From e0b87852d519cf31cee961e9c07f7af7ace9dd4c Mon Sep 17 00:00:00 2001 From: Vitaliy Potyarkin Date: Thu, 1 Jan 1970 00:00:00 +0000 Subject: [PATCH 0001/1196] Empty default branch for forked repos Signed-off-by: Vitaliy Potyarkin --- README.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..7463f9e --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# WIP area: this repo is just a fork! + +Useful things may be published only in [other branches](../../../branches) From 1cf33e5ffd17f0d11e167e3fdc8ca585cefac4b1 Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Mon, 18 Nov 2019 16:34:06 +0300 Subject: [PATCH 0002/1196] initial --- .gitattributes | 1 + .gitignore | 3 + LICENSE.md | 675 +++++ Makefile | 12 + README.md | 99 + accounting/fixtures/cheque.sh | 8 + accounting/fixtures/cheque_data | Bin 0 -> 650 bytes accounting/service.go | 49 + accounting/service.pb.go | 701 +++++ accounting/service.proto | 23 + accounting/types.go | 353 +++ accounting/types.pb.go | 3905 +++++++++++++++++++++++++++ accounting/types.proto | 106 + accounting/types_test.go | 84 + accounting/withdraw.go | 53 + accounting/withdraw.pb.go | 2641 ++++++++++++++++++ accounting/withdraw.proto | 61 + bootstrap/service.go | 11 + bootstrap/service.pb.go | 483 ++++ bootstrap/service.proto | 20 + bootstrap/types.go | 100 + bootstrap/types.pb.go | 697 +++++ bootstrap/types.proto | 22 + chain/address.go | 185 ++ chain/address_test.go | 292 ++ container/service.go | 68 + container/service.pb.go | 2131 +++++++++++++++ container/service.proto | 68 + container/types.go | 94 + container/types.pb.go | 464 ++++ container/types.proto | 16 + container/types_test.go | 57 + decimal/decimal.go | 110 + decimal/decimal.pb.go | 345 +++ decimal/decimal.proto | 14 + decimal/decimal_test.go | 445 +++ go.mod | 22 + go.sum | 165 ++ hash/hash.go | 98 + hash/hash_test.go | 166 ++ hash/hashesslice.go | 20 + hash/salt.go | 17 + internal/error.go | 7 + internal/proto.go | 16 + object/doc.go | 143 + object/extensions.go | 84 + object/service.go | 215 ++ object/service.pb.go | 4491 +++++++++++++++++++++++++++++++ object/service.proto | 119 + object/sg.go | 66 + object/sg_test.go | 87 + object/types.go | 219 ++ object/types.pb.go | 3814 ++++++++++++++++++++++++++ object/types.proto | 107 + object/utils.go | 107 + object/verification.go | 132 + object/verification_test.go | 105 + proto.go | 7 + query/types.go | 43 + query/types.pb.go | 634 +++++ query/types.proto | 25 + refs/address.go | 68 + refs/cid.go | 96 + refs/owner.go | 65 + refs/sgid.go | 14 + refs/types.go | 106 + refs/types.pb.go | 368 +++ refs/types.proto | 15 + refs/types_test.go | 112 + refs/uuid.go | 76 + service/epoch.go | 7 + service/role.go | 24 + service/role_test.go | 22 + service/sign.go | 47 + service/ttl.go | 45 + service/ttl_test.go | 72 + session/service.go | 57 + session/service.pb.go | 922 +++++++ session/service.proto | 27 + session/store.go | 81 + session/store_test.go | 84 + session/types.go | 159 ++ session/types.pb.go | 845 ++++++ session/types.proto | 22 + state/service.go | 48 + state/service.pb.go | 1111 ++++++++ state/service.proto | 37 + 87 files changed, 29835 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 LICENSE.md create mode 100644 Makefile create mode 100644 README.md create mode 100755 accounting/fixtures/cheque.sh create mode 100644 accounting/fixtures/cheque_data create mode 100644 accounting/service.go create mode 100644 accounting/service.pb.go create mode 100644 accounting/service.proto create mode 100644 accounting/types.go create mode 100644 accounting/types.pb.go create mode 100644 accounting/types.proto create mode 100644 accounting/types_test.go create mode 100644 accounting/withdraw.go create mode 100644 accounting/withdraw.pb.go create mode 100644 accounting/withdraw.proto create mode 100644 bootstrap/service.go create mode 100644 bootstrap/service.pb.go create mode 100644 bootstrap/service.proto create mode 100644 bootstrap/types.go create mode 100644 bootstrap/types.pb.go create mode 100644 bootstrap/types.proto create mode 100644 chain/address.go create mode 100644 chain/address_test.go create mode 100644 container/service.go create mode 100644 container/service.pb.go create mode 100644 container/service.proto create mode 100644 container/types.go create mode 100644 container/types.pb.go create mode 100644 container/types.proto create mode 100644 container/types_test.go create mode 100644 decimal/decimal.go create mode 100644 decimal/decimal.pb.go create mode 100644 decimal/decimal.proto create mode 100644 decimal/decimal_test.go create mode 100644 go.mod create mode 100644 go.sum create mode 100644 hash/hash.go create mode 100644 hash/hash_test.go create mode 100644 hash/hashesslice.go create mode 100644 hash/salt.go create mode 100644 internal/error.go create mode 100644 internal/proto.go create mode 100644 object/doc.go create mode 100644 object/extensions.go create mode 100644 object/service.go create mode 100644 object/service.pb.go create mode 100644 object/service.proto create mode 100644 object/sg.go create mode 100644 object/sg_test.go create mode 100644 object/types.go create mode 100644 object/types.pb.go create mode 100644 object/types.proto create mode 100644 object/utils.go create mode 100644 object/verification.go create mode 100644 object/verification_test.go create mode 100644 proto.go create mode 100644 query/types.go create mode 100644 query/types.pb.go create mode 100644 query/types.proto create mode 100644 refs/address.go create mode 100644 refs/cid.go create mode 100644 refs/owner.go create mode 100644 refs/sgid.go create mode 100644 refs/types.go create mode 100644 refs/types.pb.go create mode 100644 refs/types.proto create mode 100644 refs/types_test.go create mode 100644 refs/uuid.go create mode 100644 service/epoch.go create mode 100644 service/role.go create mode 100644 service/role_test.go create mode 100644 service/sign.go create mode 100644 service/ttl.go create mode 100644 service/ttl_test.go create mode 100644 session/service.go create mode 100644 session/service.pb.go create mode 100644 session/service.proto create mode 100644 session/store.go create mode 100644 session/store_test.go create mode 100644 session/types.go create mode 100644 session/types.pb.go create mode 100644 session/types.proto create mode 100644 state/service.go create mode 100644 state/service.pb.go create mode 100644 state/service.proto diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..b002a5d --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +/**/*.pb.go -diff binary diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..22e0c65 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +bin +temp +/vendor/ diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..5c13ba2 --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,675 @@ +### GNU GENERAL PUBLIC LICENSE + +Version 3, 29 June 2007 + +Copyright (C) 2007 Free Software Foundation, Inc. + + +Everyone is permitted to copy and distribute verbatim copies of this +license document, but changing it is not allowed. + +### Preamble + +The GNU General Public License is a free, copyleft license for +software and other kinds of works. + +The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom +to share and change all versions of a program--to make sure it remains +free software for all its users. We, the Free Software Foundation, use +the GNU General Public License for most of our software; it applies +also to any other work released this way by its authors. You can apply +it to your programs, too. + +When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + +To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you +have certain responsibilities if you distribute copies of the +software, or if you modify it: responsibilities to respect the freedom +of others. + +For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + +Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + +For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + +Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the +manufacturer can do so. This is fundamentally incompatible with the +aim of protecting users' freedom to change the software. The +systematic pattern of such abuse occurs in the area of products for +individuals to use, which is precisely where it is most unacceptable. +Therefore, we have designed this version of the GPL to prohibit the +practice for those products. If such problems arise substantially in +other domains, we stand ready to extend this provision to those +domains in future versions of the GPL, as needed to protect the +freedom of users. + +Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish +to avoid the special danger that patents applied to a free program +could make it effectively proprietary. To prevent this, the GPL +assures that patents cannot be used to render the program non-free. + +The precise terms and conditions for copying, distribution and +modification follow. + +### TERMS AND CONDITIONS + +#### 0. Definitions. + +"This License" refers to version 3 of the GNU General Public License. + +"Copyright" also means copyright-like laws that apply to other kinds +of works, such as semiconductor masks. + +"The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + +To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of +an exact copy. The resulting work is called a "modified version" of +the earlier work or a work "based on" the earlier work. + +A "covered work" means either the unmodified Program or a work based +on the Program. + +To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + +To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user +through a computer network, with no transfer of a copy, is not +conveying. + +An interactive user interface displays "Appropriate Legal Notices" to +the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + +#### 1. Source Code. + +The "source code" for a work means the preferred form of the work for +making modifications to it. "Object code" means any non-source form of +a work. + +A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + +The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + +The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + +The Corresponding Source need not include anything that users can +regenerate automatically from other parts of the Corresponding Source. + +The Corresponding Source for a work in source code form is that same +work. + +#### 2. Basic Permissions. + +All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + +You may make, run and propagate covered works that you do not convey, +without conditions so long as your license otherwise remains in force. +You may convey covered works to others for the sole purpose of having +them make modifications exclusively for you, or provide you with +facilities for running those works, provided that you comply with the +terms of this License in conveying all material for which you do not +control copyright. Those thus making or running the covered works for +you must do so exclusively on your behalf, under your direction and +control, on terms that prohibit them from making any copies of your +copyrighted material outside their relationship with you. + +Conveying under any other circumstances is permitted solely under the +conditions stated below. Sublicensing is not allowed; section 10 makes +it unnecessary. + +#### 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + +No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + +When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such +circumvention is effected by exercising rights under this License with +respect to the covered work, and you disclaim any intention to limit +operation or modification of the work as a means of enforcing, against +the work's users, your or third parties' legal rights to forbid +circumvention of technological measures. + +#### 4. Conveying Verbatim Copies. + +You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + +You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + +#### 5. Conveying Modified Source Versions. + +You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these +conditions: + +- a) The work must carry prominent notices stating that you modified +it, and giving a relevant date. +- b) The work must carry prominent notices stating that it is +released under this License and any conditions added under +section 7. This requirement modifies the requirement in section 4 +to "keep intact all notices". +- c) You must license the entire work, as a whole, under this +License to anyone who comes into possession of a copy. This +License will therefore apply, along with any applicable section 7 +additional terms, to the whole of the work, and all its parts, +regardless of how they are packaged. This License gives no +permission to license the work in any other way, but it does not +invalidate such permission if you have separately received it. +- d) If the work has interactive user interfaces, each must display +Appropriate Legal Notices; however, if the Program has interactive +interfaces that do not display Appropriate Legal Notices, your +work need not make them do so. + +A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + +#### 6. Conveying Non-Source Forms. + +You may convey a covered work in object code form under the terms of +sections 4 and 5, provided that you also convey the machine-readable +Corresponding Source under the terms of this License, in one of these +ways: + +- a) Convey the object code in, or embodied in, a physical product +(including a physical distribution medium), accompanied by the +Corresponding Source fixed on a durable physical medium +customarily used for software interchange. +- b) Convey the object code in, or embodied in, a physical product +(including a physical distribution medium), accompanied by a +written offer, valid for at least three years and valid for as +long as you offer spare parts or customer support for that product +model, to give anyone who possesses the object code either (1) a +copy of the Corresponding Source for all the software in the +product that is covered by this License, on a durable physical +medium customarily used for software interchange, for a price no +more than your reasonable cost of physically performing this +conveying of source, or (2) access to copy the Corresponding +Source from a network server at no charge. +- c) Convey individual copies of the object code with a copy of the +written offer to provide the Corresponding Source. This +alternative is allowed only occasionally and noncommercially, and +only if you received the object code with such an offer, in accord +with subsection 6b. +- d) Convey the object code by offering access from a designated +place (gratis or for a charge), and offer equivalent access to the +Corresponding Source in the same way through the same place at no +further charge. You need not require recipients to copy the +Corresponding Source along with the object code. If the place to +copy the object code is a network server, the Corresponding Source +may be on a different server (operated by you or a third party) +that supports equivalent copying facilities, provided you maintain +clear directions next to the object code saying where to find the +Corresponding Source. Regardless of what server hosts the +Corresponding Source, you remain obligated to ensure that it is +available for as long as needed to satisfy these requirements. +- e) Convey the object code using peer-to-peer transmission, +provided you inform other peers where the object code and +Corresponding Source of the work are being offered to the general +public at no charge under subsection 6d. + +A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + +A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, +family, or household purposes, or (2) anything designed or sold for +incorporation into a dwelling. In determining whether a product is a +consumer product, doubtful cases shall be resolved in favor of +coverage. For a particular product received by a particular user, +"normally used" refers to a typical or common use of that class of +product, regardless of the status of the particular user or of the way +in which the particular user actually uses, or expects or is expected +to use, the product. A product is a consumer product regardless of +whether the product has substantial commercial, industrial or +non-consumer uses, unless such uses represent the only significant +mode of use of the product. + +"Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to +install and execute modified versions of a covered work in that User +Product from a modified version of its Corresponding Source. The +information must suffice to ensure that the continued functioning of +the modified object code is in no case prevented or interfered with +solely because modification has been made. + +If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + +The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or +updates for a work that has been modified or installed by the +recipient, or for the User Product in which it has been modified or +installed. Access to a network may be denied when the modification +itself materially and adversely affects the operation of the network +or violates the rules and protocols for communication across the +network. + +Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + +#### 7. Additional Terms. + +"Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + +When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + +Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders +of that material) supplement the terms of this License with terms: + +- a) Disclaiming warranty or limiting liability differently from the +terms of sections 15 and 16 of this License; or +- b) Requiring preservation of specified reasonable legal notices or +author attributions in that material or in the Appropriate Legal +Notices displayed by works containing it; or +- c) Prohibiting misrepresentation of the origin of that material, +or requiring that modified versions of such material be marked in +reasonable ways as different from the original version; or +- d) Limiting the use for publicity purposes of names of licensors +or authors of the material; or +- e) Declining to grant rights under trademark law for use of some +trade names, trademarks, or service marks; or +- f) Requiring indemnification of licensors and authors of that +material by anyone who conveys the material (or modified versions +of it) with contractual assumptions of liability to the recipient, +for any liability that these contractual assumptions directly +impose on those licensors and authors. + +All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + +If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + +Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; the +above requirements apply either way. + +#### 8. Termination. + +You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + +However, if you cease all violation of this License, then your license +from a particular copyright holder is reinstated (a) provisionally, +unless and until the copyright holder explicitly and finally +terminates your license, and (b) permanently, if the copyright holder +fails to notify you of the violation by some reasonable means prior to +60 days after the cessation. + +Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + +Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + +#### 9. Acceptance Not Required for Having Copies. + +You are not required to accept this License in order to receive or run +a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + +#### 10. Automatic Licensing of Downstream Recipients. + +Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + +An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + +You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + +#### 11. Patents. + +A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + +A contributor's "essential patent claims" are all patent claims owned +or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + +Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + +In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + +If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + +If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + +A patent license is "discriminatory" if it does not include within the +scope of its coverage, prohibits the exercise of, or is conditioned on +the non-exercise of one or more of the rights that are specifically +granted under this License. You may not convey a covered work if you +are a party to an arrangement with a third party that is in the +business of distributing software, under which you make payment to the +third party based on the extent of your activity of conveying the +work, and under which the third party grants, to any of the parties +who would receive the covered work from you, a discriminatory patent +license (a) in connection with copies of the covered work conveyed by +you (or copies made from those copies), or (b) primarily for and in +connection with specific products or compilations that contain the +covered work, unless you entered into that arrangement, or that patent +license was granted, prior to 28 March 2007. + +Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + +#### 12. No Surrender of Others' Freedom. + +If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under +this License and any other pertinent obligations, then as a +consequence you may not convey it at all. For example, if you agree to +terms that obligate you to collect a royalty for further conveying +from those to whom you convey the Program, the only way you could +satisfy both those terms and this License would be to refrain entirely +from conveying the Program. + +#### 13. Use with the GNU Affero General Public License. + +Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + +#### 14. Revised Versions of this License. + +The Free Software Foundation may publish revised and/or new versions +of the GNU General Public License from time to time. Such new versions +will be similar in spirit to the present version, but may differ in +detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies that a certain numbered version of the GNU General Public +License "or any later version" applies to it, you have the option of +following the terms and conditions either of that numbered version or +of any later version published by the Free Software Foundation. If the +Program does not specify a version number of the GNU General Public +License, you may choose any version ever published by the Free +Software Foundation. + +If the Program specifies that a proxy can decide which future versions +of the GNU General Public License can be used, that proxy's public +statement of acceptance of a version permanently authorizes you to +choose that version for the Program. + +Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + +#### 15. Disclaimer of Warranty. + +THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT +WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND +PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE +DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR +CORRECTION. + +#### 16. Limitation of Liability. + +IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR +CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES +ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT +NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR +LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM +TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER +PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +#### 17. Interpretation of Sections 15 and 16. + +If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + +END OF TERMS AND CONDITIONS + +### How to Apply These Terms to Your New Programs + +If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these +terms. + +To do so, attach the following notices to the program. It is safest to +attach them to the start of each source file to most effectively state +the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + +Copyright (C) + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +Also add information on how to contact you by electronic and paper +mail. + +If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) +This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands \`show w' and \`show c' should show the +appropriate parts of the General Public License. Of course, your +program's commands might be different; for a GUI interface, you would +use an "about box". + +You should also get your employer (if you work as a programmer) or +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. For more information on this, and how to apply and follow +the GNU GPL, see . + +The GNU General Public License does not permit incorporating your +program into proprietary programs. If your program is a subroutine +library, you may consider it more useful to permit linking proprietary +applications with the library. If this is what you want to do, use the +GNU Lesser General Public License instead of this License. But first, +please read . \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..c17477a --- /dev/null +++ b/Makefile @@ -0,0 +1,12 @@ +protoc: + @go mod tidy -v + @go mod vendor + # Install specific version for gogo-proto + @go list -f '{{.Path}}/...@{{.Version}}' -m github.com/gogo/protobuf | xargs go get -v + # Install specific version for protobuf lib + @go list -f '{{.Path}}/...@{{.Version}}' -m github.com/golang/protobuf | xargs go get -v + # Protoc generate + @find . -type f -name '*.proto' -not -path './vendor/*' \ + -exec protoc \ + --proto_path=.:./vendor \ + --gofast_out=plugins=grpc,paths=source_relative:. '{}' \; diff --git a/README.md b/README.md new file mode 100644 index 0000000..9247a10 --- /dev/null +++ b/README.md @@ -0,0 +1,99 @@ +# NeoFS-proto + +NeoFS-proto repository contains implementation of core NeoFS structures that +can be used for integration with NeoFS. + +## Description + +Repository contains 13 packages that implement NeoFS core structures. These +packages mostly contain protobuf files with service and structure definitions +or NeoFS core types with complemented functions. + +### Accounting + +Accounting package defines services and structures for accounting operations: +balance request and `cheque` operations for withdraw. `Cheque` is a structure +with inner ring signatures, which approve that user can withdraw requested +amount of assets. NeoFS smart contract takes binary formatted `cheque` as a +parameter in withdraw call. + +### Bootstrap + +Bootstrap package defines bootstrap service which is used by storage nodes to +connect to the storage network. + +### Chain + +Chain package contains util functions for operations with NEO Blockchain types: +wallet addresses, script-hashes. + +### Container + +Container package defines service and structures for operations with containers. +Objects in NeoFS are stored in containers. Container defines storage +policy for the objects. + +### Decimal + +Decimal defines custom decimal implementation which is used in accounting +operations. + +### Hash + +Hash package defines homomorphic hash type. + +### Internal + +Internal package defines constant error type and proto interface for custom +protobuf structures. + +### Object + +Object package defines service and structures for object operations. Object is +a core storage structure in NeoFS. Package contains detailed information +about object internal structure. + +### Query + +Query package defines structure for object search requests. + +### Refs + +Refs package defines core identity types: Object ID, Container ID, etc. + +### Service + +Service package defines util structure and functions for all NeoFS services +operations: TTL and request signature management, node roles, epoch retriever. + +### Session + +Session package defines service and structures for session obtain. Object +operations require an established session with pair of session keys signed by +owner of the object. + +### State + +State package defines service and structures for metrics gathering. + +## How to use + +NeoFS-proto packages contain godoc documentation. Examples of using most of +these packages can be found in NeoFS-CLI repository. CLI implements and +demonstrates all basic interactions with NeoFS: container, object, storage +group, and accounting operations. + +Protobuf files are recompiled with the command: + +``` +$ make protoc +``` + +## Contributing + +At this moment, we do not accept contributions. + +## License + +This project is licensed under the GPLv3 License - +see the [LICENSE.md](LICENSE.md) file for details diff --git a/accounting/fixtures/cheque.sh b/accounting/fixtures/cheque.sh new file mode 100755 index 0000000..9336813 --- /dev/null +++ b/accounting/fixtures/cheque.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +CHEQUE=d6520dabb6cb9b981792608c73670eff14775e9a65bbc189271723ba2703c53263e8d6e522dc32203339dcd8eee9c6b7439a0000000053724e000000000000001e61000603012d47e76210aec73be39ab3d186e0a40fe8d86bfa3d4fabfda57ba13b88f96abe1de4c7ecd46cb32081c0ff199e0b32708d2ce709dd146ce096484073a9b15a259ca799f8d848eb5bea16f6d0842a0181ccd47384af2cdb0fd0af0819e8a08802f7528ce97c9a93558efe7d4f62577aabdf771c931f54a71be6ad21e7d9cc1777686ad19b5dc4b80d7b8decf90054c5aad66c0e6fe63d8473b751cd77c1bd0557516e0f3e7d0ccb485809023b0c08a89f33ae38b2f99ce3f1ebc7905dddf0ed0f023e00f03a16e8707ce045eb42ee80d392451541ee510dc18e1c8befbac54d7426087d37d32d836537d317deafbbd193002a36f80fbdfbf3a730cf011bc6c75c7e6d5724f3adee7015fcb3068d321e2ae555e79107be0c46070efdae2f724dbc9f0340750b92789821683283bcb98e32b7e032b94f267b6964613fc31a7ce5813fddeea47a1db525634237e924178b5c8ea745549ae60aa3570ce6cf52e370e6ab87652bdf8a179176f1acaf48896bef9ab300818a53f410d86241d506a550f4915403fef27f744e829131d0ec980829fafa51db1714c2761d9f78762c008c323e9d6612e4f9efdc609f191fd9ca5431dd9dc037130150107ab8769780d728e9ffdf314019b57c8d2b940b9ec078afa951ed8b06c1bf352edd2037e29b8f24cca3ec700368a6f5829fb2a34fa03d0308ae6b05f433f2904d9a852fed1f5d2eb598ca79475b74ef6394e712d275cd798062c6d8e41fad822ac5a4fcb167f0a2e196f61f9f65a0adef9650f49150e7eb7bb08dd1739fa6e86b341f1b2cf5657fcd200637e8 +DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) + +echo $CHEQUE | xxd -p -r > $DIR/cheque_data + +exit 0 diff --git a/accounting/fixtures/cheque_data b/accounting/fixtures/cheque_data new file mode 100644 index 0000000000000000000000000000000000000000..cd7b286642c3d1fc8d0080985c4d070013761b63 GIT binary patch literal 650 zcmV;50(Je?QVpxN%bS=Nl3BhH1ng9R*08?^K000000000UVE_gL0WC-8Vi2y!JL8(O(T3op59ruy`aMsp{iS=M zJBayez8&Pp?9^3o`#RgV6BPhwYktKWAVlOI&48|JMc=h@5`cW7$S zn_a}X4SS93`2bYKs@7}{Z{|IObGK2=cfq{{S5a;cK79q72;(~?CMLGDov!Hyh@@4CfJbS4OWH`6VHWjE6o z-mkmSlK?6<_z%7N^QSP+0UO50Tz+j=B=fEAa25Qs28}WvD&(&r;)X=BtNgE8mJ2k#_N{uSkh&@0zm!fr?Y~5ZGct)drs++d#>AKA)OG2NZOHxmI+5PGHps`KpC}sjVqK3p1^posZs5V2Eo5IF5MtE;+u~o%%kjZ18Ao8f}gUZPoO;m z2(D`d^fU61O`3%-?H^q(wV29zM_Y97W0dC-(sj*wfMUkjR literal 0 HcmV?d00001 diff --git a/accounting/service.go b/accounting/service.go new file mode 100644 index 0000000..df74e58 --- /dev/null +++ b/accounting/service.go @@ -0,0 +1,49 @@ +package accounting + +import ( + "github.com/nspcc-dev/neofs-proto/decimal" + "github.com/nspcc-dev/neofs-proto/internal" + "github.com/nspcc-dev/neofs-proto/refs" +) + +type ( + // OwnerID type alias. + OwnerID = refs.OwnerID + + // Decimal type alias. + Decimal = decimal.Decimal + + // Filter is used to filter accounts by criteria. + Filter func(acc *Account) bool +) + +const ( + // ErrEmptyAddress is raised when passed Address is empty. + ErrEmptyAddress = internal.Error("empty address") + + // ErrEmptyLockTarget is raised when passed LockTarget is empty. + ErrEmptyLockTarget = internal.Error("empty lock target") + + // ErrEmptyContainerID is raised when passed CID is empty. + ErrEmptyContainerID = internal.Error("empty container ID") + + // ErrEmptyParentAddress is raised when passed ParentAddress is empty. + ErrEmptyParentAddress = internal.Error("empty parent address") +) + +// SetTTL sets ttl to BalanceRequest to satisfy TTLRequest interface. +func (m BalanceRequest) SetTTL(v uint32) { m.TTL = v } + +// SumFunds goes through all accounts and sums up active funds. +func SumFunds(accounts []*Account) (res *decimal.Decimal) { + res = decimal.Zero.Copy() + + for i := range accounts { + if accounts[i] == nil { + continue + } + + res = res.Add(accounts[i].ActiveFunds) + } + return +} diff --git a/accounting/service.pb.go b/accounting/service.pb.go new file mode 100644 index 0000000..8708db3 --- /dev/null +++ b/accounting/service.pb.go @@ -0,0 +1,701 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: accounting/service.proto + +package accounting + +import ( + context "context" + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/golang/protobuf/proto" + decimal "github.com/nspcc-dev/neofs-proto/decimal" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package + +type BalanceRequest struct { + OwnerID OwnerID `protobuf:"bytes,1,opt,name=OwnerID,proto3,customtype=OwnerID" json:"OwnerID"` + TTL uint32 `protobuf:"varint,2,opt,name=TTL,proto3" json:"TTL,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *BalanceRequest) Reset() { *m = BalanceRequest{} } +func (m *BalanceRequest) String() string { return proto.CompactTextString(m) } +func (*BalanceRequest) ProtoMessage() {} +func (*BalanceRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_7f9514b8f1d4c7fe, []int{0} +} +func (m *BalanceRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *BalanceRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *BalanceRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_BalanceRequest.Merge(m, src) +} +func (m *BalanceRequest) XXX_Size() int { + return m.Size() +} +func (m *BalanceRequest) XXX_DiscardUnknown() { + xxx_messageInfo_BalanceRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_BalanceRequest proto.InternalMessageInfo + +func (m *BalanceRequest) GetTTL() uint32 { + if m != nil { + return m.TTL + } + return 0 +} + +type BalanceResponse struct { + Balance *decimal.Decimal `protobuf:"bytes,1,opt,name=Balance,proto3" json:"Balance,omitempty"` + LockAccounts []*Account `protobuf:"bytes,2,rep,name=LockAccounts,proto3" json:"LockAccounts,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *BalanceResponse) Reset() { *m = BalanceResponse{} } +func (m *BalanceResponse) String() string { return proto.CompactTextString(m) } +func (*BalanceResponse) ProtoMessage() {} +func (*BalanceResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_7f9514b8f1d4c7fe, []int{1} +} +func (m *BalanceResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *BalanceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *BalanceResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_BalanceResponse.Merge(m, src) +} +func (m *BalanceResponse) XXX_Size() int { + return m.Size() +} +func (m *BalanceResponse) XXX_DiscardUnknown() { + xxx_messageInfo_BalanceResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_BalanceResponse proto.InternalMessageInfo + +func (m *BalanceResponse) GetBalance() *decimal.Decimal { + if m != nil { + return m.Balance + } + return nil +} + +func (m *BalanceResponse) GetLockAccounts() []*Account { + if m != nil { + return m.LockAccounts + } + return nil +} + +func init() { + proto.RegisterType((*BalanceRequest)(nil), "accounting.BalanceRequest") + proto.RegisterType((*BalanceResponse)(nil), "accounting.BalanceResponse") +} + +func init() { proto.RegisterFile("accounting/service.proto", fileDescriptor_7f9514b8f1d4c7fe) } + +var fileDescriptor_7f9514b8f1d4c7fe = []byte{ + // 311 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x48, 0x4c, 0x4e, 0xce, + 0x2f, 0xcd, 0x2b, 0xc9, 0xcc, 0x4b, 0xd7, 0x2f, 0x4e, 0x2d, 0x2a, 0xcb, 0x4c, 0x4e, 0xd5, 0x2b, + 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x42, 0xc8, 0x48, 0x89, 0xa6, 0xa4, 0x26, 0x67, 0xe6, 0x26, + 0xe6, 0xe8, 0x43, 0x69, 0x88, 0x12, 0x29, 0x31, 0x24, 0xcd, 0x25, 0x95, 0x05, 0xa9, 0xc5, 0x50, + 0x71, 0xdd, 0xf4, 0xcc, 0x92, 0x8c, 0xd2, 0x24, 0xbd, 0xe4, 0xfc, 0x5c, 0xfd, 0xf4, 0xfc, 0xf4, + 0x7c, 0x7d, 0xb0, 0x70, 0x52, 0x69, 0x1a, 0x98, 0x07, 0xe6, 0x80, 0x59, 0x10, 0xe5, 0x4a, 0xbe, + 0x5c, 0x7c, 0x4e, 0x89, 0x39, 0x89, 0x79, 0xc9, 0xa9, 0x41, 0xa9, 0x85, 0xa5, 0xa9, 0xc5, 0x25, + 0x42, 0x9a, 0x5c, 0xec, 0xfe, 0xe5, 0x79, 0xa9, 0x45, 0x9e, 0x2e, 0x12, 0x8c, 0x0a, 0x8c, 0x1a, + 0x3c, 0x4e, 0xfc, 0x27, 0xee, 0xc9, 0x33, 0xdc, 0xba, 0x27, 0x0f, 0x13, 0x0e, 0x82, 0x31, 0x84, + 0x04, 0xb8, 0x98, 0x43, 0x42, 0x7c, 0x24, 0x98, 0x14, 0x18, 0x35, 0x78, 0x83, 0x40, 0x4c, 0xa5, + 0x32, 0x2e, 0x7e, 0xb8, 0x71, 0xc5, 0x05, 0xf9, 0x79, 0xc5, 0xa9, 0x42, 0x5a, 0x5c, 0xec, 0x50, + 0x21, 0xb0, 0x79, 0xdc, 0x46, 0x02, 0x7a, 0x30, 0x9f, 0xb8, 0x40, 0xe8, 0x20, 0x98, 0x02, 0x21, + 0x73, 0x2e, 0x1e, 0x9f, 0xfc, 0xe4, 0x6c, 0x47, 0x88, 0xd7, 0x8a, 0x25, 0x98, 0x14, 0x98, 0x35, + 0xb8, 0x8d, 0x84, 0xf5, 0x10, 0x7e, 0xd5, 0x83, 0xca, 0x05, 0xa1, 0x28, 0x34, 0x0a, 0xe0, 0xe2, + 0x72, 0x84, 0xab, 0x11, 0x72, 0x82, 0x5b, 0x29, 0x24, 0x85, 0xac, 0x17, 0xd5, 0xa7, 0x52, 0xd2, + 0x58, 0xe5, 0x20, 0xce, 0x76, 0x72, 0x3c, 0xf1, 0x48, 0x8e, 0xf1, 0xc2, 0x23, 0x39, 0xc6, 0x1b, + 0x8f, 0xe4, 0x18, 0x1f, 0x3c, 0x92, 0x63, 0x9c, 0xf1, 0x58, 0x8e, 0x21, 0x4a, 0x1b, 0x29, 0x74, + 0xf3, 0x8a, 0x0b, 0x92, 0x93, 0x75, 0x53, 0x52, 0xcb, 0xf4, 0xf3, 0x52, 0xf3, 0xd3, 0x8a, 0x75, + 0x21, 0x61, 0x8b, 0x30, 0x32, 0x89, 0x0d, 0x2c, 0x62, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0x0c, + 0x45, 0x3c, 0x0a, 0xe8, 0x01, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// AccountingClient is the client API for Accounting service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type AccountingClient interface { + Balance(ctx context.Context, in *BalanceRequest, opts ...grpc.CallOption) (*BalanceResponse, error) +} + +type accountingClient struct { + cc *grpc.ClientConn +} + +func NewAccountingClient(cc *grpc.ClientConn) AccountingClient { + return &accountingClient{cc} +} + +func (c *accountingClient) Balance(ctx context.Context, in *BalanceRequest, opts ...grpc.CallOption) (*BalanceResponse, error) { + out := new(BalanceResponse) + err := c.cc.Invoke(ctx, "/accounting.Accounting/Balance", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// AccountingServer is the server API for Accounting service. +type AccountingServer interface { + Balance(context.Context, *BalanceRequest) (*BalanceResponse, error) +} + +// UnimplementedAccountingServer can be embedded to have forward compatible implementations. +type UnimplementedAccountingServer struct { +} + +func (*UnimplementedAccountingServer) Balance(ctx context.Context, req *BalanceRequest) (*BalanceResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Balance not implemented") +} + +func RegisterAccountingServer(s *grpc.Server, srv AccountingServer) { + s.RegisterService(&_Accounting_serviceDesc, srv) +} + +func _Accounting_Balance_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(BalanceRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AccountingServer).Balance(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/accounting.Accounting/Balance", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AccountingServer).Balance(ctx, req.(*BalanceRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Accounting_serviceDesc = grpc.ServiceDesc{ + ServiceName: "accounting.Accounting", + HandlerType: (*AccountingServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Balance", + Handler: _Accounting_Balance_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "accounting/service.proto", +} + +func (m *BalanceRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *BalanceRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BalanceRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.TTL != 0 { + i = encodeVarintService(dAtA, i, uint64(m.TTL)) + i-- + dAtA[i] = 0x10 + } + { + size := m.OwnerID.Size() + i -= size + if _, err := m.OwnerID.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *BalanceResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *BalanceResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BalanceResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.LockAccounts) > 0 { + for iNdEx := len(m.LockAccounts) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.LockAccounts[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if m.Balance != nil { + { + size, err := m.Balance.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintService(dAtA []byte, offset int, v uint64) int { + offset -= sovService(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *BalanceRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.OwnerID.Size() + n += 1 + l + sovService(uint64(l)) + if m.TTL != 0 { + n += 1 + sovService(uint64(m.TTL)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *BalanceResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Balance != nil { + l = m.Balance.Size() + n += 1 + l + sovService(uint64(l)) + } + if len(m.LockAccounts) > 0 { + for _, e := range m.LockAccounts { + l = e.Size() + n += 1 + l + sovService(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovService(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozService(x uint64) (n int) { + return sovService(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *BalanceRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: BalanceRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BalanceRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OwnerID", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.OwnerID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TTL", wireType) + } + m.TTL = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TTL |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *BalanceResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: BalanceResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BalanceResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Balance", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Balance == nil { + m.Balance = &decimal.Decimal{} + } + if err := m.Balance.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LockAccounts", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.LockAccounts = append(m.LockAccounts, &Account{}) + if err := m.LockAccounts[len(m.LockAccounts)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipService(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowService + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowService + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowService + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthService + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupService + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthService + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthService = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowService = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupService = fmt.Errorf("proto: unexpected end of group") +) diff --git a/accounting/service.proto b/accounting/service.proto new file mode 100644 index 0000000..b75bf9c --- /dev/null +++ b/accounting/service.proto @@ -0,0 +1,23 @@ +syntax = "proto3"; +package accounting; +option go_package = "github.com/nspcc-dev/neofs-proto/accounting"; + +import "decimal/decimal.proto"; +import "accounting/types.proto"; +import "github.com/gogo/protobuf/gogoproto/gogo.proto"; + +option (gogoproto.stable_marshaler_all) = true; + +service Accounting { + rpc Balance(BalanceRequest) returns (BalanceResponse); +} + +message BalanceRequest { + bytes OwnerID = 1 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false]; + uint32 TTL = 2; +} + +message BalanceResponse { + decimal.Decimal Balance = 1; + repeated Account LockAccounts = 2; +} diff --git a/accounting/types.go b/accounting/types.go new file mode 100644 index 0000000..9c76fc7 --- /dev/null +++ b/accounting/types.go @@ -0,0 +1,353 @@ +package accounting + +import ( + "crypto/ecdsa" + "crypto/rand" + "encoding/binary" + "reflect" + + "github.com/mr-tron/base58" + crypto "github.com/nspcc-dev/neofs-crypto" + "github.com/nspcc-dev/neofs-proto/chain" + "github.com/nspcc-dev/neofs-proto/decimal" + "github.com/nspcc-dev/neofs-proto/internal" + "github.com/nspcc-dev/neofs-proto/refs" + "github.com/pkg/errors" +) + +type ( + // Cheque structure that describes a user request for withdrawal of funds. + Cheque struct { + ID ChequeID + Owner refs.OwnerID + Amount *decimal.Decimal + Height uint64 + Signatures []ChequeSignature + } + + // BalanceReceiver interface that is used to retrieve user balance by address. + BalanceReceiver interface { + Balance(accountAddress string) (*Account, error) + } + + // ChequeID is identifier of user request for withdrawal of funds. + ChequeID string + + // CID type alias. + CID = refs.CID + + // SGID type alias. + SGID = refs.SGID + + // ChequeSignature contains public key and hash, and is used to verify signatures. + ChequeSignature struct { + Key *ecdsa.PublicKey + Hash []byte + } +) + +const ( + // ErrWrongSignature is raised when wrong signature is passed. + ErrWrongSignature = internal.Error("wrong signature") + + // ErrWrongPublicKey is raised when wrong public key is passed. + ErrWrongPublicKey = internal.Error("wrong public key") + + // ErrWrongChequeData is raised when passed bytes cannot not be parsed as valid Cheque. + ErrWrongChequeData = internal.Error("wrong cheque data") + + // ErrInvalidLength is raised when passed bytes cannot not be parsed as valid ChequeID. + ErrInvalidLength = internal.Error("invalid length") + + u16size = 2 + u64size = 8 + + signaturesOffset = chain.AddressLength + refs.OwnerIDSize + u64size + u64size +) + +// NewChequeID generates valid random ChequeID using crypto/rand.Reader. +func NewChequeID() (ChequeID, error) { + d := make([]byte, chain.AddressLength) + if _, err := rand.Read(d); err != nil { + return "", err + } + + id := base58.Encode(d) + + return ChequeID(id), nil +} + +// String returns string representation of ChequeID. +func (b ChequeID) String() string { return string(b) } + +// Empty returns true, if ChequeID is empty. +func (b ChequeID) Empty() bool { return len(b) == 0 } + +// Valid validates ChequeID. +func (b ChequeID) Valid() bool { + d, err := base58.Decode(string(b)) + return err == nil && len(d) == chain.AddressLength +} + +// Bytes returns bytes representation of ChequeID. +func (b ChequeID) Bytes() []byte { + d, err := base58.Decode(string(b)) + if err != nil { + return make([]byte, chain.AddressLength) + } + return d +} + +// Equal checks that current ChequeID is equal to passed ChequeID. +func (b ChequeID) Equal(b2 ChequeID) bool { + return b.Valid() && b2.Valid() && string(b) == string(b2) +} + +// Unmarshal tries to parse []byte into valid ChequeID. +func (b *ChequeID) Unmarshal(data []byte) error { + *b = ChequeID(base58.Encode(data)) + if !b.Valid() { + return ErrInvalidLength + } + return nil +} + +// Size returns size (chain.AddressLength). +func (b ChequeID) Size() int { + return chain.AddressLength +} + +// MarshalTo tries to marshal ChequeID into passed bytes and returns +// count of copied bytes or error, if bytes len is not enough to contain ChequeID. +func (b ChequeID) MarshalTo(data []byte) (int, error) { + if len(data) < chain.AddressLength { + return 0, ErrInvalidLength + } + return copy(data, b.Bytes()), nil +} + +// Equals checks that m and tx are valid and equal Tx values. +func (m Tx) Equals(tx Tx) bool { + return m.From == tx.From && + m.To == tx.To && + m.Type == tx.Type && + m.Amount == tx.Amount +} + +// Verify validates current Cheque and Signatures that are generated for current Cheque. +func (b Cheque) Verify() error { + data := b.marshalBody() + for i, sign := range b.Signatures { + if err := crypto.VerifyRFC6979(sign.Key, data, sign.Hash); err != nil { + return errors.Wrapf(ErrWrongSignature, "item #%d: %s", i, err.Error()) + } + } + + return nil +} + +// Sign is used to sign current Cheque and stores result inside b.Signatures. +func (b *Cheque) Sign(key *ecdsa.PrivateKey) error { + hash, err := crypto.SignRFC6979(key, b.marshalBody()) + if err != nil { + return err + } + + b.Signatures = append(b.Signatures, ChequeSignature{ + Key: &key.PublicKey, + Hash: hash, + }) + + return nil +} + +func (b *Cheque) marshalBody() []byte { + buf := make([]byte, signaturesOffset) + + var offset int + + offset += copy(buf, b.ID.Bytes()) + offset += copy(buf[offset:], b.Owner.Bytes()) + + binary.BigEndian.PutUint64(buf[offset:], uint64(b.Amount.Value)) + offset += u64size + + binary.BigEndian.PutUint64(buf[offset:], b.Height) + + return buf +} + +func (b *Cheque) unmarshalBody(buf []byte) error { + var offset int + + if len(buf) < signaturesOffset { + return ErrWrongChequeData + } + + { // unmarshal UUID + if err := b.ID.Unmarshal(buf[offset : offset+chain.AddressLength]); err != nil { + return err + } + offset += chain.AddressLength + } + + { // unmarshal OwnerID + if err := b.Owner.Unmarshal(buf[offset : offset+refs.OwnerIDSize]); err != nil { + return err + } + offset += refs.OwnerIDSize + } + + { // unmarshal amount + amount := int64(binary.BigEndian.Uint64(buf[offset:])) + b.Amount = decimal.New(amount) + offset += u64size + } + + { // unmarshal height + b.Height = binary.BigEndian.Uint64(buf[offset:]) + offset += u64size + } + + return nil +} + +// MarshalBinary is used to marshal Cheque into bytes. +func (b Cheque) MarshalBinary() ([]byte, error) { + var ( + count = len(b.Signatures) + buf = make([]byte, b.Size()) + offset = copy(buf, b.marshalBody()) + ) + + binary.BigEndian.PutUint16(buf[offset:], uint16(count)) + offset += u16size + + for _, sign := range b.Signatures { + key := crypto.MarshalPublicKey(sign.Key) + offset += copy(buf[offset:], key) + offset += copy(buf[offset:], sign.Hash) + } + + return buf, nil +} + +// Size returns size of Cheque (count of bytes needs to store it). +func (b Cheque) Size() int { + return signaturesOffset + u16size + + len(b.Signatures)*(crypto.PublicKeyCompressedSize+crypto.RFC6979SignatureSize) +} + +// UnmarshalBinary tries to parse []byte into valid Cheque. +func (b *Cheque) UnmarshalBinary(buf []byte) error { + if err := b.unmarshalBody(buf); err != nil { + return err + } + + body := buf[:signaturesOffset] + + count := int64(binary.BigEndian.Uint16(buf[signaturesOffset:])) + offset := signaturesOffset + u16size + + if ln := count * int64(crypto.PublicKeyCompressedSize+crypto.RFC6979SignatureSize); ln > int64(len(buf[offset:])) { + return ErrWrongChequeData + } + + for i := int64(0); i < count; i++ { + sign := ChequeSignature{ + Key: crypto.UnmarshalPublicKey(buf[offset : offset+crypto.PublicKeyCompressedSize]), + Hash: make([]byte, crypto.RFC6979SignatureSize), + } + + offset += crypto.PublicKeyCompressedSize + if sign.Key == nil { + return errors.Wrapf(ErrWrongPublicKey, "item #%d", i) + } + + offset += copy(sign.Hash, buf[offset:offset+crypto.RFC6979SignatureSize]) + if err := crypto.VerifyRFC6979(sign.Key, body, sign.Hash); err != nil { + return errors.Wrapf(ErrWrongSignature, "item #%d: %s (offset=%d, len=%d)", i, err.Error(), offset, len(sign.Hash)) + } + + b.Signatures = append(b.Signatures, sign) + } + + return nil +} + +// ErrNotEnoughFunds generates error using address and amounts. +func ErrNotEnoughFunds(addr string, needed, residue *decimal.Decimal) error { + return errors.Errorf("not enough funds (requested=%s, residue=%s, addr=%s", needed, residue, addr) +} + +func (m *Account) hasLockAcc(addr string) bool { + for i := range m.LockAccounts { + if m.LockAccounts[i].Address == addr { + return true + } + } + return false +} + +// ValidateLock checks that account can be locked. +func (m *Account) ValidateLock() error { + switch { + case m.Address == "": + return ErrEmptyAddress + case m.ParentAddress == "": + return ErrEmptyParentAddress + case m.LockTarget == nil: + return ErrEmptyLockTarget + } + + switch v := m.LockTarget.Target.(type) { + case *LockTarget_WithdrawTarget: + if v.WithdrawTarget.Cheque != m.Address { + return errors.Errorf("wrong cheque ID: expected %s, has %s", m.Address, v.WithdrawTarget.Cheque) + } + case *LockTarget_ContainerCreateTarget: + switch { + case v.ContainerCreateTarget.CID.Empty(): + return ErrEmptyContainerID + } + } + return nil +} + +// CanLock checks possibility to lock funds. +func (m *Account) CanLock(lockAcc *Account) error { + switch { + case m.ActiveFunds.LT(lockAcc.ActiveFunds): + return ErrNotEnoughFunds(lockAcc.ParentAddress, lockAcc.ActiveFunds, m.ActiveFunds) + case m.hasLockAcc(lockAcc.Address): + return errors.Errorf("could not lock account(%s) funds: duplicating lock(%s)", m.Address, lockAcc.Address) + default: + return nil + } +} + +// LockForWithdraw checks that account contains locked funds by passed ChequeID. +func (m *Account) LockForWithdraw(chequeID string) bool { + switch v := m.LockTarget.Target.(type) { + case *LockTarget_WithdrawTarget: + return v.WithdrawTarget.Cheque == chequeID + } + return false +} + +// LockForContainerCreate checks that account contains locked funds for container creation. +func (m *Account) LockForContainerCreate(cid refs.CID) bool { + switch v := m.LockTarget.Target.(type) { + case *LockTarget_ContainerCreateTarget: + return v.ContainerCreateTarget.CID.Equal(cid) + } + return false +} + +// Equal checks that current Settlement is equal to passed Settlement. +func (m *Settlement) Equal(s *Settlement) bool { + if s == nil || m.Epoch != s.Epoch || len(m.Transactions) != len(s.Transactions) { + return false + } + return len(m.Transactions) == 0 || reflect.DeepEqual(m.Transactions, s.Transactions) +} diff --git a/accounting/types.pb.go b/accounting/types.pb.go new file mode 100644 index 0000000..cb4b0c8 --- /dev/null +++ b/accounting/types.pb.go @@ -0,0 +1,3905 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: accounting/types.proto + +package accounting + +import ( + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/golang/protobuf/proto" + decimal "github.com/nspcc-dev/neofs-proto/decimal" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package + +type Lifetime_Unit int32 + +const ( + Lifetime_Unlimited Lifetime_Unit = 0 + Lifetime_NeoFSEpoch Lifetime_Unit = 1 + Lifetime_NeoBlock Lifetime_Unit = 2 +) + +var Lifetime_Unit_name = map[int32]string{ + 0: "Unlimited", + 1: "NeoFSEpoch", + 2: "NeoBlock", +} + +var Lifetime_Unit_value = map[string]int32{ + "Unlimited": 0, + "NeoFSEpoch": 1, + "NeoBlock": 2, +} + +func (x Lifetime_Unit) String() string { + return proto.EnumName(Lifetime_Unit_name, int32(x)) +} + +func (Lifetime_Unit) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_437c556d7375b726, []int{6, 0} +} + +type Tx_Type int32 + +const ( + Tx_Unknown Tx_Type = 0 + Tx_Withdraw Tx_Type = 1 + Tx_PayIO Tx_Type = 2 + Tx_Inner Tx_Type = 3 +) + +var Tx_Type_name = map[int32]string{ + 0: "Unknown", + 1: "Withdraw", + 2: "PayIO", + 3: "Inner", +} + +var Tx_Type_value = map[string]int32{ + "Unknown": 0, + "Withdraw": 1, + "PayIO": 2, + "Inner": 3, +} + +func (x Tx_Type) String() string { + return proto.EnumName(Tx_Type_name, int32(x)) +} + +func (Tx_Type) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_437c556d7375b726, []int{7, 0} +} + +// Snapshot accounting messages +type Account struct { + OwnerID OwnerID `protobuf:"bytes,1,opt,name=OwnerID,proto3,customtype=OwnerID" json:"OwnerID"` + Address string `protobuf:"bytes,2,opt,name=Address,proto3" json:"Address,omitempty"` + ParentAddress string `protobuf:"bytes,3,opt,name=ParentAddress,proto3" json:"ParentAddress,omitempty"` + ActiveFunds *decimal.Decimal `protobuf:"bytes,4,opt,name=ActiveFunds,proto3" json:"ActiveFunds,omitempty"` + Lifetime Lifetime `protobuf:"bytes,5,opt,name=Lifetime,proto3" json:"Lifetime"` + LockTarget *LockTarget `protobuf:"bytes,6,opt,name=LockTarget,proto3" json:"LockTarget,omitempty"` + LockAccounts []*Account `protobuf:"bytes,7,rep,name=LockAccounts,proto3" json:"LockAccounts,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Account) Reset() { *m = Account{} } +func (m *Account) String() string { return proto.CompactTextString(m) } +func (*Account) ProtoMessage() {} +func (*Account) Descriptor() ([]byte, []int) { + return fileDescriptor_437c556d7375b726, []int{0} +} +func (m *Account) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Account) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *Account) XXX_Merge(src proto.Message) { + xxx_messageInfo_Account.Merge(m, src) +} +func (m *Account) XXX_Size() int { + return m.Size() +} +func (m *Account) XXX_DiscardUnknown() { + xxx_messageInfo_Account.DiscardUnknown(m) +} + +var xxx_messageInfo_Account proto.InternalMessageInfo + +func (m *Account) GetAddress() string { + if m != nil { + return m.Address + } + return "" +} + +func (m *Account) GetParentAddress() string { + if m != nil { + return m.ParentAddress + } + return "" +} + +func (m *Account) GetActiveFunds() *decimal.Decimal { + if m != nil { + return m.ActiveFunds + } + return nil +} + +func (m *Account) GetLifetime() Lifetime { + if m != nil { + return m.Lifetime + } + return Lifetime{} +} + +func (m *Account) GetLockTarget() *LockTarget { + if m != nil { + return m.LockTarget + } + return nil +} + +func (m *Account) GetLockAccounts() []*Account { + if m != nil { + return m.LockAccounts + } + return nil +} + +type LockTarget struct { + // Types that are valid to be assigned to Target: + // *LockTarget_WithdrawTarget + // *LockTarget_ContainerCreateTarget + Target isLockTarget_Target `protobuf_oneof:"Target"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *LockTarget) Reset() { *m = LockTarget{} } +func (m *LockTarget) String() string { return proto.CompactTextString(m) } +func (*LockTarget) ProtoMessage() {} +func (*LockTarget) Descriptor() ([]byte, []int) { + return fileDescriptor_437c556d7375b726, []int{1} +} +func (m *LockTarget) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *LockTarget) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *LockTarget) XXX_Merge(src proto.Message) { + xxx_messageInfo_LockTarget.Merge(m, src) +} +func (m *LockTarget) XXX_Size() int { + return m.Size() +} +func (m *LockTarget) XXX_DiscardUnknown() { + xxx_messageInfo_LockTarget.DiscardUnknown(m) +} + +var xxx_messageInfo_LockTarget proto.InternalMessageInfo + +type isLockTarget_Target interface { + isLockTarget_Target() + MarshalTo([]byte) (int, error) + Size() int +} + +type LockTarget_WithdrawTarget struct { + WithdrawTarget *WithdrawTarget `protobuf:"bytes,1,opt,name=WithdrawTarget,proto3,oneof" json:"WithdrawTarget,omitempty"` +} +type LockTarget_ContainerCreateTarget struct { + ContainerCreateTarget *ContainerCreateTarget `protobuf:"bytes,2,opt,name=ContainerCreateTarget,proto3,oneof" json:"ContainerCreateTarget,omitempty"` +} + +func (*LockTarget_WithdrawTarget) isLockTarget_Target() {} +func (*LockTarget_ContainerCreateTarget) isLockTarget_Target() {} + +func (m *LockTarget) GetTarget() isLockTarget_Target { + if m != nil { + return m.Target + } + return nil +} + +func (m *LockTarget) GetWithdrawTarget() *WithdrawTarget { + if x, ok := m.GetTarget().(*LockTarget_WithdrawTarget); ok { + return x.WithdrawTarget + } + return nil +} + +func (m *LockTarget) GetContainerCreateTarget() *ContainerCreateTarget { + if x, ok := m.GetTarget().(*LockTarget_ContainerCreateTarget); ok { + return x.ContainerCreateTarget + } + return nil +} + +// XXX_OneofWrappers is for the internal use of the proto package. +func (*LockTarget) XXX_OneofWrappers() []interface{} { + return []interface{}{ + (*LockTarget_WithdrawTarget)(nil), + (*LockTarget_ContainerCreateTarget)(nil), + } +} + +// Snapshot balance messages +type Balances struct { + Accounts []Account `protobuf:"bytes,1,rep,name=Accounts,proto3" json:"Accounts"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Balances) Reset() { *m = Balances{} } +func (m *Balances) String() string { return proto.CompactTextString(m) } +func (*Balances) ProtoMessage() {} +func (*Balances) Descriptor() ([]byte, []int) { + return fileDescriptor_437c556d7375b726, []int{2} +} +func (m *Balances) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Balances) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *Balances) XXX_Merge(src proto.Message) { + xxx_messageInfo_Balances.Merge(m, src) +} +func (m *Balances) XXX_Size() int { + return m.Size() +} +func (m *Balances) XXX_DiscardUnknown() { + xxx_messageInfo_Balances.DiscardUnknown(m) +} + +var xxx_messageInfo_Balances proto.InternalMessageInfo + +func (m *Balances) GetAccounts() []Account { + if m != nil { + return m.Accounts + } + return nil +} + +// PayIn / PayOut messages +type PayIO struct { + BlockID uint64 `protobuf:"varint,1,opt,name=BlockID,proto3" json:"BlockID,omitempty"` + Transactions []Tx `protobuf:"bytes,2,rep,name=Transactions,proto3" json:"Transactions"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *PayIO) Reset() { *m = PayIO{} } +func (m *PayIO) String() string { return proto.CompactTextString(m) } +func (*PayIO) ProtoMessage() {} +func (*PayIO) Descriptor() ([]byte, []int) { + return fileDescriptor_437c556d7375b726, []int{3} +} +func (m *PayIO) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *PayIO) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *PayIO) XXX_Merge(src proto.Message) { + xxx_messageInfo_PayIO.Merge(m, src) +} +func (m *PayIO) XXX_Size() int { + return m.Size() +} +func (m *PayIO) XXX_DiscardUnknown() { + xxx_messageInfo_PayIO.DiscardUnknown(m) +} + +var xxx_messageInfo_PayIO proto.InternalMessageInfo + +func (m *PayIO) GetBlockID() uint64 { + if m != nil { + return m.BlockID + } + return 0 +} + +func (m *PayIO) GetTransactions() []Tx { + if m != nil { + return m.Transactions + } + return nil +} + +// Clearing messages +type Clearing struct { + Transactions []Tx `protobuf:"bytes,1,rep,name=Transactions,proto3" json:"Transactions"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Clearing) Reset() { *m = Clearing{} } +func (m *Clearing) String() string { return proto.CompactTextString(m) } +func (*Clearing) ProtoMessage() {} +func (*Clearing) Descriptor() ([]byte, []int) { + return fileDescriptor_437c556d7375b726, []int{4} +} +func (m *Clearing) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Clearing) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *Clearing) XXX_Merge(src proto.Message) { + xxx_messageInfo_Clearing.Merge(m, src) +} +func (m *Clearing) XXX_Size() int { + return m.Size() +} +func (m *Clearing) XXX_DiscardUnknown() { + xxx_messageInfo_Clearing.DiscardUnknown(m) +} + +var xxx_messageInfo_Clearing proto.InternalMessageInfo + +func (m *Clearing) GetTransactions() []Tx { + if m != nil { + return m.Transactions + } + return nil +} + +// Clearing messages +type Withdraw struct { + ID string `protobuf:"bytes,1,opt,name=ID,proto3" json:"ID,omitempty"` + Epoch uint64 `protobuf:"varint,2,opt,name=Epoch,proto3" json:"Epoch,omitempty"` + Transaction *Tx `protobuf:"bytes,3,opt,name=Transaction,proto3" json:"Transaction,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Withdraw) Reset() { *m = Withdraw{} } +func (m *Withdraw) String() string { return proto.CompactTextString(m) } +func (*Withdraw) ProtoMessage() {} +func (*Withdraw) Descriptor() ([]byte, []int) { + return fileDescriptor_437c556d7375b726, []int{5} +} +func (m *Withdraw) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Withdraw) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *Withdraw) XXX_Merge(src proto.Message) { + xxx_messageInfo_Withdraw.Merge(m, src) +} +func (m *Withdraw) XXX_Size() int { + return m.Size() +} +func (m *Withdraw) XXX_DiscardUnknown() { + xxx_messageInfo_Withdraw.DiscardUnknown(m) +} + +var xxx_messageInfo_Withdraw proto.InternalMessageInfo + +func (m *Withdraw) GetID() string { + if m != nil { + return m.ID + } + return "" +} + +func (m *Withdraw) GetEpoch() uint64 { + if m != nil { + return m.Epoch + } + return 0 +} + +func (m *Withdraw) GetTransaction() *Tx { + if m != nil { + return m.Transaction + } + return nil +} + +// Lifetime of locks +type Lifetime struct { + Unit Lifetime_Unit `protobuf:"varint,1,opt,name=unit,proto3,enum=accounting.Lifetime_Unit" json:"unit,omitempty"` + Value int64 `protobuf:"varint,2,opt,name=Value,proto3" json:"Value,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Lifetime) Reset() { *m = Lifetime{} } +func (m *Lifetime) String() string { return proto.CompactTextString(m) } +func (*Lifetime) ProtoMessage() {} +func (*Lifetime) Descriptor() ([]byte, []int) { + return fileDescriptor_437c556d7375b726, []int{6} +} +func (m *Lifetime) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Lifetime) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *Lifetime) XXX_Merge(src proto.Message) { + xxx_messageInfo_Lifetime.Merge(m, src) +} +func (m *Lifetime) XXX_Size() int { + return m.Size() +} +func (m *Lifetime) XXX_DiscardUnknown() { + xxx_messageInfo_Lifetime.DiscardUnknown(m) +} + +var xxx_messageInfo_Lifetime proto.InternalMessageInfo + +func (m *Lifetime) GetUnit() Lifetime_Unit { + if m != nil { + return m.Unit + } + return Lifetime_Unlimited +} + +func (m *Lifetime) GetValue() int64 { + if m != nil { + return m.Value + } + return 0 +} + +// Transaction messages +type Tx struct { + Type Tx_Type `protobuf:"varint,1,opt,name=type,proto3,enum=accounting.Tx_Type" json:"type,omitempty"` + From string `protobuf:"bytes,2,opt,name=From,proto3" json:"From,omitempty"` + To string `protobuf:"bytes,3,opt,name=To,proto3" json:"To,omitempty"` + Amount *decimal.Decimal `protobuf:"bytes,4,opt,name=Amount,proto3" json:"Amount,omitempty"` + PublicKeys []byte `protobuf:"bytes,5,opt,name=PublicKeys,proto3" json:"PublicKeys,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Tx) Reset() { *m = Tx{} } +func (m *Tx) String() string { return proto.CompactTextString(m) } +func (*Tx) ProtoMessage() {} +func (*Tx) Descriptor() ([]byte, []int) { + return fileDescriptor_437c556d7375b726, []int{7} +} +func (m *Tx) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Tx) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *Tx) XXX_Merge(src proto.Message) { + xxx_messageInfo_Tx.Merge(m, src) +} +func (m *Tx) XXX_Size() int { + return m.Size() +} +func (m *Tx) XXX_DiscardUnknown() { + xxx_messageInfo_Tx.DiscardUnknown(m) +} + +var xxx_messageInfo_Tx proto.InternalMessageInfo + +func (m *Tx) GetType() Tx_Type { + if m != nil { + return m.Type + } + return Tx_Unknown +} + +func (m *Tx) GetFrom() string { + if m != nil { + return m.From + } + return "" +} + +func (m *Tx) GetTo() string { + if m != nil { + return m.To + } + return "" +} + +func (m *Tx) GetAmount() *decimal.Decimal { + if m != nil { + return m.Amount + } + return nil +} + +func (m *Tx) GetPublicKeys() []byte { + if m != nil { + return m.PublicKeys + } + return nil +} + +type Settlement struct { + Epoch uint64 `protobuf:"varint,1,opt,name=Epoch,proto3" json:"Epoch,omitempty"` + Transactions []*Settlement_Tx `protobuf:"bytes,2,rep,name=Transactions,proto3" json:"Transactions,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Settlement) Reset() { *m = Settlement{} } +func (m *Settlement) String() string { return proto.CompactTextString(m) } +func (*Settlement) ProtoMessage() {} +func (*Settlement) Descriptor() ([]byte, []int) { + return fileDescriptor_437c556d7375b726, []int{8} +} +func (m *Settlement) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Settlement) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *Settlement) XXX_Merge(src proto.Message) { + xxx_messageInfo_Settlement.Merge(m, src) +} +func (m *Settlement) XXX_Size() int { + return m.Size() +} +func (m *Settlement) XXX_DiscardUnknown() { + xxx_messageInfo_Settlement.DiscardUnknown(m) +} + +var xxx_messageInfo_Settlement proto.InternalMessageInfo + +func (m *Settlement) GetEpoch() uint64 { + if m != nil { + return m.Epoch + } + return 0 +} + +func (m *Settlement) GetTransactions() []*Settlement_Tx { + if m != nil { + return m.Transactions + } + return nil +} + +type Settlement_Receiver struct { + To string `protobuf:"bytes,1,opt,name=To,proto3" json:"To,omitempty"` + Amount *decimal.Decimal `protobuf:"bytes,2,opt,name=Amount,proto3" json:"Amount,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Settlement_Receiver) Reset() { *m = Settlement_Receiver{} } +func (m *Settlement_Receiver) String() string { return proto.CompactTextString(m) } +func (*Settlement_Receiver) ProtoMessage() {} +func (*Settlement_Receiver) Descriptor() ([]byte, []int) { + return fileDescriptor_437c556d7375b726, []int{8, 0} +} +func (m *Settlement_Receiver) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Settlement_Receiver) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *Settlement_Receiver) XXX_Merge(src proto.Message) { + xxx_messageInfo_Settlement_Receiver.Merge(m, src) +} +func (m *Settlement_Receiver) XXX_Size() int { + return m.Size() +} +func (m *Settlement_Receiver) XXX_DiscardUnknown() { + xxx_messageInfo_Settlement_Receiver.DiscardUnknown(m) +} + +var xxx_messageInfo_Settlement_Receiver proto.InternalMessageInfo + +func (m *Settlement_Receiver) GetTo() string { + if m != nil { + return m.To + } + return "" +} + +func (m *Settlement_Receiver) GetAmount() *decimal.Decimal { + if m != nil { + return m.Amount + } + return nil +} + +type Settlement_Container struct { + CID CID `protobuf:"bytes,1,opt,name=CID,proto3,customtype=CID" json:"CID"` + SGIDs []SGID `protobuf:"bytes,2,rep,name=SGIDs,proto3,customtype=SGID" json:"SGIDs"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Settlement_Container) Reset() { *m = Settlement_Container{} } +func (m *Settlement_Container) String() string { return proto.CompactTextString(m) } +func (*Settlement_Container) ProtoMessage() {} +func (*Settlement_Container) Descriptor() ([]byte, []int) { + return fileDescriptor_437c556d7375b726, []int{8, 1} +} +func (m *Settlement_Container) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Settlement_Container) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *Settlement_Container) XXX_Merge(src proto.Message) { + xxx_messageInfo_Settlement_Container.Merge(m, src) +} +func (m *Settlement_Container) XXX_Size() int { + return m.Size() +} +func (m *Settlement_Container) XXX_DiscardUnknown() { + xxx_messageInfo_Settlement_Container.DiscardUnknown(m) +} + +var xxx_messageInfo_Settlement_Container proto.InternalMessageInfo + +type Settlement_Tx struct { + From string `protobuf:"bytes,1,opt,name=From,proto3" json:"From,omitempty"` + Container Settlement_Container `protobuf:"bytes,2,opt,name=Container,proto3" json:"Container"` + Receivers []Settlement_Receiver `protobuf:"bytes,3,rep,name=Receivers,proto3" json:"Receivers"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Settlement_Tx) Reset() { *m = Settlement_Tx{} } +func (m *Settlement_Tx) String() string { return proto.CompactTextString(m) } +func (*Settlement_Tx) ProtoMessage() {} +func (*Settlement_Tx) Descriptor() ([]byte, []int) { + return fileDescriptor_437c556d7375b726, []int{8, 2} +} +func (m *Settlement_Tx) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Settlement_Tx) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *Settlement_Tx) XXX_Merge(src proto.Message) { + xxx_messageInfo_Settlement_Tx.Merge(m, src) +} +func (m *Settlement_Tx) XXX_Size() int { + return m.Size() +} +func (m *Settlement_Tx) XXX_DiscardUnknown() { + xxx_messageInfo_Settlement_Tx.DiscardUnknown(m) +} + +var xxx_messageInfo_Settlement_Tx proto.InternalMessageInfo + +func (m *Settlement_Tx) GetFrom() string { + if m != nil { + return m.From + } + return "" +} + +func (m *Settlement_Tx) GetContainer() Settlement_Container { + if m != nil { + return m.Container + } + return Settlement_Container{} +} + +func (m *Settlement_Tx) GetReceivers() []Settlement_Receiver { + if m != nil { + return m.Receivers + } + return nil +} + +type ContainerCreateTarget struct { + CID CID `protobuf:"bytes,1,opt,name=CID,proto3,customtype=CID" json:"CID"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ContainerCreateTarget) Reset() { *m = ContainerCreateTarget{} } +func (m *ContainerCreateTarget) String() string { return proto.CompactTextString(m) } +func (*ContainerCreateTarget) ProtoMessage() {} +func (*ContainerCreateTarget) Descriptor() ([]byte, []int) { + return fileDescriptor_437c556d7375b726, []int{9} +} +func (m *ContainerCreateTarget) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ContainerCreateTarget) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *ContainerCreateTarget) XXX_Merge(src proto.Message) { + xxx_messageInfo_ContainerCreateTarget.Merge(m, src) +} +func (m *ContainerCreateTarget) XXX_Size() int { + return m.Size() +} +func (m *ContainerCreateTarget) XXX_DiscardUnknown() { + xxx_messageInfo_ContainerCreateTarget.DiscardUnknown(m) +} + +var xxx_messageInfo_ContainerCreateTarget proto.InternalMessageInfo + +type WithdrawTarget struct { + Cheque string `protobuf:"bytes,1,opt,name=Cheque,proto3" json:"Cheque,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *WithdrawTarget) Reset() { *m = WithdrawTarget{} } +func (m *WithdrawTarget) String() string { return proto.CompactTextString(m) } +func (*WithdrawTarget) ProtoMessage() {} +func (*WithdrawTarget) Descriptor() ([]byte, []int) { + return fileDescriptor_437c556d7375b726, []int{10} +} +func (m *WithdrawTarget) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *WithdrawTarget) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *WithdrawTarget) XXX_Merge(src proto.Message) { + xxx_messageInfo_WithdrawTarget.Merge(m, src) +} +func (m *WithdrawTarget) XXX_Size() int { + return m.Size() +} +func (m *WithdrawTarget) XXX_DiscardUnknown() { + xxx_messageInfo_WithdrawTarget.DiscardUnknown(m) +} + +var xxx_messageInfo_WithdrawTarget proto.InternalMessageInfo + +func (m *WithdrawTarget) GetCheque() string { + if m != nil { + return m.Cheque + } + return "" +} + +func init() { + proto.RegisterEnum("accounting.Lifetime_Unit", Lifetime_Unit_name, Lifetime_Unit_value) + proto.RegisterEnum("accounting.Tx_Type", Tx_Type_name, Tx_Type_value) + proto.RegisterType((*Account)(nil), "accounting.Account") + proto.RegisterType((*LockTarget)(nil), "accounting.LockTarget") + proto.RegisterType((*Balances)(nil), "accounting.Balances") + proto.RegisterType((*PayIO)(nil), "accounting.PayIO") + proto.RegisterType((*Clearing)(nil), "accounting.Clearing") + proto.RegisterType((*Withdraw)(nil), "accounting.Withdraw") + proto.RegisterType((*Lifetime)(nil), "accounting.Lifetime") + proto.RegisterType((*Tx)(nil), "accounting.Tx") + proto.RegisterType((*Settlement)(nil), "accounting.Settlement") + proto.RegisterType((*Settlement_Receiver)(nil), "accounting.Settlement.Receiver") + proto.RegisterType((*Settlement_Container)(nil), "accounting.Settlement.Container") + proto.RegisterType((*Settlement_Tx)(nil), "accounting.Settlement.Tx") + proto.RegisterType((*ContainerCreateTarget)(nil), "accounting.ContainerCreateTarget") + proto.RegisterType((*WithdrawTarget)(nil), "accounting.WithdrawTarget") +} + +func init() { proto.RegisterFile("accounting/types.proto", fileDescriptor_437c556d7375b726) } + +var fileDescriptor_437c556d7375b726 = []byte{ + // 866 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x55, 0x4d, 0x73, 0x22, 0x45, + 0x18, 0xa6, 0x87, 0x09, 0x0c, 0x2f, 0x2c, 0x52, 0xbd, 0xbb, 0x29, 0xa4, 0x4a, 0x82, 0x53, 0x1e, + 0xb0, 0xac, 0x80, 0x66, 0xcb, 0xc4, 0x8b, 0x07, 0x3e, 0x8c, 0x4b, 0xb9, 0x95, 0x4d, 0x75, 0x88, + 0x96, 0x7a, 0x1a, 0x86, 0x0e, 0xe9, 0x0a, 0x74, 0xe3, 0x4c, 0x93, 0x6c, 0xfe, 0x84, 0x67, 0x2f, + 0x9e, 0xfc, 0x11, 0xfe, 0x85, 0x3d, 0xea, 0xcd, 0xf2, 0x90, 0xb2, 0xf0, 0x8f, 0x58, 0xdd, 0xd3, + 0x33, 0xcc, 0xec, 0x82, 0x7a, 0x81, 0xf7, 0xe3, 0x79, 0x9f, 0x7e, 0xbf, 0xba, 0x07, 0xf6, 0x3d, + 0xdf, 0x17, 0x2b, 0x2e, 0x19, 0x9f, 0x75, 0xe5, 0xfd, 0x92, 0x86, 0x9d, 0x65, 0x20, 0xa4, 0xc0, + 0xb0, 0xb1, 0x37, 0x9e, 0x4e, 0xa9, 0xcf, 0x16, 0xde, 0xbc, 0x6b, 0xfe, 0x23, 0x48, 0xe3, 0x70, + 0xc6, 0xe4, 0xf5, 0x6a, 0xd2, 0xf1, 0xc5, 0xa2, 0x3b, 0x13, 0x33, 0xd1, 0xd5, 0xe6, 0xc9, 0xea, + 0x4a, 0x6b, 0x5a, 0xd1, 0x52, 0x04, 0x77, 0x7f, 0xb7, 0xa0, 0xd8, 0x8b, 0x48, 0xf1, 0x87, 0x50, + 0x7c, 0x79, 0xc7, 0x69, 0x30, 0x1a, 0xd6, 0x51, 0x0b, 0xb5, 0x2b, 0xfd, 0x77, 0x5e, 0x3f, 0x1c, + 0xe4, 0xfe, 0x7c, 0x38, 0x88, 0xcd, 0x24, 0x16, 0x70, 0x1d, 0x8a, 0xbd, 0xe9, 0x34, 0xa0, 0x61, + 0x58, 0xb7, 0x5a, 0xa8, 0x5d, 0x22, 0xb1, 0x8a, 0x3f, 0x80, 0x47, 0xe7, 0x5e, 0x40, 0xb9, 0x8c, + 0xfd, 0x79, 0xed, 0xcf, 0x1a, 0xf1, 0x11, 0x94, 0x7b, 0xbe, 0x64, 0xb7, 0xf4, 0x74, 0xc5, 0xa7, + 0x61, 0xdd, 0x6e, 0xa1, 0x76, 0xf9, 0xa8, 0xd6, 0x89, 0x4b, 0x19, 0x46, 0xff, 0x24, 0x0d, 0xc2, + 0xc7, 0xe0, 0xbc, 0x60, 0x57, 0x54, 0xb2, 0x05, 0xad, 0xef, 0xe9, 0x80, 0x27, 0x9d, 0x4d, 0x3f, + 0x3a, 0xb1, 0xaf, 0x6f, 0xab, 0xac, 0x49, 0x82, 0xc5, 0xc7, 0x00, 0x2f, 0x84, 0x7f, 0x33, 0xf6, + 0x82, 0x19, 0x95, 0xf5, 0x82, 0x8e, 0xdc, 0xcf, 0x44, 0x26, 0x5e, 0x92, 0x42, 0xe2, 0x13, 0xa8, + 0x28, 0xcd, 0x74, 0x27, 0xac, 0x17, 0x5b, 0xf9, 0x76, 0xf9, 0xe8, 0x71, 0x3a, 0xd2, 0xf8, 0x48, + 0x06, 0xe8, 0xfe, 0x8a, 0xd2, 0x27, 0xe2, 0x21, 0x54, 0xbf, 0x61, 0xf2, 0x7a, 0x1a, 0x78, 0x77, + 0x26, 0x07, 0xa4, 0x73, 0x68, 0xa4, 0x99, 0xb2, 0x88, 0xe7, 0x39, 0xf2, 0x46, 0x0c, 0xfe, 0x16, + 0x9e, 0x0e, 0x04, 0x97, 0x1e, 0xe3, 0x34, 0x18, 0x04, 0xd4, 0x93, 0xd4, 0x90, 0x59, 0x9a, 0xec, + 0xfd, 0x34, 0xd9, 0x56, 0xe0, 0xf3, 0x1c, 0xd9, 0xce, 0xd0, 0x77, 0xa0, 0x10, 0x49, 0x6e, 0x0f, + 0x9c, 0xbe, 0x37, 0xf7, 0xb8, 0x4f, 0x43, 0xfc, 0x29, 0x38, 0x49, 0xe9, 0x68, 0x67, 0xe9, 0x71, + 0xb7, 0x93, 0xe2, 0xbf, 0x87, 0xbd, 0x73, 0xef, 0x7e, 0xf4, 0x52, 0xad, 0x48, 0x7f, 0x2e, 0xfc, + 0x1b, 0xb3, 0x4d, 0x36, 0x89, 0x55, 0xfc, 0x19, 0x54, 0xc6, 0x81, 0xc7, 0x43, 0xcf, 0x97, 0x4c, + 0x70, 0xb5, 0x41, 0x8a, 0xbd, 0x9a, 0x66, 0x1f, 0xbf, 0x32, 0xc4, 0x19, 0xa4, 0x3b, 0x04, 0x67, + 0x30, 0xa7, 0x5e, 0xc0, 0xf8, 0xec, 0x2d, 0x16, 0xf4, 0xbf, 0x59, 0x26, 0xe0, 0xc4, 0xcd, 0xc5, + 0x55, 0xb0, 0x4c, 0x82, 0x25, 0x62, 0x8d, 0x86, 0xf8, 0x09, 0xec, 0x7d, 0xb1, 0x14, 0xfe, 0xb5, + 0x6e, 0xab, 0x4d, 0x22, 0x05, 0x7f, 0x0c, 0xe5, 0x14, 0x83, 0x5e, 0xe9, 0xb7, 0x8e, 0x22, 0x69, + 0x88, 0xfb, 0x23, 0xda, 0x6c, 0x2b, 0x3e, 0x01, 0x7b, 0xc5, 0x59, 0x34, 0xf7, 0xea, 0xd1, 0xbb, + 0xdb, 0xb6, 0xb6, 0x73, 0xc9, 0x99, 0xec, 0x3b, 0xeb, 0x87, 0x03, 0x5b, 0x49, 0x44, 0x07, 0xa8, + 0x6c, 0xbe, 0xf6, 0xe6, 0x2b, 0xaa, 0xb3, 0xc9, 0x93, 0x48, 0x71, 0x9f, 0x81, 0xc6, 0xe0, 0x47, + 0x50, 0xba, 0xe4, 0x73, 0xb6, 0x60, 0x92, 0x4e, 0x6b, 0x39, 0x5c, 0x05, 0x38, 0xa3, 0xe2, 0xf4, + 0x42, 0xa7, 0x5c, 0x43, 0xb8, 0x02, 0xce, 0x19, 0x15, 0xba, 0xe9, 0x35, 0xcb, 0x7d, 0x40, 0x60, + 0x8d, 0x5f, 0xe1, 0x4f, 0xc0, 0x56, 0x0f, 0x8a, 0x49, 0xe5, 0x71, 0xb6, 0x84, 0xce, 0xf8, 0x7e, + 0x49, 0xa3, 0x24, 0x94, 0x44, 0x34, 0x14, 0x63, 0xb0, 0x4f, 0x03, 0xb1, 0x30, 0x17, 0x5d, 0xcb, + 0xaa, 0x6d, 0x63, 0x61, 0xae, 0xb6, 0x35, 0x16, 0xb8, 0x0d, 0x85, 0xde, 0x42, 0x11, 0xed, 0xbc, + 0xca, 0xc6, 0x8f, 0x9b, 0x00, 0xe7, 0xab, 0xc9, 0x9c, 0xf9, 0x5f, 0xd1, 0xfb, 0x50, 0xdf, 0xe3, + 0x0a, 0x49, 0x59, 0xdc, 0x13, 0xd0, 0x67, 0xe3, 0x32, 0x14, 0x2f, 0xf9, 0x0d, 0x17, 0x77, 0xbc, + 0x96, 0x53, 0xa5, 0xc4, 0x13, 0xab, 0x21, 0x5c, 0x32, 0x2b, 0x56, 0xb3, 0x94, 0x38, 0xe2, 0x9c, + 0x06, 0xb5, 0xbc, 0xfb, 0x73, 0x1e, 0xe0, 0x82, 0x4a, 0x39, 0xa7, 0x0b, 0xca, 0xe5, 0x66, 0x90, + 0x28, 0x3d, 0xc8, 0xcf, 0xb7, 0xae, 0x5e, 0x66, 0x22, 0x1b, 0x0e, 0x35, 0xd4, 0x0c, 0xbc, 0x31, + 0x04, 0x87, 0x50, 0x9f, 0xb2, 0x5b, 0x1a, 0x98, 0x16, 0xa0, 0x2d, 0x2d, 0xb0, 0xfe, 0xbd, 0x05, + 0x8d, 0x33, 0x28, 0x25, 0x17, 0x11, 0xbf, 0x07, 0xf9, 0x41, 0xf2, 0xe0, 0x96, 0xcd, 0x83, 0xab, + 0x4c, 0x44, 0xfd, 0x60, 0x17, 0xf6, 0x2e, 0xbe, 0x1c, 0x0d, 0xa3, 0x4c, 0x2b, 0xfd, 0x8a, 0x01, + 0xd8, 0xca, 0x48, 0x22, 0x57, 0xe3, 0x97, 0x68, 0xb4, 0xf1, 0x9c, 0x50, 0x6a, 0x4e, 0xc3, 0xd4, + 0x51, 0x26, 0xaf, 0xd6, 0x8e, 0x62, 0x13, 0x9c, 0xb9, 0x33, 0xa9, 0x1c, 0x07, 0x50, 0x8a, 0xcb, + 0x56, 0xef, 0xb9, 0x6a, 0xd9, 0xc1, 0x0e, 0x96, 0x18, 0x17, 0x93, 0x24, 0x71, 0xee, 0xf1, 0x8e, + 0x07, 0xec, 0x3f, 0x3a, 0xe0, 0xb6, 0xdf, 0x7c, 0x3e, 0xf1, 0x3e, 0x14, 0x06, 0xd7, 0xf4, 0x87, + 0x15, 0x35, 0xa5, 0x1a, 0xad, 0xdf, 0x7b, 0xbd, 0x6e, 0xa2, 0xdf, 0xd6, 0x4d, 0xf4, 0xc7, 0xba, + 0x89, 0xfe, 0x5a, 0x37, 0xd1, 0x4f, 0x7f, 0x37, 0x73, 0xdf, 0x7d, 0x94, 0xfa, 0x20, 0xf2, 0x70, + 0xe9, 0xfb, 0x87, 0x53, 0x7a, 0xdb, 0xe5, 0x54, 0x5c, 0x85, 0x87, 0xd1, 0xe7, 0x70, 0x53, 0xc9, + 0xa4, 0xa0, 0x2d, 0xcf, 0xfe, 0x09, 0x00, 0x00, 0xff, 0xff, 0x66, 0x69, 0x27, 0xa6, 0x81, 0x07, + 0x00, 0x00, +} + +func (m *Account) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Account) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Account) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.LockAccounts) > 0 { + for iNdEx := len(m.LockAccounts) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.LockAccounts[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3a + } + } + if m.LockTarget != nil { + { + size, err := m.LockTarget.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + } + { + size, err := m.Lifetime.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + if m.ActiveFunds != nil { + { + size, err := m.ActiveFunds.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + if len(m.ParentAddress) > 0 { + i -= len(m.ParentAddress) + copy(dAtA[i:], m.ParentAddress) + i = encodeVarintTypes(dAtA, i, uint64(len(m.ParentAddress))) + i-- + dAtA[i] = 0x1a + } + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0x12 + } + { + size := m.OwnerID.Size() + i -= size + if _, err := m.OwnerID.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *LockTarget) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *LockTarget) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *LockTarget) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.Target != nil { + { + size := m.Target.Size() + i -= size + if _, err := m.Target.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + } + } + return len(dAtA) - i, nil +} + +func (m *LockTarget_WithdrawTarget) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *LockTarget_WithdrawTarget) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.WithdrawTarget != nil { + { + size, err := m.WithdrawTarget.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} +func (m *LockTarget_ContainerCreateTarget) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *LockTarget_ContainerCreateTarget) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.ContainerCreateTarget != nil { + { + size, err := m.ContainerCreateTarget.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + return len(dAtA) - i, nil +} +func (m *Balances) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Balances) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Balances) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Accounts) > 0 { + for iNdEx := len(m.Accounts) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Accounts[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *PayIO) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PayIO) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PayIO) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Transactions) > 0 { + for iNdEx := len(m.Transactions) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Transactions[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if m.BlockID != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.BlockID)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *Clearing) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Clearing) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Clearing) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Transactions) > 0 { + for iNdEx := len(m.Transactions) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Transactions[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *Withdraw) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Withdraw) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Withdraw) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.Transaction != nil { + { + size, err := m.Transaction.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + if m.Epoch != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Epoch)) + i-- + dAtA[i] = 0x10 + } + if len(m.ID) > 0 { + i -= len(m.ID) + copy(dAtA[i:], m.ID) + i = encodeVarintTypes(dAtA, i, uint64(len(m.ID))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Lifetime) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Lifetime) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Lifetime) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.Value != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Value)) + i-- + dAtA[i] = 0x10 + } + if m.Unit != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Unit)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *Tx) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Tx) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Tx) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.PublicKeys) > 0 { + i -= len(m.PublicKeys) + copy(dAtA[i:], m.PublicKeys) + i = encodeVarintTypes(dAtA, i, uint64(len(m.PublicKeys))) + i-- + dAtA[i] = 0x2a + } + if m.Amount != nil { + { + size, err := m.Amount.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + if len(m.To) > 0 { + i -= len(m.To) + copy(dAtA[i:], m.To) + i = encodeVarintTypes(dAtA, i, uint64(len(m.To))) + i-- + dAtA[i] = 0x1a + } + if len(m.From) > 0 { + i -= len(m.From) + copy(dAtA[i:], m.From) + i = encodeVarintTypes(dAtA, i, uint64(len(m.From))) + i-- + dAtA[i] = 0x12 + } + if m.Type != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Type)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *Settlement) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Settlement) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Settlement) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Transactions) > 0 { + for iNdEx := len(m.Transactions) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Transactions[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if m.Epoch != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Epoch)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *Settlement_Receiver) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Settlement_Receiver) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Settlement_Receiver) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.Amount != nil { + { + size, err := m.Amount.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.To) > 0 { + i -= len(m.To) + copy(dAtA[i:], m.To) + i = encodeVarintTypes(dAtA, i, uint64(len(m.To))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Settlement_Container) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Settlement_Container) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Settlement_Container) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.SGIDs) > 0 { + for iNdEx := len(m.SGIDs) - 1; iNdEx >= 0; iNdEx-- { + { + size := m.SGIDs[iNdEx].Size() + i -= size + if _, err := m.SGIDs[iNdEx].MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + { + size := m.CID.Size() + i -= size + if _, err := m.CID.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *Settlement_Tx) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Settlement_Tx) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Settlement_Tx) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Receivers) > 0 { + for iNdEx := len(m.Receivers) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Receivers[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } + { + size, err := m.Container.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.From) > 0 { + i -= len(m.From) + copy(dAtA[i:], m.From) + i = encodeVarintTypes(dAtA, i, uint64(len(m.From))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *ContainerCreateTarget) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ContainerCreateTarget) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ContainerCreateTarget) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + { + size := m.CID.Size() + i -= size + if _, err := m.CID.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *WithdrawTarget) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *WithdrawTarget) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *WithdrawTarget) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Cheque) > 0 { + i -= len(m.Cheque) + copy(dAtA[i:], m.Cheque) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Cheque))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintTypes(dAtA []byte, offset int, v uint64) int { + offset -= sovTypes(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Account) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.OwnerID.Size() + n += 1 + l + sovTypes(uint64(l)) + l = len(m.Address) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.ParentAddress) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + if m.ActiveFunds != nil { + l = m.ActiveFunds.Size() + n += 1 + l + sovTypes(uint64(l)) + } + l = m.Lifetime.Size() + n += 1 + l + sovTypes(uint64(l)) + if m.LockTarget != nil { + l = m.LockTarget.Size() + n += 1 + l + sovTypes(uint64(l)) + } + if len(m.LockAccounts) > 0 { + for _, e := range m.LockAccounts { + l = e.Size() + n += 1 + l + sovTypes(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *LockTarget) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Target != nil { + n += m.Target.Size() + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *LockTarget_WithdrawTarget) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.WithdrawTarget != nil { + l = m.WithdrawTarget.Size() + n += 1 + l + sovTypes(uint64(l)) + } + return n +} +func (m *LockTarget_ContainerCreateTarget) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ContainerCreateTarget != nil { + l = m.ContainerCreateTarget.Size() + n += 1 + l + sovTypes(uint64(l)) + } + return n +} +func (m *Balances) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Accounts) > 0 { + for _, e := range m.Accounts { + l = e.Size() + n += 1 + l + sovTypes(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *PayIO) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.BlockID != 0 { + n += 1 + sovTypes(uint64(m.BlockID)) + } + if len(m.Transactions) > 0 { + for _, e := range m.Transactions { + l = e.Size() + n += 1 + l + sovTypes(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *Clearing) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Transactions) > 0 { + for _, e := range m.Transactions { + l = e.Size() + n += 1 + l + sovTypes(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *Withdraw) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ID) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + if m.Epoch != 0 { + n += 1 + sovTypes(uint64(m.Epoch)) + } + if m.Transaction != nil { + l = m.Transaction.Size() + n += 1 + l + sovTypes(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *Lifetime) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Unit != 0 { + n += 1 + sovTypes(uint64(m.Unit)) + } + if m.Value != 0 { + n += 1 + sovTypes(uint64(m.Value)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *Tx) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Type != 0 { + n += 1 + sovTypes(uint64(m.Type)) + } + l = len(m.From) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.To) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + if m.Amount != nil { + l = m.Amount.Size() + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.PublicKeys) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *Settlement) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Epoch != 0 { + n += 1 + sovTypes(uint64(m.Epoch)) + } + if len(m.Transactions) > 0 { + for _, e := range m.Transactions { + l = e.Size() + n += 1 + l + sovTypes(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *Settlement_Receiver) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.To) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + if m.Amount != nil { + l = m.Amount.Size() + n += 1 + l + sovTypes(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *Settlement_Container) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.CID.Size() + n += 1 + l + sovTypes(uint64(l)) + if len(m.SGIDs) > 0 { + for _, e := range m.SGIDs { + l = e.Size() + n += 1 + l + sovTypes(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *Settlement_Tx) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.From) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = m.Container.Size() + n += 1 + l + sovTypes(uint64(l)) + if len(m.Receivers) > 0 { + for _, e := range m.Receivers { + l = e.Size() + n += 1 + l + sovTypes(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *ContainerCreateTarget) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.CID.Size() + n += 1 + l + sovTypes(uint64(l)) + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *WithdrawTarget) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Cheque) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovTypes(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozTypes(x uint64) (n int) { + return sovTypes(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Account) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Account: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Account: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OwnerID", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.OwnerID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ParentAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ParentAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ActiveFunds", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.ActiveFunds == nil { + m.ActiveFunds = &decimal.Decimal{} + } + if err := m.ActiveFunds.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Lifetime", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Lifetime.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LockTarget", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.LockTarget == nil { + m.LockTarget = &LockTarget{} + } + if err := m.LockTarget.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LockAccounts", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.LockAccounts = append(m.LockAccounts, &Account{}) + if err := m.LockAccounts[len(m.LockAccounts)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *LockTarget) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: LockTarget: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: LockTarget: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field WithdrawTarget", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &WithdrawTarget{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Target = &LockTarget_WithdrawTarget{v} + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ContainerCreateTarget", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &ContainerCreateTarget{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Target = &LockTarget_ContainerCreateTarget{v} + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Balances) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Balances: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Balances: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Accounts", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Accounts = append(m.Accounts, Account{}) + if err := m.Accounts[len(m.Accounts)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *PayIO) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: PayIO: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PayIO: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BlockID", wireType) + } + m.BlockID = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.BlockID |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Transactions", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Transactions = append(m.Transactions, Tx{}) + if err := m.Transactions[len(m.Transactions)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Clearing) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Clearing: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Clearing: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Transactions", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Transactions = append(m.Transactions, Tx{}) + if err := m.Transactions[len(m.Transactions)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Withdraw) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Withdraw: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Withdraw: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Epoch", wireType) + } + m.Epoch = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Epoch |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Transaction", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Transaction == nil { + m.Transaction = &Tx{} + } + if err := m.Transaction.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Lifetime) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Lifetime: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Lifetime: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Unit", wireType) + } + m.Unit = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Unit |= Lifetime_Unit(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + m.Value = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Value |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Tx) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Tx: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Tx: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) + } + m.Type = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Type |= Tx_Type(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field From", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.From = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field To", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.To = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Amount == nil { + m.Amount = &decimal.Decimal{} + } + if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PublicKeys", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PublicKeys = append(m.PublicKeys[:0], dAtA[iNdEx:postIndex]...) + if m.PublicKeys == nil { + m.PublicKeys = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Settlement) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Settlement: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Settlement: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Epoch", wireType) + } + m.Epoch = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Epoch |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Transactions", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Transactions = append(m.Transactions, &Settlement_Tx{}) + if err := m.Transactions[len(m.Transactions)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Settlement_Receiver) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Receiver: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Receiver: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field To", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.To = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Amount == nil { + m.Amount = &decimal.Decimal{} + } + if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Settlement_Container) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Container: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Container: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CID", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SGIDs", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var v SGID + m.SGIDs = append(m.SGIDs, v) + if err := m.SGIDs[len(m.SGIDs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Settlement_Tx) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Tx: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Tx: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field From", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.From = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Container", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Container.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Receivers", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Receivers = append(m.Receivers, Settlement_Receiver{}) + if err := m.Receivers[len(m.Receivers)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ContainerCreateTarget) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ContainerCreateTarget: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ContainerCreateTarget: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CID", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *WithdrawTarget) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: WithdrawTarget: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: WithdrawTarget: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Cheque", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Cheque = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipTypes(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthTypes + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTypes + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthTypes + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthTypes = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTypes = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTypes = fmt.Errorf("proto: unexpected end of group") +) diff --git a/accounting/types.proto b/accounting/types.proto new file mode 100644 index 0000000..1b4e783 --- /dev/null +++ b/accounting/types.proto @@ -0,0 +1,106 @@ +syntax = "proto3"; +package accounting; +option go_package = "github.com/nspcc-dev/neofs-proto/accounting"; + +import "decimal/decimal.proto"; +import "github.com/gogo/protobuf/gogoproto/gogo.proto"; + +option (gogoproto.stable_marshaler_all) = true; + +// Snapshot accounting messages +message Account { + bytes OwnerID = 1 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false]; + string Address = 2; + string ParentAddress = 3; + decimal.Decimal ActiveFunds = 4; + Lifetime Lifetime = 5 [(gogoproto.nullable) = false]; + LockTarget LockTarget = 6; + repeated Account LockAccounts = 7; +} + +message LockTarget { + oneof Target { + WithdrawTarget WithdrawTarget = 1; + ContainerCreateTarget ContainerCreateTarget = 2; + } +} + +// Snapshot balance messages +message Balances { + repeated Account Accounts = 1 [(gogoproto.nullable) = false]; +} + +// PayIn / PayOut messages +message PayIO { + uint64 BlockID = 1; + repeated Tx Transactions = 2 [(gogoproto.nullable) = false]; +} + +// Clearing messages +message Clearing { + repeated Tx Transactions = 1 [(gogoproto.nullable) = false]; +} + +// Clearing messages +message Withdraw { + string ID = 1; + uint64 Epoch = 2; + Tx Transaction = 3; +} + +// Lifetime of locks +message Lifetime { + enum Unit { + Unlimited = 0; + NeoFSEpoch = 1; + NeoBlock = 2; + } + + Unit unit = 1 [(gogoproto.customname) = "Unit"]; + int64 Value = 2; +} + +// Transaction messages +message Tx { + enum Type { + Unknown = 0; + Withdraw = 1; + PayIO = 2; + Inner = 3; + } + + Type type = 1 [(gogoproto.customname) = "Type"]; + string From = 2; + string To = 3; + decimal.Decimal Amount = 4; + bytes PublicKeys = 5; // of sender +} + +message Settlement { + message Receiver { + string To = 1; + decimal.Decimal Amount = 2; + } + + message Container { + bytes CID = 1 [(gogoproto.customtype) = "CID", (gogoproto.nullable) = false]; + repeated bytes SGIDs = 2 [(gogoproto.customtype) = "SGID", (gogoproto.nullable) = false]; + } + + message Tx { + string From = 1; + Container Container = 2 [(gogoproto.nullable) = false]; + repeated Receiver Receivers = 3 [(gogoproto.nullable) = false]; + } + + uint64 Epoch = 1; + repeated Tx Transactions = 2; +} + +message ContainerCreateTarget { + bytes CID = 1 [(gogoproto.customtype) = "CID", (gogoproto.nullable) = false]; +} + +message WithdrawTarget { + string Cheque = 1; +} diff --git a/accounting/types_test.go b/accounting/types_test.go new file mode 100644 index 0000000..c78e5b4 --- /dev/null +++ b/accounting/types_test.go @@ -0,0 +1,84 @@ +package accounting + +import ( + "io/ioutil" + "testing" + + "github.com/mr-tron/base58" + "github.com/nspcc-dev/neofs-crypto/test" + "github.com/nspcc-dev/neofs-proto/chain" + "github.com/nspcc-dev/neofs-proto/decimal" + "github.com/nspcc-dev/neofs-proto/refs" + "github.com/stretchr/testify/require" +) + +func TestCheque(t *testing.T) { + t.Run("new/valid", func(t *testing.T) { + id, err := NewChequeID() + require.NoError(t, err) + require.True(t, id.Valid()) + + d := make([]byte, chain.AddressLength+1) + + // expected size + 1 byte + str := base58.Encode(d) + require.False(t, ChequeID(str).Valid()) + + // expected size - 1 byte + str = base58.Encode(d[:len(d)-2]) + require.False(t, ChequeID(str).Valid()) + + // wrong encoding + d = d[:len(d)-1] // normal size + require.False(t, ChequeID(string(d)).Valid()) + }) + + t.Run("marshal/unmarshal", func(t *testing.T) { + var b2 = new(Cheque) + + key1 := test.DecodeKey(0) + key2 := test.DecodeKey(1) + + id, err := NewChequeID() + require.NoError(t, err) + + owner, err := refs.NewOwnerID(&key1.PublicKey) + require.NoError(t, err) + + b1 := &Cheque{ + ID: id, + Owner: owner, + Height: 100, + Amount: decimal.NewGAS(100), + } + + require.NoError(t, b1.Sign(key1)) + require.NoError(t, b1.Sign(key2)) + + data, err := b1.MarshalBinary() + require.NoError(t, err) + + require.Len(t, data, b1.Size()) + require.NoError(t, b2.UnmarshalBinary(data)) + require.Equal(t, b1, b2) + + require.NoError(t, b1.Verify()) + require.NoError(t, b2.Verify()) + }) + + t.Run("example from SC", func(t *testing.T) { + var pathToCheque = "fixtures/cheque_data" + expect, err := ioutil.ReadFile(pathToCheque) + require.NoError(t, err) + + var cheque Cheque + require.NoError(t, cheque.UnmarshalBinary(expect)) + + actual, err := cheque.MarshalBinary() + require.NoError(t, err) + + require.Equal(t, expect, actual) + + require.NoError(t, cheque.Verify()) + }) +} diff --git a/accounting/withdraw.go b/accounting/withdraw.go new file mode 100644 index 0000000..3cd2766 --- /dev/null +++ b/accounting/withdraw.go @@ -0,0 +1,53 @@ +package accounting + +import ( + "encoding/binary" + + "github.com/nspcc-dev/neofs-proto/refs" +) + +type ( + // MessageID type alias. + MessageID = refs.MessageID +) + +// SetTTL sets ttl to GetRequest to satisfy TTLRequest interface. +func (m *GetRequest) SetTTL(v uint32) { m.TTL = v } + +// SetTTL sets ttl to PutRequest to satisfy TTLRequest interface. +func (m *PutRequest) SetTTL(v uint32) { m.TTL = v } + +// SetTTL sets ttl to ListRequest to satisfy TTLRequest interface. +func (m *ListRequest) SetTTL(v uint32) { m.TTL = v } + +// SetTTL sets ttl to DeleteRequest to satisfy TTLRequest interface. +func (m *DeleteRequest) SetTTL(v uint32) { m.TTL = v } + +// SetSignature sets signature to PutRequest to satisfy SignedRequest interface. +func (m *PutRequest) SetSignature(v []byte) { m.Signature = v } + +// SetSignature sets signature to DeleteRequest to satisfy SignedRequest interface. +func (m *DeleteRequest) SetSignature(v []byte) { m.Signature = v } + +// PrepareData prepares bytes representation of PutRequest to satisfy SignedRequest interface. +func (m *PutRequest) PrepareData() ([]byte, error) { + var offset int + // MessageID-len + OwnerID-len + Amount + Height + buf := make([]byte, refs.UUIDSize+refs.OwnerIDSize+binary.MaxVarintLen64+binary.MaxVarintLen64) + offset += copy(buf[offset:], m.MessageID.Bytes()) + offset += copy(buf[offset:], m.OwnerID.Bytes()) + offset += binary.PutVarint(buf[offset:], m.Amount.Value) + binary.PutUvarint(buf[offset:], m.Height) + return buf, nil +} + +// PrepareData prepares bytes representation of DeleteRequest to satisfy SignedRequest interface. +func (m *DeleteRequest) PrepareData() ([]byte, error) { + var offset int + // ID-len + OwnerID-len + MessageID-len + buf := make([]byte, refs.UUIDSize+refs.OwnerIDSize+refs.UUIDSize) + offset += copy(buf[offset:], m.ID.Bytes()) + offset += copy(buf[offset:], m.OwnerID.Bytes()) + copy(buf[offset:], m.MessageID.Bytes()) + return buf, nil +} diff --git a/accounting/withdraw.pb.go b/accounting/withdraw.pb.go new file mode 100644 index 0000000..967a2ce --- /dev/null +++ b/accounting/withdraw.pb.go @@ -0,0 +1,2641 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: accounting/withdraw.proto + +package accounting + +import ( + context "context" + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/golang/protobuf/proto" + decimal "github.com/nspcc-dev/neofs-proto/decimal" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package + +type Item struct { + ID ChequeID `protobuf:"bytes,1,opt,name=ID,proto3,customtype=ChequeID" json:"ID"` + OwnerID OwnerID `protobuf:"bytes,2,opt,name=OwnerID,proto3,customtype=OwnerID" json:"OwnerID"` + Amount *decimal.Decimal `protobuf:"bytes,3,opt,name=Amount,proto3" json:"Amount,omitempty"` + Height uint64 `protobuf:"varint,4,opt,name=Height,proto3" json:"Height,omitempty"` + Payload []byte `protobuf:"bytes,5,opt,name=Payload,proto3" json:"Payload,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Item) Reset() { *m = Item{} } +func (m *Item) String() string { return proto.CompactTextString(m) } +func (*Item) ProtoMessage() {} +func (*Item) Descriptor() ([]byte, []int) { + return fileDescriptor_b3a38a4dc2575267, []int{0} +} +func (m *Item) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Item) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *Item) XXX_Merge(src proto.Message) { + xxx_messageInfo_Item.Merge(m, src) +} +func (m *Item) XXX_Size() int { + return m.Size() +} +func (m *Item) XXX_DiscardUnknown() { + xxx_messageInfo_Item.DiscardUnknown(m) +} + +var xxx_messageInfo_Item proto.InternalMessageInfo + +func (m *Item) GetAmount() *decimal.Decimal { + if m != nil { + return m.Amount + } + return nil +} + +func (m *Item) GetHeight() uint64 { + if m != nil { + return m.Height + } + return 0 +} + +func (m *Item) GetPayload() []byte { + if m != nil { + return m.Payload + } + return nil +} + +type GetRequest struct { + ID ChequeID `protobuf:"bytes,1,opt,name=ID,proto3,customtype=ChequeID" json:"ID"` + OwnerID OwnerID `protobuf:"bytes,2,opt,name=OwnerID,proto3,customtype=OwnerID" json:"OwnerID"` + TTL uint32 `protobuf:"varint,3,opt,name=TTL,proto3" json:"TTL,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetRequest) Reset() { *m = GetRequest{} } +func (m *GetRequest) String() string { return proto.CompactTextString(m) } +func (*GetRequest) ProtoMessage() {} +func (*GetRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_b3a38a4dc2575267, []int{1} +} +func (m *GetRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GetRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *GetRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetRequest.Merge(m, src) +} +func (m *GetRequest) XXX_Size() int { + return m.Size() +} +func (m *GetRequest) XXX_DiscardUnknown() { + xxx_messageInfo_GetRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_GetRequest proto.InternalMessageInfo + +func (m *GetRequest) GetTTL() uint32 { + if m != nil { + return m.TTL + } + return 0 +} + +type GetResponse struct { + Withdraw *Item `protobuf:"bytes,1,opt,name=Withdraw,proto3" json:"Withdraw,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetResponse) Reset() { *m = GetResponse{} } +func (m *GetResponse) String() string { return proto.CompactTextString(m) } +func (*GetResponse) ProtoMessage() {} +func (*GetResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_b3a38a4dc2575267, []int{2} +} +func (m *GetResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GetResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *GetResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetResponse.Merge(m, src) +} +func (m *GetResponse) XXX_Size() int { + return m.Size() +} +func (m *GetResponse) XXX_DiscardUnknown() { + xxx_messageInfo_GetResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_GetResponse proto.InternalMessageInfo + +func (m *GetResponse) GetWithdraw() *Item { + if m != nil { + return m.Withdraw + } + return nil +} + +type PutRequest struct { + OwnerID OwnerID `protobuf:"bytes,1,opt,name=OwnerID,proto3,customtype=OwnerID" json:"OwnerID"` + Amount *decimal.Decimal `protobuf:"bytes,2,opt,name=Amount,proto3" json:"Amount,omitempty"` + Height uint64 `protobuf:"varint,3,opt,name=Height,proto3" json:"Height,omitempty"` + MessageID MessageID `protobuf:"bytes,4,opt,name=MessageID,proto3,customtype=MessageID" json:"MessageID"` + Signature []byte `protobuf:"bytes,5,opt,name=Signature,proto3" json:"Signature,omitempty"` + TTL uint32 `protobuf:"varint,6,opt,name=TTL,proto3" json:"TTL,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *PutRequest) Reset() { *m = PutRequest{} } +func (m *PutRequest) String() string { return proto.CompactTextString(m) } +func (*PutRequest) ProtoMessage() {} +func (*PutRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_b3a38a4dc2575267, []int{3} +} +func (m *PutRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *PutRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *PutRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_PutRequest.Merge(m, src) +} +func (m *PutRequest) XXX_Size() int { + return m.Size() +} +func (m *PutRequest) XXX_DiscardUnknown() { + xxx_messageInfo_PutRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_PutRequest proto.InternalMessageInfo + +func (m *PutRequest) GetAmount() *decimal.Decimal { + if m != nil { + return m.Amount + } + return nil +} + +func (m *PutRequest) GetHeight() uint64 { + if m != nil { + return m.Height + } + return 0 +} + +func (m *PutRequest) GetSignature() []byte { + if m != nil { + return m.Signature + } + return nil +} + +func (m *PutRequest) GetTTL() uint32 { + if m != nil { + return m.TTL + } + return 0 +} + +type PutResponse struct { + ID ChequeID `protobuf:"bytes,1,opt,name=ID,proto3,customtype=ChequeID" json:"ID"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *PutResponse) Reset() { *m = PutResponse{} } +func (m *PutResponse) String() string { return proto.CompactTextString(m) } +func (*PutResponse) ProtoMessage() {} +func (*PutResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_b3a38a4dc2575267, []int{4} +} +func (m *PutResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *PutResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *PutResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_PutResponse.Merge(m, src) +} +func (m *PutResponse) XXX_Size() int { + return m.Size() +} +func (m *PutResponse) XXX_DiscardUnknown() { + xxx_messageInfo_PutResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_PutResponse proto.InternalMessageInfo + +type ListRequest struct { + OwnerID OwnerID `protobuf:"bytes,1,opt,name=OwnerID,proto3,customtype=OwnerID" json:"OwnerID"` + TTL uint32 `protobuf:"varint,2,opt,name=TTL,proto3" json:"TTL,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ListRequest) Reset() { *m = ListRequest{} } +func (m *ListRequest) String() string { return proto.CompactTextString(m) } +func (*ListRequest) ProtoMessage() {} +func (*ListRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_b3a38a4dc2575267, []int{5} +} +func (m *ListRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ListRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *ListRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_ListRequest.Merge(m, src) +} +func (m *ListRequest) XXX_Size() int { + return m.Size() +} +func (m *ListRequest) XXX_DiscardUnknown() { + xxx_messageInfo_ListRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_ListRequest proto.InternalMessageInfo + +func (m *ListRequest) GetTTL() uint32 { + if m != nil { + return m.TTL + } + return 0 +} + +type ListResponse struct { + Items []*Item `protobuf:"bytes,1,rep,name=Items,proto3" json:"Items,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ListResponse) Reset() { *m = ListResponse{} } +func (m *ListResponse) String() string { return proto.CompactTextString(m) } +func (*ListResponse) ProtoMessage() {} +func (*ListResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_b3a38a4dc2575267, []int{6} +} +func (m *ListResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ListResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *ListResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_ListResponse.Merge(m, src) +} +func (m *ListResponse) XXX_Size() int { + return m.Size() +} +func (m *ListResponse) XXX_DiscardUnknown() { + xxx_messageInfo_ListResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_ListResponse proto.InternalMessageInfo + +func (m *ListResponse) GetItems() []*Item { + if m != nil { + return m.Items + } + return nil +} + +type DeleteRequest struct { + ID ChequeID `protobuf:"bytes,1,opt,name=ID,proto3,customtype=ChequeID" json:"ID"` + OwnerID OwnerID `protobuf:"bytes,2,opt,name=OwnerID,proto3,customtype=OwnerID" json:"OwnerID"` + MessageID MessageID `protobuf:"bytes,3,opt,name=MessageID,proto3,customtype=MessageID" json:"MessageID"` + Signature []byte `protobuf:"bytes,4,opt,name=Signature,proto3" json:"Signature,omitempty"` + TTL uint32 `protobuf:"varint,5,opt,name=TTL,proto3" json:"TTL,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DeleteRequest) Reset() { *m = DeleteRequest{} } +func (m *DeleteRequest) String() string { return proto.CompactTextString(m) } +func (*DeleteRequest) ProtoMessage() {} +func (*DeleteRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_b3a38a4dc2575267, []int{7} +} +func (m *DeleteRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DeleteRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *DeleteRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_DeleteRequest.Merge(m, src) +} +func (m *DeleteRequest) XXX_Size() int { + return m.Size() +} +func (m *DeleteRequest) XXX_DiscardUnknown() { + xxx_messageInfo_DeleteRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_DeleteRequest proto.InternalMessageInfo + +func (m *DeleteRequest) GetSignature() []byte { + if m != nil { + return m.Signature + } + return nil +} + +func (m *DeleteRequest) GetTTL() uint32 { + if m != nil { + return m.TTL + } + return 0 +} + +type DeleteResponse struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DeleteResponse) Reset() { *m = DeleteResponse{} } +func (m *DeleteResponse) String() string { return proto.CompactTextString(m) } +func (*DeleteResponse) ProtoMessage() {} +func (*DeleteResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_b3a38a4dc2575267, []int{8} +} +func (m *DeleteResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DeleteResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *DeleteResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_DeleteResponse.Merge(m, src) +} +func (m *DeleteResponse) XXX_Size() int { + return m.Size() +} +func (m *DeleteResponse) XXX_DiscardUnknown() { + xxx_messageInfo_DeleteResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_DeleteResponse proto.InternalMessageInfo + +func init() { + proto.RegisterType((*Item)(nil), "accounting.Item") + proto.RegisterType((*GetRequest)(nil), "accounting.GetRequest") + proto.RegisterType((*GetResponse)(nil), "accounting.GetResponse") + proto.RegisterType((*PutRequest)(nil), "accounting.PutRequest") + proto.RegisterType((*PutResponse)(nil), "accounting.PutResponse") + proto.RegisterType((*ListRequest)(nil), "accounting.ListRequest") + proto.RegisterType((*ListResponse)(nil), "accounting.ListResponse") + proto.RegisterType((*DeleteRequest)(nil), "accounting.DeleteRequest") + proto.RegisterType((*DeleteResponse)(nil), "accounting.DeleteResponse") +} + +func init() { proto.RegisterFile("accounting/withdraw.proto", fileDescriptor_b3a38a4dc2575267) } + +var fileDescriptor_b3a38a4dc2575267 = []byte{ + // 550 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x94, 0xcd, 0x6e, 0xd3, 0x40, + 0x10, 0xc7, 0xbb, 0xb6, 0xe3, 0xb6, 0x93, 0x14, 0xc2, 0x4a, 0x14, 0xd7, 0x42, 0xae, 0xe5, 0x03, + 0x0a, 0x82, 0xc4, 0x52, 0x91, 0x22, 0x21, 0x0e, 0xa8, 0xc1, 0x52, 0x31, 0x2a, 0x22, 0x32, 0x95, + 0x90, 0xb8, 0x39, 0xce, 0xd6, 0xb1, 0x48, 0xec, 0x10, 0xaf, 0x89, 0x78, 0x13, 0xde, 0x82, 0x27, + 0xe0, 0xde, 0x23, 0x47, 0xd4, 0x43, 0x85, 0xc2, 0x3b, 0x70, 0x46, 0x5e, 0xaf, 0xbb, 0x36, 0x2d, + 0xa2, 0x20, 0x38, 0x79, 0xe7, 0x63, 0x77, 0x66, 0x7e, 0xff, 0xf5, 0xc2, 0x8e, 0x1f, 0x04, 0x49, + 0x16, 0xd3, 0x28, 0x0e, 0xed, 0x65, 0x44, 0x27, 0xe3, 0x85, 0xbf, 0xec, 0xcd, 0x17, 0x09, 0x4d, + 0x30, 0x88, 0x90, 0x7e, 0x73, 0x4c, 0x82, 0x68, 0xe6, 0x4f, 0x6d, 0xfe, 0x2d, 0x52, 0xf4, 0x6e, + 0x18, 0xd1, 0x49, 0x36, 0xea, 0x05, 0xc9, 0xcc, 0x0e, 0x93, 0x30, 0xb1, 0x99, 0x7b, 0x94, 0x1d, + 0x33, 0x8b, 0x19, 0x6c, 0x55, 0xa4, 0x5b, 0x1f, 0x11, 0x28, 0x2e, 0x25, 0x33, 0x6c, 0x82, 0xe4, + 0x3a, 0x1a, 0x32, 0x51, 0xa7, 0x35, 0x68, 0x9f, 0x9c, 0xed, 0xae, 0x9d, 0x9e, 0xed, 0x6e, 0x3c, + 0x99, 0x90, 0xb7, 0x19, 0x71, 0x1d, 0x4f, 0x72, 0x1d, 0x7c, 0x17, 0xd6, 0x5f, 0x2c, 0x63, 0xb2, + 0x70, 0x1d, 0x4d, 0x62, 0x69, 0xd7, 0x79, 0x5a, 0xe9, 0xf6, 0xca, 0x05, 0xee, 0x80, 0xba, 0x3f, + 0xcb, 0x1b, 0xd5, 0x64, 0x13, 0x75, 0x9a, 0x7b, 0xed, 0x5e, 0xd9, 0xa4, 0x53, 0x7c, 0x3d, 0x1e, + 0xc7, 0xdb, 0xa0, 0x3e, 0x25, 0x51, 0x38, 0xa1, 0x9a, 0x62, 0xa2, 0x8e, 0xe2, 0x71, 0x0b, 0x6b, + 0xb0, 0x3e, 0xf4, 0xdf, 0x4f, 0x13, 0x7f, 0xac, 0x35, 0xf2, 0x62, 0x5e, 0x69, 0x5a, 0x6f, 0x00, + 0x0e, 0x08, 0xf5, 0xf2, 0xc6, 0x52, 0xfa, 0x6f, 0xdb, 0x6e, 0x83, 0x7c, 0x74, 0x74, 0xc8, 0x7a, + 0xde, 0xf2, 0xf2, 0xa5, 0xf5, 0x08, 0x9a, 0xac, 0x58, 0x3a, 0x4f, 0xe2, 0x94, 0xe0, 0xfb, 0xb0, + 0xf1, 0x8a, 0x2b, 0xc2, 0x6a, 0xe6, 0x93, 0x09, 0x49, 0x7a, 0x39, 0x48, 0xef, 0x3c, 0xc3, 0x3a, + 0x45, 0x00, 0xc3, 0xec, 0xbc, 0xd5, 0x4a, 0x23, 0xe8, 0xca, 0xfc, 0xa4, 0x2b, 0xf3, 0x93, 0x6b, + 0xfc, 0x6c, 0xd8, 0x7c, 0x4e, 0xd2, 0xd4, 0x0f, 0x89, 0xeb, 0x30, 0xb4, 0xad, 0xc1, 0x0d, 0x5e, + 0x4e, 0x04, 0x3c, 0xb1, 0xc4, 0xb7, 0x61, 0xf3, 0x65, 0x14, 0xc6, 0x3e, 0xcd, 0x16, 0x84, 0x23, + 0x17, 0x8e, 0x92, 0x8c, 0x2a, 0xc8, 0xd8, 0xd0, 0x64, 0xb3, 0x71, 0x32, 0xbf, 0xd5, 0xc1, 0x7a, + 0x06, 0xcd, 0xc3, 0x28, 0xfd, 0x1b, 0x1a, 0xbc, 0xb8, 0x24, 0x8a, 0xf7, 0xa1, 0x55, 0x9c, 0xc5, + 0xab, 0xdf, 0x81, 0x46, 0xce, 0x3e, 0xd5, 0x90, 0x29, 0x5f, 0x2a, 0x4a, 0x11, 0xb6, 0x3e, 0x21, + 0xd8, 0x72, 0xc8, 0x94, 0x50, 0xf2, 0x5f, 0xee, 0x4f, 0x0d, 0xba, 0xfc, 0xa7, 0xd0, 0x95, 0x5f, + 0x40, 0x6f, 0x88, 0xb9, 0xdb, 0x70, 0xad, 0x6c, 0xbf, 0x98, 0x7c, 0xef, 0x3b, 0x12, 0x57, 0x12, + 0xf7, 0x41, 0x3e, 0x20, 0x14, 0x6f, 0x57, 0xc7, 0x17, 0xff, 0x8a, 0x7e, 0xeb, 0x82, 0x9f, 0xe3, + 0xeb, 0x83, 0x3c, 0xcc, 0x7e, 0xda, 0x27, 0x2e, 0x6e, 0x7d, 0x5f, 0x55, 0xf4, 0x87, 0xa0, 0xe4, + 0x32, 0xe0, 0x5a, 0x42, 0x45, 0x64, 0x5d, 0xbb, 0x18, 0xe0, 0x5b, 0x1f, 0x83, 0x5a, 0x4c, 0x82, + 0x77, 0xaa, 0x39, 0x35, 0x71, 0x74, 0xfd, 0xb2, 0x50, 0x71, 0xc0, 0x60, 0xff, 0x64, 0x65, 0xa0, + 0xcf, 0x2b, 0x03, 0x7d, 0x59, 0x19, 0xe8, 0xeb, 0xca, 0x40, 0x1f, 0xbe, 0x19, 0x6b, 0xaf, 0xef, + 0x55, 0x5e, 0xbf, 0x38, 0x9d, 0x07, 0x41, 0x77, 0x4c, 0xde, 0xd9, 0x31, 0x49, 0x8e, 0xd3, 0x6e, + 0xf1, 0xf6, 0x89, 0x13, 0x47, 0x2a, 0xf3, 0x3c, 0xf8, 0x11, 0x00, 0x00, 0xff, 0xff, 0xd9, 0xcf, + 0xde, 0x66, 0x71, 0x05, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// WithdrawClient is the client API for Withdraw service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type WithdrawClient interface { + Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*GetResponse, error) + Put(ctx context.Context, in *PutRequest, opts ...grpc.CallOption) (*PutResponse, error) + List(ctx context.Context, in *ListRequest, opts ...grpc.CallOption) (*ListResponse, error) + Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteResponse, error) +} + +type withdrawClient struct { + cc *grpc.ClientConn +} + +func NewWithdrawClient(cc *grpc.ClientConn) WithdrawClient { + return &withdrawClient{cc} +} + +func (c *withdrawClient) Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*GetResponse, error) { + out := new(GetResponse) + err := c.cc.Invoke(ctx, "/accounting.Withdraw/Get", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *withdrawClient) Put(ctx context.Context, in *PutRequest, opts ...grpc.CallOption) (*PutResponse, error) { + out := new(PutResponse) + err := c.cc.Invoke(ctx, "/accounting.Withdraw/Put", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *withdrawClient) List(ctx context.Context, in *ListRequest, opts ...grpc.CallOption) (*ListResponse, error) { + out := new(ListResponse) + err := c.cc.Invoke(ctx, "/accounting.Withdraw/List", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *withdrawClient) Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteResponse, error) { + out := new(DeleteResponse) + err := c.cc.Invoke(ctx, "/accounting.Withdraw/Delete", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// WithdrawServer is the server API for Withdraw service. +type WithdrawServer interface { + Get(context.Context, *GetRequest) (*GetResponse, error) + Put(context.Context, *PutRequest) (*PutResponse, error) + List(context.Context, *ListRequest) (*ListResponse, error) + Delete(context.Context, *DeleteRequest) (*DeleteResponse, error) +} + +// UnimplementedWithdrawServer can be embedded to have forward compatible implementations. +type UnimplementedWithdrawServer struct { +} + +func (*UnimplementedWithdrawServer) Get(ctx context.Context, req *GetRequest) (*GetResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Get not implemented") +} +func (*UnimplementedWithdrawServer) Put(ctx context.Context, req *PutRequest) (*PutResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Put not implemented") +} +func (*UnimplementedWithdrawServer) List(ctx context.Context, req *ListRequest) (*ListResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method List not implemented") +} +func (*UnimplementedWithdrawServer) Delete(ctx context.Context, req *DeleteRequest) (*DeleteResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Delete not implemented") +} + +func RegisterWithdrawServer(s *grpc.Server, srv WithdrawServer) { + s.RegisterService(&_Withdraw_serviceDesc, srv) +} + +func _Withdraw_Get_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WithdrawServer).Get(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/accounting.Withdraw/Get", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WithdrawServer).Get(ctx, req.(*GetRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Withdraw_Put_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(PutRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WithdrawServer).Put(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/accounting.Withdraw/Put", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WithdrawServer).Put(ctx, req.(*PutRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Withdraw_List_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WithdrawServer).List(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/accounting.Withdraw/List", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WithdrawServer).List(ctx, req.(*ListRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Withdraw_Delete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WithdrawServer).Delete(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/accounting.Withdraw/Delete", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WithdrawServer).Delete(ctx, req.(*DeleteRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Withdraw_serviceDesc = grpc.ServiceDesc{ + ServiceName: "accounting.Withdraw", + HandlerType: (*WithdrawServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Get", + Handler: _Withdraw_Get_Handler, + }, + { + MethodName: "Put", + Handler: _Withdraw_Put_Handler, + }, + { + MethodName: "List", + Handler: _Withdraw_List_Handler, + }, + { + MethodName: "Delete", + Handler: _Withdraw_Delete_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "accounting/withdraw.proto", +} + +func (m *Item) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Item) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Item) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Payload) > 0 { + i -= len(m.Payload) + copy(dAtA[i:], m.Payload) + i = encodeVarintWithdraw(dAtA, i, uint64(len(m.Payload))) + i-- + dAtA[i] = 0x2a + } + if m.Height != 0 { + i = encodeVarintWithdraw(dAtA, i, uint64(m.Height)) + i-- + dAtA[i] = 0x20 + } + if m.Amount != nil { + { + size, err := m.Amount.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintWithdraw(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + { + size := m.OwnerID.Size() + i -= size + if _, err := m.OwnerID.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintWithdraw(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size := m.ID.Size() + i -= size + if _, err := m.ID.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintWithdraw(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *GetRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GetRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.TTL != 0 { + i = encodeVarintWithdraw(dAtA, i, uint64(m.TTL)) + i-- + dAtA[i] = 0x18 + } + { + size := m.OwnerID.Size() + i -= size + if _, err := m.OwnerID.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintWithdraw(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size := m.ID.Size() + i -= size + if _, err := m.ID.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintWithdraw(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *GetResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GetResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.Withdraw != nil { + { + size, err := m.Withdraw.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintWithdraw(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *PutRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PutRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PutRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.TTL != 0 { + i = encodeVarintWithdraw(dAtA, i, uint64(m.TTL)) + i-- + dAtA[i] = 0x30 + } + if len(m.Signature) > 0 { + i -= len(m.Signature) + copy(dAtA[i:], m.Signature) + i = encodeVarintWithdraw(dAtA, i, uint64(len(m.Signature))) + i-- + dAtA[i] = 0x2a + } + { + size := m.MessageID.Size() + i -= size + if _, err := m.MessageID.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintWithdraw(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + if m.Height != 0 { + i = encodeVarintWithdraw(dAtA, i, uint64(m.Height)) + i-- + dAtA[i] = 0x18 + } + if m.Amount != nil { + { + size, err := m.Amount.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintWithdraw(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + { + size := m.OwnerID.Size() + i -= size + if _, err := m.OwnerID.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintWithdraw(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *PutResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PutResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PutResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + { + size := m.ID.Size() + i -= size + if _, err := m.ID.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintWithdraw(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *ListRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ListRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ListRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.TTL != 0 { + i = encodeVarintWithdraw(dAtA, i, uint64(m.TTL)) + i-- + dAtA[i] = 0x10 + } + { + size := m.OwnerID.Size() + i -= size + if _, err := m.OwnerID.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintWithdraw(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *ListResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ListResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ListResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Items) > 0 { + for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintWithdraw(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *DeleteRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *DeleteRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DeleteRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.TTL != 0 { + i = encodeVarintWithdraw(dAtA, i, uint64(m.TTL)) + i-- + dAtA[i] = 0x28 + } + if len(m.Signature) > 0 { + i -= len(m.Signature) + copy(dAtA[i:], m.Signature) + i = encodeVarintWithdraw(dAtA, i, uint64(len(m.Signature))) + i-- + dAtA[i] = 0x22 + } + { + size := m.MessageID.Size() + i -= size + if _, err := m.MessageID.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintWithdraw(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + { + size := m.OwnerID.Size() + i -= size + if _, err := m.OwnerID.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintWithdraw(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size := m.ID.Size() + i -= size + if _, err := m.ID.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintWithdraw(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *DeleteResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *DeleteResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DeleteResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + return len(dAtA) - i, nil +} + +func encodeVarintWithdraw(dAtA []byte, offset int, v uint64) int { + offset -= sovWithdraw(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Item) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.ID.Size() + n += 1 + l + sovWithdraw(uint64(l)) + l = m.OwnerID.Size() + n += 1 + l + sovWithdraw(uint64(l)) + if m.Amount != nil { + l = m.Amount.Size() + n += 1 + l + sovWithdraw(uint64(l)) + } + if m.Height != 0 { + n += 1 + sovWithdraw(uint64(m.Height)) + } + l = len(m.Payload) + if l > 0 { + n += 1 + l + sovWithdraw(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *GetRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.ID.Size() + n += 1 + l + sovWithdraw(uint64(l)) + l = m.OwnerID.Size() + n += 1 + l + sovWithdraw(uint64(l)) + if m.TTL != 0 { + n += 1 + sovWithdraw(uint64(m.TTL)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *GetResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Withdraw != nil { + l = m.Withdraw.Size() + n += 1 + l + sovWithdraw(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *PutRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.OwnerID.Size() + n += 1 + l + sovWithdraw(uint64(l)) + if m.Amount != nil { + l = m.Amount.Size() + n += 1 + l + sovWithdraw(uint64(l)) + } + if m.Height != 0 { + n += 1 + sovWithdraw(uint64(m.Height)) + } + l = m.MessageID.Size() + n += 1 + l + sovWithdraw(uint64(l)) + l = len(m.Signature) + if l > 0 { + n += 1 + l + sovWithdraw(uint64(l)) + } + if m.TTL != 0 { + n += 1 + sovWithdraw(uint64(m.TTL)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *PutResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.ID.Size() + n += 1 + l + sovWithdraw(uint64(l)) + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *ListRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.OwnerID.Size() + n += 1 + l + sovWithdraw(uint64(l)) + if m.TTL != 0 { + n += 1 + sovWithdraw(uint64(m.TTL)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *ListResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Items) > 0 { + for _, e := range m.Items { + l = e.Size() + n += 1 + l + sovWithdraw(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *DeleteRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.ID.Size() + n += 1 + l + sovWithdraw(uint64(l)) + l = m.OwnerID.Size() + n += 1 + l + sovWithdraw(uint64(l)) + l = m.MessageID.Size() + n += 1 + l + sovWithdraw(uint64(l)) + l = len(m.Signature) + if l > 0 { + n += 1 + l + sovWithdraw(uint64(l)) + } + if m.TTL != 0 { + n += 1 + sovWithdraw(uint64(m.TTL)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *DeleteResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovWithdraw(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozWithdraw(x uint64) (n int) { + return sovWithdraw(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Item) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWithdraw + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Item: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Item: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWithdraw + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthWithdraw + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthWithdraw + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OwnerID", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWithdraw + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthWithdraw + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthWithdraw + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.OwnerID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWithdraw + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthWithdraw + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthWithdraw + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Amount == nil { + m.Amount = &decimal.Decimal{} + } + if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType) + } + m.Height = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWithdraw + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Height |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Payload", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWithdraw + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthWithdraw + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthWithdraw + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Payload = append(m.Payload[:0], dAtA[iNdEx:postIndex]...) + if m.Payload == nil { + m.Payload = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipWithdraw(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthWithdraw + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthWithdraw + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GetRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWithdraw + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GetRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWithdraw + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthWithdraw + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthWithdraw + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OwnerID", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWithdraw + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthWithdraw + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthWithdraw + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.OwnerID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TTL", wireType) + } + m.TTL = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWithdraw + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TTL |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipWithdraw(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthWithdraw + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthWithdraw + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GetResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWithdraw + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GetResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Withdraw", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWithdraw + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthWithdraw + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthWithdraw + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Withdraw == nil { + m.Withdraw = &Item{} + } + if err := m.Withdraw.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipWithdraw(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthWithdraw + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthWithdraw + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *PutRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWithdraw + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: PutRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PutRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OwnerID", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWithdraw + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthWithdraw + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthWithdraw + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.OwnerID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWithdraw + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthWithdraw + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthWithdraw + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Amount == nil { + m.Amount = &decimal.Decimal{} + } + if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType) + } + m.Height = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWithdraw + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Height |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MessageID", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWithdraw + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthWithdraw + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthWithdraw + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.MessageID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signature", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWithdraw + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthWithdraw + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthWithdraw + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Signature = append(m.Signature[:0], dAtA[iNdEx:postIndex]...) + if m.Signature == nil { + m.Signature = []byte{} + } + iNdEx = postIndex + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TTL", wireType) + } + m.TTL = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWithdraw + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TTL |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipWithdraw(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthWithdraw + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthWithdraw + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *PutResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWithdraw + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: PutResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PutResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWithdraw + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthWithdraw + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthWithdraw + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipWithdraw(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthWithdraw + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthWithdraw + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ListRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWithdraw + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ListRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ListRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OwnerID", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWithdraw + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthWithdraw + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthWithdraw + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.OwnerID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TTL", wireType) + } + m.TTL = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWithdraw + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TTL |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipWithdraw(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthWithdraw + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthWithdraw + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ListResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWithdraw + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ListResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ListResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWithdraw + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthWithdraw + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthWithdraw + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Items = append(m.Items, &Item{}) + if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipWithdraw(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthWithdraw + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthWithdraw + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DeleteRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWithdraw + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DeleteRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DeleteRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWithdraw + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthWithdraw + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthWithdraw + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OwnerID", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWithdraw + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthWithdraw + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthWithdraw + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.OwnerID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MessageID", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWithdraw + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthWithdraw + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthWithdraw + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.MessageID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signature", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWithdraw + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthWithdraw + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthWithdraw + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Signature = append(m.Signature[:0], dAtA[iNdEx:postIndex]...) + if m.Signature == nil { + m.Signature = []byte{} + } + iNdEx = postIndex + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TTL", wireType) + } + m.TTL = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWithdraw + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TTL |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipWithdraw(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthWithdraw + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthWithdraw + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DeleteResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWithdraw + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DeleteResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DeleteResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipWithdraw(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthWithdraw + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthWithdraw + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipWithdraw(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowWithdraw + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowWithdraw + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowWithdraw + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthWithdraw + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupWithdraw + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthWithdraw + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthWithdraw = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowWithdraw = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupWithdraw = fmt.Errorf("proto: unexpected end of group") +) diff --git a/accounting/withdraw.proto b/accounting/withdraw.proto new file mode 100644 index 0000000..c099ef7 --- /dev/null +++ b/accounting/withdraw.proto @@ -0,0 +1,61 @@ +syntax = "proto3"; +package accounting; +option go_package = "github.com/nspcc-dev/neofs-proto/accounting"; + +import "decimal/decimal.proto"; +import "github.com/gogo/protobuf/gogoproto/gogo.proto"; + +option (gogoproto.stable_marshaler_all) = true; + +service Withdraw { + rpc Get(GetRequest) returns (GetResponse); + rpc Put(PutRequest) returns (PutResponse); + rpc List(ListRequest) returns (ListResponse); + rpc Delete(DeleteRequest) returns (DeleteResponse); +} + +message Item { + bytes ID = 1 [(gogoproto.customtype) = "ChequeID", (gogoproto.nullable) = false]; + bytes OwnerID = 2 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false]; + decimal.Decimal Amount = 3; + uint64 Height = 4; + bytes Payload = 5; +} + +message GetRequest { + bytes ID = 1 [(gogoproto.customtype) = "ChequeID", (gogoproto.nullable) = false]; + bytes OwnerID = 2 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false]; + uint32 TTL = 3; +} +message GetResponse { + Item Withdraw = 1; +} + +message PutRequest { + bytes OwnerID = 1 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false]; + decimal.Decimal Amount = 2; + uint64 Height = 3; + bytes MessageID = 4 [(gogoproto.customtype) = "MessageID", (gogoproto.nullable) = false]; + bytes Signature = 5; + uint32 TTL = 6; +} +message PutResponse { + bytes ID = 1 [(gogoproto.customtype) = "ChequeID", (gogoproto.nullable) = false]; +} + +message ListRequest { + bytes OwnerID = 1 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false]; + uint32 TTL = 2; +} +message ListResponse { + repeated Item Items = 1; +} + +message DeleteRequest { + bytes ID = 1 [(gogoproto.customtype) = "ChequeID", (gogoproto.nullable) = false]; + bytes OwnerID = 2 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false]; + bytes MessageID = 3 [(gogoproto.customtype) = "MessageID", (gogoproto.nullable) = false]; + bytes Signature = 4; + uint32 TTL = 5; +} +message DeleteResponse {} diff --git a/bootstrap/service.go b/bootstrap/service.go new file mode 100644 index 0000000..6d0d3ca --- /dev/null +++ b/bootstrap/service.go @@ -0,0 +1,11 @@ +package bootstrap + +import ( + "github.com/nspcc-dev/neofs-proto/service" +) + +// NodeType type alias. +type NodeType = service.NodeRole + +// SetTTL sets ttl to Request to satisfy TTLRequest interface. +func (m *Request) SetTTL(v uint32) { m.TTL = v } diff --git a/bootstrap/service.pb.go b/bootstrap/service.pb.go new file mode 100644 index 0000000..2fcdb4d --- /dev/null +++ b/bootstrap/service.pb.go @@ -0,0 +1,483 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: bootstrap/service.proto + +package bootstrap + +import ( + context "context" + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/golang/protobuf/proto" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package + +// Request message to communicate between DHT nodes +type Request struct { + Type NodeType `protobuf:"varint,1,opt,name=type,proto3,customtype=NodeType" json:"type"` + Info NodeInfo `protobuf:"bytes,2,opt,name=info,proto3" json:"info"` + TTL uint32 `protobuf:"varint,3,opt,name=TTL,proto3" json:"TTL,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Request) Reset() { *m = Request{} } +func (m *Request) String() string { return proto.CompactTextString(m) } +func (*Request) ProtoMessage() {} +func (*Request) Descriptor() ([]byte, []int) { + return fileDescriptor_21bce759c9d8eb63, []int{0} +} +func (m *Request) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Request) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *Request) XXX_Merge(src proto.Message) { + xxx_messageInfo_Request.Merge(m, src) +} +func (m *Request) XXX_Size() int { + return m.Size() +} +func (m *Request) XXX_DiscardUnknown() { + xxx_messageInfo_Request.DiscardUnknown(m) +} + +var xxx_messageInfo_Request proto.InternalMessageInfo + +func (m *Request) GetInfo() NodeInfo { + if m != nil { + return m.Info + } + return NodeInfo{} +} + +func (m *Request) GetTTL() uint32 { + if m != nil { + return m.TTL + } + return 0 +} + +func init() { + proto.RegisterType((*Request)(nil), "bootstrap.Request") +} + +func init() { proto.RegisterFile("bootstrap/service.proto", fileDescriptor_21bce759c9d8eb63) } + +var fileDescriptor_21bce759c9d8eb63 = []byte{ + // 284 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x4f, 0xca, 0xcf, 0x2f, + 0x29, 0x2e, 0x29, 0x4a, 0x2c, 0xd0, 0x2f, 0x4e, 0x2d, 0x2a, 0xcb, 0x4c, 0x4e, 0xd5, 0x2b, 0x28, + 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x84, 0x4b, 0x48, 0x89, 0x22, 0xd4, 0x94, 0x54, 0x16, 0xa4, 0x16, + 0x43, 0x54, 0x48, 0xe9, 0xa6, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0xa7, + 0xe7, 0xa7, 0xe7, 0xeb, 0x83, 0x85, 0x93, 0x4a, 0xd3, 0xc0, 0x3c, 0x30, 0x07, 0xcc, 0x82, 0x28, + 0x57, 0xaa, 0xe0, 0x62, 0x0f, 0x4a, 0x2d, 0x2c, 0x4d, 0x2d, 0x2e, 0x11, 0xd2, 0xe1, 0x62, 0x01, + 0x19, 0x24, 0xc1, 0xa8, 0xc0, 0xa8, 0xc1, 0xea, 0x24, 0x71, 0xe2, 0x9e, 0x3c, 0xc3, 0xad, 0x7b, + 0xf2, 0x1c, 0x7e, 0xf9, 0x29, 0xa9, 0x21, 0x95, 0x05, 0xa9, 0x8f, 0xee, 0xc9, 0xb3, 0x80, 0xe8, + 0x20, 0xb0, 0x2a, 0x21, 0x5d, 0x2e, 0x96, 0xcc, 0xbc, 0xb4, 0x7c, 0x09, 0x26, 0x05, 0x46, 0x0d, + 0x6e, 0x23, 0x61, 0x3d, 0xb8, 0x6b, 0xf4, 0x40, 0x1a, 0x3c, 0xf3, 0xd2, 0xf2, 0x9d, 0x58, 0x40, + 0x46, 0x04, 0x81, 0x95, 0x09, 0x09, 0x70, 0x31, 0x87, 0x84, 0xf8, 0x48, 0x30, 0x2b, 0x30, 0x6a, + 0xf0, 0x06, 0x81, 0x98, 0x46, 0x0e, 0x5c, 0x9c, 0x4e, 0x30, 0x3d, 0x42, 0xc6, 0x5c, 0xec, 0x01, + 0x45, 0xf9, 0xc9, 0xa9, 0xc5, 0xc5, 0x42, 0x42, 0x48, 0x46, 0x41, 0x9d, 0x26, 0x25, 0x82, 0x24, + 0x16, 0x5c, 0x50, 0x94, 0x9a, 0x98, 0xe2, 0x9b, 0x58, 0xe0, 0xe4, 0x70, 0xe2, 0x91, 0x1c, 0xe3, + 0x85, 0x47, 0x72, 0x8c, 0x37, 0x1e, 0xc9, 0x31, 0x3e, 0x78, 0x24, 0xc7, 0x38, 0xe3, 0xb1, 0x1c, + 0x43, 0x94, 0x16, 0x52, 0x00, 0xe4, 0x15, 0x17, 0x24, 0x27, 0xeb, 0xa6, 0xa4, 0x96, 0xe9, 0xe7, + 0xa5, 0xe6, 0xa7, 0x15, 0xeb, 0x42, 0xbc, 0x0f, 0x37, 0x2b, 0x89, 0x0d, 0x2c, 0x60, 0x0c, 0x08, + 0x00, 0x00, 0xff, 0xff, 0xdf, 0x93, 0xe2, 0x48, 0x70, 0x01, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// BootstrapClient is the client API for Bootstrap service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type BootstrapClient interface { + Process(ctx context.Context, in *Request, opts ...grpc.CallOption) (*SpreadMap, error) +} + +type bootstrapClient struct { + cc *grpc.ClientConn +} + +func NewBootstrapClient(cc *grpc.ClientConn) BootstrapClient { + return &bootstrapClient{cc} +} + +func (c *bootstrapClient) Process(ctx context.Context, in *Request, opts ...grpc.CallOption) (*SpreadMap, error) { + out := new(SpreadMap) + err := c.cc.Invoke(ctx, "/bootstrap.Bootstrap/Process", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// BootstrapServer is the server API for Bootstrap service. +type BootstrapServer interface { + Process(context.Context, *Request) (*SpreadMap, error) +} + +// UnimplementedBootstrapServer can be embedded to have forward compatible implementations. +type UnimplementedBootstrapServer struct { +} + +func (*UnimplementedBootstrapServer) Process(ctx context.Context, req *Request) (*SpreadMap, error) { + return nil, status.Errorf(codes.Unimplemented, "method Process not implemented") +} + +func RegisterBootstrapServer(s *grpc.Server, srv BootstrapServer) { + s.RegisterService(&_Bootstrap_serviceDesc, srv) +} + +func _Bootstrap_Process_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(BootstrapServer).Process(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/bootstrap.Bootstrap/Process", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(BootstrapServer).Process(ctx, req.(*Request)) + } + return interceptor(ctx, in, info, handler) +} + +var _Bootstrap_serviceDesc = grpc.ServiceDesc{ + ServiceName: "bootstrap.Bootstrap", + HandlerType: (*BootstrapServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Process", + Handler: _Bootstrap_Process_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "bootstrap/service.proto", +} + +func (m *Request) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Request) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Request) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.TTL != 0 { + i = encodeVarintService(dAtA, i, uint64(m.TTL)) + i-- + dAtA[i] = 0x18 + } + { + size, err := m.Info.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if m.Type != 0 { + i = encodeVarintService(dAtA, i, uint64(m.Type)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func encodeVarintService(dAtA []byte, offset int, v uint64) int { + offset -= sovService(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Request) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Type != 0 { + n += 1 + sovService(uint64(m.Type)) + } + l = m.Info.Size() + n += 1 + l + sovService(uint64(l)) + if m.TTL != 0 { + n += 1 + sovService(uint64(m.TTL)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovService(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozService(x uint64) (n int) { + return sovService(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Request) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Request: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Request: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) + } + m.Type = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Type |= NodeType(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Info", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Info.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TTL", wireType) + } + m.TTL = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TTL |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipService(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowService + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowService + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowService + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthService + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupService + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthService + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthService = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowService = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupService = fmt.Errorf("proto: unexpected end of group") +) diff --git a/bootstrap/service.proto b/bootstrap/service.proto new file mode 100644 index 0000000..3c9dced --- /dev/null +++ b/bootstrap/service.proto @@ -0,0 +1,20 @@ +syntax = "proto3"; +package bootstrap; +option go_package = "github.com/nspcc-dev/neofs-proto/bootstrap"; + +import "bootstrap/types.proto"; +import "github.com/gogo/protobuf/gogoproto/gogo.proto"; + +option (gogoproto.stable_marshaler_all) = true; + +// The Bootstrap service definition. +service Bootstrap { + rpc Process(Request) returns (bootstrap.SpreadMap); +} + +// Request message to communicate between DHT nodes +message Request { + int32 type = 1 [(gogoproto.customname) = "Type" , (gogoproto.nullable) = false, (gogoproto.customtype) = "NodeType"]; + bootstrap.NodeInfo info = 2 [(gogoproto.nullable) = false]; + uint32 TTL = 3; +} diff --git a/bootstrap/types.go b/bootstrap/types.go new file mode 100644 index 0000000..6fcf0ed --- /dev/null +++ b/bootstrap/types.go @@ -0,0 +1,100 @@ +package bootstrap + +import ( + "bytes" + "encoding/hex" + "strconv" + "strings" + + "github.com/golang/protobuf/proto" + "github.com/nspcc-dev/neofs-proto/object" +) + +type ( + // NodeStatus is a bitwise status field of the node. + NodeStatus uint64 +) + +const ( + storageFullMask = 0x1 + + optionCapacity = "/Capacity:" + optionPrice = "/Price:" +) + +var ( + _ proto.Message = (*NodeInfo)(nil) + _ proto.Message = (*SpreadMap)(nil) +) + +// Equals checks whether two NodeInfo has same address. +func (m NodeInfo) Equals(n1 NodeInfo) bool { + return m.Address == n1.Address && bytes.Equal(m.PubKey, n1.PubKey) +} + +// Full checks if node has enough space for storing users objects. +func (n NodeStatus) Full() bool { + return n&storageFullMask > 0 +} + +// SetFull changes state of node to indicate if node has enough space for storing users objects. +// If value is true - there's not enough space. +func (n *NodeStatus) SetFull(value bool) { + switch value { + case true: + *n |= NodeStatus(storageFullMask) + case false: + *n &= NodeStatus(^uint64(storageFullMask)) + } +} + +// Price returns price in 1e-8*GAS/Megabyte per month. +// User set price in GAS/Terabyte per month. +func (m NodeInfo) Price() uint64 { + for i := range m.Options { + if strings.HasPrefix(m.Options[i], optionPrice) { + n, err := strconv.ParseFloat(m.Options[i][len(optionPrice):], 64) + if err != nil { + return 0 + } + return uint64(n*1e8) / uint64(object.UnitsMB) // UnitsMB == megabytes in 1 terabyte + } + } + return 0 +} + +// Capacity returns node's capacity as reported by user. +func (m NodeInfo) Capacity() uint64 { + for i := range m.Options { + if strings.HasPrefix(m.Options[i], optionCapacity) { + n, err := strconv.ParseUint(m.Options[i][len(optionCapacity):], 10, 64) + if err != nil { + return 0 + } + return n + } + } + return 0 +} + +// String returns string representation of NodeInfo. +func (m NodeInfo) String() string { + return "(NodeInfo)<" + + "Address:" + m.Address + + ", " + + "PublicKey:" + hex.EncodeToString(m.PubKey) + + ", " + + "Options: [" + strings.Join(m.Options, ",") + "]>" +} + +// String returns string representation of SpreadMap. +func (m SpreadMap) String() string { + result := make([]string, 0, len(m.NetMap)) + for i := range m.NetMap { + result = append(result, m.NetMap[i].String()) + } + return "(SpreadMap)<" + + "Epoch: " + strconv.FormatUint(m.Epoch, 10) + + ", " + + "Netmap: [" + strings.Join(result, ",") + "]>" +} diff --git a/bootstrap/types.pb.go b/bootstrap/types.pb.go new file mode 100644 index 0000000..a90de05 --- /dev/null +++ b/bootstrap/types.pb.go @@ -0,0 +1,697 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: bootstrap/types.proto + +package bootstrap + +import ( + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/golang/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package + +type SpreadMap struct { + Epoch uint64 `protobuf:"varint,1,opt,name=Epoch,proto3" json:"Epoch,omitempty"` + NetMap []NodeInfo `protobuf:"bytes,2,rep,name=NetMap,proto3" json:"NetMap"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SpreadMap) Reset() { *m = SpreadMap{} } +func (*SpreadMap) ProtoMessage() {} +func (*SpreadMap) Descriptor() ([]byte, []int) { + return fileDescriptor_423083266369adee, []int{0} +} +func (m *SpreadMap) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *SpreadMap) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *SpreadMap) XXX_Merge(src proto.Message) { + xxx_messageInfo_SpreadMap.Merge(m, src) +} +func (m *SpreadMap) XXX_Size() int { + return m.Size() +} +func (m *SpreadMap) XXX_DiscardUnknown() { + xxx_messageInfo_SpreadMap.DiscardUnknown(m) +} + +var xxx_messageInfo_SpreadMap proto.InternalMessageInfo + +func (m *SpreadMap) GetEpoch() uint64 { + if m != nil { + return m.Epoch + } + return 0 +} + +func (m *SpreadMap) GetNetMap() []NodeInfo { + if m != nil { + return m.NetMap + } + return nil +} + +type NodeInfo struct { + Address string `protobuf:"bytes,1,opt,name=Address,proto3" json:"address"` + PubKey []byte `protobuf:"bytes,2,opt,name=PubKey,proto3" json:"pubkey,omitempty"` + Options []string `protobuf:"bytes,3,rep,name=Options,proto3" json:"options,omitempty"` + Status NodeStatus `protobuf:"varint,4,opt,name=Status,proto3,customtype=NodeStatus" json:"status"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *NodeInfo) Reset() { *m = NodeInfo{} } +func (*NodeInfo) ProtoMessage() {} +func (*NodeInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_423083266369adee, []int{1} +} +func (m *NodeInfo) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *NodeInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *NodeInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_NodeInfo.Merge(m, src) +} +func (m *NodeInfo) XXX_Size() int { + return m.Size() +} +func (m *NodeInfo) XXX_DiscardUnknown() { + xxx_messageInfo_NodeInfo.DiscardUnknown(m) +} + +var xxx_messageInfo_NodeInfo proto.InternalMessageInfo + +func (m *NodeInfo) GetAddress() string { + if m != nil { + return m.Address + } + return "" +} + +func (m *NodeInfo) GetPubKey() []byte { + if m != nil { + return m.PubKey + } + return nil +} + +func (m *NodeInfo) GetOptions() []string { + if m != nil { + return m.Options + } + return nil +} + +func init() { + proto.RegisterType((*SpreadMap)(nil), "bootstrap.SpreadMap") + proto.RegisterType((*NodeInfo)(nil), "bootstrap.NodeInfo") +} + +func init() { proto.RegisterFile("bootstrap/types.proto", fileDescriptor_423083266369adee) } + +var fileDescriptor_423083266369adee = []byte{ + // 345 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x4c, 0x90, 0xcb, 0x4a, 0xc3, 0x40, + 0x18, 0x85, 0x33, 0x6d, 0x4d, 0xcd, 0xd4, 0x85, 0xc6, 0x16, 0x82, 0x48, 0x12, 0x0a, 0x42, 0x90, + 0x36, 0xc1, 0xcb, 0x0b, 0x18, 0x10, 0x14, 0x69, 0x95, 0xd4, 0x95, 0xbb, 0x5c, 0xa6, 0x17, 0xa4, + 0xf9, 0x87, 0xcc, 0x44, 0xc8, 0xce, 0xc7, 0xf0, 0x89, 0xa4, 0x4b, 0x97, 0xc5, 0x45, 0xd0, 0xb8, + 0xcb, 0x53, 0x48, 0x27, 0x6d, 0xe9, 0xee, 0x3f, 0xe7, 0x7c, 0x33, 0xf3, 0xcf, 0xc1, 0x9d, 0x00, + 0x80, 0x33, 0x9e, 0xf8, 0xd4, 0xe1, 0x19, 0x25, 0xcc, 0xa6, 0x09, 0x70, 0x50, 0x95, 0xad, 0x7d, + 0xd2, 0x9f, 0xcc, 0xf8, 0x34, 0x0d, 0xec, 0x10, 0xe6, 0xce, 0x04, 0x26, 0xe0, 0x08, 0x22, 0x48, + 0xc7, 0x42, 0x09, 0x21, 0xa6, 0xea, 0x64, 0xf7, 0x19, 0x2b, 0x23, 0x9a, 0x10, 0x3f, 0x1a, 0xf8, + 0x54, 0x6d, 0xe3, 0xbd, 0x5b, 0x0a, 0xe1, 0x54, 0x43, 0x26, 0xb2, 0x1a, 0x5e, 0x25, 0xd4, 0x0b, + 0x2c, 0x0f, 0x09, 0x1f, 0xf8, 0x54, 0xab, 0x99, 0x75, 0xab, 0x75, 0x79, 0x6c, 0x6f, 0x5f, 0xb3, + 0x87, 0x10, 0x91, 0xfb, 0x78, 0x0c, 0x6e, 0x63, 0x91, 0x1b, 0x92, 0xb7, 0x06, 0xbb, 0x9f, 0x08, + 0xef, 0x6f, 0x22, 0xf5, 0x0c, 0x37, 0x6f, 0xa2, 0x28, 0x21, 0x8c, 0x89, 0x7b, 0x15, 0xb7, 0x55, + 0xe6, 0x46, 0xd3, 0xaf, 0x2c, 0x6f, 0x93, 0xa9, 0x3d, 0x2c, 0x3f, 0xa5, 0xc1, 0x03, 0xc9, 0xb4, + 0x9a, 0x89, 0xac, 0x03, 0xb7, 0x5d, 0xe6, 0xc6, 0x21, 0x4d, 0x83, 0x57, 0x92, 0xf5, 0x60, 0x3e, + 0xe3, 0x64, 0x4e, 0x79, 0xe6, 0xad, 0x19, 0xd5, 0xc1, 0xcd, 0x47, 0xca, 0x67, 0x10, 0x33, 0xad, + 0x6e, 0xd6, 0x2d, 0xc5, 0xed, 0x94, 0xb9, 0x71, 0x04, 0x95, 0xb5, 0xc3, 0x6f, 0x28, 0xf5, 0x1a, + 0xcb, 0x23, 0xee, 0xf3, 0x94, 0x69, 0x8d, 0xd5, 0xe7, 0xdc, 0xd3, 0xd5, 0xc2, 0xdf, 0xb9, 0x81, + 0x57, 0x7b, 0x56, 0x49, 0x99, 0x1b, 0x32, 0x13, 0x93, 0xb7, 0x66, 0xdd, 0xbb, 0xe5, 0xaf, 0x2e, + 0xbd, 0x17, 0xba, 0xb4, 0x28, 0x74, 0xf4, 0x55, 0xe8, 0x68, 0x59, 0xe8, 0xe8, 0xa7, 0xd0, 0xd1, + 0xc7, 0x9f, 0x2e, 0xbd, 0x9c, 0xef, 0x74, 0x1d, 0x33, 0x1a, 0x86, 0xfd, 0x88, 0xbc, 0x39, 0x31, + 0x81, 0x31, 0xeb, 0x57, 0x4d, 0x6f, 0x9b, 0x0a, 0x64, 0x61, 0x5c, 0xfd, 0x07, 0x00, 0x00, 0xff, + 0xff, 0x71, 0xeb, 0x37, 0x57, 0xc2, 0x01, 0x00, 0x00, +} + +func (m *SpreadMap) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *SpreadMap) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *SpreadMap) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.NetMap) > 0 { + for iNdEx := len(m.NetMap) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.NetMap[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if m.Epoch != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Epoch)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *NodeInfo) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *NodeInfo) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *NodeInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.Status != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Status)) + i-- + dAtA[i] = 0x20 + } + if len(m.Options) > 0 { + for iNdEx := len(m.Options) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Options[iNdEx]) + copy(dAtA[i:], m.Options[iNdEx]) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Options[iNdEx]))) + i-- + dAtA[i] = 0x1a + } + } + if len(m.PubKey) > 0 { + i -= len(m.PubKey) + copy(dAtA[i:], m.PubKey) + i = encodeVarintTypes(dAtA, i, uint64(len(m.PubKey))) + i-- + dAtA[i] = 0x12 + } + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintTypes(dAtA []byte, offset int, v uint64) int { + offset -= sovTypes(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *SpreadMap) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Epoch != 0 { + n += 1 + sovTypes(uint64(m.Epoch)) + } + if len(m.NetMap) > 0 { + for _, e := range m.NetMap { + l = e.Size() + n += 1 + l + sovTypes(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *NodeInfo) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Address) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.PubKey) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + if len(m.Options) > 0 { + for _, s := range m.Options { + l = len(s) + n += 1 + l + sovTypes(uint64(l)) + } + } + if m.Status != 0 { + n += 1 + sovTypes(uint64(m.Status)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovTypes(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozTypes(x uint64) (n int) { + return sovTypes(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *SpreadMap) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: SpreadMap: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SpreadMap: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Epoch", wireType) + } + m.Epoch = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Epoch |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NetMap", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.NetMap = append(m.NetMap, NodeInfo{}) + if err := m.NetMap[len(m.NetMap)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *NodeInfo) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: NodeInfo: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: NodeInfo: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PubKey", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PubKey = append(m.PubKey[:0], dAtA[iNdEx:postIndex]...) + if m.PubKey == nil { + m.PubKey = []byte{} + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Options", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Options = append(m.Options, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + m.Status = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Status |= NodeStatus(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipTypes(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthTypes + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTypes + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthTypes + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthTypes = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTypes = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTypes = fmt.Errorf("proto: unexpected end of group") +) diff --git a/bootstrap/types.proto b/bootstrap/types.proto new file mode 100644 index 0000000..4d6e458 --- /dev/null +++ b/bootstrap/types.proto @@ -0,0 +1,22 @@ +syntax = "proto3"; +package bootstrap; +option go_package = "github.com/nspcc-dev/neofs-proto/bootstrap"; + +import "github.com/gogo/protobuf/gogoproto/gogo.proto"; + +option (gogoproto.stable_marshaler_all) = true;; + +option (gogoproto.stringer_all) = false; +option (gogoproto.goproto_stringer_all) = false; + +message SpreadMap { + uint64 Epoch = 1; + repeated NodeInfo NetMap = 2 [(gogoproto.nullable) = false]; +} + +message NodeInfo { + string Address = 1 [(gogoproto.jsontag) = "address"]; + bytes PubKey = 2 [(gogoproto.jsontag) = "pubkey,omitempty"]; + repeated string Options = 3 [(gogoproto.jsontag) = "options,omitempty"]; + uint64 Status = 4 [(gogoproto.jsontag) = "status", (gogoproto.nullable) = false, (gogoproto.customtype) = "NodeStatus"]; +} diff --git a/chain/address.go b/chain/address.go new file mode 100644 index 0000000..e760d69 --- /dev/null +++ b/chain/address.go @@ -0,0 +1,185 @@ +package chain + +import ( + "bytes" + "crypto/ecdsa" + "crypto/sha256" + "encoding/hex" + + "github.com/mr-tron/base58" + crypto "github.com/nspcc-dev/neofs-crypto" + "github.com/nspcc-dev/neofs-proto/internal" + "github.com/pkg/errors" + "golang.org/x/crypto/ripemd160" +) + +// WalletAddress implements NEO address. +type WalletAddress [AddressLength]byte + +const ( + // AddressLength contains size of address, + // 0x17 byte (address version) + 20 bytes of ScriptHash + 4 bytes of checksum. + AddressLength = 25 + + // ScriptHashLength contains size of ScriptHash. + ScriptHashLength = 20 + + // ErrEmptyAddress is raised when empty Address is passed. + ErrEmptyAddress = internal.Error("empty address") + + // ErrAddressLength is raised when passed address has wrong size. + ErrAddressLength = internal.Error("wrong address length") +) + +func checksum(sign []byte) []byte { + hash := sha256.Sum256(sign) + hash = sha256.Sum256(hash[:]) + return hash[:4] +} + +// FetchPublicKeys tries to parse public keys from verification script. +func FetchPublicKeys(vs []byte) []*ecdsa.PublicKey { + var ( + count int + offset int + ln = len(vs) + result []*ecdsa.PublicKey + ) + + switch { + case ln < 1: // wrong data size + return nil + case vs[ln-1] == 0xac: // last byte is CHECKSIG + count = 1 + case vs[ln-1] == 0xae: // last byte is CHECKMULTISIG + // 2nd byte from the end indicates about PK's count + count = int(vs[ln-2] - 0x50) + // ignores CHECKMULTISIG + offset = 1 + default: // unknown type + return nil + } + + result = make([]*ecdsa.PublicKey, 0, count) + for i := 0; i < count; i++ { + // ignores PUSHBYTE33 and tries to parse + from, to := offset+1, offset+1+crypto.PublicKeyCompressedSize + + // when passed VerificationScript has wrong size + if len(vs) < to { + return nil + } + + key := crypto.UnmarshalPublicKey(vs[from:to]) + // when wrong public key is passed + if key == nil { + return nil + } + result = append(result, key) + + offset += 1 + crypto.PublicKeyCompressedSize + } + return result +} + +// VerificationScript returns VerificationScript composed from public keys. +func VerificationScript(pubs ...*ecdsa.PublicKey) []byte { + var ( + pre []byte + suf []byte + body []byte + offset int + lnPK = len(pubs) + ln = crypto.PublicKeyCompressedSize*lnPK + lnPK // 33 * count + count * 1 (PUSHBYTES33) + ) + + if len(pubs) > 1 { + pre = []byte{0x51} // one address + suf = []byte{byte(0x50 + lnPK), 0xae} // count of PK's + CHECKMULTISIG + } else { + suf = []byte{0xac} // CHECKSIG + } + + ln += len(pre) + len(suf) + + body = make([]byte, ln) + offset += copy(body, pre) + + for i := range pubs { + body[offset] = 0x21 + offset++ + offset += copy(body[offset:], crypto.MarshalPublicKey(pubs[i])) + } + + copy(body[offset:], suf) + + return body +} + +// KeysToAddress return NEO address composed from public keys. +func KeysToAddress(pubs ...*ecdsa.PublicKey) string { + if len(pubs) == 0 { + return "" + } + return Address(VerificationScript(pubs...)) +} + +// Address returns NEO address based on passed VerificationScript. +func Address(verificationScript []byte) string { + sign := [AddressLength]byte{0x17} + hash := sha256.Sum256(verificationScript) + ripe := ripemd160.New() + ripe.Write(hash[:]) + copy(sign[1:], ripe.Sum(nil)) + copy(sign[21:], checksum(sign[:21])) + return base58.Encode(sign[:]) +} + +// ReversedScriptHashToAddress parses script hash and returns valid NEO address. +func ReversedScriptHashToAddress(sc string) (addr string, err error) { + var data []byte + if data, err = DecodeScriptHash(sc); err != nil { + return + } + sign := [AddressLength]byte{0x17} + copy(sign[1:], data) + copy(sign[1+ScriptHashLength:], checksum(sign[:1+ScriptHashLength])) + return base58.Encode(sign[:]), nil +} + +// IsAddress checks that passed NEO Address is valid. +func IsAddress(s string) error { + if s == "" { + return ErrEmptyAddress + } else if addr, err := base58.Decode(s); err != nil { + return errors.Wrap(err, "base58 decode") + } else if ln := len(addr); ln != AddressLength { + return errors.Wrapf(ErrAddressLength, "length %d != %d", AddressLength, ln) + } else if sum := checksum(addr[:21]); !bytes.Equal(addr[21:], sum) { + return errors.Errorf("wrong checksum %0x != %0x", + addr[21:], sum) + } + + return nil +} + +// ReverseBytes returns reversed []byte of given. +func ReverseBytes(data []byte) []byte { + for i, j := 0, len(data)-1; i < j; i, j = i+1, j-1 { + data[i], data[j] = data[j], data[i] + } + return data +} + +// DecodeScriptHash parses script hash into slice of bytes. +func DecodeScriptHash(s string) ([]byte, error) { + if s == "" { + return nil, ErrEmptyAddress + } else if addr, err := hex.DecodeString(s); err != nil { + return nil, errors.Wrap(err, "hex decode") + } else if ln := len(addr); ln != ScriptHashLength { + return nil, errors.Wrapf(ErrAddressLength, "length %d != %d", ScriptHashLength, ln) + } else { + return addr, nil + } +} diff --git a/chain/address_test.go b/chain/address_test.go new file mode 100644 index 0000000..f83b1dd --- /dev/null +++ b/chain/address_test.go @@ -0,0 +1,292 @@ +package chain + +import ( + "crypto/ecdsa" + "encoding/hex" + "testing" + + crypto "github.com/nspcc-dev/neofs-crypto" + "github.com/nspcc-dev/neofs-crypto/test" + "github.com/stretchr/testify/require" +) + +func TestAddress(t *testing.T) { + var ( + multiSigVerificationScript = "512103c02a93134f98d9c78ec54b1b1f97fc64cd81360f53a293f41e4ad54aac3c57172103fea219d4ccfd7641cebbb2439740bb4bd7c4730c1abd6ca1dc44386533816df952ae" + multiSigAddress = "ANbvKqa2SfgTUkq43NRUhCiyxPrpUPn7S3" + + normalVerificationScript = "2102a33413277a319cc6fd4c54a2feb9032eba668ec587f307e319dc48733087fa61ac" + normalAddress = "AcraNnCuPKnUYtPYyrACRCVJhLpvskbfhu" + ) + + t.Run("check multi-sig address", func(t *testing.T) { + data, err := hex.DecodeString(multiSigVerificationScript) + require.NoError(t, err) + require.Equal(t, multiSigAddress, Address(data)) + }) + + t.Run("check normal address", func(t *testing.T) { + data, err := hex.DecodeString(normalVerificationScript) + require.NoError(t, err) + require.Equal(t, normalAddress, Address(data)) + }) +} + +func TestVerificationScript(t *testing.T) { + t.Run("check normal", func(t *testing.T) { + pkString := "02a33413277a319cc6fd4c54a2feb9032eba668ec587f307e319dc48733087fa61" + + pkBytes, err := hex.DecodeString(pkString) + require.NoError(t, err) + + pk := crypto.UnmarshalPublicKey(pkBytes) + + expect, err := hex.DecodeString( + "21" + pkString + // PUSHBYTES33 + "ac", // CHECKSIG + ) + + require.Equal(t, expect, VerificationScript(pk)) + }) + + t.Run("check multisig", func(t *testing.T) { + pk1String := "03c02a93134f98d9c78ec54b1b1f97fc64cd81360f53a293f41e4ad54aac3c5717" + pk2String := "03fea219d4ccfd7641cebbb2439740bb4bd7c4730c1abd6ca1dc44386533816df9" + + pk1Bytes, err := hex.DecodeString(pk1String) + require.NoError(t, err) + + pk1 := crypto.UnmarshalPublicKey(pk1Bytes) + + pk2Bytes, err := hex.DecodeString(pk2String) + require.NoError(t, err) + + pk2 := crypto.UnmarshalPublicKey(pk2Bytes) + + expect, err := hex.DecodeString( + "51" + // one address + "21" + pk1String + // PUSHBYTES33 + "21" + pk2String + // PUSHBYTES33 + "52" + // 2 PublicKeys + "ae", // CHECKMULTISIG + ) + + require.Equal(t, expect, VerificationScript(pk1, pk2)) + }) +} + +func TestKeysToAddress(t *testing.T) { + t.Run("check normal", func(t *testing.T) { + pkString := "02a33413277a319cc6fd4c54a2feb9032eba668ec587f307e319dc48733087fa61" + + pkBytes, err := hex.DecodeString(pkString) + require.NoError(t, err) + + pk := crypto.UnmarshalPublicKey(pkBytes) + + expect := "AcraNnCuPKnUYtPYyrACRCVJhLpvskbfhu" + + actual := KeysToAddress(pk) + require.Equal(t, expect, actual) + require.NoError(t, IsAddress(actual)) + }) + + t.Run("check multisig", func(t *testing.T) { + pk1String := "03c02a93134f98d9c78ec54b1b1f97fc64cd81360f53a293f41e4ad54aac3c5717" + pk2String := "03fea219d4ccfd7641cebbb2439740bb4bd7c4730c1abd6ca1dc44386533816df9" + + pk1Bytes, err := hex.DecodeString(pk1String) + require.NoError(t, err) + + pk1 := crypto.UnmarshalPublicKey(pk1Bytes) + + pk2Bytes, err := hex.DecodeString(pk2String) + require.NoError(t, err) + + pk2 := crypto.UnmarshalPublicKey(pk2Bytes) + + expect := "ANbvKqa2SfgTUkq43NRUhCiyxPrpUPn7S3" + actual := KeysToAddress(pk1, pk2) + require.Equal(t, expect, actual) + require.NoError(t, IsAddress(actual)) + }) +} + +func TestFetchPublicKeys(t *testing.T) { + var ( + multiSigVerificationScript = "512103c02a93134f98d9c78ec54b1b1f97fc64cd81360f53a293f41e4ad54aac3c57172103fea219d4ccfd7641cebbb2439740bb4bd7c4730c1abd6ca1dc44386533816df952ae" + normalVerificationScript = "2102a33413277a319cc6fd4c54a2feb9032eba668ec587f307e319dc48733087fa61ac" + + pk1String = "03c02a93134f98d9c78ec54b1b1f97fc64cd81360f53a293f41e4ad54aac3c5717" + pk2String = "03fea219d4ccfd7641cebbb2439740bb4bd7c4730c1abd6ca1dc44386533816df9" + pk3String = "02a33413277a319cc6fd4c54a2feb9032eba668ec587f307e319dc48733087fa61" + ) + + t.Run("shouls not fail", func(t *testing.T) { + wrongVS, err := hex.DecodeString(multiSigVerificationScript) + require.NoError(t, err) + + wrongVS[len(wrongVS)-1] = 0x1 + + wrongPK, err := hex.DecodeString(multiSigVerificationScript) + require.NoError(t, err) + wrongPK[2] = 0x1 + + var testCases = []struct { + name string + value []byte + }{ + {name: "empty VerificationScript"}, + { + name: "wrong size VerificationScript", + value: []byte{0x1}, + }, + { + name: "wrong VerificationScript type", + value: wrongVS, + }, + { + name: "wrong public key in VerificationScript", + value: wrongPK, + }, + } + + for i := range testCases { + tt := testCases[i] + t.Run(tt.name, func(t *testing.T) { + var keys []*ecdsa.PublicKey + require.NotPanics(t, func() { + keys = FetchPublicKeys(tt.value) + }) + require.Nil(t, keys) + }) + } + }) + + t.Run("check multi-sig address", func(t *testing.T) { + data, err := hex.DecodeString(multiSigVerificationScript) + require.NoError(t, err) + + pk1Bytes, err := hex.DecodeString(pk1String) + require.NoError(t, err) + + pk2Bytes, err := hex.DecodeString(pk2String) + require.NoError(t, err) + + pk1 := crypto.UnmarshalPublicKey(pk1Bytes) + pk2 := crypto.UnmarshalPublicKey(pk2Bytes) + + keys := FetchPublicKeys(data) + require.Len(t, keys, 2) + require.Equal(t, keys[0], pk1) + require.Equal(t, keys[1], pk2) + }) + + t.Run("check normal address", func(t *testing.T) { + data, err := hex.DecodeString(normalVerificationScript) + require.NoError(t, err) + + pkBytes, err := hex.DecodeString(pk3String) + require.NoError(t, err) + + pk := crypto.UnmarshalPublicKey(pkBytes) + + keys := FetchPublicKeys(data) + require.Len(t, keys, 1) + require.Equal(t, keys[0], pk) + }) + + t.Run("generate 10 keys VerificationScript and try parse it", func(t *testing.T) { + var ( + count = 10 + expect = make([]*ecdsa.PublicKey, 0, count) + ) + + for i := 0; i < count; i++ { + key := test.DecodeKey(i) + expect = append(expect, &key.PublicKey) + } + + vs := VerificationScript(expect...) + + actual := FetchPublicKeys(vs) + require.Equal(t, expect, actual) + }) +} + +func TestReversedScriptHashToAddress(t *testing.T) { + var testCases = []struct { + name string + value string + expect string + }{ + { + name: "first", + expect: "APfiG5imQgn8dzTTfaDfqHnxo3QDUkF69A", + value: "5696acd07f0927fd5f01946828638c9e2c90c5dc", + }, + + { + name: "second", + expect: "AK2nJJpJr6o664CWJKi1QRXjqeic2zRp8y", + value: "23ba2703c53263e8d6e522dc32203339dcd8eee9", + }, + } + + for i := range testCases { + tt := testCases[i] + t.Run(tt.name, func(t *testing.T) { + actual, err := ReversedScriptHashToAddress(tt.value) + require.NoError(t, err) + require.Equal(t, tt.expect, actual) + require.NoError(t, IsAddress(actual)) + }) + } +} + +func TestReverseBytes(t *testing.T) { + var testCases = []struct { + name string + value []byte + expect []byte + }{ + {name: "empty"}, + { + name: "single byte", + expect: []byte{0x1}, + value: []byte{0x1}, + }, + + { + name: "two bytes", + expect: []byte{0x2, 0x1}, + value: []byte{0x1, 0x2}, + }, + + { + name: "three bytes", + expect: []byte{0x3, 0x2, 0x1}, + value: []byte{0x1, 0x2, 0x3}, + }, + + { + name: "five bytes", + expect: []byte{0x5, 0x4, 0x3, 0x2, 0x1}, + value: []byte{0x1, 0x2, 0x3, 0x4, 0x5}, + }, + + { + name: "eight bytes", + expect: []byte{0x8, 0x7, 0x6, 0x5, 0x4, 0x3, 0x2, 0x1}, + value: []byte{0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8}, + }, + } + + for i := range testCases { + tt := testCases[i] + t.Run(tt.name, func(t *testing.T) { + actual := ReverseBytes(tt.value) + require.Equal(t, tt.expect, actual) + }) + } +} diff --git a/container/service.go b/container/service.go new file mode 100644 index 0000000..527377a --- /dev/null +++ b/container/service.go @@ -0,0 +1,68 @@ +package container + +import ( + "bytes" + "encoding/binary" + + "github.com/nspcc-dev/neofs-proto/refs" + "github.com/pkg/errors" +) + +type ( + // CID type alias. + CID = refs.CID + // UUID type alias. + UUID = refs.UUID + // OwnerID type alias. + OwnerID = refs.OwnerID + // OwnerID type alias. + MessageID = refs.MessageID +) + +// SetTTL sets ttl to GetRequest to satisfy TTLRequest interface. +func (m *GetRequest) SetTTL(v uint32) { m.TTL = v } + +// SetTTL sets ttl to PutRequest to satisfy TTLRequest interface. +func (m *PutRequest) SetTTL(v uint32) { m.TTL = v } + +// SetTTL sets ttl to ListRequest to satisfy TTLRequest interface. +func (m *ListRequest) SetTTL(v uint32) { m.TTL = v } + +// SetTTL sets ttl to DeleteRequest to satisfy TTLRequest interface. +func (m *DeleteRequest) SetTTL(v uint32) { m.TTL = v } + +// SetSignature sets signature to PutRequest to satisfy SignedRequest interface. +func (m *PutRequest) SetSignature(v []byte) { m.Signature = v } + +// SetSignature sets signature to DeleteRequest to satisfy SignedRequest interface. +func (m *DeleteRequest) SetSignature(v []byte) { m.Signature = v } + +// PrepareData prepares bytes representation of PutRequest to satisfy SignedRequest interface. +func (m *PutRequest) PrepareData() ([]byte, error) { + var ( + err error + buf = new(bytes.Buffer) + capBytes = make([]byte, 8) + ) + + binary.BigEndian.PutUint64(capBytes, m.Capacity) + + if _, err = buf.Write(m.MessageID.Bytes()); err != nil { + return nil, errors.Wrap(err, "could not write message id") + } else if _, err = buf.Write(capBytes); err != nil { + return nil, errors.Wrap(err, "could not write capacity") + } else if _, err = buf.Write(m.OwnerID.Bytes()); err != nil { + return nil, errors.Wrap(err, "could not write pub") + } else if data, err := m.Rules.Marshal(); err != nil { + return nil, errors.Wrap(err, "could not marshal placement") + } else if _, err = buf.Write(data); err != nil { + return nil, errors.Wrap(err, "could not write placement") + } + + return buf.Bytes(), nil +} + +// PrepareData prepares bytes representation of DeleteRequest to satisfy SignedRequest interface. +func (m *DeleteRequest) PrepareData() ([]byte, error) { + return m.CID.Bytes(), nil +} diff --git a/container/service.pb.go b/container/service.pb.go new file mode 100644 index 0000000..bc2e831 --- /dev/null +++ b/container/service.pb.go @@ -0,0 +1,2131 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: container/service.proto + +package container + +import ( + context "context" + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/golang/protobuf/proto" + netmap "github.com/nspcc-dev/netmap" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package + +// NewRequest message to create new container +type PutRequest struct { + MessageID MessageID `protobuf:"bytes,1,opt,name=MessageID,proto3,customtype=MessageID" json:"MessageID"` + Capacity uint64 `protobuf:"varint,2,opt,name=Capacity,proto3" json:"Capacity,omitempty"` + OwnerID OwnerID `protobuf:"bytes,3,opt,name=OwnerID,proto3,customtype=OwnerID" json:"OwnerID"` + Rules netmap.PlacementRule `protobuf:"bytes,4,opt,name=rules,proto3" json:"rules"` + Signature []byte `protobuf:"bytes,5,opt,name=Signature,proto3" json:"Signature,omitempty"` + TTL uint32 `protobuf:"varint,6,opt,name=TTL,proto3" json:"TTL,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *PutRequest) Reset() { *m = PutRequest{} } +func (m *PutRequest) String() string { return proto.CompactTextString(m) } +func (*PutRequest) ProtoMessage() {} +func (*PutRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_e1fa9d7ab2e7ae06, []int{0} +} +func (m *PutRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *PutRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *PutRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_PutRequest.Merge(m, src) +} +func (m *PutRequest) XXX_Size() int { + return m.Size() +} +func (m *PutRequest) XXX_DiscardUnknown() { + xxx_messageInfo_PutRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_PutRequest proto.InternalMessageInfo + +func (m *PutRequest) GetCapacity() uint64 { + if m != nil { + return m.Capacity + } + return 0 +} + +func (m *PutRequest) GetRules() netmap.PlacementRule { + if m != nil { + return m.Rules + } + return netmap.PlacementRule{} +} + +func (m *PutRequest) GetSignature() []byte { + if m != nil { + return m.Signature + } + return nil +} + +func (m *PutRequest) GetTTL() uint32 { + if m != nil { + return m.TTL + } + return 0 +} + +// PutResponse message to respond about container uuid +type PutResponse struct { + CID CID `protobuf:"bytes,1,opt,name=CID,proto3,customtype=CID" json:"CID"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *PutResponse) Reset() { *m = PutResponse{} } +func (m *PutResponse) String() string { return proto.CompactTextString(m) } +func (*PutResponse) ProtoMessage() {} +func (*PutResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_e1fa9d7ab2e7ae06, []int{1} +} +func (m *PutResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *PutResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *PutResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_PutResponse.Merge(m, src) +} +func (m *PutResponse) XXX_Size() int { + return m.Size() +} +func (m *PutResponse) XXX_DiscardUnknown() { + xxx_messageInfo_PutResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_PutResponse proto.InternalMessageInfo + +type DeleteRequest struct { + CID CID `protobuf:"bytes,1,opt,name=CID,proto3,customtype=CID" json:"CID"` + TTL uint32 `protobuf:"varint,2,opt,name=TTL,proto3" json:"TTL,omitempty"` + Signature []byte `protobuf:"bytes,3,opt,name=Signature,proto3" json:"Signature,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DeleteRequest) Reset() { *m = DeleteRequest{} } +func (m *DeleteRequest) String() string { return proto.CompactTextString(m) } +func (*DeleteRequest) ProtoMessage() {} +func (*DeleteRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_e1fa9d7ab2e7ae06, []int{2} +} +func (m *DeleteRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DeleteRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *DeleteRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_DeleteRequest.Merge(m, src) +} +func (m *DeleteRequest) XXX_Size() int { + return m.Size() +} +func (m *DeleteRequest) XXX_DiscardUnknown() { + xxx_messageInfo_DeleteRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_DeleteRequest proto.InternalMessageInfo + +func (m *DeleteRequest) GetTTL() uint32 { + if m != nil { + return m.TTL + } + return 0 +} + +func (m *DeleteRequest) GetSignature() []byte { + if m != nil { + return m.Signature + } + return nil +} + +type DeleteResponse struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DeleteResponse) Reset() { *m = DeleteResponse{} } +func (m *DeleteResponse) String() string { return proto.CompactTextString(m) } +func (*DeleteResponse) ProtoMessage() {} +func (*DeleteResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_e1fa9d7ab2e7ae06, []int{3} +} +func (m *DeleteResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DeleteResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *DeleteResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_DeleteResponse.Merge(m, src) +} +func (m *DeleteResponse) XXX_Size() int { + return m.Size() +} +func (m *DeleteResponse) XXX_DiscardUnknown() { + xxx_messageInfo_DeleteResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_DeleteResponse proto.InternalMessageInfo + +// GetRequest message to fetch container placement rules +type GetRequest struct { + CID CID `protobuf:"bytes,1,opt,name=CID,proto3,customtype=CID" json:"CID"` + TTL uint32 `protobuf:"varint,2,opt,name=TTL,proto3" json:"TTL,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetRequest) Reset() { *m = GetRequest{} } +func (m *GetRequest) String() string { return proto.CompactTextString(m) } +func (*GetRequest) ProtoMessage() {} +func (*GetRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_e1fa9d7ab2e7ae06, []int{4} +} +func (m *GetRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GetRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *GetRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetRequest.Merge(m, src) +} +func (m *GetRequest) XXX_Size() int { + return m.Size() +} +func (m *GetRequest) XXX_DiscardUnknown() { + xxx_messageInfo_GetRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_GetRequest proto.InternalMessageInfo + +func (m *GetRequest) GetTTL() uint32 { + if m != nil { + return m.TTL + } + return 0 +} + +// GetResponse message with container structure +type GetResponse struct { + Container *Container `protobuf:"bytes,1,opt,name=Container,proto3" json:"Container,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetResponse) Reset() { *m = GetResponse{} } +func (m *GetResponse) String() string { return proto.CompactTextString(m) } +func (*GetResponse) ProtoMessage() {} +func (*GetResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_e1fa9d7ab2e7ae06, []int{5} +} +func (m *GetResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GetResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *GetResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetResponse.Merge(m, src) +} +func (m *GetResponse) XXX_Size() int { + return m.Size() +} +func (m *GetResponse) XXX_DiscardUnknown() { + xxx_messageInfo_GetResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_GetResponse proto.InternalMessageInfo + +func (m *GetResponse) GetContainer() *Container { + if m != nil { + return m.Container + } + return nil +} + +// ListRequest message to list containers for user +type ListRequest struct { + OwnerID OwnerID `protobuf:"bytes,1,opt,name=OwnerID,proto3,customtype=OwnerID" json:"OwnerID"` + TTL uint32 `protobuf:"varint,2,opt,name=TTL,proto3" json:"TTL,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ListRequest) Reset() { *m = ListRequest{} } +func (m *ListRequest) String() string { return proto.CompactTextString(m) } +func (*ListRequest) ProtoMessage() {} +func (*ListRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_e1fa9d7ab2e7ae06, []int{6} +} +func (m *ListRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ListRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *ListRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_ListRequest.Merge(m, src) +} +func (m *ListRequest) XXX_Size() int { + return m.Size() +} +func (m *ListRequest) XXX_DiscardUnknown() { + xxx_messageInfo_ListRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_ListRequest proto.InternalMessageInfo + +func (m *ListRequest) GetTTL() uint32 { + if m != nil { + return m.TTL + } + return 0 +} + +// ListResponse message to respond about all user containers +type ListResponse struct { + CID []CID `protobuf:"bytes,1,rep,name=CID,proto3,customtype=CID" json:"CID"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ListResponse) Reset() { *m = ListResponse{} } +func (m *ListResponse) String() string { return proto.CompactTextString(m) } +func (*ListResponse) ProtoMessage() {} +func (*ListResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_e1fa9d7ab2e7ae06, []int{7} +} +func (m *ListResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ListResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *ListResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_ListResponse.Merge(m, src) +} +func (m *ListResponse) XXX_Size() int { + return m.Size() +} +func (m *ListResponse) XXX_DiscardUnknown() { + xxx_messageInfo_ListResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_ListResponse proto.InternalMessageInfo + +func init() { + proto.RegisterType((*PutRequest)(nil), "container.PutRequest") + proto.RegisterType((*PutResponse)(nil), "container.PutResponse") + proto.RegisterType((*DeleteRequest)(nil), "container.DeleteRequest") + proto.RegisterType((*DeleteResponse)(nil), "container.DeleteResponse") + proto.RegisterType((*GetRequest)(nil), "container.GetRequest") + proto.RegisterType((*GetResponse)(nil), "container.GetResponse") + proto.RegisterType((*ListRequest)(nil), "container.ListRequest") + proto.RegisterType((*ListResponse)(nil), "container.ListResponse") +} + +func init() { proto.RegisterFile("container/service.proto", fileDescriptor_e1fa9d7ab2e7ae06) } + +var fileDescriptor_e1fa9d7ab2e7ae06 = []byte{ + // 520 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x53, 0xcf, 0x6e, 0xd3, 0x4e, + 0x10, 0xee, 0xd6, 0x69, 0xfa, 0xcb, 0xb8, 0xfd, 0x51, 0x56, 0x84, 0x1a, 0x0b, 0xdc, 0xc8, 0xa7, + 0x80, 0x88, 0x2d, 0x42, 0x25, 0x4e, 0x95, 0x20, 0x89, 0x54, 0x15, 0x15, 0x11, 0x6d, 0x7b, 0xe2, + 0x80, 0xe4, 0x98, 0xa9, 0xb1, 0xe4, 0xd8, 0xc6, 0xbb, 0x2e, 0xea, 0x9b, 0xf0, 0x48, 0x3d, 0x72, + 0x44, 0x1c, 0x2a, 0x14, 0x0e, 0x9c, 0x78, 0x07, 0x64, 0xaf, 0xff, 0x25, 0x2d, 0x20, 0x71, 0x59, + 0xcd, 0xce, 0x7c, 0xf3, 0xcd, 0x37, 0x33, 0xbb, 0xb0, 0xeb, 0x46, 0xa1, 0x70, 0xfc, 0x10, 0x13, + 0x9b, 0x63, 0x72, 0xee, 0xbb, 0x68, 0xc5, 0x49, 0x24, 0x22, 0xda, 0xa9, 0x02, 0x7a, 0xb7, 0xc6, + 0x88, 0x8b, 0x18, 0xb9, 0x44, 0xe8, 0x8f, 0x3c, 0x5f, 0xbc, 0x4f, 0x67, 0x96, 0x1b, 0xcd, 0xed, + 0x90, 0xc7, 0xae, 0x3b, 0x78, 0x87, 0xe7, 0x76, 0x88, 0x62, 0xee, 0xc4, 0x36, 0xc7, 0x00, 0x5d, + 0x11, 0x25, 0x05, 0x76, 0xd0, 0xc0, 0x7a, 0x91, 0x17, 0xd9, 0xb9, 0x7b, 0x96, 0x9e, 0xe5, 0xb7, + 0xfc, 0x92, 0x5b, 0x12, 0x6e, 0xfe, 0x20, 0x00, 0xd3, 0x54, 0x30, 0xfc, 0x90, 0x22, 0x17, 0xd4, + 0x86, 0xce, 0x2b, 0xe4, 0xdc, 0xf1, 0xf0, 0x68, 0xa2, 0x91, 0x1e, 0xe9, 0x6f, 0x8d, 0x6e, 0x5f, + 0x5e, 0xed, 0xad, 0x7d, 0xbd, 0xda, 0xab, 0x03, 0xac, 0x36, 0xa9, 0x0e, 0xff, 0x8d, 0x9d, 0xd8, + 0x71, 0x7d, 0x71, 0xa1, 0xad, 0xf7, 0x48, 0xbf, 0xc5, 0xaa, 0x3b, 0x7d, 0x08, 0x9b, 0xaf, 0x3f, + 0x86, 0x98, 0x1c, 0x4d, 0x34, 0x25, 0xa7, 0xba, 0x55, 0x50, 0x95, 0x6e, 0x56, 0x1a, 0xf4, 0x09, + 0x6c, 0x24, 0x69, 0x80, 0x5c, 0x6b, 0xf5, 0x48, 0x5f, 0x1d, 0x76, 0x2d, 0xd9, 0x9c, 0x35, 0x0d, + 0x1c, 0x17, 0xe7, 0x18, 0x0a, 0x96, 0x06, 0x38, 0x6a, 0x65, 0xf9, 0x4c, 0x22, 0xe9, 0x7d, 0xe8, + 0x9c, 0xf8, 0x5e, 0xe8, 0x88, 0x34, 0x41, 0x6d, 0x23, 0xe3, 0x67, 0xb5, 0x83, 0xee, 0x80, 0x72, + 0x7a, 0x7a, 0xac, 0xb5, 0x7b, 0xa4, 0xbf, 0xcd, 0x32, 0xd3, 0x7c, 0x0c, 0x6a, 0xde, 0x28, 0x8f, + 0xa3, 0x90, 0x23, 0x7d, 0x00, 0xca, 0xb8, 0xea, 0x51, 0x2d, 0x84, 0x65, 0x2e, 0x96, 0x1d, 0xe6, + 0x5b, 0xd8, 0x9e, 0x60, 0x80, 0x02, 0xcb, 0xc9, 0xfc, 0x19, 0x5f, 0xd6, 0x5b, 0xaf, 0xea, 0x2d, + 0xeb, 0x53, 0x56, 0xf4, 0x99, 0x3b, 0xf0, 0x7f, 0xc9, 0x2f, 0x05, 0x99, 0x07, 0x00, 0x87, 0x28, + 0xfe, 0xb5, 0x9c, 0xf9, 0x02, 0xd4, 0x3c, 0xbd, 0x68, 0x6f, 0x08, 0x9d, 0x71, 0xf9, 0x96, 0x72, + 0x16, 0x75, 0x78, 0xc7, 0xaa, 0x5e, 0x97, 0x55, 0xc5, 0x58, 0x0d, 0x33, 0x5f, 0x82, 0x7a, 0xec, + 0xf3, 0x4a, 0x42, 0x63, 0x7d, 0xe4, 0x2f, 0xeb, 0xbb, 0x2e, 0x67, 0x00, 0x5b, 0x92, 0x6b, 0x75, + 0xdc, 0xca, 0x4d, 0xfd, 0x0c, 0x7f, 0x12, 0xd8, 0x3c, 0x91, 0xbf, 0x82, 0xee, 0x83, 0x32, 0x4d, + 0x05, 0xed, 0x36, 0xe4, 0xd6, 0x2f, 0x54, 0xbf, 0xbb, 0xea, 0x2e, 0x0a, 0x1c, 0x40, 0x5b, 0x0e, + 0x94, 0x6a, 0x0d, 0xc4, 0xd2, 0x0e, 0xf5, 0x7b, 0x37, 0x44, 0x8a, 0xf4, 0x7d, 0x50, 0x0e, 0x71, + 0xb9, 0x68, 0xbd, 0x8d, 0xa5, 0xa2, 0xcd, 0x29, 0x3f, 0x83, 0x56, 0xd6, 0x25, 0x6d, 0xc6, 0x1b, + 0x23, 0xd4, 0x77, 0xaf, 0xf9, 0x65, 0xe2, 0xe8, 0xf9, 0xe5, 0xc2, 0x20, 0x9f, 0x17, 0x06, 0xf9, + 0xb2, 0x30, 0xc8, 0xb7, 0x85, 0x41, 0x3e, 0x7d, 0x37, 0xd6, 0xde, 0xfc, 0xee, 0x9f, 0x47, 0x67, + 0x7c, 0x20, 0x7f, 0x6e, 0x45, 0x37, 0x6b, 0xe7, 0x8e, 0xa7, 0xbf, 0x02, 0x00, 0x00, 0xff, 0xff, + 0xa3, 0xe9, 0x55, 0x5c, 0x57, 0x04, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// ServiceClient is the client API for Service service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type ServiceClient interface { + // Create container + Put(ctx context.Context, in *PutRequest, opts ...grpc.CallOption) (*PutResponse, error) + // Delete container ... discuss implementation later + Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteResponse, error) + // Get container + Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*GetResponse, error) + List(ctx context.Context, in *ListRequest, opts ...grpc.CallOption) (*ListResponse, error) +} + +type serviceClient struct { + cc *grpc.ClientConn +} + +func NewServiceClient(cc *grpc.ClientConn) ServiceClient { + return &serviceClient{cc} +} + +func (c *serviceClient) Put(ctx context.Context, in *PutRequest, opts ...grpc.CallOption) (*PutResponse, error) { + out := new(PutResponse) + err := c.cc.Invoke(ctx, "/container.Service/Put", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteResponse, error) { + out := new(DeleteResponse) + err := c.cc.Invoke(ctx, "/container.Service/Delete", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*GetResponse, error) { + out := new(GetResponse) + err := c.cc.Invoke(ctx, "/container.Service/Get", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) List(ctx context.Context, in *ListRequest, opts ...grpc.CallOption) (*ListResponse, error) { + out := new(ListResponse) + err := c.cc.Invoke(ctx, "/container.Service/List", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// ServiceServer is the server API for Service service. +type ServiceServer interface { + // Create container + Put(context.Context, *PutRequest) (*PutResponse, error) + // Delete container ... discuss implementation later + Delete(context.Context, *DeleteRequest) (*DeleteResponse, error) + // Get container + Get(context.Context, *GetRequest) (*GetResponse, error) + List(context.Context, *ListRequest) (*ListResponse, error) +} + +// UnimplementedServiceServer can be embedded to have forward compatible implementations. +type UnimplementedServiceServer struct { +} + +func (*UnimplementedServiceServer) Put(ctx context.Context, req *PutRequest) (*PutResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Put not implemented") +} +func (*UnimplementedServiceServer) Delete(ctx context.Context, req *DeleteRequest) (*DeleteResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Delete not implemented") +} +func (*UnimplementedServiceServer) Get(ctx context.Context, req *GetRequest) (*GetResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Get not implemented") +} +func (*UnimplementedServiceServer) List(ctx context.Context, req *ListRequest) (*ListResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method List not implemented") +} + +func RegisterServiceServer(s *grpc.Server, srv ServiceServer) { + s.RegisterService(&_Service_serviceDesc, srv) +} + +func _Service_Put_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(PutRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ServiceServer).Put(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/container.Service/Put", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ServiceServer).Put(ctx, req.(*PutRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Service_Delete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ServiceServer).Delete(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/container.Service/Delete", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ServiceServer).Delete(ctx, req.(*DeleteRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Service_Get_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ServiceServer).Get(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/container.Service/Get", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ServiceServer).Get(ctx, req.(*GetRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Service_List_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ServiceServer).List(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/container.Service/List", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ServiceServer).List(ctx, req.(*ListRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Service_serviceDesc = grpc.ServiceDesc{ + ServiceName: "container.Service", + HandlerType: (*ServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Put", + Handler: _Service_Put_Handler, + }, + { + MethodName: "Delete", + Handler: _Service_Delete_Handler, + }, + { + MethodName: "Get", + Handler: _Service_Get_Handler, + }, + { + MethodName: "List", + Handler: _Service_List_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "container/service.proto", +} + +func (m *PutRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PutRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PutRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.TTL != 0 { + i = encodeVarintService(dAtA, i, uint64(m.TTL)) + i-- + dAtA[i] = 0x30 + } + if len(m.Signature) > 0 { + i -= len(m.Signature) + copy(dAtA[i:], m.Signature) + i = encodeVarintService(dAtA, i, uint64(len(m.Signature))) + i-- + dAtA[i] = 0x2a + } + { + size, err := m.Rules.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + { + size := m.OwnerID.Size() + i -= size + if _, err := m.OwnerID.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + if m.Capacity != 0 { + i = encodeVarintService(dAtA, i, uint64(m.Capacity)) + i-- + dAtA[i] = 0x10 + } + { + size := m.MessageID.Size() + i -= size + if _, err := m.MessageID.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *PutResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PutResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PutResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + { + size := m.CID.Size() + i -= size + if _, err := m.CID.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *DeleteRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *DeleteRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DeleteRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Signature) > 0 { + i -= len(m.Signature) + copy(dAtA[i:], m.Signature) + i = encodeVarintService(dAtA, i, uint64(len(m.Signature))) + i-- + dAtA[i] = 0x1a + } + if m.TTL != 0 { + i = encodeVarintService(dAtA, i, uint64(m.TTL)) + i-- + dAtA[i] = 0x10 + } + { + size := m.CID.Size() + i -= size + if _, err := m.CID.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *DeleteResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *DeleteResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DeleteResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + return len(dAtA) - i, nil +} + +func (m *GetRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GetRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.TTL != 0 { + i = encodeVarintService(dAtA, i, uint64(m.TTL)) + i-- + dAtA[i] = 0x10 + } + { + size := m.CID.Size() + i -= size + if _, err := m.CID.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *GetResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GetResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.Container != nil { + { + size, err := m.Container.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *ListRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ListRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ListRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.TTL != 0 { + i = encodeVarintService(dAtA, i, uint64(m.TTL)) + i-- + dAtA[i] = 0x10 + } + { + size := m.OwnerID.Size() + i -= size + if _, err := m.OwnerID.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *ListResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ListResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ListResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.CID) > 0 { + for iNdEx := len(m.CID) - 1; iNdEx >= 0; iNdEx-- { + { + size := m.CID[iNdEx].Size() + i -= size + if _, err := m.CID[iNdEx].MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func encodeVarintService(dAtA []byte, offset int, v uint64) int { + offset -= sovService(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *PutRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.MessageID.Size() + n += 1 + l + sovService(uint64(l)) + if m.Capacity != 0 { + n += 1 + sovService(uint64(m.Capacity)) + } + l = m.OwnerID.Size() + n += 1 + l + sovService(uint64(l)) + l = m.Rules.Size() + n += 1 + l + sovService(uint64(l)) + l = len(m.Signature) + if l > 0 { + n += 1 + l + sovService(uint64(l)) + } + if m.TTL != 0 { + n += 1 + sovService(uint64(m.TTL)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *PutResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.CID.Size() + n += 1 + l + sovService(uint64(l)) + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *DeleteRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.CID.Size() + n += 1 + l + sovService(uint64(l)) + if m.TTL != 0 { + n += 1 + sovService(uint64(m.TTL)) + } + l = len(m.Signature) + if l > 0 { + n += 1 + l + sovService(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *DeleteResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *GetRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.CID.Size() + n += 1 + l + sovService(uint64(l)) + if m.TTL != 0 { + n += 1 + sovService(uint64(m.TTL)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *GetResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Container != nil { + l = m.Container.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *ListRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.OwnerID.Size() + n += 1 + l + sovService(uint64(l)) + if m.TTL != 0 { + n += 1 + sovService(uint64(m.TTL)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *ListResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.CID) > 0 { + for _, e := range m.CID { + l = e.Size() + n += 1 + l + sovService(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovService(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozService(x uint64) (n int) { + return sovService(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *PutRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: PutRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PutRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MessageID", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.MessageID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Capacity", wireType) + } + m.Capacity = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Capacity |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OwnerID", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.OwnerID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Rules", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Rules.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signature", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Signature = append(m.Signature[:0], dAtA[iNdEx:postIndex]...) + if m.Signature == nil { + m.Signature = []byte{} + } + iNdEx = postIndex + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TTL", wireType) + } + m.TTL = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TTL |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *PutResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: PutResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PutResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CID", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DeleteRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DeleteRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DeleteRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CID", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TTL", wireType) + } + m.TTL = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TTL |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signature", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Signature = append(m.Signature[:0], dAtA[iNdEx:postIndex]...) + if m.Signature == nil { + m.Signature = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DeleteResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DeleteResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DeleteResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GetRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GetRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CID", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TTL", wireType) + } + m.TTL = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TTL |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GetResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GetResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Container", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Container == nil { + m.Container = &Container{} + } + if err := m.Container.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ListRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ListRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ListRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OwnerID", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.OwnerID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TTL", wireType) + } + m.TTL = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TTL |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ListResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ListResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ListResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CID", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var v CID + m.CID = append(m.CID, v) + if err := m.CID[len(m.CID)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipService(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowService + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowService + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowService + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthService + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupService + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthService + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthService = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowService = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupService = fmt.Errorf("proto: unexpected end of group") +) diff --git a/container/service.proto b/container/service.proto new file mode 100644 index 0000000..a3b72ca --- /dev/null +++ b/container/service.proto @@ -0,0 +1,68 @@ +syntax = "proto3"; +package container; +option go_package = "github.com/nspcc-dev/neofs-proto/container"; + +import "container/types.proto"; +import "github.com/nspcc-dev/netmap/selector.proto"; +import "github.com/gogo/protobuf/gogoproto/gogo.proto"; + +option (gogoproto.stable_marshaler_all) = true; + +service Service { + // Create container + rpc Put(PutRequest) returns (PutResponse); + + // Delete container ... discuss implementation later + rpc Delete(DeleteRequest) returns (DeleteResponse); + + // Get container + rpc Get(GetRequest) returns (GetResponse); + + rpc List(ListRequest) returns (ListResponse); +} + +// NewRequest message to create new container +message PutRequest { + bytes MessageID = 1 [(gogoproto.customtype) = "MessageID", (gogoproto.nullable) = false]; + uint64 Capacity = 2; // not actual size in megabytes, but probability of storage availability + bytes OwnerID = 3 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false]; + netmap.PlacementRule rules = 4 [(gogoproto.nullable) = false]; + bytes Signature = 5; + uint32 TTL = 6; +} + +// PutResponse message to respond about container uuid +message PutResponse { + bytes CID = 1 [(gogoproto.customtype) = "CID", (gogoproto.nullable) = false]; +} + +message DeleteRequest { + bytes CID = 1 [(gogoproto.customtype) = "CID", (gogoproto.nullable) = false]; + uint32 TTL = 2; + bytes Signature = 3; +} + +message DeleteResponse { } + + +// GetRequest message to fetch container placement rules +message GetRequest { + bytes CID = 1 [(gogoproto.customtype) = "CID", (gogoproto.nullable) = false]; + uint32 TTL = 2; +} + +// GetResponse message with container structure +message GetResponse { + container.Container Container = 1; +} + +// ListRequest message to list containers for user +message ListRequest { + bytes OwnerID = 1 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false]; + uint32 TTL = 2; +} + +// ListResponse message to respond about all user containers +message ListResponse { + repeated bytes CID = 1 [(gogoproto.customtype) = "CID", (gogoproto.nullable) = false]; +} diff --git a/container/types.go b/container/types.go new file mode 100644 index 0000000..1ffcafe --- /dev/null +++ b/container/types.go @@ -0,0 +1,94 @@ +package container + +import ( + "bytes" + + "github.com/google/uuid" + "github.com/nspcc-dev/neofs-crypto/test" + "github.com/nspcc-dev/neofs-proto/internal" + "github.com/nspcc-dev/neofs-proto/refs" + "github.com/nspcc-dev/netmap" + "github.com/pkg/errors" +) + +var ( + _ internal.Custom = (*Container)(nil) + + emptySalt = (UUID{}).Bytes() + emptyOwner = (OwnerID{}).Bytes() +) + +// New creates new user container based on capacity, OwnerID and PlacementRules. +func New(cap uint64, owner OwnerID, rules netmap.PlacementRule) (*Container, error) { + if bytes.Equal(owner[:], emptyOwner) { + return nil, refs.ErrEmptyOwner + } else if cap == 0 { + return nil, refs.ErrEmptyCapacity + } + + salt, err := uuid.NewRandom() + if err != nil { + return nil, errors.Wrap(err, "could not create salt") + } + + return &Container{ + OwnerID: owner, + Salt: UUID(salt), + Capacity: cap, + Rules: rules, + }, nil +} + +// Bytes returns bytes representation of Container. +func (m *Container) Bytes() []byte { + data, err := m.Marshal() + if err != nil { + return nil + } + + return data +} + +// ID returns generated ContainerID based on Container (data). +func (m *Container) ID() (CID, error) { + if m.Empty() { + return CID{}, refs.ErrEmptyContainer + } + data, err := m.Marshal() + if err != nil { + return CID{}, err + } + + return refs.CIDForBytes(data), nil +} + +// Empty checks that container is empty. +func (m *Container) Empty() bool { + return m.Capacity == 0 || bytes.Equal(m.Salt.Bytes(), emptySalt) || bytes.Equal(m.OwnerID.Bytes(), emptyOwner) +} + +// -- Test container definition -- // +// NewTestContainer returns test container. +// +// WARNING: DON'T USE THIS OUTSIDE TESTS. +func NewTestContainer() (*Container, error) { + key := test.DecodeKey(0) + owner, err := refs.NewOwnerID(&key.PublicKey) + if err != nil { + return nil, err + } + return New(100, owner, netmap.PlacementRule{ + ReplFactor: 2, + SFGroups: []netmap.SFGroup{ + { + Selectors: []netmap.Select{ + {Key: "Country", Count: 1}, + {Key: netmap.NodesBucket, Count: 2}, + }, + Filters: []netmap.Filter{ + {Key: "Country", F: netmap.FilterIn("USA")}, + }, + }, + }, + }) +} diff --git a/container/types.pb.go b/container/types.pb.go new file mode 100644 index 0000000..8c4775c --- /dev/null +++ b/container/types.pb.go @@ -0,0 +1,464 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: container/types.proto + +package container + +import ( + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/golang/protobuf/proto" + netmap "github.com/nspcc-dev/netmap" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package + +// The Container service definition. +type Container struct { + OwnerID OwnerID `protobuf:"bytes,1,opt,name=OwnerID,proto3,customtype=OwnerID" json:"OwnerID"` + Salt UUID `protobuf:"bytes,2,opt,name=Salt,proto3,customtype=UUID" json:"Salt"` + Capacity uint64 `protobuf:"varint,3,opt,name=Capacity,proto3" json:"Capacity,omitempty"` + Rules netmap.PlacementRule `protobuf:"bytes,4,opt,name=Rules,proto3" json:"Rules"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Container) Reset() { *m = Container{} } +func (m *Container) String() string { return proto.CompactTextString(m) } +func (*Container) ProtoMessage() {} +func (*Container) Descriptor() ([]byte, []int) { + return fileDescriptor_1432e52ab0b53e3e, []int{0} +} +func (m *Container) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Container) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *Container) XXX_Merge(src proto.Message) { + xxx_messageInfo_Container.Merge(m, src) +} +func (m *Container) XXX_Size() int { + return m.Size() +} +func (m *Container) XXX_DiscardUnknown() { + xxx_messageInfo_Container.DiscardUnknown(m) +} + +var xxx_messageInfo_Container proto.InternalMessageInfo + +func (m *Container) GetCapacity() uint64 { + if m != nil { + return m.Capacity + } + return 0 +} + +func (m *Container) GetRules() netmap.PlacementRule { + if m != nil { + return m.Rules + } + return netmap.PlacementRule{} +} + +func init() { + proto.RegisterType((*Container)(nil), "container.Container") +} + +func init() { proto.RegisterFile("container/types.proto", fileDescriptor_1432e52ab0b53e3e) } + +var fileDescriptor_1432e52ab0b53e3e = []byte{ + // 275 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x4d, 0xce, 0xcf, 0x2b, + 0x49, 0xcc, 0xcc, 0x4b, 0x2d, 0xd2, 0x2f, 0xa9, 0x2c, 0x48, 0x2d, 0xd6, 0x2b, 0x28, 0xca, 0x2f, + 0xc9, 0x17, 0xe2, 0x84, 0x0b, 0x4b, 0x69, 0xa5, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, + 0xe7, 0xea, 0xe7, 0x15, 0x17, 0x24, 0x27, 0xeb, 0xa6, 0xa4, 0x96, 0xe9, 0xe7, 0xa5, 0x96, 0xe4, + 0x26, 0x16, 0xe8, 0x17, 0xa7, 0xe6, 0xa4, 0x26, 0x97, 0xe4, 0x17, 0x41, 0xb4, 0x49, 0xe9, 0x22, + 0xa9, 0x4d, 0xcf, 0x4f, 0xcf, 0xd7, 0x07, 0x0b, 0x27, 0x95, 0xa6, 0x81, 0x79, 0x60, 0x0e, 0x98, + 0x05, 0x51, 0xae, 0xb4, 0x9c, 0x91, 0x8b, 0xd3, 0x19, 0x66, 0x91, 0x90, 0x26, 0x17, 0xbb, 0x7f, + 0x79, 0x5e, 0x6a, 0x91, 0xa7, 0x8b, 0x04, 0xa3, 0x02, 0xa3, 0x06, 0x8f, 0x13, 0xff, 0x89, 0x7b, + 0xf2, 0x0c, 0xb7, 0xee, 0xc9, 0xc3, 0x84, 0x83, 0x60, 0x0c, 0x21, 0x05, 0x2e, 0x96, 0xe0, 0xc4, + 0x9c, 0x12, 0x09, 0x26, 0xb0, 0x3a, 0x1e, 0xa8, 0x3a, 0x96, 0xd0, 0x50, 0x4f, 0x97, 0x20, 0xb0, + 0x8c, 0x90, 0x14, 0x17, 0x87, 0x73, 0x62, 0x41, 0x62, 0x72, 0x66, 0x49, 0xa5, 0x04, 0xb3, 0x02, + 0xa3, 0x06, 0x4b, 0x10, 0x9c, 0x2f, 0x64, 0xc8, 0xc5, 0x1a, 0x54, 0x9a, 0x93, 0x5a, 0x2c, 0xc1, + 0xa2, 0xc0, 0xa8, 0xc1, 0x6d, 0x24, 0xaa, 0x07, 0xf1, 0x8c, 0x5e, 0x40, 0x4e, 0x62, 0x72, 0x6a, + 0x6e, 0x6a, 0x5e, 0x09, 0x48, 0xd6, 0x89, 0x05, 0x64, 0x6a, 0x10, 0x44, 0xa5, 0x93, 0xc3, 0x89, + 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, 0x31, 0xde, 0x78, 0x24, 0xc7, 0xf8, 0xe0, 0x91, 0x1c, 0xe3, + 0x8c, 0xc7, 0x72, 0x0c, 0x51, 0xb8, 0x82, 0x26, 0x3f, 0xad, 0x58, 0x17, 0xe2, 0x59, 0x78, 0x30, + 0x26, 0xb1, 0x81, 0x05, 0x8c, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0x29, 0x6b, 0x4d, 0x08, 0x71, + 0x01, 0x00, 0x00, +} + +func (m *Container) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Container) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Container) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + { + size, err := m.Rules.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + if m.Capacity != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Capacity)) + i-- + dAtA[i] = 0x18 + } + { + size := m.Salt.Size() + i -= size + if _, err := m.Salt.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size := m.OwnerID.Size() + i -= size + if _, err := m.OwnerID.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func encodeVarintTypes(dAtA []byte, offset int, v uint64) int { + offset -= sovTypes(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Container) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.OwnerID.Size() + n += 1 + l + sovTypes(uint64(l)) + l = m.Salt.Size() + n += 1 + l + sovTypes(uint64(l)) + if m.Capacity != 0 { + n += 1 + sovTypes(uint64(m.Capacity)) + } + l = m.Rules.Size() + n += 1 + l + sovTypes(uint64(l)) + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovTypes(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozTypes(x uint64) (n int) { + return sovTypes(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Container) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Container: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Container: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OwnerID", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.OwnerID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Salt", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Salt.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Capacity", wireType) + } + m.Capacity = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Capacity |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Rules", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Rules.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipTypes(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthTypes + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTypes + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthTypes + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthTypes = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTypes = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTypes = fmt.Errorf("proto: unexpected end of group") +) diff --git a/container/types.proto b/container/types.proto new file mode 100644 index 0000000..b05001f --- /dev/null +++ b/container/types.proto @@ -0,0 +1,16 @@ +syntax = "proto3"; +package container; +option go_package = "github.com/nspcc-dev/neofs-proto/container"; + +import "github.com/nspcc-dev/netmap/selector.proto"; +import "github.com/gogo/protobuf/gogoproto/gogo.proto"; + +option (gogoproto.stable_marshaler_all) = true; + +// The Container service definition. +message Container { + bytes OwnerID = 1 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false]; + bytes Salt = 2 [(gogoproto.customtype) = "UUID", (gogoproto.nullable) = false]; + uint64 Capacity = 3; + netmap.PlacementRule Rules = 4 [(gogoproto.nullable) = false]; +} diff --git a/container/types_test.go b/container/types_test.go new file mode 100644 index 0000000..c7dbbf8 --- /dev/null +++ b/container/types_test.go @@ -0,0 +1,57 @@ +package container + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/nspcc-dev/neofs-crypto/test" + "github.com/nspcc-dev/neofs-proto/refs" + "github.com/nspcc-dev/netmap" + "github.com/stretchr/testify/require" +) + +func TestCID(t *testing.T) { + t.Run("check that marshal/unmarshal works like expected", func(t *testing.T) { + var ( + c2 Container + cid2 CID + key = test.DecodeKey(0) + ) + + rules := netmap.PlacementRule{ + ReplFactor: 2, + SFGroups: []netmap.SFGroup{ + { + Selectors: []netmap.Select{ + {Key: "Country", Count: 1}, + {Key: netmap.NodesBucket, Count: 2}, + }, + Filters: []netmap.Filter{ + {Key: "Country", F: netmap.FilterIn("USA")}, + }, + }, + }, + } + + owner, err := refs.NewOwnerID(&key.PublicKey) + require.NoError(t, err) + + c1, err := New(10, owner, rules) + require.NoError(t, err) + + data, err := proto.Marshal(c1) + require.NoError(t, err) + + require.NoError(t, c2.Unmarshal(data)) + require.Equal(t, c1, &c2) + + cid1, err := c1.ID() + require.NoError(t, err) + + data, err = proto.Marshal(&cid1) + require.NoError(t, err) + require.NoError(t, cid2.Unmarshal(data)) + + require.Equal(t, cid1, cid2) + }) +} diff --git a/decimal/decimal.go b/decimal/decimal.go new file mode 100644 index 0000000..2ee0088 --- /dev/null +++ b/decimal/decimal.go @@ -0,0 +1,110 @@ +package decimal + +import ( + "math" + "strconv" + "strings" +) + +// GASPrecision contains precision for NEO Gas token. +const GASPrecision = 8 + +// Zero is empty Decimal value. +var Zero = &Decimal{} + +// New returns new Decimal (in satoshi). +func New(v int64) *Decimal { + return NewWithPrecision(v, GASPrecision) +} + +// NewGAS returns new Decimal * 1e8 (in GAS). +func NewGAS(v int64) *Decimal { + v *= int64(math.Pow10(GASPrecision)) + return NewWithPrecision(v, GASPrecision) +} + +// NewWithPrecision returns new Decimal with custom precision. +func NewWithPrecision(v int64, p uint32) *Decimal { + return &Decimal{Value: v, Precision: p} +} + +// ParseFloat return new Decimal parsed from float64 * 1e8 (in GAS). +func ParseFloat(v float64) *Decimal { + return new(Decimal).Parse(v, GASPrecision) +} + +// ParseFloatWithPrecision returns new Decimal parsed from float64 * 1^p. +func ParseFloatWithPrecision(v float64, p int) *Decimal { + return new(Decimal).Parse(v, p) +} + +// Copy returns copy of current Decimal. +func (m *Decimal) Copy() *Decimal { return &Decimal{Value: m.Value, Precision: m.Precision} } + +// Parse returns parsed Decimal from float64 * 1^p. +func (m *Decimal) Parse(v float64, p int) *Decimal { + m.Value = int64(v * math.Pow10(p)) + m.Precision = uint32(p) + return m +} + +// String returns string representation of Decimal. +func (m Decimal) String() string { + buf := new(strings.Builder) + val := m.Value + dec := int64(math.Pow10(int(m.Precision))) + if val < 0 { + buf.WriteRune('-') + val = -val + } + str := strconv.FormatInt(val/dec, 10) + buf.WriteString(str) + val %= dec + if val > 0 { + buf.WriteRune('.') + str = strconv.FormatInt(val, 10) + for i := len(str); i < int(m.Precision); i++ { + buf.WriteRune('0') + } + buf.WriteString(strings.TrimRight(str, "0")) + } + return buf.String() +} + +// Add returns d + m. +func (m Decimal) Add(d *Decimal) *Decimal { + precision := m.Precision + if precision < d.Precision { + precision = d.Precision + } + return &Decimal{ + Value: m.Value + d.Value, + Precision: precision, + } +} + +// Zero checks that Decimal is empty. +func (m Decimal) Zero() bool { return m.Value == 0 } + +// Equal checks that current Decimal is equal to passed Decimal. +func (m Decimal) Equal(v *Decimal) bool { return m.Value == v.Value && m.Precision == v.Precision } + +// GT checks that m > v. +func (m Decimal) GT(v *Decimal) bool { return m.Value > v.Value } + +// GTE checks that m >= v. +func (m Decimal) GTE(v *Decimal) bool { return m.Value >= v.Value } + +// LT checks that m < v. +func (m Decimal) LT(v *Decimal) bool { return m.Value < v.Value } + +// LTE checks that m <= v. +func (m Decimal) LTE(v *Decimal) bool { return m.Value <= v.Value } + +// Neg returns negative representation of current Decimal (m * -1). +func (m Decimal) Neg() *Decimal { + return &Decimal{ + Value: m.Value * -1, + Precision: m.Precision, + } +} diff --git a/decimal/decimal.pb.go b/decimal/decimal.pb.go new file mode 100644 index 0000000..e125af4 --- /dev/null +++ b/decimal/decimal.pb.go @@ -0,0 +1,345 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: decimal/decimal.proto + +package decimal + +import ( + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/golang/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package + +type Decimal struct { + Value int64 `protobuf:"varint,1,opt,name=Value,proto3" json:"Value,omitempty"` + Precision uint32 `protobuf:"varint,2,opt,name=Precision,proto3" json:"Precision,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Decimal) Reset() { *m = Decimal{} } +func (*Decimal) ProtoMessage() {} +func (*Decimal) Descriptor() ([]byte, []int) { + return fileDescriptor_e7e70e1773836c80, []int{0} +} +func (m *Decimal) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Decimal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *Decimal) XXX_Merge(src proto.Message) { + xxx_messageInfo_Decimal.Merge(m, src) +} +func (m *Decimal) XXX_Size() int { + return m.Size() +} +func (m *Decimal) XXX_DiscardUnknown() { + xxx_messageInfo_Decimal.DiscardUnknown(m) +} + +var xxx_messageInfo_Decimal proto.InternalMessageInfo + +func (m *Decimal) GetValue() int64 { + if m != nil { + return m.Value + } + return 0 +} + +func (m *Decimal) GetPrecision() uint32 { + if m != nil { + return m.Precision + } + return 0 +} + +func init() { + proto.RegisterType((*Decimal)(nil), "decimal.Decimal") +} + +func init() { proto.RegisterFile("decimal/decimal.proto", fileDescriptor_e7e70e1773836c80) } + +var fileDescriptor_e7e70e1773836c80 = []byte{ + // 181 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x4d, 0x49, 0x4d, 0xce, + 0xcc, 0x4d, 0xcc, 0xd1, 0x87, 0xd2, 0x7a, 0x05, 0x45, 0xf9, 0x25, 0xf9, 0x42, 0xec, 0x50, 0xae, + 0x94, 0x6e, 0x7a, 0x66, 0x49, 0x46, 0x69, 0x92, 0x5e, 0x72, 0x7e, 0xae, 0x7e, 0x7a, 0x7e, 0x7a, + 0xbe, 0x3e, 0x58, 0x3e, 0xa9, 0x34, 0x0d, 0xcc, 0x03, 0x73, 0xc0, 0x2c, 0x88, 0x3e, 0x25, 0x67, + 0x2e, 0x76, 0x17, 0x88, 0x4e, 0x21, 0x11, 0x2e, 0xd6, 0xb0, 0xc4, 0x9c, 0xd2, 0x54, 0x09, 0x46, + 0x05, 0x46, 0x0d, 0xe6, 0x20, 0x08, 0x47, 0x48, 0x86, 0x8b, 0x33, 0xa0, 0x28, 0x35, 0x39, 0xb3, + 0x38, 0x33, 0x3f, 0x4f, 0x82, 0x49, 0x81, 0x51, 0x83, 0x37, 0x08, 0x21, 0x60, 0xc5, 0x32, 0x63, + 0x81, 0x3c, 0x83, 0x93, 0xdd, 0x89, 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, 0x31, 0xde, 0x78, 0x24, + 0xc7, 0xf8, 0xe0, 0x91, 0x1c, 0xe3, 0x8c, 0xc7, 0x72, 0x0c, 0x51, 0x1a, 0x48, 0x2e, 0xc9, 0x2b, + 0x2e, 0x48, 0x4e, 0xd6, 0x4d, 0x49, 0x2d, 0xd3, 0xcf, 0x4b, 0xcd, 0x4f, 0x2b, 0xd6, 0x85, 0xb8, + 0x03, 0xea, 0xe6, 0x24, 0x36, 0x30, 0xd7, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, 0xac, 0x68, 0x21, + 0x20, 0xdc, 0x00, 0x00, 0x00, +} + +func (m *Decimal) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Decimal) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Decimal) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.Precision != 0 { + i = encodeVarintDecimal(dAtA, i, uint64(m.Precision)) + i-- + dAtA[i] = 0x10 + } + if m.Value != 0 { + i = encodeVarintDecimal(dAtA, i, uint64(m.Value)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func encodeVarintDecimal(dAtA []byte, offset int, v uint64) int { + offset -= sovDecimal(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Decimal) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Value != 0 { + n += 1 + sovDecimal(uint64(m.Value)) + } + if m.Precision != 0 { + n += 1 + sovDecimal(uint64(m.Precision)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovDecimal(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozDecimal(x uint64) (n int) { + return sovDecimal(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Decimal) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDecimal + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Decimal: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Decimal: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + m.Value = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDecimal + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Value |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Precision", wireType) + } + m.Precision = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDecimal + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Precision |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipDecimal(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthDecimal + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthDecimal + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipDecimal(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowDecimal + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowDecimal + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowDecimal + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthDecimal + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupDecimal + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthDecimal + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthDecimal = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowDecimal = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupDecimal = fmt.Errorf("proto: unexpected end of group") +) diff --git a/decimal/decimal.proto b/decimal/decimal.proto new file mode 100644 index 0000000..31bb963 --- /dev/null +++ b/decimal/decimal.proto @@ -0,0 +1,14 @@ +syntax = "proto3"; +package decimal; +option go_package = "github.com/nspcc-dev/neofs-proto/decimal"; + +import "github.com/gogo/protobuf/gogoproto/gogo.proto"; + +option (gogoproto.stable_marshaler_all) = true; + +message Decimal { + option (gogoproto.goproto_stringer) = false; + + int64 Value = 1; + uint32 Precision = 2; +} diff --git a/decimal/decimal_test.go b/decimal/decimal_test.go new file mode 100644 index 0000000..c5ffef7 --- /dev/null +++ b/decimal/decimal_test.go @@ -0,0 +1,445 @@ +package decimal + +import ( + "testing" + + "github.com/stretchr/testify/require" +) + +func TestDecimal_Parse(t *testing.T) { + tests := []struct { + value float64 + name string + expect *Decimal + }{ + {name: "empty", expect: &Decimal{Precision: GASPrecision}}, + + { + value: 100, + name: "100 GAS", + expect: &Decimal{Value: 1e10, Precision: GASPrecision}, + }, + } + for i := range tests { + tt := tests[i] + t.Run(tt.name, func(t *testing.T) { + require.Equal(t, tt.expect, ParseFloat(tt.value)) + }) + } +} + +func TestDecimal_ParseWithPrecision(t *testing.T) { + type args struct { + v float64 + p int + } + tests := []struct { + args args + name string + expect *Decimal + }{ + {name: "empty", expect: &Decimal{}}, + + { + name: "empty precision", + expect: &Decimal{Value: 0, Precision: 0}, + }, + + { + name: "100 GAS", + args: args{100, GASPrecision}, + expect: &Decimal{Value: 1e10, Precision: GASPrecision}, + }, + } + for i := range tests { + tt := tests[i] + t.Run(tt.name, func(t *testing.T) { + require.Equal(t, tt.expect, + ParseFloatWithPrecision(tt.args.v, tt.args.p)) + }) + } +} + +func TestNew(t *testing.T) { + tests := []struct { + name string + val int64 + expect *Decimal + }{ + {name: "empty", expect: &Decimal{Value: 0, Precision: GASPrecision}}, + {name: "100 GAS", val: 1e10, expect: &Decimal{Value: 1e10, Precision: GASPrecision}}, + } + for i := range tests { + tt := tests[i] + t.Run(tt.name, func(t *testing.T) { + require.Equalf(t, tt.expect, New(tt.val), tt.name) + }) + } +} + +func TestNewGAS(t *testing.T) { + tests := []struct { + name string + val int64 + expect *Decimal + }{ + {name: "empty", expect: &Decimal{Value: 0, Precision: GASPrecision}}, + {name: "100 GAS", val: 100, expect: &Decimal{Value: 1e10, Precision: GASPrecision}}, + } + for i := range tests { + tt := tests[i] + t.Run(tt.name, func(t *testing.T) { + require.Equalf(t, tt.expect, NewGAS(tt.val), tt.name) + }) + } +} +func TestNewWithPrecision(t *testing.T) { + tests := []struct { + name string + val int64 + pre uint32 + expect *Decimal + }{ + {name: "empty", expect: &Decimal{}}, + {name: "100 GAS", val: 1e10, pre: GASPrecision, expect: &Decimal{Value: 1e10, Precision: GASPrecision}}, + } + for i := range tests { + tt := tests[i] + t.Run(tt.name, func(t *testing.T) { + require.Equalf(t, tt.expect, NewWithPrecision(tt.val, tt.pre), tt.name) + }) + } +} + +func TestDecimal_Neg(t *testing.T) { + tests := []struct { + name string + val int64 + expect *Decimal + }{ + {name: "empty", expect: &Decimal{Value: 0, Precision: GASPrecision}}, + {name: "100 GAS", val: 1e10, expect: &Decimal{Value: -1e10, Precision: GASPrecision}}, + } + for i := range tests { + tt := tests[i] + t.Run(tt.name, func(t *testing.T) { + require.NotPanicsf(t, func() { + require.Equalf(t, tt.expect, New(tt.val).Neg(), tt.name) + }, tt.name) + }) + } +} + +func TestDecimal_String(t *testing.T) { + tests := []struct { + name string + expect string + value *Decimal + }{ + {name: "empty", expect: "0", value: &Decimal{}}, + {name: "100 GAS", expect: "100", value: &Decimal{Value: 1e10, Precision: GASPrecision}}, + {name: "-100 GAS", expect: "-100", value: &Decimal{Value: -1e10, Precision: GASPrecision}}, + } + for i := range tests { + tt := tests[i] + t.Run(tt.name, func(t *testing.T) { + require.Equalf(t, tt.expect, tt.value.String(), tt.name) + }) + } +} + +const SomethingElsePrecision = 5 + +func TestDecimal_Add(t *testing.T) { + tests := []struct { + name string + expect *Decimal + values [2]*Decimal + }{ + {name: "empty", expect: &Decimal{}, values: [2]*Decimal{{}, {}}}, + { + name: "5 GAS + 2 GAS", + expect: &Decimal{Value: 7e8, Precision: GASPrecision}, + values: [2]*Decimal{ + {Value: 2e8, Precision: GASPrecision}, + {Value: 5e8, Precision: GASPrecision}, + }, + }, + { + name: "1e2 + 1e3", + expect: &Decimal{Value: 1.1e3, Precision: 3}, + values: [2]*Decimal{ + {Value: 1e2, Precision: 2}, + {Value: 1e3, Precision: 3}, + }, + }, + { + name: "5 GAS + 10 SomethingElse", + expect: &Decimal{Value: 5.01e8, Precision: GASPrecision}, + values: [2]*Decimal{ + {Value: 5e8, Precision: GASPrecision}, + {Value: 1e6, Precision: SomethingElsePrecision}, + }, + }, + } + for i := range tests { + tt := tests[i] + t.Run(tt.name, func(t *testing.T) { + require.NotPanicsf(t, func() { + { // A + B + one := tt.values[0] + two := tt.values[1] + require.Equalf(t, tt.expect, one.Add(two), tt.name) + t.Log(one.Add(two)) + } + + { // B + A + one := tt.values[0] + two := tt.values[1] + require.Equalf(t, tt.expect, two.Add(one), tt.name) + t.Log(two.Add(one)) + } + }, tt.name) + }) + } +} + +func TestDecimal_Copy(t *testing.T) { + tests := []struct { + name string + expect *Decimal + value *Decimal + }{ + {name: "zero", expect: Zero}, + { + name: "5 GAS", + expect: &Decimal{Value: 5e8, Precision: GASPrecision}, + }, + { + name: "100 GAS", + expect: &Decimal{Value: 1e10, Precision: GASPrecision}, + }, + } + for i := range tests { + tt := tests[i] + t.Run(tt.name, func(t *testing.T) { + require.NotPanicsf(t, func() { + require.Equal(t, tt.expect, tt.expect.Copy()) + }, tt.name) + }) + } +} + +func TestDecimal_Zero(t *testing.T) { + tests := []struct { + name string + expect bool + value *Decimal + }{ + {name: "zero", expect: true, value: Zero}, + { + name: "5 GAS", + expect: false, + value: &Decimal{Value: 5e8, Precision: GASPrecision}, + }, + { + name: "100 GAS", + expect: false, + value: &Decimal{Value: 1e10, Precision: GASPrecision}, + }, + } + for i := range tests { + tt := tests[i] + t.Run(tt.name, func(t *testing.T) { + require.NotPanicsf(t, func() { + require.Truef(t, tt.expect == tt.value.Zero(), tt.name) + }, tt.name) + }) + } +} + +func TestDecimal_Equal(t *testing.T) { + tests := []struct { + name string + expect bool + values [2]*Decimal + }{ + {name: "zero == zero", expect: true, values: [2]*Decimal{Zero, Zero}}, + { + name: "5 GAS != 2 GAS", + expect: false, + values: [2]*Decimal{ + {Value: 5e8, Precision: GASPrecision}, + {Value: 2e8, Precision: GASPrecision}, + }, + }, + { + name: "100 GAS == 100 GAS", + expect: true, + values: [2]*Decimal{ + {Value: 1e10, Precision: GASPrecision}, + {Value: 1e10, Precision: GASPrecision}, + }, + }, + } + for i := range tests { + tt := tests[i] + t.Run(tt.name, func(t *testing.T) { + require.NotPanicsf(t, func() { + require.Truef(t, tt.expect == (tt.values[0].Equal(tt.values[1])), tt.name) + }, tt.name) + }) + } +} + +func TestDecimal_GT(t *testing.T) { + tests := []struct { + name string + expect bool + values [2]*Decimal + }{ + {name: "two zeros", expect: false, values: [2]*Decimal{Zero, Zero}}, + { + name: "5 GAS > 2 GAS", + expect: true, + values: [2]*Decimal{ + {Value: 5e8, Precision: GASPrecision}, + {Value: 2e8, Precision: GASPrecision}, + }, + }, + { + name: "100 GAS !> 100 GAS", + expect: false, + values: [2]*Decimal{ + {Value: 1e10, Precision: GASPrecision}, + {Value: 1e10, Precision: GASPrecision}, + }, + }, + } + for i := range tests { + tt := tests[i] + t.Run(tt.name, func(t *testing.T) { + require.NotPanicsf(t, func() { + require.Truef(t, tt.expect == (tt.values[0].GT(tt.values[1])), tt.name) + }, tt.name) + }) + } +} + +func TestDecimal_GTE(t *testing.T) { + tests := []struct { + name string + expect bool + values [2]*Decimal + }{ + {name: "two zeros", expect: true, values: [2]*Decimal{Zero, Zero}}, + { + name: "5 GAS >= 2 GAS", + expect: true, + values: [2]*Decimal{ + {Value: 5e8, Precision: GASPrecision}, + {Value: 2e8, Precision: GASPrecision}, + }, + }, + { + name: "1 GAS !>= 100 GAS", + expect: false, + values: [2]*Decimal{ + {Value: 1e8, Precision: GASPrecision}, + {Value: 1e10, Precision: GASPrecision}, + }, + }, + } + for i := range tests { + tt := tests[i] + t.Run(tt.name, func(t *testing.T) { + require.NotPanicsf(t, func() { + require.Truef(t, tt.expect == (tt.values[0].GTE(tt.values[1])), tt.name) + }, tt.name) + }) + } +} + +func TestDecimal_LT(t *testing.T) { + tests := []struct { + name string + expect bool + values [2]*Decimal + }{ + {name: "two zeros", expect: false, values: [2]*Decimal{Zero, Zero}}, + { + name: "5 GAS !< 2 GAS", + expect: false, + values: [2]*Decimal{ + {Value: 5e8, Precision: GASPrecision}, + {Value: 2e8, Precision: GASPrecision}, + }, + }, + { + name: "1 GAS < 100 GAS", + expect: true, + values: [2]*Decimal{ + {Value: 1e8, Precision: GASPrecision}, + {Value: 1e10, Precision: GASPrecision}, + }, + }, + { + name: "100 GAS !< 100 GAS", + expect: false, + values: [2]*Decimal{ + {Value: 1e10, Precision: GASPrecision}, + {Value: 1e10, Precision: GASPrecision}, + }, + }, + } + for i := range tests { + tt := tests[i] + t.Run(tt.name, func(t *testing.T) { + require.NotPanicsf(t, func() { + require.Truef(t, tt.expect == (tt.values[0].LT(tt.values[1])), tt.name) + }, tt.name) + }) + } +} + +func TestDecimal_LTE(t *testing.T) { + tests := []struct { + name string + expect bool + values [2]*Decimal + }{ + {name: "two zeros", expect: true, values: [2]*Decimal{Zero, Zero}}, + { + name: "5 GAS <= 2 GAS", + expect: false, + values: [2]*Decimal{ + {Value: 5e8, Precision: GASPrecision}, + {Value: 2e8, Precision: GASPrecision}, + }, + }, + { + name: "1 GAS <= 100 GAS", + expect: true, + values: [2]*Decimal{ + {Value: 1e8, Precision: GASPrecision}, + {Value: 1e10, Precision: GASPrecision}, + }, + }, + { + name: "100 GAS !<= 1 GAS", + expect: false, + values: [2]*Decimal{ + {Value: 1e10, Precision: GASPrecision}, + {Value: 1e8, Precision: GASPrecision}, + }, + }, + } + for i := range tests { + tt := tests[i] + t.Run(tt.name, func(t *testing.T) { + require.NotPanicsf(t, func() { + require.Truef(t, tt.expect == (tt.values[0].LTE(tt.values[1])), tt.name) + }, tt.name) + }) + } +} diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..4649004 --- /dev/null +++ b/go.mod @@ -0,0 +1,22 @@ +module github.com/nspcc-dev/neofs-proto + +go 1.13 + +require ( + code.cloudfoundry.org/bytefmt v0.0.0-20190819182555-854d396b647c + github.com/gogo/protobuf v1.3.1 + github.com/golang/protobuf v1.3.2 + github.com/google/uuid v1.1.1 + github.com/mr-tron/base58 v1.1.2 + github.com/nspcc-dev/neofs-crypto v0.2.1 + github.com/nspcc-dev/netmap v1.6.1 + github.com/nspcc-dev/tzhash v1.3.0 + github.com/onsi/ginkgo v1.10.2 // indirect + github.com/onsi/gomega v1.7.0 // indirect + github.com/pkg/errors v0.8.1 + github.com/prometheus/client_golang v1.2.1 + github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4 + github.com/stretchr/testify v1.4.0 + golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550 + google.golang.org/grpc v1.24.0 +) diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..6b48f3f --- /dev/null +++ b/go.sum @@ -0,0 +1,165 @@ +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +code.cloudfoundry.org/bytefmt v0.0.0-20190819182555-854d396b647c h1:2RuXx1+tSNWRjxhY0Bx52kjV2odJQ0a6MTbfTPhGAkg= +code.cloudfoundry.org/bytefmt v0.0.0-20190819182555-854d396b647c/go.mod h1:wN/zk7mhREp/oviagqUXY3EwuHhWyOvAdsn5Y4CzOrc= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/abiosoft/ishell v2.0.0+incompatible/go.mod h1:HQR9AqF2R3P4XXpMpI0NAzgHf/aS6+zVXRj14cVk9qg= +github.com/abiosoft/readline v0.0.0-20180607040430-155bce2042db/go.mod h1:rB3B4rKii8V21ydCbIzH5hZiCQE7f5E9SzUb/ZZx530= +github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/awalterschulze/gographviz v0.0.0-20181013152038-b2885df04310 h1:t+qxRrRtwNiUYA+Xh2jSXhoG2grnMCMKX4Fg6lx9X1U= +github.com/awalterschulze/gographviz v0.0.0-20181013152038-b2885df04310/go.mod h1:GEV5wmg4YquNw7v1kkyoX9etIk8yVmXj+AkDHuuETHs= +github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= +github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= +github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= +github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= +github.com/cespare/xxhash/v2 v2.1.0 h1:yTUvW7Vhb89inJ+8irsUqiWjh8iT6sQPZiQzI6ReGkA= +github.com/cespare/xxhash/v2 v2.1.0/go.mod h1:dgIUBU3pDso/gPgZ1osOZ0iQf77oPR28Tjxl5dIMyVM= +github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= +github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= +github.com/flynn-archive/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:rZfgFAXFS/z/lEd6LJmf9HVZ1LkgYiHx5pHhV5DR16M= +github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= +github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= +github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= +github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= +github.com/gogo/protobuf v1.3.0/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= +github.com/gogo/protobuf v1.3.1 h1:DqDEcV5aeaTmdFBePNpYsp3FlcVH/2ISVVM9Qf8PSls= +github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/google/go-cmp v0.3.0 h1:crn/baboCvb5fXaQ0IJ1SGTsTVrWpDsCWC8EGETZijY= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= +github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= +github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= +github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= +github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= +github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= +github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= +github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/mr-tron/base58 v1.1.2 h1:ZEw4I2EgPKDJ2iEw0cNmLB3ROrEmkOtXIkaG7wZg+78= +github.com/mr-tron/base58 v1.1.2/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= +github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/nspcc-dev/hrw v1.0.8 h1:vwRuJXZXgkMvf473vFzeWGCfY1WBVeSHAEHvR4u3/Cg= +github.com/nspcc-dev/hrw v1.0.8/go.mod h1:l/W2vx83vMQo6aStyx2AuZrJ+07lGv2JQGlVkPG06MU= +github.com/nspcc-dev/neofs-crypto v0.2.1 h1:NxKexcW88vlHO/u7EYjx5Q1UaOQ7XhYrCsLSVgOcCxw= +github.com/nspcc-dev/neofs-crypto v0.2.1/go.mod h1:F/96fUzPM3wR+UGsPi3faVNmFlA9KAEAUQR7dMxZmNA= +github.com/nspcc-dev/netmap v1.6.1 h1:Pigqpqi6QSdRiusbq5XlO20A18k6Eyu7j9MzOfAE3CM= +github.com/nspcc-dev/netmap v1.6.1/go.mod h1:mhV3UOg9ljQmu0teQShD6+JYX09XY5gu2I4hIByCH9M= +github.com/nspcc-dev/rfc6979 v0.1.0 h1:Lwg7esRRoyK1Up/IN1vAef1EmvrBeMHeeEkek2fAJ6c= +github.com/nspcc-dev/rfc6979 v0.1.0/go.mod h1:exhIh1PdpDC5vQmyEsGvc4YDM/lyQp/452QxGq/UEso= +github.com/nspcc-dev/tzhash v1.3.0 h1:n6FTHsfPYbMi5Jmo6SwGVVRQD8i2w1P2ScCaW6rz69Q= +github.com/nspcc-dev/tzhash v1.3.0/go.mod h1:Lc4DersKS8MNIrunTmsAzANO56qnG+LZ4GOE/WYGVzU= +github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.10.2 h1:uqH7bpe+ERSiDa34FDOF7RikN6RzXgduUF8yarlZp94= +github.com/onsi/ginkgo v1.10.2/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/gomega v1.7.0 h1:XPnZz8VVBHjVsy1vzJmRwIcSwiUO+JFfrv/xGiigmME= +github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= +github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= +github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= +github.com/prometheus/client_golang v1.2.1 h1:JnMpQc6ppsNgw9QPAGF6Dod479itz7lvlsMzzNayLOI= +github.com/prometheus/client_golang v1.2.1/go.mod h1:XMU6Z2MjaRKVu/dC1qupJI9SiNkDYzz3xecMgSW/F+U= +github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= +github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4 h1:gQz4mCbXsO+nc9n1hCxHcGA3Zx3Eo+UHZoInFGUIXNM= +github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/common v0.7.0 h1:L+1lyG48J1zAQXA3RBX/nG/B3gjlHq0zTt2tlbJLyCY= +github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt26CguLLsqA= +github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= +github.com/prometheus/procfs v0.0.5 h1:3+auTFlqw+ZaQYJARz6ArODtkaIwtvBTx3N2NehQlL8= +github.com/prometheus/procfs v0.0.5/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDaekg4FpcdQ= +github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= +github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= +github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= +github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550 h1:ObdrDkeb4kJdCP557AjRjq69pTHfNouLtWZG7j9rPN8= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3 h1:0GoQqolDA55aaLxZyTzK/Y2ePZzZTUrRacwib7cNsYQ= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190613194153-d28f0bde5980 h1:dfGZHvZk057jK2MCeWus/TowKpJ8y4AmooUzdBSR9GU= +golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181228144115-9a3f9b0469bb/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d h1:+R4KGOnez64A81RvjARKc4UT5/tI9ujCIVX+P5KiHuI= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191010194322-b09406accb47 h1:/XfQ9z7ib8eEJX2hdgFTZJ/ntt0swNk5oYBziWeTCvY= +golang.org/x/sys v0.0.0-20191010194322-b09406accb47/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8 h1:Nw54tB0rB7hY/N0NQvRW8DG4Yk3Q6T9cu9RcFQDu1tc= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/grpc v1.24.0 h1:vb/1TCsVn3DcJlQ0Gs1yB1pKI6Do2/QNwxdKqmc/b0s= +google.golang.org/grpc v1.24.0/go.mod h1:XDChyiUovWa60DnaeDeZmSW86xtLtjtZbwvSiRnRtcA= +gopkg.in/abiosoft/ishell.v2 v2.0.0/go.mod h1:sFp+cGtH6o4s1FtpVPTMcHq2yue+c4DGOVohJCPUzwY= +gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= +gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/hash/hash.go b/hash/hash.go new file mode 100644 index 0000000..3688443 --- /dev/null +++ b/hash/hash.go @@ -0,0 +1,98 @@ +package hash + +import ( + "bytes" + + "github.com/mr-tron/base58" + "github.com/nspcc-dev/neofs-proto/internal" + "github.com/nspcc-dev/tzhash/tz" + "github.com/pkg/errors" +) + +// HomomorphicHashSize contains size of HH. +const HomomorphicHashSize = 64 + +// Hash is implementation of HomomorphicHash. +type Hash [HomomorphicHashSize]byte + +// ErrWrongDataSize raised when wrong size of bytes is passed to unmarshal HH. +const ErrWrongDataSize = internal.Error("wrong data size") + +var ( + _ internal.Custom = (*Hash)(nil) + + emptyHH [HomomorphicHashSize]byte +) + +// Size returns size of Hash (HomomorphicHashSize). +func (h Hash) Size() int { return HomomorphicHashSize } + +// Empty checks that Hash is empty. +func (h Hash) Empty() bool { return bytes.Equal(h.Bytes(), emptyHH[:]) } + +// Reset sets current Hash to empty value. +func (h *Hash) Reset() { *h = Hash{} } + +// ProtoMessage method to satisfy proto.Message interface. +func (h Hash) ProtoMessage() {} + +// Bytes represents Hash as bytes. +func (h Hash) Bytes() []byte { + buf := make([]byte, HomomorphicHashSize) + copy(buf, h[:]) + return h[:] +} + +// Marshal returns bytes representation of Hash. +func (h Hash) Marshal() ([]byte, error) { return h.Bytes(), nil } + +// MarshalTo tries to marshal Hash into passed bytes and returns count of copied bytes. +func (h *Hash) MarshalTo(data []byte) (int, error) { return copy(data, h.Bytes()), nil } + +// Unmarshal tries to parse bytes into valid Hash. +func (h *Hash) Unmarshal(data []byte) error { + if ln := len(data); ln != HomomorphicHashSize { + return errors.Wrapf(ErrWrongDataSize, "expect=%d, actual=%d", HomomorphicHashSize, ln) + } + + copy((*h)[:], data) + return nil +} + +// String returns string representation of Hash. +func (h Hash) String() string { return base58.Encode(h[:]) } + +// Equal checks that current Hash is equal to passed Hash. +func (h Hash) Equal(hash Hash) bool { return h == hash } + +// Verify validates if current hash generated from passed data. +func (h Hash) Verify(data []byte) bool { return h.Equal(Sum(data)) } + +// Validate checks if combined hashes are equal to current Hash. +func (h Hash) Validate(hashes []Hash) bool { + var hashBytes = make([][]byte, 0, len(hashes)) + for i := range hashes { + hashBytes = append(hashBytes, hashes[i].Bytes()) + } + ok, err := tz.Validate(h.Bytes(), hashBytes) + return err == nil && ok +} + +// Sum returns Tillich-Zémor checksum of data. +func Sum(data []byte) Hash { return tz.Sum(data) } + +// Concat combines hashes based on homomorphic property. +func Concat(hashes []Hash) (Hash, error) { + var ( + hash Hash + h = make([][]byte, 0, len(hashes)) + ) + for i := range hashes { + h = append(h, hashes[i].Bytes()) + } + cat, err := tz.Concat(h) + if err != nil { + return hash, err + } + return hash, hash.Unmarshal(cat) +} diff --git a/hash/hash_test.go b/hash/hash_test.go new file mode 100644 index 0000000..b3ef703 --- /dev/null +++ b/hash/hash_test.go @@ -0,0 +1,166 @@ +package hash + +import ( + "bytes" + "crypto/rand" + "testing" + + "github.com/pkg/errors" + "github.com/stretchr/testify/require" +) + +func Test_Sum(t *testing.T) { + var ( + data = []byte("Hello world") + sum = Sum(data) + hash = []byte{0, 0, 0, 0, 1, 79, 16, 173, 134, 90, 176, 77, 114, 165, 253, 114, 0, 0, 0, 0, 0, 148, + 172, 222, 98, 248, 15, 99, 205, 129, 66, 91, 0, 0, 0, 0, 0, 138, 173, 39, 228, 231, 239, 123, + 170, 96, 186, 61, 0, 0, 0, 0, 0, 90, 69, 237, 131, 90, 161, 73, 38, 164, 185, 55} + ) + + require.Equal(t, hash, sum.Bytes()) +} + +func Test_Validate(t *testing.T) { + var ( + data = []byte("Hello world") + hash = Sum(data) + pieces = splitData(data, 2) + ln = len(pieces) + hashes = make([]Hash, 0, ln) + ) + + for i := 0; i < ln; i++ { + hashes = append(hashes, Sum(pieces[i])) + } + + require.True(t, hash.Validate(hashes)) +} + +func Test_Concat(t *testing.T) { + var ( + data = []byte("Hello world") + hash = Sum(data) + pieces = splitData(data, 2) + ln = len(pieces) + hashes = make([]Hash, 0, ln) + ) + + for i := 0; i < ln; i++ { + hashes = append(hashes, Sum(pieces[i])) + } + + res, err := Concat(hashes) + require.NoError(t, err) + require.Equal(t, hash, res) +} + +func Test_HashChunks(t *testing.T) { + var ( + chars = []byte("+") + size = 1400 + data = bytes.Repeat(chars, size) + hash = Sum(data) + count = 150 + ) + + hashes, err := dataHashes(data, count) + require.NoError(t, err) + require.Len(t, hashes, count) + + require.True(t, hash.Validate(hashes)) + + // 100 / 150 = 0 + hashes, err = dataHashes(data[:100], count) + require.Error(t, err) + require.Nil(t, hashes) +} + +func TestXOR(t *testing.T) { + var ( + dl = 10 + data = make([]byte, dl) + ) + + _, err := rand.Read(data) + require.NoError(t, err) + + t.Run("XOR with salt", func(t *testing.T) { + res := SaltXOR(data, nil) + require.Equal(t, res, data) + }) + + t.Run("XOR with empty salt", func(t *testing.T) { + xorWithSalt(t, data, 0) + }) + + t.Run("XOR with salt same data size", func(t *testing.T) { + xorWithSalt(t, data, dl) + }) + + t.Run("XOR with salt shorter than data aliquot", func(t *testing.T) { + xorWithSalt(t, data, dl/2) + }) + + t.Run("XOR with salt shorter than data aliquant", func(t *testing.T) { + xorWithSalt(t, data, dl/3/+1) + }) + + t.Run("XOR with salt longer than data aliquot", func(t *testing.T) { + xorWithSalt(t, data, dl*2) + }) + + t.Run("XOR with salt longer than data aliquant", func(t *testing.T) { + xorWithSalt(t, data, dl*2-1) + }) +} + +func xorWithSalt(t *testing.T, data []byte, saltSize int) { + var ( + direct, reverse []byte + salt = make([]byte, saltSize) + ) + + _, err := rand.Read(salt) + require.NoError(t, err) + + direct = SaltXOR(data, salt) + require.Len(t, direct, len(data)) + + reverse = SaltXOR(direct, salt) + require.Len(t, reverse, len(data)) + + require.Equal(t, reverse, data) +} + +func splitData(buf []byte, lim int) [][]byte { + var piece []byte + pieces := make([][]byte, 0, len(buf)/lim+1) + for len(buf) >= lim { + piece, buf = buf[:lim], buf[lim:] + pieces = append(pieces, piece) + } + if len(buf) > 0 { + pieces = append(pieces, buf) + } + return pieces +} + +func dataHashes(data []byte, count int) ([]Hash, error) { + var ( + ln = len(data) + mis = ln / count + off = (count - 1) * mis + hashes = make([]Hash, 0, count) + ) + if mis == 0 { + return nil, errors.Errorf("could not split %d bytes to %d pieces", ln, count) + } + + pieces := splitData(data[:off], mis) + pieces = append(pieces, data[off:]) + for i := 0; i < count; i++ { + hashes = append(hashes, Sum(pieces[i])) + } + return hashes, nil +} diff --git a/hash/hashesslice.go b/hash/hashesslice.go new file mode 100644 index 0000000..83bf4c5 --- /dev/null +++ b/hash/hashesslice.go @@ -0,0 +1,20 @@ +package hash + +import ( + "bytes" +) + +// HashesSlice is a collection that satisfies sort.Interface and can be +// sorted by the routines in sort package. +type HashesSlice []Hash + +// -- HashesSlice -- an inner type to sort Objects +// Len is the number of elements in the collection. +func (hs HashesSlice) Len() int { return len(hs) } + +// Less reports whether the element with +// index i should be sorted before the element with index j. +func (hs HashesSlice) Less(i, j int) bool { return bytes.Compare(hs[i].Bytes(), hs[j].Bytes()) == -1 } + +// Swap swaps the elements with indexes i and j. +func (hs HashesSlice) Swap(i, j int) { hs[i], hs[j] = hs[j], hs[i] } diff --git a/hash/salt.go b/hash/salt.go new file mode 100644 index 0000000..5b6eeb0 --- /dev/null +++ b/hash/salt.go @@ -0,0 +1,17 @@ +package hash + +// SaltXOR xors bits of data with salt +// repeating salt if necessary. +func SaltXOR(data, salt []byte) (result []byte) { + result = make([]byte, len(data)) + ls := len(salt) + if ls == 0 { + copy(result, data) + return + } + + for i := range result { + result[i] = data[i] ^ salt[i%ls] + } + return +} diff --git a/internal/error.go b/internal/error.go new file mode 100644 index 0000000..7df1603 --- /dev/null +++ b/internal/error.go @@ -0,0 +1,7 @@ +package internal + +// Error is a custom error. +type Error string + +// Error is an implementation of error interface. +func (e Error) Error() string { return string(e) } diff --git a/internal/proto.go b/internal/proto.go new file mode 100644 index 0000000..951168b --- /dev/null +++ b/internal/proto.go @@ -0,0 +1,16 @@ +package internal + +import "github.com/gogo/protobuf/proto" + +// Custom contains methods to satisfy proto.Message +// including custom methods to satisfy protobuf for +// non-proto defined types. +type Custom interface { + Size() int + Empty() bool + Bytes() []byte + Marshal() ([]byte, error) + MarshalTo(data []byte) (int, error) + Unmarshal(data []byte) error + proto.Message +} diff --git a/object/doc.go b/object/doc.go new file mode 100644 index 0000000..d81495b --- /dev/null +++ b/object/doc.go @@ -0,0 +1,143 @@ +/* +Package object manages main storage structure in the system. All storage +operations are performed with the objects. During lifetime object might be +transformed into another object by cutting its payload or adding meta +information. All transformation may be reversed, therefore source object +will be able to restore. + +Object structure + +Object consists of Payload and Header. Payload is unlimited but storage nodes +may have a policy to store objects with a limited payload. In this case object +with large payload will be transformed into the chain of objects with small +payload. + +Headers are simple key-value fields that divided into two groups: system +headers and extended headers. System headers contain information about +protocol version, object id, payload length in bytes, owner id, container id +and object creation timestamp (both in epochs and unix time). All these fields +must be set up in the correct object. + + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- + | System Headers | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- + | Version : 1 | + | Payload Length : 21673465 | + | Object ID : 465208e2-ba4f-4f99-ad47-82a59f4192d4 | + | Owner ID : AShvoCbSZ7VfRiPkVb1tEcBLiJrcbts1tt | + | Container ID : FGobtRZA6sBZv2i9k4L7TiTtnuP6E788qa278xfj3Fxj | + | Created At : Epoch#10, 1573033162 | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- + | Extended Headers | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- + | User Header : , | + | Verification Header : , | + | Homomorphic Hash : 0x23d35a56ae... | + | Payload Checksum : 0x1bd34abs75... | + | Integrity Header :
, | + | Transformation : Payload Split | + | Link-parent : cae08935-b4ba-499a-bf6c-98276c1e6c0b | + | Link-next : c3b40fbf-3798-4b61-a189-2992b5fb5070 | + | Payload Checksum : 0x1f387a5c36... | + | Integrity Header :
, | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- + | Payload | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- + | 0xd1581963a342d231... | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- + +There are different kinds of extended headers. A correct object must contain +verification header, homomorphic hash header, payload checksum and +integrity header. The order of headers is matter. Let's look through all +these headers. + +Link header points to the connected objects. During object transformation, large +object might be transformed into the chain of smaller objects. One of these +objects drops payload and has several "Child" links. We call this object as +zero-object. Others will have "Parent" link to the zero-object, "Previous" +and "Next" links in the payload chain. + + [ Object ID:1 ] = > transformed + `- [ Zero-Object ID:1 ] + `- Link-child ID:2 + `- Link-child ID:3 + `- Link-child ID:4 + `- Payload [null] + `- [ Object ID:2 ] + `- Link-parent ID:1 + `- Link-next ID:3 + `- Payload [ 0x13ba... ] + `- [ Object ID:3 ] + `- Link-parent ID:1 + `- Link-previous ID:2 + `- Link-next ID:4 + `- Payload [ 0xcd34... ] + `- [ Object ID:4 ] + `- Link-parent ID:1 + `- Link-previous ID:3 + `- Payload [ 0xef86... ] + +Storage groups are also objects. They have "Storage Group" links to all +objects in the group. Links are set by nodes during transformations and, +in general, they should not be set by user manually. + +Redirect headers are not used yet, they will be implemented and described +later. + +User header is a key-value pair of string that can be defined by user. User +can use these headers as search attribute. You can store any meta information +about object there, e.g. object's nicename. + +Transformation header notifies that object was transformed by some pre-defined +way. This header sets up before object is transformed and all headers after +transformation must be located after transformation header. During reverse +transformation, all headers under transformation header will be cut out. + + +-+-+-+-+-+-+-+-+-+- +-+-+-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+-+-+ + | Payload checksum | | Payload checksum | | Payload checksum | + | Integrity header | => | Integrity header | + | Integrity header | + +-+-+-+-+-+-+-+-+-+- | Transformation | | Transformation | + | Large payload | | New Checksum | | New Checksum | + +-+-+-+-+-+-+-+-+-+- | New Integrity | | New Integrity | + +-+-+-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+-+-+ + | Small payload | | Small payload | + +-+-+-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+-+-+ + +For now, we use only one type of transformation: payload split transformation. +This header set up by node automatically. + +Tombstone header notifies that this object was deleted by user. Objects with +tombstone header do not have payload, but they still contain meta information +in the headers. This way we implement two-phase commit for object removal. +Storage nodes will eventually delete all tombstone objects. If you want to +delete object, you must create new object with the same object id, with +tombstone header, correct signatures and without payload. + +Verification header contains session information. To put the object in +the system user must create session. It is required because objects might +be transformed and therefore must be re-signed. To do that node creates +a pair of session public and private keys. Object owner delegates permission to +re-sign objects by signing session public key. This header contains session +public key and owner's signature of this key. You must specify this header +manually. + +Homomorphic hash header contains homomorphic hash of the source object. +Transformations do not affect this header. This header used by data audit and +set by node automatically. + +Payload checksum contains checksum of the actual object payload. All payload +transformation must set new payload checksum headers. This header set by node +automatically. + +Integrity header contains checksum of the header and signature of the +session key. This header must be last in the list of extended headers. +Checksum is calculated by marshaling all above headers, including system +headers. This header set by node automatically. + +Storage group header is presented in storage group objects. It contains +information for data audit: size of validated data, homomorphic has of this +data, storage group expiration time in epochs or unix time. + + +*/ +package object diff --git a/object/extensions.go b/object/extensions.go new file mode 100644 index 0000000..1d89683 --- /dev/null +++ b/object/extensions.go @@ -0,0 +1,84 @@ +package object + +import ( + "github.com/nspcc-dev/neofs-proto/hash" +) + +// IsLinking checks if object has children links to another objects. +// We have to check payload size because zero-object must have zero +// payload and non-zero payload length field in system header. +func (m Object) IsLinking() bool { + for i := range m.Headers { + switch v := m.Headers[i].Value.(type) { + case *Header_Link: + if v.Link.GetType() == Link_Child { + return m.SystemHeader.PayloadLength > 0 && len(m.Payload) == 0 + } + } + } + return false +} + +// VerificationHeader returns verification header if it is presented in extended headers. +func (m Object) VerificationHeader() (*VerificationHeader, error) { + _, vh := m.LastHeader(HeaderType(VerifyHdr)) + if vh == nil { + return nil, ErrHeaderNotFound + } + return vh.Value.(*Header_Verify).Verify, nil +} + +// SetVerificationHeader sets verification header in the object. +// It will replace existing verification header or add a new one. +func (m *Object) SetVerificationHeader(header *VerificationHeader) { + m.SetHeader(&Header{Value: &Header_Verify{Verify: header}}) +} + +// Links returns slice of ids of specified link type +func (m *Object) Links(t Link_Type) []ID { + var res []ID + for i := range m.Headers { + switch v := m.Headers[i].Value.(type) { + case *Header_Link: + if v.Link.GetType() == t { + res = append(res, v.Link.ID) + } + } + } + return res +} + +// Tombstone returns tombstone header if it is presented in extended headers. +func (m Object) Tombstone() *Tombstone { + _, h := m.LastHeader(HeaderType(TombstoneHdr)) + if h != nil { + return h.Value.(*Header_Tombstone).Tombstone + } + return nil +} + +// IsTombstone checks if object has tombstone header. +func (m Object) IsTombstone() bool { + n, _ := m.LastHeader(HeaderType(TombstoneHdr)) + return n != -1 +} + +// StorageGroup returns storage group structure if it is presented in extended headers. +func (m Object) StorageGroup() (*StorageGroup, error) { + _, sgHdr := m.LastHeader(HeaderType(StorageGroupHdr)) + if sgHdr == nil { + return nil, ErrHeaderNotFound + } + return sgHdr.Value.(*Header_StorageGroup).StorageGroup, nil +} + +// SetStorageGroup sets storage group header in the object. +// It will replace existing storage group header or add a new one. +func (m *Object) SetStorageGroup(sg *StorageGroup) { + m.SetHeader(&Header{Value: &Header_StorageGroup{StorageGroup: sg}}) +} + +// Empty checks if storage group has some data for validation. +func (m StorageGroup) Empty() bool { + return m.ValidationDataSize == 0 && m.ValidationHash.Equal(hash.Hash{}) +} diff --git a/object/service.go b/object/service.go new file mode 100644 index 0000000..098f9c3 --- /dev/null +++ b/object/service.go @@ -0,0 +1,215 @@ +package object + +import ( + "github.com/nspcc-dev/neofs-proto/hash" + "github.com/nspcc-dev/neofs-proto/internal" + "github.com/nspcc-dev/neofs-proto/refs" + "github.com/nspcc-dev/neofs-proto/service" + "github.com/nspcc-dev/neofs-proto/session" +) + +type ( + // ID is a type alias of object id. + ID = refs.ObjectID + + // CID is a type alias of container id. + CID = refs.CID + + // SGID is a type alias of storage group id. + SGID = refs.SGID + + // OwnerID is a type alias of owner id. + OwnerID = refs.OwnerID + + // Hash is a type alias of Homomorphic hash. + Hash = hash.Hash + + // Token is a type alias of session token. + Token = session.Token + + // Request defines object rpc requests. + // All object operations must have TTL, Epoch, Container ID and + // permission of usage previous network map. + Request interface { + service.TTLRequest + service.EpochRequest + + CID() CID + AllowPreviousNetMap() bool + } +) + +const ( + // UnitsB starts enum for amount of bytes. + UnitsB int64 = 1 << (10 * iota) + + // UnitsKB defines amount of bytes in one kilobyte. + UnitsKB + + // UnitsMB defines amount of bytes in one megabyte. + UnitsMB + + // UnitsGB defines amount of bytes in one gigabyte. + UnitsGB + + // UnitsTB defines amount of bytes in one terabyte. + UnitsTB +) + +const ( + // ErrNotFound is raised when object is not found in the system. + ErrNotFound = internal.Error("could not find object") + + // ErrHeaderExpected is raised when first message in protobuf stream does not contain user header. + ErrHeaderExpected = internal.Error("expected header as a first message in stream") + + // KeyStorageGroup is a key for a search object by storage group id. + KeyStorageGroup = "STORAGE_GROUP" + + // KeyNoChildren is a key for searching object that have no children links. + KeyNoChildren = "LEAF" + + // KeyParent is a key for searching object by id of parent object. + KeyParent = "PARENT" + + // KeyHasParent is a key for searching object that have parent link. + KeyHasParent = "HAS_PAR" + + // KeyTombstone is a key for searching object that have tombstone header. + KeyTombstone = "TOMBSTONE" + + // KeyChild is a key for searching object by id of child link. + KeyChild = "CHILD" + + // KeyPrev is a key for searching object by id of previous link. + KeyPrev = "PREV" + + // KeyNext is a key for searching object by id of next link. + KeyNext = "NEXT" + + // KeyID is a key for searching object by object id. + KeyID = "ID" + + // KeyCID is a key for searching object by container id. + KeyCID = "CID" + + // KeyOwnerID is a key for searching object by owner id. + KeyOwnerID = "OWNERID" + + // KeyRootObject is a key for searching object that are zero-object or do + // not have any children. + KeyRootObject = "ROOT_OBJECT" +) + +func checkIsNotFull(v interface{}) bool { + var obj *Object + + switch t := v.(type) { + case *GetResponse: + obj = t.GetObject() + case *PutRequest: + if h := t.GetHeader(); h != nil { + obj = h.Object + } + default: + panic("unknown type") + } + + return obj == nil || obj.SystemHeader.PayloadLength != uint64(len(obj.Payload)) && !obj.IsLinking() +} + +// NotFull checks if protobuf stream provided whole object for get operation. +func (m *GetResponse) NotFull() bool { return checkIsNotFull(m) } + +// NotFull checks if protobuf stream provided whole object for put operation. +func (m *PutRequest) NotFull() bool { return checkIsNotFull(m) } + +// GetTTL returns TTL value from object put request. +func (m *PutRequest) GetTTL() uint32 { return m.GetHeader().TTL } + +// GetEpoch returns epoch value from object put request. +func (m *PutRequest) GetEpoch() uint64 { return m.GetHeader().GetEpoch() } + +// SetTTL sets TTL value into object put request. +func (m *PutRequest) SetTTL(ttl uint32) { m.GetHeader().TTL = ttl } + +// SetTTL sets TTL value into object get request. +func (m *GetRequest) SetTTL(ttl uint32) { m.TTL = ttl } + +// SetTTL sets TTL value into object head request. +func (m *HeadRequest) SetTTL(ttl uint32) { m.TTL = ttl } + +// SetTTL sets TTL value into object search request. +func (m *SearchRequest) SetTTL(ttl uint32) { m.TTL = ttl } + +// SetTTL sets TTL value into object delete request. +func (m *DeleteRequest) SetTTL(ttl uint32) { m.TTL = ttl } + +// SetTTL sets TTL value into object get range request. +func (m *GetRangeRequest) SetTTL(ttl uint32) { m.TTL = ttl } + +// SetTTL sets TTL value into object get range hash request. +func (m *GetRangeHashRequest) SetTTL(ttl uint32) { m.TTL = ttl } + +// SetEpoch sets epoch value into object put request. +func (m *PutRequest) SetEpoch(v uint64) { m.GetHeader().Epoch = v } + +// SetEpoch sets epoch value into object get request. +func (m *GetRequest) SetEpoch(v uint64) { m.Epoch = v } + +// SetEpoch sets epoch value into object head request. +func (m *HeadRequest) SetEpoch(v uint64) { m.Epoch = v } + +// SetEpoch sets epoch value into object search request. +func (m *SearchRequest) SetEpoch(v uint64) { m.Epoch = v } + +// SetEpoch sets epoch value into object delete request. +func (m *DeleteRequest) SetEpoch(v uint64) { m.Epoch = v } + +// SetEpoch sets epoch value into object get range request. +func (m *GetRangeRequest) SetEpoch(v uint64) { m.Epoch = v } + +// SetEpoch sets epoch value into object get range hash request. +func (m *GetRangeHashRequest) SetEpoch(v uint64) { m.Epoch = v } + +// CID returns container id value from object put request. +func (m *PutRequest) CID() CID { return m.GetHeader().Object.SystemHeader.CID } + +// CID returns container id value from object get request. +func (m *GetRequest) CID() CID { return m.Address.CID } + +// CID returns container id value from object head request. +func (m *HeadRequest) CID() CID { return m.Address.CID } + +// CID returns container id value from object search request. +func (m *SearchRequest) CID() CID { return m.ContainerID } + +// CID returns container id value from object delete request. +func (m *DeleteRequest) CID() CID { return m.Address.CID } + +// CID returns container id value from object get range request. +func (m *GetRangeRequest) CID() CID { return m.Address.CID } + +// CID returns container id value from object get range hash request. +func (m *GetRangeHashRequest) CID() CID { return m.Address.CID } + +// AllowPreviousNetMap returns permission to use previous network map in object put request. +func (m *PutRequest) AllowPreviousNetMap() bool { return false } + +// AllowPreviousNetMap returns permission to use previous network map in object get request. +func (m *GetRequest) AllowPreviousNetMap() bool { return true } + +// AllowPreviousNetMap returns permission to use previous network map in object head request. +func (m *HeadRequest) AllowPreviousNetMap() bool { return true } + +// AllowPreviousNetMap returns permission to use previous network map in object search request. +func (m *SearchRequest) AllowPreviousNetMap() bool { return true } + +// AllowPreviousNetMap returns permission to use previous network map in object delete request. +func (m *DeleteRequest) AllowPreviousNetMap() bool { return false } + +// AllowPreviousNetMap returns permission to use previous network map in object get range request. +func (m *GetRangeRequest) AllowPreviousNetMap() bool { return false } + +// AllowPreviousNetMap returns permission to use previous network map in object get range hash request. +func (m *GetRangeHashRequest) AllowPreviousNetMap() bool { return false } diff --git a/object/service.pb.go b/object/service.pb.go new file mode 100644 index 0000000..aede5cd --- /dev/null +++ b/object/service.pb.go @@ -0,0 +1,4491 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: object/service.proto + +package object + +import ( + context "context" + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/golang/protobuf/proto" + refs "github.com/nspcc-dev/neofs-proto/refs" + session "github.com/nspcc-dev/neofs-proto/session" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package + +type GetRequest struct { + Epoch uint64 `protobuf:"varint,1,opt,name=Epoch,proto3" json:"Epoch,omitempty"` + Address refs.Address `protobuf:"bytes,2,opt,name=Address,proto3" json:"Address"` + TTL uint32 `protobuf:"varint,3,opt,name=TTL,proto3" json:"TTL,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetRequest) Reset() { *m = GetRequest{} } +func (m *GetRequest) String() string { return proto.CompactTextString(m) } +func (*GetRequest) ProtoMessage() {} +func (*GetRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_dfcdf610ade6a9ce, []int{0} +} +func (m *GetRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GetRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *GetRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetRequest.Merge(m, src) +} +func (m *GetRequest) XXX_Size() int { + return m.Size() +} +func (m *GetRequest) XXX_DiscardUnknown() { + xxx_messageInfo_GetRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_GetRequest proto.InternalMessageInfo + +func (m *GetRequest) GetEpoch() uint64 { + if m != nil { + return m.Epoch + } + return 0 +} + +func (m *GetRequest) GetAddress() refs.Address { + if m != nil { + return m.Address + } + return refs.Address{} +} + +func (m *GetRequest) GetTTL() uint32 { + if m != nil { + return m.TTL + } + return 0 +} + +type GetResponse struct { + // Types that are valid to be assigned to R: + // *GetResponse_Object + // *GetResponse_Chunk + R isGetResponse_R `protobuf_oneof:"R"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetResponse) Reset() { *m = GetResponse{} } +func (m *GetResponse) String() string { return proto.CompactTextString(m) } +func (*GetResponse) ProtoMessage() {} +func (*GetResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_dfcdf610ade6a9ce, []int{1} +} +func (m *GetResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GetResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *GetResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetResponse.Merge(m, src) +} +func (m *GetResponse) XXX_Size() int { + return m.Size() +} +func (m *GetResponse) XXX_DiscardUnknown() { + xxx_messageInfo_GetResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_GetResponse proto.InternalMessageInfo + +type isGetResponse_R interface { + isGetResponse_R() + MarshalTo([]byte) (int, error) + Size() int +} + +type GetResponse_Object struct { + Object *Object `protobuf:"bytes,1,opt,name=object,proto3,oneof" json:"object,omitempty"` +} +type GetResponse_Chunk struct { + Chunk []byte `protobuf:"bytes,2,opt,name=Chunk,proto3,oneof" json:"Chunk,omitempty"` +} + +func (*GetResponse_Object) isGetResponse_R() {} +func (*GetResponse_Chunk) isGetResponse_R() {} + +func (m *GetResponse) GetR() isGetResponse_R { + if m != nil { + return m.R + } + return nil +} + +func (m *GetResponse) GetObject() *Object { + if x, ok := m.GetR().(*GetResponse_Object); ok { + return x.Object + } + return nil +} + +func (m *GetResponse) GetChunk() []byte { + if x, ok := m.GetR().(*GetResponse_Chunk); ok { + return x.Chunk + } + return nil +} + +// XXX_OneofWrappers is for the internal use of the proto package. +func (*GetResponse) XXX_OneofWrappers() []interface{} { + return []interface{}{ + (*GetResponse_Object)(nil), + (*GetResponse_Chunk)(nil), + } +} + +type PutRequest struct { + // Types that are valid to be assigned to R: + // *PutRequest_Header + // *PutRequest_Chunk + R isPutRequest_R `protobuf_oneof:"R"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *PutRequest) Reset() { *m = PutRequest{} } +func (m *PutRequest) String() string { return proto.CompactTextString(m) } +func (*PutRequest) ProtoMessage() {} +func (*PutRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_dfcdf610ade6a9ce, []int{2} +} +func (m *PutRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *PutRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *PutRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_PutRequest.Merge(m, src) +} +func (m *PutRequest) XXX_Size() int { + return m.Size() +} +func (m *PutRequest) XXX_DiscardUnknown() { + xxx_messageInfo_PutRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_PutRequest proto.InternalMessageInfo + +type isPutRequest_R interface { + isPutRequest_R() + MarshalTo([]byte) (int, error) + Size() int +} + +type PutRequest_Header struct { + Header *PutRequest_PutHeader `protobuf:"bytes,1,opt,name=Header,proto3,oneof" json:"Header,omitempty"` +} +type PutRequest_Chunk struct { + Chunk []byte `protobuf:"bytes,2,opt,name=Chunk,proto3,oneof" json:"Chunk,omitempty"` +} + +func (*PutRequest_Header) isPutRequest_R() {} +func (*PutRequest_Chunk) isPutRequest_R() {} + +func (m *PutRequest) GetR() isPutRequest_R { + if m != nil { + return m.R + } + return nil +} + +func (m *PutRequest) GetHeader() *PutRequest_PutHeader { + if x, ok := m.GetR().(*PutRequest_Header); ok { + return x.Header + } + return nil +} + +func (m *PutRequest) GetChunk() []byte { + if x, ok := m.GetR().(*PutRequest_Chunk); ok { + return x.Chunk + } + return nil +} + +// XXX_OneofWrappers is for the internal use of the proto package. +func (*PutRequest) XXX_OneofWrappers() []interface{} { + return []interface{}{ + (*PutRequest_Header)(nil), + (*PutRequest_Chunk)(nil), + } +} + +type PutRequest_PutHeader struct { + Epoch uint64 `protobuf:"varint,1,opt,name=Epoch,proto3" json:"Epoch,omitempty"` + Object *Object `protobuf:"bytes,2,opt,name=Object,proto3" json:"Object,omitempty"` + TTL uint32 `protobuf:"varint,3,opt,name=TTL,proto3" json:"TTL,omitempty"` + Token *session.Token `protobuf:"bytes,4,opt,name=Token,proto3" json:"Token,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *PutRequest_PutHeader) Reset() { *m = PutRequest_PutHeader{} } +func (m *PutRequest_PutHeader) String() string { return proto.CompactTextString(m) } +func (*PutRequest_PutHeader) ProtoMessage() {} +func (*PutRequest_PutHeader) Descriptor() ([]byte, []int) { + return fileDescriptor_dfcdf610ade6a9ce, []int{2, 0} +} +func (m *PutRequest_PutHeader) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *PutRequest_PutHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *PutRequest_PutHeader) XXX_Merge(src proto.Message) { + xxx_messageInfo_PutRequest_PutHeader.Merge(m, src) +} +func (m *PutRequest_PutHeader) XXX_Size() int { + return m.Size() +} +func (m *PutRequest_PutHeader) XXX_DiscardUnknown() { + xxx_messageInfo_PutRequest_PutHeader.DiscardUnknown(m) +} + +var xxx_messageInfo_PutRequest_PutHeader proto.InternalMessageInfo + +func (m *PutRequest_PutHeader) GetEpoch() uint64 { + if m != nil { + return m.Epoch + } + return 0 +} + +func (m *PutRequest_PutHeader) GetObject() *Object { + if m != nil { + return m.Object + } + return nil +} + +func (m *PutRequest_PutHeader) GetTTL() uint32 { + if m != nil { + return m.TTL + } + return 0 +} + +func (m *PutRequest_PutHeader) GetToken() *session.Token { + if m != nil { + return m.Token + } + return nil +} + +type PutResponse struct { + Address refs.Address `protobuf:"bytes,1,opt,name=Address,proto3" json:"Address"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *PutResponse) Reset() { *m = PutResponse{} } +func (m *PutResponse) String() string { return proto.CompactTextString(m) } +func (*PutResponse) ProtoMessage() {} +func (*PutResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_dfcdf610ade6a9ce, []int{3} +} +func (m *PutResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *PutResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *PutResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_PutResponse.Merge(m, src) +} +func (m *PutResponse) XXX_Size() int { + return m.Size() +} +func (m *PutResponse) XXX_DiscardUnknown() { + xxx_messageInfo_PutResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_PutResponse proto.InternalMessageInfo + +func (m *PutResponse) GetAddress() refs.Address { + if m != nil { + return m.Address + } + return refs.Address{} +} + +type DeleteRequest struct { + Epoch uint64 `protobuf:"varint,1,opt,name=Epoch,proto3" json:"Epoch,omitempty"` + Address refs.Address `protobuf:"bytes,2,opt,name=Address,proto3" json:"Address"` + OwnerID OwnerID `protobuf:"bytes,3,opt,name=OwnerID,proto3,customtype=OwnerID" json:"OwnerID"` + TTL uint32 `protobuf:"varint,4,opt,name=TTL,proto3" json:"TTL,omitempty"` + Token *session.Token `protobuf:"bytes,5,opt,name=Token,proto3" json:"Token,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DeleteRequest) Reset() { *m = DeleteRequest{} } +func (m *DeleteRequest) String() string { return proto.CompactTextString(m) } +func (*DeleteRequest) ProtoMessage() {} +func (*DeleteRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_dfcdf610ade6a9ce, []int{4} +} +func (m *DeleteRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DeleteRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *DeleteRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_DeleteRequest.Merge(m, src) +} +func (m *DeleteRequest) XXX_Size() int { + return m.Size() +} +func (m *DeleteRequest) XXX_DiscardUnknown() { + xxx_messageInfo_DeleteRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_DeleteRequest proto.InternalMessageInfo + +func (m *DeleteRequest) GetEpoch() uint64 { + if m != nil { + return m.Epoch + } + return 0 +} + +func (m *DeleteRequest) GetAddress() refs.Address { + if m != nil { + return m.Address + } + return refs.Address{} +} + +func (m *DeleteRequest) GetTTL() uint32 { + if m != nil { + return m.TTL + } + return 0 +} + +func (m *DeleteRequest) GetToken() *session.Token { + if m != nil { + return m.Token + } + return nil +} + +type DeleteResponse struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DeleteResponse) Reset() { *m = DeleteResponse{} } +func (m *DeleteResponse) String() string { return proto.CompactTextString(m) } +func (*DeleteResponse) ProtoMessage() {} +func (*DeleteResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_dfcdf610ade6a9ce, []int{5} +} +func (m *DeleteResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DeleteResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *DeleteResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_DeleteResponse.Merge(m, src) +} +func (m *DeleteResponse) XXX_Size() int { + return m.Size() +} +func (m *DeleteResponse) XXX_DiscardUnknown() { + xxx_messageInfo_DeleteResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_DeleteResponse proto.InternalMessageInfo + +// HeadRequest.FullHeader == true, for fetch all headers +type HeadRequest struct { + Epoch uint64 `protobuf:"varint,1,opt,name=Epoch,proto3" json:"Epoch,omitempty"` + Address Address `protobuf:"bytes,2,opt,name=Address,proto3,customtype=Address" json:"Address"` + FullHeaders bool `protobuf:"varint,3,opt,name=FullHeaders,proto3" json:"FullHeaders,omitempty"` + TTL uint32 `protobuf:"varint,4,opt,name=TTL,proto3" json:"TTL,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *HeadRequest) Reset() { *m = HeadRequest{} } +func (m *HeadRequest) String() string { return proto.CompactTextString(m) } +func (*HeadRequest) ProtoMessage() {} +func (*HeadRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_dfcdf610ade6a9ce, []int{6} +} +func (m *HeadRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *HeadRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *HeadRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_HeadRequest.Merge(m, src) +} +func (m *HeadRequest) XXX_Size() int { + return m.Size() +} +func (m *HeadRequest) XXX_DiscardUnknown() { + xxx_messageInfo_HeadRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_HeadRequest proto.InternalMessageInfo + +func (m *HeadRequest) GetEpoch() uint64 { + if m != nil { + return m.Epoch + } + return 0 +} + +func (m *HeadRequest) GetFullHeaders() bool { + if m != nil { + return m.FullHeaders + } + return false +} + +func (m *HeadRequest) GetTTL() uint32 { + if m != nil { + return m.TTL + } + return 0 +} + +type HeadResponse struct { + Object *Object `protobuf:"bytes,1,opt,name=Object,proto3" json:"Object,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *HeadResponse) Reset() { *m = HeadResponse{} } +func (m *HeadResponse) String() string { return proto.CompactTextString(m) } +func (*HeadResponse) ProtoMessage() {} +func (*HeadResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_dfcdf610ade6a9ce, []int{7} +} +func (m *HeadResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *HeadResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *HeadResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_HeadResponse.Merge(m, src) +} +func (m *HeadResponse) XXX_Size() int { + return m.Size() +} +func (m *HeadResponse) XXX_DiscardUnknown() { + xxx_messageInfo_HeadResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_HeadResponse proto.InternalMessageInfo + +func (m *HeadResponse) GetObject() *Object { + if m != nil { + return m.Object + } + return nil +} + +type SearchRequest struct { + Epoch uint64 `protobuf:"varint,1,opt,name=Epoch,proto3" json:"Epoch,omitempty"` + Version uint32 `protobuf:"varint,2,opt,name=Version,proto3" json:"Version,omitempty"` + ContainerID CID `protobuf:"bytes,3,opt,name=ContainerID,proto3,customtype=CID" json:"ContainerID"` + Query []byte `protobuf:"bytes,4,opt,name=Query,proto3" json:"Query,omitempty"` + TTL uint32 `protobuf:"varint,5,opt,name=TTL,proto3" json:"TTL,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SearchRequest) Reset() { *m = SearchRequest{} } +func (m *SearchRequest) String() string { return proto.CompactTextString(m) } +func (*SearchRequest) ProtoMessage() {} +func (*SearchRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_dfcdf610ade6a9ce, []int{8} +} +func (m *SearchRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *SearchRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *SearchRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_SearchRequest.Merge(m, src) +} +func (m *SearchRequest) XXX_Size() int { + return m.Size() +} +func (m *SearchRequest) XXX_DiscardUnknown() { + xxx_messageInfo_SearchRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_SearchRequest proto.InternalMessageInfo + +func (m *SearchRequest) GetEpoch() uint64 { + if m != nil { + return m.Epoch + } + return 0 +} + +func (m *SearchRequest) GetVersion() uint32 { + if m != nil { + return m.Version + } + return 0 +} + +func (m *SearchRequest) GetQuery() []byte { + if m != nil { + return m.Query + } + return nil +} + +func (m *SearchRequest) GetTTL() uint32 { + if m != nil { + return m.TTL + } + return 0 +} + +type SearchResponse struct { + Addresses []refs.Address `protobuf:"bytes,1,rep,name=Addresses,proto3" json:"Addresses"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SearchResponse) Reset() { *m = SearchResponse{} } +func (m *SearchResponse) String() string { return proto.CompactTextString(m) } +func (*SearchResponse) ProtoMessage() {} +func (*SearchResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_dfcdf610ade6a9ce, []int{9} +} +func (m *SearchResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *SearchResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *SearchResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_SearchResponse.Merge(m, src) +} +func (m *SearchResponse) XXX_Size() int { + return m.Size() +} +func (m *SearchResponse) XXX_DiscardUnknown() { + xxx_messageInfo_SearchResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_SearchResponse proto.InternalMessageInfo + +func (m *SearchResponse) GetAddresses() []refs.Address { + if m != nil { + return m.Addresses + } + return nil +} + +type GetRangeRequest struct { + Epoch uint64 `protobuf:"varint,1,opt,name=Epoch,proto3" json:"Epoch,omitempty"` + Address refs.Address `protobuf:"bytes,2,opt,name=Address,proto3" json:"Address"` + Ranges []Range `protobuf:"bytes,3,rep,name=Ranges,proto3" json:"Ranges"` + TTL uint32 `protobuf:"varint,4,opt,name=TTL,proto3" json:"TTL,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetRangeRequest) Reset() { *m = GetRangeRequest{} } +func (m *GetRangeRequest) String() string { return proto.CompactTextString(m) } +func (*GetRangeRequest) ProtoMessage() {} +func (*GetRangeRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_dfcdf610ade6a9ce, []int{10} +} +func (m *GetRangeRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GetRangeRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *GetRangeRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetRangeRequest.Merge(m, src) +} +func (m *GetRangeRequest) XXX_Size() int { + return m.Size() +} +func (m *GetRangeRequest) XXX_DiscardUnknown() { + xxx_messageInfo_GetRangeRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_GetRangeRequest proto.InternalMessageInfo + +func (m *GetRangeRequest) GetEpoch() uint64 { + if m != nil { + return m.Epoch + } + return 0 +} + +func (m *GetRangeRequest) GetAddress() refs.Address { + if m != nil { + return m.Address + } + return refs.Address{} +} + +func (m *GetRangeRequest) GetRanges() []Range { + if m != nil { + return m.Ranges + } + return nil +} + +func (m *GetRangeRequest) GetTTL() uint32 { + if m != nil { + return m.TTL + } + return 0 +} + +type GetRangeResponse struct { + Fragments [][]byte `protobuf:"bytes,1,rep,name=Fragments,proto3" json:"Fragments,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetRangeResponse) Reset() { *m = GetRangeResponse{} } +func (m *GetRangeResponse) String() string { return proto.CompactTextString(m) } +func (*GetRangeResponse) ProtoMessage() {} +func (*GetRangeResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_dfcdf610ade6a9ce, []int{11} +} +func (m *GetRangeResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GetRangeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *GetRangeResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetRangeResponse.Merge(m, src) +} +func (m *GetRangeResponse) XXX_Size() int { + return m.Size() +} +func (m *GetRangeResponse) XXX_DiscardUnknown() { + xxx_messageInfo_GetRangeResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_GetRangeResponse proto.InternalMessageInfo + +func (m *GetRangeResponse) GetFragments() [][]byte { + if m != nil { + return m.Fragments + } + return nil +} + +type GetRangeHashRequest struct { + Epoch uint64 `protobuf:"varint,1,opt,name=Epoch,proto3" json:"Epoch,omitempty"` + Address refs.Address `protobuf:"bytes,2,opt,name=Address,proto3" json:"Address"` + Ranges []Range `protobuf:"bytes,3,rep,name=Ranges,proto3" json:"Ranges"` + Salt []byte `protobuf:"bytes,4,opt,name=Salt,proto3" json:"Salt,omitempty"` + TTL uint32 `protobuf:"varint,5,opt,name=TTL,proto3" json:"TTL,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetRangeHashRequest) Reset() { *m = GetRangeHashRequest{} } +func (m *GetRangeHashRequest) String() string { return proto.CompactTextString(m) } +func (*GetRangeHashRequest) ProtoMessage() {} +func (*GetRangeHashRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_dfcdf610ade6a9ce, []int{12} +} +func (m *GetRangeHashRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GetRangeHashRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *GetRangeHashRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetRangeHashRequest.Merge(m, src) +} +func (m *GetRangeHashRequest) XXX_Size() int { + return m.Size() +} +func (m *GetRangeHashRequest) XXX_DiscardUnknown() { + xxx_messageInfo_GetRangeHashRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_GetRangeHashRequest proto.InternalMessageInfo + +func (m *GetRangeHashRequest) GetEpoch() uint64 { + if m != nil { + return m.Epoch + } + return 0 +} + +func (m *GetRangeHashRequest) GetAddress() refs.Address { + if m != nil { + return m.Address + } + return refs.Address{} +} + +func (m *GetRangeHashRequest) GetRanges() []Range { + if m != nil { + return m.Ranges + } + return nil +} + +func (m *GetRangeHashRequest) GetSalt() []byte { + if m != nil { + return m.Salt + } + return nil +} + +func (m *GetRangeHashRequest) GetTTL() uint32 { + if m != nil { + return m.TTL + } + return 0 +} + +type GetRangeHashResponse struct { + Hashes []Hash `protobuf:"bytes,1,rep,name=Hashes,proto3,customtype=Hash" json:"Hashes"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetRangeHashResponse) Reset() { *m = GetRangeHashResponse{} } +func (m *GetRangeHashResponse) String() string { return proto.CompactTextString(m) } +func (*GetRangeHashResponse) ProtoMessage() {} +func (*GetRangeHashResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_dfcdf610ade6a9ce, []int{13} +} +func (m *GetRangeHashResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GetRangeHashResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *GetRangeHashResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetRangeHashResponse.Merge(m, src) +} +func (m *GetRangeHashResponse) XXX_Size() int { + return m.Size() +} +func (m *GetRangeHashResponse) XXX_DiscardUnknown() { + xxx_messageInfo_GetRangeHashResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_GetRangeHashResponse proto.InternalMessageInfo + +func init() { + proto.RegisterType((*GetRequest)(nil), "object.GetRequest") + proto.RegisterType((*GetResponse)(nil), "object.GetResponse") + proto.RegisterType((*PutRequest)(nil), "object.PutRequest") + proto.RegisterType((*PutRequest_PutHeader)(nil), "object.PutRequest.PutHeader") + proto.RegisterType((*PutResponse)(nil), "object.PutResponse") + proto.RegisterType((*DeleteRequest)(nil), "object.DeleteRequest") + proto.RegisterType((*DeleteResponse)(nil), "object.DeleteResponse") + proto.RegisterType((*HeadRequest)(nil), "object.HeadRequest") + proto.RegisterType((*HeadResponse)(nil), "object.HeadResponse") + proto.RegisterType((*SearchRequest)(nil), "object.SearchRequest") + proto.RegisterType((*SearchResponse)(nil), "object.SearchResponse") + proto.RegisterType((*GetRangeRequest)(nil), "object.GetRangeRequest") + proto.RegisterType((*GetRangeResponse)(nil), "object.GetRangeResponse") + proto.RegisterType((*GetRangeHashRequest)(nil), "object.GetRangeHashRequest") + proto.RegisterType((*GetRangeHashResponse)(nil), "object.GetRangeHashResponse") +} + +func init() { proto.RegisterFile("object/service.proto", fileDescriptor_dfcdf610ade6a9ce) } + +var fileDescriptor_dfcdf610ade6a9ce = []byte{ + // 793 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x55, 0xc1, 0x4e, 0xdb, 0x4c, + 0x10, 0xce, 0xfe, 0x49, 0x1c, 0x18, 0x3b, 0x10, 0x2d, 0xf9, 0xf9, 0x23, 0xff, 0x28, 0x44, 0x16, + 0x6a, 0x53, 0x55, 0x49, 0x28, 0x95, 0xa0, 0x07, 0x38, 0x34, 0xa1, 0x10, 0xa4, 0x4a, 0xd0, 0x25, + 0xea, 0xa1, 0xb7, 0xc4, 0x59, 0x92, 0x94, 0x60, 0xa7, 0x5e, 0x9b, 0x8a, 0x63, 0x1f, 0xa1, 0x87, + 0x56, 0x3d, 0xf4, 0x15, 0x7a, 0xee, 0x2b, 0x70, 0xec, 0xb1, 0xea, 0x01, 0x55, 0xa9, 0xfa, 0x1e, + 0x95, 0x77, 0xd7, 0xb1, 0x13, 0x42, 0xb8, 0x20, 0xf5, 0xe4, 0x9d, 0x6f, 0x66, 0x77, 0xe6, 0x9b, + 0x6f, 0xbc, 0x0b, 0x59, 0xbb, 0xf5, 0x9a, 0x9a, 0x6e, 0x85, 0x51, 0xe7, 0xbc, 0x67, 0xd2, 0xf2, + 0xc0, 0xb1, 0x5d, 0x1b, 0x2b, 0x02, 0xd5, 0x33, 0x0e, 0x3d, 0x61, 0x15, 0xf7, 0x62, 0x40, 0x99, + 0xf0, 0xe8, 0x58, 0xc6, 0x47, 0xb1, 0x25, 0x46, 0x19, 0xeb, 0xd9, 0xd6, 0x18, 0x58, 0xea, 0xf4, + 0xdc, 0xae, 0xd7, 0x2a, 0x9b, 0xf6, 0x59, 0xa5, 0x63, 0x77, 0xec, 0x0a, 0x87, 0x5b, 0xde, 0x09, + 0xb7, 0xb8, 0xc1, 0x57, 0x22, 0xdc, 0x30, 0x01, 0xf6, 0xa9, 0x4b, 0xe8, 0x1b, 0x8f, 0x32, 0x17, + 0x67, 0x21, 0xf9, 0x6c, 0x60, 0x9b, 0xdd, 0x1c, 0x2a, 0xa0, 0x62, 0x82, 0x08, 0x03, 0x97, 0x20, + 0xf5, 0xb4, 0xdd, 0x76, 0x28, 0x63, 0xb9, 0x7f, 0x0a, 0xa8, 0xa8, 0x6e, 0xa4, 0xcb, 0x7e, 0x7d, + 0x65, 0x09, 0x56, 0x13, 0x97, 0x57, 0xab, 0x31, 0x12, 0xc4, 0xe0, 0x0c, 0xc4, 0x1b, 0x8d, 0xe7, + 0xb9, 0x78, 0x01, 0x15, 0xd3, 0xc4, 0x5f, 0x1a, 0x0d, 0x50, 0x79, 0x12, 0x36, 0xb0, 0x2d, 0x46, + 0x71, 0x11, 0x24, 0x4f, 0x9e, 0x46, 0xdd, 0x58, 0x28, 0x0b, 0xb3, 0x7c, 0xc8, 0x3f, 0xf5, 0x18, + 0x91, 0x7e, 0xbc, 0x0c, 0xc9, 0x5a, 0xd7, 0xb3, 0x4e, 0x79, 0x5e, 0xad, 0x1e, 0x23, 0xc2, 0xac, + 0xc6, 0x01, 0x11, 0xe3, 0x37, 0x02, 0x38, 0xf2, 0x46, 0xb5, 0x6f, 0x82, 0x52, 0xa7, 0xcd, 0x36, + 0x75, 0xe4, 0xa9, 0x2b, 0xc1, 0xa9, 0x61, 0x8c, 0xbf, 0x14, 0x31, 0x7e, 0x0e, 0xb1, 0xba, 0x29, + 0x87, 0xfe, 0x0e, 0xc1, 0xfc, 0x28, 0xfe, 0x86, 0xce, 0xdc, 0x03, 0x45, 0xd4, 0x2c, 0x1b, 0x33, + 0xc1, 0x84, 0x48, 0xef, 0xf5, 0x96, 0xe0, 0x35, 0x48, 0x36, 0xec, 0x53, 0x6a, 0xe5, 0x12, 0x72, + 0xa3, 0xd4, 0xb2, 0xcc, 0x51, 0x22, 0x9c, 0x82, 0xe7, 0x36, 0xa8, 0x9c, 0x82, 0xec, 0x5e, 0x44, + 0x0d, 0x74, 0xbb, 0x1a, 0xc6, 0x57, 0x04, 0xe9, 0x5d, 0xda, 0xa7, 0x2e, 0xbd, 0x53, 0x91, 0x1f, + 0x40, 0xea, 0xf0, 0xad, 0x45, 0x9d, 0x83, 0x5d, 0xce, 0x4a, 0xab, 0x2e, 0xfa, 0xfe, 0x1f, 0x57, + 0xab, 0x01, 0x4c, 0x82, 0x45, 0x40, 0x3e, 0x31, 0x85, 0x7c, 0x72, 0x06, 0x79, 0x23, 0x03, 0x0b, + 0x41, 0xe1, 0x82, 0xba, 0xf1, 0x1e, 0x81, 0xea, 0xeb, 0x31, 0x9b, 0xc9, 0x93, 0x5b, 0x98, 0x8c, + 0x2a, 0x95, 0x40, 0x48, 0xaa, 0x00, 0xea, 0x9e, 0xd7, 0xef, 0x0b, 0xc9, 0x19, 0x27, 0x36, 0x47, + 0xa2, 0xd0, 0x75, 0x2e, 0xc6, 0x26, 0x68, 0xa2, 0x24, 0x29, 0x4f, 0x38, 0x12, 0x68, 0xd6, 0x48, + 0x18, 0x1f, 0x11, 0xa4, 0x8f, 0x69, 0xd3, 0x31, 0xbb, 0xb3, 0xd9, 0xe4, 0x20, 0xf5, 0x92, 0x3a, + 0x7e, 0x77, 0x38, 0x9b, 0x34, 0x09, 0x4c, 0x5c, 0x02, 0xb5, 0x66, 0x5b, 0x6e, 0xb3, 0x17, 0x95, + 0x41, 0x95, 0xe4, 0xe2, 0xb5, 0x83, 0x5d, 0x12, 0xf5, 0xfb, 0xc7, 0xbf, 0xf0, 0xa8, 0x73, 0xc1, + 0x8b, 0xd7, 0x88, 0x30, 0x02, 0x42, 0xc9, 0x90, 0x50, 0x0d, 0x16, 0x82, 0xba, 0x24, 0xa5, 0x47, + 0x30, 0x2f, 0x3b, 0x44, 0xfd, 0x99, 0x8b, 0xdf, 0x34, 0x1c, 0x61, 0x94, 0xf1, 0x01, 0xc1, 0xa2, + 0xff, 0xcb, 0x37, 0xad, 0xce, 0xdd, 0xce, 0xdd, 0x43, 0x50, 0xf8, 0xa1, 0xbe, 0x3a, 0xa2, 0x10, + 0xd9, 0x5e, 0x8e, 0xca, 0x68, 0x19, 0x32, 0x45, 0xad, 0x75, 0xc8, 0x84, 0x65, 0x49, 0x7a, 0x2b, + 0x30, 0xbf, 0xe7, 0x34, 0x3b, 0x67, 0xd4, 0x72, 0x05, 0x3d, 0x8d, 0x84, 0x80, 0xf1, 0x05, 0xc1, + 0x52, 0xb0, 0xa5, 0xde, 0x64, 0xdd, 0xbf, 0xc7, 0x06, 0x43, 0xe2, 0xb8, 0xd9, 0x77, 0xa5, 0x7e, + 0x7c, 0x3d, 0x45, 0xbe, 0x6d, 0xc8, 0x8e, 0x97, 0x2b, 0x59, 0xae, 0x81, 0xe2, 0xdb, 0x52, 0x41, + 0xad, 0xaa, 0xc9, 0x41, 0x49, 0xf0, 0x28, 0xe9, 0xdb, 0xf8, 0x1c, 0x87, 0xd4, 0xb1, 0x78, 0x92, + 0xf0, 0x3a, 0xc4, 0xf7, 0xa9, 0x8b, 0x71, 0x50, 0x53, 0xf8, 0x4e, 0xe8, 0x4b, 0x63, 0x98, 0xc8, + 0xb0, 0x8e, 0xfc, 0x1d, 0x47, 0x5e, 0x64, 0x47, 0x78, 0xf3, 0x86, 0x3b, 0x22, 0x57, 0x59, 0x11, + 0xe1, 0x2d, 0x50, 0xc4, 0x3f, 0x8e, 0xff, 0x0d, 0x02, 0xc6, 0x2e, 0x2b, 0x7d, 0x79, 0x12, 0x1e, + 0xcd, 0x64, 0xc2, 0xff, 0xed, 0xf0, 0xe8, 0xdc, 0xc8, 0xbd, 0xa0, 0x67, 0xc7, 0x41, 0xb9, 0x65, + 0x0b, 0x14, 0x31, 0xd8, 0x61, 0xae, 0xb1, 0x1f, 0x30, 0xcc, 0x35, 0x31, 0xff, 0x3b, 0x30, 0x17, + 0xb4, 0x14, 0xff, 0x17, 0x65, 0x1e, 0x99, 0x6e, 0x3d, 0x77, 0xdd, 0x21, 0xb7, 0x1f, 0x80, 0x16, + 0x55, 0x04, 0xff, 0x3f, 0x19, 0x19, 0x19, 0x2b, 0x7d, 0x65, 0xba, 0x53, 0x1c, 0x55, 0xdd, 0xb9, + 0x1c, 0xe6, 0xd1, 0xb7, 0x61, 0x1e, 0x7d, 0x1f, 0xe6, 0xd1, 0xcf, 0x61, 0x1e, 0x7d, 0xfa, 0x95, + 0x8f, 0xbd, 0xba, 0x1f, 0x79, 0xf2, 0x2d, 0x36, 0x30, 0xcd, 0x52, 0x9b, 0x9e, 0x57, 0x2c, 0x6a, + 0x9f, 0xb0, 0x92, 0x78, 0xf0, 0xc5, 0x99, 0x2d, 0x85, 0x5b, 0x8f, 0xff, 0x04, 0x00, 0x00, 0xff, + 0xff, 0x37, 0xfc, 0x5a, 0x85, 0x7d, 0x08, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// ServiceClient is the client API for Service service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type ServiceClient interface { + // Get the object from a container + Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (Service_GetClient, error) + // Put the object into a container + Put(ctx context.Context, opts ...grpc.CallOption) (Service_PutClient, error) + // Delete the object from a container + Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteResponse, error) + // Get MetaInfo + Head(ctx context.Context, in *HeadRequest, opts ...grpc.CallOption) (*HeadResponse, error) + // Search by MetaInfo + Search(ctx context.Context, in *SearchRequest, opts ...grpc.CallOption) (*SearchResponse, error) + // Get ranges of object payload + GetRange(ctx context.Context, in *GetRangeRequest, opts ...grpc.CallOption) (*GetRangeResponse, error) + // Get hashes of object ranges + GetRangeHash(ctx context.Context, in *GetRangeHashRequest, opts ...grpc.CallOption) (*GetRangeHashResponse, error) +} + +type serviceClient struct { + cc *grpc.ClientConn +} + +func NewServiceClient(cc *grpc.ClientConn) ServiceClient { + return &serviceClient{cc} +} + +func (c *serviceClient) Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (Service_GetClient, error) { + stream, err := c.cc.NewStream(ctx, &_Service_serviceDesc.Streams[0], "/object.Service/Get", opts...) + if err != nil { + return nil, err + } + x := &serviceGetClient{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 +} + +type Service_GetClient interface { + Recv() (*GetResponse, error) + grpc.ClientStream +} + +type serviceGetClient struct { + grpc.ClientStream +} + +func (x *serviceGetClient) Recv() (*GetResponse, error) { + m := new(GetResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *serviceClient) Put(ctx context.Context, opts ...grpc.CallOption) (Service_PutClient, error) { + stream, err := c.cc.NewStream(ctx, &_Service_serviceDesc.Streams[1], "/object.Service/Put", opts...) + if err != nil { + return nil, err + } + x := &servicePutClient{stream} + return x, nil +} + +type Service_PutClient interface { + Send(*PutRequest) error + CloseAndRecv() (*PutResponse, error) + grpc.ClientStream +} + +type servicePutClient struct { + grpc.ClientStream +} + +func (x *servicePutClient) Send(m *PutRequest) error { + return x.ClientStream.SendMsg(m) +} + +func (x *servicePutClient) CloseAndRecv() (*PutResponse, error) { + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + m := new(PutResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *serviceClient) Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteResponse, error) { + out := new(DeleteResponse) + err := c.cc.Invoke(ctx, "/object.Service/Delete", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Head(ctx context.Context, in *HeadRequest, opts ...grpc.CallOption) (*HeadResponse, error) { + out := new(HeadResponse) + err := c.cc.Invoke(ctx, "/object.Service/Head", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Search(ctx context.Context, in *SearchRequest, opts ...grpc.CallOption) (*SearchResponse, error) { + out := new(SearchResponse) + err := c.cc.Invoke(ctx, "/object.Service/Search", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) GetRange(ctx context.Context, in *GetRangeRequest, opts ...grpc.CallOption) (*GetRangeResponse, error) { + out := new(GetRangeResponse) + err := c.cc.Invoke(ctx, "/object.Service/GetRange", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) GetRangeHash(ctx context.Context, in *GetRangeHashRequest, opts ...grpc.CallOption) (*GetRangeHashResponse, error) { + out := new(GetRangeHashResponse) + err := c.cc.Invoke(ctx, "/object.Service/GetRangeHash", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// ServiceServer is the server API for Service service. +type ServiceServer interface { + // Get the object from a container + Get(*GetRequest, Service_GetServer) error + // Put the object into a container + Put(Service_PutServer) error + // Delete the object from a container + Delete(context.Context, *DeleteRequest) (*DeleteResponse, error) + // Get MetaInfo + Head(context.Context, *HeadRequest) (*HeadResponse, error) + // Search by MetaInfo + Search(context.Context, *SearchRequest) (*SearchResponse, error) + // Get ranges of object payload + GetRange(context.Context, *GetRangeRequest) (*GetRangeResponse, error) + // Get hashes of object ranges + GetRangeHash(context.Context, *GetRangeHashRequest) (*GetRangeHashResponse, error) +} + +// UnimplementedServiceServer can be embedded to have forward compatible implementations. +type UnimplementedServiceServer struct { +} + +func (*UnimplementedServiceServer) Get(req *GetRequest, srv Service_GetServer) error { + return status.Errorf(codes.Unimplemented, "method Get not implemented") +} +func (*UnimplementedServiceServer) Put(srv Service_PutServer) error { + return status.Errorf(codes.Unimplemented, "method Put not implemented") +} +func (*UnimplementedServiceServer) Delete(ctx context.Context, req *DeleteRequest) (*DeleteResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Delete not implemented") +} +func (*UnimplementedServiceServer) Head(ctx context.Context, req *HeadRequest) (*HeadResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Head not implemented") +} +func (*UnimplementedServiceServer) Search(ctx context.Context, req *SearchRequest) (*SearchResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Search not implemented") +} +func (*UnimplementedServiceServer) GetRange(ctx context.Context, req *GetRangeRequest) (*GetRangeResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetRange not implemented") +} +func (*UnimplementedServiceServer) GetRangeHash(ctx context.Context, req *GetRangeHashRequest) (*GetRangeHashResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetRangeHash not implemented") +} + +func RegisterServiceServer(s *grpc.Server, srv ServiceServer) { + s.RegisterService(&_Service_serviceDesc, srv) +} + +func _Service_Get_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(GetRequest) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(ServiceServer).Get(m, &serviceGetServer{stream}) +} + +type Service_GetServer interface { + Send(*GetResponse) error + grpc.ServerStream +} + +type serviceGetServer struct { + grpc.ServerStream +} + +func (x *serviceGetServer) Send(m *GetResponse) error { + return x.ServerStream.SendMsg(m) +} + +func _Service_Put_Handler(srv interface{}, stream grpc.ServerStream) error { + return srv.(ServiceServer).Put(&servicePutServer{stream}) +} + +type Service_PutServer interface { + SendAndClose(*PutResponse) error + Recv() (*PutRequest, error) + grpc.ServerStream +} + +type servicePutServer struct { + grpc.ServerStream +} + +func (x *servicePutServer) SendAndClose(m *PutResponse) error { + return x.ServerStream.SendMsg(m) +} + +func (x *servicePutServer) Recv() (*PutRequest, error) { + m := new(PutRequest) + if err := x.ServerStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func _Service_Delete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ServiceServer).Delete(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/object.Service/Delete", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ServiceServer).Delete(ctx, req.(*DeleteRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Service_Head_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(HeadRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ServiceServer).Head(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/object.Service/Head", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ServiceServer).Head(ctx, req.(*HeadRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Service_Search_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SearchRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ServiceServer).Search(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/object.Service/Search", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ServiceServer).Search(ctx, req.(*SearchRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Service_GetRange_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetRangeRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ServiceServer).GetRange(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/object.Service/GetRange", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ServiceServer).GetRange(ctx, req.(*GetRangeRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Service_GetRangeHash_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetRangeHashRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ServiceServer).GetRangeHash(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/object.Service/GetRangeHash", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ServiceServer).GetRangeHash(ctx, req.(*GetRangeHashRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Service_serviceDesc = grpc.ServiceDesc{ + ServiceName: "object.Service", + HandlerType: (*ServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Delete", + Handler: _Service_Delete_Handler, + }, + { + MethodName: "Head", + Handler: _Service_Head_Handler, + }, + { + MethodName: "Search", + Handler: _Service_Search_Handler, + }, + { + MethodName: "GetRange", + Handler: _Service_GetRange_Handler, + }, + { + MethodName: "GetRangeHash", + Handler: _Service_GetRangeHash_Handler, + }, + }, + Streams: []grpc.StreamDesc{ + { + StreamName: "Get", + Handler: _Service_Get_Handler, + ServerStreams: true, + }, + { + StreamName: "Put", + Handler: _Service_Put_Handler, + ClientStreams: true, + }, + }, + Metadata: "object/service.proto", +} + +func (m *GetRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GetRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.TTL != 0 { + i = encodeVarintService(dAtA, i, uint64(m.TTL)) + i-- + dAtA[i] = 0x18 + } + { + size, err := m.Address.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if m.Epoch != 0 { + i = encodeVarintService(dAtA, i, uint64(m.Epoch)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *GetResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GetResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.R != nil { + { + size := m.R.Size() + i -= size + if _, err := m.R.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + } + } + return len(dAtA) - i, nil +} + +func (m *GetResponse_Object) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GetResponse_Object) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.Object != nil { + { + size, err := m.Object.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} +func (m *GetResponse_Chunk) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GetResponse_Chunk) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.Chunk != nil { + i -= len(m.Chunk) + copy(dAtA[i:], m.Chunk) + i = encodeVarintService(dAtA, i, uint64(len(m.Chunk))) + i-- + dAtA[i] = 0x12 + } + return len(dAtA) - i, nil +} +func (m *PutRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PutRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PutRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.R != nil { + { + size := m.R.Size() + i -= size + if _, err := m.R.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + } + } + return len(dAtA) - i, nil +} + +func (m *PutRequest_Header) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PutRequest_Header) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.Header != nil { + { + size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} +func (m *PutRequest_Chunk) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PutRequest_Chunk) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.Chunk != nil { + i -= len(m.Chunk) + copy(dAtA[i:], m.Chunk) + i = encodeVarintService(dAtA, i, uint64(len(m.Chunk))) + i-- + dAtA[i] = 0x12 + } + return len(dAtA) - i, nil +} +func (m *PutRequest_PutHeader) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PutRequest_PutHeader) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PutRequest_PutHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.Token != nil { + { + size, err := m.Token.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + if m.TTL != 0 { + i = encodeVarintService(dAtA, i, uint64(m.TTL)) + i-- + dAtA[i] = 0x18 + } + if m.Object != nil { + { + size, err := m.Object.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.Epoch != 0 { + i = encodeVarintService(dAtA, i, uint64(m.Epoch)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *PutResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PutResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PutResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + { + size, err := m.Address.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *DeleteRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *DeleteRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DeleteRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.Token != nil { + { + size, err := m.Token.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + } + if m.TTL != 0 { + i = encodeVarintService(dAtA, i, uint64(m.TTL)) + i-- + dAtA[i] = 0x20 + } + { + size := m.OwnerID.Size() + i -= size + if _, err := m.OwnerID.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + { + size, err := m.Address.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if m.Epoch != 0 { + i = encodeVarintService(dAtA, i, uint64(m.Epoch)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *DeleteResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *DeleteResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DeleteResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + return len(dAtA) - i, nil +} + +func (m *HeadRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *HeadRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *HeadRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.TTL != 0 { + i = encodeVarintService(dAtA, i, uint64(m.TTL)) + i-- + dAtA[i] = 0x20 + } + if m.FullHeaders { + i-- + if m.FullHeaders { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x18 + } + { + size := m.Address.Size() + i -= size + if _, err := m.Address.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if m.Epoch != 0 { + i = encodeVarintService(dAtA, i, uint64(m.Epoch)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *HeadResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *HeadResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *HeadResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.Object != nil { + { + size, err := m.Object.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *SearchRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *SearchRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *SearchRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.TTL != 0 { + i = encodeVarintService(dAtA, i, uint64(m.TTL)) + i-- + dAtA[i] = 0x28 + } + if len(m.Query) > 0 { + i -= len(m.Query) + copy(dAtA[i:], m.Query) + i = encodeVarintService(dAtA, i, uint64(len(m.Query))) + i-- + dAtA[i] = 0x22 + } + { + size := m.ContainerID.Size() + i -= size + if _, err := m.ContainerID.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + if m.Version != 0 { + i = encodeVarintService(dAtA, i, uint64(m.Version)) + i-- + dAtA[i] = 0x10 + } + if m.Epoch != 0 { + i = encodeVarintService(dAtA, i, uint64(m.Epoch)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *SearchResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *SearchResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *SearchResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Addresses) > 0 { + for iNdEx := len(m.Addresses) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Addresses[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *GetRangeRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetRangeRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GetRangeRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.TTL != 0 { + i = encodeVarintService(dAtA, i, uint64(m.TTL)) + i-- + dAtA[i] = 0x20 + } + if len(m.Ranges) > 0 { + for iNdEx := len(m.Ranges) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Ranges[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } + { + size, err := m.Address.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if m.Epoch != 0 { + i = encodeVarintService(dAtA, i, uint64(m.Epoch)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *GetRangeResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetRangeResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GetRangeResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Fragments) > 0 { + for iNdEx := len(m.Fragments) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Fragments[iNdEx]) + copy(dAtA[i:], m.Fragments[iNdEx]) + i = encodeVarintService(dAtA, i, uint64(len(m.Fragments[iNdEx]))) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *GetRangeHashRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetRangeHashRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GetRangeHashRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.TTL != 0 { + i = encodeVarintService(dAtA, i, uint64(m.TTL)) + i-- + dAtA[i] = 0x28 + } + if len(m.Salt) > 0 { + i -= len(m.Salt) + copy(dAtA[i:], m.Salt) + i = encodeVarintService(dAtA, i, uint64(len(m.Salt))) + i-- + dAtA[i] = 0x22 + } + if len(m.Ranges) > 0 { + for iNdEx := len(m.Ranges) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Ranges[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } + { + size, err := m.Address.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if m.Epoch != 0 { + i = encodeVarintService(dAtA, i, uint64(m.Epoch)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *GetRangeHashResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetRangeHashResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GetRangeHashResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Hashes) > 0 { + for iNdEx := len(m.Hashes) - 1; iNdEx >= 0; iNdEx-- { + { + size := m.Hashes[iNdEx].Size() + i -= size + if _, err := m.Hashes[iNdEx].MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func encodeVarintService(dAtA []byte, offset int, v uint64) int { + offset -= sovService(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *GetRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Epoch != 0 { + n += 1 + sovService(uint64(m.Epoch)) + } + l = m.Address.Size() + n += 1 + l + sovService(uint64(l)) + if m.TTL != 0 { + n += 1 + sovService(uint64(m.TTL)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *GetResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.R != nil { + n += m.R.Size() + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *GetResponse_Object) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Object != nil { + l = m.Object.Size() + n += 1 + l + sovService(uint64(l)) + } + return n +} +func (m *GetResponse_Chunk) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Chunk != nil { + l = len(m.Chunk) + n += 1 + l + sovService(uint64(l)) + } + return n +} +func (m *PutRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.R != nil { + n += m.R.Size() + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *PutRequest_Header) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Header != nil { + l = m.Header.Size() + n += 1 + l + sovService(uint64(l)) + } + return n +} +func (m *PutRequest_Chunk) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Chunk != nil { + l = len(m.Chunk) + n += 1 + l + sovService(uint64(l)) + } + return n +} +func (m *PutRequest_PutHeader) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Epoch != 0 { + n += 1 + sovService(uint64(m.Epoch)) + } + if m.Object != nil { + l = m.Object.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.TTL != 0 { + n += 1 + sovService(uint64(m.TTL)) + } + if m.Token != nil { + l = m.Token.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *PutResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Address.Size() + n += 1 + l + sovService(uint64(l)) + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *DeleteRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Epoch != 0 { + n += 1 + sovService(uint64(m.Epoch)) + } + l = m.Address.Size() + n += 1 + l + sovService(uint64(l)) + l = m.OwnerID.Size() + n += 1 + l + sovService(uint64(l)) + if m.TTL != 0 { + n += 1 + sovService(uint64(m.TTL)) + } + if m.Token != nil { + l = m.Token.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *DeleteResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *HeadRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Epoch != 0 { + n += 1 + sovService(uint64(m.Epoch)) + } + l = m.Address.Size() + n += 1 + l + sovService(uint64(l)) + if m.FullHeaders { + n += 2 + } + if m.TTL != 0 { + n += 1 + sovService(uint64(m.TTL)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *HeadResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Object != nil { + l = m.Object.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *SearchRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Epoch != 0 { + n += 1 + sovService(uint64(m.Epoch)) + } + if m.Version != 0 { + n += 1 + sovService(uint64(m.Version)) + } + l = m.ContainerID.Size() + n += 1 + l + sovService(uint64(l)) + l = len(m.Query) + if l > 0 { + n += 1 + l + sovService(uint64(l)) + } + if m.TTL != 0 { + n += 1 + sovService(uint64(m.TTL)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *SearchResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Addresses) > 0 { + for _, e := range m.Addresses { + l = e.Size() + n += 1 + l + sovService(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *GetRangeRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Epoch != 0 { + n += 1 + sovService(uint64(m.Epoch)) + } + l = m.Address.Size() + n += 1 + l + sovService(uint64(l)) + if len(m.Ranges) > 0 { + for _, e := range m.Ranges { + l = e.Size() + n += 1 + l + sovService(uint64(l)) + } + } + if m.TTL != 0 { + n += 1 + sovService(uint64(m.TTL)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *GetRangeResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Fragments) > 0 { + for _, b := range m.Fragments { + l = len(b) + n += 1 + l + sovService(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *GetRangeHashRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Epoch != 0 { + n += 1 + sovService(uint64(m.Epoch)) + } + l = m.Address.Size() + n += 1 + l + sovService(uint64(l)) + if len(m.Ranges) > 0 { + for _, e := range m.Ranges { + l = e.Size() + n += 1 + l + sovService(uint64(l)) + } + } + l = len(m.Salt) + if l > 0 { + n += 1 + l + sovService(uint64(l)) + } + if m.TTL != 0 { + n += 1 + sovService(uint64(m.TTL)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *GetRangeHashResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Hashes) > 0 { + for _, e := range m.Hashes { + l = e.Size() + n += 1 + l + sovService(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovService(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozService(x uint64) (n int) { + return sovService(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *GetRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GetRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Epoch", wireType) + } + m.Epoch = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Epoch |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Address.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TTL", wireType) + } + m.TTL = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TTL |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GetResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GetResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Object", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &Object{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.R = &GetResponse_Object{v} + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Chunk", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := make([]byte, postIndex-iNdEx) + copy(v, dAtA[iNdEx:postIndex]) + m.R = &GetResponse_Chunk{v} + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *PutRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: PutRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PutRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &PutRequest_PutHeader{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.R = &PutRequest_Header{v} + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Chunk", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := make([]byte, postIndex-iNdEx) + copy(v, dAtA[iNdEx:postIndex]) + m.R = &PutRequest_Chunk{v} + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *PutRequest_PutHeader) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: PutHeader: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PutHeader: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Epoch", wireType) + } + m.Epoch = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Epoch |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Object", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Object == nil { + m.Object = &Object{} + } + if err := m.Object.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TTL", wireType) + } + m.TTL = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TTL |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Token", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Token == nil { + m.Token = &session.Token{} + } + if err := m.Token.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *PutResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: PutResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PutResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Address.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DeleteRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DeleteRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DeleteRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Epoch", wireType) + } + m.Epoch = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Epoch |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Address.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OwnerID", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.OwnerID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TTL", wireType) + } + m.TTL = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TTL |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Token", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Token == nil { + m.Token = &session.Token{} + } + if err := m.Token.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DeleteResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DeleteResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DeleteResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *HeadRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: HeadRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: HeadRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Epoch", wireType) + } + m.Epoch = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Epoch |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Address.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field FullHeaders", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.FullHeaders = bool(v != 0) + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TTL", wireType) + } + m.TTL = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TTL |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *HeadResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: HeadResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: HeadResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Object", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Object == nil { + m.Object = &Object{} + } + if err := m.Object.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *SearchRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: SearchRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SearchRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Epoch", wireType) + } + m.Epoch = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Epoch |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) + } + m.Version = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Version |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ContainerID", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ContainerID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Query", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Query = append(m.Query[:0], dAtA[iNdEx:postIndex]...) + if m.Query == nil { + m.Query = []byte{} + } + iNdEx = postIndex + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TTL", wireType) + } + m.TTL = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TTL |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *SearchResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: SearchResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SearchResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Addresses", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Addresses = append(m.Addresses, refs.Address{}) + if err := m.Addresses[len(m.Addresses)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GetRangeRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GetRangeRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetRangeRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Epoch", wireType) + } + m.Epoch = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Epoch |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Address.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Ranges", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Ranges = append(m.Ranges, Range{}) + if err := m.Ranges[len(m.Ranges)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TTL", wireType) + } + m.TTL = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TTL |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GetRangeResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GetRangeResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetRangeResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Fragments", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Fragments = append(m.Fragments, make([]byte, postIndex-iNdEx)) + copy(m.Fragments[len(m.Fragments)-1], dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GetRangeHashRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GetRangeHashRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetRangeHashRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Epoch", wireType) + } + m.Epoch = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Epoch |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Address.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Ranges", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Ranges = append(m.Ranges, Range{}) + if err := m.Ranges[len(m.Ranges)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Salt", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Salt = append(m.Salt[:0], dAtA[iNdEx:postIndex]...) + if m.Salt == nil { + m.Salt = []byte{} + } + iNdEx = postIndex + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TTL", wireType) + } + m.TTL = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TTL |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GetRangeHashResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GetRangeHashResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetRangeHashResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Hashes", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var v Hash + m.Hashes = append(m.Hashes, v) + if err := m.Hashes[len(m.Hashes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipService(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowService + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowService + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowService + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthService + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupService + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthService + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthService = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowService = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupService = fmt.Errorf("proto: unexpected end of group") +) diff --git a/object/service.proto b/object/service.proto new file mode 100644 index 0000000..0a03383 --- /dev/null +++ b/object/service.proto @@ -0,0 +1,119 @@ +syntax = "proto3"; +package object; +option go_package = "github.com/nspcc-dev/neofs-proto/object"; + +import "refs/types.proto"; +import "object/types.proto"; +import "session/types.proto"; +import "github.com/gogo/protobuf/gogoproto/gogo.proto"; + +option (gogoproto.stable_marshaler_all) = true; + +service Service { + // Get the object from a container + rpc Get(GetRequest) returns (stream GetResponse); + + // Put the object into a container + rpc Put(stream PutRequest) returns (PutResponse); + + // Delete the object from a container + rpc Delete(DeleteRequest) returns (DeleteResponse); + + // Get MetaInfo + rpc Head(HeadRequest) returns (HeadResponse); + + // Search by MetaInfo + rpc Search(SearchRequest) returns (SearchResponse); + + // Get ranges of object payload + rpc GetRange(GetRangeRequest) returns (GetRangeResponse); + + // Get hashes of object ranges + rpc GetRangeHash(GetRangeHashRequest) returns (GetRangeHashResponse); +} + +message GetRequest { + uint64 Epoch = 1; + refs.Address Address = 2 [(gogoproto.nullable) = false]; + uint32 TTL = 3; +} + +message GetResponse { + oneof R { + Object object = 1; + bytes Chunk = 2; + } +} + +message PutRequest { + message PutHeader { + uint64 Epoch = 1; + Object Object = 2; + uint32 TTL = 3; + session.Token Token = 4; + } + + oneof R { + PutHeader Header = 1; + bytes Chunk = 2; + } +} + +message PutResponse { + refs.Address Address = 1 [(gogoproto.nullable) = false]; +} +message DeleteRequest { + uint64 Epoch = 1; + refs.Address Address = 2 [(gogoproto.nullable) = false]; + bytes OwnerID = 3 [(gogoproto.nullable) = false, (gogoproto.customtype) = "OwnerID"]; + uint32 TTL = 4; + session.Token Token = 5; +} +message DeleteResponse {} + +// HeadRequest.FullHeader == true, for fetch all headers +message HeadRequest { + uint64 Epoch = 1; + refs.Address Address = 2 [(gogoproto.nullable) = false, (gogoproto.customtype) = "Address"]; + bool FullHeaders = 3; + uint32 TTL = 4; +} +message HeadResponse { + Object Object = 1; +} + +message SearchRequest { + uint64 Epoch = 1; + uint32 Version = 2; + bytes ContainerID = 3 [(gogoproto.nullable) = false, (gogoproto.customtype) = "CID"]; + bytes Query = 4; + uint32 TTL = 5; +} + +message SearchResponse { + repeated refs.Address Addresses = 1 [(gogoproto.nullable) = false]; +} + +message GetRangeRequest { + uint64 Epoch = 1; + refs.Address Address = 2 [(gogoproto.nullable) = false]; + repeated Range Ranges = 3 [(gogoproto.nullable) = false]; + uint32 TTL = 4; +} + +message GetRangeResponse { + repeated bytes Fragments = 1; +} + +message GetRangeHashRequest { + uint64 Epoch = 1; + refs.Address Address = 2 [(gogoproto.nullable) = false]; + repeated Range Ranges = 3 [(gogoproto.nullable) = false]; + bytes Salt = 4; + uint32 TTL = 5; +} + +message GetRangeHashResponse { + repeated bytes Hashes = 1 [(gogoproto.customtype) = "Hash", (gogoproto.nullable) = false]; +} + diff --git a/object/sg.go b/object/sg.go new file mode 100644 index 0000000..1b48b3e --- /dev/null +++ b/object/sg.go @@ -0,0 +1,66 @@ +package object + +import ( + "bytes" + "sort" +) + +// Here are defined getter functions for objects that contain storage group +// information. + +type ( + // IDList is a slice of object ids, that can be sorted. + IDList []ID + + // ZoneInfo provides validation info of storage group. + ZoneInfo struct { + Hash + Size uint64 + } + + // IdentificationInfo provides meta information about storage group. + IdentificationInfo struct { + SGID + CID + OwnerID + } +) + +// Len returns amount of object ids in IDList. +func (s IDList) Len() int { return len(s) } + +// Less returns byte comparision between IDList[i] and IDList[j]. +func (s IDList) Less(i, j int) bool { return bytes.Compare(s[i].Bytes(), s[j].Bytes()) == -1 } + +// Swap swaps element with i and j index in IDList. +func (s IDList) Swap(i, j int) { s[i], s[j] = s[j], s[i] } + +// Group returns slice of object ids that are part of a storage group. +func (m *Object) Group() []ID { + sgLinks := m.Links(Link_StorageGroup) + sort.Sort(IDList(sgLinks)) + return sgLinks +} + +// Zones returns validation zones of storage group. +func (m *Object) Zones() []ZoneInfo { + sgInfo, err := m.StorageGroup() + if err != nil { + return nil + } + return []ZoneInfo{ + { + Hash: sgInfo.ValidationHash, + Size: sgInfo.ValidationDataSize, + }, + } +} + +// IDInfo returns meta information about storage group. +func (m *Object) IDInfo() *IdentificationInfo { + return &IdentificationInfo{ + SGID: m.SystemHeader.ID, + CID: m.SystemHeader.CID, + OwnerID: m.SystemHeader.OwnerID, + } +} diff --git a/object/sg_test.go b/object/sg_test.go new file mode 100644 index 0000000..58e2042 --- /dev/null +++ b/object/sg_test.go @@ -0,0 +1,87 @@ +package object + +import ( + "math/rand" + "sort" + "testing" + + "github.com/nspcc-dev/neofs-proto/hash" + "github.com/stretchr/testify/require" +) + +func TestObject_StorageGroup(t *testing.T) { + t.Run("group method", func(t *testing.T) { + var linkCount byte = 100 + + obj := &Object{Headers: make([]Header, 0, linkCount)} + require.Empty(t, obj.Group()) + + idList := make([]ID, linkCount) + for i := byte(0); i < linkCount; i++ { + idList[i] = ID{i} + obj.Headers = append(obj.Headers, Header{ + Value: &Header_Link{Link: &Link{ + Type: Link_StorageGroup, + ID: idList[i], + }}, + }) + } + + rand.Shuffle(len(obj.Headers), func(i, j int) { obj.Headers[i], obj.Headers[j] = obj.Headers[j], obj.Headers[i] }) + sort.Sort(IDList(idList)) + require.Equal(t, idList, obj.Group()) + }) + t.Run("identification method", func(t *testing.T) { + oid, cid, owner := ID{1}, CID{2}, OwnerID{3} + obj := &Object{ + SystemHeader: SystemHeader{ + ID: oid, + OwnerID: owner, + CID: cid, + }, + } + + idInfo := obj.IDInfo() + require.Equal(t, oid, idInfo.SGID) + require.Equal(t, cid, idInfo.CID) + require.Equal(t, owner, idInfo.OwnerID) + }) + t.Run("zones method", func(t *testing.T) { + sgSize := uint64(100) + + d := make([]byte, sgSize) + _, err := rand.Read(d) + require.NoError(t, err) + sgHash := hash.Sum(d) + + obj := &Object{ + Headers: []Header{ + { + Value: &Header_StorageGroup{ + StorageGroup: &StorageGroup{ + ValidationDataSize: sgSize, + ValidationHash: sgHash, + }, + }, + }, + }, + } + + var ( + sumSize uint64 + zones = obj.Zones() + hashes = make([]Hash, len(zones)) + ) + + for i := range zones { + sumSize += zones[i].Size + hashes[i] = zones[i].Hash + } + + sumHash, err := hash.Concat(hashes) + require.NoError(t, err) + + require.Equal(t, sgSize, sumSize) + require.Equal(t, sgHash, sumHash) + }) +} diff --git a/object/types.go b/object/types.go new file mode 100644 index 0000000..f433b9c --- /dev/null +++ b/object/types.go @@ -0,0 +1,219 @@ +package object + +import ( + "bytes" + "context" + + "github.com/gogo/protobuf/proto" + "github.com/nspcc-dev/neofs-proto/internal" + "github.com/nspcc-dev/neofs-proto/refs" + "github.com/nspcc-dev/neofs-proto/session" +) + +type ( + // Pred defines a predicate function that can check if passed header + // satisfies predicate condition. It is used to find headers of + // specific type. + Pred = func(*Header) bool + + // Address is a type alias of object Address. + Address = refs.Address + + // VerificationHeader is a type alias of session's verification header. + VerificationHeader = session.VerificationHeader + + // PositionReader defines object reader that returns slice of bytes + // for specified object and data range. + PositionReader interface { + PRead(ctx context.Context, addr refs.Address, rng Range) ([]byte, error) + } + + headerType int +) + +const ( + // ErrVerifyPayload is raised when payload checksum cannot be verified. + ErrVerifyPayload = internal.Error("can't verify payload") + + // ErrVerifyHeader is raised when object integrity cannot be verified. + ErrVerifyHeader = internal.Error("can't verify header") + + // ErrHeaderNotFound is raised when requested header not found. + ErrHeaderNotFound = internal.Error("header not found") + + // ErrVerifySignature is raised when signature cannot be verified. + ErrVerifySignature = internal.Error("can't verify signature") +) + +const ( + _ headerType = iota + // LinkHdr is a link header type. + LinkHdr + // RedirectHdr is a redirect header type. + RedirectHdr + // UserHdr is a user defined header type. + UserHdr + // TransformHdr is a transformation header type. + TransformHdr + // TombstoneHdr is a tombstone header type. + TombstoneHdr + // VerifyHdr is a verification header type. + VerifyHdr + // HomoHashHdr is a homomorphic hash header type. + HomoHashHdr + // PayloadChecksumHdr is a payload checksum header type. + PayloadChecksumHdr + // IntegrityHdr is a integrity header type. + IntegrityHdr + // StorageGroupHdr is a storage group header type. + StorageGroupHdr +) + +var ( + _ internal.Custom = (*Object)(nil) + + emptyObject = new(Object).Bytes() +) + +// Bytes returns marshaled object in a binary format. +func (m Object) Bytes() []byte { data, _ := m.Marshal(); return data } + +// Empty checks if object does not contain any information. +func (m Object) Empty() bool { return bytes.Equal(m.Bytes(), emptyObject) } + +// LastHeader returns last header of the specified type. Type must be +// specified as a Pred function. +func (m Object) LastHeader(f Pred) (int, *Header) { + for i := len(m.Headers) - 1; i >= 0; i-- { + if f != nil && f(&m.Headers[i]) { + return i, &m.Headers[i] + } + } + return -1, nil +} + +// AddHeader adds passed header to the end of extended header list. +func (m *Object) AddHeader(h *Header) { + m.Headers = append(m.Headers, *h) +} + +// SetPayload sets payload field and payload length in the system header. +func (m *Object) SetPayload(payload []byte) { + m.Payload = payload + m.SystemHeader.PayloadLength = uint64(len(payload)) +} + +// SetHeader replaces existing extended header or adds new one to the end of +// extended header list. +func (m *Object) SetHeader(h *Header) { + // looking for the header of that type + for i := range m.Headers { + if m.Headers[i].typeOf(h.Value) { + // if we found one - set it with new value and return + m.Headers[i] = *h + return + } + } + // if we did not find one - add this header + m.AddHeader(h) +} + +func (m Header) typeOf(t isHeader_Value) (ok bool) { + switch t.(type) { + case *Header_Link: + _, ok = m.Value.(*Header_Link) + case *Header_Redirect: + _, ok = m.Value.(*Header_Redirect) + case *Header_UserHeader: + _, ok = m.Value.(*Header_UserHeader) + case *Header_Transform: + _, ok = m.Value.(*Header_Transform) + case *Header_Tombstone: + _, ok = m.Value.(*Header_Tombstone) + case *Header_Verify: + _, ok = m.Value.(*Header_Verify) + case *Header_HomoHash: + _, ok = m.Value.(*Header_HomoHash) + case *Header_PayloadChecksum: + _, ok = m.Value.(*Header_PayloadChecksum) + case *Header_Integrity: + _, ok = m.Value.(*Header_Integrity) + case *Header_StorageGroup: + _, ok = m.Value.(*Header_StorageGroup) + } + return +} + +// HeaderType returns predicate that check if extended header is a header +// of specified type. +func HeaderType(t headerType) Pred { + switch t { + case LinkHdr: + return func(h *Header) bool { _, ok := h.Value.(*Header_Link); return ok } + case RedirectHdr: + return func(h *Header) bool { _, ok := h.Value.(*Header_Redirect); return ok } + case UserHdr: + return func(h *Header) bool { _, ok := h.Value.(*Header_UserHeader); return ok } + case TransformHdr: + return func(h *Header) bool { _, ok := h.Value.(*Header_Transform); return ok } + case TombstoneHdr: + return func(h *Header) bool { _, ok := h.Value.(*Header_Tombstone); return ok } + case VerifyHdr: + return func(h *Header) bool { _, ok := h.Value.(*Header_Verify); return ok } + case HomoHashHdr: + return func(h *Header) bool { _, ok := h.Value.(*Header_HomoHash); return ok } + case PayloadChecksumHdr: + return func(h *Header) bool { _, ok := h.Value.(*Header_PayloadChecksum); return ok } + case IntegrityHdr: + return func(h *Header) bool { _, ok := h.Value.(*Header_Integrity); return ok } + case StorageGroupHdr: + return func(h *Header) bool { _, ok := h.Value.(*Header_StorageGroup); return ok } + default: + return nil + } +} + +// Copy creates full copy of the object. +func (m *Object) Copy() (obj *Object) { + obj = new(Object) + m.CopyTo(obj) + return +} + +// CopyTo creates fills passed object with the data from the current object. +// This function creates copies on every available data slice. +func (m *Object) CopyTo(o *Object) { + o.SystemHeader = m.SystemHeader + o.Headers = make([]Header, len(m.Headers)) + o.Payload = make([]byte, len(m.Payload)) + + for i := range m.Headers { + switch v := m.Headers[i].Value.(type) { + case *Header_Link: + link := *v.Link + o.Headers[i] = Header{ + Value: &Header_Link{ + Link: &link, + }, + } + case *Header_HomoHash: + o.Headers[i] = Header{ + Value: &Header_HomoHash{ + HomoHash: v.HomoHash, + }, + } + default: + o.Headers[i] = *proto.Clone(&m.Headers[i]).(*Header) + } + } + + copy(o.Payload, m.Payload) +} + +// Address returns object's address. +func (m Object) Address() *refs.Address { + return &refs.Address{ + ObjectID: m.SystemHeader.ID, + CID: m.SystemHeader.CID, + } +} diff --git a/object/types.pb.go b/object/types.pb.go new file mode 100644 index 0000000..99b6c90 --- /dev/null +++ b/object/types.pb.go @@ -0,0 +1,3814 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: object/types.proto + +package object + +import ( + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/golang/protobuf/proto" + refs "github.com/nspcc-dev/neofs-proto/refs" + session "github.com/nspcc-dev/neofs-proto/session" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package + +type Link_Type int32 + +const ( + Link_Unknown Link_Type = 0 + Link_Parent Link_Type = 1 + Link_Previous Link_Type = 2 + Link_Next Link_Type = 3 + Link_Child Link_Type = 4 + Link_StorageGroup Link_Type = 5 +) + +var Link_Type_name = map[int32]string{ + 0: "Unknown", + 1: "Parent", + 2: "Previous", + 3: "Next", + 4: "Child", + 5: "StorageGroup", +} + +var Link_Type_value = map[string]int32{ + "Unknown": 0, + "Parent": 1, + "Previous": 2, + "Next": 3, + "Child": 4, + "StorageGroup": 5, +} + +func (x Link_Type) String() string { + return proto.EnumName(Link_Type_name, int32(x)) +} + +func (Link_Type) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_02021a1d39b1aee0, []int{7, 0} +} + +type Transform_Type int32 + +const ( + Transform_Unknown Transform_Type = 0 + Transform_Split Transform_Type = 1 + Transform_Sign Transform_Type = 2 + Transform_Mould Transform_Type = 3 +) + +var Transform_Type_name = map[int32]string{ + 0: "Unknown", + 1: "Split", + 2: "Sign", + 3: "Mould", +} + +var Transform_Type_value = map[string]int32{ + "Unknown": 0, + "Split": 1, + "Sign": 2, + "Mould": 3, +} + +func (x Transform_Type) String() string { + return proto.EnumName(Transform_Type_name, int32(x)) +} + +func (Transform_Type) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_02021a1d39b1aee0, []int{8, 0} +} + +type StorageGroup_Lifetime_Unit int32 + +const ( + StorageGroup_Lifetime_Unlimited StorageGroup_Lifetime_Unit = 0 + StorageGroup_Lifetime_NeoFSEpoch StorageGroup_Lifetime_Unit = 1 + StorageGroup_Lifetime_UnixTime StorageGroup_Lifetime_Unit = 2 +) + +var StorageGroup_Lifetime_Unit_name = map[int32]string{ + 0: "Unlimited", + 1: "NeoFSEpoch", + 2: "UnixTime", +} + +var StorageGroup_Lifetime_Unit_value = map[string]int32{ + "Unlimited": 0, + "NeoFSEpoch": 1, + "UnixTime": 2, +} + +func (x StorageGroup_Lifetime_Unit) String() string { + return proto.EnumName(StorageGroup_Lifetime_Unit_name, int32(x)) +} + +func (StorageGroup_Lifetime_Unit) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_02021a1d39b1aee0, []int{10, 0, 0} +} + +type Range struct { + Offset uint64 `protobuf:"varint,1,opt,name=Offset,proto3" json:"Offset,omitempty"` + Length uint64 `protobuf:"varint,2,opt,name=Length,proto3" json:"Length,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Range) Reset() { *m = Range{} } +func (m *Range) String() string { return proto.CompactTextString(m) } +func (*Range) ProtoMessage() {} +func (*Range) Descriptor() ([]byte, []int) { + return fileDescriptor_02021a1d39b1aee0, []int{0} +} +func (m *Range) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Range) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *Range) XXX_Merge(src proto.Message) { + xxx_messageInfo_Range.Merge(m, src) +} +func (m *Range) XXX_Size() int { + return m.Size() +} +func (m *Range) XXX_DiscardUnknown() { + xxx_messageInfo_Range.DiscardUnknown(m) +} + +var xxx_messageInfo_Range proto.InternalMessageInfo + +func (m *Range) GetOffset() uint64 { + if m != nil { + return m.Offset + } + return 0 +} + +func (m *Range) GetLength() uint64 { + if m != nil { + return m.Length + } + return 0 +} + +type UserHeader struct { + Key string `protobuf:"bytes,1,opt,name=Key,proto3" json:"Key,omitempty"` + Value string `protobuf:"bytes,2,opt,name=Value,proto3" json:"Value,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *UserHeader) Reset() { *m = UserHeader{} } +func (m *UserHeader) String() string { return proto.CompactTextString(m) } +func (*UserHeader) ProtoMessage() {} +func (*UserHeader) Descriptor() ([]byte, []int) { + return fileDescriptor_02021a1d39b1aee0, []int{1} +} +func (m *UserHeader) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *UserHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *UserHeader) XXX_Merge(src proto.Message) { + xxx_messageInfo_UserHeader.Merge(m, src) +} +func (m *UserHeader) XXX_Size() int { + return m.Size() +} +func (m *UserHeader) XXX_DiscardUnknown() { + xxx_messageInfo_UserHeader.DiscardUnknown(m) +} + +var xxx_messageInfo_UserHeader proto.InternalMessageInfo + +func (m *UserHeader) GetKey() string { + if m != nil { + return m.Key + } + return "" +} + +func (m *UserHeader) GetValue() string { + if m != nil { + return m.Value + } + return "" +} + +type Header struct { + // Types that are valid to be assigned to Value: + // *Header_Link + // *Header_Redirect + // *Header_UserHeader + // *Header_Transform + // *Header_Tombstone + // *Header_Verify + // *Header_HomoHash + // *Header_PayloadChecksum + // *Header_Integrity + // *Header_StorageGroup + Value isHeader_Value `protobuf_oneof:"Value"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Header) Reset() { *m = Header{} } +func (m *Header) String() string { return proto.CompactTextString(m) } +func (*Header) ProtoMessage() {} +func (*Header) Descriptor() ([]byte, []int) { + return fileDescriptor_02021a1d39b1aee0, []int{2} +} +func (m *Header) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Header) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *Header) XXX_Merge(src proto.Message) { + xxx_messageInfo_Header.Merge(m, src) +} +func (m *Header) XXX_Size() int { + return m.Size() +} +func (m *Header) XXX_DiscardUnknown() { + xxx_messageInfo_Header.DiscardUnknown(m) +} + +var xxx_messageInfo_Header proto.InternalMessageInfo + +type isHeader_Value interface { + isHeader_Value() + MarshalTo([]byte) (int, error) + Size() int +} + +type Header_Link struct { + Link *Link `protobuf:"bytes,1,opt,name=Link,proto3,oneof" json:"Link,omitempty"` +} +type Header_Redirect struct { + Redirect *refs.Address `protobuf:"bytes,2,opt,name=Redirect,proto3,oneof" json:"Redirect,omitempty"` +} +type Header_UserHeader struct { + UserHeader *UserHeader `protobuf:"bytes,3,opt,name=UserHeader,proto3,oneof" json:"UserHeader,omitempty"` +} +type Header_Transform struct { + Transform *Transform `protobuf:"bytes,4,opt,name=Transform,proto3,oneof" json:"Transform,omitempty"` +} +type Header_Tombstone struct { + Tombstone *Tombstone `protobuf:"bytes,5,opt,name=Tombstone,proto3,oneof" json:"Tombstone,omitempty"` +} +type Header_Verify struct { + Verify *session.VerificationHeader `protobuf:"bytes,6,opt,name=Verify,proto3,oneof" json:"Verify,omitempty"` +} +type Header_HomoHash struct { + HomoHash Hash `protobuf:"bytes,7,opt,name=HomoHash,proto3,oneof,customtype=Hash" json:"HomoHash,omitempty"` +} +type Header_PayloadChecksum struct { + PayloadChecksum []byte `protobuf:"bytes,8,opt,name=PayloadChecksum,proto3,oneof" json:"PayloadChecksum,omitempty"` +} +type Header_Integrity struct { + Integrity *IntegrityHeader `protobuf:"bytes,9,opt,name=Integrity,proto3,oneof" json:"Integrity,omitempty"` +} +type Header_StorageGroup struct { + StorageGroup *StorageGroup `protobuf:"bytes,10,opt,name=StorageGroup,proto3,oneof" json:"StorageGroup,omitempty"` +} + +func (*Header_Link) isHeader_Value() {} +func (*Header_Redirect) isHeader_Value() {} +func (*Header_UserHeader) isHeader_Value() {} +func (*Header_Transform) isHeader_Value() {} +func (*Header_Tombstone) isHeader_Value() {} +func (*Header_Verify) isHeader_Value() {} +func (*Header_HomoHash) isHeader_Value() {} +func (*Header_PayloadChecksum) isHeader_Value() {} +func (*Header_Integrity) isHeader_Value() {} +func (*Header_StorageGroup) isHeader_Value() {} + +func (m *Header) GetValue() isHeader_Value { + if m != nil { + return m.Value + } + return nil +} + +func (m *Header) GetLink() *Link { + if x, ok := m.GetValue().(*Header_Link); ok { + return x.Link + } + return nil +} + +func (m *Header) GetRedirect() *refs.Address { + if x, ok := m.GetValue().(*Header_Redirect); ok { + return x.Redirect + } + return nil +} + +func (m *Header) GetUserHeader() *UserHeader { + if x, ok := m.GetValue().(*Header_UserHeader); ok { + return x.UserHeader + } + return nil +} + +func (m *Header) GetTransform() *Transform { + if x, ok := m.GetValue().(*Header_Transform); ok { + return x.Transform + } + return nil +} + +func (m *Header) GetTombstone() *Tombstone { + if x, ok := m.GetValue().(*Header_Tombstone); ok { + return x.Tombstone + } + return nil +} + +func (m *Header) GetVerify() *session.VerificationHeader { + if x, ok := m.GetValue().(*Header_Verify); ok { + return x.Verify + } + return nil +} + +func (m *Header) GetPayloadChecksum() []byte { + if x, ok := m.GetValue().(*Header_PayloadChecksum); ok { + return x.PayloadChecksum + } + return nil +} + +func (m *Header) GetIntegrity() *IntegrityHeader { + if x, ok := m.GetValue().(*Header_Integrity); ok { + return x.Integrity + } + return nil +} + +func (m *Header) GetStorageGroup() *StorageGroup { + if x, ok := m.GetValue().(*Header_StorageGroup); ok { + return x.StorageGroup + } + return nil +} + +// XXX_OneofWrappers is for the internal use of the proto package. +func (*Header) XXX_OneofWrappers() []interface{} { + return []interface{}{ + (*Header_Link)(nil), + (*Header_Redirect)(nil), + (*Header_UserHeader)(nil), + (*Header_Transform)(nil), + (*Header_Tombstone)(nil), + (*Header_Verify)(nil), + (*Header_HomoHash)(nil), + (*Header_PayloadChecksum)(nil), + (*Header_Integrity)(nil), + (*Header_StorageGroup)(nil), + } +} + +type Tombstone struct { + Epoch uint64 `protobuf:"varint,1,opt,name=Epoch,proto3" json:"Epoch,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Tombstone) Reset() { *m = Tombstone{} } +func (m *Tombstone) String() string { return proto.CompactTextString(m) } +func (*Tombstone) ProtoMessage() {} +func (*Tombstone) Descriptor() ([]byte, []int) { + return fileDescriptor_02021a1d39b1aee0, []int{3} +} +func (m *Tombstone) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Tombstone) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *Tombstone) XXX_Merge(src proto.Message) { + xxx_messageInfo_Tombstone.Merge(m, src) +} +func (m *Tombstone) XXX_Size() int { + return m.Size() +} +func (m *Tombstone) XXX_DiscardUnknown() { + xxx_messageInfo_Tombstone.DiscardUnknown(m) +} + +var xxx_messageInfo_Tombstone proto.InternalMessageInfo + +func (m *Tombstone) GetEpoch() uint64 { + if m != nil { + return m.Epoch + } + return 0 +} + +type SystemHeader struct { + Version uint64 `protobuf:"varint,1,opt,name=Version,proto3" json:"Version,omitempty"` + PayloadLength uint64 `protobuf:"varint,2,opt,name=PayloadLength,proto3" json:"PayloadLength,omitempty"` + ID ID `protobuf:"bytes,3,opt,name=ID,proto3,customtype=ID" json:"ID"` + OwnerID OwnerID `protobuf:"bytes,4,opt,name=OwnerID,proto3,customtype=OwnerID" json:"OwnerID"` + CID CID `protobuf:"bytes,5,opt,name=CID,proto3,customtype=CID" json:"CID"` + CreatedAt CreationPoint `protobuf:"bytes,6,opt,name=CreatedAt,proto3" json:"CreatedAt"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SystemHeader) Reset() { *m = SystemHeader{} } +func (m *SystemHeader) String() string { return proto.CompactTextString(m) } +func (*SystemHeader) ProtoMessage() {} +func (*SystemHeader) Descriptor() ([]byte, []int) { + return fileDescriptor_02021a1d39b1aee0, []int{4} +} +func (m *SystemHeader) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *SystemHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *SystemHeader) XXX_Merge(src proto.Message) { + xxx_messageInfo_SystemHeader.Merge(m, src) +} +func (m *SystemHeader) XXX_Size() int { + return m.Size() +} +func (m *SystemHeader) XXX_DiscardUnknown() { + xxx_messageInfo_SystemHeader.DiscardUnknown(m) +} + +var xxx_messageInfo_SystemHeader proto.InternalMessageInfo + +func (m *SystemHeader) GetVersion() uint64 { + if m != nil { + return m.Version + } + return 0 +} + +func (m *SystemHeader) GetPayloadLength() uint64 { + if m != nil { + return m.PayloadLength + } + return 0 +} + +func (m *SystemHeader) GetCreatedAt() CreationPoint { + if m != nil { + return m.CreatedAt + } + return CreationPoint{} +} + +type CreationPoint struct { + UnixTime int64 `protobuf:"varint,1,opt,name=UnixTime,proto3" json:"UnixTime,omitempty"` + Epoch uint64 `protobuf:"varint,2,opt,name=Epoch,proto3" json:"Epoch,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *CreationPoint) Reset() { *m = CreationPoint{} } +func (m *CreationPoint) String() string { return proto.CompactTextString(m) } +func (*CreationPoint) ProtoMessage() {} +func (*CreationPoint) Descriptor() ([]byte, []int) { + return fileDescriptor_02021a1d39b1aee0, []int{5} +} +func (m *CreationPoint) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *CreationPoint) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *CreationPoint) XXX_Merge(src proto.Message) { + xxx_messageInfo_CreationPoint.Merge(m, src) +} +func (m *CreationPoint) XXX_Size() int { + return m.Size() +} +func (m *CreationPoint) XXX_DiscardUnknown() { + xxx_messageInfo_CreationPoint.DiscardUnknown(m) +} + +var xxx_messageInfo_CreationPoint proto.InternalMessageInfo + +func (m *CreationPoint) GetUnixTime() int64 { + if m != nil { + return m.UnixTime + } + return 0 +} + +func (m *CreationPoint) GetEpoch() uint64 { + if m != nil { + return m.Epoch + } + return 0 +} + +type IntegrityHeader struct { + HeadersChecksum []byte `protobuf:"bytes,1,opt,name=HeadersChecksum,proto3" json:"HeadersChecksum,omitempty"` + ChecksumSignature []byte `protobuf:"bytes,2,opt,name=ChecksumSignature,proto3" json:"ChecksumSignature,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *IntegrityHeader) Reset() { *m = IntegrityHeader{} } +func (m *IntegrityHeader) String() string { return proto.CompactTextString(m) } +func (*IntegrityHeader) ProtoMessage() {} +func (*IntegrityHeader) Descriptor() ([]byte, []int) { + return fileDescriptor_02021a1d39b1aee0, []int{6} +} +func (m *IntegrityHeader) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *IntegrityHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *IntegrityHeader) XXX_Merge(src proto.Message) { + xxx_messageInfo_IntegrityHeader.Merge(m, src) +} +func (m *IntegrityHeader) XXX_Size() int { + return m.Size() +} +func (m *IntegrityHeader) XXX_DiscardUnknown() { + xxx_messageInfo_IntegrityHeader.DiscardUnknown(m) +} + +var xxx_messageInfo_IntegrityHeader proto.InternalMessageInfo + +func (m *IntegrityHeader) GetHeadersChecksum() []byte { + if m != nil { + return m.HeadersChecksum + } + return nil +} + +func (m *IntegrityHeader) GetChecksumSignature() []byte { + if m != nil { + return m.ChecksumSignature + } + return nil +} + +type Link struct { + Type Link_Type `protobuf:"varint,1,opt,name=type,proto3,enum=object.Link_Type" json:"type,omitempty"` + ID ID `protobuf:"bytes,2,opt,name=ID,proto3,customtype=ID" json:"ID"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Link) Reset() { *m = Link{} } +func (m *Link) String() string { return proto.CompactTextString(m) } +func (*Link) ProtoMessage() {} +func (*Link) Descriptor() ([]byte, []int) { + return fileDescriptor_02021a1d39b1aee0, []int{7} +} +func (m *Link) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Link) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *Link) XXX_Merge(src proto.Message) { + xxx_messageInfo_Link.Merge(m, src) +} +func (m *Link) XXX_Size() int { + return m.Size() +} +func (m *Link) XXX_DiscardUnknown() { + xxx_messageInfo_Link.DiscardUnknown(m) +} + +var xxx_messageInfo_Link proto.InternalMessageInfo + +func (m *Link) GetType() Link_Type { + if m != nil { + return m.Type + } + return Link_Unknown +} + +type Transform struct { + Type Transform_Type `protobuf:"varint,1,opt,name=type,proto3,enum=object.Transform_Type" json:"type,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Transform) Reset() { *m = Transform{} } +func (m *Transform) String() string { return proto.CompactTextString(m) } +func (*Transform) ProtoMessage() {} +func (*Transform) Descriptor() ([]byte, []int) { + return fileDescriptor_02021a1d39b1aee0, []int{8} +} +func (m *Transform) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Transform) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *Transform) XXX_Merge(src proto.Message) { + xxx_messageInfo_Transform.Merge(m, src) +} +func (m *Transform) XXX_Size() int { + return m.Size() +} +func (m *Transform) XXX_DiscardUnknown() { + xxx_messageInfo_Transform.DiscardUnknown(m) +} + +var xxx_messageInfo_Transform proto.InternalMessageInfo + +func (m *Transform) GetType() Transform_Type { + if m != nil { + return m.Type + } + return Transform_Unknown +} + +type Object struct { + SystemHeader SystemHeader `protobuf:"bytes,1,opt,name=SystemHeader,proto3" json:"SystemHeader"` + Headers []Header `protobuf:"bytes,2,rep,name=Headers,proto3" json:"Headers"` + Payload []byte `protobuf:"bytes,3,opt,name=Payload,proto3" json:"Payload,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Object) Reset() { *m = Object{} } +func (m *Object) String() string { return proto.CompactTextString(m) } +func (*Object) ProtoMessage() {} +func (*Object) Descriptor() ([]byte, []int) { + return fileDescriptor_02021a1d39b1aee0, []int{9} +} +func (m *Object) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Object) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *Object) XXX_Merge(src proto.Message) { + xxx_messageInfo_Object.Merge(m, src) +} +func (m *Object) XXX_Size() int { + return m.Size() +} +func (m *Object) XXX_DiscardUnknown() { + xxx_messageInfo_Object.DiscardUnknown(m) +} + +var xxx_messageInfo_Object proto.InternalMessageInfo + +func (m *Object) GetSystemHeader() SystemHeader { + if m != nil { + return m.SystemHeader + } + return SystemHeader{} +} + +func (m *Object) GetHeaders() []Header { + if m != nil { + return m.Headers + } + return nil +} + +func (m *Object) GetPayload() []byte { + if m != nil { + return m.Payload + } + return nil +} + +type StorageGroup struct { + ValidationDataSize uint64 `protobuf:"varint,1,opt,name=ValidationDataSize,proto3" json:"ValidationDataSize,omitempty"` + ValidationHash Hash `protobuf:"bytes,2,opt,name=ValidationHash,proto3,customtype=Hash" json:"ValidationHash"` + Lifetime *StorageGroup_Lifetime `protobuf:"bytes,3,opt,name=lifetime,proto3" json:"lifetime,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *StorageGroup) Reset() { *m = StorageGroup{} } +func (m *StorageGroup) String() string { return proto.CompactTextString(m) } +func (*StorageGroup) ProtoMessage() {} +func (*StorageGroup) Descriptor() ([]byte, []int) { + return fileDescriptor_02021a1d39b1aee0, []int{10} +} +func (m *StorageGroup) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *StorageGroup) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *StorageGroup) XXX_Merge(src proto.Message) { + xxx_messageInfo_StorageGroup.Merge(m, src) +} +func (m *StorageGroup) XXX_Size() int { + return m.Size() +} +func (m *StorageGroup) XXX_DiscardUnknown() { + xxx_messageInfo_StorageGroup.DiscardUnknown(m) +} + +var xxx_messageInfo_StorageGroup proto.InternalMessageInfo + +func (m *StorageGroup) GetValidationDataSize() uint64 { + if m != nil { + return m.ValidationDataSize + } + return 0 +} + +func (m *StorageGroup) GetLifetime() *StorageGroup_Lifetime { + if m != nil { + return m.Lifetime + } + return nil +} + +type StorageGroup_Lifetime struct { + Unit StorageGroup_Lifetime_Unit `protobuf:"varint,1,opt,name=unit,proto3,enum=object.StorageGroup_Lifetime_Unit" json:"unit,omitempty"` + Value int64 `protobuf:"varint,2,opt,name=Value,proto3" json:"Value,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *StorageGroup_Lifetime) Reset() { *m = StorageGroup_Lifetime{} } +func (m *StorageGroup_Lifetime) String() string { return proto.CompactTextString(m) } +func (*StorageGroup_Lifetime) ProtoMessage() {} +func (*StorageGroup_Lifetime) Descriptor() ([]byte, []int) { + return fileDescriptor_02021a1d39b1aee0, []int{10, 0} +} +func (m *StorageGroup_Lifetime) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *StorageGroup_Lifetime) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *StorageGroup_Lifetime) XXX_Merge(src proto.Message) { + xxx_messageInfo_StorageGroup_Lifetime.Merge(m, src) +} +func (m *StorageGroup_Lifetime) XXX_Size() int { + return m.Size() +} +func (m *StorageGroup_Lifetime) XXX_DiscardUnknown() { + xxx_messageInfo_StorageGroup_Lifetime.DiscardUnknown(m) +} + +var xxx_messageInfo_StorageGroup_Lifetime proto.InternalMessageInfo + +func (m *StorageGroup_Lifetime) GetUnit() StorageGroup_Lifetime_Unit { + if m != nil { + return m.Unit + } + return StorageGroup_Lifetime_Unlimited +} + +func (m *StorageGroup_Lifetime) GetValue() int64 { + if m != nil { + return m.Value + } + return 0 +} + +func init() { + proto.RegisterEnum("object.Link_Type", Link_Type_name, Link_Type_value) + proto.RegisterEnum("object.Transform_Type", Transform_Type_name, Transform_Type_value) + proto.RegisterEnum("object.StorageGroup_Lifetime_Unit", StorageGroup_Lifetime_Unit_name, StorageGroup_Lifetime_Unit_value) + proto.RegisterType((*Range)(nil), "object.Range") + proto.RegisterType((*UserHeader)(nil), "object.UserHeader") + proto.RegisterType((*Header)(nil), "object.Header") + proto.RegisterType((*Tombstone)(nil), "object.Tombstone") + proto.RegisterType((*SystemHeader)(nil), "object.SystemHeader") + proto.RegisterType((*CreationPoint)(nil), "object.CreationPoint") + proto.RegisterType((*IntegrityHeader)(nil), "object.IntegrityHeader") + proto.RegisterType((*Link)(nil), "object.Link") + proto.RegisterType((*Transform)(nil), "object.Transform") + proto.RegisterType((*Object)(nil), "object.Object") + proto.RegisterType((*StorageGroup)(nil), "object.StorageGroup") + proto.RegisterType((*StorageGroup_Lifetime)(nil), "object.StorageGroup.Lifetime") +} + +func init() { proto.RegisterFile("object/types.proto", fileDescriptor_02021a1d39b1aee0) } + +var fileDescriptor_02021a1d39b1aee0 = []byte{ + // 996 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x55, 0xdf, 0x6e, 0xe3, 0xc4, + 0x17, 0xb6, 0x1d, 0x27, 0x71, 0x4e, 0xdd, 0xd6, 0x3b, 0xbf, 0xfd, 0x2d, 0x56, 0xd1, 0xb6, 0xc5, + 0xe2, 0x4f, 0x59, 0xa8, 0x2b, 0xda, 0x45, 0x2b, 0x90, 0x40, 0x34, 0x0d, 0x6c, 0x22, 0xca, 0xb6, + 0x9a, 0xb4, 0xbd, 0xe0, 0xce, 0x89, 0x27, 0xc9, 0xd0, 0x64, 0x26, 0xb2, 0x27, 0xbb, 0x1b, 0x1e, + 0x83, 0x1b, 0xb8, 0xe3, 0x75, 0xf6, 0x92, 0x3b, 0xd0, 0x5e, 0x44, 0x28, 0x3c, 0x00, 0x6f, 0x80, + 0xd0, 0x8c, 0xc7, 0x49, 0x9c, 0xad, 0xb8, 0x89, 0xe6, 0x9c, 0xef, 0xfb, 0x46, 0x27, 0xe7, 0x7c, + 0x67, 0x0c, 0x88, 0x77, 0x7e, 0x20, 0x5d, 0x71, 0x24, 0xa6, 0x63, 0x92, 0x86, 0xe3, 0x84, 0x0b, + 0x8e, 0x2a, 0x59, 0x6e, 0xc7, 0x4b, 0x48, 0x2f, 0x5d, 0x45, 0x76, 0xfe, 0x97, 0x92, 0x34, 0xa5, + 0x9c, 0x15, 0x92, 0x87, 0x7d, 0x2a, 0x06, 0x93, 0x4e, 0xd8, 0xe5, 0xa3, 0xa3, 0x3e, 0xef, 0xf3, + 0x23, 0x95, 0xee, 0x4c, 0x7a, 0x2a, 0x52, 0x81, 0x3a, 0x65, 0xf4, 0xe0, 0x09, 0x94, 0x71, 0xc4, + 0xfa, 0x04, 0x3d, 0x80, 0xca, 0x45, 0xaf, 0x97, 0x12, 0xe1, 0x9b, 0xfb, 0xe6, 0x81, 0x8d, 0x75, + 0x24, 0xf3, 0xe7, 0x84, 0xf5, 0xc5, 0xc0, 0xb7, 0xb2, 0x7c, 0x16, 0x05, 0x8f, 0x01, 0xae, 0x53, + 0x92, 0x34, 0x49, 0x14, 0x93, 0x04, 0x79, 0x50, 0xfa, 0x96, 0x4c, 0x95, 0xb4, 0x86, 0xe5, 0x11, + 0xdd, 0x87, 0xf2, 0x4d, 0x34, 0x9c, 0x10, 0x25, 0xab, 0xe1, 0x2c, 0x08, 0xfe, 0x29, 0x41, 0x45, + 0x4b, 0x02, 0xb0, 0xcf, 0x29, 0xbb, 0x55, 0x9a, 0x8d, 0x63, 0x37, 0xcc, 0xfe, 0x66, 0x28, 0x73, + 0x4d, 0x03, 0x2b, 0x0c, 0x7d, 0x04, 0x0e, 0x26, 0x31, 0x4d, 0x48, 0x57, 0xa8, 0x7b, 0x36, 0x8e, + 0x37, 0x43, 0xd9, 0x86, 0xf0, 0x34, 0x8e, 0x13, 0x92, 0xa6, 0x4d, 0x03, 0x2f, 0x08, 0xa8, 0x50, + 0x91, 0x5f, 0x52, 0x74, 0x94, 0x5f, 0xbb, 0x44, 0x9a, 0x06, 0x5e, 0xad, 0xfc, 0x13, 0xa8, 0x5d, + 0x25, 0x11, 0x4b, 0x7b, 0x3c, 0x19, 0xf9, 0xb6, 0x12, 0xdd, 0xcb, 0x45, 0x0b, 0xa0, 0x69, 0xe0, + 0x25, 0x4b, 0x49, 0xf8, 0xa8, 0x93, 0x0a, 0xce, 0x88, 0x5f, 0x5e, 0x93, 0xe4, 0x80, 0x92, 0xe4, + 0x01, 0xfa, 0x14, 0x2a, 0x37, 0x24, 0xa1, 0xbd, 0xa9, 0x5f, 0x51, 0xfc, 0xb7, 0x43, 0x3d, 0xbb, + 0x50, 0xa5, 0x69, 0x37, 0x12, 0x94, 0xb3, 0x45, 0x81, 0x9a, 0x8c, 0xde, 0x07, 0xa7, 0xc9, 0x47, + 0xbc, 0x19, 0xa5, 0x03, 0xbf, 0xba, 0x6f, 0x1e, 0xb8, 0x75, 0xe7, 0xf5, 0x6c, 0xcf, 0x96, 0xb1, + 0xfc, 0xeb, 0x39, 0x86, 0x1e, 0xc1, 0xf6, 0x65, 0x34, 0x1d, 0xf2, 0x28, 0x3e, 0x1b, 0x90, 0xee, + 0x6d, 0x3a, 0x19, 0xf9, 0x8e, 0xa4, 0x37, 0x0d, 0xbc, 0x0e, 0xa0, 0x27, 0x50, 0x6b, 0x31, 0x41, + 0xfa, 0x09, 0x15, 0x53, 0xbf, 0xa6, 0xaa, 0x79, 0x2b, 0xaf, 0x7e, 0x01, 0x2c, 0x2a, 0x59, 0x72, + 0xd1, 0xe7, 0xe0, 0xb6, 0x05, 0x4f, 0xa2, 0x3e, 0x79, 0x9a, 0xf0, 0xc9, 0xd8, 0x07, 0xa5, 0xbd, + 0x9f, 0x6b, 0x57, 0xb1, 0xa6, 0x81, 0x0b, 0xdc, 0x7a, 0x55, 0xbb, 0x21, 0x78, 0x67, 0xa5, 0x77, + 0xd2, 0x23, 0x5f, 0x8f, 0x79, 0x77, 0xa0, 0x2d, 0x97, 0x05, 0xc1, 0xdf, 0x26, 0xb8, 0xed, 0x69, + 0x2a, 0xc8, 0x48, 0x8f, 0xc8, 0x87, 0xea, 0x0d, 0x49, 0x64, 0xb7, 0x34, 0x31, 0x0f, 0xd1, 0xbb, + 0xb0, 0xa9, 0xff, 0x5e, 0xc1, 0xa3, 0xc5, 0x24, 0xda, 0x01, 0xab, 0xd5, 0x50, 0x86, 0x70, 0xeb, + 0xf0, 0x6a, 0xb6, 0x67, 0xbc, 0x9e, 0xed, 0x59, 0xad, 0x06, 0xb6, 0x5a, 0x0d, 0xf4, 0x21, 0x54, + 0x2f, 0x5e, 0x30, 0x92, 0xb4, 0x1a, 0x6a, 0xf8, 0x6e, 0x7d, 0x5b, 0x13, 0xf2, 0x34, 0xce, 0x0f, + 0xe8, 0x21, 0x94, 0xce, 0x5a, 0x0d, 0x35, 0x70, 0xb7, 0xbe, 0xa1, 0x69, 0x32, 0x85, 0xe5, 0x0f, + 0xfa, 0x0c, 0x6a, 0x67, 0x09, 0x89, 0x04, 0x89, 0x4f, 0x85, 0x9e, 0xf2, 0xff, 0xf3, 0xde, 0x28, + 0x80, 0x72, 0x76, 0xc9, 0x29, 0x13, 0x75, 0x5b, 0x6a, 0xf1, 0x92, 0x1d, 0x9c, 0xc2, 0x66, 0x81, + 0x81, 0x76, 0xc0, 0xb9, 0x66, 0xf4, 0xe5, 0x15, 0x1d, 0x11, 0xf5, 0x97, 0x4b, 0x78, 0x11, 0x2f, + 0x9b, 0x66, 0xad, 0x36, 0x8d, 0xc2, 0xf6, 0xda, 0xf0, 0xd0, 0x01, 0x6c, 0x67, 0xa7, 0x74, 0x61, + 0x0a, 0x79, 0x97, 0x8b, 0xd7, 0xd3, 0xe8, 0x63, 0xb8, 0x97, 0x9f, 0xdb, 0xb4, 0xcf, 0x22, 0x31, + 0x49, 0xb2, 0xbd, 0x75, 0xf1, 0x9b, 0x40, 0xf0, 0xab, 0x99, 0x6d, 0x2e, 0x7a, 0x0f, 0x6c, 0xf9, + 0xf2, 0xa8, 0x5b, 0xb7, 0x96, 0x2b, 0x20, 0xb1, 0xf0, 0x6a, 0x3a, 0x26, 0x58, 0xc1, 0xba, 0xfd, + 0xd6, 0x5d, 0xed, 0x0f, 0xae, 0xc0, 0x96, 0x4c, 0xb4, 0x01, 0xd5, 0x6b, 0x76, 0xcb, 0xf8, 0x0b, + 0xe6, 0x19, 0x08, 0xa0, 0x72, 0x19, 0x25, 0x84, 0x09, 0xcf, 0x44, 0x2e, 0x38, 0x97, 0x09, 0x79, + 0x4e, 0xf9, 0x24, 0xf5, 0x2c, 0xe4, 0x80, 0xfd, 0x8c, 0xbc, 0x14, 0x5e, 0x09, 0xd5, 0xa0, 0x7c, + 0x36, 0xa0, 0xc3, 0xd8, 0xb3, 0x91, 0x57, 0xf4, 0xa5, 0x57, 0x0e, 0x86, 0x2b, 0x3b, 0x8d, 0x1e, + 0x15, 0xaa, 0x7c, 0xf0, 0xc6, 0x6e, 0xaf, 0x94, 0x1a, 0x9c, 0xdc, 0x55, 0x4e, 0x0d, 0xca, 0xed, + 0xf1, 0x90, 0xca, 0x6a, 0x1c, 0xb0, 0x65, 0x1f, 0x3c, 0x4b, 0x26, 0xbf, 0xe3, 0x93, 0x61, 0xec, + 0x95, 0x82, 0x9f, 0x4c, 0xa8, 0x5c, 0xa8, 0x4b, 0xd1, 0x97, 0x45, 0xe7, 0xea, 0xb7, 0x6d, 0xb9, + 0x22, 0x2b, 0x98, 0x76, 0x41, 0xd1, 0xe9, 0x21, 0x54, 0xf5, 0x6c, 0x7c, 0x6b, 0xbf, 0x74, 0xb0, + 0x71, 0xbc, 0x95, 0x4b, 0x0b, 0xa2, 0x9c, 0x24, 0x37, 0x43, 0x5b, 0x3d, 0xb3, 0x37, 0xce, 0xc3, + 0xe0, 0x77, 0xab, 0xd8, 0x15, 0x14, 0x02, 0xba, 0x89, 0x86, 0x34, 0x56, 0x2e, 0x6b, 0x44, 0x22, + 0x6a, 0xd3, 0x1f, 0x89, 0xde, 0xa7, 0x3b, 0x10, 0xf4, 0x18, 0xb6, 0x96, 0x59, 0xf5, 0x00, 0x65, + 0x13, 0x74, 0xf5, 0x04, 0xd5, 0x23, 0x84, 0xd7, 0x38, 0xe8, 0x29, 0x38, 0x43, 0xda, 0x23, 0x42, + 0x1a, 0x37, 0x7b, 0x81, 0x1f, 0xde, 0xf5, 0x3e, 0x84, 0xe7, 0x9a, 0x54, 0x77, 0xe7, 0xb3, 0x3d, + 0x27, 0x8f, 0xf0, 0x42, 0xbc, 0xf3, 0xb3, 0x09, 0x8b, 0x34, 0xfa, 0x0a, 0xec, 0x09, 0xa3, 0x42, + 0x8f, 0x30, 0xf8, 0xcf, 0x1b, 0xc3, 0x6b, 0x46, 0x45, 0xdd, 0x99, 0xcf, 0xf6, 0x6c, 0x79, 0xc2, + 0x4a, 0x59, 0xfc, 0x1a, 0x95, 0xf2, 0xaf, 0xd1, 0x09, 0x28, 0x0e, 0xda, 0x84, 0xda, 0x35, 0x1b, + 0xd2, 0x11, 0x15, 0x24, 0xf6, 0x0c, 0xb4, 0x05, 0xf0, 0x8c, 0xf0, 0x6f, 0xda, 0x6a, 0xb3, 0x32, + 0x0f, 0xe6, 0xdb, 0xe7, 0x59, 0xf5, 0x2f, 0x5e, 0xcd, 0x77, 0xcd, 0xdf, 0xe6, 0xbb, 0xe6, 0x1f, + 0xf3, 0x5d, 0xf3, 0xcf, 0xf9, 0xae, 0xf9, 0xcb, 0x5f, 0xbb, 0xc6, 0xf7, 0x1f, 0xac, 0x7c, 0x76, + 0x59, 0x3a, 0xee, 0x76, 0x0f, 0x63, 0xf2, 0xfc, 0x88, 0x11, 0xde, 0x4b, 0x0f, 0xb3, 0x8f, 0x6e, + 0x56, 0x74, 0xa7, 0xa2, 0xa2, 0x93, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, 0xbb, 0x65, 0xf4, 0xeb, + 0xeb, 0x07, 0x00, 0x00, +} + +func (m *Range) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Range) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Range) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.Length != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Length)) + i-- + dAtA[i] = 0x10 + } + if m.Offset != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Offset)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *UserHeader) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *UserHeader) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *UserHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Value) > 0 { + i -= len(m.Value) + copy(dAtA[i:], m.Value) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Value))) + i-- + dAtA[i] = 0x12 + } + if len(m.Key) > 0 { + i -= len(m.Key) + copy(dAtA[i:], m.Key) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Key))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Header) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Header) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Header) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.Value != nil { + { + size := m.Value.Size() + i -= size + if _, err := m.Value.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + } + } + return len(dAtA) - i, nil +} + +func (m *Header_Link) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Header_Link) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.Link != nil { + { + size, err := m.Link.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} +func (m *Header_Redirect) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Header_Redirect) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.Redirect != nil { + { + size, err := m.Redirect.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + return len(dAtA) - i, nil +} +func (m *Header_UserHeader) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Header_UserHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.UserHeader != nil { + { + size, err := m.UserHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + return len(dAtA) - i, nil +} +func (m *Header_Transform) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Header_Transform) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.Transform != nil { + { + size, err := m.Transform.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + return len(dAtA) - i, nil +} +func (m *Header_Tombstone) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Header_Tombstone) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.Tombstone != nil { + { + size, err := m.Tombstone.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + } + return len(dAtA) - i, nil +} +func (m *Header_Verify) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Header_Verify) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.Verify != nil { + { + size, err := m.Verify.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + } + return len(dAtA) - i, nil +} +func (m *Header_HomoHash) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Header_HomoHash) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + { + size := m.HomoHash.Size() + i -= size + if _, err := m.HomoHash.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3a + return len(dAtA) - i, nil +} +func (m *Header_PayloadChecksum) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Header_PayloadChecksum) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.PayloadChecksum != nil { + i -= len(m.PayloadChecksum) + copy(dAtA[i:], m.PayloadChecksum) + i = encodeVarintTypes(dAtA, i, uint64(len(m.PayloadChecksum))) + i-- + dAtA[i] = 0x42 + } + return len(dAtA) - i, nil +} +func (m *Header_Integrity) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Header_Integrity) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.Integrity != nil { + { + size, err := m.Integrity.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x4a + } + return len(dAtA) - i, nil +} +func (m *Header_StorageGroup) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Header_StorageGroup) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.StorageGroup != nil { + { + size, err := m.StorageGroup.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x52 + } + return len(dAtA) - i, nil +} +func (m *Tombstone) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Tombstone) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Tombstone) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.Epoch != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Epoch)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *SystemHeader) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *SystemHeader) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *SystemHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + { + size, err := m.CreatedAt.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + { + size := m.CID.Size() + i -= size + if _, err := m.CID.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + { + size := m.OwnerID.Size() + i -= size + if _, err := m.OwnerID.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + { + size := m.ID.Size() + i -= size + if _, err := m.ID.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + if m.PayloadLength != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.PayloadLength)) + i-- + dAtA[i] = 0x10 + } + if m.Version != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Version)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *CreationPoint) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *CreationPoint) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *CreationPoint) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.Epoch != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Epoch)) + i-- + dAtA[i] = 0x10 + } + if m.UnixTime != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.UnixTime)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *IntegrityHeader) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *IntegrityHeader) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *IntegrityHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.ChecksumSignature) > 0 { + i -= len(m.ChecksumSignature) + copy(dAtA[i:], m.ChecksumSignature) + i = encodeVarintTypes(dAtA, i, uint64(len(m.ChecksumSignature))) + i-- + dAtA[i] = 0x12 + } + if len(m.HeadersChecksum) > 0 { + i -= len(m.HeadersChecksum) + copy(dAtA[i:], m.HeadersChecksum) + i = encodeVarintTypes(dAtA, i, uint64(len(m.HeadersChecksum))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Link) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Link) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Link) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + { + size := m.ID.Size() + i -= size + if _, err := m.ID.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if m.Type != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Type)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *Transform) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Transform) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Transform) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.Type != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Type)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *Object) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Object) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Object) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Payload) > 0 { + i -= len(m.Payload) + copy(dAtA[i:], m.Payload) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Payload))) + i-- + dAtA[i] = 0x1a + } + if len(m.Headers) > 0 { + for iNdEx := len(m.Headers) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Headers[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + { + size, err := m.SystemHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *StorageGroup) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *StorageGroup) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *StorageGroup) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.Lifetime != nil { + { + size, err := m.Lifetime.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + { + size := m.ValidationHash.Size() + i -= size + if _, err := m.ValidationHash.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if m.ValidationDataSize != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.ValidationDataSize)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *StorageGroup_Lifetime) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *StorageGroup_Lifetime) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *StorageGroup_Lifetime) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.Value != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Value)) + i-- + dAtA[i] = 0x10 + } + if m.Unit != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Unit)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func encodeVarintTypes(dAtA []byte, offset int, v uint64) int { + offset -= sovTypes(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Range) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Offset != 0 { + n += 1 + sovTypes(uint64(m.Offset)) + } + if m.Length != 0 { + n += 1 + sovTypes(uint64(m.Length)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *UserHeader) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Key) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.Value) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *Header) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Value != nil { + n += m.Value.Size() + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *Header_Link) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Link != nil { + l = m.Link.Size() + n += 1 + l + sovTypes(uint64(l)) + } + return n +} +func (m *Header_Redirect) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Redirect != nil { + l = m.Redirect.Size() + n += 1 + l + sovTypes(uint64(l)) + } + return n +} +func (m *Header_UserHeader) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.UserHeader != nil { + l = m.UserHeader.Size() + n += 1 + l + sovTypes(uint64(l)) + } + return n +} +func (m *Header_Transform) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Transform != nil { + l = m.Transform.Size() + n += 1 + l + sovTypes(uint64(l)) + } + return n +} +func (m *Header_Tombstone) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Tombstone != nil { + l = m.Tombstone.Size() + n += 1 + l + sovTypes(uint64(l)) + } + return n +} +func (m *Header_Verify) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Verify != nil { + l = m.Verify.Size() + n += 1 + l + sovTypes(uint64(l)) + } + return n +} +func (m *Header_HomoHash) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.HomoHash.Size() + n += 1 + l + sovTypes(uint64(l)) + return n +} +func (m *Header_PayloadChecksum) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.PayloadChecksum != nil { + l = len(m.PayloadChecksum) + n += 1 + l + sovTypes(uint64(l)) + } + return n +} +func (m *Header_Integrity) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Integrity != nil { + l = m.Integrity.Size() + n += 1 + l + sovTypes(uint64(l)) + } + return n +} +func (m *Header_StorageGroup) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.StorageGroup != nil { + l = m.StorageGroup.Size() + n += 1 + l + sovTypes(uint64(l)) + } + return n +} +func (m *Tombstone) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Epoch != 0 { + n += 1 + sovTypes(uint64(m.Epoch)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *SystemHeader) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Version != 0 { + n += 1 + sovTypes(uint64(m.Version)) + } + if m.PayloadLength != 0 { + n += 1 + sovTypes(uint64(m.PayloadLength)) + } + l = m.ID.Size() + n += 1 + l + sovTypes(uint64(l)) + l = m.OwnerID.Size() + n += 1 + l + sovTypes(uint64(l)) + l = m.CID.Size() + n += 1 + l + sovTypes(uint64(l)) + l = m.CreatedAt.Size() + n += 1 + l + sovTypes(uint64(l)) + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *CreationPoint) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.UnixTime != 0 { + n += 1 + sovTypes(uint64(m.UnixTime)) + } + if m.Epoch != 0 { + n += 1 + sovTypes(uint64(m.Epoch)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *IntegrityHeader) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.HeadersChecksum) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.ChecksumSignature) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *Link) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Type != 0 { + n += 1 + sovTypes(uint64(m.Type)) + } + l = m.ID.Size() + n += 1 + l + sovTypes(uint64(l)) + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *Transform) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Type != 0 { + n += 1 + sovTypes(uint64(m.Type)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *Object) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.SystemHeader.Size() + n += 1 + l + sovTypes(uint64(l)) + if len(m.Headers) > 0 { + for _, e := range m.Headers { + l = e.Size() + n += 1 + l + sovTypes(uint64(l)) + } + } + l = len(m.Payload) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *StorageGroup) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ValidationDataSize != 0 { + n += 1 + sovTypes(uint64(m.ValidationDataSize)) + } + l = m.ValidationHash.Size() + n += 1 + l + sovTypes(uint64(l)) + if m.Lifetime != nil { + l = m.Lifetime.Size() + n += 1 + l + sovTypes(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *StorageGroup_Lifetime) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Unit != 0 { + n += 1 + sovTypes(uint64(m.Unit)) + } + if m.Value != 0 { + n += 1 + sovTypes(uint64(m.Value)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovTypes(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozTypes(x uint64) (n int) { + return sovTypes(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Range) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Range: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Range: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Offset", wireType) + } + m.Offset = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Offset |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Length", wireType) + } + m.Length = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Length |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *UserHeader) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: UserHeader: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: UserHeader: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Key = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Value = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Header) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Header: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Header: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Link", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &Link{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Value = &Header_Link{v} + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Redirect", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &refs.Address{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Value = &Header_Redirect{v} + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UserHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &UserHeader{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Value = &Header_UserHeader{v} + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Transform", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &Transform{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Value = &Header_Transform{v} + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Tombstone", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &Tombstone{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Value = &Header_Tombstone{v} + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Verify", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &session.VerificationHeader{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Value = &Header_Verify{v} + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field HomoHash", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var vv Hash + v := &vv + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Value = &Header_HomoHash{*v} + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PayloadChecksum", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := make([]byte, postIndex-iNdEx) + copy(v, dAtA[iNdEx:postIndex]) + m.Value = &Header_PayloadChecksum{v} + iNdEx = postIndex + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Integrity", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &IntegrityHeader{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Value = &Header_Integrity{v} + iNdEx = postIndex + case 10: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StorageGroup", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &StorageGroup{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Value = &Header_StorageGroup{v} + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Tombstone) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Tombstone: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Tombstone: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Epoch", wireType) + } + m.Epoch = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Epoch |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *SystemHeader) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: SystemHeader: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SystemHeader: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) + } + m.Version = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Version |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PayloadLength", wireType) + } + m.PayloadLength = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.PayloadLength |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OwnerID", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.OwnerID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CID", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CreatedAt", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CreatedAt.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CreationPoint) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CreationPoint: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CreationPoint: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field UnixTime", wireType) + } + m.UnixTime = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.UnixTime |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Epoch", wireType) + } + m.Epoch = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Epoch |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *IntegrityHeader) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: IntegrityHeader: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: IntegrityHeader: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field HeadersChecksum", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.HeadersChecksum = append(m.HeadersChecksum[:0], dAtA[iNdEx:postIndex]...) + if m.HeadersChecksum == nil { + m.HeadersChecksum = []byte{} + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ChecksumSignature", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ChecksumSignature = append(m.ChecksumSignature[:0], dAtA[iNdEx:postIndex]...) + if m.ChecksumSignature == nil { + m.ChecksumSignature = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Link) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Link: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Link: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) + } + m.Type = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Type |= Link_Type(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Transform) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Transform: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Transform: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) + } + m.Type = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Type |= Transform_Type(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Object) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Object: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Object: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SystemHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.SystemHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Headers", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Headers = append(m.Headers, Header{}) + if err := m.Headers[len(m.Headers)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Payload", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Payload = append(m.Payload[:0], dAtA[iNdEx:postIndex]...) + if m.Payload == nil { + m.Payload = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *StorageGroup) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: StorageGroup: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: StorageGroup: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidationDataSize", wireType) + } + m.ValidationDataSize = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ValidationDataSize |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidationHash", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ValidationHash.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Lifetime", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Lifetime == nil { + m.Lifetime = &StorageGroup_Lifetime{} + } + if err := m.Lifetime.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *StorageGroup_Lifetime) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Lifetime: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Lifetime: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Unit", wireType) + } + m.Unit = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Unit |= StorageGroup_Lifetime_Unit(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + m.Value = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Value |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipTypes(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthTypes + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTypes + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthTypes + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthTypes = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTypes = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTypes = fmt.Errorf("proto: unexpected end of group") +) diff --git a/object/types.proto b/object/types.proto new file mode 100644 index 0000000..a7cbd8c --- /dev/null +++ b/object/types.proto @@ -0,0 +1,107 @@ +syntax = "proto3"; +package object; +option go_package = "github.com/nspcc-dev/neofs-proto/object"; + +import "refs/types.proto"; +import "session/types.proto"; +import "github.com/gogo/protobuf/gogoproto/gogo.proto"; + +option (gogoproto.stable_marshaler_all) = true; + +message Range { + uint64 Offset = 1; + uint64 Length = 2; +} + +message UserHeader { + string Key = 1; + string Value = 2; +} + +message Header { + oneof Value { + Link Link = 1; + refs.Address Redirect = 2; + UserHeader UserHeader = 3; + Transform Transform = 4; + Tombstone Tombstone = 5; + // session-related info: session.VerificationHeader + session.VerificationHeader Verify = 6; + // integrity-related info + bytes HomoHash = 7 [(gogoproto.customtype) = "Hash"]; + bytes PayloadChecksum = 8; + IntegrityHeader Integrity = 9; + StorageGroup StorageGroup = 10; + } +} + +message Tombstone { + uint64 Epoch = 1; +} + +message SystemHeader { + uint64 Version = 1; + uint64 PayloadLength = 2; + + bytes ID = 3 [(gogoproto.customtype) = "ID", (gogoproto.nullable) = false]; + bytes OwnerID = 4 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false]; + bytes CID = 5 [(gogoproto.customtype) = "CID", (gogoproto.nullable) = false]; + CreationPoint CreatedAt = 6 [(gogoproto.nullable) = false]; +} + +message CreationPoint { + int64 UnixTime = 1; + uint64 Epoch = 2; +} + +message IntegrityHeader { + bytes HeadersChecksum = 1; + bytes ChecksumSignature = 2; +} + +message Link { + enum Type { + Unknown = 0; + Parent = 1; + Previous = 2; + Next = 3; + Child = 4; + StorageGroup = 5; + } + Type type = 1; + bytes ID = 2 [(gogoproto.customtype) = "ID", (gogoproto.nullable) = false]; +} + +message Transform { + enum Type { + Unknown = 0; + Split = 1; + Sign = 2; + Mould = 3; + } + Type type = 1; +} + +message Object { + SystemHeader SystemHeader = 1 [(gogoproto.nullable) = false]; + repeated Header Headers = 2 [(gogoproto.nullable) = false]; + bytes Payload = 3; +} + +message StorageGroup { + uint64 ValidationDataSize = 1; + bytes ValidationHash = 2 [(gogoproto.customtype) = "Hash", (gogoproto.nullable) = false]; + + message Lifetime { + enum Unit { + Unlimited = 0; + NeoFSEpoch = 1; + UnixTime = 2; + } + + Unit unit = 1 [(gogoproto.customname) = "Unit"]; + int64 Value = 2; + } + + Lifetime lifetime = 3 [(gogoproto.customname) = "Lifetime"]; +} diff --git a/object/utils.go b/object/utils.go new file mode 100644 index 0000000..1799b24 --- /dev/null +++ b/object/utils.go @@ -0,0 +1,107 @@ +package object + +import ( + "io" + + "code.cloudfoundry.org/bytefmt" + "github.com/nspcc-dev/neofs-proto/session" + "github.com/pkg/errors" +) + +const maxGetPayloadSize = 3584 * 1024 // 3.5 MiB + +func splitBytes(data []byte, maxSize int) (result [][]byte) { + l := len(data) + if l == 0 { + return [][]byte{data} + } + for i := 0; i < l; i += maxSize { + last := i + maxSize + if last > l { + last = l + } + result = append(result, data[i:last]) + } + return +} + +// SendPutRequest prepares object and sends it in chunks through protobuf stream. +func SendPutRequest(s Service_PutClient, obj *Object, epoch uint64, ttl uint32) (*PutResponse, error) { + // TODO split must take into account size of the marshalled Object + chunks := splitBytes(obj.Payload, maxGetPayloadSize) + obj.Payload = chunks[0] + if err := s.Send(MakePutRequestHeader(obj, epoch, ttl, nil)); err != nil { + return nil, err + } + for i := range chunks[1:] { + if err := s.Send(MakePutRequestChunk(chunks[i+1])); err != nil { + return nil, err + } + } + resp, err := s.CloseAndRecv() + if err != nil && err != io.EOF { + return nil, err + } + return resp, nil +} + +// MakePutRequestHeader combines object, epoch, ttl and session token value +// into header of object put request. +func MakePutRequestHeader(obj *Object, epoch uint64, ttl uint32, token *session.Token) *PutRequest { + return &PutRequest{ + R: &PutRequest_Header{ + Header: &PutRequest_PutHeader{ + Epoch: epoch, + Object: obj, + TTL: ttl, + Token: token, + }, + }, + } +} + +// MakePutRequestChunk splits data into chunks that will be transferred +// in the protobuf stream. +func MakePutRequestChunk(chunk []byte) *PutRequest { + return &PutRequest{R: &PutRequest_Chunk{Chunk: chunk}} +} + +func errMaxSizeExceeded(size uint64) error { + return errors.Errorf("object payload size exceed: %s", bytefmt.ByteSize(size)) +} + +// ReceiveGetResponse receives object by chunks from the protobuf stream +// and combine it into single get response structure. +func ReceiveGetResponse(c Service_GetClient, maxSize uint64) (*GetResponse, error) { + res, err := c.Recv() + if err == io.EOF { + return res, err + } else if err != nil { + return nil, err + } + + obj := res.GetObject() + if obj == nil { + return nil, ErrHeaderExpected + } + + if obj.SystemHeader.PayloadLength > maxSize { + return nil, errMaxSizeExceeded(maxSize) + } + + if res.NotFull() { + payload := make([]byte, obj.SystemHeader.PayloadLength) + offset := copy(payload, obj.Payload) + + var r *GetResponse + for r, err = c.Recv(); err == nil; r, err = c.Recv() { + offset += copy(payload[offset:], r.GetChunk()) + } + if err != io.EOF { + return nil, err + } + obj.Payload = payload + } + + return res, nil +} diff --git a/object/verification.go b/object/verification.go new file mode 100644 index 0000000..761c04e --- /dev/null +++ b/object/verification.go @@ -0,0 +1,132 @@ +package object + +import ( + "bytes" + "crypto/ecdsa" + "crypto/sha256" + + crypto "github.com/nspcc-dev/neofs-crypto" + "github.com/pkg/errors" +) + +func (m Object) headersData(check bool) ([]byte, error) { + var bytebuf = new(bytes.Buffer) + + // fixme: we must marshal fields one by one without protobuf marshaling + // protobuf marshaling does not guarantee the same result + + if sysheader, err := m.SystemHeader.Marshal(); err != nil { + return nil, err + } else if _, err := bytebuf.Write(sysheader); err != nil { + return nil, err + } + + n, _ := m.LastHeader(HeaderType(IntegrityHdr)) + for i := range m.Headers { + if check && i == n { + // ignore last integrity header in order to check headers data + continue + } + + if header, err := m.Headers[i].Marshal(); err != nil { + return nil, err + } else if _, err := bytebuf.Write(header); err != nil { + return nil, err + } + } + return bytebuf.Bytes(), nil +} + +func (m Object) headersChecksum(check bool) ([]byte, error) { + data, err := m.headersData(check) + if err != nil { + return nil, err + } + checksum := sha256.Sum256(data) + return checksum[:], nil +} + +// PayloadChecksum calculates sha256 checksum of object payload. +func (m Object) PayloadChecksum() []byte { + checksum := sha256.Sum256(m.Payload) + return checksum[:] +} + +func (m Object) verifySignature(key []byte, ih *IntegrityHeader) error { + pk := crypto.UnmarshalPublicKey(key) + if crypto.Verify(pk, ih.HeadersChecksum, ih.ChecksumSignature) == nil { + return nil + } + return ErrVerifySignature +} + +// Verify performs local integrity check by finding verification header and +// integrity header. If header integrity is passed, function verifies +// checksum of the object payload. +func (m Object) Verify() error { + var ( + err error + checksum []byte + ) + // Prepare structures + _, vh := m.LastHeader(HeaderType(VerifyHdr)) + if vh == nil { + return ErrHeaderNotFound + } + verify := vh.Value.(*Header_Verify).Verify + + _, ih := m.LastHeader(HeaderType(IntegrityHdr)) + if ih == nil { + return ErrHeaderNotFound + } + integrity := ih.Value.(*Header_Integrity).Integrity + + // Verify signature + err = m.verifySignature(verify.PublicKey, integrity) + if err != nil { + return errors.Wrapf(err, "public key: %x", verify.PublicKey) + } + + // Verify checksum of header + checksum, err = m.headersChecksum(true) + if err != nil { + return err + } + if !bytes.Equal(integrity.HeadersChecksum, checksum) { + return ErrVerifyHeader + } + + // Verify checksum of payload + if m.SystemHeader.PayloadLength > 0 && !m.IsLinking() { + checksum = m.PayloadChecksum() + + _, ph := m.LastHeader(HeaderType(PayloadChecksumHdr)) + if ph == nil { + return ErrHeaderNotFound + } + if !bytes.Equal(ph.Value.(*Header_PayloadChecksum).PayloadChecksum, checksum) { + return ErrVerifyPayload + } + } + return nil +} + +// Sign creates new integrity header and adds it to the end of the list of +// extended headers. +func (m *Object) Sign(key *ecdsa.PrivateKey) error { + headerChecksum, err := m.headersChecksum(false) + if err != nil { + return err + } + headerChecksumSignature, err := crypto.Sign(key, headerChecksum) + if err != nil { + return err + } + m.AddHeader(&Header{Value: &Header_Integrity{ + Integrity: &IntegrityHeader{ + HeadersChecksum: headerChecksum, + ChecksumSignature: headerChecksumSignature, + }, + }}) + return nil +} diff --git a/object/verification_test.go b/object/verification_test.go new file mode 100644 index 0000000..f91e051 --- /dev/null +++ b/object/verification_test.go @@ -0,0 +1,105 @@ +package object + +import ( + "testing" + + "github.com/google/uuid" + crypto "github.com/nspcc-dev/neofs-crypto" + "github.com/nspcc-dev/neofs-crypto/test" + "github.com/nspcc-dev/neofs-proto/container" + "github.com/nspcc-dev/neofs-proto/refs" + "github.com/nspcc-dev/neofs-proto/session" + "github.com/stretchr/testify/require" +) + +func TestObject_Verify(t *testing.T) { + key := test.DecodeKey(0) + sessionkey := test.DecodeKey(1) + + payload := make([]byte, 1024*1024) + + cnr, err := container.NewTestContainer() + require.NoError(t, err) + + cid, err := cnr.ID() + require.NoError(t, err) + + id, err := uuid.NewRandom() + uid := refs.UUID(id) + require.NoError(t, err) + + obj := &Object{ + SystemHeader: SystemHeader{ + ID: uid, + CID: cid, + OwnerID: refs.OwnerID([refs.OwnerIDSize]byte{}), + }, + Headers: []Header{ + { + Value: &Header_UserHeader{ + UserHeader: &UserHeader{ + Key: "Profession", + Value: "Developer", + }, + }, + }, + { + Value: &Header_UserHeader{ + UserHeader: &UserHeader{ + Key: "Language", + Value: "GO", + }, + }, + }, + }, + } + obj.SetPayload(payload) + obj.SetHeader(&Header{Value: &Header_PayloadChecksum{[]byte("incorrect checksum")}}) + + t.Run("error no integrity header", func(t *testing.T) { + err = obj.Verify() + require.EqualError(t, err, ErrHeaderNotFound.Error()) + }) + + badHeaderChecksum := []byte("incorrect checksum") + signature, err := crypto.Sign(sessionkey, badHeaderChecksum) + require.NoError(t, err) + ih := &IntegrityHeader{ + HeadersChecksum: badHeaderChecksum, + ChecksumSignature: signature, + } + obj.SetHeader(&Header{Value: &Header_Integrity{ih}}) + + t.Run("error no validation header", func(t *testing.T) { + err = obj.Verify() + require.EqualError(t, err, ErrHeaderNotFound.Error()) + }) + + dataPK := crypto.MarshalPublicKey(&sessionkey.PublicKey) + signature, err = crypto.Sign(key, dataPK) + vh := &session.VerificationHeader{ + PublicKey: dataPK, + KeySignature: signature, + } + obj.SetVerificationHeader(vh) + + t.Run("error invalid header checksum", func(t *testing.T) { + err = obj.Verify() + require.EqualError(t, err, ErrVerifyHeader.Error()) + }) + + require.NoError(t, obj.Sign(sessionkey)) + + t.Run("error invalid payload checksum", func(t *testing.T) { + err = obj.Verify() + require.EqualError(t, err, ErrVerifyPayload.Error()) + }) + + obj.SetHeader(&Header{Value: &Header_PayloadChecksum{obj.PayloadChecksum()}}) + require.NoError(t, obj.Sign(sessionkey)) + + t.Run("correct", func(t *testing.T) { + err = obj.Verify() + require.NoError(t, err) + }) +} diff --git a/proto.go b/proto.go new file mode 100644 index 0000000..b15f22a --- /dev/null +++ b/proto.go @@ -0,0 +1,7 @@ +package neofs_proto // import "github.com/nspcc-dev/neofs-proto" + +import ( + _ "github.com/gogo/protobuf/gogoproto" + _ "github.com/gogo/protobuf/proto" + _ "github.com/golang/protobuf/proto" +) diff --git a/query/types.go b/query/types.go new file mode 100644 index 0000000..15a54f6 --- /dev/null +++ b/query/types.go @@ -0,0 +1,43 @@ +package query + +import ( + "strings" + + "github.com/gogo/protobuf/proto" +) + +var ( + _ proto.Message = (*Query)(nil) + _ proto.Message = (*Filter)(nil) +) + +// String returns string representation of Filter. +func (m Filter) String() string { + b := new(strings.Builder) + b.WriteString("") + return b.String() +} + +// String returns string representation of Query. +func (m Query) String() string { + b := new(strings.Builder) + b.WriteString(" 0 { + i -= len(m.Value) + copy(dAtA[i:], m.Value) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Value))) + i-- + dAtA[i] = 0x1a + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0x12 + } + if m.Type != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Type)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *Query) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Query) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Query) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Filters) > 0 { + for iNdEx := len(m.Filters) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Filters[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func encodeVarintTypes(dAtA []byte, offset int, v uint64) int { + offset -= sovTypes(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Filter) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Type != 0 { + n += 1 + sovTypes(uint64(m.Type)) + } + l = len(m.Name) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.Value) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *Query) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Filters) > 0 { + for _, e := range m.Filters { + l = e.Size() + n += 1 + l + sovTypes(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovTypes(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozTypes(x uint64) (n int) { + return sovTypes(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Filter) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Filter: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Filter: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) + } + m.Type = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Type |= Filter_Type(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Value = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Query) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Query: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Query: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Filters", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Filters = append(m.Filters, Filter{}) + if err := m.Filters[len(m.Filters)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipTypes(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthTypes + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTypes + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthTypes + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthTypes = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTypes = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTypes = fmt.Errorf("proto: unexpected end of group") +) diff --git a/query/types.proto b/query/types.proto new file mode 100644 index 0000000..5f46072 --- /dev/null +++ b/query/types.proto @@ -0,0 +1,25 @@ +syntax = "proto3"; +package query; +option go_package = "github.com/nspcc-dev/neofs-proto/query"; + +import "github.com/gogo/protobuf/gogoproto/gogo.proto"; + +option (gogoproto.stable_marshaler_all) = true; + +message Filter { + option (gogoproto.goproto_stringer) = false; + + enum Type { + Exact = 0; + Regex = 1; + } + Type type = 1 [(gogoproto.customname) = "Type"]; + string Name = 2; + string Value = 3; +} + +message Query { + option (gogoproto.goproto_stringer) = false; + + repeated Filter Filters = 1 [(gogoproto.nullable) = false]; +} diff --git a/refs/address.go b/refs/address.go new file mode 100644 index 0000000..be6b6a3 --- /dev/null +++ b/refs/address.go @@ -0,0 +1,68 @@ +package refs + +import ( + "crypto/sha256" + "strings" + + "github.com/nspcc-dev/neofs-proto/internal" +) + +const ( + joinSeparator = "/" + + // ErrWrongAddress is raised when wrong address is passed to Address.Parse ParseAddress. + ErrWrongAddress = internal.Error("wrong address") + + // ErrEmptyAddress is raised when empty address is passed to Address.Parse ParseAddress. + ErrEmptyAddress = internal.Error("empty address") +) + +// ParseAddress parses address from string representation into new Address. +func ParseAddress(str string) (*Address, error) { + var addr Address + return &addr, addr.Parse(str) +} + +// Parse parses address from string representation into current Address. +func (m *Address) Parse(addr string) error { + if m == nil { + return ErrEmptyAddress + } + + items := strings.Split(addr, joinSeparator) + if len(items) != 2 { + return ErrWrongAddress + } + + if err := m.CID.Parse(items[0]); err != nil { + return err + } else if err := m.ObjectID.Parse(items[1]); err != nil { + return err + } + + return nil +} + +// String returns string representation of Address. +func (m Address) String() string { + return strings.Join([]string{m.CID.String(), m.ObjectID.String()}, joinSeparator) +} + +// IsFull checks that ContainerID and ObjectID is not empty. +func (m Address) IsFull() bool { + return !m.CID.Empty() && !m.ObjectID.Empty() +} + +// Equal checks that current Address is equal to passed Address. +func (m Address) Equal(a2 *Address) bool { + return m.CID.Equal(a2.CID) && m.ObjectID.Equal(a2.ObjectID) +} + +// Hash returns []byte that used as a key for storage bucket. +func (m Address) Hash() ([]byte, error) { + if !m.IsFull() { + return nil, ErrEmptyAddress + } + h := sha256.Sum256(append(m.ObjectID.Bytes(), m.CID.Bytes()...)) + return h[:], nil +} diff --git a/refs/cid.go b/refs/cid.go new file mode 100644 index 0000000..4f0cf39 --- /dev/null +++ b/refs/cid.go @@ -0,0 +1,96 @@ +package refs + +import ( + "bytes" + "crypto/sha256" + + "github.com/mr-tron/base58" + "github.com/pkg/errors" +) + +// CIDForBytes creates CID for passed bytes. +func CIDForBytes(data []byte) CID { return sha256.Sum256(data) } + +// CIDFromBytes parses CID from passed bytes. +func CIDFromBytes(data []byte) (cid CID, err error) { + if ln := len(data); ln != CIDSize { + return CID{}, errors.Wrapf(ErrWrongDataSize, "expect=%d, actual=%d", CIDSize, ln) + } + + copy(cid[:], data) + return +} + +// CIDFromString parses CID from string representation of CID. +func CIDFromString(c string) (CID, error) { + var cid CID + decoded, err := base58.Decode(c) + if err != nil { + return cid, err + } + return CIDFromBytes(decoded) +} + +// Size returns size of CID (CIDSize). +func (c CID) Size() int { return CIDSize } + +// Parse tries to parse CID from string representation. +func (c *CID) Parse(cid string) error { + var err error + if *c, err = CIDFromString(cid); err != nil { + return err + } + return nil +} + +// Empty checks that current CID is empty. +func (c CID) Empty() bool { return bytes.Equal(c.Bytes(), emptyCID) } + +// Equal checks that current CID is equal to passed CID. +func (c CID) Equal(cid CID) bool { return bytes.Equal(c.Bytes(), cid.Bytes()) } + +// Marshal returns CID bytes representation. +func (c CID) Marshal() ([]byte, error) { return c.Bytes(), nil } + +// MarshalBinary returns CID bytes representation. +func (c CID) MarshalBinary() ([]byte, error) { return c.Bytes(), nil } + +// MarshalTo marshal CID to bytes representation into passed bytes. +func (c *CID) MarshalTo(data []byte) (int, error) { return copy(data, c.Bytes()), nil } + +// ProtoMessage method to satisfy proto.Message interface. +func (c CID) ProtoMessage() {} + +// String returns string representation of CID. +func (c CID) String() string { return base58.Encode(c[:]) } + +// Reset resets current CID to zero value. +func (c *CID) Reset() { *c = CID{} } + +// Bytes returns CID bytes representation. +func (c CID) Bytes() []byte { + buf := make([]byte, CIDSize) + copy(buf, c[:]) + return buf +} + +// UnmarshalBinary tries to parse bytes representation of CID. +func (c *CID) UnmarshalBinary(data []byte) error { return c.Unmarshal(data) } + +// Unmarshal tries to parse bytes representation of CID. +func (c *CID) Unmarshal(data []byte) error { + if ln := len(data); ln != CIDSize { + return errors.Wrapf(ErrWrongDataSize, "expect=%d, actual=%d", CIDSize, ln) + } + + copy((*c)[:], data) + return nil +} + +// Verify validates that current CID is generated for passed bytes data. +func (c CID) Verify(data []byte) error { + if id := CIDForBytes(data); !bytes.Equal(c[:], id[:]) { + return errors.New("wrong hash for data") + } + return nil +} diff --git a/refs/owner.go b/refs/owner.go new file mode 100644 index 0000000..ff88446 --- /dev/null +++ b/refs/owner.go @@ -0,0 +1,65 @@ +package refs + +import ( + "bytes" + "crypto/ecdsa" + + "github.com/mr-tron/base58" + "github.com/nspcc-dev/neofs-proto/chain" + "github.com/pkg/errors" +) + +// NewOwnerID returns generated OwnerID from passed public keys. +func NewOwnerID(keys ...*ecdsa.PublicKey) (owner OwnerID, err error) { + if len(keys) == 0 { + return + } + var d []byte + d, err = base58.Decode(chain.KeysToAddress(keys...)) + if err != nil { + return + } + copy(owner[:], d) + return owner, nil +} + +// Size returns OwnerID size in bytes (OwnerIDSize). +func (OwnerID) Size() int { return OwnerIDSize } + +// Empty checks that current OwnerID is empty value. +func (o OwnerID) Empty() bool { return bytes.Equal(o.Bytes(), emptyOwner) } + +// Equal checks that current OwnerID is equal to passed OwnerID. +func (o OwnerID) Equal(id OwnerID) bool { return bytes.Equal(o.Bytes(), id.Bytes()) } + +// Reset sets current OwnerID to empty value. +func (o *OwnerID) Reset() { *o = OwnerID{} } + +// ProtoMessage method to satisfy proto.Message interface. +func (OwnerID) ProtoMessage() {} + +// Marshal returns OwnerID bytes representation. +func (o OwnerID) Marshal() ([]byte, error) { return o.Bytes(), nil } + +// MarshalTo copies OwnerID bytes representation into passed slice of bytes. +func (o OwnerID) MarshalTo(data []byte) (int, error) { return copy(data, o.Bytes()), nil } + +// String returns string representation of OwnerID. +func (o OwnerID) String() string { return base58.Encode(o[:]) } + +// Bytes returns OwnerID bytes representation. +func (o OwnerID) Bytes() []byte { + buf := make([]byte, OwnerIDSize) + copy(buf, o[:]) + return buf +} + +// Unmarshal tries to parse OwnerID bytes representation into current OwnerID. +func (o *OwnerID) Unmarshal(data []byte) error { + if ln := len(data); ln != OwnerIDSize { + return errors.Wrapf(ErrWrongDataSize, "expect=%d, actual=%d", OwnerIDSize, ln) + } + + copy((*o)[:], data) + return nil +} diff --git a/refs/sgid.go b/refs/sgid.go new file mode 100644 index 0000000..d6fcf2d --- /dev/null +++ b/refs/sgid.go @@ -0,0 +1,14 @@ +package refs + +import ( + "github.com/pkg/errors" +) + +// SGIDFromBytes parse bytes representation of SGID into new SGID value. +func SGIDFromBytes(data []byte) (sgid SGID, err error) { + if ln := len(data); ln != SGIDSize { + return SGID{}, errors.Wrapf(ErrWrongDataSize, "expect=%d, actual=%d", SGIDSize, ln) + } + copy(sgid[:], data) + return +} diff --git a/refs/types.go b/refs/types.go new file mode 100644 index 0000000..785155c --- /dev/null +++ b/refs/types.go @@ -0,0 +1,106 @@ +// This package contains basic structures implemented in Go, such as +// +// CID - container id +// OwnerID - owner id +// ObjectID - object id +// SGID - storage group id +// Address - contains object id and container id +// UUID - a 128 bit (16 byte) Universal Unique Identifier as defined in RFC 4122 + +package refs + +import ( + "crypto/sha256" + + "github.com/google/uuid" + "github.com/nspcc-dev/neofs-proto/chain" + "github.com/nspcc-dev/neofs-proto/internal" +) + +type ( + // CID is implementation of ContainerID. + CID [CIDSize]byte + + // UUID wrapper over github.com/google/uuid.UUID. + UUID uuid.UUID + + // SGID is type alias of UUID. + SGID = UUID + + // ObjectID is type alias of UUID. + ObjectID = UUID + + // MessageID is type alias of UUID. + MessageID = UUID + + // OwnerID is wrapper over neofs-proto/chain.WalletAddress. + OwnerID chain.WalletAddress +) + +const ( + // UUIDSize contains size of UUID. + UUIDSize = 16 + + // SGIDSize contains size of SGID. + SGIDSize = UUIDSize + + // CIDSize contains size of CID. + CIDSize = sha256.Size + + // OwnerIDSize contains size of OwnerID. + OwnerIDSize = chain.AddressLength + + // ErrWrongDataSize is raised when passed bytes into Unmarshal have wrong size. + ErrWrongDataSize = internal.Error("wrong data size") + + // ErrEmptyOwner is raised when empty OwnerID is passed into container.New. + ErrEmptyOwner = internal.Error("owner cant be empty") + + // ErrEmptyCapacity is raised when empty Capacity is passed container.New. + ErrEmptyCapacity = internal.Error("capacity cant be empty") + + // ErrEmptyContainer is raised when it CID method is called for an empty container. + ErrEmptyContainer = internal.Error("cannot return ID for empty container") +) + +var ( + emptyCID = (CID{}).Bytes() + emptyUUID = (UUID{}).Bytes() + emptyOwner = (OwnerID{}).Bytes() + + _ internal.Custom = (*CID)(nil) + _ internal.Custom = (*SGID)(nil) + _ internal.Custom = (*UUID)(nil) + _ internal.Custom = (*OwnerID)(nil) + _ internal.Custom = (*ObjectID)(nil) + _ internal.Custom = (*MessageID)(nil) + + // NewSGID method alias. + NewSGID = NewUUID + + // NewObjectID method alias. + NewObjectID = NewUUID + + // NewMessageID method alias. + NewMessageID = NewUUID +) + +// NewUUID returns a Random (Version 4) UUID. +// +// The strength of the UUIDs is based on the strength of the crypto/rand +// package. +// +// A note about uniqueness derived from the UUID Wikipedia entry: +// +// Randomly generated UUIDs have 122 random bits. One's annual risk of being +// hit by a meteorite is estimated to be one chance in 17 billion, that +// means the probability is about 0.00000000006 (6 × 10−11), +// equivalent to the odds of creating a few tens of trillions of UUIDs in a +// year and having one duplicate. +func NewUUID() (UUID, error) { + id, err := uuid.NewRandom() + if err != nil { + return UUID{}, err + } + return UUID(id), nil +} diff --git a/refs/types.pb.go b/refs/types.pb.go new file mode 100644 index 0000000..33f7578 --- /dev/null +++ b/refs/types.pb.go @@ -0,0 +1,368 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: refs/types.proto + +package refs + +import ( + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/golang/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package + +type Address struct { + ObjectID ObjectID `protobuf:"bytes,1,opt,name=ObjectID,proto3,customtype=ObjectID" json:"ObjectID"` + CID CID `protobuf:"bytes,2,opt,name=CID,proto3,customtype=CID" json:"CID"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Address) Reset() { *m = Address{} } +func (*Address) ProtoMessage() {} +func (*Address) Descriptor() ([]byte, []int) { + return fileDescriptor_063a64a96d952d31, []int{0} +} +func (m *Address) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Address) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *Address) XXX_Merge(src proto.Message) { + xxx_messageInfo_Address.Merge(m, src) +} +func (m *Address) XXX_Size() int { + return m.Size() +} +func (m *Address) XXX_DiscardUnknown() { + xxx_messageInfo_Address.DiscardUnknown(m) +} + +var xxx_messageInfo_Address proto.InternalMessageInfo + +func init() { + proto.RegisterType((*Address)(nil), "refs.Address") +} + +func init() { proto.RegisterFile("refs/types.proto", fileDescriptor_063a64a96d952d31) } + +var fileDescriptor_063a64a96d952d31 = []byte{ + // 199 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x28, 0x4a, 0x4d, 0x2b, + 0xd6, 0x2f, 0xa9, 0x2c, 0x48, 0x2d, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x01, 0x89, + 0x48, 0xe9, 0xa6, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0xa7, 0xe7, 0xa7, + 0xe7, 0xeb, 0x83, 0x25, 0x93, 0x4a, 0xd3, 0xc0, 0x3c, 0x30, 0x07, 0xcc, 0x82, 0x68, 0x52, 0x0a, + 0xe3, 0x62, 0x77, 0x4c, 0x49, 0x29, 0x4a, 0x2d, 0x2e, 0x16, 0xd2, 0xe1, 0xe2, 0xf0, 0x4f, 0xca, + 0x4a, 0x4d, 0x2e, 0xf1, 0x74, 0x91, 0x60, 0x54, 0x60, 0xd4, 0xe0, 0x71, 0x12, 0x38, 0x71, 0x4f, + 0x9e, 0xe1, 0xd6, 0x3d, 0x79, 0xb8, 0x78, 0x10, 0x9c, 0x25, 0x24, 0xcb, 0xc5, 0xec, 0xec, 0xe9, + 0x22, 0xc1, 0x04, 0x56, 0xc8, 0x0d, 0x55, 0x08, 0x12, 0x0a, 0x02, 0x11, 0x4e, 0xce, 0x37, 0x1e, + 0xca, 0x31, 0x34, 0x3c, 0x92, 0x63, 0x38, 0xf1, 0x48, 0x8e, 0xf1, 0xc2, 0x23, 0x39, 0xc6, 0x1b, + 0x8f, 0xe4, 0x18, 0x1f, 0x3c, 0x92, 0x63, 0x9c, 0xf1, 0x58, 0x8e, 0x21, 0x4a, 0x15, 0xc9, 0x91, + 0x79, 0xc5, 0x05, 0xc9, 0xc9, 0xba, 0x29, 0xa9, 0x65, 0xfa, 0x79, 0xa9, 0xf9, 0x69, 0xc5, 0xba, + 0x10, 0x27, 0x82, 0xfc, 0x92, 0xc4, 0x06, 0x66, 0x1b, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0xfd, + 0xb6, 0x0b, 0x68, 0xec, 0x00, 0x00, 0x00, +} + +func (m *Address) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Address) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Address) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + { + size := m.CID.Size() + i -= size + if _, err := m.CID.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size := m.ObjectID.Size() + i -= size + if _, err := m.ObjectID.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func encodeVarintTypes(dAtA []byte, offset int, v uint64) int { + offset -= sovTypes(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Address) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.ObjectID.Size() + n += 1 + l + sovTypes(uint64(l)) + l = m.CID.Size() + n += 1 + l + sovTypes(uint64(l)) + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovTypes(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozTypes(x uint64) (n int) { + return sovTypes(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Address) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Address: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Address: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ObjectID", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ObjectID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CID", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipTypes(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthTypes + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTypes + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthTypes + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthTypes = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTypes = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTypes = fmt.Errorf("proto: unexpected end of group") +) diff --git a/refs/types.proto b/refs/types.proto new file mode 100644 index 0000000..e607f34 --- /dev/null +++ b/refs/types.proto @@ -0,0 +1,15 @@ +syntax = "proto3"; +package refs; +option go_package = "github.com/nspcc-dev/neofs-proto/refs"; + +import "github.com/gogo/protobuf/gogoproto/gogo.proto"; + +option (gogoproto.stable_marshaler_all) = true; + +option (gogoproto.stringer_all) = false; +option (gogoproto.goproto_stringer_all) = false; + +message Address { + bytes ObjectID = 1[(gogoproto.customtype) = "ObjectID", (gogoproto.nullable) = false]; // UUID + bytes CID = 2[(gogoproto.customtype) = "CID", (gogoproto.nullable) = false]; // sha256 +} diff --git a/refs/types_test.go b/refs/types_test.go new file mode 100644 index 0000000..2fd3ced --- /dev/null +++ b/refs/types_test.go @@ -0,0 +1,112 @@ +package refs + +import ( + "strings" + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/google/uuid" + "github.com/nspcc-dev/neofs-crypto/test" + "github.com/stretchr/testify/require" +) + +func TestSGID(t *testing.T) { + t.Run("check that marshal/unmarshal works like expected", func(t *testing.T) { + var sgid1, sgid2 UUID + + sgid1, err := NewSGID() + require.NoError(t, err) + + data, err := proto.Marshal(&sgid1) + require.NoError(t, err) + + require.NoError(t, sgid2.Unmarshal(data)) + require.Equal(t, sgid1, sgid2) + }) +} + +func TestUUID(t *testing.T) { + t.Run("parse should work like expected", func(t *testing.T) { + var u UUID + + id, err := uuid.NewRandom() + require.NoError(t, err) + + require.NoError(t, u.Parse(id.String())) + require.Equal(t, id.String(), u.String()) + }) + + t.Run("check that marshal/unmarshal works like expected", func(t *testing.T) { + var u1, u2 UUID + + u1 = UUID{0x8f, 0xe4, 0xeb, 0xa0, 0xb8, 0xfb, 0x49, 0x3b, 0xbb, 0x1d, 0x1d, 0x13, 0x6e, 0x69, 0xfc, 0xf7} + + data, err := proto.Marshal(&u1) + require.NoError(t, err) + + require.NoError(t, u2.Unmarshal(data)) + require.Equal(t, u1, u2) + }) + + t.Run("check that marshal/unmarshal works like expected even for msg id", func(t *testing.T) { + var u2 MessageID + + u1, err := NewMessageID() + require.NoError(t, err) + + data, err := proto.Marshal(&u1) + require.NoError(t, err) + + require.NoError(t, u2.Unmarshal(data)) + require.Equal(t, u1, u2) + }) +} + +func TestOwnerID(t *testing.T) { + t.Run("check that marshal/unmarshal works like expected", func(t *testing.T) { + var u1, u2 OwnerID + + owner, err := NewOwnerID() + require.NoError(t, err) + require.True(t, owner.Empty()) + + key := test.DecodeKey(0) + + u1, err = NewOwnerID(&key.PublicKey) + require.NoError(t, err) + data, err := proto.Marshal(&u1) + require.NoError(t, err) + + require.NoError(t, u2.Unmarshal(data)) + require.Equal(t, u1, u2) + }) +} + +func TestAddress(t *testing.T) { + cid := CIDForBytes([]byte("test")) + + id, err := NewObjectID() + require.NoError(t, err) + + expect := strings.Join([]string{ + cid.String(), + id.String(), + }, joinSeparator) + + require.NotPanics(t, func() { + actual := (Address{ + ObjectID: id, + CID: cid, + }).String() + + require.Equal(t, expect, actual) + }) + + var temp Address + require.NoError(t, temp.Parse(expect)) + require.Equal(t, expect, temp.String()) + + actual, err := ParseAddress(expect) + require.NoError(t, err) + require.Equal(t, expect, actual.String()) +} diff --git a/refs/uuid.go b/refs/uuid.go new file mode 100644 index 0000000..2ffc525 --- /dev/null +++ b/refs/uuid.go @@ -0,0 +1,76 @@ +package refs + +import ( + "bytes" + "encoding/hex" + + "github.com/google/uuid" + "github.com/pkg/errors" +) + +func encodeHex(dst []byte, uuid UUID) { + hex.Encode(dst, uuid[:4]) + dst[8] = '-' + hex.Encode(dst[9:13], uuid[4:6]) + dst[13] = '-' + hex.Encode(dst[14:18], uuid[6:8]) + dst[18] = '-' + hex.Encode(dst[19:23], uuid[8:10]) + dst[23] = '-' + hex.Encode(dst[24:], uuid[10:]) +} + +// Size returns size in bytes of UUID (UUIDSize). +func (UUID) Size() int { return UUIDSize } + +// Empty checks that current UUID is empty value. +func (u UUID) Empty() bool { return bytes.Equal(u.Bytes(), emptyUUID) } + +// Reset sets current UUID to empty value. +func (u *UUID) Reset() { *u = [UUIDSize]byte{} } + +// ProtoMessage method to satisfy proto.Message. +func (UUID) ProtoMessage() {} + +// Marshal returns UUID bytes representation. +func (u UUID) Marshal() ([]byte, error) { return u.Bytes(), nil } + +// MarshalTo returns UUID bytes representation. +func (u UUID) MarshalTo(data []byte) (int, error) { return copy(data, u[:]), nil } + +// Bytes returns UUID bytes representation. +func (u UUID) Bytes() []byte { + buf := make([]byte, UUIDSize) + copy(buf, u[:]) + return buf +} + +// Equal checks that current UUID is equal to passed UUID. +func (u UUID) Equal(u2 UUID) bool { return bytes.Equal(u.Bytes(), u2.Bytes()) } + +func (u UUID) String() string { + var buf [36]byte + encodeHex(buf[:], u) + return string(buf[:]) +} + +// Unmarshal tries to parse UUID bytes representation. +func (u *UUID) Unmarshal(data []byte) error { + if ln := len(data); ln != UUIDSize { + return errors.Wrapf(ErrWrongDataSize, "expect=%d, actual=%d", UUIDSize, ln) + } + + copy((*u)[:], data) + return nil +} + +// Parse tries to parse UUID string representation. +func (u *UUID) Parse(id string) error { + tmp, err := uuid.Parse(id) + if err != nil { + return errors.Wrapf(err, "could not parse `%s`", id) + } + + copy((*u)[:], tmp[:]) + return nil +} diff --git a/service/epoch.go b/service/epoch.go new file mode 100644 index 0000000..2fd4381 --- /dev/null +++ b/service/epoch.go @@ -0,0 +1,7 @@ +package service + +// EpochRequest interface gives possibility to get or set epoch in RPC Requests. +type EpochRequest interface { + GetEpoch() uint64 + SetEpoch(v uint64) +} diff --git a/service/role.go b/service/role.go new file mode 100644 index 0000000..53bcdf5 --- /dev/null +++ b/service/role.go @@ -0,0 +1,24 @@ +package service + +// NodeRole to identify in Bootstrap service. +type NodeRole int32 + +const ( + _ NodeRole = iota + // InnerRingNode that work like IR node. + InnerRingNode + // StorageNode that work like a storage node. + StorageNode +) + +// String is method, that represent NodeRole as string. +func (nt NodeRole) String() string { + switch nt { + case InnerRingNode: + return "InnerRingNode" + case StorageNode: + return "StorageNode" + default: + return "Unknown" + } +} diff --git a/service/role_test.go b/service/role_test.go new file mode 100644 index 0000000..a1f1cc0 --- /dev/null +++ b/service/role_test.go @@ -0,0 +1,22 @@ +package service + +import ( + "github.com/stretchr/testify/require" + "testing" +) + +func TestNodeRole_String(t *testing.T) { + tests := []struct { + nt NodeRole + want string + }{ + {want: "Unknown"}, + {nt: StorageNode, want: "StorageNode"}, + {nt: InnerRingNode, want: "InnerRingNode"}, + } + for _, tt := range tests { + t.Run(tt.want, func(t *testing.T) { + require.Equal(t, tt.want, tt.nt.String()) + }) + } +} diff --git a/service/sign.go b/service/sign.go new file mode 100644 index 0000000..d8db94e --- /dev/null +++ b/service/sign.go @@ -0,0 +1,47 @@ +package service + +import ( + "crypto/ecdsa" + + crypto "github.com/nspcc-dev/neofs-crypto" + "github.com/nspcc-dev/neofs-proto/internal" + "github.com/pkg/errors" +) + +// ErrWrongSignature should be raised when wrong signature is passed into VerifyRequest. +const ErrWrongSignature = internal.Error("wrong signature") + +// SignedRequest interface allows sign and verify requests. +type SignedRequest interface { + PrepareData() ([]byte, error) + GetSignature() []byte + SetSignature([]byte) +} + +// SignRequest with passed private key. +func SignRequest(r SignedRequest, key *ecdsa.PrivateKey) error { + var signature []byte + if data, err := r.PrepareData(); err != nil { + return err + } else if signature, err = crypto.Sign(key, data); err != nil { + return errors.Wrap(err, "could not sign data") + } + + r.SetSignature(signature) + + return nil +} + +// VerifyRequest by passed public keys. +func VerifyRequest(r SignedRequest, keys ...*ecdsa.PublicKey) bool { + data, err := r.PrepareData() + if err != nil { + return false + } + for i := range keys { + if err := crypto.Verify(keys[i], data, r.GetSignature()); err == nil { + return true + } + } + return false +} diff --git a/service/ttl.go b/service/ttl.go new file mode 100644 index 0000000..8ddf1de --- /dev/null +++ b/service/ttl.go @@ -0,0 +1,45 @@ +package service + +import ( + "github.com/nspcc-dev/neofs-proto/internal" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +// TTLRequest to verify and update ttl requests. +type TTLRequest interface { + GetTTL() uint32 + SetTTL(uint32) +} + +const ( + // ZeroTTL is empty ttl, should produce ErrZeroTTL. + ZeroTTL = iota + + // NonForwardingTTL is a ttl that allows direct connections only. + NonForwardingTTL + + // SingleForwardingTTL is a ttl that allows connections through another node. + SingleForwardingTTL + + // ErrZeroTTL is raised when zero ttl is passed. + ErrZeroTTL = internal.Error("zero ttl") + + // ErrIncorrectTTL is raised when NonForwardingTTL is passed and NodeRole != InnerRingNode. + ErrIncorrectTTL = internal.Error("incorrect ttl") +) + +// CheckTTLRequest validates and update ttl requests. +func CheckTTLRequest(req TTLRequest, role NodeRole) error { + var ttl = req.GetTTL() + + if ttl == ZeroTTL { + return status.New(codes.InvalidArgument, ErrZeroTTL.Error()).Err() + } else if ttl == NonForwardingTTL && role != InnerRingNode { + return status.New(codes.InvalidArgument, ErrIncorrectTTL.Error()).Err() + } + + req.SetTTL(ttl - 1) + + return nil +} diff --git a/service/ttl_test.go b/service/ttl_test.go new file mode 100644 index 0000000..1349198 --- /dev/null +++ b/service/ttl_test.go @@ -0,0 +1,72 @@ +package service + +import ( + "github.com/stretchr/testify/require" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + "testing" +) + +type mockedRequest struct { + msg string + ttl uint32 + name string + role NodeRole + code codes.Code +} + +func (m *mockedRequest) SetTTL(v uint32) { m.ttl = v } +func (m mockedRequest) GetTTL() uint32 { return m.ttl } + +func TestCheckTTLRequest(t *testing.T) { + tests := []mockedRequest{ + { + ttl: NonForwardingTTL, + role: InnerRingNode, + name: "direct to ir node", + }, + { + ttl: NonForwardingTTL, + role: StorageNode, + code: codes.InvalidArgument, + msg: ErrIncorrectTTL.Error(), + name: "direct to storage node", + }, + { + ttl: ZeroTTL, + role: StorageNode, + msg: ErrZeroTTL.Error(), + code: codes.InvalidArgument, + name: "zero ttl", + }, + { + ttl: SingleForwardingTTL, + role: InnerRingNode, + name: "default to ir node", + }, + { + ttl: SingleForwardingTTL, + role: StorageNode, + name: "default to storage node", + }, + } + + for i := range tests { + tt := tests[i] + t.Run(tt.name, func(t *testing.T) { + before := tt.ttl + err := CheckTTLRequest(&tt, tt.role) + if tt.msg != "" { + require.Errorf(t, err, tt.msg) + + state, ok := status.FromError(err) + require.True(t, ok) + require.Equal(t, state.Code(), tt.code) + require.Equal(t, state.Message(), tt.msg) + } else { + require.NoError(t, err) + require.NotEqualf(t, before, tt.ttl, "ttl should be changed: %d vs %d", before, tt.ttl) + } + }) + } +} diff --git a/session/service.go b/session/service.go new file mode 100644 index 0000000..1695c04 --- /dev/null +++ b/session/service.go @@ -0,0 +1,57 @@ +package session + +import ( + "context" + "crypto/ecdsa" + + crypto "github.com/nspcc-dev/neofs-crypto" + "github.com/nspcc-dev/neofs-proto/refs" +) + +type ( + // KeyStore is an interface that describes storage, + // that allows to fetch public keys by OwnerID. + KeyStore interface { + Get(ctx context.Context, id refs.OwnerID) ([]*ecdsa.PublicKey, error) + } + + // TokenStore is a PToken storage manipulation interface. + TokenStore interface { + // New returns new token with specified parameters. + New(p TokenParams) *PToken + + // Fetch tries to fetch a token with specified id. + Fetch(id TokenID) *PToken + + // Remove removes token with id from store. + Remove(id TokenID) + } + + // TokenParams contains params to create new PToken. + TokenParams struct { + FirstEpoch uint64 + LastEpoch uint64 + ObjectID []ObjectID + OwnerID OwnerID + } +) + +// NewInitRequest returns new initialization CreateRequest from passed Token. +func NewInitRequest(t *Token) *CreateRequest { + return &CreateRequest{Message: &CreateRequest_Init{Init: t}} +} + +// NewSignedRequest returns new signed CreateRequest from passed Token. +func NewSignedRequest(t *Token) *CreateRequest { + return &CreateRequest{Message: &CreateRequest_Signed{Signed: t}} +} + +// Sign signs contents of the header with the private key. +func (m *VerificationHeader) Sign(key *ecdsa.PrivateKey) error { + s, err := crypto.Sign(key, m.PublicKey) + if err != nil { + return err + } + m.KeySignature = s + return nil +} diff --git a/session/service.pb.go b/session/service.pb.go new file mode 100644 index 0000000..da85708 --- /dev/null +++ b/session/service.pb.go @@ -0,0 +1,922 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: session/service.proto + +package session + +import ( + context "context" + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/golang/protobuf/proto" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package + +type CreateRequest struct { + // Types that are valid to be assigned to Message: + // *CreateRequest_Init + // *CreateRequest_Signed + Message isCreateRequest_Message `protobuf_oneof:"Message"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *CreateRequest) Reset() { *m = CreateRequest{} } +func (m *CreateRequest) String() string { return proto.CompactTextString(m) } +func (*CreateRequest) ProtoMessage() {} +func (*CreateRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_b329bee0fd1148e0, []int{0} +} +func (m *CreateRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *CreateRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *CreateRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_CreateRequest.Merge(m, src) +} +func (m *CreateRequest) XXX_Size() int { + return m.Size() +} +func (m *CreateRequest) XXX_DiscardUnknown() { + xxx_messageInfo_CreateRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_CreateRequest proto.InternalMessageInfo + +type isCreateRequest_Message interface { + isCreateRequest_Message() + MarshalTo([]byte) (int, error) + Size() int +} + +type CreateRequest_Init struct { + Init *Token `protobuf:"bytes,1,opt,name=Init,proto3,oneof" json:"Init,omitempty"` +} +type CreateRequest_Signed struct { + Signed *Token `protobuf:"bytes,2,opt,name=Signed,proto3,oneof" json:"Signed,omitempty"` +} + +func (*CreateRequest_Init) isCreateRequest_Message() {} +func (*CreateRequest_Signed) isCreateRequest_Message() {} + +func (m *CreateRequest) GetMessage() isCreateRequest_Message { + if m != nil { + return m.Message + } + return nil +} + +func (m *CreateRequest) GetInit() *Token { + if x, ok := m.GetMessage().(*CreateRequest_Init); ok { + return x.Init + } + return nil +} + +func (m *CreateRequest) GetSigned() *Token { + if x, ok := m.GetMessage().(*CreateRequest_Signed); ok { + return x.Signed + } + return nil +} + +// XXX_OneofWrappers is for the internal use of the proto package. +func (*CreateRequest) XXX_OneofWrappers() []interface{} { + return []interface{}{ + (*CreateRequest_Init)(nil), + (*CreateRequest_Signed)(nil), + } +} + +type CreateResponse struct { + // Types that are valid to be assigned to Message: + // *CreateResponse_Unsigned + // *CreateResponse_Result + Message isCreateResponse_Message `protobuf_oneof:"Message"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *CreateResponse) Reset() { *m = CreateResponse{} } +func (m *CreateResponse) String() string { return proto.CompactTextString(m) } +func (*CreateResponse) ProtoMessage() {} +func (*CreateResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_b329bee0fd1148e0, []int{1} +} +func (m *CreateResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *CreateResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *CreateResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_CreateResponse.Merge(m, src) +} +func (m *CreateResponse) XXX_Size() int { + return m.Size() +} +func (m *CreateResponse) XXX_DiscardUnknown() { + xxx_messageInfo_CreateResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_CreateResponse proto.InternalMessageInfo + +type isCreateResponse_Message interface { + isCreateResponse_Message() + MarshalTo([]byte) (int, error) + Size() int +} + +type CreateResponse_Unsigned struct { + Unsigned *Token `protobuf:"bytes,1,opt,name=Unsigned,proto3,oneof" json:"Unsigned,omitempty"` +} +type CreateResponse_Result struct { + Result *Token `protobuf:"bytes,2,opt,name=Result,proto3,oneof" json:"Result,omitempty"` +} + +func (*CreateResponse_Unsigned) isCreateResponse_Message() {} +func (*CreateResponse_Result) isCreateResponse_Message() {} + +func (m *CreateResponse) GetMessage() isCreateResponse_Message { + if m != nil { + return m.Message + } + return nil +} + +func (m *CreateResponse) GetUnsigned() *Token { + if x, ok := m.GetMessage().(*CreateResponse_Unsigned); ok { + return x.Unsigned + } + return nil +} + +func (m *CreateResponse) GetResult() *Token { + if x, ok := m.GetMessage().(*CreateResponse_Result); ok { + return x.Result + } + return nil +} + +// XXX_OneofWrappers is for the internal use of the proto package. +func (*CreateResponse) XXX_OneofWrappers() []interface{} { + return []interface{}{ + (*CreateResponse_Unsigned)(nil), + (*CreateResponse_Result)(nil), + } +} + +func init() { + proto.RegisterType((*CreateRequest)(nil), "session.CreateRequest") + proto.RegisterType((*CreateResponse)(nil), "session.CreateResponse") +} + +func init() { proto.RegisterFile("session/service.proto", fileDescriptor_b329bee0fd1148e0) } + +var fileDescriptor_b329bee0fd1148e0 = []byte{ + // 284 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x90, 0xbd, 0x4e, 0xc3, 0x30, + 0x10, 0xc7, 0x6b, 0x84, 0x12, 0x30, 0xa2, 0x83, 0x11, 0x50, 0x65, 0xb0, 0x50, 0xc5, 0x90, 0x81, + 0x24, 0xa8, 0xcc, 0x30, 0x94, 0xa5, 0x0c, 0x2c, 0x29, 0x2c, 0x6c, 0x4d, 0x7a, 0x35, 0xe6, 0xc3, + 0x0e, 0x39, 0xa7, 0x12, 0x6f, 0xc2, 0x23, 0x31, 0x32, 0x32, 0xa2, 0xf0, 0x22, 0x08, 0x3b, 0xad, + 0x82, 0x50, 0x36, 0xff, 0x3f, 0x7c, 0x3f, 0xfb, 0xe8, 0x3e, 0x02, 0xa2, 0xd4, 0x2a, 0x41, 0x28, + 0x97, 0x32, 0x87, 0xb8, 0x28, 0xb5, 0xd1, 0xcc, 0x6f, 0xec, 0x60, 0x6f, 0x95, 0x9b, 0xd7, 0x02, + 0xd0, 0xa5, 0x41, 0x24, 0xa4, 0xb9, 0xaf, 0xb2, 0x38, 0xd7, 0xcf, 0x89, 0xd0, 0x42, 0x27, 0xd6, + 0xce, 0xaa, 0x85, 0x55, 0x56, 0xd8, 0x93, 0xab, 0x0f, 0x1f, 0xe8, 0xee, 0x65, 0x09, 0x33, 0x03, + 0x29, 0xbc, 0x54, 0x80, 0x86, 0x1d, 0xd3, 0xcd, 0x2b, 0x25, 0xcd, 0x80, 0x1c, 0x91, 0x70, 0x67, + 0xd4, 0x8f, 0x1b, 0x46, 0x7c, 0xa3, 0x1f, 0x41, 0x4d, 0x7a, 0xa9, 0x4d, 0x59, 0x48, 0xbd, 0xa9, + 0x14, 0x0a, 0xe6, 0x83, 0x8d, 0x8e, 0x5e, 0x93, 0x8f, 0xb7, 0xa9, 0x7f, 0x0d, 0x88, 0x33, 0x01, + 0x43, 0xa4, 0xfd, 0x15, 0x0b, 0x0b, 0xad, 0x10, 0xd8, 0x09, 0xdd, 0xba, 0x55, 0xe8, 0x06, 0x75, + 0x01, 0xd7, 0x8d, 0x5f, 0x68, 0x0a, 0x58, 0x3d, 0x99, 0x6e, 0xa8, 0xcb, 0x5b, 0xd0, 0xd1, 0x84, + 0xfa, 0x53, 0xd7, 0x62, 0xe7, 0xd4, 0x73, 0x7c, 0x76, 0xb0, 0xbe, 0xf9, 0xe7, 0xf3, 0xc1, 0xe1, + 0x3f, 0xdf, 0x3d, 0x34, 0x24, 0xa7, 0x64, 0x7c, 0xf1, 0x5e, 0x73, 0xf2, 0x51, 0x73, 0xf2, 0x59, + 0x73, 0xf2, 0x55, 0x73, 0xf2, 0xf6, 0xcd, 0x7b, 0x77, 0x61, 0x6b, 0xdf, 0x0a, 0x8b, 0x3c, 0x8f, + 0xe6, 0xb0, 0x4c, 0x14, 0xe8, 0x05, 0x46, 0x6e, 0xdb, 0xcd, 0xc8, 0xcc, 0xb3, 0xf2, 0xec, 0x27, + 0x00, 0x00, 0xff, 0xff, 0x74, 0x3d, 0x2a, 0x06, 0xd7, 0x01, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// SessionClient is the client API for Session service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type SessionClient interface { + Create(ctx context.Context, opts ...grpc.CallOption) (Session_CreateClient, error) +} + +type sessionClient struct { + cc *grpc.ClientConn +} + +func NewSessionClient(cc *grpc.ClientConn) SessionClient { + return &sessionClient{cc} +} + +func (c *sessionClient) Create(ctx context.Context, opts ...grpc.CallOption) (Session_CreateClient, error) { + stream, err := c.cc.NewStream(ctx, &_Session_serviceDesc.Streams[0], "/session.Session/Create", opts...) + if err != nil { + return nil, err + } + x := &sessionCreateClient{stream} + return x, nil +} + +type Session_CreateClient interface { + Send(*CreateRequest) error + Recv() (*CreateResponse, error) + grpc.ClientStream +} + +type sessionCreateClient struct { + grpc.ClientStream +} + +func (x *sessionCreateClient) Send(m *CreateRequest) error { + return x.ClientStream.SendMsg(m) +} + +func (x *sessionCreateClient) Recv() (*CreateResponse, error) { + m := new(CreateResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +// SessionServer is the server API for Session service. +type SessionServer interface { + Create(Session_CreateServer) error +} + +// UnimplementedSessionServer can be embedded to have forward compatible implementations. +type UnimplementedSessionServer struct { +} + +func (*UnimplementedSessionServer) Create(srv Session_CreateServer) error { + return status.Errorf(codes.Unimplemented, "method Create not implemented") +} + +func RegisterSessionServer(s *grpc.Server, srv SessionServer) { + s.RegisterService(&_Session_serviceDesc, srv) +} + +func _Session_Create_Handler(srv interface{}, stream grpc.ServerStream) error { + return srv.(SessionServer).Create(&sessionCreateServer{stream}) +} + +type Session_CreateServer interface { + Send(*CreateResponse) error + Recv() (*CreateRequest, error) + grpc.ServerStream +} + +type sessionCreateServer struct { + grpc.ServerStream +} + +func (x *sessionCreateServer) Send(m *CreateResponse) error { + return x.ServerStream.SendMsg(m) +} + +func (x *sessionCreateServer) Recv() (*CreateRequest, error) { + m := new(CreateRequest) + if err := x.ServerStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +var _Session_serviceDesc = grpc.ServiceDesc{ + ServiceName: "session.Session", + HandlerType: (*SessionServer)(nil), + Methods: []grpc.MethodDesc{}, + Streams: []grpc.StreamDesc{ + { + StreamName: "Create", + Handler: _Session_Create_Handler, + ServerStreams: true, + ClientStreams: true, + }, + }, + Metadata: "session/service.proto", +} + +func (m *CreateRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *CreateRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *CreateRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.Message != nil { + { + size := m.Message.Size() + i -= size + if _, err := m.Message.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + } + } + return len(dAtA) - i, nil +} + +func (m *CreateRequest_Init) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *CreateRequest_Init) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.Init != nil { + { + size, err := m.Init.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} +func (m *CreateRequest_Signed) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *CreateRequest_Signed) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.Signed != nil { + { + size, err := m.Signed.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + return len(dAtA) - i, nil +} +func (m *CreateResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *CreateResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *CreateResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.Message != nil { + { + size := m.Message.Size() + i -= size + if _, err := m.Message.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + } + } + return len(dAtA) - i, nil +} + +func (m *CreateResponse_Unsigned) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *CreateResponse_Unsigned) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.Unsigned != nil { + { + size, err := m.Unsigned.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} +func (m *CreateResponse_Result) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *CreateResponse_Result) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.Result != nil { + { + size, err := m.Result.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + return len(dAtA) - i, nil +} +func encodeVarintService(dAtA []byte, offset int, v uint64) int { + offset -= sovService(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *CreateRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Message != nil { + n += m.Message.Size() + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *CreateRequest_Init) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Init != nil { + l = m.Init.Size() + n += 1 + l + sovService(uint64(l)) + } + return n +} +func (m *CreateRequest_Signed) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Signed != nil { + l = m.Signed.Size() + n += 1 + l + sovService(uint64(l)) + } + return n +} +func (m *CreateResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Message != nil { + n += m.Message.Size() + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *CreateResponse_Unsigned) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Unsigned != nil { + l = m.Unsigned.Size() + n += 1 + l + sovService(uint64(l)) + } + return n +} +func (m *CreateResponse_Result) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Result != nil { + l = m.Result.Size() + n += 1 + l + sovService(uint64(l)) + } + return n +} + +func sovService(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozService(x uint64) (n int) { + return sovService(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *CreateRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CreateRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CreateRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Init", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &Token{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Message = &CreateRequest_Init{v} + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signed", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &Token{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Message = &CreateRequest_Signed{v} + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CreateResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CreateResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CreateResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Unsigned", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &Token{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Message = &CreateResponse_Unsigned{v} + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Result", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &Token{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Message = &CreateResponse_Result{v} + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipService(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowService + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowService + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowService + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthService + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupService + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthService + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthService = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowService = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupService = fmt.Errorf("proto: unexpected end of group") +) diff --git a/session/service.proto b/session/service.proto new file mode 100644 index 0000000..ee56a22 --- /dev/null +++ b/session/service.proto @@ -0,0 +1,27 @@ +syntax = "proto3"; +package session; +option go_package = "github.com/nspcc-dev/neofs-proto/session"; + +import "session/types.proto"; +import "github.com/gogo/protobuf/gogoproto/gogo.proto"; + +option (gogoproto.stable_marshaler_all) = true; + +service Session { + rpc Create (stream CreateRequest) returns (stream CreateResponse); +} + + +message CreateRequest { + oneof Message { + session.Token Init = 1; + session.Token Signed = 2; + } +} + +message CreateResponse { + oneof Message { + session.Token Unsigned = 1; + session.Token Result = 2; + } +} diff --git a/session/store.go b/session/store.go new file mode 100644 index 0000000..f12943f --- /dev/null +++ b/session/store.go @@ -0,0 +1,81 @@ +package session + +import ( + "crypto/ecdsa" + "crypto/elliptic" + "crypto/rand" + "sync" + + crypto "github.com/nspcc-dev/neofs-crypto" + "github.com/nspcc-dev/neofs-proto/refs" +) + +type simpleStore struct { + *sync.RWMutex + + tokens map[TokenID]*PToken +} + +// TODO get curve from neofs-crypto +func defaultCurve() elliptic.Curve { + return elliptic.P256() +} + +// NewSimpleStore creates simple token storage +func NewSimpleStore() TokenStore { + return &simpleStore{ + RWMutex: new(sync.RWMutex), + tokens: make(map[TokenID]*PToken), + } +} + +// New returns new token with specified parameters. +func (s *simpleStore) New(p TokenParams) *PToken { + tid, err := refs.NewUUID() + if err != nil { + return nil + } + + key, err := ecdsa.GenerateKey(defaultCurve(), rand.Reader) + if err != nil { + return nil + } + + if p.FirstEpoch > p.LastEpoch || p.OwnerID.Empty() { + return nil + } + + t := &PToken{ + mtx: new(sync.Mutex), + Token: Token{ + ID: tid, + Header: VerificationHeader{PublicKey: crypto.MarshalPublicKey(&key.PublicKey)}, + FirstEpoch: p.FirstEpoch, + LastEpoch: p.LastEpoch, + ObjectID: p.ObjectID, + OwnerID: p.OwnerID, + }, + PrivateKey: key, + } + + s.Lock() + s.tokens[t.ID] = t + s.Unlock() + + return t +} + +// Fetch tries to fetch a token with specified id. +func (s *simpleStore) Fetch(id TokenID) *PToken { + s.RLock() + defer s.RUnlock() + + return s.tokens[id] +} + +// Remove removes token with id from store. +func (s *simpleStore) Remove(id TokenID) { + s.Lock() + delete(s.tokens, id) + s.Unlock() +} diff --git a/session/store_test.go b/session/store_test.go new file mode 100644 index 0000000..1a9e977 --- /dev/null +++ b/session/store_test.go @@ -0,0 +1,84 @@ +package session + +import ( + "crypto/ecdsa" + "crypto/rand" + "testing" + + crypto "github.com/nspcc-dev/neofs-crypto" + "github.com/nspcc-dev/neofs-proto/refs" + "github.com/stretchr/testify/require" +) + +type testClient struct { + *ecdsa.PrivateKey + OwnerID OwnerID +} + +func (c *testClient) Sign(data []byte) ([]byte, error) { + return crypto.Sign(c.PrivateKey, data) +} + +func newTestClient(t *testing.T) *testClient { + key, err := ecdsa.GenerateKey(defaultCurve(), rand.Reader) + require.NoError(t, err) + + owner, err := refs.NewOwnerID(&key.PublicKey) + require.NoError(t, err) + + return &testClient{PrivateKey: key, OwnerID: owner} +} + +func signToken(t *testing.T, token *PToken, c *testClient) { + require.NotNil(t, token) + + signH, err := c.Sign(token.Header.PublicKey) + require.NoError(t, err) + require.NotNil(t, signH) + + // data is not yet signed + require.False(t, token.Verify(&c.PublicKey)) + + signT, err := c.Sign(token.verificationData()) + require.NoError(t, err) + require.NotNil(t, signT) + + token.AddSignatures(signH, signT) + require.True(t, token.Verify(&c.PublicKey)) +} + +func TestTokenStore(t *testing.T) { + s := NewSimpleStore() + + oid, err := refs.NewObjectID() + require.NoError(t, err) + + c := newTestClient(t) + require.NotNil(t, c) + + // create new token + token := s.New(TokenParams{ObjectID: []ObjectID{oid}, OwnerID: c.OwnerID}) + signToken(t, token, c) + + // check that it can be fetched + t1 := s.Fetch(token.ID) + require.NotNil(t, t1) + require.Equal(t, token, t1) + + // create and sign another token by the same client + t1 = s.New(TokenParams{ObjectID: []ObjectID{oid}, OwnerID: c.OwnerID}) + signToken(t, t1, c) + + data := []byte{1, 2, 3} + sign, err := t1.SignData(data) + require.NoError(t, err) + require.Error(t, token.Header.VerifyData(data, sign)) + + sign, err = token.SignData(data) + require.NoError(t, err) + require.NoError(t, token.Header.VerifyData(data, sign)) + + s.Remove(token.ID) + require.Nil(t, s.Fetch(token.ID)) + require.NotNil(t, s.Fetch(t1.ID)) +} diff --git a/session/types.go b/session/types.go new file mode 100644 index 0000000..ceb2944 --- /dev/null +++ b/session/types.go @@ -0,0 +1,159 @@ +package session + +import ( + "crypto/ecdsa" + "encoding/binary" + "sync" + + crypto "github.com/nspcc-dev/neofs-crypto" + "github.com/nspcc-dev/neofs-proto/internal" + "github.com/nspcc-dev/neofs-proto/refs" + "github.com/pkg/errors" +) + +type ( + // ObjectID type alias. + ObjectID = refs.ObjectID + // OwnerID type alias. + OwnerID = refs.OwnerID + // TokenID type alias. + TokenID = refs.UUID + + // PToken is a wrapper around Token that allows to sign data + // and to do thread-safe manipulations. + PToken struct { + Token + + mtx *sync.Mutex + PrivateKey *ecdsa.PrivateKey + } +) + +const ( + // ErrWrongFirstEpoch is raised when passed Token contains wrong first epoch. + // First epoch is an epoch since token is valid + ErrWrongFirstEpoch = internal.Error("wrong first epoch") + + // ErrWrongLastEpoch is raised when passed Token contains wrong last epoch. + // Last epoch is an epoch until token is valid + ErrWrongLastEpoch = internal.Error("wrong last epoch") + + // ErrWrongOwner is raised when passed Token contains wrong OwnerID. + ErrWrongOwner = internal.Error("wrong owner") + + // ErrEmptyPublicKey is raised when passed Token contains wrong public key. + ErrEmptyPublicKey = internal.Error("empty public key") + + // ErrWrongObjectsCount is raised when passed Token contains wrong objects count. + ErrWrongObjectsCount = internal.Error("wrong objects count") + + // ErrWrongObjects is raised when passed Token contains wrong object ids. + ErrWrongObjects = internal.Error("wrong objects") + + // ErrInvalidSignature is raised when wrong signature is passed to VerificationHeader.VerifyData(). + ErrInvalidSignature = internal.Error("invalid signature") +) + +// verificationData returns byte array to sign. +// Note: protobuf serialization is inconsistent as +// wire order is unspecified. +func (m *Token) verificationData() (data []byte) { + var size int + if l := len(m.ObjectID); l > 0 { + size = m.ObjectID[0].Size() + data = make([]byte, 16+l*size) + } else { + data = make([]byte, 16) + } + binary.BigEndian.PutUint64(data, m.FirstEpoch) + binary.BigEndian.PutUint64(data[8:], m.LastEpoch) + for i := range m.ObjectID { + copy(data[16+i*size:], m.ObjectID[i].Bytes()) + } + return +} + +// IsSame checks if the passed token is valid and equal to current token +func (m *Token) IsSame(t *Token) error { + switch { + case m.FirstEpoch != t.FirstEpoch: + return ErrWrongFirstEpoch + case m.LastEpoch != t.LastEpoch: + return ErrWrongLastEpoch + case !m.OwnerID.Equal(t.OwnerID): + return ErrWrongOwner + case m.Header.PublicKey == nil: + return ErrEmptyPublicKey + case len(m.ObjectID) != len(t.ObjectID): + return ErrWrongObjectsCount + default: + for i := range m.ObjectID { + if !m.ObjectID[i].Equal(t.ObjectID[i]) { + return errors.Wrapf(ErrWrongObjects, "expect %s, actual: %s", m.ObjectID[i], t.ObjectID[i]) + } + } + } + return nil +} + +// Sign tries to sign current Token data and stores signature inside it. +func (m *Token) Sign(key *ecdsa.PrivateKey) error { + if err := m.Header.Sign(key); err != nil { + return err + } + + s, err := crypto.Sign(key, m.verificationData()) + if err != nil { + return err + } + + m.Signature = s + return nil +} + +// Verify checks if token is correct and signed. +func (m *Token) Verify(keys ...*ecdsa.PublicKey) bool { + if m.FirstEpoch > m.LastEpoch { + return false + } + for i := range keys { + if m.Header.Verify(keys[i]) && crypto.Verify(keys[i], m.verificationData(), m.Signature) == nil { + return true + } + } + return false +} + +// Sign adds token signatures. +func (t *PToken) AddSignatures(signH, signT []byte) { + t.mtx.Lock() + + t.Header.KeySignature = signH + t.Signature = signT + + t.mtx.Unlock() +} + +// SignData signs data with session private key. +func (t *PToken) SignData(data []byte) ([]byte, error) { + return crypto.Sign(t.PrivateKey, data) +} + +// VerifyData checks if signature of data by token t +// is equal to sign. +func (m *VerificationHeader) VerifyData(data, sign []byte) error { + if crypto.Verify(crypto.UnmarshalPublicKey(m.PublicKey), data, sign) != nil { + return ErrInvalidSignature + } + return nil +} + +// Verify checks if verification header was issued by id. +func (m *VerificationHeader) Verify(keys ...*ecdsa.PublicKey) bool { + for i := range keys { + if crypto.Verify(keys[i], m.PublicKey, m.KeySignature) == nil { + return true + } + } + return false +} diff --git a/session/types.pb.go b/session/types.pb.go new file mode 100644 index 0000000..ce0e0a4 --- /dev/null +++ b/session/types.pb.go @@ -0,0 +1,845 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: session/types.proto + +package session + +import ( + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/golang/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package + +type VerificationHeader struct { + PublicKey []byte `protobuf:"bytes,1,opt,name=PublicKey,proto3" json:"PublicKey,omitempty"` + KeySignature []byte `protobuf:"bytes,2,opt,name=KeySignature,proto3" json:"KeySignature,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *VerificationHeader) Reset() { *m = VerificationHeader{} } +func (m *VerificationHeader) String() string { return proto.CompactTextString(m) } +func (*VerificationHeader) ProtoMessage() {} +func (*VerificationHeader) Descriptor() ([]byte, []int) { + return fileDescriptor_c0d9d9cb855cdad8, []int{0} +} +func (m *VerificationHeader) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *VerificationHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *VerificationHeader) XXX_Merge(src proto.Message) { + xxx_messageInfo_VerificationHeader.Merge(m, src) +} +func (m *VerificationHeader) XXX_Size() int { + return m.Size() +} +func (m *VerificationHeader) XXX_DiscardUnknown() { + xxx_messageInfo_VerificationHeader.DiscardUnknown(m) +} + +var xxx_messageInfo_VerificationHeader proto.InternalMessageInfo + +func (m *VerificationHeader) GetPublicKey() []byte { + if m != nil { + return m.PublicKey + } + return nil +} + +func (m *VerificationHeader) GetKeySignature() []byte { + if m != nil { + return m.KeySignature + } + return nil +} + +type Token struct { + Header VerificationHeader `protobuf:"bytes,1,opt,name=Header,proto3" json:"Header"` + OwnerID OwnerID `protobuf:"bytes,2,opt,name=OwnerID,proto3,customtype=OwnerID" json:"OwnerID"` + FirstEpoch uint64 `protobuf:"varint,3,opt,name=FirstEpoch,proto3" json:"FirstEpoch,omitempty"` + LastEpoch uint64 `protobuf:"varint,4,opt,name=LastEpoch,proto3" json:"LastEpoch,omitempty"` + ObjectID []ObjectID `protobuf:"bytes,5,rep,name=ObjectID,proto3,customtype=ObjectID" json:"ObjectID"` + Signature []byte `protobuf:"bytes,6,opt,name=Signature,proto3" json:"Signature,omitempty"` + ID TokenID `protobuf:"bytes,7,opt,name=ID,proto3,customtype=TokenID" json:"ID"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Token) Reset() { *m = Token{} } +func (m *Token) String() string { return proto.CompactTextString(m) } +func (*Token) ProtoMessage() {} +func (*Token) Descriptor() ([]byte, []int) { + return fileDescriptor_c0d9d9cb855cdad8, []int{1} +} +func (m *Token) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Token) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *Token) XXX_Merge(src proto.Message) { + xxx_messageInfo_Token.Merge(m, src) +} +func (m *Token) XXX_Size() int { + return m.Size() +} +func (m *Token) XXX_DiscardUnknown() { + xxx_messageInfo_Token.DiscardUnknown(m) +} + +var xxx_messageInfo_Token proto.InternalMessageInfo + +func (m *Token) GetHeader() VerificationHeader { + if m != nil { + return m.Header + } + return VerificationHeader{} +} + +func (m *Token) GetFirstEpoch() uint64 { + if m != nil { + return m.FirstEpoch + } + return 0 +} + +func (m *Token) GetLastEpoch() uint64 { + if m != nil { + return m.LastEpoch + } + return 0 +} + +func (m *Token) GetSignature() []byte { + if m != nil { + return m.Signature + } + return nil +} + +func init() { + proto.RegisterType((*VerificationHeader)(nil), "session.VerificationHeader") + proto.RegisterType((*Token)(nil), "session.Token") +} + +func init() { proto.RegisterFile("session/types.proto", fileDescriptor_c0d9d9cb855cdad8) } + +var fileDescriptor_c0d9d9cb855cdad8 = []byte{ + // 344 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x91, 0x4d, 0x4b, 0xc3, 0x30, + 0x18, 0xc7, 0x97, 0xee, 0x4d, 0xe3, 0x40, 0x89, 0x97, 0xa2, 0xd2, 0x8d, 0x9d, 0x2a, 0xb8, 0x16, + 0xf4, 0xe4, 0xc5, 0x43, 0xa9, 0x62, 0x99, 0x30, 0xa9, 0xb2, 0x83, 0xb7, 0x36, 0xcb, 0xba, 0xf8, + 0x92, 0x94, 0x26, 0x55, 0xf6, 0x4d, 0xf6, 0x91, 0x76, 0xf4, 0x28, 0x1e, 0x86, 0xd4, 0x2f, 0x22, + 0x4b, 0xbb, 0x75, 0xc3, 0xdb, 0xf3, 0xfc, 0xfe, 0xc9, 0xf3, 0xf2, 0x7f, 0xe0, 0xa1, 0x20, 0x42, + 0x50, 0xce, 0x6c, 0x39, 0x8d, 0x89, 0xb0, 0xe2, 0x84, 0x4b, 0x8e, 0x9a, 0x05, 0x3c, 0xea, 0x45, + 0x54, 0x4e, 0xd2, 0xd0, 0xc2, 0xfc, 0xcd, 0x8e, 0x78, 0xc4, 0x6d, 0xa5, 0x87, 0xe9, 0x58, 0x65, + 0x2a, 0x51, 0x51, 0xfe, 0xaf, 0x3b, 0x84, 0x68, 0x48, 0x12, 0x3a, 0xa6, 0x38, 0x90, 0x94, 0xb3, + 0x5b, 0x12, 0x8c, 0x48, 0x82, 0x4e, 0xe0, 0xee, 0x7d, 0x1a, 0xbe, 0x52, 0xdc, 0x27, 0x53, 0x1d, + 0x74, 0x80, 0xd9, 0xf2, 0x4b, 0x80, 0xba, 0xb0, 0xd5, 0x27, 0xd3, 0x07, 0x1a, 0xb1, 0x40, 0xa6, + 0x09, 0xd1, 0x35, 0xf5, 0x60, 0x8b, 0x75, 0x67, 0x1a, 0xac, 0x3f, 0xf2, 0x17, 0xc2, 0xd0, 0x25, + 0x6c, 0xe4, 0x55, 0x55, 0xa1, 0xbd, 0xf3, 0x63, 0xab, 0x18, 0xd5, 0xfa, 0xdf, 0xd8, 0xa9, 0xcd, + 0x17, 0xed, 0x8a, 0x5f, 0x7c, 0x40, 0xa7, 0xb0, 0x39, 0xf8, 0x60, 0x24, 0xf1, 0xdc, 0xbc, 0x87, + 0xb3, 0xbf, 0x94, 0xbf, 0x17, 0xed, 0x15, 0xf6, 0x57, 0x01, 0x32, 0x20, 0xbc, 0xa1, 0x89, 0x90, + 0xd7, 0x31, 0xc7, 0x13, 0xbd, 0xda, 0x01, 0x66, 0xcd, 0xdf, 0x20, 0xcb, 0x8d, 0xee, 0x82, 0x95, + 0x5c, 0x53, 0x72, 0x09, 0xd0, 0x19, 0xdc, 0x19, 0x84, 0xcf, 0x04, 0x4b, 0xcf, 0xd5, 0xeb, 0x9d, + 0xaa, 0xd9, 0x72, 0x0e, 0x8a, 0x4e, 0x6b, 0xee, 0xaf, 0xa3, 0x65, 0xad, 0x72, 0xf9, 0x46, 0xee, + 0xce, 0x1a, 0xa0, 0x36, 0xd4, 0x3c, 0x57, 0x6f, 0x6e, 0xcf, 0xab, 0xac, 0xf0, 0x5c, 0x5f, 0xf3, + 0x5c, 0xe7, 0x6a, 0x9e, 0x19, 0xe0, 0x33, 0x33, 0xc0, 0x57, 0x66, 0x80, 0x9f, 0xcc, 0x00, 0xb3, + 0x5f, 0xa3, 0xf2, 0x64, 0x6e, 0xdc, 0x8d, 0x89, 0x18, 0xe3, 0xde, 0x88, 0xbc, 0xdb, 0x8c, 0xf0, + 0xb1, 0xe8, 0xe5, 0x57, 0x2b, 0x6c, 0x0b, 0x1b, 0x2a, 0xbd, 0xf8, 0x0b, 0x00, 0x00, 0xff, 0xff, + 0xc6, 0x87, 0x25, 0xf9, 0x08, 0x02, 0x00, 0x00, +} + +func (m *VerificationHeader) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *VerificationHeader) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *VerificationHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.KeySignature) > 0 { + i -= len(m.KeySignature) + copy(dAtA[i:], m.KeySignature) + i = encodeVarintTypes(dAtA, i, uint64(len(m.KeySignature))) + i-- + dAtA[i] = 0x12 + } + if len(m.PublicKey) > 0 { + i -= len(m.PublicKey) + copy(dAtA[i:], m.PublicKey) + i = encodeVarintTypes(dAtA, i, uint64(len(m.PublicKey))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Token) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Token) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Token) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + { + size := m.ID.Size() + i -= size + if _, err := m.ID.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3a + if len(m.Signature) > 0 { + i -= len(m.Signature) + copy(dAtA[i:], m.Signature) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Signature))) + i-- + dAtA[i] = 0x32 + } + if len(m.ObjectID) > 0 { + for iNdEx := len(m.ObjectID) - 1; iNdEx >= 0; iNdEx-- { + { + size := m.ObjectID[iNdEx].Size() + i -= size + if _, err := m.ObjectID[iNdEx].MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + } + } + if m.LastEpoch != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.LastEpoch)) + i-- + dAtA[i] = 0x20 + } + if m.FirstEpoch != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.FirstEpoch)) + i-- + dAtA[i] = 0x18 + } + { + size := m.OwnerID.Size() + i -= size + if _, err := m.OwnerID.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func encodeVarintTypes(dAtA []byte, offset int, v uint64) int { + offset -= sovTypes(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *VerificationHeader) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.PublicKey) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.KeySignature) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *Token) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Header.Size() + n += 1 + l + sovTypes(uint64(l)) + l = m.OwnerID.Size() + n += 1 + l + sovTypes(uint64(l)) + if m.FirstEpoch != 0 { + n += 1 + sovTypes(uint64(m.FirstEpoch)) + } + if m.LastEpoch != 0 { + n += 1 + sovTypes(uint64(m.LastEpoch)) + } + if len(m.ObjectID) > 0 { + for _, e := range m.ObjectID { + l = e.Size() + n += 1 + l + sovTypes(uint64(l)) + } + } + l = len(m.Signature) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = m.ID.Size() + n += 1 + l + sovTypes(uint64(l)) + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovTypes(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozTypes(x uint64) (n int) { + return sovTypes(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *VerificationHeader) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: VerificationHeader: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: VerificationHeader: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PublicKey", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PublicKey = append(m.PublicKey[:0], dAtA[iNdEx:postIndex]...) + if m.PublicKey == nil { + m.PublicKey = []byte{} + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field KeySignature", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.KeySignature = append(m.KeySignature[:0], dAtA[iNdEx:postIndex]...) + if m.KeySignature == nil { + m.KeySignature = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Token) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Token: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Token: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Header.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OwnerID", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.OwnerID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field FirstEpoch", wireType) + } + m.FirstEpoch = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.FirstEpoch |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field LastEpoch", wireType) + } + m.LastEpoch = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.LastEpoch |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ObjectID", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var v ObjectID + m.ObjectID = append(m.ObjectID, v) + if err := m.ObjectID[len(m.ObjectID)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signature", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Signature = append(m.Signature[:0], dAtA[iNdEx:postIndex]...) + if m.Signature == nil { + m.Signature = []byte{} + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipTypes(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthTypes + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTypes + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthTypes + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthTypes = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTypes = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTypes = fmt.Errorf("proto: unexpected end of group") +) diff --git a/session/types.proto b/session/types.proto new file mode 100644 index 0000000..8989040 --- /dev/null +++ b/session/types.proto @@ -0,0 +1,22 @@ +syntax = "proto3"; +package session; +option go_package = "github.com/nspcc-dev/neofs-proto/session"; + +import "github.com/gogo/protobuf/gogoproto/gogo.proto"; + +option (gogoproto.stable_marshaler_all) = true; + +message VerificationHeader { + bytes PublicKey = 1; + bytes KeySignature = 2; +} + +message Token { + VerificationHeader Header = 1 [(gogoproto.nullable) = false]; + bytes OwnerID = 2 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false]; + uint64 FirstEpoch = 3; + uint64 LastEpoch = 4; + repeated bytes ObjectID = 5 [(gogoproto.customtype) = "ObjectID", (gogoproto.nullable) = false]; + bytes Signature = 6; + bytes ID = 7 [(gogoproto.customtype) = "TokenID", (gogoproto.nullable) = false]; +} diff --git a/state/service.go b/state/service.go new file mode 100644 index 0000000..dd2ec9b --- /dev/null +++ b/state/service.go @@ -0,0 +1,48 @@ +package state + +import ( + "github.com/golang/protobuf/proto" + "github.com/prometheus/client_golang/prometheus" + dto "github.com/prometheus/client_model/go" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +// MetricFamily is type alias for proto.Message generated +// from github.com/prometheus/client_model/metrics.proto. +type MetricFamily = dto.MetricFamily + +// EncodeMetrics encodes metrics from gatherer into MetricsResponse message, +// if something went wrong returns gRPC Status error (can be returned from service). +func EncodeMetrics(g prometheus.Gatherer) (*MetricsResponse, error) { + metrics, err := g.Gather() + if err != nil { + return nil, status.New(codes.Internal, err.Error()).Err() + } + + results := make([][]byte, 0, len(metrics)) + for _, mf := range metrics { + item, err := proto.Marshal(mf) + if err != nil { + return nil, status.New(codes.Internal, err.Error()).Err() + } + + results = append(results, item) + } + + return &MetricsResponse{Metrics: results}, nil +} + +// DecodeMetrics decodes metrics from MetricsResponse to []MetricFamily, +// if something went wrong returns error. +func DecodeMetrics(r *MetricsResponse) ([]*MetricFamily, error) { + metrics := make([]*dto.MetricFamily, 0, len(r.Metrics)) + for i := range r.Metrics { + mf := new(MetricFamily) + if err := proto.Unmarshal(r.Metrics[i], mf); err != nil { + return nil, err + } + } + + return metrics, nil +} diff --git a/state/service.pb.go b/state/service.pb.go new file mode 100644 index 0000000..f71dad6 --- /dev/null +++ b/state/service.pb.go @@ -0,0 +1,1111 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: state/service.proto + +package state + +import ( + context "context" + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/golang/protobuf/proto" + bootstrap "github.com/nspcc-dev/neofs-proto/bootstrap" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package + +// NetmapRequest message to request current node netmap +type NetmapRequest struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *NetmapRequest) Reset() { *m = NetmapRequest{} } +func (m *NetmapRequest) String() string { return proto.CompactTextString(m) } +func (*NetmapRequest) ProtoMessage() {} +func (*NetmapRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_695592f6f2fc97b7, []int{0} +} +func (m *NetmapRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *NetmapRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *NetmapRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_NetmapRequest.Merge(m, src) +} +func (m *NetmapRequest) XXX_Size() int { + return m.Size() +} +func (m *NetmapRequest) XXX_DiscardUnknown() { + xxx_messageInfo_NetmapRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_NetmapRequest proto.InternalMessageInfo + +// MetricsRequest message to request node metrics +type MetricsRequest struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *MetricsRequest) Reset() { *m = MetricsRequest{} } +func (m *MetricsRequest) String() string { return proto.CompactTextString(m) } +func (*MetricsRequest) ProtoMessage() {} +func (*MetricsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_695592f6f2fc97b7, []int{1} +} +func (m *MetricsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MetricsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *MetricsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_MetricsRequest.Merge(m, src) +} +func (m *MetricsRequest) XXX_Size() int { + return m.Size() +} +func (m *MetricsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_MetricsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_MetricsRequest proto.InternalMessageInfo + +// MetricsResponse contains [][]byte, +// every []byte is marshaled MetricFamily proto message +// from github.com/prometheus/client_model/metrics.proto +type MetricsResponse struct { + Metrics [][]byte `protobuf:"bytes,1,rep,name=Metrics,proto3" json:"Metrics,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *MetricsResponse) Reset() { *m = MetricsResponse{} } +func (m *MetricsResponse) String() string { return proto.CompactTextString(m) } +func (*MetricsResponse) ProtoMessage() {} +func (*MetricsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_695592f6f2fc97b7, []int{2} +} +func (m *MetricsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MetricsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *MetricsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MetricsResponse.Merge(m, src) +} +func (m *MetricsResponse) XXX_Size() int { + return m.Size() +} +func (m *MetricsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MetricsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MetricsResponse proto.InternalMessageInfo + +func (m *MetricsResponse) GetMetrics() [][]byte { + if m != nil { + return m.Metrics + } + return nil +} + +// HealthRequest message to check current state +type HealthRequest struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *HealthRequest) Reset() { *m = HealthRequest{} } +func (m *HealthRequest) String() string { return proto.CompactTextString(m) } +func (*HealthRequest) ProtoMessage() {} +func (*HealthRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_695592f6f2fc97b7, []int{3} +} +func (m *HealthRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *HealthRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *HealthRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_HealthRequest.Merge(m, src) +} +func (m *HealthRequest) XXX_Size() int { + return m.Size() +} +func (m *HealthRequest) XXX_DiscardUnknown() { + xxx_messageInfo_HealthRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_HealthRequest proto.InternalMessageInfo + +// HealthResponse message with current state +type HealthResponse struct { + Healthy bool `protobuf:"varint,1,opt,name=Healthy,proto3" json:"Healthy,omitempty"` + Status string `protobuf:"bytes,2,opt,name=Status,proto3" json:"Status,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *HealthResponse) Reset() { *m = HealthResponse{} } +func (m *HealthResponse) String() string { return proto.CompactTextString(m) } +func (*HealthResponse) ProtoMessage() {} +func (*HealthResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_695592f6f2fc97b7, []int{4} +} +func (m *HealthResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *HealthResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *HealthResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_HealthResponse.Merge(m, src) +} +func (m *HealthResponse) XXX_Size() int { + return m.Size() +} +func (m *HealthResponse) XXX_DiscardUnknown() { + xxx_messageInfo_HealthResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_HealthResponse proto.InternalMessageInfo + +func (m *HealthResponse) GetHealthy() bool { + if m != nil { + return m.Healthy + } + return false +} + +func (m *HealthResponse) GetStatus() string { + if m != nil { + return m.Status + } + return "" +} + +func init() { + proto.RegisterType((*NetmapRequest)(nil), "state.NetmapRequest") + proto.RegisterType((*MetricsRequest)(nil), "state.MetricsRequest") + proto.RegisterType((*MetricsResponse)(nil), "state.MetricsResponse") + proto.RegisterType((*HealthRequest)(nil), "state.HealthRequest") + proto.RegisterType((*HealthResponse)(nil), "state.HealthResponse") +} + +func init() { proto.RegisterFile("state/service.proto", fileDescriptor_695592f6f2fc97b7) } + +var fileDescriptor_695592f6f2fc97b7 = []byte{ + // 320 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x5c, 0x91, 0xbf, 0x4e, 0xc3, 0x30, + 0x10, 0xc6, 0x31, 0x88, 0x02, 0x06, 0x5a, 0x64, 0xda, 0x2a, 0xca, 0x10, 0x55, 0x1d, 0x50, 0x25, + 0xd4, 0x44, 0x02, 0x06, 0x84, 0x98, 0xca, 0xc2, 0x52, 0x86, 0x74, 0x63, 0x73, 0xdc, 0xeb, 0x1f, + 0x41, 0x6b, 0x13, 0x5f, 0x2a, 0xf5, 0x4d, 0x78, 0x10, 0x1e, 0x82, 0x91, 0x91, 0x11, 0x85, 0x17, + 0x41, 0xd8, 0x71, 0x20, 0xdd, 0xf2, 0xfd, 0x2e, 0xdf, 0xf9, 0xbb, 0x3b, 0x7a, 0xaa, 0x91, 0x23, + 0x44, 0x1a, 0xd2, 0xd5, 0x5c, 0x40, 0xa8, 0x52, 0x89, 0x92, 0xed, 0x1a, 0xe8, 0xb7, 0x12, 0x29, + 0x51, 0x63, 0xca, 0x55, 0x84, 0x6b, 0x05, 0xda, 0x56, 0xfd, 0xfe, 0x74, 0x8e, 0xb3, 0x2c, 0x09, + 0x85, 0x5c, 0x44, 0x53, 0x39, 0x95, 0x91, 0xc1, 0x49, 0x36, 0x31, 0xca, 0x08, 0xf3, 0x65, 0x7f, + 0xef, 0x36, 0xe8, 0xf1, 0x03, 0xe0, 0x82, 0xab, 0x18, 0x5e, 0x32, 0xd0, 0xd8, 0x3d, 0xa1, 0xf5, + 0x21, 0x60, 0x3a, 0x17, 0xda, 0x91, 0x73, 0xda, 0x28, 0x89, 0x56, 0x72, 0xa9, 0x81, 0x79, 0x74, + 0xaf, 0x40, 0x1e, 0xe9, 0xec, 0xf4, 0x8e, 0x62, 0x27, 0x7f, 0xfb, 0xdd, 0x03, 0x7f, 0xc6, 0x99, + 0x73, 0x0f, 0x68, 0xdd, 0x81, 0x3f, 0xb3, 0x25, 0x6b, 0x8f, 0x74, 0x48, 0x6f, 0x3f, 0x76, 0x92, + 0xb5, 0x69, 0x6d, 0x84, 0x1c, 0x33, 0xed, 0x6d, 0x77, 0x48, 0xef, 0x20, 0x2e, 0xd4, 0xc5, 0x1b, + 0x71, 0x05, 0x76, 0x45, 0x6b, 0x36, 0x2f, 0x6b, 0x86, 0x66, 0x0f, 0x61, 0x25, 0xbe, 0xdf, 0x0c, + 0xcb, 0xb5, 0x84, 0x23, 0x95, 0x02, 0x1f, 0x0f, 0xb9, 0x62, 0xd7, 0x65, 0x5e, 0xd6, 0x2a, 0x6c, + 0xd5, 0x21, 0xfd, 0xf6, 0x26, 0x2e, 0xc2, 0xde, 0xd0, 0x43, 0x9b, 0xee, 0x6e, 0x06, 0xe2, 0xa9, + 0x7c, 0xb4, 0x32, 0xa3, 0xdf, 0xda, 0xa0, 0xd6, 0x3b, 0xb8, 0x7d, 0xcf, 0x03, 0xf2, 0x91, 0x07, + 0xe4, 0x33, 0x0f, 0xc8, 0x57, 0x1e, 0x90, 0xd7, 0xef, 0x60, 0xeb, 0xf1, 0xec, 0xdf, 0x81, 0x96, + 0x5a, 0x09, 0xd1, 0x1f, 0xc3, 0x2a, 0x5a, 0x82, 0x9c, 0xe8, 0xbe, 0x3d, 0x8f, 0x69, 0x96, 0xd4, + 0x8c, 0xb8, 0xfc, 0x09, 0x00, 0x00, 0xff, 0xff, 0x73, 0xd9, 0x9d, 0xd0, 0x04, 0x02, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// StatusClient is the client API for Status service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type StatusClient interface { + Netmap(ctx context.Context, in *NetmapRequest, opts ...grpc.CallOption) (*bootstrap.SpreadMap, error) + Metrics(ctx context.Context, in *MetricsRequest, opts ...grpc.CallOption) (*MetricsResponse, error) + HealthCheck(ctx context.Context, in *HealthRequest, opts ...grpc.CallOption) (*HealthResponse, error) +} + +type statusClient struct { + cc *grpc.ClientConn +} + +func NewStatusClient(cc *grpc.ClientConn) StatusClient { + return &statusClient{cc} +} + +func (c *statusClient) Netmap(ctx context.Context, in *NetmapRequest, opts ...grpc.CallOption) (*bootstrap.SpreadMap, error) { + out := new(bootstrap.SpreadMap) + err := c.cc.Invoke(ctx, "/state.Status/Netmap", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *statusClient) Metrics(ctx context.Context, in *MetricsRequest, opts ...grpc.CallOption) (*MetricsResponse, error) { + out := new(MetricsResponse) + err := c.cc.Invoke(ctx, "/state.Status/Metrics", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *statusClient) HealthCheck(ctx context.Context, in *HealthRequest, opts ...grpc.CallOption) (*HealthResponse, error) { + out := new(HealthResponse) + err := c.cc.Invoke(ctx, "/state.Status/HealthCheck", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// StatusServer is the server API for Status service. +type StatusServer interface { + Netmap(context.Context, *NetmapRequest) (*bootstrap.SpreadMap, error) + Metrics(context.Context, *MetricsRequest) (*MetricsResponse, error) + HealthCheck(context.Context, *HealthRequest) (*HealthResponse, error) +} + +// UnimplementedStatusServer can be embedded to have forward compatible implementations. +type UnimplementedStatusServer struct { +} + +func (*UnimplementedStatusServer) Netmap(ctx context.Context, req *NetmapRequest) (*bootstrap.SpreadMap, error) { + return nil, status.Errorf(codes.Unimplemented, "method Netmap not implemented") +} +func (*UnimplementedStatusServer) Metrics(ctx context.Context, req *MetricsRequest) (*MetricsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Metrics not implemented") +} +func (*UnimplementedStatusServer) HealthCheck(ctx context.Context, req *HealthRequest) (*HealthResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method HealthCheck not implemented") +} + +func RegisterStatusServer(s *grpc.Server, srv StatusServer) { + s.RegisterService(&_Status_serviceDesc, srv) +} + +func _Status_Netmap_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(NetmapRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(StatusServer).Netmap(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/state.Status/Netmap", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(StatusServer).Netmap(ctx, req.(*NetmapRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Status_Metrics_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MetricsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(StatusServer).Metrics(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/state.Status/Metrics", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(StatusServer).Metrics(ctx, req.(*MetricsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Status_HealthCheck_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(HealthRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(StatusServer).HealthCheck(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/state.Status/HealthCheck", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(StatusServer).HealthCheck(ctx, req.(*HealthRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Status_serviceDesc = grpc.ServiceDesc{ + ServiceName: "state.Status", + HandlerType: (*StatusServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Netmap", + Handler: _Status_Netmap_Handler, + }, + { + MethodName: "Metrics", + Handler: _Status_Metrics_Handler, + }, + { + MethodName: "HealthCheck", + Handler: _Status_HealthCheck_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "state/service.proto", +} + +func (m *NetmapRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *NetmapRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *NetmapRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + return len(dAtA) - i, nil +} + +func (m *MetricsRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MetricsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MetricsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + return len(dAtA) - i, nil +} + +func (m *MetricsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MetricsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MetricsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Metrics) > 0 { + for iNdEx := len(m.Metrics) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Metrics[iNdEx]) + copy(dAtA[i:], m.Metrics[iNdEx]) + i = encodeVarintService(dAtA, i, uint64(len(m.Metrics[iNdEx]))) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *HealthRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *HealthRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *HealthRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + return len(dAtA) - i, nil +} + +func (m *HealthResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *HealthResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *HealthResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Status) > 0 { + i -= len(m.Status) + copy(dAtA[i:], m.Status) + i = encodeVarintService(dAtA, i, uint64(len(m.Status))) + i-- + dAtA[i] = 0x12 + } + if m.Healthy { + i-- + if m.Healthy { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func encodeVarintService(dAtA []byte, offset int, v uint64) int { + offset -= sovService(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *NetmapRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *MetricsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *MetricsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Metrics) > 0 { + for _, b := range m.Metrics { + l = len(b) + n += 1 + l + sovService(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *HealthRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *HealthResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Healthy { + n += 2 + } + l = len(m.Status) + if l > 0 { + n += 1 + l + sovService(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovService(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozService(x uint64) (n int) { + return sovService(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *NetmapRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: NetmapRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: NetmapRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MetricsRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MetricsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MetricsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MetricsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MetricsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MetricsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Metrics", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Metrics = append(m.Metrics, make([]byte, postIndex-iNdEx)) + copy(m.Metrics[len(m.Metrics)-1], dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *HealthRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: HealthRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: HealthRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *HealthResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: HealthResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: HealthResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Healthy", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Healthy = bool(v != 0) + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Status = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipService(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowService + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowService + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowService + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthService + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupService + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthService + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthService = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowService = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupService = fmt.Errorf("proto: unexpected end of group") +) diff --git a/state/service.proto b/state/service.proto new file mode 100644 index 0000000..d0e59b4 --- /dev/null +++ b/state/service.proto @@ -0,0 +1,37 @@ +syntax = "proto3"; +package state; +option go_package = "github.com/nspcc-dev/neofs-proto/state"; + +import "bootstrap/types.proto"; +import "github.com/gogo/protobuf/gogoproto/gogo.proto"; + +option (gogoproto.stable_marshaler_all) = true; + +// The Status service definition. +service Status { + rpc Netmap(NetmapRequest) returns (bootstrap.SpreadMap); + rpc Metrics(MetricsRequest) returns (MetricsResponse); + rpc HealthCheck(HealthRequest) returns (HealthResponse); +} + +// NetmapRequest message to request current node netmap +message NetmapRequest {} + +// MetricsRequest message to request node metrics +message MetricsRequest {} + +// MetricsResponse contains [][]byte, +// every []byte is marshaled MetricFamily proto message +// from github.com/prometheus/client_model/metrics.proto +message MetricsResponse { + repeated bytes Metrics = 1; +} + +// HealthRequest message to check current state +message HealthRequest {} + +// HealthResponse message with current state +message HealthResponse { + bool Healthy = 1; + string Status = 2; +} From 04a5b80550190b46167d1dedae070d4ffcaeac2a Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Wed, 20 Nov 2019 16:40:06 +0300 Subject: [PATCH 0003/1196] docs: prepare template and gen make command - add markdown simple template - add Makefile `docgen` command --- .github/markdown.tmpl | 83 +++++++++++++++++++++++++++++++++++++++++++ Makefile | 33 ++++++++++++++--- docs/.gitkeep | 0 3 files changed, 112 insertions(+), 4 deletions(-) create mode 100644 .github/markdown.tmpl create mode 100644 docs/.gitkeep diff --git a/.github/markdown.tmpl b/.github/markdown.tmpl new file mode 100644 index 0000000..f945c13 --- /dev/null +++ b/.github/markdown.tmpl @@ -0,0 +1,83 @@ +# Protocol Documentation + + +## Table of Contents +{{range .Files}} +{{$file_name := .Name}}- [{{.Name}}](#{{.Name}}) +{{if .Services}} - Services + {{range .Services}}- [{{.Name}}](#{{.FullName}}) + {{end}}{{end}} +{{if .Messages}} - Messages + {{range .Messages}}- [{{.LongName}}](#{{.FullName}}) + {{end}}{{end}} +{{end}} +- [Scalar Value Types](#scalar-value-types) + +{{range .Files}} +{{$file_name := .Name}} + +

Top

+ +## {{.Name}} +{{.Description}} + +{{range .Services}} + + + +### Service "{{.FullName}}" +{{.Description}} + +``` +{{range .Methods -}} + rpc {{.Name}}({{if .RequestStreaming}}stream {{end}}{{.RequestLongType}}) returns ({{if .ResponseStreaming}}stream {{end}}{{.ResponseLongType}}); +{{end}} +``` + +{{range .Methods -}} +#### Method {{.Name}} + +{{.Description}} + +| Name | Input | Output | +| ---- | ----- | ------ | +| {{.Name}} | [{{.RequestLongType}}](#{{.RequestFullType}}) | [{{.ResponseLongType}}](#{{.ResponseFullType}}) | +{{end}}{{end}} + +{{range .Messages}} + + +### Message {{.LongName}} +{{.Description}} + +{{if .HasFields}} +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +{{range .Fields -}} + | {{.Name}} | [{{.LongType}}](#{{.FullType}}) | {{.Label}} | {{nobr .Description}}{{if .DefaultValue}} Default: {{.DefaultValue}}{{end}} | +{{end}}{{end}} +{{end}} + +{{range .Enums}} + + +### {{.LongName}} +{{.Description}} + +| Name | Number | Description | +| ---- | ------ | ----------- | +{{range .Values -}} + | {{.Name}} | {{.Number}} | {{nobr .Description}} | +{{end}} + +{{end}} + +{{end}} + +## Scalar Value Types + +| .proto Type | Notes | C++ Type | Java Type | Python Type | +| ----------- | ----- | -------- | --------- | ----------- | +{{range .Scalars -}} + | {{.ProtoType}} | {{.Notes}} | {{.CppType}} | {{.JavaType}} | {{.PythonType}} | +{{end}} diff --git a/Makefile b/Makefile index c17477a..64b0939 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,26 @@ +B=\033[0;1m +G=\033[0;92m +R=\033[0m + +# Reformat code +format: + @[ ! -z `which goimports` ] || (echo "install goimports" && exit 2) + @for f in `find . -type f -name '*.go' -not -path './vendor/*' -not -name '*.pb.go' -prune`; do \ + echo "${B}${G}⇒ Processing $$f ${R}"; \ + goimports -w $$f; \ + done + +# Regenerate documentation for protot files: +docgen: + @for f in `find . -type f -name '*.proto' -not -path './vendor/*' -exec dirname {} \; | sort -u `; do \ + echo "${B}${G}⇒ Documentation for $$(basename $$f) ${R}"; \ + protoc \ + --doc_opt=.github/markdown.tmpl,$${f}.md \ + --proto_path=.:./vendor:/usr/local/include \ + --doc_out=docs/ $${f}/*.proto; \ + done + +# Regenerate proto files: protoc: @go mod tidy -v @go mod vendor @@ -6,7 +29,9 @@ protoc: # Install specific version for protobuf lib @go list -f '{{.Path}}/...@{{.Version}}' -m github.com/golang/protobuf | xargs go get -v # Protoc generate - @find . -type f -name '*.proto' -not -path './vendor/*' \ - -exec protoc \ - --proto_path=.:./vendor \ - --gofast_out=plugins=grpc,paths=source_relative:. '{}' \; + @for f in `find . -type f -name '*.proto' -not -path './vendor/*'`; do \ + echo "${B}${G}⇒ Processing $$f ${R}"; \ + protoc \ + --proto_path=.:./vendor:/usr/local/include \ + --gofast_out=plugins=grpc,paths=source_relative:. $$f; \ + done diff --git a/docs/.gitkeep b/docs/.gitkeep new file mode 100644 index 0000000..e69de29 From 5befe14968a3b5eff2db684299830748a2b1ac36 Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Wed, 20 Nov 2019 18:57:51 +0300 Subject: [PATCH 0004/1196] docs: add accounting proto documentation --- accounting/service.proto | 8 ++++++ accounting/types.proto | 54 ++++++++++++++++++++++++++------------- accounting/withdraw.proto | 33 ++++++++++++++++++++++++ 3 files changed, 77 insertions(+), 18 deletions(-) diff --git a/accounting/service.proto b/accounting/service.proto index b75bf9c..f975c23 100644 --- a/accounting/service.proto +++ b/accounting/service.proto @@ -8,16 +8,24 @@ import "github.com/gogo/protobuf/gogoproto/gogo.proto"; option (gogoproto.stable_marshaler_all) = true; +// Accounting is a service that provides access for accounting balance +// information service Accounting { + // Balance returns current balance status of the NeoFS user rpc Balance(BalanceRequest) returns (BalanceResponse); } message BalanceRequest { + // OwnerID is a wallet address bytes OwnerID = 1 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false]; + // TTL must be larger than zero, it decreased in every neofs-node uint32 TTL = 2; } message BalanceResponse { + // Balance contains current account balance state decimal.Decimal Balance = 1; + // LockAccounts contains information about locked funds. Locked funds appear + // when user pays for storage or withdraw assets. repeated Account LockAccounts = 2; } diff --git a/accounting/types.proto b/accounting/types.proto index 1b4e783..ac512b9 100644 --- a/accounting/types.proto +++ b/accounting/types.proto @@ -7,61 +7,63 @@ import "github.com/gogo/protobuf/gogoproto/gogo.proto"; option (gogoproto.stable_marshaler_all) = true; -// Snapshot accounting messages message Account { + // OwnerID is a wallet address bytes OwnerID = 1 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false]; + // Address is identifier of accounting record string Address = 2; + // ParentAddress is identifier of parent accounting record string ParentAddress = 3; + // ActiveFunds is amount of active (non locked) funds for account decimal.Decimal ActiveFunds = 4; + // Lifetime is time until account is valid (used for lock accounts) Lifetime Lifetime = 5 [(gogoproto.nullable) = false]; + // LockTarget is the purpose of lock funds (it might be withdraw or payment for storage) LockTarget LockTarget = 6; + // LockAccounts contains child accounts with locked funds repeated Account LockAccounts = 7; } +// LockTarget must be one of two options message LockTarget { oneof Target { + // WithdrawTarget used when user requested withdraw WithdrawTarget WithdrawTarget = 1; + // ContainerCreateTarget used when user requested creation of container ContainerCreateTarget ContainerCreateTarget = 2; } } -// Snapshot balance messages message Balances { + // Accounts contains multiple account snapshots repeated Account Accounts = 1 [(gogoproto.nullable) = false]; } -// PayIn / PayOut messages message PayIO { + // BlockID contains id of the NEO block where withdraw or deposit + // call was invoked uint64 BlockID = 1; + // Transactions contains all transactions that founded in block + // and used for PayIO repeated Tx Transactions = 2 [(gogoproto.nullable) = false]; } -// Clearing messages -message Clearing { - repeated Tx Transactions = 1 [(gogoproto.nullable) = false]; -} - -// Clearing messages -message Withdraw { - string ID = 1; - uint64 Epoch = 2; - Tx Transaction = 3; -} - -// Lifetime of locks message Lifetime { + // Unit can be Unlimited, based on NeoFS epoch or Neo block enum Unit { Unlimited = 0; NeoFSEpoch = 1; NeoBlock = 2; } + // Unit describes how lifetime is measured in account Unit unit = 1 [(gogoproto.customname) = "Unit"]; + // Value describes how long lifetime will be valid int64 Value = 2; } -// Transaction messages message Tx { + // Type can be withdrawal, payIO or inner enum Type { Unknown = 0; Withdraw = 1; @@ -69,38 +71,54 @@ message Tx { Inner = 3; } + // Type describes target of transaction Type type = 1 [(gogoproto.customname) = "Type"]; + // From describes sender of funds string From = 2; + // To describes receiver of funds string To = 3; + // Amount describes amount of funds decimal.Decimal Amount = 4; - bytes PublicKeys = 5; // of sender + // PublicKeys contains public key of sender + bytes PublicKeys = 5; } message Settlement { message Receiver { + // To is the address of funds recipient string To = 1; + // Amount is the amount of funds that will be sent decimal.Decimal Amount = 2; } message Container { + // CID is container identifier bytes CID = 1 [(gogoproto.customtype) = "CID", (gogoproto.nullable) = false]; + // SGIDs is a set of storage groups that successfully passed the audit repeated bytes SGIDs = 2 [(gogoproto.customtype) = "SGID", (gogoproto.nullable) = false]; } message Tx { + // From is the address of the sender of funds string From = 1; + // Container that successfully had passed the audit Container Container = 2 [(gogoproto.nullable) = false]; + // Receivers is a set of addresses of funds recipients repeated Receiver Receivers = 3 [(gogoproto.nullable) = false]; } + // Epoch contains an epoch when settlement was accepted uint64 Epoch = 1; + // Transactions is a set of transactions repeated Tx Transactions = 2; } message ContainerCreateTarget { + // CID is container identifier bytes CID = 1 [(gogoproto.customtype) = "CID", (gogoproto.nullable) = false]; } message WithdrawTarget { + // Cheque is a string representation of cheque id string Cheque = 1; } diff --git a/accounting/withdraw.proto b/accounting/withdraw.proto index c099ef7..33ce402 100644 --- a/accounting/withdraw.proto +++ b/accounting/withdraw.proto @@ -7,55 +7,88 @@ import "github.com/gogo/protobuf/gogoproto/gogo.proto"; option (gogoproto.stable_marshaler_all) = true; +// Withdraw is a service that provides withdraw assets operations from the NeoFS service Withdraw { + // Get returns cheque if it was signed by inner ring nodes rpc Get(GetRequest) returns (GetResponse); + // Put ask inner ring nodes to sign a cheque for withdraw invoke rpc Put(PutRequest) returns (PutResponse); + // List shows all user's checks rpc List(ListRequest) returns (ListResponse); + // Delete allows user to remove unused cheque rpc Delete(DeleteRequest) returns (DeleteResponse); } message Item { + // ID is a cheque identifier bytes ID = 1 [(gogoproto.customtype) = "ChequeID", (gogoproto.nullable) = false]; + // OwnerID is a wallet address bytes OwnerID = 2 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false]; + // Amount of funds decimal.Decimal Amount = 3; + // Height is the neo blockchain height until the cheque is valid uint64 Height = 4; + // Payload contains cheque representation in bytes bytes Payload = 5; } message GetRequest { + // ID is cheque identifier bytes ID = 1 [(gogoproto.customtype) = "ChequeID", (gogoproto.nullable) = false]; + // OwnerID is a wallet address bytes OwnerID = 2 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false]; + // TTL must be larger than zero, it decreased in every neofs-node uint32 TTL = 3; } + message GetResponse { + // Item is cheque with meta information Item Withdraw = 1; } message PutRequest { + // OwnerID is a wallet address bytes OwnerID = 1 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false]; + // Amount of funds decimal.Decimal Amount = 2; + // Height is the neo blockchain height until the cheque is valid uint64 Height = 3; + // MessageID is a nonce for uniq request (UUIDv4) bytes MessageID = 4 [(gogoproto.customtype) = "MessageID", (gogoproto.nullable) = false]; + // Signature is a signature of the sent request bytes Signature = 5; + // TTL must be larger than zero, it decreased in every neofs-node uint32 TTL = 6; } message PutResponse { + // ID is cheque identifier bytes ID = 1 [(gogoproto.customtype) = "ChequeID", (gogoproto.nullable) = false]; } message ListRequest { + // OwnerID is a wallet address bytes OwnerID = 1 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false]; + // TTL must be larger than zero, it decreased in every neofs-node uint32 TTL = 2; } + message ListResponse { + // Item is a set of cheques with meta information repeated Item Items = 1; } message DeleteRequest { + // ID is cheque identifier bytes ID = 1 [(gogoproto.customtype) = "ChequeID", (gogoproto.nullable) = false]; + // OwnerID is a wallet address bytes OwnerID = 2 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false]; + // MessageID is a nonce for uniq request (UUIDv4) bytes MessageID = 3 [(gogoproto.customtype) = "MessageID", (gogoproto.nullable) = false]; + // Signature is a signature of the sent request bytes Signature = 4; + // TTL must be larger than zero, it decreased in every neofs-node uint32 TTL = 5; } + +// DeleteResponse is empty message DeleteResponse {} From 5aaea793da22bee51f79debbc3a4caae86ccae5b Mon Sep 17 00:00:00 2001 From: alexvanin Date: Wed, 20 Nov 2019 18:50:10 +0300 Subject: [PATCH 0005/1196] docs: add object proto documentation --- object/service.proto | 113 +++++++++++++++++++++++++------------------ object/types.proto | 96 ++++++++++++++++++------------------ 2 files changed, 114 insertions(+), 95 deletions(-) diff --git a/object/service.proto b/object/service.proto index 0a03383..6f13d55 100644 --- a/object/service.proto +++ b/object/service.proto @@ -9,111 +9,132 @@ import "github.com/gogo/protobuf/gogoproto/gogo.proto"; option (gogoproto.stable_marshaler_all) = true; +// Object service provides API for manipulating with the object. service Service { - // Get the object from a container + + // Get the object from container. Response uses gRPC stream. First response + // message carry object of requested address. Chunk messages are parts of + // the object's payload if it is needed. All messages except first carry + // chunks. Requested object can be restored by concatenation of object + // message payload and all chunks keeping receiving order. rpc Get(GetRequest) returns (stream GetResponse); - // Put the object into a container + // Put the object into container. Request uses gRPC stream. First message + // SHOULD BE type of PutHeader. Container id and Owner id of object SHOULD + // BE set. Session token SHOULD BE obtained before put operation (see + // session package). Chunk messages considered by server as part of object + // payload. All messages except first SHOULD BE chunks. Chunk messages + // SHOULD BE sent in direct order of fragmentation. rpc Put(stream PutRequest) returns (PutResponse); // Delete the object from a container rpc Delete(DeleteRequest) returns (DeleteResponse); - // Get MetaInfo + // Head returns the object without data payload. Object in the + // response has system header only. If full headers flag is set, extended + // headers are also present. rpc Head(HeadRequest) returns (HeadResponse); - // Search by MetaInfo + // Search objects in container. Version of query language format SHOULD BE + // set to 1. Search query represented in serialized format (see query + // package). rpc Search(SearchRequest) returns (SearchResponse); - // Get ranges of object payload + // GetRange of data payload. Ranges are set of pairs (offset, length). + // Fragments order in response corresponds to ranges order in request. rpc GetRange(GetRangeRequest) returns (GetRangeResponse); - // Get hashes of object ranges + // GetRangeHash returns homomorphic hash of object payload range after XOR + // operation. Ranges are set of pairs (offset, length). Hashes order in + // response corresponds to ranges order in request. Homomorphic hash is + // calculated for XORed data. rpc GetRangeHash(GetRangeHashRequest) returns (GetRangeHashResponse); } message GetRequest { - uint64 Epoch = 1; - refs.Address Address = 2 [(gogoproto.nullable) = false]; - uint32 TTL = 3; + uint64 Epoch = 1; // Epoch is set by user to 0, node set epoch to the actual value + refs.Address Address = 2 [(gogoproto.nullable) = false]; // Address of object (container id + object id) + uint32 TTL = 3; // TTL must be larger than zero, it decreased in every neofs-node } message GetResponse { oneof R { - Object object = 1; - bytes Chunk = 2; + Object object = 1; // Object header and some payload + bytes Chunk = 2; // Chunk of remaining payload } } message PutRequest { message PutHeader { - uint64 Epoch = 1; - Object Object = 2; - uint32 TTL = 3; - session.Token Token = 4; + uint64 Epoch = 1; // Epoch is set by user to 0, node set epoch to the actual value + Object Object = 2; // Object with at least container id and owner id fields + uint32 TTL = 3; // TTL must be larger than zero, it decreased in every neofs-node + session.Token Token = 4; // Token with session public key and user's signature } oneof R { - PutHeader Header = 1; - bytes Chunk = 2; + PutHeader Header = 1; // Header should be the first message in the stream + bytes Chunk = 2; // Chunk should be a remaining message in stream should be chunks } } message PutResponse { - refs.Address Address = 1 [(gogoproto.nullable) = false]; + refs.Address Address = 1 [(gogoproto.nullable) = false]; // Address of object (container id + object id) } message DeleteRequest { - uint64 Epoch = 1; - refs.Address Address = 2 [(gogoproto.nullable) = false]; - bytes OwnerID = 3 [(gogoproto.nullable) = false, (gogoproto.customtype) = "OwnerID"]; - uint32 TTL = 4; - session.Token Token = 5; + uint64 Epoch = 1; // Epoch is set by user to 0, node set epoch to the actual value + refs.Address Address = 2 [(gogoproto.nullable) = false]; // Address of object (container id + object id) + bytes OwnerID = 3 [(gogoproto.nullable) = false, (gogoproto.customtype) = "OwnerID"]; // OwnerID is a wallet address + uint32 TTL = 4; // TTL must be larger than zero, it decreased in every neofs-node + session.Token Token = 5; // Token with session public key and user's signature } + +// DeleteResponse is empty because we cannot guarantee permanent object removal +// in distributed system. message DeleteResponse {} -// HeadRequest.FullHeader == true, for fetch all headers message HeadRequest { - uint64 Epoch = 1; - refs.Address Address = 2 [(gogoproto.nullable) = false, (gogoproto.customtype) = "Address"]; - bool FullHeaders = 3; - uint32 TTL = 4; + uint64 Epoch = 1; // Epoch is set by user to 0, node set epoch to the actual value + refs.Address Address = 2 [(gogoproto.nullable) = false, (gogoproto.customtype) = "Address"]; // Address of object (container id + object id) + bool FullHeaders = 3; // FullHeaders can be set true for extended headers in the object + uint32 TTL = 4; // TTL must be larger than zero, it decreased in every neofs-node } message HeadResponse { - Object Object = 1; + Object Object = 1; // Object without payload } message SearchRequest { - uint64 Epoch = 1; - uint32 Version = 2; - bytes ContainerID = 3 [(gogoproto.nullable) = false, (gogoproto.customtype) = "CID"]; - bytes Query = 4; - uint32 TTL = 5; + uint64 Epoch = 1; // Epoch is set by user to 0, node set epoch to the actual value + uint32 Version = 2; // Version of search query format + bytes ContainerID = 3 [(gogoproto.nullable) = false, (gogoproto.customtype) = "CID"]; // ContainerID for searching the object + bytes Query = 4; // Query in the binary serialized format + uint32 TTL = 5; // TTL must be larger than zero, it decreased in every neofs-node } message SearchResponse { - repeated refs.Address Addresses = 1 [(gogoproto.nullable) = false]; + repeated refs.Address Addresses = 1 [(gogoproto.nullable) = false]; // Addresses of found objects } message GetRangeRequest { - uint64 Epoch = 1; - refs.Address Address = 2 [(gogoproto.nullable) = false]; - repeated Range Ranges = 3 [(gogoproto.nullable) = false]; - uint32 TTL = 4; + uint64 Epoch = 1; // Epoch is set by user to 0, node set epoch to the actual value + refs.Address Address = 2 [(gogoproto.nullable) = false]; // Address of object (container id + object id) + repeated Range Ranges = 3 [(gogoproto.nullable) = false]; // Ranges of object's payload to return + uint32 TTL = 4; // TTL must be larger than zero, it decreased in every neofs-node } message GetRangeResponse { - repeated bytes Fragments = 1; + repeated bytes Fragments = 1; // Fragments of object's payload } message GetRangeHashRequest { - uint64 Epoch = 1; - refs.Address Address = 2 [(gogoproto.nullable) = false]; - repeated Range Ranges = 3 [(gogoproto.nullable) = false]; - bytes Salt = 4; - uint32 TTL = 5; + uint64 Epoch = 1; // Epoch is set by user to 0, node set epoch to the actual value + refs.Address Address = 2 [(gogoproto.nullable) = false]; // Address of object (container id + object id) + repeated Range Ranges = 3 [(gogoproto.nullable) = false]; // Ranges of object's payload to calculate homomorphic hash + bytes Salt = 4; // Salt is used to XOR object's payload ranges before hashing, it can be nil + uint32 TTL = 5; // TTL must be larger than zero, it decreased in every neofs-node } message GetRangeHashResponse { - repeated bytes Hashes = 1 [(gogoproto.customtype) = "Hash", (gogoproto.nullable) = false]; + repeated bytes Hashes = 1 [(gogoproto.customtype) = "Hash", (gogoproto.nullable) = false]; // Homomorphic hashes of all ranges } diff --git a/object/types.proto b/object/types.proto index a7cbd8c..30e468e 100644 --- a/object/types.proto +++ b/object/types.proto @@ -9,99 +9,97 @@ import "github.com/gogo/protobuf/gogoproto/gogo.proto"; option (gogoproto.stable_marshaler_all) = true; message Range { - uint64 Offset = 1; - uint64 Length = 2; + uint64 Offset = 1; // Offset of the data range + uint64 Length = 2; // Length of the data range } message UserHeader { - string Key = 1; - string Value = 2; + string Key = 1; // Key of the user's header + string Value = 2; // Value of the user's header } message Header { oneof Value { - Link Link = 1; - refs.Address Redirect = 2; - UserHeader UserHeader = 3; - Transform Transform = 4; - Tombstone Tombstone = 5; - // session-related info: session.VerificationHeader - session.VerificationHeader Verify = 6; - // integrity-related info - bytes HomoHash = 7 [(gogoproto.customtype) = "Hash"]; - bytes PayloadChecksum = 8; - IntegrityHeader Integrity = 9; - StorageGroup StorageGroup = 10; + Link Link = 1; // Link to other objects + refs.Address Redirect = 2; // RedirectNot used yet + UserHeader UserHeader = 3; // UserHeader defined by user + Transform Transform = 4; // Transform defines transform operation (e.g. payload split) + Tombstone Tombstone = 5; // Tombstone header that set up in deleted objects + session.VerificationHeader Verify = 6; // Verify header that contains session public key and user's signature + bytes HomoHash = 7 [(gogoproto.customtype) = "Hash"]; // Homomorphic hash of original object payload + bytes PayloadChecksum = 8; // PayloadChecksum of actual object's payload + IntegrityHeader Integrity = 9; // Integrity header with checksum of all above headers in the object + StorageGroup StorageGroup = 10; // StorageGroup contains meta information for the data audit } } message Tombstone { - uint64 Epoch = 1; + uint64 Epoch = 1; // Epoch when tombstone was created } message SystemHeader { - uint64 Version = 1; - uint64 PayloadLength = 2; + uint64 Version = 1; // Version of the object structure + uint64 PayloadLength = 2; // Object payload length - bytes ID = 3 [(gogoproto.customtype) = "ID", (gogoproto.nullable) = false]; - bytes OwnerID = 4 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false]; - bytes CID = 5 [(gogoproto.customtype) = "CID", (gogoproto.nullable) = false]; - CreationPoint CreatedAt = 6 [(gogoproto.nullable) = false]; + bytes ID = 3 [(gogoproto.customtype) = "ID", (gogoproto.nullable) = false]; // ObjectID is a UUID + bytes OwnerID = 4 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false]; // OwnerID is a wallet address + bytes CID = 5 [(gogoproto.customtype) = "CID", (gogoproto.nullable) = false]; // ContainerID is a SHA256 hash of the container structure + CreationPoint CreatedAt = 6 [(gogoproto.nullable) = false]; // Timestamp of object creation } message CreationPoint { - int64 UnixTime = 1; - uint64 Epoch = 2; + int64 UnixTime = 1; // Date of creation in unixtime format + uint64 Epoch = 2; // Date of creation in NeoFS epochs } message IntegrityHeader { - bytes HeadersChecksum = 1; - bytes ChecksumSignature = 2; + bytes HeadersChecksum = 1; // Checksum of all above headers in the object + bytes ChecksumSignature = 2; // User's signature of checksum to verify if it is correct } message Link { enum Type { Unknown = 0; - Parent = 1; - Previous = 2; - Next = 3; - Child = 4; - StorageGroup = 5; + Parent = 1; // Parent object created during object transformation + Previous = 2; // Previous object in the linked list created during object transformation + Next = 3; // Next object in the linked list created during object transformation + Child = 4; // Child object created during object transformation + StorageGroup = 5; // Object that included into this storage group } - Type type = 1; - bytes ID = 2 [(gogoproto.customtype) = "ID", (gogoproto.nullable) = false]; + Type type = 1; // Link type + bytes ID = 2 [(gogoproto.customtype) = "ID", (gogoproto.nullable) = false]; // Object id } message Transform { enum Type { Unknown = 0; - Split = 1; - Sign = 2; - Mould = 3; + Split = 1; // Object created after payload split + Sign = 2; // Object created after re-signing (doesn't used) + Mould = 3; // Object created after filling missing headers in the object } - Type type = 1; + Type type = 1; // Type of object transformation } message Object { - SystemHeader SystemHeader = 1 [(gogoproto.nullable) = false]; - repeated Header Headers = 2 [(gogoproto.nullable) = false]; - bytes Payload = 3; + SystemHeader SystemHeader = 1 [(gogoproto.nullable) = false]; // System header + repeated Header Headers = 2 [(gogoproto.nullable) = false]; // Extended headers + bytes Payload = 3; // Object's payload } message StorageGroup { - uint64 ValidationDataSize = 1; - bytes ValidationHash = 2 [(gogoproto.customtype) = "Hash", (gogoproto.nullable) = false]; + uint64 ValidationDataSize = 1; // Size of the all object's payloads included into storage group + bytes ValidationHash = 2 [(gogoproto.customtype) = "Hash", (gogoproto.nullable) = false]; // Homomorphic hash of all object's payloads included into storage group message Lifetime { enum Unit { - Unlimited = 0; - NeoFSEpoch = 1; - UnixTime = 2; + Unlimited = 0; // Storage group always valid + NeoFSEpoch = 1; // Storage group is valid until lifetime NeoFS epoch + UnixTime = 2; // Storage group is valid until lifetime unix timestamp } - Unit unit = 1 [(gogoproto.customname) = "Unit"]; - int64 Value = 2; + Unit unit = 1 [(gogoproto.customname) = "Unit"]; // Lifetime type + int64 Value = 2; // Lifetime value } - Lifetime lifetime = 3 [(gogoproto.customname) = "Lifetime"]; + Lifetime lifetime = 3 [(gogoproto.customname) = "Lifetime"]; // Time until storage group is valid } From 1383aabfa55309023c423222978b77cd44c6022e Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Wed, 20 Nov 2019 19:07:48 +0300 Subject: [PATCH 0006/1196] docs: add decimal proto documentation --- decimal/decimal.proto | 3 +++ 1 file changed, 3 insertions(+) diff --git a/decimal/decimal.proto b/decimal/decimal.proto index 31bb963..42cf2df 100644 --- a/decimal/decimal.proto +++ b/decimal/decimal.proto @@ -6,9 +6,12 @@ import "github.com/gogo/protobuf/gogoproto/gogo.proto"; option (gogoproto.stable_marshaler_all) = true; +// Decimal is a structure used for representation of assets amount message Decimal { option (gogoproto.goproto_stringer) = false; + // Value is value number int64 Value = 1; + // Precision is precision number uint32 Precision = 2; } From 811bcbd14fa110335bd2c62bba186bd7c0d09c16 Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Wed, 20 Nov 2019 19:11:46 +0300 Subject: [PATCH 0007/1196] docs: add refs proto documentation --- refs/types.proto | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/refs/types.proto b/refs/types.proto index e607f34..15355ae 100644 --- a/refs/types.proto +++ b/refs/types.proto @@ -9,7 +9,10 @@ option (gogoproto.stable_marshaler_all) = true; option (gogoproto.stringer_all) = false; option (gogoproto.goproto_stringer_all) = false; +// Address of object (container id + object id) message Address { - bytes ObjectID = 1[(gogoproto.customtype) = "ObjectID", (gogoproto.nullable) = false]; // UUID - bytes CID = 2[(gogoproto.customtype) = "CID", (gogoproto.nullable) = false]; // sha256 + // ObjectID is an object identifier + bytes ObjectID = 1[(gogoproto.customtype) = "ObjectID", (gogoproto.nullable) = false]; + // CID is container identifier + bytes CID = 2[(gogoproto.customtype) = "CID", (gogoproto.nullable) = false]; } From 84ac6f55a3be265db8d8cccb709f5a328f4ab401 Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Wed, 20 Nov 2019 19:21:45 +0300 Subject: [PATCH 0008/1196] docs: add bootstrap proto documentation --- bootstrap/service.proto | 9 +++++++-- bootstrap/types.proto | 6 ++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/bootstrap/service.proto b/bootstrap/service.proto index 3c9dced..a0f82dc 100644 --- a/bootstrap/service.proto +++ b/bootstrap/service.proto @@ -7,14 +7,19 @@ import "github.com/gogo/protobuf/gogoproto/gogo.proto"; option (gogoproto.stable_marshaler_all) = true; -// The Bootstrap service definition. +// Bootstrap service allows neofs-node to connect to the network. Node should +// perform at least one bootstrap request in the epoch to stay in the network +// for the next epoch. service Bootstrap { + // Process is method that allows to register node in the network and receive actual netmap rpc Process(Request) returns (bootstrap.SpreadMap); } -// Request message to communicate between DHT nodes message Request { + // Type is NodeType, can be InnerRingNode (type=1) or StorageNode (type=2) int32 type = 1 [(gogoproto.customname) = "Type" , (gogoproto.nullable) = false, (gogoproto.customtype) = "NodeType"]; + // Info contains information about node bootstrap.NodeInfo info = 2 [(gogoproto.nullable) = false]; + // TTL must be larger than zero, it decreased in every neofs-node uint32 TTL = 3; } diff --git a/bootstrap/types.proto b/bootstrap/types.proto index 4d6e458..5a566da 100644 --- a/bootstrap/types.proto +++ b/bootstrap/types.proto @@ -10,13 +10,19 @@ option (gogoproto.stringer_all) = false; option (gogoproto.goproto_stringer_all) = false; message SpreadMap { + // Epoch is current epoch for netmap uint64 Epoch = 1; + // NetMap is a set of NodeInfos repeated NodeInfo NetMap = 2 [(gogoproto.nullable) = false]; } message NodeInfo { + // Address is a node [multi-address](https://github.com/multiformats/multiaddr) string Address = 1 [(gogoproto.jsontag) = "address"]; + // PubKey is a compressed public key representation in bytes bytes PubKey = 2 [(gogoproto.jsontag) = "pubkey,omitempty"]; + // Options is set of node optional information, such as storage capacity, node location, price and etc repeated string Options = 3 [(gogoproto.jsontag) = "options,omitempty"]; + // Status is bitmap status of the node uint64 Status = 4 [(gogoproto.jsontag) = "status", (gogoproto.nullable) = false, (gogoproto.customtype) = "NodeStatus"]; } From 6c0ee948e660c80cb7bf24818acce38eaed66f2f Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Wed, 20 Nov 2019 19:25:53 +0300 Subject: [PATCH 0009/1196] docs: add query proto documentation --- query/types.proto | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/query/types.proto b/query/types.proto index 5f46072..884a6bd 100644 --- a/query/types.proto +++ b/query/types.proto @@ -9,17 +9,23 @@ option (gogoproto.stable_marshaler_all) = true; message Filter { option (gogoproto.goproto_stringer) = false; + // Type can be Exact or Regex enum Type { Exact = 0; Regex = 1; } + + // Type of filter Type type = 1 [(gogoproto.customname) = "Type"]; + // Name of field that should be filtered string Name = 2; + // Value that should be used for filter string Value = 3; } message Query { option (gogoproto.goproto_stringer) = false; + // Filters is set of filters, should not be empty repeated Filter Filters = 1 [(gogoproto.nullable) = false]; } From 6050ab755c8f05e285dfd4b5b90aab95f837257f Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Wed, 20 Nov 2019 19:33:10 +0300 Subject: [PATCH 0010/1196] docs: add state proto documentation --- state/service.proto | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/state/service.proto b/state/service.proto index d0e59b4..3c85d86 100644 --- a/state/service.proto +++ b/state/service.proto @@ -7,10 +7,14 @@ import "github.com/gogo/protobuf/gogoproto/gogo.proto"; option (gogoproto.stable_marshaler_all) = true; -// The Status service definition. +// Status service provides node's healthcheck and status info service Status { + // Netmap request allows to receive current [bootstrap.SpreadMap](bootstrap.md#bootstrap.SpreadMap) rpc Netmap(NetmapRequest) returns (bootstrap.SpreadMap); + // Metrics request allows to receive metrics in prometheus format rpc Metrics(MetricsRequest) returns (MetricsResponse); + // HealthCheck request allows to check health status of the node. + // If node unhealthy field Status would contains detailed info. rpc HealthCheck(HealthRequest) returns (HealthResponse); } @@ -32,6 +36,8 @@ message HealthRequest {} // HealthResponse message with current state message HealthResponse { + // Healthy is true when node alive and healthy bool Healthy = 1; + // Status contains detailed information about health status string Status = 2; } From 04f1cbca48f7c95aacc96e565e424b31760af598 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 20 Nov 2019 19:46:30 +0300 Subject: [PATCH 0011/1196] docs: add session proto documentation --- session/service.proto | 20 ++++++++++++++++++++ session/types.proto | 10 ++++++++++ 2 files changed, 30 insertions(+) diff --git a/session/service.proto b/session/service.proto index ee56a22..484425b 100644 --- a/session/service.proto +++ b/session/service.proto @@ -7,21 +7,41 @@ import "github.com/gogo/protobuf/gogoproto/gogo.proto"; option (gogoproto.stable_marshaler_all) = true; + service Session { + // Open a trusted session to manipulate an object. In order to put or + // delete object client have to obtain session token with trusted node. + // Trusted node will modify client's object (add missing headers, checksums, + // homomorphic hash) and sign id with session key. Session is established + // during 4-step handshake in one gRPC stream + + // - First client stream message SHOULD BE type of `CreateRequest_Init`. + // - First server stream message SHOULD BE type of `CreateResponse_Unsigned`. + // - Second client stream message SHOULD BE type of `CreateRequest_Signed`. + // - Second server stream message SHOULD BE type of `CreateResponse_Result`. + rpc Create (stream CreateRequest) returns (stream CreateResponse); } message CreateRequest { + // Message should be one of oneof Message { + // Message to init session opening. Carry: + // owner of manipulation object; + // ID of manipulation object; + // token lifetime bounds. session.Token Init = 1; + // Signed Init message response (Unsigned) from server with user private key session.Token Signed = 2; } } message CreateResponse { oneof Message { + // Unsigned token with token ID and session public key generated on server side session.Token Unsigned = 1; + // Resulting token which can be used for object placing through an trusted intermediary session.Token Result = 2; } } diff --git a/session/types.proto b/session/types.proto index 8989040..bf804bf 100644 --- a/session/types.proto +++ b/session/types.proto @@ -7,16 +7,26 @@ import "github.com/gogo/protobuf/gogoproto/gogo.proto"; option (gogoproto.stable_marshaler_all) = true; message VerificationHeader { + // Session public key bytes PublicKey = 1; + // Session public key signature. Signed by trusted side bytes KeySignature = 2; } +// User token granting rights for object manipulation message Token { + // Header carries verification data of session key VerificationHeader Header = 1 [(gogoproto.nullable) = false]; + // Owner of manipulation object bytes OwnerID = 2 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false]; + // Initial epoch of token lifetime uint64 FirstEpoch = 3; + // Last epoch of token lifetime uint64 LastEpoch = 4; + // ID of manipulation object repeated bytes ObjectID = 5 [(gogoproto.customtype) = "ObjectID", (gogoproto.nullable) = false]; + // Token signature. Signed by owner of manipulation object bytes Signature = 6; + // Token ID (UUID) bytes ID = 7 [(gogoproto.customtype) = "TokenID", (gogoproto.nullable) = false]; } From ad86acf62f40677c7b3a5fac969b032e00cf9e06 Mon Sep 17 00:00:00 2001 From: alexvanin Date: Wed, 20 Nov 2019 20:16:24 +0300 Subject: [PATCH 0012/1196] docs: add container proto documentation --- container/service.proto | 46 ++++++++++++++++++++++++++++++++--------- container/types.proto | 8 +++---- 2 files changed, 40 insertions(+), 14 deletions(-) diff --git a/container/service.proto b/container/service.proto index a3b72ca..72c0899 100644 --- a/container/service.proto +++ b/container/service.proto @@ -8,61 +8,87 @@ import "github.com/gogo/protobuf/gogoproto/gogo.proto"; option (gogoproto.stable_marshaler_all) = true; +// Container service provides API for manipulating with the container. service Service { - // Create container + // Put request proposes container to the inner ring nodes. They will + // accept new container if user has enough deposit. All containers + // are accepted by the consensus, therefore it is asynchronous process. rpc Put(PutRequest) returns (PutResponse); - // Delete container ... discuss implementation later + // Delete container removes it from the inner ring container storage. It + // also asynchronous process done by consensus. rpc Delete(DeleteRequest) returns (DeleteResponse); - // Get container + // Get container returns container instance rpc Get(GetRequest) returns (GetResponse); + // List returns all user's containers rpc List(ListRequest) returns (ListResponse); } -// NewRequest message to create new container message PutRequest { + // MessageID is a nonce for uniq container id calculation bytes MessageID = 1 [(gogoproto.customtype) = "MessageID", (gogoproto.nullable) = false]; - uint64 Capacity = 2; // not actual size in megabytes, but probability of storage availability + + // Capacity defines amount of data that can be stored in the container (doesn't used for now). + uint64 Capacity = 2; + + // OwnerID is a wallet address bytes OwnerID = 3 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false]; + + // Rules define storage policy for the object inside the container. netmap.PlacementRule rules = 4 [(gogoproto.nullable) = false]; + + // Signature of the user (owner id) bytes Signature = 5; + + // TTL must be larger than zero, it decreased in every neofs-node uint32 TTL = 6; } -// PutResponse message to respond about container uuid message PutResponse { + // CID (container id) is a SHA256 hash of the container structure bytes CID = 1 [(gogoproto.customtype) = "CID", (gogoproto.nullable) = false]; } message DeleteRequest { + // CID (container id) is a SHA256 hash of the container structure bytes CID = 1 [(gogoproto.customtype) = "CID", (gogoproto.nullable) = false]; + + // TTL must be larger than zero, it decreased in every neofs-node uint32 TTL = 2; + + // Signature of the container owner bytes Signature = 3; } +// DeleteResponse is empty because delete operation is asynchronous and done +// via consensus in inner ring nodes message DeleteResponse { } -// GetRequest message to fetch container placement rules message GetRequest { + // CID (container id) is a SHA256 hash of the container structure bytes CID = 1 [(gogoproto.customtype) = "CID", (gogoproto.nullable) = false]; + + // TTL must be larger than zero, it decreased in every neofs-node uint32 TTL = 2; } -// GetResponse message with container structure message GetResponse { + // Container is a structure that contains placement rules and owner id container.Container Container = 1; } -// ListRequest message to list containers for user message ListRequest { + // OwnerID is a wallet address bytes OwnerID = 1 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false]; + + // TTL must be larger than zero, it decreased in every neofs-node uint32 TTL = 2; } -// ListResponse message to respond about all user containers message ListResponse { + // CID (container id) is list of SHA256 hashes of the container structures repeated bytes CID = 1 [(gogoproto.customtype) = "CID", (gogoproto.nullable) = false]; } diff --git a/container/types.proto b/container/types.proto index b05001f..efcaee8 100644 --- a/container/types.proto +++ b/container/types.proto @@ -9,8 +9,8 @@ option (gogoproto.stable_marshaler_all) = true; // The Container service definition. message Container { - bytes OwnerID = 1 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false]; - bytes Salt = 2 [(gogoproto.customtype) = "UUID", (gogoproto.nullable) = false]; - uint64 Capacity = 3; - netmap.PlacementRule Rules = 4 [(gogoproto.nullable) = false]; + bytes OwnerID = 1 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false]; // OwnerID is a wallet address. + bytes Salt = 2 [(gogoproto.customtype) = "UUID", (gogoproto.nullable) = false]; // Salt is a nonce for unique container id calculation. + uint64 Capacity = 3; // Capacity defines amount of data that can be stored in the container (doesn't used for now). + netmap.PlacementRule Rules = 4 [(gogoproto.nullable) = false]; // Rules define storage policy for the object inside the container. } From 0af63c42ccf04fd9b3f919512c2ae522f0747c03 Mon Sep 17 00:00:00 2001 From: alexvanin Date: Wed, 20 Nov 2019 21:18:44 +0300 Subject: [PATCH 0013/1196] docs: regenerate proto files --- accounting/service.pb.go | 19 +- accounting/types.pb.go | 693 +++++++------------------------------- accounting/withdraw.pb.go | 89 +++-- bootstrap/service.pb.go | 10 +- bootstrap/types.pb.go | 14 +- container/service.pb.go | 70 ++-- decimal/decimal.pb.go | 5 +- object/service.pb.go | 61 +++- query/types.pb.go | 17 +- refs/types.pb.go | 5 +- session/service.pb.go | 2 + session/types.pb.go | 32 +- state/service.pb.go | 12 +- 13 files changed, 362 insertions(+), 667 deletions(-) diff --git a/accounting/service.pb.go b/accounting/service.pb.go index 8708db3..ea86a8e 100644 --- a/accounting/service.pb.go +++ b/accounting/service.pb.go @@ -29,7 +29,9 @@ var _ = math.Inf const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package type BalanceRequest struct { - OwnerID OwnerID `protobuf:"bytes,1,opt,name=OwnerID,proto3,customtype=OwnerID" json:"OwnerID"` + // OwnerID is a wallet address + OwnerID OwnerID `protobuf:"bytes,1,opt,name=OwnerID,proto3,customtype=OwnerID" json:"OwnerID"` + // TTL must be larger than zero, it decreased in every neofs-node TTL uint32 `protobuf:"varint,2,opt,name=TTL,proto3" json:"TTL,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -73,11 +75,14 @@ func (m *BalanceRequest) GetTTL() uint32 { } type BalanceResponse struct { - Balance *decimal.Decimal `protobuf:"bytes,1,opt,name=Balance,proto3" json:"Balance,omitempty"` - LockAccounts []*Account `protobuf:"bytes,2,rep,name=LockAccounts,proto3" json:"LockAccounts,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + // Balance contains current account balance state + Balance *decimal.Decimal `protobuf:"bytes,1,opt,name=Balance,proto3" json:"Balance,omitempty"` + // LockAccounts contains information about locked funds. Locked funds appear + // when user pays for storage or withdraw assets. + LockAccounts []*Account `protobuf:"bytes,2,rep,name=LockAccounts,proto3" json:"LockAccounts,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *BalanceResponse) Reset() { *m = BalanceResponse{} } @@ -166,6 +171,7 @@ const _ = grpc.SupportPackageIsVersion4 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type AccountingClient interface { + // Balance returns current balance status of the NeoFS user Balance(ctx context.Context, in *BalanceRequest, opts ...grpc.CallOption) (*BalanceResponse, error) } @@ -188,6 +194,7 @@ func (c *accountingClient) Balance(ctx context.Context, in *BalanceRequest, opts // AccountingServer is the server API for Accounting service. type AccountingServer interface { + // Balance returns current balance status of the NeoFS user Balance(context.Context, *BalanceRequest) (*BalanceResponse, error) } diff --git a/accounting/types.pb.go b/accounting/types.pb.go index cb4b0c8..dd020ec 100644 --- a/accounting/types.pb.go +++ b/accounting/types.pb.go @@ -24,6 +24,7 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +// Unit can be Unlimited, based on NeoFS epoch or Neo block type Lifetime_Unit int32 const ( @@ -49,9 +50,10 @@ func (x Lifetime_Unit) String() string { } func (Lifetime_Unit) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_437c556d7375b726, []int{6, 0} + return fileDescriptor_437c556d7375b726, []int{4, 0} } +// Type can be withdrawal, payIO or inner type Tx_Type int32 const ( @@ -80,21 +82,27 @@ func (x Tx_Type) String() string { } func (Tx_Type) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_437c556d7375b726, []int{7, 0} + return fileDescriptor_437c556d7375b726, []int{5, 0} } -// Snapshot accounting messages type Account struct { - OwnerID OwnerID `protobuf:"bytes,1,opt,name=OwnerID,proto3,customtype=OwnerID" json:"OwnerID"` - Address string `protobuf:"bytes,2,opt,name=Address,proto3" json:"Address,omitempty"` - ParentAddress string `protobuf:"bytes,3,opt,name=ParentAddress,proto3" json:"ParentAddress,omitempty"` - ActiveFunds *decimal.Decimal `protobuf:"bytes,4,opt,name=ActiveFunds,proto3" json:"ActiveFunds,omitempty"` - Lifetime Lifetime `protobuf:"bytes,5,opt,name=Lifetime,proto3" json:"Lifetime"` - LockTarget *LockTarget `protobuf:"bytes,6,opt,name=LockTarget,proto3" json:"LockTarget,omitempty"` - LockAccounts []*Account `protobuf:"bytes,7,rep,name=LockAccounts,proto3" json:"LockAccounts,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + // OwnerID is a wallet address + OwnerID OwnerID `protobuf:"bytes,1,opt,name=OwnerID,proto3,customtype=OwnerID" json:"OwnerID"` + // Address is identifier of accounting record + Address string `protobuf:"bytes,2,opt,name=Address,proto3" json:"Address,omitempty"` + // ParentAddress is identifier of parent accounting record + ParentAddress string `protobuf:"bytes,3,opt,name=ParentAddress,proto3" json:"ParentAddress,omitempty"` + // ActiveFunds is amount of active (non locked) funds for account + ActiveFunds *decimal.Decimal `protobuf:"bytes,4,opt,name=ActiveFunds,proto3" json:"ActiveFunds,omitempty"` + // Lifetime is time until account is valid (used for lock accounts) + Lifetime Lifetime `protobuf:"bytes,5,opt,name=Lifetime,proto3" json:"Lifetime"` + // LockTarget is the purpose of lock funds (it might be withdraw or payment for storage) + LockTarget *LockTarget `protobuf:"bytes,6,opt,name=LockTarget,proto3" json:"LockTarget,omitempty"` + // LockAccounts contains child accounts with locked funds + LockAccounts []*Account `protobuf:"bytes,7,rep,name=LockAccounts,proto3" json:"LockAccounts,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *Account) Reset() { *m = Account{} } @@ -168,6 +176,7 @@ func (m *Account) GetLockAccounts() []*Account { return nil } +// LockTarget must be one of two options type LockTarget struct { // Types that are valid to be assigned to Target: // *LockTarget_WithdrawTarget @@ -252,8 +261,8 @@ func (*LockTarget) XXX_OneofWrappers() []interface{} { } } -// Snapshot balance messages type Balances struct { + // Accounts contains multiple account snapshots Accounts []Account `protobuf:"bytes,1,rep,name=Accounts,proto3" json:"Accounts"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -296,9 +305,12 @@ func (m *Balances) GetAccounts() []Account { return nil } -// PayIn / PayOut messages type PayIO struct { - BlockID uint64 `protobuf:"varint,1,opt,name=BlockID,proto3" json:"BlockID,omitempty"` + // BlockID contains id of the NEO block where withdraw or deposit + // call was invoked + BlockID uint64 `protobuf:"varint,1,opt,name=BlockID,proto3" json:"BlockID,omitempty"` + // Transactions contains all transactions that founded in block + // and used for PayIO Transactions []Tx `protobuf:"bytes,2,rep,name=Transactions,proto3" json:"Transactions"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -348,124 +360,21 @@ func (m *PayIO) GetTransactions() []Tx { return nil } -// Clearing messages -type Clearing struct { - Transactions []Tx `protobuf:"bytes,1,rep,name=Transactions,proto3" json:"Transactions"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Clearing) Reset() { *m = Clearing{} } -func (m *Clearing) String() string { return proto.CompactTextString(m) } -func (*Clearing) ProtoMessage() {} -func (*Clearing) Descriptor() ([]byte, []int) { - return fileDescriptor_437c556d7375b726, []int{4} -} -func (m *Clearing) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Clearing) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *Clearing) XXX_Merge(src proto.Message) { - xxx_messageInfo_Clearing.Merge(m, src) -} -func (m *Clearing) XXX_Size() int { - return m.Size() -} -func (m *Clearing) XXX_DiscardUnknown() { - xxx_messageInfo_Clearing.DiscardUnknown(m) -} - -var xxx_messageInfo_Clearing proto.InternalMessageInfo - -func (m *Clearing) GetTransactions() []Tx { - if m != nil { - return m.Transactions - } - return nil -} - -// Clearing messages -type Withdraw struct { - ID string `protobuf:"bytes,1,opt,name=ID,proto3" json:"ID,omitempty"` - Epoch uint64 `protobuf:"varint,2,opt,name=Epoch,proto3" json:"Epoch,omitempty"` - Transaction *Tx `protobuf:"bytes,3,opt,name=Transaction,proto3" json:"Transaction,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Withdraw) Reset() { *m = Withdraw{} } -func (m *Withdraw) String() string { return proto.CompactTextString(m) } -func (*Withdraw) ProtoMessage() {} -func (*Withdraw) Descriptor() ([]byte, []int) { - return fileDescriptor_437c556d7375b726, []int{5} -} -func (m *Withdraw) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Withdraw) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *Withdraw) XXX_Merge(src proto.Message) { - xxx_messageInfo_Withdraw.Merge(m, src) -} -func (m *Withdraw) XXX_Size() int { - return m.Size() -} -func (m *Withdraw) XXX_DiscardUnknown() { - xxx_messageInfo_Withdraw.DiscardUnknown(m) -} - -var xxx_messageInfo_Withdraw proto.InternalMessageInfo - -func (m *Withdraw) GetID() string { - if m != nil { - return m.ID - } - return "" -} - -func (m *Withdraw) GetEpoch() uint64 { - if m != nil { - return m.Epoch - } - return 0 -} - -func (m *Withdraw) GetTransaction() *Tx { - if m != nil { - return m.Transaction - } - return nil -} - -// Lifetime of locks type Lifetime struct { - Unit Lifetime_Unit `protobuf:"varint,1,opt,name=unit,proto3,enum=accounting.Lifetime_Unit" json:"unit,omitempty"` - Value int64 `protobuf:"varint,2,opt,name=Value,proto3" json:"Value,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + // Unit describes how lifetime is measured in account + Unit Lifetime_Unit `protobuf:"varint,1,opt,name=unit,proto3,enum=accounting.Lifetime_Unit" json:"unit,omitempty"` + // Value describes how long lifetime will be valid + Value int64 `protobuf:"varint,2,opt,name=Value,proto3" json:"Value,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *Lifetime) Reset() { *m = Lifetime{} } func (m *Lifetime) String() string { return proto.CompactTextString(m) } func (*Lifetime) ProtoMessage() {} func (*Lifetime) Descriptor() ([]byte, []int) { - return fileDescriptor_437c556d7375b726, []int{6} + return fileDescriptor_437c556d7375b726, []int{4} } func (m *Lifetime) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -504,23 +413,27 @@ func (m *Lifetime) GetValue() int64 { return 0 } -// Transaction messages type Tx struct { - Type Tx_Type `protobuf:"varint,1,opt,name=type,proto3,enum=accounting.Tx_Type" json:"type,omitempty"` - From string `protobuf:"bytes,2,opt,name=From,proto3" json:"From,omitempty"` - To string `protobuf:"bytes,3,opt,name=To,proto3" json:"To,omitempty"` - Amount *decimal.Decimal `protobuf:"bytes,4,opt,name=Amount,proto3" json:"Amount,omitempty"` - PublicKeys []byte `protobuf:"bytes,5,opt,name=PublicKeys,proto3" json:"PublicKeys,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + // Type describes target of transaction + Type Tx_Type `protobuf:"varint,1,opt,name=type,proto3,enum=accounting.Tx_Type" json:"type,omitempty"` + // From describes sender of funds + From string `protobuf:"bytes,2,opt,name=From,proto3" json:"From,omitempty"` + // To describes receiver of funds + To string `protobuf:"bytes,3,opt,name=To,proto3" json:"To,omitempty"` + // Amount describes amount of funds + Amount *decimal.Decimal `protobuf:"bytes,4,opt,name=Amount,proto3" json:"Amount,omitempty"` + // PublicKeys contains public key of sender + PublicKeys []byte `protobuf:"bytes,5,opt,name=PublicKeys,proto3" json:"PublicKeys,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *Tx) Reset() { *m = Tx{} } func (m *Tx) String() string { return proto.CompactTextString(m) } func (*Tx) ProtoMessage() {} func (*Tx) Descriptor() ([]byte, []int) { - return fileDescriptor_437c556d7375b726, []int{7} + return fileDescriptor_437c556d7375b726, []int{5} } func (m *Tx) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -581,7 +494,9 @@ func (m *Tx) GetPublicKeys() []byte { } type Settlement struct { - Epoch uint64 `protobuf:"varint,1,opt,name=Epoch,proto3" json:"Epoch,omitempty"` + // Epoch contains an epoch when settlement was accepted + Epoch uint64 `protobuf:"varint,1,opt,name=Epoch,proto3" json:"Epoch,omitempty"` + // Transactions is a set of transactions Transactions []*Settlement_Tx `protobuf:"bytes,2,rep,name=Transactions,proto3" json:"Transactions,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -592,7 +507,7 @@ func (m *Settlement) Reset() { *m = Settlement{} } func (m *Settlement) String() string { return proto.CompactTextString(m) } func (*Settlement) ProtoMessage() {} func (*Settlement) Descriptor() ([]byte, []int) { - return fileDescriptor_437c556d7375b726, []int{8} + return fileDescriptor_437c556d7375b726, []int{6} } func (m *Settlement) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -632,7 +547,9 @@ func (m *Settlement) GetTransactions() []*Settlement_Tx { } type Settlement_Receiver struct { - To string `protobuf:"bytes,1,opt,name=To,proto3" json:"To,omitempty"` + // To is the address of funds recipient + To string `protobuf:"bytes,1,opt,name=To,proto3" json:"To,omitempty"` + // Amount is the amount of funds that will be sent Amount *decimal.Decimal `protobuf:"bytes,2,opt,name=Amount,proto3" json:"Amount,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -643,7 +560,7 @@ func (m *Settlement_Receiver) Reset() { *m = Settlement_Receiver{} } func (m *Settlement_Receiver) String() string { return proto.CompactTextString(m) } func (*Settlement_Receiver) ProtoMessage() {} func (*Settlement_Receiver) Descriptor() ([]byte, []int) { - return fileDescriptor_437c556d7375b726, []int{8, 0} + return fileDescriptor_437c556d7375b726, []int{6, 0} } func (m *Settlement_Receiver) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -683,7 +600,9 @@ func (m *Settlement_Receiver) GetAmount() *decimal.Decimal { } type Settlement_Container struct { - CID CID `protobuf:"bytes,1,opt,name=CID,proto3,customtype=CID" json:"CID"` + // CID is container identifier + CID CID `protobuf:"bytes,1,opt,name=CID,proto3,customtype=CID" json:"CID"` + // SGIDs is a set of storage groups that successfully passed the audit SGIDs []SGID `protobuf:"bytes,2,rep,name=SGIDs,proto3,customtype=SGID" json:"SGIDs"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -694,7 +613,7 @@ func (m *Settlement_Container) Reset() { *m = Settlement_Container{} } func (m *Settlement_Container) String() string { return proto.CompactTextString(m) } func (*Settlement_Container) ProtoMessage() {} func (*Settlement_Container) Descriptor() ([]byte, []int) { - return fileDescriptor_437c556d7375b726, []int{8, 1} + return fileDescriptor_437c556d7375b726, []int{6, 1} } func (m *Settlement_Container) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -720,8 +639,11 @@ func (m *Settlement_Container) XXX_DiscardUnknown() { var xxx_messageInfo_Settlement_Container proto.InternalMessageInfo type Settlement_Tx struct { - From string `protobuf:"bytes,1,opt,name=From,proto3" json:"From,omitempty"` - Container Settlement_Container `protobuf:"bytes,2,opt,name=Container,proto3" json:"Container"` + // From is the address of the sender of funds + From string `protobuf:"bytes,1,opt,name=From,proto3" json:"From,omitempty"` + // Container that successfully had passed the audit + Container Settlement_Container `protobuf:"bytes,2,opt,name=Container,proto3" json:"Container"` + // Receivers is a set of addresses of funds recipients Receivers []Settlement_Receiver `protobuf:"bytes,3,rep,name=Receivers,proto3" json:"Receivers"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -732,7 +654,7 @@ func (m *Settlement_Tx) Reset() { *m = Settlement_Tx{} } func (m *Settlement_Tx) String() string { return proto.CompactTextString(m) } func (*Settlement_Tx) ProtoMessage() {} func (*Settlement_Tx) Descriptor() ([]byte, []int) { - return fileDescriptor_437c556d7375b726, []int{8, 2} + return fileDescriptor_437c556d7375b726, []int{6, 2} } func (m *Settlement_Tx) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -779,6 +701,7 @@ func (m *Settlement_Tx) GetReceivers() []Settlement_Receiver { } type ContainerCreateTarget struct { + // CID is container identifier CID CID `protobuf:"bytes,1,opt,name=CID,proto3,customtype=CID" json:"CID"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -789,7 +712,7 @@ func (m *ContainerCreateTarget) Reset() { *m = ContainerCreateTarget{} } func (m *ContainerCreateTarget) String() string { return proto.CompactTextString(m) } func (*ContainerCreateTarget) ProtoMessage() {} func (*ContainerCreateTarget) Descriptor() ([]byte, []int) { - return fileDescriptor_437c556d7375b726, []int{9} + return fileDescriptor_437c556d7375b726, []int{7} } func (m *ContainerCreateTarget) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -815,6 +738,7 @@ func (m *ContainerCreateTarget) XXX_DiscardUnknown() { var xxx_messageInfo_ContainerCreateTarget proto.InternalMessageInfo type WithdrawTarget struct { + // Cheque is a string representation of cheque id Cheque string `protobuf:"bytes,1,opt,name=Cheque,proto3" json:"Cheque,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -825,7 +749,7 @@ func (m *WithdrawTarget) Reset() { *m = WithdrawTarget{} } func (m *WithdrawTarget) String() string { return proto.CompactTextString(m) } func (*WithdrawTarget) ProtoMessage() {} func (*WithdrawTarget) Descriptor() ([]byte, []int) { - return fileDescriptor_437c556d7375b726, []int{10} + return fileDescriptor_437c556d7375b726, []int{8} } func (m *WithdrawTarget) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -864,8 +788,6 @@ func init() { proto.RegisterType((*LockTarget)(nil), "accounting.LockTarget") proto.RegisterType((*Balances)(nil), "accounting.Balances") proto.RegisterType((*PayIO)(nil), "accounting.PayIO") - proto.RegisterType((*Clearing)(nil), "accounting.Clearing") - proto.RegisterType((*Withdraw)(nil), "accounting.Withdraw") proto.RegisterType((*Lifetime)(nil), "accounting.Lifetime") proto.RegisterType((*Tx)(nil), "accounting.Tx") proto.RegisterType((*Settlement)(nil), "accounting.Settlement") @@ -879,62 +801,59 @@ func init() { func init() { proto.RegisterFile("accounting/types.proto", fileDescriptor_437c556d7375b726) } var fileDescriptor_437c556d7375b726 = []byte{ - // 866 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x55, 0x4d, 0x73, 0x22, 0x45, - 0x18, 0xa6, 0x87, 0x09, 0x0c, 0x2f, 0x2c, 0x52, 0xbd, 0xbb, 0x29, 0xa4, 0x4a, 0x82, 0x53, 0x1e, - 0xb0, 0xac, 0x80, 0x66, 0xcb, 0xc4, 0x8b, 0x07, 0x3e, 0x8c, 0x4b, 0xb9, 0x95, 0x4d, 0x75, 0x88, - 0x96, 0x7a, 0x1a, 0x86, 0x0e, 0xe9, 0x0a, 0x74, 0xe3, 0x4c, 0x93, 0x6c, 0xfe, 0x84, 0x67, 0x2f, - 0x9e, 0xfc, 0x11, 0xfe, 0x85, 0x3d, 0xea, 0xcd, 0xf2, 0x90, 0xb2, 0xf0, 0x8f, 0x58, 0xdd, 0xd3, - 0x33, 0xcc, 0xec, 0x82, 0x7a, 0x81, 0xf7, 0xe3, 0x79, 0x9f, 0x7e, 0xbf, 0xba, 0x07, 0xf6, 0x3d, - 0xdf, 0x17, 0x2b, 0x2e, 0x19, 0x9f, 0x75, 0xe5, 0xfd, 0x92, 0x86, 0x9d, 0x65, 0x20, 0xa4, 0xc0, - 0xb0, 0xb1, 0x37, 0x9e, 0x4e, 0xa9, 0xcf, 0x16, 0xde, 0xbc, 0x6b, 0xfe, 0x23, 0x48, 0xe3, 0x70, - 0xc6, 0xe4, 0xf5, 0x6a, 0xd2, 0xf1, 0xc5, 0xa2, 0x3b, 0x13, 0x33, 0xd1, 0xd5, 0xe6, 0xc9, 0xea, - 0x4a, 0x6b, 0x5a, 0xd1, 0x52, 0x04, 0x77, 0x7f, 0xb7, 0xa0, 0xd8, 0x8b, 0x48, 0xf1, 0x87, 0x50, - 0x7c, 0x79, 0xc7, 0x69, 0x30, 0x1a, 0xd6, 0x51, 0x0b, 0xb5, 0x2b, 0xfd, 0x77, 0x5e, 0x3f, 0x1c, - 0xe4, 0xfe, 0x7c, 0x38, 0x88, 0xcd, 0x24, 0x16, 0x70, 0x1d, 0x8a, 0xbd, 0xe9, 0x34, 0xa0, 0x61, - 0x58, 0xb7, 0x5a, 0xa8, 0x5d, 0x22, 0xb1, 0x8a, 0x3f, 0x80, 0x47, 0xe7, 0x5e, 0x40, 0xb9, 0x8c, - 0xfd, 0x79, 0xed, 0xcf, 0x1a, 0xf1, 0x11, 0x94, 0x7b, 0xbe, 0x64, 0xb7, 0xf4, 0x74, 0xc5, 0xa7, - 0x61, 0xdd, 0x6e, 0xa1, 0x76, 0xf9, 0xa8, 0xd6, 0x89, 0x4b, 0x19, 0x46, 0xff, 0x24, 0x0d, 0xc2, - 0xc7, 0xe0, 0xbc, 0x60, 0x57, 0x54, 0xb2, 0x05, 0xad, 0xef, 0xe9, 0x80, 0x27, 0x9d, 0x4d, 0x3f, - 0x3a, 0xb1, 0xaf, 0x6f, 0xab, 0xac, 0x49, 0x82, 0xc5, 0xc7, 0x00, 0x2f, 0x84, 0x7f, 0x33, 0xf6, - 0x82, 0x19, 0x95, 0xf5, 0x82, 0x8e, 0xdc, 0xcf, 0x44, 0x26, 0x5e, 0x92, 0x42, 0xe2, 0x13, 0xa8, - 0x28, 0xcd, 0x74, 0x27, 0xac, 0x17, 0x5b, 0xf9, 0x76, 0xf9, 0xe8, 0x71, 0x3a, 0xd2, 0xf8, 0x48, - 0x06, 0xe8, 0xfe, 0x8a, 0xd2, 0x27, 0xe2, 0x21, 0x54, 0xbf, 0x61, 0xf2, 0x7a, 0x1a, 0x78, 0x77, - 0x26, 0x07, 0xa4, 0x73, 0x68, 0xa4, 0x99, 0xb2, 0x88, 0xe7, 0x39, 0xf2, 0x46, 0x0c, 0xfe, 0x16, - 0x9e, 0x0e, 0x04, 0x97, 0x1e, 0xe3, 0x34, 0x18, 0x04, 0xd4, 0x93, 0xd4, 0x90, 0x59, 0x9a, 0xec, - 0xfd, 0x34, 0xd9, 0x56, 0xe0, 0xf3, 0x1c, 0xd9, 0xce, 0xd0, 0x77, 0xa0, 0x10, 0x49, 0x6e, 0x0f, - 0x9c, 0xbe, 0x37, 0xf7, 0xb8, 0x4f, 0x43, 0xfc, 0x29, 0x38, 0x49, 0xe9, 0x68, 0x67, 0xe9, 0x71, - 0xb7, 0x93, 0xe2, 0xbf, 0x87, 0xbd, 0x73, 0xef, 0x7e, 0xf4, 0x52, 0xad, 0x48, 0x7f, 0x2e, 0xfc, - 0x1b, 0xb3, 0x4d, 0x36, 0x89, 0x55, 0xfc, 0x19, 0x54, 0xc6, 0x81, 0xc7, 0x43, 0xcf, 0x97, 0x4c, - 0x70, 0xb5, 0x41, 0x8a, 0xbd, 0x9a, 0x66, 0x1f, 0xbf, 0x32, 0xc4, 0x19, 0xa4, 0x3b, 0x04, 0x67, - 0x30, 0xa7, 0x5e, 0xc0, 0xf8, 0xec, 0x2d, 0x16, 0xf4, 0xbf, 0x59, 0x26, 0xe0, 0xc4, 0xcd, 0xc5, - 0x55, 0xb0, 0x4c, 0x82, 0x25, 0x62, 0x8d, 0x86, 0xf8, 0x09, 0xec, 0x7d, 0xb1, 0x14, 0xfe, 0xb5, - 0x6e, 0xab, 0x4d, 0x22, 0x05, 0x7f, 0x0c, 0xe5, 0x14, 0x83, 0x5e, 0xe9, 0xb7, 0x8e, 0x22, 0x69, - 0x88, 0xfb, 0x23, 0xda, 0x6c, 0x2b, 0x3e, 0x01, 0x7b, 0xc5, 0x59, 0x34, 0xf7, 0xea, 0xd1, 0xbb, - 0xdb, 0xb6, 0xb6, 0x73, 0xc9, 0x99, 0xec, 0x3b, 0xeb, 0x87, 0x03, 0x5b, 0x49, 0x44, 0x07, 0xa8, - 0x6c, 0xbe, 0xf6, 0xe6, 0x2b, 0xaa, 0xb3, 0xc9, 0x93, 0x48, 0x71, 0x9f, 0x81, 0xc6, 0xe0, 0x47, - 0x50, 0xba, 0xe4, 0x73, 0xb6, 0x60, 0x92, 0x4e, 0x6b, 0x39, 0x5c, 0x05, 0x38, 0xa3, 0xe2, 0xf4, - 0x42, 0xa7, 0x5c, 0x43, 0xb8, 0x02, 0xce, 0x19, 0x15, 0xba, 0xe9, 0x35, 0xcb, 0x7d, 0x40, 0x60, - 0x8d, 0x5f, 0xe1, 0x4f, 0xc0, 0x56, 0x0f, 0x8a, 0x49, 0xe5, 0x71, 0xb6, 0x84, 0xce, 0xf8, 0x7e, - 0x49, 0xa3, 0x24, 0x94, 0x44, 0x34, 0x14, 0x63, 0xb0, 0x4f, 0x03, 0xb1, 0x30, 0x17, 0x5d, 0xcb, - 0xaa, 0x6d, 0x63, 0x61, 0xae, 0xb6, 0x35, 0x16, 0xb8, 0x0d, 0x85, 0xde, 0x42, 0x11, 0xed, 0xbc, - 0xca, 0xc6, 0x8f, 0x9b, 0x00, 0xe7, 0xab, 0xc9, 0x9c, 0xf9, 0x5f, 0xd1, 0xfb, 0x50, 0xdf, 0xe3, - 0x0a, 0x49, 0x59, 0xdc, 0x13, 0xd0, 0x67, 0xe3, 0x32, 0x14, 0x2f, 0xf9, 0x0d, 0x17, 0x77, 0xbc, - 0x96, 0x53, 0xa5, 0xc4, 0x13, 0xab, 0x21, 0x5c, 0x32, 0x2b, 0x56, 0xb3, 0x94, 0x38, 0xe2, 0x9c, - 0x06, 0xb5, 0xbc, 0xfb, 0x73, 0x1e, 0xe0, 0x82, 0x4a, 0x39, 0xa7, 0x0b, 0xca, 0xe5, 0x66, 0x90, - 0x28, 0x3d, 0xc8, 0xcf, 0xb7, 0xae, 0x5e, 0x66, 0x22, 0x1b, 0x0e, 0x35, 0xd4, 0x0c, 0xbc, 0x31, - 0x04, 0x87, 0x50, 0x9f, 0xb2, 0x5b, 0x1a, 0x98, 0x16, 0xa0, 0x2d, 0x2d, 0xb0, 0xfe, 0xbd, 0x05, - 0x8d, 0x33, 0x28, 0x25, 0x17, 0x11, 0xbf, 0x07, 0xf9, 0x41, 0xf2, 0xe0, 0x96, 0xcd, 0x83, 0xab, - 0x4c, 0x44, 0xfd, 0x60, 0x17, 0xf6, 0x2e, 0xbe, 0x1c, 0x0d, 0xa3, 0x4c, 0x2b, 0xfd, 0x8a, 0x01, - 0xd8, 0xca, 0x48, 0x22, 0x57, 0xe3, 0x97, 0x68, 0xb4, 0xf1, 0x9c, 0x50, 0x6a, 0x4e, 0xc3, 0xd4, - 0x51, 0x26, 0xaf, 0xd6, 0x8e, 0x62, 0x13, 0x9c, 0xb9, 0x33, 0xa9, 0x1c, 0x07, 0x50, 0x8a, 0xcb, - 0x56, 0xef, 0xb9, 0x6a, 0xd9, 0xc1, 0x0e, 0x96, 0x18, 0x17, 0x93, 0x24, 0x71, 0xee, 0xf1, 0x8e, - 0x07, 0xec, 0x3f, 0x3a, 0xe0, 0xb6, 0xdf, 0x7c, 0x3e, 0xf1, 0x3e, 0x14, 0x06, 0xd7, 0xf4, 0x87, - 0x15, 0x35, 0xa5, 0x1a, 0xad, 0xdf, 0x7b, 0xbd, 0x6e, 0xa2, 0xdf, 0xd6, 0x4d, 0xf4, 0xc7, 0xba, - 0x89, 0xfe, 0x5a, 0x37, 0xd1, 0x4f, 0x7f, 0x37, 0x73, 0xdf, 0x7d, 0x94, 0xfa, 0x20, 0xf2, 0x70, - 0xe9, 0xfb, 0x87, 0x53, 0x7a, 0xdb, 0xe5, 0x54, 0x5c, 0x85, 0x87, 0xd1, 0xe7, 0x70, 0x53, 0xc9, - 0xa4, 0xa0, 0x2d, 0xcf, 0xfe, 0x09, 0x00, 0x00, 0xff, 0xff, 0x66, 0x69, 0x27, 0xa6, 0x81, 0x07, - 0x00, 0x00, + // 821 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x55, 0x4d, 0x6f, 0xe3, 0x44, + 0x18, 0xce, 0x38, 0x69, 0x3e, 0xde, 0x64, 0x83, 0x35, 0xbb, 0x5b, 0x85, 0x48, 0xa4, 0xc1, 0xe2, + 0x10, 0x84, 0xea, 0x88, 0xae, 0x68, 0xb9, 0x70, 0x88, 0x13, 0xca, 0x56, 0xac, 0xba, 0xd5, 0xd4, + 0x05, 0x01, 0x27, 0xd7, 0x99, 0xa6, 0x56, 0x93, 0x99, 0x60, 0x8f, 0xfb, 0xf1, 0x27, 0x38, 0x73, + 0xe1, 0xc4, 0x8f, 0xe0, 0x2f, 0xec, 0x11, 0x6e, 0x88, 0x43, 0x85, 0xc2, 0x1f, 0x41, 0x33, 0x1e, + 0x3b, 0x76, 0x95, 0xc0, 0x25, 0x79, 0x3f, 0x9e, 0xf7, 0x99, 0xf7, 0x6b, 0xc6, 0xb0, 0xeb, 0xf9, + 0x3e, 0x8f, 0x99, 0x08, 0xd8, 0x6c, 0x28, 0x1e, 0x96, 0x34, 0xb2, 0x97, 0x21, 0x17, 0x1c, 0xc3, + 0xda, 0xde, 0x7d, 0x39, 0xa5, 0x7e, 0xb0, 0xf0, 0xe6, 0x43, 0xfd, 0x9f, 0x40, 0xba, 0xfb, 0xb3, + 0x40, 0x5c, 0xc7, 0x97, 0xb6, 0xcf, 0x17, 0xc3, 0x19, 0x9f, 0xf1, 0xa1, 0x32, 0x5f, 0xc6, 0x57, + 0x4a, 0x53, 0x8a, 0x92, 0x12, 0xb8, 0xf5, 0x87, 0x01, 0xb5, 0x51, 0x42, 0x8a, 0x3f, 0x86, 0xda, + 0xdb, 0x3b, 0x46, 0xc3, 0x93, 0x49, 0x07, 0xf5, 0xd1, 0xa0, 0xe5, 0xbc, 0xf7, 0xee, 0x71, 0xaf, + 0xf4, 0xd7, 0xe3, 0x5e, 0x6a, 0x26, 0xa9, 0x80, 0x3b, 0x50, 0x1b, 0x4d, 0xa7, 0x21, 0x8d, 0xa2, + 0x8e, 0xd1, 0x47, 0x83, 0x06, 0x49, 0x55, 0xfc, 0x11, 0x3c, 0x3b, 0xf3, 0x42, 0xca, 0x44, 0xea, + 0x2f, 0x2b, 0x7f, 0xd1, 0x88, 0x0f, 0xa0, 0x39, 0xf2, 0x45, 0x70, 0x4b, 0x8f, 0x63, 0x36, 0x8d, + 0x3a, 0x95, 0x3e, 0x1a, 0x34, 0x0f, 0x4c, 0x3b, 0x2d, 0x65, 0x92, 0xfc, 0x93, 0x3c, 0x08, 0x1f, + 0x42, 0xfd, 0x4d, 0x70, 0x45, 0x45, 0xb0, 0xa0, 0x9d, 0x1d, 0x15, 0xf0, 0xc2, 0x5e, 0xf7, 0xc3, + 0x4e, 0x7d, 0x4e, 0x45, 0x66, 0x4d, 0x32, 0x2c, 0x3e, 0x04, 0x78, 0xc3, 0xfd, 0x1b, 0xd7, 0x0b, + 0x67, 0x54, 0x74, 0xaa, 0x2a, 0x72, 0xb7, 0x10, 0x99, 0x79, 0x49, 0x0e, 0x89, 0x8f, 0xa0, 0x25, + 0x35, 0xdd, 0x9d, 0xa8, 0x53, 0xeb, 0x97, 0x07, 0xcd, 0x83, 0xe7, 0xf9, 0x48, 0xed, 0x23, 0x05, + 0xa0, 0xf5, 0x1b, 0xca, 0x9f, 0x88, 0x27, 0xd0, 0xfe, 0x36, 0x10, 0xd7, 0xd3, 0xd0, 0xbb, 0xd3, + 0x39, 0x20, 0x95, 0x43, 0x37, 0xcf, 0x54, 0x44, 0xbc, 0x2e, 0x91, 0x27, 0x31, 0xf8, 0x3b, 0x78, + 0x39, 0xe6, 0x4c, 0x78, 0x01, 0xa3, 0xe1, 0x38, 0xa4, 0x9e, 0xa0, 0x9a, 0xcc, 0x50, 0x64, 0x1f, + 0xe6, 0xc9, 0x36, 0x02, 0x5f, 0x97, 0xc8, 0x66, 0x06, 0xa7, 0x0e, 0xd5, 0x44, 0xb2, 0x46, 0x50, + 0x77, 0xbc, 0xb9, 0xc7, 0x7c, 0x1a, 0xe1, 0xcf, 0xa0, 0x9e, 0x95, 0x8e, 0xb6, 0x96, 0x9e, 0x76, + 0x3b, 0x2b, 0xfe, 0x07, 0xd8, 0x39, 0xf3, 0x1e, 0x4e, 0xde, 0xca, 0x15, 0x71, 0xe6, 0xdc, 0xbf, + 0xd1, 0xdb, 0x54, 0x21, 0xa9, 0x8a, 0x3f, 0x87, 0x96, 0x1b, 0x7a, 0x2c, 0xf2, 0x7c, 0x11, 0x70, + 0x26, 0x37, 0x48, 0xb2, 0xb7, 0xf3, 0xec, 0xee, 0xbd, 0x26, 0x2e, 0x20, 0xad, 0x9f, 0xd0, 0x7a, + 0x07, 0xf0, 0x11, 0x54, 0x62, 0x16, 0x24, 0xdd, 0x6c, 0x1f, 0xbc, 0xbf, 0x69, 0x17, 0xec, 0x0b, + 0x16, 0x08, 0xa7, 0xbe, 0x7a, 0xdc, 0xab, 0x48, 0x89, 0xa8, 0x00, 0xfc, 0x02, 0x76, 0xbe, 0xf1, + 0xe6, 0x31, 0x55, 0xad, 0x2b, 0x93, 0x44, 0xb1, 0x5e, 0x81, 0xc2, 0xe0, 0x67, 0xd0, 0xb8, 0x60, + 0xf3, 0x60, 0x11, 0x08, 0x3a, 0x35, 0x4b, 0xb8, 0x0d, 0x70, 0x4a, 0xf9, 0xf1, 0xf9, 0x97, 0x4b, + 0xee, 0x5f, 0x9b, 0x08, 0xb7, 0xa0, 0x7e, 0x4a, 0xb9, 0x2a, 0xc5, 0x34, 0xac, 0x47, 0x04, 0x86, + 0x7b, 0x8f, 0x3f, 0x85, 0x8a, 0xbc, 0xa6, 0x3a, 0x95, 0xe7, 0xc5, 0x4a, 0x6c, 0xf7, 0x61, 0x49, + 0x93, 0x24, 0xa4, 0x44, 0x14, 0x14, 0x63, 0xa8, 0x1c, 0x87, 0x7c, 0xa1, 0xaf, 0x8f, 0x92, 0x71, + 0x1b, 0x0c, 0x97, 0xeb, 0x0b, 0x63, 0xb8, 0x1c, 0x0f, 0xa0, 0x3a, 0x5a, 0x48, 0xa2, 0xad, 0x17, + 0x44, 0xfb, 0x71, 0x0f, 0xe0, 0x2c, 0xbe, 0x9c, 0x07, 0xfe, 0xd7, 0xf4, 0x21, 0x52, 0xb7, 0xa3, + 0x45, 0x72, 0x16, 0xeb, 0x08, 0xd4, 0xd9, 0xb8, 0x09, 0xb5, 0x0b, 0x76, 0xc3, 0xf8, 0x1d, 0x33, + 0x4b, 0xb2, 0x94, 0x74, 0xc9, 0x4c, 0x84, 0x1b, 0x7a, 0x70, 0xa6, 0x21, 0xc5, 0x13, 0xc6, 0x68, + 0x68, 0x96, 0xad, 0x5f, 0xca, 0x00, 0xe7, 0x54, 0x88, 0x39, 0x5d, 0x50, 0xa6, 0x5a, 0xa7, 0x1a, + 0xa1, 0x47, 0x9a, 0x28, 0xf8, 0x8b, 0x8d, 0x03, 0x2d, 0x4c, 0x64, 0xcd, 0x61, 0xbb, 0xf7, 0xc5, + 0xa9, 0x76, 0x27, 0x50, 0x27, 0xd4, 0xa7, 0xc1, 0x2d, 0x0d, 0x75, 0x0b, 0xd0, 0x86, 0x16, 0x18, + 0xff, 0xdd, 0x82, 0xee, 0x29, 0x34, 0xb2, 0xf5, 0xc6, 0x1f, 0x40, 0x79, 0x9c, 0x3d, 0x63, 0x4d, + 0xfd, 0x8c, 0x49, 0x13, 0x91, 0x3f, 0xd8, 0x82, 0x9d, 0xf3, 0xaf, 0x4e, 0x26, 0x49, 0xa6, 0x2d, + 0xa7, 0xa5, 0x01, 0x15, 0x69, 0x24, 0x89, 0xab, 0xfb, 0x6b, 0x32, 0xda, 0x74, 0x4e, 0x28, 0x37, + 0xa7, 0x49, 0xee, 0x28, 0x9d, 0x57, 0x7f, 0x4b, 0xb1, 0x19, 0x4e, 0xef, 0x73, 0x2e, 0xc7, 0x31, + 0x34, 0xd2, 0xb2, 0xe5, 0x2b, 0x29, 0x5b, 0xb6, 0xb7, 0x85, 0x25, 0xc5, 0xa5, 0x24, 0x59, 0x9c, + 0x75, 0xb8, 0xe5, 0x59, 0xf8, 0x9f, 0x0e, 0x58, 0x83, 0xa7, 0x8f, 0x12, 0xde, 0x85, 0xea, 0xf8, + 0x9a, 0xfe, 0x18, 0x53, 0x5d, 0xaa, 0xd6, 0x9c, 0xd1, 0xbb, 0x55, 0x0f, 0xfd, 0xbe, 0xea, 0xa1, + 0x3f, 0x57, 0x3d, 0xf4, 0xf7, 0xaa, 0x87, 0x7e, 0xfe, 0xa7, 0x57, 0xfa, 0xfe, 0x93, 0xdc, 0x67, + 0x86, 0x45, 0x4b, 0xdf, 0xdf, 0x9f, 0xd2, 0xdb, 0x21, 0xa3, 0xfc, 0x2a, 0xda, 0x4f, 0x3e, 0x32, + 0xeb, 0x4a, 0x2e, 0xab, 0xca, 0xf2, 0xea, 0xdf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x3c, 0x2d, 0x7e, + 0x6b, 0xd7, 0x06, 0x00, 0x00, } func (m *Account) Marshal() (dAtA []byte, err error) { @@ -1201,98 +1120,6 @@ func (m *PayIO) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *Clearing) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Clearing) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Clearing) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.Transactions) > 0 { - for iNdEx := len(m.Transactions) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Transactions[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *Withdraw) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Withdraw) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Withdraw) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.Transaction != nil { - { - size, err := m.Transaction.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if m.Epoch != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.Epoch)) - i-- - dAtA[i] = 0x10 - } - if len(m.ID) > 0 { - i -= len(m.ID) - copy(dAtA[i:], m.ID) - i = encodeVarintTypes(dAtA, i, uint64(len(m.ID))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - func (m *Lifetime) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -1794,47 +1621,6 @@ func (m *PayIO) Size() (n int) { return n } -func (m *Clearing) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Transactions) > 0 { - for _, e := range m.Transactions { - l = e.Size() - n += 1 + l + sovTypes(uint64(l)) - } - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *Withdraw) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ID) - if l > 0 { - n += 1 + l + sovTypes(uint64(l)) - } - if m.Epoch != 0 { - n += 1 + sovTypes(uint64(m.Epoch)) - } - if m.Transaction != nil { - l = m.Transaction.Size() - n += 1 + l + sovTypes(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - func (m *Lifetime) Size() (n int) { if m == nil { return 0 @@ -2614,235 +2400,6 @@ func (m *PayIO) Unmarshal(dAtA []byte) error { } return nil } -func (m *Clearing) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Clearing: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Clearing: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Transactions", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Transactions = append(m.Transactions, Tx{}) - if err := m.Transactions[len(m.Transactions)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Withdraw) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Withdraw: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Withdraw: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ID = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Epoch", wireType) - } - m.Epoch = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Epoch |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Transaction", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Transaction == nil { - m.Transaction = &Tx{} - } - if err := m.Transaction.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func (m *Lifetime) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/accounting/withdraw.pb.go b/accounting/withdraw.pb.go index 967a2ce..b50bc1c 100644 --- a/accounting/withdraw.pb.go +++ b/accounting/withdraw.pb.go @@ -29,14 +29,19 @@ var _ = math.Inf const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package type Item struct { - ID ChequeID `protobuf:"bytes,1,opt,name=ID,proto3,customtype=ChequeID" json:"ID"` - OwnerID OwnerID `protobuf:"bytes,2,opt,name=OwnerID,proto3,customtype=OwnerID" json:"OwnerID"` - Amount *decimal.Decimal `protobuf:"bytes,3,opt,name=Amount,proto3" json:"Amount,omitempty"` - Height uint64 `protobuf:"varint,4,opt,name=Height,proto3" json:"Height,omitempty"` - Payload []byte `protobuf:"bytes,5,opt,name=Payload,proto3" json:"Payload,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + // ID is a cheque identifier + ID ChequeID `protobuf:"bytes,1,opt,name=ID,proto3,customtype=ChequeID" json:"ID"` + // OwnerID is a wallet address + OwnerID OwnerID `protobuf:"bytes,2,opt,name=OwnerID,proto3,customtype=OwnerID" json:"OwnerID"` + // Amount of funds + Amount *decimal.Decimal `protobuf:"bytes,3,opt,name=Amount,proto3" json:"Amount,omitempty"` + // Height is the neo blockchain height until the cheque is valid + Height uint64 `protobuf:"varint,4,opt,name=Height,proto3" json:"Height,omitempty"` + // Payload contains cheque representation in bytes + Payload []byte `protobuf:"bytes,5,opt,name=Payload,proto3" json:"Payload,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *Item) Reset() { *m = Item{} } @@ -90,8 +95,11 @@ func (m *Item) GetPayload() []byte { } type GetRequest struct { - ID ChequeID `protobuf:"bytes,1,opt,name=ID,proto3,customtype=ChequeID" json:"ID"` - OwnerID OwnerID `protobuf:"bytes,2,opt,name=OwnerID,proto3,customtype=OwnerID" json:"OwnerID"` + // ID is cheque identifier + ID ChequeID `protobuf:"bytes,1,opt,name=ID,proto3,customtype=ChequeID" json:"ID"` + // OwnerID is a wallet address + OwnerID OwnerID `protobuf:"bytes,2,opt,name=OwnerID,proto3,customtype=OwnerID" json:"OwnerID"` + // TTL must be larger than zero, it decreased in every neofs-node TTL uint32 `protobuf:"varint,3,opt,name=TTL,proto3" json:"TTL,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -135,6 +143,7 @@ func (m *GetRequest) GetTTL() uint32 { } type GetResponse struct { + // Item is cheque with meta information Withdraw *Item `protobuf:"bytes,1,opt,name=Withdraw,proto3" json:"Withdraw,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -178,15 +187,21 @@ func (m *GetResponse) GetWithdraw() *Item { } type PutRequest struct { - OwnerID OwnerID `protobuf:"bytes,1,opt,name=OwnerID,proto3,customtype=OwnerID" json:"OwnerID"` - Amount *decimal.Decimal `protobuf:"bytes,2,opt,name=Amount,proto3" json:"Amount,omitempty"` - Height uint64 `protobuf:"varint,3,opt,name=Height,proto3" json:"Height,omitempty"` - MessageID MessageID `protobuf:"bytes,4,opt,name=MessageID,proto3,customtype=MessageID" json:"MessageID"` - Signature []byte `protobuf:"bytes,5,opt,name=Signature,proto3" json:"Signature,omitempty"` - TTL uint32 `protobuf:"varint,6,opt,name=TTL,proto3" json:"TTL,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + // OwnerID is a wallet address + OwnerID OwnerID `protobuf:"bytes,1,opt,name=OwnerID,proto3,customtype=OwnerID" json:"OwnerID"` + // Amount of funds + Amount *decimal.Decimal `protobuf:"bytes,2,opt,name=Amount,proto3" json:"Amount,omitempty"` + // Height is the neo blockchain height until the cheque is valid + Height uint64 `protobuf:"varint,3,opt,name=Height,proto3" json:"Height,omitempty"` + // MessageID is a nonce for uniq request (UUIDv4) + MessageID MessageID `protobuf:"bytes,4,opt,name=MessageID,proto3,customtype=MessageID" json:"MessageID"` + // Signature is a signature of the sent request + Signature []byte `protobuf:"bytes,5,opt,name=Signature,proto3" json:"Signature,omitempty"` + // TTL must be larger than zero, it decreased in every neofs-node + TTL uint32 `protobuf:"varint,6,opt,name=TTL,proto3" json:"TTL,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *PutRequest) Reset() { *m = PutRequest{} } @@ -247,6 +262,7 @@ func (m *PutRequest) GetTTL() uint32 { } type PutResponse struct { + // ID is cheque identifier ID ChequeID `protobuf:"bytes,1,opt,name=ID,proto3,customtype=ChequeID" json:"ID"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -283,7 +299,9 @@ func (m *PutResponse) XXX_DiscardUnknown() { var xxx_messageInfo_PutResponse proto.InternalMessageInfo type ListRequest struct { - OwnerID OwnerID `protobuf:"bytes,1,opt,name=OwnerID,proto3,customtype=OwnerID" json:"OwnerID"` + // OwnerID is a wallet address + OwnerID OwnerID `protobuf:"bytes,1,opt,name=OwnerID,proto3,customtype=OwnerID" json:"OwnerID"` + // TTL must be larger than zero, it decreased in every neofs-node TTL uint32 `protobuf:"varint,2,opt,name=TTL,proto3" json:"TTL,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -327,6 +345,7 @@ func (m *ListRequest) GetTTL() uint32 { } type ListResponse struct { + // Item is a set of cheques with meta information Items []*Item `protobuf:"bytes,1,rep,name=Items,proto3" json:"Items,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -370,14 +389,19 @@ func (m *ListResponse) GetItems() []*Item { } type DeleteRequest struct { - ID ChequeID `protobuf:"bytes,1,opt,name=ID,proto3,customtype=ChequeID" json:"ID"` - OwnerID OwnerID `protobuf:"bytes,2,opt,name=OwnerID,proto3,customtype=OwnerID" json:"OwnerID"` - MessageID MessageID `protobuf:"bytes,3,opt,name=MessageID,proto3,customtype=MessageID" json:"MessageID"` - Signature []byte `protobuf:"bytes,4,opt,name=Signature,proto3" json:"Signature,omitempty"` - TTL uint32 `protobuf:"varint,5,opt,name=TTL,proto3" json:"TTL,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + // ID is cheque identifier + ID ChequeID `protobuf:"bytes,1,opt,name=ID,proto3,customtype=ChequeID" json:"ID"` + // OwnerID is a wallet address + OwnerID OwnerID `protobuf:"bytes,2,opt,name=OwnerID,proto3,customtype=OwnerID" json:"OwnerID"` + // MessageID is a nonce for uniq request (UUIDv4) + MessageID MessageID `protobuf:"bytes,3,opt,name=MessageID,proto3,customtype=MessageID" json:"MessageID"` + // Signature is a signature of the sent request + Signature []byte `protobuf:"bytes,4,opt,name=Signature,proto3" json:"Signature,omitempty"` + // TTL must be larger than zero, it decreased in every neofs-node + TTL uint32 `protobuf:"varint,5,opt,name=TTL,proto3" json:"TTL,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *DeleteRequest) Reset() { *m = DeleteRequest{} } @@ -423,6 +447,7 @@ func (m *DeleteRequest) GetTTL() uint32 { return 0 } +// DeleteResponse is empty type DeleteResponse struct { XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -523,9 +548,13 @@ const _ = grpc.SupportPackageIsVersion4 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type WithdrawClient interface { + // Get returns cheque if it was signed by inner ring nodes Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*GetResponse, error) + // Put ask inner ring nodes to sign a cheque for withdraw invoke Put(ctx context.Context, in *PutRequest, opts ...grpc.CallOption) (*PutResponse, error) + // List shows all user's checks List(ctx context.Context, in *ListRequest, opts ...grpc.CallOption) (*ListResponse, error) + // Delete allows user to remove unused cheque Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteResponse, error) } @@ -575,9 +604,13 @@ func (c *withdrawClient) Delete(ctx context.Context, in *DeleteRequest, opts ... // WithdrawServer is the server API for Withdraw service. type WithdrawServer interface { + // Get returns cheque if it was signed by inner ring nodes Get(context.Context, *GetRequest) (*GetResponse, error) + // Put ask inner ring nodes to sign a cheque for withdraw invoke Put(context.Context, *PutRequest) (*PutResponse, error) + // List shows all user's checks List(context.Context, *ListRequest) (*ListResponse, error) + // Delete allows user to remove unused cheque Delete(context.Context, *DeleteRequest) (*DeleteResponse, error) } diff --git a/bootstrap/service.pb.go b/bootstrap/service.pb.go index 2fcdb4d..14f8e9e 100644 --- a/bootstrap/service.pb.go +++ b/bootstrap/service.pb.go @@ -27,10 +27,12 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package -// Request message to communicate between DHT nodes type Request struct { - Type NodeType `protobuf:"varint,1,opt,name=type,proto3,customtype=NodeType" json:"type"` - Info NodeInfo `protobuf:"bytes,2,opt,name=info,proto3" json:"info"` + // Type is NodeType, can be InnerRingNode (type=1) or StorageNode (type=2) + Type NodeType `protobuf:"varint,1,opt,name=type,proto3,customtype=NodeType" json:"type"` + // Info contains information about node + Info NodeInfo `protobuf:"bytes,2,opt,name=info,proto3" json:"info"` + // TTL must be larger than zero, it decreased in every neofs-node TTL uint32 `protobuf:"varint,3,opt,name=TTL,proto3" json:"TTL,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -120,6 +122,7 @@ const _ = grpc.SupportPackageIsVersion4 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type BootstrapClient interface { + // Process is method that allows to register node in the network and receive actual netmap Process(ctx context.Context, in *Request, opts ...grpc.CallOption) (*SpreadMap, error) } @@ -142,6 +145,7 @@ func (c *bootstrapClient) Process(ctx context.Context, in *Request, opts ...grpc // BootstrapServer is the server API for Bootstrap service. type BootstrapServer interface { + // Process is method that allows to register node in the network and receive actual netmap Process(context.Context, *Request) (*SpreadMap, error) } diff --git a/bootstrap/types.pb.go b/bootstrap/types.pb.go index a90de05..f279919 100644 --- a/bootstrap/types.pb.go +++ b/bootstrap/types.pb.go @@ -24,7 +24,9 @@ var _ = math.Inf const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package type SpreadMap struct { - Epoch uint64 `protobuf:"varint,1,opt,name=Epoch,proto3" json:"Epoch,omitempty"` + // Epoch is current epoch for netmap + Epoch uint64 `protobuf:"varint,1,opt,name=Epoch,proto3" json:"Epoch,omitempty"` + // NetMap is a set of NodeInfos NetMap []NodeInfo `protobuf:"bytes,2,rep,name=NetMap,proto3" json:"NetMap"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -74,9 +76,13 @@ func (m *SpreadMap) GetNetMap() []NodeInfo { } type NodeInfo struct { - Address string `protobuf:"bytes,1,opt,name=Address,proto3" json:"address"` - PubKey []byte `protobuf:"bytes,2,opt,name=PubKey,proto3" json:"pubkey,omitempty"` - Options []string `protobuf:"bytes,3,rep,name=Options,proto3" json:"options,omitempty"` + // Address is a node [multi-address](https://github.com/multiformats/multiaddr) + Address string `protobuf:"bytes,1,opt,name=Address,proto3" json:"address"` + // PubKey is a compressed public key representation in bytes + PubKey []byte `protobuf:"bytes,2,opt,name=PubKey,proto3" json:"pubkey,omitempty"` + // Options is set of node optional information, such as storage capacity, node location, price and etc + Options []string `protobuf:"bytes,3,rep,name=Options,proto3" json:"options,omitempty"` + // Status is bitmap status of the node Status NodeStatus `protobuf:"varint,4,opt,name=Status,proto3,customtype=NodeStatus" json:"status"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` diff --git a/container/service.pb.go b/container/service.pb.go index bc2e831..9cc6991 100644 --- a/container/service.pb.go +++ b/container/service.pb.go @@ -28,17 +28,22 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package -// NewRequest message to create new container type PutRequest struct { - MessageID MessageID `protobuf:"bytes,1,opt,name=MessageID,proto3,customtype=MessageID" json:"MessageID"` - Capacity uint64 `protobuf:"varint,2,opt,name=Capacity,proto3" json:"Capacity,omitempty"` - OwnerID OwnerID `protobuf:"bytes,3,opt,name=OwnerID,proto3,customtype=OwnerID" json:"OwnerID"` - Rules netmap.PlacementRule `protobuf:"bytes,4,opt,name=rules,proto3" json:"rules"` - Signature []byte `protobuf:"bytes,5,opt,name=Signature,proto3" json:"Signature,omitempty"` - TTL uint32 `protobuf:"varint,6,opt,name=TTL,proto3" json:"TTL,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + // MessageID is a nonce for uniq container id calculation + MessageID MessageID `protobuf:"bytes,1,opt,name=MessageID,proto3,customtype=MessageID" json:"MessageID"` + // Capacity defines amount of data that can be stored in the container (doesn't used for now). + Capacity uint64 `protobuf:"varint,2,opt,name=Capacity,proto3" json:"Capacity,omitempty"` + // OwnerID is a wallet address + OwnerID OwnerID `protobuf:"bytes,3,opt,name=OwnerID,proto3,customtype=OwnerID" json:"OwnerID"` + // Rules define storage policy for the object inside the container. + Rules netmap.PlacementRule `protobuf:"bytes,4,opt,name=rules,proto3" json:"rules"` + // Signature of the user (owner id) + Signature []byte `protobuf:"bytes,5,opt,name=Signature,proto3" json:"Signature,omitempty"` + // TTL must be larger than zero, it decreased in every neofs-node + TTL uint32 `protobuf:"varint,6,opt,name=TTL,proto3" json:"TTL,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *PutRequest) Reset() { *m = PutRequest{} } @@ -98,8 +103,8 @@ func (m *PutRequest) GetTTL() uint32 { return 0 } -// PutResponse message to respond about container uuid type PutResponse struct { + // CID (container id) is a SHA256 hash of the container structure CID CID `protobuf:"bytes,1,opt,name=CID,proto3,customtype=CID" json:"CID"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -136,8 +141,11 @@ func (m *PutResponse) XXX_DiscardUnknown() { var xxx_messageInfo_PutResponse proto.InternalMessageInfo type DeleteRequest struct { - CID CID `protobuf:"bytes,1,opt,name=CID,proto3,customtype=CID" json:"CID"` - TTL uint32 `protobuf:"varint,2,opt,name=TTL,proto3" json:"TTL,omitempty"` + // CID (container id) is a SHA256 hash of the container structure + CID CID `protobuf:"bytes,1,opt,name=CID,proto3,customtype=CID" json:"CID"` + // TTL must be larger than zero, it decreased in every neofs-node + TTL uint32 `protobuf:"varint,2,opt,name=TTL,proto3" json:"TTL,omitempty"` + // Signature of the container owner Signature []byte `protobuf:"bytes,3,opt,name=Signature,proto3" json:"Signature,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -187,6 +195,8 @@ func (m *DeleteRequest) GetSignature() []byte { return nil } +// DeleteResponse is empty because delete operation is asynchronous and done +// via consensus in inner ring nodes type DeleteResponse struct { XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -222,9 +232,10 @@ func (m *DeleteResponse) XXX_DiscardUnknown() { var xxx_messageInfo_DeleteResponse proto.InternalMessageInfo -// GetRequest message to fetch container placement rules type GetRequest struct { - CID CID `protobuf:"bytes,1,opt,name=CID,proto3,customtype=CID" json:"CID"` + // CID (container id) is a SHA256 hash of the container structure + CID CID `protobuf:"bytes,1,opt,name=CID,proto3,customtype=CID" json:"CID"` + // TTL must be larger than zero, it decreased in every neofs-node TTL uint32 `protobuf:"varint,2,opt,name=TTL,proto3" json:"TTL,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -267,8 +278,8 @@ func (m *GetRequest) GetTTL() uint32 { return 0 } -// GetResponse message with container structure type GetResponse struct { + // Container is a structure that contains placement rules and owner id Container *Container `protobuf:"bytes,1,opt,name=Container,proto3" json:"Container,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -311,9 +322,10 @@ func (m *GetResponse) GetContainer() *Container { return nil } -// ListRequest message to list containers for user type ListRequest struct { - OwnerID OwnerID `protobuf:"bytes,1,opt,name=OwnerID,proto3,customtype=OwnerID" json:"OwnerID"` + // OwnerID is a wallet address + OwnerID OwnerID `protobuf:"bytes,1,opt,name=OwnerID,proto3,customtype=OwnerID" json:"OwnerID"` + // TTL must be larger than zero, it decreased in every neofs-node TTL uint32 `protobuf:"varint,2,opt,name=TTL,proto3" json:"TTL,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -356,8 +368,8 @@ func (m *ListRequest) GetTTL() uint32 { return 0 } -// ListResponse message to respond about all user containers type ListResponse struct { + // CID (container id) is list of SHA256 hashes of the container structures CID []CID `protobuf:"bytes,1,rep,name=CID,proto3,customtype=CID" json:"CID"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -455,12 +467,16 @@ const _ = grpc.SupportPackageIsVersion4 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type ServiceClient interface { - // Create container + // Put request proposes container to the inner ring nodes. They will + // accept new container if user has enough deposit. All containers + // are accepted by the consensus, therefore it is asynchronous process. Put(ctx context.Context, in *PutRequest, opts ...grpc.CallOption) (*PutResponse, error) - // Delete container ... discuss implementation later + // Delete container removes it from the inner ring container storage. It + // also asynchronous process done by consensus. Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteResponse, error) - // Get container + // Get container returns container instance Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*GetResponse, error) + // List returns all user's containers List(ctx context.Context, in *ListRequest, opts ...grpc.CallOption) (*ListResponse, error) } @@ -510,12 +526,16 @@ func (c *serviceClient) List(ctx context.Context, in *ListRequest, opts ...grpc. // ServiceServer is the server API for Service service. type ServiceServer interface { - // Create container + // Put request proposes container to the inner ring nodes. They will + // accept new container if user has enough deposit. All containers + // are accepted by the consensus, therefore it is asynchronous process. Put(context.Context, *PutRequest) (*PutResponse, error) - // Delete container ... discuss implementation later + // Delete container removes it from the inner ring container storage. It + // also asynchronous process done by consensus. Delete(context.Context, *DeleteRequest) (*DeleteResponse, error) - // Get container + // Get container returns container instance Get(context.Context, *GetRequest) (*GetResponse, error) + // List returns all user's containers List(context.Context, *ListRequest) (*ListResponse, error) } diff --git a/decimal/decimal.pb.go b/decimal/decimal.pb.go index e125af4..d2bed7d 100644 --- a/decimal/decimal.pb.go +++ b/decimal/decimal.pb.go @@ -23,8 +23,11 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +// Decimal is a structure used for representation of assets amount type Decimal struct { - Value int64 `protobuf:"varint,1,opt,name=Value,proto3" json:"Value,omitempty"` + // Value is value number + Value int64 `protobuf:"varint,1,opt,name=Value,proto3" json:"Value,omitempty"` + // Precision is precision number Precision uint32 `protobuf:"varint,2,opt,name=Precision,proto3" json:"Precision,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` diff --git a/object/service.pb.go b/object/service.pb.go index aede5cd..8301ebb 100644 --- a/object/service.pb.go +++ b/object/service.pb.go @@ -434,6 +434,8 @@ func (m *DeleteRequest) GetToken() *session.Token { return nil } +// DeleteResponse is empty because we cannot guarantee permanent object removal +// in distributed system. type DeleteResponse struct { XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -469,7 +471,6 @@ func (m *DeleteResponse) XXX_DiscardUnknown() { var xxx_messageInfo_DeleteResponse proto.InternalMessageInfo -// HeadRequest.FullHeader == true, for fetch all headers type HeadRequest struct { Epoch uint64 `protobuf:"varint,1,opt,name=Epoch,proto3" json:"Epoch,omitempty"` Address Address `protobuf:"bytes,2,opt,name=Address,proto3,customtype=Address" json:"Address"` @@ -991,19 +992,36 @@ const _ = grpc.SupportPackageIsVersion4 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type ServiceClient interface { - // Get the object from a container + // Get the object from container. Response uses gRPC stream. First response + // message carry object of requested address. Chunk messages are parts of + // the object's payload if it is needed. All messages except first carry + // chunks. Requested object can be restored by concatenation of object + // message payload and all chunks keeping receiving order. Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (Service_GetClient, error) - // Put the object into a container + // Put the object into container. Request uses gRPC stream. First message + // SHOULD BE type of PutHeader. Container id and Owner id of object SHOULD + // BE set. Session token SHOULD BE obtained before put operation (see + // session package). Chunk messages considered by server as part of object + // payload. All messages except first SHOULD BE chunks. Chunk messages + // SHOULD BE sent in direct order of fragmentation. Put(ctx context.Context, opts ...grpc.CallOption) (Service_PutClient, error) // Delete the object from a container Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteResponse, error) - // Get MetaInfo + // Head returns the object without data payload. Object in the + // response has system header only. If full headers flag is set, extended + // headers are also present. Head(ctx context.Context, in *HeadRequest, opts ...grpc.CallOption) (*HeadResponse, error) - // Search by MetaInfo + // Search objects in container. Version of query language format SHOULD BE + // set to 1. Search query represented in serialized format (see query + // package). Search(ctx context.Context, in *SearchRequest, opts ...grpc.CallOption) (*SearchResponse, error) - // Get ranges of object payload + // GetRange of data payload. Ranges are set of pairs (offset, length). + // Fragments order in response corresponds to ranges order in request. GetRange(ctx context.Context, in *GetRangeRequest, opts ...grpc.CallOption) (*GetRangeResponse, error) - // Get hashes of object ranges + // GetRangeHash returns homomorphic hash of object payload range after XOR + // operation. Ranges are set of pairs (offset, length). Hashes order in + // response corresponds to ranges order in request. Homomorphic hash is + // calculated for XORed data. GetRangeHash(ctx context.Context, in *GetRangeHashRequest, opts ...grpc.CallOption) (*GetRangeHashResponse, error) } @@ -1128,19 +1146,36 @@ func (c *serviceClient) GetRangeHash(ctx context.Context, in *GetRangeHashReques // ServiceServer is the server API for Service service. type ServiceServer interface { - // Get the object from a container + // Get the object from container. Response uses gRPC stream. First response + // message carry object of requested address. Chunk messages are parts of + // the object's payload if it is needed. All messages except first carry + // chunks. Requested object can be restored by concatenation of object + // message payload and all chunks keeping receiving order. Get(*GetRequest, Service_GetServer) error - // Put the object into a container + // Put the object into container. Request uses gRPC stream. First message + // SHOULD BE type of PutHeader. Container id and Owner id of object SHOULD + // BE set. Session token SHOULD BE obtained before put operation (see + // session package). Chunk messages considered by server as part of object + // payload. All messages except first SHOULD BE chunks. Chunk messages + // SHOULD BE sent in direct order of fragmentation. Put(Service_PutServer) error // Delete the object from a container Delete(context.Context, *DeleteRequest) (*DeleteResponse, error) - // Get MetaInfo + // Head returns the object without data payload. Object in the + // response has system header only. If full headers flag is set, extended + // headers are also present. Head(context.Context, *HeadRequest) (*HeadResponse, error) - // Search by MetaInfo + // Search objects in container. Version of query language format SHOULD BE + // set to 1. Search query represented in serialized format (see query + // package). Search(context.Context, *SearchRequest) (*SearchResponse, error) - // Get ranges of object payload + // GetRange of data payload. Ranges are set of pairs (offset, length). + // Fragments order in response corresponds to ranges order in request. GetRange(context.Context, *GetRangeRequest) (*GetRangeResponse, error) - // Get hashes of object ranges + // GetRangeHash returns homomorphic hash of object payload range after XOR + // operation. Ranges are set of pairs (offset, length). Hashes order in + // response corresponds to ranges order in request. Homomorphic hash is + // calculated for XORed data. GetRangeHash(context.Context, *GetRangeHashRequest) (*GetRangeHashResponse, error) } diff --git a/query/types.pb.go b/query/types.pb.go index 51f682e..8fa3dbe 100644 --- a/query/types.pb.go +++ b/query/types.pb.go @@ -23,6 +23,7 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +// Type can be Exact or Regex type Filter_Type int32 const ( @@ -49,12 +50,15 @@ func (Filter_Type) EnumDescriptor() ([]byte, []int) { } type Filter struct { - Type Filter_Type `protobuf:"varint,1,opt,name=type,proto3,enum=query.Filter_Type" json:"type,omitempty"` - Name string `protobuf:"bytes,2,opt,name=Name,proto3" json:"Name,omitempty"` - Value string `protobuf:"bytes,3,opt,name=Value,proto3" json:"Value,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + // Type of filter + Type Filter_Type `protobuf:"varint,1,opt,name=type,proto3,enum=query.Filter_Type" json:"type,omitempty"` + // Name of field that should be filtered + Name string `protobuf:"bytes,2,opt,name=Name,proto3" json:"Name,omitempty"` + // Value that should be used for filter + Value string `protobuf:"bytes,3,opt,name=Value,proto3" json:"Value,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *Filter) Reset() { *m = Filter{} } @@ -107,6 +111,7 @@ func (m *Filter) GetValue() string { } type Query struct { + // Filters is set of filters, should not be empty Filters []Filter `protobuf:"bytes,1,rep,name=Filters,proto3" json:"Filters"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` diff --git a/refs/types.pb.go b/refs/types.pb.go index 33f7578..87f3fce 100644 --- a/refs/types.pb.go +++ b/refs/types.pb.go @@ -23,8 +23,11 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +// Address of object (container id + object id) type Address struct { - ObjectID ObjectID `protobuf:"bytes,1,opt,name=ObjectID,proto3,customtype=ObjectID" json:"ObjectID"` + // ObjectID is an object identifier + ObjectID ObjectID `protobuf:"bytes,1,opt,name=ObjectID,proto3,customtype=ObjectID" json:"ObjectID"` + // CID is container identifier CID CID `protobuf:"bytes,2,opt,name=CID,proto3,customtype=CID" json:"CID"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` diff --git a/session/service.pb.go b/session/service.pb.go index da85708..4961b0d 100644 --- a/session/service.pb.go +++ b/session/service.pb.go @@ -28,6 +28,8 @@ var _ = math.Inf const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package type CreateRequest struct { + // Message should be one of + // // Types that are valid to be assigned to Message: // *CreateRequest_Init // *CreateRequest_Signed diff --git a/session/types.pb.go b/session/types.pb.go index ce0e0a4..d39961e 100644 --- a/session/types.pb.go +++ b/session/types.pb.go @@ -24,7 +24,9 @@ var _ = math.Inf const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package type VerificationHeader struct { - PublicKey []byte `protobuf:"bytes,1,opt,name=PublicKey,proto3" json:"PublicKey,omitempty"` + // Session public key + PublicKey []byte `protobuf:"bytes,1,opt,name=PublicKey,proto3" json:"PublicKey,omitempty"` + // Session public key signature. Signed by trusted side KeySignature []byte `protobuf:"bytes,2,opt,name=KeySignature,proto3" json:"KeySignature,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -74,17 +76,25 @@ func (m *VerificationHeader) GetKeySignature() []byte { return nil } +// User token granting rights for object manipulation type Token struct { - Header VerificationHeader `protobuf:"bytes,1,opt,name=Header,proto3" json:"Header"` - OwnerID OwnerID `protobuf:"bytes,2,opt,name=OwnerID,proto3,customtype=OwnerID" json:"OwnerID"` - FirstEpoch uint64 `protobuf:"varint,3,opt,name=FirstEpoch,proto3" json:"FirstEpoch,omitempty"` - LastEpoch uint64 `protobuf:"varint,4,opt,name=LastEpoch,proto3" json:"LastEpoch,omitempty"` - ObjectID []ObjectID `protobuf:"bytes,5,rep,name=ObjectID,proto3,customtype=ObjectID" json:"ObjectID"` - Signature []byte `protobuf:"bytes,6,opt,name=Signature,proto3" json:"Signature,omitempty"` - ID TokenID `protobuf:"bytes,7,opt,name=ID,proto3,customtype=TokenID" json:"ID"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + // Header carries verification data of session key + Header VerificationHeader `protobuf:"bytes,1,opt,name=Header,proto3" json:"Header"` + // Owner of manipulation object + OwnerID OwnerID `protobuf:"bytes,2,opt,name=OwnerID,proto3,customtype=OwnerID" json:"OwnerID"` + // Initial epoch of token lifetime + FirstEpoch uint64 `protobuf:"varint,3,opt,name=FirstEpoch,proto3" json:"FirstEpoch,omitempty"` + // Last epoch of token lifetime + LastEpoch uint64 `protobuf:"varint,4,opt,name=LastEpoch,proto3" json:"LastEpoch,omitempty"` + // ID of manipulation object + ObjectID []ObjectID `protobuf:"bytes,5,rep,name=ObjectID,proto3,customtype=ObjectID" json:"ObjectID"` + // Token signature. Signed by owner of manipulation object + Signature []byte `protobuf:"bytes,6,opt,name=Signature,proto3" json:"Signature,omitempty"` + // Token ID (UUID) + ID TokenID `protobuf:"bytes,7,opt,name=ID,proto3,customtype=TokenID" json:"ID"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *Token) Reset() { *m = Token{} } diff --git a/state/service.pb.go b/state/service.pb.go index f71dad6..a368410 100644 --- a/state/service.pb.go +++ b/state/service.pb.go @@ -184,7 +184,9 @@ var xxx_messageInfo_HealthRequest proto.InternalMessageInfo // HealthResponse message with current state type HealthResponse struct { - Healthy bool `protobuf:"varint,1,opt,name=Healthy,proto3" json:"Healthy,omitempty"` + // Healthy is true when node alive and healthy + Healthy bool `protobuf:"varint,1,opt,name=Healthy,proto3" json:"Healthy,omitempty"` + // Status contains detailed information about health status Status string `protobuf:"bytes,2,opt,name=Status,proto3" json:"Status,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -280,8 +282,12 @@ const _ = grpc.SupportPackageIsVersion4 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type StatusClient interface { + // Netmap request allows to receive current [bootstrap.SpreadMap](bootstrap.md#bootstrap.SpreadMap) Netmap(ctx context.Context, in *NetmapRequest, opts ...grpc.CallOption) (*bootstrap.SpreadMap, error) + // Metrics request allows to receive metrics in prometheus format Metrics(ctx context.Context, in *MetricsRequest, opts ...grpc.CallOption) (*MetricsResponse, error) + // HealthCheck request allows to check health status of the node. + // If node unhealthy field Status would contains detailed info. HealthCheck(ctx context.Context, in *HealthRequest, opts ...grpc.CallOption) (*HealthResponse, error) } @@ -322,8 +328,12 @@ func (c *statusClient) HealthCheck(ctx context.Context, in *HealthRequest, opts // StatusServer is the server API for Status service. type StatusServer interface { + // Netmap request allows to receive current [bootstrap.SpreadMap](bootstrap.md#bootstrap.SpreadMap) Netmap(context.Context, *NetmapRequest) (*bootstrap.SpreadMap, error) + // Metrics request allows to receive metrics in prometheus format Metrics(context.Context, *MetricsRequest) (*MetricsResponse, error) + // HealthCheck request allows to check health status of the node. + // If node unhealthy field Status would contains detailed info. HealthCheck(context.Context, *HealthRequest) (*HealthResponse, error) } From c7a5c19ef5359005b8ac1e1138f42e70ef9a51ab Mon Sep 17 00:00:00 2001 From: alexvanin Date: Wed, 20 Nov 2019 21:42:03 +0300 Subject: [PATCH 0014/1196] docs: generate documentation for proto files --- README.md | 29 +++ docs/accounting.md | 488 ++++++++++++++++++++++++++++++++++++++ docs/bootstrap.md | 132 +++++++++++ docs/container.md | 232 +++++++++++++++++++ docs/decimal.md | 61 +++++ docs/object.md | 566 +++++++++++++++++++++++++++++++++++++++++++++ docs/query.md | 86 +++++++ docs/refs.md | 61 +++++ docs/session.md | 149 ++++++++++++ docs/state.md | 137 +++++++++++ 10 files changed, 1941 insertions(+) create mode 100644 docs/accounting.md create mode 100644 docs/bootstrap.md create mode 100644 docs/container.md create mode 100644 docs/decimal.md create mode 100644 docs/object.md create mode 100644 docs/query.md create mode 100644 docs/refs.md create mode 100644 docs/session.md create mode 100644 docs/state.md diff --git a/README.md b/README.md index 9247a10..a6662c3 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,8 @@ Repository contains 13 packages that implement NeoFS core structures. These packages mostly contain protobuf files with service and structure definitions or NeoFS core types with complemented functions. +There is a auto-generated documentation for protobuf files in [docs](docs). + ### Accounting Accounting package defines services and structures for accounting operations: @@ -17,11 +19,22 @@ with inner ring signatures, which approve that user can withdraw requested amount of assets. NeoFS smart contract takes binary formatted `cheque` as a parameter in withdraw call. +#### API +Accounting package defines: +- [Accounting service](docs/accounting.md#accounting.Accounting) +- [Withdraw service](docs/accounting.md#accounting.Withdraw) + + ### Bootstrap Bootstrap package defines bootstrap service which is used by storage nodes to connect to the storage network. +#### API +Bootstrap package defines: +- [Bootstrap service](docs/bootstrap.md#bootstrap.Bootstrap) + + ### Chain Chain package contains util functions for operations with NEO Blockchain types: @@ -33,6 +46,10 @@ Container package defines service and structures for operations with containers. Objects in NeoFS are stored in containers. Container defines storage policy for the objects. +#### API +Bootstrap package defines: +- [Container service](docs/container.md#container.Service) + ### Decimal Decimal defines custom decimal implementation which is used in accounting @@ -53,6 +70,10 @@ Object package defines service and structures for object operations. Object is a core storage structure in NeoFS. Package contains detailed information about object internal structure. +#### API +Object package defines: +- [Object service](docs/object.md#object.Service) + ### Query Query package defines structure for object search requests. @@ -72,10 +93,18 @@ Session package defines service and structures for session obtain. Object operations require an established session with pair of session keys signed by owner of the object. +#### API +Session package defines: +- [Session service](docs/session.md#session.Session) + ### State State package defines service and structures for metrics gathering. +#### API +State package defines: +- [Status service](docs/state.md#state.Status) + ## How to use NeoFS-proto packages contain godoc documentation. Examples of using most of diff --git a/docs/accounting.md b/docs/accounting.md new file mode 100644 index 0000000..f08bd52 --- /dev/null +++ b/docs/accounting.md @@ -0,0 +1,488 @@ +# Protocol Documentation + + +## Table of Contents + +- [accounting/service.proto](#accounting/service.proto) + - Services + - [Accounting](#accounting.Accounting) + + - Messages + - [BalanceRequest](#accounting.BalanceRequest) + - [BalanceResponse](#accounting.BalanceResponse) + + +- [accounting/types.proto](#accounting/types.proto) + + - Messages + - [Account](#accounting.Account) + - [Balances](#accounting.Balances) + - [ContainerCreateTarget](#accounting.ContainerCreateTarget) + - [Lifetime](#accounting.Lifetime) + - [LockTarget](#accounting.LockTarget) + - [PayIO](#accounting.PayIO) + - [Settlement](#accounting.Settlement) + - [Settlement.Container](#accounting.Settlement.Container) + - [Settlement.Receiver](#accounting.Settlement.Receiver) + - [Settlement.Tx](#accounting.Settlement.Tx) + - [Tx](#accounting.Tx) + - [WithdrawTarget](#accounting.WithdrawTarget) + + +- [accounting/withdraw.proto](#accounting/withdraw.proto) + - Services + - [Withdraw](#accounting.Withdraw) + + - Messages + - [DeleteRequest](#accounting.DeleteRequest) + - [DeleteResponse](#accounting.DeleteResponse) + - [GetRequest](#accounting.GetRequest) + - [GetResponse](#accounting.GetResponse) + - [Item](#accounting.Item) + - [ListRequest](#accounting.ListRequest) + - [ListResponse](#accounting.ListResponse) + - [PutRequest](#accounting.PutRequest) + - [PutResponse](#accounting.PutResponse) + + +- [Scalar Value Types](#scalar-value-types) + + + + +

Top

+ +## accounting/service.proto + + + + + + +### Service "accounting.Accounting" +Accounting is a service that provides access for accounting balance +information + +``` +rpc Balance(BalanceRequest) returns (BalanceResponse); + +``` + +#### Method Balance + +Balance returns current balance status of the NeoFS user + +| Name | Input | Output | +| ---- | ----- | ------ | +| Balance | [BalanceRequest](#accounting.BalanceRequest) | [BalanceResponse](#accounting.BalanceResponse) | + + + + + +### Message BalanceRequest + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| OwnerID | [bytes](#bytes) | | OwnerID is a wallet address | +| TTL | [uint32](#uint32) | | TTL must be larger than zero, it decreased in every neofs-node | + + + + +### Message BalanceResponse + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| Balance | [decimal.Decimal](#decimal.Decimal) | | Balance contains current account balance state | +| LockAccounts | [Account](#accounting.Account) | repeated | LockAccounts contains information about locked funds. Locked funds appear when user pays for storage or withdraw assets. | + + + + + + + + +

Top

+ +## accounting/types.proto + + + + + + + +### Message Account + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| OwnerID | [bytes](#bytes) | | OwnerID is a wallet address | +| Address | [string](#string) | | Address is identifier of accounting record | +| ParentAddress | [string](#string) | | ParentAddress is identifier of parent accounting record | +| ActiveFunds | [decimal.Decimal](#decimal.Decimal) | | ActiveFunds is amount of active (non locked) funds for account | +| Lifetime | [Lifetime](#accounting.Lifetime) | | Lifetime is time until account is valid (used for lock accounts) | +| LockTarget | [LockTarget](#accounting.LockTarget) | | LockTarget is the purpose of lock funds (it might be withdraw or payment for storage) | +| LockAccounts | [Account](#accounting.Account) | repeated | LockAccounts contains child accounts with locked funds | + + + + +### Message Balances + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| Accounts | [Account](#accounting.Account) | repeated | Accounts contains multiple account snapshots | + + + + +### Message ContainerCreateTarget + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| CID | [bytes](#bytes) | | CID is container identifier | + + + + +### Message Lifetime + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| unit | [Lifetime.Unit](#accounting.Lifetime.Unit) | | Unit describes how lifetime is measured in account | +| Value | [int64](#int64) | | Value describes how long lifetime will be valid | + + + + +### Message LockTarget +LockTarget must be one of two options + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| WithdrawTarget | [WithdrawTarget](#accounting.WithdrawTarget) | | WithdrawTarget used when user requested withdraw | +| ContainerCreateTarget | [ContainerCreateTarget](#accounting.ContainerCreateTarget) | | ContainerCreateTarget used when user requested creation of container | + + + + +### Message PayIO + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| BlockID | [uint64](#uint64) | | BlockID contains id of the NEO block where withdraw or deposit call was invoked | +| Transactions | [Tx](#accounting.Tx) | repeated | Transactions contains all transactions that founded in block and used for PayIO | + + + + +### Message Settlement + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| Epoch | [uint64](#uint64) | | Epoch contains an epoch when settlement was accepted | +| Transactions | [Settlement.Tx](#accounting.Settlement.Tx) | repeated | Transactions is a set of transactions | + + + + +### Message Settlement.Container + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| CID | [bytes](#bytes) | | CID is container identifier | +| SGIDs | [bytes](#bytes) | repeated | SGIDs is a set of storage groups that successfully passed the audit | + + + + +### Message Settlement.Receiver + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| To | [string](#string) | | To is the address of funds recipient | +| Amount | [decimal.Decimal](#decimal.Decimal) | | Amount is the amount of funds that will be sent | + + + + +### Message Settlement.Tx + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| From | [string](#string) | | From is the address of the sender of funds | +| Container | [Settlement.Container](#accounting.Settlement.Container) | | Container that successfully had passed the audit | +| Receivers | [Settlement.Receiver](#accounting.Settlement.Receiver) | repeated | Receivers is a set of addresses of funds recipients | + + + + +### Message Tx + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| type | [Tx.Type](#accounting.Tx.Type) | | Type describes target of transaction | +| From | [string](#string) | | From describes sender of funds | +| To | [string](#string) | | To describes receiver of funds | +| Amount | [decimal.Decimal](#decimal.Decimal) | | Amount describes amount of funds | +| PublicKeys | [bytes](#bytes) | | PublicKeys contains public key of sender | + + + + +### Message WithdrawTarget + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| Cheque | [string](#string) | | Cheque is a string representation of cheque id | + + + + + + +### Lifetime.Unit +Unit can be Unlimited, based on NeoFS epoch or Neo block + +| Name | Number | Description | +| ---- | ------ | ----------- | +| Unlimited | 0 | | +| NeoFSEpoch | 1 | | +| NeoBlock | 2 | | + + + + + +### Tx.Type +Type can be withdrawal, payIO or inner + +| Name | Number | Description | +| ---- | ------ | ----------- | +| Unknown | 0 | | +| Withdraw | 1 | | +| PayIO | 2 | | +| Inner | 3 | | + + + + + + + +

Top

+ +## accounting/withdraw.proto + + + + + + +### Service "accounting.Withdraw" +Withdraw is a service that provides withdraw assets operations from the NeoFS + +``` +rpc Get(GetRequest) returns (GetResponse); +rpc Put(PutRequest) returns (PutResponse); +rpc List(ListRequest) returns (ListResponse); +rpc Delete(DeleteRequest) returns (DeleteResponse); + +``` + +#### Method Get + +Get returns cheque if it was signed by inner ring nodes + +| Name | Input | Output | +| ---- | ----- | ------ | +| Get | [GetRequest](#accounting.GetRequest) | [GetResponse](#accounting.GetResponse) | +#### Method Put + +Put ask inner ring nodes to sign a cheque for withdraw invoke + +| Name | Input | Output | +| ---- | ----- | ------ | +| Put | [PutRequest](#accounting.PutRequest) | [PutResponse](#accounting.PutResponse) | +#### Method List + +List shows all user's checks + +| Name | Input | Output | +| ---- | ----- | ------ | +| List | [ListRequest](#accounting.ListRequest) | [ListResponse](#accounting.ListResponse) | +#### Method Delete + +Delete allows user to remove unused cheque + +| Name | Input | Output | +| ---- | ----- | ------ | +| Delete | [DeleteRequest](#accounting.DeleteRequest) | [DeleteResponse](#accounting.DeleteResponse) | + + + + + +### Message DeleteRequest + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| ID | [bytes](#bytes) | | ID is cheque identifier | +| OwnerID | [bytes](#bytes) | | OwnerID is a wallet address | +| MessageID | [bytes](#bytes) | | MessageID is a nonce for uniq request (UUIDv4) | +| Signature | [bytes](#bytes) | | Signature is a signature of the sent request | +| TTL | [uint32](#uint32) | | TTL must be larger than zero, it decreased in every neofs-node | + + + + +### Message DeleteResponse +DeleteResponse is empty + + + + + +### Message GetRequest + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| ID | [bytes](#bytes) | | ID is cheque identifier | +| OwnerID | [bytes](#bytes) | | OwnerID is a wallet address | +| TTL | [uint32](#uint32) | | TTL must be larger than zero, it decreased in every neofs-node | + + + + +### Message GetResponse + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| Withdraw | [Item](#accounting.Item) | | Item is cheque with meta information | + + + + +### Message Item + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| ID | [bytes](#bytes) | | ID is a cheque identifier | +| OwnerID | [bytes](#bytes) | | OwnerID is a wallet address | +| Amount | [decimal.Decimal](#decimal.Decimal) | | Amount of funds | +| Height | [uint64](#uint64) | | Height is the neo blockchain height until the cheque is valid | +| Payload | [bytes](#bytes) | | Payload contains cheque representation in bytes | + + + + +### Message ListRequest + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| OwnerID | [bytes](#bytes) | | OwnerID is a wallet address | +| TTL | [uint32](#uint32) | | TTL must be larger than zero, it decreased in every neofs-node | + + + + +### Message ListResponse + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| Items | [Item](#accounting.Item) | repeated | Item is a set of cheques with meta information | + + + + +### Message PutRequest + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| OwnerID | [bytes](#bytes) | | OwnerID is a wallet address | +| Amount | [decimal.Decimal](#decimal.Decimal) | | Amount of funds | +| Height | [uint64](#uint64) | | Height is the neo blockchain height until the cheque is valid | +| MessageID | [bytes](#bytes) | | MessageID is a nonce for uniq request (UUIDv4) | +| Signature | [bytes](#bytes) | | Signature is a signature of the sent request | +| TTL | [uint32](#uint32) | | TTL must be larger than zero, it decreased in every neofs-node | + + + + +### Message PutResponse + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| ID | [bytes](#bytes) | | ID is cheque identifier | + + + + + + + +## Scalar Value Types + +| .proto Type | Notes | C++ Type | Java Type | Python Type | +| ----------- | ----- | -------- | --------- | ----------- | +| double | | double | double | float | +| float | | float | float | float | +| int32 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint32 instead. | int32 | int | int | +| int64 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint64 instead. | int64 | long | int/long | +| uint32 | Uses variable-length encoding. | uint32 | int | int/long | +| uint64 | Uses variable-length encoding. | uint64 | long | int/long | +| sint32 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s. | int32 | int | int | +| sint64 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s. | int64 | long | int/long | +| fixed32 | Always four bytes. More efficient than uint32 if values are often greater than 2^28. | uint32 | int | int | +| fixed64 | Always eight bytes. More efficient than uint64 if values are often greater than 2^56. | uint64 | long | int/long | +| sfixed32 | Always four bytes. | int32 | int | int | +| sfixed64 | Always eight bytes. | int64 | long | int/long | +| bool | | bool | boolean | boolean | +| string | A string must always contain UTF-8 encoded or 7-bit ASCII text. | string | String | str/unicode | +| bytes | May contain any arbitrary sequence of bytes. | string | ByteString | str | + diff --git a/docs/bootstrap.md b/docs/bootstrap.md new file mode 100644 index 0000000..dfada2c --- /dev/null +++ b/docs/bootstrap.md @@ -0,0 +1,132 @@ +# Protocol Documentation + + +## Table of Contents + +- [bootstrap/service.proto](#bootstrap/service.proto) + - Services + - [Bootstrap](#bootstrap.Bootstrap) + + - Messages + - [Request](#bootstrap.Request) + + +- [bootstrap/types.proto](#bootstrap/types.proto) + + - Messages + - [NodeInfo](#bootstrap.NodeInfo) + - [SpreadMap](#bootstrap.SpreadMap) + + +- [Scalar Value Types](#scalar-value-types) + + + + +

Top

+ +## bootstrap/service.proto + + + + + + +### Service "bootstrap.Bootstrap" +Bootstrap service allows neofs-node to connect to the network. Node should +perform at least one bootstrap request in the epoch to stay in the network +for the next epoch. + +``` +rpc Process(Request) returns (SpreadMap); + +``` + +#### Method Process + +Process is method that allows to register node in the network and receive actual netmap + +| Name | Input | Output | +| ---- | ----- | ------ | +| Process | [Request](#bootstrap.Request) | [SpreadMap](#bootstrap.SpreadMap) | + + + + + +### Message Request + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| type | [int32](#int32) | | Type is NodeType, can be InnerRingNode (type=1) or StorageNode (type=2) | +| info | [NodeInfo](#bootstrap.NodeInfo) | | Info contains information about node | +| TTL | [uint32](#uint32) | | TTL must be larger than zero, it decreased in every neofs-node | + + + + + + + + +

Top

+ +## bootstrap/types.proto + + + + + + + +### Message NodeInfo + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| Address | [string](#string) | | Address is a node [multi-address](https://github.com/multiformats/multiaddr) | +| PubKey | [bytes](#bytes) | | PubKey is a compressed public key representation in bytes | +| Options | [string](#string) | repeated | Options is set of node optional information, such as storage capacity, node location, price and etc | +| Status | [uint64](#uint64) | | Status is bitmap status of the node | + + + + +### Message SpreadMap + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| Epoch | [uint64](#uint64) | | Epoch is current epoch for netmap | +| NetMap | [NodeInfo](#bootstrap.NodeInfo) | repeated | NetMap is a set of NodeInfos | + + + + + + + +## Scalar Value Types + +| .proto Type | Notes | C++ Type | Java Type | Python Type | +| ----------- | ----- | -------- | --------- | ----------- | +| double | | double | double | float | +| float | | float | float | float | +| int32 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint32 instead. | int32 | int | int | +| int64 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint64 instead. | int64 | long | int/long | +| uint32 | Uses variable-length encoding. | uint32 | int | int/long | +| uint64 | Uses variable-length encoding. | uint64 | long | int/long | +| sint32 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s. | int32 | int | int | +| sint64 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s. | int64 | long | int/long | +| fixed32 | Always four bytes. More efficient than uint32 if values are often greater than 2^28. | uint32 | int | int | +| fixed64 | Always eight bytes. More efficient than uint64 if values are often greater than 2^56. | uint64 | long | int/long | +| sfixed32 | Always four bytes. | int32 | int | int | +| sfixed64 | Always eight bytes. | int64 | long | int/long | +| bool | | bool | boolean | boolean | +| string | A string must always contain UTF-8 encoded or 7-bit ASCII text. | string | String | str/unicode | +| bytes | May contain any arbitrary sequence of bytes. | string | ByteString | str | + diff --git a/docs/container.md b/docs/container.md new file mode 100644 index 0000000..5ff0d89 --- /dev/null +++ b/docs/container.md @@ -0,0 +1,232 @@ +# Protocol Documentation + + +## Table of Contents + +- [container/service.proto](#container/service.proto) + - Services + - [Service](#container.Service) + + - Messages + - [DeleteRequest](#container.DeleteRequest) + - [DeleteResponse](#container.DeleteResponse) + - [GetRequest](#container.GetRequest) + - [GetResponse](#container.GetResponse) + - [ListRequest](#container.ListRequest) + - [ListResponse](#container.ListResponse) + - [PutRequest](#container.PutRequest) + - [PutResponse](#container.PutResponse) + + +- [container/types.proto](#container/types.proto) + + - Messages + - [Container](#container.Container) + + +- [Scalar Value Types](#scalar-value-types) + + + + +

Top

+ +## container/service.proto + + + + + + +### Service "container.Service" +Container service provides API for manipulating with the container. + +``` +rpc Put(PutRequest) returns (PutResponse); +rpc Delete(DeleteRequest) returns (DeleteResponse); +rpc Get(GetRequest) returns (GetResponse); +rpc List(ListRequest) returns (ListResponse); + +``` + +#### Method Put + +Put request proposes container to the inner ring nodes. They will +accept new container if user has enough deposit. All containers +are accepted by the consensus, therefore it is asynchronous process. + +| Name | Input | Output | +| ---- | ----- | ------ | +| Put | [PutRequest](#container.PutRequest) | [PutResponse](#container.PutResponse) | +#### Method Delete + +Delete container removes it from the inner ring container storage. It +also asynchronous process done by consensus. + +| Name | Input | Output | +| ---- | ----- | ------ | +| Delete | [DeleteRequest](#container.DeleteRequest) | [DeleteResponse](#container.DeleteResponse) | +#### Method Get + +Get container returns container instance + +| Name | Input | Output | +| ---- | ----- | ------ | +| Get | [GetRequest](#container.GetRequest) | [GetResponse](#container.GetResponse) | +#### Method List + +List returns all user's containers + +| Name | Input | Output | +| ---- | ----- | ------ | +| List | [ListRequest](#container.ListRequest) | [ListResponse](#container.ListResponse) | + + + + + +### Message DeleteRequest + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| CID | [bytes](#bytes) | | CID (container id) is a SHA256 hash of the container structure | +| TTL | [uint32](#uint32) | | TTL must be larger than zero, it decreased in every neofs-node | +| Signature | [bytes](#bytes) | | Signature of the container owner | + + + + +### Message DeleteResponse +DeleteResponse is empty because delete operation is asynchronous and done +via consensus in inner ring nodes + + + + + +### Message GetRequest + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| CID | [bytes](#bytes) | | CID (container id) is a SHA256 hash of the container structure | +| TTL | [uint32](#uint32) | | TTL must be larger than zero, it decreased in every neofs-node | + + + + +### Message GetResponse + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| Container | [Container](#container.Container) | | Container is a structure that contains placement rules and owner id | + + + + +### Message ListRequest + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| OwnerID | [bytes](#bytes) | | OwnerID is a wallet address | +| TTL | [uint32](#uint32) | | TTL must be larger than zero, it decreased in every neofs-node | + + + + +### Message ListResponse + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| CID | [bytes](#bytes) | repeated | CID (container id) is list of SHA256 hashes of the container structures | + + + + +### Message PutRequest + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| MessageID | [bytes](#bytes) | | MessageID is a nonce for uniq container id calculation | +| Capacity | [uint64](#uint64) | | Capacity defines amount of data that can be stored in the container (doesn't used for now). | +| OwnerID | [bytes](#bytes) | | OwnerID is a wallet address | +| rules | [netmap.PlacementRule](#netmap.PlacementRule) | | Rules define storage policy for the object inside the container. | +| Signature | [bytes](#bytes) | | Signature of the user (owner id) | +| TTL | [uint32](#uint32) | | TTL must be larger than zero, it decreased in every neofs-node | + + + + +### Message PutResponse + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| CID | [bytes](#bytes) | | CID (container id) is a SHA256 hash of the container structure | + + + + + + + + +

Top

+ +## container/types.proto + + + + + + + +### Message Container +The Container service definition. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| OwnerID | [bytes](#bytes) | | OwnerID is a wallet address. | +| Salt | [bytes](#bytes) | | Salt is a nonce for unique container id calculation. | +| Capacity | [uint64](#uint64) | | Capacity defines amount of data that can be stored in the container (doesn't used for now). | +| Rules | [netmap.PlacementRule](#netmap.PlacementRule) | | Rules define storage policy for the object inside the container. | + + + + + + + +## Scalar Value Types + +| .proto Type | Notes | C++ Type | Java Type | Python Type | +| ----------- | ----- | -------- | --------- | ----------- | +| double | | double | double | float | +| float | | float | float | float | +| int32 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint32 instead. | int32 | int | int | +| int64 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint64 instead. | int64 | long | int/long | +| uint32 | Uses variable-length encoding. | uint32 | int | int/long | +| uint64 | Uses variable-length encoding. | uint64 | long | int/long | +| sint32 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s. | int32 | int | int | +| sint64 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s. | int64 | long | int/long | +| fixed32 | Always four bytes. More efficient than uint32 if values are often greater than 2^28. | uint32 | int | int | +| fixed64 | Always eight bytes. More efficient than uint64 if values are often greater than 2^56. | uint64 | long | int/long | +| sfixed32 | Always four bytes. | int32 | int | int | +| sfixed64 | Always eight bytes. | int64 | long | int/long | +| bool | | bool | boolean | boolean | +| string | A string must always contain UTF-8 encoded or 7-bit ASCII text. | string | String | str/unicode | +| bytes | May contain any arbitrary sequence of bytes. | string | ByteString | str | + diff --git a/docs/decimal.md b/docs/decimal.md new file mode 100644 index 0000000..62acb86 --- /dev/null +++ b/docs/decimal.md @@ -0,0 +1,61 @@ +# Protocol Documentation + + +## Table of Contents + +- [decimal/decimal.proto](#decimal/decimal.proto) + + - Messages + - [Decimal](#decimal.Decimal) + + +- [Scalar Value Types](#scalar-value-types) + + + + +

Top

+ +## decimal/decimal.proto + + + + + + + +### Message Decimal +Decimal is a structure used for representation of assets amount + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| Value | [int64](#int64) | | Value is value number | +| Precision | [uint32](#uint32) | | Precision is precision number | + + + + + + + +## Scalar Value Types + +| .proto Type | Notes | C++ Type | Java Type | Python Type | +| ----------- | ----- | -------- | --------- | ----------- | +| double | | double | double | float | +| float | | float | float | float | +| int32 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint32 instead. | int32 | int | int | +| int64 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint64 instead. | int64 | long | int/long | +| uint32 | Uses variable-length encoding. | uint32 | int | int/long | +| uint64 | Uses variable-length encoding. | uint64 | long | int/long | +| sint32 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s. | int32 | int | int | +| sint64 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s. | int64 | long | int/long | +| fixed32 | Always four bytes. More efficient than uint32 if values are often greater than 2^28. | uint32 | int | int | +| fixed64 | Always eight bytes. More efficient than uint64 if values are often greater than 2^56. | uint64 | long | int/long | +| sfixed32 | Always four bytes. | int32 | int | int | +| sfixed64 | Always eight bytes. | int64 | long | int/long | +| bool | | bool | boolean | boolean | +| string | A string must always contain UTF-8 encoded or 7-bit ASCII text. | string | String | str/unicode | +| bytes | May contain any arbitrary sequence of bytes. | string | ByteString | str | + diff --git a/docs/object.md b/docs/object.md new file mode 100644 index 0000000..5ba1845 --- /dev/null +++ b/docs/object.md @@ -0,0 +1,566 @@ +# Protocol Documentation + + +## Table of Contents + +- [object/service.proto](#object/service.proto) + - Services + - [Service](#object.Service) + + - Messages + - [DeleteRequest](#object.DeleteRequest) + - [DeleteResponse](#object.DeleteResponse) + - [GetRangeHashRequest](#object.GetRangeHashRequest) + - [GetRangeHashResponse](#object.GetRangeHashResponse) + - [GetRangeRequest](#object.GetRangeRequest) + - [GetRangeResponse](#object.GetRangeResponse) + - [GetRequest](#object.GetRequest) + - [GetResponse](#object.GetResponse) + - [HeadRequest](#object.HeadRequest) + - [HeadResponse](#object.HeadResponse) + - [PutRequest](#object.PutRequest) + - [PutRequest.PutHeader](#object.PutRequest.PutHeader) + - [PutResponse](#object.PutResponse) + - [SearchRequest](#object.SearchRequest) + - [SearchResponse](#object.SearchResponse) + + +- [object/types.proto](#object/types.proto) + + - Messages + - [CreationPoint](#object.CreationPoint) + - [Header](#object.Header) + - [IntegrityHeader](#object.IntegrityHeader) + - [Link](#object.Link) + - [Object](#object.Object) + - [Range](#object.Range) + - [StorageGroup](#object.StorageGroup) + - [StorageGroup.Lifetime](#object.StorageGroup.Lifetime) + - [SystemHeader](#object.SystemHeader) + - [Tombstone](#object.Tombstone) + - [Transform](#object.Transform) + - [UserHeader](#object.UserHeader) + + +- [Scalar Value Types](#scalar-value-types) + + + + +

Top

+ +## object/service.proto + + + + + + +### Service "object.Service" +Object service provides API for manipulating with the object. + +``` +rpc Get(GetRequest) returns (stream GetResponse); +rpc Put(stream PutRequest) returns (PutResponse); +rpc Delete(DeleteRequest) returns (DeleteResponse); +rpc Head(HeadRequest) returns (HeadResponse); +rpc Search(SearchRequest) returns (SearchResponse); +rpc GetRange(GetRangeRequest) returns (GetRangeResponse); +rpc GetRangeHash(GetRangeHashRequest) returns (GetRangeHashResponse); + +``` + +#### Method Get + +Get the object from container. Response uses gRPC stream. First response +message carry object of requested address. Chunk messages are parts of +the object's payload if it is needed. All messages except first carry +chunks. Requested object can be restored by concatenation of object +message payload and all chunks keeping receiving order. + +| Name | Input | Output | +| ---- | ----- | ------ | +| Get | [GetRequest](#object.GetRequest) | [GetResponse](#object.GetResponse) | +#### Method Put + +Put the object into container. Request uses gRPC stream. First message +SHOULD BE type of PutHeader. Container id and Owner id of object SHOULD +BE set. Session token SHOULD BE obtained before put operation (see +session package). Chunk messages considered by server as part of object +payload. All messages except first SHOULD BE chunks. Chunk messages +SHOULD BE sent in direct order of fragmentation. + +| Name | Input | Output | +| ---- | ----- | ------ | +| Put | [PutRequest](#object.PutRequest) | [PutResponse](#object.PutResponse) | +#### Method Delete + +Delete the object from a container + +| Name | Input | Output | +| ---- | ----- | ------ | +| Delete | [DeleteRequest](#object.DeleteRequest) | [DeleteResponse](#object.DeleteResponse) | +#### Method Head + +Head returns the object without data payload. Object in the +response has system header only. If full headers flag is set, extended +headers are also present. + +| Name | Input | Output | +| ---- | ----- | ------ | +| Head | [HeadRequest](#object.HeadRequest) | [HeadResponse](#object.HeadResponse) | +#### Method Search + +Search objects in container. Version of query language format SHOULD BE +set to 1. Search query represented in serialized format (see query +package). + +| Name | Input | Output | +| ---- | ----- | ------ | +| Search | [SearchRequest](#object.SearchRequest) | [SearchResponse](#object.SearchResponse) | +#### Method GetRange + +GetRange of data payload. Ranges are set of pairs (offset, length). +Fragments order in response corresponds to ranges order in request. + +| Name | Input | Output | +| ---- | ----- | ------ | +| GetRange | [GetRangeRequest](#object.GetRangeRequest) | [GetRangeResponse](#object.GetRangeResponse) | +#### Method GetRangeHash + +GetRangeHash returns homomorphic hash of object payload range after XOR +operation. Ranges are set of pairs (offset, length). Hashes order in +response corresponds to ranges order in request. Homomorphic hash is +calculated for XORed data. + +| Name | Input | Output | +| ---- | ----- | ------ | +| GetRangeHash | [GetRangeHashRequest](#object.GetRangeHashRequest) | [GetRangeHashResponse](#object.GetRangeHashResponse) | + + + + + +### Message DeleteRequest + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| Epoch | [uint64](#uint64) | | Epoch is set by user to 0, node set epoch to the actual value | +| Address | [refs.Address](#refs.Address) | | Address of object (container id + object id) | +| OwnerID | [bytes](#bytes) | | OwnerID is a wallet address | +| TTL | [uint32](#uint32) | | TTL must be larger than zero, it decreased in every neofs-node | +| Token | [session.Token](#session.Token) | | Token with session public key and user's signature | + + + + +### Message DeleteResponse +DeleteResponse is empty because we cannot guarantee permanent object removal +in distributed system. + + + + + +### Message GetRangeHashRequest + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| Epoch | [uint64](#uint64) | | Epoch is set by user to 0, node set epoch to the actual value | +| Address | [refs.Address](#refs.Address) | | Address of object (container id + object id) | +| Ranges | [Range](#object.Range) | repeated | Ranges of object's payload to calculate homomorphic hash | +| Salt | [bytes](#bytes) | | Salt is used to XOR object's payload ranges before hashing, it can be nil | +| TTL | [uint32](#uint32) | | TTL must be larger than zero, it decreased in every neofs-node | + + + + +### Message GetRangeHashResponse + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| Hashes | [bytes](#bytes) | repeated | Homomorphic hashes of all ranges | + + + + +### Message GetRangeRequest + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| Epoch | [uint64](#uint64) | | Epoch is set by user to 0, node set epoch to the actual value | +| Address | [refs.Address](#refs.Address) | | Address of object (container id + object id) | +| Ranges | [Range](#object.Range) | repeated | Ranges of object's payload to return | +| TTL | [uint32](#uint32) | | TTL must be larger than zero, it decreased in every neofs-node | + + + + +### Message GetRangeResponse + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| Fragments | [bytes](#bytes) | repeated | Fragments of object's payload | + + + + +### Message GetRequest + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| Epoch | [uint64](#uint64) | | Epoch is set by user to 0, node set epoch to the actual value | +| Address | [refs.Address](#refs.Address) | | Address of object (container id + object id) | +| TTL | [uint32](#uint32) | | TTL must be larger than zero, it decreased in every neofs-node | + + + + +### Message GetResponse + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| object | [Object](#object.Object) | | Object header and some payload | +| Chunk | [bytes](#bytes) | | Chunk of remaining payload | + + + + +### Message HeadRequest + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| Epoch | [uint64](#uint64) | | Epoch is set by user to 0, node set epoch to the actual value | +| Address | [refs.Address](#refs.Address) | | Address of object (container id + object id) | +| FullHeaders | [bool](#bool) | | FullHeaders can be set true for extended headers in the object | +| TTL | [uint32](#uint32) | | TTL must be larger than zero, it decreased in every neofs-node | + + + + +### Message HeadResponse + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| Object | [Object](#object.Object) | | Object without payload | + + + + +### Message PutRequest + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| Header | [PutRequest.PutHeader](#object.PutRequest.PutHeader) | | Header should be the first message in the stream | +| Chunk | [bytes](#bytes) | | Chunk should be a remaining message in stream should be chunks | + + + + +### Message PutRequest.PutHeader + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| Epoch | [uint64](#uint64) | | Epoch is set by user to 0, node set epoch to the actual value | +| Object | [Object](#object.Object) | | Object with at least container id and owner id fields | +| TTL | [uint32](#uint32) | | TTL must be larger than zero, it decreased in every neofs-node | +| Token | [session.Token](#session.Token) | | Token with session public key and user's signature | + + + + +### Message PutResponse + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| Address | [refs.Address](#refs.Address) | | Address of object (container id + object id) | + + + + +### Message SearchRequest + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| Epoch | [uint64](#uint64) | | Epoch is set by user to 0, node set epoch to the actual value | +| Version | [uint32](#uint32) | | Version of search query format | +| ContainerID | [bytes](#bytes) | | ContainerID for searching the object | +| Query | [bytes](#bytes) | | Query in the binary serialized format | +| TTL | [uint32](#uint32) | | TTL must be larger than zero, it decreased in every neofs-node | + + + + +### Message SearchResponse + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| Addresses | [refs.Address](#refs.Address) | repeated | Addresses of found objects | + + + + + + + + +

Top

+ +## object/types.proto + + + + + + + +### Message CreationPoint + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| UnixTime | [int64](#int64) | | Date of creation in unixtime format | +| Epoch | [uint64](#uint64) | | Date of creation in NeoFS epochs | + + + + +### Message Header + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| Link | [Link](#object.Link) | | Link to other objects | +| Redirect | [refs.Address](#refs.Address) | | RedirectNot used yet | +| UserHeader | [UserHeader](#object.UserHeader) | | UserHeader defined by user | +| Transform | [Transform](#object.Transform) | | Transform defines transform operation (e.g. payload split) | +| Tombstone | [Tombstone](#object.Tombstone) | | Tombstone header that set up in deleted objects | +| Verify | [session.VerificationHeader](#session.VerificationHeader) | | Verify header that contains session public key and user's signature | +| HomoHash | [bytes](#bytes) | | Homomorphic hash of original object payload | +| PayloadChecksum | [bytes](#bytes) | | PayloadChecksum of actual object's payload | +| Integrity | [IntegrityHeader](#object.IntegrityHeader) | | Integrity header with checksum of all above headers in the object | +| StorageGroup | [StorageGroup](#object.StorageGroup) | | StorageGroup contains meta information for the data audit | + + + + +### Message IntegrityHeader + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| HeadersChecksum | [bytes](#bytes) | | Checksum of all above headers in the object | +| ChecksumSignature | [bytes](#bytes) | | User's signature of checksum to verify if it is correct | + + + + +### Message Link + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| type | [Link.Type](#object.Link.Type) | | Link type | +| ID | [bytes](#bytes) | | Object id | + + + + +### Message Object + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| SystemHeader | [SystemHeader](#object.SystemHeader) | | System header | +| Headers | [Header](#object.Header) | repeated | Extended headers | +| Payload | [bytes](#bytes) | | Object's payload | + + + + +### Message Range + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| Offset | [uint64](#uint64) | | Offset of the data range | +| Length | [uint64](#uint64) | | Length of the data range | + + + + +### Message StorageGroup + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| ValidationDataSize | [uint64](#uint64) | | Size of the all object's payloads included into storage group | +| ValidationHash | [bytes](#bytes) | | Homomorphic hash of all object's payloads included into storage group | +| lifetime | [StorageGroup.Lifetime](#object.StorageGroup.Lifetime) | | Time until storage group is valid | + + + + +### Message StorageGroup.Lifetime + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| unit | [StorageGroup.Lifetime.Unit](#object.StorageGroup.Lifetime.Unit) | | Lifetime type | +| Value | [int64](#int64) | | Lifetime value | + + + + +### Message SystemHeader + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| Version | [uint64](#uint64) | | Version of the object structure | +| PayloadLength | [uint64](#uint64) | | Object payload length | +| ID | [bytes](#bytes) | | ObjectID is a UUID | +| OwnerID | [bytes](#bytes) | | OwnerID is a wallet address | +| CID | [bytes](#bytes) | | ContainerID is a SHA256 hash of the container structure | +| CreatedAt | [CreationPoint](#object.CreationPoint) | | Timestamp of object creation | + + + + +### Message Tombstone + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| Epoch | [uint64](#uint64) | | Epoch when tombstone was created | + + + + +### Message Transform + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| type | [Transform.Type](#object.Transform.Type) | | Type of object transformation | + + + + +### Message UserHeader + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| Key | [string](#string) | | Key of the user's header | +| Value | [string](#string) | | Value of the user's header | + + + + + + +### Link.Type + + +| Name | Number | Description | +| ---- | ------ | ----------- | +| Unknown | 0 | | +| Parent | 1 | Parent object created during object transformation | +| Previous | 2 | Previous object in the linked list created during object transformation | +| Next | 3 | Next object in the linked list created during object transformation | +| Child | 4 | Child object created during object transformation | +| StorageGroup | 5 | Object that included into this storage group | + + + + + +### StorageGroup.Lifetime.Unit + + +| Name | Number | Description | +| ---- | ------ | ----------- | +| Unlimited | 0 | Storage group always valid | +| NeoFSEpoch | 1 | Storage group is valid until lifetime NeoFS epoch | +| UnixTime | 2 | Storage group is valid until lifetime unix timestamp | + + + + + +### Transform.Type + + +| Name | Number | Description | +| ---- | ------ | ----------- | +| Unknown | 0 | | +| Split | 1 | Object created after payload split | +| Sign | 2 | Object created after re-signing (doesn't used) | +| Mould | 3 | Object created after filling missing headers in the object | + + + + + + +## Scalar Value Types + +| .proto Type | Notes | C++ Type | Java Type | Python Type | +| ----------- | ----- | -------- | --------- | ----------- | +| double | | double | double | float | +| float | | float | float | float | +| int32 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint32 instead. | int32 | int | int | +| int64 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint64 instead. | int64 | long | int/long | +| uint32 | Uses variable-length encoding. | uint32 | int | int/long | +| uint64 | Uses variable-length encoding. | uint64 | long | int/long | +| sint32 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s. | int32 | int | int | +| sint64 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s. | int64 | long | int/long | +| fixed32 | Always four bytes. More efficient than uint32 if values are often greater than 2^28. | uint32 | int | int | +| fixed64 | Always eight bytes. More efficient than uint64 if values are often greater than 2^56. | uint64 | long | int/long | +| sfixed32 | Always four bytes. | int32 | int | int | +| sfixed64 | Always eight bytes. | int64 | long | int/long | +| bool | | bool | boolean | boolean | +| string | A string must always contain UTF-8 encoded or 7-bit ASCII text. | string | String | str/unicode | +| bytes | May contain any arbitrary sequence of bytes. | string | ByteString | str | + diff --git a/docs/query.md b/docs/query.md new file mode 100644 index 0000000..9deb2c1 --- /dev/null +++ b/docs/query.md @@ -0,0 +1,86 @@ +# Protocol Documentation + + +## Table of Contents + +- [query/types.proto](#query/types.proto) + + - Messages + - [Filter](#query.Filter) + - [Query](#query.Query) + + +- [Scalar Value Types](#scalar-value-types) + + + + +

Top

+ +## query/types.proto + + + + + + + +### Message Filter + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| type | [Filter.Type](#query.Filter.Type) | | Type of filter | +| Name | [string](#string) | | Name of field that should be filtered | +| Value | [string](#string) | | Value that should be used for filter | + + + + +### Message Query + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| Filters | [Filter](#query.Filter) | repeated | Filters is set of filters, should not be empty | + + + + + + +### Filter.Type +Type can be Exact or Regex + +| Name | Number | Description | +| ---- | ------ | ----------- | +| Exact | 0 | | +| Regex | 1 | | + + + + + + +## Scalar Value Types + +| .proto Type | Notes | C++ Type | Java Type | Python Type | +| ----------- | ----- | -------- | --------- | ----------- | +| double | | double | double | float | +| float | | float | float | float | +| int32 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint32 instead. | int32 | int | int | +| int64 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint64 instead. | int64 | long | int/long | +| uint32 | Uses variable-length encoding. | uint32 | int | int/long | +| uint64 | Uses variable-length encoding. | uint64 | long | int/long | +| sint32 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s. | int32 | int | int | +| sint64 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s. | int64 | long | int/long | +| fixed32 | Always four bytes. More efficient than uint32 if values are often greater than 2^28. | uint32 | int | int | +| fixed64 | Always eight bytes. More efficient than uint64 if values are often greater than 2^56. | uint64 | long | int/long | +| sfixed32 | Always four bytes. | int32 | int | int | +| sfixed64 | Always eight bytes. | int64 | long | int/long | +| bool | | bool | boolean | boolean | +| string | A string must always contain UTF-8 encoded or 7-bit ASCII text. | string | String | str/unicode | +| bytes | May contain any arbitrary sequence of bytes. | string | ByteString | str | + diff --git a/docs/refs.md b/docs/refs.md new file mode 100644 index 0000000..c3051ab --- /dev/null +++ b/docs/refs.md @@ -0,0 +1,61 @@ +# Protocol Documentation + + +## Table of Contents + +- [refs/types.proto](#refs/types.proto) + + - Messages + - [Address](#refs.Address) + + +- [Scalar Value Types](#scalar-value-types) + + + + +

Top

+ +## refs/types.proto + + + + + + + +### Message Address +Address of object (container id + object id) + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| ObjectID | [bytes](#bytes) | | ObjectID is an object identifier | +| CID | [bytes](#bytes) | | CID is container identifier | + + + + + + + +## Scalar Value Types + +| .proto Type | Notes | C++ Type | Java Type | Python Type | +| ----------- | ----- | -------- | --------- | ----------- | +| double | | double | double | float | +| float | | float | float | float | +| int32 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint32 instead. | int32 | int | int | +| int64 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint64 instead. | int64 | long | int/long | +| uint32 | Uses variable-length encoding. | uint32 | int | int/long | +| uint64 | Uses variable-length encoding. | uint64 | long | int/long | +| sint32 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s. | int32 | int | int | +| sint64 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s. | int64 | long | int/long | +| fixed32 | Always four bytes. More efficient than uint32 if values are often greater than 2^28. | uint32 | int | int | +| fixed64 | Always eight bytes. More efficient than uint64 if values are often greater than 2^56. | uint64 | long | int/long | +| sfixed32 | Always four bytes. | int32 | int | int | +| sfixed64 | Always eight bytes. | int64 | long | int/long | +| bool | | bool | boolean | boolean | +| string | A string must always contain UTF-8 encoded or 7-bit ASCII text. | string | String | str/unicode | +| bytes | May contain any arbitrary sequence of bytes. | string | ByteString | str | + diff --git a/docs/session.md b/docs/session.md new file mode 100644 index 0000000..8ea703e --- /dev/null +++ b/docs/session.md @@ -0,0 +1,149 @@ +# Protocol Documentation + + +## Table of Contents + +- [session/service.proto](#session/service.proto) + - Services + - [Session](#session.Session) + + - Messages + - [CreateRequest](#session.CreateRequest) + - [CreateResponse](#session.CreateResponse) + + +- [session/types.proto](#session/types.proto) + + - Messages + - [Token](#session.Token) + - [VerificationHeader](#session.VerificationHeader) + + +- [Scalar Value Types](#scalar-value-types) + + + + +

Top

+ +## session/service.proto + + + + + + +### Service "session.Session" +Open a trusted session to manipulate an object. In order to put or +delete object client have to obtain session token with trusted node. +Trusted node will modify client's object (add missing headers, checksums, +homomorphic hash) and sign id with session key. Session is established +during 4-step handshake in one gRPC stream + +``` +rpc Create(stream CreateRequest) returns (stream CreateResponse); + +``` + +#### Method Create + + + +| Name | Input | Output | +| ---- | ----- | ------ | +| Create | [CreateRequest](#session.CreateRequest) | [CreateResponse](#session.CreateResponse) | + + + + + +### Message CreateRequest + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| Init | [Token](#session.Token) | | Message to init session opening. Carry: owner of manipulation object; ID of manipulation object; token lifetime bounds. | +| Signed | [Token](#session.Token) | | Signed Init message response (Unsigned) from server with user private key | + + + + +### Message CreateResponse + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| Unsigned | [Token](#session.Token) | | Unsigned token with token ID and session public key generated on server side | +| Result | [Token](#session.Token) | | Resulting token which can be used for object placing through an trusted intermediary | + + + + + + + + +

Top

+ +## session/types.proto + + + + + + + +### Message Token +User token granting rights for object manipulation + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| Header | [VerificationHeader](#session.VerificationHeader) | | Header carries verification data of session key | +| OwnerID | [bytes](#bytes) | | Owner of manipulation object | +| FirstEpoch | [uint64](#uint64) | | Initial epoch of token lifetime | +| LastEpoch | [uint64](#uint64) | | Last epoch of token lifetime | +| ObjectID | [bytes](#bytes) | repeated | ID of manipulation object | +| Signature | [bytes](#bytes) | | Token signature. Signed by owner of manipulation object | +| ID | [bytes](#bytes) | | Token ID (UUID) | + + + + +### Message VerificationHeader + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| PublicKey | [bytes](#bytes) | | Session public key | +| KeySignature | [bytes](#bytes) | | Session public key signature. Signed by trusted side | + + + + + + + +## Scalar Value Types + +| .proto Type | Notes | C++ Type | Java Type | Python Type | +| ----------- | ----- | -------- | --------- | ----------- | +| double | | double | double | float | +| float | | float | float | float | +| int32 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint32 instead. | int32 | int | int | +| int64 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint64 instead. | int64 | long | int/long | +| uint32 | Uses variable-length encoding. | uint32 | int | int/long | +| uint64 | Uses variable-length encoding. | uint64 | long | int/long | +| sint32 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s. | int32 | int | int | +| sint64 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s. | int64 | long | int/long | +| fixed32 | Always four bytes. More efficient than uint32 if values are often greater than 2^28. | uint32 | int | int | +| fixed64 | Always eight bytes. More efficient than uint64 if values are often greater than 2^56. | uint64 | long | int/long | +| sfixed32 | Always four bytes. | int32 | int | int | +| sfixed64 | Always eight bytes. | int64 | long | int/long | +| bool | | bool | boolean | boolean | +| string | A string must always contain UTF-8 encoded or 7-bit ASCII text. | string | String | str/unicode | +| bytes | May contain any arbitrary sequence of bytes. | string | ByteString | str | + diff --git a/docs/state.md b/docs/state.md new file mode 100644 index 0000000..6d240c1 --- /dev/null +++ b/docs/state.md @@ -0,0 +1,137 @@ +# Protocol Documentation + + +## Table of Contents + +- [state/service.proto](#state/service.proto) + - Services + - [Status](#state.Status) + + - Messages + - [HealthRequest](#state.HealthRequest) + - [HealthResponse](#state.HealthResponse) + - [MetricsRequest](#state.MetricsRequest) + - [MetricsResponse](#state.MetricsResponse) + - [NetmapRequest](#state.NetmapRequest) + + +- [Scalar Value Types](#scalar-value-types) + + + + +

Top

+ +## state/service.proto + + + + + + +### Service "state.Status" +Status service provides node's healthcheck and status info + +``` +rpc Netmap(NetmapRequest) returns (.bootstrap.SpreadMap); +rpc Metrics(MetricsRequest) returns (MetricsResponse); +rpc HealthCheck(HealthRequest) returns (HealthResponse); + +``` + +#### Method Netmap + +Netmap request allows to receive current [bootstrap.SpreadMap](bootstrap.md#bootstrap.SpreadMap) + +| Name | Input | Output | +| ---- | ----- | ------ | +| Netmap | [NetmapRequest](#state.NetmapRequest) | [.bootstrap.SpreadMap](#bootstrap.SpreadMap) | +#### Method Metrics + +Metrics request allows to receive metrics in prometheus format + +| Name | Input | Output | +| ---- | ----- | ------ | +| Metrics | [MetricsRequest](#state.MetricsRequest) | [MetricsResponse](#state.MetricsResponse) | +#### Method HealthCheck + +HealthCheck request allows to check health status of the node. +If node unhealthy field Status would contains detailed info. + +| Name | Input | Output | +| ---- | ----- | ------ | +| HealthCheck | [HealthRequest](#state.HealthRequest) | [HealthResponse](#state.HealthResponse) | + + + + + +### Message HealthRequest +HealthRequest message to check current state + + + + + +### Message HealthResponse +HealthResponse message with current state + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| Healthy | [bool](#bool) | | Healthy is true when node alive and healthy | +| Status | [string](#string) | | Status contains detailed information about health status | + + + + +### Message MetricsRequest +MetricsRequest message to request node metrics + + + + + +### Message MetricsResponse +MetricsResponse contains [][]byte, +every []byte is marshaled MetricFamily proto message +from github.com/prometheus/client_model/metrics.proto + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| Metrics | [bytes](#bytes) | repeated | | + + + + +### Message NetmapRequest +NetmapRequest message to request current node netmap + + + + + + + + +## Scalar Value Types + +| .proto Type | Notes | C++ Type | Java Type | Python Type | +| ----------- | ----- | -------- | --------- | ----------- | +| double | | double | double | float | +| float | | float | float | float | +| int32 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint32 instead. | int32 | int | int | +| int64 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint64 instead. | int64 | long | int/long | +| uint32 | Uses variable-length encoding. | uint32 | int | int/long | +| uint64 | Uses variable-length encoding. | uint64 | long | int/long | +| sint32 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s. | int32 | int | int | +| sint64 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s. | int64 | long | int/long | +| fixed32 | Always four bytes. More efficient than uint32 if values are often greater than 2^28. | uint32 | int | int | +| fixed64 | Always eight bytes. More efficient than uint64 if values are often greater than 2^56. | uint64 | long | int/long | +| sfixed32 | Always four bytes. | int32 | int | int | +| sfixed64 | Always eight bytes. | int64 | long | int/long | +| bool | | bool | boolean | boolean | +| string | A string must always contain UTF-8 encoded or 7-bit ASCII text. | string | String | str/unicode | +| bytes | May contain any arbitrary sequence of bytes. | string | ByteString | str | + From 15b997bdb51b2e3dbafab0a10e4b7c8c3b1f8b37 Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Thu, 21 Nov 2019 10:26:01 +0300 Subject: [PATCH 0015/1196] docs: update proto doc comments to satisfy go-doc comment --- accounting/withdraw.proto | 4 +- container/types.proto | 12 ++-- object/service.proto | 117 ++++++++++++++++++++----------- object/types.proto | 141 +++++++++++++++++++++++++------------- query/types.proto | 3 +- refs/types.proto | 2 +- session/service.proto | 17 +++-- session/types.proto | 16 ++--- 8 files changed, 201 insertions(+), 111 deletions(-) diff --git a/accounting/withdraw.proto b/accounting/withdraw.proto index 33ce402..8e10ef9 100644 --- a/accounting/withdraw.proto +++ b/accounting/withdraw.proto @@ -42,7 +42,7 @@ message GetRequest { } message GetResponse { - // Item is cheque with meta information + // Withdraw is cheque with meta information Item Withdraw = 1; } @@ -73,7 +73,7 @@ message ListRequest { } message ListResponse { - // Item is a set of cheques with meta information + // Items is a set of cheques with meta information repeated Item Items = 1; } diff --git a/container/types.proto b/container/types.proto index efcaee8..a601edd 100644 --- a/container/types.proto +++ b/container/types.proto @@ -9,8 +9,12 @@ option (gogoproto.stable_marshaler_all) = true; // The Container service definition. message Container { - bytes OwnerID = 1 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false]; // OwnerID is a wallet address. - bytes Salt = 2 [(gogoproto.customtype) = "UUID", (gogoproto.nullable) = false]; // Salt is a nonce for unique container id calculation. - uint64 Capacity = 3; // Capacity defines amount of data that can be stored in the container (doesn't used for now). - netmap.PlacementRule Rules = 4 [(gogoproto.nullable) = false]; // Rules define storage policy for the object inside the container. + // OwnerID is a wallet address. + bytes OwnerID = 1 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false]; + // Salt is a nonce for unique container id calculation. + bytes Salt = 2 [(gogoproto.customtype) = "UUID", (gogoproto.nullable) = false]; + // Capacity defines amount of data that can be stored in the container (doesn't used for now). + uint64 Capacity = 3; + // Rules define storage policy for the object inside the container. + netmap.PlacementRule Rules = 4 [(gogoproto.nullable) = false]; } diff --git a/object/service.proto b/object/service.proto index 6f13d55..5edf935 100644 --- a/object/service.proto +++ b/object/service.proto @@ -52,41 +52,58 @@ service Service { } message GetRequest { - uint64 Epoch = 1; // Epoch is set by user to 0, node set epoch to the actual value - refs.Address Address = 2 [(gogoproto.nullable) = false]; // Address of object (container id + object id) - uint32 TTL = 3; // TTL must be larger than zero, it decreased in every neofs-node + // Epoch is set by user to 0, node set epoch to the actual value + uint64 Epoch = 1; + // Address of object (container id + object id) + refs.Address Address = 2 [(gogoproto.nullable) = false]; + // TTL must be larger than zero, it decreased in every neofs-node + uint32 TTL = 3; } message GetResponse { oneof R { - Object object = 1; // Object header and some payload - bytes Chunk = 2; // Chunk of remaining payload + // Object header and some payload + Object object = 1; + // Chunk of remaining payload + bytes Chunk = 2; } } message PutRequest { message PutHeader { - uint64 Epoch = 1; // Epoch is set by user to 0, node set epoch to the actual value - Object Object = 2; // Object with at least container id and owner id fields - uint32 TTL = 3; // TTL must be larger than zero, it decreased in every neofs-node - session.Token Token = 4; // Token with session public key and user's signature + // Epoch is set by user to 0, node set epoch to the actual value + uint64 Epoch = 1; + // Object with at least container id and owner id fields + Object Object = 2; + // TTL must be larger than zero, it decreased in every neofs-node + uint32 TTL = 3; + // Token with session public key and user's signature + session.Token Token = 4; } oneof R { - PutHeader Header = 1; // Header should be the first message in the stream - bytes Chunk = 2; // Chunk should be a remaining message in stream should be chunks + // Header should be the first message in the stream + PutHeader Header = 1; + // Chunk should be a remaining message in stream should be chunks + bytes Chunk = 2; } } message PutResponse { - refs.Address Address = 1 [(gogoproto.nullable) = false]; // Address of object (container id + object id) + // Address of object (container id + object id) + refs.Address Address = 1 [(gogoproto.nullable) = false]; } message DeleteRequest { - uint64 Epoch = 1; // Epoch is set by user to 0, node set epoch to the actual value - refs.Address Address = 2 [(gogoproto.nullable) = false]; // Address of object (container id + object id) - bytes OwnerID = 3 [(gogoproto.nullable) = false, (gogoproto.customtype) = "OwnerID"]; // OwnerID is a wallet address - uint32 TTL = 4; // TTL must be larger than zero, it decreased in every neofs-node - session.Token Token = 5; // Token with session public key and user's signature + // Epoch is set by user to 0, node set epoch to the actual value + uint64 Epoch = 1; + // Address of object (container id + object id) + refs.Address Address = 2 [(gogoproto.nullable) = false]; + // OwnerID is a wallet address + bytes OwnerID = 3 [(gogoproto.nullable) = false, (gogoproto.customtype) = "OwnerID"]; + // TTL must be larger than zero, it decreased in every neofs-node + uint32 TTL = 4; + // Token with session public key and user's signature + session.Token Token = 5; } // DeleteResponse is empty because we cannot guarantee permanent object removal @@ -94,47 +111,69 @@ message DeleteRequest { message DeleteResponse {} message HeadRequest { - uint64 Epoch = 1; // Epoch is set by user to 0, node set epoch to the actual value - refs.Address Address = 2 [(gogoproto.nullable) = false, (gogoproto.customtype) = "Address"]; // Address of object (container id + object id) - bool FullHeaders = 3; // FullHeaders can be set true for extended headers in the object - uint32 TTL = 4; // TTL must be larger than zero, it decreased in every neofs-node + // Epoch should be empty on user side, node sets epoch to the actual value + uint64 Epoch = 1; + // Address of object (container id + object id) + refs.Address Address = 2 [(gogoproto.nullable) = false, (gogoproto.customtype) = "Address"]; + // FullHeaders can be set true for extended headers in the object + bool FullHeaders = 3; + // TTL must be larger than zero, it decreased in every neofs-node + uint32 TTL = 4; } message HeadResponse { - Object Object = 1; // Object without payload + // Object without payload + Object Object = 1; } message SearchRequest { - uint64 Epoch = 1; // Epoch is set by user to 0, node set epoch to the actual value - uint32 Version = 2; // Version of search query format - bytes ContainerID = 3 [(gogoproto.nullable) = false, (gogoproto.customtype) = "CID"]; // ContainerID for searching the object - bytes Query = 4; // Query in the binary serialized format - uint32 TTL = 5; // TTL must be larger than zero, it decreased in every neofs-node + // Epoch is set by user to 0, node set epoch to the actual value + uint64 Epoch = 1; + // Version of search query format + uint32 Version = 2; + // ContainerID for searching the object + bytes ContainerID = 3 [(gogoproto.nullable) = false, (gogoproto.customtype) = "CID"]; + // Query in the binary serialized format + bytes Query = 4; + // TTL must be larger than zero, it decreased in every neofs-node + uint32 TTL = 5; } message SearchResponse { - repeated refs.Address Addresses = 1 [(gogoproto.nullable) = false]; // Addresses of found objects + // Addresses of found objects + repeated refs.Address Addresses = 1 [(gogoproto.nullable) = false]; } message GetRangeRequest { - uint64 Epoch = 1; // Epoch is set by user to 0, node set epoch to the actual value - refs.Address Address = 2 [(gogoproto.nullable) = false]; // Address of object (container id + object id) - repeated Range Ranges = 3 [(gogoproto.nullable) = false]; // Ranges of object's payload to return - uint32 TTL = 4; // TTL must be larger than zero, it decreased in every neofs-node + // Epoch is set by user to 0, node set epoch to the actual value + uint64 Epoch = 1; + // Address of object (container id + object id) + refs.Address Address = 2 [(gogoproto.nullable) = false]; + // Ranges of object's payload to return + repeated Range Ranges = 3 [(gogoproto.nullable) = false]; + // TTL must be larger than zero, it decreased in every neofs-node + uint32 TTL = 4; } message GetRangeResponse { - repeated bytes Fragments = 1; // Fragments of object's payload + // Fragments of object's payload + repeated bytes Fragments = 1; } message GetRangeHashRequest { - uint64 Epoch = 1; // Epoch is set by user to 0, node set epoch to the actual value - refs.Address Address = 2 [(gogoproto.nullable) = false]; // Address of object (container id + object id) - repeated Range Ranges = 3 [(gogoproto.nullable) = false]; // Ranges of object's payload to calculate homomorphic hash - bytes Salt = 4; // Salt is used to XOR object's payload ranges before hashing, it can be nil - uint32 TTL = 5; // TTL must be larger than zero, it decreased in every neofs-node + // Epoch is set by user to 0, node set epoch to the actual value + uint64 Epoch = 1; + // Address of object (container id + object id) + refs.Address Address = 2 [(gogoproto.nullable) = false]; + // Ranges of object's payload to calculate homomorphic hash + repeated Range Ranges = 3 [(gogoproto.nullable) = false]; + // Salt is used to XOR object's payload ranges before hashing, it can be nil + bytes Salt = 4; + // TTL must be larger than zero, it decreased in every neofs-node + uint32 TTL = 5; } message GetRangeHashResponse { - repeated bytes Hashes = 1 [(gogoproto.customtype) = "Hash", (gogoproto.nullable) = false]; // Homomorphic hashes of all ranges + // Hashes is a homomorphic hashes of all ranges + repeated bytes Hashes = 1 [(gogoproto.customtype) = "Hash", (gogoproto.nullable) = false]; } diff --git a/object/types.proto b/object/types.proto index 30e468e..f3313a3 100644 --- a/object/types.proto +++ b/object/types.proto @@ -9,97 +9,144 @@ import "github.com/gogo/protobuf/gogoproto/gogo.proto"; option (gogoproto.stable_marshaler_all) = true; message Range { - uint64 Offset = 1; // Offset of the data range - uint64 Length = 2; // Length of the data range + // Offset of the data range + uint64 Offset = 1; + // Length of the data range + uint64 Length = 2; } message UserHeader { - string Key = 1; // Key of the user's header - string Value = 2; // Value of the user's header + // Key of the user's header + string Key = 1; + // Value of the user's header + string Value = 2; } message Header { oneof Value { - Link Link = 1; // Link to other objects - refs.Address Redirect = 2; // RedirectNot used yet - UserHeader UserHeader = 3; // UserHeader defined by user - Transform Transform = 4; // Transform defines transform operation (e.g. payload split) - Tombstone Tombstone = 5; // Tombstone header that set up in deleted objects - session.VerificationHeader Verify = 6; // Verify header that contains session public key and user's signature - bytes HomoHash = 7 [(gogoproto.customtype) = "Hash"]; // Homomorphic hash of original object payload - bytes PayloadChecksum = 8; // PayloadChecksum of actual object's payload - IntegrityHeader Integrity = 9; // Integrity header with checksum of all above headers in the object - StorageGroup StorageGroup = 10; // StorageGroup contains meta information for the data audit + // Link to other objects + Link Link = 1; + // Redirect not used yet + refs.Address Redirect = 2; + // UserHeader is a set of KV headers defined by user + UserHeader UserHeader = 3; + // Transform defines transform operation (e.g. payload split) + Transform Transform = 4; + // Tombstone header that set up in deleted objects + Tombstone Tombstone = 5; + // Verify header that contains session public key and user's signature + session.VerificationHeader Verify = 6; + // HomoHash is a homomorphic hash of original object payload + bytes HomoHash = 7 [(gogoproto.customtype) = "Hash"]; + // PayloadChecksum of actual object's payload + bytes PayloadChecksum = 8; + // Integrity header with checksum of all above headers in the object + IntegrityHeader Integrity = 9; + // StorageGroup contains meta information for the data audit + StorageGroup StorageGroup = 10; } } message Tombstone { - uint64 Epoch = 1; // Epoch when tombstone was created + // Epoch when tombstone was created + uint64 Epoch = 1; } message SystemHeader { - uint64 Version = 1; // Version of the object structure - uint64 PayloadLength = 2; // Object payload length + // Version of the object structure + uint64 Version = 1; + // PayloadLength is an object payload length + uint64 PayloadLength = 2; - bytes ID = 3 [(gogoproto.customtype) = "ID", (gogoproto.nullable) = false]; // ObjectID is a UUID - bytes OwnerID = 4 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false]; // OwnerID is a wallet address - bytes CID = 5 [(gogoproto.customtype) = "CID", (gogoproto.nullable) = false]; // ContainerID is a SHA256 hash of the container structure - CreationPoint CreatedAt = 6 [(gogoproto.nullable) = false]; // Timestamp of object creation + // ID is an object identifier, is a valid UUIDv4 + bytes ID = 3 [(gogoproto.customtype) = "ID", (gogoproto.nullable) = false]; + // OwnerID is a wallet address + bytes OwnerID = 4 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false]; + // CID is a SHA256 hash of the container structure (container identifier) + bytes CID = 5 [(gogoproto.customtype) = "CID", (gogoproto.nullable) = false]; + // CreatedAt is a timestamp of object creation + CreationPoint CreatedAt = 6 [(gogoproto.nullable) = false]; } message CreationPoint { - int64 UnixTime = 1; // Date of creation in unixtime format - uint64 Epoch = 2; // Date of creation in NeoFS epochs + // UnixTime is a date of creation in unixtime format + int64 UnixTime = 1; + // Epoch is a date of creation in NeoFS epochs + uint64 Epoch = 2; } message IntegrityHeader { - bytes HeadersChecksum = 1; // Checksum of all above headers in the object - bytes ChecksumSignature = 2; // User's signature of checksum to verify if it is correct + // HeadersChecksum is a checksum of all above headers in the object + bytes HeadersChecksum = 1; + // ChecksumSignature is an user's signature of checksum to verify if it is correct + bytes ChecksumSignature = 2; } message Link { enum Type { Unknown = 0; - Parent = 1; // Parent object created during object transformation - Previous = 2; // Previous object in the linked list created during object transformation - Next = 3; // Next object in the linked list created during object transformation - Child = 4; // Child object created during object transformation - StorageGroup = 5; // Object that included into this storage group + // Parent object created during object transformation + Parent = 1; + // Previous object in the linked list created during object transformation + Previous = 2; + // Next object in the linked list created during object transformation + Next = 3; + // Child object created during object transformation + Child = 4; + // Object that included into this storage group + StorageGroup = 5; } - Type type = 1; // Link type - bytes ID = 2 [(gogoproto.customtype) = "ID", (gogoproto.nullable) = false]; // Object id + // Type of link + Type type = 1; + // ID is an object identifier, is a valid UUIDv4 + bytes ID = 2 [(gogoproto.customtype) = "ID", (gogoproto.nullable) = false]; } message Transform { enum Type { Unknown = 0; - Split = 1; // Object created after payload split - Sign = 2; // Object created after re-signing (doesn't used) - Mould = 3; // Object created after filling missing headers in the object + // Split sets when object created after payload split + Split = 1; + // Sign sets when object created after re-signing (doesn't used) + Sign = 2; + // Mould sets when object created after filling missing headers in the object + Mould = 3; } - Type type = 1; // Type of object transformation + // Type of object transformation + Type type = 1; } message Object { - SystemHeader SystemHeader = 1 [(gogoproto.nullable) = false]; // System header - repeated Header Headers = 2 [(gogoproto.nullable) = false]; // Extended headers - bytes Payload = 3; // Object's payload + // SystemHeader describes system header + SystemHeader SystemHeader = 1 [(gogoproto.nullable) = false]; + // Headers describes a set of an extended headers + repeated Header Headers = 2 [(gogoproto.nullable) = false]; + // Payload is an object's payload + bytes Payload = 3; } message StorageGroup { - uint64 ValidationDataSize = 1; // Size of the all object's payloads included into storage group - bytes ValidationHash = 2 [(gogoproto.customtype) = "Hash", (gogoproto.nullable) = false]; // Homomorphic hash of all object's payloads included into storage group + // ValidationDataSize is size of the all object's payloads included into storage group + uint64 ValidationDataSize = 1; + // ValidationHash is homomorphic hash of all object's payloads included into storage group + bytes ValidationHash = 2 [(gogoproto.customtype) = "Hash", (gogoproto.nullable) = false]; message Lifetime { enum Unit { - Unlimited = 0; // Storage group always valid - NeoFSEpoch = 1; // Storage group is valid until lifetime NeoFS epoch - UnixTime = 2; // Storage group is valid until lifetime unix timestamp + // Unlimited set if storage group always valid + Unlimited = 0; + // NeoFSEpoch set if storage group is valid until lifetime NeoFS epoch + NeoFSEpoch = 1; + // UnixTime set if storage group is valid until lifetime unix timestamp + UnixTime = 2; } - Unit unit = 1 [(gogoproto.customname) = "Unit"]; // Lifetime type - int64 Value = 2; // Lifetime value + // Unit is lifetime type + Unit unit = 1 [(gogoproto.customname) = "Unit"]; + // Value for lifetime + int64 Value = 2; } - Lifetime lifetime = 3 [(gogoproto.customname) = "Lifetime"]; // Time until storage group is valid + // Lifetime is time until storage group is valid + Lifetime lifetime = 3 [(gogoproto.customname) = "Lifetime"]; } diff --git a/query/types.proto b/query/types.proto index 884a6bd..6eaed5d 100644 --- a/query/types.proto +++ b/query/types.proto @@ -9,9 +9,10 @@ option (gogoproto.stable_marshaler_all) = true; message Filter { option (gogoproto.goproto_stringer) = false; - // Type can be Exact or Regex enum Type { + // Exact sets when value of filter should be equal to the header value Exact = 0; + // Regex sets when value of filter should match the header value by the regular expression Regex = 1; } diff --git a/refs/types.proto b/refs/types.proto index 15355ae..8c7d2eb 100644 --- a/refs/types.proto +++ b/refs/types.proto @@ -11,7 +11,7 @@ option (gogoproto.goproto_stringer_all) = false; // Address of object (container id + object id) message Address { - // ObjectID is an object identifier + // ObjectID is an object identifier, valid UUIDv4 represented in bytes bytes ObjectID = 1[(gogoproto.customtype) = "ObjectID", (gogoproto.nullable) = false]; // CID is container identifier bytes CID = 2[(gogoproto.customtype) = "CID", (gogoproto.nullable) = false]; diff --git a/session/service.proto b/session/service.proto index 484425b..4b37aaf 100644 --- a/session/service.proto +++ b/session/service.proto @@ -9,17 +9,16 @@ option (gogoproto.stable_marshaler_all) = true; service Session { - // Open a trusted session to manipulate an object. In order to put or - // delete object client have to obtain session token with trusted node. - // Trusted node will modify client's object (add missing headers, checksums, - // homomorphic hash) and sign id with session key. Session is established - // during 4-step handshake in one gRPC stream - + // Create is a method that used to open a trusted session to manipulate + // an object. In order to put or delete object client have to obtain session + // token with trusted node. Trusted node will modify client's object + // (add missing headers, checksums, homomorphic hash) and sign id with + // session key. Session is established during 4-step handshake in one gRPC stream + // // - First client stream message SHOULD BE type of `CreateRequest_Init`. // - First server stream message SHOULD BE type of `CreateResponse_Unsigned`. // - Second client stream message SHOULD BE type of `CreateRequest_Signed`. // - Second server stream message SHOULD BE type of `CreateResponse_Result`. - rpc Create (stream CreateRequest) returns (stream CreateResponse); } @@ -27,7 +26,7 @@ service Session { message CreateRequest { // Message should be one of oneof Message { - // Message to init session opening. Carry: + // Init is a message to initialize session opening. Carry: // owner of manipulation object; // ID of manipulation object; // token lifetime bounds. @@ -41,7 +40,7 @@ message CreateResponse { oneof Message { // Unsigned token with token ID and session public key generated on server side session.Token Unsigned = 1; - // Resulting token which can be used for object placing through an trusted intermediary + // Result is a resulting token which can be used for object placing through an trusted intermediary session.Token Result = 2; } } diff --git a/session/types.proto b/session/types.proto index bf804bf..1ade791 100644 --- a/session/types.proto +++ b/session/types.proto @@ -7,9 +7,9 @@ import "github.com/gogo/protobuf/gogoproto/gogo.proto"; option (gogoproto.stable_marshaler_all) = true; message VerificationHeader { - // Session public key + // PublicKey is a session public key bytes PublicKey = 1; - // Session public key signature. Signed by trusted side + // KeySignature is a session public key signature. Signed by trusted side bytes KeySignature = 2; } @@ -17,16 +17,16 @@ message VerificationHeader { message Token { // Header carries verification data of session key VerificationHeader Header = 1 [(gogoproto.nullable) = false]; - // Owner of manipulation object + // OwnerID is an owner of manipulation object bytes OwnerID = 2 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false]; - // Initial epoch of token lifetime + // FirstEpoch is an initial epoch of token lifetime uint64 FirstEpoch = 3; - // Last epoch of token lifetime + // LastEpoch is a last epoch of token lifetime uint64 LastEpoch = 4; - // ID of manipulation object + // ObjectID is an object identifier of manipulation object repeated bytes ObjectID = 5 [(gogoproto.customtype) = "ObjectID", (gogoproto.nullable) = false]; - // Token signature. Signed by owner of manipulation object + // Signature is a token signature, signed by owner of manipulation object bytes Signature = 6; - // Token ID (UUID) + // ID is a token identifier. valid UUIDv4 represented in bytes bytes ID = 7 [(gogoproto.customtype) = "TokenID", (gogoproto.nullable) = false]; } From 3d445aeb0b2e1fc71e06e66f22b67bd4fa918970 Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Thu, 21 Nov 2019 10:32:07 +0300 Subject: [PATCH 0016/1196] docs: add deprecation notice for epoch and ttl fields --- accounting/service.proto | 1 + accounting/withdraw.proto | 4 ++++ bootstrap/service.proto | 1 + container/service.proto | 4 ++++ object/service.proto | 14 ++++++++++++++ 5 files changed, 24 insertions(+) diff --git a/accounting/service.proto b/accounting/service.proto index f975c23..9cfdb0f 100644 --- a/accounting/service.proto +++ b/accounting/service.proto @@ -19,6 +19,7 @@ message BalanceRequest { // OwnerID is a wallet address bytes OwnerID = 1 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false]; // TTL must be larger than zero, it decreased in every neofs-node + // Deprecated: will be replaced with RequestMetaHeader (see develop branch) uint32 TTL = 2; } diff --git a/accounting/withdraw.proto b/accounting/withdraw.proto index 8e10ef9..eb58d08 100644 --- a/accounting/withdraw.proto +++ b/accounting/withdraw.proto @@ -38,6 +38,7 @@ message GetRequest { // OwnerID is a wallet address bytes OwnerID = 2 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false]; // TTL must be larger than zero, it decreased in every neofs-node + // Deprecated: will be replaced with RequestMetaHeader (see develop branch) uint32 TTL = 3; } @@ -58,6 +59,7 @@ message PutRequest { // Signature is a signature of the sent request bytes Signature = 5; // TTL must be larger than zero, it decreased in every neofs-node + // Deprecated: will be replaced with RequestMetaHeader (see develop branch) uint32 TTL = 6; } message PutResponse { @@ -69,6 +71,7 @@ message ListRequest { // OwnerID is a wallet address bytes OwnerID = 1 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false]; // TTL must be larger than zero, it decreased in every neofs-node + // Deprecated: will be replaced with RequestMetaHeader (see develop branch) uint32 TTL = 2; } @@ -87,6 +90,7 @@ message DeleteRequest { // Signature is a signature of the sent request bytes Signature = 4; // TTL must be larger than zero, it decreased in every neofs-node + // Deprecated: will be replaced with RequestMetaHeader (see develop branch) uint32 TTL = 5; } diff --git a/bootstrap/service.proto b/bootstrap/service.proto index a0f82dc..cde94dc 100644 --- a/bootstrap/service.proto +++ b/bootstrap/service.proto @@ -21,5 +21,6 @@ message Request { // Info contains information about node bootstrap.NodeInfo info = 2 [(gogoproto.nullable) = false]; // TTL must be larger than zero, it decreased in every neofs-node + // Deprecated: will be replaced with RequestMetaHeader (see develop branch) uint32 TTL = 3; } diff --git a/container/service.proto b/container/service.proto index 72c0899..1cf8227 100644 --- a/container/service.proto +++ b/container/service.proto @@ -43,6 +43,7 @@ message PutRequest { bytes Signature = 5; // TTL must be larger than zero, it decreased in every neofs-node + // Deprecated: will be replaced with RequestMetaHeader (see develop branch) uint32 TTL = 6; } @@ -56,6 +57,7 @@ message DeleteRequest { bytes CID = 1 [(gogoproto.customtype) = "CID", (gogoproto.nullable) = false]; // TTL must be larger than zero, it decreased in every neofs-node + // Deprecated: will be replaced with RequestMetaHeader (see develop branch) uint32 TTL = 2; // Signature of the container owner @@ -72,6 +74,7 @@ message GetRequest { bytes CID = 1 [(gogoproto.customtype) = "CID", (gogoproto.nullable) = false]; // TTL must be larger than zero, it decreased in every neofs-node + // Deprecated: will be replaced with RequestMetaHeader (see develop branch) uint32 TTL = 2; } @@ -85,6 +88,7 @@ message ListRequest { bytes OwnerID = 1 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false]; // TTL must be larger than zero, it decreased in every neofs-node + // Deprecated: will be replaced with RequestMetaHeader (see develop branch) uint32 TTL = 2; } diff --git a/object/service.proto b/object/service.proto index 5edf935..7a971db 100644 --- a/object/service.proto +++ b/object/service.proto @@ -53,10 +53,12 @@ service Service { message GetRequest { // Epoch is set by user to 0, node set epoch to the actual value + // Deprecated: will be replaced with RequestMetaHeader (see develop branch) uint64 Epoch = 1; // Address of object (container id + object id) refs.Address Address = 2 [(gogoproto.nullable) = false]; // TTL must be larger than zero, it decreased in every neofs-node + // Deprecated: will be replaced with RequestMetaHeader (see develop branch) uint32 TTL = 3; } @@ -72,10 +74,12 @@ message GetResponse { message PutRequest { message PutHeader { // Epoch is set by user to 0, node set epoch to the actual value + // Deprecated: will be replaced with RequestMetaHeader (see develop branch) uint64 Epoch = 1; // Object with at least container id and owner id fields Object Object = 2; // TTL must be larger than zero, it decreased in every neofs-node + // Deprecated: will be replaced with RequestMetaHeader (see develop branch) uint32 TTL = 3; // Token with session public key and user's signature session.Token Token = 4; @@ -95,12 +99,14 @@ message PutResponse { } message DeleteRequest { // Epoch is set by user to 0, node set epoch to the actual value + // Deprecated: will be replaced with RequestMetaHeader (see develop branch) uint64 Epoch = 1; // Address of object (container id + object id) refs.Address Address = 2 [(gogoproto.nullable) = false]; // OwnerID is a wallet address bytes OwnerID = 3 [(gogoproto.nullable) = false, (gogoproto.customtype) = "OwnerID"]; // TTL must be larger than zero, it decreased in every neofs-node + // Deprecated: will be replaced with RequestMetaHeader (see develop branch) uint32 TTL = 4; // Token with session public key and user's signature session.Token Token = 5; @@ -112,12 +118,14 @@ message DeleteResponse {} message HeadRequest { // Epoch should be empty on user side, node sets epoch to the actual value + // Deprecated: will be replaced with RequestMetaHeader (see develop branch) uint64 Epoch = 1; // Address of object (container id + object id) refs.Address Address = 2 [(gogoproto.nullable) = false, (gogoproto.customtype) = "Address"]; // FullHeaders can be set true for extended headers in the object bool FullHeaders = 3; // TTL must be larger than zero, it decreased in every neofs-node + // Deprecated: will be replaced with RequestMetaHeader (see develop branch) uint32 TTL = 4; } message HeadResponse { @@ -127,6 +135,7 @@ message HeadResponse { message SearchRequest { // Epoch is set by user to 0, node set epoch to the actual value + // Deprecated: will be replaced with RequestMetaHeader (see develop branch) uint64 Epoch = 1; // Version of search query format uint32 Version = 2; @@ -135,6 +144,7 @@ message SearchRequest { // Query in the binary serialized format bytes Query = 4; // TTL must be larger than zero, it decreased in every neofs-node + // Deprecated: will be replaced with RequestMetaHeader (see develop branch) uint32 TTL = 5; } @@ -145,12 +155,14 @@ message SearchResponse { message GetRangeRequest { // Epoch is set by user to 0, node set epoch to the actual value + // Deprecated: will be replaced with RequestMetaHeader (see develop branch) uint64 Epoch = 1; // Address of object (container id + object id) refs.Address Address = 2 [(gogoproto.nullable) = false]; // Ranges of object's payload to return repeated Range Ranges = 3 [(gogoproto.nullable) = false]; // TTL must be larger than zero, it decreased in every neofs-node + // Deprecated: will be replaced with RequestMetaHeader (see develop branch) uint32 TTL = 4; } @@ -161,6 +173,7 @@ message GetRangeResponse { message GetRangeHashRequest { // Epoch is set by user to 0, node set epoch to the actual value + // Deprecated: will be replaced with RequestMetaHeader (see develop branch) uint64 Epoch = 1; // Address of object (container id + object id) refs.Address Address = 2 [(gogoproto.nullable) = false]; @@ -169,6 +182,7 @@ message GetRangeHashRequest { // Salt is used to XOR object's payload ranges before hashing, it can be nil bytes Salt = 4; // TTL must be larger than zero, it decreased in every neofs-node + // Deprecated: will be replaced with RequestMetaHeader (see develop branch) uint32 TTL = 5; } From e333a13557861ac034893040af7fced87eaec5c3 Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Thu, 21 Nov 2019 10:34:38 +0300 Subject: [PATCH 0017/1196] docs: regenerate proto files --- accounting/service.pb.go | 1 + accounting/withdraw.pb.go | 8 ++- bootstrap/service.pb.go | 1 + container/service.pb.go | 4 ++ container/types.pb.go | 10 +++- object/service.pb.go | 119 +++++++++++++++++++++++++++----------- object/types.pb.go | 111 +++++++++++++++++++++++------------ query/types.pb.go | 3 +- refs/types.pb.go | 2 +- session/service.pb.go | 20 +++++++ session/types.pb.go | 16 ++--- 11 files changed, 208 insertions(+), 87 deletions(-) diff --git a/accounting/service.pb.go b/accounting/service.pb.go index ea86a8e..bc31ce1 100644 --- a/accounting/service.pb.go +++ b/accounting/service.pb.go @@ -32,6 +32,7 @@ type BalanceRequest struct { // OwnerID is a wallet address OwnerID OwnerID `protobuf:"bytes,1,opt,name=OwnerID,proto3,customtype=OwnerID" json:"OwnerID"` // TTL must be larger than zero, it decreased in every neofs-node + // Deprecated: will be replaced with RequestMetaHeader (see develop branch) TTL uint32 `protobuf:"varint,2,opt,name=TTL,proto3" json:"TTL,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` diff --git a/accounting/withdraw.pb.go b/accounting/withdraw.pb.go index b50bc1c..f0e78aa 100644 --- a/accounting/withdraw.pb.go +++ b/accounting/withdraw.pb.go @@ -100,6 +100,7 @@ type GetRequest struct { // OwnerID is a wallet address OwnerID OwnerID `protobuf:"bytes,2,opt,name=OwnerID,proto3,customtype=OwnerID" json:"OwnerID"` // TTL must be larger than zero, it decreased in every neofs-node + // Deprecated: will be replaced with RequestMetaHeader (see develop branch) TTL uint32 `protobuf:"varint,3,opt,name=TTL,proto3" json:"TTL,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -143,7 +144,7 @@ func (m *GetRequest) GetTTL() uint32 { } type GetResponse struct { - // Item is cheque with meta information + // Withdraw is cheque with meta information Withdraw *Item `protobuf:"bytes,1,opt,name=Withdraw,proto3" json:"Withdraw,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -198,6 +199,7 @@ type PutRequest struct { // Signature is a signature of the sent request Signature []byte `protobuf:"bytes,5,opt,name=Signature,proto3" json:"Signature,omitempty"` // TTL must be larger than zero, it decreased in every neofs-node + // Deprecated: will be replaced with RequestMetaHeader (see develop branch) TTL uint32 `protobuf:"varint,6,opt,name=TTL,proto3" json:"TTL,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -302,6 +304,7 @@ type ListRequest struct { // OwnerID is a wallet address OwnerID OwnerID `protobuf:"bytes,1,opt,name=OwnerID,proto3,customtype=OwnerID" json:"OwnerID"` // TTL must be larger than zero, it decreased in every neofs-node + // Deprecated: will be replaced with RequestMetaHeader (see develop branch) TTL uint32 `protobuf:"varint,2,opt,name=TTL,proto3" json:"TTL,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -345,7 +348,7 @@ func (m *ListRequest) GetTTL() uint32 { } type ListResponse struct { - // Item is a set of cheques with meta information + // Items is a set of cheques with meta information Items []*Item `protobuf:"bytes,1,rep,name=Items,proto3" json:"Items,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -398,6 +401,7 @@ type DeleteRequest struct { // Signature is a signature of the sent request Signature []byte `protobuf:"bytes,4,opt,name=Signature,proto3" json:"Signature,omitempty"` // TTL must be larger than zero, it decreased in every neofs-node + // Deprecated: will be replaced with RequestMetaHeader (see develop branch) TTL uint32 `protobuf:"varint,5,opt,name=TTL,proto3" json:"TTL,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` diff --git a/bootstrap/service.pb.go b/bootstrap/service.pb.go index 14f8e9e..f00f814 100644 --- a/bootstrap/service.pb.go +++ b/bootstrap/service.pb.go @@ -33,6 +33,7 @@ type Request struct { // Info contains information about node Info NodeInfo `protobuf:"bytes,2,opt,name=info,proto3" json:"info"` // TTL must be larger than zero, it decreased in every neofs-node + // Deprecated: will be replaced with RequestMetaHeader (see develop branch) TTL uint32 `protobuf:"varint,3,opt,name=TTL,proto3" json:"TTL,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` diff --git a/container/service.pb.go b/container/service.pb.go index 9cc6991..cfd401d 100644 --- a/container/service.pb.go +++ b/container/service.pb.go @@ -40,6 +40,7 @@ type PutRequest struct { // Signature of the user (owner id) Signature []byte `protobuf:"bytes,5,opt,name=Signature,proto3" json:"Signature,omitempty"` // TTL must be larger than zero, it decreased in every neofs-node + // Deprecated: will be replaced with RequestMetaHeader (see develop branch) TTL uint32 `protobuf:"varint,6,opt,name=TTL,proto3" json:"TTL,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -144,6 +145,7 @@ type DeleteRequest struct { // CID (container id) is a SHA256 hash of the container structure CID CID `protobuf:"bytes,1,opt,name=CID,proto3,customtype=CID" json:"CID"` // TTL must be larger than zero, it decreased in every neofs-node + // Deprecated: will be replaced with RequestMetaHeader (see develop branch) TTL uint32 `protobuf:"varint,2,opt,name=TTL,proto3" json:"TTL,omitempty"` // Signature of the container owner Signature []byte `protobuf:"bytes,3,opt,name=Signature,proto3" json:"Signature,omitempty"` @@ -236,6 +238,7 @@ type GetRequest struct { // CID (container id) is a SHA256 hash of the container structure CID CID `protobuf:"bytes,1,opt,name=CID,proto3,customtype=CID" json:"CID"` // TTL must be larger than zero, it decreased in every neofs-node + // Deprecated: will be replaced with RequestMetaHeader (see develop branch) TTL uint32 `protobuf:"varint,2,opt,name=TTL,proto3" json:"TTL,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -326,6 +329,7 @@ type ListRequest struct { // OwnerID is a wallet address OwnerID OwnerID `protobuf:"bytes,1,opt,name=OwnerID,proto3,customtype=OwnerID" json:"OwnerID"` // TTL must be larger than zero, it decreased in every neofs-node + // Deprecated: will be replaced with RequestMetaHeader (see develop branch) TTL uint32 `protobuf:"varint,2,opt,name=TTL,proto3" json:"TTL,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` diff --git a/container/types.pb.go b/container/types.pb.go index 8c4775c..7bf9a03 100644 --- a/container/types.pb.go +++ b/container/types.pb.go @@ -26,9 +26,13 @@ const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package // The Container service definition. type Container struct { - OwnerID OwnerID `protobuf:"bytes,1,opt,name=OwnerID,proto3,customtype=OwnerID" json:"OwnerID"` - Salt UUID `protobuf:"bytes,2,opt,name=Salt,proto3,customtype=UUID" json:"Salt"` - Capacity uint64 `protobuf:"varint,3,opt,name=Capacity,proto3" json:"Capacity,omitempty"` + // OwnerID is a wallet address. + OwnerID OwnerID `protobuf:"bytes,1,opt,name=OwnerID,proto3,customtype=OwnerID" json:"OwnerID"` + // Salt is a nonce for unique container id calculation. + Salt UUID `protobuf:"bytes,2,opt,name=Salt,proto3,customtype=UUID" json:"Salt"` + // Capacity defines amount of data that can be stored in the container (doesn't used for now). + Capacity uint64 `protobuf:"varint,3,opt,name=Capacity,proto3" json:"Capacity,omitempty"` + // Rules define storage policy for the object inside the container. Rules netmap.PlacementRule `protobuf:"bytes,4,opt,name=Rules,proto3" json:"Rules"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` diff --git a/object/service.pb.go b/object/service.pb.go index 8301ebb..b19ed93 100644 --- a/object/service.pb.go +++ b/object/service.pb.go @@ -30,12 +30,17 @@ var _ = math.Inf const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package type GetRequest struct { - Epoch uint64 `protobuf:"varint,1,opt,name=Epoch,proto3" json:"Epoch,omitempty"` - Address refs.Address `protobuf:"bytes,2,opt,name=Address,proto3" json:"Address"` - TTL uint32 `protobuf:"varint,3,opt,name=TTL,proto3" json:"TTL,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + // Epoch is set by user to 0, node set epoch to the actual value + // Deprecated: will be replaced with RequestMetaHeader (see develop branch) + Epoch uint64 `protobuf:"varint,1,opt,name=Epoch,proto3" json:"Epoch,omitempty"` + // Address of object (container id + object id) + Address refs.Address `protobuf:"bytes,2,opt,name=Address,proto3" json:"Address"` + // TTL must be larger than zero, it decreased in every neofs-node + // Deprecated: will be replaced with RequestMetaHeader (see develop branch) + TTL uint32 `protobuf:"varint,3,opt,name=TTL,proto3" json:"TTL,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetRequest) Reset() { *m = GetRequest{} } @@ -257,9 +262,15 @@ func (*PutRequest) XXX_OneofWrappers() []interface{} { } type PutRequest_PutHeader struct { - Epoch uint64 `protobuf:"varint,1,opt,name=Epoch,proto3" json:"Epoch,omitempty"` - Object *Object `protobuf:"bytes,2,opt,name=Object,proto3" json:"Object,omitempty"` - TTL uint32 `protobuf:"varint,3,opt,name=TTL,proto3" json:"TTL,omitempty"` + // Epoch is set by user to 0, node set epoch to the actual value + // Deprecated: will be replaced with RequestMetaHeader (see develop branch) + Epoch uint64 `protobuf:"varint,1,opt,name=Epoch,proto3" json:"Epoch,omitempty"` + // Object with at least container id and owner id fields + Object *Object `protobuf:"bytes,2,opt,name=Object,proto3" json:"Object,omitempty"` + // TTL must be larger than zero, it decreased in every neofs-node + // Deprecated: will be replaced with RequestMetaHeader (see develop branch) + TTL uint32 `protobuf:"varint,3,opt,name=TTL,proto3" json:"TTL,omitempty"` + // Token with session public key and user's signature Token *session.Token `protobuf:"bytes,4,opt,name=Token,proto3" json:"Token,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -324,6 +335,7 @@ func (m *PutRequest_PutHeader) GetToken() *session.Token { } type PutResponse struct { + // Address of object (container id + object id) Address refs.Address `protobuf:"bytes,1,opt,name=Address,proto3" json:"Address"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -367,10 +379,17 @@ func (m *PutResponse) GetAddress() refs.Address { } type DeleteRequest struct { - Epoch uint64 `protobuf:"varint,1,opt,name=Epoch,proto3" json:"Epoch,omitempty"` - Address refs.Address `protobuf:"bytes,2,opt,name=Address,proto3" json:"Address"` - OwnerID OwnerID `protobuf:"bytes,3,opt,name=OwnerID,proto3,customtype=OwnerID" json:"OwnerID"` - TTL uint32 `protobuf:"varint,4,opt,name=TTL,proto3" json:"TTL,omitempty"` + // Epoch is set by user to 0, node set epoch to the actual value + // Deprecated: will be replaced with RequestMetaHeader (see develop branch) + Epoch uint64 `protobuf:"varint,1,opt,name=Epoch,proto3" json:"Epoch,omitempty"` + // Address of object (container id + object id) + Address refs.Address `protobuf:"bytes,2,opt,name=Address,proto3" json:"Address"` + // OwnerID is a wallet address + OwnerID OwnerID `protobuf:"bytes,3,opt,name=OwnerID,proto3,customtype=OwnerID" json:"OwnerID"` + // TTL must be larger than zero, it decreased in every neofs-node + // Deprecated: will be replaced with RequestMetaHeader (see develop branch) + TTL uint32 `protobuf:"varint,4,opt,name=TTL,proto3" json:"TTL,omitempty"` + // Token with session public key and user's signature Token *session.Token `protobuf:"bytes,5,opt,name=Token,proto3" json:"Token,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -472,9 +491,15 @@ func (m *DeleteResponse) XXX_DiscardUnknown() { var xxx_messageInfo_DeleteResponse proto.InternalMessageInfo type HeadRequest struct { - Epoch uint64 `protobuf:"varint,1,opt,name=Epoch,proto3" json:"Epoch,omitempty"` - Address Address `protobuf:"bytes,2,opt,name=Address,proto3,customtype=Address" json:"Address"` - FullHeaders bool `protobuf:"varint,3,opt,name=FullHeaders,proto3" json:"FullHeaders,omitempty"` + // Epoch should be empty on user side, node sets epoch to the actual value + // Deprecated: will be replaced with RequestMetaHeader (see develop branch) + Epoch uint64 `protobuf:"varint,1,opt,name=Epoch,proto3" json:"Epoch,omitempty"` + // Address of object (container id + object id) + Address Address `protobuf:"bytes,2,opt,name=Address,proto3,customtype=Address" json:"Address"` + // FullHeaders can be set true for extended headers in the object + FullHeaders bool `protobuf:"varint,3,opt,name=FullHeaders,proto3" json:"FullHeaders,omitempty"` + // TTL must be larger than zero, it decreased in every neofs-node + // Deprecated: will be replaced with RequestMetaHeader (see develop branch) TTL uint32 `protobuf:"varint,4,opt,name=TTL,proto3" json:"TTL,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -532,6 +557,7 @@ func (m *HeadRequest) GetTTL() uint32 { } type HeadResponse struct { + // Object without payload Object *Object `protobuf:"bytes,1,opt,name=Object,proto3" json:"Object,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -575,10 +601,17 @@ func (m *HeadResponse) GetObject() *Object { } type SearchRequest struct { - Epoch uint64 `protobuf:"varint,1,opt,name=Epoch,proto3" json:"Epoch,omitempty"` - Version uint32 `protobuf:"varint,2,opt,name=Version,proto3" json:"Version,omitempty"` - ContainerID CID `protobuf:"bytes,3,opt,name=ContainerID,proto3,customtype=CID" json:"ContainerID"` - Query []byte `protobuf:"bytes,4,opt,name=Query,proto3" json:"Query,omitempty"` + // Epoch is set by user to 0, node set epoch to the actual value + // Deprecated: will be replaced with RequestMetaHeader (see develop branch) + Epoch uint64 `protobuf:"varint,1,opt,name=Epoch,proto3" json:"Epoch,omitempty"` + // Version of search query format + Version uint32 `protobuf:"varint,2,opt,name=Version,proto3" json:"Version,omitempty"` + // ContainerID for searching the object + ContainerID CID `protobuf:"bytes,3,opt,name=ContainerID,proto3,customtype=CID" json:"ContainerID"` + // Query in the binary serialized format + Query []byte `protobuf:"bytes,4,opt,name=Query,proto3" json:"Query,omitempty"` + // TTL must be larger than zero, it decreased in every neofs-node + // Deprecated: will be replaced with RequestMetaHeader (see develop branch) TTL uint32 `protobuf:"varint,5,opt,name=TTL,proto3" json:"TTL,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -643,6 +676,7 @@ func (m *SearchRequest) GetTTL() uint32 { } type SearchResponse struct { + // Addresses of found objects Addresses []refs.Address `protobuf:"bytes,1,rep,name=Addresses,proto3" json:"Addresses"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -686,13 +720,19 @@ func (m *SearchResponse) GetAddresses() []refs.Address { } type GetRangeRequest struct { - Epoch uint64 `protobuf:"varint,1,opt,name=Epoch,proto3" json:"Epoch,omitempty"` - Address refs.Address `protobuf:"bytes,2,opt,name=Address,proto3" json:"Address"` - Ranges []Range `protobuf:"bytes,3,rep,name=Ranges,proto3" json:"Ranges"` - TTL uint32 `protobuf:"varint,4,opt,name=TTL,proto3" json:"TTL,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + // Epoch is set by user to 0, node set epoch to the actual value + // Deprecated: will be replaced with RequestMetaHeader (see develop branch) + Epoch uint64 `protobuf:"varint,1,opt,name=Epoch,proto3" json:"Epoch,omitempty"` + // Address of object (container id + object id) + Address refs.Address `protobuf:"bytes,2,opt,name=Address,proto3" json:"Address"` + // Ranges of object's payload to return + Ranges []Range `protobuf:"bytes,3,rep,name=Ranges,proto3" json:"Ranges"` + // TTL must be larger than zero, it decreased in every neofs-node + // Deprecated: will be replaced with RequestMetaHeader (see develop branch) + TTL uint32 `protobuf:"varint,4,opt,name=TTL,proto3" json:"TTL,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetRangeRequest) Reset() { *m = GetRangeRequest{} } @@ -753,6 +793,7 @@ func (m *GetRangeRequest) GetTTL() uint32 { } type GetRangeResponse struct { + // Fragments of object's payload Fragments [][]byte `protobuf:"bytes,1,rep,name=Fragments,proto3" json:"Fragments,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -796,14 +837,21 @@ func (m *GetRangeResponse) GetFragments() [][]byte { } type GetRangeHashRequest struct { - Epoch uint64 `protobuf:"varint,1,opt,name=Epoch,proto3" json:"Epoch,omitempty"` - Address refs.Address `protobuf:"bytes,2,opt,name=Address,proto3" json:"Address"` - Ranges []Range `protobuf:"bytes,3,rep,name=Ranges,proto3" json:"Ranges"` - Salt []byte `protobuf:"bytes,4,opt,name=Salt,proto3" json:"Salt,omitempty"` - TTL uint32 `protobuf:"varint,5,opt,name=TTL,proto3" json:"TTL,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + // Epoch is set by user to 0, node set epoch to the actual value + // Deprecated: will be replaced with RequestMetaHeader (see develop branch) + Epoch uint64 `protobuf:"varint,1,opt,name=Epoch,proto3" json:"Epoch,omitempty"` + // Address of object (container id + object id) + Address refs.Address `protobuf:"bytes,2,opt,name=Address,proto3" json:"Address"` + // Ranges of object's payload to calculate homomorphic hash + Ranges []Range `protobuf:"bytes,3,rep,name=Ranges,proto3" json:"Ranges"` + // Salt is used to XOR object's payload ranges before hashing, it can be nil + Salt []byte `protobuf:"bytes,4,opt,name=Salt,proto3" json:"Salt,omitempty"` + // TTL must be larger than zero, it decreased in every neofs-node + // Deprecated: will be replaced with RequestMetaHeader (see develop branch) + TTL uint32 `protobuf:"varint,5,opt,name=TTL,proto3" json:"TTL,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetRangeHashRequest) Reset() { *m = GetRangeHashRequest{} } @@ -871,6 +919,7 @@ func (m *GetRangeHashRequest) GetTTL() uint32 { } type GetRangeHashResponse struct { + // Hashes is a homomorphic hashes of all ranges Hashes []Hash `protobuf:"bytes,1,rep,name=Hashes,proto3,customtype=Hash" json:"Hashes"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` diff --git a/object/types.pb.go b/object/types.pb.go index 99b6c90..217ef09 100644 --- a/object/types.pb.go +++ b/object/types.pb.go @@ -28,11 +28,16 @@ const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package type Link_Type int32 const ( - Link_Unknown Link_Type = 0 - Link_Parent Link_Type = 1 - Link_Previous Link_Type = 2 - Link_Next Link_Type = 3 - Link_Child Link_Type = 4 + Link_Unknown Link_Type = 0 + // Parent object created during object transformation + Link_Parent Link_Type = 1 + // Previous object in the linked list created during object transformation + Link_Previous Link_Type = 2 + // Next object in the linked list created during object transformation + Link_Next Link_Type = 3 + // Child object created during object transformation + Link_Child Link_Type = 4 + // Object that included into this storage group Link_StorageGroup Link_Type = 5 ) @@ -66,9 +71,12 @@ type Transform_Type int32 const ( Transform_Unknown Transform_Type = 0 - Transform_Split Transform_Type = 1 - Transform_Sign Transform_Type = 2 - Transform_Mould Transform_Type = 3 + // Split sets when object created after payload split + Transform_Split Transform_Type = 1 + // Sign sets when object created after re-signing (doesn't used) + Transform_Sign Transform_Type = 2 + // Mould sets when object created after filling missing headers in the object + Transform_Mould Transform_Type = 3 ) var Transform_Type_name = map[int32]string{ @@ -96,9 +104,12 @@ func (Transform_Type) EnumDescriptor() ([]byte, []int) { type StorageGroup_Lifetime_Unit int32 const ( - StorageGroup_Lifetime_Unlimited StorageGroup_Lifetime_Unit = 0 + // Unlimited set if storage group always valid + StorageGroup_Lifetime_Unlimited StorageGroup_Lifetime_Unit = 0 + // NeoFSEpoch set if storage group is valid until lifetime NeoFS epoch StorageGroup_Lifetime_NeoFSEpoch StorageGroup_Lifetime_Unit = 1 - StorageGroup_Lifetime_UnixTime StorageGroup_Lifetime_Unit = 2 + // UnixTime set if storage group is valid until lifetime unix timestamp + StorageGroup_Lifetime_UnixTime StorageGroup_Lifetime_Unit = 2 ) var StorageGroup_Lifetime_Unit_name = map[int32]string{ @@ -122,7 +133,9 @@ func (StorageGroup_Lifetime_Unit) EnumDescriptor() ([]byte, []int) { } type Range struct { - Offset uint64 `protobuf:"varint,1,opt,name=Offset,proto3" json:"Offset,omitempty"` + // Offset of the data range + Offset uint64 `protobuf:"varint,1,opt,name=Offset,proto3" json:"Offset,omitempty"` + // Length of the data range Length uint64 `protobuf:"varint,2,opt,name=Length,proto3" json:"Length,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -173,7 +186,9 @@ func (m *Range) GetLength() uint64 { } type UserHeader struct { - Key string `protobuf:"bytes,1,opt,name=Key,proto3" json:"Key,omitempty"` + // Key of the user's header + Key string `protobuf:"bytes,1,opt,name=Key,proto3" json:"Key,omitempty"` + // Value of the user's header Value string `protobuf:"bytes,2,opt,name=Value,proto3" json:"Value,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -405,6 +420,7 @@ func (*Header) XXX_OneofWrappers() []interface{} { } type Tombstone struct { + // Epoch when tombstone was created Epoch uint64 `protobuf:"varint,1,opt,name=Epoch,proto3" json:"Epoch,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -448,11 +464,17 @@ func (m *Tombstone) GetEpoch() uint64 { } type SystemHeader struct { - Version uint64 `protobuf:"varint,1,opt,name=Version,proto3" json:"Version,omitempty"` - PayloadLength uint64 `protobuf:"varint,2,opt,name=PayloadLength,proto3" json:"PayloadLength,omitempty"` - ID ID `protobuf:"bytes,3,opt,name=ID,proto3,customtype=ID" json:"ID"` - OwnerID OwnerID `protobuf:"bytes,4,opt,name=OwnerID,proto3,customtype=OwnerID" json:"OwnerID"` - CID CID `protobuf:"bytes,5,opt,name=CID,proto3,customtype=CID" json:"CID"` + // Version of the object structure + Version uint64 `protobuf:"varint,1,opt,name=Version,proto3" json:"Version,omitempty"` + // PayloadLength is an object payload length + PayloadLength uint64 `protobuf:"varint,2,opt,name=PayloadLength,proto3" json:"PayloadLength,omitempty"` + // ID is an object identifier, is a valid UUIDv4 + ID ID `protobuf:"bytes,3,opt,name=ID,proto3,customtype=ID" json:"ID"` + // OwnerID is a wallet address + OwnerID OwnerID `protobuf:"bytes,4,opt,name=OwnerID,proto3,customtype=OwnerID" json:"OwnerID"` + // CID is a SHA256 hash of the container structure (container identifier) + CID CID `protobuf:"bytes,5,opt,name=CID,proto3,customtype=CID" json:"CID"` + // CreatedAt is a timestamp of object creation CreatedAt CreationPoint `protobuf:"bytes,6,opt,name=CreatedAt,proto3" json:"CreatedAt"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -510,7 +532,9 @@ func (m *SystemHeader) GetCreatedAt() CreationPoint { } type CreationPoint struct { - UnixTime int64 `protobuf:"varint,1,opt,name=UnixTime,proto3" json:"UnixTime,omitempty"` + // UnixTime is a date of creation in unixtime format + UnixTime int64 `protobuf:"varint,1,opt,name=UnixTime,proto3" json:"UnixTime,omitempty"` + // Epoch is a date of creation in NeoFS epochs Epoch uint64 `protobuf:"varint,2,opt,name=Epoch,proto3" json:"Epoch,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -561,7 +585,9 @@ func (m *CreationPoint) GetEpoch() uint64 { } type IntegrityHeader struct { - HeadersChecksum []byte `protobuf:"bytes,1,opt,name=HeadersChecksum,proto3" json:"HeadersChecksum,omitempty"` + // HeadersChecksum is a checksum of all above headers in the object + HeadersChecksum []byte `protobuf:"bytes,1,opt,name=HeadersChecksum,proto3" json:"HeadersChecksum,omitempty"` + // ChecksumSignature is an user's signature of checksum to verify if it is correct ChecksumSignature []byte `protobuf:"bytes,2,opt,name=ChecksumSignature,proto3" json:"ChecksumSignature,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -612,11 +638,13 @@ func (m *IntegrityHeader) GetChecksumSignature() []byte { } type Link struct { - Type Link_Type `protobuf:"varint,1,opt,name=type,proto3,enum=object.Link_Type" json:"type,omitempty"` - ID ID `protobuf:"bytes,2,opt,name=ID,proto3,customtype=ID" json:"ID"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + // Type of link + Type Link_Type `protobuf:"varint,1,opt,name=type,proto3,enum=object.Link_Type" json:"type,omitempty"` + // ID is an object identifier, is a valid UUIDv4 + ID ID `protobuf:"bytes,2,opt,name=ID,proto3,customtype=ID" json:"ID"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *Link) Reset() { *m = Link{} } @@ -656,6 +684,7 @@ func (m *Link) GetType() Link_Type { } type Transform struct { + // Type of object transformation Type Transform_Type `protobuf:"varint,1,opt,name=type,proto3,enum=object.Transform_Type" json:"type,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -699,12 +728,15 @@ func (m *Transform) GetType() Transform_Type { } type Object struct { - SystemHeader SystemHeader `protobuf:"bytes,1,opt,name=SystemHeader,proto3" json:"SystemHeader"` - Headers []Header `protobuf:"bytes,2,rep,name=Headers,proto3" json:"Headers"` - Payload []byte `protobuf:"bytes,3,opt,name=Payload,proto3" json:"Payload,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + // SystemHeader describes system header + SystemHeader SystemHeader `protobuf:"bytes,1,opt,name=SystemHeader,proto3" json:"SystemHeader"` + // Headers describes a set of an extended headers + Headers []Header `protobuf:"bytes,2,rep,name=Headers,proto3" json:"Headers"` + // Payload is an object's payload + Payload []byte `protobuf:"bytes,3,opt,name=Payload,proto3" json:"Payload,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *Object) Reset() { *m = Object{} } @@ -758,8 +790,11 @@ func (m *Object) GetPayload() []byte { } type StorageGroup struct { - ValidationDataSize uint64 `protobuf:"varint,1,opt,name=ValidationDataSize,proto3" json:"ValidationDataSize,omitempty"` - ValidationHash Hash `protobuf:"bytes,2,opt,name=ValidationHash,proto3,customtype=Hash" json:"ValidationHash"` + // ValidationDataSize is size of the all object's payloads included into storage group + ValidationDataSize uint64 `protobuf:"varint,1,opt,name=ValidationDataSize,proto3" json:"ValidationDataSize,omitempty"` + // ValidationHash is homomorphic hash of all object's payloads included into storage group + ValidationHash Hash `protobuf:"bytes,2,opt,name=ValidationHash,proto3,customtype=Hash" json:"ValidationHash"` + // Lifetime is time until storage group is valid Lifetime *StorageGroup_Lifetime `protobuf:"bytes,3,opt,name=lifetime,proto3" json:"lifetime,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -810,11 +845,13 @@ func (m *StorageGroup) GetLifetime() *StorageGroup_Lifetime { } type StorageGroup_Lifetime struct { - Unit StorageGroup_Lifetime_Unit `protobuf:"varint,1,opt,name=unit,proto3,enum=object.StorageGroup_Lifetime_Unit" json:"unit,omitempty"` - Value int64 `protobuf:"varint,2,opt,name=Value,proto3" json:"Value,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + // Unit is lifetime type + Unit StorageGroup_Lifetime_Unit `protobuf:"varint,1,opt,name=unit,proto3,enum=object.StorageGroup_Lifetime_Unit" json:"unit,omitempty"` + // Value for lifetime + Value int64 `protobuf:"varint,2,opt,name=Value,proto3" json:"Value,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *StorageGroup_Lifetime) Reset() { *m = StorageGroup_Lifetime{} } diff --git a/query/types.pb.go b/query/types.pb.go index 8fa3dbe..7223bf8 100644 --- a/query/types.pb.go +++ b/query/types.pb.go @@ -23,11 +23,12 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package -// Type can be Exact or Regex type Filter_Type int32 const ( + // Exact sets when value of filter should be equal to the header value Filter_Exact Filter_Type = 0 + // Regex sets when value of filter should match the header value by the regular expression Filter_Regex Filter_Type = 1 ) diff --git a/refs/types.pb.go b/refs/types.pb.go index 87f3fce..2ccde2f 100644 --- a/refs/types.pb.go +++ b/refs/types.pb.go @@ -25,7 +25,7 @@ const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package // Address of object (container id + object id) type Address struct { - // ObjectID is an object identifier + // ObjectID is an object identifier, valid UUIDv4 represented in bytes ObjectID ObjectID `protobuf:"bytes,1,opt,name=ObjectID,proto3,customtype=ObjectID" json:"ObjectID"` // CID is container identifier CID CID `protobuf:"bytes,2,opt,name=CID,proto3,customtype=CID" json:"CID"` diff --git a/session/service.pb.go b/session/service.pb.go index 4961b0d..b99b611 100644 --- a/session/service.pb.go +++ b/session/service.pb.go @@ -238,6 +238,16 @@ const _ = grpc.SupportPackageIsVersion4 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type SessionClient interface { + // Create is a method that used to open a trusted session to manipulate + // an object. In order to put or delete object client have to obtain session + // token with trusted node. Trusted node will modify client's object + // (add missing headers, checksums, homomorphic hash) and sign id with + // session key. Session is established during 4-step handshake in one gRPC stream + // + // - First client stream message SHOULD BE type of `CreateRequest_Init`. + // - First server stream message SHOULD BE type of `CreateResponse_Unsigned`. + // - Second client stream message SHOULD BE type of `CreateRequest_Signed`. + // - Second server stream message SHOULD BE type of `CreateResponse_Result`. Create(ctx context.Context, opts ...grpc.CallOption) (Session_CreateClient, error) } @@ -282,6 +292,16 @@ func (x *sessionCreateClient) Recv() (*CreateResponse, error) { // SessionServer is the server API for Session service. type SessionServer interface { + // Create is a method that used to open a trusted session to manipulate + // an object. In order to put or delete object client have to obtain session + // token with trusted node. Trusted node will modify client's object + // (add missing headers, checksums, homomorphic hash) and sign id with + // session key. Session is established during 4-step handshake in one gRPC stream + // + // - First client stream message SHOULD BE type of `CreateRequest_Init`. + // - First server stream message SHOULD BE type of `CreateResponse_Unsigned`. + // - Second client stream message SHOULD BE type of `CreateRequest_Signed`. + // - Second server stream message SHOULD BE type of `CreateResponse_Result`. Create(Session_CreateServer) error } diff --git a/session/types.pb.go b/session/types.pb.go index d39961e..f597612 100644 --- a/session/types.pb.go +++ b/session/types.pb.go @@ -24,9 +24,9 @@ var _ = math.Inf const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package type VerificationHeader struct { - // Session public key + // PublicKey is a session public key PublicKey []byte `protobuf:"bytes,1,opt,name=PublicKey,proto3" json:"PublicKey,omitempty"` - // Session public key signature. Signed by trusted side + // KeySignature is a session public key signature. Signed by trusted side KeySignature []byte `protobuf:"bytes,2,opt,name=KeySignature,proto3" json:"KeySignature,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -80,17 +80,17 @@ func (m *VerificationHeader) GetKeySignature() []byte { type Token struct { // Header carries verification data of session key Header VerificationHeader `protobuf:"bytes,1,opt,name=Header,proto3" json:"Header"` - // Owner of manipulation object + // OwnerID is an owner of manipulation object OwnerID OwnerID `protobuf:"bytes,2,opt,name=OwnerID,proto3,customtype=OwnerID" json:"OwnerID"` - // Initial epoch of token lifetime + // FirstEpoch is an initial epoch of token lifetime FirstEpoch uint64 `protobuf:"varint,3,opt,name=FirstEpoch,proto3" json:"FirstEpoch,omitempty"` - // Last epoch of token lifetime + // LastEpoch is a last epoch of token lifetime LastEpoch uint64 `protobuf:"varint,4,opt,name=LastEpoch,proto3" json:"LastEpoch,omitempty"` - // ID of manipulation object + // ObjectID is an object identifier of manipulation object ObjectID []ObjectID `protobuf:"bytes,5,rep,name=ObjectID,proto3,customtype=ObjectID" json:"ObjectID"` - // Token signature. Signed by owner of manipulation object + // Signature is a token signature, signed by owner of manipulation object Signature []byte `protobuf:"bytes,6,opt,name=Signature,proto3" json:"Signature,omitempty"` - // Token ID (UUID) + // ID is a token identifier. valid UUIDv4 represented in bytes ID TokenID `protobuf:"bytes,7,opt,name=ID,proto3,customtype=TokenID" json:"ID"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` From 27a129c79523571fb2f6302aa58298b244804e02 Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Thu, 21 Nov 2019 10:35:17 +0300 Subject: [PATCH 0018/1196] docs: regenerate proto documentation --- docs/accounting.md | 14 ++++---- docs/bootstrap.md | 2 +- docs/container.md | 8 ++--- docs/object.md | 84 +++++++++++++++++++++++----------------------- docs/query.md | 6 ++-- docs/refs.md | 2 +- docs/session.md | 35 ++++++++++--------- 7 files changed, 78 insertions(+), 73 deletions(-) diff --git a/docs/accounting.md b/docs/accounting.md index f08bd52..b4317ae 100644 --- a/docs/accounting.md +++ b/docs/accounting.md @@ -87,7 +87,7 @@ Balance returns current balance status of the NeoFS user | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | | OwnerID | [bytes](#bytes) | | OwnerID is a wallet address | -| TTL | [uint32](#uint32) | | TTL must be larger than zero, it decreased in every neofs-node | +| TTL | [uint32](#uint32) | | TTL must be larger than zero, it decreased in every neofs-node Deprecated: will be replaced with RequestMetaHeader (see develop branch) | @@ -362,7 +362,7 @@ Delete allows user to remove unused cheque | OwnerID | [bytes](#bytes) | | OwnerID is a wallet address | | MessageID | [bytes](#bytes) | | MessageID is a nonce for uniq request (UUIDv4) | | Signature | [bytes](#bytes) | | Signature is a signature of the sent request | -| TTL | [uint32](#uint32) | | TTL must be larger than zero, it decreased in every neofs-node | +| TTL | [uint32](#uint32) | | TTL must be larger than zero, it decreased in every neofs-node Deprecated: will be replaced with RequestMetaHeader (see develop branch) | @@ -382,7 +382,7 @@ DeleteResponse is empty | ----- | ---- | ----- | ----------- | | ID | [bytes](#bytes) | | ID is cheque identifier | | OwnerID | [bytes](#bytes) | | OwnerID is a wallet address | -| TTL | [uint32](#uint32) | | TTL must be larger than zero, it decreased in every neofs-node | +| TTL | [uint32](#uint32) | | TTL must be larger than zero, it decreased in every neofs-node Deprecated: will be replaced with RequestMetaHeader (see develop branch) | @@ -393,7 +393,7 @@ DeleteResponse is empty | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| Withdraw | [Item](#accounting.Item) | | Item is cheque with meta information | +| Withdraw | [Item](#accounting.Item) | | Withdraw is cheque with meta information | @@ -420,7 +420,7 @@ DeleteResponse is empty | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | | OwnerID | [bytes](#bytes) | | OwnerID is a wallet address | -| TTL | [uint32](#uint32) | | TTL must be larger than zero, it decreased in every neofs-node | +| TTL | [uint32](#uint32) | | TTL must be larger than zero, it decreased in every neofs-node Deprecated: will be replaced with RequestMetaHeader (see develop branch) | @@ -431,7 +431,7 @@ DeleteResponse is empty | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| Items | [Item](#accounting.Item) | repeated | Item is a set of cheques with meta information | +| Items | [Item](#accounting.Item) | repeated | Items is a set of cheques with meta information | @@ -447,7 +447,7 @@ DeleteResponse is empty | Height | [uint64](#uint64) | | Height is the neo blockchain height until the cheque is valid | | MessageID | [bytes](#bytes) | | MessageID is a nonce for uniq request (UUIDv4) | | Signature | [bytes](#bytes) | | Signature is a signature of the sent request | -| TTL | [uint32](#uint32) | | TTL must be larger than zero, it decreased in every neofs-node | +| TTL | [uint32](#uint32) | | TTL must be larger than zero, it decreased in every neofs-node Deprecated: will be replaced with RequestMetaHeader (see develop branch) | diff --git a/docs/bootstrap.md b/docs/bootstrap.md index dfada2c..19967bf 100644 --- a/docs/bootstrap.md +++ b/docs/bootstrap.md @@ -62,7 +62,7 @@ Process is method that allows to register node in the network and receive actual | ----- | ---- | ----- | ----------- | | type | [int32](#int32) | | Type is NodeType, can be InnerRingNode (type=1) or StorageNode (type=2) | | info | [NodeInfo](#bootstrap.NodeInfo) | | Info contains information about node | -| TTL | [uint32](#uint32) | | TTL must be larger than zero, it decreased in every neofs-node | +| TTL | [uint32](#uint32) | | TTL must be larger than zero, it decreased in every neofs-node Deprecated: will be replaced with RequestMetaHeader (see develop branch) | diff --git a/docs/container.md b/docs/container.md index 5ff0d89..4f98a47 100644 --- a/docs/container.md +++ b/docs/container.md @@ -92,7 +92,7 @@ List returns all user's containers | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | | CID | [bytes](#bytes) | | CID (container id) is a SHA256 hash of the container structure | -| TTL | [uint32](#uint32) | | TTL must be larger than zero, it decreased in every neofs-node | +| TTL | [uint32](#uint32) | | TTL must be larger than zero, it decreased in every neofs-node Deprecated: will be replaced with RequestMetaHeader (see develop branch) | | Signature | [bytes](#bytes) | | Signature of the container owner | @@ -113,7 +113,7 @@ via consensus in inner ring nodes | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | | CID | [bytes](#bytes) | | CID (container id) is a SHA256 hash of the container structure | -| TTL | [uint32](#uint32) | | TTL must be larger than zero, it decreased in every neofs-node | +| TTL | [uint32](#uint32) | | TTL must be larger than zero, it decreased in every neofs-node Deprecated: will be replaced with RequestMetaHeader (see develop branch) | @@ -136,7 +136,7 @@ via consensus in inner ring nodes | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | | OwnerID | [bytes](#bytes) | | OwnerID is a wallet address | -| TTL | [uint32](#uint32) | | TTL must be larger than zero, it decreased in every neofs-node | +| TTL | [uint32](#uint32) | | TTL must be larger than zero, it decreased in every neofs-node Deprecated: will be replaced with RequestMetaHeader (see develop branch) | @@ -163,7 +163,7 @@ via consensus in inner ring nodes | OwnerID | [bytes](#bytes) | | OwnerID is a wallet address | | rules | [netmap.PlacementRule](#netmap.PlacementRule) | | Rules define storage policy for the object inside the container. | | Signature | [bytes](#bytes) | | Signature of the user (owner id) | -| TTL | [uint32](#uint32) | | TTL must be larger than zero, it decreased in every neofs-node | +| TTL | [uint32](#uint32) | | TTL must be larger than zero, it decreased in every neofs-node Deprecated: will be replaced with RequestMetaHeader (see develop branch) | diff --git a/docs/object.md b/docs/object.md index 5ba1845..03e41c8 100644 --- a/docs/object.md +++ b/docs/object.md @@ -147,10 +147,10 @@ calculated for XORed data. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| Epoch | [uint64](#uint64) | | Epoch is set by user to 0, node set epoch to the actual value | +| Epoch | [uint64](#uint64) | | Epoch is set by user to 0, node set epoch to the actual value Deprecated: will be replaced with RequestMetaHeader (see develop branch) | | Address | [refs.Address](#refs.Address) | | Address of object (container id + object id) | | OwnerID | [bytes](#bytes) | | OwnerID is a wallet address | -| TTL | [uint32](#uint32) | | TTL must be larger than zero, it decreased in every neofs-node | +| TTL | [uint32](#uint32) | | TTL must be larger than zero, it decreased in every neofs-node Deprecated: will be replaced with RequestMetaHeader (see develop branch) | | Token | [session.Token](#session.Token) | | Token with session public key and user's signature | @@ -170,11 +170,11 @@ in distributed system. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| Epoch | [uint64](#uint64) | | Epoch is set by user to 0, node set epoch to the actual value | +| Epoch | [uint64](#uint64) | | Epoch is set by user to 0, node set epoch to the actual value Deprecated: will be replaced with RequestMetaHeader (see develop branch) | | Address | [refs.Address](#refs.Address) | | Address of object (container id + object id) | | Ranges | [Range](#object.Range) | repeated | Ranges of object's payload to calculate homomorphic hash | | Salt | [bytes](#bytes) | | Salt is used to XOR object's payload ranges before hashing, it can be nil | -| TTL | [uint32](#uint32) | | TTL must be larger than zero, it decreased in every neofs-node | +| TTL | [uint32](#uint32) | | TTL must be larger than zero, it decreased in every neofs-node Deprecated: will be replaced with RequestMetaHeader (see develop branch) | @@ -185,7 +185,7 @@ in distributed system. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| Hashes | [bytes](#bytes) | repeated | Homomorphic hashes of all ranges | +| Hashes | [bytes](#bytes) | repeated | Hashes is a homomorphic hashes of all ranges | @@ -196,10 +196,10 @@ in distributed system. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| Epoch | [uint64](#uint64) | | Epoch is set by user to 0, node set epoch to the actual value | +| Epoch | [uint64](#uint64) | | Epoch is set by user to 0, node set epoch to the actual value Deprecated: will be replaced with RequestMetaHeader (see develop branch) | | Address | [refs.Address](#refs.Address) | | Address of object (container id + object id) | | Ranges | [Range](#object.Range) | repeated | Ranges of object's payload to return | -| TTL | [uint32](#uint32) | | TTL must be larger than zero, it decreased in every neofs-node | +| TTL | [uint32](#uint32) | | TTL must be larger than zero, it decreased in every neofs-node Deprecated: will be replaced with RequestMetaHeader (see develop branch) | @@ -221,9 +221,9 @@ in distributed system. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| Epoch | [uint64](#uint64) | | Epoch is set by user to 0, node set epoch to the actual value | +| Epoch | [uint64](#uint64) | | Epoch is set by user to 0, node set epoch to the actual value Deprecated: will be replaced with RequestMetaHeader (see develop branch) | | Address | [refs.Address](#refs.Address) | | Address of object (container id + object id) | -| TTL | [uint32](#uint32) | | TTL must be larger than zero, it decreased in every neofs-node | +| TTL | [uint32](#uint32) | | TTL must be larger than zero, it decreased in every neofs-node Deprecated: will be replaced with RequestMetaHeader (see develop branch) | @@ -246,10 +246,10 @@ in distributed system. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| Epoch | [uint64](#uint64) | | Epoch is set by user to 0, node set epoch to the actual value | +| Epoch | [uint64](#uint64) | | Epoch should be empty on user side, node sets epoch to the actual value Deprecated: will be replaced with RequestMetaHeader (see develop branch) | | Address | [refs.Address](#refs.Address) | | Address of object (container id + object id) | | FullHeaders | [bool](#bool) | | FullHeaders can be set true for extended headers in the object | -| TTL | [uint32](#uint32) | | TTL must be larger than zero, it decreased in every neofs-node | +| TTL | [uint32](#uint32) | | TTL must be larger than zero, it decreased in every neofs-node Deprecated: will be replaced with RequestMetaHeader (see develop branch) | @@ -283,9 +283,9 @@ in distributed system. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| Epoch | [uint64](#uint64) | | Epoch is set by user to 0, node set epoch to the actual value | +| Epoch | [uint64](#uint64) | | Epoch is set by user to 0, node set epoch to the actual value Deprecated: will be replaced with RequestMetaHeader (see develop branch) | | Object | [Object](#object.Object) | | Object with at least container id and owner id fields | -| TTL | [uint32](#uint32) | | TTL must be larger than zero, it decreased in every neofs-node | +| TTL | [uint32](#uint32) | | TTL must be larger than zero, it decreased in every neofs-node Deprecated: will be replaced with RequestMetaHeader (see develop branch) | | Token | [session.Token](#session.Token) | | Token with session public key and user's signature | @@ -308,11 +308,11 @@ in distributed system. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| Epoch | [uint64](#uint64) | | Epoch is set by user to 0, node set epoch to the actual value | +| Epoch | [uint64](#uint64) | | Epoch is set by user to 0, node set epoch to the actual value Deprecated: will be replaced with RequestMetaHeader (see develop branch) | | Version | [uint32](#uint32) | | Version of search query format | | ContainerID | [bytes](#bytes) | | ContainerID for searching the object | | Query | [bytes](#bytes) | | Query in the binary serialized format | -| TTL | [uint32](#uint32) | | TTL must be larger than zero, it decreased in every neofs-node | +| TTL | [uint32](#uint32) | | TTL must be larger than zero, it decreased in every neofs-node Deprecated: will be replaced with RequestMetaHeader (see develop branch) | @@ -348,8 +348,8 @@ in distributed system. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| UnixTime | [int64](#int64) | | Date of creation in unixtime format | -| Epoch | [uint64](#uint64) | | Date of creation in NeoFS epochs | +| UnixTime | [int64](#int64) | | UnixTime is a date of creation in unixtime format | +| Epoch | [uint64](#uint64) | | Epoch is a date of creation in NeoFS epochs | @@ -361,12 +361,12 @@ in distributed system. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | | Link | [Link](#object.Link) | | Link to other objects | -| Redirect | [refs.Address](#refs.Address) | | RedirectNot used yet | -| UserHeader | [UserHeader](#object.UserHeader) | | UserHeader defined by user | +| Redirect | [refs.Address](#refs.Address) | | Redirect not used yet | +| UserHeader | [UserHeader](#object.UserHeader) | | UserHeader is a set of KV headers defined by user | | Transform | [Transform](#object.Transform) | | Transform defines transform operation (e.g. payload split) | | Tombstone | [Tombstone](#object.Tombstone) | | Tombstone header that set up in deleted objects | | Verify | [session.VerificationHeader](#session.VerificationHeader) | | Verify header that contains session public key and user's signature | -| HomoHash | [bytes](#bytes) | | Homomorphic hash of original object payload | +| HomoHash | [bytes](#bytes) | | HomoHash is a homomorphic hash of original object payload | | PayloadChecksum | [bytes](#bytes) | | PayloadChecksum of actual object's payload | | Integrity | [IntegrityHeader](#object.IntegrityHeader) | | Integrity header with checksum of all above headers in the object | | StorageGroup | [StorageGroup](#object.StorageGroup) | | StorageGroup contains meta information for the data audit | @@ -380,8 +380,8 @@ in distributed system. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| HeadersChecksum | [bytes](#bytes) | | Checksum of all above headers in the object | -| ChecksumSignature | [bytes](#bytes) | | User's signature of checksum to verify if it is correct | +| HeadersChecksum | [bytes](#bytes) | | HeadersChecksum is a checksum of all above headers in the object | +| ChecksumSignature | [bytes](#bytes) | | ChecksumSignature is an user's signature of checksum to verify if it is correct | @@ -392,8 +392,8 @@ in distributed system. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| type | [Link.Type](#object.Link.Type) | | Link type | -| ID | [bytes](#bytes) | | Object id | +| type | [Link.Type](#object.Link.Type) | | Type of link | +| ID | [bytes](#bytes) | | ID is an object identifier, is a valid UUIDv4 | @@ -404,9 +404,9 @@ in distributed system. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| SystemHeader | [SystemHeader](#object.SystemHeader) | | System header | -| Headers | [Header](#object.Header) | repeated | Extended headers | -| Payload | [bytes](#bytes) | | Object's payload | +| SystemHeader | [SystemHeader](#object.SystemHeader) | | SystemHeader describes system header | +| Headers | [Header](#object.Header) | repeated | Headers describes a set of an extended headers | +| Payload | [bytes](#bytes) | | Payload is an object's payload | @@ -429,9 +429,9 @@ in distributed system. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| ValidationDataSize | [uint64](#uint64) | | Size of the all object's payloads included into storage group | -| ValidationHash | [bytes](#bytes) | | Homomorphic hash of all object's payloads included into storage group | -| lifetime | [StorageGroup.Lifetime](#object.StorageGroup.Lifetime) | | Time until storage group is valid | +| ValidationDataSize | [uint64](#uint64) | | ValidationDataSize is size of the all object's payloads included into storage group | +| ValidationHash | [bytes](#bytes) | | ValidationHash is homomorphic hash of all object's payloads included into storage group | +| lifetime | [StorageGroup.Lifetime](#object.StorageGroup.Lifetime) | | Lifetime is time until storage group is valid | @@ -442,8 +442,8 @@ in distributed system. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| unit | [StorageGroup.Lifetime.Unit](#object.StorageGroup.Lifetime.Unit) | | Lifetime type | -| Value | [int64](#int64) | | Lifetime value | +| unit | [StorageGroup.Lifetime.Unit](#object.StorageGroup.Lifetime.Unit) | | Unit is lifetime type | +| Value | [int64](#int64) | | Value for lifetime | @@ -455,11 +455,11 @@ in distributed system. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | | Version | [uint64](#uint64) | | Version of the object structure | -| PayloadLength | [uint64](#uint64) | | Object payload length | -| ID | [bytes](#bytes) | | ObjectID is a UUID | +| PayloadLength | [uint64](#uint64) | | PayloadLength is an object payload length | +| ID | [bytes](#bytes) | | ID is an object identifier, is a valid UUIDv4 | | OwnerID | [bytes](#bytes) | | OwnerID is a wallet address | -| CID | [bytes](#bytes) | | ContainerID is a SHA256 hash of the container structure | -| CreatedAt | [CreationPoint](#object.CreationPoint) | | Timestamp of object creation | +| CID | [bytes](#bytes) | | CID is a SHA256 hash of the container structure (container identifier) | +| CreatedAt | [CreationPoint](#object.CreationPoint) | | CreatedAt is a timestamp of object creation | @@ -521,9 +521,9 @@ in distributed system. | Name | Number | Description | | ---- | ------ | ----------- | -| Unlimited | 0 | Storage group always valid | -| NeoFSEpoch | 1 | Storage group is valid until lifetime NeoFS epoch | -| UnixTime | 2 | Storage group is valid until lifetime unix timestamp | +| Unlimited | 0 | Unlimited set if storage group always valid | +| NeoFSEpoch | 1 | NeoFSEpoch set if storage group is valid until lifetime NeoFS epoch | +| UnixTime | 2 | UnixTime set if storage group is valid until lifetime unix timestamp | @@ -535,9 +535,9 @@ in distributed system. | Name | Number | Description | | ---- | ------ | ----------- | | Unknown | 0 | | -| Split | 1 | Object created after payload split | -| Sign | 2 | Object created after re-signing (doesn't used) | -| Mould | 3 | Object created after filling missing headers in the object | +| Split | 1 | Split sets when object created after payload split | +| Sign | 2 | Sign sets when object created after re-signing (doesn't used) | +| Mould | 3 | Mould sets when object created after filling missing headers in the object | diff --git a/docs/query.md b/docs/query.md index 9deb2c1..c014c6c 100644 --- a/docs/query.md +++ b/docs/query.md @@ -52,12 +52,12 @@ ### Filter.Type -Type can be Exact or Regex + | Name | Number | Description | | ---- | ------ | ----------- | -| Exact | 0 | | -| Regex | 1 | | +| Exact | 0 | Exact sets when value of filter should be equal to the header value | +| Regex | 1 | Regex sets when value of filter should match the header value by the regular expression | diff --git a/docs/refs.md b/docs/refs.md index c3051ab..b808482 100644 --- a/docs/refs.md +++ b/docs/refs.md @@ -30,7 +30,7 @@ Address of object (container id + object id) | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| ObjectID | [bytes](#bytes) | | ObjectID is an object identifier | +| ObjectID | [bytes](#bytes) | | ObjectID is an object identifier, valid UUIDv4 represented in bytes | | CID | [bytes](#bytes) | | CID is container identifier | diff --git a/docs/session.md b/docs/session.md index 8ea703e..cf4a1fd 100644 --- a/docs/session.md +++ b/docs/session.md @@ -34,11 +34,7 @@ ### Service "session.Session" -Open a trusted session to manipulate an object. In order to put or -delete object client have to obtain session token with trusted node. -Trusted node will modify client's object (add missing headers, checksums, -homomorphic hash) and sign id with session key. Session is established -during 4-step handshake in one gRPC stream + ``` rpc Create(stream CreateRequest) returns (stream CreateResponse); @@ -47,7 +43,16 @@ rpc Create(stream CreateRequest) returns (stream CreateResponse); #### Method Create +Create is a method that used to open a trusted session to manipulate +an object. In order to put or delete object client have to obtain session +token with trusted node. Trusted node will modify client's object +(add missing headers, checksums, homomorphic hash) and sign id with +session key. Session is established during 4-step handshake in one gRPC stream +- First client stream message SHOULD BE type of `CreateRequest_Init`. +- First server stream message SHOULD BE type of `CreateResponse_Unsigned`. +- Second client stream message SHOULD BE type of `CreateRequest_Signed`. +- Second server stream message SHOULD BE type of `CreateResponse_Result`. | Name | Input | Output | | ---- | ----- | ------ | @@ -63,7 +68,7 @@ rpc Create(stream CreateRequest) returns (stream CreateResponse); | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| Init | [Token](#session.Token) | | Message to init session opening. Carry: owner of manipulation object; ID of manipulation object; token lifetime bounds. | +| Init | [Token](#session.Token) | | Init is a message to initialize session opening. Carry: owner of manipulation object; ID of manipulation object; token lifetime bounds. | | Signed | [Token](#session.Token) | | Signed Init message response (Unsigned) from server with user private key | @@ -76,7 +81,7 @@ rpc Create(stream CreateRequest) returns (stream CreateResponse); | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | | Unsigned | [Token](#session.Token) | | Unsigned token with token ID and session public key generated on server side | -| Result | [Token](#session.Token) | | Resulting token which can be used for object placing through an trusted intermediary | +| Result | [Token](#session.Token) | | Result is a resulting token which can be used for object placing through an trusted intermediary | @@ -102,12 +107,12 @@ User token granting rights for object manipulation | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | | Header | [VerificationHeader](#session.VerificationHeader) | | Header carries verification data of session key | -| OwnerID | [bytes](#bytes) | | Owner of manipulation object | -| FirstEpoch | [uint64](#uint64) | | Initial epoch of token lifetime | -| LastEpoch | [uint64](#uint64) | | Last epoch of token lifetime | -| ObjectID | [bytes](#bytes) | repeated | ID of manipulation object | -| Signature | [bytes](#bytes) | | Token signature. Signed by owner of manipulation object | -| ID | [bytes](#bytes) | | Token ID (UUID) | +| OwnerID | [bytes](#bytes) | | OwnerID is an owner of manipulation object | +| FirstEpoch | [uint64](#uint64) | | FirstEpoch is an initial epoch of token lifetime | +| LastEpoch | [uint64](#uint64) | | LastEpoch is a last epoch of token lifetime | +| ObjectID | [bytes](#bytes) | repeated | ObjectID is an object identifier of manipulation object | +| Signature | [bytes](#bytes) | | Signature is a token signature, signed by owner of manipulation object | +| ID | [bytes](#bytes) | | ID is a token identifier. valid UUIDv4 represented in bytes | @@ -118,8 +123,8 @@ User token granting rights for object manipulation | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| PublicKey | [bytes](#bytes) | | Session public key | -| KeySignature | [bytes](#bytes) | | Session public key signature. Signed by trusted side | +| PublicKey | [bytes](#bytes) | | PublicKey is a session public key | +| KeySignature | [bytes](#bytes) | | KeySignature is a session public key signature. Signed by trusted side | From 67ccd83579c48739270eafa6995d7864d7f80eae Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Thu, 21 Nov 2019 12:50:27 +0300 Subject: [PATCH 0019/1196] ci: integrate GitHub Actions --- .github/workflows/go.yml | 41 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 .github/workflows/go.yml diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml new file mode 100644 index 0000000..de59f36 --- /dev/null +++ b/.github/workflows/go.yml @@ -0,0 +1,41 @@ +name: Go +on: [push] +jobs: + + test: + name: test + runs-on: ubuntu-latest + strategy: + matrix: + go: [ '1.11.x', '1.12.x', '1.13.x'] + steps: + + - name: Setup go + uses: actions/setup-go@v1 + with: + go-version: ${{ matrix.go }} + + - name: Check out code into the Go module directory + uses: actions/checkout@v1 + + - name: Set GOPATH + # temporary fix + # see https://github.com/actions/setup-go/issues/14 + run: | + echo "##[set-env name=GOPATH;]$(dirname $GITHUB_WORKSPACE)" + echo "##[add-path]$(dirname $GITHUB_WORKSPACE)/bin" + shell: bash + + - name: Get dependencies + run: | + go get -u -v golang.org/x/lint/golint + go mod tidy -v + + - name: Linter + run: golint -set_exit_status ./... + + - name: Tests + run: go test -coverprofile=coverage.txt -covermode=atomic ./... + + - name: Codecov + run: bash <(curl -s https://codecov.io/bash) From a6c563e039919ec7947651fcb920fb0c17f24e7c Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Thu, 21 Nov 2019 12:34:18 +0300 Subject: [PATCH 0020/1196] linter: remove unused --- proto.go | 7 ------- 1 file changed, 7 deletions(-) delete mode 100644 proto.go diff --git a/proto.go b/proto.go deleted file mode 100644 index b15f22a..0000000 --- a/proto.go +++ /dev/null @@ -1,7 +0,0 @@ -package neofs_proto // import "github.com/nspcc-dev/neofs-proto" - -import ( - _ "github.com/gogo/protobuf/gogoproto" - _ "github.com/gogo/protobuf/proto" - _ "github.com/golang/protobuf/proto" -) From 165dc9abd7fa6e64b73ce526811bd7b21886f53e Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Thu, 21 Nov 2019 12:34:54 +0300 Subject: [PATCH 0021/1196] linter: fix doc comments issues --- container/service.go | 2 +- container/types.go | 2 +- session/types.go | 5 ++--- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/container/service.go b/container/service.go index 527377a..27f39e7 100644 --- a/container/service.go +++ b/container/service.go @@ -15,7 +15,7 @@ type ( UUID = refs.UUID // OwnerID type alias. OwnerID = refs.OwnerID - // OwnerID type alias. + // MessageID type alias. MessageID = refs.MessageID ) diff --git a/container/types.go b/container/types.go index 1ffcafe..9269f30 100644 --- a/container/types.go +++ b/container/types.go @@ -68,8 +68,8 @@ func (m *Container) Empty() bool { } // -- Test container definition -- // + // NewTestContainer returns test container. -// // WARNING: DON'T USE THIS OUTSIDE TESTS. func NewTestContainer() (*Container, error) { key := test.DecodeKey(0) diff --git a/session/types.go b/session/types.go index ceb2944..aff7cca 100644 --- a/session/types.go +++ b/session/types.go @@ -124,7 +124,7 @@ func (m *Token) Verify(keys ...*ecdsa.PublicKey) bool { return false } -// Sign adds token signatures. +// AddSignatures adds token signatures. func (t *PToken) AddSignatures(signH, signT []byte) { t.mtx.Lock() @@ -139,8 +139,7 @@ func (t *PToken) SignData(data []byte) ([]byte, error) { return crypto.Sign(t.PrivateKey, data) } -// VerifyData checks if signature of data by token t -// is equal to sign. +// VerifyData checks if signature of data by token is equal to sign. func (m *VerificationHeader) VerifyData(data, sign []byte) error { if crypto.Verify(crypto.UnmarshalPublicKey(m.PublicKey), data, sign) != nil { return ErrInvalidSignature From 24e5497b1d117e44930dba1c9910935132aab284 Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Mon, 18 Nov 2019 19:22:08 +0300 Subject: [PATCH 0022/1196] Update develop branch --- Makefile | 2 +- accounting/service.go | 3 - accounting/service.pb.go | 158 +++-- accounting/service.proto | 11 +- accounting/withdraw.go | 12 - accounting/withdraw.pb.go | 521 +++++++++++---- accounting/withdraw.proto | 54 +- bootstrap/service.go | 3 - bootstrap/service.pb.go | 154 +++-- bootstrap/service.proto | 13 +- container/service.go | 12 - container/service.pb.go | 551 +++++++++++----- container/service.proto | 51 +- object/service.go | 51 +- object/service.pb.go | 1283 +++++++++++++++++++++---------------- object/service.proto | 105 ++- object/utils.go | 14 +- service/meta.go | 90 +++ service/meta.pb.go | 346 ++++++++++ service/meta.proto | 12 + service/meta_test.go | 70 ++ service/role_test.go | 3 +- service/ttl.go | 45 -- service/ttl_test.go | 72 --- service/verify.go | 179 ++++++ service/verify.pb.go | 813 +++++++++++++++++++++++ service/verify.proto | 20 + service/verify_test.go | 106 +++ service/verify_test.pb.go | 518 +++++++++++++++ service/verify_test.proto | 17 + session/service.pb.go | 148 ++++- session/service.proto | 4 + state/service.pb.go | 355 +++++++++- state/service.proto | 17 +- 34 files changed, 4503 insertions(+), 1310 deletions(-) create mode 100644 service/meta.go create mode 100644 service/meta.pb.go create mode 100644 service/meta.proto create mode 100644 service/meta_test.go delete mode 100644 service/ttl.go delete mode 100644 service/ttl_test.go create mode 100644 service/verify.go create mode 100644 service/verify.pb.go create mode 100644 service/verify.proto create mode 100644 service/verify_test.go create mode 100644 service/verify_test.pb.go create mode 100644 service/verify_test.proto diff --git a/Makefile b/Makefile index 64b0939..9609923 100644 --- a/Makefile +++ b/Makefile @@ -33,5 +33,5 @@ protoc: echo "${B}${G}⇒ Processing $$f ${R}"; \ protoc \ --proto_path=.:./vendor:/usr/local/include \ - --gofast_out=plugins=grpc,paths=source_relative:. $$f; \ + --gofast_out=plugins=grpc,paths=source_relative:. $$f; \ done diff --git a/accounting/service.go b/accounting/service.go index df74e58..ac1ceb5 100644 --- a/accounting/service.go +++ b/accounting/service.go @@ -31,9 +31,6 @@ const ( ErrEmptyParentAddress = internal.Error("empty parent address") ) -// SetTTL sets ttl to BalanceRequest to satisfy TTLRequest interface. -func (m BalanceRequest) SetTTL(v uint32) { m.TTL = v } - // SumFunds goes through all accounts and sums up active funds. func SumFunds(accounts []*Account) (res *decimal.Decimal) { res = decimal.Zero.Copy() diff --git a/accounting/service.pb.go b/accounting/service.pb.go index bc31ce1..7a8a086 100644 --- a/accounting/service.pb.go +++ b/accounting/service.pb.go @@ -9,6 +9,7 @@ import ( _ "github.com/gogo/protobuf/gogoproto" proto "github.com/golang/protobuf/proto" decimal "github.com/nspcc-dev/neofs-proto/decimal" + service "github.com/nspcc-dev/neofs-proto/service" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" @@ -31,12 +32,13 @@ const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package type BalanceRequest struct { // OwnerID is a wallet address OwnerID OwnerID `protobuf:"bytes,1,opt,name=OwnerID,proto3,customtype=OwnerID" json:"OwnerID"` - // TTL must be larger than zero, it decreased in every neofs-node - // Deprecated: will be replaced with RequestMetaHeader (see develop branch) - TTL uint32 `protobuf:"varint,2,opt,name=TTL,proto3" json:"TTL,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + // RequestMetaHeader contains information about request meta headers (should be embedded into message) + service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` + // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) + service.RequestVerificationHeader `protobuf:"bytes,99,opt,name=Verify,proto3,embedded=Verify" json:"Verify"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *BalanceRequest) Reset() { *m = BalanceRequest{} } @@ -68,13 +70,6 @@ func (m *BalanceRequest) XXX_DiscardUnknown() { var xxx_messageInfo_BalanceRequest proto.InternalMessageInfo -func (m *BalanceRequest) GetTTL() uint32 { - if m != nil { - return m.TTL - } - return 0 -} - type BalanceResponse struct { // Balance contains current account balance state Balance *decimal.Decimal `protobuf:"bytes,1,opt,name=Balance,proto3" json:"Balance,omitempty"` @@ -137,27 +132,31 @@ func init() { func init() { proto.RegisterFile("accounting/service.proto", fileDescriptor_7f9514b8f1d4c7fe) } var fileDescriptor_7f9514b8f1d4c7fe = []byte{ - // 311 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x48, 0x4c, 0x4e, 0xce, - 0x2f, 0xcd, 0x2b, 0xc9, 0xcc, 0x4b, 0xd7, 0x2f, 0x4e, 0x2d, 0x2a, 0xcb, 0x4c, 0x4e, 0xd5, 0x2b, - 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x42, 0xc8, 0x48, 0x89, 0xa6, 0xa4, 0x26, 0x67, 0xe6, 0x26, - 0xe6, 0xe8, 0x43, 0x69, 0x88, 0x12, 0x29, 0x31, 0x24, 0xcd, 0x25, 0x95, 0x05, 0xa9, 0xc5, 0x50, - 0x71, 0xdd, 0xf4, 0xcc, 0x92, 0x8c, 0xd2, 0x24, 0xbd, 0xe4, 0xfc, 0x5c, 0xfd, 0xf4, 0xfc, 0xf4, - 0x7c, 0x7d, 0xb0, 0x70, 0x52, 0x69, 0x1a, 0x98, 0x07, 0xe6, 0x80, 0x59, 0x10, 0xe5, 0x4a, 0xbe, - 0x5c, 0x7c, 0x4e, 0x89, 0x39, 0x89, 0x79, 0xc9, 0xa9, 0x41, 0xa9, 0x85, 0xa5, 0xa9, 0xc5, 0x25, - 0x42, 0x9a, 0x5c, 0xec, 0xfe, 0xe5, 0x79, 0xa9, 0x45, 0x9e, 0x2e, 0x12, 0x8c, 0x0a, 0x8c, 0x1a, - 0x3c, 0x4e, 0xfc, 0x27, 0xee, 0xc9, 0x33, 0xdc, 0xba, 0x27, 0x0f, 0x13, 0x0e, 0x82, 0x31, 0x84, - 0x04, 0xb8, 0x98, 0x43, 0x42, 0x7c, 0x24, 0x98, 0x14, 0x18, 0x35, 0x78, 0x83, 0x40, 0x4c, 0xa5, - 0x32, 0x2e, 0x7e, 0xb8, 0x71, 0xc5, 0x05, 0xf9, 0x79, 0xc5, 0xa9, 0x42, 0x5a, 0x5c, 0xec, 0x50, - 0x21, 0xb0, 0x79, 0xdc, 0x46, 0x02, 0x7a, 0x30, 0x9f, 0xb8, 0x40, 0xe8, 0x20, 0x98, 0x02, 0x21, - 0x73, 0x2e, 0x1e, 0x9f, 0xfc, 0xe4, 0x6c, 0x47, 0x88, 0xd7, 0x8a, 0x25, 0x98, 0x14, 0x98, 0x35, - 0xb8, 0x8d, 0x84, 0xf5, 0x10, 0x7e, 0xd5, 0x83, 0xca, 0x05, 0xa1, 0x28, 0x34, 0x0a, 0xe0, 0xe2, - 0x72, 0x84, 0xab, 0x11, 0x72, 0x82, 0x5b, 0x29, 0x24, 0x85, 0xac, 0x17, 0xd5, 0xa7, 0x52, 0xd2, - 0x58, 0xe5, 0x20, 0xce, 0x76, 0x72, 0x3c, 0xf1, 0x48, 0x8e, 0xf1, 0xc2, 0x23, 0x39, 0xc6, 0x1b, - 0x8f, 0xe4, 0x18, 0x1f, 0x3c, 0x92, 0x63, 0x9c, 0xf1, 0x58, 0x8e, 0x21, 0x4a, 0x1b, 0x29, 0x74, - 0xf3, 0x8a, 0x0b, 0x92, 0x93, 0x75, 0x53, 0x52, 0xcb, 0xf4, 0xf3, 0x52, 0xf3, 0xd3, 0x8a, 0x75, - 0x21, 0x61, 0x8b, 0x30, 0x32, 0x89, 0x0d, 0x2c, 0x62, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0x0c, - 0x45, 0x3c, 0x0a, 0xe8, 0x01, 0x00, 0x00, + // 381 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x91, 0xbd, 0x6e, 0xdb, 0x30, + 0x14, 0x85, 0xcd, 0xb6, 0xb0, 0x0b, 0xda, 0xa8, 0x0b, 0xf6, 0x07, 0x82, 0x0a, 0xc8, 0x86, 0x27, + 0xb7, 0x85, 0x25, 0x40, 0x1d, 0xda, 0xd5, 0x82, 0x87, 0x16, 0x68, 0xd1, 0x40, 0x43, 0x86, 0x6c, + 0x14, 0x7d, 0xad, 0x08, 0xb1, 0x49, 0x45, 0xa4, 0x14, 0xf8, 0x4d, 0xf2, 0x2e, 0x79, 0x01, 0x8f, + 0x1e, 0x83, 0x0c, 0x46, 0xa0, 0xbc, 0x48, 0x60, 0x8a, 0xf2, 0x4f, 0x92, 0x89, 0xe4, 0x77, 0xee, + 0xb9, 0xbc, 0x3c, 0xc4, 0x16, 0x65, 0x4c, 0xe4, 0x5c, 0x25, 0x3c, 0xf6, 0x24, 0x64, 0x45, 0xc2, + 0xc0, 0x4d, 0x33, 0xa1, 0x04, 0xc1, 0x7b, 0xc5, 0x26, 0x46, 0xf2, 0x16, 0xa0, 0x68, 0xa5, 0xdb, + 0x1f, 0x6b, 0x56, 0x40, 0x96, 0xcc, 0x96, 0x86, 0x7e, 0x9a, 0x02, 0x4b, 0x16, 0x74, 0xee, 0x99, + 0xd5, 0xe0, 0xcf, 0x07, 0xd7, 0xa8, 0x65, 0x0a, 0xd2, 0xf0, 0x51, 0x9c, 0xa8, 0xf3, 0x3c, 0x72, + 0x99, 0x58, 0x78, 0xb1, 0x88, 0x85, 0xa7, 0x71, 0x94, 0xcf, 0xf4, 0x49, 0x1f, 0xf4, 0xae, 0x2a, + 0x1f, 0xdc, 0x20, 0xfc, 0x2e, 0xa0, 0x73, 0xca, 0x19, 0x84, 0x70, 0x99, 0x83, 0x54, 0xe4, 0x2b, + 0x6e, 0xfd, 0xbf, 0xe2, 0x90, 0xfd, 0x99, 0x58, 0xa8, 0x8f, 0x86, 0x9d, 0xa0, 0xbb, 0xda, 0xf4, + 0x1a, 0x77, 0x9b, 0x5e, 0x8d, 0xc3, 0x7a, 0x43, 0x7e, 0xe1, 0x37, 0xff, 0x40, 0x51, 0x2b, 0xea, + 0xa3, 0x61, 0xdb, 0xb7, 0xdd, 0xfa, 0xbd, 0xa6, 0xd5, 0x56, 0xfb, 0x0d, 0x74, 0x0a, 0x59, 0xf0, + 0x76, 0xdb, 0x63, 0xbd, 0xe9, 0xa1, 0x50, 0x3b, 0xc8, 0x04, 0x37, 0x4f, 0xf5, 0x2b, 0x2d, 0xa6, + 0xbd, 0x83, 0xa7, 0x5e, 0xad, 0x26, 0x8c, 0xaa, 0x44, 0xf0, 0x67, 0x3d, 0x8c, 0x77, 0x50, 0xe0, + 0xee, 0x6e, 0x78, 0x99, 0x0a, 0x2e, 0x81, 0x7c, 0xc3, 0x2d, 0x83, 0xf4, 0xf4, 0x6d, 0xff, 0xbd, + 0x5b, 0x07, 0x37, 0xa9, 0xd6, 0xb0, 0x2e, 0x20, 0x3f, 0x71, 0xe7, 0xaf, 0x60, 0x17, 0xe3, 0x2a, + 0x49, 0x69, 0xbd, 0xea, 0xbf, 0x1e, 0xb6, 0xfd, 0x0f, 0xee, 0x3e, 0x5a, 0xd7, 0x68, 0xe1, 0x51, + 0xa1, 0x7f, 0x82, 0xf1, 0x78, 0x57, 0x43, 0x82, 0xdd, 0x95, 0xc4, 0x3e, 0xf4, 0x1e, 0xe7, 0x6a, + 0x7f, 0x79, 0x51, 0xab, 0xc6, 0x0e, 0xc6, 0xab, 0xd2, 0x41, 0xeb, 0xd2, 0x41, 0xb7, 0xa5, 0x83, + 0xee, 0x4b, 0x07, 0x5d, 0x3f, 0x38, 0x8d, 0xb3, 0xef, 0x07, 0x9f, 0xc9, 0x65, 0xca, 0xd8, 0x68, + 0x0a, 0x85, 0xc7, 0x41, 0xcc, 0xe4, 0xa8, 0xfa, 0xca, 0x7d, 0xcb, 0xa8, 0xa9, 0xc9, 0x8f, 0xc7, + 0x00, 0x00, 0x00, 0xff, 0xff, 0xf9, 0xca, 0x86, 0x87, 0x81, 0x02, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -266,11 +265,30 @@ func (m *BalanceRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } - if m.TTL != 0 { - i = encodeVarintService(dAtA, i, uint64(m.TTL)) - i-- - dAtA[i] = 0x10 + { + size, err := m.RequestVerificationHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x9a + { + size, err := m.RequestMetaHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x92 { size := m.OwnerID.Size() i -= size @@ -356,9 +374,10 @@ func (m *BalanceRequest) Size() (n int) { _ = l l = m.OwnerID.Size() n += 1 + l + sovService(uint64(l)) - if m.TTL != 0 { - n += 1 + sovService(uint64(m.TTL)) - } + l = m.RequestMetaHeader.Size() + n += 2 + l + sovService(uint64(l)) + l = m.RequestVerificationHeader.Size() + n += 2 + l + sovService(uint64(l)) if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -455,11 +474,11 @@ func (m *BalanceRequest) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TTL", wireType) + case 98: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType) } - m.TTL = 0 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowService @@ -469,11 +488,58 @@ func (m *BalanceRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.TTL |= uint32(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RequestMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 99: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestVerificationHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RequestVerificationHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipService(dAtA[iNdEx:]) diff --git a/accounting/service.proto b/accounting/service.proto index 9cfdb0f..f2696c4 100644 --- a/accounting/service.proto +++ b/accounting/service.proto @@ -2,6 +2,8 @@ syntax = "proto3"; package accounting; option go_package = "github.com/nspcc-dev/neofs-proto/accounting"; +import "service/meta.proto"; +import "service/verify.proto"; import "decimal/decimal.proto"; import "accounting/types.proto"; import "github.com/gogo/protobuf/gogoproto/gogo.proto"; @@ -17,10 +19,11 @@ service Accounting { message BalanceRequest { // OwnerID is a wallet address - bytes OwnerID = 1 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false]; - // TTL must be larger than zero, it decreased in every neofs-node - // Deprecated: will be replaced with RequestMetaHeader (see develop branch) - uint32 TTL = 2; + bytes OwnerID = 1 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false]; + // RequestMetaHeader contains information about request meta headers (should be embedded into message) + service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) + service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; } message BalanceResponse { diff --git a/accounting/withdraw.go b/accounting/withdraw.go index 3cd2766..0a8cf90 100644 --- a/accounting/withdraw.go +++ b/accounting/withdraw.go @@ -11,18 +11,6 @@ type ( MessageID = refs.MessageID ) -// SetTTL sets ttl to GetRequest to satisfy TTLRequest interface. -func (m *GetRequest) SetTTL(v uint32) { m.TTL = v } - -// SetTTL sets ttl to PutRequest to satisfy TTLRequest interface. -func (m *PutRequest) SetTTL(v uint32) { m.TTL = v } - -// SetTTL sets ttl to ListRequest to satisfy TTLRequest interface. -func (m *ListRequest) SetTTL(v uint32) { m.TTL = v } - -// SetTTL sets ttl to DeleteRequest to satisfy TTLRequest interface. -func (m *DeleteRequest) SetTTL(v uint32) { m.TTL = v } - // SetSignature sets signature to PutRequest to satisfy SignedRequest interface. func (m *PutRequest) SetSignature(v []byte) { m.Signature = v } diff --git a/accounting/withdraw.pb.go b/accounting/withdraw.pb.go index f0e78aa..a2116c0 100644 --- a/accounting/withdraw.pb.go +++ b/accounting/withdraw.pb.go @@ -9,6 +9,7 @@ import ( _ "github.com/gogo/protobuf/gogoproto" proto "github.com/golang/protobuf/proto" decimal "github.com/nspcc-dev/neofs-proto/decimal" + service "github.com/nspcc-dev/neofs-proto/service" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" @@ -99,12 +100,13 @@ type GetRequest struct { ID ChequeID `protobuf:"bytes,1,opt,name=ID,proto3,customtype=ChequeID" json:"ID"` // OwnerID is a wallet address OwnerID OwnerID `protobuf:"bytes,2,opt,name=OwnerID,proto3,customtype=OwnerID" json:"OwnerID"` - // TTL must be larger than zero, it decreased in every neofs-node - // Deprecated: will be replaced with RequestMetaHeader (see develop branch) - TTL uint32 `protobuf:"varint,3,opt,name=TTL,proto3" json:"TTL,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + // RequestMetaHeader contains information about request meta headers (should be embedded into message) + service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` + // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) + service.RequestVerificationHeader `protobuf:"bytes,99,opt,name=Verify,proto3,embedded=Verify" json:"Verify"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetRequest) Reset() { *m = GetRequest{} } @@ -136,13 +138,6 @@ func (m *GetRequest) XXX_DiscardUnknown() { var xxx_messageInfo_GetRequest proto.InternalMessageInfo -func (m *GetRequest) GetTTL() uint32 { - if m != nil { - return m.TTL - } - return 0 -} - type GetResponse struct { // Withdraw is cheque with meta information Withdraw *Item `protobuf:"bytes,1,opt,name=Withdraw,proto3" json:"Withdraw,omitempty"` @@ -198,12 +193,13 @@ type PutRequest struct { MessageID MessageID `protobuf:"bytes,4,opt,name=MessageID,proto3,customtype=MessageID" json:"MessageID"` // Signature is a signature of the sent request Signature []byte `protobuf:"bytes,5,opt,name=Signature,proto3" json:"Signature,omitempty"` - // TTL must be larger than zero, it decreased in every neofs-node - // Deprecated: will be replaced with RequestMetaHeader (see develop branch) - TTL uint32 `protobuf:"varint,6,opt,name=TTL,proto3" json:"TTL,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + // RequestMetaHeader contains information about request meta headers (should be embedded into message) + service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` + // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) + service.RequestVerificationHeader `protobuf:"bytes,99,opt,name=Verify,proto3,embedded=Verify" json:"Verify"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *PutRequest) Reset() { *m = PutRequest{} } @@ -256,13 +252,6 @@ func (m *PutRequest) GetSignature() []byte { return nil } -func (m *PutRequest) GetTTL() uint32 { - if m != nil { - return m.TTL - } - return 0 -} - type PutResponse struct { // ID is cheque identifier ID ChequeID `protobuf:"bytes,1,opt,name=ID,proto3,customtype=ChequeID" json:"ID"` @@ -303,12 +292,13 @@ var xxx_messageInfo_PutResponse proto.InternalMessageInfo type ListRequest struct { // OwnerID is a wallet address OwnerID OwnerID `protobuf:"bytes,1,opt,name=OwnerID,proto3,customtype=OwnerID" json:"OwnerID"` - // TTL must be larger than zero, it decreased in every neofs-node - // Deprecated: will be replaced with RequestMetaHeader (see develop branch) - TTL uint32 `protobuf:"varint,2,opt,name=TTL,proto3" json:"TTL,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + // RequestMetaHeader contains information about request meta headers (should be embedded into message) + service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` + // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) + service.RequestVerificationHeader `protobuf:"bytes,99,opt,name=Verify,proto3,embedded=Verify" json:"Verify"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *ListRequest) Reset() { *m = ListRequest{} } @@ -340,13 +330,6 @@ func (m *ListRequest) XXX_DiscardUnknown() { var xxx_messageInfo_ListRequest proto.InternalMessageInfo -func (m *ListRequest) GetTTL() uint32 { - if m != nil { - return m.TTL - } - return 0 -} - type ListResponse struct { // Items is a set of cheques with meta information Items []*Item `protobuf:"bytes,1,rep,name=Items,proto3" json:"Items,omitempty"` @@ -400,12 +383,13 @@ type DeleteRequest struct { MessageID MessageID `protobuf:"bytes,3,opt,name=MessageID,proto3,customtype=MessageID" json:"MessageID"` // Signature is a signature of the sent request Signature []byte `protobuf:"bytes,4,opt,name=Signature,proto3" json:"Signature,omitempty"` - // TTL must be larger than zero, it decreased in every neofs-node - // Deprecated: will be replaced with RequestMetaHeader (see develop branch) - TTL uint32 `protobuf:"varint,5,opt,name=TTL,proto3" json:"TTL,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + // RequestMetaHeader contains information about request meta headers (should be embedded into message) + service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` + // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) + service.RequestVerificationHeader `protobuf:"bytes,99,opt,name=Verify,proto3,embedded=Verify" json:"Verify"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *DeleteRequest) Reset() { *m = DeleteRequest{} } @@ -444,13 +428,6 @@ func (m *DeleteRequest) GetSignature() []byte { return nil } -func (m *DeleteRequest) GetTTL() uint32 { - if m != nil { - return m.TTL - } - return 0 -} - // DeleteResponse is empty type DeleteResponse struct { XXX_NoUnkeyedLiteral struct{} `json:"-"` @@ -502,42 +479,46 @@ func init() { func init() { proto.RegisterFile("accounting/withdraw.proto", fileDescriptor_b3a38a4dc2575267) } var fileDescriptor_b3a38a4dc2575267 = []byte{ - // 550 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x94, 0xcd, 0x6e, 0xd3, 0x40, - 0x10, 0xc7, 0xbb, 0xb6, 0xe3, 0xb6, 0x93, 0x14, 0xc2, 0x4a, 0x14, 0xd7, 0x42, 0xae, 0xe5, 0x03, - 0x0a, 0x82, 0xc4, 0x52, 0x91, 0x22, 0x21, 0x0e, 0xa8, 0xc1, 0x52, 0x31, 0x2a, 0x22, 0x32, 0x95, - 0x90, 0xb8, 0x39, 0xce, 0xd6, 0xb1, 0x48, 0xec, 0x10, 0xaf, 0x89, 0x78, 0x13, 0xde, 0x82, 0x27, - 0xe0, 0xde, 0x23, 0x47, 0xd4, 0x43, 0x85, 0xc2, 0x3b, 0x70, 0x46, 0x5e, 0xaf, 0xbb, 0x36, 0x2d, - 0xa2, 0x20, 0x38, 0x79, 0xe7, 0x63, 0x77, 0x66, 0x7e, 0xff, 0xf5, 0xc2, 0x8e, 0x1f, 0x04, 0x49, - 0x16, 0xd3, 0x28, 0x0e, 0xed, 0x65, 0x44, 0x27, 0xe3, 0x85, 0xbf, 0xec, 0xcd, 0x17, 0x09, 0x4d, - 0x30, 0x88, 0x90, 0x7e, 0x73, 0x4c, 0x82, 0x68, 0xe6, 0x4f, 0x6d, 0xfe, 0x2d, 0x52, 0xf4, 0x6e, - 0x18, 0xd1, 0x49, 0x36, 0xea, 0x05, 0xc9, 0xcc, 0x0e, 0x93, 0x30, 0xb1, 0x99, 0x7b, 0x94, 0x1d, - 0x33, 0x8b, 0x19, 0x6c, 0x55, 0xa4, 0x5b, 0x1f, 0x11, 0x28, 0x2e, 0x25, 0x33, 0x6c, 0x82, 0xe4, - 0x3a, 0x1a, 0x32, 0x51, 0xa7, 0x35, 0x68, 0x9f, 0x9c, 0xed, 0xae, 0x9d, 0x9e, 0xed, 0x6e, 0x3c, - 0x99, 0x90, 0xb7, 0x19, 0x71, 0x1d, 0x4f, 0x72, 0x1d, 0x7c, 0x17, 0xd6, 0x5f, 0x2c, 0x63, 0xb2, - 0x70, 0x1d, 0x4d, 0x62, 0x69, 0xd7, 0x79, 0x5a, 0xe9, 0xf6, 0xca, 0x05, 0xee, 0x80, 0xba, 0x3f, - 0xcb, 0x1b, 0xd5, 0x64, 0x13, 0x75, 0x9a, 0x7b, 0xed, 0x5e, 0xd9, 0xa4, 0x53, 0x7c, 0x3d, 0x1e, - 0xc7, 0xdb, 0xa0, 0x3e, 0x25, 0x51, 0x38, 0xa1, 0x9a, 0x62, 0xa2, 0x8e, 0xe2, 0x71, 0x0b, 0x6b, - 0xb0, 0x3e, 0xf4, 0xdf, 0x4f, 0x13, 0x7f, 0xac, 0x35, 0xf2, 0x62, 0x5e, 0x69, 0x5a, 0x6f, 0x00, - 0x0e, 0x08, 0xf5, 0xf2, 0xc6, 0x52, 0xfa, 0x6f, 0xdb, 0x6e, 0x83, 0x7c, 0x74, 0x74, 0xc8, 0x7a, - 0xde, 0xf2, 0xf2, 0xa5, 0xf5, 0x08, 0x9a, 0xac, 0x58, 0x3a, 0x4f, 0xe2, 0x94, 0xe0, 0xfb, 0xb0, - 0xf1, 0x8a, 0x2b, 0xc2, 0x6a, 0xe6, 0x93, 0x09, 0x49, 0x7a, 0x39, 0x48, 0xef, 0x3c, 0xc3, 0x3a, - 0x45, 0x00, 0xc3, 0xec, 0xbc, 0xd5, 0x4a, 0x23, 0xe8, 0xca, 0xfc, 0xa4, 0x2b, 0xf3, 0x93, 0x6b, - 0xfc, 0x6c, 0xd8, 0x7c, 0x4e, 0xd2, 0xd4, 0x0f, 0x89, 0xeb, 0x30, 0xb4, 0xad, 0xc1, 0x0d, 0x5e, - 0x4e, 0x04, 0x3c, 0xb1, 0xc4, 0xb7, 0x61, 0xf3, 0x65, 0x14, 0xc6, 0x3e, 0xcd, 0x16, 0x84, 0x23, - 0x17, 0x8e, 0x92, 0x8c, 0x2a, 0xc8, 0xd8, 0xd0, 0x64, 0xb3, 0x71, 0x32, 0xbf, 0xd5, 0xc1, 0x7a, - 0x06, 0xcd, 0xc3, 0x28, 0xfd, 0x1b, 0x1a, 0xbc, 0xb8, 0x24, 0x8a, 0xf7, 0xa1, 0x55, 0x9c, 0xc5, - 0xab, 0xdf, 0x81, 0x46, 0xce, 0x3e, 0xd5, 0x90, 0x29, 0x5f, 0x2a, 0x4a, 0x11, 0xb6, 0x3e, 0x21, - 0xd8, 0x72, 0xc8, 0x94, 0x50, 0xf2, 0x5f, 0xee, 0x4f, 0x0d, 0xba, 0xfc, 0xa7, 0xd0, 0x95, 0x5f, - 0x40, 0x6f, 0x88, 0xb9, 0xdb, 0x70, 0xad, 0x6c, 0xbf, 0x98, 0x7c, 0xef, 0x3b, 0x12, 0x57, 0x12, - 0xf7, 0x41, 0x3e, 0x20, 0x14, 0x6f, 0x57, 0xc7, 0x17, 0xff, 0x8a, 0x7e, 0xeb, 0x82, 0x9f, 0xe3, - 0xeb, 0x83, 0x3c, 0xcc, 0x7e, 0xda, 0x27, 0x2e, 0x6e, 0x7d, 0x5f, 0x55, 0xf4, 0x87, 0xa0, 0xe4, - 0x32, 0xe0, 0x5a, 0x42, 0x45, 0x64, 0x5d, 0xbb, 0x18, 0xe0, 0x5b, 0x1f, 0x83, 0x5a, 0x4c, 0x82, - 0x77, 0xaa, 0x39, 0x35, 0x71, 0x74, 0xfd, 0xb2, 0x50, 0x71, 0xc0, 0x60, 0xff, 0x64, 0x65, 0xa0, - 0xcf, 0x2b, 0x03, 0x7d, 0x59, 0x19, 0xe8, 0xeb, 0xca, 0x40, 0x1f, 0xbe, 0x19, 0x6b, 0xaf, 0xef, - 0x55, 0x5e, 0xbf, 0x38, 0x9d, 0x07, 0x41, 0x77, 0x4c, 0xde, 0xd9, 0x31, 0x49, 0x8e, 0xd3, 0x6e, - 0xf1, 0xf6, 0x89, 0x13, 0x47, 0x2a, 0xf3, 0x3c, 0xf8, 0x11, 0x00, 0x00, 0xff, 0xff, 0xd9, 0xcf, - 0xde, 0x66, 0x71, 0x05, 0x00, 0x00, + // 615 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x55, 0x41, 0x6b, 0xd4, 0x40, + 0x14, 0xee, 0x24, 0xe9, 0xb6, 0x7d, 0x5b, 0xb5, 0x0e, 0x5a, 0xd3, 0x20, 0xdb, 0x25, 0x07, 0x59, + 0xd1, 0x26, 0x50, 0xa1, 0x28, 0x1e, 0xa4, 0x6b, 0xa0, 0x0d, 0x58, 0x2c, 0x11, 0x14, 0xbc, 0x65, + 0xb3, 0xaf, 0xd9, 0x40, 0x37, 0x59, 0x93, 0xc9, 0x2e, 0xfd, 0x27, 0xfe, 0x07, 0x0f, 0x5e, 0xfd, + 0x09, 0x7b, 0xec, 0x51, 0x3d, 0x2c, 0xb2, 0xfe, 0x07, 0xcf, 0x92, 0xc9, 0xa4, 0xc9, 0x76, 0x0b, + 0x56, 0x51, 0xea, 0x29, 0x33, 0xef, 0x7b, 0x6f, 0xe6, 0xbd, 0xef, 0xfb, 0x92, 0xc0, 0x86, 0xeb, + 0x79, 0x51, 0x1a, 0xb2, 0x20, 0xf4, 0xcd, 0x51, 0xc0, 0x7a, 0xdd, 0xd8, 0x1d, 0x19, 0x83, 0x38, + 0x62, 0x11, 0x85, 0x12, 0xd2, 0x68, 0x82, 0xf1, 0x30, 0xf0, 0xd0, 0xec, 0x23, 0x73, 0x73, 0x5c, + 0xbb, 0x55, 0xc4, 0x86, 0x18, 0x07, 0x47, 0x27, 0x22, 0x7a, 0xbb, 0x8b, 0x5e, 0xd0, 0x77, 0x8f, + 0x4d, 0xf1, 0x14, 0xe1, 0x2d, 0x3f, 0x60, 0xbd, 0xb4, 0x63, 0x78, 0x51, 0xdf, 0xf4, 0x23, 0x3f, + 0x32, 0x79, 0xb8, 0x93, 0x1e, 0xf1, 0x1d, 0xdf, 0xf0, 0x55, 0x9e, 0xae, 0x7f, 0x24, 0xa0, 0xd8, + 0x0c, 0xfb, 0xb4, 0x09, 0x92, 0x6d, 0xa9, 0xa4, 0x49, 0x5a, 0xab, 0xed, 0xb5, 0xf1, 0x64, 0x73, + 0xe1, 0xeb, 0x64, 0x73, 0xf9, 0x79, 0x0f, 0xdf, 0xa5, 0x68, 0x5b, 0x8e, 0x64, 0x5b, 0xf4, 0x3e, + 0x2c, 0xbd, 0x1c, 0x85, 0x18, 0xdb, 0x96, 0x2a, 0xf1, 0xb4, 0x1b, 0x22, 0xad, 0x08, 0x3b, 0xc5, + 0x82, 0xb6, 0xa0, 0xb6, 0xdb, 0xcf, 0x46, 0x52, 0xe5, 0x26, 0x69, 0xd5, 0xb7, 0xd7, 0x8c, 0xa2, + 0x49, 0x2b, 0x7f, 0x3a, 0x02, 0xa7, 0xeb, 0x50, 0xdb, 0xc7, 0xc0, 0xef, 0x31, 0x55, 0x69, 0x92, + 0x96, 0xe2, 0x88, 0x1d, 0x55, 0x61, 0xe9, 0xd0, 0x3d, 0x39, 0x8e, 0xdc, 0xae, 0xba, 0x98, 0x5d, + 0xe6, 0x14, 0x5b, 0xfd, 0x0b, 0x01, 0xd8, 0x43, 0xe6, 0x64, 0x9d, 0x25, 0xec, 0xef, 0xf6, 0xfd, + 0x18, 0x94, 0x03, 0x64, 0xae, 0xda, 0xe1, 0x5d, 0x6b, 0x86, 0x20, 0xde, 0x10, 0x97, 0x65, 0xd8, + 0x3e, 0xba, 0x5d, 0x8c, 0xdb, 0xcb, 0xd9, 0x19, 0xa7, 0x93, 0x4d, 0xe2, 0xf0, 0x0a, 0x6a, 0x41, + 0xed, 0x35, 0x57, 0x47, 0xf5, 0x78, 0xad, 0x7e, 0xbe, 0x96, 0xa3, 0x81, 0xe7, 0xb2, 0x20, 0x0a, + 0xe7, 0xce, 0x10, 0xb5, 0xfa, 0x53, 0xa8, 0xf3, 0xd1, 0x92, 0x41, 0x14, 0x26, 0x48, 0x1f, 0xc2, + 0xf2, 0x1b, 0x61, 0x15, 0x3e, 0x61, 0x46, 0x64, 0xe9, 0x15, 0x23, 0xd3, 0xcd, 0x39, 0xcb, 0xd0, + 0xc7, 0x12, 0xc0, 0x61, 0x7a, 0x46, 0x4c, 0x65, 0x6c, 0x72, 0x69, 0xb9, 0xa4, 0x4b, 0xcb, 0x25, + 0xcf, 0xc8, 0x65, 0xc2, 0xca, 0x01, 0x26, 0x89, 0xeb, 0xa3, 0x6d, 0x71, 0x25, 0x57, 0xdb, 0x37, + 0xc5, 0x75, 0x25, 0xe0, 0x94, 0x4b, 0x7a, 0x17, 0x56, 0x5e, 0x05, 0x7e, 0xe8, 0xb2, 0x34, 0x46, + 0xa1, 0x70, 0x19, 0xb8, 0x72, 0x1d, 0x4c, 0xa8, 0x73, 0x26, 0x85, 0x0e, 0xbf, 0xf4, 0x98, 0xfe, + 0x89, 0x40, 0xfd, 0x45, 0x90, 0xfc, 0x09, 0xf9, 0x57, 0x3d, 0xeb, 0x0e, 0xac, 0xe6, 0x9d, 0x8b, + 0x61, 0xef, 0xc1, 0x62, 0x66, 0xac, 0x44, 0x25, 0x4d, 0xf9, 0x42, 0xc7, 0xe5, 0xb0, 0xfe, 0x41, + 0x82, 0x6b, 0x16, 0x1e, 0x23, 0xc3, 0x7f, 0xf2, 0x2a, 0xce, 0x38, 0x4a, 0xfe, 0x5d, 0x47, 0x29, + 0xff, 0x9b, 0xa3, 0xd6, 0xe0, 0x7a, 0x41, 0x56, 0xce, 0xf3, 0xf6, 0x0f, 0x52, 0xbe, 0xdd, 0x74, + 0x07, 0xe4, 0x3d, 0x64, 0x74, 0xbd, 0x4a, 0x76, 0xf9, 0x91, 0xd3, 0xee, 0xcc, 0xc5, 0x85, 0x58, + 0x3b, 0x20, 0x1f, 0xa6, 0xe7, 0xea, 0xca, 0x6f, 0xc0, 0x6c, 0x5d, 0xd5, 0xd1, 0x4f, 0x40, 0xc9, + 0x44, 0xa7, 0x33, 0x09, 0x15, 0x03, 0x6b, 0xea, 0x3c, 0x20, 0x4a, 0x9f, 0x41, 0x2d, 0x9f, 0x84, + 0x6e, 0x54, 0x73, 0x66, 0xac, 0xa0, 0x69, 0x17, 0x41, 0xf9, 0x01, 0xed, 0xdd, 0xf1, 0xb4, 0x41, + 0x4e, 0xa7, 0x0d, 0xf2, 0x79, 0xda, 0x20, 0xdf, 0xa6, 0x0d, 0xf2, 0xfe, 0x7b, 0x63, 0xe1, 0xed, + 0x83, 0xca, 0x7f, 0x2b, 0x4c, 0x06, 0x9e, 0xb7, 0xd5, 0xc5, 0xa1, 0x19, 0x62, 0x74, 0x94, 0x6c, + 0xe5, 0x7f, 0xad, 0xf2, 0xc4, 0x4e, 0x8d, 0x47, 0x1e, 0xfd, 0x0c, 0x00, 0x00, 0xff, 0xff, 0xd3, + 0x26, 0xc1, 0xc6, 0x55, 0x07, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -831,11 +812,30 @@ func (m *GetRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } - if m.TTL != 0 { - i = encodeVarintWithdraw(dAtA, i, uint64(m.TTL)) - i-- - dAtA[i] = 0x18 + { + size, err := m.RequestVerificationHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintWithdraw(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x9a + { + size, err := m.RequestMetaHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintWithdraw(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x92 { size := m.OwnerID.Size() i -= size @@ -922,11 +922,30 @@ func (m *PutRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } - if m.TTL != 0 { - i = encodeVarintWithdraw(dAtA, i, uint64(m.TTL)) - i-- - dAtA[i] = 0x30 + { + size, err := m.RequestVerificationHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintWithdraw(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x9a + { + size, err := m.RequestMetaHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintWithdraw(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x92 if len(m.Signature) > 0 { i -= len(m.Signature) copy(dAtA[i:], m.Signature) @@ -1035,11 +1054,30 @@ func (m *ListRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } - if m.TTL != 0 { - i = encodeVarintWithdraw(dAtA, i, uint64(m.TTL)) - i-- - dAtA[i] = 0x10 + { + size, err := m.RequestVerificationHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintWithdraw(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x9a + { + size, err := m.RequestMetaHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintWithdraw(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x92 { size := m.OwnerID.Size() i -= size @@ -1118,11 +1156,30 @@ func (m *DeleteRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } - if m.TTL != 0 { - i = encodeVarintWithdraw(dAtA, i, uint64(m.TTL)) - i-- - dAtA[i] = 0x28 + { + size, err := m.RequestVerificationHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintWithdraw(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x9a + { + size, err := m.RequestMetaHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintWithdraw(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x92 if len(m.Signature) > 0 { i -= len(m.Signature) copy(dAtA[i:], m.Signature) @@ -1238,9 +1295,10 @@ func (m *GetRequest) Size() (n int) { n += 1 + l + sovWithdraw(uint64(l)) l = m.OwnerID.Size() n += 1 + l + sovWithdraw(uint64(l)) - if m.TTL != 0 { - n += 1 + sovWithdraw(uint64(m.TTL)) - } + l = m.RequestMetaHeader.Size() + n += 2 + l + sovWithdraw(uint64(l)) + l = m.RequestVerificationHeader.Size() + n += 2 + l + sovWithdraw(uint64(l)) if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -1284,9 +1342,10 @@ func (m *PutRequest) Size() (n int) { if l > 0 { n += 1 + l + sovWithdraw(uint64(l)) } - if m.TTL != 0 { - n += 1 + sovWithdraw(uint64(m.TTL)) - } + l = m.RequestMetaHeader.Size() + n += 2 + l + sovWithdraw(uint64(l)) + l = m.RequestVerificationHeader.Size() + n += 2 + l + sovWithdraw(uint64(l)) if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -1315,9 +1374,10 @@ func (m *ListRequest) Size() (n int) { _ = l l = m.OwnerID.Size() n += 1 + l + sovWithdraw(uint64(l)) - if m.TTL != 0 { - n += 1 + sovWithdraw(uint64(m.TTL)) - } + l = m.RequestMetaHeader.Size() + n += 2 + l + sovWithdraw(uint64(l)) + l = m.RequestVerificationHeader.Size() + n += 2 + l + sovWithdraw(uint64(l)) if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -1358,9 +1418,10 @@ func (m *DeleteRequest) Size() (n int) { if l > 0 { n += 1 + l + sovWithdraw(uint64(l)) } - if m.TTL != 0 { - n += 1 + sovWithdraw(uint64(m.TTL)) - } + l = m.RequestMetaHeader.Size() + n += 2 + l + sovWithdraw(uint64(l)) + l = m.RequestVerificationHeader.Size() + n += 2 + l + sovWithdraw(uint64(l)) if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -1689,11 +1750,11 @@ func (m *GetRequest) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TTL", wireType) + case 98: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType) } - m.TTL = 0 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowWithdraw @@ -1703,11 +1764,58 @@ func (m *GetRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.TTL |= uint32(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } + if msglen < 0 { + return ErrInvalidLengthWithdraw + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthWithdraw + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RequestMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 99: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestVerificationHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWithdraw + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthWithdraw + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthWithdraw + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RequestVerificationHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipWithdraw(dAtA[iNdEx:]) @@ -2007,11 +2115,11 @@ func (m *PutRequest) Unmarshal(dAtA []byte) error { m.Signature = []byte{} } iNdEx = postIndex - case 6: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TTL", wireType) + case 98: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType) } - m.TTL = 0 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowWithdraw @@ -2021,11 +2129,58 @@ func (m *PutRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.TTL |= uint32(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } + if msglen < 0 { + return ErrInvalidLengthWithdraw + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthWithdraw + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RequestMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 99: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestVerificationHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWithdraw + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthWithdraw + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthWithdraw + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RequestVerificationHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipWithdraw(dAtA[iNdEx:]) @@ -2200,11 +2355,11 @@ func (m *ListRequest) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TTL", wireType) + case 98: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType) } - m.TTL = 0 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowWithdraw @@ -2214,11 +2369,58 @@ func (m *ListRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.TTL |= uint32(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } + if msglen < 0 { + return ErrInvalidLengthWithdraw + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthWithdraw + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RequestMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 99: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestVerificationHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWithdraw + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthWithdraw + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthWithdraw + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RequestVerificationHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipWithdraw(dAtA[iNdEx:]) @@ -2494,11 +2696,11 @@ func (m *DeleteRequest) Unmarshal(dAtA []byte) error { m.Signature = []byte{} } iNdEx = postIndex - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TTL", wireType) + case 98: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType) } - m.TTL = 0 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowWithdraw @@ -2508,11 +2710,58 @@ func (m *DeleteRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.TTL |= uint32(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } + if msglen < 0 { + return ErrInvalidLengthWithdraw + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthWithdraw + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RequestMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 99: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestVerificationHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWithdraw + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthWithdraw + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthWithdraw + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RequestVerificationHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipWithdraw(dAtA[iNdEx:]) diff --git a/accounting/withdraw.proto b/accounting/withdraw.proto index eb58d08..bb950ba 100644 --- a/accounting/withdraw.proto +++ b/accounting/withdraw.proto @@ -2,6 +2,8 @@ syntax = "proto3"; package accounting; option go_package = "github.com/nspcc-dev/neofs-proto/accounting"; +import "service/meta.proto"; +import "service/verify.proto"; import "decimal/decimal.proto"; import "github.com/gogo/protobuf/gogoproto/gogo.proto"; @@ -34,12 +36,13 @@ message Item { message GetRequest { // ID is cheque identifier - bytes ID = 1 [(gogoproto.customtype) = "ChequeID", (gogoproto.nullable) = false]; + bytes ID = 1 [(gogoproto.customtype) = "ChequeID", (gogoproto.nullable) = false]; // OwnerID is a wallet address - bytes OwnerID = 2 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false]; - // TTL must be larger than zero, it decreased in every neofs-node - // Deprecated: will be replaced with RequestMetaHeader (see develop branch) - uint32 TTL = 3; + bytes OwnerID = 2 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false]; + // RequestMetaHeader contains information about request meta headers (should be embedded into message) + service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) + service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; } message GetResponse { @@ -49,18 +52,19 @@ message GetResponse { message PutRequest { // OwnerID is a wallet address - bytes OwnerID = 1 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false]; + bytes OwnerID = 1 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false]; // Amount of funds - decimal.Decimal Amount = 2; + decimal.Decimal Amount = 2; // Height is the neo blockchain height until the cheque is valid - uint64 Height = 3; + uint64 Height = 3; // MessageID is a nonce for uniq request (UUIDv4) - bytes MessageID = 4 [(gogoproto.customtype) = "MessageID", (gogoproto.nullable) = false]; + bytes MessageID = 4 [(gogoproto.customtype) = "MessageID", (gogoproto.nullable) = false]; // Signature is a signature of the sent request - bytes Signature = 5; - // TTL must be larger than zero, it decreased in every neofs-node - // Deprecated: will be replaced with RequestMetaHeader (see develop branch) - uint32 TTL = 6; + bytes Signature = 5; + // RequestMetaHeader contains information about request meta headers (should be embedded into message) + service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) + service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; } message PutResponse { // ID is cheque identifier @@ -69,10 +73,11 @@ message PutResponse { message ListRequest { // OwnerID is a wallet address - bytes OwnerID = 1 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false]; - // TTL must be larger than zero, it decreased in every neofs-node - // Deprecated: will be replaced with RequestMetaHeader (see develop branch) - uint32 TTL = 2; + bytes OwnerID = 1 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false]; + // RequestMetaHeader contains information about request meta headers (should be embedded into message) + service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) + service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; } message ListResponse { @@ -82,16 +87,17 @@ message ListResponse { message DeleteRequest { // ID is cheque identifier - bytes ID = 1 [(gogoproto.customtype) = "ChequeID", (gogoproto.nullable) = false]; + bytes ID = 1 [(gogoproto.customtype) = "ChequeID", (gogoproto.nullable) = false]; // OwnerID is a wallet address - bytes OwnerID = 2 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false]; + bytes OwnerID = 2 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false]; // MessageID is a nonce for uniq request (UUIDv4) - bytes MessageID = 3 [(gogoproto.customtype) = "MessageID", (gogoproto.nullable) = false]; + bytes MessageID = 3 [(gogoproto.customtype) = "MessageID", (gogoproto.nullable) = false]; // Signature is a signature of the sent request - bytes Signature = 4; - // TTL must be larger than zero, it decreased in every neofs-node - // Deprecated: will be replaced with RequestMetaHeader (see develop branch) - uint32 TTL = 5; + bytes Signature = 4; + // RequestMetaHeader contains information about request meta headers (should be embedded into message) + service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) + service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; } // DeleteResponse is empty diff --git a/bootstrap/service.go b/bootstrap/service.go index 6d0d3ca..e67ea6d 100644 --- a/bootstrap/service.go +++ b/bootstrap/service.go @@ -6,6 +6,3 @@ import ( // NodeType type alias. type NodeType = service.NodeRole - -// SetTTL sets ttl to Request to satisfy TTLRequest interface. -func (m *Request) SetTTL(v uint32) { m.TTL = v } diff --git a/bootstrap/service.pb.go b/bootstrap/service.pb.go index f00f814..7165399 100644 --- a/bootstrap/service.pb.go +++ b/bootstrap/service.pb.go @@ -8,6 +8,7 @@ import ( fmt "fmt" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/golang/protobuf/proto" + service "github.com/nspcc-dev/neofs-proto/service" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" @@ -32,12 +33,13 @@ type Request struct { Type NodeType `protobuf:"varint,1,opt,name=type,proto3,customtype=NodeType" json:"type"` // Info contains information about node Info NodeInfo `protobuf:"bytes,2,opt,name=info,proto3" json:"info"` - // TTL must be larger than zero, it decreased in every neofs-node - // Deprecated: will be replaced with RequestMetaHeader (see develop branch) - TTL uint32 `protobuf:"varint,3,opt,name=TTL,proto3" json:"TTL,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + // RequestMetaHeader contains information about request meta headers (should be embedded into message) + service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` + // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) + service.RequestVerificationHeader `protobuf:"bytes,99,opt,name=Verify,proto3,embedded=Verify" json:"Verify"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *Request) Reset() { *m = Request{} } @@ -76,13 +78,6 @@ func (m *Request) GetInfo() NodeInfo { return NodeInfo{} } -func (m *Request) GetTTL() uint32 { - if m != nil { - return m.TTL - } - return 0 -} - func init() { proto.RegisterType((*Request)(nil), "bootstrap.Request") } @@ -90,25 +85,29 @@ func init() { func init() { proto.RegisterFile("bootstrap/service.proto", fileDescriptor_21bce759c9d8eb63) } var fileDescriptor_21bce759c9d8eb63 = []byte{ - // 284 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x4f, 0xca, 0xcf, 0x2f, - 0x29, 0x2e, 0x29, 0x4a, 0x2c, 0xd0, 0x2f, 0x4e, 0x2d, 0x2a, 0xcb, 0x4c, 0x4e, 0xd5, 0x2b, 0x28, - 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x84, 0x4b, 0x48, 0x89, 0x22, 0xd4, 0x94, 0x54, 0x16, 0xa4, 0x16, - 0x43, 0x54, 0x48, 0xe9, 0xa6, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0xa7, - 0xe7, 0xa7, 0xe7, 0xeb, 0x83, 0x85, 0x93, 0x4a, 0xd3, 0xc0, 0x3c, 0x30, 0x07, 0xcc, 0x82, 0x28, - 0x57, 0xaa, 0xe0, 0x62, 0x0f, 0x4a, 0x2d, 0x2c, 0x4d, 0x2d, 0x2e, 0x11, 0xd2, 0xe1, 0x62, 0x01, - 0x19, 0x24, 0xc1, 0xa8, 0xc0, 0xa8, 0xc1, 0xea, 0x24, 0x71, 0xe2, 0x9e, 0x3c, 0xc3, 0xad, 0x7b, - 0xf2, 0x1c, 0x7e, 0xf9, 0x29, 0xa9, 0x21, 0x95, 0x05, 0xa9, 0x8f, 0xee, 0xc9, 0xb3, 0x80, 0xe8, - 0x20, 0xb0, 0x2a, 0x21, 0x5d, 0x2e, 0x96, 0xcc, 0xbc, 0xb4, 0x7c, 0x09, 0x26, 0x05, 0x46, 0x0d, - 0x6e, 0x23, 0x61, 0x3d, 0xb8, 0x6b, 0xf4, 0x40, 0x1a, 0x3c, 0xf3, 0xd2, 0xf2, 0x9d, 0x58, 0x40, - 0x46, 0x04, 0x81, 0x95, 0x09, 0x09, 0x70, 0x31, 0x87, 0x84, 0xf8, 0x48, 0x30, 0x2b, 0x30, 0x6a, - 0xf0, 0x06, 0x81, 0x98, 0x46, 0x0e, 0x5c, 0x9c, 0x4e, 0x30, 0x3d, 0x42, 0xc6, 0x5c, 0xec, 0x01, - 0x45, 0xf9, 0xc9, 0xa9, 0xc5, 0xc5, 0x42, 0x42, 0x48, 0x46, 0x41, 0x9d, 0x26, 0x25, 0x82, 0x24, - 0x16, 0x5c, 0x50, 0x94, 0x9a, 0x98, 0xe2, 0x9b, 0x58, 0xe0, 0xe4, 0x70, 0xe2, 0x91, 0x1c, 0xe3, - 0x85, 0x47, 0x72, 0x8c, 0x37, 0x1e, 0xc9, 0x31, 0x3e, 0x78, 0x24, 0xc7, 0x38, 0xe3, 0xb1, 0x1c, - 0x43, 0x94, 0x16, 0x52, 0x00, 0xe4, 0x15, 0x17, 0x24, 0x27, 0xeb, 0xa6, 0xa4, 0x96, 0xe9, 0xe7, - 0xa5, 0xe6, 0xa7, 0x15, 0xeb, 0x42, 0xbc, 0x0f, 0x37, 0x2b, 0x89, 0x0d, 0x2c, 0x60, 0x0c, 0x08, - 0x00, 0x00, 0xff, 0xff, 0xdf, 0x93, 0xe2, 0x48, 0x70, 0x01, 0x00, 0x00, + // 342 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x50, 0xbd, 0x4e, 0xeb, 0x30, + 0x14, 0xae, 0xaf, 0x72, 0xfb, 0xe3, 0xbb, 0xf9, 0x16, 0x11, 0x65, 0x48, 0xaa, 0x4e, 0x15, 0x22, + 0x89, 0xd4, 0x2e, 0x8c, 0x55, 0xc4, 0x00, 0x43, 0x11, 0x0a, 0x88, 0x81, 0xcd, 0x71, 0x4e, 0x4a, + 0x86, 0xc6, 0xc6, 0x76, 0x2b, 0xf5, 0x4d, 0x78, 0xa4, 0x8e, 0x1d, 0x11, 0x43, 0x84, 0x82, 0xc4, + 0x73, 0xa0, 0xb8, 0x69, 0xa9, 0x60, 0xb2, 0xcf, 0xf7, 0xe7, 0xe3, 0x0f, 0x9f, 0x26, 0x9c, 0x6b, + 0xa5, 0x25, 0x15, 0xa1, 0x02, 0xb9, 0xca, 0x19, 0x04, 0x42, 0x72, 0xcd, 0x49, 0xef, 0x40, 0x38, + 0xa4, 0x61, 0xc2, 0x05, 0x68, 0xba, 0xa3, 0x9d, 0xfe, 0x1e, 0x5b, 0x81, 0xcc, 0xb3, 0x75, 0x83, + 0x9e, 0x7c, 0xa7, 0xe9, 0xb5, 0x00, 0xd5, 0xc0, 0xfe, 0x3c, 0xd7, 0x4f, 0xcb, 0x24, 0x60, 0x7c, + 0x11, 0xce, 0xf9, 0x9c, 0x87, 0x06, 0x4e, 0x96, 0x99, 0x99, 0xcc, 0x60, 0x6e, 0x3b, 0xf9, 0xf0, + 0x13, 0xe1, 0x4e, 0x0c, 0xcf, 0x4b, 0x50, 0x9a, 0x9c, 0x63, 0xab, 0x4e, 0xb2, 0xd1, 0x00, 0x8d, + 0xfe, 0x46, 0xf6, 0xa6, 0xf4, 0x5a, 0x6f, 0xa5, 0xd7, 0xbd, 0xe1, 0x29, 0xdc, 0xaf, 0x05, 0x54, + 0xa5, 0x67, 0xd5, 0x67, 0x6c, 0x54, 0xc4, 0xc7, 0x56, 0x5e, 0x64, 0xdc, 0xfe, 0x33, 0x40, 0xa3, + 0x7f, 0xe3, 0xff, 0xc1, 0x61, 0x9d, 0xa0, 0x36, 0x5c, 0x17, 0x19, 0x8f, 0xac, 0x3a, 0x22, 0x36, + 0x32, 0x72, 0x81, 0xad, 0x19, 0x68, 0x6a, 0x27, 0x46, 0xee, 0x04, 0xfb, 0x06, 0x9a, 0xc7, 0x6b, + 0xee, 0x0a, 0x68, 0x0a, 0x32, 0xea, 0xd6, 0xae, 0x6d, 0xe9, 0xa1, 0xd8, 0x38, 0xc8, 0x25, 0x6e, + 0x3f, 0x98, 0x8f, 0xdb, 0xcc, 0x78, 0x87, 0x3f, 0xbd, 0x86, 0xcd, 0x19, 0xd5, 0x39, 0x2f, 0x7e, + 0x65, 0x34, 0xde, 0xf1, 0x14, 0xf7, 0xa2, 0xfd, 0x86, 0x64, 0x82, 0x3b, 0xb7, 0x92, 0x33, 0x50, + 0x8a, 0x90, 0xa3, 0xc5, 0x9b, 0x3c, 0xa7, 0x7f, 0x84, 0xdd, 0x09, 0x09, 0x34, 0x9d, 0x51, 0x11, + 0x4d, 0x37, 0x95, 0x8b, 0xb6, 0x95, 0x8b, 0x5e, 0x2b, 0x17, 0xbd, 0x57, 0x2e, 0x7a, 0xf9, 0x70, + 0x5b, 0x8f, 0x67, 0x47, 0x7d, 0x17, 0x4a, 0x30, 0xe6, 0xa7, 0xb0, 0x0a, 0x0b, 0xe0, 0x99, 0xf2, + 0x77, 0x6d, 0x1f, 0xb2, 0x92, 0xb6, 0x01, 0x26, 0x5f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xfe, 0xcb, + 0xf7, 0x92, 0x09, 0x02, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -217,11 +216,30 @@ func (m *Request) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } - if m.TTL != 0 { - i = encodeVarintService(dAtA, i, uint64(m.TTL)) - i-- - dAtA[i] = 0x18 + { + size, err := m.RequestVerificationHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x9a + { + size, err := m.RequestMetaHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x92 { size, err := m.Info.MarshalToSizedBuffer(dAtA[:i]) if err != nil { @@ -262,9 +280,10 @@ func (m *Request) Size() (n int) { } l = m.Info.Size() n += 1 + l + sovService(uint64(l)) - if m.TTL != 0 { - n += 1 + sovService(uint64(m.TTL)) - } + l = m.RequestMetaHeader.Size() + n += 2 + l + sovService(uint64(l)) + l = m.RequestVerificationHeader.Size() + n += 2 + l + sovService(uint64(l)) if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -358,11 +377,11 @@ func (m *Request) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TTL", wireType) + case 98: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType) } - m.TTL = 0 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowService @@ -372,11 +391,58 @@ func (m *Request) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.TTL |= uint32(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RequestMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 99: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestVerificationHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RequestVerificationHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipService(dAtA[iNdEx:]) diff --git a/bootstrap/service.proto b/bootstrap/service.proto index cde94dc..f0bf755 100644 --- a/bootstrap/service.proto +++ b/bootstrap/service.proto @@ -2,6 +2,8 @@ syntax = "proto3"; package bootstrap; option go_package = "github.com/nspcc-dev/neofs-proto/bootstrap"; +import "service/meta.proto"; +import "service/verify.proto"; import "bootstrap/types.proto"; import "github.com/gogo/protobuf/gogoproto/gogo.proto"; @@ -17,10 +19,11 @@ service Bootstrap { message Request { // Type is NodeType, can be InnerRingNode (type=1) or StorageNode (type=2) - int32 type = 1 [(gogoproto.customname) = "Type" , (gogoproto.nullable) = false, (gogoproto.customtype) = "NodeType"]; + int32 type = 1 [(gogoproto.customname) = "Type" , (gogoproto.nullable) = false, (gogoproto.customtype) = "NodeType"]; // Info contains information about node - bootstrap.NodeInfo info = 2 [(gogoproto.nullable) = false]; - // TTL must be larger than zero, it decreased in every neofs-node - // Deprecated: will be replaced with RequestMetaHeader (see develop branch) - uint32 TTL = 3; + bootstrap.NodeInfo info = 2 [(gogoproto.nullable) = false]; + // RequestMetaHeader contains information about request meta headers (should be embedded into message) + service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) + service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; } diff --git a/container/service.go b/container/service.go index 27f39e7..5f446da 100644 --- a/container/service.go +++ b/container/service.go @@ -19,18 +19,6 @@ type ( MessageID = refs.MessageID ) -// SetTTL sets ttl to GetRequest to satisfy TTLRequest interface. -func (m *GetRequest) SetTTL(v uint32) { m.TTL = v } - -// SetTTL sets ttl to PutRequest to satisfy TTLRequest interface. -func (m *PutRequest) SetTTL(v uint32) { m.TTL = v } - -// SetTTL sets ttl to ListRequest to satisfy TTLRequest interface. -func (m *ListRequest) SetTTL(v uint32) { m.TTL = v } - -// SetTTL sets ttl to DeleteRequest to satisfy TTLRequest interface. -func (m *DeleteRequest) SetTTL(v uint32) { m.TTL = v } - // SetSignature sets signature to PutRequest to satisfy SignedRequest interface. func (m *PutRequest) SetSignature(v []byte) { m.Signature = v } diff --git a/container/service.pb.go b/container/service.pb.go index cfd401d..8b98cfa 100644 --- a/container/service.pb.go +++ b/container/service.pb.go @@ -8,6 +8,7 @@ import ( fmt "fmt" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/golang/protobuf/proto" + service "github.com/nspcc-dev/neofs-proto/service" netmap "github.com/nspcc-dev/netmap" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" @@ -39,12 +40,13 @@ type PutRequest struct { Rules netmap.PlacementRule `protobuf:"bytes,4,opt,name=rules,proto3" json:"rules"` // Signature of the user (owner id) Signature []byte `protobuf:"bytes,5,opt,name=Signature,proto3" json:"Signature,omitempty"` - // TTL must be larger than zero, it decreased in every neofs-node - // Deprecated: will be replaced with RequestMetaHeader (see develop branch) - TTL uint32 `protobuf:"varint,6,opt,name=TTL,proto3" json:"TTL,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + // RequestMetaHeader contains information about request meta headers (should be embedded into message) + service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` + // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) + service.RequestVerificationHeader `protobuf:"bytes,99,opt,name=Verify,proto3,embedded=Verify" json:"Verify"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *PutRequest) Reset() { *m = PutRequest{} } @@ -97,13 +99,6 @@ func (m *PutRequest) GetSignature() []byte { return nil } -func (m *PutRequest) GetTTL() uint32 { - if m != nil { - return m.TTL - } - return 0 -} - type PutResponse struct { // CID (container id) is a SHA256 hash of the container structure CID CID `protobuf:"bytes,1,opt,name=CID,proto3,customtype=CID" json:"CID"` @@ -144,14 +139,15 @@ var xxx_messageInfo_PutResponse proto.InternalMessageInfo type DeleteRequest struct { // CID (container id) is a SHA256 hash of the container structure CID CID `protobuf:"bytes,1,opt,name=CID,proto3,customtype=CID" json:"CID"` - // TTL must be larger than zero, it decreased in every neofs-node - // Deprecated: will be replaced with RequestMetaHeader (see develop branch) - TTL uint32 `protobuf:"varint,2,opt,name=TTL,proto3" json:"TTL,omitempty"` // Signature of the container owner - Signature []byte `protobuf:"bytes,3,opt,name=Signature,proto3" json:"Signature,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Signature []byte `protobuf:"bytes,2,opt,name=Signature,proto3" json:"Signature,omitempty"` + // RequestMetaHeader contains information about request meta headers (should be embedded into message) + service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` + // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) + service.RequestVerificationHeader `protobuf:"bytes,99,opt,name=Verify,proto3,embedded=Verify" json:"Verify"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *DeleteRequest) Reset() { *m = DeleteRequest{} } @@ -183,13 +179,6 @@ func (m *DeleteRequest) XXX_DiscardUnknown() { var xxx_messageInfo_DeleteRequest proto.InternalMessageInfo -func (m *DeleteRequest) GetTTL() uint32 { - if m != nil { - return m.TTL - } - return 0 -} - func (m *DeleteRequest) GetSignature() []byte { if m != nil { return m.Signature @@ -237,12 +226,13 @@ var xxx_messageInfo_DeleteResponse proto.InternalMessageInfo type GetRequest struct { // CID (container id) is a SHA256 hash of the container structure CID CID `protobuf:"bytes,1,opt,name=CID,proto3,customtype=CID" json:"CID"` - // TTL must be larger than zero, it decreased in every neofs-node - // Deprecated: will be replaced with RequestMetaHeader (see develop branch) - TTL uint32 `protobuf:"varint,2,opt,name=TTL,proto3" json:"TTL,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + // RequestMetaHeader contains information about request meta headers (should be embedded into message) + service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` + // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) + service.RequestVerificationHeader `protobuf:"bytes,99,opt,name=Verify,proto3,embedded=Verify" json:"Verify"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetRequest) Reset() { *m = GetRequest{} } @@ -274,13 +264,6 @@ func (m *GetRequest) XXX_DiscardUnknown() { var xxx_messageInfo_GetRequest proto.InternalMessageInfo -func (m *GetRequest) GetTTL() uint32 { - if m != nil { - return m.TTL - } - return 0 -} - type GetResponse struct { // Container is a structure that contains placement rules and owner id Container *Container `protobuf:"bytes,1,opt,name=Container,proto3" json:"Container,omitempty"` @@ -328,12 +311,13 @@ func (m *GetResponse) GetContainer() *Container { type ListRequest struct { // OwnerID is a wallet address OwnerID OwnerID `protobuf:"bytes,1,opt,name=OwnerID,proto3,customtype=OwnerID" json:"OwnerID"` - // TTL must be larger than zero, it decreased in every neofs-node - // Deprecated: will be replaced with RequestMetaHeader (see develop branch) - TTL uint32 `protobuf:"varint,2,opt,name=TTL,proto3" json:"TTL,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + // RequestMetaHeader contains information about request meta headers (should be embedded into message) + service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` + // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) + service.RequestVerificationHeader `protobuf:"bytes,99,opt,name=Verify,proto3,embedded=Verify" json:"Verify"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *ListRequest) Reset() { *m = ListRequest{} } @@ -365,13 +349,6 @@ func (m *ListRequest) XXX_DiscardUnknown() { var xxx_messageInfo_ListRequest proto.InternalMessageInfo -func (m *ListRequest) GetTTL() uint32 { - if m != nil { - return m.TTL - } - return 0 -} - type ListResponse struct { // CID (container id) is list of SHA256 hashes of the container structures CID []CID `protobuf:"bytes,1,rep,name=CID,proto3,customtype=CID" json:"CID"` @@ -423,40 +400,44 @@ func init() { func init() { proto.RegisterFile("container/service.proto", fileDescriptor_e1fa9d7ab2e7ae06) } var fileDescriptor_e1fa9d7ab2e7ae06 = []byte{ - // 520 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x53, 0xcf, 0x6e, 0xd3, 0x4e, - 0x10, 0xee, 0xd6, 0x69, 0xfa, 0xcb, 0xb8, 0xfd, 0x51, 0x56, 0x84, 0x1a, 0x0b, 0xdc, 0xc8, 0xa7, - 0x80, 0x88, 0x2d, 0x42, 0x25, 0x4e, 0x95, 0x20, 0x89, 0x54, 0x15, 0x15, 0x11, 0x6d, 0x7b, 0xe2, - 0x80, 0xe4, 0x98, 0xa9, 0xb1, 0xe4, 0xd8, 0xc6, 0xbb, 0x2e, 0xea, 0x9b, 0xf0, 0x48, 0x3d, 0x72, - 0x44, 0x1c, 0x2a, 0x14, 0x0e, 0x9c, 0x78, 0x07, 0x64, 0xaf, 0xff, 0x25, 0x2d, 0x20, 0x71, 0x59, - 0xcd, 0xce, 0x7c, 0xf3, 0xcd, 0x37, 0x33, 0xbb, 0xb0, 0xeb, 0x46, 0xa1, 0x70, 0xfc, 0x10, 0x13, - 0x9b, 0x63, 0x72, 0xee, 0xbb, 0x68, 0xc5, 0x49, 0x24, 0x22, 0xda, 0xa9, 0x02, 0x7a, 0xb7, 0xc6, - 0x88, 0x8b, 0x18, 0xb9, 0x44, 0xe8, 0x8f, 0x3c, 0x5f, 0xbc, 0x4f, 0x67, 0x96, 0x1b, 0xcd, 0xed, - 0x90, 0xc7, 0xae, 0x3b, 0x78, 0x87, 0xe7, 0x76, 0x88, 0x62, 0xee, 0xc4, 0x36, 0xc7, 0x00, 0x5d, - 0x11, 0x25, 0x05, 0x76, 0xd0, 0xc0, 0x7a, 0x91, 0x17, 0xd9, 0xb9, 0x7b, 0x96, 0x9e, 0xe5, 0xb7, - 0xfc, 0x92, 0x5b, 0x12, 0x6e, 0xfe, 0x20, 0x00, 0xd3, 0x54, 0x30, 0xfc, 0x90, 0x22, 0x17, 0xd4, - 0x86, 0xce, 0x2b, 0xe4, 0xdc, 0xf1, 0xf0, 0x68, 0xa2, 0x91, 0x1e, 0xe9, 0x6f, 0x8d, 0x6e, 0x5f, - 0x5e, 0xed, 0xad, 0x7d, 0xbd, 0xda, 0xab, 0x03, 0xac, 0x36, 0xa9, 0x0e, 0xff, 0x8d, 0x9d, 0xd8, - 0x71, 0x7d, 0x71, 0xa1, 0xad, 0xf7, 0x48, 0xbf, 0xc5, 0xaa, 0x3b, 0x7d, 0x08, 0x9b, 0xaf, 0x3f, - 0x86, 0x98, 0x1c, 0x4d, 0x34, 0x25, 0xa7, 0xba, 0x55, 0x50, 0x95, 0x6e, 0x56, 0x1a, 0xf4, 0x09, - 0x6c, 0x24, 0x69, 0x80, 0x5c, 0x6b, 0xf5, 0x48, 0x5f, 0x1d, 0x76, 0x2d, 0xd9, 0x9c, 0x35, 0x0d, - 0x1c, 0x17, 0xe7, 0x18, 0x0a, 0x96, 0x06, 0x38, 0x6a, 0x65, 0xf9, 0x4c, 0x22, 0xe9, 0x7d, 0xe8, - 0x9c, 0xf8, 0x5e, 0xe8, 0x88, 0x34, 0x41, 0x6d, 0x23, 0xe3, 0x67, 0xb5, 0x83, 0xee, 0x80, 0x72, - 0x7a, 0x7a, 0xac, 0xb5, 0x7b, 0xa4, 0xbf, 0xcd, 0x32, 0xd3, 0x7c, 0x0c, 0x6a, 0xde, 0x28, 0x8f, - 0xa3, 0x90, 0x23, 0x7d, 0x00, 0xca, 0xb8, 0xea, 0x51, 0x2d, 0x84, 0x65, 0x2e, 0x96, 0x1d, 0xe6, - 0x5b, 0xd8, 0x9e, 0x60, 0x80, 0x02, 0xcb, 0xc9, 0xfc, 0x19, 0x5f, 0xd6, 0x5b, 0xaf, 0xea, 0x2d, - 0xeb, 0x53, 0x56, 0xf4, 0x99, 0x3b, 0xf0, 0x7f, 0xc9, 0x2f, 0x05, 0x99, 0x07, 0x00, 0x87, 0x28, - 0xfe, 0xb5, 0x9c, 0xf9, 0x02, 0xd4, 0x3c, 0xbd, 0x68, 0x6f, 0x08, 0x9d, 0x71, 0xf9, 0x96, 0x72, - 0x16, 0x75, 0x78, 0xc7, 0xaa, 0x5e, 0x97, 0x55, 0xc5, 0x58, 0x0d, 0x33, 0x5f, 0x82, 0x7a, 0xec, - 0xf3, 0x4a, 0x42, 0x63, 0x7d, 0xe4, 0x2f, 0xeb, 0xbb, 0x2e, 0x67, 0x00, 0x5b, 0x92, 0x6b, 0x75, - 0xdc, 0xca, 0x4d, 0xfd, 0x0c, 0x7f, 0x12, 0xd8, 0x3c, 0x91, 0xbf, 0x82, 0xee, 0x83, 0x32, 0x4d, - 0x05, 0xed, 0x36, 0xe4, 0xd6, 0x2f, 0x54, 0xbf, 0xbb, 0xea, 0x2e, 0x0a, 0x1c, 0x40, 0x5b, 0x0e, - 0x94, 0x6a, 0x0d, 0xc4, 0xd2, 0x0e, 0xf5, 0x7b, 0x37, 0x44, 0x8a, 0xf4, 0x7d, 0x50, 0x0e, 0x71, - 0xb9, 0x68, 0xbd, 0x8d, 0xa5, 0xa2, 0xcd, 0x29, 0x3f, 0x83, 0x56, 0xd6, 0x25, 0x6d, 0xc6, 0x1b, - 0x23, 0xd4, 0x77, 0xaf, 0xf9, 0x65, 0xe2, 0xe8, 0xf9, 0xe5, 0xc2, 0x20, 0x9f, 0x17, 0x06, 0xf9, - 0xb2, 0x30, 0xc8, 0xb7, 0x85, 0x41, 0x3e, 0x7d, 0x37, 0xd6, 0xde, 0xfc, 0xee, 0x9f, 0x47, 0x67, - 0x7c, 0x20, 0x7f, 0x6e, 0x45, 0x37, 0x6b, 0xe7, 0x8e, 0xa7, 0xbf, 0x02, 0x00, 0x00, 0xff, 0xff, - 0xa3, 0xe9, 0x55, 0x5c, 0x57, 0x04, 0x00, 0x00, + // 586 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x54, 0xcd, 0x6e, 0xd3, 0x4c, + 0x14, 0xed, 0x34, 0x69, 0xda, 0x5c, 0xf7, 0xfb, 0x80, 0x51, 0x43, 0x8d, 0x05, 0x49, 0xe4, 0x55, + 0x40, 0xc4, 0x16, 0xa1, 0x12, 0x6c, 0x90, 0x20, 0x89, 0x54, 0x2a, 0x51, 0x11, 0xb9, 0x12, 0x0b, + 0x76, 0x8e, 0x7b, 0x13, 0x2c, 0x25, 0xb6, 0xf1, 0x8c, 0x83, 0xf2, 0x26, 0xbc, 0x03, 0x2f, 0xc0, + 0x23, 0x74, 0xc1, 0xa2, 0x1b, 0x24, 0xc4, 0x22, 0x42, 0x61, 0xcd, 0x3b, 0x20, 0x8f, 0xc7, 0x3f, + 0x49, 0xcb, 0xcf, 0xae, 0x6c, 0x2c, 0xcf, 0x39, 0xf7, 0x9e, 0x99, 0x73, 0xef, 0xdc, 0x81, 0x7d, + 0xc7, 0xf7, 0xb8, 0xed, 0x7a, 0x18, 0x9a, 0x0c, 0xc3, 0x99, 0xeb, 0xa0, 0x11, 0x84, 0x3e, 0xf7, + 0x69, 0x35, 0x23, 0x34, 0x2a, 0x19, 0x73, 0x8a, 0xdc, 0x4e, 0x68, 0x6d, 0x2f, 0xc5, 0x66, 0x18, + 0xba, 0xa3, 0xb9, 0x44, 0x6b, 0xb9, 0x1a, 0x9f, 0x07, 0xc8, 0x24, 0x7c, 0x6f, 0xec, 0xf2, 0x37, + 0xd1, 0xd0, 0x70, 0xfc, 0xa9, 0xe9, 0xb1, 0xc0, 0x71, 0xda, 0xa7, 0x38, 0x33, 0x3d, 0xe4, 0x53, + 0x3b, 0x30, 0x19, 0x4e, 0xd0, 0xe1, 0x7e, 0x28, 0x63, 0xdb, 0x85, 0xd8, 0xb1, 0x3f, 0xf6, 0x4d, + 0x01, 0x0f, 0xa3, 0x91, 0x58, 0x89, 0x85, 0xf8, 0x4b, 0xc2, 0xf5, 0xcf, 0x9b, 0x00, 0x83, 0x88, + 0x5b, 0xf8, 0x36, 0x42, 0xc6, 0xa9, 0x09, 0xd5, 0x63, 0x64, 0xcc, 0x1e, 0xe3, 0x51, 0x5f, 0x25, + 0x4d, 0xd2, 0xda, 0xed, 0xde, 0x38, 0x5b, 0x34, 0x36, 0xbe, 0x2e, 0x1a, 0x39, 0x61, 0xe5, 0xbf, + 0x54, 0x83, 0x9d, 0x9e, 0x1d, 0xd8, 0x8e, 0xcb, 0xe7, 0xea, 0x66, 0x93, 0xb4, 0xca, 0x56, 0xb6, + 0xa6, 0x77, 0x61, 0xfb, 0xe5, 0x3b, 0x0f, 0xc3, 0xa3, 0xbe, 0x5a, 0x12, 0x52, 0xd7, 0xa4, 0x54, + 0x0a, 0x5b, 0xe9, 0x0f, 0x7d, 0x00, 0x5b, 0x61, 0x34, 0x41, 0xa6, 0x96, 0x9b, 0xa4, 0xa5, 0x74, + 0x6a, 0x46, 0x62, 0xce, 0x18, 0x4c, 0x6c, 0x07, 0xa7, 0xe8, 0x71, 0x2b, 0x9a, 0x60, 0xb7, 0x1c, + 0xe7, 0x5b, 0x49, 0x24, 0xbd, 0x0d, 0xd5, 0x13, 0x77, 0xec, 0xd9, 0x3c, 0x0a, 0x51, 0xdd, 0x8a, + 0xf5, 0xad, 0x1c, 0xa0, 0x8f, 0xa1, 0x7c, 0x8c, 0xdc, 0x56, 0x87, 0x42, 0x4f, 0x33, 0xd2, 0xe6, + 0x48, 0xa3, 0x31, 0xf7, 0x1c, 0xed, 0x53, 0x0c, 0xbb, 0x3b, 0xb1, 0xe8, 0xf9, 0xa2, 0x41, 0x2c, + 0x91, 0x41, 0xfb, 0x50, 0x79, 0x25, 0x7a, 0xa2, 0x3a, 0x22, 0x57, 0x5f, 0xcf, 0x15, 0xac, 0xeb, + 0xd8, 0xdc, 0xf5, 0xbd, 0x0b, 0x1a, 0x32, 0x57, 0xbf, 0x0f, 0x8a, 0x28, 0x2b, 0x0b, 0x7c, 0x8f, + 0x21, 0xbd, 0x03, 0xa5, 0x5e, 0x56, 0x51, 0x45, 0x96, 0x21, 0x86, 0xac, 0xf8, 0xa3, 0x7f, 0x22, + 0xf0, 0x5f, 0x1f, 0x27, 0xc8, 0x31, 0x6d, 0xc4, 0xef, 0x13, 0x56, 0xcd, 0x6f, 0xfe, 0x6b, 0xe6, + 0xaf, 0xc3, 0xff, 0xa9, 0x9b, 0xc4, 0xbf, 0xfe, 0x81, 0x00, 0x1c, 0x22, 0xff, 0x4b, 0x77, 0x57, + 0x7d, 0xfe, 0x67, 0xa0, 0x88, 0xc3, 0xca, 0xe6, 0x75, 0xa0, 0xda, 0x4b, 0xe7, 0x52, 0x9c, 0x59, + 0xe9, 0xec, 0x19, 0xd9, 0xa4, 0x1a, 0x19, 0x67, 0xe5, 0x61, 0xfa, 0x47, 0x02, 0xca, 0x0b, 0x97, + 0x65, 0x8e, 0x0b, 0xb3, 0x40, 0xfe, 0x30, 0x0b, 0x57, 0xed, 0xbe, 0x0d, 0xbb, 0xc9, 0xc9, 0xd7, + 0xef, 0x6e, 0xe9, 0xb2, 0x66, 0x75, 0x7e, 0x10, 0xd8, 0x3e, 0x49, 0xb6, 0xa1, 0x07, 0x50, 0x1a, + 0x44, 0x9c, 0xd6, 0x0a, 0xd5, 0xc9, 0x1f, 0x17, 0xed, 0xe6, 0x3a, 0x2c, 0x37, 0x78, 0x02, 0x95, + 0xe4, 0xba, 0x50, 0xb5, 0x10, 0xb1, 0x32, 0x0f, 0xda, 0xad, 0x4b, 0x18, 0x99, 0x7e, 0x00, 0xa5, + 0x43, 0x5c, 0xdd, 0x34, 0xbf, 0x6a, 0x2b, 0x9b, 0x16, 0x9b, 0xfa, 0x08, 0xca, 0xb1, 0x4b, 0x5a, + 0xe4, 0x0b, 0x0d, 0xd3, 0xf6, 0x2f, 0xe0, 0x49, 0x62, 0xf7, 0xe9, 0xd9, 0xb2, 0x4e, 0xce, 0x97, + 0x75, 0xf2, 0x65, 0x59, 0x27, 0xdf, 0x96, 0x75, 0xf2, 0xfe, 0x7b, 0x7d, 0xe3, 0xf5, 0xaf, 0x9e, + 0x68, 0x7f, 0xc4, 0xda, 0xc9, 0xa3, 0x9b, 0xc9, 0x0d, 0x2b, 0x02, 0x78, 0xf8, 0x33, 0x00, 0x00, + 0xff, 0xff, 0xd2, 0x95, 0x12, 0x0c, 0x3c, 0x06, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -685,11 +666,30 @@ func (m *PutRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } - if m.TTL != 0 { - i = encodeVarintService(dAtA, i, uint64(m.TTL)) - i-- - dAtA[i] = 0x30 + { + size, err := m.RequestVerificationHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x9a + { + size, err := m.RequestMetaHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x92 if len(m.Signature) > 0 { i -= len(m.Signature) copy(dAtA[i:], m.Signature) @@ -796,17 +796,36 @@ func (m *DeleteRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } + { + size, err := m.RequestVerificationHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x9a + { + size, err := m.RequestMetaHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x92 if len(m.Signature) > 0 { i -= len(m.Signature) copy(dAtA[i:], m.Signature) i = encodeVarintService(dAtA, i, uint64(len(m.Signature))) i-- - dAtA[i] = 0x1a - } - if m.TTL != 0 { - i = encodeVarintService(dAtA, i, uint64(m.TTL)) - i-- - dAtA[i] = 0x10 + dAtA[i] = 0x12 } { size := m.CID.Size() @@ -872,11 +891,30 @@ func (m *GetRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } - if m.TTL != 0 { - i = encodeVarintService(dAtA, i, uint64(m.TTL)) - i-- - dAtA[i] = 0x10 + { + size, err := m.RequestVerificationHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x9a + { + size, err := m.RequestMetaHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x92 { size := m.CID.Size() i -= size @@ -953,11 +991,30 @@ func (m *ListRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } - if m.TTL != 0 { - i = encodeVarintService(dAtA, i, uint64(m.TTL)) - i-- - dAtA[i] = 0x10 + { + size, err := m.RequestVerificationHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x9a + { + size, err := m.RequestMetaHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x92 { size := m.OwnerID.Size() i -= size @@ -1042,9 +1099,10 @@ func (m *PutRequest) Size() (n int) { if l > 0 { n += 1 + l + sovService(uint64(l)) } - if m.TTL != 0 { - n += 1 + sovService(uint64(m.TTL)) - } + l = m.RequestMetaHeader.Size() + n += 2 + l + sovService(uint64(l)) + l = m.RequestVerificationHeader.Size() + n += 2 + l + sovService(uint64(l)) if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -1073,13 +1131,14 @@ func (m *DeleteRequest) Size() (n int) { _ = l l = m.CID.Size() n += 1 + l + sovService(uint64(l)) - if m.TTL != 0 { - n += 1 + sovService(uint64(m.TTL)) - } l = len(m.Signature) if l > 0 { n += 1 + l + sovService(uint64(l)) } + l = m.RequestMetaHeader.Size() + n += 2 + l + sovService(uint64(l)) + l = m.RequestVerificationHeader.Size() + n += 2 + l + sovService(uint64(l)) if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -1106,9 +1165,10 @@ func (m *GetRequest) Size() (n int) { _ = l l = m.CID.Size() n += 1 + l + sovService(uint64(l)) - if m.TTL != 0 { - n += 1 + sovService(uint64(m.TTL)) - } + l = m.RequestMetaHeader.Size() + n += 2 + l + sovService(uint64(l)) + l = m.RequestVerificationHeader.Size() + n += 2 + l + sovService(uint64(l)) if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -1139,9 +1199,10 @@ func (m *ListRequest) Size() (n int) { _ = l l = m.OwnerID.Size() n += 1 + l + sovService(uint64(l)) - if m.TTL != 0 { - n += 1 + sovService(uint64(m.TTL)) - } + l = m.RequestMetaHeader.Size() + n += 2 + l + sovService(uint64(l)) + l = m.RequestVerificationHeader.Size() + n += 2 + l + sovService(uint64(l)) if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -1353,11 +1414,11 @@ func (m *PutRequest) Unmarshal(dAtA []byte) error { m.Signature = []byte{} } iNdEx = postIndex - case 6: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TTL", wireType) + case 98: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType) } - m.TTL = 0 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowService @@ -1367,11 +1428,58 @@ func (m *PutRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.TTL |= uint32(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RequestMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 99: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestVerificationHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RequestVerificationHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipService(dAtA[iNdEx:]) @@ -1547,25 +1655,6 @@ func (m *DeleteRequest) Unmarshal(dAtA []byte) error { } iNdEx = postIndex case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TTL", wireType) - } - m.TTL = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.TTL |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Signature", wireType) } @@ -1599,6 +1688,72 @@ func (m *DeleteRequest) Unmarshal(dAtA []byte) error { m.Signature = []byte{} } iNdEx = postIndex + case 98: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RequestMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 99: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestVerificationHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RequestVerificationHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipService(dAtA[iNdEx:]) @@ -1740,11 +1895,11 @@ func (m *GetRequest) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TTL", wireType) + case 98: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType) } - m.TTL = 0 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowService @@ -1754,11 +1909,58 @@ func (m *GetRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.TTL |= uint32(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RequestMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 99: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestVerificationHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RequestVerificationHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipService(dAtA[iNdEx:]) @@ -1936,11 +2138,11 @@ func (m *ListRequest) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TTL", wireType) + case 98: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType) } - m.TTL = 0 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowService @@ -1950,11 +2152,58 @@ func (m *ListRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.TTL |= uint32(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RequestMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 99: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestVerificationHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RequestVerificationHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipService(dAtA[iNdEx:]) diff --git a/container/service.proto b/container/service.proto index 1cf8227..d4d50ca 100644 --- a/container/service.proto +++ b/container/service.proto @@ -2,6 +2,8 @@ syntax = "proto3"; package container; option go_package = "github.com/nspcc-dev/neofs-proto/container"; +import "service/meta.proto"; +import "service/verify.proto"; import "container/types.proto"; import "github.com/nspcc-dev/netmap/selector.proto"; import "github.com/gogo/protobuf/gogoproto/gogo.proto"; @@ -28,23 +30,24 @@ service Service { message PutRequest { // MessageID is a nonce for uniq container id calculation - bytes MessageID = 1 [(gogoproto.customtype) = "MessageID", (gogoproto.nullable) = false]; + bytes MessageID = 1 [(gogoproto.customtype) = "MessageID", (gogoproto.nullable) = false]; // Capacity defines amount of data that can be stored in the container (doesn't used for now). - uint64 Capacity = 2; + uint64 Capacity = 2; // OwnerID is a wallet address - bytes OwnerID = 3 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false]; + bytes OwnerID = 3 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false]; // Rules define storage policy for the object inside the container. - netmap.PlacementRule rules = 4 [(gogoproto.nullable) = false]; + netmap.PlacementRule rules = 4 [(gogoproto.nullable) = false]; // Signature of the user (owner id) - bytes Signature = 5; + bytes Signature = 5; - // TTL must be larger than zero, it decreased in every neofs-node - // Deprecated: will be replaced with RequestMetaHeader (see develop branch) - uint32 TTL = 6; + // RequestMetaHeader contains information about request meta headers (should be embedded into message) + service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) + service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; } message PutResponse { @@ -54,14 +57,15 @@ message PutResponse { message DeleteRequest { // CID (container id) is a SHA256 hash of the container structure - bytes CID = 1 [(gogoproto.customtype) = "CID", (gogoproto.nullable) = false]; - - // TTL must be larger than zero, it decreased in every neofs-node - // Deprecated: will be replaced with RequestMetaHeader (see develop branch) - uint32 TTL = 2; + bytes CID = 1 [(gogoproto.customtype) = "CID", (gogoproto.nullable) = false]; // Signature of the container owner - bytes Signature = 3; + bytes Signature = 2; + + // RequestMetaHeader contains information about request meta headers (should be embedded into message) + service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) + service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; } // DeleteResponse is empty because delete operation is asynchronous and done @@ -71,11 +75,12 @@ message DeleteResponse { } message GetRequest { // CID (container id) is a SHA256 hash of the container structure - bytes CID = 1 [(gogoproto.customtype) = "CID", (gogoproto.nullable) = false]; + bytes CID = 1 [(gogoproto.customtype) = "CID", (gogoproto.nullable) = false]; - // TTL must be larger than zero, it decreased in every neofs-node - // Deprecated: will be replaced with RequestMetaHeader (see develop branch) - uint32 TTL = 2; + // RequestMetaHeader contains information about request meta headers (should be embedded into message) + service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) + service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; } message GetResponse { @@ -85,11 +90,11 @@ message GetResponse { message ListRequest { // OwnerID is a wallet address - bytes OwnerID = 1 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false]; - - // TTL must be larger than zero, it decreased in every neofs-node - // Deprecated: will be replaced with RequestMetaHeader (see develop branch) - uint32 TTL = 2; + bytes OwnerID = 1 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false]; + // RequestMetaHeader contains information about request meta headers (should be embedded into message) + service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) + service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; } message ListResponse { diff --git a/object/service.go b/object/service.go index 098f9c3..8482539 100644 --- a/object/service.go +++ b/object/service.go @@ -31,8 +31,7 @@ type ( // All object operations must have TTL, Epoch, Container ID and // permission of usage previous network map. Request interface { - service.TTLRequest - service.EpochRequest + service.MetaHeader CID() CID AllowPreviousNetMap() bool @@ -124,54 +123,6 @@ func (m *GetResponse) NotFull() bool { return checkIsNotFull(m) } // NotFull checks if protobuf stream provided whole object for put operation. func (m *PutRequest) NotFull() bool { return checkIsNotFull(m) } -// GetTTL returns TTL value from object put request. -func (m *PutRequest) GetTTL() uint32 { return m.GetHeader().TTL } - -// GetEpoch returns epoch value from object put request. -func (m *PutRequest) GetEpoch() uint64 { return m.GetHeader().GetEpoch() } - -// SetTTL sets TTL value into object put request. -func (m *PutRequest) SetTTL(ttl uint32) { m.GetHeader().TTL = ttl } - -// SetTTL sets TTL value into object get request. -func (m *GetRequest) SetTTL(ttl uint32) { m.TTL = ttl } - -// SetTTL sets TTL value into object head request. -func (m *HeadRequest) SetTTL(ttl uint32) { m.TTL = ttl } - -// SetTTL sets TTL value into object search request. -func (m *SearchRequest) SetTTL(ttl uint32) { m.TTL = ttl } - -// SetTTL sets TTL value into object delete request. -func (m *DeleteRequest) SetTTL(ttl uint32) { m.TTL = ttl } - -// SetTTL sets TTL value into object get range request. -func (m *GetRangeRequest) SetTTL(ttl uint32) { m.TTL = ttl } - -// SetTTL sets TTL value into object get range hash request. -func (m *GetRangeHashRequest) SetTTL(ttl uint32) { m.TTL = ttl } - -// SetEpoch sets epoch value into object put request. -func (m *PutRequest) SetEpoch(v uint64) { m.GetHeader().Epoch = v } - -// SetEpoch sets epoch value into object get request. -func (m *GetRequest) SetEpoch(v uint64) { m.Epoch = v } - -// SetEpoch sets epoch value into object head request. -func (m *HeadRequest) SetEpoch(v uint64) { m.Epoch = v } - -// SetEpoch sets epoch value into object search request. -func (m *SearchRequest) SetEpoch(v uint64) { m.Epoch = v } - -// SetEpoch sets epoch value into object delete request. -func (m *DeleteRequest) SetEpoch(v uint64) { m.Epoch = v } - -// SetEpoch sets epoch value into object get range request. -func (m *GetRangeRequest) SetEpoch(v uint64) { m.Epoch = v } - -// SetEpoch sets epoch value into object get range hash request. -func (m *GetRangeHashRequest) SetEpoch(v uint64) { m.Epoch = v } - // CID returns container id value from object put request. func (m *PutRequest) CID() CID { return m.GetHeader().Object.SystemHeader.CID } diff --git a/object/service.pb.go b/object/service.pb.go index b19ed93..d58d391 100644 --- a/object/service.pb.go +++ b/object/service.pb.go @@ -9,6 +9,7 @@ import ( _ "github.com/gogo/protobuf/gogoproto" proto "github.com/golang/protobuf/proto" refs "github.com/nspcc-dev/neofs-proto/refs" + service "github.com/nspcc-dev/neofs-proto/service" session "github.com/nspcc-dev/neofs-proto/session" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" @@ -30,17 +31,15 @@ var _ = math.Inf const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package type GetRequest struct { - // Epoch is set by user to 0, node set epoch to the actual value - // Deprecated: will be replaced with RequestMetaHeader (see develop branch) - Epoch uint64 `protobuf:"varint,1,opt,name=Epoch,proto3" json:"Epoch,omitempty"` // Address of object (container id + object id) - Address refs.Address `protobuf:"bytes,2,opt,name=Address,proto3" json:"Address"` - // TTL must be larger than zero, it decreased in every neofs-node - // Deprecated: will be replaced with RequestMetaHeader (see develop branch) - TTL uint32 `protobuf:"varint,3,opt,name=TTL,proto3" json:"TTL,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Address refs.Address `protobuf:"bytes,1,opt,name=Address,proto3" json:"Address"` + // RequestMetaHeader contains information about request meta headers (should be embedded into message) + service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` + // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) + service.RequestVerificationHeader `protobuf:"bytes,99,opt,name=Verify,proto3,embedded=Verify" json:"Verify"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetRequest) Reset() { *m = GetRequest{} } @@ -72,13 +71,6 @@ func (m *GetRequest) XXX_DiscardUnknown() { var xxx_messageInfo_GetRequest proto.InternalMessageInfo -func (m *GetRequest) GetEpoch() uint64 { - if m != nil { - return m.Epoch - } - return 0 -} - func (m *GetRequest) GetAddress() refs.Address { if m != nil { return m.Address @@ -86,13 +78,6 @@ func (m *GetRequest) GetAddress() refs.Address { return refs.Address{} } -func (m *GetRequest) GetTTL() uint32 { - if m != nil { - return m.TTL - } - return 0 -} - type GetResponse struct { // Types that are valid to be assigned to R: // *GetResponse_Object @@ -181,10 +166,14 @@ type PutRequest struct { // Types that are valid to be assigned to R: // *PutRequest_Header // *PutRequest_Chunk - R isPutRequest_R `protobuf_oneof:"R"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + R isPutRequest_R `protobuf_oneof:"R"` + // RequestMetaHeader contains information about request meta headers (should be embedded into message) + service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` + // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) + service.RequestVerificationHeader `protobuf:"bytes,99,opt,name=Verify,proto3,embedded=Verify" json:"Verify"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *PutRequest) Reset() { *m = PutRequest{} } @@ -262,16 +251,10 @@ func (*PutRequest) XXX_OneofWrappers() []interface{} { } type PutRequest_PutHeader struct { - // Epoch is set by user to 0, node set epoch to the actual value - // Deprecated: will be replaced with RequestMetaHeader (see develop branch) - Epoch uint64 `protobuf:"varint,1,opt,name=Epoch,proto3" json:"Epoch,omitempty"` // Object with at least container id and owner id fields - Object *Object `protobuf:"bytes,2,opt,name=Object,proto3" json:"Object,omitempty"` - // TTL must be larger than zero, it decreased in every neofs-node - // Deprecated: will be replaced with RequestMetaHeader (see develop branch) - TTL uint32 `protobuf:"varint,3,opt,name=TTL,proto3" json:"TTL,omitempty"` + Object *Object `protobuf:"bytes,1,opt,name=Object,proto3" json:"Object,omitempty"` // Token with session public key and user's signature - Token *session.Token `protobuf:"bytes,4,opt,name=Token,proto3" json:"Token,omitempty"` + Token *session.Token `protobuf:"bytes,2,opt,name=Token,proto3" json:"Token,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -306,13 +289,6 @@ func (m *PutRequest_PutHeader) XXX_DiscardUnknown() { var xxx_messageInfo_PutRequest_PutHeader proto.InternalMessageInfo -func (m *PutRequest_PutHeader) GetEpoch() uint64 { - if m != nil { - return m.Epoch - } - return 0 -} - func (m *PutRequest_PutHeader) GetObject() *Object { if m != nil { return m.Object @@ -320,13 +296,6 @@ func (m *PutRequest_PutHeader) GetObject() *Object { return nil } -func (m *PutRequest_PutHeader) GetTTL() uint32 { - if m != nil { - return m.TTL - } - return 0 -} - func (m *PutRequest_PutHeader) GetToken() *session.Token { if m != nil { return m.Token @@ -379,21 +348,19 @@ func (m *PutResponse) GetAddress() refs.Address { } type DeleteRequest struct { - // Epoch is set by user to 0, node set epoch to the actual value - // Deprecated: will be replaced with RequestMetaHeader (see develop branch) - Epoch uint64 `protobuf:"varint,1,opt,name=Epoch,proto3" json:"Epoch,omitempty"` // Address of object (container id + object id) - Address refs.Address `protobuf:"bytes,2,opt,name=Address,proto3" json:"Address"` + Address refs.Address `protobuf:"bytes,1,opt,name=Address,proto3" json:"Address"` // OwnerID is a wallet address - OwnerID OwnerID `protobuf:"bytes,3,opt,name=OwnerID,proto3,customtype=OwnerID" json:"OwnerID"` - // TTL must be larger than zero, it decreased in every neofs-node - // Deprecated: will be replaced with RequestMetaHeader (see develop branch) - TTL uint32 `protobuf:"varint,4,opt,name=TTL,proto3" json:"TTL,omitempty"` + OwnerID OwnerID `protobuf:"bytes,2,opt,name=OwnerID,proto3,customtype=OwnerID" json:"OwnerID"` // Token with session public key and user's signature - Token *session.Token `protobuf:"bytes,5,opt,name=Token,proto3" json:"Token,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Token *session.Token `protobuf:"bytes,3,opt,name=Token,proto3" json:"Token,omitempty"` + // RequestMetaHeader contains information about request meta headers (should be embedded into message) + service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` + // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) + service.RequestVerificationHeader `protobuf:"bytes,99,opt,name=Verify,proto3,embedded=Verify" json:"Verify"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *DeleteRequest) Reset() { *m = DeleteRequest{} } @@ -425,13 +392,6 @@ func (m *DeleteRequest) XXX_DiscardUnknown() { var xxx_messageInfo_DeleteRequest proto.InternalMessageInfo -func (m *DeleteRequest) GetEpoch() uint64 { - if m != nil { - return m.Epoch - } - return 0 -} - func (m *DeleteRequest) GetAddress() refs.Address { if m != nil { return m.Address @@ -439,13 +399,6 @@ func (m *DeleteRequest) GetAddress() refs.Address { return refs.Address{} } -func (m *DeleteRequest) GetTTL() uint32 { - if m != nil { - return m.TTL - } - return 0 -} - func (m *DeleteRequest) GetToken() *session.Token { if m != nil { return m.Token @@ -491,19 +444,17 @@ func (m *DeleteResponse) XXX_DiscardUnknown() { var xxx_messageInfo_DeleteResponse proto.InternalMessageInfo type HeadRequest struct { - // Epoch should be empty on user side, node sets epoch to the actual value - // Deprecated: will be replaced with RequestMetaHeader (see develop branch) - Epoch uint64 `protobuf:"varint,1,opt,name=Epoch,proto3" json:"Epoch,omitempty"` // Address of object (container id + object id) - Address Address `protobuf:"bytes,2,opt,name=Address,proto3,customtype=Address" json:"Address"` + Address Address `protobuf:"bytes,1,opt,name=Address,proto3,customtype=Address" json:"Address"` // FullHeaders can be set true for extended headers in the object - FullHeaders bool `protobuf:"varint,3,opt,name=FullHeaders,proto3" json:"FullHeaders,omitempty"` - // TTL must be larger than zero, it decreased in every neofs-node - // Deprecated: will be replaced with RequestMetaHeader (see develop branch) - TTL uint32 `protobuf:"varint,4,opt,name=TTL,proto3" json:"TTL,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + FullHeaders bool `protobuf:"varint,2,opt,name=FullHeaders,proto3" json:"FullHeaders,omitempty"` + // RequestMetaHeader contains information about request meta headers (should be embedded into message) + service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` + // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) + service.RequestVerificationHeader `protobuf:"bytes,99,opt,name=Verify,proto3,embedded=Verify" json:"Verify"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *HeadRequest) Reset() { *m = HeadRequest{} } @@ -535,13 +486,6 @@ func (m *HeadRequest) XXX_DiscardUnknown() { var xxx_messageInfo_HeadRequest proto.InternalMessageInfo -func (m *HeadRequest) GetEpoch() uint64 { - if m != nil { - return m.Epoch - } - return 0 -} - func (m *HeadRequest) GetFullHeaders() bool { if m != nil { return m.FullHeaders @@ -549,13 +493,6 @@ func (m *HeadRequest) GetFullHeaders() bool { return false } -func (m *HeadRequest) GetTTL() uint32 { - if m != nil { - return m.TTL - } - return 0 -} - type HeadResponse struct { // Object without payload Object *Object `protobuf:"bytes,1,opt,name=Object,proto3" json:"Object,omitempty"` @@ -601,21 +538,19 @@ func (m *HeadResponse) GetObject() *Object { } type SearchRequest struct { - // Epoch is set by user to 0, node set epoch to the actual value - // Deprecated: will be replaced with RequestMetaHeader (see develop branch) - Epoch uint64 `protobuf:"varint,1,opt,name=Epoch,proto3" json:"Epoch,omitempty"` // Version of search query format - Version uint32 `protobuf:"varint,2,opt,name=Version,proto3" json:"Version,omitempty"` + Version uint32 `protobuf:"varint,1,opt,name=Version,proto3" json:"Version,omitempty"` // ContainerID for searching the object - ContainerID CID `protobuf:"bytes,3,opt,name=ContainerID,proto3,customtype=CID" json:"ContainerID"` + ContainerID CID `protobuf:"bytes,2,opt,name=ContainerID,proto3,customtype=CID" json:"ContainerID"` // Query in the binary serialized format - Query []byte `protobuf:"bytes,4,opt,name=Query,proto3" json:"Query,omitempty"` - // TTL must be larger than zero, it decreased in every neofs-node - // Deprecated: will be replaced with RequestMetaHeader (see develop branch) - TTL uint32 `protobuf:"varint,5,opt,name=TTL,proto3" json:"TTL,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Query []byte `protobuf:"bytes,3,opt,name=Query,proto3" json:"Query,omitempty"` + // RequestMetaHeader contains information about request meta headers (should be embedded into message) + service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` + // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) + service.RequestVerificationHeader `protobuf:"bytes,99,opt,name=Verify,proto3,embedded=Verify" json:"Verify"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *SearchRequest) Reset() { *m = SearchRequest{} } @@ -647,13 +582,6 @@ func (m *SearchRequest) XXX_DiscardUnknown() { var xxx_messageInfo_SearchRequest proto.InternalMessageInfo -func (m *SearchRequest) GetEpoch() uint64 { - if m != nil { - return m.Epoch - } - return 0 -} - func (m *SearchRequest) GetVersion() uint32 { if m != nil { return m.Version @@ -668,13 +596,6 @@ func (m *SearchRequest) GetQuery() []byte { return nil } -func (m *SearchRequest) GetTTL() uint32 { - if m != nil { - return m.TTL - } - return 0 -} - type SearchResponse struct { // Addresses of found objects Addresses []refs.Address `protobuf:"bytes,1,rep,name=Addresses,proto3" json:"Addresses"` @@ -720,19 +641,17 @@ func (m *SearchResponse) GetAddresses() []refs.Address { } type GetRangeRequest struct { - // Epoch is set by user to 0, node set epoch to the actual value - // Deprecated: will be replaced with RequestMetaHeader (see develop branch) - Epoch uint64 `protobuf:"varint,1,opt,name=Epoch,proto3" json:"Epoch,omitempty"` // Address of object (container id + object id) - Address refs.Address `protobuf:"bytes,2,opt,name=Address,proto3" json:"Address"` + Address refs.Address `protobuf:"bytes,1,opt,name=Address,proto3" json:"Address"` // Ranges of object's payload to return - Ranges []Range `protobuf:"bytes,3,rep,name=Ranges,proto3" json:"Ranges"` - // TTL must be larger than zero, it decreased in every neofs-node - // Deprecated: will be replaced with RequestMetaHeader (see develop branch) - TTL uint32 `protobuf:"varint,4,opt,name=TTL,proto3" json:"TTL,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Ranges []Range `protobuf:"bytes,2,rep,name=Ranges,proto3" json:"Ranges"` + // RequestMetaHeader contains information about request meta headers (should be embedded into message) + service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` + // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) + service.RequestVerificationHeader `protobuf:"bytes,99,opt,name=Verify,proto3,embedded=Verify" json:"Verify"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetRangeRequest) Reset() { *m = GetRangeRequest{} } @@ -764,13 +683,6 @@ func (m *GetRangeRequest) XXX_DiscardUnknown() { var xxx_messageInfo_GetRangeRequest proto.InternalMessageInfo -func (m *GetRangeRequest) GetEpoch() uint64 { - if m != nil { - return m.Epoch - } - return 0 -} - func (m *GetRangeRequest) GetAddress() refs.Address { if m != nil { return m.Address @@ -785,13 +697,6 @@ func (m *GetRangeRequest) GetRanges() []Range { return nil } -func (m *GetRangeRequest) GetTTL() uint32 { - if m != nil { - return m.TTL - } - return 0 -} - type GetRangeResponse struct { // Fragments of object's payload Fragments [][]byte `protobuf:"bytes,1,rep,name=Fragments,proto3" json:"Fragments,omitempty"` @@ -837,21 +742,19 @@ func (m *GetRangeResponse) GetFragments() [][]byte { } type GetRangeHashRequest struct { - // Epoch is set by user to 0, node set epoch to the actual value - // Deprecated: will be replaced with RequestMetaHeader (see develop branch) - Epoch uint64 `protobuf:"varint,1,opt,name=Epoch,proto3" json:"Epoch,omitempty"` // Address of object (container id + object id) - Address refs.Address `protobuf:"bytes,2,opt,name=Address,proto3" json:"Address"` + Address refs.Address `protobuf:"bytes,1,opt,name=Address,proto3" json:"Address"` // Ranges of object's payload to calculate homomorphic hash - Ranges []Range `protobuf:"bytes,3,rep,name=Ranges,proto3" json:"Ranges"` + Ranges []Range `protobuf:"bytes,2,rep,name=Ranges,proto3" json:"Ranges"` // Salt is used to XOR object's payload ranges before hashing, it can be nil - Salt []byte `protobuf:"bytes,4,opt,name=Salt,proto3" json:"Salt,omitempty"` - // TTL must be larger than zero, it decreased in every neofs-node - // Deprecated: will be replaced with RequestMetaHeader (see develop branch) - TTL uint32 `protobuf:"varint,5,opt,name=TTL,proto3" json:"TTL,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Salt []byte `protobuf:"bytes,3,opt,name=Salt,proto3" json:"Salt,omitempty"` + // RequestMetaHeader contains information about request meta headers (should be embedded into message) + service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` + // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) + service.RequestVerificationHeader `protobuf:"bytes,99,opt,name=Verify,proto3,embedded=Verify" json:"Verify"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetRangeHashRequest) Reset() { *m = GetRangeHashRequest{} } @@ -883,13 +786,6 @@ func (m *GetRangeHashRequest) XXX_DiscardUnknown() { var xxx_messageInfo_GetRangeHashRequest proto.InternalMessageInfo -func (m *GetRangeHashRequest) GetEpoch() uint64 { - if m != nil { - return m.Epoch - } - return 0 -} - func (m *GetRangeHashRequest) GetAddress() refs.Address { if m != nil { return m.Address @@ -911,13 +807,6 @@ func (m *GetRangeHashRequest) GetSalt() []byte { return nil } -func (m *GetRangeHashRequest) GetTTL() uint32 { - if m != nil { - return m.TTL - } - return 0 -} - type GetRangeHashResponse struct { // Hashes is a homomorphic hashes of all ranges Hashes []Hash `protobuf:"bytes,1,rep,name=Hashes,proto3,customtype=Hash" json:"Hashes"` @@ -976,57 +865,59 @@ func init() { func init() { proto.RegisterFile("object/service.proto", fileDescriptor_dfcdf610ade6a9ce) } var fileDescriptor_dfcdf610ade6a9ce = []byte{ - // 793 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x55, 0xc1, 0x4e, 0xdb, 0x4c, - 0x10, 0xce, 0xfe, 0x49, 0x1c, 0x18, 0x3b, 0x10, 0x2d, 0xf9, 0xf9, 0x23, 0xff, 0x28, 0x44, 0x16, - 0x6a, 0x53, 0x55, 0x49, 0x28, 0x95, 0xa0, 0x07, 0x38, 0x34, 0xa1, 0x10, 0xa4, 0x4a, 0xd0, 0x25, - 0xea, 0xa1, 0xb7, 0xc4, 0x59, 0x92, 0x94, 0x60, 0xa7, 0x5e, 0x9b, 0x8a, 0x63, 0x1f, 0xa1, 0x87, - 0x56, 0x3d, 0xf4, 0x15, 0x7a, 0xee, 0x2b, 0x70, 0xec, 0xb1, 0xea, 0x01, 0x55, 0xa9, 0xfa, 0x1e, - 0x95, 0x77, 0xd7, 0xb1, 0x13, 0x42, 0xb8, 0x20, 0xf5, 0xe4, 0x9d, 0x6f, 0x66, 0x77, 0xe6, 0x9b, - 0x6f, 0xbc, 0x0b, 0x59, 0xbb, 0xf5, 0x9a, 0x9a, 0x6e, 0x85, 0x51, 0xe7, 0xbc, 0x67, 0xd2, 0xf2, - 0xc0, 0xb1, 0x5d, 0x1b, 0x2b, 0x02, 0xd5, 0x33, 0x0e, 0x3d, 0x61, 0x15, 0xf7, 0x62, 0x40, 0x99, - 0xf0, 0xe8, 0x58, 0xc6, 0x47, 0xb1, 0x25, 0x46, 0x19, 0xeb, 0xd9, 0xd6, 0x18, 0x58, 0xea, 0xf4, - 0xdc, 0xae, 0xd7, 0x2a, 0x9b, 0xf6, 0x59, 0xa5, 0x63, 0x77, 0xec, 0x0a, 0x87, 0x5b, 0xde, 0x09, - 0xb7, 0xb8, 0xc1, 0x57, 0x22, 0xdc, 0x30, 0x01, 0xf6, 0xa9, 0x4b, 0xe8, 0x1b, 0x8f, 0x32, 0x17, - 0x67, 0x21, 0xf9, 0x6c, 0x60, 0x9b, 0xdd, 0x1c, 0x2a, 0xa0, 0x62, 0x82, 0x08, 0x03, 0x97, 0x20, - 0xf5, 0xb4, 0xdd, 0x76, 0x28, 0x63, 0xb9, 0x7f, 0x0a, 0xa8, 0xa8, 0x6e, 0xa4, 0xcb, 0x7e, 0x7d, - 0x65, 0x09, 0x56, 0x13, 0x97, 0x57, 0xab, 0x31, 0x12, 0xc4, 0xe0, 0x0c, 0xc4, 0x1b, 0x8d, 0xe7, - 0xb9, 0x78, 0x01, 0x15, 0xd3, 0xc4, 0x5f, 0x1a, 0x0d, 0x50, 0x79, 0x12, 0x36, 0xb0, 0x2d, 0x46, - 0x71, 0x11, 0x24, 0x4f, 0x9e, 0x46, 0xdd, 0x58, 0x28, 0x0b, 0xb3, 0x7c, 0xc8, 0x3f, 0xf5, 0x18, - 0x91, 0x7e, 0xbc, 0x0c, 0xc9, 0x5a, 0xd7, 0xb3, 0x4e, 0x79, 0x5e, 0xad, 0x1e, 0x23, 0xc2, 0xac, - 0xc6, 0x01, 0x11, 0xe3, 0x37, 0x02, 0x38, 0xf2, 0x46, 0xb5, 0x6f, 0x82, 0x52, 0xa7, 0xcd, 0x36, - 0x75, 0xe4, 0xa9, 0x2b, 0xc1, 0xa9, 0x61, 0x8c, 0xbf, 0x14, 0x31, 0x7e, 0x0e, 0xb1, 0xba, 0x29, - 0x87, 0xfe, 0x0e, 0xc1, 0xfc, 0x28, 0xfe, 0x86, 0xce, 0xdc, 0x03, 0x45, 0xd4, 0x2c, 0x1b, 0x33, - 0xc1, 0x84, 0x48, 0xef, 0xf5, 0x96, 0xe0, 0x35, 0x48, 0x36, 0xec, 0x53, 0x6a, 0xe5, 0x12, 0x72, - 0xa3, 0xd4, 0xb2, 0xcc, 0x51, 0x22, 0x9c, 0x82, 0xe7, 0x36, 0xa8, 0x9c, 0x82, 0xec, 0x5e, 0x44, - 0x0d, 0x74, 0xbb, 0x1a, 0xc6, 0x57, 0x04, 0xe9, 0x5d, 0xda, 0xa7, 0x2e, 0xbd, 0x53, 0x91, 0x1f, - 0x40, 0xea, 0xf0, 0xad, 0x45, 0x9d, 0x83, 0x5d, 0xce, 0x4a, 0xab, 0x2e, 0xfa, 0xfe, 0x1f, 0x57, - 0xab, 0x01, 0x4c, 0x82, 0x45, 0x40, 0x3e, 0x31, 0x85, 0x7c, 0x72, 0x06, 0x79, 0x23, 0x03, 0x0b, - 0x41, 0xe1, 0x82, 0xba, 0xf1, 0x1e, 0x81, 0xea, 0xeb, 0x31, 0x9b, 0xc9, 0x93, 0x5b, 0x98, 0x8c, - 0x2a, 0x95, 0x40, 0x48, 0xaa, 0x00, 0xea, 0x9e, 0xd7, 0xef, 0x0b, 0xc9, 0x19, 0x27, 0x36, 0x47, - 0xa2, 0xd0, 0x75, 0x2e, 0xc6, 0x26, 0x68, 0xa2, 0x24, 0x29, 0x4f, 0x38, 0x12, 0x68, 0xd6, 0x48, - 0x18, 0x1f, 0x11, 0xa4, 0x8f, 0x69, 0xd3, 0x31, 0xbb, 0xb3, 0xd9, 0xe4, 0x20, 0xf5, 0x92, 0x3a, - 0x7e, 0x77, 0x38, 0x9b, 0x34, 0x09, 0x4c, 0x5c, 0x02, 0xb5, 0x66, 0x5b, 0x6e, 0xb3, 0x17, 0x95, - 0x41, 0x95, 0xe4, 0xe2, 0xb5, 0x83, 0x5d, 0x12, 0xf5, 0xfb, 0xc7, 0xbf, 0xf0, 0xa8, 0x73, 0xc1, - 0x8b, 0xd7, 0x88, 0x30, 0x02, 0x42, 0xc9, 0x90, 0x50, 0x0d, 0x16, 0x82, 0xba, 0x24, 0xa5, 0x47, - 0x30, 0x2f, 0x3b, 0x44, 0xfd, 0x99, 0x8b, 0xdf, 0x34, 0x1c, 0x61, 0x94, 0xf1, 0x01, 0xc1, 0xa2, - 0xff, 0xcb, 0x37, 0xad, 0xce, 0xdd, 0xce, 0xdd, 0x43, 0x50, 0xf8, 0xa1, 0xbe, 0x3a, 0xa2, 0x10, - 0xd9, 0x5e, 0x8e, 0xca, 0x68, 0x19, 0x32, 0x45, 0xad, 0x75, 0xc8, 0x84, 0x65, 0x49, 0x7a, 0x2b, - 0x30, 0xbf, 0xe7, 0x34, 0x3b, 0x67, 0xd4, 0x72, 0x05, 0x3d, 0x8d, 0x84, 0x80, 0xf1, 0x05, 0xc1, - 0x52, 0xb0, 0xa5, 0xde, 0x64, 0xdd, 0xbf, 0xc7, 0x06, 0x43, 0xe2, 0xb8, 0xd9, 0x77, 0xa5, 0x7e, - 0x7c, 0x3d, 0x45, 0xbe, 0x6d, 0xc8, 0x8e, 0x97, 0x2b, 0x59, 0xae, 0x81, 0xe2, 0xdb, 0x52, 0x41, - 0xad, 0xaa, 0xc9, 0x41, 0x49, 0xf0, 0x28, 0xe9, 0xdb, 0xf8, 0x1c, 0x87, 0xd4, 0xb1, 0x78, 0x92, - 0xf0, 0x3a, 0xc4, 0xf7, 0xa9, 0x8b, 0x71, 0x50, 0x53, 0xf8, 0x4e, 0xe8, 0x4b, 0x63, 0x98, 0xc8, - 0xb0, 0x8e, 0xfc, 0x1d, 0x47, 0x5e, 0x64, 0x47, 0x78, 0xf3, 0x86, 0x3b, 0x22, 0x57, 0x59, 0x11, - 0xe1, 0x2d, 0x50, 0xc4, 0x3f, 0x8e, 0xff, 0x0d, 0x02, 0xc6, 0x2e, 0x2b, 0x7d, 0x79, 0x12, 0x1e, - 0xcd, 0x64, 0xc2, 0xff, 0xed, 0xf0, 0xe8, 0xdc, 0xc8, 0xbd, 0xa0, 0x67, 0xc7, 0x41, 0xb9, 0x65, - 0x0b, 0x14, 0x31, 0xd8, 0x61, 0xae, 0xb1, 0x1f, 0x30, 0xcc, 0x35, 0x31, 0xff, 0x3b, 0x30, 0x17, - 0xb4, 0x14, 0xff, 0x17, 0x65, 0x1e, 0x99, 0x6e, 0x3d, 0x77, 0xdd, 0x21, 0xb7, 0x1f, 0x80, 0x16, - 0x55, 0x04, 0xff, 0x3f, 0x19, 0x19, 0x19, 0x2b, 0x7d, 0x65, 0xba, 0x53, 0x1c, 0x55, 0xdd, 0xb9, - 0x1c, 0xe6, 0xd1, 0xb7, 0x61, 0x1e, 0x7d, 0x1f, 0xe6, 0xd1, 0xcf, 0x61, 0x1e, 0x7d, 0xfa, 0x95, - 0x8f, 0xbd, 0xba, 0x1f, 0x79, 0xf2, 0x2d, 0x36, 0x30, 0xcd, 0x52, 0x9b, 0x9e, 0x57, 0x2c, 0x6a, - 0x9f, 0xb0, 0x92, 0x78, 0xf0, 0xc5, 0x99, 0x2d, 0x85, 0x5b, 0x8f, 0xff, 0x04, 0x00, 0x00, 0xff, - 0xff, 0x37, 0xfc, 0x5a, 0x85, 0x7d, 0x08, 0x00, 0x00, + // 827 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x56, 0xcd, 0x4e, 0x1b, 0x49, + 0x10, 0xf6, 0xd8, 0x66, 0x0c, 0x65, 0x1b, 0x50, 0xe3, 0x65, 0xad, 0x59, 0x64, 0xd0, 0x08, 0xed, + 0x7a, 0xb5, 0xf2, 0x98, 0x25, 0x12, 0x70, 0x80, 0x43, 0x6c, 0x0b, 0xcc, 0x21, 0x82, 0x0c, 0x08, + 0x29, 0xb9, 0x8d, 0xc7, 0xed, 0x9f, 0x60, 0x66, 0x9c, 0xf9, 0x21, 0xe2, 0x01, 0x72, 0xce, 0x35, + 0x87, 0xbc, 0x49, 0xf2, 0x00, 0x1c, 0x39, 0x46, 0x39, 0xa0, 0xc8, 0x39, 0xe5, 0x90, 0x3c, 0x43, + 0x34, 0xdd, 0xd5, 0x9e, 0xb1, 0x09, 0x24, 0xe1, 0x10, 0x9f, 0xdc, 0xf5, 0xd5, 0x57, 0x55, 0x5d, + 0x5f, 0x57, 0xb7, 0x07, 0x72, 0x76, 0xe3, 0x19, 0x35, 0xbd, 0xb2, 0x4b, 0x9d, 0xf3, 0xae, 0x49, + 0xb5, 0xbe, 0x63, 0x7b, 0x36, 0x91, 0x39, 0xaa, 0xcc, 0x3b, 0xb4, 0xe5, 0x96, 0xbd, 0x8b, 0x3e, + 0x75, 0xb9, 0x47, 0x21, 0xc8, 0x8f, 0x62, 0x0b, 0x2e, 0x75, 0xdd, 0xae, 0x6d, 0x8d, 0x12, 0x31, + 0x63, 0xf9, 0x8c, 0x7a, 0x06, 0x62, 0x39, 0x81, 0x9d, 0x53, 0xa7, 0xdb, 0xba, 0x40, 0xb4, 0xd4, + 0xee, 0x7a, 0x1d, 0xbf, 0xa1, 0x99, 0xf6, 0x59, 0xb9, 0x6d, 0xb7, 0xed, 0x32, 0x83, 0x1b, 0x7e, + 0x8b, 0x59, 0xcc, 0x60, 0x2b, 0x4e, 0x57, 0xdf, 0x4a, 0x00, 0x7b, 0xd4, 0xd3, 0xe9, 0x73, 0x9f, + 0xba, 0x1e, 0x29, 0x41, 0xea, 0x61, 0xb3, 0xe9, 0x50, 0xd7, 0xcd, 0x4b, 0x2b, 0x52, 0x31, 0xbd, + 0x9e, 0xd5, 0x82, 0x4d, 0x6b, 0x08, 0x56, 0x92, 0x97, 0xd7, 0xcb, 0x31, 0x5d, 0x70, 0xc8, 0x16, + 0x24, 0x1f, 0x51, 0xcf, 0xc8, 0x37, 0x18, 0x57, 0xd1, 0x44, 0xdf, 0x98, 0x2e, 0xf0, 0xd5, 0xa9, + 0xd1, 0xa4, 0x4e, 0x65, 0x3a, 0x08, 0xbc, 0xba, 0x5e, 0x96, 0x74, 0x16, 0x41, 0x6a, 0x20, 0x9f, + 0xb0, 0x6d, 0xe7, 0x4d, 0x16, 0xab, 0x8e, 0xc7, 0x32, 0x6f, 0xd7, 0x34, 0xbc, 0xae, 0x6d, 0xdd, + 0xc8, 0x81, 0xb1, 0xea, 0x31, 0xa4, 0xd9, 0xe6, 0xdd, 0xbe, 0x6d, 0xb9, 0x94, 0x14, 0x01, 0xa5, + 0xc6, 0xcd, 0xcf, 0x6a, 0xdc, 0xd4, 0x0e, 0xd8, 0x4f, 0x3d, 0xa6, 0xa3, 0x9f, 0x2c, 0xc2, 0x54, + 0xb5, 0xe3, 0x5b, 0xa7, 0xf9, 0xf8, 0x8a, 0x54, 0xcc, 0xd4, 0x63, 0x3a, 0x37, 0x2b, 0x09, 0x90, + 0x74, 0xf5, 0x5d, 0x1c, 0xe0, 0xd0, 0x1f, 0x6a, 0xb2, 0x01, 0x32, 0xdf, 0x00, 0x66, 0x5d, 0x12, + 0x59, 0x43, 0x4e, 0xb0, 0xe4, 0x9c, 0xa0, 0x06, 0x5f, 0xdd, 0x56, 0x63, 0xd2, 0xa2, 0x29, 0x4f, + 0x60, 0x66, 0xb8, 0x5d, 0xf2, 0x37, 0xc8, 0x07, 0x77, 0x48, 0xa6, 0xa3, 0x97, 0xac, 0xc2, 0xd4, + 0xb1, 0x7d, 0x4a, 0x2d, 0xd6, 0x4c, 0x40, 0xc3, 0x29, 0xd5, 0x18, 0xaa, 0x73, 0x27, 0x97, 0x6f, + 0x1b, 0xd2, 0x4c, 0x19, 0x3c, 0x94, 0x5f, 0x1b, 0x29, 0xf5, 0x55, 0x1c, 0xb2, 0x35, 0xda, 0xa3, + 0x1e, 0xbd, 0xe7, 0x4c, 0xfe, 0x0b, 0xa9, 0x83, 0x17, 0x16, 0x75, 0xf6, 0x6b, 0x5c, 0xf8, 0xca, + 0x5c, 0xe0, 0xff, 0x70, 0xbd, 0x2c, 0x60, 0x5d, 0x2c, 0xc2, 0xa6, 0x12, 0x77, 0x34, 0x35, 0xf1, + 0x21, 0x9f, 0x87, 0x59, 0x21, 0x08, 0x97, 0x54, 0xfd, 0x2c, 0x41, 0x3a, 0xa0, 0x0b, 0x85, 0xb6, + 0x7e, 0xa0, 0xd0, 0x50, 0x01, 0x04, 0x42, 0xb1, 0x56, 0x20, 0xbd, 0xeb, 0xf7, 0x7a, 0xbc, 0xb6, + 0xcb, 0x04, 0x9b, 0xd6, 0xa3, 0xd0, 0xc4, 0xbb, 0xdf, 0x80, 0x0c, 0x6f, 0x15, 0xc7, 0xe9, 0x27, + 0x07, 0x56, 0xfd, 0x2a, 0x41, 0xf6, 0x88, 0x1a, 0x8e, 0xd9, 0x11, 0x2a, 0xe5, 0x21, 0x75, 0x42, + 0x9d, 0xe0, 0x7c, 0x59, 0x68, 0x56, 0x17, 0x26, 0x29, 0x41, 0xba, 0x6a, 0x5b, 0x9e, 0xd1, 0x8d, + 0x8e, 0x4d, 0x1a, 0x45, 0x4b, 0x54, 0xf7, 0x6b, 0x7a, 0xd4, 0x4f, 0x72, 0x30, 0xf5, 0xd8, 0xa7, + 0xce, 0x05, 0x1b, 0x9b, 0x8c, 0xce, 0x8d, 0x89, 0x0b, 0x55, 0x85, 0x59, 0xd1, 0x2f, 0x4a, 0xf5, + 0x3f, 0xcc, 0xe0, 0x39, 0xd3, 0x60, 0x30, 0x12, 0xb7, 0x5d, 0x9d, 0x90, 0xa5, 0x7e, 0x91, 0x60, + 0x2e, 0x78, 0x51, 0x0d, 0xab, 0x7d, 0xdf, 0xfb, 0xf7, 0x1f, 0xc8, 0x2c, 0x3c, 0x98, 0x26, 0x5e, + 0x12, 0x0f, 0x88, 0xa1, 0xc8, 0x46, 0xca, 0xc4, 0x45, 0x5b, 0x83, 0xf9, 0xb0, 0x5d, 0x94, 0x6d, + 0x09, 0x66, 0x76, 0x1d, 0xa3, 0x7d, 0x46, 0x2d, 0x8f, 0xcb, 0x96, 0xd1, 0x43, 0x40, 0x7d, 0x19, + 0x87, 0x05, 0x11, 0x52, 0x37, 0xdc, 0xce, 0xef, 0x50, 0x89, 0x40, 0xf2, 0xc8, 0xe8, 0x79, 0x38, + 0x6f, 0x6c, 0x3d, 0x71, 0xe5, 0xb6, 0x21, 0x37, 0x2a, 0x03, 0xaa, 0xb7, 0x0a, 0x72, 0x60, 0xe3, + 0xc4, 0x65, 0x2a, 0x19, 0xbc, 0x46, 0x49, 0xc6, 0x42, 0xdf, 0xfa, 0x9b, 0x04, 0xa4, 0x8e, 0x78, + 0x55, 0xb2, 0x06, 0x89, 0x3d, 0xea, 0x11, 0x22, 0x14, 0x08, 0x3f, 0x47, 0x94, 0x85, 0x11, 0x8c, + 0x57, 0x58, 0x93, 0x82, 0x88, 0x43, 0x3f, 0x12, 0x11, 0xfe, 0x11, 0x87, 0x11, 0x91, 0xbf, 0xa0, + 0xa2, 0x44, 0x36, 0x41, 0xe6, 0x6f, 0x28, 0xf9, 0x43, 0x10, 0x46, 0xfe, 0x64, 0x94, 0xc5, 0x71, + 0x78, 0x78, 0x87, 0x92, 0x81, 0x04, 0x64, 0x98, 0x37, 0xf2, 0xee, 0x2a, 0xb9, 0x51, 0x10, 0x43, + 0x36, 0x41, 0xe6, 0x17, 0x31, 0xac, 0x35, 0xf2, 0x10, 0x85, 0xb5, 0xc6, 0xee, 0xeb, 0x0e, 0x4c, + 0x0b, 0x49, 0xc9, 0x9f, 0xd1, 0xce, 0x23, 0xb7, 0x51, 0xc9, 0xdf, 0x74, 0x60, 0xf8, 0x3e, 0x64, + 0xa2, 0x27, 0x42, 0xfe, 0x1a, 0x67, 0x46, 0xc6, 0x55, 0x59, 0xfa, 0xbe, 0x93, 0xa7, 0xaa, 0xec, + 0x5c, 0x0e, 0x0a, 0xd2, 0xd5, 0xa0, 0x20, 0xbd, 0x1f, 0x14, 0xa4, 0x8f, 0x83, 0x82, 0xf4, 0xfa, + 0x53, 0x21, 0xf6, 0xf4, 0x9f, 0xc8, 0xa7, 0xa5, 0xe5, 0xf6, 0x4d, 0xb3, 0xd4, 0xa4, 0xe7, 0x65, + 0x8b, 0xda, 0x2d, 0xb7, 0xc4, 0x3f, 0x2c, 0x79, 0xce, 0x86, 0xcc, 0xac, 0x07, 0xdf, 0x02, 0x00, + 0x00, 0xff, 0xff, 0x96, 0xdf, 0x01, 0x74, 0x0f, 0x0b, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1459,11 +1350,30 @@ func (m *GetRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } - if m.TTL != 0 { - i = encodeVarintService(dAtA, i, uint64(m.TTL)) - i-- - dAtA[i] = 0x18 + { + size, err := m.RequestVerificationHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x9a + { + size, err := m.RequestMetaHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x92 { size, err := m.Address.MarshalToSizedBuffer(dAtA[:i]) if err != nil { @@ -1473,12 +1383,7 @@ func (m *GetRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintService(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x12 - if m.Epoch != 0 { - i = encodeVarintService(dAtA, i, uint64(m.Epoch)) - i-- - dAtA[i] = 0x8 - } + dAtA[i] = 0xa return len(dAtA) - i, nil } @@ -1579,6 +1484,30 @@ func (m *PutRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } + { + size, err := m.RequestVerificationHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x9a + { + size, err := m.RequestMetaHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x92 if m.R != nil { { size := m.R.Size() @@ -1662,12 +1591,7 @@ func (m *PutRequest_PutHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintService(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x22 - } - if m.TTL != 0 { - i = encodeVarintService(dAtA, i, uint64(m.TTL)) - i-- - dAtA[i] = 0x18 + dAtA[i] = 0x12 } if m.Object != nil { { @@ -1679,12 +1603,7 @@ func (m *PutRequest_PutHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintService(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x12 - } - if m.Epoch != 0 { - i = encodeVarintService(dAtA, i, uint64(m.Epoch)) - i-- - dAtA[i] = 0x8 + dAtA[i] = 0xa } return len(dAtA) - i, nil } @@ -1750,6 +1669,30 @@ func (m *DeleteRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } + { + size, err := m.RequestVerificationHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x9a + { + size, err := m.RequestMetaHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x92 if m.Token != nil { { size, err := m.Token.MarshalToSizedBuffer(dAtA[:i]) @@ -1760,12 +1703,7 @@ func (m *DeleteRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintService(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x2a - } - if m.TTL != 0 { - i = encodeVarintService(dAtA, i, uint64(m.TTL)) - i-- - dAtA[i] = 0x20 + dAtA[i] = 0x1a } { size := m.OwnerID.Size() @@ -1776,7 +1714,7 @@ func (m *DeleteRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintService(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x1a + dAtA[i] = 0x12 { size, err := m.Address.MarshalToSizedBuffer(dAtA[:i]) if err != nil { @@ -1786,12 +1724,7 @@ func (m *DeleteRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintService(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x12 - if m.Epoch != 0 { - i = encodeVarintService(dAtA, i, uint64(m.Epoch)) - i-- - dAtA[i] = 0x8 - } + dAtA[i] = 0xa return len(dAtA) - i, nil } @@ -1846,11 +1779,30 @@ func (m *HeadRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } - if m.TTL != 0 { - i = encodeVarintService(dAtA, i, uint64(m.TTL)) - i-- - dAtA[i] = 0x20 + { + size, err := m.RequestVerificationHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x9a + { + size, err := m.RequestMetaHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x92 if m.FullHeaders { i-- if m.FullHeaders { @@ -1859,7 +1811,7 @@ func (m *HeadRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0 } i-- - dAtA[i] = 0x18 + dAtA[i] = 0x10 } { size := m.Address.Size() @@ -1870,12 +1822,7 @@ func (m *HeadRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintService(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x12 - if m.Epoch != 0 { - i = encodeVarintService(dAtA, i, uint64(m.Epoch)) - i-- - dAtA[i] = 0x8 - } + dAtA[i] = 0xa return len(dAtA) - i, nil } @@ -1942,17 +1889,36 @@ func (m *SearchRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } - if m.TTL != 0 { - i = encodeVarintService(dAtA, i, uint64(m.TTL)) - i-- - dAtA[i] = 0x28 + { + size, err := m.RequestVerificationHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x9a + { + size, err := m.RequestMetaHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x92 if len(m.Query) > 0 { i -= len(m.Query) copy(dAtA[i:], m.Query) i = encodeVarintService(dAtA, i, uint64(len(m.Query))) i-- - dAtA[i] = 0x22 + dAtA[i] = 0x1a } { size := m.ContainerID.Size() @@ -1963,15 +1929,10 @@ func (m *SearchRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintService(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x1a + dAtA[i] = 0x12 if m.Version != 0 { i = encodeVarintService(dAtA, i, uint64(m.Version)) i-- - dAtA[i] = 0x10 - } - if m.Epoch != 0 { - i = encodeVarintService(dAtA, i, uint64(m.Epoch)) - i-- dAtA[i] = 0x8 } return len(dAtA) - i, nil @@ -2042,11 +2003,30 @@ func (m *GetRangeRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } - if m.TTL != 0 { - i = encodeVarintService(dAtA, i, uint64(m.TTL)) - i-- - dAtA[i] = 0x20 + { + size, err := m.RequestVerificationHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x9a + { + size, err := m.RequestMetaHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x92 if len(m.Ranges) > 0 { for iNdEx := len(m.Ranges) - 1; iNdEx >= 0; iNdEx-- { { @@ -2058,7 +2038,7 @@ func (m *GetRangeRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintService(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x1a + dAtA[i] = 0x12 } } { @@ -2070,12 +2050,7 @@ func (m *GetRangeRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintService(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x12 - if m.Epoch != 0 { - i = encodeVarintService(dAtA, i, uint64(m.Epoch)) - i-- - dAtA[i] = 0x8 - } + dAtA[i] = 0xa return len(dAtA) - i, nil } @@ -2139,17 +2114,36 @@ func (m *GetRangeHashRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } - if m.TTL != 0 { - i = encodeVarintService(dAtA, i, uint64(m.TTL)) - i-- - dAtA[i] = 0x28 + { + size, err := m.RequestVerificationHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x9a + { + size, err := m.RequestMetaHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x92 if len(m.Salt) > 0 { i -= len(m.Salt) copy(dAtA[i:], m.Salt) i = encodeVarintService(dAtA, i, uint64(len(m.Salt))) i-- - dAtA[i] = 0x22 + dAtA[i] = 0x1a } if len(m.Ranges) > 0 { for iNdEx := len(m.Ranges) - 1; iNdEx >= 0; iNdEx-- { @@ -2162,7 +2156,7 @@ func (m *GetRangeHashRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintService(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x1a + dAtA[i] = 0x12 } } { @@ -2174,12 +2168,7 @@ func (m *GetRangeHashRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintService(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x12 - if m.Epoch != 0 { - i = encodeVarintService(dAtA, i, uint64(m.Epoch)) - i-- - dAtA[i] = 0x8 - } + dAtA[i] = 0xa return len(dAtA) - i, nil } @@ -2241,14 +2230,12 @@ func (m *GetRequest) Size() (n int) { } var l int _ = l - if m.Epoch != 0 { - n += 1 + sovService(uint64(m.Epoch)) - } l = m.Address.Size() n += 1 + l + sovService(uint64(l)) - if m.TTL != 0 { - n += 1 + sovService(uint64(m.TTL)) - } + l = m.RequestMetaHeader.Size() + n += 2 + l + sovService(uint64(l)) + l = m.RequestVerificationHeader.Size() + n += 2 + l + sovService(uint64(l)) if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -2303,6 +2290,10 @@ func (m *PutRequest) Size() (n int) { if m.R != nil { n += m.R.Size() } + l = m.RequestMetaHeader.Size() + n += 2 + l + sovService(uint64(l)) + l = m.RequestVerificationHeader.Size() + n += 2 + l + sovService(uint64(l)) if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -2339,16 +2330,10 @@ func (m *PutRequest_PutHeader) Size() (n int) { } var l int _ = l - if m.Epoch != 0 { - n += 1 + sovService(uint64(m.Epoch)) - } if m.Object != nil { l = m.Object.Size() n += 1 + l + sovService(uint64(l)) } - if m.TTL != 0 { - n += 1 + sovService(uint64(m.TTL)) - } if m.Token != nil { l = m.Token.Size() n += 1 + l + sovService(uint64(l)) @@ -2379,20 +2364,18 @@ func (m *DeleteRequest) Size() (n int) { } var l int _ = l - if m.Epoch != 0 { - n += 1 + sovService(uint64(m.Epoch)) - } l = m.Address.Size() n += 1 + l + sovService(uint64(l)) l = m.OwnerID.Size() n += 1 + l + sovService(uint64(l)) - if m.TTL != 0 { - n += 1 + sovService(uint64(m.TTL)) - } if m.Token != nil { l = m.Token.Size() n += 1 + l + sovService(uint64(l)) } + l = m.RequestMetaHeader.Size() + n += 2 + l + sovService(uint64(l)) + l = m.RequestVerificationHeader.Size() + n += 2 + l + sovService(uint64(l)) if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -2417,17 +2400,15 @@ func (m *HeadRequest) Size() (n int) { } var l int _ = l - if m.Epoch != 0 { - n += 1 + sovService(uint64(m.Epoch)) - } l = m.Address.Size() n += 1 + l + sovService(uint64(l)) if m.FullHeaders { n += 2 } - if m.TTL != 0 { - n += 1 + sovService(uint64(m.TTL)) - } + l = m.RequestMetaHeader.Size() + n += 2 + l + sovService(uint64(l)) + l = m.RequestVerificationHeader.Size() + n += 2 + l + sovService(uint64(l)) if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -2456,9 +2437,6 @@ func (m *SearchRequest) Size() (n int) { } var l int _ = l - if m.Epoch != 0 { - n += 1 + sovService(uint64(m.Epoch)) - } if m.Version != 0 { n += 1 + sovService(uint64(m.Version)) } @@ -2468,9 +2446,10 @@ func (m *SearchRequest) Size() (n int) { if l > 0 { n += 1 + l + sovService(uint64(l)) } - if m.TTL != 0 { - n += 1 + sovService(uint64(m.TTL)) - } + l = m.RequestMetaHeader.Size() + n += 2 + l + sovService(uint64(l)) + l = m.RequestVerificationHeader.Size() + n += 2 + l + sovService(uint64(l)) if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -2501,9 +2480,6 @@ func (m *GetRangeRequest) Size() (n int) { } var l int _ = l - if m.Epoch != 0 { - n += 1 + sovService(uint64(m.Epoch)) - } l = m.Address.Size() n += 1 + l + sovService(uint64(l)) if len(m.Ranges) > 0 { @@ -2512,9 +2488,10 @@ func (m *GetRangeRequest) Size() (n int) { n += 1 + l + sovService(uint64(l)) } } - if m.TTL != 0 { - n += 1 + sovService(uint64(m.TTL)) - } + l = m.RequestMetaHeader.Size() + n += 2 + l + sovService(uint64(l)) + l = m.RequestVerificationHeader.Size() + n += 2 + l + sovService(uint64(l)) if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -2545,9 +2522,6 @@ func (m *GetRangeHashRequest) Size() (n int) { } var l int _ = l - if m.Epoch != 0 { - n += 1 + sovService(uint64(m.Epoch)) - } l = m.Address.Size() n += 1 + l + sovService(uint64(l)) if len(m.Ranges) > 0 { @@ -2560,9 +2534,10 @@ func (m *GetRangeHashRequest) Size() (n int) { if l > 0 { n += 1 + l + sovService(uint64(l)) } - if m.TTL != 0 { - n += 1 + sovService(uint64(m.TTL)) - } + l = m.RequestMetaHeader.Size() + n += 2 + l + sovService(uint64(l)) + l = m.RequestVerificationHeader.Size() + n += 2 + l + sovService(uint64(l)) if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -2623,25 +2598,6 @@ func (m *GetRequest) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Epoch", wireType) - } - m.Epoch = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Epoch |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) } @@ -2674,11 +2630,11 @@ func (m *GetRequest) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TTL", wireType) + case 98: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType) } - m.TTL = 0 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowService @@ -2688,11 +2644,58 @@ func (m *GetRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.TTL |= uint32(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RequestMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 99: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestVerificationHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RequestVerificationHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipService(dAtA[iNdEx:]) @@ -2937,6 +2940,72 @@ func (m *PutRequest) Unmarshal(dAtA []byte) error { copy(v, dAtA[iNdEx:postIndex]) m.R = &PutRequest_Chunk{v} iNdEx = postIndex + case 98: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RequestMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 99: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestVerificationHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RequestVerificationHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipService(dAtA[iNdEx:]) @@ -2992,25 +3061,6 @@ func (m *PutRequest_PutHeader) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Epoch", wireType) - } - m.Epoch = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Epoch |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Object", wireType) } @@ -3046,26 +3096,7 @@ func (m *PutRequest_PutHeader) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TTL", wireType) - } - m.TTL = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.TTL |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: + case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Token", wireType) } @@ -3243,25 +3274,6 @@ func (m *DeleteRequest) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Epoch", wireType) - } - m.Epoch = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Epoch |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) } @@ -3294,7 +3306,7 @@ func (m *DeleteRequest) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 3: + case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field OwnerID", wireType) } @@ -3327,26 +3339,7 @@ func (m *DeleteRequest) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TTL", wireType) - } - m.TTL = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.TTL |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 5: + case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Token", wireType) } @@ -3382,6 +3375,72 @@ func (m *DeleteRequest) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 98: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RequestMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 99: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestVerificationHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RequestVerificationHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipService(dAtA[iNdEx:]) @@ -3491,25 +3550,6 @@ func (m *HeadRequest) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Epoch", wireType) - } - m.Epoch = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Epoch |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) } @@ -3542,7 +3582,7 @@ func (m *HeadRequest) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 3: + case 2: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field FullHeaders", wireType) } @@ -3562,11 +3602,11 @@ func (m *HeadRequest) Unmarshal(dAtA []byte) error { } } m.FullHeaders = bool(v != 0) - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TTL", wireType) + case 98: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType) } - m.TTL = 0 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowService @@ -3576,11 +3616,58 @@ func (m *HeadRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.TTL |= uint32(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RequestMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 99: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestVerificationHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RequestVerificationHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipService(dAtA[iNdEx:]) @@ -3726,25 +3813,6 @@ func (m *SearchRequest) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Epoch", wireType) - } - m.Epoch = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Epoch |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) } @@ -3763,7 +3831,7 @@ func (m *SearchRequest) Unmarshal(dAtA []byte) error { break } } - case 3: + case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ContainerID", wireType) } @@ -3796,7 +3864,7 @@ func (m *SearchRequest) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 4: + case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Query", wireType) } @@ -3830,11 +3898,11 @@ func (m *SearchRequest) Unmarshal(dAtA []byte) error { m.Query = []byte{} } iNdEx = postIndex - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TTL", wireType) + case 98: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType) } - m.TTL = 0 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowService @@ -3844,11 +3912,58 @@ func (m *SearchRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.TTL |= uint32(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RequestMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 99: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestVerificationHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RequestVerificationHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipService(dAtA[iNdEx:]) @@ -3992,25 +4107,6 @@ func (m *GetRangeRequest) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Epoch", wireType) - } - m.Epoch = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Epoch |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) } @@ -4043,7 +4139,7 @@ func (m *GetRangeRequest) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 3: + case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Ranges", wireType) } @@ -4077,11 +4173,11 @@ func (m *GetRangeRequest) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TTL", wireType) + case 98: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType) } - m.TTL = 0 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowService @@ -4091,11 +4187,58 @@ func (m *GetRangeRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.TTL |= uint32(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RequestMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 99: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestVerificationHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RequestVerificationHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipService(dAtA[iNdEx:]) @@ -4237,25 +4380,6 @@ func (m *GetRangeHashRequest) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Epoch", wireType) - } - m.Epoch = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Epoch |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) } @@ -4288,7 +4412,7 @@ func (m *GetRangeHashRequest) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 3: + case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Ranges", wireType) } @@ -4322,7 +4446,7 @@ func (m *GetRangeHashRequest) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 4: + case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Salt", wireType) } @@ -4356,11 +4480,11 @@ func (m *GetRangeHashRequest) Unmarshal(dAtA []byte) error { m.Salt = []byte{} } iNdEx = postIndex - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TTL", wireType) + case 98: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType) } - m.TTL = 0 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowService @@ -4370,11 +4494,58 @@ func (m *GetRangeHashRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.TTL |= uint32(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RequestMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 99: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestVerificationHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RequestVerificationHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipService(dAtA[iNdEx:]) diff --git a/object/service.proto b/object/service.proto index 7a971db..6abe8ed 100644 --- a/object/service.proto +++ b/object/service.proto @@ -5,6 +5,8 @@ option go_package = "github.com/nspcc-dev/neofs-proto/object"; import "refs/types.proto"; import "object/types.proto"; import "session/types.proto"; +import "service/meta.proto"; +import "service/verify.proto"; import "github.com/gogo/protobuf/gogoproto/gogo.proto"; option (gogoproto.stable_marshaler_all) = true; @@ -52,14 +54,12 @@ service Service { } message GetRequest { - // Epoch is set by user to 0, node set epoch to the actual value - // Deprecated: will be replaced with RequestMetaHeader (see develop branch) - uint64 Epoch = 1; // Address of object (container id + object id) - refs.Address Address = 2 [(gogoproto.nullable) = false]; - // TTL must be larger than zero, it decreased in every neofs-node - // Deprecated: will be replaced with RequestMetaHeader (see develop branch) - uint32 TTL = 3; + refs.Address Address = 1 [(gogoproto.nullable) = false]; + // RequestMetaHeader contains information about request meta headers (should be embedded into message) + service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) + service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; } message GetResponse { @@ -73,16 +73,10 @@ message GetResponse { message PutRequest { message PutHeader { - // Epoch is set by user to 0, node set epoch to the actual value - // Deprecated: will be replaced with RequestMetaHeader (see develop branch) - uint64 Epoch = 1; // Object with at least container id and owner id fields - Object Object = 2; - // TTL must be larger than zero, it decreased in every neofs-node - // Deprecated: will be replaced with RequestMetaHeader (see develop branch) - uint32 TTL = 3; + Object Object = 1; // Token with session public key and user's signature - session.Token Token = 4; + session.Token Token = 2; } oneof R { @@ -91,6 +85,11 @@ message PutRequest { // Chunk should be a remaining message in stream should be chunks bytes Chunk = 2; } + + // RequestMetaHeader contains information about request meta headers (should be embedded into message) + service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) + service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; } message PutResponse { @@ -98,18 +97,16 @@ message PutResponse { refs.Address Address = 1 [(gogoproto.nullable) = false]; } message DeleteRequest { - // Epoch is set by user to 0, node set epoch to the actual value - // Deprecated: will be replaced with RequestMetaHeader (see develop branch) - uint64 Epoch = 1; // Address of object (container id + object id) - refs.Address Address = 2 [(gogoproto.nullable) = false]; + refs.Address Address = 1 [(gogoproto.nullable) = false]; // OwnerID is a wallet address - bytes OwnerID = 3 [(gogoproto.nullable) = false, (gogoproto.customtype) = "OwnerID"]; - // TTL must be larger than zero, it decreased in every neofs-node - // Deprecated: will be replaced with RequestMetaHeader (see develop branch) - uint32 TTL = 4; + bytes OwnerID = 2 [(gogoproto.nullable) = false, (gogoproto.customtype) = "OwnerID"]; // Token with session public key and user's signature - session.Token Token = 5; + session.Token Token = 3; + // RequestMetaHeader contains information about request meta headers (should be embedded into message) + service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) + service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; } // DeleteResponse is empty because we cannot guarantee permanent object removal @@ -117,16 +114,14 @@ message DeleteRequest { message DeleteResponse {} message HeadRequest { - // Epoch should be empty on user side, node sets epoch to the actual value - // Deprecated: will be replaced with RequestMetaHeader (see develop branch) - uint64 Epoch = 1; // Address of object (container id + object id) - refs.Address Address = 2 [(gogoproto.nullable) = false, (gogoproto.customtype) = "Address"]; + refs.Address Address = 1 [(gogoproto.nullable) = false, (gogoproto.customtype) = "Address"]; // FullHeaders can be set true for extended headers in the object - bool FullHeaders = 3; - // TTL must be larger than zero, it decreased in every neofs-node - // Deprecated: will be replaced with RequestMetaHeader (see develop branch) - uint32 TTL = 4; + bool FullHeaders = 2; + // RequestMetaHeader contains information about request meta headers (should be embedded into message) + service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) + service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; } message HeadResponse { // Object without payload @@ -134,18 +129,16 @@ message HeadResponse { } message SearchRequest { - // Epoch is set by user to 0, node set epoch to the actual value - // Deprecated: will be replaced with RequestMetaHeader (see develop branch) - uint64 Epoch = 1; // Version of search query format - uint32 Version = 2; + uint32 Version = 1; // ContainerID for searching the object - bytes ContainerID = 3 [(gogoproto.nullable) = false, (gogoproto.customtype) = "CID"]; + bytes ContainerID = 2 [(gogoproto.nullable) = false, (gogoproto.customtype) = "CID"]; // Query in the binary serialized format - bytes Query = 4; - // TTL must be larger than zero, it decreased in every neofs-node - // Deprecated: will be replaced with RequestMetaHeader (see develop branch) - uint32 TTL = 5; + bytes Query = 3; + // RequestMetaHeader contains information about request meta headers (should be embedded into message) + service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) + service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; } message SearchResponse { @@ -154,16 +147,14 @@ message SearchResponse { } message GetRangeRequest { - // Epoch is set by user to 0, node set epoch to the actual value - // Deprecated: will be replaced with RequestMetaHeader (see develop branch) - uint64 Epoch = 1; // Address of object (container id + object id) - refs.Address Address = 2 [(gogoproto.nullable) = false]; + refs.Address Address = 1 [(gogoproto.nullable) = false]; // Ranges of object's payload to return - repeated Range Ranges = 3 [(gogoproto.nullable) = false]; - // TTL must be larger than zero, it decreased in every neofs-node - // Deprecated: will be replaced with RequestMetaHeader (see develop branch) - uint32 TTL = 4; + repeated Range Ranges = 2 [(gogoproto.nullable) = false]; + // RequestMetaHeader contains information about request meta headers (should be embedded into message) + service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) + service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; } message GetRangeResponse { @@ -172,18 +163,16 @@ message GetRangeResponse { } message GetRangeHashRequest { - // Epoch is set by user to 0, node set epoch to the actual value - // Deprecated: will be replaced with RequestMetaHeader (see develop branch) - uint64 Epoch = 1; // Address of object (container id + object id) - refs.Address Address = 2 [(gogoproto.nullable) = false]; + refs.Address Address = 1 [(gogoproto.nullable) = false]; // Ranges of object's payload to calculate homomorphic hash - repeated Range Ranges = 3 [(gogoproto.nullable) = false]; + repeated Range Ranges = 2 [(gogoproto.nullable) = false]; // Salt is used to XOR object's payload ranges before hashing, it can be nil - bytes Salt = 4; - // TTL must be larger than zero, it decreased in every neofs-node - // Deprecated: will be replaced with RequestMetaHeader (see develop branch) - uint32 TTL = 5; + bytes Salt = 3; + // RequestMetaHeader contains information about request meta headers (should be embedded into message) + service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) + service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; } message GetRangeHashResponse { diff --git a/object/utils.go b/object/utils.go index 1799b24..f74fa2f 100644 --- a/object/utils.go +++ b/object/utils.go @@ -4,6 +4,7 @@ import ( "io" "code.cloudfoundry.org/bytefmt" + "github.com/nspcc-dev/neofs-proto/service" "github.com/nspcc-dev/neofs-proto/session" "github.com/pkg/errors" ) @@ -49,14 +50,11 @@ func SendPutRequest(s Service_PutClient, obj *Object, epoch uint64, ttl uint32) // into header of object put request. func MakePutRequestHeader(obj *Object, epoch uint64, ttl uint32, token *session.Token) *PutRequest { return &PutRequest{ - R: &PutRequest_Header{ - Header: &PutRequest_PutHeader{ - Epoch: epoch, - Object: obj, - TTL: ttl, - Token: token, - }, - }, + RequestMetaHeader: service.RequestMetaHeader{TTL: ttl, Epoch: epoch}, + R: &PutRequest_Header{Header: &PutRequest_PutHeader{ + Object: obj, + Token: token, + }}, } } diff --git a/service/meta.go b/service/meta.go new file mode 100644 index 0000000..cd3459e --- /dev/null +++ b/service/meta.go @@ -0,0 +1,90 @@ +package service + +import ( + "github.com/nspcc-dev/neofs-proto/internal" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +type ( + // MetaHeader contains meta information of request. + // It provides methods to get or set meta information + // and reset meta header. + MetaHeader interface { + ResetMeta() + + // TTLRequest to verify and update ttl requests. + GetTTL() uint32 + SetTTL(uint32) + + // EpochRequest gives possibility to get or set epoch in RPC Requests. + GetEpoch() uint64 + SetEpoch(v uint64) + } + + // TTLCondition is closure, that allows to validate request with ttl + TTLCondition func(ttl uint32) error +) + +const ( + // ZeroTTL is empty ttl, should produce ErrZeroTTL. + ZeroTTL = iota + + // NonForwardingTTL is a ttl that allows direct connections only. + NonForwardingTTL + + // SingleForwardingTTL is a ttl that allows connections through another node. + SingleForwardingTTL +) + +const ( + // ErrZeroTTL is raised when zero ttl is passed. + ErrZeroTTL = internal.Error("zero ttl") + + // ErrIncorrectTTL is raised when NonForwardingTTL is passed and NodeRole != InnerRingNode. + ErrIncorrectTTL = internal.Error("incorrect ttl") +) + +// SetTTL sets TTL to RequestMetaHeader +func (m *RequestMetaHeader) SetTTL(v uint32) { m.TTL = v } + +// SetEpoch sets Epoch to RequestMetaHeader +func (m *RequestMetaHeader) SetEpoch(v uint64) { m.Epoch = v } + +// ResetMeta sets RequestMetaHeader to empty value +func (m *RequestMetaHeader) ResetMeta() { m.Reset() } + +// IRNonForwarding condition that allows NonForwardingTTL only for IR +func IRNonForwarding(role NodeRole) TTLCondition { + return func(ttl uint32) error { + if ttl == NonForwardingTTL && role != InnerRingNode { + return ErrIncorrectTTL + } + + return nil + } +} + +// ProcessRequestTTL validates and update ttl requests. +func ProcessRequestTTL(req MetaHeader, cond ...TTLCondition) error { + var ttl = req.GetTTL() + + if ttl == ZeroTTL { + return status.New(codes.InvalidArgument, ErrZeroTTL.Error()).Err() + } + + for i := range cond { + if cond[i] == nil { + continue + } + + // check specific condition: + if err := cond[i](ttl); err != nil { + return status.New(codes.InvalidArgument, err.Error()).Err() + } + } + + req.SetTTL(ttl - 1) + + return nil +} diff --git a/service/meta.pb.go b/service/meta.pb.go new file mode 100644 index 0000000..9fbd283 --- /dev/null +++ b/service/meta.pb.go @@ -0,0 +1,346 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: service/meta.proto + +package service + +import ( + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/golang/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package + +type RequestMetaHeader struct { + TTL uint32 `protobuf:"varint,1,opt,name=TTL,proto3" json:"TTL,omitempty"` + Epoch uint64 `protobuf:"varint,2,opt,name=Epoch,proto3" json:"Epoch,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *RequestMetaHeader) Reset() { *m = RequestMetaHeader{} } +func (m *RequestMetaHeader) String() string { return proto.CompactTextString(m) } +func (*RequestMetaHeader) ProtoMessage() {} +func (*RequestMetaHeader) Descriptor() ([]byte, []int) { + return fileDescriptor_a638867e7b43457c, []int{0} +} +func (m *RequestMetaHeader) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RequestMetaHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *RequestMetaHeader) XXX_Merge(src proto.Message) { + xxx_messageInfo_RequestMetaHeader.Merge(m, src) +} +func (m *RequestMetaHeader) XXX_Size() int { + return m.Size() +} +func (m *RequestMetaHeader) XXX_DiscardUnknown() { + xxx_messageInfo_RequestMetaHeader.DiscardUnknown(m) +} + +var xxx_messageInfo_RequestMetaHeader proto.InternalMessageInfo + +func (m *RequestMetaHeader) GetTTL() uint32 { + if m != nil { + return m.TTL + } + return 0 +} + +func (m *RequestMetaHeader) GetEpoch() uint64 { + if m != nil { + return m.Epoch + } + return 0 +} + +func init() { + proto.RegisterType((*RequestMetaHeader)(nil), "service.RequestMetaHeader") +} + +func init() { proto.RegisterFile("service/meta.proto", fileDescriptor_a638867e7b43457c) } + +var fileDescriptor_a638867e7b43457c = []byte{ + // 185 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x2a, 0x4e, 0x2d, 0x2a, + 0xcb, 0x4c, 0x4e, 0xd5, 0xcf, 0x4d, 0x2d, 0x49, 0xd4, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, + 0x87, 0x8a, 0x49, 0xe9, 0xa6, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0xa7, + 0xe7, 0xa7, 0xe7, 0xeb, 0x83, 0xe5, 0x93, 0x4a, 0xd3, 0xc0, 0x3c, 0x30, 0x07, 0xcc, 0x82, 0xe8, + 0x53, 0xb2, 0xe6, 0x12, 0x0c, 0x4a, 0x2d, 0x2c, 0x4d, 0x2d, 0x2e, 0xf1, 0x4d, 0x2d, 0x49, 0xf4, + 0x48, 0x4d, 0x4c, 0x49, 0x2d, 0x12, 0x12, 0xe0, 0x62, 0x0e, 0x09, 0xf1, 0x91, 0x60, 0x54, 0x60, + 0xd4, 0xe0, 0x0d, 0x02, 0x31, 0x85, 0x44, 0xb8, 0x58, 0x5d, 0x0b, 0xf2, 0x93, 0x33, 0x24, 0x98, + 0x14, 0x18, 0x35, 0x58, 0x82, 0x20, 0x1c, 0x27, 0xbb, 0x13, 0x8f, 0xe4, 0x18, 0x2f, 0x3c, 0x92, + 0x63, 0xbc, 0xf1, 0x48, 0x8e, 0xf1, 0xc1, 0x23, 0x39, 0xc6, 0x19, 0x8f, 0xe5, 0x18, 0xa2, 0x34, + 0x90, 0x5c, 0x90, 0x57, 0x5c, 0x90, 0x9c, 0xac, 0x9b, 0x92, 0x5a, 0xa6, 0x9f, 0x97, 0x9a, 0x9f, + 0x56, 0xac, 0x0b, 0xb1, 0x1f, 0xea, 0xd6, 0x24, 0x36, 0x30, 0xd7, 0x18, 0x10, 0x00, 0x00, 0xff, + 0xff, 0x73, 0x6f, 0x01, 0x49, 0xd1, 0x00, 0x00, 0x00, +} + +func (m *RequestMetaHeader) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *RequestMetaHeader) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RequestMetaHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.Epoch != 0 { + i = encodeVarintMeta(dAtA, i, uint64(m.Epoch)) + i-- + dAtA[i] = 0x10 + } + if m.TTL != 0 { + i = encodeVarintMeta(dAtA, i, uint64(m.TTL)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func encodeVarintMeta(dAtA []byte, offset int, v uint64) int { + offset -= sovMeta(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *RequestMetaHeader) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.TTL != 0 { + n += 1 + sovMeta(uint64(m.TTL)) + } + if m.Epoch != 0 { + n += 1 + sovMeta(uint64(m.Epoch)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovMeta(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozMeta(x uint64) (n int) { + return sovMeta(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *RequestMetaHeader) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMeta + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: RequestMetaHeader: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RequestMetaHeader: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TTL", wireType) + } + m.TTL = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMeta + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TTL |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Epoch", wireType) + } + m.Epoch = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMeta + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Epoch |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipMeta(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthMeta + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthMeta + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipMeta(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowMeta + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowMeta + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowMeta + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthMeta + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupMeta + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthMeta + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthMeta = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowMeta = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupMeta = fmt.Errorf("proto: unexpected end of group") +) diff --git a/service/meta.proto b/service/meta.proto new file mode 100644 index 0000000..4c09fb3 --- /dev/null +++ b/service/meta.proto @@ -0,0 +1,12 @@ +syntax = "proto3"; +package service; +option go_package = "github.com/nspcc-dev/neofs-proto/service"; + +import "github.com/gogo/protobuf/gogoproto/gogo.proto"; + +option (gogoproto.stable_marshaler_all) = true; + +message RequestMetaHeader { + uint32 TTL = 1; + uint64 Epoch = 2; +} diff --git a/service/meta_test.go b/service/meta_test.go new file mode 100644 index 0000000..893ca5e --- /dev/null +++ b/service/meta_test.go @@ -0,0 +1,70 @@ +package service + +import ( + "testing" + + "github.com/stretchr/testify/require" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +type mockedRequest struct { + msg string + name string + role NodeRole + code codes.Code + RequestMetaHeader +} + +func TestMetaRequest(t *testing.T) { + tests := []mockedRequest{ + { + role: InnerRingNode, + name: "direct to ir node", + RequestMetaHeader: RequestMetaHeader{TTL: NonForwardingTTL}, + }, + { + role: StorageNode, + code: codes.InvalidArgument, + msg: ErrIncorrectTTL.Error(), + name: "direct to storage node", + RequestMetaHeader: RequestMetaHeader{TTL: NonForwardingTTL}, + }, + { + role: StorageNode, + msg: ErrZeroTTL.Error(), + code: codes.InvalidArgument, + name: "zero ttl", + RequestMetaHeader: RequestMetaHeader{TTL: ZeroTTL}, + }, + { + role: InnerRingNode, + name: "default to ir node", + RequestMetaHeader: RequestMetaHeader{TTL: SingleForwardingTTL}, + }, + { + role: StorageNode, + name: "default to storage node", + RequestMetaHeader: RequestMetaHeader{TTL: SingleForwardingTTL}, + }, + } + + for i := range tests { + tt := tests[i] + t.Run(tt.name, func(t *testing.T) { + before := tt.GetTTL() + err := ProcessRequestTTL(&tt, IRNonForwarding(tt.role)) + if tt.msg != "" { + require.Errorf(t, err, tt.msg) + + state, ok := status.FromError(err) + require.True(t, ok) + require.Equal(t, state.Code(), tt.code) + require.Equal(t, state.Message(), tt.msg) + } else { + require.NoError(t, err) + require.NotEqualf(t, before, tt.GetTTL(), "ttl should be changed: %d vs %d", before, tt.GetTTL()) + } + }) + } +} diff --git a/service/role_test.go b/service/role_test.go index a1f1cc0..01dbee2 100644 --- a/service/role_test.go +++ b/service/role_test.go @@ -1,8 +1,9 @@ package service import ( - "github.com/stretchr/testify/require" "testing" + + "github.com/stretchr/testify/require" ) func TestNodeRole_String(t *testing.T) { diff --git a/service/ttl.go b/service/ttl.go deleted file mode 100644 index 8ddf1de..0000000 --- a/service/ttl.go +++ /dev/null @@ -1,45 +0,0 @@ -package service - -import ( - "github.com/nspcc-dev/neofs-proto/internal" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" -) - -// TTLRequest to verify and update ttl requests. -type TTLRequest interface { - GetTTL() uint32 - SetTTL(uint32) -} - -const ( - // ZeroTTL is empty ttl, should produce ErrZeroTTL. - ZeroTTL = iota - - // NonForwardingTTL is a ttl that allows direct connections only. - NonForwardingTTL - - // SingleForwardingTTL is a ttl that allows connections through another node. - SingleForwardingTTL - - // ErrZeroTTL is raised when zero ttl is passed. - ErrZeroTTL = internal.Error("zero ttl") - - // ErrIncorrectTTL is raised when NonForwardingTTL is passed and NodeRole != InnerRingNode. - ErrIncorrectTTL = internal.Error("incorrect ttl") -) - -// CheckTTLRequest validates and update ttl requests. -func CheckTTLRequest(req TTLRequest, role NodeRole) error { - var ttl = req.GetTTL() - - if ttl == ZeroTTL { - return status.New(codes.InvalidArgument, ErrZeroTTL.Error()).Err() - } else if ttl == NonForwardingTTL && role != InnerRingNode { - return status.New(codes.InvalidArgument, ErrIncorrectTTL.Error()).Err() - } - - req.SetTTL(ttl - 1) - - return nil -} diff --git a/service/ttl_test.go b/service/ttl_test.go deleted file mode 100644 index 1349198..0000000 --- a/service/ttl_test.go +++ /dev/null @@ -1,72 +0,0 @@ -package service - -import ( - "github.com/stretchr/testify/require" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - "testing" -) - -type mockedRequest struct { - msg string - ttl uint32 - name string - role NodeRole - code codes.Code -} - -func (m *mockedRequest) SetTTL(v uint32) { m.ttl = v } -func (m mockedRequest) GetTTL() uint32 { return m.ttl } - -func TestCheckTTLRequest(t *testing.T) { - tests := []mockedRequest{ - { - ttl: NonForwardingTTL, - role: InnerRingNode, - name: "direct to ir node", - }, - { - ttl: NonForwardingTTL, - role: StorageNode, - code: codes.InvalidArgument, - msg: ErrIncorrectTTL.Error(), - name: "direct to storage node", - }, - { - ttl: ZeroTTL, - role: StorageNode, - msg: ErrZeroTTL.Error(), - code: codes.InvalidArgument, - name: "zero ttl", - }, - { - ttl: SingleForwardingTTL, - role: InnerRingNode, - name: "default to ir node", - }, - { - ttl: SingleForwardingTTL, - role: StorageNode, - name: "default to storage node", - }, - } - - for i := range tests { - tt := tests[i] - t.Run(tt.name, func(t *testing.T) { - before := tt.ttl - err := CheckTTLRequest(&tt, tt.role) - if tt.msg != "" { - require.Errorf(t, err, tt.msg) - - state, ok := status.FromError(err) - require.True(t, ok) - require.Equal(t, state.Code(), tt.code) - require.Equal(t, state.Message(), tt.msg) - } else { - require.NoError(t, err) - require.NotEqualf(t, before, tt.ttl, "ttl should be changed: %d vs %d", before, tt.ttl) - } - }) - } -} diff --git a/service/verify.go b/service/verify.go new file mode 100644 index 0000000..d8ede7e --- /dev/null +++ b/service/verify.go @@ -0,0 +1,179 @@ +package service + +import ( + "crypto/ecdsa" + + "github.com/gogo/protobuf/proto" + crypto "github.com/nspcc-dev/neofs-crypto" + "github.com/nspcc-dev/neofs-proto/internal" + "github.com/pkg/errors" +) + +type ( + // VerifiableRequest adds possibility to sign and verify request header + VerifiableRequest interface { + proto.Message + Marshal() ([]byte, error) + AddSignature(*RequestVerificationHeader_Signature) + GetSignatures() []*RequestVerificationHeader_Signature + SetSignatures([]*RequestVerificationHeader_Signature) + } + + // MaintainableRequest adds possibility to set and get (+validate) + // owner (client) public key from RequestVerificationHeader. + MaintainableRequest interface { + proto.Message + GetOwner() (*ecdsa.PublicKey, error) + SetOwner(*ecdsa.PublicKey, []byte) + GetLastPeer() (*ecdsa.PublicKey, error) + } +) + +const ( + // ErrCannotLoadPublicKey is raised when cannot unmarshal public key from RequestVerificationHeader_Sign + ErrCannotLoadPublicKey = internal.Error("cannot load public key") + + // ErrCannotFindOwner is raised when signatures empty in GetOwner + ErrCannotFindOwner = internal.Error("cannot find owner public key") +) + +// SetSignatures replaces signatures stored in RequestVerificationHeader +func (m *RequestVerificationHeader) SetSignatures(signatures []*RequestVerificationHeader_Signature) { + m.Signatures = signatures +} + +// AddSignature adds new Signature into RequestVerificationHeader +func (m *RequestVerificationHeader) AddSignature(sig *RequestVerificationHeader_Signature) { + if sig == nil { + return + } + m.Signatures = append(m.Signatures, sig) +} + +// SetOwner adds origin (sign and public key) of owner (client) into first signature. +func (m *RequestVerificationHeader) SetOwner(pub *ecdsa.PublicKey, sign []byte) { + if len(m.Signatures) == 0 || pub == nil { + return + } + + m.Signatures[0].Origin = &RequestVerificationHeader_Sign{ + Sign: sign, + Peer: crypto.MarshalPublicKey(pub), + } +} + +// GetOwner tries to get owner (client) public key from signatures. +// If signatures contains not empty Origin, we should try to validate, +// that session key was signed by owner (client), otherwise return error. +func (m *RequestVerificationHeader) GetOwner() (*ecdsa.PublicKey, error) { + if len(m.Signatures) == 0 { + return nil, ErrCannotFindOwner + } + + // if first signature contains origin, we should try to validate session key + if m.Signatures[0].Origin != nil { + owner := crypto.UnmarshalPublicKey(m.Signatures[0].Origin.Peer) + if owner == nil { + return nil, ErrCannotLoadPublicKey + } else if err := crypto.Verify(owner, m.Signatures[0].Peer, m.Signatures[0].Origin.Sign); err != nil { + return nil, errors.Wrap(err, "could not verify session token") + } + + return owner, nil + } else if key := crypto.UnmarshalPublicKey(m.Signatures[0].Peer); key != nil { + return key, nil + } + + return nil, ErrCannotLoadPublicKey +} + +// GetLastPeer tries to get last peer public key from signatures. +// If signatures has zero length, returns ErrCannotFindOwner. +// If signatures has length equal to one, uses GetOwner. +// Otherwise tries to unmarshal last peer public key. +func (m *RequestVerificationHeader) GetLastPeer() (*ecdsa.PublicKey, error) { + switch ln := len(m.Signatures); ln { + case 0: + return nil, ErrCannotFindOwner + case 1: + return m.GetOwner() + default: + if key := crypto.UnmarshalPublicKey(m.Signatures[ln-1].Peer); key != nil { + return key, nil + } + + return nil, ErrCannotLoadPublicKey + } +} + +func newSignature(key *ecdsa.PrivateKey, data []byte) (*RequestVerificationHeader_Signature, error) { + sign, err := crypto.Sign(key, data) + if err != nil { + return nil, err + } + + return &RequestVerificationHeader_Signature{ + RequestVerificationHeader_Sign: RequestVerificationHeader_Sign{ + Sign: sign, + Peer: crypto.MarshalPublicKey(&key.PublicKey), + }, + }, nil +} + +// SignRequestHeader receives private key and request with RequestVerificationHeader, +// tries to marshal and sign request with passed PrivateKey, after that adds +// new signature to headers. If something went wrong, returns error. +func SignRequestHeader(key *ecdsa.PrivateKey, req VerifiableRequest) error { + msg := proto.Clone(req).(VerifiableRequest) + + // ignore meta header + if meta, ok := msg.(MetaHeader); ok { + meta.ResetMeta() + } + + data, err := msg.Marshal() + if err != nil { + return err + } + + signature, err := newSignature(key, data) + if err != nil { + return err + } + + req.AddSignature(signature) + + return nil +} + +// VerifyRequestHeader receives request with RequestVerificationHeader, +// tries to marshal and verify each signature from request +// If something went wrong, returns error. +func VerifyRequestHeader(req VerifiableRequest) error { + msg := proto.Clone(req).(VerifiableRequest) + // ignore meta header + if meta, ok := msg.(MetaHeader); ok { + meta.ResetMeta() + } + + signatures := msg.GetSignatures() + + for i := range signatures { + msg.SetSignatures(signatures[:i]) + peer := signatures[i].GetPeer() + sign := signatures[i].GetSign() + + key := crypto.UnmarshalPublicKey(peer) + if key == nil { + return errors.Wrapf(ErrCannotLoadPublicKey, "%d: %02x", i, peer) + } + + if data, err := msg.Marshal(); err != nil { + return errors.Wrapf(err, "%d: %02x", i, peer) + } else if err := crypto.Verify(key, data, sign); err != nil { + return errors.Wrapf(err, "%d: %02x", i, peer) + } + } + + return nil +} diff --git a/service/verify.pb.go b/service/verify.pb.go new file mode 100644 index 0000000..3c0f357 --- /dev/null +++ b/service/verify.pb.go @@ -0,0 +1,813 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: service/verify.proto + +package service + +import ( + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/golang/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package + +type RequestVerificationHeader struct { + Signatures []*RequestVerificationHeader_Signature `protobuf:"bytes,1,rep,name=Signatures,proto3" json:"Signatures,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *RequestVerificationHeader) Reset() { *m = RequestVerificationHeader{} } +func (m *RequestVerificationHeader) String() string { return proto.CompactTextString(m) } +func (*RequestVerificationHeader) ProtoMessage() {} +func (*RequestVerificationHeader) Descriptor() ([]byte, []int) { + return fileDescriptor_4bdd5bc50ec96238, []int{0} +} +func (m *RequestVerificationHeader) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RequestVerificationHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *RequestVerificationHeader) XXX_Merge(src proto.Message) { + xxx_messageInfo_RequestVerificationHeader.Merge(m, src) +} +func (m *RequestVerificationHeader) XXX_Size() int { + return m.Size() +} +func (m *RequestVerificationHeader) XXX_DiscardUnknown() { + xxx_messageInfo_RequestVerificationHeader.DiscardUnknown(m) +} + +var xxx_messageInfo_RequestVerificationHeader proto.InternalMessageInfo + +func (m *RequestVerificationHeader) GetSignatures() []*RequestVerificationHeader_Signature { + if m != nil { + return m.Signatures + } + return nil +} + +type RequestVerificationHeader_Sign struct { + Sign []byte `protobuf:"bytes,1,opt,name=Sign,proto3" json:"Sign,omitempty"` + Peer []byte `protobuf:"bytes,2,opt,name=Peer,proto3" json:"Peer,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *RequestVerificationHeader_Sign) Reset() { *m = RequestVerificationHeader_Sign{} } +func (m *RequestVerificationHeader_Sign) String() string { return proto.CompactTextString(m) } +func (*RequestVerificationHeader_Sign) ProtoMessage() {} +func (*RequestVerificationHeader_Sign) Descriptor() ([]byte, []int) { + return fileDescriptor_4bdd5bc50ec96238, []int{0, 0} +} +func (m *RequestVerificationHeader_Sign) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RequestVerificationHeader_Sign) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *RequestVerificationHeader_Sign) XXX_Merge(src proto.Message) { + xxx_messageInfo_RequestVerificationHeader_Sign.Merge(m, src) +} +func (m *RequestVerificationHeader_Sign) XXX_Size() int { + return m.Size() +} +func (m *RequestVerificationHeader_Sign) XXX_DiscardUnknown() { + xxx_messageInfo_RequestVerificationHeader_Sign.DiscardUnknown(m) +} + +var xxx_messageInfo_RequestVerificationHeader_Sign proto.InternalMessageInfo + +func (m *RequestVerificationHeader_Sign) GetSign() []byte { + if m != nil { + return m.Sign + } + return nil +} + +func (m *RequestVerificationHeader_Sign) GetPeer() []byte { + if m != nil { + return m.Peer + } + return nil +} + +type RequestVerificationHeader_Signature struct { + RequestVerificationHeader_Sign `protobuf:"bytes,1,opt,name=Sign,proto3,embedded=Sign" json:"Sign"` + Origin *RequestVerificationHeader_Sign `protobuf:"bytes,2,opt,name=Origin,proto3" json:"Origin,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *RequestVerificationHeader_Signature) Reset() { *m = RequestVerificationHeader_Signature{} } +func (m *RequestVerificationHeader_Signature) String() string { return proto.CompactTextString(m) } +func (*RequestVerificationHeader_Signature) ProtoMessage() {} +func (*RequestVerificationHeader_Signature) Descriptor() ([]byte, []int) { + return fileDescriptor_4bdd5bc50ec96238, []int{0, 1} +} +func (m *RequestVerificationHeader_Signature) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RequestVerificationHeader_Signature) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *RequestVerificationHeader_Signature) XXX_Merge(src proto.Message) { + xxx_messageInfo_RequestVerificationHeader_Signature.Merge(m, src) +} +func (m *RequestVerificationHeader_Signature) XXX_Size() int { + return m.Size() +} +func (m *RequestVerificationHeader_Signature) XXX_DiscardUnknown() { + xxx_messageInfo_RequestVerificationHeader_Signature.DiscardUnknown(m) +} + +var xxx_messageInfo_RequestVerificationHeader_Signature proto.InternalMessageInfo + +func (m *RequestVerificationHeader_Signature) GetOrigin() *RequestVerificationHeader_Sign { + if m != nil { + return m.Origin + } + return nil +} + +func init() { + proto.RegisterType((*RequestVerificationHeader)(nil), "service.RequestVerificationHeader") + proto.RegisterType((*RequestVerificationHeader_Sign)(nil), "service.RequestVerificationHeader.Sign") + proto.RegisterType((*RequestVerificationHeader_Signature)(nil), "service.RequestVerificationHeader.Signature") +} + +func init() { proto.RegisterFile("service/verify.proto", fileDescriptor_4bdd5bc50ec96238) } + +var fileDescriptor_4bdd5bc50ec96238 = []byte{ + // 270 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x29, 0x4e, 0x2d, 0x2a, + 0xcb, 0x4c, 0x4e, 0xd5, 0x2f, 0x4b, 0x2d, 0xca, 0x4c, 0xab, 0xd4, 0x2b, 0x28, 0xca, 0x2f, 0xc9, + 0x17, 0x62, 0x87, 0x8a, 0x4a, 0xe9, 0xa6, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, + 0xea, 0xa7, 0xe7, 0xa7, 0xe7, 0xeb, 0x83, 0xe5, 0x93, 0x4a, 0xd3, 0xc0, 0x3c, 0x30, 0x07, 0xcc, + 0x82, 0xe8, 0x53, 0x5a, 0xcf, 0xc4, 0x25, 0x19, 0x94, 0x5a, 0x58, 0x9a, 0x5a, 0x5c, 0x12, 0x06, + 0x32, 0x2f, 0x33, 0x39, 0xb1, 0x24, 0x33, 0x3f, 0xcf, 0x23, 0x35, 0x31, 0x25, 0xb5, 0x48, 0xc8, + 0x87, 0x8b, 0x2b, 0x38, 0x33, 0x3d, 0x2f, 0xb1, 0xa4, 0xb4, 0x28, 0xb5, 0x58, 0x82, 0x51, 0x81, + 0x59, 0x83, 0xdb, 0x48, 0x47, 0x0f, 0x6a, 0x95, 0x1e, 0x4e, 0x7d, 0x7a, 0x70, 0x4d, 0x41, 0x48, + 0xfa, 0xa5, 0xf4, 0xb8, 0x58, 0x40, 0x3c, 0x21, 0x21, 0x08, 0x2d, 0xc1, 0xa8, 0xc0, 0xa8, 0xc1, + 0x13, 0x04, 0x17, 0x0b, 0x48, 0x4d, 0x2d, 0x92, 0x60, 0x82, 0x88, 0x81, 0xd8, 0x52, 0x93, 0x19, + 0xb9, 0x38, 0xe1, 0xda, 0x85, 0x5c, 0x91, 0x74, 0x71, 0x1b, 0xa9, 0x13, 0xe9, 0x0a, 0x27, 0x8e, + 0x13, 0xf7, 0xe4, 0x19, 0x2e, 0xdc, 0x93, 0x67, 0x84, 0x5a, 0x64, 0xcf, 0xc5, 0xe6, 0x5f, 0x94, + 0x99, 0x9e, 0x99, 0x07, 0xb6, 0x8a, 0x78, 0x83, 0x82, 0xa0, 0xda, 0x9c, 0xec, 0x4e, 0x3c, 0x92, + 0x63, 0xbc, 0xf0, 0x48, 0x8e, 0xf1, 0xc6, 0x23, 0x39, 0xc6, 0x07, 0x8f, 0xe4, 0x18, 0x67, 0x3c, + 0x96, 0x63, 0x88, 0xd2, 0x40, 0x0a, 0xf6, 0xbc, 0xe2, 0x82, 0xe4, 0x64, 0xdd, 0x94, 0xd4, 0x32, + 0xfd, 0xbc, 0xd4, 0xfc, 0xb4, 0x62, 0x5d, 0x48, 0xa0, 0x43, 0xad, 0x49, 0x62, 0x03, 0x73, 0x8d, + 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xd7, 0x15, 0xf6, 0x5e, 0xc8, 0x01, 0x00, 0x00, +} + +func (m *RequestVerificationHeader) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *RequestVerificationHeader) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RequestVerificationHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Signatures) > 0 { + for iNdEx := len(m.Signatures) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Signatures[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintVerify(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *RequestVerificationHeader_Sign) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *RequestVerificationHeader_Sign) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RequestVerificationHeader_Sign) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Peer) > 0 { + i -= len(m.Peer) + copy(dAtA[i:], m.Peer) + i = encodeVarintVerify(dAtA, i, uint64(len(m.Peer))) + i-- + dAtA[i] = 0x12 + } + if len(m.Sign) > 0 { + i -= len(m.Sign) + copy(dAtA[i:], m.Sign) + i = encodeVarintVerify(dAtA, i, uint64(len(m.Sign))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *RequestVerificationHeader_Signature) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *RequestVerificationHeader_Signature) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RequestVerificationHeader_Signature) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.Origin != nil { + { + size, err := m.Origin.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintVerify(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + { + size, err := m.RequestVerificationHeader_Sign.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintVerify(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func encodeVarintVerify(dAtA []byte, offset int, v uint64) int { + offset -= sovVerify(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *RequestVerificationHeader) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Signatures) > 0 { + for _, e := range m.Signatures { + l = e.Size() + n += 1 + l + sovVerify(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *RequestVerificationHeader_Sign) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Sign) + if l > 0 { + n += 1 + l + sovVerify(uint64(l)) + } + l = len(m.Peer) + if l > 0 { + n += 1 + l + sovVerify(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *RequestVerificationHeader_Signature) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.RequestVerificationHeader_Sign.Size() + n += 1 + l + sovVerify(uint64(l)) + if m.Origin != nil { + l = m.Origin.Size() + n += 1 + l + sovVerify(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovVerify(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozVerify(x uint64) (n int) { + return sovVerify(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *RequestVerificationHeader) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVerify + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: RequestVerificationHeader: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RequestVerificationHeader: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signatures", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVerify + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthVerify + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthVerify + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Signatures = append(m.Signatures, &RequestVerificationHeader_Signature{}) + if err := m.Signatures[len(m.Signatures)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipVerify(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthVerify + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthVerify + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RequestVerificationHeader_Sign) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVerify + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Sign: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Sign: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sign", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVerify + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthVerify + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthVerify + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Sign = append(m.Sign[:0], dAtA[iNdEx:postIndex]...) + if m.Sign == nil { + m.Sign = []byte{} + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Peer", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVerify + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthVerify + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthVerify + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Peer = append(m.Peer[:0], dAtA[iNdEx:postIndex]...) + if m.Peer == nil { + m.Peer = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipVerify(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthVerify + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthVerify + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RequestVerificationHeader_Signature) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVerify + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Signature: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Signature: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestVerificationHeader_Sign", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVerify + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthVerify + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthVerify + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RequestVerificationHeader_Sign.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Origin", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVerify + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthVerify + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthVerify + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Origin == nil { + m.Origin = &RequestVerificationHeader_Sign{} + } + if err := m.Origin.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipVerify(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthVerify + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthVerify + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipVerify(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowVerify + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowVerify + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowVerify + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthVerify + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupVerify + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthVerify + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthVerify = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowVerify = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupVerify = fmt.Errorf("proto: unexpected end of group") +) diff --git a/service/verify.proto b/service/verify.proto new file mode 100644 index 0000000..7d83308 --- /dev/null +++ b/service/verify.proto @@ -0,0 +1,20 @@ +syntax = "proto3"; +package service; +option go_package = "github.com/nspcc-dev/neofs-proto/service"; + +import "github.com/gogo/protobuf/gogoproto/gogo.proto"; + +option (gogoproto.stable_marshaler_all) = true; + +message RequestVerificationHeader { + message Sign { + bytes Sign = 1; + bytes Peer = 2; + } + message Signature { + Sign Sign = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + Sign Origin = 2; + } + + repeated Signature Signatures = 1; +} diff --git a/service/verify_test.go b/service/verify_test.go new file mode 100644 index 0000000..4aaefb4 --- /dev/null +++ b/service/verify_test.go @@ -0,0 +1,106 @@ +package service + +import ( + "math" + "testing" + + crypto "github.com/nspcc-dev/neofs-crypto" + "github.com/nspcc-dev/neofs-crypto/test" + "github.com/pkg/errors" + "github.com/stretchr/testify/require" +) + +func TestSignRequestHeader(t *testing.T) { + req := &TestRequest{ + IntField: math.MaxInt32, + StringField: "TestRequestStringField", + BytesField: []byte("TestRequestBytesField"), + } + + key := test.DecodeKey(0) + peer := crypto.MarshalPublicKey(&key.PublicKey) + + data, err := req.Marshal() + require.NoError(t, err) + + require.NoError(t, SignRequestHeader(key, req)) + + require.Len(t, req.Signatures, 1) + for i := range req.Signatures { + sign := req.Signatures[i].GetSign() + require.Equal(t, peer, req.Signatures[i].GetPeer()) + require.NoError(t, crypto.Verify(&key.PublicKey, data, sign)) + } +} + +func TestVerifyRequestHeader(t *testing.T) { + req := &TestRequest{ + IntField: math.MaxInt32, + StringField: "TestRequestStringField", + BytesField: []byte("TestRequestBytesField"), + RequestMetaHeader: RequestMetaHeader{TTL: 10}, + } + + for i := 0; i < 10; i++ { + req.TTL-- + require.NoError(t, SignRequestHeader(test.DecodeKey(i), req)) + } + + require.NoError(t, VerifyRequestHeader(req)) +} + +func TestMaintainableRequest(t *testing.T) { + req := &TestRequest{ + IntField: math.MaxInt32, + StringField: "TestRequestStringField", + BytesField: []byte("TestRequestBytesField"), + RequestMetaHeader: RequestMetaHeader{TTL: 10}, + } + + count := 10 + owner := test.DecodeKey(count + 1) + + for i := 0; i < count; i++ { + req.TTL-- + + key := test.DecodeKey(i) + require.NoError(t, SignRequestHeader(key, req)) + + // sign first key (session key) by owner key + if i == 0 { + sign, err := crypto.Sign(owner, crypto.MarshalPublicKey(&key.PublicKey)) + require.NoError(t, err) + + req.SetOwner(&owner.PublicKey, sign) + } + } + + { // Good case: + require.NoError(t, VerifyRequestHeader(req)) + + // validate, that first key (session key) was signed with owner + signatures := req.GetSignatures() + + require.Len(t, signatures, count) + + pub, err := req.GetOwner() + require.NoError(t, err) + + require.Equal(t, &owner.PublicKey, pub) + } + + { // wrong owner: + req.Signatures[0].Origin = nil + + pub, err := req.GetOwner() + require.NoError(t, err) + + require.NotEqual(t, &owner.PublicKey, pub) + } + + { // Wrong signatures: + copy(req.Signatures[count-1].Sign, req.Signatures[count-1].Peer) + err := VerifyRequestHeader(req) + require.EqualError(t, errors.Cause(err), crypto.ErrInvalidSignature.Error()) + } +} diff --git a/service/verify_test.pb.go b/service/verify_test.pb.go new file mode 100644 index 0000000..a029c2e --- /dev/null +++ b/service/verify_test.pb.go @@ -0,0 +1,518 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: service/verify_test.proto + +package service + +import ( + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/golang/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package + +type TestRequest struct { + IntField int32 `protobuf:"varint,1,opt,name=IntField,proto3" json:"IntField,omitempty"` + StringField string `protobuf:"bytes,2,opt,name=StringField,proto3" json:"StringField,omitempty"` + BytesField []byte `protobuf:"bytes,3,opt,name=BytesField,proto3" json:"BytesField,omitempty"` + RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` + RequestVerificationHeader `protobuf:"bytes,99,opt,name=Header,proto3,embedded=Header" json:"Header"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *TestRequest) Reset() { *m = TestRequest{} } +func (m *TestRequest) String() string { return proto.CompactTextString(m) } +func (*TestRequest) ProtoMessage() {} +func (*TestRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_1effa83201a30d75, []int{0} +} +func (m *TestRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *TestRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *TestRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_TestRequest.Merge(m, src) +} +func (m *TestRequest) XXX_Size() int { + return m.Size() +} +func (m *TestRequest) XXX_DiscardUnknown() { + xxx_messageInfo_TestRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_TestRequest proto.InternalMessageInfo + +func (m *TestRequest) GetIntField() int32 { + if m != nil { + return m.IntField + } + return 0 +} + +func (m *TestRequest) GetStringField() string { + if m != nil { + return m.StringField + } + return "" +} + +func (m *TestRequest) GetBytesField() []byte { + if m != nil { + return m.BytesField + } + return nil +} + +func init() { + proto.RegisterType((*TestRequest)(nil), "service.TestRequest") +} + +func init() { proto.RegisterFile("service/verify_test.proto", fileDescriptor_1effa83201a30d75) } + +var fileDescriptor_1effa83201a30d75 = []byte{ + // 296 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x90, 0xbf, 0x4e, 0xeb, 0x30, + 0x14, 0xc6, 0xeb, 0x7b, 0xa1, 0x14, 0x97, 0xc9, 0x62, 0x28, 0x19, 0xdc, 0xa8, 0x53, 0x96, 0x26, + 0x12, 0x2c, 0x4c, 0x0c, 0x15, 0x42, 0x30, 0xb0, 0x04, 0xc4, 0xc0, 0x82, 0x12, 0xe7, 0x24, 0x58, + 0xa2, 0x71, 0x89, 0x4f, 0x22, 0xf5, 0x4d, 0x78, 0xa4, 0x8e, 0x1d, 0x99, 0x2a, 0x14, 0x46, 0x5e, + 0x02, 0xd5, 0x36, 0x28, 0xc0, 0x96, 0xef, 0xcf, 0x2f, 0x47, 0xfe, 0xe8, 0x91, 0x86, 0xaa, 0x91, + 0x02, 0xa2, 0x06, 0x2a, 0x99, 0x2f, 0x1f, 0x10, 0x34, 0x86, 0x8b, 0x4a, 0xa1, 0x62, 0x7b, 0x2e, + 0xf2, 0xd8, 0x57, 0x67, 0x0e, 0x98, 0xd8, 0xd0, 0x3b, 0xfc, 0xc9, 0x39, 0x77, 0x5a, 0x48, 0x7c, + 0xac, 0xd3, 0x50, 0xa8, 0x79, 0x54, 0xa8, 0x42, 0x45, 0xc6, 0x4e, 0xeb, 0xdc, 0x28, 0x23, 0xcc, + 0x97, 0xad, 0x4f, 0x3e, 0x08, 0x1d, 0xde, 0x82, 0xc6, 0x18, 0x9e, 0x6b, 0xd0, 0xc8, 0x3c, 0x3a, + 0xb8, 0x2a, 0xf1, 0x42, 0xc2, 0x53, 0x36, 0x22, 0x3e, 0x09, 0x76, 0xe3, 0x6f, 0xcd, 0x7c, 0x3a, + 0xbc, 0xc1, 0x4a, 0x96, 0x85, 0x8d, 0xff, 0xf9, 0x24, 0xd8, 0x8f, 0xbb, 0x16, 0xe3, 0x94, 0xce, + 0x96, 0x08, 0xda, 0x16, 0xfe, 0xfb, 0x24, 0x38, 0x88, 0x3b, 0x0e, 0x3b, 0xa5, 0x3b, 0xd7, 0x80, + 0xc9, 0x28, 0xf5, 0x49, 0x30, 0x3c, 0xf6, 0x42, 0xf7, 0x82, 0xd0, 0x5d, 0xdf, 0x66, 0x97, 0x90, + 0x64, 0x50, 0xcd, 0x06, 0xab, 0xcd, 0xb8, 0xb7, 0xde, 0x8c, 0x49, 0x6c, 0x08, 0x76, 0x4e, 0xfb, + 0x36, 0x19, 0x09, 0xc3, 0x4e, 0x7e, 0xb3, 0x77, 0xdb, 0x11, 0xa4, 0x48, 0x50, 0xaa, 0xf2, 0xcf, + 0x3f, 0x1c, 0x3b, 0x3b, 0x5b, 0xb5, 0x9c, 0xac, 0x5b, 0x4e, 0x5e, 0x5b, 0x4e, 0xde, 0x5a, 0x4e, + 0x5e, 0xde, 0x79, 0xef, 0x3e, 0xe8, 0x4c, 0x56, 0xea, 0x85, 0x10, 0xd3, 0x0c, 0x9a, 0xa8, 0x04, + 0x95, 0xeb, 0xa9, 0x1d, 0xcc, 0xdd, 0x4a, 0xfb, 0x46, 0x9e, 0x7c, 0x06, 0x00, 0x00, 0xff, 0xff, + 0xa6, 0xdb, 0x5f, 0x7a, 0xb3, 0x01, 0x00, 0x00, +} + +func (m *TestRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *TestRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TestRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + { + size, err := m.RequestVerificationHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintVerifyTest(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x9a + { + size, err := m.RequestMetaHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintVerifyTest(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x92 + if len(m.BytesField) > 0 { + i -= len(m.BytesField) + copy(dAtA[i:], m.BytesField) + i = encodeVarintVerifyTest(dAtA, i, uint64(len(m.BytesField))) + i-- + dAtA[i] = 0x1a + } + if len(m.StringField) > 0 { + i -= len(m.StringField) + copy(dAtA[i:], m.StringField) + i = encodeVarintVerifyTest(dAtA, i, uint64(len(m.StringField))) + i-- + dAtA[i] = 0x12 + } + if m.IntField != 0 { + i = encodeVarintVerifyTest(dAtA, i, uint64(m.IntField)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func encodeVarintVerifyTest(dAtA []byte, offset int, v uint64) int { + offset -= sovVerifyTest(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *TestRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.IntField != 0 { + n += 1 + sovVerifyTest(uint64(m.IntField)) + } + l = len(m.StringField) + if l > 0 { + n += 1 + l + sovVerifyTest(uint64(l)) + } + l = len(m.BytesField) + if l > 0 { + n += 1 + l + sovVerifyTest(uint64(l)) + } + l = m.RequestMetaHeader.Size() + n += 2 + l + sovVerifyTest(uint64(l)) + l = m.RequestVerificationHeader.Size() + n += 2 + l + sovVerifyTest(uint64(l)) + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovVerifyTest(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozVerifyTest(x uint64) (n int) { + return sovVerifyTest(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *TestRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVerifyTest + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: TestRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TestRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field IntField", wireType) + } + m.IntField = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVerifyTest + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.IntField |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StringField", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVerifyTest + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthVerifyTest + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthVerifyTest + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.StringField = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BytesField", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVerifyTest + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthVerifyTest + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthVerifyTest + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BytesField = append(m.BytesField[:0], dAtA[iNdEx:postIndex]...) + if m.BytesField == nil { + m.BytesField = []byte{} + } + iNdEx = postIndex + case 98: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVerifyTest + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthVerifyTest + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthVerifyTest + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RequestMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 99: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestVerificationHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVerifyTest + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthVerifyTest + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthVerifyTest + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RequestVerificationHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipVerifyTest(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthVerifyTest + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthVerifyTest + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipVerifyTest(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowVerifyTest + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowVerifyTest + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowVerifyTest + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthVerifyTest + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupVerifyTest + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthVerifyTest + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthVerifyTest = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowVerifyTest = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupVerifyTest = fmt.Errorf("proto: unexpected end of group") +) diff --git a/service/verify_test.proto b/service/verify_test.proto new file mode 100644 index 0000000..5eb8cfd --- /dev/null +++ b/service/verify_test.proto @@ -0,0 +1,17 @@ +syntax = "proto3"; +package service; +option go_package = "github.com/nspcc-dev/neofs-proto/service"; + +import "service/meta.proto"; +import "service/verify.proto"; +import "github.com/gogo/protobuf/gogoproto/gogo.proto"; + +option (gogoproto.stable_marshaler_all) = true; + +message TestRequest { + int32 IntField = 1; + string StringField = 2; + bytes BytesField = 3; + RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + RequestVerificationHeader Header = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; +} diff --git a/session/service.pb.go b/session/service.pb.go index b99b611..eef5819 100644 --- a/session/service.pb.go +++ b/session/service.pb.go @@ -8,6 +8,7 @@ import ( fmt "fmt" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/golang/protobuf/proto" + service "github.com/nspcc-dev/neofs-proto/service" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" @@ -33,10 +34,12 @@ type CreateRequest struct { // Types that are valid to be assigned to Message: // *CreateRequest_Init // *CreateRequest_Signed - Message isCreateRequest_Message `protobuf_oneof:"Message"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Message isCreateRequest_Message `protobuf_oneof:"Message"` + service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` + service.RequestVerificationHeader `protobuf:"bytes,99,opt,name=Verify,proto3,embedded=Verify" json:"Verify"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *CreateRequest) Reset() { *m = CreateRequest{} } @@ -205,25 +208,30 @@ func init() { func init() { proto.RegisterFile("session/service.proto", fileDescriptor_b329bee0fd1148e0) } var fileDescriptor_b329bee0fd1148e0 = []byte{ - // 284 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x90, 0xbd, 0x4e, 0xc3, 0x30, - 0x10, 0xc7, 0x6b, 0x84, 0x12, 0x30, 0xa2, 0x83, 0x11, 0x50, 0x65, 0xb0, 0x50, 0xc5, 0x90, 0x81, - 0x24, 0xa8, 0xcc, 0x30, 0x94, 0xa5, 0x0c, 0x2c, 0x29, 0x2c, 0x6c, 0x4d, 0x7a, 0x35, 0xe6, 0xc3, - 0x0e, 0x39, 0xa7, 0x12, 0x6f, 0xc2, 0x23, 0x31, 0x32, 0x32, 0xa2, 0xf0, 0x22, 0x08, 0x3b, 0xad, - 0x82, 0x50, 0x36, 0xff, 0x3f, 0x7c, 0x3f, 0xfb, 0xe8, 0x3e, 0x02, 0xa2, 0xd4, 0x2a, 0x41, 0x28, - 0x97, 0x32, 0x87, 0xb8, 0x28, 0xb5, 0xd1, 0xcc, 0x6f, 0xec, 0x60, 0x6f, 0x95, 0x9b, 0xd7, 0x02, - 0xd0, 0xa5, 0x41, 0x24, 0xa4, 0xb9, 0xaf, 0xb2, 0x38, 0xd7, 0xcf, 0x89, 0xd0, 0x42, 0x27, 0xd6, - 0xce, 0xaa, 0x85, 0x55, 0x56, 0xd8, 0x93, 0xab, 0x0f, 0x1f, 0xe8, 0xee, 0x65, 0x09, 0x33, 0x03, - 0x29, 0xbc, 0x54, 0x80, 0x86, 0x1d, 0xd3, 0xcd, 0x2b, 0x25, 0xcd, 0x80, 0x1c, 0x91, 0x70, 0x67, - 0xd4, 0x8f, 0x1b, 0x46, 0x7c, 0xa3, 0x1f, 0x41, 0x4d, 0x7a, 0xa9, 0x4d, 0x59, 0x48, 0xbd, 0xa9, - 0x14, 0x0a, 0xe6, 0x83, 0x8d, 0x8e, 0x5e, 0x93, 0x8f, 0xb7, 0xa9, 0x7f, 0x0d, 0x88, 0x33, 0x01, - 0x43, 0xa4, 0xfd, 0x15, 0x0b, 0x0b, 0xad, 0x10, 0xd8, 0x09, 0xdd, 0xba, 0x55, 0xe8, 0x06, 0x75, - 0x01, 0xd7, 0x8d, 0x5f, 0x68, 0x0a, 0x58, 0x3d, 0x99, 0x6e, 0xa8, 0xcb, 0x5b, 0xd0, 0xd1, 0x84, - 0xfa, 0x53, 0xd7, 0x62, 0xe7, 0xd4, 0x73, 0x7c, 0x76, 0xb0, 0xbe, 0xf9, 0xe7, 0xf3, 0xc1, 0xe1, - 0x3f, 0xdf, 0x3d, 0x34, 0x24, 0xa7, 0x64, 0x7c, 0xf1, 0x5e, 0x73, 0xf2, 0x51, 0x73, 0xf2, 0x59, - 0x73, 0xf2, 0x55, 0x73, 0xf2, 0xf6, 0xcd, 0x7b, 0x77, 0x61, 0x6b, 0xdf, 0x0a, 0x8b, 0x3c, 0x8f, - 0xe6, 0xb0, 0x4c, 0x14, 0xe8, 0x05, 0x46, 0x6e, 0xdb, 0xcd, 0xc8, 0xcc, 0xb3, 0xf2, 0xec, 0x27, - 0x00, 0x00, 0xff, 0xff, 0x74, 0x3d, 0x2a, 0x06, 0xd7, 0x01, 0x00, 0x00, + // 364 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x51, 0xbd, 0x4e, 0xeb, 0x30, + 0x14, 0xae, 0xaf, 0xaa, 0xb4, 0xd7, 0x57, 0xb7, 0x83, 0xef, 0x0f, 0x51, 0x86, 0x14, 0x55, 0x0c, + 0x19, 0x68, 0x82, 0xca, 0xc2, 0x02, 0x43, 0x61, 0x28, 0x43, 0x97, 0x14, 0x18, 0xd8, 0x92, 0xf4, + 0x34, 0x58, 0x50, 0x3b, 0xc4, 0x4e, 0xa5, 0xbe, 0x09, 0x8f, 0xd4, 0xb1, 0x23, 0x53, 0x85, 0xc2, + 0xc6, 0x53, 0xa0, 0xda, 0x4e, 0x55, 0xa8, 0xba, 0xf9, 0x7c, 0x3f, 0xe7, 0x9c, 0xcf, 0x07, 0xff, + 0x13, 0x20, 0x04, 0xe5, 0x2c, 0x10, 0x90, 0xcf, 0x68, 0x02, 0x7e, 0x96, 0x73, 0xc9, 0x49, 0xc3, + 0xc0, 0xce, 0x9f, 0x8a, 0x97, 0xf3, 0x0c, 0x84, 0x66, 0x1d, 0x62, 0xc4, 0xc1, 0x14, 0x64, 0x64, + 0xb0, 0xbf, 0x15, 0x36, 0x83, 0x9c, 0x4e, 0xe6, 0x06, 0xed, 0xa6, 0x54, 0x3e, 0x14, 0xb1, 0x9f, + 0xf0, 0x69, 0x90, 0xf2, 0x94, 0x07, 0x0a, 0x8e, 0x8b, 0x89, 0xaa, 0x54, 0xa1, 0x5e, 0x5a, 0xde, + 0xf9, 0x40, 0xf8, 0xf7, 0x65, 0x0e, 0x91, 0x84, 0x10, 0x9e, 0x0b, 0x10, 0x92, 0x1c, 0xe1, 0xfa, + 0x35, 0xa3, 0xd2, 0x46, 0x87, 0xc8, 0xfb, 0xd5, 0x6b, 0xf9, 0x66, 0x1d, 0xff, 0x86, 0x3f, 0x02, + 0x1b, 0xd4, 0x42, 0xc5, 0x12, 0x0f, 0x5b, 0x23, 0x9a, 0x32, 0x18, 0xdb, 0x3f, 0xf6, 0xe8, 0x0c, + 0x4f, 0xce, 0x70, 0x7d, 0x08, 0x32, 0xb2, 0x63, 0xa5, 0x73, 0xfc, 0x2a, 0xb6, 0x99, 0xb7, 0xe6, + 0x06, 0x10, 0x8d, 0x21, 0xef, 0x37, 0x17, 0xab, 0x76, 0x6d, 0xb9, 0x6a, 0xa3, 0x50, 0x39, 0xc8, + 0x15, 0xb6, 0xee, 0x54, 0x34, 0x3b, 0x51, 0xde, 0xce, 0x77, 0xaf, 0x62, 0x69, 0x12, 0x49, 0xca, + 0xd9, 0x4e, 0x0f, 0xe3, 0xed, 0xff, 0xc4, 0x8d, 0x21, 0x08, 0x11, 0xa5, 0xd0, 0x11, 0xb8, 0x55, + 0x65, 0x15, 0x19, 0x67, 0x02, 0xc8, 0x31, 0x6e, 0xde, 0x32, 0xa1, 0x83, 0xec, 0x0b, 0xbc, 0x51, + 0xac, 0x43, 0x87, 0x20, 0x8a, 0x27, 0xb9, 0x3f, 0xb4, 0xe6, 0xb7, 0x86, 0xf6, 0x06, 0xb8, 0x31, + 0xd2, 0x2a, 0x72, 0x8e, 0x2d, 0x3d, 0x9f, 0xfc, 0xdf, 0x38, 0xbf, 0x7c, 0xbe, 0x73, 0xb0, 0x83, + 0xeb, 0x45, 0x3d, 0x74, 0x82, 0xfa, 0x17, 0x8b, 0xd2, 0x45, 0xcb, 0xd2, 0x45, 0xaf, 0xa5, 0x8b, + 0xde, 0x4a, 0x17, 0xbd, 0xbc, 0xbb, 0xb5, 0x7b, 0x6f, 0xeb, 0xe0, 0x4c, 0x64, 0x49, 0xd2, 0x1d, + 0xc3, 0x2c, 0x60, 0xc0, 0x27, 0xa2, 0xab, 0xcf, 0x6d, 0x5a, 0xc6, 0x96, 0x2a, 0x4f, 0x3f, 0x03, + 0x00, 0x00, 0xff, 0xff, 0xf6, 0xdd, 0x2a, 0xdb, 0x82, 0x02, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -382,6 +390,30 @@ func (m *CreateRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } + { + size, err := m.RequestVerificationHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x9a + { + size, err := m.RequestMetaHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x92 if m.Message != nil { { size := m.Message.Size() @@ -534,6 +566,10 @@ func (m *CreateRequest) Size() (n int) { if m.Message != nil { n += m.Message.Size() } + l = m.RequestMetaHeader.Size() + n += 2 + l + sovService(uint64(l)) + l = m.RequestVerificationHeader.Size() + n += 2 + l + sovService(uint64(l)) if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -709,6 +745,72 @@ func (m *CreateRequest) Unmarshal(dAtA []byte) error { } m.Message = &CreateRequest_Signed{v} iNdEx = postIndex + case 98: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RequestMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 99: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestVerificationHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RequestVerificationHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipService(dAtA[iNdEx:]) diff --git a/session/service.proto b/session/service.proto index 4b37aaf..9b0c65e 100644 --- a/session/service.proto +++ b/session/service.proto @@ -3,6 +3,8 @@ package session; option go_package = "github.com/nspcc-dev/neofs-proto/session"; import "session/types.proto"; +import "service/meta.proto"; +import "service/verify.proto"; import "github.com/gogo/protobuf/gogoproto/gogo.proto"; option (gogoproto.stable_marshaler_all) = true; @@ -34,6 +36,8 @@ message CreateRequest { // Signed Init message response (Unsigned) from server with user private key session.Token Signed = 2; } + service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; } message CreateResponse { diff --git a/state/service.pb.go b/state/service.pb.go index a368410..8e66a2f 100644 --- a/state/service.pb.go +++ b/state/service.pb.go @@ -9,6 +9,7 @@ import ( _ "github.com/gogo/protobuf/gogoproto" proto "github.com/golang/protobuf/proto" bootstrap "github.com/nspcc-dev/neofs-proto/bootstrap" + service "github.com/nspcc-dev/neofs-proto/service" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" @@ -30,9 +31,11 @@ const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package // NetmapRequest message to request current node netmap type NetmapRequest struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` + service.RequestVerificationHeader `protobuf:"bytes,99,opt,name=Verify,proto3,embedded=Verify" json:"Verify"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *NetmapRequest) Reset() { *m = NetmapRequest{} } @@ -66,9 +69,11 @@ var xxx_messageInfo_NetmapRequest proto.InternalMessageInfo // MetricsRequest message to request node metrics type MetricsRequest struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` + service.RequestVerificationHeader `protobuf:"bytes,99,opt,name=Verify,proto3,embedded=Verify" json:"Verify"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *MetricsRequest) Reset() { *m = MetricsRequest{} } @@ -148,9 +153,11 @@ func (m *MetricsResponse) GetMetrics() [][]byte { // HealthRequest message to check current state type HealthRequest struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` + service.RequestVerificationHeader `protobuf:"bytes,99,opt,name=Verify,proto3,embedded=Verify" json:"Verify"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *HealthRequest) Reset() { *m = HealthRequest{} } @@ -247,27 +254,33 @@ func init() { func init() { proto.RegisterFile("state/service.proto", fileDescriptor_695592f6f2fc97b7) } var fileDescriptor_695592f6f2fc97b7 = []byte{ - // 320 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x5c, 0x91, 0xbf, 0x4e, 0xc3, 0x30, - 0x10, 0xc6, 0x31, 0x88, 0x02, 0x06, 0x5a, 0x64, 0xda, 0x2a, 0xca, 0x10, 0x55, 0x1d, 0x50, 0x25, - 0xd4, 0x44, 0x02, 0x06, 0x84, 0x98, 0xca, 0xc2, 0x52, 0x86, 0x74, 0x63, 0x73, 0xdc, 0xeb, 0x1f, - 0x41, 0x6b, 0x13, 0x5f, 0x2a, 0xf5, 0x4d, 0x78, 0x10, 0x1e, 0x82, 0x91, 0x91, 0x11, 0x85, 0x17, - 0x41, 0xd8, 0x71, 0x20, 0xdd, 0xf2, 0xfd, 0x2e, 0xdf, 0xf9, 0xbb, 0x3b, 0x7a, 0xaa, 0x91, 0x23, - 0x44, 0x1a, 0xd2, 0xd5, 0x5c, 0x40, 0xa8, 0x52, 0x89, 0x92, 0xed, 0x1a, 0xe8, 0xb7, 0x12, 0x29, - 0x51, 0x63, 0xca, 0x55, 0x84, 0x6b, 0x05, 0xda, 0x56, 0xfd, 0xfe, 0x74, 0x8e, 0xb3, 0x2c, 0x09, - 0x85, 0x5c, 0x44, 0x53, 0x39, 0x95, 0x91, 0xc1, 0x49, 0x36, 0x31, 0xca, 0x08, 0xf3, 0x65, 0x7f, - 0xef, 0x36, 0xe8, 0xf1, 0x03, 0xe0, 0x82, 0xab, 0x18, 0x5e, 0x32, 0xd0, 0xd8, 0x3d, 0xa1, 0xf5, - 0x21, 0x60, 0x3a, 0x17, 0xda, 0x91, 0x73, 0xda, 0x28, 0x89, 0x56, 0x72, 0xa9, 0x81, 0x79, 0x74, - 0xaf, 0x40, 0x1e, 0xe9, 0xec, 0xf4, 0x8e, 0x62, 0x27, 0x7f, 0xfb, 0xdd, 0x03, 0x7f, 0xc6, 0x99, - 0x73, 0x0f, 0x68, 0xdd, 0x81, 0x3f, 0xb3, 0x25, 0x6b, 0x8f, 0x74, 0x48, 0x6f, 0x3f, 0x76, 0x92, - 0xb5, 0x69, 0x6d, 0x84, 0x1c, 0x33, 0xed, 0x6d, 0x77, 0x48, 0xef, 0x20, 0x2e, 0xd4, 0xc5, 0x1b, - 0x71, 0x05, 0x76, 0x45, 0x6b, 0x36, 0x2f, 0x6b, 0x86, 0x66, 0x0f, 0x61, 0x25, 0xbe, 0xdf, 0x0c, - 0xcb, 0xb5, 0x84, 0x23, 0x95, 0x02, 0x1f, 0x0f, 0xb9, 0x62, 0xd7, 0x65, 0x5e, 0xd6, 0x2a, 0x6c, - 0xd5, 0x21, 0xfd, 0xf6, 0x26, 0x2e, 0xc2, 0xde, 0xd0, 0x43, 0x9b, 0xee, 0x6e, 0x06, 0xe2, 0xa9, - 0x7c, 0xb4, 0x32, 0xa3, 0xdf, 0xda, 0xa0, 0xd6, 0x3b, 0xb8, 0x7d, 0xcf, 0x03, 0xf2, 0x91, 0x07, - 0xe4, 0x33, 0x0f, 0xc8, 0x57, 0x1e, 0x90, 0xd7, 0xef, 0x60, 0xeb, 0xf1, 0xec, 0xdf, 0x81, 0x96, - 0x5a, 0x09, 0xd1, 0x1f, 0xc3, 0x2a, 0x5a, 0x82, 0x9c, 0xe8, 0xbe, 0x3d, 0x8f, 0x69, 0x96, 0xd4, - 0x8c, 0xb8, 0xfc, 0x09, 0x00, 0x00, 0xff, 0xff, 0x73, 0xd9, 0x9d, 0xd0, 0x04, 0x02, 0x00, 0x00, + // 408 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x93, 0xbf, 0xae, 0xd3, 0x30, + 0x14, 0xc6, 0xaf, 0xf9, 0x13, 0x2e, 0xbe, 0x70, 0x91, 0x4c, 0x5b, 0x45, 0x19, 0xd2, 0xa8, 0x03, + 0x8a, 0x84, 0x9a, 0x48, 0x85, 0xa1, 0x42, 0x4c, 0x85, 0xa1, 0x4b, 0x19, 0x52, 0x89, 0x81, 0xcd, + 0x71, 0x4f, 0xdb, 0x08, 0x1a, 0x9b, 0xf8, 0xa4, 0x52, 0x9f, 0x02, 0x46, 0x1e, 0x84, 0x87, 0xe8, + 0xd8, 0x91, 0xa9, 0x42, 0xe1, 0x45, 0x10, 0x8e, 0x13, 0x68, 0x79, 0x81, 0x6e, 0xf9, 0x7e, 0x5f, + 0x3e, 0xe7, 0xd3, 0xc9, 0x31, 0x7d, 0xaa, 0x91, 0x23, 0xc4, 0x1a, 0x8a, 0x6d, 0x26, 0x20, 0x52, + 0x85, 0x44, 0xc9, 0xee, 0x1b, 0xe8, 0x31, 0x4b, 0xe3, 0x0d, 0x20, 0xaf, 0x2d, 0xaf, 0xd3, 0xb0, + 0x2d, 0x14, 0xd9, 0x72, 0x67, 0x69, 0x37, 0x95, 0x12, 0x35, 0x16, 0x5c, 0xc5, 0xb8, 0x53, 0xa0, + 0x2d, 0x1e, 0xae, 0x32, 0x5c, 0x97, 0x69, 0x24, 0xe4, 0x26, 0x5e, 0xc9, 0x95, 0x8c, 0x0d, 0x4e, + 0xcb, 0xa5, 0x51, 0x46, 0x98, 0xa7, 0xfa, 0xf5, 0xc1, 0x17, 0x42, 0x1f, 0xbf, 0x03, 0xdc, 0x70, + 0x95, 0xc0, 0xe7, 0x12, 0x34, 0xb2, 0x31, 0xbd, 0x37, 0x03, 0xe4, 0x6e, 0x1a, 0x90, 0xf0, 0x66, + 0xe4, 0x45, 0x4d, 0x4d, 0xeb, 0xff, 0xf1, 0xa6, 0xc0, 0x17, 0x50, 0x4c, 0xae, 0xf7, 0xc7, 0xfe, + 0xd5, 0xe1, 0xd8, 0x27, 0x89, 0x49, 0xb0, 0xb7, 0xd4, 0x79, 0x6f, 0x1a, 0xba, 0xc2, 0x64, 0x07, + 0xe7, 0x59, 0xe3, 0x66, 0x82, 0x63, 0x26, 0xf3, 0xff, 0xce, 0xb0, 0xd9, 0xc1, 0x57, 0x42, 0x6f, + 0x67, 0x80, 0x45, 0x26, 0xf4, 0xa5, 0x54, 0x7a, 0x4e, 0x9f, 0xb4, 0x8d, 0xb4, 0x92, 0xb9, 0x06, + 0xe6, 0xd2, 0x07, 0x16, 0xb9, 0x24, 0xb8, 0x1b, 0x3e, 0x4a, 0x1a, 0x69, 0x26, 0x3a, 0x05, 0xfe, + 0x09, 0xd7, 0x97, 0x52, 0x7f, 0x42, 0x6f, 0x9b, 0x42, 0x7f, 0xdb, 0xd7, 0x64, 0xe7, 0x92, 0x80, + 0x84, 0xd7, 0x49, 0x23, 0x59, 0x8f, 0x3a, 0x73, 0xe4, 0x58, 0x6a, 0xf7, 0x4e, 0x40, 0xc2, 0x87, + 0x89, 0x55, 0xa3, 0xef, 0xa4, 0x31, 0xd8, 0x4b, 0xea, 0xd4, 0x1b, 0xc3, 0x3a, 0x91, 0x59, 0xda, + 0xe8, 0x64, 0x81, 0xbc, 0x4e, 0xd4, 0x6e, 0x66, 0x34, 0x57, 0x05, 0xf0, 0xc5, 0x8c, 0x2b, 0x36, + 0x6e, 0x07, 0xc6, 0xba, 0x36, 0x76, 0xfa, 0x97, 0xbd, 0xde, 0x39, 0xb6, 0x65, 0x5f, 0xd1, 0x9b, + 0xba, 0xdd, 0x9b, 0x35, 0x88, 0x8f, 0xed, 0x47, 0x4f, 0x66, 0xec, 0x75, 0xcf, 0x68, 0x9d, 0x9d, + 0xbc, 0xde, 0x57, 0x3e, 0x39, 0x54, 0x3e, 0xf9, 0x51, 0xf9, 0xe4, 0x67, 0xe5, 0x93, 0x6f, 0xbf, + 0xfc, 0xab, 0x0f, 0xcf, 0xfe, 0xb9, 0x23, 0xb9, 0x56, 0x42, 0x0c, 0x17, 0xb0, 0x8d, 0x73, 0x90, + 0x4b, 0x3d, 0xac, 0x6f, 0x88, 0x39, 0x2c, 0x75, 0x8c, 0x78, 0xf1, 0x3b, 0x00, 0x00, 0xff, 0xff, + 0x78, 0x9b, 0x96, 0xe5, 0xb1, 0x03, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -454,6 +467,30 @@ func (m *NetmapRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } + { + size, err := m.RequestVerificationHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x9a + { + size, err := m.RequestMetaHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x92 return len(dAtA) - i, nil } @@ -481,6 +518,30 @@ func (m *MetricsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } + { + size, err := m.RequestVerificationHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x9a + { + size, err := m.RequestMetaHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x92 return len(dAtA) - i, nil } @@ -544,6 +605,30 @@ func (m *HealthRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } + { + size, err := m.RequestVerificationHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x9a + { + size, err := m.RequestMetaHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x92 return len(dAtA) - i, nil } @@ -608,6 +693,10 @@ func (m *NetmapRequest) Size() (n int) { } var l int _ = l + l = m.RequestMetaHeader.Size() + n += 2 + l + sovService(uint64(l)) + l = m.RequestVerificationHeader.Size() + n += 2 + l + sovService(uint64(l)) if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -620,6 +709,10 @@ func (m *MetricsRequest) Size() (n int) { } var l int _ = l + l = m.RequestMetaHeader.Size() + n += 2 + l + sovService(uint64(l)) + l = m.RequestVerificationHeader.Size() + n += 2 + l + sovService(uint64(l)) if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -650,6 +743,10 @@ func (m *HealthRequest) Size() (n int) { } var l int _ = l + l = m.RequestMetaHeader.Size() + n += 2 + l + sovService(uint64(l)) + l = m.RequestVerificationHeader.Size() + n += 2 + l + sovService(uint64(l)) if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -710,6 +807,72 @@ func (m *NetmapRequest) Unmarshal(dAtA []byte) error { return fmt.Errorf("proto: NetmapRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { + case 98: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RequestMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 99: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestVerificationHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RequestVerificationHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipService(dAtA[iNdEx:]) @@ -764,6 +927,72 @@ func (m *MetricsRequest) Unmarshal(dAtA []byte) error { return fmt.Errorf("proto: MetricsRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { + case 98: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RequestMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 99: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestVerificationHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RequestVerificationHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipService(dAtA[iNdEx:]) @@ -904,6 +1133,72 @@ func (m *HealthRequest) Unmarshal(dAtA []byte) error { return fmt.Errorf("proto: HealthRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { + case 98: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RequestMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 99: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestVerificationHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RequestVerificationHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipService(dAtA[iNdEx:]) diff --git a/state/service.proto b/state/service.proto index 3c85d86..cb2698b 100644 --- a/state/service.proto +++ b/state/service.proto @@ -2,6 +2,8 @@ syntax = "proto3"; package state; option go_package = "github.com/nspcc-dev/neofs-proto/state"; +import "service/meta.proto"; +import "service/verify.proto"; import "bootstrap/types.proto"; import "github.com/gogo/protobuf/gogoproto/gogo.proto"; @@ -19,10 +21,16 @@ service Status { } // NetmapRequest message to request current node netmap -message NetmapRequest {} +message NetmapRequest { + service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; +} // MetricsRequest message to request node metrics -message MetricsRequest {} +message MetricsRequest { + service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; +} // MetricsResponse contains [][]byte, // every []byte is marshaled MetricFamily proto message @@ -32,7 +40,10 @@ message MetricsResponse { } // HealthRequest message to check current state -message HealthRequest {} +message HealthRequest { + service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; +} // HealthResponse message with current state message HealthResponse { From 5c344bfceb7d42921d070a43546d2cff3db298ff Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Tue, 19 Nov 2019 19:03:42 +0300 Subject: [PATCH 0023/1196] Fix issue with Sign/VerifyRequestHeader proto.Clone proto.Clone couldn't makes copy for custom fields. We should reset and restore MetaHeader before/after Sign/Verify. Add test coverage to check that all works like expected. --- service/meta.go | 24 ++++++--- service/verify.go | 68 ++++++++++++++++++++------ service/verify_test.go | 37 ++++++++++++++ service/verify_test.pb.go | 100 +++++++++++++++++++++++++++++--------- service/verify_test.proto | 1 + 5 files changed, 185 insertions(+), 45 deletions(-) diff --git a/service/meta.go b/service/meta.go index cd3459e..52874c1 100644 --- a/service/meta.go +++ b/service/meta.go @@ -8,10 +8,11 @@ import ( type ( // MetaHeader contains meta information of request. - // It provides methods to get or set meta information - // and reset meta header. + // It provides methods to get or set meta information meta header. + // Also contains methods to reset and restore meta header. MetaHeader interface { - ResetMeta() + ResetMeta() RequestMetaHeader + RestoreMeta(RequestMetaHeader) // TTLRequest to verify and update ttl requests. GetTTL() uint32 @@ -22,7 +23,7 @@ type ( SetEpoch(v uint64) } - // TTLCondition is closure, that allows to validate request with ttl + // TTLCondition is closure, that allows to validate request with ttl. TTLCondition func(ttl uint32) error ) @@ -45,14 +46,21 @@ const ( ErrIncorrectTTL = internal.Error("incorrect ttl") ) -// SetTTL sets TTL to RequestMetaHeader +// SetTTL sets TTL to RequestMetaHeader. func (m *RequestMetaHeader) SetTTL(v uint32) { m.TTL = v } -// SetEpoch sets Epoch to RequestMetaHeader +// SetEpoch sets Epoch to RequestMetaHeader. func (m *RequestMetaHeader) SetEpoch(v uint64) { m.Epoch = v } -// ResetMeta sets RequestMetaHeader to empty value -func (m *RequestMetaHeader) ResetMeta() { m.Reset() } +// ResetMeta returns current value and sets RequestMetaHeader to empty value. +func (m *RequestMetaHeader) ResetMeta() RequestMetaHeader { + cp := *m + m.Reset() + return cp +} + +// RestoreMeta sets current RequestMetaHeader to passed value. +func (m *RequestMetaHeader) RestoreMeta(v RequestMetaHeader) { *m = v } // IRNonForwarding condition that allows NonForwardingTTL only for IR func IRNonForwarding(role NodeRole) TTLCondition { diff --git a/service/verify.go b/service/verify.go index d8ede7e..a6ac3a5 100644 --- a/service/verify.go +++ b/service/verify.go @@ -10,7 +10,7 @@ import ( ) type ( - // VerifiableRequest adds possibility to sign and verify request header + // VerifiableRequest adds possibility to sign and verify request header. VerifiableRequest interface { proto.Message Marshal() ([]byte, error) @@ -30,19 +30,19 @@ type ( ) const ( - // ErrCannotLoadPublicKey is raised when cannot unmarshal public key from RequestVerificationHeader_Sign + // ErrCannotLoadPublicKey is raised when cannot unmarshal public key from RequestVerificationHeader_Sign. ErrCannotLoadPublicKey = internal.Error("cannot load public key") - // ErrCannotFindOwner is raised when signatures empty in GetOwner + // ErrCannotFindOwner is raised when signatures empty in GetOwner. ErrCannotFindOwner = internal.Error("cannot find owner public key") ) -// SetSignatures replaces signatures stored in RequestVerificationHeader +// SetSignatures replaces signatures stored in RequestVerificationHeader. func (m *RequestVerificationHeader) SetSignatures(signatures []*RequestVerificationHeader_Signature) { m.Signatures = signatures } -// AddSignature adds new Signature into RequestVerificationHeader +// AddSignature adds new Signature into RequestVerificationHeader. func (m *RequestVerificationHeader) AddSignature(sig *RequestVerificationHeader_Signature) { if sig == nil { return @@ -123,12 +123,14 @@ func newSignature(key *ecdsa.PrivateKey, data []byte) (*RequestVerificationHeade // SignRequestHeader receives private key and request with RequestVerificationHeader, // tries to marshal and sign request with passed PrivateKey, after that adds // new signature to headers. If something went wrong, returns error. -func SignRequestHeader(key *ecdsa.PrivateKey, req VerifiableRequest) error { - msg := proto.Clone(req).(VerifiableRequest) - +func SignRequestHeader(key *ecdsa.PrivateKey, msg VerifiableRequest) error { // ignore meta header if meta, ok := msg.(MetaHeader); ok { - meta.ResetMeta() + h := meta.ResetMeta() + + defer func() { + meta.RestoreMeta(h) + }() } data, err := msg.Marshal() @@ -141,22 +143,28 @@ func SignRequestHeader(key *ecdsa.PrivateKey, req VerifiableRequest) error { return err } - req.AddSignature(signature) + msg.AddSignature(signature) return nil } // VerifyRequestHeader receives request with RequestVerificationHeader, -// tries to marshal and verify each signature from request +// tries to marshal and verify each signature from request. // If something went wrong, returns error. -func VerifyRequestHeader(req VerifiableRequest) error { - msg := proto.Clone(req).(VerifiableRequest) +func VerifyRequestHeader(msg VerifiableRequest) error { // ignore meta header if meta, ok := msg.(MetaHeader); ok { - meta.ResetMeta() + h := meta.ResetMeta() + + defer func() { + meta.RestoreMeta(h) + }() } signatures := msg.GetSignatures() + defer func() { + msg.SetSignatures(signatures) + }() for i := range signatures { msg.SetSignatures(signatures[:i]) @@ -177,3 +185,35 @@ func VerifyRequestHeader(req VerifiableRequest) error { return nil } + +// testCustomField for test usage only. +type testCustomField [8]uint32 + +var _ internal.Custom = (*testCustomField)(nil) + +// Reset skip, it's for test usage only. +func (t testCustomField) Reset() {} + +// ProtoMessage skip, it's for test usage only. +func (t testCustomField) ProtoMessage() {} + +// Size skip, it's for test usage only. +func (t testCustomField) Size() int { return 32 } + +// String skip, it's for test usage only. +func (t testCustomField) String() string { return "" } + +// Bytes skip, it's for test usage only. +func (t testCustomField) Bytes() []byte { return nil } + +// Unmarshal skip, it's for test usage only. +func (t testCustomField) Unmarshal(data []byte) error { return nil } + +// Empty skip, it's for test usage only. +func (t testCustomField) Empty() bool { return false } + +// UnmarshalTo skip, it's for test usage only. +func (t testCustomField) MarshalTo(data []byte) (int, error) { return 0, nil } + +// Marshal skip, it's for test usage only. +func (t testCustomField) Marshal() ([]byte, error) { return nil, nil } diff --git a/service/verify_test.go b/service/verify_test.go index 4aaefb4..1403c67 100644 --- a/service/verify_test.go +++ b/service/verify_test.go @@ -1,9 +1,12 @@ package service import ( + "bytes" + "log" "math" "testing" + "github.com/gogo/protobuf/proto" crypto "github.com/nspcc-dev/neofs-crypto" "github.com/nspcc-dev/neofs-crypto/test" "github.com/pkg/errors" @@ -104,3 +107,37 @@ func TestMaintainableRequest(t *testing.T) { require.EqualError(t, errors.Cause(err), crypto.ErrInvalidSignature.Error()) } } + +func TestVerifyAndSignRequestHeaderWithoutCloning(t *testing.T) { + key := test.DecodeKey(0) + + custom := testCustomField{1, 2, 3, 4, 5, 6, 7, 8} + + b := &TestRequest{ + IntField: math.MaxInt32, + StringField: "TestRequestStringField", + BytesField: []byte("TestRequestBytesField"), + CustomField: &custom, + RequestMetaHeader: RequestMetaHeader{ + TTL: math.MaxInt32 - 8, + Epoch: math.MaxInt64 - 12, + }, + } + + require.NoError(t, SignRequestHeader(key, b)) + require.NoError(t, VerifyRequestHeader(b)) + + require.Len(t, b.Signatures, 1) + require.Equal(t, custom, *b.CustomField) + require.Equal(t, uint32(math.MaxInt32-8), b.GetTTL()) + require.Equal(t, uint64(math.MaxInt64-12), b.GetEpoch()) + + buf := bytes.NewBuffer(nil) + log.SetOutput(buf) + + cp, ok := proto.Clone(b).(*TestRequest) + require.True(t, ok) + require.NotEqual(t, b, cp) + + require.Contains(t, buf.String(), "proto: don't know how to copy") +} diff --git a/service/verify_test.pb.go b/service/verify_test.pb.go index a029c2e..06e7971 100644 --- a/service/verify_test.pb.go +++ b/service/verify_test.pb.go @@ -24,9 +24,10 @@ var _ = math.Inf const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package type TestRequest struct { - IntField int32 `protobuf:"varint,1,opt,name=IntField,proto3" json:"IntField,omitempty"` - StringField string `protobuf:"bytes,2,opt,name=StringField,proto3" json:"StringField,omitempty"` - BytesField []byte `protobuf:"bytes,3,opt,name=BytesField,proto3" json:"BytesField,omitempty"` + IntField int32 `protobuf:"varint,1,opt,name=IntField,proto3" json:"IntField,omitempty"` + StringField string `protobuf:"bytes,2,opt,name=StringField,proto3" json:"StringField,omitempty"` + BytesField []byte `protobuf:"bytes,3,opt,name=BytesField,proto3" json:"BytesField,omitempty"` + CustomField *testCustomField `protobuf:"bytes,4,opt,name=CustomField,proto3,customtype=testCustomField" json:"CustomField,omitempty"` RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` RequestVerificationHeader `protobuf:"bytes,99,opt,name=Header,proto3,embedded=Header" json:"Header"` XXX_NoUnkeyedLiteral struct{} `json:"-"` @@ -91,26 +92,28 @@ func init() { func init() { proto.RegisterFile("service/verify_test.proto", fileDescriptor_1effa83201a30d75) } var fileDescriptor_1effa83201a30d75 = []byte{ - // 296 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x90, 0xbf, 0x4e, 0xeb, 0x30, - 0x14, 0xc6, 0xeb, 0x7b, 0xa1, 0x14, 0x97, 0xc9, 0x62, 0x28, 0x19, 0xdc, 0xa8, 0x53, 0x96, 0x26, - 0x12, 0x2c, 0x4c, 0x0c, 0x15, 0x42, 0x30, 0xb0, 0x04, 0xc4, 0xc0, 0x82, 0x12, 0xe7, 0x24, 0x58, - 0xa2, 0x71, 0x89, 0x4f, 0x22, 0xf5, 0x4d, 0x78, 0xa4, 0x8e, 0x1d, 0x99, 0x2a, 0x14, 0x46, 0x5e, - 0x02, 0xd5, 0x36, 0x28, 0xc0, 0x96, 0xef, 0xcf, 0x2f, 0x47, 0xfe, 0xe8, 0x91, 0x86, 0xaa, 0x91, - 0x02, 0xa2, 0x06, 0x2a, 0x99, 0x2f, 0x1f, 0x10, 0x34, 0x86, 0x8b, 0x4a, 0xa1, 0x62, 0x7b, 0x2e, - 0xf2, 0xd8, 0x57, 0x67, 0x0e, 0x98, 0xd8, 0xd0, 0x3b, 0xfc, 0xc9, 0x39, 0x77, 0x5a, 0x48, 0x7c, - 0xac, 0xd3, 0x50, 0xa8, 0x79, 0x54, 0xa8, 0x42, 0x45, 0xc6, 0x4e, 0xeb, 0xdc, 0x28, 0x23, 0xcc, - 0x97, 0xad, 0x4f, 0x3e, 0x08, 0x1d, 0xde, 0x82, 0xc6, 0x18, 0x9e, 0x6b, 0xd0, 0xc8, 0x3c, 0x3a, - 0xb8, 0x2a, 0xf1, 0x42, 0xc2, 0x53, 0x36, 0x22, 0x3e, 0x09, 0x76, 0xe3, 0x6f, 0xcd, 0x7c, 0x3a, - 0xbc, 0xc1, 0x4a, 0x96, 0x85, 0x8d, 0xff, 0xf9, 0x24, 0xd8, 0x8f, 0xbb, 0x16, 0xe3, 0x94, 0xce, - 0x96, 0x08, 0xda, 0x16, 0xfe, 0xfb, 0x24, 0x38, 0x88, 0x3b, 0x0e, 0x3b, 0xa5, 0x3b, 0xd7, 0x80, - 0xc9, 0x28, 0xf5, 0x49, 0x30, 0x3c, 0xf6, 0x42, 0xf7, 0x82, 0xd0, 0x5d, 0xdf, 0x66, 0x97, 0x90, - 0x64, 0x50, 0xcd, 0x06, 0xab, 0xcd, 0xb8, 0xb7, 0xde, 0x8c, 0x49, 0x6c, 0x08, 0x76, 0x4e, 0xfb, - 0x36, 0x19, 0x09, 0xc3, 0x4e, 0x7e, 0xb3, 0x77, 0xdb, 0x11, 0xa4, 0x48, 0x50, 0xaa, 0xf2, 0xcf, - 0x3f, 0x1c, 0x3b, 0x3b, 0x5b, 0xb5, 0x9c, 0xac, 0x5b, 0x4e, 0x5e, 0x5b, 0x4e, 0xde, 0x5a, 0x4e, - 0x5e, 0xde, 0x79, 0xef, 0x3e, 0xe8, 0x4c, 0x56, 0xea, 0x85, 0x10, 0xd3, 0x0c, 0x9a, 0xa8, 0x04, - 0x95, 0xeb, 0xa9, 0x1d, 0xcc, 0xdd, 0x4a, 0xfb, 0x46, 0x9e, 0x7c, 0x06, 0x00, 0x00, 0xff, 0xff, - 0xa6, 0xdb, 0x5f, 0x7a, 0xb3, 0x01, 0x00, 0x00, + // 322 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x90, 0x31, 0x4f, 0xc3, 0x30, + 0x10, 0x85, 0xeb, 0x52, 0x4a, 0x71, 0x90, 0x90, 0x0c, 0x43, 0xc9, 0x90, 0x46, 0x9d, 0xb2, 0x34, + 0x91, 0x40, 0x48, 0x4c, 0x0c, 0x01, 0x21, 0x18, 0x58, 0x02, 0x62, 0x60, 0x41, 0x49, 0x7a, 0x0d, + 0x96, 0x68, 0x5c, 0xe2, 0x4b, 0xa5, 0xfe, 0x13, 0x66, 0x7e, 0x4d, 0xc7, 0x8e, 0x88, 0xa1, 0x42, + 0xe1, 0x8f, 0xa0, 0xd8, 0x06, 0x05, 0xd8, 0xfc, 0xde, 0xfb, 0x9e, 0xed, 0x3b, 0x7a, 0x20, 0xa1, + 0x98, 0xf3, 0x14, 0x82, 0x39, 0x14, 0x7c, 0xb2, 0x78, 0x40, 0x90, 0xe8, 0xcf, 0x0a, 0x81, 0x82, + 0x6d, 0x99, 0xc8, 0x66, 0xdf, 0xcc, 0x14, 0x30, 0xd6, 0xa1, 0xbd, 0xff, 0xbb, 0x67, 0xdc, 0x51, + 0xc6, 0xf1, 0xb1, 0x4c, 0xfc, 0x54, 0x4c, 0x83, 0x4c, 0x64, 0x22, 0x50, 0x76, 0x52, 0x4e, 0x94, + 0x52, 0x42, 0x9d, 0x34, 0x3e, 0x7c, 0x6d, 0x53, 0xeb, 0x16, 0x24, 0x46, 0xf0, 0x5c, 0x82, 0x44, + 0x66, 0xd3, 0xde, 0x55, 0x8e, 0x17, 0x1c, 0x9e, 0xc6, 0x7d, 0xe2, 0x12, 0x6f, 0x33, 0xfa, 0xd1, + 0xcc, 0xa5, 0xd6, 0x0d, 0x16, 0x3c, 0xcf, 0x74, 0xdc, 0x76, 0x89, 0xb7, 0x1d, 0x35, 0x2d, 0xe6, + 0x50, 0x1a, 0x2e, 0x10, 0xa4, 0x06, 0x36, 0x5c, 0xe2, 0xed, 0x44, 0x0d, 0x87, 0x1d, 0x53, 0xeb, + 0xac, 0x94, 0x28, 0xa6, 0x1a, 0xe8, 0xd4, 0x40, 0xb8, 0xf7, 0xbe, 0x1e, 0xec, 0xd6, 0x43, 0x37, + 0xa2, 0xa8, 0xc9, 0xb1, 0x13, 0xda, 0xb9, 0x06, 0x8c, 0xfb, 0x89, 0x4b, 0x3c, 0xeb, 0xd0, 0xf6, + 0xcd, 0xe0, 0xbe, 0xf9, 0x74, 0x9d, 0x5d, 0x42, 0x3c, 0x86, 0x22, 0xec, 0x2d, 0xd7, 0x83, 0xd6, + 0x6a, 0x3d, 0x20, 0x91, 0x6a, 0xb0, 0x73, 0xda, 0xd5, 0x49, 0x3f, 0x55, 0xdd, 0xe1, 0xdf, 0xee, + 0x5d, 0xbd, 0x3b, 0x9e, 0xc6, 0xc8, 0x45, 0xfe, 0xef, 0x0e, 0xd3, 0x0d, 0x4f, 0x97, 0x95, 0x43, + 0x56, 0x95, 0x43, 0xde, 0x2a, 0x87, 0x7c, 0x54, 0x0e, 0x79, 0xf9, 0x74, 0x5a, 0xf7, 0x5e, 0x63, + 0xd3, 0xb9, 0x9c, 0xa5, 0xe9, 0x68, 0x0c, 0xf3, 0x20, 0x07, 0x31, 0x91, 0x23, 0xbd, 0x67, 0xf3, + 0x56, 0xd2, 0x55, 0xf2, 0xe8, 0x2b, 0x00, 0x00, 0xff, 0xff, 0xf7, 0x37, 0x92, 0xd2, 0xea, 0x01, + 0x00, 0x00, } func (m *TestRequest) Marshal() (dAtA []byte, err error) { @@ -161,6 +164,18 @@ func (m *TestRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x6 i-- dAtA[i] = 0x92 + if m.CustomField != nil { + { + size := m.CustomField.Size() + i -= size + if _, err := m.CustomField.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintVerifyTest(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } if len(m.BytesField) > 0 { i -= len(m.BytesField) copy(dAtA[i:], m.BytesField) @@ -211,6 +226,10 @@ func (m *TestRequest) Size() (n int) { if l > 0 { n += 1 + l + sovVerifyTest(uint64(l)) } + if m.CustomField != nil { + l = m.CustomField.Size() + n += 1 + l + sovVerifyTest(uint64(l)) + } l = m.RequestMetaHeader.Size() n += 2 + l + sovVerifyTest(uint64(l)) l = m.RequestVerificationHeader.Size() @@ -341,6 +360,41 @@ func (m *TestRequest) Unmarshal(dAtA []byte) error { m.BytesField = []byte{} } iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CustomField", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVerifyTest + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthVerifyTest + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthVerifyTest + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var v testCustomField + m.CustomField = &v + if err := m.CustomField.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex case 98: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType) diff --git a/service/verify_test.proto b/service/verify_test.proto index 5eb8cfd..c632615 100644 --- a/service/verify_test.proto +++ b/service/verify_test.proto @@ -12,6 +12,7 @@ message TestRequest { int32 IntField = 1; string StringField = 2; bytes BytesField = 3; + bytes CustomField = 4 [(gogoproto.customtype) = "testCustomField"]; RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; RequestVerificationHeader Header = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; } From 4efb4dafe87d417677004fcf4fce9f3216a46780 Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Wed, 20 Nov 2019 12:49:05 +0300 Subject: [PATCH 0024/1196] Add ErrNotFound for container --- container/service.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/container/service.go b/container/service.go index 5f446da..4d3747e 100644 --- a/container/service.go +++ b/container/service.go @@ -4,6 +4,7 @@ import ( "bytes" "encoding/binary" + "github.com/nspcc-dev/neofs-proto/internal" "github.com/nspcc-dev/neofs-proto/refs" "github.com/pkg/errors" ) @@ -19,6 +20,11 @@ type ( MessageID = refs.MessageID ) +const ( + // ErrNotFound is raised when container could not be found. + ErrNotFound = internal.Error("could not find container") +) + // SetSignature sets signature to PutRequest to satisfy SignedRequest interface. func (m *PutRequest) SetSignature(v []byte) { m.Signature = v } From ce667591e94686db28c21dcb08d15db1c33c14e5 Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Thu, 21 Nov 2019 14:09:44 +0300 Subject: [PATCH 0025/1196] Add CODECOV_TOKEN --- .github/workflows/go.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index de59f36..d846055 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -38,4 +38,6 @@ jobs: run: go test -coverprofile=coverage.txt -covermode=atomic ./... - name: Codecov + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} run: bash <(curl -s https://codecov.io/bash) From 16101b7d84cebf35e855ba0e30ab6d7d552e2385 Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Thu, 21 Nov 2019 15:13:07 +0300 Subject: [PATCH 0026/1196] proto: add version of protocol into meta header --- service/meta.go | 12 +++++++++++- service/meta.proto | 5 +++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/service/meta.go b/service/meta.go index 52874c1..1e3fcc8 100644 --- a/service/meta.go +++ b/service/meta.go @@ -10,6 +10,7 @@ type ( // MetaHeader contains meta information of request. // It provides methods to get or set meta information meta header. // Also contains methods to reset and restore meta header. + // Also contains methods to get or set request protocol version MetaHeader interface { ResetMeta() RequestMetaHeader RestoreMeta(RequestMetaHeader) @@ -20,7 +21,16 @@ type ( // EpochRequest gives possibility to get or set epoch in RPC Requests. GetEpoch() uint64 - SetEpoch(v uint64) + SetEpoch(uint64) + + // VersionHeader allows get or set version of protocol request + VersionHeader + } + + // VersionHeader allows get or set version of protocol request + VersionHeader interface { + GetVersion() uint32 + SetVersion(uint32) } // TTLCondition is closure, that allows to validate request with ttl. diff --git a/service/meta.proto b/service/meta.proto index 4c09fb3..62866d2 100644 --- a/service/meta.proto +++ b/service/meta.proto @@ -7,6 +7,7 @@ import "github.com/gogo/protobuf/gogoproto/gogo.proto"; option (gogoproto.stable_marshaler_all) = true; message RequestMetaHeader { - uint32 TTL = 1; - uint64 Epoch = 2; + uint32 TTL = 1; + uint64 Epoch = 2; + uint32 Version = 3; } From cc3b4d9087a9499b5bde677209ebe8b997adbc77 Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Thu, 21 Nov 2019 15:17:54 +0300 Subject: [PATCH 0027/1196] proto: SearchRequest rename Version to QueryVersion --- object/service.proto | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/object/service.proto b/object/service.proto index 6abe8ed..da54447 100644 --- a/object/service.proto +++ b/object/service.proto @@ -129,12 +129,12 @@ message HeadResponse { } message SearchRequest { - // Version of search query format - uint32 Version = 1; // ContainerID for searching the object - bytes ContainerID = 2 [(gogoproto.nullable) = false, (gogoproto.customtype) = "CID"]; + bytes ContainerID = 1 [(gogoproto.nullable) = false, (gogoproto.customtype) = "CID"]; // Query in the binary serialized format - bytes Query = 3; + bytes Query = 2; + // QueryVersion is a version of search query format + uint32 QueryVersion = 3; // RequestMetaHeader contains information about request meta headers (should be embedded into message) service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) From b8f3641b591e2416fe7fa8222d2bda84a49833b5 Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Thu, 21 Nov 2019 15:20:49 +0300 Subject: [PATCH 0028/1196] service: add `SetVersion` to satisfy `MetaHeader` interface --- service/meta.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/service/meta.go b/service/meta.go index 1e3fcc8..6b5b8b7 100644 --- a/service/meta.go +++ b/service/meta.go @@ -56,6 +56,9 @@ const ( ErrIncorrectTTL = internal.Error("incorrect ttl") ) +// SetVersion sets protocol version to RequestMetaHeader. +func (m *RequestMetaHeader) SetVersion(v uint32) { m.Version = v } + // SetTTL sets TTL to RequestMetaHeader. func (m *RequestMetaHeader) SetTTL(v uint32) { m.TTL = v } From e2842ae2166ab0f2f6aebd5b5aa0ccb933ef9045 Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Thu, 21 Nov 2019 15:14:01 +0300 Subject: [PATCH 0029/1196] docs: add doc comments for meta and verify proto files --- service/meta.proto | 6 ++++++ service/verify.proto | 10 ++++++++++ 2 files changed, 16 insertions(+) diff --git a/service/meta.proto b/service/meta.proto index 62866d2..d3c3005 100644 --- a/service/meta.proto +++ b/service/meta.proto @@ -6,8 +6,14 @@ import "github.com/gogo/protobuf/gogoproto/gogo.proto"; option (gogoproto.stable_marshaler_all) = true; +// RequestMetaHeader contains information about request meta headers +// (should be embedded into message) message RequestMetaHeader { + // TTL must be larger than zero, it decreased in every NeoFS Node uint32 TTL = 1; + // Epoch for user can be empty, because node sets epoch to the actual value uint64 Epoch = 2; + // Version defines protocol version + // TODO: not used for now, should be implemented in future uint32 Version = 3; } diff --git a/service/verify.proto b/service/verify.proto index 7d83308..c70015b 100644 --- a/service/verify.proto +++ b/service/verify.proto @@ -6,15 +6,25 @@ import "github.com/gogo/protobuf/gogoproto/gogo.proto"; option (gogoproto.stable_marshaler_all) = true; +// RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request +// (should be embedded into message). message RequestVerificationHeader { message Sign { + // Sign is signature of the request or session key. bytes Sign = 1; + // Peer is compressed public key used for signature. bytes Peer = 2; } + message Signature { + // Sign is a signature and public key of the request. Sign Sign = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + // Origin used for requests, when trusted node changes it and re-sign with session key. + // If session key used for signature request, then Origin should contain + // public key of user and signed session key. Sign Origin = 2; } + // Signatures is a set of signatures of every passed NeoFS Node repeated Signature Signatures = 1; } From c35eefec3b5e4d0d33aff42f827f41ed8d72d440 Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Thu, 21 Nov 2019 15:27:17 +0300 Subject: [PATCH 0030/1196] docs: add doc comments for session and state requests --- session/service.proto | 2 ++ state/service.proto | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/session/service.proto b/session/service.proto index 9b0c65e..377e77e 100644 --- a/session/service.proto +++ b/session/service.proto @@ -36,7 +36,9 @@ message CreateRequest { // Signed Init message response (Unsigned) from server with user private key session.Token Signed = 2; } + // RequestMetaHeader contains information about request meta headers (should be embedded into message) service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; } diff --git a/state/service.proto b/state/service.proto index cb2698b..ed90e26 100644 --- a/state/service.proto +++ b/state/service.proto @@ -22,13 +22,17 @@ service Status { // NetmapRequest message to request current node netmap message NetmapRequest { + // RequestMetaHeader contains information about request meta headers (should be embedded into message) service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; } // MetricsRequest message to request node metrics message MetricsRequest { + // RequestMetaHeader contains information about request meta headers (should be embedded into message) service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; } @@ -41,7 +45,9 @@ message MetricsResponse { // HealthRequest message to check current state message HealthRequest { + // RequestMetaHeader contains information about request meta headers (should be embedded into message) service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; } From 0aa2d69dbd55afbd3e7e83758c45297958e46a3b Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Thu, 21 Nov 2019 15:28:15 +0300 Subject: [PATCH 0031/1196] docs: regenerate proto documentation --- docs/accounting.md | 15 +++-- docs/bootstrap.md | 3 +- docs/container.md | 12 ++-- docs/object.md | 30 ++++----- docs/service.md | 157 +++++++++++++++++++++++++++++++++++++++++++++ docs/session.md | 2 + docs/state.md | 15 +++++ 7 files changed, 209 insertions(+), 25 deletions(-) create mode 100644 docs/service.md diff --git a/docs/accounting.md b/docs/accounting.md index b4317ae..268a187 100644 --- a/docs/accounting.md +++ b/docs/accounting.md @@ -87,7 +87,8 @@ Balance returns current balance status of the NeoFS user | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | | OwnerID | [bytes](#bytes) | | OwnerID is a wallet address | -| TTL | [uint32](#uint32) | | TTL must be larger than zero, it decreased in every neofs-node Deprecated: will be replaced with RequestMetaHeader (see develop branch) | +| Meta | [service.RequestMetaHeader](#service.RequestMetaHeader) | | RequestMetaHeader contains information about request meta headers (should be embedded into message) | +| Verify | [service.RequestVerificationHeader](#service.RequestVerificationHeader) | | RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) | @@ -362,7 +363,8 @@ Delete allows user to remove unused cheque | OwnerID | [bytes](#bytes) | | OwnerID is a wallet address | | MessageID | [bytes](#bytes) | | MessageID is a nonce for uniq request (UUIDv4) | | Signature | [bytes](#bytes) | | Signature is a signature of the sent request | -| TTL | [uint32](#uint32) | | TTL must be larger than zero, it decreased in every neofs-node Deprecated: will be replaced with RequestMetaHeader (see develop branch) | +| Meta | [service.RequestMetaHeader](#service.RequestMetaHeader) | | RequestMetaHeader contains information about request meta headers (should be embedded into message) | +| Verify | [service.RequestVerificationHeader](#service.RequestVerificationHeader) | | RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) | @@ -382,7 +384,8 @@ DeleteResponse is empty | ----- | ---- | ----- | ----------- | | ID | [bytes](#bytes) | | ID is cheque identifier | | OwnerID | [bytes](#bytes) | | OwnerID is a wallet address | -| TTL | [uint32](#uint32) | | TTL must be larger than zero, it decreased in every neofs-node Deprecated: will be replaced with RequestMetaHeader (see develop branch) | +| Meta | [service.RequestMetaHeader](#service.RequestMetaHeader) | | RequestMetaHeader contains information about request meta headers (should be embedded into message) | +| Verify | [service.RequestVerificationHeader](#service.RequestVerificationHeader) | | RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) | @@ -420,7 +423,8 @@ DeleteResponse is empty | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | | OwnerID | [bytes](#bytes) | | OwnerID is a wallet address | -| TTL | [uint32](#uint32) | | TTL must be larger than zero, it decreased in every neofs-node Deprecated: will be replaced with RequestMetaHeader (see develop branch) | +| Meta | [service.RequestMetaHeader](#service.RequestMetaHeader) | | RequestMetaHeader contains information about request meta headers (should be embedded into message) | +| Verify | [service.RequestVerificationHeader](#service.RequestVerificationHeader) | | RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) | @@ -447,7 +451,8 @@ DeleteResponse is empty | Height | [uint64](#uint64) | | Height is the neo blockchain height until the cheque is valid | | MessageID | [bytes](#bytes) | | MessageID is a nonce for uniq request (UUIDv4) | | Signature | [bytes](#bytes) | | Signature is a signature of the sent request | -| TTL | [uint32](#uint32) | | TTL must be larger than zero, it decreased in every neofs-node Deprecated: will be replaced with RequestMetaHeader (see develop branch) | +| Meta | [service.RequestMetaHeader](#service.RequestMetaHeader) | | RequestMetaHeader contains information about request meta headers (should be embedded into message) | +| Verify | [service.RequestVerificationHeader](#service.RequestVerificationHeader) | | RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) | diff --git a/docs/bootstrap.md b/docs/bootstrap.md index 19967bf..737e085 100644 --- a/docs/bootstrap.md +++ b/docs/bootstrap.md @@ -62,7 +62,8 @@ Process is method that allows to register node in the network and receive actual | ----- | ---- | ----- | ----------- | | type | [int32](#int32) | | Type is NodeType, can be InnerRingNode (type=1) or StorageNode (type=2) | | info | [NodeInfo](#bootstrap.NodeInfo) | | Info contains information about node | -| TTL | [uint32](#uint32) | | TTL must be larger than zero, it decreased in every neofs-node Deprecated: will be replaced with RequestMetaHeader (see develop branch) | +| Meta | [service.RequestMetaHeader](#service.RequestMetaHeader) | | RequestMetaHeader contains information about request meta headers (should be embedded into message) | +| Verify | [service.RequestVerificationHeader](#service.RequestVerificationHeader) | | RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) | diff --git a/docs/container.md b/docs/container.md index 4f98a47..bc559ce 100644 --- a/docs/container.md +++ b/docs/container.md @@ -92,8 +92,9 @@ List returns all user's containers | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | | CID | [bytes](#bytes) | | CID (container id) is a SHA256 hash of the container structure | -| TTL | [uint32](#uint32) | | TTL must be larger than zero, it decreased in every neofs-node Deprecated: will be replaced with RequestMetaHeader (see develop branch) | | Signature | [bytes](#bytes) | | Signature of the container owner | +| Meta | [service.RequestMetaHeader](#service.RequestMetaHeader) | | RequestMetaHeader contains information about request meta headers (should be embedded into message) | +| Verify | [service.RequestVerificationHeader](#service.RequestVerificationHeader) | | RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) | @@ -113,7 +114,8 @@ via consensus in inner ring nodes | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | | CID | [bytes](#bytes) | | CID (container id) is a SHA256 hash of the container structure | -| TTL | [uint32](#uint32) | | TTL must be larger than zero, it decreased in every neofs-node Deprecated: will be replaced with RequestMetaHeader (see develop branch) | +| Meta | [service.RequestMetaHeader](#service.RequestMetaHeader) | | RequestMetaHeader contains information about request meta headers (should be embedded into message) | +| Verify | [service.RequestVerificationHeader](#service.RequestVerificationHeader) | | RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) | @@ -136,7 +138,8 @@ via consensus in inner ring nodes | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | | OwnerID | [bytes](#bytes) | | OwnerID is a wallet address | -| TTL | [uint32](#uint32) | | TTL must be larger than zero, it decreased in every neofs-node Deprecated: will be replaced with RequestMetaHeader (see develop branch) | +| Meta | [service.RequestMetaHeader](#service.RequestMetaHeader) | | RequestMetaHeader contains information about request meta headers (should be embedded into message) | +| Verify | [service.RequestVerificationHeader](#service.RequestVerificationHeader) | | RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) | @@ -163,7 +166,8 @@ via consensus in inner ring nodes | OwnerID | [bytes](#bytes) | | OwnerID is a wallet address | | rules | [netmap.PlacementRule](#netmap.PlacementRule) | | Rules define storage policy for the object inside the container. | | Signature | [bytes](#bytes) | | Signature of the user (owner id) | -| TTL | [uint32](#uint32) | | TTL must be larger than zero, it decreased in every neofs-node Deprecated: will be replaced with RequestMetaHeader (see develop branch) | +| Meta | [service.RequestMetaHeader](#service.RequestMetaHeader) | | RequestMetaHeader contains information about request meta headers (should be embedded into message) | +| Verify | [service.RequestVerificationHeader](#service.RequestVerificationHeader) | | RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) | diff --git a/docs/object.md b/docs/object.md index 03e41c8..8407733 100644 --- a/docs/object.md +++ b/docs/object.md @@ -147,11 +147,11 @@ calculated for XORed data. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| Epoch | [uint64](#uint64) | | Epoch is set by user to 0, node set epoch to the actual value Deprecated: will be replaced with RequestMetaHeader (see develop branch) | | Address | [refs.Address](#refs.Address) | | Address of object (container id + object id) | | OwnerID | [bytes](#bytes) | | OwnerID is a wallet address | -| TTL | [uint32](#uint32) | | TTL must be larger than zero, it decreased in every neofs-node Deprecated: will be replaced with RequestMetaHeader (see develop branch) | | Token | [session.Token](#session.Token) | | Token with session public key and user's signature | +| Meta | [service.RequestMetaHeader](#service.RequestMetaHeader) | | RequestMetaHeader contains information about request meta headers (should be embedded into message) | +| Verify | [service.RequestVerificationHeader](#service.RequestVerificationHeader) | | RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) | @@ -170,11 +170,11 @@ in distributed system. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| Epoch | [uint64](#uint64) | | Epoch is set by user to 0, node set epoch to the actual value Deprecated: will be replaced with RequestMetaHeader (see develop branch) | | Address | [refs.Address](#refs.Address) | | Address of object (container id + object id) | | Ranges | [Range](#object.Range) | repeated | Ranges of object's payload to calculate homomorphic hash | | Salt | [bytes](#bytes) | | Salt is used to XOR object's payload ranges before hashing, it can be nil | -| TTL | [uint32](#uint32) | | TTL must be larger than zero, it decreased in every neofs-node Deprecated: will be replaced with RequestMetaHeader (see develop branch) | +| Meta | [service.RequestMetaHeader](#service.RequestMetaHeader) | | RequestMetaHeader contains information about request meta headers (should be embedded into message) | +| Verify | [service.RequestVerificationHeader](#service.RequestVerificationHeader) | | RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) | @@ -196,10 +196,10 @@ in distributed system. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| Epoch | [uint64](#uint64) | | Epoch is set by user to 0, node set epoch to the actual value Deprecated: will be replaced with RequestMetaHeader (see develop branch) | | Address | [refs.Address](#refs.Address) | | Address of object (container id + object id) | | Ranges | [Range](#object.Range) | repeated | Ranges of object's payload to return | -| TTL | [uint32](#uint32) | | TTL must be larger than zero, it decreased in every neofs-node Deprecated: will be replaced with RequestMetaHeader (see develop branch) | +| Meta | [service.RequestMetaHeader](#service.RequestMetaHeader) | | RequestMetaHeader contains information about request meta headers (should be embedded into message) | +| Verify | [service.RequestVerificationHeader](#service.RequestVerificationHeader) | | RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) | @@ -221,9 +221,9 @@ in distributed system. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| Epoch | [uint64](#uint64) | | Epoch is set by user to 0, node set epoch to the actual value Deprecated: will be replaced with RequestMetaHeader (see develop branch) | | Address | [refs.Address](#refs.Address) | | Address of object (container id + object id) | -| TTL | [uint32](#uint32) | | TTL must be larger than zero, it decreased in every neofs-node Deprecated: will be replaced with RequestMetaHeader (see develop branch) | +| Meta | [service.RequestMetaHeader](#service.RequestMetaHeader) | | RequestMetaHeader contains information about request meta headers (should be embedded into message) | +| Verify | [service.RequestVerificationHeader](#service.RequestVerificationHeader) | | RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) | @@ -246,10 +246,10 @@ in distributed system. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| Epoch | [uint64](#uint64) | | Epoch should be empty on user side, node sets epoch to the actual value Deprecated: will be replaced with RequestMetaHeader (see develop branch) | | Address | [refs.Address](#refs.Address) | | Address of object (container id + object id) | | FullHeaders | [bool](#bool) | | FullHeaders can be set true for extended headers in the object | -| TTL | [uint32](#uint32) | | TTL must be larger than zero, it decreased in every neofs-node Deprecated: will be replaced with RequestMetaHeader (see develop branch) | +| Meta | [service.RequestMetaHeader](#service.RequestMetaHeader) | | RequestMetaHeader contains information about request meta headers (should be embedded into message) | +| Verify | [service.RequestVerificationHeader](#service.RequestVerificationHeader) | | RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) | @@ -273,6 +273,8 @@ in distributed system. | ----- | ---- | ----- | ----------- | | Header | [PutRequest.PutHeader](#object.PutRequest.PutHeader) | | Header should be the first message in the stream | | Chunk | [bytes](#bytes) | | Chunk should be a remaining message in stream should be chunks | +| Meta | [service.RequestMetaHeader](#service.RequestMetaHeader) | | RequestMetaHeader contains information about request meta headers (should be embedded into message) | +| Verify | [service.RequestVerificationHeader](#service.RequestVerificationHeader) | | RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) | @@ -283,9 +285,7 @@ in distributed system. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| Epoch | [uint64](#uint64) | | Epoch is set by user to 0, node set epoch to the actual value Deprecated: will be replaced with RequestMetaHeader (see develop branch) | | Object | [Object](#object.Object) | | Object with at least container id and owner id fields | -| TTL | [uint32](#uint32) | | TTL must be larger than zero, it decreased in every neofs-node Deprecated: will be replaced with RequestMetaHeader (see develop branch) | | Token | [session.Token](#session.Token) | | Token with session public key and user's signature | @@ -308,11 +308,11 @@ in distributed system. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| Epoch | [uint64](#uint64) | | Epoch is set by user to 0, node set epoch to the actual value Deprecated: will be replaced with RequestMetaHeader (see develop branch) | -| Version | [uint32](#uint32) | | Version of search query format | | ContainerID | [bytes](#bytes) | | ContainerID for searching the object | | Query | [bytes](#bytes) | | Query in the binary serialized format | -| TTL | [uint32](#uint32) | | TTL must be larger than zero, it decreased in every neofs-node Deprecated: will be replaced with RequestMetaHeader (see develop branch) | +| QueryVersion | [uint32](#uint32) | | QueryVersion is a version of search query format | +| Meta | [service.RequestMetaHeader](#service.RequestMetaHeader) | | RequestMetaHeader contains information about request meta headers (should be embedded into message) | +| Verify | [service.RequestVerificationHeader](#service.RequestVerificationHeader) | | RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) | diff --git a/docs/service.md b/docs/service.md new file mode 100644 index 0000000..454fab4 --- /dev/null +++ b/docs/service.md @@ -0,0 +1,157 @@ +# Protocol Documentation + + +## Table of Contents + +- [service/meta.proto](#service/meta.proto) + + - Messages + - [RequestMetaHeader](#service.RequestMetaHeader) + + +- [service/verify.proto](#service/verify.proto) + + - Messages + - [RequestVerificationHeader](#service.RequestVerificationHeader) + - [RequestVerificationHeader.Sign](#service.RequestVerificationHeader.Sign) + - [RequestVerificationHeader.Signature](#service.RequestVerificationHeader.Signature) + + +- [service/verify_test.proto](#service/verify_test.proto) + + - Messages + - [TestRequest](#service.TestRequest) + + +- [Scalar Value Types](#scalar-value-types) + + + + +

Top

+ +## service/meta.proto + + + + + + + +### Message RequestMetaHeader +RequestMetaHeader contains information about request meta headers +(should be embedded into message) + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| TTL | [uint32](#uint32) | | TTL must be larger than zero, it decreased in every NeoFS Node | +| Epoch | [uint64](#uint64) | | Epoch for user can be empty, because node sets epoch to the actual value | +| Version | [uint32](#uint32) | | Version defines protocol version TODO: not used for now, should be implemented in future | + + + + + + + + +

Top

+ +## service/verify.proto + + + + + + + +### Message RequestVerificationHeader +RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request +(should be embedded into message). + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| Signatures | [RequestVerificationHeader.Signature](#service.RequestVerificationHeader.Signature) | repeated | Signatures is a set of signatures of every passed NeoFS Node | + + + + +### Message RequestVerificationHeader.Sign + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| Sign | [bytes](#bytes) | | Sign is signature of the request or session key. | +| Peer | [bytes](#bytes) | | Peer is compressed public key used for signature. | + + + + +### Message RequestVerificationHeader.Signature + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| Sign | [RequestVerificationHeader.Sign](#service.RequestVerificationHeader.Sign) | | Sign is a signature and public key of the request. | +| Origin | [RequestVerificationHeader.Sign](#service.RequestVerificationHeader.Sign) | | Origin used for requests, when trusted node changes it and re-sign with session key. If session key used for signature request, then Origin should contain public key of user and signed session key. | + + + + + + + + +

Top

+ +## service/verify_test.proto + + + + + + + +### Message TestRequest + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| IntField | [int32](#int32) | | | +| StringField | [string](#string) | | | +| BytesField | [bytes](#bytes) | | | +| CustomField | [bytes](#bytes) | | | +| Meta | [RequestMetaHeader](#service.RequestMetaHeader) | | | +| Header | [RequestVerificationHeader](#service.RequestVerificationHeader) | | | + + + + + + + +## Scalar Value Types + +| .proto Type | Notes | C++ Type | Java Type | Python Type | +| ----------- | ----- | -------- | --------- | ----------- | +| double | | double | double | float | +| float | | float | float | float | +| int32 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint32 instead. | int32 | int | int | +| int64 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint64 instead. | int64 | long | int/long | +| uint32 | Uses variable-length encoding. | uint32 | int | int/long | +| uint64 | Uses variable-length encoding. | uint64 | long | int/long | +| sint32 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s. | int32 | int | int | +| sint64 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s. | int64 | long | int/long | +| fixed32 | Always four bytes. More efficient than uint32 if values are often greater than 2^28. | uint32 | int | int | +| fixed64 | Always eight bytes. More efficient than uint64 if values are often greater than 2^56. | uint64 | long | int/long | +| sfixed32 | Always four bytes. | int32 | int | int | +| sfixed64 | Always eight bytes. | int64 | long | int/long | +| bool | | bool | boolean | boolean | +| string | A string must always contain UTF-8 encoded or 7-bit ASCII text. | string | String | str/unicode | +| bytes | May contain any arbitrary sequence of bytes. | string | ByteString | str | + diff --git a/docs/session.md b/docs/session.md index cf4a1fd..e8633d3 100644 --- a/docs/session.md +++ b/docs/session.md @@ -70,6 +70,8 @@ session key. Session is established during 4-step handshake in one gRPC stream | ----- | ---- | ----- | ----------- | | Init | [Token](#session.Token) | | Init is a message to initialize session opening. Carry: owner of manipulation object; ID of manipulation object; token lifetime bounds. | | Signed | [Token](#session.Token) | | Signed Init message response (Unsigned) from server with user private key | +| Meta | [service.RequestMetaHeader](#service.RequestMetaHeader) | | RequestMetaHeader contains information about request meta headers (should be embedded into message) | +| Verify | [service.RequestVerificationHeader](#service.RequestVerificationHeader) | | RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) | diff --git a/docs/state.md b/docs/state.md index 6d240c1..e678be3 100644 --- a/docs/state.md +++ b/docs/state.md @@ -70,6 +70,11 @@ If node unhealthy field Status would contains detailed info. HealthRequest message to check current state +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| Meta | [service.RequestMetaHeader](#service.RequestMetaHeader) | | RequestMetaHeader contains information about request meta headers (should be embedded into message) | +| Verify | [service.RequestVerificationHeader](#service.RequestVerificationHeader) | | RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) | + @@ -89,6 +94,11 @@ HealthResponse message with current state MetricsRequest message to request node metrics +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| Meta | [service.RequestMetaHeader](#service.RequestMetaHeader) | | RequestMetaHeader contains information about request meta headers (should be embedded into message) | +| Verify | [service.RequestVerificationHeader](#service.RequestVerificationHeader) | | RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) | + @@ -109,6 +119,11 @@ from github.com/prometheus/client_model/metrics.proto NetmapRequest message to request current node netmap +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| Meta | [service.RequestMetaHeader](#service.RequestMetaHeader) | | RequestMetaHeader contains information about request meta headers (should be embedded into message) | +| Verify | [service.RequestVerificationHeader](#service.RequestVerificationHeader) | | RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) | + From 1a9a840d1789ab58e8453f9e3590c7fa05888a70 Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Thu, 21 Nov 2019 15:21:37 +0300 Subject: [PATCH 0032/1196] proto: regenerate proto files --- object/service.pb.go | 188 +++++++++++++++++++++--------------------- service/meta.pb.go | 60 ++++++++++++-- service/verify.pb.go | 19 +++-- session/service.pb.go | 6 +- state/service.pb.go | 12 ++- 5 files changed, 172 insertions(+), 113 deletions(-) diff --git a/object/service.pb.go b/object/service.pb.go index d58d391..4cad2f7 100644 --- a/object/service.pb.go +++ b/object/service.pb.go @@ -538,12 +538,12 @@ func (m *HeadResponse) GetObject() *Object { } type SearchRequest struct { - // Version of search query format - Version uint32 `protobuf:"varint,1,opt,name=Version,proto3" json:"Version,omitempty"` // ContainerID for searching the object - ContainerID CID `protobuf:"bytes,2,opt,name=ContainerID,proto3,customtype=CID" json:"ContainerID"` + ContainerID CID `protobuf:"bytes,1,opt,name=ContainerID,proto3,customtype=CID" json:"ContainerID"` // Query in the binary serialized format - Query []byte `protobuf:"bytes,3,opt,name=Query,proto3" json:"Query,omitempty"` + Query []byte `protobuf:"bytes,2,opt,name=Query,proto3" json:"Query,omitempty"` + // QueryVersion is a version of search query format + QueryVersion uint32 `protobuf:"varint,3,opt,name=QueryVersion,proto3" json:"QueryVersion,omitempty"` // RequestMetaHeader contains information about request meta headers (should be embedded into message) service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) @@ -582,13 +582,6 @@ func (m *SearchRequest) XXX_DiscardUnknown() { var xxx_messageInfo_SearchRequest proto.InternalMessageInfo -func (m *SearchRequest) GetVersion() uint32 { - if m != nil { - return m.Version - } - return 0 -} - func (m *SearchRequest) GetQuery() []byte { if m != nil { return m.Query @@ -596,6 +589,13 @@ func (m *SearchRequest) GetQuery() []byte { return nil } +func (m *SearchRequest) GetQueryVersion() uint32 { + if m != nil { + return m.QueryVersion + } + return 0 +} + type SearchResponse struct { // Addresses of found objects Addresses []refs.Address `protobuf:"bytes,1,rep,name=Addresses,proto3" json:"Addresses"` @@ -865,59 +865,59 @@ func init() { func init() { proto.RegisterFile("object/service.proto", fileDescriptor_dfcdf610ade6a9ce) } var fileDescriptor_dfcdf610ade6a9ce = []byte{ - // 827 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x56, 0xcd, 0x4e, 0x1b, 0x49, - 0x10, 0xf6, 0xd8, 0x66, 0x0c, 0x65, 0x1b, 0x50, 0xe3, 0x65, 0xad, 0x59, 0x64, 0xd0, 0x08, 0xed, - 0x7a, 0xb5, 0xf2, 0x98, 0x25, 0x12, 0x70, 0x80, 0x43, 0x6c, 0x0b, 0xcc, 0x21, 0x82, 0x0c, 0x08, - 0x29, 0xb9, 0x8d, 0xc7, 0xed, 0x9f, 0x60, 0x66, 0x9c, 0xf9, 0x21, 0xe2, 0x01, 0x72, 0xce, 0x35, - 0x87, 0xbc, 0x49, 0xf2, 0x00, 0x1c, 0x39, 0x46, 0x39, 0xa0, 0xc8, 0x39, 0xe5, 0x90, 0x3c, 0x43, - 0x34, 0xdd, 0xd5, 0x9e, 0xb1, 0x09, 0x24, 0xe1, 0x10, 0x9f, 0xdc, 0xf5, 0xd5, 0x57, 0x55, 0x5d, - 0x5f, 0x57, 0xb7, 0x07, 0x72, 0x76, 0xe3, 0x19, 0x35, 0xbd, 0xb2, 0x4b, 0x9d, 0xf3, 0xae, 0x49, - 0xb5, 0xbe, 0x63, 0x7b, 0x36, 0x91, 0x39, 0xaa, 0xcc, 0x3b, 0xb4, 0xe5, 0x96, 0xbd, 0x8b, 0x3e, - 0x75, 0xb9, 0x47, 0x21, 0xc8, 0x8f, 0x62, 0x0b, 0x2e, 0x75, 0xdd, 0xae, 0x6d, 0x8d, 0x12, 0x31, - 0x63, 0xf9, 0x8c, 0x7a, 0x06, 0x62, 0x39, 0x81, 0x9d, 0x53, 0xa7, 0xdb, 0xba, 0x40, 0xb4, 0xd4, - 0xee, 0x7a, 0x1d, 0xbf, 0xa1, 0x99, 0xf6, 0x59, 0xb9, 0x6d, 0xb7, 0xed, 0x32, 0x83, 0x1b, 0x7e, - 0x8b, 0x59, 0xcc, 0x60, 0x2b, 0x4e, 0x57, 0xdf, 0x4a, 0x00, 0x7b, 0xd4, 0xd3, 0xe9, 0x73, 0x9f, - 0xba, 0x1e, 0x29, 0x41, 0xea, 0x61, 0xb3, 0xe9, 0x50, 0xd7, 0xcd, 0x4b, 0x2b, 0x52, 0x31, 0xbd, - 0x9e, 0xd5, 0x82, 0x4d, 0x6b, 0x08, 0x56, 0x92, 0x97, 0xd7, 0xcb, 0x31, 0x5d, 0x70, 0xc8, 0x16, - 0x24, 0x1f, 0x51, 0xcf, 0xc8, 0x37, 0x18, 0x57, 0xd1, 0x44, 0xdf, 0x98, 0x2e, 0xf0, 0xd5, 0xa9, - 0xd1, 0xa4, 0x4e, 0x65, 0x3a, 0x08, 0xbc, 0xba, 0x5e, 0x96, 0x74, 0x16, 0x41, 0x6a, 0x20, 0x9f, - 0xb0, 0x6d, 0xe7, 0x4d, 0x16, 0xab, 0x8e, 0xc7, 0x32, 0x6f, 0xd7, 0x34, 0xbc, 0xae, 0x6d, 0xdd, - 0xc8, 0x81, 0xb1, 0xea, 0x31, 0xa4, 0xd9, 0xe6, 0xdd, 0xbe, 0x6d, 0xb9, 0x94, 0x14, 0x01, 0xa5, - 0xc6, 0xcd, 0xcf, 0x6a, 0xdc, 0xd4, 0x0e, 0xd8, 0x4f, 0x3d, 0xa6, 0xa3, 0x9f, 0x2c, 0xc2, 0x54, - 0xb5, 0xe3, 0x5b, 0xa7, 0xf9, 0xf8, 0x8a, 0x54, 0xcc, 0xd4, 0x63, 0x3a, 0x37, 0x2b, 0x09, 0x90, - 0x74, 0xf5, 0x5d, 0x1c, 0xe0, 0xd0, 0x1f, 0x6a, 0xb2, 0x01, 0x32, 0xdf, 0x00, 0x66, 0x5d, 0x12, - 0x59, 0x43, 0x4e, 0xb0, 0xe4, 0x9c, 0xa0, 0x06, 0x5f, 0xdd, 0x56, 0x63, 0xd2, 0xa2, 0x29, 0x4f, - 0x60, 0x66, 0xb8, 0x5d, 0xf2, 0x37, 0xc8, 0x07, 0x77, 0x48, 0xa6, 0xa3, 0x97, 0xac, 0xc2, 0xd4, - 0xb1, 0x7d, 0x4a, 0x2d, 0xd6, 0x4c, 0x40, 0xc3, 0x29, 0xd5, 0x18, 0xaa, 0x73, 0x27, 0x97, 0x6f, - 0x1b, 0xd2, 0x4c, 0x19, 0x3c, 0x94, 0x5f, 0x1b, 0x29, 0xf5, 0x55, 0x1c, 0xb2, 0x35, 0xda, 0xa3, - 0x1e, 0xbd, 0xe7, 0x4c, 0xfe, 0x0b, 0xa9, 0x83, 0x17, 0x16, 0x75, 0xf6, 0x6b, 0x5c, 0xf8, 0xca, - 0x5c, 0xe0, 0xff, 0x70, 0xbd, 0x2c, 0x60, 0x5d, 0x2c, 0xc2, 0xa6, 0x12, 0x77, 0x34, 0x35, 0xf1, - 0x21, 0x9f, 0x87, 0x59, 0x21, 0x08, 0x97, 0x54, 0xfd, 0x2c, 0x41, 0x3a, 0xa0, 0x0b, 0x85, 0xb6, - 0x7e, 0xa0, 0xd0, 0x50, 0x01, 0x04, 0x42, 0xb1, 0x56, 0x20, 0xbd, 0xeb, 0xf7, 0x7a, 0xbc, 0xb6, - 0xcb, 0x04, 0x9b, 0xd6, 0xa3, 0xd0, 0xc4, 0xbb, 0xdf, 0x80, 0x0c, 0x6f, 0x15, 0xc7, 0xe9, 0x27, - 0x07, 0x56, 0xfd, 0x2a, 0x41, 0xf6, 0x88, 0x1a, 0x8e, 0xd9, 0x11, 0x2a, 0xe5, 0x21, 0x75, 0x42, - 0x9d, 0xe0, 0x7c, 0x59, 0x68, 0x56, 0x17, 0x26, 0x29, 0x41, 0xba, 0x6a, 0x5b, 0x9e, 0xd1, 0x8d, - 0x8e, 0x4d, 0x1a, 0x45, 0x4b, 0x54, 0xf7, 0x6b, 0x7a, 0xd4, 0x4f, 0x72, 0x30, 0xf5, 0xd8, 0xa7, - 0xce, 0x05, 0x1b, 0x9b, 0x8c, 0xce, 0x8d, 0x89, 0x0b, 0x55, 0x85, 0x59, 0xd1, 0x2f, 0x4a, 0xf5, - 0x3f, 0xcc, 0xe0, 0x39, 0xd3, 0x60, 0x30, 0x12, 0xb7, 0x5d, 0x9d, 0x90, 0xa5, 0x7e, 0x91, 0x60, - 0x2e, 0x78, 0x51, 0x0d, 0xab, 0x7d, 0xdf, 0xfb, 0xf7, 0x1f, 0xc8, 0x2c, 0x3c, 0x98, 0x26, 0x5e, - 0x12, 0x0f, 0x88, 0xa1, 0xc8, 0x46, 0xca, 0xc4, 0x45, 0x5b, 0x83, 0xf9, 0xb0, 0x5d, 0x94, 0x6d, - 0x09, 0x66, 0x76, 0x1d, 0xa3, 0x7d, 0x46, 0x2d, 0x8f, 0xcb, 0x96, 0xd1, 0x43, 0x40, 0x7d, 0x19, - 0x87, 0x05, 0x11, 0x52, 0x37, 0xdc, 0xce, 0xef, 0x50, 0x89, 0x40, 0xf2, 0xc8, 0xe8, 0x79, 0x38, - 0x6f, 0x6c, 0x3d, 0x71, 0xe5, 0xb6, 0x21, 0x37, 0x2a, 0x03, 0xaa, 0xb7, 0x0a, 0x72, 0x60, 0xe3, - 0xc4, 0x65, 0x2a, 0x19, 0xbc, 0x46, 0x49, 0xc6, 0x42, 0xdf, 0xfa, 0x9b, 0x04, 0xa4, 0x8e, 0x78, - 0x55, 0xb2, 0x06, 0x89, 0x3d, 0xea, 0x11, 0x22, 0x14, 0x08, 0x3f, 0x47, 0x94, 0x85, 0x11, 0x8c, - 0x57, 0x58, 0x93, 0x82, 0x88, 0x43, 0x3f, 0x12, 0x11, 0xfe, 0x11, 0x87, 0x11, 0x91, 0xbf, 0xa0, - 0xa2, 0x44, 0x36, 0x41, 0xe6, 0x6f, 0x28, 0xf9, 0x43, 0x10, 0x46, 0xfe, 0x64, 0x94, 0xc5, 0x71, - 0x78, 0x78, 0x87, 0x92, 0x81, 0x04, 0x64, 0x98, 0x37, 0xf2, 0xee, 0x2a, 0xb9, 0x51, 0x10, 0x43, - 0x36, 0x41, 0xe6, 0x17, 0x31, 0xac, 0x35, 0xf2, 0x10, 0x85, 0xb5, 0xc6, 0xee, 0xeb, 0x0e, 0x4c, - 0x0b, 0x49, 0xc9, 0x9f, 0xd1, 0xce, 0x23, 0xb7, 0x51, 0xc9, 0xdf, 0x74, 0x60, 0xf8, 0x3e, 0x64, - 0xa2, 0x27, 0x42, 0xfe, 0x1a, 0x67, 0x46, 0xc6, 0x55, 0x59, 0xfa, 0xbe, 0x93, 0xa7, 0xaa, 0xec, - 0x5c, 0x0e, 0x0a, 0xd2, 0xd5, 0xa0, 0x20, 0xbd, 0x1f, 0x14, 0xa4, 0x8f, 0x83, 0x82, 0xf4, 0xfa, - 0x53, 0x21, 0xf6, 0xf4, 0x9f, 0xc8, 0xa7, 0xa5, 0xe5, 0xf6, 0x4d, 0xb3, 0xd4, 0xa4, 0xe7, 0x65, - 0x8b, 0xda, 0x2d, 0xb7, 0xc4, 0x3f, 0x2c, 0x79, 0xce, 0x86, 0xcc, 0xac, 0x07, 0xdf, 0x02, 0x00, - 0x00, 0xff, 0xff, 0x96, 0xdf, 0x01, 0x74, 0x0f, 0x0b, 0x00, 0x00, + // 831 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x56, 0xcf, 0x4f, 0xdb, 0x48, + 0x14, 0xce, 0x24, 0xc1, 0xc0, 0x8b, 0x03, 0x68, 0xc8, 0xb2, 0x91, 0x17, 0x05, 0x64, 0xa1, 0xdd, + 0xac, 0x56, 0x71, 0x58, 0x56, 0x02, 0x0e, 0x70, 0xd8, 0x24, 0x82, 0x70, 0x58, 0xc1, 0x1a, 0x84, + 0xd4, 0xde, 0x1c, 0x67, 0xf2, 0xa3, 0x04, 0x3b, 0xf5, 0xd8, 0x54, 0xfc, 0x01, 0x3d, 0xf7, 0xda, + 0x43, 0xff, 0x93, 0xf6, 0x0f, 0xe0, 0xc8, 0xb1, 0xea, 0x01, 0x55, 0xe9, 0xa9, 0x87, 0xde, 0x7b, + 0xac, 0xe6, 0x87, 0x63, 0x27, 0x14, 0xda, 0x72, 0x68, 0x4e, 0x99, 0xf9, 0xde, 0xf7, 0xde, 0x9b, + 0xf7, 0xf9, 0x1b, 0xc7, 0x90, 0x73, 0x1b, 0x4f, 0x88, 0xed, 0x97, 0x29, 0xf1, 0x2e, 0xba, 0x36, + 0x31, 0xfa, 0x9e, 0xeb, 0xbb, 0x58, 0x11, 0xa8, 0xb6, 0xe0, 0x91, 0x16, 0x2d, 0xfb, 0x97, 0x7d, + 0x42, 0x45, 0x44, 0xc3, 0x92, 0x1f, 0xc7, 0x16, 0x29, 0xa1, 0xb4, 0xeb, 0x3a, 0xa3, 0x44, 0x59, + 0xb1, 0x7c, 0x4e, 0x7c, 0x4b, 0x62, 0xb9, 0x10, 0xbb, 0x20, 0x5e, 0xb7, 0x75, 0x29, 0xd1, 0x52, + 0xbb, 0xeb, 0x77, 0x82, 0x86, 0x61, 0xbb, 0xe7, 0xe5, 0xb6, 0xdb, 0x76, 0xcb, 0x1c, 0x6e, 0x04, + 0x2d, 0xbe, 0xe3, 0x1b, 0xbe, 0x12, 0x74, 0xfd, 0x35, 0x02, 0xd8, 0x27, 0xbe, 0x49, 0x9e, 0x06, + 0x84, 0xfa, 0xb8, 0x04, 0xd3, 0xff, 0x36, 0x9b, 0x1e, 0xa1, 0x34, 0x8f, 0x56, 0x51, 0x31, 0xb3, + 0x91, 0x35, 0xd8, 0xa1, 0x0d, 0x09, 0x56, 0xd2, 0x57, 0x37, 0x2b, 0x09, 0x33, 0xe4, 0xe0, 0x6d, + 0x48, 0xff, 0x47, 0x7c, 0x2b, 0xdf, 0xe0, 0x5c, 0xcd, 0x08, 0xe7, 0x96, 0xe5, 0x58, 0xac, 0x4e, + 0xac, 0x26, 0xf1, 0x2a, 0x33, 0x2c, 0xf1, 0xfa, 0x66, 0x05, 0x99, 0x3c, 0x03, 0xd7, 0x40, 0x39, + 0xe5, 0xc7, 0xce, 0xdb, 0x3c, 0x57, 0x1f, 0xcf, 0xe5, 0xd1, 0xae, 0x6d, 0xf9, 0x5d, 0xd7, 0xb9, + 0x55, 0x43, 0xe6, 0xea, 0x27, 0x90, 0xe1, 0x87, 0xa7, 0x7d, 0xd7, 0xa1, 0x04, 0x17, 0x41, 0x4a, + 0x2d, 0x0f, 0x3f, 0x67, 0x88, 0xad, 0x71, 0xc8, 0x7f, 0xea, 0x09, 0x53, 0xc6, 0xf1, 0x12, 0x4c, + 0x55, 0x3b, 0x81, 0x73, 0x96, 0x4f, 0xae, 0xa2, 0xa2, 0x5a, 0x4f, 0x98, 0x62, 0x5b, 0x49, 0x01, + 0x32, 0xf5, 0x37, 0x49, 0x80, 0xa3, 0x60, 0xa8, 0xc9, 0x26, 0x28, 0xe2, 0x00, 0xb2, 0xea, 0x72, + 0x58, 0x35, 0xe2, 0xb0, 0xa5, 0xe0, 0xb0, 0x1e, 0x62, 0x75, 0x57, 0x8f, 0x49, 0x8b, 0xa6, 0x3d, + 0x82, 0xd9, 0xe1, 0x71, 0xf1, 0xef, 0xa0, 0x1c, 0xde, 0x23, 0x99, 0x29, 0xa3, 0x78, 0x0d, 0xa6, + 0x4e, 0xdc, 0x33, 0xe2, 0xf0, 0x61, 0x18, 0x4d, 0xba, 0xd4, 0xe0, 0xa8, 0x29, 0x82, 0x42, 0xbe, + 0x1d, 0xc8, 0x70, 0x65, 0xe4, 0x43, 0xf9, 0x31, 0x4b, 0xe9, 0x2f, 0x92, 0x90, 0xad, 0x91, 0x1e, + 0xf1, 0xc9, 0x03, 0x3d, 0xf9, 0x27, 0x4c, 0x1f, 0x3e, 0x73, 0x88, 0x77, 0x50, 0x13, 0xc2, 0x57, + 0xe6, 0x59, 0xfc, 0xdd, 0xcd, 0x4a, 0x08, 0x9b, 0xe1, 0x22, 0x1a, 0x2a, 0x75, 0xcf, 0x50, 0x13, + 0x37, 0xf9, 0x02, 0xcc, 0x85, 0x82, 0x08, 0x49, 0xf5, 0x8f, 0x08, 0x32, 0x8c, 0x1e, 0x2a, 0xb4, + 0xfd, 0x0d, 0x85, 0x86, 0x0a, 0x48, 0x20, 0x12, 0x6b, 0x15, 0x32, 0x7b, 0x41, 0xaf, 0x27, 0x7a, + 0x53, 0x2e, 0xd8, 0x8c, 0x19, 0x87, 0x26, 0x3e, 0xfd, 0x26, 0xa8, 0x62, 0x54, 0x69, 0xa7, 0xef, + 0x34, 0xac, 0xfe, 0x19, 0x41, 0xf6, 0x98, 0x58, 0x9e, 0xdd, 0x89, 0x7c, 0x94, 0xa9, 0xba, 0x8e, + 0x6f, 0x75, 0x85, 0x39, 0x10, 0x37, 0x47, 0x46, 0x4a, 0x93, 0xaa, 0x1e, 0xd4, 0xcc, 0x78, 0x1c, + 0xe7, 0x60, 0xea, 0xff, 0x80, 0x78, 0x97, 0xc2, 0x45, 0xa6, 0xd8, 0x60, 0x1d, 0x54, 0xbe, 0x38, + 0x25, 0x1e, 0x73, 0x0a, 0x77, 0x4e, 0xd6, 0x1c, 0xc1, 0x26, 0x2e, 0x59, 0x15, 0xe6, 0xc2, 0xc9, + 0xa5, 0x68, 0x7f, 0xc3, 0xac, 0x7c, 0xe2, 0x84, 0x59, 0x24, 0x75, 0xd7, 0x25, 0x8a, 0x58, 0xfa, + 0x27, 0x04, 0xf3, 0xec, 0xdd, 0x6a, 0x39, 0xed, 0x87, 0xde, 0xc4, 0xbf, 0x40, 0xe1, 0xe9, 0xcc, + 0x57, 0xa2, 0xa5, 0x7c, 0x54, 0x1c, 0x95, 0x6c, 0x49, 0x99, 0xb8, 0x68, 0xeb, 0xb0, 0x10, 0x8d, + 0x2b, 0x65, 0x5b, 0x86, 0xd9, 0x3d, 0xcf, 0x6a, 0x9f, 0x13, 0xc7, 0x17, 0xb2, 0xa9, 0x66, 0x04, + 0xe8, 0xcf, 0x93, 0xb0, 0x18, 0xa6, 0xd4, 0x2d, 0xda, 0xf9, 0x19, 0x2a, 0x61, 0x48, 0x1f, 0x5b, + 0x3d, 0x9f, 0xdb, 0x4e, 0x35, 0xf9, 0x7a, 0xe2, 0xca, 0xed, 0x40, 0x6e, 0x54, 0x06, 0xa9, 0xde, + 0x1a, 0x28, 0x6c, 0x2f, 0x1d, 0xa7, 0x56, 0x54, 0x79, 0xd5, 0xd2, 0x9c, 0x25, 0x63, 0x1b, 0xaf, + 0x52, 0x30, 0x7d, 0x2c, 0xba, 0xe2, 0x75, 0x48, 0xed, 0x13, 0x1f, 0xe3, 0x50, 0x81, 0xe8, 0xc3, + 0x44, 0x5b, 0x1c, 0xc1, 0x44, 0x87, 0x75, 0xc4, 0x32, 0x8e, 0x82, 0x58, 0x46, 0xf4, 0x97, 0x1c, + 0x65, 0xc4, 0xfe, 0x8c, 0x8a, 0x08, 0x6f, 0x81, 0x22, 0xde, 0xa6, 0xf8, 0x97, 0x90, 0x30, 0xf2, + 0x77, 0xa3, 0x2d, 0x8d, 0xc3, 0xc3, 0x3b, 0x94, 0x66, 0x12, 0xe0, 0x61, 0xdd, 0xd8, 0x1b, 0x58, + 0xcb, 0x8d, 0x82, 0x32, 0x65, 0x0b, 0x14, 0x71, 0x11, 0xa3, 0x5e, 0x23, 0xaf, 0xa4, 0xa8, 0xd7, + 0xd8, 0x7d, 0xdd, 0x85, 0x99, 0x50, 0x52, 0xfc, 0x6b, 0x7c, 0xf2, 0xd8, 0x6d, 0xd4, 0xf2, 0xb7, + 0x03, 0x32, 0xfd, 0x00, 0xd4, 0xf8, 0x13, 0xc1, 0xbf, 0x8d, 0x33, 0x63, 0x76, 0xd5, 0x96, 0xbf, + 0x1e, 0x14, 0xa5, 0x2a, 0xbb, 0x57, 0x83, 0x02, 0xba, 0x1e, 0x14, 0xd0, 0xdb, 0x41, 0x01, 0xbd, + 0x1f, 0x14, 0xd0, 0xcb, 0x0f, 0x85, 0xc4, 0xe3, 0x3f, 0x62, 0x1f, 0x99, 0x0e, 0xed, 0xdb, 0x76, + 0xa9, 0x49, 0x2e, 0xca, 0x0e, 0x71, 0x5b, 0xb4, 0x24, 0x3e, 0x31, 0x45, 0xcd, 0x86, 0xc2, 0x77, + 0xff, 0x7c, 0x09, 0x00, 0x00, 0xff, 0xff, 0x56, 0x6d, 0x00, 0xd5, 0x19, 0x0b, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1913,12 +1913,17 @@ func (m *SearchRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x6 i-- dAtA[i] = 0x92 + if m.QueryVersion != 0 { + i = encodeVarintService(dAtA, i, uint64(m.QueryVersion)) + i-- + dAtA[i] = 0x18 + } if len(m.Query) > 0 { i -= len(m.Query) copy(dAtA[i:], m.Query) i = encodeVarintService(dAtA, i, uint64(len(m.Query))) i-- - dAtA[i] = 0x1a + dAtA[i] = 0x12 } { size := m.ContainerID.Size() @@ -1929,12 +1934,7 @@ func (m *SearchRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintService(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x12 - if m.Version != 0 { - i = encodeVarintService(dAtA, i, uint64(m.Version)) - i-- - dAtA[i] = 0x8 - } + dAtA[i] = 0xa return len(dAtA) - i, nil } @@ -2437,15 +2437,15 @@ func (m *SearchRequest) Size() (n int) { } var l int _ = l - if m.Version != 0 { - n += 1 + sovService(uint64(m.Version)) - } l = m.ContainerID.Size() n += 1 + l + sovService(uint64(l)) l = len(m.Query) if l > 0 { n += 1 + l + sovService(uint64(l)) } + if m.QueryVersion != 0 { + n += 1 + sovService(uint64(m.QueryVersion)) + } l = m.RequestMetaHeader.Size() n += 2 + l + sovService(uint64(l)) l = m.RequestVerificationHeader.Size() @@ -3813,25 +3813,6 @@ func (m *SearchRequest) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) - } - m.Version = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Version |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ContainerID", wireType) } @@ -3864,7 +3845,7 @@ func (m *SearchRequest) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 3: + case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Query", wireType) } @@ -3898,6 +3879,25 @@ func (m *SearchRequest) Unmarshal(dAtA []byte) error { m.Query = []byte{} } iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field QueryVersion", wireType) + } + m.QueryVersion = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.QueryVersion |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } case 98: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType) diff --git a/service/meta.pb.go b/service/meta.pb.go index 9fbd283..d5f58fd 100644 --- a/service/meta.pb.go +++ b/service/meta.pb.go @@ -23,9 +23,16 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +// RequestMetaHeader contains information about request meta headers +// (should be embedded into message) type RequestMetaHeader struct { - TTL uint32 `protobuf:"varint,1,opt,name=TTL,proto3" json:"TTL,omitempty"` - Epoch uint64 `protobuf:"varint,2,opt,name=Epoch,proto3" json:"Epoch,omitempty"` + // TTL must be larger than zero, it decreased in every NeoFS Node + TTL uint32 `protobuf:"varint,1,opt,name=TTL,proto3" json:"TTL,omitempty"` + // Epoch for user can be empty, because node sets epoch to the actual value + Epoch uint64 `protobuf:"varint,2,opt,name=Epoch,proto3" json:"Epoch,omitempty"` + // Version defines protocol version + // TODO: not used for now, should be implemented in future + Version uint32 `protobuf:"varint,3,opt,name=Version,proto3" json:"Version,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -74,6 +81,13 @@ func (m *RequestMetaHeader) GetEpoch() uint64 { return 0 } +func (m *RequestMetaHeader) GetVersion() uint32 { + if m != nil { + return m.Version + } + return 0 +} + func init() { proto.RegisterType((*RequestMetaHeader)(nil), "service.RequestMetaHeader") } @@ -81,19 +95,20 @@ func init() { func init() { proto.RegisterFile("service/meta.proto", fileDescriptor_a638867e7b43457c) } var fileDescriptor_a638867e7b43457c = []byte{ - // 185 bytes of a gzipped FileDescriptorProto + // 202 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x2a, 0x4e, 0x2d, 0x2a, 0xcb, 0x4c, 0x4e, 0xd5, 0xcf, 0x4d, 0x2d, 0x49, 0xd4, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x87, 0x8a, 0x49, 0xe9, 0xa6, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0xa7, 0xe7, 0xa7, 0xe7, 0xeb, 0x83, 0xe5, 0x93, 0x4a, 0xd3, 0xc0, 0x3c, 0x30, 0x07, 0xcc, 0x82, 0xe8, - 0x53, 0xb2, 0xe6, 0x12, 0x0c, 0x4a, 0x2d, 0x2c, 0x4d, 0x2d, 0x2e, 0xf1, 0x4d, 0x2d, 0x49, 0xf4, + 0x53, 0x0a, 0xe5, 0x12, 0x0c, 0x4a, 0x2d, 0x2c, 0x4d, 0x2d, 0x2e, 0xf1, 0x4d, 0x2d, 0x49, 0xf4, 0x48, 0x4d, 0x4c, 0x49, 0x2d, 0x12, 0x12, 0xe0, 0x62, 0x0e, 0x09, 0xf1, 0x91, 0x60, 0x54, 0x60, 0xd4, 0xe0, 0x0d, 0x02, 0x31, 0x85, 0x44, 0xb8, 0x58, 0x5d, 0x0b, 0xf2, 0x93, 0x33, 0x24, 0x98, - 0x14, 0x18, 0x35, 0x58, 0x82, 0x20, 0x1c, 0x27, 0xbb, 0x13, 0x8f, 0xe4, 0x18, 0x2f, 0x3c, 0x92, - 0x63, 0xbc, 0xf1, 0x48, 0x8e, 0xf1, 0xc1, 0x23, 0x39, 0xc6, 0x19, 0x8f, 0xe5, 0x18, 0xa2, 0x34, - 0x90, 0x5c, 0x90, 0x57, 0x5c, 0x90, 0x9c, 0xac, 0x9b, 0x92, 0x5a, 0xa6, 0x9f, 0x97, 0x9a, 0x9f, - 0x56, 0xac, 0x0b, 0xb1, 0x1f, 0xea, 0xd6, 0x24, 0x36, 0x30, 0xd7, 0x18, 0x10, 0x00, 0x00, 0xff, - 0xff, 0x73, 0x6f, 0x01, 0x49, 0xd1, 0x00, 0x00, 0x00, + 0x14, 0x18, 0x35, 0x58, 0x82, 0x20, 0x1c, 0x21, 0x09, 0x2e, 0xf6, 0xb0, 0xd4, 0xa2, 0xe2, 0xcc, + 0xfc, 0x3c, 0x09, 0x66, 0xb0, 0x5a, 0x18, 0xd7, 0xc9, 0xee, 0xc4, 0x23, 0x39, 0xc6, 0x0b, 0x8f, + 0xe4, 0x18, 0x6f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e, 0x71, 0xc6, 0x63, 0x39, 0x86, 0x28, + 0x0d, 0x24, 0xb7, 0xe5, 0x15, 0x17, 0x24, 0x27, 0xeb, 0xa6, 0xa4, 0x96, 0xe9, 0xe7, 0xa5, 0xe6, + 0xa7, 0x15, 0xeb, 0x42, 0x5c, 0x06, 0xf5, 0x45, 0x12, 0x1b, 0x98, 0x6b, 0x0c, 0x08, 0x00, 0x00, + 0xff, 0xff, 0x6b, 0x83, 0x1d, 0xcf, 0xeb, 0x00, 0x00, 0x00, } func (m *RequestMetaHeader) Marshal() (dAtA []byte, err error) { @@ -120,6 +135,11 @@ func (m *RequestMetaHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } + if m.Version != 0 { + i = encodeVarintMeta(dAtA, i, uint64(m.Version)) + i-- + dAtA[i] = 0x18 + } if m.Epoch != 0 { i = encodeVarintMeta(dAtA, i, uint64(m.Epoch)) i-- @@ -156,6 +176,9 @@ func (m *RequestMetaHeader) Size() (n int) { if m.Epoch != 0 { n += 1 + sovMeta(uint64(m.Epoch)) } + if m.Version != 0 { + n += 1 + sovMeta(uint64(m.Version)) + } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -235,6 +258,25 @@ func (m *RequestMetaHeader) Unmarshal(dAtA []byte) error { break } } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) + } + m.Version = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMeta + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Version |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipMeta(dAtA[iNdEx:]) diff --git a/service/verify.pb.go b/service/verify.pb.go index 3c0f357..95a9452 100644 --- a/service/verify.pb.go +++ b/service/verify.pb.go @@ -23,7 +23,10 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +// RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request +// (should be embedded into message). type RequestVerificationHeader struct { + // Signatures is a set of signatures of every passed NeoFS Node Signatures []*RequestVerificationHeader_Signature `protobuf:"bytes,1,rep,name=Signatures,proto3" json:"Signatures,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -67,7 +70,9 @@ func (m *RequestVerificationHeader) GetSignatures() []*RequestVerificationHeader } type RequestVerificationHeader_Sign struct { - Sign []byte `protobuf:"bytes,1,opt,name=Sign,proto3" json:"Sign,omitempty"` + // Sign is signature of the request or session key. + Sign []byte `protobuf:"bytes,1,opt,name=Sign,proto3" json:"Sign,omitempty"` + // Peer is compressed public key used for signature. Peer []byte `protobuf:"bytes,2,opt,name=Peer,proto3" json:"Peer,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -118,11 +123,15 @@ func (m *RequestVerificationHeader_Sign) GetPeer() []byte { } type RequestVerificationHeader_Signature struct { + // Sign is a signature and public key of the request. RequestVerificationHeader_Sign `protobuf:"bytes,1,opt,name=Sign,proto3,embedded=Sign" json:"Sign"` - Origin *RequestVerificationHeader_Sign `protobuf:"bytes,2,opt,name=Origin,proto3" json:"Origin,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + // Origin used for requests, when trusted node changes it and re-sign with session key. + // If session key used for signature request, then Origin should contain + // public key of user and signed session key. + Origin *RequestVerificationHeader_Sign `protobuf:"bytes,2,opt,name=Origin,proto3" json:"Origin,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *RequestVerificationHeader_Signature) Reset() { *m = RequestVerificationHeader_Signature{} } diff --git a/session/service.pb.go b/session/service.pb.go index eef5819..8532523 100644 --- a/session/service.pb.go +++ b/session/service.pb.go @@ -34,8 +34,10 @@ type CreateRequest struct { // Types that are valid to be assigned to Message: // *CreateRequest_Init // *CreateRequest_Signed - Message isCreateRequest_Message `protobuf_oneof:"Message"` - service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` + Message isCreateRequest_Message `protobuf_oneof:"Message"` + // RequestMetaHeader contains information about request meta headers (should be embedded into message) + service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` + // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) service.RequestVerificationHeader `protobuf:"bytes,99,opt,name=Verify,proto3,embedded=Verify" json:"Verify"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` diff --git a/state/service.pb.go b/state/service.pb.go index 8e66a2f..520c8ce 100644 --- a/state/service.pb.go +++ b/state/service.pb.go @@ -31,7 +31,9 @@ const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package // NetmapRequest message to request current node netmap type NetmapRequest struct { - service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` + // RequestMetaHeader contains information about request meta headers (should be embedded into message) + service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` + // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) service.RequestVerificationHeader `protobuf:"bytes,99,opt,name=Verify,proto3,embedded=Verify" json:"Verify"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -69,7 +71,9 @@ var xxx_messageInfo_NetmapRequest proto.InternalMessageInfo // MetricsRequest message to request node metrics type MetricsRequest struct { - service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` + // RequestMetaHeader contains information about request meta headers (should be embedded into message) + service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` + // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) service.RequestVerificationHeader `protobuf:"bytes,99,opt,name=Verify,proto3,embedded=Verify" json:"Verify"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -153,7 +157,9 @@ func (m *MetricsResponse) GetMetrics() [][]byte { // HealthRequest message to check current state type HealthRequest struct { - service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` + // RequestMetaHeader contains information about request meta headers (should be embedded into message) + service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` + // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) service.RequestVerificationHeader `protobuf:"bytes,99,opt,name=Verify,proto3,embedded=Verify" json:"Verify"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` From cb3f4b4b31304970f3ed0e4100b7fde92f179f10 Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Thu, 21 Nov 2019 16:35:17 +0300 Subject: [PATCH 0033/1196] docs: create changelog --- CHANGELOG.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..e4b71c8 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,22 @@ +# Changelog +This is the changelog for NeoFS Proto + +## [0.2.0] - 2019-11-21 + +### Added +- Container not found error +- GitHub Actions as CI and Codecov +- Auto-generated proto documentation +- RequestMetaHeader to all RPC requests +- RequestVerificationHeader to all RPC requests + +### Changed +- Moved TTL and Epoch fields to RequestMetaHeader +- Renamed Version in object.SearchRequest to QueryVersion +- Removed SetTTL, GetTTL, SetEpoch, GetEpoch from all RPC requests + +## 0.1.0 - 2019-11-18 + +Initial public release + +[0.2.0]: https://github.com/nspcc-dev/neofs-proto/compare/v0.1.0...v0.2.0 From 3b2ea6b8f4e954bc621735537f53f12b839d6e06 Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Fri, 22 Nov 2019 16:32:21 +0300 Subject: [PATCH 0034/1196] Remove SendPutRequest and update MakePutRequestHeader - SendPutRequest unused and work not like expected - MakePutRequestHeader should not set epoch / ttl - remove unused internal functions and consts - update to latest neofs-crypto --- go.mod | 2 +- go.sum | 1 + object/utils.go | 43 ++----------------------------------------- 3 files changed, 4 insertions(+), 42 deletions(-) diff --git a/go.mod b/go.mod index 4649004..06fb5c0 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,7 @@ require ( github.com/golang/protobuf v1.3.2 github.com/google/uuid v1.1.1 github.com/mr-tron/base58 v1.1.2 - github.com/nspcc-dev/neofs-crypto v0.2.1 + github.com/nspcc-dev/neofs-crypto v0.2.2 github.com/nspcc-dev/netmap v1.6.1 github.com/nspcc-dev/tzhash v1.3.0 github.com/onsi/ginkgo v1.10.2 // indirect diff --git a/go.sum b/go.sum index 6b48f3f..fce9983 100644 --- a/go.sum +++ b/go.sum @@ -73,6 +73,7 @@ github.com/nspcc-dev/hrw v1.0.8 h1:vwRuJXZXgkMvf473vFzeWGCfY1WBVeSHAEHvR4u3/Cg= github.com/nspcc-dev/hrw v1.0.8/go.mod h1:l/W2vx83vMQo6aStyx2AuZrJ+07lGv2JQGlVkPG06MU= github.com/nspcc-dev/neofs-crypto v0.2.1 h1:NxKexcW88vlHO/u7EYjx5Q1UaOQ7XhYrCsLSVgOcCxw= github.com/nspcc-dev/neofs-crypto v0.2.1/go.mod h1:F/96fUzPM3wR+UGsPi3faVNmFlA9KAEAUQR7dMxZmNA= +github.com/nspcc-dev/neofs-crypto v0.2.2/go.mod h1:F/96fUzPM3wR+UGsPi3faVNmFlA9KAEAUQR7dMxZmNA= github.com/nspcc-dev/netmap v1.6.1 h1:Pigqpqi6QSdRiusbq5XlO20A18k6Eyu7j9MzOfAE3CM= github.com/nspcc-dev/netmap v1.6.1/go.mod h1:mhV3UOg9ljQmu0teQShD6+JYX09XY5gu2I4hIByCH9M= github.com/nspcc-dev/rfc6979 v0.1.0 h1:Lwg7esRRoyK1Up/IN1vAef1EmvrBeMHeeEkek2fAJ6c= diff --git a/object/utils.go b/object/utils.go index f74fa2f..c0fb624 100644 --- a/object/utils.go +++ b/object/utils.go @@ -4,53 +4,14 @@ import ( "io" "code.cloudfoundry.org/bytefmt" - "github.com/nspcc-dev/neofs-proto/service" "github.com/nspcc-dev/neofs-proto/session" "github.com/pkg/errors" ) -const maxGetPayloadSize = 3584 * 1024 // 3.5 MiB - -func splitBytes(data []byte, maxSize int) (result [][]byte) { - l := len(data) - if l == 0 { - return [][]byte{data} - } - for i := 0; i < l; i += maxSize { - last := i + maxSize - if last > l { - last = l - } - result = append(result, data[i:last]) - } - return -} - -// SendPutRequest prepares object and sends it in chunks through protobuf stream. -func SendPutRequest(s Service_PutClient, obj *Object, epoch uint64, ttl uint32) (*PutResponse, error) { - // TODO split must take into account size of the marshalled Object - chunks := splitBytes(obj.Payload, maxGetPayloadSize) - obj.Payload = chunks[0] - if err := s.Send(MakePutRequestHeader(obj, epoch, ttl, nil)); err != nil { - return nil, err - } - for i := range chunks[1:] { - if err := s.Send(MakePutRequestChunk(chunks[i+1])); err != nil { - return nil, err - } - } - resp, err := s.CloseAndRecv() - if err != nil && err != io.EOF { - return nil, err - } - return resp, nil -} - -// MakePutRequestHeader combines object, epoch, ttl and session token value +// MakePutRequestHeader combines object and session token value // into header of object put request. -func MakePutRequestHeader(obj *Object, epoch uint64, ttl uint32, token *session.Token) *PutRequest { +func MakePutRequestHeader(obj *Object, token *session.Token) *PutRequest { return &PutRequest{ - RequestMetaHeader: service.RequestMetaHeader{TTL: ttl, Epoch: epoch}, R: &PutRequest_Header{Header: &PutRequest_PutHeader{ Object: obj, Token: token, From 982a953d8af943d0559dde57755d18524c6b55ce Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Fri, 22 Nov 2019 17:23:03 +0300 Subject: [PATCH 0035/1196] update go.sum --- go.sum | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/go.sum b/go.sum index fce9983..f06a499 100644 --- a/go.sum +++ b/go.sum @@ -71,8 +71,7 @@ github.com/mr-tron/base58 v1.1.2/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjW github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/nspcc-dev/hrw v1.0.8 h1:vwRuJXZXgkMvf473vFzeWGCfY1WBVeSHAEHvR4u3/Cg= github.com/nspcc-dev/hrw v1.0.8/go.mod h1:l/W2vx83vMQo6aStyx2AuZrJ+07lGv2JQGlVkPG06MU= -github.com/nspcc-dev/neofs-crypto v0.2.1 h1:NxKexcW88vlHO/u7EYjx5Q1UaOQ7XhYrCsLSVgOcCxw= -github.com/nspcc-dev/neofs-crypto v0.2.1/go.mod h1:F/96fUzPM3wR+UGsPi3faVNmFlA9KAEAUQR7dMxZmNA= +github.com/nspcc-dev/neofs-crypto v0.2.2 h1:jLc5O+Wdpaq7L4lNYFX7li+OP4I1FsvvcPW1NXm3erY= github.com/nspcc-dev/neofs-crypto v0.2.2/go.mod h1:F/96fUzPM3wR+UGsPi3faVNmFlA9KAEAUQR7dMxZmNA= github.com/nspcc-dev/netmap v1.6.1 h1:Pigqpqi6QSdRiusbq5XlO20A18k6Eyu7j9MzOfAE3CM= github.com/nspcc-dev/netmap v1.6.1/go.mod h1:mhV3UOg9ljQmu0teQShD6+JYX09XY5gu2I4hIByCH9M= From c2d1ee7495ab7724c8571d048756cfe00b88ec94 Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Fri, 22 Nov 2019 17:23:36 +0300 Subject: [PATCH 0036/1196] CHANGELOG for v0.2.1 --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e4b71c8..c2ce5b8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,12 @@ # Changelog This is the changelog for NeoFS Proto +## [0.2.1] - 2019-11-22 + +### Changed +- Removed SendPutRequest +- MakePutRequestHeader sets only object and token + ## [0.2.0] - 2019-11-21 ### Added @@ -20,3 +26,4 @@ This is the changelog for NeoFS Proto Initial public release [0.2.0]: https://github.com/nspcc-dev/neofs-proto/compare/v0.1.0...v0.2.0 +[0.2.1]: https://github.com/nspcc-dev/neofs-proto/compare/v0.2.0...v0.2.1 From 5c031fc6b2ede36233c8d213ece893384929cbfd Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Mon, 25 Nov 2019 15:47:57 +0300 Subject: [PATCH 0037/1196] service: ProcessRequestTTL shouldn't change status errors --- service/meta.go | 4 ++++ service/meta_test.go | 31 +++++++++++++++++++------------ 2 files changed, 23 insertions(+), 12 deletions(-) diff --git a/service/meta.go b/service/meta.go index 6b5b8b7..abffdad 100644 --- a/service/meta.go +++ b/service/meta.go @@ -101,6 +101,10 @@ func ProcessRequestTTL(req MetaHeader, cond ...TTLCondition) error { // check specific condition: if err := cond[i](ttl); err != nil { + if st, ok := status.FromError(err); ok { + return st.Err() + } + return status.New(codes.InvalidArgument, err.Error()).Err() } } diff --git a/service/meta_test.go b/service/meta_test.go index 893ca5e..496ea51 100644 --- a/service/meta_test.go +++ b/service/meta_test.go @@ -9,58 +9,65 @@ import ( ) type mockedRequest struct { - msg string - name string - role NodeRole - code codes.Code + msg string + name string + code codes.Code + handler TTLCondition RequestMetaHeader } func TestMetaRequest(t *testing.T) { tests := []mockedRequest{ { - role: InnerRingNode, name: "direct to ir node", + handler: IRNonForwarding(InnerRingNode), RequestMetaHeader: RequestMetaHeader{TTL: NonForwardingTTL}, }, { - role: StorageNode, code: codes.InvalidArgument, msg: ErrIncorrectTTL.Error(), name: "direct to storage node", + handler: IRNonForwarding(StorageNode), RequestMetaHeader: RequestMetaHeader{TTL: NonForwardingTTL}, }, { - role: StorageNode, msg: ErrZeroTTL.Error(), code: codes.InvalidArgument, name: "zero ttl", + handler: IRNonForwarding(StorageNode), RequestMetaHeader: RequestMetaHeader{TTL: ZeroTTL}, }, { - role: InnerRingNode, name: "default to ir node", + handler: IRNonForwarding(InnerRingNode), RequestMetaHeader: RequestMetaHeader{TTL: SingleForwardingTTL}, }, { - role: StorageNode, name: "default to storage node", + handler: IRNonForwarding(StorageNode), RequestMetaHeader: RequestMetaHeader{TTL: SingleForwardingTTL}, }, + { + msg: "not found", + code: codes.NotFound, + name: "custom status error", + RequestMetaHeader: RequestMetaHeader{TTL: SingleForwardingTTL}, + handler: func(_ uint32) error { return status.Error(codes.NotFound, "not found") }, + }, } for i := range tests { tt := tests[i] t.Run(tt.name, func(t *testing.T) { before := tt.GetTTL() - err := ProcessRequestTTL(&tt, IRNonForwarding(tt.role)) + err := ProcessRequestTTL(&tt, tt.handler) if tt.msg != "" { require.Errorf(t, err, tt.msg) state, ok := status.FromError(err) require.True(t, ok) - require.Equal(t, state.Code(), tt.code) - require.Equal(t, state.Message(), tt.msg) + require.Equal(t, tt.code, state.Code()) + require.Equal(t, tt.msg, state.Message()) } else { require.NoError(t, err) require.NotEqualf(t, before, tt.GetTTL(), "ttl should be changed: %d vs %d", before, tt.GetTTL()) From 50a8be84c4ca08f9bd86d14028220d9b2c0eb2bf Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Mon, 25 Nov 2019 15:59:53 +0300 Subject: [PATCH 0038/1196] CHANGELOG --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c2ce5b8..2e7736d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,11 @@ # Changelog This is the changelog for NeoFS Proto +## [0.2.2] - 2019-11-22 + +### Changed +- ProcessRequestTTL don't changes status errors from TTLCondition + ## [0.2.1] - 2019-11-22 ### Changed @@ -27,3 +32,4 @@ Initial public release [0.2.0]: https://github.com/nspcc-dev/neofs-proto/compare/v0.1.0...v0.2.0 [0.2.1]: https://github.com/nspcc-dev/neofs-proto/compare/v0.2.0...v0.2.1 +[0.2.2]: https://github.com/nspcc-dev/neofs-proto/compare/v0.2.1...v0.2.2 From 8967a0d1f5b0f0b67f66d5d472cda77af11e573f Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Tue, 26 Nov 2019 13:33:14 +0300 Subject: [PATCH 0039/1196] service: remove SignRequest, VerifyRequest and accompanying code --- service/sign.go | 47 ----------------------------------------------- 1 file changed, 47 deletions(-) delete mode 100644 service/sign.go diff --git a/service/sign.go b/service/sign.go deleted file mode 100644 index d8db94e..0000000 --- a/service/sign.go +++ /dev/null @@ -1,47 +0,0 @@ -package service - -import ( - "crypto/ecdsa" - - crypto "github.com/nspcc-dev/neofs-crypto" - "github.com/nspcc-dev/neofs-proto/internal" - "github.com/pkg/errors" -) - -// ErrWrongSignature should be raised when wrong signature is passed into VerifyRequest. -const ErrWrongSignature = internal.Error("wrong signature") - -// SignedRequest interface allows sign and verify requests. -type SignedRequest interface { - PrepareData() ([]byte, error) - GetSignature() []byte - SetSignature([]byte) -} - -// SignRequest with passed private key. -func SignRequest(r SignedRequest, key *ecdsa.PrivateKey) error { - var signature []byte - if data, err := r.PrepareData(); err != nil { - return err - } else if signature, err = crypto.Sign(key, data); err != nil { - return errors.Wrap(err, "could not sign data") - } - - r.SetSignature(signature) - - return nil -} - -// VerifyRequest by passed public keys. -func VerifyRequest(r SignedRequest, keys ...*ecdsa.PublicKey) bool { - data, err := r.PrepareData() - if err != nil { - return false - } - for i := range keys { - if err := crypto.Verify(keys[i], data, r.GetSignature()); err == nil { - return true - } - } - return false -} From eda9ea38291220cd9354e8a0166f04f169c58d4b Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Tue, 26 Nov 2019 13:34:16 +0300 Subject: [PATCH 0040/1196] service: add method to RequestVerificationHeader to validate owner --- service/verify.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/service/verify.go b/service/verify.go index a6ac3a5..48e2871 100644 --- a/service/verify.go +++ b/service/verify.go @@ -6,6 +6,7 @@ import ( "github.com/gogo/protobuf/proto" crypto "github.com/nspcc-dev/neofs-crypto" "github.com/nspcc-dev/neofs-proto/internal" + "github.com/nspcc-dev/neofs-proto/refs" "github.com/pkg/errors" ) @@ -35,6 +36,9 @@ const ( // ErrCannotFindOwner is raised when signatures empty in GetOwner. ErrCannotFindOwner = internal.Error("cannot find owner public key") + + // ErrWrongOwner is raised when passed OwnerID not equal to present PublicKey + ErrWrongOwner = internal.Error("wrong owner") ) // SetSignatures replaces signatures stored in RequestVerificationHeader. @@ -62,6 +66,18 @@ func (m *RequestVerificationHeader) SetOwner(pub *ecdsa.PublicKey, sign []byte) } } +// CheckOwner validates, that passed OwnerID is equal to present PublicKey of owner. +func (m *RequestVerificationHeader) CheckOwner(owner refs.OwnerID) error { + if key, err := m.GetOwner(); err != nil { + return err + } else if user, err := refs.NewOwnerID(key); err != nil { + return err + } else if !user.Equal(owner) { + return ErrWrongOwner + } + return nil +} + // GetOwner tries to get owner (client) public key from signatures. // If signatures contains not empty Origin, we should try to validate, // that session key was signed by owner (client), otherwise return error. From 40038cc860cbacfd0512dcc7a50245494a07556e Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Tue, 26 Nov 2019 13:42:47 +0300 Subject: [PATCH 0041/1196] service: test coverage for CheckOwner --- service/verify_test.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/service/verify_test.go b/service/verify_test.go index 1403c67..237e362 100644 --- a/service/verify_test.go +++ b/service/verify_test.go @@ -9,6 +9,7 @@ import ( "github.com/gogo/protobuf/proto" crypto "github.com/nspcc-dev/neofs-crypto" "github.com/nspcc-dev/neofs-crypto/test" + "github.com/nspcc-dev/neofs-proto/refs" "github.com/pkg/errors" "github.com/stretchr/testify/require" ) @@ -78,6 +79,12 @@ func TestMaintainableRequest(t *testing.T) { } } + { // Validate owner + user, err := refs.NewOwnerID(&owner.PublicKey) + require.NoError(t, err) + require.NoError(t, req.CheckOwner(user)) + } + { // Good case: require.NoError(t, VerifyRequestHeader(req)) From 20c10a2afd5641a8f95394501949d5fef865f78c Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Tue, 26 Nov 2019 13:57:29 +0300 Subject: [PATCH 0042/1196] service: rename EpochRequest to EpochHeader and merge with MetaHeader --- service/epoch.go | 7 ------- service/meta.go | 11 ++++++++--- 2 files changed, 8 insertions(+), 10 deletions(-) delete mode 100644 service/epoch.go diff --git a/service/epoch.go b/service/epoch.go deleted file mode 100644 index 2fd4381..0000000 --- a/service/epoch.go +++ /dev/null @@ -1,7 +0,0 @@ -package service - -// EpochRequest interface gives possibility to get or set epoch in RPC Requests. -type EpochRequest interface { - GetEpoch() uint64 - SetEpoch(v uint64) -} diff --git a/service/meta.go b/service/meta.go index abffdad..b41596a 100644 --- a/service/meta.go +++ b/service/meta.go @@ -19,14 +19,19 @@ type ( GetTTL() uint32 SetTTL(uint32) - // EpochRequest gives possibility to get or set epoch in RPC Requests. - GetEpoch() uint64 - SetEpoch(uint64) + // EpochHeader gives possibility to get or set epoch in RPC Requests. + EpochHeader // VersionHeader allows get or set version of protocol request VersionHeader } + // EpochHeader interface gives possibility to get or set epoch in RPC Requests. + EpochHeader interface { + GetEpoch() uint64 + SetEpoch(v uint64) + } + // VersionHeader allows get or set version of protocol request VersionHeader interface { GetVersion() uint32 From d08f5a5811f0f19e7981bc3f60a391e7d722a261 Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Tue, 26 Nov 2019 14:08:52 +0300 Subject: [PATCH 0043/1196] service: get status error even if it is wrapped --- service/meta.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/service/meta.go b/service/meta.go index abffdad..c5d09f7 100644 --- a/service/meta.go +++ b/service/meta.go @@ -2,6 +2,7 @@ package service import ( "github.com/nspcc-dev/neofs-proto/internal" + "github.com/pkg/errors" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" ) @@ -101,7 +102,7 @@ func ProcessRequestTTL(req MetaHeader, cond ...TTLCondition) error { // check specific condition: if err := cond[i](ttl); err != nil { - if st, ok := status.FromError(err); ok { + if st, ok := status.FromError(errors.Cause(err)); ok { return st.Err() } From a893e389b0d9c2c58bc2d39e8691a1be5e85f256 Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Tue, 26 Nov 2019 14:09:23 +0300 Subject: [PATCH 0044/1196] service: test coverage for wrapped status errors --- service/meta_test.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/service/meta_test.go b/service/meta_test.go index 496ea51..e208dfe 100644 --- a/service/meta_test.go +++ b/service/meta_test.go @@ -3,6 +3,7 @@ package service import ( "testing" + "github.com/pkg/errors" "github.com/stretchr/testify/require" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" @@ -54,6 +55,18 @@ func TestMetaRequest(t *testing.T) { RequestMetaHeader: RequestMetaHeader{TTL: SingleForwardingTTL}, handler: func(_ uint32) error { return status.Error(codes.NotFound, "not found") }, }, + { + msg: "not found", + code: codes.NotFound, + name: "custom wrapped status error", + RequestMetaHeader: RequestMetaHeader{TTL: SingleForwardingTTL}, + handler: func(_ uint32) error { + err := status.Error(codes.NotFound, "not found") + err = errors.Wrap(err, "some error context") + err = errors.Wrap(err, "another error context") + return err + }, + }, } for i := range tests { From 5fa7d72bbad05acdc1eb2ec59e53183d1897a903 Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Tue, 26 Nov 2019 15:53:55 +0300 Subject: [PATCH 0045/1196] service: get rid of signature field in accounting + proto generate --- accounting/withdraw.go | 6 -- accounting/withdraw.pb.go | 187 ++++++++------------------------------ accounting/withdraw.proto | 4 - 3 files changed, 39 insertions(+), 158 deletions(-) diff --git a/accounting/withdraw.go b/accounting/withdraw.go index 0a8cf90..11c5608 100644 --- a/accounting/withdraw.go +++ b/accounting/withdraw.go @@ -11,12 +11,6 @@ type ( MessageID = refs.MessageID ) -// SetSignature sets signature to PutRequest to satisfy SignedRequest interface. -func (m *PutRequest) SetSignature(v []byte) { m.Signature = v } - -// SetSignature sets signature to DeleteRequest to satisfy SignedRequest interface. -func (m *DeleteRequest) SetSignature(v []byte) { m.Signature = v } - // PrepareData prepares bytes representation of PutRequest to satisfy SignedRequest interface. func (m *PutRequest) PrepareData() ([]byte, error) { var offset int diff --git a/accounting/withdraw.pb.go b/accounting/withdraw.pb.go index a2116c0..d80b01c 100644 --- a/accounting/withdraw.pb.go +++ b/accounting/withdraw.pb.go @@ -191,8 +191,6 @@ type PutRequest struct { Height uint64 `protobuf:"varint,3,opt,name=Height,proto3" json:"Height,omitempty"` // MessageID is a nonce for uniq request (UUIDv4) MessageID MessageID `protobuf:"bytes,4,opt,name=MessageID,proto3,customtype=MessageID" json:"MessageID"` - // Signature is a signature of the sent request - Signature []byte `protobuf:"bytes,5,opt,name=Signature,proto3" json:"Signature,omitempty"` // RequestMetaHeader contains information about request meta headers (should be embedded into message) service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) @@ -245,13 +243,6 @@ func (m *PutRequest) GetHeight() uint64 { return 0 } -func (m *PutRequest) GetSignature() []byte { - if m != nil { - return m.Signature - } - return nil -} - type PutResponse struct { // ID is cheque identifier ID ChequeID `protobuf:"bytes,1,opt,name=ID,proto3,customtype=ChequeID" json:"ID"` @@ -381,8 +372,6 @@ type DeleteRequest struct { OwnerID OwnerID `protobuf:"bytes,2,opt,name=OwnerID,proto3,customtype=OwnerID" json:"OwnerID"` // MessageID is a nonce for uniq request (UUIDv4) MessageID MessageID `protobuf:"bytes,3,opt,name=MessageID,proto3,customtype=MessageID" json:"MessageID"` - // Signature is a signature of the sent request - Signature []byte `protobuf:"bytes,4,opt,name=Signature,proto3" json:"Signature,omitempty"` // RequestMetaHeader contains information about request meta headers (should be embedded into message) service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) @@ -421,13 +410,6 @@ func (m *DeleteRequest) XXX_DiscardUnknown() { var xxx_messageInfo_DeleteRequest proto.InternalMessageInfo -func (m *DeleteRequest) GetSignature() []byte { - if m != nil { - return m.Signature - } - return nil -} - // DeleteResponse is empty type DeleteResponse struct { XXX_NoUnkeyedLiteral struct{} `json:"-"` @@ -479,46 +461,45 @@ func init() { func init() { proto.RegisterFile("accounting/withdraw.proto", fileDescriptor_b3a38a4dc2575267) } var fileDescriptor_b3a38a4dc2575267 = []byte{ - // 615 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x55, 0x41, 0x6b, 0xd4, 0x40, - 0x14, 0xee, 0x24, 0xe9, 0xb6, 0x7d, 0x5b, 0xb5, 0x0e, 0x5a, 0xd3, 0x20, 0xdb, 0x25, 0x07, 0x59, - 0xd1, 0x26, 0x50, 0xa1, 0x28, 0x1e, 0xa4, 0x6b, 0xa0, 0x0d, 0x58, 0x2c, 0x11, 0x14, 0xbc, 0x65, - 0xb3, 0xaf, 0xd9, 0x40, 0x37, 0x59, 0x93, 0xc9, 0x2e, 0xfd, 0x27, 0xfe, 0x07, 0x0f, 0x5e, 0xfd, - 0x09, 0x7b, 0xec, 0x51, 0x3d, 0x2c, 0xb2, 0xfe, 0x07, 0xcf, 0x92, 0xc9, 0xa4, 0xc9, 0x76, 0x0b, - 0x56, 0x51, 0xea, 0x29, 0x33, 0xef, 0x7b, 0x6f, 0xe6, 0xbd, 0xef, 0xfb, 0x92, 0xc0, 0x86, 0xeb, - 0x79, 0x51, 0x1a, 0xb2, 0x20, 0xf4, 0xcd, 0x51, 0xc0, 0x7a, 0xdd, 0xd8, 0x1d, 0x19, 0x83, 0x38, - 0x62, 0x11, 0x85, 0x12, 0xd2, 0x68, 0x82, 0xf1, 0x30, 0xf0, 0xd0, 0xec, 0x23, 0x73, 0x73, 0x5c, - 0xbb, 0x55, 0xc4, 0x86, 0x18, 0x07, 0x47, 0x27, 0x22, 0x7a, 0xbb, 0x8b, 0x5e, 0xd0, 0x77, 0x8f, - 0x4d, 0xf1, 0x14, 0xe1, 0x2d, 0x3f, 0x60, 0xbd, 0xb4, 0x63, 0x78, 0x51, 0xdf, 0xf4, 0x23, 0x3f, - 0x32, 0x79, 0xb8, 0x93, 0x1e, 0xf1, 0x1d, 0xdf, 0xf0, 0x55, 0x9e, 0xae, 0x7f, 0x24, 0xa0, 0xd8, - 0x0c, 0xfb, 0xb4, 0x09, 0x92, 0x6d, 0xa9, 0xa4, 0x49, 0x5a, 0xab, 0xed, 0xb5, 0xf1, 0x64, 0x73, - 0xe1, 0xeb, 0x64, 0x73, 0xf9, 0x79, 0x0f, 0xdf, 0xa5, 0x68, 0x5b, 0x8e, 0x64, 0x5b, 0xf4, 0x3e, - 0x2c, 0xbd, 0x1c, 0x85, 0x18, 0xdb, 0x96, 0x2a, 0xf1, 0xb4, 0x1b, 0x22, 0xad, 0x08, 0x3b, 0xc5, - 0x82, 0xb6, 0xa0, 0xb6, 0xdb, 0xcf, 0x46, 0x52, 0xe5, 0x26, 0x69, 0xd5, 0xb7, 0xd7, 0x8c, 0xa2, - 0x49, 0x2b, 0x7f, 0x3a, 0x02, 0xa7, 0xeb, 0x50, 0xdb, 0xc7, 0xc0, 0xef, 0x31, 0x55, 0x69, 0x92, - 0x96, 0xe2, 0x88, 0x1d, 0x55, 0x61, 0xe9, 0xd0, 0x3d, 0x39, 0x8e, 0xdc, 0xae, 0xba, 0x98, 0x5d, - 0xe6, 0x14, 0x5b, 0xfd, 0x0b, 0x01, 0xd8, 0x43, 0xe6, 0x64, 0x9d, 0x25, 0xec, 0xef, 0xf6, 0xfd, - 0x18, 0x94, 0x03, 0x64, 0xae, 0xda, 0xe1, 0x5d, 0x6b, 0x86, 0x20, 0xde, 0x10, 0x97, 0x65, 0xd8, - 0x3e, 0xba, 0x5d, 0x8c, 0xdb, 0xcb, 0xd9, 0x19, 0xa7, 0x93, 0x4d, 0xe2, 0xf0, 0x0a, 0x6a, 0x41, - 0xed, 0x35, 0x57, 0x47, 0xf5, 0x78, 0xad, 0x7e, 0xbe, 0x96, 0xa3, 0x81, 0xe7, 0xb2, 0x20, 0x0a, - 0xe7, 0xce, 0x10, 0xb5, 0xfa, 0x53, 0xa8, 0xf3, 0xd1, 0x92, 0x41, 0x14, 0x26, 0x48, 0x1f, 0xc2, - 0xf2, 0x1b, 0x61, 0x15, 0x3e, 0x61, 0x46, 0x64, 0xe9, 0x15, 0x23, 0xd3, 0xcd, 0x39, 0xcb, 0xd0, - 0xc7, 0x12, 0xc0, 0x61, 0x7a, 0x46, 0x4c, 0x65, 0x6c, 0x72, 0x69, 0xb9, 0xa4, 0x4b, 0xcb, 0x25, - 0xcf, 0xc8, 0x65, 0xc2, 0xca, 0x01, 0x26, 0x89, 0xeb, 0xa3, 0x6d, 0x71, 0x25, 0x57, 0xdb, 0x37, - 0xc5, 0x75, 0x25, 0xe0, 0x94, 0x4b, 0x7a, 0x17, 0x56, 0x5e, 0x05, 0x7e, 0xe8, 0xb2, 0x34, 0x46, - 0xa1, 0x70, 0x19, 0xb8, 0x72, 0x1d, 0x4c, 0xa8, 0x73, 0x26, 0x85, 0x0e, 0xbf, 0xf4, 0x98, 0xfe, - 0x89, 0x40, 0xfd, 0x45, 0x90, 0xfc, 0x09, 0xf9, 0x57, 0x3d, 0xeb, 0x0e, 0xac, 0xe6, 0x9d, 0x8b, - 0x61, 0xef, 0xc1, 0x62, 0x66, 0xac, 0x44, 0x25, 0x4d, 0xf9, 0x42, 0xc7, 0xe5, 0xb0, 0xfe, 0x41, - 0x82, 0x6b, 0x16, 0x1e, 0x23, 0xc3, 0x7f, 0xf2, 0x2a, 0xce, 0x38, 0x4a, 0xfe, 0x5d, 0x47, 0x29, - 0xff, 0x9b, 0xa3, 0xd6, 0xe0, 0x7a, 0x41, 0x56, 0xce, 0xf3, 0xf6, 0x0f, 0x52, 0xbe, 0xdd, 0x74, - 0x07, 0xe4, 0x3d, 0x64, 0x74, 0xbd, 0x4a, 0x76, 0xf9, 0x91, 0xd3, 0xee, 0xcc, 0xc5, 0x85, 0x58, - 0x3b, 0x20, 0x1f, 0xa6, 0xe7, 0xea, 0xca, 0x6f, 0xc0, 0x6c, 0x5d, 0xd5, 0xd1, 0x4f, 0x40, 0xc9, - 0x44, 0xa7, 0x33, 0x09, 0x15, 0x03, 0x6b, 0xea, 0x3c, 0x20, 0x4a, 0x9f, 0x41, 0x2d, 0x9f, 0x84, - 0x6e, 0x54, 0x73, 0x66, 0xac, 0xa0, 0x69, 0x17, 0x41, 0xf9, 0x01, 0xed, 0xdd, 0xf1, 0xb4, 0x41, - 0x4e, 0xa7, 0x0d, 0xf2, 0x79, 0xda, 0x20, 0xdf, 0xa6, 0x0d, 0xf2, 0xfe, 0x7b, 0x63, 0xe1, 0xed, - 0x83, 0xca, 0x7f, 0x2b, 0x4c, 0x06, 0x9e, 0xb7, 0xd5, 0xc5, 0xa1, 0x19, 0x62, 0x74, 0x94, 0x6c, - 0xe5, 0x7f, 0xad, 0xf2, 0xc4, 0x4e, 0x8d, 0x47, 0x1e, 0xfd, 0x0c, 0x00, 0x00, 0xff, 0xff, 0xd3, - 0x26, 0xc1, 0xc6, 0x55, 0x07, 0x00, 0x00, + // 600 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x55, 0xc1, 0x6e, 0xd3, 0x4c, + 0x10, 0xee, 0xda, 0x69, 0xda, 0x7f, 0xd2, 0x1f, 0xca, 0x0a, 0x8a, 0xeb, 0x43, 0x1a, 0xf9, 0x80, + 0x82, 0x20, 0xb6, 0x54, 0xa4, 0x08, 0xc4, 0x01, 0x35, 0x58, 0x6a, 0x2d, 0x51, 0x11, 0xf9, 0x00, + 0x12, 0x37, 0xc7, 0x99, 0x38, 0x96, 0x12, 0x3b, 0xd8, 0xeb, 0x44, 0x7d, 0x08, 0xee, 0x3c, 0x03, + 0x17, 0xae, 0x3c, 0x42, 0x8f, 0x3d, 0x02, 0x87, 0x08, 0x85, 0x77, 0xe0, 0x8c, 0xbc, 0x5e, 0xd7, + 0x4e, 0x53, 0x89, 0x0a, 0x81, 0x2a, 0x4e, 0xd9, 0x9d, 0x6f, 0x66, 0x77, 0xe6, 0xfb, 0xbe, 0x8d, + 0x61, 0xd7, 0x71, 0xdd, 0x30, 0x09, 0x98, 0x1f, 0x78, 0xc6, 0xcc, 0x67, 0xc3, 0x7e, 0xe4, 0xcc, + 0xf4, 0x49, 0x14, 0xb2, 0x90, 0x42, 0x01, 0xa9, 0x34, 0xc6, 0x68, 0xea, 0xbb, 0x68, 0x8c, 0x91, + 0x39, 0x19, 0xae, 0xde, 0xce, 0x63, 0x53, 0x8c, 0xfc, 0xc1, 0x89, 0x88, 0xde, 0xe9, 0xa3, 0xeb, + 0x8f, 0x9d, 0x91, 0x21, 0x7e, 0x45, 0xb8, 0xe5, 0xf9, 0x6c, 0x98, 0xf4, 0x74, 0x37, 0x1c, 0x1b, + 0x5e, 0xe8, 0x85, 0x06, 0x0f, 0xf7, 0x92, 0x01, 0xdf, 0xf1, 0x0d, 0x5f, 0x65, 0xe9, 0xda, 0x47, + 0x02, 0x15, 0x8b, 0xe1, 0x98, 0x36, 0x40, 0xb2, 0x4c, 0x85, 0x34, 0x48, 0x73, 0xab, 0xb3, 0x7d, + 0x3a, 0xdf, 0x5b, 0xfb, 0x3a, 0xdf, 0xdb, 0x7c, 0x3e, 0xc4, 0xb7, 0x09, 0x5a, 0xa6, 0x2d, 0x59, + 0x26, 0xbd, 0x0f, 0x1b, 0x2f, 0x67, 0x01, 0x46, 0x96, 0xa9, 0x48, 0x3c, 0xed, 0xa6, 0x48, 0xcb, + 0xc3, 0x76, 0xbe, 0xa0, 0x4d, 0xa8, 0x1e, 0x8c, 0xd3, 0x91, 0x14, 0xb9, 0x41, 0x9a, 0xb5, 0xfd, + 0x6d, 0x3d, 0x6f, 0xd2, 0xcc, 0x7e, 0x6d, 0x81, 0xd3, 0x1d, 0xa8, 0x1e, 0xa1, 0xef, 0x0d, 0x99, + 0x52, 0x69, 0x90, 0x66, 0xc5, 0x16, 0x3b, 0xaa, 0xc0, 0x46, 0xd7, 0x39, 0x19, 0x85, 0x4e, 0x5f, + 0x59, 0x4f, 0x2f, 0xb3, 0xf3, 0xad, 0xf6, 0x85, 0x00, 0x1c, 0x22, 0xb3, 0xd3, 0xce, 0x62, 0xf6, + 0x67, 0xfb, 0x7e, 0x0c, 0x95, 0x63, 0x64, 0x8e, 0xd2, 0xe3, 0x5d, 0xab, 0xba, 0x20, 0x5e, 0x17, + 0x97, 0xa5, 0xd8, 0x11, 0x3a, 0x7d, 0x8c, 0x3a, 0x9b, 0xe9, 0x19, 0x67, 0xf3, 0x3d, 0x62, 0xf3, + 0x0a, 0x6a, 0x42, 0xf5, 0x15, 0x57, 0x47, 0x71, 0x79, 0xad, 0x76, 0xb1, 0x96, 0xa3, 0xbe, 0xeb, + 0x30, 0x3f, 0x0c, 0x56, 0xce, 0x10, 0xb5, 0xda, 0x53, 0xa8, 0xf1, 0xd1, 0xe2, 0x49, 0x18, 0xc4, + 0x48, 0x1f, 0xc2, 0xe6, 0x6b, 0x61, 0x15, 0x3e, 0x61, 0x4a, 0x64, 0xe1, 0x15, 0x3d, 0xd5, 0xcd, + 0x3e, 0xcf, 0xd0, 0x3e, 0x48, 0x00, 0xdd, 0xe4, 0x9c, 0x98, 0xd2, 0xd8, 0xe4, 0xca, 0x72, 0x49, + 0x57, 0x96, 0x4b, 0x5e, 0x92, 0xcb, 0x80, 0xff, 0x8e, 0x31, 0x8e, 0x1d, 0x0f, 0x2d, 0x93, 0x2b, + 0xb9, 0xd5, 0xb9, 0x25, 0xae, 0x2b, 0x00, 0xbb, 0x58, 0x5e, 0x3b, 0xd3, 0x06, 0xd4, 0x38, 0x57, + 0x82, 0xe9, 0x5f, 0xba, 0x48, 0xfb, 0x44, 0xa0, 0xf6, 0xc2, 0x8f, 0x7f, 0x87, 0xde, 0xeb, 0x9e, + 0xb5, 0x0d, 0x5b, 0x59, 0xe7, 0x62, 0xd8, 0x7b, 0xb0, 0x9e, 0x5a, 0x27, 0x56, 0x48, 0x43, 0xbe, + 0xd4, 0x53, 0x19, 0xac, 0xbd, 0x93, 0xe0, 0x7f, 0x13, 0x47, 0xc8, 0xf0, 0xaf, 0x3c, 0xb6, 0x25, + 0xcf, 0xc8, 0xff, 0x80, 0x67, 0xb6, 0xe1, 0x46, 0x4e, 0x47, 0xc6, 0xe4, 0xfe, 0x0f, 0x52, 0xbc, + 0x50, 0xda, 0x06, 0xf9, 0x10, 0x19, 0xdd, 0x29, 0xd3, 0x59, 0xfc, 0x51, 0xa9, 0x77, 0x57, 0xe2, + 0x42, 0x8e, 0x36, 0xc8, 0xdd, 0xe4, 0x42, 0x5d, 0xf1, 0x8e, 0x97, 0xeb, 0xca, 0x9e, 0x7d, 0x02, + 0x95, 0x54, 0x56, 0xba, 0x94, 0x50, 0xb2, 0xa8, 0xaa, 0xac, 0x02, 0xa2, 0xf4, 0x19, 0x54, 0xb3, + 0x49, 0xe8, 0x6e, 0x39, 0x67, 0x49, 0x6c, 0x55, 0xbd, 0x0c, 0xca, 0x0e, 0xe8, 0x1c, 0x9c, 0x2e, + 0xea, 0xe4, 0x6c, 0x51, 0x27, 0x9f, 0x17, 0x75, 0xf2, 0x6d, 0x51, 0x27, 0xef, 0xbf, 0xd7, 0xd7, + 0xde, 0x3c, 0x28, 0x7d, 0x7b, 0x82, 0x78, 0xe2, 0xba, 0xad, 0x3e, 0x4e, 0x8d, 0x00, 0xc3, 0x41, + 0xdc, 0xca, 0xbe, 0x3c, 0xc5, 0x89, 0xbd, 0x2a, 0x8f, 0x3c, 0xfa, 0x19, 0x00, 0x00, 0xff, 0xff, + 0x39, 0x77, 0x4b, 0x08, 0x19, 0x07, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -946,13 +927,6 @@ func (m *PutRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x6 i-- dAtA[i] = 0x92 - if len(m.Signature) > 0 { - i -= len(m.Signature) - copy(dAtA[i:], m.Signature) - i = encodeVarintWithdraw(dAtA, i, uint64(len(m.Signature))) - i-- - dAtA[i] = 0x2a - } { size := m.MessageID.Size() i -= size @@ -1180,13 +1154,6 @@ func (m *DeleteRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x6 i-- dAtA[i] = 0x92 - if len(m.Signature) > 0 { - i -= len(m.Signature) - copy(dAtA[i:], m.Signature) - i = encodeVarintWithdraw(dAtA, i, uint64(len(m.Signature))) - i-- - dAtA[i] = 0x22 - } { size := m.MessageID.Size() i -= size @@ -1338,10 +1305,6 @@ func (m *PutRequest) Size() (n int) { } l = m.MessageID.Size() n += 1 + l + sovWithdraw(uint64(l)) - l = len(m.Signature) - if l > 0 { - n += 1 + l + sovWithdraw(uint64(l)) - } l = m.RequestMetaHeader.Size() n += 2 + l + sovWithdraw(uint64(l)) l = m.RequestVerificationHeader.Size() @@ -1414,10 +1377,6 @@ func (m *DeleteRequest) Size() (n int) { n += 1 + l + sovWithdraw(uint64(l)) l = m.MessageID.Size() n += 1 + l + sovWithdraw(uint64(l)) - l = len(m.Signature) - if l > 0 { - n += 1 + l + sovWithdraw(uint64(l)) - } l = m.RequestMetaHeader.Size() n += 2 + l + sovWithdraw(uint64(l)) l = m.RequestVerificationHeader.Size() @@ -2081,40 +2040,6 @@ func (m *PutRequest) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Signature", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWithdraw - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthWithdraw - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthWithdraw - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Signature = append(m.Signature[:0], dAtA[iNdEx:postIndex]...) - if m.Signature == nil { - m.Signature = []byte{} - } - iNdEx = postIndex case 98: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType) @@ -2662,40 +2587,6 @@ func (m *DeleteRequest) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Signature", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWithdraw - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthWithdraw - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthWithdraw - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Signature = append(m.Signature[:0], dAtA[iNdEx:postIndex]...) - if m.Signature == nil { - m.Signature = []byte{} - } - iNdEx = postIndex case 98: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType) diff --git a/accounting/withdraw.proto b/accounting/withdraw.proto index bb950ba..a44e47a 100644 --- a/accounting/withdraw.proto +++ b/accounting/withdraw.proto @@ -59,8 +59,6 @@ message PutRequest { uint64 Height = 3; // MessageID is a nonce for uniq request (UUIDv4) bytes MessageID = 4 [(gogoproto.customtype) = "MessageID", (gogoproto.nullable) = false]; - // Signature is a signature of the sent request - bytes Signature = 5; // RequestMetaHeader contains information about request meta headers (should be embedded into message) service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) @@ -92,8 +90,6 @@ message DeleteRequest { bytes OwnerID = 2 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false]; // MessageID is a nonce for uniq request (UUIDv4) bytes MessageID = 3 [(gogoproto.customtype) = "MessageID", (gogoproto.nullable) = false]; - // Signature is a signature of the sent request - bytes Signature = 4; // RequestMetaHeader contains information about request meta headers (should be embedded into message) service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) From 14f85ced84cc0d44af9c005a57986242acd5334b Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Tue, 26 Nov 2019 15:54:27 +0300 Subject: [PATCH 0046/1196] service: get rid of signature field in container + proto generate --- container/service.go | 6 -- container/service.pb.go | 183 ++++++++-------------------------------- container/service.proto | 6 -- 3 files changed, 37 insertions(+), 158 deletions(-) diff --git a/container/service.go b/container/service.go index 4d3747e..24727ee 100644 --- a/container/service.go +++ b/container/service.go @@ -25,12 +25,6 @@ const ( ErrNotFound = internal.Error("could not find container") ) -// SetSignature sets signature to PutRequest to satisfy SignedRequest interface. -func (m *PutRequest) SetSignature(v []byte) { m.Signature = v } - -// SetSignature sets signature to DeleteRequest to satisfy SignedRequest interface. -func (m *DeleteRequest) SetSignature(v []byte) { m.Signature = v } - // PrepareData prepares bytes representation of PutRequest to satisfy SignedRequest interface. func (m *PutRequest) PrepareData() ([]byte, error) { var ( diff --git a/container/service.pb.go b/container/service.pb.go index 8b98cfa..d9febc0 100644 --- a/container/service.pb.go +++ b/container/service.pb.go @@ -38,8 +38,6 @@ type PutRequest struct { OwnerID OwnerID `protobuf:"bytes,3,opt,name=OwnerID,proto3,customtype=OwnerID" json:"OwnerID"` // Rules define storage policy for the object inside the container. Rules netmap.PlacementRule `protobuf:"bytes,4,opt,name=rules,proto3" json:"rules"` - // Signature of the user (owner id) - Signature []byte `protobuf:"bytes,5,opt,name=Signature,proto3" json:"Signature,omitempty"` // RequestMetaHeader contains information about request meta headers (should be embedded into message) service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) @@ -92,13 +90,6 @@ func (m *PutRequest) GetRules() netmap.PlacementRule { return netmap.PlacementRule{} } -func (m *PutRequest) GetSignature() []byte { - if m != nil { - return m.Signature - } - return nil -} - type PutResponse struct { // CID (container id) is a SHA256 hash of the container structure CID CID `protobuf:"bytes,1,opt,name=CID,proto3,customtype=CID" json:"CID"` @@ -139,8 +130,6 @@ var xxx_messageInfo_PutResponse proto.InternalMessageInfo type DeleteRequest struct { // CID (container id) is a SHA256 hash of the container structure CID CID `protobuf:"bytes,1,opt,name=CID,proto3,customtype=CID" json:"CID"` - // Signature of the container owner - Signature []byte `protobuf:"bytes,2,opt,name=Signature,proto3" json:"Signature,omitempty"` // RequestMetaHeader contains information about request meta headers (should be embedded into message) service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) @@ -179,13 +168,6 @@ func (m *DeleteRequest) XXX_DiscardUnknown() { var xxx_messageInfo_DeleteRequest proto.InternalMessageInfo -func (m *DeleteRequest) GetSignature() []byte { - if m != nil { - return m.Signature - } - return nil -} - // DeleteResponse is empty because delete operation is asynchronous and done // via consensus in inner ring nodes type DeleteResponse struct { @@ -400,44 +382,43 @@ func init() { func init() { proto.RegisterFile("container/service.proto", fileDescriptor_e1fa9d7ab2e7ae06) } var fileDescriptor_e1fa9d7ab2e7ae06 = []byte{ - // 586 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x54, 0xcd, 0x6e, 0xd3, 0x4c, - 0x14, 0xed, 0x34, 0x69, 0xda, 0x5c, 0xf7, 0xfb, 0x80, 0x51, 0x43, 0x8d, 0x05, 0x49, 0xe4, 0x55, - 0x40, 0xc4, 0x16, 0xa1, 0x12, 0x6c, 0x90, 0x20, 0x89, 0x54, 0x2a, 0x51, 0x11, 0xb9, 0x12, 0x0b, - 0x76, 0x8e, 0x7b, 0x13, 0x2c, 0x25, 0xb6, 0xf1, 0x8c, 0x83, 0xf2, 0x26, 0xbc, 0x03, 0x2f, 0xc0, - 0x23, 0x74, 0xc1, 0xa2, 0x1b, 0x24, 0xc4, 0x22, 0x42, 0x61, 0xcd, 0x3b, 0x20, 0x8f, 0xc7, 0x3f, - 0x49, 0xcb, 0xcf, 0xae, 0x6c, 0x2c, 0xcf, 0x39, 0xf7, 0x9e, 0x99, 0x73, 0xef, 0xdc, 0x81, 0x7d, - 0xc7, 0xf7, 0xb8, 0xed, 0x7a, 0x18, 0x9a, 0x0c, 0xc3, 0x99, 0xeb, 0xa0, 0x11, 0x84, 0x3e, 0xf7, - 0x69, 0x35, 0x23, 0x34, 0x2a, 0x19, 0x73, 0x8a, 0xdc, 0x4e, 0x68, 0x6d, 0x2f, 0xc5, 0x66, 0x18, - 0xba, 0xa3, 0xb9, 0x44, 0x6b, 0xb9, 0x1a, 0x9f, 0x07, 0xc8, 0x24, 0x7c, 0x6f, 0xec, 0xf2, 0x37, - 0xd1, 0xd0, 0x70, 0xfc, 0xa9, 0xe9, 0xb1, 0xc0, 0x71, 0xda, 0xa7, 0x38, 0x33, 0x3d, 0xe4, 0x53, - 0x3b, 0x30, 0x19, 0x4e, 0xd0, 0xe1, 0x7e, 0x28, 0x63, 0xdb, 0x85, 0xd8, 0xb1, 0x3f, 0xf6, 0x4d, - 0x01, 0x0f, 0xa3, 0x91, 0x58, 0x89, 0x85, 0xf8, 0x4b, 0xc2, 0xf5, 0xcf, 0x9b, 0x00, 0x83, 0x88, - 0x5b, 0xf8, 0x36, 0x42, 0xc6, 0xa9, 0x09, 0xd5, 0x63, 0x64, 0xcc, 0x1e, 0xe3, 0x51, 0x5f, 0x25, - 0x4d, 0xd2, 0xda, 0xed, 0xde, 0x38, 0x5b, 0x34, 0x36, 0xbe, 0x2e, 0x1a, 0x39, 0x61, 0xe5, 0xbf, - 0x54, 0x83, 0x9d, 0x9e, 0x1d, 0xd8, 0x8e, 0xcb, 0xe7, 0xea, 0x66, 0x93, 0xb4, 0xca, 0x56, 0xb6, - 0xa6, 0x77, 0x61, 0xfb, 0xe5, 0x3b, 0x0f, 0xc3, 0xa3, 0xbe, 0x5a, 0x12, 0x52, 0xd7, 0xa4, 0x54, - 0x0a, 0x5b, 0xe9, 0x0f, 0x7d, 0x00, 0x5b, 0x61, 0x34, 0x41, 0xa6, 0x96, 0x9b, 0xa4, 0xa5, 0x74, - 0x6a, 0x46, 0x62, 0xce, 0x18, 0x4c, 0x6c, 0x07, 0xa7, 0xe8, 0x71, 0x2b, 0x9a, 0x60, 0xb7, 0x1c, - 0xe7, 0x5b, 0x49, 0x24, 0xbd, 0x0d, 0xd5, 0x13, 0x77, 0xec, 0xd9, 0x3c, 0x0a, 0x51, 0xdd, 0x8a, - 0xf5, 0xad, 0x1c, 0xa0, 0x8f, 0xa1, 0x7c, 0x8c, 0xdc, 0x56, 0x87, 0x42, 0x4f, 0x33, 0xd2, 0xe6, - 0x48, 0xa3, 0x31, 0xf7, 0x1c, 0xed, 0x53, 0x0c, 0xbb, 0x3b, 0xb1, 0xe8, 0xf9, 0xa2, 0x41, 0x2c, - 0x91, 0x41, 0xfb, 0x50, 0x79, 0x25, 0x7a, 0xa2, 0x3a, 0x22, 0x57, 0x5f, 0xcf, 0x15, 0xac, 0xeb, - 0xd8, 0xdc, 0xf5, 0xbd, 0x0b, 0x1a, 0x32, 0x57, 0xbf, 0x0f, 0x8a, 0x28, 0x2b, 0x0b, 0x7c, 0x8f, - 0x21, 0xbd, 0x03, 0xa5, 0x5e, 0x56, 0x51, 0x45, 0x96, 0x21, 0x86, 0xac, 0xf8, 0xa3, 0x7f, 0x22, - 0xf0, 0x5f, 0x1f, 0x27, 0xc8, 0x31, 0x6d, 0xc4, 0xef, 0x13, 0x56, 0xcd, 0x6f, 0xfe, 0x6b, 0xe6, - 0xaf, 0xc3, 0xff, 0xa9, 0x9b, 0xc4, 0xbf, 0xfe, 0x81, 0x00, 0x1c, 0x22, 0xff, 0x4b, 0x77, 0x57, - 0x7d, 0xfe, 0x67, 0xa0, 0x88, 0xc3, 0xca, 0xe6, 0x75, 0xa0, 0xda, 0x4b, 0xe7, 0x52, 0x9c, 0x59, - 0xe9, 0xec, 0x19, 0xd9, 0xa4, 0x1a, 0x19, 0x67, 0xe5, 0x61, 0xfa, 0x47, 0x02, 0xca, 0x0b, 0x97, - 0x65, 0x8e, 0x0b, 0xb3, 0x40, 0xfe, 0x30, 0x0b, 0x57, 0xed, 0xbe, 0x0d, 0xbb, 0xc9, 0xc9, 0xd7, - 0xef, 0x6e, 0xe9, 0xb2, 0x66, 0x75, 0x7e, 0x10, 0xd8, 0x3e, 0x49, 0xb6, 0xa1, 0x07, 0x50, 0x1a, - 0x44, 0x9c, 0xd6, 0x0a, 0xd5, 0xc9, 0x1f, 0x17, 0xed, 0xe6, 0x3a, 0x2c, 0x37, 0x78, 0x02, 0x95, - 0xe4, 0xba, 0x50, 0xb5, 0x10, 0xb1, 0x32, 0x0f, 0xda, 0xad, 0x4b, 0x18, 0x99, 0x7e, 0x00, 0xa5, - 0x43, 0x5c, 0xdd, 0x34, 0xbf, 0x6a, 0x2b, 0x9b, 0x16, 0x9b, 0xfa, 0x08, 0xca, 0xb1, 0x4b, 0x5a, - 0xe4, 0x0b, 0x0d, 0xd3, 0xf6, 0x2f, 0xe0, 0x49, 0x62, 0xf7, 0xe9, 0xd9, 0xb2, 0x4e, 0xce, 0x97, - 0x75, 0xf2, 0x65, 0x59, 0x27, 0xdf, 0x96, 0x75, 0xf2, 0xfe, 0x7b, 0x7d, 0xe3, 0xf5, 0xaf, 0x9e, - 0x68, 0x7f, 0xc4, 0xda, 0xc9, 0xa3, 0x9b, 0xc9, 0x0d, 0x2b, 0x02, 0x78, 0xf8, 0x33, 0x00, 0x00, - 0xff, 0xff, 0xd2, 0x95, 0x12, 0x0c, 0x3c, 0x06, 0x00, 0x00, + // 562 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x54, 0xcd, 0x6e, 0xd3, 0x4c, + 0x14, 0xed, 0x34, 0xf9, 0xd2, 0xe6, 0xba, 0x1f, 0x3f, 0xa3, 0x86, 0x1a, 0x4b, 0x24, 0x91, 0x57, + 0x01, 0x11, 0x5b, 0x84, 0x4a, 0xb0, 0x41, 0x82, 0x24, 0x52, 0xa9, 0x44, 0x45, 0x64, 0x24, 0x16, + 0xec, 0x1c, 0xf7, 0x26, 0x58, 0x72, 0x6c, 0xe3, 0x19, 0x07, 0xe5, 0x4d, 0x78, 0x07, 0x24, 0xb6, + 0xf0, 0x08, 0x5d, 0x76, 0x89, 0x58, 0x44, 0x28, 0xac, 0x79, 0x07, 0xe4, 0xf1, 0xf8, 0x27, 0x69, + 0x81, 0x65, 0xc5, 0xc6, 0x9a, 0x39, 0xe7, 0x9e, 0x3b, 0xf7, 0xdc, 0xb9, 0x1e, 0x38, 0x70, 0x02, + 0x9f, 0xdb, 0xae, 0x8f, 0x91, 0xc9, 0x30, 0x9a, 0xbb, 0x0e, 0x1a, 0x61, 0x14, 0xf0, 0x80, 0xd6, + 0x73, 0x42, 0xa3, 0x92, 0x31, 0x67, 0xc8, 0xed, 0x94, 0xd6, 0xf6, 0x33, 0x6c, 0x8e, 0x91, 0x3b, + 0x59, 0x48, 0xb4, 0x51, 0x64, 0xe3, 0x8b, 0x10, 0x99, 0x84, 0xef, 0x4d, 0x5d, 0xfe, 0x36, 0x1e, + 0x1b, 0x4e, 0x30, 0x33, 0x7d, 0x16, 0x3a, 0x4e, 0xf7, 0x14, 0xe7, 0xa6, 0x8f, 0x7c, 0x66, 0x87, + 0x26, 0x43, 0x0f, 0x1d, 0x1e, 0x44, 0x32, 0xb6, 0x5b, 0x8a, 0x9d, 0x06, 0xd3, 0xc0, 0x14, 0xf0, + 0x38, 0x9e, 0x88, 0x9d, 0xd8, 0x88, 0x55, 0x1a, 0xae, 0x7f, 0xde, 0x06, 0x18, 0xc5, 0xdc, 0xc2, + 0x77, 0x31, 0x32, 0x4e, 0x4d, 0xa8, 0x9f, 0x20, 0x63, 0xf6, 0x14, 0x8f, 0x87, 0x2a, 0x69, 0x93, + 0xce, 0x5e, 0xff, 0xe6, 0xd9, 0xb2, 0xb5, 0xf5, 0x6d, 0xd9, 0x2a, 0x08, 0xab, 0x58, 0x52, 0x0d, + 0x76, 0x07, 0x76, 0x68, 0x3b, 0x2e, 0x5f, 0xa8, 0xdb, 0x6d, 0xd2, 0xa9, 0x5a, 0xf9, 0x9e, 0xde, + 0x85, 0x9d, 0x97, 0xef, 0x7d, 0x8c, 0x8e, 0x87, 0x6a, 0x45, 0xa4, 0xba, 0x2e, 0x53, 0x65, 0xb0, + 0x95, 0x2d, 0xe8, 0x03, 0xf8, 0x2f, 0x8a, 0x3d, 0x64, 0x6a, 0xb5, 0x4d, 0x3a, 0x4a, 0xaf, 0x61, + 0xa4, 0xe6, 0x8c, 0x91, 0x67, 0x3b, 0x38, 0x43, 0x9f, 0x5b, 0xb1, 0x87, 0xfd, 0x6a, 0xa2, 0xb7, + 0xd2, 0x48, 0xfa, 0x18, 0xaa, 0x27, 0xc8, 0x6d, 0x75, 0x2c, 0x14, 0x9a, 0x91, 0xb5, 0x5f, 0x5a, + 0x49, 0xb8, 0xe7, 0x68, 0x9f, 0x62, 0xd4, 0xdf, 0x4d, 0x64, 0xe7, 0xcb, 0x16, 0xb1, 0x84, 0x82, + 0x0e, 0xa1, 0xf6, 0x5a, 0x74, 0x5d, 0x75, 0x84, 0x56, 0xdf, 0xd4, 0x0a, 0xd6, 0x75, 0x6c, 0xee, + 0x06, 0xfe, 0x85, 0x1c, 0x52, 0xab, 0xdf, 0x07, 0x45, 0x34, 0x8e, 0x85, 0x81, 0xcf, 0x90, 0xde, + 0x81, 0xca, 0x20, 0xef, 0x99, 0x22, 0x8d, 0x26, 0x90, 0x95, 0x7c, 0xf4, 0x4f, 0x04, 0xfe, 0x1f, + 0xa2, 0x87, 0x1c, 0xb3, 0x56, 0xff, 0x59, 0x70, 0xe5, 0xf6, 0x6e, 0xc0, 0xb5, 0xac, 0xde, 0xd4, + 0xa1, 0xfe, 0x91, 0x00, 0x1c, 0x21, 0xff, 0x47, 0xea, 0x7f, 0x06, 0x8a, 0x28, 0x56, 0x5e, 0x4f, + 0x0f, 0xea, 0x83, 0xec, 0xdf, 0x12, 0x35, 0x2b, 0xbd, 0x7d, 0x23, 0xff, 0xdb, 0x8c, 0x9c, 0xb3, + 0x8a, 0x30, 0xfd, 0x0b, 0x01, 0xe5, 0x85, 0xcb, 0x72, 0xc7, 0xa5, 0x79, 0x26, 0x7f, 0x99, 0xe7, + 0xab, 0x76, 0xdf, 0x85, 0xbd, 0xb4, 0xf2, 0xcd, 0xe9, 0xac, 0x5c, 0x76, 0x59, 0xbd, 0x9f, 0x04, + 0x76, 0x5e, 0xa5, 0xc7, 0xd0, 0x43, 0xa8, 0x8c, 0x62, 0x4e, 0x1b, 0xa5, 0xee, 0x14, 0x0f, 0x84, + 0x76, 0x6b, 0x13, 0x96, 0x07, 0x3c, 0x81, 0x5a, 0x3a, 0x2e, 0x54, 0x2d, 0x45, 0xac, 0x4d, 0xbc, + 0x76, 0xfb, 0x12, 0x46, 0xca, 0x0f, 0xa1, 0x72, 0x84, 0xeb, 0x87, 0x16, 0xa3, 0xb6, 0x76, 0x68, + 0xf9, 0x52, 0x1f, 0x41, 0x35, 0x71, 0x49, 0xcb, 0x7c, 0xe9, 0xc2, 0xb4, 0x83, 0x0b, 0x78, 0x2a, + 0xec, 0x3f, 0x3d, 0x5b, 0x35, 0xc9, 0xf9, 0xaa, 0x49, 0xbe, 0xae, 0x9a, 0xe4, 0xfb, 0xaa, 0x49, + 0x3e, 0xfc, 0x68, 0x6e, 0xbd, 0xf9, 0xdd, 0x33, 0x1b, 0x4c, 0x58, 0x37, 0x7d, 0x38, 0xf3, 0x74, + 0xe3, 0x9a, 0x00, 0x1e, 0xfe, 0x0a, 0x00, 0x00, 0xff, 0xff, 0x36, 0x72, 0xbd, 0x89, 0x00, 0x06, + 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -690,13 +671,6 @@ func (m *PutRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x6 i-- dAtA[i] = 0x92 - if len(m.Signature) > 0 { - i -= len(m.Signature) - copy(dAtA[i:], m.Signature) - i = encodeVarintService(dAtA, i, uint64(len(m.Signature))) - i-- - dAtA[i] = 0x2a - } { size, err := m.Rules.MarshalToSizedBuffer(dAtA[:i]) if err != nil { @@ -820,13 +794,6 @@ func (m *DeleteRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x6 i-- dAtA[i] = 0x92 - if len(m.Signature) > 0 { - i -= len(m.Signature) - copy(dAtA[i:], m.Signature) - i = encodeVarintService(dAtA, i, uint64(len(m.Signature))) - i-- - dAtA[i] = 0x12 - } { size := m.CID.Size() i -= size @@ -1095,10 +1062,6 @@ func (m *PutRequest) Size() (n int) { n += 1 + l + sovService(uint64(l)) l = m.Rules.Size() n += 1 + l + sovService(uint64(l)) - l = len(m.Signature) - if l > 0 { - n += 1 + l + sovService(uint64(l)) - } l = m.RequestMetaHeader.Size() n += 2 + l + sovService(uint64(l)) l = m.RequestVerificationHeader.Size() @@ -1131,10 +1094,6 @@ func (m *DeleteRequest) Size() (n int) { _ = l l = m.CID.Size() n += 1 + l + sovService(uint64(l)) - l = len(m.Signature) - if l > 0 { - n += 1 + l + sovService(uint64(l)) - } l = m.RequestMetaHeader.Size() n += 2 + l + sovService(uint64(l)) l = m.RequestVerificationHeader.Size() @@ -1380,40 +1339,6 @@ func (m *PutRequest) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Signature", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Signature = append(m.Signature[:0], dAtA[iNdEx:postIndex]...) - if m.Signature == nil { - m.Signature = []byte{} - } - iNdEx = postIndex case 98: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType) @@ -1654,40 +1579,6 @@ func (m *DeleteRequest) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Signature", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Signature = append(m.Signature[:0], dAtA[iNdEx:postIndex]...) - if m.Signature == nil { - m.Signature = []byte{} - } - iNdEx = postIndex case 98: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType) diff --git a/container/service.proto b/container/service.proto index d4d50ca..8a3f56c 100644 --- a/container/service.proto +++ b/container/service.proto @@ -41,9 +41,6 @@ message PutRequest { // Rules define storage policy for the object inside the container. netmap.PlacementRule rules = 4 [(gogoproto.nullable) = false]; - // Signature of the user (owner id) - bytes Signature = 5; - // RequestMetaHeader contains information about request meta headers (should be embedded into message) service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) @@ -59,9 +56,6 @@ message DeleteRequest { // CID (container id) is a SHA256 hash of the container structure bytes CID = 1 [(gogoproto.customtype) = "CID", (gogoproto.nullable) = false]; - // Signature of the container owner - bytes Signature = 2; - // RequestMetaHeader contains information about request meta headers (should be embedded into message) service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) From 7099e2083edd7e8c1249e0cb9348582bbf540cf3 Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Tue, 26 Nov 2019 15:54:40 +0300 Subject: [PATCH 0047/1196] docs: regenerate documentation --- docs/accounting.md | 2 -- docs/container.md | 2 -- 2 files changed, 4 deletions(-) diff --git a/docs/accounting.md b/docs/accounting.md index 268a187..bcae136 100644 --- a/docs/accounting.md +++ b/docs/accounting.md @@ -362,7 +362,6 @@ Delete allows user to remove unused cheque | ID | [bytes](#bytes) | | ID is cheque identifier | | OwnerID | [bytes](#bytes) | | OwnerID is a wallet address | | MessageID | [bytes](#bytes) | | MessageID is a nonce for uniq request (UUIDv4) | -| Signature | [bytes](#bytes) | | Signature is a signature of the sent request | | Meta | [service.RequestMetaHeader](#service.RequestMetaHeader) | | RequestMetaHeader contains information about request meta headers (should be embedded into message) | | Verify | [service.RequestVerificationHeader](#service.RequestVerificationHeader) | | RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) | @@ -450,7 +449,6 @@ DeleteResponse is empty | Amount | [decimal.Decimal](#decimal.Decimal) | | Amount of funds | | Height | [uint64](#uint64) | | Height is the neo blockchain height until the cheque is valid | | MessageID | [bytes](#bytes) | | MessageID is a nonce for uniq request (UUIDv4) | -| Signature | [bytes](#bytes) | | Signature is a signature of the sent request | | Meta | [service.RequestMetaHeader](#service.RequestMetaHeader) | | RequestMetaHeader contains information about request meta headers (should be embedded into message) | | Verify | [service.RequestVerificationHeader](#service.RequestVerificationHeader) | | RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) | diff --git a/docs/container.md b/docs/container.md index bc559ce..ef2ba19 100644 --- a/docs/container.md +++ b/docs/container.md @@ -92,7 +92,6 @@ List returns all user's containers | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | | CID | [bytes](#bytes) | | CID (container id) is a SHA256 hash of the container structure | -| Signature | [bytes](#bytes) | | Signature of the container owner | | Meta | [service.RequestMetaHeader](#service.RequestMetaHeader) | | RequestMetaHeader contains information about request meta headers (should be embedded into message) | | Verify | [service.RequestVerificationHeader](#service.RequestVerificationHeader) | | RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) | @@ -165,7 +164,6 @@ via consensus in inner ring nodes | Capacity | [uint64](#uint64) | | Capacity defines amount of data that can be stored in the container (doesn't used for now). | | OwnerID | [bytes](#bytes) | | OwnerID is a wallet address | | rules | [netmap.PlacementRule](#netmap.PlacementRule) | | Rules define storage policy for the object inside the container. | -| Signature | [bytes](#bytes) | | Signature of the user (owner id) | | Meta | [service.RequestMetaHeader](#service.RequestMetaHeader) | | RequestMetaHeader contains information about request meta headers (should be embedded into message) | | Verify | [service.RequestVerificationHeader](#service.RequestVerificationHeader) | | RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) | From ac44e4bb9fa1e1adf7026f190cf08b37a3bb85b5 Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Tue, 26 Nov 2019 15:48:55 +0300 Subject: [PATCH 0048/1196] service: get rid of bytefmt - add ByteSize type + Stringer - add test coverage - cleanup modules closes #22 --- go.mod | 5 +---- go.sum | 20 ++---------------- object/utils.go | 35 ++++++++++++++++++++++++++++++-- object/utils_test.go | 48 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 84 insertions(+), 24 deletions(-) create mode 100644 object/utils_test.go diff --git a/go.mod b/go.mod index 06fb5c0..dc07a30 100644 --- a/go.mod +++ b/go.mod @@ -3,16 +3,13 @@ module github.com/nspcc-dev/neofs-proto go 1.13 require ( - code.cloudfoundry.org/bytefmt v0.0.0-20190819182555-854d396b647c github.com/gogo/protobuf v1.3.1 github.com/golang/protobuf v1.3.2 github.com/google/uuid v1.1.1 - github.com/mr-tron/base58 v1.1.2 + github.com/mr-tron/base58 v1.1.3 github.com/nspcc-dev/neofs-crypto v0.2.2 github.com/nspcc-dev/netmap v1.6.1 github.com/nspcc-dev/tzhash v1.3.0 - github.com/onsi/ginkgo v1.10.2 // indirect - github.com/onsi/gomega v1.7.0 // indirect github.com/pkg/errors v0.8.1 github.com/prometheus/client_golang v1.2.1 github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4 diff --git a/go.sum b/go.sum index f06a499..13842ce 100644 --- a/go.sum +++ b/go.sum @@ -1,6 +1,4 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -code.cloudfoundry.org/bytefmt v0.0.0-20190819182555-854d396b647c h1:2RuXx1+tSNWRjxhY0Bx52kjV2odJQ0a6MTbfTPhGAkg= -code.cloudfoundry.org/bytefmt v0.0.0-20190819182555-854d396b647c/go.mod h1:wN/zk7mhREp/oviagqUXY3EwuHhWyOvAdsn5Y4CzOrc= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/abiosoft/ishell v2.0.0+incompatible/go.mod h1:HQR9AqF2R3P4XXpMpI0NAzgHf/aS6+zVXRj14cVk9qg= github.com/abiosoft/readline v0.0.0-20180607040430-155bce2042db/go.mod h1:rB3B4rKii8V21ydCbIzH5hZiCQE7f5E9SzUb/ZZx530= @@ -25,8 +23,6 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/flynn-archive/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:rZfgFAXFS/z/lEd6LJmf9HVZ1LkgYiHx5pHhV5DR16M= -github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= -github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= @@ -49,8 +45,6 @@ github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= -github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= @@ -68,6 +62,8 @@ github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lN github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/mr-tron/base58 v1.1.2 h1:ZEw4I2EgPKDJ2iEw0cNmLB3ROrEmkOtXIkaG7wZg+78= github.com/mr-tron/base58 v1.1.2/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= +github.com/mr-tron/base58 v1.1.3 h1:v+sk57XuaCKGXpWtVBX8YJzO7hMGx4Aajh4TQbdEFdc= +github.com/mr-tron/base58 v1.1.3/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/nspcc-dev/hrw v1.0.8 h1:vwRuJXZXgkMvf473vFzeWGCfY1WBVeSHAEHvR4u3/Cg= github.com/nspcc-dev/hrw v1.0.8/go.mod h1:l/W2vx83vMQo6aStyx2AuZrJ+07lGv2JQGlVkPG06MU= @@ -79,11 +75,6 @@ github.com/nspcc-dev/rfc6979 v0.1.0 h1:Lwg7esRRoyK1Up/IN1vAef1EmvrBeMHeeEkek2fAJ github.com/nspcc-dev/rfc6979 v0.1.0/go.mod h1:exhIh1PdpDC5vQmyEsGvc4YDM/lyQp/452QxGq/UEso= github.com/nspcc-dev/tzhash v1.3.0 h1:n6FTHsfPYbMi5Jmo6SwGVVRQD8i2w1P2ScCaW6rz69Q= github.com/nspcc-dev/tzhash v1.3.0/go.mod h1:Lc4DersKS8MNIrunTmsAzANO56qnG+LZ4GOE/WYGVzU= -github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.10.2 h1:uqH7bpe+ERSiDa34FDOF7RikN6RzXgduUF8yarlZp94= -github.com/onsi/ginkgo v1.10.2/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/gomega v1.7.0 h1:XPnZz8VVBHjVsy1vzJmRwIcSwiUO+JFfrv/xGiigmME= -github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= @@ -119,7 +110,6 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550 h1:ObdrDkeb4kJdCP557AjRjq69pTHfNouLtWZG7j9rPN8= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3 h1:0GoQqolDA55aaLxZyTzK/Y2ePZzZTUrRacwib7cNsYQ= @@ -127,12 +117,10 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190613194153-d28f0bde5980 h1:dfGZHvZk057jK2MCeWus/TowKpJ8y4AmooUzdBSR9GU= golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181228144115-9a3f9b0469bb/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -155,10 +143,6 @@ gopkg.in/abiosoft/ishell.v2 v2.0.0/go.mod h1:sFp+cGtH6o4s1FtpVPTMcHq2yue+c4DGOVo gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= -gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/object/utils.go b/object/utils.go index c0fb624..fab7fcc 100644 --- a/object/utils.go +++ b/object/utils.go @@ -2,12 +2,43 @@ package object import ( "io" + "strconv" - "code.cloudfoundry.org/bytefmt" "github.com/nspcc-dev/neofs-proto/session" "github.com/pkg/errors" ) +// ByteSize used to format bytes +type ByteSize uint64 + +// String represents ByteSize in string format +func (b ByteSize) String() string { + var ( + dec int64 + unit string + num = int64(b) + ) + + switch { + case num > UnitsTB: + unit = "TB" + dec = UnitsTB + case num > UnitsGB: + unit = "GB" + dec = UnitsGB + case num > UnitsMB: + unit = "MB" + dec = UnitsMB + case num > UnitsKB: + unit = "KB" + dec = UnitsKB + case num > UnitsB: + dec = 1 + } + + return strconv.FormatFloat(float64(num)/float64(dec), 'g', 6, 64) + unit +} + // MakePutRequestHeader combines object and session token value // into header of object put request. func MakePutRequestHeader(obj *Object, token *session.Token) *PutRequest { @@ -26,7 +57,7 @@ func MakePutRequestChunk(chunk []byte) *PutRequest { } func errMaxSizeExceeded(size uint64) error { - return errors.Errorf("object payload size exceed: %s", bytefmt.ByteSize(size)) + return errors.Errorf("object payload size exceed: %s", ByteSize(size).String()) } // ReceiveGetResponse receives object by chunks from the protobuf stream diff --git a/object/utils_test.go b/object/utils_test.go new file mode 100644 index 0000000..a3f0162 --- /dev/null +++ b/object/utils_test.go @@ -0,0 +1,48 @@ +package object + +import ( + "testing" + + "github.com/stretchr/testify/require" +) + +func TestByteSize_String(t *testing.T) { + var cases = []struct { + name string + expect string + actual ByteSize + }{ + { + name: "101 bytes", + expect: "101", + actual: ByteSize(101), + }, + { + name: "112.84KB", + expect: "112.84KB", + actual: ByteSize(115548), + }, + { + name: "80.44MB", + expect: "80.44MB", + actual: ByteSize(84347453), + }, + { + name: "905.144GB", + expect: "905.144GB", + actual: ByteSize(971891061884), + }, + { + name: "1.857TB", + expect: "1.857TB", + actual: ByteSize(2041793092780), + }, + } + + for i := range cases { + tt := cases[i] + t.Run(tt.name, func(t *testing.T) { + require.Equal(t, tt.expect, tt.actual.String()) + }) + } +} From b4df24aab9ddc62cb6dfcc3cf4b1210def1251b5 Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Thu, 28 Nov 2019 20:22:34 +0300 Subject: [PATCH 0049/1196] CHANGELOG --- CHANGELOG.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2e7736d..a3f3c8c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,22 @@ # Changelog This is the changelog for NeoFS Proto +## [0.2.3] - 2019-11-28 + +### Removed +- service: SignRequest / VerifyRequest and accompanying code +- proto: Signature field from requests +- object: bytefmt package not used anymore + +### Changed +- service: rename EpochRequest to EpochHeader and merge with MetaHeader +- service: get status error even if it is wrapped + +### Added +- service: RequestVerificationHeader's method to validate owner +- service: test coverage for CheckOwner +- service: test coverage for wrapped status errors + ## [0.2.2] - 2019-11-22 ### Changed @@ -33,3 +49,4 @@ Initial public release [0.2.0]: https://github.com/nspcc-dev/neofs-proto/compare/v0.1.0...v0.2.0 [0.2.1]: https://github.com/nspcc-dev/neofs-proto/compare/v0.2.0...v0.2.1 [0.2.2]: https://github.com/nspcc-dev/neofs-proto/compare/v0.2.1...v0.2.2 +[0.2.3]: https://github.com/nspcc-dev/neofs-proto/compare/v0.2.2...v0.2.3 From 0fce8a6ba2b6750751d7928a5f0d57e76afebc23 Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Mon, 2 Dec 2019 17:56:06 +0300 Subject: [PATCH 0050/1196] proto: publish sg lib, rewrite object --- docs/object.md | 42 +-- docs/storagegroup.md | 88 ++++++ object/extensions.go | 15 +- object/sg.go | 43 +-- object/sg_test.go | 5 +- object/types.pb.go | 633 ++++--------------------------------- object/types.proto | 47 +-- storagegroup/storage.go | 39 +++ storagegroup/types.go | 97 ++++++ storagegroup/types.pb.go | 663 +++++++++++++++++++++++++++++++++++++++ storagegroup/types.proto | 35 +++ 11 files changed, 1011 insertions(+), 696 deletions(-) create mode 100644 docs/storagegroup.md create mode 100644 storagegroup/storage.go create mode 100644 storagegroup/types.go create mode 100644 storagegroup/types.pb.go create mode 100644 storagegroup/types.proto diff --git a/docs/object.md b/docs/object.md index 8407733..9e7efe6 100644 --- a/docs/object.md +++ b/docs/object.md @@ -34,8 +34,6 @@ - [Link](#object.Link) - [Object](#object.Object) - [Range](#object.Range) - - [StorageGroup](#object.StorageGroup) - - [StorageGroup.Lifetime](#object.StorageGroup.Lifetime) - [SystemHeader](#object.SystemHeader) - [Tombstone](#object.Tombstone) - [Transform](#object.Transform) @@ -369,7 +367,7 @@ in distributed system. | HomoHash | [bytes](#bytes) | | HomoHash is a homomorphic hash of original object payload | | PayloadChecksum | [bytes](#bytes) | | PayloadChecksum of actual object's payload | | Integrity | [IntegrityHeader](#object.IntegrityHeader) | | Integrity header with checksum of all above headers in the object | -| StorageGroup | [StorageGroup](#object.StorageGroup) | | StorageGroup contains meta information for the data audit | +| StorageGroup | [storagegroup.StorageGroup](#storagegroup.StorageGroup) | | StorageGroup contains meta information for the data audit | @@ -421,31 +419,6 @@ in distributed system. | Length | [uint64](#uint64) | | Length of the data range | - - -### Message StorageGroup - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| ValidationDataSize | [uint64](#uint64) | | ValidationDataSize is size of the all object's payloads included into storage group | -| ValidationHash | [bytes](#bytes) | | ValidationHash is homomorphic hash of all object's payloads included into storage group | -| lifetime | [StorageGroup.Lifetime](#object.StorageGroup.Lifetime) | | Lifetime is time until storage group is valid | - - - - -### Message StorageGroup.Lifetime - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| unit | [StorageGroup.Lifetime.Unit](#object.StorageGroup.Lifetime.Unit) | | Unit is lifetime type | -| Value | [int64](#int64) | | Value for lifetime | - - ### Message SystemHeader @@ -514,19 +487,6 @@ in distributed system. - - -### StorageGroup.Lifetime.Unit - - -| Name | Number | Description | -| ---- | ------ | ----------- | -| Unlimited | 0 | Unlimited set if storage group always valid | -| NeoFSEpoch | 1 | NeoFSEpoch set if storage group is valid until lifetime NeoFS epoch | -| UnixTime | 2 | UnixTime set if storage group is valid until lifetime unix timestamp | - - - ### Transform.Type diff --git a/docs/storagegroup.md b/docs/storagegroup.md new file mode 100644 index 0000000..7522902 --- /dev/null +++ b/docs/storagegroup.md @@ -0,0 +1,88 @@ +# Protocol Documentation + + +## Table of Contents + +- [storagegroup/types.proto](#storagegroup/types.proto) + + - Messages + - [StorageGroup](#storagegroup.StorageGroup) + - [StorageGroup.Lifetime](#storagegroup.StorageGroup.Lifetime) + + +- [Scalar Value Types](#scalar-value-types) + + + + +

Top

+ +## storagegroup/types.proto + + + + + + + +### Message StorageGroup + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| ValidationDataSize | [uint64](#uint64) | | ValidationDataSize is size of the all object's payloads included into storage group | +| ValidationHash | [bytes](#bytes) | | ValidationHash is homomorphic hash of all object's payloads included into storage group | +| lifetime | [StorageGroup.Lifetime](#storagegroup.StorageGroup.Lifetime) | | Lifetime is time until storage group is valid | + + + + +### Message StorageGroup.Lifetime + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| unit | [StorageGroup.Lifetime.Unit](#storagegroup.StorageGroup.Lifetime.Unit) | | Unit is lifetime type | +| Value | [int64](#int64) | | Value for lifetime | + + + + + + +### StorageGroup.Lifetime.Unit + + +| Name | Number | Description | +| ---- | ------ | ----------- | +| Unlimited | 0 | Unlimited set if storage group always valid | +| NeoFSEpoch | 1 | NeoFSEpoch set if storage group is valid until lifetime NeoFS epoch | +| UnixTime | 2 | UnixTime set if storage group is valid until lifetime unix timestamp | + + + + + + +## Scalar Value Types + +| .proto Type | Notes | C++ Type | Java Type | Python Type | +| ----------- | ----- | -------- | --------- | ----------- | +| double | | double | double | float | +| float | | float | float | float | +| int32 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint32 instead. | int32 | int | int | +| int64 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint64 instead. | int64 | long | int/long | +| uint32 | Uses variable-length encoding. | uint32 | int | int/long | +| uint64 | Uses variable-length encoding. | uint64 | long | int/long | +| sint32 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s. | int32 | int | int | +| sint64 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s. | int64 | long | int/long | +| fixed32 | Always four bytes. More efficient than uint32 if values are often greater than 2^28. | uint32 | int | int | +| fixed64 | Always eight bytes. More efficient than uint64 if values are often greater than 2^56. | uint64 | long | int/long | +| sfixed32 | Always four bytes. | int32 | int | int | +| sfixed64 | Always eight bytes. | int64 | long | int/long | +| bool | | bool | boolean | boolean | +| string | A string must always contain UTF-8 encoded or 7-bit ASCII text. | string | String | str/unicode | +| bytes | May contain any arbitrary sequence of bytes. | string | ByteString | str | + diff --git a/object/extensions.go b/object/extensions.go index 1d89683..7427079 100644 --- a/object/extensions.go +++ b/object/extensions.go @@ -1,8 +1,6 @@ package object -import ( - "github.com/nspcc-dev/neofs-proto/hash" -) +import "github.com/nspcc-dev/neofs-proto/storagegroup" // IsLinking checks if object has children links to another objects. // We have to check payload size because zero-object must have zero @@ -64,7 +62,7 @@ func (m Object) IsTombstone() bool { } // StorageGroup returns storage group structure if it is presented in extended headers. -func (m Object) StorageGroup() (*StorageGroup, error) { +func (m Object) StorageGroup() (*storagegroup.StorageGroup, error) { _, sgHdr := m.LastHeader(HeaderType(StorageGroupHdr)) if sgHdr == nil { return nil, ErrHeaderNotFound @@ -74,11 +72,6 @@ func (m Object) StorageGroup() (*StorageGroup, error) { // SetStorageGroup sets storage group header in the object. // It will replace existing storage group header or add a new one. -func (m *Object) SetStorageGroup(sg *StorageGroup) { - m.SetHeader(&Header{Value: &Header_StorageGroup{StorageGroup: sg}}) -} - -// Empty checks if storage group has some data for validation. -func (m StorageGroup) Empty() bool { - return m.ValidationDataSize == 0 && m.ValidationHash.Equal(hash.Hash{}) +func (m *Object) SetStorageGroup(group *storagegroup.StorageGroup) { + m.SetHeader(&Header{Value: &Header_StorageGroup{StorageGroup: group}}) } diff --git a/object/sg.go b/object/sg.go index 1b48b3e..620d24d 100644 --- a/object/sg.go +++ b/object/sg.go @@ -1,54 +1,31 @@ package object import ( - "bytes" "sort" + + "github.com/nspcc-dev/neofs-proto/refs" + "github.com/nspcc-dev/neofs-proto/storagegroup" ) // Here are defined getter functions for objects that contain storage group // information. -type ( - // IDList is a slice of object ids, that can be sorted. - IDList []ID - - // ZoneInfo provides validation info of storage group. - ZoneInfo struct { - Hash - Size uint64 - } - - // IdentificationInfo provides meta information about storage group. - IdentificationInfo struct { - SGID - CID - OwnerID - } -) - -// Len returns amount of object ids in IDList. -func (s IDList) Len() int { return len(s) } - -// Less returns byte comparision between IDList[i] and IDList[j]. -func (s IDList) Less(i, j int) bool { return bytes.Compare(s[i].Bytes(), s[j].Bytes()) == -1 } - -// Swap swaps element with i and j index in IDList. -func (s IDList) Swap(i, j int) { s[i], s[j] = s[j], s[i] } +var _ storagegroup.Provider = (*Object)(nil) // Group returns slice of object ids that are part of a storage group. -func (m *Object) Group() []ID { +func (m *Object) Group() []refs.ObjectID { sgLinks := m.Links(Link_StorageGroup) - sort.Sort(IDList(sgLinks)) + sort.Sort(storagegroup.IDList(sgLinks)) return sgLinks } // Zones returns validation zones of storage group. -func (m *Object) Zones() []ZoneInfo { +func (m *Object) Zones() []storagegroup.ZoneInfo { sgInfo, err := m.StorageGroup() if err != nil { return nil } - return []ZoneInfo{ + return []storagegroup.ZoneInfo{ { Hash: sgInfo.ValidationHash, Size: sgInfo.ValidationDataSize, @@ -57,8 +34,8 @@ func (m *Object) Zones() []ZoneInfo { } // IDInfo returns meta information about storage group. -func (m *Object) IDInfo() *IdentificationInfo { - return &IdentificationInfo{ +func (m *Object) IDInfo() *storagegroup.IdentificationInfo { + return &storagegroup.IdentificationInfo{ SGID: m.SystemHeader.ID, CID: m.SystemHeader.CID, OwnerID: m.SystemHeader.OwnerID, diff --git a/object/sg_test.go b/object/sg_test.go index 58e2042..15cc21b 100644 --- a/object/sg_test.go +++ b/object/sg_test.go @@ -6,6 +6,7 @@ import ( "testing" "github.com/nspcc-dev/neofs-proto/hash" + "github.com/nspcc-dev/neofs-proto/storagegroup" "github.com/stretchr/testify/require" ) @@ -28,7 +29,7 @@ func TestObject_StorageGroup(t *testing.T) { } rand.Shuffle(len(obj.Headers), func(i, j int) { obj.Headers[i], obj.Headers[j] = obj.Headers[j], obj.Headers[i] }) - sort.Sort(IDList(idList)) + sort.Sort(storagegroup.IDList(idList)) require.Equal(t, idList, obj.Group()) }) t.Run("identification method", func(t *testing.T) { @@ -58,7 +59,7 @@ func TestObject_StorageGroup(t *testing.T) { Headers: []Header{ { Value: &Header_StorageGroup{ - StorageGroup: &StorageGroup{ + StorageGroup: &storagegroup.StorageGroup{ ValidationDataSize: sgSize, ValidationHash: sgHash, }, diff --git a/object/types.pb.go b/object/types.pb.go index 217ef09..459e124 100644 --- a/object/types.pb.go +++ b/object/types.pb.go @@ -9,6 +9,7 @@ import ( proto "github.com/golang/protobuf/proto" refs "github.com/nspcc-dev/neofs-proto/refs" session "github.com/nspcc-dev/neofs-proto/session" + storagegroup "github.com/nspcc-dev/neofs-proto/storagegroup" io "io" math "math" math_bits "math/bits" @@ -101,37 +102,6 @@ func (Transform_Type) EnumDescriptor() ([]byte, []int) { return fileDescriptor_02021a1d39b1aee0, []int{8, 0} } -type StorageGroup_Lifetime_Unit int32 - -const ( - // Unlimited set if storage group always valid - StorageGroup_Lifetime_Unlimited StorageGroup_Lifetime_Unit = 0 - // NeoFSEpoch set if storage group is valid until lifetime NeoFS epoch - StorageGroup_Lifetime_NeoFSEpoch StorageGroup_Lifetime_Unit = 1 - // UnixTime set if storage group is valid until lifetime unix timestamp - StorageGroup_Lifetime_UnixTime StorageGroup_Lifetime_Unit = 2 -) - -var StorageGroup_Lifetime_Unit_name = map[int32]string{ - 0: "Unlimited", - 1: "NeoFSEpoch", - 2: "UnixTime", -} - -var StorageGroup_Lifetime_Unit_value = map[string]int32{ - "Unlimited": 0, - "NeoFSEpoch": 1, - "UnixTime": 2, -} - -func (x StorageGroup_Lifetime_Unit) String() string { - return proto.EnumName(StorageGroup_Lifetime_Unit_name, int32(x)) -} - -func (StorageGroup_Lifetime_Unit) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_02021a1d39b1aee0, []int{10, 0, 0} -} - type Range struct { // Offset of the data range Offset uint64 `protobuf:"varint,1,opt,name=Offset,proto3" json:"Offset,omitempty"` @@ -319,7 +289,7 @@ type Header_Integrity struct { Integrity *IntegrityHeader `protobuf:"bytes,9,opt,name=Integrity,proto3,oneof" json:"Integrity,omitempty"` } type Header_StorageGroup struct { - StorageGroup *StorageGroup `protobuf:"bytes,10,opt,name=StorageGroup,proto3,oneof" json:"StorageGroup,omitempty"` + StorageGroup *storagegroup.StorageGroup `protobuf:"bytes,10,opt,name=StorageGroup,proto3,oneof" json:"StorageGroup,omitempty"` } func (*Header_Link) isHeader_Value() {} @@ -396,7 +366,7 @@ func (m *Header) GetIntegrity() *IntegrityHeader { return nil } -func (m *Header) GetStorageGroup() *StorageGroup { +func (m *Header) GetStorageGroup() *storagegroup.StorageGroup { if x, ok := m.GetValue().(*Header_StorageGroup); ok { return x.StorageGroup } @@ -789,118 +759,9 @@ func (m *Object) GetPayload() []byte { return nil } -type StorageGroup struct { - // ValidationDataSize is size of the all object's payloads included into storage group - ValidationDataSize uint64 `protobuf:"varint,1,opt,name=ValidationDataSize,proto3" json:"ValidationDataSize,omitempty"` - // ValidationHash is homomorphic hash of all object's payloads included into storage group - ValidationHash Hash `protobuf:"bytes,2,opt,name=ValidationHash,proto3,customtype=Hash" json:"ValidationHash"` - // Lifetime is time until storage group is valid - Lifetime *StorageGroup_Lifetime `protobuf:"bytes,3,opt,name=lifetime,proto3" json:"lifetime,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *StorageGroup) Reset() { *m = StorageGroup{} } -func (m *StorageGroup) String() string { return proto.CompactTextString(m) } -func (*StorageGroup) ProtoMessage() {} -func (*StorageGroup) Descriptor() ([]byte, []int) { - return fileDescriptor_02021a1d39b1aee0, []int{10} -} -func (m *StorageGroup) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *StorageGroup) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *StorageGroup) XXX_Merge(src proto.Message) { - xxx_messageInfo_StorageGroup.Merge(m, src) -} -func (m *StorageGroup) XXX_Size() int { - return m.Size() -} -func (m *StorageGroup) XXX_DiscardUnknown() { - xxx_messageInfo_StorageGroup.DiscardUnknown(m) -} - -var xxx_messageInfo_StorageGroup proto.InternalMessageInfo - -func (m *StorageGroup) GetValidationDataSize() uint64 { - if m != nil { - return m.ValidationDataSize - } - return 0 -} - -func (m *StorageGroup) GetLifetime() *StorageGroup_Lifetime { - if m != nil { - return m.Lifetime - } - return nil -} - -type StorageGroup_Lifetime struct { - // Unit is lifetime type - Unit StorageGroup_Lifetime_Unit `protobuf:"varint,1,opt,name=unit,proto3,enum=object.StorageGroup_Lifetime_Unit" json:"unit,omitempty"` - // Value for lifetime - Value int64 `protobuf:"varint,2,opt,name=Value,proto3" json:"Value,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *StorageGroup_Lifetime) Reset() { *m = StorageGroup_Lifetime{} } -func (m *StorageGroup_Lifetime) String() string { return proto.CompactTextString(m) } -func (*StorageGroup_Lifetime) ProtoMessage() {} -func (*StorageGroup_Lifetime) Descriptor() ([]byte, []int) { - return fileDescriptor_02021a1d39b1aee0, []int{10, 0} -} -func (m *StorageGroup_Lifetime) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *StorageGroup_Lifetime) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *StorageGroup_Lifetime) XXX_Merge(src proto.Message) { - xxx_messageInfo_StorageGroup_Lifetime.Merge(m, src) -} -func (m *StorageGroup_Lifetime) XXX_Size() int { - return m.Size() -} -func (m *StorageGroup_Lifetime) XXX_DiscardUnknown() { - xxx_messageInfo_StorageGroup_Lifetime.DiscardUnknown(m) -} - -var xxx_messageInfo_StorageGroup_Lifetime proto.InternalMessageInfo - -func (m *StorageGroup_Lifetime) GetUnit() StorageGroup_Lifetime_Unit { - if m != nil { - return m.Unit - } - return StorageGroup_Lifetime_Unlimited -} - -func (m *StorageGroup_Lifetime) GetValue() int64 { - if m != nil { - return m.Value - } - return 0 -} - func init() { proto.RegisterEnum("object.Link_Type", Link_Type_name, Link_Type_value) proto.RegisterEnum("object.Transform_Type", Transform_Type_name, Transform_Type_value) - proto.RegisterEnum("object.StorageGroup_Lifetime_Unit", StorageGroup_Lifetime_Unit_name, StorageGroup_Lifetime_Unit_value) proto.RegisterType((*Range)(nil), "object.Range") proto.RegisterType((*UserHeader)(nil), "object.UserHeader") proto.RegisterType((*Header)(nil), "object.Header") @@ -911,77 +772,67 @@ func init() { proto.RegisterType((*Link)(nil), "object.Link") proto.RegisterType((*Transform)(nil), "object.Transform") proto.RegisterType((*Object)(nil), "object.Object") - proto.RegisterType((*StorageGroup)(nil), "object.StorageGroup") - proto.RegisterType((*StorageGroup_Lifetime)(nil), "object.StorageGroup.Lifetime") } func init() { proto.RegisterFile("object/types.proto", fileDescriptor_02021a1d39b1aee0) } var fileDescriptor_02021a1d39b1aee0 = []byte{ - // 996 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x55, 0xdf, 0x6e, 0xe3, 0xc4, - 0x17, 0xb6, 0x1d, 0x27, 0x71, 0x4e, 0xdd, 0xd6, 0x3b, 0xbf, 0xfd, 0x2d, 0x56, 0xd1, 0xb6, 0xc5, - 0xe2, 0x4f, 0x59, 0xa8, 0x2b, 0xda, 0x45, 0x2b, 0x90, 0x40, 0x34, 0x0d, 0x6c, 0x22, 0xca, 0xb6, - 0x9a, 0xb4, 0xbd, 0xe0, 0xce, 0x89, 0x27, 0xc9, 0xd0, 0x64, 0x26, 0xb2, 0x27, 0xbb, 0x1b, 0x1e, - 0x83, 0x1b, 0xb8, 0xe3, 0x75, 0xf6, 0x92, 0x3b, 0xd0, 0x5e, 0x44, 0x28, 0x3c, 0x00, 0x6f, 0x80, - 0xd0, 0x8c, 0xc7, 0x49, 0x9c, 0xad, 0xb8, 0x89, 0xe6, 0x9c, 0xef, 0xfb, 0x46, 0x27, 0xe7, 0x7c, - 0x67, 0x0c, 0x88, 0x77, 0x7e, 0x20, 0x5d, 0x71, 0x24, 0xa6, 0x63, 0x92, 0x86, 0xe3, 0x84, 0x0b, - 0x8e, 0x2a, 0x59, 0x6e, 0xc7, 0x4b, 0x48, 0x2f, 0x5d, 0x45, 0x76, 0xfe, 0x97, 0x92, 0x34, 0xa5, - 0x9c, 0x15, 0x92, 0x87, 0x7d, 0x2a, 0x06, 0x93, 0x4e, 0xd8, 0xe5, 0xa3, 0xa3, 0x3e, 0xef, 0xf3, - 0x23, 0x95, 0xee, 0x4c, 0x7a, 0x2a, 0x52, 0x81, 0x3a, 0x65, 0xf4, 0xe0, 0x09, 0x94, 0x71, 0xc4, - 0xfa, 0x04, 0x3d, 0x80, 0xca, 0x45, 0xaf, 0x97, 0x12, 0xe1, 0x9b, 0xfb, 0xe6, 0x81, 0x8d, 0x75, - 0x24, 0xf3, 0xe7, 0x84, 0xf5, 0xc5, 0xc0, 0xb7, 0xb2, 0x7c, 0x16, 0x05, 0x8f, 0x01, 0xae, 0x53, - 0x92, 0x34, 0x49, 0x14, 0x93, 0x04, 0x79, 0x50, 0xfa, 0x96, 0x4c, 0x95, 0xb4, 0x86, 0xe5, 0x11, - 0xdd, 0x87, 0xf2, 0x4d, 0x34, 0x9c, 0x10, 0x25, 0xab, 0xe1, 0x2c, 0x08, 0xfe, 0x29, 0x41, 0x45, - 0x4b, 0x02, 0xb0, 0xcf, 0x29, 0xbb, 0x55, 0x9a, 0x8d, 0x63, 0x37, 0xcc, 0xfe, 0x66, 0x28, 0x73, - 0x4d, 0x03, 0x2b, 0x0c, 0x7d, 0x04, 0x0e, 0x26, 0x31, 0x4d, 0x48, 0x57, 0xa8, 0x7b, 0x36, 0x8e, - 0x37, 0x43, 0xd9, 0x86, 0xf0, 0x34, 0x8e, 0x13, 0x92, 0xa6, 0x4d, 0x03, 0x2f, 0x08, 0xa8, 0x50, - 0x91, 0x5f, 0x52, 0x74, 0x94, 0x5f, 0xbb, 0x44, 0x9a, 0x06, 0x5e, 0xad, 0xfc, 0x13, 0xa8, 0x5d, - 0x25, 0x11, 0x4b, 0x7b, 0x3c, 0x19, 0xf9, 0xb6, 0x12, 0xdd, 0xcb, 0x45, 0x0b, 0xa0, 0x69, 0xe0, - 0x25, 0x4b, 0x49, 0xf8, 0xa8, 0x93, 0x0a, 0xce, 0x88, 0x5f, 0x5e, 0x93, 0xe4, 0x80, 0x92, 0xe4, - 0x01, 0xfa, 0x14, 0x2a, 0x37, 0x24, 0xa1, 0xbd, 0xa9, 0x5f, 0x51, 0xfc, 0xb7, 0x43, 0x3d, 0xbb, - 0x50, 0xa5, 0x69, 0x37, 0x12, 0x94, 0xb3, 0x45, 0x81, 0x9a, 0x8c, 0xde, 0x07, 0xa7, 0xc9, 0x47, - 0xbc, 0x19, 0xa5, 0x03, 0xbf, 0xba, 0x6f, 0x1e, 0xb8, 0x75, 0xe7, 0xf5, 0x6c, 0xcf, 0x96, 0xb1, - 0xfc, 0xeb, 0x39, 0x86, 0x1e, 0xc1, 0xf6, 0x65, 0x34, 0x1d, 0xf2, 0x28, 0x3e, 0x1b, 0x90, 0xee, - 0x6d, 0x3a, 0x19, 0xf9, 0x8e, 0xa4, 0x37, 0x0d, 0xbc, 0x0e, 0xa0, 0x27, 0x50, 0x6b, 0x31, 0x41, - 0xfa, 0x09, 0x15, 0x53, 0xbf, 0xa6, 0xaa, 0x79, 0x2b, 0xaf, 0x7e, 0x01, 0x2c, 0x2a, 0x59, 0x72, - 0xd1, 0xe7, 0xe0, 0xb6, 0x05, 0x4f, 0xa2, 0x3e, 0x79, 0x9a, 0xf0, 0xc9, 0xd8, 0x07, 0xa5, 0xbd, - 0x9f, 0x6b, 0x57, 0xb1, 0xa6, 0x81, 0x0b, 0xdc, 0x7a, 0x55, 0xbb, 0x21, 0x78, 0x67, 0xa5, 0x77, - 0xd2, 0x23, 0x5f, 0x8f, 0x79, 0x77, 0xa0, 0x2d, 0x97, 0x05, 0xc1, 0xdf, 0x26, 0xb8, 0xed, 0x69, - 0x2a, 0xc8, 0x48, 0x8f, 0xc8, 0x87, 0xea, 0x0d, 0x49, 0x64, 0xb7, 0x34, 0x31, 0x0f, 0xd1, 0xbb, - 0xb0, 0xa9, 0xff, 0x5e, 0xc1, 0xa3, 0xc5, 0x24, 0xda, 0x01, 0xab, 0xd5, 0x50, 0x86, 0x70, 0xeb, - 0xf0, 0x6a, 0xb6, 0x67, 0xbc, 0x9e, 0xed, 0x59, 0xad, 0x06, 0xb6, 0x5a, 0x0d, 0xf4, 0x21, 0x54, - 0x2f, 0x5e, 0x30, 0x92, 0xb4, 0x1a, 0x6a, 0xf8, 0x6e, 0x7d, 0x5b, 0x13, 0xf2, 0x34, 0xce, 0x0f, - 0xe8, 0x21, 0x94, 0xce, 0x5a, 0x0d, 0x35, 0x70, 0xb7, 0xbe, 0xa1, 0x69, 0x32, 0x85, 0xe5, 0x0f, - 0xfa, 0x0c, 0x6a, 0x67, 0x09, 0x89, 0x04, 0x89, 0x4f, 0x85, 0x9e, 0xf2, 0xff, 0xf3, 0xde, 0x28, - 0x80, 0x72, 0x76, 0xc9, 0x29, 0x13, 0x75, 0x5b, 0x6a, 0xf1, 0x92, 0x1d, 0x9c, 0xc2, 0x66, 0x81, - 0x81, 0x76, 0xc0, 0xb9, 0x66, 0xf4, 0xe5, 0x15, 0x1d, 0x11, 0xf5, 0x97, 0x4b, 0x78, 0x11, 0x2f, - 0x9b, 0x66, 0xad, 0x36, 0x8d, 0xc2, 0xf6, 0xda, 0xf0, 0xd0, 0x01, 0x6c, 0x67, 0xa7, 0x74, 0x61, - 0x0a, 0x79, 0x97, 0x8b, 0xd7, 0xd3, 0xe8, 0x63, 0xb8, 0x97, 0x9f, 0xdb, 0xb4, 0xcf, 0x22, 0x31, - 0x49, 0xb2, 0xbd, 0x75, 0xf1, 0x9b, 0x40, 0xf0, 0xab, 0x99, 0x6d, 0x2e, 0x7a, 0x0f, 0x6c, 0xf9, - 0xf2, 0xa8, 0x5b, 0xb7, 0x96, 0x2b, 0x20, 0xb1, 0xf0, 0x6a, 0x3a, 0x26, 0x58, 0xc1, 0xba, 0xfd, - 0xd6, 0x5d, 0xed, 0x0f, 0xae, 0xc0, 0x96, 0x4c, 0xb4, 0x01, 0xd5, 0x6b, 0x76, 0xcb, 0xf8, 0x0b, - 0xe6, 0x19, 0x08, 0xa0, 0x72, 0x19, 0x25, 0x84, 0x09, 0xcf, 0x44, 0x2e, 0x38, 0x97, 0x09, 0x79, - 0x4e, 0xf9, 0x24, 0xf5, 0x2c, 0xe4, 0x80, 0xfd, 0x8c, 0xbc, 0x14, 0x5e, 0x09, 0xd5, 0xa0, 0x7c, - 0x36, 0xa0, 0xc3, 0xd8, 0xb3, 0x91, 0x57, 0xf4, 0xa5, 0x57, 0x0e, 0x86, 0x2b, 0x3b, 0x8d, 0x1e, - 0x15, 0xaa, 0x7c, 0xf0, 0xc6, 0x6e, 0xaf, 0x94, 0x1a, 0x9c, 0xdc, 0x55, 0x4e, 0x0d, 0xca, 0xed, - 0xf1, 0x90, 0xca, 0x6a, 0x1c, 0xb0, 0x65, 0x1f, 0x3c, 0x4b, 0x26, 0xbf, 0xe3, 0x93, 0x61, 0xec, - 0x95, 0x82, 0x9f, 0x4c, 0xa8, 0x5c, 0xa8, 0x4b, 0xd1, 0x97, 0x45, 0xe7, 0xea, 0xb7, 0x6d, 0xb9, - 0x22, 0x2b, 0x98, 0x76, 0x41, 0xd1, 0xe9, 0x21, 0x54, 0xf5, 0x6c, 0x7c, 0x6b, 0xbf, 0x74, 0xb0, - 0x71, 0xbc, 0x95, 0x4b, 0x0b, 0xa2, 0x9c, 0x24, 0x37, 0x43, 0x5b, 0x3d, 0xb3, 0x37, 0xce, 0xc3, - 0xe0, 0x77, 0xab, 0xd8, 0x15, 0x14, 0x02, 0xba, 0x89, 0x86, 0x34, 0x56, 0x2e, 0x6b, 0x44, 0x22, - 0x6a, 0xd3, 0x1f, 0x89, 0xde, 0xa7, 0x3b, 0x10, 0xf4, 0x18, 0xb6, 0x96, 0x59, 0xf5, 0x00, 0x65, - 0x13, 0x74, 0xf5, 0x04, 0xd5, 0x23, 0x84, 0xd7, 0x38, 0xe8, 0x29, 0x38, 0x43, 0xda, 0x23, 0x42, - 0x1a, 0x37, 0x7b, 0x81, 0x1f, 0xde, 0xf5, 0x3e, 0x84, 0xe7, 0x9a, 0x54, 0x77, 0xe7, 0xb3, 0x3d, - 0x27, 0x8f, 0xf0, 0x42, 0xbc, 0xf3, 0xb3, 0x09, 0x8b, 0x34, 0xfa, 0x0a, 0xec, 0x09, 0xa3, 0x42, - 0x8f, 0x30, 0xf8, 0xcf, 0x1b, 0xc3, 0x6b, 0x46, 0x45, 0xdd, 0x99, 0xcf, 0xf6, 0x6c, 0x79, 0xc2, - 0x4a, 0x59, 0xfc, 0x1a, 0x95, 0xf2, 0xaf, 0xd1, 0x09, 0x28, 0x0e, 0xda, 0x84, 0xda, 0x35, 0x1b, - 0xd2, 0x11, 0x15, 0x24, 0xf6, 0x0c, 0xb4, 0x05, 0xf0, 0x8c, 0xf0, 0x6f, 0xda, 0x6a, 0xb3, 0x32, - 0x0f, 0xe6, 0xdb, 0xe7, 0x59, 0xf5, 0x2f, 0x5e, 0xcd, 0x77, 0xcd, 0xdf, 0xe6, 0xbb, 0xe6, 0x1f, - 0xf3, 0x5d, 0xf3, 0xcf, 0xf9, 0xae, 0xf9, 0xcb, 0x5f, 0xbb, 0xc6, 0xf7, 0x1f, 0xac, 0x7c, 0x76, - 0x59, 0x3a, 0xee, 0x76, 0x0f, 0x63, 0xf2, 0xfc, 0x88, 0x11, 0xde, 0x4b, 0x0f, 0xb3, 0x8f, 0x6e, - 0x56, 0x74, 0xa7, 0xa2, 0xa2, 0x93, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, 0xbb, 0x65, 0xf4, 0xeb, - 0xeb, 0x07, 0x00, 0x00, + // 867 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x55, 0x4d, 0x73, 0xdb, 0x44, + 0x18, 0x96, 0x64, 0xf9, 0xeb, 0xb5, 0xd2, 0xa8, 0x4b, 0x29, 0x1a, 0x33, 0x38, 0x41, 0xc3, 0x47, + 0x28, 0x44, 0x19, 0x52, 0x98, 0x0e, 0x07, 0x18, 0xe2, 0x98, 0x41, 0x1e, 0x0a, 0xc9, 0x6c, 0x3e, + 0x0e, 0xdc, 0x64, 0x6b, 0x2d, 0x8b, 0xd8, 0xbb, 0x9e, 0xdd, 0x75, 0x5b, 0xdf, 0xf9, 0x05, 0x9c, + 0xb8, 0xf1, 0x77, 0x7a, 0xe4, 0xc8, 0xf4, 0x90, 0x61, 0xc2, 0x0f, 0xe0, 0x2f, 0x74, 0x76, 0x25, + 0xd9, 0x92, 0xdb, 0x8b, 0x67, 0xdf, 0xe7, 0x63, 0xfd, 0xea, 0xdd, 0x67, 0x25, 0x40, 0x6c, 0xf4, + 0x1b, 0x19, 0xcb, 0x23, 0xb9, 0x5a, 0x10, 0x11, 0x2c, 0x38, 0x93, 0x0c, 0x35, 0x32, 0xac, 0xeb, + 0x72, 0x32, 0x11, 0x65, 0xa6, 0xfb, 0x8e, 0x20, 0x42, 0xa4, 0x8c, 0x56, 0x40, 0x4f, 0x48, 0xc6, + 0xa3, 0x84, 0x24, 0x9c, 0x2d, 0x17, 0x15, 0xe6, 0x30, 0x49, 0xe5, 0x74, 0x39, 0x0a, 0xc6, 0x6c, + 0x7e, 0x94, 0xb0, 0x84, 0x1d, 0x69, 0x78, 0xb4, 0x9c, 0xe8, 0x4a, 0x17, 0x7a, 0x95, 0xc9, 0xfd, + 0x27, 0x50, 0xc7, 0x11, 0x4d, 0x08, 0x7a, 0x08, 0x8d, 0xb3, 0xc9, 0x44, 0x10, 0xe9, 0x99, 0xfb, + 0xe6, 0x81, 0x8d, 0xf3, 0x4a, 0xe1, 0x4f, 0x09, 0x4d, 0xe4, 0xd4, 0xb3, 0x32, 0x3c, 0xab, 0xfc, + 0xaf, 0x00, 0xae, 0x04, 0xe1, 0x21, 0x89, 0x62, 0xc2, 0x91, 0x0b, 0xb5, 0x9f, 0xc8, 0x4a, 0x5b, + 0xdb, 0x58, 0x2d, 0xd1, 0x03, 0xa8, 0x5f, 0x47, 0xb3, 0x25, 0xd1, 0xb6, 0x36, 0xce, 0x0a, 0xff, + 0x77, 0x1b, 0x1a, 0xb9, 0xc5, 0x07, 0xfb, 0x69, 0x4a, 0x6f, 0xb4, 0xa7, 0x73, 0xec, 0x04, 0xd9, + 0x00, 0x02, 0x85, 0x85, 0x06, 0xd6, 0x1c, 0xfa, 0x1c, 0x5a, 0x98, 0xc4, 0x29, 0x27, 0x63, 0xa9, + 0xf7, 0xe9, 0x1c, 0xef, 0x04, 0x6a, 0x40, 0xc1, 0x49, 0x1c, 0x73, 0x22, 0x44, 0x68, 0xe0, 0xb5, + 0x00, 0x55, 0x3a, 0xf2, 0x6a, 0x5a, 0x8e, 0x8a, 0x6d, 0x37, 0x4c, 0x68, 0xe0, 0x72, 0xe7, 0x5f, + 0x42, 0xfb, 0x92, 0x47, 0x54, 0x4c, 0x18, 0x9f, 0x7b, 0xb6, 0x36, 0xdd, 0x2f, 0x4c, 0x6b, 0x22, + 0x34, 0xf0, 0x46, 0xa5, 0x2d, 0x6c, 0x3e, 0x12, 0x92, 0x51, 0xe2, 0xd5, 0xb7, 0x2c, 0x05, 0xa1, + 0x2d, 0x45, 0x81, 0xbe, 0x86, 0xc6, 0x35, 0xe1, 0xe9, 0x64, 0xe5, 0x35, 0xb4, 0xfe, 0xfd, 0x20, + 0x3f, 0xd5, 0x40, 0xc3, 0xe9, 0x38, 0x92, 0x29, 0xa3, 0xeb, 0x06, 0x73, 0x31, 0xfa, 0x04, 0x5a, + 0x21, 0x9b, 0xb3, 0x30, 0x12, 0x53, 0xaf, 0xb9, 0x6f, 0x1e, 0x38, 0xfd, 0xd6, 0xab, 0xdb, 0x3d, + 0x5b, 0xd5, 0xea, 0xd1, 0x0b, 0x0e, 0x3d, 0x82, 0xdd, 0xf3, 0x68, 0x35, 0x63, 0x51, 0x7c, 0x3a, + 0x25, 0xe3, 0x1b, 0xb1, 0x9c, 0x7b, 0x2d, 0x25, 0x0f, 0x0d, 0xbc, 0x4d, 0xa0, 0x27, 0xd0, 0x1e, + 0x52, 0x49, 0x12, 0x9e, 0xca, 0x95, 0xd7, 0xd6, 0xdd, 0xbc, 0x57, 0x74, 0xbf, 0x26, 0xd6, 0x9d, + 0x6c, 0xb4, 0xe8, 0x7b, 0x70, 0x2e, 0xb2, 0xd4, 0xfd, 0xa8, 0x52, 0xe7, 0x81, 0xf6, 0x76, 0x83, + 0x72, 0x14, 0x83, 0xb2, 0x22, 0x34, 0x70, 0xc5, 0xd1, 0x6f, 0xe6, 0x99, 0xf0, 0x3f, 0x2c, 0x4d, + 0x50, 0x25, 0xe5, 0x87, 0x05, 0x1b, 0x4f, 0xf3, 0xe0, 0x65, 0x85, 0xff, 0xbf, 0x09, 0xce, 0xc5, + 0x4a, 0x48, 0x32, 0xcf, 0x0f, 0xca, 0x83, 0xe6, 0x35, 0xe1, 0x6a, 0x66, 0xb9, 0xb0, 0x28, 0xd1, + 0x47, 0xb0, 0x93, 0x3f, 0x64, 0x25, 0xa9, 0x55, 0x10, 0x75, 0xc1, 0x1a, 0x0e, 0x74, 0x2c, 0x9c, + 0x3e, 0xbc, 0xbc, 0xdd, 0x33, 0x5e, 0xdd, 0xee, 0x59, 0xc3, 0x01, 0xb6, 0x86, 0x03, 0xf4, 0x19, + 0x34, 0xcf, 0x9e, 0x53, 0xc2, 0x87, 0x03, 0x1d, 0x01, 0xa7, 0xbf, 0x9b, 0x0b, 0x0a, 0x18, 0x17, + 0x0b, 0xf4, 0x01, 0xd4, 0x4e, 0x87, 0x03, 0x7d, 0xec, 0x4e, 0xbf, 0x93, 0xcb, 0x14, 0x84, 0xd5, + 0x0f, 0xfa, 0x06, 0xda, 0xa7, 0x9c, 0x44, 0x92, 0xc4, 0x27, 0x32, 0x3f, 0xeb, 0x77, 0x8b, 0xe9, + 0x6a, 0x22, 0x65, 0xf4, 0x9c, 0xa5, 0x54, 0xf6, 0x6d, 0xe5, 0xc5, 0x1b, 0xb5, 0x7f, 0x02, 0x3b, + 0x15, 0x05, 0xea, 0x42, 0xeb, 0x8a, 0xa6, 0x2f, 0x2e, 0xd3, 0x39, 0xd1, 0x8f, 0x5c, 0xc3, 0xeb, + 0x7a, 0x33, 0x34, 0xab, 0x3c, 0xb4, 0x14, 0x76, 0xb7, 0x8e, 0x10, 0x1d, 0xc0, 0x6e, 0xb6, 0x12, + 0xeb, 0x68, 0xa8, 0xbd, 0x1c, 0xbc, 0x0d, 0xa3, 0x2f, 0xe0, 0x7e, 0xb1, 0xbe, 0x48, 0x13, 0x1a, + 0xc9, 0x25, 0xcf, 0x6e, 0xaf, 0x83, 0xdf, 0x24, 0xfc, 0xbf, 0xcc, 0xec, 0xfe, 0xa2, 0x8f, 0xc1, + 0x56, 0xef, 0x1f, 0xbd, 0xeb, 0xbd, 0xcd, 0x45, 0x50, 0x5c, 0x70, 0xb9, 0x5a, 0x10, 0xac, 0xe9, + 0x7c, 0xfc, 0xd6, 0xdb, 0xc6, 0xef, 0x5f, 0x82, 0xad, 0x94, 0xa8, 0x03, 0xcd, 0x2b, 0x7a, 0x43, + 0xd9, 0x73, 0xea, 0x1a, 0x08, 0xa0, 0x71, 0x1e, 0x71, 0x42, 0xa5, 0x6b, 0x22, 0x07, 0x5a, 0xe7, + 0x9c, 0x3c, 0x4b, 0xd9, 0x52, 0xb8, 0x16, 0x6a, 0x81, 0xfd, 0x0b, 0x79, 0x21, 0xdd, 0x1a, 0x6a, + 0x43, 0xfd, 0x74, 0x9a, 0xce, 0x62, 0xd7, 0x46, 0x6e, 0x35, 0x9d, 0x6e, 0xdd, 0x9f, 0x95, 0x6e, + 0x36, 0x7a, 0x54, 0xe9, 0xf2, 0xe1, 0x1b, 0x37, 0xbc, 0xd4, 0xaa, 0xff, 0xf8, 0x6d, 0xed, 0xb4, + 0xa1, 0x7e, 0xb1, 0x98, 0xa5, 0xaa, 0x9b, 0x16, 0xd8, 0x6a, 0x0e, 0xae, 0xa5, 0xc0, 0x9f, 0xd9, + 0x72, 0x16, 0xbb, 0x35, 0xff, 0x0f, 0x13, 0x1a, 0x67, 0x7a, 0x53, 0xf4, 0x5d, 0x35, 0xb9, 0xf9, + 0x1b, 0xee, 0x41, 0xf1, 0x9f, 0x65, 0x2e, 0x4f, 0x41, 0x35, 0xe9, 0x01, 0x34, 0xf3, 0xb3, 0xf1, + 0xac, 0xfd, 0xda, 0x41, 0xe7, 0xf8, 0x5e, 0x61, 0xad, 0x98, 0x0a, 0x91, 0xba, 0x19, 0x79, 0xd4, + 0xb3, 0x78, 0xe3, 0xa2, 0xec, 0x7f, 0xfb, 0xf2, 0xae, 0x67, 0xfe, 0x7d, 0xd7, 0x33, 0xff, 0xb9, + 0xeb, 0x99, 0xff, 0xde, 0xf5, 0xcc, 0x3f, 0xff, 0xeb, 0x19, 0xbf, 0x7e, 0x5a, 0xfa, 0x44, 0x50, + 0xb1, 0x18, 0x8f, 0x0f, 0x63, 0xf2, 0xec, 0x88, 0x12, 0x36, 0x11, 0x87, 0xd9, 0x07, 0x22, 0xfb, + 0xbb, 0x51, 0x43, 0x57, 0x8f, 0x5f, 0x07, 0x00, 0x00, 0xff, 0xff, 0x40, 0x7d, 0xa2, 0x84, 0xb1, + 0x06, 0x00, 0x00, } func (m *Range) Marshal() (dAtA []byte, err error) { @@ -1620,97 +1471,6 @@ func (m *Object) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *StorageGroup) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *StorageGroup) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *StorageGroup) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.Lifetime != nil { - { - size, err := m.Lifetime.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - { - size := m.ValidationHash.Size() - i -= size - if _, err := m.ValidationHash.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - if m.ValidationDataSize != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.ValidationDataSize)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *StorageGroup_Lifetime) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *StorageGroup_Lifetime) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *StorageGroup_Lifetime) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.Value != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.Value)) - i-- - dAtA[i] = 0x10 - } - if m.Unit != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.Unit)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - func encodeVarintTypes(dAtA []byte, offset int, v uint64) int { offset -= sovTypes(v) base := offset @@ -2028,45 +1788,6 @@ func (m *Object) Size() (n int) { return n } -func (m *StorageGroup) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ValidationDataSize != 0 { - n += 1 + sovTypes(uint64(m.ValidationDataSize)) - } - l = m.ValidationHash.Size() - n += 1 + l + sovTypes(uint64(l)) - if m.Lifetime != nil { - l = m.Lifetime.Size() - n += 1 + l + sovTypes(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *StorageGroup_Lifetime) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Unit != 0 { - n += 1 + sovTypes(uint64(m.Unit)) - } - if m.Value != 0 { - n += 1 + sovTypes(uint64(m.Value)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - func sovTypes(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -2655,7 +2376,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &StorageGroup{} + v := &storagegroup.StorageGroup{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -3531,240 +3252,6 @@ func (m *Object) Unmarshal(dAtA []byte) error { } return nil } -func (m *StorageGroup) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: StorageGroup: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: StorageGroup: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ValidationDataSize", wireType) - } - m.ValidationDataSize = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ValidationDataSize |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ValidationHash", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ValidationHash.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Lifetime", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Lifetime == nil { - m.Lifetime = &StorageGroup_Lifetime{} - } - if err := m.Lifetime.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *StorageGroup_Lifetime) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Lifetime: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Lifetime: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Unit", wireType) - } - m.Unit = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Unit |= StorageGroup_Lifetime_Unit(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) - } - m.Value = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Value |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func skipTypes(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/object/types.proto b/object/types.proto index f3313a3..d2bbaab 100644 --- a/object/types.proto +++ b/object/types.proto @@ -4,6 +4,7 @@ option go_package = "github.com/nspcc-dev/neofs-proto/object"; import "refs/types.proto"; import "session/types.proto"; +import "storagegroup/types.proto"; import "github.com/gogo/protobuf/gogoproto/gogo.proto"; option (gogoproto.stable_marshaler_all) = true; @@ -25,25 +26,25 @@ message UserHeader { message Header { oneof Value { // Link to other objects - Link Link = 1; + Link Link = 1; // Redirect not used yet - refs.Address Redirect = 2; + refs.Address Redirect = 2; // UserHeader is a set of KV headers defined by user - UserHeader UserHeader = 3; + UserHeader UserHeader = 3; // Transform defines transform operation (e.g. payload split) - Transform Transform = 4; + Transform Transform = 4; // Tombstone header that set up in deleted objects - Tombstone Tombstone = 5; + Tombstone Tombstone = 5; // Verify header that contains session public key and user's signature - session.VerificationHeader Verify = 6; + session.VerificationHeader Verify = 6; // HomoHash is a homomorphic hash of original object payload - bytes HomoHash = 7 [(gogoproto.customtype) = "Hash"]; + bytes HomoHash = 7 [(gogoproto.customtype) = "Hash"]; // PayloadChecksum of actual object's payload - bytes PayloadChecksum = 8; + bytes PayloadChecksum = 8; // Integrity header with checksum of all above headers in the object - IntegrityHeader Integrity = 9; + IntegrityHeader Integrity = 9; // StorageGroup contains meta information for the data audit - StorageGroup StorageGroup = 10; + storagegroup.StorageGroup StorageGroup = 10; } } @@ -124,29 +125,3 @@ message Object { // Payload is an object's payload bytes Payload = 3; } - -message StorageGroup { - // ValidationDataSize is size of the all object's payloads included into storage group - uint64 ValidationDataSize = 1; - // ValidationHash is homomorphic hash of all object's payloads included into storage group - bytes ValidationHash = 2 [(gogoproto.customtype) = "Hash", (gogoproto.nullable) = false]; - - message Lifetime { - enum Unit { - // Unlimited set if storage group always valid - Unlimited = 0; - // NeoFSEpoch set if storage group is valid until lifetime NeoFS epoch - NeoFSEpoch = 1; - // UnixTime set if storage group is valid until lifetime unix timestamp - UnixTime = 2; - } - - // Unit is lifetime type - Unit unit = 1 [(gogoproto.customname) = "Unit"]; - // Value for lifetime - int64 Value = 2; - } - - // Lifetime is time until storage group is valid - Lifetime lifetime = 3 [(gogoproto.customname) = "Lifetime"]; -} diff --git a/storagegroup/storage.go b/storagegroup/storage.go new file mode 100644 index 0000000..a23ef74 --- /dev/null +++ b/storagegroup/storage.go @@ -0,0 +1,39 @@ +package storagegroup + +import ( + "context" + + "github.com/nspcc-dev/neofs-proto/refs" +) + +type ( + // Store is a interface for storing users storage group + Store interface { + Lister + Receiver + Receptacle + } + + // Lister defines list function that returns all storage groups + // created for the passed container + Lister interface { + List(ctx context.Context, cid refs.CID) ([]refs.SGID, error) + } + + // Receiver defines get function that returns asked storage group + Receiver interface { + Get(ctx context.Context, cid refs.CID, sgid refs.SGID) (Provider, error) + } + + // Receptacle defines put function that places storage group in the + // store. + Receptacle interface { + Put(ctx context.Context, sg Provider) error + } + + // InfoReceiver defines GetSGInfo function that returns storage group + // that contains passed object ids. + InfoReceiver interface { + GetSGInfo(ctx context.Context, cid refs.CID, group []refs.ObjectID) (*StorageGroup, error) + } +) diff --git a/storagegroup/types.go b/storagegroup/types.go new file mode 100644 index 0000000..6c6f775 --- /dev/null +++ b/storagegroup/types.go @@ -0,0 +1,97 @@ +package storagegroup + +import ( + "bytes" + "strconv" + "strings" + + "github.com/gogo/protobuf/proto" + "github.com/mr-tron/base58" + "github.com/nspcc-dev/neofs-proto/hash" + "github.com/nspcc-dev/neofs-proto/refs" +) + +type ( + // Hash is alias of hash.Hash for proto definition. + Hash = hash.Hash + + // Provider is an interface that defines storage group instance. + // There was different storage group implementation. Right now it + // is implemented as extended header in the object. + Provider interface { + // Group returns list of object ids of the storage group. + // This list **should be** sorted. + Group() []refs.ObjectID + + IDInfo() *IdentificationInfo + Zones() []ZoneInfo + } + + // ZoneInfo provides validation information of storage group. + ZoneInfo struct { + hash.Hash + Size uint64 + } + + // IdentificationInfo provides meta information about storage group. + IdentificationInfo struct { + CID refs.CID + SGID refs.SGID + OwnerID refs.OwnerID + } + + // IDList is a slice of object ids, that can be sorted. + IDList []refs.ObjectID +) + +var _ proto.Message = (*StorageGroup)(nil) + +// String returns string representation of StorageGroup. +func (m *StorageGroup) String() string { + b := new(strings.Builder) + b.WriteString("') + return b.String() +} + +// Empty checks if storage group has some data for validation. +func (m StorageGroup) Empty() bool { + return m.ValidationDataSize == 0 && m.ValidationHash.Equal(hash.Hash{}) +} + +// Len returns amount of object ids in IDList. +func (s IDList) Len() int { return len(s) } + +// Less returns byte comparision between IDList[i] and IDList[j]. +func (s IDList) Less(i, j int) bool { return bytes.Compare(s[i].Bytes(), s[j].Bytes()) == -1 } + +// Swap swaps element with i and j index in IDList. +func (s IDList) Swap(i, j int) { s[i], s[j] = s[j], s[i] } + +// CalculateSize combines length of all zones in storage group. +func CalculateSize(sg Provider) (size uint64) { + zoneList := sg.Zones() + for i := range zoneList { + size += zoneList[i].Size + } + return +} + +// CalculateHash returns homomorphic sum of hashes +// fromm all zones in storage group. +func CalculateHash(sg Provider) (hash.Hash, error) { + var ( + zones = sg.Zones() + hashes = make([]hash.Hash, len(zones)) + ) + for i := range zones { + hashes[i] = zones[i].Hash + } + return hash.Concat(hashes) +} diff --git a/storagegroup/types.pb.go b/storagegroup/types.pb.go new file mode 100644 index 0000000..f052885 --- /dev/null +++ b/storagegroup/types.pb.go @@ -0,0 +1,663 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: storagegroup/types.proto + +package storagegroup + +import ( + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/golang/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package + +type StorageGroup_Lifetime_Unit int32 + +const ( + // Unlimited set if storage group always valid + StorageGroup_Lifetime_Unlimited StorageGroup_Lifetime_Unit = 0 + // NeoFSEpoch set if storage group is valid until lifetime NeoFS epoch + StorageGroup_Lifetime_NeoFSEpoch StorageGroup_Lifetime_Unit = 1 + // UnixTime set if storage group is valid until lifetime unix timestamp + StorageGroup_Lifetime_UnixTime StorageGroup_Lifetime_Unit = 2 +) + +var StorageGroup_Lifetime_Unit_name = map[int32]string{ + 0: "Unlimited", + 1: "NeoFSEpoch", + 2: "UnixTime", +} + +var StorageGroup_Lifetime_Unit_value = map[string]int32{ + "Unlimited": 0, + "NeoFSEpoch": 1, + "UnixTime": 2, +} + +func (x StorageGroup_Lifetime_Unit) String() string { + return proto.EnumName(StorageGroup_Lifetime_Unit_name, int32(x)) +} + +func (StorageGroup_Lifetime_Unit) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_cfa54edc899249a8, []int{0, 0, 0} +} + +type StorageGroup struct { + // ValidationDataSize is size of the all object's payloads included into storage group + ValidationDataSize uint64 `protobuf:"varint,1,opt,name=ValidationDataSize,proto3" json:"ValidationDataSize,omitempty"` + // ValidationHash is homomorphic hash of all object's payloads included into storage group + ValidationHash Hash `protobuf:"bytes,2,opt,name=ValidationHash,proto3,customtype=Hash" json:"ValidationHash"` + // Lifetime is time until storage group is valid + Lifetime *StorageGroup_Lifetime `protobuf:"bytes,3,opt,name=lifetime,proto3" json:"lifetime,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *StorageGroup) Reset() { *m = StorageGroup{} } +func (*StorageGroup) ProtoMessage() {} +func (*StorageGroup) Descriptor() ([]byte, []int) { + return fileDescriptor_cfa54edc899249a8, []int{0} +} +func (m *StorageGroup) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *StorageGroup) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *StorageGroup) XXX_Merge(src proto.Message) { + xxx_messageInfo_StorageGroup.Merge(m, src) +} +func (m *StorageGroup) XXX_Size() int { + return m.Size() +} +func (m *StorageGroup) XXX_DiscardUnknown() { + xxx_messageInfo_StorageGroup.DiscardUnknown(m) +} + +var xxx_messageInfo_StorageGroup proto.InternalMessageInfo + +func (m *StorageGroup) GetValidationDataSize() uint64 { + if m != nil { + return m.ValidationDataSize + } + return 0 +} + +func (m *StorageGroup) GetLifetime() *StorageGroup_Lifetime { + if m != nil { + return m.Lifetime + } + return nil +} + +type StorageGroup_Lifetime struct { + // Unit is lifetime type + Unit StorageGroup_Lifetime_Unit `protobuf:"varint,1,opt,name=unit,proto3,enum=storagegroup.StorageGroup_Lifetime_Unit" json:"unit,omitempty"` + // Value for lifetime + Value int64 `protobuf:"varint,2,opt,name=Value,proto3" json:"Value,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *StorageGroup_Lifetime) Reset() { *m = StorageGroup_Lifetime{} } +func (m *StorageGroup_Lifetime) String() string { return proto.CompactTextString(m) } +func (*StorageGroup_Lifetime) ProtoMessage() {} +func (*StorageGroup_Lifetime) Descriptor() ([]byte, []int) { + return fileDescriptor_cfa54edc899249a8, []int{0, 0} +} +func (m *StorageGroup_Lifetime) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *StorageGroup_Lifetime) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *StorageGroup_Lifetime) XXX_Merge(src proto.Message) { + xxx_messageInfo_StorageGroup_Lifetime.Merge(m, src) +} +func (m *StorageGroup_Lifetime) XXX_Size() int { + return m.Size() +} +func (m *StorageGroup_Lifetime) XXX_DiscardUnknown() { + xxx_messageInfo_StorageGroup_Lifetime.DiscardUnknown(m) +} + +var xxx_messageInfo_StorageGroup_Lifetime proto.InternalMessageInfo + +func (m *StorageGroup_Lifetime) GetUnit() StorageGroup_Lifetime_Unit { + if m != nil { + return m.Unit + } + return StorageGroup_Lifetime_Unlimited +} + +func (m *StorageGroup_Lifetime) GetValue() int64 { + if m != nil { + return m.Value + } + return 0 +} + +func init() { + proto.RegisterEnum("storagegroup.StorageGroup_Lifetime_Unit", StorageGroup_Lifetime_Unit_name, StorageGroup_Lifetime_Unit_value) + proto.RegisterType((*StorageGroup)(nil), "storagegroup.StorageGroup") + proto.RegisterType((*StorageGroup_Lifetime)(nil), "storagegroup.StorageGroup.Lifetime") +} + +func init() { proto.RegisterFile("storagegroup/types.proto", fileDescriptor_cfa54edc899249a8) } + +var fileDescriptor_cfa54edc899249a8 = []byte{ + // 353 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x51, 0x31, 0x4f, 0xc2, 0x40, + 0x18, 0xed, 0x41, 0x35, 0xf5, 0xac, 0x84, 0x5c, 0x1c, 0x1a, 0x86, 0x96, 0xe0, 0xd2, 0x85, 0x36, + 0x01, 0x27, 0xc7, 0xaa, 0xe8, 0xa0, 0x0e, 0x45, 0x18, 0xdc, 0x8e, 0x72, 0x94, 0x4b, 0xda, 0xbb, + 0x86, 0x5e, 0x8d, 0xfa, 0x4b, 0x58, 0x4c, 0xfc, 0x39, 0x8c, 0x8e, 0xc6, 0xa1, 0x31, 0x75, 0xf2, + 0x5f, 0x18, 0xae, 0x8a, 0x8d, 0x71, 0x70, 0xfb, 0xde, 0xfb, 0xde, 0xfb, 0xf2, 0xbd, 0x3c, 0x68, + 0xa4, 0x82, 0x2f, 0x70, 0x48, 0xc2, 0x05, 0xcf, 0x12, 0x57, 0xdc, 0x27, 0x24, 0x75, 0x92, 0x05, + 0x17, 0x1c, 0xe9, 0xd5, 0x4d, 0xab, 0x1b, 0x52, 0x31, 0xcf, 0x26, 0x4e, 0xc0, 0x63, 0x37, 0xe4, + 0x21, 0x77, 0xa5, 0x68, 0x92, 0xcd, 0x24, 0x92, 0x40, 0x4e, 0xa5, 0xb9, 0xf3, 0x51, 0x83, 0xfa, + 0xb0, 0xf4, 0x9f, 0xad, 0xfd, 0xc8, 0x81, 0x68, 0x8c, 0x23, 0x3a, 0xc5, 0x82, 0x72, 0x76, 0x82, + 0x05, 0x1e, 0xd2, 0x07, 0x62, 0x80, 0x36, 0xb0, 0x55, 0xff, 0x8f, 0x0d, 0x3a, 0x84, 0x8d, 0x1f, + 0xf6, 0x1c, 0xa7, 0x73, 0xa3, 0xd6, 0x06, 0xb6, 0xee, 0xe9, 0xab, 0xdc, 0x52, 0x5e, 0x73, 0x4b, + 0x5d, 0x73, 0xfe, 0x2f, 0x0d, 0xba, 0x84, 0x5a, 0x44, 0x67, 0x44, 0xd0, 0x98, 0x18, 0xf5, 0x36, + 0xb0, 0x77, 0x7b, 0x07, 0x4e, 0x35, 0x86, 0x53, 0xfd, 0xc9, 0xb9, 0xf8, 0x92, 0x7a, 0x7a, 0x91, + 0x5b, 0xda, 0x37, 0xf2, 0x37, 0x27, 0x5a, 0x8f, 0x00, 0x6e, 0x68, 0x34, 0x80, 0x6a, 0xc6, 0xa8, + 0x90, 0x3f, 0x37, 0x7a, 0xf6, 0x3f, 0xee, 0x3a, 0x23, 0x46, 0x85, 0xa7, 0x15, 0xb9, 0xa5, 0xae, + 0x27, 0x5f, 0xfa, 0xd1, 0x3e, 0xdc, 0x1a, 0xe3, 0x28, 0x23, 0x32, 0x50, 0xdd, 0x2f, 0x41, 0xa7, + 0x0f, 0xa5, 0x06, 0xed, 0xc1, 0x9d, 0x11, 0x8b, 0x68, 0x4c, 0x05, 0x99, 0x36, 0x15, 0xd4, 0x80, + 0xf0, 0x8a, 0xf0, 0xc1, 0xf0, 0x34, 0xe1, 0xc1, 0xbc, 0x09, 0x90, 0x0e, 0xb5, 0x11, 0xa3, 0x77, + 0xd7, 0x34, 0x26, 0xcd, 0xda, 0x91, 0xba, 0x7c, 0xb2, 0x14, 0xef, 0x78, 0x55, 0x98, 0xe0, 0xb9, + 0x30, 0xc1, 0x4b, 0x61, 0x82, 0xb7, 0xc2, 0x04, 0xcb, 0x77, 0x53, 0xb9, 0xa9, 0x16, 0xc6, 0xd2, + 0x24, 0x08, 0xba, 0x53, 0x72, 0xeb, 0x32, 0xc2, 0x67, 0x69, 0xb7, 0xac, 0xab, 0x1a, 0x60, 0xb2, + 0x2d, 0xb9, 0xfe, 0x67, 0x00, 0x00, 0x00, 0xff, 0xff, 0x91, 0x55, 0xe3, 0x01, 0x10, 0x02, 0x00, + 0x00, +} + +func (m *StorageGroup) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *StorageGroup) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *StorageGroup) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.Lifetime != nil { + { + size, err := m.Lifetime.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + { + size := m.ValidationHash.Size() + i -= size + if _, err := m.ValidationHash.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if m.ValidationDataSize != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.ValidationDataSize)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *StorageGroup_Lifetime) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *StorageGroup_Lifetime) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *StorageGroup_Lifetime) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.Value != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Value)) + i-- + dAtA[i] = 0x10 + } + if m.Unit != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Unit)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func encodeVarintTypes(dAtA []byte, offset int, v uint64) int { + offset -= sovTypes(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *StorageGroup) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ValidationDataSize != 0 { + n += 1 + sovTypes(uint64(m.ValidationDataSize)) + } + l = m.ValidationHash.Size() + n += 1 + l + sovTypes(uint64(l)) + if m.Lifetime != nil { + l = m.Lifetime.Size() + n += 1 + l + sovTypes(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *StorageGroup_Lifetime) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Unit != 0 { + n += 1 + sovTypes(uint64(m.Unit)) + } + if m.Value != 0 { + n += 1 + sovTypes(uint64(m.Value)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovTypes(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozTypes(x uint64) (n int) { + return sovTypes(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *StorageGroup) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: StorageGroup: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: StorageGroup: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidationDataSize", wireType) + } + m.ValidationDataSize = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ValidationDataSize |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidationHash", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ValidationHash.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Lifetime", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Lifetime == nil { + m.Lifetime = &StorageGroup_Lifetime{} + } + if err := m.Lifetime.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *StorageGroup_Lifetime) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Lifetime: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Lifetime: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Unit", wireType) + } + m.Unit = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Unit |= StorageGroup_Lifetime_Unit(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + m.Value = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Value |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipTypes(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthTypes + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTypes + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthTypes + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthTypes = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTypes = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTypes = fmt.Errorf("proto: unexpected end of group") +) diff --git a/storagegroup/types.proto b/storagegroup/types.proto new file mode 100644 index 0000000..5014b96 --- /dev/null +++ b/storagegroup/types.proto @@ -0,0 +1,35 @@ +syntax = "proto3"; +package storagegroup; +option go_package = "github.com/nspcc-dev/neofs-proto/storagegroup"; + +import "github.com/gogo/protobuf/gogoproto/gogo.proto"; + +option (gogoproto.stable_marshaler_all) = true; + +message StorageGroup { + option (gogoproto.goproto_stringer) = false; + + // ValidationDataSize is size of the all object's payloads included into storage group + uint64 ValidationDataSize = 1; + // ValidationHash is homomorphic hash of all object's payloads included into storage group + bytes ValidationHash = 2 [(gogoproto.customtype) = "Hash", (gogoproto.nullable) = false]; + + message Lifetime { + enum Unit { + // Unlimited set if storage group always valid + Unlimited = 0; + // NeoFSEpoch set if storage group is valid until lifetime NeoFS epoch + NeoFSEpoch = 1; + // UnixTime set if storage group is valid until lifetime unix timestamp + UnixTime = 2; + } + + // Unit is lifetime type + Unit unit = 1 [(gogoproto.customname) = "Unit"]; + // Value for lifetime + int64 Value = 2; + } + + // Lifetime is time until storage group is valid + Lifetime lifetime = 3 [(gogoproto.customname) = "Lifetime"]; +} From 90b6e5c4c110c7fdc451c5947556fe43cc43893d Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Tue, 3 Dec 2019 13:20:54 +0300 Subject: [PATCH 0051/1196] CHANGELOG --- CHANGELOG.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a3f3c8c..a039d13 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,15 @@ # Changelog This is the changelog for NeoFS Proto +## [0.2.4] - 2019-12-03 + +### Added +- StorageGroup library + +### Changed +- Storage group part of object library moved into separate package +- Updated proto documentation + ## [0.2.3] - 2019-11-28 ### Removed @@ -50,3 +59,4 @@ Initial public release [0.2.1]: https://github.com/nspcc-dev/neofs-proto/compare/v0.2.0...v0.2.1 [0.2.2]: https://github.com/nspcc-dev/neofs-proto/compare/v0.2.1...v0.2.2 [0.2.3]: https://github.com/nspcc-dev/neofs-proto/compare/v0.2.2...v0.2.3 +[0.2.4]: https://github.com/nspcc-dev/neofs-proto/compare/v0.2.3...v0.2.4 From 891ba27edec4b9c8c2a44c8df3b79b51d49a63bc Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Thu, 5 Dec 2019 14:30:08 +0300 Subject: [PATCH 0052/1196] service: get rid of proto.Message in Maintainable/Verifiable requests --- service/verify.go | 3 --- 1 file changed, 3 deletions(-) diff --git a/service/verify.go b/service/verify.go index 48e2871..8571459 100644 --- a/service/verify.go +++ b/service/verify.go @@ -3,7 +3,6 @@ package service import ( "crypto/ecdsa" - "github.com/gogo/protobuf/proto" crypto "github.com/nspcc-dev/neofs-crypto" "github.com/nspcc-dev/neofs-proto/internal" "github.com/nspcc-dev/neofs-proto/refs" @@ -13,7 +12,6 @@ import ( type ( // VerifiableRequest adds possibility to sign and verify request header. VerifiableRequest interface { - proto.Message Marshal() ([]byte, error) AddSignature(*RequestVerificationHeader_Signature) GetSignatures() []*RequestVerificationHeader_Signature @@ -23,7 +21,6 @@ type ( // MaintainableRequest adds possibility to set and get (+validate) // owner (client) public key from RequestVerificationHeader. MaintainableRequest interface { - proto.Message GetOwner() (*ecdsa.PublicKey, error) SetOwner(*ecdsa.PublicKey, []byte) GetLastPeer() (*ecdsa.PublicKey, error) From 1f22bcc9c118e15a6628eac1b2bc803a8010e4ee Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Thu, 5 Dec 2019 14:45:40 +0300 Subject: [PATCH 0053/1196] CHANGELOG --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a039d13..77ba22c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,11 @@ # Changelog This is the changelog for NeoFS Proto +## [0.2.5] - 2019-12-05 + +### Removed +- proto.Message in Maintainable/Verifiable requests + ## [0.2.4] - 2019-12-03 ### Added @@ -60,3 +65,4 @@ Initial public release [0.2.2]: https://github.com/nspcc-dev/neofs-proto/compare/v0.2.1...v0.2.2 [0.2.3]: https://github.com/nspcc-dev/neofs-proto/compare/v0.2.2...v0.2.3 [0.2.4]: https://github.com/nspcc-dev/neofs-proto/compare/v0.2.3...v0.2.4 +[0.2.5]: https://github.com/nspcc-dev/neofs-proto/compare/v0.2.4...v0.2.5 From 11eb541f2305a6266fac26f88164fa863332f216 Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Tue, 17 Dec 2019 14:08:59 +0300 Subject: [PATCH 0054/1196] state: add request to dump node config - regenerate proto files - regenerate proto docs --- docs/state.md | 36 ++++ state/service.pb.go | 511 +++++++++++++++++++++++++++++++++++++++++--- state/service.proto | 18 ++ 3 files changed, 538 insertions(+), 27 deletions(-) diff --git a/docs/state.md b/docs/state.md index e678be3..7950455 100644 --- a/docs/state.md +++ b/docs/state.md @@ -8,6 +8,8 @@ - [Status](#state.Status) - Messages + - [DumpRequest](#state.DumpRequest) + - [DumpResponse](#state.DumpResponse) - [HealthRequest](#state.HealthRequest) - [HealthResponse](#state.HealthResponse) - [MetricsRequest](#state.MetricsRequest) @@ -36,6 +38,7 @@ Status service provides node's healthcheck and status info rpc Netmap(NetmapRequest) returns (.bootstrap.SpreadMap); rpc Metrics(MetricsRequest) returns (MetricsResponse); rpc HealthCheck(HealthRequest) returns (HealthResponse); +rpc DumpConfig(DumpRequest) returns (DumpResponse); ``` @@ -61,9 +64,42 @@ If node unhealthy field Status would contains detailed info. | Name | Input | Output | | ---- | ----- | ------ | | HealthCheck | [HealthRequest](#state.HealthRequest) | [HealthResponse](#state.HealthResponse) | +#### Method DumpConfig + +DumpConfig request allows dumping settings for the current node. +To permit access, used server config options. +The request should be signed. + +| Name | Input | Output | +| ---- | ----- | ------ | +| DumpConfig | [DumpRequest](#state.DumpRequest) | [DumpResponse](#state.DumpResponse) | + + +### Message DumpRequest +DumpRequest message to fetch current server config. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| Meta | [service.RequestMetaHeader](#service.RequestMetaHeader) | | RequestMetaHeader contains information about request meta headers (should be embedded into message) | +| Verify | [service.RequestVerificationHeader](#service.RequestVerificationHeader) | | RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) | + + + + +### Message DumpResponse +DumpResponse message contains current server config. +Config stored in JSON encoded into slice of bytes. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| Config | [bytes](#bytes) | | | + + ### Message HealthRequest diff --git a/state/service.pb.go b/state/service.pb.go index 520c8ce..09cc645 100644 --- a/state/service.pb.go +++ b/state/service.pb.go @@ -249,44 +249,134 @@ func (m *HealthResponse) GetStatus() string { return "" } +// DumpRequest message to fetch current server config. +type DumpRequest struct { + // RequestMetaHeader contains information about request meta headers (should be embedded into message) + service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` + // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) + service.RequestVerificationHeader `protobuf:"bytes,99,opt,name=Verify,proto3,embedded=Verify" json:"Verify"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DumpRequest) Reset() { *m = DumpRequest{} } +func (m *DumpRequest) String() string { return proto.CompactTextString(m) } +func (*DumpRequest) ProtoMessage() {} +func (*DumpRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_695592f6f2fc97b7, []int{5} +} +func (m *DumpRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DumpRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *DumpRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_DumpRequest.Merge(m, src) +} +func (m *DumpRequest) XXX_Size() int { + return m.Size() +} +func (m *DumpRequest) XXX_DiscardUnknown() { + xxx_messageInfo_DumpRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_DumpRequest proto.InternalMessageInfo + +// DumpResponse message contains current server config. +// Config stored in JSON encoded into slice of bytes. +type DumpResponse struct { + Config []byte `protobuf:"bytes,1,opt,name=Config,proto3" json:"Config,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DumpResponse) Reset() { *m = DumpResponse{} } +func (m *DumpResponse) String() string { return proto.CompactTextString(m) } +func (*DumpResponse) ProtoMessage() {} +func (*DumpResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_695592f6f2fc97b7, []int{6} +} +func (m *DumpResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DumpResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *DumpResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_DumpResponse.Merge(m, src) +} +func (m *DumpResponse) XXX_Size() int { + return m.Size() +} +func (m *DumpResponse) XXX_DiscardUnknown() { + xxx_messageInfo_DumpResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_DumpResponse proto.InternalMessageInfo + +func (m *DumpResponse) GetConfig() []byte { + if m != nil { + return m.Config + } + return nil +} + func init() { proto.RegisterType((*NetmapRequest)(nil), "state.NetmapRequest") proto.RegisterType((*MetricsRequest)(nil), "state.MetricsRequest") proto.RegisterType((*MetricsResponse)(nil), "state.MetricsResponse") proto.RegisterType((*HealthRequest)(nil), "state.HealthRequest") proto.RegisterType((*HealthResponse)(nil), "state.HealthResponse") + proto.RegisterType((*DumpRequest)(nil), "state.DumpRequest") + proto.RegisterType((*DumpResponse)(nil), "state.DumpResponse") } func init() { proto.RegisterFile("state/service.proto", fileDescriptor_695592f6f2fc97b7) } var fileDescriptor_695592f6f2fc97b7 = []byte{ - // 408 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x93, 0xbf, 0xae, 0xd3, 0x30, - 0x14, 0xc6, 0xaf, 0xf9, 0x13, 0x2e, 0xbe, 0x70, 0x91, 0x4c, 0x5b, 0x45, 0x19, 0xd2, 0xa8, 0x03, - 0x8a, 0x84, 0x9a, 0x48, 0x85, 0xa1, 0x42, 0x4c, 0x85, 0xa1, 0x4b, 0x19, 0x52, 0x89, 0x81, 0xcd, - 0x71, 0x4f, 0xdb, 0x08, 0x1a, 0x9b, 0xf8, 0xa4, 0x52, 0x9f, 0x02, 0x46, 0x1e, 0x84, 0x87, 0xe8, - 0xd8, 0x91, 0xa9, 0x42, 0xe1, 0x45, 0x10, 0x8e, 0x13, 0x68, 0x79, 0x81, 0x6e, 0xf9, 0x7e, 0x5f, - 0x3e, 0xe7, 0xd3, 0xc9, 0x31, 0x7d, 0xaa, 0x91, 0x23, 0xc4, 0x1a, 0x8a, 0x6d, 0x26, 0x20, 0x52, - 0x85, 0x44, 0xc9, 0xee, 0x1b, 0xe8, 0x31, 0x4b, 0xe3, 0x0d, 0x20, 0xaf, 0x2d, 0xaf, 0xd3, 0xb0, - 0x2d, 0x14, 0xd9, 0x72, 0x67, 0x69, 0x37, 0x95, 0x12, 0x35, 0x16, 0x5c, 0xc5, 0xb8, 0x53, 0xa0, - 0x2d, 0x1e, 0xae, 0x32, 0x5c, 0x97, 0x69, 0x24, 0xe4, 0x26, 0x5e, 0xc9, 0x95, 0x8c, 0x0d, 0x4e, - 0xcb, 0xa5, 0x51, 0x46, 0x98, 0xa7, 0xfa, 0xf5, 0xc1, 0x17, 0x42, 0x1f, 0xbf, 0x03, 0xdc, 0x70, - 0x95, 0xc0, 0xe7, 0x12, 0x34, 0xb2, 0x31, 0xbd, 0x37, 0x03, 0xe4, 0x6e, 0x1a, 0x90, 0xf0, 0x66, - 0xe4, 0x45, 0x4d, 0x4d, 0xeb, 0xff, 0xf1, 0xa6, 0xc0, 0x17, 0x50, 0x4c, 0xae, 0xf7, 0xc7, 0xfe, - 0xd5, 0xe1, 0xd8, 0x27, 0x89, 0x49, 0xb0, 0xb7, 0xd4, 0x79, 0x6f, 0x1a, 0xba, 0xc2, 0x64, 0x07, - 0xe7, 0x59, 0xe3, 0x66, 0x82, 0x63, 0x26, 0xf3, 0xff, 0xce, 0xb0, 0xd9, 0xc1, 0x57, 0x42, 0x6f, - 0x67, 0x80, 0x45, 0x26, 0xf4, 0xa5, 0x54, 0x7a, 0x4e, 0x9f, 0xb4, 0x8d, 0xb4, 0x92, 0xb9, 0x06, - 0xe6, 0xd2, 0x07, 0x16, 0xb9, 0x24, 0xb8, 0x1b, 0x3e, 0x4a, 0x1a, 0x69, 0x26, 0x3a, 0x05, 0xfe, - 0x09, 0xd7, 0x97, 0x52, 0x7f, 0x42, 0x6f, 0x9b, 0x42, 0x7f, 0xdb, 0xd7, 0x64, 0xe7, 0x92, 0x80, - 0x84, 0xd7, 0x49, 0x23, 0x59, 0x8f, 0x3a, 0x73, 0xe4, 0x58, 0x6a, 0xf7, 0x4e, 0x40, 0xc2, 0x87, - 0x89, 0x55, 0xa3, 0xef, 0xa4, 0x31, 0xd8, 0x4b, 0xea, 0xd4, 0x1b, 0xc3, 0x3a, 0x91, 0x59, 0xda, - 0xe8, 0x64, 0x81, 0xbc, 0x4e, 0xd4, 0x6e, 0x66, 0x34, 0x57, 0x05, 0xf0, 0xc5, 0x8c, 0x2b, 0x36, - 0x6e, 0x07, 0xc6, 0xba, 0x36, 0x76, 0xfa, 0x97, 0xbd, 0xde, 0x39, 0xb6, 0x65, 0x5f, 0xd1, 0x9b, - 0xba, 0xdd, 0x9b, 0x35, 0x88, 0x8f, 0xed, 0x47, 0x4f, 0x66, 0xec, 0x75, 0xcf, 0x68, 0x9d, 0x9d, - 0xbc, 0xde, 0x57, 0x3e, 0x39, 0x54, 0x3e, 0xf9, 0x51, 0xf9, 0xe4, 0x67, 0xe5, 0x93, 0x6f, 0xbf, - 0xfc, 0xab, 0x0f, 0xcf, 0xfe, 0xb9, 0x23, 0xb9, 0x56, 0x42, 0x0c, 0x17, 0xb0, 0x8d, 0x73, 0x90, - 0x4b, 0x3d, 0xac, 0x6f, 0x88, 0x39, 0x2c, 0x75, 0x8c, 0x78, 0xf1, 0x3b, 0x00, 0x00, 0xff, 0xff, - 0x78, 0x9b, 0x96, 0xe5, 0xb1, 0x03, 0x00, 0x00, + // 459 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x94, 0xbf, 0x6e, 0xdb, 0x30, + 0x10, 0xc6, 0xc3, 0xfe, 0x51, 0xd3, 0xb3, 0x9b, 0x02, 0x8c, 0x6d, 0x08, 0x1a, 0x14, 0xc3, 0x43, + 0x60, 0xa0, 0xb0, 0x04, 0xa4, 0x2d, 0x10, 0x14, 0x9d, 0x9c, 0x0c, 0x59, 0xdc, 0x41, 0x01, 0x3a, + 0x74, 0xa3, 0xe4, 0xb3, 0x2d, 0xb4, 0x16, 0x59, 0xf1, 0x64, 0xc0, 0x0f, 0x51, 0xb4, 0x63, 0x1f, + 0x29, 0x63, 0xc6, 0x4e, 0x41, 0xe1, 0x8e, 0x7d, 0x89, 0x22, 0x24, 0xe5, 0xda, 0xce, 0x0b, 0x78, + 0xf3, 0xf7, 0x3b, 0x7d, 0xf4, 0x77, 0xe4, 0x91, 0x70, 0xac, 0x49, 0x10, 0xc6, 0x1a, 0xcb, 0x45, + 0x9e, 0x61, 0xa4, 0x4a, 0x49, 0x92, 0x3f, 0x35, 0x30, 0xe0, 0x8e, 0xc6, 0x73, 0x24, 0x61, 0x4b, + 0x41, 0xab, 0x66, 0x0b, 0x2c, 0xf3, 0xc9, 0xd2, 0xd1, 0x76, 0x2a, 0x25, 0x69, 0x2a, 0x85, 0x8a, + 0x69, 0xa9, 0x50, 0x3b, 0x3c, 0x98, 0xe6, 0x34, 0xab, 0xd2, 0x28, 0x93, 0xf3, 0x78, 0x2a, 0xa7, + 0x32, 0x36, 0x38, 0xad, 0x26, 0x46, 0x19, 0x61, 0x7e, 0xd9, 0xcf, 0x7b, 0xdf, 0x19, 0xbc, 0xf8, + 0x80, 0x34, 0x17, 0x2a, 0xc1, 0xaf, 0x15, 0x6a, 0xe2, 0xe7, 0xf0, 0x64, 0x84, 0x24, 0xfc, 0xb4, + 0xcb, 0xfa, 0x8d, 0xb3, 0x20, 0xaa, 0x63, 0xba, 0xfa, 0x7d, 0xed, 0x0a, 0xc5, 0x18, 0xcb, 0xe1, + 0xe1, 0xcd, 0xdd, 0xc9, 0xc1, 0xed, 0xdd, 0x09, 0x4b, 0x8c, 0x83, 0x5f, 0x82, 0xf7, 0xd1, 0x24, + 0xf4, 0x33, 0xe3, 0xed, 0xed, 0x7a, 0x4d, 0x35, 0xcf, 0x04, 0xe5, 0xb2, 0x78, 0xb0, 0x86, 0xf3, + 0xf6, 0x7e, 0x30, 0x38, 0x1a, 0x21, 0x95, 0x79, 0xa6, 0xf7, 0x25, 0xd2, 0x2b, 0x78, 0xb9, 0x4e, + 0xa4, 0x95, 0x2c, 0x34, 0x72, 0x1f, 0x9e, 0x39, 0xe4, 0xb3, 0xee, 0xe3, 0x7e, 0x33, 0xa9, 0xa5, + 0xd9, 0xd1, 0x2b, 0x14, 0x5f, 0x68, 0xb6, 0x2f, 0xf1, 0x87, 0x70, 0x54, 0x07, 0xfa, 0x9f, 0xde, + 0x92, 0xa5, 0xcf, 0xba, 0xac, 0x7f, 0x98, 0xd4, 0x92, 0x77, 0xc0, 0xbb, 0x26, 0x41, 0x95, 0xf6, + 0x1f, 0x75, 0x59, 0xff, 0x79, 0xe2, 0x54, 0xef, 0x1b, 0x83, 0xc6, 0x65, 0x35, 0xdf, 0x9b, 0x29, + 0x39, 0x85, 0xa6, 0x8d, 0xe3, 0x3a, 0xea, 0x80, 0x77, 0x21, 0x8b, 0x49, 0x3e, 0x35, 0x0d, 0x35, + 0x13, 0xa7, 0xce, 0xfe, 0xb2, 0xba, 0x21, 0xfe, 0x06, 0x3c, 0x3b, 0xe9, 0xbc, 0x15, 0x99, 0xcb, + 0x16, 0x6d, 0x0d, 0x7e, 0xd0, 0x8a, 0xd6, 0x37, 0x2a, 0xba, 0x56, 0x25, 0x8a, 0xf1, 0x48, 0x28, + 0x7e, 0xbe, 0x3e, 0x68, 0xde, 0x76, 0xb6, 0xed, 0xe9, 0x0c, 0x3a, 0xbb, 0xd8, 0x45, 0x7a, 0x07, + 0x0d, 0xbb, 0xab, 0x17, 0x33, 0xcc, 0x3e, 0xaf, 0xff, 0x74, 0x6b, 0x36, 0x82, 0xf6, 0x0e, 0x75, + 0xde, 0xb7, 0x00, 0xf7, 0xed, 0xd9, 0x26, 0x38, 0x77, 0x1f, 0x6d, 0x1c, 0x40, 0x70, 0xbc, 0xc5, + 0xac, 0x6d, 0xf8, 0xfe, 0x66, 0x15, 0xb2, 0xdb, 0x55, 0xc8, 0x7e, 0xad, 0x42, 0xf6, 0x7b, 0x15, + 0xb2, 0x9f, 0x7f, 0xc2, 0x83, 0x4f, 0xa7, 0x1b, 0x4f, 0x42, 0xa1, 0x55, 0x96, 0x0d, 0xc6, 0xb8, + 0x88, 0x0b, 0x94, 0x13, 0x3d, 0xb0, 0x0f, 0x82, 0x59, 0x2a, 0xf5, 0x8c, 0x78, 0xfd, 0x2f, 0x00, + 0x00, 0xff, 0xff, 0x88, 0xd9, 0x75, 0x33, 0xa0, 0x04, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -308,6 +398,10 @@ type StatusClient interface { // HealthCheck request allows to check health status of the node. // If node unhealthy field Status would contains detailed info. HealthCheck(ctx context.Context, in *HealthRequest, opts ...grpc.CallOption) (*HealthResponse, error) + // DumpConfig request allows dumping settings for the current node. + // To permit access, used server config options. + // The request should be signed. + DumpConfig(ctx context.Context, in *DumpRequest, opts ...grpc.CallOption) (*DumpResponse, error) } type statusClient struct { @@ -345,6 +439,15 @@ func (c *statusClient) HealthCheck(ctx context.Context, in *HealthRequest, opts return out, nil } +func (c *statusClient) DumpConfig(ctx context.Context, in *DumpRequest, opts ...grpc.CallOption) (*DumpResponse, error) { + out := new(DumpResponse) + err := c.cc.Invoke(ctx, "/state.Status/DumpConfig", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // StatusServer is the server API for Status service. type StatusServer interface { // Netmap request allows to receive current [bootstrap.SpreadMap](bootstrap.md#bootstrap.SpreadMap) @@ -354,6 +457,10 @@ type StatusServer interface { // HealthCheck request allows to check health status of the node. // If node unhealthy field Status would contains detailed info. HealthCheck(context.Context, *HealthRequest) (*HealthResponse, error) + // DumpConfig request allows dumping settings for the current node. + // To permit access, used server config options. + // The request should be signed. + DumpConfig(context.Context, *DumpRequest) (*DumpResponse, error) } // UnimplementedStatusServer can be embedded to have forward compatible implementations. @@ -369,6 +476,9 @@ func (*UnimplementedStatusServer) Metrics(ctx context.Context, req *MetricsReque func (*UnimplementedStatusServer) HealthCheck(ctx context.Context, req *HealthRequest) (*HealthResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method HealthCheck not implemented") } +func (*UnimplementedStatusServer) DumpConfig(ctx context.Context, req *DumpRequest) (*DumpResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DumpConfig not implemented") +} func RegisterStatusServer(s *grpc.Server, srv StatusServer) { s.RegisterService(&_Status_serviceDesc, srv) @@ -428,6 +538,24 @@ func _Status_HealthCheck_Handler(srv interface{}, ctx context.Context, dec func( return interceptor(ctx, in, info, handler) } +func _Status_DumpConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DumpRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(StatusServer).DumpConfig(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/state.Status/DumpConfig", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(StatusServer).DumpConfig(ctx, req.(*DumpRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _Status_serviceDesc = grpc.ServiceDesc{ ServiceName: "state.Status", HandlerType: (*StatusServer)(nil), @@ -444,6 +572,10 @@ var _Status_serviceDesc = grpc.ServiceDesc{ MethodName: "HealthCheck", Handler: _Status_HealthCheck_Handler, }, + { + MethodName: "DumpConfig", + Handler: _Status_DumpConfig_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "state/service.proto", @@ -682,6 +814,91 @@ func (m *HealthResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *DumpRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *DumpRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DumpRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + { + size, err := m.RequestVerificationHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x9a + { + size, err := m.RequestMetaHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x92 + return len(dAtA) - i, nil +} + +func (m *DumpResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *DumpResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DumpResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Config) > 0 { + i -= len(m.Config) + copy(dAtA[i:], m.Config) + i = encodeVarintService(dAtA, i, uint64(len(m.Config))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func encodeVarintService(dAtA []byte, offset int, v uint64) int { offset -= sovService(v) base := offset @@ -778,6 +995,38 @@ func (m *HealthResponse) Size() (n int) { return n } +func (m *DumpRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.RequestMetaHeader.Size() + n += 2 + l + sovService(uint64(l)) + l = m.RequestVerificationHeader.Size() + n += 2 + l + sovService(uint64(l)) + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *DumpResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Config) + if l > 0 { + n += 1 + l + sovService(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + func sovService(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -1336,6 +1585,214 @@ func (m *HealthResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *DumpRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DumpRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DumpRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 98: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RequestMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 99: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestVerificationHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RequestVerificationHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DumpResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DumpResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DumpResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Config", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Config = append(m.Config[:0], dAtA[iNdEx:postIndex]...) + if m.Config == nil { + m.Config = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipService(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/state/service.proto b/state/service.proto index ed90e26..a30af22 100644 --- a/state/service.proto +++ b/state/service.proto @@ -18,6 +18,10 @@ service Status { // HealthCheck request allows to check health status of the node. // If node unhealthy field Status would contains detailed info. rpc HealthCheck(HealthRequest) returns (HealthResponse); + // DumpConfig request allows dumping settings for the current node. + // To permit access, used server config options. + // The request should be signed. + rpc DumpConfig(DumpRequest) returns (DumpResponse); } // NetmapRequest message to request current node netmap @@ -58,3 +62,17 @@ message HealthResponse { // Status contains detailed information about health status string Status = 2; } + +// DumpRequest message to fetch current server config. +message DumpRequest { + // RequestMetaHeader contains information about request meta headers (should be embedded into message) + service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) + service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; +} + +// DumpResponse message contains current server config. +// Config stored in JSON encoded into slice of bytes. +message DumpResponse { + bytes Config = 1; +} From 55b9a2447c3b84bb2766464b3f06e8be1e81331b Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Tue, 17 Dec 2019 14:09:52 +0300 Subject: [PATCH 0055/1196] state: add method to encode config into response message --- go.mod | 1 + go.sum | 96 ++++++++++++++++++++++++++++++++++++++++++++++++ state/service.go | 14 +++++++ 3 files changed, 111 insertions(+) diff --git a/go.mod b/go.mod index dc07a30..fd114d3 100644 --- a/go.mod +++ b/go.mod @@ -13,6 +13,7 @@ require ( github.com/pkg/errors v0.8.1 github.com/prometheus/client_golang v1.2.1 github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4 + github.com/spf13/viper v1.6.1 github.com/stretchr/testify v1.4.0 golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550 google.golang.org/grpc v1.24.0 diff --git a/go.sum b/go.sum index 13842ce..db7763e 100644 --- a/go.sum +++ b/go.sum @@ -1,61 +1,100 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/abiosoft/ishell v2.0.0+incompatible/go.mod h1:HQR9AqF2R3P4XXpMpI0NAzgHf/aS6+zVXRj14cVk9qg= github.com/abiosoft/readline v0.0.0-20180607040430-155bce2042db/go.mod h1:rB3B4rKii8V21ydCbIzH5hZiCQE7f5E9SzUb/ZZx530= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= github.com/awalterschulze/gographviz v0.0.0-20181013152038-b2885df04310 h1:t+qxRrRtwNiUYA+Xh2jSXhoG2grnMCMKX4Fg6lx9X1U= github.com/awalterschulze/gographviz v0.0.0-20181013152038-b2885df04310/go.mod h1:GEV5wmg4YquNw7v1kkyoX9etIk8yVmXj+AkDHuuETHs= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= +github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= +github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.0 h1:yTUvW7Vhb89inJ+8irsUqiWjh8iT6sQPZiQzI6ReGkA= github.com/cespare/xxhash/v2 v2.1.0/go.mod h1:dgIUBU3pDso/gPgZ1osOZ0iQf77oPR28Tjxl5dIMyVM= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= +github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= +github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= +github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= +github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= +github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/flynn-archive/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:rZfgFAXFS/z/lEd6LJmf9HVZ1LkgYiHx5pHhV5DR16M= +github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= +github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= +github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= github.com/gogo/protobuf v1.3.0/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= github.com/gogo/protobuf v1.3.1 h1:DqDEcV5aeaTmdFBePNpYsp3FlcVH/2ISVVM9Qf8PSls= github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0 h1:crn/baboCvb5fXaQ0IJ1SGTsTVrWpDsCWC8EGETZijY= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8= +github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= +github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= +github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= +github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= +github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= +github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= +github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= +github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= +github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= +github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= +github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/magiconair/properties v1.8.1 h1:ZC2Vc7/ZFkGmsVC9KvOjumD+G5lXy2RtTKyzRKO2BQ4= +github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= +github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE= +github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= @@ -75,12 +114,16 @@ github.com/nspcc-dev/rfc6979 v0.1.0 h1:Lwg7esRRoyK1Up/IN1vAef1EmvrBeMHeeEkek2fAJ github.com/nspcc-dev/rfc6979 v0.1.0/go.mod h1:exhIh1PdpDC5vQmyEsGvc4YDM/lyQp/452QxGq/UEso= github.com/nspcc-dev/tzhash v1.3.0 h1:n6FTHsfPYbMi5Jmo6SwGVVRQD8i2w1P2ScCaW6rz69Q= github.com/nspcc-dev/tzhash v1.3.0/go.mod h1:Lc4DersKS8MNIrunTmsAzANO56qnG+LZ4GOE/WYGVzU= +github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= +github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181zc= +github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= +github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.2.1 h1:JnMpQc6ppsNgw9QPAGF6Dod479itz7lvlsMzzNayLOI= github.com/prometheus/client_golang v1.2.1/go.mod h1:XMU6Z2MjaRKVu/dC1qupJI9SiNkDYzz3xecMgSW/F+U= @@ -88,39 +131,77 @@ github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1: github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4 h1:gQz4mCbXsO+nc9n1hCxHcGA3Zx3Eo+UHZoInFGUIXNM= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= +github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.7.0 h1:L+1lyG48J1zAQXA3RBX/nG/B3gjlHq0zTt2tlbJLyCY= github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt26CguLLsqA= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.5 h1:3+auTFlqw+ZaQYJARz6ArODtkaIwtvBTx3N2NehQlL8= github.com/prometheus/procfs v0.0.5/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDaekg4FpcdQ= +github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= +github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= +github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM= +github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= +github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s= +github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= +github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= +github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= +github.com/spf13/afero v1.1.2 h1:m8/z1t7/fwjysjQRYbP0RD+bUIF/8tJwPdEZsI83ACI= +github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= +github.com/spf13/cast v1.3.0 h1:oget//CVOEoFewqQxwr0Ej5yjygnqGkvggSE/gB35Q8= +github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= +github.com/spf13/jwalterweatherman v1.0.0 h1:XHEdyB+EcvlqZamSM4ZOMGlc93t6AcsBEu9Gc1vn7yk= +github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= +github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg= +github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/spf13/viper v1.6.1 h1:VPZzIkznI1YhVMRi6vNFLHSwhnhReBfgTxIPccpfdZk= +github.com/spf13/viper v1.6.1/go.mod h1:t3iDnF5Jlj76alVNuyFBk5oUMCvsrkbvZK0WQdfDi5k= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s= +github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= +github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= +github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= +github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= +github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= +go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= +go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= +go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= +go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550 h1:ObdrDkeb4kJdCP557AjRjq69pTHfNouLtWZG7j9rPN8= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3 h1:0GoQqolDA55aaLxZyTzK/Y2ePZzZTUrRacwib7cNsYQ= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190613194153-d28f0bde5980 h1:dfGZHvZk057jK2MCeWus/TowKpJ8y4AmooUzdBSR9GU= golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181228144115-9a3f9b0469bb/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -131,19 +212,34 @@ golang.org/x/sys v0.0.0-20191010194322-b09406accb47 h1:/XfQ9z7ib8eEJX2hdgFTZJ/nt golang.org/x/sys v0.0.0-20191010194322-b09406accb47/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8 h1:Nw54tB0rB7hY/N0NQvRW8DG4Yk3Q6T9cu9RcFQDu1tc= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= google.golang.org/grpc v1.24.0 h1:vb/1TCsVn3DcJlQ0Gs1yB1pKI6Do2/QNwxdKqmc/b0s= google.golang.org/grpc v1.24.0/go.mod h1:XDChyiUovWa60DnaeDeZmSW86xtLtjtZbwvSiRnRtcA= gopkg.in/abiosoft/ishell.v2 v2.0.0/go.mod h1:sFp+cGtH6o4s1FtpVPTMcHq2yue+c4DGOVohJCPUzwY= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/ini.v1 v1.51.0 h1:AQvPpx3LzTDM0AjnIRlVFwFFGC+npRopjZxLJj6gdno= +gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= +gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I= +gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/state/service.go b/state/service.go index dd2ec9b..cd7b685 100644 --- a/state/service.go +++ b/state/service.go @@ -1,9 +1,12 @@ package state import ( + "encoding/json" + "github.com/golang/protobuf/proto" "github.com/prometheus/client_golang/prometheus" dto "github.com/prometheus/client_model/go" + "github.com/spf13/viper" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" ) @@ -46,3 +49,14 @@ func DecodeMetrics(r *MetricsResponse) ([]*MetricFamily, error) { return metrics, nil } + +// EncodeConfig encodes viper settings into DumpConfig message, +// if something went wrong returns gRPC Status error (can be returned from service). +func EncodeConfig(v *viper.Viper) (*DumpResponse, error) { + data, err := json.Marshal(v.AllSettings()) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + return &DumpResponse{Config: data}, nil +} From 13bc423c455495299b1152998544f60183208825 Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Tue, 17 Dec 2019 14:30:23 +0300 Subject: [PATCH 0056/1196] CHANGELOG --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 77ba22c..d92bbfa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,11 @@ # Changelog This is the changelog for NeoFS Proto +## [0.2.6] - 2019-12-17 + +### Added +- Request to dump node config + ## [0.2.5] - 2019-12-05 ### Removed @@ -66,3 +71,4 @@ Initial public release [0.2.3]: https://github.com/nspcc-dev/neofs-proto/compare/v0.2.2...v0.2.3 [0.2.4]: https://github.com/nspcc-dev/neofs-proto/compare/v0.2.3...v0.2.4 [0.2.5]: https://github.com/nspcc-dev/neofs-proto/compare/v0.2.4...v0.2.5 +[0.2.6]: https://github.com/nspcc-dev/neofs-proto/compare/v0.2.5...v0.2.6 From 6b6728356aa258ba8c2dab8156db7724c6e66550 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 17 Dec 2019 15:35:38 +0300 Subject: [PATCH 0057/1196] Container access control type definitions --- container/service.pb.go | 129 +++++++--- container/service.proto | 3 + container/types.go | 13 + container/types.pb.go | 519 ++++++++++++++++++++++++++++++++++++++-- container/types.proto | 14 ++ 5 files changed, 618 insertions(+), 60 deletions(-) diff --git a/container/service.pb.go b/container/service.pb.go index d9febc0..cac8764 100644 --- a/container/service.pb.go +++ b/container/service.pb.go @@ -38,6 +38,8 @@ type PutRequest struct { OwnerID OwnerID `protobuf:"bytes,3,opt,name=OwnerID,proto3,customtype=OwnerID" json:"OwnerID"` // Rules define storage policy for the object inside the container. Rules netmap.PlacementRule `protobuf:"bytes,4,opt,name=rules,proto3" json:"rules"` + // Container ACL. + Group AccessGroup `protobuf:"bytes,5,opt,name=Group,proto3" json:"Group"` // RequestMetaHeader contains information about request meta headers (should be embedded into message) service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) @@ -90,6 +92,13 @@ func (m *PutRequest) GetRules() netmap.PlacementRule { return netmap.PlacementRule{} } +func (m *PutRequest) GetGroup() AccessGroup { + if m != nil { + return m.Group + } + return AccessGroup{} +} + type PutResponse struct { // CID (container id) is a SHA256 hash of the container structure CID CID `protobuf:"bytes,1,opt,name=CID,proto3,customtype=CID" json:"CID"` @@ -382,43 +391,44 @@ func init() { func init() { proto.RegisterFile("container/service.proto", fileDescriptor_e1fa9d7ab2e7ae06) } var fileDescriptor_e1fa9d7ab2e7ae06 = []byte{ - // 562 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x54, 0xcd, 0x6e, 0xd3, 0x4c, - 0x14, 0xed, 0x34, 0xf9, 0xd2, 0xe6, 0xba, 0x1f, 0x3f, 0xa3, 0x86, 0x1a, 0x4b, 0x24, 0x91, 0x57, - 0x01, 0x11, 0x5b, 0x84, 0x4a, 0xb0, 0x41, 0x82, 0x24, 0x52, 0xa9, 0x44, 0x45, 0x64, 0x24, 0x16, - 0xec, 0x1c, 0xf7, 0x26, 0x58, 0x72, 0x6c, 0xe3, 0x19, 0x07, 0xe5, 0x4d, 0x78, 0x07, 0x24, 0xb6, - 0xf0, 0x08, 0x5d, 0x76, 0x89, 0x58, 0x44, 0x28, 0xac, 0x79, 0x07, 0xe4, 0xf1, 0xf8, 0x27, 0x69, - 0x81, 0x65, 0xc5, 0xc6, 0x9a, 0x39, 0xe7, 0x9e, 0x3b, 0xf7, 0xdc, 0xb9, 0x1e, 0x38, 0x70, 0x02, - 0x9f, 0xdb, 0xae, 0x8f, 0x91, 0xc9, 0x30, 0x9a, 0xbb, 0x0e, 0x1a, 0x61, 0x14, 0xf0, 0x80, 0xd6, - 0x73, 0x42, 0xa3, 0x92, 0x31, 0x67, 0xc8, 0xed, 0x94, 0xd6, 0xf6, 0x33, 0x6c, 0x8e, 0x91, 0x3b, - 0x59, 0x48, 0xb4, 0x51, 0x64, 0xe3, 0x8b, 0x10, 0x99, 0x84, 0xef, 0x4d, 0x5d, 0xfe, 0x36, 0x1e, - 0x1b, 0x4e, 0x30, 0x33, 0x7d, 0x16, 0x3a, 0x4e, 0xf7, 0x14, 0xe7, 0xa6, 0x8f, 0x7c, 0x66, 0x87, - 0x26, 0x43, 0x0f, 0x1d, 0x1e, 0x44, 0x32, 0xb6, 0x5b, 0x8a, 0x9d, 0x06, 0xd3, 0xc0, 0x14, 0xf0, - 0x38, 0x9e, 0x88, 0x9d, 0xd8, 0x88, 0x55, 0x1a, 0xae, 0x7f, 0xde, 0x06, 0x18, 0xc5, 0xdc, 0xc2, - 0x77, 0x31, 0x32, 0x4e, 0x4d, 0xa8, 0x9f, 0x20, 0x63, 0xf6, 0x14, 0x8f, 0x87, 0x2a, 0x69, 0x93, - 0xce, 0x5e, 0xff, 0xe6, 0xd9, 0xb2, 0xb5, 0xf5, 0x6d, 0xd9, 0x2a, 0x08, 0xab, 0x58, 0x52, 0x0d, - 0x76, 0x07, 0x76, 0x68, 0x3b, 0x2e, 0x5f, 0xa8, 0xdb, 0x6d, 0xd2, 0xa9, 0x5a, 0xf9, 0x9e, 0xde, - 0x85, 0x9d, 0x97, 0xef, 0x7d, 0x8c, 0x8e, 0x87, 0x6a, 0x45, 0xa4, 0xba, 0x2e, 0x53, 0x65, 0xb0, - 0x95, 0x2d, 0xe8, 0x03, 0xf8, 0x2f, 0x8a, 0x3d, 0x64, 0x6a, 0xb5, 0x4d, 0x3a, 0x4a, 0xaf, 0x61, - 0xa4, 0xe6, 0x8c, 0x91, 0x67, 0x3b, 0x38, 0x43, 0x9f, 0x5b, 0xb1, 0x87, 0xfd, 0x6a, 0xa2, 0xb7, - 0xd2, 0x48, 0xfa, 0x18, 0xaa, 0x27, 0xc8, 0x6d, 0x75, 0x2c, 0x14, 0x9a, 0x91, 0xb5, 0x5f, 0x5a, - 0x49, 0xb8, 0xe7, 0x68, 0x9f, 0x62, 0xd4, 0xdf, 0x4d, 0x64, 0xe7, 0xcb, 0x16, 0xb1, 0x84, 0x82, - 0x0e, 0xa1, 0xf6, 0x5a, 0x74, 0x5d, 0x75, 0x84, 0x56, 0xdf, 0xd4, 0x0a, 0xd6, 0x75, 0x6c, 0xee, - 0x06, 0xfe, 0x85, 0x1c, 0x52, 0xab, 0xdf, 0x07, 0x45, 0x34, 0x8e, 0x85, 0x81, 0xcf, 0x90, 0xde, - 0x81, 0xca, 0x20, 0xef, 0x99, 0x22, 0x8d, 0x26, 0x90, 0x95, 0x7c, 0xf4, 0x4f, 0x04, 0xfe, 0x1f, - 0xa2, 0x87, 0x1c, 0xb3, 0x56, 0xff, 0x59, 0x70, 0xe5, 0xf6, 0x6e, 0xc0, 0xb5, 0xac, 0xde, 0xd4, - 0xa1, 0xfe, 0x91, 0x00, 0x1c, 0x21, 0xff, 0x47, 0xea, 0x7f, 0x06, 0x8a, 0x28, 0x56, 0x5e, 0x4f, - 0x0f, 0xea, 0x83, 0xec, 0xdf, 0x12, 0x35, 0x2b, 0xbd, 0x7d, 0x23, 0xff, 0xdb, 0x8c, 0x9c, 0xb3, - 0x8a, 0x30, 0xfd, 0x0b, 0x01, 0xe5, 0x85, 0xcb, 0x72, 0xc7, 0xa5, 0x79, 0x26, 0x7f, 0x99, 0xe7, - 0xab, 0x76, 0xdf, 0x85, 0xbd, 0xb4, 0xf2, 0xcd, 0xe9, 0xac, 0x5c, 0x76, 0x59, 0xbd, 0x9f, 0x04, - 0x76, 0x5e, 0xa5, 0xc7, 0xd0, 0x43, 0xa8, 0x8c, 0x62, 0x4e, 0x1b, 0xa5, 0xee, 0x14, 0x0f, 0x84, - 0x76, 0x6b, 0x13, 0x96, 0x07, 0x3c, 0x81, 0x5a, 0x3a, 0x2e, 0x54, 0x2d, 0x45, 0xac, 0x4d, 0xbc, - 0x76, 0xfb, 0x12, 0x46, 0xca, 0x0f, 0xa1, 0x72, 0x84, 0xeb, 0x87, 0x16, 0xa3, 0xb6, 0x76, 0x68, - 0xf9, 0x52, 0x1f, 0x41, 0x35, 0x71, 0x49, 0xcb, 0x7c, 0xe9, 0xc2, 0xb4, 0x83, 0x0b, 0x78, 0x2a, - 0xec, 0x3f, 0x3d, 0x5b, 0x35, 0xc9, 0xf9, 0xaa, 0x49, 0xbe, 0xae, 0x9a, 0xe4, 0xfb, 0xaa, 0x49, - 0x3e, 0xfc, 0x68, 0x6e, 0xbd, 0xf9, 0xdd, 0x33, 0x1b, 0x4c, 0x58, 0x37, 0x7d, 0x38, 0xf3, 0x74, - 0xe3, 0x9a, 0x00, 0x1e, 0xfe, 0x0a, 0x00, 0x00, 0xff, 0xff, 0x36, 0x72, 0xbd, 0x89, 0x00, 0x06, - 0x00, 0x00, + // 580 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x54, 0xcb, 0x6e, 0xd3, 0x40, + 0x14, 0xed, 0x34, 0xe9, 0x23, 0xd7, 0xe5, 0x35, 0x6a, 0x5a, 0x63, 0x89, 0x24, 0xf2, 0x2a, 0x20, + 0x62, 0x8b, 0x50, 0x09, 0x36, 0x48, 0x34, 0x89, 0x14, 0x2a, 0x51, 0x11, 0x19, 0x89, 0x05, 0x3b, + 0x67, 0x7a, 0x13, 0x2c, 0x25, 0xb6, 0xf1, 0x8c, 0x83, 0xf2, 0x27, 0xfc, 0x03, 0x12, 0x6b, 0x3e, + 0xa1, 0xcb, 0x2e, 0x11, 0x8b, 0x08, 0x85, 0x25, 0xe2, 0x1f, 0x90, 0xc7, 0xcf, 0xa4, 0x05, 0x96, + 0x15, 0x1b, 0x6b, 0xe6, 0x9c, 0x7b, 0xee, 0xdb, 0x03, 0x87, 0xcc, 0x73, 0x85, 0xed, 0xb8, 0x18, + 0x98, 0x1c, 0x83, 0x99, 0xc3, 0xd0, 0xf0, 0x03, 0x4f, 0x78, 0xb4, 0x92, 0x11, 0x1a, 0x4d, 0x18, + 0x73, 0x8a, 0xc2, 0x8e, 0x69, 0x6d, 0x3f, 0xc5, 0x66, 0x18, 0x38, 0xa3, 0x79, 0x82, 0x56, 0x73, + 0x6f, 0x62, 0xee, 0x23, 0x4f, 0xe0, 0x07, 0x63, 0x47, 0xbc, 0x0b, 0x87, 0x06, 0xf3, 0xa6, 0xa6, + 0xcb, 0x7d, 0xc6, 0x5a, 0x67, 0x38, 0x33, 0x5d, 0x14, 0x53, 0xdb, 0x37, 0x39, 0x4e, 0x90, 0x09, + 0x2f, 0x48, 0x6c, 0x5b, 0x05, 0xdb, 0xb1, 0x37, 0xf6, 0x4c, 0x09, 0x0f, 0xc3, 0x91, 0xbc, 0xc9, + 0x8b, 0x3c, 0xc5, 0xe6, 0xfa, 0xcf, 0x4d, 0x80, 0x41, 0x28, 0x2c, 0x7c, 0x1f, 0x22, 0x17, 0xd4, + 0x84, 0xca, 0x29, 0x72, 0x6e, 0x8f, 0xf1, 0xa4, 0xa7, 0x92, 0x06, 0x69, 0xee, 0x75, 0xee, 0x9c, + 0x2f, 0xea, 0x1b, 0xdf, 0x16, 0xf5, 0x9c, 0xb0, 0xf2, 0x23, 0xd5, 0x60, 0xb7, 0x6b, 0xfb, 0x36, + 0x73, 0xc4, 0x5c, 0xdd, 0x6c, 0x90, 0x66, 0xd9, 0xca, 0xee, 0xf4, 0x3e, 0xec, 0xbc, 0xfa, 0xe0, + 0x62, 0x70, 0xd2, 0x53, 0x4b, 0xd2, 0xd5, 0xad, 0xc4, 0x55, 0x0a, 0x5b, 0xe9, 0x81, 0x3e, 0x82, + 0xad, 0x20, 0x9c, 0x20, 0x57, 0xcb, 0x0d, 0xd2, 0x54, 0xda, 0x55, 0x23, 0x2e, 0xce, 0x18, 0x4c, + 0x6c, 0x86, 0x53, 0x74, 0x85, 0x15, 0x4e, 0xb0, 0x53, 0x8e, 0xf4, 0x56, 0x6c, 0x49, 0xdb, 0xb0, + 0xd5, 0x0f, 0xbc, 0xd0, 0x57, 0xb7, 0xa4, 0xe4, 0xc0, 0xc8, 0x7a, 0x67, 0x1c, 0x33, 0x86, 0x9c, + 0x4b, 0x36, 0xd5, 0xc8, 0x0b, 0x7d, 0x0a, 0xe5, 0x53, 0x14, 0xb6, 0x3a, 0x94, 0x12, 0xcd, 0x48, + 0x47, 0x96, 0x94, 0x1f, 0x71, 0x2f, 0xd0, 0x3e, 0xc3, 0xa0, 0xb3, 0x1b, 0xc9, 0x2e, 0x16, 0x75, + 0x62, 0x49, 0x05, 0xed, 0xc1, 0xf6, 0x1b, 0x39, 0x29, 0x95, 0x49, 0xad, 0xbe, 0xae, 0x95, 0xac, + 0xc3, 0x6c, 0xe1, 0x78, 0xee, 0x25, 0x1f, 0x89, 0x56, 0x7f, 0x08, 0x8a, 0x6c, 0x36, 0xf7, 0x3d, + 0x97, 0x23, 0xbd, 0x07, 0xa5, 0x6e, 0xd6, 0x67, 0x25, 0x69, 0x4e, 0x04, 0x59, 0xd1, 0x47, 0xff, + 0x4c, 0xe0, 0x46, 0x0f, 0x27, 0x28, 0x30, 0x1d, 0xcf, 0xdf, 0x05, 0xd7, 0x5e, 0xde, 0x6d, 0xb8, + 0x99, 0xe6, 0x1b, 0x57, 0xa8, 0x7f, 0x22, 0x00, 0x7d, 0x14, 0xff, 0x49, 0xfe, 0xc7, 0xa0, 0xc8, + 0x64, 0x93, 0xf1, 0xb4, 0xa1, 0xd2, 0x4d, 0x77, 0x4a, 0xe6, 0xac, 0xb4, 0xf7, 0x0b, 0x5b, 0x96, + 0x71, 0x56, 0x6e, 0xa6, 0x7f, 0x21, 0xa0, 0xbc, 0x74, 0x78, 0x56, 0x71, 0xe1, 0x1f, 0x20, 0xff, + 0xf8, 0x07, 0xae, 0xbb, 0xfa, 0x16, 0xec, 0xc5, 0x99, 0xaf, 0x6f, 0x67, 0xe9, 0xaa, 0x61, 0xb5, + 0x7f, 0x11, 0xd8, 0x79, 0x1d, 0x87, 0xa1, 0x47, 0x50, 0x1a, 0x84, 0x82, 0x56, 0x0b, 0xdd, 0xc9, + 0x1f, 0x15, 0xed, 0x60, 0x1d, 0x4e, 0x02, 0x3c, 0x83, 0xed, 0x78, 0x5d, 0xa8, 0x5a, 0xb0, 0x58, + 0xd9, 0x78, 0xed, 0xee, 0x15, 0x4c, 0x22, 0x3f, 0x82, 0x52, 0x1f, 0x57, 0x83, 0xe6, 0xab, 0xb6, + 0x12, 0xb4, 0x38, 0xd4, 0x27, 0x50, 0x8e, 0xaa, 0xa4, 0x45, 0xbe, 0x30, 0x30, 0xed, 0xf0, 0x12, + 0x1e, 0x0b, 0x3b, 0xcf, 0xcf, 0x97, 0x35, 0x72, 0xb1, 0xac, 0x91, 0xaf, 0xcb, 0x1a, 0xf9, 0xbe, + 0xac, 0x91, 0x8f, 0x3f, 0x6a, 0x1b, 0x6f, 0xff, 0xf4, 0x34, 0x7b, 0x23, 0xde, 0x8a, 0x1f, 0xdb, + 0xcc, 0xdd, 0x70, 0x5b, 0x02, 0x8f, 0x7f, 0x07, 0x00, 0x00, 0xff, 0xff, 0x31, 0xf8, 0x4f, 0x34, + 0x34, 0x06, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -671,6 +681,16 @@ func (m *PutRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x6 i-- dAtA[i] = 0x92 + { + size, err := m.Group.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a { size, err := m.Rules.MarshalToSizedBuffer(dAtA[:i]) if err != nil { @@ -1062,6 +1082,8 @@ func (m *PutRequest) Size() (n int) { n += 1 + l + sovService(uint64(l)) l = m.Rules.Size() n += 1 + l + sovService(uint64(l)) + l = m.Group.Size() + n += 1 + l + sovService(uint64(l)) l = m.RequestMetaHeader.Size() n += 2 + l + sovService(uint64(l)) l = m.RequestVerificationHeader.Size() @@ -1339,6 +1361,39 @@ func (m *PutRequest) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Group", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Group.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex case 98: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType) diff --git a/container/service.proto b/container/service.proto index 8a3f56c..9bd02c9 100644 --- a/container/service.proto +++ b/container/service.proto @@ -41,6 +41,9 @@ message PutRequest { // Rules define storage policy for the object inside the container. netmap.PlacementRule rules = 4 [(gogoproto.nullable) = false]; + // Container ACL. + AccessGroup Group = 5 [(gogoproto.nullable) = false]; + // RequestMetaHeader contains information about request meta headers (should be embedded into message) service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) diff --git a/container/types.go b/container/types.go index 9269f30..d5d5a77 100644 --- a/container/types.go +++ b/container/types.go @@ -11,6 +11,19 @@ import ( "github.com/pkg/errors" ) +// AccessMode is a container access mode type. +type AccessMode uint32 + +const ( + // AccessModeRead is a read access mode. + AccessModeRead AccessMode = 1 << iota + // AccessModeWrite is a write access mode. + AccessModeWrite +) + +// AccessModeReadWrite is a read/write container access mode. +const AccessModeReadWrite = AccessModeRead | AccessModeWrite + var ( _ internal.Custom = (*Container)(nil) diff --git a/container/types.pb.go b/container/types.pb.go index 7bf9a03..6671670 100644 --- a/container/types.pb.go +++ b/container/types.pb.go @@ -33,10 +33,12 @@ type Container struct { // Capacity defines amount of data that can be stored in the container (doesn't used for now). Capacity uint64 `protobuf:"varint,3,opt,name=Capacity,proto3" json:"Capacity,omitempty"` // Rules define storage policy for the object inside the container. - Rules netmap.PlacementRule `protobuf:"bytes,4,opt,name=Rules,proto3" json:"Rules"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Rules netmap.PlacementRule `protobuf:"bytes,4,opt,name=Rules,proto3" json:"Rules"` + // Container ACL. + List AccessControlList `protobuf:"bytes,5,opt,name=List,proto3" json:"List"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *Container) Reset() { *m = Container{} } @@ -82,32 +84,136 @@ func (m *Container) GetRules() netmap.PlacementRule { return netmap.PlacementRule{} } +func (m *Container) GetList() AccessControlList { + if m != nil { + return m.List + } + return AccessControlList{} +} + +type AccessGroup struct { + // Group access mode. + M uint32 `protobuf:"varint,1,opt,name=M,proto3" json:"M,omitempty"` + // Group members. + G []OwnerID `protobuf:"bytes,2,rep,name=G,proto3,customtype=OwnerID" json:"G"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *AccessGroup) Reset() { *m = AccessGroup{} } +func (m *AccessGroup) String() string { return proto.CompactTextString(m) } +func (*AccessGroup) ProtoMessage() {} +func (*AccessGroup) Descriptor() ([]byte, []int) { + return fileDescriptor_1432e52ab0b53e3e, []int{1} +} +func (m *AccessGroup) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AccessGroup) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *AccessGroup) XXX_Merge(src proto.Message) { + xxx_messageInfo_AccessGroup.Merge(m, src) +} +func (m *AccessGroup) XXX_Size() int { + return m.Size() +} +func (m *AccessGroup) XXX_DiscardUnknown() { + xxx_messageInfo_AccessGroup.DiscardUnknown(m) +} + +var xxx_messageInfo_AccessGroup proto.InternalMessageInfo + +func (m *AccessGroup) GetM() uint32 { + if m != nil { + return m.M + } + return 0 +} + +type AccessControlList struct { + // List of access groups. + List []AccessGroup `protobuf:"bytes,1,rep,name=List,proto3" json:"List"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *AccessControlList) Reset() { *m = AccessControlList{} } +func (m *AccessControlList) String() string { return proto.CompactTextString(m) } +func (*AccessControlList) ProtoMessage() {} +func (*AccessControlList) Descriptor() ([]byte, []int) { + return fileDescriptor_1432e52ab0b53e3e, []int{2} +} +func (m *AccessControlList) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AccessControlList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *AccessControlList) XXX_Merge(src proto.Message) { + xxx_messageInfo_AccessControlList.Merge(m, src) +} +func (m *AccessControlList) XXX_Size() int { + return m.Size() +} +func (m *AccessControlList) XXX_DiscardUnknown() { + xxx_messageInfo_AccessControlList.DiscardUnknown(m) +} + +var xxx_messageInfo_AccessControlList proto.InternalMessageInfo + +func (m *AccessControlList) GetList() []AccessGroup { + if m != nil { + return m.List + } + return nil +} + func init() { proto.RegisterType((*Container)(nil), "container.Container") + proto.RegisterType((*AccessGroup)(nil), "container.AccessGroup") + proto.RegisterType((*AccessControlList)(nil), "container.AccessControlList") } func init() { proto.RegisterFile("container/types.proto", fileDescriptor_1432e52ab0b53e3e) } var fileDescriptor_1432e52ab0b53e3e = []byte{ - // 275 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x4d, 0xce, 0xcf, 0x2b, - 0x49, 0xcc, 0xcc, 0x4b, 0x2d, 0xd2, 0x2f, 0xa9, 0x2c, 0x48, 0x2d, 0xd6, 0x2b, 0x28, 0xca, 0x2f, - 0xc9, 0x17, 0xe2, 0x84, 0x0b, 0x4b, 0x69, 0xa5, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, - 0xe7, 0xea, 0xe7, 0x15, 0x17, 0x24, 0x27, 0xeb, 0xa6, 0xa4, 0x96, 0xe9, 0xe7, 0xa5, 0x96, 0xe4, - 0x26, 0x16, 0xe8, 0x17, 0xa7, 0xe6, 0xa4, 0x26, 0x97, 0xe4, 0x17, 0x41, 0xb4, 0x49, 0xe9, 0x22, - 0xa9, 0x4d, 0xcf, 0x4f, 0xcf, 0xd7, 0x07, 0x0b, 0x27, 0x95, 0xa6, 0x81, 0x79, 0x60, 0x0e, 0x98, - 0x05, 0x51, 0xae, 0xb4, 0x9c, 0x91, 0x8b, 0xd3, 0x19, 0x66, 0x91, 0x90, 0x26, 0x17, 0xbb, 0x7f, - 0x79, 0x5e, 0x6a, 0x91, 0xa7, 0x8b, 0x04, 0xa3, 0x02, 0xa3, 0x06, 0x8f, 0x13, 0xff, 0x89, 0x7b, - 0xf2, 0x0c, 0xb7, 0xee, 0xc9, 0xc3, 0x84, 0x83, 0x60, 0x0c, 0x21, 0x05, 0x2e, 0x96, 0xe0, 0xc4, - 0x9c, 0x12, 0x09, 0x26, 0xb0, 0x3a, 0x1e, 0xa8, 0x3a, 0x96, 0xd0, 0x50, 0x4f, 0x97, 0x20, 0xb0, - 0x8c, 0x90, 0x14, 0x17, 0x87, 0x73, 0x62, 0x41, 0x62, 0x72, 0x66, 0x49, 0xa5, 0x04, 0xb3, 0x02, - 0xa3, 0x06, 0x4b, 0x10, 0x9c, 0x2f, 0x64, 0xc8, 0xc5, 0x1a, 0x54, 0x9a, 0x93, 0x5a, 0x2c, 0xc1, - 0xa2, 0xc0, 0xa8, 0xc1, 0x6d, 0x24, 0xaa, 0x07, 0xf1, 0x8c, 0x5e, 0x40, 0x4e, 0x62, 0x72, 0x6a, - 0x6e, 0x6a, 0x5e, 0x09, 0x48, 0xd6, 0x89, 0x05, 0x64, 0x6a, 0x10, 0x44, 0xa5, 0x93, 0xc3, 0x89, - 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, 0x31, 0xde, 0x78, 0x24, 0xc7, 0xf8, 0xe0, 0x91, 0x1c, 0xe3, - 0x8c, 0xc7, 0x72, 0x0c, 0x51, 0xb8, 0x82, 0x26, 0x3f, 0xad, 0x58, 0x17, 0xe2, 0x59, 0x78, 0x30, - 0x26, 0xb1, 0x81, 0x05, 0x8c, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0x29, 0x6b, 0x4d, 0x08, 0x71, - 0x01, 0x00, 0x00, + // 361 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x91, 0xcf, 0x4e, 0xc2, 0x40, + 0x10, 0xc6, 0x19, 0x28, 0x2a, 0x0b, 0xc6, 0xb8, 0x09, 0xa6, 0x21, 0x5a, 0x1a, 0x4e, 0xd5, 0x84, + 0x56, 0x31, 0xf1, 0xe0, 0x49, 0x01, 0x43, 0x48, 0x24, 0x9a, 0x1a, 0x2e, 0xde, 0xca, 0xba, 0x60, + 0x93, 0xd2, 0x6d, 0xba, 0x5b, 0x0d, 0x6f, 0xe2, 0x23, 0x71, 0xf4, 0x68, 0x3c, 0xa0, 0xa9, 0x2f, + 0x62, 0xba, 0x85, 0x86, 0x04, 0xbd, 0xed, 0x7c, 0xf3, 0x9b, 0x3f, 0xdf, 0x0e, 0xaa, 0x12, 0xe6, + 0x0b, 0xc7, 0xf5, 0x69, 0x68, 0x89, 0x59, 0x40, 0xb9, 0x19, 0x84, 0x4c, 0x30, 0x5c, 0xca, 0xe4, + 0xda, 0xc9, 0xc4, 0x15, 0xcf, 0xd1, 0xc8, 0x24, 0x6c, 0x6a, 0xf9, 0x3c, 0x20, 0xa4, 0xf9, 0x44, + 0x5f, 0x2c, 0x9f, 0x8a, 0xa9, 0x13, 0x58, 0x9c, 0x7a, 0x94, 0x08, 0x16, 0xa6, 0x65, 0xb5, 0xe6, + 0x1a, 0x3b, 0x61, 0x13, 0x66, 0x49, 0x79, 0x14, 0x8d, 0x65, 0x24, 0x03, 0xf9, 0x4a, 0xf1, 0xc6, + 0x17, 0xa0, 0x52, 0x67, 0x35, 0x08, 0x1f, 0xa3, 0xed, 0xbb, 0x57, 0x9f, 0x86, 0xfd, 0xae, 0x0a, + 0x3a, 0x18, 0x95, 0xf6, 0xde, 0x7c, 0x51, 0xcf, 0x7d, 0x2e, 0xea, 0x2b, 0xd9, 0x5e, 0x3d, 0xb0, + 0x8e, 0x94, 0x07, 0xc7, 0x13, 0x6a, 0x5e, 0x72, 0x95, 0x25, 0xa7, 0x0c, 0x87, 0xfd, 0xae, 0x2d, + 0x33, 0xb8, 0x86, 0x76, 0x3a, 0x4e, 0xe0, 0x10, 0x57, 0xcc, 0xd4, 0x82, 0x0e, 0x86, 0x62, 0x67, + 0x31, 0x3e, 0x43, 0x45, 0x3b, 0xf2, 0x28, 0x57, 0x15, 0x1d, 0x8c, 0x72, 0xab, 0x6a, 0xa6, 0x66, + 0xcc, 0x7b, 0xcf, 0x21, 0x74, 0x4a, 0x7d, 0x91, 0x64, 0xdb, 0x4a, 0xd2, 0xd5, 0x4e, 0x49, 0x7c, + 0x81, 0x94, 0x5b, 0x97, 0x0b, 0xb5, 0x28, 0x2b, 0x0e, 0xcd, 0xec, 0x7b, 0xcc, 0x6b, 0x42, 0x28, + 0xe7, 0x89, 0x8b, 0x90, 0x79, 0x09, 0xb3, 0x2c, 0x94, 0x7c, 0xe3, 0x12, 0x95, 0x53, 0xa0, 0x17, + 0xb2, 0x28, 0xc0, 0x15, 0x04, 0x03, 0x69, 0x6e, 0xd7, 0x86, 0x01, 0x3e, 0x42, 0xd0, 0x53, 0xf3, + 0x7a, 0xe1, 0x2f, 0xab, 0xd0, 0x6b, 0xdc, 0xa0, 0xfd, 0x8d, 0xe6, 0xf8, 0x74, 0xb9, 0x08, 0xe8, + 0x05, 0xa3, 0xdc, 0x3a, 0xd8, 0x58, 0x44, 0xce, 0x59, 0x5f, 0xa1, 0x7d, 0x35, 0x8f, 0x35, 0x78, + 0x8f, 0x35, 0xf8, 0x88, 0x35, 0xf8, 0x8e, 0x35, 0x78, 0xfb, 0xd1, 0x72, 0x8f, 0xff, 0x5d, 0x95, + 0x8d, 0x79, 0x33, 0xbd, 0x53, 0xd6, 0x79, 0xb4, 0x25, 0x85, 0xf3, 0xdf, 0x00, 0x00, 0x00, 0xff, + 0xff, 0xb4, 0x12, 0x2d, 0xb0, 0x2c, 0x02, 0x00, 0x00, } func (m *Container) Marshal() (dAtA []byte, err error) { @@ -134,6 +240,16 @@ func (m *Container) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } + { + size, err := m.List.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a { size, err := m.Rules.MarshalToSizedBuffer(dAtA[:i]) if err != nil { @@ -172,6 +288,93 @@ func (m *Container) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *AccessGroup) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *AccessGroup) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AccessGroup) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.G) > 0 { + for iNdEx := len(m.G) - 1; iNdEx >= 0; iNdEx-- { + { + size := m.G[iNdEx].Size() + i -= size + if _, err := m.G[iNdEx].MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if m.M != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.M)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *AccessControlList) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *AccessControlList) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AccessControlList) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.List) > 0 { + for iNdEx := len(m.List) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.List[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + func encodeVarintTypes(dAtA []byte, offset int, v uint64) int { offset -= sovTypes(v) base := offset @@ -198,6 +401,47 @@ func (m *Container) Size() (n int) { } l = m.Rules.Size() n += 1 + l + sovTypes(uint64(l)) + l = m.List.Size() + n += 1 + l + sovTypes(uint64(l)) + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *AccessGroup) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.M != 0 { + n += 1 + sovTypes(uint64(m.M)) + } + if len(m.G) > 0 { + for _, e := range m.G { + l = e.Size() + n += 1 + l + sovTypes(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *AccessControlList) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.List) > 0 { + for _, e := range m.List { + l = e.Size() + n += 1 + l + sovTypes(uint64(l)) + } + } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -357,6 +601,235 @@ func (m *Container) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field List", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.List.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *AccessGroup) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: AccessGroup: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AccessGroup: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field M", wireType) + } + m.M = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.M |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field G", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var v OwnerID + m.G = append(m.G, v) + if err := m.G[len(m.G)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *AccessControlList) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: AccessControlList: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AccessControlList: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field List", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.List = append(m.List, AccessGroup{}) + if err := m.List[len(m.List)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTypes(dAtA[iNdEx:]) diff --git a/container/types.proto b/container/types.proto index a601edd..a1429ce 100644 --- a/container/types.proto +++ b/container/types.proto @@ -17,4 +17,18 @@ message Container { uint64 Capacity = 3; // Rules define storage policy for the object inside the container. netmap.PlacementRule Rules = 4 [(gogoproto.nullable) = false]; + // Container ACL. + AccessControlList List = 5 [(gogoproto.nullable) = false]; +} + +message AccessGroup { + // Group access mode. + uint32 M = 1; + // Group members. + repeated bytes G = 2 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false]; +} + +message AccessControlList { + // List of access groups. + repeated AccessGroup List = 1 [(gogoproto.nullable) = false]; } From 7e6e30b85024a669111f46dfa48da626d0802f5a Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 17 Dec 2019 16:15:51 +0300 Subject: [PATCH 0058/1196] Add unit tests for container access modes --- container/types_test.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/container/types_test.go b/container/types_test.go index c7dbbf8..cfd5f52 100644 --- a/container/types_test.go +++ b/container/types_test.go @@ -55,3 +55,23 @@ func TestCID(t *testing.T) { require.Equal(t, cid1, cid2) }) } + +func TestAccessMode(t *testing.T) { + t.Run("read access to read/write mode", func(t *testing.T) { + require.Equal(t, AccessModeRead, AccessModeReadWrite&AccessModeRead) + }) + + t.Run("write access to read/write mode", func(t *testing.T) { + require.Equal(t, AccessModeWrite, AccessModeReadWrite&AccessModeWrite) + }) + + t.Run("read(write) access to write(read) mode", func(t *testing.T) { + require.Zero(t, AccessModeRead&AccessModeWrite) + }) + + t.Run("access to same mode", func(t *testing.T) { + require.Equal(t, AccessModeWrite, AccessModeWrite&AccessModeWrite) + require.Equal(t, AccessModeRead, AccessModeRead&AccessModeRead) + require.Equal(t, AccessModeReadWrite, AccessModeReadWrite&AccessModeReadWrite) + }) +} From f557f2461691e8c8d5e78f0a856726c6c034f480 Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Tue, 17 Dec 2019 17:53:48 +0300 Subject: [PATCH 0059/1196] Fix bug with DecodeMetrics (empty metrics returns) --- state/service.go | 1 + 1 file changed, 1 insertion(+) diff --git a/state/service.go b/state/service.go index cd7b685..343a822 100644 --- a/state/service.go +++ b/state/service.go @@ -45,6 +45,7 @@ func DecodeMetrics(r *MetricsResponse) ([]*MetricFamily, error) { if err := proto.Unmarshal(r.Metrics[i], mf); err != nil { return nil, err } + metrics = append(metrics, mf) } return metrics, nil From a52e26389e0a6711dc1ab53c9f230979cc6c1180 Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Tue, 17 Dec 2019 18:03:24 +0300 Subject: [PATCH 0060/1196] CHANGELOG --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d92bbfa..7b46745 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,11 @@ # Changelog This is the changelog for NeoFS Proto +## [0.2.7] - 2019-12-17 + +### Fixed +- Bug with DecodeMetrics (empty metrics returns) + ## [0.2.6] - 2019-12-17 ### Added @@ -72,3 +77,4 @@ Initial public release [0.2.4]: https://github.com/nspcc-dev/neofs-proto/compare/v0.2.3...v0.2.4 [0.2.5]: https://github.com/nspcc-dev/neofs-proto/compare/v0.2.4...v0.2.5 [0.2.6]: https://github.com/nspcc-dev/neofs-proto/compare/v0.2.5...v0.2.6 +[0.2.7]: https://github.com/nspcc-dev/neofs-proto/compare/v0.2.6...v0.2.7 From 6ad23612c99f2c1a84e3bbb0e28bf416746bf1e4 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 17 Dec 2019 19:48:44 +0300 Subject: [PATCH 0061/1196] Use expanded field naming in AccessGroup structure --- container/types.pb.go | 88 +++++++++++++++++++++---------------------- container/types.proto | 4 +- 2 files changed, 46 insertions(+), 46 deletions(-) diff --git a/container/types.pb.go b/container/types.pb.go index 6671670..7a454de 100644 --- a/container/types.pb.go +++ b/container/types.pb.go @@ -93,9 +93,9 @@ func (m *Container) GetList() AccessControlList { type AccessGroup struct { // Group access mode. - M uint32 `protobuf:"varint,1,opt,name=M,proto3" json:"M,omitempty"` + AccessMode uint32 `protobuf:"varint,1,opt,name=AccessMode,proto3" json:"AccessMode,omitempty"` // Group members. - G []OwnerID `protobuf:"bytes,2,rep,name=G,proto3,customtype=OwnerID" json:"G"` + UserGroup []OwnerID `protobuf:"bytes,2,rep,name=UserGroup,proto3,customtype=OwnerID" json:"UserGroup"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -130,9 +130,9 @@ func (m *AccessGroup) XXX_DiscardUnknown() { var xxx_messageInfo_AccessGroup proto.InternalMessageInfo -func (m *AccessGroup) GetM() uint32 { +func (m *AccessGroup) GetAccessMode() uint32 { if m != nil { - return m.M + return m.AccessMode } return 0 } @@ -190,30 +190,30 @@ func init() { func init() { proto.RegisterFile("container/types.proto", fileDescriptor_1432e52ab0b53e3e) } var fileDescriptor_1432e52ab0b53e3e = []byte{ - // 361 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x91, 0xcf, 0x4e, 0xc2, 0x40, - 0x10, 0xc6, 0x19, 0x28, 0x2a, 0x0b, 0xc6, 0xb8, 0x09, 0xa6, 0x21, 0x5a, 0x1a, 0x4e, 0xd5, 0x84, - 0x56, 0x31, 0xf1, 0xe0, 0x49, 0x01, 0x43, 0x48, 0x24, 0x9a, 0x1a, 0x2e, 0xde, 0xca, 0xba, 0x60, - 0x93, 0xd2, 0x6d, 0xba, 0x5b, 0x0d, 0x6f, 0xe2, 0x23, 0x71, 0xf4, 0x68, 0x3c, 0xa0, 0xa9, 0x2f, - 0x62, 0xba, 0x85, 0x86, 0x04, 0xbd, 0xed, 0x7c, 0xf3, 0x9b, 0x3f, 0xdf, 0x0e, 0xaa, 0x12, 0xe6, - 0x0b, 0xc7, 0xf5, 0x69, 0x68, 0x89, 0x59, 0x40, 0xb9, 0x19, 0x84, 0x4c, 0x30, 0x5c, 0xca, 0xe4, - 0xda, 0xc9, 0xc4, 0x15, 0xcf, 0xd1, 0xc8, 0x24, 0x6c, 0x6a, 0xf9, 0x3c, 0x20, 0xa4, 0xf9, 0x44, - 0x5f, 0x2c, 0x9f, 0x8a, 0xa9, 0x13, 0x58, 0x9c, 0x7a, 0x94, 0x08, 0x16, 0xa6, 0x65, 0xb5, 0xe6, - 0x1a, 0x3b, 0x61, 0x13, 0x66, 0x49, 0x79, 0x14, 0x8d, 0x65, 0x24, 0x03, 0xf9, 0x4a, 0xf1, 0xc6, - 0x17, 0xa0, 0x52, 0x67, 0x35, 0x08, 0x1f, 0xa3, 0xed, 0xbb, 0x57, 0x9f, 0x86, 0xfd, 0xae, 0x0a, - 0x3a, 0x18, 0x95, 0xf6, 0xde, 0x7c, 0x51, 0xcf, 0x7d, 0x2e, 0xea, 0x2b, 0xd9, 0x5e, 0x3d, 0xb0, - 0x8e, 0x94, 0x07, 0xc7, 0x13, 0x6a, 0x5e, 0x72, 0x95, 0x25, 0xa7, 0x0c, 0x87, 0xfd, 0xae, 0x2d, - 0x33, 0xb8, 0x86, 0x76, 0x3a, 0x4e, 0xe0, 0x10, 0x57, 0xcc, 0xd4, 0x82, 0x0e, 0x86, 0x62, 0x67, - 0x31, 0x3e, 0x43, 0x45, 0x3b, 0xf2, 0x28, 0x57, 0x15, 0x1d, 0x8c, 0x72, 0xab, 0x6a, 0xa6, 0x66, - 0xcc, 0x7b, 0xcf, 0x21, 0x74, 0x4a, 0x7d, 0x91, 0x64, 0xdb, 0x4a, 0xd2, 0xd5, 0x4e, 0x49, 0x7c, - 0x81, 0x94, 0x5b, 0x97, 0x0b, 0xb5, 0x28, 0x2b, 0x0e, 0xcd, 0xec, 0x7b, 0xcc, 0x6b, 0x42, 0x28, - 0xe7, 0x89, 0x8b, 0x90, 0x79, 0x09, 0xb3, 0x2c, 0x94, 0x7c, 0xe3, 0x12, 0x95, 0x53, 0xa0, 0x17, - 0xb2, 0x28, 0xc0, 0x15, 0x04, 0x03, 0x69, 0x6e, 0xd7, 0x86, 0x01, 0x3e, 0x42, 0xd0, 0x53, 0xf3, - 0x7a, 0xe1, 0x2f, 0xab, 0xd0, 0x6b, 0xdc, 0xa0, 0xfd, 0x8d, 0xe6, 0xf8, 0x74, 0xb9, 0x08, 0xe8, - 0x05, 0xa3, 0xdc, 0x3a, 0xd8, 0x58, 0x44, 0xce, 0x59, 0x5f, 0xa1, 0x7d, 0x35, 0x8f, 0x35, 0x78, - 0x8f, 0x35, 0xf8, 0x88, 0x35, 0xf8, 0x8e, 0x35, 0x78, 0xfb, 0xd1, 0x72, 0x8f, 0xff, 0x5d, 0x95, - 0x8d, 0x79, 0x33, 0xbd, 0x53, 0xd6, 0x79, 0xb4, 0x25, 0x85, 0xf3, 0xdf, 0x00, 0x00, 0x00, 0xff, - 0xff, 0xb4, 0x12, 0x2d, 0xb0, 0x2c, 0x02, 0x00, 0x00, + // 368 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x91, 0x4f, 0x4b, 0xfb, 0x30, + 0x1c, 0xc6, 0x97, 0xad, 0xfb, 0xfd, 0x5c, 0x36, 0x11, 0x03, 0x93, 0x32, 0xa4, 0x2b, 0x3b, 0x55, + 0xa1, 0xad, 0x4e, 0xf0, 0xac, 0xdb, 0x44, 0x06, 0x8a, 0x52, 0xd9, 0x45, 0xbc, 0x74, 0x59, 0x36, + 0x0b, 0x5d, 0x53, 0x92, 0x54, 0xd9, 0x3b, 0xf1, 0x25, 0xed, 0xe8, 0x51, 0x3c, 0x4c, 0xa9, 0x6f, + 0x44, 0x9a, 0x6c, 0x75, 0x30, 0xbd, 0xe5, 0x79, 0xf2, 0x79, 0x92, 0xef, 0x1f, 0x58, 0xc7, 0x34, + 0x12, 0x7e, 0x10, 0x11, 0xe6, 0x8a, 0x59, 0x4c, 0xb8, 0x13, 0x33, 0x2a, 0x28, 0xaa, 0xe4, 0x76, + 0xe3, 0x70, 0x12, 0x88, 0xc7, 0x64, 0xe8, 0x60, 0x3a, 0x75, 0x23, 0x1e, 0x63, 0x6c, 0x8f, 0xc8, + 0x93, 0x1b, 0x11, 0x31, 0xf5, 0x63, 0x97, 0x93, 0x90, 0x60, 0x41, 0x99, 0x8a, 0x35, 0xec, 0x35, + 0x76, 0x42, 0x27, 0xd4, 0x95, 0xf6, 0x30, 0x19, 0x4b, 0x25, 0x85, 0x3c, 0x29, 0xbc, 0xf5, 0x01, + 0x60, 0xa5, 0xbb, 0xfa, 0x08, 0x1d, 0xc0, 0xff, 0x37, 0xcf, 0x11, 0x61, 0xfd, 0x9e, 0x0e, 0x4c, + 0x60, 0xd5, 0x3a, 0x3b, 0xf3, 0x45, 0xb3, 0xf0, 0xbe, 0x68, 0xae, 0x6c, 0x6f, 0x75, 0x40, 0x26, + 0xd4, 0xee, 0xfc, 0x50, 0xe8, 0x45, 0xc9, 0xd5, 0x96, 0x9c, 0x36, 0x18, 0xf4, 0x7b, 0x9e, 0xbc, + 0x41, 0x0d, 0xb8, 0xd5, 0xf5, 0x63, 0x1f, 0x07, 0x62, 0xa6, 0x97, 0x4c, 0x60, 0x69, 0x5e, 0xae, + 0xd1, 0x31, 0x2c, 0x7b, 0x49, 0x48, 0xb8, 0xae, 0x99, 0xc0, 0xaa, 0xb6, 0xeb, 0x8e, 0x6a, 0xc6, + 0xb9, 0x0d, 0x7d, 0x4c, 0xa6, 0x24, 0x12, 0xd9, 0x6d, 0x47, 0xcb, 0x5e, 0xf5, 0x14, 0x89, 0x4e, + 0xa1, 0x76, 0x15, 0x70, 0xa1, 0x97, 0x65, 0x62, 0xdf, 0xc9, 0xc7, 0xe3, 0x9c, 0x63, 0x4c, 0x38, + 0xcf, 0xba, 0x60, 0x34, 0xcc, 0x98, 0x65, 0x50, 0xf2, 0xad, 0x07, 0x58, 0x55, 0xc0, 0x25, 0xa3, + 0x49, 0x8c, 0x0c, 0x08, 0x95, 0xbc, 0xa6, 0x23, 0x22, 0xbb, 0xdc, 0xf6, 0xd6, 0x1c, 0x64, 0xc3, + 0xca, 0x80, 0x13, 0x26, 0x61, 0xbd, 0x68, 0x96, 0x7e, 0x1b, 0xc2, 0x0f, 0xd1, 0xba, 0x80, 0xbb, + 0x1b, 0xdf, 0xa3, 0xa3, 0x65, 0xa9, 0xc0, 0x2c, 0x59, 0xd5, 0xf6, 0xde, 0x46, 0xa9, 0x32, 0xba, + 0x5e, 0x64, 0xe7, 0x6c, 0x9e, 0x1a, 0xe0, 0x35, 0x35, 0xc0, 0x5b, 0x6a, 0x80, 0xcf, 0xd4, 0x00, + 0x2f, 0x5f, 0x46, 0xe1, 0xfe, 0xaf, 0xbd, 0xd3, 0x31, 0xb7, 0xd5, 0x26, 0xf3, 0x97, 0x87, 0xff, + 0xa4, 0x71, 0xf2, 0x1d, 0x00, 0x00, 0xff, 0xff, 0x13, 0x1b, 0x01, 0x24, 0x4e, 0x02, 0x00, 0x00, } func (m *Container) Marshal() (dAtA []byte, err error) { @@ -312,12 +312,12 @@ func (m *AccessGroup) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } - if len(m.G) > 0 { - for iNdEx := len(m.G) - 1; iNdEx >= 0; iNdEx-- { + if len(m.UserGroup) > 0 { + for iNdEx := len(m.UserGroup) - 1; iNdEx >= 0; iNdEx-- { { - size := m.G[iNdEx].Size() + size := m.UserGroup[iNdEx].Size() i -= size - if _, err := m.G[iNdEx].MarshalTo(dAtA[i:]); err != nil { + if _, err := m.UserGroup[iNdEx].MarshalTo(dAtA[i:]); err != nil { return 0, err } i = encodeVarintTypes(dAtA, i, uint64(size)) @@ -326,8 +326,8 @@ func (m *AccessGroup) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x12 } } - if m.M != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.M)) + if m.AccessMode != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.AccessMode)) i-- dAtA[i] = 0x8 } @@ -415,11 +415,11 @@ func (m *AccessGroup) Size() (n int) { } var l int _ = l - if m.M != 0 { - n += 1 + sovTypes(uint64(m.M)) + if m.AccessMode != 0 { + n += 1 + sovTypes(uint64(m.AccessMode)) } - if len(m.G) > 0 { - for _, e := range m.G { + if len(m.UserGroup) > 0 { + for _, e := range m.UserGroup { l = e.Size() n += 1 + l + sovTypes(uint64(l)) } @@ -690,9 +690,9 @@ func (m *AccessGroup) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field M", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field AccessMode", wireType) } - m.M = 0 + m.AccessMode = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTypes @@ -702,14 +702,14 @@ func (m *AccessGroup) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.M |= uint32(b&0x7F) << shift + m.AccessMode |= uint32(b&0x7F) << shift if b < 0x80 { break } } case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field G", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field UserGroup", wireType) } var byteLen int for shift := uint(0); ; shift += 7 { @@ -737,8 +737,8 @@ func (m *AccessGroup) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } var v OwnerID - m.G = append(m.G, v) - if err := m.G[len(m.G)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.UserGroup = append(m.UserGroup, v) + if err := m.UserGroup[len(m.UserGroup)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/container/types.proto b/container/types.proto index a1429ce..4600046 100644 --- a/container/types.proto +++ b/container/types.proto @@ -23,9 +23,9 @@ message Container { message AccessGroup { // Group access mode. - uint32 M = 1; + uint32 AccessMode = 1; // Group members. - repeated bytes G = 2 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false]; + repeated bytes UserGroup = 2 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false]; } message AccessControlList { From 8d028100e948f0bb68a34d7a04b4363e92462527 Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Fri, 20 Dec 2019 10:13:16 +0300 Subject: [PATCH 0062/1196] service: Use sync pool for Sign/Verify request headers ``` // Before BenchmarkSignRequestHeader-8 146 8070375 ns/op 4210607 B/op 48 allocs/op BenchmarkVerifyRequestHeader-8 14 83058325 ns/op 42085955 B/op 1601 allocs/op // After BenchmarkSignRequestHeader-8 156 7709172 ns/op 33902 B/op 45 allocs/op BenchmarkVerifyRequestHeader-8 15 76910232 ns/op 54368 B/op 1563 allocs/op // Summary: benchmark old ns/op new ns/op delta BenchmarkSignRequestHeader-8 8070375 7709172 -4.48% BenchmarkVerifyRequestHeader-8 83058325 76910232 -7.40% benchmark old allocs new allocs delta BenchmarkSignRequestHeader-8 48 45 -6.25% BenchmarkVerifyRequestHeader-8 1601 1563 -2.37% benchmark old bytes new bytes delta BenchmarkSignRequestHeader-8 4210607 33902 -99.19% BenchmarkVerifyRequestHeader-8 42085955 54368 -99.87% ``` --- go.mod | 3 +++ service/verify.go | 35 ++++++++++++++++++++++++----- service/verify_test.go | 51 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 84 insertions(+), 5 deletions(-) diff --git a/go.mod b/go.mod index fd114d3..bb8c4ff 100644 --- a/go.mod +++ b/go.mod @@ -18,3 +18,6 @@ require ( golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550 google.golang.org/grpc v1.24.0 ) + +// Used for debug reasons +// replace github.com/nspcc-dev/neofs-crypto => ../neofs-crypto diff --git a/service/verify.go b/service/verify.go index 8571459..2bd1661 100644 --- a/service/verify.go +++ b/service/verify.go @@ -2,6 +2,7 @@ package service import ( "crypto/ecdsa" + "sync" crypto "github.com/nspcc-dev/neofs-crypto" "github.com/nspcc-dev/neofs-proto/internal" @@ -12,7 +13,8 @@ import ( type ( // VerifiableRequest adds possibility to sign and verify request header. VerifiableRequest interface { - Marshal() ([]byte, error) + Size() int + MarshalTo([]byte) (int, error) AddSignature(*RequestVerificationHeader_Signature) GetSignatures() []*RequestVerificationHeader_Signature SetSignatures([]*RequestVerificationHeader_Signature) @@ -133,6 +135,10 @@ func newSignature(key *ecdsa.PrivateKey, data []byte) (*RequestVerificationHeade }, nil } +var bytesPool = sync.Pool{New: func() interface{} { + return make([]byte, 4.5*1024*1024) // 4.5MB +}} + // SignRequestHeader receives private key and request with RequestVerificationHeader, // tries to marshal and sign request with passed PrivateKey, after that adds // new signature to headers. If something went wrong, returns error. @@ -146,12 +152,23 @@ func SignRequestHeader(key *ecdsa.PrivateKey, msg VerifiableRequest) error { }() } - data, err := msg.Marshal() + data := bytesPool.Get().([]byte) + defer func() { + bytesPool.Put(data) + }() + + if size := msg.Size(); size <= cap(data) { + data = data[:size] + } else { + data = make([]byte, size) + } + + size, err := msg.MarshalTo(data) if err != nil { return err } - signature, err := newSignature(key, data) + signature, err := newSignature(key, data[:size]) if err != nil { return err } @@ -174,8 +191,10 @@ func VerifyRequestHeader(msg VerifiableRequest) error { }() } + data := bytesPool.Get().([]byte) signatures := msg.GetSignatures() defer func() { + bytesPool.Put(data) msg.SetSignatures(signatures) }() @@ -189,9 +208,15 @@ func VerifyRequestHeader(msg VerifiableRequest) error { return errors.Wrapf(ErrCannotLoadPublicKey, "%d: %02x", i, peer) } - if data, err := msg.Marshal(); err != nil { + if size := msg.Size(); size <= cap(data) { + data = data[:size] + } else { + data = make([]byte, size) + } + + if size, err := msg.MarshalTo(data); err != nil { return errors.Wrapf(err, "%d: %02x", i, peer) - } else if err := crypto.Verify(key, data, sign); err != nil { + } else if err := crypto.Verify(key, data[:size], sign); err != nil { return errors.Wrapf(err, "%d: %02x", i, peer) } } diff --git a/service/verify_test.go b/service/verify_test.go index 237e362..44542c4 100644 --- a/service/verify_test.go +++ b/service/verify_test.go @@ -14,6 +14,57 @@ import ( "github.com/stretchr/testify/require" ) +func BenchmarkSignRequestHeader(b *testing.B) { + key := test.DecodeKey(0) + + custom := testCustomField{1, 2, 3, 4, 5, 6, 7, 8} + + some := &TestRequest{ + IntField: math.MaxInt32, + StringField: "TestRequestStringField", + BytesField: make([]byte, 1<<22), + CustomField: &custom, + RequestMetaHeader: RequestMetaHeader{ + TTL: math.MaxInt32 - 8, + Epoch: math.MaxInt64 - 12, + }, + } + + b.ResetTimer() + b.ReportAllocs() + + for i := 0; i < b.N; i++ { + require.NoError(b, SignRequestHeader(key, some)) + } +} + +func BenchmarkVerifyRequestHeader(b *testing.B) { + custom := testCustomField{1, 2, 3, 4, 5, 6, 7, 8} + + some := &TestRequest{ + IntField: math.MaxInt32, + StringField: "TestRequestStringField", + BytesField: make([]byte, 1<<22), + CustomField: &custom, + RequestMetaHeader: RequestMetaHeader{ + TTL: math.MaxInt32 - 8, + Epoch: math.MaxInt64 - 12, + }, + } + + for i := 0; i < 10; i++ { + key := test.DecodeKey(i) + require.NoError(b, SignRequestHeader(key, some)) + } + + b.ResetTimer() + b.ReportAllocs() + + for i := 0; i < b.N; i++ { + require.NoError(b, VerifyRequestHeader(some)) + } +} + func TestSignRequestHeader(t *testing.T) { req := &TestRequest{ IntField: math.MaxInt32, From e1b7d0a7a6db4784390a72bca3e227612cbd0fe5 Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Sat, 21 Dec 2019 12:25:35 +0300 Subject: [PATCH 0063/1196] CHANGELOG --- CHANGELOG.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7b46745..b76c77e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,15 @@ # Changelog This is the changelog for NeoFS Proto +## [0.2.8] - 2019-12-21 + +### Added +- Container access control type definitions + +### Changed +- Used sync.Pool for Sign/VerifyRequestHeader +- VerifiableRequest.Marshal method replace with MarshalTo and Size + ## [0.2.7] - 2019-12-17 ### Fixed @@ -78,3 +87,4 @@ Initial public release [0.2.5]: https://github.com/nspcc-dev/neofs-proto/compare/v0.2.4...v0.2.5 [0.2.6]: https://github.com/nspcc-dev/neofs-proto/compare/v0.2.5...v0.2.6 [0.2.7]: https://github.com/nspcc-dev/neofs-proto/compare/v0.2.6...v0.2.7 +[0.2.8]: https://github.com/nspcc-dev/neofs-proto/compare/v0.2.7...v0.2.8 From d5072d20f09489be796a1b8b90cc7a340df6ca22 Mon Sep 17 00:00:00 2001 From: alexvanin Date: Wed, 15 Jan 2020 17:05:53 +0300 Subject: [PATCH 0064/1196] docs: Add doc for container ACL field ACL support still under development. Detailed documentation on container access rules will be added later. --- docs/container.md | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/docs/container.md b/docs/container.md index ef2ba19..6693980 100644 --- a/docs/container.md +++ b/docs/container.md @@ -21,6 +21,8 @@ - [container/types.proto](#container/types.proto) - Messages + - [AccessControlList](#container.AccessControlList) + - [AccessGroup](#container.AccessGroup) - [Container](#container.Container) @@ -164,6 +166,7 @@ via consensus in inner ring nodes | Capacity | [uint64](#uint64) | | Capacity defines amount of data that can be stored in the container (doesn't used for now). | | OwnerID | [bytes](#bytes) | | OwnerID is a wallet address | | rules | [netmap.PlacementRule](#netmap.PlacementRule) | | Rules define storage policy for the object inside the container. | +| Group | [AccessGroup](#container.AccessGroup) | | Container ACL. | | Meta | [service.RequestMetaHeader](#service.RequestMetaHeader) | | RequestMetaHeader contains information about request meta headers (should be embedded into message) | | Verify | [service.RequestVerificationHeader](#service.RequestVerificationHeader) | | RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) | @@ -193,6 +196,29 @@ via consensus in inner ring nodes + + +### Message AccessControlList + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| List | [AccessGroup](#container.AccessGroup) | repeated | List of access groups. | + + + + +### Message AccessGroup + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| AccessMode | [uint32](#uint32) | | Group access mode. | +| UserGroup | [bytes](#bytes) | repeated | Group members. | + + ### Message Container @@ -205,6 +231,7 @@ The Container service definition. | Salt | [bytes](#bytes) | | Salt is a nonce for unique container id calculation. | | Capacity | [uint64](#uint64) | | Capacity defines amount of data that can be stored in the container (doesn't used for now). | | Rules | [netmap.PlacementRule](#netmap.PlacementRule) | | Rules define storage policy for the object inside the container. | +| List | [AccessControlList](#container.AccessControlList) | | Container ACL. | From e4d761be06c4acfd1767e476b43614320bd03aa6 Mon Sep 17 00:00:00 2001 From: alexvanin Date: Wed, 15 Jan 2020 17:10:45 +0300 Subject: [PATCH 0065/1196] object: Remove tombstone creation field in tombstone header Tombstone header contains timestamp when tombstone was created. This timestamp duplicates object creation timestamp in object system header. This commit removes redundant field. --- object/types.pb.go | 147 +++++++++++++++++---------------------------- object/types.proto | 5 +- 2 files changed, 56 insertions(+), 96 deletions(-) diff --git a/object/types.pb.go b/object/types.pb.go index 459e124..b5a1e78 100644 --- a/object/types.pb.go +++ b/object/types.pb.go @@ -390,8 +390,6 @@ func (*Header) XXX_OneofWrappers() []interface{} { } type Tombstone struct { - // Epoch when tombstone was created - Epoch uint64 `protobuf:"varint,1,opt,name=Epoch,proto3" json:"Epoch,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -426,13 +424,6 @@ func (m *Tombstone) XXX_DiscardUnknown() { var xxx_messageInfo_Tombstone proto.InternalMessageInfo -func (m *Tombstone) GetEpoch() uint64 { - if m != nil { - return m.Epoch - } - return 0 -} - type SystemHeader struct { // Version of the object structure Version uint64 `protobuf:"varint,1,opt,name=Version,proto3" json:"Version,omitempty"` @@ -777,62 +768,61 @@ func init() { func init() { proto.RegisterFile("object/types.proto", fileDescriptor_02021a1d39b1aee0) } var fileDescriptor_02021a1d39b1aee0 = []byte{ - // 867 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x55, 0x4d, 0x73, 0xdb, 0x44, - 0x18, 0x96, 0x64, 0xf9, 0xeb, 0xb5, 0xd2, 0xa8, 0x4b, 0x29, 0x1a, 0x33, 0x38, 0x41, 0xc3, 0x47, - 0x28, 0x44, 0x19, 0x52, 0x98, 0x0e, 0x07, 0x18, 0xe2, 0x98, 0x41, 0x1e, 0x0a, 0xc9, 0x6c, 0x3e, - 0x0e, 0xdc, 0x64, 0x6b, 0x2d, 0x8b, 0xd8, 0xbb, 0x9e, 0xdd, 0x75, 0x5b, 0xdf, 0xf9, 0x05, 0x9c, - 0xb8, 0xf1, 0x77, 0x7a, 0xe4, 0xc8, 0xf4, 0x90, 0x61, 0xc2, 0x0f, 0xe0, 0x2f, 0x74, 0x76, 0x25, - 0xd9, 0x92, 0xdb, 0x8b, 0x67, 0xdf, 0xe7, 0x63, 0xfd, 0xea, 0xdd, 0x67, 0x25, 0x40, 0x6c, 0xf4, - 0x1b, 0x19, 0xcb, 0x23, 0xb9, 0x5a, 0x10, 0x11, 0x2c, 0x38, 0x93, 0x0c, 0x35, 0x32, 0xac, 0xeb, - 0x72, 0x32, 0x11, 0x65, 0xa6, 0xfb, 0x8e, 0x20, 0x42, 0xa4, 0x8c, 0x56, 0x40, 0x4f, 0x48, 0xc6, - 0xa3, 0x84, 0x24, 0x9c, 0x2d, 0x17, 0x15, 0xe6, 0x30, 0x49, 0xe5, 0x74, 0x39, 0x0a, 0xc6, 0x6c, - 0x7e, 0x94, 0xb0, 0x84, 0x1d, 0x69, 0x78, 0xb4, 0x9c, 0xe8, 0x4a, 0x17, 0x7a, 0x95, 0xc9, 0xfd, - 0x27, 0x50, 0xc7, 0x11, 0x4d, 0x08, 0x7a, 0x08, 0x8d, 0xb3, 0xc9, 0x44, 0x10, 0xe9, 0x99, 0xfb, - 0xe6, 0x81, 0x8d, 0xf3, 0x4a, 0xe1, 0x4f, 0x09, 0x4d, 0xe4, 0xd4, 0xb3, 0x32, 0x3c, 0xab, 0xfc, - 0xaf, 0x00, 0xae, 0x04, 0xe1, 0x21, 0x89, 0x62, 0xc2, 0x91, 0x0b, 0xb5, 0x9f, 0xc8, 0x4a, 0x5b, - 0xdb, 0x58, 0x2d, 0xd1, 0x03, 0xa8, 0x5f, 0x47, 0xb3, 0x25, 0xd1, 0xb6, 0x36, 0xce, 0x0a, 0xff, - 0x77, 0x1b, 0x1a, 0xb9, 0xc5, 0x07, 0xfb, 0x69, 0x4a, 0x6f, 0xb4, 0xa7, 0x73, 0xec, 0x04, 0xd9, - 0x00, 0x02, 0x85, 0x85, 0x06, 0xd6, 0x1c, 0xfa, 0x1c, 0x5a, 0x98, 0xc4, 0x29, 0x27, 0x63, 0xa9, - 0xf7, 0xe9, 0x1c, 0xef, 0x04, 0x6a, 0x40, 0xc1, 0x49, 0x1c, 0x73, 0x22, 0x44, 0x68, 0xe0, 0xb5, - 0x00, 0x55, 0x3a, 0xf2, 0x6a, 0x5a, 0x8e, 0x8a, 0x6d, 0x37, 0x4c, 0x68, 0xe0, 0x72, 0xe7, 0x5f, - 0x42, 0xfb, 0x92, 0x47, 0x54, 0x4c, 0x18, 0x9f, 0x7b, 0xb6, 0x36, 0xdd, 0x2f, 0x4c, 0x6b, 0x22, - 0x34, 0xf0, 0x46, 0xa5, 0x2d, 0x6c, 0x3e, 0x12, 0x92, 0x51, 0xe2, 0xd5, 0xb7, 0x2c, 0x05, 0xa1, - 0x2d, 0x45, 0x81, 0xbe, 0x86, 0xc6, 0x35, 0xe1, 0xe9, 0x64, 0xe5, 0x35, 0xb4, 0xfe, 0xfd, 0x20, - 0x3f, 0xd5, 0x40, 0xc3, 0xe9, 0x38, 0x92, 0x29, 0xa3, 0xeb, 0x06, 0x73, 0x31, 0xfa, 0x04, 0x5a, - 0x21, 0x9b, 0xb3, 0x30, 0x12, 0x53, 0xaf, 0xb9, 0x6f, 0x1e, 0x38, 0xfd, 0xd6, 0xab, 0xdb, 0x3d, - 0x5b, 0xd5, 0xea, 0xd1, 0x0b, 0x0e, 0x3d, 0x82, 0xdd, 0xf3, 0x68, 0x35, 0x63, 0x51, 0x7c, 0x3a, - 0x25, 0xe3, 0x1b, 0xb1, 0x9c, 0x7b, 0x2d, 0x25, 0x0f, 0x0d, 0xbc, 0x4d, 0xa0, 0x27, 0xd0, 0x1e, - 0x52, 0x49, 0x12, 0x9e, 0xca, 0x95, 0xd7, 0xd6, 0xdd, 0xbc, 0x57, 0x74, 0xbf, 0x26, 0xd6, 0x9d, - 0x6c, 0xb4, 0xe8, 0x7b, 0x70, 0x2e, 0xb2, 0xd4, 0xfd, 0xa8, 0x52, 0xe7, 0x81, 0xf6, 0x76, 0x83, - 0x72, 0x14, 0x83, 0xb2, 0x22, 0x34, 0x70, 0xc5, 0xd1, 0x6f, 0xe6, 0x99, 0xf0, 0x3f, 0x2c, 0x4d, - 0x50, 0x25, 0xe5, 0x87, 0x05, 0x1b, 0x4f, 0xf3, 0xe0, 0x65, 0x85, 0xff, 0xbf, 0x09, 0xce, 0xc5, - 0x4a, 0x48, 0x32, 0xcf, 0x0f, 0xca, 0x83, 0xe6, 0x35, 0xe1, 0x6a, 0x66, 0xb9, 0xb0, 0x28, 0xd1, - 0x47, 0xb0, 0x93, 0x3f, 0x64, 0x25, 0xa9, 0x55, 0x10, 0x75, 0xc1, 0x1a, 0x0e, 0x74, 0x2c, 0x9c, - 0x3e, 0xbc, 0xbc, 0xdd, 0x33, 0x5e, 0xdd, 0xee, 0x59, 0xc3, 0x01, 0xb6, 0x86, 0x03, 0xf4, 0x19, - 0x34, 0xcf, 0x9e, 0x53, 0xc2, 0x87, 0x03, 0x1d, 0x01, 0xa7, 0xbf, 0x9b, 0x0b, 0x0a, 0x18, 0x17, - 0x0b, 0xf4, 0x01, 0xd4, 0x4e, 0x87, 0x03, 0x7d, 0xec, 0x4e, 0xbf, 0x93, 0xcb, 0x14, 0x84, 0xd5, - 0x0f, 0xfa, 0x06, 0xda, 0xa7, 0x9c, 0x44, 0x92, 0xc4, 0x27, 0x32, 0x3f, 0xeb, 0x77, 0x8b, 0xe9, - 0x6a, 0x22, 0x65, 0xf4, 0x9c, 0xa5, 0x54, 0xf6, 0x6d, 0xe5, 0xc5, 0x1b, 0xb5, 0x7f, 0x02, 0x3b, - 0x15, 0x05, 0xea, 0x42, 0xeb, 0x8a, 0xa6, 0x2f, 0x2e, 0xd3, 0x39, 0xd1, 0x8f, 0x5c, 0xc3, 0xeb, - 0x7a, 0x33, 0x34, 0xab, 0x3c, 0xb4, 0x14, 0x76, 0xb7, 0x8e, 0x10, 0x1d, 0xc0, 0x6e, 0xb6, 0x12, - 0xeb, 0x68, 0xa8, 0xbd, 0x1c, 0xbc, 0x0d, 0xa3, 0x2f, 0xe0, 0x7e, 0xb1, 0xbe, 0x48, 0x13, 0x1a, - 0xc9, 0x25, 0xcf, 0x6e, 0xaf, 0x83, 0xdf, 0x24, 0xfc, 0xbf, 0xcc, 0xec, 0xfe, 0xa2, 0x8f, 0xc1, - 0x56, 0xef, 0x1f, 0xbd, 0xeb, 0xbd, 0xcd, 0x45, 0x50, 0x5c, 0x70, 0xb9, 0x5a, 0x10, 0xac, 0xe9, - 0x7c, 0xfc, 0xd6, 0xdb, 0xc6, 0xef, 0x5f, 0x82, 0xad, 0x94, 0xa8, 0x03, 0xcd, 0x2b, 0x7a, 0x43, - 0xd9, 0x73, 0xea, 0x1a, 0x08, 0xa0, 0x71, 0x1e, 0x71, 0x42, 0xa5, 0x6b, 0x22, 0x07, 0x5a, 0xe7, - 0x9c, 0x3c, 0x4b, 0xd9, 0x52, 0xb8, 0x16, 0x6a, 0x81, 0xfd, 0x0b, 0x79, 0x21, 0xdd, 0x1a, 0x6a, - 0x43, 0xfd, 0x74, 0x9a, 0xce, 0x62, 0xd7, 0x46, 0x6e, 0x35, 0x9d, 0x6e, 0xdd, 0x9f, 0x95, 0x6e, - 0x36, 0x7a, 0x54, 0xe9, 0xf2, 0xe1, 0x1b, 0x37, 0xbc, 0xd4, 0xaa, 0xff, 0xf8, 0x6d, 0xed, 0xb4, - 0xa1, 0x7e, 0xb1, 0x98, 0xa5, 0xaa, 0x9b, 0x16, 0xd8, 0x6a, 0x0e, 0xae, 0xa5, 0xc0, 0x9f, 0xd9, - 0x72, 0x16, 0xbb, 0x35, 0xff, 0x0f, 0x13, 0x1a, 0x67, 0x7a, 0x53, 0xf4, 0x5d, 0x35, 0xb9, 0xf9, - 0x1b, 0xee, 0x41, 0xf1, 0x9f, 0x65, 0x2e, 0x4f, 0x41, 0x35, 0xe9, 0x01, 0x34, 0xf3, 0xb3, 0xf1, - 0xac, 0xfd, 0xda, 0x41, 0xe7, 0xf8, 0x5e, 0x61, 0xad, 0x98, 0x0a, 0x91, 0xba, 0x19, 0x79, 0xd4, - 0xb3, 0x78, 0xe3, 0xa2, 0xec, 0x7f, 0xfb, 0xf2, 0xae, 0x67, 0xfe, 0x7d, 0xd7, 0x33, 0xff, 0xb9, - 0xeb, 0x99, 0xff, 0xde, 0xf5, 0xcc, 0x3f, 0xff, 0xeb, 0x19, 0xbf, 0x7e, 0x5a, 0xfa, 0x44, 0x50, - 0xb1, 0x18, 0x8f, 0x0f, 0x63, 0xf2, 0xec, 0x88, 0x12, 0x36, 0x11, 0x87, 0xd9, 0x07, 0x22, 0xfb, - 0xbb, 0x51, 0x43, 0x57, 0x8f, 0x5f, 0x07, 0x00, 0x00, 0xff, 0xff, 0x40, 0x7d, 0xa2, 0x84, 0xb1, - 0x06, 0x00, 0x00, + // 863 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x55, 0xcb, 0x8e, 0xe3, 0x44, + 0x14, 0xb5, 0x13, 0xe7, 0x75, 0xe3, 0x99, 0xf6, 0x14, 0xc3, 0x60, 0x05, 0x91, 0x6e, 0x59, 0x3c, + 0x9a, 0x81, 0x76, 0x8b, 0x1e, 0xd0, 0x88, 0x05, 0x88, 0x4e, 0x07, 0xe1, 0x88, 0x81, 0x6e, 0x55, + 0x3f, 0x16, 0xec, 0x9c, 0xb8, 0xe2, 0x14, 0x9d, 0x54, 0x45, 0x55, 0x95, 0x99, 0xc9, 0x9e, 0x2f, + 0x60, 0xc5, 0x8e, 0xdf, 0x99, 0x25, 0x4b, 0x34, 0x8b, 0x16, 0x6a, 0x3e, 0x80, 0x5f, 0x40, 0x55, + 0xb6, 0x13, 0xbb, 0x67, 0x36, 0x56, 0xdd, 0x7b, 0xce, 0x29, 0xdf, 0xba, 0xf7, 0x94, 0x0d, 0x88, + 0x8f, 0x7f, 0x25, 0x13, 0x75, 0xa8, 0xd6, 0x4b, 0x22, 0xc3, 0xa5, 0xe0, 0x8a, 0xa3, 0x66, 0x96, + 0xeb, 0x79, 0x82, 0x4c, 0x65, 0x19, 0xe9, 0xbd, 0x23, 0x89, 0x94, 0x94, 0xb3, 0x4a, 0xd2, 0x97, + 0x8a, 0x8b, 0x38, 0x25, 0xa9, 0xe0, 0xab, 0x65, 0x05, 0x39, 0x48, 0xa9, 0x9a, 0xad, 0xc6, 0xe1, + 0x84, 0x2f, 0x0e, 0x53, 0x9e, 0xf2, 0x43, 0x93, 0x1e, 0xaf, 0xa6, 0x26, 0x32, 0x81, 0x59, 0x65, + 0xf4, 0xe0, 0x29, 0x34, 0x70, 0xcc, 0x52, 0x82, 0x1e, 0x41, 0xf3, 0x74, 0x3a, 0x95, 0x44, 0xf9, + 0xf6, 0x9e, 0xbd, 0xef, 0xe0, 0x3c, 0xd2, 0xf9, 0x67, 0x84, 0xa5, 0x6a, 0xe6, 0xd7, 0xb2, 0x7c, + 0x16, 0x05, 0x5f, 0x02, 0x5c, 0x4a, 0x22, 0x22, 0x12, 0x27, 0x44, 0x20, 0x0f, 0xea, 0x3f, 0x92, + 0xb5, 0x91, 0x76, 0xb0, 0x5e, 0xa2, 0x87, 0xd0, 0xb8, 0x8a, 0xe7, 0x2b, 0x62, 0x64, 0x1d, 0x9c, + 0x05, 0xc1, 0x6f, 0x0e, 0x34, 0x73, 0x49, 0x00, 0xce, 0x33, 0xca, 0xae, 0x8d, 0xa6, 0x7b, 0xe4, + 0x86, 0x59, 0x03, 0x42, 0x9d, 0x8b, 0x2c, 0x6c, 0x30, 0xf4, 0x19, 0xb4, 0x31, 0x49, 0xa8, 0x20, + 0x13, 0x65, 0xf6, 0xe9, 0x1e, 0xdd, 0x0b, 0x75, 0x83, 0xc2, 0xe3, 0x24, 0x11, 0x44, 0xca, 0xc8, + 0xc2, 0x1b, 0x02, 0xaa, 0x54, 0xe4, 0xd7, 0x0d, 0x1d, 0x15, 0xdb, 0x6e, 0x91, 0xc8, 0xc2, 0xe5, + 0xca, 0xbf, 0x80, 0xce, 0x85, 0x88, 0x99, 0x9c, 0x72, 0xb1, 0xf0, 0x1d, 0x23, 0x7a, 0x50, 0x88, + 0x36, 0x40, 0x64, 0xe1, 0x2d, 0xcb, 0x48, 0xf8, 0x62, 0x2c, 0x15, 0x67, 0xc4, 0x6f, 0xdc, 0x91, + 0x14, 0x80, 0x91, 0x14, 0x01, 0xfa, 0x0a, 0x9a, 0x57, 0x44, 0xd0, 0xe9, 0xda, 0x6f, 0x1a, 0xfe, + 0xfb, 0x61, 0x3e, 0xd5, 0xd0, 0xa4, 0xe9, 0x24, 0x56, 0x94, 0xb3, 0x4d, 0x81, 0x39, 0x19, 0x7d, + 0x0c, 0xed, 0x88, 0x2f, 0x78, 0x14, 0xcb, 0x99, 0xdf, 0xda, 0xb3, 0xf7, 0xdd, 0x41, 0xfb, 0xf5, + 0xcd, 0xae, 0xa3, 0x63, 0x7d, 0xf4, 0x02, 0x43, 0x8f, 0x61, 0xe7, 0x2c, 0x5e, 0xcf, 0x79, 0x9c, + 0x9c, 0xcc, 0xc8, 0xe4, 0x5a, 0xae, 0x16, 0x7e, 0x5b, 0xd3, 0x23, 0x0b, 0xdf, 0x05, 0xd0, 0x53, + 0xe8, 0x8c, 0x98, 0x22, 0xa9, 0xa0, 0x6a, 0xed, 0x77, 0x4c, 0x35, 0xef, 0x15, 0xd5, 0x6f, 0x80, + 0x4d, 0x25, 0x5b, 0x2e, 0xfa, 0x0e, 0xdc, 0xf3, 0xcc, 0x75, 0x3f, 0x68, 0xd7, 0xf9, 0x60, 0xb4, + 0xbd, 0xb0, 0x6c, 0xc5, 0xb0, 0xcc, 0x88, 0x2c, 0x5c, 0x51, 0x0c, 0x5a, 0xb9, 0x27, 0x82, 0x6e, + 0xa9, 0x83, 0xc1, 0x7f, 0x36, 0xb8, 0xe7, 0x6b, 0xa9, 0xc8, 0x22, 0x1f, 0x89, 0x0f, 0xad, 0x2b, + 0x22, 0x74, 0x77, 0x72, 0x2f, 0x16, 0x21, 0xfa, 0x10, 0xee, 0xe5, 0xc7, 0xa9, 0x78, 0xb2, 0x9a, + 0x44, 0x3d, 0xa8, 0x8d, 0x86, 0xc6, 0x00, 0xee, 0x00, 0x5e, 0xdd, 0xec, 0x5a, 0xaf, 0x6f, 0x76, + 0x6b, 0xa3, 0x21, 0xae, 0x8d, 0x86, 0xe8, 0x53, 0x68, 0x9d, 0xbe, 0x60, 0x44, 0x8c, 0x86, 0x66, + 0xd8, 0xee, 0x60, 0x27, 0x27, 0x14, 0x69, 0x5c, 0x2c, 0xd0, 0x07, 0x50, 0x3f, 0x19, 0x0d, 0xcd, + 0x80, 0xdd, 0x41, 0x37, 0xa7, 0xe9, 0x14, 0xd6, 0x0f, 0xf4, 0x35, 0x74, 0x4e, 0x04, 0x89, 0x15, + 0x49, 0x8e, 0x55, 0x3e, 0xd5, 0x77, 0x8b, 0x3e, 0x1a, 0x80, 0x72, 0x76, 0xc6, 0x29, 0x53, 0x03, + 0x47, 0x6b, 0xf1, 0x96, 0x1d, 0x1c, 0xc3, 0xbd, 0x0a, 0x03, 0xf5, 0xa0, 0x7d, 0xc9, 0xe8, 0xcb, + 0x0b, 0xba, 0x20, 0xe6, 0xc8, 0x75, 0xbc, 0x89, 0xf5, 0x45, 0xfa, 0x7e, 0xc9, 0x27, 0xc5, 0x59, + 0xb3, 0x20, 0xa0, 0xb0, 0x73, 0x67, 0x58, 0x68, 0x1f, 0x76, 0xb2, 0x95, 0xdc, 0x98, 0x40, 0xef, + 0xe5, 0xe2, 0xbb, 0x69, 0xf4, 0x39, 0x3c, 0x28, 0xd6, 0xe7, 0x34, 0x65, 0xb1, 0x5a, 0x89, 0xec, + 0x9e, 0xba, 0xf8, 0x4d, 0x20, 0xf8, 0xd3, 0xce, 0x6e, 0x2a, 0xfa, 0x08, 0x1c, 0xfd, 0xa5, 0x31, + 0xbb, 0xde, 0xdf, 0x5a, 0x5e, 0x63, 0xe1, 0xc5, 0x7a, 0x49, 0xb0, 0x81, 0xf3, 0xf6, 0xd7, 0xde, + 0xd6, 0xfe, 0xe0, 0x02, 0x1c, 0xcd, 0x44, 0x5d, 0x68, 0x5d, 0xb2, 0x6b, 0xc6, 0x5f, 0x30, 0xcf, + 0x42, 0x00, 0xcd, 0xb3, 0x58, 0x10, 0xa6, 0x3c, 0x1b, 0xb9, 0xd0, 0x3e, 0x13, 0xe4, 0x39, 0xe5, + 0x2b, 0xe9, 0xd5, 0x50, 0x1b, 0x9c, 0x9f, 0xc9, 0x4b, 0xe5, 0xd5, 0x51, 0x07, 0x1a, 0x27, 0x33, + 0x3a, 0x4f, 0x3c, 0x07, 0x79, 0x55, 0x1f, 0x7a, 0x8d, 0x60, 0x5e, 0xba, 0xc3, 0xe8, 0x71, 0xa5, + 0xca, 0x47, 0x6f, 0xdc, 0xe5, 0x52, 0xa9, 0xc1, 0x93, 0xb7, 0x95, 0xd3, 0x81, 0xc6, 0xf9, 0x72, + 0x4e, 0x75, 0x35, 0x6d, 0x70, 0x74, 0x1f, 0xbc, 0x9a, 0x4e, 0xfe, 0xc4, 0x57, 0xf3, 0xc4, 0xab, + 0x07, 0xbf, 0xdb, 0xd0, 0x3c, 0x35, 0x9b, 0xa2, 0x6f, 0xab, 0xce, 0xcd, 0xbf, 0x65, 0x0f, 0x8b, + 0x77, 0x96, 0xb1, 0xdc, 0x05, 0x55, 0xa7, 0x87, 0xd0, 0xca, 0x67, 0xe3, 0xd7, 0xf6, 0xea, 0xfb, + 0xdd, 0xa3, 0xfb, 0x85, 0xb4, 0x22, 0x2a, 0x48, 0xfa, 0x66, 0xe4, 0x56, 0xcf, 0xec, 0x8d, 0x8b, + 0x70, 0xf0, 0xcd, 0xab, 0xdb, 0xbe, 0xfd, 0xd7, 0x6d, 0xdf, 0xfe, 0xfb, 0xb6, 0x6f, 0xff, 0x73, + 0xdb, 0xb7, 0xff, 0xf8, 0xb7, 0x6f, 0xfd, 0xf2, 0x49, 0xe9, 0x67, 0xc0, 0xe4, 0x72, 0x32, 0x39, + 0x48, 0xc8, 0xf3, 0x43, 0x46, 0xf8, 0x54, 0x1e, 0x64, 0xbf, 0x82, 0xec, 0x75, 0xe3, 0xa6, 0x89, + 0x9e, 0xfc, 0x1f, 0x00, 0x00, 0xff, 0xff, 0x06, 0x20, 0x25, 0xf2, 0x9b, 0x06, 0x00, 0x00, } func (m *Range) Marshal() (dAtA []byte, err error) { @@ -1176,11 +1166,6 @@ func (m *Tombstone) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } - if m.Epoch != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.Epoch)) - i-- - dAtA[i] = 0x8 - } return len(dAtA) - i, nil } @@ -1659,9 +1644,6 @@ func (m *Tombstone) Size() (n int) { } var l int _ = l - if m.Epoch != 0 { - n += 1 + sovTypes(uint64(m.Epoch)) - } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -2436,25 +2418,6 @@ func (m *Tombstone) Unmarshal(dAtA []byte) error { return fmt.Errorf("proto: Tombstone: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Epoch", wireType) - } - m.Epoch = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Epoch |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } default: iNdEx = preIndex skippy, err := skipTypes(dAtA[iNdEx:]) diff --git a/object/types.proto b/object/types.proto index d2bbaab..8f50f76 100644 --- a/object/types.proto +++ b/object/types.proto @@ -48,10 +48,7 @@ message Header { } } -message Tombstone { - // Epoch when tombstone was created - uint64 Epoch = 1; -} +message Tombstone {} message SystemHeader { // Version of the object structure From dea70026259ea7a6de540db24682bfafcdc6abbf Mon Sep 17 00:00:00 2001 From: alexvanin Date: Wed, 15 Jan 2020 17:11:39 +0300 Subject: [PATCH 0066/1196] docs: Update doc for object proto file Tombstone header in the object does not contain timestamp now. --- docs/object.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/docs/object.md b/docs/object.md index 9e7efe6..e9248ba 100644 --- a/docs/object.md +++ b/docs/object.md @@ -441,10 +441,6 @@ in distributed system. -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| Epoch | [uint64](#uint64) | | Epoch when tombstone was created | - From f0097d6c248f301f1f9ff8cc31355662ddbf36fd Mon Sep 17 00:00:00 2001 From: alexvanin Date: Thu, 16 Jan 2020 14:16:20 +0300 Subject: [PATCH 0067/1196] dep: Update neofs-crypto lib to v0.2.3 --- go.mod | 2 +- go.sum | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/go.mod b/go.mod index bb8c4ff..688905e 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/golang/protobuf v1.3.2 github.com/google/uuid v1.1.1 github.com/mr-tron/base58 v1.1.3 - github.com/nspcc-dev/neofs-crypto v0.2.2 + github.com/nspcc-dev/neofs-crypto v0.2.3 github.com/nspcc-dev/netmap v1.6.1 github.com/nspcc-dev/tzhash v1.3.0 github.com/pkg/errors v0.8.1 diff --git a/go.sum b/go.sum index db7763e..531a682 100644 --- a/go.sum +++ b/go.sum @@ -106,12 +106,12 @@ github.com/mr-tron/base58 v1.1.3/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjW github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/nspcc-dev/hrw v1.0.8 h1:vwRuJXZXgkMvf473vFzeWGCfY1WBVeSHAEHvR4u3/Cg= github.com/nspcc-dev/hrw v1.0.8/go.mod h1:l/W2vx83vMQo6aStyx2AuZrJ+07lGv2JQGlVkPG06MU= -github.com/nspcc-dev/neofs-crypto v0.2.2 h1:jLc5O+Wdpaq7L4lNYFX7li+OP4I1FsvvcPW1NXm3erY= -github.com/nspcc-dev/neofs-crypto v0.2.2/go.mod h1:F/96fUzPM3wR+UGsPi3faVNmFlA9KAEAUQR7dMxZmNA= +github.com/nspcc-dev/neofs-crypto v0.2.3 h1:aca3X2aly92ENRbFK+kH6Hd+J9EQ4Eu6XMVoITSIKtc= +github.com/nspcc-dev/neofs-crypto v0.2.3/go.mod h1:8w16GEJbH6791ktVqHN9YRNH3s9BEEKYxGhlFnp0cDw= github.com/nspcc-dev/netmap v1.6.1 h1:Pigqpqi6QSdRiusbq5XlO20A18k6Eyu7j9MzOfAE3CM= github.com/nspcc-dev/netmap v1.6.1/go.mod h1:mhV3UOg9ljQmu0teQShD6+JYX09XY5gu2I4hIByCH9M= -github.com/nspcc-dev/rfc6979 v0.1.0 h1:Lwg7esRRoyK1Up/IN1vAef1EmvrBeMHeeEkek2fAJ6c= -github.com/nspcc-dev/rfc6979 v0.1.0/go.mod h1:exhIh1PdpDC5vQmyEsGvc4YDM/lyQp/452QxGq/UEso= +github.com/nspcc-dev/rfc6979 v0.2.0 h1:3e1WNxrN60/6N0DW7+UYisLeZJyfqZTNOjeV/toYvOE= +github.com/nspcc-dev/rfc6979 v0.2.0/go.mod h1:exhIh1PdpDC5vQmyEsGvc4YDM/lyQp/452QxGq/UEso= github.com/nspcc-dev/tzhash v1.3.0 h1:n6FTHsfPYbMi5Jmo6SwGVVRQD8i2w1P2ScCaW6rz69Q= github.com/nspcc-dev/tzhash v1.3.0/go.mod h1:Lc4DersKS8MNIrunTmsAzANO56qnG+LZ4GOE/WYGVzU= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= From 50d3649acf2143125b1eb1fece68b43c091596c5 Mon Sep 17 00:00:00 2001 From: alexvanin Date: Thu, 16 Jan 2020 14:17:34 +0300 Subject: [PATCH 0068/1196] object: Add public key header type Object can contain public key header. It will be used for object verification. This header can contain owner's public key or be the part of x509 chain verification in couple with verification header. --- object/types.go | 6 + object/types.pb.go | 376 ++++++++++++++++++++++++++++++++++++++------- object/types.proto | 7 + 3 files changed, 334 insertions(+), 55 deletions(-) diff --git a/object/types.go b/object/types.go index f433b9c..79cef65 100644 --- a/object/types.go +++ b/object/types.go @@ -67,6 +67,8 @@ const ( IntegrityHdr // StorageGroupHdr is a storage group header type. StorageGroupHdr + // PublicKeyHdr is a public key header type. + PublicKeyHdr ) var ( @@ -140,6 +142,8 @@ func (m Header) typeOf(t isHeader_Value) (ok bool) { _, ok = m.Value.(*Header_Integrity) case *Header_StorageGroup: _, ok = m.Value.(*Header_StorageGroup) + case *Header_PublicKey: + _, ok = m.Value.(*Header_PublicKey) } return } @@ -168,6 +172,8 @@ func HeaderType(t headerType) Pred { return func(h *Header) bool { _, ok := h.Value.(*Header_Integrity); return ok } case StorageGroupHdr: return func(h *Header) bool { _, ok := h.Value.(*Header_StorageGroup); return ok } + case PublicKeyHdr: + return func(h *Header) bool { _, ok := h.Value.(*Header_PublicKey); return ok } default: return nil } diff --git a/object/types.pb.go b/object/types.pb.go index b5a1e78..525b39b 100644 --- a/object/types.pb.go +++ b/object/types.pb.go @@ -220,6 +220,7 @@ type Header struct { // *Header_PayloadChecksum // *Header_Integrity // *Header_StorageGroup + // *Header_PublicKey Value isHeader_Value `protobuf_oneof:"Value"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -291,6 +292,9 @@ type Header_Integrity struct { type Header_StorageGroup struct { StorageGroup *storagegroup.StorageGroup `protobuf:"bytes,10,opt,name=StorageGroup,proto3,oneof" json:"StorageGroup,omitempty"` } +type Header_PublicKey struct { + PublicKey *PublicKey `protobuf:"bytes,11,opt,name=PublicKey,proto3,oneof" json:"PublicKey,omitempty"` +} func (*Header_Link) isHeader_Value() {} func (*Header_Redirect) isHeader_Value() {} @@ -302,6 +306,7 @@ func (*Header_HomoHash) isHeader_Value() {} func (*Header_PayloadChecksum) isHeader_Value() {} func (*Header_Integrity) isHeader_Value() {} func (*Header_StorageGroup) isHeader_Value() {} +func (*Header_PublicKey) isHeader_Value() {} func (m *Header) GetValue() isHeader_Value { if m != nil { @@ -373,6 +378,13 @@ func (m *Header) GetStorageGroup() *storagegroup.StorageGroup { return nil } +func (m *Header) GetPublicKey() *PublicKey { + if x, ok := m.GetValue().(*Header_PublicKey); ok { + return x.PublicKey + } + return nil +} + // XXX_OneofWrappers is for the internal use of the proto package. func (*Header) XXX_OneofWrappers() []interface{} { return []interface{}{ @@ -386,6 +398,7 @@ func (*Header) XXX_OneofWrappers() []interface{} { (*Header_PayloadChecksum)(nil), (*Header_Integrity)(nil), (*Header_StorageGroup)(nil), + (*Header_PublicKey)(nil), } } @@ -750,6 +763,50 @@ func (m *Object) GetPayload() []byte { return nil } +type PublicKey struct { + // Value contains marshaled ecdsa public key + Value []byte `protobuf:"bytes,1,opt,name=Value,proto3" json:"Value,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *PublicKey) Reset() { *m = PublicKey{} } +func (m *PublicKey) String() string { return proto.CompactTextString(m) } +func (*PublicKey) ProtoMessage() {} +func (*PublicKey) Descriptor() ([]byte, []int) { + return fileDescriptor_02021a1d39b1aee0, []int{10} +} +func (m *PublicKey) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *PublicKey) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *PublicKey) XXX_Merge(src proto.Message) { + xxx_messageInfo_PublicKey.Merge(m, src) +} +func (m *PublicKey) XXX_Size() int { + return m.Size() +} +func (m *PublicKey) XXX_DiscardUnknown() { + xxx_messageInfo_PublicKey.DiscardUnknown(m) +} + +var xxx_messageInfo_PublicKey proto.InternalMessageInfo + +func (m *PublicKey) GetValue() []byte { + if m != nil { + return m.Value + } + return nil +} + func init() { proto.RegisterEnum("object.Link_Type", Link_Type_name, Link_Type_value) proto.RegisterEnum("object.Transform_Type", Transform_Type_name, Transform_Type_value) @@ -763,66 +820,69 @@ func init() { proto.RegisterType((*Link)(nil), "object.Link") proto.RegisterType((*Transform)(nil), "object.Transform") proto.RegisterType((*Object)(nil), "object.Object") + proto.RegisterType((*PublicKey)(nil), "object.PublicKey") } func init() { proto.RegisterFile("object/types.proto", fileDescriptor_02021a1d39b1aee0) } var fileDescriptor_02021a1d39b1aee0 = []byte{ - // 863 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x55, 0xcb, 0x8e, 0xe3, 0x44, - 0x14, 0xb5, 0x13, 0xe7, 0x75, 0xe3, 0x99, 0xf6, 0x14, 0xc3, 0x60, 0x05, 0x91, 0x6e, 0x59, 0x3c, - 0x9a, 0x81, 0x76, 0x8b, 0x1e, 0xd0, 0x88, 0x05, 0x88, 0x4e, 0x07, 0xe1, 0x88, 0x81, 0x6e, 0x55, - 0x3f, 0x16, 0xec, 0x9c, 0xb8, 0xe2, 0x14, 0x9d, 0x54, 0x45, 0x55, 0x95, 0x99, 0xc9, 0x9e, 0x2f, - 0x60, 0xc5, 0x8e, 0xdf, 0x99, 0x25, 0x4b, 0x34, 0x8b, 0x16, 0x6a, 0x3e, 0x80, 0x5f, 0x40, 0x55, - 0xb6, 0x13, 0xbb, 0x67, 0x36, 0x56, 0xdd, 0x7b, 0xce, 0x29, 0xdf, 0xba, 0xf7, 0x94, 0x0d, 0x88, - 0x8f, 0x7f, 0x25, 0x13, 0x75, 0xa8, 0xd6, 0x4b, 0x22, 0xc3, 0xa5, 0xe0, 0x8a, 0xa3, 0x66, 0x96, - 0xeb, 0x79, 0x82, 0x4c, 0x65, 0x19, 0xe9, 0xbd, 0x23, 0x89, 0x94, 0x94, 0xb3, 0x4a, 0xd2, 0x97, - 0x8a, 0x8b, 0x38, 0x25, 0xa9, 0xe0, 0xab, 0x65, 0x05, 0x39, 0x48, 0xa9, 0x9a, 0xad, 0xc6, 0xe1, - 0x84, 0x2f, 0x0e, 0x53, 0x9e, 0xf2, 0x43, 0x93, 0x1e, 0xaf, 0xa6, 0x26, 0x32, 0x81, 0x59, 0x65, - 0xf4, 0xe0, 0x29, 0x34, 0x70, 0xcc, 0x52, 0x82, 0x1e, 0x41, 0xf3, 0x74, 0x3a, 0x95, 0x44, 0xf9, - 0xf6, 0x9e, 0xbd, 0xef, 0xe0, 0x3c, 0xd2, 0xf9, 0x67, 0x84, 0xa5, 0x6a, 0xe6, 0xd7, 0xb2, 0x7c, - 0x16, 0x05, 0x5f, 0x02, 0x5c, 0x4a, 0x22, 0x22, 0x12, 0x27, 0x44, 0x20, 0x0f, 0xea, 0x3f, 0x92, - 0xb5, 0x91, 0x76, 0xb0, 0x5e, 0xa2, 0x87, 0xd0, 0xb8, 0x8a, 0xe7, 0x2b, 0x62, 0x64, 0x1d, 0x9c, - 0x05, 0xc1, 0x6f, 0x0e, 0x34, 0x73, 0x49, 0x00, 0xce, 0x33, 0xca, 0xae, 0x8d, 0xa6, 0x7b, 0xe4, - 0x86, 0x59, 0x03, 0x42, 0x9d, 0x8b, 0x2c, 0x6c, 0x30, 0xf4, 0x19, 0xb4, 0x31, 0x49, 0xa8, 0x20, - 0x13, 0x65, 0xf6, 0xe9, 0x1e, 0xdd, 0x0b, 0x75, 0x83, 0xc2, 0xe3, 0x24, 0x11, 0x44, 0xca, 0xc8, - 0xc2, 0x1b, 0x02, 0xaa, 0x54, 0xe4, 0xd7, 0x0d, 0x1d, 0x15, 0xdb, 0x6e, 0x91, 0xc8, 0xc2, 0xe5, - 0xca, 0xbf, 0x80, 0xce, 0x85, 0x88, 0x99, 0x9c, 0x72, 0xb1, 0xf0, 0x1d, 0x23, 0x7a, 0x50, 0x88, - 0x36, 0x40, 0x64, 0xe1, 0x2d, 0xcb, 0x48, 0xf8, 0x62, 0x2c, 0x15, 0x67, 0xc4, 0x6f, 0xdc, 0x91, - 0x14, 0x80, 0x91, 0x14, 0x01, 0xfa, 0x0a, 0x9a, 0x57, 0x44, 0xd0, 0xe9, 0xda, 0x6f, 0x1a, 0xfe, - 0xfb, 0x61, 0x3e, 0xd5, 0xd0, 0xa4, 0xe9, 0x24, 0x56, 0x94, 0xb3, 0x4d, 0x81, 0x39, 0x19, 0x7d, - 0x0c, 0xed, 0x88, 0x2f, 0x78, 0x14, 0xcb, 0x99, 0xdf, 0xda, 0xb3, 0xf7, 0xdd, 0x41, 0xfb, 0xf5, - 0xcd, 0xae, 0xa3, 0x63, 0x7d, 0xf4, 0x02, 0x43, 0x8f, 0x61, 0xe7, 0x2c, 0x5e, 0xcf, 0x79, 0x9c, - 0x9c, 0xcc, 0xc8, 0xe4, 0x5a, 0xae, 0x16, 0x7e, 0x5b, 0xd3, 0x23, 0x0b, 0xdf, 0x05, 0xd0, 0x53, - 0xe8, 0x8c, 0x98, 0x22, 0xa9, 0xa0, 0x6a, 0xed, 0x77, 0x4c, 0x35, 0xef, 0x15, 0xd5, 0x6f, 0x80, - 0x4d, 0x25, 0x5b, 0x2e, 0xfa, 0x0e, 0xdc, 0xf3, 0xcc, 0x75, 0x3f, 0x68, 0xd7, 0xf9, 0x60, 0xb4, - 0xbd, 0xb0, 0x6c, 0xc5, 0xb0, 0xcc, 0x88, 0x2c, 0x5c, 0x51, 0x0c, 0x5a, 0xb9, 0x27, 0x82, 0x6e, - 0xa9, 0x83, 0xc1, 0x7f, 0x36, 0xb8, 0xe7, 0x6b, 0xa9, 0xc8, 0x22, 0x1f, 0x89, 0x0f, 0xad, 0x2b, - 0x22, 0x74, 0x77, 0x72, 0x2f, 0x16, 0x21, 0xfa, 0x10, 0xee, 0xe5, 0xc7, 0xa9, 0x78, 0xb2, 0x9a, - 0x44, 0x3d, 0xa8, 0x8d, 0x86, 0xc6, 0x00, 0xee, 0x00, 0x5e, 0xdd, 0xec, 0x5a, 0xaf, 0x6f, 0x76, - 0x6b, 0xa3, 0x21, 0xae, 0x8d, 0x86, 0xe8, 0x53, 0x68, 0x9d, 0xbe, 0x60, 0x44, 0x8c, 0x86, 0x66, - 0xd8, 0xee, 0x60, 0x27, 0x27, 0x14, 0x69, 0x5c, 0x2c, 0xd0, 0x07, 0x50, 0x3f, 0x19, 0x0d, 0xcd, - 0x80, 0xdd, 0x41, 0x37, 0xa7, 0xe9, 0x14, 0xd6, 0x0f, 0xf4, 0x35, 0x74, 0x4e, 0x04, 0x89, 0x15, - 0x49, 0x8e, 0x55, 0x3e, 0xd5, 0x77, 0x8b, 0x3e, 0x1a, 0x80, 0x72, 0x76, 0xc6, 0x29, 0x53, 0x03, - 0x47, 0x6b, 0xf1, 0x96, 0x1d, 0x1c, 0xc3, 0xbd, 0x0a, 0x03, 0xf5, 0xa0, 0x7d, 0xc9, 0xe8, 0xcb, - 0x0b, 0xba, 0x20, 0xe6, 0xc8, 0x75, 0xbc, 0x89, 0xf5, 0x45, 0xfa, 0x7e, 0xc9, 0x27, 0xc5, 0x59, - 0xb3, 0x20, 0xa0, 0xb0, 0x73, 0x67, 0x58, 0x68, 0x1f, 0x76, 0xb2, 0x95, 0xdc, 0x98, 0x40, 0xef, - 0xe5, 0xe2, 0xbb, 0x69, 0xf4, 0x39, 0x3c, 0x28, 0xd6, 0xe7, 0x34, 0x65, 0xb1, 0x5a, 0x89, 0xec, - 0x9e, 0xba, 0xf8, 0x4d, 0x20, 0xf8, 0xd3, 0xce, 0x6e, 0x2a, 0xfa, 0x08, 0x1c, 0xfd, 0xa5, 0x31, - 0xbb, 0xde, 0xdf, 0x5a, 0x5e, 0x63, 0xe1, 0xc5, 0x7a, 0x49, 0xb0, 0x81, 0xf3, 0xf6, 0xd7, 0xde, - 0xd6, 0xfe, 0xe0, 0x02, 0x1c, 0xcd, 0x44, 0x5d, 0x68, 0x5d, 0xb2, 0x6b, 0xc6, 0x5f, 0x30, 0xcf, - 0x42, 0x00, 0xcd, 0xb3, 0x58, 0x10, 0xa6, 0x3c, 0x1b, 0xb9, 0xd0, 0x3e, 0x13, 0xe4, 0x39, 0xe5, - 0x2b, 0xe9, 0xd5, 0x50, 0x1b, 0x9c, 0x9f, 0xc9, 0x4b, 0xe5, 0xd5, 0x51, 0x07, 0x1a, 0x27, 0x33, - 0x3a, 0x4f, 0x3c, 0x07, 0x79, 0x55, 0x1f, 0x7a, 0x8d, 0x60, 0x5e, 0xba, 0xc3, 0xe8, 0x71, 0xa5, - 0xca, 0x47, 0x6f, 0xdc, 0xe5, 0x52, 0xa9, 0xc1, 0x93, 0xb7, 0x95, 0xd3, 0x81, 0xc6, 0xf9, 0x72, - 0x4e, 0x75, 0x35, 0x6d, 0x70, 0x74, 0x1f, 0xbc, 0x9a, 0x4e, 0xfe, 0xc4, 0x57, 0xf3, 0xc4, 0xab, - 0x07, 0xbf, 0xdb, 0xd0, 0x3c, 0x35, 0x9b, 0xa2, 0x6f, 0xab, 0xce, 0xcd, 0xbf, 0x65, 0x0f, 0x8b, - 0x77, 0x96, 0xb1, 0xdc, 0x05, 0x55, 0xa7, 0x87, 0xd0, 0xca, 0x67, 0xe3, 0xd7, 0xf6, 0xea, 0xfb, - 0xdd, 0xa3, 0xfb, 0x85, 0xb4, 0x22, 0x2a, 0x48, 0xfa, 0x66, 0xe4, 0x56, 0xcf, 0xec, 0x8d, 0x8b, - 0x70, 0xf0, 0xcd, 0xab, 0xdb, 0xbe, 0xfd, 0xd7, 0x6d, 0xdf, 0xfe, 0xfb, 0xb6, 0x6f, 0xff, 0x73, - 0xdb, 0xb7, 0xff, 0xf8, 0xb7, 0x6f, 0xfd, 0xf2, 0x49, 0xe9, 0x67, 0xc0, 0xe4, 0x72, 0x32, 0x39, - 0x48, 0xc8, 0xf3, 0x43, 0x46, 0xf8, 0x54, 0x1e, 0x64, 0xbf, 0x82, 0xec, 0x75, 0xe3, 0xa6, 0x89, - 0x9e, 0xfc, 0x1f, 0x00, 0x00, 0xff, 0xff, 0x06, 0x20, 0x25, 0xf2, 0x9b, 0x06, 0x00, 0x00, + // 892 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x55, 0xcb, 0x72, 0x1b, 0x45, + 0x14, 0xd5, 0x48, 0xa3, 0xd7, 0xd5, 0x38, 0x9e, 0x34, 0x21, 0x4c, 0x89, 0x42, 0x36, 0x53, 0x3c, + 0x4c, 0xc0, 0xe3, 0xc2, 0x81, 0x4a, 0xb1, 0x80, 0xc2, 0xb2, 0x28, 0xa4, 0x22, 0x60, 0x55, 0xfb, + 0xb1, 0x60, 0x37, 0x92, 0x5a, 0xa3, 0xc6, 0x52, 0xb7, 0xaa, 0xbb, 0x27, 0x89, 0x7e, 0x83, 0x15, + 0x3b, 0x3e, 0x83, 0x5f, 0xc8, 0x92, 0x25, 0x95, 0x85, 0x8b, 0x32, 0x1f, 0xc0, 0x2f, 0xa4, 0xba, + 0xe7, 0xa1, 0x19, 0x27, 0x1b, 0x55, 0x9f, 0x7b, 0xce, 0x69, 0xdd, 0xb9, 0x7d, 0x7a, 0x06, 0x10, + 0x9f, 0xfc, 0x46, 0xa6, 0xea, 0x48, 0x6d, 0xd6, 0x44, 0x06, 0x6b, 0xc1, 0x15, 0x47, 0x8d, 0xa4, + 0xd6, 0x75, 0x05, 0x99, 0xcb, 0x22, 0xd3, 0x7d, 0x47, 0x12, 0x29, 0x29, 0x67, 0xa5, 0xa2, 0x27, + 0x15, 0x17, 0x61, 0x44, 0x22, 0xc1, 0xe3, 0x75, 0x89, 0x39, 0x8c, 0xa8, 0x5a, 0xc4, 0x93, 0x60, + 0xca, 0x57, 0x47, 0x11, 0x8f, 0xf8, 0x91, 0x29, 0x4f, 0xe2, 0xb9, 0x41, 0x06, 0x98, 0x55, 0x22, + 0xf7, 0x9f, 0x40, 0x1d, 0x87, 0x2c, 0x22, 0xe8, 0x21, 0x34, 0xce, 0xe6, 0x73, 0x49, 0x94, 0x67, + 0xed, 0x5b, 0x07, 0x36, 0x4e, 0x91, 0xae, 0x3f, 0x25, 0x2c, 0x52, 0x0b, 0xaf, 0x9a, 0xd4, 0x13, + 0xe4, 0x7f, 0x05, 0x70, 0x29, 0x89, 0x18, 0x92, 0x70, 0x46, 0x04, 0x72, 0xa1, 0xf6, 0x13, 0xd9, + 0x18, 0x6b, 0x1b, 0xeb, 0x25, 0x7a, 0x00, 0xf5, 0xab, 0x70, 0x19, 0x13, 0x63, 0x6b, 0xe3, 0x04, + 0xf8, 0x7f, 0xd9, 0xd0, 0x48, 0x2d, 0x3e, 0xd8, 0x4f, 0x29, 0xbb, 0x36, 0x9e, 0xce, 0xb1, 0x13, + 0x24, 0x03, 0x08, 0x74, 0x6d, 0x58, 0xc1, 0x86, 0x43, 0x9f, 0x43, 0x0b, 0x93, 0x19, 0x15, 0x64, + 0xaa, 0xcc, 0x3e, 0x9d, 0xe3, 0x9d, 0x40, 0x0f, 0x28, 0x38, 0x99, 0xcd, 0x04, 0x91, 0x72, 0x58, + 0xc1, 0xb9, 0x00, 0x95, 0x3a, 0xf2, 0x6a, 0x46, 0x8e, 0xb2, 0x6d, 0xb7, 0xcc, 0xb0, 0x82, 0x8b, + 0x9d, 0x7f, 0x09, 0xed, 0x0b, 0x11, 0x32, 0x39, 0xe7, 0x62, 0xe5, 0xd9, 0xc6, 0x74, 0x3f, 0x33, + 0xe5, 0xc4, 0xb0, 0x82, 0xb7, 0x2a, 0x63, 0xe1, 0xab, 0x89, 0x54, 0x9c, 0x11, 0xaf, 0x7e, 0xc7, + 0x92, 0x11, 0xc6, 0x92, 0x01, 0xf4, 0x35, 0x34, 0xae, 0x88, 0xa0, 0xf3, 0x8d, 0xd7, 0x30, 0xfa, + 0xf7, 0x83, 0xf4, 0x54, 0x03, 0x53, 0xa6, 0xd3, 0x50, 0x51, 0xce, 0xf2, 0x06, 0x53, 0x31, 0xfa, + 0x04, 0x5a, 0x43, 0xbe, 0xe2, 0xc3, 0x50, 0x2e, 0xbc, 0xe6, 0xbe, 0x75, 0xe0, 0xf4, 0x5b, 0xaf, + 0x6e, 0xf6, 0x6c, 0x8d, 0xf5, 0xa3, 0x67, 0x1c, 0x7a, 0x04, 0xbb, 0xe3, 0x70, 0xb3, 0xe4, 0xe1, + 0xec, 0x74, 0x41, 0xa6, 0xd7, 0x32, 0x5e, 0x79, 0x2d, 0x2d, 0x1f, 0x56, 0xf0, 0x5d, 0x02, 0x3d, + 0x81, 0xf6, 0x88, 0x29, 0x12, 0x09, 0xaa, 0x36, 0x5e, 0xdb, 0x74, 0xf3, 0x5e, 0xd6, 0x7d, 0x4e, + 0xe4, 0x9d, 0x6c, 0xb5, 0xe8, 0x7b, 0x70, 0xce, 0x93, 0xd4, 0xfd, 0xa8, 0x53, 0xe7, 0x81, 0xf1, + 0x76, 0x83, 0x62, 0x14, 0x83, 0xa2, 0x62, 0x58, 0xc1, 0x25, 0x87, 0x1e, 0xdc, 0x38, 0x9e, 0x2c, + 0xe9, 0x54, 0x67, 0xa5, 0x53, 0x1e, 0x5c, 0x4e, 0xe8, 0x3f, 0xcd, 0x41, 0xbf, 0x99, 0xc6, 0xc8, + 0xef, 0x14, 0x86, 0xee, 0xff, 0x6f, 0x81, 0x73, 0xbe, 0x91, 0x8a, 0xac, 0xd2, 0x53, 0xf4, 0xa0, + 0x79, 0x45, 0x84, 0x1e, 0x68, 0x1a, 0xdf, 0x0c, 0xa2, 0x8f, 0x60, 0x27, 0x9d, 0x40, 0x29, 0xc6, + 0xe5, 0x22, 0xea, 0x42, 0x75, 0x34, 0x30, 0x99, 0x71, 0xfa, 0xf0, 0xf2, 0x66, 0xaf, 0xf2, 0xea, + 0x66, 0xaf, 0x3a, 0x1a, 0xe0, 0xea, 0x68, 0x80, 0x3e, 0x83, 0xe6, 0xd9, 0x73, 0x46, 0xc4, 0x68, + 0x60, 0xf2, 0xe1, 0xf4, 0x77, 0x53, 0x41, 0x56, 0xc6, 0xd9, 0x02, 0x7d, 0x00, 0xb5, 0xd3, 0xd1, + 0xc0, 0x64, 0xc2, 0xe9, 0x77, 0x52, 0x99, 0x2e, 0x61, 0xfd, 0x83, 0xbe, 0x81, 0xf6, 0xa9, 0x20, + 0xa1, 0x22, 0xb3, 0x13, 0x95, 0x06, 0xe1, 0xdd, 0xec, 0xf9, 0x0d, 0x41, 0x39, 0x1b, 0x73, 0xca, + 0x54, 0xdf, 0xd6, 0x5e, 0xbc, 0x55, 0xfb, 0x27, 0xb0, 0x53, 0x52, 0xa0, 0x2e, 0xb4, 0x2e, 0x19, + 0x7d, 0x71, 0x41, 0x57, 0xc4, 0x3c, 0x72, 0x0d, 0xe7, 0x58, 0xdf, 0xbd, 0x1f, 0xd6, 0x7c, 0x9a, + 0x3d, 0x6b, 0x02, 0x7c, 0x0a, 0xbb, 0x77, 0xce, 0x17, 0x1d, 0xc0, 0x6e, 0xb2, 0x92, 0x79, 0x6e, + 0xf4, 0x5e, 0x0e, 0xbe, 0x5b, 0x46, 0x5f, 0xc0, 0xfd, 0x6c, 0x7d, 0x4e, 0x23, 0x16, 0xaa, 0x58, + 0x24, 0x57, 0xdb, 0xc1, 0x6f, 0x12, 0xfe, 0x9f, 0x56, 0x72, 0xb9, 0xd1, 0xc7, 0x60, 0xeb, 0x97, + 0x93, 0xd9, 0xf5, 0xde, 0xf6, 0xb0, 0x35, 0x17, 0x5c, 0x6c, 0xd6, 0x04, 0x1b, 0x3a, 0x1d, 0x7f, + 0xf5, 0x6d, 0xe3, 0xf7, 0x2f, 0xc0, 0xd6, 0x4a, 0xd4, 0x81, 0xe6, 0x25, 0xbb, 0x66, 0xfc, 0x39, + 0x73, 0x2b, 0x08, 0xa0, 0x31, 0x0e, 0x05, 0x61, 0xca, 0xb5, 0x90, 0x03, 0xad, 0xb1, 0x20, 0xcf, + 0x28, 0x8f, 0xa5, 0x5b, 0x45, 0x2d, 0xb0, 0x7f, 0x21, 0x2f, 0x94, 0x5b, 0x43, 0x6d, 0xa8, 0x9f, + 0x2e, 0xe8, 0x72, 0xe6, 0xda, 0xc8, 0x2d, 0x47, 0xd7, 0xad, 0xfb, 0xcb, 0xc2, 0xb5, 0x47, 0x8f, + 0x4a, 0x5d, 0x3e, 0x7c, 0xe3, 0xfa, 0x17, 0x5a, 0xf5, 0x1f, 0xbf, 0xad, 0x9d, 0x36, 0xd4, 0xcf, + 0xd7, 0x4b, 0xaa, 0xbb, 0x69, 0x81, 0xad, 0xe7, 0xe0, 0x56, 0x75, 0xf1, 0x67, 0x1e, 0x2f, 0x67, + 0x6e, 0xcd, 0xff, 0xdd, 0x82, 0xc6, 0x99, 0xd9, 0x14, 0x7d, 0x57, 0x4e, 0x6e, 0xfa, 0xfa, 0x7b, + 0x90, 0xfd, 0x67, 0x91, 0x4b, 0x53, 0x50, 0x4e, 0x7a, 0x00, 0xcd, 0xf4, 0x6c, 0xbc, 0xea, 0x7e, + 0xed, 0xa0, 0x73, 0x7c, 0x2f, 0xb3, 0x96, 0x4c, 0x99, 0x48, 0xdf, 0x8c, 0x34, 0xea, 0x49, 0xbc, + 0x71, 0x06, 0xfd, 0x0f, 0x0b, 0xb7, 0x71, 0xfb, 0xba, 0x4e, 0xce, 0x3f, 0x01, 0xfd, 0x6f, 0x5f, + 0xde, 0xf6, 0xac, 0xbf, 0x6f, 0x7b, 0xd6, 0x3f, 0xb7, 0x3d, 0xeb, 0xdf, 0xdb, 0x9e, 0xf5, 0xc7, + 0x7f, 0xbd, 0xca, 0xaf, 0x9f, 0x16, 0x3e, 0x31, 0x4c, 0xae, 0xa7, 0xd3, 0xc3, 0x19, 0x79, 0x76, + 0xc4, 0x08, 0x9f, 0xcb, 0xc3, 0xe4, 0x03, 0x93, 0x74, 0x34, 0x69, 0x18, 0xf4, 0xf8, 0x75, 0x00, + 0x00, 0x00, 0xff, 0xff, 0x95, 0x5d, 0xc3, 0x1e, 0xf1, 0x06, 0x00, 0x00, } func (m *Range) Marshal() (dAtA []byte, err error) { @@ -1142,6 +1202,27 @@ func (m *Header_StorageGroup) MarshalToSizedBuffer(dAtA []byte) (int, error) { } return len(dAtA) - i, nil } +func (m *Header_PublicKey) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Header_PublicKey) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.PublicKey != nil { + { + size, err := m.PublicKey.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x5a + } + return len(dAtA) - i, nil +} func (m *Tombstone) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -1456,6 +1537,40 @@ func (m *Object) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *PublicKey) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PublicKey) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PublicKey) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Value) > 0 { + i -= len(m.Value) + copy(dAtA[i:], m.Value) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Value))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func encodeVarintTypes(dAtA []byte, offset int, v uint64) int { offset -= sovTypes(v) base := offset @@ -1638,6 +1753,18 @@ func (m *Header_StorageGroup) Size() (n int) { } return n } +func (m *Header_PublicKey) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.PublicKey != nil { + l = m.PublicKey.Size() + n += 1 + l + sovTypes(uint64(l)) + } + return n +} func (m *Tombstone) Size() (n int) { if m == nil { return 0 @@ -1770,6 +1897,22 @@ func (m *Object) Size() (n int) { return n } +func (m *PublicKey) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Value) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + func sovTypes(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -2364,6 +2507,41 @@ func (m *Header) Unmarshal(dAtA []byte) error { } m.Value = &Header_StorageGroup{v} iNdEx = postIndex + case 11: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PublicKey", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &PublicKey{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Value = &Header_PublicKey{v} + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTypes(dAtA[iNdEx:]) @@ -3215,6 +3393,94 @@ func (m *Object) Unmarshal(dAtA []byte) error { } return nil } +func (m *PublicKey) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: PublicKey: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PublicKey: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Value = append(m.Value[:0], dAtA[iNdEx:postIndex]...) + if m.Value == nil { + m.Value = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipTypes(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/object/types.proto b/object/types.proto index 8f50f76..293f347 100644 --- a/object/types.proto +++ b/object/types.proto @@ -45,6 +45,8 @@ message Header { IntegrityHeader Integrity = 9; // StorageGroup contains meta information for the data audit storagegroup.StorageGroup StorageGroup = 10; + // PublicKey of owner of the object. Key is used for verification and can be based on NeoID or x509 cert. + PublicKey PublicKey = 11; } } @@ -122,3 +124,8 @@ message Object { // Payload is an object's payload bytes Payload = 3; } + +message PublicKey { + // Value contains marshaled ecdsa public key + bytes Value = 1; +} From c2f63107d0c20ad0c1edfa1745ba6b2d4b50f644 Mon Sep 17 00:00:00 2001 From: alexvanin Date: Thu, 16 Jan 2020 14:21:34 +0300 Subject: [PATCH 0069/1196] docs: Add doc about new public key header in object --- docs/object.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/docs/object.md b/docs/object.md index e9248ba..7e86325 100644 --- a/docs/object.md +++ b/docs/object.md @@ -33,6 +33,7 @@ - [IntegrityHeader](#object.IntegrityHeader) - [Link](#object.Link) - [Object](#object.Object) + - [PublicKey](#object.PublicKey) - [Range](#object.Range) - [SystemHeader](#object.SystemHeader) - [Tombstone](#object.Tombstone) @@ -368,6 +369,7 @@ in distributed system. | PayloadChecksum | [bytes](#bytes) | | PayloadChecksum of actual object's payload | | Integrity | [IntegrityHeader](#object.IntegrityHeader) | | Integrity header with checksum of all above headers in the object | | StorageGroup | [storagegroup.StorageGroup](#storagegroup.StorageGroup) | | StorageGroup contains meta information for the data audit | +| PublicKey | [PublicKey](#object.PublicKey) | | PublicKey of owner of the object. Key is used for verification and can be based on NeoID or x509 cert. | @@ -407,6 +409,17 @@ in distributed system. | Payload | [bytes](#bytes) | | Payload is an object's payload | + + +### Message PublicKey + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| Value | [bytes](#bytes) | | Value contains marshaled ecdsa public key | + + ### Message Range From f1418ef79dd7e998954a9f02ba9733f39124ed39 Mon Sep 17 00:00:00 2001 From: alexvanin Date: Thu, 16 Jan 2020 14:38:08 +0300 Subject: [PATCH 0070/1196] object: Add `CreateIntegrityHeader` function CreateIntegrityHeader function allow to optimize object put pipeline in neofs nodes. --- object/verification.go | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/object/verification.go b/object/verification.go index 761c04e..cbf12ab 100644 --- a/object/verification.go +++ b/object/verification.go @@ -63,6 +63,7 @@ func (m Object) verifySignature(key []byte, ih *IntegrityHeader) error { // Verify performs local integrity check by finding verification header and // integrity header. If header integrity is passed, function verifies // checksum of the object payload. +// todo: move this verification logic into separate library func (m Object) Verify() error { var ( err error @@ -111,22 +112,32 @@ func (m Object) Verify() error { return nil } -// Sign creates new integrity header and adds it to the end of the list of -// extended headers. -func (m *Object) Sign(key *ecdsa.PrivateKey) error { - headerChecksum, err := m.headersChecksum(false) +// CreateIntegrityHeader returns signed integrity header for the object +func CreateIntegrityHeader(obj *Object, key *ecdsa.PrivateKey) (*Header, error) { + headerChecksum, err := obj.headersChecksum(false) if err != nil { - return err + return nil, err } headerChecksumSignature, err := crypto.Sign(key, headerChecksum) if err != nil { - return err + return nil, err } - m.AddHeader(&Header{Value: &Header_Integrity{ + + return &Header{Value: &Header_Integrity{ Integrity: &IntegrityHeader{ HeadersChecksum: headerChecksum, ChecksumSignature: headerChecksumSignature, }, - }}) + }}, nil +} + +// Sign creates new integrity header and adds it to the end of the list of +// extended headers. +func (m *Object) Sign(key *ecdsa.PrivateKey) error { + ih, err := CreateIntegrityHeader(m, key) + if err != nil { + return err + } + m.AddHeader(ih) return nil } From 81cdfcc502a47ddc4f781903585f7ab264fa45f3 Mon Sep 17 00:00:00 2001 From: alexvanin Date: Thu, 16 Jan 2020 17:32:57 +0300 Subject: [PATCH 0071/1196] object: Update verify routine Verify routine now supports public key field to check if integrity header contains correct signature of object header. Verify also have strict check that integrity header is last header in the list of headers. --- object/extensions.go | 1 + object/verification.go | 28 +++++++++++++-------- object/verification_test.go | 50 ++++++++++++++++++++++++++++++++++--- 3 files changed, 64 insertions(+), 15 deletions(-) diff --git a/object/extensions.go b/object/extensions.go index 7427079..f6b10ab 100644 --- a/object/extensions.go +++ b/object/extensions.go @@ -1,4 +1,5 @@ package object +// todo: all extensions must be transferred to the separate util library import "github.com/nspcc-dev/neofs-proto/storagegroup" diff --git a/object/verification.go b/object/verification.go index cbf12ab..742375a 100644 --- a/object/verification.go +++ b/object/verification.go @@ -68,24 +68,30 @@ func (m Object) Verify() error { var ( err error checksum []byte + pubkey []byte ) - // Prepare structures - _, vh := m.LastHeader(HeaderType(VerifyHdr)) - if vh == nil { - return ErrHeaderNotFound - } - verify := vh.Value.(*Header_Verify).Verify - - _, ih := m.LastHeader(HeaderType(IntegrityHdr)) - if ih == nil { + ind, ih := m.LastHeader(HeaderType(IntegrityHdr)) + if ih == nil || ind != len(m.Headers) - 1{ return ErrHeaderNotFound } integrity := ih.Value.(*Header_Integrity).Integrity + // Prepare structures + _, vh := m.LastHeader(HeaderType(VerifyHdr)) + if vh == nil { + _, pkh := m.LastHeader(HeaderType(PublicKeyHdr)) + if pkh == nil { + return ErrHeaderNotFound + } + pubkey = pkh.Value.(*Header_PublicKey).PublicKey.Value + } else { + pubkey = vh.Value.(*Header_Verify).Verify.PublicKey + } + // Verify signature - err = m.verifySignature(verify.PublicKey, integrity) + err = m.verifySignature(pubkey, integrity) if err != nil { - return errors.Wrapf(err, "public key: %x", verify.PublicKey) + return errors.Wrapf(err, "public key: %x", pubkey) } // Verify checksum of header diff --git a/object/verification_test.go b/object/verification_test.go index f91e051..b538023 100644 --- a/object/verification_test.go +++ b/object/verification_test.go @@ -56,7 +56,7 @@ func TestObject_Verify(t *testing.T) { obj.SetPayload(payload) obj.SetHeader(&Header{Value: &Header_PayloadChecksum{[]byte("incorrect checksum")}}) - t.Run("error no integrity header", func(t *testing.T) { + t.Run("error no integrity header and pubkey", func(t *testing.T) { err = obj.Verify() require.EqualError(t, err, ErrHeaderNotFound.Error()) }) @@ -83,12 +83,25 @@ func TestObject_Verify(t *testing.T) { } obj.SetVerificationHeader(vh) + // validation header is not last + t.Run("error validation header is not last", func(t *testing.T) { + err = obj.Verify() + require.EqualError(t, err, ErrHeaderNotFound.Error()) + }) + + obj.Headers = obj.Headers[:len(obj.Headers)-2] + obj.SetVerificationHeader(vh) + obj.SetHeader(&Header{Value: &Header_Integrity{ih}}) + t.Run("error invalid header checksum", func(t *testing.T) { err = obj.Verify() require.EqualError(t, err, ErrVerifyHeader.Error()) }) - require.NoError(t, obj.Sign(sessionkey)) + obj.Headers = obj.Headers[:len(obj.Headers)-1] + genIH, err := CreateIntegrityHeader(obj, sessionkey) + require.NoError(t, err) + obj.SetHeader(genIH) t.Run("error invalid payload checksum", func(t *testing.T) { err = obj.Verify() @@ -96,10 +109,39 @@ func TestObject_Verify(t *testing.T) { }) obj.SetHeader(&Header{Value: &Header_PayloadChecksum{obj.PayloadChecksum()}}) - require.NoError(t, obj.Sign(sessionkey)) - t.Run("correct", func(t *testing.T) { + obj.Headers = obj.Headers[:len(obj.Headers)-1] + genIH, err = CreateIntegrityHeader(obj, sessionkey) + require.NoError(t, err) + obj.SetHeader(genIH) + + t.Run("correct with vh", func(t *testing.T) { err = obj.Verify() require.NoError(t, err) }) + + pkh := Header{Value: &Header_PublicKey{&PublicKey{ + Value: crypto.MarshalPublicKey(&key.PublicKey), + }}} + // replace vh with pkh + obj.Headers[len(obj.Headers)-2] = pkh + // re-sign object + obj.Sign(sessionkey) + + + t.Run("incorrect with bad public key", func(t *testing.T) { + err = obj.Verify() + require.Error(t, err) + }) + + obj.SetHeader(&Header{Value: &Header_PublicKey{&PublicKey{ + Value: dataPK, + }}}) + obj.Sign(sessionkey) + + t.Run("correct with good public key", func(t *testing.T) { + err = obj.Verify() + require.NoError(t, err) + }) + } From e88a6ee028d6c841f6e9a7789f9098c537dda440 Mon Sep 17 00:00:00 2001 From: alexvanin Date: Fri, 17 Jan 2020 12:37:04 +0300 Subject: [PATCH 0072/1196] session: Add owner's public key into session token We want to remove all innner ring queries to authenticate owner by public keys. Therefore we put public keys into session token. Later public keys could be gathered with NeoID or other centre of authority. --- session/types.pb.go | 105 ++++++++++++++++++++++++++++++++++---------- session/types.proto | 2 + 2 files changed, 83 insertions(+), 24 deletions(-) diff --git a/session/types.pb.go b/session/types.pb.go index f597612..5b2f5c4 100644 --- a/session/types.pb.go +++ b/session/types.pb.go @@ -91,7 +91,9 @@ type Token struct { // Signature is a token signature, signed by owner of manipulation object Signature []byte `protobuf:"bytes,6,opt,name=Signature,proto3" json:"Signature,omitempty"` // ID is a token identifier. valid UUIDv4 represented in bytes - ID TokenID `protobuf:"bytes,7,opt,name=ID,proto3,customtype=TokenID" json:"ID"` + ID TokenID `protobuf:"bytes,7,opt,name=ID,proto3,customtype=TokenID" json:"ID"` + // PublicKeys associated with owner + PublicKeys [][]byte `protobuf:"bytes,8,rep,name=PublicKeys,proto3" json:"PublicKeys,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -154,6 +156,13 @@ func (m *Token) GetSignature() []byte { return nil } +func (m *Token) GetPublicKeys() [][]byte { + if m != nil { + return m.PublicKeys + } + return nil +} + func init() { proto.RegisterType((*VerificationHeader)(nil), "session.VerificationHeader") proto.RegisterType((*Token)(nil), "session.Token") @@ -162,29 +171,30 @@ func init() { func init() { proto.RegisterFile("session/types.proto", fileDescriptor_c0d9d9cb855cdad8) } var fileDescriptor_c0d9d9cb855cdad8 = []byte{ - // 344 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x91, 0x4d, 0x4b, 0xc3, 0x30, - 0x18, 0xc7, 0x97, 0xee, 0x4d, 0xe3, 0x40, 0x89, 0x97, 0xa2, 0xd2, 0x8d, 0x9d, 0x2a, 0xb8, 0x16, - 0xf4, 0xe4, 0xc5, 0x43, 0xa9, 0x62, 0x99, 0x30, 0xa9, 0xb2, 0x83, 0xb7, 0x36, 0xcb, 0xba, 0xf8, - 0x92, 0x94, 0x26, 0x55, 0xf6, 0x4d, 0xf6, 0x91, 0x76, 0xf4, 0x28, 0x1e, 0x86, 0xd4, 0x2f, 0x22, - 0x4b, 0xbb, 0x75, 0xc3, 0xdb, 0xf3, 0xfc, 0xfe, 0xc9, 0xf3, 0xf2, 0x7f, 0xe0, 0xa1, 0x20, 0x42, - 0x50, 0xce, 0x6c, 0x39, 0x8d, 0x89, 0xb0, 0xe2, 0x84, 0x4b, 0x8e, 0x9a, 0x05, 0x3c, 0xea, 0x45, - 0x54, 0x4e, 0xd2, 0xd0, 0xc2, 0xfc, 0xcd, 0x8e, 0x78, 0xc4, 0x6d, 0xa5, 0x87, 0xe9, 0x58, 0x65, - 0x2a, 0x51, 0x51, 0xfe, 0xaf, 0x3b, 0x84, 0x68, 0x48, 0x12, 0x3a, 0xa6, 0x38, 0x90, 0x94, 0xb3, - 0x5b, 0x12, 0x8c, 0x48, 0x82, 0x4e, 0xe0, 0xee, 0x7d, 0x1a, 0xbe, 0x52, 0xdc, 0x27, 0x53, 0x1d, - 0x74, 0x80, 0xd9, 0xf2, 0x4b, 0x80, 0xba, 0xb0, 0xd5, 0x27, 0xd3, 0x07, 0x1a, 0xb1, 0x40, 0xa6, - 0x09, 0xd1, 0x35, 0xf5, 0x60, 0x8b, 0x75, 0x67, 0x1a, 0xac, 0x3f, 0xf2, 0x17, 0xc2, 0xd0, 0x25, - 0x6c, 0xe4, 0x55, 0x55, 0xa1, 0xbd, 0xf3, 0x63, 0xab, 0x18, 0xd5, 0xfa, 0xdf, 0xd8, 0xa9, 0xcd, - 0x17, 0xed, 0x8a, 0x5f, 0x7c, 0x40, 0xa7, 0xb0, 0x39, 0xf8, 0x60, 0x24, 0xf1, 0xdc, 0xbc, 0x87, - 0xb3, 0xbf, 0x94, 0xbf, 0x17, 0xed, 0x15, 0xf6, 0x57, 0x01, 0x32, 0x20, 0xbc, 0xa1, 0x89, 0x90, - 0xd7, 0x31, 0xc7, 0x13, 0xbd, 0xda, 0x01, 0x66, 0xcd, 0xdf, 0x20, 0xcb, 0x8d, 0xee, 0x82, 0x95, - 0x5c, 0x53, 0x72, 0x09, 0xd0, 0x19, 0xdc, 0x19, 0x84, 0xcf, 0x04, 0x4b, 0xcf, 0xd5, 0xeb, 0x9d, - 0xaa, 0xd9, 0x72, 0x0e, 0x8a, 0x4e, 0x6b, 0xee, 0xaf, 0xa3, 0x65, 0xad, 0x72, 0xf9, 0x46, 0xee, - 0xce, 0x1a, 0xa0, 0x36, 0xd4, 0x3c, 0x57, 0x6f, 0x6e, 0xcf, 0xab, 0xac, 0xf0, 0x5c, 0x5f, 0xf3, - 0x5c, 0xe7, 0x6a, 0x9e, 0x19, 0xe0, 0x33, 0x33, 0xc0, 0x57, 0x66, 0x80, 0x9f, 0xcc, 0x00, 0xb3, - 0x5f, 0xa3, 0xf2, 0x64, 0x6e, 0xdc, 0x8d, 0x89, 0x18, 0xe3, 0xde, 0x88, 0xbc, 0xdb, 0x8c, 0xf0, - 0xb1, 0xe8, 0xe5, 0x57, 0x2b, 0x6c, 0x0b, 0x1b, 0x2a, 0xbd, 0xf8, 0x0b, 0x00, 0x00, 0xff, 0xff, - 0xc6, 0x87, 0x25, 0xf9, 0x08, 0x02, 0x00, 0x00, + // 358 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x91, 0xcd, 0x4e, 0xe3, 0x30, + 0x14, 0x85, 0x9b, 0xf4, 0x77, 0x3c, 0x95, 0x66, 0xe4, 0xd9, 0x44, 0x03, 0x4a, 0xab, 0xae, 0x82, + 0x44, 0x13, 0x09, 0x56, 0x6c, 0x58, 0x44, 0x01, 0x11, 0x15, 0xa9, 0xc8, 0xa0, 0x2e, 0xd8, 0x25, + 0xae, 0x9b, 0x9a, 0x1f, 0x3b, 0x8a, 0x1d, 0x50, 0xdf, 0x84, 0x47, 0xe1, 0x11, 0xba, 0x64, 0x89, + 0x58, 0x54, 0x28, 0xbc, 0x08, 0x8a, 0x93, 0xa6, 0xad, 0xd8, 0xdd, 0xfb, 0x1d, 0xfb, 0x9e, 0xeb, + 0x63, 0xf0, 0x4f, 0x10, 0x21, 0x28, 0x67, 0x8e, 0x5c, 0xc4, 0x44, 0xd8, 0x71, 0xc2, 0x25, 0x87, + 0xed, 0x12, 0xfe, 0x1f, 0x46, 0x54, 0xce, 0xd3, 0xd0, 0xc6, 0xfc, 0xd1, 0x89, 0x78, 0xc4, 0x1d, + 0xa5, 0x87, 0xe9, 0x4c, 0x75, 0xaa, 0x51, 0x55, 0x71, 0x6f, 0x30, 0x01, 0x70, 0x42, 0x12, 0x3a, + 0xa3, 0x38, 0x90, 0x94, 0xb3, 0x0b, 0x12, 0x4c, 0x49, 0x02, 0xf7, 0xc1, 0xaf, 0xab, 0x34, 0x7c, + 0xa0, 0x78, 0x44, 0x16, 0x86, 0xd6, 0xd7, 0xac, 0x2e, 0xda, 0x00, 0x38, 0x00, 0xdd, 0x11, 0x59, + 0x5c, 0xd3, 0x88, 0x05, 0x32, 0x4d, 0x88, 0xa1, 0xab, 0x03, 0x3b, 0x6c, 0xf0, 0xaa, 0x83, 0xe6, + 0x0d, 0xbf, 0x27, 0x0c, 0x9e, 0x80, 0x56, 0x31, 0x55, 0x0d, 0xfa, 0x7d, 0xb4, 0x67, 0x97, 0xab, + 0xda, 0x3f, 0x8d, 0xdd, 0xc6, 0x72, 0xd5, 0xab, 0xa1, 0xf2, 0x02, 0x3c, 0x00, 0xed, 0xf1, 0x33, + 0x23, 0x89, 0xef, 0x15, 0x1e, 0xee, 0x9f, 0x5c, 0xfe, 0x58, 0xf5, 0xd6, 0x18, 0xad, 0x0b, 0x68, + 0x02, 0x70, 0x4e, 0x13, 0x21, 0xcf, 0x62, 0x8e, 0xe7, 0x46, 0xbd, 0xaf, 0x59, 0x0d, 0xb4, 0x45, + 0xf2, 0x17, 0x5d, 0x06, 0x6b, 0xb9, 0xa1, 0xe4, 0x0d, 0x80, 0x87, 0xa0, 0x33, 0x0e, 0xef, 0x08, + 0x96, 0xbe, 0x67, 0x34, 0xfb, 0x75, 0xab, 0xeb, 0xfe, 0x2d, 0x9d, 0x2a, 0x8e, 0xaa, 0x2a, 0x9f, + 0xb5, 0x79, 0x7c, 0xab, 0x48, 0xa7, 0x02, 0xb0, 0x07, 0x74, 0xdf, 0x33, 0xda, 0xbb, 0xfb, 0xaa, + 0x28, 0x7c, 0x0f, 0xe9, 0xc5, 0xaa, 0x55, 0x96, 0xc2, 0xe8, 0xe4, 0x76, 0x68, 0x8b, 0xb8, 0xa7, + 0xcb, 0xcc, 0xd4, 0xde, 0x32, 0x53, 0x7b, 0xcf, 0x4c, 0xed, 0x33, 0x33, 0xb5, 0x97, 0x2f, 0xb3, + 0x76, 0x6b, 0x6d, 0xfd, 0x2b, 0x13, 0x31, 0xc6, 0xc3, 0x29, 0x79, 0x72, 0x18, 0xe1, 0x33, 0x31, + 0x2c, 0x7e, 0xb5, 0x8c, 0x35, 0x6c, 0xa9, 0xf6, 0xf8, 0x3b, 0x00, 0x00, 0xff, 0xff, 0xbe, 0x33, + 0xae, 0xb5, 0x28, 0x02, 0x00, 0x00, } func (m *VerificationHeader) Marshal() (dAtA []byte, err error) { @@ -252,6 +262,15 @@ func (m *Token) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } + if len(m.PublicKeys) > 0 { + for iNdEx := len(m.PublicKeys) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.PublicKeys[iNdEx]) + copy(dAtA[i:], m.PublicKeys[iNdEx]) + i = encodeVarintTypes(dAtA, i, uint64(len(m.PublicKeys[iNdEx]))) + i-- + dAtA[i] = 0x42 + } + } { size := m.ID.Size() i -= size @@ -375,6 +394,12 @@ func (m *Token) Size() (n int) { } l = m.ID.Size() n += 1 + l + sovTypes(uint64(l)) + if len(m.PublicKeys) > 0 { + for _, b := range m.PublicKeys { + l = len(b) + n += 1 + l + sovTypes(uint64(l)) + } + } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -744,6 +769,38 @@ func (m *Token) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PublicKeys", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PublicKeys = append(m.PublicKeys, make([]byte, postIndex-iNdEx)) + copy(m.PublicKeys[len(m.PublicKeys)-1], dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTypes(dAtA[iNdEx:]) diff --git a/session/types.proto b/session/types.proto index 1ade791..294928b 100644 --- a/session/types.proto +++ b/session/types.proto @@ -29,4 +29,6 @@ message Token { bytes Signature = 6; // ID is a token identifier. valid UUIDv4 represented in bytes bytes ID = 7 [(gogoproto.customtype) = "TokenID", (gogoproto.nullable) = false]; + // PublicKeys associated with owner + repeated bytes PublicKeys = 8; } From 98ea69a9d4e285f4431a9e2983dbb6a731de7aa0 Mon Sep 17 00:00:00 2001 From: alexvanin Date: Fri, 17 Jan 2020 12:38:34 +0300 Subject: [PATCH 0073/1196] docs: Add documentation on public keys field in session token --- docs/session.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/session.md b/docs/session.md index e8633d3..ba615c3 100644 --- a/docs/session.md +++ b/docs/session.md @@ -115,6 +115,7 @@ User token granting rights for object manipulation | ObjectID | [bytes](#bytes) | repeated | ObjectID is an object identifier of manipulation object | | Signature | [bytes](#bytes) | | Signature is a token signature, signed by owner of manipulation object | | ID | [bytes](#bytes) | | ID is a token identifier. valid UUIDv4 represented in bytes | +| PublicKeys | [bytes](#bytes) | repeated | PublicKeys associated with owner | From b556d54f16acd1de144379329a49c1c1e1570623 Mon Sep 17 00:00:00 2001 From: alexvanin Date: Fri, 17 Jan 2020 12:39:00 +0300 Subject: [PATCH 0074/1196] session: Modify verify routine to check owner id connection with public keys --- session/store_test.go | 6 ++++-- session/types.go | 23 +++++++++++++++++++++++ 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/session/store_test.go b/session/store_test.go index 1a9e977..66f99d4 100644 --- a/session/store_test.go +++ b/session/store_test.go @@ -31,20 +31,22 @@ func newTestClient(t *testing.T) *testClient { func signToken(t *testing.T, token *PToken, c *testClient) { require.NotNil(t, token) + token.SetPublicKeys(&c.PublicKey) signH, err := c.Sign(token.Header.PublicKey) require.NoError(t, err) require.NotNil(t, signH) // data is not yet signed - require.False(t, token.Verify(&c.PublicKey)) + keys := UnmarshalPublicKeys(&token.Token) + require.False(t, token.Verify(keys...)) signT, err := c.Sign(token.verificationData()) require.NoError(t, err) require.NotNil(t, signT) token.AddSignatures(signH, signT) - require.True(t, token.Verify(&c.PublicKey)) + require.True(t, token.Verify(keys...)) } func TestTokenStore(t *testing.T) { diff --git a/session/types.go b/session/types.go index aff7cca..08abec8 100644 --- a/session/types.go +++ b/session/types.go @@ -6,6 +6,7 @@ import ( "sync" crypto "github.com/nspcc-dev/neofs-crypto" + "github.com/nspcc-dev/neofs-proto/chain" "github.com/nspcc-dev/neofs-proto/internal" "github.com/nspcc-dev/neofs-proto/refs" "github.com/pkg/errors" @@ -111,11 +112,24 @@ func (m *Token) Sign(key *ecdsa.PrivateKey) error { return nil } +// SetPublicKeys sets owner's public keys to the token +func (m *Token) SetPublicKeys(keys... *ecdsa.PublicKey) { + m.PublicKeys = m.PublicKeys[:0] + for i := range keys { + m.PublicKeys = append(m.PublicKeys, crypto.MarshalPublicKey(keys[i])) + } +} + // Verify checks if token is correct and signed. func (m *Token) Verify(keys ...*ecdsa.PublicKey) bool { if m.FirstEpoch > m.LastEpoch { return false } + ownerFromKeys := chain.KeysToAddress(keys...) + if m.OwnerID.String() != ownerFromKeys { + return false + } + for i := range keys { if m.Header.Verify(keys[i]) && crypto.Verify(keys[i], m.verificationData(), m.Signature) == nil { return true @@ -156,3 +170,12 @@ func (m *VerificationHeader) Verify(keys ...*ecdsa.PublicKey) bool { } return false } + +// UnmarshalPublicKeys returns unmarshal public keys from the token +func UnmarshalPublicKeys(t *Token) []*ecdsa.PublicKey { + r := make([]*ecdsa.PublicKey, 0, len(t.PublicKeys)) + for i := range t.PublicKeys { + r = append(r, crypto.UnmarshalPublicKey(t.PublicKeys[i])) + } + return r +} From 34828f557828466f15e1dc803db0a70e182c85fb Mon Sep 17 00:00:00 2001 From: alexvanin Date: Fri, 17 Jan 2020 14:06:08 +0300 Subject: [PATCH 0075/1196] Update changelog for v0.2.9 --- CHANGELOG.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b76c77e..dc0bb81 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,23 @@ # Changelog This is the changelog for NeoFS Proto +## [0.2.9] - 2020-01-17 + +### Added +- Docs for container ACL field +- Public key header in the object with docs +- Public key field in the session token with docs + +### Changed +- Routine to verify correct object checks if integrity header is last and +may use public key header if verification header is not present +- Routine to verify correct session token checks if keys in the token +associated with owner id +- Updated neofs-crypto to v0.2.3 + +### Removed +- Timestamp in object tombstone header + ## [0.2.8] - 2019-12-21 ### Added @@ -88,3 +105,4 @@ Initial public release [0.2.6]: https://github.com/nspcc-dev/neofs-proto/compare/v0.2.5...v0.2.6 [0.2.7]: https://github.com/nspcc-dev/neofs-proto/compare/v0.2.6...v0.2.7 [0.2.8]: https://github.com/nspcc-dev/neofs-proto/compare/v0.2.7...v0.2.8 +[0.2.9]: https://github.com/nspcc-dev/neofs-proto/compare/v0.2.8...v0.2.9 From 01b910fd317906bf323360f00d87d256f1b3101a Mon Sep 17 00:00:00 2001 From: alexvanin Date: Fri, 17 Jan 2020 14:56:51 +0300 Subject: [PATCH 0076/1196] session: Add public key to the constructor of new private token Private token based on the token with private key. Therefore it must inherit public key field through constructor parameter. --- session/service.go | 1 + session/store.go | 1 + session/store_test.go | 13 +++++++++++-- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/session/service.go b/session/service.go index 1695c04..d9f889f 100644 --- a/session/service.go +++ b/session/service.go @@ -33,6 +33,7 @@ type ( LastEpoch uint64 ObjectID []ObjectID OwnerID OwnerID + PublicKeys [][]byte } ) diff --git a/session/store.go b/session/store.go index f12943f..1daf151 100644 --- a/session/store.go +++ b/session/store.go @@ -54,6 +54,7 @@ func (s *simpleStore) New(p TokenParams) *PToken { LastEpoch: p.LastEpoch, ObjectID: p.ObjectID, OwnerID: p.OwnerID, + PublicKeys: p.PublicKeys, }, PrivateKey: key, } diff --git a/session/store_test.go b/session/store_test.go index 66f99d4..ade0cb0 100644 --- a/session/store_test.go +++ b/session/store_test.go @@ -57,9 +57,14 @@ func TestTokenStore(t *testing.T) { c := newTestClient(t) require.NotNil(t, c) + pk := [][]byte{crypto.MarshalPublicKey(&c.PublicKey)} // create new token - token := s.New(TokenParams{ObjectID: []ObjectID{oid}, OwnerID: c.OwnerID}) + token := s.New(TokenParams{ + ObjectID: []ObjectID{oid}, + OwnerID: c.OwnerID, + PublicKeys: pk, + }) signToken(t, token, c) // check that it can be fetched @@ -68,7 +73,11 @@ func TestTokenStore(t *testing.T) { require.Equal(t, token, t1) // create and sign another token by the same client - t1 = s.New(TokenParams{ObjectID: []ObjectID{oid}, OwnerID: c.OwnerID}) + t1 = s.New(TokenParams{ + ObjectID: []ObjectID{oid}, + OwnerID: c.OwnerID, + PublicKeys: pk}) + signToken(t, t1, c) data := []byte{1, 2, 3} From 0a2fd1dbc0f11a391901f4d5fedee817805ab0c2 Mon Sep 17 00:00:00 2001 From: alexvanin Date: Fri, 17 Jan 2020 15:08:21 +0300 Subject: [PATCH 0077/1196] Update changelog for v0.2.10 --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index dc0bb81..cb2b4ec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,11 @@ # Changelog This is the changelog for NeoFS Proto +## [0.2.10] - 2020-01-17 + +### Changed +- Private token contructor now takes public keys as an argument + ## [0.2.9] - 2020-01-17 ### Added @@ -106,3 +111,4 @@ Initial public release [0.2.7]: https://github.com/nspcc-dev/neofs-proto/compare/v0.2.6...v0.2.7 [0.2.8]: https://github.com/nspcc-dev/neofs-proto/compare/v0.2.7...v0.2.8 [0.2.9]: https://github.com/nspcc-dev/neofs-proto/compare/v0.2.8...v0.2.9 +[0.2.10]: https://github.com/nspcc-dev/neofs-proto/compare/v0.2.9...v0.2.10 From 5bd19fe0d2f5f38e7006f27b98f966f9fe7015f5 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 20 Jan 2020 18:26:29 +0300 Subject: [PATCH 0078/1196] Add Raw flag to Get and Head request bodies Raw flag provides the ability to switch the expected representation of the object between the physically stored and the system-wide. The response to the request may vary when the flag is set for some classes of objects (e.g. linking). --- docs/object.md | 2 + object/service.pb.go | 191 +++++++++++++++++++++++++++++++------------ object/service.proto | 4 + 3 files changed, 144 insertions(+), 53 deletions(-) diff --git a/docs/object.md b/docs/object.md index 7e86325..e749b98 100644 --- a/docs/object.md +++ b/docs/object.md @@ -221,6 +221,7 @@ in distributed system. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | | Address | [refs.Address](#refs.Address) | | Address of object (container id + object id) | +| Raw | [bool](#bool) | | Raw is the request flag of a physically stored representation of an object | | Meta | [service.RequestMetaHeader](#service.RequestMetaHeader) | | RequestMetaHeader contains information about request meta headers (should be embedded into message) | | Verify | [service.RequestVerificationHeader](#service.RequestVerificationHeader) | | RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) | @@ -247,6 +248,7 @@ in distributed system. | ----- | ---- | ----- | ----------- | | Address | [refs.Address](#refs.Address) | | Address of object (container id + object id) | | FullHeaders | [bool](#bool) | | FullHeaders can be set true for extended headers in the object | +| Raw | [bool](#bool) | | Raw is the request flag of a physically stored representation of an object | | Meta | [service.RequestMetaHeader](#service.RequestMetaHeader) | | RequestMetaHeader contains information about request meta headers (should be embedded into message) | | Verify | [service.RequestVerificationHeader](#service.RequestVerificationHeader) | | RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) | diff --git a/object/service.pb.go b/object/service.pb.go index 4cad2f7..9019cae 100644 --- a/object/service.pb.go +++ b/object/service.pb.go @@ -33,6 +33,8 @@ const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package type GetRequest struct { // Address of object (container id + object id) Address refs.Address `protobuf:"bytes,1,opt,name=Address,proto3" json:"Address"` + // Raw is the request flag of a physically stored representation of an object + Raw bool `protobuf:"varint,2,opt,name=Raw,proto3" json:"Raw,omitempty"` // RequestMetaHeader contains information about request meta headers (should be embedded into message) service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) @@ -78,6 +80,13 @@ func (m *GetRequest) GetAddress() refs.Address { return refs.Address{} } +func (m *GetRequest) GetRaw() bool { + if m != nil { + return m.Raw + } + return false +} + type GetResponse struct { // Types that are valid to be assigned to R: // *GetResponse_Object @@ -448,6 +457,8 @@ type HeadRequest struct { Address Address `protobuf:"bytes,1,opt,name=Address,proto3,customtype=Address" json:"Address"` // FullHeaders can be set true for extended headers in the object FullHeaders bool `protobuf:"varint,2,opt,name=FullHeaders,proto3" json:"FullHeaders,omitempty"` + // Raw is the request flag of a physically stored representation of an object + Raw bool `protobuf:"varint,3,opt,name=Raw,proto3" json:"Raw,omitempty"` // RequestMetaHeader contains information about request meta headers (should be embedded into message) service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) @@ -493,6 +504,13 @@ func (m *HeadRequest) GetFullHeaders() bool { return false } +func (m *HeadRequest) GetRaw() bool { + if m != nil { + return m.Raw + } + return false +} + type HeadResponse struct { // Object without payload Object *Object `protobuf:"bytes,1,opt,name=Object,proto3" json:"Object,omitempty"` @@ -865,59 +883,60 @@ func init() { func init() { proto.RegisterFile("object/service.proto", fileDescriptor_dfcdf610ade6a9ce) } var fileDescriptor_dfcdf610ade6a9ce = []byte{ - // 831 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x56, 0xcf, 0x4f, 0xdb, 0x48, - 0x14, 0xce, 0x24, 0xc1, 0xc0, 0x8b, 0x03, 0x68, 0xc8, 0xb2, 0x91, 0x17, 0x05, 0x64, 0xa1, 0xdd, - 0xac, 0x56, 0x71, 0x58, 0x56, 0x02, 0x0e, 0x70, 0xd8, 0x24, 0x82, 0x70, 0x58, 0xc1, 0x1a, 0x84, - 0xd4, 0xde, 0x1c, 0x67, 0xf2, 0xa3, 0x04, 0x3b, 0xf5, 0xd8, 0x54, 0xfc, 0x01, 0x3d, 0xf7, 0xda, - 0x43, 0xff, 0x93, 0xf6, 0x0f, 0xe0, 0xc8, 0xb1, 0xea, 0x01, 0x55, 0xe9, 0xa9, 0x87, 0xde, 0x7b, - 0xac, 0xe6, 0x87, 0x63, 0x27, 0x14, 0xda, 0x72, 0x68, 0x4e, 0x99, 0xf9, 0xde, 0xf7, 0xde, 0x9b, - 0xf7, 0xf9, 0x1b, 0xc7, 0x90, 0x73, 0x1b, 0x4f, 0x88, 0xed, 0x97, 0x29, 0xf1, 0x2e, 0xba, 0x36, - 0x31, 0xfa, 0x9e, 0xeb, 0xbb, 0x58, 0x11, 0xa8, 0xb6, 0xe0, 0x91, 0x16, 0x2d, 0xfb, 0x97, 0x7d, - 0x42, 0x45, 0x44, 0xc3, 0x92, 0x1f, 0xc7, 0x16, 0x29, 0xa1, 0xb4, 0xeb, 0x3a, 0xa3, 0x44, 0x59, - 0xb1, 0x7c, 0x4e, 0x7c, 0x4b, 0x62, 0xb9, 0x10, 0xbb, 0x20, 0x5e, 0xb7, 0x75, 0x29, 0xd1, 0x52, - 0xbb, 0xeb, 0x77, 0x82, 0x86, 0x61, 0xbb, 0xe7, 0xe5, 0xb6, 0xdb, 0x76, 0xcb, 0x1c, 0x6e, 0x04, - 0x2d, 0xbe, 0xe3, 0x1b, 0xbe, 0x12, 0x74, 0xfd, 0x35, 0x02, 0xd8, 0x27, 0xbe, 0x49, 0x9e, 0x06, - 0x84, 0xfa, 0xb8, 0x04, 0xd3, 0xff, 0x36, 0x9b, 0x1e, 0xa1, 0x34, 0x8f, 0x56, 0x51, 0x31, 0xb3, - 0x91, 0x35, 0xd8, 0xa1, 0x0d, 0x09, 0x56, 0xd2, 0x57, 0x37, 0x2b, 0x09, 0x33, 0xe4, 0xe0, 0x6d, - 0x48, 0xff, 0x47, 0x7c, 0x2b, 0xdf, 0xe0, 0x5c, 0xcd, 0x08, 0xe7, 0x96, 0xe5, 0x58, 0xac, 0x4e, - 0xac, 0x26, 0xf1, 0x2a, 0x33, 0x2c, 0xf1, 0xfa, 0x66, 0x05, 0x99, 0x3c, 0x03, 0xd7, 0x40, 0x39, - 0xe5, 0xc7, 0xce, 0xdb, 0x3c, 0x57, 0x1f, 0xcf, 0xe5, 0xd1, 0xae, 0x6d, 0xf9, 0x5d, 0xd7, 0xb9, - 0x55, 0x43, 0xe6, 0xea, 0x27, 0x90, 0xe1, 0x87, 0xa7, 0x7d, 0xd7, 0xa1, 0x04, 0x17, 0x41, 0x4a, - 0x2d, 0x0f, 0x3f, 0x67, 0x88, 0xad, 0x71, 0xc8, 0x7f, 0xea, 0x09, 0x53, 0xc6, 0xf1, 0x12, 0x4c, - 0x55, 0x3b, 0x81, 0x73, 0x96, 0x4f, 0xae, 0xa2, 0xa2, 0x5a, 0x4f, 0x98, 0x62, 0x5b, 0x49, 0x01, - 0x32, 0xf5, 0x37, 0x49, 0x80, 0xa3, 0x60, 0xa8, 0xc9, 0x26, 0x28, 0xe2, 0x00, 0xb2, 0xea, 0x72, - 0x58, 0x35, 0xe2, 0xb0, 0xa5, 0xe0, 0xb0, 0x1e, 0x62, 0x75, 0x57, 0x8f, 0x49, 0x8b, 0xa6, 0x3d, - 0x82, 0xd9, 0xe1, 0x71, 0xf1, 0xef, 0xa0, 0x1c, 0xde, 0x23, 0x99, 0x29, 0xa3, 0x78, 0x0d, 0xa6, - 0x4e, 0xdc, 0x33, 0xe2, 0xf0, 0x61, 0x18, 0x4d, 0xba, 0xd4, 0xe0, 0xa8, 0x29, 0x82, 0x42, 0xbe, - 0x1d, 0xc8, 0x70, 0x65, 0xe4, 0x43, 0xf9, 0x31, 0x4b, 0xe9, 0x2f, 0x92, 0x90, 0xad, 0x91, 0x1e, - 0xf1, 0xc9, 0x03, 0x3d, 0xf9, 0x27, 0x4c, 0x1f, 0x3e, 0x73, 0x88, 0x77, 0x50, 0x13, 0xc2, 0x57, - 0xe6, 0x59, 0xfc, 0xdd, 0xcd, 0x4a, 0x08, 0x9b, 0xe1, 0x22, 0x1a, 0x2a, 0x75, 0xcf, 0x50, 0x13, - 0x37, 0xf9, 0x02, 0xcc, 0x85, 0x82, 0x08, 0x49, 0xf5, 0x8f, 0x08, 0x32, 0x8c, 0x1e, 0x2a, 0xb4, - 0xfd, 0x0d, 0x85, 0x86, 0x0a, 0x48, 0x20, 0x12, 0x6b, 0x15, 0x32, 0x7b, 0x41, 0xaf, 0x27, 0x7a, - 0x53, 0x2e, 0xd8, 0x8c, 0x19, 0x87, 0x26, 0x3e, 0xfd, 0x26, 0xa8, 0x62, 0x54, 0x69, 0xa7, 0xef, - 0x34, 0xac, 0xfe, 0x19, 0x41, 0xf6, 0x98, 0x58, 0x9e, 0xdd, 0x89, 0x7c, 0x94, 0xa9, 0xba, 0x8e, - 0x6f, 0x75, 0x85, 0x39, 0x10, 0x37, 0x47, 0x46, 0x4a, 0x93, 0xaa, 0x1e, 0xd4, 0xcc, 0x78, 0x1c, - 0xe7, 0x60, 0xea, 0xff, 0x80, 0x78, 0x97, 0xc2, 0x45, 0xa6, 0xd8, 0x60, 0x1d, 0x54, 0xbe, 0x38, - 0x25, 0x1e, 0x73, 0x0a, 0x77, 0x4e, 0xd6, 0x1c, 0xc1, 0x26, 0x2e, 0x59, 0x15, 0xe6, 0xc2, 0xc9, - 0xa5, 0x68, 0x7f, 0xc3, 0xac, 0x7c, 0xe2, 0x84, 0x59, 0x24, 0x75, 0xd7, 0x25, 0x8a, 0x58, 0xfa, - 0x27, 0x04, 0xf3, 0xec, 0xdd, 0x6a, 0x39, 0xed, 0x87, 0xde, 0xc4, 0xbf, 0x40, 0xe1, 0xe9, 0xcc, - 0x57, 0xa2, 0xa5, 0x7c, 0x54, 0x1c, 0x95, 0x6c, 0x49, 0x99, 0xb8, 0x68, 0xeb, 0xb0, 0x10, 0x8d, - 0x2b, 0x65, 0x5b, 0x86, 0xd9, 0x3d, 0xcf, 0x6a, 0x9f, 0x13, 0xc7, 0x17, 0xb2, 0xa9, 0x66, 0x04, - 0xe8, 0xcf, 0x93, 0xb0, 0x18, 0xa6, 0xd4, 0x2d, 0xda, 0xf9, 0x19, 0x2a, 0x61, 0x48, 0x1f, 0x5b, - 0x3d, 0x9f, 0xdb, 0x4e, 0x35, 0xf9, 0x7a, 0xe2, 0xca, 0xed, 0x40, 0x6e, 0x54, 0x06, 0xa9, 0xde, - 0x1a, 0x28, 0x6c, 0x2f, 0x1d, 0xa7, 0x56, 0x54, 0x79, 0xd5, 0xd2, 0x9c, 0x25, 0x63, 0x1b, 0xaf, - 0x52, 0x30, 0x7d, 0x2c, 0xba, 0xe2, 0x75, 0x48, 0xed, 0x13, 0x1f, 0xe3, 0x50, 0x81, 0xe8, 0xc3, - 0x44, 0x5b, 0x1c, 0xc1, 0x44, 0x87, 0x75, 0xc4, 0x32, 0x8e, 0x82, 0x58, 0x46, 0xf4, 0x97, 0x1c, - 0x65, 0xc4, 0xfe, 0x8c, 0x8a, 0x08, 0x6f, 0x81, 0x22, 0xde, 0xa6, 0xf8, 0x97, 0x90, 0x30, 0xf2, - 0x77, 0xa3, 0x2d, 0x8d, 0xc3, 0xc3, 0x3b, 0x94, 0x66, 0x12, 0xe0, 0x61, 0xdd, 0xd8, 0x1b, 0x58, - 0xcb, 0x8d, 0x82, 0x32, 0x65, 0x0b, 0x14, 0x71, 0x11, 0xa3, 0x5e, 0x23, 0xaf, 0xa4, 0xa8, 0xd7, - 0xd8, 0x7d, 0xdd, 0x85, 0x99, 0x50, 0x52, 0xfc, 0x6b, 0x7c, 0xf2, 0xd8, 0x6d, 0xd4, 0xf2, 0xb7, - 0x03, 0x32, 0xfd, 0x00, 0xd4, 0xf8, 0x13, 0xc1, 0xbf, 0x8d, 0x33, 0x63, 0x76, 0xd5, 0x96, 0xbf, - 0x1e, 0x14, 0xa5, 0x2a, 0xbb, 0x57, 0x83, 0x02, 0xba, 0x1e, 0x14, 0xd0, 0xdb, 0x41, 0x01, 0xbd, - 0x1f, 0x14, 0xd0, 0xcb, 0x0f, 0x85, 0xc4, 0xe3, 0x3f, 0x62, 0x1f, 0x99, 0x0e, 0xed, 0xdb, 0x76, - 0xa9, 0x49, 0x2e, 0xca, 0x0e, 0x71, 0x5b, 0xb4, 0x24, 0x3e, 0x31, 0x45, 0xcd, 0x86, 0xc2, 0x77, - 0xff, 0x7c, 0x09, 0x00, 0x00, 0xff, 0xff, 0x56, 0x6d, 0x00, 0xd5, 0x19, 0x0b, 0x00, 0x00, + // 842 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x56, 0x4b, 0x4f, 0xe3, 0x56, + 0x14, 0xce, 0x8d, 0x83, 0x81, 0x13, 0x07, 0xa2, 0x4b, 0x4a, 0x23, 0x17, 0x05, 0x64, 0xa1, 0x36, + 0x55, 0x15, 0x87, 0x52, 0x09, 0x58, 0xc0, 0xa2, 0x49, 0x04, 0x61, 0x51, 0x41, 0x2f, 0x08, 0xa9, + 0xdd, 0x39, 0xce, 0xcd, 0xa3, 0x04, 0x3b, 0xf5, 0x03, 0xc4, 0x0f, 0xe8, 0xba, 0xdb, 0x2e, 0xfa, + 0x53, 0xfa, 0x03, 0xd8, 0x54, 0x62, 0x59, 0x75, 0x81, 0xaa, 0x74, 0xdd, 0x7d, 0xa5, 0xd9, 0x8c, + 0xee, 0xc3, 0xb1, 0x13, 0x06, 0x66, 0x86, 0xc5, 0x64, 0x56, 0xb9, 0xe7, 0x3b, 0xaf, 0x9c, 0xcf, + 0xdf, 0xb9, 0x36, 0x14, 0xdc, 0xd6, 0x4f, 0xd4, 0x0e, 0xaa, 0x3e, 0xf5, 0xae, 0xfb, 0x36, 0x35, + 0x87, 0x9e, 0x1b, 0xb8, 0x58, 0x15, 0xa8, 0x9e, 0xf7, 0x68, 0xc7, 0xaf, 0x06, 0xb7, 0x43, 0xea, + 0x0b, 0x8f, 0x8e, 0x65, 0x7c, 0x12, 0x5b, 0xf1, 0xa9, 0xef, 0xf7, 0x5d, 0x67, 0x32, 0x50, 0x56, + 0xac, 0x5e, 0xd1, 0xc0, 0x92, 0x58, 0x21, 0xc2, 0xae, 0xa9, 0xd7, 0xef, 0xdc, 0x4a, 0xb4, 0xd2, + 0xed, 0x07, 0xbd, 0xb0, 0x65, 0xda, 0xee, 0x55, 0xb5, 0xeb, 0x76, 0xdd, 0x2a, 0x87, 0x5b, 0x61, + 0x87, 0x5b, 0xdc, 0xe0, 0x27, 0x11, 0x6e, 0xfc, 0x89, 0x00, 0x8e, 0x68, 0x40, 0xe8, 0xcf, 0x21, + 0xf5, 0x03, 0x5c, 0x81, 0xf9, 0x6f, 0xdb, 0x6d, 0x8f, 0xfa, 0x7e, 0x11, 0x6d, 0xa0, 0x72, 0x76, + 0x3b, 0x67, 0xb2, 0x3f, 0x6d, 0x4a, 0xb0, 0x96, 0xb9, 0x7b, 0x58, 0x4f, 0x91, 0x28, 0x06, 0xe7, + 0x41, 0x21, 0xd6, 0x4d, 0x31, 0xbd, 0x81, 0xca, 0x0b, 0x84, 0x1d, 0xf1, 0x1e, 0x64, 0xbe, 0xa3, + 0x81, 0x55, 0x6c, 0xf1, 0x6c, 0xdd, 0x8c, 0x98, 0x90, 0x0d, 0x98, 0xaf, 0x49, 0xad, 0x36, 0xf5, + 0x6a, 0x0b, 0xac, 0xd4, 0xfd, 0xc3, 0x3a, 0x22, 0x3c, 0x03, 0x37, 0x40, 0xbd, 0xe0, 0x83, 0x14, + 0x6d, 0x9e, 0x6b, 0x4c, 0xe7, 0x72, 0x6f, 0xdf, 0xb6, 0x82, 0xbe, 0xeb, 0x3c, 0xaa, 0x21, 0x73, + 0x8d, 0x73, 0xc8, 0xf2, 0x71, 0xfc, 0xa1, 0xeb, 0xf8, 0x14, 0x97, 0x41, 0x92, 0x2f, 0xc7, 0x59, + 0x32, 0x85, 0x69, 0x9e, 0xf0, 0x9f, 0x66, 0x8a, 0x48, 0x3f, 0x5e, 0x85, 0xb9, 0x7a, 0x2f, 0x74, + 0x2e, 0xf9, 0x30, 0x5a, 0x33, 0x45, 0x84, 0x59, 0x53, 0x00, 0x11, 0xe3, 0x8f, 0x34, 0xc0, 0x69, + 0x38, 0x66, 0x69, 0x07, 0x54, 0xf1, 0x07, 0x64, 0xd5, 0xb5, 0xa8, 0x6a, 0x1c, 0xc3, 0x8e, 0x22, + 0x86, 0xf5, 0x10, 0xa7, 0xa7, 0x7a, 0xcc, 0x9a, 0x34, 0xfd, 0x07, 0x58, 0x1c, 0xff, 0x5d, 0xfc, + 0x39, 0xa8, 0x27, 0xcf, 0x50, 0x46, 0xa4, 0x17, 0x6f, 0xc2, 0xdc, 0xb9, 0x7b, 0x49, 0x1d, 0x3e, + 0x0c, 0x0b, 0x93, 0xba, 0x35, 0x39, 0x4a, 0x84, 0x53, 0xd0, 0xb7, 0x0f, 0x59, 0xce, 0x8c, 0x7c, + 0x28, 0xef, 0x27, 0x32, 0xe3, 0xd7, 0x34, 0xe4, 0x1a, 0x74, 0x40, 0x03, 0xfa, 0x42, 0x95, 0x7e, + 0x09, 0xf3, 0x27, 0x37, 0x0e, 0xf5, 0x8e, 0x1b, 0x82, 0xf8, 0xda, 0x32, 0xf3, 0xff, 0xfd, 0xb0, + 0x1e, 0xc1, 0x24, 0x3a, 0xc4, 0x43, 0x29, 0xcf, 0x0c, 0x35, 0x73, 0x91, 0xe7, 0x61, 0x29, 0x22, + 0x44, 0x50, 0x6a, 0xbc, 0x42, 0x90, 0x65, 0xe1, 0x11, 0x43, 0x7b, 0x6f, 0x61, 0x68, 0xcc, 0x80, + 0x04, 0x62, 0xb2, 0x36, 0x20, 0x7b, 0x18, 0x0e, 0x06, 0xa2, 0xb7, 0x2f, 0x57, 0x3b, 0x09, 0x45, + 0x4b, 0xaf, 0x7c, 0x3c, 0x4b, 0xbf, 0x03, 0x9a, 0x18, 0x5e, 0x0a, 0xec, 0x1d, 0x25, 0x6c, 0xfc, + 0x8f, 0x20, 0x77, 0x46, 0x2d, 0xcf, 0xee, 0xc5, 0xca, 0xca, 0xd6, 0x5d, 0x27, 0xb0, 0xfa, 0x42, + 0x2e, 0x88, 0xcb, 0x25, 0x2b, 0xc9, 0x52, 0xea, 0xc7, 0x0d, 0x92, 0xf4, 0xe3, 0x02, 0xcc, 0x7d, + 0x1f, 0x52, 0xef, 0x56, 0xe8, 0x8a, 0x08, 0x03, 0x1b, 0xa0, 0xf1, 0xc3, 0x05, 0xf5, 0x98, 0x76, + 0x38, 0x53, 0x39, 0x32, 0x81, 0xcd, 0x9c, 0xb2, 0x3a, 0x2c, 0x45, 0x93, 0x4b, 0xd2, 0xbe, 0x86, + 0x45, 0xa9, 0x01, 0xca, 0x44, 0xa3, 0x3c, 0xb5, 0x56, 0x71, 0x94, 0xf1, 0x1f, 0x82, 0x65, 0x76, + 0xdb, 0x5a, 0x4e, 0xf7, 0xa5, 0xbb, 0xf9, 0x15, 0xa8, 0x3c, 0x9d, 0x29, 0x4d, 0xb4, 0x94, 0x8f, + 0x8a, 0xa3, 0x32, 0x5a, 0x86, 0xcc, 0x9c, 0xb4, 0x2d, 0xc8, 0xc7, 0xe3, 0x4a, 0xda, 0xd6, 0x60, + 0xf1, 0xd0, 0xb3, 0xba, 0x57, 0xd4, 0x09, 0x04, 0x6d, 0x1a, 0x89, 0x01, 0xe3, 0x97, 0x34, 0xac, + 0x44, 0x29, 0x4d, 0xcb, 0xef, 0x7d, 0x08, 0x96, 0x30, 0x64, 0xce, 0xac, 0x41, 0xc0, 0x65, 0xa7, + 0x11, 0x7e, 0x9e, 0x39, 0x73, 0xfb, 0x50, 0x98, 0xa4, 0x41, 0xb2, 0xb7, 0x09, 0x2a, 0xb3, 0xa5, + 0xe2, 0xb4, 0x9a, 0x26, 0x57, 0x2d, 0xc3, 0xa3, 0xa4, 0x6f, 0xfb, 0x77, 0x05, 0xe6, 0xcf, 0x44, + 0x57, 0xbc, 0x05, 0xca, 0x11, 0x0d, 0x30, 0x8e, 0x18, 0x88, 0x3f, 0x5e, 0xf4, 0x95, 0x09, 0x4c, + 0x74, 0xd8, 0x42, 0x2c, 0xe3, 0x34, 0x4c, 0x64, 0xc4, 0x2f, 0xe9, 0x38, 0x23, 0xf1, 0x7a, 0x2a, + 0x23, 0xbc, 0x0b, 0xaa, 0xb8, 0x5f, 0xf1, 0x27, 0x51, 0xc0, 0xc4, 0x0b, 0x48, 0x5f, 0x9d, 0x86, + 0xc7, 0x3b, 0x94, 0x61, 0x14, 0xe0, 0x71, 0xdd, 0xc4, 0x9d, 0xac, 0x17, 0x26, 0x41, 0x99, 0xb2, + 0x0b, 0xaa, 0x58, 0xc4, 0xb8, 0xd7, 0xc4, 0x95, 0x14, 0xf7, 0x9a, 0xda, 0xd7, 0x03, 0x58, 0x88, + 0x28, 0xc5, 0x9f, 0x26, 0x27, 0x4f, 0x6c, 0xa3, 0x5e, 0x7c, 0xec, 0x90, 0xe9, 0xc7, 0xa0, 0x25, + 0x9f, 0x08, 0xfe, 0x6c, 0x3a, 0x32, 0x21, 0x57, 0x7d, 0xed, 0xcd, 0x4e, 0x51, 0xaa, 0x76, 0x70, + 0x37, 0x2a, 0xa1, 0xfb, 0x51, 0x09, 0xfd, 0x35, 0x2a, 0xa1, 0x7f, 0x46, 0x25, 0xf4, 0xdb, 0xbf, + 0xa5, 0xd4, 0x8f, 0x5f, 0x24, 0x3e, 0x44, 0x1d, 0x7f, 0x68, 0xdb, 0x95, 0x36, 0xbd, 0xae, 0x3a, + 0xd4, 0xed, 0xf8, 0x15, 0xf1, 0x19, 0x2a, 0x6a, 0xb6, 0x54, 0x6e, 0x7d, 0xf3, 0x3a, 0x00, 0x00, + 0xff, 0xff, 0xbe, 0x82, 0x72, 0x84, 0x3d, 0x0b, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1374,6 +1393,16 @@ func (m *GetRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x6 i-- dAtA[i] = 0x92 + if m.Raw { + i-- + if m.Raw { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x10 + } { size, err := m.Address.MarshalToSizedBuffer(dAtA[:i]) if err != nil { @@ -1803,6 +1832,16 @@ func (m *HeadRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x6 i-- dAtA[i] = 0x92 + if m.Raw { + i-- + if m.Raw { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x18 + } if m.FullHeaders { i-- if m.FullHeaders { @@ -2232,6 +2271,9 @@ func (m *GetRequest) Size() (n int) { _ = l l = m.Address.Size() n += 1 + l + sovService(uint64(l)) + if m.Raw { + n += 2 + } l = m.RequestMetaHeader.Size() n += 2 + l + sovService(uint64(l)) l = m.RequestVerificationHeader.Size() @@ -2405,6 +2447,9 @@ func (m *HeadRequest) Size() (n int) { if m.FullHeaders { n += 2 } + if m.Raw { + n += 2 + } l = m.RequestMetaHeader.Size() n += 2 + l + sovService(uint64(l)) l = m.RequestVerificationHeader.Size() @@ -2630,6 +2675,26 @@ func (m *GetRequest) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Raw", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Raw = bool(v != 0) case 98: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType) @@ -3602,6 +3667,26 @@ func (m *HeadRequest) Unmarshal(dAtA []byte) error { } } m.FullHeaders = bool(v != 0) + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Raw", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Raw = bool(v != 0) case 98: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType) diff --git a/object/service.proto b/object/service.proto index da54447..91c0cbd 100644 --- a/object/service.proto +++ b/object/service.proto @@ -56,6 +56,8 @@ service Service { message GetRequest { // Address of object (container id + object id) refs.Address Address = 1 [(gogoproto.nullable) = false]; + // Raw is the request flag of a physically stored representation of an object + bool Raw = 2; // RequestMetaHeader contains information about request meta headers (should be embedded into message) service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) @@ -118,6 +120,8 @@ message HeadRequest { refs.Address Address = 1 [(gogoproto.nullable) = false, (gogoproto.customtype) = "Address"]; // FullHeaders can be set true for extended headers in the object bool FullHeaders = 2; + // Raw is the request flag of a physically stored representation of an object + bool Raw = 3; // RequestMetaHeader contains information about request meta headers (should be embedded into message) service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) From 9683795a224bd520d86933810a3446a0b45c3fa9 Mon Sep 17 00:00:00 2001 From: alexvanin Date: Tue, 21 Jan 2020 13:12:28 +0300 Subject: [PATCH 0079/1196] Update changelog for v0.2.11 --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index cb2b4ec..80012c6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,11 @@ # Changelog This is the changelog for NeoFS Proto +## [0.2.11] - 2020-01-21 + +### Added +- Raw flag in object head and get queries with docs + ## [0.2.10] - 2020-01-17 ### Changed @@ -112,3 +117,4 @@ Initial public release [0.2.8]: https://github.com/nspcc-dev/neofs-proto/compare/v0.2.7...v0.2.8 [0.2.9]: https://github.com/nspcc-dev/neofs-proto/compare/v0.2.8...v0.2.9 [0.2.10]: https://github.com/nspcc-dev/neofs-proto/compare/v0.2.9...v0.2.10 +[0.2.11]: https://github.com/nspcc-dev/neofs-proto/compare/v0.2.10...v0.2.11 From 9366b51acef2a9acb6d2127f33cfa00fa84b63ee Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Mon, 27 Jan 2020 15:02:14 +0300 Subject: [PATCH 0080/1196] Fix NaN ObjectSize --- object/service.go | 4 ++-- object/utils.go | 2 +- object/utils_test.go | 7 ++++++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/object/service.go b/object/service.go index 8482539..38dbee1 100644 --- a/object/service.go +++ b/object/service.go @@ -39,8 +39,8 @@ type ( ) const ( - // UnitsB starts enum for amount of bytes. - UnitsB int64 = 1 << (10 * iota) + // starts enum for amount of bytes. + _ int64 = 1 << (10 * iota) // UnitsKB defines amount of bytes in one kilobyte. UnitsKB diff --git a/object/utils.go b/object/utils.go index fab7fcc..7e628f1 100644 --- a/object/utils.go +++ b/object/utils.go @@ -32,7 +32,7 @@ func (b ByteSize) String() string { case num > UnitsKB: unit = "KB" dec = UnitsKB - case num > UnitsB: + default: dec = 1 } diff --git a/object/utils_test.go b/object/utils_test.go index a3f0162..d4d7fe2 100644 --- a/object/utils_test.go +++ b/object/utils_test.go @@ -7,11 +7,16 @@ import ( ) func TestByteSize_String(t *testing.T) { - var cases = []struct { + cases := []struct { name string expect string actual ByteSize }{ + { + name: "0 bytes", + expect: "0", + actual: ByteSize(0), + }, { name: "101 bytes", expect: "101", From 131ec937da119d9b10910426f1653665a00f3d28 Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Mon, 27 Jan 2020 15:51:58 +0300 Subject: [PATCH 0081/1196] Update changelog for v0.2.12 --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 80012c6..3d09b11 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,11 @@ # Changelog This is the changelog for NeoFS Proto +## [0.2.12] - 2020-01-27 + +### Fixed +- Bug with ByteSize (0 bytes returns NaN) + ## [0.2.11] - 2020-01-21 ### Added @@ -118,3 +123,4 @@ Initial public release [0.2.9]: https://github.com/nspcc-dev/neofs-proto/compare/v0.2.8...v0.2.9 [0.2.10]: https://github.com/nspcc-dev/neofs-proto/compare/v0.2.9...v0.2.10 [0.2.11]: https://github.com/nspcc-dev/neofs-proto/compare/v0.2.10...v0.2.11 +[0.2.12]: https://github.com/nspcc-dev/neofs-proto/compare/v0.2.11...v0.2.12 From b42537f8d8b68766eb26c2a44738def8d81e4267 Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Thu, 30 Jan 2020 15:47:05 +0300 Subject: [PATCH 0082/1196] Use separated proto repository Workflow: - update goland dependencies - remove old `*.proto` and `*.pb.go` files - download specific version of neofs-proto (will be published soon) - extract proto files into `vendor/proto` - walk throw `vendor/proto` folders that contains `*.proto` files and override in repo --- Makefile | 39 ++++++++++++++++++++++++++++++++------- 1 file changed, 32 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 9609923..43f4642 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,34 @@ +PROTO_VERSION=master +PROTO_URL=https://bitbucket.org/nspcc-dev/neofs-proto/get/$(PROTO_VERSION).tar.gz + B=\033[0;1m G=\033[0;92m R=\033[0m +.PHONY: deps format docgen protoc + +# Dependencies +deps: + @echo "${B}${G}=> Golang modules ${R}" + @go mod tidy -v + @go mod vendor + + @echo "${B}${G}=> Cleanup old files ${R}" + @find . -type f -name '*.pb.go' -not -path './vendor/*' -exec rm {} \; + @find . -type f -name '*.proto' -not -path './vendor/*' -not -name '*_test.proto' -exec rm {} \; + + @echo "${B}${G}=> NeoFS Proto files ${R}" + @mkdir -p ./vendor/proto + @curl -sL -o ./vendor/proto.tar.gz $(PROTO_URL) + @tar -xzf ./vendor/proto.tar.gz --strip-components 1 -C ./vendor/proto + @for f in `find ./vendor/proto -type f -name '*.proto' -exec dirname {} \; | sort -u `; do \ + cp $$f/*.proto ./$$(basename $$f); \ + done + + @echo "${B}${G}=> Cleanup ${R}" + @rm -rf ./vendor/proto + @rm -rf ./vendor/proto.tar.gz + # Reformat code format: @[ ! -z `which goimports` ] || (echo "install goimports" && exit 2) @@ -11,7 +38,7 @@ format: done # Regenerate documentation for protot files: -docgen: +docgen: deps @for f in `find . -type f -name '*.proto' -not -path './vendor/*' -exec dirname {} \; | sort -u `; do \ echo "${B}${G}⇒ Documentation for $$(basename $$f) ${R}"; \ protoc \ @@ -21,14 +48,12 @@ docgen: done # Regenerate proto files: -protoc: - @go mod tidy -v - @go mod vendor - # Install specific version for gogo-proto +protoc: deps + @echo "${B}${G}=> Install specific version for gogo-proto ${R}" @go list -f '{{.Path}}/...@{{.Version}}' -m github.com/gogo/protobuf | xargs go get -v - # Install specific version for protobuf lib + @echo "${B}${G}=> Install specific version for protobuf lib ${R}" @go list -f '{{.Path}}/...@{{.Version}}' -m github.com/golang/protobuf | xargs go get -v - # Protoc generate + @echo "${B}${G}=> Protoc generate ${R}" @for f in `find . -type f -name '*.proto' -not -path './vendor/*'`; do \ echo "${B}${G}⇒ Processing $$f ${R}"; \ protoc \ From 53af48372fba4ddcfd6153cbeb440e480f7152f7 Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Thu, 30 Jan 2020 16:32:50 +0300 Subject: [PATCH 0083/1196] prepare to rename neofs-proto to neofs-api --- CHANGELOG.md | 26 ++++---- accounting/service.go | 6 +- accounting/service.pb.go | 54 ++++++++-------- accounting/service.proto | 2 +- accounting/types.go | 8 +-- accounting/types.pb.go | 106 +++++++++++++++---------------- accounting/types.proto | 4 +- accounting/types_test.go | 10 +-- accounting/withdraw.go | 2 +- accounting/withdraw.pb.go | 78 +++++++++++------------ accounting/withdraw.proto | 2 +- bootstrap/service.go | 2 +- bootstrap/service.pb.go | 46 +++++++------- bootstrap/service.proto | 2 +- bootstrap/types.go | 2 +- bootstrap/types.pb.go | 46 +++++++------- bootstrap/types.proto | 2 +- chain/address.go | 2 +- container/service.go | 4 +- container/service.pb.go | 12 ++-- container/service.proto | 2 +- container/types.go | 4 +- container/types.pb.go | 45 +++++++------- container/types.proto | 2 +- container/types_test.go | 2 +- decimal/decimal.pb.go | 12 ++-- decimal/decimal.proto | 2 +- go.mod | 2 +- hash/hash.go | 4 +- object/extensions.go | 3 +- object/service.go | 10 +-- object/service.pb.go | 114 +++++++++++++++++----------------- object/service.proto | 2 +- object/sg.go | 4 +- object/sg_test.go | 4 +- object/types.go | 6 +- object/types.pb.go | 120 ++++++++++++++++++------------------ object/types.proto | 2 +- object/utils.go | 2 +- object/verification_test.go | 7 +-- query/types.pb.go | 12 ++-- query/types.proto | 2 +- refs/address.go | 2 +- refs/owner.go | 2 +- refs/types.go | 4 +- refs/types.pb.go | 10 +-- refs/types.proto | 2 +- service/meta.go | 4 +- service/meta.pb.go | 10 +-- service/meta.proto | 2 +- service/verify.go | 4 +- service/verify.pb.go | 10 +-- service/verify.proto | 2 +- service/verify_test.go | 2 +- service/verify_test.pb.go | 44 ++++++------- service/verify_test.proto | 2 +- session/service.go | 2 +- session/service.pb.go | 50 +++++++-------- session/service.proto | 2 +- session/store.go | 2 +- session/store_test.go | 13 ++-- session/types.go | 8 +-- session/types.pb.go | 48 +++++++-------- session/types.proto | 2 +- state/service.pb.go | 64 +++++++++---------- state/service.proto | 2 +- storagegroup/storage.go | 2 +- storagegroup/types.go | 4 +- storagegroup/types.pb.go | 48 +++++++-------- storagegroup/types.proto | 2 +- 70 files changed, 565 insertions(+), 563 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3d09b11..27d0e93 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -111,16 +111,16 @@ associated with owner id Initial public release -[0.2.0]: https://github.com/nspcc-dev/neofs-proto/compare/v0.1.0...v0.2.0 -[0.2.1]: https://github.com/nspcc-dev/neofs-proto/compare/v0.2.0...v0.2.1 -[0.2.2]: https://github.com/nspcc-dev/neofs-proto/compare/v0.2.1...v0.2.2 -[0.2.3]: https://github.com/nspcc-dev/neofs-proto/compare/v0.2.2...v0.2.3 -[0.2.4]: https://github.com/nspcc-dev/neofs-proto/compare/v0.2.3...v0.2.4 -[0.2.5]: https://github.com/nspcc-dev/neofs-proto/compare/v0.2.4...v0.2.5 -[0.2.6]: https://github.com/nspcc-dev/neofs-proto/compare/v0.2.5...v0.2.6 -[0.2.7]: https://github.com/nspcc-dev/neofs-proto/compare/v0.2.6...v0.2.7 -[0.2.8]: https://github.com/nspcc-dev/neofs-proto/compare/v0.2.7...v0.2.8 -[0.2.9]: https://github.com/nspcc-dev/neofs-proto/compare/v0.2.8...v0.2.9 -[0.2.10]: https://github.com/nspcc-dev/neofs-proto/compare/v0.2.9...v0.2.10 -[0.2.11]: https://github.com/nspcc-dev/neofs-proto/compare/v0.2.10...v0.2.11 -[0.2.12]: https://github.com/nspcc-dev/neofs-proto/compare/v0.2.11...v0.2.12 +[0.2.0]: https://github.com/nspcc-dev/neofs-api/compare/v0.1.0...v0.2.0 +[0.2.1]: https://github.com/nspcc-dev/neofs-api/compare/v0.2.0...v0.2.1 +[0.2.2]: https://github.com/nspcc-dev/neofs-api/compare/v0.2.1...v0.2.2 +[0.2.3]: https://github.com/nspcc-dev/neofs-api/compare/v0.2.2...v0.2.3 +[0.2.4]: https://github.com/nspcc-dev/neofs-api/compare/v0.2.3...v0.2.4 +[0.2.5]: https://github.com/nspcc-dev/neofs-api/compare/v0.2.4...v0.2.5 +[0.2.6]: https://github.com/nspcc-dev/neofs-api/compare/v0.2.5...v0.2.6 +[0.2.7]: https://github.com/nspcc-dev/neofs-api/compare/v0.2.6...v0.2.7 +[0.2.8]: https://github.com/nspcc-dev/neofs-api/compare/v0.2.7...v0.2.8 +[0.2.9]: https://github.com/nspcc-dev/neofs-api/compare/v0.2.8...v0.2.9 +[0.2.10]: https://github.com/nspcc-dev/neofs-api/compare/v0.2.9...v0.2.10 +[0.2.11]: https://github.com/nspcc-dev/neofs-api/compare/v0.2.10...v0.2.11 +[0.2.12]: https://github.com/nspcc-dev/neofs-api/compare/v0.2.11...v0.2.12 diff --git a/accounting/service.go b/accounting/service.go index ac1ceb5..5f8f889 100644 --- a/accounting/service.go +++ b/accounting/service.go @@ -1,9 +1,9 @@ package accounting import ( - "github.com/nspcc-dev/neofs-proto/decimal" - "github.com/nspcc-dev/neofs-proto/internal" - "github.com/nspcc-dev/neofs-proto/refs" + "github.com/nspcc-dev/neofs-api/decimal" + "github.com/nspcc-dev/neofs-api/internal" + "github.com/nspcc-dev/neofs-api/refs" ) type ( diff --git a/accounting/service.pb.go b/accounting/service.pb.go index 7a8a086..4e1127b 100644 --- a/accounting/service.pb.go +++ b/accounting/service.pb.go @@ -8,8 +8,8 @@ import ( fmt "fmt" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/golang/protobuf/proto" - decimal "github.com/nspcc-dev/neofs-proto/decimal" - service "github.com/nspcc-dev/neofs-proto/service" + decimal "github.com/nspcc-dev/neofs-api/decimal" + service "github.com/nspcc-dev/neofs-api/service" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" @@ -132,31 +132,31 @@ func init() { func init() { proto.RegisterFile("accounting/service.proto", fileDescriptor_7f9514b8f1d4c7fe) } var fileDescriptor_7f9514b8f1d4c7fe = []byte{ - // 381 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x91, 0xbd, 0x6e, 0xdb, 0x30, - 0x14, 0x85, 0xcd, 0xb6, 0xb0, 0x0b, 0xda, 0xa8, 0x0b, 0xf6, 0x07, 0x82, 0x0a, 0xc8, 0x86, 0x27, - 0xb7, 0x85, 0x25, 0x40, 0x1d, 0xda, 0xd5, 0x82, 0x87, 0x16, 0x68, 0xd1, 0x40, 0x43, 0x86, 0x6c, - 0x14, 0x7d, 0xad, 0x08, 0xb1, 0x49, 0x45, 0xa4, 0x14, 0xf8, 0x4d, 0xf2, 0x2e, 0x79, 0x01, 0x8f, - 0x1e, 0x83, 0x0c, 0x46, 0xa0, 0xbc, 0x48, 0x60, 0x8a, 0xf2, 0x4f, 0x92, 0x89, 0xe4, 0x77, 0xee, - 0xb9, 0xbc, 0x3c, 0xc4, 0x16, 0x65, 0x4c, 0xe4, 0x5c, 0x25, 0x3c, 0xf6, 0x24, 0x64, 0x45, 0xc2, - 0xc0, 0x4d, 0x33, 0xa1, 0x04, 0xc1, 0x7b, 0xc5, 0x26, 0x46, 0xf2, 0x16, 0xa0, 0x68, 0xa5, 0xdb, - 0x1f, 0x6b, 0x56, 0x40, 0x96, 0xcc, 0x96, 0x86, 0x7e, 0x9a, 0x02, 0x4b, 0x16, 0x74, 0xee, 0x99, - 0xd5, 0xe0, 0xcf, 0x07, 0xd7, 0xa8, 0x65, 0x0a, 0xd2, 0xf0, 0x51, 0x9c, 0xa8, 0xf3, 0x3c, 0x72, - 0x99, 0x58, 0x78, 0xb1, 0x88, 0x85, 0xa7, 0x71, 0x94, 0xcf, 0xf4, 0x49, 0x1f, 0xf4, 0xae, 0x2a, - 0x1f, 0xdc, 0x20, 0xfc, 0x2e, 0xa0, 0x73, 0xca, 0x19, 0x84, 0x70, 0x99, 0x83, 0x54, 0xe4, 0x2b, - 0x6e, 0xfd, 0xbf, 0xe2, 0x90, 0xfd, 0x99, 0x58, 0xa8, 0x8f, 0x86, 0x9d, 0xa0, 0xbb, 0xda, 0xf4, - 0x1a, 0x77, 0x9b, 0x5e, 0x8d, 0xc3, 0x7a, 0x43, 0x7e, 0xe1, 0x37, 0xff, 0x40, 0x51, 0x2b, 0xea, - 0xa3, 0x61, 0xdb, 0xb7, 0xdd, 0xfa, 0xbd, 0xa6, 0xd5, 0x56, 0xfb, 0x0d, 0x74, 0x0a, 0x59, 0xf0, - 0x76, 0xdb, 0x63, 0xbd, 0xe9, 0xa1, 0x50, 0x3b, 0xc8, 0x04, 0x37, 0x4f, 0xf5, 0x2b, 0x2d, 0xa6, - 0xbd, 0x83, 0xa7, 0x5e, 0xad, 0x26, 0x8c, 0xaa, 0x44, 0xf0, 0x67, 0x3d, 0x8c, 0x77, 0x50, 0xe0, - 0xee, 0x6e, 0x78, 0x99, 0x0a, 0x2e, 0x81, 0x7c, 0xc3, 0x2d, 0x83, 0xf4, 0xf4, 0x6d, 0xff, 0xbd, - 0x5b, 0x07, 0x37, 0xa9, 0xd6, 0xb0, 0x2e, 0x20, 0x3f, 0x71, 0xe7, 0xaf, 0x60, 0x17, 0xe3, 0x2a, - 0x49, 0x69, 0xbd, 0xea, 0xbf, 0x1e, 0xb6, 0xfd, 0x0f, 0xee, 0x3e, 0x5a, 0xd7, 0x68, 0xe1, 0x51, - 0xa1, 0x7f, 0x82, 0xf1, 0x78, 0x57, 0x43, 0x82, 0xdd, 0x95, 0xc4, 0x3e, 0xf4, 0x1e, 0xe7, 0x6a, - 0x7f, 0x79, 0x51, 0xab, 0xc6, 0x0e, 0xc6, 0xab, 0xd2, 0x41, 0xeb, 0xd2, 0x41, 0xb7, 0xa5, 0x83, - 0xee, 0x4b, 0x07, 0x5d, 0x3f, 0x38, 0x8d, 0xb3, 0xef, 0x07, 0x9f, 0xc9, 0x65, 0xca, 0xd8, 0x68, - 0x0a, 0x85, 0xc7, 0x41, 0xcc, 0xe4, 0xa8, 0xfa, 0xca, 0x7d, 0xcb, 0xa8, 0xa9, 0xc9, 0x8f, 0xc7, - 0x00, 0x00, 0x00, 0xff, 0xff, 0xf9, 0xca, 0x86, 0x87, 0x81, 0x02, 0x00, 0x00, + // 379 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x51, 0xbb, 0xae, 0xd3, 0x30, + 0x18, 0xae, 0x01, 0xb5, 0xc8, 0xad, 0x28, 0x32, 0x17, 0x45, 0x41, 0x4a, 0xab, 0x4e, 0x2d, 0x52, + 0x13, 0x29, 0x0c, 0xb0, 0xa1, 0x46, 0x1d, 0x40, 0x02, 0x81, 0x32, 0x30, 0xb0, 0x39, 0xee, 0xdf, + 0x60, 0xd1, 0xda, 0x21, 0x76, 0x82, 0xfa, 0x26, 0xbc, 0x0b, 0x2f, 0xd0, 0xb1, 0x23, 0x62, 0xa8, + 0x8e, 0x72, 0x5e, 0xe4, 0xa8, 0x8e, 0xd3, 0xcb, 0x39, 0x67, 0xb2, 0xfd, 0xdd, 0xfc, 0xfb, 0x33, + 0x76, 0x28, 0x63, 0xb2, 0x10, 0x9a, 0x8b, 0x34, 0x50, 0x90, 0x97, 0x9c, 0x81, 0x9f, 0xe5, 0x52, + 0x4b, 0x82, 0x4f, 0x8c, 0x4b, 0x2c, 0x15, 0xac, 0x41, 0xd3, 0x9a, 0x77, 0x9f, 0x37, 0x58, 0x09, + 0x39, 0x5f, 0x6e, 0x2c, 0xfa, 0x62, 0x01, 0x8c, 0xaf, 0xe9, 0x2a, 0xb0, 0xab, 0x85, 0x5f, 0x9e, + 0x5d, 0xa3, 0x37, 0x19, 0x28, 0x8b, 0x4f, 0x53, 0xae, 0x7f, 0x14, 0x89, 0xcf, 0xe4, 0x3a, 0x48, + 0x65, 0x2a, 0x03, 0x03, 0x27, 0xc5, 0xd2, 0x9c, 0xcc, 0xc1, 0xec, 0x6a, 0xf9, 0xe8, 0x2f, 0xc2, + 0x4f, 0x22, 0xba, 0xa2, 0x82, 0x41, 0x0c, 0xbf, 0x0a, 0x50, 0x9a, 0x4c, 0x70, 0xe7, 0xcb, 0x6f, + 0x01, 0xf9, 0xc7, 0xb9, 0x83, 0x86, 0x68, 0xdc, 0x8b, 0xfa, 0xdb, 0xfd, 0xa0, 0xf5, 0x7f, 0x3f, + 0x68, 0xe0, 0xb8, 0xd9, 0x90, 0x77, 0xf8, 0xd1, 0x67, 0xd0, 0xd4, 0x49, 0x86, 0x68, 0xdc, 0x0d, + 0x5d, 0xbf, 0x79, 0xaf, 0x8d, 0x3a, 0x70, 0x1f, 0x80, 0x2e, 0x20, 0x8f, 0x1e, 0x1f, 0x32, 0x76, + 0xfb, 0x01, 0x8a, 0x8d, 0x83, 0xcc, 0x71, 0xfb, 0x9b, 0x79, 0xa5, 0xc3, 0x8c, 0x77, 0x74, 0xdb, + 0x6b, 0x58, 0xce, 0xa8, 0xe6, 0x52, 0xdc, 0xc9, 0xb0, 0xde, 0x51, 0x89, 0xfb, 0xc7, 0xe1, 0x55, + 0x26, 0x85, 0x02, 0xf2, 0x1a, 0x77, 0x2c, 0x64, 0xa6, 0xef, 0x86, 0x4f, 0xfd, 0xa6, 0xb8, 0x79, + 0xbd, 0xc6, 0x8d, 0x80, 0xbc, 0xc5, 0xbd, 0x4f, 0x92, 0xfd, 0x9c, 0xd5, 0x4d, 0x2a, 0xe7, 0xc1, + 0xf0, 0xe1, 0xb8, 0x1b, 0x3e, 0xf3, 0x4f, 0xd5, 0xfa, 0x96, 0x8b, 0x2f, 0x84, 0xe1, 0x57, 0x8c, + 0x67, 0x47, 0x0d, 0x89, 0x8e, 0x57, 0x12, 0xf7, 0xdc, 0x7b, 0xd9, 0xab, 0xfb, 0xea, 0x5e, 0xae, + 0x1e, 0x3b, 0x7a, 0xbf, 0xad, 0x3c, 0xb4, 0xab, 0x3c, 0xf4, 0xaf, 0xf2, 0xd0, 0x55, 0xe5, 0xa1, + 0x3f, 0xd7, 0x5e, 0xeb, 0xfb, 0xe4, 0xec, 0x33, 0x85, 0xca, 0x18, 0x9b, 0x2e, 0xa0, 0x0c, 0x04, + 0xc8, 0xa5, 0x9a, 0xd2, 0x8c, 0x07, 0xa7, 0xc0, 0xa4, 0x6d, 0xfe, 0xf3, 0xcd, 0x4d, 0x00, 0x00, + 0x00, 0xff, 0xff, 0x4f, 0x3c, 0xca, 0x62, 0x7f, 0x02, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/accounting/service.proto b/accounting/service.proto index f2696c4..c320106 100644 --- a/accounting/service.proto +++ b/accounting/service.proto @@ -1,6 +1,6 @@ syntax = "proto3"; package accounting; -option go_package = "github.com/nspcc-dev/neofs-proto/accounting"; +option go_package = "github.com/nspcc-dev/neofs-api/accounting"; import "service/meta.proto"; import "service/verify.proto"; diff --git a/accounting/types.go b/accounting/types.go index 9c76fc7..af883a2 100644 --- a/accounting/types.go +++ b/accounting/types.go @@ -7,11 +7,11 @@ import ( "reflect" "github.com/mr-tron/base58" + "github.com/nspcc-dev/neofs-api/chain" + "github.com/nspcc-dev/neofs-api/decimal" + "github.com/nspcc-dev/neofs-api/internal" + "github.com/nspcc-dev/neofs-api/refs" crypto "github.com/nspcc-dev/neofs-crypto" - "github.com/nspcc-dev/neofs-proto/chain" - "github.com/nspcc-dev/neofs-proto/decimal" - "github.com/nspcc-dev/neofs-proto/internal" - "github.com/nspcc-dev/neofs-proto/refs" "github.com/pkg/errors" ) diff --git a/accounting/types.pb.go b/accounting/types.pb.go index dd020ec..f420355 100644 --- a/accounting/types.pb.go +++ b/accounting/types.pb.go @@ -7,7 +7,7 @@ import ( fmt "fmt" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/golang/protobuf/proto" - decimal "github.com/nspcc-dev/neofs-proto/decimal" + decimal "github.com/nspcc-dev/neofs-api/decimal" io "io" math "math" math_bits "math/bits" @@ -801,59 +801,59 @@ func init() { func init() { proto.RegisterFile("accounting/types.proto", fileDescriptor_437c556d7375b726) } var fileDescriptor_437c556d7375b726 = []byte{ - // 821 bytes of a gzipped FileDescriptorProto + // 823 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x55, 0x4d, 0x6f, 0xe3, 0x44, - 0x18, 0xce, 0x38, 0x69, 0x3e, 0xde, 0x64, 0x83, 0x35, 0xbb, 0x5b, 0x85, 0x48, 0xa4, 0xc1, 0xe2, - 0x10, 0x84, 0xea, 0x88, 0xae, 0x68, 0xb9, 0x70, 0x88, 0x13, 0xca, 0x56, 0xac, 0xba, 0xd5, 0xd4, - 0x05, 0x01, 0x27, 0xd7, 0x99, 0xa6, 0x56, 0x93, 0x99, 0x60, 0x8f, 0xfb, 0xf1, 0x27, 0x38, 0x73, - 0xe1, 0xc4, 0x8f, 0xe0, 0x2f, 0xec, 0x11, 0x6e, 0x88, 0x43, 0x85, 0xc2, 0x1f, 0x41, 0x33, 0x1e, - 0x3b, 0x76, 0x95, 0xc0, 0x25, 0x79, 0x3f, 0x9e, 0xf7, 0x99, 0xf7, 0x6b, 0xc6, 0xb0, 0xeb, 0xf9, - 0x3e, 0x8f, 0x99, 0x08, 0xd8, 0x6c, 0x28, 0x1e, 0x96, 0x34, 0xb2, 0x97, 0x21, 0x17, 0x1c, 0xc3, - 0xda, 0xde, 0x7d, 0x39, 0xa5, 0x7e, 0xb0, 0xf0, 0xe6, 0x43, 0xfd, 0x9f, 0x40, 0xba, 0xfb, 0xb3, - 0x40, 0x5c, 0xc7, 0x97, 0xb6, 0xcf, 0x17, 0xc3, 0x19, 0x9f, 0xf1, 0xa1, 0x32, 0x5f, 0xc6, 0x57, - 0x4a, 0x53, 0x8a, 0x92, 0x12, 0xb8, 0xf5, 0x87, 0x01, 0xb5, 0x51, 0x42, 0x8a, 0x3f, 0x86, 0xda, - 0xdb, 0x3b, 0x46, 0xc3, 0x93, 0x49, 0x07, 0xf5, 0xd1, 0xa0, 0xe5, 0xbc, 0xf7, 0xee, 0x71, 0xaf, - 0xf4, 0xd7, 0xe3, 0x5e, 0x6a, 0x26, 0xa9, 0x80, 0x3b, 0x50, 0x1b, 0x4d, 0xa7, 0x21, 0x8d, 0xa2, - 0x8e, 0xd1, 0x47, 0x83, 0x06, 0x49, 0x55, 0xfc, 0x11, 0x3c, 0x3b, 0xf3, 0x42, 0xca, 0x44, 0xea, - 0x2f, 0x2b, 0x7f, 0xd1, 0x88, 0x0f, 0xa0, 0x39, 0xf2, 0x45, 0x70, 0x4b, 0x8f, 0x63, 0x36, 0x8d, - 0x3a, 0x95, 0x3e, 0x1a, 0x34, 0x0f, 0x4c, 0x3b, 0x2d, 0x65, 0x92, 0xfc, 0x93, 0x3c, 0x08, 0x1f, - 0x42, 0xfd, 0x4d, 0x70, 0x45, 0x45, 0xb0, 0xa0, 0x9d, 0x1d, 0x15, 0xf0, 0xc2, 0x5e, 0xf7, 0xc3, - 0x4e, 0x7d, 0x4e, 0x45, 0x66, 0x4d, 0x32, 0x2c, 0x3e, 0x04, 0x78, 0xc3, 0xfd, 0x1b, 0xd7, 0x0b, - 0x67, 0x54, 0x74, 0xaa, 0x2a, 0x72, 0xb7, 0x10, 0x99, 0x79, 0x49, 0x0e, 0x89, 0x8f, 0xa0, 0x25, - 0x35, 0xdd, 0x9d, 0xa8, 0x53, 0xeb, 0x97, 0x07, 0xcd, 0x83, 0xe7, 0xf9, 0x48, 0xed, 0x23, 0x05, - 0xa0, 0xf5, 0x1b, 0xca, 0x9f, 0x88, 0x27, 0xd0, 0xfe, 0x36, 0x10, 0xd7, 0xd3, 0xd0, 0xbb, 0xd3, - 0x39, 0x20, 0x95, 0x43, 0x37, 0xcf, 0x54, 0x44, 0xbc, 0x2e, 0x91, 0x27, 0x31, 0xf8, 0x3b, 0x78, - 0x39, 0xe6, 0x4c, 0x78, 0x01, 0xa3, 0xe1, 0x38, 0xa4, 0x9e, 0xa0, 0x9a, 0xcc, 0x50, 0x64, 0x1f, - 0xe6, 0xc9, 0x36, 0x02, 0x5f, 0x97, 0xc8, 0x66, 0x06, 0xa7, 0x0e, 0xd5, 0x44, 0xb2, 0x46, 0x50, - 0x77, 0xbc, 0xb9, 0xc7, 0x7c, 0x1a, 0xe1, 0xcf, 0xa0, 0x9e, 0x95, 0x8e, 0xb6, 0x96, 0x9e, 0x76, - 0x3b, 0x2b, 0xfe, 0x07, 0xd8, 0x39, 0xf3, 0x1e, 0x4e, 0xde, 0xca, 0x15, 0x71, 0xe6, 0xdc, 0xbf, - 0xd1, 0xdb, 0x54, 0x21, 0xa9, 0x8a, 0x3f, 0x87, 0x96, 0x1b, 0x7a, 0x2c, 0xf2, 0x7c, 0x11, 0x70, - 0x26, 0x37, 0x48, 0xb2, 0xb7, 0xf3, 0xec, 0xee, 0xbd, 0x26, 0x2e, 0x20, 0xad, 0x9f, 0xd0, 0x7a, - 0x07, 0xf0, 0x11, 0x54, 0x62, 0x16, 0x24, 0xdd, 0x6c, 0x1f, 0xbc, 0xbf, 0x69, 0x17, 0xec, 0x0b, - 0x16, 0x08, 0xa7, 0xbe, 0x7a, 0xdc, 0xab, 0x48, 0x89, 0xa8, 0x00, 0xfc, 0x02, 0x76, 0xbe, 0xf1, - 0xe6, 0x31, 0x55, 0xad, 0x2b, 0x93, 0x44, 0xb1, 0x5e, 0x81, 0xc2, 0xe0, 0x67, 0xd0, 0xb8, 0x60, - 0xf3, 0x60, 0x11, 0x08, 0x3a, 0x35, 0x4b, 0xb8, 0x0d, 0x70, 0x4a, 0xf9, 0xf1, 0xf9, 0x97, 0x4b, - 0xee, 0x5f, 0x9b, 0x08, 0xb7, 0xa0, 0x7e, 0x4a, 0xb9, 0x2a, 0xc5, 0x34, 0xac, 0x47, 0x04, 0x86, - 0x7b, 0x8f, 0x3f, 0x85, 0x8a, 0xbc, 0xa6, 0x3a, 0x95, 0xe7, 0xc5, 0x4a, 0x6c, 0xf7, 0x61, 0x49, - 0x93, 0x24, 0xa4, 0x44, 0x14, 0x14, 0x63, 0xa8, 0x1c, 0x87, 0x7c, 0xa1, 0xaf, 0x8f, 0x92, 0x71, - 0x1b, 0x0c, 0x97, 0xeb, 0x0b, 0x63, 0xb8, 0x1c, 0x0f, 0xa0, 0x3a, 0x5a, 0x48, 0xa2, 0xad, 0x17, - 0x44, 0xfb, 0x71, 0x0f, 0xe0, 0x2c, 0xbe, 0x9c, 0x07, 0xfe, 0xd7, 0xf4, 0x21, 0x52, 0xb7, 0xa3, - 0x45, 0x72, 0x16, 0xeb, 0x08, 0xd4, 0xd9, 0xb8, 0x09, 0xb5, 0x0b, 0x76, 0xc3, 0xf8, 0x1d, 0x33, - 0x4b, 0xb2, 0x94, 0x74, 0xc9, 0x4c, 0x84, 0x1b, 0x7a, 0x70, 0xa6, 0x21, 0xc5, 0x13, 0xc6, 0x68, - 0x68, 0x96, 0xad, 0x5f, 0xca, 0x00, 0xe7, 0x54, 0x88, 0x39, 0x5d, 0x50, 0xa6, 0x5a, 0xa7, 0x1a, - 0xa1, 0x47, 0x9a, 0x28, 0xf8, 0x8b, 0x8d, 0x03, 0x2d, 0x4c, 0x64, 0xcd, 0x61, 0xbb, 0xf7, 0xc5, - 0xa9, 0x76, 0x27, 0x50, 0x27, 0xd4, 0xa7, 0xc1, 0x2d, 0x0d, 0x75, 0x0b, 0xd0, 0x86, 0x16, 0x18, - 0xff, 0xdd, 0x82, 0xee, 0x29, 0x34, 0xb2, 0xf5, 0xc6, 0x1f, 0x40, 0x79, 0x9c, 0x3d, 0x63, 0x4d, - 0xfd, 0x8c, 0x49, 0x13, 0x91, 0x3f, 0xd8, 0x82, 0x9d, 0xf3, 0xaf, 0x4e, 0x26, 0x49, 0xa6, 0x2d, - 0xa7, 0xa5, 0x01, 0x15, 0x69, 0x24, 0x89, 0xab, 0xfb, 0x6b, 0x32, 0xda, 0x74, 0x4e, 0x28, 0x37, - 0xa7, 0x49, 0xee, 0x28, 0x9d, 0x57, 0x7f, 0x4b, 0xb1, 0x19, 0x4e, 0xef, 0x73, 0x2e, 0xc7, 0x31, - 0x34, 0xd2, 0xb2, 0xe5, 0x2b, 0x29, 0x5b, 0xb6, 0xb7, 0x85, 0x25, 0xc5, 0xa5, 0x24, 0x59, 0x9c, - 0x75, 0xb8, 0xe5, 0x59, 0xf8, 0x9f, 0x0e, 0x58, 0x83, 0xa7, 0x8f, 0x12, 0xde, 0x85, 0xea, 0xf8, - 0x9a, 0xfe, 0x18, 0x53, 0x5d, 0xaa, 0xd6, 0x9c, 0xd1, 0xbb, 0x55, 0x0f, 0xfd, 0xbe, 0xea, 0xa1, - 0x3f, 0x57, 0x3d, 0xf4, 0xf7, 0xaa, 0x87, 0x7e, 0xfe, 0xa7, 0x57, 0xfa, 0xfe, 0x93, 0xdc, 0x67, - 0x86, 0x45, 0x4b, 0xdf, 0xdf, 0x9f, 0xd2, 0xdb, 0x21, 0xa3, 0xfc, 0x2a, 0xda, 0x4f, 0x3e, 0x32, - 0xeb, 0x4a, 0x2e, 0xab, 0xca, 0xf2, 0xea, 0xdf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x3c, 0x2d, 0x7e, - 0x6b, 0xd7, 0x06, 0x00, 0x00, + 0x18, 0xce, 0x38, 0x69, 0x3e, 0xde, 0x64, 0x43, 0x34, 0xbb, 0x5b, 0x85, 0x48, 0xa4, 0xc1, 0xe2, + 0x90, 0x3d, 0x34, 0x11, 0x5d, 0xd1, 0x72, 0x41, 0x28, 0x4e, 0x28, 0x5b, 0xb1, 0xea, 0x56, 0x53, + 0x17, 0x04, 0x9c, 0x5c, 0x67, 0x9a, 0x8e, 0x9a, 0xcc, 0x04, 0x7b, 0xdc, 0x8f, 0x3f, 0xc1, 0x99, + 0x0b, 0x27, 0x7e, 0x04, 0x7f, 0x61, 0x8f, 0x70, 0x43, 0x1c, 0x2a, 0x14, 0xfe, 0x08, 0x9a, 0xf1, + 0xd8, 0xb1, 0x57, 0x09, 0x7b, 0x49, 0xde, 0x8f, 0xe7, 0x7d, 0xe6, 0xfd, 0x9a, 0x31, 0xec, 0x7a, + 0xbe, 0x2f, 0x22, 0x2e, 0x19, 0x9f, 0x0d, 0xe5, 0xc3, 0x92, 0x86, 0x83, 0x65, 0x20, 0xa4, 0xc0, + 0xb0, 0xb6, 0x77, 0x9e, 0x4f, 0xa9, 0xcf, 0x16, 0xde, 0x7c, 0x68, 0xfe, 0x63, 0x48, 0x67, 0x7f, + 0xc6, 0xe4, 0x75, 0x74, 0x39, 0xf0, 0xc5, 0x62, 0x38, 0x13, 0x33, 0x31, 0xd4, 0xe6, 0xcb, 0xe8, + 0x4a, 0x6b, 0x5a, 0xd1, 0x52, 0x0c, 0xb7, 0xff, 0xb4, 0xa0, 0x32, 0x8a, 0x49, 0xf1, 0x0b, 0xa8, + 0xbc, 0xb9, 0xe3, 0x34, 0x38, 0x99, 0xb4, 0x51, 0x0f, 0xf5, 0x1b, 0xce, 0x07, 0x6f, 0x1f, 0xf7, + 0x0a, 0x7f, 0x3f, 0xee, 0x25, 0x66, 0x92, 0x08, 0xb8, 0x0d, 0x95, 0xd1, 0x74, 0x1a, 0xd0, 0x30, + 0x6c, 0x5b, 0x3d, 0xd4, 0xaf, 0x91, 0x44, 0xc5, 0x9f, 0xc0, 0x93, 0x33, 0x2f, 0xa0, 0x5c, 0x26, + 0xfe, 0xa2, 0xf6, 0xe7, 0x8d, 0xf8, 0x00, 0xea, 0x23, 0x5f, 0xb2, 0x5b, 0x7a, 0x1c, 0xf1, 0x69, + 0xd8, 0x2e, 0xf5, 0x50, 0xbf, 0x7e, 0xd0, 0x1a, 0x24, 0xa5, 0x4c, 0xe2, 0x7f, 0x92, 0x05, 0xe1, + 0x43, 0xa8, 0xbe, 0x66, 0x57, 0x54, 0xb2, 0x05, 0x6d, 0xef, 0xe8, 0x80, 0x67, 0x83, 0x75, 0x3f, + 0x06, 0x89, 0xcf, 0x29, 0xa9, 0xac, 0x49, 0x8a, 0xc5, 0x87, 0x00, 0xaf, 0x85, 0x7f, 0xe3, 0x7a, + 0xc1, 0x8c, 0xca, 0x76, 0x59, 0x47, 0xee, 0xe6, 0x22, 0x53, 0x2f, 0xc9, 0x20, 0xf1, 0x11, 0x34, + 0x94, 0x66, 0xba, 0x13, 0xb6, 0x2b, 0xbd, 0x62, 0xbf, 0x7e, 0xf0, 0x34, 0x1b, 0x69, 0x7c, 0x24, + 0x07, 0xb4, 0x7f, 0x47, 0xd9, 0x13, 0xf1, 0x04, 0x9a, 0xdf, 0x31, 0x79, 0x3d, 0x0d, 0xbc, 0x3b, + 0x93, 0x03, 0xd2, 0x39, 0x74, 0xb2, 0x4c, 0x79, 0xc4, 0xab, 0x02, 0x79, 0x27, 0x06, 0x7f, 0x0f, + 0xcf, 0xc7, 0x82, 0x4b, 0x8f, 0x71, 0x1a, 0x8c, 0x03, 0xea, 0x49, 0x6a, 0xc8, 0x2c, 0x4d, 0xf6, + 0x71, 0x96, 0x6c, 0x23, 0xf0, 0x55, 0x81, 0x6c, 0x66, 0x70, 0xaa, 0x50, 0x8e, 0x25, 0x7b, 0x04, + 0x55, 0xc7, 0x9b, 0x7b, 0xdc, 0xa7, 0x21, 0xfe, 0x0c, 0xaa, 0x69, 0xe9, 0x68, 0x6b, 0xe9, 0x49, + 0xb7, 0xd3, 0xe2, 0x7f, 0x84, 0x9d, 0x33, 0xef, 0xe1, 0xe4, 0x8d, 0x5a, 0x11, 0x67, 0x2e, 0xfc, + 0x1b, 0xb3, 0x4d, 0x25, 0x92, 0xa8, 0xf8, 0x73, 0x68, 0xb8, 0x81, 0xc7, 0x43, 0xcf, 0x97, 0x4c, + 0x70, 0xb5, 0x41, 0x8a, 0xbd, 0x99, 0x65, 0x77, 0xef, 0x0d, 0x71, 0x0e, 0x69, 0xff, 0x8c, 0xd6, + 0x3b, 0x80, 0x8f, 0xa0, 0x14, 0x71, 0x16, 0x77, 0xb3, 0x79, 0xf0, 0xe1, 0xa6, 0x5d, 0x18, 0x5c, + 0x70, 0x26, 0x9d, 0xea, 0xea, 0x71, 0xaf, 0xa4, 0x24, 0xa2, 0x03, 0xf0, 0x33, 0xd8, 0xf9, 0xd6, + 0x9b, 0x47, 0x54, 0xb7, 0xae, 0x48, 0x62, 0xc5, 0x7e, 0x09, 0x1a, 0x83, 0x9f, 0x40, 0xed, 0x82, + 0xcf, 0xd9, 0x82, 0x49, 0x3a, 0x6d, 0x15, 0x70, 0x13, 0xe0, 0x94, 0x8a, 0xe3, 0xf3, 0xaf, 0x96, + 0xc2, 0xbf, 0x6e, 0x21, 0xdc, 0x80, 0xea, 0x29, 0x15, 0xba, 0x94, 0x96, 0x65, 0x3f, 0x22, 0xb0, + 0xdc, 0x7b, 0xfc, 0x29, 0x94, 0xd4, 0x35, 0x35, 0xa9, 0x3c, 0xcd, 0x57, 0x32, 0x70, 0x1f, 0x96, + 0x34, 0x4e, 0x42, 0x49, 0x44, 0x43, 0x31, 0x86, 0xd2, 0x71, 0x20, 0x16, 0xe6, 0xfa, 0x68, 0x19, + 0x37, 0xc1, 0x72, 0x85, 0xb9, 0x30, 0x96, 0x2b, 0x70, 0x1f, 0xca, 0xa3, 0x85, 0x22, 0xda, 0x7a, + 0x41, 0x8c, 0x1f, 0x77, 0x01, 0xce, 0xa2, 0xcb, 0x39, 0xf3, 0xbf, 0xa1, 0x0f, 0xa1, 0xbe, 0x1d, + 0x0d, 0x92, 0xb1, 0xd8, 0x47, 0xa0, 0xcf, 0xc6, 0x75, 0xa8, 0x5c, 0xf0, 0x1b, 0x2e, 0xee, 0x78, + 0xab, 0xa0, 0x4a, 0x49, 0x96, 0xac, 0x85, 0x70, 0xcd, 0x0c, 0xae, 0x65, 0x29, 0xf1, 0x84, 0x73, + 0x1a, 0xb4, 0x8a, 0xf6, 0xaf, 0x45, 0x80, 0x73, 0x2a, 0xe5, 0x9c, 0x2e, 0x28, 0xd7, 0xad, 0xd3, + 0x8d, 0x30, 0x23, 0x8d, 0x15, 0xfc, 0xc5, 0xc6, 0x81, 0xe6, 0x26, 0xb2, 0xe6, 0x18, 0xb8, 0xf7, + 0xf9, 0xa9, 0x76, 0x26, 0x50, 0x25, 0xd4, 0xa7, 0xec, 0x96, 0x06, 0xa6, 0x05, 0x68, 0x43, 0x0b, + 0xac, 0xff, 0x6f, 0x41, 0xe7, 0x14, 0x6a, 0xe9, 0x7a, 0xe3, 0x8f, 0xa0, 0x38, 0x4e, 0x9f, 0xb1, + 0xba, 0x79, 0xc6, 0x94, 0x89, 0xa8, 0x1f, 0x6c, 0xc3, 0xce, 0xf9, 0xd7, 0x27, 0x93, 0x38, 0xd3, + 0x86, 0xd3, 0x30, 0x80, 0x92, 0x32, 0x92, 0xd8, 0xd5, 0xf9, 0x2d, 0x1e, 0x6d, 0x32, 0x27, 0x94, + 0x99, 0xd3, 0x24, 0x73, 0x94, 0xc9, 0xab, 0xb7, 0xa5, 0xd8, 0x14, 0x67, 0xf6, 0x39, 0x93, 0xe3, + 0x18, 0x6a, 0x49, 0xd9, 0xea, 0x95, 0x54, 0x2d, 0xdb, 0xdb, 0xc2, 0x92, 0xe0, 0x12, 0x92, 0x34, + 0xce, 0x3e, 0xdc, 0xf2, 0x2c, 0xbc, 0xa7, 0x03, 0x76, 0xff, 0xdd, 0x47, 0x09, 0xef, 0x42, 0x79, + 0x7c, 0x4d, 0x7f, 0x8a, 0xa8, 0x29, 0xd5, 0x68, 0xce, 0x97, 0x6f, 0x57, 0x5d, 0xf4, 0xc7, 0xaa, + 0x8b, 0xfe, 0x5a, 0x75, 0xd1, 0x3f, 0xab, 0x2e, 0xfa, 0xe5, 0xdf, 0x6e, 0xe1, 0x87, 0x17, 0x99, + 0xcf, 0x0c, 0x0f, 0x97, 0xbe, 0xbf, 0x3f, 0xa5, 0xb7, 0x43, 0x4e, 0xc5, 0x55, 0xb8, 0xef, 0x2d, + 0xd9, 0x70, 0x5d, 0xc7, 0x65, 0x59, 0x7f, 0x69, 0x5e, 0xfe, 0x17, 0x00, 0x00, 0xff, 0xff, 0x8f, + 0x4d, 0xeb, 0x13, 0xd5, 0x06, 0x00, 0x00, } func (m *Account) Marshal() (dAtA []byte, err error) { diff --git a/accounting/types.proto b/accounting/types.proto index ac512b9..1af83c1 100644 --- a/accounting/types.proto +++ b/accounting/types.proto @@ -1,6 +1,6 @@ syntax = "proto3"; package accounting; -option go_package = "github.com/nspcc-dev/neofs-proto/accounting"; +option go_package = "github.com/nspcc-dev/neofs-api/accounting"; import "decimal/decimal.proto"; import "github.com/gogo/protobuf/gogoproto/gogo.proto"; @@ -85,7 +85,7 @@ message Tx { message Settlement { message Receiver { - // To is the address of funds recipient + // To is the address of funds recipient string To = 1; // Amount is the amount of funds that will be sent decimal.Decimal Amount = 2; diff --git a/accounting/types_test.go b/accounting/types_test.go index c78e5b4..424993a 100644 --- a/accounting/types_test.go +++ b/accounting/types_test.go @@ -5,10 +5,10 @@ import ( "testing" "github.com/mr-tron/base58" + "github.com/nspcc-dev/neofs-api/chain" + "github.com/nspcc-dev/neofs-api/decimal" + "github.com/nspcc-dev/neofs-api/refs" "github.com/nspcc-dev/neofs-crypto/test" - "github.com/nspcc-dev/neofs-proto/chain" - "github.com/nspcc-dev/neofs-proto/decimal" - "github.com/nspcc-dev/neofs-proto/refs" "github.com/stretchr/testify/require" ) @@ -34,7 +34,7 @@ func TestCheque(t *testing.T) { }) t.Run("marshal/unmarshal", func(t *testing.T) { - var b2 = new(Cheque) + b2 := new(Cheque) key1 := test.DecodeKey(0) key2 := test.DecodeKey(1) @@ -67,7 +67,7 @@ func TestCheque(t *testing.T) { }) t.Run("example from SC", func(t *testing.T) { - var pathToCheque = "fixtures/cheque_data" + pathToCheque := "fixtures/cheque_data" expect, err := ioutil.ReadFile(pathToCheque) require.NoError(t, err) diff --git a/accounting/withdraw.go b/accounting/withdraw.go index 11c5608..735fb85 100644 --- a/accounting/withdraw.go +++ b/accounting/withdraw.go @@ -3,7 +3,7 @@ package accounting import ( "encoding/binary" - "github.com/nspcc-dev/neofs-proto/refs" + "github.com/nspcc-dev/neofs-api/refs" ) type ( diff --git a/accounting/withdraw.pb.go b/accounting/withdraw.pb.go index d80b01c..0e299e7 100644 --- a/accounting/withdraw.pb.go +++ b/accounting/withdraw.pb.go @@ -8,8 +8,8 @@ import ( fmt "fmt" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/golang/protobuf/proto" - decimal "github.com/nspcc-dev/neofs-proto/decimal" - service "github.com/nspcc-dev/neofs-proto/service" + decimal "github.com/nspcc-dev/neofs-api/decimal" + service "github.com/nspcc-dev/neofs-api/service" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" @@ -461,45 +461,45 @@ func init() { func init() { proto.RegisterFile("accounting/withdraw.proto", fileDescriptor_b3a38a4dc2575267) } var fileDescriptor_b3a38a4dc2575267 = []byte{ - // 600 bytes of a gzipped FileDescriptorProto + // 602 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x55, 0xc1, 0x6e, 0xd3, 0x4c, 0x10, 0xee, 0xda, 0x69, 0xda, 0x7f, 0xd2, 0x1f, 0xca, 0x0a, 0x8a, 0xeb, 0x43, 0x1a, 0xf9, 0x80, - 0x82, 0x20, 0xb6, 0x54, 0xa4, 0x08, 0xc4, 0x01, 0x35, 0x58, 0x6a, 0x2d, 0x51, 0x11, 0xf9, 0x00, - 0x12, 0x37, 0xc7, 0x99, 0x38, 0x96, 0x12, 0x3b, 0xd8, 0xeb, 0x44, 0x7d, 0x08, 0xee, 0x3c, 0x03, - 0x17, 0xae, 0x3c, 0x42, 0x8f, 0x3d, 0x02, 0x87, 0x08, 0x85, 0x77, 0xe0, 0x8c, 0xbc, 0x5e, 0xd7, - 0x4e, 0x53, 0x89, 0x0a, 0x81, 0x2a, 0x4e, 0xd9, 0x9d, 0x6f, 0x66, 0x77, 0xe6, 0xfb, 0xbe, 0x8d, - 0x61, 0xd7, 0x71, 0xdd, 0x30, 0x09, 0x98, 0x1f, 0x78, 0xc6, 0xcc, 0x67, 0xc3, 0x7e, 0xe4, 0xcc, - 0xf4, 0x49, 0x14, 0xb2, 0x90, 0x42, 0x01, 0xa9, 0x34, 0xc6, 0x68, 0xea, 0xbb, 0x68, 0x8c, 0x91, - 0x39, 0x19, 0xae, 0xde, 0xce, 0x63, 0x53, 0x8c, 0xfc, 0xc1, 0x89, 0x88, 0xde, 0xe9, 0xa3, 0xeb, - 0x8f, 0x9d, 0x91, 0x21, 0x7e, 0x45, 0xb8, 0xe5, 0xf9, 0x6c, 0x98, 0xf4, 0x74, 0x37, 0x1c, 0x1b, - 0x5e, 0xe8, 0x85, 0x06, 0x0f, 0xf7, 0x92, 0x01, 0xdf, 0xf1, 0x0d, 0x5f, 0x65, 0xe9, 0xda, 0x47, - 0x02, 0x15, 0x8b, 0xe1, 0x98, 0x36, 0x40, 0xb2, 0x4c, 0x85, 0x34, 0x48, 0x73, 0xab, 0xb3, 0x7d, - 0x3a, 0xdf, 0x5b, 0xfb, 0x3a, 0xdf, 0xdb, 0x7c, 0x3e, 0xc4, 0xb7, 0x09, 0x5a, 0xa6, 0x2d, 0x59, - 0x26, 0xbd, 0x0f, 0x1b, 0x2f, 0x67, 0x01, 0x46, 0x96, 0xa9, 0x48, 0x3c, 0xed, 0xa6, 0x48, 0xcb, - 0xc3, 0x76, 0xbe, 0xa0, 0x4d, 0xa8, 0x1e, 0x8c, 0xd3, 0x91, 0x14, 0xb9, 0x41, 0x9a, 0xb5, 0xfd, - 0x6d, 0x3d, 0x6f, 0xd2, 0xcc, 0x7e, 0x6d, 0x81, 0xd3, 0x1d, 0xa8, 0x1e, 0xa1, 0xef, 0x0d, 0x99, - 0x52, 0x69, 0x90, 0x66, 0xc5, 0x16, 0x3b, 0xaa, 0xc0, 0x46, 0xd7, 0x39, 0x19, 0x85, 0x4e, 0x5f, - 0x59, 0x4f, 0x2f, 0xb3, 0xf3, 0xad, 0xf6, 0x85, 0x00, 0x1c, 0x22, 0xb3, 0xd3, 0xce, 0x62, 0xf6, - 0x67, 0xfb, 0x7e, 0x0c, 0x95, 0x63, 0x64, 0x8e, 0xd2, 0xe3, 0x5d, 0xab, 0xba, 0x20, 0x5e, 0x17, - 0x97, 0xa5, 0xd8, 0x11, 0x3a, 0x7d, 0x8c, 0x3a, 0x9b, 0xe9, 0x19, 0x67, 0xf3, 0x3d, 0x62, 0xf3, - 0x0a, 0x6a, 0x42, 0xf5, 0x15, 0x57, 0x47, 0x71, 0x79, 0xad, 0x76, 0xb1, 0x96, 0xa3, 0xbe, 0xeb, - 0x30, 0x3f, 0x0c, 0x56, 0xce, 0x10, 0xb5, 0xda, 0x53, 0xa8, 0xf1, 0xd1, 0xe2, 0x49, 0x18, 0xc4, - 0x48, 0x1f, 0xc2, 0xe6, 0x6b, 0x61, 0x15, 0x3e, 0x61, 0x4a, 0x64, 0xe1, 0x15, 0x3d, 0xd5, 0xcd, - 0x3e, 0xcf, 0xd0, 0x3e, 0x48, 0x00, 0xdd, 0xe4, 0x9c, 0x98, 0xd2, 0xd8, 0xe4, 0xca, 0x72, 0x49, - 0x57, 0x96, 0x4b, 0x5e, 0x92, 0xcb, 0x80, 0xff, 0x8e, 0x31, 0x8e, 0x1d, 0x0f, 0x2d, 0x93, 0x2b, - 0xb9, 0xd5, 0xb9, 0x25, 0xae, 0x2b, 0x00, 0xbb, 0x58, 0x5e, 0x3b, 0xd3, 0x06, 0xd4, 0x38, 0x57, - 0x82, 0xe9, 0x5f, 0xba, 0x48, 0xfb, 0x44, 0xa0, 0xf6, 0xc2, 0x8f, 0x7f, 0x87, 0xde, 0xeb, 0x9e, - 0xb5, 0x0d, 0x5b, 0x59, 0xe7, 0x62, 0xd8, 0x7b, 0xb0, 0x9e, 0x5a, 0x27, 0x56, 0x48, 0x43, 0xbe, - 0xd4, 0x53, 0x19, 0xac, 0xbd, 0x93, 0xe0, 0x7f, 0x13, 0x47, 0xc8, 0xf0, 0xaf, 0x3c, 0xb6, 0x25, - 0xcf, 0xc8, 0xff, 0x80, 0x67, 0xb6, 0xe1, 0x46, 0x4e, 0x47, 0xc6, 0xe4, 0xfe, 0x0f, 0x52, 0xbc, - 0x50, 0xda, 0x06, 0xf9, 0x10, 0x19, 0xdd, 0x29, 0xd3, 0x59, 0xfc, 0x51, 0xa9, 0x77, 0x57, 0xe2, - 0x42, 0x8e, 0x36, 0xc8, 0xdd, 0xe4, 0x42, 0x5d, 0xf1, 0x8e, 0x97, 0xeb, 0xca, 0x9e, 0x7d, 0x02, - 0x95, 0x54, 0x56, 0xba, 0x94, 0x50, 0xb2, 0xa8, 0xaa, 0xac, 0x02, 0xa2, 0xf4, 0x19, 0x54, 0xb3, - 0x49, 0xe8, 0x6e, 0x39, 0x67, 0x49, 0x6c, 0x55, 0xbd, 0x0c, 0xca, 0x0e, 0xe8, 0x1c, 0x9c, 0x2e, - 0xea, 0xe4, 0x6c, 0x51, 0x27, 0x9f, 0x17, 0x75, 0xf2, 0x6d, 0x51, 0x27, 0xef, 0xbf, 0xd7, 0xd7, - 0xde, 0x3c, 0x28, 0x7d, 0x7b, 0x82, 0x78, 0xe2, 0xba, 0xad, 0x3e, 0x4e, 0x8d, 0x00, 0xc3, 0x41, - 0xdc, 0xca, 0xbe, 0x3c, 0xc5, 0x89, 0xbd, 0x2a, 0x8f, 0x3c, 0xfa, 0x19, 0x00, 0x00, 0xff, 0xff, - 0x39, 0x77, 0x4b, 0x08, 0x19, 0x07, 0x00, 0x00, + 0x52, 0x89, 0xd8, 0x52, 0x91, 0x22, 0x10, 0x87, 0x8a, 0x60, 0xa9, 0xb5, 0x44, 0x45, 0xe4, 0x03, + 0x48, 0xdc, 0x1c, 0x67, 0xe2, 0x58, 0x4a, 0xec, 0x60, 0xaf, 0x13, 0xf5, 0x21, 0xb8, 0xf3, 0x0c, + 0x5c, 0xb8, 0xf2, 0x08, 0x3d, 0xf6, 0x08, 0x1c, 0x22, 0x14, 0xde, 0x81, 0x33, 0xf2, 0x7a, 0x5d, + 0x3b, 0x4d, 0x25, 0x2a, 0x04, 0xaa, 0x38, 0x65, 0x77, 0xbe, 0x99, 0xdd, 0x99, 0xef, 0xfb, 0x36, + 0x86, 0x5d, 0xc7, 0x75, 0xc3, 0x24, 0x60, 0x7e, 0xe0, 0x19, 0x33, 0x9f, 0x0d, 0xfb, 0x91, 0x33, + 0xd3, 0x27, 0x51, 0xc8, 0x42, 0x0a, 0x05, 0xa4, 0xd2, 0x18, 0xa3, 0xa9, 0xef, 0xa2, 0x31, 0x46, + 0xe6, 0x64, 0xb8, 0x7a, 0x37, 0x8f, 0x4d, 0x31, 0xf2, 0x07, 0xa7, 0x22, 0x7a, 0xaf, 0x8f, 0xae, + 0x3f, 0x76, 0x46, 0x86, 0xf8, 0x15, 0xe1, 0x96, 0xe7, 0xb3, 0x61, 0xd2, 0xd3, 0xdd, 0x70, 0x6c, + 0x78, 0xa1, 0x17, 0x1a, 0x3c, 0xdc, 0x4b, 0x06, 0x7c, 0xc7, 0x37, 0x7c, 0x95, 0xa5, 0x6b, 0x1f, + 0x09, 0x54, 0x2c, 0x86, 0x63, 0xda, 0x00, 0xc9, 0x32, 0x15, 0xd2, 0x20, 0xcd, 0xad, 0xce, 0xf6, + 0xd9, 0x7c, 0x6f, 0xed, 0xeb, 0x7c, 0x6f, 0xf3, 0xf9, 0x10, 0xdf, 0x26, 0x68, 0x99, 0xb6, 0x64, + 0x99, 0x74, 0x1f, 0x36, 0x5e, 0xce, 0x02, 0x8c, 0x2c, 0x53, 0x91, 0x78, 0xda, 0x6d, 0x91, 0x96, + 0x87, 0xed, 0x7c, 0x41, 0x9b, 0x50, 0x7d, 0x36, 0x4e, 0x47, 0x52, 0xe4, 0x06, 0x69, 0xd6, 0x0e, + 0xb6, 0xf5, 0xbc, 0x49, 0x33, 0xfb, 0xb5, 0x05, 0x4e, 0x77, 0xa0, 0x7a, 0x8c, 0xbe, 0x37, 0x64, + 0x4a, 0xa5, 0x41, 0x9a, 0x15, 0x5b, 0xec, 0xa8, 0x02, 0x1b, 0x5d, 0xe7, 0x74, 0x14, 0x3a, 0x7d, + 0x65, 0x3d, 0xbd, 0xcc, 0xce, 0xb7, 0xda, 0x17, 0x02, 0x70, 0x84, 0xcc, 0x4e, 0x3b, 0x8b, 0xd9, + 0x9f, 0xed, 0xfb, 0x31, 0x54, 0x4e, 0x90, 0x39, 0x4a, 0x8f, 0x77, 0xad, 0xea, 0x82, 0x78, 0x5d, + 0x5c, 0x96, 0x62, 0xc7, 0xe8, 0xf4, 0x31, 0xea, 0x6c, 0xa6, 0x67, 0x9c, 0xcf, 0xf7, 0x88, 0xcd, + 0x2b, 0xa8, 0x09, 0xd5, 0x57, 0x5c, 0x1d, 0xc5, 0xe5, 0xb5, 0xda, 0xe5, 0x5a, 0x8e, 0xfa, 0xae, + 0xc3, 0xfc, 0x30, 0x58, 0x39, 0x43, 0xd4, 0x6a, 0x4f, 0xa1, 0xc6, 0x47, 0x8b, 0x27, 0x61, 0x10, + 0x23, 0x7d, 0x08, 0x9b, 0xaf, 0x85, 0x55, 0xf8, 0x84, 0x29, 0x91, 0x85, 0x57, 0xf4, 0x54, 0x37, + 0xfb, 0x22, 0x43, 0xfb, 0x20, 0x01, 0x74, 0x93, 0x0b, 0x62, 0x4a, 0x63, 0x93, 0x6b, 0xcb, 0x25, + 0x5d, 0x5b, 0x2e, 0x79, 0x49, 0x2e, 0x03, 0xfe, 0x3b, 0xc1, 0x38, 0x76, 0x3c, 0xb4, 0x4c, 0xae, + 0xe4, 0x56, 0xe7, 0x8e, 0xb8, 0xae, 0x00, 0xec, 0x62, 0x79, 0xe3, 0x4c, 0x1b, 0x50, 0xe3, 0x5c, + 0x09, 0xa6, 0x7f, 0xe9, 0x22, 0xed, 0x13, 0x81, 0xda, 0x0b, 0x3f, 0xfe, 0x1d, 0x7a, 0x6f, 0x7a, + 0xd6, 0x36, 0x6c, 0x65, 0x9d, 0x8b, 0x61, 0x1f, 0xc0, 0x7a, 0x6a, 0x9d, 0x58, 0x21, 0x0d, 0xf9, + 0x4a, 0x4f, 0x65, 0xb0, 0xf6, 0x4e, 0x82, 0xff, 0x4d, 0x1c, 0x21, 0xc3, 0xbf, 0xf2, 0xd8, 0x96, + 0x3c, 0x23, 0xff, 0x03, 0x9e, 0xd9, 0x86, 0x5b, 0x39, 0x1d, 0x19, 0x93, 0x07, 0x3f, 0x48, 0xf1, + 0x42, 0x69, 0x1b, 0xe4, 0x23, 0x64, 0x74, 0xa7, 0x4c, 0x67, 0xf1, 0x47, 0xa5, 0xde, 0x5f, 0x89, + 0x0b, 0x39, 0xda, 0x20, 0x77, 0x93, 0x4b, 0x75, 0xc5, 0x3b, 0x5e, 0xae, 0x2b, 0x7b, 0xf6, 0x09, + 0x54, 0x52, 0x59, 0xe9, 0x52, 0x42, 0xc9, 0xa2, 0xaa, 0xb2, 0x0a, 0x88, 0xd2, 0x43, 0xa8, 0x66, + 0x93, 0xd0, 0xdd, 0x72, 0xce, 0x92, 0xd8, 0xaa, 0x7a, 0x15, 0x94, 0x1d, 0xd0, 0x39, 0x3c, 0x5b, + 0xd4, 0xc9, 0xf9, 0xa2, 0x4e, 0x3e, 0x2f, 0xea, 0xe4, 0xdb, 0xa2, 0x4e, 0xde, 0x7f, 0xaf, 0xaf, + 0xbd, 0xd9, 0x2f, 0x7d, 0x7b, 0x82, 0x78, 0xe2, 0xba, 0xad, 0x3e, 0x4e, 0x8d, 0x00, 0xc3, 0x41, + 0xdc, 0x72, 0x26, 0xbe, 0x51, 0x9c, 0xd7, 0xab, 0xf2, 0xcf, 0xcf, 0xa3, 0x9f, 0x01, 0x00, 0x00, + 0xff, 0xff, 0xe2, 0xb5, 0x2a, 0x26, 0x17, 0x07, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/accounting/withdraw.proto b/accounting/withdraw.proto index a44e47a..85000b9 100644 --- a/accounting/withdraw.proto +++ b/accounting/withdraw.proto @@ -1,6 +1,6 @@ syntax = "proto3"; package accounting; -option go_package = "github.com/nspcc-dev/neofs-proto/accounting"; +option go_package = "github.com/nspcc-dev/neofs-api/accounting"; import "service/meta.proto"; import "service/verify.proto"; diff --git a/bootstrap/service.go b/bootstrap/service.go index e67ea6d..e068728 100644 --- a/bootstrap/service.go +++ b/bootstrap/service.go @@ -1,7 +1,7 @@ package bootstrap import ( - "github.com/nspcc-dev/neofs-proto/service" + "github.com/nspcc-dev/neofs-api/service" ) // NodeType type alias. diff --git a/bootstrap/service.pb.go b/bootstrap/service.pb.go index 7165399..163ff9b 100644 --- a/bootstrap/service.pb.go +++ b/bootstrap/service.pb.go @@ -8,7 +8,7 @@ import ( fmt "fmt" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/golang/protobuf/proto" - service "github.com/nspcc-dev/neofs-proto/service" + service "github.com/nspcc-dev/neofs-api/service" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" @@ -86,28 +86,28 @@ func init() { proto.RegisterFile("bootstrap/service.proto", fileDescriptor_21bce var fileDescriptor_21bce759c9d8eb63 = []byte{ // 342 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x50, 0xbd, 0x4e, 0xeb, 0x30, - 0x14, 0xae, 0xaf, 0x72, 0xfb, 0xe3, 0xbb, 0xf9, 0x16, 0x11, 0x65, 0x48, 0xaa, 0x4e, 0x15, 0x22, - 0x89, 0xd4, 0x2e, 0x8c, 0x55, 0xc4, 0x00, 0x43, 0x11, 0x0a, 0x88, 0x81, 0xcd, 0x71, 0x4e, 0x4a, - 0x86, 0xc6, 0xc6, 0x76, 0x2b, 0xf5, 0x4d, 0x78, 0xa4, 0x8e, 0x1d, 0x11, 0x43, 0x84, 0x82, 0xc4, - 0x73, 0xa0, 0xb8, 0x69, 0xa9, 0x60, 0xb2, 0xcf, 0xf7, 0xe7, 0xe3, 0x0f, 0x9f, 0x26, 0x9c, 0x6b, - 0xa5, 0x25, 0x15, 0xa1, 0x02, 0xb9, 0xca, 0x19, 0x04, 0x42, 0x72, 0xcd, 0x49, 0xef, 0x40, 0x38, - 0xa4, 0x61, 0xc2, 0x05, 0x68, 0xba, 0xa3, 0x9d, 0xfe, 0x1e, 0x5b, 0x81, 0xcc, 0xb3, 0x75, 0x83, - 0x9e, 0x7c, 0xa7, 0xe9, 0xb5, 0x00, 0xd5, 0xc0, 0xfe, 0x3c, 0xd7, 0x4f, 0xcb, 0x24, 0x60, 0x7c, - 0x11, 0xce, 0xf9, 0x9c, 0x87, 0x06, 0x4e, 0x96, 0x99, 0x99, 0xcc, 0x60, 0x6e, 0x3b, 0xf9, 0xf0, - 0x13, 0xe1, 0x4e, 0x0c, 0xcf, 0x4b, 0x50, 0x9a, 0x9c, 0x63, 0xab, 0x4e, 0xb2, 0xd1, 0x00, 0x8d, - 0xfe, 0x46, 0xf6, 0xa6, 0xf4, 0x5a, 0x6f, 0xa5, 0xd7, 0xbd, 0xe1, 0x29, 0xdc, 0xaf, 0x05, 0x54, - 0xa5, 0x67, 0xd5, 0x67, 0x6c, 0x54, 0xc4, 0xc7, 0x56, 0x5e, 0x64, 0xdc, 0xfe, 0x33, 0x40, 0xa3, - 0x7f, 0xe3, 0xff, 0xc1, 0x61, 0x9d, 0xa0, 0x36, 0x5c, 0x17, 0x19, 0x8f, 0xac, 0x3a, 0x22, 0x36, - 0x32, 0x72, 0x81, 0xad, 0x19, 0x68, 0x6a, 0x27, 0x46, 0xee, 0x04, 0xfb, 0x06, 0x9a, 0xc7, 0x6b, - 0xee, 0x0a, 0x68, 0x0a, 0x32, 0xea, 0xd6, 0xae, 0x6d, 0xe9, 0xa1, 0xd8, 0x38, 0xc8, 0x25, 0x6e, - 0x3f, 0x98, 0x8f, 0xdb, 0xcc, 0x78, 0x87, 0x3f, 0xbd, 0x86, 0xcd, 0x19, 0xd5, 0x39, 0x2f, 0x7e, - 0x65, 0x34, 0xde, 0xf1, 0x14, 0xf7, 0xa2, 0xfd, 0x86, 0x64, 0x82, 0x3b, 0xb7, 0x92, 0x33, 0x50, - 0x8a, 0x90, 0xa3, 0xc5, 0x9b, 0x3c, 0xa7, 0x7f, 0x84, 0xdd, 0x09, 0x09, 0x34, 0x9d, 0x51, 0x11, - 0x4d, 0x37, 0x95, 0x8b, 0xb6, 0x95, 0x8b, 0x5e, 0x2b, 0x17, 0xbd, 0x57, 0x2e, 0x7a, 0xf9, 0x70, - 0x5b, 0x8f, 0x67, 0x47, 0x7d, 0x17, 0x4a, 0x30, 0xe6, 0xa7, 0xb0, 0x0a, 0x0b, 0xe0, 0x99, 0xf2, - 0x77, 0x6d, 0x1f, 0xb2, 0x92, 0xb6, 0x01, 0x26, 0x5f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xfe, 0xcb, - 0xf7, 0x92, 0x09, 0x02, 0x00, 0x00, + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x50, 0xbb, 0x4e, 0xf3, 0x30, + 0x14, 0xae, 0x7f, 0xe5, 0xef, 0xc5, 0x6c, 0xa6, 0x88, 0x28, 0x43, 0x52, 0x75, 0xea, 0x40, 0x12, + 0xa9, 0x5d, 0x98, 0x10, 0x8a, 0x18, 0x60, 0x28, 0x42, 0x01, 0x31, 0xb0, 0x39, 0xc9, 0x49, 0xf1, + 0xd0, 0xd8, 0xd8, 0x6e, 0xa5, 0xbe, 0x09, 0x8f, 0xd4, 0xb1, 0x23, 0x62, 0x88, 0x50, 0x90, 0x78, + 0x0e, 0x14, 0x37, 0x2d, 0x15, 0x4c, 0xf6, 0xf9, 0x6e, 0x3e, 0xfe, 0xf0, 0x69, 0xc2, 0xb9, 0x56, + 0x5a, 0x52, 0x11, 0x2a, 0x90, 0x4b, 0x96, 0x42, 0x20, 0x24, 0xd7, 0x9c, 0xf4, 0xf6, 0x84, 0x43, + 0x1a, 0x26, 0x9c, 0x83, 0xa6, 0x5b, 0xda, 0xe9, 0xef, 0xb0, 0x25, 0x48, 0x96, 0xaf, 0x1a, 0xf4, + 0xe4, 0x27, 0x4d, 0xaf, 0x04, 0xa8, 0x06, 0xf6, 0x67, 0x4c, 0x3f, 0x2f, 0x92, 0x20, 0xe5, 0xf3, + 0x70, 0xc6, 0x67, 0x3c, 0x34, 0x70, 0xb2, 0xc8, 0xcd, 0x64, 0x06, 0x73, 0xdb, 0xca, 0x87, 0x5f, + 0x08, 0x77, 0x62, 0x78, 0x59, 0x80, 0xd2, 0xe4, 0x0c, 0x5b, 0x75, 0x92, 0x8d, 0x06, 0x68, 0xf4, + 0x3f, 0xb2, 0xd7, 0xa5, 0xd7, 0x7a, 0x2f, 0xbd, 0xee, 0x2d, 0xcf, 0xe0, 0x61, 0x25, 0xa0, 0x2a, + 0x3d, 0xab, 0x3e, 0x63, 0xa3, 0x22, 0x3e, 0xb6, 0x58, 0x91, 0x73, 0xfb, 0xdf, 0x00, 0x8d, 0x8e, + 0xc6, 0xc7, 0xc1, 0x7e, 0x9d, 0xa0, 0x36, 0xdc, 0x14, 0x39, 0x8f, 0xac, 0x3a, 0x22, 0x36, 0x32, + 0x72, 0x8e, 0xad, 0x29, 0x68, 0x6a, 0x27, 0x46, 0xee, 0x04, 0xbb, 0x06, 0x9a, 0xc7, 0x6b, 0xee, + 0x1a, 0x68, 0x06, 0x32, 0xea, 0xd6, 0xae, 0x4d, 0xe9, 0xa1, 0xd8, 0x38, 0xc8, 0x15, 0x6e, 0x3f, + 0x9a, 0x8f, 0xdb, 0xa9, 0xf1, 0x0e, 0x7f, 0x7b, 0x0d, 0xcb, 0x52, 0xaa, 0x19, 0x2f, 0xfe, 0x64, + 0x34, 0xde, 0xf1, 0x25, 0xee, 0x45, 0xbb, 0x0d, 0xc9, 0x04, 0x77, 0xee, 0x24, 0x4f, 0x41, 0x29, + 0x42, 0x0e, 0x16, 0x6f, 0xf2, 0x9c, 0xfe, 0x01, 0x76, 0x2f, 0x24, 0xd0, 0x6c, 0x4a, 0x45, 0x74, + 0xb1, 0xae, 0x5c, 0xb4, 0xa9, 0x5c, 0xf4, 0x56, 0xb9, 0xe8, 0xa3, 0x72, 0xd1, 0xeb, 0xa7, 0xdb, + 0x7a, 0x1a, 0x1d, 0xf4, 0x5d, 0x28, 0x91, 0xa6, 0x7e, 0x06, 0xcb, 0xb0, 0x00, 0x9e, 0x2b, 0x9f, + 0x0a, 0x16, 0xee, 0x93, 0x92, 0xb6, 0x69, 0x7c, 0xf2, 0x1d, 0x00, 0x00, 0xff, 0xff, 0xe6, 0xa2, + 0x5a, 0xfd, 0x07, 0x02, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/bootstrap/service.proto b/bootstrap/service.proto index f0bf755..fa0248c 100644 --- a/bootstrap/service.proto +++ b/bootstrap/service.proto @@ -1,6 +1,6 @@ syntax = "proto3"; package bootstrap; -option go_package = "github.com/nspcc-dev/neofs-proto/bootstrap"; +option go_package = "github.com/nspcc-dev/neofs-api/bootstrap"; import "service/meta.proto"; import "service/verify.proto"; diff --git a/bootstrap/types.go b/bootstrap/types.go index 6fcf0ed..6c21b73 100644 --- a/bootstrap/types.go +++ b/bootstrap/types.go @@ -7,7 +7,7 @@ import ( "strings" "github.com/golang/protobuf/proto" - "github.com/nspcc-dev/neofs-proto/object" + "github.com/nspcc-dev/neofs-api/object" ) type ( diff --git a/bootstrap/types.pb.go b/bootstrap/types.pb.go index f279919..83af13d 100644 --- a/bootstrap/types.pb.go +++ b/bootstrap/types.pb.go @@ -146,29 +146,29 @@ func init() { func init() { proto.RegisterFile("bootstrap/types.proto", fileDescriptor_423083266369adee) } var fileDescriptor_423083266369adee = []byte{ - // 345 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x4c, 0x90, 0xcb, 0x4a, 0xc3, 0x40, - 0x18, 0x85, 0x33, 0x6d, 0x4d, 0xcd, 0xd4, 0x85, 0xc6, 0x16, 0x82, 0x48, 0x12, 0x0a, 0x42, 0x90, - 0x36, 0xc1, 0xcb, 0x0b, 0x18, 0x10, 0x14, 0x69, 0x95, 0xd4, 0x95, 0xbb, 0x5c, 0xa6, 0x17, 0xa4, - 0xf9, 0x87, 0xcc, 0x44, 0xc8, 0xce, 0xc7, 0xf0, 0x89, 0xa4, 0x4b, 0x97, 0xc5, 0x45, 0xd0, 0xb8, - 0xcb, 0x53, 0x48, 0x27, 0x6d, 0xe9, 0xee, 0x3f, 0xe7, 0x7c, 0x33, 0xf3, 0xcf, 0xc1, 0x9d, 0x00, - 0x80, 0x33, 0x9e, 0xf8, 0xd4, 0xe1, 0x19, 0x25, 0xcc, 0xa6, 0x09, 0x70, 0x50, 0x95, 0xad, 0x7d, - 0xd2, 0x9f, 0xcc, 0xf8, 0x34, 0x0d, 0xec, 0x10, 0xe6, 0xce, 0x04, 0x26, 0xe0, 0x08, 0x22, 0x48, - 0xc7, 0x42, 0x09, 0x21, 0xa6, 0xea, 0x64, 0xf7, 0x19, 0x2b, 0x23, 0x9a, 0x10, 0x3f, 0x1a, 0xf8, - 0x54, 0x6d, 0xe3, 0xbd, 0x5b, 0x0a, 0xe1, 0x54, 0x43, 0x26, 0xb2, 0x1a, 0x5e, 0x25, 0xd4, 0x0b, - 0x2c, 0x0f, 0x09, 0x1f, 0xf8, 0x54, 0xab, 0x99, 0x75, 0xab, 0x75, 0x79, 0x6c, 0x6f, 0x5f, 0xb3, - 0x87, 0x10, 0x91, 0xfb, 0x78, 0x0c, 0x6e, 0x63, 0x91, 0x1b, 0x92, 0xb7, 0x06, 0xbb, 0x9f, 0x08, - 0xef, 0x6f, 0x22, 0xf5, 0x0c, 0x37, 0x6f, 0xa2, 0x28, 0x21, 0x8c, 0x89, 0x7b, 0x15, 0xb7, 0x55, - 0xe6, 0x46, 0xd3, 0xaf, 0x2c, 0x6f, 0x93, 0xa9, 0x3d, 0x2c, 0x3f, 0xa5, 0xc1, 0x03, 0xc9, 0xb4, - 0x9a, 0x89, 0xac, 0x03, 0xb7, 0x5d, 0xe6, 0xc6, 0x21, 0x4d, 0x83, 0x57, 0x92, 0xf5, 0x60, 0x3e, - 0xe3, 0x64, 0x4e, 0x79, 0xe6, 0xad, 0x19, 0xd5, 0xc1, 0xcd, 0x47, 0xca, 0x67, 0x10, 0x33, 0xad, - 0x6e, 0xd6, 0x2d, 0xc5, 0xed, 0x94, 0xb9, 0x71, 0x04, 0x95, 0xb5, 0xc3, 0x6f, 0x28, 0xf5, 0x1a, - 0xcb, 0x23, 0xee, 0xf3, 0x94, 0x69, 0x8d, 0xd5, 0xe7, 0xdc, 0xd3, 0xd5, 0xc2, 0xdf, 0xb9, 0x81, - 0x57, 0x7b, 0x56, 0x49, 0x99, 0x1b, 0x32, 0x13, 0x93, 0xb7, 0x66, 0xdd, 0xbb, 0xe5, 0xaf, 0x2e, - 0xbd, 0x17, 0xba, 0xb4, 0x28, 0x74, 0xf4, 0x55, 0xe8, 0x68, 0x59, 0xe8, 0xe8, 0xa7, 0xd0, 0xd1, - 0xc7, 0x9f, 0x2e, 0xbd, 0x9c, 0xef, 0x74, 0x1d, 0x33, 0x1a, 0x86, 0xfd, 0x88, 0xbc, 0x39, 0x31, - 0x81, 0x31, 0xeb, 0x57, 0x4d, 0x6f, 0x9b, 0x0a, 0x64, 0x61, 0x5c, 0xfd, 0x07, 0x00, 0x00, 0xff, - 0xff, 0x71, 0xeb, 0x37, 0x57, 0xc2, 0x01, 0x00, 0x00, + // 348 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x4c, 0x90, 0xcd, 0x4a, 0xfb, 0x40, + 0x14, 0xc5, 0x33, 0x6d, 0xff, 0xe9, 0x3f, 0x53, 0x17, 0x1a, 0x5b, 0x08, 0x22, 0x49, 0x28, 0x08, + 0x59, 0xb4, 0x09, 0x7e, 0xbc, 0x80, 0x01, 0x05, 0x91, 0x56, 0x49, 0x5d, 0xb9, 0xcb, 0xc7, 0xb4, + 0x0d, 0xd2, 0xdc, 0x21, 0x33, 0x11, 0xb2, 0xf3, 0x31, 0x7c, 0x22, 0xe9, 0xd2, 0x65, 0x71, 0x11, + 0x34, 0xee, 0xf2, 0x14, 0xd2, 0x49, 0x5b, 0xba, 0xbb, 0xe7, 0x9c, 0xdf, 0xcc, 0xdc, 0x39, 0xb8, + 0x17, 0x00, 0x70, 0xc6, 0x53, 0x9f, 0x3a, 0x3c, 0xa7, 0x84, 0xd9, 0x34, 0x05, 0x0e, 0xaa, 0xb2, + 0xb3, 0x4f, 0x86, 0xb3, 0x98, 0xcf, 0xb3, 0xc0, 0x0e, 0x61, 0xe1, 0xcc, 0x60, 0x06, 0x8e, 0x20, + 0x82, 0x6c, 0x2a, 0x94, 0x10, 0x62, 0xaa, 0x4f, 0xf6, 0x9f, 0xb0, 0x32, 0xa1, 0x29, 0xf1, 0xa3, + 0x91, 0x4f, 0xd5, 0x2e, 0xfe, 0x77, 0x43, 0x21, 0x9c, 0x6b, 0xc8, 0x44, 0x56, 0xcb, 0xab, 0x85, + 0x7a, 0x8e, 0xe5, 0x31, 0xe1, 0x23, 0x9f, 0x6a, 0x0d, 0xb3, 0x69, 0x75, 0x2e, 0x8e, 0xed, 0xdd, + 0x6b, 0xf6, 0x18, 0x22, 0x72, 0x97, 0x4c, 0xc1, 0x6d, 0x2d, 0x0b, 0x43, 0xf2, 0x36, 0x60, 0xff, + 0x03, 0xe1, 0xff, 0xdb, 0x48, 0x3d, 0xc3, 0xed, 0xeb, 0x28, 0x4a, 0x09, 0x63, 0xe2, 0x5e, 0xc5, + 0xed, 0x54, 0x85, 0xd1, 0xf6, 0x6b, 0xcb, 0xdb, 0x66, 0xea, 0x00, 0xcb, 0x8f, 0x59, 0x70, 0x4f, + 0x72, 0xad, 0x61, 0x22, 0xeb, 0xc0, 0xed, 0x56, 0x85, 0x71, 0x48, 0xb3, 0xe0, 0x85, 0xe4, 0x03, + 0x58, 0xc4, 0x9c, 0x2c, 0x28, 0xcf, 0xbd, 0x0d, 0xa3, 0x3a, 0xb8, 0xfd, 0x40, 0x79, 0x0c, 0x09, + 0xd3, 0x9a, 0x66, 0xd3, 0x52, 0xdc, 0x5e, 0x55, 0x18, 0x47, 0x50, 0x5b, 0x7b, 0xfc, 0x96, 0x52, + 0xaf, 0xb0, 0x3c, 0xe1, 0x3e, 0xcf, 0x98, 0xd6, 0x5a, 0x7f, 0xce, 0x3d, 0x5d, 0x2f, 0xfc, 0x55, + 0x18, 0x78, 0xbd, 0x67, 0x9d, 0x54, 0x85, 0x21, 0x33, 0x31, 0x79, 0x1b, 0xd6, 0xbd, 0x5d, 0xfd, + 0xe8, 0xd2, 0x5b, 0xa9, 0x4b, 0xcb, 0x52, 0x47, 0x9f, 0xa5, 0x8e, 0x56, 0xa5, 0x8e, 0xbe, 0x4b, + 0x1d, 0xbd, 0xff, 0xea, 0xd2, 0xb3, 0xb5, 0xd7, 0x75, 0xc2, 0x68, 0x18, 0x0e, 0x23, 0xf2, 0xea, + 0x24, 0x04, 0xa6, 0x6c, 0xe8, 0xd3, 0xd8, 0xd9, 0xf5, 0x14, 0xc8, 0xa2, 0xed, 0xcb, 0xbf, 0x00, + 0x00, 0x00, 0xff, 0xff, 0xc2, 0x29, 0x27, 0x0e, 0xc0, 0x01, 0x00, 0x00, } func (m *SpreadMap) Marshal() (dAtA []byte, err error) { diff --git a/bootstrap/types.proto b/bootstrap/types.proto index 5a566da..02da9ad 100644 --- a/bootstrap/types.proto +++ b/bootstrap/types.proto @@ -1,6 +1,6 @@ syntax = "proto3"; package bootstrap; -option go_package = "github.com/nspcc-dev/neofs-proto/bootstrap"; +option go_package = "github.com/nspcc-dev/neofs-api/bootstrap"; import "github.com/gogo/protobuf/gogoproto/gogo.proto"; diff --git a/chain/address.go b/chain/address.go index e760d69..bdc8a65 100644 --- a/chain/address.go +++ b/chain/address.go @@ -7,8 +7,8 @@ import ( "encoding/hex" "github.com/mr-tron/base58" + "github.com/nspcc-dev/neofs-api/internal" crypto "github.com/nspcc-dev/neofs-crypto" - "github.com/nspcc-dev/neofs-proto/internal" "github.com/pkg/errors" "golang.org/x/crypto/ripemd160" ) diff --git a/container/service.go b/container/service.go index 24727ee..01d88fa 100644 --- a/container/service.go +++ b/container/service.go @@ -4,8 +4,8 @@ import ( "bytes" "encoding/binary" - "github.com/nspcc-dev/neofs-proto/internal" - "github.com/nspcc-dev/neofs-proto/refs" + "github.com/nspcc-dev/neofs-api/internal" + "github.com/nspcc-dev/neofs-api/refs" "github.com/pkg/errors" ) diff --git a/container/service.pb.go b/container/service.pb.go index cac8764..e202a7c 100644 --- a/container/service.pb.go +++ b/container/service.pb.go @@ -8,7 +8,7 @@ import ( fmt "fmt" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/golang/protobuf/proto" - service "github.com/nspcc-dev/neofs-proto/service" + service "github.com/nspcc-dev/neofs-api/service" netmap "github.com/nspcc-dev/netmap" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" @@ -391,10 +391,10 @@ func init() { func init() { proto.RegisterFile("container/service.proto", fileDescriptor_e1fa9d7ab2e7ae06) } var fileDescriptor_e1fa9d7ab2e7ae06 = []byte{ - // 580 bytes of a gzipped FileDescriptorProto + // 582 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x54, 0xcb, 0x6e, 0xd3, 0x40, 0x14, 0xed, 0x34, 0xe9, 0x23, 0xd7, 0xe5, 0x35, 0x6a, 0x5a, 0x63, 0x89, 0x24, 0xf2, 0x2a, 0x20, - 0x62, 0x8b, 0x50, 0x09, 0x36, 0x48, 0x34, 0x89, 0x14, 0x2a, 0x51, 0x11, 0x19, 0x89, 0x05, 0x3b, + 0x62, 0x8b, 0x50, 0x09, 0x36, 0x20, 0x35, 0x89, 0x14, 0x2a, 0x51, 0x11, 0x19, 0x89, 0x05, 0x3b, 0x67, 0x7a, 0x13, 0x2c, 0x25, 0xb6, 0xf1, 0x8c, 0x83, 0xf2, 0x27, 0xfc, 0x03, 0x12, 0x6b, 0x3e, 0xa1, 0xcb, 0x2e, 0x11, 0x8b, 0x08, 0x85, 0x25, 0xe2, 0x1f, 0x90, 0xc7, 0xcf, 0xa4, 0x05, 0x96, 0x15, 0x1b, 0x6b, 0xe6, 0x9c, 0x7b, 0xee, 0xdb, 0x03, 0x87, 0xcc, 0x73, 0x85, 0xed, 0xb8, 0x18, @@ -426,9 +426,9 @@ var fileDescriptor_e1fa9d7ab2e7ae06 = []byte{ 0xd9, 0x78, 0xed, 0xee, 0x15, 0x4c, 0x22, 0x3f, 0x82, 0x52, 0x1f, 0x57, 0x83, 0xe6, 0xab, 0xb6, 0x12, 0xb4, 0x38, 0xd4, 0x27, 0x50, 0x8e, 0xaa, 0xa4, 0x45, 0xbe, 0x30, 0x30, 0xed, 0xf0, 0x12, 0x1e, 0x0b, 0x3b, 0xcf, 0xcf, 0x97, 0x35, 0x72, 0xb1, 0xac, 0x91, 0xaf, 0xcb, 0x1a, 0xf9, 0xbe, - 0xac, 0x91, 0x8f, 0x3f, 0x6a, 0x1b, 0x6f, 0xff, 0xf4, 0x34, 0x7b, 0x23, 0xde, 0x8a, 0x1f, 0xdb, - 0xcc, 0xdd, 0x70, 0x5b, 0x02, 0x8f, 0x7f, 0x07, 0x00, 0x00, 0xff, 0xff, 0x31, 0xf8, 0x4f, 0x34, - 0x34, 0x06, 0x00, 0x00, + 0xac, 0x91, 0x8f, 0x3f, 0x6a, 0x1b, 0x6f, 0x9b, 0x7f, 0x78, 0x9a, 0xbd, 0x11, 0x6f, 0xd9, 0xbe, + 0x63, 0x66, 0xce, 0x86, 0xdb, 0xf2, 0xc1, 0x7d, 0xfc, 0x3b, 0x00, 0x00, 0xff, 0xff, 0x31, 0xf8, + 0x12, 0xa0, 0x32, 0x06, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/container/service.proto b/container/service.proto index 9bd02c9..4576197 100644 --- a/container/service.proto +++ b/container/service.proto @@ -1,6 +1,6 @@ syntax = "proto3"; package container; -option go_package = "github.com/nspcc-dev/neofs-proto/container"; +option go_package = "github.com/nspcc-dev/neofs-api/container"; import "service/meta.proto"; import "service/verify.proto"; diff --git a/container/types.go b/container/types.go index d5d5a77..b718907 100644 --- a/container/types.go +++ b/container/types.go @@ -4,9 +4,9 @@ import ( "bytes" "github.com/google/uuid" + "github.com/nspcc-dev/neofs-api/internal" + "github.com/nspcc-dev/neofs-api/refs" "github.com/nspcc-dev/neofs-crypto/test" - "github.com/nspcc-dev/neofs-proto/internal" - "github.com/nspcc-dev/neofs-proto/refs" "github.com/nspcc-dev/netmap" "github.com/pkg/errors" ) diff --git a/container/types.pb.go b/container/types.pb.go index 7a454de..fb22b13 100644 --- a/container/types.pb.go +++ b/container/types.pb.go @@ -190,30 +190,31 @@ func init() { func init() { proto.RegisterFile("container/types.proto", fileDescriptor_1432e52ab0b53e3e) } var fileDescriptor_1432e52ab0b53e3e = []byte{ - // 368 bytes of a gzipped FileDescriptorProto + // 371 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x91, 0x4f, 0x4b, 0xfb, 0x30, 0x1c, 0xc6, 0x97, 0xad, 0xfb, 0xfd, 0x5c, 0x36, 0x11, 0x03, 0x93, 0x32, 0xa4, 0x2b, 0x3b, 0x55, - 0xa1, 0xad, 0x4e, 0xf0, 0xac, 0xdb, 0x44, 0x06, 0x8a, 0x52, 0xd9, 0x45, 0xbc, 0x74, 0x59, 0x36, - 0x0b, 0x5d, 0x53, 0x92, 0x54, 0xd9, 0x3b, 0xf1, 0x25, 0xed, 0xe8, 0x51, 0x3c, 0x4c, 0xa9, 0x6f, - 0x44, 0x9a, 0x6c, 0x75, 0x30, 0xbd, 0xe5, 0x79, 0xf2, 0x79, 0x92, 0xef, 0x1f, 0x58, 0xc7, 0x34, - 0x12, 0x7e, 0x10, 0x11, 0xe6, 0x8a, 0x59, 0x4c, 0xb8, 0x13, 0x33, 0x2a, 0x28, 0xaa, 0xe4, 0x76, - 0xe3, 0x70, 0x12, 0x88, 0xc7, 0x64, 0xe8, 0x60, 0x3a, 0x75, 0x23, 0x1e, 0x63, 0x6c, 0x8f, 0xc8, - 0x93, 0x1b, 0x11, 0x31, 0xf5, 0x63, 0x97, 0x93, 0x90, 0x60, 0x41, 0x99, 0x8a, 0x35, 0xec, 0x35, - 0x76, 0x42, 0x27, 0xd4, 0x95, 0xf6, 0x30, 0x19, 0x4b, 0x25, 0x85, 0x3c, 0x29, 0xbc, 0xf5, 0x01, - 0x60, 0xa5, 0xbb, 0xfa, 0x08, 0x1d, 0xc0, 0xff, 0x37, 0xcf, 0x11, 0x61, 0xfd, 0x9e, 0x0e, 0x4c, - 0x60, 0xd5, 0x3a, 0x3b, 0xf3, 0x45, 0xb3, 0xf0, 0xbe, 0x68, 0xae, 0x6c, 0x6f, 0x75, 0x40, 0x26, - 0xd4, 0xee, 0xfc, 0x50, 0xe8, 0x45, 0xc9, 0xd5, 0x96, 0x9c, 0x36, 0x18, 0xf4, 0x7b, 0x9e, 0xbc, - 0x41, 0x0d, 0xb8, 0xd5, 0xf5, 0x63, 0x1f, 0x07, 0x62, 0xa6, 0x97, 0x4c, 0x60, 0x69, 0x5e, 0xae, - 0xd1, 0x31, 0x2c, 0x7b, 0x49, 0x48, 0xb8, 0xae, 0x99, 0xc0, 0xaa, 0xb6, 0xeb, 0x8e, 0x6a, 0xc6, - 0xb9, 0x0d, 0x7d, 0x4c, 0xa6, 0x24, 0x12, 0xd9, 0x6d, 0x47, 0xcb, 0x5e, 0xf5, 0x14, 0x89, 0x4e, - 0xa1, 0x76, 0x15, 0x70, 0xa1, 0x97, 0x65, 0x62, 0xdf, 0xc9, 0xc7, 0xe3, 0x9c, 0x63, 0x4c, 0x38, - 0xcf, 0xba, 0x60, 0x34, 0xcc, 0x98, 0x65, 0x50, 0xf2, 0xad, 0x07, 0x58, 0x55, 0xc0, 0x25, 0xa3, - 0x49, 0x8c, 0x0c, 0x08, 0x95, 0xbc, 0xa6, 0x23, 0x22, 0xbb, 0xdc, 0xf6, 0xd6, 0x1c, 0x64, 0xc3, - 0xca, 0x80, 0x13, 0x26, 0x61, 0xbd, 0x68, 0x96, 0x7e, 0x1b, 0xc2, 0x0f, 0xd1, 0xba, 0x80, 0xbb, - 0x1b, 0xdf, 0xa3, 0xa3, 0x65, 0xa9, 0xc0, 0x2c, 0x59, 0xd5, 0xf6, 0xde, 0x46, 0xa9, 0x32, 0xba, - 0x5e, 0x64, 0xe7, 0x6c, 0x9e, 0x1a, 0xe0, 0x35, 0x35, 0xc0, 0x5b, 0x6a, 0x80, 0xcf, 0xd4, 0x00, - 0x2f, 0x5f, 0x46, 0xe1, 0xfe, 0xaf, 0xbd, 0xd3, 0x31, 0xb7, 0xd5, 0x26, 0xf3, 0x97, 0x87, 0xff, - 0xa4, 0x71, 0xf2, 0x1d, 0x00, 0x00, 0xff, 0xff, 0x13, 0x1b, 0x01, 0x24, 0x4e, 0x02, 0x00, 0x00, + 0xa1, 0xad, 0x4e, 0xf0, 0x28, 0xb8, 0x4d, 0x64, 0xa0, 0x28, 0x95, 0x5d, 0xc4, 0x4b, 0x97, 0x65, + 0xb3, 0xd0, 0x35, 0x21, 0x49, 0x95, 0xbd, 0x13, 0x5f, 0xd2, 0x8e, 0x1e, 0xc5, 0xc3, 0x94, 0xfa, + 0x46, 0xa4, 0xe9, 0x56, 0x07, 0xd3, 0x5b, 0x9e, 0x27, 0x9f, 0x27, 0xf9, 0xfe, 0x81, 0x75, 0x4c, + 0x23, 0xe9, 0x07, 0x11, 0xe1, 0xae, 0x9c, 0x31, 0x22, 0x1c, 0xc6, 0xa9, 0xa4, 0xa8, 0x92, 0xdb, + 0x8d, 0xc3, 0x49, 0x20, 0x1f, 0xe3, 0xa1, 0x83, 0xe9, 0xd4, 0x8d, 0x04, 0xc3, 0xd8, 0x1e, 0x91, + 0x27, 0x37, 0x22, 0x72, 0xea, 0x33, 0x57, 0x90, 0x90, 0x60, 0x49, 0x79, 0x16, 0x6b, 0xd8, 0x6b, + 0xec, 0x84, 0x4e, 0xa8, 0xab, 0xec, 0x61, 0x3c, 0x56, 0x4a, 0x09, 0x75, 0xca, 0xf0, 0xd6, 0x07, + 0x80, 0x95, 0xee, 0xea, 0x23, 0x74, 0x00, 0xff, 0xdf, 0x3c, 0x47, 0x84, 0xf7, 0x7b, 0x3a, 0x30, + 0x81, 0x55, 0xeb, 0xec, 0xcc, 0x17, 0xcd, 0xc2, 0xfb, 0xa2, 0xb9, 0xb2, 0xbd, 0xd5, 0x01, 0x99, + 0x50, 0xbb, 0xf3, 0x43, 0xa9, 0x17, 0x15, 0x57, 0x5b, 0x72, 0xda, 0x60, 0xd0, 0xef, 0x79, 0xea, + 0x06, 0x35, 0xe0, 0x56, 0xd7, 0x67, 0x3e, 0x0e, 0xe4, 0x4c, 0x2f, 0x99, 0xc0, 0xd2, 0xbc, 0x5c, + 0xa3, 0x63, 0x58, 0xf6, 0xe2, 0x90, 0x08, 0x5d, 0x33, 0x81, 0x55, 0x6d, 0xd7, 0x9d, 0xac, 0x19, + 0xe7, 0x36, 0xf4, 0x31, 0x99, 0x92, 0x48, 0xa6, 0xb7, 0x1d, 0x2d, 0x7d, 0xd5, 0xcb, 0x48, 0x74, + 0x0a, 0xb5, 0xab, 0x40, 0x48, 0xbd, 0xac, 0x12, 0xfb, 0x4e, 0x3e, 0x1e, 0xe7, 0x1c, 0x63, 0x22, + 0x44, 0xda, 0x05, 0xa7, 0x61, 0xca, 0x2c, 0x83, 0x8a, 0x6f, 0x3d, 0xc0, 0x6a, 0x06, 0x5c, 0x72, + 0x1a, 0x33, 0x64, 0x40, 0x98, 0xc9, 0x6b, 0x3a, 0x22, 0xaa, 0xcb, 0x6d, 0x6f, 0xcd, 0x41, 0x36, + 0xac, 0x0c, 0x04, 0xe1, 0x0a, 0xd6, 0x8b, 0x66, 0xe9, 0xb7, 0x21, 0xfc, 0x10, 0xad, 0x0b, 0xb8, + 0xbb, 0xf1, 0x3d, 0x3a, 0x5a, 0x96, 0x0a, 0xcc, 0x92, 0x55, 0x6d, 0xef, 0x6d, 0x94, 0xaa, 0xa2, + 0xeb, 0x45, 0x76, 0xce, 0xe6, 0x89, 0x01, 0x5e, 0x13, 0x03, 0xbc, 0x25, 0x06, 0xf8, 0x4c, 0x0c, + 0xf0, 0xf2, 0x65, 0x14, 0xee, 0xad, 0x3f, 0xf6, 0x4e, 0xc7, 0xc2, 0xf6, 0x59, 0xe0, 0xe6, 0xef, + 0x0e, 0xff, 0xa9, 0x6d, 0x9e, 0x7c, 0x07, 0x00, 0x00, 0xff, 0xff, 0xb8, 0xe6, 0x51, 0x5d, 0x4c, + 0x02, 0x00, 0x00, } func (m *Container) Marshal() (dAtA []byte, err error) { diff --git a/container/types.proto b/container/types.proto index 4600046..e53587e 100644 --- a/container/types.proto +++ b/container/types.proto @@ -1,6 +1,6 @@ syntax = "proto3"; package container; -option go_package = "github.com/nspcc-dev/neofs-proto/container"; +option go_package = "github.com/nspcc-dev/neofs-api/container"; import "github.com/nspcc-dev/netmap/selector.proto"; import "github.com/gogo/protobuf/gogoproto/gogo.proto"; diff --git a/container/types_test.go b/container/types_test.go index cfd5f52..0a20d54 100644 --- a/container/types_test.go +++ b/container/types_test.go @@ -4,8 +4,8 @@ import ( "testing" "github.com/gogo/protobuf/proto" + "github.com/nspcc-dev/neofs-api/refs" "github.com/nspcc-dev/neofs-crypto/test" - "github.com/nspcc-dev/neofs-proto/refs" "github.com/nspcc-dev/netmap" "github.com/stretchr/testify/require" ) diff --git a/decimal/decimal.pb.go b/decimal/decimal.pb.go index d2bed7d..c0726a4 100644 --- a/decimal/decimal.pb.go +++ b/decimal/decimal.pb.go @@ -83,7 +83,7 @@ func init() { func init() { proto.RegisterFile("decimal/decimal.proto", fileDescriptor_e7e70e1773836c80) } var fileDescriptor_e7e70e1773836c80 = []byte{ - // 181 bytes of a gzipped FileDescriptorProto + // 183 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x4d, 0x49, 0x4d, 0xce, 0xcc, 0x4d, 0xcc, 0xd1, 0x87, 0xd2, 0x7a, 0x05, 0x45, 0xf9, 0x25, 0xf9, 0x42, 0xec, 0x50, 0xae, 0x94, 0x6e, 0x7a, 0x66, 0x49, 0x46, 0x69, 0x92, 0x5e, 0x72, 0x7e, 0xae, 0x7e, 0x7a, 0x7e, 0x7a, @@ -91,11 +91,11 @@ var fileDescriptor_e7e70e1773836c80 = []byte{ 0x2e, 0x76, 0x17, 0x88, 0x4e, 0x21, 0x11, 0x2e, 0xd6, 0xb0, 0xc4, 0x9c, 0xd2, 0x54, 0x09, 0x46, 0x05, 0x46, 0x0d, 0xe6, 0x20, 0x08, 0x47, 0x48, 0x86, 0x8b, 0x33, 0xa0, 0x28, 0x35, 0x39, 0xb3, 0x38, 0x33, 0x3f, 0x4f, 0x82, 0x49, 0x81, 0x51, 0x83, 0x37, 0x08, 0x21, 0x60, 0xc5, 0x32, 0x63, - 0x81, 0x3c, 0x83, 0x93, 0xdd, 0x89, 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, 0x31, 0xde, 0x78, 0x24, - 0xc7, 0xf8, 0xe0, 0x91, 0x1c, 0xe3, 0x8c, 0xc7, 0x72, 0x0c, 0x51, 0x1a, 0x48, 0x2e, 0xc9, 0x2b, - 0x2e, 0x48, 0x4e, 0xd6, 0x4d, 0x49, 0x2d, 0xd3, 0xcf, 0x4b, 0xcd, 0x4f, 0x2b, 0xd6, 0x85, 0xb8, - 0x03, 0xea, 0xe6, 0x24, 0x36, 0x30, 0xd7, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, 0xac, 0x68, 0x21, - 0x20, 0xdc, 0x00, 0x00, 0x00, + 0x81, 0x3c, 0x83, 0x93, 0xcd, 0x89, 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, 0x31, 0xde, 0x78, 0x24, + 0xc7, 0xf8, 0xe0, 0x91, 0x1c, 0xe3, 0x8c, 0xc7, 0x72, 0x0c, 0x51, 0x6a, 0x48, 0x2e, 0xc9, 0x2b, + 0x2e, 0x48, 0x4e, 0xd6, 0x4d, 0x49, 0x2d, 0xd3, 0xcf, 0x4b, 0xcd, 0x4f, 0x2b, 0xd6, 0x4d, 0x2c, + 0xc8, 0x84, 0x79, 0x20, 0x89, 0x0d, 0xec, 0x12, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0x8d, + 0xc1, 0x18, 0x3c, 0xda, 0x00, 0x00, 0x00, } func (m *Decimal) Marshal() (dAtA []byte, err error) { diff --git a/decimal/decimal.proto b/decimal/decimal.proto index 42cf2df..e0e16d5 100644 --- a/decimal/decimal.proto +++ b/decimal/decimal.proto @@ -1,6 +1,6 @@ syntax = "proto3"; package decimal; -option go_package = "github.com/nspcc-dev/neofs-proto/decimal"; +option go_package = "github.com/nspcc-dev/neofs-api/decimal"; import "github.com/gogo/protobuf/gogoproto/gogo.proto"; diff --git a/go.mod b/go.mod index 688905e..92ae511 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/nspcc-dev/neofs-proto +module github.com/nspcc-dev/neofs-api go 1.13 diff --git a/hash/hash.go b/hash/hash.go index 3688443..de02491 100644 --- a/hash/hash.go +++ b/hash/hash.go @@ -4,7 +4,7 @@ import ( "bytes" "github.com/mr-tron/base58" - "github.com/nspcc-dev/neofs-proto/internal" + "github.com/nspcc-dev/neofs-api/internal" "github.com/nspcc-dev/tzhash/tz" "github.com/pkg/errors" ) @@ -70,7 +70,7 @@ func (h Hash) Verify(data []byte) bool { return h.Equal(Sum(data)) } // Validate checks if combined hashes are equal to current Hash. func (h Hash) Validate(hashes []Hash) bool { - var hashBytes = make([][]byte, 0, len(hashes)) + hashBytes := make([][]byte, 0, len(hashes)) for i := range hashes { hashBytes = append(hashBytes, hashes[i].Bytes()) } diff --git a/object/extensions.go b/object/extensions.go index f6b10ab..a496413 100644 --- a/object/extensions.go +++ b/object/extensions.go @@ -1,7 +1,8 @@ package object + // todo: all extensions must be transferred to the separate util library -import "github.com/nspcc-dev/neofs-proto/storagegroup" +import "github.com/nspcc-dev/neofs-api/storagegroup" // IsLinking checks if object has children links to another objects. // We have to check payload size because zero-object must have zero diff --git a/object/service.go b/object/service.go index 38dbee1..b0afc55 100644 --- a/object/service.go +++ b/object/service.go @@ -1,11 +1,11 @@ package object import ( - "github.com/nspcc-dev/neofs-proto/hash" - "github.com/nspcc-dev/neofs-proto/internal" - "github.com/nspcc-dev/neofs-proto/refs" - "github.com/nspcc-dev/neofs-proto/service" - "github.com/nspcc-dev/neofs-proto/session" + "github.com/nspcc-dev/neofs-api/hash" + "github.com/nspcc-dev/neofs-api/internal" + "github.com/nspcc-dev/neofs-api/refs" + "github.com/nspcc-dev/neofs-api/service" + "github.com/nspcc-dev/neofs-api/session" ) type ( diff --git a/object/service.pb.go b/object/service.pb.go index 9019cae..43013fe 100644 --- a/object/service.pb.go +++ b/object/service.pb.go @@ -8,9 +8,9 @@ import ( fmt "fmt" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/golang/protobuf/proto" - refs "github.com/nspcc-dev/neofs-proto/refs" - service "github.com/nspcc-dev/neofs-proto/service" - session "github.com/nspcc-dev/neofs-proto/session" + refs "github.com/nspcc-dev/neofs-api/refs" + service "github.com/nspcc-dev/neofs-api/service" + session "github.com/nspcc-dev/neofs-api/session" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" @@ -883,60 +883,60 @@ func init() { func init() { proto.RegisterFile("object/service.proto", fileDescriptor_dfcdf610ade6a9ce) } var fileDescriptor_dfcdf610ade6a9ce = []byte{ - // 842 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x56, 0x4b, 0x4f, 0xe3, 0x56, - 0x14, 0xce, 0x8d, 0x83, 0x81, 0x13, 0x07, 0xa2, 0x4b, 0x4a, 0x23, 0x17, 0x05, 0x64, 0xa1, 0x36, - 0x55, 0x15, 0x87, 0x52, 0x09, 0x58, 0xc0, 0xa2, 0x49, 0x04, 0x61, 0x51, 0x41, 0x2f, 0x08, 0xa9, - 0xdd, 0x39, 0xce, 0xcd, 0xa3, 0x04, 0x3b, 0xf5, 0x03, 0xc4, 0x0f, 0xe8, 0xba, 0xdb, 0x2e, 0xfa, - 0x53, 0xfa, 0x03, 0xd8, 0x54, 0x62, 0x59, 0x75, 0x81, 0xaa, 0x74, 0xdd, 0x7d, 0xa5, 0xd9, 0x8c, - 0xee, 0xc3, 0xb1, 0x13, 0x06, 0x66, 0x86, 0xc5, 0x64, 0x56, 0xb9, 0xe7, 0x3b, 0xaf, 0x9c, 0xcf, - 0xdf, 0xb9, 0x36, 0x14, 0xdc, 0xd6, 0x4f, 0xd4, 0x0e, 0xaa, 0x3e, 0xf5, 0xae, 0xfb, 0x36, 0x35, - 0x87, 0x9e, 0x1b, 0xb8, 0x58, 0x15, 0xa8, 0x9e, 0xf7, 0x68, 0xc7, 0xaf, 0x06, 0xb7, 0x43, 0xea, - 0x0b, 0x8f, 0x8e, 0x65, 0x7c, 0x12, 0x5b, 0xf1, 0xa9, 0xef, 0xf7, 0x5d, 0x67, 0x32, 0x50, 0x56, - 0xac, 0x5e, 0xd1, 0xc0, 0x92, 0x58, 0x21, 0xc2, 0xae, 0xa9, 0xd7, 0xef, 0xdc, 0x4a, 0xb4, 0xd2, - 0xed, 0x07, 0xbd, 0xb0, 0x65, 0xda, 0xee, 0x55, 0xb5, 0xeb, 0x76, 0xdd, 0x2a, 0x87, 0x5b, 0x61, - 0x87, 0x5b, 0xdc, 0xe0, 0x27, 0x11, 0x6e, 0xfc, 0x89, 0x00, 0x8e, 0x68, 0x40, 0xe8, 0xcf, 0x21, - 0xf5, 0x03, 0x5c, 0x81, 0xf9, 0x6f, 0xdb, 0x6d, 0x8f, 0xfa, 0x7e, 0x11, 0x6d, 0xa0, 0x72, 0x76, - 0x3b, 0x67, 0xb2, 0x3f, 0x6d, 0x4a, 0xb0, 0x96, 0xb9, 0x7b, 0x58, 0x4f, 0x91, 0x28, 0x06, 0xe7, - 0x41, 0x21, 0xd6, 0x4d, 0x31, 0xbd, 0x81, 0xca, 0x0b, 0x84, 0x1d, 0xf1, 0x1e, 0x64, 0xbe, 0xa3, - 0x81, 0x55, 0x6c, 0xf1, 0x6c, 0xdd, 0x8c, 0x98, 0x90, 0x0d, 0x98, 0xaf, 0x49, 0xad, 0x36, 0xf5, - 0x6a, 0x0b, 0xac, 0xd4, 0xfd, 0xc3, 0x3a, 0x22, 0x3c, 0x03, 0x37, 0x40, 0xbd, 0xe0, 0x83, 0x14, - 0x6d, 0x9e, 0x6b, 0x4c, 0xe7, 0x72, 0x6f, 0xdf, 0xb6, 0x82, 0xbe, 0xeb, 0x3c, 0xaa, 0x21, 0x73, - 0x8d, 0x73, 0xc8, 0xf2, 0x71, 0xfc, 0xa1, 0xeb, 0xf8, 0x14, 0x97, 0x41, 0x92, 0x2f, 0xc7, 0x59, - 0x32, 0x85, 0x69, 0x9e, 0xf0, 0x9f, 0x66, 0x8a, 0x48, 0x3f, 0x5e, 0x85, 0xb9, 0x7a, 0x2f, 0x74, - 0x2e, 0xf9, 0x30, 0x5a, 0x33, 0x45, 0x84, 0x59, 0x53, 0x00, 0x11, 0xe3, 0x8f, 0x34, 0xc0, 0x69, - 0x38, 0x66, 0x69, 0x07, 0x54, 0xf1, 0x07, 0x64, 0xd5, 0xb5, 0xa8, 0x6a, 0x1c, 0xc3, 0x8e, 0x22, - 0x86, 0xf5, 0x10, 0xa7, 0xa7, 0x7a, 0xcc, 0x9a, 0x34, 0xfd, 0x07, 0x58, 0x1c, 0xff, 0x5d, 0xfc, - 0x39, 0xa8, 0x27, 0xcf, 0x50, 0x46, 0xa4, 0x17, 0x6f, 0xc2, 0xdc, 0xb9, 0x7b, 0x49, 0x1d, 0x3e, - 0x0c, 0x0b, 0x93, 0xba, 0x35, 0x39, 0x4a, 0x84, 0x53, 0xd0, 0xb7, 0x0f, 0x59, 0xce, 0x8c, 0x7c, - 0x28, 0xef, 0x27, 0x32, 0xe3, 0xd7, 0x34, 0xe4, 0x1a, 0x74, 0x40, 0x03, 0xfa, 0x42, 0x95, 0x7e, - 0x09, 0xf3, 0x27, 0x37, 0x0e, 0xf5, 0x8e, 0x1b, 0x82, 0xf8, 0xda, 0x32, 0xf3, 0xff, 0xfd, 0xb0, - 0x1e, 0xc1, 0x24, 0x3a, 0xc4, 0x43, 0x29, 0xcf, 0x0c, 0x35, 0x73, 0x91, 0xe7, 0x61, 0x29, 0x22, - 0x44, 0x50, 0x6a, 0xbc, 0x42, 0x90, 0x65, 0xe1, 0x11, 0x43, 0x7b, 0x6f, 0x61, 0x68, 0xcc, 0x80, - 0x04, 0x62, 0xb2, 0x36, 0x20, 0x7b, 0x18, 0x0e, 0x06, 0xa2, 0xb7, 0x2f, 0x57, 0x3b, 0x09, 0x45, - 0x4b, 0xaf, 0x7c, 0x3c, 0x4b, 0xbf, 0x03, 0x9a, 0x18, 0x5e, 0x0a, 0xec, 0x1d, 0x25, 0x6c, 0xfc, - 0x8f, 0x20, 0x77, 0x46, 0x2d, 0xcf, 0xee, 0xc5, 0xca, 0xca, 0xd6, 0x5d, 0x27, 0xb0, 0xfa, 0x42, - 0x2e, 0x88, 0xcb, 0x25, 0x2b, 0xc9, 0x52, 0xea, 0xc7, 0x0d, 0x92, 0xf4, 0xe3, 0x02, 0xcc, 0x7d, - 0x1f, 0x52, 0xef, 0x56, 0xe8, 0x8a, 0x08, 0x03, 0x1b, 0xa0, 0xf1, 0xc3, 0x05, 0xf5, 0x98, 0x76, - 0x38, 0x53, 0x39, 0x32, 0x81, 0xcd, 0x9c, 0xb2, 0x3a, 0x2c, 0x45, 0x93, 0x4b, 0xd2, 0xbe, 0x86, - 0x45, 0xa9, 0x01, 0xca, 0x44, 0xa3, 0x3c, 0xb5, 0x56, 0x71, 0x94, 0xf1, 0x1f, 0x82, 0x65, 0x76, - 0xdb, 0x5a, 0x4e, 0xf7, 0xa5, 0xbb, 0xf9, 0x15, 0xa8, 0x3c, 0x9d, 0x29, 0x4d, 0xb4, 0x94, 0x8f, - 0x8a, 0xa3, 0x32, 0x5a, 0x86, 0xcc, 0x9c, 0xb4, 0x2d, 0xc8, 0xc7, 0xe3, 0x4a, 0xda, 0xd6, 0x60, - 0xf1, 0xd0, 0xb3, 0xba, 0x57, 0xd4, 0x09, 0x04, 0x6d, 0x1a, 0x89, 0x01, 0xe3, 0x97, 0x34, 0xac, - 0x44, 0x29, 0x4d, 0xcb, 0xef, 0x7d, 0x08, 0x96, 0x30, 0x64, 0xce, 0xac, 0x41, 0xc0, 0x65, 0xa7, - 0x11, 0x7e, 0x9e, 0x39, 0x73, 0xfb, 0x50, 0x98, 0xa4, 0x41, 0xb2, 0xb7, 0x09, 0x2a, 0xb3, 0xa5, - 0xe2, 0xb4, 0x9a, 0x26, 0x57, 0x2d, 0xc3, 0xa3, 0xa4, 0x6f, 0xfb, 0x77, 0x05, 0xe6, 0xcf, 0x44, - 0x57, 0xbc, 0x05, 0xca, 0x11, 0x0d, 0x30, 0x8e, 0x18, 0x88, 0x3f, 0x5e, 0xf4, 0x95, 0x09, 0x4c, - 0x74, 0xd8, 0x42, 0x2c, 0xe3, 0x34, 0x4c, 0x64, 0xc4, 0x2f, 0xe9, 0x38, 0x23, 0xf1, 0x7a, 0x2a, - 0x23, 0xbc, 0x0b, 0xaa, 0xb8, 0x5f, 0xf1, 0x27, 0x51, 0xc0, 0xc4, 0x0b, 0x48, 0x5f, 0x9d, 0x86, - 0xc7, 0x3b, 0x94, 0x61, 0x14, 0xe0, 0x71, 0xdd, 0xc4, 0x9d, 0xac, 0x17, 0x26, 0x41, 0x99, 0xb2, - 0x0b, 0xaa, 0x58, 0xc4, 0xb8, 0xd7, 0xc4, 0x95, 0x14, 0xf7, 0x9a, 0xda, 0xd7, 0x03, 0x58, 0x88, - 0x28, 0xc5, 0x9f, 0x26, 0x27, 0x4f, 0x6c, 0xa3, 0x5e, 0x7c, 0xec, 0x90, 0xe9, 0xc7, 0xa0, 0x25, - 0x9f, 0x08, 0xfe, 0x6c, 0x3a, 0x32, 0x21, 0x57, 0x7d, 0xed, 0xcd, 0x4e, 0x51, 0xaa, 0x76, 0x70, - 0x37, 0x2a, 0xa1, 0xfb, 0x51, 0x09, 0xfd, 0x35, 0x2a, 0xa1, 0x7f, 0x46, 0x25, 0xf4, 0xdb, 0xbf, - 0xa5, 0xd4, 0x8f, 0x5f, 0x24, 0x3e, 0x44, 0x1d, 0x7f, 0x68, 0xdb, 0x95, 0x36, 0xbd, 0xae, 0x3a, - 0xd4, 0xed, 0xf8, 0x15, 0xf1, 0x19, 0x2a, 0x6a, 0xb6, 0x54, 0x6e, 0x7d, 0xf3, 0x3a, 0x00, 0x00, - 0xff, 0xff, 0xbe, 0x82, 0x72, 0x84, 0x3d, 0x0b, 0x00, 0x00, + // 843 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x56, 0x4d, 0x4f, 0x33, 0x55, + 0x14, 0xee, 0xed, 0x94, 0x01, 0x4e, 0xa7, 0xd0, 0x5c, 0x2a, 0x36, 0x23, 0x29, 0x64, 0x82, 0xa6, + 0xc6, 0x74, 0x8a, 0x98, 0x00, 0x89, 0xb8, 0xb0, 0x6d, 0xa0, 0x2c, 0x0c, 0x78, 0x21, 0x24, 0xba, + 0x9b, 0x4e, 0x6f, 0xdb, 0x91, 0x32, 0x53, 0xe7, 0x03, 0xc2, 0x0f, 0x70, 0xed, 0xd6, 0x85, 0x3f, + 0xc5, 0x1f, 0xc0, 0xc6, 0x84, 0xa5, 0x71, 0x41, 0x4c, 0x5d, 0xbb, 0x37, 0x71, 0x63, 0xee, 0xc7, + 0x74, 0xa6, 0x45, 0x50, 0x59, 0xbc, 0x7d, 0x57, 0x3d, 0xf7, 0x39, 0x5f, 0x3d, 0xcf, 0x3c, 0xe7, + 0xce, 0x40, 0xc9, 0xeb, 0x7c, 0x43, 0xed, 0xb0, 0x1e, 0x50, 0xff, 0xc6, 0xb1, 0xa9, 0x39, 0xf2, + 0xbd, 0xd0, 0xc3, 0xaa, 0x40, 0xf5, 0xa2, 0x4f, 0x7b, 0x41, 0x3d, 0xbc, 0x1b, 0xd1, 0x40, 0x78, + 0x74, 0x2c, 0xe3, 0xd3, 0xd8, 0x5a, 0x40, 0x83, 0xc0, 0xf1, 0xdc, 0xe9, 0x40, 0x59, 0xb1, 0x7e, + 0x4d, 0x43, 0x4b, 0x62, 0xa5, 0x18, 0xbb, 0xa1, 0xbe, 0xd3, 0xbb, 0x93, 0x68, 0xad, 0xef, 0x84, + 0x83, 0xa8, 0x63, 0xda, 0xde, 0x75, 0xbd, 0xef, 0xf5, 0xbd, 0x3a, 0x87, 0x3b, 0x51, 0x8f, 0x9f, + 0xf8, 0x81, 0x5b, 0x22, 0xdc, 0xf8, 0x19, 0x01, 0x1c, 0xd3, 0x90, 0xd0, 0x6f, 0x23, 0x1a, 0x84, + 0xb8, 0x06, 0x8b, 0x9f, 0x77, 0xbb, 0x3e, 0x0d, 0x82, 0x32, 0xda, 0x42, 0xd5, 0xfc, 0x6e, 0xc1, + 0x64, 0x7f, 0xda, 0x94, 0x60, 0x23, 0x77, 0xff, 0xb8, 0x99, 0x21, 0x71, 0x0c, 0x2e, 0x82, 0x42, + 0xac, 0xdb, 0x72, 0x76, 0x0b, 0x55, 0x97, 0x08, 0x33, 0xf1, 0x01, 0xe4, 0xbe, 0xa0, 0xa1, 0x55, + 0xee, 0xf0, 0x6c, 0xdd, 0x8c, 0x99, 0x90, 0x0d, 0x98, 0xaf, 0x4d, 0xad, 0x2e, 0xf5, 0x1b, 0x4b, + 0xac, 0xd4, 0xc3, 0xe3, 0x26, 0x22, 0x3c, 0x03, 0xb7, 0x40, 0xbd, 0xe4, 0x83, 0x94, 0x6d, 0x9e, + 0x6b, 0xcc, 0xe6, 0x72, 0xaf, 0x63, 0x5b, 0xa1, 0xe3, 0xb9, 0x4f, 0x6a, 0xc8, 0x5c, 0xe3, 0x02, + 0xf2, 0x7c, 0x9c, 0x60, 0xe4, 0xb9, 0x01, 0xc5, 0x55, 0x90, 0xe4, 0xcb, 0x71, 0x56, 0x4c, 0x71, + 0x34, 0x4f, 0xf9, 0x4f, 0x3b, 0x43, 0xa4, 0x1f, 0xaf, 0xc3, 0x42, 0x73, 0x10, 0xb9, 0x57, 0x7c, + 0x18, 0xad, 0x9d, 0x21, 0xe2, 0xd8, 0x50, 0x00, 0x11, 0xe3, 0xa7, 0x2c, 0xc0, 0x59, 0x34, 0x61, + 0x69, 0x0f, 0x54, 0xf1, 0x07, 0x64, 0xd5, 0x8d, 0xb8, 0x6a, 0x12, 0xc3, 0x4c, 0x11, 0xc3, 0x7a, + 0x08, 0xeb, 0xb9, 0x1e, 0xf3, 0x26, 0x4d, 0xff, 0x0a, 0x96, 0x27, 0x7f, 0x17, 0x7f, 0x00, 0xea, + 0xe9, 0x0b, 0x94, 0x11, 0xe9, 0xc5, 0xdb, 0xb0, 0x70, 0xe1, 0x5d, 0x51, 0x97, 0x0f, 0xc3, 0xc2, + 0xa4, 0x6e, 0x4d, 0x8e, 0x12, 0xe1, 0x14, 0xf4, 0x1d, 0x42, 0x9e, 0x33, 0x23, 0x1f, 0xca, 0xff, + 0x13, 0x99, 0xf1, 0x7d, 0x16, 0x0a, 0x2d, 0x3a, 0xa4, 0x21, 0x7d, 0xa5, 0x4a, 0x3f, 0x84, 0xc5, + 0xd3, 0x5b, 0x97, 0xfa, 0x27, 0x2d, 0x41, 0x7c, 0x63, 0x95, 0xf9, 0x7f, 0x7d, 0xdc, 0x8c, 0x61, + 0x12, 0x1b, 0xc9, 0x50, 0xca, 0x0b, 0x43, 0xcd, 0x5d, 0xe4, 0x45, 0x58, 0x89, 0x09, 0x11, 0x94, + 0x1a, 0x7f, 0x21, 0xc8, 0xb3, 0xf0, 0x98, 0xa1, 0x83, 0x7f, 0x61, 0x68, 0xc2, 0x80, 0x04, 0x12, + 0xb2, 0xb6, 0x20, 0x7f, 0x14, 0x0d, 0x87, 0xa2, 0x77, 0x20, 0x57, 0x3b, 0x0d, 0xc5, 0x4b, 0xaf, + 0xbc, 0x3d, 0x4b, 0xbf, 0x07, 0x9a, 0x18, 0x5e, 0x0a, 0xec, 0x3f, 0x4a, 0xd8, 0xf8, 0x13, 0x41, + 0xe1, 0x9c, 0x5a, 0xbe, 0x3d, 0x48, 0x94, 0x95, 0x6f, 0x7a, 0x6e, 0x68, 0x39, 0x42, 0x2e, 0x88, + 0xcb, 0x25, 0x2f, 0xc9, 0x52, 0x9a, 0x27, 0x2d, 0x92, 0xf6, 0xe3, 0x12, 0x2c, 0x7c, 0x19, 0x51, + 0xff, 0x4e, 0xe8, 0x8a, 0x88, 0x03, 0x36, 0x40, 0xe3, 0xc6, 0x25, 0xf5, 0x99, 0x76, 0x38, 0x53, + 0x05, 0x32, 0x85, 0xcd, 0x9d, 0xb2, 0x26, 0xac, 0xc4, 0x93, 0x4b, 0xd2, 0x3e, 0x86, 0x65, 0xa9, + 0x01, 0xca, 0x44, 0xa3, 0x3c, 0xb7, 0x56, 0x49, 0x94, 0xf1, 0x07, 0x82, 0x55, 0x76, 0xdb, 0x5a, + 0x6e, 0xff, 0xb5, 0xbb, 0xf9, 0x11, 0xa8, 0x3c, 0x9d, 0x29, 0x4d, 0xb4, 0x94, 0x8f, 0x8a, 0xa3, + 0x32, 0x5a, 0x86, 0xcc, 0x9d, 0xb4, 0x1d, 0x28, 0x26, 0xe3, 0x4a, 0xda, 0x36, 0x60, 0xf9, 0xc8, + 0xb7, 0xfa, 0xd7, 0xd4, 0x0d, 0x05, 0x6d, 0x1a, 0x49, 0x00, 0xe3, 0xbb, 0x2c, 0xac, 0xc5, 0x29, + 0x6d, 0x2b, 0x18, 0xbc, 0x09, 0x96, 0x30, 0xe4, 0xce, 0xad, 0x61, 0xc8, 0x65, 0xa7, 0x11, 0x6e, + 0xcf, 0x9d, 0xb9, 0x43, 0x28, 0x4d, 0xd3, 0x20, 0xd9, 0xdb, 0x06, 0x95, 0x9d, 0xa5, 0xe2, 0xb4, + 0x86, 0x26, 0x57, 0x2d, 0xc7, 0xa3, 0xa4, 0x6f, 0xf7, 0x47, 0x05, 0x16, 0xcf, 0x45, 0x57, 0xbc, + 0x03, 0xca, 0x31, 0x0d, 0x31, 0x8e, 0x19, 0x48, 0x3e, 0x5e, 0xf4, 0xb5, 0x29, 0x4c, 0x74, 0xd8, + 0x41, 0x2c, 0xe3, 0x2c, 0x4a, 0x65, 0x24, 0x2f, 0xe9, 0x24, 0x23, 0xf5, 0x7a, 0xaa, 0x22, 0xbc, + 0x0f, 0xaa, 0xb8, 0x5f, 0xf1, 0x3b, 0x71, 0xc0, 0xd4, 0x0b, 0x48, 0x5f, 0x9f, 0x85, 0x27, 0x3b, + 0x94, 0x63, 0x14, 0xe0, 0x49, 0xdd, 0xd4, 0x9d, 0xac, 0x97, 0xa6, 0x41, 0x99, 0xb2, 0x0f, 0xaa, + 0x58, 0xc4, 0xa4, 0xd7, 0xd4, 0x95, 0x94, 0xf4, 0x9a, 0xd9, 0xd7, 0xcf, 0x60, 0x29, 0xa6, 0x14, + 0xbf, 0x9b, 0x9e, 0x3c, 0xb5, 0x8d, 0x7a, 0xf9, 0xa9, 0x43, 0xa6, 0x9f, 0x80, 0x96, 0x7e, 0x22, + 0xf8, 0xbd, 0xd9, 0xc8, 0x94, 0x5c, 0xf5, 0x8d, 0x7f, 0x76, 0x8a, 0x52, 0x8d, 0x4f, 0xef, 0xc7, + 0x15, 0xf4, 0x30, 0xae, 0xa0, 0x5f, 0xc6, 0x15, 0xf4, 0xdb, 0xb8, 0x82, 0x7e, 0xf8, 0xbd, 0x92, + 0xf9, 0xfa, 0xfd, 0xd4, 0x87, 0xa8, 0x1b, 0x8c, 0x6c, 0xbb, 0xd6, 0xa5, 0x37, 0x75, 0x97, 0x7a, + 0xbd, 0xa0, 0x66, 0x8d, 0x9c, 0xba, 0xa8, 0xd8, 0x51, 0xf9, 0x77, 0xe8, 0x27, 0x7f, 0x07, 0x00, + 0x00, 0xff, 0xff, 0xfc, 0xc2, 0x63, 0xdb, 0x3b, 0x0b, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/object/service.proto b/object/service.proto index 91c0cbd..12f9741 100644 --- a/object/service.proto +++ b/object/service.proto @@ -1,6 +1,6 @@ syntax = "proto3"; package object; -option go_package = "github.com/nspcc-dev/neofs-proto/object"; +option go_package = "github.com/nspcc-dev/neofs-api/object"; import "refs/types.proto"; import "object/types.proto"; diff --git a/object/sg.go b/object/sg.go index 620d24d..a51123b 100644 --- a/object/sg.go +++ b/object/sg.go @@ -3,8 +3,8 @@ package object import ( "sort" - "github.com/nspcc-dev/neofs-proto/refs" - "github.com/nspcc-dev/neofs-proto/storagegroup" + "github.com/nspcc-dev/neofs-api/refs" + "github.com/nspcc-dev/neofs-api/storagegroup" ) // Here are defined getter functions for objects that contain storage group diff --git a/object/sg_test.go b/object/sg_test.go index 15cc21b..ed657b7 100644 --- a/object/sg_test.go +++ b/object/sg_test.go @@ -5,8 +5,8 @@ import ( "sort" "testing" - "github.com/nspcc-dev/neofs-proto/hash" - "github.com/nspcc-dev/neofs-proto/storagegroup" + "github.com/nspcc-dev/neofs-api/hash" + "github.com/nspcc-dev/neofs-api/storagegroup" "github.com/stretchr/testify/require" ) diff --git a/object/types.go b/object/types.go index 79cef65..e5735a5 100644 --- a/object/types.go +++ b/object/types.go @@ -5,9 +5,9 @@ import ( "context" "github.com/gogo/protobuf/proto" - "github.com/nspcc-dev/neofs-proto/internal" - "github.com/nspcc-dev/neofs-proto/refs" - "github.com/nspcc-dev/neofs-proto/session" + "github.com/nspcc-dev/neofs-api/internal" + "github.com/nspcc-dev/neofs-api/refs" + "github.com/nspcc-dev/neofs-api/session" ) type ( diff --git a/object/types.pb.go b/object/types.pb.go index 525b39b..2be08c9 100644 --- a/object/types.pb.go +++ b/object/types.pb.go @@ -7,9 +7,9 @@ import ( fmt "fmt" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/golang/protobuf/proto" - refs "github.com/nspcc-dev/neofs-proto/refs" - session "github.com/nspcc-dev/neofs-proto/session" - storagegroup "github.com/nspcc-dev/neofs-proto/storagegroup" + refs "github.com/nspcc-dev/neofs-api/refs" + session "github.com/nspcc-dev/neofs-api/session" + storagegroup "github.com/nspcc-dev/neofs-api/storagegroup" io "io" math "math" math_bits "math/bits" @@ -826,63 +826,63 @@ func init() { func init() { proto.RegisterFile("object/types.proto", fileDescriptor_02021a1d39b1aee0) } var fileDescriptor_02021a1d39b1aee0 = []byte{ - // 892 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x55, 0xcb, 0x72, 0x1b, 0x45, - 0x14, 0xd5, 0x48, 0xa3, 0xd7, 0xd5, 0x38, 0x9e, 0x34, 0x21, 0x4c, 0x89, 0x42, 0x36, 0x53, 0x3c, - 0x4c, 0xc0, 0xe3, 0xc2, 0x81, 0x4a, 0xb1, 0x80, 0xc2, 0xb2, 0x28, 0xa4, 0x22, 0x60, 0x55, 0xfb, - 0xb1, 0x60, 0x37, 0x92, 0x5a, 0xa3, 0xc6, 0x52, 0xb7, 0xaa, 0xbb, 0x27, 0x89, 0x7e, 0x83, 0x15, - 0x3b, 0x3e, 0x83, 0x5f, 0xc8, 0x92, 0x25, 0x95, 0x85, 0x8b, 0x32, 0x1f, 0xc0, 0x2f, 0xa4, 0xba, - 0xe7, 0xa1, 0x19, 0x27, 0x1b, 0x55, 0x9f, 0x7b, 0xce, 0x69, 0xdd, 0xb9, 0x7d, 0x7a, 0x06, 0x10, - 0x9f, 0xfc, 0x46, 0xa6, 0xea, 0x48, 0x6d, 0xd6, 0x44, 0x06, 0x6b, 0xc1, 0x15, 0x47, 0x8d, 0xa4, - 0xd6, 0x75, 0x05, 0x99, 0xcb, 0x22, 0xd3, 0x7d, 0x47, 0x12, 0x29, 0x29, 0x67, 0xa5, 0xa2, 0x27, - 0x15, 0x17, 0x61, 0x44, 0x22, 0xc1, 0xe3, 0x75, 0x89, 0x39, 0x8c, 0xa8, 0x5a, 0xc4, 0x93, 0x60, - 0xca, 0x57, 0x47, 0x11, 0x8f, 0xf8, 0x91, 0x29, 0x4f, 0xe2, 0xb9, 0x41, 0x06, 0x98, 0x55, 0x22, - 0xf7, 0x9f, 0x40, 0x1d, 0x87, 0x2c, 0x22, 0xe8, 0x21, 0x34, 0xce, 0xe6, 0x73, 0x49, 0x94, 0x67, - 0xed, 0x5b, 0x07, 0x36, 0x4e, 0x91, 0xae, 0x3f, 0x25, 0x2c, 0x52, 0x0b, 0xaf, 0x9a, 0xd4, 0x13, - 0xe4, 0x7f, 0x05, 0x70, 0x29, 0x89, 0x18, 0x92, 0x70, 0x46, 0x04, 0x72, 0xa1, 0xf6, 0x13, 0xd9, - 0x18, 0x6b, 0x1b, 0xeb, 0x25, 0x7a, 0x00, 0xf5, 0xab, 0x70, 0x19, 0x13, 0x63, 0x6b, 0xe3, 0x04, - 0xf8, 0x7f, 0xd9, 0xd0, 0x48, 0x2d, 0x3e, 0xd8, 0x4f, 0x29, 0xbb, 0x36, 0x9e, 0xce, 0xb1, 0x13, - 0x24, 0x03, 0x08, 0x74, 0x6d, 0x58, 0xc1, 0x86, 0x43, 0x9f, 0x43, 0x0b, 0x93, 0x19, 0x15, 0x64, - 0xaa, 0xcc, 0x3e, 0x9d, 0xe3, 0x9d, 0x40, 0x0f, 0x28, 0x38, 0x99, 0xcd, 0x04, 0x91, 0x72, 0x58, - 0xc1, 0xb9, 0x00, 0x95, 0x3a, 0xf2, 0x6a, 0x46, 0x8e, 0xb2, 0x6d, 0xb7, 0xcc, 0xb0, 0x82, 0x8b, - 0x9d, 0x7f, 0x09, 0xed, 0x0b, 0x11, 0x32, 0x39, 0xe7, 0x62, 0xe5, 0xd9, 0xc6, 0x74, 0x3f, 0x33, - 0xe5, 0xc4, 0xb0, 0x82, 0xb7, 0x2a, 0x63, 0xe1, 0xab, 0x89, 0x54, 0x9c, 0x11, 0xaf, 0x7e, 0xc7, - 0x92, 0x11, 0xc6, 0x92, 0x01, 0xf4, 0x35, 0x34, 0xae, 0x88, 0xa0, 0xf3, 0x8d, 0xd7, 0x30, 0xfa, - 0xf7, 0x83, 0xf4, 0x54, 0x03, 0x53, 0xa6, 0xd3, 0x50, 0x51, 0xce, 0xf2, 0x06, 0x53, 0x31, 0xfa, - 0x04, 0x5a, 0x43, 0xbe, 0xe2, 0xc3, 0x50, 0x2e, 0xbc, 0xe6, 0xbe, 0x75, 0xe0, 0xf4, 0x5b, 0xaf, - 0x6e, 0xf6, 0x6c, 0x8d, 0xf5, 0xa3, 0x67, 0x1c, 0x7a, 0x04, 0xbb, 0xe3, 0x70, 0xb3, 0xe4, 0xe1, - 0xec, 0x74, 0x41, 0xa6, 0xd7, 0x32, 0x5e, 0x79, 0x2d, 0x2d, 0x1f, 0x56, 0xf0, 0x5d, 0x02, 0x3d, - 0x81, 0xf6, 0x88, 0x29, 0x12, 0x09, 0xaa, 0x36, 0x5e, 0xdb, 0x74, 0xf3, 0x5e, 0xd6, 0x7d, 0x4e, - 0xe4, 0x9d, 0x6c, 0xb5, 0xe8, 0x7b, 0x70, 0xce, 0x93, 0xd4, 0xfd, 0xa8, 0x53, 0xe7, 0x81, 0xf1, - 0x76, 0x83, 0x62, 0x14, 0x83, 0xa2, 0x62, 0x58, 0xc1, 0x25, 0x87, 0x1e, 0xdc, 0x38, 0x9e, 0x2c, - 0xe9, 0x54, 0x67, 0xa5, 0x53, 0x1e, 0x5c, 0x4e, 0xe8, 0x3f, 0xcd, 0x41, 0xbf, 0x99, 0xc6, 0xc8, - 0xef, 0x14, 0x86, 0xee, 0xff, 0x6f, 0x81, 0x73, 0xbe, 0x91, 0x8a, 0xac, 0xd2, 0x53, 0xf4, 0xa0, - 0x79, 0x45, 0x84, 0x1e, 0x68, 0x1a, 0xdf, 0x0c, 0xa2, 0x8f, 0x60, 0x27, 0x9d, 0x40, 0x29, 0xc6, - 0xe5, 0x22, 0xea, 0x42, 0x75, 0x34, 0x30, 0x99, 0x71, 0xfa, 0xf0, 0xf2, 0x66, 0xaf, 0xf2, 0xea, - 0x66, 0xaf, 0x3a, 0x1a, 0xe0, 0xea, 0x68, 0x80, 0x3e, 0x83, 0xe6, 0xd9, 0x73, 0x46, 0xc4, 0x68, - 0x60, 0xf2, 0xe1, 0xf4, 0x77, 0x53, 0x41, 0x56, 0xc6, 0xd9, 0x02, 0x7d, 0x00, 0xb5, 0xd3, 0xd1, - 0xc0, 0x64, 0xc2, 0xe9, 0x77, 0x52, 0x99, 0x2e, 0x61, 0xfd, 0x83, 0xbe, 0x81, 0xf6, 0xa9, 0x20, - 0xa1, 0x22, 0xb3, 0x13, 0x95, 0x06, 0xe1, 0xdd, 0xec, 0xf9, 0x0d, 0x41, 0x39, 0x1b, 0x73, 0xca, - 0x54, 0xdf, 0xd6, 0x5e, 0xbc, 0x55, 0xfb, 0x27, 0xb0, 0x53, 0x52, 0xa0, 0x2e, 0xb4, 0x2e, 0x19, - 0x7d, 0x71, 0x41, 0x57, 0xc4, 0x3c, 0x72, 0x0d, 0xe7, 0x58, 0xdf, 0xbd, 0x1f, 0xd6, 0x7c, 0x9a, - 0x3d, 0x6b, 0x02, 0x7c, 0x0a, 0xbb, 0x77, 0xce, 0x17, 0x1d, 0xc0, 0x6e, 0xb2, 0x92, 0x79, 0x6e, - 0xf4, 0x5e, 0x0e, 0xbe, 0x5b, 0x46, 0x5f, 0xc0, 0xfd, 0x6c, 0x7d, 0x4e, 0x23, 0x16, 0xaa, 0x58, - 0x24, 0x57, 0xdb, 0xc1, 0x6f, 0x12, 0xfe, 0x9f, 0x56, 0x72, 0xb9, 0xd1, 0xc7, 0x60, 0xeb, 0x97, - 0x93, 0xd9, 0xf5, 0xde, 0xf6, 0xb0, 0x35, 0x17, 0x5c, 0x6c, 0xd6, 0x04, 0x1b, 0x3a, 0x1d, 0x7f, - 0xf5, 0x6d, 0xe3, 0xf7, 0x2f, 0xc0, 0xd6, 0x4a, 0xd4, 0x81, 0xe6, 0x25, 0xbb, 0x66, 0xfc, 0x39, - 0x73, 0x2b, 0x08, 0xa0, 0x31, 0x0e, 0x05, 0x61, 0xca, 0xb5, 0x90, 0x03, 0xad, 0xb1, 0x20, 0xcf, - 0x28, 0x8f, 0xa5, 0x5b, 0x45, 0x2d, 0xb0, 0x7f, 0x21, 0x2f, 0x94, 0x5b, 0x43, 0x6d, 0xa8, 0x9f, - 0x2e, 0xe8, 0x72, 0xe6, 0xda, 0xc8, 0x2d, 0x47, 0xd7, 0xad, 0xfb, 0xcb, 0xc2, 0xb5, 0x47, 0x8f, - 0x4a, 0x5d, 0x3e, 0x7c, 0xe3, 0xfa, 0x17, 0x5a, 0xf5, 0x1f, 0xbf, 0xad, 0x9d, 0x36, 0xd4, 0xcf, - 0xd7, 0x4b, 0xaa, 0xbb, 0x69, 0x81, 0xad, 0xe7, 0xe0, 0x56, 0x75, 0xf1, 0x67, 0x1e, 0x2f, 0x67, - 0x6e, 0xcd, 0xff, 0xdd, 0x82, 0xc6, 0x99, 0xd9, 0x14, 0x7d, 0x57, 0x4e, 0x6e, 0xfa, 0xfa, 0x7b, - 0x90, 0xfd, 0x67, 0x91, 0x4b, 0x53, 0x50, 0x4e, 0x7a, 0x00, 0xcd, 0xf4, 0x6c, 0xbc, 0xea, 0x7e, - 0xed, 0xa0, 0x73, 0x7c, 0x2f, 0xb3, 0x96, 0x4c, 0x99, 0x48, 0xdf, 0x8c, 0x34, 0xea, 0x49, 0xbc, - 0x71, 0x06, 0xfd, 0x0f, 0x0b, 0xb7, 0x71, 0xfb, 0xba, 0x4e, 0xce, 0x3f, 0x01, 0xfd, 0x6f, 0x5f, - 0xde, 0xf6, 0xac, 0xbf, 0x6f, 0x7b, 0xd6, 0x3f, 0xb7, 0x3d, 0xeb, 0xdf, 0xdb, 0x9e, 0xf5, 0xc7, - 0x7f, 0xbd, 0xca, 0xaf, 0x9f, 0x16, 0x3e, 0x31, 0x4c, 0xae, 0xa7, 0xd3, 0xc3, 0x19, 0x79, 0x76, - 0xc4, 0x08, 0x9f, 0xcb, 0xc3, 0xe4, 0x03, 0x93, 0x74, 0x34, 0x69, 0x18, 0xf4, 0xf8, 0x75, 0x00, - 0x00, 0x00, 0xff, 0xff, 0x95, 0x5d, 0xc3, 0x1e, 0xf1, 0x06, 0x00, 0x00, + // 893 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x55, 0xdd, 0x6e, 0x1b, 0x45, + 0x14, 0xf6, 0xda, 0xeb, 0xbf, 0xe3, 0x4d, 0xb3, 0x1d, 0x4a, 0x59, 0x05, 0xe1, 0x84, 0x15, 0x45, + 0xa1, 0x90, 0xb5, 0x48, 0x41, 0x15, 0x42, 0x42, 0xc4, 0x31, 0xc2, 0x16, 0x85, 0x58, 0x93, 0x9f, + 0x0b, 0xee, 0xd6, 0xf6, 0x78, 0x3d, 0xc4, 0x9e, 0xb1, 0x66, 0x66, 0xdb, 0xfa, 0x35, 0xb8, 0xe2, + 0x8e, 0xc7, 0xe0, 0x15, 0x7a, 0xc9, 0x25, 0xea, 0x45, 0x84, 0xc2, 0x03, 0xf0, 0x0a, 0xd5, 0xcc, + 0xfe, 0x78, 0x37, 0xed, 0x8d, 0x35, 0xe7, 0x7c, 0xdf, 0x37, 0x3e, 0x73, 0xe6, 0x3b, 0xb3, 0x80, + 0xf8, 0xe4, 0x37, 0x32, 0x55, 0x3d, 0xb5, 0x59, 0x13, 0x19, 0xac, 0x05, 0x57, 0x1c, 0x35, 0x92, + 0xdc, 0x9e, 0x2b, 0xc8, 0x5c, 0x16, 0x91, 0xbd, 0xf7, 0x24, 0x91, 0x92, 0x72, 0x56, 0x4a, 0x7a, + 0x52, 0x71, 0x11, 0x46, 0x24, 0x12, 0x3c, 0x5e, 0x97, 0x90, 0xa3, 0x88, 0xaa, 0x45, 0x3c, 0x09, + 0xa6, 0x7c, 0xd5, 0x8b, 0x78, 0xc4, 0x7b, 0x26, 0x3d, 0x89, 0xe7, 0x26, 0x32, 0x81, 0x59, 0x25, + 0x74, 0xff, 0x29, 0xd4, 0x71, 0xc8, 0x22, 0x82, 0x1e, 0x42, 0xe3, 0x6c, 0x3e, 0x97, 0x44, 0x79, + 0xd6, 0x81, 0x75, 0x68, 0xe3, 0x34, 0xd2, 0xf9, 0x67, 0x84, 0x45, 0x6a, 0xe1, 0x55, 0x93, 0x7c, + 0x12, 0xf9, 0x5f, 0x01, 0x5c, 0x4a, 0x22, 0x86, 0x24, 0x9c, 0x11, 0x81, 0x5c, 0xa8, 0xfd, 0x44, + 0x36, 0x46, 0xda, 0xc6, 0x7a, 0x89, 0x1e, 0x40, 0xfd, 0x2a, 0x5c, 0xc6, 0xc4, 0xc8, 0xda, 0x38, + 0x09, 0xfc, 0xbf, 0x6c, 0x68, 0xa4, 0x12, 0x1f, 0xec, 0x67, 0x94, 0x5d, 0x1b, 0x4d, 0xe7, 0xd8, + 0x09, 0x92, 0x06, 0x04, 0x3a, 0x37, 0xac, 0x60, 0x83, 0xa1, 0xcf, 0xa1, 0x85, 0xc9, 0x8c, 0x0a, + 0x32, 0x55, 0x66, 0x9f, 0xce, 0xf1, 0x4e, 0xa0, 0x1b, 0x14, 0x9c, 0xcc, 0x66, 0x82, 0x48, 0x39, + 0xac, 0xe0, 0x9c, 0x80, 0x4a, 0x15, 0x79, 0x35, 0x43, 0x47, 0xd9, 0xb6, 0x5b, 0x64, 0x58, 0xc1, + 0xc5, 0xca, 0xbf, 0x84, 0xf6, 0x85, 0x08, 0x99, 0x9c, 0x73, 0xb1, 0xf2, 0x6c, 0x23, 0xba, 0x9f, + 0x89, 0x72, 0x60, 0x58, 0xc1, 0x5b, 0x96, 0x91, 0xf0, 0xd5, 0x44, 0x2a, 0xce, 0x88, 0x57, 0xbf, + 0x23, 0xc9, 0x00, 0x23, 0xc9, 0x02, 0xf4, 0x35, 0x34, 0xae, 0x88, 0xa0, 0xf3, 0x8d, 0xd7, 0x30, + 0xfc, 0x0f, 0x83, 0xf4, 0x56, 0x03, 0x93, 0xa6, 0xd3, 0x50, 0x51, 0xce, 0xf2, 0x02, 0x53, 0x32, + 0xfa, 0x14, 0x5a, 0x43, 0xbe, 0xe2, 0xc3, 0x50, 0x2e, 0xbc, 0xe6, 0x81, 0x75, 0xe8, 0xf4, 0x5b, + 0xaf, 0x6f, 0xf6, 0x6d, 0x1d, 0xeb, 0xa3, 0x67, 0x18, 0x7a, 0x0c, 0xbb, 0xe3, 0x70, 0xb3, 0xe4, + 0xe1, 0xec, 0x74, 0x41, 0xa6, 0xd7, 0x32, 0x5e, 0x79, 0x2d, 0x4d, 0x1f, 0x56, 0xf0, 0x5d, 0x00, + 0x3d, 0x85, 0xf6, 0x88, 0x29, 0x12, 0x09, 0xaa, 0x36, 0x5e, 0xdb, 0x54, 0xf3, 0x41, 0x56, 0x7d, + 0x0e, 0xe4, 0x95, 0x6c, 0xb9, 0xe8, 0x7b, 0x70, 0xce, 0x13, 0xd7, 0xfd, 0xa8, 0x5d, 0xe7, 0x81, + 0xd1, 0xee, 0x05, 0x45, 0x2b, 0x06, 0x45, 0xc6, 0xb0, 0x82, 0x4b, 0x0a, 0xdd, 0xb8, 0x71, 0x3c, + 0x59, 0xd2, 0xa9, 0xf6, 0x4a, 0xa7, 0xdc, 0xb8, 0x1c, 0xd0, 0x7f, 0x9a, 0x07, 0xfd, 0x66, 0x6a, + 0x23, 0xbf, 0x53, 0x68, 0xba, 0xff, 0xbf, 0x05, 0xce, 0xf9, 0x46, 0x2a, 0xb2, 0x4a, 0x6f, 0xd1, + 0x83, 0xe6, 0x15, 0x11, 0xba, 0xa1, 0xa9, 0x7d, 0xb3, 0x10, 0x7d, 0x02, 0x3b, 0x69, 0x07, 0x4a, + 0x36, 0x2e, 0x27, 0xd1, 0x1e, 0x54, 0x47, 0x03, 0xe3, 0x19, 0xa7, 0x0f, 0xaf, 0x6e, 0xf6, 0x2b, + 0xaf, 0x6f, 0xf6, 0xab, 0xa3, 0x01, 0xae, 0x8e, 0x06, 0xe8, 0x33, 0x68, 0x9e, 0xbd, 0x60, 0x44, + 0x8c, 0x06, 0xc6, 0x1f, 0x4e, 0x7f, 0x37, 0x25, 0x64, 0x69, 0x9c, 0x2d, 0xd0, 0x47, 0x50, 0x3b, + 0x1d, 0x0d, 0x8c, 0x27, 0x9c, 0x7e, 0x27, 0xa5, 0xe9, 0x14, 0xd6, 0x3f, 0xe8, 0x1b, 0x68, 0x9f, + 0x0a, 0x12, 0x2a, 0x32, 0x3b, 0x51, 0xa9, 0x11, 0xde, 0xcf, 0xce, 0x6f, 0x00, 0xca, 0xd9, 0x98, + 0x53, 0xa6, 0xfa, 0xb6, 0xd6, 0xe2, 0x2d, 0xdb, 0x3f, 0x81, 0x9d, 0x12, 0x03, 0xed, 0x41, 0xeb, + 0x92, 0xd1, 0x97, 0x17, 0x74, 0x45, 0xcc, 0x91, 0x6b, 0x38, 0x8f, 0xf5, 0xec, 0xfd, 0xb0, 0xe6, + 0xd3, 0xec, 0xac, 0x49, 0xe0, 0x53, 0xd8, 0xbd, 0x73, 0xbf, 0xe8, 0x10, 0x76, 0x93, 0x95, 0xcc, + 0x7d, 0xa3, 0xf7, 0x72, 0xf0, 0xdd, 0x34, 0xfa, 0x02, 0xee, 0x67, 0xeb, 0x73, 0x1a, 0xb1, 0x50, + 0xc5, 0x22, 0x19, 0x6d, 0x07, 0xbf, 0x0d, 0xf8, 0x7f, 0x5a, 0xc9, 0x70, 0xa3, 0x47, 0x60, 0xeb, + 0xc7, 0xc9, 0xec, 0x7a, 0x6f, 0x7b, 0xd9, 0x1a, 0x0b, 0x2e, 0x36, 0x6b, 0x82, 0x0d, 0x9c, 0xb6, + 0xbf, 0xfa, 0xae, 0xf6, 0xfb, 0x17, 0x60, 0x6b, 0x26, 0xea, 0x40, 0xf3, 0x92, 0x5d, 0x33, 0xfe, + 0x82, 0xb9, 0x15, 0x04, 0xd0, 0x18, 0x87, 0x82, 0x30, 0xe5, 0x5a, 0xc8, 0x81, 0xd6, 0x58, 0x90, + 0xe7, 0x94, 0xc7, 0xd2, 0xad, 0xa2, 0x16, 0xd8, 0xbf, 0x90, 0x97, 0xca, 0xad, 0xa1, 0x36, 0xd4, + 0x4f, 0x17, 0x74, 0x39, 0x73, 0x6d, 0xe4, 0x96, 0xad, 0xeb, 0xd6, 0xfd, 0x65, 0x61, 0xec, 0xd1, + 0xe3, 0x52, 0x95, 0x0f, 0xdf, 0x1a, 0xff, 0x42, 0xa9, 0xfe, 0x93, 0x77, 0x95, 0xd3, 0x86, 0xfa, + 0xf9, 0x7a, 0x49, 0x75, 0x35, 0x2d, 0xb0, 0x75, 0x1f, 0xdc, 0xaa, 0x4e, 0xfe, 0xcc, 0xe3, 0xe5, + 0xcc, 0xad, 0xf9, 0xbf, 0x5b, 0xd0, 0x38, 0x33, 0x9b, 0xa2, 0xef, 0xca, 0xce, 0x4d, 0x9f, 0xbf, + 0x07, 0xd9, 0x7f, 0x16, 0xb1, 0xd4, 0x05, 0x65, 0xa7, 0x07, 0xd0, 0x4c, 0xef, 0xc6, 0xab, 0x1e, + 0xd4, 0x0e, 0x3b, 0xc7, 0xf7, 0x32, 0x69, 0x49, 0x94, 0x91, 0xf4, 0x64, 0xa4, 0x56, 0x4f, 0xec, + 0x8d, 0xb3, 0xd0, 0xff, 0xb8, 0x30, 0x8d, 0xdb, 0xe7, 0x3a, 0xb9, 0xff, 0x24, 0xe8, 0x7f, 0xfb, + 0xea, 0xb6, 0x6b, 0xfd, 0x7d, 0xdb, 0xb5, 0xfe, 0xb9, 0xed, 0x5a, 0xff, 0xde, 0x76, 0xad, 0x3f, + 0xfe, 0xeb, 0x56, 0x7e, 0x7d, 0x54, 0xf8, 0xc4, 0x30, 0xb9, 0x9e, 0x4e, 0x8f, 0x66, 0xe4, 0x79, + 0x8f, 0x11, 0x3e, 0x97, 0x47, 0xe1, 0x9a, 0xf6, 0x92, 0x7a, 0x26, 0x0d, 0xf3, 0x85, 0x79, 0xf2, + 0x26, 0x00, 0x00, 0xff, 0xff, 0xf4, 0x71, 0x76, 0x6c, 0xef, 0x06, 0x00, 0x00, } func (m *Range) Marshal() (dAtA []byte, err error) { diff --git a/object/types.proto b/object/types.proto index 293f347..5a0b98e 100644 --- a/object/types.proto +++ b/object/types.proto @@ -1,6 +1,6 @@ syntax = "proto3"; package object; -option go_package = "github.com/nspcc-dev/neofs-proto/object"; +option go_package = "github.com/nspcc-dev/neofs-api/object"; import "refs/types.proto"; import "session/types.proto"; diff --git a/object/utils.go b/object/utils.go index 7e628f1..baaed0f 100644 --- a/object/utils.go +++ b/object/utils.go @@ -4,7 +4,7 @@ import ( "io" "strconv" - "github.com/nspcc-dev/neofs-proto/session" + "github.com/nspcc-dev/neofs-api/session" "github.com/pkg/errors" ) diff --git a/object/verification_test.go b/object/verification_test.go index b538023..053a7de 100644 --- a/object/verification_test.go +++ b/object/verification_test.go @@ -4,11 +4,11 @@ import ( "testing" "github.com/google/uuid" + "github.com/nspcc-dev/neofs-api/container" + "github.com/nspcc-dev/neofs-api/refs" + "github.com/nspcc-dev/neofs-api/session" crypto "github.com/nspcc-dev/neofs-crypto" "github.com/nspcc-dev/neofs-crypto/test" - "github.com/nspcc-dev/neofs-proto/container" - "github.com/nspcc-dev/neofs-proto/refs" - "github.com/nspcc-dev/neofs-proto/session" "github.com/stretchr/testify/require" ) @@ -128,7 +128,6 @@ func TestObject_Verify(t *testing.T) { // re-sign object obj.Sign(sessionkey) - t.Run("incorrect with bad public key", func(t *testing.T) { err = obj.Verify() require.Error(t, err) diff --git a/query/types.pb.go b/query/types.pb.go index 7223bf8..63e9879 100644 --- a/query/types.pb.go +++ b/query/types.pb.go @@ -163,7 +163,7 @@ func init() { func init() { proto.RegisterFile("query/types.proto", fileDescriptor_c682aeaf51d46f4d) } var fileDescriptor_c682aeaf51d46f4d = []byte{ - // 275 bytes of a gzipped FileDescriptorProto + // 278 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x2c, 0x2c, 0x4d, 0x2d, 0xaa, 0xd4, 0x2f, 0xa9, 0x2c, 0x48, 0x2d, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x05, 0x0b, 0x49, 0xe9, 0xa6, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0xa7, 0xe7, @@ -177,11 +177,11 @@ var fileDescriptor_c682aeaf51d46f4d = []byte{ 0x28, 0x35, 0x3d, 0xb5, 0x42, 0x80, 0xd1, 0x8a, 0x65, 0xc6, 0x02, 0x79, 0x06, 0x25, 0x1b, 0x2e, 0xd6, 0x40, 0x90, 0x95, 0x42, 0xba, 0x5c, 0xec, 0x10, 0x5b, 0x8b, 0x25, 0x18, 0x15, 0x98, 0x35, 0xb8, 0x8d, 0x78, 0x51, 0xdc, 0xe2, 0xc4, 0x72, 0xe2, 0x9e, 0x3c, 0x43, 0x10, 0x4c, 0x0d, 0x44, - 0xb7, 0x93, 0xcd, 0x89, 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, 0x31, 0xde, 0x78, 0x24, 0xc7, 0xf8, - 0xe0, 0x91, 0x1c, 0xe3, 0x8c, 0xc7, 0x72, 0x0c, 0x51, 0x6a, 0x48, 0xa1, 0x91, 0x57, 0x5c, 0x90, - 0x9c, 0xac, 0x9b, 0x92, 0x5a, 0xa6, 0x9f, 0x97, 0x9a, 0x9f, 0x56, 0xac, 0x0b, 0x09, 0x0b, 0xb0, - 0xc9, 0x49, 0x6c, 0x60, 0x8e, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0xa6, 0xcd, 0xeb, 0xf6, 0x58, - 0x01, 0x00, 0x00, + 0xb7, 0x93, 0xd5, 0x89, 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, 0x31, 0xde, 0x78, 0x24, 0xc7, 0xf8, + 0xe0, 0x91, 0x1c, 0xe3, 0x8c, 0xc7, 0x72, 0x0c, 0x51, 0x2a, 0x48, 0xa1, 0x91, 0x57, 0x5c, 0x90, + 0x9c, 0xac, 0x9b, 0x92, 0x5a, 0xa6, 0x9f, 0x97, 0x9a, 0x9f, 0x56, 0xac, 0x9b, 0x58, 0x90, 0xa9, + 0x0f, 0x36, 0x37, 0x89, 0x0d, 0x1c, 0x16, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0x8b, 0x7c, + 0x6b, 0x50, 0x56, 0x01, 0x00, 0x00, } func (m *Filter) Marshal() (dAtA []byte, err error) { diff --git a/query/types.proto b/query/types.proto index 6eaed5d..90f4bbf 100644 --- a/query/types.proto +++ b/query/types.proto @@ -1,6 +1,6 @@ syntax = "proto3"; package query; -option go_package = "github.com/nspcc-dev/neofs-proto/query"; +option go_package = "github.com/nspcc-dev/neofs-api/query"; import "github.com/gogo/protobuf/gogoproto/gogo.proto"; diff --git a/refs/address.go b/refs/address.go index be6b6a3..9c9ce7d 100644 --- a/refs/address.go +++ b/refs/address.go @@ -4,7 +4,7 @@ import ( "crypto/sha256" "strings" - "github.com/nspcc-dev/neofs-proto/internal" + "github.com/nspcc-dev/neofs-api/internal" ) const ( diff --git a/refs/owner.go b/refs/owner.go index ff88446..59c9c25 100644 --- a/refs/owner.go +++ b/refs/owner.go @@ -5,7 +5,7 @@ import ( "crypto/ecdsa" "github.com/mr-tron/base58" - "github.com/nspcc-dev/neofs-proto/chain" + "github.com/nspcc-dev/neofs-api/chain" "github.com/pkg/errors" ) diff --git a/refs/types.go b/refs/types.go index 785155c..c0ba85a 100644 --- a/refs/types.go +++ b/refs/types.go @@ -13,8 +13,8 @@ import ( "crypto/sha256" "github.com/google/uuid" - "github.com/nspcc-dev/neofs-proto/chain" - "github.com/nspcc-dev/neofs-proto/internal" + "github.com/nspcc-dev/neofs-api/chain" + "github.com/nspcc-dev/neofs-api/internal" ) type ( diff --git a/refs/types.pb.go b/refs/types.pb.go index 2ccde2f..80dcde2 100644 --- a/refs/types.pb.go +++ b/refs/types.pb.go @@ -69,7 +69,7 @@ func init() { func init() { proto.RegisterFile("refs/types.proto", fileDescriptor_063a64a96d952d31) } var fileDescriptor_063a64a96d952d31 = []byte{ - // 199 bytes of a gzipped FileDescriptorProto + // 201 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x28, 0x4a, 0x4d, 0x2b, 0xd6, 0x2f, 0xa9, 0x2c, 0x48, 0x2d, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x01, 0x89, 0x48, 0xe9, 0xa6, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0xa7, 0xe7, 0xa7, @@ -77,12 +77,12 @@ var fileDescriptor_063a64a96d952d31 = []byte{ 0xe3, 0x62, 0x77, 0x4c, 0x49, 0x29, 0x4a, 0x2d, 0x2e, 0x16, 0xd2, 0xe1, 0xe2, 0xf0, 0x4f, 0xca, 0x4a, 0x4d, 0x2e, 0xf1, 0x74, 0x91, 0x60, 0x54, 0x60, 0xd4, 0xe0, 0x71, 0x12, 0x38, 0x71, 0x4f, 0x9e, 0xe1, 0xd6, 0x3d, 0x79, 0xb8, 0x78, 0x10, 0x9c, 0x25, 0x24, 0xcb, 0xc5, 0xec, 0xec, 0xe9, - 0x22, 0xc1, 0x04, 0x56, 0xc8, 0x0d, 0x55, 0x08, 0x12, 0x0a, 0x02, 0x11, 0x4e, 0xce, 0x37, 0x1e, + 0x22, 0xc1, 0x04, 0x56, 0xc8, 0x0d, 0x55, 0x08, 0x12, 0x0a, 0x02, 0x11, 0x4e, 0x8e, 0x37, 0x1e, 0xca, 0x31, 0x34, 0x3c, 0x92, 0x63, 0x38, 0xf1, 0x48, 0x8e, 0xf1, 0xc2, 0x23, 0x39, 0xc6, 0x1b, - 0x8f, 0xe4, 0x18, 0x1f, 0x3c, 0x92, 0x63, 0x9c, 0xf1, 0x58, 0x8e, 0x21, 0x4a, 0x15, 0xc9, 0x91, + 0x8f, 0xe4, 0x18, 0x1f, 0x3c, 0x92, 0x63, 0x9c, 0xf1, 0x58, 0x8e, 0x21, 0x4a, 0x19, 0xc9, 0x91, 0x79, 0xc5, 0x05, 0xc9, 0xc9, 0xba, 0x29, 0xa9, 0x65, 0xfa, 0x79, 0xa9, 0xf9, 0x69, 0xc5, 0xba, - 0x10, 0x27, 0x82, 0xfc, 0x92, 0xc4, 0x06, 0x66, 0x1b, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0xfd, - 0xb6, 0x0b, 0x68, 0xec, 0x00, 0x00, 0x00, + 0x89, 0x05, 0x99, 0xfa, 0x20, 0x9f, 0x24, 0xb1, 0x81, 0x5d, 0x68, 0x0c, 0x08, 0x00, 0x00, 0xff, + 0xff, 0x50, 0xaf, 0xc5, 0x62, 0xea, 0x00, 0x00, 0x00, } func (m *Address) Marshal() (dAtA []byte, err error) { diff --git a/refs/types.proto b/refs/types.proto index 8c7d2eb..c526d56 100644 --- a/refs/types.proto +++ b/refs/types.proto @@ -1,6 +1,6 @@ syntax = "proto3"; package refs; -option go_package = "github.com/nspcc-dev/neofs-proto/refs"; +option go_package = "github.com/nspcc-dev/neofs-api/refs"; import "github.com/gogo/protobuf/gogoproto/gogo.proto"; diff --git a/service/meta.go b/service/meta.go index 8730386..95c1b13 100644 --- a/service/meta.go +++ b/service/meta.go @@ -1,7 +1,7 @@ package service import ( - "github.com/nspcc-dev/neofs-proto/internal" + "github.com/nspcc-dev/neofs-api/internal" "github.com/pkg/errors" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" @@ -94,7 +94,7 @@ func IRNonForwarding(role NodeRole) TTLCondition { // ProcessRequestTTL validates and update ttl requests. func ProcessRequestTTL(req MetaHeader, cond ...TTLCondition) error { - var ttl = req.GetTTL() + ttl := req.GetTTL() if ttl == ZeroTTL { return status.New(codes.InvalidArgument, ErrZeroTTL.Error()).Err() diff --git a/service/meta.pb.go b/service/meta.pb.go index d5f58fd..6ff1a5d 100644 --- a/service/meta.pb.go +++ b/service/meta.pb.go @@ -95,7 +95,7 @@ func init() { func init() { proto.RegisterFile("service/meta.proto", fileDescriptor_a638867e7b43457c) } var fileDescriptor_a638867e7b43457c = []byte{ - // 202 bytes of a gzipped FileDescriptorProto + // 204 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x2a, 0x4e, 0x2d, 0x2a, 0xcb, 0x4c, 0x4e, 0xd5, 0xcf, 0x4d, 0x2d, 0x49, 0xd4, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x87, 0x8a, 0x49, 0xe9, 0xa6, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0xa7, @@ -104,11 +104,11 @@ var fileDescriptor_a638867e7b43457c = []byte{ 0x48, 0x4d, 0x4c, 0x49, 0x2d, 0x12, 0x12, 0xe0, 0x62, 0x0e, 0x09, 0xf1, 0x91, 0x60, 0x54, 0x60, 0xd4, 0xe0, 0x0d, 0x02, 0x31, 0x85, 0x44, 0xb8, 0x58, 0x5d, 0x0b, 0xf2, 0x93, 0x33, 0x24, 0x98, 0x14, 0x18, 0x35, 0x58, 0x82, 0x20, 0x1c, 0x21, 0x09, 0x2e, 0xf6, 0xb0, 0xd4, 0xa2, 0xe2, 0xcc, - 0xfc, 0x3c, 0x09, 0x66, 0xb0, 0x5a, 0x18, 0xd7, 0xc9, 0xee, 0xc4, 0x23, 0x39, 0xc6, 0x0b, 0x8f, + 0xfc, 0x3c, 0x09, 0x66, 0xb0, 0x5a, 0x18, 0xd7, 0xc9, 0xe6, 0xc4, 0x23, 0x39, 0xc6, 0x0b, 0x8f, 0xe4, 0x18, 0x6f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e, 0x71, 0xc6, 0x63, 0x39, 0x86, 0x28, - 0x0d, 0x24, 0xb7, 0xe5, 0x15, 0x17, 0x24, 0x27, 0xeb, 0xa6, 0xa4, 0x96, 0xe9, 0xe7, 0xa5, 0xe6, - 0xa7, 0x15, 0xeb, 0x42, 0x5c, 0x06, 0xf5, 0x45, 0x12, 0x1b, 0x98, 0x6b, 0x0c, 0x08, 0x00, 0x00, - 0xff, 0xff, 0x6b, 0x83, 0x1d, 0xcf, 0xeb, 0x00, 0x00, 0x00, + 0x35, 0x24, 0xb7, 0xe5, 0x15, 0x17, 0x24, 0x27, 0xeb, 0xa6, 0xa4, 0x96, 0xe9, 0xe7, 0xa5, 0xe6, + 0xa7, 0x15, 0xeb, 0x26, 0x16, 0x64, 0xea, 0x43, 0xfd, 0x90, 0xc4, 0x06, 0x76, 0x9b, 0x31, 0x20, + 0x00, 0x00, 0xff, 0xff, 0xa6, 0x4d, 0x59, 0x8e, 0xe9, 0x00, 0x00, 0x00, } func (m *RequestMetaHeader) Marshal() (dAtA []byte, err error) { diff --git a/service/meta.proto b/service/meta.proto index d3c3005..f2cfe8f 100644 --- a/service/meta.proto +++ b/service/meta.proto @@ -1,6 +1,6 @@ syntax = "proto3"; package service; -option go_package = "github.com/nspcc-dev/neofs-proto/service"; +option go_package = "github.com/nspcc-dev/neofs-api/service"; import "github.com/gogo/protobuf/gogoproto/gogo.proto"; diff --git a/service/verify.go b/service/verify.go index 2bd1661..c8bd8d6 100644 --- a/service/verify.go +++ b/service/verify.go @@ -4,9 +4,9 @@ import ( "crypto/ecdsa" "sync" + "github.com/nspcc-dev/neofs-api/internal" + "github.com/nspcc-dev/neofs-api/refs" crypto "github.com/nspcc-dev/neofs-crypto" - "github.com/nspcc-dev/neofs-proto/internal" - "github.com/nspcc-dev/neofs-proto/refs" "github.com/pkg/errors" ) diff --git a/service/verify.pb.go b/service/verify.pb.go index 95a9452..a8f0ea5 100644 --- a/service/verify.pb.go +++ b/service/verify.pb.go @@ -179,7 +179,7 @@ func init() { func init() { proto.RegisterFile("service/verify.proto", fileDescriptor_4bdd5bc50ec96238) } var fileDescriptor_4bdd5bc50ec96238 = []byte{ - // 270 bytes of a gzipped FileDescriptorProto + // 272 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x29, 0x4e, 0x2d, 0x2a, 0xcb, 0x4c, 0x4e, 0xd5, 0x2f, 0x4b, 0x2d, 0xca, 0x4c, 0xab, 0xd4, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x87, 0x8a, 0x4a, 0xe9, 0xa6, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, @@ -192,11 +192,11 @@ var fileDescriptor_4bdd5bc50ec96238 = []byte{ 0x13, 0x04, 0x17, 0x0b, 0x48, 0x4d, 0x2d, 0x92, 0x60, 0x82, 0x88, 0x81, 0xd8, 0x52, 0x93, 0x19, 0xb9, 0x38, 0xe1, 0xda, 0x85, 0x5c, 0x91, 0x74, 0x71, 0x1b, 0xa9, 0x13, 0xe9, 0x0a, 0x27, 0x8e, 0x13, 0xf7, 0xe4, 0x19, 0x2e, 0xdc, 0x93, 0x67, 0x84, 0x5a, 0x64, 0xcf, 0xc5, 0xe6, 0x5f, 0x94, - 0x99, 0x9e, 0x99, 0x07, 0xb6, 0x8a, 0x78, 0x83, 0x82, 0xa0, 0xda, 0x9c, 0xec, 0x4e, 0x3c, 0x92, + 0x99, 0x9e, 0x99, 0x07, 0xb6, 0x8a, 0x78, 0x83, 0x82, 0xa0, 0xda, 0x9c, 0x6c, 0x4e, 0x3c, 0x92, 0x63, 0xbc, 0xf0, 0x48, 0x8e, 0xf1, 0xc6, 0x23, 0x39, 0xc6, 0x07, 0x8f, 0xe4, 0x18, 0x67, 0x3c, - 0x96, 0x63, 0x88, 0xd2, 0x40, 0x0a, 0xf6, 0xbc, 0xe2, 0x82, 0xe4, 0x64, 0xdd, 0x94, 0xd4, 0x32, - 0xfd, 0xbc, 0xd4, 0xfc, 0xb4, 0x62, 0x5d, 0x48, 0xa0, 0x43, 0xad, 0x49, 0x62, 0x03, 0x73, 0x8d, - 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xd7, 0x15, 0xf6, 0x5e, 0xc8, 0x01, 0x00, 0x00, + 0x96, 0x63, 0x88, 0x52, 0x43, 0x0a, 0xf6, 0xbc, 0xe2, 0x82, 0xe4, 0x64, 0xdd, 0x94, 0xd4, 0x32, + 0xfd, 0xbc, 0xd4, 0xfc, 0xb4, 0x62, 0xdd, 0xc4, 0x82, 0x4c, 0x7d, 0xa8, 0x25, 0x49, 0x6c, 0xe0, + 0x60, 0x37, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0x7a, 0xfc, 0xec, 0x11, 0xc6, 0x01, 0x00, 0x00, } func (m *RequestVerificationHeader) Marshal() (dAtA []byte, err error) { diff --git a/service/verify.proto b/service/verify.proto index c70015b..6a4a0e0 100644 --- a/service/verify.proto +++ b/service/verify.proto @@ -1,6 +1,6 @@ syntax = "proto3"; package service; -option go_package = "github.com/nspcc-dev/neofs-proto/service"; +option go_package = "github.com/nspcc-dev/neofs-api/service"; import "github.com/gogo/protobuf/gogoproto/gogo.proto"; diff --git a/service/verify_test.go b/service/verify_test.go index 44542c4..fb6736b 100644 --- a/service/verify_test.go +++ b/service/verify_test.go @@ -7,9 +7,9 @@ import ( "testing" "github.com/gogo/protobuf/proto" + "github.com/nspcc-dev/neofs-api/refs" crypto "github.com/nspcc-dev/neofs-crypto" "github.com/nspcc-dev/neofs-crypto/test" - "github.com/nspcc-dev/neofs-proto/refs" "github.com/pkg/errors" "github.com/stretchr/testify/require" ) diff --git a/service/verify_test.pb.go b/service/verify_test.pb.go index 06e7971..d920097 100644 --- a/service/verify_test.pb.go +++ b/service/verify_test.pb.go @@ -92,28 +92,28 @@ func init() { func init() { proto.RegisterFile("service/verify_test.proto", fileDescriptor_1effa83201a30d75) } var fileDescriptor_1effa83201a30d75 = []byte{ - // 322 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x90, 0x31, 0x4f, 0xc3, 0x30, - 0x10, 0x85, 0xeb, 0x52, 0x4a, 0x71, 0x90, 0x90, 0x0c, 0x43, 0xc9, 0x90, 0x46, 0x9d, 0xb2, 0x34, - 0x91, 0x40, 0x48, 0x4c, 0x0c, 0x01, 0x21, 0x18, 0x58, 0x02, 0x62, 0x60, 0x41, 0x49, 0x7a, 0x0d, - 0x96, 0x68, 0x5c, 0xe2, 0x4b, 0xa5, 0xfe, 0x13, 0x66, 0x7e, 0x4d, 0xc7, 0x8e, 0x88, 0xa1, 0x42, - 0xe1, 0x8f, 0xa0, 0xd8, 0x06, 0x05, 0xd8, 0xfc, 0xde, 0xfb, 0x9e, 0xed, 0x3b, 0x7a, 0x20, 0xa1, - 0x98, 0xf3, 0x14, 0x82, 0x39, 0x14, 0x7c, 0xb2, 0x78, 0x40, 0x90, 0xe8, 0xcf, 0x0a, 0x81, 0x82, - 0x6d, 0x99, 0xc8, 0x66, 0xdf, 0xcc, 0x14, 0x30, 0xd6, 0xa1, 0xbd, 0xff, 0xbb, 0x67, 0xdc, 0x51, - 0xc6, 0xf1, 0xb1, 0x4c, 0xfc, 0x54, 0x4c, 0x83, 0x4c, 0x64, 0x22, 0x50, 0x76, 0x52, 0x4e, 0x94, - 0x52, 0x42, 0x9d, 0x34, 0x3e, 0x7c, 0x6d, 0x53, 0xeb, 0x16, 0x24, 0x46, 0xf0, 0x5c, 0x82, 0x44, - 0x66, 0xd3, 0xde, 0x55, 0x8e, 0x17, 0x1c, 0x9e, 0xc6, 0x7d, 0xe2, 0x12, 0x6f, 0x33, 0xfa, 0xd1, - 0xcc, 0xa5, 0xd6, 0x0d, 0x16, 0x3c, 0xcf, 0x74, 0xdc, 0x76, 0x89, 0xb7, 0x1d, 0x35, 0x2d, 0xe6, - 0x50, 0x1a, 0x2e, 0x10, 0xa4, 0x06, 0x36, 0x5c, 0xe2, 0xed, 0x44, 0x0d, 0x87, 0x1d, 0x53, 0xeb, - 0xac, 0x94, 0x28, 0xa6, 0x1a, 0xe8, 0xd4, 0x40, 0xb8, 0xf7, 0xbe, 0x1e, 0xec, 0xd6, 0x43, 0x37, - 0xa2, 0xa8, 0xc9, 0xb1, 0x13, 0xda, 0xb9, 0x06, 0x8c, 0xfb, 0x89, 0x4b, 0x3c, 0xeb, 0xd0, 0xf6, - 0xcd, 0xe0, 0xbe, 0xf9, 0x74, 0x9d, 0x5d, 0x42, 0x3c, 0x86, 0x22, 0xec, 0x2d, 0xd7, 0x83, 0xd6, - 0x6a, 0x3d, 0x20, 0x91, 0x6a, 0xb0, 0x73, 0xda, 0xd5, 0x49, 0x3f, 0x55, 0xdd, 0xe1, 0xdf, 0xee, - 0x5d, 0xbd, 0x3b, 0x9e, 0xc6, 0xc8, 0x45, 0xfe, 0xef, 0x0e, 0xd3, 0x0d, 0x4f, 0x97, 0x95, 0x43, - 0x56, 0x95, 0x43, 0xde, 0x2a, 0x87, 0x7c, 0x54, 0x0e, 0x79, 0xf9, 0x74, 0x5a, 0xf7, 0x5e, 0x63, - 0xd3, 0xb9, 0x9c, 0xa5, 0xe9, 0x68, 0x0c, 0xf3, 0x20, 0x07, 0x31, 0x91, 0x23, 0xbd, 0x67, 0xf3, - 0x56, 0xd2, 0x55, 0xf2, 0xe8, 0x2b, 0x00, 0x00, 0xff, 0xff, 0xf7, 0x37, 0x92, 0xd2, 0xea, 0x01, - 0x00, 0x00, + // 326 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x90, 0xb1, 0x4e, 0xf3, 0x30, + 0x14, 0x85, 0xeb, 0xfe, 0xfd, 0x4b, 0x71, 0x90, 0x90, 0x0c, 0x43, 0xc9, 0x90, 0x46, 0x1d, 0x50, + 0x96, 0x26, 0x12, 0x08, 0x89, 0x81, 0x29, 0x20, 0x04, 0x03, 0x4b, 0x40, 0x0c, 0x2c, 0x28, 0x49, + 0x6f, 0x83, 0x25, 0x1a, 0x97, 0xf8, 0xa6, 0x52, 0xdf, 0x84, 0x99, 0xa7, 0xe9, 0xd8, 0x11, 0x31, + 0x54, 0x28, 0xbc, 0x08, 0x8a, 0x6d, 0x50, 0x80, 0xcd, 0xf7, 0x9c, 0xef, 0xd8, 0xbe, 0x87, 0xee, + 0x49, 0x28, 0xe6, 0x3c, 0x85, 0x60, 0x0e, 0x05, 0x9f, 0x2c, 0xee, 0x11, 0x24, 0xfa, 0xb3, 0x42, + 0xa0, 0x60, 0x1b, 0xc6, 0xb2, 0xd9, 0x17, 0x33, 0x05, 0x8c, 0xb5, 0x69, 0xef, 0xfe, 0xcc, 0x19, + 0x75, 0x94, 0x71, 0x7c, 0x28, 0x13, 0x3f, 0x15, 0xd3, 0x20, 0x13, 0x99, 0x08, 0x94, 0x9c, 0x94, + 0x13, 0x35, 0xa9, 0x41, 0x9d, 0x34, 0x3e, 0x7c, 0x69, 0x53, 0xeb, 0x06, 0x24, 0x46, 0xf0, 0x54, + 0x82, 0x44, 0x66, 0xd3, 0xde, 0x65, 0x8e, 0xe7, 0x1c, 0x1e, 0xc7, 0x7d, 0xe2, 0x12, 0xef, 0x7f, + 0xf4, 0x3d, 0x33, 0x97, 0x5a, 0xd7, 0x58, 0xf0, 0x3c, 0xd3, 0x76, 0xdb, 0x25, 0xde, 0x66, 0xd4, + 0x94, 0x98, 0x43, 0x69, 0xb8, 0x40, 0x90, 0x1a, 0xf8, 0xe7, 0x12, 0x6f, 0x2b, 0x6a, 0x28, 0xec, + 0x88, 0x5a, 0xa7, 0xa5, 0x44, 0x31, 0xd5, 0x40, 0xa7, 0x06, 0xc2, 0x9d, 0xb7, 0xf5, 0x60, 0xbb, + 0x5e, 0xba, 0x61, 0x45, 0x4d, 0x8e, 0x1d, 0xd3, 0xce, 0x15, 0x60, 0xdc, 0x4f, 0x5c, 0xe2, 0x59, + 0x07, 0xb6, 0x6f, 0x16, 0xf7, 0xcd, 0xa7, 0x6b, 0xef, 0x02, 0xe2, 0x31, 0x14, 0x61, 0x6f, 0xb9, + 0x1e, 0xb4, 0x56, 0xeb, 0x01, 0x89, 0x54, 0x82, 0x9d, 0xd1, 0xae, 0x76, 0xfa, 0xa9, 0xca, 0x0e, + 0x7f, 0x67, 0x6f, 0xeb, 0xee, 0x78, 0x1a, 0x23, 0x17, 0xf9, 0x9f, 0x3b, 0x4c, 0x36, 0x3c, 0x59, + 0x56, 0x0e, 0x59, 0x55, 0x0e, 0x79, 0xad, 0x1c, 0xf2, 0x5e, 0x39, 0xe4, 0xf9, 0xc3, 0x69, 0xdd, + 0xed, 0x37, 0x9a, 0xce, 0xe5, 0x2c, 0x4d, 0x47, 0x63, 0x98, 0x07, 0x39, 0x88, 0x89, 0x1c, 0xc5, + 0x33, 0x1e, 0x98, 0x97, 0x92, 0xae, 0x6a, 0xfa, 0xf0, 0x33, 0x00, 0x00, 0xff, 0xff, 0x04, 0x99, + 0x63, 0xf2, 0xe8, 0x01, 0x00, 0x00, } func (m *TestRequest) Marshal() (dAtA []byte, err error) { diff --git a/service/verify_test.proto b/service/verify_test.proto index c632615..ce81180 100644 --- a/service/verify_test.proto +++ b/service/verify_test.proto @@ -1,6 +1,6 @@ syntax = "proto3"; package service; -option go_package = "github.com/nspcc-dev/neofs-proto/service"; +option go_package = "github.com/nspcc-dev/neofs-api/service"; import "service/meta.proto"; import "service/verify.proto"; diff --git a/session/service.go b/session/service.go index d9f889f..39dfb11 100644 --- a/session/service.go +++ b/session/service.go @@ -4,8 +4,8 @@ import ( "context" "crypto/ecdsa" + "github.com/nspcc-dev/neofs-api/refs" crypto "github.com/nspcc-dev/neofs-crypto" - "github.com/nspcc-dev/neofs-proto/refs" ) type ( diff --git a/session/service.pb.go b/session/service.pb.go index 8532523..e554ba1 100644 --- a/session/service.pb.go +++ b/session/service.pb.go @@ -8,7 +8,7 @@ import ( fmt "fmt" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/golang/protobuf/proto" - service "github.com/nspcc-dev/neofs-proto/service" + service "github.com/nspcc-dev/neofs-api/service" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" @@ -210,30 +210,30 @@ func init() { func init() { proto.RegisterFile("session/service.proto", fileDescriptor_b329bee0fd1148e0) } var fileDescriptor_b329bee0fd1148e0 = []byte{ - // 364 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x51, 0xbd, 0x4e, 0xeb, 0x30, - 0x14, 0xae, 0xaf, 0xaa, 0xb4, 0xd7, 0x57, 0xb7, 0x83, 0xef, 0x0f, 0x51, 0x86, 0x14, 0x55, 0x0c, - 0x19, 0x68, 0x82, 0xca, 0xc2, 0x02, 0x43, 0x61, 0x28, 0x43, 0x97, 0x14, 0x18, 0xd8, 0x92, 0xf4, - 0x34, 0x58, 0x50, 0x3b, 0xc4, 0x4e, 0xa5, 0xbe, 0x09, 0x8f, 0xd4, 0xb1, 0x23, 0x53, 0x85, 0xc2, - 0xc6, 0x53, 0xa0, 0xda, 0x4e, 0x55, 0xa8, 0xba, 0xf9, 0x7c, 0x3f, 0xe7, 0x9c, 0xcf, 0x07, 0xff, - 0x13, 0x20, 0x04, 0xe5, 0x2c, 0x10, 0x90, 0xcf, 0x68, 0x02, 0x7e, 0x96, 0x73, 0xc9, 0x49, 0xc3, - 0xc0, 0xce, 0x9f, 0x8a, 0x97, 0xf3, 0x0c, 0x84, 0x66, 0x1d, 0x62, 0xc4, 0xc1, 0x14, 0x64, 0x64, - 0xb0, 0xbf, 0x15, 0x36, 0x83, 0x9c, 0x4e, 0xe6, 0x06, 0xed, 0xa6, 0x54, 0x3e, 0x14, 0xb1, 0x9f, - 0xf0, 0x69, 0x90, 0xf2, 0x94, 0x07, 0x0a, 0x8e, 0x8b, 0x89, 0xaa, 0x54, 0xa1, 0x5e, 0x5a, 0xde, - 0xf9, 0x40, 0xf8, 0xf7, 0x65, 0x0e, 0x91, 0x84, 0x10, 0x9e, 0x0b, 0x10, 0x92, 0x1c, 0xe1, 0xfa, - 0x35, 0xa3, 0xd2, 0x46, 0x87, 0xc8, 0xfb, 0xd5, 0x6b, 0xf9, 0x66, 0x1d, 0xff, 0x86, 0x3f, 0x02, - 0x1b, 0xd4, 0x42, 0xc5, 0x12, 0x0f, 0x5b, 0x23, 0x9a, 0x32, 0x18, 0xdb, 0x3f, 0xf6, 0xe8, 0x0c, - 0x4f, 0xce, 0x70, 0x7d, 0x08, 0x32, 0xb2, 0x63, 0xa5, 0x73, 0xfc, 0x2a, 0xb6, 0x99, 0xb7, 0xe6, - 0x06, 0x10, 0x8d, 0x21, 0xef, 0x37, 0x17, 0xab, 0x76, 0x6d, 0xb9, 0x6a, 0xa3, 0x50, 0x39, 0xc8, - 0x15, 0xb6, 0xee, 0x54, 0x34, 0x3b, 0x51, 0xde, 0xce, 0x77, 0xaf, 0x62, 0x69, 0x12, 0x49, 0xca, - 0xd9, 0x4e, 0x0f, 0xe3, 0xed, 0xff, 0xc4, 0x8d, 0x21, 0x08, 0x11, 0xa5, 0xd0, 0x11, 0xb8, 0x55, - 0x65, 0x15, 0x19, 0x67, 0x02, 0xc8, 0x31, 0x6e, 0xde, 0x32, 0xa1, 0x83, 0xec, 0x0b, 0xbc, 0x51, - 0xac, 0x43, 0x87, 0x20, 0x8a, 0x27, 0xb9, 0x3f, 0xb4, 0xe6, 0xb7, 0x86, 0xf6, 0x06, 0xb8, 0x31, - 0xd2, 0x2a, 0x72, 0x8e, 0x2d, 0x3d, 0x9f, 0xfc, 0xdf, 0x38, 0xbf, 0x7c, 0xbe, 0x73, 0xb0, 0x83, - 0xeb, 0x45, 0x3d, 0x74, 0x82, 0xfa, 0x17, 0x8b, 0xd2, 0x45, 0xcb, 0xd2, 0x45, 0xaf, 0xa5, 0x8b, - 0xde, 0x4a, 0x17, 0xbd, 0xbc, 0xbb, 0xb5, 0x7b, 0x6f, 0xeb, 0xe0, 0x4c, 0x64, 0x49, 0xd2, 0x1d, - 0xc3, 0x2c, 0x60, 0xc0, 0x27, 0xa2, 0xab, 0xcf, 0x6d, 0x5a, 0xc6, 0x96, 0x2a, 0x4f, 0x3f, 0x03, - 0x00, 0x00, 0xff, 0xff, 0xf6, 0xdd, 0x2a, 0xdb, 0x82, 0x02, 0x00, 0x00, + // 367 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x51, 0xbd, 0x6e, 0xe2, 0x40, + 0x10, 0x66, 0x4f, 0xc8, 0x70, 0x7b, 0x3a, 0x8a, 0xbd, 0x3f, 0xcb, 0x85, 0x39, 0xa1, 0xd3, 0x89, + 0xe2, 0xb0, 0x4f, 0xa4, 0x49, 0x91, 0x34, 0x24, 0x05, 0x29, 0x68, 0x4c, 0x92, 0x22, 0x9d, 0x6d, + 0x06, 0x67, 0x95, 0xb0, 0xeb, 0x78, 0xd6, 0x48, 0xbc, 0x49, 0x1e, 0x89, 0x92, 0x32, 0x15, 0x8a, + 0x9c, 0x2e, 0x4f, 0x11, 0xb1, 0x5e, 0x23, 0x12, 0x44, 0xb7, 0xf3, 0xfd, 0xcc, 0xcc, 0xb7, 0x43, + 0x7f, 0x20, 0x20, 0x72, 0x29, 0x7c, 0x84, 0x6c, 0xce, 0x63, 0xf0, 0xd2, 0x4c, 0x2a, 0xc9, 0x1a, + 0x06, 0x76, 0xbe, 0x55, 0xbc, 0x5a, 0xa4, 0x80, 0x25, 0xeb, 0x30, 0x23, 0xf6, 0x67, 0xa0, 0x42, + 0x83, 0x7d, 0xaf, 0xb0, 0x39, 0x64, 0x7c, 0xba, 0x30, 0x68, 0x2f, 0xe1, 0xea, 0x36, 0x8f, 0xbc, + 0x58, 0xce, 0xfc, 0x44, 0x26, 0xd2, 0xd7, 0x70, 0x94, 0x4f, 0x75, 0xa5, 0x0b, 0xfd, 0x2a, 0xe5, + 0x9d, 0x57, 0x42, 0xbf, 0x9e, 0x65, 0x10, 0x2a, 0x08, 0xe0, 0x21, 0x07, 0x54, 0xec, 0x0f, 0xad, + 0x5f, 0x08, 0xae, 0x6c, 0xf2, 0x9b, 0x74, 0xbf, 0xf4, 0x5b, 0x9e, 0x59, 0xc7, 0xbb, 0x94, 0x77, + 0x20, 0x86, 0xb5, 0x40, 0xb3, 0xac, 0x4b, 0xad, 0x31, 0x4f, 0x04, 0x4c, 0xec, 0x4f, 0x07, 0x74, + 0x86, 0x67, 0xc7, 0xb4, 0x3e, 0x02, 0x15, 0xda, 0x91, 0xd6, 0x39, 0x5e, 0x15, 0xdb, 0xcc, 0xdb, + 0x70, 0x43, 0x08, 0x27, 0x90, 0x0d, 0x9a, 0xcb, 0x75, 0xbb, 0xb6, 0x5a, 0xb7, 0x49, 0xa0, 0x1d, + 0xec, 0x9c, 0x5a, 0xd7, 0x3a, 0x9a, 0x1d, 0x6b, 0x6f, 0xe7, 0xa3, 0x57, 0xb3, 0x3c, 0x0e, 0x15, + 0x97, 0x62, 0xaf, 0x87, 0xf1, 0x0e, 0x3e, 0xd3, 0xc6, 0x08, 0x10, 0xc3, 0x04, 0x3a, 0x48, 0x5b, + 0x55, 0x56, 0x4c, 0xa5, 0x40, 0x60, 0xff, 0x68, 0xf3, 0x4a, 0x60, 0x19, 0xe4, 0x50, 0xe0, 0xad, + 0x62, 0x13, 0x3a, 0x00, 0xcc, 0xef, 0xd5, 0xe1, 0xd0, 0x25, 0xbf, 0x33, 0xb4, 0x3f, 0xa4, 0x8d, + 0x71, 0xa9, 0x62, 0xa7, 0xd4, 0x2a, 0xe7, 0xb3, 0x9f, 0x5b, 0xe7, 0xbb, 0xcf, 0x77, 0x7e, 0xed, + 0xe1, 0xe5, 0xa2, 0x5d, 0xf2, 0x9f, 0x0c, 0x4e, 0x96, 0x85, 0x4b, 0x56, 0x85, 0x4b, 0x9e, 0x0a, + 0x97, 0x3c, 0x17, 0x2e, 0x79, 0x7c, 0x71, 0x6b, 0x37, 0x7f, 0x77, 0x0e, 0x2e, 0x30, 0x8d, 0xe3, + 0xde, 0x04, 0xe6, 0xbe, 0x00, 0x39, 0xc5, 0x5e, 0x98, 0x72, 0xdf, 0x34, 0x8c, 0x2c, 0x7d, 0xf0, + 0xa3, 0xb7, 0x00, 0x00, 0x00, 0xff, 0xff, 0xfb, 0x22, 0x92, 0x20, 0x80, 0x02, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/session/service.proto b/session/service.proto index 377e77e..95ea9c5 100644 --- a/session/service.proto +++ b/session/service.proto @@ -1,6 +1,6 @@ syntax = "proto3"; package session; -option go_package = "github.com/nspcc-dev/neofs-proto/session"; +option go_package = "github.com/nspcc-dev/neofs-api/session"; import "session/types.proto"; import "service/meta.proto"; diff --git a/session/store.go b/session/store.go index 1daf151..b671a8c 100644 --- a/session/store.go +++ b/session/store.go @@ -6,8 +6,8 @@ import ( "crypto/rand" "sync" + "github.com/nspcc-dev/neofs-api/refs" crypto "github.com/nspcc-dev/neofs-crypto" - "github.com/nspcc-dev/neofs-proto/refs" ) type simpleStore struct { diff --git a/session/store_test.go b/session/store_test.go index ade0cb0..6ee17ad 100644 --- a/session/store_test.go +++ b/session/store_test.go @@ -5,8 +5,8 @@ import ( "crypto/rand" "testing" + "github.com/nspcc-dev/neofs-api/refs" crypto "github.com/nspcc-dev/neofs-crypto" - "github.com/nspcc-dev/neofs-proto/refs" "github.com/stretchr/testify/require" ) @@ -61,8 +61,8 @@ func TestTokenStore(t *testing.T) { // create new token token := s.New(TokenParams{ - ObjectID: []ObjectID{oid}, - OwnerID: c.OwnerID, + ObjectID: []ObjectID{oid}, + OwnerID: c.OwnerID, PublicKeys: pk, }) signToken(t, token, c) @@ -74,9 +74,10 @@ func TestTokenStore(t *testing.T) { // create and sign another token by the same client t1 = s.New(TokenParams{ - ObjectID: []ObjectID{oid}, - OwnerID: c.OwnerID, - PublicKeys: pk}) + ObjectID: []ObjectID{oid}, + OwnerID: c.OwnerID, + PublicKeys: pk, + }) signToken(t, t1, c) diff --git a/session/types.go b/session/types.go index 08abec8..120b8a8 100644 --- a/session/types.go +++ b/session/types.go @@ -5,10 +5,10 @@ import ( "encoding/binary" "sync" + "github.com/nspcc-dev/neofs-api/chain" + "github.com/nspcc-dev/neofs-api/internal" + "github.com/nspcc-dev/neofs-api/refs" crypto "github.com/nspcc-dev/neofs-crypto" - "github.com/nspcc-dev/neofs-proto/chain" - "github.com/nspcc-dev/neofs-proto/internal" - "github.com/nspcc-dev/neofs-proto/refs" "github.com/pkg/errors" ) @@ -113,7 +113,7 @@ func (m *Token) Sign(key *ecdsa.PrivateKey) error { } // SetPublicKeys sets owner's public keys to the token -func (m *Token) SetPublicKeys(keys... *ecdsa.PublicKey) { +func (m *Token) SetPublicKeys(keys ...*ecdsa.PublicKey) { m.PublicKeys = m.PublicKeys[:0] for i := range keys { m.PublicKeys = append(m.PublicKeys, crypto.MarshalPublicKey(keys[i])) diff --git a/session/types.pb.go b/session/types.pb.go index 5b2f5c4..e27f0c6 100644 --- a/session/types.pb.go +++ b/session/types.pb.go @@ -171,30 +171,30 @@ func init() { func init() { proto.RegisterFile("session/types.proto", fileDescriptor_c0d9d9cb855cdad8) } var fileDescriptor_c0d9d9cb855cdad8 = []byte{ - // 358 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x91, 0xcd, 0x4e, 0xe3, 0x30, - 0x14, 0x85, 0x9b, 0xf4, 0x77, 0x3c, 0x95, 0x66, 0xe4, 0xd9, 0x44, 0x03, 0x4a, 0xab, 0xae, 0x82, - 0x44, 0x13, 0x09, 0x56, 0x6c, 0x58, 0x44, 0x01, 0x11, 0x15, 0xa9, 0xc8, 0xa0, 0x2e, 0xd8, 0x25, - 0xae, 0x9b, 0x9a, 0x1f, 0x3b, 0x8a, 0x1d, 0x50, 0xdf, 0x84, 0x47, 0xe1, 0x11, 0xba, 0x64, 0x89, - 0x58, 0x54, 0x28, 0xbc, 0x08, 0x8a, 0x93, 0xa6, 0xad, 0xd8, 0xdd, 0xfb, 0x1d, 0xfb, 0x9e, 0xeb, - 0x63, 0xf0, 0x4f, 0x10, 0x21, 0x28, 0x67, 0x8e, 0x5c, 0xc4, 0x44, 0xd8, 0x71, 0xc2, 0x25, 0x87, - 0xed, 0x12, 0xfe, 0x1f, 0x46, 0x54, 0xce, 0xd3, 0xd0, 0xc6, 0xfc, 0xd1, 0x89, 0x78, 0xc4, 0x1d, - 0xa5, 0x87, 0xe9, 0x4c, 0x75, 0xaa, 0x51, 0x55, 0x71, 0x6f, 0x30, 0x01, 0x70, 0x42, 0x12, 0x3a, - 0xa3, 0x38, 0x90, 0x94, 0xb3, 0x0b, 0x12, 0x4c, 0x49, 0x02, 0xf7, 0xc1, 0xaf, 0xab, 0x34, 0x7c, - 0xa0, 0x78, 0x44, 0x16, 0x86, 0xd6, 0xd7, 0xac, 0x2e, 0xda, 0x00, 0x38, 0x00, 0xdd, 0x11, 0x59, - 0x5c, 0xd3, 0x88, 0x05, 0x32, 0x4d, 0x88, 0xa1, 0xab, 0x03, 0x3b, 0x6c, 0xf0, 0xaa, 0x83, 0xe6, - 0x0d, 0xbf, 0x27, 0x0c, 0x9e, 0x80, 0x56, 0x31, 0x55, 0x0d, 0xfa, 0x7d, 0xb4, 0x67, 0x97, 0xab, - 0xda, 0x3f, 0x8d, 0xdd, 0xc6, 0x72, 0xd5, 0xab, 0xa1, 0xf2, 0x02, 0x3c, 0x00, 0xed, 0xf1, 0x33, - 0x23, 0x89, 0xef, 0x15, 0x1e, 0xee, 0x9f, 0x5c, 0xfe, 0x58, 0xf5, 0xd6, 0x18, 0xad, 0x0b, 0x68, - 0x02, 0x70, 0x4e, 0x13, 0x21, 0xcf, 0x62, 0x8e, 0xe7, 0x46, 0xbd, 0xaf, 0x59, 0x0d, 0xb4, 0x45, - 0xf2, 0x17, 0x5d, 0x06, 0x6b, 0xb9, 0xa1, 0xe4, 0x0d, 0x80, 0x87, 0xa0, 0x33, 0x0e, 0xef, 0x08, - 0x96, 0xbe, 0x67, 0x34, 0xfb, 0x75, 0xab, 0xeb, 0xfe, 0x2d, 0x9d, 0x2a, 0x8e, 0xaa, 0x2a, 0x9f, - 0xb5, 0x79, 0x7c, 0xab, 0x48, 0xa7, 0x02, 0xb0, 0x07, 0x74, 0xdf, 0x33, 0xda, 0xbb, 0xfb, 0xaa, - 0x28, 0x7c, 0x0f, 0xe9, 0xc5, 0xaa, 0x55, 0x96, 0xc2, 0xe8, 0xe4, 0x76, 0x68, 0x8b, 0xb8, 0xa7, - 0xcb, 0xcc, 0xd4, 0xde, 0x32, 0x53, 0x7b, 0xcf, 0x4c, 0xed, 0x33, 0x33, 0xb5, 0x97, 0x2f, 0xb3, - 0x76, 0x6b, 0x6d, 0xfd, 0x2b, 0x13, 0x31, 0xc6, 0xc3, 0x29, 0x79, 0x72, 0x18, 0xe1, 0x33, 0x31, - 0x2c, 0x7e, 0xb5, 0x8c, 0x35, 0x6c, 0xa9, 0xf6, 0xf8, 0x3b, 0x00, 0x00, 0xff, 0xff, 0xbe, 0x33, - 0xae, 0xb5, 0x28, 0x02, 0x00, 0x00, + // 360 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x91, 0xcf, 0x4a, 0xeb, 0x40, + 0x14, 0xc6, 0x9b, 0xf4, 0xef, 0x9d, 0x5b, 0xb8, 0x97, 0x71, 0x13, 0x54, 0xd2, 0xd2, 0x85, 0x54, + 0xb0, 0x09, 0xe8, 0x4a, 0x70, 0x15, 0xa2, 0x18, 0x2a, 0x54, 0x46, 0xe9, 0xc2, 0x5d, 0x32, 0x9d, + 0xa6, 0xe3, 0x9f, 0x99, 0x90, 0x99, 0x28, 0x7d, 0x13, 0x1f, 0xc5, 0x47, 0xe8, 0xd2, 0xa5, 0xb8, + 0x28, 0x12, 0x5f, 0x44, 0x32, 0x49, 0xd3, 0x16, 0x77, 0x67, 0x7e, 0xdf, 0xcc, 0xf9, 0xce, 0x7c, + 0x07, 0xec, 0x08, 0x22, 0x04, 0xe5, 0xcc, 0x96, 0xf3, 0x88, 0x08, 0x2b, 0x8a, 0xb9, 0xe4, 0xb0, + 0x59, 0xc0, 0xdd, 0x41, 0x48, 0xe5, 0x2c, 0x09, 0x2c, 0xcc, 0x9f, 0xec, 0x90, 0x87, 0xdc, 0x56, + 0x7a, 0x90, 0x4c, 0xd5, 0x49, 0x1d, 0x54, 0x95, 0xbf, 0xeb, 0x8d, 0x01, 0x1c, 0x93, 0x98, 0x4e, + 0x29, 0xf6, 0x25, 0xe5, 0xec, 0x92, 0xf8, 0x13, 0x12, 0xc3, 0x7d, 0xf0, 0xe7, 0x3a, 0x09, 0x1e, + 0x29, 0x1e, 0x92, 0xb9, 0xa1, 0x75, 0xb5, 0x7e, 0x1b, 0xad, 0x01, 0xec, 0x81, 0xf6, 0x90, 0xcc, + 0x6f, 0x68, 0xc8, 0x7c, 0x99, 0xc4, 0xc4, 0xd0, 0xd5, 0x85, 0x2d, 0xd6, 0x7b, 0xd3, 0x41, 0xfd, + 0x96, 0x3f, 0x10, 0x06, 0x4f, 0x41, 0x23, 0xef, 0xaa, 0x1a, 0xfd, 0x3d, 0xde, 0xb3, 0x8a, 0x51, + 0xad, 0xdf, 0xc6, 0x4e, 0x6d, 0xb1, 0xec, 0x54, 0x50, 0xf1, 0x00, 0x1e, 0x82, 0xe6, 0xe8, 0x85, + 0x91, 0xd8, 0x73, 0x73, 0x0f, 0xe7, 0x5f, 0x26, 0x7f, 0x2e, 0x3b, 0x2b, 0x8c, 0x56, 0x05, 0x34, + 0x01, 0xb8, 0xa0, 0xb1, 0x90, 0xe7, 0x11, 0xc7, 0x33, 0xa3, 0xda, 0xd5, 0xfa, 0x35, 0xb4, 0x41, + 0xb2, 0x1f, 0x5d, 0xf9, 0x2b, 0xb9, 0xa6, 0xe4, 0x35, 0x80, 0x47, 0xa0, 0x35, 0x0a, 0xee, 0x09, + 0x96, 0x9e, 0x6b, 0xd4, 0xbb, 0xd5, 0x7e, 0xdb, 0xf9, 0x5f, 0x38, 0x95, 0x1c, 0x95, 0x55, 0xd6, + 0x6b, 0xfd, 0xf9, 0x46, 0x9e, 0x4e, 0x09, 0x60, 0x07, 0xe8, 0x9e, 0x6b, 0x34, 0xb7, 0xe7, 0x55, + 0x51, 0x78, 0x2e, 0xd2, 0xf3, 0x51, 0xcb, 0x2c, 0x85, 0xd1, 0xca, 0xec, 0xd0, 0x06, 0x71, 0xce, + 0x16, 0xa9, 0xa9, 0xbd, 0xa7, 0xa6, 0xf6, 0x91, 0x9a, 0xda, 0x57, 0x6a, 0x6a, 0xaf, 0xdf, 0x66, + 0xe5, 0xee, 0x60, 0x63, 0xaf, 0x4c, 0x44, 0x18, 0x0f, 0x26, 0xe4, 0xd9, 0x66, 0x84, 0x4f, 0xc5, + 0xc0, 0x8f, 0xa8, 0x5d, 0x84, 0x1a, 0x34, 0xd4, 0x5e, 0x4f, 0x7e, 0x02, 0x00, 0x00, 0xff, 0xff, + 0xb8, 0x9f, 0x2d, 0x1d, 0x26, 0x02, 0x00, 0x00, } func (m *VerificationHeader) Marshal() (dAtA []byte, err error) { diff --git a/session/types.proto b/session/types.proto index 294928b..79b24ff 100644 --- a/session/types.proto +++ b/session/types.proto @@ -1,6 +1,6 @@ syntax = "proto3"; package session; -option go_package = "github.com/nspcc-dev/neofs-proto/session"; +option go_package = "github.com/nspcc-dev/neofs-api/session"; import "github.com/gogo/protobuf/gogoproto/gogo.proto"; diff --git a/state/service.pb.go b/state/service.pb.go index 09cc645..62f5f4e 100644 --- a/state/service.pb.go +++ b/state/service.pb.go @@ -8,8 +8,8 @@ import ( fmt "fmt" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/golang/protobuf/proto" - bootstrap "github.com/nspcc-dev/neofs-proto/bootstrap" - service "github.com/nspcc-dev/neofs-proto/service" + bootstrap "github.com/nspcc-dev/neofs-api/bootstrap" + service "github.com/nspcc-dev/neofs-api/service" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" @@ -347,36 +347,36 @@ func init() { func init() { proto.RegisterFile("state/service.proto", fileDescriptor_695592f6f2fc97b7) } var fileDescriptor_695592f6f2fc97b7 = []byte{ - // 459 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x94, 0xbf, 0x6e, 0xdb, 0x30, - 0x10, 0xc6, 0xc3, 0xfe, 0x51, 0xd3, 0xb3, 0x9b, 0x02, 0x8c, 0x6d, 0x08, 0x1a, 0x14, 0xc3, 0x43, - 0x60, 0xa0, 0xb0, 0x04, 0xa4, 0x2d, 0x10, 0x14, 0x9d, 0x9c, 0x0c, 0x59, 0xdc, 0x41, 0x01, 0x3a, - 0x74, 0xa3, 0xe4, 0xb3, 0x2d, 0xb4, 0x16, 0x59, 0xf1, 0x64, 0xc0, 0x0f, 0x51, 0xb4, 0x63, 0x1f, - 0x29, 0x63, 0xc6, 0x4e, 0x41, 0xe1, 0x8e, 0x7d, 0x89, 0x22, 0x24, 0xe5, 0xda, 0xce, 0x0b, 0x78, - 0xf3, 0xf7, 0x3b, 0x7d, 0xf4, 0x77, 0xe4, 0x91, 0x70, 0xac, 0x49, 0x10, 0xc6, 0x1a, 0xcb, 0x45, - 0x9e, 0x61, 0xa4, 0x4a, 0x49, 0x92, 0x3f, 0x35, 0x30, 0xe0, 0x8e, 0xc6, 0x73, 0x24, 0x61, 0x4b, - 0x41, 0xab, 0x66, 0x0b, 0x2c, 0xf3, 0xc9, 0xd2, 0xd1, 0x76, 0x2a, 0x25, 0x69, 0x2a, 0x85, 0x8a, - 0x69, 0xa9, 0x50, 0x3b, 0x3c, 0x98, 0xe6, 0x34, 0xab, 0xd2, 0x28, 0x93, 0xf3, 0x78, 0x2a, 0xa7, - 0x32, 0x36, 0x38, 0xad, 0x26, 0x46, 0x19, 0x61, 0x7e, 0xd9, 0xcf, 0x7b, 0xdf, 0x19, 0xbc, 0xf8, - 0x80, 0x34, 0x17, 0x2a, 0xc1, 0xaf, 0x15, 0x6a, 0xe2, 0xe7, 0xf0, 0x64, 0x84, 0x24, 0xfc, 0xb4, - 0xcb, 0xfa, 0x8d, 0xb3, 0x20, 0xaa, 0x63, 0xba, 0xfa, 0x7d, 0xed, 0x0a, 0xc5, 0x18, 0xcb, 0xe1, - 0xe1, 0xcd, 0xdd, 0xc9, 0xc1, 0xed, 0xdd, 0x09, 0x4b, 0x8c, 0x83, 0x5f, 0x82, 0xf7, 0xd1, 0x24, - 0xf4, 0x33, 0xe3, 0xed, 0xed, 0x7a, 0x4d, 0x35, 0xcf, 0x04, 0xe5, 0xb2, 0x78, 0xb0, 0x86, 0xf3, - 0xf6, 0x7e, 0x30, 0x38, 0x1a, 0x21, 0x95, 0x79, 0xa6, 0xf7, 0x25, 0xd2, 0x2b, 0x78, 0xb9, 0x4e, - 0xa4, 0x95, 0x2c, 0x34, 0x72, 0x1f, 0x9e, 0x39, 0xe4, 0xb3, 0xee, 0xe3, 0x7e, 0x33, 0xa9, 0xa5, - 0xd9, 0xd1, 0x2b, 0x14, 0x5f, 0x68, 0xb6, 0x2f, 0xf1, 0x87, 0x70, 0x54, 0x07, 0xfa, 0x9f, 0xde, - 0x92, 0xa5, 0xcf, 0xba, 0xac, 0x7f, 0x98, 0xd4, 0x92, 0x77, 0xc0, 0xbb, 0x26, 0x41, 0x95, 0xf6, - 0x1f, 0x75, 0x59, 0xff, 0x79, 0xe2, 0x54, 0xef, 0x1b, 0x83, 0xc6, 0x65, 0x35, 0xdf, 0x9b, 0x29, - 0x39, 0x85, 0xa6, 0x8d, 0xe3, 0x3a, 0xea, 0x80, 0x77, 0x21, 0x8b, 0x49, 0x3e, 0x35, 0x0d, 0x35, - 0x13, 0xa7, 0xce, 0xfe, 0xb2, 0xba, 0x21, 0xfe, 0x06, 0x3c, 0x3b, 0xe9, 0xbc, 0x15, 0x99, 0xcb, - 0x16, 0x6d, 0x0d, 0x7e, 0xd0, 0x8a, 0xd6, 0x37, 0x2a, 0xba, 0x56, 0x25, 0x8a, 0xf1, 0x48, 0x28, - 0x7e, 0xbe, 0x3e, 0x68, 0xde, 0x76, 0xb6, 0xed, 0xe9, 0x0c, 0x3a, 0xbb, 0xd8, 0x45, 0x7a, 0x07, - 0x0d, 0xbb, 0xab, 0x17, 0x33, 0xcc, 0x3e, 0xaf, 0xff, 0x74, 0x6b, 0x36, 0x82, 0xf6, 0x0e, 0x75, - 0xde, 0xb7, 0x00, 0xf7, 0xed, 0xd9, 0x26, 0x38, 0x77, 0x1f, 0x6d, 0x1c, 0x40, 0x70, 0xbc, 0xc5, - 0xac, 0x6d, 0xf8, 0xfe, 0x66, 0x15, 0xb2, 0xdb, 0x55, 0xc8, 0x7e, 0xad, 0x42, 0xf6, 0x7b, 0x15, - 0xb2, 0x9f, 0x7f, 0xc2, 0x83, 0x4f, 0xa7, 0x1b, 0x4f, 0x42, 0xa1, 0x55, 0x96, 0x0d, 0xc6, 0xb8, - 0x88, 0x0b, 0x94, 0x13, 0x3d, 0xb0, 0x0f, 0x82, 0x59, 0x2a, 0xf5, 0x8c, 0x78, 0xfd, 0x2f, 0x00, - 0x00, 0xff, 0xff, 0x88, 0xd9, 0x75, 0x33, 0xa0, 0x04, 0x00, 0x00, + // 461 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x94, 0xcf, 0x6e, 0xd3, 0x40, + 0x10, 0xc6, 0xbb, 0xfc, 0x31, 0x65, 0x12, 0x8a, 0xb4, 0x4d, 0x22, 0xcb, 0x07, 0x37, 0x8a, 0x10, + 0x8a, 0x84, 0x62, 0x4b, 0x05, 0xa4, 0xaa, 0xc7, 0xb4, 0x87, 0x5e, 0xc2, 0xc1, 0x95, 0x38, 0x70, + 0x5b, 0x3b, 0x93, 0xc4, 0x82, 0x78, 0x17, 0xef, 0x38, 0x52, 0x1e, 0x02, 0xc1, 0x91, 0x47, 0xea, + 0xb1, 0x47, 0x4e, 0x15, 0x0a, 0x47, 0x5e, 0x02, 0x75, 0x77, 0x1d, 0x92, 0xf4, 0x05, 0x72, 0xcb, + 0xf7, 0x1b, 0x7f, 0x9b, 0x6f, 0x76, 0x67, 0x17, 0x8e, 0x35, 0x09, 0xc2, 0x58, 0x63, 0xb9, 0xc8, + 0x33, 0x8c, 0x54, 0x29, 0x49, 0xf2, 0xa7, 0x06, 0x06, 0xdc, 0xd1, 0x78, 0x8e, 0x24, 0x6c, 0x29, + 0x68, 0xd5, 0x6c, 0x81, 0x65, 0x3e, 0x59, 0x3a, 0xda, 0x4e, 0xa5, 0x24, 0x4d, 0xa5, 0x50, 0x31, + 0x2d, 0x15, 0x6a, 0x87, 0x07, 0xd3, 0x9c, 0x66, 0x55, 0x1a, 0x65, 0x72, 0x1e, 0x4f, 0xe5, 0x54, + 0xc6, 0x06, 0xa7, 0xd5, 0xc4, 0x28, 0x23, 0xcc, 0x2f, 0xfb, 0x79, 0xef, 0x3b, 0x83, 0x17, 0x1f, + 0x90, 0xe6, 0x42, 0x25, 0xf8, 0xb5, 0x42, 0x4d, 0xfc, 0x0c, 0x9e, 0x8c, 0x90, 0x84, 0x9f, 0x76, + 0x59, 0xbf, 0x71, 0x1a, 0x44, 0x75, 0x4c, 0x57, 0xbf, 0xaf, 0x5d, 0xa1, 0x18, 0x63, 0x39, 0x3c, + 0xbc, 0xb9, 0x3b, 0x39, 0xb8, 0xbd, 0x3b, 0x61, 0x89, 0x71, 0xf0, 0x4b, 0xf0, 0x3e, 0x9a, 0x84, + 0x7e, 0x66, 0xbc, 0xbd, 0x5d, 0xaf, 0xa9, 0xe6, 0x99, 0xa0, 0x5c, 0x16, 0x0f, 0xd6, 0x70, 0xde, + 0xde, 0x0f, 0x06, 0x47, 0x23, 0xa4, 0x32, 0xcf, 0xf4, 0xbe, 0x44, 0x7a, 0x03, 0x2f, 0xd7, 0x89, + 0xb4, 0x92, 0x85, 0x46, 0xee, 0xc3, 0x33, 0x87, 0x7c, 0xd6, 0x7d, 0xdc, 0x6f, 0x26, 0xb5, 0x34, + 0x3b, 0x7a, 0x85, 0xe2, 0x0b, 0xcd, 0xf6, 0x25, 0xfe, 0x10, 0x8e, 0xea, 0x40, 0xff, 0xd3, 0x5b, + 0xb2, 0xf4, 0x59, 0x97, 0xf5, 0x0f, 0x93, 0x5a, 0xf2, 0x0e, 0x78, 0xd7, 0x24, 0xa8, 0xd2, 0xfe, + 0xa3, 0x2e, 0xeb, 0x3f, 0x4f, 0x9c, 0xea, 0x7d, 0x63, 0xd0, 0xb8, 0xac, 0xe6, 0x7b, 0x33, 0x25, + 0xaf, 0xa1, 0x69, 0xe3, 0xb8, 0x8e, 0x3a, 0xe0, 0x5d, 0xc8, 0x62, 0x92, 0x4f, 0x4d, 0x43, 0xcd, + 0xc4, 0xa9, 0xd3, 0xbf, 0xac, 0x6e, 0x88, 0xbf, 0x03, 0xcf, 0x4e, 0x3a, 0x6f, 0x45, 0xe6, 0xb2, + 0x45, 0x5b, 0x83, 0x1f, 0xb4, 0xa2, 0xf5, 0x8d, 0x8a, 0xae, 0x55, 0x89, 0x62, 0x3c, 0x12, 0x8a, + 0x9f, 0xad, 0x0f, 0x9a, 0xb7, 0x9d, 0x6d, 0x7b, 0x3a, 0x83, 0xce, 0x2e, 0x76, 0x91, 0xce, 0xa1, + 0x61, 0x77, 0xf5, 0x62, 0x86, 0xd9, 0xe7, 0xf5, 0x9f, 0x6e, 0xcd, 0x46, 0xd0, 0xde, 0xa1, 0xce, + 0xfb, 0x1e, 0xe0, 0xbe, 0x3d, 0xdb, 0x04, 0xe7, 0xee, 0xa3, 0x8d, 0x03, 0x08, 0x8e, 0xb7, 0x98, + 0xb5, 0x0d, 0xcf, 0x6f, 0x56, 0x21, 0xbb, 0x5d, 0x85, 0xec, 0xd7, 0x2a, 0x64, 0xbf, 0x57, 0x21, + 0xfb, 0xf9, 0x27, 0x3c, 0xf8, 0xf4, 0x6a, 0xe3, 0x49, 0x28, 0xb4, 0xca, 0xb2, 0xc1, 0x18, 0x17, + 0x71, 0x81, 0x72, 0xa2, 0x07, 0x42, 0xe5, 0xb1, 0x59, 0x28, 0xf5, 0xcc, 0x83, 0xf0, 0xf6, 0x5f, + 0x00, 0x00, 0x00, 0xff, 0xff, 0x32, 0x55, 0xc1, 0x4b, 0x9e, 0x04, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/state/service.proto b/state/service.proto index a30af22..7966d43 100644 --- a/state/service.proto +++ b/state/service.proto @@ -1,6 +1,6 @@ syntax = "proto3"; package state; -option go_package = "github.com/nspcc-dev/neofs-proto/state"; +option go_package = "github.com/nspcc-dev/neofs-api/state"; import "service/meta.proto"; import "service/verify.proto"; diff --git a/storagegroup/storage.go b/storagegroup/storage.go index a23ef74..d41af49 100644 --- a/storagegroup/storage.go +++ b/storagegroup/storage.go @@ -3,7 +3,7 @@ package storagegroup import ( "context" - "github.com/nspcc-dev/neofs-proto/refs" + "github.com/nspcc-dev/neofs-api/refs" ) type ( diff --git a/storagegroup/types.go b/storagegroup/types.go index 6c6f775..52c1410 100644 --- a/storagegroup/types.go +++ b/storagegroup/types.go @@ -7,8 +7,8 @@ import ( "github.com/gogo/protobuf/proto" "github.com/mr-tron/base58" - "github.com/nspcc-dev/neofs-proto/hash" - "github.com/nspcc-dev/neofs-proto/refs" + "github.com/nspcc-dev/neofs-api/hash" + "github.com/nspcc-dev/neofs-api/refs" ) type ( diff --git a/storagegroup/types.pb.go b/storagegroup/types.pb.go index f052885..aae646a 100644 --- a/storagegroup/types.pb.go +++ b/storagegroup/types.pb.go @@ -170,30 +170,30 @@ func init() { func init() { proto.RegisterFile("storagegroup/types.proto", fileDescriptor_cfa54edc899249a8) } var fileDescriptor_cfa54edc899249a8 = []byte{ - // 353 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x51, 0x31, 0x4f, 0xc2, 0x40, - 0x18, 0xed, 0x41, 0x35, 0xf5, 0xac, 0x84, 0x5c, 0x1c, 0x1a, 0x86, 0x96, 0xe0, 0xd2, 0x85, 0x36, - 0x01, 0x27, 0xc7, 0xaa, 0xe8, 0xa0, 0x0e, 0x45, 0x18, 0xdc, 0x8e, 0x72, 0x94, 0x4b, 0xda, 0xbb, - 0x86, 0x5e, 0x8d, 0xfa, 0x4b, 0x58, 0x4c, 0xfc, 0x39, 0x8c, 0x8e, 0xc6, 0xa1, 0x31, 0x75, 0xf2, - 0x5f, 0x18, 0xae, 0x8a, 0x8d, 0x71, 0x70, 0xfb, 0xde, 0xfb, 0xde, 0xfb, 0xf2, 0xbd, 0x3c, 0x68, - 0xa4, 0x82, 0x2f, 0x70, 0x48, 0xc2, 0x05, 0xcf, 0x12, 0x57, 0xdc, 0x27, 0x24, 0x75, 0x92, 0x05, - 0x17, 0x1c, 0xe9, 0xd5, 0x4d, 0xab, 0x1b, 0x52, 0x31, 0xcf, 0x26, 0x4e, 0xc0, 0x63, 0x37, 0xe4, - 0x21, 0x77, 0xa5, 0x68, 0x92, 0xcd, 0x24, 0x92, 0x40, 0x4e, 0xa5, 0xb9, 0xf3, 0x51, 0x83, 0xfa, - 0xb0, 0xf4, 0x9f, 0xad, 0xfd, 0xc8, 0x81, 0x68, 0x8c, 0x23, 0x3a, 0xc5, 0x82, 0x72, 0x76, 0x82, - 0x05, 0x1e, 0xd2, 0x07, 0x62, 0x80, 0x36, 0xb0, 0x55, 0xff, 0x8f, 0x0d, 0x3a, 0x84, 0x8d, 0x1f, - 0xf6, 0x1c, 0xa7, 0x73, 0xa3, 0xd6, 0x06, 0xb6, 0xee, 0xe9, 0xab, 0xdc, 0x52, 0x5e, 0x73, 0x4b, - 0x5d, 0x73, 0xfe, 0x2f, 0x0d, 0xba, 0x84, 0x5a, 0x44, 0x67, 0x44, 0xd0, 0x98, 0x18, 0xf5, 0x36, - 0xb0, 0x77, 0x7b, 0x07, 0x4e, 0x35, 0x86, 0x53, 0xfd, 0xc9, 0xb9, 0xf8, 0x92, 0x7a, 0x7a, 0x91, - 0x5b, 0xda, 0x37, 0xf2, 0x37, 0x27, 0x5a, 0x8f, 0x00, 0x6e, 0x68, 0x34, 0x80, 0x6a, 0xc6, 0xa8, - 0x90, 0x3f, 0x37, 0x7a, 0xf6, 0x3f, 0xee, 0x3a, 0x23, 0x46, 0x85, 0xa7, 0x15, 0xb9, 0xa5, 0xae, - 0x27, 0x5f, 0xfa, 0xd1, 0x3e, 0xdc, 0x1a, 0xe3, 0x28, 0x23, 0x32, 0x50, 0xdd, 0x2f, 0x41, 0xa7, - 0x0f, 0xa5, 0x06, 0xed, 0xc1, 0x9d, 0x11, 0x8b, 0x68, 0x4c, 0x05, 0x99, 0x36, 0x15, 0xd4, 0x80, - 0xf0, 0x8a, 0xf0, 0xc1, 0xf0, 0x34, 0xe1, 0xc1, 0xbc, 0x09, 0x90, 0x0e, 0xb5, 0x11, 0xa3, 0x77, - 0xd7, 0x34, 0x26, 0xcd, 0xda, 0x91, 0xba, 0x7c, 0xb2, 0x14, 0xef, 0x78, 0x55, 0x98, 0xe0, 0xb9, - 0x30, 0xc1, 0x4b, 0x61, 0x82, 0xb7, 0xc2, 0x04, 0xcb, 0x77, 0x53, 0xb9, 0xa9, 0x16, 0xc6, 0xd2, - 0x24, 0x08, 0xba, 0x53, 0x72, 0xeb, 0x32, 0xc2, 0x67, 0x69, 0xb7, 0xac, 0xab, 0x1a, 0x60, 0xb2, - 0x2d, 0xb9, 0xfe, 0x67, 0x00, 0x00, 0x00, 0xff, 0xff, 0x91, 0x55, 0xe3, 0x01, 0x10, 0x02, 0x00, - 0x00, + // 359 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x51, 0xb1, 0x4e, 0xe3, 0x40, + 0x14, 0xf4, 0x26, 0xbe, 0x93, 0x6f, 0xcf, 0x17, 0x45, 0xab, 0x2b, 0xac, 0x14, 0x76, 0x14, 0x1a, + 0x4b, 0x28, 0x6b, 0x29, 0xa1, 0xa2, 0xc3, 0x82, 0x40, 0x01, 0x14, 0x0e, 0x49, 0x41, 0xb7, 0x71, + 0x36, 0xce, 0x4a, 0xf6, 0xae, 0x15, 0xaf, 0x11, 0xf0, 0x25, 0x69, 0x90, 0xf8, 0x9c, 0x94, 0x94, + 0x88, 0xc2, 0x42, 0xa6, 0xe2, 0x2f, 0x50, 0x36, 0x10, 0x2c, 0x44, 0x41, 0xf7, 0x66, 0xde, 0xcc, + 0xd3, 0x3c, 0x0d, 0xb4, 0x32, 0x29, 0x16, 0x24, 0xa2, 0xd1, 0x42, 0xe4, 0xa9, 0x27, 0x6f, 0x52, + 0x9a, 0xe1, 0x74, 0x21, 0xa4, 0x40, 0x66, 0x75, 0xd3, 0xea, 0x46, 0x4c, 0xce, 0xf3, 0x09, 0x0e, + 0x45, 0xe2, 0x45, 0x22, 0x12, 0x9e, 0x12, 0x4d, 0xf2, 0x99, 0x42, 0x0a, 0xa8, 0x69, 0x63, 0xee, + 0xbc, 0xd6, 0xa0, 0x39, 0xdc, 0xf8, 0x8f, 0xd7, 0x7e, 0x84, 0x21, 0x1a, 0x93, 0x98, 0x4d, 0x89, + 0x64, 0x82, 0x1f, 0x12, 0x49, 0x86, 0xec, 0x96, 0x5a, 0xa0, 0x0d, 0x5c, 0x3d, 0xf8, 0x66, 0x83, + 0xf6, 0x60, 0xe3, 0x93, 0x3d, 0x21, 0xd9, 0xdc, 0xaa, 0xb5, 0x81, 0x6b, 0xfa, 0xe6, 0xaa, 0x70, + 0xb4, 0xa7, 0xc2, 0xd1, 0xd7, 0x5c, 0xf0, 0x45, 0x83, 0xce, 0xa0, 0x11, 0xb3, 0x19, 0x95, 0x2c, + 0xa1, 0x56, 0xbd, 0x0d, 0xdc, 0xbf, 0xbd, 0x1d, 0x5c, 0x7d, 0x03, 0x57, 0x33, 0xe1, 0xd3, 0x77, + 0xa9, 0x6f, 0x96, 0x85, 0x63, 0x7c, 0xa0, 0x60, 0x7b, 0xa2, 0x75, 0x07, 0xe0, 0x96, 0x46, 0x03, + 0xa8, 0xe7, 0x9c, 0x49, 0x95, 0xb9, 0xd1, 0x73, 0x7f, 0x70, 0x17, 0x8f, 0x38, 0x93, 0xbe, 0x51, + 0x16, 0x8e, 0xbe, 0x9e, 0x02, 0xe5, 0x47, 0xff, 0xe1, 0xaf, 0x31, 0x89, 0x73, 0xaa, 0x1e, 0xaa, + 0x07, 0x1b, 0xd0, 0xe9, 0x43, 0xa5, 0x41, 0xff, 0xe0, 0x9f, 0x11, 0x8f, 0x59, 0xc2, 0x24, 0x9d, + 0x36, 0x35, 0xd4, 0x80, 0xf0, 0x9c, 0x8a, 0xc1, 0xf0, 0x28, 0x15, 0xe1, 0xbc, 0x09, 0x90, 0x09, + 0x8d, 0x11, 0x67, 0xd7, 0x17, 0x2c, 0xa1, 0xcd, 0xda, 0xbe, 0xbe, 0xbc, 0x77, 0x34, 0xff, 0x60, + 0x55, 0xda, 0xe0, 0xa1, 0xb4, 0xc1, 0x63, 0x69, 0x83, 0xe7, 0xd2, 0x06, 0xcb, 0x17, 0x5b, 0xbb, + 0xdc, 0xad, 0x14, 0xc6, 0xb3, 0x34, 0x0c, 0xbb, 0x53, 0x7a, 0xe5, 0x71, 0x2a, 0x66, 0x59, 0x97, + 0xa4, 0xcc, 0xab, 0xc6, 0x9f, 0xfc, 0x56, 0xad, 0xf5, 0xdf, 0x02, 0x00, 0x00, 0xff, 0xff, 0x74, + 0xed, 0x88, 0xb3, 0x0e, 0x02, 0x00, 0x00, } func (m *StorageGroup) Marshal() (dAtA []byte, err error) { diff --git a/storagegroup/types.proto b/storagegroup/types.proto index 5014b96..238b454 100644 --- a/storagegroup/types.proto +++ b/storagegroup/types.proto @@ -1,6 +1,6 @@ syntax = "proto3"; package storagegroup; -option go_package = "github.com/nspcc-dev/neofs-proto/storagegroup"; +option go_package = "github.com/nspcc-dev/neofs-api/storagegroup"; import "github.com/gogo/protobuf/gogoproto/gogo.proto"; From 80fde665ca70eda980cc0b23c30a0b7dfda9688c Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Thu, 30 Jan 2020 16:38:52 +0300 Subject: [PATCH 0084/1196] code format --- object/verification.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/object/verification.go b/object/verification.go index 742375a..a00b30a 100644 --- a/object/verification.go +++ b/object/verification.go @@ -68,10 +68,10 @@ func (m Object) Verify() error { var ( err error checksum []byte - pubkey []byte + pubkey []byte ) ind, ih := m.LastHeader(HeaderType(IntegrityHdr)) - if ih == nil || ind != len(m.Headers) - 1{ + if ih == nil || ind != len(m.Headers)-1 { return ErrHeaderNotFound } integrity := ih.Value.(*Header_Integrity).Integrity From 3f5a819af699e967dc2269291d32cc39b8232b02 Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Mon, 3 Feb 2020 11:35:35 +0300 Subject: [PATCH 0085/1196] CHANGELOG --- CHANGELOG.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 27d0e93..281bedc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,15 @@ # Changelog This is the changelog for NeoFS Proto +## [0.2.13] - 2020-02-03 + +### Fixed +- Code format + +### Changed +- Use separated proto repository +- Rename neofs-proto to neofs-api + ## [0.2.12] - 2020-01-27 ### Fixed @@ -124,3 +133,4 @@ Initial public release [0.2.10]: https://github.com/nspcc-dev/neofs-api/compare/v0.2.9...v0.2.10 [0.2.11]: https://github.com/nspcc-dev/neofs-api/compare/v0.2.10...v0.2.11 [0.2.12]: https://github.com/nspcc-dev/neofs-api/compare/v0.2.11...v0.2.12 +[0.2.13]: https://github.com/nspcc-dev/neofs-api/compare/v0.2.12...v0.2.13 From 0d3aa8bf4ebd0e036ae130126d73e29c7e357db6 Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Mon, 3 Feb 2020 11:39:03 +0300 Subject: [PATCH 0086/1196] Update README --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index a6662c3..d9a97b8 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# NeoFS-proto +# NeoFS API -NeoFS-proto repository contains implementation of core NeoFS structures that +NeoFS API repository contains implementation of core NeoFS structures that can be used for integration with NeoFS. ## Description @@ -107,7 +107,7 @@ State package defines: ## How to use -NeoFS-proto packages contain godoc documentation. Examples of using most of +NeoFS API packages contain godoc documentation. Examples of using most of these packages can be found in NeoFS-CLI repository. CLI implements and demonstrates all basic interactions with NeoFS: container, object, storage group, and accounting operations. From d75a56f92e2861985de366275607e99a3cf665cf Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Mon, 3 Feb 2020 12:36:37 +0300 Subject: [PATCH 0087/1196] Update Object.Search, stream --- docs/object.md | 2 +- object/service.pb.go | 187 +++++++++++++++++++++++++------------------ object/service.proto | 2 +- 3 files changed, 109 insertions(+), 82 deletions(-) diff --git a/docs/object.md b/docs/object.md index e749b98..dbdd6dc 100644 --- a/docs/object.md +++ b/docs/object.md @@ -63,7 +63,7 @@ rpc Get(GetRequest) returns (stream GetResponse); rpc Put(stream PutRequest) returns (PutResponse); rpc Delete(DeleteRequest) returns (DeleteResponse); rpc Head(HeadRequest) returns (HeadResponse); -rpc Search(SearchRequest) returns (SearchResponse); +rpc Search(SearchRequest) returns (stream SearchResponse); rpc GetRange(GetRangeRequest) returns (GetRangeResponse); rpc GetRangeHash(GetRangeHashRequest) returns (GetRangeHashResponse); diff --git a/object/service.pb.go b/object/service.pb.go index 43013fe..05e7c4b 100644 --- a/object/service.pb.go +++ b/object/service.pb.go @@ -883,60 +883,60 @@ func init() { func init() { proto.RegisterFile("object/service.proto", fileDescriptor_dfcdf610ade6a9ce) } var fileDescriptor_dfcdf610ade6a9ce = []byte{ - // 843 bytes of a gzipped FileDescriptorProto + // 846 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x56, 0x4d, 0x4f, 0x33, 0x55, - 0x14, 0xee, 0xed, 0x94, 0x01, 0x4e, 0xa7, 0xd0, 0x5c, 0x2a, 0x36, 0x23, 0x29, 0x64, 0x82, 0xa6, - 0xc6, 0x74, 0x8a, 0x98, 0x00, 0x89, 0xb8, 0xb0, 0x6d, 0xa0, 0x2c, 0x0c, 0x78, 0x21, 0x24, 0xba, - 0x9b, 0x4e, 0x6f, 0xdb, 0x91, 0x32, 0x53, 0xe7, 0x03, 0xc2, 0x0f, 0x70, 0xed, 0xd6, 0x85, 0x3f, - 0xc5, 0x1f, 0xc0, 0xc6, 0x84, 0xa5, 0x71, 0x41, 0x4c, 0x5d, 0xbb, 0x37, 0x71, 0x63, 0xee, 0xc7, - 0x74, 0xa6, 0x45, 0x50, 0x59, 0xbc, 0x7d, 0x57, 0x3d, 0xf7, 0x39, 0x5f, 0x3d, 0xcf, 0x3c, 0xe7, - 0xce, 0x40, 0xc9, 0xeb, 0x7c, 0x43, 0xed, 0xb0, 0x1e, 0x50, 0xff, 0xc6, 0xb1, 0xa9, 0x39, 0xf2, - 0xbd, 0xd0, 0xc3, 0xaa, 0x40, 0xf5, 0xa2, 0x4f, 0x7b, 0x41, 0x3d, 0xbc, 0x1b, 0xd1, 0x40, 0x78, - 0x74, 0x2c, 0xe3, 0xd3, 0xd8, 0x5a, 0x40, 0x83, 0xc0, 0xf1, 0xdc, 0xe9, 0x40, 0x59, 0xb1, 0x7e, - 0x4d, 0x43, 0x4b, 0x62, 0xa5, 0x18, 0xbb, 0xa1, 0xbe, 0xd3, 0xbb, 0x93, 0x68, 0xad, 0xef, 0x84, - 0x83, 0xa8, 0x63, 0xda, 0xde, 0x75, 0xbd, 0xef, 0xf5, 0xbd, 0x3a, 0x87, 0x3b, 0x51, 0x8f, 0x9f, - 0xf8, 0x81, 0x5b, 0x22, 0xdc, 0xf8, 0x19, 0x01, 0x1c, 0xd3, 0x90, 0xd0, 0x6f, 0x23, 0x1a, 0x84, - 0xb8, 0x06, 0x8b, 0x9f, 0x77, 0xbb, 0x3e, 0x0d, 0x82, 0x32, 0xda, 0x42, 0xd5, 0xfc, 0x6e, 0xc1, - 0x64, 0x7f, 0xda, 0x94, 0x60, 0x23, 0x77, 0xff, 0xb8, 0x99, 0x21, 0x71, 0x0c, 0x2e, 0x82, 0x42, - 0xac, 0xdb, 0x72, 0x76, 0x0b, 0x55, 0x97, 0x08, 0x33, 0xf1, 0x01, 0xe4, 0xbe, 0xa0, 0xa1, 0x55, - 0xee, 0xf0, 0x6c, 0xdd, 0x8c, 0x99, 0x90, 0x0d, 0x98, 0xaf, 0x4d, 0xad, 0x2e, 0xf5, 0x1b, 0x4b, - 0xac, 0xd4, 0xc3, 0xe3, 0x26, 0x22, 0x3c, 0x03, 0xb7, 0x40, 0xbd, 0xe4, 0x83, 0x94, 0x6d, 0x9e, - 0x6b, 0xcc, 0xe6, 0x72, 0xaf, 0x63, 0x5b, 0xa1, 0xe3, 0xb9, 0x4f, 0x6a, 0xc8, 0x5c, 0xe3, 0x02, - 0xf2, 0x7c, 0x9c, 0x60, 0xe4, 0xb9, 0x01, 0xc5, 0x55, 0x90, 0xe4, 0xcb, 0x71, 0x56, 0x4c, 0x71, - 0x34, 0x4f, 0xf9, 0x4f, 0x3b, 0x43, 0xa4, 0x1f, 0xaf, 0xc3, 0x42, 0x73, 0x10, 0xb9, 0x57, 0x7c, - 0x18, 0xad, 0x9d, 0x21, 0xe2, 0xd8, 0x50, 0x00, 0x11, 0xe3, 0xa7, 0x2c, 0xc0, 0x59, 0x34, 0x61, - 0x69, 0x0f, 0x54, 0xf1, 0x07, 0x64, 0xd5, 0x8d, 0xb8, 0x6a, 0x12, 0xc3, 0x4c, 0x11, 0xc3, 0x7a, - 0x08, 0xeb, 0xb9, 0x1e, 0xf3, 0x26, 0x4d, 0xff, 0x0a, 0x96, 0x27, 0x7f, 0x17, 0x7f, 0x00, 0xea, - 0xe9, 0x0b, 0x94, 0x11, 0xe9, 0xc5, 0xdb, 0xb0, 0x70, 0xe1, 0x5d, 0x51, 0x97, 0x0f, 0xc3, 0xc2, - 0xa4, 0x6e, 0x4d, 0x8e, 0x12, 0xe1, 0x14, 0xf4, 0x1d, 0x42, 0x9e, 0x33, 0x23, 0x1f, 0xca, 0xff, - 0x13, 0x99, 0xf1, 0x7d, 0x16, 0x0a, 0x2d, 0x3a, 0xa4, 0x21, 0x7d, 0xa5, 0x4a, 0x3f, 0x84, 0xc5, - 0xd3, 0x5b, 0x97, 0xfa, 0x27, 0x2d, 0x41, 0x7c, 0x63, 0x95, 0xf9, 0x7f, 0x7d, 0xdc, 0x8c, 0x61, - 0x12, 0x1b, 0xc9, 0x50, 0xca, 0x0b, 0x43, 0xcd, 0x5d, 0xe4, 0x45, 0x58, 0x89, 0x09, 0x11, 0x94, - 0x1a, 0x7f, 0x21, 0xc8, 0xb3, 0xf0, 0x98, 0xa1, 0x83, 0x7f, 0x61, 0x68, 0xc2, 0x80, 0x04, 0x12, - 0xb2, 0xb6, 0x20, 0x7f, 0x14, 0x0d, 0x87, 0xa2, 0x77, 0x20, 0x57, 0x3b, 0x0d, 0xc5, 0x4b, 0xaf, - 0xbc, 0x3d, 0x4b, 0xbf, 0x07, 0x9a, 0x18, 0x5e, 0x0a, 0xec, 0x3f, 0x4a, 0xd8, 0xf8, 0x13, 0x41, - 0xe1, 0x9c, 0x5a, 0xbe, 0x3d, 0x48, 0x94, 0x95, 0x6f, 0x7a, 0x6e, 0x68, 0x39, 0x42, 0x2e, 0x88, - 0xcb, 0x25, 0x2f, 0xc9, 0x52, 0x9a, 0x27, 0x2d, 0x92, 0xf6, 0xe3, 0x12, 0x2c, 0x7c, 0x19, 0x51, - 0xff, 0x4e, 0xe8, 0x8a, 0x88, 0x03, 0x36, 0x40, 0xe3, 0xc6, 0x25, 0xf5, 0x99, 0x76, 0x38, 0x53, - 0x05, 0x32, 0x85, 0xcd, 0x9d, 0xb2, 0x26, 0xac, 0xc4, 0x93, 0x4b, 0xd2, 0x3e, 0x86, 0x65, 0xa9, - 0x01, 0xca, 0x44, 0xa3, 0x3c, 0xb7, 0x56, 0x49, 0x94, 0xf1, 0x07, 0x82, 0x55, 0x76, 0xdb, 0x5a, - 0x6e, 0xff, 0xb5, 0xbb, 0xf9, 0x11, 0xa8, 0x3c, 0x9d, 0x29, 0x4d, 0xb4, 0x94, 0x8f, 0x8a, 0xa3, - 0x32, 0x5a, 0x86, 0xcc, 0x9d, 0xb4, 0x1d, 0x28, 0x26, 0xe3, 0x4a, 0xda, 0x36, 0x60, 0xf9, 0xc8, - 0xb7, 0xfa, 0xd7, 0xd4, 0x0d, 0x05, 0x6d, 0x1a, 0x49, 0x00, 0xe3, 0xbb, 0x2c, 0xac, 0xc5, 0x29, - 0x6d, 0x2b, 0x18, 0xbc, 0x09, 0x96, 0x30, 0xe4, 0xce, 0xad, 0x61, 0xc8, 0x65, 0xa7, 0x11, 0x6e, - 0xcf, 0x9d, 0xb9, 0x43, 0x28, 0x4d, 0xd3, 0x20, 0xd9, 0xdb, 0x06, 0x95, 0x9d, 0xa5, 0xe2, 0xb4, - 0x86, 0x26, 0x57, 0x2d, 0xc7, 0xa3, 0xa4, 0x6f, 0xf7, 0x47, 0x05, 0x16, 0xcf, 0x45, 0x57, 0xbc, - 0x03, 0xca, 0x31, 0x0d, 0x31, 0x8e, 0x19, 0x48, 0x3e, 0x5e, 0xf4, 0xb5, 0x29, 0x4c, 0x74, 0xd8, - 0x41, 0x2c, 0xe3, 0x2c, 0x4a, 0x65, 0x24, 0x2f, 0xe9, 0x24, 0x23, 0xf5, 0x7a, 0xaa, 0x22, 0xbc, - 0x0f, 0xaa, 0xb8, 0x5f, 0xf1, 0x3b, 0x71, 0xc0, 0xd4, 0x0b, 0x48, 0x5f, 0x9f, 0x85, 0x27, 0x3b, - 0x94, 0x63, 0x14, 0xe0, 0x49, 0xdd, 0xd4, 0x9d, 0xac, 0x97, 0xa6, 0x41, 0x99, 0xb2, 0x0f, 0xaa, - 0x58, 0xc4, 0xa4, 0xd7, 0xd4, 0x95, 0x94, 0xf4, 0x9a, 0xd9, 0xd7, 0xcf, 0x60, 0x29, 0xa6, 0x14, - 0xbf, 0x9b, 0x9e, 0x3c, 0xb5, 0x8d, 0x7a, 0xf9, 0xa9, 0x43, 0xa6, 0x9f, 0x80, 0x96, 0x7e, 0x22, - 0xf8, 0xbd, 0xd9, 0xc8, 0x94, 0x5c, 0xf5, 0x8d, 0x7f, 0x76, 0x8a, 0x52, 0x8d, 0x4f, 0xef, 0xc7, - 0x15, 0xf4, 0x30, 0xae, 0xa0, 0x5f, 0xc6, 0x15, 0xf4, 0xdb, 0xb8, 0x82, 0x7e, 0xf8, 0xbd, 0x92, - 0xf9, 0xfa, 0xfd, 0xd4, 0x87, 0xa8, 0x1b, 0x8c, 0x6c, 0xbb, 0xd6, 0xa5, 0x37, 0x75, 0x97, 0x7a, - 0xbd, 0xa0, 0x66, 0x8d, 0x9c, 0xba, 0xa8, 0xd8, 0x51, 0xf9, 0x77, 0xe8, 0x27, 0x7f, 0x07, 0x00, - 0x00, 0xff, 0xff, 0xfc, 0xc2, 0x63, 0xdb, 0x3b, 0x0b, 0x00, 0x00, + 0x14, 0xee, 0xed, 0x94, 0x01, 0x4e, 0xa7, 0xbc, 0xcd, 0xa5, 0xbe, 0x36, 0x23, 0x29, 0x64, 0x82, + 0xa6, 0xc6, 0x74, 0x5a, 0x31, 0x41, 0x8c, 0xb8, 0xb0, 0x6d, 0xa0, 0x2c, 0x0c, 0x78, 0x21, 0x24, + 0xba, 0x9b, 0x4e, 0x6f, 0xdb, 0x91, 0x32, 0x53, 0xe7, 0x03, 0xc2, 0x0f, 0x70, 0xed, 0xd6, 0x95, + 0xbf, 0xc4, 0x1f, 0xc0, 0xc6, 0x84, 0xa5, 0x71, 0x41, 0x4c, 0x5d, 0xbb, 0x37, 0x71, 0x63, 0xee, + 0xc7, 0x74, 0x66, 0x40, 0x50, 0x59, 0x58, 0x57, 0x3d, 0xf7, 0x39, 0x5f, 0x3d, 0xcf, 0x3c, 0xe7, + 0xce, 0x40, 0xc5, 0xeb, 0x7f, 0x45, 0xed, 0xb0, 0x19, 0x50, 0xff, 0xca, 0xb1, 0xa9, 0x39, 0xf5, + 0xbd, 0xd0, 0xc3, 0xaa, 0x40, 0xf5, 0xb2, 0x4f, 0x87, 0x41, 0x33, 0xbc, 0x99, 0xd2, 0x40, 0x78, + 0x74, 0x2c, 0xe3, 0xd3, 0xd8, 0x7a, 0x40, 0x83, 0xc0, 0xf1, 0xdc, 0x6c, 0xa0, 0xac, 0xd8, 0xbc, + 0xa4, 0xa1, 0x25, 0xb1, 0x4a, 0x8c, 0x5d, 0x51, 0xdf, 0x19, 0xde, 0x48, 0xb4, 0x31, 0x72, 0xc2, + 0x71, 0xd4, 0x37, 0x6d, 0xef, 0xb2, 0x39, 0xf2, 0x46, 0x5e, 0x93, 0xc3, 0xfd, 0x68, 0xc8, 0x4f, + 0xfc, 0xc0, 0x2d, 0x11, 0x6e, 0xfc, 0x88, 0x00, 0x0e, 0x69, 0x48, 0xe8, 0xd7, 0x11, 0x0d, 0x42, + 0xdc, 0x80, 0xe5, 0x4f, 0x07, 0x03, 0x9f, 0x06, 0x41, 0x15, 0x6d, 0xa1, 0x7a, 0x71, 0xa7, 0x64, + 0xb2, 0x3f, 0x6d, 0x4a, 0xb0, 0x5d, 0xb8, 0xbd, 0xdf, 0xcc, 0x91, 0x38, 0x06, 0x97, 0x41, 0x21, + 0xd6, 0x75, 0x35, 0xbf, 0x85, 0xea, 0x2b, 0x84, 0x99, 0x78, 0x0f, 0x0a, 0x9f, 0xd1, 0xd0, 0xaa, + 0xf6, 0x79, 0xb6, 0x6e, 0xc6, 0x4c, 0xc8, 0x06, 0xcc, 0xd7, 0xa3, 0xd6, 0x80, 0xfa, 0xed, 0x15, + 0x56, 0xea, 0xee, 0x7e, 0x13, 0x11, 0x9e, 0x81, 0xbb, 0xa0, 0x9e, 0xf3, 0x41, 0xaa, 0x36, 0xcf, + 0x35, 0x1e, 0xe6, 0x72, 0xaf, 0x63, 0x5b, 0xa1, 0xe3, 0xb9, 0x8f, 0x6a, 0xc8, 0x5c, 0xe3, 0x0c, + 0x8a, 0x7c, 0x9c, 0x60, 0xea, 0xb9, 0x01, 0xc5, 0x75, 0x90, 0xe4, 0xcb, 0x71, 0xd6, 0x4c, 0x71, + 0x34, 0x8f, 0xf9, 0x4f, 0x2f, 0x47, 0xa4, 0x1f, 0xbf, 0x86, 0xa5, 0xce, 0x38, 0x72, 0x2f, 0xf8, + 0x30, 0x5a, 0x2f, 0x47, 0xc4, 0xb1, 0xad, 0x00, 0x22, 0xc6, 0x0f, 0x79, 0x80, 0x93, 0x68, 0xce, + 0xd2, 0x2e, 0xa8, 0xe2, 0x0f, 0xc8, 0xaa, 0x1b, 0x71, 0xd5, 0x24, 0x86, 0x99, 0x22, 0x86, 0xf5, + 0x10, 0xd6, 0x53, 0x3d, 0x16, 0x4d, 0x9a, 0xfe, 0x05, 0xac, 0xce, 0xff, 0x2e, 0x7e, 0x07, 0xd4, + 0xe3, 0x67, 0x28, 0x23, 0xd2, 0x8b, 0xb7, 0x61, 0xe9, 0xcc, 0xbb, 0xa0, 0x2e, 0x1f, 0x86, 0x85, + 0x49, 0xdd, 0x9a, 0x1c, 0x25, 0xc2, 0x29, 0xe8, 0xdb, 0x87, 0x22, 0x67, 0x46, 0x3e, 0x94, 0x7f, + 0x27, 0x32, 0xe3, 0xdb, 0x3c, 0x94, 0xba, 0x74, 0x42, 0x43, 0xfa, 0x42, 0x95, 0xbe, 0x0b, 0xcb, + 0xc7, 0xd7, 0x2e, 0xf5, 0x8f, 0xba, 0x82, 0xf8, 0xf6, 0x2b, 0xe6, 0xff, 0xf9, 0x7e, 0x33, 0x86, + 0x49, 0x6c, 0x24, 0x43, 0x29, 0xcf, 0x0c, 0xb5, 0x70, 0x91, 0x97, 0x61, 0x2d, 0x26, 0x44, 0x50, + 0x6a, 0xfc, 0x81, 0xa0, 0xc8, 0xc2, 0x63, 0x86, 0xf6, 0xfe, 0x86, 0xa1, 0x39, 0x03, 0x12, 0x48, + 0xc8, 0xda, 0x82, 0xe2, 0x41, 0x34, 0x99, 0x88, 0xde, 0x81, 0x5c, 0xed, 0x34, 0x14, 0x2f, 0xbd, + 0xf2, 0xff, 0x59, 0xfa, 0x5d, 0xd0, 0xc4, 0xf0, 0x52, 0x60, 0xff, 0x50, 0xc2, 0xc6, 0xef, 0x08, + 0x4a, 0xa7, 0xd4, 0xf2, 0xed, 0x71, 0xa2, 0xac, 0x62, 0xc7, 0x73, 0x43, 0xcb, 0x11, 0x72, 0x41, + 0x5c, 0x2e, 0x45, 0x49, 0x96, 0xd2, 0x39, 0xea, 0x92, 0xb4, 0x1f, 0x57, 0x60, 0xe9, 0xf3, 0x88, + 0xfa, 0x37, 0x42, 0x57, 0x44, 0x1c, 0xb0, 0x01, 0x1a, 0x37, 0xce, 0xa9, 0xcf, 0xb4, 0xc3, 0x99, + 0x2a, 0x91, 0x0c, 0xb6, 0x70, 0xca, 0x3a, 0xb0, 0x16, 0x4f, 0x2e, 0x49, 0x7b, 0x1f, 0x56, 0xa5, + 0x06, 0x28, 0x13, 0x8d, 0xf2, 0xd4, 0x5a, 0x25, 0x51, 0xc6, 0x6f, 0x08, 0x5e, 0xb1, 0xdb, 0xd6, + 0x72, 0x47, 0x2f, 0xdd, 0xcd, 0xf7, 0x40, 0xe5, 0xe9, 0x4c, 0x69, 0xa2, 0xa5, 0x7c, 0x54, 0x1c, + 0x95, 0xd1, 0x32, 0x64, 0xe1, 0xa4, 0xb5, 0xa0, 0x9c, 0x8c, 0x2b, 0x69, 0xdb, 0x80, 0xd5, 0x03, + 0xdf, 0x1a, 0x5d, 0x52, 0x37, 0x14, 0xb4, 0x69, 0x24, 0x01, 0x8c, 0x6f, 0xf2, 0xb0, 0x1e, 0xa7, + 0xf4, 0xac, 0x60, 0xfc, 0x5f, 0xb0, 0x84, 0xa1, 0x70, 0x6a, 0x4d, 0x42, 0x2e, 0x3b, 0x8d, 0x70, + 0x7b, 0xe1, 0xcc, 0xed, 0x43, 0x25, 0x4b, 0x83, 0x64, 0x6f, 0x1b, 0x54, 0x76, 0x96, 0x8a, 0xd3, + 0xda, 0x9a, 0x5c, 0xb5, 0x02, 0x8f, 0x92, 0xbe, 0x9d, 0xef, 0x15, 0x58, 0x3e, 0x15, 0x5d, 0x71, + 0x0b, 0x94, 0x43, 0x1a, 0x62, 0x1c, 0x33, 0x90, 0x7c, 0xbc, 0xe8, 0xeb, 0x19, 0x4c, 0x74, 0x68, + 0x21, 0x96, 0x71, 0x12, 0xa5, 0x32, 0x92, 0x97, 0x74, 0x92, 0x91, 0x7a, 0x3d, 0xd5, 0x11, 0xfe, + 0x10, 0x54, 0x71, 0xbf, 0xe2, 0x37, 0xe2, 0x80, 0xcc, 0x0b, 0x48, 0x7f, 0xfd, 0x10, 0x9e, 0xef, + 0x50, 0x81, 0x51, 0x80, 0xe7, 0x75, 0x53, 0x77, 0xb2, 0x5e, 0xc9, 0x82, 0x32, 0xe5, 0x23, 0x50, + 0xc5, 0x22, 0x26, 0xbd, 0x32, 0x57, 0x52, 0xd2, 0x2b, 0xbb, 0xaf, 0x2d, 0x84, 0x3f, 0x81, 0x95, + 0x98, 0x54, 0xfc, 0x66, 0x7a, 0xf6, 0xd4, 0x3e, 0xea, 0xd5, 0xc7, 0x0e, 0xd9, 0xf9, 0x08, 0xb4, + 0xf4, 0x33, 0xc1, 0x6f, 0x3d, 0x8c, 0x4c, 0x09, 0x56, 0xdf, 0xf8, 0x6b, 0xa7, 0x28, 0xd5, 0xfe, + 0xf8, 0x76, 0x56, 0x43, 0x77, 0xb3, 0x1a, 0xfa, 0x69, 0x56, 0x43, 0xbf, 0xcc, 0x6a, 0xe8, 0xbb, + 0x5f, 0x6b, 0xb9, 0x2f, 0xdf, 0x4e, 0x7d, 0x8a, 0xba, 0xc1, 0xd4, 0xb6, 0x1b, 0x03, 0x7a, 0xd5, + 0x74, 0xa9, 0x37, 0x0c, 0x1a, 0xd6, 0xd4, 0x69, 0x8a, 0x8a, 0x7d, 0x95, 0x7f, 0x89, 0x7e, 0xf0, + 0x67, 0x00, 0x00, 0x00, 0xff, 0xff, 0xee, 0x6d, 0x9e, 0x41, 0x3d, 0x0b, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -973,7 +973,7 @@ type ServiceClient interface { // Search objects in container. Version of query language format SHOULD BE // set to 1. Search query represented in serialized format (see query // package). - Search(ctx context.Context, in *SearchRequest, opts ...grpc.CallOption) (*SearchResponse, error) + Search(ctx context.Context, in *SearchRequest, opts ...grpc.CallOption) (Service_SearchClient, error) // GetRange of data payload. Ranges are set of pairs (offset, length). // Fragments order in response corresponds to ranges order in request. GetRange(ctx context.Context, in *GetRangeRequest, opts ...grpc.CallOption) (*GetRangeResponse, error) @@ -1076,13 +1076,36 @@ func (c *serviceClient) Head(ctx context.Context, in *HeadRequest, opts ...grpc. return out, nil } -func (c *serviceClient) Search(ctx context.Context, in *SearchRequest, opts ...grpc.CallOption) (*SearchResponse, error) { - out := new(SearchResponse) - err := c.cc.Invoke(ctx, "/object.Service/Search", in, out, opts...) +func (c *serviceClient) Search(ctx context.Context, in *SearchRequest, opts ...grpc.CallOption) (Service_SearchClient, error) { + stream, err := c.cc.NewStream(ctx, &_Service_serviceDesc.Streams[2], "/object.Service/Search", opts...) if err != nil { return nil, err } - return out, nil + x := &serviceSearchClient{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 +} + +type Service_SearchClient interface { + Recv() (*SearchResponse, error) + grpc.ClientStream +} + +type serviceSearchClient struct { + grpc.ClientStream +} + +func (x *serviceSearchClient) Recv() (*SearchResponse, error) { + m := new(SearchResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil } func (c *serviceClient) GetRange(ctx context.Context, in *GetRangeRequest, opts ...grpc.CallOption) (*GetRangeResponse, error) { @@ -1127,7 +1150,7 @@ type ServiceServer interface { // Search objects in container. Version of query language format SHOULD BE // set to 1. Search query represented in serialized format (see query // package). - Search(context.Context, *SearchRequest) (*SearchResponse, error) + Search(*SearchRequest, Service_SearchServer) error // GetRange of data payload. Ranges are set of pairs (offset, length). // Fragments order in response corresponds to ranges order in request. GetRange(context.Context, *GetRangeRequest) (*GetRangeResponse, error) @@ -1154,8 +1177,8 @@ func (*UnimplementedServiceServer) Delete(ctx context.Context, req *DeleteReques func (*UnimplementedServiceServer) Head(ctx context.Context, req *HeadRequest) (*HeadResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Head not implemented") } -func (*UnimplementedServiceServer) Search(ctx context.Context, req *SearchRequest) (*SearchResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Search not implemented") +func (*UnimplementedServiceServer) Search(req *SearchRequest, srv Service_SearchServer) error { + return status.Errorf(codes.Unimplemented, "method Search not implemented") } func (*UnimplementedServiceServer) GetRange(ctx context.Context, req *GetRangeRequest) (*GetRangeResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method GetRange not implemented") @@ -1251,22 +1274,25 @@ func _Service_Head_Handler(srv interface{}, ctx context.Context, dec func(interf return interceptor(ctx, in, info, handler) } -func _Service_Search_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(SearchRequest) - if err := dec(in); err != nil { - return nil, err +func _Service_Search_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(SearchRequest) + if err := stream.RecvMsg(m); err != nil { + return err } - if interceptor == nil { - return srv.(ServiceServer).Search(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/object.Service/Search", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ServiceServer).Search(ctx, req.(*SearchRequest)) - } - return interceptor(ctx, in, info, handler) + return srv.(ServiceServer).Search(m, &serviceSearchServer{stream}) +} + +type Service_SearchServer interface { + Send(*SearchResponse) error + grpc.ServerStream +} + +type serviceSearchServer struct { + grpc.ServerStream +} + +func (x *serviceSearchServer) Send(m *SearchResponse) error { + return x.ServerStream.SendMsg(m) } func _Service_GetRange_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { @@ -1317,10 +1343,6 @@ var _Service_serviceDesc = grpc.ServiceDesc{ MethodName: "Head", Handler: _Service_Head_Handler, }, - { - MethodName: "Search", - Handler: _Service_Search_Handler, - }, { MethodName: "GetRange", Handler: _Service_GetRange_Handler, @@ -1341,6 +1363,11 @@ var _Service_serviceDesc = grpc.ServiceDesc{ Handler: _Service_Put_Handler, ClientStreams: true, }, + { + StreamName: "Search", + Handler: _Service_Search_Handler, + ServerStreams: true, + }, }, Metadata: "object/service.proto", } diff --git a/object/service.proto b/object/service.proto index 12f9741..4487a49 100644 --- a/object/service.proto +++ b/object/service.proto @@ -40,7 +40,7 @@ service Service { // Search objects in container. Version of query language format SHOULD BE // set to 1. Search query represented in serialized format (see query // package). - rpc Search(SearchRequest) returns (SearchResponse); + rpc Search(SearchRequest) returns (stream SearchResponse); // GetRange of data payload. Ranges are set of pairs (offset, length). // Fragments order in response corresponds to ranges order in request. From 124666a1426246011f9b8c054ce846e649232134 Mon Sep 17 00:00:00 2001 From: alexvanin Date: Tue, 4 Feb 2020 13:29:31 +0300 Subject: [PATCH 0088/1196] object: Add default filename user header key for third party apps --- object/utils.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/object/utils.go b/object/utils.go index baaed0f..329f287 100644 --- a/object/utils.go +++ b/object/utils.go @@ -8,6 +8,11 @@ import ( "github.com/pkg/errors" ) +// FilenameHeader is a user header key for names of files, stored by third +// party apps. We recommend to use this header to be compatible with neofs +// http gate, neofs minio gate and neofs-dropper application. +const FilenameHeader = "filename" + // ByteSize used to format bytes type ByteSize uint64 From 3f82b41a62718f8a25e5f9ffd4c38696f669cf8f Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Tue, 4 Feb 2020 13:52:57 +0300 Subject: [PATCH 0089/1196] CHANGELOG --- CHANGELOG.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 281bedc..f4d4864 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,17 @@ # Changelog This is the changelog for NeoFS Proto +## [0.2.14] - 2020-02-04 + +### Fixed +- Readme + +### Added +- Filename header + +### Updated +- Object.Search now uses streams + ## [0.2.13] - 2020-02-03 ### Fixed @@ -134,3 +145,4 @@ Initial public release [0.2.11]: https://github.com/nspcc-dev/neofs-api/compare/v0.2.10...v0.2.11 [0.2.12]: https://github.com/nspcc-dev/neofs-api/compare/v0.2.11...v0.2.12 [0.2.13]: https://github.com/nspcc-dev/neofs-api/compare/v0.2.12...v0.2.13 +[0.2.14]: https://github.com/nspcc-dev/neofs-api/compare/v0.2.13...v0.2.14 From 6becb23585f9ee963e6049a4c0f239ebee7077c0 Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Tue, 4 Feb 2020 19:12:46 +0300 Subject: [PATCH 0090/1196] Update dependencies - github.com/golang/protobuf `v1.3.2 => v1.3.3` - github.com/pkg/errors `v0.8.1 => v0.9.1` - github.com/prometheus/client_golang `v1.2.1 => v1.4.0` - github.com/prometheus/client_model `v0.0.0-20190812154241-14fe0d1b01d4 => v0.2.0` - github.com/spf13/viper `v1.6.1 => v1.6.2` - google.golang.org/grpc `v1.24.0 => v1.27.0` --- go.mod | 12 ++++++------ go.sum | 60 +++++++++++++++++++++++++++++++++++++++++----------------- 2 files changed, 49 insertions(+), 23 deletions(-) diff --git a/go.mod b/go.mod index 92ae511..d5ec195 100644 --- a/go.mod +++ b/go.mod @@ -4,19 +4,19 @@ go 1.13 require ( github.com/gogo/protobuf v1.3.1 - github.com/golang/protobuf v1.3.2 + github.com/golang/protobuf v1.3.3 github.com/google/uuid v1.1.1 github.com/mr-tron/base58 v1.1.3 github.com/nspcc-dev/neofs-crypto v0.2.3 github.com/nspcc-dev/netmap v1.6.1 github.com/nspcc-dev/tzhash v1.3.0 - github.com/pkg/errors v0.8.1 - github.com/prometheus/client_golang v1.2.1 - github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4 - github.com/spf13/viper v1.6.1 + github.com/pkg/errors v0.9.1 + github.com/prometheus/client_golang v1.4.0 + github.com/prometheus/client_model v0.2.0 + github.com/spf13/viper v1.6.2 github.com/stretchr/testify v1.4.0 golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550 - google.golang.org/grpc v1.24.0 + google.golang.org/grpc v1.27.0 ) // Used for debug reasons diff --git a/go.sum b/go.sum index 531a682..5ef748d 100644 --- a/go.sum +++ b/go.sum @@ -15,10 +15,11 @@ github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24 github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= +github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= -github.com/cespare/xxhash/v2 v2.1.0 h1:yTUvW7Vhb89inJ+8irsUqiWjh8iT6sQPZiQzI6ReGkA= -github.com/cespare/xxhash/v2 v2.1.0/go.mod h1:dgIUBU3pDso/gPgZ1osOZ0iQf77oPR28Tjxl5dIMyVM= +github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY= +github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= @@ -33,6 +34,8 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= +github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/flynn-archive/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:rZfgFAXFS/z/lEd6LJmf9HVZ1LkgYiHx5pHhV5DR16M= github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= @@ -56,10 +59,13 @@ github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5y github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.3 h1:gyjaxf+svBWX08ZjK86iN9geUJF0H6gp2IRKX6Nf6/I= +github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= -github.com/google/go-cmp v0.3.0 h1:crn/baboCvb5fXaQ0IJ1SGTsTVrWpDsCWC8EGETZijY= -github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= @@ -73,7 +79,7 @@ github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= -github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= @@ -120,27 +126,31 @@ github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/9 github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= -github.com/prometheus/client_golang v1.2.1 h1:JnMpQc6ppsNgw9QPAGF6Dod479itz7lvlsMzzNayLOI= -github.com/prometheus/client_golang v1.2.1/go.mod h1:XMU6Z2MjaRKVu/dC1qupJI9SiNkDYzz3xecMgSW/F+U= +github.com/prometheus/client_golang v1.4.0 h1:YVIb/fVcOTMSqtqZWSKnHpSLBxu8DKgxq8z6RuBZwqI= +github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4 h1:gQz4mCbXsO+nc9n1hCxHcGA3Zx3Eo+UHZoInFGUIXNM= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.2.0 h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2dUR+/W/M= +github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= -github.com/prometheus/common v0.7.0 h1:L+1lyG48J1zAQXA3RBX/nG/B3gjlHq0zTt2tlbJLyCY= -github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt26CguLLsqA= +github.com/prometheus/common v0.9.1 h1:KOMtN28tlbam3/7ZKEYKHhKoJZYYj3gMH4uc62x7X7U= +github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= -github.com/prometheus/procfs v0.0.5 h1:3+auTFlqw+ZaQYJARz6ArODtkaIwtvBTx3N2NehQlL8= -github.com/prometheus/procfs v0.0.5/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDaekg4FpcdQ= +github.com/prometheus/procfs v0.0.8 h1:+fpWZdT24pJBiqJdAwYBjPSk+5YmQzYNPYzQsdzLkt8= +github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= @@ -161,8 +171,8 @@ github.com/spf13/jwalterweatherman v1.0.0 h1:XHEdyB+EcvlqZamSM4ZOMGlc93t6AcsBEu9 github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg= github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= -github.com/spf13/viper v1.6.1 h1:VPZzIkznI1YhVMRi6vNFLHSwhnhReBfgTxIPccpfdZk= -github.com/spf13/viper v1.6.1/go.mod h1:t3iDnF5Jlj76alVNuyFBk5oUMCvsrkbvZK0WQdfDi5k= +github.com/spf13/viper v1.6.2 h1:7aKfF+e8/k68gda3LOjo5RxiUqddoFxVq4BKBPrxk5E= +github.com/spf13/viper v1.6.2/go.mod h1:t3iDnF5Jlj76alVNuyFBk5oUMCvsrkbvZK0WQdfDi5k= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= @@ -183,11 +193,15 @@ golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnf golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550 h1:ObdrDkeb4kJdCP557AjRjq69pTHfNouLtWZG7j9rPN8= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3 h1:0GoQqolDA55aaLxZyTzK/Y2ePZzZTUrRacwib7cNsYQ= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= @@ -199,6 +213,7 @@ golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -208,30 +223,39 @@ golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20190412213103-97732733099d h1:+R4KGOnez64A81RvjARKc4UT5/tI9ujCIVX+P5KiHuI= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191010194322-b09406accb47 h1:/XfQ9z7ib8eEJX2hdgFTZJ/ntt0swNk5oYBziWeTCvY= -golang.org/x/sys v0.0.0-20191010194322-b09406accb47/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200122134326-e047566fdf82 h1:ywK/j/KkyTHcdyYSZNXGjMwgmDSfjglYZ3vStQ/gSCU= +golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8 h1:Nw54tB0rB7hY/N0NQvRW8DG4Yk3Q6T9cu9RcFQDu1tc= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55 h1:gSJIx1SDwno+2ElGhA4+qG2zF97qiUzTM+rQ0klBOcE= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= -google.golang.org/grpc v1.24.0 h1:vb/1TCsVn3DcJlQ0Gs1yB1pKI6Do2/QNwxdKqmc/b0s= -google.golang.org/grpc v1.24.0/go.mod h1:XDChyiUovWa60DnaeDeZmSW86xtLtjtZbwvSiRnRtcA= +google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.27.0 h1:rRYRFMVgRv6E0D70Skyfsr28tDXIuuPZyWGMPdMcnXg= +google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= gopkg.in/abiosoft/ishell.v2 v2.0.0/go.mod h1:sFp+cGtH6o4s1FtpVPTMcHq2yue+c4DGOVohJCPUzwY= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/ini.v1 v1.51.0 h1:AQvPpx3LzTDM0AjnIRlVFwFFGC+npRopjZxLJj6gdno= gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= @@ -241,5 +265,7 @@ gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.5 h1:ymVxjfMaHvXD8RqPRmzHHsB3VvucivSkIAvJFDI5O3c= +gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= From 1fe7f7b2faf02483eed1a2f52bd1c57d7b410fe2 Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Wed, 5 Feb 2020 13:42:49 +0300 Subject: [PATCH 0091/1196] make object.GetRange to be server-side streaming RPC --- docs/object.md | 9 +- object/service.pb.go | 243 +++++++++++++++++++++++-------------------- object/service.proto | 11 +- 3 files changed, 143 insertions(+), 120 deletions(-) diff --git a/docs/object.md b/docs/object.md index dbdd6dc..997991a 100644 --- a/docs/object.md +++ b/docs/object.md @@ -64,7 +64,7 @@ rpc Put(stream PutRequest) returns (PutResponse); rpc Delete(DeleteRequest) returns (DeleteResponse); rpc Head(HeadRequest) returns (HeadResponse); rpc Search(SearchRequest) returns (stream SearchResponse); -rpc GetRange(GetRangeRequest) returns (GetRangeResponse); +rpc GetRange(GetRangeRequest) returns (stream GetRangeResponse); rpc GetRangeHash(GetRangeHashRequest) returns (GetRangeHashResponse); ``` @@ -119,8 +119,9 @@ package). | Search | [SearchRequest](#object.SearchRequest) | [SearchResponse](#object.SearchResponse) | #### Method GetRange -GetRange of data payload. Ranges are set of pairs (offset, length). -Fragments order in response corresponds to ranges order in request. +GetRange of data payload. Range is a pair (offset, length). +Requested range can be restored by concatenation of all chunks +keeping receiving order. | Name | Input | Output | | ---- | ----- | ------ | @@ -196,7 +197,7 @@ in distributed system. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | | Address | [refs.Address](#refs.Address) | | Address of object (container id + object id) | -| Ranges | [Range](#object.Range) | repeated | Ranges of object's payload to return | +| Range | [Range](#object.Range) | | Range of object's payload to return | | Meta | [service.RequestMetaHeader](#service.RequestMetaHeader) | | RequestMetaHeader contains information about request meta headers (should be embedded into message) | | Verify | [service.RequestVerificationHeader](#service.RequestVerificationHeader) | | RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) | diff --git a/object/service.pb.go b/object/service.pb.go index 05e7c4b..0e40508 100644 --- a/object/service.pb.go +++ b/object/service.pb.go @@ -661,8 +661,8 @@ func (m *SearchResponse) GetAddresses() []refs.Address { type GetRangeRequest struct { // Address of object (container id + object id) Address refs.Address `protobuf:"bytes,1,opt,name=Address,proto3" json:"Address"` - // Ranges of object's payload to return - Ranges []Range `protobuf:"bytes,2,rep,name=Ranges,proto3" json:"Ranges"` + // Range of object's payload to return + Range Range `protobuf:"bytes,2,opt,name=Range,proto3" json:"Range"` // RequestMetaHeader contains information about request meta headers (should be embedded into message) service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) @@ -708,11 +708,11 @@ func (m *GetRangeRequest) GetAddress() refs.Address { return refs.Address{} } -func (m *GetRangeRequest) GetRanges() []Range { +func (m *GetRangeRequest) GetRange() Range { if m != nil { - return m.Ranges + return m.Range } - return nil + return Range{} } type GetRangeResponse struct { @@ -883,60 +883,61 @@ func init() { func init() { proto.RegisterFile("object/service.proto", fileDescriptor_dfcdf610ade6a9ce) } var fileDescriptor_dfcdf610ade6a9ce = []byte{ - // 846 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x56, 0x4d, 0x4f, 0x33, 0x55, - 0x14, 0xee, 0xed, 0x94, 0x01, 0x4e, 0xa7, 0xbc, 0xcd, 0xa5, 0xbe, 0x36, 0x23, 0x29, 0x64, 0x82, - 0xa6, 0xc6, 0x74, 0x5a, 0x31, 0x41, 0x8c, 0xb8, 0xb0, 0x6d, 0xa0, 0x2c, 0x0c, 0x78, 0x21, 0x24, - 0xba, 0x9b, 0x4e, 0x6f, 0xdb, 0x91, 0x32, 0x53, 0xe7, 0x03, 0xc2, 0x0f, 0x70, 0xed, 0xd6, 0x95, - 0xbf, 0xc4, 0x1f, 0xc0, 0xc6, 0x84, 0xa5, 0x71, 0x41, 0x4c, 0x5d, 0xbb, 0x37, 0x71, 0x63, 0xee, - 0xc7, 0x74, 0x66, 0x40, 0x50, 0x59, 0x58, 0x57, 0x3d, 0xf7, 0x39, 0x5f, 0x3d, 0xcf, 0x3c, 0xe7, - 0xce, 0x40, 0xc5, 0xeb, 0x7f, 0x45, 0xed, 0xb0, 0x19, 0x50, 0xff, 0xca, 0xb1, 0xa9, 0x39, 0xf5, - 0xbd, 0xd0, 0xc3, 0xaa, 0x40, 0xf5, 0xb2, 0x4f, 0x87, 0x41, 0x33, 0xbc, 0x99, 0xd2, 0x40, 0x78, - 0x74, 0x2c, 0xe3, 0xd3, 0xd8, 0x7a, 0x40, 0x83, 0xc0, 0xf1, 0xdc, 0x6c, 0xa0, 0xac, 0xd8, 0xbc, - 0xa4, 0xa1, 0x25, 0xb1, 0x4a, 0x8c, 0x5d, 0x51, 0xdf, 0x19, 0xde, 0x48, 0xb4, 0x31, 0x72, 0xc2, - 0x71, 0xd4, 0x37, 0x6d, 0xef, 0xb2, 0x39, 0xf2, 0x46, 0x5e, 0x93, 0xc3, 0xfd, 0x68, 0xc8, 0x4f, - 0xfc, 0xc0, 0x2d, 0x11, 0x6e, 0xfc, 0x88, 0x00, 0x0e, 0x69, 0x48, 0xe8, 0xd7, 0x11, 0x0d, 0x42, - 0xdc, 0x80, 0xe5, 0x4f, 0x07, 0x03, 0x9f, 0x06, 0x41, 0x15, 0x6d, 0xa1, 0x7a, 0x71, 0xa7, 0x64, - 0xb2, 0x3f, 0x6d, 0x4a, 0xb0, 0x5d, 0xb8, 0xbd, 0xdf, 0xcc, 0x91, 0x38, 0x06, 0x97, 0x41, 0x21, - 0xd6, 0x75, 0x35, 0xbf, 0x85, 0xea, 0x2b, 0x84, 0x99, 0x78, 0x0f, 0x0a, 0x9f, 0xd1, 0xd0, 0xaa, - 0xf6, 0x79, 0xb6, 0x6e, 0xc6, 0x4c, 0xc8, 0x06, 0xcc, 0xd7, 0xa3, 0xd6, 0x80, 0xfa, 0xed, 0x15, - 0x56, 0xea, 0xee, 0x7e, 0x13, 0x11, 0x9e, 0x81, 0xbb, 0xa0, 0x9e, 0xf3, 0x41, 0xaa, 0x36, 0xcf, - 0x35, 0x1e, 0xe6, 0x72, 0xaf, 0x63, 0x5b, 0xa1, 0xe3, 0xb9, 0x8f, 0x6a, 0xc8, 0x5c, 0xe3, 0x0c, - 0x8a, 0x7c, 0x9c, 0x60, 0xea, 0xb9, 0x01, 0xc5, 0x75, 0x90, 0xe4, 0xcb, 0x71, 0xd6, 0x4c, 0x71, - 0x34, 0x8f, 0xf9, 0x4f, 0x2f, 0x47, 0xa4, 0x1f, 0xbf, 0x86, 0xa5, 0xce, 0x38, 0x72, 0x2f, 0xf8, - 0x30, 0x5a, 0x2f, 0x47, 0xc4, 0xb1, 0xad, 0x00, 0x22, 0xc6, 0x0f, 0x79, 0x80, 0x93, 0x68, 0xce, - 0xd2, 0x2e, 0xa8, 0xe2, 0x0f, 0xc8, 0xaa, 0x1b, 0x71, 0xd5, 0x24, 0x86, 0x99, 0x22, 0x86, 0xf5, - 0x10, 0xd6, 0x53, 0x3d, 0x16, 0x4d, 0x9a, 0xfe, 0x05, 0xac, 0xce, 0xff, 0x2e, 0x7e, 0x07, 0xd4, - 0xe3, 0x67, 0x28, 0x23, 0xd2, 0x8b, 0xb7, 0x61, 0xe9, 0xcc, 0xbb, 0xa0, 0x2e, 0x1f, 0x86, 0x85, - 0x49, 0xdd, 0x9a, 0x1c, 0x25, 0xc2, 0x29, 0xe8, 0xdb, 0x87, 0x22, 0x67, 0x46, 0x3e, 0x94, 0x7f, - 0x27, 0x32, 0xe3, 0xdb, 0x3c, 0x94, 0xba, 0x74, 0x42, 0x43, 0xfa, 0x42, 0x95, 0xbe, 0x0b, 0xcb, - 0xc7, 0xd7, 0x2e, 0xf5, 0x8f, 0xba, 0x82, 0xf8, 0xf6, 0x2b, 0xe6, 0xff, 0xf9, 0x7e, 0x33, 0x86, - 0x49, 0x6c, 0x24, 0x43, 0x29, 0xcf, 0x0c, 0xb5, 0x70, 0x91, 0x97, 0x61, 0x2d, 0x26, 0x44, 0x50, - 0x6a, 0xfc, 0x81, 0xa0, 0xc8, 0xc2, 0x63, 0x86, 0xf6, 0xfe, 0x86, 0xa1, 0x39, 0x03, 0x12, 0x48, - 0xc8, 0xda, 0x82, 0xe2, 0x41, 0x34, 0x99, 0x88, 0xde, 0x81, 0x5c, 0xed, 0x34, 0x14, 0x2f, 0xbd, - 0xf2, 0xff, 0x59, 0xfa, 0x5d, 0xd0, 0xc4, 0xf0, 0x52, 0x60, 0xff, 0x50, 0xc2, 0xc6, 0xef, 0x08, - 0x4a, 0xa7, 0xd4, 0xf2, 0xed, 0x71, 0xa2, 0xac, 0x62, 0xc7, 0x73, 0x43, 0xcb, 0x11, 0x72, 0x41, - 0x5c, 0x2e, 0x45, 0x49, 0x96, 0xd2, 0x39, 0xea, 0x92, 0xb4, 0x1f, 0x57, 0x60, 0xe9, 0xf3, 0x88, - 0xfa, 0x37, 0x42, 0x57, 0x44, 0x1c, 0xb0, 0x01, 0x1a, 0x37, 0xce, 0xa9, 0xcf, 0xb4, 0xc3, 0x99, - 0x2a, 0x91, 0x0c, 0xb6, 0x70, 0xca, 0x3a, 0xb0, 0x16, 0x4f, 0x2e, 0x49, 0x7b, 0x1f, 0x56, 0xa5, - 0x06, 0x28, 0x13, 0x8d, 0xf2, 0xd4, 0x5a, 0x25, 0x51, 0xc6, 0x6f, 0x08, 0x5e, 0xb1, 0xdb, 0xd6, - 0x72, 0x47, 0x2f, 0xdd, 0xcd, 0xf7, 0x40, 0xe5, 0xe9, 0x4c, 0x69, 0xa2, 0xa5, 0x7c, 0x54, 0x1c, - 0x95, 0xd1, 0x32, 0x64, 0xe1, 0xa4, 0xb5, 0xa0, 0x9c, 0x8c, 0x2b, 0x69, 0xdb, 0x80, 0xd5, 0x03, - 0xdf, 0x1a, 0x5d, 0x52, 0x37, 0x14, 0xb4, 0x69, 0x24, 0x01, 0x8c, 0x6f, 0xf2, 0xb0, 0x1e, 0xa7, - 0xf4, 0xac, 0x60, 0xfc, 0x5f, 0xb0, 0x84, 0xa1, 0x70, 0x6a, 0x4d, 0x42, 0x2e, 0x3b, 0x8d, 0x70, - 0x7b, 0xe1, 0xcc, 0xed, 0x43, 0x25, 0x4b, 0x83, 0x64, 0x6f, 0x1b, 0x54, 0x76, 0x96, 0x8a, 0xd3, - 0xda, 0x9a, 0x5c, 0xb5, 0x02, 0x8f, 0x92, 0xbe, 0x9d, 0xef, 0x15, 0x58, 0x3e, 0x15, 0x5d, 0x71, - 0x0b, 0x94, 0x43, 0x1a, 0x62, 0x1c, 0x33, 0x90, 0x7c, 0xbc, 0xe8, 0xeb, 0x19, 0x4c, 0x74, 0x68, - 0x21, 0x96, 0x71, 0x12, 0xa5, 0x32, 0x92, 0x97, 0x74, 0x92, 0x91, 0x7a, 0x3d, 0xd5, 0x11, 0xfe, - 0x10, 0x54, 0x71, 0xbf, 0xe2, 0x37, 0xe2, 0x80, 0xcc, 0x0b, 0x48, 0x7f, 0xfd, 0x10, 0x9e, 0xef, - 0x50, 0x81, 0x51, 0x80, 0xe7, 0x75, 0x53, 0x77, 0xb2, 0x5e, 0xc9, 0x82, 0x32, 0xe5, 0x23, 0x50, - 0xc5, 0x22, 0x26, 0xbd, 0x32, 0x57, 0x52, 0xd2, 0x2b, 0xbb, 0xaf, 0x2d, 0x84, 0x3f, 0x81, 0x95, - 0x98, 0x54, 0xfc, 0x66, 0x7a, 0xf6, 0xd4, 0x3e, 0xea, 0xd5, 0xc7, 0x0e, 0xd9, 0xf9, 0x08, 0xb4, - 0xf4, 0x33, 0xc1, 0x6f, 0x3d, 0x8c, 0x4c, 0x09, 0x56, 0xdf, 0xf8, 0x6b, 0xa7, 0x28, 0xd5, 0xfe, - 0xf8, 0x76, 0x56, 0x43, 0x77, 0xb3, 0x1a, 0xfa, 0x69, 0x56, 0x43, 0xbf, 0xcc, 0x6a, 0xe8, 0xbb, - 0x5f, 0x6b, 0xb9, 0x2f, 0xdf, 0x4e, 0x7d, 0x8a, 0xba, 0xc1, 0xd4, 0xb6, 0x1b, 0x03, 0x7a, 0xd5, - 0x74, 0xa9, 0x37, 0x0c, 0x1a, 0xd6, 0xd4, 0x69, 0x8a, 0x8a, 0x7d, 0x95, 0x7f, 0x89, 0x7e, 0xf0, - 0x67, 0x00, 0x00, 0x00, 0xff, 0xff, 0xee, 0x6d, 0x9e, 0x41, 0x3d, 0x0b, 0x00, 0x00, + // 859 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x56, 0xcd, 0x6e, 0xeb, 0x44, + 0x14, 0xce, 0xc4, 0x89, 0xdb, 0x9e, 0x38, 0xbd, 0xd1, 0x34, 0x5c, 0x22, 0x53, 0xa5, 0x95, 0x75, + 0x41, 0x41, 0x28, 0x4e, 0xb8, 0x48, 0xa5, 0x88, 0x4a, 0x88, 0x24, 0x6a, 0xd3, 0x05, 0x6a, 0x99, + 0x56, 0x95, 0x60, 0xe7, 0x38, 0x93, 0xc4, 0x34, 0xb5, 0x83, 0x7f, 0x5a, 0xf5, 0x01, 0x58, 0xb3, + 0x65, 0xc9, 0x83, 0xf0, 0x00, 0xdd, 0x20, 0x75, 0x89, 0x58, 0x54, 0x28, 0x2c, 0x79, 0x01, 0x24, + 0x36, 0x68, 0x7e, 0x1c, 0xdb, 0x2d, 0x2d, 0xd0, 0x4d, 0xee, 0x2a, 0x33, 0xdf, 0xf9, 0xce, 0x99, + 0x9c, 0xcf, 0xdf, 0x19, 0x1b, 0xaa, 0xde, 0xe0, 0x1b, 0x6a, 0x87, 0xad, 0x80, 0xfa, 0x97, 0x8e, + 0x4d, 0xcd, 0x99, 0xef, 0x85, 0x1e, 0x56, 0x05, 0xaa, 0x57, 0x7c, 0x3a, 0x0a, 0x5a, 0xe1, 0xf5, + 0x8c, 0x06, 0x22, 0xa2, 0x63, 0xc9, 0x4f, 0x63, 0x1b, 0x01, 0x0d, 0x02, 0xc7, 0x73, 0xb3, 0x44, + 0x59, 0xb1, 0x75, 0x41, 0x43, 0x4b, 0x62, 0xd5, 0x18, 0xbb, 0xa4, 0xbe, 0x33, 0xba, 0x96, 0x68, + 0x73, 0xec, 0x84, 0x93, 0x68, 0x60, 0xda, 0xde, 0x45, 0x6b, 0xec, 0x8d, 0xbd, 0x16, 0x87, 0x07, + 0xd1, 0x88, 0xef, 0xf8, 0x86, 0xaf, 0x04, 0xdd, 0xf8, 0x19, 0x01, 0x1c, 0xd0, 0x90, 0xd0, 0x6f, + 0x23, 0x1a, 0x84, 0xb8, 0x09, 0x2b, 0x9f, 0x0f, 0x87, 0x3e, 0x0d, 0x82, 0x1a, 0xda, 0x46, 0x8d, + 0xd2, 0xeb, 0xb2, 0xc9, 0xfe, 0xb4, 0x29, 0xc1, 0x4e, 0xe1, 0xe6, 0x6e, 0x2b, 0x47, 0x62, 0x0e, + 0xae, 0x80, 0x42, 0xac, 0xab, 0x5a, 0x7e, 0x1b, 0x35, 0x56, 0x09, 0x5b, 0xe2, 0x5d, 0x28, 0x7c, + 0x41, 0x43, 0xab, 0x36, 0xe0, 0xd9, 0xba, 0x19, 0x2b, 0x21, 0x0f, 0x60, 0xb1, 0x3e, 0xb5, 0x86, + 0xd4, 0xef, 0xac, 0xb2, 0x52, 0xb7, 0x77, 0x5b, 0x88, 0xf0, 0x0c, 0xdc, 0x03, 0xf5, 0x8c, 0x37, + 0x52, 0xb3, 0x79, 0xae, 0x71, 0x3f, 0x97, 0x47, 0x1d, 0xdb, 0x0a, 0x1d, 0xcf, 0x7d, 0x50, 0x43, + 0xe6, 0x1a, 0xa7, 0x50, 0xe2, 0xed, 0x04, 0x33, 0xcf, 0x0d, 0x28, 0x6e, 0x80, 0x14, 0x5f, 0xb6, + 0xb3, 0x6e, 0x8a, 0xad, 0x79, 0xc4, 0x7f, 0xfa, 0x39, 0x22, 0xe3, 0xf8, 0x25, 0x14, 0xbb, 0x93, + 0xc8, 0x3d, 0xe7, 0xcd, 0x68, 0xfd, 0x1c, 0x11, 0xdb, 0x8e, 0x02, 0x88, 0x18, 0x3f, 0xe5, 0x01, + 0x8e, 0xa3, 0x85, 0x4a, 0x3b, 0xa0, 0x8a, 0x3f, 0x20, 0xab, 0x6e, 0xc6, 0x55, 0x13, 0x0e, 0x5b, + 0x0a, 0x0e, 0x3b, 0x43, 0xac, 0x1e, 0x3b, 0x63, 0xd9, 0xa2, 0xe9, 0x5f, 0xc1, 0xda, 0xe2, 0xef, + 0xe2, 0xf7, 0x40, 0x3d, 0x7a, 0x42, 0x32, 0x22, 0xa3, 0xf8, 0x15, 0x14, 0x4f, 0xbd, 0x73, 0xea, + 0xf2, 0x66, 0x18, 0x4d, 0xfa, 0xd6, 0xe4, 0x28, 0x11, 0x41, 0x21, 0xdf, 0x1e, 0x94, 0xb8, 0x32, + 0xf2, 0xa1, 0xfc, 0x3f, 0x93, 0x19, 0xdf, 0xe7, 0xa1, 0xdc, 0xa3, 0x53, 0x1a, 0xd2, 0x67, 0xba, + 0xf4, 0x7d, 0x58, 0x39, 0xba, 0x72, 0xa9, 0x7f, 0xd8, 0x13, 0xc2, 0x77, 0x5e, 0xb0, 0xf8, 0xaf, + 0x77, 0x5b, 0x31, 0x4c, 0xe2, 0x45, 0xd2, 0x94, 0xf2, 0x44, 0x53, 0x4b, 0x37, 0x79, 0x05, 0xd6, + 0x63, 0x41, 0x84, 0xa4, 0xc6, 0x5f, 0x08, 0x4a, 0x8c, 0x1e, 0x2b, 0xb4, 0xfb, 0x2f, 0x0a, 0x2d, + 0x14, 0x90, 0x40, 0x22, 0xd6, 0x36, 0x94, 0xf6, 0xa3, 0xe9, 0x54, 0x9c, 0x1d, 0xc8, 0xd1, 0x4e, + 0x43, 0xf1, 0xd0, 0x2b, 0x6f, 0xce, 0xd0, 0xef, 0x80, 0x26, 0x9a, 0x97, 0x06, 0xfb, 0x8f, 0x16, + 0x36, 0xfe, 0x44, 0x50, 0x3e, 0xa1, 0x96, 0x6f, 0x4f, 0x12, 0x67, 0x95, 0xba, 0x9e, 0x1b, 0x5a, + 0x8e, 0xb0, 0x0b, 0xe2, 0x76, 0x29, 0x49, 0xb1, 0x94, 0xee, 0x61, 0x8f, 0xa4, 0xe3, 0xb8, 0x0a, + 0xc5, 0x2f, 0x23, 0xea, 0x5f, 0x0b, 0x5f, 0x11, 0xb1, 0xc1, 0x06, 0x68, 0x7c, 0x71, 0x46, 0x7d, + 0xe6, 0x1d, 0xae, 0x54, 0x99, 0x64, 0xb0, 0xa5, 0x4b, 0xd6, 0x85, 0xf5, 0xb8, 0x73, 0x29, 0xda, + 0x87, 0xb0, 0x26, 0x3d, 0x40, 0x99, 0x69, 0x94, 0xc7, 0xc6, 0x2a, 0x61, 0x19, 0x7f, 0x20, 0x78, + 0xc1, 0x6e, 0x5b, 0xcb, 0x1d, 0x3f, 0x7f, 0x36, 0x8b, 0x3c, 0x5d, 0xde, 0x22, 0xe5, 0xf8, 0x49, + 0x71, 0x50, 0x92, 0x05, 0x63, 0xe9, 0x92, 0xb5, 0xa1, 0x92, 0x34, 0x2b, 0x45, 0xdb, 0x84, 0xb5, + 0x7d, 0xdf, 0x1a, 0x5f, 0x50, 0x37, 0x14, 0xa2, 0x69, 0x24, 0x01, 0x8c, 0xef, 0xf2, 0xb0, 0x11, + 0xa7, 0xf4, 0xad, 0x60, 0xf2, 0x4c, 0x8d, 0x3e, 0x00, 0x95, 0x97, 0x60, 0xd3, 0xa8, 0x3c, 0x26, + 0x92, 0xa4, 0x60, 0x0c, 0x85, 0x13, 0x6b, 0x1a, 0x72, 0xd3, 0x69, 0x84, 0xaf, 0x97, 0xae, 0xdc, + 0x1e, 0x54, 0xb3, 0x32, 0x48, 0xf5, 0x5e, 0x81, 0xca, 0xf6, 0xd2, 0x6f, 0x5a, 0x47, 0x93, 0x83, + 0x56, 0xe0, 0x2c, 0x19, 0x7b, 0xfd, 0xa3, 0x02, 0x2b, 0x27, 0xe2, 0x54, 0xdc, 0x06, 0xe5, 0x80, + 0x86, 0x18, 0xc7, 0x0a, 0x24, 0x9f, 0x2e, 0xfa, 0x46, 0x06, 0x13, 0x27, 0xb4, 0x11, 0xcb, 0x38, + 0x8e, 0x52, 0x19, 0xc9, 0x2b, 0x3a, 0xc9, 0x48, 0xbd, 0x9c, 0x1a, 0x08, 0x7f, 0x0c, 0xaa, 0xb8, + 0x5d, 0xf1, 0x5b, 0x31, 0x21, 0xf3, 0xfa, 0xd1, 0x5f, 0xde, 0x87, 0x17, 0x13, 0x54, 0x60, 0x12, + 0xe0, 0x45, 0xdd, 0xd4, 0x8d, 0xac, 0x57, 0xb3, 0xa0, 0x4c, 0xf9, 0x04, 0x54, 0x31, 0x86, 0xc9, + 0x59, 0x99, 0x0b, 0x29, 0x39, 0x2b, 0x3b, 0xad, 0x6d, 0x84, 0x3f, 0x83, 0xd5, 0x58, 0x54, 0xfc, + 0x76, 0xba, 0xf7, 0xd4, 0x34, 0xea, 0xb5, 0x87, 0x81, 0x45, 0x81, 0x43, 0xd0, 0xd2, 0x4f, 0x05, + 0xbf, 0x73, 0x9f, 0x9b, 0xb2, 0xac, 0xbe, 0xf9, 0xcf, 0x41, 0x51, 0xac, 0xf3, 0xe9, 0xcd, 0xbc, + 0x8e, 0x6e, 0xe7, 0x75, 0xf4, 0xcb, 0xbc, 0x8e, 0x7e, 0x9b, 0xd7, 0xd1, 0x0f, 0xbf, 0xd7, 0x73, + 0x5f, 0xbf, 0x9b, 0xfa, 0x14, 0x75, 0x83, 0x99, 0x6d, 0x37, 0x87, 0xf4, 0xb2, 0xe5, 0x52, 0x6f, + 0x14, 0x34, 0xad, 0x99, 0xd3, 0x12, 0x15, 0x07, 0x2a, 0xff, 0x12, 0xfd, 0xe8, 0xef, 0x00, 0x00, + 0x00, 0xff, 0xff, 0x46, 0xff, 0x20, 0xe9, 0x3d, 0x0b, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -974,9 +975,10 @@ type ServiceClient interface { // set to 1. Search query represented in serialized format (see query // package). Search(ctx context.Context, in *SearchRequest, opts ...grpc.CallOption) (Service_SearchClient, error) - // GetRange of data payload. Ranges are set of pairs (offset, length). - // Fragments order in response corresponds to ranges order in request. - GetRange(ctx context.Context, in *GetRangeRequest, opts ...grpc.CallOption) (*GetRangeResponse, error) + // GetRange of data payload. Range is a pair (offset, length). + // Requested range can be restored by concatenation of all chunks + // keeping receiving order. + GetRange(ctx context.Context, in *GetRangeRequest, opts ...grpc.CallOption) (Service_GetRangeClient, error) // GetRangeHash returns homomorphic hash of object payload range after XOR // operation. Ranges are set of pairs (offset, length). Hashes order in // response corresponds to ranges order in request. Homomorphic hash is @@ -1108,13 +1110,36 @@ func (x *serviceSearchClient) Recv() (*SearchResponse, error) { return m, nil } -func (c *serviceClient) GetRange(ctx context.Context, in *GetRangeRequest, opts ...grpc.CallOption) (*GetRangeResponse, error) { - out := new(GetRangeResponse) - err := c.cc.Invoke(ctx, "/object.Service/GetRange", in, out, opts...) +func (c *serviceClient) GetRange(ctx context.Context, in *GetRangeRequest, opts ...grpc.CallOption) (Service_GetRangeClient, error) { + stream, err := c.cc.NewStream(ctx, &_Service_serviceDesc.Streams[3], "/object.Service/GetRange", opts...) if err != nil { return nil, err } - return out, nil + x := &serviceGetRangeClient{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 +} + +type Service_GetRangeClient interface { + Recv() (*GetRangeResponse, error) + grpc.ClientStream +} + +type serviceGetRangeClient struct { + grpc.ClientStream +} + +func (x *serviceGetRangeClient) Recv() (*GetRangeResponse, error) { + m := new(GetRangeResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil } func (c *serviceClient) GetRangeHash(ctx context.Context, in *GetRangeHashRequest, opts ...grpc.CallOption) (*GetRangeHashResponse, error) { @@ -1151,9 +1176,10 @@ type ServiceServer interface { // set to 1. Search query represented in serialized format (see query // package). Search(*SearchRequest, Service_SearchServer) error - // GetRange of data payload. Ranges are set of pairs (offset, length). - // Fragments order in response corresponds to ranges order in request. - GetRange(context.Context, *GetRangeRequest) (*GetRangeResponse, error) + // GetRange of data payload. Range is a pair (offset, length). + // Requested range can be restored by concatenation of all chunks + // keeping receiving order. + GetRange(*GetRangeRequest, Service_GetRangeServer) error // GetRangeHash returns homomorphic hash of object payload range after XOR // operation. Ranges are set of pairs (offset, length). Hashes order in // response corresponds to ranges order in request. Homomorphic hash is @@ -1180,8 +1206,8 @@ func (*UnimplementedServiceServer) Head(ctx context.Context, req *HeadRequest) ( func (*UnimplementedServiceServer) Search(req *SearchRequest, srv Service_SearchServer) error { return status.Errorf(codes.Unimplemented, "method Search not implemented") } -func (*UnimplementedServiceServer) GetRange(ctx context.Context, req *GetRangeRequest) (*GetRangeResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetRange not implemented") +func (*UnimplementedServiceServer) GetRange(req *GetRangeRequest, srv Service_GetRangeServer) error { + return status.Errorf(codes.Unimplemented, "method GetRange not implemented") } func (*UnimplementedServiceServer) GetRangeHash(ctx context.Context, req *GetRangeHashRequest) (*GetRangeHashResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method GetRangeHash not implemented") @@ -1295,22 +1321,25 @@ func (x *serviceSearchServer) Send(m *SearchResponse) error { return x.ServerStream.SendMsg(m) } -func _Service_GetRange_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetRangeRequest) - if err := dec(in); err != nil { - return nil, err +func _Service_GetRange_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(GetRangeRequest) + if err := stream.RecvMsg(m); err != nil { + return err } - if interceptor == nil { - return srv.(ServiceServer).GetRange(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/object.Service/GetRange", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ServiceServer).GetRange(ctx, req.(*GetRangeRequest)) - } - return interceptor(ctx, in, info, handler) + return srv.(ServiceServer).GetRange(m, &serviceGetRangeServer{stream}) +} + +type Service_GetRangeServer interface { + Send(*GetRangeResponse) error + grpc.ServerStream +} + +type serviceGetRangeServer struct { + grpc.ServerStream +} + +func (x *serviceGetRangeServer) Send(m *GetRangeResponse) error { + return x.ServerStream.SendMsg(m) } func _Service_GetRangeHash_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { @@ -1343,10 +1372,6 @@ var _Service_serviceDesc = grpc.ServiceDesc{ MethodName: "Head", Handler: _Service_Head_Handler, }, - { - MethodName: "GetRange", - Handler: _Service_GetRange_Handler, - }, { MethodName: "GetRangeHash", Handler: _Service_GetRangeHash_Handler, @@ -1368,6 +1393,11 @@ var _Service_serviceDesc = grpc.ServiceDesc{ Handler: _Service_Search_Handler, ServerStreams: true, }, + { + StreamName: "GetRange", + Handler: _Service_GetRange_Handler, + ServerStreams: true, + }, }, Metadata: "object/service.proto", } @@ -2093,20 +2123,16 @@ func (m *GetRangeRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x6 i-- dAtA[i] = 0x92 - if len(m.Ranges) > 0 { - for iNdEx := len(m.Ranges) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Ranges[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 + { + size, err := m.Range.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x12 { size, err := m.Address.MarshalToSizedBuffer(dAtA[:i]) if err != nil { @@ -2554,12 +2580,8 @@ func (m *GetRangeRequest) Size() (n int) { _ = l l = m.Address.Size() n += 1 + l + sovService(uint64(l)) - if len(m.Ranges) > 0 { - for _, e := range m.Ranges { - l = e.Size() - n += 1 + l + sovService(uint64(l)) - } - } + l = m.Range.Size() + n += 1 + l + sovService(uint64(l)) l = m.RequestMetaHeader.Size() n += 2 + l + sovService(uint64(l)) l = m.RequestVerificationHeader.Size() @@ -4253,7 +4275,7 @@ func (m *GetRangeRequest) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Ranges", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Range", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -4280,8 +4302,7 @@ func (m *GetRangeRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Ranges = append(m.Ranges, Range{}) - if err := m.Ranges[len(m.Ranges)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Range.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/object/service.proto b/object/service.proto index 4487a49..fb80e5d 100644 --- a/object/service.proto +++ b/object/service.proto @@ -42,9 +42,10 @@ service Service { // package). rpc Search(SearchRequest) returns (stream SearchResponse); - // GetRange of data payload. Ranges are set of pairs (offset, length). - // Fragments order in response corresponds to ranges order in request. - rpc GetRange(GetRangeRequest) returns (GetRangeResponse); + // GetRange of data payload. Range is a pair (offset, length). + // Requested range can be restored by concatenation of all chunks + // keeping receiving order. + rpc GetRange(GetRangeRequest) returns (stream GetRangeResponse); // GetRangeHash returns homomorphic hash of object payload range after XOR // operation. Ranges are set of pairs (offset, length). Hashes order in @@ -153,8 +154,8 @@ message SearchResponse { message GetRangeRequest { // Address of object (container id + object id) refs.Address Address = 1 [(gogoproto.nullable) = false]; - // Ranges of object's payload to return - repeated Range Ranges = 2 [(gogoproto.nullable) = false]; + // Range of object's payload to return + Range Range = 2 [(gogoproto.nullable) = false]; // RequestMetaHeader contains information about request meta headers (should be embedded into message) service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) From 1caab5200c7b31b8d9223be55c6877335c73f9a0 Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Wed, 5 Feb 2020 13:55:07 +0300 Subject: [PATCH 0092/1196] Add badges --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index d9a97b8..1320e72 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,13 @@ # NeoFS API +![Go](https://github.com/nspcc-dev/neofs-api/workflows/Go/badge.svg) +[![codecov](https://codecov.io/gh/nspcc-dev/neofs-api/branch/master/graph/badge.svg)](https://codecov.io/gh/nspcc-dev/neofs-api) +[![Report](https://goreportcard.com/badge/github.com/nspcc-dev/neofs-api)](https://goreportcard.com/report/github.com/nspcc-dev/neofs-api) +[![GitHub release](https://img.shields.io/github/release/nspcc-dev/neofs-api.svg)](https://github.com/nspcc-dev/neofs-api) +![GitHub license](https://img.shields.io/github/license/nspcc-dev/neofs-api.svg?style=popout) + +--- + NeoFS API repository contains implementation of core NeoFS structures that can be used for integration with NeoFS. From c0dd4fcb153e3603d65afb156c3e77883627889f Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Wed, 5 Feb 2020 14:34:23 +0300 Subject: [PATCH 0093/1196] Get range response struct --- docs/object.md | 2 +- object/service.pb.go | 138 +++++++++++++++++++++---------------------- object/service.proto | 4 +- 3 files changed, 71 insertions(+), 73 deletions(-) diff --git a/docs/object.md b/docs/object.md index 997991a..d13b676 100644 --- a/docs/object.md +++ b/docs/object.md @@ -210,7 +210,7 @@ in distributed system. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| Fragments | [bytes](#bytes) | repeated | Fragments of object's payload | +| Fragment | [bytes](#bytes) | | Fragment of object's payload | diff --git a/object/service.pb.go b/object/service.pb.go index 0e40508..10fbe51 100644 --- a/object/service.pb.go +++ b/object/service.pb.go @@ -716,8 +716,8 @@ func (m *GetRangeRequest) GetRange() Range { } type GetRangeResponse struct { - // Fragments of object's payload - Fragments [][]byte `protobuf:"bytes,1,rep,name=Fragments,proto3" json:"Fragments,omitempty"` + // Fragment of object's payload + Fragment []byte `protobuf:"bytes,1,opt,name=Fragment,proto3" json:"Fragment,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -752,9 +752,9 @@ func (m *GetRangeResponse) XXX_DiscardUnknown() { var xxx_messageInfo_GetRangeResponse proto.InternalMessageInfo -func (m *GetRangeResponse) GetFragments() [][]byte { +func (m *GetRangeResponse) GetFragment() []byte { if m != nil { - return m.Fragments + return m.Fragment } return nil } @@ -883,61 +883,61 @@ func init() { func init() { proto.RegisterFile("object/service.proto", fileDescriptor_dfcdf610ade6a9ce) } var fileDescriptor_dfcdf610ade6a9ce = []byte{ - // 859 bytes of a gzipped FileDescriptorProto + // 858 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x56, 0xcd, 0x6e, 0xeb, 0x44, - 0x14, 0xce, 0xc4, 0x89, 0xdb, 0x9e, 0x38, 0xbd, 0xd1, 0x34, 0x5c, 0x22, 0x53, 0xa5, 0x95, 0x75, - 0x41, 0x41, 0x28, 0x4e, 0xb8, 0x48, 0xa5, 0x88, 0x4a, 0x88, 0x24, 0x6a, 0xd3, 0x05, 0x6a, 0x99, + 0x14, 0xce, 0xc4, 0x89, 0x9b, 0x7b, 0xe2, 0xf4, 0x46, 0xd3, 0x70, 0x89, 0xcc, 0x55, 0x5a, 0x59, + 0x05, 0x05, 0xa1, 0x38, 0xa5, 0x48, 0xa5, 0x88, 0x4a, 0x88, 0x24, 0x6a, 0xd3, 0x05, 0x6a, 0x99, 0x56, 0x95, 0x60, 0xe7, 0x38, 0x93, 0xc4, 0x34, 0xb5, 0x83, 0x7f, 0x5a, 0xf5, 0x01, 0x58, 0xb3, 0x65, 0xc9, 0x83, 0xf0, 0x00, 0xdd, 0x20, 0x75, 0x89, 0x58, 0x54, 0x28, 0x2c, 0x79, 0x01, 0x24, 0x36, 0x68, 0x7e, 0x1c, 0xdb, 0x2d, 0x2d, 0xd0, 0x4d, 0xee, 0x2a, 0x33, 0xdf, 0xf9, 0xce, 0x99, - 0x9c, 0xcf, 0xdf, 0x19, 0x1b, 0xaa, 0xde, 0xe0, 0x1b, 0x6a, 0x87, 0xad, 0x80, 0xfa, 0x97, 0x8e, - 0x4d, 0xcd, 0x99, 0xef, 0x85, 0x1e, 0x56, 0x05, 0xaa, 0x57, 0x7c, 0x3a, 0x0a, 0x5a, 0xe1, 0xf5, - 0x8c, 0x06, 0x22, 0xa2, 0x63, 0xc9, 0x4f, 0x63, 0x1b, 0x01, 0x0d, 0x02, 0xc7, 0x73, 0xb3, 0x44, - 0x59, 0xb1, 0x75, 0x41, 0x43, 0x4b, 0x62, 0xd5, 0x18, 0xbb, 0xa4, 0xbe, 0x33, 0xba, 0x96, 0x68, - 0x73, 0xec, 0x84, 0x93, 0x68, 0x60, 0xda, 0xde, 0x45, 0x6b, 0xec, 0x8d, 0xbd, 0x16, 0x87, 0x07, + 0x9c, 0xcf, 0xdf, 0x19, 0x1b, 0x6a, 0xde, 0xe0, 0x1b, 0x6a, 0x87, 0xed, 0x80, 0xfa, 0x97, 0x8e, + 0x4d, 0xcd, 0x99, 0xef, 0x85, 0x1e, 0x56, 0x05, 0xaa, 0x57, 0x7d, 0x3a, 0x0a, 0xda, 0xe1, 0xf5, + 0x8c, 0x06, 0x22, 0xa2, 0x63, 0xc9, 0x4f, 0x63, 0x6b, 0x01, 0x0d, 0x02, 0xc7, 0x73, 0xb3, 0x44, + 0x59, 0xb1, 0x7d, 0x41, 0x43, 0x4b, 0x62, 0xb5, 0x18, 0xbb, 0xa4, 0xbe, 0x33, 0xba, 0x96, 0x68, + 0x6b, 0xec, 0x84, 0x93, 0x68, 0x60, 0xda, 0xde, 0x45, 0x7b, 0xec, 0x8d, 0xbd, 0x36, 0x87, 0x07, 0xd1, 0x88, 0xef, 0xf8, 0x86, 0xaf, 0x04, 0xdd, 0xf8, 0x19, 0x01, 0x1c, 0xd0, 0x90, 0xd0, 0x6f, - 0x23, 0x1a, 0x84, 0xb8, 0x09, 0x2b, 0x9f, 0x0f, 0x87, 0x3e, 0x0d, 0x82, 0x1a, 0xda, 0x46, 0x8d, - 0xd2, 0xeb, 0xb2, 0xc9, 0xfe, 0xb4, 0x29, 0xc1, 0x4e, 0xe1, 0xe6, 0x6e, 0x2b, 0x47, 0x62, 0x0e, - 0xae, 0x80, 0x42, 0xac, 0xab, 0x5a, 0x7e, 0x1b, 0x35, 0x56, 0x09, 0x5b, 0xe2, 0x5d, 0x28, 0x7c, - 0x41, 0x43, 0xab, 0x36, 0xe0, 0xd9, 0xba, 0x19, 0x2b, 0x21, 0x0f, 0x60, 0xb1, 0x3e, 0xb5, 0x86, - 0xd4, 0xef, 0xac, 0xb2, 0x52, 0xb7, 0x77, 0x5b, 0x88, 0xf0, 0x0c, 0xdc, 0x03, 0xf5, 0x8c, 0x37, - 0x52, 0xb3, 0x79, 0xae, 0x71, 0x3f, 0x97, 0x47, 0x1d, 0xdb, 0x0a, 0x1d, 0xcf, 0x7d, 0x50, 0x43, - 0xe6, 0x1a, 0xa7, 0x50, 0xe2, 0xed, 0x04, 0x33, 0xcf, 0x0d, 0x28, 0x6e, 0x80, 0x14, 0x5f, 0xb6, - 0xb3, 0x6e, 0x8a, 0xad, 0x79, 0xc4, 0x7f, 0xfa, 0x39, 0x22, 0xe3, 0xf8, 0x25, 0x14, 0xbb, 0x93, - 0xc8, 0x3d, 0xe7, 0xcd, 0x68, 0xfd, 0x1c, 0x11, 0xdb, 0x8e, 0x02, 0x88, 0x18, 0x3f, 0xe5, 0x01, - 0x8e, 0xa3, 0x85, 0x4a, 0x3b, 0xa0, 0x8a, 0x3f, 0x20, 0xab, 0x6e, 0xc6, 0x55, 0x13, 0x0e, 0x5b, - 0x0a, 0x0e, 0x3b, 0x43, 0xac, 0x1e, 0x3b, 0x63, 0xd9, 0xa2, 0xe9, 0x5f, 0xc1, 0xda, 0xe2, 0xef, - 0xe2, 0xf7, 0x40, 0x3d, 0x7a, 0x42, 0x32, 0x22, 0xa3, 0xf8, 0x15, 0x14, 0x4f, 0xbd, 0x73, 0xea, - 0xf2, 0x66, 0x18, 0x4d, 0xfa, 0xd6, 0xe4, 0x28, 0x11, 0x41, 0x21, 0xdf, 0x1e, 0x94, 0xb8, 0x32, - 0xf2, 0xa1, 0xfc, 0x3f, 0x93, 0x19, 0xdf, 0xe7, 0xa1, 0xdc, 0xa3, 0x53, 0x1a, 0xd2, 0x67, 0xba, - 0xf4, 0x7d, 0x58, 0x39, 0xba, 0x72, 0xa9, 0x7f, 0xd8, 0x13, 0xc2, 0x77, 0x5e, 0xb0, 0xf8, 0xaf, - 0x77, 0x5b, 0x31, 0x4c, 0xe2, 0x45, 0xd2, 0x94, 0xf2, 0x44, 0x53, 0x4b, 0x37, 0x79, 0x05, 0xd6, - 0x63, 0x41, 0x84, 0xa4, 0xc6, 0x5f, 0x08, 0x4a, 0x8c, 0x1e, 0x2b, 0xb4, 0xfb, 0x2f, 0x0a, 0x2d, - 0x14, 0x90, 0x40, 0x22, 0xd6, 0x36, 0x94, 0xf6, 0xa3, 0xe9, 0x54, 0x9c, 0x1d, 0xc8, 0xd1, 0x4e, - 0x43, 0xf1, 0xd0, 0x2b, 0x6f, 0xce, 0xd0, 0xef, 0x80, 0x26, 0x9a, 0x97, 0x06, 0xfb, 0x8f, 0x16, - 0x36, 0xfe, 0x44, 0x50, 0x3e, 0xa1, 0x96, 0x6f, 0x4f, 0x12, 0x67, 0x95, 0xba, 0x9e, 0x1b, 0x5a, - 0x8e, 0xb0, 0x0b, 0xe2, 0x76, 0x29, 0x49, 0xb1, 0x94, 0xee, 0x61, 0x8f, 0xa4, 0xe3, 0xb8, 0x0a, - 0xc5, 0x2f, 0x23, 0xea, 0x5f, 0x0b, 0x5f, 0x11, 0xb1, 0xc1, 0x06, 0x68, 0x7c, 0x71, 0x46, 0x7d, - 0xe6, 0x1d, 0xae, 0x54, 0x99, 0x64, 0xb0, 0xa5, 0x4b, 0xd6, 0x85, 0xf5, 0xb8, 0x73, 0x29, 0xda, - 0x87, 0xb0, 0x26, 0x3d, 0x40, 0x99, 0x69, 0x94, 0xc7, 0xc6, 0x2a, 0x61, 0x19, 0x7f, 0x20, 0x78, - 0xc1, 0x6e, 0x5b, 0xcb, 0x1d, 0x3f, 0x7f, 0x36, 0x8b, 0x3c, 0x5d, 0xde, 0x22, 0xe5, 0xf8, 0x49, - 0x71, 0x50, 0x92, 0x05, 0x63, 0xe9, 0x92, 0xb5, 0xa1, 0x92, 0x34, 0x2b, 0x45, 0xdb, 0x84, 0xb5, - 0x7d, 0xdf, 0x1a, 0x5f, 0x50, 0x37, 0x14, 0xa2, 0x69, 0x24, 0x01, 0x8c, 0xef, 0xf2, 0xb0, 0x11, - 0xa7, 0xf4, 0xad, 0x60, 0xf2, 0x4c, 0x8d, 0x3e, 0x00, 0x95, 0x97, 0x60, 0xd3, 0xa8, 0x3c, 0x26, - 0x92, 0xa4, 0x60, 0x0c, 0x85, 0x13, 0x6b, 0x1a, 0x72, 0xd3, 0x69, 0x84, 0xaf, 0x97, 0xae, 0xdc, - 0x1e, 0x54, 0xb3, 0x32, 0x48, 0xf5, 0x5e, 0x81, 0xca, 0xf6, 0xd2, 0x6f, 0x5a, 0x47, 0x93, 0x83, - 0x56, 0xe0, 0x2c, 0x19, 0x7b, 0xfd, 0xa3, 0x02, 0x2b, 0x27, 0xe2, 0x54, 0xdc, 0x06, 0xe5, 0x80, - 0x86, 0x18, 0xc7, 0x0a, 0x24, 0x9f, 0x2e, 0xfa, 0x46, 0x06, 0x13, 0x27, 0xb4, 0x11, 0xcb, 0x38, - 0x8e, 0x52, 0x19, 0xc9, 0x2b, 0x3a, 0xc9, 0x48, 0xbd, 0x9c, 0x1a, 0x08, 0x7f, 0x0c, 0xaa, 0xb8, - 0x5d, 0xf1, 0x5b, 0x31, 0x21, 0xf3, 0xfa, 0xd1, 0x5f, 0xde, 0x87, 0x17, 0x13, 0x54, 0x60, 0x12, - 0xe0, 0x45, 0xdd, 0xd4, 0x8d, 0xac, 0x57, 0xb3, 0xa0, 0x4c, 0xf9, 0x04, 0x54, 0x31, 0x86, 0xc9, - 0x59, 0x99, 0x0b, 0x29, 0x39, 0x2b, 0x3b, 0xad, 0x6d, 0x84, 0x3f, 0x83, 0xd5, 0x58, 0x54, 0xfc, - 0x76, 0xba, 0xf7, 0xd4, 0x34, 0xea, 0xb5, 0x87, 0x81, 0x45, 0x81, 0x43, 0xd0, 0xd2, 0x4f, 0x05, - 0xbf, 0x73, 0x9f, 0x9b, 0xb2, 0xac, 0xbe, 0xf9, 0xcf, 0x41, 0x51, 0xac, 0xf3, 0xe9, 0xcd, 0xbc, - 0x8e, 0x6e, 0xe7, 0x75, 0xf4, 0xcb, 0xbc, 0x8e, 0x7e, 0x9b, 0xd7, 0xd1, 0x0f, 0xbf, 0xd7, 0x73, - 0x5f, 0xbf, 0x9b, 0xfa, 0x14, 0x75, 0x83, 0x99, 0x6d, 0x37, 0x87, 0xf4, 0xb2, 0xe5, 0x52, 0x6f, - 0x14, 0x34, 0xad, 0x99, 0xd3, 0x12, 0x15, 0x07, 0x2a, 0xff, 0x12, 0xfd, 0xe8, 0xef, 0x00, 0x00, - 0x00, 0xff, 0xff, 0x46, 0xff, 0x20, 0xe9, 0x3d, 0x0b, 0x00, 0x00, + 0x23, 0x1a, 0x84, 0xb8, 0x05, 0x2b, 0x9f, 0x0f, 0x87, 0x3e, 0x0d, 0x82, 0x3a, 0xda, 0x40, 0xcd, + 0xf2, 0x76, 0xc5, 0x64, 0x7f, 0xda, 0x94, 0x60, 0xa7, 0x70, 0x73, 0xb7, 0x9e, 0x23, 0x31, 0x07, + 0x57, 0x41, 0x21, 0xd6, 0x55, 0x3d, 0xbf, 0x81, 0x9a, 0x25, 0xc2, 0x96, 0x78, 0x17, 0x0a, 0x5f, + 0xd0, 0xd0, 0xaa, 0x0f, 0x78, 0xb6, 0x6e, 0xc6, 0x4a, 0xc8, 0x03, 0x58, 0xac, 0x4f, 0xad, 0x21, + 0xf5, 0x3b, 0x25, 0x56, 0xea, 0xf6, 0x6e, 0x1d, 0x11, 0x9e, 0x81, 0x7b, 0xa0, 0x9e, 0xf1, 0x46, + 0xea, 0x36, 0xcf, 0x35, 0xee, 0xe7, 0xf2, 0xa8, 0x63, 0x5b, 0xa1, 0xe3, 0xb9, 0x0f, 0x6a, 0xc8, + 0x5c, 0xe3, 0x14, 0xca, 0xbc, 0x9d, 0x60, 0xe6, 0xb9, 0x01, 0xc5, 0x4d, 0x90, 0xe2, 0xcb, 0x76, + 0x56, 0x4d, 0xb1, 0x35, 0x8f, 0xf8, 0x4f, 0x3f, 0x47, 0x64, 0x1c, 0xbf, 0x82, 0x62, 0x77, 0x12, + 0xb9, 0xe7, 0xbc, 0x19, 0xad, 0x9f, 0x23, 0x62, 0xdb, 0x51, 0x00, 0x11, 0xe3, 0xa7, 0x3c, 0xc0, + 0x71, 0xb4, 0x50, 0x69, 0x07, 0x54, 0xf1, 0x07, 0x64, 0xd5, 0xd7, 0x71, 0xd5, 0x84, 0xc3, 0x96, + 0x82, 0xc3, 0xce, 0x10, 0xab, 0xc7, 0xce, 0x58, 0xb6, 0x68, 0xfa, 0x57, 0xf0, 0x62, 0xf1, 0x77, + 0xf1, 0x7b, 0xa0, 0x1e, 0x3d, 0x21, 0x19, 0x91, 0x51, 0xbc, 0x09, 0xc5, 0x53, 0xef, 0x9c, 0xba, + 0xbc, 0x19, 0x46, 0x93, 0xbe, 0x35, 0x39, 0x4a, 0x44, 0x50, 0xc8, 0xb7, 0x07, 0x65, 0xae, 0x8c, + 0x7c, 0x28, 0xff, 0xcf, 0x64, 0xc6, 0xf7, 0x79, 0xa8, 0xf4, 0xe8, 0x94, 0x86, 0xf4, 0x99, 0x2e, + 0x7d, 0x1f, 0x56, 0x8e, 0xae, 0x5c, 0xea, 0x1f, 0xf6, 0x84, 0xf0, 0x9d, 0x97, 0x2c, 0xfe, 0xeb, + 0xdd, 0x7a, 0x0c, 0x93, 0x78, 0x91, 0x34, 0xa5, 0x3c, 0xd1, 0xd4, 0xd2, 0x4d, 0x5e, 0x85, 0xd5, + 0x58, 0x10, 0x21, 0xa9, 0xf1, 0x17, 0x82, 0x32, 0xa3, 0xc7, 0x0a, 0xed, 0xfe, 0x8b, 0x42, 0x0b, + 0x05, 0x24, 0x90, 0x88, 0xb5, 0x01, 0xe5, 0xfd, 0x68, 0x3a, 0x15, 0x67, 0x07, 0x72, 0xb4, 0xd3, + 0x50, 0x3c, 0xf4, 0xca, 0x9b, 0x33, 0xf4, 0x3b, 0xa0, 0x89, 0xe6, 0xa5, 0xc1, 0xfe, 0xa3, 0x85, + 0x8d, 0x3f, 0x11, 0x54, 0x4e, 0xa8, 0xe5, 0xdb, 0x93, 0xc4, 0x59, 0xe5, 0xae, 0xe7, 0x86, 0x96, + 0x23, 0xec, 0x82, 0xb8, 0x5d, 0xca, 0x52, 0x2c, 0xa5, 0x7b, 0xd8, 0x23, 0xe9, 0x38, 0xae, 0x41, + 0xf1, 0xcb, 0x88, 0xfa, 0xd7, 0xc2, 0x57, 0x44, 0x6c, 0xb0, 0x01, 0x1a, 0x5f, 0x9c, 0x51, 0x9f, + 0x79, 0x87, 0x2b, 0x55, 0x21, 0x19, 0x6c, 0xe9, 0x92, 0x75, 0x61, 0x35, 0xee, 0x5c, 0x8a, 0xf6, + 0x21, 0xbc, 0x90, 0x1e, 0xa0, 0xcc, 0x34, 0xca, 0x63, 0x63, 0x95, 0xb0, 0x8c, 0x3f, 0x10, 0xbc, + 0x64, 0xb7, 0xad, 0xe5, 0x8e, 0x9f, 0x3f, 0x9b, 0x45, 0x9e, 0x2e, 0x6f, 0x91, 0x4a, 0xfc, 0xa4, + 0x38, 0x28, 0xc9, 0x82, 0xb1, 0x74, 0xc9, 0x4c, 0xa8, 0x26, 0xcd, 0x4a, 0xd1, 0x74, 0x28, 0xed, + 0xfb, 0xd6, 0xf8, 0x82, 0xba, 0xc2, 0x6b, 0x1a, 0x59, 0xec, 0x8d, 0xef, 0xf2, 0xb0, 0x16, 0x27, + 0xf4, 0xad, 0x60, 0xf2, 0x4c, 0x85, 0x3e, 0x00, 0x95, 0x97, 0x60, 0xb3, 0xa8, 0x3c, 0x26, 0x91, + 0xa4, 0x60, 0x0c, 0x85, 0x13, 0x6b, 0x1a, 0x72, 0xcb, 0x69, 0x84, 0xaf, 0x97, 0xae, 0xdb, 0x1e, + 0xd4, 0xb2, 0x32, 0x48, 0xed, 0x36, 0x41, 0x65, 0x7b, 0xe9, 0x36, 0xad, 0xa3, 0xc9, 0x31, 0x2b, + 0x70, 0x96, 0x8c, 0x6d, 0xff, 0xa8, 0xc0, 0xca, 0x89, 0x38, 0x15, 0x6f, 0x81, 0x72, 0x40, 0x43, + 0x8c, 0x63, 0x05, 0x92, 0x0f, 0x17, 0x7d, 0x2d, 0x83, 0x89, 0x13, 0xb6, 0x10, 0xcb, 0x38, 0x8e, + 0x52, 0x19, 0xc9, 0x0b, 0x3a, 0xc9, 0x48, 0xbd, 0x9a, 0x9a, 0x08, 0x7f, 0x0c, 0xaa, 0xb8, 0x5b, + 0xf1, 0x5b, 0x31, 0x21, 0xf3, 0xf2, 0xd1, 0x5f, 0xdd, 0x87, 0x17, 0xf3, 0x53, 0x60, 0x12, 0xe0, + 0x45, 0xdd, 0xd4, 0x7d, 0xac, 0xd7, 0xb2, 0xa0, 0x4c, 0xf9, 0x04, 0x54, 0x31, 0x84, 0xc9, 0x59, + 0x99, 0xeb, 0x28, 0x39, 0x2b, 0x3b, 0xab, 0x5b, 0x08, 0x7f, 0x06, 0xa5, 0x58, 0x54, 0xfc, 0x76, + 0xba, 0xf7, 0xd4, 0x2c, 0xea, 0xf5, 0x87, 0x81, 0x45, 0x81, 0x43, 0xd0, 0xd2, 0x4f, 0x05, 0xbf, + 0x73, 0x9f, 0x9b, 0xb2, 0xac, 0xfe, 0xfa, 0x9f, 0x83, 0xa2, 0x58, 0xe7, 0xd3, 0x9b, 0x79, 0x03, + 0xdd, 0xce, 0x1b, 0xe8, 0x97, 0x79, 0x03, 0xfd, 0x36, 0x6f, 0xa0, 0x1f, 0x7e, 0x6f, 0xe4, 0xbe, + 0x7e, 0x37, 0xf5, 0x21, 0xea, 0x06, 0x33, 0xdb, 0x6e, 0x0d, 0xe9, 0x65, 0xdb, 0xa5, 0xde, 0x28, + 0x68, 0x59, 0x33, 0xa7, 0x2d, 0x2a, 0x0e, 0x54, 0xfe, 0x1d, 0xfa, 0xd1, 0xdf, 0x01, 0x00, 0x00, + 0xff, 0xff, 0xcd, 0x28, 0x29, 0x7f, 0x3b, 0x0b, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -2170,14 +2170,12 @@ func (m *GetRangeResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } - if len(m.Fragments) > 0 { - for iNdEx := len(m.Fragments) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Fragments[iNdEx]) - copy(dAtA[i:], m.Fragments[iNdEx]) - i = encodeVarintService(dAtA, i, uint64(len(m.Fragments[iNdEx]))) - i-- - dAtA[i] = 0xa - } + if len(m.Fragment) > 0 { + i -= len(m.Fragment) + copy(dAtA[i:], m.Fragment) + i = encodeVarintService(dAtA, i, uint64(len(m.Fragment))) + i-- + dAtA[i] = 0xa } return len(dAtA) - i, nil } @@ -2598,11 +2596,9 @@ func (m *GetRangeResponse) Size() (n int) { } var l int _ = l - if len(m.Fragments) > 0 { - for _, b := range m.Fragments { - l = len(b) - n += 1 + l + sovService(uint64(l)) - } + l = len(m.Fragment) + if l > 0 { + n += 1 + l + sovService(uint64(l)) } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) @@ -4428,7 +4424,7 @@ func (m *GetRangeResponse) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Fragments", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Fragment", wireType) } var byteLen int for shift := uint(0); ; shift += 7 { @@ -4455,8 +4451,10 @@ func (m *GetRangeResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Fragments = append(m.Fragments, make([]byte, postIndex-iNdEx)) - copy(m.Fragments[len(m.Fragments)-1], dAtA[iNdEx:postIndex]) + m.Fragment = append(m.Fragment[:0], dAtA[iNdEx:postIndex]...) + if m.Fragment == nil { + m.Fragment = []byte{} + } iNdEx = postIndex default: iNdEx = preIndex diff --git a/object/service.proto b/object/service.proto index fb80e5d..662bf8a 100644 --- a/object/service.proto +++ b/object/service.proto @@ -163,8 +163,8 @@ message GetRangeRequest { } message GetRangeResponse { - // Fragments of object's payload - repeated bytes Fragments = 1; + // Fragment of object's payload + bytes Fragment = 1; } message GetRangeHashRequest { From 49cc731c8de283f1fd68c81bce6de1d6b26e496a Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Wed, 5 Feb 2020 16:58:06 +0300 Subject: [PATCH 0094/1196] update proto files, regenerate pb.go --- accounting/service.pb.go | 51 ++++++++--------- accounting/service.proto | 1 + accounting/types.pb.go | 107 +++++++++++++++++------------------ accounting/types.proto | 1 + accounting/withdraw.pb.go | 77 ++++++++++++------------- accounting/withdraw.proto | 1 + bootstrap/service.pb.go | 47 ++++++++-------- bootstrap/service.proto | 1 + bootstrap/types.pb.go | 47 ++++++++-------- bootstrap/types.proto | 3 +- container/service.pb.go | 77 ++++++++++++------------- container/service.proto | 1 + container/types.pb.go | 51 ++++++++--------- container/types.proto | 1 + decimal/decimal.pb.go | 9 +-- decimal/decimal.proto | 1 + object/service.pb.go | 111 ++++++++++++++++++------------------ object/service.proto | 1 + object/types.pb.go | 115 +++++++++++++++++++------------------- object/types.proto | 1 + query/types.pb.go | 9 +-- query/types.proto | 1 + refs/types.pb.go | 9 +-- refs/types.proto | 1 + service/meta.pb.go | 9 +-- service/meta.proto | 1 + service/verify.pb.go | 9 +-- service/verify.proto | 1 + session/service.pb.go | 50 +++++++++-------- session/service.proto | 1 + session/types.pb.go | 49 ++++++++-------- session/types.proto | 1 + state/service.pb.go | 61 ++++++++++---------- state/service.proto | 1 + storagegroup/types.pb.go | 49 ++++++++-------- storagegroup/types.proto | 1 + 36 files changed, 497 insertions(+), 460 deletions(-) diff --git a/accounting/service.pb.go b/accounting/service.pb.go index 4e1127b..5b485ce 100644 --- a/accounting/service.pb.go +++ b/accounting/service.pb.go @@ -132,31 +132,32 @@ func init() { func init() { proto.RegisterFile("accounting/service.proto", fileDescriptor_7f9514b8f1d4c7fe) } var fileDescriptor_7f9514b8f1d4c7fe = []byte{ - // 379 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x51, 0xbb, 0xae, 0xd3, 0x30, - 0x18, 0xae, 0x01, 0xb5, 0xc8, 0xad, 0x28, 0x32, 0x17, 0x45, 0x41, 0x4a, 0xab, 0x4e, 0x2d, 0x52, - 0x13, 0x29, 0x0c, 0xb0, 0xa1, 0x46, 0x1d, 0x40, 0x02, 0x81, 0x32, 0x30, 0xb0, 0x39, 0xee, 0xdf, - 0x60, 0xd1, 0xda, 0x21, 0x76, 0x82, 0xfa, 0x26, 0xbc, 0x0b, 0x2f, 0xd0, 0xb1, 0x23, 0x62, 0xa8, - 0x8e, 0x72, 0x5e, 0xe4, 0xa8, 0x8e, 0xd3, 0xcb, 0x39, 0x67, 0xb2, 0xfd, 0xdd, 0xfc, 0xfb, 0x33, - 0x76, 0x28, 0x63, 0xb2, 0x10, 0x9a, 0x8b, 0x34, 0x50, 0x90, 0x97, 0x9c, 0x81, 0x9f, 0xe5, 0x52, - 0x4b, 0x82, 0x4f, 0x8c, 0x4b, 0x2c, 0x15, 0xac, 0x41, 0xd3, 0x9a, 0x77, 0x9f, 0x37, 0x58, 0x09, - 0x39, 0x5f, 0x6e, 0x2c, 0xfa, 0x62, 0x01, 0x8c, 0xaf, 0xe9, 0x2a, 0xb0, 0xab, 0x85, 0x5f, 0x9e, - 0x5d, 0xa3, 0x37, 0x19, 0x28, 0x8b, 0x4f, 0x53, 0xae, 0x7f, 0x14, 0x89, 0xcf, 0xe4, 0x3a, 0x48, - 0x65, 0x2a, 0x03, 0x03, 0x27, 0xc5, 0xd2, 0x9c, 0xcc, 0xc1, 0xec, 0x6a, 0xf9, 0xe8, 0x2f, 0xc2, - 0x4f, 0x22, 0xba, 0xa2, 0x82, 0x41, 0x0c, 0xbf, 0x0a, 0x50, 0x9a, 0x4c, 0x70, 0xe7, 0xcb, 0x6f, - 0x01, 0xf9, 0xc7, 0xb9, 0x83, 0x86, 0x68, 0xdc, 0x8b, 0xfa, 0xdb, 0xfd, 0xa0, 0xf5, 0x7f, 0x3f, - 0x68, 0xe0, 0xb8, 0xd9, 0x90, 0x77, 0xf8, 0xd1, 0x67, 0xd0, 0xd4, 0x49, 0x86, 0x68, 0xdc, 0x0d, - 0x5d, 0xbf, 0x79, 0xaf, 0x8d, 0x3a, 0x70, 0x1f, 0x80, 0x2e, 0x20, 0x8f, 0x1e, 0x1f, 0x32, 0x76, - 0xfb, 0x01, 0x8a, 0x8d, 0x83, 0xcc, 0x71, 0xfb, 0x9b, 0x79, 0xa5, 0xc3, 0x8c, 0x77, 0x74, 0xdb, - 0x6b, 0x58, 0xce, 0xa8, 0xe6, 0x52, 0xdc, 0xc9, 0xb0, 0xde, 0x51, 0x89, 0xfb, 0xc7, 0xe1, 0x55, - 0x26, 0x85, 0x02, 0xf2, 0x1a, 0x77, 0x2c, 0x64, 0xa6, 0xef, 0x86, 0x4f, 0xfd, 0xa6, 0xb8, 0x79, - 0xbd, 0xc6, 0x8d, 0x80, 0xbc, 0xc5, 0xbd, 0x4f, 0x92, 0xfd, 0x9c, 0xd5, 0x4d, 0x2a, 0xe7, 0xc1, - 0xf0, 0xe1, 0xb8, 0x1b, 0x3e, 0xf3, 0x4f, 0xd5, 0xfa, 0x96, 0x8b, 0x2f, 0x84, 0xe1, 0x57, 0x8c, - 0x67, 0x47, 0x0d, 0x89, 0x8e, 0x57, 0x12, 0xf7, 0xdc, 0x7b, 0xd9, 0xab, 0xfb, 0xea, 0x5e, 0xae, - 0x1e, 0x3b, 0x7a, 0xbf, 0xad, 0x3c, 0xb4, 0xab, 0x3c, 0xf4, 0xaf, 0xf2, 0xd0, 0x55, 0xe5, 0xa1, - 0x3f, 0xd7, 0x5e, 0xeb, 0xfb, 0xe4, 0xec, 0x33, 0x85, 0xca, 0x18, 0x9b, 0x2e, 0xa0, 0x0c, 0x04, - 0xc8, 0xa5, 0x9a, 0xd2, 0x8c, 0x07, 0xa7, 0xc0, 0xa4, 0x6d, 0xfe, 0xf3, 0xcd, 0x4d, 0x00, 0x00, - 0x00, 0xff, 0xff, 0x4f, 0x3c, 0xca, 0x62, 0x7f, 0x02, 0x00, 0x00, + // 396 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x51, 0xcd, 0x8e, 0xd3, 0x30, + 0x18, 0x5c, 0x2f, 0x68, 0x17, 0xb9, 0x2b, 0x16, 0x99, 0x05, 0x45, 0x41, 0x4a, 0xab, 0x9e, 0xba, + 0x48, 0x75, 0xa4, 0x70, 0x80, 0x6b, 0xa3, 0x0a, 0xb1, 0x12, 0x3f, 0xab, 0x20, 0xed, 0x81, 0x9b, + 0xe3, 0x7e, 0x0d, 0x16, 0x5b, 0x3b, 0xc4, 0x4e, 0x50, 0xdf, 0x84, 0x67, 0xe0, 0x15, 0x78, 0x81, + 0x1e, 0x7b, 0x44, 0x1c, 0x2a, 0x14, 0x5e, 0x04, 0xd5, 0x71, 0x9a, 0x16, 0x38, 0xd9, 0x9e, 0xf9, + 0x66, 0x3c, 0x1e, 0x63, 0x8f, 0x71, 0xae, 0x4a, 0x69, 0x84, 0xcc, 0x42, 0x0d, 0x45, 0x25, 0x38, + 0xd0, 0xbc, 0x50, 0x46, 0x11, 0xdc, 0x31, 0x3e, 0x71, 0x54, 0xb8, 0x00, 0xc3, 0x1a, 0xde, 0xbf, + 0x68, 0xb1, 0x0a, 0x0a, 0x31, 0x5f, 0x3a, 0xf4, 0xd1, 0x0c, 0xb8, 0x58, 0xb0, 0xdb, 0xd0, 0xad, + 0x0e, 0x7e, 0xbc, 0x77, 0x8d, 0x59, 0xe6, 0xa0, 0x1d, 0x3e, 0xce, 0x84, 0xf9, 0x58, 0xa6, 0x94, + 0xab, 0x45, 0x98, 0xa9, 0x4c, 0x85, 0x16, 0x4e, 0xcb, 0xb9, 0x3d, 0xd9, 0x83, 0xdd, 0x35, 0xe3, + 0xc3, 0xef, 0x08, 0xdf, 0x8f, 0xd9, 0x2d, 0x93, 0x1c, 0x12, 0xf8, 0x5c, 0x82, 0x36, 0xe4, 0x12, + 0x9f, 0xbe, 0xfb, 0x22, 0xa1, 0xb8, 0x9a, 0x7a, 0x68, 0x80, 0x46, 0x67, 0xf1, 0xf9, 0x6a, 0xd3, + 0x3f, 0xfa, 0xb9, 0xe9, 0xb7, 0x70, 0xd2, 0x6e, 0xc8, 0x0b, 0x7c, 0xf7, 0x0d, 0x18, 0xe6, 0xa5, + 0x03, 0x34, 0xea, 0x45, 0x3e, 0x6d, 0xdf, 0xeb, 0xac, 0xb6, 0xdc, 0x2b, 0x60, 0x33, 0x28, 0xe2, + 0x7b, 0x5b, 0x8f, 0xf5, 0xa6, 0x8f, 0x12, 0xab, 0x20, 0x53, 0x7c, 0x72, 0x63, 0x5f, 0xe9, 0x71, + 0xab, 0x1d, 0xfe, 0xad, 0xb5, 0xac, 0xe0, 0xcc, 0x08, 0x25, 0xff, 0xf1, 0x70, 0xda, 0x61, 0x85, + 0xcf, 0x77, 0xe1, 0x75, 0xae, 0xa4, 0x06, 0xf2, 0x14, 0x9f, 0x3a, 0xc8, 0xa6, 0xef, 0x45, 0x0f, + 0x68, 0x5b, 0xdc, 0xb4, 0x59, 0x93, 0x76, 0x80, 0x3c, 0xc7, 0x67, 0xaf, 0x15, 0xff, 0x34, 0x69, + 0x9a, 0xd4, 0xde, 0xf1, 0xe0, 0xce, 0xa8, 0x17, 0x3d, 0xa4, 0x5d, 0xb5, 0xd4, 0x71, 0xc9, 0xc1, + 0x60, 0x74, 0x8d, 0xf1, 0x64, 0x37, 0x43, 0xe2, 0xdd, 0x95, 0xc4, 0xdf, 0xd7, 0x1e, 0xf6, 0xea, + 0x3f, 0xf9, 0x2f, 0xd7, 0xc4, 0x8e, 0x6f, 0x56, 0x75, 0x80, 0xd6, 0x75, 0x80, 0x7e, 0xd4, 0x01, + 0xfa, 0x55, 0x07, 0xe8, 0xeb, 0xef, 0xe0, 0xe8, 0xc3, 0xe5, 0xde, 0x67, 0x4a, 0x9d, 0x73, 0x3e, + 0x9e, 0x41, 0x15, 0x4a, 0x50, 0x73, 0x3d, 0x66, 0xb9, 0x08, 0x3b, 0xc3, 0x6f, 0xc7, 0x17, 0x6f, + 0x41, 0xbd, 0x7c, 0x4f, 0x27, 0xd7, 0x57, 0xb4, 0xcb, 0x96, 0x9e, 0xd8, 0x6f, 0x7e, 0xf6, 0x27, + 0x00, 0x00, 0xff, 0xff, 0x21, 0xfc, 0xc3, 0x0b, 0x96, 0x02, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/accounting/service.proto b/accounting/service.proto index c320106..12fca58 100644 --- a/accounting/service.proto +++ b/accounting/service.proto @@ -1,6 +1,7 @@ syntax = "proto3"; package accounting; option go_package = "github.com/nspcc-dev/neofs-api/accounting"; +option csharp_namespace = "NeoFS.API.Accounting"; import "service/meta.proto"; import "service/verify.proto"; diff --git a/accounting/types.pb.go b/accounting/types.pb.go index f420355..af22ec8 100644 --- a/accounting/types.pb.go +++ b/accounting/types.pb.go @@ -801,59 +801,60 @@ func init() { func init() { proto.RegisterFile("accounting/types.proto", fileDescriptor_437c556d7375b726) } var fileDescriptor_437c556d7375b726 = []byte{ - // 823 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x55, 0x4d, 0x6f, 0xe3, 0x44, - 0x18, 0xce, 0x38, 0x69, 0x3e, 0xde, 0x64, 0x43, 0x34, 0xbb, 0x5b, 0x85, 0x48, 0xa4, 0xc1, 0xe2, - 0x90, 0x3d, 0x34, 0x11, 0x5d, 0xd1, 0x72, 0x41, 0x28, 0x4e, 0x28, 0x5b, 0xb1, 0xea, 0x56, 0x53, - 0x17, 0x04, 0x9c, 0x5c, 0x67, 0x9a, 0x8e, 0x9a, 0xcc, 0x04, 0x7b, 0xdc, 0x8f, 0x3f, 0xc1, 0x99, - 0x0b, 0x27, 0x7e, 0x04, 0x7f, 0x61, 0x8f, 0x70, 0x43, 0x1c, 0x2a, 0x14, 0xfe, 0x08, 0x9a, 0xf1, - 0xd8, 0xb1, 0x57, 0x09, 0x7b, 0x49, 0xde, 0x8f, 0xe7, 0x7d, 0xe6, 0xfd, 0x9a, 0x31, 0xec, 0x7a, - 0xbe, 0x2f, 0x22, 0x2e, 0x19, 0x9f, 0x0d, 0xe5, 0xc3, 0x92, 0x86, 0x83, 0x65, 0x20, 0xa4, 0xc0, - 0xb0, 0xb6, 0x77, 0x9e, 0x4f, 0xa9, 0xcf, 0x16, 0xde, 0x7c, 0x68, 0xfe, 0x63, 0x48, 0x67, 0x7f, - 0xc6, 0xe4, 0x75, 0x74, 0x39, 0xf0, 0xc5, 0x62, 0x38, 0x13, 0x33, 0x31, 0xd4, 0xe6, 0xcb, 0xe8, - 0x4a, 0x6b, 0x5a, 0xd1, 0x52, 0x0c, 0xb7, 0xff, 0xb4, 0xa0, 0x32, 0x8a, 0x49, 0xf1, 0x0b, 0xa8, - 0xbc, 0xb9, 0xe3, 0x34, 0x38, 0x99, 0xb4, 0x51, 0x0f, 0xf5, 0x1b, 0xce, 0x07, 0x6f, 0x1f, 0xf7, - 0x0a, 0x7f, 0x3f, 0xee, 0x25, 0x66, 0x92, 0x08, 0xb8, 0x0d, 0x95, 0xd1, 0x74, 0x1a, 0xd0, 0x30, - 0x6c, 0x5b, 0x3d, 0xd4, 0xaf, 0x91, 0x44, 0xc5, 0x9f, 0xc0, 0x93, 0x33, 0x2f, 0xa0, 0x5c, 0x26, - 0xfe, 0xa2, 0xf6, 0xe7, 0x8d, 0xf8, 0x00, 0xea, 0x23, 0x5f, 0xb2, 0x5b, 0x7a, 0x1c, 0xf1, 0x69, - 0xd8, 0x2e, 0xf5, 0x50, 0xbf, 0x7e, 0xd0, 0x1a, 0x24, 0xa5, 0x4c, 0xe2, 0x7f, 0x92, 0x05, 0xe1, - 0x43, 0xa8, 0xbe, 0x66, 0x57, 0x54, 0xb2, 0x05, 0x6d, 0xef, 0xe8, 0x80, 0x67, 0x83, 0x75, 0x3f, - 0x06, 0x89, 0xcf, 0x29, 0xa9, 0xac, 0x49, 0x8a, 0xc5, 0x87, 0x00, 0xaf, 0x85, 0x7f, 0xe3, 0x7a, - 0xc1, 0x8c, 0xca, 0x76, 0x59, 0x47, 0xee, 0xe6, 0x22, 0x53, 0x2f, 0xc9, 0x20, 0xf1, 0x11, 0x34, - 0x94, 0x66, 0xba, 0x13, 0xb6, 0x2b, 0xbd, 0x62, 0xbf, 0x7e, 0xf0, 0x34, 0x1b, 0x69, 0x7c, 0x24, - 0x07, 0xb4, 0x7f, 0x47, 0xd9, 0x13, 0xf1, 0x04, 0x9a, 0xdf, 0x31, 0x79, 0x3d, 0x0d, 0xbc, 0x3b, - 0x93, 0x03, 0xd2, 0x39, 0x74, 0xb2, 0x4c, 0x79, 0xc4, 0xab, 0x02, 0x79, 0x27, 0x06, 0x7f, 0x0f, - 0xcf, 0xc7, 0x82, 0x4b, 0x8f, 0x71, 0x1a, 0x8c, 0x03, 0xea, 0x49, 0x6a, 0xc8, 0x2c, 0x4d, 0xf6, - 0x71, 0x96, 0x6c, 0x23, 0xf0, 0x55, 0x81, 0x6c, 0x66, 0x70, 0xaa, 0x50, 0x8e, 0x25, 0x7b, 0x04, - 0x55, 0xc7, 0x9b, 0x7b, 0xdc, 0xa7, 0x21, 0xfe, 0x0c, 0xaa, 0x69, 0xe9, 0x68, 0x6b, 0xe9, 0x49, - 0xb7, 0xd3, 0xe2, 0x7f, 0x84, 0x9d, 0x33, 0xef, 0xe1, 0xe4, 0x8d, 0x5a, 0x11, 0x67, 0x2e, 0xfc, - 0x1b, 0xb3, 0x4d, 0x25, 0x92, 0xa8, 0xf8, 0x73, 0x68, 0xb8, 0x81, 0xc7, 0x43, 0xcf, 0x97, 0x4c, - 0x70, 0xb5, 0x41, 0x8a, 0xbd, 0x99, 0x65, 0x77, 0xef, 0x0d, 0x71, 0x0e, 0x69, 0xff, 0x8c, 0xd6, - 0x3b, 0x80, 0x8f, 0xa0, 0x14, 0x71, 0x16, 0x77, 0xb3, 0x79, 0xf0, 0xe1, 0xa6, 0x5d, 0x18, 0x5c, - 0x70, 0x26, 0x9d, 0xea, 0xea, 0x71, 0xaf, 0xa4, 0x24, 0xa2, 0x03, 0xf0, 0x33, 0xd8, 0xf9, 0xd6, - 0x9b, 0x47, 0x54, 0xb7, 0xae, 0x48, 0x62, 0xc5, 0x7e, 0x09, 0x1a, 0x83, 0x9f, 0x40, 0xed, 0x82, - 0xcf, 0xd9, 0x82, 0x49, 0x3a, 0x6d, 0x15, 0x70, 0x13, 0xe0, 0x94, 0x8a, 0xe3, 0xf3, 0xaf, 0x96, - 0xc2, 0xbf, 0x6e, 0x21, 0xdc, 0x80, 0xea, 0x29, 0x15, 0xba, 0x94, 0x96, 0x65, 0x3f, 0x22, 0xb0, - 0xdc, 0x7b, 0xfc, 0x29, 0x94, 0xd4, 0x35, 0x35, 0xa9, 0x3c, 0xcd, 0x57, 0x32, 0x70, 0x1f, 0x96, - 0x34, 0x4e, 0x42, 0x49, 0x44, 0x43, 0x31, 0x86, 0xd2, 0x71, 0x20, 0x16, 0xe6, 0xfa, 0x68, 0x19, - 0x37, 0xc1, 0x72, 0x85, 0xb9, 0x30, 0x96, 0x2b, 0x70, 0x1f, 0xca, 0xa3, 0x85, 0x22, 0xda, 0x7a, - 0x41, 0x8c, 0x1f, 0x77, 0x01, 0xce, 0xa2, 0xcb, 0x39, 0xf3, 0xbf, 0xa1, 0x0f, 0xa1, 0xbe, 0x1d, - 0x0d, 0x92, 0xb1, 0xd8, 0x47, 0xa0, 0xcf, 0xc6, 0x75, 0xa8, 0x5c, 0xf0, 0x1b, 0x2e, 0xee, 0x78, - 0xab, 0xa0, 0x4a, 0x49, 0x96, 0xac, 0x85, 0x70, 0xcd, 0x0c, 0xae, 0x65, 0x29, 0xf1, 0x84, 0x73, - 0x1a, 0xb4, 0x8a, 0xf6, 0xaf, 0x45, 0x80, 0x73, 0x2a, 0xe5, 0x9c, 0x2e, 0x28, 0xd7, 0xad, 0xd3, - 0x8d, 0x30, 0x23, 0x8d, 0x15, 0xfc, 0xc5, 0xc6, 0x81, 0xe6, 0x26, 0xb2, 0xe6, 0x18, 0xb8, 0xf7, - 0xf9, 0xa9, 0x76, 0x26, 0x50, 0x25, 0xd4, 0xa7, 0xec, 0x96, 0x06, 0xa6, 0x05, 0x68, 0x43, 0x0b, - 0xac, 0xff, 0x6f, 0x41, 0xe7, 0x14, 0x6a, 0xe9, 0x7a, 0xe3, 0x8f, 0xa0, 0x38, 0x4e, 0x9f, 0xb1, - 0xba, 0x79, 0xc6, 0x94, 0x89, 0xa8, 0x1f, 0x6c, 0xc3, 0xce, 0xf9, 0xd7, 0x27, 0x93, 0x38, 0xd3, - 0x86, 0xd3, 0x30, 0x80, 0x92, 0x32, 0x92, 0xd8, 0xd5, 0xf9, 0x2d, 0x1e, 0x6d, 0x32, 0x27, 0x94, - 0x99, 0xd3, 0x24, 0x73, 0x94, 0xc9, 0xab, 0xb7, 0xa5, 0xd8, 0x14, 0x67, 0xf6, 0x39, 0x93, 0xe3, - 0x18, 0x6a, 0x49, 0xd9, 0xea, 0x95, 0x54, 0x2d, 0xdb, 0xdb, 0xc2, 0x92, 0xe0, 0x12, 0x92, 0x34, - 0xce, 0x3e, 0xdc, 0xf2, 0x2c, 0xbc, 0xa7, 0x03, 0x76, 0xff, 0xdd, 0x47, 0x09, 0xef, 0x42, 0x79, - 0x7c, 0x4d, 0x7f, 0x8a, 0xa8, 0x29, 0xd5, 0x68, 0xce, 0x97, 0x6f, 0x57, 0x5d, 0xf4, 0xc7, 0xaa, - 0x8b, 0xfe, 0x5a, 0x75, 0xd1, 0x3f, 0xab, 0x2e, 0xfa, 0xe5, 0xdf, 0x6e, 0xe1, 0x87, 0x17, 0x99, - 0xcf, 0x0c, 0x0f, 0x97, 0xbe, 0xbf, 0x3f, 0xa5, 0xb7, 0x43, 0x4e, 0xc5, 0x55, 0xb8, 0xef, 0x2d, - 0xd9, 0x70, 0x5d, 0xc7, 0x65, 0x59, 0x7f, 0x69, 0x5e, 0xfe, 0x17, 0x00, 0x00, 0xff, 0xff, 0x8f, - 0x4d, 0xeb, 0x13, 0xd5, 0x06, 0x00, 0x00, + // 837 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x55, 0xcb, 0x6e, 0x23, 0x45, + 0x14, 0x75, 0xb5, 0x1d, 0x3f, 0xae, 0x3d, 0xc6, 0xaa, 0xc9, 0x44, 0xc6, 0x12, 0x8e, 0x69, 0xb1, + 0xf0, 0x2c, 0xd2, 0x16, 0x19, 0x91, 0xb0, 0x61, 0xe1, 0x07, 0x61, 0x2c, 0x46, 0x99, 0xa8, 0xe2, + 0x0c, 0x02, 0x56, 0x9d, 0x76, 0xc5, 0x29, 0xc5, 0xae, 0x32, 0xdd, 0xd5, 0x79, 0xfc, 0x04, 0x6b, + 0x36, 0xac, 0xd8, 0xf1, 0x03, 0xfc, 0xc2, 0x2c, 0x61, 0x87, 0x58, 0x44, 0xc8, 0xfc, 0x08, 0xaa, + 0xea, 0xea, 0x76, 0x77, 0x64, 0xc3, 0xc6, 0xbe, 0x8f, 0x73, 0x4f, 0xdd, 0x57, 0x55, 0xc3, 0x9e, + 0xeb, 0x79, 0x22, 0xe4, 0x92, 0xf1, 0x59, 0x4f, 0x3e, 0x2c, 0x69, 0xe0, 0x2c, 0x7d, 0x21, 0x05, + 0x86, 0xb5, 0xbd, 0xf5, 0x62, 0x4a, 0x3d, 0xb6, 0x70, 0xe7, 0x3d, 0xf3, 0x1f, 0x41, 0x5a, 0x07, + 0x33, 0x26, 0xaf, 0xc3, 0x4b, 0xc7, 0x13, 0x8b, 0xde, 0x4c, 0xcc, 0x44, 0x4f, 0x9b, 0x2f, 0xc3, + 0x2b, 0xad, 0x69, 0x45, 0x4b, 0x11, 0xdc, 0xfe, 0xc3, 0x82, 0x52, 0x3f, 0x22, 0xc5, 0x2f, 0xa1, + 0xf4, 0xf6, 0x8e, 0x53, 0x7f, 0x3c, 0x6a, 0xa2, 0x0e, 0xea, 0xd6, 0x06, 0x1f, 0xbc, 0x7f, 0xdc, + 0xcf, 0xfd, 0xf5, 0xb8, 0x1f, 0x9b, 0x49, 0x2c, 0xe0, 0x26, 0x94, 0xfa, 0xd3, 0xa9, 0x4f, 0x83, + 0xa0, 0x69, 0x75, 0x50, 0xb7, 0x42, 0x62, 0x15, 0x7f, 0x02, 0xcf, 0xce, 0x5c, 0x9f, 0x72, 0x19, + 0xfb, 0xf3, 0xda, 0x9f, 0x35, 0xe2, 0x43, 0xa8, 0xf6, 0x3d, 0xc9, 0x6e, 0xe9, 0x49, 0xc8, 0xa7, + 0x41, 0xb3, 0xd0, 0x41, 0xdd, 0xea, 0x61, 0xc3, 0x89, 0x4b, 0x19, 0x45, 0xff, 0x24, 0x0d, 0xc2, + 0x47, 0x50, 0x7e, 0xc3, 0xae, 0xa8, 0x64, 0x0b, 0xda, 0xdc, 0xd1, 0x01, 0xbb, 0xce, 0xba, 0x1f, + 0x4e, 0xec, 0x1b, 0x14, 0x54, 0xd6, 0x24, 0xc1, 0xe2, 0x23, 0x80, 0x37, 0xc2, 0xbb, 0x99, 0xb8, + 0xfe, 0x8c, 0xca, 0x66, 0x51, 0x47, 0xee, 0x65, 0x22, 0x13, 0x2f, 0x49, 0x21, 0xf1, 0x31, 0xd4, + 0x94, 0x66, 0xba, 0x13, 0x34, 0x4b, 0x9d, 0x7c, 0xb7, 0x7a, 0xf8, 0x3c, 0x1d, 0x69, 0x7c, 0x24, + 0x03, 0xb4, 0x7f, 0x43, 0xe9, 0x13, 0xf1, 0x08, 0xea, 0xdf, 0x30, 0x79, 0x3d, 0xf5, 0xdd, 0x3b, + 0x93, 0x03, 0xd2, 0x39, 0xb4, 0xd2, 0x4c, 0x59, 0xc4, 0xeb, 0x1c, 0x79, 0x12, 0x83, 0xbf, 0x85, + 0x17, 0x43, 0xc1, 0xa5, 0xcb, 0x38, 0xf5, 0x87, 0x3e, 0x75, 0x25, 0x35, 0x64, 0x96, 0x26, 0xfb, + 0x38, 0x4d, 0xb6, 0x11, 0xf8, 0x3a, 0x47, 0x36, 0x33, 0x0c, 0xca, 0x50, 0x8c, 0x24, 0xbb, 0x0f, + 0xe5, 0x81, 0x3b, 0x77, 0xb9, 0x47, 0x03, 0xfc, 0x19, 0x94, 0x93, 0xd2, 0xd1, 0xd6, 0xd2, 0xe3, + 0x6e, 0x27, 0xc5, 0x7f, 0x0f, 0x3b, 0x67, 0xee, 0xc3, 0xf8, 0xad, 0x5a, 0x91, 0xc1, 0x5c, 0x78, + 0x37, 0x66, 0x9b, 0x0a, 0x24, 0x56, 0xf1, 0xe7, 0x50, 0x9b, 0xf8, 0x2e, 0x0f, 0x5c, 0x4f, 0x32, + 0xc1, 0xd5, 0x06, 0x29, 0xf6, 0x7a, 0x9a, 0x7d, 0x72, 0x6f, 0x88, 0x33, 0x48, 0xfb, 0x47, 0xb4, + 0xde, 0x01, 0x7c, 0x0c, 0x85, 0x90, 0xb3, 0xa8, 0x9b, 0xf5, 0xc3, 0x0f, 0x37, 0xed, 0x82, 0x73, + 0xc1, 0x99, 0x1c, 0x94, 0x57, 0x8f, 0xfb, 0x05, 0x25, 0x11, 0x1d, 0x80, 0x77, 0x61, 0xe7, 0x9d, + 0x3b, 0x0f, 0xa9, 0x6e, 0x5d, 0x9e, 0x44, 0x8a, 0xfd, 0x0a, 0x34, 0x06, 0x3f, 0x83, 0xca, 0x05, + 0x9f, 0xb3, 0x05, 0x93, 0x74, 0xda, 0xc8, 0xe1, 0x3a, 0xc0, 0x29, 0x15, 0x27, 0xe7, 0x5f, 0x2e, + 0x85, 0x77, 0xdd, 0x40, 0xb8, 0x06, 0xe5, 0x53, 0x2a, 0x74, 0x29, 0x0d, 0xcb, 0x7e, 0x44, 0x60, + 0x4d, 0xee, 0xf1, 0xa7, 0x50, 0x50, 0xd7, 0xd4, 0xa4, 0xf2, 0x3c, 0x5b, 0x89, 0x33, 0x79, 0x58, + 0xd2, 0x28, 0x09, 0x25, 0x11, 0x0d, 0xc5, 0x18, 0x0a, 0x27, 0xbe, 0x58, 0x98, 0xeb, 0xa3, 0x65, + 0x5c, 0x07, 0x6b, 0x22, 0xcc, 0x85, 0xb1, 0x26, 0x02, 0x77, 0xa1, 0xd8, 0x5f, 0x28, 0xa2, 0xad, + 0x17, 0xc4, 0xf8, 0x71, 0x1b, 0xe0, 0x2c, 0xbc, 0x9c, 0x33, 0xef, 0x6b, 0xfa, 0x10, 0xe8, 0xdb, + 0x51, 0x23, 0x29, 0x8b, 0x7d, 0x0c, 0xfa, 0x6c, 0x5c, 0x85, 0xd2, 0x05, 0xbf, 0xe1, 0xe2, 0x8e, + 0x37, 0x72, 0xaa, 0x94, 0x78, 0xc9, 0x1a, 0x08, 0x57, 0xcc, 0xe0, 0x1a, 0x96, 0x12, 0xc7, 0x9c, + 0x53, 0xbf, 0x91, 0xb7, 0x7f, 0xce, 0x03, 0x9c, 0x53, 0x29, 0xe7, 0x74, 0x41, 0xb9, 0x6e, 0x9d, + 0x6e, 0x84, 0x19, 0x69, 0xa4, 0xe0, 0x2f, 0x36, 0x0e, 0x34, 0x33, 0x91, 0x35, 0x87, 0x33, 0xb9, + 0xcf, 0x4e, 0xb5, 0x35, 0x82, 0x32, 0xa1, 0x1e, 0x65, 0xb7, 0xd4, 0x37, 0x2d, 0x40, 0x1b, 0x5a, + 0x60, 0xfd, 0x77, 0x0b, 0x5a, 0xa7, 0x50, 0x49, 0xd6, 0x1b, 0x7f, 0x04, 0xf9, 0x61, 0xf2, 0x8c, + 0x55, 0xcd, 0x33, 0xa6, 0x4c, 0x44, 0xfd, 0x60, 0x1b, 0x76, 0xce, 0xbf, 0x1a, 0x8f, 0xa2, 0x4c, + 0x6b, 0x83, 0x9a, 0x01, 0x14, 0x94, 0x91, 0x44, 0xae, 0xd6, 0x2f, 0xd1, 0x68, 0xe3, 0x39, 0xa1, + 0xd4, 0x9c, 0x46, 0xa9, 0xa3, 0x4c, 0x5e, 0x9d, 0x2d, 0xc5, 0x26, 0x38, 0xb3, 0xcf, 0xa9, 0x1c, + 0x87, 0x50, 0x89, 0xcb, 0x56, 0xaf, 0xa4, 0x6a, 0xd9, 0xfe, 0x16, 0x96, 0x18, 0x17, 0x93, 0x24, + 0x71, 0xf6, 0xd1, 0x96, 0x67, 0xe1, 0x7f, 0x3a, 0x60, 0x77, 0x9f, 0x3e, 0x4a, 0x78, 0x0f, 0x8a, + 0xc3, 0x6b, 0xfa, 0x43, 0x48, 0x4d, 0xa9, 0x46, 0x1b, 0xbc, 0x7b, 0xbf, 0x6a, 0xa3, 0xdf, 0x57, + 0x6d, 0xf4, 0xe7, 0xaa, 0x8d, 0xfe, 0x5e, 0xb5, 0xd1, 0x4f, 0xff, 0xb4, 0x73, 0xdf, 0xbd, 0x4c, + 0x7d, 0x66, 0x78, 0xb0, 0xf4, 0xbc, 0x83, 0x29, 0xbd, 0xed, 0x71, 0x2a, 0xae, 0x82, 0x03, 0x77, + 0xc9, 0x7a, 0xeb, 0x3a, 0x7e, 0xb5, 0x76, 0xf5, 0x05, 0x72, 0xfa, 0x67, 0xe3, 0xf8, 0xd5, 0x60, + 0x7c, 0x76, 0x59, 0xd4, 0x1f, 0xa0, 0x57, 0xff, 0x06, 0x00, 0x00, 0xff, 0xff, 0xcc, 0x8e, 0x24, + 0x5b, 0xec, 0x06, 0x00, 0x00, } func (m *Account) Marshal() (dAtA []byte, err error) { diff --git a/accounting/types.proto b/accounting/types.proto index 1af83c1..1c0cd57 100644 --- a/accounting/types.proto +++ b/accounting/types.proto @@ -1,6 +1,7 @@ syntax = "proto3"; package accounting; option go_package = "github.com/nspcc-dev/neofs-api/accounting"; +option csharp_namespace = "NeoFS.API.Accounting"; import "decimal/decimal.proto"; import "github.com/gogo/protobuf/gogoproto/gogo.proto"; diff --git a/accounting/withdraw.pb.go b/accounting/withdraw.pb.go index 0e299e7..d8a8eeb 100644 --- a/accounting/withdraw.pb.go +++ b/accounting/withdraw.pb.go @@ -461,45 +461,46 @@ func init() { func init() { proto.RegisterFile("accounting/withdraw.proto", fileDescriptor_b3a38a4dc2575267) } var fileDescriptor_b3a38a4dc2575267 = []byte{ - // 602 bytes of a gzipped FileDescriptorProto + // 617 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x55, 0xc1, 0x6e, 0xd3, 0x4c, - 0x10, 0xee, 0xda, 0x69, 0xda, 0x7f, 0xd2, 0x1f, 0xca, 0x0a, 0x8a, 0xeb, 0x43, 0x1a, 0xf9, 0x80, - 0x52, 0x89, 0xd8, 0x52, 0x91, 0x22, 0x10, 0x87, 0x8a, 0x60, 0xa9, 0xb5, 0x44, 0x45, 0xe4, 0x03, - 0x48, 0xdc, 0x1c, 0x67, 0xe2, 0x58, 0x4a, 0xec, 0x60, 0xaf, 0x13, 0xf5, 0x21, 0xb8, 0xf3, 0x0c, - 0x5c, 0xb8, 0xf2, 0x08, 0x3d, 0xf6, 0x08, 0x1c, 0x22, 0x14, 0xde, 0x81, 0x33, 0xf2, 0x7a, 0x5d, - 0x3b, 0x4d, 0x25, 0x2a, 0x04, 0xaa, 0x38, 0x65, 0x77, 0xbe, 0x99, 0xdd, 0x99, 0xef, 0xfb, 0x36, - 0x86, 0x5d, 0xc7, 0x75, 0xc3, 0x24, 0x60, 0x7e, 0xe0, 0x19, 0x33, 0x9f, 0x0d, 0xfb, 0x91, 0x33, - 0xd3, 0x27, 0x51, 0xc8, 0x42, 0x0a, 0x05, 0xa4, 0xd2, 0x18, 0xa3, 0xa9, 0xef, 0xa2, 0x31, 0x46, - 0xe6, 0x64, 0xb8, 0x7a, 0x37, 0x8f, 0x4d, 0x31, 0xf2, 0x07, 0xa7, 0x22, 0x7a, 0xaf, 0x8f, 0xae, - 0x3f, 0x76, 0x46, 0x86, 0xf8, 0x15, 0xe1, 0x96, 0xe7, 0xb3, 0x61, 0xd2, 0xd3, 0xdd, 0x70, 0x6c, - 0x78, 0xa1, 0x17, 0x1a, 0x3c, 0xdc, 0x4b, 0x06, 0x7c, 0xc7, 0x37, 0x7c, 0x95, 0xa5, 0x6b, 0x1f, - 0x09, 0x54, 0x2c, 0x86, 0x63, 0xda, 0x00, 0xc9, 0x32, 0x15, 0xd2, 0x20, 0xcd, 0xad, 0xce, 0xf6, - 0xd9, 0x7c, 0x6f, 0xed, 0xeb, 0x7c, 0x6f, 0xf3, 0xf9, 0x10, 0xdf, 0x26, 0x68, 0x99, 0xb6, 0x64, - 0x99, 0x74, 0x1f, 0x36, 0x5e, 0xce, 0x02, 0x8c, 0x2c, 0x53, 0x91, 0x78, 0xda, 0x6d, 0x91, 0x96, - 0x87, 0xed, 0x7c, 0x41, 0x9b, 0x50, 0x7d, 0x36, 0x4e, 0x47, 0x52, 0xe4, 0x06, 0x69, 0xd6, 0x0e, - 0xb6, 0xf5, 0xbc, 0x49, 0x33, 0xfb, 0xb5, 0x05, 0x4e, 0x77, 0xa0, 0x7a, 0x8c, 0xbe, 0x37, 0x64, - 0x4a, 0xa5, 0x41, 0x9a, 0x15, 0x5b, 0xec, 0xa8, 0x02, 0x1b, 0x5d, 0xe7, 0x74, 0x14, 0x3a, 0x7d, - 0x65, 0x3d, 0xbd, 0xcc, 0xce, 0xb7, 0xda, 0x17, 0x02, 0x70, 0x84, 0xcc, 0x4e, 0x3b, 0x8b, 0xd9, - 0x9f, 0xed, 0xfb, 0x31, 0x54, 0x4e, 0x90, 0x39, 0x4a, 0x8f, 0x77, 0xad, 0xea, 0x82, 0x78, 0x5d, - 0x5c, 0x96, 0x62, 0xc7, 0xe8, 0xf4, 0x31, 0xea, 0x6c, 0xa6, 0x67, 0x9c, 0xcf, 0xf7, 0x88, 0xcd, - 0x2b, 0xa8, 0x09, 0xd5, 0x57, 0x5c, 0x1d, 0xc5, 0xe5, 0xb5, 0xda, 0xe5, 0x5a, 0x8e, 0xfa, 0xae, - 0xc3, 0xfc, 0x30, 0x58, 0x39, 0x43, 0xd4, 0x6a, 0x4f, 0xa1, 0xc6, 0x47, 0x8b, 0x27, 0x61, 0x10, - 0x23, 0x7d, 0x08, 0x9b, 0xaf, 0x85, 0x55, 0xf8, 0x84, 0x29, 0x91, 0x85, 0x57, 0xf4, 0x54, 0x37, - 0xfb, 0x22, 0x43, 0xfb, 0x20, 0x01, 0x74, 0x93, 0x0b, 0x62, 0x4a, 0x63, 0x93, 0x6b, 0xcb, 0x25, - 0x5d, 0x5b, 0x2e, 0x79, 0x49, 0x2e, 0x03, 0xfe, 0x3b, 0xc1, 0x38, 0x76, 0x3c, 0xb4, 0x4c, 0xae, - 0xe4, 0x56, 0xe7, 0x8e, 0xb8, 0xae, 0x00, 0xec, 0x62, 0x79, 0xe3, 0x4c, 0x1b, 0x50, 0xe3, 0x5c, - 0x09, 0xa6, 0x7f, 0xe9, 0x22, 0xed, 0x13, 0x81, 0xda, 0x0b, 0x3f, 0xfe, 0x1d, 0x7a, 0x6f, 0x7a, - 0xd6, 0x36, 0x6c, 0x65, 0x9d, 0x8b, 0x61, 0x1f, 0xc0, 0x7a, 0x6a, 0x9d, 0x58, 0x21, 0x0d, 0xf9, - 0x4a, 0x4f, 0x65, 0xb0, 0xf6, 0x4e, 0x82, 0xff, 0x4d, 0x1c, 0x21, 0xc3, 0xbf, 0xf2, 0xd8, 0x96, - 0x3c, 0x23, 0xff, 0x03, 0x9e, 0xd9, 0x86, 0x5b, 0x39, 0x1d, 0x19, 0x93, 0x07, 0x3f, 0x48, 0xf1, - 0x42, 0x69, 0x1b, 0xe4, 0x23, 0x64, 0x74, 0xa7, 0x4c, 0x67, 0xf1, 0x47, 0xa5, 0xde, 0x5f, 0x89, - 0x0b, 0x39, 0xda, 0x20, 0x77, 0x93, 0x4b, 0x75, 0xc5, 0x3b, 0x5e, 0xae, 0x2b, 0x7b, 0xf6, 0x09, - 0x54, 0x52, 0x59, 0xe9, 0x52, 0x42, 0xc9, 0xa2, 0xaa, 0xb2, 0x0a, 0x88, 0xd2, 0x43, 0xa8, 0x66, - 0x93, 0xd0, 0xdd, 0x72, 0xce, 0x92, 0xd8, 0xaa, 0x7a, 0x15, 0x94, 0x1d, 0xd0, 0x39, 0x3c, 0x5b, - 0xd4, 0xc9, 0xf9, 0xa2, 0x4e, 0x3e, 0x2f, 0xea, 0xe4, 0xdb, 0xa2, 0x4e, 0xde, 0x7f, 0xaf, 0xaf, - 0xbd, 0xd9, 0x2f, 0x7d, 0x7b, 0x82, 0x78, 0xe2, 0xba, 0xad, 0x3e, 0x4e, 0x8d, 0x00, 0xc3, 0x41, - 0xdc, 0x72, 0x26, 0xbe, 0x51, 0x9c, 0xd7, 0xab, 0xf2, 0xcf, 0xcf, 0xa3, 0x9f, 0x01, 0x00, 0x00, - 0xff, 0xff, 0xe2, 0xb5, 0x2a, 0x26, 0x17, 0x07, 0x00, 0x00, + 0x10, 0xee, 0xda, 0x69, 0xda, 0x7f, 0xd2, 0x1f, 0xca, 0xaa, 0x14, 0xd7, 0x87, 0x34, 0xf2, 0x01, + 0xa5, 0x12, 0xb5, 0xa5, 0x22, 0x55, 0x20, 0x0e, 0xa8, 0xc1, 0xa2, 0xb5, 0x44, 0x21, 0x32, 0x52, + 0x91, 0xb8, 0x39, 0xce, 0xd4, 0xb1, 0xd4, 0xd8, 0xc1, 0x5e, 0x27, 0xea, 0x43, 0x70, 0xe7, 0x19, + 0x7a, 0xe1, 0xca, 0x23, 0xf4, 0xd8, 0x23, 0x70, 0x88, 0x50, 0x78, 0x07, 0xce, 0xc8, 0xeb, 0x75, + 0xec, 0x34, 0x95, 0xa8, 0x10, 0xa8, 0xe2, 0x94, 0xdd, 0xf9, 0x66, 0x76, 0x67, 0xbe, 0xef, 0xdb, + 0x18, 0x36, 0x1c, 0xd7, 0x0d, 0x93, 0x80, 0xf9, 0x81, 0x67, 0x8c, 0x7c, 0xd6, 0xeb, 0x46, 0xce, + 0x48, 0x1f, 0x44, 0x21, 0x0b, 0x29, 0x14, 0x90, 0x4a, 0x63, 0x8c, 0x86, 0xbe, 0x8b, 0x46, 0x1f, + 0x99, 0x93, 0xe1, 0xea, 0x5a, 0x1e, 0x1b, 0x62, 0xe4, 0x1f, 0x9f, 0x8a, 0xe8, 0xdd, 0x2e, 0xba, + 0x7e, 0xdf, 0x39, 0x31, 0xc4, 0xaf, 0x08, 0x6f, 0x7b, 0x3e, 0xeb, 0x25, 0x1d, 0xdd, 0x0d, 0xfb, + 0x86, 0x17, 0x7a, 0xa1, 0xc1, 0xc3, 0x9d, 0xe4, 0x98, 0xef, 0xf8, 0x86, 0xaf, 0xb2, 0x74, 0xed, + 0x23, 0x81, 0x8a, 0xc5, 0xb0, 0x4f, 0x1b, 0x20, 0x59, 0xa6, 0x42, 0x1a, 0xa4, 0xb9, 0xd2, 0x5a, + 0x3d, 0x1f, 0x6f, 0x2e, 0x7c, 0x1d, 0x6f, 0x2e, 0x3f, 0xeb, 0xe1, 0xbb, 0x04, 0x2d, 0xd3, 0x96, + 0x2c, 0x93, 0x6e, 0xc1, 0xd2, 0xab, 0x51, 0x80, 0x91, 0x65, 0x2a, 0x12, 0x4f, 0xbb, 0x2d, 0xd2, + 0xf2, 0xb0, 0x9d, 0x2f, 0x68, 0x13, 0xaa, 0x7b, 0xfd, 0x74, 0x24, 0x45, 0x6e, 0x90, 0x66, 0x6d, + 0x67, 0x55, 0xcf, 0x9b, 0x34, 0xb3, 0x5f, 0x5b, 0xe0, 0x74, 0x1d, 0xaa, 0x07, 0xe8, 0x7b, 0x3d, + 0xa6, 0x54, 0x1a, 0xa4, 0x59, 0xb1, 0xc5, 0x8e, 0x2a, 0xb0, 0xd4, 0x76, 0x4e, 0x4f, 0x42, 0xa7, + 0xab, 0x2c, 0xa6, 0x97, 0xd9, 0xf9, 0x56, 0xfb, 0x42, 0x00, 0xf6, 0x91, 0xd9, 0x69, 0x67, 0x31, + 0xfb, 0xb3, 0x7d, 0x3f, 0x82, 0xca, 0x21, 0x32, 0x47, 0xe9, 0xf0, 0xae, 0x55, 0x5d, 0x10, 0xaf, + 0x8b, 0xcb, 0x52, 0xec, 0x00, 0x9d, 0x2e, 0x46, 0xad, 0xe5, 0xf4, 0x8c, 0x8b, 0xf1, 0x26, 0xb1, + 0x79, 0x05, 0x35, 0xa1, 0x7a, 0xc4, 0xd5, 0x51, 0x5c, 0x5e, 0xab, 0x5d, 0xae, 0xe5, 0xa8, 0xef, + 0x3a, 0xcc, 0x0f, 0x83, 0xb9, 0x33, 0x44, 0xad, 0xf6, 0x04, 0x6a, 0x7c, 0xb4, 0x78, 0x10, 0x06, + 0x31, 0xd2, 0x07, 0xb0, 0xfc, 0x46, 0x58, 0x85, 0x4f, 0x98, 0x12, 0x59, 0x78, 0x45, 0x4f, 0x75, + 0xb3, 0xa7, 0x19, 0xda, 0x99, 0x04, 0xd0, 0x4e, 0xa6, 0xc4, 0x94, 0xc6, 0x26, 0xd7, 0x96, 0x4b, + 0xba, 0xb6, 0x5c, 0xf2, 0x8c, 0x5c, 0x06, 0xfc, 0x77, 0x88, 0x71, 0xec, 0x78, 0x68, 0x99, 0x5c, + 0xc9, 0x95, 0xd6, 0x1d, 0x71, 0x5d, 0x01, 0xd8, 0xc5, 0xf2, 0xc6, 0x99, 0x36, 0xa0, 0xc6, 0xb9, + 0x12, 0x4c, 0xff, 0xd2, 0x45, 0xda, 0x27, 0x02, 0xb5, 0x17, 0x7e, 0xfc, 0x3b, 0xf4, 0xde, 0xf4, + 0xac, 0xbb, 0xb0, 0x92, 0x75, 0x2e, 0x86, 0xbd, 0x0f, 0x8b, 0xa9, 0x75, 0x62, 0x85, 0x34, 0xe4, + 0x2b, 0x3d, 0x95, 0xc1, 0xda, 0x7b, 0x09, 0xfe, 0x37, 0xf1, 0x04, 0x19, 0xfe, 0x95, 0xc7, 0x36, + 0xe3, 0x19, 0xf9, 0x1f, 0xf0, 0xcc, 0x2a, 0xdc, 0xca, 0xe9, 0xc8, 0x98, 0xdc, 0xf9, 0x41, 0x8a, + 0x17, 0x4a, 0x77, 0x41, 0xde, 0x47, 0x46, 0xd7, 0xcb, 0x74, 0x16, 0x7f, 0x54, 0xea, 0xbd, 0xb9, + 0xb8, 0x90, 0x63, 0x17, 0xe4, 0x76, 0x72, 0xa9, 0xae, 0x78, 0xc7, 0xb3, 0x75, 0x65, 0xcf, 0x3e, + 0x86, 0x4a, 0x2a, 0x2b, 0x9d, 0x49, 0x28, 0x59, 0x54, 0x55, 0xe6, 0x01, 0x51, 0xfa, 0x14, 0xaa, + 0xd9, 0x24, 0x74, 0xa3, 0x9c, 0x33, 0x23, 0xb6, 0xaa, 0x5e, 0x05, 0x65, 0x07, 0xb4, 0x8e, 0xce, + 0x27, 0x75, 0x72, 0x31, 0xa9, 0x93, 0xcf, 0x93, 0x3a, 0xf9, 0x36, 0xa9, 0x93, 0x0f, 0xdf, 0xeb, + 0x0b, 0x6f, 0xb7, 0x4a, 0xdf, 0x9e, 0x20, 0x1e, 0xb8, 0xee, 0x76, 0x17, 0x87, 0x46, 0x80, 0xe1, + 0x71, 0xbc, 0xed, 0x0c, 0x7c, 0xa3, 0x38, 0xef, 0x4c, 0x5a, 0x7b, 0x89, 0xe1, 0xf3, 0xd7, 0xfa, + 0x5e, 0xdb, 0xd2, 0xf7, 0xa6, 0xe1, 0x4e, 0x95, 0x7f, 0x95, 0x1e, 0xfe, 0x0c, 0x00, 0x00, 0xff, + 0xff, 0x72, 0x77, 0x2d, 0x52, 0x2e, 0x07, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/accounting/withdraw.proto b/accounting/withdraw.proto index 85000b9..ee23b5d 100644 --- a/accounting/withdraw.proto +++ b/accounting/withdraw.proto @@ -1,6 +1,7 @@ syntax = "proto3"; package accounting; option go_package = "github.com/nspcc-dev/neofs-api/accounting"; +option csharp_namespace = "NeoFS.API.Accounting"; import "service/meta.proto"; import "service/verify.proto"; diff --git a/bootstrap/service.pb.go b/bootstrap/service.pb.go index 163ff9b..fadb464 100644 --- a/bootstrap/service.pb.go +++ b/bootstrap/service.pb.go @@ -85,29 +85,30 @@ func init() { func init() { proto.RegisterFile("bootstrap/service.proto", fileDescriptor_21bce759c9d8eb63) } var fileDescriptor_21bce759c9d8eb63 = []byte{ - // 342 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x50, 0xbb, 0x4e, 0xf3, 0x30, - 0x14, 0xae, 0x7f, 0xe5, 0xef, 0xc5, 0x6c, 0xa6, 0x88, 0x28, 0x43, 0x52, 0x75, 0xea, 0x40, 0x12, - 0xa9, 0x5d, 0x98, 0x10, 0x8a, 0x18, 0x60, 0x28, 0x42, 0x01, 0x31, 0xb0, 0x39, 0xc9, 0x49, 0xf1, - 0xd0, 0xd8, 0xd8, 0x6e, 0xa5, 0xbe, 0x09, 0x8f, 0xd4, 0xb1, 0x23, 0x62, 0x88, 0x50, 0x90, 0x78, - 0x0e, 0x14, 0x37, 0x2d, 0x15, 0x4c, 0xf6, 0xf9, 0x6e, 0x3e, 0xfe, 0xf0, 0x69, 0xc2, 0xb9, 0x56, - 0x5a, 0x52, 0x11, 0x2a, 0x90, 0x4b, 0x96, 0x42, 0x20, 0x24, 0xd7, 0x9c, 0xf4, 0xf6, 0x84, 0x43, - 0x1a, 0x26, 0x9c, 0x83, 0xa6, 0x5b, 0xda, 0xe9, 0xef, 0xb0, 0x25, 0x48, 0x96, 0xaf, 0x1a, 0xf4, - 0xe4, 0x27, 0x4d, 0xaf, 0x04, 0xa8, 0x06, 0xf6, 0x67, 0x4c, 0x3f, 0x2f, 0x92, 0x20, 0xe5, 0xf3, - 0x70, 0xc6, 0x67, 0x3c, 0x34, 0x70, 0xb2, 0xc8, 0xcd, 0x64, 0x06, 0x73, 0xdb, 0xca, 0x87, 0x5f, - 0x08, 0x77, 0x62, 0x78, 0x59, 0x80, 0xd2, 0xe4, 0x0c, 0x5b, 0x75, 0x92, 0x8d, 0x06, 0x68, 0xf4, - 0x3f, 0xb2, 0xd7, 0xa5, 0xd7, 0x7a, 0x2f, 0xbd, 0xee, 0x2d, 0xcf, 0xe0, 0x61, 0x25, 0xa0, 0x2a, - 0x3d, 0xab, 0x3e, 0x63, 0xa3, 0x22, 0x3e, 0xb6, 0x58, 0x91, 0x73, 0xfb, 0xdf, 0x00, 0x8d, 0x8e, - 0xc6, 0xc7, 0xc1, 0x7e, 0x9d, 0xa0, 0x36, 0xdc, 0x14, 0x39, 0x8f, 0xac, 0x3a, 0x22, 0x36, 0x32, - 0x72, 0x8e, 0xad, 0x29, 0x68, 0x6a, 0x27, 0x46, 0xee, 0x04, 0xbb, 0x06, 0x9a, 0xc7, 0x6b, 0xee, - 0x1a, 0x68, 0x06, 0x32, 0xea, 0xd6, 0xae, 0x4d, 0xe9, 0xa1, 0xd8, 0x38, 0xc8, 0x15, 0x6e, 0x3f, - 0x9a, 0x8f, 0xdb, 0xa9, 0xf1, 0x0e, 0x7f, 0x7b, 0x0d, 0xcb, 0x52, 0xaa, 0x19, 0x2f, 0xfe, 0x64, - 0x34, 0xde, 0xf1, 0x25, 0xee, 0x45, 0xbb, 0x0d, 0xc9, 0x04, 0x77, 0xee, 0x24, 0x4f, 0x41, 0x29, - 0x42, 0x0e, 0x16, 0x6f, 0xf2, 0x9c, 0xfe, 0x01, 0x76, 0x2f, 0x24, 0xd0, 0x6c, 0x4a, 0x45, 0x74, - 0xb1, 0xae, 0x5c, 0xb4, 0xa9, 0x5c, 0xf4, 0x56, 0xb9, 0xe8, 0xa3, 0x72, 0xd1, 0xeb, 0xa7, 0xdb, - 0x7a, 0x1a, 0x1d, 0xf4, 0x5d, 0x28, 0x91, 0xa6, 0x7e, 0x06, 0xcb, 0xb0, 0x00, 0x9e, 0x2b, 0x9f, - 0x0a, 0x16, 0xee, 0x93, 0x92, 0xb6, 0x69, 0x7c, 0xf2, 0x1d, 0x00, 0x00, 0xff, 0xff, 0xe6, 0xa2, - 0x5a, 0xfd, 0x07, 0x02, 0x00, 0x00, + // 360 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x51, 0xbf, 0x6e, 0xe2, 0x30, + 0x18, 0xc7, 0x28, 0xc7, 0x1f, 0xdf, 0x66, 0x38, 0x5d, 0x94, 0x21, 0x41, 0x4c, 0x0c, 0x97, 0x44, + 0x82, 0xe5, 0xc6, 0xbb, 0xa8, 0xaa, 0xca, 0x00, 0x42, 0x01, 0x75, 0xe8, 0xe6, 0x24, 0x5f, 0x68, + 0x06, 0x62, 0x37, 0x36, 0x48, 0xbc, 0x49, 0x9f, 0xa1, 0x4f, 0xc2, 0xc8, 0x58, 0x75, 0x88, 0xaa, + 0x54, 0xea, 0x73, 0x54, 0x31, 0x21, 0x45, 0xed, 0x94, 0x7c, 0xbf, 0x7f, 0xfe, 0xf9, 0x33, 0xfe, + 0x1d, 0x30, 0x26, 0x85, 0xcc, 0x28, 0x77, 0x05, 0x64, 0xbb, 0x24, 0x04, 0x87, 0x67, 0x4c, 0x32, + 0xd2, 0xad, 0x09, 0x83, 0x54, 0x8c, 0xbb, 0x01, 0x49, 0x4f, 0xb4, 0xd1, 0x3f, 0x63, 0x3b, 0xc8, + 0x92, 0x78, 0x5f, 0xa1, 0xbf, 0x3e, 0xd3, 0xe4, 0x9e, 0x83, 0xa8, 0x60, 0x7b, 0x9d, 0xc8, 0xfb, + 0x6d, 0xe0, 0x84, 0x6c, 0xe3, 0xae, 0xd9, 0x9a, 0xb9, 0x0a, 0x0e, 0xb6, 0xb1, 0x9a, 0xd4, 0xa0, + 0xfe, 0x4e, 0xf2, 0xe1, 0x3b, 0xc2, 0x6d, 0x1f, 0x1e, 0xb6, 0x20, 0x24, 0xf9, 0x83, 0xb5, 0x32, + 0x49, 0x47, 0x03, 0x34, 0xfa, 0xe1, 0xe9, 0x87, 0xdc, 0x6a, 0xbc, 0xe4, 0x56, 0x67, 0xce, 0x22, + 0x58, 0xed, 0x39, 0x14, 0xb9, 0xa5, 0x95, 0x5f, 0x5f, 0xa9, 0x88, 0x8d, 0xb5, 0x24, 0x8d, 0x99, + 0xde, 0x1c, 0xa0, 0xd1, 0xcf, 0x71, 0xcf, 0xa9, 0xeb, 0x38, 0xa5, 0x61, 0x9a, 0xc6, 0xcc, 0xd3, + 0xca, 0x08, 0x5f, 0xc9, 0xc8, 0x5f, 0xac, 0xcd, 0x40, 0x52, 0x3d, 0x50, 0x72, 0xc3, 0x39, 0x6f, + 0xa0, 0x3a, 0xbc, 0xe4, 0x6e, 0x80, 0x46, 0x90, 0x79, 0x9d, 0xd2, 0x75, 0xcc, 0x2d, 0xe4, 0x2b, + 0x07, 0xb9, 0xc2, 0xad, 0x5b, 0x75, 0x71, 0x3d, 0x54, 0xde, 0xe1, 0x57, 0xaf, 0x62, 0x93, 0x90, + 0xca, 0x84, 0xa5, 0xdf, 0x32, 0x2a, 0xef, 0xf8, 0x1f, 0xee, 0x7a, 0xe7, 0x86, 0x64, 0x82, 0xdb, + 0x8b, 0x8c, 0x85, 0x20, 0x04, 0x21, 0x17, 0xc5, 0xab, 0x3c, 0xa3, 0x7f, 0x81, 0x2d, 0x79, 0x06, + 0x34, 0x9a, 0x51, 0xee, 0xad, 0x0e, 0x85, 0x89, 0x8e, 0x85, 0x89, 0x9e, 0x0b, 0x13, 0xbd, 0x16, + 0x26, 0x7a, 0x7c, 0x33, 0x1b, 0x77, 0xa3, 0x8b, 0x7d, 0xa7, 0x82, 0x87, 0xa1, 0x1d, 0xc1, 0xce, + 0x4d, 0x81, 0xc5, 0xc2, 0xa6, 0x3c, 0x71, 0xeb, 0xa4, 0xa7, 0x66, 0x6f, 0x0e, 0xec, 0x7a, 0xe9, + 0xfc, 0x5f, 0x4c, 0x9d, 0xba, 0x4a, 0xd0, 0x52, 0xef, 0x30, 0xf9, 0x08, 0x00, 0x00, 0xff, 0xff, + 0x7c, 0x15, 0x25, 0x92, 0x1d, 0x02, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/bootstrap/service.proto b/bootstrap/service.proto index fa0248c..db43bf6 100644 --- a/bootstrap/service.proto +++ b/bootstrap/service.proto @@ -1,6 +1,7 @@ syntax = "proto3"; package bootstrap; option go_package = "github.com/nspcc-dev/neofs-api/bootstrap"; +option csharp_namespace = "NeoFS.API.Bootstrap"; import "service/meta.proto"; import "service/verify.proto"; diff --git a/bootstrap/types.pb.go b/bootstrap/types.pb.go index 83af13d..db83671 100644 --- a/bootstrap/types.pb.go +++ b/bootstrap/types.pb.go @@ -146,29 +146,30 @@ func init() { func init() { proto.RegisterFile("bootstrap/types.proto", fileDescriptor_423083266369adee) } var fileDescriptor_423083266369adee = []byte{ - // 348 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x4c, 0x90, 0xcd, 0x4a, 0xfb, 0x40, - 0x14, 0xc5, 0x33, 0x6d, 0xff, 0xe9, 0x3f, 0x53, 0x17, 0x1a, 0x5b, 0x08, 0x22, 0x49, 0x28, 0x08, - 0x59, 0xb4, 0x09, 0x7e, 0xbc, 0x80, 0x01, 0x05, 0x91, 0x56, 0x49, 0x5d, 0xb9, 0xcb, 0xc7, 0xb4, - 0x0d, 0xd2, 0xdc, 0x21, 0x33, 0x11, 0xb2, 0xf3, 0x31, 0x7c, 0x22, 0xe9, 0xd2, 0x65, 0x71, 0x11, - 0x34, 0xee, 0xf2, 0x14, 0xd2, 0x49, 0x5b, 0xba, 0xbb, 0xe7, 0x9c, 0xdf, 0xcc, 0xdc, 0x39, 0xb8, - 0x17, 0x00, 0x70, 0xc6, 0x53, 0x9f, 0x3a, 0x3c, 0xa7, 0x84, 0xd9, 0x34, 0x05, 0x0e, 0xaa, 0xb2, - 0xb3, 0x4f, 0x86, 0xb3, 0x98, 0xcf, 0xb3, 0xc0, 0x0e, 0x61, 0xe1, 0xcc, 0x60, 0x06, 0x8e, 0x20, - 0x82, 0x6c, 0x2a, 0x94, 0x10, 0x62, 0xaa, 0x4f, 0xf6, 0x9f, 0xb0, 0x32, 0xa1, 0x29, 0xf1, 0xa3, - 0x91, 0x4f, 0xd5, 0x2e, 0xfe, 0x77, 0x43, 0x21, 0x9c, 0x6b, 0xc8, 0x44, 0x56, 0xcb, 0xab, 0x85, - 0x7a, 0x8e, 0xe5, 0x31, 0xe1, 0x23, 0x9f, 0x6a, 0x0d, 0xb3, 0x69, 0x75, 0x2e, 0x8e, 0xed, 0xdd, - 0x6b, 0xf6, 0x18, 0x22, 0x72, 0x97, 0x4c, 0xc1, 0x6d, 0x2d, 0x0b, 0x43, 0xf2, 0x36, 0x60, 0xff, - 0x03, 0xe1, 0xff, 0xdb, 0x48, 0x3d, 0xc3, 0xed, 0xeb, 0x28, 0x4a, 0x09, 0x63, 0xe2, 0x5e, 0xc5, - 0xed, 0x54, 0x85, 0xd1, 0xf6, 0x6b, 0xcb, 0xdb, 0x66, 0xea, 0x00, 0xcb, 0x8f, 0x59, 0x70, 0x4f, - 0x72, 0xad, 0x61, 0x22, 0xeb, 0xc0, 0xed, 0x56, 0x85, 0x71, 0x48, 0xb3, 0xe0, 0x85, 0xe4, 0x03, - 0x58, 0xc4, 0x9c, 0x2c, 0x28, 0xcf, 0xbd, 0x0d, 0xa3, 0x3a, 0xb8, 0xfd, 0x40, 0x79, 0x0c, 0x09, - 0xd3, 0x9a, 0x66, 0xd3, 0x52, 0xdc, 0x5e, 0x55, 0x18, 0x47, 0x50, 0x5b, 0x7b, 0xfc, 0x96, 0x52, - 0xaf, 0xb0, 0x3c, 0xe1, 0x3e, 0xcf, 0x98, 0xd6, 0x5a, 0x7f, 0xce, 0x3d, 0x5d, 0x2f, 0xfc, 0x55, - 0x18, 0x78, 0xbd, 0x67, 0x9d, 0x54, 0x85, 0x21, 0x33, 0x31, 0x79, 0x1b, 0xd6, 0xbd, 0x5d, 0xfd, - 0xe8, 0xd2, 0x5b, 0xa9, 0x4b, 0xcb, 0x52, 0x47, 0x9f, 0xa5, 0x8e, 0x56, 0xa5, 0x8e, 0xbe, 0x4b, - 0x1d, 0xbd, 0xff, 0xea, 0xd2, 0xb3, 0xb5, 0xd7, 0x75, 0xc2, 0x68, 0x18, 0x0e, 0x23, 0xf2, 0xea, - 0x24, 0x04, 0xa6, 0x6c, 0xe8, 0xd3, 0xd8, 0xd9, 0xf5, 0x14, 0xc8, 0xa2, 0xed, 0xcb, 0xbf, 0x00, - 0x00, 0x00, 0xff, 0xff, 0xc2, 0x29, 0x27, 0x0e, 0xc0, 0x01, 0x00, 0x00, + // 367 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x4c, 0x91, 0x4f, 0x6b, 0xe2, 0x40, + 0x18, 0xc6, 0x33, 0xea, 0xc6, 0xcd, 0xb8, 0x87, 0xdd, 0xa8, 0x10, 0x96, 0x25, 0x09, 0xc2, 0x42, + 0x0e, 0x9a, 0xb0, 0xdb, 0x7e, 0x01, 0x03, 0x2d, 0x48, 0xd1, 0x4a, 0xec, 0xa9, 0xf4, 0x92, 0x3f, + 0xa3, 0x86, 0x62, 0xde, 0x21, 0x33, 0x29, 0xe4, 0xd6, 0x8f, 0xd1, 0xcf, 0xd0, 0x0f, 0x52, 0x3c, + 0xf6, 0x28, 0x3d, 0x84, 0x36, 0xbd, 0xe5, 0x53, 0x14, 0x13, 0x23, 0xde, 0xde, 0xe7, 0x79, 0x7e, + 0x33, 0xf3, 0xce, 0xfb, 0xe2, 0xbe, 0x07, 0xc0, 0x19, 0x8f, 0x5d, 0x6a, 0xf1, 0x94, 0x12, 0x66, + 0xd2, 0x18, 0x38, 0xc8, 0xd2, 0xd1, 0xfe, 0x3d, 0x5a, 0x85, 0x7c, 0x9d, 0x78, 0xa6, 0x0f, 0x1b, + 0x6b, 0x05, 0x2b, 0xb0, 0x4a, 0xc2, 0x4b, 0x96, 0xa5, 0x2a, 0x45, 0x59, 0x55, 0x27, 0x07, 0x37, + 0x58, 0x5a, 0xd0, 0x98, 0xb8, 0xc1, 0xd4, 0xa5, 0x72, 0x0f, 0x7f, 0xbb, 0xa0, 0xe0, 0xaf, 0x15, + 0xa4, 0x23, 0xa3, 0xe5, 0x54, 0x42, 0xfe, 0x87, 0xc5, 0x19, 0xe1, 0x53, 0x97, 0x2a, 0x0d, 0xbd, + 0x69, 0x74, 0xfe, 0x77, 0xcd, 0xe3, 0x6b, 0xe6, 0x0c, 0x02, 0x32, 0x89, 0x96, 0x60, 0xb7, 0xb6, + 0x99, 0x26, 0x38, 0x07, 0x70, 0xf0, 0x82, 0xf0, 0xf7, 0x3a, 0x92, 0xff, 0xe2, 0xf6, 0x38, 0x08, + 0x62, 0xc2, 0x58, 0x79, 0xaf, 0x64, 0x77, 0x8a, 0x4c, 0x6b, 0xbb, 0x95, 0xe5, 0xd4, 0x99, 0x3c, + 0xc4, 0xe2, 0x3c, 0xf1, 0xae, 0x48, 0xaa, 0x34, 0x74, 0x64, 0xfc, 0xb0, 0x7b, 0x45, 0xa6, 0xfd, + 0xa4, 0x89, 0x77, 0x4f, 0xd2, 0x21, 0x6c, 0x42, 0x4e, 0x36, 0x94, 0xa7, 0xce, 0x81, 0x91, 0x2d, + 0xdc, 0xbe, 0xa6, 0x3c, 0x84, 0x88, 0x29, 0x4d, 0xbd, 0x69, 0x48, 0x76, 0xbf, 0xc8, 0xb4, 0x5f, + 0x50, 0x59, 0x27, 0x7c, 0x4d, 0xc9, 0xe7, 0x58, 0x5c, 0x70, 0x97, 0x27, 0x4c, 0x69, 0xed, 0x3f, + 0x67, 0xff, 0xd9, 0x37, 0xfc, 0x96, 0x69, 0x78, 0xdf, 0x67, 0x95, 0x14, 0x99, 0x26, 0xb2, 0xb2, + 0x72, 0x0e, 0xac, 0x7d, 0xb7, 0xfb, 0x50, 0x85, 0xc7, 0x5c, 0x15, 0xb6, 0xb9, 0x8a, 0x5e, 0x73, + 0x15, 0xed, 0x72, 0x15, 0xbd, 0xe7, 0x2a, 0x7a, 0xfa, 0x54, 0x85, 0x5b, 0xe3, 0x64, 0xd6, 0x11, + 0xa3, 0xbe, 0x3f, 0x0a, 0xc8, 0x83, 0x15, 0x11, 0x58, 0xb2, 0x91, 0x4b, 0x43, 0xeb, 0x38, 0xa7, + 0xe7, 0x46, 0x77, 0x46, 0xe0, 0x72, 0x61, 0x8e, 0xe7, 0x13, 0xd3, 0xae, 0x5d, 0x4f, 0x2c, 0x77, + 0x70, 0xf6, 0x15, 0x00, 0x00, 0xff, 0xff, 0xe4, 0xbf, 0x86, 0xf3, 0xd6, 0x01, 0x00, 0x00, } func (m *SpreadMap) Marshal() (dAtA []byte, err error) { diff --git a/bootstrap/types.proto b/bootstrap/types.proto index 02da9ad..cbce379 100644 --- a/bootstrap/types.proto +++ b/bootstrap/types.proto @@ -1,10 +1,11 @@ syntax = "proto3"; package bootstrap; option go_package = "github.com/nspcc-dev/neofs-api/bootstrap"; +option csharp_namespace = "NeoFS.API.Bootstrap"; import "github.com/gogo/protobuf/gogoproto/gogo.proto"; -option (gogoproto.stable_marshaler_all) = true;; +option (gogoproto.stable_marshaler_all) = true; option (gogoproto.stringer_all) = false; option (gogoproto.goproto_stringer_all) = false; diff --git a/container/service.pb.go b/container/service.pb.go index e202a7c..b887121 100644 --- a/container/service.pb.go +++ b/container/service.pb.go @@ -391,44 +391,45 @@ func init() { func init() { proto.RegisterFile("container/service.proto", fileDescriptor_e1fa9d7ab2e7ae06) } var fileDescriptor_e1fa9d7ab2e7ae06 = []byte{ - // 582 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x54, 0xcb, 0x6e, 0xd3, 0x40, - 0x14, 0xed, 0x34, 0xe9, 0x23, 0xd7, 0xe5, 0x35, 0x6a, 0x5a, 0x63, 0x89, 0x24, 0xf2, 0x2a, 0x20, - 0x62, 0x8b, 0x50, 0x09, 0x36, 0x20, 0x35, 0x89, 0x14, 0x2a, 0x51, 0x11, 0x19, 0x89, 0x05, 0x3b, - 0x67, 0x7a, 0x13, 0x2c, 0x25, 0xb6, 0xf1, 0x8c, 0x83, 0xf2, 0x27, 0xfc, 0x03, 0x12, 0x6b, 0x3e, - 0xa1, 0xcb, 0x2e, 0x11, 0x8b, 0x08, 0x85, 0x25, 0xe2, 0x1f, 0x90, 0xc7, 0xcf, 0xa4, 0x05, 0x96, - 0x15, 0x1b, 0x6b, 0xe6, 0x9c, 0x7b, 0xee, 0xdb, 0x03, 0x87, 0xcc, 0x73, 0x85, 0xed, 0xb8, 0x18, - 0x98, 0x1c, 0x83, 0x99, 0xc3, 0xd0, 0xf0, 0x03, 0x4f, 0x78, 0xb4, 0x92, 0x11, 0x1a, 0x4d, 0x18, - 0x73, 0x8a, 0xc2, 0x8e, 0x69, 0x6d, 0x3f, 0xc5, 0x66, 0x18, 0x38, 0xa3, 0x79, 0x82, 0x56, 0x73, - 0x6f, 0x62, 0xee, 0x23, 0x4f, 0xe0, 0x07, 0x63, 0x47, 0xbc, 0x0b, 0x87, 0x06, 0xf3, 0xa6, 0xa6, - 0xcb, 0x7d, 0xc6, 0x5a, 0x67, 0x38, 0x33, 0x5d, 0x14, 0x53, 0xdb, 0x37, 0x39, 0x4e, 0x90, 0x09, - 0x2f, 0x48, 0x6c, 0x5b, 0x05, 0xdb, 0xb1, 0x37, 0xf6, 0x4c, 0x09, 0x0f, 0xc3, 0x91, 0xbc, 0xc9, - 0x8b, 0x3c, 0xc5, 0xe6, 0xfa, 0xcf, 0x4d, 0x80, 0x41, 0x28, 0x2c, 0x7c, 0x1f, 0x22, 0x17, 0xd4, - 0x84, 0xca, 0x29, 0x72, 0x6e, 0x8f, 0xf1, 0xa4, 0xa7, 0x92, 0x06, 0x69, 0xee, 0x75, 0xee, 0x9c, - 0x2f, 0xea, 0x1b, 0xdf, 0x16, 0xf5, 0x9c, 0xb0, 0xf2, 0x23, 0xd5, 0x60, 0xb7, 0x6b, 0xfb, 0x36, - 0x73, 0xc4, 0x5c, 0xdd, 0x6c, 0x90, 0x66, 0xd9, 0xca, 0xee, 0xf4, 0x3e, 0xec, 0xbc, 0xfa, 0xe0, - 0x62, 0x70, 0xd2, 0x53, 0x4b, 0xd2, 0xd5, 0xad, 0xc4, 0x55, 0x0a, 0x5b, 0xe9, 0x81, 0x3e, 0x82, - 0xad, 0x20, 0x9c, 0x20, 0x57, 0xcb, 0x0d, 0xd2, 0x54, 0xda, 0x55, 0x23, 0x2e, 0xce, 0x18, 0x4c, - 0x6c, 0x86, 0x53, 0x74, 0x85, 0x15, 0x4e, 0xb0, 0x53, 0x8e, 0xf4, 0x56, 0x6c, 0x49, 0xdb, 0xb0, - 0xd5, 0x0f, 0xbc, 0xd0, 0x57, 0xb7, 0xa4, 0xe4, 0xc0, 0xc8, 0x7a, 0x67, 0x1c, 0x33, 0x86, 0x9c, - 0x4b, 0x36, 0xd5, 0xc8, 0x0b, 0x7d, 0x0a, 0xe5, 0x53, 0x14, 0xb6, 0x3a, 0x94, 0x12, 0xcd, 0x48, - 0x47, 0x96, 0x94, 0x1f, 0x71, 0x2f, 0xd0, 0x3e, 0xc3, 0xa0, 0xb3, 0x1b, 0xc9, 0x2e, 0x16, 0x75, - 0x62, 0x49, 0x05, 0xed, 0xc1, 0xf6, 0x1b, 0x39, 0x29, 0x95, 0x49, 0xad, 0xbe, 0xae, 0x95, 0xac, - 0xc3, 0x6c, 0xe1, 0x78, 0xee, 0x25, 0x1f, 0x89, 0x56, 0x7f, 0x08, 0x8a, 0x6c, 0x36, 0xf7, 0x3d, - 0x97, 0x23, 0xbd, 0x07, 0xa5, 0x6e, 0xd6, 0x67, 0x25, 0x69, 0x4e, 0x04, 0x59, 0xd1, 0x47, 0xff, - 0x4c, 0xe0, 0x46, 0x0f, 0x27, 0x28, 0x30, 0x1d, 0xcf, 0xdf, 0x05, 0xd7, 0x5e, 0xde, 0x6d, 0xb8, - 0x99, 0xe6, 0x1b, 0x57, 0xa8, 0x7f, 0x22, 0x00, 0x7d, 0x14, 0xff, 0x49, 0xfe, 0xc7, 0xa0, 0xc8, - 0x64, 0x93, 0xf1, 0xb4, 0xa1, 0xd2, 0x4d, 0x77, 0x4a, 0xe6, 0xac, 0xb4, 0xf7, 0x0b, 0x5b, 0x96, - 0x71, 0x56, 0x6e, 0xa6, 0x7f, 0x21, 0xa0, 0xbc, 0x74, 0x78, 0x56, 0x71, 0xe1, 0x1f, 0x20, 0xff, - 0xf8, 0x07, 0xae, 0xbb, 0xfa, 0x16, 0xec, 0xc5, 0x99, 0xaf, 0x6f, 0x67, 0xe9, 0xaa, 0x61, 0xb5, - 0x7f, 0x11, 0xd8, 0x79, 0x1d, 0x87, 0xa1, 0x47, 0x50, 0x1a, 0x84, 0x82, 0x56, 0x0b, 0xdd, 0xc9, - 0x1f, 0x15, 0xed, 0x60, 0x1d, 0x4e, 0x02, 0x3c, 0x83, 0xed, 0x78, 0x5d, 0xa8, 0x5a, 0xb0, 0x58, - 0xd9, 0x78, 0xed, 0xee, 0x15, 0x4c, 0x22, 0x3f, 0x82, 0x52, 0x1f, 0x57, 0x83, 0xe6, 0xab, 0xb6, - 0x12, 0xb4, 0x38, 0xd4, 0x27, 0x50, 0x8e, 0xaa, 0xa4, 0x45, 0xbe, 0x30, 0x30, 0xed, 0xf0, 0x12, - 0x1e, 0x0b, 0x3b, 0xcf, 0xcf, 0x97, 0x35, 0x72, 0xb1, 0xac, 0x91, 0xaf, 0xcb, 0x1a, 0xf9, 0xbe, - 0xac, 0x91, 0x8f, 0x3f, 0x6a, 0x1b, 0x6f, 0x9b, 0x7f, 0x78, 0x9a, 0xbd, 0x11, 0x6f, 0xd9, 0xbe, - 0x63, 0x66, 0xce, 0x86, 0xdb, 0xf2, 0xc1, 0x7d, 0xfc, 0x3b, 0x00, 0x00, 0xff, 0xff, 0x31, 0xf8, - 0x12, 0xa0, 0x32, 0x06, 0x00, 0x00, + // 598 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x54, 0xcb, 0x6e, 0xd3, 0x4c, + 0x14, 0xee, 0x34, 0xe9, 0xed, 0xb8, 0xff, 0x0f, 0x0c, 0xbd, 0x18, 0x4b, 0xa4, 0x95, 0x57, 0x01, + 0x11, 0x5b, 0x84, 0x4a, 0xb0, 0x61, 0xd1, 0x34, 0xa2, 0x54, 0xa2, 0x10, 0xb9, 0x88, 0x05, 0x3b, + 0x67, 0x7a, 0x12, 0x2c, 0x25, 0x1e, 0xe3, 0x19, 0x07, 0xe5, 0x4d, 0x78, 0x06, 0x90, 0x58, 0xf3, + 0x08, 0x5d, 0x76, 0x89, 0x58, 0x44, 0x28, 0x2c, 0x11, 0xef, 0x80, 0x3c, 0xbe, 0x26, 0x2d, 0xb0, + 0xac, 0xd8, 0x58, 0x33, 0xdf, 0x77, 0xbe, 0x73, 0xf7, 0xc0, 0x36, 0xe3, 0xbe, 0x74, 0x3d, 0x1f, + 0x43, 0x5b, 0x60, 0x38, 0xf2, 0x18, 0x5a, 0x41, 0xc8, 0x25, 0xa7, 0x6b, 0x39, 0x61, 0xd0, 0x94, + 0xb1, 0x87, 0x28, 0xdd, 0x84, 0x36, 0x36, 0x32, 0x6c, 0x84, 0xa1, 0xd7, 0x1b, 0xa7, 0xe8, 0x66, + 0xe1, 0x4d, 0x8e, 0x03, 0x14, 0x29, 0x7c, 0xb7, 0xef, 0xc9, 0x37, 0x51, 0xd7, 0x62, 0x7c, 0x68, + 0xfb, 0x22, 0x60, 0xac, 0x71, 0x8a, 0x23, 0xdb, 0x47, 0x39, 0x74, 0x03, 0x5b, 0xe0, 0x00, 0x99, + 0xe4, 0x61, 0x6a, 0xdb, 0x28, 0xd9, 0xf6, 0x79, 0x9f, 0xdb, 0x0a, 0xee, 0x46, 0x3d, 0x75, 0x53, + 0x17, 0x75, 0x4a, 0xcc, 0xcd, 0x1f, 0x8b, 0x00, 0x9d, 0x48, 0x3a, 0xf8, 0x36, 0x42, 0x21, 0xa9, + 0x0d, 0x6b, 0xc7, 0x28, 0x84, 0xdb, 0xc7, 0xa3, 0xb6, 0x4e, 0x76, 0x49, 0x7d, 0xbd, 0x75, 0xe3, + 0x6c, 0xb2, 0xb3, 0xf0, 0x75, 0xb2, 0x53, 0x10, 0x4e, 0x71, 0xa4, 0x06, 0xac, 0x1e, 0xb8, 0x81, + 0xcb, 0x3c, 0x39, 0xd6, 0x17, 0x77, 0x49, 0xbd, 0xea, 0xe4, 0x77, 0x7a, 0x07, 0x56, 0x5e, 0xbc, + 0xf3, 0x31, 0x3c, 0x6a, 0xeb, 0x15, 0xe5, 0xea, 0x5a, 0xea, 0x2a, 0x83, 0x9d, 0xec, 0x40, 0xef, + 0xc3, 0x52, 0x18, 0x0d, 0x50, 0xe8, 0xd5, 0x5d, 0x52, 0xd7, 0x9a, 0x9b, 0x56, 0x52, 0x9c, 0xd5, + 0x19, 0xb8, 0x0c, 0x87, 0xe8, 0x4b, 0x27, 0x1a, 0x60, 0xab, 0x1a, 0xeb, 0x9d, 0xc4, 0x92, 0x36, + 0x61, 0xe9, 0x30, 0xe4, 0x51, 0xa0, 0x2f, 0x29, 0xc9, 0x96, 0x95, 0xf7, 0xce, 0xda, 0x67, 0x0c, + 0x85, 0x50, 0x6c, 0xa6, 0x51, 0x17, 0xfa, 0x08, 0xaa, 0xc7, 0x28, 0x5d, 0xbd, 0xab, 0x24, 0x86, + 0x95, 0x8d, 0x2c, 0x2d, 0x3f, 0xe6, 0x9e, 0xa2, 0x7b, 0x8a, 0x61, 0x6b, 0x35, 0x96, 0x9d, 0x4f, + 0x76, 0x88, 0xa3, 0x14, 0xb4, 0x0d, 0xcb, 0xaf, 0xd4, 0xa4, 0x74, 0xa6, 0xb4, 0xe6, 0xbc, 0x56, + 0xb1, 0x1e, 0x73, 0xa5, 0xc7, 0xfd, 0x0b, 0x3e, 0x52, 0xad, 0x79, 0x0f, 0x34, 0xd5, 0x6c, 0x11, + 0x70, 0x5f, 0x20, 0xbd, 0x0d, 0x95, 0x83, 0xbc, 0xcf, 0x5a, 0xda, 0x9c, 0x18, 0x72, 0xe2, 0x8f, + 0xf9, 0x89, 0xc0, 0x7f, 0x6d, 0x1c, 0xa0, 0xc4, 0x6c, 0x3c, 0x7f, 0x16, 0x5c, 0x79, 0x79, 0xd7, + 0xe1, 0xff, 0x2c, 0xdf, 0xa4, 0x42, 0xf3, 0x23, 0x01, 0x38, 0x44, 0xf9, 0x8f, 0xe4, 0xbf, 0x0f, + 0x9a, 0x4a, 0x36, 0x1d, 0x4f, 0x13, 0xd6, 0x0e, 0xb2, 0x9d, 0x52, 0x39, 0x6b, 0xcd, 0x8d, 0xd2, + 0x96, 0xe5, 0x9c, 0x53, 0x98, 0x99, 0x9f, 0x09, 0x68, 0xcf, 0x3c, 0x91, 0x57, 0x5c, 0xfa, 0x07, + 0xc8, 0x5f, 0xfe, 0x81, 0xab, 0xae, 0xbe, 0x01, 0xeb, 0x49, 0xe6, 0xf3, 0xdb, 0x59, 0xb9, 0x6c, + 0x58, 0xcd, 0x9f, 0x04, 0x56, 0x4e, 0x92, 0x30, 0x74, 0x0f, 0x2a, 0x9d, 0x48, 0xd2, 0xcd, 0x52, + 0x77, 0x8a, 0x47, 0xc5, 0xd8, 0x9a, 0x87, 0xd3, 0x00, 0x8f, 0x61, 0x39, 0x59, 0x17, 0xaa, 0x97, + 0x2c, 0x66, 0x36, 0xde, 0xb8, 0x75, 0x09, 0x93, 0xca, 0xf7, 0xa0, 0x72, 0x88, 0xb3, 0x41, 0x8b, + 0x55, 0x9b, 0x09, 0x5a, 0x1e, 0xea, 0x43, 0xa8, 0xc6, 0x55, 0xd2, 0x32, 0x5f, 0x1a, 0x98, 0xb1, + 0x7d, 0x01, 0x4f, 0x84, 0xad, 0x97, 0x67, 0xd3, 0x1a, 0x39, 0x9f, 0xd6, 0xc8, 0x97, 0x69, 0x8d, + 0x7c, 0x9b, 0xd6, 0xc8, 0xfb, 0xef, 0xb5, 0x85, 0xd7, 0xf5, 0xdf, 0x3c, 0xcd, 0xbc, 0x27, 0x1a, + 0x6e, 0xe0, 0xd9, 0xb9, 0xb3, 0x0f, 0x8b, 0x37, 0x9f, 0x23, 0x7f, 0x72, 0x62, 0xed, 0x77, 0x8e, + 0x8a, 0xd5, 0xe9, 0x2e, 0xab, 0x67, 0xf8, 0xc1, 0xaf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x02, 0x54, + 0x99, 0x9f, 0x48, 0x06, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/container/service.proto b/container/service.proto index 4576197..b287a22 100644 --- a/container/service.proto +++ b/container/service.proto @@ -1,6 +1,7 @@ syntax = "proto3"; package container; option go_package = "github.com/nspcc-dev/neofs-api/container"; +option csharp_namespace = "NeoFS.API.Container"; import "service/meta.proto"; import "service/verify.proto"; diff --git a/container/types.pb.go b/container/types.pb.go index fb22b13..cc0f736 100644 --- a/container/types.pb.go +++ b/container/types.pb.go @@ -190,31 +190,32 @@ func init() { func init() { proto.RegisterFile("container/types.proto", fileDescriptor_1432e52ab0b53e3e) } var fileDescriptor_1432e52ab0b53e3e = []byte{ - // 371 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x91, 0x4f, 0x4b, 0xfb, 0x30, - 0x1c, 0xc6, 0x97, 0xad, 0xfb, 0xfd, 0x5c, 0x36, 0x11, 0x03, 0x93, 0x32, 0xa4, 0x2b, 0x3b, 0x55, - 0xa1, 0xad, 0x4e, 0xf0, 0x28, 0xb8, 0x4d, 0x64, 0xa0, 0x28, 0x95, 0x5d, 0xc4, 0x4b, 0x97, 0x65, - 0xb3, 0xd0, 0x35, 0x21, 0x49, 0x95, 0xbd, 0x13, 0x5f, 0xd2, 0x8e, 0x1e, 0xc5, 0xc3, 0x94, 0xfa, - 0x46, 0xa4, 0xe9, 0x56, 0x07, 0xd3, 0x5b, 0x9e, 0x27, 0x9f, 0x27, 0xf9, 0xfe, 0x81, 0x75, 0x4c, - 0x23, 0xe9, 0x07, 0x11, 0xe1, 0xae, 0x9c, 0x31, 0x22, 0x1c, 0xc6, 0xa9, 0xa4, 0xa8, 0x92, 0xdb, - 0x8d, 0xc3, 0x49, 0x20, 0x1f, 0xe3, 0xa1, 0x83, 0xe9, 0xd4, 0x8d, 0x04, 0xc3, 0xd8, 0x1e, 0x91, - 0x27, 0x37, 0x22, 0x72, 0xea, 0x33, 0x57, 0x90, 0x90, 0x60, 0x49, 0x79, 0x16, 0x6b, 0xd8, 0x6b, - 0xec, 0x84, 0x4e, 0xa8, 0xab, 0xec, 0x61, 0x3c, 0x56, 0x4a, 0x09, 0x75, 0xca, 0xf0, 0xd6, 0x07, - 0x80, 0x95, 0xee, 0xea, 0x23, 0x74, 0x00, 0xff, 0xdf, 0x3c, 0x47, 0x84, 0xf7, 0x7b, 0x3a, 0x30, - 0x81, 0x55, 0xeb, 0xec, 0xcc, 0x17, 0xcd, 0xc2, 0xfb, 0xa2, 0xb9, 0xb2, 0xbd, 0xd5, 0x01, 0x99, - 0x50, 0xbb, 0xf3, 0x43, 0xa9, 0x17, 0x15, 0x57, 0x5b, 0x72, 0xda, 0x60, 0xd0, 0xef, 0x79, 0xea, - 0x06, 0x35, 0xe0, 0x56, 0xd7, 0x67, 0x3e, 0x0e, 0xe4, 0x4c, 0x2f, 0x99, 0xc0, 0xd2, 0xbc, 0x5c, - 0xa3, 0x63, 0x58, 0xf6, 0xe2, 0x90, 0x08, 0x5d, 0x33, 0x81, 0x55, 0x6d, 0xd7, 0x9d, 0xac, 0x19, - 0xe7, 0x36, 0xf4, 0x31, 0x99, 0x92, 0x48, 0xa6, 0xb7, 0x1d, 0x2d, 0x7d, 0xd5, 0xcb, 0x48, 0x74, - 0x0a, 0xb5, 0xab, 0x40, 0x48, 0xbd, 0xac, 0x12, 0xfb, 0x4e, 0x3e, 0x1e, 0xe7, 0x1c, 0x63, 0x22, - 0x44, 0xda, 0x05, 0xa7, 0x61, 0xca, 0x2c, 0x83, 0x8a, 0x6f, 0x3d, 0xc0, 0x6a, 0x06, 0x5c, 0x72, - 0x1a, 0x33, 0x64, 0x40, 0x98, 0xc9, 0x6b, 0x3a, 0x22, 0xaa, 0xcb, 0x6d, 0x6f, 0xcd, 0x41, 0x36, - 0xac, 0x0c, 0x04, 0xe1, 0x0a, 0xd6, 0x8b, 0x66, 0xe9, 0xb7, 0x21, 0xfc, 0x10, 0xad, 0x0b, 0xb8, - 0xbb, 0xf1, 0x3d, 0x3a, 0x5a, 0x96, 0x0a, 0xcc, 0x92, 0x55, 0x6d, 0xef, 0x6d, 0x94, 0xaa, 0xa2, - 0xeb, 0x45, 0x76, 0xce, 0xe6, 0x89, 0x01, 0x5e, 0x13, 0x03, 0xbc, 0x25, 0x06, 0xf8, 0x4c, 0x0c, - 0xf0, 0xf2, 0x65, 0x14, 0xee, 0xad, 0x3f, 0xf6, 0x4e, 0xc7, 0xc2, 0xf6, 0x59, 0xe0, 0xe6, 0xef, - 0x0e, 0xff, 0xa9, 0x6d, 0x9e, 0x7c, 0x07, 0x00, 0x00, 0xff, 0xff, 0xb8, 0xe6, 0x51, 0x5d, 0x4c, - 0x02, 0x00, 0x00, + // 389 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x91, 0x4d, 0x4f, 0xe2, 0x40, + 0x1c, 0xc6, 0x19, 0x28, 0xbb, 0xcb, 0xc0, 0x66, 0xb3, 0xb3, 0x61, 0xd3, 0x10, 0x53, 0x1a, 0x4e, + 0xd5, 0xa4, 0x53, 0xc5, 0xc4, 0x3b, 0x2f, 0x6a, 0x48, 0x7c, 0x21, 0x45, 0x2e, 0xc6, 0x4b, 0x19, + 0x06, 0x6c, 0x52, 0x3a, 0x4d, 0x67, 0xaa, 0xe1, 0x9b, 0xf8, 0x19, 0xfc, 0x24, 0x1c, 0x3d, 0x1a, + 0x0f, 0x68, 0xea, 0x17, 0x31, 0x9d, 0x42, 0x25, 0x41, 0x6f, 0xf3, 0x3c, 0xf3, 0x7b, 0x66, 0xfe, + 0x2f, 0xb0, 0x4a, 0x98, 0x2f, 0x1c, 0xd7, 0xa7, 0xa1, 0x25, 0xe6, 0x01, 0xe5, 0x38, 0x08, 0x99, + 0x60, 0xa8, 0x94, 0xd9, 0xb5, 0xbd, 0xa9, 0x2b, 0x6e, 0xa3, 0x11, 0x26, 0x6c, 0x66, 0xf9, 0x3c, + 0x20, 0xc4, 0x1c, 0xd3, 0x3b, 0xcb, 0xa7, 0x62, 0xe6, 0x04, 0x16, 0xa7, 0x1e, 0x25, 0x82, 0x85, + 0x69, 0xac, 0x66, 0x6e, 0xb0, 0x53, 0x36, 0x65, 0x96, 0xb4, 0x47, 0xd1, 0x44, 0x2a, 0x29, 0xe4, + 0x29, 0xc5, 0x1b, 0xaf, 0x00, 0x96, 0x3a, 0xeb, 0x8f, 0xd0, 0x2e, 0xfc, 0x79, 0x79, 0xef, 0xd3, + 0xb0, 0xd7, 0x55, 0x81, 0x0e, 0x8c, 0x4a, 0xfb, 0xcf, 0x62, 0x59, 0xcf, 0xbd, 0x2c, 0xeb, 0x6b, + 0xdb, 0x5e, 0x1f, 0x90, 0x0e, 0x95, 0x81, 0xe3, 0x09, 0x35, 0x2f, 0xb9, 0xca, 0x8a, 0x53, 0x86, + 0xc3, 0x5e, 0xd7, 0x96, 0x37, 0xa8, 0x06, 0x7f, 0x75, 0x9c, 0xc0, 0x21, 0xae, 0x98, 0xab, 0x05, + 0x1d, 0x18, 0x8a, 0x9d, 0x69, 0x74, 0x00, 0x8b, 0x76, 0xe4, 0x51, 0xae, 0x2a, 0x3a, 0x30, 0xca, + 0xcd, 0x2a, 0x4e, 0x9b, 0xc1, 0x7d, 0xcf, 0x21, 0x74, 0x46, 0x7d, 0x91, 0xdc, 0xb6, 0x95, 0xe4, + 0x55, 0x3b, 0x25, 0xd1, 0x11, 0x54, 0xce, 0x5c, 0x2e, 0xd4, 0xa2, 0x4c, 0xec, 0xe0, 0x6c, 0x3c, + 0xb8, 0x45, 0x08, 0xe5, 0x3c, 0xe9, 0x22, 0x64, 0x5e, 0xc2, 0xac, 0x82, 0x92, 0x6f, 0xdc, 0xc0, + 0x72, 0x0a, 0x9c, 0x86, 0x2c, 0x0a, 0x90, 0x06, 0x61, 0x2a, 0xcf, 0xd9, 0x98, 0xca, 0x2e, 0x7f, + 0xdb, 0x1b, 0x0e, 0x32, 0x61, 0x69, 0xc8, 0x69, 0x28, 0x61, 0x35, 0xaf, 0x17, 0xbe, 0x1a, 0xc2, + 0x27, 0xd1, 0x38, 0x86, 0x7f, 0xb7, 0xbe, 0x47, 0xfb, 0xab, 0x52, 0x81, 0x5e, 0x30, 0xca, 0xcd, + 0xff, 0x5b, 0xa5, 0xca, 0xe8, 0x66, 0x91, 0xed, 0xab, 0x45, 0xac, 0x81, 0xa7, 0x58, 0x03, 0xcf, + 0xb1, 0x06, 0xde, 0x62, 0x0d, 0x3c, 0xbc, 0x6b, 0xb9, 0x6b, 0xe3, 0x9b, 0xbd, 0xb3, 0x09, 0x37, + 0x9d, 0xc0, 0xb5, 0xb2, 0x77, 0x1f, 0xf3, 0xff, 0x2e, 0x28, 0x3b, 0x19, 0xe0, 0x56, 0xbf, 0x87, + 0xb3, 0x75, 0x8e, 0x7e, 0xc8, 0x1d, 0x1f, 0x7e, 0x04, 0x00, 0x00, 0xff, 0xff, 0xd4, 0x4d, 0x91, + 0xa9, 0x62, 0x02, 0x00, 0x00, } func (m *Container) Marshal() (dAtA []byte, err error) { diff --git a/container/types.proto b/container/types.proto index e53587e..775d84c 100644 --- a/container/types.proto +++ b/container/types.proto @@ -1,6 +1,7 @@ syntax = "proto3"; package container; option go_package = "github.com/nspcc-dev/neofs-api/container"; +option csharp_namespace = "NeoFS.API.Container"; import "github.com/nspcc-dev/netmap/selector.proto"; import "github.com/gogo/protobuf/gogoproto/gogo.proto"; diff --git a/decimal/decimal.pb.go b/decimal/decimal.pb.go index c0726a4..60c0153 100644 --- a/decimal/decimal.pb.go +++ b/decimal/decimal.pb.go @@ -83,7 +83,7 @@ func init() { func init() { proto.RegisterFile("decimal/decimal.proto", fileDescriptor_e7e70e1773836c80) } var fileDescriptor_e7e70e1773836c80 = []byte{ - // 183 bytes of a gzipped FileDescriptorProto + // 198 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x4d, 0x49, 0x4d, 0xce, 0xcc, 0x4d, 0xcc, 0xd1, 0x87, 0xd2, 0x7a, 0x05, 0x45, 0xf9, 0x25, 0xf9, 0x42, 0xec, 0x50, 0xae, 0x94, 0x6e, 0x7a, 0x66, 0x49, 0x46, 0x69, 0x92, 0x5e, 0x72, 0x7e, 0xae, 0x7e, 0x7a, 0x7e, 0x7a, @@ -91,11 +91,12 @@ var fileDescriptor_e7e70e1773836c80 = []byte{ 0x2e, 0x76, 0x17, 0x88, 0x4e, 0x21, 0x11, 0x2e, 0xd6, 0xb0, 0xc4, 0x9c, 0xd2, 0x54, 0x09, 0x46, 0x05, 0x46, 0x0d, 0xe6, 0x20, 0x08, 0x47, 0x48, 0x86, 0x8b, 0x33, 0xa0, 0x28, 0x35, 0x39, 0xb3, 0x38, 0x33, 0x3f, 0x4f, 0x82, 0x49, 0x81, 0x51, 0x83, 0x37, 0x08, 0x21, 0x60, 0xc5, 0x32, 0x63, - 0x81, 0x3c, 0x83, 0x93, 0xcd, 0x89, 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, 0x31, 0xde, 0x78, 0x24, + 0x81, 0x3c, 0x83, 0x53, 0xc0, 0x89, 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, 0x31, 0xde, 0x78, 0x24, 0xc7, 0xf8, 0xe0, 0x91, 0x1c, 0xe3, 0x8c, 0xc7, 0x72, 0x0c, 0x51, 0x6a, 0x48, 0x2e, 0xc9, 0x2b, 0x2e, 0x48, 0x4e, 0xd6, 0x4d, 0x49, 0x2d, 0xd3, 0xcf, 0x4b, 0xcd, 0x4f, 0x2b, 0xd6, 0x4d, 0x2c, - 0xc8, 0x84, 0x79, 0x20, 0x89, 0x0d, 0xec, 0x12, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0x8d, - 0xc1, 0x18, 0x3c, 0xda, 0x00, 0x00, 0x00, + 0xc8, 0x84, 0x79, 0x60, 0x15, 0x93, 0xa0, 0x5f, 0x6a, 0xbe, 0x5b, 0xb0, 0x9e, 0x63, 0x80, 0xa7, + 0x1e, 0xd4, 0x2d, 0x49, 0x6c, 0x60, 0xd7, 0x19, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0x76, 0xde, + 0x39, 0xfb, 0xee, 0x00, 0x00, 0x00, } func (m *Decimal) Marshal() (dAtA []byte, err error) { diff --git a/decimal/decimal.proto b/decimal/decimal.proto index e0e16d5..d21ce1b 100644 --- a/decimal/decimal.proto +++ b/decimal/decimal.proto @@ -1,6 +1,7 @@ syntax = "proto3"; package decimal; option go_package = "github.com/nspcc-dev/neofs-api/decimal"; +option csharp_namespace = "NeoFS.API.Decimal"; import "github.com/gogo/protobuf/gogoproto/gogo.proto"; diff --git a/object/service.pb.go b/object/service.pb.go index 10fbe51..1ecf6d9 100644 --- a/object/service.pb.go +++ b/object/service.pb.go @@ -883,61 +883,62 @@ func init() { func init() { proto.RegisterFile("object/service.proto", fileDescriptor_dfcdf610ade6a9ce) } var fileDescriptor_dfcdf610ade6a9ce = []byte{ - // 858 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x56, 0xcd, 0x6e, 0xeb, 0x44, - 0x14, 0xce, 0xc4, 0x89, 0x9b, 0x7b, 0xe2, 0xf4, 0x46, 0xd3, 0x70, 0x89, 0xcc, 0x55, 0x5a, 0x59, - 0x05, 0x05, 0xa1, 0x38, 0xa5, 0x48, 0xa5, 0x88, 0x4a, 0x88, 0x24, 0x6a, 0xd3, 0x05, 0x6a, 0x99, - 0x56, 0x95, 0x60, 0xe7, 0x38, 0x93, 0xc4, 0x34, 0xb5, 0x83, 0x7f, 0x5a, 0xf5, 0x01, 0x58, 0xb3, - 0x65, 0xc9, 0x83, 0xf0, 0x00, 0xdd, 0x20, 0x75, 0x89, 0x58, 0x54, 0x28, 0x2c, 0x79, 0x01, 0x24, - 0x36, 0x68, 0x7e, 0x1c, 0xdb, 0x2d, 0x2d, 0xd0, 0x4d, 0xee, 0x2a, 0x33, 0xdf, 0xf9, 0xce, 0x99, - 0x9c, 0xcf, 0xdf, 0x19, 0x1b, 0x6a, 0xde, 0xe0, 0x1b, 0x6a, 0x87, 0xed, 0x80, 0xfa, 0x97, 0x8e, - 0x4d, 0xcd, 0x99, 0xef, 0x85, 0x1e, 0x56, 0x05, 0xaa, 0x57, 0x7d, 0x3a, 0x0a, 0xda, 0xe1, 0xf5, - 0x8c, 0x06, 0x22, 0xa2, 0x63, 0xc9, 0x4f, 0x63, 0x6b, 0x01, 0x0d, 0x02, 0xc7, 0x73, 0xb3, 0x44, - 0x59, 0xb1, 0x7d, 0x41, 0x43, 0x4b, 0x62, 0xb5, 0x18, 0xbb, 0xa4, 0xbe, 0x33, 0xba, 0x96, 0x68, - 0x6b, 0xec, 0x84, 0x93, 0x68, 0x60, 0xda, 0xde, 0x45, 0x7b, 0xec, 0x8d, 0xbd, 0x36, 0x87, 0x07, - 0xd1, 0x88, 0xef, 0xf8, 0x86, 0xaf, 0x04, 0xdd, 0xf8, 0x19, 0x01, 0x1c, 0xd0, 0x90, 0xd0, 0x6f, - 0x23, 0x1a, 0x84, 0xb8, 0x05, 0x2b, 0x9f, 0x0f, 0x87, 0x3e, 0x0d, 0x82, 0x3a, 0xda, 0x40, 0xcd, - 0xf2, 0x76, 0xc5, 0x64, 0x7f, 0xda, 0x94, 0x60, 0xa7, 0x70, 0x73, 0xb7, 0x9e, 0x23, 0x31, 0x07, - 0x57, 0x41, 0x21, 0xd6, 0x55, 0x3d, 0xbf, 0x81, 0x9a, 0x25, 0xc2, 0x96, 0x78, 0x17, 0x0a, 0x5f, - 0xd0, 0xd0, 0xaa, 0x0f, 0x78, 0xb6, 0x6e, 0xc6, 0x4a, 0xc8, 0x03, 0x58, 0xac, 0x4f, 0xad, 0x21, - 0xf5, 0x3b, 0x25, 0x56, 0xea, 0xf6, 0x6e, 0x1d, 0x11, 0x9e, 0x81, 0x7b, 0xa0, 0x9e, 0xf1, 0x46, - 0xea, 0x36, 0xcf, 0x35, 0xee, 0xe7, 0xf2, 0xa8, 0x63, 0x5b, 0xa1, 0xe3, 0xb9, 0x0f, 0x6a, 0xc8, - 0x5c, 0xe3, 0x14, 0xca, 0xbc, 0x9d, 0x60, 0xe6, 0xb9, 0x01, 0xc5, 0x4d, 0x90, 0xe2, 0xcb, 0x76, - 0x56, 0x4d, 0xb1, 0x35, 0x8f, 0xf8, 0x4f, 0x3f, 0x47, 0x64, 0x1c, 0xbf, 0x82, 0x62, 0x77, 0x12, - 0xb9, 0xe7, 0xbc, 0x19, 0xad, 0x9f, 0x23, 0x62, 0xdb, 0x51, 0x00, 0x11, 0xe3, 0xa7, 0x3c, 0xc0, - 0x71, 0xb4, 0x50, 0x69, 0x07, 0x54, 0xf1, 0x07, 0x64, 0xd5, 0xd7, 0x71, 0xd5, 0x84, 0xc3, 0x96, - 0x82, 0xc3, 0xce, 0x10, 0xab, 0xc7, 0xce, 0x58, 0xb6, 0x68, 0xfa, 0x57, 0xf0, 0x62, 0xf1, 0x77, - 0xf1, 0x7b, 0xa0, 0x1e, 0x3d, 0x21, 0x19, 0x91, 0x51, 0xbc, 0x09, 0xc5, 0x53, 0xef, 0x9c, 0xba, - 0xbc, 0x19, 0x46, 0x93, 0xbe, 0x35, 0x39, 0x4a, 0x44, 0x50, 0xc8, 0xb7, 0x07, 0x65, 0xae, 0x8c, - 0x7c, 0x28, 0xff, 0xcf, 0x64, 0xc6, 0xf7, 0x79, 0xa8, 0xf4, 0xe8, 0x94, 0x86, 0xf4, 0x99, 0x2e, - 0x7d, 0x1f, 0x56, 0x8e, 0xae, 0x5c, 0xea, 0x1f, 0xf6, 0x84, 0xf0, 0x9d, 0x97, 0x2c, 0xfe, 0xeb, - 0xdd, 0x7a, 0x0c, 0x93, 0x78, 0x91, 0x34, 0xa5, 0x3c, 0xd1, 0xd4, 0xd2, 0x4d, 0x5e, 0x85, 0xd5, - 0x58, 0x10, 0x21, 0xa9, 0xf1, 0x17, 0x82, 0x32, 0xa3, 0xc7, 0x0a, 0xed, 0xfe, 0x8b, 0x42, 0x0b, - 0x05, 0x24, 0x90, 0x88, 0xb5, 0x01, 0xe5, 0xfd, 0x68, 0x3a, 0x15, 0x67, 0x07, 0x72, 0xb4, 0xd3, - 0x50, 0x3c, 0xf4, 0xca, 0x9b, 0x33, 0xf4, 0x3b, 0xa0, 0x89, 0xe6, 0xa5, 0xc1, 0xfe, 0xa3, 0x85, - 0x8d, 0x3f, 0x11, 0x54, 0x4e, 0xa8, 0xe5, 0xdb, 0x93, 0xc4, 0x59, 0xe5, 0xae, 0xe7, 0x86, 0x96, - 0x23, 0xec, 0x82, 0xb8, 0x5d, 0xca, 0x52, 0x2c, 0xa5, 0x7b, 0xd8, 0x23, 0xe9, 0x38, 0xae, 0x41, - 0xf1, 0xcb, 0x88, 0xfa, 0xd7, 0xc2, 0x57, 0x44, 0x6c, 0xb0, 0x01, 0x1a, 0x5f, 0x9c, 0x51, 0x9f, - 0x79, 0x87, 0x2b, 0x55, 0x21, 0x19, 0x6c, 0xe9, 0x92, 0x75, 0x61, 0x35, 0xee, 0x5c, 0x8a, 0xf6, - 0x21, 0xbc, 0x90, 0x1e, 0xa0, 0xcc, 0x34, 0xca, 0x63, 0x63, 0x95, 0xb0, 0x8c, 0x3f, 0x10, 0xbc, - 0x64, 0xb7, 0xad, 0xe5, 0x8e, 0x9f, 0x3f, 0x9b, 0x45, 0x9e, 0x2e, 0x6f, 0x91, 0x4a, 0xfc, 0xa4, - 0x38, 0x28, 0xc9, 0x82, 0xb1, 0x74, 0xc9, 0x4c, 0xa8, 0x26, 0xcd, 0x4a, 0xd1, 0x74, 0x28, 0xed, - 0xfb, 0xd6, 0xf8, 0x82, 0xba, 0xc2, 0x6b, 0x1a, 0x59, 0xec, 0x8d, 0xef, 0xf2, 0xb0, 0x16, 0x27, - 0xf4, 0xad, 0x60, 0xf2, 0x4c, 0x85, 0x3e, 0x00, 0x95, 0x97, 0x60, 0xb3, 0xa8, 0x3c, 0x26, 0x91, - 0xa4, 0x60, 0x0c, 0x85, 0x13, 0x6b, 0x1a, 0x72, 0xcb, 0x69, 0x84, 0xaf, 0x97, 0xae, 0xdb, 0x1e, - 0xd4, 0xb2, 0x32, 0x48, 0xed, 0x36, 0x41, 0x65, 0x7b, 0xe9, 0x36, 0xad, 0xa3, 0xc9, 0x31, 0x2b, - 0x70, 0x96, 0x8c, 0x6d, 0xff, 0xa8, 0xc0, 0xca, 0x89, 0x38, 0x15, 0x6f, 0x81, 0x72, 0x40, 0x43, - 0x8c, 0x63, 0x05, 0x92, 0x0f, 0x17, 0x7d, 0x2d, 0x83, 0x89, 0x13, 0xb6, 0x10, 0xcb, 0x38, 0x8e, - 0x52, 0x19, 0xc9, 0x0b, 0x3a, 0xc9, 0x48, 0xbd, 0x9a, 0x9a, 0x08, 0x7f, 0x0c, 0xaa, 0xb8, 0x5b, - 0xf1, 0x5b, 0x31, 0x21, 0xf3, 0xf2, 0xd1, 0x5f, 0xdd, 0x87, 0x17, 0xf3, 0x53, 0x60, 0x12, 0xe0, - 0x45, 0xdd, 0xd4, 0x7d, 0xac, 0xd7, 0xb2, 0xa0, 0x4c, 0xf9, 0x04, 0x54, 0x31, 0x84, 0xc9, 0x59, - 0x99, 0xeb, 0x28, 0x39, 0x2b, 0x3b, 0xab, 0x5b, 0x08, 0x7f, 0x06, 0xa5, 0x58, 0x54, 0xfc, 0x76, - 0xba, 0xf7, 0xd4, 0x2c, 0xea, 0xf5, 0x87, 0x81, 0x45, 0x81, 0x43, 0xd0, 0xd2, 0x4f, 0x05, 0xbf, - 0x73, 0x9f, 0x9b, 0xb2, 0xac, 0xfe, 0xfa, 0x9f, 0x83, 0xa2, 0x58, 0xe7, 0xd3, 0x9b, 0x79, 0x03, - 0xdd, 0xce, 0x1b, 0xe8, 0x97, 0x79, 0x03, 0xfd, 0x36, 0x6f, 0xa0, 0x1f, 0x7e, 0x6f, 0xe4, 0xbe, - 0x7e, 0x37, 0xf5, 0x21, 0xea, 0x06, 0x33, 0xdb, 0x6e, 0x0d, 0xe9, 0x65, 0xdb, 0xa5, 0xde, 0x28, - 0x68, 0x59, 0x33, 0xa7, 0x2d, 0x2a, 0x0e, 0x54, 0xfe, 0x1d, 0xfa, 0xd1, 0xdf, 0x01, 0x00, 0x00, - 0xff, 0xff, 0xcd, 0x28, 0x29, 0x7f, 0x3b, 0x0b, 0x00, 0x00, + // 874 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x56, 0xcd, 0x6e, 0xe3, 0x54, + 0x14, 0xce, 0x8d, 0x13, 0x37, 0x73, 0xe2, 0x74, 0xa2, 0xdb, 0x30, 0x44, 0x66, 0x94, 0x56, 0xd6, + 0x80, 0x82, 0x50, 0x9c, 0x32, 0x48, 0xc3, 0x20, 0x8d, 0x84, 0x26, 0x89, 0x3a, 0xc9, 0x82, 0xb6, + 0xdc, 0x54, 0x95, 0x60, 0xe7, 0x38, 0x37, 0x89, 0x69, 0x6a, 0x07, 0xff, 0xb4, 0xea, 0x03, 0xb0, + 0x66, 0xcb, 0x92, 0x35, 0xcf, 0xc0, 0x03, 0x74, 0x83, 0xd4, 0x25, 0x62, 0x51, 0xa1, 0xb0, 0xe4, + 0x05, 0x90, 0xd8, 0xa0, 0xfb, 0xe3, 0xd8, 0x6e, 0x69, 0x81, 0x6e, 0xc2, 0x2a, 0xf7, 0x7e, 0xe7, + 0x3b, 0xe7, 0xe6, 0x7c, 0xfe, 0xce, 0xb5, 0xa1, 0xe6, 0x8d, 0xbe, 0xa2, 0x76, 0xd8, 0x0e, 0xa8, + 0x7f, 0xe6, 0xd8, 0xd4, 0x5c, 0xf8, 0x5e, 0xe8, 0x61, 0x55, 0xa0, 0x7a, 0xd5, 0xa7, 0x93, 0xa0, + 0x1d, 0x5e, 0x2c, 0x68, 0x20, 0x22, 0x3a, 0x96, 0xfc, 0x34, 0xb6, 0x15, 0xd0, 0x20, 0x70, 0x3c, + 0x37, 0x4b, 0x94, 0x15, 0xdb, 0xa7, 0x34, 0xb4, 0x24, 0x56, 0x8b, 0xb1, 0x33, 0xea, 0x3b, 0x93, + 0x0b, 0x89, 0xb6, 0xa6, 0x4e, 0x38, 0x8b, 0x46, 0xa6, 0xed, 0x9d, 0xb6, 0xa7, 0xde, 0xd4, 0x6b, + 0x73, 0x78, 0x14, 0x4d, 0xf8, 0x8e, 0x6f, 0xf8, 0x4a, 0xd0, 0x8d, 0x9f, 0x10, 0xc0, 0x1b, 0x1a, + 0x12, 0xfa, 0x75, 0x44, 0x83, 0x10, 0xb7, 0x60, 0xe3, 0xf5, 0x78, 0xec, 0xd3, 0x20, 0xa8, 0xa3, + 0x1d, 0xd4, 0x2c, 0x3f, 0xaf, 0x98, 0xec, 0x4f, 0x9b, 0x12, 0xec, 0x14, 0x2e, 0xaf, 0xb7, 0x73, + 0x24, 0xe6, 0xe0, 0x2a, 0x28, 0xc4, 0x3a, 0xaf, 0xe7, 0x77, 0x50, 0xb3, 0x44, 0xd8, 0x12, 0xbf, + 0x84, 0xc2, 0x67, 0x34, 0xb4, 0xea, 0x23, 0x9e, 0xad, 0x9b, 0xb1, 0x12, 0xf2, 0x00, 0x16, 0xeb, + 0x53, 0x6b, 0x4c, 0xfd, 0x4e, 0x89, 0x95, 0xba, 0xba, 0xde, 0x46, 0x84, 0x67, 0xe0, 0x1e, 0xa8, + 0xc7, 0xbc, 0x91, 0xba, 0xcd, 0x73, 0x8d, 0x9b, 0xb9, 0x3c, 0xea, 0xd8, 0x56, 0xe8, 0x78, 0xee, + 0xad, 0x1a, 0x32, 0xd7, 0x38, 0x82, 0x32, 0x6f, 0x27, 0x58, 0x78, 0x6e, 0x40, 0x71, 0x13, 0xa4, + 0xf8, 0xb2, 0x9d, 0x4d, 0x53, 0x6c, 0xcd, 0x03, 0xfe, 0xd3, 0xcf, 0x11, 0x19, 0xc7, 0x4f, 0xa0, + 0xd8, 0x9d, 0x45, 0xee, 0x09, 0x6f, 0x46, 0xeb, 0xe7, 0x88, 0xd8, 0x76, 0x14, 0x40, 0xc4, 0xf8, + 0x31, 0x0f, 0x70, 0x18, 0xad, 0x54, 0x7a, 0x01, 0xaa, 0xf8, 0x03, 0xb2, 0xea, 0xd3, 0xb8, 0x6a, + 0xc2, 0x61, 0x4b, 0xc1, 0x61, 0x67, 0x88, 0xd5, 0x5d, 0x67, 0xac, 0x5b, 0x34, 0xfd, 0x0b, 0x78, + 0xb4, 0xfa, 0xbb, 0xf8, 0x3d, 0x50, 0x0f, 0xee, 0x91, 0x8c, 0xc8, 0x28, 0x7e, 0x06, 0xc5, 0x23, + 0xef, 0x84, 0xba, 0xbc, 0x19, 0x46, 0x93, 0xbe, 0x35, 0x39, 0x4a, 0x44, 0x50, 0xc8, 0xf7, 0x0a, + 0xca, 0x5c, 0x19, 0xf9, 0x50, 0xfe, 0x9b, 0xc9, 0x8c, 0x6f, 0xf3, 0x50, 0xe9, 0xd1, 0x39, 0x0d, + 0xe9, 0x03, 0x5d, 0xfa, 0x3e, 0x6c, 0x1c, 0x9c, 0xbb, 0xd4, 0x1f, 0xf4, 0x84, 0xf0, 0x9d, 0xc7, + 0x2c, 0xfe, 0xcb, 0xf5, 0x76, 0x0c, 0x93, 0x78, 0x91, 0x34, 0xa5, 0xdc, 0xd3, 0xd4, 0xda, 0x4d, + 0x5e, 0x85, 0xcd, 0x58, 0x10, 0x21, 0xa9, 0xf1, 0x27, 0x82, 0x32, 0xa3, 0xc7, 0x0a, 0xbd, 0xfc, + 0x07, 0x85, 0x56, 0x0a, 0x48, 0x20, 0x11, 0x6b, 0x07, 0xca, 0x7b, 0xd1, 0x7c, 0x2e, 0xce, 0x0e, + 0xe4, 0x68, 0xa7, 0xa1, 0x78, 0xe8, 0x95, 0xff, 0xcf, 0xd0, 0xbf, 0x00, 0x4d, 0x34, 0x2f, 0x0d, + 0xf6, 0x2f, 0x2d, 0x6c, 0xfc, 0x81, 0xa0, 0x32, 0xa4, 0x96, 0x6f, 0xcf, 0x12, 0x67, 0x95, 0xbb, + 0x9e, 0x1b, 0x5a, 0x8e, 0xb0, 0x0b, 0xe2, 0x76, 0x29, 0x4b, 0xb1, 0x94, 0xee, 0xa0, 0x47, 0xd2, + 0x71, 0x5c, 0x83, 0xe2, 0xe7, 0x11, 0xf5, 0x2f, 0x84, 0xaf, 0x88, 0xd8, 0x60, 0x03, 0x34, 0xbe, + 0x38, 0xa6, 0x3e, 0xf3, 0x0e, 0x57, 0xaa, 0x42, 0x32, 0xd8, 0xda, 0x25, 0xeb, 0xc2, 0x66, 0xdc, + 0xb9, 0x14, 0xed, 0x43, 0x78, 0x24, 0x3d, 0x40, 0x99, 0x69, 0x94, 0xbb, 0xc6, 0x2a, 0x61, 0x19, + 0xbf, 0x23, 0x78, 0xcc, 0x6e, 0x5b, 0xcb, 0x9d, 0x3e, 0x7c, 0x36, 0x8b, 0x3c, 0x5d, 0xde, 0x22, + 0x95, 0xf8, 0x49, 0x71, 0x50, 0x92, 0x05, 0x63, 0xed, 0x92, 0x99, 0x50, 0x4d, 0x9a, 0x95, 0xa2, + 0xe9, 0x50, 0xda, 0xf3, 0xad, 0xe9, 0x29, 0x75, 0x85, 0xd7, 0x34, 0xb2, 0xda, 0x1b, 0xdf, 0xe4, + 0x61, 0x2b, 0x4e, 0xe8, 0x5b, 0xc1, 0xec, 0x81, 0x0a, 0x7d, 0x00, 0x2a, 0x2f, 0xc1, 0x66, 0x51, + 0xb9, 0x4b, 0x22, 0x49, 0xc1, 0x18, 0x0a, 0x43, 0x6b, 0x1e, 0x72, 0xcb, 0x69, 0x84, 0xaf, 0xd7, + 0xae, 0xdb, 0x2b, 0xa8, 0x65, 0x65, 0x90, 0xda, 0x3d, 0x03, 0x95, 0xed, 0xa5, 0xdb, 0xb4, 0x8e, + 0x26, 0xc7, 0xac, 0xc0, 0x59, 0x32, 0xf6, 0xfc, 0x7b, 0x05, 0x36, 0x86, 0xe2, 0x54, 0xbc, 0x0b, + 0xca, 0x1b, 0x1a, 0x62, 0x1c, 0x2b, 0x90, 0x7c, 0xb8, 0xe8, 0x5b, 0x19, 0x4c, 0x9c, 0xb0, 0x8b, + 0x58, 0xc6, 0x61, 0x94, 0xca, 0x48, 0x5e, 0xd0, 0x49, 0x46, 0xea, 0xd5, 0xd4, 0x44, 0xf8, 0x63, + 0x50, 0xc5, 0xdd, 0x8a, 0xdf, 0x8a, 0x09, 0x99, 0x97, 0x8f, 0xfe, 0xe4, 0x26, 0xbc, 0x9a, 0x9f, + 0x02, 0x93, 0x00, 0xaf, 0xea, 0xa6, 0xee, 0x63, 0xbd, 0x96, 0x05, 0x65, 0xca, 0x27, 0xa0, 0x8a, + 0x21, 0x4c, 0xce, 0xca, 0x5c, 0x47, 0xc9, 0x59, 0xd9, 0x59, 0xdd, 0x45, 0xf8, 0x53, 0x28, 0xc5, + 0xa2, 0xe2, 0xb7, 0xd3, 0xbd, 0xa7, 0x66, 0x51, 0xaf, 0xdf, 0x0e, 0xac, 0x0a, 0x0c, 0x40, 0x4b, + 0x3f, 0x15, 0xfc, 0xce, 0x4d, 0x6e, 0xca, 0xb2, 0xfa, 0xd3, 0xbf, 0x0f, 0x8a, 0x62, 0x9d, 0xfd, + 0xcb, 0x65, 0x03, 0x5d, 0x2d, 0x1b, 0xe8, 0xe7, 0x65, 0x03, 0xfd, 0xba, 0x6c, 0xa0, 0xef, 0x7e, + 0x6b, 0xe4, 0xbe, 0x7c, 0x37, 0xf5, 0x21, 0xea, 0x06, 0x0b, 0xdb, 0x6e, 0x8d, 0xe9, 0x59, 0xdb, + 0xa5, 0xde, 0x24, 0x68, 0x59, 0x0b, 0xa7, 0x2d, 0x2a, 0xfe, 0x90, 0xaf, 0xee, 0x53, 0x6f, 0x6f, + 0x68, 0xbe, 0x3e, 0x1c, 0xc8, 0xeb, 0x79, 0xa4, 0xf2, 0x4f, 0xd3, 0x8f, 0xfe, 0x0a, 0x00, 0x00, + 0xff, 0xff, 0x4f, 0x13, 0xa2, 0x69, 0x4e, 0x0b, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/object/service.proto b/object/service.proto index 662bf8a..f208472 100644 --- a/object/service.proto +++ b/object/service.proto @@ -1,6 +1,7 @@ syntax = "proto3"; package object; option go_package = "github.com/nspcc-dev/neofs-api/object"; +option csharp_namespace = "NeoFS.API.Object"; import "refs/types.proto"; import "object/types.proto"; diff --git a/object/types.pb.go b/object/types.pb.go index 2be08c9..53be938 100644 --- a/object/types.pb.go +++ b/object/types.pb.go @@ -826,63 +826,64 @@ func init() { func init() { proto.RegisterFile("object/types.proto", fileDescriptor_02021a1d39b1aee0) } var fileDescriptor_02021a1d39b1aee0 = []byte{ - // 893 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x55, 0xdd, 0x6e, 0x1b, 0x45, - 0x14, 0xf6, 0xda, 0xeb, 0xbf, 0xe3, 0x4d, 0xb3, 0x1d, 0x4a, 0x59, 0x05, 0xe1, 0x84, 0x15, 0x45, - 0xa1, 0x90, 0xb5, 0x48, 0x41, 0x15, 0x42, 0x42, 0xc4, 0x31, 0xc2, 0x16, 0x85, 0x58, 0x93, 0x9f, - 0x0b, 0xee, 0xd6, 0xf6, 0x78, 0x3d, 0xc4, 0x9e, 0xb1, 0x66, 0x66, 0xdb, 0xfa, 0x35, 0xb8, 0xe2, - 0x8e, 0xc7, 0xe0, 0x15, 0x7a, 0xc9, 0x25, 0xea, 0x45, 0x84, 0xc2, 0x03, 0xf0, 0x0a, 0xd5, 0xcc, - 0xfe, 0x78, 0x37, 0xed, 0x8d, 0x35, 0xe7, 0x7c, 0xdf, 0x37, 0x3e, 0x73, 0xe6, 0x3b, 0xb3, 0x80, - 0xf8, 0xe4, 0x37, 0x32, 0x55, 0x3d, 0xb5, 0x59, 0x13, 0x19, 0xac, 0x05, 0x57, 0x1c, 0x35, 0x92, - 0xdc, 0x9e, 0x2b, 0xc8, 0x5c, 0x16, 0x91, 0xbd, 0xf7, 0x24, 0x91, 0x92, 0x72, 0x56, 0x4a, 0x7a, - 0x52, 0x71, 0x11, 0x46, 0x24, 0x12, 0x3c, 0x5e, 0x97, 0x90, 0xa3, 0x88, 0xaa, 0x45, 0x3c, 0x09, - 0xa6, 0x7c, 0xd5, 0x8b, 0x78, 0xc4, 0x7b, 0x26, 0x3d, 0x89, 0xe7, 0x26, 0x32, 0x81, 0x59, 0x25, - 0x74, 0xff, 0x29, 0xd4, 0x71, 0xc8, 0x22, 0x82, 0x1e, 0x42, 0xe3, 0x6c, 0x3e, 0x97, 0x44, 0x79, - 0xd6, 0x81, 0x75, 0x68, 0xe3, 0x34, 0xd2, 0xf9, 0x67, 0x84, 0x45, 0x6a, 0xe1, 0x55, 0x93, 0x7c, - 0x12, 0xf9, 0x5f, 0x01, 0x5c, 0x4a, 0x22, 0x86, 0x24, 0x9c, 0x11, 0x81, 0x5c, 0xa8, 0xfd, 0x44, - 0x36, 0x46, 0xda, 0xc6, 0x7a, 0x89, 0x1e, 0x40, 0xfd, 0x2a, 0x5c, 0xc6, 0xc4, 0xc8, 0xda, 0x38, - 0x09, 0xfc, 0xbf, 0x6c, 0x68, 0xa4, 0x12, 0x1f, 0xec, 0x67, 0x94, 0x5d, 0x1b, 0x4d, 0xe7, 0xd8, - 0x09, 0x92, 0x06, 0x04, 0x3a, 0x37, 0xac, 0x60, 0x83, 0xa1, 0xcf, 0xa1, 0x85, 0xc9, 0x8c, 0x0a, - 0x32, 0x55, 0x66, 0x9f, 0xce, 0xf1, 0x4e, 0xa0, 0x1b, 0x14, 0x9c, 0xcc, 0x66, 0x82, 0x48, 0x39, - 0xac, 0xe0, 0x9c, 0x80, 0x4a, 0x15, 0x79, 0x35, 0x43, 0x47, 0xd9, 0xb6, 0x5b, 0x64, 0x58, 0xc1, - 0xc5, 0xca, 0xbf, 0x84, 0xf6, 0x85, 0x08, 0x99, 0x9c, 0x73, 0xb1, 0xf2, 0x6c, 0x23, 0xba, 0x9f, - 0x89, 0x72, 0x60, 0x58, 0xc1, 0x5b, 0x96, 0x91, 0xf0, 0xd5, 0x44, 0x2a, 0xce, 0x88, 0x57, 0xbf, - 0x23, 0xc9, 0x00, 0x23, 0xc9, 0x02, 0xf4, 0x35, 0x34, 0xae, 0x88, 0xa0, 0xf3, 0x8d, 0xd7, 0x30, - 0xfc, 0x0f, 0x83, 0xf4, 0x56, 0x03, 0x93, 0xa6, 0xd3, 0x50, 0x51, 0xce, 0xf2, 0x02, 0x53, 0x32, - 0xfa, 0x14, 0x5a, 0x43, 0xbe, 0xe2, 0xc3, 0x50, 0x2e, 0xbc, 0xe6, 0x81, 0x75, 0xe8, 0xf4, 0x5b, - 0xaf, 0x6f, 0xf6, 0x6d, 0x1d, 0xeb, 0xa3, 0x67, 0x18, 0x7a, 0x0c, 0xbb, 0xe3, 0x70, 0xb3, 0xe4, - 0xe1, 0xec, 0x74, 0x41, 0xa6, 0xd7, 0x32, 0x5e, 0x79, 0x2d, 0x4d, 0x1f, 0x56, 0xf0, 0x5d, 0x00, - 0x3d, 0x85, 0xf6, 0x88, 0x29, 0x12, 0x09, 0xaa, 0x36, 0x5e, 0xdb, 0x54, 0xf3, 0x41, 0x56, 0x7d, - 0x0e, 0xe4, 0x95, 0x6c, 0xb9, 0xe8, 0x7b, 0x70, 0xce, 0x13, 0xd7, 0xfd, 0xa8, 0x5d, 0xe7, 0x81, - 0xd1, 0xee, 0x05, 0x45, 0x2b, 0x06, 0x45, 0xc6, 0xb0, 0x82, 0x4b, 0x0a, 0xdd, 0xb8, 0x71, 0x3c, - 0x59, 0xd2, 0xa9, 0xf6, 0x4a, 0xa7, 0xdc, 0xb8, 0x1c, 0xd0, 0x7f, 0x9a, 0x07, 0xfd, 0x66, 0x6a, - 0x23, 0xbf, 0x53, 0x68, 0xba, 0xff, 0xbf, 0x05, 0xce, 0xf9, 0x46, 0x2a, 0xb2, 0x4a, 0x6f, 0xd1, - 0x83, 0xe6, 0x15, 0x11, 0xba, 0xa1, 0xa9, 0x7d, 0xb3, 0x10, 0x7d, 0x02, 0x3b, 0x69, 0x07, 0x4a, - 0x36, 0x2e, 0x27, 0xd1, 0x1e, 0x54, 0x47, 0x03, 0xe3, 0x19, 0xa7, 0x0f, 0xaf, 0x6e, 0xf6, 0x2b, - 0xaf, 0x6f, 0xf6, 0xab, 0xa3, 0x01, 0xae, 0x8e, 0x06, 0xe8, 0x33, 0x68, 0x9e, 0xbd, 0x60, 0x44, - 0x8c, 0x06, 0xc6, 0x1f, 0x4e, 0x7f, 0x37, 0x25, 0x64, 0x69, 0x9c, 0x2d, 0xd0, 0x47, 0x50, 0x3b, - 0x1d, 0x0d, 0x8c, 0x27, 0x9c, 0x7e, 0x27, 0xa5, 0xe9, 0x14, 0xd6, 0x3f, 0xe8, 0x1b, 0x68, 0x9f, - 0x0a, 0x12, 0x2a, 0x32, 0x3b, 0x51, 0xa9, 0x11, 0xde, 0xcf, 0xce, 0x6f, 0x00, 0xca, 0xd9, 0x98, - 0x53, 0xa6, 0xfa, 0xb6, 0xd6, 0xe2, 0x2d, 0xdb, 0x3f, 0x81, 0x9d, 0x12, 0x03, 0xed, 0x41, 0xeb, - 0x92, 0xd1, 0x97, 0x17, 0x74, 0x45, 0xcc, 0x91, 0x6b, 0x38, 0x8f, 0xf5, 0xec, 0xfd, 0xb0, 0xe6, - 0xd3, 0xec, 0xac, 0x49, 0xe0, 0x53, 0xd8, 0xbd, 0x73, 0xbf, 0xe8, 0x10, 0x76, 0x93, 0x95, 0xcc, - 0x7d, 0xa3, 0xf7, 0x72, 0xf0, 0xdd, 0x34, 0xfa, 0x02, 0xee, 0x67, 0xeb, 0x73, 0x1a, 0xb1, 0x50, - 0xc5, 0x22, 0x19, 0x6d, 0x07, 0xbf, 0x0d, 0xf8, 0x7f, 0x5a, 0xc9, 0x70, 0xa3, 0x47, 0x60, 0xeb, - 0xc7, 0xc9, 0xec, 0x7a, 0x6f, 0x7b, 0xd9, 0x1a, 0x0b, 0x2e, 0x36, 0x6b, 0x82, 0x0d, 0x9c, 0xb6, - 0xbf, 0xfa, 0xae, 0xf6, 0xfb, 0x17, 0x60, 0x6b, 0x26, 0xea, 0x40, 0xf3, 0x92, 0x5d, 0x33, 0xfe, - 0x82, 0xb9, 0x15, 0x04, 0xd0, 0x18, 0x87, 0x82, 0x30, 0xe5, 0x5a, 0xc8, 0x81, 0xd6, 0x58, 0x90, - 0xe7, 0x94, 0xc7, 0xd2, 0xad, 0xa2, 0x16, 0xd8, 0xbf, 0x90, 0x97, 0xca, 0xad, 0xa1, 0x36, 0xd4, - 0x4f, 0x17, 0x74, 0x39, 0x73, 0x6d, 0xe4, 0x96, 0xad, 0xeb, 0xd6, 0xfd, 0x65, 0x61, 0xec, 0xd1, - 0xe3, 0x52, 0x95, 0x0f, 0xdf, 0x1a, 0xff, 0x42, 0xa9, 0xfe, 0x93, 0x77, 0x95, 0xd3, 0x86, 0xfa, - 0xf9, 0x7a, 0x49, 0x75, 0x35, 0x2d, 0xb0, 0x75, 0x1f, 0xdc, 0xaa, 0x4e, 0xfe, 0xcc, 0xe3, 0xe5, - 0xcc, 0xad, 0xf9, 0xbf, 0x5b, 0xd0, 0x38, 0x33, 0x9b, 0xa2, 0xef, 0xca, 0xce, 0x4d, 0x9f, 0xbf, - 0x07, 0xd9, 0x7f, 0x16, 0xb1, 0xd4, 0x05, 0x65, 0xa7, 0x07, 0xd0, 0x4c, 0xef, 0xc6, 0xab, 0x1e, - 0xd4, 0x0e, 0x3b, 0xc7, 0xf7, 0x32, 0x69, 0x49, 0x94, 0x91, 0xf4, 0x64, 0xa4, 0x56, 0x4f, 0xec, - 0x8d, 0xb3, 0xd0, 0xff, 0xb8, 0x30, 0x8d, 0xdb, 0xe7, 0x3a, 0xb9, 0xff, 0x24, 0xe8, 0x7f, 0xfb, - 0xea, 0xb6, 0x6b, 0xfd, 0x7d, 0xdb, 0xb5, 0xfe, 0xb9, 0xed, 0x5a, 0xff, 0xde, 0x76, 0xad, 0x3f, - 0xfe, 0xeb, 0x56, 0x7e, 0x7d, 0x54, 0xf8, 0xc4, 0x30, 0xb9, 0x9e, 0x4e, 0x8f, 0x66, 0xe4, 0x79, - 0x8f, 0x11, 0x3e, 0x97, 0x47, 0xe1, 0x9a, 0xf6, 0x92, 0x7a, 0x26, 0x0d, 0xf3, 0x85, 0x79, 0xf2, - 0x26, 0x00, 0x00, 0xff, 0xff, 0xf4, 0x71, 0x76, 0x6c, 0xef, 0x06, 0x00, 0x00, + // 908 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x55, 0xdd, 0x72, 0x1b, 0x35, + 0x14, 0xf6, 0xda, 0xeb, 0xbf, 0xe3, 0x4d, 0xb3, 0x15, 0xa5, 0xec, 0x84, 0xc1, 0x09, 0x3b, 0x94, + 0x09, 0x85, 0xac, 0x87, 0x14, 0xa6, 0xc3, 0x0d, 0x43, 0x1c, 0x03, 0xf6, 0x50, 0x12, 0x8f, 0x9c, + 0xe4, 0x82, 0xbb, 0xb5, 0x2d, 0xdb, 0x22, 0xb6, 0xe4, 0x91, 0xb4, 0x6d, 0xfd, 0x1a, 0x5c, 0x71, + 0xc7, 0x3d, 0x2f, 0xc0, 0x2b, 0xf4, 0x92, 0x4b, 0xa6, 0x17, 0x19, 0x26, 0x3c, 0x00, 0xaf, 0xd0, + 0x91, 0xf6, 0xc7, 0xbb, 0x69, 0x6f, 0x3c, 0x3a, 0xe7, 0xfb, 0x3e, 0xf9, 0xe8, 0xe8, 0x3b, 0x5a, + 0x40, 0x7c, 0xfc, 0x2b, 0x99, 0xa8, 0x8e, 0xda, 0xac, 0x89, 0x0c, 0xd6, 0x82, 0x2b, 0x8e, 0x6a, + 0x71, 0x6e, 0xcf, 0x15, 0x64, 0x26, 0xf3, 0xc8, 0xde, 0x7b, 0x92, 0x48, 0x49, 0x39, 0x2b, 0x24, + 0x3d, 0xa9, 0xb8, 0x08, 0xe7, 0x64, 0x2e, 0x78, 0xb4, 0x2e, 0x20, 0x47, 0x73, 0xaa, 0x16, 0xd1, + 0x38, 0x98, 0xf0, 0x55, 0x67, 0xce, 0xe7, 0xbc, 0x63, 0xd2, 0xe3, 0x68, 0x66, 0x22, 0x13, 0x98, + 0x55, 0x4c, 0xf7, 0x9f, 0x42, 0x15, 0x87, 0x6c, 0x4e, 0xd0, 0x43, 0xa8, 0x9d, 0xcf, 0x66, 0x92, + 0x28, 0xcf, 0x3a, 0xb0, 0x0e, 0x6d, 0x9c, 0x44, 0x3a, 0xff, 0x8c, 0xb0, 0xb9, 0x5a, 0x78, 0xe5, + 0x38, 0x1f, 0x47, 0xfe, 0x57, 0x00, 0x97, 0x92, 0x88, 0x3e, 0x09, 0xa7, 0x44, 0x20, 0x17, 0x2a, + 0x3f, 0x91, 0x8d, 0x91, 0x36, 0xb1, 0x5e, 0xa2, 0x07, 0x50, 0xbd, 0x0a, 0x97, 0x11, 0x31, 0xb2, + 0x26, 0x8e, 0x03, 0xff, 0x2f, 0x1b, 0x6a, 0x89, 0xc4, 0x07, 0xfb, 0x19, 0x65, 0xd7, 0x46, 0xd3, + 0x3a, 0x76, 0x82, 0xb8, 0x01, 0x81, 0xce, 0xf5, 0x4b, 0xd8, 0x60, 0xe8, 0x73, 0x68, 0x60, 0x32, + 0xa5, 0x82, 0x4c, 0x94, 0xd9, 0xa7, 0x75, 0xbc, 0x13, 0xe8, 0x06, 0x05, 0x27, 0xd3, 0xa9, 0x20, + 0x52, 0xf6, 0x4b, 0x38, 0x23, 0xa0, 0x42, 0x45, 0x5e, 0xc5, 0xd0, 0x51, 0xba, 0xed, 0x16, 0xe9, + 0x97, 0x70, 0xbe, 0xf2, 0x2f, 0xa1, 0x79, 0x21, 0x42, 0x26, 0x67, 0x5c, 0xac, 0x3c, 0xdb, 0x88, + 0xee, 0xa7, 0xa2, 0x0c, 0xe8, 0x97, 0xf0, 0x96, 0x65, 0x24, 0x7c, 0x35, 0x96, 0x8a, 0x33, 0xe2, + 0x55, 0xef, 0x48, 0x52, 0xc0, 0x48, 0xd2, 0x00, 0x7d, 0x0d, 0xb5, 0x2b, 0x22, 0xe8, 0x6c, 0xe3, + 0xd5, 0x0c, 0xff, 0xc3, 0x20, 0xb9, 0xd5, 0xc0, 0xa4, 0xe9, 0x24, 0x54, 0x94, 0xb3, 0xac, 0xc0, + 0x84, 0x8c, 0x3e, 0x85, 0x46, 0x9f, 0xaf, 0x78, 0x3f, 0x94, 0x0b, 0xaf, 0x7e, 0x60, 0x1d, 0x3a, + 0xdd, 0xc6, 0xeb, 0x9b, 0x7d, 0x5b, 0xc7, 0xfa, 0xe8, 0x29, 0x86, 0x1e, 0xc3, 0xee, 0x30, 0xdc, + 0x2c, 0x79, 0x38, 0x3d, 0x5d, 0x90, 0xc9, 0xb5, 0x8c, 0x56, 0x5e, 0x43, 0xd3, 0xfb, 0x25, 0x7c, + 0x17, 0x40, 0x4f, 0xa1, 0x39, 0x60, 0x8a, 0xcc, 0x05, 0x55, 0x1b, 0xaf, 0x69, 0xaa, 0xf9, 0x20, + 0xad, 0x3e, 0x03, 0xb2, 0x4a, 0xb6, 0x5c, 0xf4, 0x1d, 0x38, 0xa3, 0xd8, 0x75, 0x3f, 0x6a, 0xd7, + 0x79, 0x60, 0xb4, 0x7b, 0x41, 0xde, 0x8a, 0x41, 0x9e, 0xd1, 0x2f, 0xe1, 0x82, 0x42, 0x37, 0x6e, + 0x18, 0x8d, 0x97, 0x74, 0xa2, 0xbd, 0xd2, 0x2a, 0x36, 0x2e, 0x03, 0xf4, 0x9f, 0x66, 0x41, 0xb7, + 0x9e, 0xd8, 0xc8, 0x6f, 0xe5, 0x9a, 0xee, 0xff, 0x6f, 0x81, 0x33, 0xda, 0x48, 0x45, 0x56, 0xc9, + 0x2d, 0x7a, 0x50, 0xbf, 0x22, 0x42, 0x37, 0x34, 0xb1, 0x6f, 0x1a, 0xa2, 0x4f, 0x60, 0x27, 0xe9, + 0x40, 0xc1, 0xc6, 0xc5, 0x24, 0xda, 0x83, 0xf2, 0xa0, 0x67, 0x3c, 0xe3, 0x74, 0xe1, 0xd5, 0xcd, + 0x7e, 0xe9, 0xf5, 0xcd, 0x7e, 0x79, 0xd0, 0xc3, 0xe5, 0x41, 0x0f, 0x7d, 0x06, 0xf5, 0xf3, 0x17, + 0x8c, 0x88, 0x41, 0xcf, 0xf8, 0xc3, 0xe9, 0xee, 0x26, 0x84, 0x34, 0x8d, 0xd3, 0x05, 0xfa, 0x08, + 0x2a, 0xa7, 0x83, 0x9e, 0xf1, 0x84, 0xd3, 0x6d, 0x25, 0x34, 0x9d, 0xc2, 0xfa, 0x07, 0x7d, 0x03, + 0xcd, 0x53, 0x41, 0x42, 0x45, 0xa6, 0x27, 0x2a, 0x31, 0xc2, 0xfb, 0xe9, 0xf9, 0x0d, 0x40, 0x39, + 0x1b, 0x72, 0xca, 0x54, 0xd7, 0xd6, 0x5a, 0xbc, 0x65, 0xfb, 0x27, 0xb0, 0x53, 0x60, 0xa0, 0x3d, + 0x68, 0x5c, 0x32, 0xfa, 0xf2, 0x82, 0xae, 0x88, 0x39, 0x72, 0x05, 0x67, 0xb1, 0x9e, 0xbd, 0xef, + 0xd7, 0x7c, 0x92, 0x9e, 0x35, 0x0e, 0x7c, 0x0a, 0xbb, 0x77, 0xee, 0x17, 0x1d, 0xc2, 0x6e, 0xbc, + 0x92, 0x99, 0x6f, 0xf4, 0x5e, 0x0e, 0xbe, 0x9b, 0x46, 0x5f, 0xc0, 0xfd, 0x74, 0x3d, 0xa2, 0x73, + 0x16, 0xaa, 0x48, 0xc4, 0xa3, 0xed, 0xe0, 0xb7, 0x01, 0xff, 0x0f, 0x2b, 0x1e, 0x6e, 0xf4, 0x08, + 0x6c, 0xfd, 0x38, 0x99, 0x5d, 0xef, 0x6d, 0x2f, 0x5b, 0x63, 0xc1, 0xc5, 0x66, 0x4d, 0xb0, 0x81, + 0x93, 0xf6, 0x97, 0xdf, 0xd5, 0x7e, 0xff, 0x02, 0x6c, 0xcd, 0x44, 0x2d, 0xa8, 0x5f, 0xb2, 0x6b, + 0xc6, 0x5f, 0x30, 0xb7, 0x84, 0x00, 0x6a, 0xc3, 0x50, 0x10, 0xa6, 0x5c, 0x0b, 0x39, 0xd0, 0x18, + 0x0a, 0xf2, 0x9c, 0xf2, 0x48, 0xba, 0x65, 0xd4, 0x00, 0xfb, 0x8c, 0xbc, 0x54, 0x6e, 0x05, 0x35, + 0xa1, 0x7a, 0xba, 0xa0, 0xcb, 0xa9, 0x6b, 0x23, 0xb7, 0x68, 0x5d, 0xb7, 0xea, 0x2f, 0x73, 0x63, + 0x8f, 0x1e, 0x17, 0xaa, 0x7c, 0xf8, 0xd6, 0xf8, 0xe7, 0x4a, 0xf5, 0x9f, 0xbc, 0xab, 0x9c, 0x26, + 0x54, 0x47, 0xeb, 0x25, 0xd5, 0xd5, 0x34, 0xc0, 0xd6, 0x7d, 0x70, 0xcb, 0x3a, 0xf9, 0x33, 0x8f, + 0x96, 0x53, 0xb7, 0xe2, 0xff, 0x66, 0x41, 0xed, 0xdc, 0x6c, 0x8a, 0xbe, 0x2d, 0x3a, 0x37, 0x79, + 0xfe, 0x1e, 0xa4, 0xff, 0x99, 0xc7, 0x12, 0x17, 0x14, 0x9d, 0x1e, 0x40, 0x3d, 0xb9, 0x1b, 0xaf, + 0x7c, 0x50, 0x39, 0x6c, 0x1d, 0xdf, 0x4b, 0xa5, 0x05, 0x51, 0x4a, 0xd2, 0x93, 0x91, 0x58, 0x3d, + 0xb6, 0x37, 0x4e, 0x43, 0xff, 0xe3, 0xdc, 0x34, 0x6e, 0x9f, 0xeb, 0xf8, 0xfe, 0xe3, 0xa0, 0x7b, + 0xf6, 0xea, 0xb6, 0x6d, 0xfd, 0x7d, 0xdb, 0xb6, 0xfe, 0xb9, 0x6d, 0x5b, 0xff, 0xde, 0xb6, 0xad, + 0xdf, 0xff, 0x6b, 0x97, 0x7e, 0x79, 0x94, 0xfb, 0xc4, 0x30, 0xb9, 0x9e, 0x4c, 0x8e, 0xa6, 0xe4, + 0x79, 0x87, 0x11, 0x3e, 0x93, 0x47, 0xe1, 0x9a, 0x76, 0xe2, 0x7a, 0xfe, 0x2c, 0xbb, 0x67, 0x84, + 0xff, 0x30, 0x0a, 0x4e, 0x86, 0x83, 0x20, 0x3e, 0xfc, 0xb8, 0x66, 0x3e, 0x3a, 0x4f, 0xde, 0x04, + 0x00, 0x00, 0xff, 0xff, 0x29, 0xb2, 0x70, 0xad, 0x02, 0x07, 0x00, 0x00, } func (m *Range) Marshal() (dAtA []byte, err error) { diff --git a/object/types.proto b/object/types.proto index 5a0b98e..3abe725 100644 --- a/object/types.proto +++ b/object/types.proto @@ -1,6 +1,7 @@ syntax = "proto3"; package object; option go_package = "github.com/nspcc-dev/neofs-api/object"; +option csharp_namespace = "NeoFS.API.Object"; import "refs/types.proto"; import "session/types.proto"; diff --git a/query/types.pb.go b/query/types.pb.go index 63e9879..ed20942 100644 --- a/query/types.pb.go +++ b/query/types.pb.go @@ -163,7 +163,7 @@ func init() { func init() { proto.RegisterFile("query/types.proto", fileDescriptor_c682aeaf51d46f4d) } var fileDescriptor_c682aeaf51d46f4d = []byte{ - // 278 bytes of a gzipped FileDescriptorProto + // 293 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x2c, 0x2c, 0x4d, 0x2d, 0xaa, 0xd4, 0x2f, 0xa9, 0x2c, 0x48, 0x2d, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x05, 0x0b, 0x49, 0xe9, 0xa6, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0xa7, 0xe7, @@ -177,11 +177,12 @@ var fileDescriptor_c682aeaf51d46f4d = []byte{ 0x28, 0x35, 0x3d, 0xb5, 0x42, 0x80, 0xd1, 0x8a, 0x65, 0xc6, 0x02, 0x79, 0x06, 0x25, 0x1b, 0x2e, 0xd6, 0x40, 0x90, 0x95, 0x42, 0xba, 0x5c, 0xec, 0x10, 0x5b, 0x8b, 0x25, 0x18, 0x15, 0x98, 0x35, 0xb8, 0x8d, 0x78, 0x51, 0xdc, 0xe2, 0xc4, 0x72, 0xe2, 0x9e, 0x3c, 0x43, 0x10, 0x4c, 0x0d, 0x44, - 0xb7, 0x93, 0xd5, 0x89, 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, 0x31, 0xde, 0x78, 0x24, 0xc7, 0xf8, + 0xb7, 0x93, 0xcf, 0x89, 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, 0x31, 0xde, 0x78, 0x24, 0xc7, 0xf8, 0xe0, 0x91, 0x1c, 0xe3, 0x8c, 0xc7, 0x72, 0x0c, 0x51, 0x2a, 0x48, 0xa1, 0x91, 0x57, 0x5c, 0x90, 0x9c, 0xac, 0x9b, 0x92, 0x5a, 0xa6, 0x9f, 0x97, 0x9a, 0x9f, 0x56, 0xac, 0x9b, 0x58, 0x90, 0xa9, - 0x0f, 0x36, 0x37, 0x89, 0x0d, 0x1c, 0x16, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0x8b, 0x7c, - 0x6b, 0x50, 0x56, 0x01, 0x00, 0x00, + 0x0f, 0x36, 0x77, 0x15, 0x13, 0xbf, 0x5f, 0x6a, 0xbe, 0x5b, 0xb0, 0x9e, 0x63, 0x80, 0xa7, 0x1e, + 0xd8, 0x09, 0x49, 0x6c, 0xe0, 0xd0, 0x31, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0x2b, 0x12, 0xad, + 0xe4, 0x68, 0x01, 0x00, 0x00, } func (m *Filter) Marshal() (dAtA []byte, err error) { diff --git a/query/types.proto b/query/types.proto index 90f4bbf..0d35154 100644 --- a/query/types.proto +++ b/query/types.proto @@ -1,6 +1,7 @@ syntax = "proto3"; package query; option go_package = "github.com/nspcc-dev/neofs-api/query"; +option csharp_namespace = "NeoFS.API.Query"; import "github.com/gogo/protobuf/gogoproto/gogo.proto"; diff --git a/refs/types.pb.go b/refs/types.pb.go index 80dcde2..e4d6a65 100644 --- a/refs/types.pb.go +++ b/refs/types.pb.go @@ -69,7 +69,7 @@ func init() { func init() { proto.RegisterFile("refs/types.proto", fileDescriptor_063a64a96d952d31) } var fileDescriptor_063a64a96d952d31 = []byte{ - // 201 bytes of a gzipped FileDescriptorProto + // 218 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x28, 0x4a, 0x4d, 0x2b, 0xd6, 0x2f, 0xa9, 0x2c, 0x48, 0x2d, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x01, 0x89, 0x48, 0xe9, 0xa6, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0xa7, 0xe7, 0xa7, @@ -77,12 +77,13 @@ var fileDescriptor_063a64a96d952d31 = []byte{ 0xe3, 0x62, 0x77, 0x4c, 0x49, 0x29, 0x4a, 0x2d, 0x2e, 0x16, 0xd2, 0xe1, 0xe2, 0xf0, 0x4f, 0xca, 0x4a, 0x4d, 0x2e, 0xf1, 0x74, 0x91, 0x60, 0x54, 0x60, 0xd4, 0xe0, 0x71, 0x12, 0x38, 0x71, 0x4f, 0x9e, 0xe1, 0xd6, 0x3d, 0x79, 0xb8, 0x78, 0x10, 0x9c, 0x25, 0x24, 0xcb, 0xc5, 0xec, 0xec, 0xe9, - 0x22, 0xc1, 0x04, 0x56, 0xc8, 0x0d, 0x55, 0x08, 0x12, 0x0a, 0x02, 0x11, 0x4e, 0x8e, 0x37, 0x1e, + 0x22, 0xc1, 0x04, 0x56, 0xc8, 0x0d, 0x55, 0x08, 0x12, 0x0a, 0x02, 0x11, 0x4e, 0x41, 0x37, 0x1e, 0xca, 0x31, 0x34, 0x3c, 0x92, 0x63, 0x38, 0xf1, 0x48, 0x8e, 0xf1, 0xc2, 0x23, 0x39, 0xc6, 0x1b, 0x8f, 0xe4, 0x18, 0x1f, 0x3c, 0x92, 0x63, 0x9c, 0xf1, 0x58, 0x8e, 0x21, 0x4a, 0x19, 0xc9, 0x91, 0x79, 0xc5, 0x05, 0xc9, 0xc9, 0xba, 0x29, 0xa9, 0x65, 0xfa, 0x79, 0xa9, 0xf9, 0x69, 0xc5, 0xba, - 0x89, 0x05, 0x99, 0xfa, 0x20, 0x9f, 0x24, 0xb1, 0x81, 0x5d, 0x68, 0x0c, 0x08, 0x00, 0x00, 0xff, - 0xff, 0x50, 0xaf, 0xc5, 0x62, 0xea, 0x00, 0x00, 0x00, + 0x89, 0x05, 0x99, 0xfa, 0x20, 0x9f, 0xac, 0x62, 0xe2, 0xf3, 0x4b, 0xcd, 0x77, 0x0b, 0xd6, 0x73, + 0x0c, 0xf0, 0xd4, 0x0b, 0x4a, 0x4d, 0x2b, 0x4e, 0x62, 0x03, 0x3b, 0xd9, 0x18, 0x10, 0x00, 0x00, + 0xff, 0xff, 0xa7, 0xa4, 0xe2, 0xf3, 0xfb, 0x00, 0x00, 0x00, } func (m *Address) Marshal() (dAtA []byte, err error) { diff --git a/refs/types.proto b/refs/types.proto index c526d56..d552d6c 100644 --- a/refs/types.proto +++ b/refs/types.proto @@ -1,6 +1,7 @@ syntax = "proto3"; package refs; option go_package = "github.com/nspcc-dev/neofs-api/refs"; +option csharp_namespace = "NeoFS.API.Refs"; import "github.com/gogo/protobuf/gogoproto/gogo.proto"; diff --git a/service/meta.pb.go b/service/meta.pb.go index 6ff1a5d..9b2f430 100644 --- a/service/meta.pb.go +++ b/service/meta.pb.go @@ -95,7 +95,7 @@ func init() { func init() { proto.RegisterFile("service/meta.proto", fileDescriptor_a638867e7b43457c) } var fileDescriptor_a638867e7b43457c = []byte{ - // 204 bytes of a gzipped FileDescriptorProto + // 220 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x2a, 0x4e, 0x2d, 0x2a, 0xcb, 0x4c, 0x4e, 0xd5, 0xcf, 0x4d, 0x2d, 0x49, 0xd4, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x87, 0x8a, 0x49, 0xe9, 0xa6, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0xa7, @@ -104,11 +104,12 @@ var fileDescriptor_a638867e7b43457c = []byte{ 0x48, 0x4d, 0x4c, 0x49, 0x2d, 0x12, 0x12, 0xe0, 0x62, 0x0e, 0x09, 0xf1, 0x91, 0x60, 0x54, 0x60, 0xd4, 0xe0, 0x0d, 0x02, 0x31, 0x85, 0x44, 0xb8, 0x58, 0x5d, 0x0b, 0xf2, 0x93, 0x33, 0x24, 0x98, 0x14, 0x18, 0x35, 0x58, 0x82, 0x20, 0x1c, 0x21, 0x09, 0x2e, 0xf6, 0xb0, 0xd4, 0xa2, 0xe2, 0xcc, - 0xfc, 0x3c, 0x09, 0x66, 0xb0, 0x5a, 0x18, 0xd7, 0xc9, 0xe6, 0xc4, 0x23, 0x39, 0xc6, 0x0b, 0x8f, + 0xfc, 0x3c, 0x09, 0x66, 0xb0, 0x5a, 0x18, 0xd7, 0x29, 0xe0, 0xc4, 0x23, 0x39, 0xc6, 0x0b, 0x8f, 0xe4, 0x18, 0x6f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e, 0x71, 0xc6, 0x63, 0x39, 0x86, 0x28, 0x35, 0x24, 0xb7, 0xe5, 0x15, 0x17, 0x24, 0x27, 0xeb, 0xa6, 0xa4, 0x96, 0xe9, 0xe7, 0xa5, 0xe6, - 0xa7, 0x15, 0xeb, 0x26, 0x16, 0x64, 0xea, 0x43, 0xfd, 0x90, 0xc4, 0x06, 0x76, 0x9b, 0x31, 0x20, - 0x00, 0x00, 0xff, 0xff, 0xa6, 0x4d, 0x59, 0x8e, 0xe9, 0x00, 0x00, 0x00, + 0xa7, 0x15, 0xeb, 0x26, 0x16, 0x64, 0xea, 0x43, 0xfd, 0xb0, 0x8a, 0x49, 0xd0, 0x2f, 0x35, 0xdf, + 0x2d, 0x58, 0xcf, 0x31, 0xc0, 0x53, 0x2f, 0x18, 0x22, 0x96, 0xc4, 0x06, 0x76, 0xaf, 0x31, 0x20, + 0x00, 0x00, 0xff, 0xff, 0x78, 0x63, 0x03, 0x7b, 0xfd, 0x00, 0x00, 0x00, } func (m *RequestMetaHeader) Marshal() (dAtA []byte, err error) { diff --git a/service/meta.proto b/service/meta.proto index f2cfe8f..5ca3633 100644 --- a/service/meta.proto +++ b/service/meta.proto @@ -1,6 +1,7 @@ syntax = "proto3"; package service; option go_package = "github.com/nspcc-dev/neofs-api/service"; +option csharp_namespace = "NeoFS.API.Service"; import "github.com/gogo/protobuf/gogoproto/gogo.proto"; diff --git a/service/verify.pb.go b/service/verify.pb.go index a8f0ea5..c7a2435 100644 --- a/service/verify.pb.go +++ b/service/verify.pb.go @@ -179,7 +179,7 @@ func init() { func init() { proto.RegisterFile("service/verify.proto", fileDescriptor_4bdd5bc50ec96238) } var fileDescriptor_4bdd5bc50ec96238 = []byte{ - // 272 bytes of a gzipped FileDescriptorProto + // 288 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x29, 0x4e, 0x2d, 0x2a, 0xcb, 0x4c, 0x4e, 0xd5, 0x2f, 0x4b, 0x2d, 0xca, 0x4c, 0xab, 0xd4, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x87, 0x8a, 0x4a, 0xe9, 0xa6, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, @@ -192,11 +192,12 @@ var fileDescriptor_4bdd5bc50ec96238 = []byte{ 0x13, 0x04, 0x17, 0x0b, 0x48, 0x4d, 0x2d, 0x92, 0x60, 0x82, 0x88, 0x81, 0xd8, 0x52, 0x93, 0x19, 0xb9, 0x38, 0xe1, 0xda, 0x85, 0x5c, 0x91, 0x74, 0x71, 0x1b, 0xa9, 0x13, 0xe9, 0x0a, 0x27, 0x8e, 0x13, 0xf7, 0xe4, 0x19, 0x2e, 0xdc, 0x93, 0x67, 0x84, 0x5a, 0x64, 0xcf, 0xc5, 0xe6, 0x5f, 0x94, - 0x99, 0x9e, 0x99, 0x07, 0xb6, 0x8a, 0x78, 0x83, 0x82, 0xa0, 0xda, 0x9c, 0x6c, 0x4e, 0x3c, 0x92, + 0x99, 0x9e, 0x99, 0x07, 0xb6, 0x8a, 0x78, 0x83, 0x82, 0xa0, 0xda, 0x9c, 0x02, 0x4e, 0x3c, 0x92, 0x63, 0xbc, 0xf0, 0x48, 0x8e, 0xf1, 0xc6, 0x23, 0x39, 0xc6, 0x07, 0x8f, 0xe4, 0x18, 0x67, 0x3c, 0x96, 0x63, 0x88, 0x52, 0x43, 0x0a, 0xf6, 0xbc, 0xe2, 0x82, 0xe4, 0x64, 0xdd, 0x94, 0xd4, 0x32, - 0xfd, 0xbc, 0xd4, 0xfc, 0xb4, 0x62, 0xdd, 0xc4, 0x82, 0x4c, 0x7d, 0xa8, 0x25, 0x49, 0x6c, 0xe0, - 0x60, 0x37, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0x7a, 0xfc, 0xec, 0x11, 0xc6, 0x01, 0x00, 0x00, + 0xfd, 0xbc, 0xd4, 0xfc, 0xb4, 0x62, 0xdd, 0xc4, 0x82, 0x4c, 0x7d, 0xa8, 0x25, 0xab, 0x98, 0x04, + 0xfd, 0x52, 0xf3, 0xdd, 0x82, 0xf5, 0x1c, 0x03, 0x3c, 0xf5, 0x82, 0x21, 0x62, 0x49, 0x6c, 0xe0, + 0xa8, 0x30, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0x94, 0x02, 0xe4, 0x3c, 0xda, 0x01, 0x00, 0x00, } func (m *RequestVerificationHeader) Marshal() (dAtA []byte, err error) { diff --git a/service/verify.proto b/service/verify.proto index 6a4a0e0..d241d88 100644 --- a/service/verify.proto +++ b/service/verify.proto @@ -1,6 +1,7 @@ syntax = "proto3"; package service; option go_package = "github.com/nspcc-dev/neofs-api/service"; +option csharp_namespace = "NeoFS.API.Service"; import "github.com/gogo/protobuf/gogoproto/gogo.proto"; diff --git a/session/service.pb.go b/session/service.pb.go index e554ba1..f003216 100644 --- a/session/service.pb.go +++ b/session/service.pb.go @@ -210,30 +210,32 @@ func init() { func init() { proto.RegisterFile("session/service.proto", fileDescriptor_b329bee0fd1148e0) } var fileDescriptor_b329bee0fd1148e0 = []byte{ - // 367 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x51, 0xbd, 0x6e, 0xe2, 0x40, - 0x10, 0x66, 0x4f, 0xc8, 0x70, 0x7b, 0x3a, 0x8a, 0xbd, 0x3f, 0xcb, 0x85, 0x39, 0xa1, 0xd3, 0x89, - 0xe2, 0xb0, 0x4f, 0xa4, 0x49, 0x91, 0x34, 0x24, 0x05, 0x29, 0x68, 0x4c, 0x92, 0x22, 0x9d, 0x6d, - 0x06, 0x67, 0x95, 0xb0, 0xeb, 0x78, 0xd6, 0x48, 0xbc, 0x49, 0x1e, 0x89, 0x92, 0x32, 0x15, 0x8a, - 0x9c, 0x2e, 0x4f, 0x11, 0xb1, 0x5e, 0x23, 0x12, 0x44, 0xb7, 0xf3, 0xfd, 0xcc, 0xcc, 0xb7, 0x43, - 0x7f, 0x20, 0x20, 0x72, 0x29, 0x7c, 0x84, 0x6c, 0xce, 0x63, 0xf0, 0xd2, 0x4c, 0x2a, 0xc9, 0x1a, - 0x06, 0x76, 0xbe, 0x55, 0xbc, 0x5a, 0xa4, 0x80, 0x25, 0xeb, 0x30, 0x23, 0xf6, 0x67, 0xa0, 0x42, - 0x83, 0x7d, 0xaf, 0xb0, 0x39, 0x64, 0x7c, 0xba, 0x30, 0x68, 0x2f, 0xe1, 0xea, 0x36, 0x8f, 0xbc, - 0x58, 0xce, 0xfc, 0x44, 0x26, 0xd2, 0xd7, 0x70, 0x94, 0x4f, 0x75, 0xa5, 0x0b, 0xfd, 0x2a, 0xe5, - 0x9d, 0x57, 0x42, 0xbf, 0x9e, 0x65, 0x10, 0x2a, 0x08, 0xe0, 0x21, 0x07, 0x54, 0xec, 0x0f, 0xad, - 0x5f, 0x08, 0xae, 0x6c, 0xf2, 0x9b, 0x74, 0xbf, 0xf4, 0x5b, 0x9e, 0x59, 0xc7, 0xbb, 0x94, 0x77, - 0x20, 0x86, 0xb5, 0x40, 0xb3, 0xac, 0x4b, 0xad, 0x31, 0x4f, 0x04, 0x4c, 0xec, 0x4f, 0x07, 0x74, - 0x86, 0x67, 0xc7, 0xb4, 0x3e, 0x02, 0x15, 0xda, 0x91, 0xd6, 0x39, 0x5e, 0x15, 0xdb, 0xcc, 0xdb, - 0x70, 0x43, 0x08, 0x27, 0x90, 0x0d, 0x9a, 0xcb, 0x75, 0xbb, 0xb6, 0x5a, 0xb7, 0x49, 0xa0, 0x1d, - 0xec, 0x9c, 0x5a, 0xd7, 0x3a, 0x9a, 0x1d, 0x6b, 0x6f, 0xe7, 0xa3, 0x57, 0xb3, 0x3c, 0x0e, 0x15, - 0x97, 0x62, 0xaf, 0x87, 0xf1, 0x0e, 0x3e, 0xd3, 0xc6, 0x08, 0x10, 0xc3, 0x04, 0x3a, 0x48, 0x5b, - 0x55, 0x56, 0x4c, 0xa5, 0x40, 0x60, 0xff, 0x68, 0xf3, 0x4a, 0x60, 0x19, 0xe4, 0x50, 0xe0, 0xad, - 0x62, 0x13, 0x3a, 0x00, 0xcc, 0xef, 0xd5, 0xe1, 0xd0, 0x25, 0xbf, 0x33, 0xb4, 0x3f, 0xa4, 0x8d, - 0x71, 0xa9, 0x62, 0xa7, 0xd4, 0x2a, 0xe7, 0xb3, 0x9f, 0x5b, 0xe7, 0xbb, 0xcf, 0x77, 0x7e, 0xed, - 0xe1, 0xe5, 0xa2, 0x5d, 0xf2, 0x9f, 0x0c, 0x4e, 0x96, 0x85, 0x4b, 0x56, 0x85, 0x4b, 0x9e, 0x0a, - 0x97, 0x3c, 0x17, 0x2e, 0x79, 0x7c, 0x71, 0x6b, 0x37, 0x7f, 0x77, 0x0e, 0x2e, 0x30, 0x8d, 0xe3, - 0xde, 0x04, 0xe6, 0xbe, 0x00, 0x39, 0xc5, 0x5e, 0x98, 0x72, 0xdf, 0x34, 0x8c, 0x2c, 0x7d, 0xf0, - 0xa3, 0xb7, 0x00, 0x00, 0x00, 0xff, 0xff, 0xfb, 0x22, 0x92, 0x20, 0x80, 0x02, 0x00, 0x00, + // 385 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x52, 0x3f, 0x6f, 0xe2, 0x30, + 0x14, 0xc7, 0x08, 0x05, 0xce, 0xa7, 0x43, 0x3a, 0xdf, 0xbf, 0x28, 0x43, 0x38, 0xa1, 0xd3, 0x89, + 0xe1, 0x48, 0x4e, 0x74, 0xe9, 0xd2, 0xa1, 0xb4, 0xaa, 0x60, 0xa0, 0x42, 0xa1, 0xed, 0xd0, 0x2d, + 0x09, 0x8f, 0xd4, 0x6a, 0xb1, 0xd3, 0xd8, 0x41, 0xe2, 0x9b, 0xf4, 0x33, 0xf4, 0x93, 0x30, 0x32, + 0x76, 0x42, 0x55, 0xba, 0xf5, 0x53, 0x54, 0x38, 0x0e, 0xa2, 0x45, 0x6c, 0x7e, 0xbf, 0x3f, 0xef, + 0xbd, 0x9f, 0x6d, 0xfc, 0x43, 0x80, 0x10, 0x94, 0x33, 0x57, 0x40, 0x32, 0xa3, 0x21, 0x38, 0x71, + 0xc2, 0x25, 0x27, 0x55, 0x0d, 0x5b, 0xdf, 0x0a, 0x5e, 0xce, 0x63, 0x10, 0x39, 0x6b, 0x11, 0x2d, + 0x76, 0xa7, 0x20, 0x7d, 0x8d, 0x7d, 0x2f, 0xb0, 0x19, 0x24, 0x74, 0x32, 0xd7, 0x68, 0x3b, 0xa2, + 0xf2, 0x26, 0x0d, 0x9c, 0x90, 0x4f, 0xdd, 0x88, 0x47, 0xdc, 0x55, 0x70, 0x90, 0x4e, 0x54, 0xa5, + 0x0a, 0x75, 0xca, 0xe5, 0xcd, 0x57, 0x84, 0xbf, 0x9c, 0x24, 0xe0, 0x4b, 0xf0, 0xe0, 0x3e, 0x05, + 0x21, 0xc9, 0x1f, 0x5c, 0xe9, 0x33, 0x2a, 0x4d, 0xf4, 0x1b, 0xb5, 0x3e, 0x77, 0xea, 0x8e, 0x5e, + 0xc7, 0xb9, 0xe0, 0xb7, 0xc0, 0x7a, 0x25, 0x4f, 0xb1, 0xa4, 0x85, 0x8d, 0x11, 0x8d, 0x18, 0x8c, + 0xcd, 0xf2, 0x1e, 0x9d, 0xe6, 0xc9, 0x21, 0xae, 0x0c, 0x40, 0xfa, 0x66, 0xa0, 0x74, 0x96, 0x53, + 0xc4, 0xd6, 0xf3, 0xd6, 0x5c, 0x0f, 0xfc, 0x31, 0x24, 0xdd, 0xda, 0x62, 0xd5, 0x28, 0x2d, 0x57, + 0x0d, 0xe4, 0x29, 0x07, 0x39, 0xc5, 0xc6, 0x95, 0x8a, 0x66, 0x86, 0xca, 0xdb, 0xfc, 0xe8, 0x55, + 0x2c, 0x0d, 0x7d, 0x49, 0x39, 0xdb, 0xe9, 0xa1, 0xbd, 0xdd, 0x4f, 0xb8, 0x3a, 0x00, 0x21, 0xfc, + 0x08, 0x9a, 0x02, 0xd7, 0x8b, 0xac, 0x22, 0xe6, 0x4c, 0x00, 0xf9, 0x87, 0x6b, 0x97, 0x4c, 0xe4, + 0x41, 0xf6, 0x05, 0xde, 0x28, 0xd6, 0xa1, 0x3d, 0x10, 0xe9, 0x9d, 0xdc, 0x1f, 0x3a, 0xe7, 0xb7, + 0x86, 0x76, 0x7a, 0xb8, 0x3a, 0xca, 0x55, 0xe4, 0x08, 0x1b, 0xf9, 0x7c, 0xf2, 0x73, 0xe3, 0x7c, + 0x77, 0xf9, 0xd6, 0xaf, 0x1d, 0x3c, 0x5f, 0xb4, 0x85, 0xfe, 0xa3, 0xee, 0x70, 0x91, 0xd9, 0x68, + 0x99, 0xd9, 0xe8, 0x29, 0xb3, 0xd1, 0x73, 0x66, 0xa3, 0x87, 0x17, 0xbb, 0x74, 0xfd, 0x77, 0xeb, + 0xc1, 0x99, 0x88, 0xc3, 0xb0, 0x3d, 0x86, 0x99, 0xcb, 0x80, 0x4f, 0x44, 0xdb, 0x8f, 0xa9, 0xab, + 0x1b, 0x3e, 0x96, 0xbf, 0x9e, 0x03, 0x3f, 0x1b, 0x39, 0xc7, 0xc3, 0xbe, 0xa3, 0x17, 0x0a, 0x0c, + 0xf5, 0x09, 0x0e, 0xde, 0x02, 0x00, 0x00, 0xff, 0xff, 0xd9, 0x56, 0x19, 0xd1, 0x94, 0x02, 0x00, + 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/session/service.proto b/session/service.proto index 95ea9c5..2c96a3e 100644 --- a/session/service.proto +++ b/session/service.proto @@ -1,6 +1,7 @@ syntax = "proto3"; package session; option go_package = "github.com/nspcc-dev/neofs-api/session"; +option csharp_namespace = "NeoFS.API.Session"; import "session/types.proto"; import "service/meta.proto"; diff --git a/session/types.pb.go b/session/types.pb.go index e27f0c6..81e3a86 100644 --- a/session/types.pb.go +++ b/session/types.pb.go @@ -171,30 +171,31 @@ func init() { func init() { proto.RegisterFile("session/types.proto", fileDescriptor_c0d9d9cb855cdad8) } var fileDescriptor_c0d9d9cb855cdad8 = []byte{ - // 360 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x91, 0xcf, 0x4a, 0xeb, 0x40, - 0x14, 0xc6, 0x9b, 0xf4, 0xef, 0x9d, 0x5b, 0xb8, 0x97, 0x71, 0x13, 0x54, 0xd2, 0xd2, 0x85, 0x54, - 0xb0, 0x09, 0xe8, 0x4a, 0x70, 0x15, 0xa2, 0x18, 0x2a, 0x54, 0x46, 0xe9, 0xc2, 0x5d, 0x32, 0x9d, - 0xa6, 0xe3, 0x9f, 0x99, 0x90, 0x99, 0x28, 0x7d, 0x13, 0x1f, 0xc5, 0x47, 0xe8, 0xd2, 0xa5, 0xb8, - 0x28, 0x12, 0x5f, 0x44, 0x32, 0x49, 0xd3, 0x16, 0x77, 0x67, 0x7e, 0xdf, 0xcc, 0xf9, 0xce, 0x7c, - 0x07, 0xec, 0x08, 0x22, 0x04, 0xe5, 0xcc, 0x96, 0xf3, 0x88, 0x08, 0x2b, 0x8a, 0xb9, 0xe4, 0xb0, - 0x59, 0xc0, 0xdd, 0x41, 0x48, 0xe5, 0x2c, 0x09, 0x2c, 0xcc, 0x9f, 0xec, 0x90, 0x87, 0xdc, 0x56, - 0x7a, 0x90, 0x4c, 0xd5, 0x49, 0x1d, 0x54, 0x95, 0xbf, 0xeb, 0x8d, 0x01, 0x1c, 0x93, 0x98, 0x4e, - 0x29, 0xf6, 0x25, 0xe5, 0xec, 0x92, 0xf8, 0x13, 0x12, 0xc3, 0x7d, 0xf0, 0xe7, 0x3a, 0x09, 0x1e, - 0x29, 0x1e, 0x92, 0xb9, 0xa1, 0x75, 0xb5, 0x7e, 0x1b, 0xad, 0x01, 0xec, 0x81, 0xf6, 0x90, 0xcc, - 0x6f, 0x68, 0xc8, 0x7c, 0x99, 0xc4, 0xc4, 0xd0, 0xd5, 0x85, 0x2d, 0xd6, 0x7b, 0xd3, 0x41, 0xfd, - 0x96, 0x3f, 0x10, 0x06, 0x4f, 0x41, 0x23, 0xef, 0xaa, 0x1a, 0xfd, 0x3d, 0xde, 0xb3, 0x8a, 0x51, - 0xad, 0xdf, 0xc6, 0x4e, 0x6d, 0xb1, 0xec, 0x54, 0x50, 0xf1, 0x00, 0x1e, 0x82, 0xe6, 0xe8, 0x85, - 0x91, 0xd8, 0x73, 0x73, 0x0f, 0xe7, 0x5f, 0x26, 0x7f, 0x2e, 0x3b, 0x2b, 0x8c, 0x56, 0x05, 0x34, - 0x01, 0xb8, 0xa0, 0xb1, 0x90, 0xe7, 0x11, 0xc7, 0x33, 0xa3, 0xda, 0xd5, 0xfa, 0x35, 0xb4, 0x41, - 0xb2, 0x1f, 0x5d, 0xf9, 0x2b, 0xb9, 0xa6, 0xe4, 0x35, 0x80, 0x47, 0xa0, 0x35, 0x0a, 0xee, 0x09, - 0x96, 0x9e, 0x6b, 0xd4, 0xbb, 0xd5, 0x7e, 0xdb, 0xf9, 0x5f, 0x38, 0x95, 0x1c, 0x95, 0x55, 0xd6, - 0x6b, 0xfd, 0xf9, 0x46, 0x9e, 0x4e, 0x09, 0x60, 0x07, 0xe8, 0x9e, 0x6b, 0x34, 0xb7, 0xe7, 0x55, - 0x51, 0x78, 0x2e, 0xd2, 0xf3, 0x51, 0xcb, 0x2c, 0x85, 0xd1, 0xca, 0xec, 0xd0, 0x06, 0x71, 0xce, - 0x16, 0xa9, 0xa9, 0xbd, 0xa7, 0xa6, 0xf6, 0x91, 0x9a, 0xda, 0x57, 0x6a, 0x6a, 0xaf, 0xdf, 0x66, - 0xe5, 0xee, 0x60, 0x63, 0xaf, 0x4c, 0x44, 0x18, 0x0f, 0x26, 0xe4, 0xd9, 0x66, 0x84, 0x4f, 0xc5, - 0xc0, 0x8f, 0xa8, 0x5d, 0x84, 0x1a, 0x34, 0xd4, 0x5e, 0x4f, 0x7e, 0x02, 0x00, 0x00, 0xff, 0xff, - 0xb8, 0x9f, 0x2d, 0x1d, 0x26, 0x02, 0x00, 0x00, + // 373 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x91, 0xcd, 0x4e, 0xc2, 0x40, + 0x14, 0x85, 0x69, 0xf9, 0x75, 0x24, 0x51, 0xc7, 0x4d, 0xa3, 0xa6, 0x10, 0x16, 0x06, 0x13, 0x69, + 0x13, 0x5d, 0xb9, 0xb4, 0xa9, 0xc4, 0x06, 0x23, 0xa4, 0x18, 0x16, 0xee, 0xda, 0x72, 0x29, 0xe3, + 0x4f, 0xa7, 0xe9, 0xb4, 0x1a, 0xde, 0xc4, 0x67, 0xf0, 0x09, 0x7c, 0x04, 0x96, 0x2e, 0x8d, 0x0b, + 0x62, 0xea, 0x8b, 0x98, 0x4e, 0x4b, 0x81, 0xb8, 0xbb, 0xf3, 0x9d, 0x99, 0x7b, 0xee, 0x9c, 0x8b, + 0xf6, 0x19, 0x30, 0x46, 0xa8, 0xa7, 0x86, 0x33, 0x1f, 0x98, 0xe2, 0x07, 0x34, 0xa4, 0xb8, 0x9a, + 0xc1, 0x83, 0x8e, 0x4b, 0xc2, 0x69, 0x64, 0x2b, 0x0e, 0x7d, 0x56, 0x5d, 0xea, 0x52, 0x95, 0xeb, + 0x76, 0x34, 0xe1, 0x27, 0x7e, 0xe0, 0x55, 0xfa, 0xae, 0x35, 0x42, 0x78, 0x04, 0x01, 0x99, 0x10, + 0xc7, 0x0a, 0x09, 0xf5, 0xae, 0xc1, 0x1a, 0x43, 0x80, 0x8f, 0xd0, 0xd6, 0x20, 0xb2, 0x9f, 0x88, + 0xd3, 0x83, 0x99, 0x24, 0x34, 0x85, 0x76, 0xdd, 0x5c, 0x01, 0xdc, 0x42, 0xf5, 0x1e, 0xcc, 0x86, + 0xc4, 0xf5, 0xac, 0x30, 0x0a, 0x40, 0x12, 0xf9, 0x85, 0x0d, 0xd6, 0xfa, 0x10, 0x51, 0xf9, 0x8e, + 0x3e, 0x82, 0x87, 0x2f, 0x50, 0x25, 0xed, 0xca, 0x1b, 0x6d, 0x9f, 0x1d, 0x2a, 0xd9, 0xa8, 0xca, + 0x7f, 0x63, 0xad, 0x34, 0x5f, 0x34, 0x0a, 0x66, 0xf6, 0x00, 0x9f, 0xa0, 0x6a, 0xff, 0xd5, 0x83, + 0xc0, 0xd0, 0x53, 0x0f, 0x6d, 0x27, 0x91, 0xbf, 0x17, 0x8d, 0x25, 0x36, 0x97, 0x05, 0x96, 0x11, + 0xea, 0x92, 0x80, 0x85, 0x57, 0x3e, 0x75, 0xa6, 0x52, 0xb1, 0x29, 0xb4, 0x4b, 0xe6, 0x1a, 0x49, + 0x7e, 0x74, 0x63, 0x2d, 0xe5, 0x12, 0x97, 0x57, 0x00, 0x9f, 0xa2, 0x5a, 0xdf, 0x7e, 0x00, 0x27, + 0x34, 0x74, 0xa9, 0xdc, 0x2c, 0xb6, 0xeb, 0xda, 0x6e, 0xe6, 0x94, 0x73, 0x33, 0xaf, 0x92, 0x5e, + 0xab, 0xcf, 0x57, 0xd2, 0x74, 0x72, 0x80, 0x1b, 0x48, 0x34, 0x74, 0xa9, 0xba, 0x39, 0x2f, 0x8f, + 0xc2, 0xd0, 0x4d, 0x31, 0x1d, 0x35, 0xcf, 0x92, 0x49, 0xb5, 0xc4, 0xce, 0x5c, 0x23, 0xda, 0x60, + 0x1e, 0xcb, 0xc2, 0x67, 0x2c, 0x0b, 0x5f, 0xb1, 0x2c, 0xfc, 0xc4, 0xb2, 0xf0, 0xf6, 0x2b, 0x17, + 0xee, 0x8f, 0xd7, 0xf6, 0xea, 0x31, 0xdf, 0x71, 0x3a, 0x63, 0x78, 0x51, 0x3d, 0xa0, 0x13, 0xd6, + 0xb1, 0x7c, 0xa2, 0x66, 0xa1, 0xbe, 0x8b, 0x7b, 0xb7, 0x40, 0xbb, 0x43, 0xe5, 0x72, 0x60, 0x28, + 0xc3, 0x94, 0xd9, 0x15, 0xbe, 0xeb, 0xf3, 0xbf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x20, 0x10, 0x09, + 0xd3, 0x3a, 0x02, 0x00, 0x00, } func (m *VerificationHeader) Marshal() (dAtA []byte, err error) { diff --git a/session/types.proto b/session/types.proto index 79b24ff..0cf1583 100644 --- a/session/types.proto +++ b/session/types.proto @@ -1,6 +1,7 @@ syntax = "proto3"; package session; option go_package = "github.com/nspcc-dev/neofs-api/session"; +option csharp_namespace = "NeoFS.API.Session"; import "github.com/gogo/protobuf/gogoproto/gogo.proto"; diff --git a/state/service.pb.go b/state/service.pb.go index 62f5f4e..f1e08de 100644 --- a/state/service.pb.go +++ b/state/service.pb.go @@ -347,36 +347,37 @@ func init() { func init() { proto.RegisterFile("state/service.proto", fileDescriptor_695592f6f2fc97b7) } var fileDescriptor_695592f6f2fc97b7 = []byte{ - // 461 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x94, 0xcf, 0x6e, 0xd3, 0x40, - 0x10, 0xc6, 0xbb, 0xfc, 0x31, 0x65, 0x12, 0x8a, 0xb4, 0x4d, 0x22, 0xcb, 0x07, 0x37, 0x8a, 0x10, - 0x8a, 0x84, 0x62, 0x4b, 0x05, 0xa4, 0xaa, 0xc7, 0xb4, 0x87, 0x5e, 0xc2, 0xc1, 0x95, 0x38, 0x70, - 0x5b, 0x3b, 0x93, 0xc4, 0x82, 0x78, 0x17, 0xef, 0x38, 0x52, 0x1e, 0x02, 0xc1, 0x91, 0x47, 0xea, - 0xb1, 0x47, 0x4e, 0x15, 0x0a, 0x47, 0x5e, 0x02, 0x75, 0x77, 0x1d, 0x92, 0xf4, 0x05, 0x72, 0xcb, - 0xf7, 0x1b, 0x7f, 0x9b, 0x6f, 0x76, 0x67, 0x17, 0x8e, 0x35, 0x09, 0xc2, 0x58, 0x63, 0xb9, 0xc8, - 0x33, 0x8c, 0x54, 0x29, 0x49, 0xf2, 0xa7, 0x06, 0x06, 0xdc, 0xd1, 0x78, 0x8e, 0x24, 0x6c, 0x29, - 0x68, 0xd5, 0x6c, 0x81, 0x65, 0x3e, 0x59, 0x3a, 0xda, 0x4e, 0xa5, 0x24, 0x4d, 0xa5, 0x50, 0x31, - 0x2d, 0x15, 0x6a, 0x87, 0x07, 0xd3, 0x9c, 0x66, 0x55, 0x1a, 0x65, 0x72, 0x1e, 0x4f, 0xe5, 0x54, - 0xc6, 0x06, 0xa7, 0xd5, 0xc4, 0x28, 0x23, 0xcc, 0x2f, 0xfb, 0x79, 0xef, 0x3b, 0x83, 0x17, 0x1f, - 0x90, 0xe6, 0x42, 0x25, 0xf8, 0xb5, 0x42, 0x4d, 0xfc, 0x0c, 0x9e, 0x8c, 0x90, 0x84, 0x9f, 0x76, - 0x59, 0xbf, 0x71, 0x1a, 0x44, 0x75, 0x4c, 0x57, 0xbf, 0xaf, 0x5d, 0xa1, 0x18, 0x63, 0x39, 0x3c, - 0xbc, 0xb9, 0x3b, 0x39, 0xb8, 0xbd, 0x3b, 0x61, 0x89, 0x71, 0xf0, 0x4b, 0xf0, 0x3e, 0x9a, 0x84, - 0x7e, 0x66, 0xbc, 0xbd, 0x5d, 0xaf, 0xa9, 0xe6, 0x99, 0xa0, 0x5c, 0x16, 0x0f, 0xd6, 0x70, 0xde, - 0xde, 0x0f, 0x06, 0x47, 0x23, 0xa4, 0x32, 0xcf, 0xf4, 0xbe, 0x44, 0x7a, 0x03, 0x2f, 0xd7, 0x89, - 0xb4, 0x92, 0x85, 0x46, 0xee, 0xc3, 0x33, 0x87, 0x7c, 0xd6, 0x7d, 0xdc, 0x6f, 0x26, 0xb5, 0x34, - 0x3b, 0x7a, 0x85, 0xe2, 0x0b, 0xcd, 0xf6, 0x25, 0xfe, 0x10, 0x8e, 0xea, 0x40, 0xff, 0xd3, 0x5b, - 0xb2, 0xf4, 0x59, 0x97, 0xf5, 0x0f, 0x93, 0x5a, 0xf2, 0x0e, 0x78, 0xd7, 0x24, 0xa8, 0xd2, 0xfe, - 0xa3, 0x2e, 0xeb, 0x3f, 0x4f, 0x9c, 0xea, 0x7d, 0x63, 0xd0, 0xb8, 0xac, 0xe6, 0x7b, 0x33, 0x25, - 0xaf, 0xa1, 0x69, 0xe3, 0xb8, 0x8e, 0x3a, 0xe0, 0x5d, 0xc8, 0x62, 0x92, 0x4f, 0x4d, 0x43, 0xcd, - 0xc4, 0xa9, 0xd3, 0xbf, 0xac, 0x6e, 0x88, 0xbf, 0x03, 0xcf, 0x4e, 0x3a, 0x6f, 0x45, 0xe6, 0xb2, - 0x45, 0x5b, 0x83, 0x1f, 0xb4, 0xa2, 0xf5, 0x8d, 0x8a, 0xae, 0x55, 0x89, 0x62, 0x3c, 0x12, 0x8a, - 0x9f, 0xad, 0x0f, 0x9a, 0xb7, 0x9d, 0x6d, 0x7b, 0x3a, 0x83, 0xce, 0x2e, 0x76, 0x91, 0xce, 0xa1, - 0x61, 0x77, 0xf5, 0x62, 0x86, 0xd9, 0xe7, 0xf5, 0x9f, 0x6e, 0xcd, 0x46, 0xd0, 0xde, 0xa1, 0xce, - 0xfb, 0x1e, 0xe0, 0xbe, 0x3d, 0xdb, 0x04, 0xe7, 0xee, 0xa3, 0x8d, 0x03, 0x08, 0x8e, 0xb7, 0x98, - 0xb5, 0x0d, 0xcf, 0x6f, 0x56, 0x21, 0xbb, 0x5d, 0x85, 0xec, 0xd7, 0x2a, 0x64, 0xbf, 0x57, 0x21, - 0xfb, 0xf9, 0x27, 0x3c, 0xf8, 0xf4, 0x6a, 0xe3, 0x49, 0x28, 0xb4, 0xca, 0xb2, 0xc1, 0x18, 0x17, - 0x71, 0x81, 0x72, 0xa2, 0x07, 0x42, 0xe5, 0xb1, 0x59, 0x28, 0xf5, 0xcc, 0x83, 0xf0, 0xf6, 0x5f, - 0x00, 0x00, 0x00, 0xff, 0xff, 0x32, 0x55, 0xc1, 0x4b, 0x9e, 0x04, 0x00, 0x00, + // 478 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x94, 0x41, 0x6f, 0xd3, 0x30, + 0x14, 0xc7, 0xe7, 0x01, 0x61, 0xb8, 0x65, 0x93, 0xbc, 0xb6, 0x8a, 0x72, 0xc8, 0xaa, 0x0a, 0xa1, + 0x4a, 0xa8, 0x8e, 0x34, 0x40, 0x9a, 0xb8, 0xd1, 0x4d, 0x68, 0x48, 0x74, 0x42, 0xa9, 0xc4, 0x81, + 0x9b, 0x93, 0xbe, 0xb6, 0x11, 0x34, 0x36, 0xf1, 0x4b, 0xa5, 0x7e, 0x08, 0x04, 0x47, 0x3e, 0x03, + 0x9f, 0x64, 0xc7, 0x1d, 0x39, 0x4d, 0xa8, 0x1c, 0xf9, 0x12, 0xa8, 0x8e, 0x53, 0x9a, 0xee, 0x0b, + 0xf4, 0x96, 0xf7, 0x7b, 0xfe, 0x3b, 0xff, 0xf7, 0xfc, 0x6c, 0x7a, 0xac, 0x51, 0x20, 0x04, 0x1a, + 0xb2, 0x79, 0x12, 0x03, 0x57, 0x99, 0x44, 0xc9, 0x1e, 0x18, 0xe8, 0x31, 0x4b, 0x83, 0x19, 0xa0, + 0x28, 0x52, 0x5e, 0xa3, 0x64, 0x73, 0xc8, 0x92, 0xf1, 0xc2, 0xd2, 0x66, 0x24, 0x25, 0x6a, 0xcc, + 0x84, 0x0a, 0x70, 0xa1, 0x40, 0x5b, 0xdc, 0x9b, 0x24, 0x38, 0xcd, 0x23, 0x1e, 0xcb, 0x59, 0x30, + 0x91, 0x13, 0x19, 0x18, 0x1c, 0xe5, 0x63, 0x13, 0x99, 0xc0, 0x7c, 0x15, 0xcb, 0x3b, 0xdf, 0x08, + 0x7d, 0x7c, 0x05, 0x38, 0x13, 0x2a, 0x84, 0x2f, 0x39, 0x68, 0x64, 0x67, 0xf4, 0xfe, 0x00, 0x50, + 0xb8, 0x51, 0x9b, 0x74, 0x6b, 0xa7, 0x1e, 0x2f, 0x6d, 0xda, 0xfc, 0x2a, 0x77, 0x09, 0x62, 0x04, + 0x59, 0xff, 0xe0, 0xfa, 0xf6, 0x64, 0xef, 0xe6, 0xf6, 0x84, 0x84, 0x46, 0xc1, 0x2e, 0xa8, 0xf3, + 0xc1, 0x38, 0x74, 0x63, 0xa3, 0xed, 0x6c, 0x6b, 0x4d, 0x36, 0x89, 0x05, 0x26, 0x32, 0xbd, 0xb3, + 0x87, 0xd5, 0x76, 0xbe, 0x13, 0x7a, 0x38, 0x00, 0xcc, 0x92, 0x58, 0xef, 0x8a, 0xa5, 0x67, 0xf4, + 0x68, 0xed, 0x48, 0x2b, 0x99, 0x6a, 0x60, 0x2e, 0x7d, 0x68, 0x91, 0x4b, 0xda, 0xf7, 0xba, 0xf5, + 0xb0, 0x0c, 0x4d, 0x47, 0x2f, 0x41, 0x7c, 0xc6, 0xe9, 0xae, 0xd8, 0xef, 0xd3, 0xc3, 0xd2, 0xd0, + 0x7f, 0xf7, 0x05, 0x59, 0xb8, 0xa4, 0x4d, 0xba, 0x07, 0x61, 0x19, 0xb2, 0x16, 0x75, 0x86, 0x28, + 0x30, 0xd7, 0xee, 0x7e, 0x9b, 0x74, 0x1f, 0x85, 0x36, 0xea, 0x7c, 0x25, 0xb4, 0x76, 0x91, 0xcf, + 0x76, 0x66, 0x4a, 0x9e, 0xd2, 0x7a, 0x61, 0xc7, 0x56, 0xd4, 0xa2, 0xce, 0xb9, 0x4c, 0xc7, 0xc9, + 0xc4, 0x14, 0x54, 0x0f, 0x6d, 0x74, 0xfa, 0x97, 0x94, 0x05, 0xb1, 0x17, 0xd4, 0x29, 0x26, 0x9d, + 0x35, 0xb8, 0xb9, 0x6c, 0xbc, 0x32, 0xf8, 0x5e, 0x83, 0xaf, 0x6f, 0x14, 0x1f, 0xaa, 0x0c, 0xc4, + 0x68, 0x20, 0x14, 0x3b, 0x5b, 0x1f, 0x34, 0x6b, 0x5a, 0x59, 0x75, 0x3a, 0xbd, 0xd6, 0x36, 0xb6, + 0x96, 0x5e, 0xd1, 0x5a, 0xd1, 0xd5, 0xf3, 0x29, 0xc4, 0x9f, 0xd6, 0x3f, 0xad, 0xcc, 0x86, 0xd7, + 0xdc, 0xa2, 0x56, 0xfb, 0x92, 0xd2, 0x55, 0x79, 0x45, 0x11, 0x8c, 0xd9, 0x45, 0x1b, 0x07, 0xe0, + 0x1d, 0x57, 0x58, 0x21, 0xeb, 0xbf, 0xbb, 0x5e, 0xfa, 0xe4, 0x66, 0xe9, 0x93, 0x5f, 0x4b, 0x9f, + 0xfc, 0x5e, 0xfa, 0xe4, 0xc7, 0x1f, 0x7f, 0xef, 0xe3, 0x93, 0x8d, 0x27, 0x21, 0xd5, 0x2a, 0x8e, + 0x7b, 0x23, 0x98, 0x07, 0x29, 0xc8, 0xb1, 0xee, 0x09, 0x95, 0x04, 0x66, 0xa3, 0x9f, 0xfb, 0x47, + 0x57, 0x20, 0xdf, 0x0c, 0xf9, 0xeb, 0xf7, 0x6f, 0xf9, 0xaa, 0x63, 0x10, 0x39, 0xe6, 0x89, 0x78, + 0xfe, 0x2f, 0x00, 0x00, 0xff, 0xff, 0xd8, 0xe0, 0x18, 0xa7, 0xb0, 0x04, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/state/service.proto b/state/service.proto index 7966d43..312d465 100644 --- a/state/service.proto +++ b/state/service.proto @@ -1,6 +1,7 @@ syntax = "proto3"; package state; option go_package = "github.com/nspcc-dev/neofs-api/state"; +option csharp_namespace = "NeoFS.API.State"; import "service/meta.proto"; import "service/verify.proto"; diff --git a/storagegroup/types.pb.go b/storagegroup/types.pb.go index aae646a..46f736d 100644 --- a/storagegroup/types.pb.go +++ b/storagegroup/types.pb.go @@ -170,30 +170,31 @@ func init() { func init() { proto.RegisterFile("storagegroup/types.proto", fileDescriptor_cfa54edc899249a8) } var fileDescriptor_cfa54edc899249a8 = []byte{ - // 359 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x51, 0xb1, 0x4e, 0xe3, 0x40, - 0x14, 0xf4, 0x26, 0xbe, 0x93, 0x6f, 0xcf, 0x17, 0x45, 0xab, 0x2b, 0xac, 0x14, 0x76, 0x14, 0x1a, - 0x4b, 0x28, 0x6b, 0x29, 0xa1, 0xa2, 0xc3, 0x82, 0x40, 0x01, 0x14, 0x0e, 0x49, 0x41, 0xb7, 0x71, - 0x36, 0xce, 0x4a, 0xf6, 0xae, 0x15, 0xaf, 0x11, 0xf0, 0x25, 0x69, 0x90, 0xf8, 0x9c, 0x94, 0x94, - 0x88, 0xc2, 0x42, 0xa6, 0xe2, 0x2f, 0x50, 0x36, 0x10, 0x2c, 0x44, 0x41, 0xf7, 0x66, 0xde, 0xcc, - 0xd3, 0x3c, 0x0d, 0xb4, 0x32, 0x29, 0x16, 0x24, 0xa2, 0xd1, 0x42, 0xe4, 0xa9, 0x27, 0x6f, 0x52, - 0x9a, 0xe1, 0x74, 0x21, 0xa4, 0x40, 0x66, 0x75, 0xd3, 0xea, 0x46, 0x4c, 0xce, 0xf3, 0x09, 0x0e, - 0x45, 0xe2, 0x45, 0x22, 0x12, 0x9e, 0x12, 0x4d, 0xf2, 0x99, 0x42, 0x0a, 0xa8, 0x69, 0x63, 0xee, - 0xbc, 0xd6, 0xa0, 0x39, 0xdc, 0xf8, 0x8f, 0xd7, 0x7e, 0x84, 0x21, 0x1a, 0x93, 0x98, 0x4d, 0x89, - 0x64, 0x82, 0x1f, 0x12, 0x49, 0x86, 0xec, 0x96, 0x5a, 0xa0, 0x0d, 0x5c, 0x3d, 0xf8, 0x66, 0x83, - 0xf6, 0x60, 0xe3, 0x93, 0x3d, 0x21, 0xd9, 0xdc, 0xaa, 0xb5, 0x81, 0x6b, 0xfa, 0xe6, 0xaa, 0x70, - 0xb4, 0xa7, 0xc2, 0xd1, 0xd7, 0x5c, 0xf0, 0x45, 0x83, 0xce, 0xa0, 0x11, 0xb3, 0x19, 0x95, 0x2c, - 0xa1, 0x56, 0xbd, 0x0d, 0xdc, 0xbf, 0xbd, 0x1d, 0x5c, 0x7d, 0x03, 0x57, 0x33, 0xe1, 0xd3, 0x77, - 0xa9, 0x6f, 0x96, 0x85, 0x63, 0x7c, 0xa0, 0x60, 0x7b, 0xa2, 0x75, 0x07, 0xe0, 0x96, 0x46, 0x03, - 0xa8, 0xe7, 0x9c, 0x49, 0x95, 0xb9, 0xd1, 0x73, 0x7f, 0x70, 0x17, 0x8f, 0x38, 0x93, 0xbe, 0x51, - 0x16, 0x8e, 0xbe, 0x9e, 0x02, 0xe5, 0x47, 0xff, 0xe1, 0xaf, 0x31, 0x89, 0x73, 0xaa, 0x1e, 0xaa, - 0x07, 0x1b, 0xd0, 0xe9, 0x43, 0xa5, 0x41, 0xff, 0xe0, 0x9f, 0x11, 0x8f, 0x59, 0xc2, 0x24, 0x9d, - 0x36, 0x35, 0xd4, 0x80, 0xf0, 0x9c, 0x8a, 0xc1, 0xf0, 0x28, 0x15, 0xe1, 0xbc, 0x09, 0x90, 0x09, - 0x8d, 0x11, 0x67, 0xd7, 0x17, 0x2c, 0xa1, 0xcd, 0xda, 0xbe, 0xbe, 0xbc, 0x77, 0x34, 0xff, 0x60, - 0x55, 0xda, 0xe0, 0xa1, 0xb4, 0xc1, 0x63, 0x69, 0x83, 0xe7, 0xd2, 0x06, 0xcb, 0x17, 0x5b, 0xbb, - 0xdc, 0xad, 0x14, 0xc6, 0xb3, 0x34, 0x0c, 0xbb, 0x53, 0x7a, 0xe5, 0x71, 0x2a, 0x66, 0x59, 0x97, - 0xa4, 0xcc, 0xab, 0xc6, 0x9f, 0xfc, 0x56, 0xad, 0xf5, 0xdf, 0x02, 0x00, 0x00, 0xff, 0xff, 0x74, - 0xed, 0x88, 0xb3, 0x0e, 0x02, 0x00, 0x00, + // 374 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x51, 0x41, 0x4b, 0xe3, 0x40, + 0x18, 0xcd, 0xa4, 0xd9, 0x25, 0x3b, 0x9b, 0x2d, 0x65, 0x58, 0x96, 0xd0, 0x43, 0x52, 0xba, 0x97, + 0xc0, 0xd2, 0x09, 0xb4, 0x7b, 0xda, 0xdb, 0x86, 0xdd, 0xaa, 0xa0, 0x22, 0xa9, 0xed, 0xa1, 0xb7, + 0x69, 0x3a, 0x4d, 0x07, 0x92, 0x4c, 0x68, 0x26, 0xa2, 0xfe, 0x92, 0x5e, 0x04, 0xcf, 0xfe, 0x92, + 0x1e, 0x3d, 0x8a, 0x87, 0x20, 0xf1, 0xe4, 0xbf, 0x90, 0x4e, 0xb5, 0x46, 0xf1, 0xe0, 0x6d, 0xde, + 0xfb, 0xde, 0xfb, 0xe6, 0x3d, 0x3e, 0x68, 0x66, 0x82, 0x2f, 0x48, 0x48, 0xc3, 0x05, 0xcf, 0x53, + 0x57, 0x9c, 0xa5, 0x34, 0xc3, 0xe9, 0x82, 0x0b, 0x8e, 0x8c, 0xea, 0xa4, 0xd9, 0x09, 0x99, 0x98, + 0xe7, 0x13, 0x1c, 0xf0, 0xd8, 0x0d, 0x79, 0xc8, 0x5d, 0x29, 0x9a, 0xe4, 0x33, 0x89, 0x24, 0x90, + 0xaf, 0x8d, 0xb9, 0xfd, 0xa0, 0x42, 0x63, 0xb0, 0xf1, 0xef, 0xac, 0xfd, 0x08, 0x43, 0x34, 0x22, + 0x11, 0x9b, 0x12, 0xc1, 0x78, 0xf2, 0x8f, 0x08, 0x32, 0x60, 0xe7, 0xd4, 0x04, 0x2d, 0xe0, 0x68, + 0xfe, 0x3b, 0x13, 0xf4, 0x1b, 0xd6, 0x5f, 0xd8, 0x5d, 0x92, 0xcd, 0x4d, 0xb5, 0x05, 0x1c, 0xc3, + 0x33, 0x56, 0x85, 0xad, 0xdc, 0x16, 0xb6, 0xb6, 0xe6, 0xfc, 0x37, 0x1a, 0x74, 0x00, 0xf5, 0x88, + 0xcd, 0xa8, 0x60, 0x31, 0x35, 0x6b, 0x2d, 0xe0, 0x7c, 0xed, 0xfe, 0xc4, 0xd5, 0x1a, 0xb8, 0x9a, + 0x09, 0xef, 0x3f, 0x49, 0x3d, 0xa3, 0x2c, 0x6c, 0xfd, 0x19, 0xf9, 0xdb, 0x15, 0xcd, 0x0b, 0x00, + 0xb7, 0x34, 0xea, 0x43, 0x2d, 0x4f, 0x98, 0x90, 0x99, 0xeb, 0x5d, 0xe7, 0x03, 0x7b, 0xf1, 0x30, + 0x61, 0xc2, 0xd3, 0xcb, 0xc2, 0xd6, 0xd6, 0x2f, 0x5f, 0xfa, 0xd1, 0x77, 0xf8, 0x69, 0x44, 0xa2, + 0x9c, 0xca, 0x42, 0x35, 0x7f, 0x03, 0xda, 0x3d, 0x28, 0x35, 0xe8, 0x1b, 0xfc, 0x32, 0x4c, 0x22, + 0x16, 0x33, 0x41, 0xa7, 0x0d, 0x05, 0xd5, 0x21, 0x3c, 0xa4, 0xbc, 0x3f, 0xf8, 0x9f, 0xf2, 0x60, + 0xde, 0x00, 0xc8, 0x80, 0xfa, 0x30, 0x61, 0xa7, 0xc7, 0x2c, 0xa6, 0x0d, 0xf5, 0x8f, 0xb6, 0xbc, + 0xb4, 0x15, 0x6f, 0xbc, 0x2a, 0x2d, 0x70, 0x5d, 0x5a, 0xe0, 0xa6, 0xb4, 0xc0, 0x5d, 0x69, 0x81, + 0xe5, 0xbd, 0xa5, 0x8c, 0x7f, 0x55, 0x0e, 0x96, 0x64, 0x69, 0x10, 0x74, 0xa6, 0xf4, 0xc4, 0x4d, + 0x28, 0x9f, 0x65, 0x1d, 0x92, 0x32, 0xb7, 0x1a, 0xff, 0x4a, 0xfd, 0x21, 0x7f, 0xc1, 0x7f, 0x8f, + 0xf6, 0x5e, 0x55, 0x99, 0x7c, 0x96, 0xe7, 0xec, 0x3d, 0x06, 0x00, 0x00, 0xff, 0xff, 0x79, 0x0c, + 0x52, 0x44, 0x27, 0x02, 0x00, 0x00, } func (m *StorageGroup) Marshal() (dAtA []byte, err error) { diff --git a/storagegroup/types.proto b/storagegroup/types.proto index 238b454..41a211f 100644 --- a/storagegroup/types.proto +++ b/storagegroup/types.proto @@ -1,6 +1,7 @@ syntax = "proto3"; package storagegroup; option go_package = "github.com/nspcc-dev/neofs-api/storagegroup"; +option csharp_namespace = "NeoFS.API.StorageGroup"; import "github.com/gogo/protobuf/gogoproto/gogo.proto"; From 86b1241e3e641de57f61d8e855d91c8308c81e95 Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Wed, 5 Feb 2020 17:20:17 +0300 Subject: [PATCH 0095/1196] CHANGELOG --- CHANGELOG.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f4d4864..7443632 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,25 @@ # Changelog This is the changelog for NeoFS Proto +## [0.3.0] - 2020-02-05 + +### Updated +- proto files +- dependencies + - github.com/golang/protobuf `v1.3.2 => v1.3.3` + - github.com/pkg/errors `v0.8.1 => v0.9.1` + - github.com/prometheus/client_golang `v1.2.1 => v1.4.0` + - github.com/prometheus/client_model `v0.0.0-20190812154241-14fe0d1b01d4 => v0.2.0` + - github.com/spf13/viper `v1.6.1 => v1.6.2` + - google.golang.org/grpc `v1.24.0 => v1.27.0` + +### Changed +- make object.GetRange to be server-side streaming RPC +- GetRange response struct + +### Added +- badges to readme + ## [0.2.14] - 2020-02-04 ### Fixed @@ -146,3 +165,4 @@ Initial public release [0.2.12]: https://github.com/nspcc-dev/neofs-api/compare/v0.2.11...v0.2.12 [0.2.13]: https://github.com/nspcc-dev/neofs-api/compare/v0.2.12...v0.2.13 [0.2.14]: https://github.com/nspcc-dev/neofs-api/compare/v0.2.13...v0.2.14 +[0.3.0]: https://github.com/nspcc-dev/neofs-api/compare/v0.2.14...v0.3.0 From 631787ccf7d5aaee5fc1aa9351b98c0a1f5cf412 Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Fri, 7 Feb 2020 17:16:25 +0300 Subject: [PATCH 0096/1196] Update dependencies - github.com/nspcc-dev/tzhash `v1.3.0 => v1.4.0` - github.com/prometheus/client_golang `v1.4.0 => v1.4.1` - google.golang.org/grpc `v1.27.0 => v1.27.1` --- go.mod | 6 +++--- go.sum | 10 ++++++---- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/go.mod b/go.mod index d5ec195..7882e96 100644 --- a/go.mod +++ b/go.mod @@ -9,14 +9,14 @@ require ( github.com/mr-tron/base58 v1.1.3 github.com/nspcc-dev/neofs-crypto v0.2.3 github.com/nspcc-dev/netmap v1.6.1 - github.com/nspcc-dev/tzhash v1.3.0 + github.com/nspcc-dev/tzhash v1.4.0 github.com/pkg/errors v0.9.1 - github.com/prometheus/client_golang v1.4.0 + github.com/prometheus/client_golang v1.4.1 github.com/prometheus/client_model v0.2.0 github.com/spf13/viper v1.6.2 github.com/stretchr/testify v1.4.0 golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550 - google.golang.org/grpc v1.27.0 + google.golang.org/grpc v1.27.1 ) // Used for debug reasons diff --git a/go.sum b/go.sum index 5ef748d..cec7f5d 100644 --- a/go.sum +++ b/go.sum @@ -118,8 +118,8 @@ github.com/nspcc-dev/netmap v1.6.1 h1:Pigqpqi6QSdRiusbq5XlO20A18k6Eyu7j9MzOfAE3C github.com/nspcc-dev/netmap v1.6.1/go.mod h1:mhV3UOg9ljQmu0teQShD6+JYX09XY5gu2I4hIByCH9M= github.com/nspcc-dev/rfc6979 v0.2.0 h1:3e1WNxrN60/6N0DW7+UYisLeZJyfqZTNOjeV/toYvOE= github.com/nspcc-dev/rfc6979 v0.2.0/go.mod h1:exhIh1PdpDC5vQmyEsGvc4YDM/lyQp/452QxGq/UEso= -github.com/nspcc-dev/tzhash v1.3.0 h1:n6FTHsfPYbMi5Jmo6SwGVVRQD8i2w1P2ScCaW6rz69Q= -github.com/nspcc-dev/tzhash v1.3.0/go.mod h1:Lc4DersKS8MNIrunTmsAzANO56qnG+LZ4GOE/WYGVzU= +github.com/nspcc-dev/tzhash v1.4.0 h1:RVIR+mxOBHl58CE99+DXtE31ylD5PEkZSoWqoj4fVjg= +github.com/nspcc-dev/tzhash v1.4.0/go.mod h1:Z8gp/VZbyWgPhaMp/KTmeoW5UTynp/N60g0jTtSzBws= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181zc= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= @@ -135,6 +135,7 @@ github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDf github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.4.0 h1:YVIb/fVcOTMSqtqZWSKnHpSLBxu8DKgxq8z6RuBZwqI= github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= +github.com/prometheus/client_golang v1.4.1/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4 h1:gQz4mCbXsO+nc9n1hCxHcGA3Zx3Eo+UHZoInFGUIXNM= @@ -223,6 +224,7 @@ golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20190412213103-97732733099d h1:+R4KGOnez64A81RvjARKc4UT5/tI9ujCIVX+P5KiHuI= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200122134326-e047566fdf82 h1:ywK/j/KkyTHcdyYSZNXGjMwgmDSfjglYZ3vStQ/gSCU= golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= @@ -246,8 +248,8 @@ google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98 google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.27.0 h1:rRYRFMVgRv6E0D70Skyfsr28tDXIuuPZyWGMPdMcnXg= -google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.27.1 h1:zvIju4sqAGvwKspUQOhwnpcqSbzi7/H6QomNNjTL4sk= +google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= gopkg.in/abiosoft/ishell.v2 v2.0.0/go.mod h1:sFp+cGtH6o4s1FtpVPTMcHq2yue+c4DGOVohJCPUzwY= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= From b73e54bb1d6c673d4338dbf63060d46d0adffd7a Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Fri, 7 Feb 2020 17:27:38 +0300 Subject: [PATCH 0097/1196] update go.sum --- go.sum | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/go.sum b/go.sum index cec7f5d..bb83093 100644 --- a/go.sum +++ b/go.sum @@ -133,8 +133,7 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= -github.com/prometheus/client_golang v1.4.0 h1:YVIb/fVcOTMSqtqZWSKnHpSLBxu8DKgxq8z6RuBZwqI= -github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= +github.com/prometheus/client_golang v1.4.1 h1:FFSuS004yOQEtDdTq+TAOLP5xUq63KqAFYyOi8zA+Y8= github.com/prometheus/client_golang v1.4.1/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= From 6fc5061c76281c9d554da020ae7b6074cea06f0b Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Fri, 7 Feb 2020 17:28:16 +0300 Subject: [PATCH 0098/1196] CHANGELOG --- CHANGELOG.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7443632..992ba8d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,16 @@ # Changelog This is the changelog for NeoFS Proto +## [0.3.1] - 2020-02-07 +### Fixed +- bug with `tz.Concat` + +### Updated +- dependencies: + - github.com/nspcc-dev/tzhash `v1.3.0 => v1.4.0` + - github.com/prometheus/client_golang `v1.4.0 => v1.4.1` + - google.golang.org/grpc `v1.27.0 => v1.27.1` + ## [0.3.0] - 2020-02-05 ### Updated @@ -166,3 +176,4 @@ Initial public release [0.2.13]: https://github.com/nspcc-dev/neofs-api/compare/v0.2.12...v0.2.13 [0.2.14]: https://github.com/nspcc-dev/neofs-api/compare/v0.2.13...v0.2.14 [0.3.0]: https://github.com/nspcc-dev/neofs-api/compare/v0.2.14...v0.3.0 +[0.3.1]: https://github.com/nspcc-dev/neofs-api/compare/v0.3.0...v0.3.1 From ba4aa98cc2cb5fe3286d1132fb052649c9e79f1e Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Mon, 10 Feb 2020 14:49:39 +0300 Subject: [PATCH 0099/1196] Refactoring Makefile --- Makefile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 43f4642..a20243e 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,6 @@ deps: @go mod vendor @echo "${B}${G}=> Cleanup old files ${R}" - @find . -type f -name '*.pb.go' -not -path './vendor/*' -exec rm {} \; @find . -type f -name '*.proto' -not -path './vendor/*' -not -name '*_test.proto' -exec rm {} \; @echo "${B}${G}=> NeoFS Proto files ${R}" @@ -49,6 +48,9 @@ docgen: deps # Regenerate proto files: protoc: deps + @echo "${B}${G}=> Cleanup old files ${R}" + @find . -type f -name '*.pb.go' -not -path './vendor/*' -exec rm {} \; + @echo "${B}${G}=> Install specific version for gogo-proto ${R}" @go list -f '{{.Path}}/...@{{.Version}}' -m github.com/gogo/protobuf | xargs go get -v @echo "${B}${G}=> Install specific version for protobuf lib ${R}" @@ -60,3 +62,5 @@ protoc: deps --proto_path=.:./vendor:/usr/local/include \ --gofast_out=plugins=grpc,paths=source_relative:. $$f; \ done + +update: docgen protoc From e12a7887cbbc6f139dbb3c423c16788471d77d11 Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Mon, 10 Feb 2020 14:50:08 +0300 Subject: [PATCH 0100/1196] Update documentation --- docs/state.md | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/docs/state.md b/docs/state.md index 7950455..2b3de4a 100644 --- a/docs/state.md +++ b/docs/state.md @@ -10,6 +10,8 @@ - Messages - [DumpRequest](#state.DumpRequest) - [DumpResponse](#state.DumpResponse) + - [DumpVarsRequest](#state.DumpVarsRequest) + - [DumpVarsResponse](#state.DumpVarsResponse) - [HealthRequest](#state.HealthRequest) - [HealthResponse](#state.HealthResponse) - [MetricsRequest](#state.MetricsRequest) @@ -39,6 +41,7 @@ rpc Netmap(NetmapRequest) returns (.bootstrap.SpreadMap); rpc Metrics(MetricsRequest) returns (MetricsResponse); rpc HealthCheck(HealthRequest) returns (HealthResponse); rpc DumpConfig(DumpRequest) returns (DumpResponse); +rpc DumpVars(DumpVarsRequest) returns (DumpVarsResponse); ``` @@ -73,6 +76,15 @@ The request should be signed. | Name | Input | Output | | ---- | ----- | ------ | | DumpConfig | [DumpRequest](#state.DumpRequest) | [DumpResponse](#state.DumpResponse) | +#### Method DumpVars + +DumpVars returns debug variables for the current node. +To permit access, used server config options. +The request should be signed. + +| Name | Input | Output | +| ---- | ----- | ------ | +| DumpVars | [DumpVarsRequest](#state.DumpVarsRequest) | [DumpVarsResponse](#state.DumpVarsResponse) | @@ -100,6 +112,30 @@ Config stored in JSON encoded into slice of bytes. | Config | [bytes](#bytes) | | | + + +### Message DumpVarsRequest +DumpVarsRequest message to fetch current server debug variables. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| Meta | [service.RequestMetaHeader](#service.RequestMetaHeader) | | RequestMetaHeader contains information about request meta headers (should be embedded into message) | +| Verify | [service.RequestVerificationHeader](#service.RequestVerificationHeader) | | RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) | + + + + +### Message DumpVarsResponse +DumpVarsResponse message contains current server debug variables. +Variables stored in JSON encoded into slice of bytes. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| Variables | [bytes](#bytes) | | | + + ### Message HealthRequest From bf5cd8b74088542932d4fcd5d7a5d7cba4e7d875 Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Mon, 10 Feb 2020 14:51:24 +0300 Subject: [PATCH 0101/1196] Update service.proto file and generate go-code --- state/service.pb.go | 519 +++++++++++++++++++++++++++++++++++++++++--- state/service.proto | 18 ++ 2 files changed, 506 insertions(+), 31 deletions(-) diff --git a/state/service.pb.go b/state/service.pb.go index f1e08de..b55f3c1 100644 --- a/state/service.pb.go +++ b/state/service.pb.go @@ -334,6 +334,91 @@ func (m *DumpResponse) GetConfig() []byte { return nil } +// DumpVarsRequest message to fetch current server debug variables. +type DumpVarsRequest struct { + // RequestMetaHeader contains information about request meta headers (should be embedded into message) + service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` + // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) + service.RequestVerificationHeader `protobuf:"bytes,99,opt,name=Verify,proto3,embedded=Verify" json:"Verify"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DumpVarsRequest) Reset() { *m = DumpVarsRequest{} } +func (m *DumpVarsRequest) String() string { return proto.CompactTextString(m) } +func (*DumpVarsRequest) ProtoMessage() {} +func (*DumpVarsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_695592f6f2fc97b7, []int{7} +} +func (m *DumpVarsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DumpVarsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *DumpVarsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_DumpVarsRequest.Merge(m, src) +} +func (m *DumpVarsRequest) XXX_Size() int { + return m.Size() +} +func (m *DumpVarsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_DumpVarsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_DumpVarsRequest proto.InternalMessageInfo + +// DumpVarsResponse message contains current server debug variables. +// Variables stored in JSON encoded into slice of bytes. +type DumpVarsResponse struct { + Variables []byte `protobuf:"bytes,1,opt,name=Variables,proto3" json:"Variables,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DumpVarsResponse) Reset() { *m = DumpVarsResponse{} } +func (m *DumpVarsResponse) String() string { return proto.CompactTextString(m) } +func (*DumpVarsResponse) ProtoMessage() {} +func (*DumpVarsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_695592f6f2fc97b7, []int{8} +} +func (m *DumpVarsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DumpVarsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *DumpVarsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_DumpVarsResponse.Merge(m, src) +} +func (m *DumpVarsResponse) XXX_Size() int { + return m.Size() +} +func (m *DumpVarsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_DumpVarsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_DumpVarsResponse proto.InternalMessageInfo + +func (m *DumpVarsResponse) GetVariables() []byte { + if m != nil { + return m.Variables + } + return nil +} + func init() { proto.RegisterType((*NetmapRequest)(nil), "state.NetmapRequest") proto.RegisterType((*MetricsRequest)(nil), "state.MetricsRequest") @@ -342,42 +427,47 @@ func init() { proto.RegisterType((*HealthResponse)(nil), "state.HealthResponse") proto.RegisterType((*DumpRequest)(nil), "state.DumpRequest") proto.RegisterType((*DumpResponse)(nil), "state.DumpResponse") + proto.RegisterType((*DumpVarsRequest)(nil), "state.DumpVarsRequest") + proto.RegisterType((*DumpVarsResponse)(nil), "state.DumpVarsResponse") } func init() { proto.RegisterFile("state/service.proto", fileDescriptor_695592f6f2fc97b7) } var fileDescriptor_695592f6f2fc97b7 = []byte{ - // 478 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x94, 0x41, 0x6f, 0xd3, 0x30, - 0x14, 0xc7, 0xe7, 0x01, 0x61, 0xb8, 0x65, 0x93, 0xbc, 0xb6, 0x8a, 0x72, 0xc8, 0xaa, 0x0a, 0xa1, - 0x4a, 0xa8, 0x8e, 0x34, 0x40, 0x9a, 0xb8, 0xd1, 0x4d, 0x68, 0x48, 0x74, 0x42, 0xa9, 0xc4, 0x81, - 0x9b, 0x93, 0xbe, 0xb6, 0x11, 0x34, 0x36, 0xf1, 0x4b, 0xa5, 0x7e, 0x08, 0x04, 0x47, 0x3e, 0x03, - 0x9f, 0x64, 0xc7, 0x1d, 0x39, 0x4d, 0xa8, 0x1c, 0xf9, 0x12, 0xa8, 0x8e, 0x53, 0x9a, 0xee, 0x0b, - 0xf4, 0x96, 0xf7, 0x7b, 0xfe, 0x3b, 0xff, 0xf7, 0xfc, 0x6c, 0x7a, 0xac, 0x51, 0x20, 0x04, 0x1a, - 0xb2, 0x79, 0x12, 0x03, 0x57, 0x99, 0x44, 0xc9, 0x1e, 0x18, 0xe8, 0x31, 0x4b, 0x83, 0x19, 0xa0, - 0x28, 0x52, 0x5e, 0xa3, 0x64, 0x73, 0xc8, 0x92, 0xf1, 0xc2, 0xd2, 0x66, 0x24, 0x25, 0x6a, 0xcc, - 0x84, 0x0a, 0x70, 0xa1, 0x40, 0x5b, 0xdc, 0x9b, 0x24, 0x38, 0xcd, 0x23, 0x1e, 0xcb, 0x59, 0x30, - 0x91, 0x13, 0x19, 0x18, 0x1c, 0xe5, 0x63, 0x13, 0x99, 0xc0, 0x7c, 0x15, 0xcb, 0x3b, 0xdf, 0x08, - 0x7d, 0x7c, 0x05, 0x38, 0x13, 0x2a, 0x84, 0x2f, 0x39, 0x68, 0x64, 0x67, 0xf4, 0xfe, 0x00, 0x50, - 0xb8, 0x51, 0x9b, 0x74, 0x6b, 0xa7, 0x1e, 0x2f, 0x6d, 0xda, 0xfc, 0x2a, 0x77, 0x09, 0x62, 0x04, - 0x59, 0xff, 0xe0, 0xfa, 0xf6, 0x64, 0xef, 0xe6, 0xf6, 0x84, 0x84, 0x46, 0xc1, 0x2e, 0xa8, 0xf3, - 0xc1, 0x38, 0x74, 0x63, 0xa3, 0xed, 0x6c, 0x6b, 0x4d, 0x36, 0x89, 0x05, 0x26, 0x32, 0xbd, 0xb3, - 0x87, 0xd5, 0x76, 0xbe, 0x13, 0x7a, 0x38, 0x00, 0xcc, 0x92, 0x58, 0xef, 0x8a, 0xa5, 0x67, 0xf4, - 0x68, 0xed, 0x48, 0x2b, 0x99, 0x6a, 0x60, 0x2e, 0x7d, 0x68, 0x91, 0x4b, 0xda, 0xf7, 0xba, 0xf5, - 0xb0, 0x0c, 0x4d, 0x47, 0x2f, 0x41, 0x7c, 0xc6, 0xe9, 0xae, 0xd8, 0xef, 0xd3, 0xc3, 0xd2, 0xd0, - 0x7f, 0xf7, 0x05, 0x59, 0xb8, 0xa4, 0x4d, 0xba, 0x07, 0x61, 0x19, 0xb2, 0x16, 0x75, 0x86, 0x28, - 0x30, 0xd7, 0xee, 0x7e, 0x9b, 0x74, 0x1f, 0x85, 0x36, 0xea, 0x7c, 0x25, 0xb4, 0x76, 0x91, 0xcf, - 0x76, 0x66, 0x4a, 0x9e, 0xd2, 0x7a, 0x61, 0xc7, 0x56, 0xd4, 0xa2, 0xce, 0xb9, 0x4c, 0xc7, 0xc9, - 0xc4, 0x14, 0x54, 0x0f, 0x6d, 0x74, 0xfa, 0x97, 0x94, 0x05, 0xb1, 0x17, 0xd4, 0x29, 0x26, 0x9d, - 0x35, 0xb8, 0xb9, 0x6c, 0xbc, 0x32, 0xf8, 0x5e, 0x83, 0xaf, 0x6f, 0x14, 0x1f, 0xaa, 0x0c, 0xc4, - 0x68, 0x20, 0x14, 0x3b, 0x5b, 0x1f, 0x34, 0x6b, 0x5a, 0x59, 0x75, 0x3a, 0xbd, 0xd6, 0x36, 0xb6, - 0x96, 0x5e, 0xd1, 0x5a, 0xd1, 0xd5, 0xf3, 0x29, 0xc4, 0x9f, 0xd6, 0x3f, 0xad, 0xcc, 0x86, 0xd7, - 0xdc, 0xa2, 0x56, 0xfb, 0x92, 0xd2, 0x55, 0x79, 0x45, 0x11, 0x8c, 0xd9, 0x45, 0x1b, 0x07, 0xe0, - 0x1d, 0x57, 0x58, 0x21, 0xeb, 0xbf, 0xbb, 0x5e, 0xfa, 0xe4, 0x66, 0xe9, 0x93, 0x5f, 0x4b, 0x9f, - 0xfc, 0x5e, 0xfa, 0xe4, 0xc7, 0x1f, 0x7f, 0xef, 0xe3, 0x93, 0x8d, 0x27, 0x21, 0xd5, 0x2a, 0x8e, - 0x7b, 0x23, 0x98, 0x07, 0x29, 0xc8, 0xb1, 0xee, 0x09, 0x95, 0x04, 0x66, 0xa3, 0x9f, 0xfb, 0x47, - 0x57, 0x20, 0xdf, 0x0c, 0xf9, 0xeb, 0xf7, 0x6f, 0xf9, 0xaa, 0x63, 0x10, 0x39, 0xe6, 0x89, 0x78, - 0xfe, 0x2f, 0x00, 0x00, 0xff, 0xff, 0xd8, 0xe0, 0x18, 0xa7, 0xb0, 0x04, 0x00, 0x00, + // 527 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x94, 0xcf, 0x6e, 0xd3, 0x40, + 0x10, 0xc6, 0xbb, 0x01, 0x42, 0x3a, 0x09, 0x0d, 0xda, 0x26, 0xc1, 0xb2, 0x90, 0x1b, 0x59, 0x08, + 0x45, 0x42, 0xb1, 0x51, 0x01, 0xa9, 0x82, 0x13, 0x69, 0x85, 0x8a, 0x44, 0x2a, 0xe4, 0x48, 0x39, + 0x70, 0x5b, 0x3b, 0x93, 0xc4, 0xa2, 0xf1, 0x1a, 0xef, 0x3a, 0x52, 0x1e, 0x02, 0x01, 0x37, 0x1e, + 0x01, 0xf1, 0x24, 0x3d, 0xf6, 0xc8, 0xa9, 0x42, 0xe1, 0x45, 0x50, 0xd6, 0xeb, 0xfc, 0xeb, 0x0b, + 0xe4, 0x96, 0xf9, 0xcd, 0x7c, 0xce, 0x37, 0xbb, 0xb3, 0x03, 0x87, 0x42, 0x32, 0x89, 0xae, 0xc0, + 0x64, 0x1a, 0x06, 0xe8, 0xc4, 0x09, 0x97, 0x9c, 0xde, 0x53, 0xd0, 0xa4, 0x9a, 0xba, 0x13, 0x94, + 0x2c, 0x4b, 0x99, 0xb5, 0x9c, 0x4d, 0x31, 0x09, 0x87, 0x33, 0x4d, 0xeb, 0x3e, 0xe7, 0x52, 0xc8, + 0x84, 0xc5, 0xae, 0x9c, 0xc5, 0x28, 0x34, 0x6e, 0x8f, 0x42, 0x39, 0x4e, 0x7d, 0x27, 0xe0, 0x13, + 0x77, 0xc4, 0x47, 0xdc, 0x55, 0xd8, 0x4f, 0x87, 0x2a, 0x52, 0x81, 0xfa, 0x95, 0x95, 0xdb, 0xdf, + 0x08, 0x3c, 0xb8, 0x40, 0x39, 0x61, 0xb1, 0x87, 0x5f, 0x52, 0x14, 0x92, 0x9e, 0xc0, 0xdd, 0x2e, + 0x4a, 0x66, 0xf8, 0x4d, 0xd2, 0x2a, 0x1f, 0x9b, 0x4e, 0x6e, 0x53, 0xe7, 0x17, 0xb9, 0x73, 0x64, + 0x03, 0x4c, 0x3a, 0xa5, 0xab, 0x9b, 0xa3, 0xbd, 0xeb, 0x9b, 0x23, 0xe2, 0x29, 0x05, 0x3d, 0x83, + 0x62, 0x5f, 0x39, 0x34, 0x02, 0xa5, 0xb5, 0xb7, 0xb5, 0x2a, 0x1b, 0x06, 0x4c, 0x86, 0x3c, 0xba, + 0xf5, 0x0d, 0xad, 0xb5, 0xbf, 0x13, 0x38, 0xe8, 0xa2, 0x4c, 0xc2, 0x40, 0xec, 0x8a, 0xa5, 0x67, + 0x50, 0x5d, 0x3a, 0x12, 0x31, 0x8f, 0x04, 0x52, 0x03, 0xee, 0x6b, 0x64, 0x90, 0xe6, 0x9d, 0x56, + 0xc5, 0xcb, 0x43, 0x75, 0xa2, 0xe7, 0xc8, 0x2e, 0xe5, 0x78, 0x57, 0xec, 0x77, 0xe0, 0x20, 0x37, + 0xb4, 0x72, 0x9f, 0x91, 0x99, 0x41, 0x9a, 0xa4, 0x55, 0xf2, 0xf2, 0x90, 0x36, 0xa0, 0xd8, 0x93, + 0x4c, 0xa6, 0xc2, 0x28, 0x34, 0x49, 0x6b, 0xdf, 0xd3, 0x91, 0xfd, 0x95, 0x40, 0xf9, 0x2c, 0x9d, + 0xec, 0xcc, 0x94, 0x3c, 0x85, 0x4a, 0x66, 0x47, 0x77, 0xd4, 0x80, 0xe2, 0x29, 0x8f, 0x86, 0xe1, + 0x48, 0x35, 0x54, 0xf1, 0x74, 0x64, 0xff, 0x20, 0x50, 0x5d, 0x14, 0xf6, 0x59, 0xb2, 0x33, 0xe3, + 0xf4, 0x1c, 0x1e, 0xae, 0x2c, 0x69, 0xff, 0x8f, 0x61, 0xbf, 0xcf, 0x92, 0x90, 0xf9, 0x97, 0x28, + 0x74, 0x0b, 0x2b, 0x70, 0xfc, 0xab, 0x90, 0x5f, 0x0b, 0x7d, 0x09, 0xc5, 0xec, 0xbd, 0xd2, 0x9a, + 0xa3, 0x56, 0x86, 0xb3, 0xf1, 0x7c, 0xcd, 0x9a, 0xb3, 0xdc, 0x0b, 0x4e, 0x2f, 0x4e, 0x90, 0x0d, + 0xba, 0x2c, 0xa6, 0x27, 0xcb, 0x71, 0xa5, 0x75, 0x2d, 0xdb, 0x7c, 0x63, 0x66, 0x63, 0x1b, 0x6b, + 0x63, 0xaf, 0xa1, 0x9c, 0xcd, 0xc6, 0xe9, 0x18, 0x83, 0xcf, 0xcb, 0x3f, 0xdd, 0x98, 0x70, 0xb3, + 0xbe, 0x45, 0xb5, 0xf6, 0x15, 0xc0, 0xa2, 0xd1, 0xec, 0x2a, 0x28, 0xd5, 0x45, 0x6b, 0x63, 0x64, + 0x1e, 0x6e, 0x30, 0x2d, 0x7b, 0x03, 0xa5, 0xfc, 0x7c, 0x68, 0x63, 0xad, 0x60, 0xed, 0x0e, 0xcd, + 0x47, 0xb7, 0x78, 0x26, 0xee, 0x7c, 0xb8, 0x9a, 0x5b, 0xe4, 0x7a, 0x6e, 0x91, 0x3f, 0x73, 0x8b, + 0xfc, 0x9d, 0x5b, 0xe4, 0xe7, 0x3f, 0x6b, 0xef, 0xd3, 0x93, 0xb5, 0xad, 0x18, 0x89, 0x38, 0x08, + 0xda, 0x03, 0x9c, 0xba, 0x11, 0xf2, 0xa1, 0x68, 0xb3, 0x38, 0x74, 0xd5, 0xc7, 0x7e, 0x17, 0xaa, + 0x17, 0xc8, 0xdf, 0xf5, 0x9c, 0xb7, 0x1f, 0xdf, 0x3b, 0x8b, 0xe3, 0x46, 0xbf, 0xa8, 0xb6, 0xe4, + 0x8b, 0xff, 0x01, 0x00, 0x00, 0xff, 0xff, 0xfc, 0x52, 0x8c, 0x82, 0xb3, 0x05, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -403,6 +493,10 @@ type StatusClient interface { // To permit access, used server config options. // The request should be signed. DumpConfig(ctx context.Context, in *DumpRequest, opts ...grpc.CallOption) (*DumpResponse, error) + // DumpVars returns debug variables for the current node. + // To permit access, used server config options. + // The request should be signed. + DumpVars(ctx context.Context, in *DumpVarsRequest, opts ...grpc.CallOption) (*DumpVarsResponse, error) } type statusClient struct { @@ -449,6 +543,15 @@ func (c *statusClient) DumpConfig(ctx context.Context, in *DumpRequest, opts ... return out, nil } +func (c *statusClient) DumpVars(ctx context.Context, in *DumpVarsRequest, opts ...grpc.CallOption) (*DumpVarsResponse, error) { + out := new(DumpVarsResponse) + err := c.cc.Invoke(ctx, "/state.Status/DumpVars", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // StatusServer is the server API for Status service. type StatusServer interface { // Netmap request allows to receive current [bootstrap.SpreadMap](bootstrap.md#bootstrap.SpreadMap) @@ -462,6 +565,10 @@ type StatusServer interface { // To permit access, used server config options. // The request should be signed. DumpConfig(context.Context, *DumpRequest) (*DumpResponse, error) + // DumpVars returns debug variables for the current node. + // To permit access, used server config options. + // The request should be signed. + DumpVars(context.Context, *DumpVarsRequest) (*DumpVarsResponse, error) } // UnimplementedStatusServer can be embedded to have forward compatible implementations. @@ -480,6 +587,9 @@ func (*UnimplementedStatusServer) HealthCheck(ctx context.Context, req *HealthRe func (*UnimplementedStatusServer) DumpConfig(ctx context.Context, req *DumpRequest) (*DumpResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method DumpConfig not implemented") } +func (*UnimplementedStatusServer) DumpVars(ctx context.Context, req *DumpVarsRequest) (*DumpVarsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DumpVars not implemented") +} func RegisterStatusServer(s *grpc.Server, srv StatusServer) { s.RegisterService(&_Status_serviceDesc, srv) @@ -557,6 +667,24 @@ func _Status_DumpConfig_Handler(srv interface{}, ctx context.Context, dec func(i return interceptor(ctx, in, info, handler) } +func _Status_DumpVars_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DumpVarsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(StatusServer).DumpVars(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/state.Status/DumpVars", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(StatusServer).DumpVars(ctx, req.(*DumpVarsRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _Status_serviceDesc = grpc.ServiceDesc{ ServiceName: "state.Status", HandlerType: (*StatusServer)(nil), @@ -577,6 +705,10 @@ var _Status_serviceDesc = grpc.ServiceDesc{ MethodName: "DumpConfig", Handler: _Status_DumpConfig_Handler, }, + { + MethodName: "DumpVars", + Handler: _Status_DumpVars_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "state/service.proto", @@ -900,6 +1032,91 @@ func (m *DumpResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *DumpVarsRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *DumpVarsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DumpVarsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + { + size, err := m.RequestVerificationHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x9a + { + size, err := m.RequestMetaHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x92 + return len(dAtA) - i, nil +} + +func (m *DumpVarsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *DumpVarsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DumpVarsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Variables) > 0 { + i -= len(m.Variables) + copy(dAtA[i:], m.Variables) + i = encodeVarintService(dAtA, i, uint64(len(m.Variables))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func encodeVarintService(dAtA []byte, offset int, v uint64) int { offset -= sovService(v) base := offset @@ -1028,6 +1245,38 @@ func (m *DumpResponse) Size() (n int) { return n } +func (m *DumpVarsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.RequestMetaHeader.Size() + n += 2 + l + sovService(uint64(l)) + l = m.RequestVerificationHeader.Size() + n += 2 + l + sovService(uint64(l)) + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *DumpVarsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Variables) + if l > 0 { + n += 1 + l + sovService(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + func sovService(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -1794,6 +2043,214 @@ func (m *DumpResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *DumpVarsRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DumpVarsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DumpVarsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 98: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RequestMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 99: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestVerificationHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RequestVerificationHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DumpVarsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DumpVarsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DumpVarsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Variables", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Variables = append(m.Variables[:0], dAtA[iNdEx:postIndex]...) + if m.Variables == nil { + m.Variables = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipService(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/state/service.proto b/state/service.proto index 312d465..dc5efe4 100644 --- a/state/service.proto +++ b/state/service.proto @@ -23,6 +23,10 @@ service Status { // To permit access, used server config options. // The request should be signed. rpc DumpConfig(DumpRequest) returns (DumpResponse); + // DumpVars returns debug variables for the current node. + // To permit access, used server config options. + // The request should be signed. + rpc DumpVars(DumpVarsRequest) returns (DumpVarsResponse); } // NetmapRequest message to request current node netmap @@ -77,3 +81,17 @@ message DumpRequest { message DumpResponse { bytes Config = 1; } + +// DumpVarsRequest message to fetch current server debug variables. +message DumpVarsRequest { + // RequestMetaHeader contains information about request meta headers (should be embedded into message) + service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) + service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; +} + +// DumpVarsResponse message contains current server debug variables. +// Variables stored in JSON encoded into slice of bytes. +message DumpVarsResponse { + bytes Variables = 1; +} From cf5f6b11923a87417e1a5e5d8b20b996ed9471a7 Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Mon, 10 Feb 2020 14:52:07 +0300 Subject: [PATCH 0102/1196] Implement function to encode debug variables --- state/service.go | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/state/service.go b/state/service.go index 343a822..577046c 100644 --- a/state/service.go +++ b/state/service.go @@ -1,7 +1,10 @@ package state import ( + "bytes" "encoding/json" + "expvar" + "fmt" "github.com/golang/protobuf/proto" "github.com/prometheus/client_golang/prometheus" @@ -61,3 +64,25 @@ func EncodeConfig(v *viper.Viper) (*DumpResponse, error) { return &DumpResponse{Config: data}, nil } + +// EncodeVariables encodes debug variables into DumpVarsResponse message. +// Variables encoded into JSON and stored as slice of bytes. +func EncodeVariables() *DumpVarsResponse { + buf := new(bytes.Buffer) + buf.WriteString("{\n") + first := true + + expvar.Do(func(kv expvar.KeyValue) { + if !first { + buf.WriteString(",\n") + } + + first = false + + _, _ = fmt.Fprintf(buf, "%q: %s", kv.Key, kv.Value) + }) + + buf.WriteString("\n}\n") + + return &DumpVarsResponse{Variables: buf.Bytes()} +} From fc91a5b2323759442472a86a33c38b6d2155c1ef Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Mon, 10 Feb 2020 14:52:49 +0300 Subject: [PATCH 0103/1196] Add tests for EncodeVariables --- state/service_test.go | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 state/service_test.go diff --git a/state/service_test.go b/state/service_test.go new file mode 100644 index 0000000..2c089ad --- /dev/null +++ b/state/service_test.go @@ -0,0 +1,28 @@ +package state + +import ( + "encoding/json" + "expvar" + "testing" + + "github.com/stretchr/testify/require" +) + +func TestEncodeVariables(t *testing.T) { + dump := make(map[string]interface{}) + + expvar.NewString("test1").Set("test1") + expvar.NewString("test2").Set("test2") + + res := EncodeVariables() + + require.NoError(t, json.Unmarshal(res.Variables, &dump)) + require.NotEmpty(t, dump) + + // dump should contains keys `test1` and `test2` + require.Contains(t, dump, "test1") + require.Equal(t, "test1", dump["test1"]) + + require.Contains(t, dump, "test2") + require.Equal(t, "test2", dump["test2"]) +} From 02e82156ba46a828f00ca098b74a78e1298d3186 Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Mon, 10 Feb 2020 15:27:24 +0300 Subject: [PATCH 0104/1196] Add tests for EncodeConfig --- state/service_test.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/state/service_test.go b/state/service_test.go index 2c089ad..21dc0bc 100644 --- a/state/service_test.go +++ b/state/service_test.go @@ -5,6 +5,7 @@ import ( "expvar" "testing" + "github.com/spf13/viper" "github.com/stretchr/testify/require" ) @@ -26,3 +27,23 @@ func TestEncodeVariables(t *testing.T) { require.Contains(t, dump, "test2") require.Equal(t, "test2", dump["test2"]) } + +func TestEncodeConfig(t *testing.T) { + v := viper.New() + v.Set("test1", "test1") + v.Set("test2", "test2") + + res, err := EncodeConfig(v) + require.NoError(t, err) + + dump := make(map[string]interface{}) + require.NoError(t, json.Unmarshal(res.Config, &dump)) + + require.NotEmpty(t, dump) + + require.Contains(t, dump, "test1") + require.Equal(t, dump["test1"], "test1") + + require.Contains(t, dump, "test2") + require.Equal(t, dump["test2"], "test2") +} From 1deea42f5ac0dd2b3ae681eedbc6f5b570de1039 Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Mon, 10 Feb 2020 15:35:23 +0300 Subject: [PATCH 0105/1196] Add tests for EncodeMetrics and DecodeMetrics --- state/service_test.go | 69 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) diff --git a/state/service_test.go b/state/service_test.go index 21dc0bc..d545cb0 100644 --- a/state/service_test.go +++ b/state/service_test.go @@ -1,14 +1,31 @@ package state import ( + "bytes" "encoding/json" "expvar" "testing" + "github.com/prometheus/client_golang/prometheus" "github.com/spf13/viper" "github.com/stretchr/testify/require" ) +type testCollector struct { + testA *prometheus.Desc + testB *prometheus.Desc +} + +func (c *testCollector) Describe(ch chan<- *prometheus.Desc) { + ch <- c.testA + ch <- c.testB +} + +func (c *testCollector) Collect(ch chan<- prometheus.Metric) { + ch <- prometheus.MustNewConstMetric(c.testA, prometheus.GaugeValue, 1, "label_1") + ch <- prometheus.MustNewConstMetric(c.testB, prometheus.GaugeValue, 2, "label_2") +} + func TestEncodeVariables(t *testing.T) { dump := make(map[string]interface{}) @@ -47,3 +64,55 @@ func TestEncodeConfig(t *testing.T) { require.Contains(t, dump, "test2") require.Equal(t, dump["test2"], "test2") } + +func TestEncodeAndDecodeMetrics(t *testing.T) { + registry := prometheus.NewRegistry() + + collector := &testCollector{ + testA: prometheus.NewDesc("test1", "test1", []string{"test1"}, prometheus.Labels{"label_1": "test1"}), + testB: prometheus.NewDesc("test2", "test2", []string{"test2"}, prometheus.Labels{"label_2": "test2"}), + } + + require.NoError(t, registry.Register(collector)) + + gather, err := registry.Gather() + require.NoError(t, err) + + res, err := EncodeMetrics(registry) + require.NoError(t, err) + + metrics, err := DecodeMetrics(res) + require.NoError(t, err) + + require.Len(t, metrics, len(gather)) + + { // Check that JSON encoded metrics are equal: + expect := new(bytes.Buffer) + actual := new(bytes.Buffer) + + require.NoError(t, json.NewEncoder(expect).Encode(gather)) + require.NoError(t, json.NewEncoder(actual).Encode(metrics)) + + require.Equal(t, expect.Bytes(), actual.Bytes()) + } + + { // Deep comparison of metrics: + for i := range metrics { + require.Equal(t, gather[i].Help, metrics[i].Help) + require.Equal(t, gather[i].Name, metrics[i].Name) + require.Equal(t, gather[i].Type, metrics[i].Type) + + require.Len(t, metrics[i].Metric, len(gather[i].Metric)) + + for j := range metrics[i].Metric { + require.Equal(t, gather[i].Metric[j].Gauge, metrics[i].Metric[j].Gauge) + require.Len(t, metrics[i].Metric[j].Label, len(gather[i].Metric[j].Label)) + + for k := range metrics[i].Metric[j].Label { + require.Equal(t, gather[i].Metric[j].Label[k].Name, metrics[i].Metric[j].Label[k].Name) + require.Equal(t, gather[i].Metric[j].Label[k].Value, metrics[i].Metric[j].Label[k].Value) + } + } + } + } +} From d5bf805a0280553bb69d3274cb8de2d47da47141 Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Mon, 10 Feb 2020 17:00:40 +0300 Subject: [PATCH 0106/1196] CHANGELOG --- CHANGELOG.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 992ba8d..124d349 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,17 @@ # Changelog This is the changelog for NeoFS Proto +## [0.3.2] - 2020-02-10 + +### Added +- gRPC method DumpVars to State service +- add method `EncodeVariables` to encode debug variables to JSON (slice of bytes) +- increase test coverage for state package + +### Updated +- state proto file +- documentation for state service and messages + ## [0.3.1] - 2020-02-07 ### Fixed - bug with `tz.Concat` @@ -177,3 +188,4 @@ Initial public release [0.2.14]: https://github.com/nspcc-dev/neofs-api/compare/v0.2.13...v0.2.14 [0.3.0]: https://github.com/nspcc-dev/neofs-api/compare/v0.2.14...v0.3.0 [0.3.1]: https://github.com/nspcc-dev/neofs-api/compare/v0.3.0...v0.3.1 +[0.3.2]: https://github.com/nspcc-dev/neofs-api/compare/v0.3.1...v0.3.2 From 3b63d9148006ad161c67574844d9461ee3c58946 Mon Sep 17 00:00:00 2001 From: alexvanin Date: Tue, 11 Feb 2020 16:54:43 +0300 Subject: [PATCH 0107/1196] accounting: Use little endian in number encoding NeoFS smart-contract uses little endian for number of signatures, GAS amount and block height. If we encode these parameters in little endian, smart-contract will not reverse bytes during execution therefore will be cheaper. --- accounting/fixtures/cheque.sh | 2 +- accounting/fixtures/cheque_data | Bin 650 -> 650 bytes accounting/types.go | 12 ++++++------ accounting/types_test.go | 2 ++ 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/accounting/fixtures/cheque.sh b/accounting/fixtures/cheque.sh index 9336813..581402a 100755 --- a/accounting/fixtures/cheque.sh +++ b/accounting/fixtures/cheque.sh @@ -1,6 +1,6 @@ #!/bin/bash -CHEQUE=d6520dabb6cb9b981792608c73670eff14775e9a65bbc189271723ba2703c53263e8d6e522dc32203339dcd8eee9c6b7439a0000000053724e000000000000001e61000603012d47e76210aec73be39ab3d186e0a40fe8d86bfa3d4fabfda57ba13b88f96abe1de4c7ecd46cb32081c0ff199e0b32708d2ce709dd146ce096484073a9b15a259ca799f8d848eb5bea16f6d0842a0181ccd47384af2cdb0fd0af0819e8a08802f7528ce97c9a93558efe7d4f62577aabdf771c931f54a71be6ad21e7d9cc1777686ad19b5dc4b80d7b8decf90054c5aad66c0e6fe63d8473b751cd77c1bd0557516e0f3e7d0ccb485809023b0c08a89f33ae38b2f99ce3f1ebc7905dddf0ed0f023e00f03a16e8707ce045eb42ee80d392451541ee510dc18e1c8befbac54d7426087d37d32d836537d317deafbbd193002a36f80fbdfbf3a730cf011bc6c75c7e6d5724f3adee7015fcb3068d321e2ae555e79107be0c46070efdae2f724dbc9f0340750b92789821683283bcb98e32b7e032b94f267b6964613fc31a7ce5813fddeea47a1db525634237e924178b5c8ea745549ae60aa3570ce6cf52e370e6ab87652bdf8a179176f1acaf48896bef9ab300818a53f410d86241d506a550f4915403fef27f744e829131d0ec980829fafa51db1714c2761d9f78762c008c323e9d6612e4f9efdc609f191fd9ca5431dd9dc037130150107ab8769780d728e9ffdf314019b57c8d2b940b9ec078afa951ed8b06c1bf352edd2037e29b8f24cca3ec700368a6f5829fb2a34fa03d0308ae6b05f433f2904d9a852fed1f5d2eb598ca79475b74ef6394e712d275cd798062c6d8e41fad822ac5a4fcb167f0a2e196f61f9f65a0adef9650f49150e7eb7bb08dd1739fa6e86b341f1b2cf5657fcd200637e8 +CHEQUE=7849b02d01cc7f7734295fa815ea64ec4d2012e45b8781eb891723ba2703c53263e8d6e522dc32203339dcd8eee9c6b7439a00ea56fa00000000611e000000000000060003012d47e76210aec73be39ab3d186e0a40fe8d86bfa3d4fabfda57ba13b88f96a8ebe4360627a1326f13fb9516c0dbc4af90f116e44bd33f4d04a0d1633afa243ad4f2fa9cd933e7631a619b5132cec6983906aba757af5590434124b232a43e302f7528ce97c9a93558efe7d4f62577aabdf771c931f54a71be6ad21e7d9cc177744b4b9781cf0c29adb503f33d2df9f810ebf33a774849848984cf7e2bbebd48ef0cd8592fbf9b6aee1dc74803e31c95a02dbbd5fd9783f9ecbcbf444b5942f830368a6f5829fb2a34fa03d0308ae6b05f433f2904d9a852fed1f5d2eb598ca794770adb1ece9dccd1c7ad98f709cfb890e3bdd5973dcdd838111fae2efa4c3c09ea2133e5d7c6eac6ae24afcce46db7c9f4dc154f123c835adff4e0b7e19bcffda0340750b92789821683283bcb98e32b7e032b94f267b6964613fc31a7ce5813fddad8298f71dfdc4f9b3e353f969727af476d43b12a25727cf6b9c73ae7152266d995bec807068ad2156288c4d946aeb17ebca787d498a1b87b9dae1bcd935763403fef27f744e829131d0ec980829fafa51db1714c2761d9f78762c008c323e9d66db9b5086d355897e52fe065e14f1cc70334248349aa4c7a3e6e3dc8f8693b1511c73dc88e6d6e8b6c6c68de922f351b5b1543917af2f2a3588aebfbd1ff3fac6023e00f03a16e8707ce045eb42ee80d392451541ee510dc18e1c8befbac54d742648b58f379b5337d9b74c5a61afb8ef3db7f3eb0454d6823777b613a3ee22cd6ce47e4fa72170d49267b773cc09c123654e0bcd7278aa2ae1e7c85d049b557a3c DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) echo $CHEQUE | xxd -p -r > $DIR/cheque_data diff --git a/accounting/fixtures/cheque_data b/accounting/fixtures/cheque_data index cd7b286642c3d1fc8d0080985c4d070013761b63..a1530960f321d4d6d1cb7f11f9cf1de82006ffc4 100644 GIT binary patch delta 485 zcmVzU3_k= zYT`=#&PLmOpH0D3@gvAJt^ZC7ei^*~+LLDiAwaEynD-t1#QC%1Q~7Cfdh~YGI})N- zC(mn~bFOhxCT*Ep?0|4+tszz@j7^kk>lf?FczsEV8;7~t;k?;3b~Ka70U^ZLe<1_2>JNVShQn^QO0w@g}Luek3$xAW@+RMvtwceWFw?jp@>lWxK(NCl@2SCj-SYW9Zi9BHS_{ zGdbMY?&-$2Lz(~p002{RP5=M^000009$^3mkwhUtz8&Pp?9^&K8?-SF)XlPLlrKnQ&|(=CH#H`5p1ue;Hc04g^4554>Ir!da}8^*_6er;DI^R4c1 z75uXXjWQl8JTXgSZl;;xCb int64(len(buf[offset:])) { diff --git a/accounting/types_test.go b/accounting/types_test.go index 424993a..14aee3b 100644 --- a/accounting/types_test.go +++ b/accounting/types_test.go @@ -80,5 +80,7 @@ func TestCheque(t *testing.T) { require.Equal(t, expect, actual) require.NoError(t, cheque.Verify()) + require.Equal(t, cheque.Height, uint64(7777)) + require.Equal(t, cheque.Amount, decimal.NewGAS(42)) }) } From de09878df18f8f268872e69f45021bd135de10e8 Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Thu, 13 Feb 2020 18:10:46 +0300 Subject: [PATCH 0108/1196] Response meta header --- docs/object.md | 10 + docs/service.md | 14 ++ object/service.pb.go | 511 ++++++++++++++++++++++++++++++++++++------- object/service.proto | 18 +- service/meta.pb.go | 220 ++++++++++++++++++- service/meta.proto | 10 + 6 files changed, 692 insertions(+), 91 deletions(-) diff --git a/docs/object.md b/docs/object.md index d13b676..ce9252b 100644 --- a/docs/object.md +++ b/docs/object.md @@ -161,6 +161,10 @@ DeleteResponse is empty because we cannot guarantee permanent object removal in distributed system. +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| Meta | [service.ResponseMetaHeader](#service.ResponseMetaHeader) | | ResponseMetaHeader contains meta information based on request processing by server (should be embedded into message) | + @@ -186,6 +190,7 @@ in distributed system. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | | Hashes | [bytes](#bytes) | repeated | Hashes is a homomorphic hashes of all ranges | +| Meta | [service.ResponseMetaHeader](#service.ResponseMetaHeader) | | ResponseMetaHeader contains meta information based on request processing by server (should be embedded into message) | @@ -211,6 +216,7 @@ in distributed system. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | | Fragment | [bytes](#bytes) | | Fragment of object's payload | +| Meta | [service.ResponseMetaHeader](#service.ResponseMetaHeader) | | ResponseMetaHeader contains meta information based on request processing by server (should be embedded into message) | @@ -237,6 +243,7 @@ in distributed system. | ----- | ---- | ----- | ----------- | | object | [Object](#object.Object) | | Object header and some payload | | Chunk | [bytes](#bytes) | | Chunk of remaining payload | +| Meta | [service.ResponseMetaHeader](#service.ResponseMetaHeader) | | ResponseMetaHeader contains meta information based on request processing by server (should be embedded into message) | @@ -263,6 +270,7 @@ in distributed system. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | | Object | [Object](#object.Object) | | Object without payload | +| Meta | [service.ResponseMetaHeader](#service.ResponseMetaHeader) | | ResponseMetaHeader contains meta information based on request processing by server (should be embedded into message) | @@ -300,6 +308,7 @@ in distributed system. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | | Address | [refs.Address](#refs.Address) | | Address of object (container id + object id) | +| Meta | [service.ResponseMetaHeader](#service.ResponseMetaHeader) | | ResponseMetaHeader contains meta information based on request processing by server (should be embedded into message) | @@ -326,6 +335,7 @@ in distributed system. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | | Addresses | [refs.Address](#refs.Address) | repeated | Addresses of found objects | +| Meta | [service.ResponseMetaHeader](#service.ResponseMetaHeader) | | ResponseMetaHeader contains meta information based on request processing by server (should be embedded into message) | diff --git a/docs/service.md b/docs/service.md index 454fab4..90e1bd2 100644 --- a/docs/service.md +++ b/docs/service.md @@ -7,6 +7,7 @@ - Messages - [RequestMetaHeader](#service.RequestMetaHeader) + - [ResponseMetaHeader](#service.ResponseMetaHeader) - [service/verify.proto](#service/verify.proto) @@ -49,6 +50,19 @@ RequestMetaHeader contains information about request meta headers | Epoch | [uint64](#uint64) | | Epoch for user can be empty, because node sets epoch to the actual value | | Version | [uint32](#uint32) | | Version defines protocol version TODO: not used for now, should be implemented in future | + + + +### Message ResponseMetaHeader +ResponseMetaHeader contains meta information based on request processing by server +(should be embedded into message) + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| Epoch | [uint64](#uint64) | | Current NeoFS epoch on server | +| Version | [uint32](#uint32) | | Version defines protocol version TODO: not used for now, should be implemented in future | + diff --git a/object/service.pb.go b/object/service.pb.go index 1ecf6d9..46891e2 100644 --- a/object/service.pb.go +++ b/object/service.pb.go @@ -91,10 +91,12 @@ type GetResponse struct { // Types that are valid to be assigned to R: // *GetResponse_Object // *GetResponse_Chunk - R isGetResponse_R `protobuf_oneof:"R"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + R isGetResponse_R `protobuf_oneof:"R"` + // ResponseMetaHeader contains meta information based on request processing by server (should be embedded into message) + service.ResponseMetaHeader `protobuf:"bytes,99,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetResponse) Reset() { *m = GetResponse{} } @@ -314,10 +316,12 @@ func (m *PutRequest_PutHeader) GetToken() *session.Token { type PutResponse struct { // Address of object (container id + object id) - Address refs.Address `protobuf:"bytes,1,opt,name=Address,proto3" json:"Address"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Address refs.Address `protobuf:"bytes,1,opt,name=Address,proto3" json:"Address"` + // ResponseMetaHeader contains meta information based on request processing by server (should be embedded into message) + service.ResponseMetaHeader `protobuf:"bytes,99,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *PutResponse) Reset() { *m = PutResponse{} } @@ -418,9 +422,11 @@ func (m *DeleteRequest) GetToken() *session.Token { // DeleteResponse is empty because we cannot guarantee permanent object removal // in distributed system. type DeleteResponse struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + // ResponseMetaHeader contains meta information based on request processing by server (should be embedded into message) + service.ResponseMetaHeader `protobuf:"bytes,99,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *DeleteResponse) Reset() { *m = DeleteResponse{} } @@ -513,10 +519,12 @@ func (m *HeadRequest) GetRaw() bool { type HeadResponse struct { // Object without payload - Object *Object `protobuf:"bytes,1,opt,name=Object,proto3" json:"Object,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Object *Object `protobuf:"bytes,1,opt,name=Object,proto3" json:"Object,omitempty"` + // ResponseMetaHeader contains meta information based on request processing by server (should be embedded into message) + service.ResponseMetaHeader `protobuf:"bytes,99,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *HeadResponse) Reset() { *m = HeadResponse{} } @@ -616,10 +624,12 @@ func (m *SearchRequest) GetQueryVersion() uint32 { type SearchResponse struct { // Addresses of found objects - Addresses []refs.Address `protobuf:"bytes,1,rep,name=Addresses,proto3" json:"Addresses"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Addresses []refs.Address `protobuf:"bytes,1,rep,name=Addresses,proto3" json:"Addresses"` + // ResponseMetaHeader contains meta information based on request processing by server (should be embedded into message) + service.ResponseMetaHeader `protobuf:"bytes,99,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *SearchResponse) Reset() { *m = SearchResponse{} } @@ -717,10 +727,12 @@ func (m *GetRangeRequest) GetRange() Range { type GetRangeResponse struct { // Fragment of object's payload - Fragment []byte `protobuf:"bytes,1,opt,name=Fragment,proto3" json:"Fragment,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Fragment []byte `protobuf:"bytes,1,opt,name=Fragment,proto3" json:"Fragment,omitempty"` + // ResponseMetaHeader contains meta information based on request processing by server (should be embedded into message) + service.ResponseMetaHeader `protobuf:"bytes,99,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetRangeResponse) Reset() { *m = GetRangeResponse{} } @@ -827,10 +839,12 @@ func (m *GetRangeHashRequest) GetSalt() []byte { type GetRangeHashResponse struct { // Hashes is a homomorphic hashes of all ranges - Hashes []Hash `protobuf:"bytes,1,rep,name=Hashes,proto3,customtype=Hash" json:"Hashes"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Hashes []Hash `protobuf:"bytes,1,rep,name=Hashes,proto3,customtype=Hash" json:"Hashes"` + // ResponseMetaHeader contains meta information based on request processing by server (should be embedded into message) + service.ResponseMetaHeader `protobuf:"bytes,99,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetRangeHashResponse) Reset() { *m = GetRangeHashResponse{} } @@ -883,62 +897,64 @@ func init() { func init() { proto.RegisterFile("object/service.proto", fileDescriptor_dfcdf610ade6a9ce) } var fileDescriptor_dfcdf610ade6a9ce = []byte{ - // 874 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x56, 0xcd, 0x6e, 0xe3, 0x54, - 0x14, 0xce, 0x8d, 0x13, 0x37, 0x73, 0xe2, 0x74, 0xa2, 0xdb, 0x30, 0x44, 0x66, 0x94, 0x56, 0xd6, - 0x80, 0x82, 0x50, 0x9c, 0x32, 0x48, 0xc3, 0x20, 0x8d, 0x84, 0x26, 0x89, 0x3a, 0xc9, 0x82, 0xb6, - 0xdc, 0x54, 0x95, 0x60, 0xe7, 0x38, 0x37, 0x89, 0x69, 0x6a, 0x07, 0xff, 0xb4, 0xea, 0x03, 0xb0, - 0x66, 0xcb, 0x92, 0x35, 0xcf, 0xc0, 0x03, 0x74, 0x83, 0xd4, 0x25, 0x62, 0x51, 0xa1, 0xb0, 0xe4, - 0x05, 0x90, 0xd8, 0xa0, 0xfb, 0xe3, 0xd8, 0x6e, 0x69, 0x81, 0x6e, 0xc2, 0x2a, 0xf7, 0x7e, 0xe7, - 0x3b, 0xe7, 0xe6, 0x7c, 0xfe, 0xce, 0xb5, 0xa1, 0xe6, 0x8d, 0xbe, 0xa2, 0x76, 0xd8, 0x0e, 0xa8, - 0x7f, 0xe6, 0xd8, 0xd4, 0x5c, 0xf8, 0x5e, 0xe8, 0x61, 0x55, 0xa0, 0x7a, 0xd5, 0xa7, 0x93, 0xa0, - 0x1d, 0x5e, 0x2c, 0x68, 0x20, 0x22, 0x3a, 0x96, 0xfc, 0x34, 0xb6, 0x15, 0xd0, 0x20, 0x70, 0x3c, - 0x37, 0x4b, 0x94, 0x15, 0xdb, 0xa7, 0x34, 0xb4, 0x24, 0x56, 0x8b, 0xb1, 0x33, 0xea, 0x3b, 0x93, - 0x0b, 0x89, 0xb6, 0xa6, 0x4e, 0x38, 0x8b, 0x46, 0xa6, 0xed, 0x9d, 0xb6, 0xa7, 0xde, 0xd4, 0x6b, - 0x73, 0x78, 0x14, 0x4d, 0xf8, 0x8e, 0x6f, 0xf8, 0x4a, 0xd0, 0x8d, 0x9f, 0x10, 0xc0, 0x1b, 0x1a, - 0x12, 0xfa, 0x75, 0x44, 0x83, 0x10, 0xb7, 0x60, 0xe3, 0xf5, 0x78, 0xec, 0xd3, 0x20, 0xa8, 0xa3, - 0x1d, 0xd4, 0x2c, 0x3f, 0xaf, 0x98, 0xec, 0x4f, 0x9b, 0x12, 0xec, 0x14, 0x2e, 0xaf, 0xb7, 0x73, - 0x24, 0xe6, 0xe0, 0x2a, 0x28, 0xc4, 0x3a, 0xaf, 0xe7, 0x77, 0x50, 0xb3, 0x44, 0xd8, 0x12, 0xbf, - 0x84, 0xc2, 0x67, 0x34, 0xb4, 0xea, 0x23, 0x9e, 0xad, 0x9b, 0xb1, 0x12, 0xf2, 0x00, 0x16, 0xeb, - 0x53, 0x6b, 0x4c, 0xfd, 0x4e, 0x89, 0x95, 0xba, 0xba, 0xde, 0x46, 0x84, 0x67, 0xe0, 0x1e, 0xa8, - 0xc7, 0xbc, 0x91, 0xba, 0xcd, 0x73, 0x8d, 0x9b, 0xb9, 0x3c, 0xea, 0xd8, 0x56, 0xe8, 0x78, 0xee, - 0xad, 0x1a, 0x32, 0xd7, 0x38, 0x82, 0x32, 0x6f, 0x27, 0x58, 0x78, 0x6e, 0x40, 0x71, 0x13, 0xa4, - 0xf8, 0xb2, 0x9d, 0x4d, 0x53, 0x6c, 0xcd, 0x03, 0xfe, 0xd3, 0xcf, 0x11, 0x19, 0xc7, 0x4f, 0xa0, - 0xd8, 0x9d, 0x45, 0xee, 0x09, 0x6f, 0x46, 0xeb, 0xe7, 0x88, 0xd8, 0x76, 0x14, 0x40, 0xc4, 0xf8, - 0x31, 0x0f, 0x70, 0x18, 0xad, 0x54, 0x7a, 0x01, 0xaa, 0xf8, 0x03, 0xb2, 0xea, 0xd3, 0xb8, 0x6a, - 0xc2, 0x61, 0x4b, 0xc1, 0x61, 0x67, 0x88, 0xd5, 0x5d, 0x67, 0xac, 0x5b, 0x34, 0xfd, 0x0b, 0x78, - 0xb4, 0xfa, 0xbb, 0xf8, 0x3d, 0x50, 0x0f, 0xee, 0x91, 0x8c, 0xc8, 0x28, 0x7e, 0x06, 0xc5, 0x23, - 0xef, 0x84, 0xba, 0xbc, 0x19, 0x46, 0x93, 0xbe, 0x35, 0x39, 0x4a, 0x44, 0x50, 0xc8, 0xf7, 0x0a, - 0xca, 0x5c, 0x19, 0xf9, 0x50, 0xfe, 0x9b, 0xc9, 0x8c, 0x6f, 0xf3, 0x50, 0xe9, 0xd1, 0x39, 0x0d, - 0xe9, 0x03, 0x5d, 0xfa, 0x3e, 0x6c, 0x1c, 0x9c, 0xbb, 0xd4, 0x1f, 0xf4, 0x84, 0xf0, 0x9d, 0xc7, - 0x2c, 0xfe, 0xcb, 0xf5, 0x76, 0x0c, 0x93, 0x78, 0x91, 0x34, 0xa5, 0xdc, 0xd3, 0xd4, 0xda, 0x4d, - 0x5e, 0x85, 0xcd, 0x58, 0x10, 0x21, 0xa9, 0xf1, 0x27, 0x82, 0x32, 0xa3, 0xc7, 0x0a, 0xbd, 0xfc, - 0x07, 0x85, 0x56, 0x0a, 0x48, 0x20, 0x11, 0x6b, 0x07, 0xca, 0x7b, 0xd1, 0x7c, 0x2e, 0xce, 0x0e, - 0xe4, 0x68, 0xa7, 0xa1, 0x78, 0xe8, 0x95, 0xff, 0xcf, 0xd0, 0xbf, 0x00, 0x4d, 0x34, 0x2f, 0x0d, - 0xf6, 0x2f, 0x2d, 0x6c, 0xfc, 0x81, 0xa0, 0x32, 0xa4, 0x96, 0x6f, 0xcf, 0x12, 0x67, 0x95, 0xbb, - 0x9e, 0x1b, 0x5a, 0x8e, 0xb0, 0x0b, 0xe2, 0x76, 0x29, 0x4b, 0xb1, 0x94, 0xee, 0xa0, 0x47, 0xd2, - 0x71, 0x5c, 0x83, 0xe2, 0xe7, 0x11, 0xf5, 0x2f, 0x84, 0xaf, 0x88, 0xd8, 0x60, 0x03, 0x34, 0xbe, - 0x38, 0xa6, 0x3e, 0xf3, 0x0e, 0x57, 0xaa, 0x42, 0x32, 0xd8, 0xda, 0x25, 0xeb, 0xc2, 0x66, 0xdc, - 0xb9, 0x14, 0xed, 0x43, 0x78, 0x24, 0x3d, 0x40, 0x99, 0x69, 0x94, 0xbb, 0xc6, 0x2a, 0x61, 0x19, - 0xbf, 0x23, 0x78, 0xcc, 0x6e, 0x5b, 0xcb, 0x9d, 0x3e, 0x7c, 0x36, 0x8b, 0x3c, 0x5d, 0xde, 0x22, - 0x95, 0xf8, 0x49, 0x71, 0x50, 0x92, 0x05, 0x63, 0xed, 0x92, 0x99, 0x50, 0x4d, 0x9a, 0x95, 0xa2, - 0xe9, 0x50, 0xda, 0xf3, 0xad, 0xe9, 0x29, 0x75, 0x85, 0xd7, 0x34, 0xb2, 0xda, 0x1b, 0xdf, 0xe4, - 0x61, 0x2b, 0x4e, 0xe8, 0x5b, 0xc1, 0xec, 0x81, 0x0a, 0x7d, 0x00, 0x2a, 0x2f, 0xc1, 0x66, 0x51, - 0xb9, 0x4b, 0x22, 0x49, 0xc1, 0x18, 0x0a, 0x43, 0x6b, 0x1e, 0x72, 0xcb, 0x69, 0x84, 0xaf, 0xd7, - 0xae, 0xdb, 0x2b, 0xa8, 0x65, 0x65, 0x90, 0xda, 0x3d, 0x03, 0x95, 0xed, 0xa5, 0xdb, 0xb4, 0x8e, - 0x26, 0xc7, 0xac, 0xc0, 0x59, 0x32, 0xf6, 0xfc, 0x7b, 0x05, 0x36, 0x86, 0xe2, 0x54, 0xbc, 0x0b, - 0xca, 0x1b, 0x1a, 0x62, 0x1c, 0x2b, 0x90, 0x7c, 0xb8, 0xe8, 0x5b, 0x19, 0x4c, 0x9c, 0xb0, 0x8b, - 0x58, 0xc6, 0x61, 0x94, 0xca, 0x48, 0x5e, 0xd0, 0x49, 0x46, 0xea, 0xd5, 0xd4, 0x44, 0xf8, 0x63, - 0x50, 0xc5, 0xdd, 0x8a, 0xdf, 0x8a, 0x09, 0x99, 0x97, 0x8f, 0xfe, 0xe4, 0x26, 0xbc, 0x9a, 0x9f, - 0x02, 0x93, 0x00, 0xaf, 0xea, 0xa6, 0xee, 0x63, 0xbd, 0x96, 0x05, 0x65, 0xca, 0x27, 0xa0, 0x8a, - 0x21, 0x4c, 0xce, 0xca, 0x5c, 0x47, 0xc9, 0x59, 0xd9, 0x59, 0xdd, 0x45, 0xf8, 0x53, 0x28, 0xc5, - 0xa2, 0xe2, 0xb7, 0xd3, 0xbd, 0xa7, 0x66, 0x51, 0xaf, 0xdf, 0x0e, 0xac, 0x0a, 0x0c, 0x40, 0x4b, - 0x3f, 0x15, 0xfc, 0xce, 0x4d, 0x6e, 0xca, 0xb2, 0xfa, 0xd3, 0xbf, 0x0f, 0x8a, 0x62, 0x9d, 0xfd, - 0xcb, 0x65, 0x03, 0x5d, 0x2d, 0x1b, 0xe8, 0xe7, 0x65, 0x03, 0xfd, 0xba, 0x6c, 0xa0, 0xef, 0x7e, - 0x6b, 0xe4, 0xbe, 0x7c, 0x37, 0xf5, 0x21, 0xea, 0x06, 0x0b, 0xdb, 0x6e, 0x8d, 0xe9, 0x59, 0xdb, - 0xa5, 0xde, 0x24, 0x68, 0x59, 0x0b, 0xa7, 0x2d, 0x2a, 0xfe, 0x90, 0xaf, 0xee, 0x53, 0x6f, 0x6f, - 0x68, 0xbe, 0x3e, 0x1c, 0xc8, 0xeb, 0x79, 0xa4, 0xf2, 0x4f, 0xd3, 0x8f, 0xfe, 0x0a, 0x00, 0x00, - 0xff, 0xff, 0x4f, 0x13, 0xa2, 0x69, 0x4e, 0x0b, 0x00, 0x00, + // 905 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x57, 0x4f, 0x6f, 0x1b, 0x45, + 0x14, 0xcf, 0x78, 0xed, 0x8d, 0xfb, 0xbc, 0x4e, 0xad, 0x89, 0x29, 0xd6, 0xb6, 0x72, 0x22, 0xab, + 0x20, 0x23, 0xe4, 0x75, 0x28, 0x12, 0x94, 0x13, 0xaa, 0x63, 0xa5, 0xb6, 0x10, 0x4d, 0x18, 0xa3, + 0x4a, 0x70, 0x5b, 0xaf, 0xc7, 0xf6, 0x52, 0x67, 0xd7, 0xdd, 0x3f, 0xb1, 0x72, 0xe1, 0xc6, 0xb9, + 0x57, 0x8e, 0x9c, 0xf9, 0x0c, 0x7c, 0x80, 0x5e, 0x90, 0x7a, 0x44, 0x1c, 0x22, 0x64, 0x8e, 0x7c, + 0x01, 0x24, 0x2e, 0x68, 0xfe, 0xec, 0xbf, 0x14, 0x07, 0xb0, 0x0f, 0xee, 0xc9, 0x33, 0xbf, 0xf7, + 0x7b, 0x6f, 0xe6, 0xfd, 0xe6, 0xcd, 0x1b, 0x2f, 0x54, 0xdd, 0xe1, 0x37, 0xd4, 0x0a, 0xda, 0x3e, + 0xf5, 0x2e, 0x6c, 0x8b, 0x1a, 0x73, 0xcf, 0x0d, 0x5c, 0xac, 0x0a, 0x54, 0xaf, 0x78, 0x74, 0xec, + 0xb7, 0x83, 0xcb, 0x39, 0xf5, 0x85, 0x45, 0xc7, 0x92, 0x9f, 0xc6, 0xf6, 0x7d, 0xea, 0xfb, 0xb6, + 0xeb, 0x64, 0x89, 0x32, 0x62, 0xfb, 0x9c, 0x06, 0xa6, 0xc4, 0xaa, 0x11, 0x76, 0x41, 0x3d, 0x7b, + 0x7c, 0x29, 0xd1, 0xd6, 0xc4, 0x0e, 0xa6, 0xe1, 0xd0, 0xb0, 0xdc, 0xf3, 0xf6, 0xc4, 0x9d, 0xb8, + 0x6d, 0x0e, 0x0f, 0xc3, 0x31, 0x9f, 0xf1, 0x09, 0x1f, 0x09, 0x7a, 0xe3, 0x67, 0x04, 0xf0, 0x98, + 0x06, 0x84, 0x3e, 0x0f, 0xa9, 0x1f, 0xe0, 0x16, 0xec, 0x3e, 0x1a, 0x8d, 0x3c, 0xea, 0xfb, 0x35, + 0x74, 0x88, 0x9a, 0xa5, 0x07, 0x65, 0x83, 0x6d, 0xda, 0x90, 0x60, 0x27, 0xff, 0xf2, 0xea, 0x60, + 0x87, 0x44, 0x1c, 0x5c, 0x01, 0x85, 0x98, 0x8b, 0x5a, 0xee, 0x10, 0x35, 0x8b, 0x84, 0x0d, 0xf1, + 0x43, 0xc8, 0x7f, 0x4e, 0x03, 0xb3, 0x36, 0xe4, 0xde, 0xba, 0x11, 0x29, 0x21, 0x17, 0x60, 0xb6, + 0x1e, 0x35, 0x47, 0xd4, 0xeb, 0x14, 0x59, 0xa8, 0x57, 0x57, 0x07, 0x88, 0x70, 0x0f, 0xdc, 0x05, + 0xf5, 0x29, 0x4f, 0xa4, 0x66, 0x71, 0xdf, 0xc6, 0x75, 0x5f, 0x6e, 0xb5, 0x2d, 0x33, 0xb0, 0x5d, + 0xe7, 0xb5, 0x18, 0xd2, 0xb7, 0xf1, 0x02, 0x41, 0x89, 0xe7, 0xe3, 0xcf, 0x5d, 0xc7, 0xa7, 0xb8, + 0x09, 0x52, 0x7d, 0x99, 0xcf, 0x9e, 0x21, 0xa6, 0xc6, 0x29, 0xff, 0xe9, 0xed, 0x10, 0x69, 0xc7, + 0x77, 0xa0, 0x70, 0x3c, 0x0d, 0x9d, 0x67, 0x3c, 0x1b, 0xad, 0xb7, 0x43, 0xc4, 0x14, 0x7f, 0x22, + 0x33, 0x12, 0xbb, 0xba, 0x9b, 0xda, 0x95, 0x58, 0x62, 0x75, 0x4a, 0x1d, 0x05, 0x10, 0x69, 0xfc, + 0x94, 0x03, 0x38, 0x0b, 0x63, 0x85, 0x3f, 0x02, 0x55, 0xb0, 0xe5, 0x86, 0xee, 0x45, 0x1b, 0x4a, + 0x38, 0x6c, 0x28, 0x38, 0x6c, 0x7b, 0x62, 0xb4, 0x72, 0x7b, 0x5b, 0x16, 0x5c, 0xff, 0x0a, 0x6e, + 0xc5, 0xdb, 0xc5, 0xef, 0x82, 0x7a, 0x7a, 0x83, 0xda, 0x44, 0x5a, 0xf1, 0x7d, 0x28, 0x7c, 0xe9, + 0x3e, 0xa3, 0x0e, 0x4f, 0x86, 0xd1, 0x64, 0xcd, 0x1b, 0x1c, 0x25, 0xc2, 0x28, 0xe4, 0x5b, 0x40, + 0x89, 0x2b, 0x23, 0xcf, 0xf3, 0x7f, 0x16, 0xe8, 0xfa, 0x87, 0xd7, 0x78, 0x91, 0x83, 0x72, 0x97, + 0xce, 0x68, 0x40, 0xd7, 0xbc, 0x1c, 0xef, 0xc1, 0xee, 0xe9, 0xc2, 0xa1, 0x5e, 0xbf, 0x2b, 0xce, + 0xac, 0x73, 0x9b, 0xd9, 0x7f, 0xbd, 0x3a, 0x88, 0x60, 0x12, 0x0d, 0x12, 0x3d, 0x94, 0x1b, 0xf4, + 0xd8, 0xfa, 0xdd, 0xfa, 0x0c, 0xf6, 0x22, 0x41, 0xe4, 0x69, 0x6c, 0x20, 0xef, 0x5f, 0x08, 0x4a, + 0xcc, 0x14, 0x89, 0xfb, 0xf0, 0x5f, 0xc4, 0x8d, 0xc5, 0x93, 0x40, 0xa2, 0xf3, 0x21, 0x94, 0x4e, + 0xc2, 0xd9, 0x4c, 0xac, 0xe3, 0xcb, 0x66, 0x94, 0x86, 0xa2, 0x36, 0xa5, 0xbc, 0x39, 0x6d, 0xea, + 0x39, 0x68, 0x22, 0x79, 0x29, 0xe4, 0x7f, 0xbd, 0x38, 0x1b, 0x08, 0xfe, 0x27, 0x82, 0xf2, 0x80, + 0x9a, 0x9e, 0x35, 0x4d, 0xea, 0xb9, 0x74, 0xec, 0x3a, 0x81, 0x69, 0x8b, 0x22, 0x45, 0xbc, 0x48, + 0x4b, 0x52, 0x67, 0xe5, 0xb8, 0xdf, 0x25, 0x69, 0x3b, 0xae, 0x42, 0xe1, 0x8b, 0x90, 0x7a, 0x97, + 0xa2, 0x9a, 0x89, 0x98, 0xe0, 0x06, 0x68, 0x7c, 0xf0, 0x94, 0x7a, 0xac, 0x62, 0xb9, 0xc8, 0x65, + 0x92, 0xc1, 0xb6, 0xae, 0xf6, 0xb7, 0xb0, 0x17, 0x65, 0x2e, 0xf5, 0xfe, 0x00, 0x6e, 0xc9, 0xf2, + 0xa1, 0xac, 0xde, 0x94, 0x55, 0x97, 0x39, 0x61, 0x6d, 0x22, 0xfd, 0x1f, 0x08, 0x6e, 0xb3, 0x47, + 0xc9, 0x74, 0x26, 0xeb, 0x37, 0x93, 0x02, 0x77, 0x97, 0x1d, 0xb3, 0x1c, 0xd5, 0x07, 0x07, 0x25, + 0x59, 0x30, 0xb6, 0xae, 0xb6, 0x0d, 0x95, 0x24, 0x59, 0xa9, 0xb7, 0x0e, 0xc5, 0x13, 0xcf, 0x9c, + 0x9c, 0x53, 0x47, 0x54, 0xb8, 0x46, 0xe2, 0xf9, 0x26, 0xc2, 0x7e, 0x97, 0x83, 0xfd, 0x68, 0xad, + 0x9e, 0xe9, 0x4f, 0xd7, 0x14, 0xf7, 0x7d, 0x50, 0x79, 0x08, 0xd6, 0x3c, 0x94, 0x55, 0xea, 0x4a, + 0x0a, 0xc6, 0x90, 0x1f, 0x98, 0xb3, 0x80, 0x17, 0xba, 0x46, 0xf8, 0x78, 0xeb, 0x92, 0x2f, 0xa0, + 0x9a, 0x95, 0x41, 0xca, 0x7e, 0x1f, 0x54, 0x36, 0x97, 0x35, 0xae, 0x75, 0x34, 0x79, 0xb9, 0xf3, + 0x9c, 0x25, 0x6d, 0x1b, 0x1c, 0xc0, 0x83, 0x1f, 0x14, 0xd8, 0x1d, 0x08, 0x3a, 0x3e, 0x02, 0xe5, + 0x31, 0x0d, 0x30, 0x8e, 0xc4, 0x4b, 0xfe, 0x56, 0xea, 0xfb, 0x19, 0x4c, 0x44, 0x3d, 0x42, 0xcc, + 0xe3, 0x2c, 0x4c, 0x79, 0x24, 0x7f, 0x81, 0x12, 0x8f, 0xd4, 0xe3, 0xdf, 0x44, 0xf8, 0x63, 0x50, + 0xc5, 0x13, 0x84, 0xdf, 0x8a, 0x08, 0x99, 0x37, 0x5a, 0xbf, 0x73, 0x1d, 0x8e, 0x2f, 0x7c, 0x9e, + 0xa5, 0x80, 0xe3, 0xb8, 0xa9, 0xb7, 0x47, 0xaf, 0x66, 0xc1, 0xf8, 0x71, 0x53, 0x45, 0xd7, 0x48, + 0xd6, 0xca, 0xf4, 0xcf, 0x64, 0xad, 0x6c, 0x73, 0x39, 0x42, 0xf8, 0x53, 0x28, 0x46, 0xe7, 0x81, + 0xdf, 0x4e, 0xe7, 0x9e, 0xea, 0x00, 0x7a, 0xed, 0x75, 0x43, 0x1c, 0xa0, 0x0f, 0x5a, 0xfa, 0x40, + 0xf1, 0xdd, 0xeb, 0xdc, 0x54, 0xb5, 0xeb, 0xf7, 0xfe, 0xd9, 0x28, 0x82, 0x75, 0x9e, 0xbc, 0x5c, + 0xd6, 0xd1, 0xab, 0x65, 0x1d, 0xfd, 0xb2, 0xac, 0xa3, 0xdf, 0x96, 0x75, 0xf4, 0xfd, 0xef, 0xf5, + 0x9d, 0xaf, 0xdf, 0x49, 0x7d, 0x26, 0x38, 0xfe, 0xdc, 0xb2, 0x5a, 0x23, 0x7a, 0xd1, 0x76, 0xa8, + 0x3b, 0xf6, 0x5b, 0xe6, 0xdc, 0x6e, 0x8b, 0x88, 0x3f, 0xe6, 0x2a, 0x4f, 0xa8, 0x7b, 0x32, 0x30, + 0x1e, 0x9d, 0xf5, 0xe5, 0x53, 0x34, 0x54, 0xf9, 0x87, 0xc3, 0x87, 0x7f, 0x07, 0x00, 0x00, 0xff, + 0xff, 0xd3, 0xb9, 0x0e, 0x2b, 0xec, 0x0c, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1498,6 +1514,18 @@ func (m *GetResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } + { + size, err := m.ResponseMetaHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x9a if m.R != nil { { size := m.R.Size() @@ -1719,6 +1747,18 @@ func (m *PutResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } + { + size, err := m.ResponseMetaHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x9a { size, err := m.Address.MarshalToSizedBuffer(dAtA[:i]) if err != nil { @@ -1839,6 +1879,18 @@ func (m *DeleteResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } + { + size, err := m.ResponseMetaHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x9a return len(dAtA) - i, nil } @@ -1947,6 +1999,18 @@ func (m *HeadResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } + { + size, err := m.ResponseMetaHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x9a if m.Object != nil { { size, err := m.Object.MarshalToSizedBuffer(dAtA[:i]) @@ -2059,6 +2123,18 @@ func (m *SearchResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } + { + size, err := m.ResponseMetaHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x9a if len(m.Addresses) > 0 { for iNdEx := len(m.Addresses) - 1; iNdEx >= 0; iNdEx-- { { @@ -2171,6 +2247,18 @@ func (m *GetRangeResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } + { + size, err := m.ResponseMetaHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x9a if len(m.Fragment) > 0 { i -= len(m.Fragment) copy(dAtA[i:], m.Fragment) @@ -2287,6 +2375,18 @@ func (m *GetRangeHashResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } + { + size, err := m.ResponseMetaHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x9a if len(m.Hashes) > 0 { for iNdEx := len(m.Hashes) - 1; iNdEx >= 0; iNdEx-- { { @@ -2345,6 +2445,8 @@ func (m *GetResponse) Size() (n int) { if m.R != nil { n += m.R.Size() } + l = m.ResponseMetaHeader.Size() + n += 2 + l + sovService(uint64(l)) if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -2446,6 +2548,8 @@ func (m *PutResponse) Size() (n int) { _ = l l = m.Address.Size() n += 1 + l + sovService(uint64(l)) + l = m.ResponseMetaHeader.Size() + n += 2 + l + sovService(uint64(l)) if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -2482,6 +2586,8 @@ func (m *DeleteResponse) Size() (n int) { } var l int _ = l + l = m.ResponseMetaHeader.Size() + n += 2 + l + sovService(uint64(l)) if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -2522,6 +2628,8 @@ func (m *HeadResponse) Size() (n int) { l = m.Object.Size() n += 1 + l + sovService(uint64(l)) } + l = m.ResponseMetaHeader.Size() + n += 2 + l + sovService(uint64(l)) if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -2565,6 +2673,8 @@ func (m *SearchResponse) Size() (n int) { n += 1 + l + sovService(uint64(l)) } } + l = m.ResponseMetaHeader.Size() + n += 2 + l + sovService(uint64(l)) if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -2601,6 +2711,8 @@ func (m *GetRangeResponse) Size() (n int) { if l > 0 { n += 1 + l + sovService(uint64(l)) } + l = m.ResponseMetaHeader.Size() + n += 2 + l + sovService(uint64(l)) if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -2647,6 +2759,8 @@ func (m *GetRangeHashResponse) Size() (n int) { n += 1 + l + sovService(uint64(l)) } } + l = m.ResponseMetaHeader.Size() + n += 2 + l + sovService(uint64(l)) if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -2929,6 +3043,39 @@ func (m *GetResponse) Unmarshal(dAtA []byte) error { copy(v, dAtA[iNdEx:postIndex]) m.R = &GetResponse_Chunk{v} iNdEx = postIndex + case 99: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ResponseMetaHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ResponseMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipService(dAtA[iNdEx:]) @@ -3330,6 +3477,39 @@ func (m *PutResponse) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 99: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ResponseMetaHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ResponseMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipService(dAtA[iNdEx:]) @@ -3606,6 +3786,39 @@ func (m *DeleteResponse) Unmarshal(dAtA []byte) error { return fmt.Errorf("proto: DeleteResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { + case 99: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ResponseMetaHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ResponseMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipService(dAtA[iNdEx:]) @@ -3889,6 +4102,39 @@ func (m *HeadResponse) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 99: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ResponseMetaHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ResponseMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipService(dAtA[iNdEx:]) @@ -4183,6 +4429,39 @@ func (m *SearchResponse) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 99: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ResponseMetaHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ResponseMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipService(dAtA[iNdEx:]) @@ -4457,6 +4736,39 @@ func (m *GetRangeResponse) Unmarshal(dAtA []byte) error { m.Fragment = []byte{} } iNdEx = postIndex + case 99: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ResponseMetaHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ResponseMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipService(dAtA[iNdEx:]) @@ -4767,6 +5079,39 @@ func (m *GetRangeHashResponse) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 99: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ResponseMetaHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ResponseMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipService(dAtA[iNdEx:]) diff --git a/object/service.proto b/object/service.proto index f208472..dbd2a80 100644 --- a/object/service.proto +++ b/object/service.proto @@ -73,6 +73,9 @@ message GetResponse { // Chunk of remaining payload bytes Chunk = 2; } + + // ResponseMetaHeader contains meta information based on request processing by server (should be embedded into message) + service.ResponseMetaHeader Meta = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; } message PutRequest { @@ -99,6 +102,8 @@ message PutRequest { message PutResponse { // Address of object (container id + object id) refs.Address Address = 1 [(gogoproto.nullable) = false]; + // ResponseMetaHeader contains meta information based on request processing by server (should be embedded into message) + service.ResponseMetaHeader Meta = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; } message DeleteRequest { // Address of object (container id + object id) @@ -115,7 +120,10 @@ message DeleteRequest { // DeleteResponse is empty because we cannot guarantee permanent object removal // in distributed system. -message DeleteResponse {} +message DeleteResponse { + // ResponseMetaHeader contains meta information based on request processing by server (should be embedded into message) + service.ResponseMetaHeader Meta = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; +} message HeadRequest { // Address of object (container id + object id) @@ -132,6 +140,8 @@ message HeadRequest { message HeadResponse { // Object without payload Object Object = 1; + // ResponseMetaHeader contains meta information based on request processing by server (should be embedded into message) + service.ResponseMetaHeader Meta = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; } message SearchRequest { @@ -150,6 +160,8 @@ message SearchRequest { message SearchResponse { // Addresses of found objects repeated refs.Address Addresses = 1 [(gogoproto.nullable) = false]; + // ResponseMetaHeader contains meta information based on request processing by server (should be embedded into message) + service.ResponseMetaHeader Meta = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; } message GetRangeRequest { @@ -166,6 +178,8 @@ message GetRangeRequest { message GetRangeResponse { // Fragment of object's payload bytes Fragment = 1; + // ResponseMetaHeader contains meta information based on request processing by server (should be embedded into message) + service.ResponseMetaHeader Meta = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; } message GetRangeHashRequest { @@ -184,5 +198,7 @@ message GetRangeHashRequest { message GetRangeHashResponse { // Hashes is a homomorphic hashes of all ranges repeated bytes Hashes = 1 [(gogoproto.customtype) = "Hash", (gogoproto.nullable) = false]; + // ResponseMetaHeader contains meta information based on request processing by server (should be embedded into message) + service.ResponseMetaHeader Meta = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; } diff --git a/service/meta.pb.go b/service/meta.pb.go index 9b2f430..b4769e2 100644 --- a/service/meta.pb.go +++ b/service/meta.pb.go @@ -88,14 +88,71 @@ func (m *RequestMetaHeader) GetVersion() uint32 { return 0 } +// ResponseMetaHeader contains meta information based on request processing by server +// (should be embedded into message) +type ResponseMetaHeader struct { + // Current NeoFS epoch on server + Epoch uint64 `protobuf:"varint,1,opt,name=Epoch,proto3" json:"Epoch,omitempty"` + // Version defines protocol version + // TODO: not used for now, should be implemented in future + Version uint32 `protobuf:"varint,2,opt,name=Version,proto3" json:"Version,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ResponseMetaHeader) Reset() { *m = ResponseMetaHeader{} } +func (m *ResponseMetaHeader) String() string { return proto.CompactTextString(m) } +func (*ResponseMetaHeader) ProtoMessage() {} +func (*ResponseMetaHeader) Descriptor() ([]byte, []int) { + return fileDescriptor_a638867e7b43457c, []int{1} +} +func (m *ResponseMetaHeader) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ResponseMetaHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *ResponseMetaHeader) XXX_Merge(src proto.Message) { + xxx_messageInfo_ResponseMetaHeader.Merge(m, src) +} +func (m *ResponseMetaHeader) XXX_Size() int { + return m.Size() +} +func (m *ResponseMetaHeader) XXX_DiscardUnknown() { + xxx_messageInfo_ResponseMetaHeader.DiscardUnknown(m) +} + +var xxx_messageInfo_ResponseMetaHeader proto.InternalMessageInfo + +func (m *ResponseMetaHeader) GetEpoch() uint64 { + if m != nil { + return m.Epoch + } + return 0 +} + +func (m *ResponseMetaHeader) GetVersion() uint32 { + if m != nil { + return m.Version + } + return 0 +} + func init() { proto.RegisterType((*RequestMetaHeader)(nil), "service.RequestMetaHeader") + proto.RegisterType((*ResponseMetaHeader)(nil), "service.ResponseMetaHeader") } func init() { proto.RegisterFile("service/meta.proto", fileDescriptor_a638867e7b43457c) } var fileDescriptor_a638867e7b43457c = []byte{ - // 220 bytes of a gzipped FileDescriptorProto + // 244 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x2a, 0x4e, 0x2d, 0x2a, 0xcb, 0x4c, 0x4e, 0xd5, 0xcf, 0x4d, 0x2d, 0x49, 0xd4, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x87, 0x8a, 0x49, 0xe9, 0xa6, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0xa7, @@ -104,12 +161,14 @@ var fileDescriptor_a638867e7b43457c = []byte{ 0x48, 0x4d, 0x4c, 0x49, 0x2d, 0x12, 0x12, 0xe0, 0x62, 0x0e, 0x09, 0xf1, 0x91, 0x60, 0x54, 0x60, 0xd4, 0xe0, 0x0d, 0x02, 0x31, 0x85, 0x44, 0xb8, 0x58, 0x5d, 0x0b, 0xf2, 0x93, 0x33, 0x24, 0x98, 0x14, 0x18, 0x35, 0x58, 0x82, 0x20, 0x1c, 0x21, 0x09, 0x2e, 0xf6, 0xb0, 0xd4, 0xa2, 0xe2, 0xcc, - 0xfc, 0x3c, 0x09, 0x66, 0xb0, 0x5a, 0x18, 0xd7, 0x29, 0xe0, 0xc4, 0x23, 0x39, 0xc6, 0x0b, 0x8f, - 0xe4, 0x18, 0x6f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e, 0x71, 0xc6, 0x63, 0x39, 0x86, 0x28, - 0x35, 0x24, 0xb7, 0xe5, 0x15, 0x17, 0x24, 0x27, 0xeb, 0xa6, 0xa4, 0x96, 0xe9, 0xe7, 0xa5, 0xe6, - 0xa7, 0x15, 0xeb, 0x26, 0x16, 0x64, 0xea, 0x43, 0xfd, 0xb0, 0x8a, 0x49, 0xd0, 0x2f, 0x35, 0xdf, - 0x2d, 0x58, 0xcf, 0x31, 0xc0, 0x53, 0x2f, 0x18, 0x22, 0x96, 0xc4, 0x06, 0x76, 0xaf, 0x31, 0x20, - 0x00, 0x00, 0xff, 0xff, 0x78, 0x63, 0x03, 0x7b, 0xfd, 0x00, 0x00, 0x00, + 0xfc, 0x3c, 0x09, 0x66, 0xb0, 0x5a, 0x18, 0x57, 0xc9, 0x85, 0x4b, 0x28, 0x28, 0xb5, 0xb8, 0x20, + 0x3f, 0xaf, 0x38, 0x15, 0xc9, 0x5c, 0xb8, 0x29, 0x8c, 0x38, 0x4c, 0x61, 0x42, 0x31, 0xc5, 0x29, + 0xe0, 0xc4, 0x23, 0x39, 0xc6, 0x0b, 0x8f, 0xe4, 0x18, 0x6f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, + 0x8e, 0x71, 0xc6, 0x63, 0x39, 0x86, 0x28, 0x35, 0x24, 0x1f, 0xe6, 0x15, 0x17, 0x24, 0x27, 0xeb, + 0xa6, 0xa4, 0x96, 0xe9, 0xe7, 0xa5, 0xe6, 0xa7, 0x15, 0xeb, 0x26, 0x16, 0x64, 0xea, 0x43, 0x43, + 0x62, 0x15, 0x93, 0xa0, 0x5f, 0x6a, 0xbe, 0x5b, 0xb0, 0x9e, 0x63, 0x80, 0xa7, 0x5e, 0x30, 0x44, + 0x2c, 0x89, 0x0d, 0xec, 0x6b, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0xd5, 0x3a, 0x21, 0x1a, + 0x43, 0x01, 0x00, 0x00, } func (m *RequestMetaHeader) Marshal() (dAtA []byte, err error) { @@ -154,6 +213,43 @@ func (m *RequestMetaHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *ResponseMetaHeader) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ResponseMetaHeader) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ResponseMetaHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.Version != 0 { + i = encodeVarintMeta(dAtA, i, uint64(m.Version)) + i-- + dAtA[i] = 0x10 + } + if m.Epoch != 0 { + i = encodeVarintMeta(dAtA, i, uint64(m.Epoch)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + func encodeVarintMeta(dAtA []byte, offset int, v uint64) int { offset -= sovMeta(v) base := offset @@ -186,6 +282,24 @@ func (m *RequestMetaHeader) Size() (n int) { return n } +func (m *ResponseMetaHeader) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Epoch != 0 { + n += 1 + sovMeta(uint64(m.Epoch)) + } + if m.Version != 0 { + n += 1 + sovMeta(uint64(m.Version)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + func sovMeta(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -303,6 +417,98 @@ func (m *RequestMetaHeader) Unmarshal(dAtA []byte) error { } return nil } +func (m *ResponseMetaHeader) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMeta + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ResponseMetaHeader: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ResponseMetaHeader: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Epoch", wireType) + } + m.Epoch = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMeta + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Epoch |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) + } + m.Version = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMeta + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Version |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipMeta(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthMeta + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthMeta + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipMeta(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/service/meta.proto b/service/meta.proto index 5ca3633..97017c9 100644 --- a/service/meta.proto +++ b/service/meta.proto @@ -18,3 +18,13 @@ message RequestMetaHeader { // TODO: not used for now, should be implemented in future uint32 Version = 3; } + +// ResponseMetaHeader contains meta information based on request processing by server +// (should be embedded into message) +message ResponseMetaHeader { + // Current NeoFS epoch on server + uint64 Epoch = 1; + // Version defines protocol version + // TODO: not used for now, should be implemented in future + uint32 Version = 2; +} From a21e42ea4fed167b90e59d2aa8b9b748f30e0dc6 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 14 Feb 2020 12:14:19 +0300 Subject: [PATCH 0109/1196] Implement Epoch and Version setters on ResponseMetaHeader --- service/meta.go | 6 ++++++ service/meta_test.go | 14 ++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/service/meta.go b/service/meta.go index 95c1b13..dc2cdd3 100644 --- a/service/meta.go +++ b/service/meta.go @@ -62,6 +62,12 @@ const ( ErrIncorrectTTL = internal.Error("incorrect ttl") ) +// SetVersion sets protocol version to ResponseMetaHeader. +func (m *ResponseMetaHeader) SetVersion(v uint32) { m.Version = v } + +// SetEpoch sets Epoch to ResponseMetaHeader. +func (m *ResponseMetaHeader) SetEpoch(v uint64) { m.Epoch = v } + // SetVersion sets protocol version to RequestMetaHeader. func (m *RequestMetaHeader) SetVersion(v uint32) { m.Version = v } diff --git a/service/meta_test.go b/service/meta_test.go index e208dfe..083ccd6 100644 --- a/service/meta_test.go +++ b/service/meta_test.go @@ -88,3 +88,17 @@ func TestMetaRequest(t *testing.T) { }) } } + +func TestRequestMetaHeader_SetEpoch(t *testing.T) { + m := new(ResponseMetaHeader) + epoch := uint64(3) + m.SetEpoch(epoch) + require.Equal(t, epoch, m.GetEpoch()) +} + +func TestRequestMetaHeader_SetVersion(t *testing.T) { + m := new(ResponseMetaHeader) + version := uint32(3) + m.SetVersion(version) + require.Equal(t, version, m.GetVersion()) +} From 04ead038592aa32eac60e25751c0654033eccb67 Mon Sep 17 00:00:00 2001 From: alexvanin Date: Tue, 18 Feb 2020 12:04:09 +0300 Subject: [PATCH 0110/1196] Update changelog for v0.4.0 --- CHANGELOG.md | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 124d349..d832568 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog -This is the changelog for NeoFS Proto +This is the changelog for NeoFS API + +## [0.4.0] - 2020-02-18 + +### Added +- Meta header for all gRPC responses. It contains epoch stamp and version number. +### Changed +- Endianness in accounting cheque. Now it uses little endian for cheaper +decoding in neofs smart-contract. ## [0.3.2] - 2020-02-10 @@ -189,3 +197,4 @@ Initial public release [0.3.0]: https://github.com/nspcc-dev/neofs-api/compare/v0.2.14...v0.3.0 [0.3.1]: https://github.com/nspcc-dev/neofs-api/compare/v0.3.0...v0.3.1 [0.3.2]: https://github.com/nspcc-dev/neofs-api/compare/v0.3.1...v0.3.2 +[0.4.0]: https://github.com/nspcc-dev/neofs-api/compare/v0.3.2...v0.4.0 From 6ad2e90d82750358fe165ebc3affdddf70e3eb87 Mon Sep 17 00:00:00 2001 From: alexvanin Date: Mon, 2 Mar 2020 13:59:31 +0300 Subject: [PATCH 0111/1196] dep: Update neofs-crypto library to v0.3.0 New version of neofs-crypto library fixes bug with `SignRFC6979()` function. This function used in accounting library to sign withdraw cheque. --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 7882e96..161343f 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/golang/protobuf v1.3.3 github.com/google/uuid v1.1.1 github.com/mr-tron/base58 v1.1.3 - github.com/nspcc-dev/neofs-crypto v0.2.3 + github.com/nspcc-dev/neofs-crypto v0.3.0 github.com/nspcc-dev/netmap v1.6.1 github.com/nspcc-dev/tzhash v1.4.0 github.com/pkg/errors v0.9.1 diff --git a/go.sum b/go.sum index bb83093..92bb732 100644 --- a/go.sum +++ b/go.sum @@ -112,8 +112,8 @@ github.com/mr-tron/base58 v1.1.3/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjW github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/nspcc-dev/hrw v1.0.8 h1:vwRuJXZXgkMvf473vFzeWGCfY1WBVeSHAEHvR4u3/Cg= github.com/nspcc-dev/hrw v1.0.8/go.mod h1:l/W2vx83vMQo6aStyx2AuZrJ+07lGv2JQGlVkPG06MU= -github.com/nspcc-dev/neofs-crypto v0.2.3 h1:aca3X2aly92ENRbFK+kH6Hd+J9EQ4Eu6XMVoITSIKtc= -github.com/nspcc-dev/neofs-crypto v0.2.3/go.mod h1:8w16GEJbH6791ktVqHN9YRNH3s9BEEKYxGhlFnp0cDw= +github.com/nspcc-dev/neofs-crypto v0.3.0 h1:zlr3pgoxuzrmGCxc5W8dGVfA9Rro8diFvVnBg0L4ifM= +github.com/nspcc-dev/neofs-crypto v0.3.0/go.mod h1:8w16GEJbH6791ktVqHN9YRNH3s9BEEKYxGhlFnp0cDw= github.com/nspcc-dev/netmap v1.6.1 h1:Pigqpqi6QSdRiusbq5XlO20A18k6Eyu7j9MzOfAE3CM= github.com/nspcc-dev/netmap v1.6.1/go.mod h1:mhV3UOg9ljQmu0teQShD6+JYX09XY5gu2I4hIByCH9M= github.com/nspcc-dev/rfc6979 v0.2.0 h1:3e1WNxrN60/6N0DW7+UYisLeZJyfqZTNOjeV/toYvOE= From a213d10b3a5ff7a9fb407d173592fee12f86e8e8 Mon Sep 17 00:00:00 2001 From: alexvanin Date: Mon, 2 Mar 2020 14:10:05 +0300 Subject: [PATCH 0112/1196] Update changelog for v0.4.1 --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d832568..de5255e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,11 @@ # Changelog This is the changelog for NeoFS API +## [0.4.1] - 2020-03-02 + +### Changed +- Updated neofs-crypto library to v0.3.0 + ## [0.4.0] - 2020-02-18 ### Added @@ -198,3 +203,4 @@ Initial public release [0.3.1]: https://github.com/nspcc-dev/neofs-api/compare/v0.3.0...v0.3.1 [0.3.2]: https://github.com/nspcc-dev/neofs-api/compare/v0.3.1...v0.3.2 [0.4.0]: https://github.com/nspcc-dev/neofs-api/compare/v0.3.2...v0.4.0 +[0.4.1]: https://github.com/nspcc-dev/neofs-api/compare/v0.4.0...v0.4.1 From eab0a26cc07fc675fa01bec1ea0fdd1a0d37c6d3 Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Mon, 16 Mar 2020 18:34:13 +0300 Subject: [PATCH 0113/1196] [NPE] check that header exists, otherwise return empty string --- object/service.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/object/service.go b/object/service.go index b0afc55..e75c9f2 100644 --- a/object/service.go +++ b/object/service.go @@ -124,7 +124,12 @@ func (m *GetResponse) NotFull() bool { return checkIsNotFull(m) } func (m *PutRequest) NotFull() bool { return checkIsNotFull(m) } // CID returns container id value from object put request. -func (m *PutRequest) CID() CID { return m.GetHeader().Object.SystemHeader.CID } +func (m *PutRequest) CID() CID { + if header := m.GetHeader(); header != nil { + return header.Object.SystemHeader.CID + } + return refs.CID{} +} // CID returns container id value from object get request. func (m *GetRequest) CID() CID { return m.Address.CID } From ea0703e089f5df26b0b489f4e2335d0e9a2ad3a3 Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Mon, 16 Mar 2020 18:34:56 +0300 Subject: [PATCH 0114/1196] add tests case to prevent npe --- object/service_test.go | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 object/service_test.go diff --git a/object/service_test.go b/object/service_test.go new file mode 100644 index 0000000..f06e557 --- /dev/null +++ b/object/service_test.go @@ -0,0 +1,28 @@ +package object + +import ( + "fmt" + "testing" + + "github.com/stretchr/testify/require" +) + +func TestRequest(t *testing.T) { + cases := []Request{ + &PutRequest{}, + &GetRequest{}, + &HeadRequest{}, + &SearchRequest{}, + &DeleteRequest{}, + &GetRangeRequest{}, + &GetRangeHashRequest{}, + } + + for i := range cases { + v := cases[i] + + t.Run(fmt.Sprintf("%T", v), func(t *testing.T) { + require.NotPanics(t, func() { v.CID() }) + }) + } +} From 164897604764d2f6ac75d2b0e7adc4549643cf54 Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Mon, 16 Mar 2020 18:37:57 +0300 Subject: [PATCH 0115/1196] drop go 1.11 from tests --- .github/workflows/go.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index d846055..77b6a5e 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - go: [ '1.11.x', '1.12.x', '1.13.x'] + go: [ '1.12.x', '1.13.x', '1.14.x'] steps: - name: Setup go From 5a63112f5356b4f5de2bc7d59c761dedb26bc15f Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Mon, 16 Mar 2020 18:43:48 +0300 Subject: [PATCH 0116/1196] ci cache modules --- .github/workflows/go.yml | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 77b6a5e..e74d31a 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -1,5 +1,17 @@ name: Go -on: [push] +on: + push: + branches: + - master + - develop + paths-ignore: + - '*.md' + pull_request: + branches: + - master + - develop + paths-ignore: + - '*.md' jobs: test: @@ -14,9 +26,10 @@ jobs: uses: actions/setup-go@v1 with: go-version: ${{ matrix.go }} + id: go - name: Check out code into the Go module directory - uses: actions/checkout@v1 + uses: actions/checkout@v2 - name: Set GOPATH # temporary fix @@ -26,6 +39,13 @@ jobs: echo "##[add-path]$(dirname $GITHUB_WORKSPACE)/bin" shell: bash + - uses: actions/cache@v1 + with: + path: ~/go/pkg/mod + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- + - name: Get dependencies run: | go get -u -v golang.org/x/lint/golint From f3d0f43eb3107e03d1eaa0f793137f9a6a27a42a Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Mon, 16 Mar 2020 18:58:27 +0300 Subject: [PATCH 0117/1196] CHANGELOG --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index de5255e..f271707 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,11 @@ # Changelog This is the changelog for NeoFS API +## [0.4.2] - 2020-03-16 + +### Fixed +- NPE bug with CID method of object.PutRequest + ## [0.4.1] - 2020-03-02 ### Changed @@ -204,3 +209,4 @@ Initial public release [0.3.2]: https://github.com/nspcc-dev/neofs-api/compare/v0.3.1...v0.3.2 [0.4.0]: https://github.com/nspcc-dev/neofs-api/compare/v0.3.2...v0.4.0 [0.4.1]: https://github.com/nspcc-dev/neofs-api/compare/v0.4.0...v0.4.1 +[0.4.2]: https://github.com/nspcc-dev/neofs-api/compare/v0.4.1...v0.4.2 From b118f469d268ab42c76df228255a164f650c4d83 Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Tue, 31 Mar 2020 10:05:26 +0300 Subject: [PATCH 0118/1196] Migrate to new repo --- CHANGELOG.md | 42 ++++++------- README.md | 8 +-- accounting/service.go | 6 +- accounting/service.pb.go | 54 ++++++++-------- accounting/service.proto | 2 +- accounting/types.go | 8 +-- accounting/types.pb.go | 64 +++++++++---------- accounting/types.proto | 2 +- accounting/types_test.go | 6 +- accounting/withdraw.go | 2 +- accounting/withdraw.pb.go | 80 +++++++++++------------ accounting/withdraw.proto | 2 +- bootstrap/service.go | 2 +- bootstrap/service.pb.go | 50 +++++++-------- bootstrap/service.proto | 2 +- bootstrap/types.go | 2 +- bootstrap/types.pb.go | 49 ++++++++------- bootstrap/types.proto | 2 +- chain/address.go | 2 +- container/service.go | 4 +- container/service.pb.go | 80 +++++++++++------------ container/service.proto | 2 +- container/types.go | 4 +- container/types.pb.go | 52 +++++++-------- container/types.proto | 2 +- container/types_test.go | 2 +- decimal/decimal.pb.go | 12 ++-- decimal/decimal.proto | 2 +- go.mod | 4 +- hash/hash.go | 2 +- object/extensions.go | 2 +- object/service.go | 10 +-- object/service.pb.go | 122 ++++++++++++++++++------------------ object/service.proto | 2 +- object/sg.go | 4 +- object/sg_test.go | 4 +- object/types.go | 6 +- object/types.pb.go | 122 ++++++++++++++++++------------------ object/types.proto | 2 +- object/utils.go | 2 +- object/verification_test.go | 6 +- query/types.pb.go | 12 ++-- query/types.proto | 2 +- refs/address.go | 2 +- refs/owner.go | 2 +- refs/types.go | 4 +- refs/types.pb.go | 12 ++-- refs/types.proto | 2 +- service/meta.go | 2 +- service/meta.pb.go | 14 ++--- service/meta.proto | 2 +- service/verify.go | 4 +- service/verify.pb.go | 13 ++-- service/verify.proto | 2 +- service/verify_test.go | 2 +- service/verify_test.pb.go | 42 ++++++------- service/verify_test.proto | 2 +- session/service.go | 2 +- session/service.pb.go | 54 ++++++++-------- session/service.proto | 2 +- session/store.go | 2 +- session/store_test.go | 2 +- session/types.go | 6 +- session/types.pb.go | 50 +++++++-------- session/types.proto | 2 +- state/service.pb.go | 71 ++++++++++----------- state/service.proto | 2 +- storagegroup/storage.go | 2 +- storagegroup/types.go | 4 +- storagegroup/types.pb.go | 50 +++++++-------- storagegroup/types.proto | 2 +- 71 files changed, 603 insertions(+), 600 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f271707..559435c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -189,24 +189,24 @@ associated with owner id Initial public release -[0.2.0]: https://github.com/nspcc-dev/neofs-api/compare/v0.1.0...v0.2.0 -[0.2.1]: https://github.com/nspcc-dev/neofs-api/compare/v0.2.0...v0.2.1 -[0.2.2]: https://github.com/nspcc-dev/neofs-api/compare/v0.2.1...v0.2.2 -[0.2.3]: https://github.com/nspcc-dev/neofs-api/compare/v0.2.2...v0.2.3 -[0.2.4]: https://github.com/nspcc-dev/neofs-api/compare/v0.2.3...v0.2.4 -[0.2.5]: https://github.com/nspcc-dev/neofs-api/compare/v0.2.4...v0.2.5 -[0.2.6]: https://github.com/nspcc-dev/neofs-api/compare/v0.2.5...v0.2.6 -[0.2.7]: https://github.com/nspcc-dev/neofs-api/compare/v0.2.6...v0.2.7 -[0.2.8]: https://github.com/nspcc-dev/neofs-api/compare/v0.2.7...v0.2.8 -[0.2.9]: https://github.com/nspcc-dev/neofs-api/compare/v0.2.8...v0.2.9 -[0.2.10]: https://github.com/nspcc-dev/neofs-api/compare/v0.2.9...v0.2.10 -[0.2.11]: https://github.com/nspcc-dev/neofs-api/compare/v0.2.10...v0.2.11 -[0.2.12]: https://github.com/nspcc-dev/neofs-api/compare/v0.2.11...v0.2.12 -[0.2.13]: https://github.com/nspcc-dev/neofs-api/compare/v0.2.12...v0.2.13 -[0.2.14]: https://github.com/nspcc-dev/neofs-api/compare/v0.2.13...v0.2.14 -[0.3.0]: https://github.com/nspcc-dev/neofs-api/compare/v0.2.14...v0.3.0 -[0.3.1]: https://github.com/nspcc-dev/neofs-api/compare/v0.3.0...v0.3.1 -[0.3.2]: https://github.com/nspcc-dev/neofs-api/compare/v0.3.1...v0.3.2 -[0.4.0]: https://github.com/nspcc-dev/neofs-api/compare/v0.3.2...v0.4.0 -[0.4.1]: https://github.com/nspcc-dev/neofs-api/compare/v0.4.0...v0.4.1 -[0.4.2]: https://github.com/nspcc-dev/neofs-api/compare/v0.4.1...v0.4.2 +[0.2.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v0.1.0...v0.2.0 +[0.2.1]: https://github.com/nspcc-dev/neofs-api-go/compare/v0.2.0...v0.2.1 +[0.2.2]: https://github.com/nspcc-dev/neofs-api-go/compare/v0.2.1...v0.2.2 +[0.2.3]: https://github.com/nspcc-dev/neofs-api-go/compare/v0.2.2...v0.2.3 +[0.2.4]: https://github.com/nspcc-dev/neofs-api-go/compare/v0.2.3...v0.2.4 +[0.2.5]: https://github.com/nspcc-dev/neofs-api-go/compare/v0.2.4...v0.2.5 +[0.2.6]: https://github.com/nspcc-dev/neofs-api-go/compare/v0.2.5...v0.2.6 +[0.2.7]: https://github.com/nspcc-dev/neofs-api-go/compare/v0.2.6...v0.2.7 +[0.2.8]: https://github.com/nspcc-dev/neofs-api-go/compare/v0.2.7...v0.2.8 +[0.2.9]: https://github.com/nspcc-dev/neofs-api-go/compare/v0.2.8...v0.2.9 +[0.2.10]: https://github.com/nspcc-dev/neofs-api-go/compare/v0.2.9...v0.2.10 +[0.2.11]: https://github.com/nspcc-dev/neofs-api-go/compare/v0.2.10...v0.2.11 +[0.2.12]: https://github.com/nspcc-dev/neofs-api-go/compare/v0.2.11...v0.2.12 +[0.2.13]: https://github.com/nspcc-dev/neofs-api-go/compare/v0.2.12...v0.2.13 +[0.2.14]: https://github.com/nspcc-dev/neofs-api-go/compare/v0.2.13...v0.2.14 +[0.3.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v0.2.14...v0.3.0 +[0.3.1]: https://github.com/nspcc-dev/neofs-api-go/compare/v0.3.0...v0.3.1 +[0.3.2]: https://github.com/nspcc-dev/neofs-api-go/compare/v0.3.1...v0.3.2 +[0.4.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v0.3.2...v0.4.0 +[0.4.1]: https://github.com/nspcc-dev/neofs-api-go/compare/v0.4.0...v0.4.1 +[0.4.2]: https://github.com/nspcc-dev/neofs-api-go/compare/v0.4.1...v0.4.2 diff --git a/README.md b/README.md index 1320e72..8820d58 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ # NeoFS API -![Go](https://github.com/nspcc-dev/neofs-api/workflows/Go/badge.svg) -[![codecov](https://codecov.io/gh/nspcc-dev/neofs-api/branch/master/graph/badge.svg)](https://codecov.io/gh/nspcc-dev/neofs-api) -[![Report](https://goreportcard.com/badge/github.com/nspcc-dev/neofs-api)](https://goreportcard.com/report/github.com/nspcc-dev/neofs-api) -[![GitHub release](https://img.shields.io/github/release/nspcc-dev/neofs-api.svg)](https://github.com/nspcc-dev/neofs-api) +![Go](https://github.com/nspcc-dev/neofs-api-go/workflows/Go/badge.svg) +[![codecov](https://codecov.io/gh/nspcc-dev/neofs-api-go/branch/master/graph/badge.svg)](https://codecov.io/gh/nspcc-dev/neofs-api-go) +[![Report](https://goreportcard.com/badge/github.com/nspcc-dev/neofs-api-go)](https://goreportcard.com/report/github.com/nspcc-dev/neofs-api-go) +[![GitHub release](https://img.shields.io/github/release/nspcc-dev/neofs-api.svg)](https://github.com/nspcc-dev/neofs-api-go) ![GitHub license](https://img.shields.io/github/license/nspcc-dev/neofs-api.svg?style=popout) --- diff --git a/accounting/service.go b/accounting/service.go index 5f8f889..229707f 100644 --- a/accounting/service.go +++ b/accounting/service.go @@ -1,9 +1,9 @@ package accounting import ( - "github.com/nspcc-dev/neofs-api/decimal" - "github.com/nspcc-dev/neofs-api/internal" - "github.com/nspcc-dev/neofs-api/refs" + "github.com/nspcc-dev/neofs-api-go/decimal" + "github.com/nspcc-dev/neofs-api-go/internal" + "github.com/nspcc-dev/neofs-api-go/refs" ) type ( diff --git a/accounting/service.pb.go b/accounting/service.pb.go index 5b485ce..8dd146b 100644 --- a/accounting/service.pb.go +++ b/accounting/service.pb.go @@ -8,8 +8,8 @@ import ( fmt "fmt" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/golang/protobuf/proto" - decimal "github.com/nspcc-dev/neofs-api/decimal" - service "github.com/nspcc-dev/neofs-api/service" + decimal "github.com/nspcc-dev/neofs-api-go/decimal" + service "github.com/nspcc-dev/neofs-api-go/service" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" @@ -132,32 +132,32 @@ func init() { func init() { proto.RegisterFile("accounting/service.proto", fileDescriptor_7f9514b8f1d4c7fe) } var fileDescriptor_7f9514b8f1d4c7fe = []byte{ - // 396 bytes of a gzipped FileDescriptorProto + // 399 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x51, 0xcd, 0x8e, 0xd3, 0x30, - 0x18, 0x5c, 0x2f, 0x68, 0x17, 0xb9, 0x2b, 0x16, 0x99, 0x05, 0x45, 0x41, 0x4a, 0xab, 0x9e, 0xba, - 0x48, 0x75, 0xa4, 0x70, 0x80, 0x6b, 0xa3, 0x0a, 0xb1, 0x12, 0x3f, 0xab, 0x20, 0xed, 0x81, 0x9b, - 0xe3, 0x7e, 0x0d, 0x16, 0x5b, 0x3b, 0xc4, 0x4e, 0x50, 0xdf, 0x84, 0x67, 0xe0, 0x15, 0x78, 0x81, - 0x1e, 0x7b, 0x44, 0x1c, 0x2a, 0x14, 0x5e, 0x04, 0xd5, 0x71, 0x9a, 0x16, 0x38, 0xd9, 0x9e, 0xf9, - 0x66, 0x3c, 0x1e, 0x63, 0x8f, 0x71, 0xae, 0x4a, 0x69, 0x84, 0xcc, 0x42, 0x0d, 0x45, 0x25, 0x38, - 0xd0, 0xbc, 0x50, 0x46, 0x11, 0xdc, 0x31, 0x3e, 0x71, 0x54, 0xb8, 0x00, 0xc3, 0x1a, 0xde, 0xbf, - 0x68, 0xb1, 0x0a, 0x0a, 0x31, 0x5f, 0x3a, 0xf4, 0xd1, 0x0c, 0xb8, 0x58, 0xb0, 0xdb, 0xd0, 0xad, - 0x0e, 0x7e, 0xbc, 0x77, 0x8d, 0x59, 0xe6, 0xa0, 0x1d, 0x3e, 0xce, 0x84, 0xf9, 0x58, 0xa6, 0x94, - 0xab, 0x45, 0x98, 0xa9, 0x4c, 0x85, 0x16, 0x4e, 0xcb, 0xb9, 0x3d, 0xd9, 0x83, 0xdd, 0x35, 0xe3, - 0xc3, 0xef, 0x08, 0xdf, 0x8f, 0xd9, 0x2d, 0x93, 0x1c, 0x12, 0xf8, 0x5c, 0x82, 0x36, 0xe4, 0x12, - 0x9f, 0xbe, 0xfb, 0x22, 0xa1, 0xb8, 0x9a, 0x7a, 0x68, 0x80, 0x46, 0x67, 0xf1, 0xf9, 0x6a, 0xd3, - 0x3f, 0xfa, 0xb9, 0xe9, 0xb7, 0x70, 0xd2, 0x6e, 0xc8, 0x0b, 0x7c, 0xf7, 0x0d, 0x18, 0xe6, 0xa5, - 0x03, 0x34, 0xea, 0x45, 0x3e, 0x6d, 0xdf, 0xeb, 0xac, 0xb6, 0xdc, 0x2b, 0x60, 0x33, 0x28, 0xe2, - 0x7b, 0x5b, 0x8f, 0xf5, 0xa6, 0x8f, 0x12, 0xab, 0x20, 0x53, 0x7c, 0x72, 0x63, 0x5f, 0xe9, 0x71, - 0xab, 0x1d, 0xfe, 0xad, 0xb5, 0xac, 0xe0, 0xcc, 0x08, 0x25, 0xff, 0xf1, 0x70, 0xda, 0x61, 0x85, - 0xcf, 0x77, 0xe1, 0x75, 0xae, 0xa4, 0x06, 0xf2, 0x14, 0x9f, 0x3a, 0xc8, 0xa6, 0xef, 0x45, 0x0f, - 0x68, 0x5b, 0xdc, 0xb4, 0x59, 0x93, 0x76, 0x80, 0x3c, 0xc7, 0x67, 0xaf, 0x15, 0xff, 0x34, 0x69, - 0x9a, 0xd4, 0xde, 0xf1, 0xe0, 0xce, 0xa8, 0x17, 0x3d, 0xa4, 0x5d, 0xb5, 0xd4, 0x71, 0xc9, 0xc1, - 0x60, 0x74, 0x8d, 0xf1, 0x64, 0x37, 0x43, 0xe2, 0xdd, 0x95, 0xc4, 0xdf, 0xd7, 0x1e, 0xf6, 0xea, - 0x3f, 0xf9, 0x2f, 0xd7, 0xc4, 0x8e, 0x6f, 0x56, 0x75, 0x80, 0xd6, 0x75, 0x80, 0x7e, 0xd4, 0x01, - 0xfa, 0x55, 0x07, 0xe8, 0xeb, 0xef, 0xe0, 0xe8, 0xc3, 0xe5, 0xde, 0x67, 0x4a, 0x9d, 0x73, 0x3e, - 0x9e, 0x41, 0x15, 0x4a, 0x50, 0x73, 0x3d, 0x66, 0xb9, 0x08, 0x3b, 0xc3, 0x6f, 0xc7, 0x17, 0x6f, - 0x41, 0xbd, 0x7c, 0x4f, 0x27, 0xd7, 0x57, 0xb4, 0xcb, 0x96, 0x9e, 0xd8, 0x6f, 0x7e, 0xf6, 0x27, - 0x00, 0x00, 0xff, 0xff, 0x21, 0xfc, 0xc3, 0x0b, 0x96, 0x02, 0x00, 0x00, + 0x18, 0x5c, 0x2f, 0x68, 0x17, 0xb9, 0x2b, 0x16, 0x99, 0x05, 0x45, 0x41, 0x4a, 0xab, 0x9e, 0x0a, + 0x22, 0x8e, 0x14, 0x0e, 0x70, 0x6d, 0x54, 0x21, 0x56, 0xe2, 0x67, 0x15, 0x24, 0x24, 0xb8, 0x39, + 0xee, 0xd7, 0x60, 0xb1, 0xb5, 0x43, 0xec, 0x04, 0xed, 0x9b, 0xf0, 0x0c, 0xbc, 0x02, 0x2f, 0xb0, + 0xc7, 0x1e, 0x11, 0x87, 0x0a, 0x85, 0x17, 0x41, 0x75, 0x9c, 0xa6, 0x05, 0x4e, 0xb6, 0x67, 0xbe, + 0x19, 0x8f, 0xc7, 0xd8, 0x63, 0x9c, 0xab, 0x4a, 0x1a, 0x21, 0xf3, 0x48, 0x43, 0x59, 0x0b, 0x0e, + 0xb4, 0x28, 0x95, 0x51, 0x04, 0xf7, 0x8c, 0x4f, 0x1c, 0x15, 0x2d, 0xc1, 0xb0, 0x96, 0xf7, 0xcf, + 0x3a, 0xac, 0x86, 0x52, 0x2c, 0xae, 0x1c, 0x7a, 0x6f, 0x0e, 0x5c, 0x2c, 0xd9, 0x65, 0xe4, 0x56, + 0x07, 0xdf, 0xdf, 0xb9, 0xc6, 0x5c, 0x15, 0xa0, 0x1d, 0x1e, 0xe6, 0xc2, 0x7c, 0xac, 0x32, 0xca, + 0xd5, 0x32, 0xca, 0x55, 0xae, 0x22, 0x0b, 0x67, 0xd5, 0xc2, 0x9e, 0xec, 0xc1, 0xee, 0xda, 0xf1, + 0xf1, 0x77, 0x84, 0x6f, 0x27, 0xec, 0x92, 0x49, 0x0e, 0x29, 0x7c, 0xae, 0x40, 0x1b, 0xf2, 0x10, + 0x1f, 0xbf, 0xf9, 0x22, 0xa1, 0x3c, 0x9f, 0x79, 0x68, 0x84, 0x26, 0x27, 0xc9, 0xe9, 0xf5, 0x7a, + 0x78, 0xf0, 0x73, 0x3d, 0xec, 0xe0, 0xb4, 0xdb, 0x90, 0x67, 0xf8, 0xe6, 0x2b, 0x30, 0xcc, 0xcb, + 0x46, 0x68, 0x32, 0x88, 0x7d, 0xda, 0xbd, 0xd7, 0x59, 0x6d, 0xb8, 0x17, 0xc0, 0xe6, 0x50, 0x26, + 0xb7, 0x36, 0x1e, 0xab, 0xf5, 0x10, 0xa5, 0x56, 0x41, 0x66, 0xf8, 0xe8, 0x9d, 0x7d, 0xa5, 0xc7, + 0xad, 0x76, 0xfc, 0xb7, 0xd6, 0xb2, 0x82, 0x33, 0x23, 0x94, 0xfc, 0xc7, 0xc3, 0x69, 0xc7, 0x35, + 0x3e, 0xdd, 0x86, 0xd7, 0x85, 0x92, 0x1a, 0xc8, 0x23, 0x7c, 0xec, 0x20, 0x9b, 0x7e, 0x10, 0xdf, + 0xa1, 0x5d, 0x71, 0xb3, 0x76, 0x4d, 0xbb, 0x01, 0xf2, 0x14, 0x9f, 0xbc, 0x54, 0xfc, 0xd3, 0xb4, + 0x6d, 0x52, 0x7b, 0x87, 0xa3, 0x1b, 0x93, 0x41, 0x7c, 0x97, 0xf6, 0xd5, 0x52, 0xc7, 0xa5, 0x7b, + 0x83, 0xf1, 0x05, 0xc6, 0xd3, 0xed, 0x0c, 0x49, 0xb6, 0x57, 0x12, 0x7f, 0x57, 0xbb, 0xdf, 0xab, + 0xff, 0xe0, 0xbf, 0x5c, 0x1b, 0x3b, 0x79, 0x7f, 0xdd, 0x04, 0x68, 0xd5, 0x04, 0xe8, 0x47, 0x13, + 0xa0, 0x5f, 0x4d, 0x80, 0xbe, 0xfe, 0x0e, 0x0e, 0x3e, 0x3c, 0xde, 0xf9, 0x4c, 0xa9, 0x0b, 0xce, + 0xc3, 0x39, 0xd4, 0x91, 0x04, 0xb5, 0xd0, 0x21, 0x2b, 0x44, 0x98, 0xab, 0xa8, 0xf7, 0xfc, 0x76, + 0x78, 0xf6, 0x1a, 0xd4, 0xf3, 0xb7, 0x74, 0x7a, 0x71, 0x4e, 0xfb, 0x78, 0xd9, 0x91, 0xfd, 0xe9, + 0x27, 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff, 0xc8, 0x81, 0x29, 0x02, 0x99, 0x02, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/accounting/service.proto b/accounting/service.proto index 12fca58..d1540c4 100644 --- a/accounting/service.proto +++ b/accounting/service.proto @@ -1,6 +1,6 @@ syntax = "proto3"; package accounting; -option go_package = "github.com/nspcc-dev/neofs-api/accounting"; +option go_package = "github.com/nspcc-dev/neofs-api-go/accounting"; option csharp_namespace = "NeoFS.API.Accounting"; import "service/meta.proto"; diff --git a/accounting/types.go b/accounting/types.go index a100cf2..6a3b2e2 100644 --- a/accounting/types.go +++ b/accounting/types.go @@ -7,10 +7,10 @@ import ( "reflect" "github.com/mr-tron/base58" - "github.com/nspcc-dev/neofs-api/chain" - "github.com/nspcc-dev/neofs-api/decimal" - "github.com/nspcc-dev/neofs-api/internal" - "github.com/nspcc-dev/neofs-api/refs" + "github.com/nspcc-dev/neofs-api-go/chain" + "github.com/nspcc-dev/neofs-api-go/decimal" + "github.com/nspcc-dev/neofs-api-go/internal" + "github.com/nspcc-dev/neofs-api-go/refs" crypto "github.com/nspcc-dev/neofs-crypto" "github.com/pkg/errors" ) diff --git a/accounting/types.pb.go b/accounting/types.pb.go index af22ec8..576ba1f 100644 --- a/accounting/types.pb.go +++ b/accounting/types.pb.go @@ -7,7 +7,7 @@ import ( fmt "fmt" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/golang/protobuf/proto" - decimal "github.com/nspcc-dev/neofs-api/decimal" + decimal "github.com/nspcc-dev/neofs-api-go/decimal" io "io" math "math" math_bits "math/bits" @@ -801,37 +801,37 @@ func init() { func init() { proto.RegisterFile("accounting/types.proto", fileDescriptor_437c556d7375b726) } var fileDescriptor_437c556d7375b726 = []byte{ - // 837 bytes of a gzipped FileDescriptorProto + // 840 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x55, 0xcb, 0x6e, 0x23, 0x45, 0x14, 0x75, 0xb5, 0x1d, 0x3f, 0xae, 0x3d, 0xc6, 0xaa, 0xc9, 0x44, 0xc6, 0x12, 0x8e, 0x69, 0xb1, - 0xf0, 0x2c, 0xd2, 0x16, 0x19, 0x91, 0xb0, 0x61, 0xe1, 0x07, 0x61, 0x2c, 0x46, 0x99, 0xa8, 0xe2, - 0x0c, 0x02, 0x56, 0x9d, 0x76, 0xc5, 0x29, 0xc5, 0xae, 0x32, 0xdd, 0xd5, 0x79, 0xfc, 0x04, 0x6b, - 0x36, 0xac, 0xd8, 0xf1, 0x03, 0xfc, 0xc2, 0x2c, 0x61, 0x87, 0x58, 0x44, 0xc8, 0xfc, 0x08, 0xaa, - 0xea, 0xea, 0x76, 0x77, 0x64, 0xc3, 0xc6, 0xbe, 0x8f, 0x73, 0x4f, 0xdd, 0x57, 0x55, 0xc3, 0x9e, - 0xeb, 0x79, 0x22, 0xe4, 0x92, 0xf1, 0x59, 0x4f, 0x3e, 0x2c, 0x69, 0xe0, 0x2c, 0x7d, 0x21, 0x05, - 0x86, 0xb5, 0xbd, 0xf5, 0x62, 0x4a, 0x3d, 0xb6, 0x70, 0xe7, 0x3d, 0xf3, 0x1f, 0x41, 0x5a, 0x07, - 0x33, 0x26, 0xaf, 0xc3, 0x4b, 0xc7, 0x13, 0x8b, 0xde, 0x4c, 0xcc, 0x44, 0x4f, 0x9b, 0x2f, 0xc3, - 0x2b, 0xad, 0x69, 0x45, 0x4b, 0x11, 0xdc, 0xfe, 0xc3, 0x82, 0x52, 0x3f, 0x22, 0xc5, 0x2f, 0xa1, - 0xf4, 0xf6, 0x8e, 0x53, 0x7f, 0x3c, 0x6a, 0xa2, 0x0e, 0xea, 0xd6, 0x06, 0x1f, 0xbc, 0x7f, 0xdc, + 0x30, 0x12, 0x69, 0x8b, 0x8c, 0x48, 0xd8, 0xb0, 0xf0, 0x83, 0x30, 0x16, 0xa3, 0x4c, 0x54, 0x71, + 0x40, 0x03, 0xab, 0x4e, 0xbb, 0xe2, 0x94, 0x62, 0x57, 0x99, 0xee, 0xea, 0x3c, 0x7e, 0x82, 0x35, + 0x1b, 0x56, 0xec, 0xf8, 0x01, 0x7e, 0x61, 0x96, 0xb0, 0x43, 0x2c, 0x22, 0x64, 0x7e, 0x04, 0x55, + 0x75, 0x75, 0xbb, 0x3b, 0xb2, 0x61, 0x63, 0xdf, 0xc7, 0xb9, 0xa7, 0xee, 0xab, 0xaa, 0x61, 0xcf, + 0xf5, 0x3c, 0x11, 0x72, 0xc9, 0xf8, 0xac, 0x27, 0x1f, 0x96, 0x34, 0x70, 0x96, 0xbe, 0x90, 0x02, + 0xc3, 0xda, 0xde, 0x7a, 0x31, 0xa5, 0x1e, 0x5b, 0xb8, 0xf3, 0x9e, 0xf9, 0x8f, 0x20, 0xad, 0x83, + 0x19, 0x93, 0xd7, 0xe1, 0xa5, 0xe3, 0x89, 0x45, 0x6f, 0x26, 0x66, 0xa2, 0xa7, 0xcd, 0x97, 0xe1, + 0x95, 0xd6, 0xb4, 0xa2, 0xa5, 0x08, 0x6e, 0xff, 0x61, 0x41, 0xa9, 0x1f, 0x91, 0xe2, 0x8f, 0xa1, + 0xf4, 0xe6, 0x8e, 0x53, 0x7f, 0x3c, 0x6a, 0xa2, 0x0e, 0xea, 0xd6, 0x06, 0xef, 0xbd, 0x7b, 0xdc, 0xcf, 0xfd, 0xf5, 0xb8, 0x1f, 0x9b, 0x49, 0x2c, 0xe0, 0x26, 0x94, 0xfa, 0xd3, 0xa9, 0x4f, 0x83, - 0xa0, 0x69, 0x75, 0x50, 0xb7, 0x42, 0x62, 0x15, 0x7f, 0x02, 0xcf, 0xce, 0x5c, 0x9f, 0x72, 0x19, + 0xa0, 0x69, 0x75, 0x50, 0xb7, 0x42, 0x62, 0x15, 0x7f, 0x04, 0xcf, 0xce, 0x5c, 0x9f, 0x72, 0x19, 0xfb, 0xf3, 0xda, 0x9f, 0x35, 0xe2, 0x43, 0xa8, 0xf6, 0x3d, 0xc9, 0x6e, 0xe9, 0x49, 0xc8, 0xa7, 0x41, 0xb3, 0xd0, 0x41, 0xdd, 0xea, 0x61, 0xc3, 0x89, 0x4b, 0x19, 0x45, 0xff, 0x24, 0x0d, 0xc2, - 0x47, 0x50, 0x7e, 0xc3, 0xae, 0xa8, 0x64, 0x0b, 0xda, 0xdc, 0xd1, 0x01, 0xbb, 0xce, 0xba, 0x1f, - 0x4e, 0xec, 0x1b, 0x14, 0x54, 0xd6, 0x24, 0xc1, 0xe2, 0x23, 0x80, 0x37, 0xc2, 0xbb, 0x99, 0xb8, + 0x47, 0x50, 0x7e, 0xcd, 0xae, 0xa8, 0x64, 0x0b, 0xda, 0xdc, 0xd1, 0x01, 0xbb, 0xce, 0xba, 0x1f, + 0x4e, 0xec, 0x1b, 0x14, 0x54, 0xd6, 0x24, 0xc1, 0xe2, 0x23, 0x80, 0xd7, 0xc2, 0xbb, 0x99, 0xb8, 0xfe, 0x8c, 0xca, 0x66, 0x51, 0x47, 0xee, 0x65, 0x22, 0x13, 0x2f, 0x49, 0x21, 0xf1, 0x31, 0xd4, 0x94, 0x66, 0xba, 0x13, 0x34, 0x4b, 0x9d, 0x7c, 0xb7, 0x7a, 0xf8, 0x3c, 0x1d, 0x69, 0x7c, 0x24, - 0x03, 0xb4, 0x7f, 0x43, 0xe9, 0x13, 0xf1, 0x08, 0xea, 0xdf, 0x30, 0x79, 0x3d, 0xf5, 0xdd, 0x3b, - 0x93, 0x03, 0xd2, 0x39, 0xb4, 0xd2, 0x4c, 0x59, 0xc4, 0xeb, 0x1c, 0x79, 0x12, 0x83, 0xbf, 0x85, - 0x17, 0x43, 0xc1, 0xa5, 0xcb, 0x38, 0xf5, 0x87, 0x3e, 0x75, 0x25, 0x35, 0x64, 0x96, 0x26, 0xfb, - 0x38, 0x4d, 0xb6, 0x11, 0xf8, 0x3a, 0x47, 0x36, 0x33, 0x0c, 0xca, 0x50, 0x8c, 0x24, 0xbb, 0x0f, - 0xe5, 0x81, 0x3b, 0x77, 0xb9, 0x47, 0x03, 0xfc, 0x19, 0x94, 0x93, 0xd2, 0xd1, 0xd6, 0xd2, 0xe3, - 0x6e, 0x27, 0xc5, 0x7f, 0x0f, 0x3b, 0x67, 0xee, 0xc3, 0xf8, 0xad, 0x5a, 0x91, 0xc1, 0x5c, 0x78, - 0x37, 0x66, 0x9b, 0x0a, 0x24, 0x56, 0xf1, 0xe7, 0x50, 0x9b, 0xf8, 0x2e, 0x0f, 0x5c, 0x4f, 0x32, - 0xc1, 0xd5, 0x06, 0x29, 0xf6, 0x7a, 0x9a, 0x7d, 0x72, 0x6f, 0x88, 0x33, 0x48, 0xfb, 0x47, 0xb4, - 0xde, 0x01, 0x7c, 0x0c, 0x85, 0x90, 0xb3, 0xa8, 0x9b, 0xf5, 0xc3, 0x0f, 0x37, 0xed, 0x82, 0x73, - 0xc1, 0x99, 0x1c, 0x94, 0x57, 0x8f, 0xfb, 0x05, 0x25, 0x11, 0x1d, 0x80, 0x77, 0x61, 0xe7, 0x9d, - 0x3b, 0x0f, 0xa9, 0x6e, 0x5d, 0x9e, 0x44, 0x8a, 0xfd, 0x0a, 0x34, 0x06, 0x3f, 0x83, 0xca, 0x05, + 0x03, 0xb4, 0x7f, 0x43, 0xe9, 0x13, 0xf1, 0x08, 0xea, 0xdf, 0x32, 0x79, 0x3d, 0xf5, 0xdd, 0x3b, + 0x93, 0x03, 0xd2, 0x39, 0xb4, 0xd2, 0x4c, 0x59, 0xc4, 0xab, 0x1c, 0x79, 0x12, 0x83, 0xdf, 0xc2, + 0x8b, 0xa1, 0xe0, 0xd2, 0x65, 0x9c, 0xfa, 0x43, 0x9f, 0xba, 0x92, 0x1a, 0x32, 0x4b, 0x93, 0x7d, + 0x98, 0x26, 0xdb, 0x08, 0x7c, 0x95, 0x23, 0x9b, 0x19, 0x06, 0x65, 0x28, 0x46, 0x92, 0xdd, 0x87, + 0xf2, 0xc0, 0x9d, 0xbb, 0xdc, 0xa3, 0x01, 0xfe, 0x0c, 0xca, 0x49, 0xe9, 0x68, 0x6b, 0xe9, 0x71, + 0xb7, 0x93, 0xe2, 0xbf, 0x87, 0x9d, 0x33, 0xf7, 0x61, 0xfc, 0x46, 0xad, 0xc8, 0x60, 0x2e, 0xbc, + 0x1b, 0xb3, 0x4d, 0x05, 0x12, 0xab, 0xf8, 0x73, 0xa8, 0x4d, 0x7c, 0x97, 0x07, 0xae, 0x27, 0x99, + 0xe0, 0x6a, 0x83, 0x14, 0x7b, 0x3d, 0xcd, 0x3e, 0xb9, 0x37, 0xc4, 0x19, 0xa4, 0xfd, 0x23, 0x5a, + 0xef, 0x00, 0x3e, 0x86, 0x42, 0xc8, 0x59, 0xd4, 0xcd, 0xfa, 0xe1, 0xfb, 0x9b, 0x76, 0xc1, 0xb9, + 0xe0, 0x4c, 0x0e, 0xca, 0xab, 0xc7, 0xfd, 0x82, 0x92, 0x88, 0x0e, 0xc0, 0xbb, 0xb0, 0xf3, 0x8d, + 0x3b, 0x0f, 0xa9, 0x6e, 0x5d, 0x9e, 0x44, 0x8a, 0xfd, 0x12, 0x34, 0x06, 0x3f, 0x83, 0xca, 0x05, 0x9f, 0xb3, 0x05, 0x93, 0x74, 0xda, 0xc8, 0xe1, 0x3a, 0xc0, 0x29, 0x15, 0x27, 0xe7, 0x5f, 0x2e, 0x85, 0x77, 0xdd, 0x40, 0xb8, 0x06, 0xe5, 0x53, 0x2a, 0x74, 0x29, 0x0d, 0xcb, 0x7e, 0x44, 0x60, 0x4d, 0xee, 0xf1, 0xa7, 0x50, 0x50, 0xd7, 0xd4, 0xa4, 0xf2, 0x3c, 0x5b, 0x89, 0x33, 0x79, 0x58, @@ -843,18 +843,18 @@ var fileDescriptor_437c556d7375b726 = []byte{ 0x53, 0xbf, 0x91, 0xb7, 0x7f, 0xce, 0x03, 0x9c, 0x53, 0x29, 0xe7, 0x74, 0x41, 0xb9, 0x6e, 0x9d, 0x6e, 0x84, 0x19, 0x69, 0xa4, 0xe0, 0x2f, 0x36, 0x0e, 0x34, 0x33, 0x91, 0x35, 0x87, 0x33, 0xb9, 0xcf, 0x4e, 0xb5, 0x35, 0x82, 0x32, 0xa1, 0x1e, 0x65, 0xb7, 0xd4, 0x37, 0x2d, 0x40, 0x1b, 0x5a, - 0x60, 0xfd, 0x77, 0x0b, 0x5a, 0xa7, 0x50, 0x49, 0xd6, 0x1b, 0x7f, 0x04, 0xf9, 0x61, 0xf2, 0x8c, + 0x60, 0xfd, 0x77, 0x0b, 0x5a, 0xa7, 0x50, 0x49, 0xd6, 0x1b, 0x7f, 0x00, 0xf9, 0x61, 0xf2, 0x8c, 0x55, 0xcd, 0x33, 0xa6, 0x4c, 0x44, 0xfd, 0x60, 0x1b, 0x76, 0xce, 0xbf, 0x1a, 0x8f, 0xa2, 0x4c, 0x6b, 0x83, 0x9a, 0x01, 0x14, 0x94, 0x91, 0x44, 0xae, 0xd6, 0x2f, 0xd1, 0x68, 0xe3, 0x39, 0xa1, 0xd4, 0x9c, 0x46, 0xa9, 0xa3, 0x4c, 0x5e, 0x9d, 0x2d, 0xc5, 0x26, 0x38, 0xb3, 0xcf, 0xa9, 0x1c, 0x87, 0x50, 0x89, 0xcb, 0x56, 0xaf, 0xa4, 0x6a, 0xd9, 0xfe, 0x16, 0x96, 0x18, 0x17, 0x93, 0x24, 0x71, 0xf6, 0xd1, 0x96, 0x67, 0xe1, 0x7f, 0x3a, 0x60, 0x77, 0x9f, 0x3e, 0x4a, 0x78, 0x0f, 0x8a, - 0xc3, 0x6b, 0xfa, 0x43, 0x48, 0x4d, 0xa9, 0x46, 0x1b, 0xbc, 0x7b, 0xbf, 0x6a, 0xa3, 0xdf, 0x57, - 0x6d, 0xf4, 0xe7, 0xaa, 0x8d, 0xfe, 0x5e, 0xb5, 0xd1, 0x4f, 0xff, 0xb4, 0x73, 0xdf, 0xbd, 0x4c, - 0x7d, 0x66, 0x78, 0xb0, 0xf4, 0xbc, 0x83, 0x29, 0xbd, 0xed, 0x71, 0x2a, 0xae, 0x82, 0x03, 0x77, - 0xc9, 0x7a, 0xeb, 0x3a, 0x7e, 0xb5, 0x76, 0xf5, 0x05, 0x72, 0xfa, 0x67, 0xe3, 0xf8, 0xd5, 0x60, - 0x7c, 0x76, 0x59, 0xd4, 0x1f, 0xa0, 0x57, 0xff, 0x06, 0x00, 0x00, 0xff, 0xff, 0xcc, 0x8e, 0x24, - 0x5b, 0xec, 0x06, 0x00, 0x00, + 0xc3, 0x6b, 0xfa, 0x43, 0x48, 0x4d, 0xa9, 0x46, 0x1b, 0xbc, 0x7d, 0xb7, 0x6a, 0xa3, 0xdf, 0x57, + 0x6d, 0xf4, 0xe7, 0xaa, 0x8d, 0xfe, 0x5e, 0xb5, 0xd1, 0x4f, 0xff, 0xb4, 0x73, 0xdf, 0x7d, 0x92, + 0xfa, 0xcc, 0xf0, 0x60, 0xe9, 0x79, 0x07, 0x53, 0x7a, 0xdb, 0xe3, 0x54, 0x5c, 0x05, 0x07, 0xee, + 0x92, 0x1d, 0xcc, 0x44, 0x6f, 0x5d, 0xca, 0xaf, 0xd6, 0xae, 0xbe, 0x43, 0x4e, 0xff, 0x6c, 0x1c, + 0x3f, 0x1c, 0x8c, 0xcf, 0x2e, 0x8b, 0xfa, 0x1b, 0xf4, 0xf2, 0xdf, 0x00, 0x00, 0x00, 0xff, 0xff, + 0xc4, 0xae, 0x74, 0x80, 0xef, 0x06, 0x00, 0x00, } func (m *Account) Marshal() (dAtA []byte, err error) { diff --git a/accounting/types.proto b/accounting/types.proto index 1c0cd57..02fb691 100644 --- a/accounting/types.proto +++ b/accounting/types.proto @@ -1,6 +1,6 @@ syntax = "proto3"; package accounting; -option go_package = "github.com/nspcc-dev/neofs-api/accounting"; +option go_package = "github.com/nspcc-dev/neofs-api-go/accounting"; option csharp_namespace = "NeoFS.API.Accounting"; import "decimal/decimal.proto"; diff --git a/accounting/types_test.go b/accounting/types_test.go index 14aee3b..df81b46 100644 --- a/accounting/types_test.go +++ b/accounting/types_test.go @@ -5,9 +5,9 @@ import ( "testing" "github.com/mr-tron/base58" - "github.com/nspcc-dev/neofs-api/chain" - "github.com/nspcc-dev/neofs-api/decimal" - "github.com/nspcc-dev/neofs-api/refs" + "github.com/nspcc-dev/neofs-api-go/chain" + "github.com/nspcc-dev/neofs-api-go/decimal" + "github.com/nspcc-dev/neofs-api-go/refs" "github.com/nspcc-dev/neofs-crypto/test" "github.com/stretchr/testify/require" ) diff --git a/accounting/withdraw.go b/accounting/withdraw.go index 735fb85..1077395 100644 --- a/accounting/withdraw.go +++ b/accounting/withdraw.go @@ -3,7 +3,7 @@ package accounting import ( "encoding/binary" - "github.com/nspcc-dev/neofs-api/refs" + "github.com/nspcc-dev/neofs-api-go/refs" ) type ( diff --git a/accounting/withdraw.pb.go b/accounting/withdraw.pb.go index d8a8eeb..e0825f5 100644 --- a/accounting/withdraw.pb.go +++ b/accounting/withdraw.pb.go @@ -8,8 +8,8 @@ import ( fmt "fmt" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/golang/protobuf/proto" - decimal "github.com/nspcc-dev/neofs-api/decimal" - service "github.com/nspcc-dev/neofs-api/service" + decimal "github.com/nspcc-dev/neofs-api-go/decimal" + service "github.com/nspcc-dev/neofs-api-go/service" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" @@ -461,46 +461,46 @@ func init() { func init() { proto.RegisterFile("accounting/withdraw.proto", fileDescriptor_b3a38a4dc2575267) } var fileDescriptor_b3a38a4dc2575267 = []byte{ - // 617 bytes of a gzipped FileDescriptorProto + // 620 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x55, 0xc1, 0x6e, 0xd3, 0x4c, 0x10, 0xee, 0xda, 0x69, 0xda, 0x7f, 0xd2, 0x1f, 0xca, 0xaa, 0x14, 0xd7, 0x87, 0x34, 0xf2, 0x01, - 0xa5, 0x12, 0xb5, 0xa5, 0x22, 0x55, 0x20, 0x0e, 0xa8, 0xc1, 0xa2, 0xb5, 0x44, 0x21, 0x32, 0x52, - 0x91, 0xb8, 0x39, 0xce, 0xd4, 0xb1, 0xd4, 0xd8, 0xc1, 0x5e, 0x27, 0xea, 0x43, 0x70, 0xe7, 0x19, - 0x7a, 0xe1, 0xca, 0x23, 0xf4, 0xd8, 0x23, 0x70, 0x88, 0x50, 0x78, 0x07, 0xce, 0xc8, 0xeb, 0x75, - 0xec, 0x34, 0x95, 0xa8, 0x10, 0xa8, 0xe2, 0x94, 0xdd, 0xf9, 0x66, 0x76, 0x67, 0xbe, 0xef, 0xdb, - 0x18, 0x36, 0x1c, 0xd7, 0x0d, 0x93, 0x80, 0xf9, 0x81, 0x67, 0x8c, 0x7c, 0xd6, 0xeb, 0x46, 0xce, - 0x48, 0x1f, 0x44, 0x21, 0x0b, 0x29, 0x14, 0x90, 0x4a, 0x63, 0x8c, 0x86, 0xbe, 0x8b, 0x46, 0x1f, - 0x99, 0x93, 0xe1, 0xea, 0x5a, 0x1e, 0x1b, 0x62, 0xe4, 0x1f, 0x9f, 0x8a, 0xe8, 0xdd, 0x2e, 0xba, - 0x7e, 0xdf, 0x39, 0x31, 0xc4, 0xaf, 0x08, 0x6f, 0x7b, 0x3e, 0xeb, 0x25, 0x1d, 0xdd, 0x0d, 0xfb, - 0x86, 0x17, 0x7a, 0xa1, 0xc1, 0xc3, 0x9d, 0xe4, 0x98, 0xef, 0xf8, 0x86, 0xaf, 0xb2, 0x74, 0xed, - 0x23, 0x81, 0x8a, 0xc5, 0xb0, 0x4f, 0x1b, 0x20, 0x59, 0xa6, 0x42, 0x1a, 0xa4, 0xb9, 0xd2, 0x5a, - 0x3d, 0x1f, 0x6f, 0x2e, 0x7c, 0x1d, 0x6f, 0x2e, 0x3f, 0xeb, 0xe1, 0xbb, 0x04, 0x2d, 0xd3, 0x96, - 0x2c, 0x93, 0x6e, 0xc1, 0xd2, 0xab, 0x51, 0x80, 0x91, 0x65, 0x2a, 0x12, 0x4f, 0xbb, 0x2d, 0xd2, - 0xf2, 0xb0, 0x9d, 0x2f, 0x68, 0x13, 0xaa, 0x7b, 0xfd, 0x74, 0x24, 0x45, 0x6e, 0x90, 0x66, 0x6d, - 0x67, 0x55, 0xcf, 0x9b, 0x34, 0xb3, 0x5f, 0x5b, 0xe0, 0x74, 0x1d, 0xaa, 0x07, 0xe8, 0x7b, 0x3d, - 0xa6, 0x54, 0x1a, 0xa4, 0x59, 0xb1, 0xc5, 0x8e, 0x2a, 0xb0, 0xd4, 0x76, 0x4e, 0x4f, 0x42, 0xa7, - 0xab, 0x2c, 0xa6, 0x97, 0xd9, 0xf9, 0x56, 0xfb, 0x42, 0x00, 0xf6, 0x91, 0xd9, 0x69, 0x67, 0x31, - 0xfb, 0xb3, 0x7d, 0x3f, 0x82, 0xca, 0x21, 0x32, 0x47, 0xe9, 0xf0, 0xae, 0x55, 0x5d, 0x10, 0xaf, - 0x8b, 0xcb, 0x52, 0xec, 0x00, 0x9d, 0x2e, 0x46, 0xad, 0xe5, 0xf4, 0x8c, 0x8b, 0xf1, 0x26, 0xb1, - 0x79, 0x05, 0x35, 0xa1, 0x7a, 0xc4, 0xd5, 0x51, 0x5c, 0x5e, 0xab, 0x5d, 0xae, 0xe5, 0xa8, 0xef, - 0x3a, 0xcc, 0x0f, 0x83, 0xb9, 0x33, 0x44, 0xad, 0xf6, 0x04, 0x6a, 0x7c, 0xb4, 0x78, 0x10, 0x06, - 0x31, 0xd2, 0x07, 0xb0, 0xfc, 0x46, 0x58, 0x85, 0x4f, 0x98, 0x12, 0x59, 0x78, 0x45, 0x4f, 0x75, - 0xb3, 0xa7, 0x19, 0xda, 0x99, 0x04, 0xd0, 0x4e, 0xa6, 0xc4, 0x94, 0xc6, 0x26, 0xd7, 0x96, 0x4b, - 0xba, 0xb6, 0x5c, 0xf2, 0x8c, 0x5c, 0x06, 0xfc, 0x77, 0x88, 0x71, 0xec, 0x78, 0x68, 0x99, 0x5c, - 0xc9, 0x95, 0xd6, 0x1d, 0x71, 0x5d, 0x01, 0xd8, 0xc5, 0xf2, 0xc6, 0x99, 0x36, 0xa0, 0xc6, 0xb9, - 0x12, 0x4c, 0xff, 0xd2, 0x45, 0xda, 0x27, 0x02, 0xb5, 0x17, 0x7e, 0xfc, 0x3b, 0xf4, 0xde, 0xf4, - 0xac, 0xbb, 0xb0, 0x92, 0x75, 0x2e, 0x86, 0xbd, 0x0f, 0x8b, 0xa9, 0x75, 0x62, 0x85, 0x34, 0xe4, - 0x2b, 0x3d, 0x95, 0xc1, 0xda, 0x7b, 0x09, 0xfe, 0x37, 0xf1, 0x04, 0x19, 0xfe, 0x95, 0xc7, 0x36, - 0xe3, 0x19, 0xf9, 0x1f, 0xf0, 0xcc, 0x2a, 0xdc, 0xca, 0xe9, 0xc8, 0x98, 0xdc, 0xf9, 0x41, 0x8a, - 0x17, 0x4a, 0x77, 0x41, 0xde, 0x47, 0x46, 0xd7, 0xcb, 0x74, 0x16, 0x7f, 0x54, 0xea, 0xbd, 0xb9, - 0xb8, 0x90, 0x63, 0x17, 0xe4, 0x76, 0x72, 0xa9, 0xae, 0x78, 0xc7, 0xb3, 0x75, 0x65, 0xcf, 0x3e, - 0x86, 0x4a, 0x2a, 0x2b, 0x9d, 0x49, 0x28, 0x59, 0x54, 0x55, 0xe6, 0x01, 0x51, 0xfa, 0x14, 0xaa, - 0xd9, 0x24, 0x74, 0xa3, 0x9c, 0x33, 0x23, 0xb6, 0xaa, 0x5e, 0x05, 0x65, 0x07, 0xb4, 0x8e, 0xce, - 0x27, 0x75, 0x72, 0x31, 0xa9, 0x93, 0xcf, 0x93, 0x3a, 0xf9, 0x36, 0xa9, 0x93, 0x0f, 0xdf, 0xeb, - 0x0b, 0x6f, 0xb7, 0x4a, 0xdf, 0x9e, 0x20, 0x1e, 0xb8, 0xee, 0x76, 0x17, 0x87, 0x46, 0x80, 0xe1, - 0x71, 0xbc, 0xed, 0x0c, 0x7c, 0xa3, 0x38, 0xef, 0x4c, 0x5a, 0x7b, 0x89, 0xe1, 0xf3, 0xd7, 0xfa, - 0x5e, 0xdb, 0xd2, 0xf7, 0xa6, 0xe1, 0x4e, 0x95, 0x7f, 0x95, 0x1e, 0xfe, 0x0c, 0x00, 0x00, 0xff, - 0xff, 0x72, 0x77, 0x2d, 0x52, 0x2e, 0x07, 0x00, 0x00, + 0x05, 0xa9, 0xb1, 0xa5, 0x22, 0x55, 0x20, 0x0e, 0xa8, 0xc1, 0xa2, 0xb5, 0x44, 0x21, 0x32, 0x12, + 0x08, 0x6e, 0x8e, 0x33, 0x75, 0x2c, 0x35, 0xde, 0x60, 0xaf, 0x5b, 0xf5, 0x21, 0xb8, 0xf3, 0x0c, + 0xbd, 0x70, 0xe5, 0x11, 0x7a, 0xec, 0x11, 0x38, 0x54, 0x28, 0xbc, 0x03, 0x67, 0xe4, 0xf5, 0xba, + 0x76, 0xda, 0x4a, 0x54, 0x08, 0x54, 0x71, 0xca, 0xee, 0x7c, 0x33, 0xbb, 0x33, 0xdf, 0xf7, 0x6d, + 0x0c, 0x2b, 0x9e, 0xef, 0xb3, 0x34, 0xe2, 0x61, 0x14, 0x58, 0x07, 0x21, 0x1f, 0x0e, 0x62, 0xef, + 0xc0, 0x1c, 0xc7, 0x8c, 0x33, 0x0a, 0x25, 0xa4, 0xd3, 0x04, 0xe3, 0xfd, 0xd0, 0x47, 0x6b, 0x84, + 0xdc, 0xcb, 0x71, 0x7d, 0xa9, 0x88, 0xed, 0x63, 0x1c, 0xee, 0x1e, 0xca, 0xe8, 0xed, 0x01, 0xfa, + 0xe1, 0xc8, 0xdb, 0xb3, 0xe4, 0xaf, 0x0c, 0x77, 0x82, 0x90, 0x0f, 0xd3, 0xbe, 0xe9, 0xb3, 0x91, + 0x15, 0xb0, 0x80, 0x59, 0x22, 0xdc, 0x4f, 0x77, 0xc5, 0x4e, 0x6c, 0xc4, 0x2a, 0x4f, 0x37, 0x3e, + 0x12, 0xa8, 0x39, 0x1c, 0x47, 0xb4, 0x05, 0x8a, 0x63, 0x6b, 0xa4, 0x45, 0xda, 0x0b, 0xdd, 0xc5, + 0xe3, 0xd3, 0xd5, 0x99, 0xaf, 0xa7, 0xab, 0xf3, 0x4f, 0x86, 0xf8, 0x2e, 0x45, 0xc7, 0x76, 0x15, + 0xc7, 0xa6, 0xf7, 0x60, 0xee, 0xc5, 0x41, 0x84, 0xb1, 0x63, 0x6b, 0x8a, 0x48, 0xbb, 0x29, 0xd3, + 0x8a, 0xb0, 0x5b, 0x2c, 0x68, 0x1b, 0xea, 0x9b, 0xa3, 0x6c, 0x24, 0x4d, 0x6d, 0x91, 0x76, 0x63, + 0x7d, 0xd1, 0x2c, 0x9a, 0xb4, 0xf3, 0x5f, 0x57, 0xe2, 0x74, 0x19, 0xea, 0xdb, 0x18, 0x06, 0x43, + 0xae, 0xd5, 0x5a, 0xa4, 0x5d, 0x73, 0xe5, 0x8e, 0x6a, 0x30, 0xd7, 0xf3, 0x0e, 0xf7, 0x98, 0x37, + 0xd0, 0x66, 0xb3, 0xcb, 0xdc, 0x62, 0x6b, 0x7c, 0x21, 0x00, 0x5b, 0xc8, 0xdd, 0xac, 0xb3, 0x84, + 0xff, 0xd9, 0xbe, 0x1f, 0x40, 0x6d, 0x07, 0xb9, 0xa7, 0xf5, 0x45, 0xd7, 0xba, 0x29, 0x89, 0x37, + 0xe5, 0x65, 0x19, 0xb6, 0x8d, 0xde, 0x00, 0xe3, 0xee, 0x7c, 0x76, 0xc6, 0xc9, 0xe9, 0x2a, 0x71, + 0x45, 0x05, 0xb5, 0xa1, 0xfe, 0x4a, 0xa8, 0xa3, 0xf9, 0xa2, 0xd6, 0x38, 0x5f, 0x2b, 0xd0, 0xd0, + 0xf7, 0x78, 0xc8, 0xa2, 0x0b, 0x67, 0xc8, 0x5a, 0xe3, 0x11, 0x34, 0xc4, 0x68, 0xc9, 0x98, 0x45, + 0x09, 0xd2, 0x35, 0x98, 0x7f, 0x2d, 0xad, 0x22, 0x26, 0xcc, 0x88, 0x2c, 0xbd, 0x62, 0x66, 0xba, + 0xb9, 0x67, 0x19, 0xc6, 0x91, 0x02, 0xd0, 0x4b, 0xcf, 0x88, 0xa9, 0x8c, 0x4d, 0xae, 0x2c, 0x97, + 0x72, 0x65, 0xb9, 0xd4, 0x29, 0xb9, 0x2c, 0xf8, 0x6f, 0x07, 0x93, 0xc4, 0x0b, 0xd0, 0xb1, 0x85, + 0x92, 0x0b, 0xdd, 0x5b, 0xf2, 0xba, 0x12, 0x70, 0xcb, 0xe5, 0xb5, 0x33, 0x6d, 0x41, 0x43, 0x70, + 0x25, 0x99, 0xfe, 0xa5, 0x8b, 0x8c, 0x4f, 0x04, 0x1a, 0xcf, 0xc2, 0xe4, 0x77, 0xe8, 0xbd, 0xee, + 0x59, 0x37, 0x60, 0x21, 0xef, 0x5c, 0x0e, 0x7b, 0x17, 0x66, 0x33, 0xeb, 0x24, 0x1a, 0x69, 0xa9, + 0x97, 0x7a, 0x2a, 0x87, 0x8d, 0xf7, 0x0a, 0xfc, 0x6f, 0xe3, 0x1e, 0x72, 0xfc, 0x2b, 0x8f, 0x6d, + 0xca, 0x33, 0xea, 0x3f, 0xe0, 0x99, 0x45, 0xb8, 0x51, 0xd0, 0x91, 0x33, 0xb9, 0xfe, 0x83, 0x94, + 0x2f, 0x94, 0x6e, 0x80, 0xba, 0x85, 0x9c, 0x2e, 0x57, 0xe9, 0x2c, 0xff, 0xa8, 0xf4, 0x3b, 0x17, + 0xe2, 0x52, 0x8e, 0x0d, 0x50, 0x7b, 0xe9, 0xb9, 0xba, 0xf2, 0x1d, 0x4f, 0xd7, 0x55, 0x3d, 0xfb, + 0x10, 0x6a, 0x99, 0xac, 0x74, 0x2a, 0xa1, 0x62, 0x51, 0x5d, 0xbb, 0x08, 0xc8, 0xd2, 0xc7, 0x50, + 0xcf, 0x27, 0xa1, 0x2b, 0xd5, 0x9c, 0x29, 0xb1, 0x75, 0xfd, 0x32, 0x28, 0x3f, 0xa0, 0xfb, 0xe6, + 0x78, 0xd2, 0x24, 0x27, 0x93, 0x26, 0xf9, 0x3c, 0x69, 0x92, 0x6f, 0x93, 0x26, 0xf9, 0xf0, 0xbd, + 0x39, 0xf3, 0x76, 0xad, 0xf2, 0xed, 0x89, 0x92, 0xb1, 0xef, 0x77, 0x06, 0xb8, 0x6f, 0x45, 0xc8, + 0x76, 0x93, 0x8e, 0x37, 0x0e, 0x3b, 0x01, 0xb3, 0xca, 0x23, 0x8f, 0x94, 0xa5, 0xe7, 0xc8, 0x9e, + 0xbe, 0x34, 0x37, 0x7b, 0x8e, 0xb9, 0x79, 0x16, 0xee, 0xd7, 0xc5, 0x87, 0xe9, 0xfe, 0xcf, 0x00, + 0x00, 0x00, 0xff, 0xff, 0x87, 0x9f, 0x16, 0xf3, 0x31, 0x07, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/accounting/withdraw.proto b/accounting/withdraw.proto index ee23b5d..080a100 100644 --- a/accounting/withdraw.proto +++ b/accounting/withdraw.proto @@ -1,6 +1,6 @@ syntax = "proto3"; package accounting; -option go_package = "github.com/nspcc-dev/neofs-api/accounting"; +option go_package = "github.com/nspcc-dev/neofs-api-go/accounting"; option csharp_namespace = "NeoFS.API.Accounting"; import "service/meta.proto"; diff --git a/bootstrap/service.go b/bootstrap/service.go index e068728..929d9b3 100644 --- a/bootstrap/service.go +++ b/bootstrap/service.go @@ -1,7 +1,7 @@ package bootstrap import ( - "github.com/nspcc-dev/neofs-api/service" + "github.com/nspcc-dev/neofs-api-go/service" ) // NodeType type alias. diff --git a/bootstrap/service.pb.go b/bootstrap/service.pb.go index fadb464..d1797cc 100644 --- a/bootstrap/service.pb.go +++ b/bootstrap/service.pb.go @@ -8,7 +8,7 @@ import ( fmt "fmt" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/golang/protobuf/proto" - service "github.com/nspcc-dev/neofs-api/service" + service "github.com/nspcc-dev/neofs-api-go/service" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" @@ -85,30 +85,30 @@ func init() { func init() { proto.RegisterFile("bootstrap/service.proto", fileDescriptor_21bce759c9d8eb63) } var fileDescriptor_21bce759c9d8eb63 = []byte{ - // 360 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x51, 0xbf, 0x6e, 0xe2, 0x30, - 0x18, 0xc7, 0x28, 0xc7, 0x1f, 0xdf, 0x66, 0x38, 0x5d, 0x94, 0x21, 0x41, 0x4c, 0x0c, 0x97, 0x44, - 0x82, 0xe5, 0xc6, 0xbb, 0xa8, 0xaa, 0xca, 0x00, 0x42, 0x01, 0x75, 0xe8, 0xe6, 0x24, 0x5f, 0x68, - 0x06, 0x62, 0x37, 0x36, 0x48, 0xbc, 0x49, 0x9f, 0xa1, 0x4f, 0xc2, 0xc8, 0x58, 0x75, 0x88, 0xaa, - 0x54, 0xea, 0x73, 0x54, 0x31, 0x21, 0x45, 0xed, 0x94, 0x7c, 0xbf, 0x7f, 0xfe, 0xf9, 0x33, 0xfe, - 0x1d, 0x30, 0x26, 0x85, 0xcc, 0x28, 0x77, 0x05, 0x64, 0xbb, 0x24, 0x04, 0x87, 0x67, 0x4c, 0x32, - 0xd2, 0xad, 0x09, 0x83, 0x54, 0x8c, 0xbb, 0x01, 0x49, 0x4f, 0xb4, 0xd1, 0x3f, 0x63, 0x3b, 0xc8, - 0x92, 0x78, 0x5f, 0xa1, 0xbf, 0x3e, 0xd3, 0xe4, 0x9e, 0x83, 0xa8, 0x60, 0x7b, 0x9d, 0xc8, 0xfb, - 0x6d, 0xe0, 0x84, 0x6c, 0xe3, 0xae, 0xd9, 0x9a, 0xb9, 0x0a, 0x0e, 0xb6, 0xb1, 0x9a, 0xd4, 0xa0, - 0xfe, 0x4e, 0xf2, 0xe1, 0x3b, 0xc2, 0x6d, 0x1f, 0x1e, 0xb6, 0x20, 0x24, 0xf9, 0x83, 0xb5, 0x32, - 0x49, 0x47, 0x03, 0x34, 0xfa, 0xe1, 0xe9, 0x87, 0xdc, 0x6a, 0xbc, 0xe4, 0x56, 0x67, 0xce, 0x22, - 0x58, 0xed, 0x39, 0x14, 0xb9, 0xa5, 0x95, 0x5f, 0x5f, 0xa9, 0x88, 0x8d, 0xb5, 0x24, 0x8d, 0x99, - 0xde, 0x1c, 0xa0, 0xd1, 0xcf, 0x71, 0xcf, 0xa9, 0xeb, 0x38, 0xa5, 0x61, 0x9a, 0xc6, 0xcc, 0xd3, - 0xca, 0x08, 0x5f, 0xc9, 0xc8, 0x5f, 0xac, 0xcd, 0x40, 0x52, 0x3d, 0x50, 0x72, 0xc3, 0x39, 0x6f, - 0xa0, 0x3a, 0xbc, 0xe4, 0x6e, 0x80, 0x46, 0x90, 0x79, 0x9d, 0xd2, 0x75, 0xcc, 0x2d, 0xe4, 0x2b, - 0x07, 0xb9, 0xc2, 0xad, 0x5b, 0x75, 0x71, 0x3d, 0x54, 0xde, 0xe1, 0x57, 0xaf, 0x62, 0x93, 0x90, - 0xca, 0x84, 0xa5, 0xdf, 0x32, 0x2a, 0xef, 0xf8, 0x1f, 0xee, 0x7a, 0xe7, 0x86, 0x64, 0x82, 0xdb, - 0x8b, 0x8c, 0x85, 0x20, 0x04, 0x21, 0x17, 0xc5, 0xab, 0x3c, 0xa3, 0x7f, 0x81, 0x2d, 0x79, 0x06, - 0x34, 0x9a, 0x51, 0xee, 0xad, 0x0e, 0x85, 0x89, 0x8e, 0x85, 0x89, 0x9e, 0x0b, 0x13, 0xbd, 0x16, - 0x26, 0x7a, 0x7c, 0x33, 0x1b, 0x77, 0xa3, 0x8b, 0x7d, 0xa7, 0x82, 0x87, 0xa1, 0x1d, 0xc1, 0xce, - 0x4d, 0x81, 0xc5, 0xc2, 0xa6, 0x3c, 0x71, 0xeb, 0xa4, 0xa7, 0x66, 0x6f, 0x0e, 0xec, 0x7a, 0xe9, - 0xfc, 0x5f, 0x4c, 0x9d, 0xba, 0x4a, 0xd0, 0x52, 0xef, 0x30, 0xf9, 0x08, 0x00, 0x00, 0xff, 0xff, - 0x7c, 0x15, 0x25, 0x92, 0x1d, 0x02, 0x00, 0x00, + // 364 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x51, 0xbf, 0x6e, 0x9b, 0x40, + 0x18, 0xf7, 0x59, 0xd4, 0x7f, 0xae, 0xdb, 0xd9, 0x55, 0x11, 0x03, 0x58, 0x9e, 0x2c, 0xb5, 0x80, + 0x64, 0x2f, 0x1d, 0x5b, 0x54, 0x55, 0xf5, 0x60, 0xcb, 0xc2, 0x55, 0x23, 0x65, 0x3b, 0xe0, 0x83, + 0x30, 0x98, 0xbb, 0x70, 0x67, 0x4b, 0x7e, 0x93, 0x3c, 0x43, 0x9e, 0xc4, 0xa3, 0xc7, 0x28, 0x03, + 0x8a, 0x88, 0x94, 0xe7, 0x88, 0x38, 0x63, 0x62, 0x25, 0x13, 0x7c, 0xbf, 0x7f, 0xf7, 0xbb, 0xef, + 0xf0, 0xd7, 0x80, 0x31, 0x29, 0x64, 0x4e, 0xb9, 0x2b, 0x20, 0xdf, 0xa5, 0x21, 0x38, 0x3c, 0x67, + 0x92, 0x91, 0x7e, 0x43, 0x18, 0xa4, 0x66, 0xdc, 0x0d, 0x48, 0x7a, 0xa2, 0x8d, 0xe1, 0x19, 0xdb, + 0x41, 0x9e, 0xc6, 0xfb, 0x1a, 0xfd, 0xf2, 0x96, 0x26, 0xf7, 0x1c, 0x44, 0x0d, 0xdb, 0x49, 0x2a, + 0x6f, 0xb6, 0x81, 0x13, 0xb2, 0x8d, 0x9b, 0xb0, 0x84, 0xb9, 0x0a, 0x0e, 0xb6, 0xb1, 0x9a, 0xd4, + 0xa0, 0xfe, 0x4e, 0xf2, 0xf1, 0x0b, 0xc2, 0x5d, 0x1f, 0x6e, 0xb7, 0x20, 0x24, 0xf9, 0x8e, 0xb5, + 0x2a, 0x49, 0x47, 0x23, 0x34, 0xf9, 0xe4, 0xe9, 0x87, 0xc2, 0x6a, 0x3d, 0x16, 0x56, 0x6f, 0xc9, + 0x22, 0xf8, 0xb7, 0xe7, 0x50, 0x16, 0x96, 0x56, 0x7d, 0x7d, 0xa5, 0x22, 0x36, 0xd6, 0xd2, 0x2c, + 0x66, 0x7a, 0x7b, 0x84, 0x26, 0x9f, 0xa7, 0x03, 0xa7, 0xa9, 0xe3, 0x54, 0x86, 0x79, 0x16, 0x33, + 0x4f, 0xab, 0x22, 0x7c, 0x25, 0x23, 0x3f, 0xb0, 0xb6, 0x00, 0x49, 0xf5, 0x40, 0xc9, 0x0d, 0xe7, + 0xbc, 0x81, 0xfa, 0xf0, 0x8a, 0xfb, 0x0b, 0x34, 0x82, 0xdc, 0xeb, 0x55, 0xae, 0x63, 0x61, 0x21, + 0x5f, 0x39, 0xc8, 0x6f, 0xdc, 0xf9, 0xaf, 0x2e, 0xae, 0x87, 0xca, 0x3b, 0x7e, 0xef, 0x55, 0x6c, + 0x1a, 0x52, 0x99, 0xb2, 0xec, 0x43, 0x46, 0xed, 0x9d, 0xfe, 0xc4, 0x7d, 0xef, 0xdc, 0x90, 0xcc, + 0x70, 0x77, 0x95, 0xb3, 0x10, 0x84, 0x20, 0xe4, 0xa2, 0x78, 0x9d, 0x67, 0x0c, 0x2f, 0xb0, 0x35, + 0xcf, 0x81, 0x46, 0x0b, 0xca, 0xbd, 0xab, 0x43, 0x69, 0xa2, 0x63, 0x69, 0xa2, 0x87, 0xd2, 0x44, + 0x4f, 0xa5, 0x89, 0xee, 0x9e, 0xcd, 0xd6, 0xf5, 0xb7, 0x8b, 0x7d, 0x67, 0x82, 0x87, 0xa1, 0x1d, + 0xc1, 0xce, 0xcd, 0x80, 0xc5, 0xc2, 0xa6, 0x3c, 0xb5, 0x13, 0xe6, 0x36, 0x61, 0xf7, 0xed, 0xc1, + 0x12, 0xd8, 0x9f, 0xb5, 0xf3, 0x6b, 0x35, 0x77, 0x9a, 0x36, 0x41, 0x47, 0x3d, 0xc5, 0xec, 0x35, + 0x00, 0x00, 0xff, 0xff, 0xc7, 0x01, 0xac, 0x62, 0x20, 0x02, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/bootstrap/service.proto b/bootstrap/service.proto index db43bf6..e37c878 100644 --- a/bootstrap/service.proto +++ b/bootstrap/service.proto @@ -1,6 +1,6 @@ syntax = "proto3"; package bootstrap; -option go_package = "github.com/nspcc-dev/neofs-api/bootstrap"; +option go_package = "github.com/nspcc-dev/neofs-api-go/bootstrap"; option csharp_namespace = "NeoFS.API.Bootstrap"; import "service/meta.proto"; diff --git a/bootstrap/types.go b/bootstrap/types.go index 6c21b73..690d81c 100644 --- a/bootstrap/types.go +++ b/bootstrap/types.go @@ -7,7 +7,7 @@ import ( "strings" "github.com/golang/protobuf/proto" - "github.com/nspcc-dev/neofs-api/object" + "github.com/nspcc-dev/neofs-api-go/object" ) type ( diff --git a/bootstrap/types.pb.go b/bootstrap/types.pb.go index db83671..fcd8848 100644 --- a/bootstrap/types.pb.go +++ b/bootstrap/types.pb.go @@ -146,30 +146,31 @@ func init() { func init() { proto.RegisterFile("bootstrap/types.proto", fileDescriptor_423083266369adee) } var fileDescriptor_423083266369adee = []byte{ - // 367 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x4c, 0x91, 0x4f, 0x6b, 0xe2, 0x40, - 0x18, 0xc6, 0x33, 0xea, 0xc6, 0xcd, 0xb8, 0x87, 0xdd, 0xa8, 0x10, 0x96, 0x25, 0x09, 0xc2, 0x42, - 0x0e, 0x9a, 0xb0, 0xdb, 0x7e, 0x01, 0x03, 0x2d, 0x48, 0xd1, 0x4a, 0xec, 0xa9, 0xf4, 0x92, 0x3f, - 0xa3, 0x86, 0x62, 0xde, 0x21, 0x33, 0x29, 0xe4, 0xd6, 0x8f, 0xd1, 0xcf, 0xd0, 0x0f, 0x52, 0x3c, - 0xf6, 0x28, 0x3d, 0x84, 0x36, 0xbd, 0xe5, 0x53, 0x14, 0x13, 0x23, 0xde, 0xde, 0xe7, 0x79, 0x7e, - 0x33, 0xf3, 0xce, 0xfb, 0xe2, 0xbe, 0x07, 0xc0, 0x19, 0x8f, 0x5d, 0x6a, 0xf1, 0x94, 0x12, 0x66, - 0xd2, 0x18, 0x38, 0xc8, 0xd2, 0xd1, 0xfe, 0x3d, 0x5a, 0x85, 0x7c, 0x9d, 0x78, 0xa6, 0x0f, 0x1b, - 0x6b, 0x05, 0x2b, 0xb0, 0x4a, 0xc2, 0x4b, 0x96, 0xa5, 0x2a, 0x45, 0x59, 0x55, 0x27, 0x07, 0x37, - 0x58, 0x5a, 0xd0, 0x98, 0xb8, 0xc1, 0xd4, 0xa5, 0x72, 0x0f, 0x7f, 0xbb, 0xa0, 0xe0, 0xaf, 0x15, - 0xa4, 0x23, 0xa3, 0xe5, 0x54, 0x42, 0xfe, 0x87, 0xc5, 0x19, 0xe1, 0x53, 0x97, 0x2a, 0x0d, 0xbd, - 0x69, 0x74, 0xfe, 0x77, 0xcd, 0xe3, 0x6b, 0xe6, 0x0c, 0x02, 0x32, 0x89, 0x96, 0x60, 0xb7, 0xb6, - 0x99, 0x26, 0x38, 0x07, 0x70, 0xf0, 0x82, 0xf0, 0xf7, 0x3a, 0x92, 0xff, 0xe2, 0xf6, 0x38, 0x08, - 0x62, 0xc2, 0x58, 0x79, 0xaf, 0x64, 0x77, 0x8a, 0x4c, 0x6b, 0xbb, 0x95, 0xe5, 0xd4, 0x99, 0x3c, - 0xc4, 0xe2, 0x3c, 0xf1, 0xae, 0x48, 0xaa, 0x34, 0x74, 0x64, 0xfc, 0xb0, 0x7b, 0x45, 0xa6, 0xfd, - 0xa4, 0x89, 0x77, 0x4f, 0xd2, 0x21, 0x6c, 0x42, 0x4e, 0x36, 0x94, 0xa7, 0xce, 0x81, 0x91, 0x2d, - 0xdc, 0xbe, 0xa6, 0x3c, 0x84, 0x88, 0x29, 0x4d, 0xbd, 0x69, 0x48, 0x76, 0xbf, 0xc8, 0xb4, 0x5f, - 0x50, 0x59, 0x27, 0x7c, 0x4d, 0xc9, 0xe7, 0x58, 0x5c, 0x70, 0x97, 0x27, 0x4c, 0x69, 0xed, 0x3f, - 0x67, 0xff, 0xd9, 0x37, 0xfc, 0x96, 0x69, 0x78, 0xdf, 0x67, 0x95, 0x14, 0x99, 0x26, 0xb2, 0xb2, - 0x72, 0x0e, 0xac, 0x7d, 0xb7, 0xfb, 0x50, 0x85, 0xc7, 0x5c, 0x15, 0xb6, 0xb9, 0x8a, 0x5e, 0x73, - 0x15, 0xed, 0x72, 0x15, 0xbd, 0xe7, 0x2a, 0x7a, 0xfa, 0x54, 0x85, 0x5b, 0xe3, 0x64, 0xd6, 0x11, - 0xa3, 0xbe, 0x3f, 0x0a, 0xc8, 0x83, 0x15, 0x11, 0x58, 0xb2, 0x91, 0x4b, 0x43, 0xeb, 0x38, 0xa7, - 0xe7, 0x46, 0x77, 0x46, 0xe0, 0x72, 0x61, 0x8e, 0xe7, 0x13, 0xd3, 0xae, 0x5d, 0x4f, 0x2c, 0x77, - 0x70, 0xf6, 0x15, 0x00, 0x00, 0xff, 0xff, 0xe4, 0xbf, 0x86, 0xf3, 0xd6, 0x01, 0x00, 0x00, + // 370 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x4c, 0x91, 0xdf, 0x8a, 0x9b, 0x40, + 0x14, 0xc6, 0x9d, 0x24, 0x35, 0x75, 0xd2, 0x8b, 0xd6, 0x24, 0x20, 0xa5, 0xa8, 0x04, 0x0a, 0x42, + 0xa3, 0xd2, 0x3f, 0x2f, 0x10, 0xa1, 0x85, 0x50, 0x92, 0x06, 0xd3, 0xab, 0xde, 0x14, 0xff, 0x4c, + 0x8c, 0x2c, 0xf1, 0x0c, 0xce, 0xb8, 0xe0, 0xdd, 0x3e, 0xc6, 0x3e, 0xc3, 0x3e, 0xc8, 0x92, 0xcb, + 0xbd, 0x0c, 0x7b, 0x21, 0xbb, 0xee, 0x9d, 0x4f, 0xb1, 0x44, 0x63, 0xc8, 0xdd, 0xf9, 0xbe, 0xef, + 0x37, 0x33, 0x67, 0xce, 0xc1, 0x63, 0x1f, 0x80, 0x33, 0x9e, 0x7a, 0xd4, 0xe6, 0x39, 0x25, 0xcc, + 0xa2, 0x29, 0x70, 0x90, 0xa5, 0xb3, 0xfd, 0xd1, 0x8c, 0x62, 0xbe, 0xcd, 0x7c, 0x2b, 0x80, 0x9d, + 0x1d, 0x41, 0x04, 0x76, 0x4d, 0xf8, 0xd9, 0xa6, 0x56, 0xb5, 0xa8, 0xab, 0xe6, 0xe4, 0xe4, 0x2f, + 0x96, 0xd6, 0x34, 0x25, 0x5e, 0xb8, 0xf0, 0xa8, 0x3c, 0xc2, 0x6f, 0x7e, 0x52, 0x08, 0xb6, 0x0a, + 0xd2, 0x91, 0xd1, 0x73, 0x1b, 0x21, 0x7f, 0xc5, 0xe2, 0x92, 0xf0, 0x85, 0x47, 0x95, 0x8e, 0xde, + 0x35, 0x06, 0xdf, 0x86, 0xd6, 0xf9, 0x35, 0x6b, 0x09, 0x21, 0x99, 0x27, 0x1b, 0x70, 0x7a, 0xfb, + 0x42, 0x13, 0xdc, 0x13, 0x38, 0xb9, 0x47, 0xf8, 0x6d, 0x1b, 0xc9, 0x9f, 0x71, 0x7f, 0x16, 0x86, + 0x29, 0x61, 0xac, 0xbe, 0x57, 0x72, 0x06, 0x55, 0xa1, 0xf5, 0xbd, 0xc6, 0x72, 0xdb, 0x4c, 0x9e, + 0x62, 0x71, 0x95, 0xf9, 0xbf, 0x49, 0xae, 0x74, 0x74, 0x64, 0xbc, 0x73, 0x46, 0x55, 0xa1, 0xbd, + 0xa7, 0x99, 0x7f, 0x45, 0xf2, 0x29, 0xec, 0x62, 0x4e, 0x76, 0x94, 0xe7, 0xee, 0x89, 0x91, 0x6d, + 0xdc, 0xff, 0x43, 0x79, 0x0c, 0x09, 0x53, 0xba, 0x7a, 0xd7, 0x90, 0x9c, 0x71, 0x55, 0x68, 0x1f, + 0xa0, 0xb1, 0x2e, 0xf8, 0x96, 0x92, 0x7f, 0x60, 0x71, 0xcd, 0x3d, 0x9e, 0x31, 0xa5, 0x77, 0xfc, + 0x9c, 0xf3, 0xe9, 0xd8, 0xf0, 0x63, 0xa1, 0xe1, 0x63, 0x9f, 0x4d, 0x52, 0x15, 0x9a, 0xc8, 0xea, + 0xca, 0x3d, 0xb1, 0xce, 0xff, 0xc3, 0xb3, 0x2a, 0xdc, 0x94, 0xaa, 0xb0, 0x2f, 0x55, 0xf4, 0x50, + 0xaa, 0xe8, 0x50, 0xaa, 0xe8, 0xa9, 0x54, 0xd1, 0xed, 0x8b, 0x2a, 0xfc, 0xfb, 0x72, 0x31, 0xeb, + 0x84, 0xd1, 0x20, 0x30, 0x43, 0x72, 0x6d, 0x27, 0x04, 0x36, 0xcc, 0xf4, 0x68, 0x6c, 0x46, 0x60, + 0x9f, 0x47, 0x75, 0xd7, 0x19, 0x2e, 0x09, 0xfc, 0x5a, 0x5b, 0xb3, 0xd5, 0xdc, 0x72, 0x5a, 0xd7, + 0x17, 0xeb, 0x35, 0x7c, 0x7f, 0x0d, 0x00, 0x00, 0xff, 0xff, 0xef, 0x9f, 0x22, 0x25, 0xd9, 0x01, + 0x00, 0x00, } func (m *SpreadMap) Marshal() (dAtA []byte, err error) { diff --git a/bootstrap/types.proto b/bootstrap/types.proto index cbce379..4ef0fff 100644 --- a/bootstrap/types.proto +++ b/bootstrap/types.proto @@ -1,6 +1,6 @@ syntax = "proto3"; package bootstrap; -option go_package = "github.com/nspcc-dev/neofs-api/bootstrap"; +option go_package = "github.com/nspcc-dev/neofs-api-go/bootstrap"; option csharp_namespace = "NeoFS.API.Bootstrap"; import "github.com/gogo/protobuf/gogoproto/gogo.proto"; diff --git a/chain/address.go b/chain/address.go index bdc8a65..e10301f 100644 --- a/chain/address.go +++ b/chain/address.go @@ -7,7 +7,7 @@ import ( "encoding/hex" "github.com/mr-tron/base58" - "github.com/nspcc-dev/neofs-api/internal" + "github.com/nspcc-dev/neofs-api-go/internal" crypto "github.com/nspcc-dev/neofs-crypto" "github.com/pkg/errors" "golang.org/x/crypto/ripemd160" diff --git a/container/service.go b/container/service.go index 01d88fa..8eb9ba6 100644 --- a/container/service.go +++ b/container/service.go @@ -4,8 +4,8 @@ import ( "bytes" "encoding/binary" - "github.com/nspcc-dev/neofs-api/internal" - "github.com/nspcc-dev/neofs-api/refs" + "github.com/nspcc-dev/neofs-api-go/internal" + "github.com/nspcc-dev/neofs-api-go/refs" "github.com/pkg/errors" ) diff --git a/container/service.pb.go b/container/service.pb.go index b887121..8698925 100644 --- a/container/service.pb.go +++ b/container/service.pb.go @@ -8,7 +8,7 @@ import ( fmt "fmt" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/golang/protobuf/proto" - service "github.com/nspcc-dev/neofs-api/service" + service "github.com/nspcc-dev/neofs-api-go/service" netmap "github.com/nspcc-dev/netmap" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" @@ -391,45 +391,45 @@ func init() { func init() { proto.RegisterFile("container/service.proto", fileDescriptor_e1fa9d7ab2e7ae06) } var fileDescriptor_e1fa9d7ab2e7ae06 = []byte{ - // 598 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x54, 0xcb, 0x6e, 0xd3, 0x4c, - 0x14, 0xee, 0x34, 0xe9, 0xed, 0xb8, 0xff, 0x0f, 0x0c, 0xbd, 0x18, 0x4b, 0xa4, 0x95, 0x57, 0x01, - 0x11, 0x5b, 0x84, 0x4a, 0xb0, 0x61, 0xd1, 0x34, 0xa2, 0x54, 0xa2, 0x10, 0xb9, 0x88, 0x05, 0x3b, - 0x67, 0x7a, 0x12, 0x2c, 0x25, 0x1e, 0xe3, 0x19, 0x07, 0xe5, 0x4d, 0x78, 0x06, 0x90, 0x58, 0xf3, - 0x08, 0x5d, 0x76, 0x89, 0x58, 0x44, 0x28, 0x2c, 0x11, 0xef, 0x80, 0x3c, 0xbe, 0x26, 0x2d, 0xb0, - 0xac, 0xd8, 0x58, 0x33, 0xdf, 0x77, 0xbe, 0x73, 0xf7, 0xc0, 0x36, 0xe3, 0xbe, 0x74, 0x3d, 0x1f, - 0x43, 0x5b, 0x60, 0x38, 0xf2, 0x18, 0x5a, 0x41, 0xc8, 0x25, 0xa7, 0x6b, 0x39, 0x61, 0xd0, 0x94, - 0xb1, 0x87, 0x28, 0xdd, 0x84, 0x36, 0x36, 0x32, 0x6c, 0x84, 0xa1, 0xd7, 0x1b, 0xa7, 0xe8, 0x66, - 0xe1, 0x4d, 0x8e, 0x03, 0x14, 0x29, 0x7c, 0xb7, 0xef, 0xc9, 0x37, 0x51, 0xd7, 0x62, 0x7c, 0x68, - 0xfb, 0x22, 0x60, 0xac, 0x71, 0x8a, 0x23, 0xdb, 0x47, 0x39, 0x74, 0x03, 0x5b, 0xe0, 0x00, 0x99, - 0xe4, 0x61, 0x6a, 0xdb, 0x28, 0xd9, 0xf6, 0x79, 0x9f, 0xdb, 0x0a, 0xee, 0x46, 0x3d, 0x75, 0x53, - 0x17, 0x75, 0x4a, 0xcc, 0xcd, 0x1f, 0x8b, 0x00, 0x9d, 0x48, 0x3a, 0xf8, 0x36, 0x42, 0x21, 0xa9, - 0x0d, 0x6b, 0xc7, 0x28, 0x84, 0xdb, 0xc7, 0xa3, 0xb6, 0x4e, 0x76, 0x49, 0x7d, 0xbd, 0x75, 0xe3, - 0x6c, 0xb2, 0xb3, 0xf0, 0x75, 0xb2, 0x53, 0x10, 0x4e, 0x71, 0xa4, 0x06, 0xac, 0x1e, 0xb8, 0x81, - 0xcb, 0x3c, 0x39, 0xd6, 0x17, 0x77, 0x49, 0xbd, 0xea, 0xe4, 0x77, 0x7a, 0x07, 0x56, 0x5e, 0xbc, - 0xf3, 0x31, 0x3c, 0x6a, 0xeb, 0x15, 0xe5, 0xea, 0x5a, 0xea, 0x2a, 0x83, 0x9d, 0xec, 0x40, 0xef, - 0xc3, 0x52, 0x18, 0x0d, 0x50, 0xe8, 0xd5, 0x5d, 0x52, 0xd7, 0x9a, 0x9b, 0x56, 0x52, 0x9c, 0xd5, - 0x19, 0xb8, 0x0c, 0x87, 0xe8, 0x4b, 0x27, 0x1a, 0x60, 0xab, 0x1a, 0xeb, 0x9d, 0xc4, 0x92, 0x36, - 0x61, 0xe9, 0x30, 0xe4, 0x51, 0xa0, 0x2f, 0x29, 0xc9, 0x96, 0x95, 0xf7, 0xce, 0xda, 0x67, 0x0c, - 0x85, 0x50, 0x6c, 0xa6, 0x51, 0x17, 0xfa, 0x08, 0xaa, 0xc7, 0x28, 0x5d, 0xbd, 0xab, 0x24, 0x86, - 0x95, 0x8d, 0x2c, 0x2d, 0x3f, 0xe6, 0x9e, 0xa2, 0x7b, 0x8a, 0x61, 0x6b, 0x35, 0x96, 0x9d, 0x4f, - 0x76, 0x88, 0xa3, 0x14, 0xb4, 0x0d, 0xcb, 0xaf, 0xd4, 0xa4, 0x74, 0xa6, 0xb4, 0xe6, 0xbc, 0x56, - 0xb1, 0x1e, 0x73, 0xa5, 0xc7, 0xfd, 0x0b, 0x3e, 0x52, 0xad, 0x79, 0x0f, 0x34, 0xd5, 0x6c, 0x11, - 0x70, 0x5f, 0x20, 0xbd, 0x0d, 0x95, 0x83, 0xbc, 0xcf, 0x5a, 0xda, 0x9c, 0x18, 0x72, 0xe2, 0x8f, - 0xf9, 0x89, 0xc0, 0x7f, 0x6d, 0x1c, 0xa0, 0xc4, 0x6c, 0x3c, 0x7f, 0x16, 0x5c, 0x79, 0x79, 0xd7, - 0xe1, 0xff, 0x2c, 0xdf, 0xa4, 0x42, 0xf3, 0x23, 0x01, 0x38, 0x44, 0xf9, 0x8f, 0xe4, 0xbf, 0x0f, - 0x9a, 0x4a, 0x36, 0x1d, 0x4f, 0x13, 0xd6, 0x0e, 0xb2, 0x9d, 0x52, 0x39, 0x6b, 0xcd, 0x8d, 0xd2, - 0x96, 0xe5, 0x9c, 0x53, 0x98, 0x99, 0x9f, 0x09, 0x68, 0xcf, 0x3c, 0x91, 0x57, 0x5c, 0xfa, 0x07, - 0xc8, 0x5f, 0xfe, 0x81, 0xab, 0xae, 0xbe, 0x01, 0xeb, 0x49, 0xe6, 0xf3, 0xdb, 0x59, 0xb9, 0x6c, - 0x58, 0xcd, 0x9f, 0x04, 0x56, 0x4e, 0x92, 0x30, 0x74, 0x0f, 0x2a, 0x9d, 0x48, 0xd2, 0xcd, 0x52, - 0x77, 0x8a, 0x47, 0xc5, 0xd8, 0x9a, 0x87, 0xd3, 0x00, 0x8f, 0x61, 0x39, 0x59, 0x17, 0xaa, 0x97, - 0x2c, 0x66, 0x36, 0xde, 0xb8, 0x75, 0x09, 0x93, 0xca, 0xf7, 0xa0, 0x72, 0x88, 0xb3, 0x41, 0x8b, - 0x55, 0x9b, 0x09, 0x5a, 0x1e, 0xea, 0x43, 0xa8, 0xc6, 0x55, 0xd2, 0x32, 0x5f, 0x1a, 0x98, 0xb1, - 0x7d, 0x01, 0x4f, 0x84, 0xad, 0x97, 0x67, 0xd3, 0x1a, 0x39, 0x9f, 0xd6, 0xc8, 0x97, 0x69, 0x8d, - 0x7c, 0x9b, 0xd6, 0xc8, 0xfb, 0xef, 0xb5, 0x85, 0xd7, 0xf5, 0xdf, 0x3c, 0xcd, 0xbc, 0x27, 0x1a, - 0x6e, 0xe0, 0xd9, 0xb9, 0xb3, 0x0f, 0x8b, 0x37, 0x9f, 0x23, 0x7f, 0x72, 0x62, 0xed, 0x77, 0x8e, - 0x8a, 0xd5, 0xe9, 0x2e, 0xab, 0x67, 0xf8, 0xc1, 0xaf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x02, 0x54, - 0x99, 0x9f, 0x48, 0x06, 0x00, 0x00, + // 599 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x54, 0xcb, 0x6e, 0xd3, 0x40, + 0x14, 0xed, 0x34, 0xe9, 0xeb, 0xba, 0xbc, 0x86, 0x3e, 0x8c, 0x25, 0xd2, 0xca, 0xab, 0xf2, 0x88, + 0x2d, 0x42, 0x25, 0xd8, 0xb0, 0x68, 0x1a, 0x51, 0x2a, 0x51, 0x88, 0x5c, 0x09, 0x24, 0x76, 0xce, + 0xf4, 0x26, 0x58, 0x4a, 0x3c, 0xc6, 0x33, 0x0e, 0xca, 0x9f, 0xf0, 0x0d, 0x20, 0xb1, 0xe6, 0x13, + 0xba, 0xec, 0x12, 0xb1, 0x88, 0x50, 0x58, 0x22, 0xfe, 0x01, 0x79, 0xfc, 0x4c, 0x5a, 0x60, 0x59, + 0xb1, 0xb1, 0x66, 0xce, 0xb9, 0xe7, 0xbe, 0x3d, 0xb0, 0xc9, 0xb8, 0x2f, 0x5d, 0xcf, 0xc7, 0xd0, + 0x16, 0x18, 0x0e, 0x3d, 0x86, 0x56, 0x10, 0x72, 0xc9, 0xe9, 0x4a, 0x4e, 0x18, 0x34, 0x65, 0xec, + 0x01, 0x4a, 0x37, 0xa1, 0x8d, 0xb5, 0x0c, 0x1b, 0x62, 0xe8, 0x75, 0x47, 0x29, 0xba, 0x5e, 0x78, + 0x93, 0xa3, 0x00, 0x45, 0x0a, 0xdf, 0xed, 0x79, 0xf2, 0x6d, 0xd4, 0xb1, 0x18, 0x1f, 0xd8, 0xbe, + 0x08, 0x18, 0xab, 0x9f, 0xe0, 0xd0, 0xf6, 0x51, 0x0e, 0xdc, 0xc0, 0x16, 0xd8, 0x47, 0x26, 0x79, + 0x98, 0xda, 0xd6, 0x4b, 0xb6, 0x3d, 0xde, 0xe3, 0xb6, 0x82, 0x3b, 0x51, 0x57, 0xdd, 0xd4, 0x45, + 0x9d, 0x12, 0x73, 0xf3, 0xe7, 0x3c, 0x40, 0x3b, 0x92, 0x0e, 0xbe, 0x8b, 0x50, 0x48, 0x6a, 0xc3, + 0xca, 0x11, 0x0a, 0xe1, 0xf6, 0xf0, 0xb0, 0xa5, 0x93, 0x6d, 0xb2, 0xb3, 0xda, 0xbc, 0x71, 0x3a, + 0xde, 0x9a, 0xfb, 0x36, 0xde, 0x2a, 0x08, 0xa7, 0x38, 0x52, 0x03, 0x96, 0xf7, 0xdd, 0xc0, 0x65, + 0x9e, 0x1c, 0xe9, 0xf3, 0xdb, 0x64, 0xa7, 0xea, 0xe4, 0x77, 0x7a, 0x07, 0x96, 0x5e, 0xbe, 0xf7, + 0x31, 0x3c, 0x6c, 0xe9, 0x15, 0xe5, 0xea, 0x5a, 0xea, 0x2a, 0x83, 0x9d, 0xec, 0x40, 0x1f, 0xc0, + 0x42, 0x18, 0xf5, 0x51, 0xe8, 0xd5, 0x6d, 0xb2, 0xa3, 0x35, 0xd6, 0xad, 0xa4, 0x38, 0xab, 0xdd, + 0x77, 0x19, 0x0e, 0xd0, 0x97, 0x4e, 0xd4, 0xc7, 0x66, 0x35, 0xd6, 0x3b, 0x89, 0x25, 0x6d, 0xc0, + 0xc2, 0x41, 0xc8, 0xa3, 0x40, 0x5f, 0x50, 0x92, 0x0d, 0x2b, 0xef, 0x9d, 0xb5, 0xc7, 0x18, 0x0a, + 0xa1, 0xd8, 0x4c, 0xa3, 0x2e, 0xf4, 0x31, 0x54, 0x8f, 0x50, 0xba, 0x7a, 0x47, 0x49, 0x0c, 0x2b, + 0x1b, 0x59, 0x5a, 0x7e, 0xcc, 0x3d, 0x43, 0xf7, 0x04, 0xc3, 0xe6, 0x72, 0x2c, 0x3b, 0x1b, 0x6f, + 0x11, 0x47, 0x29, 0x68, 0x0b, 0x16, 0x5f, 0xa9, 0x49, 0xe9, 0x4c, 0x69, 0xcd, 0x59, 0xad, 0x62, + 0x3d, 0xe6, 0x4a, 0x8f, 0xfb, 0xe7, 0x7c, 0xa4, 0x5a, 0xf3, 0x3e, 0x68, 0xaa, 0xd9, 0x22, 0xe0, + 0xbe, 0x40, 0x7a, 0x1b, 0x2a, 0xfb, 0x79, 0x9f, 0xb5, 0xb4, 0x39, 0x31, 0xe4, 0xc4, 0x1f, 0xf3, + 0x33, 0x81, 0x2b, 0x2d, 0xec, 0xa3, 0xc4, 0x6c, 0x3c, 0x7f, 0x17, 0x5c, 0x7a, 0x79, 0xd7, 0xe1, + 0x6a, 0x96, 0x6f, 0x52, 0xa1, 0xf9, 0x89, 0x00, 0x1c, 0xa0, 0xfc, 0x4f, 0xf2, 0xdf, 0x03, 0x4d, + 0x25, 0x9b, 0x8e, 0xa7, 0x01, 0x2b, 0xfb, 0xd9, 0x4e, 0xa9, 0x9c, 0xb5, 0xc6, 0x5a, 0x69, 0xcb, + 0x72, 0xce, 0x29, 0xcc, 0xcc, 0x2f, 0x04, 0xb4, 0xe7, 0x9e, 0xc8, 0x2b, 0x2e, 0xfd, 0x03, 0xe4, + 0x1f, 0xff, 0xc0, 0x65, 0x57, 0x5f, 0x87, 0xd5, 0x24, 0xf3, 0xd9, 0xed, 0xac, 0x5c, 0x34, 0xac, + 0xc6, 0x2f, 0x02, 0x4b, 0xc7, 0x49, 0x18, 0xba, 0x0b, 0x95, 0x76, 0x24, 0xe9, 0x7a, 0xa9, 0x3b, + 0xc5, 0xa3, 0x62, 0x6c, 0xcc, 0xc2, 0x69, 0x80, 0x27, 0xb0, 0x98, 0xac, 0x0b, 0xd5, 0x4b, 0x16, + 0x53, 0x1b, 0x6f, 0xdc, 0xba, 0x80, 0x49, 0xe5, 0xbb, 0x50, 0x39, 0xc0, 0xe9, 0xa0, 0xc5, 0xaa, + 0x4d, 0x05, 0x2d, 0x0f, 0xf5, 0x11, 0x54, 0xe3, 0x2a, 0x69, 0x99, 0x2f, 0x0d, 0xcc, 0xd8, 0x3c, + 0x87, 0x27, 0xc2, 0xe6, 0xeb, 0xd3, 0x49, 0x8d, 0x9c, 0x4d, 0x6a, 0xe4, 0xeb, 0xa4, 0x46, 0xbe, + 0x4f, 0x6a, 0xe4, 0xc3, 0x8f, 0xda, 0xdc, 0x9b, 0x7b, 0x7f, 0x78, 0x9a, 0x79, 0x57, 0xd4, 0xdd, + 0xc0, 0xab, 0xf7, 0xb8, 0x9d, 0xfb, 0xfb, 0x38, 0x7f, 0xf3, 0x05, 0xf2, 0xa7, 0xc7, 0xd6, 0x5e, + 0xfb, 0xb0, 0xd8, 0x9e, 0xce, 0xa2, 0x7a, 0x89, 0x1f, 0xfe, 0x0e, 0x00, 0x00, 0xff, 0xff, 0x4c, + 0xfc, 0xa5, 0x37, 0x4b, 0x06, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/container/service.proto b/container/service.proto index b287a22..bccf924 100644 --- a/container/service.proto +++ b/container/service.proto @@ -1,6 +1,6 @@ syntax = "proto3"; package container; -option go_package = "github.com/nspcc-dev/neofs-api/container"; +option go_package = "github.com/nspcc-dev/neofs-api-go/container"; option csharp_namespace = "NeoFS.API.Container"; import "service/meta.proto"; diff --git a/container/types.go b/container/types.go index b718907..21fc0d1 100644 --- a/container/types.go +++ b/container/types.go @@ -4,8 +4,8 @@ import ( "bytes" "github.com/google/uuid" - "github.com/nspcc-dev/neofs-api/internal" - "github.com/nspcc-dev/neofs-api/refs" + "github.com/nspcc-dev/neofs-api-go/internal" + "github.com/nspcc-dev/neofs-api-go/refs" "github.com/nspcc-dev/neofs-crypto/test" "github.com/nspcc-dev/netmap" "github.com/pkg/errors" diff --git a/container/types.pb.go b/container/types.pb.go index cc0f736..bfb7fa7 100644 --- a/container/types.pb.go +++ b/container/types.pb.go @@ -190,32 +190,32 @@ func init() { func init() { proto.RegisterFile("container/types.proto", fileDescriptor_1432e52ab0b53e3e) } var fileDescriptor_1432e52ab0b53e3e = []byte{ - // 389 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x91, 0x4d, 0x4f, 0xe2, 0x40, - 0x1c, 0xc6, 0x19, 0x28, 0xbb, 0xcb, 0xc0, 0x66, 0xb3, 0xb3, 0x61, 0xd3, 0x10, 0x53, 0x1a, 0x4e, - 0xd5, 0xa4, 0x53, 0xc5, 0xc4, 0x3b, 0x2f, 0x6a, 0x48, 0x7c, 0x21, 0x45, 0x2e, 0xc6, 0x4b, 0x19, - 0x06, 0x6c, 0x52, 0x3a, 0x4d, 0x67, 0xaa, 0xe1, 0x9b, 0xf8, 0x19, 0xfc, 0x24, 0x1c, 0x3d, 0x1a, - 0x0f, 0x68, 0xea, 0x17, 0x31, 0x9d, 0x42, 0x25, 0x41, 0x6f, 0xf3, 0x3c, 0xf3, 0x7b, 0x66, 0xfe, - 0x2f, 0xb0, 0x4a, 0x98, 0x2f, 0x1c, 0xd7, 0xa7, 0xa1, 0x25, 0xe6, 0x01, 0xe5, 0x38, 0x08, 0x99, - 0x60, 0xa8, 0x94, 0xd9, 0xb5, 0xbd, 0xa9, 0x2b, 0x6e, 0xa3, 0x11, 0x26, 0x6c, 0x66, 0xf9, 0x3c, - 0x20, 0xc4, 0x1c, 0xd3, 0x3b, 0xcb, 0xa7, 0x62, 0xe6, 0x04, 0x16, 0xa7, 0x1e, 0x25, 0x82, 0x85, - 0x69, 0xac, 0x66, 0x6e, 0xb0, 0x53, 0x36, 0x65, 0x96, 0xb4, 0x47, 0xd1, 0x44, 0x2a, 0x29, 0xe4, - 0x29, 0xc5, 0x1b, 0xaf, 0x00, 0x96, 0x3a, 0xeb, 0x8f, 0xd0, 0x2e, 0xfc, 0x79, 0x79, 0xef, 0xd3, - 0xb0, 0xd7, 0x55, 0x81, 0x0e, 0x8c, 0x4a, 0xfb, 0xcf, 0x62, 0x59, 0xcf, 0xbd, 0x2c, 0xeb, 0x6b, - 0xdb, 0x5e, 0x1f, 0x90, 0x0e, 0x95, 0x81, 0xe3, 0x09, 0x35, 0x2f, 0xb9, 0xca, 0x8a, 0x53, 0x86, - 0xc3, 0x5e, 0xd7, 0x96, 0x37, 0xa8, 0x06, 0x7f, 0x75, 0x9c, 0xc0, 0x21, 0xae, 0x98, 0xab, 0x05, - 0x1d, 0x18, 0x8a, 0x9d, 0x69, 0x74, 0x00, 0x8b, 0x76, 0xe4, 0x51, 0xae, 0x2a, 0x3a, 0x30, 0xca, - 0xcd, 0x2a, 0x4e, 0x9b, 0xc1, 0x7d, 0xcf, 0x21, 0x74, 0x46, 0x7d, 0x91, 0xdc, 0xb6, 0x95, 0xe4, - 0x55, 0x3b, 0x25, 0xd1, 0x11, 0x54, 0xce, 0x5c, 0x2e, 0xd4, 0xa2, 0x4c, 0xec, 0xe0, 0x6c, 0x3c, - 0xb8, 0x45, 0x08, 0xe5, 0x3c, 0xe9, 0x22, 0x64, 0x5e, 0xc2, 0xac, 0x82, 0x92, 0x6f, 0xdc, 0xc0, - 0x72, 0x0a, 0x9c, 0x86, 0x2c, 0x0a, 0x90, 0x06, 0x61, 0x2a, 0xcf, 0xd9, 0x98, 0xca, 0x2e, 0x7f, - 0xdb, 0x1b, 0x0e, 0x32, 0x61, 0x69, 0xc8, 0x69, 0x28, 0x61, 0x35, 0xaf, 0x17, 0xbe, 0x1a, 0xc2, - 0x27, 0xd1, 0x38, 0x86, 0x7f, 0xb7, 0xbe, 0x47, 0xfb, 0xab, 0x52, 0x81, 0x5e, 0x30, 0xca, 0xcd, - 0xff, 0x5b, 0xa5, 0xca, 0xe8, 0x66, 0x91, 0xed, 0xab, 0x45, 0xac, 0x81, 0xa7, 0x58, 0x03, 0xcf, - 0xb1, 0x06, 0xde, 0x62, 0x0d, 0x3c, 0xbc, 0x6b, 0xb9, 0x6b, 0xe3, 0x9b, 0xbd, 0xb3, 0x09, 0x37, - 0x9d, 0xc0, 0xb5, 0xb2, 0x77, 0x1f, 0xf3, 0xff, 0x2e, 0x28, 0x3b, 0x19, 0xe0, 0x56, 0xbf, 0x87, - 0xb3, 0x75, 0x8e, 0x7e, 0xc8, 0x1d, 0x1f, 0x7e, 0x04, 0x00, 0x00, 0xff, 0xff, 0xd4, 0x4d, 0x91, - 0xa9, 0x62, 0x02, 0x00, 0x00, + // 393 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x91, 0x4d, 0x6b, 0xe2, 0x40, + 0x1c, 0xc6, 0x1d, 0x8d, 0xbb, 0xeb, 0xe8, 0xb2, 0xec, 0x2c, 0x2e, 0x41, 0x96, 0x18, 0x3c, 0x65, + 0x77, 0xc9, 0x64, 0xd7, 0x42, 0xef, 0xbe, 0xb4, 0x45, 0xe8, 0x8b, 0x44, 0xa4, 0x50, 0x7a, 0x89, + 0xe3, 0x98, 0x06, 0x62, 0x26, 0x64, 0x26, 0x2d, 0x7e, 0x93, 0x7e, 0x86, 0x7e, 0x12, 0x8f, 0x3d, + 0x96, 0x1e, 0x6c, 0x49, 0xbf, 0x48, 0xc9, 0x44, 0x53, 0xc1, 0xf6, 0x36, 0xcf, 0x33, 0xbf, 0x67, + 0xe6, 0xff, 0x02, 0xeb, 0x84, 0x05, 0xc2, 0xf1, 0x02, 0x1a, 0x59, 0x62, 0x11, 0x52, 0x8e, 0xc3, + 0x88, 0x09, 0x86, 0x2a, 0xb9, 0xdd, 0xf8, 0xe3, 0x7a, 0xe2, 0x2a, 0x9e, 0x60, 0xc2, 0xe6, 0x56, + 0xc0, 0x43, 0x42, 0xcc, 0x29, 0xbd, 0xb6, 0x02, 0x2a, 0xe6, 0x4e, 0x68, 0x71, 0xea, 0x53, 0x22, + 0x58, 0x94, 0xc5, 0x1a, 0xe6, 0x16, 0xeb, 0x32, 0x97, 0x59, 0xd2, 0x9e, 0xc4, 0x33, 0xa9, 0xa4, + 0x90, 0xa7, 0x0c, 0x6f, 0x3d, 0x01, 0x58, 0xe9, 0x6d, 0x3e, 0x42, 0xbf, 0xe1, 0xe7, 0xb3, 0x9b, + 0x80, 0x46, 0x83, 0xbe, 0x0a, 0x74, 0x60, 0xd4, 0xba, 0xdf, 0x96, 0xab, 0x66, 0xe1, 0x71, 0xd5, + 0xdc, 0xd8, 0xf6, 0xe6, 0x80, 0x74, 0xa8, 0x8c, 0x1c, 0x5f, 0xa8, 0x45, 0xc9, 0xd5, 0xd6, 0x9c, + 0x32, 0x1e, 0x0f, 0xfa, 0xb6, 0xbc, 0x41, 0x0d, 0xf8, 0xa5, 0xe7, 0x84, 0x0e, 0xf1, 0xc4, 0x42, + 0x2d, 0xe9, 0xc0, 0x50, 0xec, 0x5c, 0xa3, 0xff, 0xb0, 0x6c, 0xc7, 0x3e, 0xe5, 0xaa, 0xa2, 0x03, + 0xa3, 0xda, 0xae, 0xe3, 0xac, 0x19, 0x3c, 0xf4, 0x1d, 0x42, 0xe7, 0x34, 0x10, 0xe9, 0x6d, 0x57, + 0x49, 0x5f, 0xb5, 0x33, 0x12, 0xed, 0x43, 0xe5, 0xd8, 0xe3, 0x42, 0x2d, 0xcb, 0xc4, 0x2f, 0x9c, + 0x8f, 0x07, 0x77, 0x08, 0xa1, 0x9c, 0xa7, 0x5d, 0x44, 0xcc, 0x4f, 0x99, 0x75, 0x50, 0xf2, 0xad, + 0x4b, 0x58, 0xcd, 0x80, 0xa3, 0x88, 0xc5, 0x21, 0xd2, 0x20, 0xcc, 0xe4, 0x09, 0x9b, 0x52, 0xd9, + 0xe5, 0x57, 0x7b, 0xcb, 0x41, 0x26, 0xac, 0x8c, 0x39, 0x8d, 0x24, 0xac, 0x16, 0xf5, 0xd2, 0x7b, + 0x43, 0x78, 0x23, 0x5a, 0x07, 0xf0, 0xfb, 0xce, 0xf7, 0xe8, 0xdf, 0xba, 0x54, 0xa0, 0x97, 0x8c, + 0x6a, 0xfb, 0xe7, 0x4e, 0xa9, 0x32, 0xba, 0x5d, 0x64, 0xf7, 0x7c, 0x99, 0x68, 0xe0, 0x3e, 0xd1, + 0xc0, 0x43, 0xa2, 0x81, 0xe7, 0x44, 0x03, 0xb7, 0x2f, 0x5a, 0xe1, 0xe2, 0xef, 0x07, 0x7b, 0x67, + 0x33, 0x6e, 0x3a, 0xa1, 0x67, 0xba, 0xcc, 0xca, 0x9f, 0xbe, 0x2b, 0xfe, 0x38, 0xa5, 0xec, 0x70, + 0x84, 0x3b, 0xc3, 0x01, 0xce, 0x37, 0x3a, 0xf9, 0x24, 0xd7, 0xbc, 0xf7, 0x1a, 0x00, 0x00, 0xff, + 0xff, 0xd2, 0x94, 0x7a, 0x2b, 0x65, 0x02, 0x00, 0x00, } func (m *Container) Marshal() (dAtA []byte, err error) { diff --git a/container/types.proto b/container/types.proto index 775d84c..a0d035d 100644 --- a/container/types.proto +++ b/container/types.proto @@ -1,6 +1,6 @@ syntax = "proto3"; package container; -option go_package = "github.com/nspcc-dev/neofs-api/container"; +option go_package = "github.com/nspcc-dev/neofs-api-go/container"; option csharp_namespace = "NeoFS.API.Container"; import "github.com/nspcc-dev/netmap/selector.proto"; diff --git a/container/types_test.go b/container/types_test.go index 0a20d54..1ccc00b 100644 --- a/container/types_test.go +++ b/container/types_test.go @@ -4,7 +4,7 @@ import ( "testing" "github.com/gogo/protobuf/proto" - "github.com/nspcc-dev/neofs-api/refs" + "github.com/nspcc-dev/neofs-api-go/refs" "github.com/nspcc-dev/neofs-crypto/test" "github.com/nspcc-dev/netmap" "github.com/stretchr/testify/require" diff --git a/decimal/decimal.pb.go b/decimal/decimal.pb.go index 60c0153..9108e61 100644 --- a/decimal/decimal.pb.go +++ b/decimal/decimal.pb.go @@ -83,7 +83,7 @@ func init() { func init() { proto.RegisterFile("decimal/decimal.proto", fileDescriptor_e7e70e1773836c80) } var fileDescriptor_e7e70e1773836c80 = []byte{ - // 198 bytes of a gzipped FileDescriptorProto + // 201 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x4d, 0x49, 0x4d, 0xce, 0xcc, 0x4d, 0xcc, 0xd1, 0x87, 0xd2, 0x7a, 0x05, 0x45, 0xf9, 0x25, 0xf9, 0x42, 0xec, 0x50, 0xae, 0x94, 0x6e, 0x7a, 0x66, 0x49, 0x46, 0x69, 0x92, 0x5e, 0x72, 0x7e, 0xae, 0x7e, 0x7a, 0x7e, 0x7a, @@ -91,12 +91,12 @@ var fileDescriptor_e7e70e1773836c80 = []byte{ 0x2e, 0x76, 0x17, 0x88, 0x4e, 0x21, 0x11, 0x2e, 0xd6, 0xb0, 0xc4, 0x9c, 0xd2, 0x54, 0x09, 0x46, 0x05, 0x46, 0x0d, 0xe6, 0x20, 0x08, 0x47, 0x48, 0x86, 0x8b, 0x33, 0xa0, 0x28, 0x35, 0x39, 0xb3, 0x38, 0x33, 0x3f, 0x4f, 0x82, 0x49, 0x81, 0x51, 0x83, 0x37, 0x08, 0x21, 0x60, 0xc5, 0x32, 0x63, - 0x81, 0x3c, 0x83, 0x53, 0xc0, 0x89, 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, 0x31, 0xde, 0x78, 0x24, - 0xc7, 0xf8, 0xe0, 0x91, 0x1c, 0xe3, 0x8c, 0xc7, 0x72, 0x0c, 0x51, 0x6a, 0x48, 0x2e, 0xc9, 0x2b, + 0x81, 0x3c, 0x83, 0x53, 0xf0, 0x89, 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, 0x31, 0xde, 0x78, 0x24, + 0xc7, 0xf8, 0xe0, 0x91, 0x1c, 0xe3, 0x8c, 0xc7, 0x72, 0x0c, 0x51, 0x9a, 0x48, 0x2e, 0xc9, 0x2b, 0x2e, 0x48, 0x4e, 0xd6, 0x4d, 0x49, 0x2d, 0xd3, 0xcf, 0x4b, 0xcd, 0x4f, 0x2b, 0xd6, 0x4d, 0x2c, - 0xc8, 0x84, 0x79, 0x60, 0x15, 0x93, 0xa0, 0x5f, 0x6a, 0xbe, 0x5b, 0xb0, 0x9e, 0x63, 0x80, 0xa7, - 0x1e, 0xd4, 0x2d, 0x49, 0x6c, 0x60, 0xd7, 0x19, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0x76, 0xde, - 0x39, 0xfb, 0xee, 0x00, 0x00, 0x00, + 0xc8, 0xd4, 0x4d, 0xcf, 0x87, 0xf9, 0x61, 0x15, 0x93, 0xa0, 0x5f, 0x6a, 0xbe, 0x5b, 0xb0, 0x9e, + 0x63, 0x80, 0xa7, 0x1e, 0xd4, 0x39, 0x49, 0x6c, 0x60, 0x07, 0x1a, 0x03, 0x02, 0x00, 0x00, 0xff, + 0xff, 0xa5, 0x41, 0x4c, 0x9f, 0xf1, 0x00, 0x00, 0x00, } func (m *Decimal) Marshal() (dAtA []byte, err error) { diff --git a/decimal/decimal.proto b/decimal/decimal.proto index d21ce1b..f3d5c00 100644 --- a/decimal/decimal.proto +++ b/decimal/decimal.proto @@ -1,6 +1,6 @@ syntax = "proto3"; package decimal; -option go_package = "github.com/nspcc-dev/neofs-api/decimal"; +option go_package = "github.com/nspcc-dev/neofs-api-go/decimal"; option csharp_namespace = "NeoFS.API.Decimal"; import "github.com/gogo/protobuf/gogoproto/gogo.proto"; diff --git a/go.mod b/go.mod index 161343f..50c24ad 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ -module github.com/nspcc-dev/neofs-api +module github.com/nspcc-dev/neofs-api-go -go 1.13 +go 1.14 require ( github.com/gogo/protobuf v1.3.1 diff --git a/hash/hash.go b/hash/hash.go index de02491..9d75278 100644 --- a/hash/hash.go +++ b/hash/hash.go @@ -4,7 +4,7 @@ import ( "bytes" "github.com/mr-tron/base58" - "github.com/nspcc-dev/neofs-api/internal" + "github.com/nspcc-dev/neofs-api-go/internal" "github.com/nspcc-dev/tzhash/tz" "github.com/pkg/errors" ) diff --git a/object/extensions.go b/object/extensions.go index a496413..6e577bd 100644 --- a/object/extensions.go +++ b/object/extensions.go @@ -2,7 +2,7 @@ package object // todo: all extensions must be transferred to the separate util library -import "github.com/nspcc-dev/neofs-api/storagegroup" +import "github.com/nspcc-dev/neofs-api-go/storagegroup" // IsLinking checks if object has children links to another objects. // We have to check payload size because zero-object must have zero diff --git a/object/service.go b/object/service.go index e75c9f2..589bd95 100644 --- a/object/service.go +++ b/object/service.go @@ -1,11 +1,11 @@ package object import ( - "github.com/nspcc-dev/neofs-api/hash" - "github.com/nspcc-dev/neofs-api/internal" - "github.com/nspcc-dev/neofs-api/refs" - "github.com/nspcc-dev/neofs-api/service" - "github.com/nspcc-dev/neofs-api/session" + "github.com/nspcc-dev/neofs-api-go/hash" + "github.com/nspcc-dev/neofs-api-go/internal" + "github.com/nspcc-dev/neofs-api-go/refs" + "github.com/nspcc-dev/neofs-api-go/service" + "github.com/nspcc-dev/neofs-api-go/session" ) type ( diff --git a/object/service.pb.go b/object/service.pb.go index 46891e2..8502c8e 100644 --- a/object/service.pb.go +++ b/object/service.pb.go @@ -8,9 +8,9 @@ import ( fmt "fmt" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/golang/protobuf/proto" - refs "github.com/nspcc-dev/neofs-api/refs" - service "github.com/nspcc-dev/neofs-api/service" - session "github.com/nspcc-dev/neofs-api/session" + refs "github.com/nspcc-dev/neofs-api-go/refs" + service "github.com/nspcc-dev/neofs-api-go/service" + session "github.com/nspcc-dev/neofs-api-go/session" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" @@ -897,64 +897,64 @@ func init() { func init() { proto.RegisterFile("object/service.proto", fileDescriptor_dfcdf610ade6a9ce) } var fileDescriptor_dfcdf610ade6a9ce = []byte{ - // 905 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x57, 0x4f, 0x6f, 0x1b, 0x45, - 0x14, 0xcf, 0x78, 0xed, 0x8d, 0xfb, 0xbc, 0x4e, 0xad, 0x89, 0x29, 0xd6, 0xb6, 0x72, 0x22, 0xab, - 0x20, 0x23, 0xe4, 0x75, 0x28, 0x12, 0x94, 0x13, 0xaa, 0x63, 0xa5, 0xb6, 0x10, 0x4d, 0x18, 0xa3, - 0x4a, 0x70, 0x5b, 0xaf, 0xc7, 0xf6, 0x52, 0x67, 0xd7, 0xdd, 0x3f, 0xb1, 0x72, 0xe1, 0xc6, 0xb9, - 0x57, 0x8e, 0x9c, 0xf9, 0x0c, 0x7c, 0x80, 0x5e, 0x90, 0x7a, 0x44, 0x1c, 0x22, 0x64, 0x8e, 0x7c, - 0x01, 0x24, 0x2e, 0x68, 0xfe, 0xec, 0xbf, 0x14, 0x07, 0xb0, 0x0f, 0xee, 0xc9, 0x33, 0xbf, 0xf7, - 0x7b, 0x6f, 0xe6, 0xfd, 0xe6, 0xcd, 0x1b, 0x2f, 0x54, 0xdd, 0xe1, 0x37, 0xd4, 0x0a, 0xda, 0x3e, - 0xf5, 0x2e, 0x6c, 0x8b, 0x1a, 0x73, 0xcf, 0x0d, 0x5c, 0xac, 0x0a, 0x54, 0xaf, 0x78, 0x74, 0xec, - 0xb7, 0x83, 0xcb, 0x39, 0xf5, 0x85, 0x45, 0xc7, 0x92, 0x9f, 0xc6, 0xf6, 0x7d, 0xea, 0xfb, 0xb6, - 0xeb, 0x64, 0x89, 0x32, 0x62, 0xfb, 0x9c, 0x06, 0xa6, 0xc4, 0xaa, 0x11, 0x76, 0x41, 0x3d, 0x7b, - 0x7c, 0x29, 0xd1, 0xd6, 0xc4, 0x0e, 0xa6, 0xe1, 0xd0, 0xb0, 0xdc, 0xf3, 0xf6, 0xc4, 0x9d, 0xb8, - 0x6d, 0x0e, 0x0f, 0xc3, 0x31, 0x9f, 0xf1, 0x09, 0x1f, 0x09, 0x7a, 0xe3, 0x67, 0x04, 0xf0, 0x98, - 0x06, 0x84, 0x3e, 0x0f, 0xa9, 0x1f, 0xe0, 0x16, 0xec, 0x3e, 0x1a, 0x8d, 0x3c, 0xea, 0xfb, 0x35, - 0x74, 0x88, 0x9a, 0xa5, 0x07, 0x65, 0x83, 0x6d, 0xda, 0x90, 0x60, 0x27, 0xff, 0xf2, 0xea, 0x60, - 0x87, 0x44, 0x1c, 0x5c, 0x01, 0x85, 0x98, 0x8b, 0x5a, 0xee, 0x10, 0x35, 0x8b, 0x84, 0x0d, 0xf1, - 0x43, 0xc8, 0x7f, 0x4e, 0x03, 0xb3, 0x36, 0xe4, 0xde, 0xba, 0x11, 0x29, 0x21, 0x17, 0x60, 0xb6, - 0x1e, 0x35, 0x47, 0xd4, 0xeb, 0x14, 0x59, 0xa8, 0x57, 0x57, 0x07, 0x88, 0x70, 0x0f, 0xdc, 0x05, - 0xf5, 0x29, 0x4f, 0xa4, 0x66, 0x71, 0xdf, 0xc6, 0x75, 0x5f, 0x6e, 0xb5, 0x2d, 0x33, 0xb0, 0x5d, - 0xe7, 0xb5, 0x18, 0xd2, 0xb7, 0xf1, 0x02, 0x41, 0x89, 0xe7, 0xe3, 0xcf, 0x5d, 0xc7, 0xa7, 0xb8, - 0x09, 0x52, 0x7d, 0x99, 0xcf, 0x9e, 0x21, 0xa6, 0xc6, 0x29, 0xff, 0xe9, 0xed, 0x10, 0x69, 0xc7, - 0x77, 0xa0, 0x70, 0x3c, 0x0d, 0x9d, 0x67, 0x3c, 0x1b, 0xad, 0xb7, 0x43, 0xc4, 0x14, 0x7f, 0x22, - 0x33, 0x12, 0xbb, 0xba, 0x9b, 0xda, 0x95, 0x58, 0x62, 0x75, 0x4a, 0x1d, 0x05, 0x10, 0x69, 0xfc, - 0x94, 0x03, 0x38, 0x0b, 0x63, 0x85, 0x3f, 0x02, 0x55, 0xb0, 0xe5, 0x86, 0xee, 0x45, 0x1b, 0x4a, - 0x38, 0x6c, 0x28, 0x38, 0x6c, 0x7b, 0x62, 0xb4, 0x72, 0x7b, 0x5b, 0x16, 0x5c, 0xff, 0x0a, 0x6e, - 0xc5, 0xdb, 0xc5, 0xef, 0x82, 0x7a, 0x7a, 0x83, 0xda, 0x44, 0x5a, 0xf1, 0x7d, 0x28, 0x7c, 0xe9, - 0x3e, 0xa3, 0x0e, 0x4f, 0x86, 0xd1, 0x64, 0xcd, 0x1b, 0x1c, 0x25, 0xc2, 0x28, 0xe4, 0x5b, 0x40, - 0x89, 0x2b, 0x23, 0xcf, 0xf3, 0x7f, 0x16, 0xe8, 0xfa, 0x87, 0xd7, 0x78, 0x91, 0x83, 0x72, 0x97, - 0xce, 0x68, 0x40, 0xd7, 0xbc, 0x1c, 0xef, 0xc1, 0xee, 0xe9, 0xc2, 0xa1, 0x5e, 0xbf, 0x2b, 0xce, - 0xac, 0x73, 0x9b, 0xd9, 0x7f, 0xbd, 0x3a, 0x88, 0x60, 0x12, 0x0d, 0x12, 0x3d, 0x94, 0x1b, 0xf4, - 0xd8, 0xfa, 0xdd, 0xfa, 0x0c, 0xf6, 0x22, 0x41, 0xe4, 0x69, 0x6c, 0x20, 0xef, 0x5f, 0x08, 0x4a, - 0xcc, 0x14, 0x89, 0xfb, 0xf0, 0x5f, 0xc4, 0x8d, 0xc5, 0x93, 0x40, 0xa2, 0xf3, 0x21, 0x94, 0x4e, - 0xc2, 0xd9, 0x4c, 0xac, 0xe3, 0xcb, 0x66, 0x94, 0x86, 0xa2, 0x36, 0xa5, 0xbc, 0x39, 0x6d, 0xea, - 0x39, 0x68, 0x22, 0x79, 0x29, 0xe4, 0x7f, 0xbd, 0x38, 0x1b, 0x08, 0xfe, 0x27, 0x82, 0xf2, 0x80, - 0x9a, 0x9e, 0x35, 0x4d, 0xea, 0xb9, 0x74, 0xec, 0x3a, 0x81, 0x69, 0x8b, 0x22, 0x45, 0xbc, 0x48, - 0x4b, 0x52, 0x67, 0xe5, 0xb8, 0xdf, 0x25, 0x69, 0x3b, 0xae, 0x42, 0xe1, 0x8b, 0x90, 0x7a, 0x97, - 0xa2, 0x9a, 0x89, 0x98, 0xe0, 0x06, 0x68, 0x7c, 0xf0, 0x94, 0x7a, 0xac, 0x62, 0xb9, 0xc8, 0x65, - 0x92, 0xc1, 0xb6, 0xae, 0xf6, 0xb7, 0xb0, 0x17, 0x65, 0x2e, 0xf5, 0xfe, 0x00, 0x6e, 0xc9, 0xf2, - 0xa1, 0xac, 0xde, 0x94, 0x55, 0x97, 0x39, 0x61, 0x6d, 0x22, 0xfd, 0x1f, 0x08, 0x6e, 0xb3, 0x47, - 0xc9, 0x74, 0x26, 0xeb, 0x37, 0x93, 0x02, 0x77, 0x97, 0x1d, 0xb3, 0x1c, 0xd5, 0x07, 0x07, 0x25, - 0x59, 0x30, 0xb6, 0xae, 0xb6, 0x0d, 0x95, 0x24, 0x59, 0xa9, 0xb7, 0x0e, 0xc5, 0x13, 0xcf, 0x9c, - 0x9c, 0x53, 0x47, 0x54, 0xb8, 0x46, 0xe2, 0xf9, 0x26, 0xc2, 0x7e, 0x97, 0x83, 0xfd, 0x68, 0xad, - 0x9e, 0xe9, 0x4f, 0xd7, 0x14, 0xf7, 0x7d, 0x50, 0x79, 0x08, 0xd6, 0x3c, 0x94, 0x55, 0xea, 0x4a, - 0x0a, 0xc6, 0x90, 0x1f, 0x98, 0xb3, 0x80, 0x17, 0xba, 0x46, 0xf8, 0x78, 0xeb, 0x92, 0x2f, 0xa0, - 0x9a, 0x95, 0x41, 0xca, 0x7e, 0x1f, 0x54, 0x36, 0x97, 0x35, 0xae, 0x75, 0x34, 0x79, 0xb9, 0xf3, - 0x9c, 0x25, 0x6d, 0x1b, 0x1c, 0xc0, 0x83, 0x1f, 0x14, 0xd8, 0x1d, 0x08, 0x3a, 0x3e, 0x02, 0xe5, - 0x31, 0x0d, 0x30, 0x8e, 0xc4, 0x4b, 0xfe, 0x56, 0xea, 0xfb, 0x19, 0x4c, 0x44, 0x3d, 0x42, 0xcc, - 0xe3, 0x2c, 0x4c, 0x79, 0x24, 0x7f, 0x81, 0x12, 0x8f, 0xd4, 0xe3, 0xdf, 0x44, 0xf8, 0x63, 0x50, - 0xc5, 0x13, 0x84, 0xdf, 0x8a, 0x08, 0x99, 0x37, 0x5a, 0xbf, 0x73, 0x1d, 0x8e, 0x2f, 0x7c, 0x9e, - 0xa5, 0x80, 0xe3, 0xb8, 0xa9, 0xb7, 0x47, 0xaf, 0x66, 0xc1, 0xf8, 0x71, 0x53, 0x45, 0xd7, 0x48, - 0xd6, 0xca, 0xf4, 0xcf, 0x64, 0xad, 0x6c, 0x73, 0x39, 0x42, 0xf8, 0x53, 0x28, 0x46, 0xe7, 0x81, - 0xdf, 0x4e, 0xe7, 0x9e, 0xea, 0x00, 0x7a, 0xed, 0x75, 0x43, 0x1c, 0xa0, 0x0f, 0x5a, 0xfa, 0x40, - 0xf1, 0xdd, 0xeb, 0xdc, 0x54, 0xb5, 0xeb, 0xf7, 0xfe, 0xd9, 0x28, 0x82, 0x75, 0x9e, 0xbc, 0x5c, - 0xd6, 0xd1, 0xab, 0x65, 0x1d, 0xfd, 0xb2, 0xac, 0xa3, 0xdf, 0x96, 0x75, 0xf4, 0xfd, 0xef, 0xf5, - 0x9d, 0xaf, 0xdf, 0x49, 0x7d, 0x26, 0x38, 0xfe, 0xdc, 0xb2, 0x5a, 0x23, 0x7a, 0xd1, 0x76, 0xa8, - 0x3b, 0xf6, 0x5b, 0xe6, 0xdc, 0x6e, 0x8b, 0x88, 0x3f, 0xe6, 0x2a, 0x4f, 0xa8, 0x7b, 0x32, 0x30, - 0x1e, 0x9d, 0xf5, 0xe5, 0x53, 0x34, 0x54, 0xf9, 0x87, 0xc3, 0x87, 0x7f, 0x07, 0x00, 0x00, 0xff, - 0xff, 0xd3, 0xb9, 0x0e, 0x2b, 0xec, 0x0c, 0x00, 0x00, + // 907 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x57, 0x4f, 0x8f, 0x22, 0x45, + 0x14, 0xa7, 0x68, 0xe8, 0x61, 0x1f, 0xcd, 0x2c, 0xa9, 0xc1, 0x95, 0xf4, 0x6e, 0x98, 0x09, 0xd9, + 0x18, 0x8c, 0xa1, 0x19, 0xd7, 0x44, 0xd7, 0x93, 0x59, 0x86, 0xcc, 0x42, 0x8c, 0xce, 0x6c, 0x61, + 0x36, 0xd1, 0x5b, 0xd3, 0x14, 0xd0, 0x2e, 0xd3, 0xcd, 0xf6, 0x9f, 0x21, 0x73, 0xf1, 0xe6, 0x79, + 0xaf, 0x1e, 0x3d, 0xfb, 0x19, 0xfc, 0x00, 0x7b, 0x31, 0xd9, 0xa3, 0xf1, 0x30, 0x31, 0x78, 0xf4, + 0x0b, 0x98, 0x78, 0x31, 0xf5, 0xa7, 0xff, 0xcd, 0xca, 0xaa, 0x70, 0xc0, 0x13, 0x55, 0xbf, 0xf7, + 0x7b, 0xaf, 0xea, 0xfd, 0xea, 0xd5, 0x2b, 0x1a, 0x6a, 0xee, 0xe8, 0x6b, 0x6a, 0x05, 0x1d, 0x9f, + 0x7a, 0x97, 0xb6, 0x45, 0x8d, 0x85, 0xe7, 0x06, 0x2e, 0x56, 0x05, 0xaa, 0x57, 0x3d, 0x3a, 0xf1, + 0x3b, 0xc1, 0xd5, 0x82, 0xfa, 0xc2, 0xa2, 0x63, 0xc9, 0x4f, 0x63, 0x07, 0x3e, 0xf5, 0x7d, 0xdb, + 0x75, 0xb2, 0x44, 0x19, 0xb1, 0x73, 0x41, 0x03, 0x53, 0x62, 0xb5, 0x08, 0xbb, 0xa4, 0x9e, 0x3d, + 0xb9, 0x92, 0x68, 0x7b, 0x6a, 0x07, 0xb3, 0x70, 0x64, 0x58, 0xee, 0x45, 0x67, 0xea, 0x4e, 0xdd, + 0x0e, 0x87, 0x47, 0xe1, 0x84, 0xcf, 0xf8, 0x84, 0x8f, 0x04, 0xbd, 0xf9, 0x13, 0x02, 0x78, 0x4c, + 0x03, 0x42, 0x9f, 0x87, 0xd4, 0x0f, 0x70, 0x1b, 0xf6, 0x1e, 0x8d, 0xc7, 0x1e, 0xf5, 0xfd, 0x3a, + 0x3a, 0x42, 0xad, 0xf2, 0x83, 0x8a, 0xc1, 0x36, 0x6d, 0x48, 0xb0, 0x5b, 0x78, 0x79, 0x7d, 0x98, + 0x23, 0x11, 0x07, 0x57, 0x41, 0x21, 0xe6, 0xb2, 0x9e, 0x3f, 0x42, 0xad, 0x12, 0x61, 0x43, 0xfc, + 0x10, 0x0a, 0x9f, 0xd1, 0xc0, 0xac, 0x8f, 0xb8, 0xb7, 0x6e, 0x44, 0x4a, 0xc8, 0x05, 0x98, 0xad, + 0x4f, 0xcd, 0x31, 0xf5, 0xba, 0x25, 0x16, 0xea, 0xd5, 0xf5, 0x21, 0x22, 0xdc, 0x03, 0xf7, 0x40, + 0x7d, 0xca, 0x13, 0xa9, 0x5b, 0xdc, 0xb7, 0x79, 0xd3, 0x97, 0x5b, 0x6d, 0xcb, 0x0c, 0x6c, 0xd7, + 0x79, 0x2d, 0x86, 0xf4, 0x6d, 0xbe, 0x40, 0x50, 0xe6, 0xf9, 0xf8, 0x0b, 0xd7, 0xf1, 0x29, 0x6e, + 0x81, 0x54, 0x5f, 0xe6, 0xb3, 0x6f, 0x88, 0xa9, 0x71, 0xc6, 0x7f, 0xfa, 0x39, 0x22, 0xed, 0xf8, + 0x0e, 0x14, 0x4f, 0x66, 0xa1, 0xf3, 0x8c, 0x67, 0xa3, 0xf5, 0x73, 0x44, 0x4c, 0xf1, 0xc7, 0x32, + 0x23, 0xb1, 0xab, 0xbb, 0xa9, 0x5d, 0x89, 0x25, 0xd6, 0xa7, 0xd4, 0x55, 0x00, 0x91, 0xe6, 0x8f, + 0x79, 0x80, 0xf3, 0x30, 0x56, 0xf8, 0x43, 0x50, 0x05, 0x5b, 0x6e, 0xe8, 0x5e, 0xb4, 0xa1, 0x84, + 0xc3, 0x86, 0x82, 0xc3, 0xb6, 0x27, 0x46, 0x6b, 0xb7, 0xb7, 0x63, 0xc1, 0xf5, 0x2f, 0xe1, 0x56, + 0xbc, 0x5d, 0xfc, 0x0e, 0xa8, 0x67, 0x6f, 0x50, 0x9b, 0x48, 0x2b, 0xbe, 0x0f, 0xc5, 0x2f, 0xdc, + 0x67, 0xd4, 0xe1, 0xc9, 0x30, 0x9a, 0xac, 0x79, 0x83, 0xa3, 0x44, 0x18, 0x85, 0x7c, 0x4b, 0x28, + 0x73, 0x65, 0xe4, 0x79, 0xfe, 0xc7, 0x02, 0xdd, 0xfc, 0xf0, 0x9a, 0x2f, 0xf2, 0x50, 0xe9, 0xd1, + 0x39, 0x0d, 0xe8, 0x86, 0x97, 0xe3, 0x5d, 0xd8, 0x3b, 0x5b, 0x3a, 0xd4, 0x1b, 0xf4, 0xc4, 0x99, + 0x75, 0x6f, 0x33, 0xfb, 0x2f, 0xd7, 0x87, 0x11, 0x4c, 0xa2, 0x41, 0xa2, 0x87, 0xf2, 0x06, 0x3d, + 0x76, 0x7e, 0xb7, 0x3e, 0x85, 0xfd, 0x48, 0x10, 0x79, 0x1a, 0x5b, 0xc8, 0xfb, 0x27, 0x82, 0x32, + 0x33, 0x45, 0xe2, 0x3e, 0xfc, 0x07, 0x71, 0x63, 0xf1, 0x24, 0x90, 0xe8, 0x7c, 0x04, 0xe5, 0xd3, + 0x70, 0x3e, 0x17, 0xeb, 0xf8, 0xb2, 0x19, 0xa5, 0xa1, 0xa8, 0x4d, 0x29, 0xff, 0x9f, 0x36, 0xf5, + 0x1c, 0x34, 0x91, 0xbc, 0x14, 0xf2, 0xdf, 0x5e, 0x9c, 0x2d, 0x04, 0xff, 0x03, 0x41, 0x65, 0x48, + 0x4d, 0xcf, 0x9a, 0x25, 0xf5, 0x5c, 0x3e, 0x71, 0x9d, 0xc0, 0xb4, 0x45, 0x91, 0x22, 0x5e, 0xa4, + 0x65, 0xa9, 0xb3, 0x72, 0x32, 0xe8, 0x91, 0xb4, 0x1d, 0xd7, 0xa0, 0xf8, 0x24, 0xa4, 0xde, 0x95, + 0xa8, 0x66, 0x22, 0x26, 0xb8, 0x09, 0x1a, 0x1f, 0x3c, 0xa5, 0x1e, 0xab, 0x58, 0x2e, 0x72, 0x85, + 0x64, 0xb0, 0x9d, 0xab, 0xfd, 0x0d, 0xec, 0x47, 0x99, 0x4b, 0xbd, 0xdf, 0x87, 0x5b, 0xb2, 0x7c, + 0x28, 0xab, 0x37, 0x65, 0xdd, 0x65, 0x4e, 0x58, 0xdb, 0x48, 0xff, 0x3b, 0x82, 0xdb, 0xec, 0x51, + 0x32, 0x9d, 0xe9, 0xe6, 0xcd, 0xa4, 0xc8, 0xdd, 0x65, 0xc7, 0xac, 0x44, 0xf5, 0xc1, 0x41, 0x49, + 0x16, 0x8c, 0x9d, 0xab, 0x6d, 0x43, 0x35, 0x49, 0x56, 0xea, 0xad, 0x43, 0xe9, 0xd4, 0x33, 0xa7, + 0x17, 0xd4, 0x11, 0x15, 0xae, 0x91, 0x78, 0xbe, 0x8d, 0xb0, 0xdf, 0xe6, 0xe1, 0x20, 0x5a, 0xab, + 0x6f, 0xfa, 0xb3, 0x0d, 0xc5, 0x7d, 0x0f, 0x54, 0x1e, 0x82, 0x35, 0x0f, 0x65, 0x9d, 0xba, 0x92, + 0x82, 0x31, 0x14, 0x86, 0xe6, 0x3c, 0xe0, 0x85, 0xae, 0x11, 0x3e, 0xde, 0xb9, 0xe4, 0x4b, 0xa8, + 0x65, 0x65, 0x90, 0xb2, 0xdf, 0x07, 0x95, 0xcd, 0x65, 0x8d, 0x6b, 0x5d, 0x4d, 0x5e, 0xee, 0x02, + 0x67, 0x49, 0xdb, 0x16, 0x07, 0xf0, 0xe0, 0x7b, 0x05, 0xf6, 0x86, 0x82, 0x8e, 0x8f, 0x41, 0x79, + 0x4c, 0x03, 0x8c, 0x23, 0xf1, 0x92, 0xbf, 0x95, 0xfa, 0x41, 0x06, 0x13, 0x51, 0x8f, 0x11, 0xf3, + 0x38, 0x0f, 0x53, 0x1e, 0xc9, 0x5f, 0xa0, 0xc4, 0x23, 0xf5, 0xf8, 0xb7, 0x10, 0xfe, 0x08, 0x54, + 0xf1, 0x04, 0xe1, 0xb7, 0x22, 0x42, 0xe6, 0x8d, 0xd6, 0xef, 0xdc, 0x84, 0xe3, 0x0b, 0x5f, 0x60, + 0x29, 0xe0, 0x38, 0x6e, 0xea, 0xed, 0xd1, 0x6b, 0x59, 0x30, 0x7e, 0xdc, 0x54, 0xd1, 0x35, 0x92, + 0xb5, 0x32, 0xfd, 0x33, 0x59, 0x2b, 0xdb, 0x5c, 0x8e, 0x11, 0xfe, 0x04, 0x4a, 0xd1, 0x79, 0xe0, + 0xb7, 0xd3, 0xb9, 0xa7, 0x3a, 0x80, 0x5e, 0x7f, 0xdd, 0x10, 0x07, 0x18, 0x80, 0x96, 0x3e, 0x50, + 0x7c, 0xf7, 0x26, 0x37, 0x55, 0xed, 0xfa, 0xbd, 0xbf, 0x37, 0x8a, 0x60, 0xdd, 0x27, 0x2f, 0x57, + 0x0d, 0xf4, 0x6a, 0xd5, 0x40, 0x3f, 0xaf, 0x1a, 0xe8, 0xd7, 0x55, 0x03, 0x7d, 0xf7, 0x5b, 0x23, + 0xf7, 0x55, 0x2b, 0xf5, 0x99, 0xe0, 0xf8, 0x0b, 0xcb, 0x6a, 0x8f, 0xe9, 0x65, 0xc7, 0xa1, 0xee, + 0xc4, 0x6f, 0x9b, 0x0b, 0xbb, 0x3d, 0x75, 0x3b, 0x22, 0xe8, 0x0f, 0xf9, 0xea, 0xe7, 0xd4, 0x3d, + 0x1d, 0x1a, 0x8f, 0xce, 0x07, 0xf2, 0x35, 0x1a, 0xa9, 0xfc, 0xdb, 0xe1, 0x83, 0xbf, 0x02, 0x00, + 0x00, 0xff, 0xff, 0x9e, 0xc2, 0xdd, 0xbd, 0xef, 0x0c, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/object/service.proto b/object/service.proto index dbd2a80..2aa21fd 100644 --- a/object/service.proto +++ b/object/service.proto @@ -1,6 +1,6 @@ syntax = "proto3"; package object; -option go_package = "github.com/nspcc-dev/neofs-api/object"; +option go_package = "github.com/nspcc-dev/neofs-api-go/object"; option csharp_namespace = "NeoFS.API.Object"; import "refs/types.proto"; diff --git a/object/sg.go b/object/sg.go index a51123b..a75b950 100644 --- a/object/sg.go +++ b/object/sg.go @@ -3,8 +3,8 @@ package object import ( "sort" - "github.com/nspcc-dev/neofs-api/refs" - "github.com/nspcc-dev/neofs-api/storagegroup" + "github.com/nspcc-dev/neofs-api-go/refs" + "github.com/nspcc-dev/neofs-api-go/storagegroup" ) // Here are defined getter functions for objects that contain storage group diff --git a/object/sg_test.go b/object/sg_test.go index ed657b7..716e916 100644 --- a/object/sg_test.go +++ b/object/sg_test.go @@ -5,8 +5,8 @@ import ( "sort" "testing" - "github.com/nspcc-dev/neofs-api/hash" - "github.com/nspcc-dev/neofs-api/storagegroup" + "github.com/nspcc-dev/neofs-api-go/hash" + "github.com/nspcc-dev/neofs-api-go/storagegroup" "github.com/stretchr/testify/require" ) diff --git a/object/types.go b/object/types.go index e5735a5..de909a8 100644 --- a/object/types.go +++ b/object/types.go @@ -5,9 +5,9 @@ import ( "context" "github.com/gogo/protobuf/proto" - "github.com/nspcc-dev/neofs-api/internal" - "github.com/nspcc-dev/neofs-api/refs" - "github.com/nspcc-dev/neofs-api/session" + "github.com/nspcc-dev/neofs-api-go/internal" + "github.com/nspcc-dev/neofs-api-go/refs" + "github.com/nspcc-dev/neofs-api-go/session" ) type ( diff --git a/object/types.pb.go b/object/types.pb.go index 53be938..fe47459 100644 --- a/object/types.pb.go +++ b/object/types.pb.go @@ -7,9 +7,9 @@ import ( fmt "fmt" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/golang/protobuf/proto" - refs "github.com/nspcc-dev/neofs-api/refs" - session "github.com/nspcc-dev/neofs-api/session" - storagegroup "github.com/nspcc-dev/neofs-api/storagegroup" + refs "github.com/nspcc-dev/neofs-api-go/refs" + session "github.com/nspcc-dev/neofs-api-go/session" + storagegroup "github.com/nspcc-dev/neofs-api-go/storagegroup" io "io" math "math" math_bits "math/bits" @@ -826,64 +826,64 @@ func init() { func init() { proto.RegisterFile("object/types.proto", fileDescriptor_02021a1d39b1aee0) } var fileDescriptor_02021a1d39b1aee0 = []byte{ - // 908 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x55, 0xdd, 0x72, 0x1b, 0x35, - 0x14, 0xf6, 0xda, 0xeb, 0xbf, 0xe3, 0x4d, 0xb3, 0x15, 0xa5, 0xec, 0x84, 0xc1, 0x09, 0x3b, 0x94, - 0x09, 0x85, 0xac, 0x87, 0x14, 0xa6, 0xc3, 0x0d, 0x43, 0x1c, 0x03, 0xf6, 0x50, 0x12, 0x8f, 0x9c, - 0xe4, 0x82, 0xbb, 0xb5, 0x2d, 0xdb, 0x22, 0xb6, 0xe4, 0x91, 0xb4, 0x6d, 0xfd, 0x1a, 0x5c, 0x71, - 0xc7, 0x3d, 0x2f, 0xc0, 0x2b, 0xf4, 0x92, 0x4b, 0xa6, 0x17, 0x19, 0x26, 0x3c, 0x00, 0xaf, 0xd0, - 0x91, 0xf6, 0xc7, 0xbb, 0x69, 0x6f, 0x3c, 0x3a, 0xe7, 0xfb, 0x3e, 0xf9, 0xe8, 0xe8, 0x3b, 0x5a, - 0x40, 0x7c, 0xfc, 0x2b, 0x99, 0xa8, 0x8e, 0xda, 0xac, 0x89, 0x0c, 0xd6, 0x82, 0x2b, 0x8e, 0x6a, - 0x71, 0x6e, 0xcf, 0x15, 0x64, 0x26, 0xf3, 0xc8, 0xde, 0x7b, 0x92, 0x48, 0x49, 0x39, 0x2b, 0x24, - 0x3d, 0xa9, 0xb8, 0x08, 0xe7, 0x64, 0x2e, 0x78, 0xb4, 0x2e, 0x20, 0x47, 0x73, 0xaa, 0x16, 0xd1, - 0x38, 0x98, 0xf0, 0x55, 0x67, 0xce, 0xe7, 0xbc, 0x63, 0xd2, 0xe3, 0x68, 0x66, 0x22, 0x13, 0x98, - 0x55, 0x4c, 0xf7, 0x9f, 0x42, 0x15, 0x87, 0x6c, 0x4e, 0xd0, 0x43, 0xa8, 0x9d, 0xcf, 0x66, 0x92, - 0x28, 0xcf, 0x3a, 0xb0, 0x0e, 0x6d, 0x9c, 0x44, 0x3a, 0xff, 0x8c, 0xb0, 0xb9, 0x5a, 0x78, 0xe5, - 0x38, 0x1f, 0x47, 0xfe, 0x57, 0x00, 0x97, 0x92, 0x88, 0x3e, 0x09, 0xa7, 0x44, 0x20, 0x17, 0x2a, - 0x3f, 0x91, 0x8d, 0x91, 0x36, 0xb1, 0x5e, 0xa2, 0x07, 0x50, 0xbd, 0x0a, 0x97, 0x11, 0x31, 0xb2, - 0x26, 0x8e, 0x03, 0xff, 0x2f, 0x1b, 0x6a, 0x89, 0xc4, 0x07, 0xfb, 0x19, 0x65, 0xd7, 0x46, 0xd3, - 0x3a, 0x76, 0x82, 0xb8, 0x01, 0x81, 0xce, 0xf5, 0x4b, 0xd8, 0x60, 0xe8, 0x73, 0x68, 0x60, 0x32, - 0xa5, 0x82, 0x4c, 0x94, 0xd9, 0xa7, 0x75, 0xbc, 0x13, 0xe8, 0x06, 0x05, 0x27, 0xd3, 0xa9, 0x20, - 0x52, 0xf6, 0x4b, 0x38, 0x23, 0xa0, 0x42, 0x45, 0x5e, 0xc5, 0xd0, 0x51, 0xba, 0xed, 0x16, 0xe9, - 0x97, 0x70, 0xbe, 0xf2, 0x2f, 0xa1, 0x79, 0x21, 0x42, 0x26, 0x67, 0x5c, 0xac, 0x3c, 0xdb, 0x88, - 0xee, 0xa7, 0xa2, 0x0c, 0xe8, 0x97, 0xf0, 0x96, 0x65, 0x24, 0x7c, 0x35, 0x96, 0x8a, 0x33, 0xe2, - 0x55, 0xef, 0x48, 0x52, 0xc0, 0x48, 0xd2, 0x00, 0x7d, 0x0d, 0xb5, 0x2b, 0x22, 0xe8, 0x6c, 0xe3, - 0xd5, 0x0c, 0xff, 0xc3, 0x20, 0xb9, 0xd5, 0xc0, 0xa4, 0xe9, 0x24, 0x54, 0x94, 0xb3, 0xac, 0xc0, - 0x84, 0x8c, 0x3e, 0x85, 0x46, 0x9f, 0xaf, 0x78, 0x3f, 0x94, 0x0b, 0xaf, 0x7e, 0x60, 0x1d, 0x3a, - 0xdd, 0xc6, 0xeb, 0x9b, 0x7d, 0x5b, 0xc7, 0xfa, 0xe8, 0x29, 0x86, 0x1e, 0xc3, 0xee, 0x30, 0xdc, - 0x2c, 0x79, 0x38, 0x3d, 0x5d, 0x90, 0xc9, 0xb5, 0x8c, 0x56, 0x5e, 0x43, 0xd3, 0xfb, 0x25, 0x7c, - 0x17, 0x40, 0x4f, 0xa1, 0x39, 0x60, 0x8a, 0xcc, 0x05, 0x55, 0x1b, 0xaf, 0x69, 0xaa, 0xf9, 0x20, - 0xad, 0x3e, 0x03, 0xb2, 0x4a, 0xb6, 0x5c, 0xf4, 0x1d, 0x38, 0xa3, 0xd8, 0x75, 0x3f, 0x6a, 0xd7, - 0x79, 0x60, 0xb4, 0x7b, 0x41, 0xde, 0x8a, 0x41, 0x9e, 0xd1, 0x2f, 0xe1, 0x82, 0x42, 0x37, 0x6e, - 0x18, 0x8d, 0x97, 0x74, 0xa2, 0xbd, 0xd2, 0x2a, 0x36, 0x2e, 0x03, 0xf4, 0x9f, 0x66, 0x41, 0xb7, - 0x9e, 0xd8, 0xc8, 0x6f, 0xe5, 0x9a, 0xee, 0xff, 0x6f, 0x81, 0x33, 0xda, 0x48, 0x45, 0x56, 0xc9, - 0x2d, 0x7a, 0x50, 0xbf, 0x22, 0x42, 0x37, 0x34, 0xb1, 0x6f, 0x1a, 0xa2, 0x4f, 0x60, 0x27, 0xe9, - 0x40, 0xc1, 0xc6, 0xc5, 0x24, 0xda, 0x83, 0xf2, 0xa0, 0x67, 0x3c, 0xe3, 0x74, 0xe1, 0xd5, 0xcd, - 0x7e, 0xe9, 0xf5, 0xcd, 0x7e, 0x79, 0xd0, 0xc3, 0xe5, 0x41, 0x0f, 0x7d, 0x06, 0xf5, 0xf3, 0x17, - 0x8c, 0x88, 0x41, 0xcf, 0xf8, 0xc3, 0xe9, 0xee, 0x26, 0x84, 0x34, 0x8d, 0xd3, 0x05, 0xfa, 0x08, - 0x2a, 0xa7, 0x83, 0x9e, 0xf1, 0x84, 0xd3, 0x6d, 0x25, 0x34, 0x9d, 0xc2, 0xfa, 0x07, 0x7d, 0x03, - 0xcd, 0x53, 0x41, 0x42, 0x45, 0xa6, 0x27, 0x2a, 0x31, 0xc2, 0xfb, 0xe9, 0xf9, 0x0d, 0x40, 0x39, - 0x1b, 0x72, 0xca, 0x54, 0xd7, 0xd6, 0x5a, 0xbc, 0x65, 0xfb, 0x27, 0xb0, 0x53, 0x60, 0xa0, 0x3d, - 0x68, 0x5c, 0x32, 0xfa, 0xf2, 0x82, 0xae, 0x88, 0x39, 0x72, 0x05, 0x67, 0xb1, 0x9e, 0xbd, 0xef, - 0xd7, 0x7c, 0x92, 0x9e, 0x35, 0x0e, 0x7c, 0x0a, 0xbb, 0x77, 0xee, 0x17, 0x1d, 0xc2, 0x6e, 0xbc, - 0x92, 0x99, 0x6f, 0xf4, 0x5e, 0x0e, 0xbe, 0x9b, 0x46, 0x5f, 0xc0, 0xfd, 0x74, 0x3d, 0xa2, 0x73, - 0x16, 0xaa, 0x48, 0xc4, 0xa3, 0xed, 0xe0, 0xb7, 0x01, 0xff, 0x0f, 0x2b, 0x1e, 0x6e, 0xf4, 0x08, - 0x6c, 0xfd, 0x38, 0x99, 0x5d, 0xef, 0x6d, 0x2f, 0x5b, 0x63, 0xc1, 0xc5, 0x66, 0x4d, 0xb0, 0x81, - 0x93, 0xf6, 0x97, 0xdf, 0xd5, 0x7e, 0xff, 0x02, 0x6c, 0xcd, 0x44, 0x2d, 0xa8, 0x5f, 0xb2, 0x6b, - 0xc6, 0x5f, 0x30, 0xb7, 0x84, 0x00, 0x6a, 0xc3, 0x50, 0x10, 0xa6, 0x5c, 0x0b, 0x39, 0xd0, 0x18, - 0x0a, 0xf2, 0x9c, 0xf2, 0x48, 0xba, 0x65, 0xd4, 0x00, 0xfb, 0x8c, 0xbc, 0x54, 0x6e, 0x05, 0x35, - 0xa1, 0x7a, 0xba, 0xa0, 0xcb, 0xa9, 0x6b, 0x23, 0xb7, 0x68, 0x5d, 0xb7, 0xea, 0x2f, 0x73, 0x63, - 0x8f, 0x1e, 0x17, 0xaa, 0x7c, 0xf8, 0xd6, 0xf8, 0xe7, 0x4a, 0xf5, 0x9f, 0xbc, 0xab, 0x9c, 0x26, - 0x54, 0x47, 0xeb, 0x25, 0xd5, 0xd5, 0x34, 0xc0, 0xd6, 0x7d, 0x70, 0xcb, 0x3a, 0xf9, 0x33, 0x8f, - 0x96, 0x53, 0xb7, 0xe2, 0xff, 0x66, 0x41, 0xed, 0xdc, 0x6c, 0x8a, 0xbe, 0x2d, 0x3a, 0x37, 0x79, - 0xfe, 0x1e, 0xa4, 0xff, 0x99, 0xc7, 0x12, 0x17, 0x14, 0x9d, 0x1e, 0x40, 0x3d, 0xb9, 0x1b, 0xaf, - 0x7c, 0x50, 0x39, 0x6c, 0x1d, 0xdf, 0x4b, 0xa5, 0x05, 0x51, 0x4a, 0xd2, 0x93, 0x91, 0x58, 0x3d, - 0xb6, 0x37, 0x4e, 0x43, 0xff, 0xe3, 0xdc, 0x34, 0x6e, 0x9f, 0xeb, 0xf8, 0xfe, 0xe3, 0xa0, 0x7b, - 0xf6, 0xea, 0xb6, 0x6d, 0xfd, 0x7d, 0xdb, 0xb6, 0xfe, 0xb9, 0x6d, 0x5b, 0xff, 0xde, 0xb6, 0xad, - 0xdf, 0xff, 0x6b, 0x97, 0x7e, 0x79, 0x94, 0xfb, 0xc4, 0x30, 0xb9, 0x9e, 0x4c, 0x8e, 0xa6, 0xe4, - 0x79, 0x87, 0x11, 0x3e, 0x93, 0x47, 0xe1, 0x9a, 0x76, 0xe2, 0x7a, 0xfe, 0x2c, 0xbb, 0x67, 0x84, - 0xff, 0x30, 0x0a, 0x4e, 0x86, 0x83, 0x20, 0x3e, 0xfc, 0xb8, 0x66, 0x3e, 0x3a, 0x4f, 0xde, 0x04, - 0x00, 0x00, 0xff, 0xff, 0x29, 0xb2, 0x70, 0xad, 0x02, 0x07, 0x00, 0x00, + // 911 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x55, 0x4f, 0x73, 0x1b, 0x35, + 0x14, 0xf7, 0xda, 0xeb, 0x7f, 0xcf, 0x9b, 0x66, 0x2b, 0x4a, 0xd9, 0x31, 0x83, 0x13, 0x76, 0x80, + 0x31, 0x85, 0xac, 0x87, 0x14, 0xa6, 0xc3, 0x85, 0x21, 0x8e, 0x01, 0x7b, 0x28, 0x8d, 0x91, 0x93, + 0x1c, 0xb8, 0xad, 0x6d, 0x79, 0x2d, 0x62, 0x4b, 0x1e, 0x49, 0x6e, 0xeb, 0xaf, 0xc1, 0x89, 0x1b, + 0x77, 0xbe, 0x00, 0x5f, 0xa1, 0x47, 0x8e, 0x4c, 0x0f, 0x19, 0x26, 0x7c, 0x00, 0xbe, 0x42, 0x47, + 0xda, 0x5d, 0x7b, 0x37, 0xcd, 0xc5, 0xa3, 0xf7, 0x7e, 0xbf, 0x9f, 0xfc, 0xf4, 0xf4, 0x7b, 0x5a, + 0x40, 0x7c, 0xfc, 0x2b, 0x99, 0xa8, 0x8e, 0xda, 0xac, 0x88, 0x0c, 0x56, 0x82, 0x2b, 0x8e, 0x2a, + 0x71, 0xae, 0xe9, 0x0a, 0x32, 0x93, 0x59, 0xa4, 0xf9, 0x8e, 0x24, 0x52, 0x52, 0xce, 0x72, 0x49, + 0x4f, 0x2a, 0x2e, 0xc2, 0x88, 0x44, 0x82, 0xaf, 0x57, 0x39, 0xe4, 0x28, 0xa2, 0x6a, 0xbe, 0x1e, + 0x07, 0x13, 0xbe, 0xec, 0x44, 0x3c, 0xe2, 0x1d, 0x93, 0x1e, 0xaf, 0x67, 0x26, 0x32, 0x81, 0x59, + 0xc5, 0x74, 0xff, 0x09, 0x94, 0x71, 0xc8, 0x22, 0x82, 0x1e, 0x42, 0xe5, 0x6c, 0x36, 0x93, 0x44, + 0x79, 0xd6, 0xa1, 0xd5, 0xb6, 0x71, 0x12, 0xe9, 0xfc, 0x53, 0xc2, 0x22, 0x35, 0xf7, 0x8a, 0x71, + 0x3e, 0x8e, 0xfc, 0x2f, 0x01, 0x2e, 0x24, 0x11, 0x7d, 0x12, 0x4e, 0x89, 0x40, 0x2e, 0x94, 0x7e, + 0x24, 0x1b, 0x23, 0xad, 0x63, 0xbd, 0x44, 0x0f, 0xa0, 0x7c, 0x19, 0x2e, 0xd6, 0xc4, 0xc8, 0xea, + 0x38, 0x0e, 0xfc, 0xbf, 0x6c, 0xa8, 0x24, 0x12, 0x1f, 0xec, 0xa7, 0x94, 0x5d, 0x19, 0x4d, 0xe3, + 0xd8, 0x09, 0xe2, 0x06, 0x04, 0x3a, 0xd7, 0x2f, 0x60, 0x83, 0xa1, 0xcf, 0xa0, 0x86, 0xc9, 0x94, + 0x0a, 0x32, 0x51, 0x66, 0x9f, 0xc6, 0xf1, 0x5e, 0xa0, 0x1b, 0x14, 0x9c, 0x4c, 0xa7, 0x82, 0x48, + 0xd9, 0x2f, 0xe0, 0x2d, 0x01, 0xe5, 0x2a, 0xf2, 0x4a, 0x86, 0x8e, 0xd2, 0x6d, 0x77, 0x48, 0xbf, + 0x80, 0xb3, 0x95, 0x7f, 0x01, 0xf5, 0x73, 0x11, 0x32, 0x39, 0xe3, 0x62, 0xe9, 0xd9, 0x46, 0x74, + 0x3f, 0x15, 0x6d, 0x81, 0x7e, 0x01, 0xef, 0x58, 0x46, 0xc2, 0x97, 0x63, 0xa9, 0x38, 0x23, 0x5e, + 0xf9, 0x96, 0x24, 0x05, 0x8c, 0x24, 0x0d, 0xd0, 0x57, 0x50, 0xb9, 0x24, 0x82, 0xce, 0x36, 0x5e, + 0xc5, 0xf0, 0xdf, 0x0f, 0x92, 0x5b, 0x0d, 0x4c, 0x9a, 0x4e, 0x42, 0x45, 0x39, 0xdb, 0x16, 0x98, + 0x90, 0xd1, 0x27, 0x50, 0xeb, 0xf3, 0x25, 0xef, 0x87, 0x72, 0xee, 0x55, 0x0f, 0xad, 0xb6, 0xd3, + 0xad, 0xbd, 0xbe, 0x3e, 0xb0, 0x75, 0xac, 0x8f, 0x9e, 0x62, 0xe8, 0x11, 0xec, 0x0f, 0xc3, 0xcd, + 0x82, 0x87, 0xd3, 0xd3, 0x39, 0x99, 0x5c, 0xc9, 0xf5, 0xd2, 0xab, 0x69, 0x7a, 0xbf, 0x80, 0x6f, + 0x03, 0xe8, 0x09, 0xd4, 0x07, 0x4c, 0x91, 0x48, 0x50, 0xb5, 0xf1, 0xea, 0xa6, 0x9a, 0xf7, 0xd2, + 0xea, 0xb7, 0xc0, 0xb6, 0x92, 0x1d, 0x17, 0x7d, 0x0b, 0xce, 0x28, 0x76, 0xdd, 0x0f, 0xda, 0x75, + 0x1e, 0x18, 0x6d, 0x33, 0xc8, 0x5a, 0x31, 0xc8, 0x32, 0xfa, 0x05, 0x9c, 0x53, 0xe8, 0xc6, 0x0d, + 0xd7, 0xe3, 0x05, 0x9d, 0x68, 0xaf, 0x34, 0xf2, 0x8d, 0xdb, 0x02, 0xfa, 0x4f, 0xb7, 0x41, 0xb7, + 0x9a, 0xd8, 0xc8, 0x6f, 0x64, 0x9a, 0xee, 0xff, 0x6f, 0x81, 0x33, 0xda, 0x48, 0x45, 0x96, 0xc9, + 0x2d, 0x7a, 0x50, 0xbd, 0x24, 0x42, 0x37, 0x34, 0xb1, 0x6f, 0x1a, 0xa2, 0x8f, 0x60, 0x2f, 0xe9, + 0x40, 0xce, 0xc6, 0xf9, 0x24, 0x6a, 0x42, 0x71, 0xd0, 0x33, 0x9e, 0x71, 0xba, 0xf0, 0xea, 0xfa, + 0xa0, 0xf0, 0xfa, 0xfa, 0xa0, 0x38, 0xe8, 0xe1, 0xe2, 0xa0, 0x87, 0x3e, 0x85, 0xea, 0xd9, 0x0b, + 0x46, 0xc4, 0xa0, 0x67, 0xfc, 0xe1, 0x74, 0xf7, 0x13, 0x42, 0x9a, 0xc6, 0xe9, 0x02, 0x7d, 0x00, + 0xa5, 0xd3, 0x41, 0xcf, 0x78, 0xc2, 0xe9, 0x36, 0x12, 0x9a, 0x4e, 0x61, 0xfd, 0x83, 0xbe, 0x86, + 0xfa, 0xa9, 0x20, 0xa1, 0x22, 0xd3, 0x13, 0x95, 0x18, 0xe1, 0xdd, 0xf4, 0xfc, 0x06, 0xa0, 0x9c, + 0x0d, 0x39, 0x65, 0xaa, 0x6b, 0x6b, 0x2d, 0xde, 0xb1, 0xfd, 0x13, 0xd8, 0xcb, 0x31, 0x50, 0x13, + 0x6a, 0x17, 0x8c, 0xbe, 0x3c, 0xa7, 0x4b, 0x62, 0x8e, 0x5c, 0xc2, 0xdb, 0x58, 0xcf, 0xde, 0x77, + 0x2b, 0x3e, 0x49, 0xcf, 0x1a, 0x07, 0x3e, 0x85, 0xfd, 0x5b, 0xf7, 0x8b, 0xda, 0xb0, 0x1f, 0xaf, + 0xe4, 0xd6, 0x37, 0x7a, 0x2f, 0x07, 0xdf, 0x4e, 0xa3, 0xcf, 0xe1, 0x7e, 0xba, 0x1e, 0xd1, 0x88, + 0x85, 0x6a, 0x2d, 0xe2, 0xd1, 0x76, 0xf0, 0xdb, 0x80, 0xff, 0x87, 0x15, 0x0f, 0x37, 0xfa, 0x18, + 0x6c, 0xfd, 0x38, 0x99, 0x5d, 0xef, 0xed, 0x2e, 0x5b, 0x63, 0xc1, 0xf9, 0x66, 0x45, 0xb0, 0x81, + 0x93, 0xf6, 0x17, 0xef, 0x6a, 0xbf, 0x7f, 0x0e, 0xb6, 0x66, 0xa2, 0x06, 0x54, 0x2f, 0xd8, 0x15, + 0xe3, 0x2f, 0x98, 0x5b, 0x40, 0x00, 0x95, 0x61, 0x28, 0x08, 0x53, 0xae, 0x85, 0x1c, 0xa8, 0x0d, + 0x05, 0x79, 0x4e, 0xf9, 0x5a, 0xba, 0x45, 0x54, 0x03, 0xfb, 0x19, 0x79, 0xa9, 0xdc, 0x12, 0xaa, + 0x43, 0xf9, 0x74, 0x4e, 0x17, 0x53, 0xd7, 0x46, 0x6e, 0xde, 0xba, 0x6e, 0xd9, 0x5f, 0x64, 0xc6, + 0x1e, 0x3d, 0xca, 0x55, 0xf9, 0xf0, 0xad, 0xf1, 0xcf, 0x94, 0xea, 0x3f, 0xbe, 0xab, 0x9c, 0x3a, + 0x94, 0x47, 0xab, 0x05, 0xd5, 0xd5, 0xd4, 0xc0, 0xd6, 0x7d, 0x70, 0x8b, 0x3a, 0xf9, 0x13, 0x5f, + 0x2f, 0xa6, 0x6e, 0xc9, 0xff, 0xcd, 0x82, 0xca, 0x99, 0xd9, 0x14, 0x7d, 0x93, 0x77, 0x6e, 0xf2, + 0xfc, 0x3d, 0x48, 0xff, 0x33, 0x8b, 0x25, 0x2e, 0xc8, 0x3b, 0x3d, 0x80, 0x6a, 0x72, 0x37, 0x5e, + 0xf1, 0xb0, 0xd4, 0x6e, 0x1c, 0xdf, 0x4b, 0xa5, 0x39, 0x51, 0x4a, 0xd2, 0x93, 0x91, 0x58, 0x3d, + 0xb6, 0x37, 0x4e, 0x43, 0xff, 0xc3, 0xcc, 0x34, 0xee, 0x9e, 0xeb, 0xf8, 0xfe, 0xe3, 0xa0, 0xfb, + 0xf3, 0xab, 0x9b, 0x96, 0xf5, 0xf7, 0x4d, 0xcb, 0xfa, 0xe7, 0xa6, 0x65, 0xfd, 0x7b, 0xd3, 0xb2, + 0x7e, 0xff, 0xaf, 0x55, 0xf8, 0xa5, 0x9d, 0xf9, 0xc4, 0x30, 0xb9, 0x9a, 0x4c, 0x8e, 0xa6, 0xe4, + 0x79, 0x87, 0x11, 0x3e, 0x93, 0x47, 0xe1, 0x8a, 0x1e, 0x45, 0xbc, 0x13, 0x97, 0xf4, 0x67, 0xd1, + 0x7d, 0x46, 0xf8, 0xf7, 0xa3, 0xe0, 0x64, 0x38, 0x08, 0xe2, 0xf3, 0x8f, 0x2b, 0xe6, 0xbb, 0xf3, + 0xf8, 0x4d, 0x00, 0x00, 0x00, 0xff, 0xff, 0xee, 0xb1, 0xc7, 0x51, 0x05, 0x07, 0x00, 0x00, } func (m *Range) Marshal() (dAtA []byte, err error) { diff --git a/object/types.proto b/object/types.proto index 3abe725..f21bf74 100644 --- a/object/types.proto +++ b/object/types.proto @@ -1,6 +1,6 @@ syntax = "proto3"; package object; -option go_package = "github.com/nspcc-dev/neofs-api/object"; +option go_package = "github.com/nspcc-dev/neofs-api-go/object"; option csharp_namespace = "NeoFS.API.Object"; import "refs/types.proto"; diff --git a/object/utils.go b/object/utils.go index 329f287..07f0984 100644 --- a/object/utils.go +++ b/object/utils.go @@ -4,7 +4,7 @@ import ( "io" "strconv" - "github.com/nspcc-dev/neofs-api/session" + "github.com/nspcc-dev/neofs-api-go/session" "github.com/pkg/errors" ) diff --git a/object/verification_test.go b/object/verification_test.go index 053a7de..b37ec70 100644 --- a/object/verification_test.go +++ b/object/verification_test.go @@ -4,9 +4,9 @@ import ( "testing" "github.com/google/uuid" - "github.com/nspcc-dev/neofs-api/container" - "github.com/nspcc-dev/neofs-api/refs" - "github.com/nspcc-dev/neofs-api/session" + "github.com/nspcc-dev/neofs-api-go/container" + "github.com/nspcc-dev/neofs-api-go/refs" + "github.com/nspcc-dev/neofs-api-go/session" crypto "github.com/nspcc-dev/neofs-crypto" "github.com/nspcc-dev/neofs-crypto/test" "github.com/stretchr/testify/require" diff --git a/query/types.pb.go b/query/types.pb.go index ed20942..96bd198 100644 --- a/query/types.pb.go +++ b/query/types.pb.go @@ -163,7 +163,7 @@ func init() { func init() { proto.RegisterFile("query/types.proto", fileDescriptor_c682aeaf51d46f4d) } var fileDescriptor_c682aeaf51d46f4d = []byte{ - // 293 bytes of a gzipped FileDescriptorProto + // 296 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x2c, 0x2c, 0x4d, 0x2d, 0xaa, 0xd4, 0x2f, 0xa9, 0x2c, 0x48, 0x2d, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x05, 0x0b, 0x49, 0xe9, 0xa6, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0xa7, 0xe7, @@ -177,12 +177,12 @@ var fileDescriptor_c682aeaf51d46f4d = []byte{ 0x28, 0x35, 0x3d, 0xb5, 0x42, 0x80, 0xd1, 0x8a, 0x65, 0xc6, 0x02, 0x79, 0x06, 0x25, 0x1b, 0x2e, 0xd6, 0x40, 0x90, 0x95, 0x42, 0xba, 0x5c, 0xec, 0x10, 0x5b, 0x8b, 0x25, 0x18, 0x15, 0x98, 0x35, 0xb8, 0x8d, 0x78, 0x51, 0xdc, 0xe2, 0xc4, 0x72, 0xe2, 0x9e, 0x3c, 0x43, 0x10, 0x4c, 0x0d, 0x44, - 0xb7, 0x93, 0xcf, 0x89, 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, 0x31, 0xde, 0x78, 0x24, 0xc7, 0xf8, - 0xe0, 0x91, 0x1c, 0xe3, 0x8c, 0xc7, 0x72, 0x0c, 0x51, 0x2a, 0x48, 0xa1, 0x91, 0x57, 0x5c, 0x90, + 0xb7, 0x93, 0xff, 0x89, 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, 0x31, 0xde, 0x78, 0x24, 0xc7, 0xf8, + 0xe0, 0x91, 0x1c, 0xe3, 0x8c, 0xc7, 0x72, 0x0c, 0x51, 0xea, 0x48, 0xa1, 0x91, 0x57, 0x5c, 0x90, 0x9c, 0xac, 0x9b, 0x92, 0x5a, 0xa6, 0x9f, 0x97, 0x9a, 0x9f, 0x56, 0xac, 0x9b, 0x58, 0x90, 0xa9, - 0x0f, 0x36, 0x77, 0x15, 0x13, 0xbf, 0x5f, 0x6a, 0xbe, 0x5b, 0xb0, 0x9e, 0x63, 0x80, 0xa7, 0x1e, - 0xd8, 0x09, 0x49, 0x6c, 0xe0, 0xd0, 0x31, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0x2b, 0x12, 0xad, - 0xe4, 0x68, 0x01, 0x00, 0x00, + 0x9b, 0x9e, 0xaf, 0x0f, 0x36, 0x7a, 0x15, 0x13, 0xbf, 0x5f, 0x6a, 0xbe, 0x5b, 0xb0, 0x9e, 0x63, + 0x80, 0xa7, 0x1e, 0xd8, 0x15, 0x49, 0x6c, 0xe0, 0x00, 0x32, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, + 0x83, 0xc6, 0x2b, 0x05, 0x6b, 0x01, 0x00, 0x00, } func (m *Filter) Marshal() (dAtA []byte, err error) { diff --git a/query/types.proto b/query/types.proto index 0d35154..ebc0d64 100644 --- a/query/types.proto +++ b/query/types.proto @@ -1,6 +1,6 @@ syntax = "proto3"; package query; -option go_package = "github.com/nspcc-dev/neofs-api/query"; +option go_package = "github.com/nspcc-dev/neofs-api-go/query"; option csharp_namespace = "NeoFS.API.Query"; import "github.com/gogo/protobuf/gogoproto/gogo.proto"; diff --git a/refs/address.go b/refs/address.go index 9c9ce7d..f07e317 100644 --- a/refs/address.go +++ b/refs/address.go @@ -4,7 +4,7 @@ import ( "crypto/sha256" "strings" - "github.com/nspcc-dev/neofs-api/internal" + "github.com/nspcc-dev/neofs-api-go/internal" ) const ( diff --git a/refs/owner.go b/refs/owner.go index 59c9c25..1aed00c 100644 --- a/refs/owner.go +++ b/refs/owner.go @@ -5,7 +5,7 @@ import ( "crypto/ecdsa" "github.com/mr-tron/base58" - "github.com/nspcc-dev/neofs-api/chain" + "github.com/nspcc-dev/neofs-api-go/chain" "github.com/pkg/errors" ) diff --git a/refs/types.go b/refs/types.go index c0ba85a..117aa03 100644 --- a/refs/types.go +++ b/refs/types.go @@ -13,8 +13,8 @@ import ( "crypto/sha256" "github.com/google/uuid" - "github.com/nspcc-dev/neofs-api/chain" - "github.com/nspcc-dev/neofs-api/internal" + "github.com/nspcc-dev/neofs-api-go/chain" + "github.com/nspcc-dev/neofs-api-go/internal" ) type ( diff --git a/refs/types.pb.go b/refs/types.pb.go index e4d6a65..1b483cd 100644 --- a/refs/types.pb.go +++ b/refs/types.pb.go @@ -69,7 +69,7 @@ func init() { func init() { proto.RegisterFile("refs/types.proto", fileDescriptor_063a64a96d952d31) } var fileDescriptor_063a64a96d952d31 = []byte{ - // 218 bytes of a gzipped FileDescriptorProto + // 221 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x28, 0x4a, 0x4d, 0x2b, 0xd6, 0x2f, 0xa9, 0x2c, 0x48, 0x2d, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x01, 0x89, 0x48, 0xe9, 0xa6, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0xa7, 0xe7, 0xa7, @@ -77,13 +77,13 @@ var fileDescriptor_063a64a96d952d31 = []byte{ 0xe3, 0x62, 0x77, 0x4c, 0x49, 0x29, 0x4a, 0x2d, 0x2e, 0x16, 0xd2, 0xe1, 0xe2, 0xf0, 0x4f, 0xca, 0x4a, 0x4d, 0x2e, 0xf1, 0x74, 0x91, 0x60, 0x54, 0x60, 0xd4, 0xe0, 0x71, 0x12, 0x38, 0x71, 0x4f, 0x9e, 0xe1, 0xd6, 0x3d, 0x79, 0xb8, 0x78, 0x10, 0x9c, 0x25, 0x24, 0xcb, 0xc5, 0xec, 0xec, 0xe9, - 0x22, 0xc1, 0x04, 0x56, 0xc8, 0x0d, 0x55, 0x08, 0x12, 0x0a, 0x02, 0x11, 0x4e, 0x41, 0x37, 0x1e, + 0x22, 0xc1, 0x04, 0x56, 0xc8, 0x0d, 0x55, 0x08, 0x12, 0x0a, 0x02, 0x11, 0x4e, 0xa1, 0x37, 0x1e, 0xca, 0x31, 0x34, 0x3c, 0x92, 0x63, 0x38, 0xf1, 0x48, 0x8e, 0xf1, 0xc2, 0x23, 0x39, 0xc6, 0x1b, - 0x8f, 0xe4, 0x18, 0x1f, 0x3c, 0x92, 0x63, 0x9c, 0xf1, 0x58, 0x8e, 0x21, 0x4a, 0x19, 0xc9, 0x91, + 0x8f, 0xe4, 0x18, 0x1f, 0x3c, 0x92, 0x63, 0x9c, 0xf1, 0x58, 0x8e, 0x21, 0x4a, 0x0d, 0xc9, 0x91, 0x79, 0xc5, 0x05, 0xc9, 0xc9, 0xba, 0x29, 0xa9, 0x65, 0xfa, 0x79, 0xa9, 0xf9, 0x69, 0xc5, 0xba, - 0x89, 0x05, 0x99, 0xfa, 0x20, 0x9f, 0xac, 0x62, 0xe2, 0xf3, 0x4b, 0xcd, 0x77, 0x0b, 0xd6, 0x73, - 0x0c, 0xf0, 0xd4, 0x0b, 0x4a, 0x4d, 0x2b, 0x4e, 0x62, 0x03, 0x3b, 0xd9, 0x18, 0x10, 0x00, 0x00, - 0xff, 0xff, 0xa7, 0xa4, 0xe2, 0xf3, 0xfb, 0x00, 0x00, 0x00, + 0x89, 0x05, 0x99, 0xba, 0xe9, 0xf9, 0xfa, 0x20, 0xcf, 0xac, 0x62, 0xe2, 0xf3, 0x4b, 0xcd, 0x77, + 0x0b, 0xd6, 0x73, 0x0c, 0xf0, 0xd4, 0x0b, 0x4a, 0x4d, 0x2b, 0x4e, 0x62, 0x03, 0xbb, 0xda, 0x18, + 0x10, 0x00, 0x00, 0xff, 0xff, 0xae, 0x9a, 0x6d, 0x68, 0xfe, 0x00, 0x00, 0x00, } func (m *Address) Marshal() (dAtA []byte, err error) { diff --git a/refs/types.proto b/refs/types.proto index d552d6c..6b001c0 100644 --- a/refs/types.proto +++ b/refs/types.proto @@ -1,6 +1,6 @@ syntax = "proto3"; package refs; -option go_package = "github.com/nspcc-dev/neofs-api/refs"; +option go_package = "github.com/nspcc-dev/neofs-api-go/refs"; option csharp_namespace = "NeoFS.API.Refs"; import "github.com/gogo/protobuf/gogoproto/gogo.proto"; diff --git a/service/meta.go b/service/meta.go index dc2cdd3..5e9886d 100644 --- a/service/meta.go +++ b/service/meta.go @@ -1,7 +1,7 @@ package service import ( - "github.com/nspcc-dev/neofs-api/internal" + "github.com/nspcc-dev/neofs-api-go/internal" "github.com/pkg/errors" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" diff --git a/service/meta.pb.go b/service/meta.pb.go index b4769e2..8039990 100644 --- a/service/meta.pb.go +++ b/service/meta.pb.go @@ -152,7 +152,7 @@ func init() { func init() { proto.RegisterFile("service/meta.proto", fileDescriptor_a638867e7b43457c) } var fileDescriptor_a638867e7b43457c = []byte{ - // 244 bytes of a gzipped FileDescriptorProto + // 247 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x2a, 0x4e, 0x2d, 0x2a, 0xcb, 0x4c, 0x4e, 0xd5, 0xcf, 0x4d, 0x2d, 0x49, 0xd4, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x87, 0x8a, 0x49, 0xe9, 0xa6, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0xa7, @@ -163,12 +163,12 @@ var fileDescriptor_a638867e7b43457c = []byte{ 0x14, 0x18, 0x35, 0x58, 0x82, 0x20, 0x1c, 0x21, 0x09, 0x2e, 0xf6, 0xb0, 0xd4, 0xa2, 0xe2, 0xcc, 0xfc, 0x3c, 0x09, 0x66, 0xb0, 0x5a, 0x18, 0x57, 0xc9, 0x85, 0x4b, 0x28, 0x28, 0xb5, 0xb8, 0x20, 0x3f, 0xaf, 0x38, 0x15, 0xc9, 0x5c, 0xb8, 0x29, 0x8c, 0x38, 0x4c, 0x61, 0x42, 0x31, 0xc5, 0x29, - 0xe0, 0xc4, 0x23, 0x39, 0xc6, 0x0b, 0x8f, 0xe4, 0x18, 0x6f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, - 0x8e, 0x71, 0xc6, 0x63, 0x39, 0x86, 0x28, 0x35, 0x24, 0x1f, 0xe6, 0x15, 0x17, 0x24, 0x27, 0xeb, - 0xa6, 0xa4, 0x96, 0xe9, 0xe7, 0xa5, 0xe6, 0xa7, 0x15, 0xeb, 0x26, 0x16, 0x64, 0xea, 0x43, 0x43, - 0x62, 0x15, 0x93, 0xa0, 0x5f, 0x6a, 0xbe, 0x5b, 0xb0, 0x9e, 0x63, 0x80, 0xa7, 0x5e, 0x30, 0x44, - 0x2c, 0x89, 0x0d, 0xec, 0x6b, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0xd5, 0x3a, 0x21, 0x1a, - 0x43, 0x01, 0x00, 0x00, + 0xf8, 0xc4, 0x23, 0x39, 0xc6, 0x0b, 0x8f, 0xe4, 0x18, 0x6f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, + 0x8e, 0x71, 0xc6, 0x63, 0x39, 0x86, 0x28, 0x4d, 0x24, 0x1f, 0xe6, 0x15, 0x17, 0x24, 0x27, 0xeb, + 0xa6, 0xa4, 0x96, 0xe9, 0xe7, 0xa5, 0xe6, 0xa7, 0x15, 0xeb, 0x26, 0x16, 0x64, 0xea, 0xa6, 0xe7, + 0xeb, 0x43, 0x03, 0x63, 0x15, 0x93, 0xa0, 0x5f, 0x6a, 0xbe, 0x5b, 0xb0, 0x9e, 0x63, 0x80, 0xa7, + 0x5e, 0x30, 0x44, 0x2c, 0x89, 0x0d, 0xec, 0x71, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0x36, + 0xce, 0x54, 0x19, 0x46, 0x01, 0x00, 0x00, } func (m *RequestMetaHeader) Marshal() (dAtA []byte, err error) { diff --git a/service/meta.proto b/service/meta.proto index 97017c9..99b37d3 100644 --- a/service/meta.proto +++ b/service/meta.proto @@ -1,6 +1,6 @@ syntax = "proto3"; package service; -option go_package = "github.com/nspcc-dev/neofs-api/service"; +option go_package = "github.com/nspcc-dev/neofs-api-go/service"; option csharp_namespace = "NeoFS.API.Service"; import "github.com/gogo/protobuf/gogoproto/gogo.proto"; diff --git a/service/verify.go b/service/verify.go index c8bd8d6..9687032 100644 --- a/service/verify.go +++ b/service/verify.go @@ -4,8 +4,8 @@ import ( "crypto/ecdsa" "sync" - "github.com/nspcc-dev/neofs-api/internal" - "github.com/nspcc-dev/neofs-api/refs" + "github.com/nspcc-dev/neofs-api-go/internal" + "github.com/nspcc-dev/neofs-api-go/refs" crypto "github.com/nspcc-dev/neofs-crypto" "github.com/pkg/errors" ) diff --git a/service/verify.pb.go b/service/verify.pb.go index c7a2435..9dca855 100644 --- a/service/verify.pb.go +++ b/service/verify.pb.go @@ -179,7 +179,7 @@ func init() { func init() { proto.RegisterFile("service/verify.proto", fileDescriptor_4bdd5bc50ec96238) } var fileDescriptor_4bdd5bc50ec96238 = []byte{ - // 288 bytes of a gzipped FileDescriptorProto + // 291 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x29, 0x4e, 0x2d, 0x2a, 0xcb, 0x4c, 0x4e, 0xd5, 0x2f, 0x4b, 0x2d, 0xca, 0x4c, 0xab, 0xd4, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x87, 0x8a, 0x4a, 0xe9, 0xa6, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, @@ -192,12 +192,13 @@ var fileDescriptor_4bdd5bc50ec96238 = []byte{ 0x13, 0x04, 0x17, 0x0b, 0x48, 0x4d, 0x2d, 0x92, 0x60, 0x82, 0x88, 0x81, 0xd8, 0x52, 0x93, 0x19, 0xb9, 0x38, 0xe1, 0xda, 0x85, 0x5c, 0x91, 0x74, 0x71, 0x1b, 0xa9, 0x13, 0xe9, 0x0a, 0x27, 0x8e, 0x13, 0xf7, 0xe4, 0x19, 0x2e, 0xdc, 0x93, 0x67, 0x84, 0x5a, 0x64, 0xcf, 0xc5, 0xe6, 0x5f, 0x94, - 0x99, 0x9e, 0x99, 0x07, 0xb6, 0x8a, 0x78, 0x83, 0x82, 0xa0, 0xda, 0x9c, 0x02, 0x4e, 0x3c, 0x92, + 0x99, 0x9e, 0x99, 0x07, 0xb6, 0x8a, 0x78, 0x83, 0x82, 0xa0, 0xda, 0x9c, 0x82, 0x4f, 0x3c, 0x92, 0x63, 0xbc, 0xf0, 0x48, 0x8e, 0xf1, 0xc6, 0x23, 0x39, 0xc6, 0x07, 0x8f, 0xe4, 0x18, 0x67, 0x3c, - 0x96, 0x63, 0x88, 0x52, 0x43, 0x0a, 0xf6, 0xbc, 0xe2, 0x82, 0xe4, 0x64, 0xdd, 0x94, 0xd4, 0x32, - 0xfd, 0xbc, 0xd4, 0xfc, 0xb4, 0x62, 0xdd, 0xc4, 0x82, 0x4c, 0x7d, 0xa8, 0x25, 0xab, 0x98, 0x04, - 0xfd, 0x52, 0xf3, 0xdd, 0x82, 0xf5, 0x1c, 0x03, 0x3c, 0xf5, 0x82, 0x21, 0x62, 0x49, 0x6c, 0xe0, - 0xa8, 0x30, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0x94, 0x02, 0xe4, 0x3c, 0xda, 0x01, 0x00, 0x00, + 0x96, 0x63, 0x88, 0xd2, 0x44, 0x0a, 0xf6, 0xbc, 0xe2, 0x82, 0xe4, 0x64, 0xdd, 0x94, 0xd4, 0x32, + 0xfd, 0xbc, 0xd4, 0xfc, 0xb4, 0x62, 0xdd, 0xc4, 0x82, 0x4c, 0xdd, 0xf4, 0x7c, 0x7d, 0xa8, 0x3d, + 0xab, 0x98, 0x04, 0xfd, 0x52, 0xf3, 0xdd, 0x82, 0xf5, 0x1c, 0x03, 0x3c, 0xf5, 0x82, 0x21, 0x62, + 0x49, 0x6c, 0xe0, 0xd8, 0x30, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0x23, 0xa3, 0x9d, 0x94, 0xdd, + 0x01, 0x00, 0x00, } func (m *RequestVerificationHeader) Marshal() (dAtA []byte, err error) { diff --git a/service/verify.proto b/service/verify.proto index d241d88..de0a69a 100644 --- a/service/verify.proto +++ b/service/verify.proto @@ -1,6 +1,6 @@ syntax = "proto3"; package service; -option go_package = "github.com/nspcc-dev/neofs-api/service"; +option go_package = "github.com/nspcc-dev/neofs-api-go/service"; option csharp_namespace = "NeoFS.API.Service"; import "github.com/gogo/protobuf/gogoproto/gogo.proto"; diff --git a/service/verify_test.go b/service/verify_test.go index fb6736b..27491da 100644 --- a/service/verify_test.go +++ b/service/verify_test.go @@ -7,7 +7,7 @@ import ( "testing" "github.com/gogo/protobuf/proto" - "github.com/nspcc-dev/neofs-api/refs" + "github.com/nspcc-dev/neofs-api-go/refs" crypto "github.com/nspcc-dev/neofs-crypto" "github.com/nspcc-dev/neofs-crypto/test" "github.com/pkg/errors" diff --git a/service/verify_test.pb.go b/service/verify_test.pb.go index d920097..6bc8748 100644 --- a/service/verify_test.pb.go +++ b/service/verify_test.pb.go @@ -92,28 +92,28 @@ func init() { func init() { proto.RegisterFile("service/verify_test.proto", fileDescriptor_1effa83201a30d75) } var fileDescriptor_1effa83201a30d75 = []byte{ - // 326 bytes of a gzipped FileDescriptorProto + // 328 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x90, 0xb1, 0x4e, 0xf3, 0x30, - 0x14, 0x85, 0xeb, 0xfe, 0xfd, 0x4b, 0x71, 0x90, 0x90, 0x0c, 0x43, 0xc9, 0x90, 0x46, 0x1d, 0x50, - 0x96, 0x26, 0x12, 0x08, 0x89, 0x81, 0x29, 0x20, 0x04, 0x03, 0x4b, 0x40, 0x0c, 0x2c, 0x28, 0x49, - 0x6f, 0x83, 0x25, 0x1a, 0x97, 0xf8, 0xa6, 0x52, 0xdf, 0x84, 0x99, 0xa7, 0xe9, 0xd8, 0x11, 0x31, - 0x54, 0x28, 0xbc, 0x08, 0x8a, 0x6d, 0x50, 0x80, 0xcd, 0xf7, 0x9c, 0xef, 0xd8, 0xbe, 0x87, 0xee, - 0x49, 0x28, 0xe6, 0x3c, 0x85, 0x60, 0x0e, 0x05, 0x9f, 0x2c, 0xee, 0x11, 0x24, 0xfa, 0xb3, 0x42, - 0xa0, 0x60, 0x1b, 0xc6, 0xb2, 0xd9, 0x17, 0x33, 0x05, 0x8c, 0xb5, 0x69, 0xef, 0xfe, 0xcc, 0x19, - 0x75, 0x94, 0x71, 0x7c, 0x28, 0x13, 0x3f, 0x15, 0xd3, 0x20, 0x13, 0x99, 0x08, 0x94, 0x9c, 0x94, - 0x13, 0x35, 0xa9, 0x41, 0x9d, 0x34, 0x3e, 0x7c, 0x69, 0x53, 0xeb, 0x06, 0x24, 0x46, 0xf0, 0x54, - 0x82, 0x44, 0x66, 0xd3, 0xde, 0x65, 0x8e, 0xe7, 0x1c, 0x1e, 0xc7, 0x7d, 0xe2, 0x12, 0xef, 0x7f, - 0xf4, 0x3d, 0x33, 0x97, 0x5a, 0xd7, 0x58, 0xf0, 0x3c, 0xd3, 0x76, 0xdb, 0x25, 0xde, 0x66, 0xd4, - 0x94, 0x98, 0x43, 0x69, 0xb8, 0x40, 0x90, 0x1a, 0xf8, 0xe7, 0x12, 0x6f, 0x2b, 0x6a, 0x28, 0xec, - 0x88, 0x5a, 0xa7, 0xa5, 0x44, 0x31, 0xd5, 0x40, 0xa7, 0x06, 0xc2, 0x9d, 0xb7, 0xf5, 0x60, 0xbb, - 0x5e, 0xba, 0x61, 0x45, 0x4d, 0x8e, 0x1d, 0xd3, 0xce, 0x15, 0x60, 0xdc, 0x4f, 0x5c, 0xe2, 0x59, - 0x07, 0xb6, 0x6f, 0x16, 0xf7, 0xcd, 0xa7, 0x6b, 0xef, 0x02, 0xe2, 0x31, 0x14, 0x61, 0x6f, 0xb9, - 0x1e, 0xb4, 0x56, 0xeb, 0x01, 0x89, 0x54, 0x82, 0x9d, 0xd1, 0xae, 0x76, 0xfa, 0xa9, 0xca, 0x0e, - 0x7f, 0x67, 0x6f, 0xeb, 0xee, 0x78, 0x1a, 0x23, 0x17, 0xf9, 0x9f, 0x3b, 0x4c, 0x36, 0x3c, 0x59, - 0x56, 0x0e, 0x59, 0x55, 0x0e, 0x79, 0xad, 0x1c, 0xf2, 0x5e, 0x39, 0xe4, 0xf9, 0xc3, 0x69, 0xdd, - 0xed, 0x37, 0x9a, 0xce, 0xe5, 0x2c, 0x4d, 0x47, 0x63, 0x98, 0x07, 0x39, 0x88, 0x89, 0x1c, 0xc5, - 0x33, 0x1e, 0x98, 0x97, 0x92, 0xae, 0x6a, 0xfa, 0xf0, 0x33, 0x00, 0x00, 0xff, 0xff, 0x04, 0x99, - 0x63, 0xf2, 0xe8, 0x01, 0x00, 0x00, + 0x14, 0x85, 0xeb, 0xfe, 0xfd, 0x4b, 0x71, 0x90, 0x90, 0x0c, 0x43, 0xc9, 0x90, 0x46, 0x9d, 0xc2, + 0x90, 0x44, 0x02, 0x21, 0xb1, 0x21, 0x05, 0x84, 0x60, 0x60, 0x09, 0x88, 0x81, 0x05, 0x25, 0xe9, + 0x6d, 0xb0, 0x44, 0xe3, 0x12, 0xdf, 0x54, 0xea, 0x9b, 0x30, 0xf3, 0x34, 0x1d, 0x3b, 0x22, 0x86, + 0x08, 0x85, 0x17, 0x41, 0x71, 0x0c, 0x0a, 0xb0, 0xf9, 0x9e, 0xf3, 0x1d, 0xdb, 0xf7, 0xd0, 0x3d, + 0x09, 0xf9, 0x82, 0x27, 0xe0, 0x2f, 0x20, 0xe7, 0xd3, 0xe5, 0x3d, 0x82, 0x44, 0x6f, 0x9e, 0x0b, + 0x14, 0x6c, 0x43, 0x5b, 0x26, 0xfb, 0x62, 0x66, 0x80, 0x51, 0x63, 0x9a, 0xbb, 0x3f, 0x73, 0x5a, + 0x75, 0x53, 0x8e, 0x0f, 0x45, 0xec, 0x25, 0x62, 0xe6, 0xa7, 0x22, 0x15, 0xbe, 0x92, 0xe3, 0x62, + 0xaa, 0x26, 0x35, 0xa8, 0x53, 0x83, 0x8f, 0x5f, 0xba, 0xd4, 0xb8, 0x01, 0x89, 0x21, 0x3c, 0x15, + 0x20, 0x91, 0x99, 0x74, 0x70, 0x99, 0xe1, 0x39, 0x87, 0xc7, 0xc9, 0x90, 0xd8, 0xc4, 0xf9, 0x1f, + 0x7e, 0xcf, 0xcc, 0xa6, 0xc6, 0x35, 0xe6, 0x3c, 0x4b, 0x1b, 0xbb, 0x6b, 0x13, 0x67, 0x33, 0x6c, + 0x4b, 0xcc, 0xa2, 0x34, 0x58, 0x22, 0xc8, 0x06, 0xf8, 0x67, 0x13, 0x67, 0x2b, 0x6c, 0x29, 0xec, + 0x88, 0x1a, 0xa7, 0x85, 0x44, 0x31, 0x6b, 0x80, 0x5e, 0x0d, 0x04, 0x3b, 0x6f, 0xe5, 0x68, 0xbb, + 0x5e, 0xba, 0x65, 0x85, 0x6d, 0x8e, 0x1d, 0xd3, 0xde, 0x15, 0x60, 0x34, 0x8c, 0x6d, 0xe2, 0x18, + 0x07, 0xa6, 0xa7, 0x17, 0xf7, 0xf4, 0xa7, 0x6b, 0xef, 0x02, 0xa2, 0x09, 0xe4, 0xc1, 0x60, 0x55, + 0x8e, 0x3a, 0xeb, 0x72, 0x44, 0x42, 0x95, 0x60, 0x67, 0xb4, 0xdf, 0x38, 0xc3, 0x44, 0x65, 0xc7, + 0xbf, 0xb3, 0xb7, 0x75, 0x77, 0x3c, 0x89, 0x90, 0x8b, 0xec, 0xcf, 0x1d, 0x3a, 0x1b, 0x9c, 0xac, + 0x2a, 0x8b, 0xac, 0x2b, 0x8b, 0xbc, 0x56, 0x16, 0x79, 0xaf, 0x2c, 0xf2, 0xfc, 0x61, 0x75, 0xee, + 0xf6, 0x5b, 0x4d, 0x67, 0x72, 0x9e, 0x24, 0xee, 0x04, 0x16, 0x7e, 0x06, 0x62, 0x2a, 0xdd, 0x68, + 0xce, 0xdd, 0x54, 0xf8, 0xfa, 0xb1, 0xb8, 0xaf, 0xca, 0x3e, 0xfc, 0x0c, 0x00, 0x00, 0xff, 0xff, + 0xcb, 0xae, 0x78, 0xc0, 0xeb, 0x01, 0x00, 0x00, } func (m *TestRequest) Marshal() (dAtA []byte, err error) { diff --git a/service/verify_test.proto b/service/verify_test.proto index ce81180..901d6fd 100644 --- a/service/verify_test.proto +++ b/service/verify_test.proto @@ -1,6 +1,6 @@ syntax = "proto3"; package service; -option go_package = "github.com/nspcc-dev/neofs-api/service"; +option go_package = "github.com/nspcc-dev/neofs-api-go/service"; import "service/meta.proto"; import "service/verify.proto"; diff --git a/session/service.go b/session/service.go index 39dfb11..182ff7d 100644 --- a/session/service.go +++ b/session/service.go @@ -4,7 +4,7 @@ import ( "context" "crypto/ecdsa" - "github.com/nspcc-dev/neofs-api/refs" + "github.com/nspcc-dev/neofs-api-go/refs" crypto "github.com/nspcc-dev/neofs-crypto" ) diff --git a/session/service.pb.go b/session/service.pb.go index f003216..abd1618 100644 --- a/session/service.pb.go +++ b/session/service.pb.go @@ -8,7 +8,7 @@ import ( fmt "fmt" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/golang/protobuf/proto" - service "github.com/nspcc-dev/neofs-api/service" + service "github.com/nspcc-dev/neofs-api-go/service" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" @@ -210,32 +210,32 @@ func init() { func init() { proto.RegisterFile("session/service.proto", fileDescriptor_b329bee0fd1148e0) } var fileDescriptor_b329bee0fd1148e0 = []byte{ - // 385 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x52, 0x3f, 0x6f, 0xe2, 0x30, - 0x14, 0xc7, 0x08, 0x05, 0xce, 0xa7, 0x43, 0x3a, 0xdf, 0xbf, 0x28, 0x43, 0x38, 0xa1, 0xd3, 0x89, - 0xe1, 0x48, 0x4e, 0x74, 0xe9, 0xd2, 0xa1, 0xb4, 0xaa, 0x60, 0xa0, 0x42, 0xa1, 0xed, 0xd0, 0x2d, - 0x09, 0x8f, 0xd4, 0x6a, 0xb1, 0xd3, 0xd8, 0x41, 0xe2, 0x9b, 0xf4, 0x33, 0xf4, 0x93, 0x30, 0x32, - 0x76, 0x42, 0x55, 0xba, 0xf5, 0x53, 0x54, 0x38, 0x0e, 0xa2, 0x45, 0x6c, 0x7e, 0xbf, 0x3f, 0xef, - 0xbd, 0x9f, 0x6d, 0xfc, 0x43, 0x80, 0x10, 0x94, 0x33, 0x57, 0x40, 0x32, 0xa3, 0x21, 0x38, 0x71, - 0xc2, 0x25, 0x27, 0x55, 0x0d, 0x5b, 0xdf, 0x0a, 0x5e, 0xce, 0x63, 0x10, 0x39, 0x6b, 0x11, 0x2d, - 0x76, 0xa7, 0x20, 0x7d, 0x8d, 0x7d, 0x2f, 0xb0, 0x19, 0x24, 0x74, 0x32, 0xd7, 0x68, 0x3b, 0xa2, - 0xf2, 0x26, 0x0d, 0x9c, 0x90, 0x4f, 0xdd, 0x88, 0x47, 0xdc, 0x55, 0x70, 0x90, 0x4e, 0x54, 0xa5, - 0x0a, 0x75, 0xca, 0xe5, 0xcd, 0x57, 0x84, 0xbf, 0x9c, 0x24, 0xe0, 0x4b, 0xf0, 0xe0, 0x3e, 0x05, - 0x21, 0xc9, 0x1f, 0x5c, 0xe9, 0x33, 0x2a, 0x4d, 0xf4, 0x1b, 0xb5, 0x3e, 0x77, 0xea, 0x8e, 0x5e, - 0xc7, 0xb9, 0xe0, 0xb7, 0xc0, 0x7a, 0x25, 0x4f, 0xb1, 0xa4, 0x85, 0x8d, 0x11, 0x8d, 0x18, 0x8c, - 0xcd, 0xf2, 0x1e, 0x9d, 0xe6, 0xc9, 0x21, 0xae, 0x0c, 0x40, 0xfa, 0x66, 0xa0, 0x74, 0x96, 0x53, - 0xc4, 0xd6, 0xf3, 0xd6, 0x5c, 0x0f, 0xfc, 0x31, 0x24, 0xdd, 0xda, 0x62, 0xd5, 0x28, 0x2d, 0x57, - 0x0d, 0xe4, 0x29, 0x07, 0x39, 0xc5, 0xc6, 0x95, 0x8a, 0x66, 0x86, 0xca, 0xdb, 0xfc, 0xe8, 0x55, - 0x2c, 0x0d, 0x7d, 0x49, 0x39, 0xdb, 0xe9, 0xa1, 0xbd, 0xdd, 0x4f, 0xb8, 0x3a, 0x00, 0x21, 0xfc, - 0x08, 0x9a, 0x02, 0xd7, 0x8b, 0xac, 0x22, 0xe6, 0x4c, 0x00, 0xf9, 0x87, 0x6b, 0x97, 0x4c, 0xe4, - 0x41, 0xf6, 0x05, 0xde, 0x28, 0xd6, 0xa1, 0x3d, 0x10, 0xe9, 0x9d, 0xdc, 0x1f, 0x3a, 0xe7, 0xb7, - 0x86, 0x76, 0x7a, 0xb8, 0x3a, 0xca, 0x55, 0xe4, 0x08, 0x1b, 0xf9, 0x7c, 0xf2, 0x73, 0xe3, 0x7c, - 0x77, 0xf9, 0xd6, 0xaf, 0x1d, 0x3c, 0x5f, 0xb4, 0x85, 0xfe, 0xa3, 0xee, 0x70, 0x91, 0xd9, 0x68, - 0x99, 0xd9, 0xe8, 0x29, 0xb3, 0xd1, 0x73, 0x66, 0xa3, 0x87, 0x17, 0xbb, 0x74, 0xfd, 0x77, 0xeb, - 0xc1, 0x99, 0x88, 0xc3, 0xb0, 0x3d, 0x86, 0x99, 0xcb, 0x80, 0x4f, 0x44, 0xdb, 0x8f, 0xa9, 0xab, - 0x1b, 0x3e, 0x96, 0xbf, 0x9e, 0x03, 0x3f, 0x1b, 0x39, 0xc7, 0xc3, 0xbe, 0xa3, 0x17, 0x0a, 0x0c, - 0xf5, 0x09, 0x0e, 0xde, 0x02, 0x00, 0x00, 0xff, 0xff, 0xd9, 0x56, 0x19, 0xd1, 0x94, 0x02, 0x00, - 0x00, + // 388 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x52, 0x4f, 0x6f, 0xda, 0x30, + 0x14, 0xc7, 0x08, 0x05, 0xe6, 0x69, 0x48, 0xf3, 0xfe, 0x45, 0x39, 0x84, 0x09, 0xed, 0xc0, 0xa4, + 0x25, 0x99, 0xd8, 0x65, 0x97, 0x1d, 0xc6, 0xa6, 0x0a, 0x0e, 0x54, 0x55, 0xd2, 0xf6, 0xd0, 0x5b, + 0x12, 0x1e, 0xa9, 0xd5, 0x62, 0xa7, 0xb1, 0x83, 0xc4, 0x37, 0xe9, 0x67, 0xe8, 0x27, 0xe1, 0xc8, + 0xb1, 0x27, 0x54, 0xa5, 0xb7, 0x7e, 0x8a, 0x0a, 0xc7, 0x41, 0xb4, 0x88, 0x9b, 0xdf, 0xef, 0xcf, + 0x7b, 0xef, 0x67, 0x1b, 0x7f, 0x12, 0x20, 0x04, 0xe5, 0xcc, 0x13, 0x90, 0xcd, 0x69, 0x0c, 0x6e, + 0x9a, 0x71, 0xc9, 0x49, 0x53, 0xc3, 0xd6, 0x87, 0x8a, 0x97, 0x8b, 0x14, 0x44, 0xc9, 0x5a, 0x44, + 0x8b, 0xbd, 0x19, 0xc8, 0x50, 0x63, 0x1f, 0x2b, 0x6c, 0x0e, 0x19, 0x9d, 0x2e, 0x34, 0xea, 0x24, + 0x54, 0x5e, 0xe6, 0x91, 0x1b, 0xf3, 0x99, 0x97, 0xf0, 0x84, 0x7b, 0x0a, 0x8e, 0xf2, 0xa9, 0xaa, + 0x54, 0xa1, 0x4e, 0xa5, 0xbc, 0xfb, 0x84, 0xf0, 0xbb, 0x7f, 0x19, 0x84, 0x12, 0x7c, 0xb8, 0xc9, + 0x41, 0x48, 0xf2, 0x0d, 0x37, 0x46, 0x8c, 0x4a, 0x13, 0x7d, 0x45, 0xbd, 0xb7, 0xfd, 0xb6, 0xab, + 0xd7, 0x71, 0x4f, 0xf9, 0x15, 0xb0, 0x61, 0xcd, 0x57, 0x2c, 0xe9, 0x61, 0x23, 0xa0, 0x09, 0x83, + 0x89, 0x59, 0x3f, 0xa0, 0xd3, 0x3c, 0xf9, 0x8d, 0x1b, 0x63, 0x90, 0xa1, 0x19, 0x29, 0x9d, 0xe5, + 0x56, 0xb1, 0xf5, 0xbc, 0x0d, 0x37, 0x84, 0x70, 0x02, 0xd9, 0xa0, 0xb5, 0x5c, 0x77, 0x6a, 0xab, + 0x75, 0x07, 0xf9, 0xca, 0x41, 0xfe, 0x63, 0xe3, 0x5c, 0x45, 0x33, 0x63, 0xe5, 0xed, 0xbe, 0xf6, + 0x2a, 0x96, 0xc6, 0xa1, 0xa4, 0x9c, 0xed, 0xf5, 0xd0, 0xde, 0xc1, 0x1b, 0xdc, 0x1c, 0x83, 0x10, + 0x61, 0x02, 0x5d, 0x81, 0xdb, 0x55, 0x56, 0x91, 0x72, 0x26, 0x80, 0xfc, 0xc0, 0xad, 0x33, 0x26, + 0xca, 0x20, 0x87, 0x02, 0x6f, 0x15, 0x9b, 0xd0, 0x3e, 0x88, 0xfc, 0x5a, 0x1e, 0x0e, 0x5d, 0xf2, + 0x3b, 0x43, 0xfb, 0x43, 0xdc, 0x0c, 0x4a, 0x15, 0xf9, 0x83, 0x8d, 0x72, 0x3e, 0xf9, 0xbc, 0x75, + 0xbe, 0xb8, 0x7c, 0xeb, 0xcb, 0x1e, 0x5e, 0x2e, 0xda, 0x43, 0x3f, 0xd1, 0x20, 0x58, 0x16, 0x36, + 0x5a, 0x15, 0x36, 0xba, 0x2f, 0x6c, 0xf4, 0x50, 0xd8, 0xe8, 0xf6, 0xd1, 0xae, 0x5d, 0x7c, 0xdf, + 0x79, 0x70, 0x26, 0xd2, 0x38, 0x76, 0x26, 0x30, 0xf7, 0x18, 0xf0, 0xa9, 0x70, 0xc2, 0x94, 0x3a, + 0x09, 0xf7, 0x74, 0xcf, 0xbb, 0xfa, 0xfb, 0x63, 0xe0, 0x47, 0x81, 0xfb, 0xf7, 0x64, 0xe4, 0xea, + 0x9d, 0x22, 0x43, 0xfd, 0x83, 0x5f, 0xcf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x18, 0x94, 0x4c, 0x61, + 0x97, 0x02, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/session/service.proto b/session/service.proto index 2c96a3e..524213a 100644 --- a/session/service.proto +++ b/session/service.proto @@ -1,6 +1,6 @@ syntax = "proto3"; package session; -option go_package = "github.com/nspcc-dev/neofs-api/session"; +option go_package = "github.com/nspcc-dev/neofs-api-go/session"; option csharp_namespace = "NeoFS.API.Session"; import "session/types.proto"; diff --git a/session/store.go b/session/store.go index b671a8c..f6a6655 100644 --- a/session/store.go +++ b/session/store.go @@ -6,7 +6,7 @@ import ( "crypto/rand" "sync" - "github.com/nspcc-dev/neofs-api/refs" + "github.com/nspcc-dev/neofs-api-go/refs" crypto "github.com/nspcc-dev/neofs-crypto" ) diff --git a/session/store_test.go b/session/store_test.go index 6ee17ad..9ad0e1d 100644 --- a/session/store_test.go +++ b/session/store_test.go @@ -5,7 +5,7 @@ import ( "crypto/rand" "testing" - "github.com/nspcc-dev/neofs-api/refs" + "github.com/nspcc-dev/neofs-api-go/refs" crypto "github.com/nspcc-dev/neofs-crypto" "github.com/stretchr/testify/require" ) diff --git a/session/types.go b/session/types.go index 120b8a8..4165291 100644 --- a/session/types.go +++ b/session/types.go @@ -5,9 +5,9 @@ import ( "encoding/binary" "sync" - "github.com/nspcc-dev/neofs-api/chain" - "github.com/nspcc-dev/neofs-api/internal" - "github.com/nspcc-dev/neofs-api/refs" + "github.com/nspcc-dev/neofs-api-go/chain" + "github.com/nspcc-dev/neofs-api-go/internal" + "github.com/nspcc-dev/neofs-api-go/refs" crypto "github.com/nspcc-dev/neofs-crypto" "github.com/pkg/errors" ) diff --git a/session/types.pb.go b/session/types.pb.go index 81e3a86..01458dd 100644 --- a/session/types.pb.go +++ b/session/types.pb.go @@ -171,31 +171,31 @@ func init() { func init() { proto.RegisterFile("session/types.proto", fileDescriptor_c0d9d9cb855cdad8) } var fileDescriptor_c0d9d9cb855cdad8 = []byte{ - // 373 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x91, 0xcd, 0x4e, 0xc2, 0x40, - 0x14, 0x85, 0x69, 0xf9, 0x75, 0x24, 0x51, 0xc7, 0x4d, 0xa3, 0xa6, 0x10, 0x16, 0x06, 0x13, 0x69, - 0x13, 0x5d, 0xb9, 0xb4, 0xa9, 0xc4, 0x06, 0x23, 0xa4, 0x18, 0x16, 0xee, 0xda, 0x72, 0x29, 0xe3, - 0x4f, 0xa7, 0xe9, 0xb4, 0x1a, 0xde, 0xc4, 0x67, 0xf0, 0x09, 0x7c, 0x04, 0x96, 0x2e, 0x8d, 0x0b, - 0x62, 0xea, 0x8b, 0x98, 0x4e, 0x4b, 0x81, 0xb8, 0xbb, 0xf3, 0x9d, 0x99, 0x7b, 0xee, 0x9c, 0x8b, - 0xf6, 0x19, 0x30, 0x46, 0xa8, 0xa7, 0x86, 0x33, 0x1f, 0x98, 0xe2, 0x07, 0x34, 0xa4, 0xb8, 0x9a, - 0xc1, 0x83, 0x8e, 0x4b, 0xc2, 0x69, 0x64, 0x2b, 0x0e, 0x7d, 0x56, 0x5d, 0xea, 0x52, 0x95, 0xeb, - 0x76, 0x34, 0xe1, 0x27, 0x7e, 0xe0, 0x55, 0xfa, 0xae, 0x35, 0x42, 0x78, 0x04, 0x01, 0x99, 0x10, - 0xc7, 0x0a, 0x09, 0xf5, 0xae, 0xc1, 0x1a, 0x43, 0x80, 0x8f, 0xd0, 0xd6, 0x20, 0xb2, 0x9f, 0x88, - 0xd3, 0x83, 0x99, 0x24, 0x34, 0x85, 0x76, 0xdd, 0x5c, 0x01, 0xdc, 0x42, 0xf5, 0x1e, 0xcc, 0x86, - 0xc4, 0xf5, 0xac, 0x30, 0x0a, 0x40, 0x12, 0xf9, 0x85, 0x0d, 0xd6, 0xfa, 0x10, 0x51, 0xf9, 0x8e, - 0x3e, 0x82, 0x87, 0x2f, 0x50, 0x25, 0xed, 0xca, 0x1b, 0x6d, 0x9f, 0x1d, 0x2a, 0xd9, 0xa8, 0xca, - 0x7f, 0x63, 0xad, 0x34, 0x5f, 0x34, 0x0a, 0x66, 0xf6, 0x00, 0x9f, 0xa0, 0x6a, 0xff, 0xd5, 0x83, - 0xc0, 0xd0, 0x53, 0x0f, 0x6d, 0x27, 0x91, 0xbf, 0x17, 0x8d, 0x25, 0x36, 0x97, 0x05, 0x96, 0x11, - 0xea, 0x92, 0x80, 0x85, 0x57, 0x3e, 0x75, 0xa6, 0x52, 0xb1, 0x29, 0xb4, 0x4b, 0xe6, 0x1a, 0x49, - 0x7e, 0x74, 0x63, 0x2d, 0xe5, 0x12, 0x97, 0x57, 0x00, 0x9f, 0xa2, 0x5a, 0xdf, 0x7e, 0x00, 0x27, - 0x34, 0x74, 0xa9, 0xdc, 0x2c, 0xb6, 0xeb, 0xda, 0x6e, 0xe6, 0x94, 0x73, 0x33, 0xaf, 0x92, 0x5e, - 0xab, 0xcf, 0x57, 0xd2, 0x74, 0x72, 0x80, 0x1b, 0x48, 0x34, 0x74, 0xa9, 0xba, 0x39, 0x2f, 0x8f, - 0xc2, 0xd0, 0x4d, 0x31, 0x1d, 0x35, 0xcf, 0x92, 0x49, 0xb5, 0xc4, 0xce, 0x5c, 0x23, 0xda, 0x60, - 0x1e, 0xcb, 0xc2, 0x67, 0x2c, 0x0b, 0x5f, 0xb1, 0x2c, 0xfc, 0xc4, 0xb2, 0xf0, 0xf6, 0x2b, 0x17, - 0xee, 0x8f, 0xd7, 0xf6, 0xea, 0x31, 0xdf, 0x71, 0x3a, 0x63, 0x78, 0x51, 0x3d, 0xa0, 0x13, 0xd6, - 0xb1, 0x7c, 0xa2, 0x66, 0xa1, 0xbe, 0x8b, 0x7b, 0xb7, 0x40, 0xbb, 0x43, 0xe5, 0x72, 0x60, 0x28, - 0xc3, 0x94, 0xd9, 0x15, 0xbe, 0xeb, 0xf3, 0xbf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x20, 0x10, 0x09, - 0xd3, 0x3a, 0x02, 0x00, 0x00, + // 374 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x91, 0xcd, 0x4e, 0x83, 0x40, + 0x14, 0x85, 0x0b, 0xfd, 0x75, 0x6c, 0xa2, 0x8e, 0x1b, 0xa2, 0x86, 0x36, 0x5d, 0xb5, 0x89, 0x40, + 0xa2, 0x2b, 0x97, 0x12, 0x6c, 0x24, 0x35, 0xb6, 0x01, 0xd3, 0x85, 0x3b, 0xa0, 0x53, 0x3a, 0xfe, + 0x30, 0x84, 0x19, 0x34, 0x7d, 0x13, 0x9f, 0xc1, 0x27, 0xf0, 0x11, 0xba, 0x74, 0x69, 0x5c, 0x34, + 0x06, 0x5f, 0xc4, 0x30, 0x50, 0xda, 0xc6, 0xdd, 0x9d, 0xef, 0xcc, 0xdc, 0x73, 0xe7, 0x5c, 0x70, + 0x48, 0x11, 0xa5, 0x98, 0x04, 0x1a, 0x9b, 0x87, 0x88, 0xaa, 0x61, 0x44, 0x18, 0x81, 0xf5, 0x1c, + 0x1e, 0x29, 0x3e, 0x66, 0xb3, 0xd8, 0x55, 0x3d, 0xf2, 0xac, 0xf9, 0xc4, 0x27, 0x1a, 0xd7, 0xdd, + 0x78, 0xca, 0x4f, 0xfc, 0xc0, 0xab, 0xec, 0x5d, 0x67, 0x0c, 0xe0, 0x18, 0x45, 0x78, 0x8a, 0x3d, + 0x87, 0x61, 0x12, 0x5c, 0x23, 0x67, 0x82, 0x22, 0x78, 0x02, 0x76, 0x46, 0xb1, 0xfb, 0x84, 0xbd, + 0x01, 0x9a, 0x4b, 0x42, 0x5b, 0xe8, 0x36, 0xad, 0x35, 0x80, 0x1d, 0xd0, 0x1c, 0xa0, 0xb9, 0x8d, + 0xfd, 0xc0, 0x61, 0x71, 0x84, 0x24, 0x91, 0x5f, 0xd8, 0x62, 0x9d, 0x0f, 0x11, 0x54, 0xef, 0xc8, + 0x23, 0x0a, 0xe0, 0x05, 0xa8, 0x65, 0x5d, 0x79, 0xa3, 0xdd, 0xb3, 0x63, 0x35, 0x1f, 0x55, 0xfd, + 0x6f, 0xac, 0x57, 0x16, 0xcb, 0x56, 0xc9, 0xca, 0x1f, 0xc0, 0x1e, 0xa8, 0x0f, 0x5f, 0x03, 0x14, + 0x99, 0x46, 0xe6, 0xa1, 0xef, 0xa5, 0xf2, 0xf7, 0xb2, 0xb5, 0xc2, 0xd6, 0xaa, 0x80, 0x32, 0x00, + 0x7d, 0x1c, 0x51, 0x76, 0x15, 0x12, 0x6f, 0x26, 0x95, 0xdb, 0x42, 0xb7, 0x62, 0x6d, 0x90, 0xf4, + 0x47, 0x37, 0xce, 0x4a, 0xae, 0x70, 0x79, 0x0d, 0xe0, 0x29, 0x68, 0x0c, 0xdd, 0x07, 0xe4, 0x31, + 0xd3, 0x90, 0xaa, 0xed, 0x72, 0xb7, 0xa9, 0xef, 0xe7, 0x4e, 0x05, 0xb7, 0x8a, 0x2a, 0xed, 0xb5, + 0xfe, 0x7c, 0x2d, 0x4b, 0xa7, 0x00, 0xb0, 0x05, 0x44, 0xd3, 0x90, 0xea, 0xdb, 0xf3, 0xf2, 0x28, + 0x4c, 0xc3, 0x12, 0xb3, 0x51, 0x8b, 0x2c, 0xa9, 0xd4, 0x48, 0xed, 0xac, 0x0d, 0xa2, 0xdb, 0x8b, + 0x44, 0x16, 0x3e, 0x13, 0x59, 0xf8, 0x4a, 0x64, 0xe1, 0x27, 0x91, 0x85, 0xb7, 0x5f, 0xb9, 0x74, + 0xdf, 0xdb, 0xd8, 0x6b, 0x40, 0x43, 0xcf, 0x53, 0x26, 0xe8, 0x45, 0x0b, 0x10, 0x99, 0x52, 0xc5, + 0x09, 0xb1, 0xe2, 0x13, 0x2d, 0xcf, 0xf5, 0x5d, 0x3c, 0xb8, 0x45, 0xa4, 0x6f, 0xab, 0x97, 0x23, + 0x53, 0xb5, 0x33, 0xe6, 0xd6, 0xf8, 0xba, 0xcf, 0xff, 0x02, 0x00, 0x00, 0xff, 0xff, 0xa2, 0x24, + 0xcd, 0x60, 0x3d, 0x02, 0x00, 0x00, } func (m *VerificationHeader) Marshal() (dAtA []byte, err error) { diff --git a/session/types.proto b/session/types.proto index 0cf1583..3ae49a3 100644 --- a/session/types.proto +++ b/session/types.proto @@ -1,6 +1,6 @@ syntax = "proto3"; package session; -option go_package = "github.com/nspcc-dev/neofs-api/session"; +option go_package = "github.com/nspcc-dev/neofs-api-go/session"; option csharp_namespace = "NeoFS.API.Session"; import "github.com/gogo/protobuf/gogoproto/gogo.proto"; diff --git a/state/service.pb.go b/state/service.pb.go index b55f3c1..4c7db88 100644 --- a/state/service.pb.go +++ b/state/service.pb.go @@ -8,8 +8,8 @@ import ( fmt "fmt" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/golang/protobuf/proto" - bootstrap "github.com/nspcc-dev/neofs-api/bootstrap" - service "github.com/nspcc-dev/neofs-api/service" + bootstrap "github.com/nspcc-dev/neofs-api-go/bootstrap" + service "github.com/nspcc-dev/neofs-api-go/service" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" @@ -434,40 +434,41 @@ func init() { func init() { proto.RegisterFile("state/service.proto", fileDescriptor_695592f6f2fc97b7) } var fileDescriptor_695592f6f2fc97b7 = []byte{ - // 527 bytes of a gzipped FileDescriptorProto + // 529 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x94, 0xcf, 0x6e, 0xd3, 0x40, - 0x10, 0xc6, 0xbb, 0x01, 0x42, 0x3a, 0x09, 0x0d, 0xda, 0x26, 0xc1, 0xb2, 0x90, 0x1b, 0x59, 0x08, - 0x45, 0x42, 0xb1, 0x51, 0x01, 0xa9, 0x82, 0x13, 0x69, 0x85, 0x8a, 0x44, 0x2a, 0xe4, 0x48, 0x39, - 0x70, 0x5b, 0x3b, 0x93, 0xc4, 0xa2, 0xf1, 0x1a, 0xef, 0x3a, 0x52, 0x1e, 0x02, 0x01, 0x37, 0x1e, - 0x01, 0xf1, 0x24, 0x3d, 0xf6, 0xc8, 0xa9, 0x42, 0xe1, 0x45, 0x50, 0xd6, 0xeb, 0xfc, 0xeb, 0x0b, - 0xe4, 0x96, 0xf9, 0xcd, 0x7c, 0xce, 0x37, 0xbb, 0xb3, 0x03, 0x87, 0x42, 0x32, 0x89, 0xae, 0xc0, - 0x64, 0x1a, 0x06, 0xe8, 0xc4, 0x09, 0x97, 0x9c, 0xde, 0x53, 0xd0, 0xa4, 0x9a, 0xba, 0x13, 0x94, - 0x2c, 0x4b, 0x99, 0xb5, 0x9c, 0x4d, 0x31, 0x09, 0x87, 0x33, 0x4d, 0xeb, 0x3e, 0xe7, 0x52, 0xc8, - 0x84, 0xc5, 0xae, 0x9c, 0xc5, 0x28, 0x34, 0x6e, 0x8f, 0x42, 0x39, 0x4e, 0x7d, 0x27, 0xe0, 0x13, - 0x77, 0xc4, 0x47, 0xdc, 0x55, 0xd8, 0x4f, 0x87, 0x2a, 0x52, 0x81, 0xfa, 0x95, 0x95, 0xdb, 0xdf, - 0x08, 0x3c, 0xb8, 0x40, 0x39, 0x61, 0xb1, 0x87, 0x5f, 0x52, 0x14, 0x92, 0x9e, 0xc0, 0xdd, 0x2e, - 0x4a, 0x66, 0xf8, 0x4d, 0xd2, 0x2a, 0x1f, 0x9b, 0x4e, 0x6e, 0x53, 0xe7, 0x17, 0xb9, 0x73, 0x64, - 0x03, 0x4c, 0x3a, 0xa5, 0xab, 0x9b, 0xa3, 0xbd, 0xeb, 0x9b, 0x23, 0xe2, 0x29, 0x05, 0x3d, 0x83, - 0x62, 0x5f, 0x39, 0x34, 0x02, 0xa5, 0xb5, 0xb7, 0xb5, 0x2a, 0x1b, 0x06, 0x4c, 0x86, 0x3c, 0xba, - 0xf5, 0x0d, 0xad, 0xb5, 0xbf, 0x13, 0x38, 0xe8, 0xa2, 0x4c, 0xc2, 0x40, 0xec, 0x8a, 0xa5, 0x67, - 0x50, 0x5d, 0x3a, 0x12, 0x31, 0x8f, 0x04, 0x52, 0x03, 0xee, 0x6b, 0x64, 0x90, 0xe6, 0x9d, 0x56, - 0xc5, 0xcb, 0x43, 0x75, 0xa2, 0xe7, 0xc8, 0x2e, 0xe5, 0x78, 0x57, 0xec, 0x77, 0xe0, 0x20, 0x37, - 0xb4, 0x72, 0x9f, 0x91, 0x99, 0x41, 0x9a, 0xa4, 0x55, 0xf2, 0xf2, 0x90, 0x36, 0xa0, 0xd8, 0x93, - 0x4c, 0xa6, 0xc2, 0x28, 0x34, 0x49, 0x6b, 0xdf, 0xd3, 0x91, 0xfd, 0x95, 0x40, 0xf9, 0x2c, 0x9d, - 0xec, 0xcc, 0x94, 0x3c, 0x85, 0x4a, 0x66, 0x47, 0x77, 0xd4, 0x80, 0xe2, 0x29, 0x8f, 0x86, 0xe1, - 0x48, 0x35, 0x54, 0xf1, 0x74, 0x64, 0xff, 0x20, 0x50, 0x5d, 0x14, 0xf6, 0x59, 0xb2, 0x33, 0xe3, - 0xf4, 0x1c, 0x1e, 0xae, 0x2c, 0x69, 0xff, 0x8f, 0x61, 0xbf, 0xcf, 0x92, 0x90, 0xf9, 0x97, 0x28, - 0x74, 0x0b, 0x2b, 0x70, 0xfc, 0xab, 0x90, 0x5f, 0x0b, 0x7d, 0x09, 0xc5, 0xec, 0xbd, 0xd2, 0x9a, - 0xa3, 0x56, 0x86, 0xb3, 0xf1, 0x7c, 0xcd, 0x9a, 0xb3, 0xdc, 0x0b, 0x4e, 0x2f, 0x4e, 0x90, 0x0d, - 0xba, 0x2c, 0xa6, 0x27, 0xcb, 0x71, 0xa5, 0x75, 0x2d, 0xdb, 0x7c, 0x63, 0x66, 0x63, 0x1b, 0x6b, - 0x63, 0xaf, 0xa1, 0x9c, 0xcd, 0xc6, 0xe9, 0x18, 0x83, 0xcf, 0xcb, 0x3f, 0xdd, 0x98, 0x70, 0xb3, - 0xbe, 0x45, 0xb5, 0xf6, 0x15, 0xc0, 0xa2, 0xd1, 0xec, 0x2a, 0x28, 0xd5, 0x45, 0x6b, 0x63, 0x64, - 0x1e, 0x6e, 0x30, 0x2d, 0x7b, 0x03, 0xa5, 0xfc, 0x7c, 0x68, 0x63, 0xad, 0x60, 0xed, 0x0e, 0xcd, - 0x47, 0xb7, 0x78, 0x26, 0xee, 0x7c, 0xb8, 0x9a, 0x5b, 0xe4, 0x7a, 0x6e, 0x91, 0x3f, 0x73, 0x8b, - 0xfc, 0x9d, 0x5b, 0xe4, 0xe7, 0x3f, 0x6b, 0xef, 0xd3, 0x93, 0xb5, 0xad, 0x18, 0x89, 0x38, 0x08, - 0xda, 0x03, 0x9c, 0xba, 0x11, 0xf2, 0xa1, 0x68, 0xb3, 0x38, 0x74, 0xd5, 0xc7, 0x7e, 0x17, 0xaa, - 0x17, 0xc8, 0xdf, 0xf5, 0x9c, 0xb7, 0x1f, 0xdf, 0x3b, 0x8b, 0xe3, 0x46, 0xbf, 0xa8, 0xb6, 0xe4, - 0x8b, 0xff, 0x01, 0x00, 0x00, 0xff, 0xff, 0xfc, 0x52, 0x8c, 0x82, 0xb3, 0x05, 0x00, 0x00, + 0x10, 0xc6, 0xbb, 0x01, 0x42, 0x3a, 0x09, 0x0d, 0xda, 0x26, 0xc1, 0xb2, 0x50, 0x1a, 0xf9, 0x00, + 0x91, 0x50, 0x6c, 0x54, 0x40, 0xaa, 0xe0, 0x44, 0x5a, 0xa1, 0x72, 0x48, 0x41, 0x8e, 0x94, 0x03, + 0xb7, 0xb5, 0x33, 0x71, 0x2c, 0x1a, 0xaf, 0xf1, 0xae, 0x23, 0xe5, 0x21, 0x10, 0x70, 0xe3, 0x11, + 0x10, 0x4f, 0xd2, 0x63, 0x8f, 0x9c, 0x2a, 0x14, 0x5e, 0x04, 0x65, 0xbd, 0xce, 0xbf, 0xbe, 0x40, + 0x6e, 0x99, 0xdf, 0xcc, 0xe7, 0x7c, 0xb3, 0x3b, 0x3b, 0x70, 0x28, 0x24, 0x93, 0xe8, 0x08, 0x4c, + 0xa6, 0xa1, 0x8f, 0x76, 0x9c, 0x70, 0xc9, 0xe9, 0x3d, 0x05, 0x4d, 0xaa, 0xa9, 0x33, 0x41, 0xc9, + 0xb2, 0x94, 0x59, 0xcb, 0xd9, 0x14, 0x93, 0x70, 0x34, 0xd3, 0xb4, 0xee, 0x71, 0x2e, 0x85, 0x4c, + 0x58, 0xec, 0xc8, 0x59, 0x8c, 0x42, 0xe3, 0x4e, 0x10, 0xca, 0x71, 0xea, 0xd9, 0x3e, 0x9f, 0x38, + 0x01, 0x0f, 0xb8, 0xa3, 0xb0, 0x97, 0x8e, 0x54, 0xa4, 0x02, 0xf5, 0x2b, 0x2b, 0xb7, 0xbe, 0x11, + 0x78, 0x70, 0x81, 0x72, 0xc2, 0x62, 0x17, 0xbf, 0xa4, 0x28, 0x24, 0x3d, 0x81, 0xbb, 0x3d, 0x94, + 0xcc, 0xf0, 0x5a, 0xa4, 0x5d, 0x3e, 0x36, 0xed, 0xdc, 0xa6, 0xce, 0x2f, 0x72, 0xe7, 0xc8, 0x86, + 0x98, 0x74, 0x4b, 0x57, 0x37, 0x47, 0x7b, 0xd7, 0x37, 0x47, 0xc4, 0x55, 0x0a, 0x7a, 0x06, 0xc5, + 0x81, 0x72, 0x68, 0xf8, 0x4a, 0x6b, 0x6d, 0x6b, 0x55, 0x36, 0xf4, 0x99, 0x0c, 0x79, 0x74, 0xeb, + 0x1b, 0x5a, 0x6b, 0x7d, 0x27, 0x70, 0xd0, 0x43, 0x99, 0x84, 0xbe, 0xd8, 0x15, 0x4b, 0xcf, 0xa0, + 0xba, 0x74, 0x24, 0x62, 0x1e, 0x09, 0xa4, 0x06, 0xdc, 0xd7, 0xc8, 0x20, 0xad, 0x3b, 0xed, 0x8a, + 0x9b, 0x87, 0xea, 0x44, 0xcf, 0x91, 0x5d, 0xca, 0xf1, 0xae, 0xd8, 0xef, 0xc2, 0x41, 0x6e, 0x68, + 0xe5, 0x3e, 0x23, 0x33, 0x83, 0xb4, 0x48, 0xbb, 0xe4, 0xe6, 0x21, 0x6d, 0x40, 0xb1, 0x2f, 0x99, + 0x4c, 0x85, 0x51, 0x68, 0x91, 0xf6, 0xbe, 0xab, 0x23, 0xeb, 0x2b, 0x81, 0xf2, 0x59, 0x3a, 0xd9, + 0x99, 0x29, 0x79, 0x02, 0x95, 0xcc, 0x8e, 0xee, 0xa8, 0x01, 0xc5, 0x53, 0x1e, 0x8d, 0xc2, 0x40, + 0x35, 0x54, 0x71, 0x75, 0x64, 0xfd, 0x20, 0x50, 0x5d, 0x14, 0x0e, 0x58, 0xb2, 0x33, 0xe3, 0xf4, + 0x1c, 0x1e, 0xae, 0x2c, 0x69, 0xff, 0x8f, 0x61, 0x7f, 0xc0, 0x92, 0x90, 0x79, 0x97, 0x28, 0x74, + 0x0b, 0x2b, 0x70, 0xfc, 0xab, 0x90, 0x5f, 0x0b, 0x7d, 0x09, 0xc5, 0xec, 0xbd, 0xd2, 0x9a, 0xad, + 0x56, 0x86, 0xbd, 0xf1, 0x7c, 0xcd, 0x9a, 0xbd, 0xdc, 0x0b, 0x76, 0x3f, 0x4e, 0x90, 0x0d, 0x7b, + 0x2c, 0xa6, 0x27, 0xcb, 0x71, 0xa5, 0x75, 0x2d, 0xdb, 0x7c, 0x63, 0x66, 0x63, 0x1b, 0x6b, 0x63, + 0xaf, 0xa1, 0x9c, 0xcd, 0xc6, 0xe9, 0x18, 0xfd, 0xcf, 0xcb, 0x3f, 0xdd, 0x98, 0x70, 0xb3, 0xbe, + 0x45, 0xb5, 0xf6, 0x15, 0xc0, 0xa2, 0xd1, 0xec, 0x2a, 0x28, 0xd5, 0x45, 0x6b, 0x63, 0x64, 0x1e, + 0x6e, 0x30, 0x2d, 0x7b, 0x03, 0xa5, 0xfc, 0x7c, 0x68, 0x63, 0xad, 0x60, 0xed, 0x0e, 0xcd, 0x47, + 0xb7, 0x78, 0x26, 0xee, 0x7e, 0xb8, 0x9a, 0x37, 0xc9, 0xf5, 0xbc, 0x49, 0xfe, 0xcc, 0x9b, 0xe4, + 0xef, 0xbc, 0x49, 0x7e, 0xfe, 0x6b, 0xee, 0x7d, 0x7a, 0xba, 0xb6, 0x15, 0x23, 0x11, 0xfb, 0x7e, + 0x67, 0x88, 0x53, 0x27, 0x42, 0x3e, 0x12, 0x1d, 0x16, 0x87, 0x9d, 0x80, 0x3b, 0xea, 0x7b, 0xbf, + 0x0b, 0xd5, 0x0b, 0xe4, 0xef, 0xfa, 0xf6, 0xdb, 0x8f, 0xef, 0xed, 0xc5, 0x89, 0xa3, 0x57, 0x54, + 0x8b, 0xf2, 0xc5, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, 0x60, 0x43, 0xc8, 0xac, 0xb6, 0x05, 0x00, + 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/state/service.proto b/state/service.proto index dc5efe4..bebc913 100644 --- a/state/service.proto +++ b/state/service.proto @@ -1,6 +1,6 @@ syntax = "proto3"; package state; -option go_package = "github.com/nspcc-dev/neofs-api/state"; +option go_package = "github.com/nspcc-dev/neofs-api-go/state"; option csharp_namespace = "NeoFS.API.State"; import "service/meta.proto"; diff --git a/storagegroup/storage.go b/storagegroup/storage.go index d41af49..7438b2b 100644 --- a/storagegroup/storage.go +++ b/storagegroup/storage.go @@ -3,7 +3,7 @@ package storagegroup import ( "context" - "github.com/nspcc-dev/neofs-api/refs" + "github.com/nspcc-dev/neofs-api-go/refs" ) type ( diff --git a/storagegroup/types.go b/storagegroup/types.go index 52c1410..d16382b 100644 --- a/storagegroup/types.go +++ b/storagegroup/types.go @@ -7,8 +7,8 @@ import ( "github.com/gogo/protobuf/proto" "github.com/mr-tron/base58" - "github.com/nspcc-dev/neofs-api/hash" - "github.com/nspcc-dev/neofs-api/refs" + "github.com/nspcc-dev/neofs-api-go/hash" + "github.com/nspcc-dev/neofs-api-go/refs" ) type ( diff --git a/storagegroup/types.pb.go b/storagegroup/types.pb.go index 46f736d..fa4b248 100644 --- a/storagegroup/types.pb.go +++ b/storagegroup/types.pb.go @@ -170,31 +170,31 @@ func init() { func init() { proto.RegisterFile("storagegroup/types.proto", fileDescriptor_cfa54edc899249a8) } var fileDescriptor_cfa54edc899249a8 = []byte{ - // 374 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x51, 0x41, 0x4b, 0xe3, 0x40, - 0x18, 0xcd, 0xa4, 0xd9, 0x25, 0x3b, 0x9b, 0x2d, 0x65, 0x58, 0x96, 0xd0, 0x43, 0x52, 0xba, 0x97, - 0xc0, 0xd2, 0x09, 0xb4, 0x7b, 0xda, 0xdb, 0x86, 0xdd, 0xaa, 0xa0, 0x22, 0xa9, 0xed, 0xa1, 0xb7, - 0x69, 0x3a, 0x4d, 0x07, 0x92, 0x4c, 0x68, 0x26, 0xa2, 0xfe, 0x92, 0x5e, 0x04, 0xcf, 0xfe, 0x92, - 0x1e, 0x3d, 0x8a, 0x87, 0x20, 0xf1, 0xe4, 0xbf, 0x90, 0x4e, 0xb5, 0x46, 0xf1, 0xe0, 0x6d, 0xde, - 0xfb, 0xde, 0xfb, 0xe6, 0x3d, 0x3e, 0x68, 0x66, 0x82, 0x2f, 0x48, 0x48, 0xc3, 0x05, 0xcf, 0x53, - 0x57, 0x9c, 0xa5, 0x34, 0xc3, 0xe9, 0x82, 0x0b, 0x8e, 0x8c, 0xea, 0xa4, 0xd9, 0x09, 0x99, 0x98, - 0xe7, 0x13, 0x1c, 0xf0, 0xd8, 0x0d, 0x79, 0xc8, 0x5d, 0x29, 0x9a, 0xe4, 0x33, 0x89, 0x24, 0x90, - 0xaf, 0x8d, 0xb9, 0xfd, 0xa0, 0x42, 0x63, 0xb0, 0xf1, 0xef, 0xac, 0xfd, 0x08, 0x43, 0x34, 0x22, - 0x11, 0x9b, 0x12, 0xc1, 0x78, 0xf2, 0x8f, 0x08, 0x32, 0x60, 0xe7, 0xd4, 0x04, 0x2d, 0xe0, 0x68, - 0xfe, 0x3b, 0x13, 0xf4, 0x1b, 0xd6, 0x5f, 0xd8, 0x5d, 0x92, 0xcd, 0x4d, 0xb5, 0x05, 0x1c, 0xc3, - 0x33, 0x56, 0x85, 0xad, 0xdc, 0x16, 0xb6, 0xb6, 0xe6, 0xfc, 0x37, 0x1a, 0x74, 0x00, 0xf5, 0x88, - 0xcd, 0xa8, 0x60, 0x31, 0x35, 0x6b, 0x2d, 0xe0, 0x7c, 0xed, 0xfe, 0xc4, 0xd5, 0x1a, 0xb8, 0x9a, - 0x09, 0xef, 0x3f, 0x49, 0x3d, 0xa3, 0x2c, 0x6c, 0xfd, 0x19, 0xf9, 0xdb, 0x15, 0xcd, 0x0b, 0x00, - 0xb7, 0x34, 0xea, 0x43, 0x2d, 0x4f, 0x98, 0x90, 0x99, 0xeb, 0x5d, 0xe7, 0x03, 0x7b, 0xf1, 0x30, - 0x61, 0xc2, 0xd3, 0xcb, 0xc2, 0xd6, 0xd6, 0x2f, 0x5f, 0xfa, 0xd1, 0x77, 0xf8, 0x69, 0x44, 0xa2, - 0x9c, 0xca, 0x42, 0x35, 0x7f, 0x03, 0xda, 0x3d, 0x28, 0x35, 0xe8, 0x1b, 0xfc, 0x32, 0x4c, 0x22, - 0x16, 0x33, 0x41, 0xa7, 0x0d, 0x05, 0xd5, 0x21, 0x3c, 0xa4, 0xbc, 0x3f, 0xf8, 0x9f, 0xf2, 0x60, - 0xde, 0x00, 0xc8, 0x80, 0xfa, 0x30, 0x61, 0xa7, 0xc7, 0x2c, 0xa6, 0x0d, 0xf5, 0x8f, 0xb6, 0xbc, - 0xb4, 0x15, 0x6f, 0xbc, 0x2a, 0x2d, 0x70, 0x5d, 0x5a, 0xe0, 0xa6, 0xb4, 0xc0, 0x5d, 0x69, 0x81, - 0xe5, 0xbd, 0xa5, 0x8c, 0x7f, 0x55, 0x0e, 0x96, 0x64, 0x69, 0x10, 0x74, 0xa6, 0xf4, 0xc4, 0x4d, - 0x28, 0x9f, 0x65, 0x1d, 0x92, 0x32, 0xb7, 0x1a, 0xff, 0x4a, 0xfd, 0x21, 0x7f, 0xc1, 0x7f, 0x8f, - 0xf6, 0x5e, 0x55, 0x99, 0x7c, 0x96, 0xe7, 0xec, 0x3d, 0x06, 0x00, 0x00, 0xff, 0xff, 0x79, 0x0c, - 0x52, 0x44, 0x27, 0x02, 0x00, 0x00, + // 377 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x51, 0x31, 0x6b, 0xdb, 0x40, + 0x14, 0xd6, 0xc9, 0x6a, 0x51, 0xaf, 0xaa, 0x31, 0x47, 0x29, 0xc2, 0x83, 0x64, 0xdc, 0x45, 0x8b, + 0x4e, 0x60, 0x77, 0xea, 0x56, 0xd1, 0xba, 0x2d, 0x24, 0x21, 0xc8, 0xb1, 0x87, 0x40, 0x86, 0xb3, + 0x7c, 0x96, 0x0f, 0x24, 0x9d, 0xb0, 0x4e, 0x21, 0xc9, 0x2f, 0xf1, 0x12, 0xc8, 0x9c, 0x5f, 0xe2, + 0x31, 0x63, 0xc8, 0x20, 0x82, 0x32, 0xe5, 0x5f, 0x04, 0x9f, 0x13, 0x47, 0x09, 0x19, 0xb2, 0xbd, + 0xef, 0x7b, 0xdf, 0xf7, 0xde, 0xfb, 0x78, 0xd0, 0xcc, 0x05, 0x5f, 0x90, 0x88, 0x46, 0x0b, 0x5e, + 0x64, 0x9e, 0x38, 0xcd, 0x68, 0x8e, 0xb3, 0x05, 0x17, 0x1c, 0x19, 0xf5, 0x4e, 0xdb, 0x8d, 0x98, + 0x98, 0x17, 0x13, 0x1c, 0xf2, 0xc4, 0x8b, 0x78, 0xc4, 0x3d, 0x29, 0x9a, 0x14, 0x33, 0x89, 0x24, + 0x90, 0xd5, 0xc6, 0xdc, 0xbd, 0x57, 0xa1, 0x31, 0xdc, 0xf8, 0xff, 0xae, 0xfd, 0x08, 0x43, 0x34, + 0x26, 0x31, 0x9b, 0x12, 0xc1, 0x78, 0xfa, 0x9b, 0x08, 0x32, 0x64, 0x67, 0xd4, 0x04, 0x1d, 0xe0, + 0x68, 0xc1, 0x1b, 0x1d, 0xf4, 0x03, 0x36, 0x9f, 0xd9, 0x7f, 0x24, 0x9f, 0x9b, 0x6a, 0x07, 0x38, + 0x86, 0x6f, 0xac, 0x4a, 0x5b, 0xb9, 0x29, 0x6d, 0x6d, 0xcd, 0x05, 0xaf, 0x34, 0x68, 0x17, 0xea, + 0x31, 0x9b, 0x51, 0xc1, 0x12, 0x6a, 0x36, 0x3a, 0xc0, 0xf9, 0xdc, 0xfb, 0x8e, 0xeb, 0x31, 0x70, + 0xfd, 0x26, 0xbc, 0xf3, 0x28, 0xf5, 0x8d, 0xaa, 0xb4, 0xf5, 0x27, 0x14, 0x6c, 0x47, 0xb4, 0xcf, + 0x01, 0xdc, 0xd2, 0x68, 0x00, 0xb5, 0x22, 0x65, 0x42, 0xde, 0xdc, 0xec, 0x39, 0xef, 0x98, 0x8b, + 0x47, 0x29, 0x13, 0xbe, 0x5e, 0x95, 0xb6, 0xb6, 0xae, 0x02, 0xe9, 0x47, 0x5f, 0xe1, 0x87, 0x31, + 0x89, 0x0b, 0x2a, 0x03, 0x35, 0x82, 0x0d, 0xe8, 0xf6, 0xa1, 0xd4, 0xa0, 0x2f, 0xf0, 0xd3, 0x28, + 0x8d, 0x59, 0xc2, 0x04, 0x9d, 0xb6, 0x14, 0xd4, 0x84, 0x70, 0x8f, 0xf2, 0xc1, 0xf0, 0x4f, 0xc6, + 0xc3, 0x79, 0x0b, 0x20, 0x03, 0xea, 0xa3, 0x94, 0x9d, 0x1c, 0xb0, 0x84, 0xb6, 0xd4, 0x9f, 0xda, + 0xf2, 0xc2, 0x56, 0xfc, 0xa3, 0x55, 0x65, 0x81, 0xab, 0xca, 0x02, 0xd7, 0x95, 0x05, 0x6e, 0x2b, + 0x0b, 0x2c, 0xef, 0x2c, 0xe5, 0x10, 0xd7, 0x1e, 0x96, 0xe6, 0x59, 0x18, 0xba, 0x53, 0x7a, 0xec, + 0xa5, 0x94, 0xcf, 0x72, 0x97, 0x64, 0xcc, 0x8d, 0xb8, 0x57, 0x4f, 0x70, 0xa9, 0x7e, 0x93, 0x8b, + 0xf0, 0xaf, 0xfd, 0xff, 0x2f, 0xd2, 0x4c, 0x3e, 0xca, 0x8f, 0xf6, 0x1f, 0x02, 0x00, 0x00, 0xff, + 0xff, 0xf8, 0x32, 0x27, 0x9d, 0x2a, 0x02, 0x00, 0x00, } func (m *StorageGroup) Marshal() (dAtA []byte, err error) { diff --git a/storagegroup/types.proto b/storagegroup/types.proto index 41a211f..fde33aa 100644 --- a/storagegroup/types.proto +++ b/storagegroup/types.proto @@ -1,6 +1,6 @@ syntax = "proto3"; package storagegroup; -option go_package = "github.com/nspcc-dev/neofs-api/storagegroup"; +option go_package = "github.com/nspcc-dev/neofs-api-go/storagegroup"; option csharp_namespace = "NeoFS.API.StorageGroup"; import "github.com/gogo/protobuf/gogoproto/gogo.proto"; From 56a38ec33c4cc849efa1b3b29591a21587b24be5 Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Tue, 31 Mar 2020 10:21:31 +0300 Subject: [PATCH 0119/1196] migrate to public proto files --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index a20243e..84583ff 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ -PROTO_VERSION=master -PROTO_URL=https://bitbucket.org/nspcc-dev/neofs-proto/get/$(PROTO_VERSION).tar.gz +PROTO_VERSION=v0.5.0 +PROTO_URL=https://github.com/nspcc-dev/neofs-api/archive/$(PROTO_VERSION).tar.gz B=\033[0;1m G=\033[0;92m From a13de8a2fa9e727e45b61ae7fa8e878fea9fa1fe Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Tue, 31 Mar 2020 10:29:33 +0300 Subject: [PATCH 0120/1196] CHANGELOG --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 559435c..02254ab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,12 @@ # Changelog This is the changelog for NeoFS API +## [0.5.0] - 2020-03-31 + +### Changed +- Rename repo to `neofs-api-go` +- Used public proto files + ## [0.4.2] - 2020-03-16 ### Fixed @@ -210,3 +216,4 @@ Initial public release [0.4.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v0.3.2...v0.4.0 [0.4.1]: https://github.com/nspcc-dev/neofs-api-go/compare/v0.4.0...v0.4.1 [0.4.2]: https://github.com/nspcc-dev/neofs-api-go/compare/v0.4.1...v0.4.2 +[0.5.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v0.4.2...v0.5.0 From 4abd71f99b1830b4f58f45e10daddf9f3538a1ad Mon Sep 17 00:00:00 2001 From: alexvanin Date: Thu, 2 Apr 2020 14:38:34 +0300 Subject: [PATCH 0121/1196] object: Define RequestType for object service requests --- object/types.go | 45 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/object/types.go b/object/types.go index de909a8..cde1f25 100644 --- a/object/types.go +++ b/object/types.go @@ -28,7 +28,10 @@ type ( PRead(ctx context.Context, addr refs.Address, rng Range) ([]byte, error) } - headerType int + // RequestType of the object service requests. + RequestType int + + headerType int ) const ( @@ -71,12 +74,52 @@ const ( PublicKeyHdr ) +const ( + _ RequestType = iota + // RequestPut is a type for object put request. + RequestPut + // RequestGet is a type for object get request. + RequestGet + // RequestHead is a type for object head request. + RequestHead + // RequestSearch is a type for object search request. + RequestSearch + // RequestRange is a type for object range request. + RequestRange + // RequestRangeHash is a type for object hash range request. + RequestRangeHash + // RequestDelete is a type for object delete request. + RequestDelete +) + var ( _ internal.Custom = (*Object)(nil) emptyObject = new(Object).Bytes() ) +// String returns printable name of the request type. +func (s RequestType) String() string { + switch s { + case RequestPut: + return "PUT" + case RequestGet: + return "GET" + case RequestHead: + return "HEAD" + case RequestSearch: + return "SEARCH" + case RequestRange: + return "RANGE" + case RequestRangeHash: + return "RANGE_HASH" + case RequestDelete: + return "DELETE" + default: + return "UNKNOWN" + } +} + // Bytes returns marshaled object in a binary format. func (m Object) Bytes() []byte { data, _ := m.Marshal(); return data } From 1e513625f1564c1c0d21878057cabcd46b154207 Mon Sep 17 00:00:00 2001 From: alexvanin Date: Thu, 2 Apr 2020 14:52:08 +0300 Subject: [PATCH 0122/1196] object: Add `Type()` in `Request` interface BasicACL have set of rules for every request type. ACL will be processed before any request specific handlers. Therefore we need to determine request type in generic request interface, which is used in pre-processors of object service implementation. --- object/service.go | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/object/service.go b/object/service.go index 589bd95..3a2ca08 100644 --- a/object/service.go +++ b/object/service.go @@ -28,12 +28,13 @@ type ( Token = session.Token // Request defines object rpc requests. - // All object operations must have TTL, Epoch, Container ID and + // All object operations must have TTL, Epoch, Type, Container ID and // permission of usage previous network map. Request interface { service.MetaHeader CID() CID + Type() RequestType AllowPreviousNetMap() bool } ) @@ -169,3 +170,24 @@ func (m *GetRangeRequest) AllowPreviousNetMap() bool { return false } // AllowPreviousNetMap returns permission to use previous network map in object get range hash request. func (m *GetRangeHashRequest) AllowPreviousNetMap() bool { return false } + +// Type returns type of the object put request. +func (m *PutRequest) Type() RequestType { return RequestPut } + +// Type returns type of the object get request. +func (m *GetRequest) Type() RequestType { return RequestGet } + +// Type returns type of the object head request. +func (m *HeadRequest) Type() RequestType { return RequestHead } + +// Type returns type of the object search request. +func (m *SearchRequest) Type() RequestType { return RequestSearch } + +// Type returns type of the object delete request. +func (m *DeleteRequest) Type() RequestType { return RequestDelete } + +// Type returns type of the object get range request. +func (m *GetRangeRequest) Type() RequestType { return RequestRange } + +// Type returns type of the object get range hash request. +func (m *GetRangeHashRequest) Type() RequestType { return RequestRangeHash } From 55b75a0dae7dfa1ab610b1f9af70d5ec0db8d324 Mon Sep 17 00:00:00 2001 From: alexvanin Date: Thu, 2 Apr 2020 15:05:48 +0300 Subject: [PATCH 0123/1196] object: Add test for object request type --- object/service_test.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/object/service_test.go b/object/service_test.go index f06e557..46213e2 100644 --- a/object/service_test.go +++ b/object/service_test.go @@ -18,11 +18,22 @@ func TestRequest(t *testing.T) { &GetRangeHashRequest{}, } + types := []RequestType{ + RequestPut, + RequestGet, + RequestHead, + RequestSearch, + RequestDelete, + RequestRange, + RequestRangeHash, + } + for i := range cases { v := cases[i] t.Run(fmt.Sprintf("%T", v), func(t *testing.T) { require.NotPanics(t, func() { v.CID() }) + require.Equal(t, types[i], v.Type()) }) } } From 48c55886509ced36c53916ebf29eb32c47b07ea6 Mon Sep 17 00:00:00 2001 From: alexvanin Date: Thu, 2 Apr 2020 15:15:59 +0300 Subject: [PATCH 0124/1196] proto: Update proto library to v0.6.0 --- Makefile | 2 +- acl/types.pb.go | 88 +++++++ acl/types.proto | 27 +++ container/service.pb.go | 128 +++++----- container/service.proto | 4 +- container/types.pb.go | 512 +++------------------------------------- container/types.proto | 17 +- 7 files changed, 214 insertions(+), 564 deletions(-) create mode 100644 acl/types.pb.go create mode 100644 acl/types.proto diff --git a/Makefile b/Makefile index 84583ff..9b02a6e 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -PROTO_VERSION=v0.5.0 +PROTO_VERSION=v0.6.0 PROTO_URL=https://github.com/nspcc-dev/neofs-api/archive/$(PROTO_VERSION).tar.gz B=\033[0;1m diff --git a/acl/types.pb.go b/acl/types.pb.go new file mode 100644 index 0000000..bcbd199 --- /dev/null +++ b/acl/types.pb.go @@ -0,0 +1,88 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: acl/types.proto + +package acl + +import ( + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/golang/protobuf/proto" + math "math" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package + +// Target of the access control rule in access control list. +type Target int32 + +const ( + // Unknown target, default value. + Target_Unknown Target = 0 + // User target rule is applied if sender is the owner of the container. + Target_User Target = 1 + // System target rule is applied if sender is the storage node within the + // container or inner ring node. + Target_System Target = 2 + // Others target rule is applied if sender is not user or system target. + Target_Others Target = 3 + // PubKey target rule is applied if sender has public key provided in + // extended ACL. + Target_PubKey Target = 4 +) + +var Target_name = map[int32]string{ + 0: "Unknown", + 1: "User", + 2: "System", + 3: "Others", + 4: "PubKey", +} + +var Target_value = map[string]int32{ + "Unknown": 0, + "User": 1, + "System": 2, + "Others": 3, + "PubKey": 4, +} + +func (x Target) String() string { + return proto.EnumName(Target_name, int32(x)) +} + +func (Target) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_9b63aff5f3a35e32, []int{0} +} + +func init() { + proto.RegisterEnum("acl.Target", Target_name, Target_value) +} + +func init() { proto.RegisterFile("acl/types.proto", fileDescriptor_9b63aff5f3a35e32) } + +var fileDescriptor_9b63aff5f3a35e32 = []byte{ + // 216 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x4f, 0x4c, 0xce, 0xd1, + 0x2f, 0xa9, 0x2c, 0x48, 0x2d, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x4e, 0x4c, 0xce, + 0x91, 0xd2, 0x4d, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x4f, 0xcf, 0x4f, + 0xcf, 0xd7, 0x07, 0xcb, 0x25, 0x95, 0xa6, 0x81, 0x79, 0x60, 0x0e, 0x98, 0x05, 0xd1, 0xa3, 0xe5, + 0xcc, 0xc5, 0x16, 0x92, 0x58, 0x94, 0x9e, 0x5a, 0x22, 0xc4, 0xcd, 0xc5, 0x1e, 0x9a, 0x97, 0x9d, + 0x97, 0x5f, 0x9e, 0x27, 0xc0, 0x20, 0xc4, 0xc1, 0xc5, 0x12, 0x5a, 0x9c, 0x5a, 0x24, 0xc0, 0x28, + 0xc4, 0xc5, 0xc5, 0x16, 0x5c, 0x59, 0x5c, 0x92, 0x9a, 0x2b, 0xc0, 0x04, 0x62, 0xfb, 0x97, 0x64, + 0xa4, 0x16, 0x15, 0x0b, 0x30, 0x83, 0xd8, 0x01, 0xa5, 0x49, 0xde, 0xa9, 0x95, 0x02, 0x2c, 0x4e, + 0xde, 0x27, 0x1e, 0xc9, 0x31, 0x5e, 0x78, 0x24, 0xc7, 0x78, 0xe3, 0x91, 0x1c, 0xe3, 0x83, 0x47, + 0x72, 0x8c, 0x33, 0x1e, 0xcb, 0x31, 0x44, 0xa9, 0x22, 0xb9, 0x24, 0xaf, 0xb8, 0x20, 0x39, 0x59, + 0x37, 0x25, 0xb5, 0x4c, 0x3f, 0x2f, 0x35, 0x3f, 0xad, 0x58, 0x37, 0xb1, 0x20, 0x53, 0x37, 0x3d, + 0x5f, 0x3f, 0x31, 0x39, 0x67, 0x15, 0x13, 0xaf, 0x5f, 0x6a, 0xbe, 0x5b, 0xb0, 0x9e, 0x63, 0x80, + 0xa7, 0x9e, 0x63, 0x72, 0x4e, 0x12, 0x1b, 0xd8, 0x61, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, + 0xb3, 0xda, 0x09, 0x81, 0xdf, 0x00, 0x00, 0x00, +} diff --git a/acl/types.proto b/acl/types.proto new file mode 100644 index 0000000..f20423f --- /dev/null +++ b/acl/types.proto @@ -0,0 +1,27 @@ +syntax = "proto3"; +package acl; +option go_package = "github.com/nspcc-dev/neofs-api-go/acl"; +option csharp_namespace = "NeoFS.API.Acl"; + +import "github.com/gogo/protobuf/gogoproto/gogo.proto"; +option (gogoproto.stable_marshaler_all) = true; + +// Target of the access control rule in access control list. +enum Target { + // Unknown target, default value. + Unknown = 0; + + // User target rule is applied if sender is the owner of the container. + User = 1; + + // System target rule is applied if sender is the storage node within the + // container or inner ring node. + System = 2; + + // Others target rule is applied if sender is not user or system target. + Others = 3; + + // PubKey target rule is applied if sender has public key provided in + // extended ACL. + PubKey = 4; +} diff --git a/container/service.pb.go b/container/service.pb.go index 8698925..6131254 100644 --- a/container/service.pb.go +++ b/container/service.pb.go @@ -38,8 +38,8 @@ type PutRequest struct { OwnerID OwnerID `protobuf:"bytes,3,opt,name=OwnerID,proto3,customtype=OwnerID" json:"OwnerID"` // Rules define storage policy for the object inside the container. Rules netmap.PlacementRule `protobuf:"bytes,4,opt,name=rules,proto3" json:"rules"` - // Container ACL. - Group AccessGroup `protobuf:"bytes,5,opt,name=Group,proto3" json:"Group"` + // BasicACL of the container. + BasicACL uint32 `protobuf:"varint,5,opt,name=BasicACL,proto3" json:"BasicACL,omitempty"` // RequestMetaHeader contains information about request meta headers (should be embedded into message) service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) @@ -92,11 +92,11 @@ func (m *PutRequest) GetRules() netmap.PlacementRule { return netmap.PlacementRule{} } -func (m *PutRequest) GetGroup() AccessGroup { +func (m *PutRequest) GetBasicACL() uint32 { if m != nil { - return m.Group + return m.BasicACL } - return AccessGroup{} + return 0 } type PutResponse struct { @@ -391,45 +391,45 @@ func init() { func init() { proto.RegisterFile("container/service.proto", fileDescriptor_e1fa9d7ab2e7ae06) } var fileDescriptor_e1fa9d7ab2e7ae06 = []byte{ - // 599 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x54, 0xcb, 0x6e, 0xd3, 0x40, - 0x14, 0xed, 0x34, 0xe9, 0xeb, 0xba, 0xbc, 0x86, 0x3e, 0x8c, 0x25, 0xd2, 0xca, 0xab, 0xf2, 0x88, - 0x2d, 0x42, 0x25, 0xd8, 0xb0, 0x68, 0x1a, 0x51, 0x2a, 0x51, 0x88, 0x5c, 0x09, 0x24, 0x76, 0xce, - 0xf4, 0x26, 0x58, 0x4a, 0x3c, 0xc6, 0x33, 0x0e, 0xca, 0x9f, 0xf0, 0x0d, 0x20, 0xb1, 0xe6, 0x13, - 0xba, 0xec, 0x12, 0xb1, 0x88, 0x50, 0x58, 0x22, 0xfe, 0x01, 0x79, 0xfc, 0x4c, 0x5a, 0x60, 0x59, - 0xb1, 0xb1, 0x66, 0xce, 0xb9, 0xe7, 0xbe, 0x3d, 0xb0, 0xc9, 0xb8, 0x2f, 0x5d, 0xcf, 0xc7, 0xd0, - 0x16, 0x18, 0x0e, 0x3d, 0x86, 0x56, 0x10, 0x72, 0xc9, 0xe9, 0x4a, 0x4e, 0x18, 0x34, 0x65, 0xec, - 0x01, 0x4a, 0x37, 0xa1, 0x8d, 0xb5, 0x0c, 0x1b, 0x62, 0xe8, 0x75, 0x47, 0x29, 0xba, 0x5e, 0x78, - 0x93, 0xa3, 0x00, 0x45, 0x0a, 0xdf, 0xed, 0x79, 0xf2, 0x6d, 0xd4, 0xb1, 0x18, 0x1f, 0xd8, 0xbe, - 0x08, 0x18, 0xab, 0x9f, 0xe0, 0xd0, 0xf6, 0x51, 0x0e, 0xdc, 0xc0, 0x16, 0xd8, 0x47, 0x26, 0x79, - 0x98, 0xda, 0xd6, 0x4b, 0xb6, 0x3d, 0xde, 0xe3, 0xb6, 0x82, 0x3b, 0x51, 0x57, 0xdd, 0xd4, 0x45, - 0x9d, 0x12, 0x73, 0xf3, 0xe7, 0x3c, 0x40, 0x3b, 0x92, 0x0e, 0xbe, 0x8b, 0x50, 0x48, 0x6a, 0xc3, - 0xca, 0x11, 0x0a, 0xe1, 0xf6, 0xf0, 0xb0, 0xa5, 0x93, 0x6d, 0xb2, 0xb3, 0xda, 0xbc, 0x71, 0x3a, - 0xde, 0x9a, 0xfb, 0x36, 0xde, 0x2a, 0x08, 0xa7, 0x38, 0x52, 0x03, 0x96, 0xf7, 0xdd, 0xc0, 0x65, - 0x9e, 0x1c, 0xe9, 0xf3, 0xdb, 0x64, 0xa7, 0xea, 0xe4, 0x77, 0x7a, 0x07, 0x96, 0x5e, 0xbe, 0xf7, - 0x31, 0x3c, 0x6c, 0xe9, 0x15, 0xe5, 0xea, 0x5a, 0xea, 0x2a, 0x83, 0x9d, 0xec, 0x40, 0x1f, 0xc0, - 0x42, 0x18, 0xf5, 0x51, 0xe8, 0xd5, 0x6d, 0xb2, 0xa3, 0x35, 0xd6, 0xad, 0xa4, 0x38, 0xab, 0xdd, - 0x77, 0x19, 0x0e, 0xd0, 0x97, 0x4e, 0xd4, 0xc7, 0x66, 0x35, 0xd6, 0x3b, 0x89, 0x25, 0x6d, 0xc0, - 0xc2, 0x41, 0xc8, 0xa3, 0x40, 0x5f, 0x50, 0x92, 0x0d, 0x2b, 0xef, 0x9d, 0xb5, 0xc7, 0x18, 0x0a, - 0xa1, 0xd8, 0x4c, 0xa3, 0x2e, 0xf4, 0x31, 0x54, 0x8f, 0x50, 0xba, 0x7a, 0x47, 0x49, 0x0c, 0x2b, - 0x1b, 0x59, 0x5a, 0x7e, 0xcc, 0x3d, 0x43, 0xf7, 0x04, 0xc3, 0xe6, 0x72, 0x2c, 0x3b, 0x1b, 0x6f, - 0x11, 0x47, 0x29, 0x68, 0x0b, 0x16, 0x5f, 0xa9, 0x49, 0xe9, 0x4c, 0x69, 0xcd, 0x59, 0xad, 0x62, - 0x3d, 0xe6, 0x4a, 0x8f, 0xfb, 0xe7, 0x7c, 0xa4, 0x5a, 0xf3, 0x3e, 0x68, 0xaa, 0xd9, 0x22, 0xe0, - 0xbe, 0x40, 0x7a, 0x1b, 0x2a, 0xfb, 0x79, 0x9f, 0xb5, 0xb4, 0x39, 0x31, 0xe4, 0xc4, 0x1f, 0xf3, - 0x33, 0x81, 0x2b, 0x2d, 0xec, 0xa3, 0xc4, 0x6c, 0x3c, 0x7f, 0x17, 0x5c, 0x7a, 0x79, 0xd7, 0xe1, - 0x6a, 0x96, 0x6f, 0x52, 0xa1, 0xf9, 0x89, 0x00, 0x1c, 0xa0, 0xfc, 0x4f, 0xf2, 0xdf, 0x03, 0x4d, - 0x25, 0x9b, 0x8e, 0xa7, 0x01, 0x2b, 0xfb, 0xd9, 0x4e, 0xa9, 0x9c, 0xb5, 0xc6, 0x5a, 0x69, 0xcb, - 0x72, 0xce, 0x29, 0xcc, 0xcc, 0x2f, 0x04, 0xb4, 0xe7, 0x9e, 0xc8, 0x2b, 0x2e, 0xfd, 0x03, 0xe4, - 0x1f, 0xff, 0xc0, 0x65, 0x57, 0x5f, 0x87, 0xd5, 0x24, 0xf3, 0xd9, 0xed, 0xac, 0x5c, 0x34, 0xac, - 0xc6, 0x2f, 0x02, 0x4b, 0xc7, 0x49, 0x18, 0xba, 0x0b, 0x95, 0x76, 0x24, 0xe9, 0x7a, 0xa9, 0x3b, - 0xc5, 0xa3, 0x62, 0x6c, 0xcc, 0xc2, 0x69, 0x80, 0x27, 0xb0, 0x98, 0xac, 0x0b, 0xd5, 0x4b, 0x16, - 0x53, 0x1b, 0x6f, 0xdc, 0xba, 0x80, 0x49, 0xe5, 0xbb, 0x50, 0x39, 0xc0, 0xe9, 0xa0, 0xc5, 0xaa, - 0x4d, 0x05, 0x2d, 0x0f, 0xf5, 0x11, 0x54, 0xe3, 0x2a, 0x69, 0x99, 0x2f, 0x0d, 0xcc, 0xd8, 0x3c, - 0x87, 0x27, 0xc2, 0xe6, 0xeb, 0xd3, 0x49, 0x8d, 0x9c, 0x4d, 0x6a, 0xe4, 0xeb, 0xa4, 0x46, 0xbe, - 0x4f, 0x6a, 0xe4, 0xc3, 0x8f, 0xda, 0xdc, 0x9b, 0x7b, 0x7f, 0x78, 0x9a, 0x79, 0x57, 0xd4, 0xdd, - 0xc0, 0xab, 0xf7, 0xb8, 0x9d, 0xfb, 0xfb, 0x38, 0x7f, 0xf3, 0x05, 0xf2, 0xa7, 0xc7, 0xd6, 0x5e, - 0xfb, 0xb0, 0xd8, 0x9e, 0xce, 0xa2, 0x7a, 0x89, 0x1f, 0xfe, 0x0e, 0x00, 0x00, 0xff, 0xff, 0x4c, - 0xfc, 0xa5, 0x37, 0x4b, 0x06, 0x00, 0x00, + // 596 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x54, 0xcb, 0x6e, 0xd3, 0x4c, + 0x14, 0xee, 0x34, 0xe9, 0xed, 0xb8, 0xfd, 0x7f, 0x18, 0x5a, 0x6a, 0x2c, 0x91, 0x46, 0x5e, 0x85, + 0x4b, 0x6c, 0x11, 0x2a, 0xc1, 0x86, 0x45, 0x93, 0x88, 0x52, 0xa9, 0x85, 0xc8, 0x95, 0x40, 0x62, + 0x37, 0x71, 0x4f, 0x83, 0xa5, 0xc4, 0x63, 0x3c, 0xe3, 0xa2, 0xbe, 0x09, 0xcf, 0x00, 0x12, 0x6b, + 0x1e, 0xa1, 0xcb, 0x4a, 0x6c, 0x10, 0x8b, 0x08, 0x85, 0x35, 0xef, 0x80, 0x3c, 0xbe, 0x26, 0x2d, + 0xb0, 0xac, 0xd8, 0x58, 0x33, 0xdf, 0x77, 0xbe, 0x73, 0xf7, 0xc0, 0xa6, 0xcb, 0x7d, 0xc9, 0x3c, + 0x1f, 0x43, 0x5b, 0x60, 0x78, 0xe2, 0xb9, 0x68, 0x05, 0x21, 0x97, 0x9c, 0xae, 0xe4, 0x84, 0x41, + 0x53, 0xc6, 0x1e, 0xa1, 0x64, 0x09, 0x6d, 0xac, 0x67, 0xd8, 0x09, 0x86, 0xde, 0xf1, 0x69, 0x8a, + 0x6e, 0x14, 0xde, 0xe4, 0x69, 0x80, 0x22, 0x85, 0xef, 0x0e, 0x3c, 0xf9, 0x26, 0xea, 0x5b, 0x2e, + 0x1f, 0xd9, 0xbe, 0x08, 0x5c, 0xb7, 0x79, 0x84, 0x27, 0xb6, 0x8f, 0x72, 0xc4, 0x02, 0x5b, 0xe0, + 0x10, 0x5d, 0xc9, 0xc3, 0xd4, 0xb6, 0x59, 0xb2, 0x1d, 0xf0, 0x01, 0xb7, 0x15, 0xdc, 0x8f, 0x8e, + 0xd5, 0x4d, 0x5d, 0xd4, 0x29, 0x31, 0x37, 0xbf, 0xcc, 0x03, 0xf4, 0x22, 0xe9, 0xe0, 0xdb, 0x08, + 0x85, 0xa4, 0x36, 0xac, 0x1c, 0xa0, 0x10, 0x6c, 0x80, 0x7b, 0x5d, 0x9d, 0xd4, 0x49, 0x63, 0xb5, + 0x7d, 0xfd, 0x6c, 0xbc, 0x35, 0xf7, 0x6d, 0xbc, 0x55, 0x10, 0x4e, 0x71, 0xa4, 0x06, 0x2c, 0x77, + 0x58, 0xc0, 0x5c, 0x4f, 0x9e, 0xea, 0xf3, 0x75, 0xd2, 0xa8, 0x3a, 0xf9, 0x9d, 0xde, 0x81, 0xa5, + 0x17, 0xef, 0x7c, 0x0c, 0xf7, 0xba, 0x7a, 0x45, 0xb9, 0xfa, 0x3f, 0x75, 0x95, 0xc1, 0x4e, 0x76, + 0xa0, 0x0f, 0x60, 0x21, 0x8c, 0x86, 0x28, 0xf4, 0x6a, 0x9d, 0x34, 0xb4, 0xd6, 0x86, 0x95, 0x14, + 0x67, 0xf5, 0x86, 0xcc, 0xc5, 0x11, 0xfa, 0xd2, 0x89, 0x86, 0xd8, 0xae, 0xc6, 0x7a, 0x27, 0xb1, + 0x8c, 0x23, 0xb7, 0x99, 0xf0, 0xdc, 0x9d, 0xce, 0xbe, 0xbe, 0x50, 0x27, 0x8d, 0x35, 0x27, 0xbf, + 0xd3, 0xc7, 0x50, 0x3d, 0x40, 0xc9, 0xf4, 0xbe, 0xf2, 0x66, 0x58, 0xd9, 0x68, 0xd2, 0x32, 0x63, + 0xee, 0x19, 0xb2, 0x23, 0x0c, 0xdb, 0xcb, 0xb1, 0xcb, 0xf3, 0xf1, 0x16, 0x71, 0x94, 0x82, 0x76, + 0x61, 0xf1, 0xa5, 0x9a, 0x88, 0xee, 0x2a, 0xad, 0x39, 0xab, 0x55, 0xac, 0xe7, 0x32, 0xe9, 0x71, + 0xff, 0x82, 0x8f, 0x54, 0x6b, 0xde, 0x07, 0x4d, 0x35, 0x55, 0x04, 0xdc, 0x17, 0x48, 0x6f, 0x43, + 0xa5, 0x93, 0xf7, 0x53, 0x4b, 0x9b, 0x10, 0x43, 0x4e, 0xfc, 0x31, 0x3f, 0x11, 0x58, 0xeb, 0xe2, + 0x10, 0x25, 0x66, 0x63, 0xf8, 0xb3, 0xe0, 0xca, 0xcb, 0xbb, 0x06, 0xff, 0x65, 0xf9, 0x26, 0x15, + 0x9a, 0x1f, 0x09, 0xc0, 0x2e, 0xca, 0x7f, 0x24, 0xff, 0x1d, 0xd0, 0x54, 0xb2, 0xe9, 0x78, 0x5a, + 0xb0, 0xd2, 0xc9, 0xfe, 0x3b, 0x95, 0xb3, 0xd6, 0x5a, 0xb7, 0xf2, 0x3f, 0xd1, 0xca, 0x39, 0xa7, + 0x30, 0x33, 0x3f, 0x13, 0xd0, 0xf6, 0x3d, 0x91, 0x57, 0x5c, 0xda, 0x75, 0xf2, 0x97, 0x5d, 0xbf, + 0xea, 0xea, 0x9b, 0xb0, 0x9a, 0x64, 0x3e, 0xbb, 0x9d, 0x95, 0xcb, 0x86, 0xd5, 0xfa, 0x49, 0x60, + 0xe9, 0x30, 0x09, 0x43, 0xb7, 0xa1, 0xd2, 0x8b, 0x24, 0xdd, 0x28, 0x75, 0xa7, 0x78, 0x3c, 0x8c, + 0x9b, 0xb3, 0x70, 0x1a, 0xe0, 0x09, 0x2c, 0x26, 0xeb, 0x42, 0xf5, 0x92, 0xc5, 0xd4, 0xc6, 0x1b, + 0xb7, 0x2e, 0x61, 0x52, 0xf9, 0x36, 0x54, 0x76, 0x71, 0x3a, 0x68, 0xb1, 0x6a, 0x53, 0x41, 0xcb, + 0x43, 0x7d, 0x04, 0xd5, 0xb8, 0x4a, 0x5a, 0xe6, 0x4b, 0x03, 0x33, 0x36, 0x2f, 0xe0, 0x89, 0xb0, + 0xfd, 0xea, 0x6c, 0x52, 0x23, 0xe7, 0x93, 0x1a, 0xf9, 0x3a, 0xa9, 0x91, 0xef, 0x93, 0x1a, 0x79, + 0xff, 0xa3, 0x36, 0xf7, 0xfa, 0xde, 0x6f, 0x9e, 0x60, 0x7e, 0x2c, 0x9a, 0x2c, 0xf0, 0x9a, 0x03, + 0x6e, 0xe7, 0xfe, 0x3e, 0xcc, 0xdf, 0x78, 0x8e, 0xfc, 0xe9, 0xa1, 0xb5, 0xd3, 0xdb, 0x2b, 0xb6, + 0xa7, 0xbf, 0xa8, 0x5e, 0xdc, 0x87, 0xbf, 0x02, 0x00, 0x00, 0xff, 0xff, 0x5b, 0x68, 0x23, 0x86, + 0x33, 0x06, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -682,16 +682,11 @@ func (m *PutRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x6 i-- dAtA[i] = 0x92 - { - size, err := m.Group.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) + if m.BasicACL != 0 { + i = encodeVarintService(dAtA, i, uint64(m.BasicACL)) + i-- + dAtA[i] = 0x28 } - i-- - dAtA[i] = 0x2a { size, err := m.Rules.MarshalToSizedBuffer(dAtA[:i]) if err != nil { @@ -1083,8 +1078,9 @@ func (m *PutRequest) Size() (n int) { n += 1 + l + sovService(uint64(l)) l = m.Rules.Size() n += 1 + l + sovService(uint64(l)) - l = m.Group.Size() - n += 1 + l + sovService(uint64(l)) + if m.BasicACL != 0 { + n += 1 + sovService(uint64(m.BasicACL)) + } l = m.RequestMetaHeader.Size() n += 2 + l + sovService(uint64(l)) l = m.RequestVerificationHeader.Size() @@ -1363,10 +1359,10 @@ func (m *PutRequest) Unmarshal(dAtA []byte) error { } iNdEx = postIndex case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Group", wireType) + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BasicACL", wireType) } - var msglen int + m.BasicACL = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowService @@ -1376,25 +1372,11 @@ func (m *PutRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + m.BasicACL |= uint32(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Group.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex case 98: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType) diff --git a/container/service.proto b/container/service.proto index bccf924..7df2c66 100644 --- a/container/service.proto +++ b/container/service.proto @@ -42,8 +42,8 @@ message PutRequest { // Rules define storage policy for the object inside the container. netmap.PlacementRule rules = 4 [(gogoproto.nullable) = false]; - // Container ACL. - AccessGroup Group = 5 [(gogoproto.nullable) = false]; + // BasicACL of the container. + uint32 BasicACL = 5; // RequestMetaHeader contains information about request meta headers (should be embedded into message) service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; diff --git a/container/types.pb.go b/container/types.pb.go index bfb7fa7..391656c 100644 --- a/container/types.pb.go +++ b/container/types.pb.go @@ -34,11 +34,12 @@ type Container struct { Capacity uint64 `protobuf:"varint,3,opt,name=Capacity,proto3" json:"Capacity,omitempty"` // Rules define storage policy for the object inside the container. Rules netmap.PlacementRule `protobuf:"bytes,4,opt,name=Rules,proto3" json:"Rules"` - // Container ACL. - List AccessControlList `protobuf:"bytes,5,opt,name=List,proto3" json:"List"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + // BasicACL with access control rules for owner, system, others and + // permission bits for bearer token and extended ACL. + BasicACL uint32 `protobuf:"varint,5,opt,name=BasicACL,proto3" json:"BasicACL,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *Container) Reset() { *m = Container{} } @@ -84,138 +85,41 @@ func (m *Container) GetRules() netmap.PlacementRule { return netmap.PlacementRule{} } -func (m *Container) GetList() AccessControlList { +func (m *Container) GetBasicACL() uint32 { if m != nil { - return m.List - } - return AccessControlList{} -} - -type AccessGroup struct { - // Group access mode. - AccessMode uint32 `protobuf:"varint,1,opt,name=AccessMode,proto3" json:"AccessMode,omitempty"` - // Group members. - UserGroup []OwnerID `protobuf:"bytes,2,rep,name=UserGroup,proto3,customtype=OwnerID" json:"UserGroup"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *AccessGroup) Reset() { *m = AccessGroup{} } -func (m *AccessGroup) String() string { return proto.CompactTextString(m) } -func (*AccessGroup) ProtoMessage() {} -func (*AccessGroup) Descriptor() ([]byte, []int) { - return fileDescriptor_1432e52ab0b53e3e, []int{1} -} -func (m *AccessGroup) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *AccessGroup) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *AccessGroup) XXX_Merge(src proto.Message) { - xxx_messageInfo_AccessGroup.Merge(m, src) -} -func (m *AccessGroup) XXX_Size() int { - return m.Size() -} -func (m *AccessGroup) XXX_DiscardUnknown() { - xxx_messageInfo_AccessGroup.DiscardUnknown(m) -} - -var xxx_messageInfo_AccessGroup proto.InternalMessageInfo - -func (m *AccessGroup) GetAccessMode() uint32 { - if m != nil { - return m.AccessMode + return m.BasicACL } return 0 } -type AccessControlList struct { - // List of access groups. - List []AccessGroup `protobuf:"bytes,1,rep,name=List,proto3" json:"List"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *AccessControlList) Reset() { *m = AccessControlList{} } -func (m *AccessControlList) String() string { return proto.CompactTextString(m) } -func (*AccessControlList) ProtoMessage() {} -func (*AccessControlList) Descriptor() ([]byte, []int) { - return fileDescriptor_1432e52ab0b53e3e, []int{2} -} -func (m *AccessControlList) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *AccessControlList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *AccessControlList) XXX_Merge(src proto.Message) { - xxx_messageInfo_AccessControlList.Merge(m, src) -} -func (m *AccessControlList) XXX_Size() int { - return m.Size() -} -func (m *AccessControlList) XXX_DiscardUnknown() { - xxx_messageInfo_AccessControlList.DiscardUnknown(m) -} - -var xxx_messageInfo_AccessControlList proto.InternalMessageInfo - -func (m *AccessControlList) GetList() []AccessGroup { - if m != nil { - return m.List - } - return nil -} - func init() { proto.RegisterType((*Container)(nil), "container.Container") - proto.RegisterType((*AccessGroup)(nil), "container.AccessGroup") - proto.RegisterType((*AccessControlList)(nil), "container.AccessControlList") } func init() { proto.RegisterFile("container/types.proto", fileDescriptor_1432e52ab0b53e3e) } var fileDescriptor_1432e52ab0b53e3e = []byte{ - // 393 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x91, 0x4d, 0x6b, 0xe2, 0x40, - 0x1c, 0xc6, 0x1d, 0x8d, 0xbb, 0xeb, 0xe8, 0xb2, 0xec, 0x2c, 0x2e, 0x41, 0x96, 0x18, 0x3c, 0x65, - 0x77, 0xc9, 0x64, 0xd7, 0x42, 0xef, 0xbe, 0xb4, 0x45, 0xe8, 0x8b, 0x44, 0xa4, 0x50, 0x7a, 0x89, - 0xe3, 0x98, 0x06, 0x62, 0x26, 0x64, 0x26, 0x2d, 0x7e, 0x93, 0x7e, 0x86, 0x7e, 0x12, 0x8f, 0x3d, - 0x96, 0x1e, 0x6c, 0x49, 0xbf, 0x48, 0xc9, 0x44, 0x53, 0xc1, 0xf6, 0x36, 0xcf, 0x33, 0xbf, 0x67, - 0xe6, 0xff, 0x02, 0xeb, 0x84, 0x05, 0xc2, 0xf1, 0x02, 0x1a, 0x59, 0x62, 0x11, 0x52, 0x8e, 0xc3, - 0x88, 0x09, 0x86, 0x2a, 0xb9, 0xdd, 0xf8, 0xe3, 0x7a, 0xe2, 0x2a, 0x9e, 0x60, 0xc2, 0xe6, 0x56, - 0xc0, 0x43, 0x42, 0xcc, 0x29, 0xbd, 0xb6, 0x02, 0x2a, 0xe6, 0x4e, 0x68, 0x71, 0xea, 0x53, 0x22, - 0x58, 0x94, 0xc5, 0x1a, 0xe6, 0x16, 0xeb, 0x32, 0x97, 0x59, 0xd2, 0x9e, 0xc4, 0x33, 0xa9, 0xa4, - 0x90, 0xa7, 0x0c, 0x6f, 0x3d, 0x01, 0x58, 0xe9, 0x6d, 0x3e, 0x42, 0xbf, 0xe1, 0xe7, 0xb3, 0x9b, - 0x80, 0x46, 0x83, 0xbe, 0x0a, 0x74, 0x60, 0xd4, 0xba, 0xdf, 0x96, 0xab, 0x66, 0xe1, 0x71, 0xd5, - 0xdc, 0xd8, 0xf6, 0xe6, 0x80, 0x74, 0xa8, 0x8c, 0x1c, 0x5f, 0xa8, 0x45, 0xc9, 0xd5, 0xd6, 0x9c, - 0x32, 0x1e, 0x0f, 0xfa, 0xb6, 0xbc, 0x41, 0x0d, 0xf8, 0xa5, 0xe7, 0x84, 0x0e, 0xf1, 0xc4, 0x42, - 0x2d, 0xe9, 0xc0, 0x50, 0xec, 0x5c, 0xa3, 0xff, 0xb0, 0x6c, 0xc7, 0x3e, 0xe5, 0xaa, 0xa2, 0x03, - 0xa3, 0xda, 0xae, 0xe3, 0xac, 0x19, 0x3c, 0xf4, 0x1d, 0x42, 0xe7, 0x34, 0x10, 0xe9, 0x6d, 0x57, - 0x49, 0x5f, 0xb5, 0x33, 0x12, 0xed, 0x43, 0xe5, 0xd8, 0xe3, 0x42, 0x2d, 0xcb, 0xc4, 0x2f, 0x9c, - 0x8f, 0x07, 0x77, 0x08, 0xa1, 0x9c, 0xa7, 0x5d, 0x44, 0xcc, 0x4f, 0x99, 0x75, 0x50, 0xf2, 0xad, - 0x4b, 0x58, 0xcd, 0x80, 0xa3, 0x88, 0xc5, 0x21, 0xd2, 0x20, 0xcc, 0xe4, 0x09, 0x9b, 0x52, 0xd9, - 0xe5, 0x57, 0x7b, 0xcb, 0x41, 0x26, 0xac, 0x8c, 0x39, 0x8d, 0x24, 0xac, 0x16, 0xf5, 0xd2, 0x7b, - 0x43, 0x78, 0x23, 0x5a, 0x07, 0xf0, 0xfb, 0xce, 0xf7, 0xe8, 0xdf, 0xba, 0x54, 0xa0, 0x97, 0x8c, - 0x6a, 0xfb, 0xe7, 0x4e, 0xa9, 0x32, 0xba, 0x5d, 0x64, 0xf7, 0x7c, 0x99, 0x68, 0xe0, 0x3e, 0xd1, - 0xc0, 0x43, 0xa2, 0x81, 0xe7, 0x44, 0x03, 0xb7, 0x2f, 0x5a, 0xe1, 0xe2, 0xef, 0x07, 0x7b, 0x67, - 0x33, 0x6e, 0x3a, 0xa1, 0x67, 0xba, 0xcc, 0xca, 0x9f, 0xbe, 0x2b, 0xfe, 0x38, 0xa5, 0xec, 0x70, - 0x84, 0x3b, 0xc3, 0x01, 0xce, 0x37, 0x3a, 0xf9, 0x24, 0xd7, 0xbc, 0xf7, 0x1a, 0x00, 0x00, 0xff, - 0xff, 0xd2, 0x94, 0x7a, 0x2b, 0x65, 0x02, 0x00, 0x00, + // 315 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x4d, 0xce, 0xcf, 0x2b, + 0x49, 0xcc, 0xcc, 0x4b, 0x2d, 0xd2, 0x2f, 0xa9, 0x2c, 0x48, 0x2d, 0xd6, 0x2b, 0x28, 0xca, 0x2f, + 0xc9, 0x17, 0xe2, 0x84, 0x0b, 0x4b, 0x69, 0xa5, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, + 0xe7, 0xea, 0xe7, 0x15, 0x17, 0x24, 0x27, 0xeb, 0xa6, 0xa4, 0x96, 0xe9, 0xe7, 0xa5, 0x96, 0xe4, + 0x26, 0x16, 0xe8, 0x17, 0xa7, 0xe6, 0xa4, 0x26, 0x97, 0xe4, 0x17, 0x41, 0xb4, 0x49, 0xe9, 0x22, + 0xa9, 0x4d, 0xcf, 0x4f, 0xcf, 0xd7, 0x07, 0x0b, 0x27, 0x95, 0xa6, 0x81, 0x79, 0x60, 0x0e, 0x98, + 0x05, 0x51, 0xae, 0x74, 0x98, 0x91, 0x8b, 0xd3, 0x19, 0x66, 0x91, 0x90, 0x26, 0x17, 0xbb, 0x7f, + 0x79, 0x5e, 0x6a, 0x91, 0xa7, 0x8b, 0x04, 0xa3, 0x02, 0xa3, 0x06, 0x8f, 0x13, 0xff, 0x89, 0x7b, + 0xf2, 0x0c, 0xb7, 0xee, 0xc9, 0xc3, 0x84, 0x83, 0x60, 0x0c, 0x21, 0x05, 0x2e, 0x96, 0xe0, 0xc4, + 0x9c, 0x12, 0x09, 0x26, 0xb0, 0x3a, 0x1e, 0xa8, 0x3a, 0x96, 0xd0, 0x50, 0x4f, 0x97, 0x20, 0xb0, + 0x8c, 0x90, 0x14, 0x17, 0x87, 0x73, 0x62, 0x41, 0x62, 0x72, 0x66, 0x49, 0xa5, 0x04, 0xb3, 0x02, + 0xa3, 0x06, 0x4b, 0x10, 0x9c, 0x2f, 0x64, 0xc8, 0xc5, 0x1a, 0x54, 0x9a, 0x93, 0x5a, 0x2c, 0xc1, + 0xa2, 0xc0, 0xa8, 0xc1, 0x6d, 0x24, 0xaa, 0x07, 0xf1, 0x8c, 0x5e, 0x40, 0x4e, 0x62, 0x72, 0x6a, + 0x6e, 0x6a, 0x5e, 0x09, 0x48, 0xd6, 0x89, 0x05, 0x64, 0x6a, 0x10, 0x44, 0x25, 0xc8, 0x38, 0xa7, + 0xc4, 0xe2, 0xcc, 0x64, 0x47, 0x67, 0x1f, 0x09, 0x56, 0x05, 0x46, 0x0d, 0xde, 0x20, 0x38, 0xdf, + 0x29, 0xfc, 0xc4, 0x23, 0x39, 0xc6, 0x0b, 0x8f, 0xe4, 0x18, 0x6f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, + 0x48, 0x8e, 0x71, 0xc6, 0x63, 0x39, 0x86, 0x28, 0x6d, 0x1c, 0xc1, 0x96, 0x9f, 0x56, 0xac, 0x9b, + 0x58, 0x90, 0xa9, 0x9b, 0x9e, 0xaf, 0x0f, 0x0f, 0xe3, 0x55, 0x4c, 0xc2, 0x7e, 0xa9, 0xf9, 0x6e, + 0xc1, 0x7a, 0x8e, 0x01, 0x9e, 0x7a, 0xf0, 0x00, 0x49, 0x62, 0x03, 0x87, 0x92, 0x31, 0x20, 0x00, + 0x00, 0xff, 0xff, 0xfc, 0x81, 0x55, 0xd6, 0xa4, 0x01, 0x00, 0x00, } func (m *Container) Marshal() (dAtA []byte, err error) { @@ -242,16 +146,11 @@ func (m *Container) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } - { - size, err := m.List.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) + if m.BasicACL != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.BasicACL)) + i-- + dAtA[i] = 0x28 } - i-- - dAtA[i] = 0x2a { size, err := m.Rules.MarshalToSizedBuffer(dAtA[:i]) if err != nil { @@ -290,93 +189,6 @@ func (m *Container) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *AccessGroup) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *AccessGroup) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *AccessGroup) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.UserGroup) > 0 { - for iNdEx := len(m.UserGroup) - 1; iNdEx >= 0; iNdEx-- { - { - size := m.UserGroup[iNdEx].Size() - i -= size - if _, err := m.UserGroup[iNdEx].MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - if m.AccessMode != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.AccessMode)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *AccessControlList) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *AccessControlList) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *AccessControlList) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.List) > 0 { - for iNdEx := len(m.List) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.List[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - func encodeVarintTypes(dAtA []byte, offset int, v uint64) int { offset -= sovTypes(v) base := offset @@ -403,46 +215,8 @@ func (m *Container) Size() (n int) { } l = m.Rules.Size() n += 1 + l + sovTypes(uint64(l)) - l = m.List.Size() - n += 1 + l + sovTypes(uint64(l)) - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *AccessGroup) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.AccessMode != 0 { - n += 1 + sovTypes(uint64(m.AccessMode)) - } - if len(m.UserGroup) > 0 { - for _, e := range m.UserGroup { - l = e.Size() - n += 1 + l + sovTypes(uint64(l)) - } - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *AccessControlList) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.List) > 0 { - for _, e := range m.List { - l = e.Size() - n += 1 + l + sovTypes(uint64(l)) - } + if m.BasicACL != 0 { + n += 1 + sovTypes(uint64(m.BasicACL)) } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) @@ -604,97 +378,10 @@ func (m *Container) Unmarshal(dAtA []byte) error { } iNdEx = postIndex case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field List", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.List.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *AccessGroup) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: AccessGroup: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: AccessGroup: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field AccessMode", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field BasicACL", wireType) } - m.AccessMode = 0 + m.BasicACL = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTypes @@ -704,134 +391,11 @@ func (m *AccessGroup) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.AccessMode |= uint32(b&0x7F) << shift + m.BasicACL |= uint32(b&0x7F) << shift if b < 0x80 { break } } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field UserGroup", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - var v OwnerID - m.UserGroup = append(m.UserGroup, v) - if err := m.UserGroup[len(m.UserGroup)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *AccessControlList) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: AccessControlList: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: AccessControlList: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field List", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.List = append(m.List, AccessGroup{}) - if err := m.List[len(m.List)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTypes(dAtA[iNdEx:]) diff --git a/container/types.proto b/container/types.proto index a0d035d..dc79bd3 100644 --- a/container/types.proto +++ b/container/types.proto @@ -18,18 +18,7 @@ message Container { uint64 Capacity = 3; // Rules define storage policy for the object inside the container. netmap.PlacementRule Rules = 4 [(gogoproto.nullable) = false]; - // Container ACL. - AccessControlList List = 5 [(gogoproto.nullable) = false]; -} - -message AccessGroup { - // Group access mode. - uint32 AccessMode = 1; - // Group members. - repeated bytes UserGroup = 2 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false]; -} - -message AccessControlList { - // List of access groups. - repeated AccessGroup List = 1 [(gogoproto.nullable) = false]; + // BasicACL with access control rules for owner, system, others and + // permission bits for bearer token and extended ACL. + uint32 BasicACL = 5; } From 9f4636618fbba620452e0e4b5a5ab8e41e1448fb Mon Sep 17 00:00:00 2001 From: alexvanin Date: Thu, 2 Apr 2020 15:16:52 +0300 Subject: [PATCH 0125/1196] docs: Update docs for neofs-api v0.6.0 --- docs/acl.md | 62 +++++++++++++++++++++++++++++++++++++++++++++++ docs/container.md | 29 ++-------------------- 2 files changed, 64 insertions(+), 27 deletions(-) create mode 100644 docs/acl.md diff --git a/docs/acl.md b/docs/acl.md new file mode 100644 index 0000000..38f328b --- /dev/null +++ b/docs/acl.md @@ -0,0 +1,62 @@ +# Protocol Documentation + + +## Table of Contents + +- [acl/types.proto](#acl/types.proto) + + + +- [Scalar Value Types](#scalar-value-types) + + + + +

Top

+ +## acl/types.proto + + + + + + + + + +### Target +Target of the access control rule in access control list. + +| Name | Number | Description | +| ---- | ------ | ----------- | +| Unknown | 0 | Unknown target, default value. | +| User | 1 | User target rule is applied if sender is the owner of the container. | +| System | 2 | System target rule is applied if sender is the storage node within the container or inner ring node. | +| Others | 3 | Others target rule is applied if sender is not user or system target. | +| PubKey | 4 | PubKey target rule is applied if sender has public key provided in extended ACL. | + + + + + + +## Scalar Value Types + +| .proto Type | Notes | C++ Type | Java Type | Python Type | +| ----------- | ----- | -------- | --------- | ----------- | +| double | | double | double | float | +| float | | float | float | float | +| int32 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint32 instead. | int32 | int | int | +| int64 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint64 instead. | int64 | long | int/long | +| uint32 | Uses variable-length encoding. | uint32 | int | int/long | +| uint64 | Uses variable-length encoding. | uint64 | long | int/long | +| sint32 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s. | int32 | int | int | +| sint64 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s. | int64 | long | int/long | +| fixed32 | Always four bytes. More efficient than uint32 if values are often greater than 2^28. | uint32 | int | int | +| fixed64 | Always eight bytes. More efficient than uint64 if values are often greater than 2^56. | uint64 | long | int/long | +| sfixed32 | Always four bytes. | int32 | int | int | +| sfixed64 | Always eight bytes. | int64 | long | int/long | +| bool | | bool | boolean | boolean | +| string | A string must always contain UTF-8 encoded or 7-bit ASCII text. | string | String | str/unicode | +| bytes | May contain any arbitrary sequence of bytes. | string | ByteString | str | + diff --git a/docs/container.md b/docs/container.md index 6693980..f0188ca 100644 --- a/docs/container.md +++ b/docs/container.md @@ -21,8 +21,6 @@ - [container/types.proto](#container/types.proto) - Messages - - [AccessControlList](#container.AccessControlList) - - [AccessGroup](#container.AccessGroup) - [Container](#container.Container) @@ -166,7 +164,7 @@ via consensus in inner ring nodes | Capacity | [uint64](#uint64) | | Capacity defines amount of data that can be stored in the container (doesn't used for now). | | OwnerID | [bytes](#bytes) | | OwnerID is a wallet address | | rules | [netmap.PlacementRule](#netmap.PlacementRule) | | Rules define storage policy for the object inside the container. | -| Group | [AccessGroup](#container.AccessGroup) | | Container ACL. | +| BasicACL | [uint32](#uint32) | | BasicACL of the container. | | Meta | [service.RequestMetaHeader](#service.RequestMetaHeader) | | RequestMetaHeader contains information about request meta headers (should be embedded into message) | | Verify | [service.RequestVerificationHeader](#service.RequestVerificationHeader) | | RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) | @@ -196,29 +194,6 @@ via consensus in inner ring nodes - - -### Message AccessControlList - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| List | [AccessGroup](#container.AccessGroup) | repeated | List of access groups. | - - - - -### Message AccessGroup - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| AccessMode | [uint32](#uint32) | | Group access mode. | -| UserGroup | [bytes](#bytes) | repeated | Group members. | - - ### Message Container @@ -231,7 +206,7 @@ The Container service definition. | Salt | [bytes](#bytes) | | Salt is a nonce for unique container id calculation. | | Capacity | [uint64](#uint64) | | Capacity defines amount of data that can be stored in the container (doesn't used for now). | | Rules | [netmap.PlacementRule](#netmap.PlacementRule) | | Rules define storage policy for the object inside the container. | -| List | [AccessControlList](#container.AccessControlList) | | Container ACL. | +| BasicACL | [uint32](#uint32) | | BasicACL with access control rules for owner, system, others and permission bits for bearer token and extended ACL. | From 2fb36f85887cd8e2b9036c150813c43a913fc18f Mon Sep 17 00:00:00 2001 From: alexvanin Date: Thu, 2 Apr 2020 15:44:18 +0300 Subject: [PATCH 0126/1196] container: Support new `BasicACL` field --- container/service.go | 4 ++++ container/types.go | 20 ++++---------------- container/types_test.go | 22 +--------------------- 3 files changed, 9 insertions(+), 37 deletions(-) diff --git a/container/service.go b/container/service.go index 8eb9ba6..2f36dc1 100644 --- a/container/service.go +++ b/container/service.go @@ -31,9 +31,11 @@ func (m *PutRequest) PrepareData() ([]byte, error) { err error buf = new(bytes.Buffer) capBytes = make([]byte, 8) + aclBytes = make([]byte, 4) ) binary.BigEndian.PutUint64(capBytes, m.Capacity) + binary.BigEndian.PutUint32(capBytes, m.BasicACL) if _, err = buf.Write(m.MessageID.Bytes()); err != nil { return nil, errors.Wrap(err, "could not write message id") @@ -45,6 +47,8 @@ func (m *PutRequest) PrepareData() ([]byte, error) { return nil, errors.Wrap(err, "could not marshal placement") } else if _, err = buf.Write(data); err != nil { return nil, errors.Wrap(err, "could not write placement") + } else if _, err = buf.Write(aclBytes); err != nil { + return nil, errors.Wrap(err, "could not write basic acl") } return buf.Bytes(), nil diff --git a/container/types.go b/container/types.go index 21fc0d1..e358e6d 100644 --- a/container/types.go +++ b/container/types.go @@ -11,19 +11,6 @@ import ( "github.com/pkg/errors" ) -// AccessMode is a container access mode type. -type AccessMode uint32 - -const ( - // AccessModeRead is a read access mode. - AccessModeRead AccessMode = 1 << iota - // AccessModeWrite is a write access mode. - AccessModeWrite -) - -// AccessModeReadWrite is a read/write container access mode. -const AccessModeReadWrite = AccessModeRead | AccessModeWrite - var ( _ internal.Custom = (*Container)(nil) @@ -31,8 +18,8 @@ var ( emptyOwner = (OwnerID{}).Bytes() ) -// New creates new user container based on capacity, OwnerID and PlacementRules. -func New(cap uint64, owner OwnerID, rules netmap.PlacementRule) (*Container, error) { +// New creates new user container based on capacity, OwnerID, ACL and PlacementRules. +func New(cap uint64, owner OwnerID, acl uint32, rules netmap.PlacementRule) (*Container, error) { if bytes.Equal(owner[:], emptyOwner) { return nil, refs.ErrEmptyOwner } else if cap == 0 { @@ -49,6 +36,7 @@ func New(cap uint64, owner OwnerID, rules netmap.PlacementRule) (*Container, err Salt: UUID(salt), Capacity: cap, Rules: rules, + BasicACL: acl, }, nil } @@ -90,7 +78,7 @@ func NewTestContainer() (*Container, error) { if err != nil { return nil, err } - return New(100, owner, netmap.PlacementRule{ + return New(100, owner, 0xFFFFFFFF, netmap.PlacementRule{ ReplFactor: 2, SFGroups: []netmap.SFGroup{ { diff --git a/container/types_test.go b/container/types_test.go index 1ccc00b..fddccb3 100644 --- a/container/types_test.go +++ b/container/types_test.go @@ -36,7 +36,7 @@ func TestCID(t *testing.T) { owner, err := refs.NewOwnerID(&key.PublicKey) require.NoError(t, err) - c1, err := New(10, owner, rules) + c1, err := New(10, owner, 0xDEADBEEF, rules) require.NoError(t, err) data, err := proto.Marshal(c1) @@ -55,23 +55,3 @@ func TestCID(t *testing.T) { require.Equal(t, cid1, cid2) }) } - -func TestAccessMode(t *testing.T) { - t.Run("read access to read/write mode", func(t *testing.T) { - require.Equal(t, AccessModeRead, AccessModeReadWrite&AccessModeRead) - }) - - t.Run("write access to read/write mode", func(t *testing.T) { - require.Equal(t, AccessModeWrite, AccessModeReadWrite&AccessModeWrite) - }) - - t.Run("read(write) access to write(read) mode", func(t *testing.T) { - require.Zero(t, AccessModeRead&AccessModeWrite) - }) - - t.Run("access to same mode", func(t *testing.T) { - require.Equal(t, AccessModeWrite, AccessModeWrite&AccessModeWrite) - require.Equal(t, AccessModeRead, AccessModeRead&AccessModeRead) - require.Equal(t, AccessModeReadWrite, AccessModeReadWrite&AccessModeReadWrite) - }) -} From 72c61002aa6effd0c1c3cb1a6b7b4fe00629f3e7 Mon Sep 17 00:00:00 2001 From: alexvanin Date: Fri, 3 Apr 2020 10:30:48 +0300 Subject: [PATCH 0127/1196] Update changelog for v0.6.0 --- CHANGELOG.md | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 02254ab..1e9d098 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,16 @@ # Changelog -This is the changelog for NeoFS API +This is the changelog for NeoFS-API-Go + +## [0.6.0] - 2020-04-03 + +### Added + +- `RequestType` for object service requests +- `Type()` function in `Request` interface + +### Changed + +- Synced proto files with `neofs-api v0.6.0` ## [0.5.0] - 2020-03-31 @@ -217,3 +228,4 @@ Initial public release [0.4.1]: https://github.com/nspcc-dev/neofs-api-go/compare/v0.4.0...v0.4.1 [0.4.2]: https://github.com/nspcc-dev/neofs-api-go/compare/v0.4.1...v0.4.2 [0.5.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v0.4.2...v0.5.0 +[0.6.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v0.5.0...v0.6.0 From e999110be1955e941932943e772cf22d62929513 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 3 Apr 2020 18:23:24 +0300 Subject: [PATCH 0128/1196] object: prevent potential NPE panic in PutRequest.CID method --- object/service.go | 4 +++- object/service_test.go | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/object/service.go b/object/service.go index 3a2ca08..ab3bf5f 100644 --- a/object/service.go +++ b/object/service.go @@ -127,7 +127,9 @@ func (m *PutRequest) NotFull() bool { return checkIsNotFull(m) } // CID returns container id value from object put request. func (m *PutRequest) CID() CID { if header := m.GetHeader(); header != nil { - return header.Object.SystemHeader.CID + if obj := header.GetObject(); obj != nil { + return obj.SystemHeader.CID + } } return refs.CID{} } diff --git a/object/service_test.go b/object/service_test.go index 46213e2..f38e2ed 100644 --- a/object/service_test.go +++ b/object/service_test.go @@ -16,6 +16,7 @@ func TestRequest(t *testing.T) { &DeleteRequest{}, &GetRangeRequest{}, &GetRangeHashRequest{}, + MakePutRequestHeader(nil, nil), } types := []RequestType{ @@ -26,6 +27,7 @@ func TestRequest(t *testing.T) { RequestDelete, RequestRange, RequestRangeHash, + RequestPut, } for i := range cases { From 67bb8cbcf8aec47961d3045f85e195265778614f Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Thu, 9 Apr 2020 19:20:40 +0300 Subject: [PATCH 0129/1196] change license --- LICENSE | 201 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 201 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..261eeb9 --- /dev/null +++ b/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. From 4c11cca7da105365829ea433576be78c42c3e3cb Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Thu, 9 Apr 2020 19:21:26 +0300 Subject: [PATCH 0130/1196] remove old license --- LICENSE.md | 675 ----------------------------------------------------- 1 file changed, 675 deletions(-) delete mode 100644 LICENSE.md diff --git a/LICENSE.md b/LICENSE.md deleted file mode 100644 index 5c13ba2..0000000 --- a/LICENSE.md +++ /dev/null @@ -1,675 +0,0 @@ -### GNU GENERAL PUBLIC LICENSE - -Version 3, 29 June 2007 - -Copyright (C) 2007 Free Software Foundation, Inc. - - -Everyone is permitted to copy and distribute verbatim copies of this -license document, but changing it is not allowed. - -### Preamble - -The GNU General Public License is a free, copyleft license for -software and other kinds of works. - -The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom -to share and change all versions of a program--to make sure it remains -free software for all its users. We, the Free Software Foundation, use -the GNU General Public License for most of our software; it applies -also to any other work released this way by its authors. You can apply -it to your programs, too. - -When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - -To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you -have certain responsibilities if you distribute copies of the -software, or if you modify it: responsibilities to respect the freedom -of others. - -For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - -Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - -For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - -Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the -manufacturer can do so. This is fundamentally incompatible with the -aim of protecting users' freedom to change the software. The -systematic pattern of such abuse occurs in the area of products for -individuals to use, which is precisely where it is most unacceptable. -Therefore, we have designed this version of the GPL to prohibit the -practice for those products. If such problems arise substantially in -other domains, we stand ready to extend this provision to those -domains in future versions of the GPL, as needed to protect the -freedom of users. - -Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish -to avoid the special danger that patents applied to a free program -could make it effectively proprietary. To prevent this, the GPL -assures that patents cannot be used to render the program non-free. - -The precise terms and conditions for copying, distribution and -modification follow. - -### TERMS AND CONDITIONS - -#### 0. Definitions. - -"This License" refers to version 3 of the GNU General Public License. - -"Copyright" also means copyright-like laws that apply to other kinds -of works, such as semiconductor masks. - -"The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - -To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of -an exact copy. The resulting work is called a "modified version" of -the earlier work or a work "based on" the earlier work. - -A "covered work" means either the unmodified Program or a work based -on the Program. - -To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - -To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user -through a computer network, with no transfer of a copy, is not -conveying. - -An interactive user interface displays "Appropriate Legal Notices" to -the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - -#### 1. Source Code. - -The "source code" for a work means the preferred form of the work for -making modifications to it. "Object code" means any non-source form of -a work. - -A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - -The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - -The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - -The Corresponding Source need not include anything that users can -regenerate automatically from other parts of the Corresponding Source. - -The Corresponding Source for a work in source code form is that same -work. - -#### 2. Basic Permissions. - -All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - -You may make, run and propagate covered works that you do not convey, -without conditions so long as your license otherwise remains in force. -You may convey covered works to others for the sole purpose of having -them make modifications exclusively for you, or provide you with -facilities for running those works, provided that you comply with the -terms of this License in conveying all material for which you do not -control copyright. Those thus making or running the covered works for -you must do so exclusively on your behalf, under your direction and -control, on terms that prohibit them from making any copies of your -copyrighted material outside their relationship with you. - -Conveying under any other circumstances is permitted solely under the -conditions stated below. Sublicensing is not allowed; section 10 makes -it unnecessary. - -#### 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - -No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - -When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such -circumvention is effected by exercising rights under this License with -respect to the covered work, and you disclaim any intention to limit -operation or modification of the work as a means of enforcing, against -the work's users, your or third parties' legal rights to forbid -circumvention of technological measures. - -#### 4. Conveying Verbatim Copies. - -You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - -You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - -#### 5. Conveying Modified Source Versions. - -You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these -conditions: - -- a) The work must carry prominent notices stating that you modified -it, and giving a relevant date. -- b) The work must carry prominent notices stating that it is -released under this License and any conditions added under -section 7. This requirement modifies the requirement in section 4 -to "keep intact all notices". -- c) You must license the entire work, as a whole, under this -License to anyone who comes into possession of a copy. This -License will therefore apply, along with any applicable section 7 -additional terms, to the whole of the work, and all its parts, -regardless of how they are packaged. This License gives no -permission to license the work in any other way, but it does not -invalidate such permission if you have separately received it. -- d) If the work has interactive user interfaces, each must display -Appropriate Legal Notices; however, if the Program has interactive -interfaces that do not display Appropriate Legal Notices, your -work need not make them do so. - -A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - -#### 6. Conveying Non-Source Forms. - -You may convey a covered work in object code form under the terms of -sections 4 and 5, provided that you also convey the machine-readable -Corresponding Source under the terms of this License, in one of these -ways: - -- a) Convey the object code in, or embodied in, a physical product -(including a physical distribution medium), accompanied by the -Corresponding Source fixed on a durable physical medium -customarily used for software interchange. -- b) Convey the object code in, or embodied in, a physical product -(including a physical distribution medium), accompanied by a -written offer, valid for at least three years and valid for as -long as you offer spare parts or customer support for that product -model, to give anyone who possesses the object code either (1) a -copy of the Corresponding Source for all the software in the -product that is covered by this License, on a durable physical -medium customarily used for software interchange, for a price no -more than your reasonable cost of physically performing this -conveying of source, or (2) access to copy the Corresponding -Source from a network server at no charge. -- c) Convey individual copies of the object code with a copy of the -written offer to provide the Corresponding Source. This -alternative is allowed only occasionally and noncommercially, and -only if you received the object code with such an offer, in accord -with subsection 6b. -- d) Convey the object code by offering access from a designated -place (gratis or for a charge), and offer equivalent access to the -Corresponding Source in the same way through the same place at no -further charge. You need not require recipients to copy the -Corresponding Source along with the object code. If the place to -copy the object code is a network server, the Corresponding Source -may be on a different server (operated by you or a third party) -that supports equivalent copying facilities, provided you maintain -clear directions next to the object code saying where to find the -Corresponding Source. Regardless of what server hosts the -Corresponding Source, you remain obligated to ensure that it is -available for as long as needed to satisfy these requirements. -- e) Convey the object code using peer-to-peer transmission, -provided you inform other peers where the object code and -Corresponding Source of the work are being offered to the general -public at no charge under subsection 6d. - -A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - -A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, -family, or household purposes, or (2) anything designed or sold for -incorporation into a dwelling. In determining whether a product is a -consumer product, doubtful cases shall be resolved in favor of -coverage. For a particular product received by a particular user, -"normally used" refers to a typical or common use of that class of -product, regardless of the status of the particular user or of the way -in which the particular user actually uses, or expects or is expected -to use, the product. A product is a consumer product regardless of -whether the product has substantial commercial, industrial or -non-consumer uses, unless such uses represent the only significant -mode of use of the product. - -"Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to -install and execute modified versions of a covered work in that User -Product from a modified version of its Corresponding Source. The -information must suffice to ensure that the continued functioning of -the modified object code is in no case prevented or interfered with -solely because modification has been made. - -If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - -The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or -updates for a work that has been modified or installed by the -recipient, or for the User Product in which it has been modified or -installed. Access to a network may be denied when the modification -itself materially and adversely affects the operation of the network -or violates the rules and protocols for communication across the -network. - -Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - -#### 7. Additional Terms. - -"Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - -When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - -Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders -of that material) supplement the terms of this License with terms: - -- a) Disclaiming warranty or limiting liability differently from the -terms of sections 15 and 16 of this License; or -- b) Requiring preservation of specified reasonable legal notices or -author attributions in that material or in the Appropriate Legal -Notices displayed by works containing it; or -- c) Prohibiting misrepresentation of the origin of that material, -or requiring that modified versions of such material be marked in -reasonable ways as different from the original version; or -- d) Limiting the use for publicity purposes of names of licensors -or authors of the material; or -- e) Declining to grant rights under trademark law for use of some -trade names, trademarks, or service marks; or -- f) Requiring indemnification of licensors and authors of that -material by anyone who conveys the material (or modified versions -of it) with contractual assumptions of liability to the recipient, -for any liability that these contractual assumptions directly -impose on those licensors and authors. - -All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - -If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - -Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; the -above requirements apply either way. - -#### 8. Termination. - -You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - -However, if you cease all violation of this License, then your license -from a particular copyright holder is reinstated (a) provisionally, -unless and until the copyright holder explicitly and finally -terminates your license, and (b) permanently, if the copyright holder -fails to notify you of the violation by some reasonable means prior to -60 days after the cessation. - -Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - -Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - -#### 9. Acceptance Not Required for Having Copies. - -You are not required to accept this License in order to receive or run -a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - -#### 10. Automatic Licensing of Downstream Recipients. - -Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - -An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - -You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - -#### 11. Patents. - -A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - -A contributor's "essential patent claims" are all patent claims owned -or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - -Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - -In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - -If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - -If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - -A patent license is "discriminatory" if it does not include within the -scope of its coverage, prohibits the exercise of, or is conditioned on -the non-exercise of one or more of the rights that are specifically -granted under this License. You may not convey a covered work if you -are a party to an arrangement with a third party that is in the -business of distributing software, under which you make payment to the -third party based on the extent of your activity of conveying the -work, and under which the third party grants, to any of the parties -who would receive the covered work from you, a discriminatory patent -license (a) in connection with copies of the covered work conveyed by -you (or copies made from those copies), or (b) primarily for and in -connection with specific products or compilations that contain the -covered work, unless you entered into that arrangement, or that patent -license was granted, prior to 28 March 2007. - -Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - -#### 12. No Surrender of Others' Freedom. - -If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under -this License and any other pertinent obligations, then as a -consequence you may not convey it at all. For example, if you agree to -terms that obligate you to collect a royalty for further conveying -from those to whom you convey the Program, the only way you could -satisfy both those terms and this License would be to refrain entirely -from conveying the Program. - -#### 13. Use with the GNU Affero General Public License. - -Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - -#### 14. Revised Versions of this License. - -The Free Software Foundation may publish revised and/or new versions -of the GNU General Public License from time to time. Such new versions -will be similar in spirit to the present version, but may differ in -detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies that a certain numbered version of the GNU General Public -License "or any later version" applies to it, you have the option of -following the terms and conditions either of that numbered version or -of any later version published by the Free Software Foundation. If the -Program does not specify a version number of the GNU General Public -License, you may choose any version ever published by the Free -Software Foundation. - -If the Program specifies that a proxy can decide which future versions -of the GNU General Public License can be used, that proxy's public -statement of acceptance of a version permanently authorizes you to -choose that version for the Program. - -Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - -#### 15. Disclaimer of Warranty. - -THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT -WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND -PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE -DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR -CORRECTION. - -#### 16. Limitation of Liability. - -IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR -CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES -ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT -NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR -LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM -TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER -PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - -#### 17. Interpretation of Sections 15 and 16. - -If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - -END OF TERMS AND CONDITIONS - -### How to Apply These Terms to Your New Programs - -If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these -terms. - -To do so, attach the following notices to the program. It is safest to -attach them to the start of each source file to most effectively state -the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - -Copyright (C) - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . - -Also add information on how to contact you by electronic and paper -mail. - -If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - Copyright (C) -This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands \`show w' and \`show c' should show the -appropriate parts of the General Public License. Of course, your -program's commands might be different; for a GUI interface, you would -use an "about box". - -You should also get your employer (if you work as a programmer) or -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. For more information on this, and how to apply and follow -the GNU GPL, see . - -The GNU General Public License does not permit incorporating your -program into proprietary programs. If your program is a subroutine -library, you may consider it more useful to permit linking proprietary -applications with the library. If this is what you want to do, use the -GNU Lesser General Public License instead of this License. But first, -please read . \ No newline at end of file From 87e38ff220fc2768954161323123d88a985375f1 Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Fri, 10 Apr 2020 09:00:37 +0300 Subject: [PATCH 0131/1196] update license in readme --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 8820d58..fac04d0 100644 --- a/README.md +++ b/README.md @@ -132,5 +132,6 @@ At this moment, we do not accept contributions. ## License -This project is licensed under the GPLv3 License - -see the [LICENSE.md](LICENSE.md) file for details +This project is licensed under the Apache 2.0 License - +see the [LICENSE](LICENSE) file for details + From 590eb4ea7ed6e352867dc901bef8e9f0326a4746 Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Fri, 10 Apr 2020 09:53:00 +0300 Subject: [PATCH 0132/1196] CHANGELOG --- CHANGELOG.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1e9d098..700ffcc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,17 @@ # Changelog This is the changelog for NeoFS-API-Go +## [0.6.1] - 2020-04-10 + +### Changed + +- License changed to Apache 2.0 + +### Fixed + +- NPE in PutRequest.CID() + + ## [0.6.0] - 2020-04-03 ### Added @@ -229,3 +240,4 @@ Initial public release [0.4.2]: https://github.com/nspcc-dev/neofs-api-go/compare/v0.4.1...v0.4.2 [0.5.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v0.4.2...v0.5.0 [0.6.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v0.5.0...v0.6.0 +[0.6.1]: https://github.com/nspcc-dev/neofs-api-go/compare/v0.6.0...v0.6.1 From acfb16d36362a9e6f4eba315beed7babc898128e Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Fri, 10 Apr 2020 11:30:45 +0300 Subject: [PATCH 0133/1196] added test case for exists object in put request --- object/service.go | 13 +++++++------ object/service_test.go | 4 +++- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/object/service.go b/object/service.go index ab3bf5f..45a8d4b 100644 --- a/object/service.go +++ b/object/service.go @@ -125,13 +125,14 @@ func (m *GetResponse) NotFull() bool { return checkIsNotFull(m) } func (m *PutRequest) NotFull() bool { return checkIsNotFull(m) } // CID returns container id value from object put request. -func (m *PutRequest) CID() CID { - if header := m.GetHeader(); header != nil { - if obj := header.GetObject(); obj != nil { - return obj.SystemHeader.CID - } +func (m *PutRequest) CID() (cid CID) { + if header := m.GetHeader(); header == nil { + return + } else if obj := header.GetObject(); obj == nil { + return + } else { + return obj.SystemHeader.CID } - return refs.CID{} } // CID returns container id value from object get request. diff --git a/object/service_test.go b/object/service_test.go index f38e2ed..4b02b37 100644 --- a/object/service_test.go +++ b/object/service_test.go @@ -17,6 +17,7 @@ func TestRequest(t *testing.T) { &GetRangeRequest{}, &GetRangeHashRequest{}, MakePutRequestHeader(nil, nil), + MakePutRequestHeader(&Object{}, nil), } types := []RequestType{ @@ -28,12 +29,13 @@ func TestRequest(t *testing.T) { RequestRange, RequestRangeHash, RequestPut, + RequestPut, } for i := range cases { v := cases[i] - t.Run(fmt.Sprintf("%T", v), func(t *testing.T) { + t.Run(fmt.Sprintf("%T_%d", v, i), func(t *testing.T) { require.NotPanics(t, func() { v.CID() }) require.Equal(t, types[i], v.Type()) }) From 4cdd71161d2a6efedb97070dc1b625cac1701a6d Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Thu, 16 Apr 2020 11:30:40 +0300 Subject: [PATCH 0134/1196] update to neofs-api v0.6.1 --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 9b02a6e..2102b78 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -PROTO_VERSION=v0.6.0 +PROTO_VERSION=v0.6.1 PROTO_URL=https://github.com/nspcc-dev/neofs-api/archive/$(PROTO_VERSION).tar.gz B=\033[0;1m From 32c660b71c7dbf4e5fa282c63cb0af328de6c6b2 Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Thu, 16 Apr 2020 11:31:09 +0300 Subject: [PATCH 0135/1196] proto: regenerate files --- bootstrap/service.pb.go | 121 ++++++++++++++++++++++++++++++++-------- bootstrap/service.proto | 12 ++++ 2 files changed, 109 insertions(+), 24 deletions(-) diff --git a/bootstrap/service.pb.go b/bootstrap/service.pb.go index d1797cc..50e6c67 100644 --- a/bootstrap/service.pb.go +++ b/bootstrap/service.pb.go @@ -28,11 +28,45 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +// Node state +type Request_State int32 + +const ( + // used by default + Request_Unknown Request_State = 0 + // used to inform that node online + Request_Online Request_State = 1 + // used to inform that node offline + Request_Offline Request_State = 2 +) + +var Request_State_name = map[int32]string{ + 0: "Unknown", + 1: "Online", + 2: "Offline", +} + +var Request_State_value = map[string]int32{ + "Unknown": 0, + "Online": 1, + "Offline": 2, +} + +func (x Request_State) String() string { + return proto.EnumName(Request_State_name, int32(x)) +} + +func (Request_State) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_21bce759c9d8eb63, []int{0, 0} +} + type Request struct { // Type is NodeType, can be InnerRingNode (type=1) or StorageNode (type=2) Type NodeType `protobuf:"varint,1,opt,name=type,proto3,customtype=NodeType" json:"type"` // Info contains information about node Info NodeInfo `protobuf:"bytes,2,opt,name=info,proto3" json:"info"` + // State contains node status + State Request_State `protobuf:"varint,3,opt,name=state,proto3,enum=bootstrap.Request_State" json:"state,omitempty"` // RequestMetaHeader contains information about request meta headers (should be embedded into message) service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) @@ -78,37 +112,49 @@ func (m *Request) GetInfo() NodeInfo { return NodeInfo{} } +func (m *Request) GetState() Request_State { + if m != nil { + return m.State + } + return Request_Unknown +} + func init() { + proto.RegisterEnum("bootstrap.Request_State", Request_State_name, Request_State_value) proto.RegisterType((*Request)(nil), "bootstrap.Request") } func init() { proto.RegisterFile("bootstrap/service.proto", fileDescriptor_21bce759c9d8eb63) } var fileDescriptor_21bce759c9d8eb63 = []byte{ - // 364 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x51, 0xbf, 0x6e, 0x9b, 0x40, - 0x18, 0xf7, 0x59, 0xd4, 0x7f, 0xae, 0xdb, 0xd9, 0x55, 0x11, 0x03, 0x58, 0x9e, 0x2c, 0xb5, 0x80, - 0x64, 0x2f, 0x1d, 0x5b, 0x54, 0x55, 0xf5, 0x60, 0xcb, 0xc2, 0x55, 0x23, 0x65, 0x3b, 0xe0, 0x83, - 0x30, 0x98, 0xbb, 0x70, 0x67, 0x4b, 0x7e, 0x93, 0x3c, 0x43, 0x9e, 0xc4, 0xa3, 0xc7, 0x28, 0x03, - 0x8a, 0x88, 0x94, 0xe7, 0x88, 0x38, 0x63, 0x62, 0x25, 0x13, 0x7c, 0xbf, 0x7f, 0xf7, 0xbb, 0xef, - 0xf0, 0xd7, 0x80, 0x31, 0x29, 0x64, 0x4e, 0xb9, 0x2b, 0x20, 0xdf, 0xa5, 0x21, 0x38, 0x3c, 0x67, - 0x92, 0x91, 0x7e, 0x43, 0x18, 0xa4, 0x66, 0xdc, 0x0d, 0x48, 0x7a, 0xa2, 0x8d, 0xe1, 0x19, 0xdb, - 0x41, 0x9e, 0xc6, 0xfb, 0x1a, 0xfd, 0xf2, 0x96, 0x26, 0xf7, 0x1c, 0x44, 0x0d, 0xdb, 0x49, 0x2a, - 0x6f, 0xb6, 0x81, 0x13, 0xb2, 0x8d, 0x9b, 0xb0, 0x84, 0xb9, 0x0a, 0x0e, 0xb6, 0xb1, 0x9a, 0xd4, - 0xa0, 0xfe, 0x4e, 0xf2, 0xf1, 0x0b, 0xc2, 0x5d, 0x1f, 0x6e, 0xb7, 0x20, 0x24, 0xf9, 0x8e, 0xb5, - 0x2a, 0x49, 0x47, 0x23, 0x34, 0xf9, 0xe4, 0xe9, 0x87, 0xc2, 0x6a, 0x3d, 0x16, 0x56, 0x6f, 0xc9, - 0x22, 0xf8, 0xb7, 0xe7, 0x50, 0x16, 0x96, 0x56, 0x7d, 0x7d, 0xa5, 0x22, 0x36, 0xd6, 0xd2, 0x2c, - 0x66, 0x7a, 0x7b, 0x84, 0x26, 0x9f, 0xa7, 0x03, 0xa7, 0xa9, 0xe3, 0x54, 0x86, 0x79, 0x16, 0x33, - 0x4f, 0xab, 0x22, 0x7c, 0x25, 0x23, 0x3f, 0xb0, 0xb6, 0x00, 0x49, 0xf5, 0x40, 0xc9, 0x0d, 0xe7, - 0xbc, 0x81, 0xfa, 0xf0, 0x8a, 0xfb, 0x0b, 0x34, 0x82, 0xdc, 0xeb, 0x55, 0xae, 0x63, 0x61, 0x21, - 0x5f, 0x39, 0xc8, 0x6f, 0xdc, 0xf9, 0xaf, 0x2e, 0xae, 0x87, 0xca, 0x3b, 0x7e, 0xef, 0x55, 0x6c, - 0x1a, 0x52, 0x99, 0xb2, 0xec, 0x43, 0x46, 0xed, 0x9d, 0xfe, 0xc4, 0x7d, 0xef, 0xdc, 0x90, 0xcc, - 0x70, 0x77, 0x95, 0xb3, 0x10, 0x84, 0x20, 0xe4, 0xa2, 0x78, 0x9d, 0x67, 0x0c, 0x2f, 0xb0, 0x35, - 0xcf, 0x81, 0x46, 0x0b, 0xca, 0xbd, 0xab, 0x43, 0x69, 0xa2, 0x63, 0x69, 0xa2, 0x87, 0xd2, 0x44, - 0x4f, 0xa5, 0x89, 0xee, 0x9e, 0xcd, 0xd6, 0xf5, 0xb7, 0x8b, 0x7d, 0x67, 0x82, 0x87, 0xa1, 0x1d, - 0xc1, 0xce, 0xcd, 0x80, 0xc5, 0xc2, 0xa6, 0x3c, 0xb5, 0x13, 0xe6, 0x36, 0x61, 0xf7, 0xed, 0xc1, - 0x12, 0xd8, 0x9f, 0xb5, 0xf3, 0x6b, 0x35, 0x77, 0x9a, 0x36, 0x41, 0x47, 0x3d, 0xc5, 0xec, 0x35, - 0x00, 0x00, 0xff, 0xff, 0xc7, 0x01, 0xac, 0x62, 0x20, 0x02, 0x00, 0x00, + // 420 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x51, 0x4d, 0x8b, 0xd3, 0x40, + 0x18, 0xee, 0xd4, 0xb4, 0xdd, 0x9d, 0x05, 0x59, 0x66, 0x57, 0x0c, 0x3d, 0xa4, 0xa5, 0xa7, 0x82, + 0x66, 0x02, 0xdd, 0x8b, 0x47, 0x0d, 0x22, 0xee, 0x61, 0x3f, 0x48, 0xfd, 0x00, 0x6f, 0x93, 0xf4, + 0x4d, 0x1d, 0x74, 0xe7, 0x1d, 0x33, 0xd3, 0x4a, 0xff, 0x89, 0xbf, 0xc1, 0xff, 0x21, 0xec, 0x71, + 0x8f, 0xe2, 0xa1, 0x48, 0xfc, 0x23, 0x32, 0xd3, 0xb4, 0x16, 0xf7, 0x94, 0xbc, 0xcf, 0xd7, 0xbc, + 0x1f, 0xf4, 0x71, 0x8e, 0x68, 0x8d, 0xad, 0x84, 0x4e, 0x0c, 0x54, 0x4b, 0x59, 0x00, 0xd7, 0x15, + 0x5a, 0x64, 0x87, 0x3b, 0xa2, 0xcf, 0x1a, 0x26, 0xb9, 0x01, 0x2b, 0x36, 0x74, 0xff, 0x74, 0x8b, + 0x2d, 0xa1, 0x92, 0xe5, 0xaa, 0x41, 0x1f, 0xfd, 0x4b, 0xb3, 0x2b, 0x0d, 0xa6, 0x81, 0xe3, 0xb9, + 0xb4, 0x1f, 0x17, 0x39, 0x2f, 0xf0, 0x26, 0x99, 0xe3, 0x1c, 0x13, 0x0f, 0xe7, 0x8b, 0xd2, 0x57, + 0xbe, 0xf0, 0x7f, 0x1b, 0xf9, 0xe8, 0x47, 0x9b, 0xf6, 0x32, 0xf8, 0xb2, 0x00, 0x63, 0xd9, 0x53, + 0x1a, 0xb8, 0xa4, 0x90, 0x0c, 0xc9, 0xb8, 0x93, 0x86, 0xb7, 0xeb, 0x41, 0xeb, 0xd7, 0x7a, 0x70, + 0x70, 0x89, 0x33, 0x78, 0xb3, 0xd2, 0x50, 0xaf, 0x07, 0x81, 0xfb, 0x66, 0x5e, 0xc5, 0x62, 0x1a, + 0x48, 0x55, 0x62, 0xd8, 0x1e, 0x92, 0xf1, 0xd1, 0xe4, 0x84, 0xef, 0xda, 0xe1, 0xce, 0x70, 0xae, + 0x4a, 0x4c, 0x03, 0x17, 0x91, 0x79, 0x19, 0xe3, 0xb4, 0x63, 0xac, 0xb0, 0x10, 0x3e, 0x18, 0x92, + 0xf1, 0xc3, 0x49, 0xb8, 0xa7, 0x6f, 0xde, 0xe7, 0x53, 0xc7, 0x67, 0x1b, 0x19, 0x7b, 0x46, 0x83, + 0x0b, 0xb0, 0x22, 0xcc, 0x7d, 0x7c, 0x9f, 0x6f, 0x37, 0xd6, 0x88, 0x1d, 0xf7, 0x1a, 0xc4, 0x0c, + 0xaa, 0xf4, 0xc0, 0xbd, 0x72, 0xb7, 0x1e, 0x90, 0xcc, 0x3b, 0xd8, 0x4b, 0xda, 0x7d, 0xe7, 0x17, + 0x15, 0x16, 0xde, 0x3b, 0xfa, 0xdf, 0xeb, 0x59, 0x59, 0x08, 0x2b, 0x51, 0xdd, 0xcb, 0x68, 0xbc, + 0xa3, 0x98, 0x76, 0x7c, 0x3f, 0xec, 0x88, 0xf6, 0xde, 0xaa, 0x4f, 0x0a, 0xbf, 0xaa, 0xe3, 0x16, + 0xa3, 0xb4, 0x7b, 0xa5, 0x3e, 0x4b, 0x05, 0xc7, 0xc4, 0x11, 0x57, 0x65, 0xe9, 0x8b, 0xf6, 0xe4, + 0x39, 0x3d, 0x4c, 0xb7, 0x03, 0xb1, 0x33, 0xda, 0xbb, 0xae, 0xb0, 0x00, 0x63, 0x18, 0xbb, 0x3f, + 0x67, 0xff, 0x74, 0x0f, 0x9b, 0xea, 0x0a, 0xc4, 0xec, 0x42, 0xe8, 0xf4, 0xfd, 0x6d, 0x1d, 0x91, + 0xbb, 0x3a, 0x22, 0x3f, 0xeb, 0x88, 0xfc, 0xae, 0x23, 0xf2, 0xed, 0x4f, 0xd4, 0xfa, 0xf0, 0x64, + 0xef, 0x9c, 0xca, 0xe8, 0xa2, 0x88, 0x67, 0xb0, 0x4c, 0x14, 0x60, 0x69, 0x62, 0xa1, 0x65, 0x3c, + 0xc7, 0x64, 0x17, 0xf6, 0xbd, 0x7d, 0x72, 0x09, 0xf8, 0x6a, 0xca, 0x5f, 0x5c, 0x9f, 0xf3, 0x5d, + 0x37, 0x79, 0xd7, 0x5f, 0xfa, 0xec, 0x6f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x74, 0xc6, 0xb6, 0xb6, + 0x7f, 0x02, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -241,6 +287,11 @@ func (m *Request) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x6 i-- dAtA[i] = 0x92 + if m.State != 0 { + i = encodeVarintService(dAtA, i, uint64(m.State)) + i-- + dAtA[i] = 0x18 + } { size, err := m.Info.MarshalToSizedBuffer(dAtA[:i]) if err != nil { @@ -281,6 +332,9 @@ func (m *Request) Size() (n int) { } l = m.Info.Size() n += 1 + l + sovService(uint64(l)) + if m.State != 0 { + n += 1 + sovService(uint64(m.State)) + } l = m.RequestMetaHeader.Size() n += 2 + l + sovService(uint64(l)) l = m.RequestVerificationHeader.Size() @@ -378,6 +432,25 @@ func (m *Request) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field State", wireType) + } + m.State = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.State |= Request_State(b&0x7F) << shift + if b < 0x80 { + break + } + } case 98: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType) diff --git a/bootstrap/service.proto b/bootstrap/service.proto index e37c878..6918bef 100644 --- a/bootstrap/service.proto +++ b/bootstrap/service.proto @@ -19,10 +19,22 @@ service Bootstrap { } message Request { + // Node state + enum State { + // used by default + Unknown = 0; + // used to inform that node online + Online = 1; + // used to inform that node offline + Offline = 2; + } + // Type is NodeType, can be InnerRingNode (type=1) or StorageNode (type=2) int32 type = 1 [(gogoproto.customname) = "Type" , (gogoproto.nullable) = false, (gogoproto.customtype) = "NodeType"]; // Info contains information about node bootstrap.NodeInfo info = 2 [(gogoproto.nullable) = false]; + // State contains node status + State state = 3; // RequestMetaHeader contains information about request meta headers (should be embedded into message) service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) From 51e476f651e22b8ad20c9b4db6a6dee9d382e85b Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Thu, 16 Apr 2020 11:31:24 +0300 Subject: [PATCH 0136/1196] docs: regenerate files --- docs/bootstrap.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/docs/bootstrap.md b/docs/bootstrap.md index 737e085..80aa109 100644 --- a/docs/bootstrap.md +++ b/docs/bootstrap.md @@ -62,11 +62,25 @@ Process is method that allows to register node in the network and receive actual | ----- | ---- | ----- | ----------- | | type | [int32](#int32) | | Type is NodeType, can be InnerRingNode (type=1) or StorageNode (type=2) | | info | [NodeInfo](#bootstrap.NodeInfo) | | Info contains information about node | +| state | [Request.State](#bootstrap.Request.State) | | State contains node status | | Meta | [service.RequestMetaHeader](#service.RequestMetaHeader) | | RequestMetaHeader contains information about request meta headers (should be embedded into message) | | Verify | [service.RequestVerificationHeader](#service.RequestVerificationHeader) | | RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) | + + + +### Request.State +Node state + +| Name | Number | Description | +| ---- | ------ | ----------- | +| Unknown | 0 | used by default | +| Online | 1 | used to inform that node online | +| Offline | 2 | used to inform that node offline | + + From 5d9feea76a1d7ab88f96ed46d2d8dc50d17639fc Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Thu, 16 Apr 2020 11:35:12 +0300 Subject: [PATCH 0137/1196] fix format --- object/types.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/object/types.go b/object/types.go index cde1f25..aebb2fc 100644 --- a/object/types.go +++ b/object/types.go @@ -31,7 +31,7 @@ type ( // RequestType of the object service requests. RequestType int - headerType int + headerType int ) const ( From 9b24ba95d4d522a3cadd407a4dd322ff393bbec7 Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Thu, 16 Apr 2020 11:41:40 +0300 Subject: [PATCH 0138/1196] modules: update dependencies --- go.mod | 10 +++++----- go.sum | 32 +++++++++++++++++++++++++------- 2 files changed, 30 insertions(+), 12 deletions(-) diff --git a/go.mod b/go.mod index 50c24ad..5ddf1f0 100644 --- a/go.mod +++ b/go.mod @@ -4,19 +4,19 @@ go 1.14 require ( github.com/gogo/protobuf v1.3.1 - github.com/golang/protobuf v1.3.3 + github.com/golang/protobuf v1.4.0 github.com/google/uuid v1.1.1 github.com/mr-tron/base58 v1.1.3 github.com/nspcc-dev/neofs-crypto v0.3.0 - github.com/nspcc-dev/netmap v1.6.1 + github.com/nspcc-dev/netmap v1.7.0 github.com/nspcc-dev/tzhash v1.4.0 github.com/pkg/errors v0.9.1 - github.com/prometheus/client_golang v1.4.1 + github.com/prometheus/client_golang v1.5.1 github.com/prometheus/client_model v0.2.0 github.com/spf13/viper v1.6.2 - github.com/stretchr/testify v1.4.0 + github.com/stretchr/testify v1.5.1 golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550 - google.golang.org/grpc v1.27.1 + google.golang.org/grpc v1.28.1 ) // Used for debug reasons diff --git a/go.sum b/go.sum index 92bb732..a9ca4af 100644 --- a/go.sum +++ b/go.sum @@ -23,6 +23,7 @@ github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XL github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= @@ -34,7 +35,8 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= -github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/flynn-archive/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:rZfgFAXFS/z/lEd6LJmf9HVZ1LkgYiHx5pHhV5DR16M= @@ -61,8 +63,15 @@ github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.3 h1:gyjaxf+svBWX08ZjK86iN9geUJF0H6gp2IRKX6Nf6/I= github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= +github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= +github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= +github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0 h1:oOuy+ugB+P/kBdUnG5QaMXSIyJ1q38wWSojYCb3z5VQ= +github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= @@ -114,8 +123,8 @@ github.com/nspcc-dev/hrw v1.0.8 h1:vwRuJXZXgkMvf473vFzeWGCfY1WBVeSHAEHvR4u3/Cg= github.com/nspcc-dev/hrw v1.0.8/go.mod h1:l/W2vx83vMQo6aStyx2AuZrJ+07lGv2JQGlVkPG06MU= github.com/nspcc-dev/neofs-crypto v0.3.0 h1:zlr3pgoxuzrmGCxc5W8dGVfA9Rro8diFvVnBg0L4ifM= github.com/nspcc-dev/neofs-crypto v0.3.0/go.mod h1:8w16GEJbH6791ktVqHN9YRNH3s9BEEKYxGhlFnp0cDw= -github.com/nspcc-dev/netmap v1.6.1 h1:Pigqpqi6QSdRiusbq5XlO20A18k6Eyu7j9MzOfAE3CM= -github.com/nspcc-dev/netmap v1.6.1/go.mod h1:mhV3UOg9ljQmu0teQShD6+JYX09XY5gu2I4hIByCH9M= +github.com/nspcc-dev/netmap v1.7.0 h1:ak64xn/gPdgYw4tsqSSF7kAGQGbEpeuJEF3XwBX4L9Y= +github.com/nspcc-dev/netmap v1.7.0/go.mod h1:mhV3UOg9ljQmu0teQShD6+JYX09XY5gu2I4hIByCH9M= github.com/nspcc-dev/rfc6979 v0.2.0 h1:3e1WNxrN60/6N0DW7+UYisLeZJyfqZTNOjeV/toYvOE= github.com/nspcc-dev/rfc6979 v0.2.0/go.mod h1:exhIh1PdpDC5vQmyEsGvc4YDM/lyQp/452QxGq/UEso= github.com/nspcc-dev/tzhash v1.4.0 h1:RVIR+mxOBHl58CE99+DXtE31ylD5PEkZSoWqoj4fVjg= @@ -133,8 +142,8 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= -github.com/prometheus/client_golang v1.4.1 h1:FFSuS004yOQEtDdTq+TAOLP5xUq63KqAFYyOi8zA+Y8= -github.com/prometheus/client_golang v1.4.1/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= +github.com/prometheus/client_golang v1.5.1 h1:bdHYieyGlH+6OLEk2YQha8THib30KP0/yD0YH9m6xcA= +github.com/prometheus/client_golang v1.5.1/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4 h1:gQz4mCbXsO+nc9n1hCxHcGA3Zx3Eo+UHZoInFGUIXNM= @@ -179,6 +188,8 @@ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXf github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4= +github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= @@ -247,8 +258,15 @@ google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98 google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.27.1 h1:zvIju4sqAGvwKspUQOhwnpcqSbzi7/H6QomNNjTL4sk= -google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= +google.golang.org/grpc v1.28.1 h1:C1QC6KzgSiLyBabDi87BbjaGreoRgGUF5nOyvfrAZ1k= +google.golang.org/grpc v1.28.1/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= +google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= +google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.21.0 h1:qdOKuR/EIArgaWNjetjgTzgVTAZ+S/WXVrq9HW9zimw= +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= gopkg.in/abiosoft/ishell.v2 v2.0.0/go.mod h1:sFp+cGtH6o4s1FtpVPTMcHq2yue+c4DGOVohJCPUzwY= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= From 0bf293340bf4ccd630b77b012cdb7ee8bca16934 Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Thu, 16 Apr 2020 11:53:34 +0300 Subject: [PATCH 0139/1196] CHANGELOG --- CHANGELOG.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 700ffcc..a51d80f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,20 @@ # Changelog This is the changelog for NeoFS-API-Go +## [0.6.2] - 2020-04-16 + +### Updated +- NeoFS API v0.6.1 +- Protobuf v1.4.0 +- Netmap v1.7.0 +- Prometheus Client v1.5.1 +- Testify v1.5.1 +- gRPC v1.28.1 + +### Fixed +- formatting +- test coverage for Object.PutRequest.CID method + ## [0.6.1] - 2020-04-10 ### Changed @@ -241,3 +255,4 @@ Initial public release [0.5.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v0.4.2...v0.5.0 [0.6.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v0.5.0...v0.6.0 [0.6.1]: https://github.com/nspcc-dev/neofs-api-go/compare/v0.6.0...v0.6.1 +[0.6.2]: https://github.com/nspcc-dev/neofs-api-go/compare/v0.6.1...v0.6.2 From effdc54f79fd006bbf0d50a743a63f3c02d3d6ab Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Thu, 16 Apr 2020 17:05:04 +0300 Subject: [PATCH 0140/1196] api: update to v0.7.0 --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 2102b78..0caa683 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -PROTO_VERSION=v0.6.1 +PROTO_VERSION=v0.7.0 PROTO_URL=https://github.com/nspcc-dev/neofs-api/archive/$(PROTO_VERSION).tar.gz B=\033[0;1m From e03e3f12706db8125cab4dec23767cc4de310a2c Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Thu, 16 Apr 2020 17:05:44 +0300 Subject: [PATCH 0141/1196] docs: regenerate files --- docs/object.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/object.md b/docs/object.md index ce9252b..4ec32fc 100644 --- a/docs/object.md +++ b/docs/object.md @@ -297,6 +297,7 @@ in distributed system. | ----- | ---- | ----- | ----------- | | Object | [Object](#object.Object) | | Object with at least container id and owner id fields | | Token | [session.Token](#session.Token) | | Token with session public key and user's signature | +| CopiesNumber | [uint32](#uint32) | | Number of the object copies to store within the RPC call (zero is processed according to the placement rules) | From bedde0e33b97a8c3c6a0c7ef837b75fc4b3b6bfb Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Thu, 16 Apr 2020 17:06:07 +0300 Subject: [PATCH 0142/1196] proto: regenerate files --- object/service.pb.go | 161 ++++++++++++++++++++++++++----------------- object/service.proto | 2 + 2 files changed, 101 insertions(+), 62 deletions(-) diff --git a/object/service.pb.go b/object/service.pb.go index 8502c8e..4ac61bc 100644 --- a/object/service.pb.go +++ b/object/service.pb.go @@ -265,10 +265,12 @@ type PutRequest_PutHeader struct { // Object with at least container id and owner id fields Object *Object `protobuf:"bytes,1,opt,name=Object,proto3" json:"Object,omitempty"` // Token with session public key and user's signature - Token *session.Token `protobuf:"bytes,2,opt,name=Token,proto3" json:"Token,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Token *session.Token `protobuf:"bytes,2,opt,name=Token,proto3" json:"Token,omitempty"` + // Number of the object copies to store within the RPC call (zero is processed according to the placement rules) + CopiesNumber uint32 `protobuf:"varint,3,opt,name=CopiesNumber,proto3" json:"CopiesNumber,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *PutRequest_PutHeader) Reset() { *m = PutRequest_PutHeader{} } @@ -314,6 +316,13 @@ func (m *PutRequest_PutHeader) GetToken() *session.Token { return nil } +func (m *PutRequest_PutHeader) GetCopiesNumber() uint32 { + if m != nil { + return m.CopiesNumber + } + return 0 +} + type PutResponse struct { // Address of object (container id + object id) Address refs.Address `protobuf:"bytes,1,opt,name=Address,proto3" json:"Address"` @@ -897,64 +906,65 @@ func init() { func init() { proto.RegisterFile("object/service.proto", fileDescriptor_dfcdf610ade6a9ce) } var fileDescriptor_dfcdf610ade6a9ce = []byte{ - // 907 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x57, 0x4f, 0x8f, 0x22, 0x45, - 0x14, 0xa7, 0x68, 0xe8, 0x61, 0x1f, 0xcd, 0x2c, 0xa9, 0xc1, 0x95, 0xf4, 0x6e, 0x98, 0x09, 0xd9, - 0x18, 0x8c, 0xa1, 0x19, 0xd7, 0x44, 0xd7, 0x93, 0x59, 0x86, 0xcc, 0x42, 0x8c, 0xce, 0x6c, 0x61, - 0x36, 0xd1, 0x5b, 0xd3, 0x14, 0xd0, 0x2e, 0xd3, 0xcd, 0xf6, 0x9f, 0x21, 0x73, 0xf1, 0xe6, 0x79, - 0xaf, 0x1e, 0x3d, 0xfb, 0x19, 0xfc, 0x00, 0x7b, 0x31, 0xd9, 0xa3, 0xf1, 0x30, 0x31, 0x78, 0xf4, - 0x0b, 0x98, 0x78, 0x31, 0xf5, 0xa7, 0xff, 0xcd, 0xca, 0xaa, 0x70, 0xc0, 0x13, 0x55, 0xbf, 0xf7, - 0x7b, 0xaf, 0xea, 0xfd, 0xea, 0xd5, 0x2b, 0x1a, 0x6a, 0xee, 0xe8, 0x6b, 0x6a, 0x05, 0x1d, 0x9f, - 0x7a, 0x97, 0xb6, 0x45, 0x8d, 0x85, 0xe7, 0x06, 0x2e, 0x56, 0x05, 0xaa, 0x57, 0x3d, 0x3a, 0xf1, - 0x3b, 0xc1, 0xd5, 0x82, 0xfa, 0xc2, 0xa2, 0x63, 0xc9, 0x4f, 0x63, 0x07, 0x3e, 0xf5, 0x7d, 0xdb, - 0x75, 0xb2, 0x44, 0x19, 0xb1, 0x73, 0x41, 0x03, 0x53, 0x62, 0xb5, 0x08, 0xbb, 0xa4, 0x9e, 0x3d, - 0xb9, 0x92, 0x68, 0x7b, 0x6a, 0x07, 0xb3, 0x70, 0x64, 0x58, 0xee, 0x45, 0x67, 0xea, 0x4e, 0xdd, - 0x0e, 0x87, 0x47, 0xe1, 0x84, 0xcf, 0xf8, 0x84, 0x8f, 0x04, 0xbd, 0xf9, 0x13, 0x02, 0x78, 0x4c, - 0x03, 0x42, 0x9f, 0x87, 0xd4, 0x0f, 0x70, 0x1b, 0xf6, 0x1e, 0x8d, 0xc7, 0x1e, 0xf5, 0xfd, 0x3a, - 0x3a, 0x42, 0xad, 0xf2, 0x83, 0x8a, 0xc1, 0x36, 0x6d, 0x48, 0xb0, 0x5b, 0x78, 0x79, 0x7d, 0x98, - 0x23, 0x11, 0x07, 0x57, 0x41, 0x21, 0xe6, 0xb2, 0x9e, 0x3f, 0x42, 0xad, 0x12, 0x61, 0x43, 0xfc, - 0x10, 0x0a, 0x9f, 0xd1, 0xc0, 0xac, 0x8f, 0xb8, 0xb7, 0x6e, 0x44, 0x4a, 0xc8, 0x05, 0x98, 0xad, - 0x4f, 0xcd, 0x31, 0xf5, 0xba, 0x25, 0x16, 0xea, 0xd5, 0xf5, 0x21, 0x22, 0xdc, 0x03, 0xf7, 0x40, - 0x7d, 0xca, 0x13, 0xa9, 0x5b, 0xdc, 0xb7, 0x79, 0xd3, 0x97, 0x5b, 0x6d, 0xcb, 0x0c, 0x6c, 0xd7, - 0x79, 0x2d, 0x86, 0xf4, 0x6d, 0xbe, 0x40, 0x50, 0xe6, 0xf9, 0xf8, 0x0b, 0xd7, 0xf1, 0x29, 0x6e, - 0x81, 0x54, 0x5f, 0xe6, 0xb3, 0x6f, 0x88, 0xa9, 0x71, 0xc6, 0x7f, 0xfa, 0x39, 0x22, 0xed, 0xf8, - 0x0e, 0x14, 0x4f, 0x66, 0xa1, 0xf3, 0x8c, 0x67, 0xa3, 0xf5, 0x73, 0x44, 0x4c, 0xf1, 0xc7, 0x32, - 0x23, 0xb1, 0xab, 0xbb, 0xa9, 0x5d, 0x89, 0x25, 0xd6, 0xa7, 0xd4, 0x55, 0x00, 0x91, 0xe6, 0x8f, - 0x79, 0x80, 0xf3, 0x30, 0x56, 0xf8, 0x43, 0x50, 0x05, 0x5b, 0x6e, 0xe8, 0x5e, 0xb4, 0xa1, 0x84, - 0xc3, 0x86, 0x82, 0xc3, 0xb6, 0x27, 0x46, 0x6b, 0xb7, 0xb7, 0x63, 0xc1, 0xf5, 0x2f, 0xe1, 0x56, - 0xbc, 0x5d, 0xfc, 0x0e, 0xa8, 0x67, 0x6f, 0x50, 0x9b, 0x48, 0x2b, 0xbe, 0x0f, 0xc5, 0x2f, 0xdc, - 0x67, 0xd4, 0xe1, 0xc9, 0x30, 0x9a, 0xac, 0x79, 0x83, 0xa3, 0x44, 0x18, 0x85, 0x7c, 0x4b, 0x28, - 0x73, 0x65, 0xe4, 0x79, 0xfe, 0xc7, 0x02, 0xdd, 0xfc, 0xf0, 0x9a, 0x2f, 0xf2, 0x50, 0xe9, 0xd1, - 0x39, 0x0d, 0xe8, 0x86, 0x97, 0xe3, 0x5d, 0xd8, 0x3b, 0x5b, 0x3a, 0xd4, 0x1b, 0xf4, 0xc4, 0x99, - 0x75, 0x6f, 0x33, 0xfb, 0x2f, 0xd7, 0x87, 0x11, 0x4c, 0xa2, 0x41, 0xa2, 0x87, 0xf2, 0x06, 0x3d, - 0x76, 0x7e, 0xb7, 0x3e, 0x85, 0xfd, 0x48, 0x10, 0x79, 0x1a, 0x5b, 0xc8, 0xfb, 0x27, 0x82, 0x32, - 0x33, 0x45, 0xe2, 0x3e, 0xfc, 0x07, 0x71, 0x63, 0xf1, 0x24, 0x90, 0xe8, 0x7c, 0x04, 0xe5, 0xd3, - 0x70, 0x3e, 0x17, 0xeb, 0xf8, 0xb2, 0x19, 0xa5, 0xa1, 0xa8, 0x4d, 0x29, 0xff, 0x9f, 0x36, 0xf5, - 0x1c, 0x34, 0x91, 0xbc, 0x14, 0xf2, 0xdf, 0x5e, 0x9c, 0x2d, 0x04, 0xff, 0x03, 0x41, 0x65, 0x48, - 0x4d, 0xcf, 0x9a, 0x25, 0xf5, 0x5c, 0x3e, 0x71, 0x9d, 0xc0, 0xb4, 0x45, 0x91, 0x22, 0x5e, 0xa4, - 0x65, 0xa9, 0xb3, 0x72, 0x32, 0xe8, 0x91, 0xb4, 0x1d, 0xd7, 0xa0, 0xf8, 0x24, 0xa4, 0xde, 0x95, - 0xa8, 0x66, 0x22, 0x26, 0xb8, 0x09, 0x1a, 0x1f, 0x3c, 0xa5, 0x1e, 0xab, 0x58, 0x2e, 0x72, 0x85, - 0x64, 0xb0, 0x9d, 0xab, 0xfd, 0x0d, 0xec, 0x47, 0x99, 0x4b, 0xbd, 0xdf, 0x87, 0x5b, 0xb2, 0x7c, - 0x28, 0xab, 0x37, 0x65, 0xdd, 0x65, 0x4e, 0x58, 0xdb, 0x48, 0xff, 0x3b, 0x82, 0xdb, 0xec, 0x51, - 0x32, 0x9d, 0xe9, 0xe6, 0xcd, 0xa4, 0xc8, 0xdd, 0x65, 0xc7, 0xac, 0x44, 0xf5, 0xc1, 0x41, 0x49, - 0x16, 0x8c, 0x9d, 0xab, 0x6d, 0x43, 0x35, 0x49, 0x56, 0xea, 0xad, 0x43, 0xe9, 0xd4, 0x33, 0xa7, - 0x17, 0xd4, 0x11, 0x15, 0xae, 0x91, 0x78, 0xbe, 0x8d, 0xb0, 0xdf, 0xe6, 0xe1, 0x20, 0x5a, 0xab, - 0x6f, 0xfa, 0xb3, 0x0d, 0xc5, 0x7d, 0x0f, 0x54, 0x1e, 0x82, 0x35, 0x0f, 0x65, 0x9d, 0xba, 0x92, - 0x82, 0x31, 0x14, 0x86, 0xe6, 0x3c, 0xe0, 0x85, 0xae, 0x11, 0x3e, 0xde, 0xb9, 0xe4, 0x4b, 0xa8, - 0x65, 0x65, 0x90, 0xb2, 0xdf, 0x07, 0x95, 0xcd, 0x65, 0x8d, 0x6b, 0x5d, 0x4d, 0x5e, 0xee, 0x02, - 0x67, 0x49, 0xdb, 0x16, 0x07, 0xf0, 0xe0, 0x7b, 0x05, 0xf6, 0x86, 0x82, 0x8e, 0x8f, 0x41, 0x79, - 0x4c, 0x03, 0x8c, 0x23, 0xf1, 0x92, 0xbf, 0x95, 0xfa, 0x41, 0x06, 0x13, 0x51, 0x8f, 0x11, 0xf3, - 0x38, 0x0f, 0x53, 0x1e, 0xc9, 0x5f, 0xa0, 0xc4, 0x23, 0xf5, 0xf8, 0xb7, 0x10, 0xfe, 0x08, 0x54, - 0xf1, 0x04, 0xe1, 0xb7, 0x22, 0x42, 0xe6, 0x8d, 0xd6, 0xef, 0xdc, 0x84, 0xe3, 0x0b, 0x5f, 0x60, - 0x29, 0xe0, 0x38, 0x6e, 0xea, 0xed, 0xd1, 0x6b, 0x59, 0x30, 0x7e, 0xdc, 0x54, 0xd1, 0x35, 0x92, - 0xb5, 0x32, 0xfd, 0x33, 0x59, 0x2b, 0xdb, 0x5c, 0x8e, 0x11, 0xfe, 0x04, 0x4a, 0xd1, 0x79, 0xe0, - 0xb7, 0xd3, 0xb9, 0xa7, 0x3a, 0x80, 0x5e, 0x7f, 0xdd, 0x10, 0x07, 0x18, 0x80, 0x96, 0x3e, 0x50, - 0x7c, 0xf7, 0x26, 0x37, 0x55, 0xed, 0xfa, 0xbd, 0xbf, 0x37, 0x8a, 0x60, 0xdd, 0x27, 0x2f, 0x57, - 0x0d, 0xf4, 0x6a, 0xd5, 0x40, 0x3f, 0xaf, 0x1a, 0xe8, 0xd7, 0x55, 0x03, 0x7d, 0xf7, 0x5b, 0x23, - 0xf7, 0x55, 0x2b, 0xf5, 0x99, 0xe0, 0xf8, 0x0b, 0xcb, 0x6a, 0x8f, 0xe9, 0x65, 0xc7, 0xa1, 0xee, - 0xc4, 0x6f, 0x9b, 0x0b, 0xbb, 0x3d, 0x75, 0x3b, 0x22, 0xe8, 0x0f, 0xf9, 0xea, 0xe7, 0xd4, 0x3d, - 0x1d, 0x1a, 0x8f, 0xce, 0x07, 0xf2, 0x35, 0x1a, 0xa9, 0xfc, 0xdb, 0xe1, 0x83, 0xbf, 0x02, 0x00, - 0x00, 0xff, 0xff, 0x9e, 0xc2, 0xdd, 0xbd, 0xef, 0x0c, 0x00, 0x00, + // 924 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x57, 0xcf, 0x6f, 0x1b, 0x45, + 0x14, 0xce, 0x78, 0x9d, 0x4d, 0xfa, 0x6c, 0xa7, 0xd1, 0xc4, 0x14, 0x6b, 0x5b, 0x39, 0x91, 0x55, + 0x21, 0x23, 0xe4, 0x75, 0x28, 0x12, 0x94, 0x13, 0xaa, 0x13, 0xa5, 0x89, 0x10, 0x4d, 0x3a, 0x41, + 0x3d, 0x70, 0x5b, 0x6f, 0x5e, 0x9c, 0xa5, 0xc9, 0xae, 0xbb, 0xb3, 0x9b, 0x28, 0x07, 0xb8, 0x71, + 0xee, 0x95, 0x23, 0x67, 0xfe, 0x92, 0x5e, 0x90, 0x7a, 0x44, 0x1c, 0xa2, 0x2a, 0x1c, 0xf9, 0x07, + 0x90, 0xb8, 0xa0, 0xf9, 0xb5, 0x3f, 0x52, 0x12, 0xc0, 0x3e, 0xb8, 0x27, 0xcf, 0x7c, 0xef, 0x7b, + 0x6f, 0xe6, 0x7d, 0xf3, 0xe6, 0x8d, 0x17, 0x9a, 0xd1, 0xf0, 0x5b, 0xf4, 0x93, 0x3e, 0xc7, 0xf8, + 0x34, 0xf0, 0xd1, 0x1d, 0xc7, 0x51, 0x12, 0x51, 0x5b, 0xa1, 0xce, 0x72, 0x8c, 0x87, 0xbc, 0x9f, + 0x9c, 0x8f, 0x91, 0x2b, 0x8b, 0x43, 0x35, 0xbf, 0x88, 0xad, 0x70, 0xe4, 0x3c, 0x88, 0xc2, 0x32, + 0x51, 0x47, 0xec, 0x9f, 0x60, 0xe2, 0x69, 0xac, 0x69, 0xb0, 0x53, 0x8c, 0x83, 0xc3, 0x73, 0x8d, + 0xf6, 0x46, 0x41, 0x72, 0x94, 0x0e, 0x5d, 0x3f, 0x3a, 0xe9, 0x8f, 0xa2, 0x51, 0xd4, 0x97, 0xf0, + 0x30, 0x3d, 0x94, 0x33, 0x39, 0x91, 0x23, 0x45, 0xef, 0xfc, 0x42, 0x00, 0x1e, 0x63, 0xc2, 0xf0, + 0x45, 0x8a, 0x3c, 0xa1, 0x3d, 0x58, 0x78, 0x74, 0x70, 0x10, 0x23, 0xe7, 0x2d, 0xb2, 0x46, 0xba, + 0xb5, 0x07, 0x0d, 0x57, 0x6c, 0xda, 0xd5, 0xe0, 0xa0, 0xfa, 0xea, 0x62, 0x75, 0x8e, 0x19, 0x0e, + 0x5d, 0x06, 0x8b, 0x79, 0x67, 0xad, 0xca, 0x1a, 0xe9, 0x2e, 0x32, 0x31, 0xa4, 0x0f, 0xa1, 0xfa, + 0x15, 0x26, 0x5e, 0x6b, 0x28, 0xbd, 0x1d, 0xd7, 0x28, 0xa1, 0x17, 0x10, 0xb6, 0x6d, 0xf4, 0x0e, + 0x30, 0x1e, 0x2c, 0x8a, 0x50, 0xaf, 0x2f, 0x56, 0x09, 0x93, 0x1e, 0x74, 0x13, 0xec, 0x67, 0x32, + 0x91, 0x96, 0x2f, 0x7d, 0x3b, 0x57, 0x7d, 0xa5, 0x35, 0xf0, 0xbd, 0x24, 0x88, 0xc2, 0xb7, 0x62, + 0x68, 0xdf, 0xce, 0x4b, 0x02, 0x35, 0x99, 0x0f, 0x1f, 0x47, 0x21, 0x47, 0xda, 0x05, 0xad, 0xbe, + 0xce, 0x67, 0xc9, 0x55, 0x53, 0x77, 0x57, 0xfe, 0x6c, 0xcf, 0x31, 0x6d, 0xa7, 0x77, 0x60, 0x7e, + 0xe3, 0x28, 0x0d, 0x9f, 0xcb, 0x6c, 0xea, 0xdb, 0x73, 0x4c, 0x4d, 0xe9, 0xe7, 0x3a, 0x23, 0xb5, + 0xab, 0xbb, 0x85, 0x5d, 0xa9, 0x25, 0xae, 0x4f, 0x69, 0x60, 0x01, 0x61, 0x9d, 0x37, 0x15, 0x80, + 0xbd, 0x34, 0x53, 0xf8, 0x53, 0xb0, 0x15, 0x5b, 0x6f, 0xe8, 0x9e, 0xd9, 0x50, 0xce, 0x11, 0x43, + 0xc5, 0x11, 0xdb, 0x53, 0xa3, 0x6b, 0xb7, 0x37, 0x63, 0xc1, 0x9d, 0xef, 0xe0, 0x56, 0xb6, 0x5d, + 0xfa, 0x01, 0xd8, 0xbb, 0x37, 0xa8, 0xcd, 0xb4, 0x95, 0xde, 0x87, 0xf9, 0xaf, 0xa3, 0xe7, 0x18, + 0xca, 0x64, 0x04, 0x4d, 0xd7, 0xbc, 0x2b, 0x51, 0xa6, 0x8c, 0xb4, 0x03, 0xf5, 0x8d, 0x68, 0x1c, + 0x20, 0x7f, 0x92, 0x9e, 0x0c, 0x31, 0x6e, 0x59, 0x6b, 0xa4, 0xdb, 0x60, 0x25, 0x4c, 0x49, 0x7c, + 0x06, 0x35, 0xa9, 0x9e, 0x3e, 0xf3, 0xff, 0x59, 0xc4, 0x93, 0x1f, 0x70, 0xe7, 0x65, 0x05, 0x1a, + 0x9b, 0x78, 0x8c, 0x09, 0x4e, 0x78, 0x81, 0x3e, 0x84, 0x85, 0xdd, 0xb3, 0x10, 0xe3, 0x9d, 0x4d, + 0x75, 0xae, 0x83, 0xdb, 0xc2, 0xfe, 0xdb, 0xc5, 0xaa, 0x81, 0x99, 0x19, 0xe4, 0x9a, 0x59, 0x37, + 0x69, 0x36, 0xeb, 0xfb, 0xf7, 0x25, 0x2c, 0x19, 0x41, 0xf4, 0x69, 0x4c, 0x21, 0xef, 0x5f, 0x04, + 0x6a, 0xc2, 0x64, 0xc4, 0x7d, 0xf8, 0x2f, 0xe2, 0x66, 0xe2, 0x69, 0x20, 0xd7, 0x79, 0x0d, 0x6a, + 0x5b, 0xe9, 0xf1, 0xb1, 0x5a, 0x87, 0xeb, 0x86, 0x55, 0x84, 0x4c, 0x2b, 0xb3, 0xde, 0x9d, 0x56, + 0xf6, 0x02, 0xea, 0x2a, 0x79, 0x2d, 0xe4, 0x7f, 0xbd, 0x5c, 0x53, 0x08, 0xfe, 0x27, 0x81, 0xc6, + 0x3e, 0x7a, 0xb1, 0x7f, 0x94, 0xd7, 0x73, 0x6d, 0x23, 0x0a, 0x13, 0x2f, 0x50, 0x45, 0x4a, 0x64, + 0x91, 0xd6, 0xb4, 0xce, 0xd6, 0xc6, 0xce, 0x26, 0x2b, 0xda, 0x69, 0x13, 0xe6, 0x9f, 0xa6, 0x18, + 0x9f, 0xab, 0x6a, 0x66, 0x6a, 0x22, 0x2e, 0xb2, 0x1c, 0x3c, 0xc3, 0x58, 0x54, 0xac, 0xb9, 0xc8, + 0x45, 0x6c, 0xe6, 0x6a, 0x7f, 0x0f, 0x4b, 0x26, 0x73, 0xad, 0xf7, 0xc7, 0x70, 0x4b, 0x97, 0x0f, + 0x8a, 0x7a, 0xb3, 0xae, 0xbb, 0xcc, 0x39, 0x6b, 0x1a, 0xe9, 0xff, 0x20, 0x70, 0x5b, 0x3c, 0x5c, + 0x5e, 0x38, 0x9a, 0xbc, 0x99, 0xcc, 0x4b, 0x77, 0xdd, 0x55, 0x1b, 0xa6, 0x3e, 0x24, 0xa8, 0xc9, + 0x8a, 0x31, 0x73, 0xb5, 0x03, 0x58, 0xce, 0x93, 0xd5, 0x7a, 0x3b, 0xb0, 0xb8, 0x15, 0x7b, 0xa3, + 0x13, 0x0c, 0x55, 0x85, 0xd7, 0x59, 0x36, 0x9f, 0x46, 0xd8, 0x1f, 0x2a, 0xb0, 0x62, 0xd6, 0xda, + 0xf6, 0xf8, 0xd1, 0x84, 0xe2, 0x7e, 0x04, 0xb6, 0x0c, 0x21, 0x9a, 0x87, 0x75, 0x9d, 0xba, 0x9a, + 0x42, 0x29, 0x54, 0xf7, 0xbd, 0xe3, 0x44, 0x16, 0x7a, 0x9d, 0xc9, 0xf1, 0xcc, 0x25, 0x3f, 0x83, + 0x66, 0x59, 0x06, 0x2d, 0xfb, 0x7d, 0xb0, 0xc5, 0x5c, 0xd7, 0x78, 0x7d, 0x50, 0xd7, 0x97, 0xbb, + 0x2a, 0x59, 0xda, 0x36, 0xc5, 0x01, 0x3c, 0xf8, 0xc9, 0x82, 0x85, 0x7d, 0x45, 0xa7, 0xeb, 0x60, + 0x3d, 0xc6, 0x84, 0x52, 0x23, 0x5e, 0xfe, 0xd7, 0xd3, 0x59, 0x29, 0x61, 0x2a, 0xea, 0x3a, 0x11, + 0x1e, 0x7b, 0x69, 0xc1, 0x23, 0xff, 0x9b, 0x94, 0x7b, 0x14, 0x1e, 0xff, 0x2e, 0xa1, 0x9f, 0x81, + 0xad, 0x9e, 0x20, 0xfa, 0x9e, 0x21, 0x94, 0xde, 0x68, 0xe7, 0xce, 0x55, 0x38, 0xbb, 0xf0, 0x55, + 0x91, 0x02, 0xcd, 0xe2, 0x16, 0xde, 0x1e, 0xa7, 0x59, 0x06, 0xb3, 0xc7, 0xcd, 0x56, 0x5d, 0x23, + 0x5f, 0xab, 0xd4, 0x3f, 0xf3, 0xb5, 0xca, 0xcd, 0x65, 0x9d, 0xd0, 0x2f, 0x60, 0xd1, 0x9c, 0x07, + 0x7d, 0xbf, 0x98, 0x7b, 0xa1, 0x03, 0x38, 0xad, 0xb7, 0x0d, 0x59, 0x80, 0x1d, 0xa8, 0x17, 0x0f, + 0x94, 0xde, 0xbd, 0xca, 0x2d, 0x54, 0xbb, 0x73, 0xef, 0x9f, 0x8d, 0x2a, 0xd8, 0xe0, 0xe9, 0xab, + 0xcb, 0x36, 0x79, 0x7d, 0xd9, 0x26, 0xbf, 0x5e, 0xb6, 0xc9, 0x9b, 0xcb, 0x36, 0xf9, 0xf1, 0xf7, + 0xf6, 0xdc, 0x37, 0xdd, 0xc2, 0xa7, 0x44, 0xc8, 0xc7, 0xbe, 0xdf, 0x3b, 0xc0, 0xd3, 0x7e, 0x88, + 0xd1, 0x21, 0xef, 0x79, 0xe3, 0xa0, 0x37, 0x8a, 0xfa, 0x2a, 0xe8, 0xcf, 0x95, 0xe5, 0x27, 0x18, + 0x6d, 0xed, 0xbb, 0x8f, 0xf6, 0x76, 0xf4, 0x6b, 0x34, 0xb4, 0xe5, 0xf7, 0xc5, 0x27, 0x7f, 0x07, + 0x00, 0x00, 0xff, 0xff, 0xb3, 0xf2, 0x5d, 0xaf, 0x13, 0x0d, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1696,6 +1706,11 @@ func (m *PutRequest_PutHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } + if m.CopiesNumber != 0 { + i = encodeVarintService(dAtA, i, uint64(m.CopiesNumber)) + i-- + dAtA[i] = 0x18 + } if m.Token != nil { { size, err := m.Token.MarshalToSizedBuffer(dAtA[:i]) @@ -2534,6 +2549,9 @@ func (m *PutRequest_PutHeader) Size() (n int) { l = m.Token.Size() n += 1 + l + sovService(uint64(l)) } + if m.CopiesNumber != 0 { + n += 1 + sovService(uint64(m.CopiesNumber)) + } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -3390,6 +3408,25 @@ func (m *PutRequest_PutHeader) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CopiesNumber", wireType) + } + m.CopiesNumber = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.CopiesNumber |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipService(dAtA[iNdEx:]) diff --git a/object/service.proto b/object/service.proto index 2aa21fd..b5042e2 100644 --- a/object/service.proto +++ b/object/service.proto @@ -84,6 +84,8 @@ message PutRequest { Object Object = 1; // Token with session public key and user's signature session.Token Token = 2; + // Number of the object copies to store within the RPC call (zero is processed according to the placement rules) + uint32 CopiesNumber = 3; } oneof R { From 1f2cee7667fa3de9aa2571e020f3329ae68951db Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Thu, 16 Apr 2020 17:11:50 +0300 Subject: [PATCH 0143/1196] CHANGELOG --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a51d80f..d96a2eb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,11 @@ # Changelog This is the changelog for NeoFS-API-Go +## [0.7.0] - 2020-04-16 + +### Updated +- NeoFS API v0.7.0 + ## [0.6.2] - 2020-04-16 ### Updated @@ -256,3 +261,4 @@ Initial public release [0.6.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v0.5.0...v0.6.0 [0.6.1]: https://github.com/nspcc-dev/neofs-api-go/compare/v0.6.0...v0.6.1 [0.6.2]: https://github.com/nspcc-dev/neofs-api-go/compare/v0.6.1...v0.6.2 +[0.7.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v0.6.2...v0.7.0 From 46942282e5412f6837675bb56b5c737a6ac37466 Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Mon, 20 Apr 2020 13:53:56 +0300 Subject: [PATCH 0144/1196] make: update to NeoFS API v0.7.1 --- Makefile | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 0caa683..29f41bc 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -PROTO_VERSION=v0.7.0 +PROTO_VERSION=v0.7.1 PROTO_URL=https://github.com/nspcc-dev/neofs-api/archive/$(PROTO_VERSION).tar.gz B=\033[0;1m @@ -9,14 +9,14 @@ R=\033[0m # Dependencies deps: - @echo "${B}${G}=> Golang modules ${R}" + @echo "${B}${G}⇒ Golang modules ${R}" @go mod tidy -v @go mod vendor - @echo "${B}${G}=> Cleanup old files ${R}" + @echo "${B}${G}⇒ Cleanup old files ${R}" @find . -type f -name '*.proto' -not -path './vendor/*' -not -name '*_test.proto' -exec rm {} \; - @echo "${B}${G}=> NeoFS Proto files ${R}" + @echo "${B}${G}⇒ NeoFS Proto files ${R}" @mkdir -p ./vendor/proto @curl -sL -o ./vendor/proto.tar.gz $(PROTO_URL) @tar -xzf ./vendor/proto.tar.gz --strip-components 1 -C ./vendor/proto @@ -24,7 +24,7 @@ deps: cp $$f/*.proto ./$$(basename $$f); \ done - @echo "${B}${G}=> Cleanup ${R}" + @echo "${B}${G}⇒ Cleanup ${R}" @rm -rf ./vendor/proto @rm -rf ./vendor/proto.tar.gz @@ -48,14 +48,14 @@ docgen: deps # Regenerate proto files: protoc: deps - @echo "${B}${G}=> Cleanup old files ${R}" + @echo "${B}${G}⇒ Cleanup old files ${R}" @find . -type f -name '*.pb.go' -not -path './vendor/*' -exec rm {} \; - @echo "${B}${G}=> Install specific version for gogo-proto ${R}" + @echo "${B}${G}⇒ Install specific version for gogo-proto ${R}" @go list -f '{{.Path}}/...@{{.Version}}' -m github.com/gogo/protobuf | xargs go get -v - @echo "${B}${G}=> Install specific version for protobuf lib ${R}" + @echo "${B}${G}⇒ Install specific version for protobuf lib ${R}" @go list -f '{{.Path}}/...@{{.Version}}' -m github.com/golang/protobuf | xargs go get -v - @echo "${B}${G}=> Protoc generate ${R}" + @echo "${B}${G}⇒ Protoc generate ${R}" @for f in `find . -type f -name '*.proto' -not -path './vendor/*'`; do \ echo "${B}${G}⇒ Processing $$f ${R}"; \ protoc \ From bef32abb9ca601347d168241f16b8b183ee781b4 Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Mon, 20 Apr 2020 13:54:34 +0300 Subject: [PATCH 0145/1196] proto: regenerate files --- state/service.pb.go | 543 +++++++++++++++++++++++++++++++++++++++++--- state/service.proto | 29 ++- 2 files changed, 536 insertions(+), 36 deletions(-) diff --git a/state/service.pb.go b/state/service.pb.go index 4c7db88..187949b 100644 --- a/state/service.pb.go +++ b/state/service.pb.go @@ -29,6 +29,37 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +type ChangeStateRequest_State int32 + +const ( + // Unknown is default value. Does nothing. + ChangeStateRequest_Unknown ChangeStateRequest_State = 0 + // Online used when need to set node to the online state. + ChangeStateRequest_Online ChangeStateRequest_State = 1 + // Offline used when need to set node to the offline state. + ChangeStateRequest_Offline ChangeStateRequest_State = 2 +) + +var ChangeStateRequest_State_name = map[int32]string{ + 0: "Unknown", + 1: "Online", + 2: "Offline", +} + +var ChangeStateRequest_State_value = map[string]int32{ + "Unknown": 0, + "Online": 1, + "Offline": 2, +} + +func (x ChangeStateRequest_State) String() string { + return proto.EnumName(ChangeStateRequest_State_name, int32(x)) +} + +func (ChangeStateRequest_State) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_695592f6f2fc97b7, []int{9, 0} +} + // NetmapRequest message to request current node netmap type NetmapRequest struct { // RequestMetaHeader contains information about request meta headers (should be embedded into message) @@ -419,7 +450,93 @@ func (m *DumpVarsResponse) GetVariables() []byte { return nil } +// ChangeStateRequest contains a new state of node. +type ChangeStateRequest struct { + // State is a new state of node. + State ChangeStateRequest_State `protobuf:"varint,1,opt,name=state,proto3,enum=state.ChangeStateRequest_State" json:"state,omitempty"` + // RequestMetaHeader contains information about request meta headers (should be embedded into message) + service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` + // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) + service.RequestVerificationHeader `protobuf:"bytes,99,opt,name=Verify,proto3,embedded=Verify" json:"Verify"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ChangeStateRequest) Reset() { *m = ChangeStateRequest{} } +func (m *ChangeStateRequest) String() string { return proto.CompactTextString(m) } +func (*ChangeStateRequest) ProtoMessage() {} +func (*ChangeStateRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_695592f6f2fc97b7, []int{9} +} +func (m *ChangeStateRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ChangeStateRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *ChangeStateRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_ChangeStateRequest.Merge(m, src) +} +func (m *ChangeStateRequest) XXX_Size() int { + return m.Size() +} +func (m *ChangeStateRequest) XXX_DiscardUnknown() { + xxx_messageInfo_ChangeStateRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_ChangeStateRequest proto.InternalMessageInfo + +func (m *ChangeStateRequest) GetState() ChangeStateRequest_State { + if m != nil { + return m.State + } + return ChangeStateRequest_Unknown +} + +// ChangeStateResponse is an empty response, that returns when RPC invoked without errors. +type ChangeStateResponse struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ChangeStateResponse) Reset() { *m = ChangeStateResponse{} } +func (m *ChangeStateResponse) String() string { return proto.CompactTextString(m) } +func (*ChangeStateResponse) ProtoMessage() {} +func (*ChangeStateResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_695592f6f2fc97b7, []int{10} +} +func (m *ChangeStateResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ChangeStateResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *ChangeStateResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_ChangeStateResponse.Merge(m, src) +} +func (m *ChangeStateResponse) XXX_Size() int { + return m.Size() +} +func (m *ChangeStateResponse) XXX_DiscardUnknown() { + xxx_messageInfo_ChangeStateResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_ChangeStateResponse proto.InternalMessageInfo + func init() { + proto.RegisterEnum("state.ChangeStateRequest_State", ChangeStateRequest_State_name, ChangeStateRequest_State_value) proto.RegisterType((*NetmapRequest)(nil), "state.NetmapRequest") proto.RegisterType((*MetricsRequest)(nil), "state.MetricsRequest") proto.RegisterType((*MetricsResponse)(nil), "state.MetricsResponse") @@ -429,46 +546,53 @@ func init() { proto.RegisterType((*DumpResponse)(nil), "state.DumpResponse") proto.RegisterType((*DumpVarsRequest)(nil), "state.DumpVarsRequest") proto.RegisterType((*DumpVarsResponse)(nil), "state.DumpVarsResponse") + proto.RegisterType((*ChangeStateRequest)(nil), "state.ChangeStateRequest") + proto.RegisterType((*ChangeStateResponse)(nil), "state.ChangeStateResponse") } func init() { proto.RegisterFile("state/service.proto", fileDescriptor_695592f6f2fc97b7) } var fileDescriptor_695592f6f2fc97b7 = []byte{ - // 529 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x94, 0xcf, 0x6e, 0xd3, 0x40, - 0x10, 0xc6, 0xbb, 0x01, 0x42, 0x3a, 0x09, 0x0d, 0xda, 0x26, 0xc1, 0xb2, 0x50, 0x1a, 0xf9, 0x00, - 0x91, 0x50, 0x6c, 0x54, 0x40, 0xaa, 0xe0, 0x44, 0x5a, 0xa1, 0x72, 0x48, 0x41, 0x8e, 0x94, 0x03, - 0xb7, 0xb5, 0x33, 0x71, 0x2c, 0x1a, 0xaf, 0xf1, 0xae, 0x23, 0xe5, 0x21, 0x10, 0x70, 0xe3, 0x11, - 0x10, 0x4f, 0xd2, 0x63, 0x8f, 0x9c, 0x2a, 0x14, 0x5e, 0x04, 0x65, 0xbd, 0xce, 0xbf, 0xbe, 0x40, - 0x6e, 0x99, 0xdf, 0xcc, 0xe7, 0x7c, 0xb3, 0x3b, 0x3b, 0x70, 0x28, 0x24, 0x93, 0xe8, 0x08, 0x4c, - 0xa6, 0xa1, 0x8f, 0x76, 0x9c, 0x70, 0xc9, 0xe9, 0x3d, 0x05, 0x4d, 0xaa, 0xa9, 0x33, 0x41, 0xc9, - 0xb2, 0x94, 0x59, 0xcb, 0xd9, 0x14, 0x93, 0x70, 0x34, 0xd3, 0xb4, 0xee, 0x71, 0x2e, 0x85, 0x4c, - 0x58, 0xec, 0xc8, 0x59, 0x8c, 0x42, 0xe3, 0x4e, 0x10, 0xca, 0x71, 0xea, 0xd9, 0x3e, 0x9f, 0x38, - 0x01, 0x0f, 0xb8, 0xa3, 0xb0, 0x97, 0x8e, 0x54, 0xa4, 0x02, 0xf5, 0x2b, 0x2b, 0xb7, 0xbe, 0x11, - 0x78, 0x70, 0x81, 0x72, 0xc2, 0x62, 0x17, 0xbf, 0xa4, 0x28, 0x24, 0x3d, 0x81, 0xbb, 0x3d, 0x94, - 0xcc, 0xf0, 0x5a, 0xa4, 0x5d, 0x3e, 0x36, 0xed, 0xdc, 0xa6, 0xce, 0x2f, 0x72, 0xe7, 0xc8, 0x86, - 0x98, 0x74, 0x4b, 0x57, 0x37, 0x47, 0x7b, 0xd7, 0x37, 0x47, 0xc4, 0x55, 0x0a, 0x7a, 0x06, 0xc5, - 0x81, 0x72, 0x68, 0xf8, 0x4a, 0x6b, 0x6d, 0x6b, 0x55, 0x36, 0xf4, 0x99, 0x0c, 0x79, 0x74, 0xeb, - 0x1b, 0x5a, 0x6b, 0x7d, 0x27, 0x70, 0xd0, 0x43, 0x99, 0x84, 0xbe, 0xd8, 0x15, 0x4b, 0xcf, 0xa0, - 0xba, 0x74, 0x24, 0x62, 0x1e, 0x09, 0xa4, 0x06, 0xdc, 0xd7, 0xc8, 0x20, 0xad, 0x3b, 0xed, 0x8a, - 0x9b, 0x87, 0xea, 0x44, 0xcf, 0x91, 0x5d, 0xca, 0xf1, 0xae, 0xd8, 0xef, 0xc2, 0x41, 0x6e, 0x68, - 0xe5, 0x3e, 0x23, 0x33, 0x83, 0xb4, 0x48, 0xbb, 0xe4, 0xe6, 0x21, 0x6d, 0x40, 0xb1, 0x2f, 0x99, - 0x4c, 0x85, 0x51, 0x68, 0x91, 0xf6, 0xbe, 0xab, 0x23, 0xeb, 0x2b, 0x81, 0xf2, 0x59, 0x3a, 0xd9, - 0x99, 0x29, 0x79, 0x02, 0x95, 0xcc, 0x8e, 0xee, 0xa8, 0x01, 0xc5, 0x53, 0x1e, 0x8d, 0xc2, 0x40, - 0x35, 0x54, 0x71, 0x75, 0x64, 0xfd, 0x20, 0x50, 0x5d, 0x14, 0x0e, 0x58, 0xb2, 0x33, 0xe3, 0xf4, - 0x1c, 0x1e, 0xae, 0x2c, 0x69, 0xff, 0x8f, 0x61, 0x7f, 0xc0, 0x92, 0x90, 0x79, 0x97, 0x28, 0x74, - 0x0b, 0x2b, 0x70, 0xfc, 0xab, 0x90, 0x5f, 0x0b, 0x7d, 0x09, 0xc5, 0xec, 0xbd, 0xd2, 0x9a, 0xad, - 0x56, 0x86, 0xbd, 0xf1, 0x7c, 0xcd, 0x9a, 0xbd, 0xdc, 0x0b, 0x76, 0x3f, 0x4e, 0x90, 0x0d, 0x7b, - 0x2c, 0xa6, 0x27, 0xcb, 0x71, 0xa5, 0x75, 0x2d, 0xdb, 0x7c, 0x63, 0x66, 0x63, 0x1b, 0x6b, 0x63, - 0xaf, 0xa1, 0x9c, 0xcd, 0xc6, 0xe9, 0x18, 0xfd, 0xcf, 0xcb, 0x3f, 0xdd, 0x98, 0x70, 0xb3, 0xbe, - 0x45, 0xb5, 0xf6, 0x15, 0xc0, 0xa2, 0xd1, 0xec, 0x2a, 0x28, 0xd5, 0x45, 0x6b, 0x63, 0x64, 0x1e, - 0x6e, 0x30, 0x2d, 0x7b, 0x03, 0xa5, 0xfc, 0x7c, 0x68, 0x63, 0xad, 0x60, 0xed, 0x0e, 0xcd, 0x47, - 0xb7, 0x78, 0x26, 0xee, 0x7e, 0xb8, 0x9a, 0x37, 0xc9, 0xf5, 0xbc, 0x49, 0xfe, 0xcc, 0x9b, 0xe4, - 0xef, 0xbc, 0x49, 0x7e, 0xfe, 0x6b, 0xee, 0x7d, 0x7a, 0xba, 0xb6, 0x15, 0x23, 0x11, 0xfb, 0x7e, - 0x67, 0x88, 0x53, 0x27, 0x42, 0x3e, 0x12, 0x1d, 0x16, 0x87, 0x9d, 0x80, 0x3b, 0xea, 0x7b, 0xbf, - 0x0b, 0xd5, 0x0b, 0xe4, 0xef, 0xfa, 0xf6, 0xdb, 0x8f, 0xef, 0xed, 0xc5, 0x89, 0xa3, 0x57, 0x54, - 0x8b, 0xf2, 0xc5, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, 0x60, 0x43, 0xc8, 0xac, 0xb6, 0x05, 0x00, - 0x00, + // 619 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x55, 0xc1, 0x6e, 0xd3, 0x4c, + 0x10, 0xee, 0xe6, 0xff, 0xeb, 0xb6, 0x93, 0xd2, 0x56, 0xdb, 0x26, 0x18, 0x0b, 0xa5, 0x91, 0x0f, + 0x10, 0x09, 0xc5, 0x46, 0x85, 0x4a, 0x15, 0x9c, 0x68, 0x2b, 0x54, 0x0e, 0x6d, 0x91, 0x2b, 0x7a, + 0xe0, 0xb6, 0x76, 0xc7, 0x8e, 0xd5, 0xc6, 0x6b, 0xbc, 0x9b, 0xa2, 0x3e, 0x04, 0x02, 0x6e, 0x3c, + 0x03, 0x4f, 0xd2, 0x63, 0x8f, 0x9c, 0x2a, 0x14, 0xee, 0x3c, 0x00, 0x27, 0x94, 0xdd, 0x75, 0x9a, + 0x34, 0x70, 0x26, 0xb7, 0x7c, 0xdf, 0xcc, 0xb7, 0xf9, 0x66, 0x77, 0x66, 0x0c, 0xab, 0x42, 0x32, + 0x89, 0xbe, 0xc0, 0xe2, 0x3c, 0x8d, 0xd0, 0xcb, 0x0b, 0x2e, 0x39, 0x9d, 0x55, 0xa4, 0x43, 0x0d, + 0xeb, 0x77, 0x51, 0x32, 0x1d, 0x72, 0xd6, 0x4a, 0xee, 0x1c, 0x8b, 0x34, 0xbe, 0x30, 0x6c, 0x2d, + 0xe4, 0x5c, 0x0a, 0x59, 0xb0, 0xdc, 0x97, 0x17, 0x39, 0x0a, 0x43, 0xb7, 0x93, 0x54, 0x76, 0x7a, + 0xa1, 0x17, 0xf1, 0xae, 0x9f, 0xf0, 0x84, 0xfb, 0x8a, 0x0e, 0x7b, 0xb1, 0x42, 0x0a, 0xa8, 0x5f, + 0x3a, 0xdd, 0xfd, 0x48, 0xe0, 0xce, 0x01, 0xca, 0x2e, 0xcb, 0x03, 0x7c, 0xd7, 0x43, 0x21, 0xe9, + 0x16, 0xfc, 0xbf, 0x8f, 0x92, 0xd9, 0x61, 0x93, 0xb4, 0xaa, 0x1b, 0x8e, 0x57, 0xda, 0x34, 0xf1, + 0x41, 0x6c, 0x0f, 0xd9, 0x09, 0x16, 0xdb, 0xf3, 0x97, 0xd7, 0xeb, 0x33, 0x57, 0xd7, 0xeb, 0x24, + 0x50, 0x0a, 0xba, 0x0b, 0xd6, 0xb1, 0x72, 0x68, 0x47, 0x4a, 0xeb, 0xde, 0xd6, 0xaa, 0x68, 0x1a, + 0x31, 0x99, 0xf2, 0x6c, 0xe2, 0x0c, 0xa3, 0x75, 0x3f, 0x11, 0x58, 0xda, 0x47, 0x59, 0xa4, 0x91, + 0x98, 0x16, 0x4b, 0x8f, 0x60, 0x79, 0xe8, 0x48, 0xe4, 0x3c, 0x13, 0x48, 0x6d, 0x98, 0x33, 0x94, + 0x4d, 0x9a, 0xff, 0xb5, 0x16, 0x83, 0x12, 0xaa, 0x1b, 0xdd, 0x43, 0x76, 0x26, 0x3b, 0xd3, 0x62, + 0x7f, 0x1b, 0x96, 0x4a, 0x43, 0x37, 0xee, 0x35, 0x73, 0x61, 0x93, 0x26, 0x69, 0xcd, 0x07, 0x25, + 0xa4, 0x75, 0xb0, 0x8e, 0x24, 0x93, 0x3d, 0x61, 0x57, 0x9a, 0xa4, 0xb5, 0x10, 0x18, 0xe4, 0x7e, + 0x20, 0x50, 0xdd, 0xed, 0x75, 0xa7, 0xa6, 0x4b, 0x1e, 0xc0, 0xa2, 0xb6, 0x63, 0x2a, 0xaa, 0x83, + 0xb5, 0xc3, 0xb3, 0x38, 0x4d, 0x54, 0x41, 0x8b, 0x81, 0x41, 0xee, 0x67, 0x02, 0xcb, 0x83, 0xc4, + 0x63, 0x56, 0x4c, 0x4d, 0x3b, 0x3d, 0x86, 0x95, 0x1b, 0x4b, 0xc6, 0xff, 0x7d, 0x58, 0x38, 0x66, + 0x45, 0xca, 0xc2, 0x33, 0x14, 0xa6, 0x84, 0x1b, 0xc2, 0xfd, 0x45, 0x80, 0xee, 0x74, 0x58, 0x96, + 0xe0, 0xe0, 0x39, 0xb0, 0x2c, 0x64, 0x13, 0xf4, 0xd6, 0x50, 0x82, 0xa5, 0x8d, 0x75, 0x4f, 0x21, + 0x6f, 0x32, 0xd3, 0xd3, 0x40, 0x67, 0xff, 0xf3, 0xfa, 0xdb, 0x30, 0xab, 0xfc, 0xd0, 0x2a, 0xcc, + 0xbd, 0xc9, 0x4e, 0x33, 0xfe, 0x3e, 0x5b, 0x99, 0xa1, 0x00, 0xd6, 0x61, 0x76, 0x96, 0x66, 0xb8, + 0x42, 0x06, 0x81, 0xc3, 0x38, 0x56, 0xa0, 0xe2, 0xd6, 0x60, 0x75, 0xac, 0x22, 0x7d, 0x63, 0x1b, + 0x3f, 0x2b, 0x65, 0xab, 0xd2, 0xa7, 0x60, 0xe9, 0x1d, 0x46, 0xd7, 0xcc, 0x15, 0x8c, 0xad, 0x34, + 0x67, 0xcd, 0x1b, 0xee, 0x4a, 0xef, 0x28, 0x2f, 0x90, 0x9d, 0xec, 0xb3, 0x9c, 0x6e, 0x0d, 0x47, + 0x98, 0xd6, 0x8c, 0x6c, 0x7c, 0xef, 0x38, 0xf5, 0xdb, 0xb4, 0x79, 0xac, 0x67, 0x50, 0xd5, 0xf3, + 0xb2, 0xd3, 0xc1, 0xe8, 0x74, 0xf8, 0xa7, 0x63, 0x53, 0xef, 0xd4, 0x6e, 0xb1, 0x46, 0xbb, 0x09, + 0x30, 0x78, 0x7c, 0xdd, 0x9e, 0x94, 0x9a, 0xa4, 0x91, 0xd1, 0x72, 0x56, 0xc7, 0x38, 0x23, 0x7b, + 0x0e, 0xf3, 0x65, 0xcf, 0xd0, 0xfa, 0x48, 0xc2, 0x48, 0x5f, 0x3b, 0x77, 0x27, 0x78, 0x23, 0xde, + 0x85, 0xea, 0xc8, 0x0d, 0xd2, 0x7b, 0x7f, 0xed, 0x13, 0xc7, 0xf9, 0x53, 0x48, 0x9f, 0xb2, 0x7d, + 0x78, 0xd9, 0x6f, 0x90, 0xab, 0x7e, 0x83, 0x7c, 0xeb, 0x37, 0xc8, 0xf7, 0x7e, 0x83, 0x7c, 0xf9, + 0xd1, 0x98, 0x79, 0xfb, 0x70, 0xe4, 0x7b, 0x93, 0x89, 0x3c, 0x8a, 0xda, 0x27, 0x78, 0xee, 0x67, + 0xc8, 0x63, 0xd1, 0x66, 0x79, 0xda, 0x4e, 0xb8, 0xaf, 0x8e, 0xfc, 0x5a, 0x59, 0x3e, 0x40, 0xfe, + 0xf2, 0xc8, 0x7b, 0xf1, 0xfa, 0x95, 0x6e, 0xc7, 0xd0, 0x52, 0x9f, 0xa0, 0x27, 0xbf, 0x03, 0x00, + 0x00, 0xff, 0xff, 0x8c, 0xdd, 0xa7, 0x55, 0x10, 0x07, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -498,6 +622,10 @@ type StatusClient interface { // To permit access, used server config options. // The request should be signed. DumpVars(ctx context.Context, in *DumpVarsRequest, opts ...grpc.CallOption) (*DumpVarsResponse, error) + // ChangeState allows to change current node state of node. + // To permit access, used server config options. + // The request should be signed. + ChangeState(ctx context.Context, in *ChangeStateRequest, opts ...grpc.CallOption) (*ChangeStateResponse, error) } type statusClient struct { @@ -553,6 +681,15 @@ func (c *statusClient) DumpVars(ctx context.Context, in *DumpVarsRequest, opts . return out, nil } +func (c *statusClient) ChangeState(ctx context.Context, in *ChangeStateRequest, opts ...grpc.CallOption) (*ChangeStateResponse, error) { + out := new(ChangeStateResponse) + err := c.cc.Invoke(ctx, "/state.Status/ChangeState", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // StatusServer is the server API for Status service. type StatusServer interface { // Netmap request allows to receive current [bootstrap.SpreadMap](bootstrap.md#bootstrap.SpreadMap) @@ -570,6 +707,10 @@ type StatusServer interface { // To permit access, used server config options. // The request should be signed. DumpVars(context.Context, *DumpVarsRequest) (*DumpVarsResponse, error) + // ChangeState allows to change current node state of node. + // To permit access, used server config options. + // The request should be signed. + ChangeState(context.Context, *ChangeStateRequest) (*ChangeStateResponse, error) } // UnimplementedStatusServer can be embedded to have forward compatible implementations. @@ -591,6 +732,9 @@ func (*UnimplementedStatusServer) DumpConfig(ctx context.Context, req *DumpReque func (*UnimplementedStatusServer) DumpVars(ctx context.Context, req *DumpVarsRequest) (*DumpVarsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method DumpVars not implemented") } +func (*UnimplementedStatusServer) ChangeState(ctx context.Context, req *ChangeStateRequest) (*ChangeStateResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ChangeState not implemented") +} func RegisterStatusServer(s *grpc.Server, srv StatusServer) { s.RegisterService(&_Status_serviceDesc, srv) @@ -686,6 +830,24 @@ func _Status_DumpVars_Handler(srv interface{}, ctx context.Context, dec func(int return interceptor(ctx, in, info, handler) } +func _Status_ChangeState_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ChangeStateRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(StatusServer).ChangeState(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/state.Status/ChangeState", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(StatusServer).ChangeState(ctx, req.(*ChangeStateRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _Status_serviceDesc = grpc.ServiceDesc{ ServiceName: "state.Status", HandlerType: (*StatusServer)(nil), @@ -710,6 +872,10 @@ var _Status_serviceDesc = grpc.ServiceDesc{ MethodName: "DumpVars", Handler: _Status_DumpVars_Handler, }, + { + MethodName: "ChangeState", + Handler: _Status_ChangeState_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "state/service.proto", @@ -1118,6 +1284,89 @@ func (m *DumpVarsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *ChangeStateRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ChangeStateRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ChangeStateRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + { + size, err := m.RequestVerificationHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x9a + { + size, err := m.RequestMetaHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x92 + if m.State != 0 { + i = encodeVarintService(dAtA, i, uint64(m.State)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *ChangeStateResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ChangeStateResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ChangeStateResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + return len(dAtA) - i, nil +} + func encodeVarintService(dAtA []byte, offset int, v uint64) int { offset -= sovService(v) base := offset @@ -1278,6 +1527,37 @@ func (m *DumpVarsResponse) Size() (n int) { return n } +func (m *ChangeStateRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.State != 0 { + n += 1 + sovService(uint64(m.State)) + } + l = m.RequestMetaHeader.Size() + n += 2 + l + sovService(uint64(l)) + l = m.RequestVerificationHeader.Size() + n += 2 + l + sovService(uint64(l)) + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *ChangeStateResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + func sovService(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -2252,6 +2532,199 @@ func (m *DumpVarsResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *ChangeStateRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ChangeStateRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ChangeStateRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field State", wireType) + } + m.State = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.State |= ChangeStateRequest_State(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 98: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RequestMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 99: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestVerificationHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RequestVerificationHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ChangeStateResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ChangeStateResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ChangeStateResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipService(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/state/service.proto b/state/service.proto index bebc913..410a000 100644 --- a/state/service.proto +++ b/state/service.proto @@ -10,7 +10,8 @@ import "github.com/gogo/protobuf/gogoproto/gogo.proto"; option (gogoproto.stable_marshaler_all) = true; -// Status service provides node's healthcheck and status info +// Status service provides node's healthcheck and status info. +// TODO: decide how to describe auth and were contains permissions. service Status { // Netmap request allows to receive current [bootstrap.SpreadMap](bootstrap.md#bootstrap.SpreadMap) rpc Netmap(NetmapRequest) returns (bootstrap.SpreadMap); @@ -27,6 +28,10 @@ service Status { // To permit access, used server config options. // The request should be signed. rpc DumpVars(DumpVarsRequest) returns (DumpVarsResponse); + // ChangeState allows to change current node state of node. + // To permit access, used server config options. + // The request should be signed. + rpc ChangeState(ChangeStateRequest) returns (ChangeStateResponse); } // NetmapRequest message to request current node netmap @@ -95,3 +100,25 @@ message DumpVarsRequest { message DumpVarsResponse { bytes Variables = 1; } + +// ChangeStateRequest contains a new state of node. +message ChangeStateRequest { + enum State { + // Unknown is default value. Does nothing. + Unknown = 0; + // Online used when need to set node to the online state. + Online = 1; + // Offline used when need to set node to the offline state. + Offline = 2; + } + + // State is a new state of node. + State state = 1; + // RequestMetaHeader contains information about request meta headers (should be embedded into message) + service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) + service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; +} + +// ChangeStateResponse is an empty response, that returns when RPC invoked without errors. +message ChangeStateResponse {} \ No newline at end of file From e03b922dd4947e13bd93a2e005f79aeeaf56ae2f Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Mon, 20 Apr 2020 13:54:49 +0300 Subject: [PATCH 0146/1196] docs: regenerate files --- docs/state.md | 48 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-) diff --git a/docs/state.md b/docs/state.md index 2b3de4a..3b7b89d 100644 --- a/docs/state.md +++ b/docs/state.md @@ -8,6 +8,8 @@ - [Status](#state.Status) - Messages + - [ChangeStateRequest](#state.ChangeStateRequest) + - [ChangeStateResponse](#state.ChangeStateResponse) - [DumpRequest](#state.DumpRequest) - [DumpResponse](#state.DumpResponse) - [DumpVarsRequest](#state.DumpVarsRequest) @@ -34,7 +36,8 @@ ### Service "state.Status" -Status service provides node's healthcheck and status info +Status service provides node's healthcheck and status info. +TODO: decide how to describe auth and were contains permissions. ``` rpc Netmap(NetmapRequest) returns (.bootstrap.SpreadMap); @@ -42,6 +45,7 @@ rpc Metrics(MetricsRequest) returns (MetricsResponse); rpc HealthCheck(HealthRequest) returns (HealthResponse); rpc DumpConfig(DumpRequest) returns (DumpResponse); rpc DumpVars(DumpVarsRequest) returns (DumpVarsResponse); +rpc ChangeState(ChangeStateRequest) returns (ChangeStateResponse); ``` @@ -85,9 +89,38 @@ The request should be signed. | Name | Input | Output | | ---- | ----- | ------ | | DumpVars | [DumpVarsRequest](#state.DumpVarsRequest) | [DumpVarsResponse](#state.DumpVarsResponse) | +#### Method ChangeState + +ChangeState allows to change current node state of node. +To permit access, used server config options. +The request should be signed. + +| Name | Input | Output | +| ---- | ----- | ------ | +| ChangeState | [ChangeStateRequest](#state.ChangeStateRequest) | [ChangeStateResponse](#state.ChangeStateResponse) | + + +### Message ChangeStateRequest +ChangeStateRequest contains a new state of node. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| state | [ChangeStateRequest.State](#state.ChangeStateRequest.State) | | State is a new state of node. | +| Meta | [service.RequestMetaHeader](#service.RequestMetaHeader) | | RequestMetaHeader contains information about request meta headers (should be embedded into message) | +| Verify | [service.RequestVerificationHeader](#service.RequestVerificationHeader) | | RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) | + + + + +### Message ChangeStateResponse +ChangeStateResponse is an empty response, that returns when RPC invoked without errors. + + + ### Message DumpRequest @@ -198,6 +231,19 @@ NetmapRequest message to request current node netmap + + + +### ChangeStateRequest.State + + +| Name | Number | Description | +| ---- | ------ | ----------- | +| Unknown | 0 | Unknown is default value. Does nothing. | +| Online | 1 | Online used when need to set node to the online state. | +| Offline | 2 | Offline used when need to set node to the offline state. | + + From 91e0b2699d8c7d329ba3a198fb84546584008eca Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Mon, 20 Apr 2020 14:03:24 +0300 Subject: [PATCH 0147/1196] CHANGELOG --- CHANGELOG.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d96a2eb..14b7a11 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,16 @@ # Changelog This is the changelog for NeoFS-API-Go +## [0.7.1] - 2020-04-20 + +### Added + +- Method to change current node state. (`state.ChangeState`) + +### Updated + +- NeoFS API v0.7.1 + ## [0.7.0] - 2020-04-16 ### Updated @@ -262,3 +272,4 @@ Initial public release [0.6.1]: https://github.com/nspcc-dev/neofs-api-go/compare/v0.6.0...v0.6.1 [0.6.2]: https://github.com/nspcc-dev/neofs-api-go/compare/v0.6.1...v0.6.2 [0.7.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v0.6.2...v0.7.0 +[0.7.1]: https://github.com/nspcc-dev/neofs-api-go/compare/v0.7.0...v0.7.1 From e63d112cb235daacce4fdc9432ad219eaaa10872 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 28 Apr 2020 12:50:52 +0300 Subject: [PATCH 0148/1196] Update to neofs-api v0.7.2 --- Makefile | 2 +- object/service.pb.go | 326 +++------------ object/service.proto | 11 +- object/types.pb.go | 154 +++---- object/types.proto | 6 +- service/meta.pb.go | 65 ++- service/meta.proto | 2 + service/verify.pb.go | 856 ++++++++++++++++++++++++++++++++------- service/verify.proto | 73 +++- session/service.pb.go | 75 ++-- session/service.proto | 9 +- session/types.pb.go | 913 ------------------------------------------ session/types.proto | 35 -- 13 files changed, 1003 insertions(+), 1524 deletions(-) delete mode 100644 session/types.pb.go delete mode 100644 session/types.proto diff --git a/Makefile b/Makefile index 29f41bc..9773c9b 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -PROTO_VERSION=v0.7.1 +PROTO_VERSION=v0.7.2 PROTO_URL=https://github.com/nspcc-dev/neofs-api/archive/$(PROTO_VERSION).tar.gz B=\033[0;1m diff --git a/object/service.pb.go b/object/service.pb.go index 4ac61bc..f882f5e 100644 --- a/object/service.pb.go +++ b/object/service.pb.go @@ -10,7 +10,6 @@ import ( proto "github.com/golang/protobuf/proto" refs "github.com/nspcc-dev/neofs-api-go/refs" service "github.com/nspcc-dev/neofs-api-go/service" - session "github.com/nspcc-dev/neofs-api-go/session" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" @@ -33,8 +32,6 @@ const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package type GetRequest struct { // Address of object (container id + object id) Address refs.Address `protobuf:"bytes,1,opt,name=Address,proto3" json:"Address"` - // Raw is the request flag of a physically stored representation of an object - Raw bool `protobuf:"varint,2,opt,name=Raw,proto3" json:"Raw,omitempty"` // RequestMetaHeader contains information about request meta headers (should be embedded into message) service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) @@ -80,13 +77,6 @@ func (m *GetRequest) GetAddress() refs.Address { return refs.Address{} } -func (m *GetRequest) GetRaw() bool { - if m != nil { - return m.Raw - } - return false -} - type GetResponse struct { // Types that are valid to be assigned to R: // *GetResponse_Object @@ -264,10 +254,8 @@ func (*PutRequest) XXX_OneofWrappers() []interface{} { type PutRequest_PutHeader struct { // Object with at least container id and owner id fields Object *Object `protobuf:"bytes,1,opt,name=Object,proto3" json:"Object,omitempty"` - // Token with session public key and user's signature - Token *session.Token `protobuf:"bytes,2,opt,name=Token,proto3" json:"Token,omitempty"` // Number of the object copies to store within the RPC call (zero is processed according to the placement rules) - CopiesNumber uint32 `protobuf:"varint,3,opt,name=CopiesNumber,proto3" json:"CopiesNumber,omitempty"` + CopiesNumber uint32 `protobuf:"varint,2,opt,name=CopiesNumber,proto3" json:"CopiesNumber,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -309,13 +297,6 @@ func (m *PutRequest_PutHeader) GetObject() *Object { return nil } -func (m *PutRequest_PutHeader) GetToken() *session.Token { - if m != nil { - return m.Token - } - return nil -} - func (m *PutRequest_PutHeader) GetCopiesNumber() uint32 { if m != nil { return m.CopiesNumber @@ -374,8 +355,6 @@ type DeleteRequest struct { Address refs.Address `protobuf:"bytes,1,opt,name=Address,proto3" json:"Address"` // OwnerID is a wallet address OwnerID OwnerID `protobuf:"bytes,2,opt,name=OwnerID,proto3,customtype=OwnerID" json:"OwnerID"` - // Token with session public key and user's signature - Token *session.Token `protobuf:"bytes,3,opt,name=Token,proto3" json:"Token,omitempty"` // RequestMetaHeader contains information about request meta headers (should be embedded into message) service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) @@ -421,13 +400,6 @@ func (m *DeleteRequest) GetAddress() refs.Address { return refs.Address{} } -func (m *DeleteRequest) GetToken() *session.Token { - if m != nil { - return m.Token - } - return nil -} - // DeleteResponse is empty because we cannot guarantee permanent object removal // in distributed system. type DeleteResponse struct { @@ -472,8 +444,6 @@ type HeadRequest struct { Address Address `protobuf:"bytes,1,opt,name=Address,proto3,customtype=Address" json:"Address"` // FullHeaders can be set true for extended headers in the object FullHeaders bool `protobuf:"varint,2,opt,name=FullHeaders,proto3" json:"FullHeaders,omitempty"` - // Raw is the request flag of a physically stored representation of an object - Raw bool `protobuf:"varint,3,opt,name=Raw,proto3" json:"Raw,omitempty"` // RequestMetaHeader contains information about request meta headers (should be embedded into message) service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) @@ -519,13 +489,6 @@ func (m *HeadRequest) GetFullHeaders() bool { return false } -func (m *HeadRequest) GetRaw() bool { - if m != nil { - return m.Raw - } - return false -} - type HeadResponse struct { // Object without payload Object *Object `protobuf:"bytes,1,opt,name=Object,proto3" json:"Object,omitempty"` @@ -906,65 +869,62 @@ func init() { func init() { proto.RegisterFile("object/service.proto", fileDescriptor_dfcdf610ade6a9ce) } var fileDescriptor_dfcdf610ade6a9ce = []byte{ - // 924 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x57, 0xcf, 0x6f, 0x1b, 0x45, - 0x14, 0xce, 0x78, 0x9d, 0x4d, 0xfa, 0x6c, 0xa7, 0xd1, 0xc4, 0x14, 0x6b, 0x5b, 0x39, 0x91, 0x55, - 0x21, 0x23, 0xe4, 0x75, 0x28, 0x12, 0x94, 0x13, 0xaa, 0x13, 0xa5, 0x89, 0x10, 0x4d, 0x3a, 0x41, - 0x3d, 0x70, 0x5b, 0x6f, 0x5e, 0x9c, 0xa5, 0xc9, 0xae, 0xbb, 0xb3, 0x9b, 0x28, 0x07, 0xb8, 0x71, - 0xee, 0x95, 0x23, 0x67, 0xfe, 0x92, 0x5e, 0x90, 0x7a, 0x44, 0x1c, 0xa2, 0x2a, 0x1c, 0xf9, 0x07, - 0x90, 0xb8, 0xa0, 0xf9, 0xb5, 0x3f, 0x52, 0x12, 0xc0, 0x3e, 0xb8, 0x27, 0xcf, 0x7c, 0xef, 0x7b, - 0x6f, 0xe6, 0x7d, 0xf3, 0xe6, 0x8d, 0x17, 0x9a, 0xd1, 0xf0, 0x5b, 0xf4, 0x93, 0x3e, 0xc7, 0xf8, - 0x34, 0xf0, 0xd1, 0x1d, 0xc7, 0x51, 0x12, 0x51, 0x5b, 0xa1, 0xce, 0x72, 0x8c, 0x87, 0xbc, 0x9f, - 0x9c, 0x8f, 0x91, 0x2b, 0x8b, 0x43, 0x35, 0xbf, 0x88, 0xad, 0x70, 0xe4, 0x3c, 0x88, 0xc2, 0x32, - 0x51, 0x47, 0xec, 0x9f, 0x60, 0xe2, 0x69, 0xac, 0x69, 0xb0, 0x53, 0x8c, 0x83, 0xc3, 0x73, 0x8d, - 0xf6, 0x46, 0x41, 0x72, 0x94, 0x0e, 0x5d, 0x3f, 0x3a, 0xe9, 0x8f, 0xa2, 0x51, 0xd4, 0x97, 0xf0, - 0x30, 0x3d, 0x94, 0x33, 0x39, 0x91, 0x23, 0x45, 0xef, 0xfc, 0x42, 0x00, 0x1e, 0x63, 0xc2, 0xf0, - 0x45, 0x8a, 0x3c, 0xa1, 0x3d, 0x58, 0x78, 0x74, 0x70, 0x10, 0x23, 0xe7, 0x2d, 0xb2, 0x46, 0xba, - 0xb5, 0x07, 0x0d, 0x57, 0x6c, 0xda, 0xd5, 0xe0, 0xa0, 0xfa, 0xea, 0x62, 0x75, 0x8e, 0x19, 0x0e, - 0x5d, 0x06, 0x8b, 0x79, 0x67, 0xad, 0xca, 0x1a, 0xe9, 0x2e, 0x32, 0x31, 0xa4, 0x0f, 0xa1, 0xfa, - 0x15, 0x26, 0x5e, 0x6b, 0x28, 0xbd, 0x1d, 0xd7, 0x28, 0xa1, 0x17, 0x10, 0xb6, 0x6d, 0xf4, 0x0e, - 0x30, 0x1e, 0x2c, 0x8a, 0x50, 0xaf, 0x2f, 0x56, 0x09, 0x93, 0x1e, 0x74, 0x13, 0xec, 0x67, 0x32, - 0x91, 0x96, 0x2f, 0x7d, 0x3b, 0x57, 0x7d, 0xa5, 0x35, 0xf0, 0xbd, 0x24, 0x88, 0xc2, 0xb7, 0x62, - 0x68, 0xdf, 0xce, 0x4b, 0x02, 0x35, 0x99, 0x0f, 0x1f, 0x47, 0x21, 0x47, 0xda, 0x05, 0xad, 0xbe, - 0xce, 0x67, 0xc9, 0x55, 0x53, 0x77, 0x57, 0xfe, 0x6c, 0xcf, 0x31, 0x6d, 0xa7, 0x77, 0x60, 0x7e, - 0xe3, 0x28, 0x0d, 0x9f, 0xcb, 0x6c, 0xea, 0xdb, 0x73, 0x4c, 0x4d, 0xe9, 0xe7, 0x3a, 0x23, 0xb5, - 0xab, 0xbb, 0x85, 0x5d, 0xa9, 0x25, 0xae, 0x4f, 0x69, 0x60, 0x01, 0x61, 0x9d, 0x37, 0x15, 0x80, - 0xbd, 0x34, 0x53, 0xf8, 0x53, 0xb0, 0x15, 0x5b, 0x6f, 0xe8, 0x9e, 0xd9, 0x50, 0xce, 0x11, 0x43, - 0xc5, 0x11, 0xdb, 0x53, 0xa3, 0x6b, 0xb7, 0x37, 0x63, 0xc1, 0x9d, 0xef, 0xe0, 0x56, 0xb6, 0x5d, - 0xfa, 0x01, 0xd8, 0xbb, 0x37, 0xa8, 0xcd, 0xb4, 0x95, 0xde, 0x87, 0xf9, 0xaf, 0xa3, 0xe7, 0x18, - 0xca, 0x64, 0x04, 0x4d, 0xd7, 0xbc, 0x2b, 0x51, 0xa6, 0x8c, 0xb4, 0x03, 0xf5, 0x8d, 0x68, 0x1c, - 0x20, 0x7f, 0x92, 0x9e, 0x0c, 0x31, 0x6e, 0x59, 0x6b, 0xa4, 0xdb, 0x60, 0x25, 0x4c, 0x49, 0x7c, - 0x06, 0x35, 0xa9, 0x9e, 0x3e, 0xf3, 0xff, 0x59, 0xc4, 0x93, 0x1f, 0x70, 0xe7, 0x65, 0x05, 0x1a, - 0x9b, 0x78, 0x8c, 0x09, 0x4e, 0x78, 0x81, 0x3e, 0x84, 0x85, 0xdd, 0xb3, 0x10, 0xe3, 0x9d, 0x4d, - 0x75, 0xae, 0x83, 0xdb, 0xc2, 0xfe, 0xdb, 0xc5, 0xaa, 0x81, 0x99, 0x19, 0xe4, 0x9a, 0x59, 0x37, - 0x69, 0x36, 0xeb, 0xfb, 0xf7, 0x25, 0x2c, 0x19, 0x41, 0xf4, 0x69, 0x4c, 0x21, 0xef, 0x5f, 0x04, - 0x6a, 0xc2, 0x64, 0xc4, 0x7d, 0xf8, 0x2f, 0xe2, 0x66, 0xe2, 0x69, 0x20, 0xd7, 0x79, 0x0d, 0x6a, - 0x5b, 0xe9, 0xf1, 0xb1, 0x5a, 0x87, 0xeb, 0x86, 0x55, 0x84, 0x4c, 0x2b, 0xb3, 0xde, 0x9d, 0x56, - 0xf6, 0x02, 0xea, 0x2a, 0x79, 0x2d, 0xe4, 0x7f, 0xbd, 0x5c, 0x53, 0x08, 0xfe, 0x27, 0x81, 0xc6, - 0x3e, 0x7a, 0xb1, 0x7f, 0x94, 0xd7, 0x73, 0x6d, 0x23, 0x0a, 0x13, 0x2f, 0x50, 0x45, 0x4a, 0x64, - 0x91, 0xd6, 0xb4, 0xce, 0xd6, 0xc6, 0xce, 0x26, 0x2b, 0xda, 0x69, 0x13, 0xe6, 0x9f, 0xa6, 0x18, - 0x9f, 0xab, 0x6a, 0x66, 0x6a, 0x22, 0x2e, 0xb2, 0x1c, 0x3c, 0xc3, 0x58, 0x54, 0xac, 0xb9, 0xc8, - 0x45, 0x6c, 0xe6, 0x6a, 0x7f, 0x0f, 0x4b, 0x26, 0x73, 0xad, 0xf7, 0xc7, 0x70, 0x4b, 0x97, 0x0f, - 0x8a, 0x7a, 0xb3, 0xae, 0xbb, 0xcc, 0x39, 0x6b, 0x1a, 0xe9, 0xff, 0x20, 0x70, 0x5b, 0x3c, 0x5c, - 0x5e, 0x38, 0x9a, 0xbc, 0x99, 0xcc, 0x4b, 0x77, 0xdd, 0x55, 0x1b, 0xa6, 0x3e, 0x24, 0xa8, 0xc9, - 0x8a, 0x31, 0x73, 0xb5, 0x03, 0x58, 0xce, 0x93, 0xd5, 0x7a, 0x3b, 0xb0, 0xb8, 0x15, 0x7b, 0xa3, - 0x13, 0x0c, 0x55, 0x85, 0xd7, 0x59, 0x36, 0x9f, 0x46, 0xd8, 0x1f, 0x2a, 0xb0, 0x62, 0xd6, 0xda, - 0xf6, 0xf8, 0xd1, 0x84, 0xe2, 0x7e, 0x04, 0xb6, 0x0c, 0x21, 0x9a, 0x87, 0x75, 0x9d, 0xba, 0x9a, - 0x42, 0x29, 0x54, 0xf7, 0xbd, 0xe3, 0x44, 0x16, 0x7a, 0x9d, 0xc9, 0xf1, 0xcc, 0x25, 0x3f, 0x83, - 0x66, 0x59, 0x06, 0x2d, 0xfb, 0x7d, 0xb0, 0xc5, 0x5c, 0xd7, 0x78, 0x7d, 0x50, 0xd7, 0x97, 0xbb, - 0x2a, 0x59, 0xda, 0x36, 0xc5, 0x01, 0x3c, 0xf8, 0xc9, 0x82, 0x85, 0x7d, 0x45, 0xa7, 0xeb, 0x60, - 0x3d, 0xc6, 0x84, 0x52, 0x23, 0x5e, 0xfe, 0xd7, 0xd3, 0x59, 0x29, 0x61, 0x2a, 0xea, 0x3a, 0x11, - 0x1e, 0x7b, 0x69, 0xc1, 0x23, 0xff, 0x9b, 0x94, 0x7b, 0x14, 0x1e, 0xff, 0x2e, 0xa1, 0x9f, 0x81, - 0xad, 0x9e, 0x20, 0xfa, 0x9e, 0x21, 0x94, 0xde, 0x68, 0xe7, 0xce, 0x55, 0x38, 0xbb, 0xf0, 0x55, - 0x91, 0x02, 0xcd, 0xe2, 0x16, 0xde, 0x1e, 0xa7, 0x59, 0x06, 0xb3, 0xc7, 0xcd, 0x56, 0x5d, 0x23, - 0x5f, 0xab, 0xd4, 0x3f, 0xf3, 0xb5, 0xca, 0xcd, 0x65, 0x9d, 0xd0, 0x2f, 0x60, 0xd1, 0x9c, 0x07, - 0x7d, 0xbf, 0x98, 0x7b, 0xa1, 0x03, 0x38, 0xad, 0xb7, 0x0d, 0x59, 0x80, 0x1d, 0xa8, 0x17, 0x0f, - 0x94, 0xde, 0xbd, 0xca, 0x2d, 0x54, 0xbb, 0x73, 0xef, 0x9f, 0x8d, 0x2a, 0xd8, 0xe0, 0xe9, 0xab, - 0xcb, 0x36, 0x79, 0x7d, 0xd9, 0x26, 0xbf, 0x5e, 0xb6, 0xc9, 0x9b, 0xcb, 0x36, 0xf9, 0xf1, 0xf7, - 0xf6, 0xdc, 0x37, 0xdd, 0xc2, 0xa7, 0x44, 0xc8, 0xc7, 0xbe, 0xdf, 0x3b, 0xc0, 0xd3, 0x7e, 0x88, - 0xd1, 0x21, 0xef, 0x79, 0xe3, 0xa0, 0x37, 0x8a, 0xfa, 0x2a, 0xe8, 0xcf, 0x95, 0xe5, 0x27, 0x18, - 0x6d, 0xed, 0xbb, 0x8f, 0xf6, 0x76, 0xf4, 0x6b, 0x34, 0xb4, 0xe5, 0xf7, 0xc5, 0x27, 0x7f, 0x07, - 0x00, 0x00, 0xff, 0xff, 0xb3, 0xf2, 0x5d, 0xaf, 0x13, 0x0d, 0x00, 0x00, + // 876 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x56, 0x4b, 0x6f, 0x22, 0x47, + 0x10, 0xa6, 0x01, 0x8f, 0x71, 0x31, 0xd8, 0x56, 0x9b, 0x38, 0x68, 0x6c, 0x61, 0x0b, 0x45, 0x11, + 0x51, 0xc4, 0xe0, 0x38, 0x52, 0xe2, 0x9c, 0x22, 0x03, 0xb2, 0x41, 0x51, 0xfc, 0x18, 0x24, 0x47, + 0xca, 0x6d, 0x18, 0x1a, 0x98, 0x04, 0x66, 0xf0, 0x3c, 0x6c, 0xf9, 0x92, 0x5b, 0xce, 0xb9, 0xe6, + 0xb8, 0xe7, 0xfd, 0x09, 0xbb, 0x7f, 0xc0, 0x47, 0x1f, 0x57, 0x7b, 0xb0, 0x56, 0xec, 0x69, 0xb5, + 0x7f, 0x60, 0x8f, 0xab, 0xe9, 0xee, 0x79, 0xd9, 0xcb, 0x3e, 0xe0, 0xc0, 0x69, 0xba, 0xbf, 0xfa, + 0xaa, 0xba, 0xea, 0xeb, 0xea, 0xee, 0x81, 0xbc, 0xd9, 0xf9, 0x8b, 0x68, 0x4e, 0xd5, 0x26, 0xd6, + 0x95, 0xae, 0x11, 0x79, 0x6c, 0x99, 0x8e, 0x89, 0x05, 0x86, 0x4a, 0xeb, 0x16, 0xe9, 0xd9, 0x55, + 0xe7, 0x66, 0x4c, 0x6c, 0x66, 0x91, 0x30, 0xe7, 0xc7, 0x30, 0xee, 0x5c, 0x1d, 0x11, 0x47, 0xe5, + 0x58, 0xde, 0xc7, 0xae, 0x88, 0xa5, 0xf7, 0x6e, 0x38, 0x5a, 0xe9, 0xeb, 0xce, 0xc0, 0xed, 0xc8, + 0x9a, 0x39, 0xaa, 0xf6, 0xcd, 0xbe, 0x59, 0xa5, 0x70, 0xc7, 0xed, 0xd1, 0x19, 0x9d, 0xd0, 0x11, + 0xa3, 0x97, 0x9e, 0x23, 0x80, 0x63, 0xe2, 0x28, 0xe4, 0xd2, 0x25, 0xb6, 0x83, 0x2b, 0xb0, 0x7c, + 0xd8, 0xed, 0x5a, 0xc4, 0xb6, 0x0b, 0x68, 0x17, 0x95, 0xb3, 0xfb, 0x39, 0xd9, 0xcb, 0x4f, 0xe6, + 0x60, 0x2d, 0x7d, 0x7b, 0xbf, 0x93, 0x50, 0x7c, 0x0e, 0x3e, 0x80, 0xf4, 0xef, 0xc4, 0x51, 0x0b, + 0x1d, 0xca, 0x95, 0x64, 0xbf, 0x44, 0x1e, 0xce, 0xb3, 0x35, 0x89, 0xda, 0x25, 0x56, 0x2d, 0xe3, + 0x39, 0xde, 0xdd, 0xef, 0x20, 0x85, 0x7a, 0xe0, 0x06, 0x08, 0x17, 0x34, 0xed, 0x82, 0x46, 0x7d, + 0x4b, 0x0f, 0x7d, 0xa9, 0x55, 0xd7, 0x54, 0x47, 0x37, 0x8d, 0x47, 0x31, 0xb8, 0x6f, 0xe9, 0x3f, + 0x04, 0x59, 0x9a, 0xbd, 0x3d, 0x36, 0x0d, 0x9b, 0xe0, 0x32, 0x70, 0x59, 0x79, 0xf6, 0xab, 0x32, + 0x9b, 0xca, 0xa7, 0xf4, 0xd3, 0x4c, 0x28, 0xdc, 0x8e, 0x37, 0x61, 0xa9, 0x3e, 0x70, 0x8d, 0xbf, + 0x0b, 0xc9, 0x5d, 0x54, 0x16, 0x9b, 0x09, 0x85, 0x4d, 0xf1, 0x2f, 0xbc, 0x22, 0x96, 0xd5, 0x56, + 0x24, 0x2b, 0xb6, 0xc4, 0xf4, 0x92, 0x6a, 0x29, 0x40, 0x4a, 0xe9, 0x59, 0x12, 0xe0, 0xcc, 0x0d, + 0xf4, 0xfc, 0x09, 0x04, 0xc6, 0xe6, 0x09, 0x6d, 0xfb, 0x09, 0x85, 0x1c, 0x6f, 0xc8, 0x38, 0x5e, + 0x7a, 0x6c, 0x34, 0x35, 0xbd, 0x05, 0x0b, 0x2e, 0xfd, 0x01, 0x2b, 0x41, 0xba, 0xf8, 0x5b, 0x10, + 0x4e, 0x3f, 0xa2, 0xb6, 0xc2, 0xad, 0xb8, 0x04, 0x62, 0xdd, 0x1c, 0xeb, 0xc4, 0x3e, 0x71, 0x47, + 0x1d, 0x62, 0xd1, 0x9a, 0x72, 0x4a, 0x0c, 0x63, 0xe2, 0x5d, 0x43, 0x96, 0xea, 0xc2, 0x77, 0xf3, + 0x0b, 0x9b, 0x71, 0xf6, 0xad, 0x2b, 0xbd, 0x41, 0x90, 0x6b, 0x90, 0x21, 0x71, 0xc8, 0x8c, 0x07, + 0xe1, 0x3b, 0x58, 0x3e, 0xbd, 0x36, 0x88, 0xd5, 0x6a, 0xb0, 0x1d, 0xab, 0xad, 0x79, 0xf6, 0x97, + 0xf7, 0x3b, 0x3e, 0xac, 0xf8, 0x83, 0x85, 0x9f, 0x99, 0xdf, 0x60, 0xd5, 0x2f, 0x95, 0xeb, 0x3c, + 0x9f, 0x70, 0x59, 0xcf, 0xe4, 0xcb, 0x76, 0xf0, 0x09, 0xd9, 0x02, 0x59, 0x38, 0x10, 0x2a, 0xb8, + 0x0b, 0xd9, 0x23, 0x77, 0x38, 0x64, 0xeb, 0xd8, 0x54, 0xc5, 0x8c, 0x12, 0x85, 0x16, 0x2e, 0xdc, + 0x25, 0x88, 0xac, 0x54, 0x2e, 0xdb, 0xe7, 0xb6, 0xff, 0x1c, 0xf2, 0xbe, 0x43, 0x90, 0x6b, 0x13, + 0xd5, 0xd2, 0x06, 0x61, 0x5f, 0x66, 0xeb, 0xa6, 0xe1, 0xa8, 0x3a, 0x6b, 0x36, 0x44, 0x9b, 0x2d, + 0xcb, 0x55, 0x4d, 0xd5, 0x5b, 0x0d, 0x25, 0x6a, 0xc7, 0x79, 0x58, 0x3a, 0x77, 0x89, 0x75, 0xc3, + 0xba, 0x52, 0x61, 0x13, 0xef, 0x40, 0xd2, 0xc1, 0x05, 0xb1, 0x6c, 0xdd, 0x34, 0x0a, 0x29, 0x76, + 0x20, 0xa3, 0xd8, 0xc2, 0xd5, 0xfe, 0x07, 0x56, 0xfd, 0xca, 0xb9, 0xde, 0x3f, 0xc0, 0x0a, 0x6f, + 0x16, 0xe2, 0x75, 0x57, 0x6a, 0xda, 0xa1, 0x0c, 0x59, 0xf3, 0x48, 0xff, 0x16, 0xc1, 0x9a, 0xf7, + 0xb4, 0xa8, 0x46, 0x7f, 0xf6, 0x4b, 0x61, 0x89, 0xba, 0x53, 0xf1, 0x3d, 0x32, 0xef, 0x0f, 0x0a, + 0x72, 0x32, 0x63, 0x2c, 0x5c, 0x6d, 0x1d, 0xd6, 0xc3, 0x62, 0xb9, 0xde, 0x12, 0x64, 0x8e, 0x2c, + 0xb5, 0x3f, 0x22, 0x06, 0xeb, 0x70, 0x51, 0x09, 0xe6, 0xf3, 0x08, 0xfb, 0x6f, 0x12, 0x36, 0xfc, + 0xb5, 0x9a, 0xaa, 0x3d, 0x98, 0x51, 0xdc, 0xef, 0x41, 0xa0, 0x21, 0xbc, 0xab, 0x22, 0x35, 0x4d, + 0x5d, 0x4e, 0xc1, 0x18, 0xd2, 0x6d, 0x75, 0xe8, 0xd0, 0x46, 0x17, 0x15, 0x3a, 0x5e, 0xb8, 0xe4, + 0xd7, 0x90, 0x8f, 0xcb, 0xc0, 0x65, 0xff, 0x06, 0x04, 0x6f, 0xce, 0x7b, 0x5c, 0xac, 0x89, 0xfc, + 0x70, 0xa7, 0x29, 0x8b, 0xdb, 0xe6, 0xd8, 0x80, 0xfd, 0x27, 0x29, 0x58, 0x6e, 0x33, 0x3a, 0xde, + 0x83, 0xd4, 0x31, 0x71, 0x30, 0xf6, 0xc5, 0x0b, 0x7f, 0x05, 0xa5, 0x8d, 0x18, 0xc6, 0xa2, 0xee, + 0x21, 0xcf, 0xe3, 0xcc, 0x8d, 0x78, 0x84, 0x3f, 0x32, 0xa1, 0x47, 0xe4, 0x11, 0x2f, 0x23, 0xfc, + 0x33, 0x08, 0xec, 0xc1, 0xc1, 0x5f, 0xf9, 0x84, 0xd8, 0x5b, 0x2b, 0x6d, 0x3e, 0x84, 0x83, 0x03, + 0x9f, 0xf6, 0x4a, 0xc0, 0x41, 0xdc, 0xc8, 0x4b, 0x23, 0xe5, 0xe3, 0x60, 0xf0, 0x94, 0x09, 0xec, + 0xd6, 0x08, 0xd7, 0x8a, 0xdd, 0x9f, 0xe1, 0x5a, 0xf1, 0xcb, 0x65, 0x0f, 0xe1, 0x5f, 0x21, 0xe3, + 0xef, 0x07, 0xfe, 0x3a, 0x5a, 0x7b, 0xe4, 0x06, 0x90, 0x0a, 0x8f, 0x0d, 0x41, 0x80, 0x16, 0x88, + 0xd1, 0x0d, 0xc5, 0x5b, 0x0f, 0xb9, 0x91, 0x6e, 0x97, 0xb6, 0x3f, 0x6c, 0x64, 0xc1, 0x6a, 0xe7, + 0xb7, 0x93, 0x22, 0xba, 0x9b, 0x14, 0xd1, 0x8b, 0x49, 0x11, 0xbd, 0x9a, 0x14, 0xd1, 0xff, 0xaf, + 0x8b, 0x89, 0x3f, 0xcb, 0x91, 0x5f, 0x7b, 0xc3, 0x1e, 0x6b, 0x5a, 0xa5, 0x4b, 0xae, 0xaa, 0x06, + 0x31, 0x7b, 0x76, 0x45, 0x1d, 0xeb, 0x95, 0xbe, 0x59, 0x65, 0x41, 0x9f, 0x26, 0xd7, 0x4f, 0x88, + 0x79, 0xd4, 0x96, 0x0f, 0xcf, 0x5a, 0xfc, 0x35, 0xea, 0x08, 0xf4, 0x7f, 0xff, 0xc7, 0xf7, 0x01, + 0x00, 0x00, 0xff, 0xff, 0x71, 0xb8, 0x50, 0x3f, 0x8e, 0x0c, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1477,16 +1437,6 @@ func (m *GetRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x6 i-- dAtA[i] = 0x92 - if m.Raw { - i-- - if m.Raw { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x10 - } { size, err := m.Address.MarshalToSizedBuffer(dAtA[:i]) if err != nil { @@ -1709,19 +1659,7 @@ func (m *PutRequest_PutHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) { if m.CopiesNumber != 0 { i = encodeVarintService(dAtA, i, uint64(m.CopiesNumber)) i-- - dAtA[i] = 0x18 - } - if m.Token != nil { - { - size, err := m.Token.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 + dAtA[i] = 0x10 } if m.Object != nil { { @@ -1835,18 +1773,6 @@ func (m *DeleteRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x6 i-- dAtA[i] = 0x92 - if m.Token != nil { - { - size, err := m.Token.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } { size := m.OwnerID.Size() i -= size @@ -1957,16 +1883,6 @@ func (m *HeadRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x6 i-- dAtA[i] = 0x92 - if m.Raw { - i-- - if m.Raw { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x18 - } if m.FullHeaders { i-- if m.FullHeaders { @@ -2438,9 +2354,6 @@ func (m *GetRequest) Size() (n int) { _ = l l = m.Address.Size() n += 1 + l + sovService(uint64(l)) - if m.Raw { - n += 2 - } l = m.RequestMetaHeader.Size() n += 2 + l + sovService(uint64(l)) l = m.RequestVerificationHeader.Size() @@ -2545,10 +2458,6 @@ func (m *PutRequest_PutHeader) Size() (n int) { l = m.Object.Size() n += 1 + l + sovService(uint64(l)) } - if m.Token != nil { - l = m.Token.Size() - n += 1 + l + sovService(uint64(l)) - } if m.CopiesNumber != 0 { n += 1 + sovService(uint64(m.CopiesNumber)) } @@ -2584,10 +2493,6 @@ func (m *DeleteRequest) Size() (n int) { n += 1 + l + sovService(uint64(l)) l = m.OwnerID.Size() n += 1 + l + sovService(uint64(l)) - if m.Token != nil { - l = m.Token.Size() - n += 1 + l + sovService(uint64(l)) - } l = m.RequestMetaHeader.Size() n += 2 + l + sovService(uint64(l)) l = m.RequestVerificationHeader.Size() @@ -2623,9 +2528,6 @@ func (m *HeadRequest) Size() (n int) { if m.FullHeaders { n += 2 } - if m.Raw { - n += 2 - } l = m.RequestMetaHeader.Size() n += 2 + l + sovService(uint64(l)) l = m.RequestVerificationHeader.Size() @@ -2853,26 +2755,6 @@ func (m *GetRequest) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Raw", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Raw = bool(v != 0) case 98: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType) @@ -3373,42 +3255,6 @@ func (m *PutRequest_PutHeader) Unmarshal(dAtA []byte) error { } iNdEx = postIndex case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Token", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Token == nil { - m.Token = &session.Token{} - } - if err := m.Token.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field CopiesNumber", wireType) } @@ -3667,42 +3513,6 @@ func (m *DeleteRequest) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Token", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Token == nil { - m.Token = &session.Token{} - } - if err := m.Token.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex case 98: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType) @@ -3963,26 +3773,6 @@ func (m *HeadRequest) Unmarshal(dAtA []byte) error { } } m.FullHeaders = bool(v != 0) - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Raw", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Raw = bool(v != 0) case 98: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType) diff --git a/object/service.proto b/object/service.proto index b5042e2..91d0b99 100644 --- a/object/service.proto +++ b/object/service.proto @@ -5,7 +5,6 @@ option csharp_namespace = "NeoFS.API.Object"; import "refs/types.proto"; import "object/types.proto"; -import "session/types.proto"; import "service/meta.proto"; import "service/verify.proto"; import "github.com/gogo/protobuf/gogoproto/gogo.proto"; @@ -58,8 +57,6 @@ service Service { message GetRequest { // Address of object (container id + object id) refs.Address Address = 1 [(gogoproto.nullable) = false]; - // Raw is the request flag of a physically stored representation of an object - bool Raw = 2; // RequestMetaHeader contains information about request meta headers (should be embedded into message) service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) @@ -82,10 +79,8 @@ message PutRequest { message PutHeader { // Object with at least container id and owner id fields Object Object = 1; - // Token with session public key and user's signature - session.Token Token = 2; // Number of the object copies to store within the RPC call (zero is processed according to the placement rules) - uint32 CopiesNumber = 3; + uint32 CopiesNumber = 2; } oneof R { @@ -112,8 +107,6 @@ message DeleteRequest { refs.Address Address = 1 [(gogoproto.nullable) = false]; // OwnerID is a wallet address bytes OwnerID = 2 [(gogoproto.nullable) = false, (gogoproto.customtype) = "OwnerID"]; - // Token with session public key and user's signature - session.Token Token = 3; // RequestMetaHeader contains information about request meta headers (should be embedded into message) service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) @@ -132,8 +125,6 @@ message HeadRequest { refs.Address Address = 1 [(gogoproto.nullable) = false, (gogoproto.customtype) = "Address"]; // FullHeaders can be set true for extended headers in the object bool FullHeaders = 2; - // Raw is the request flag of a physically stored representation of an object - bool Raw = 3; // RequestMetaHeader contains information about request meta headers (should be embedded into message) service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) diff --git a/object/types.pb.go b/object/types.pb.go index fe47459..a24a2f1 100644 --- a/object/types.pb.go +++ b/object/types.pb.go @@ -8,7 +8,7 @@ import ( _ "github.com/gogo/protobuf/gogoproto" proto "github.com/golang/protobuf/proto" refs "github.com/nspcc-dev/neofs-api-go/refs" - session "github.com/nspcc-dev/neofs-api-go/session" + service "github.com/nspcc-dev/neofs-api-go/service" storagegroup "github.com/nspcc-dev/neofs-api-go/storagegroup" io "io" math "math" @@ -215,7 +215,7 @@ type Header struct { // *Header_UserHeader // *Header_Transform // *Header_Tombstone - // *Header_Verify + // *Header_Token // *Header_HomoHash // *Header_PayloadChecksum // *Header_Integrity @@ -277,8 +277,8 @@ type Header_Transform struct { type Header_Tombstone struct { Tombstone *Tombstone `protobuf:"bytes,5,opt,name=Tombstone,proto3,oneof" json:"Tombstone,omitempty"` } -type Header_Verify struct { - Verify *session.VerificationHeader `protobuf:"bytes,6,opt,name=Verify,proto3,oneof" json:"Verify,omitempty"` +type Header_Token struct { + Token *service.Token `protobuf:"bytes,6,opt,name=Token,proto3,oneof" json:"Token,omitempty"` } type Header_HomoHash struct { HomoHash Hash `protobuf:"bytes,7,opt,name=HomoHash,proto3,oneof,customtype=Hash" json:"HomoHash,omitempty"` @@ -301,7 +301,7 @@ func (*Header_Redirect) isHeader_Value() {} func (*Header_UserHeader) isHeader_Value() {} func (*Header_Transform) isHeader_Value() {} func (*Header_Tombstone) isHeader_Value() {} -func (*Header_Verify) isHeader_Value() {} +func (*Header_Token) isHeader_Value() {} func (*Header_HomoHash) isHeader_Value() {} func (*Header_PayloadChecksum) isHeader_Value() {} func (*Header_Integrity) isHeader_Value() {} @@ -350,9 +350,9 @@ func (m *Header) GetTombstone() *Tombstone { return nil } -func (m *Header) GetVerify() *session.VerificationHeader { - if x, ok := m.GetValue().(*Header_Verify); ok { - return x.Verify +func (m *Header) GetToken() *service.Token { + if x, ok := m.GetValue().(*Header_Token); ok { + return x.Token } return nil } @@ -393,7 +393,7 @@ func (*Header) XXX_OneofWrappers() []interface{} { (*Header_UserHeader)(nil), (*Header_Transform)(nil), (*Header_Tombstone)(nil), - (*Header_Verify)(nil), + (*Header_Token)(nil), (*Header_HomoHash)(nil), (*Header_PayloadChecksum)(nil), (*Header_Integrity)(nil), @@ -826,64 +826,64 @@ func init() { func init() { proto.RegisterFile("object/types.proto", fileDescriptor_02021a1d39b1aee0) } var fileDescriptor_02021a1d39b1aee0 = []byte{ - // 911 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x55, 0x4f, 0x73, 0x1b, 0x35, - 0x14, 0xf7, 0xda, 0xeb, 0x7f, 0xcf, 0x9b, 0x66, 0x2b, 0x4a, 0xd9, 0x31, 0x83, 0x13, 0x76, 0x80, - 0x31, 0x85, 0xac, 0x87, 0x14, 0xa6, 0xc3, 0x85, 0x21, 0x8e, 0x01, 0x7b, 0x28, 0x8d, 0x91, 0x93, - 0x1c, 0xb8, 0xad, 0x6d, 0x79, 0x2d, 0x62, 0x4b, 0x1e, 0x49, 0x6e, 0xeb, 0xaf, 0xc1, 0x89, 0x1b, - 0x77, 0xbe, 0x00, 0x5f, 0xa1, 0x47, 0x8e, 0x4c, 0x0f, 0x19, 0x26, 0x7c, 0x00, 0xbe, 0x42, 0x47, - 0xda, 0x5d, 0x7b, 0x37, 0xcd, 0xc5, 0xa3, 0xf7, 0x7e, 0xbf, 0x9f, 0xfc, 0xf4, 0xf4, 0x7b, 0x5a, - 0x40, 0x7c, 0xfc, 0x2b, 0x99, 0xa8, 0x8e, 0xda, 0xac, 0x88, 0x0c, 0x56, 0x82, 0x2b, 0x8e, 0x2a, - 0x71, 0xae, 0xe9, 0x0a, 0x32, 0x93, 0x59, 0xa4, 0xf9, 0x8e, 0x24, 0x52, 0x52, 0xce, 0x72, 0x49, - 0x4f, 0x2a, 0x2e, 0xc2, 0x88, 0x44, 0x82, 0xaf, 0x57, 0x39, 0xe4, 0x28, 0xa2, 0x6a, 0xbe, 0x1e, - 0x07, 0x13, 0xbe, 0xec, 0x44, 0x3c, 0xe2, 0x1d, 0x93, 0x1e, 0xaf, 0x67, 0x26, 0x32, 0x81, 0x59, - 0xc5, 0x74, 0xff, 0x09, 0x94, 0x71, 0xc8, 0x22, 0x82, 0x1e, 0x42, 0xe5, 0x6c, 0x36, 0x93, 0x44, - 0x79, 0xd6, 0xa1, 0xd5, 0xb6, 0x71, 0x12, 0xe9, 0xfc, 0x53, 0xc2, 0x22, 0x35, 0xf7, 0x8a, 0x71, - 0x3e, 0x8e, 0xfc, 0x2f, 0x01, 0x2e, 0x24, 0x11, 0x7d, 0x12, 0x4e, 0x89, 0x40, 0x2e, 0x94, 0x7e, - 0x24, 0x1b, 0x23, 0xad, 0x63, 0xbd, 0x44, 0x0f, 0xa0, 0x7c, 0x19, 0x2e, 0xd6, 0xc4, 0xc8, 0xea, - 0x38, 0x0e, 0xfc, 0xbf, 0x6c, 0xa8, 0x24, 0x12, 0x1f, 0xec, 0xa7, 0x94, 0x5d, 0x19, 0x4d, 0xe3, - 0xd8, 0x09, 0xe2, 0x06, 0x04, 0x3a, 0xd7, 0x2f, 0x60, 0x83, 0xa1, 0xcf, 0xa0, 0x86, 0xc9, 0x94, - 0x0a, 0x32, 0x51, 0x66, 0x9f, 0xc6, 0xf1, 0x5e, 0xa0, 0x1b, 0x14, 0x9c, 0x4c, 0xa7, 0x82, 0x48, - 0xd9, 0x2f, 0xe0, 0x2d, 0x01, 0xe5, 0x2a, 0xf2, 0x4a, 0x86, 0x8e, 0xd2, 0x6d, 0x77, 0x48, 0xbf, - 0x80, 0xb3, 0x95, 0x7f, 0x01, 0xf5, 0x73, 0x11, 0x32, 0x39, 0xe3, 0x62, 0xe9, 0xd9, 0x46, 0x74, - 0x3f, 0x15, 0x6d, 0x81, 0x7e, 0x01, 0xef, 0x58, 0x46, 0xc2, 0x97, 0x63, 0xa9, 0x38, 0x23, 0x5e, - 0xf9, 0x96, 0x24, 0x05, 0x8c, 0x24, 0x0d, 0xd0, 0x57, 0x50, 0xb9, 0x24, 0x82, 0xce, 0x36, 0x5e, - 0xc5, 0xf0, 0xdf, 0x0f, 0x92, 0x5b, 0x0d, 0x4c, 0x9a, 0x4e, 0x42, 0x45, 0x39, 0xdb, 0x16, 0x98, - 0x90, 0xd1, 0x27, 0x50, 0xeb, 0xf3, 0x25, 0xef, 0x87, 0x72, 0xee, 0x55, 0x0f, 0xad, 0xb6, 0xd3, - 0xad, 0xbd, 0xbe, 0x3e, 0xb0, 0x75, 0xac, 0x8f, 0x9e, 0x62, 0xe8, 0x11, 0xec, 0x0f, 0xc3, 0xcd, - 0x82, 0x87, 0xd3, 0xd3, 0x39, 0x99, 0x5c, 0xc9, 0xf5, 0xd2, 0xab, 0x69, 0x7a, 0xbf, 0x80, 0x6f, - 0x03, 0xe8, 0x09, 0xd4, 0x07, 0x4c, 0x91, 0x48, 0x50, 0xb5, 0xf1, 0xea, 0xa6, 0x9a, 0xf7, 0xd2, - 0xea, 0xb7, 0xc0, 0xb6, 0x92, 0x1d, 0x17, 0x7d, 0x0b, 0xce, 0x28, 0x76, 0xdd, 0x0f, 0xda, 0x75, - 0x1e, 0x18, 0x6d, 0x33, 0xc8, 0x5a, 0x31, 0xc8, 0x32, 0xfa, 0x05, 0x9c, 0x53, 0xe8, 0xc6, 0x0d, - 0xd7, 0xe3, 0x05, 0x9d, 0x68, 0xaf, 0x34, 0xf2, 0x8d, 0xdb, 0x02, 0xfa, 0x4f, 0xb7, 0x41, 0xb7, - 0x9a, 0xd8, 0xc8, 0x6f, 0x64, 0x9a, 0xee, 0xff, 0x6f, 0x81, 0x33, 0xda, 0x48, 0x45, 0x96, 0xc9, - 0x2d, 0x7a, 0x50, 0xbd, 0x24, 0x42, 0x37, 0x34, 0xb1, 0x6f, 0x1a, 0xa2, 0x8f, 0x60, 0x2f, 0xe9, - 0x40, 0xce, 0xc6, 0xf9, 0x24, 0x6a, 0x42, 0x71, 0xd0, 0x33, 0x9e, 0x71, 0xba, 0xf0, 0xea, 0xfa, - 0xa0, 0xf0, 0xfa, 0xfa, 0xa0, 0x38, 0xe8, 0xe1, 0xe2, 0xa0, 0x87, 0x3e, 0x85, 0xea, 0xd9, 0x0b, - 0x46, 0xc4, 0xa0, 0x67, 0xfc, 0xe1, 0x74, 0xf7, 0x13, 0x42, 0x9a, 0xc6, 0xe9, 0x02, 0x7d, 0x00, - 0xa5, 0xd3, 0x41, 0xcf, 0x78, 0xc2, 0xe9, 0x36, 0x12, 0x9a, 0x4e, 0x61, 0xfd, 0x83, 0xbe, 0x86, - 0xfa, 0xa9, 0x20, 0xa1, 0x22, 0xd3, 0x13, 0x95, 0x18, 0xe1, 0xdd, 0xf4, 0xfc, 0x06, 0xa0, 0x9c, - 0x0d, 0x39, 0x65, 0xaa, 0x6b, 0x6b, 0x2d, 0xde, 0xb1, 0xfd, 0x13, 0xd8, 0xcb, 0x31, 0x50, 0x13, - 0x6a, 0x17, 0x8c, 0xbe, 0x3c, 0xa7, 0x4b, 0x62, 0x8e, 0x5c, 0xc2, 0xdb, 0x58, 0xcf, 0xde, 0x77, - 0x2b, 0x3e, 0x49, 0xcf, 0x1a, 0x07, 0x3e, 0x85, 0xfd, 0x5b, 0xf7, 0x8b, 0xda, 0xb0, 0x1f, 0xaf, - 0xe4, 0xd6, 0x37, 0x7a, 0x2f, 0x07, 0xdf, 0x4e, 0xa3, 0xcf, 0xe1, 0x7e, 0xba, 0x1e, 0xd1, 0x88, - 0x85, 0x6a, 0x2d, 0xe2, 0xd1, 0x76, 0xf0, 0xdb, 0x80, 0xff, 0x87, 0x15, 0x0f, 0x37, 0xfa, 0x18, - 0x6c, 0xfd, 0x38, 0x99, 0x5d, 0xef, 0xed, 0x2e, 0x5b, 0x63, 0xc1, 0xf9, 0x66, 0x45, 0xb0, 0x81, - 0x93, 0xf6, 0x17, 0xef, 0x6a, 0xbf, 0x7f, 0x0e, 0xb6, 0x66, 0xa2, 0x06, 0x54, 0x2f, 0xd8, 0x15, - 0xe3, 0x2f, 0x98, 0x5b, 0x40, 0x00, 0x95, 0x61, 0x28, 0x08, 0x53, 0xae, 0x85, 0x1c, 0xa8, 0x0d, - 0x05, 0x79, 0x4e, 0xf9, 0x5a, 0xba, 0x45, 0x54, 0x03, 0xfb, 0x19, 0x79, 0xa9, 0xdc, 0x12, 0xaa, - 0x43, 0xf9, 0x74, 0x4e, 0x17, 0x53, 0xd7, 0x46, 0x6e, 0xde, 0xba, 0x6e, 0xd9, 0x5f, 0x64, 0xc6, - 0x1e, 0x3d, 0xca, 0x55, 0xf9, 0xf0, 0xad, 0xf1, 0xcf, 0x94, 0xea, 0x3f, 0xbe, 0xab, 0x9c, 0x3a, - 0x94, 0x47, 0xab, 0x05, 0xd5, 0xd5, 0xd4, 0xc0, 0xd6, 0x7d, 0x70, 0x8b, 0x3a, 0xf9, 0x13, 0x5f, - 0x2f, 0xa6, 0x6e, 0xc9, 0xff, 0xcd, 0x82, 0xca, 0x99, 0xd9, 0x14, 0x7d, 0x93, 0x77, 0x6e, 0xf2, - 0xfc, 0x3d, 0x48, 0xff, 0x33, 0x8b, 0x25, 0x2e, 0xc8, 0x3b, 0x3d, 0x80, 0x6a, 0x72, 0x37, 0x5e, - 0xf1, 0xb0, 0xd4, 0x6e, 0x1c, 0xdf, 0x4b, 0xa5, 0x39, 0x51, 0x4a, 0xd2, 0x93, 0x91, 0x58, 0x3d, - 0xb6, 0x37, 0x4e, 0x43, 0xff, 0xc3, 0xcc, 0x34, 0xee, 0x9e, 0xeb, 0xf8, 0xfe, 0xe3, 0xa0, 0xfb, - 0xf3, 0xab, 0x9b, 0x96, 0xf5, 0xf7, 0x4d, 0xcb, 0xfa, 0xe7, 0xa6, 0x65, 0xfd, 0x7b, 0xd3, 0xb2, - 0x7e, 0xff, 0xaf, 0x55, 0xf8, 0xa5, 0x9d, 0xf9, 0xc4, 0x30, 0xb9, 0x9a, 0x4c, 0x8e, 0xa6, 0xe4, - 0x79, 0x87, 0x11, 0x3e, 0x93, 0x47, 0xe1, 0x8a, 0x1e, 0x45, 0xbc, 0x13, 0x97, 0xf4, 0x67, 0xd1, - 0x7d, 0x46, 0xf8, 0xf7, 0xa3, 0xe0, 0x64, 0x38, 0x08, 0xe2, 0xf3, 0x8f, 0x2b, 0xe6, 0xbb, 0xf3, - 0xf8, 0x4d, 0x00, 0x00, 0x00, 0xff, 0xff, 0xee, 0xb1, 0xc7, 0x51, 0x05, 0x07, 0x00, 0x00, + // 909 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x55, 0x4f, 0x8f, 0xdb, 0x44, + 0x14, 0xb7, 0x13, 0xe7, 0xdf, 0x8b, 0xb7, 0xeb, 0x8e, 0x96, 0x62, 0xad, 0x44, 0x76, 0xb1, 0xa0, + 0x5a, 0x0a, 0xeb, 0x88, 0x16, 0xa9, 0xe2, 0x82, 0xd8, 0x6c, 0x00, 0x47, 0x94, 0x6e, 0x98, 0x64, + 0x7b, 0xe0, 0xe6, 0x24, 0x13, 0xc7, 0x6c, 0x32, 0x13, 0xcd, 0x8c, 0xb7, 0xcd, 0xd7, 0xe0, 0xc4, + 0x8d, 0x2b, 0xe2, 0x93, 0xf4, 0xc8, 0x11, 0xf5, 0xb0, 0x42, 0xcb, 0x07, 0xe0, 0x2b, 0x54, 0x33, + 0xb6, 0x13, 0x7b, 0xdb, 0x4b, 0x34, 0xef, 0xfd, 0x7e, 0xbf, 0xf1, 0x9b, 0x37, 0xbf, 0x37, 0x01, + 0xc4, 0x26, 0xbf, 0x92, 0xa9, 0xec, 0xca, 0xcd, 0x9a, 0x08, 0x7f, 0xcd, 0x99, 0x64, 0xa8, 0x9e, + 0xe6, 0x0e, 0x1d, 0x4e, 0xe6, 0xa2, 0x88, 0x1c, 0x1e, 0x08, 0xc2, 0xaf, 0xe3, 0x29, 0xe9, 0x5e, + 0x13, 0x1e, 0xcf, 0x37, 0x59, 0xd6, 0x15, 0x92, 0xf1, 0x30, 0x22, 0x11, 0x67, 0xc9, 0xba, 0xc4, + 0x3f, 0x8d, 0x62, 0xb9, 0x48, 0x26, 0xfe, 0x94, 0xad, 0xba, 0x11, 0x8b, 0x58, 0x57, 0xa7, 0x27, + 0xc9, 0x5c, 0x47, 0x3a, 0xd0, 0xab, 0x94, 0xee, 0x3d, 0x85, 0x1a, 0x0e, 0x69, 0x44, 0xd0, 0x03, + 0xa8, 0x5f, 0xcc, 0xe7, 0x82, 0x48, 0xd7, 0x3c, 0x36, 0x4f, 0x2c, 0x9c, 0x45, 0x2a, 0xff, 0x8c, + 0xd0, 0x48, 0x2e, 0xdc, 0x4a, 0x9a, 0x4f, 0x23, 0xef, 0x2b, 0x80, 0x4b, 0x41, 0x78, 0x40, 0xc2, + 0x19, 0xe1, 0xc8, 0x81, 0xea, 0x8f, 0x64, 0xa3, 0xa5, 0x2d, 0xac, 0x96, 0xe8, 0x00, 0x6a, 0x2f, + 0xc2, 0x65, 0x42, 0xb4, 0xac, 0x85, 0xd3, 0xc0, 0xfb, 0xd3, 0x82, 0x7a, 0x26, 0xf1, 0xc0, 0x7a, + 0x16, 0xd3, 0x2b, 0xad, 0x69, 0x3f, 0xb6, 0xfd, 0xb4, 0x03, 0xbe, 0xca, 0x05, 0x06, 0xd6, 0x18, + 0xfa, 0x1c, 0x9a, 0x98, 0xcc, 0x62, 0x4e, 0xa6, 0x52, 0xef, 0xd3, 0x7e, 0xbc, 0xe7, 0xab, 0x0e, + 0xf9, 0x67, 0xb3, 0x19, 0x27, 0x42, 0x04, 0x06, 0xde, 0x12, 0x50, 0xa9, 0x22, 0xb7, 0xaa, 0xe9, + 0x28, 0xdf, 0x76, 0x87, 0x04, 0x06, 0x2e, 0x56, 0xfe, 0x25, 0xb4, 0xc6, 0x3c, 0xa4, 0x62, 0xce, + 0xf8, 0xca, 0xb5, 0xb4, 0xe8, 0x7e, 0x2e, 0xda, 0x02, 0x81, 0x81, 0x77, 0x2c, 0x2d, 0x61, 0xab, + 0x89, 0x90, 0x8c, 0x12, 0xb7, 0x76, 0x47, 0x92, 0x03, 0x5a, 0x92, 0x07, 0xe8, 0x21, 0xd4, 0xc6, + 0xec, 0x8a, 0x50, 0xb7, 0xae, 0xe9, 0xf7, 0xfc, 0xec, 0x56, 0x7d, 0x9d, 0x0d, 0x0c, 0x9c, 0xc2, + 0xe8, 0x21, 0x34, 0x03, 0xb6, 0x62, 0x41, 0x28, 0x16, 0x6e, 0xe3, 0xd8, 0x3c, 0xb1, 0x7b, 0xcd, + 0x37, 0x37, 0x47, 0x96, 0x8a, 0xd5, 0x59, 0x73, 0x0c, 0x3d, 0x82, 0xfd, 0x61, 0xb8, 0x59, 0xb2, + 0x70, 0x76, 0xbe, 0x20, 0xd3, 0x2b, 0x91, 0xac, 0xdc, 0xa6, 0xa2, 0x07, 0x06, 0xbe, 0x0b, 0xa0, + 0xa7, 0xd0, 0x1a, 0x50, 0x49, 0x22, 0x1e, 0xcb, 0x8d, 0xdb, 0xd2, 0xdf, 0xff, 0x30, 0x2f, 0x77, + 0x0b, 0x6c, 0x7b, 0xb3, 0xe3, 0xa2, 0x6f, 0xc1, 0x1e, 0xa5, 0x36, 0xfb, 0x41, 0xd9, 0xcc, 0x05, + 0xad, 0x3d, 0xf4, 0x8b, 0xde, 0xf3, 0x8b, 0x8c, 0xc0, 0xc0, 0x25, 0x85, 0xea, 0xd4, 0x30, 0x99, + 0x2c, 0xe3, 0xa9, 0x32, 0x47, 0xbb, 0xdc, 0xa9, 0x2d, 0xa0, 0x3e, 0xba, 0x0d, 0x7a, 0x8d, 0xcc, + 0x37, 0x5e, 0xbb, 0xd0, 0x65, 0xef, 0x7f, 0x13, 0xec, 0xd1, 0x46, 0x48, 0xb2, 0xca, 0xae, 0xcd, + 0x85, 0xc6, 0x0b, 0xc2, 0x45, 0xcc, 0x68, 0xe6, 0xd7, 0x3c, 0x44, 0x9f, 0xc0, 0x5e, 0xd6, 0x81, + 0x92, 0x6f, 0xcb, 0x49, 0x74, 0x08, 0x95, 0x41, 0x5f, 0x9b, 0xc4, 0xee, 0xc1, 0xeb, 0x9b, 0x23, + 0xe3, 0xcd, 0xcd, 0x51, 0x65, 0xd0, 0xc7, 0x95, 0x41, 0x1f, 0x7d, 0x06, 0x8d, 0x8b, 0x97, 0x94, + 0xf0, 0x41, 0x5f, 0x1b, 0xc2, 0xee, 0xed, 0x67, 0x84, 0x3c, 0x8d, 0xf3, 0x05, 0xfa, 0x08, 0xaa, + 0xe7, 0x83, 0xbe, 0x36, 0x81, 0xdd, 0x6b, 0x67, 0x34, 0x95, 0xc2, 0xea, 0x07, 0x7d, 0x0d, 0xad, + 0x73, 0x4e, 0x42, 0x49, 0x66, 0x67, 0x32, 0xbb, 0xfa, 0x0f, 0xf2, 0xf3, 0x6b, 0x20, 0x66, 0x74, + 0xc8, 0x62, 0x2a, 0x7b, 0x96, 0xd2, 0xe2, 0x1d, 0xdb, 0x3b, 0x83, 0xbd, 0x12, 0x03, 0x1d, 0x42, + 0xf3, 0x92, 0xc6, 0xaf, 0xc6, 0xf1, 0x8a, 0xe8, 0x23, 0x57, 0xf1, 0x36, 0x56, 0xc3, 0xf6, 0xdd, + 0x9a, 0x4d, 0xf3, 0xb3, 0xa6, 0x81, 0x17, 0xc3, 0xfe, 0x9d, 0xfb, 0x45, 0x27, 0xb0, 0x9f, 0xae, + 0xc4, 0xd6, 0x37, 0x6a, 0x2f, 0x1b, 0xdf, 0x4d, 0xa3, 0x2f, 0xe0, 0x7e, 0xbe, 0x1e, 0xc5, 0x11, + 0x0d, 0x65, 0xc2, 0xd3, 0x59, 0xb6, 0xf1, 0xbb, 0x80, 0xf7, 0x87, 0x99, 0x4e, 0x33, 0xfa, 0x14, + 0x2c, 0xf5, 0x1a, 0xe9, 0x5d, 0xef, 0xed, 0x2e, 0x5b, 0x61, 0xfe, 0x78, 0xb3, 0x26, 0x58, 0xc3, + 0x59, 0xfb, 0x2b, 0xef, 0x6b, 0xbf, 0x37, 0x06, 0x4b, 0x31, 0x51, 0x1b, 0x1a, 0x97, 0xf4, 0x8a, + 0xb2, 0x97, 0xd4, 0x31, 0x10, 0x40, 0x7d, 0x18, 0x72, 0x42, 0xa5, 0x63, 0x22, 0x1b, 0x9a, 0x43, + 0x4e, 0xae, 0x63, 0x96, 0x08, 0xa7, 0x82, 0x9a, 0x60, 0x3d, 0x27, 0xaf, 0xa4, 0x53, 0x45, 0x2d, + 0xa8, 0x9d, 0x2f, 0xe2, 0xe5, 0xcc, 0xb1, 0x90, 0x53, 0xb6, 0xae, 0x53, 0xf3, 0x96, 0x85, 0x39, + 0x47, 0x8f, 0x4a, 0x55, 0x3e, 0x78, 0x67, 0xde, 0x0b, 0xa5, 0x7a, 0x4f, 0xde, 0x57, 0x4e, 0x0b, + 0x6a, 0xa3, 0xf5, 0x32, 0x56, 0xd5, 0x34, 0xc1, 0x52, 0x7d, 0x70, 0x2a, 0x2a, 0xf9, 0x13, 0x4b, + 0x96, 0x33, 0xa7, 0xea, 0xfd, 0x66, 0x42, 0xfd, 0x42, 0x6f, 0x8a, 0xbe, 0x29, 0x3b, 0x37, 0x7b, + 0xef, 0x0e, 0xf2, 0x6f, 0x16, 0xb1, 0xcc, 0x05, 0x65, 0xa7, 0xfb, 0xd0, 0xc8, 0xee, 0xc6, 0xad, + 0x1c, 0x57, 0xf5, 0xe3, 0x91, 0x49, 0x4b, 0xa2, 0x9c, 0xa4, 0x26, 0x23, 0xb3, 0x7a, 0x6a, 0x6f, + 0x9c, 0x87, 0xde, 0xc7, 0x85, 0x69, 0xdc, 0xbd, 0xcf, 0xe9, 0xfd, 0xa7, 0x41, 0xef, 0xe7, 0xd7, + 0xb7, 0x1d, 0xf3, 0xef, 0xdb, 0x8e, 0xf9, 0xcf, 0x6d, 0xc7, 0xfc, 0xf7, 0xb6, 0x63, 0xfe, 0xfe, + 0x5f, 0xc7, 0xf8, 0xe5, 0xa4, 0xf0, 0x9f, 0x42, 0xc5, 0x7a, 0x3a, 0x3d, 0x9d, 0x91, 0xeb, 0x2e, + 0x25, 0x6c, 0x2e, 0x4e, 0xc3, 0x75, 0x7c, 0x1a, 0xb1, 0x6e, 0x5a, 0xd2, 0x5f, 0x15, 0xe7, 0x39, + 0x61, 0xdf, 0x8f, 0xfc, 0xb3, 0xe1, 0xc0, 0x4f, 0xcf, 0x3f, 0xa9, 0xeb, 0x3f, 0x9a, 0x27, 0x6f, + 0x03, 0x00, 0x00, 0xff, 0xff, 0x8d, 0x5e, 0xb1, 0xdf, 0xf7, 0x06, 0x00, 0x00, } func (m *Range) Marshal() (dAtA []byte, err error) { @@ -1105,16 +1105,16 @@ func (m *Header_Tombstone) MarshalToSizedBuffer(dAtA []byte) (int, error) { } return len(dAtA) - i, nil } -func (m *Header_Verify) MarshalTo(dAtA []byte) (int, error) { +func (m *Header_Token) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *Header_Verify) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *Header_Token) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) - if m.Verify != nil { + if m.Token != nil { { - size, err := m.Verify.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.Token.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -1696,14 +1696,14 @@ func (m *Header_Tombstone) Size() (n int) { } return n } -func (m *Header_Verify) Size() (n int) { +func (m *Header_Token) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.Verify != nil { - l = m.Verify.Size() + if m.Token != nil { + l = m.Token.Size() n += 1 + l + sovTypes(uint64(l)) } return n @@ -2336,7 +2336,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 6: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Verify", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Token", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -2363,11 +2363,11 @@ func (m *Header) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &session.VerificationHeader{} + v := &service.Token{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } - m.Value = &Header_Verify{v} + m.Value = &Header_Token{v} iNdEx = postIndex case 7: if wireType != 2 { diff --git a/object/types.proto b/object/types.proto index f21bf74..21ab981 100644 --- a/object/types.proto +++ b/object/types.proto @@ -4,7 +4,7 @@ option go_package = "github.com/nspcc-dev/neofs-api-go/object"; option csharp_namespace = "NeoFS.API.Object"; import "refs/types.proto"; -import "session/types.proto"; +import "service/verify.proto"; import "storagegroup/types.proto"; import "github.com/gogo/protobuf/gogoproto/gogo.proto"; @@ -36,8 +36,8 @@ message Header { Transform Transform = 4; // Tombstone header that set up in deleted objects Tombstone Tombstone = 5; - // Verify header that contains session public key and user's signature - session.VerificationHeader Verify = 6; + // Token header contains token of the session within which the object was created + service.Token Token = 6; // HomoHash is a homomorphic hash of original object payload bytes HomoHash = 7 [(gogoproto.customtype) = "Hash"]; // PayloadChecksum of actual object's payload diff --git a/service/meta.pb.go b/service/meta.pb.go index 8039990..25a5469 100644 --- a/service/meta.pb.go +++ b/service/meta.pb.go @@ -32,7 +32,9 @@ type RequestMetaHeader struct { Epoch uint64 `protobuf:"varint,2,opt,name=Epoch,proto3" json:"Epoch,omitempty"` // Version defines protocol version // TODO: not used for now, should be implemented in future - Version uint32 `protobuf:"varint,3,opt,name=Version,proto3" json:"Version,omitempty"` + Version uint32 `protobuf:"varint,3,opt,name=Version,proto3" json:"Version,omitempty"` + // Raw determines whether the request is raw or not + Raw bool `protobuf:"varint,4,opt,name=Raw,proto3" json:"Raw,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -88,6 +90,13 @@ func (m *RequestMetaHeader) GetVersion() uint32 { return 0 } +func (m *RequestMetaHeader) GetRaw() bool { + if m != nil { + return m.Raw + } + return false +} + // ResponseMetaHeader contains meta information based on request processing by server // (should be embedded into message) type ResponseMetaHeader struct { @@ -152,23 +161,24 @@ func init() { func init() { proto.RegisterFile("service/meta.proto", fileDescriptor_a638867e7b43457c) } var fileDescriptor_a638867e7b43457c = []byte{ - // 247 bytes of a gzipped FileDescriptorProto + // 261 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x2a, 0x4e, 0x2d, 0x2a, 0xcb, 0x4c, 0x4e, 0xd5, 0xcf, 0x4d, 0x2d, 0x49, 0xd4, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x87, 0x8a, 0x49, 0xe9, 0xa6, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0xa7, 0xe7, 0xa7, 0xe7, 0xeb, 0x83, 0xe5, 0x93, 0x4a, 0xd3, 0xc0, 0x3c, 0x30, 0x07, 0xcc, 0x82, 0xe8, - 0x53, 0x0a, 0xe5, 0x12, 0x0c, 0x4a, 0x2d, 0x2c, 0x4d, 0x2d, 0x2e, 0xf1, 0x4d, 0x2d, 0x49, 0xf4, + 0x53, 0x4a, 0xe7, 0x12, 0x0c, 0x4a, 0x2d, 0x2c, 0x4d, 0x2d, 0x2e, 0xf1, 0x4d, 0x2d, 0x49, 0xf4, 0x48, 0x4d, 0x4c, 0x49, 0x2d, 0x12, 0x12, 0xe0, 0x62, 0x0e, 0x09, 0xf1, 0x91, 0x60, 0x54, 0x60, 0xd4, 0xe0, 0x0d, 0x02, 0x31, 0x85, 0x44, 0xb8, 0x58, 0x5d, 0x0b, 0xf2, 0x93, 0x33, 0x24, 0x98, 0x14, 0x18, 0x35, 0x58, 0x82, 0x20, 0x1c, 0x21, 0x09, 0x2e, 0xf6, 0xb0, 0xd4, 0xa2, 0xe2, 0xcc, - 0xfc, 0x3c, 0x09, 0x66, 0xb0, 0x5a, 0x18, 0x57, 0xc9, 0x85, 0x4b, 0x28, 0x28, 0xb5, 0xb8, 0x20, - 0x3f, 0xaf, 0x38, 0x15, 0xc9, 0x5c, 0xb8, 0x29, 0x8c, 0x38, 0x4c, 0x61, 0x42, 0x31, 0xc5, 0x29, - 0xf8, 0xc4, 0x23, 0x39, 0xc6, 0x0b, 0x8f, 0xe4, 0x18, 0x6f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, - 0x8e, 0x71, 0xc6, 0x63, 0x39, 0x86, 0x28, 0x4d, 0x24, 0x1f, 0xe6, 0x15, 0x17, 0x24, 0x27, 0xeb, - 0xa6, 0xa4, 0x96, 0xe9, 0xe7, 0xa5, 0xe6, 0xa7, 0x15, 0xeb, 0x26, 0x16, 0x64, 0xea, 0xa6, 0xe7, - 0xeb, 0x43, 0x03, 0x63, 0x15, 0x93, 0xa0, 0x5f, 0x6a, 0xbe, 0x5b, 0xb0, 0x9e, 0x63, 0x80, 0xa7, - 0x5e, 0x30, 0x44, 0x2c, 0x89, 0x0d, 0xec, 0x71, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0x36, - 0xce, 0x54, 0x19, 0x46, 0x01, 0x00, 0x00, + 0xfc, 0x3c, 0x09, 0x66, 0xb0, 0x5a, 0x18, 0x17, 0x64, 0x42, 0x50, 0x62, 0xb9, 0x04, 0x8b, 0x02, + 0xa3, 0x06, 0x47, 0x10, 0x88, 0xa9, 0xe4, 0xc2, 0x25, 0x14, 0x94, 0x5a, 0x5c, 0x90, 0x9f, 0x57, + 0x9c, 0x8a, 0x64, 0x13, 0xdc, 0x5c, 0x46, 0x1c, 0xe6, 0x32, 0xa1, 0x98, 0xeb, 0x14, 0x7c, 0xe2, + 0x91, 0x1c, 0xe3, 0x85, 0x47, 0x72, 0x8c, 0x37, 0x1e, 0xc9, 0x31, 0x3e, 0x78, 0x24, 0xc7, 0x38, + 0xe3, 0xb1, 0x1c, 0x43, 0x94, 0x26, 0x92, 0x9f, 0xf3, 0x8a, 0x0b, 0x92, 0x93, 0x75, 0x53, 0x52, + 0xcb, 0xf4, 0xf3, 0x52, 0xf3, 0xd3, 0x8a, 0x75, 0x13, 0x0b, 0x32, 0x75, 0xd3, 0xf3, 0xf5, 0xa1, + 0xc1, 0xb3, 0x8a, 0x49, 0xd0, 0x2f, 0x35, 0xdf, 0x2d, 0x58, 0xcf, 0x31, 0xc0, 0x53, 0x2f, 0x18, + 0x22, 0x96, 0xc4, 0x06, 0x0e, 0x0a, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0xb2, 0x12, 0x93, + 0x5e, 0x58, 0x01, 0x00, 0x00, } func (m *RequestMetaHeader) Marshal() (dAtA []byte, err error) { @@ -195,6 +205,16 @@ func (m *RequestMetaHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } + if m.Raw { + i-- + if m.Raw { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x20 + } if m.Version != 0 { i = encodeVarintMeta(dAtA, i, uint64(m.Version)) i-- @@ -276,6 +296,9 @@ func (m *RequestMetaHeader) Size() (n int) { if m.Version != 0 { n += 1 + sovMeta(uint64(m.Version)) } + if m.Raw { + n += 2 + } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -392,6 +415,26 @@ func (m *RequestMetaHeader) Unmarshal(dAtA []byte) error { break } } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Raw", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMeta + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Raw = bool(v != 0) default: iNdEx = preIndex skippy, err := skipMeta(dAtA[iNdEx:]) diff --git a/service/meta.proto b/service/meta.proto index 99b37d3..093f118 100644 --- a/service/meta.proto +++ b/service/meta.proto @@ -17,6 +17,8 @@ message RequestMetaHeader { // Version defines protocol version // TODO: not used for now, should be implemented in future uint32 Version = 3; + // Raw determines whether the request is raw or not + bool Raw = 4; } // ResponseMetaHeader contains meta information based on request processing by server diff --git a/service/verify.pb.go b/service/verify.pb.go index 9dca855..023e639 100644 --- a/service/verify.pb.go +++ b/service/verify.pb.go @@ -7,6 +7,7 @@ import ( fmt "fmt" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/golang/protobuf/proto" + _ "github.com/nspcc-dev/neofs-api-go/refs" io "io" math "math" math_bits "math/bits" @@ -23,14 +24,64 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +// Verb is an enumeration of session request types +type Token_Info_Verb int32 + +const ( + // Put refers to object.Put RPC call + Token_Info_Put Token_Info_Verb = 0 + // Get refers to object.Get RPC call + Token_Info_Get Token_Info_Verb = 1 + // Head refers to object.Head RPC call + Token_Info_Head Token_Info_Verb = 2 + // Search refers to object.Search RPC call + Token_Info_Search Token_Info_Verb = 3 + // Delete refers to object.Delete RPC call + Token_Info_Delete Token_Info_Verb = 4 + // Range refers to object.GetRange RPC call + Token_Info_Range Token_Info_Verb = 5 + // RangeHash refers to object.GetRangeHash RPC call + Token_Info_RangeHash Token_Info_Verb = 6 +) + +var Token_Info_Verb_name = map[int32]string{ + 0: "Put", + 1: "Get", + 2: "Head", + 3: "Search", + 4: "Delete", + 5: "Range", + 6: "RangeHash", +} + +var Token_Info_Verb_value = map[string]int32{ + "Put": 0, + "Get": 1, + "Head": 2, + "Search": 3, + "Delete": 4, + "Range": 5, + "RangeHash": 6, +} + +func (x Token_Info_Verb) String() string { + return proto.EnumName(Token_Info_Verb_name, int32(x)) +} + +func (Token_Info_Verb) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_4bdd5bc50ec96238, []int{1, 0, 0} +} + // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request // (should be embedded into message). type RequestVerificationHeader struct { // Signatures is a set of signatures of every passed NeoFS Node - Signatures []*RequestVerificationHeader_Signature `protobuf:"bytes,1,rep,name=Signatures,proto3" json:"Signatures,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Signatures []*RequestVerificationHeader_Signature `protobuf:"bytes,1,rep,name=Signatures,proto3" json:"Signatures,omitempty"` + // Token is a token of the session within which the request is sent + Token *Token `protobuf:"bytes,2,opt,name=Token,proto3" json:"Token,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *RequestVerificationHeader) Reset() { *m = RequestVerificationHeader{} } @@ -69,7 +120,14 @@ func (m *RequestVerificationHeader) GetSignatures() []*RequestVerificationHeader return nil } -type RequestVerificationHeader_Sign struct { +func (m *RequestVerificationHeader) GetToken() *Token { + if m != nil { + return m.Token + } + return nil +} + +type RequestVerificationHeader_Signature struct { // Sign is signature of the request or session key. Sign []byte `protobuf:"bytes,1,opt,name=Sign,proto3" json:"Sign,omitempty"` // Peer is compressed public key used for signature. @@ -79,66 +137,11 @@ type RequestVerificationHeader_Sign struct { XXX_sizecache int32 `json:"-"` } -func (m *RequestVerificationHeader_Sign) Reset() { *m = RequestVerificationHeader_Sign{} } -func (m *RequestVerificationHeader_Sign) String() string { return proto.CompactTextString(m) } -func (*RequestVerificationHeader_Sign) ProtoMessage() {} -func (*RequestVerificationHeader_Sign) Descriptor() ([]byte, []int) { - return fileDescriptor_4bdd5bc50ec96238, []int{0, 0} -} -func (m *RequestVerificationHeader_Sign) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *RequestVerificationHeader_Sign) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *RequestVerificationHeader_Sign) XXX_Merge(src proto.Message) { - xxx_messageInfo_RequestVerificationHeader_Sign.Merge(m, src) -} -func (m *RequestVerificationHeader_Sign) XXX_Size() int { - return m.Size() -} -func (m *RequestVerificationHeader_Sign) XXX_DiscardUnknown() { - xxx_messageInfo_RequestVerificationHeader_Sign.DiscardUnknown(m) -} - -var xxx_messageInfo_RequestVerificationHeader_Sign proto.InternalMessageInfo - -func (m *RequestVerificationHeader_Sign) GetSign() []byte { - if m != nil { - return m.Sign - } - return nil -} - -func (m *RequestVerificationHeader_Sign) GetPeer() []byte { - if m != nil { - return m.Peer - } - return nil -} - -type RequestVerificationHeader_Signature struct { - // Sign is a signature and public key of the request. - RequestVerificationHeader_Sign `protobuf:"bytes,1,opt,name=Sign,proto3,embedded=Sign" json:"Sign"` - // Origin used for requests, when trusted node changes it and re-sign with session key. - // If session key used for signature request, then Origin should contain - // public key of user and signed session key. - Origin *RequestVerificationHeader_Sign `protobuf:"bytes,2,opt,name=Origin,proto3" json:"Origin,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - func (m *RequestVerificationHeader_Signature) Reset() { *m = RequestVerificationHeader_Signature{} } func (m *RequestVerificationHeader_Signature) String() string { return proto.CompactTextString(m) } func (*RequestVerificationHeader_Signature) ProtoMessage() {} func (*RequestVerificationHeader_Signature) Descriptor() ([]byte, []int) { - return fileDescriptor_4bdd5bc50ec96238, []int{0, 1} + return fileDescriptor_4bdd5bc50ec96238, []int{0, 0} } func (m *RequestVerificationHeader_Signature) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -163,42 +166,190 @@ func (m *RequestVerificationHeader_Signature) XXX_DiscardUnknown() { var xxx_messageInfo_RequestVerificationHeader_Signature proto.InternalMessageInfo -func (m *RequestVerificationHeader_Signature) GetOrigin() *RequestVerificationHeader_Sign { +func (m *RequestVerificationHeader_Signature) GetSign() []byte { if m != nil { - return m.Origin + return m.Sign + } + return nil +} + +func (m *RequestVerificationHeader_Signature) GetPeer() []byte { + if m != nil { + return m.Peer + } + return nil +} + +// User token granting rights for object manipulation +type Token struct { + // TokenInfo is a grouped information about token + Token_Info `protobuf:"bytes,1,opt,name=TokenInfo,proto3,embedded=TokenInfo" json:"TokenInfo"` + // Signature is a signature of session token information + Signature []byte `protobuf:"bytes,8,opt,name=Signature,proto3" json:"Signature,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Token) Reset() { *m = Token{} } +func (m *Token) String() string { return proto.CompactTextString(m) } +func (*Token) ProtoMessage() {} +func (*Token) Descriptor() ([]byte, []int) { + return fileDescriptor_4bdd5bc50ec96238, []int{1} +} +func (m *Token) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Token) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *Token) XXX_Merge(src proto.Message) { + xxx_messageInfo_Token.Merge(m, src) +} +func (m *Token) XXX_Size() int { + return m.Size() +} +func (m *Token) XXX_DiscardUnknown() { + xxx_messageInfo_Token.DiscardUnknown(m) +} + +var xxx_messageInfo_Token proto.InternalMessageInfo + +func (m *Token) GetSignature() []byte { + if m != nil { + return m.Signature + } + return nil +} + +type Token_Info struct { + // ID is a token identifier. valid UUIDv4 represented in bytes + ID TokenID `protobuf:"bytes,1,opt,name=ID,proto3,customtype=TokenID" json:"ID"` + // OwnerID is an owner of manipulation object + OwnerID OwnerID `protobuf:"bytes,2,opt,name=OwnerID,proto3,customtype=OwnerID" json:"OwnerID"` + // Verb is a type of request for which the token is issued + Verb Token_Info_Verb `protobuf:"varint,3,opt,name=verb,proto3,enum=service.Token_Info_Verb" json:"verb,omitempty"` + // Address is an object address for which token is issued + Address Address `protobuf:"bytes,4,opt,name=Address,proto3,customtype=Address" json:"Address"` + // Created is an initial epoch of token lifetime + Created uint64 `protobuf:"varint,5,opt,name=Created,proto3" json:"Created,omitempty"` + // ValidUntil is a last epoch of token lifetime + ValidUntil uint64 `protobuf:"varint,6,opt,name=ValidUntil,proto3" json:"ValidUntil,omitempty"` + // SessionKey is a public key of session key + SessionKey []byte `protobuf:"bytes,7,opt,name=SessionKey,proto3" json:"SessionKey,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Token_Info) Reset() { *m = Token_Info{} } +func (m *Token_Info) String() string { return proto.CompactTextString(m) } +func (*Token_Info) ProtoMessage() {} +func (*Token_Info) Descriptor() ([]byte, []int) { + return fileDescriptor_4bdd5bc50ec96238, []int{1, 0} +} +func (m *Token_Info) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Token_Info) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *Token_Info) XXX_Merge(src proto.Message) { + xxx_messageInfo_Token_Info.Merge(m, src) +} +func (m *Token_Info) XXX_Size() int { + return m.Size() +} +func (m *Token_Info) XXX_DiscardUnknown() { + xxx_messageInfo_Token_Info.DiscardUnknown(m) +} + +var xxx_messageInfo_Token_Info proto.InternalMessageInfo + +func (m *Token_Info) GetVerb() Token_Info_Verb { + if m != nil { + return m.Verb + } + return Token_Info_Put +} + +func (m *Token_Info) GetCreated() uint64 { + if m != nil { + return m.Created + } + return 0 +} + +func (m *Token_Info) GetValidUntil() uint64 { + if m != nil { + return m.ValidUntil + } + return 0 +} + +func (m *Token_Info) GetSessionKey() []byte { + if m != nil { + return m.SessionKey } return nil } func init() { + proto.RegisterEnum("service.Token_Info_Verb", Token_Info_Verb_name, Token_Info_Verb_value) proto.RegisterType((*RequestVerificationHeader)(nil), "service.RequestVerificationHeader") - proto.RegisterType((*RequestVerificationHeader_Sign)(nil), "service.RequestVerificationHeader.Sign") proto.RegisterType((*RequestVerificationHeader_Signature)(nil), "service.RequestVerificationHeader.Signature") + proto.RegisterType((*Token)(nil), "service.Token") + proto.RegisterType((*Token_Info)(nil), "service.Token.Info") } func init() { proto.RegisterFile("service/verify.proto", fileDescriptor_4bdd5bc50ec96238) } var fileDescriptor_4bdd5bc50ec96238 = []byte{ - // 291 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x29, 0x4e, 0x2d, 0x2a, - 0xcb, 0x4c, 0x4e, 0xd5, 0x2f, 0x4b, 0x2d, 0xca, 0x4c, 0xab, 0xd4, 0x2b, 0x28, 0xca, 0x2f, 0xc9, - 0x17, 0x62, 0x87, 0x8a, 0x4a, 0xe9, 0xa6, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, - 0xea, 0xa7, 0xe7, 0xa7, 0xe7, 0xeb, 0x83, 0xe5, 0x93, 0x4a, 0xd3, 0xc0, 0x3c, 0x30, 0x07, 0xcc, - 0x82, 0xe8, 0x53, 0x5a, 0xcf, 0xc4, 0x25, 0x19, 0x94, 0x5a, 0x58, 0x9a, 0x5a, 0x5c, 0x12, 0x06, - 0x32, 0x2f, 0x33, 0x39, 0xb1, 0x24, 0x33, 0x3f, 0xcf, 0x23, 0x35, 0x31, 0x25, 0xb5, 0x48, 0xc8, - 0x87, 0x8b, 0x2b, 0x38, 0x33, 0x3d, 0x2f, 0xb1, 0xa4, 0xb4, 0x28, 0xb5, 0x58, 0x82, 0x51, 0x81, - 0x59, 0x83, 0xdb, 0x48, 0x47, 0x0f, 0x6a, 0x95, 0x1e, 0x4e, 0x7d, 0x7a, 0x70, 0x4d, 0x41, 0x48, - 0xfa, 0xa5, 0xf4, 0xb8, 0x58, 0x40, 0x3c, 0x21, 0x21, 0x08, 0x2d, 0xc1, 0xa8, 0xc0, 0xa8, 0xc1, - 0x13, 0x04, 0x17, 0x0b, 0x48, 0x4d, 0x2d, 0x92, 0x60, 0x82, 0x88, 0x81, 0xd8, 0x52, 0x93, 0x19, - 0xb9, 0x38, 0xe1, 0xda, 0x85, 0x5c, 0x91, 0x74, 0x71, 0x1b, 0xa9, 0x13, 0xe9, 0x0a, 0x27, 0x8e, - 0x13, 0xf7, 0xe4, 0x19, 0x2e, 0xdc, 0x93, 0x67, 0x84, 0x5a, 0x64, 0xcf, 0xc5, 0xe6, 0x5f, 0x94, - 0x99, 0x9e, 0x99, 0x07, 0xb6, 0x8a, 0x78, 0x83, 0x82, 0xa0, 0xda, 0x9c, 0x82, 0x4f, 0x3c, 0x92, - 0x63, 0xbc, 0xf0, 0x48, 0x8e, 0xf1, 0xc6, 0x23, 0x39, 0xc6, 0x07, 0x8f, 0xe4, 0x18, 0x67, 0x3c, - 0x96, 0x63, 0x88, 0xd2, 0x44, 0x0a, 0xf6, 0xbc, 0xe2, 0x82, 0xe4, 0x64, 0xdd, 0x94, 0xd4, 0x32, - 0xfd, 0xbc, 0xd4, 0xfc, 0xb4, 0x62, 0xdd, 0xc4, 0x82, 0x4c, 0xdd, 0xf4, 0x7c, 0x7d, 0xa8, 0x3d, - 0xab, 0x98, 0x04, 0xfd, 0x52, 0xf3, 0xdd, 0x82, 0xf5, 0x1c, 0x03, 0x3c, 0xf5, 0x82, 0x21, 0x62, - 0x49, 0x6c, 0xe0, 0xd8, 0x30, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0x23, 0xa3, 0x9d, 0x94, 0xdd, - 0x01, 0x00, 0x00, + // 541 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x92, 0x4d, 0x8e, 0xd3, 0x4c, + 0x10, 0x86, 0xa7, 0x1d, 0x27, 0x4e, 0x6a, 0x7e, 0x3e, 0x7f, 0x0d, 0x0b, 0x13, 0x21, 0x27, 0x8a, + 0x58, 0x64, 0x24, 0x62, 0x4b, 0x19, 0x09, 0x21, 0xb1, 0x9a, 0x10, 0xc1, 0x44, 0x20, 0x88, 0xda, + 0x43, 0x16, 0xec, 0x1c, 0xbb, 0xe2, 0x58, 0x04, 0x77, 0xe8, 0x76, 0x82, 0x72, 0x13, 0xce, 0xc0, + 0x39, 0x58, 0xcc, 0x72, 0x96, 0xc0, 0x22, 0x42, 0xe1, 0x0a, 0x1c, 0x00, 0xb9, 0xed, 0xfc, 0x20, + 0xc1, 0xee, 0xad, 0xa7, 0xaa, 0xde, 0xaa, 0x6e, 0x15, 0xdc, 0x95, 0x28, 0x96, 0x71, 0x80, 0xee, + 0x12, 0x45, 0x3c, 0x59, 0x39, 0x73, 0xc1, 0x53, 0x4e, 0x8d, 0x82, 0xd6, 0x4d, 0x81, 0x13, 0xe9, + 0xa6, 0xab, 0x39, 0xca, 0x3c, 0x55, 0xef, 0x44, 0x71, 0x3a, 0x5d, 0x8c, 0x9d, 0x80, 0xbf, 0x77, + 0x23, 0x1e, 0x71, 0x57, 0xe1, 0xf1, 0x62, 0xa2, 0x22, 0x15, 0x28, 0x95, 0x97, 0xb7, 0xbe, 0x10, + 0xb8, 0xc7, 0xf0, 0xc3, 0x02, 0x65, 0x3a, 0xca, 0x26, 0xc4, 0x81, 0x9f, 0xc6, 0x3c, 0xb9, 0x42, + 0x3f, 0x44, 0x41, 0x5f, 0x02, 0x78, 0x71, 0x94, 0xf8, 0xe9, 0x42, 0xa0, 0xb4, 0x48, 0xb3, 0xd4, + 0x3e, 0xee, 0x3e, 0x74, 0x8a, 0xe1, 0xce, 0x3f, 0xfb, 0x9c, 0x5d, 0x13, 0x3b, 0xe8, 0xa7, 0x0f, + 0xa0, 0x7c, 0xcd, 0xdf, 0x61, 0x62, 0x69, 0x4d, 0xd2, 0x3e, 0xee, 0x9e, 0xed, 0x8c, 0x14, 0x65, + 0x79, 0xb2, 0x7e, 0x01, 0xb5, 0x5d, 0x0f, 0xa5, 0xa0, 0x67, 0x81, 0x45, 0x9a, 0xa4, 0x7d, 0xc2, + 0x94, 0xce, 0xd8, 0x10, 0x51, 0x28, 0x97, 0x13, 0xa6, 0x74, 0xeb, 0x5b, 0xa9, 0xf0, 0xa6, 0x4f, + 0xa0, 0xa6, 0xc4, 0x20, 0x99, 0x70, 0xd5, 0x76, 0xdc, 0xbd, 0xf3, 0xe7, 0x20, 0x27, 0x4b, 0xf5, + 0xaa, 0x37, 0xeb, 0xc6, 0xd1, 0xed, 0xba, 0x41, 0xd8, 0xbe, 0x9e, 0xde, 0x3f, 0x98, 0x6d, 0x55, + 0x95, 0xff, 0x1e, 0xd4, 0x7f, 0x69, 0xa0, 0xab, 0xb2, 0x06, 0x68, 0x83, 0x7e, 0xbe, 0x53, 0xef, + 0xbf, 0xcc, 0xe7, 0xfb, 0xba, 0x61, 0xe4, 0x2e, 0x7d, 0xa6, 0x0d, 0xfa, 0xf4, 0x1c, 0x8c, 0xd7, + 0x1f, 0x13, 0x14, 0x83, 0x7e, 0xbe, 0xe5, 0xbe, 0xaa, 0xc0, 0x6c, 0x2b, 0xe8, 0x23, 0xd0, 0x97, + 0x28, 0xc6, 0x56, 0xa9, 0x49, 0xda, 0x67, 0x5d, 0xeb, 0x2f, 0xab, 0x3a, 0x23, 0x14, 0xe3, 0x5e, + 0x75, 0xb3, 0x6e, 0xe8, 0x99, 0x62, 0xaa, 0x9e, 0x3e, 0x06, 0xe3, 0x32, 0x0c, 0x05, 0x4a, 0x69, + 0xe9, 0xea, 0x95, 0xa7, 0x4e, 0x76, 0x0b, 0x4e, 0x01, 0xf7, 0x13, 0x0b, 0xc0, 0xb6, 0x82, 0x5a, + 0x60, 0x3c, 0x15, 0xe8, 0xa7, 0x18, 0x5a, 0xe5, 0x26, 0x69, 0xeb, 0x6c, 0x1b, 0x52, 0x1b, 0x60, + 0xe4, 0xcf, 0xe2, 0xf0, 0x4d, 0x92, 0xc6, 0x33, 0xab, 0xa2, 0x92, 0x07, 0x24, 0xcb, 0x7b, 0x28, + 0x65, 0xcc, 0x93, 0x17, 0xb8, 0xb2, 0x0c, 0xf5, 0x3f, 0x07, 0xa4, 0x75, 0x0d, 0x6a, 0x43, 0x6a, + 0x40, 0x69, 0xb8, 0x48, 0xcd, 0xa3, 0x4c, 0x3c, 0xc7, 0xd4, 0x24, 0xb4, 0x0a, 0x7a, 0x76, 0x1a, + 0xa6, 0x46, 0x01, 0x2a, 0x1e, 0xfa, 0x22, 0x98, 0x9a, 0xa5, 0x4c, 0xf7, 0x71, 0x86, 0x29, 0x9a, + 0x3a, 0xad, 0x41, 0x99, 0xf9, 0x49, 0x84, 0x66, 0x99, 0x9e, 0x42, 0x4d, 0xc9, 0x2b, 0x5f, 0x4e, + 0xcd, 0x4a, 0xcf, 0xbb, 0xd9, 0xd8, 0xe4, 0x76, 0x63, 0x93, 0xaf, 0x1b, 0x9b, 0xfc, 0xd8, 0xd8, + 0xe4, 0xd3, 0x4f, 0xfb, 0xe8, 0xed, 0xf9, 0xc1, 0x9d, 0x27, 0x72, 0x1e, 0x04, 0x9d, 0x10, 0x97, + 0x6e, 0x82, 0x7c, 0x22, 0x3b, 0xfe, 0x3c, 0xee, 0x44, 0xdc, 0x2d, 0xbe, 0xf2, 0xb3, 0xf6, 0xff, + 0x2b, 0xe4, 0xcf, 0x3c, 0xe7, 0x72, 0x38, 0x70, 0xbc, 0x9c, 0x8d, 0x2b, 0xea, 0xfc, 0x2f, 0x7e, + 0x07, 0x00, 0x00, 0xff, 0xff, 0xea, 0xcf, 0xa5, 0xdd, 0x60, 0x03, 0x00, 0x00, } func (m *RequestVerificationHeader) Marshal() (dAtA []byte, err error) { @@ -225,6 +376,18 @@ func (m *RequestVerificationHeader) MarshalToSizedBuffer(dAtA []byte) (int, erro i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } + if m.Token != nil { + { + size, err := m.Token.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintVerify(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } if len(m.Signatures) > 0 { for iNdEx := len(m.Signatures) - 1; iNdEx >= 0; iNdEx-- { { @@ -242,47 +405,6 @@ func (m *RequestVerificationHeader) MarshalToSizedBuffer(dAtA []byte) (int, erro return len(dAtA) - i, nil } -func (m *RequestVerificationHeader_Sign) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *RequestVerificationHeader_Sign) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *RequestVerificationHeader_Sign) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.Peer) > 0 { - i -= len(m.Peer) - copy(dAtA[i:], m.Peer) - i = encodeVarintVerify(dAtA, i, uint64(len(m.Peer))) - i-- - dAtA[i] = 0x12 - } - if len(m.Sign) > 0 { - i -= len(m.Sign) - copy(dAtA[i:], m.Sign) - i = encodeVarintVerify(dAtA, i, uint64(len(m.Sign))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - func (m *RequestVerificationHeader_Signature) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -307,20 +429,56 @@ func (m *RequestVerificationHeader_Signature) MarshalToSizedBuffer(dAtA []byte) i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } - if m.Origin != nil { - { - size, err := m.Origin.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintVerify(dAtA, i, uint64(size)) - } + if len(m.Peer) > 0 { + i -= len(m.Peer) + copy(dAtA[i:], m.Peer) + i = encodeVarintVerify(dAtA, i, uint64(len(m.Peer))) i-- dAtA[i] = 0x12 } + if len(m.Sign) > 0 { + i -= len(m.Sign) + copy(dAtA[i:], m.Sign) + i = encodeVarintVerify(dAtA, i, uint64(len(m.Sign))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Token) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Token) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Token) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Signature) > 0 { + i -= len(m.Signature) + copy(dAtA[i:], m.Signature) + i = encodeVarintVerify(dAtA, i, uint64(len(m.Signature))) + i-- + dAtA[i] = 0x42 + } { - size, err := m.RequestVerificationHeader_Sign.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.Token_Info.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -332,6 +490,85 @@ func (m *RequestVerificationHeader_Signature) MarshalToSizedBuffer(dAtA []byte) return len(dAtA) - i, nil } +func (m *Token_Info) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Token_Info) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Token_Info) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.SessionKey) > 0 { + i -= len(m.SessionKey) + copy(dAtA[i:], m.SessionKey) + i = encodeVarintVerify(dAtA, i, uint64(len(m.SessionKey))) + i-- + dAtA[i] = 0x3a + } + if m.ValidUntil != 0 { + i = encodeVarintVerify(dAtA, i, uint64(m.ValidUntil)) + i-- + dAtA[i] = 0x30 + } + if m.Created != 0 { + i = encodeVarintVerify(dAtA, i, uint64(m.Created)) + i-- + dAtA[i] = 0x28 + } + { + size := m.Address.Size() + i -= size + if _, err := m.Address.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintVerify(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + if m.Verb != 0 { + i = encodeVarintVerify(dAtA, i, uint64(m.Verb)) + i-- + dAtA[i] = 0x18 + } + { + size := m.OwnerID.Size() + i -= size + if _, err := m.OwnerID.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintVerify(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size := m.ID.Size() + i -= size + if _, err := m.ID.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintVerify(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + func encodeVarintVerify(dAtA []byte, offset int, v uint64) int { offset -= sovVerify(v) base := offset @@ -355,13 +592,17 @@ func (m *RequestVerificationHeader) Size() (n int) { n += 1 + l + sovVerify(uint64(l)) } } + if m.Token != nil { + l = m.Token.Size() + n += 1 + l + sovVerify(uint64(l)) + } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } -func (m *RequestVerificationHeader_Sign) Size() (n int) { +func (m *RequestVerificationHeader_Signature) Size() (n int) { if m == nil { return 0 } @@ -381,16 +622,47 @@ func (m *RequestVerificationHeader_Sign) Size() (n int) { return n } -func (m *RequestVerificationHeader_Signature) Size() (n int) { +func (m *Token) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = m.RequestVerificationHeader_Sign.Size() + l = m.Token_Info.Size() n += 1 + l + sovVerify(uint64(l)) - if m.Origin != nil { - l = m.Origin.Size() + l = len(m.Signature) + if l > 0 { + n += 1 + l + sovVerify(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *Token_Info) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.ID.Size() + n += 1 + l + sovVerify(uint64(l)) + l = m.OwnerID.Size() + n += 1 + l + sovVerify(uint64(l)) + if m.Verb != 0 { + n += 1 + sovVerify(uint64(m.Verb)) + } + l = m.Address.Size() + n += 1 + l + sovVerify(uint64(l)) + if m.Created != 0 { + n += 1 + sovVerify(uint64(m.Created)) + } + if m.ValidUntil != 0 { + n += 1 + sovVerify(uint64(m.ValidUntil)) + } + l = len(m.SessionKey) + if l > 0 { n += 1 + l + sovVerify(uint64(l)) } if m.XXX_unrecognized != nil { @@ -468,6 +740,42 @@ func (m *RequestVerificationHeader) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Token", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVerify + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthVerify + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthVerify + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Token == nil { + m.Token = &Token{} + } + if err := m.Token.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipVerify(dAtA[iNdEx:]) @@ -493,7 +801,7 @@ func (m *RequestVerificationHeader) Unmarshal(dAtA []byte) error { } return nil } -func (m *RequestVerificationHeader_Sign) Unmarshal(dAtA []byte) error { +func (m *RequestVerificationHeader_Signature) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -516,10 +824,10 @@ func (m *RequestVerificationHeader_Sign) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: Sign: wiretype end group for non-group") + return fmt.Errorf("proto: Signature: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: Sign: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: Signature: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -615,7 +923,7 @@ func (m *RequestVerificationHeader_Sign) Unmarshal(dAtA []byte) error { } return nil } -func (m *RequestVerificationHeader_Signature) Unmarshal(dAtA []byte) error { +func (m *Token) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -638,15 +946,15 @@ func (m *RequestVerificationHeader_Signature) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: Signature: wiretype end group for non-group") + return fmt.Errorf("proto: Token: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: Signature: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: Token: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RequestVerificationHeader_Sign", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Token_Info", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -673,13 +981,186 @@ func (m *RequestVerificationHeader_Signature) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.RequestVerificationHeader_Sign.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Token_Info.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signature", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVerify + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthVerify + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthVerify + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Signature = append(m.Signature[:0], dAtA[iNdEx:postIndex]...) + if m.Signature == nil { + m.Signature = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipVerify(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthVerify + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthVerify + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Token_Info) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVerify + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Info: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Info: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVerify + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthVerify + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthVerify + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Origin", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field OwnerID", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVerify + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthVerify + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthVerify + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.OwnerID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Verb", wireType) + } + m.Verb = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVerify + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Verb |= Token_Info_Verb(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -706,13 +1187,82 @@ func (m *RequestVerificationHeader_Signature) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.Origin == nil { - m.Origin = &RequestVerificationHeader_Sign{} - } - if err := m.Origin.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Address.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Created", wireType) + } + m.Created = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVerify + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Created |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidUntil", wireType) + } + m.ValidUntil = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVerify + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ValidUntil |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SessionKey", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVerify + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthVerify + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthVerify + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SessionKey = append(m.SessionKey[:0], dAtA[iNdEx:postIndex]...) + if m.SessionKey == nil { + m.SessionKey = []byte{} + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipVerify(dAtA[iNdEx:]) diff --git a/service/verify.proto b/service/verify.proto index de0a69a..b25cd47 100644 --- a/service/verify.proto +++ b/service/verify.proto @@ -3,6 +3,7 @@ package service; option go_package = "github.com/nspcc-dev/neofs-api-go/service"; option csharp_namespace = "NeoFS.API.Service"; +import "refs/types.proto"; import "github.com/gogo/protobuf/gogoproto/gogo.proto"; option (gogoproto.stable_marshaler_all) = true; @@ -10,22 +11,74 @@ option (gogoproto.stable_marshaler_all) = true; // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request // (should be embedded into message). message RequestVerificationHeader { - message Sign { + message Signature { // Sign is signature of the request or session key. bytes Sign = 1; // Peer is compressed public key used for signature. bytes Peer = 2; } - message Signature { - // Sign is a signature and public key of the request. - Sign Sign = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; - // Origin used for requests, when trusted node changes it and re-sign with session key. - // If session key used for signature request, then Origin should contain - // public key of user and signed session key. - Sign Origin = 2; - } - // Signatures is a set of signatures of every passed NeoFS Node repeated Signature Signatures = 1; + + // Token is a token of the session within which the request is sent + Token Token = 2; } + +// User token granting rights for object manipulation +message Token { + message Info { + // ID is a token identifier. valid UUIDv4 represented in bytes + bytes ID = 1 [(gogoproto.customtype) = "TokenID", (gogoproto.nullable) = false]; + + // OwnerID is an owner of manipulation object + bytes OwnerID = 2 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false]; + + // Verb is an enumeration of session request types + enum Verb { + // Put refers to object.Put RPC call + Put = 0; + // Get refers to object.Get RPC call + Get = 1; + // Head refers to object.Head RPC call + Head = 2; + // Search refers to object.Search RPC call + Search = 3; + // Delete refers to object.Delete RPC call + Delete = 4; + // Range refers to object.GetRange RPC call + Range = 5; + // RangeHash refers to object.GetRangeHash RPC call + RangeHash = 6; + } + + // Verb is a type of request for which the token is issued + Verb verb = 3 [(gogoproto.customname) = "Verb"]; + + // Address is an object address for which token is issued + refs.Address Address = 4 [(gogoproto.nullable) = false, (gogoproto.customtype) = "Address"]; + + // Created is an initial epoch of token lifetime + uint64 Created = 5; + + // ValidUntil is a last epoch of token lifetime + uint64 ValidUntil = 6; + + // SessionKey is a public key of session key + bytes SessionKey = 7; + } + + // TokenInfo is a grouped information about token + Info TokenInfo = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + + // Signature is a signature of session token information + bytes Signature = 8; +} + +// TODO: for variable token types and version redefine message +// Example: +// message Token { +// TokenType TokenType = 1; +// uint32 Version = 2; +// bytes Data = 3; +// } diff --git a/session/service.pb.go b/session/service.pb.go index abd1618..1088308 100644 --- a/session/service.pb.go +++ b/session/service.pb.go @@ -80,10 +80,10 @@ type isCreateRequest_Message interface { } type CreateRequest_Init struct { - Init *Token `protobuf:"bytes,1,opt,name=Init,proto3,oneof" json:"Init,omitempty"` + Init *service.Token `protobuf:"bytes,1,opt,name=Init,proto3,oneof" json:"Init,omitempty"` } type CreateRequest_Signed struct { - Signed *Token `protobuf:"bytes,2,opt,name=Signed,proto3,oneof" json:"Signed,omitempty"` + Signed *service.Token `protobuf:"bytes,2,opt,name=Signed,proto3,oneof" json:"Signed,omitempty"` } func (*CreateRequest_Init) isCreateRequest_Message() {} @@ -96,14 +96,14 @@ func (m *CreateRequest) GetMessage() isCreateRequest_Message { return nil } -func (m *CreateRequest) GetInit() *Token { +func (m *CreateRequest) GetInit() *service.Token { if x, ok := m.GetMessage().(*CreateRequest_Init); ok { return x.Init } return nil } -func (m *CreateRequest) GetSigned() *Token { +func (m *CreateRequest) GetSigned() *service.Token { if x, ok := m.GetMessage().(*CreateRequest_Signed); ok { return x.Signed } @@ -164,10 +164,10 @@ type isCreateResponse_Message interface { } type CreateResponse_Unsigned struct { - Unsigned *Token `protobuf:"bytes,1,opt,name=Unsigned,proto3,oneof" json:"Unsigned,omitempty"` + Unsigned *service.Token `protobuf:"bytes,1,opt,name=Unsigned,proto3,oneof" json:"Unsigned,omitempty"` } type CreateResponse_Result struct { - Result *Token `protobuf:"bytes,2,opt,name=Result,proto3,oneof" json:"Result,omitempty"` + Result *service.Token `protobuf:"bytes,2,opt,name=Result,proto3,oneof" json:"Result,omitempty"` } func (*CreateResponse_Unsigned) isCreateResponse_Message() {} @@ -180,14 +180,14 @@ func (m *CreateResponse) GetMessage() isCreateResponse_Message { return nil } -func (m *CreateResponse) GetUnsigned() *Token { +func (m *CreateResponse) GetUnsigned() *service.Token { if x, ok := m.GetMessage().(*CreateResponse_Unsigned); ok { return x.Unsigned } return nil } -func (m *CreateResponse) GetResult() *Token { +func (m *CreateResponse) GetResult() *service.Token { if x, ok := m.GetMessage().(*CreateResponse_Result); ok { return x.Result } @@ -210,32 +210,31 @@ func init() { func init() { proto.RegisterFile("session/service.proto", fileDescriptor_b329bee0fd1148e0) } var fileDescriptor_b329bee0fd1148e0 = []byte{ - // 388 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x52, 0x4f, 0x6f, 0xda, 0x30, - 0x14, 0xc7, 0x08, 0x05, 0xe6, 0x69, 0x48, 0xf3, 0xfe, 0x45, 0x39, 0x84, 0x09, 0xed, 0xc0, 0xa4, - 0x25, 0x99, 0xd8, 0x65, 0x97, 0x1d, 0xc6, 0xa6, 0x0a, 0x0e, 0x54, 0x55, 0xd2, 0xf6, 0xd0, 0x5b, - 0x12, 0x1e, 0xa9, 0xd5, 0x62, 0xa7, 0xb1, 0x83, 0xc4, 0x37, 0xe9, 0x67, 0xe8, 0x27, 0xe1, 0xc8, - 0xb1, 0x27, 0x54, 0xa5, 0xb7, 0x7e, 0x8a, 0x0a, 0xc7, 0x41, 0xb4, 0x88, 0x9b, 0xdf, 0xef, 0xcf, - 0x7b, 0xef, 0x67, 0x1b, 0x7f, 0x12, 0x20, 0x04, 0xe5, 0xcc, 0x13, 0x90, 0xcd, 0x69, 0x0c, 0x6e, - 0x9a, 0x71, 0xc9, 0x49, 0x53, 0xc3, 0xd6, 0x87, 0x8a, 0x97, 0x8b, 0x14, 0x44, 0xc9, 0x5a, 0x44, - 0x8b, 0xbd, 0x19, 0xc8, 0x50, 0x63, 0x1f, 0x2b, 0x6c, 0x0e, 0x19, 0x9d, 0x2e, 0x34, 0xea, 0x24, - 0x54, 0x5e, 0xe6, 0x91, 0x1b, 0xf3, 0x99, 0x97, 0xf0, 0x84, 0x7b, 0x0a, 0x8e, 0xf2, 0xa9, 0xaa, - 0x54, 0xa1, 0x4e, 0xa5, 0xbc, 0xfb, 0x84, 0xf0, 0xbb, 0x7f, 0x19, 0x84, 0x12, 0x7c, 0xb8, 0xc9, - 0x41, 0x48, 0xf2, 0x0d, 0x37, 0x46, 0x8c, 0x4a, 0x13, 0x7d, 0x45, 0xbd, 0xb7, 0xfd, 0xb6, 0xab, - 0xd7, 0x71, 0x4f, 0xf9, 0x15, 0xb0, 0x61, 0xcd, 0x57, 0x2c, 0xe9, 0x61, 0x23, 0xa0, 0x09, 0x83, - 0x89, 0x59, 0x3f, 0xa0, 0xd3, 0x3c, 0xf9, 0x8d, 0x1b, 0x63, 0x90, 0xa1, 0x19, 0x29, 0x9d, 0xe5, - 0x56, 0xb1, 0xf5, 0xbc, 0x0d, 0x37, 0x84, 0x70, 0x02, 0xd9, 0xa0, 0xb5, 0x5c, 0x77, 0x6a, 0xab, - 0x75, 0x07, 0xf9, 0xca, 0x41, 0xfe, 0x63, 0xe3, 0x5c, 0x45, 0x33, 0x63, 0xe5, 0xed, 0xbe, 0xf6, - 0x2a, 0x96, 0xc6, 0xa1, 0xa4, 0x9c, 0xed, 0xf5, 0xd0, 0xde, 0xc1, 0x1b, 0xdc, 0x1c, 0x83, 0x10, - 0x61, 0x02, 0x5d, 0x81, 0xdb, 0x55, 0x56, 0x91, 0x72, 0x26, 0x80, 0xfc, 0xc0, 0xad, 0x33, 0x26, - 0xca, 0x20, 0x87, 0x02, 0x6f, 0x15, 0x9b, 0xd0, 0x3e, 0x88, 0xfc, 0x5a, 0x1e, 0x0e, 0x5d, 0xf2, - 0x3b, 0x43, 0xfb, 0x43, 0xdc, 0x0c, 0x4a, 0x15, 0xf9, 0x83, 0x8d, 0x72, 0x3e, 0xf9, 0xbc, 0x75, - 0xbe, 0xb8, 0x7c, 0xeb, 0xcb, 0x1e, 0x5e, 0x2e, 0xda, 0x43, 0x3f, 0xd1, 0x20, 0x58, 0x16, 0x36, - 0x5a, 0x15, 0x36, 0xba, 0x2f, 0x6c, 0xf4, 0x50, 0xd8, 0xe8, 0xf6, 0xd1, 0xae, 0x5d, 0x7c, 0xdf, - 0x79, 0x70, 0x26, 0xd2, 0x38, 0x76, 0x26, 0x30, 0xf7, 0x18, 0xf0, 0xa9, 0x70, 0xc2, 0x94, 0x3a, - 0x09, 0xf7, 0x74, 0xcf, 0xbb, 0xfa, 0xfb, 0x63, 0xe0, 0x47, 0x81, 0xfb, 0xf7, 0x64, 0xe4, 0xea, - 0x9d, 0x22, 0x43, 0xfd, 0x83, 0x5f, 0xcf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x18, 0x94, 0x4c, 0x61, - 0x97, 0x02, 0x00, 0x00, + // 380 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x52, 0x4f, 0x4f, 0xe2, 0x40, + 0x14, 0x67, 0x08, 0x29, 0xec, 0x6c, 0x96, 0x64, 0x27, 0xfb, 0xa7, 0xe9, 0xa1, 0x6c, 0xc8, 0x1e, + 0xd8, 0x64, 0xdb, 0x1a, 0xbc, 0x78, 0xf1, 0x20, 0x1a, 0x03, 0x07, 0x8c, 0x69, 0xd5, 0x83, 0xb7, + 0xb6, 0x3c, 0xea, 0x44, 0x99, 0xa9, 0x9d, 0x29, 0x89, 0xdf, 0xc4, 0xcf, 0xe0, 0x27, 0xe1, 0xc8, + 0xd1, 0x13, 0x31, 0xf5, 0xe6, 0xa7, 0x30, 0x4c, 0x07, 0x82, 0x12, 0x6e, 0x7d, 0xbf, 0x3f, 0xef, + 0xbd, 0x5f, 0xdf, 0xe0, 0x9f, 0x02, 0x84, 0xa0, 0x9c, 0x79, 0x02, 0xb2, 0x29, 0x8d, 0xc1, 0x4d, + 0x33, 0x2e, 0x39, 0xa9, 0x6b, 0xd8, 0x22, 0x1a, 0xf7, 0x26, 0x20, 0xc3, 0x92, 0xb4, 0x7e, 0xac, + 0xb0, 0x29, 0x64, 0x74, 0xfc, 0xa0, 0x51, 0x27, 0xa1, 0xf2, 0x26, 0x8f, 0xdc, 0x98, 0x4f, 0xbc, + 0x84, 0x27, 0xdc, 0x53, 0x70, 0x94, 0x8f, 0x55, 0xa5, 0x0a, 0xf5, 0x55, 0xca, 0xdb, 0x6f, 0x08, + 0x7f, 0x3b, 0xce, 0x20, 0x94, 0xe0, 0xc3, 0x7d, 0x0e, 0x42, 0x92, 0xbf, 0xb8, 0x36, 0x60, 0x54, + 0x9a, 0xe8, 0x0f, 0xea, 0x7c, 0xed, 0x36, 0xdd, 0xd5, 0x46, 0x17, 0xfc, 0x16, 0x58, 0xbf, 0xe2, + 0x2b, 0x96, 0x74, 0xb0, 0x11, 0xd0, 0x84, 0xc1, 0xc8, 0xac, 0xee, 0xd0, 0x69, 0x9e, 0x1c, 0xe0, + 0xda, 0x10, 0x64, 0x68, 0x46, 0x4a, 0x67, 0xad, 0x75, 0x7a, 0xde, 0x92, 0xeb, 0x43, 0x38, 0x82, + 0xac, 0xd7, 0x98, 0x2d, 0x5a, 0x95, 0xf9, 0xa2, 0x85, 0x7c, 0xe5, 0x20, 0x27, 0xd8, 0xb8, 0x52, + 0xd1, 0xcc, 0x58, 0x79, 0xdb, 0x9f, 0xbd, 0x8a, 0xa5, 0x71, 0x28, 0x29, 0x67, 0x5b, 0x3d, 0xb4, + 0xb7, 0xf7, 0x05, 0xd7, 0x87, 0x20, 0x44, 0x98, 0x40, 0x5b, 0xe0, 0xe6, 0x2a, 0xab, 0x48, 0x39, + 0x13, 0x40, 0xfe, 0xe3, 0xc6, 0x25, 0x13, 0x65, 0x90, 0x5d, 0x81, 0xd7, 0x8a, 0x65, 0x68, 0x1f, + 0x44, 0x7e, 0x27, 0x77, 0x87, 0x2e, 0xf9, 0x8d, 0xa1, 0xdd, 0x3e, 0xae, 0x07, 0xe5, 0x15, 0xc9, + 0x21, 0x36, 0xca, 0xf9, 0xe4, 0x97, 0xab, 0x2f, 0xeb, 0x7e, 0xf8, 0xf9, 0xd6, 0xef, 0x2d, 0xbc, + 0x5c, 0xb4, 0x83, 0xf6, 0x50, 0x2f, 0x98, 0x15, 0x36, 0x9a, 0x17, 0x36, 0x7a, 0x2e, 0x6c, 0xf4, + 0x52, 0xd8, 0xe8, 0xf1, 0xd5, 0xae, 0x5c, 0xff, 0xdb, 0x38, 0x38, 0x13, 0x69, 0x1c, 0x3b, 0x23, + 0x98, 0x7a, 0x0c, 0xf8, 0x58, 0x38, 0x61, 0x4a, 0x9d, 0x84, 0x7b, 0xba, 0xe7, 0x53, 0xf5, 0xfb, + 0x19, 0xf0, 0xd3, 0xc0, 0x3d, 0x3a, 0x1f, 0xb8, 0x7a, 0xa7, 0xc8, 0x50, 0xef, 0x60, 0xff, 0x3d, + 0x00, 0x00, 0xff, 0xff, 0x70, 0x53, 0x71, 0xf3, 0x82, 0x02, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -708,7 +707,7 @@ func (m *CreateRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &Token{} + v := &service.Token{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -743,7 +742,7 @@ func (m *CreateRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &Token{} + v := &service.Token{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -898,7 +897,7 @@ func (m *CreateResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &Token{} + v := &service.Token{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -933,7 +932,7 @@ func (m *CreateResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &Token{} + v := &service.Token{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } diff --git a/session/service.proto b/session/service.proto index 524213a..5c22fc3 100644 --- a/session/service.proto +++ b/session/service.proto @@ -3,7 +3,6 @@ package session; option go_package = "github.com/nspcc-dev/neofs-api-go/session"; option csharp_namespace = "NeoFS.API.Session"; -import "session/types.proto"; import "service/meta.proto"; import "service/verify.proto"; import "github.com/gogo/protobuf/gogoproto/gogo.proto"; @@ -33,9 +32,9 @@ message CreateRequest { // owner of manipulation object; // ID of manipulation object; // token lifetime bounds. - session.Token Init = 1; + service.Token Init = 1; // Signed Init message response (Unsigned) from server with user private key - session.Token Signed = 2; + service.Token Signed = 2; } // RequestMetaHeader contains information about request meta headers (should be embedded into message) service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; @@ -46,8 +45,8 @@ message CreateRequest { message CreateResponse { oneof Message { // Unsigned token with token ID and session public key generated on server side - session.Token Unsigned = 1; + service.Token Unsigned = 1; // Result is a resulting token which can be used for object placing through an trusted intermediary - session.Token Result = 2; + service.Token Result = 2; } } diff --git a/session/types.pb.go b/session/types.pb.go deleted file mode 100644 index 01458dd..0000000 --- a/session/types.pb.go +++ /dev/null @@ -1,913 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: session/types.proto - -package session - -import ( - fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/golang/protobuf/proto" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package - -type VerificationHeader struct { - // PublicKey is a session public key - PublicKey []byte `protobuf:"bytes,1,opt,name=PublicKey,proto3" json:"PublicKey,omitempty"` - // KeySignature is a session public key signature. Signed by trusted side - KeySignature []byte `protobuf:"bytes,2,opt,name=KeySignature,proto3" json:"KeySignature,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *VerificationHeader) Reset() { *m = VerificationHeader{} } -func (m *VerificationHeader) String() string { return proto.CompactTextString(m) } -func (*VerificationHeader) ProtoMessage() {} -func (*VerificationHeader) Descriptor() ([]byte, []int) { - return fileDescriptor_c0d9d9cb855cdad8, []int{0} -} -func (m *VerificationHeader) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *VerificationHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *VerificationHeader) XXX_Merge(src proto.Message) { - xxx_messageInfo_VerificationHeader.Merge(m, src) -} -func (m *VerificationHeader) XXX_Size() int { - return m.Size() -} -func (m *VerificationHeader) XXX_DiscardUnknown() { - xxx_messageInfo_VerificationHeader.DiscardUnknown(m) -} - -var xxx_messageInfo_VerificationHeader proto.InternalMessageInfo - -func (m *VerificationHeader) GetPublicKey() []byte { - if m != nil { - return m.PublicKey - } - return nil -} - -func (m *VerificationHeader) GetKeySignature() []byte { - if m != nil { - return m.KeySignature - } - return nil -} - -// User token granting rights for object manipulation -type Token struct { - // Header carries verification data of session key - Header VerificationHeader `protobuf:"bytes,1,opt,name=Header,proto3" json:"Header"` - // OwnerID is an owner of manipulation object - OwnerID OwnerID `protobuf:"bytes,2,opt,name=OwnerID,proto3,customtype=OwnerID" json:"OwnerID"` - // FirstEpoch is an initial epoch of token lifetime - FirstEpoch uint64 `protobuf:"varint,3,opt,name=FirstEpoch,proto3" json:"FirstEpoch,omitempty"` - // LastEpoch is a last epoch of token lifetime - LastEpoch uint64 `protobuf:"varint,4,opt,name=LastEpoch,proto3" json:"LastEpoch,omitempty"` - // ObjectID is an object identifier of manipulation object - ObjectID []ObjectID `protobuf:"bytes,5,rep,name=ObjectID,proto3,customtype=ObjectID" json:"ObjectID"` - // Signature is a token signature, signed by owner of manipulation object - Signature []byte `protobuf:"bytes,6,opt,name=Signature,proto3" json:"Signature,omitempty"` - // ID is a token identifier. valid UUIDv4 represented in bytes - ID TokenID `protobuf:"bytes,7,opt,name=ID,proto3,customtype=TokenID" json:"ID"` - // PublicKeys associated with owner - PublicKeys [][]byte `protobuf:"bytes,8,rep,name=PublicKeys,proto3" json:"PublicKeys,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Token) Reset() { *m = Token{} } -func (m *Token) String() string { return proto.CompactTextString(m) } -func (*Token) ProtoMessage() {} -func (*Token) Descriptor() ([]byte, []int) { - return fileDescriptor_c0d9d9cb855cdad8, []int{1} -} -func (m *Token) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Token) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *Token) XXX_Merge(src proto.Message) { - xxx_messageInfo_Token.Merge(m, src) -} -func (m *Token) XXX_Size() int { - return m.Size() -} -func (m *Token) XXX_DiscardUnknown() { - xxx_messageInfo_Token.DiscardUnknown(m) -} - -var xxx_messageInfo_Token proto.InternalMessageInfo - -func (m *Token) GetHeader() VerificationHeader { - if m != nil { - return m.Header - } - return VerificationHeader{} -} - -func (m *Token) GetFirstEpoch() uint64 { - if m != nil { - return m.FirstEpoch - } - return 0 -} - -func (m *Token) GetLastEpoch() uint64 { - if m != nil { - return m.LastEpoch - } - return 0 -} - -func (m *Token) GetSignature() []byte { - if m != nil { - return m.Signature - } - return nil -} - -func (m *Token) GetPublicKeys() [][]byte { - if m != nil { - return m.PublicKeys - } - return nil -} - -func init() { - proto.RegisterType((*VerificationHeader)(nil), "session.VerificationHeader") - proto.RegisterType((*Token)(nil), "session.Token") -} - -func init() { proto.RegisterFile("session/types.proto", fileDescriptor_c0d9d9cb855cdad8) } - -var fileDescriptor_c0d9d9cb855cdad8 = []byte{ - // 374 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x91, 0xcd, 0x4e, 0x83, 0x40, - 0x14, 0x85, 0x0b, 0xfd, 0x75, 0x6c, 0xa2, 0x8e, 0x1b, 0xa2, 0x86, 0x36, 0x5d, 0xb5, 0x89, 0x40, - 0xa2, 0x2b, 0x97, 0x12, 0x6c, 0x24, 0x35, 0xb6, 0x01, 0xd3, 0x85, 0x3b, 0xa0, 0x53, 0x3a, 0xfe, - 0x30, 0x84, 0x19, 0x34, 0x7d, 0x13, 0x9f, 0xc1, 0x27, 0xf0, 0x11, 0xba, 0x74, 0x69, 0x5c, 0x34, - 0x06, 0x5f, 0xc4, 0x30, 0x50, 0xda, 0xc6, 0xdd, 0x9d, 0xef, 0xcc, 0xdc, 0x73, 0xe7, 0x5c, 0x70, - 0x48, 0x11, 0xa5, 0x98, 0x04, 0x1a, 0x9b, 0x87, 0x88, 0xaa, 0x61, 0x44, 0x18, 0x81, 0xf5, 0x1c, - 0x1e, 0x29, 0x3e, 0x66, 0xb3, 0xd8, 0x55, 0x3d, 0xf2, 0xac, 0xf9, 0xc4, 0x27, 0x1a, 0xd7, 0xdd, - 0x78, 0xca, 0x4f, 0xfc, 0xc0, 0xab, 0xec, 0x5d, 0x67, 0x0c, 0xe0, 0x18, 0x45, 0x78, 0x8a, 0x3d, - 0x87, 0x61, 0x12, 0x5c, 0x23, 0x67, 0x82, 0x22, 0x78, 0x02, 0x76, 0x46, 0xb1, 0xfb, 0x84, 0xbd, - 0x01, 0x9a, 0x4b, 0x42, 0x5b, 0xe8, 0x36, 0xad, 0x35, 0x80, 0x1d, 0xd0, 0x1c, 0xa0, 0xb9, 0x8d, - 0xfd, 0xc0, 0x61, 0x71, 0x84, 0x24, 0x91, 0x5f, 0xd8, 0x62, 0x9d, 0x0f, 0x11, 0x54, 0xef, 0xc8, - 0x23, 0x0a, 0xe0, 0x05, 0xa8, 0x65, 0x5d, 0x79, 0xa3, 0xdd, 0xb3, 0x63, 0x35, 0x1f, 0x55, 0xfd, - 0x6f, 0xac, 0x57, 0x16, 0xcb, 0x56, 0xc9, 0xca, 0x1f, 0xc0, 0x1e, 0xa8, 0x0f, 0x5f, 0x03, 0x14, - 0x99, 0x46, 0xe6, 0xa1, 0xef, 0xa5, 0xf2, 0xf7, 0xb2, 0xb5, 0xc2, 0xd6, 0xaa, 0x80, 0x32, 0x00, - 0x7d, 0x1c, 0x51, 0x76, 0x15, 0x12, 0x6f, 0x26, 0x95, 0xdb, 0x42, 0xb7, 0x62, 0x6d, 0x90, 0xf4, - 0x47, 0x37, 0xce, 0x4a, 0xae, 0x70, 0x79, 0x0d, 0xe0, 0x29, 0x68, 0x0c, 0xdd, 0x07, 0xe4, 0x31, - 0xd3, 0x90, 0xaa, 0xed, 0x72, 0xb7, 0xa9, 0xef, 0xe7, 0x4e, 0x05, 0xb7, 0x8a, 0x2a, 0xed, 0xb5, - 0xfe, 0x7c, 0x2d, 0x4b, 0xa7, 0x00, 0xb0, 0x05, 0x44, 0xd3, 0x90, 0xea, 0xdb, 0xf3, 0xf2, 0x28, - 0x4c, 0xc3, 0x12, 0xb3, 0x51, 0x8b, 0x2c, 0xa9, 0xd4, 0x48, 0xed, 0xac, 0x0d, 0xa2, 0xdb, 0x8b, - 0x44, 0x16, 0x3e, 0x13, 0x59, 0xf8, 0x4a, 0x64, 0xe1, 0x27, 0x91, 0x85, 0xb7, 0x5f, 0xb9, 0x74, - 0xdf, 0xdb, 0xd8, 0x6b, 0x40, 0x43, 0xcf, 0x53, 0x26, 0xe8, 0x45, 0x0b, 0x10, 0x99, 0x52, 0xc5, - 0x09, 0xb1, 0xe2, 0x13, 0x2d, 0xcf, 0xf5, 0x5d, 0x3c, 0xb8, 0x45, 0xa4, 0x6f, 0xab, 0x97, 0x23, - 0x53, 0xb5, 0x33, 0xe6, 0xd6, 0xf8, 0xba, 0xcf, 0xff, 0x02, 0x00, 0x00, 0xff, 0xff, 0xa2, 0x24, - 0xcd, 0x60, 0x3d, 0x02, 0x00, 0x00, -} - -func (m *VerificationHeader) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *VerificationHeader) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *VerificationHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.KeySignature) > 0 { - i -= len(m.KeySignature) - copy(dAtA[i:], m.KeySignature) - i = encodeVarintTypes(dAtA, i, uint64(len(m.KeySignature))) - i-- - dAtA[i] = 0x12 - } - if len(m.PublicKey) > 0 { - i -= len(m.PublicKey) - copy(dAtA[i:], m.PublicKey) - i = encodeVarintTypes(dAtA, i, uint64(len(m.PublicKey))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Token) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Token) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Token) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.PublicKeys) > 0 { - for iNdEx := len(m.PublicKeys) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.PublicKeys[iNdEx]) - copy(dAtA[i:], m.PublicKeys[iNdEx]) - i = encodeVarintTypes(dAtA, i, uint64(len(m.PublicKeys[iNdEx]))) - i-- - dAtA[i] = 0x42 - } - } - { - size := m.ID.Size() - i -= size - if _, err := m.ID.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x3a - if len(m.Signature) > 0 { - i -= len(m.Signature) - copy(dAtA[i:], m.Signature) - i = encodeVarintTypes(dAtA, i, uint64(len(m.Signature))) - i-- - dAtA[i] = 0x32 - } - if len(m.ObjectID) > 0 { - for iNdEx := len(m.ObjectID) - 1; iNdEx >= 0; iNdEx-- { - { - size := m.ObjectID[iNdEx].Size() - i -= size - if _, err := m.ObjectID[iNdEx].MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2a - } - } - if m.LastEpoch != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.LastEpoch)) - i-- - dAtA[i] = 0x20 - } - if m.FirstEpoch != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.FirstEpoch)) - i-- - dAtA[i] = 0x18 - } - { - size := m.OwnerID.Size() - i -= size - if _, err := m.OwnerID.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func encodeVarintTypes(dAtA []byte, offset int, v uint64) int { - offset -= sovTypes(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *VerificationHeader) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.PublicKey) - if l > 0 { - n += 1 + l + sovTypes(uint64(l)) - } - l = len(m.KeySignature) - if l > 0 { - n += 1 + l + sovTypes(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *Token) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Header.Size() - n += 1 + l + sovTypes(uint64(l)) - l = m.OwnerID.Size() - n += 1 + l + sovTypes(uint64(l)) - if m.FirstEpoch != 0 { - n += 1 + sovTypes(uint64(m.FirstEpoch)) - } - if m.LastEpoch != 0 { - n += 1 + sovTypes(uint64(m.LastEpoch)) - } - if len(m.ObjectID) > 0 { - for _, e := range m.ObjectID { - l = e.Size() - n += 1 + l + sovTypes(uint64(l)) - } - } - l = len(m.Signature) - if l > 0 { - n += 1 + l + sovTypes(uint64(l)) - } - l = m.ID.Size() - n += 1 + l + sovTypes(uint64(l)) - if len(m.PublicKeys) > 0 { - for _, b := range m.PublicKeys { - l = len(b) - n += 1 + l + sovTypes(uint64(l)) - } - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func sovTypes(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozTypes(x uint64) (n int) { - return sovTypes(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *VerificationHeader) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: VerificationHeader: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: VerificationHeader: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PublicKey", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.PublicKey = append(m.PublicKey[:0], dAtA[iNdEx:postIndex]...) - if m.PublicKey == nil { - m.PublicKey = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field KeySignature", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.KeySignature = append(m.KeySignature[:0], dAtA[iNdEx:postIndex]...) - if m.KeySignature == nil { - m.KeySignature = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Token) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Token: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Token: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Header.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OwnerID", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.OwnerID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field FirstEpoch", wireType) - } - m.FirstEpoch = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.FirstEpoch |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field LastEpoch", wireType) - } - m.LastEpoch = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.LastEpoch |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ObjectID", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - var v ObjectID - m.ObjectID = append(m.ObjectID, v) - if err := m.ObjectID[len(m.ObjectID)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Signature", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Signature = append(m.Signature[:0], dAtA[iNdEx:postIndex]...) - if m.Signature == nil { - m.Signature = []byte{} - } - iNdEx = postIndex - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 8: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PublicKeys", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.PublicKeys = append(m.PublicKeys, make([]byte, postIndex-iNdEx)) - copy(m.PublicKeys[len(m.PublicKeys)-1], dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipTypes(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTypes - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTypes - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTypes - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthTypes - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupTypes - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthTypes - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthTypes = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowTypes = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupTypes = fmt.Errorf("proto: unexpected end of group") -) diff --git a/session/types.proto b/session/types.proto deleted file mode 100644 index 3ae49a3..0000000 --- a/session/types.proto +++ /dev/null @@ -1,35 +0,0 @@ -syntax = "proto3"; -package session; -option go_package = "github.com/nspcc-dev/neofs-api-go/session"; -option csharp_namespace = "NeoFS.API.Session"; - -import "github.com/gogo/protobuf/gogoproto/gogo.proto"; - -option (gogoproto.stable_marshaler_all) = true; - -message VerificationHeader { - // PublicKey is a session public key - bytes PublicKey = 1; - // KeySignature is a session public key signature. Signed by trusted side - bytes KeySignature = 2; -} - -// User token granting rights for object manipulation -message Token { - // Header carries verification data of session key - VerificationHeader Header = 1 [(gogoproto.nullable) = false]; - // OwnerID is an owner of manipulation object - bytes OwnerID = 2 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false]; - // FirstEpoch is an initial epoch of token lifetime - uint64 FirstEpoch = 3; - // LastEpoch is a last epoch of token lifetime - uint64 LastEpoch = 4; - // ObjectID is an object identifier of manipulation object - repeated bytes ObjectID = 5 [(gogoproto.customtype) = "ObjectID", (gogoproto.nullable) = false]; - // Signature is a token signature, signed by owner of manipulation object - bytes Signature = 6; - // ID is a token identifier. valid UUIDv4 represented in bytes - bytes ID = 7 [(gogoproto.customtype) = "TokenID", (gogoproto.nullable) = false]; - // PublicKeys associated with owner - repeated bytes PublicKeys = 8; -} From 24108f42c3afe8b70358cb420ed88d6b74533314 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 28 Apr 2020 12:51:27 +0300 Subject: [PATCH 0149/1196] Regenerate docs --- docs/object.md | 6 +---- docs/service.md | 67 ++++++++++++++++++++++++++++++++++++++----------- docs/session.md | 59 +++---------------------------------------- 3 files changed, 57 insertions(+), 75 deletions(-) diff --git a/docs/object.md b/docs/object.md index 4ec32fc..27e4bcf 100644 --- a/docs/object.md +++ b/docs/object.md @@ -149,7 +149,6 @@ calculated for XORed data. | ----- | ---- | ----- | ----------- | | Address | [refs.Address](#refs.Address) | | Address of object (container id + object id) | | OwnerID | [bytes](#bytes) | | OwnerID is a wallet address | -| Token | [session.Token](#session.Token) | | Token with session public key and user's signature | | Meta | [service.RequestMetaHeader](#service.RequestMetaHeader) | | RequestMetaHeader contains information about request meta headers (should be embedded into message) | | Verify | [service.RequestVerificationHeader](#service.RequestVerificationHeader) | | RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) | @@ -228,7 +227,6 @@ in distributed system. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | | Address | [refs.Address](#refs.Address) | | Address of object (container id + object id) | -| Raw | [bool](#bool) | | Raw is the request flag of a physically stored representation of an object | | Meta | [service.RequestMetaHeader](#service.RequestMetaHeader) | | RequestMetaHeader contains information about request meta headers (should be embedded into message) | | Verify | [service.RequestVerificationHeader](#service.RequestVerificationHeader) | | RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) | @@ -256,7 +254,6 @@ in distributed system. | ----- | ---- | ----- | ----------- | | Address | [refs.Address](#refs.Address) | | Address of object (container id + object id) | | FullHeaders | [bool](#bool) | | FullHeaders can be set true for extended headers in the object | -| Raw | [bool](#bool) | | Raw is the request flag of a physically stored representation of an object | | Meta | [service.RequestMetaHeader](#service.RequestMetaHeader) | | RequestMetaHeader contains information about request meta headers (should be embedded into message) | | Verify | [service.RequestVerificationHeader](#service.RequestVerificationHeader) | | RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) | @@ -296,7 +293,6 @@ in distributed system. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | | Object | [Object](#object.Object) | | Object with at least container id and owner id fields | -| Token | [session.Token](#session.Token) | | Token with session public key and user's signature | | CopiesNumber | [uint32](#uint32) | | Number of the object copies to store within the RPC call (zero is processed according to the placement rules) | @@ -378,7 +374,7 @@ in distributed system. | UserHeader | [UserHeader](#object.UserHeader) | | UserHeader is a set of KV headers defined by user | | Transform | [Transform](#object.Transform) | | Transform defines transform operation (e.g. payload split) | | Tombstone | [Tombstone](#object.Tombstone) | | Tombstone header that set up in deleted objects | -| Verify | [session.VerificationHeader](#session.VerificationHeader) | | Verify header that contains session public key and user's signature | +| Token | [service.Token](#service.Token) | | Token header contains token of the session within which the object was created | | HomoHash | [bytes](#bytes) | | HomoHash is a homomorphic hash of original object payload | | PayloadChecksum | [bytes](#bytes) | | PayloadChecksum of actual object's payload | | Integrity | [IntegrityHeader](#object.IntegrityHeader) | | Integrity header with checksum of all above headers in the object | diff --git a/docs/service.md b/docs/service.md index 90e1bd2..eef1e49 100644 --- a/docs/service.md +++ b/docs/service.md @@ -14,8 +14,9 @@ - Messages - [RequestVerificationHeader](#service.RequestVerificationHeader) - - [RequestVerificationHeader.Sign](#service.RequestVerificationHeader.Sign) - [RequestVerificationHeader.Signature](#service.RequestVerificationHeader.Signature) + - [Token](#service.Token) + - [Token.Info](#service.Token.Info) - [service/verify_test.proto](#service/verify_test.proto) @@ -49,6 +50,7 @@ RequestMetaHeader contains information about request meta headers | TTL | [uint32](#uint32) | | TTL must be larger than zero, it decreased in every NeoFS Node | | Epoch | [uint64](#uint64) | | Epoch for user can be empty, because node sets epoch to the actual value | | Version | [uint32](#uint32) | | Version defines protocol version TODO: not used for now, should be implemented in future | +| Raw | [bool](#bool) | | Raw determines whether the request is raw or not | @@ -88,18 +90,7 @@ RequestVerificationHeader is a set of signatures of every NeoFS Node that proces | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | | Signatures | [RequestVerificationHeader.Signature](#service.RequestVerificationHeader.Signature) | repeated | Signatures is a set of signatures of every passed NeoFS Node | - - - - -### Message RequestVerificationHeader.Sign - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| Sign | [bytes](#bytes) | | Sign is signature of the request or session key. | -| Peer | [bytes](#bytes) | | Peer is compressed public key used for signature. | +| Token | [Token](#service.Token) | | Token is a token of the session within which the request is sent | @@ -110,11 +101,57 @@ RequestVerificationHeader is a set of signatures of every NeoFS Node that proces | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| Sign | [RequestVerificationHeader.Sign](#service.RequestVerificationHeader.Sign) | | Sign is a signature and public key of the request. | -| Origin | [RequestVerificationHeader.Sign](#service.RequestVerificationHeader.Sign) | | Origin used for requests, when trusted node changes it and re-sign with session key. If session key used for signature request, then Origin should contain public key of user and signed session key. | +| Sign | [bytes](#bytes) | | Sign is signature of the request or session key. | +| Peer | [bytes](#bytes) | | Peer is compressed public key used for signature. | + + + + +### Message Token +User token granting rights for object manipulation + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| TokenInfo | [Token.Info](#service.Token.Info) | | TokenInfo is a grouped information about token | +| Signature | [bytes](#bytes) | | Signature is a signature of session token information | + + + + +### Message Token.Info + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| ID | [bytes](#bytes) | | ID is a token identifier. valid UUIDv4 represented in bytes | +| OwnerID | [bytes](#bytes) | | OwnerID is an owner of manipulation object | +| verb | [Token.Info.Verb](#service.Token.Info.Verb) | | Verb is a type of request for which the token is issued | +| Address | [refs.Address](#refs.Address) | | Address is an object address for which token is issued | +| Created | [uint64](#uint64) | | Created is an initial epoch of token lifetime | +| ValidUntil | [uint64](#uint64) | | ValidUntil is a last epoch of token lifetime | +| SessionKey | [bytes](#bytes) | | SessionKey is a public key of session key | + + + +### Token.Info.Verb +Verb is an enumeration of session request types + +| Name | Number | Description | +| ---- | ------ | ----------- | +| Put | 0 | Put refers to object.Put RPC call | +| Get | 1 | Get refers to object.Get RPC call | +| Head | 2 | Head refers to object.Head RPC call | +| Search | 3 | Search refers to object.Search RPC call | +| Delete | 4 | Delete refers to object.Delete RPC call | +| Range | 5 | Range refers to object.GetRange RPC call | +| RangeHash | 6 | RangeHash refers to object.GetRangeHash RPC call | + + diff --git a/docs/session.md b/docs/session.md index ba615c3..4a537e6 100644 --- a/docs/session.md +++ b/docs/session.md @@ -12,13 +12,6 @@ - [CreateResponse](#session.CreateResponse) -- [session/types.proto](#session/types.proto) - - - Messages - - [Token](#session.Token) - - [VerificationHeader](#session.VerificationHeader) - - - [Scalar Value Types](#scalar-value-types) @@ -68,8 +61,8 @@ session key. Session is established during 4-step handshake in one gRPC stream | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| Init | [Token](#session.Token) | | Init is a message to initialize session opening. Carry: owner of manipulation object; ID of manipulation object; token lifetime bounds. | -| Signed | [Token](#session.Token) | | Signed Init message response (Unsigned) from server with user private key | +| Init | [service.Token](#service.Token) | | Init is a message to initialize session opening. Carry: owner of manipulation object; ID of manipulation object; token lifetime bounds. | +| Signed | [service.Token](#service.Token) | | Signed Init message response (Unsigned) from server with user private key | | Meta | [service.RequestMetaHeader](#service.RequestMetaHeader) | | RequestMetaHeader contains information about request meta headers (should be embedded into message) | | Verify | [service.RequestVerificationHeader](#service.RequestVerificationHeader) | | RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) | @@ -82,52 +75,8 @@ session key. Session is established during 4-step handshake in one gRPC stream | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| Unsigned | [Token](#session.Token) | | Unsigned token with token ID and session public key generated on server side | -| Result | [Token](#session.Token) | | Result is a resulting token which can be used for object placing through an trusted intermediary | - - - - - - - - -

Top

- -## session/types.proto - - - - - - - -### Message Token -User token granting rights for object manipulation - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| Header | [VerificationHeader](#session.VerificationHeader) | | Header carries verification data of session key | -| OwnerID | [bytes](#bytes) | | OwnerID is an owner of manipulation object | -| FirstEpoch | [uint64](#uint64) | | FirstEpoch is an initial epoch of token lifetime | -| LastEpoch | [uint64](#uint64) | | LastEpoch is a last epoch of token lifetime | -| ObjectID | [bytes](#bytes) | repeated | ObjectID is an object identifier of manipulation object | -| Signature | [bytes](#bytes) | | Signature is a token signature, signed by owner of manipulation object | -| ID | [bytes](#bytes) | | ID is a token identifier. valid UUIDv4 represented in bytes | -| PublicKeys | [bytes](#bytes) | repeated | PublicKeys associated with owner | - - - - -### Message VerificationHeader - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| PublicKey | [bytes](#bytes) | | PublicKey is a session public key | -| KeySignature | [bytes](#bytes) | | KeySignature is a session public key signature. Signed by trusted side | +| Unsigned | [service.Token](#service.Token) | | Unsigned token with token ID and session public key generated on server side | +| Result | [service.Token](#service.Token) | | Result is a resulting token which can be used for object placing through an trusted intermediary | From 4ac17201b7c72e6621cad6c0955b738c28dba21b Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 28 Apr 2020 13:09:18 +0300 Subject: [PATCH 0150/1196] Resolve update conflicts --- object/extensions.go | 15 ----- object/service_test.go | 4 +- object/types.go | 16 ++--- object/utils.go | 4 +- object/verification.go | 4 +- object/verification_test.go | 18 ++--- service/alias.go | 14 ++++ service/verify.go | 30 +-------- service/verify_test.go | 19 ++---- session/service.go | 15 +---- session/store.go | 17 +++-- session/store_test.go | 95 +------------------------- session/types.go | 130 ++---------------------------------- 13 files changed, 61 insertions(+), 320 deletions(-) create mode 100644 service/alias.go diff --git a/object/extensions.go b/object/extensions.go index 6e577bd..be755c6 100644 --- a/object/extensions.go +++ b/object/extensions.go @@ -19,21 +19,6 @@ func (m Object) IsLinking() bool { return false } -// VerificationHeader returns verification header if it is presented in extended headers. -func (m Object) VerificationHeader() (*VerificationHeader, error) { - _, vh := m.LastHeader(HeaderType(VerifyHdr)) - if vh == nil { - return nil, ErrHeaderNotFound - } - return vh.Value.(*Header_Verify).Verify, nil -} - -// SetVerificationHeader sets verification header in the object. -// It will replace existing verification header or add a new one. -func (m *Object) SetVerificationHeader(header *VerificationHeader) { - m.SetHeader(&Header{Value: &Header_Verify{Verify: header}}) -} - // Links returns slice of ids of specified link type func (m *Object) Links(t Link_Type) []ID { var res []ID diff --git a/object/service_test.go b/object/service_test.go index 4b02b37..5b7a358 100644 --- a/object/service_test.go +++ b/object/service_test.go @@ -16,8 +16,8 @@ func TestRequest(t *testing.T) { &DeleteRequest{}, &GetRangeRequest{}, &GetRangeHashRequest{}, - MakePutRequestHeader(nil, nil), - MakePutRequestHeader(&Object{}, nil), + MakePutRequestHeader(nil), + MakePutRequestHeader(&Object{}), } types := []RequestType{ diff --git a/object/types.go b/object/types.go index aebb2fc..83b03c7 100644 --- a/object/types.go +++ b/object/types.go @@ -7,7 +7,6 @@ import ( "github.com/gogo/protobuf/proto" "github.com/nspcc-dev/neofs-api-go/internal" "github.com/nspcc-dev/neofs-api-go/refs" - "github.com/nspcc-dev/neofs-api-go/session" ) type ( @@ -19,9 +18,6 @@ type ( // Address is a type alias of object Address. Address = refs.Address - // VerificationHeader is a type alias of session's verification header. - VerificationHeader = session.VerificationHeader - // PositionReader defines object reader that returns slice of bytes // for specified object and data range. PositionReader interface { @@ -60,8 +56,8 @@ const ( TransformHdr // TombstoneHdr is a tombstone header type. TombstoneHdr - // VerifyHdr is a verification header type. - VerifyHdr + // TokenHdr is a token header type. + TokenHdr // HomoHashHdr is a homomorphic hash header type. HomoHashHdr // PayloadChecksumHdr is a payload checksum header type. @@ -175,8 +171,8 @@ func (m Header) typeOf(t isHeader_Value) (ok bool) { _, ok = m.Value.(*Header_Transform) case *Header_Tombstone: _, ok = m.Value.(*Header_Tombstone) - case *Header_Verify: - _, ok = m.Value.(*Header_Verify) + case *Header_Token: + _, ok = m.Value.(*Header_Token) case *Header_HomoHash: _, ok = m.Value.(*Header_HomoHash) case *Header_PayloadChecksum: @@ -205,8 +201,8 @@ func HeaderType(t headerType) Pred { return func(h *Header) bool { _, ok := h.Value.(*Header_Transform); return ok } case TombstoneHdr: return func(h *Header) bool { _, ok := h.Value.(*Header_Tombstone); return ok } - case VerifyHdr: - return func(h *Header) bool { _, ok := h.Value.(*Header_Verify); return ok } + case TokenHdr: + return func(h *Header) bool { _, ok := h.Value.(*Header_Token); return ok } case HomoHashHdr: return func(h *Header) bool { _, ok := h.Value.(*Header_HomoHash); return ok } case PayloadChecksumHdr: diff --git a/object/utils.go b/object/utils.go index 07f0984..33423aa 100644 --- a/object/utils.go +++ b/object/utils.go @@ -4,7 +4,6 @@ import ( "io" "strconv" - "github.com/nspcc-dev/neofs-api-go/session" "github.com/pkg/errors" ) @@ -46,11 +45,10 @@ func (b ByteSize) String() string { // MakePutRequestHeader combines object and session token value // into header of object put request. -func MakePutRequestHeader(obj *Object, token *session.Token) *PutRequest { +func MakePutRequestHeader(obj *Object) *PutRequest { return &PutRequest{ R: &PutRequest_Header{Header: &PutRequest_PutHeader{ Object: obj, - Token: token, }}, } } diff --git a/object/verification.go b/object/verification.go index a00b30a..5694316 100644 --- a/object/verification.go +++ b/object/verification.go @@ -77,7 +77,7 @@ func (m Object) Verify() error { integrity := ih.Value.(*Header_Integrity).Integrity // Prepare structures - _, vh := m.LastHeader(HeaderType(VerifyHdr)) + _, vh := m.LastHeader(HeaderType(TokenHdr)) if vh == nil { _, pkh := m.LastHeader(HeaderType(PublicKeyHdr)) if pkh == nil { @@ -85,7 +85,7 @@ func (m Object) Verify() error { } pubkey = pkh.Value.(*Header_PublicKey).PublicKey.Value } else { - pubkey = vh.Value.(*Header_Verify).Verify.PublicKey + pubkey = vh.Value.(*Header_Token).Token.SessionKey } // Verify signature diff --git a/object/verification_test.go b/object/verification_test.go index b37ec70..004f969 100644 --- a/object/verification_test.go +++ b/object/verification_test.go @@ -6,7 +6,7 @@ import ( "github.com/google/uuid" "github.com/nspcc-dev/neofs-api-go/container" "github.com/nspcc-dev/neofs-api-go/refs" - "github.com/nspcc-dev/neofs-api-go/session" + "github.com/nspcc-dev/neofs-api-go/service" crypto "github.com/nspcc-dev/neofs-crypto" "github.com/nspcc-dev/neofs-crypto/test" "github.com/stretchr/testify/require" @@ -77,11 +77,13 @@ func TestObject_Verify(t *testing.T) { dataPK := crypto.MarshalPublicKey(&sessionkey.PublicKey) signature, err = crypto.Sign(key, dataPK) - vh := &session.VerificationHeader{ - PublicKey: dataPK, - KeySignature: signature, + tok := &service.Token{ + Token_Info: service.Token_Info{ + SessionKey: dataPK, + }, + Signature: signature, } - obj.SetVerificationHeader(vh) + obj.AddHeader(&Header{Value: &Header_Token{Token: tok}}) // validation header is not last t.Run("error validation header is not last", func(t *testing.T) { @@ -90,7 +92,7 @@ func TestObject_Verify(t *testing.T) { }) obj.Headers = obj.Headers[:len(obj.Headers)-2] - obj.SetVerificationHeader(vh) + obj.AddHeader(&Header{Value: &Header_Token{Token: tok}}) obj.SetHeader(&Header{Value: &Header_Integrity{ih}}) t.Run("error invalid header checksum", func(t *testing.T) { @@ -115,7 +117,7 @@ func TestObject_Verify(t *testing.T) { require.NoError(t, err) obj.SetHeader(genIH) - t.Run("correct with vh", func(t *testing.T) { + t.Run("correct with tok", func(t *testing.T) { err = obj.Verify() require.NoError(t, err) }) @@ -123,7 +125,7 @@ func TestObject_Verify(t *testing.T) { pkh := Header{Value: &Header_PublicKey{&PublicKey{ Value: crypto.MarshalPublicKey(&key.PublicKey), }}} - // replace vh with pkh + // replace tok with pkh obj.Headers[len(obj.Headers)-2] = pkh // re-sign object obj.Sign(sessionkey) diff --git a/service/alias.go b/service/alias.go new file mode 100644 index 0000000..6c22ece --- /dev/null +++ b/service/alias.go @@ -0,0 +1,14 @@ +package service + +import ( + "github.com/nspcc-dev/neofs-api-go/refs" +) + +// TokenID is type alias of UUID ref. +type TokenID = refs.UUID + +// OwnerID is type alias of OwnerID ref. +type OwnerID = refs.OwnerID + +// Address is type alias of Address ref. +type Address = refs.Address diff --git a/service/verify.go b/service/verify.go index 9687032..ade13ef 100644 --- a/service/verify.go +++ b/service/verify.go @@ -53,18 +53,6 @@ func (m *RequestVerificationHeader) AddSignature(sig *RequestVerificationHeader_ m.Signatures = append(m.Signatures, sig) } -// SetOwner adds origin (sign and public key) of owner (client) into first signature. -func (m *RequestVerificationHeader) SetOwner(pub *ecdsa.PublicKey, sign []byte) { - if len(m.Signatures) == 0 || pub == nil { - return - } - - m.Signatures[0].Origin = &RequestVerificationHeader_Sign{ - Sign: sign, - Peer: crypto.MarshalPublicKey(pub), - } -} - // CheckOwner validates, that passed OwnerID is equal to present PublicKey of owner. func (m *RequestVerificationHeader) CheckOwner(owner refs.OwnerID) error { if key, err := m.GetOwner(); err != nil { @@ -83,18 +71,6 @@ func (m *RequestVerificationHeader) CheckOwner(owner refs.OwnerID) error { func (m *RequestVerificationHeader) GetOwner() (*ecdsa.PublicKey, error) { if len(m.Signatures) == 0 { return nil, ErrCannotFindOwner - } - - // if first signature contains origin, we should try to validate session key - if m.Signatures[0].Origin != nil { - owner := crypto.UnmarshalPublicKey(m.Signatures[0].Origin.Peer) - if owner == nil { - return nil, ErrCannotLoadPublicKey - } else if err := crypto.Verify(owner, m.Signatures[0].Peer, m.Signatures[0].Origin.Sign); err != nil { - return nil, errors.Wrap(err, "could not verify session token") - } - - return owner, nil } else if key := crypto.UnmarshalPublicKey(m.Signatures[0].Peer); key != nil { return key, nil } @@ -128,10 +104,8 @@ func newSignature(key *ecdsa.PrivateKey, data []byte) (*RequestVerificationHeade } return &RequestVerificationHeader_Signature{ - RequestVerificationHeader_Sign: RequestVerificationHeader_Sign{ - Sign: sign, - Peer: crypto.MarshalPublicKey(&key.PublicKey), - }, + Sign: sign, + Peer: crypto.MarshalPublicKey(&key.PublicKey), }, nil } diff --git a/service/verify_test.go b/service/verify_test.go index 27491da..ce333aa 100644 --- a/service/verify_test.go +++ b/service/verify_test.go @@ -119,15 +119,13 @@ func TestMaintainableRequest(t *testing.T) { req.TTL-- key := test.DecodeKey(i) - require.NoError(t, SignRequestHeader(key, req)) // sign first key (session key) by owner key if i == 0 { - sign, err := crypto.Sign(owner, crypto.MarshalPublicKey(&key.PublicKey)) - require.NoError(t, err) - - req.SetOwner(&owner.PublicKey, sign) + key = owner } + + require.NoError(t, SignRequestHeader(key, req)) } { // Validate owner @@ -150,17 +148,8 @@ func TestMaintainableRequest(t *testing.T) { require.Equal(t, &owner.PublicKey, pub) } - { // wrong owner: - req.Signatures[0].Origin = nil - - pub, err := req.GetOwner() - require.NoError(t, err) - - require.NotEqual(t, &owner.PublicKey, pub) - } - { // Wrong signatures: - copy(req.Signatures[count-1].Sign, req.Signatures[count-1].Peer) + copy(req.Signatures[count-1].Sign, req.Signatures[count-2].Sign) err := VerifyRequestHeader(req) require.EqualError(t, errors.Cause(err), crypto.ErrInvalidSignature.Error()) } diff --git a/session/service.go b/session/service.go index 182ff7d..367aeb1 100644 --- a/session/service.go +++ b/session/service.go @@ -5,7 +5,6 @@ import ( "crypto/ecdsa" "github.com/nspcc-dev/neofs-api-go/refs" - crypto "github.com/nspcc-dev/neofs-crypto" ) type ( @@ -31,9 +30,9 @@ type ( TokenParams struct { FirstEpoch uint64 LastEpoch uint64 - ObjectID []ObjectID + Address Address OwnerID OwnerID - PublicKeys [][]byte + Verb Verb } ) @@ -46,13 +45,3 @@ func NewInitRequest(t *Token) *CreateRequest { func NewSignedRequest(t *Token) *CreateRequest { return &CreateRequest{Message: &CreateRequest_Signed{Signed: t}} } - -// Sign signs contents of the header with the private key. -func (m *VerificationHeader) Sign(key *ecdsa.PrivateKey) error { - s, err := crypto.Sign(key, m.PublicKey) - if err != nil { - return err - } - m.KeySignature = s - return nil -} diff --git a/session/store.go b/session/store.go index f6a6655..e46afde 100644 --- a/session/store.go +++ b/session/store.go @@ -7,6 +7,7 @@ import ( "sync" "github.com/nspcc-dev/neofs-api-go/refs" + "github.com/nspcc-dev/neofs-api-go/service" crypto "github.com/nspcc-dev/neofs-crypto" ) @@ -48,13 +49,15 @@ func (s *simpleStore) New(p TokenParams) *PToken { t := &PToken{ mtx: new(sync.Mutex), Token: Token{ - ID: tid, - Header: VerificationHeader{PublicKey: crypto.MarshalPublicKey(&key.PublicKey)}, - FirstEpoch: p.FirstEpoch, - LastEpoch: p.LastEpoch, - ObjectID: p.ObjectID, - OwnerID: p.OwnerID, - PublicKeys: p.PublicKeys, + Token_Info: service.Token_Info{ + ID: tid, + OwnerID: p.OwnerID, + Verb: p.Verb, + Address: p.Address, + Created: p.FirstEpoch, + ValidUntil: p.LastEpoch, + SessionKey: crypto.MarshalPublicKey(&key.PublicKey), + }, }, PrivateKey: key, } diff --git a/session/store_test.go b/session/store_test.go index 9ad0e1d..f51fb18 100644 --- a/session/store_test.go +++ b/session/store_test.go @@ -1,96 +1,3 @@ package session -import ( - "crypto/ecdsa" - "crypto/rand" - "testing" - - "github.com/nspcc-dev/neofs-api-go/refs" - crypto "github.com/nspcc-dev/neofs-crypto" - "github.com/stretchr/testify/require" -) - -type testClient struct { - *ecdsa.PrivateKey - OwnerID OwnerID -} - -func (c *testClient) Sign(data []byte) ([]byte, error) { - return crypto.Sign(c.PrivateKey, data) -} - -func newTestClient(t *testing.T) *testClient { - key, err := ecdsa.GenerateKey(defaultCurve(), rand.Reader) - require.NoError(t, err) - - owner, err := refs.NewOwnerID(&key.PublicKey) - require.NoError(t, err) - - return &testClient{PrivateKey: key, OwnerID: owner} -} - -func signToken(t *testing.T, token *PToken, c *testClient) { - require.NotNil(t, token) - token.SetPublicKeys(&c.PublicKey) - - signH, err := c.Sign(token.Header.PublicKey) - require.NoError(t, err) - require.NotNil(t, signH) - - // data is not yet signed - keys := UnmarshalPublicKeys(&token.Token) - require.False(t, token.Verify(keys...)) - - signT, err := c.Sign(token.verificationData()) - require.NoError(t, err) - require.NotNil(t, signT) - - token.AddSignatures(signH, signT) - require.True(t, token.Verify(keys...)) -} - -func TestTokenStore(t *testing.T) { - s := NewSimpleStore() - - oid, err := refs.NewObjectID() - require.NoError(t, err) - - c := newTestClient(t) - require.NotNil(t, c) - pk := [][]byte{crypto.MarshalPublicKey(&c.PublicKey)} - - // create new token - token := s.New(TokenParams{ - ObjectID: []ObjectID{oid}, - OwnerID: c.OwnerID, - PublicKeys: pk, - }) - signToken(t, token, c) - - // check that it can be fetched - t1 := s.Fetch(token.ID) - require.NotNil(t, t1) - require.Equal(t, token, t1) - - // create and sign another token by the same client - t1 = s.New(TokenParams{ - ObjectID: []ObjectID{oid}, - OwnerID: c.OwnerID, - PublicKeys: pk, - }) - - signToken(t, t1, c) - - data := []byte{1, 2, 3} - sign, err := t1.SignData(data) - require.NoError(t, err) - require.Error(t, token.Header.VerifyData(data, sign)) - - sign, err = token.SignData(data) - require.NoError(t, err) - require.NoError(t, token.Header.VerifyData(data, sign)) - - s.Remove(token.ID) - require.Nil(t, s.Fetch(token.ID)) - require.NotNil(t, s.Fetch(t1.ID)) -} +// TODO: write unit tests diff --git a/session/types.go b/session/types.go index 4165291..e56373c 100644 --- a/session/types.go +++ b/session/types.go @@ -2,14 +2,12 @@ package session import ( "crypto/ecdsa" - "encoding/binary" "sync" - "github.com/nspcc-dev/neofs-api-go/chain" "github.com/nspcc-dev/neofs-api-go/internal" "github.com/nspcc-dev/neofs-api-go/refs" + "github.com/nspcc-dev/neofs-api-go/service" crypto "github.com/nspcc-dev/neofs-crypto" - "github.com/pkg/errors" ) type ( @@ -19,6 +17,12 @@ type ( OwnerID = refs.OwnerID // TokenID type alias. TokenID = refs.UUID + // Token type alias + Token = service.Token + // Address type alias + Address = refs.Address + // Verb is Token_Info_Verb type alias + Verb = service.Token_Info_Verb // PToken is a wrapper around Token that allows to sign data // and to do thread-safe manipulations. @@ -55,127 +59,7 @@ const ( ErrInvalidSignature = internal.Error("invalid signature") ) -// verificationData returns byte array to sign. -// Note: protobuf serialization is inconsistent as -// wire order is unspecified. -func (m *Token) verificationData() (data []byte) { - var size int - if l := len(m.ObjectID); l > 0 { - size = m.ObjectID[0].Size() - data = make([]byte, 16+l*size) - } else { - data = make([]byte, 16) - } - binary.BigEndian.PutUint64(data, m.FirstEpoch) - binary.BigEndian.PutUint64(data[8:], m.LastEpoch) - for i := range m.ObjectID { - copy(data[16+i*size:], m.ObjectID[i].Bytes()) - } - return -} - -// IsSame checks if the passed token is valid and equal to current token -func (m *Token) IsSame(t *Token) error { - switch { - case m.FirstEpoch != t.FirstEpoch: - return ErrWrongFirstEpoch - case m.LastEpoch != t.LastEpoch: - return ErrWrongLastEpoch - case !m.OwnerID.Equal(t.OwnerID): - return ErrWrongOwner - case m.Header.PublicKey == nil: - return ErrEmptyPublicKey - case len(m.ObjectID) != len(t.ObjectID): - return ErrWrongObjectsCount - default: - for i := range m.ObjectID { - if !m.ObjectID[i].Equal(t.ObjectID[i]) { - return errors.Wrapf(ErrWrongObjects, "expect %s, actual: %s", m.ObjectID[i], t.ObjectID[i]) - } - } - } - return nil -} - -// Sign tries to sign current Token data and stores signature inside it. -func (m *Token) Sign(key *ecdsa.PrivateKey) error { - if err := m.Header.Sign(key); err != nil { - return err - } - - s, err := crypto.Sign(key, m.verificationData()) - if err != nil { - return err - } - - m.Signature = s - return nil -} - -// SetPublicKeys sets owner's public keys to the token -func (m *Token) SetPublicKeys(keys ...*ecdsa.PublicKey) { - m.PublicKeys = m.PublicKeys[:0] - for i := range keys { - m.PublicKeys = append(m.PublicKeys, crypto.MarshalPublicKey(keys[i])) - } -} - -// Verify checks if token is correct and signed. -func (m *Token) Verify(keys ...*ecdsa.PublicKey) bool { - if m.FirstEpoch > m.LastEpoch { - return false - } - ownerFromKeys := chain.KeysToAddress(keys...) - if m.OwnerID.String() != ownerFromKeys { - return false - } - - for i := range keys { - if m.Header.Verify(keys[i]) && crypto.Verify(keys[i], m.verificationData(), m.Signature) == nil { - return true - } - } - return false -} - -// AddSignatures adds token signatures. -func (t *PToken) AddSignatures(signH, signT []byte) { - t.mtx.Lock() - - t.Header.KeySignature = signH - t.Signature = signT - - t.mtx.Unlock() -} - // SignData signs data with session private key. func (t *PToken) SignData(data []byte) ([]byte, error) { return crypto.Sign(t.PrivateKey, data) } - -// VerifyData checks if signature of data by token is equal to sign. -func (m *VerificationHeader) VerifyData(data, sign []byte) error { - if crypto.Verify(crypto.UnmarshalPublicKey(m.PublicKey), data, sign) != nil { - return ErrInvalidSignature - } - return nil -} - -// Verify checks if verification header was issued by id. -func (m *VerificationHeader) Verify(keys ...*ecdsa.PublicKey) bool { - for i := range keys { - if crypto.Verify(keys[i], m.PublicKey, m.KeySignature) == nil { - return true - } - } - return false -} - -// UnmarshalPublicKeys returns unmarshal public keys from the token -func UnmarshalPublicKeys(t *Token) []*ecdsa.PublicKey { - r := make([]*ecdsa.PublicKey, 0, len(t.PublicKeys)) - for i := range t.PublicKeys { - r = append(r, crypto.UnmarshalPublicKey(t.PublicKeys[i])) - } - return r -} From ba3239589443e4b908e13e448c748fbe470eb103 Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Tue, 28 Apr 2020 16:29:54 +0300 Subject: [PATCH 0151/1196] api: update to neofs-api v0.7.3 --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 9773c9b..62a92ec 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -PROTO_VERSION=v0.7.2 +PROTO_VERSION=v0.7.3 PROTO_URL=https://github.com/nspcc-dev/neofs-api/archive/$(PROTO_VERSION).tar.gz B=\033[0;1m From 7a7deb0b01a3fccff3647148ffa595c47f4c9548 Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Tue, 28 Apr 2020 16:30:47 +0300 Subject: [PATCH 0152/1196] proto: regenerate files --- object/types.pb.go | 120 ++++++++++++++++++++++----------------------- object/types.proto | 2 + 2 files changed, 62 insertions(+), 60 deletions(-) diff --git a/object/types.pb.go b/object/types.pb.go index a24a2f1..97106c7 100644 --- a/object/types.pb.go +++ b/object/types.pb.go @@ -515,9 +515,8 @@ type CreationPoint struct { XXX_sizecache int32 `json:"-"` } -func (m *CreationPoint) Reset() { *m = CreationPoint{} } -func (m *CreationPoint) String() string { return proto.CompactTextString(m) } -func (*CreationPoint) ProtoMessage() {} +func (m *CreationPoint) Reset() { *m = CreationPoint{} } +func (*CreationPoint) ProtoMessage() {} func (*CreationPoint) Descriptor() ([]byte, []int) { return fileDescriptor_02021a1d39b1aee0, []int{5} } @@ -826,64 +825,65 @@ func init() { func init() { proto.RegisterFile("object/types.proto", fileDescriptor_02021a1d39b1aee0) } var fileDescriptor_02021a1d39b1aee0 = []byte{ - // 909 bytes of a gzipped FileDescriptorProto + // 916 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x55, 0x4f, 0x8f, 0xdb, 0x44, - 0x14, 0xb7, 0x13, 0xe7, 0xdf, 0x8b, 0xb7, 0xeb, 0x8e, 0x96, 0x62, 0xad, 0x44, 0x76, 0xb1, 0xa0, - 0x5a, 0x0a, 0xeb, 0x88, 0x16, 0xa9, 0xe2, 0x82, 0xd8, 0x6c, 0x00, 0x47, 0x94, 0x6e, 0x98, 0x64, - 0x7b, 0xe0, 0xe6, 0x24, 0x13, 0xc7, 0x6c, 0x32, 0x13, 0xcd, 0x8c, 0xb7, 0xcd, 0xd7, 0xe0, 0xc4, - 0x8d, 0x2b, 0xe2, 0x93, 0xf4, 0xc8, 0x11, 0xf5, 0xb0, 0x42, 0xcb, 0x07, 0xe0, 0x2b, 0x54, 0x33, - 0xb6, 0x13, 0x7b, 0xdb, 0x4b, 0x34, 0xef, 0xfd, 0x7e, 0xbf, 0xf1, 0x9b, 0x37, 0xbf, 0x37, 0x01, - 0xc4, 0x26, 0xbf, 0x92, 0xa9, 0xec, 0xca, 0xcd, 0x9a, 0x08, 0x7f, 0xcd, 0x99, 0x64, 0xa8, 0x9e, - 0xe6, 0x0e, 0x1d, 0x4e, 0xe6, 0xa2, 0x88, 0x1c, 0x1e, 0x08, 0xc2, 0xaf, 0xe3, 0x29, 0xe9, 0x5e, - 0x13, 0x1e, 0xcf, 0x37, 0x59, 0xd6, 0x15, 0x92, 0xf1, 0x30, 0x22, 0x11, 0x67, 0xc9, 0xba, 0xc4, - 0x3f, 0x8d, 0x62, 0xb9, 0x48, 0x26, 0xfe, 0x94, 0xad, 0xba, 0x11, 0x8b, 0x58, 0x57, 0xa7, 0x27, - 0xc9, 0x5c, 0x47, 0x3a, 0xd0, 0xab, 0x94, 0xee, 0x3d, 0x85, 0x1a, 0x0e, 0x69, 0x44, 0xd0, 0x03, - 0xa8, 0x5f, 0xcc, 0xe7, 0x82, 0x48, 0xd7, 0x3c, 0x36, 0x4f, 0x2c, 0x9c, 0x45, 0x2a, 0xff, 0x8c, - 0xd0, 0x48, 0x2e, 0xdc, 0x4a, 0x9a, 0x4f, 0x23, 0xef, 0x2b, 0x80, 0x4b, 0x41, 0x78, 0x40, 0xc2, - 0x19, 0xe1, 0xc8, 0x81, 0xea, 0x8f, 0x64, 0xa3, 0xa5, 0x2d, 0xac, 0x96, 0xe8, 0x00, 0x6a, 0x2f, - 0xc2, 0x65, 0x42, 0xb4, 0xac, 0x85, 0xd3, 0xc0, 0xfb, 0xd3, 0x82, 0x7a, 0x26, 0xf1, 0xc0, 0x7a, - 0x16, 0xd3, 0x2b, 0xad, 0x69, 0x3f, 0xb6, 0xfd, 0xb4, 0x03, 0xbe, 0xca, 0x05, 0x06, 0xd6, 0x18, - 0xfa, 0x1c, 0x9a, 0x98, 0xcc, 0x62, 0x4e, 0xa6, 0x52, 0xef, 0xd3, 0x7e, 0xbc, 0xe7, 0xab, 0x0e, - 0xf9, 0x67, 0xb3, 0x19, 0x27, 0x42, 0x04, 0x06, 0xde, 0x12, 0x50, 0xa9, 0x22, 0xb7, 0xaa, 0xe9, - 0x28, 0xdf, 0x76, 0x87, 0x04, 0x06, 0x2e, 0x56, 0xfe, 0x25, 0xb4, 0xc6, 0x3c, 0xa4, 0x62, 0xce, - 0xf8, 0xca, 0xb5, 0xb4, 0xe8, 0x7e, 0x2e, 0xda, 0x02, 0x81, 0x81, 0x77, 0x2c, 0x2d, 0x61, 0xab, - 0x89, 0x90, 0x8c, 0x12, 0xb7, 0x76, 0x47, 0x92, 0x03, 0x5a, 0x92, 0x07, 0xe8, 0x21, 0xd4, 0xc6, - 0xec, 0x8a, 0x50, 0xb7, 0xae, 0xe9, 0xf7, 0xfc, 0xec, 0x56, 0x7d, 0x9d, 0x0d, 0x0c, 0x9c, 0xc2, - 0xe8, 0x21, 0x34, 0x03, 0xb6, 0x62, 0x41, 0x28, 0x16, 0x6e, 0xe3, 0xd8, 0x3c, 0xb1, 0x7b, 0xcd, - 0x37, 0x37, 0x47, 0x96, 0x8a, 0xd5, 0x59, 0x73, 0x0c, 0x3d, 0x82, 0xfd, 0x61, 0xb8, 0x59, 0xb2, - 0x70, 0x76, 0xbe, 0x20, 0xd3, 0x2b, 0x91, 0xac, 0xdc, 0xa6, 0xa2, 0x07, 0x06, 0xbe, 0x0b, 0xa0, - 0xa7, 0xd0, 0x1a, 0x50, 0x49, 0x22, 0x1e, 0xcb, 0x8d, 0xdb, 0xd2, 0xdf, 0xff, 0x30, 0x2f, 0x77, - 0x0b, 0x6c, 0x7b, 0xb3, 0xe3, 0xa2, 0x6f, 0xc1, 0x1e, 0xa5, 0x36, 0xfb, 0x41, 0xd9, 0xcc, 0x05, - 0xad, 0x3d, 0xf4, 0x8b, 0xde, 0xf3, 0x8b, 0x8c, 0xc0, 0xc0, 0x25, 0x85, 0xea, 0xd4, 0x30, 0x99, - 0x2c, 0xe3, 0xa9, 0x32, 0x47, 0xbb, 0xdc, 0xa9, 0x2d, 0xa0, 0x3e, 0xba, 0x0d, 0x7a, 0x8d, 0xcc, - 0x37, 0x5e, 0xbb, 0xd0, 0x65, 0xef, 0x7f, 0x13, 0xec, 0xd1, 0x46, 0x48, 0xb2, 0xca, 0xae, 0xcd, - 0x85, 0xc6, 0x0b, 0xc2, 0x45, 0xcc, 0x68, 0xe6, 0xd7, 0x3c, 0x44, 0x9f, 0xc0, 0x5e, 0xd6, 0x81, - 0x92, 0x6f, 0xcb, 0x49, 0x74, 0x08, 0x95, 0x41, 0x5f, 0x9b, 0xc4, 0xee, 0xc1, 0xeb, 0x9b, 0x23, - 0xe3, 0xcd, 0xcd, 0x51, 0x65, 0xd0, 0xc7, 0x95, 0x41, 0x1f, 0x7d, 0x06, 0x8d, 0x8b, 0x97, 0x94, - 0xf0, 0x41, 0x5f, 0x1b, 0xc2, 0xee, 0xed, 0x67, 0x84, 0x3c, 0x8d, 0xf3, 0x05, 0xfa, 0x08, 0xaa, - 0xe7, 0x83, 0xbe, 0x36, 0x81, 0xdd, 0x6b, 0x67, 0x34, 0x95, 0xc2, 0xea, 0x07, 0x7d, 0x0d, 0xad, - 0x73, 0x4e, 0x42, 0x49, 0x66, 0x67, 0x32, 0xbb, 0xfa, 0x0f, 0xf2, 0xf3, 0x6b, 0x20, 0x66, 0x74, - 0xc8, 0x62, 0x2a, 0x7b, 0x96, 0xd2, 0xe2, 0x1d, 0xdb, 0x3b, 0x83, 0xbd, 0x12, 0x03, 0x1d, 0x42, - 0xf3, 0x92, 0xc6, 0xaf, 0xc6, 0xf1, 0x8a, 0xe8, 0x23, 0x57, 0xf1, 0x36, 0x56, 0xc3, 0xf6, 0xdd, - 0x9a, 0x4d, 0xf3, 0xb3, 0xa6, 0x81, 0x17, 0xc3, 0xfe, 0x9d, 0xfb, 0x45, 0x27, 0xb0, 0x9f, 0xae, - 0xc4, 0xd6, 0x37, 0x6a, 0x2f, 0x1b, 0xdf, 0x4d, 0xa3, 0x2f, 0xe0, 0x7e, 0xbe, 0x1e, 0xc5, 0x11, - 0x0d, 0x65, 0xc2, 0xd3, 0x59, 0xb6, 0xf1, 0xbb, 0x80, 0xf7, 0x87, 0x99, 0x4e, 0x33, 0xfa, 0x14, - 0x2c, 0xf5, 0x1a, 0xe9, 0x5d, 0xef, 0xed, 0x2e, 0x5b, 0x61, 0xfe, 0x78, 0xb3, 0x26, 0x58, 0xc3, - 0x59, 0xfb, 0x2b, 0xef, 0x6b, 0xbf, 0x37, 0x06, 0x4b, 0x31, 0x51, 0x1b, 0x1a, 0x97, 0xf4, 0x8a, - 0xb2, 0x97, 0xd4, 0x31, 0x10, 0x40, 0x7d, 0x18, 0x72, 0x42, 0xa5, 0x63, 0x22, 0x1b, 0x9a, 0x43, - 0x4e, 0xae, 0x63, 0x96, 0x08, 0xa7, 0x82, 0x9a, 0x60, 0x3d, 0x27, 0xaf, 0xa4, 0x53, 0x45, 0x2d, - 0xa8, 0x9d, 0x2f, 0xe2, 0xe5, 0xcc, 0xb1, 0x90, 0x53, 0xb6, 0xae, 0x53, 0xf3, 0x96, 0x85, 0x39, - 0x47, 0x8f, 0x4a, 0x55, 0x3e, 0x78, 0x67, 0xde, 0x0b, 0xa5, 0x7a, 0x4f, 0xde, 0x57, 0x4e, 0x0b, - 0x6a, 0xa3, 0xf5, 0x32, 0x56, 0xd5, 0x34, 0xc1, 0x52, 0x7d, 0x70, 0x2a, 0x2a, 0xf9, 0x13, 0x4b, - 0x96, 0x33, 0xa7, 0xea, 0xfd, 0x66, 0x42, 0xfd, 0x42, 0x6f, 0x8a, 0xbe, 0x29, 0x3b, 0x37, 0x7b, - 0xef, 0x0e, 0xf2, 0x6f, 0x16, 0xb1, 0xcc, 0x05, 0x65, 0xa7, 0xfb, 0xd0, 0xc8, 0xee, 0xc6, 0xad, - 0x1c, 0x57, 0xf5, 0xe3, 0x91, 0x49, 0x4b, 0xa2, 0x9c, 0xa4, 0x26, 0x23, 0xb3, 0x7a, 0x6a, 0x6f, - 0x9c, 0x87, 0xde, 0xc7, 0x85, 0x69, 0xdc, 0xbd, 0xcf, 0xe9, 0xfd, 0xa7, 0x41, 0xef, 0xe7, 0xd7, - 0xb7, 0x1d, 0xf3, 0xef, 0xdb, 0x8e, 0xf9, 0xcf, 0x6d, 0xc7, 0xfc, 0xf7, 0xb6, 0x63, 0xfe, 0xfe, - 0x5f, 0xc7, 0xf8, 0xe5, 0xa4, 0xf0, 0x9f, 0x42, 0xc5, 0x7a, 0x3a, 0x3d, 0x9d, 0x91, 0xeb, 0x2e, - 0x25, 0x6c, 0x2e, 0x4e, 0xc3, 0x75, 0x7c, 0x1a, 0xb1, 0x6e, 0x5a, 0xd2, 0x5f, 0x15, 0xe7, 0x39, - 0x61, 0xdf, 0x8f, 0xfc, 0xb3, 0xe1, 0xc0, 0x4f, 0xcf, 0x3f, 0xa9, 0xeb, 0x3f, 0x9a, 0x27, 0x6f, - 0x03, 0x00, 0x00, 0xff, 0xff, 0x8d, 0x5e, 0xb1, 0xdf, 0xf7, 0x06, 0x00, 0x00, + 0x14, 0xb7, 0x13, 0xe7, 0xdf, 0x8b, 0xb7, 0xeb, 0x8e, 0x96, 0x62, 0x45, 0x22, 0xbb, 0x58, 0x50, + 0x2d, 0x85, 0x75, 0x44, 0x8b, 0x54, 0xc1, 0x01, 0xb1, 0xd9, 0x40, 0x1d, 0x51, 0xba, 0x61, 0x92, + 0xed, 0x81, 0x9b, 0x93, 0x4c, 0x1c, 0xb3, 0xc9, 0x4c, 0x34, 0x33, 0xd9, 0x36, 0x5f, 0x83, 0x53, + 0x6f, 0x70, 0x44, 0x7c, 0x92, 0x1e, 0x39, 0xa2, 0x1e, 0x56, 0x68, 0xf9, 0x00, 0x7c, 0x85, 0x6a, + 0xc6, 0x76, 0x62, 0x6f, 0x7b, 0x89, 0xe6, 0xbd, 0xdf, 0xef, 0x37, 0x7e, 0xf3, 0xde, 0x6f, 0x26, + 0x80, 0xd8, 0xf8, 0x57, 0x32, 0x91, 0x1d, 0xb9, 0x59, 0x11, 0xe1, 0xaf, 0x38, 0x93, 0x0c, 0x55, + 0x93, 0x5c, 0xcb, 0xe1, 0x64, 0x26, 0xf2, 0x48, 0xeb, 0x40, 0x10, 0x7e, 0x15, 0x4f, 0x48, 0xe7, + 0x8a, 0xf0, 0x78, 0xb6, 0x49, 0xb3, 0xae, 0x90, 0x8c, 0x87, 0x11, 0x89, 0x38, 0x5b, 0xaf, 0x0a, + 0xfc, 0x93, 0x28, 0x96, 0xf3, 0xf5, 0xd8, 0x9f, 0xb0, 0x65, 0x27, 0x62, 0x11, 0xeb, 0xe8, 0xf4, + 0x78, 0x3d, 0xd3, 0x91, 0x0e, 0xf4, 0x2a, 0xa1, 0x7b, 0x8f, 0xa1, 0x82, 0x43, 0x1a, 0x11, 0x74, + 0x0f, 0xaa, 0xe7, 0xb3, 0x99, 0x20, 0xd2, 0x35, 0x8f, 0xcc, 0x63, 0x0b, 0xa7, 0x91, 0xca, 0x3f, + 0x25, 0x34, 0x92, 0x73, 0xb7, 0x94, 0xe4, 0x93, 0xc8, 0xfb, 0x0a, 0xe0, 0x42, 0x10, 0x1e, 0x90, + 0x70, 0x4a, 0x38, 0x72, 0xa0, 0xfc, 0x23, 0xd9, 0x68, 0x69, 0x03, 0xab, 0x25, 0x3a, 0x80, 0xca, + 0xf3, 0x70, 0xb1, 0x26, 0x5a, 0xd6, 0xc0, 0x49, 0xe0, 0xfd, 0x69, 0x41, 0x35, 0x95, 0x78, 0x60, + 0x3d, 0x8d, 0xe9, 0xa5, 0xd6, 0x34, 0x1f, 0xda, 0x7e, 0xd2, 0x01, 0x5f, 0xe5, 0x02, 0x03, 0x6b, + 0x0c, 0x7d, 0x0e, 0x75, 0x4c, 0xa6, 0x31, 0x27, 0x13, 0xa9, 0xf7, 0x69, 0x3e, 0xdc, 0xf3, 0x55, + 0x87, 0xfc, 0xd3, 0xe9, 0x94, 0x13, 0x21, 0x02, 0x03, 0x6f, 0x09, 0xa8, 0x50, 0x91, 0x5b, 0xd6, + 0x74, 0x94, 0x6d, 0xbb, 0x43, 0x02, 0x03, 0xe7, 0x2b, 0xff, 0x12, 0x1a, 0x23, 0x1e, 0x52, 0x31, + 0x63, 0x7c, 0xe9, 0x5a, 0x5a, 0x74, 0x37, 0x13, 0x6d, 0x81, 0xc0, 0xc0, 0x3b, 0x96, 0x96, 0xb0, + 0xe5, 0x58, 0x48, 0x46, 0x89, 0x5b, 0xb9, 0x25, 0xc9, 0x00, 0x2d, 0xc9, 0x02, 0x74, 0x1f, 0x2a, + 0x23, 0x76, 0x49, 0xa8, 0x5b, 0xd5, 0xf4, 0x3b, 0x7e, 0x3a, 0x55, 0x5f, 0x67, 0x03, 0x03, 0x27, + 0x30, 0xba, 0x0f, 0xf5, 0x80, 0x2d, 0x59, 0x10, 0x8a, 0xb9, 0x5b, 0x3b, 0x32, 0x8f, 0xed, 0x6e, + 0xfd, 0xcd, 0xf5, 0xa1, 0xa5, 0x62, 0x75, 0xd6, 0x0c, 0x43, 0x0f, 0x60, 0x7f, 0x10, 0x6e, 0x16, + 0x2c, 0x9c, 0x9e, 0xcd, 0xc9, 0xe4, 0x52, 0xac, 0x97, 0x6e, 0x5d, 0xd1, 0x03, 0x03, 0xdf, 0x06, + 0xd0, 0x63, 0x68, 0xf4, 0xa9, 0x24, 0x11, 0x8f, 0xe5, 0xc6, 0x6d, 0xe8, 0xef, 0x7f, 0x98, 0x95, + 0xbb, 0x05, 0xb6, 0xbd, 0xd9, 0x71, 0xd1, 0x77, 0x60, 0x0f, 0x13, 0x9b, 0x3d, 0x51, 0x36, 0x73, + 0x41, 0x6b, 0x5b, 0x7e, 0xde, 0x7b, 0x7e, 0x9e, 0x11, 0x18, 0xb8, 0xa0, 0x50, 0x9d, 0x1a, 0xac, + 0xc7, 0x8b, 0x78, 0xa2, 0xcc, 0xd1, 0x2c, 0x76, 0x6a, 0x0b, 0xa8, 0x8f, 0x6e, 0x83, 0x6e, 0x2d, + 0xf5, 0x8d, 0xd7, 0xcc, 0x75, 0xd9, 0xfb, 0xdf, 0x04, 0x7b, 0xb8, 0x11, 0x92, 0x2c, 0xd3, 0xb1, + 0xb9, 0x50, 0x7b, 0x4e, 0xb8, 0x88, 0x19, 0x4d, 0xfd, 0x9a, 0x85, 0xe8, 0x13, 0xd8, 0x4b, 0x3b, + 0x50, 0xf0, 0x6d, 0x31, 0x89, 0x5a, 0x50, 0xea, 0xf7, 0xb4, 0x49, 0xec, 0x2e, 0xbc, 0xbe, 0x3e, + 0x34, 0xde, 0x5c, 0x1f, 0x96, 0xfa, 0x3d, 0x5c, 0xea, 0xf7, 0xd0, 0x67, 0x50, 0x3b, 0x7f, 0x41, + 0x09, 0xef, 0xf7, 0xb4, 0x21, 0xec, 0xee, 0x7e, 0x4a, 0xc8, 0xd2, 0x38, 0x5b, 0xa0, 0x8f, 0xa0, + 0x7c, 0xd6, 0xef, 0x69, 0x13, 0xd8, 0xdd, 0x66, 0x4a, 0x53, 0x29, 0xac, 0x7e, 0xd0, 0xd7, 0xd0, + 0x38, 0xe3, 0x24, 0x94, 0x64, 0x7a, 0x2a, 0xd3, 0xd1, 0x7f, 0x90, 0x9d, 0x5f, 0x03, 0x31, 0xa3, + 0x03, 0x16, 0x53, 0xd9, 0xb5, 0x94, 0x16, 0xef, 0xd8, 0xde, 0x13, 0xd8, 0x2b, 0x30, 0x50, 0x0b, + 0xea, 0x17, 0x34, 0x7e, 0x39, 0x8a, 0x97, 0x44, 0x1f, 0xb9, 0x8c, 0xb7, 0xb1, 0xba, 0x6c, 0xdf, + 0xaf, 0xd8, 0x24, 0x3b, 0x6b, 0x12, 0x7c, 0x63, 0xbd, 0xfa, 0xe3, 0xd0, 0xf0, 0x62, 0xd8, 0xbf, + 0x35, 0x65, 0x74, 0x0c, 0xfb, 0xc9, 0x4a, 0x6c, 0xdd, 0xa3, 0x76, 0xb4, 0xf1, 0xed, 0x34, 0xfa, + 0x02, 0xee, 0x66, 0xeb, 0x61, 0x1c, 0xd1, 0x50, 0xae, 0x79, 0x72, 0xa3, 0x6d, 0xfc, 0x2e, 0xe0, + 0xfd, 0x6e, 0x26, 0x77, 0x1a, 0x7d, 0x0a, 0x96, 0x7a, 0x93, 0xf4, 0xae, 0x77, 0x76, 0x23, 0x57, + 0x98, 0x3f, 0xda, 0xac, 0x08, 0xd6, 0x70, 0x3a, 0x84, 0xd2, 0xfb, 0x86, 0xe0, 0x8d, 0xc0, 0x52, + 0x4c, 0xd4, 0x84, 0xda, 0x05, 0xbd, 0xa4, 0xec, 0x05, 0x75, 0x0c, 0x04, 0x50, 0x1d, 0x84, 0x9c, + 0x50, 0xe9, 0x98, 0xc8, 0x86, 0xfa, 0x80, 0x93, 0xab, 0x98, 0xad, 0x85, 0x53, 0x42, 0x75, 0xb0, + 0x9e, 0x91, 0x97, 0xd2, 0x29, 0xa3, 0x06, 0x54, 0xce, 0xe6, 0xf1, 0x62, 0xea, 0x58, 0xc8, 0x29, + 0x1a, 0xd8, 0xa9, 0x78, 0x8b, 0xdc, 0x6d, 0x47, 0x0f, 0x0a, 0x55, 0xde, 0x7b, 0xe7, 0xd6, 0xe7, + 0x4a, 0xf5, 0x1e, 0xbd, 0xaf, 0x9c, 0x06, 0x54, 0x86, 0xab, 0x45, 0xac, 0xaa, 0xa9, 0x83, 0xa5, + 0xfa, 0xe0, 0x94, 0x54, 0xf2, 0x27, 0xb6, 0x5e, 0x4c, 0x9d, 0xb2, 0xf7, 0x9b, 0x09, 0xd5, 0x73, + 0xbd, 0x29, 0xfa, 0xb6, 0xe8, 0xdf, 0xf4, 0xd5, 0x3b, 0xc8, 0xbe, 0x99, 0xc7, 0x52, 0x2f, 0x14, + 0xfd, 0xee, 0x43, 0x2d, 0x9d, 0x8d, 0x5b, 0x3a, 0x2a, 0xeb, 0x27, 0x24, 0x95, 0x16, 0x44, 0x19, + 0x49, 0xdd, 0x8f, 0xd4, 0xf0, 0x89, 0xc9, 0x71, 0x16, 0x7a, 0x1f, 0xe7, 0xee, 0xe4, 0xee, 0x95, + 0x4e, 0xe6, 0x9f, 0x04, 0xdd, 0x9f, 0x5f, 0xdf, 0xb4, 0xcd, 0xbf, 0x6f, 0xda, 0xe6, 0x3f, 0x37, + 0x6d, 0xf3, 0xdf, 0x9b, 0xb6, 0xf9, 0xea, 0xbf, 0xb6, 0xf1, 0xcb, 0x71, 0xee, 0x9f, 0x85, 0x8a, + 0xd5, 0x64, 0x72, 0x32, 0x25, 0x57, 0x1d, 0x4a, 0xd8, 0x4c, 0x9c, 0x84, 0xab, 0xf8, 0x24, 0x62, + 0x9d, 0xa4, 0xa4, 0xbf, 0x4a, 0xce, 0x33, 0xc2, 0x7e, 0x18, 0xfa, 0xa7, 0x83, 0xbe, 0x9f, 0x9c, + 0x7f, 0x5c, 0xd5, 0x7f, 0x37, 0x8f, 0xde, 0x06, 0x00, 0x00, 0xff, 0xff, 0x4e, 0xcb, 0xd2, 0xde, + 0xfd, 0x06, 0x00, 0x00, } func (m *Range) Marshal() (dAtA []byte, err error) { diff --git a/object/types.proto b/object/types.proto index 21ab981..46e1549 100644 --- a/object/types.proto +++ b/object/types.proto @@ -70,6 +70,8 @@ message SystemHeader { } message CreationPoint { + option (gogoproto.goproto_stringer) = false; + // UnixTime is a date of creation in unixtime format int64 UnixTime = 1; // Epoch is a date of creation in NeoFS epochs From 4d535876d0396e39d19909d9ea27f8429e6f8288 Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Tue, 28 Apr 2020 16:31:46 +0300 Subject: [PATCH 0153/1196] object: implement Stringify for Object --- object/types.go | 118 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 118 insertions(+) diff --git a/object/types.go b/object/types.go index 83b03c7..4acffbe 100644 --- a/object/types.go +++ b/object/types.go @@ -3,10 +3,14 @@ package object import ( "bytes" "context" + "fmt" + "io" + "reflect" "github.com/gogo/protobuf/proto" "github.com/nspcc-dev/neofs-api-go/internal" "github.com/nspcc-dev/neofs-api-go/refs" + "github.com/pkg/errors" ) type ( @@ -262,3 +266,117 @@ func (m Object) Address() *refs.Address { CID: m.SystemHeader.CID, } } + +func (m CreationPoint) String() string { + return fmt.Sprintf(`{UnixTime=%d Epoch=%d}`, m.UnixTime, m.Epoch) +} + +// Stringify converts object into string format. +func Stringify(dst io.Writer, obj *Object) error { + // put empty line + if _, err := fmt.Fprintln(dst); err != nil { + return err + } + + // put object line + if _, err := fmt.Fprintln(dst, "Object:"); err != nil { + return err + } + + // put system headers + if _, err := fmt.Fprintln(dst, "\tSystemHeader:"); err != nil { + return err + } + + sysHeaders := []string{"ID", "CID", "OwnerID", "Version", "PayloadLength", "CreatedAt"} + v := reflect.ValueOf(obj.SystemHeader) + for _, key := range sysHeaders { + if !v.FieldByName(key).IsValid() { + return errors.Errorf("invalid system header key: %q", key) + } + + val := v.FieldByName(key).Interface() + if _, err := fmt.Fprintf(dst, "\t\t- %s=%v\n", key, val); err != nil { + return err + } + } + + // put user headers + if _, err := fmt.Fprintln(dst, "\tUserHeaders:"); err != nil { + return err + } + + for _, header := range obj.Headers { + var ( + typ = reflect.ValueOf(header.Value) + key string + val interface{} + ) + + switch t := typ.Interface().(type) { + case *Header_Link: + key = "Link" + val = fmt.Sprintf(`{Type=%s ID=%s}`, t.Link.Type, t.Link.ID) + case *Header_Redirect: + key = "Redirect" + val = fmt.Sprintf(`{CID=%s OID=%s}`, t.Redirect.CID, t.Redirect.ObjectID) + case *Header_UserHeader: + key = "UserHeader" + val = fmt.Sprintf(`{Key=%s Val=%s}`, t.UserHeader.Key, t.UserHeader.Value) + case *Header_Transform: + key = "Transform" + val = t.Transform.Type.String() + case *Header_Tombstone: + key = "Tombstone" + val = "MARKED" + case *Header_Token: + key = "Token" + val = fmt.Sprintf("{"+ + "ID=%s OwnerID=%s Verb=%s Address=%s Created=%d ValidUntil=%d SessionKey=%02x Signature=%02x"+ + "}", + t.Token.Token_Info.ID, + t.Token.Token_Info.OwnerID, + t.Token.Token_Info.Verb, + t.Token.Token_Info.Address, + t.Token.Token_Info.Created, + t.Token.Token_Info.ValidUntil, + t.Token.Token_Info.SessionKey, + t.Token.Signature) + case *Header_HomoHash: + key = "HomoHash" + val = t.HomoHash + case *Header_PayloadChecksum: + key = "PayloadChecksum" + val = t.PayloadChecksum + case *Header_Integrity: + key = "Integrity" + val = fmt.Sprintf(`{Checksum=%02x Signature=%02x}`, + t.Integrity.HeadersChecksum, + t.Integrity.ChecksumSignature) + case *Header_StorageGroup: + key = "StorageGroup" + val = fmt.Sprintf(`{DataSize=%d Hash=%02x Lifetime={Unit=%s Value=%d}}`, + t.StorageGroup.ValidationDataSize, + t.StorageGroup.ValidationHash, + t.StorageGroup.Lifetime.Unit, + t.StorageGroup.Lifetime.Value) + case *Header_PublicKey: + key = "PublicKey" + val = t.PublicKey.Value + default: + key = "Unknown" + val = t + } + + if _, err := fmt.Fprintf(dst, "\t\t- Type=%s\n\t\t Value=%v\n", key, val); err != nil { + return err + } + } + + // put payload + if _, err := fmt.Fprintf(dst, "\tPayload: %#v\n", obj.Payload); err != nil { + return err + } + + return nil +} From 5ae4e14bfaf9b83019e6bb71783f6a6d36779f6a Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Tue, 28 Apr 2020 16:32:19 +0300 Subject: [PATCH 0154/1196] object: test coverage for stringify method --- object/types_test.go | 181 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 181 insertions(+) create mode 100644 object/types_test.go diff --git a/object/types_test.go b/object/types_test.go new file mode 100644 index 0000000..50e4e0b --- /dev/null +++ b/object/types_test.go @@ -0,0 +1,181 @@ +package object + +import ( + "bytes" + "testing" + + "github.com/nspcc-dev/neofs-api-go/refs" + "github.com/nspcc-dev/neofs-api-go/service" + "github.com/nspcc-dev/neofs-api-go/storagegroup" + "github.com/nspcc-dev/neofs-crypto/test" + "github.com/stretchr/testify/require" +) + +func TestStringify(t *testing.T) { + res := ` +Object: + SystemHeader: + - ID=7e0b9c6c-aabc-4985-949e-2680e577b48b + - CID=11111111111111111111111111111111 + - OwnerID=ALYeYC41emF6MrmUMc4a8obEPdgFhq9ran + - Version=1 + - PayloadLength=1 + - CreatedAt={UnixTime=1 Epoch=1} + UserHeaders: + - Type=Link + Value={Type=Child ID=7e0b9c6c-aabc-4985-949e-2680e577b48b} + - Type=Redirect + Value={CID=11111111111111111111111111111111 OID=7e0b9c6c-aabc-4985-949e-2680e577b48b} + - Type=UserHeader + Value={Key=test_key Val=test_value} + - Type=Transform + Value=Split + - Type=Tombstone + Value=MARKED + - Type=Token + Value={ID=7e0b9c6c-aabc-4985-949e-2680e577b48b OwnerID=ALYeYC41emF6MrmUMc4a8obEPdgFhq9ran Verb=Search Address=11111111111111111111111111111111/7e0b9c6c-aabc-4985-949e-2680e577b48b Created=1 ValidUntil=2 SessionKey=010203040506 Signature=010203040506} + - Type=HomoHash + Value=1111111111111111111111111111111111111111111111111111111111111111 + - Type=PayloadChecksum + Value=[1 2 3 4 5 6] + - Type=Integrity + Value={Checksum=010203040506 Signature=010203040506} + - Type=StorageGroup + Value={DataSize=5 Hash=31313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131 Lifetime={Unit=UnixTime Value=555}} + - Type=PublicKey + Value=[1 2 3 4 5 6] + Payload: []byte{0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7} +` + + key := test.DecodeKey(0) + + uid, err := refs.NewOwnerID(&key.PublicKey) + require.NoError(t, err) + + var oid refs.UUID + + require.NoError(t, oid.Parse("7e0b9c6c-aabc-4985-949e-2680e577b48b")) + + obj := &Object{ + SystemHeader: SystemHeader{ + Version: 1, + PayloadLength: 1, + ID: oid, + OwnerID: uid, + CID: CID{}, + CreatedAt: CreationPoint{ + UnixTime: 1, + Epoch: 1, + }, + }, + Payload: []byte{1, 2, 3, 4, 5, 6, 7}, + } + + // *Header_Link + obj.Headers = append(obj.Headers, Header{ + Value: &Header_Link{ + Link: &Link{ID: oid, Type: Link_Child}, + }, + }) + + // *Header_Redirect + obj.Headers = append(obj.Headers, Header{ + Value: &Header_Redirect{ + Redirect: &Address{ObjectID: oid, CID: CID{}}, + }, + }) + + // *Header_UserHeader + obj.Headers = append(obj.Headers, Header{ + Value: &Header_UserHeader{ + UserHeader: &UserHeader{ + Key: "test_key", + Value: "test_value", + }, + }, + }) + + // *Header_Transform + obj.Headers = append(obj.Headers, Header{ + Value: &Header_Transform{ + Transform: &Transform{ + Type: Transform_Split, + }, + }, + }) + + // *Header_Tombstone + obj.Headers = append(obj.Headers, Header{ + Value: &Header_Tombstone{ + Tombstone: &Tombstone{}, + }, + }) + + // *Header_Token + obj.Headers = append(obj.Headers, Header{ + Value: &Header_Token{ + Token: &Token{ + Signature: []byte{1, 2, 3, 4, 5, 6}, + Token_Info: service.Token_Info{ + ID: oid, + OwnerID: uid, + Verb: service.Token_Info_Search, + Address: service.Address{ObjectID: oid, CID: refs.CID{}}, + Created: 1, + ValidUntil: 2, + SessionKey: []byte{1, 2, 3, 4, 5, 6}, + }, + }, + }, + }) + + // *Header_HomoHash + obj.Headers = append(obj.Headers, Header{ + Value: &Header_HomoHash{ + HomoHash: Hash{}, + }, + }) + + // *Header_PayloadChecksum + obj.Headers = append(obj.Headers, Header{ + Value: &Header_PayloadChecksum{ + PayloadChecksum: []byte{1, 2, 3, 4, 5, 6}, + }, + }) + + // *Header_Integrity + obj.Headers = append(obj.Headers, Header{ + Value: &Header_Integrity{ + Integrity: &IntegrityHeader{ + HeadersChecksum: []byte{1, 2, 3, 4, 5, 6}, + ChecksumSignature: []byte{1, 2, 3, 4, 5, 6}, + }, + }, + }) + + // *Header_StorageGroup + obj.Headers = append(obj.Headers, Header{ + Value: &Header_StorageGroup{ + StorageGroup: &storagegroup.StorageGroup{ + ValidationDataSize: 5, + ValidationHash: storagegroup.Hash{}, + Lifetime: &storagegroup.StorageGroup_Lifetime{ + Unit: storagegroup.StorageGroup_Lifetime_UnixTime, + Value: 555, + }, + }, + }, + }) + + // *Header_PublicKey + obj.Headers = append(obj.Headers, Header{ + Value: &Header_PublicKey{ + PublicKey: &PublicKey{Value: []byte{1, 2, 3, 4, 5, 6}}, + }, + }) + + buf := new(bytes.Buffer) + + require.NoError(t, Stringify(buf, obj)) + require.Equal(t, res, buf.String()) +} From 09f8ee52d0b15e808126227d349947b4d7a9687f Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 28 Apr 2020 15:39:09 +0300 Subject: [PATCH 0155/1196] service: implement Raw field setter on RequestMetaHeader struct After recent changes Raw field is presented in RequestMetaHeader. There is a need to provide an interface of field getter/setter. This commit: * defines RawHeader interface of raw value container; * embeds RawHeader into MetaHeader interface; * implements Raw field setter on RequestMetaHeader. --- service/meta.go | 14 ++++++++++++++ service/meta_test.go | 10 ++++++++++ 2 files changed, 24 insertions(+) diff --git a/service/meta.go b/service/meta.go index 5e9886d..8602dca 100644 --- a/service/meta.go +++ b/service/meta.go @@ -25,6 +25,9 @@ type ( // VersionHeader allows get or set version of protocol request VersionHeader + + // RawHeader allows to get and set raw option of request + RawHeader } // EpochHeader interface gives possibility to get or set epoch in RPC Requests. @@ -39,6 +42,12 @@ type ( SetVersion(uint32) } + // RawHeader is an interface of the container of a boolean Raw value + RawHeader interface { + GetRaw() bool + SetRaw(bool) + } + // TTLCondition is closure, that allows to validate request with ttl. TTLCondition func(ttl uint32) error ) @@ -77,6 +86,11 @@ func (m *RequestMetaHeader) SetTTL(v uint32) { m.TTL = v } // SetEpoch sets Epoch to RequestMetaHeader. func (m *RequestMetaHeader) SetEpoch(v uint64) { m.Epoch = v } +// SetRaw is a Raw field setter. +func (m *RequestMetaHeader) SetRaw(raw bool) { + m.Raw = raw +} + // ResetMeta returns current value and sets RequestMetaHeader to empty value. func (m *RequestMetaHeader) ResetMeta() RequestMetaHeader { cp := *m diff --git a/service/meta_test.go b/service/meta_test.go index 083ccd6..388b6ce 100644 --- a/service/meta_test.go +++ b/service/meta_test.go @@ -102,3 +102,13 @@ func TestRequestMetaHeader_SetVersion(t *testing.T) { m.SetVersion(version) require.Equal(t, version, m.GetVersion()) } + +func TestRequestMetaHeader_SetRaw(t *testing.T) { + m := new(RequestMetaHeader) + + m.SetRaw(true) + require.True(t, m.GetRaw()) + + m.SetRaw(false) + require.False(t, m.GetRaw()) +} From 942bedb8ed92fbb6587a19cbcbc1f79377260080 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 28 Apr 2020 16:02:40 +0300 Subject: [PATCH 0156/1196] service: implement Token field setter on RequestVerificationHeader After recent changes Token field is presented in RequestVerificationHeader. There is a need to provide an interface of field getter/setter. This commit: * defines TokenHeader interface of token value container; * implements Token field setter on RequestVerificationHeader. --- service/verify.go | 11 +++++++++++ service/verify_test.go | 14 ++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/service/verify.go b/service/verify.go index ade13ef..182685d 100644 --- a/service/verify.go +++ b/service/verify.go @@ -27,6 +27,12 @@ type ( SetOwner(*ecdsa.PublicKey, []byte) GetLastPeer() (*ecdsa.PublicKey, error) } + + // TokenHeader is an interface of the container of a Token pointer value + TokenHeader interface { + GetToken() *Token + SetToken(*Token) + } ) const ( @@ -97,6 +103,11 @@ func (m *RequestVerificationHeader) GetLastPeer() (*ecdsa.PublicKey, error) { } } +// SetToken is a Token field setter. +func (m *RequestVerificationHeader) SetToken(token *Token) { + m.Token = token +} + func newSignature(key *ecdsa.PrivateKey, data []byte) (*RequestVerificationHeader_Signature, error) { sign, err := crypto.Sign(key, data) if err != nil { diff --git a/service/verify_test.go b/service/verify_test.go index ce333aa..c192f0f 100644 --- a/service/verify_test.go +++ b/service/verify_test.go @@ -188,3 +188,17 @@ func TestVerifyAndSignRequestHeaderWithoutCloning(t *testing.T) { require.Contains(t, buf.String(), "proto: don't know how to copy") } + +func TestRequestVerificationHeader_SetToken(t *testing.T) { + id, err := refs.NewUUID() + require.NoError(t, err) + + token := new(Token) + token.ID = id + + h := new(RequestVerificationHeader) + + h.SetToken(token) + + require.Equal(t, token, h.GetToken()) +} From d327d836c417f7971bcb3d5f7867f73ff6e1e3cf Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 28 Apr 2020 16:58:07 +0300 Subject: [PATCH 0157/1196] service: define and implement Token field composing interface This commit: * defines SessionToken interface of Token field getters/setters group; * implements SessionToken on Token message. --- refs/types.go | 12 ++++ service/token.go | 125 ++++++++++++++++++++++++++++++++++++++++++ service/token_test.go | 88 +++++++++++++++++++++++++++++ 3 files changed, 225 insertions(+) create mode 100644 service/token.go create mode 100644 service/token_test.go diff --git a/refs/types.go b/refs/types.go index 117aa03..a29424e 100644 --- a/refs/types.go +++ b/refs/types.go @@ -37,6 +37,18 @@ type ( OwnerID chain.WalletAddress ) +// OwnerIDContainer is an interface of the container of an OwnerID value. +type OwnerIDContainer interface { + GetOwnerID() OwnerID + SetOwnerID(OwnerID) +} + +// AddressContainer is an interface of the container of object address value. +type AddressContainer interface { + GetAddress() Address + SetAddress(Address) +} + const ( // UUIDSize contains size of UUID. UUIDSize = 16 diff --git a/service/token.go b/service/token.go new file mode 100644 index 0000000..71ea655 --- /dev/null +++ b/service/token.go @@ -0,0 +1,125 @@ +package service + +import ( + "github.com/nspcc-dev/neofs-api-go/refs" +) + +// VerbContainer is an interface of the container of a token verb value. +type VerbContainer interface { + GetVerb() Token_Info_Verb + SetVerb(Token_Info_Verb) +} + +// TokenIDContainer is an interface of the container of a token ID value. +type TokenIDContainer interface { + GetID() TokenID + SetID(TokenID) +} + +// CreationEpochContainer is an interface of the container of a creation epoch number. +type CreationEpochContainer interface { + CreationEpoch() uint64 + SetCreationEpoch(uint64) +} + +// ExpirationEpochContainer is an interface of the container of an expiration epoch number. +type ExpirationEpochContainer interface { + ExpirationEpoch() uint64 + SetExpirationEpoch(uint64) +} + +// SessionKeyContainer is an interface of the container of session key bytes. +type SessionKeyContainer interface { + GetSessionKey() []byte + SetSessionKey([]byte) +} + +// SignatureContainer is an interface of the container of signature bytes. +type SignatureContainer interface { + GetSignature() []byte + SetSignature([]byte) +} + +// SessionTokenInfo is an interface that determines the information scope of session token. +type SessionTokenInfo interface { + TokenIDContainer + refs.OwnerIDContainer + VerbContainer + refs.AddressContainer + CreationEpochContainer + ExpirationEpochContainer + SessionKeyContainer +} + +// SessionToken is an interface of token information and signature pair. +type SessionToken interface { + SessionTokenInfo + SignatureContainer +} + +var _ SessionToken = (*Token)(nil) + +// GetID is an ID field getter. +func (m Token_Info) GetID() TokenID { + return m.ID +} + +// SetID is an ID field setter. +func (m *Token_Info) SetID(id TokenID) { + m.ID = id +} + +// GetOwnerID is an OwnerID field getter. +func (m Token_Info) GetOwnerID() OwnerID { + return m.OwnerID +} + +// SetOwnerID is an OwnerID field setter. +func (m *Token_Info) SetOwnerID(id OwnerID) { + m.OwnerID = id +} + +// SetVerb is a Verb field setter. +func (m *Token_Info) SetVerb(verb Token_Info_Verb) { + m.Verb = verb +} + +// GetAddress is an Address field getter. +func (m Token_Info) GetAddress() Address { + return m.Address +} + +// SetAddress is an Address field setter. +func (m *Token_Info) SetAddress(addr Address) { + m.Address = addr +} + +// CreationEpoch is a Created field getter. +func (m Token_Info) CreationEpoch() uint64 { + return m.Created +} + +// SetCreationEpoch is a Created field setter. +func (m *Token_Info) SetCreationEpoch(e uint64) { + m.Created = e +} + +// ExpirationEpoch is a ValidUntil field getter. +func (m Token_Info) ExpirationEpoch() uint64 { + return m.ValidUntil +} + +// SetExpirationEpoch is a ValidUntil field setter. +func (m *Token_Info) SetExpirationEpoch(e uint64) { + m.ValidUntil = e +} + +// SetSessionKey is a SessionKey field setter. +func (m *Token_Info) SetSessionKey(key []byte) { + m.SessionKey = key +} + +// SetSignature is a Signature field setter. +func (m *Token) SetSignature(sig []byte) { + m.Signature = sig +} diff --git a/service/token_test.go b/service/token_test.go new file mode 100644 index 0000000..1a55406 --- /dev/null +++ b/service/token_test.go @@ -0,0 +1,88 @@ +package service + +import ( + "crypto/rand" + "testing" + + "github.com/nspcc-dev/neofs-api-go/refs" + "github.com/stretchr/testify/require" +) + +func TestTokenGettersSetters(t *testing.T) { + var tok SessionToken = new(Token) + + { // ID + id, err := refs.NewUUID() + require.NoError(t, err) + + tok.SetID(id) + + require.Equal(t, id, tok.GetID()) + } + + { // OwnerID + ownerID := OwnerID{} + _, err := rand.Read(ownerID[:]) + require.NoError(t, err) + + tok.SetOwnerID(ownerID) + + require.Equal(t, ownerID, tok.GetOwnerID()) + } + + { // Verb + verb := Token_Info_Verb(3) + + tok.SetVerb(verb) + + require.Equal(t, verb, tok.GetVerb()) + } + + { // Address + addr := Address{} + _, err := rand.Read(addr.CID[:]) + require.NoError(t, err) + _, err = rand.Read(addr.ObjectID[:]) + require.NoError(t, err) + + tok.SetAddress(addr) + + require.Equal(t, addr, tok.GetAddress()) + } + + { // Created + e := uint64(5) + + tok.SetCreationEpoch(e) + + require.Equal(t, e, tok.CreationEpoch()) + } + + { // ValidUntil + e := uint64(5) + + tok.SetExpirationEpoch(e) + + require.Equal(t, e, tok.ExpirationEpoch()) + } + + { // SessionKey + key := make([]byte, 10) + _, err := rand.Read(key) + require.NoError(t, err) + + tok.SetSessionKey(key) + + require.Equal(t, key, tok.GetSessionKey()) + } + + { // Signature + sig := make([]byte, 10) + _, err := rand.Read(sig) + require.NoError(t, err) + + tok.SetSignature(sig) + + require.Equal(t, sig, tok.GetSignature()) + } +} From c6971d20042aef04f302cb14befe60e14a8eeb31 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 28 Apr 2020 18:40:21 +0300 Subject: [PATCH 0158/1196] service: access Token message fields through getters and setters --- object/types.go | 16 ++++++++-------- object/types_test.go | 23 +++++++++++------------ object/verification.go | 2 +- object/verification_test.go | 10 +++------- service/verify_test.go | 2 +- session/store.go | 26 ++++++++++++-------------- 6 files changed, 36 insertions(+), 43 deletions(-) diff --git a/object/types.go b/object/types.go index 4acffbe..cbc50f5 100644 --- a/object/types.go +++ b/object/types.go @@ -334,14 +334,14 @@ func Stringify(dst io.Writer, obj *Object) error { val = fmt.Sprintf("{"+ "ID=%s OwnerID=%s Verb=%s Address=%s Created=%d ValidUntil=%d SessionKey=%02x Signature=%02x"+ "}", - t.Token.Token_Info.ID, - t.Token.Token_Info.OwnerID, - t.Token.Token_Info.Verb, - t.Token.Token_Info.Address, - t.Token.Token_Info.Created, - t.Token.Token_Info.ValidUntil, - t.Token.Token_Info.SessionKey, - t.Token.Signature) + t.Token.GetID(), + t.Token.GetOwnerID(), + t.Token.GetVerb(), + t.Token.GetAddress(), + t.Token.CreationEpoch(), + t.Token.ExpirationEpoch(), + t.Token.GetSessionKey(), + t.Token.GetSignature()) case *Header_HomoHash: key = "HomoHash" val = t.HomoHash diff --git a/object/types_test.go b/object/types_test.go index 50e4e0b..95f328b 100644 --- a/object/types_test.go +++ b/object/types_test.go @@ -111,21 +111,20 @@ Object: }, }) + token := new(Token) + token.SetID(oid) + token.SetOwnerID(uid) + token.SetVerb(service.Token_Info_Search) + token.SetAddress(Address{ObjectID: oid, CID: refs.CID{}}) + token.SetCreationEpoch(1) + token.SetExpirationEpoch(2) + token.SetSessionKey([]byte{1, 2, 3, 4, 5, 6}) + token.SetSignature([]byte{1, 2, 3, 4, 5, 6}) + // *Header_Token obj.Headers = append(obj.Headers, Header{ Value: &Header_Token{ - Token: &Token{ - Signature: []byte{1, 2, 3, 4, 5, 6}, - Token_Info: service.Token_Info{ - ID: oid, - OwnerID: uid, - Verb: service.Token_Info_Search, - Address: service.Address{ObjectID: oid, CID: refs.CID{}}, - Created: 1, - ValidUntil: 2, - SessionKey: []byte{1, 2, 3, 4, 5, 6}, - }, - }, + Token: token, }, }) diff --git a/object/verification.go b/object/verification.go index 5694316..0bcbc7c 100644 --- a/object/verification.go +++ b/object/verification.go @@ -85,7 +85,7 @@ func (m Object) Verify() error { } pubkey = pkh.Value.(*Header_PublicKey).PublicKey.Value } else { - pubkey = vh.Value.(*Header_Token).Token.SessionKey + pubkey = vh.Value.(*Header_Token).Token.GetSessionKey() } // Verify signature diff --git a/object/verification_test.go b/object/verification_test.go index 004f969..95a6d32 100644 --- a/object/verification_test.go +++ b/object/verification_test.go @@ -6,7 +6,6 @@ import ( "github.com/google/uuid" "github.com/nspcc-dev/neofs-api-go/container" "github.com/nspcc-dev/neofs-api-go/refs" - "github.com/nspcc-dev/neofs-api-go/service" crypto "github.com/nspcc-dev/neofs-crypto" "github.com/nspcc-dev/neofs-crypto/test" "github.com/stretchr/testify/require" @@ -77,12 +76,9 @@ func TestObject_Verify(t *testing.T) { dataPK := crypto.MarshalPublicKey(&sessionkey.PublicKey) signature, err = crypto.Sign(key, dataPK) - tok := &service.Token{ - Token_Info: service.Token_Info{ - SessionKey: dataPK, - }, - Signature: signature, - } + tok := new(Token) + tok.SetSignature(signature) + tok.SetSessionKey(dataPK) obj.AddHeader(&Header{Value: &Header_Token{Token: tok}}) // validation header is not last diff --git a/service/verify_test.go b/service/verify_test.go index c192f0f..107416b 100644 --- a/service/verify_test.go +++ b/service/verify_test.go @@ -194,7 +194,7 @@ func TestRequestVerificationHeader_SetToken(t *testing.T) { require.NoError(t, err) token := new(Token) - token.ID = id + token.SetID(id) h := new(RequestVerificationHeader) diff --git a/session/store.go b/session/store.go index e46afde..7c56c39 100644 --- a/session/store.go +++ b/session/store.go @@ -7,7 +7,6 @@ import ( "sync" "github.com/nspcc-dev/neofs-api-go/refs" - "github.com/nspcc-dev/neofs-api-go/service" crypto "github.com/nspcc-dev/neofs-crypto" ) @@ -46,24 +45,23 @@ func (s *simpleStore) New(p TokenParams) *PToken { return nil } + token := new(Token) + token.SetID(tid) + token.SetOwnerID(p.OwnerID) + token.SetVerb(p.Verb) + token.SetAddress(p.Address) + token.SetCreationEpoch(p.FirstEpoch) + token.SetExpirationEpoch(p.LastEpoch) + token.SetSessionKey(crypto.MarshalPublicKey(&key.PublicKey)) + t := &PToken{ - mtx: new(sync.Mutex), - Token: Token{ - Token_Info: service.Token_Info{ - ID: tid, - OwnerID: p.OwnerID, - Verb: p.Verb, - Address: p.Address, - Created: p.FirstEpoch, - ValidUntil: p.LastEpoch, - SessionKey: crypto.MarshalPublicKey(&key.PublicKey), - }, - }, + mtx: new(sync.Mutex), + Token: *token, PrivateKey: key, } s.Lock() - s.tokens[t.ID] = t + s.tokens[tid] = t s.Unlock() return t From 82ffde253b2f117969ce2b17775a37e1b3a689c5 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 28 Apr 2020 19:03:15 +0300 Subject: [PATCH 0159/1196] service: implement Sign/Verify functions for SessionToken --- service/token.go | 87 +++++++++++++++++++++++++ service/token_test.go | 144 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 231 insertions(+) diff --git a/service/token.go b/service/token.go index 71ea655..b6d6435 100644 --- a/service/token.go +++ b/service/token.go @@ -1,7 +1,12 @@ package service import ( + "crypto/ecdsa" + "encoding/binary" + + "github.com/nspcc-dev/neofs-api-go/internal" "github.com/nspcc-dev/neofs-api-go/refs" + crypto "github.com/nspcc-dev/neofs-crypto" ) // VerbContainer is an interface of the container of a token verb value. @@ -57,8 +62,13 @@ type SessionToken interface { SignatureContainer } +// ErrEmptyToken is raised when passed Token is nil. +const ErrEmptyToken = internal.Error("token is empty") + var _ SessionToken = (*Token)(nil) +var tokenEndianness = binary.BigEndian + // GetID is an ID field getter. func (m Token_Info) GetID() TokenID { return m.ID @@ -123,3 +133,80 @@ func (m *Token_Info) SetSessionKey(key []byte) { func (m *Token) SetSignature(sig []byte) { m.Signature = sig } + +// Returns byte slice that is used for creation/verification of the token signature. +func verificationTokenData(token SessionToken) []byte { + var sz int + + id := token.GetID() + sz += id.Size() + + ownerID := token.GetOwnerID() + sz += ownerID.Size() + + verb := uint32(token.GetVerb()) + sz += 4 + + addr := token.GetAddress() + sz += addr.CID.Size() + addr.ObjectID.Size() + + cEpoch := token.CreationEpoch() + sz += 8 + + fEpoch := token.ExpirationEpoch() + sz += 8 + + key := token.GetSessionKey() + sz += len(key) + + data := make([]byte, sz) + + var off int + + tokenEndianness.PutUint32(data, verb) + off += 4 + + tokenEndianness.PutUint64(data[off:], cEpoch) + off += 8 + + tokenEndianness.PutUint64(data[off:], fEpoch) + off += 8 + + off += copy(data[off:], id.Bytes()) + off += copy(data[off:], ownerID.Bytes()) + off += copy(data[off:], addr.CID.Bytes()) + off += copy(data[off:], addr.ObjectID.Bytes()) + off += copy(data[off:], key) + + return data +} + +// SignToken calculates and stores the signature of token information. +// +// If passed token is nil, ErrEmptyToken returns. +// If passed private key is nil, crypto.ErrEmptyPrivateKey returns. +func SignToken(token SessionToken, key *ecdsa.PrivateKey) error { + if token == nil { + return ErrEmptyToken + } else if key == nil { + return crypto.ErrEmptyPrivateKey + } + + sig, err := crypto.Sign(key, verificationTokenData(token)) + if err != nil { + return err + } + + token.SetSignature(sig) + + return nil +} + +// VerifyTokenSignature checks if token was signed correctly. +func VerifyTokenSignature(token SessionToken, key *ecdsa.PublicKey) error { + return crypto.Verify( + key, + verificationTokenData(token), + token.GetSignature(), + ) +} diff --git a/service/token_test.go b/service/token_test.go index 1a55406..bd9c0b0 100644 --- a/service/token_test.go +++ b/service/token_test.go @@ -5,6 +5,8 @@ import ( "testing" "github.com/nspcc-dev/neofs-api-go/refs" + crypto "github.com/nspcc-dev/neofs-crypto" + "github.com/nspcc-dev/neofs-crypto/test" "github.com/stretchr/testify/require" ) @@ -86,3 +88,145 @@ func TestTokenGettersSetters(t *testing.T) { require.Equal(t, sig, tok.GetSignature()) } } + +func TestSignToken(t *testing.T) { + // nil token + require.EqualError(t, + SignToken(nil, nil), + ErrEmptyToken.Error(), + ) + + var token SessionToken = new(Token) + + // nil key + require.EqualError(t, + SignToken(token, nil), + crypto.ErrEmptyPrivateKey.Error(), + ) + + // create private key for signing + sk := test.DecodeKey(0) + pk := &sk.PublicKey + + id := TokenID{} + _, err := rand.Read(id[:]) + require.NoError(t, err) + token.SetID(id) + + ownerID := OwnerID{} + _, err = rand.Read(ownerID[:]) + require.NoError(t, err) + token.SetOwnerID(ownerID) + + verb := Token_Info_Verb(1) + token.SetVerb(verb) + + addr := Address{} + _, err = rand.Read(addr.ObjectID[:]) + require.NoError(t, err) + _, err = rand.Read(addr.CID[:]) + require.NoError(t, err) + token.SetAddress(addr) + + cEpoch := uint64(1) + token.SetCreationEpoch(cEpoch) + + fEpoch := uint64(2) + token.SetExpirationEpoch(fEpoch) + + sessionKey := make([]byte, 10) + _, err = rand.Read(sessionKey[:]) + require.NoError(t, err) + token.SetSessionKey(sessionKey) + + // sign and verify token + require.NoError(t, SignToken(token, sk)) + require.NoError(t, VerifyTokenSignature(token, pk)) + + items := []struct { + corrupt func() + restore func() + }{ + { // ID + corrupt: func() { + id[0]++ + token.SetID(id) + }, + restore: func() { + id[0]-- + token.SetID(id) + }, + }, + { // Owner ID + corrupt: func() { + ownerID[0]++ + token.SetOwnerID(ownerID) + }, + restore: func() { + ownerID[0]-- + token.SetOwnerID(ownerID) + }, + }, + { // Verb + corrupt: func() { + token.SetVerb(verb + 1) + }, + restore: func() { + token.SetVerb(verb) + }, + }, + { // ObjectID + corrupt: func() { + addr.ObjectID[0]++ + token.SetAddress(addr) + }, + restore: func() { + addr.ObjectID[0]-- + token.SetAddress(addr) + }, + }, + { // CID + corrupt: func() { + addr.CID[0]++ + token.SetAddress(addr) + }, + restore: func() { + addr.CID[0]-- + token.SetAddress(addr) + }, + }, + { // Creation epoch + corrupt: func() { + token.SetCreationEpoch(cEpoch + 1) + }, + restore: func() { + token.SetCreationEpoch(cEpoch) + }, + }, + { // Expiration epoch + corrupt: func() { + token.SetExpirationEpoch(fEpoch + 1) + }, + restore: func() { + token.SetExpirationEpoch(fEpoch) + }, + }, + { // Session key + corrupt: func() { + sessionKey[0]++ + token.SetSessionKey(sessionKey) + }, + restore: func() { + sessionKey[0]-- + token.SetSessionKey(sessionKey) + }, + }, + } + + for _, v := range items { + v.corrupt() + require.Error(t, VerifyTokenSignature(token, pk)) + v.restore() + require.NoError(t, VerifyTokenSignature(token, pk)) + } +} From cce6566f1e48a22f8c15c0fb348cb8c19516ac0a Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 29 Apr 2020 10:57:07 +0300 Subject: [PATCH 0160/1196] service: prevent NPE in VerifyTokenSignature function This commit adds next changes to VerifyTokenSignature: * returns ErrEmptyToken on nil token argument; * returns ErrEmptyPublicKey on nil public key argument. --- service/token.go | 9 +++++++++ service/token_test.go | 10 ++++++++++ 2 files changed, 19 insertions(+) diff --git a/service/token.go b/service/token.go index b6d6435..077e672 100644 --- a/service/token.go +++ b/service/token.go @@ -203,7 +203,16 @@ func SignToken(token SessionToken, key *ecdsa.PrivateKey) error { } // VerifyTokenSignature checks if token was signed correctly. +// +// If passed token is nil, ErrEmptyToken returns. +// If passed public key is nil, crypto.ErrEmptyPublicKey returns. func VerifyTokenSignature(token SessionToken, key *ecdsa.PublicKey) error { + if token == nil { + return ErrEmptyToken + } else if key == nil { + return crypto.ErrEmptyPublicKey + } + return crypto.Verify( key, verificationTokenData(token), diff --git a/service/token_test.go b/service/token_test.go index bd9c0b0..0b28084 100644 --- a/service/token_test.go +++ b/service/token_test.go @@ -96,6 +96,11 @@ func TestSignToken(t *testing.T) { ErrEmptyToken.Error(), ) + require.EqualError(t, + VerifyTokenSignature(nil, nil), + ErrEmptyToken.Error(), + ) + var token SessionToken = new(Token) // nil key @@ -104,6 +109,11 @@ func TestSignToken(t *testing.T) { crypto.ErrEmptyPrivateKey.Error(), ) + require.EqualError(t, + VerifyTokenSignature(token, nil), + crypto.ErrEmptyPublicKey.Error(), + ) + // create private key for signing sk := test.DecodeKey(0) pk := &sk.PublicKey From dfc2dd8a78ee2b63b43fb5fab221c7acf5bf71fd Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 29 Apr 2020 11:52:05 +0300 Subject: [PATCH 0161/1196] session: replace PToken structure with PrivateToken interface In previous implementation PToken contained the full Token structure. Since private token is used for data signature only, storing unused fields of a user token is impractical. To emphasize the purpose of the private part of the session, it makes sense to provide the user of the session package with its interface. The interface will only provide the functionality of data signing with private session key. This commit: * removes PToken structure from session package; * defines PrivateToken interface of private session part; * adds the implementation of PrivateToken on unexported struct; * provides the constructor that generates session key internally. --- session/private.go | 37 +++++++++++++++++++++++++++++++++++++ session/private_test.go | 33 +++++++++++++++++++++++++++++++++ session/service.go | 4 ++-- session/store.go | 14 ++++++-------- session/types.go | 30 ++++++++++++------------------ 5 files changed, 90 insertions(+), 28 deletions(-) create mode 100644 session/private.go create mode 100644 session/private_test.go diff --git a/session/private.go b/session/private.go new file mode 100644 index 0000000..4d4f3c2 --- /dev/null +++ b/session/private.go @@ -0,0 +1,37 @@ +package session + +import ( + "crypto/ecdsa" + "crypto/rand" + + crypto "github.com/nspcc-dev/neofs-crypto" +) + +type pToken struct { + // private session token + sessionKey *ecdsa.PrivateKey +} + +// NewSessionPrivateToken creates PrivateToken instance. +// +// Returns non-nil error on key generation error. +func NewPrivateToken() (PrivateToken, error) { + sk, err := ecdsa.GenerateKey(defaultCurve(), rand.Reader) + if err != nil { + return nil, err + } + + return &pToken{ + sessionKey: sk, + }, nil +} + +// Sign signs data with session private key. +func (t *pToken) Sign(data []byte) ([]byte, error) { + return crypto.Sign(t.sessionKey, data) +} + +// PublicKey returns a binary representation of the session public key. +func (t *pToken) PublicKey() []byte { + return crypto.MarshalPublicKey(&t.sessionKey.PublicKey) +} diff --git a/session/private_test.go b/session/private_test.go new file mode 100644 index 0000000..f0fb9f4 --- /dev/null +++ b/session/private_test.go @@ -0,0 +1,33 @@ +package session + +import ( + "crypto/rand" + "testing" + + crypto "github.com/nspcc-dev/neofs-crypto" + "github.com/stretchr/testify/require" +) + +func TestPrivateToken(t *testing.T) { + // create new private token + pToken, err := NewPrivateToken() + require.NoError(t, err) + + // generate data to sign + data := make([]byte, 10) + _, err = rand.Read(data) + require.NoError(t, err) + + // sign data via private token + sig, err := pToken.Sign(data) + require.NoError(t, err) + + // check signature + require.NoError(t, + crypto.Verify( + crypto.UnmarshalPublicKey(pToken.PublicKey()), + data, + sig, + ), + ) +} diff --git a/session/service.go b/session/service.go index 367aeb1..915abb4 100644 --- a/session/service.go +++ b/session/service.go @@ -17,10 +17,10 @@ type ( // TokenStore is a PToken storage manipulation interface. TokenStore interface { // New returns new token with specified parameters. - New(p TokenParams) *PToken + New(p TokenParams) PrivateToken // Fetch tries to fetch a token with specified id. - Fetch(id TokenID) *PToken + Fetch(id TokenID) PrivateToken // Remove removes token with id from store. Remove(id TokenID) diff --git a/session/store.go b/session/store.go index 7c56c39..440fbb5 100644 --- a/session/store.go +++ b/session/store.go @@ -13,7 +13,7 @@ import ( type simpleStore struct { *sync.RWMutex - tokens map[TokenID]*PToken + tokens map[TokenID]PrivateToken } // TODO get curve from neofs-crypto @@ -25,12 +25,12 @@ func defaultCurve() elliptic.Curve { func NewSimpleStore() TokenStore { return &simpleStore{ RWMutex: new(sync.RWMutex), - tokens: make(map[TokenID]*PToken), + tokens: make(map[TokenID]PrivateToken), } } // New returns new token with specified parameters. -func (s *simpleStore) New(p TokenParams) *PToken { +func (s *simpleStore) New(p TokenParams) PrivateToken { tid, err := refs.NewUUID() if err != nil { return nil @@ -54,10 +54,8 @@ func (s *simpleStore) New(p TokenParams) *PToken { token.SetExpirationEpoch(p.LastEpoch) token.SetSessionKey(crypto.MarshalPublicKey(&key.PublicKey)) - t := &PToken{ - mtx: new(sync.Mutex), - Token: *token, - PrivateKey: key, + t := &pToken{ + sessionKey: key, } s.Lock() @@ -68,7 +66,7 @@ func (s *simpleStore) New(p TokenParams) *PToken { } // Fetch tries to fetch a token with specified id. -func (s *simpleStore) Fetch(id TokenID) *PToken { +func (s *simpleStore) Fetch(id TokenID) PrivateToken { s.RLock() defer s.RUnlock() diff --git a/session/types.go b/session/types.go index e56373c..e7e4b2a 100644 --- a/session/types.go +++ b/session/types.go @@ -1,13 +1,9 @@ package session import ( - "crypto/ecdsa" - "sync" - "github.com/nspcc-dev/neofs-api-go/internal" "github.com/nspcc-dev/neofs-api-go/refs" "github.com/nspcc-dev/neofs-api-go/service" - crypto "github.com/nspcc-dev/neofs-crypto" ) type ( @@ -23,17 +19,20 @@ type ( Address = refs.Address // Verb is Token_Info_Verb type alias Verb = service.Token_Info_Verb - - // PToken is a wrapper around Token that allows to sign data - // and to do thread-safe manipulations. - PToken struct { - Token - - mtx *sync.Mutex - PrivateKey *ecdsa.PrivateKey - } ) +// PrivateToken is an interface of session private part. +type PrivateToken interface { + // PublicKey must return a binary representation of session public key. + PublicKey() []byte + + // Sign must return the signature of passed data. + // + // Resulting signature must be verified by crypto.Verify function + // with the session public key. + Sign([]byte) ([]byte, error) +} + const ( // ErrWrongFirstEpoch is raised when passed Token contains wrong first epoch. // First epoch is an epoch since token is valid @@ -58,8 +57,3 @@ const ( // ErrInvalidSignature is raised when wrong signature is passed to VerificationHeader.VerifyData(). ErrInvalidSignature = internal.Error("invalid signature") ) - -// SignData signs data with session private key. -func (t *PToken) SignData(data []byte) ([]byte, error) { - return crypto.Sign(t.PrivateKey, data) -} From 22265a9f038d27ea283cdf753feb46094b38cfe4 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 29 Apr 2020 12:39:41 +0300 Subject: [PATCH 0162/1196] session: refactor token store This commit: * changes the set and signatures of TokenStore interface methods; * adds unit test for map storage. --- session/service.go | 21 ------------- session/store.go | 70 +++++++++++++------------------------------ session/store_test.go | 34 ++++++++++++++++++++- session/types.go | 20 +++++++++++++ 4 files changed, 74 insertions(+), 71 deletions(-) diff --git a/session/service.go b/session/service.go index 915abb4..ecbd6f5 100644 --- a/session/service.go +++ b/session/service.go @@ -13,27 +13,6 @@ type ( KeyStore interface { Get(ctx context.Context, id refs.OwnerID) ([]*ecdsa.PublicKey, error) } - - // TokenStore is a PToken storage manipulation interface. - TokenStore interface { - // New returns new token with specified parameters. - New(p TokenParams) PrivateToken - - // Fetch tries to fetch a token with specified id. - Fetch(id TokenID) PrivateToken - - // Remove removes token with id from store. - Remove(id TokenID) - } - - // TokenParams contains params to create new PToken. - TokenParams struct { - FirstEpoch uint64 - LastEpoch uint64 - Address Address - OwnerID OwnerID - Verb Verb - } ) // NewInitRequest returns new initialization CreateRequest from passed Token. diff --git a/session/store.go b/session/store.go index 440fbb5..fa3ca69 100644 --- a/session/store.go +++ b/session/store.go @@ -1,16 +1,11 @@ package session import ( - "crypto/ecdsa" "crypto/elliptic" - "crypto/rand" "sync" - - "github.com/nspcc-dev/neofs-api-go/refs" - crypto "github.com/nspcc-dev/neofs-crypto" ) -type simpleStore struct { +type mapTokenStore struct { *sync.RWMutex tokens map[TokenID]PrivateToken @@ -21,61 +16,38 @@ func defaultCurve() elliptic.Curve { return elliptic.P256() } -// NewSimpleStore creates simple token storage -func NewSimpleStore() TokenStore { - return &simpleStore{ +// NewMapTokenStore creates new PrivateTokenStore instance. +// +// The elements of the instance are stored in the map. +func NewMapTokenStore() PrivateTokenStore { + return &mapTokenStore{ RWMutex: new(sync.RWMutex), tokens: make(map[TokenID]PrivateToken), } } -// New returns new token with specified parameters. -func (s *simpleStore) New(p TokenParams) PrivateToken { - tid, err := refs.NewUUID() - if err != nil { - return nil - } - - key, err := ecdsa.GenerateKey(defaultCurve(), rand.Reader) - if err != nil { - return nil - } - - if p.FirstEpoch > p.LastEpoch || p.OwnerID.Empty() { - return nil - } - - token := new(Token) - token.SetID(tid) - token.SetOwnerID(p.OwnerID) - token.SetVerb(p.Verb) - token.SetAddress(p.Address) - token.SetCreationEpoch(p.FirstEpoch) - token.SetExpirationEpoch(p.LastEpoch) - token.SetSessionKey(crypto.MarshalPublicKey(&key.PublicKey)) - - t := &pToken{ - sessionKey: key, - } - +// Store adds passed token to the map. +// +// Resulting error is always nil. +func (s *mapTokenStore) Store(id TokenID, token PrivateToken) error { s.Lock() - s.tokens[tid] = t + s.tokens[id] = token s.Unlock() - return t + return nil } -// Fetch tries to fetch a token with specified id. -func (s *simpleStore) Fetch(id TokenID) PrivateToken { +// Fetch returns the map element corresponding to the given key. +// +// Returns ErrPrivateTokenNotFound is there is no element in map. +func (s *mapTokenStore) Fetch(id TokenID) (PrivateToken, error) { s.RLock() defer s.RUnlock() - return s.tokens[id] -} + t, ok := s.tokens[id] + if !ok { + return nil, ErrPrivateTokenNotFound + } -// Remove removes token with id from store. -func (s *simpleStore) Remove(id TokenID) { - s.Lock() - delete(s.tokens, id) - s.Unlock() + return t, nil } diff --git a/session/store_test.go b/session/store_test.go index f51fb18..37d742e 100644 --- a/session/store_test.go +++ b/session/store_test.go @@ -1,3 +1,35 @@ package session -// TODO: write unit tests +import ( + "testing" + + "github.com/nspcc-dev/neofs-api-go/refs" + "github.com/stretchr/testify/require" +) + +func TestMapTokenStore(t *testing.T) { + // create new private token + pToken, err := NewPrivateToken() + require.NoError(t, err) + + // create map token store + s := NewMapTokenStore() + + // create new storage key + id, err := refs.NewUUID() + require.NoError(t, err) + + // ascertain that there is no record for the key + _, err = s.Fetch(id) + require.EqualError(t, err, ErrPrivateTokenNotFound.Error()) + + // save private token record + require.NoError(t, s.Store(id, pToken)) + + // fetch private token by the key + res, err := s.Fetch(id) + require.NoError(t, err) + + // ascertain that returned token equals to initial + require.Equal(t, pToken, res) +} diff --git a/session/types.go b/session/types.go index e7e4b2a..bacc770 100644 --- a/session/types.go +++ b/session/types.go @@ -33,6 +33,26 @@ type PrivateToken interface { Sign([]byte) ([]byte, error) } +// PrivateTokenSource is an interface of private token storage with read access. +type PrivateTokenSource interface { + // Fetch must return the storage record corresponding to the passed key. + // + // Resulting error must be ErrPrivateTokenNotFound if there is no corresponding record. + Fetch(TokenID) (PrivateToken, error) +} + +// PrivateTokenStore is an interface of the storage of private tokens addressable by TokenID. +type PrivateTokenStore interface { + PrivateTokenSource + + // Store must save passed private token in the storage under the given key. + // + // Resulting error must be nil if private token was stored successfully. + Store(TokenID, PrivateToken) error +} + +const ErrPrivateTokenNotFound = internal.Error("private token not found") + const ( // ErrWrongFirstEpoch is raised when passed Token contains wrong first epoch. // First epoch is an epoch since token is valid From 701bbafcf11724216078739990363167d8f85cc6 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 29 Apr 2020 12:44:35 +0300 Subject: [PATCH 0163/1196] session: change KeyStore documentation --- session/service.go | 15 --------------- session/types.go | 11 +++++++++++ 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/session/service.go b/session/service.go index ecbd6f5..6e293d3 100644 --- a/session/service.go +++ b/session/service.go @@ -1,20 +1,5 @@ package session -import ( - "context" - "crypto/ecdsa" - - "github.com/nspcc-dev/neofs-api-go/refs" -) - -type ( - // KeyStore is an interface that describes storage, - // that allows to fetch public keys by OwnerID. - KeyStore interface { - Get(ctx context.Context, id refs.OwnerID) ([]*ecdsa.PublicKey, error) - } -) - // NewInitRequest returns new initialization CreateRequest from passed Token. func NewInitRequest(t *Token) *CreateRequest { return &CreateRequest{Message: &CreateRequest_Init{Init: t}} diff --git a/session/types.go b/session/types.go index bacc770..435616a 100644 --- a/session/types.go +++ b/session/types.go @@ -1,6 +1,9 @@ package session import ( + "context" + "crypto/ecdsa" + "github.com/nspcc-dev/neofs-api-go/internal" "github.com/nspcc-dev/neofs-api-go/refs" "github.com/nspcc-dev/neofs-api-go/service" @@ -51,6 +54,14 @@ type PrivateTokenStore interface { Store(TokenID, PrivateToken) error } +// KeyStore is an interface of the storage of public keys addressable by OwnerID, +type KeyStore interface { + // Get must return the storage record corresponding to the passed key. + // + // Resulting error must be ErrKeyNotFound if there is no corresponding record. + Get(context.Context, OwnerID) ([]*ecdsa.PublicKey, error) +} + const ErrPrivateTokenNotFound = internal.Error("private token not found") const ( From f0867036fbd3818a1c7d2d38b5692fe73244260c Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 29 Apr 2020 12:46:05 +0300 Subject: [PATCH 0164/1196] session: remove trivial defaultCurve function --- session/private.go | 3 ++- session/store.go | 6 ------ 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/session/private.go b/session/private.go index 4d4f3c2..a159227 100644 --- a/session/private.go +++ b/session/private.go @@ -2,6 +2,7 @@ package session import ( "crypto/ecdsa" + "crypto/elliptic" "crypto/rand" crypto "github.com/nspcc-dev/neofs-crypto" @@ -16,7 +17,7 @@ type pToken struct { // // Returns non-nil error on key generation error. func NewPrivateToken() (PrivateToken, error) { - sk, err := ecdsa.GenerateKey(defaultCurve(), rand.Reader) + sk, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader) if err != nil { return nil, err } diff --git a/session/store.go b/session/store.go index fa3ca69..5cd6314 100644 --- a/session/store.go +++ b/session/store.go @@ -1,7 +1,6 @@ package session import ( - "crypto/elliptic" "sync" ) @@ -11,11 +10,6 @@ type mapTokenStore struct { tokens map[TokenID]PrivateToken } -// TODO get curve from neofs-crypto -func defaultCurve() elliptic.Curve { - return elliptic.P256() -} - // NewMapTokenStore creates new PrivateTokenStore instance. // // The elements of the instance are stored in the map. From 79142ada0484e8e5e77b6c5f7c3981d215ab116d Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 29 Apr 2020 12:49:27 +0300 Subject: [PATCH 0165/1196] session: replace used type aliases to separate file --- session/alias.go | 15 +++++++++++++++ session/types.go | 17 ----------------- 2 files changed, 15 insertions(+), 17 deletions(-) create mode 100644 session/alias.go diff --git a/session/alias.go b/session/alias.go new file mode 100644 index 0000000..aa49d55 --- /dev/null +++ b/session/alias.go @@ -0,0 +1,15 @@ +package session + +import ( + "github.com/nspcc-dev/neofs-api-go/refs" + "github.com/nspcc-dev/neofs-api-go/service" +) + +// OwnerID is a type alias of OwnerID ref. +type OwnerID = refs.OwnerID + +// TokenID is a type alias of TokenID ref. +type TokenID = service.TokenID + +// Token is a type alias of Token. +type Token = service.Token diff --git a/session/types.go b/session/types.go index 435616a..a4a1643 100644 --- a/session/types.go +++ b/session/types.go @@ -5,23 +5,6 @@ import ( "crypto/ecdsa" "github.com/nspcc-dev/neofs-api-go/internal" - "github.com/nspcc-dev/neofs-api-go/refs" - "github.com/nspcc-dev/neofs-api-go/service" -) - -type ( - // ObjectID type alias. - ObjectID = refs.ObjectID - // OwnerID type alias. - OwnerID = refs.OwnerID - // TokenID type alias. - TokenID = refs.UUID - // Token type alias - Token = service.Token - // Address type alias - Address = refs.Address - // Verb is Token_Info_Verb type alias - Verb = service.Token_Info_Verb ) // PrivateToken is an interface of session private part. From 608f5781055a72f392b9cb47bd644ee04b0b1a02 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 29 Apr 2020 12:50:52 +0300 Subject: [PATCH 0166/1196] session: removes unused errors --- session/types.go | 26 +------------------------- 1 file changed, 1 insertion(+), 25 deletions(-) diff --git a/session/types.go b/session/types.go index a4a1643..0f209c7 100644 --- a/session/types.go +++ b/session/types.go @@ -45,29 +45,5 @@ type KeyStore interface { Get(context.Context, OwnerID) ([]*ecdsa.PublicKey, error) } +// ErrPrivateTokenNotFound is raised when addressed private token was not found in storage. const ErrPrivateTokenNotFound = internal.Error("private token not found") - -const ( - // ErrWrongFirstEpoch is raised when passed Token contains wrong first epoch. - // First epoch is an epoch since token is valid - ErrWrongFirstEpoch = internal.Error("wrong first epoch") - - // ErrWrongLastEpoch is raised when passed Token contains wrong last epoch. - // Last epoch is an epoch until token is valid - ErrWrongLastEpoch = internal.Error("wrong last epoch") - - // ErrWrongOwner is raised when passed Token contains wrong OwnerID. - ErrWrongOwner = internal.Error("wrong owner") - - // ErrEmptyPublicKey is raised when passed Token contains wrong public key. - ErrEmptyPublicKey = internal.Error("empty public key") - - // ErrWrongObjectsCount is raised when passed Token contains wrong objects count. - ErrWrongObjectsCount = internal.Error("wrong objects count") - - // ErrWrongObjects is raised when passed Token contains wrong object ids. - ErrWrongObjects = internal.Error("wrong objects") - - // ErrInvalidSignature is raised when wrong signature is passed to VerificationHeader.VerifyData(). - ErrInvalidSignature = internal.Error("invalid signature") -) From ffd4338eb38bce519115ca9be3370bbb6dfa3a15 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 29 Apr 2020 12:59:58 +0300 Subject: [PATCH 0167/1196] session: fix NewPrivateToken function doc --- session/private.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/session/private.go b/session/private.go index a159227..5a0ca03 100644 --- a/session/private.go +++ b/session/private.go @@ -13,7 +13,7 @@ type pToken struct { sessionKey *ecdsa.PrivateKey } -// NewSessionPrivateToken creates PrivateToken instance. +// NewPrivateToken creates PrivateToken instance. // // Returns non-nil error on key generation error. func NewPrivateToken() (PrivateToken, error) { From 4fa7360cd1cb4abce7b8e02c86b0eac8a7395f05 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 29 Apr 2020 14:11:19 +0300 Subject: [PATCH 0168/1196] session: support the expiration of private tokens All sessions in NeoFS has limited in epochs lifetime. There is a need to limit the lifetime of private session tokens. This commmit: * extends PrivateToken interface with Expired method; * defines EpochLifetimeStore interface with RemoveExpired method and embeds it to PrivateTokenStore interface; * adds epoch value parameter to private token constructor. --- session/private.go | 11 +++++-- session/private_test.go | 19 ++++++++++++- session/store.go | 17 +++++++++++ session/store_test.go | 63 ++++++++++++++++++++++++++++++++++++++++- session/types.go | 10 +++++++ 5 files changed, 116 insertions(+), 4 deletions(-) diff --git a/session/private.go b/session/private.go index 5a0ca03..8ebce81 100644 --- a/session/private.go +++ b/session/private.go @@ -11,12 +11,14 @@ import ( type pToken struct { // private session token sessionKey *ecdsa.PrivateKey + // last epoch of the lifetime + validUntil uint64 } -// NewPrivateToken creates PrivateToken instance. +// NewPrivateToken creates PrivateToken instance that expires after passed epoch. // // Returns non-nil error on key generation error. -func NewPrivateToken() (PrivateToken, error) { +func NewPrivateToken(validUntil uint64) (PrivateToken, error) { sk, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader) if err != nil { return nil, err @@ -24,6 +26,7 @@ func NewPrivateToken() (PrivateToken, error) { return &pToken{ sessionKey: sk, + validUntil: validUntil, }, nil } @@ -36,3 +39,7 @@ func (t *pToken) Sign(data []byte) ([]byte, error) { func (t *pToken) PublicKey() []byte { return crypto.MarshalPublicKey(&t.sessionKey.PublicKey) } + +func (t *pToken) Expired(epoch uint64) bool { + return t.validUntil < epoch +} diff --git a/session/private_test.go b/session/private_test.go index f0fb9f4..7963afb 100644 --- a/session/private_test.go +++ b/session/private_test.go @@ -10,7 +10,7 @@ import ( func TestPrivateToken(t *testing.T) { // create new private token - pToken, err := NewPrivateToken() + pToken, err := NewPrivateToken(0) require.NoError(t, err) // generate data to sign @@ -31,3 +31,20 @@ func TestPrivateToken(t *testing.T) { ), ) } + +func TestPToken_Expired(t *testing.T) { + e := uint64(10) + + var token PrivateToken = &pToken{ + validUntil: e, + } + + // must not be expired in the epoch before last + require.False(t, token.Expired(e-1)) + + // must not be expired in the last epoch + require.False(t, token.Expired(e)) + + // must be expired in the epoch after last + require.True(t, token.Expired(e+1)) +} diff --git a/session/store.go b/session/store.go index 5cd6314..79998c7 100644 --- a/session/store.go +++ b/session/store.go @@ -45,3 +45,20 @@ func (s *mapTokenStore) Fetch(id TokenID) (PrivateToken, error) { return t, nil } + +// RemoveExpired removes all the map elements that are expired in the passed epoch. +// +// Resulting error is always nil. +func (s *mapTokenStore) RemoveExpired(epoch uint64) error { + s.Lock() + + for key, token := range s.tokens { + if token.Expired(epoch) { + delete(s.tokens, key) + } + } + + s.Unlock() + + return nil +} diff --git a/session/store_test.go b/session/store_test.go index 37d742e..123b103 100644 --- a/session/store_test.go +++ b/session/store_test.go @@ -9,7 +9,7 @@ import ( func TestMapTokenStore(t *testing.T) { // create new private token - pToken, err := NewPrivateToken() + pToken, err := NewPrivateToken(0) require.NoError(t, err) // create map token store @@ -33,3 +33,64 @@ func TestMapTokenStore(t *testing.T) { // ascertain that returned token equals to initial require.Equal(t, pToken, res) } + +func TestMapTokenStore_RemoveExpired(t *testing.T) { + // create some epoch number + e1 := uint64(1) + + // create private token that expires after e1 + tok1, err := NewPrivateToken(e1) + require.NoError(t, err) + + // create some greater than e1 epoch number + e2 := e1 + 1 + + // create private token that expires after e2 + tok2, err := NewPrivateToken(e2) + require.NoError(t, err) + + // create token store instance + s := NewMapTokenStore() + + // create storage keys for tokens + id1, err := refs.NewUUID() + require.NoError(t, err) + id2, err := refs.NewUUID() + require.NoError(t, err) + + assertPresence := func(ids ...TokenID) { + for i := range ids { + _, err = s.Fetch(ids[i]) + require.NoError(t, err) + } + } + + assertAbsence := func(ids ...TokenID) { + for i := range ids { + _, err = s.Fetch(ids[i]) + require.EqualError(t, err, ErrPrivateTokenNotFound.Error()) + } + } + + // store both tokens + require.NoError(t, s.Store(id1, tok1)) + require.NoError(t, s.Store(id2, tok2)) + + // ascertain that both tokens are available + assertPresence(id1, id2) + + // perform cleaning for epoch in which both tokens are not expired + require.NoError(t, s.RemoveExpired(e1)) + + // ascertain that both tokens are still available + assertPresence(id1, id2) + + // perform cleaning for epoch greater than e1 and not greater than e2 + require.NoError(t, s.RemoveExpired(e1+1)) + + // ascertain that tok1 was removed + assertAbsence(id1) + + // ascertain that tok2 was not removed + assertPresence(id2) +} diff --git a/session/types.go b/session/types.go index 0f209c7..c890aaf 100644 --- a/session/types.go +++ b/session/types.go @@ -17,6 +17,9 @@ type PrivateToken interface { // Resulting signature must be verified by crypto.Verify function // with the session public key. Sign([]byte) ([]byte, error) + + // Expired must return true if and only if private token is expired in the given epoch number. + Expired(uint64) bool } // PrivateTokenSource is an interface of private token storage with read access. @@ -27,9 +30,16 @@ type PrivateTokenSource interface { Fetch(TokenID) (PrivateToken, error) } +// EpochLifetimeStore is an interface of the storage of elements that lifetime is limited by NeoFS epoch. +type EpochLifetimeStore interface { + // RemoveExpired must remove all elements that are expired in the given epoch. + RemoveExpired(uint64) error +} + // PrivateTokenStore is an interface of the storage of private tokens addressable by TokenID. type PrivateTokenStore interface { PrivateTokenSource + EpochLifetimeStore // Store must save passed private token in the storage under the given key. // From fc177c4ce3828b56bb7eb4f562629ccd12b4355d Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 4 May 2020 13:04:10 +0300 Subject: [PATCH 0169/1196] service: change constant errors This commit: * moves defined errors to a separate file; * renames ErrEmptyToken to ErrNilToken; * merges ErrZeroTTL and ErrIncorrectTTL into single ErrInvalidTTL. --- service/errors.go | 18 ++++++++++++++++++ service/meta.go | 13 ++----------- service/meta_test.go | 4 ++-- service/token.go | 12 ++++-------- service/token_test.go | 4 ++-- service/verify.go | 17 +++-------------- 6 files changed, 31 insertions(+), 37 deletions(-) create mode 100644 service/errors.go diff --git a/service/errors.go b/service/errors.go new file mode 100644 index 0000000..4aefb4e --- /dev/null +++ b/service/errors.go @@ -0,0 +1,18 @@ +package service + +import "github.com/nspcc-dev/neofs-api-go/internal" + +// ErrNilToken is returned by functions that expect a non-nil token argument, but received nil. +const ErrNilToken = internal.Error("token is nil") + +// ErrInvalidTTL means that the TTL value does not satisfy a specific criterion. +const ErrInvalidTTL = internal.Error("invalid TTL value") + +// ErrInvalidPublicKeyBytes means that the public key could not be unmarshaled. +const ErrInvalidPublicKeyBytes = internal.Error("cannot load public key") + +// ErrCannotFindOwner is raised when signatures empty in GetOwner. +const ErrCannotFindOwner = internal.Error("cannot find owner public key") + +// ErrWrongOwner is raised when passed OwnerID not equal to present PublicKey +const ErrWrongOwner = internal.Error("wrong owner") diff --git a/service/meta.go b/service/meta.go index 8602dca..ea1a83d 100644 --- a/service/meta.go +++ b/service/meta.go @@ -1,7 +1,6 @@ package service import ( - "github.com/nspcc-dev/neofs-api-go/internal" "github.com/pkg/errors" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" @@ -63,14 +62,6 @@ const ( SingleForwardingTTL ) -const ( - // ErrZeroTTL is raised when zero ttl is passed. - ErrZeroTTL = internal.Error("zero ttl") - - // ErrIncorrectTTL is raised when NonForwardingTTL is passed and NodeRole != InnerRingNode. - ErrIncorrectTTL = internal.Error("incorrect ttl") -) - // SetVersion sets protocol version to ResponseMetaHeader. func (m *ResponseMetaHeader) SetVersion(v uint32) { m.Version = v } @@ -105,7 +96,7 @@ func (m *RequestMetaHeader) RestoreMeta(v RequestMetaHeader) { *m = v } func IRNonForwarding(role NodeRole) TTLCondition { return func(ttl uint32) error { if ttl == NonForwardingTTL && role != InnerRingNode { - return ErrIncorrectTTL + return ErrInvalidTTL } return nil @@ -117,7 +108,7 @@ func ProcessRequestTTL(req MetaHeader, cond ...TTLCondition) error { ttl := req.GetTTL() if ttl == ZeroTTL { - return status.New(codes.InvalidArgument, ErrZeroTTL.Error()).Err() + return status.New(codes.InvalidArgument, ErrInvalidTTL.Error()).Err() } for i := range cond { diff --git a/service/meta_test.go b/service/meta_test.go index 388b6ce..de77ac8 100644 --- a/service/meta_test.go +++ b/service/meta_test.go @@ -26,13 +26,13 @@ func TestMetaRequest(t *testing.T) { }, { code: codes.InvalidArgument, - msg: ErrIncorrectTTL.Error(), + msg: ErrInvalidTTL.Error(), name: "direct to storage node", handler: IRNonForwarding(StorageNode), RequestMetaHeader: RequestMetaHeader{TTL: NonForwardingTTL}, }, { - msg: ErrZeroTTL.Error(), + msg: ErrInvalidTTL.Error(), code: codes.InvalidArgument, name: "zero ttl", handler: IRNonForwarding(StorageNode), diff --git a/service/token.go b/service/token.go index 077e672..ece44c2 100644 --- a/service/token.go +++ b/service/token.go @@ -4,7 +4,6 @@ import ( "crypto/ecdsa" "encoding/binary" - "github.com/nspcc-dev/neofs-api-go/internal" "github.com/nspcc-dev/neofs-api-go/refs" crypto "github.com/nspcc-dev/neofs-crypto" ) @@ -62,9 +61,6 @@ type SessionToken interface { SignatureContainer } -// ErrEmptyToken is raised when passed Token is nil. -const ErrEmptyToken = internal.Error("token is empty") - var _ SessionToken = (*Token)(nil) var tokenEndianness = binary.BigEndian @@ -183,11 +179,11 @@ func verificationTokenData(token SessionToken) []byte { // SignToken calculates and stores the signature of token information. // -// If passed token is nil, ErrEmptyToken returns. +// If passed token is nil, ErrNilToken returns. // If passed private key is nil, crypto.ErrEmptyPrivateKey returns. func SignToken(token SessionToken, key *ecdsa.PrivateKey) error { if token == nil { - return ErrEmptyToken + return ErrNilToken } else if key == nil { return crypto.ErrEmptyPrivateKey } @@ -204,11 +200,11 @@ func SignToken(token SessionToken, key *ecdsa.PrivateKey) error { // VerifyTokenSignature checks if token was signed correctly. // -// If passed token is nil, ErrEmptyToken returns. +// If passed token is nil, ErrNilToken returns. // If passed public key is nil, crypto.ErrEmptyPublicKey returns. func VerifyTokenSignature(token SessionToken, key *ecdsa.PublicKey) error { if token == nil { - return ErrEmptyToken + return ErrNilToken } else if key == nil { return crypto.ErrEmptyPublicKey } diff --git a/service/token_test.go b/service/token_test.go index 0b28084..1e02f46 100644 --- a/service/token_test.go +++ b/service/token_test.go @@ -93,12 +93,12 @@ func TestSignToken(t *testing.T) { // nil token require.EqualError(t, SignToken(nil, nil), - ErrEmptyToken.Error(), + ErrNilToken.Error(), ) require.EqualError(t, VerifyTokenSignature(nil, nil), - ErrEmptyToken.Error(), + ErrNilToken.Error(), ) var token SessionToken = new(Token) diff --git a/service/verify.go b/service/verify.go index 182685d..7ac3cf3 100644 --- a/service/verify.go +++ b/service/verify.go @@ -35,17 +35,6 @@ type ( } ) -const ( - // ErrCannotLoadPublicKey is raised when cannot unmarshal public key from RequestVerificationHeader_Sign. - ErrCannotLoadPublicKey = internal.Error("cannot load public key") - - // ErrCannotFindOwner is raised when signatures empty in GetOwner. - ErrCannotFindOwner = internal.Error("cannot find owner public key") - - // ErrWrongOwner is raised when passed OwnerID not equal to present PublicKey - ErrWrongOwner = internal.Error("wrong owner") -) - // SetSignatures replaces signatures stored in RequestVerificationHeader. func (m *RequestVerificationHeader) SetSignatures(signatures []*RequestVerificationHeader_Signature) { m.Signatures = signatures @@ -81,7 +70,7 @@ func (m *RequestVerificationHeader) GetOwner() (*ecdsa.PublicKey, error) { return key, nil } - return nil, ErrCannotLoadPublicKey + return nil, ErrInvalidPublicKeyBytes } // GetLastPeer tries to get last peer public key from signatures. @@ -99,7 +88,7 @@ func (m *RequestVerificationHeader) GetLastPeer() (*ecdsa.PublicKey, error) { return key, nil } - return nil, ErrCannotLoadPublicKey + return nil, ErrInvalidPublicKeyBytes } } @@ -190,7 +179,7 @@ func VerifyRequestHeader(msg VerifiableRequest) error { key := crypto.UnmarshalPublicKey(peer) if key == nil { - return errors.Wrapf(ErrCannotLoadPublicKey, "%d: %02x", i, peer) + return errors.Wrapf(ErrInvalidPublicKeyBytes, "%d: %02x", i, peer) } if size := msg.Size(); size <= cap(data) { From b785eb710a157cea40c85d7c993826c43e830584 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 4 May 2020 13:38:27 +0300 Subject: [PATCH 0170/1196] service: transfer TTL code to a separate file --- service/meta.go | 67 +----------------------------- service/meta_test.go | 83 ------------------------------------- service/ttl.go | 73 ++++++++++++++++++++++++++++++++ service/ttl_test.go | 99 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 174 insertions(+), 148 deletions(-) create mode 100644 service/ttl.go create mode 100644 service/ttl_test.go diff --git a/service/meta.go b/service/meta.go index ea1a83d..2675b79 100644 --- a/service/meta.go +++ b/service/meta.go @@ -1,11 +1,5 @@ package service -import ( - "github.com/pkg/errors" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" -) - type ( // MetaHeader contains meta information of request. // It provides methods to get or set meta information meta header. @@ -15,9 +9,8 @@ type ( ResetMeta() RequestMetaHeader RestoreMeta(RequestMetaHeader) - // TTLRequest to verify and update ttl requests. - GetTTL() uint32 - SetTTL(uint32) + // TTLHeader allows to get and set TTL value of request. + TTLHeader // EpochHeader gives possibility to get or set epoch in RPC Requests. EpochHeader @@ -46,20 +39,6 @@ type ( GetRaw() bool SetRaw(bool) } - - // TTLCondition is closure, that allows to validate request with ttl. - TTLCondition func(ttl uint32) error -) - -const ( - // ZeroTTL is empty ttl, should produce ErrZeroTTL. - ZeroTTL = iota - - // NonForwardingTTL is a ttl that allows direct connections only. - NonForwardingTTL - - // SingleForwardingTTL is a ttl that allows connections through another node. - SingleForwardingTTL ) // SetVersion sets protocol version to ResponseMetaHeader. @@ -71,9 +50,6 @@ func (m *ResponseMetaHeader) SetEpoch(v uint64) { m.Epoch = v } // SetVersion sets protocol version to RequestMetaHeader. func (m *RequestMetaHeader) SetVersion(v uint32) { m.Version = v } -// SetTTL sets TTL to RequestMetaHeader. -func (m *RequestMetaHeader) SetTTL(v uint32) { m.TTL = v } - // SetEpoch sets Epoch to RequestMetaHeader. func (m *RequestMetaHeader) SetEpoch(v uint64) { m.Epoch = v } @@ -91,42 +67,3 @@ func (m *RequestMetaHeader) ResetMeta() RequestMetaHeader { // RestoreMeta sets current RequestMetaHeader to passed value. func (m *RequestMetaHeader) RestoreMeta(v RequestMetaHeader) { *m = v } - -// IRNonForwarding condition that allows NonForwardingTTL only for IR -func IRNonForwarding(role NodeRole) TTLCondition { - return func(ttl uint32) error { - if ttl == NonForwardingTTL && role != InnerRingNode { - return ErrInvalidTTL - } - - return nil - } -} - -// ProcessRequestTTL validates and update ttl requests. -func ProcessRequestTTL(req MetaHeader, cond ...TTLCondition) error { - ttl := req.GetTTL() - - if ttl == ZeroTTL { - return status.New(codes.InvalidArgument, ErrInvalidTTL.Error()).Err() - } - - for i := range cond { - if cond[i] == nil { - continue - } - - // check specific condition: - if err := cond[i](ttl); err != nil { - if st, ok := status.FromError(errors.Cause(err)); ok { - return st.Err() - } - - return status.New(codes.InvalidArgument, err.Error()).Err() - } - } - - req.SetTTL(ttl - 1) - - return nil -} diff --git a/service/meta_test.go b/service/meta_test.go index de77ac8..fb7fb17 100644 --- a/service/meta_test.go +++ b/service/meta_test.go @@ -3,92 +3,9 @@ package service import ( "testing" - "github.com/pkg/errors" "github.com/stretchr/testify/require" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" ) -type mockedRequest struct { - msg string - name string - code codes.Code - handler TTLCondition - RequestMetaHeader -} - -func TestMetaRequest(t *testing.T) { - tests := []mockedRequest{ - { - name: "direct to ir node", - handler: IRNonForwarding(InnerRingNode), - RequestMetaHeader: RequestMetaHeader{TTL: NonForwardingTTL}, - }, - { - code: codes.InvalidArgument, - msg: ErrInvalidTTL.Error(), - name: "direct to storage node", - handler: IRNonForwarding(StorageNode), - RequestMetaHeader: RequestMetaHeader{TTL: NonForwardingTTL}, - }, - { - msg: ErrInvalidTTL.Error(), - code: codes.InvalidArgument, - name: "zero ttl", - handler: IRNonForwarding(StorageNode), - RequestMetaHeader: RequestMetaHeader{TTL: ZeroTTL}, - }, - { - name: "default to ir node", - handler: IRNonForwarding(InnerRingNode), - RequestMetaHeader: RequestMetaHeader{TTL: SingleForwardingTTL}, - }, - { - name: "default to storage node", - handler: IRNonForwarding(StorageNode), - RequestMetaHeader: RequestMetaHeader{TTL: SingleForwardingTTL}, - }, - { - msg: "not found", - code: codes.NotFound, - name: "custom status error", - RequestMetaHeader: RequestMetaHeader{TTL: SingleForwardingTTL}, - handler: func(_ uint32) error { return status.Error(codes.NotFound, "not found") }, - }, - { - msg: "not found", - code: codes.NotFound, - name: "custom wrapped status error", - RequestMetaHeader: RequestMetaHeader{TTL: SingleForwardingTTL}, - handler: func(_ uint32) error { - err := status.Error(codes.NotFound, "not found") - err = errors.Wrap(err, "some error context") - err = errors.Wrap(err, "another error context") - return err - }, - }, - } - - for i := range tests { - tt := tests[i] - t.Run(tt.name, func(t *testing.T) { - before := tt.GetTTL() - err := ProcessRequestTTL(&tt, tt.handler) - if tt.msg != "" { - require.Errorf(t, err, tt.msg) - - state, ok := status.FromError(err) - require.True(t, ok) - require.Equal(t, tt.code, state.Code()) - require.Equal(t, tt.msg, state.Message()) - } else { - require.NoError(t, err) - require.NotEqualf(t, before, tt.GetTTL(), "ttl should be changed: %d vs %d", before, tt.GetTTL()) - } - }) - } -} - func TestRequestMetaHeader_SetEpoch(t *testing.T) { m := new(ResponseMetaHeader) epoch := uint64(3) diff --git a/service/ttl.go b/service/ttl.go new file mode 100644 index 0000000..f069f54 --- /dev/null +++ b/service/ttl.go @@ -0,0 +1,73 @@ +package service + +import ( + "github.com/pkg/errors" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +// TTLHeader is an interface of the container of a numerical TTL value. +type TTLHeader interface { + GetTTL() uint32 + SetTTL(uint32) +} + +// TTLCondition is a function type that used to verify that TTL value match a specific criterion. +// Nil error indicates compliance with the criterion. +type TTLCondition func(ttl uint32) error + +// TTL constants. +const ( + // ZeroTTL is an upper bound of invalid TTL values. + ZeroTTL = iota + + // NonForwardingTTL is a TTL value that does not imply a request forwarding. + NonForwardingTTL + + // SingleForwardingTTL is a TTL value that imply potential forwarding with NonForwardingTTL. + SingleForwardingTTL +) + +// SetTTL is a TTL field setter. +func (m *RequestMetaHeader) SetTTL(v uint32) { + m.TTL = v +} + +// IRNonForwarding condition that allows NonForwardingTTL only for IR. +func IRNonForwarding(role NodeRole) TTLCondition { + return func(ttl uint32) error { + if ttl == NonForwardingTTL && role != InnerRingNode { + return ErrInvalidTTL + } + + return nil + } +} + +// ProcessRequestTTL validates and updates requests with TTL. +func ProcessRequestTTL(req TTLHeader, cond ...TTLCondition) error { + ttl := req.GetTTL() + + if ttl == ZeroTTL { + return status.New(codes.InvalidArgument, ErrInvalidTTL.Error()).Err() + } + + for i := range cond { + if cond[i] == nil { + continue + } + + // check specific condition: + if err := cond[i](ttl); err != nil { + if st, ok := status.FromError(errors.Cause(err)); ok { + return st.Err() + } + + return status.New(codes.InvalidArgument, err.Error()).Err() + } + } + + req.SetTTL(ttl - 1) + + return nil +} diff --git a/service/ttl_test.go b/service/ttl_test.go new file mode 100644 index 0000000..1c982f5 --- /dev/null +++ b/service/ttl_test.go @@ -0,0 +1,99 @@ +package service + +import ( + "testing" + + "github.com/pkg/errors" + "github.com/stretchr/testify/require" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +type mockedRequest struct { + msg string + name string + code codes.Code + handler TTLCondition + RequestMetaHeader +} + +func TestMetaRequest(t *testing.T) { + tests := []mockedRequest{ + { + name: "direct to ir node", + handler: IRNonForwarding(InnerRingNode), + RequestMetaHeader: RequestMetaHeader{TTL: NonForwardingTTL}, + }, + { + code: codes.InvalidArgument, + msg: ErrInvalidTTL.Error(), + name: "direct to storage node", + handler: IRNonForwarding(StorageNode), + RequestMetaHeader: RequestMetaHeader{TTL: NonForwardingTTL}, + }, + { + msg: ErrInvalidTTL.Error(), + code: codes.InvalidArgument, + name: "zero ttl", + handler: IRNonForwarding(StorageNode), + RequestMetaHeader: RequestMetaHeader{TTL: ZeroTTL}, + }, + { + name: "default to ir node", + handler: IRNonForwarding(InnerRingNode), + RequestMetaHeader: RequestMetaHeader{TTL: SingleForwardingTTL}, + }, + { + name: "default to storage node", + handler: IRNonForwarding(StorageNode), + RequestMetaHeader: RequestMetaHeader{TTL: SingleForwardingTTL}, + }, + { + msg: "not found", + code: codes.NotFound, + name: "custom status error", + RequestMetaHeader: RequestMetaHeader{TTL: SingleForwardingTTL}, + handler: func(_ uint32) error { return status.Error(codes.NotFound, "not found") }, + }, + { + msg: "not found", + code: codes.NotFound, + name: "custom wrapped status error", + RequestMetaHeader: RequestMetaHeader{TTL: SingleForwardingTTL}, + handler: func(_ uint32) error { + err := status.Error(codes.NotFound, "not found") + err = errors.Wrap(err, "some error context") + err = errors.Wrap(err, "another error context") + return err + }, + }, + } + + for i := range tests { + tt := tests[i] + t.Run(tt.name, func(t *testing.T) { + before := tt.GetTTL() + err := ProcessRequestTTL(&tt, tt.handler) + if tt.msg != "" { + require.Errorf(t, err, tt.msg) + + state, ok := status.FromError(err) + require.True(t, ok) + require.Equal(t, tt.code, state.Code()) + require.Equal(t, tt.msg, state.Message()) + } else { + require.NoError(t, err) + require.NotEqualf(t, before, tt.GetTTL(), "ttl should be changed: %d vs %d", before, tt.GetTTL()) + } + }) + } +} + +func TestRequestMetaHeader_SetTTL(t *testing.T) { + m := new(RequestMetaHeader) + ttl := uint32(3) + + m.SetTTL(ttl) + + require.Equal(t, ttl, m.GetTTL()) +} From 8270245455f013f55c4081988ca64408301e429d Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 4 May 2020 14:00:25 +0300 Subject: [PATCH 0171/1196] service: transfer public types to a separate file --- service/alias.go | 12 +++- service/role.go | 3 - service/token.go | 56 ----------------- service/ttl.go | 4 -- service/types.go | 161 +++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 170 insertions(+), 66 deletions(-) create mode 100644 service/types.go diff --git a/service/alias.go b/service/alias.go index 6c22ece..9a40702 100644 --- a/service/alias.go +++ b/service/alias.go @@ -4,11 +4,17 @@ import ( "github.com/nspcc-dev/neofs-api-go/refs" ) -// TokenID is type alias of UUID ref. +// TokenID is a type alias of UUID ref. type TokenID = refs.UUID -// OwnerID is type alias of OwnerID ref. +// OwnerID is a type alias of OwnerID ref. type OwnerID = refs.OwnerID -// Address is type alias of Address ref. +// Address is a type alias of Address ref. type Address = refs.Address + +// AddressContainer is a type alias of refs.AddressContainer. +type AddressContainer = refs.AddressContainer + +// OwnerIDContainer is a type alias of refs.OwnerIDContainer. +type OwnerIDContainer = refs.OwnerIDContainer diff --git a/service/role.go b/service/role.go index 53bcdf5..4c405c1 100644 --- a/service/role.go +++ b/service/role.go @@ -1,8 +1,5 @@ package service -// NodeRole to identify in Bootstrap service. -type NodeRole int32 - const ( _ NodeRole = iota // InnerRingNode that work like IR node. diff --git a/service/token.go b/service/token.go index ece44c2..2aa159b 100644 --- a/service/token.go +++ b/service/token.go @@ -4,65 +4,9 @@ import ( "crypto/ecdsa" "encoding/binary" - "github.com/nspcc-dev/neofs-api-go/refs" crypto "github.com/nspcc-dev/neofs-crypto" ) -// VerbContainer is an interface of the container of a token verb value. -type VerbContainer interface { - GetVerb() Token_Info_Verb - SetVerb(Token_Info_Verb) -} - -// TokenIDContainer is an interface of the container of a token ID value. -type TokenIDContainer interface { - GetID() TokenID - SetID(TokenID) -} - -// CreationEpochContainer is an interface of the container of a creation epoch number. -type CreationEpochContainer interface { - CreationEpoch() uint64 - SetCreationEpoch(uint64) -} - -// ExpirationEpochContainer is an interface of the container of an expiration epoch number. -type ExpirationEpochContainer interface { - ExpirationEpoch() uint64 - SetExpirationEpoch(uint64) -} - -// SessionKeyContainer is an interface of the container of session key bytes. -type SessionKeyContainer interface { - GetSessionKey() []byte - SetSessionKey([]byte) -} - -// SignatureContainer is an interface of the container of signature bytes. -type SignatureContainer interface { - GetSignature() []byte - SetSignature([]byte) -} - -// SessionTokenInfo is an interface that determines the information scope of session token. -type SessionTokenInfo interface { - TokenIDContainer - refs.OwnerIDContainer - VerbContainer - refs.AddressContainer - CreationEpochContainer - ExpirationEpochContainer - SessionKeyContainer -} - -// SessionToken is an interface of token information and signature pair. -type SessionToken interface { - SessionTokenInfo - SignatureContainer -} - -var _ SessionToken = (*Token)(nil) - var tokenEndianness = binary.BigEndian // GetID is an ID field getter. diff --git a/service/ttl.go b/service/ttl.go index f069f54..c79cc85 100644 --- a/service/ttl.go +++ b/service/ttl.go @@ -12,10 +12,6 @@ type TTLHeader interface { SetTTL(uint32) } -// TTLCondition is a function type that used to verify that TTL value match a specific criterion. -// Nil error indicates compliance with the criterion. -type TTLCondition func(ttl uint32) error - // TTL constants. const ( // ZeroTTL is an upper bound of invalid TTL values. diff --git a/service/types.go b/service/types.go new file mode 100644 index 0000000..cad4b3c --- /dev/null +++ b/service/types.go @@ -0,0 +1,161 @@ +package service + +// NodeRole to identify in Bootstrap service. +type NodeRole int32 + +// TTLCondition is a function type that used to verify that TTL values match a specific criterion. +// Nil error indicates compliance with the criterion. +type TTLCondition func(uint32) error + +// RawSource is an interface of the container of a boolean Raw value with read access. +type RawSource interface { + GetRaw() bool +} + +// RawContainer is an interface of the container of a boolean Raw value. +type RawContainer interface { + RawSource + SetRaw(bool) +} + +// VersionContainer is an interface of the container of a numerical Version value with read access. +type VersionSource interface { + GetVersion() uint32 +} + +// VersionContainer is an interface of the container of a numerical Version value. +type VersionContainer interface { + VersionSource + SetVersion(uint32) +} + +// EpochSource is an interface of the container of a NeoFS epoch number with read access. +type EpochSource interface { + GetEpoch() uint64 +} + +// EpochContainer is an interface of the container of a NeoFS epoch number. +type EpochContainer interface { + EpochSource + SetEpoch(uint64) +} + +// TTLSource is an interface of the container of a numerical TTL value with read access. +type TTLSource interface { + GetTTL() uint32 +} + +// TTLContainer is an interface of the container of a numerical TTL value. +type TTLContainer interface { + TTLSource + SetTTL(uint32) +} + +// RequestMetaContainer is an interface of a fixed set of request meta value containers. +// Contains: +// - TTL value; +// - NeoFS epoch number; +// - Protocol version; +// - Raw toggle option. +type RequestMetaContainer interface { + TTLContainer + EpochContainer + VersionContainer + RawContainer +} + +// VerbSource is an interface of the container of a token verb value with read access. +type VerbSource interface { + GetVerb() Token_Info_Verb +} + +// VerbContainer is an interface of the container of a token verb value. +type VerbContainer interface { + VerbSource + SetVerb(Token_Info_Verb) +} + +// TokenIDSource is an interface of the container of a token ID value with read access. +type TokenIDSource interface { + GetID() TokenID +} + +// TokenIDContainer is an interface of the container of a token ID value. +type TokenIDContainer interface { + TokenIDSource + SetID(TokenID) +} + +// CreationEpochSource is an interface of the container of a creation epoch number with read access. +type CreationEpochSource interface { + CreationEpoch() uint64 +} + +// CreationEpochContainer is an interface of the container of a creation epoch number. +type CreationEpochContainer interface { + CreationEpochSource + SetCreationEpoch(uint64) +} + +// ExpirationEpochSource is an interface of the container of an expiration epoch number with read access. +type ExpirationEpochSource interface { + ExpirationEpoch() uint64 +} + +// ExpirationEpochContainer is an interface of the container of an expiration epoch number. +type ExpirationEpochContainer interface { + ExpirationEpochSource + SetExpirationEpoch(uint64) +} + +// SessionKeySource is an interface of the container of session key bytes with read access. +type SessionKeySource interface { + GetSessionKey() []byte +} + +// SessionKeyContainer is an interface of the container of public session key bytes. +type SessionKeyContainer interface { + SessionKeySource + SetSessionKey([]byte) +} + +// SignatureSource is an interface of the container of signature bytes with read access. +type SignatureSource interface { + GetSignature() []byte +} + +// SignatureContainer is an interface of the container of signature bytes. +type SignatureContainer interface { + SignatureSource + SetSignature([]byte) +} + +// SessionTokenSource is an interface of the container of a SessionToken with read access. +type SessionTokenSource interface { + GetSessionToken() SessionToken +} + +// SessionTokenInfo is an interface of a fixed set of token information value containers. +// Contains: +// - ID of the token; +// - ID of the token's owner; +// - verb of the session; +// - address of the session object; +// - creation epoch number of the token; +// - expiration epoch number of the token; +// - public session key bytes. +type SessionTokenInfo interface { + TokenIDContainer + OwnerIDContainer + VerbContainer + AddressContainer + CreationEpochContainer + ExpirationEpochContainer + SessionKeyContainer +} + +// SessionToken is an interface of token information and signature pair. +type SessionToken interface { + SessionTokenInfo + SignatureContainer +} From c38a8eddc898059e2ba948c64b710c6a4bb47c4c Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 4 May 2020 14:03:11 +0300 Subject: [PATCH 0172/1196] service: use value container interfaces --- service/meta.go | 33 ++++----------------------------- service/ttl.go | 8 +------- 2 files changed, 5 insertions(+), 36 deletions(-) diff --git a/service/meta.go b/service/meta.go index 2675b79..2714f08 100644 --- a/service/meta.go +++ b/service/meta.go @@ -9,35 +9,10 @@ type ( ResetMeta() RequestMetaHeader RestoreMeta(RequestMetaHeader) - // TTLHeader allows to get and set TTL value of request. - TTLHeader - - // EpochHeader gives possibility to get or set epoch in RPC Requests. - EpochHeader - - // VersionHeader allows get or set version of protocol request - VersionHeader - - // RawHeader allows to get and set raw option of request - RawHeader - } - - // EpochHeader interface gives possibility to get or set epoch in RPC Requests. - EpochHeader interface { - GetEpoch() uint64 - SetEpoch(v uint64) - } - - // VersionHeader allows get or set version of protocol request - VersionHeader interface { - GetVersion() uint32 - SetVersion(uint32) - } - - // RawHeader is an interface of the container of a boolean Raw value - RawHeader interface { - GetRaw() bool - SetRaw(bool) + TTLContainer + EpochContainer + VersionContainer + RawContainer } ) diff --git a/service/ttl.go b/service/ttl.go index c79cc85..28a5092 100644 --- a/service/ttl.go +++ b/service/ttl.go @@ -6,12 +6,6 @@ import ( "google.golang.org/grpc/status" ) -// TTLHeader is an interface of the container of a numerical TTL value. -type TTLHeader interface { - GetTTL() uint32 - SetTTL(uint32) -} - // TTL constants. const ( // ZeroTTL is an upper bound of invalid TTL values. @@ -41,7 +35,7 @@ func IRNonForwarding(role NodeRole) TTLCondition { } // ProcessRequestTTL validates and updates requests with TTL. -func ProcessRequestTTL(req TTLHeader, cond ...TTLCondition) error { +func ProcessRequestTTL(req TTLContainer, cond ...TTLCondition) error { ttl := req.GetTTL() if ttl == ZeroTTL { From eb94cf754964c6f3fd23ea2e45dce82ca9d64f66 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 4 May 2020 14:37:14 +0300 Subject: [PATCH 0173/1196] service: refactor MetaHeader interface --- object/service.go | 2 +- service/epoch.go | 11 +++++++++++ service/epoch_test.go | 21 +++++++++++++++++++++ service/meta.go | 39 ++++----------------------------------- service/meta_test.go | 38 ++++++++++++++++---------------------- service/raw.go | 6 ++++++ service/raw_test.go | 24 ++++++++++++++++++++++++ service/types.go | 12 ++++++++++++ service/verify.go | 8 ++++---- service/version.go | 11 +++++++++++ service/version_test.go | 21 +++++++++++++++++++++ 11 files changed, 131 insertions(+), 62 deletions(-) create mode 100644 service/epoch.go create mode 100644 service/epoch_test.go create mode 100644 service/raw.go create mode 100644 service/raw_test.go create mode 100644 service/version.go create mode 100644 service/version_test.go diff --git a/object/service.go b/object/service.go index 45a8d4b..0e38d70 100644 --- a/object/service.go +++ b/object/service.go @@ -31,7 +31,7 @@ type ( // All object operations must have TTL, Epoch, Type, Container ID and // permission of usage previous network map. Request interface { - service.MetaHeader + service.SeizedRequestMetaContainer CID() CID Type() RequestType diff --git a/service/epoch.go b/service/epoch.go new file mode 100644 index 0000000..7a7a556 --- /dev/null +++ b/service/epoch.go @@ -0,0 +1,11 @@ +package service + +// SetEpoch is an Epoch field setter. +func (m *ResponseMetaHeader) SetEpoch(v uint64) { + m.Epoch = v +} + +// SetEpoch is an Epoch field setter. +func (m *RequestMetaHeader) SetEpoch(v uint64) { + m.Epoch = v +} diff --git a/service/epoch_test.go b/service/epoch_test.go new file mode 100644 index 0000000..47316c0 --- /dev/null +++ b/service/epoch_test.go @@ -0,0 +1,21 @@ +package service + +import ( + "testing" + + "github.com/stretchr/testify/require" +) + +func TestGetSetEpoch(t *testing.T) { + v := uint64(5) + + items := []EpochContainer{ + new(ResponseMetaHeader), + new(RequestMetaHeader), + } + + for _, item := range items { + item.SetEpoch(v) + require.Equal(t, v, item.GetEpoch()) + } +} diff --git a/service/meta.go b/service/meta.go index 2714f08..3a945ac 100644 --- a/service/meta.go +++ b/service/meta.go @@ -1,44 +1,13 @@ package service -type ( - // MetaHeader contains meta information of request. - // It provides methods to get or set meta information meta header. - // Also contains methods to reset and restore meta header. - // Also contains methods to get or set request protocol version - MetaHeader interface { - ResetMeta() RequestMetaHeader - RestoreMeta(RequestMetaHeader) - - TTLContainer - EpochContainer - VersionContainer - RawContainer - } -) - -// SetVersion sets protocol version to ResponseMetaHeader. -func (m *ResponseMetaHeader) SetVersion(v uint32) { m.Version = v } - -// SetEpoch sets Epoch to ResponseMetaHeader. -func (m *ResponseMetaHeader) SetEpoch(v uint64) { m.Epoch = v } - -// SetVersion sets protocol version to RequestMetaHeader. -func (m *RequestMetaHeader) SetVersion(v uint32) { m.Version = v } - -// SetEpoch sets Epoch to RequestMetaHeader. -func (m *RequestMetaHeader) SetEpoch(v uint64) { m.Epoch = v } - -// SetRaw is a Raw field setter. -func (m *RequestMetaHeader) SetRaw(raw bool) { - m.Raw = raw -} - // ResetMeta returns current value and sets RequestMetaHeader to empty value. -func (m *RequestMetaHeader) ResetMeta() RequestMetaHeader { +func (m *RequestMetaHeader) CutMeta() RequestMetaHeader { cp := *m m.Reset() return cp } // RestoreMeta sets current RequestMetaHeader to passed value. -func (m *RequestMetaHeader) RestoreMeta(v RequestMetaHeader) { *m = v } +func (m *RequestMetaHeader) RestoreMeta(v RequestMetaHeader) { + *m = v +} diff --git a/service/meta_test.go b/service/meta_test.go index fb7fb17..a0b85ef 100644 --- a/service/meta_test.go +++ b/service/meta_test.go @@ -6,26 +6,20 @@ import ( "github.com/stretchr/testify/require" ) -func TestRequestMetaHeader_SetEpoch(t *testing.T) { - m := new(ResponseMetaHeader) - epoch := uint64(3) - m.SetEpoch(epoch) - require.Equal(t, epoch, m.GetEpoch()) -} - -func TestRequestMetaHeader_SetVersion(t *testing.T) { - m := new(ResponseMetaHeader) - version := uint32(3) - m.SetVersion(version) - require.Equal(t, version, m.GetVersion()) -} - -func TestRequestMetaHeader_SetRaw(t *testing.T) { - m := new(RequestMetaHeader) - - m.SetRaw(true) - require.True(t, m.GetRaw()) - - m.SetRaw(false) - require.False(t, m.GetRaw()) +func TestCutRestoreMeta(t *testing.T) { + items := []func() SeizedMetaHeaderContainer{ + func() SeizedMetaHeaderContainer { + m := new(RequestMetaHeader) + m.SetEpoch(1) + return m + }, + } + + for _, item := range items { + v1 := item() + m1 := v1.CutMeta() + v1.RestoreMeta(m1) + + require.Equal(t, item(), v1) + } } diff --git a/service/raw.go b/service/raw.go new file mode 100644 index 0000000..0bb4b27 --- /dev/null +++ b/service/raw.go @@ -0,0 +1,6 @@ +package service + +// SetRaw is a Raw field setter. +func (m *RequestMetaHeader) SetRaw(raw bool) { + m.Raw = raw +} diff --git a/service/raw_test.go b/service/raw_test.go new file mode 100644 index 0000000..ad595ed --- /dev/null +++ b/service/raw_test.go @@ -0,0 +1,24 @@ +package service + +import ( + "testing" + + "github.com/stretchr/testify/require" +) + +func TestGetSetRaw(t *testing.T) { + items := []RawContainer{ + new(RequestMetaHeader), + } + + for _, item := range items { + // init with false + item.SetRaw(false) + + item.SetRaw(true) + require.True(t, item.GetRaw()) + + item.SetRaw(false) + require.False(t, item.GetRaw()) + } +} diff --git a/service/types.go b/service/types.go index cad4b3c..e7bdcd4 100644 --- a/service/types.go +++ b/service/types.go @@ -51,6 +51,12 @@ type TTLContainer interface { SetTTL(uint32) } +// SeizedMetaHeaderContainer is an interface of container of RequestMetaHeader that can be cut and restored. +type SeizedMetaHeaderContainer interface { + CutMeta() RequestMetaHeader + RestoreMeta(RequestMetaHeader) +} + // RequestMetaContainer is an interface of a fixed set of request meta value containers. // Contains: // - TTL value; @@ -64,6 +70,12 @@ type RequestMetaContainer interface { RawContainer } +// SeizedRequestMetaContainer is a RequestMetaContainer with seized meta. +type SeizedRequestMetaContainer interface { + RequestMetaContainer + SeizedMetaHeaderContainer +} + // VerbSource is an interface of the container of a token verb value with read access. type VerbSource interface { GetVerb() Token_Info_Verb diff --git a/service/verify.go b/service/verify.go index 7ac3cf3..3ed8402 100644 --- a/service/verify.go +++ b/service/verify.go @@ -118,8 +118,8 @@ var bytesPool = sync.Pool{New: func() interface{} { // new signature to headers. If something went wrong, returns error. func SignRequestHeader(key *ecdsa.PrivateKey, msg VerifiableRequest) error { // ignore meta header - if meta, ok := msg.(MetaHeader); ok { - h := meta.ResetMeta() + if meta, ok := msg.(SeizedRequestMetaContainer); ok { + h := meta.CutMeta() defer func() { meta.RestoreMeta(h) @@ -157,8 +157,8 @@ func SignRequestHeader(key *ecdsa.PrivateKey, msg VerifiableRequest) error { // If something went wrong, returns error. func VerifyRequestHeader(msg VerifiableRequest) error { // ignore meta header - if meta, ok := msg.(MetaHeader); ok { - h := meta.ResetMeta() + if meta, ok := msg.(SeizedRequestMetaContainer); ok { + h := meta.CutMeta() defer func() { meta.RestoreMeta(h) diff --git a/service/version.go b/service/version.go new file mode 100644 index 0000000..6f4839c --- /dev/null +++ b/service/version.go @@ -0,0 +1,11 @@ +package service + +// SetVersion is a Version field setter. +func (m *ResponseMetaHeader) SetVersion(v uint32) { + m.Version = v +} + +// SetVersion is a Version field setter. +func (m *RequestMetaHeader) SetVersion(v uint32) { + m.Version = v +} diff --git a/service/version_test.go b/service/version_test.go new file mode 100644 index 0000000..d102d30 --- /dev/null +++ b/service/version_test.go @@ -0,0 +1,21 @@ +package service + +import ( + "testing" + + "github.com/stretchr/testify/require" +) + +func TestGetSetVersion(t *testing.T) { + v := uint32(7) + + items := []VersionContainer{ + new(ResponseMetaHeader), + new(RequestMetaHeader), + } + + for _, item := range items { + item.SetVersion(v) + require.Equal(t, v, item.GetVersion()) + } +} From 0ffb1bd61df9a8420fd71001af629a1e45d056c1 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 4 May 2020 18:52:56 +0300 Subject: [PATCH 0174/1196] service: implement a function for signing data --- service/errors.go | 3 ++ service/sign.go | 58 ++++++++++++++++++++++ service/sign_test.go | 112 +++++++++++++++++++++++++++++++++++++++++++ service/types.go | 16 +++++++ 4 files changed, 189 insertions(+) create mode 100644 service/sign.go create mode 100644 service/sign_test.go diff --git a/service/errors.go b/service/errors.go index 4aefb4e..1154a28 100644 --- a/service/errors.go +++ b/service/errors.go @@ -16,3 +16,6 @@ const ErrCannotFindOwner = internal.Error("cannot find owner public key") // ErrWrongOwner is raised when passed OwnerID not equal to present PublicKey const ErrWrongOwner = internal.Error("wrong owner") + +// ErrNilSignedDataSource returned by functions that expect a non-nil SignedDataSource argument, but received nil. +const ErrNilSignedDataSource = internal.Error("signed data source is nil") diff --git a/service/sign.go b/service/sign.go new file mode 100644 index 0000000..f371483 --- /dev/null +++ b/service/sign.go @@ -0,0 +1,58 @@ +package service + +import ( + "crypto/ecdsa" + + crypto "github.com/nspcc-dev/neofs-crypto" +) + +// Returns data from DataSignatureAccumulator for signature creation/verification. +// +// If passed DataSignatureAccumulator provides a SignedDataReader interface, data for signature is obtained +// using this interface for optimization. In this case, it is understood that reading into the slice D +// that the method DataForSignature returns does not change D. +func dataForSignature(src SignedDataSource) ([]byte, error) { + r, ok := src.(SignedDataReader) + if !ok { + return src.SignedData() + } + + buf := bytesPool.Get().([]byte) + defer func() { + bytesPool.Put(buf) + }() + + if size := r.SignedDataSize(); size <= cap(buf) { + buf = buf[:size] + } else { + buf = make([]byte, size) + } + + n, err := r.ReadSignedData(buf) + if err != nil { + return nil, err + } + + return buf[:n], nil + +} + +// DataSignature returns the signature of data obtained using the private key. +// +// If passed data container is nil, ErrNilSignedDataSource returns. +// If passed private key is nil, crypto.ErrEmptyPrivateKey returns. +// If the data container or the signature function returns an error, it is returned directly. +func DataSignature(src SignedDataSource, key *ecdsa.PrivateKey) ([]byte, error) { + if src == nil { + return nil, ErrNilSignedDataSource + } else if key == nil { + return nil, crypto.ErrEmptyPrivateKey + } + + data, err := dataForSignature(src) + if err != nil { + return nil, err + } + + return crypto.Sign(key, data) +} diff --git a/service/sign_test.go b/service/sign_test.go new file mode 100644 index 0000000..be5f4b7 --- /dev/null +++ b/service/sign_test.go @@ -0,0 +1,112 @@ +package service + +import ( + "crypto/rand" + "errors" + "io" + "testing" + + crypto "github.com/nspcc-dev/neofs-crypto" + "github.com/nspcc-dev/neofs-crypto/test" + "github.com/stretchr/testify/require" +) + +type testSignedDataSrc struct { + e error + d []byte +} + +type testSignedDataReader struct { + SignedDataSource + + e error + d []byte +} + +func testData(t *testing.T, sz int) []byte { + d := make([]byte, sz) + _, err := rand.Read(d) + require.NoError(t, err) + return d +} + +func (s testSignedDataReader) SignedDataSize() int { + return len(s.d) +} + +func (s testSignedDataReader) ReadSignedData(buf []byte) (int, error) { + if s.e != nil { + return 0, s.e + } + + var err error + if len(buf) < len(s.d) { + err = io.ErrUnexpectedEOF + } + return copy(buf, s.d), err +} + +func (s testSignedDataSrc) SignedData() ([]byte, error) { + return s.d, s.e +} + +func TestDataSignature(t *testing.T) { + var err error + + // nil data source + _, err = DataSignature(nil, nil) + require.EqualError(t, err, ErrNilSignedDataSource.Error()) + + // nil private key + _, err = DataSignature(new(testSignedDataSrc), nil) + require.EqualError(t, err, crypto.ErrEmptyPrivateKey.Error()) + + // create test private key + sk := test.DecodeKey(0) + + t.Run("common signed data source", func(t *testing.T) { + // create test data source + src := &testSignedDataSrc{ + d: testData(t, 10), + } + + // create custom error for data source + src.e = errors.New("test error for data source") + + _, err = DataSignature(src, sk) + require.EqualError(t, err, src.e.Error()) + + // reset error to nil + src.e = nil + + // calculate data signature + sig, err := DataSignature(src, sk) + require.NoError(t, err) + + // ascertain that the signature passes verification + require.NoError(t, crypto.Verify(&sk.PublicKey, src.d, sig)) + }) + + t.Run("signed data reader", func(t *testing.T) { + // create test signed data reader + src := &testSignedDataReader{ + d: testData(t, 10), + } + + // create custom error for signed data reader + src.e = errors.New("test error for signed data reader") + + sig, err := DataSignature(src, sk) + require.EqualError(t, err, src.e.Error()) + + // reset error to nil + src.e = nil + + // calculate data signature + sig, err = DataSignature(src, sk) + require.NoError(t, err) + + // ascertain that the signature passes verification + require.NoError(t, crypto.Verify(&sk.PublicKey, src.d, sig)) + }) +} diff --git a/service/types.go b/service/types.go index e7bdcd4..06ea4e2 100644 --- a/service/types.go +++ b/service/types.go @@ -171,3 +171,19 @@ type SessionToken interface { SessionTokenInfo SignatureContainer } + +// SignedDataSource is an interface of the container of a data for signing. +type SignedDataSource interface { + // Must return the required for signature byte slice. + // A non-nil error indicates that the data is not ready for signature. + SignedData() ([]byte, error) +} + +// SignedDataReader is an interface of signed data reader. +type SignedDataReader interface { + // Must return the minimum length of the slice for full reading. + SignedDataSize() int + + // Must behave like Read method of io.Reader and differ only in the reading of the signed data. + ReadSignedData([]byte) (int, error) +} From f3e6caf7e75cf378da1c279d72ae6cd46d9d1fc0 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 4 May 2020 19:33:18 +0300 Subject: [PATCH 0175/1196] service: implement a function for creating and storing a signature --- service/sign.go | 14 ++++++++++++++ service/sign_test.go | 35 +++++++++++++++++++++++++++++++++++ service/types.go | 10 ++++++++++ 3 files changed, 59 insertions(+) diff --git a/service/sign.go b/service/sign.go index f371483..654c4a9 100644 --- a/service/sign.go +++ b/service/sign.go @@ -56,3 +56,17 @@ func DataSignature(src SignedDataSource, key *ecdsa.PrivateKey) ([]byte, error) return crypto.Sign(key, data) } + +// AddSignatureWithKey calculates the data signature and adds it to accumulator with public key. +// +// Returns signing errors only. +func AddSignatureWithKey(v SignatureKeyAccumulator, key *ecdsa.PrivateKey) error { + sign, err := DataSignature(v, key) + if err != nil { + return err + } + + v.AddSignKey(sign, &key.PublicKey) + + return nil +} diff --git a/service/sign_test.go b/service/sign_test.go index be5f4b7..5ac7c6c 100644 --- a/service/sign_test.go +++ b/service/sign_test.go @@ -1,6 +1,7 @@ package service import ( + "crypto/ecdsa" "crypto/rand" "errors" "io" @@ -23,6 +24,21 @@ type testSignedDataReader struct { d []byte } +type testKeySigAccum struct { + d []byte + f func([]byte, *ecdsa.PublicKey) +} + +func (s testKeySigAccum) SignedData() ([]byte, error) { + return s.d, nil +} + +func (s testKeySigAccum) AddSignKey(sig []byte, key *ecdsa.PublicKey) { + if s.f != nil { + s.f(sig, key) + } +} + func testData(t *testing.T, sz int) []byte { d := make([]byte, sz) _, err := rand.Read(d) @@ -110,3 +126,22 @@ func TestDataSignature(t *testing.T) { require.NoError(t, crypto.Verify(&sk.PublicKey, src.d, sig)) }) } + +func TestAddSignatureWithKey(t *testing.T) { + // create test data + data := testData(t, 10) + + // create test private key + sk := test.DecodeKey(0) + + // create test signature accumulator + var s SignatureKeyAccumulator = &testKeySigAccum{ + d: data, + f: func(sig []byte, key *ecdsa.PublicKey) { + require.Equal(t, &sk.PublicKey, key) + require.NoError(t, crypto.Verify(key, data, sig)) + }, + } + + require.NoError(t, AddSignatureWithKey(s, sk)) +} diff --git a/service/types.go b/service/types.go index 06ea4e2..80a4a49 100644 --- a/service/types.go +++ b/service/types.go @@ -1,5 +1,9 @@ package service +import ( + "crypto/ecdsa" +) + // NodeRole to identify in Bootstrap service. type NodeRole int32 @@ -187,3 +191,9 @@ type SignedDataReader interface { // Must behave like Read method of io.Reader and differ only in the reading of the signed data. ReadSignedData([]byte) (int, error) } + +// SignatureKeyAccumulator is an interface of the accumulator of data signatures with keys. +type SignatureKeyAccumulator interface { + SignedDataSource + AddSignKey([]byte, *ecdsa.PublicKey) +} From 74144f207aa1eaf88f1e55286a7e4264c2090d09 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 5 May 2020 13:16:21 +0300 Subject: [PATCH 0176/1196] service: implement functions for verification of signatures --- service/errors.go | 8 ++- service/sign.go | 103 ++++++++++++++++++++++++++-- service/sign_test.go | 160 +++++++++++++++++++++++++++++++++++++------ service/types.go | 20 +++++- 4 files changed, 264 insertions(+), 27 deletions(-) diff --git a/service/errors.go b/service/errors.go index 1154a28..6b0ed24 100644 --- a/service/errors.go +++ b/service/errors.go @@ -17,5 +17,11 @@ const ErrCannotFindOwner = internal.Error("cannot find owner public key") // ErrWrongOwner is raised when passed OwnerID not equal to present PublicKey const ErrWrongOwner = internal.Error("wrong owner") -// ErrNilSignedDataSource returned by functions that expect a non-nil SignedDataSource argument, but received nil. +// ErrNilSignedDataSource returned by functions that expect a non-nil SignedDataSource, but received nil. const ErrNilSignedDataSource = internal.Error("signed data source is nil") + +// ErrNilSignatureKeySource is returned by functions that expect a non-nil SignatureKeySource, but received nil. +const ErrNilSignatureKeySource = internal.Error("empty key-signature source") + +// ErrEmptyDataWithSignature is returned by functions that expect a non-nil DataWithSignature, but received nil. +const ErrEmptyDataWithSignature = internal.Error("empty data with signature") diff --git a/service/sign.go b/service/sign.go index 654c4a9..9a6eba9 100644 --- a/service/sign.go +++ b/service/sign.go @@ -6,12 +6,39 @@ import ( crypto "github.com/nspcc-dev/neofs-crypto" ) +type keySign struct { + key *ecdsa.PublicKey + sign []byte +} + +// GetSignature is a sign field getter. +func (s keySign) GetSignature() []byte { + return s.sign +} + +// GetPublicKey is a key field getter, +func (s keySign) GetPublicKey() *ecdsa.PublicKey { + return s.key +} + +// Unites passed key with signature and returns SignKeyPair interface. +func newSignatureKeyPair(key *ecdsa.PublicKey, sign []byte) SignKeyPair { + return &keySign{ + key: key, + sign: sign, + } +} + // Returns data from DataSignatureAccumulator for signature creation/verification. // // If passed DataSignatureAccumulator provides a SignedDataReader interface, data for signature is obtained // using this interface for optimization. In this case, it is understood that reading into the slice D // that the method DataForSignature returns does not change D. func dataForSignature(src SignedDataSource) ([]byte, error) { + if src == nil { + return nil, ErrNilSignedDataSource + } + r, ok := src.(SignedDataReader) if !ok { return src.SignedData() @@ -42,10 +69,8 @@ func dataForSignature(src SignedDataSource) ([]byte, error) { // If passed data container is nil, ErrNilSignedDataSource returns. // If passed private key is nil, crypto.ErrEmptyPrivateKey returns. // If the data container or the signature function returns an error, it is returned directly. -func DataSignature(src SignedDataSource, key *ecdsa.PrivateKey) ([]byte, error) { - if src == nil { - return nil, ErrNilSignedDataSource - } else if key == nil { +func DataSignature(key *ecdsa.PrivateKey, src SignedDataSource) ([]byte, error) { + if key == nil { return nil, crypto.ErrEmptyPrivateKey } @@ -61,7 +86,7 @@ func DataSignature(src SignedDataSource, key *ecdsa.PrivateKey) ([]byte, error) // // Returns signing errors only. func AddSignatureWithKey(v SignatureKeyAccumulator, key *ecdsa.PrivateKey) error { - sign, err := DataSignature(v, key) + sign, err := DataSignature(key, v) if err != nil { return err } @@ -70,3 +95,71 @@ func AddSignatureWithKey(v SignatureKeyAccumulator, key *ecdsa.PrivateKey) error return nil } + +// Checks passed key-signature pairs for data from the passed container. +// +// If passed key-signatures pair set is empty, nil returns immediately. +func verifySignatures(src SignedDataSource, items ...SignKeyPair) error { + if len(items) <= 0 { + return nil + } + + data, err := dataForSignature(src) + if err != nil { + return err + } + + for _, signKey := range items { + if err := crypto.Verify( + signKey.GetPublicKey(), + data, + signKey.GetSignature(), + ); err != nil { + return err + } + } + + return nil +} + +// VerifySignatures checks passed key-signature pairs for data from the passed container. +// +// If passed data source is nil, ErrNilSignedDataSource returns. +// If check data is not ready, corresponding error returns. +// If at least one of the pairs is invalid, an error returns. +func VerifySignatures(src SignedDataSource, items ...SignKeyPair) error { + return verifySignatures(src, items...) +} + +// VerifyAccumulatedSignatures checks if accumulated key-signature pairs are valid. +// +// Behaves like VerifySignatures. +// If passed key-signature source is empty, ErrNilSignatureKeySource returns. +func VerifyAccumulatedSignatures(src SignatureKeySource) error { + if src == nil { + return ErrNilSignatureKeySource + } + + return verifySignatures(src, src.GetSignKeyPairs()...) +} + +// VerifySignatureWithKey checks data signature from the passed container with passed key. +// +// If passed data with signature is nil, ErrEmptyDataWithSignature returns. +// If passed key is nil, crypto.ErrEmptyPublicKey returns. +// A non-nil error returns if and only if the signature does not pass verification. +func VerifySignatureWithKey(src DataWithSignature, key *ecdsa.PublicKey) error { + if src == nil { + return ErrEmptyDataWithSignature + } else if key == nil { + return crypto.ErrEmptyPublicKey + } + + return verifySignatures( + src, + newSignatureKeyPair( + key, + src.GetSignature(), + ), + ) +} diff --git a/service/sign_test.go b/service/sign_test.go index 5ac7c6c..8fba968 100644 --- a/service/sign_test.go +++ b/service/sign_test.go @@ -25,18 +25,28 @@ type testSignedDataReader struct { } type testKeySigAccum struct { - d []byte - f func([]byte, *ecdsa.PublicKey) + data []byte + sig []byte + key *ecdsa.PublicKey +} + +func (s testKeySigAccum) GetSignature() []byte { + return s.sig +} + +func (s testKeySigAccum) GetSignKeyPairs() []SignKeyPair { + return []SignKeyPair{ + newSignatureKeyPair(s.key, s.sig), + } } func (s testKeySigAccum) SignedData() ([]byte, error) { - return s.d, nil + return s.data, nil } func (s testKeySigAccum) AddSignKey(sig []byte, key *ecdsa.PublicKey) { - if s.f != nil { - s.f(sig, key) - } + s.key = key + s.sig = sig } func testData(t *testing.T, sz int) []byte { @@ -69,17 +79,17 @@ func (s testSignedDataSrc) SignedData() ([]byte, error) { func TestDataSignature(t *testing.T) { var err error - // nil data source - _, err = DataSignature(nil, nil) - require.EqualError(t, err, ErrNilSignedDataSource.Error()) - // nil private key - _, err = DataSignature(new(testSignedDataSrc), nil) + _, err = DataSignature(nil, nil) require.EqualError(t, err, crypto.ErrEmptyPrivateKey.Error()) // create test private key sk := test.DecodeKey(0) + // nil private key + _, err = DataSignature(sk, nil) + require.EqualError(t, err, ErrNilSignedDataSource.Error()) + t.Run("common signed data source", func(t *testing.T) { // create test data source src := &testSignedDataSrc{ @@ -89,14 +99,14 @@ func TestDataSignature(t *testing.T) { // create custom error for data source src.e = errors.New("test error for data source") - _, err = DataSignature(src, sk) + _, err = DataSignature(sk, src) require.EqualError(t, err, src.e.Error()) // reset error to nil src.e = nil // calculate data signature - sig, err := DataSignature(src, sk) + sig, err := DataSignature(sk, src) require.NoError(t, err) // ascertain that the signature passes verification @@ -112,14 +122,14 @@ func TestDataSignature(t *testing.T) { // create custom error for signed data reader src.e = errors.New("test error for signed data reader") - sig, err := DataSignature(src, sk) + sig, err := DataSignature(sk, src) require.EqualError(t, err, src.e.Error()) // reset error to nil src.e = nil // calculate data signature - sig, err = DataSignature(src, sk) + sig, err = DataSignature(sk, src) require.NoError(t, err) // ascertain that the signature passes verification @@ -136,12 +146,122 @@ func TestAddSignatureWithKey(t *testing.T) { // create test signature accumulator var s SignatureKeyAccumulator = &testKeySigAccum{ - d: data, - f: func(sig []byte, key *ecdsa.PublicKey) { - require.Equal(t, &sk.PublicKey, key) - require.NoError(t, crypto.Verify(key, data, sig)) - }, + data: data, } require.NoError(t, AddSignatureWithKey(s, sk)) } + +func TestVerifySignatures(t *testing.T) { + // empty signatures + require.NoError(t, VerifySignatures(nil)) + + // create test signature source + src := &testSignedDataSrc{ + d: testData(t, 10), + } + + // create private key for test + sk := test.DecodeKey(0) + + // calculate a signature of the data + sig, err := crypto.Sign(sk, src.d) + require.NoError(t, err) + + // ascertain that verification is passed + require.NoError(t, + VerifySignatures( + src, + newSignatureKeyPair(&sk.PublicKey, sig), + ), + ) + + // break the signature + sig[0]++ + + require.Error(t, + VerifySignatures( + src, + newSignatureKeyPair(&sk.PublicKey, sig), + ), + ) + + // restore the signature + sig[0]-- + + // empty data source + require.EqualError(t, + VerifySignatures(nil, nil), + ErrNilSignedDataSource.Error(), + ) + +} + +func TestVerifyAccumulatedSignatures(t *testing.T) { + // nil signature source + require.EqualError(t, + VerifyAccumulatedSignatures(nil), + ErrNilSignatureKeySource.Error(), + ) + + // create test private key + sk := test.DecodeKey(0) + + // create signature source + src := &testKeySigAccum{ + data: testData(t, 10), + key: &sk.PublicKey, + } + + var err error + + // calculate a signature + src.sig, err = crypto.Sign(sk, src.data) + require.NoError(t, err) + + // ascertain that verification is passed + require.NoError(t, VerifyAccumulatedSignatures(src)) + + // break the signature + src.sig[0]++ + + // ascertain that verification is failed + require.Error(t, VerifyAccumulatedSignatures(src)) +} + +func TestVerifySignatureWithKey(t *testing.T) { + // nil signature source + require.EqualError(t, + VerifySignatureWithKey(nil, nil), + ErrEmptyDataWithSignature.Error(), + ) + + // create test signature source + src := &testKeySigAccum{ + data: testData(t, 10), + } + + // nil public key + require.EqualError(t, + VerifySignatureWithKey(src, nil), + crypto.ErrEmptyPublicKey.Error(), + ) + + // create test private key + sk := test.DecodeKey(0) + + var err error + + // calculate a signature + src.sig, err = crypto.Sign(sk, src.data) + require.NoError(t, err) + + // ascertain that verification is passed + require.NoError(t, VerifySignatureWithKey(src, &sk.PublicKey)) + + // break the signature + src.sig[0]++ + + // ascertain that verification is failed + require.Error(t, VerifySignatureWithKey(src, &sk.PublicKey)) +} diff --git a/service/types.go b/service/types.go index 80a4a49..3bf8c3a 100644 --- a/service/types.go +++ b/service/types.go @@ -192,8 +192,26 @@ type SignedDataReader interface { ReadSignedData([]byte) (int, error) } -// SignatureKeyAccumulator is an interface of the accumulator of data signatures with keys. +// SignatureKeyAccumulator is an interface of the container of a data and signatures. type SignatureKeyAccumulator interface { SignedDataSource AddSignKey([]byte, *ecdsa.PublicKey) } + +// SignKeyPair is an interface of key-signature pair with read access. +type SignKeyPair interface { + SignatureSource + GetPublicKey() *ecdsa.PublicKey +} + +// SignatureKeyAccumulator is an interface of the container of a data and signatures with read access. +type SignatureKeySource interface { + SignedDataSource + GetSignKeyPairs() []SignKeyPair +} + +// DataWithSignature is an interface of data-signature pair with read access. +type DataWithSignature interface { + SignedDataSource + SignatureSource +} From fc2c78ae896515ba6efe4a5a01b99fc5fa3bdffa Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 5 May 2020 14:49:35 +0300 Subject: [PATCH 0177/1196] service: use new function for token signing and verification --- service/token.go | 147 ++++++++++++++++++++---------------------- service/token_test.go | 33 ++-------- 2 files changed, 76 insertions(+), 104 deletions(-) diff --git a/service/token.go b/service/token.go index 2aa159b..5786a40 100644 --- a/service/token.go +++ b/service/token.go @@ -3,10 +3,22 @@ package service import ( "crypto/ecdsa" "encoding/binary" + "io" - crypto "github.com/nspcc-dev/neofs-crypto" + "github.com/nspcc-dev/neofs-api-go/refs" ) +const verbSize = 4 + +const fixedTokenDataSize = 0 + + refs.UUIDSize + + refs.OwnerIDSize + + verbSize + + refs.UUIDSize + + refs.CIDSize + + 8 + + 8 + var tokenEndianness = binary.BigEndian // GetID is an ID field getter. @@ -74,88 +86,71 @@ func (m *Token) SetSignature(sig []byte) { m.Signature = sig } -// Returns byte slice that is used for creation/verification of the token signature. -func verificationTokenData(token SessionToken) []byte { - var sz int - - id := token.GetID() - sz += id.Size() - - ownerID := token.GetOwnerID() - sz += ownerID.Size() - - verb := uint32(token.GetVerb()) - sz += 4 - - addr := token.GetAddress() - sz += addr.CID.Size() + addr.ObjectID.Size() - - cEpoch := token.CreationEpoch() - sz += 8 - - fEpoch := token.ExpirationEpoch() - sz += 8 - - key := token.GetSessionKey() - sz += len(key) - - data := make([]byte, sz) - - var off int - - tokenEndianness.PutUint32(data, verb) - off += 4 - - tokenEndianness.PutUint64(data[off:], cEpoch) - off += 8 - - tokenEndianness.PutUint64(data[off:], fEpoch) - off += 8 - - off += copy(data[off:], id.Bytes()) - off += copy(data[off:], ownerID.Bytes()) - off += copy(data[off:], addr.CID.Bytes()) - off += copy(data[off:], addr.ObjectID.Bytes()) - off += copy(data[off:], key) +// Size returns the size of a binary representation of the verb. +func (x Token_Info_Verb) Size() int { + return verbSize +} +// Bytes returns a binary representation of the verb. +func (x Token_Info_Verb) Bytes() []byte { + data := make([]byte, verbSize) + tokenEndianness.PutUint32(data, uint32(x)) return data } -// SignToken calculates and stores the signature of token information. -// -// If passed token is nil, ErrNilToken returns. -// If passed private key is nil, crypto.ErrEmptyPrivateKey returns. -func SignToken(token SessionToken, key *ecdsa.PrivateKey) error { - if token == nil { - return ErrNilToken - } else if key == nil { - return crypto.ErrEmptyPrivateKey - } - - sig, err := crypto.Sign(key, verificationTokenData(token)) - if err != nil { - return err - } - - token.SetSignature(sig) - - return nil +// AddSignKey calls a Signature field setter with passed signature. +func (m *Token) AddSignKey(sig []byte, _ *ecdsa.PublicKey) { + m.SetSignature(sig) } -// VerifyTokenSignature checks if token was signed correctly. +// SignedData returns token information in a binary representation. +func (m *Token) SignedData() ([]byte, error) { + data := make([]byte, m.SignedDataSize()) + + copyTokenSignedData(data, m) + + return data, nil +} + +// ReadSignedData copies a binary representation of the token information to passed buffer. // -// If passed token is nil, ErrNilToken returns. -// If passed public key is nil, crypto.ErrEmptyPublicKey returns. -func VerifyTokenSignature(token SessionToken, key *ecdsa.PublicKey) error { - if token == nil { - return ErrNilToken - } else if key == nil { - return crypto.ErrEmptyPublicKey +// If buffer length is less than required, io.ErrUnexpectedEOF returns. +func (m *Token_Info) ReadSignedData(p []byte) (int, error) { + sz := m.SignedDataSize() + if len(p) < sz { + return 0, io.ErrUnexpectedEOF } - return crypto.Verify( - key, - verificationTokenData(token), - token.GetSignature(), - ) + copyTokenSignedData(p, m) + + return sz, nil +} + +// SignedDataSize returns the length of signed token information slice. +func (m Token_Info) SignedDataSize() int { + return fixedTokenDataSize + len(m.GetSessionKey()) +} + +// Fills passed buffer with signing token information bytes. +// Does not check buffer length, it is understood that enough space is allocated in it. +func copyTokenSignedData(buf []byte, token SessionTokenInfo) { + var off int + + off += copy(buf[off:], token.GetID().Bytes()) + + off += copy(buf[off:], token.GetOwnerID().Bytes()) + + off += copy(buf[off:], token.GetVerb().Bytes()) + + addr := token.GetAddress() + off += copy(buf[off:], addr.CID.Bytes()) + off += copy(buf[off:], addr.ObjectID.Bytes()) + + tokenEndianness.PutUint64(buf[off:], token.CreationEpoch()) + off += 8 + + tokenEndianness.PutUint64(buf[off:], token.ExpirationEpoch()) + off += 8 + + copy(buf[off:], token.GetSessionKey()) } diff --git a/service/token_test.go b/service/token_test.go index 1e02f46..968364c 100644 --- a/service/token_test.go +++ b/service/token_test.go @@ -5,7 +5,6 @@ import ( "testing" "github.com/nspcc-dev/neofs-api-go/refs" - crypto "github.com/nspcc-dev/neofs-crypto" "github.com/nspcc-dev/neofs-crypto/test" "github.com/stretchr/testify/require" ) @@ -90,29 +89,7 @@ func TestTokenGettersSetters(t *testing.T) { } func TestSignToken(t *testing.T) { - // nil token - require.EqualError(t, - SignToken(nil, nil), - ErrNilToken.Error(), - ) - - require.EqualError(t, - VerifyTokenSignature(nil, nil), - ErrNilToken.Error(), - ) - - var token SessionToken = new(Token) - - // nil key - require.EqualError(t, - SignToken(token, nil), - crypto.ErrEmptyPrivateKey.Error(), - ) - - require.EqualError(t, - VerifyTokenSignature(token, nil), - crypto.ErrEmptyPublicKey.Error(), - ) + token := new(Token) // create private key for signing sk := test.DecodeKey(0) @@ -150,8 +127,8 @@ func TestSignToken(t *testing.T) { token.SetSessionKey(sessionKey) // sign and verify token - require.NoError(t, SignToken(token, sk)) - require.NoError(t, VerifyTokenSignature(token, pk)) + require.NoError(t, AddSignatureWithKey(token, sk)) + require.NoError(t, VerifySignatureWithKey(token, pk)) items := []struct { corrupt func() @@ -235,8 +212,8 @@ func TestSignToken(t *testing.T) { for _, v := range items { v.corrupt() - require.Error(t, VerifyTokenSignature(token, pk)) + require.Error(t, VerifySignatureWithKey(token, pk)) v.restore() - require.NoError(t, VerifyTokenSignature(token, pk)) + require.NoError(t, VerifySignatureWithKey(token, pk)) } } From 52d3c827763d28b3d8324d1e408b3b5f314c6ec0 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 6 May 2020 11:44:55 +0300 Subject: [PATCH 0178/1196] service: implement sign/verify function for data with session token --- service/errors.go | 30 ++++++-- service/sign.go | 71 ++++++++++++++++-- service/sign_test.go | 171 ++++++++++++++++++++++++++++-------------- service/token.go | 83 +++++++++++++++++++- service/token_test.go | 8 +- service/types.go | 47 +++++++++--- 6 files changed, 326 insertions(+), 84 deletions(-) diff --git a/service/errors.go b/service/errors.go index 6b0ed24..6241ad2 100644 --- a/service/errors.go +++ b/service/errors.go @@ -2,10 +2,12 @@ package service import "github.com/nspcc-dev/neofs-api-go/internal" -// ErrNilToken is returned by functions that expect a non-nil token argument, but received nil. +// ErrNilToken is returned by functions that expect +// a non-nil token argument, but received nil. const ErrNilToken = internal.Error("token is nil") -// ErrInvalidTTL means that the TTL value does not satisfy a specific criterion. +// ErrInvalidTTL means that the TTL value does not +// satisfy a specific criterion. const ErrInvalidTTL = internal.Error("invalid TTL value") // ErrInvalidPublicKeyBytes means that the public key could not be unmarshaled. @@ -14,14 +16,30 @@ const ErrInvalidPublicKeyBytes = internal.Error("cannot load public key") // ErrCannotFindOwner is raised when signatures empty in GetOwner. const ErrCannotFindOwner = internal.Error("cannot find owner public key") -// ErrWrongOwner is raised when passed OwnerID not equal to present PublicKey +// ErrWrongOwner is raised when passed OwnerID +// not equal to present PublicKey const ErrWrongOwner = internal.Error("wrong owner") -// ErrNilSignedDataSource returned by functions that expect a non-nil SignedDataSource, but received nil. +// ErrNilSignedDataSource returned by functions that expect a non-nil +// SignedDataSource, but received nil. const ErrNilSignedDataSource = internal.Error("signed data source is nil") -// ErrNilSignatureKeySource is returned by functions that expect a non-nil SignatureKeySource, but received nil. +// ErrNilSignatureKeySource is returned by functions that expect a non-nil +// SignatureKeySource, but received nil. const ErrNilSignatureKeySource = internal.Error("empty key-signature source") -// ErrEmptyDataWithSignature is returned by functions that expect a non-nil DataWithSignature, but received nil. +// ErrEmptyDataWithSignature is returned by functions that expect +// a non-nil DataWithSignature, but received nil. const ErrEmptyDataWithSignature = internal.Error("empty data with signature") + +// ErrNegativeLength is returned by functions that received +// negative length for slice allocation. +const ErrNegativeLength = internal.Error("negative slice length") + +// ErrNilDataWithTokenSignAccumulator is returned by functions that expect +// a non-nil DataWithTokenSignAccumulator, but received nil. +const ErrNilDataWithTokenSignAccumulator = internal.Error("signed data with token is nil") + +// ErrNilSignatureKeySourceWithToken is returned by functions that expect +// a non-nil SignatureKeySourceWithToken, but received nil. +const ErrNilSignatureKeySourceWithToken = internal.Error("key-signature source with token is nil") diff --git a/service/sign.go b/service/sign.go index 9a6eba9..f5cdc0b 100644 --- a/service/sign.go +++ b/service/sign.go @@ -34,6 +34,8 @@ func newSignatureKeyPair(key *ecdsa.PublicKey, sign []byte) SignKeyPair { // If passed DataSignatureAccumulator provides a SignedDataReader interface, data for signature is obtained // using this interface for optimization. In this case, it is understood that reading into the slice D // that the method DataForSignature returns does not change D. +// +// If returned length of data is negative, ErrNegativeLength returns. func dataForSignature(src SignedDataSource) ([]byte, error) { if src == nil { return nil, ErrNilSignedDataSource @@ -45,11 +47,10 @@ func dataForSignature(src SignedDataSource) ([]byte, error) { } buf := bytesPool.Get().([]byte) - defer func() { - bytesPool.Put(buf) - }() - if size := r.SignedDataSize(); size <= cap(buf) { + if size := r.SignedDataSize(); size < 0 { + return nil, ErrNegativeLength + } else if size <= cap(buf) { buf = buf[:size] } else { buf = make([]byte, size) @@ -78,14 +79,17 @@ func DataSignature(key *ecdsa.PrivateKey, src SignedDataSource) ([]byte, error) if err != nil { return nil, err } + defer bytesPool.Put(data) return crypto.Sign(key, data) } // AddSignatureWithKey calculates the data signature and adds it to accumulator with public key. // +// Any change of data provoke signature breakdown. +// // Returns signing errors only. -func AddSignatureWithKey(v SignatureKeyAccumulator, key *ecdsa.PrivateKey) error { +func AddSignatureWithKey(key *ecdsa.PrivateKey, v DataWithSignKeyAccumulator) error { sign, err := DataSignature(key, v) if err != nil { return err @@ -108,6 +112,7 @@ func verifySignatures(src SignedDataSource, items ...SignKeyPair) error { if err != nil { return err } + defer bytesPool.Put(data) for _, signKey := range items { if err := crypto.Verify( @@ -135,7 +140,7 @@ func VerifySignatures(src SignedDataSource, items ...SignKeyPair) error { // // Behaves like VerifySignatures. // If passed key-signature source is empty, ErrNilSignatureKeySource returns. -func VerifyAccumulatedSignatures(src SignatureKeySource) error { +func VerifyAccumulatedSignatures(src DataWithSignKeySource) error { if src == nil { return ErrNilSignatureKeySource } @@ -148,7 +153,7 @@ func VerifyAccumulatedSignatures(src SignatureKeySource) error { // If passed data with signature is nil, ErrEmptyDataWithSignature returns. // If passed key is nil, crypto.ErrEmptyPublicKey returns. // A non-nil error returns if and only if the signature does not pass verification. -func VerifySignatureWithKey(src DataWithSignature, key *ecdsa.PublicKey) error { +func VerifySignatureWithKey(key *ecdsa.PublicKey, src DataWithSignature) error { if src == nil { return ErrEmptyDataWithSignature } else if key == nil { @@ -163,3 +168,55 @@ func VerifySignatureWithKey(src DataWithSignature, key *ecdsa.PublicKey) error { ), ) } + +// SignDataWithSessionToken calculates data with token signature and adds it to accumulator. +// +// Any change of data or session token info provoke signature breakdown. +// +// If passed private key is nil, crypto.ErrEmptyPrivateKey returns. +// If passed DataWithTokenSignAccumulator is nil, ErrNilDataWithTokenSignAccumulator returns. +func SignDataWithSessionToken(key *ecdsa.PrivateKey, src DataWithTokenSignAccumulator) error { + if src == nil { + return ErrNilDataWithTokenSignAccumulator + } else if r, ok := src.(SignedDataReader); ok { + return AddSignatureWithKey(key, &signDataReaderWithToken{ + SignedDataSource: src, + SignKeyPairAccumulator: src, + + rdr: r, + token: src.GetSessionToken(), + }, + ) + } + + return AddSignatureWithKey(key, &signAccumWithToken{ + SignedDataSource: src, + SignKeyPairAccumulator: src, + + token: src.GetSessionToken(), + }) +} + +// VerifyAccumulatedSignaturesWithToken checks if accumulated key-signature pairs of data with token are valid. +// +// If passed DataWithTokenSignSource is nil, ErrNilSignatureKeySourceWithToken returns. +func VerifyAccumulatedSignaturesWithToken(src DataWithTokenSignSource) error { + if src == nil { + return ErrNilSignatureKeySourceWithToken + } else if r, ok := src.(SignedDataReader); ok { + return VerifyAccumulatedSignatures(&signDataReaderWithToken{ + SignedDataSource: src, + SignKeyPairSource: src, + + rdr: r, + token: src.GetSessionToken(), + }) + } + + return VerifyAccumulatedSignatures(&signAccumWithToken{ + SignedDataSource: src, + SignKeyPairSource: src, + + token: src.GetSessionToken(), + }) +} diff --git a/service/sign_test.go b/service/sign_test.go index 8fba968..5cb7c40 100644 --- a/service/sign_test.go +++ b/service/sign_test.go @@ -13,38 +13,32 @@ import ( ) type testSignedDataSrc struct { - e error - d []byte + err error + data []byte + sig []byte + key *ecdsa.PublicKey + token SessionToken } type testSignedDataReader struct { - SignedDataSource - - e error - d []byte + *testSignedDataSrc } -type testKeySigAccum struct { - data []byte - sig []byte - key *ecdsa.PublicKey -} - -func (s testKeySigAccum) GetSignature() []byte { +func (s testSignedDataSrc) GetSignature() []byte { return s.sig } -func (s testKeySigAccum) GetSignKeyPairs() []SignKeyPair { +func (s testSignedDataSrc) GetSignKeyPairs() []SignKeyPair { return []SignKeyPair{ newSignatureKeyPair(s.key, s.sig), } } -func (s testKeySigAccum) SignedData() ([]byte, error) { - return s.data, nil +func (s testSignedDataSrc) SignedData() ([]byte, error) { + return s.data, s.err } -func (s testKeySigAccum) AddSignKey(sig []byte, key *ecdsa.PublicKey) { +func (s *testSignedDataSrc) AddSignKey(sig []byte, key *ecdsa.PublicKey) { s.key = key s.sig = sig } @@ -56,24 +50,24 @@ func testData(t *testing.T, sz int) []byte { return d } +func (s testSignedDataSrc) GetSessionToken() SessionToken { + return s.token +} + func (s testSignedDataReader) SignedDataSize() int { - return len(s.d) + return len(s.data) } func (s testSignedDataReader) ReadSignedData(buf []byte) (int, error) { - if s.e != nil { - return 0, s.e + if s.err != nil { + return 0, s.err } var err error - if len(buf) < len(s.d) { + if len(buf) < len(s.data) { err = io.ErrUnexpectedEOF } - return copy(buf, s.d), err -} - -func (s testSignedDataSrc) SignedData() ([]byte, error) { - return s.d, s.e + return copy(buf, s.data), err } func TestDataSignature(t *testing.T) { @@ -93,63 +87,59 @@ func TestDataSignature(t *testing.T) { t.Run("common signed data source", func(t *testing.T) { // create test data source src := &testSignedDataSrc{ - d: testData(t, 10), + data: testData(t, 10), } // create custom error for data source - src.e = errors.New("test error for data source") + src.err = errors.New("test error for data source") _, err = DataSignature(sk, src) - require.EqualError(t, err, src.e.Error()) + require.EqualError(t, err, src.err.Error()) // reset error to nil - src.e = nil + src.err = nil // calculate data signature sig, err := DataSignature(sk, src) require.NoError(t, err) // ascertain that the signature passes verification - require.NoError(t, crypto.Verify(&sk.PublicKey, src.d, sig)) + require.NoError(t, crypto.Verify(&sk.PublicKey, src.data, sig)) }) t.Run("signed data reader", func(t *testing.T) { // create test signed data reader - src := &testSignedDataReader{ - d: testData(t, 10), + src := &testSignedDataSrc{ + data: testData(t, 10), } // create custom error for signed data reader - src.e = errors.New("test error for signed data reader") + src.err = errors.New("test error for signed data reader") sig, err := DataSignature(sk, src) - require.EqualError(t, err, src.e.Error()) + require.EqualError(t, err, src.err.Error()) // reset error to nil - src.e = nil + src.err = nil // calculate data signature sig, err = DataSignature(sk, src) require.NoError(t, err) // ascertain that the signature passes verification - require.NoError(t, crypto.Verify(&sk.PublicKey, src.d, sig)) + require.NoError(t, crypto.Verify(&sk.PublicKey, src.data, sig)) }) } func TestAddSignatureWithKey(t *testing.T) { - // create test data - data := testData(t, 10) - - // create test private key - sk := test.DecodeKey(0) - - // create test signature accumulator - var s SignatureKeyAccumulator = &testKeySigAccum{ - data: data, - } - - require.NoError(t, AddSignatureWithKey(s, sk)) + require.NoError(t, + AddSignatureWithKey( + test.DecodeKey(0), + &testSignedDataSrc{ + data: testData(t, 10), + }, + ), + ) } func TestVerifySignatures(t *testing.T) { @@ -158,14 +148,14 @@ func TestVerifySignatures(t *testing.T) { // create test signature source src := &testSignedDataSrc{ - d: testData(t, 10), + data: testData(t, 10), } // create private key for test sk := test.DecodeKey(0) // calculate a signature of the data - sig, err := crypto.Sign(sk, src.d) + sig, err := crypto.Sign(sk, src.data) require.NoError(t, err) // ascertain that verification is passed @@ -208,7 +198,7 @@ func TestVerifyAccumulatedSignatures(t *testing.T) { sk := test.DecodeKey(0) // create signature source - src := &testKeySigAccum{ + src := &testSignedDataSrc{ data: testData(t, 10), key: &sk.PublicKey, } @@ -237,13 +227,13 @@ func TestVerifySignatureWithKey(t *testing.T) { ) // create test signature source - src := &testKeySigAccum{ + src := &testSignedDataSrc{ data: testData(t, 10), } // nil public key require.EqualError(t, - VerifySignatureWithKey(src, nil), + VerifySignatureWithKey(nil, src), crypto.ErrEmptyPublicKey.Error(), ) @@ -257,11 +247,80 @@ func TestVerifySignatureWithKey(t *testing.T) { require.NoError(t, err) // ascertain that verification is passed - require.NoError(t, VerifySignatureWithKey(src, &sk.PublicKey)) + require.NoError(t, VerifySignatureWithKey(&sk.PublicKey, src)) // break the signature src.sig[0]++ // ascertain that verification is failed - require.Error(t, VerifySignatureWithKey(src, &sk.PublicKey)) + require.Error(t, VerifySignatureWithKey(&sk.PublicKey, src)) +} + +func TestSignVerifyDataWithSessionToken(t *testing.T) { + // sign with empty DataWithTokenSignAccumulator + require.EqualError(t, + SignDataWithSessionToken(nil, nil), + ErrNilDataWithTokenSignAccumulator.Error(), + ) + + // verify with empty DataWithTokenSignSource + require.EqualError(t, + VerifyAccumulatedSignaturesWithToken(nil), + ErrNilSignatureKeySourceWithToken.Error(), + ) + + // create test session token + var ( + token = new(Token) + initVerb = Token_Info_Verb(1) + ) + + token.SetVerb(initVerb) + + // create test data with token + src := &testSignedDataSrc{ + data: testData(t, 10), + token: token, + } + + // create test private key + sk := test.DecodeKey(0) + + // sign with private key + require.NoError(t, SignDataWithSessionToken(sk, src)) + + // ascertain that verification is passed + require.NoError(t, VerifyAccumulatedSignaturesWithToken(src)) + + // break the data + src.data[0]++ + + // ascertain that verification is failed + require.Error(t, VerifyAccumulatedSignaturesWithToken(src)) + + // restore the data + src.data[0]-- + + // break the token + token.SetVerb(initVerb + 1) + + // ascertain that verification is failed + require.Error(t, VerifyAccumulatedSignaturesWithToken(src)) + + // restore the token + token.SetVerb(initVerb) + + // ascertain that verification is passed + require.NoError(t, VerifyAccumulatedSignaturesWithToken(src)) + + // wrap to data reader + rdr := &testSignedDataReader{ + testSignedDataSrc: src, + } + + // sign with private key + require.NoError(t, SignDataWithSessionToken(sk, rdr)) + + // ascertain that verification is passed + require.NoError(t, VerifyAccumulatedSignaturesWithToken(rdr)) } diff --git a/service/token.go b/service/token.go index 5786a40..f431427 100644 --- a/service/token.go +++ b/service/token.go @@ -8,6 +8,24 @@ import ( "github.com/nspcc-dev/neofs-api-go/refs" ) +type signAccumWithToken struct { + SignedDataSource + SignKeyPairAccumulator + SignKeyPairSource + + token SessionToken +} + +type signDataReaderWithToken struct { + SignedDataSource + SignKeyPairAccumulator + SignKeyPairSource + + rdr SignedDataReader + + token SessionToken +} + const verbSize = 4 const fixedTokenDataSize = 0 + @@ -127,13 +145,26 @@ func (m *Token_Info) ReadSignedData(p []byte) (int, error) { } // SignedDataSize returns the length of signed token information slice. -func (m Token_Info) SignedDataSize() int { - return fixedTokenDataSize + len(m.GetSessionKey()) +func (m *Token_Info) SignedDataSize() int { + return tokenInfoSize(m) +} + +func tokenInfoSize(v SessionKeySource) int { + if v == nil { + return 0 + } + return fixedTokenDataSize + len(v.GetSessionKey()) } // Fills passed buffer with signing token information bytes. // Does not check buffer length, it is understood that enough space is allocated in it. +// +// If passed SessionTokenInfo, buffer remains unchanged. func copyTokenSignedData(buf []byte, token SessionTokenInfo) { + if token == nil { + return + } + var off int off += copy(buf[off:], token.GetID().Bytes()) @@ -154,3 +185,51 @@ func copyTokenSignedData(buf []byte, token SessionTokenInfo) { copy(buf[off:], token.GetSessionKey()) } + +// SignedData concatenates signed data with session token information. Returns concatenation result. +// +// Token bytes are added if and only if token is not nil. +func (s signAccumWithToken) SignedData() ([]byte, error) { + data, err := s.SignedDataSource.SignedData() + if err != nil { + return nil, err + } + + tokenData := make([]byte, tokenInfoSize(s.token)) + + copyTokenSignedData(tokenData, s.token) + + return append(data, tokenData...), nil +} + +func (s signDataReaderWithToken) SignedDataSize() int { + sz := s.rdr.SignedDataSize() + if sz < 0 { + return -1 + } + + sz += tokenInfoSize(s.token) + + return sz +} + +func (s signDataReaderWithToken) ReadSignedData(p []byte) (int, error) { + dataSize := s.rdr.SignedDataSize() + if dataSize < 0 { + return 0, ErrNegativeLength + } + + sumSize := dataSize + tokenInfoSize(s.token) + + if len(p) < sumSize { + return 0, io.ErrUnexpectedEOF + } + + if n, err := s.rdr.ReadSignedData(p); err != nil { + return n, err + } + + copyTokenSignedData(p[dataSize:], s.token) + + return sumSize, nil +} diff --git a/service/token_test.go b/service/token_test.go index 968364c..ce3d2c8 100644 --- a/service/token_test.go +++ b/service/token_test.go @@ -127,8 +127,8 @@ func TestSignToken(t *testing.T) { token.SetSessionKey(sessionKey) // sign and verify token - require.NoError(t, AddSignatureWithKey(token, sk)) - require.NoError(t, VerifySignatureWithKey(token, pk)) + require.NoError(t, AddSignatureWithKey(sk, token)) + require.NoError(t, VerifySignatureWithKey(pk, token)) items := []struct { corrupt func() @@ -212,8 +212,8 @@ func TestSignToken(t *testing.T) { for _, v := range items { v.corrupt() - require.Error(t, VerifySignatureWithKey(token, pk)) + require.Error(t, VerifySignatureWithKey(pk, token)) v.restore() - require.NoError(t, VerifySignatureWithKey(token, pk)) + require.NoError(t, VerifySignatureWithKey(pk, token)) } } diff --git a/service/types.go b/service/types.go index 3bf8c3a..020cba0 100644 --- a/service/types.go +++ b/service/types.go @@ -186,32 +186,61 @@ type SignedDataSource interface { // SignedDataReader is an interface of signed data reader. type SignedDataReader interface { // Must return the minimum length of the slice for full reading. + // Must return a negative value if the length cannot be calculated. SignedDataSize() int // Must behave like Read method of io.Reader and differ only in the reading of the signed data. ReadSignedData([]byte) (int, error) } -// SignatureKeyAccumulator is an interface of the container of a data and signatures. -type SignatureKeyAccumulator interface { - SignedDataSource +// SignKeyPairAccumulator is an interface of a set of key-signature pairs with append access. +type SignKeyPairAccumulator interface { AddSignKey([]byte, *ecdsa.PublicKey) } +// SignKeyPairSource is an interface of a set of key-signature pairs with read access. +type SignKeyPairSource interface { + GetSignKeyPairs() []SignKeyPair +} + // SignKeyPair is an interface of key-signature pair with read access. type SignKeyPair interface { SignatureSource GetPublicKey() *ecdsa.PublicKey } -// SignatureKeyAccumulator is an interface of the container of a data and signatures with read access. -type SignatureKeySource interface { - SignedDataSource - GetSignKeyPairs() []SignKeyPair -} - // DataWithSignature is an interface of data-signature pair with read access. type DataWithSignature interface { SignedDataSource SignatureSource } + +// DataWithSignKeyAccumulator is an interface of data and key-signature accumulator pair. +type DataWithSignKeyAccumulator interface { + SignedDataSource + SignKeyPairAccumulator +} + +// DataWithSignKeySource is an interface of data and key-signature source pair. +type DataWithSignKeySource interface { + SignedDataSource + SignKeyPairSource +} + +// SignedDataWithToken is an interface of data-token pair with read access. +type SignedDataWithToken interface { + SignedDataSource + SessionTokenSource +} + +// DataWithTokenSignAccumulator is an interface of data-token pair with signature write access. +type DataWithTokenSignAccumulator interface { + SignedDataWithToken + SignKeyPairAccumulator +} + +// DataWithTokenSignSource is an interface of data-token pair with signature read access. +type DataWithTokenSignSource interface { + SignedDataWithToken + SignKeyPairSource +} From 082edf745626b0731c300ee7b7731d88aebc01c2 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 6 May 2020 12:50:15 +0300 Subject: [PATCH 0179/1196] service: implement sign-verify methods on RequestVerificationHeader --- service/verify.go | 50 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/service/verify.go b/service/verify.go index 3ed8402..beca992 100644 --- a/service/verify.go +++ b/service/verify.go @@ -35,6 +35,56 @@ type ( } ) +// GetSessionToken returns SessionToken interface of Token field. +// +// If token field value is nil, nil returns. +func (m RequestVerificationHeader) GetSessionToken() SessionToken { + if t := m.GetToken(); t != nil { + return t + } + + return nil +} + +// AddSignKey adds new element to Signatures field. +// +// Sets Sign field to passed sign. Set Peer field to marshaled passed key. +func (m *RequestVerificationHeader) AddSignKey(sign []byte, key *ecdsa.PublicKey) { + m.SetSignatures( + append( + m.GetSignatures(), + &RequestVerificationHeader_Signature{ + Sign: sign, + Peer: crypto.MarshalPublicKey(key), + }, + ), + ) +} + +// GetSignKeyPairs returns the elements of Signatures field as SignKeyPair slice. +func (m RequestVerificationHeader) GetSignKeyPairs() []SignKeyPair { + var ( + signs = m.GetSignatures() + res = make([]SignKeyPair, len(signs)) + ) + + for i := range signs { + res[i] = signs[i] + } + + return res +} + +// GetSignature returns the result of a Sign field getter. +func (m RequestVerificationHeader_Signature) GetSignature() []byte { + return m.GetSign() +} + +// GetPublicKey unmarshals and returns the result of a Peer field getter. +func (m RequestVerificationHeader_Signature) GetPublicKey() *ecdsa.PublicKey { + return crypto.UnmarshalPublicKey(m.GetPeer()) +} + // SetSignatures replaces signatures stored in RequestVerificationHeader. func (m *RequestVerificationHeader) SetSignatures(signatures []*RequestVerificationHeader_Signature) { m.Signatures = signatures From 78f435a9051f0cdcdf9ec6faf81bc8cbd8cb2e44 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 6 May 2020 13:16:15 +0300 Subject: [PATCH 0180/1196] object: implement signing payload methods on PutRequest message --- object/sign.go | 45 ++++++++++++++++++++++++++ object/sign_test.go | 79 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 124 insertions(+) create mode 100644 object/sign.go create mode 100644 object/sign_test.go diff --git a/object/sign.go b/object/sign.go new file mode 100644 index 0000000..1dc5bd0 --- /dev/null +++ b/object/sign.go @@ -0,0 +1,45 @@ +package object + +// SignedData returns marshaled payload of the Put request. +// +// If payload is nil, ErrHeaderNotFound returns. +func (m PutRequest) SignedData() ([]byte, error) { + r := m.GetR() + if r == nil { + return nil, ErrHeaderNotFound + } + + data := make([]byte, r.Size()) + + if _, err := r.MarshalTo(data); err != nil { + return nil, err + } + + return data, nil +} + +// ReadSignedData copies marshaled payload of the Put request to passed buffer. +// +// If payload is nil, ErrHeaderNotFound returns. +func (m PutRequest) ReadSignedData(p []byte) error { + r := m.GetR() + if r == nil { + return ErrHeaderNotFound + } + + _, err := r.MarshalTo(p) + + return err +} + +// SignedDataSize returns the size of payload of the Put request. +// +// If payload is nil, -1 returns. +func (m PutRequest) SignedDataSize() int { + r := m.GetR() + if r == nil { + return -1 + } + + return r.Size() +} diff --git a/object/sign_test.go b/object/sign_test.go new file mode 100644 index 0000000..2574d9c --- /dev/null +++ b/object/sign_test.go @@ -0,0 +1,79 @@ +package object + +import ( + "testing" + + "github.com/nspcc-dev/neofs-api-go/service" + "github.com/nspcc-dev/neofs-crypto/test" + "github.com/stretchr/testify/require" +) + +func TestSignVerifyRequests(t *testing.T) { + sk := test.DecodeKey(0) + + type sigType interface { + service.SignedDataWithToken + service.SignKeyPairAccumulator + service.SignKeyPairSource + SetToken(*Token) + } + + items := []struct { + constructor func() sigType + bodyCorrupt []func(sigType) + }{ + { // PutRequest.PutHeader + constructor: func() sigType { + return MakePutRequestHeader(new(Object)) + }, + bodyCorrupt: []func(sigType){ + func(s sigType) { + obj := s.(*PutRequest).GetR().(*PutRequest_Header).Header.GetObject() + obj.SystemHeader.PayloadLength++ + }, + }, + }, + { // PutRequest.Chunk + constructor: func() sigType { + return MakePutRequestChunk(make([]byte, 10)) + }, + bodyCorrupt: []func(sigType){ + func(s sigType) { + h := s.(*PutRequest).GetR().(*PutRequest_Chunk) + h.Chunk[0]++ + }, + }, + }, + } + + for _, item := range items { + { // token corruptions + v := item.constructor() + + token := new(Token) + v.SetToken(token) + + require.NoError(t, service.SignDataWithSessionToken(sk, v)) + + require.NoError(t, service.VerifyAccumulatedSignaturesWithToken(v)) + + token.SetSessionKey(append(token.GetSessionKey(), 1)) + + require.Error(t, service.VerifyAccumulatedSignaturesWithToken(v)) + } + + { // body corruptions + for _, corruption := range item.bodyCorrupt { + v := item.constructor() + + require.NoError(t, service.SignDataWithSessionToken(sk, v)) + + require.NoError(t, service.VerifyAccumulatedSignaturesWithToken(v)) + + corruption(v) + + require.Error(t, service.VerifyAccumulatedSignaturesWithToken(v)) + } + } + } +} From 439221cea824f2b5c1568160db37344fac219a8f Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 6 May 2020 13:33:03 +0300 Subject: [PATCH 0181/1196] object: implement signing payload methods on GetRequest message --- object/sign.go | 40 ++++++++++++++++++++++++++++++++++++++++ object/sign_test.go | 25 +++++++++++++++++++------ 2 files changed, 59 insertions(+), 6 deletions(-) diff --git a/object/sign.go b/object/sign.go index 1dc5bd0..63687a5 100644 --- a/object/sign.go +++ b/object/sign.go @@ -1,5 +1,9 @@ package object +import ( + "io" +) + // SignedData returns marshaled payload of the Put request. // // If payload is nil, ErrHeaderNotFound returns. @@ -43,3 +47,39 @@ func (m PutRequest) SignedDataSize() int { return r.Size() } + +// SignedData returns marshaled Address field. +// +// Resulting error is always nil. +func (m GetRequest) SignedData() ([]byte, error) { + addr := m.GetAddress() + + return append( + addr.CID.Bytes(), + addr.ObjectID.Bytes()..., + ), nil +} + +// ReadSignedData copies marshaled Address field to passed buffer. +// +// If the buffer size is insufficient, io.ErrUnexpectedEOF returns. +func (m GetRequest) ReadSignedData(p []byte) error { + addr := m.GetAddress() + + if len(p) < addr.CID.Size()+addr.ObjectID.Size() { + return io.ErrUnexpectedEOF + } + + off := copy(p, addr.CID.Bytes()) + + copy(p[off:], addr.ObjectID.Bytes()) + + return nil +} + +// SignedDataSize returns the size of object address. +func (m GetRequest) SignedDataSize() int { + addr := m.GetAddress() + + return addr.CID.Size() + addr.ObjectID.Size() +} diff --git a/object/sign_test.go b/object/sign_test.go index 2574d9c..8cf5627 100644 --- a/object/sign_test.go +++ b/object/sign_test.go @@ -19,14 +19,14 @@ func TestSignVerifyRequests(t *testing.T) { } items := []struct { - constructor func() sigType - bodyCorrupt []func(sigType) + constructor func() sigType + payloadCorrupt []func(sigType) }{ { // PutRequest.PutHeader constructor: func() sigType { return MakePutRequestHeader(new(Object)) }, - bodyCorrupt: []func(sigType){ + payloadCorrupt: []func(sigType){ func(s sigType) { obj := s.(*PutRequest).GetR().(*PutRequest_Header).Header.GetObject() obj.SystemHeader.PayloadLength++ @@ -37,13 +37,26 @@ func TestSignVerifyRequests(t *testing.T) { constructor: func() sigType { return MakePutRequestChunk(make([]byte, 10)) }, - bodyCorrupt: []func(sigType){ + payloadCorrupt: []func(sigType){ func(s sigType) { h := s.(*PutRequest).GetR().(*PutRequest_Chunk) h.Chunk[0]++ }, }, }, + { // GetRequest + constructor: func() sigType { + return new(GetRequest) + }, + payloadCorrupt: []func(sigType){ + func(s sigType) { + s.(*GetRequest).Address.CID[0]++ + }, + func(s sigType) { + s.(*GetRequest).Address.ObjectID[0]++ + }, + }, + }, } for _, item := range items { @@ -62,8 +75,8 @@ func TestSignVerifyRequests(t *testing.T) { require.Error(t, service.VerifyAccumulatedSignaturesWithToken(v)) } - { // body corruptions - for _, corruption := range item.bodyCorrupt { + { // payload corruptions + for _, corruption := range item.payloadCorrupt { v := item.constructor() require.NoError(t, service.SignDataWithSessionToken(sk, v)) From 68f83f547043edaba1e075414cd511f5163ebacc Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 6 May 2020 13:54:13 +0300 Subject: [PATCH 0182/1196] object: implement signing payload methods on HeadRequest message --- object/sign.go | 56 ++++++++++++++++++++++++++++++++++++++++----- object/sign_test.go | 16 +++++++++++++ 2 files changed, 66 insertions(+), 6 deletions(-) diff --git a/object/sign.go b/object/sign.go index 63687a5..6cece1b 100644 --- a/object/sign.go +++ b/object/sign.go @@ -54,10 +54,7 @@ func (m PutRequest) SignedDataSize() int { func (m GetRequest) SignedData() ([]byte, error) { addr := m.GetAddress() - return append( - addr.CID.Bytes(), - addr.ObjectID.Bytes()..., - ), nil + return addressBytes(addr), nil } // ReadSignedData copies marshaled Address field to passed buffer. @@ -66,7 +63,7 @@ func (m GetRequest) SignedData() ([]byte, error) { func (m GetRequest) ReadSignedData(p []byte) error { addr := m.GetAddress() - if len(p) < addr.CID.Size()+addr.ObjectID.Size() { + if len(p) < m.SignedDataSize() { return io.ErrUnexpectedEOF } @@ -79,7 +76,54 @@ func (m GetRequest) ReadSignedData(p []byte) error { // SignedDataSize returns the size of object address. func (m GetRequest) SignedDataSize() int { - addr := m.GetAddress() + return addressSize(m.GetAddress()) +} +// SignedData returns marshaled Address field. +// +// Resulting error is always nil. +func (m HeadRequest) SignedData() ([]byte, error) { + sz := addressSize(m.Address) + + data := make([]byte, sz+1) + + if m.GetFullHeaders() { + data[0] = 1 + } + + copy(data[1:], addressBytes(m.Address)) + + return data, nil +} + +// ReadSignedData copies marshaled Address field to passed buffer. +// +// If the buffer size is insufficient, io.ErrUnexpectedEOF returns. +func (m HeadRequest) ReadSignedData(p []byte) error { + if len(p) < m.SignedDataSize() { + return io.ErrUnexpectedEOF + } + + if m.GetFullHeaders() { + p[0] = 1 + } + + off := 1 + copy(p[1:], m.Address.CID.Bytes()) + + copy(p[off:], m.Address.ObjectID.Bytes()) + + return nil +} + +// SignedDataSize returns the size of object address. +func (m HeadRequest) SignedDataSize() int { + return addressSize(m.Address) + 1 +} + +func addressSize(addr Address) int { return addr.CID.Size() + addr.ObjectID.Size() } + +func addressBytes(addr Address) []byte { + return append(addr.CID.Bytes(), addr.ObjectID.Bytes()...) +} diff --git a/object/sign_test.go b/object/sign_test.go index 8cf5627..c5159c6 100644 --- a/object/sign_test.go +++ b/object/sign_test.go @@ -57,6 +57,22 @@ func TestSignVerifyRequests(t *testing.T) { }, }, }, + { // HeadRequest + constructor: func() sigType { + return new(HeadRequest) + }, + payloadCorrupt: []func(sigType){ + func(s sigType) { + s.(*HeadRequest).Address.CID[0]++ + }, + func(s sigType) { + s.(*HeadRequest).Address.ObjectID[0]++ + }, + func(s sigType) { + s.(*HeadRequest).FullHeaders = true + }, + }, + }, } for _, item := range items { From fc0da3c8fcb69e49a9e26cea3b482ff3102381d1 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 6 May 2020 14:15:07 +0300 Subject: [PATCH 0183/1196] object: implement signing payload methods on DeleteRequest message --- object/sign.go | 77 ++++++++++++++++++++++++++------------------- object/sign_test.go | 16 ++++++++++ 2 files changed, 60 insertions(+), 33 deletions(-) diff --git a/object/sign.go b/object/sign.go index 6cece1b..acb9901 100644 --- a/object/sign.go +++ b/object/sign.go @@ -4,27 +4,23 @@ import ( "io" ) -// SignedData returns marshaled payload of the Put request. +// SignedData returns payload bytes of the request. // // If payload is nil, ErrHeaderNotFound returns. func (m PutRequest) SignedData() ([]byte, error) { - r := m.GetR() - if r == nil { + sz := m.SignedDataSize() + if sz < 0 { return nil, ErrHeaderNotFound } - data := make([]byte, r.Size()) + data := make([]byte, sz) - if _, err := r.MarshalTo(data); err != nil { - return nil, err - } - - return data, nil + return data, m.ReadSignedData(data) } -// ReadSignedData copies marshaled payload of the Put request to passed buffer. +// ReadSignedData copies payload bytes to passed buffer. // -// If payload is nil, ErrHeaderNotFound returns. +// If the buffer size is insufficient, io.ErrUnexpectedEOF returns. func (m PutRequest) ReadSignedData(p []byte) error { r := m.GetR() if r == nil { @@ -48,16 +44,14 @@ func (m PutRequest) SignedDataSize() int { return r.Size() } -// SignedData returns marshaled Address field. -// -// Resulting error is always nil. +// SignedData returns payload bytes of the request. func (m GetRequest) SignedData() ([]byte, error) { - addr := m.GetAddress() + data := make([]byte, m.SignedDataSize()) - return addressBytes(addr), nil + return data, m.ReadSignedData(data) } -// ReadSignedData copies marshaled Address field to passed buffer. +// ReadSignedData copies payload bytes to passed buffer. // // If the buffer size is insufficient, io.ErrUnexpectedEOF returns. func (m GetRequest) ReadSignedData(p []byte) error { @@ -74,29 +68,19 @@ func (m GetRequest) ReadSignedData(p []byte) error { return nil } -// SignedDataSize returns the size of object address. +// SignedDataSize returns payload size of the request. func (m GetRequest) SignedDataSize() int { return addressSize(m.GetAddress()) } -// SignedData returns marshaled Address field. -// -// Resulting error is always nil. +// SignedData returns payload bytes of the request. func (m HeadRequest) SignedData() ([]byte, error) { - sz := addressSize(m.Address) + data := make([]byte, m.SignedDataSize()) - data := make([]byte, sz+1) - - if m.GetFullHeaders() { - data[0] = 1 - } - - copy(data[1:], addressBytes(m.Address)) - - return data, nil + return data, m.ReadSignedData(data) } -// ReadSignedData copies marshaled Address field to passed buffer. +// ReadSignedData copies payload bytes to passed buffer. // // If the buffer size is insufficient, io.ErrUnexpectedEOF returns. func (m HeadRequest) ReadSignedData(p []byte) error { @@ -115,11 +99,38 @@ func (m HeadRequest) ReadSignedData(p []byte) error { return nil } -// SignedDataSize returns the size of object address. +// SignedDataSize returns payload size of the request. func (m HeadRequest) SignedDataSize() int { return addressSize(m.Address) + 1 } +// SignedData returns payload bytes of the request. +func (m DeleteRequest) SignedData() ([]byte, error) { + data := make([]byte, m.SignedDataSize()) + + return data, m.ReadSignedData(data) +} + +// ReadSignedData copies payload bytes to passed buffer. +// +// If the buffer size is insufficient, io.ErrUnexpectedEOF returns. +func (m DeleteRequest) ReadSignedData(p []byte) error { + if len(p) < m.SignedDataSize() { + return io.ErrUnexpectedEOF + } + + off := copy(p, m.OwnerID.Bytes()) + + copy(p[off:], addressBytes(m.Address)) + + return nil +} + +// SignedDataSize returns payload size of the request. +func (m DeleteRequest) SignedDataSize() int { + return m.OwnerID.Size() + addressSize(m.Address) +} + func addressSize(addr Address) int { return addr.CID.Size() + addr.ObjectID.Size() } diff --git a/object/sign_test.go b/object/sign_test.go index c5159c6..d6357b9 100644 --- a/object/sign_test.go +++ b/object/sign_test.go @@ -73,6 +73,22 @@ func TestSignVerifyRequests(t *testing.T) { }, }, }, + { // DeleteRequest + constructor: func() sigType { + return new(DeleteRequest) + }, + payloadCorrupt: []func(sigType){ + func(s sigType) { + s.(*DeleteRequest).OwnerID[0]++ + }, + func(s sigType) { + s.(*DeleteRequest).Address.CID[0]++ + }, + func(s sigType) { + s.(*DeleteRequest).Address.ObjectID[0]++ + }, + }, + }, } for _, item := range items { From e784206032922a82fc5180d68d08e69572701406 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 6 May 2020 14:38:39 +0300 Subject: [PATCH 0184/1196] object: implement signing payload methods on GetRangeRequest message --- object/sign.go | 30 ++++++++++++++++++++++++++++++ object/sign_test.go | 19 +++++++++++++++++++ 2 files changed, 49 insertions(+) diff --git a/object/sign.go b/object/sign.go index acb9901..506fc95 100644 --- a/object/sign.go +++ b/object/sign.go @@ -131,6 +131,36 @@ func (m DeleteRequest) SignedDataSize() int { return m.OwnerID.Size() + addressSize(m.Address) } +// SignedData returns payload bytes of the request. +func (m GetRangeRequest) SignedData() ([]byte, error) { + data := make([]byte, m.SignedDataSize()) + + return data, m.ReadSignedData(data) +} + +// ReadSignedData copies payload bytes to passed buffer. +// +// If the buffer size is insufficient, io.ErrUnexpectedEOF returns. +func (m GetRangeRequest) ReadSignedData(p []byte) error { + if len(p) < m.SignedDataSize() { + return io.ErrUnexpectedEOF + } + + n, err := (&m.Range).MarshalTo(p) + if err != nil { + return err + } + + copy(p[n:], addressBytes(m.GetAddress())) + + return nil +} + +// SignedDataSize returns payload size of the request. +func (m GetRangeRequest) SignedDataSize() int { + return (&m.Range).Size() + addressSize(m.GetAddress()) +} + func addressSize(addr Address) int { return addr.CID.Size() + addr.ObjectID.Size() } diff --git a/object/sign_test.go b/object/sign_test.go index d6357b9..f8450ef 100644 --- a/object/sign_test.go +++ b/object/sign_test.go @@ -89,6 +89,25 @@ func TestSignVerifyRequests(t *testing.T) { }, }, }, + { // GetRangeRequest + constructor: func() sigType { + return new(GetRangeRequest) + }, + payloadCorrupt: []func(sigType){ + func(s sigType) { + s.(*GetRangeRequest).Range.Length++ + }, + func(s sigType) { + s.(*GetRangeRequest).Range.Offset++ + }, + func(s sigType) { + s.(*GetRangeRequest).Address.CID[0]++ + }, + func(s sigType) { + s.(*GetRangeRequest).Address.ObjectID[0]++ + }, + }, + }, } for _, item := range items { From 84671cd4aa49eaa0947a2774d8d1ac0857535806 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 6 May 2020 14:58:29 +0300 Subject: [PATCH 0185/1196] object: implement signing payload methods on GetRangeHashRequest message --- object/sign.go | 76 +++++++++++++++++++++++++++++++++++++++++++++ object/sign_test.go | 28 +++++++++++++++++ 2 files changed, 104 insertions(+) diff --git a/object/sign.go b/object/sign.go index 506fc95..3b97d62 100644 --- a/object/sign.go +++ b/object/sign.go @@ -1,6 +1,7 @@ package object import ( + "encoding/binary" "io" ) @@ -161,6 +162,81 @@ func (m GetRangeRequest) SignedDataSize() int { return (&m.Range).Size() + addressSize(m.GetAddress()) } +// SignedData returns payload bytes of the request. +func (m GetRangeHashRequest) SignedData() ([]byte, error) { + data := make([]byte, m.SignedDataSize()) + + return data, m.ReadSignedData(data) +} + +// ReadSignedData copies payload bytes to passed buffer. +// +// If the buffer size is insufficient, io.ErrUnexpectedEOF returns. +func (m GetRangeHashRequest) ReadSignedData(p []byte) error { + if len(p) < m.SignedDataSize() { + return io.ErrUnexpectedEOF + } + + var off int + + off += copy(p[off:], addressBytes(m.GetAddress())) + + off += copy(p[off:], sliceBytes(m.GetSalt())) + + copy(p[off:], rangeSetBytes(m.GetRanges())) + + return nil +} + +// SignedDataSize returns payload size of the request. +func (m GetRangeHashRequest) SignedDataSize() int { + var sz int + + sz += addressSize(m.GetAddress()) + + sz += rangeSetSize(m.GetRanges()) + + sz += sliceSize(m.GetSalt()) + + return sz +} + +func sliceSize(v []byte) int { + return 4 + len(v) +} + +func sliceBytes(v []byte) []byte { + data := make([]byte, sliceSize(v)) + + binary.BigEndian.PutUint32(data, uint32(len(v))) + + copy(data[4:], v) + + return data +} + +func rangeSetSize(rs []Range) int { + return 4 + len(rs)*16 // two uint64 fields +} + +func rangeSetBytes(rs []Range) []byte { + data := make([]byte, rangeSetSize(rs)) + + binary.BigEndian.PutUint32(data, uint32(len(rs))) + + off := 4 + + for i := range rs { + binary.BigEndian.PutUint64(data[off:], rs[i].Offset) + off += 8 + + binary.BigEndian.PutUint64(data[off:], rs[i].Length) + off += 8 + } + + return data +} + func addressSize(addr Address) int { return addr.CID.Size() + addr.ObjectID.Size() } diff --git a/object/sign_test.go b/object/sign_test.go index f8450ef..8b9a011 100644 --- a/object/sign_test.go +++ b/object/sign_test.go @@ -108,6 +108,34 @@ func TestSignVerifyRequests(t *testing.T) { }, }, }, + { // GetRangeHashRequest + constructor: func() sigType { + return &GetRangeHashRequest{ + Ranges: []Range{{}}, + Salt: []byte{1, 2, 3}, + } + }, + payloadCorrupt: []func(sigType){ + func(s sigType) { + s.(*GetRangeHashRequest).Address.CID[0]++ + }, + func(s sigType) { + s.(*GetRangeHashRequest).Address.ObjectID[0]++ + }, + func(s sigType) { + s.(*GetRangeHashRequest).Salt[0]++ + }, + func(s sigType) { + s.(*GetRangeHashRequest).Ranges[0].Length++ + }, + func(s sigType) { + s.(*GetRangeHashRequest).Ranges[0].Offset++ + }, + func(s sigType) { + s.(*GetRangeHashRequest).Ranges = nil + }, + }, + }, } for _, item := range items { From 4aac4d093de8b20a2f58acf9d982266c285ad29d Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 6 May 2020 15:09:31 +0300 Subject: [PATCH 0186/1196] object: implement signing payload methods on SearchRequest message --- object/sign.go | 46 +++++++++++++++++++++++++++++++++++---------- object/sign_test.go | 18 ++++++++++++++++++ 2 files changed, 54 insertions(+), 10 deletions(-) diff --git a/object/sign.go b/object/sign.go index 3b97d62..25d0b2f 100644 --- a/object/sign.go +++ b/object/sign.go @@ -181,9 +181,9 @@ func (m GetRangeHashRequest) ReadSignedData(p []byte) error { off += copy(p[off:], addressBytes(m.GetAddress())) - off += copy(p[off:], sliceBytes(m.GetSalt())) + off += copy(p[off:], rangeSetBytes(m.GetRanges())) - copy(p[off:], rangeSetBytes(m.GetRanges())) + off += copy(p[off:], m.GetSalt()) return nil } @@ -196,23 +196,49 @@ func (m GetRangeHashRequest) SignedDataSize() int { sz += rangeSetSize(m.GetRanges()) - sz += sliceSize(m.GetSalt()) + sz += len(m.GetSalt()) return sz } -func sliceSize(v []byte) int { - return 4 + len(v) +// SignedData returns payload bytes of the request. +func (m SearchRequest) SignedData() ([]byte, error) { + data := make([]byte, m.SignedDataSize()) + + return data, m.ReadSignedData(data) } -func sliceBytes(v []byte) []byte { - data := make([]byte, sliceSize(v)) +// ReadSignedData copies payload bytes to passed buffer. +// +// If the buffer size is insufficient, io.ErrUnexpectedEOF returns. +func (m SearchRequest) ReadSignedData(p []byte) error { + if len(p) < m.SignedDataSize() { + return io.ErrUnexpectedEOF + } - binary.BigEndian.PutUint32(data, uint32(len(v))) + var off int - copy(data[4:], v) + off += copy(p[off:], m.CID().Bytes()) - return data + binary.BigEndian.PutUint32(p[off:], m.GetQueryVersion()) + off += 4 + + copy(p[off:], m.GetQuery()) + + return nil +} + +// SignedDataSize returns payload size of the request. +func (m SearchRequest) SignedDataSize() int { + var sz int + + sz += m.CID().Size() + + sz += 4 // uint32 Version + + sz += len(m.GetQuery()) + + return sz } func rangeSetSize(rs []Range) int { diff --git a/object/sign_test.go b/object/sign_test.go index 8b9a011..4df1c2b 100644 --- a/object/sign_test.go +++ b/object/sign_test.go @@ -136,6 +136,24 @@ func TestSignVerifyRequests(t *testing.T) { }, }, }, + { // GetRangeHashRequest + constructor: func() sigType { + return &SearchRequest{ + Query: []byte{1, 2, 3}, + } + }, + payloadCorrupt: []func(sigType){ + func(s sigType) { + s.(*SearchRequest).ContainerID[0]++ + }, + func(s sigType) { + s.(*SearchRequest).Query[0]++ + }, + func(s sigType) { + s.(*SearchRequest).QueryVersion++ + }, + }, + }, } for _, item := range items { From 65d7c39e1a54d488f341eef33bab801d47c870f2 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 6 May 2020 15:32:13 +0300 Subject: [PATCH 0187/1196] service: fix comments --- service/meta.go | 2 +- service/types.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/service/meta.go b/service/meta.go index 3a945ac..3f01758 100644 --- a/service/meta.go +++ b/service/meta.go @@ -1,6 +1,6 @@ package service -// ResetMeta returns current value and sets RequestMetaHeader to empty value. +// CutMeta returns current value and sets RequestMetaHeader to empty value. func (m *RequestMetaHeader) CutMeta() RequestMetaHeader { cp := *m m.Reset() diff --git a/service/types.go b/service/types.go index 020cba0..c3148a0 100644 --- a/service/types.go +++ b/service/types.go @@ -22,7 +22,7 @@ type RawContainer interface { SetRaw(bool) } -// VersionContainer is an interface of the container of a numerical Version value with read access. +// VersionSource is an interface of the container of a numerical Version value with read access. type VersionSource interface { GetVersion() uint32 } From d8cc00b54cc6a148021e051362b212b7750d846c Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 8 May 2020 10:49:23 +0300 Subject: [PATCH 0188/1196] Update to neofs-api v0.7.4 --- Makefile | 2 +- docs/service.md | 16 +- docs/session.md | 25 +- service/verify.pb.go | 351 +++++++++++++++++++++------- service/verify.proto | 18 +- session/service.go | 10 - session/service.pb.go | 515 +++++++++++------------------------------- session/service.proto | 43 ++-- 8 files changed, 448 insertions(+), 532 deletions(-) diff --git a/Makefile b/Makefile index 62a92ec..b99682b 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -PROTO_VERSION=v0.7.3 +PROTO_VERSION=v0.7.4 PROTO_URL=https://github.com/nspcc-dev/neofs-api/archive/$(PROTO_VERSION).tar.gz B=\033[0;1m diff --git a/docs/service.md b/docs/service.md index eef1e49..9ed548e 100644 --- a/docs/service.md +++ b/docs/service.md @@ -17,6 +17,7 @@ - [RequestVerificationHeader.Signature](#service.RequestVerificationHeader.Signature) - [Token](#service.Token) - [Token.Info](#service.Token.Info) + - [TokenLifetime](#service.TokenLifetime) - [service/verify_test.proto](#service/verify_test.proto) @@ -129,10 +130,21 @@ User token granting rights for object manipulation | OwnerID | [bytes](#bytes) | | OwnerID is an owner of manipulation object | | verb | [Token.Info.Verb](#service.Token.Info.Verb) | | Verb is a type of request for which the token is issued | | Address | [refs.Address](#refs.Address) | | Address is an object address for which token is issued | -| Created | [uint64](#uint64) | | Created is an initial epoch of token lifetime | -| ValidUntil | [uint64](#uint64) | | ValidUntil is a last epoch of token lifetime | +| Lifetime | [TokenLifetime](#service.TokenLifetime) | | Lifetime is a lifetime of the session | | SessionKey | [bytes](#bytes) | | SessionKey is a public key of session key | + + + +### Message TokenLifetime +TokenLifetime carries a group of lifetime parameters of the token + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| Created | [uint64](#uint64) | | Created carries an initial epoch of token lifetime | +| ValidUntil | [uint64](#uint64) | | ValidUntil carries a last epoch of token lifetime | + diff --git a/docs/session.md b/docs/session.md index 4a537e6..5ec7402 100644 --- a/docs/session.md +++ b/docs/session.md @@ -30,22 +30,13 @@ ``` -rpc Create(stream CreateRequest) returns (stream CreateResponse); +rpc Create(CreateRequest) returns (CreateResponse); ``` #### Method Create -Create is a method that used to open a trusted session to manipulate -an object. In order to put or delete object client have to obtain session -token with trusted node. Trusted node will modify client's object -(add missing headers, checksums, homomorphic hash) and sign id with -session key. Session is established during 4-step handshake in one gRPC stream - -- First client stream message SHOULD BE type of `CreateRequest_Init`. -- First server stream message SHOULD BE type of `CreateResponse_Unsigned`. -- Second client stream message SHOULD BE type of `CreateRequest_Signed`. -- Second server stream message SHOULD BE type of `CreateResponse_Result`. +Create opens new session between the client and the server | Name | Input | Output | | ---- | ----- | ------ | @@ -56,13 +47,13 @@ session key. Session is established during 4-step handshake in one gRPC stream ### Message CreateRequest - +CreateRequest carries an information necessary for opening a session | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| Init | [service.Token](#service.Token) | | Init is a message to initialize session opening. Carry: owner of manipulation object; ID of manipulation object; token lifetime bounds. | -| Signed | [service.Token](#service.Token) | | Signed Init message response (Unsigned) from server with user private key | +| OwnerID | [bytes](#bytes) | | OwnerID carries an identifier of a session initiator | +| Lifetime | [service.TokenLifetime](#service.TokenLifetime) | | Lifetime carries a lifetime of the session | | Meta | [service.RequestMetaHeader](#service.RequestMetaHeader) | | RequestMetaHeader contains information about request meta headers (should be embedded into message) | | Verify | [service.RequestVerificationHeader](#service.RequestVerificationHeader) | | RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) | @@ -70,13 +61,13 @@ session key. Session is established during 4-step handshake in one gRPC stream ### Message CreateResponse - +CreateResponse carries an information about the opened session | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| Unsigned | [service.Token](#service.Token) | | Unsigned token with token ID and session public key generated on server side | -| Result | [service.Token](#service.Token) | | Result is a resulting token which can be used for object placing through an trusted intermediary | +| ID | [bytes](#bytes) | | ID carries an identifier of session token | +| SessionKey | [bytes](#bytes) | | SessionKey carries a session public key | diff --git a/service/verify.pb.go b/service/verify.pb.go index 023e639..3dadf0b 100644 --- a/service/verify.pb.go +++ b/service/verify.pb.go @@ -236,12 +236,10 @@ type Token_Info struct { Verb Token_Info_Verb `protobuf:"varint,3,opt,name=verb,proto3,enum=service.Token_Info_Verb" json:"verb,omitempty"` // Address is an object address for which token is issued Address Address `protobuf:"bytes,4,opt,name=Address,proto3,customtype=Address" json:"Address"` - // Created is an initial epoch of token lifetime - Created uint64 `protobuf:"varint,5,opt,name=Created,proto3" json:"Created,omitempty"` - // ValidUntil is a last epoch of token lifetime - ValidUntil uint64 `protobuf:"varint,6,opt,name=ValidUntil,proto3" json:"ValidUntil,omitempty"` + // Lifetime is a lifetime of the session + TokenLifetime `protobuf:"bytes,5,opt,name=Lifetime,proto3,embedded=Lifetime" json:"Lifetime"` // SessionKey is a public key of session key - SessionKey []byte `protobuf:"bytes,7,opt,name=SessionKey,proto3" json:"SessionKey,omitempty"` + SessionKey []byte `protobuf:"bytes,6,opt,name=SessionKey,proto3" json:"SessionKey,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -283,73 +281,116 @@ func (m *Token_Info) GetVerb() Token_Info_Verb { return Token_Info_Put } -func (m *Token_Info) GetCreated() uint64 { +func (m *Token_Info) GetSessionKey() []byte { + if m != nil { + return m.SessionKey + } + return nil +} + +// TokenLifetime carries a group of lifetime parameters of the token +type TokenLifetime struct { + // Created carries an initial epoch of token lifetime + Created uint64 `protobuf:"varint,1,opt,name=Created,proto3" json:"Created,omitempty"` + // ValidUntil carries a last epoch of token lifetime + ValidUntil uint64 `protobuf:"varint,2,opt,name=ValidUntil,proto3" json:"ValidUntil,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *TokenLifetime) Reset() { *m = TokenLifetime{} } +func (m *TokenLifetime) String() string { return proto.CompactTextString(m) } +func (*TokenLifetime) ProtoMessage() {} +func (*TokenLifetime) Descriptor() ([]byte, []int) { + return fileDescriptor_4bdd5bc50ec96238, []int{2} +} +func (m *TokenLifetime) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *TokenLifetime) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *TokenLifetime) XXX_Merge(src proto.Message) { + xxx_messageInfo_TokenLifetime.Merge(m, src) +} +func (m *TokenLifetime) XXX_Size() int { + return m.Size() +} +func (m *TokenLifetime) XXX_DiscardUnknown() { + xxx_messageInfo_TokenLifetime.DiscardUnknown(m) +} + +var xxx_messageInfo_TokenLifetime proto.InternalMessageInfo + +func (m *TokenLifetime) GetCreated() uint64 { if m != nil { return m.Created } return 0 } -func (m *Token_Info) GetValidUntil() uint64 { +func (m *TokenLifetime) GetValidUntil() uint64 { if m != nil { return m.ValidUntil } return 0 } -func (m *Token_Info) GetSessionKey() []byte { - if m != nil { - return m.SessionKey - } - return nil -} - func init() { proto.RegisterEnum("service.Token_Info_Verb", Token_Info_Verb_name, Token_Info_Verb_value) proto.RegisterType((*RequestVerificationHeader)(nil), "service.RequestVerificationHeader") proto.RegisterType((*RequestVerificationHeader_Signature)(nil), "service.RequestVerificationHeader.Signature") proto.RegisterType((*Token)(nil), "service.Token") proto.RegisterType((*Token_Info)(nil), "service.Token.Info") + proto.RegisterType((*TokenLifetime)(nil), "service.TokenLifetime") } func init() { proto.RegisterFile("service/verify.proto", fileDescriptor_4bdd5bc50ec96238) } var fileDescriptor_4bdd5bc50ec96238 = []byte{ - // 541 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x92, 0x4d, 0x8e, 0xd3, 0x4c, - 0x10, 0x86, 0xa7, 0x1d, 0x27, 0x4e, 0x6a, 0x7e, 0x3e, 0x7f, 0x0d, 0x0b, 0x13, 0x21, 0x27, 0x8a, - 0x58, 0x64, 0x24, 0x62, 0x4b, 0x19, 0x09, 0x21, 0xb1, 0x9a, 0x10, 0xc1, 0x44, 0x20, 0x88, 0xda, - 0x43, 0x16, 0xec, 0x1c, 0xbb, 0xe2, 0x58, 0x04, 0x77, 0xe8, 0x76, 0x82, 0x72, 0x13, 0xce, 0xc0, - 0x39, 0x58, 0xcc, 0x72, 0x96, 0xc0, 0x22, 0x42, 0xe1, 0x0a, 0x1c, 0x00, 0xb9, 0xed, 0xfc, 0x20, - 0xc1, 0xee, 0xad, 0xa7, 0xaa, 0xde, 0xaa, 0x6e, 0x15, 0xdc, 0x95, 0x28, 0x96, 0x71, 0x80, 0xee, - 0x12, 0x45, 0x3c, 0x59, 0x39, 0x73, 0xc1, 0x53, 0x4e, 0x8d, 0x82, 0xd6, 0x4d, 0x81, 0x13, 0xe9, - 0xa6, 0xab, 0x39, 0xca, 0x3c, 0x55, 0xef, 0x44, 0x71, 0x3a, 0x5d, 0x8c, 0x9d, 0x80, 0xbf, 0x77, - 0x23, 0x1e, 0x71, 0x57, 0xe1, 0xf1, 0x62, 0xa2, 0x22, 0x15, 0x28, 0x95, 0x97, 0xb7, 0xbe, 0x10, - 0xb8, 0xc7, 0xf0, 0xc3, 0x02, 0x65, 0x3a, 0xca, 0x26, 0xc4, 0x81, 0x9f, 0xc6, 0x3c, 0xb9, 0x42, - 0x3f, 0x44, 0x41, 0x5f, 0x02, 0x78, 0x71, 0x94, 0xf8, 0xe9, 0x42, 0xa0, 0xb4, 0x48, 0xb3, 0xd4, - 0x3e, 0xee, 0x3e, 0x74, 0x8a, 0xe1, 0xce, 0x3f, 0xfb, 0x9c, 0x5d, 0x13, 0x3b, 0xe8, 0xa7, 0x0f, - 0xa0, 0x7c, 0xcd, 0xdf, 0x61, 0x62, 0x69, 0x4d, 0xd2, 0x3e, 0xee, 0x9e, 0xed, 0x8c, 0x14, 0x65, - 0x79, 0xb2, 0x7e, 0x01, 0xb5, 0x5d, 0x0f, 0xa5, 0xa0, 0x67, 0x81, 0x45, 0x9a, 0xa4, 0x7d, 0xc2, - 0x94, 0xce, 0xd8, 0x10, 0x51, 0x28, 0x97, 0x13, 0xa6, 0x74, 0xeb, 0x5b, 0xa9, 0xf0, 0xa6, 0x4f, - 0xa0, 0xa6, 0xc4, 0x20, 0x99, 0x70, 0xd5, 0x76, 0xdc, 0xbd, 0xf3, 0xe7, 0x20, 0x27, 0x4b, 0xf5, - 0xaa, 0x37, 0xeb, 0xc6, 0xd1, 0xed, 0xba, 0x41, 0xd8, 0xbe, 0x9e, 0xde, 0x3f, 0x98, 0x6d, 0x55, - 0x95, 0xff, 0x1e, 0xd4, 0x7f, 0x69, 0xa0, 0xab, 0xb2, 0x06, 0x68, 0x83, 0x7e, 0xbe, 0x53, 0xef, - 0xbf, 0xcc, 0xe7, 0xfb, 0xba, 0x61, 0xe4, 0x2e, 0x7d, 0xa6, 0x0d, 0xfa, 0xf4, 0x1c, 0x8c, 0xd7, - 0x1f, 0x13, 0x14, 0x83, 0x7e, 0xbe, 0xe5, 0xbe, 0xaa, 0xc0, 0x6c, 0x2b, 0xe8, 0x23, 0xd0, 0x97, - 0x28, 0xc6, 0x56, 0xa9, 0x49, 0xda, 0x67, 0x5d, 0xeb, 0x2f, 0xab, 0x3a, 0x23, 0x14, 0xe3, 0x5e, - 0x75, 0xb3, 0x6e, 0xe8, 0x99, 0x62, 0xaa, 0x9e, 0x3e, 0x06, 0xe3, 0x32, 0x0c, 0x05, 0x4a, 0x69, - 0xe9, 0xea, 0x95, 0xa7, 0x4e, 0x76, 0x0b, 0x4e, 0x01, 0xf7, 0x13, 0x0b, 0xc0, 0xb6, 0x82, 0x5a, - 0x60, 0x3c, 0x15, 0xe8, 0xa7, 0x18, 0x5a, 0xe5, 0x26, 0x69, 0xeb, 0x6c, 0x1b, 0x52, 0x1b, 0x60, - 0xe4, 0xcf, 0xe2, 0xf0, 0x4d, 0x92, 0xc6, 0x33, 0xab, 0xa2, 0x92, 0x07, 0x24, 0xcb, 0x7b, 0x28, - 0x65, 0xcc, 0x93, 0x17, 0xb8, 0xb2, 0x0c, 0xf5, 0x3f, 0x07, 0xa4, 0x75, 0x0d, 0x6a, 0x43, 0x6a, - 0x40, 0x69, 0xb8, 0x48, 0xcd, 0xa3, 0x4c, 0x3c, 0xc7, 0xd4, 0x24, 0xb4, 0x0a, 0x7a, 0x76, 0x1a, - 0xa6, 0x46, 0x01, 0x2a, 0x1e, 0xfa, 0x22, 0x98, 0x9a, 0xa5, 0x4c, 0xf7, 0x71, 0x86, 0x29, 0x9a, - 0x3a, 0xad, 0x41, 0x99, 0xf9, 0x49, 0x84, 0x66, 0x99, 0x9e, 0x42, 0x4d, 0xc9, 0x2b, 0x5f, 0x4e, - 0xcd, 0x4a, 0xcf, 0xbb, 0xd9, 0xd8, 0xe4, 0x76, 0x63, 0x93, 0xaf, 0x1b, 0x9b, 0xfc, 0xd8, 0xd8, - 0xe4, 0xd3, 0x4f, 0xfb, 0xe8, 0xed, 0xf9, 0xc1, 0x9d, 0x27, 0x72, 0x1e, 0x04, 0x9d, 0x10, 0x97, - 0x6e, 0x82, 0x7c, 0x22, 0x3b, 0xfe, 0x3c, 0xee, 0x44, 0xdc, 0x2d, 0xbe, 0xf2, 0xb3, 0xf6, 0xff, - 0x2b, 0xe4, 0xcf, 0x3c, 0xe7, 0x72, 0x38, 0x70, 0xbc, 0x9c, 0x8d, 0x2b, 0xea, 0xfc, 0x2f, 0x7e, - 0x07, 0x00, 0x00, 0xff, 0xff, 0xea, 0xcf, 0xa5, 0xdd, 0x60, 0x03, 0x00, 0x00, + // 567 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x53, 0x4d, 0x6f, 0xd3, 0x40, + 0x10, 0xed, 0x26, 0xce, 0xd7, 0xf4, 0x03, 0xb3, 0x20, 0x64, 0x22, 0x94, 0x44, 0x11, 0x87, 0x54, + 0x22, 0x8e, 0x94, 0x4a, 0x08, 0x09, 0x2e, 0x0d, 0x11, 0x34, 0xa2, 0x82, 0x6a, 0x53, 0x7a, 0xe0, + 0xe6, 0xd8, 0x63, 0x77, 0x45, 0xeb, 0x0d, 0xbb, 0x9b, 0xa0, 0xfe, 0x13, 0x7e, 0x03, 0xbf, 0x83, + 0x43, 0x8f, 0x3d, 0x22, 0x24, 0x22, 0x14, 0xfe, 0x04, 0x47, 0xe4, 0xb5, 0x93, 0xb8, 0x12, 0xdc, + 0xde, 0xbc, 0x99, 0x37, 0xef, 0x65, 0xe2, 0x85, 0xfb, 0x0a, 0xe5, 0x9c, 0xfb, 0xd8, 0x9b, 0xa3, + 0xe4, 0xe1, 0x95, 0x3b, 0x95, 0x42, 0x0b, 0x5a, 0xc9, 0xd8, 0xba, 0x2d, 0x31, 0x54, 0x3d, 0x7d, + 0x35, 0x45, 0x95, 0xb6, 0xea, 0xdd, 0x88, 0xeb, 0xf3, 0xd9, 0xc4, 0xf5, 0xc5, 0x65, 0x2f, 0x12, + 0x91, 0xe8, 0x19, 0x7a, 0x32, 0x0b, 0x4d, 0x65, 0x0a, 0x83, 0xd2, 0xf1, 0xf6, 0x37, 0x02, 0x0f, + 0x19, 0x7e, 0x9a, 0xa1, 0xd2, 0x67, 0x89, 0x03, 0xf7, 0x3d, 0xcd, 0x45, 0x7c, 0x84, 0x5e, 0x80, + 0x92, 0x1e, 0x03, 0x8c, 0x79, 0x14, 0x7b, 0x7a, 0x26, 0x51, 0x39, 0xa4, 0x55, 0xec, 0x6c, 0xf7, + 0x9f, 0xb8, 0x99, 0xb9, 0xfb, 0x5f, 0x9d, 0xbb, 0x16, 0xb1, 0x9c, 0x9e, 0x3e, 0x86, 0xd2, 0xa9, + 0xf8, 0x88, 0xb1, 0x53, 0x68, 0x91, 0xce, 0x76, 0x7f, 0x6f, 0xbd, 0xc8, 0xb0, 0x2c, 0x6d, 0xd6, + 0x0f, 0xa0, 0xb6, 0xd6, 0x50, 0x0a, 0x56, 0x52, 0x38, 0xa4, 0x45, 0x3a, 0x3b, 0xcc, 0xe0, 0x84, + 0x3b, 0x41, 0x94, 0x66, 0xcb, 0x0e, 0x33, 0xb8, 0xfd, 0xb3, 0x98, 0xed, 0xa6, 0xcf, 0xa1, 0x66, + 0xc0, 0x28, 0x0e, 0x85, 0x91, 0x6d, 0xf7, 0xef, 0xdd, 0x36, 0x72, 0x93, 0xd6, 0xa0, 0x7a, 0xbd, + 0x68, 0x6e, 0xdd, 0x2c, 0x9a, 0x84, 0x6d, 0xe6, 0xe9, 0xa3, 0x9c, 0xb7, 0x53, 0x35, 0xfb, 0x37, + 0x44, 0xfd, 0x4f, 0x01, 0x2c, 0x33, 0xd6, 0x84, 0xc2, 0x68, 0x98, 0x66, 0x1a, 0xdc, 0x49, 0xf6, + 0xfc, 0x58, 0x34, 0x2b, 0xe9, 0x96, 0x21, 0x2b, 0x8c, 0x86, 0x74, 0x1f, 0x2a, 0xef, 0x3e, 0xc7, + 0x28, 0x47, 0xc3, 0x34, 0xe5, 0x66, 0x2a, 0xa3, 0xd9, 0x0a, 0xd0, 0xa7, 0x60, 0xcd, 0x51, 0x4e, + 0x9c, 0x62, 0x8b, 0x74, 0xf6, 0xfa, 0xce, 0x3f, 0xa2, 0xba, 0x67, 0x28, 0x27, 0x83, 0xea, 0x72, + 0xd1, 0xb4, 0x12, 0xc4, 0xcc, 0x3c, 0x7d, 0x06, 0x95, 0xc3, 0x20, 0x90, 0xa8, 0x94, 0x63, 0x99, + 0x5f, 0xb9, 0xeb, 0x26, 0xdf, 0x82, 0x9b, 0x91, 0x1b, 0xc7, 0x8c, 0x60, 0x2b, 0x40, 0x5f, 0x40, + 0xf5, 0x98, 0x87, 0xa8, 0xf9, 0x25, 0x3a, 0x25, 0x23, 0x7d, 0x70, 0xdb, 0x75, 0xd5, 0xcd, 0xdd, + 0x68, 0xad, 0xa0, 0x0d, 0x80, 0x31, 0x2a, 0xc5, 0x45, 0xfc, 0x06, 0xaf, 0x9c, 0xb2, 0xb9, 0x51, + 0x8e, 0x69, 0x9f, 0x82, 0x49, 0x49, 0x2b, 0x50, 0x3c, 0x99, 0x69, 0x7b, 0x2b, 0x01, 0xaf, 0x51, + 0xdb, 0x84, 0x56, 0xc1, 0x4a, 0x3e, 0x0f, 0xbb, 0x40, 0x01, 0xca, 0x63, 0xf4, 0xa4, 0x7f, 0x6e, + 0x17, 0x13, 0x3c, 0xc4, 0x0b, 0xd4, 0x68, 0x5b, 0xb4, 0x06, 0x25, 0xe6, 0xc5, 0x11, 0xda, 0x25, + 0xba, 0x0b, 0x35, 0x03, 0x8f, 0x3c, 0x75, 0x6e, 0x97, 0xdb, 0x23, 0xd8, 0xbd, 0x15, 0x8d, 0x3a, + 0x50, 0x79, 0x29, 0xd1, 0xd3, 0x18, 0x98, 0xff, 0xc1, 0x62, 0xab, 0x32, 0x09, 0x78, 0xe6, 0x5d, + 0xf0, 0xe0, 0x7d, 0xac, 0xf9, 0x85, 0x39, 0xbf, 0xc5, 0x72, 0xcc, 0x60, 0x7c, 0xbd, 0x6c, 0x90, + 0x9b, 0x65, 0x83, 0x7c, 0x5f, 0x36, 0xc8, 0xaf, 0x65, 0x83, 0x7c, 0xf9, 0xdd, 0xd8, 0xfa, 0xb0, + 0x9f, 0x7b, 0x36, 0xb1, 0x9a, 0xfa, 0x7e, 0x37, 0xc0, 0x79, 0x2f, 0x46, 0x11, 0xaa, 0xae, 0x37, + 0xe5, 0xdd, 0x48, 0xf4, 0xb2, 0x1b, 0x7d, 0x2d, 0xdc, 0x7d, 0x8b, 0xe2, 0xd5, 0xd8, 0x3d, 0x3c, + 0x19, 0xb9, 0xe3, 0x94, 0x9b, 0x94, 0xcd, 0x6b, 0x3a, 0xf8, 0x1b, 0x00, 0x00, 0xff, 0xff, 0x13, + 0xf0, 0xba, 0xcc, 0xaf, 0x03, 0x00, 0x00, } func (m *RequestVerificationHeader) Marshal() (dAtA []byte, err error) { @@ -519,18 +560,18 @@ func (m *Token_Info) MarshalToSizedBuffer(dAtA []byte) (int, error) { copy(dAtA[i:], m.SessionKey) i = encodeVarintVerify(dAtA, i, uint64(len(m.SessionKey))) i-- - dAtA[i] = 0x3a + dAtA[i] = 0x32 } - if m.ValidUntil != 0 { - i = encodeVarintVerify(dAtA, i, uint64(m.ValidUntil)) - i-- - dAtA[i] = 0x30 - } - if m.Created != 0 { - i = encodeVarintVerify(dAtA, i, uint64(m.Created)) - i-- - dAtA[i] = 0x28 + { + size, err := m.TokenLifetime.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintVerify(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x2a { size := m.Address.Size() i -= size @@ -569,6 +610,43 @@ func (m *Token_Info) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *TokenLifetime) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *TokenLifetime) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TokenLifetime) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.ValidUntil != 0 { + i = encodeVarintVerify(dAtA, i, uint64(m.ValidUntil)) + i-- + dAtA[i] = 0x10 + } + if m.Created != 0 { + i = encodeVarintVerify(dAtA, i, uint64(m.Created)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + func encodeVarintVerify(dAtA []byte, offset int, v uint64) int { offset -= sovVerify(v) base := offset @@ -655,16 +733,30 @@ func (m *Token_Info) Size() (n int) { } l = m.Address.Size() n += 1 + l + sovVerify(uint64(l)) + l = m.TokenLifetime.Size() + n += 1 + l + sovVerify(uint64(l)) + l = len(m.SessionKey) + if l > 0 { + n += 1 + l + sovVerify(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *TokenLifetime) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l if m.Created != 0 { n += 1 + sovVerify(uint64(m.Created)) } if m.ValidUntil != 0 { n += 1 + sovVerify(uint64(m.ValidUntil)) } - l = len(m.SessionKey) - if l > 0 { - n += 1 + l + sovVerify(uint64(l)) - } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -1192,10 +1284,10 @@ func (m *Token_Info) Unmarshal(dAtA []byte) error { } iNdEx = postIndex case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Created", wireType) + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TokenLifetime", wireType) } - m.Created = 0 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowVerify @@ -1205,31 +1297,26 @@ func (m *Token_Info) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Created |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } + if msglen < 0 { + return ErrInvalidLengthVerify + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthVerify + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.TokenLifetime.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex case 6: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ValidUntil", wireType) - } - m.ValidUntil = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowVerify - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ValidUntil |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 7: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field SessionKey", wireType) } @@ -1288,6 +1375,98 @@ func (m *Token_Info) Unmarshal(dAtA []byte) error { } return nil } +func (m *TokenLifetime) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVerify + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: TokenLifetime: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TokenLifetime: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Created", wireType) + } + m.Created = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVerify + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Created |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidUntil", wireType) + } + m.ValidUntil = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVerify + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ValidUntil |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipVerify(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthVerify + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthVerify + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipVerify(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/service/verify.proto b/service/verify.proto index b25cd47..ed360be 100644 --- a/service/verify.proto +++ b/service/verify.proto @@ -58,14 +58,11 @@ message Token { // Address is an object address for which token is issued refs.Address Address = 4 [(gogoproto.nullable) = false, (gogoproto.customtype) = "Address"]; - // Created is an initial epoch of token lifetime - uint64 Created = 5; - - // ValidUntil is a last epoch of token lifetime - uint64 ValidUntil = 6; + // Lifetime is a lifetime of the session + TokenLifetime Lifetime = 5 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; // SessionKey is a public key of session key - bytes SessionKey = 7; + bytes SessionKey = 6; } // TokenInfo is a grouped information about token @@ -75,6 +72,15 @@ message Token { bytes Signature = 8; } +// TokenLifetime carries a group of lifetime parameters of the token +message TokenLifetime { + // Created carries an initial epoch of token lifetime + uint64 Created = 1; + + // ValidUntil carries a last epoch of token lifetime + uint64 ValidUntil = 2; +} + // TODO: for variable token types and version redefine message // Example: // message Token { diff --git a/session/service.go b/session/service.go index 6e293d3..ab87616 100644 --- a/session/service.go +++ b/session/service.go @@ -1,11 +1 @@ package session - -// NewInitRequest returns new initialization CreateRequest from passed Token. -func NewInitRequest(t *Token) *CreateRequest { - return &CreateRequest{Message: &CreateRequest_Init{Init: t}} -} - -// NewSignedRequest returns new signed CreateRequest from passed Token. -func NewSignedRequest(t *Token) *CreateRequest { - return &CreateRequest{Message: &CreateRequest_Signed{Signed: t}} -} diff --git a/session/service.pb.go b/session/service.pb.go index 1088308..e68c0fd 100644 --- a/session/service.pb.go +++ b/session/service.pb.go @@ -28,13 +28,12 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +// CreateRequest carries an information necessary for opening a session type CreateRequest struct { - // Message should be one of - // - // Types that are valid to be assigned to Message: - // *CreateRequest_Init - // *CreateRequest_Signed - Message isCreateRequest_Message `protobuf_oneof:"Message"` + // OwnerID carries an identifier of a session initiator + OwnerID OwnerID `protobuf:"bytes,1,opt,name=OwnerID,proto3,customtype=OwnerID" json:"OwnerID"` + // Lifetime carries a lifetime of the session + service.TokenLifetime `protobuf:"bytes,2,opt,name=Lifetime,proto3,embedded=Lifetime" json:"Lifetime"` // RequestMetaHeader contains information about request meta headers (should be embedded into message) service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) @@ -73,59 +72,15 @@ func (m *CreateRequest) XXX_DiscardUnknown() { var xxx_messageInfo_CreateRequest proto.InternalMessageInfo -type isCreateRequest_Message interface { - isCreateRequest_Message() - MarshalTo([]byte) (int, error) - Size() int -} - -type CreateRequest_Init struct { - Init *service.Token `protobuf:"bytes,1,opt,name=Init,proto3,oneof" json:"Init,omitempty"` -} -type CreateRequest_Signed struct { - Signed *service.Token `protobuf:"bytes,2,opt,name=Signed,proto3,oneof" json:"Signed,omitempty"` -} - -func (*CreateRequest_Init) isCreateRequest_Message() {} -func (*CreateRequest_Signed) isCreateRequest_Message() {} - -func (m *CreateRequest) GetMessage() isCreateRequest_Message { - if m != nil { - return m.Message - } - return nil -} - -func (m *CreateRequest) GetInit() *service.Token { - if x, ok := m.GetMessage().(*CreateRequest_Init); ok { - return x.Init - } - return nil -} - -func (m *CreateRequest) GetSigned() *service.Token { - if x, ok := m.GetMessage().(*CreateRequest_Signed); ok { - return x.Signed - } - return nil -} - -// XXX_OneofWrappers is for the internal use of the proto package. -func (*CreateRequest) XXX_OneofWrappers() []interface{} { - return []interface{}{ - (*CreateRequest_Init)(nil), - (*CreateRequest_Signed)(nil), - } -} - +// CreateResponse carries an information about the opened session type CreateResponse struct { - // Types that are valid to be assigned to Message: - // *CreateResponse_Unsigned - // *CreateResponse_Result - Message isCreateResponse_Message `protobuf_oneof:"Message"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + // ID carries an identifier of session token + ID TokenID `protobuf:"bytes,1,opt,name=ID,proto3,customtype=TokenID" json:"ID"` + // SessionKey carries a session public key + SessionKey []byte `protobuf:"bytes,2,opt,name=SessionKey,proto3" json:"SessionKey,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *CreateResponse) Reset() { *m = CreateResponse{} } @@ -157,51 +112,13 @@ func (m *CreateResponse) XXX_DiscardUnknown() { var xxx_messageInfo_CreateResponse proto.InternalMessageInfo -type isCreateResponse_Message interface { - isCreateResponse_Message() - MarshalTo([]byte) (int, error) - Size() int -} - -type CreateResponse_Unsigned struct { - Unsigned *service.Token `protobuf:"bytes,1,opt,name=Unsigned,proto3,oneof" json:"Unsigned,omitempty"` -} -type CreateResponse_Result struct { - Result *service.Token `protobuf:"bytes,2,opt,name=Result,proto3,oneof" json:"Result,omitempty"` -} - -func (*CreateResponse_Unsigned) isCreateResponse_Message() {} -func (*CreateResponse_Result) isCreateResponse_Message() {} - -func (m *CreateResponse) GetMessage() isCreateResponse_Message { +func (m *CreateResponse) GetSessionKey() []byte { if m != nil { - return m.Message + return m.SessionKey } return nil } -func (m *CreateResponse) GetUnsigned() *service.Token { - if x, ok := m.GetMessage().(*CreateResponse_Unsigned); ok { - return x.Unsigned - } - return nil -} - -func (m *CreateResponse) GetResult() *service.Token { - if x, ok := m.GetMessage().(*CreateResponse_Result); ok { - return x.Result - } - return nil -} - -// XXX_OneofWrappers is for the internal use of the proto package. -func (*CreateResponse) XXX_OneofWrappers() []interface{} { - return []interface{}{ - (*CreateResponse_Unsigned)(nil), - (*CreateResponse_Result)(nil), - } -} - func init() { proto.RegisterType((*CreateRequest)(nil), "session.CreateRequest") proto.RegisterType((*CreateResponse)(nil), "session.CreateResponse") @@ -210,31 +127,32 @@ func init() { func init() { proto.RegisterFile("session/service.proto", fileDescriptor_b329bee0fd1148e0) } var fileDescriptor_b329bee0fd1148e0 = []byte{ - // 380 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x52, 0x4f, 0x4f, 0xe2, 0x40, - 0x14, 0x67, 0x08, 0x29, 0xec, 0x6c, 0x96, 0x64, 0x27, 0xfb, 0xa7, 0xe9, 0xa1, 0x6c, 0xc8, 0x1e, - 0xd8, 0x64, 0xdb, 0x1a, 0xbc, 0x78, 0xf1, 0x20, 0x1a, 0x03, 0x07, 0x8c, 0x69, 0xd5, 0x83, 0xb7, - 0xb6, 0x3c, 0xea, 0x44, 0x99, 0xa9, 0x9d, 0x29, 0x89, 0xdf, 0xc4, 0xcf, 0xe0, 0x27, 0xe1, 0xc8, - 0xd1, 0x13, 0x31, 0xf5, 0xe6, 0xa7, 0x30, 0x4c, 0x07, 0x82, 0x12, 0x6e, 0x7d, 0xbf, 0x3f, 0xef, - 0xbd, 0x5f, 0xdf, 0xe0, 0x9f, 0x02, 0x84, 0xa0, 0x9c, 0x79, 0x02, 0xb2, 0x29, 0x8d, 0xc1, 0x4d, - 0x33, 0x2e, 0x39, 0xa9, 0x6b, 0xd8, 0x22, 0x1a, 0xf7, 0x26, 0x20, 0xc3, 0x92, 0xb4, 0x7e, 0xac, - 0xb0, 0x29, 0x64, 0x74, 0xfc, 0xa0, 0x51, 0x27, 0xa1, 0xf2, 0x26, 0x8f, 0xdc, 0x98, 0x4f, 0xbc, - 0x84, 0x27, 0xdc, 0x53, 0x70, 0x94, 0x8f, 0x55, 0xa5, 0x0a, 0xf5, 0x55, 0xca, 0xdb, 0x6f, 0x08, - 0x7f, 0x3b, 0xce, 0x20, 0x94, 0xe0, 0xc3, 0x7d, 0x0e, 0x42, 0x92, 0xbf, 0xb8, 0x36, 0x60, 0x54, - 0x9a, 0xe8, 0x0f, 0xea, 0x7c, 0xed, 0x36, 0xdd, 0xd5, 0x46, 0x17, 0xfc, 0x16, 0x58, 0xbf, 0xe2, - 0x2b, 0x96, 0x74, 0xb0, 0x11, 0xd0, 0x84, 0xc1, 0xc8, 0xac, 0xee, 0xd0, 0x69, 0x9e, 0x1c, 0xe0, - 0xda, 0x10, 0x64, 0x68, 0x46, 0x4a, 0x67, 0xad, 0x75, 0x7a, 0xde, 0x92, 0xeb, 0x43, 0x38, 0x82, - 0xac, 0xd7, 0x98, 0x2d, 0x5a, 0x95, 0xf9, 0xa2, 0x85, 0x7c, 0xe5, 0x20, 0x27, 0xd8, 0xb8, 0x52, - 0xd1, 0xcc, 0x58, 0x79, 0xdb, 0x9f, 0xbd, 0x8a, 0xa5, 0x71, 0x28, 0x29, 0x67, 0x5b, 0x3d, 0xb4, - 0xb7, 0xf7, 0x05, 0xd7, 0x87, 0x20, 0x44, 0x98, 0x40, 0x5b, 0xe0, 0xe6, 0x2a, 0xab, 0x48, 0x39, - 0x13, 0x40, 0xfe, 0xe3, 0xc6, 0x25, 0x13, 0x65, 0x90, 0x5d, 0x81, 0xd7, 0x8a, 0x65, 0x68, 0x1f, - 0x44, 0x7e, 0x27, 0x77, 0x87, 0x2e, 0xf9, 0x8d, 0xa1, 0xdd, 0x3e, 0xae, 0x07, 0xe5, 0x15, 0xc9, - 0x21, 0x36, 0xca, 0xf9, 0xe4, 0x97, 0xab, 0x2f, 0xeb, 0x7e, 0xf8, 0xf9, 0xd6, 0xef, 0x2d, 0xbc, - 0x5c, 0xb4, 0x83, 0xf6, 0x50, 0x2f, 0x98, 0x15, 0x36, 0x9a, 0x17, 0x36, 0x7a, 0x2e, 0x6c, 0xf4, - 0x52, 0xd8, 0xe8, 0xf1, 0xd5, 0xae, 0x5c, 0xff, 0xdb, 0x38, 0x38, 0x13, 0x69, 0x1c, 0x3b, 0x23, - 0x98, 0x7a, 0x0c, 0xf8, 0x58, 0x38, 0x61, 0x4a, 0x9d, 0x84, 0x7b, 0xba, 0xe7, 0x53, 0xf5, 0xfb, - 0x19, 0xf0, 0xd3, 0xc0, 0x3d, 0x3a, 0x1f, 0xb8, 0x7a, 0xa7, 0xc8, 0x50, 0xef, 0x60, 0xff, 0x3d, - 0x00, 0x00, 0xff, 0xff, 0x70, 0x53, 0x71, 0xf3, 0x82, 0x02, 0x00, 0x00, + // 386 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x91, 0xcf, 0x6e, 0xda, 0x40, + 0x10, 0xc6, 0x59, 0xab, 0x02, 0xb4, 0xa5, 0xad, 0xba, 0xea, 0x1f, 0xcb, 0x07, 0x1b, 0x71, 0x82, + 0x83, 0x6d, 0x89, 0x5e, 0x5a, 0xa9, 0x97, 0x52, 0xab, 0xaa, 0xd5, 0xe6, 0x9f, 0x89, 0x72, 0xc8, + 0xcd, 0x36, 0x63, 0x67, 0x15, 0xe1, 0x75, 0xbc, 0x0b, 0x11, 0x6f, 0x92, 0x67, 0xc8, 0x93, 0x70, + 0xe4, 0x18, 0xe5, 0x80, 0x22, 0xe7, 0x25, 0x72, 0x8c, 0x58, 0xaf, 0x11, 0x09, 0xb7, 0x9d, 0xdf, + 0xec, 0xf7, 0x69, 0xbe, 0x19, 0xfc, 0x99, 0x03, 0xe7, 0x94, 0x65, 0x2e, 0x87, 0x62, 0x4e, 0x63, + 0x70, 0xf2, 0x82, 0x09, 0x46, 0x5a, 0x0a, 0x1b, 0x44, 0x71, 0x77, 0x0a, 0x22, 0xac, 0x9a, 0xc6, + 0xa7, 0x9a, 0xcd, 0xa1, 0xa0, 0xc9, 0x42, 0x51, 0x3b, 0xa5, 0xe2, 0x62, 0x16, 0x39, 0x31, 0x9b, + 0xba, 0x29, 0x4b, 0x99, 0x2b, 0x71, 0x34, 0x4b, 0x64, 0x25, 0x0b, 0xf9, 0xaa, 0xbe, 0xf7, 0x9e, + 0x10, 0x7e, 0xf7, 0xbb, 0x80, 0x50, 0x40, 0x00, 0x57, 0x33, 0xe0, 0x82, 0x0c, 0x70, 0xeb, 0xe8, + 0x3a, 0x83, 0xc2, 0xf7, 0x74, 0xd4, 0x45, 0xfd, 0xce, 0xe8, 0xc3, 0x72, 0x6d, 0x35, 0xee, 0xd7, + 0x56, 0x8d, 0x83, 0xfa, 0x41, 0x7e, 0xe2, 0xf6, 0x7f, 0x9a, 0x80, 0xa0, 0x53, 0xd0, 0xb5, 0x2e, + 0xea, 0xbf, 0x1d, 0x7e, 0x71, 0xea, 0x00, 0xa7, 0xec, 0x12, 0xb2, 0xba, 0x3b, 0x6a, 0x6f, 0x3c, + 0x56, 0x6b, 0x0b, 0x05, 0x5b, 0x05, 0xf9, 0x8e, 0xdf, 0x1c, 0x80, 0x08, 0xf5, 0x48, 0x2a, 0x8d, + 0xad, 0x52, 0x0d, 0xb2, 0xe9, 0xfd, 0x85, 0x70, 0x02, 0xc5, 0x8e, 0x5a, 0x2a, 0x88, 0x87, 0x9b, + 0x67, 0x32, 0xb3, 0x1e, 0x4b, 0x6d, 0xef, 0xb5, 0x56, 0x76, 0x69, 0x1c, 0x0a, 0xca, 0xb2, 0x3d, + 0x0f, 0xa5, 0xed, 0x9d, 0xe0, 0xf7, 0x75, 0x72, 0x9e, 0xb3, 0x8c, 0x03, 0xb1, 0xb0, 0xb6, 0x9f, + 0x5a, 0x06, 0xf1, 0xbd, 0x40, 0xf3, 0x3d, 0x62, 0x62, 0x3c, 0xae, 0x2e, 0xf2, 0x0f, 0x16, 0x32, + 0x72, 0x27, 0xd8, 0x21, 0x43, 0x0f, 0xb7, 0x54, 0x45, 0x7e, 0xe0, 0x66, 0xe5, 0x4e, 0x36, 0x3b, + 0x91, 0xcc, 0x79, 0xb1, 0x68, 0xe3, 0xeb, 0x1e, 0xaf, 0xc6, 0x18, 0x8d, 0x97, 0xa5, 0x89, 0x56, + 0xa5, 0x89, 0xee, 0x4a, 0x13, 0x3d, 0x94, 0x26, 0xba, 0x79, 0x34, 0x1b, 0xe7, 0x83, 0x9d, 0xc3, + 0x66, 0x3c, 0x8f, 0x63, 0x7b, 0x02, 0x73, 0x37, 0x03, 0x96, 0x70, 0x3b, 0xcc, 0xa9, 0x9d, 0x32, + 0x57, 0xf9, 0xdd, 0x6a, 0x1f, 0x0f, 0x81, 0xfd, 0x19, 0x3b, 0xbf, 0x8e, 0x7d, 0x47, 0xcd, 0x13, + 0x35, 0xe5, 0xbd, 0xbf, 0x3d, 0x07, 0x00, 0x00, 0xff, 0xff, 0xf5, 0x66, 0xc9, 0x19, 0x6a, 0x02, + 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -249,17 +167,8 @@ const _ = grpc.SupportPackageIsVersion4 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type SessionClient interface { - // Create is a method that used to open a trusted session to manipulate - // an object. In order to put or delete object client have to obtain session - // token with trusted node. Trusted node will modify client's object - // (add missing headers, checksums, homomorphic hash) and sign id with - // session key. Session is established during 4-step handshake in one gRPC stream - // - // - First client stream message SHOULD BE type of `CreateRequest_Init`. - // - First server stream message SHOULD BE type of `CreateResponse_Unsigned`. - // - Second client stream message SHOULD BE type of `CreateRequest_Signed`. - // - Second server stream message SHOULD BE type of `CreateResponse_Result`. - Create(ctx context.Context, opts ...grpc.CallOption) (Session_CreateClient, error) + // Create opens new session between the client and the server + Create(ctx context.Context, in *CreateRequest, opts ...grpc.CallOption) (*CreateResponse, error) } type sessionClient struct { @@ -270,102 +179,61 @@ func NewSessionClient(cc *grpc.ClientConn) SessionClient { return &sessionClient{cc} } -func (c *sessionClient) Create(ctx context.Context, opts ...grpc.CallOption) (Session_CreateClient, error) { - stream, err := c.cc.NewStream(ctx, &_Session_serviceDesc.Streams[0], "/session.Session/Create", opts...) +func (c *sessionClient) Create(ctx context.Context, in *CreateRequest, opts ...grpc.CallOption) (*CreateResponse, error) { + out := new(CreateResponse) + err := c.cc.Invoke(ctx, "/session.Session/Create", in, out, opts...) if err != nil { return nil, err } - x := &sessionCreateClient{stream} - return x, nil -} - -type Session_CreateClient interface { - Send(*CreateRequest) error - Recv() (*CreateResponse, error) - grpc.ClientStream -} - -type sessionCreateClient struct { - grpc.ClientStream -} - -func (x *sessionCreateClient) Send(m *CreateRequest) error { - return x.ClientStream.SendMsg(m) -} - -func (x *sessionCreateClient) Recv() (*CreateResponse, error) { - m := new(CreateResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil + return out, nil } // SessionServer is the server API for Session service. type SessionServer interface { - // Create is a method that used to open a trusted session to manipulate - // an object. In order to put or delete object client have to obtain session - // token with trusted node. Trusted node will modify client's object - // (add missing headers, checksums, homomorphic hash) and sign id with - // session key. Session is established during 4-step handshake in one gRPC stream - // - // - First client stream message SHOULD BE type of `CreateRequest_Init`. - // - First server stream message SHOULD BE type of `CreateResponse_Unsigned`. - // - Second client stream message SHOULD BE type of `CreateRequest_Signed`. - // - Second server stream message SHOULD BE type of `CreateResponse_Result`. - Create(Session_CreateServer) error + // Create opens new session between the client and the server + Create(context.Context, *CreateRequest) (*CreateResponse, error) } // UnimplementedSessionServer can be embedded to have forward compatible implementations. type UnimplementedSessionServer struct { } -func (*UnimplementedSessionServer) Create(srv Session_CreateServer) error { - return status.Errorf(codes.Unimplemented, "method Create not implemented") +func (*UnimplementedSessionServer) Create(ctx context.Context, req *CreateRequest) (*CreateResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Create not implemented") } func RegisterSessionServer(s *grpc.Server, srv SessionServer) { s.RegisterService(&_Session_serviceDesc, srv) } -func _Session_Create_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(SessionServer).Create(&sessionCreateServer{stream}) -} - -type Session_CreateServer interface { - Send(*CreateResponse) error - Recv() (*CreateRequest, error) - grpc.ServerStream -} - -type sessionCreateServer struct { - grpc.ServerStream -} - -func (x *sessionCreateServer) Send(m *CreateResponse) error { - return x.ServerStream.SendMsg(m) -} - -func (x *sessionCreateServer) Recv() (*CreateRequest, error) { - m := new(CreateRequest) - if err := x.ServerStream.RecvMsg(m); err != nil { +func _Session_Create_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateRequest) + if err := dec(in); err != nil { return nil, err } - return m, nil + if interceptor == nil { + return srv.(SessionServer).Create(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/session.Session/Create", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SessionServer).Create(ctx, req.(*CreateRequest)) + } + return interceptor(ctx, in, info, handler) } var _Session_serviceDesc = grpc.ServiceDesc{ ServiceName: "session.Session", HandlerType: (*SessionServer)(nil), - Methods: []grpc.MethodDesc{}, - Streams: []grpc.StreamDesc{ + Methods: []grpc.MethodDesc{ { - StreamName: "Create", - Handler: _Session_Create_Handler, - ServerStreams: true, - ClientStreams: true, + MethodName: "Create", + Handler: _Session_Create_Handler, }, }, + Streams: []grpc.StreamDesc{}, Metadata: "session/service.proto", } @@ -417,60 +285,29 @@ func (m *CreateRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x6 i-- dAtA[i] = 0x92 - if m.Message != nil { - { - size := m.Message.Size() - i -= size - if _, err := m.Message.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } + { + size, err := m.TokenLifetime.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x12 + { + size := m.OwnerID.Size() + i -= size + if _, err := m.OwnerID.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa return len(dAtA) - i, nil } -func (m *CreateRequest_Init) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *CreateRequest_Init) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.Init != nil { - { - size, err := m.Init.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} -func (m *CreateRequest_Signed) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *CreateRequest_Signed) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.Signed != nil { - { - size, err := m.Signed.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - return len(dAtA) - i, nil -} func (m *CreateResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -495,60 +332,26 @@ func (m *CreateResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } - if m.Message != nil { - { - size := m.Message.Size() - i -= size - if _, err := m.Message.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - } - } - return len(dAtA) - i, nil -} - -func (m *CreateResponse_Unsigned) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *CreateResponse_Unsigned) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.Unsigned != nil { - { - size, err := m.Unsigned.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} -func (m *CreateResponse_Result) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *CreateResponse_Result) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.Result != nil { - { - size, err := m.Result.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } + if len(m.SessionKey) > 0 { + i -= len(m.SessionKey) + copy(dAtA[i:], m.SessionKey) + i = encodeVarintService(dAtA, i, uint64(len(m.SessionKey))) i-- dAtA[i] = 0x12 } + { + size := m.ID.Size() + i -= size + if _, err := m.ID.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa return len(dAtA) - i, nil } + func encodeVarintService(dAtA []byte, offset int, v uint64) int { offset -= sovService(v) base := offset @@ -566,9 +369,10 @@ func (m *CreateRequest) Size() (n int) { } var l int _ = l - if m.Message != nil { - n += m.Message.Size() - } + l = m.OwnerID.Size() + n += 1 + l + sovService(uint64(l)) + l = m.TokenLifetime.Size() + n += 1 + l + sovService(uint64(l)) l = m.RequestMetaHeader.Size() n += 2 + l + sovService(uint64(l)) l = m.RequestVerificationHeader.Size() @@ -579,38 +383,17 @@ func (m *CreateRequest) Size() (n int) { return n } -func (m *CreateRequest_Init) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Init != nil { - l = m.Init.Size() - n += 1 + l + sovService(uint64(l)) - } - return n -} -func (m *CreateRequest_Signed) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Signed != nil { - l = m.Signed.Size() - n += 1 + l + sovService(uint64(l)) - } - return n -} func (m *CreateResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.Message != nil { - n += m.Message.Size() + l = m.ID.Size() + n += 1 + l + sovService(uint64(l)) + l = len(m.SessionKey) + if l > 0 { + n += 1 + l + sovService(uint64(l)) } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) @@ -618,31 +401,6 @@ func (m *CreateResponse) Size() (n int) { return n } -func (m *CreateResponse_Unsigned) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Unsigned != nil { - l = m.Unsigned.Size() - n += 1 + l + sovService(uint64(l)) - } - return n -} -func (m *CreateResponse_Result) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Result != nil { - l = m.Result.Size() - n += 1 + l + sovService(uint64(l)) - } - return n -} - func sovService(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -680,9 +438,9 @@ func (m *CreateRequest) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Init", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field OwnerID", wireType) } - var msglen int + var byteLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowService @@ -692,30 +450,28 @@ func (m *CreateRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + if byteLen < 0 { return ErrInvalidLengthService } - postIndex := iNdEx + msglen + postIndex := iNdEx + byteLen if postIndex < 0 { return ErrInvalidLengthService } if postIndex > l { return io.ErrUnexpectedEOF } - v := &service.Token{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.OwnerID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } - m.Message = &CreateRequest_Init{v} iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Signed", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field TokenLifetime", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -742,11 +498,9 @@ func (m *CreateRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &service.Token{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.TokenLifetime.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } - m.Message = &CreateRequest_Signed{v} iNdEx = postIndex case 98: if wireType != 2 { @@ -870,9 +624,9 @@ func (m *CreateResponse) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Unsigned", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) } - var msglen int + var byteLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowService @@ -882,32 +636,30 @@ func (m *CreateResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + if byteLen < 0 { return ErrInvalidLengthService } - postIndex := iNdEx + msglen + postIndex := iNdEx + byteLen if postIndex < 0 { return ErrInvalidLengthService } if postIndex > l { return io.ErrUnexpectedEOF } - v := &service.Token{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.ID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } - m.Message = &CreateResponse_Unsigned{v} iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Result", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field SessionKey", wireType) } - var msglen int + var byteLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowService @@ -917,26 +669,25 @@ func (m *CreateResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + if byteLen < 0 { return ErrInvalidLengthService } - postIndex := iNdEx + msglen + postIndex := iNdEx + byteLen if postIndex < 0 { return ErrInvalidLengthService } if postIndex > l { return io.ErrUnexpectedEOF } - v := &service.Token{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err + m.SessionKey = append(m.SessionKey[:0], dAtA[iNdEx:postIndex]...) + if m.SessionKey == nil { + m.SessionKey = []byte{} } - m.Message = &CreateResponse_Result{v} iNdEx = postIndex default: iNdEx = preIndex diff --git a/session/service.proto b/session/service.proto index 5c22fc3..b7eb0df 100644 --- a/session/service.proto +++ b/session/service.proto @@ -11,42 +11,29 @@ option (gogoproto.stable_marshaler_all) = true; service Session { - // Create is a method that used to open a trusted session to manipulate - // an object. In order to put or delete object client have to obtain session - // token with trusted node. Trusted node will modify client's object - // (add missing headers, checksums, homomorphic hash) and sign id with - // session key. Session is established during 4-step handshake in one gRPC stream - // - // - First client stream message SHOULD BE type of `CreateRequest_Init`. - // - First server stream message SHOULD BE type of `CreateResponse_Unsigned`. - // - Second client stream message SHOULD BE type of `CreateRequest_Signed`. - // - Second server stream message SHOULD BE type of `CreateResponse_Result`. - rpc Create (stream CreateRequest) returns (stream CreateResponse); + // Create opens new session between the client and the server + rpc Create (CreateRequest) returns (CreateResponse); } - +// CreateRequest carries an information necessary for opening a session message CreateRequest { - // Message should be one of - oneof Message { - // Init is a message to initialize session opening. Carry: - // owner of manipulation object; - // ID of manipulation object; - // token lifetime bounds. - service.Token Init = 1; - // Signed Init message response (Unsigned) from server with user private key - service.Token Signed = 2; - } + // OwnerID carries an identifier of a session initiator + bytes OwnerID = 1 [(gogoproto.nullable) = false, (gogoproto.customtype) = "OwnerID"]; + + // Lifetime carries a lifetime of the session + service.TokenLifetime Lifetime = 2 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + // RequestMetaHeader contains information about request meta headers (should be embedded into message) service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; } +// CreateResponse carries an information about the opened session message CreateResponse { - oneof Message { - // Unsigned token with token ID and session public key generated on server side - service.Token Unsigned = 1; - // Result is a resulting token which can be used for object placing through an trusted intermediary - service.Token Result = 2; - } + // ID carries an identifier of session token + bytes ID = 1 [(gogoproto.customtype) = "TokenID", (gogoproto.nullable) = false]; + + // SessionKey carries a session public key + bytes SessionKey = 2; } From 1932658a7da836133a054d0a646a8f29284863ff Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 8 May 2020 11:08:09 +0300 Subject: [PATCH 0189/1196] session: implement getters and setters on messages --- service/token.go | 8 ++++---- session/request.go | 11 +++++++++++ session/request_test.go | 29 +++++++++++++++++++++++++++++ session/response.go | 16 ++++++++++++++++ session/response_test.go | 27 +++++++++++++++++++++++++++ session/service.go | 1 - 6 files changed, 87 insertions(+), 5 deletions(-) create mode 100644 session/request.go create mode 100644 session/request_test.go create mode 100644 session/response.go create mode 100644 session/response_test.go delete mode 100644 session/service.go diff --git a/service/token.go b/service/token.go index f431427..78fccfa 100644 --- a/service/token.go +++ b/service/token.go @@ -75,22 +75,22 @@ func (m *Token_Info) SetAddress(addr Address) { } // CreationEpoch is a Created field getter. -func (m Token_Info) CreationEpoch() uint64 { +func (m TokenLifetime) CreationEpoch() uint64 { return m.Created } // SetCreationEpoch is a Created field setter. -func (m *Token_Info) SetCreationEpoch(e uint64) { +func (m *TokenLifetime) SetCreationEpoch(e uint64) { m.Created = e } // ExpirationEpoch is a ValidUntil field getter. -func (m Token_Info) ExpirationEpoch() uint64 { +func (m TokenLifetime) ExpirationEpoch() uint64 { return m.ValidUntil } // SetExpirationEpoch is a ValidUntil field setter. -func (m *Token_Info) SetExpirationEpoch(e uint64) { +func (m *TokenLifetime) SetExpirationEpoch(e uint64) { m.ValidUntil = e } diff --git a/session/request.go b/session/request.go new file mode 100644 index 0000000..4a92c42 --- /dev/null +++ b/session/request.go @@ -0,0 +1,11 @@ +package session + +// GetOwnerID is an OwnerID field getter. +func (m CreateRequest) GetOwnerID() OwnerID { + return m.OwnerID +} + +// SetOwnerID is an OwnerID field setter. +func (m *CreateRequest) SetOwnerID(id OwnerID) { + m.OwnerID = id +} diff --git a/session/request_test.go b/session/request_test.go new file mode 100644 index 0000000..06c62fd --- /dev/null +++ b/session/request_test.go @@ -0,0 +1,29 @@ +package session + +import ( + "testing" + + "github.com/stretchr/testify/require" +) + +func TestCreateRequestGettersSetters(t *testing.T) { + t.Run("owner ID", func(t *testing.T) { + id := OwnerID{1, 2, 3} + m := new(CreateRequest) + + m.SetOwnerID(id) + + require.Equal(t, id, m.GetOwnerID()) + }) + + t.Run("lifetime", func(t *testing.T) { + e1, e2 := uint64(3), uint64(4) + m := new(CreateRequest) + + m.SetCreationEpoch(e1) + m.SetExpirationEpoch(e2) + + require.Equal(t, e1, m.CreationEpoch()) + require.Equal(t, e2, m.ExpirationEpoch()) + }) +} diff --git a/session/response.go b/session/response.go new file mode 100644 index 0000000..3426d7c --- /dev/null +++ b/session/response.go @@ -0,0 +1,16 @@ +package session + +// GetID is an ID field getter. +func (m CreateResponse) GetID() TokenID { + return m.ID +} + +// SetID is an ID field setter. +func (m *CreateResponse) SetID(id TokenID) { + m.ID = id +} + +// SetSessionKey is a SessionKey field setter. +func (m *CreateResponse) SetSessionKey(key []byte) { + m.SessionKey = key +} diff --git a/session/response_test.go b/session/response_test.go new file mode 100644 index 0000000..0e1de0b --- /dev/null +++ b/session/response_test.go @@ -0,0 +1,27 @@ +package session + +import ( + "testing" + + "github.com/stretchr/testify/require" +) + +func TestCreateResponseGettersSetters(t *testing.T) { + t.Run("id", func(t *testing.T) { + id := TokenID{1, 2, 3} + m := new(CreateResponse) + + m.SetID(id) + + require.Equal(t, id, m.GetID()) + }) + + t.Run("session key", func(t *testing.T) { + key := []byte{1, 2, 3} + m := new(CreateResponse) + + m.SetSessionKey(key) + + require.Equal(t, key, m.GetSessionKey()) + }) +} diff --git a/session/service.go b/session/service.go deleted file mode 100644 index ab87616..0000000 --- a/session/service.go +++ /dev/null @@ -1 +0,0 @@ -package session From 6d71ea239bb729a8021a39311b1bd790b0331534 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 8 May 2020 11:55:19 +0300 Subject: [PATCH 0190/1196] session: implement SignedDataSource on CreateRequest --- session/request.go | 47 ++++++++++++++++++++++++++++++ session/request_test.go | 63 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 110 insertions(+) diff --git a/session/request.go b/session/request.go index 4a92c42..85f563f 100644 --- a/session/request.go +++ b/session/request.go @@ -1,5 +1,19 @@ package session +import ( + "encoding/binary" + "io" + + "github.com/nspcc-dev/neofs-api-go/refs" +) + +const signedRequestDataSize = 0 + + refs.OwnerIDSize + + 8 + + 8 + +var requestEndianness = binary.BigEndian + // GetOwnerID is an OwnerID field getter. func (m CreateRequest) GetOwnerID() OwnerID { return m.OwnerID @@ -9,3 +23,36 @@ func (m CreateRequest) GetOwnerID() OwnerID { func (m *CreateRequest) SetOwnerID(id OwnerID) { m.OwnerID = id } + +func (m CreateRequest) SignedData() ([]byte, error) { + data := make([]byte, m.SignedDataSize()) + + _, err := m.ReadSignedData(data) + if err != nil { + return nil, err + } + + return data, nil +} + +func (m CreateRequest) SignedDataSize() int { + return signedRequestDataSize +} + +func (m CreateRequest) ReadSignedData(p []byte) (int, error) { + sz := m.SignedDataSize() + if len(p) < sz { + return 0, io.ErrUnexpectedEOF + } + + var off int + + off += copy(p[off:], m.GetOwnerID().Bytes()) + + requestEndianness.PutUint64(p[off:], m.CreationEpoch()) + off += 8 + + requestEndianness.PutUint64(p[off:], m.ExpirationEpoch()) + + return sz, nil +} diff --git a/session/request_test.go b/session/request_test.go index 06c62fd..094ca66 100644 --- a/session/request_test.go +++ b/session/request_test.go @@ -27,3 +27,66 @@ func TestCreateRequestGettersSetters(t *testing.T) { require.Equal(t, e2, m.ExpirationEpoch()) }) } + +func TestCreateRequest_SignedData(t *testing.T) { + var ( + id = OwnerID{1, 2, 3} + e1 = uint64(1) + e2 = uint64(2) + ) + + // create new message + m := new(CreateRequest) + + // fill the fields + m.SetOwnerID(id) + m.SetCreationEpoch(e1) + m.SetExpirationEpoch(e2) + + // calculate initial signed data + d, err := m.SignedData() + require.NoError(t, err) + + items := []struct { + change func() + reset func() + }{ + { // OwnerID + change: func() { + id2 := id + id2[0]++ + m.SetOwnerID(id2) + }, + reset: func() { + m.SetOwnerID(id) + }, + }, + { // CreationEpoch + change: func() { + m.SetCreationEpoch(e1 + 1) + }, + reset: func() { + m.SetCreationEpoch(e1) + }, + }, + { // ExpirationEpoch + change: func() { + m.SetExpirationEpoch(e2 + 1) + }, + reset: func() { + m.SetExpirationEpoch(e2) + }, + }, + } + + for _, item := range items { + item.change() + + d2, err := m.SignedData() + require.NoError(t, err) + + require.NotEqual(t, d, d2) + + item.reset() + } +} From b079a7604f19ef5aa5fa4abed0cb7a394fb14d34 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 8 May 2020 12:34:16 +0300 Subject: [PATCH 0191/1196] session: implement gRPC session creator --- refs/types.go | 7 ++- service/types.go | 18 +++++-- session/create.go | 67 +++++++++++++++++++++++++++ session/create_test.go | 103 +++++++++++++++++++++++++++++++++++++++++ session/request.go | 4 ++ session/types.go | 25 ++++++++++ 6 files changed, 219 insertions(+), 5 deletions(-) create mode 100644 session/create.go create mode 100644 session/create_test.go diff --git a/refs/types.go b/refs/types.go index a29424e..417eec3 100644 --- a/refs/types.go +++ b/refs/types.go @@ -37,9 +37,14 @@ type ( OwnerID chain.WalletAddress ) +// OwnerIDSource is an interface of the container of an OwnerID value with read access. +type OwnerIDSource interface { + GetOwnerID() OwnerID +} + // OwnerIDContainer is an interface of the container of an OwnerID value. type OwnerIDContainer interface { - GetOwnerID() OwnerID + OwnerIDSource SetOwnerID(OwnerID) } diff --git a/service/types.go b/service/types.go index c3148a0..52d68d2 100644 --- a/service/types.go +++ b/service/types.go @@ -124,6 +124,18 @@ type ExpirationEpochContainer interface { SetExpirationEpoch(uint64) } +// LifetimeSource is an interface of the container of creation-expiration epoch pair with read access. +type LifetimeSource interface { + CreationEpochSource + ExpirationEpochSource +} + +// LifetimeSource is an interface of the container of creation-expiration epoch pair. +type LifetimeContainer interface { + CreationEpochContainer + ExpirationEpochContainer +} + // SessionKeySource is an interface of the container of session key bytes with read access. type SessionKeySource interface { GetSessionKey() []byte @@ -157,16 +169,14 @@ type SessionTokenSource interface { // - ID of the token's owner; // - verb of the session; // - address of the session object; -// - creation epoch number of the token; -// - expiration epoch number of the token; +// - token lifetime; // - public session key bytes. type SessionTokenInfo interface { TokenIDContainer OwnerIDContainer VerbContainer AddressContainer - CreationEpochContainer - ExpirationEpochContainer + LifetimeContainer SessionKeyContainer } diff --git a/session/create.go b/session/create.go new file mode 100644 index 0000000..a2d2b99 --- /dev/null +++ b/session/create.go @@ -0,0 +1,67 @@ +package session + +import ( + "context" + "crypto/ecdsa" + + "github.com/nspcc-dev/neofs-api-go/internal" + "github.com/nspcc-dev/neofs-api-go/service" + crypto "github.com/nspcc-dev/neofs-crypto" + "google.golang.org/grpc" +) + +type gRPCCreator struct { + conn *grpc.ClientConn + + key *ecdsa.PrivateKey + + clientFunc func(*grpc.ClientConn) SessionClient +} + +const ErrNilCreateParamsSource = internal.Error("create params source is nil") + +const ErrNilGPRCClientConn = internal.Error("gRPC client connection is nil") + +// NewGRPCCreator unites virtual gRPC client with private ket and returns Creator interface. +// +// If passed ClientConn is nil, ErrNilGPRCClientConn returns. +// If passed private key is nil, crypto.ErrEmptyPrivateKey returns. +func NewGRPCCreator(conn *grpc.ClientConn, key *ecdsa.PrivateKey) (Creator, error) { + if conn == nil { + return nil, ErrNilGPRCClientConn + } else if key == nil { + return nil, crypto.ErrEmptyPrivateKey + } + + return &gRPCCreator{ + conn: conn, + + key: key, + + clientFunc: NewSessionClient, + }, nil +} + +// Create constructs message, signs it with private key and sends it to a gRPC client. +// +// If passed CreateParamsSource is nil, ErrNilCreateParamsSource returns. +// If message could not be signed, an error returns. +func (s gRPCCreator) Create(ctx context.Context, p CreateParamsSource) (CreateResult, error) { + if p == nil { + return nil, ErrNilCreateParamsSource + } + + // create and fill a message + req := new(CreateRequest) + req.SetOwnerID(p.GetOwnerID()) + req.SetCreationEpoch(p.CreationEpoch()) + req.SetExpirationEpoch(p.ExpirationEpoch()) + + // sign with private key + if err := service.SignDataWithSessionToken(s.key, req); err != nil { + return nil, err + } + + // make gRPC call + return s.clientFunc(s.conn).Create(ctx, req) +} diff --git a/session/create_test.go b/session/create_test.go new file mode 100644 index 0000000..732d4fd --- /dev/null +++ b/session/create_test.go @@ -0,0 +1,103 @@ +package session + +import ( + "context" + "crypto/ecdsa" + "testing" + + "github.com/nspcc-dev/neofs-api-go/service" + crypto "github.com/nspcc-dev/neofs-crypto" + "github.com/nspcc-dev/neofs-crypto/test" + "github.com/pkg/errors" + "github.com/stretchr/testify/require" + "google.golang.org/grpc" +) + +type testSessionClient struct { + fn func(*CreateRequest) + resp *CreateResponse + err error +} + +func (s testSessionClient) Create(ctx context.Context, in *CreateRequest, opts ...grpc.CallOption) (*CreateResponse, error) { + if s.fn != nil { + s.fn(in) + } + + return s.resp, s.err +} + +func TestNewGRPCCreator(t *testing.T) { + var ( + err error + conn = new(grpc.ClientConn) + sk = new(ecdsa.PrivateKey) + ) + + // nil client connection + _, err = NewGRPCCreator(nil, sk) + require.EqualError(t, err, ErrNilGPRCClientConn.Error()) + + // nil private key + _, err = NewGRPCCreator(conn, nil) + require.EqualError(t, err, crypto.ErrEmptyPrivateKey.Error()) + + // valid params + res, err := NewGRPCCreator(conn, sk) + require.NoError(t, err) + + v := res.(*gRPCCreator) + require.Equal(t, conn, v.conn) + require.Equal(t, sk, v.key) + require.NotNil(t, v.clientFunc) +} + +func TestGRPCCreator_Create(t *testing.T) { + ctx := context.TODO() + s := new(gRPCCreator) + + // nil CreateParamsSource + _, err := s.Create(ctx, nil) + require.EqualError(t, err, ErrNilCreateParamsSource.Error()) + + var ( + ownerID = OwnerID{1, 2, 3} + created = uint64(2) + expired = uint64(4) + ) + + p := NewParams() + p.SetOwnerID(ownerID) + p.SetCreationEpoch(created) + p.SetExpirationEpoch(expired) + + // nil private key + _, err = s.Create(ctx, p) + require.Error(t, err) + + // create test private key + s.key = test.DecodeKey(0) + + // create test client + c := &testSessionClient{ + fn: func(req *CreateRequest) { + require.Equal(t, ownerID, req.GetOwnerID()) + require.Equal(t, created, req.CreationEpoch()) + require.Equal(t, expired, req.ExpirationEpoch()) + require.NoError(t, service.VerifyAccumulatedSignaturesWithToken(req)) + }, + resp: &CreateResponse{ + ID: TokenID{1, 2, 3}, + SessionKey: []byte{1, 2, 3}, + }, + err: errors.New("test error"), + } + + s.clientFunc = func(*grpc.ClientConn) SessionClient { + return c + } + + res, err := s.Create(ctx, p) + require.EqualError(t, err, c.err.Error()) + require.Equal(t, c.resp, res) +} diff --git a/session/request.go b/session/request.go index 85f563f..161edca 100644 --- a/session/request.go +++ b/session/request.go @@ -14,6 +14,10 @@ const signedRequestDataSize = 0 + var requestEndianness = binary.BigEndian +func NewParams() CreateParamsContainer { + return new(CreateRequest) +} + // GetOwnerID is an OwnerID field getter. func (m CreateRequest) GetOwnerID() OwnerID { return m.OwnerID diff --git a/session/types.go b/session/types.go index c890aaf..9e8db48 100644 --- a/session/types.go +++ b/session/types.go @@ -5,6 +5,8 @@ import ( "crypto/ecdsa" "github.com/nspcc-dev/neofs-api-go/internal" + "github.com/nspcc-dev/neofs-api-go/refs" + "github.com/nspcc-dev/neofs-api-go/service" ) // PrivateToken is an interface of session private part. @@ -55,5 +57,28 @@ type KeyStore interface { Get(context.Context, OwnerID) ([]*ecdsa.PublicKey, error) } +// CreateParamsSource is an interface of the container of session parameters with read access. +type CreateParamsSource interface { + refs.OwnerIDSource + service.LifetimeSource +} + +// CreateParamsContainer is an interface of the container of session parameters. +type CreateParamsContainer interface { + refs.OwnerIDContainer + service.LifetimeContainer +} + +// CreateResult is an interface of the container of an opened session info with read access. +type CreateResult interface { + service.TokenIDSource + service.SessionKeySource +} + +// Creator is an interface of the tool for a session opening. +type Creator interface { + Create(context.Context, CreateParamsSource) (CreateResult, error) +} + // ErrPrivateTokenNotFound is raised when addressed private token was not found in storage. const ErrPrivateTokenNotFound = internal.Error("private token not found") From 2c2150b1017c8368c20b0110215a67dd9b329d75 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 8 May 2020 12:37:56 +0300 Subject: [PATCH 0192/1196] session: move errors to a separate file --- session/create.go | 5 ----- session/errors.go | 15 +++++++++++++++ session/types.go | 4 ---- 3 files changed, 15 insertions(+), 9 deletions(-) create mode 100644 session/errors.go diff --git a/session/create.go b/session/create.go index a2d2b99..35d0540 100644 --- a/session/create.go +++ b/session/create.go @@ -4,7 +4,6 @@ import ( "context" "crypto/ecdsa" - "github.com/nspcc-dev/neofs-api-go/internal" "github.com/nspcc-dev/neofs-api-go/service" crypto "github.com/nspcc-dev/neofs-crypto" "google.golang.org/grpc" @@ -18,10 +17,6 @@ type gRPCCreator struct { clientFunc func(*grpc.ClientConn) SessionClient } -const ErrNilCreateParamsSource = internal.Error("create params source is nil") - -const ErrNilGPRCClientConn = internal.Error("gRPC client connection is nil") - // NewGRPCCreator unites virtual gRPC client with private ket and returns Creator interface. // // If passed ClientConn is nil, ErrNilGPRCClientConn returns. diff --git a/session/errors.go b/session/errors.go new file mode 100644 index 0000000..3a9c129 --- /dev/null +++ b/session/errors.go @@ -0,0 +1,15 @@ +package session + +import "github.com/nspcc-dev/neofs-api-go/internal" + +// ErrNilCreateParamsSource is returned by functions that expect a non-nil +// CreateParamsSource, but received nil. +const ErrNilCreateParamsSource = internal.Error("create params source is nil") + +// ErrNilGPRCClientConn is returned by functions that expect a non-nil +// grpc.ClientConn, but received nil. +const ErrNilGPRCClientConn = internal.Error("gRPC client connection is nil") + +// ErrPrivateTokenNotFound is returned when addressed private token was +// not found in storage. +const ErrPrivateTokenNotFound = internal.Error("private token not found") diff --git a/session/types.go b/session/types.go index 9e8db48..932fe38 100644 --- a/session/types.go +++ b/session/types.go @@ -4,7 +4,6 @@ import ( "context" "crypto/ecdsa" - "github.com/nspcc-dev/neofs-api-go/internal" "github.com/nspcc-dev/neofs-api-go/refs" "github.com/nspcc-dev/neofs-api-go/service" ) @@ -79,6 +78,3 @@ type CreateResult interface { type Creator interface { Create(context.Context, CreateParamsSource) (CreateResult, error) } - -// ErrPrivateTokenNotFound is raised when addressed private token was not found in storage. -const ErrPrivateTokenNotFound = internal.Error("private token not found") From 15a55d54a22a21ff6e044754937d87222754ad85 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 8 May 2020 12:45:16 +0300 Subject: [PATCH 0193/1196] fix comments --- service/types.go | 2 +- session/request.go | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/service/types.go b/service/types.go index 52d68d2..31f4507 100644 --- a/service/types.go +++ b/service/types.go @@ -130,7 +130,7 @@ type LifetimeSource interface { ExpirationEpochSource } -// LifetimeSource is an interface of the container of creation-expiration epoch pair. +// LifetimeContainer is an interface of the container of creation-expiration epoch pair. type LifetimeContainer interface { CreationEpochContainer ExpirationEpochContainer diff --git a/session/request.go b/session/request.go index 161edca..0bb5176 100644 --- a/session/request.go +++ b/session/request.go @@ -14,6 +14,7 @@ const signedRequestDataSize = 0 + var requestEndianness = binary.BigEndian +// NewParams creates a new CreateRequest message and returns CreateParamsContainer interface. func NewParams() CreateParamsContainer { return new(CreateRequest) } @@ -28,6 +29,7 @@ func (m *CreateRequest) SetOwnerID(id OwnerID) { m.OwnerID = id } +// SignedData returns payload bytes of the request. func (m CreateRequest) SignedData() ([]byte, error) { data := make([]byte, m.SignedDataSize()) @@ -39,10 +41,14 @@ func (m CreateRequest) SignedData() ([]byte, error) { return data, nil } +// SignedDataSize returns payload size of the request. func (m CreateRequest) SignedDataSize() int { return signedRequestDataSize } +// ReadSignedData copies payload bytes to passed buffer. +// +// If the buffer size is insufficient, io.ErrUnexpectedEOF returns. func (m CreateRequest) ReadSignedData(p []byte) (int, error) { sz := m.SignedDataSize() if len(p) < sz { From af73d958a19d2a7390363690c7e1ca182f386eeb Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 8 May 2020 13:20:12 +0300 Subject: [PATCH 0194/1196] session: add OwnerID to a private token storage key --- session/private.go | 10 ++++++++++ session/private_test.go | 20 ++++++++++++++++++++ session/store.go | 12 ++++++------ session/store_test.go | 35 +++++++++++++++++++++++++---------- session/types.go | 10 ++++++++-- 5 files changed, 69 insertions(+), 18 deletions(-) diff --git a/session/private.go b/session/private.go index 8ebce81..42bb205 100644 --- a/session/private.go +++ b/session/private.go @@ -43,3 +43,13 @@ func (t *pToken) PublicKey() []byte { func (t *pToken) Expired(epoch uint64) bool { return t.validUntil < epoch } + +// SetOwnerID is an owner ID field setter. +func (s *PrivateTokenKey) SetOwnerID(id OwnerID) { + s.owner = id +} + +// SetTokenID is a token ID field setter. +func (s *PrivateTokenKey) SetTokenID(id TokenID) { + s.token = id +} diff --git a/session/private_test.go b/session/private_test.go index 7963afb..8097b97 100644 --- a/session/private_test.go +++ b/session/private_test.go @@ -48,3 +48,23 @@ func TestPToken_Expired(t *testing.T) { // must be expired in the epoch after last require.True(t, token.Expired(e+1)) } + +func TestPrivateTokenKey_SetOwnerID(t *testing.T) { + ownerID := OwnerID{1, 2, 3} + + s := new(PrivateTokenKey) + + s.SetOwnerID(ownerID) + + require.Equal(t, ownerID, s.owner) +} + +func TestPrivateTokenKey_SetTokenID(t *testing.T) { + tokenID := TokenID{1, 2, 3} + + s := new(PrivateTokenKey) + + s.SetTokenID(tokenID) + + require.Equal(t, tokenID, s.token) +} diff --git a/session/store.go b/session/store.go index 79998c7..fa33b7e 100644 --- a/session/store.go +++ b/session/store.go @@ -7,7 +7,7 @@ import ( type mapTokenStore struct { *sync.RWMutex - tokens map[TokenID]PrivateToken + tokens map[PrivateTokenKey]PrivateToken } // NewMapTokenStore creates new PrivateTokenStore instance. @@ -16,16 +16,16 @@ type mapTokenStore struct { func NewMapTokenStore() PrivateTokenStore { return &mapTokenStore{ RWMutex: new(sync.RWMutex), - tokens: make(map[TokenID]PrivateToken), + tokens: make(map[PrivateTokenKey]PrivateToken), } } // Store adds passed token to the map. // // Resulting error is always nil. -func (s *mapTokenStore) Store(id TokenID, token PrivateToken) error { +func (s *mapTokenStore) Store(key PrivateTokenKey, token PrivateToken) error { s.Lock() - s.tokens[id] = token + s.tokens[key] = token s.Unlock() return nil @@ -34,11 +34,11 @@ func (s *mapTokenStore) Store(id TokenID, token PrivateToken) error { // Fetch returns the map element corresponding to the given key. // // Returns ErrPrivateTokenNotFound is there is no element in map. -func (s *mapTokenStore) Fetch(id TokenID) (PrivateToken, error) { +func (s *mapTokenStore) Fetch(key PrivateTokenKey) (PrivateToken, error) { s.RLock() defer s.RUnlock() - t, ok := s.tokens[id] + t, ok := s.tokens[key] if !ok { return nil, ErrPrivateTokenNotFound } diff --git a/session/store_test.go b/session/store_test.go index 123b103..74e0023 100644 --- a/session/store_test.go +++ b/session/store_test.go @@ -15,19 +15,26 @@ func TestMapTokenStore(t *testing.T) { // create map token store s := NewMapTokenStore() - // create new storage key - id, err := refs.NewUUID() + // create test TokenID + tid, err := refs.NewUUID() require.NoError(t, err) + // create test OwnerID + ownerID := OwnerID{1, 2, 3} + + key := PrivateTokenKey{} + key.SetOwnerID(ownerID) + key.SetTokenID(tid) + // ascertain that there is no record for the key - _, err = s.Fetch(id) + _, err = s.Fetch(key) require.EqualError(t, err, ErrPrivateTokenNotFound.Error()) // save private token record - require.NoError(t, s.Store(id, pToken)) + require.NoError(t, s.Store(key, pToken)) // fetch private token by the key - res, err := s.Fetch(id) + res, err := s.Fetch(key) require.NoError(t, err) // ascertain that returned token equals to initial @@ -52,7 +59,11 @@ func TestMapTokenStore_RemoveExpired(t *testing.T) { // create token store instance s := NewMapTokenStore() - // create storage keys for tokens + // create test PrivateTokenKey + key := PrivateTokenKey{} + key.SetOwnerID(OwnerID{1, 2, 3}) + + // create IDs for tokens id1, err := refs.NewUUID() require.NoError(t, err) id2, err := refs.NewUUID() @@ -60,21 +71,25 @@ func TestMapTokenStore_RemoveExpired(t *testing.T) { assertPresence := func(ids ...TokenID) { for i := range ids { - _, err = s.Fetch(ids[i]) + key.SetTokenID(ids[i]) + _, err = s.Fetch(key) require.NoError(t, err) } } assertAbsence := func(ids ...TokenID) { for i := range ids { - _, err = s.Fetch(ids[i]) + key.SetTokenID(ids[i]) + _, err = s.Fetch(key) require.EqualError(t, err, ErrPrivateTokenNotFound.Error()) } } // store both tokens - require.NoError(t, s.Store(id1, tok1)) - require.NoError(t, s.Store(id2, tok2)) + key.SetTokenID(id1) + require.NoError(t, s.Store(key, tok1)) + key.SetTokenID(id2) + require.NoError(t, s.Store(key, tok2)) // ascertain that both tokens are available assertPresence(id1, id2) diff --git a/session/types.go b/session/types.go index 932fe38..ee13b92 100644 --- a/session/types.go +++ b/session/types.go @@ -23,12 +23,18 @@ type PrivateToken interface { Expired(uint64) bool } +// PrivateTokenKey is a structure of private token storage key. +type PrivateTokenKey struct { + owner OwnerID + token TokenID +} + // PrivateTokenSource is an interface of private token storage with read access. type PrivateTokenSource interface { // Fetch must return the storage record corresponding to the passed key. // // Resulting error must be ErrPrivateTokenNotFound if there is no corresponding record. - Fetch(TokenID) (PrivateToken, error) + Fetch(PrivateTokenKey) (PrivateToken, error) } // EpochLifetimeStore is an interface of the storage of elements that lifetime is limited by NeoFS epoch. @@ -45,7 +51,7 @@ type PrivateTokenStore interface { // Store must save passed private token in the storage under the given key. // // Resulting error must be nil if private token was stored successfully. - Store(TokenID, PrivateToken) error + Store(PrivateTokenKey, PrivateToken) error } // KeyStore is an interface of the storage of public keys addressable by OwnerID, From dd2f568347f1f60218dde3b79674877fdc8679fc Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 8 May 2020 15:05:33 +0300 Subject: [PATCH 0195/1196] object: add Token header case to CopyTo --- object/types.go | 6 ++++++ object/types_test.go | 21 +++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/object/types.go b/object/types.go index cbc50f5..c8d3f25 100644 --- a/object/types.go +++ b/object/types.go @@ -251,6 +251,12 @@ func (m *Object) CopyTo(o *Object) { HomoHash: v.HomoHash, }, } + case *Header_Token: + o.Headers[i] = Header{ + Value: &Header_Token{ + Token: v.Token, + }, + } default: o.Headers[i] = *proto.Clone(&m.Headers[i]).(*Header) } diff --git a/object/types_test.go b/object/types_test.go index 95f328b..3f9292d 100644 --- a/object/types_test.go +++ b/object/types_test.go @@ -178,3 +178,24 @@ Object: require.NoError(t, Stringify(buf, obj)) require.Equal(t, res, buf.String()) } + +func TestObject_Copy(t *testing.T) { + t.Run("token header", func(t *testing.T) { + token := new(Token) + token.SetID(service.TokenID{1, 2, 3}) + + obj := new(Object) + + obj.AddHeader(&Header{ + Value: &Header_Token{ + Token: token, + }, + }) + + cp := obj.Copy() + + _, h := cp.LastHeader(HeaderType(TokenHdr)) + require.NotNil(t, h) + require.Equal(t, token, h.GetValue().(*Header_Token).Token) + }) +} From b9d30d613831de5f06bea5ef9a415c9ba719ce6d Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 11 May 2020 11:59:39 +0300 Subject: [PATCH 0196/1196] accounting: implement SignedDataSource on BalanceRequest message --- accounting/sign.go | 33 ++++++++++++++++++++++++ accounting/sign_test.go | 54 ++++++++++++++++++++++++++++++++++++++++ accounting/types.go | 10 ++++++++ accounting/types_test.go | 9 +++++++ 4 files changed, 106 insertions(+) create mode 100644 accounting/sign.go create mode 100644 accounting/sign_test.go diff --git a/accounting/sign.go b/accounting/sign.go new file mode 100644 index 0000000..a42375f --- /dev/null +++ b/accounting/sign.go @@ -0,0 +1,33 @@ +package accounting + +import "io" + +// SignedData returns payload bytes of the request. +func (m BalanceRequest) SignedData() ([]byte, error) { + data := make([]byte, m.SignedDataSize()) + + if _, err := m.ReadSignedData(data); err != nil { + return nil, err + } + + return data, nil +} + +// SignedDataSize returns payload size of the request. +func (m BalanceRequest) SignedDataSize() int { + return m.GetOwnerID().Size() +} + +// ReadSignedData copies payload bytes to passed buffer. +// +// If the buffer size is insufficient, io.ErrUnexpectedEOF returns. +func (m BalanceRequest) ReadSignedData(p []byte) (int, error) { + sz := m.SignedDataSize() + if len(p) < sz { + return 0, io.ErrUnexpectedEOF + } + + copy(p, m.GetOwnerID().Bytes()) + + return sz, nil +} diff --git a/accounting/sign_test.go b/accounting/sign_test.go new file mode 100644 index 0000000..03eaf6c --- /dev/null +++ b/accounting/sign_test.go @@ -0,0 +1,54 @@ +package accounting + +import ( + "testing" + + "github.com/nspcc-dev/neofs-api-go/service" + "github.com/nspcc-dev/neofs-crypto/test" + "github.com/stretchr/testify/require" +) + +func TestSignBalanceRequest(t *testing.T) { + // create test OwnerID + ownerID := OwnerID{1, 2, 3} + + // create test BalanceRequest + req := new(BalanceRequest) + req.SetOwnerID(ownerID) + + // create test private key + sk := test.DecodeKey(0) + + items := []struct { + corrupt func() + restore func() + }{ + { + corrupt: func() { + ownerID[0]++ + req.SetOwnerID(ownerID) + }, + restore: func() { + ownerID[0]-- + req.SetOwnerID(ownerID) + }, + }, + } + + for _, item := range items { + // sign with private key + require.NoError(t, service.AddSignatureWithKey(sk, req)) + + // ascertain that verification is passed + require.NoError(t, service.VerifyAccumulatedSignatures(req)) + + // corrupt the request + item.corrupt() + + // ascertain that verification is failed + require.Error(t, service.VerifyAccumulatedSignatures(req)) + + // ascertain that request + item.restore() + } +} diff --git a/accounting/types.go b/accounting/types.go index 6a3b2e2..3ac637d 100644 --- a/accounting/types.go +++ b/accounting/types.go @@ -351,3 +351,13 @@ func (m *Settlement) Equal(s *Settlement) bool { } return len(m.Transactions) == 0 || reflect.DeepEqual(m.Transactions, s.Transactions) } + +// GetOwnerID is an OwnerID field getter. +func (m BalanceRequest) GetOwnerID() OwnerID { + return m.OwnerID +} + +// SetOwnerID is an OwnerID field setter. +func (m *BalanceRequest) SetOwnerID(owner OwnerID) { + m.OwnerID = owner +} diff --git a/accounting/types_test.go b/accounting/types_test.go index df81b46..e89c08c 100644 --- a/accounting/types_test.go +++ b/accounting/types_test.go @@ -84,3 +84,12 @@ func TestCheque(t *testing.T) { require.Equal(t, cheque.Amount, decimal.NewGAS(42)) }) } + +func TestBalanceRequest_SetOwnerID(t *testing.T) { + ownerID := OwnerID{1, 2, 3} + m := new(BalanceRequest) + + m.SetOwnerID(ownerID) + + require.Equal(t, ownerID, m.GetOwnerID()) +} From 6832d71d4870a43b48953d2c2aef23a99f9ad2a8 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 11 May 2020 12:54:21 +0300 Subject: [PATCH 0197/1196] accounting: implement SignedDataSource on GetRequest message --- accounting/sign.go | 34 ++++++++++++++ accounting/sign_test.go | 95 ++++++++++++++++++++++++++++------------ accounting/types.go | 20 +++++++++ accounting/types_test.go | 20 +++++++++ 4 files changed, 142 insertions(+), 27 deletions(-) diff --git a/accounting/sign.go b/accounting/sign.go index a42375f..8faeb96 100644 --- a/accounting/sign.go +++ b/accounting/sign.go @@ -31,3 +31,37 @@ func (m BalanceRequest) ReadSignedData(p []byte) (int, error) { return sz, nil } + +// SignedData returns payload bytes of the request. +func (m GetRequest) SignedData() ([]byte, error) { + data := make([]byte, m.SignedDataSize()) + + if _, err := m.ReadSignedData(data); err != nil { + return nil, err + } + + return data, nil +} + +// SignedDataSize returns payload size of the request. +func (m GetRequest) SignedDataSize() int { + return m.GetID().Size() + m.GetOwnerID().Size() +} + +// ReadSignedData copies payload bytes to passed buffer. +// +// If the buffer size is insufficient, io.ErrUnexpectedEOF returns. +func (m GetRequest) ReadSignedData(p []byte) (int, error) { + sz := m.SignedDataSize() + if len(p) < sz { + return 0, io.ErrUnexpectedEOF + } + + var off int + + off += copy(p[off:], m.GetID().Bytes()) + + copy(p[off:], m.GetOwnerID().Bytes()) + + return sz, nil +} diff --git a/accounting/sign_test.go b/accounting/sign_test.go index 03eaf6c..d059ab4 100644 --- a/accounting/sign_test.go +++ b/accounting/sign_test.go @@ -9,46 +9,87 @@ import ( ) func TestSignBalanceRequest(t *testing.T) { - // create test OwnerID - ownerID := OwnerID{1, 2, 3} - - // create test BalanceRequest - req := new(BalanceRequest) - req.SetOwnerID(ownerID) - - // create test private key sk := test.DecodeKey(0) + type sigType interface { + service.SignedDataWithToken + service.SignKeyPairAccumulator + service.SignKeyPairSource + SetToken(*service.Token) + } + items := []struct { - corrupt func() - restore func() + constructor func() sigType + payloadCorrupt []func(sigType) }{ - { - corrupt: func() { - ownerID[0]++ - req.SetOwnerID(ownerID) + { // BalanceRequest + constructor: func() sigType { + return new(BalanceRequest) }, - restore: func() { - ownerID[0]-- - req.SetOwnerID(ownerID) + payloadCorrupt: []func(sigType){ + func(s sigType) { + req := s.(*BalanceRequest) + + owner := req.GetOwnerID() + owner[0]++ + + req.SetOwnerID(owner) + }, + }, + }, + { // GetRequest + constructor: func() sigType { + return new(GetRequest) + }, + payloadCorrupt: []func(sigType){ + func(s sigType) { + req := s.(*GetRequest) + + id, err := NewChequeID() + require.NoError(t, err) + + req.SetID(id) + }, + func(s sigType) { + req := s.(*GetRequest) + + id := req.GetOwnerID() + id[0]++ + + req.SetOwnerID(id) + }, }, }, } for _, item := range items { - // sign with private key - require.NoError(t, service.AddSignatureWithKey(sk, req)) + { // token corruptions + v := item.constructor() - // ascertain that verification is passed - require.NoError(t, service.VerifyAccumulatedSignatures(req)) + token := new(service.Token) + v.SetToken(token) - // corrupt the request - item.corrupt() + require.NoError(t, service.SignDataWithSessionToken(sk, v)) - // ascertain that verification is failed - require.Error(t, service.VerifyAccumulatedSignatures(req)) + require.NoError(t, service.VerifyAccumulatedSignaturesWithToken(v)) - // ascertain that request - item.restore() + token.SetSessionKey(append(token.GetSessionKey(), 1)) + + require.Error(t, service.VerifyAccumulatedSignaturesWithToken(v)) + } + + { // payload corruptions + for _, corruption := range item.payloadCorrupt { + v := item.constructor() + + require.NoError(t, service.SignDataWithSessionToken(sk, v)) + + require.NoError(t, service.VerifyAccumulatedSignaturesWithToken(v)) + + corruption(v) + + require.Error(t, service.VerifyAccumulatedSignaturesWithToken(v)) + } + } } } diff --git a/accounting/types.go b/accounting/types.go index 3ac637d..1e4e80a 100644 --- a/accounting/types.go +++ b/accounting/types.go @@ -361,3 +361,23 @@ func (m BalanceRequest) GetOwnerID() OwnerID { func (m *BalanceRequest) SetOwnerID(owner OwnerID) { m.OwnerID = owner } + +// GetID is an ID field getter. +func (m GetRequest) GetID() ChequeID { + return m.ID +} + +// SetID is an ID field setter. +func (m *GetRequest) SetID(id ChequeID) { + m.ID = id +} + +// GetOwnerID is an OwnerID field getter. +func (m GetRequest) GetOwnerID() OwnerID { + return m.OwnerID +} + +// SetOwnerID is an OwnerID field setter. +func (m *GetRequest) SetOwnerID(id OwnerID) { + m.OwnerID = id +} diff --git a/accounting/types_test.go b/accounting/types_test.go index e89c08c..ea17a8a 100644 --- a/accounting/types_test.go +++ b/accounting/types_test.go @@ -93,3 +93,23 @@ func TestBalanceRequest_SetOwnerID(t *testing.T) { require.Equal(t, ownerID, m.GetOwnerID()) } + +func TestGetRequestGettersSetters(t *testing.T) { + t.Run("id", func(t *testing.T) { + id := ChequeID("test id") + m := new(GetRequest) + + m.SetID(id) + + require.Equal(t, id, m.GetID()) + }) + + t.Run("owner", func(t *testing.T) { + id := OwnerID{1, 2, 3} + m := new(GetRequest) + + m.SetOwnerID(id) + + require.Equal(t, id, m.GetOwnerID()) + }) +} From 8c492a7712b44f6fd49ceb5c977801697370e2b6 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 11 May 2020 13:14:31 +0300 Subject: [PATCH 0198/1196] accounting: implement SignedDataSource on PutRequest message --- accounting/sign.go | 59 +++++++++++++++++++++++++++++++++++++++- accounting/sign_test.go | 44 ++++++++++++++++++++++++++++++ accounting/types.go | 30 ++++++++++++++++++++ accounting/types_test.go | 39 ++++++++++++++++++++++++++ 4 files changed, 171 insertions(+), 1 deletion(-) diff --git a/accounting/sign.go b/accounting/sign.go index 8faeb96..8da8cf6 100644 --- a/accounting/sign.go +++ b/accounting/sign.go @@ -1,6 +1,9 @@ package accounting -import "io" +import ( + "encoding/binary" + "io" +) // SignedData returns payload bytes of the request. func (m BalanceRequest) SignedData() ([]byte, error) { @@ -65,3 +68,57 @@ func (m GetRequest) ReadSignedData(p []byte) (int, error) { return sz, nil } + +// SignedData returns payload bytes of the request. +func (m PutRequest) SignedData() ([]byte, error) { + data := make([]byte, m.SignedDataSize()) + + if _, err := m.ReadSignedData(data); err != nil { + return nil, err + } + + return data, nil +} + +// SignedDataSize returns payload size of the request. +func (m PutRequest) SignedDataSize() (sz int) { + sz += m.GetOwnerID().Size() + + sz += m.GetMessageID().Size() + + sz += 8 + + if amount := m.GetAmount(); amount != nil { + sz += amount.Size() + } + + return +} + +// ReadSignedData copies payload bytes to passed buffer. +// +// If the buffer size is insufficient, io.ErrUnexpectedEOF returns. +func (m PutRequest) ReadSignedData(p []byte) (int, error) { + if len(p) < m.SignedDataSize() { + return 0, io.ErrUnexpectedEOF + } + + var off int + + off += copy(p[off:], m.GetOwnerID().Bytes()) + + off += copy(p[off:], m.GetMessageID().Bytes()) + + binary.BigEndian.PutUint64(p[off:], m.GetHeight()) + off += 8 + + if amount := m.GetAmount(); amount != nil { + n, err := amount.MarshalTo(p[off:]) + off += n + if err != nil { + return off + n, err + } + } + + return off, nil +} diff --git a/accounting/sign_test.go b/accounting/sign_test.go index d059ab4..1f88dcf 100644 --- a/accounting/sign_test.go +++ b/accounting/sign_test.go @@ -3,6 +3,7 @@ package accounting import ( "testing" + "github.com/nspcc-dev/neofs-api-go/decimal" "github.com/nspcc-dev/neofs-api-go/service" "github.com/nspcc-dev/neofs-crypto/test" "github.com/stretchr/testify/require" @@ -60,6 +61,49 @@ func TestSignBalanceRequest(t *testing.T) { }, }, }, + { // PutRequest + constructor: func() sigType { + req := new(PutRequest) + + amount := decimal.New(1) + req.SetAmount(amount) + + return req + }, + payloadCorrupt: []func(sigType){ + func(s sigType) { + req := s.(*PutRequest) + + owner := req.GetOwnerID() + owner[0]++ + + req.SetOwnerID(owner) + }, + func(s sigType) { + req := s.(*PutRequest) + + mid := req.GetMessageID() + mid[0]++ + + req.SetMessageID(mid) + }, + func(s sigType) { + req := s.(*PutRequest) + + req.SetHeight(req.GetHeight() + 1) + }, + func(s sigType) { + req := s.(*PutRequest) + + amount := req.GetAmount() + if amount == nil { + req.SetAmount(decimal.New(0)) + } else { + req.SetAmount(amount.Add(decimal.New(amount.GetValue()))) + } + }, + }, + }, } for _, item := range items { diff --git a/accounting/types.go b/accounting/types.go index 1e4e80a..3a4b15e 100644 --- a/accounting/types.go +++ b/accounting/types.go @@ -381,3 +381,33 @@ func (m GetRequest) GetOwnerID() OwnerID { func (m *GetRequest) SetOwnerID(id OwnerID) { m.OwnerID = id } + +// GetOwnerID is an OwnerID field getter. +func (m PutRequest) GetOwnerID() OwnerID { + return m.OwnerID +} + +// SetOwnerID is an OwnerID field setter. +func (m *PutRequest) SetOwnerID(id OwnerID) { + m.OwnerID = id +} + +// GetMessageID is a MessageID field getter. +func (m PutRequest) GetMessageID() MessageID { + return m.MessageID +} + +// SetMessageID is a MessageID field setter. +func (m *PutRequest) SetMessageID(id MessageID) { + m.MessageID = id +} + +// SetAmount is an Amount field setter. +func (m *PutRequest) SetAmount(amount *decimal.Decimal) { + m.Amount = amount +} + +// SetHeight is a Height field setter. +func (m *PutRequest) SetHeight(h uint64) { + m.Height = h +} diff --git a/accounting/types_test.go b/accounting/types_test.go index ea17a8a..844ea70 100644 --- a/accounting/types_test.go +++ b/accounting/types_test.go @@ -113,3 +113,42 @@ func TestGetRequestGettersSetters(t *testing.T) { require.Equal(t, id, m.GetOwnerID()) }) } + +func TestPutRequestGettersSetters(t *testing.T) { + t.Run("owner", func(t *testing.T) { + id := OwnerID{1, 2, 3} + m := new(PutRequest) + + m.SetOwnerID(id) + + require.Equal(t, id, m.GetOwnerID()) + }) + + t.Run("message ID", func(t *testing.T) { + id, err := refs.NewUUID() + require.NoError(t, err) + + m := new(PutRequest) + m.SetMessageID(id) + + require.Equal(t, id, m.GetMessageID()) + }) + + t.Run("amount", func(t *testing.T) { + amount := decimal.New(1) + m := new(PutRequest) + + m.SetAmount(amount) + + require.Equal(t, amount, m.GetAmount()) + }) + + t.Run("height", func(t *testing.T) { + h := uint64(3) + m := new(PutRequest) + + m.SetHeight(h) + + require.Equal(t, h, m.GetHeight()) + }) +} From 81f537cda88329272b2d1cfe71eb2e9a7fec11d8 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 11 May 2020 13:20:58 +0300 Subject: [PATCH 0199/1196] accounting: implement SignedDataSource on ListRequest message --- accounting/sign.go | 30 ++++++++++++++++++++++++++++++ accounting/sign_test.go | 15 +++++++++++++++ accounting/types.go | 10 ++++++++++ accounting/types_test.go | 9 +++++++++ 4 files changed, 64 insertions(+) diff --git a/accounting/sign.go b/accounting/sign.go index 8da8cf6..dc8f6d7 100644 --- a/accounting/sign.go +++ b/accounting/sign.go @@ -122,3 +122,33 @@ func (m PutRequest) ReadSignedData(p []byte) (int, error) { return off, nil } + +// SignedData returns payload bytes of the request. +func (m ListRequest) SignedData() ([]byte, error) { + data := make([]byte, m.SignedDataSize()) + + if _, err := m.ReadSignedData(data); err != nil { + return nil, err + } + + return data, nil +} + +// SignedDataSize returns payload size of the request. +func (m ListRequest) SignedDataSize() int { + return m.GetOwnerID().Size() +} + +// ReadSignedData copies payload bytes to passed buffer. +// +// If the buffer size is insufficient, io.ErrUnexpectedEOF returns. +func (m ListRequest) ReadSignedData(p []byte) (int, error) { + sz := m.SignedDataSize() + if len(p) < sz { + return 0, io.ErrUnexpectedEOF + } + + copy(p, m.GetOwnerID().Bytes()) + + return sz, nil +} diff --git a/accounting/sign_test.go b/accounting/sign_test.go index 1f88dcf..77ee014 100644 --- a/accounting/sign_test.go +++ b/accounting/sign_test.go @@ -104,6 +104,21 @@ func TestSignBalanceRequest(t *testing.T) { }, }, }, + { // ListRequest + constructor: func() sigType { + return new(ListRequest) + }, + payloadCorrupt: []func(sigType){ + func(s sigType) { + req := s.(*ListRequest) + + owner := req.GetOwnerID() + owner[0]++ + + req.SetOwnerID(owner) + }, + }, + }, } for _, item := range items { diff --git a/accounting/types.go b/accounting/types.go index 3a4b15e..8ea52e3 100644 --- a/accounting/types.go +++ b/accounting/types.go @@ -411,3 +411,13 @@ func (m *PutRequest) SetAmount(amount *decimal.Decimal) { func (m *PutRequest) SetHeight(h uint64) { m.Height = h } + +// GetOwnerID is an OwnerID field getter. +func (m ListRequest) GetOwnerID() OwnerID { + return m.OwnerID +} + +// SetOwnerID is an OwnerID field setter. +func (m *ListRequest) SetOwnerID(id OwnerID) { + m.OwnerID = id +} diff --git a/accounting/types_test.go b/accounting/types_test.go index 844ea70..cdf5610 100644 --- a/accounting/types_test.go +++ b/accounting/types_test.go @@ -152,3 +152,12 @@ func TestPutRequestGettersSetters(t *testing.T) { require.Equal(t, h, m.GetHeight()) }) } + +func TestListRequestGettersSetters(t *testing.T) { + ownerID := OwnerID{1, 2, 3} + m := new(ListRequest) + + m.SetOwnerID(ownerID) + + require.Equal(t, ownerID, m.GetOwnerID()) +} From 3fb293543f0e61b91c2fa830c425032bb21e0953 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 11 May 2020 13:29:04 +0300 Subject: [PATCH 0200/1196] accounting: implement SignedDataSource on DeleteRequest message --- accounting/sign.go | 38 ++++++++++++++++++++++++++++++++++++++ accounting/sign_test.go | 31 +++++++++++++++++++++++++++++++ accounting/types.go | 30 ++++++++++++++++++++++++++++++ accounting/types_test.go | 30 ++++++++++++++++++++++++++++++ 4 files changed, 129 insertions(+) diff --git a/accounting/sign.go b/accounting/sign.go index dc8f6d7..b52d229 100644 --- a/accounting/sign.go +++ b/accounting/sign.go @@ -152,3 +152,41 @@ func (m ListRequest) ReadSignedData(p []byte) (int, error) { return sz, nil } + +// SignedData returns payload bytes of the request. +func (m DeleteRequest) SignedData() ([]byte, error) { + data := make([]byte, m.SignedDataSize()) + + if _, err := m.ReadSignedData(data); err != nil { + return nil, err + } + + return data, nil +} + +// SignedDataSize returns payload size of the request. +func (m DeleteRequest) SignedDataSize() int { + return 0 + + m.GetID().Size() + + m.GetOwnerID().Size() + + m.GetMessageID().Size() +} + +// ReadSignedData copies payload bytes to passed buffer. +// +// If the buffer size is insufficient, io.ErrUnexpectedEOF returns. +func (m DeleteRequest) ReadSignedData(p []byte) (int, error) { + if len(p) < m.SignedDataSize() { + return 0, io.ErrUnexpectedEOF + } + + var off int + + off += copy(p[off:], m.GetID().Bytes()) + + off += copy(p[off:], m.GetOwnerID().Bytes()) + + off += copy(p[off:], m.GetMessageID().Bytes()) + + return off, nil +} diff --git a/accounting/sign_test.go b/accounting/sign_test.go index 77ee014..dd7a819 100644 --- a/accounting/sign_test.go +++ b/accounting/sign_test.go @@ -119,6 +119,37 @@ func TestSignBalanceRequest(t *testing.T) { }, }, }, + { + constructor: func() sigType { + return new(DeleteRequest) + }, + payloadCorrupt: []func(sigType){ + func(s sigType) { + req := s.(*DeleteRequest) + + id, err := NewChequeID() + require.NoError(t, err) + + req.SetID(id) + }, + func(s sigType) { + req := s.(*DeleteRequest) + + owner := req.GetOwnerID() + owner[0]++ + + req.SetOwnerID(owner) + }, + func(s sigType) { + req := s.(*DeleteRequest) + + mid := req.GetMessageID() + mid[0]++ + + req.SetMessageID(mid) + }, + }, + }, } for _, item := range items { diff --git a/accounting/types.go b/accounting/types.go index 8ea52e3..e16fa99 100644 --- a/accounting/types.go +++ b/accounting/types.go @@ -421,3 +421,33 @@ func (m ListRequest) GetOwnerID() OwnerID { func (m *ListRequest) SetOwnerID(id OwnerID) { m.OwnerID = id } + +// GetID is an ID field getter. +func (m DeleteRequest) GetID() ChequeID { + return m.ID +} + +// SetID is an ID field setter. +func (m *DeleteRequest) SetID(id ChequeID) { + m.ID = id +} + +// GetOwnerID is an OwnerID field getter. +func (m DeleteRequest) GetOwnerID() OwnerID { + return m.OwnerID +} + +// SetOwnerID is an OwnerID field setter. +func (m *DeleteRequest) SetOwnerID(id OwnerID) { + m.OwnerID = id +} + +// GetMessageID is a MessageID field getter. +func (m DeleteRequest) GetMessageID() MessageID { + return m.MessageID +} + +// SetMessageID is a MessageID field setter. +func (m *DeleteRequest) SetMessageID(id MessageID) { + m.MessageID = id +} diff --git a/accounting/types_test.go b/accounting/types_test.go index cdf5610..a440028 100644 --- a/accounting/types_test.go +++ b/accounting/types_test.go @@ -161,3 +161,33 @@ func TestListRequestGettersSetters(t *testing.T) { require.Equal(t, ownerID, m.GetOwnerID()) } + +func TestDeleteRequestGettersSetters(t *testing.T) { + t.Run("id", func(t *testing.T) { + id := ChequeID("test id") + m := new(DeleteRequest) + + m.SetID(id) + + require.Equal(t, id, m.GetID()) + }) + + t.Run("owner", func(t *testing.T) { + id := OwnerID{1, 2, 3} + m := new(DeleteRequest) + + m.SetOwnerID(id) + + require.Equal(t, id, m.GetOwnerID()) + }) + + t.Run("message ID", func(t *testing.T) { + id, err := refs.NewUUID() + require.NoError(t, err) + + m := new(DeleteRequest) + m.SetMessageID(id) + + require.Equal(t, id, m.GetMessageID()) + }) +} From 9327c5f816f4624f7db1e9709d4a25a0f7464ac0 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 11 May 2020 13:57:23 +0300 Subject: [PATCH 0201/1196] bootstrap: implement SignedDataSource on Request message --- accounting/sign.go | 13 ++++--- bootstrap/sign.go | 48 ++++++++++++++++++++++++ bootstrap/sign_test.go | 82 +++++++++++++++++++++++++++++++++++++++++ bootstrap/types.go | 35 ++++++++++++++++++ bootstrap/types_test.go | 39 ++++++++++++++++++++ service/role.go | 14 +++++++ 6 files changed, 226 insertions(+), 5 deletions(-) create mode 100644 bootstrap/sign.go create mode 100644 bootstrap/sign_test.go create mode 100644 bootstrap/types_test.go diff --git a/accounting/sign.go b/accounting/sign.go index b52d229..4c6452d 100644 --- a/accounting/sign.go +++ b/accounting/sign.go @@ -165,11 +165,14 @@ func (m DeleteRequest) SignedData() ([]byte, error) { } // SignedDataSize returns payload size of the request. -func (m DeleteRequest) SignedDataSize() int { - return 0 + - m.GetID().Size() + - m.GetOwnerID().Size() + - m.GetMessageID().Size() +func (m DeleteRequest) SignedDataSize() (sz int) { + sz += m.GetID().Size() + + sz += m.GetOwnerID().Size() + + sz += m.GetMessageID().Size() + + return } // ReadSignedData copies payload bytes to passed buffer. diff --git a/bootstrap/sign.go b/bootstrap/sign.go new file mode 100644 index 0000000..97d8640 --- /dev/null +++ b/bootstrap/sign.go @@ -0,0 +1,48 @@ +package bootstrap + +import "io" + +// SignedData returns payload bytes of the request. +func (m Request) SignedData() ([]byte, error) { + data := make([]byte, m.SignedDataSize()) + + if _, err := m.ReadSignedData(data); err != nil { + return nil, err + } + + return data, nil +} + +// SignedDataSize returns payload size of the request. +func (m Request) SignedDataSize() (sz int) { + sz += m.GetType().Size() + + sz += m.GetState().Size() + + info := m.GetInfo() + sz += info.Size() + + return +} + +// ReadSignedData copies payload bytes to passed buffer. +// +// If the Request size is insufficient, io.ErrUnexpectedEOF returns. +func (m Request) ReadSignedData(p []byte) (int, error) { + if len(p) < m.SignedDataSize() { + return 0, io.ErrUnexpectedEOF + } + + var off int + + off += copy(p[off:], m.GetType().Bytes()) + + off += copy(p[off:], m.GetState().Bytes()) + + info := m.GetInfo() + // FIXME: implement and use stable functions + n, err := info.MarshalTo(p[off:]) + off += n + + return off, err +} diff --git a/bootstrap/sign_test.go b/bootstrap/sign_test.go new file mode 100644 index 0000000..2c76117 --- /dev/null +++ b/bootstrap/sign_test.go @@ -0,0 +1,82 @@ +package bootstrap + +import ( + "testing" + + "github.com/nspcc-dev/neofs-api-go/service" + "github.com/nspcc-dev/neofs-crypto/test" + "github.com/stretchr/testify/require" +) + +func TestRequestSign(t *testing.T) { + sk := test.DecodeKey(0) + + type sigType interface { + service.SignedDataWithToken + service.SignKeyPairAccumulator + service.SignKeyPairSource + SetToken(*service.Token) + } + + items := []struct { + constructor func() sigType + payloadCorrupt []func(sigType) + }{ + { // Request + constructor: func() sigType { + return new(Request) + }, + payloadCorrupt: []func(sigType){ + func(s sigType) { + req := s.(*Request) + + req.SetType(req.GetType() + 1) + }, + func(s sigType) { + req := s.(*Request) + + req.SetState(req.GetState() + 1) + }, + func(s sigType) { + req := s.(*Request) + + info := req.GetInfo() + info.Address += "1" + + req.SetInfo(info) + }, + }, + }, + } + + for _, item := range items { + { // token corruptions + v := item.constructor() + + token := new(service.Token) + v.SetToken(token) + + require.NoError(t, service.SignDataWithSessionToken(sk, v)) + + require.NoError(t, service.VerifyAccumulatedSignaturesWithToken(v)) + + token.SetSessionKey(append(token.GetSessionKey(), 1)) + + require.Error(t, service.VerifyAccumulatedSignaturesWithToken(v)) + } + + { // payload corruptions + for _, corruption := range item.payloadCorrupt { + v := item.constructor() + + require.NoError(t, service.SignDataWithSessionToken(sk, v)) + + require.NoError(t, service.VerifyAccumulatedSignaturesWithToken(v)) + + corruption(v) + + require.Error(t, service.VerifyAccumulatedSignaturesWithToken(v)) + } + } + } +} diff --git a/bootstrap/types.go b/bootstrap/types.go index 690d81c..eacc41e 100644 --- a/bootstrap/types.go +++ b/bootstrap/types.go @@ -2,6 +2,7 @@ package bootstrap import ( "bytes" + "encoding/binary" "encoding/hex" "strconv" "strings" @@ -27,6 +28,8 @@ var ( _ proto.Message = (*SpreadMap)(nil) ) +var requestEndianness = binary.BigEndian + // Equals checks whether two NodeInfo has same address. func (m NodeInfo) Equals(n1 NodeInfo) bool { return m.Address == n1.Address && bytes.Equal(m.PubKey, n1.PubKey) @@ -98,3 +101,35 @@ func (m SpreadMap) String() string { ", " + "Netmap: [" + strings.Join(result, ",") + "]>" } + +// GetType is a Type field getter. +func (m Request) GetType() NodeType { + return m.Type +} + +// SetType is a Type field setter. +func (m *Request) SetType(t NodeType) { + m.Type = t +} + +// SetState is a State field setter. +func (m *Request) SetState(state Request_State) { + m.State = state +} + +// SetInfo is an Info field getter. +func (m *Request) SetInfo(info NodeInfo) { + m.Info = info +} + +func (x Request_State) Size() int { + return 4 +} + +func (x Request_State) Bytes() []byte { + data := make([]byte, x.Size()) + + requestEndianness.PutUint32(data, uint32(x)) + + return data +} diff --git a/bootstrap/types_test.go b/bootstrap/types_test.go new file mode 100644 index 0000000..20b1b1a --- /dev/null +++ b/bootstrap/types_test.go @@ -0,0 +1,39 @@ +package bootstrap + +import ( + "testing" + + "github.com/stretchr/testify/require" +) + +func TestRequestGettersSetters(t *testing.T) { + t.Run("type", func(t *testing.T) { + rt := NodeType(1) + m := new(Request) + + m.SetType(rt) + + require.Equal(t, rt, m.GetType()) + }) + + t.Run("state", func(t *testing.T) { + st := Request_State(1) + m := new(Request) + + m.SetState(st) + + require.Equal(t, st, m.GetState()) + }) + + t.Run("info", func(t *testing.T) { + info := NodeInfo{ + Address: "some address", + } + + m := new(Request) + + m.SetInfo(info) + + require.Equal(t, info, m.GetInfo()) + }) +} diff --git a/service/role.go b/service/role.go index 4c405c1..3af09ab 100644 --- a/service/role.go +++ b/service/role.go @@ -1,5 +1,7 @@ package service +import "encoding/binary" + const ( _ NodeRole = iota // InnerRingNode that work like IR node. @@ -19,3 +21,15 @@ func (nt NodeRole) String() string { return "Unknown" } } + +func (nt NodeRole) Size() int { + return 4 +} + +func (nt NodeRole) Bytes() []byte { + data := make([]byte, nt.Size()) + + binary.BigEndian.PutUint32(data, uint32(nt)) + + return data +} From 2d53ebf9c42dcfc95c8675c1083570a06c631614 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 11 May 2020 14:37:16 +0300 Subject: [PATCH 0202/1196] container: implement SignedDataSource on PutRequest message --- container/sign.go | 66 +++++++++++++++++++++++++++ container/sign_test.go | 98 +++++++++++++++++++++++++++++++++++++++++ container/types.go | 35 +++++++++++++++ container/types_test.go | 52 ++++++++++++++++++++++ 4 files changed, 251 insertions(+) create mode 100644 container/sign.go create mode 100644 container/sign_test.go diff --git a/container/sign.go b/container/sign.go new file mode 100644 index 0000000..f551989 --- /dev/null +++ b/container/sign.go @@ -0,0 +1,66 @@ +package container + +import ( + "encoding/binary" + "io" +) + +var requestEndianness = binary.BigEndian + +// SignedData returns payload bytes of the request. +func (m PutRequest) SignedData() ([]byte, error) { + data := make([]byte, m.SignedDataSize()) + + if _, err := m.ReadSignedData(data); err != nil { + return nil, err + } + + return data, nil +} + +// SignedDataSize returns payload size of the request. +func (m PutRequest) SignedDataSize() (sz int) { + sz += m.GetMessageID().Size() + + sz += 8 + + sz += m.GetOwnerID().Size() + + rules := m.GetRules() + sz += rules.Size() + + sz += 4 + + return +} + +// ReadSignedData copies payload bytes to passed buffer. +// +// If the Request size is insufficient, io.ErrUnexpectedEOF returns. +func (m PutRequest) ReadSignedData(p []byte) (int, error) { + if len(p) < m.SignedDataSize() { + return 0, io.ErrUnexpectedEOF + } + + var off int + + off += copy(p[off:], m.GetMessageID().Bytes()) + + requestEndianness.PutUint64(p[off:], m.GetCapacity()) + off += 8 + + off += copy(p[off:], m.GetOwnerID().Bytes()) + + rules := m.GetRules() + // FIXME: implement and use stable functions + n, err := rules.MarshalTo(p[off:]) + off += n + if err != nil { + return off, err + } + + requestEndianness.PutUint32(p[off:], m.GetBasicACL()) + off += 4 + + return off, nil +} diff --git a/container/sign_test.go b/container/sign_test.go new file mode 100644 index 0000000..f1476ed --- /dev/null +++ b/container/sign_test.go @@ -0,0 +1,98 @@ +package container + +import ( + "testing" + + "github.com/nspcc-dev/neofs-api-go/service" + "github.com/nspcc-dev/neofs-crypto/test" + "github.com/stretchr/testify/require" +) + +func TestRequestSign(t *testing.T) { + sk := test.DecodeKey(0) + + type sigType interface { + service.SignedDataWithToken + service.SignKeyPairAccumulator + service.SignKeyPairSource + SetToken(*service.Token) + } + + items := []struct { + constructor func() sigType + payloadCorrupt []func(sigType) + }{ + { // Request + constructor: func() sigType { + return new(PutRequest) + }, + payloadCorrupt: []func(sigType){ + func(s sigType) { + req := s.(*PutRequest) + + id := req.GetMessageID() + id[0]++ + + req.SetMessageID(id) + }, + func(s sigType) { + req := s.(*PutRequest) + + req.SetCapacity(req.GetCapacity() + 1) + }, + func(s sigType) { + req := s.(*PutRequest) + + owner := req.GetOwnerID() + owner[0]++ + + req.SetOwnerID(owner) + }, + func(s sigType) { + req := s.(*PutRequest) + + rules := req.GetRules() + rules.ReplFactor++ + + req.SetRules(rules) + }, + func(s sigType) { + req := s.(*PutRequest) + + req.SetBasicACL(req.GetBasicACL() + 1) + }, + }, + }, + } + + for _, item := range items { + { // token corruptions + v := item.constructor() + + token := new(service.Token) + v.SetToken(token) + + require.NoError(t, service.SignDataWithSessionToken(sk, v)) + + require.NoError(t, service.VerifyAccumulatedSignaturesWithToken(v)) + + token.SetSessionKey(append(token.GetSessionKey(), 1)) + + require.Error(t, service.VerifyAccumulatedSignaturesWithToken(v)) + } + + { // payload corruptions + for _, corruption := range item.payloadCorrupt { + v := item.constructor() + + require.NoError(t, service.SignDataWithSessionToken(sk, v)) + + require.NoError(t, service.VerifyAccumulatedSignaturesWithToken(v)) + + corruption(v) + + require.Error(t, service.VerifyAccumulatedSignaturesWithToken(v)) + } + } + } +} diff --git a/container/types.go b/container/types.go index e358e6d..39cef43 100644 --- a/container/types.go +++ b/container/types.go @@ -93,3 +93,38 @@ func NewTestContainer() (*Container, error) { }, }) } + +// GetMessageID is a MessageID field getter. +func (m PutRequest) GetMessageID() MessageID { + return m.MessageID +} + +// SetMessageID is a MessageID field getter. +func (m *PutRequest) SetMessageID(id MessageID) { + m.MessageID = id +} + +// SetCapacity is a Capacity field setter. +func (m *PutRequest) SetCapacity(c uint64) { + m.Capacity = c +} + +// GetOwnerID is an OwnerID field getter. +func (m PutRequest) GetOwnerID() OwnerID { + return m.OwnerID +} + +// SetOwnerID is an OwnerID field setter. +func (m *PutRequest) SetOwnerID(owner OwnerID) { + m.OwnerID = owner +} + +// SetRules is a Rules field setter. +func (m *PutRequest) SetRules(rules netmap.PlacementRule) { + m.Rules = rules +} + +// SetBasicACL is a BasicACL field setter. +func (m *PutRequest) SetBasicACL(acl uint32) { + m.BasicACL = acl +} diff --git a/container/types_test.go b/container/types_test.go index fddccb3..07298bc 100644 --- a/container/types_test.go +++ b/container/types_test.go @@ -55,3 +55,55 @@ func TestCID(t *testing.T) { require.Equal(t, cid1, cid2) }) } + +func TestPutRequestGettersSetters(t *testing.T) { + t.Run("owner", func(t *testing.T) { + owner := OwnerID{1, 2, 3} + m := new(PutRequest) + + m.SetOwnerID(owner) + + require.Equal(t, owner, m.GetOwnerID()) + }) + + t.Run("capacity", func(t *testing.T) { + cp := uint64(3) + m := new(PutRequest) + + m.SetCapacity(cp) + + require.Equal(t, cp, m.GetCapacity()) + }) + + t.Run("message ID", func(t *testing.T) { + id, err := refs.NewUUID() + require.NoError(t, err) + + m := new(PutRequest) + + m.SetMessageID(id) + + require.Equal(t, id, m.GetMessageID()) + }) + + t.Run("rules", func(t *testing.T) { + rules := netmap.PlacementRule{ + ReplFactor: 1, + } + + m := new(PutRequest) + + m.SetRules(rules) + + require.Equal(t, rules, m.GetRules()) + }) + + t.Run("basic ACL", func(t *testing.T) { + bACL := uint32(5) + m := new(PutRequest) + + m.SetBasicACL(bACL) + + require.Equal(t, bACL, m.GetBasicACL()) + }) +} From eedb97d1355437461b71c02d7aff8cafb43786d7 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 11 May 2020 15:01:29 +0300 Subject: [PATCH 0203/1196] container: implement SignedDataSource on DeleteRequest message --- container/sign.go | 31 +++++++++++++++++++++++++++++++ container/sign_test.go | 17 ++++++++++++++++- container/types.go | 10 ++++++++++ container/types_test.go | 11 +++++++++++ 4 files changed, 68 insertions(+), 1 deletion(-) diff --git a/container/sign.go b/container/sign.go index f551989..d9405b8 100644 --- a/container/sign.go +++ b/container/sign.go @@ -64,3 +64,34 @@ func (m PutRequest) ReadSignedData(p []byte) (int, error) { return off, nil } + +// SignedData returns payload bytes of the request. +func (m DeleteRequest) SignedData() ([]byte, error) { + data := make([]byte, m.SignedDataSize()) + + if _, err := m.ReadSignedData(data); err != nil { + return nil, err + } + + return data, nil +} + +// SignedDataSize returns payload size of the request. +func (m DeleteRequest) SignedDataSize() (sz int) { + return m.GetCID().Size() +} + +// ReadSignedData copies payload bytes to passed buffer. +// +// If the Request size is insufficient, io.ErrUnexpectedEOF returns. +func (m DeleteRequest) ReadSignedData(p []byte) (int, error) { + if len(p) < m.SignedDataSize() { + return 0, io.ErrUnexpectedEOF + } + + var off int + + off += copy(p[off:], m.GetCID().Bytes()) + + return off, nil +} diff --git a/container/sign_test.go b/container/sign_test.go index f1476ed..caa3516 100644 --- a/container/sign_test.go +++ b/container/sign_test.go @@ -22,7 +22,7 @@ func TestRequestSign(t *testing.T) { constructor func() sigType payloadCorrupt []func(sigType) }{ - { // Request + { // PutRequest constructor: func() sigType { return new(PutRequest) }, @@ -63,6 +63,21 @@ func TestRequestSign(t *testing.T) { }, }, }, + { // DeleteRequest + constructor: func() sigType { + return new(DeleteRequest) + }, + payloadCorrupt: []func(sigType){ + func(s sigType) { + req := s.(*DeleteRequest) + + cid := req.GetCID() + cid[0]++ + + req.SetCID(cid) + }, + }, + }, } for _, item := range items { diff --git a/container/types.go b/container/types.go index 39cef43..eeabe35 100644 --- a/container/types.go +++ b/container/types.go @@ -128,3 +128,13 @@ func (m *PutRequest) SetRules(rules netmap.PlacementRule) { func (m *PutRequest) SetBasicACL(acl uint32) { m.BasicACL = acl } + +// GetCID is a CID field getter. +func (m DeleteRequest) GetCID() CID { + return m.CID +} + +// SetCID is a CID field setter. +func (m *DeleteRequest) SetCID(cid CID) { + m.CID = cid +} diff --git a/container/types_test.go b/container/types_test.go index 07298bc..c1dafcc 100644 --- a/container/types_test.go +++ b/container/types_test.go @@ -107,3 +107,14 @@ func TestPutRequestGettersSetters(t *testing.T) { require.Equal(t, bACL, m.GetBasicACL()) }) } + +func TestDeleteRequestGettersSetters(t *testing.T) { + t.Run("cid", func(t *testing.T) { + cid := CID{1, 2, 3} + m := new(DeleteRequest) + + m.SetCID(cid) + + require.Equal(t, cid, m.GetCID()) + }) +} From a41f22782b588ae4b250974ab2f5ed079f56ac5b Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 11 May 2020 15:05:03 +0300 Subject: [PATCH 0204/1196] container: implement SignedDataSource on GetRequest message --- container/sign.go | 31 +++++++++++++++++++++++++++++++ container/sign_test.go | 15 +++++++++++++++ container/types.go | 10 ++++++++++ container/types_test.go | 11 +++++++++++ 4 files changed, 67 insertions(+) diff --git a/container/sign.go b/container/sign.go index d9405b8..89c4a4c 100644 --- a/container/sign.go +++ b/container/sign.go @@ -95,3 +95,34 @@ func (m DeleteRequest) ReadSignedData(p []byte) (int, error) { return off, nil } + +// SignedData returns payload bytes of the request. +func (m GetRequest) SignedData() ([]byte, error) { + data := make([]byte, m.SignedDataSize()) + + if _, err := m.ReadSignedData(data); err != nil { + return nil, err + } + + return data, nil +} + +// SignedDataSize returns payload size of the request. +func (m GetRequest) SignedDataSize() (sz int) { + return m.GetCID().Size() +} + +// ReadSignedData copies payload bytes to passed buffer. +// +// If the Request size is insufficient, io.ErrUnexpectedEOF returns. +func (m GetRequest) ReadSignedData(p []byte) (int, error) { + if len(p) < m.SignedDataSize() { + return 0, io.ErrUnexpectedEOF + } + + var off int + + off += copy(p[off:], m.GetCID().Bytes()) + + return off, nil +} diff --git a/container/sign_test.go b/container/sign_test.go index caa3516..fb11fab 100644 --- a/container/sign_test.go +++ b/container/sign_test.go @@ -74,6 +74,21 @@ func TestRequestSign(t *testing.T) { cid := req.GetCID() cid[0]++ + req.SetCID(cid) + }, + }, + }, + { // GetRequest + constructor: func() sigType { + return new(GetRequest) + }, + payloadCorrupt: []func(sigType){ + func(s sigType) { + req := s.(*GetRequest) + + cid := req.GetCID() + cid[0]++ + req.SetCID(cid) }, }, diff --git a/container/types.go b/container/types.go index eeabe35..b34c51b 100644 --- a/container/types.go +++ b/container/types.go @@ -138,3 +138,13 @@ func (m DeleteRequest) GetCID() CID { func (m *DeleteRequest) SetCID(cid CID) { m.CID = cid } + +// GetCID is a CID field getter. +func (m GetRequest) GetCID() CID { + return m.CID +} + +// SetCID is a CID field setter. +func (m *GetRequest) SetCID(cid CID) { + m.CID = cid +} diff --git a/container/types_test.go b/container/types_test.go index c1dafcc..3c12072 100644 --- a/container/types_test.go +++ b/container/types_test.go @@ -118,3 +118,14 @@ func TestDeleteRequestGettersSetters(t *testing.T) { require.Equal(t, cid, m.GetCID()) }) } + +func TestGetRequestGettersSetters(t *testing.T) { + t.Run("cid", func(t *testing.T) { + cid := CID{1, 2, 3} + m := new(GetRequest) + + m.SetCID(cid) + + require.Equal(t, cid, m.GetCID()) + }) +} From f91adcb5607f62095b4ca2f5343b9fe00af7a70e Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 11 May 2020 15:17:11 +0300 Subject: [PATCH 0205/1196] container: implement SignedDataSource on ListRequest message --- container/sign.go | 35 +++++++++++++++++++++++++++++++++-- container/sign_test.go | 15 +++++++++++++++ container/types.go | 10 ++++++++++ container/types_test.go | 11 +++++++++++ 4 files changed, 69 insertions(+), 2 deletions(-) diff --git a/container/sign.go b/container/sign.go index 89c4a4c..0f5fc93 100644 --- a/container/sign.go +++ b/container/sign.go @@ -77,7 +77,7 @@ func (m DeleteRequest) SignedData() ([]byte, error) { } // SignedDataSize returns payload size of the request. -func (m DeleteRequest) SignedDataSize() (sz int) { +func (m DeleteRequest) SignedDataSize() int { return m.GetCID().Size() } @@ -108,7 +108,7 @@ func (m GetRequest) SignedData() ([]byte, error) { } // SignedDataSize returns payload size of the request. -func (m GetRequest) SignedDataSize() (sz int) { +func (m GetRequest) SignedDataSize() int { return m.GetCID().Size() } @@ -126,3 +126,34 @@ func (m GetRequest) ReadSignedData(p []byte) (int, error) { return off, nil } + +// SignedData returns payload bytes of the request. +func (m ListRequest) SignedData() ([]byte, error) { + data := make([]byte, m.SignedDataSize()) + + if _, err := m.ReadSignedData(data); err != nil { + return nil, err + } + + return data, nil +} + +// SignedDataSize returns payload size of the request. +func (m ListRequest) SignedDataSize() int { + return m.GetOwnerID().Size() +} + +// ReadSignedData copies payload bytes to passed buffer. +// +// If the Request size is insufficient, io.ErrUnexpectedEOF returns. +func (m ListRequest) ReadSignedData(p []byte) (int, error) { + if len(p) < m.SignedDataSize() { + return 0, io.ErrUnexpectedEOF + } + + var off int + + off += copy(p[off:], m.GetOwnerID().Bytes()) + + return off, nil +} diff --git a/container/sign_test.go b/container/sign_test.go index fb11fab..e469399 100644 --- a/container/sign_test.go +++ b/container/sign_test.go @@ -93,6 +93,21 @@ func TestRequestSign(t *testing.T) { }, }, }, + { // ListRequest + constructor: func() sigType { + return new(ListRequest) + }, + payloadCorrupt: []func(sigType){ + func(s sigType) { + req := s.(*ListRequest) + + owner := req.GetOwnerID() + owner[0]++ + + req.SetOwnerID(owner) + }, + }, + }, } for _, item := range items { diff --git a/container/types.go b/container/types.go index b34c51b..f340aa5 100644 --- a/container/types.go +++ b/container/types.go @@ -148,3 +148,13 @@ func (m GetRequest) GetCID() CID { func (m *GetRequest) SetCID(cid CID) { m.CID = cid } + +// GetOwnerID is an OwnerID field getter. +func (m ListRequest) GetOwnerID() OwnerID { + return m.OwnerID +} + +// SetOwnerID is an OwnerID field setter. +func (m *ListRequest) SetOwnerID(owner OwnerID) { + m.OwnerID = owner +} diff --git a/container/types_test.go b/container/types_test.go index 3c12072..cc171cb 100644 --- a/container/types_test.go +++ b/container/types_test.go @@ -129,3 +129,14 @@ func TestGetRequestGettersSetters(t *testing.T) { require.Equal(t, cid, m.GetCID()) }) } + +func TestListRequestGettersSetters(t *testing.T) { + t.Run("owner", func(t *testing.T) { + owner := OwnerID{1, 2, 3} + m := new(PutRequest) + + m.SetOwnerID(owner) + + require.Equal(t, owner, m.GetOwnerID()) + }) +} From 539e93e558a58c596f9fe8a4118f35d0a27760d3 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 11 May 2020 16:05:41 +0300 Subject: [PATCH 0206/1196] state: implement SignedDataSource on NetmapRequest message --- state/sign.go | 8 ++++++ state/sign_test.go | 62 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+) create mode 100644 state/sign.go create mode 100644 state/sign_test.go diff --git a/state/sign.go b/state/sign.go new file mode 100644 index 0000000..c0d4c7f --- /dev/null +++ b/state/sign.go @@ -0,0 +1,8 @@ +package state + +// SignedData returns payload bytes of the request. +// +// Always returns empty slice. +func (m NetmapRequest) SignedData() ([]byte, error) { + return make([]byte, 0), nil +} diff --git a/state/sign_test.go b/state/sign_test.go new file mode 100644 index 0000000..8f9a98f --- /dev/null +++ b/state/sign_test.go @@ -0,0 +1,62 @@ +package state + +import ( + "testing" + + "github.com/nspcc-dev/neofs-api-go/service" + "github.com/nspcc-dev/neofs-crypto/test" + "github.com/stretchr/testify/require" +) + +func TestRequestSign(t *testing.T) { + sk := test.DecodeKey(0) + + type sigType interface { + service.SignedDataWithToken + service.SignKeyPairAccumulator + service.SignKeyPairSource + SetToken(*service.Token) + } + + items := []struct { + constructor func() sigType + payloadCorrupt []func(sigType) + }{ + { // NetmapRequest + constructor: func() sigType { + return new(NetmapRequest) + }, + }, + } + + for _, item := range items { + { // token corruptions + v := item.constructor() + + token := new(service.Token) + v.SetToken(token) + + require.NoError(t, service.SignDataWithSessionToken(sk, v)) + + require.NoError(t, service.VerifyAccumulatedSignaturesWithToken(v)) + + token.SetSessionKey(append(token.GetSessionKey(), 1)) + + require.Error(t, service.VerifyAccumulatedSignaturesWithToken(v)) + } + + { // payload corruptions + for _, corruption := range item.payloadCorrupt { + v := item.constructor() + + require.NoError(t, service.SignDataWithSessionToken(sk, v)) + + require.NoError(t, service.VerifyAccumulatedSignaturesWithToken(v)) + + corruption(v) + + require.Error(t, service.VerifyAccumulatedSignaturesWithToken(v)) + } + } + } +} From df9a04e5427f2adbc8d1f04a57f21be0a14c1e3e Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 11 May 2020 16:11:17 +0300 Subject: [PATCH 0207/1196] state: implement SignedDataSource on MetricsRequest message --- state/sign.go | 7 +++++++ state/sign_test.go | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/state/sign.go b/state/sign.go index c0d4c7f..47edada 100644 --- a/state/sign.go +++ b/state/sign.go @@ -6,3 +6,10 @@ package state func (m NetmapRequest) SignedData() ([]byte, error) { return make([]byte, 0), nil } + +// SignedData returns payload bytes of the request. +// +// Always returns empty slice. +func (m MetricsRequest) SignedData() ([]byte, error) { + return make([]byte, 0), nil +} diff --git a/state/sign_test.go b/state/sign_test.go index 8f9a98f..2e8da40 100644 --- a/state/sign_test.go +++ b/state/sign_test.go @@ -27,6 +27,11 @@ func TestRequestSign(t *testing.T) { return new(NetmapRequest) }, }, + { // MetricsRequest + constructor: func() sigType { + return new(MetricsRequest) + }, + }, } for _, item := range items { From ea12eabaf6ec0f2f081f927b0df56c5ba4883284 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 11 May 2020 16:12:49 +0300 Subject: [PATCH 0208/1196] state: implement SignedDataSource on HealthRequest message --- state/sign.go | 11 +++++++++-- state/sign_test.go | 5 +++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/state/sign.go b/state/sign.go index 47edada..f2ddd8e 100644 --- a/state/sign.go +++ b/state/sign.go @@ -2,14 +2,21 @@ package state // SignedData returns payload bytes of the request. // -// Always returns empty slice. +// Always returns an empty slice. func (m NetmapRequest) SignedData() ([]byte, error) { return make([]byte, 0), nil } // SignedData returns payload bytes of the request. // -// Always returns empty slice. +// Always returns an empty slice. func (m MetricsRequest) SignedData() ([]byte, error) { return make([]byte, 0), nil } + +// SignedData returns payload bytes of the request. +// +// Always returns an empty slice. +func (m HealthRequest) SignedData() ([]byte, error) { + return make([]byte, 0), nil +} diff --git a/state/sign_test.go b/state/sign_test.go index 2e8da40..b5b4912 100644 --- a/state/sign_test.go +++ b/state/sign_test.go @@ -32,6 +32,11 @@ func TestRequestSign(t *testing.T) { return new(MetricsRequest) }, }, + { // HealthRequest + constructor: func() sigType { + return new(HealthRequest) + }, + }, } for _, item := range items { From 603db9c3254808d679df1dfa39f50b43c5b46eab Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 11 May 2020 16:15:31 +0300 Subject: [PATCH 0209/1196] state: implement SignedDataSource on DumpRequest message --- state/sign.go | 7 +++++++ state/sign_test.go | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/state/sign.go b/state/sign.go index f2ddd8e..aaf1a2d 100644 --- a/state/sign.go +++ b/state/sign.go @@ -20,3 +20,10 @@ func (m MetricsRequest) SignedData() ([]byte, error) { func (m HealthRequest) SignedData() ([]byte, error) { return make([]byte, 0), nil } + +// SignedData returns payload bytes of the request. +// +// Always returns an empty slice. +func (m DumpRequest) SignedData() ([]byte, error) { + return make([]byte, 0), nil +} diff --git a/state/sign_test.go b/state/sign_test.go index b5b4912..cc525bc 100644 --- a/state/sign_test.go +++ b/state/sign_test.go @@ -37,6 +37,11 @@ func TestRequestSign(t *testing.T) { return new(HealthRequest) }, }, + { // DumpRequest + constructor: func() sigType { + return new(DumpRequest) + }, + }, } for _, item := range items { From 5545b25a95de39ed790c471511cea420fa3d00ad Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 11 May 2020 16:16:54 +0300 Subject: [PATCH 0210/1196] state: implement SignedDataSource on DumpVarsRequest message --- state/sign.go | 7 +++++++ state/sign_test.go | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/state/sign.go b/state/sign.go index aaf1a2d..8316b52 100644 --- a/state/sign.go +++ b/state/sign.go @@ -27,3 +27,10 @@ func (m HealthRequest) SignedData() ([]byte, error) { func (m DumpRequest) SignedData() ([]byte, error) { return make([]byte, 0), nil } + +// SignedData returns payload bytes of the request. +// +// Always returns an empty slice. +func (m DumpVarsRequest) SignedData() ([]byte, error) { + return make([]byte, 0), nil +} diff --git a/state/sign_test.go b/state/sign_test.go index cc525bc..dd55d21 100644 --- a/state/sign_test.go +++ b/state/sign_test.go @@ -42,6 +42,11 @@ func TestRequestSign(t *testing.T) { return new(DumpRequest) }, }, + { // DumpVarsRequest + constructor: func() sigType { + return new(DumpVarsRequest) + }, + }, } for _, item := range items { From ab198b404966640a2c78a155d66cda816f639fe8 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 11 May 2020 16:31:39 +0300 Subject: [PATCH 0211/1196] state: implement SignedDataSource on ChangeStateRequest message --- state/sign.go | 35 +++++++++++++++++++++++++++++++++++ state/sign_test.go | 12 ++++++++++++ state/types.go | 24 ++++++++++++++++++++++++ state/types_test.go | 18 ++++++++++++++++++ 4 files changed, 89 insertions(+) create mode 100644 state/types.go create mode 100644 state/types_test.go diff --git a/state/sign.go b/state/sign.go index 8316b52..9193ebc 100644 --- a/state/sign.go +++ b/state/sign.go @@ -1,5 +1,9 @@ package state +import ( + "io" +) + // SignedData returns payload bytes of the request. // // Always returns an empty slice. @@ -34,3 +38,34 @@ func (m DumpRequest) SignedData() ([]byte, error) { func (m DumpVarsRequest) SignedData() ([]byte, error) { return make([]byte, 0), nil } + +// SignedData returns payload bytes of the request. +func (m ChangeStateRequest) SignedData() ([]byte, error) { + data := make([]byte, m.SignedDataSize()) + + if _, err := m.ReadSignedData(data); err != nil { + return nil, err + } + + return data, nil +} + +// SignedDataSize returns payload size of the request. +func (m ChangeStateRequest) SignedDataSize() int { + return m.GetState().Size() +} + +// ReadSignedData copies payload bytes to passed buffer. +// +// If the Request size is insufficient, io.ErrUnexpectedEOF returns. +func (m ChangeStateRequest) ReadSignedData(p []byte) (int, error) { + if len(p) < m.SignedDataSize() { + return 0, io.ErrUnexpectedEOF + } + + var off int + + off += copy(p[off:], m.GetState().Bytes()) + + return off, nil +} diff --git a/state/sign_test.go b/state/sign_test.go index dd55d21..9b2bca9 100644 --- a/state/sign_test.go +++ b/state/sign_test.go @@ -47,6 +47,18 @@ func TestRequestSign(t *testing.T) { return new(DumpVarsRequest) }, }, + { + constructor: func() sigType { + return new(ChangeStateRequest) + }, + payloadCorrupt: []func(sigType){ + func(s sigType) { + req := s.(*ChangeStateRequest) + + req.SetState(req.GetState() + 1) + }, + }, + }, } for _, item := range items { diff --git a/state/types.go b/state/types.go new file mode 100644 index 0000000..6b572db --- /dev/null +++ b/state/types.go @@ -0,0 +1,24 @@ +package state + +import ( + "encoding/binary" +) + +// SetState is a State field setter. +func (m *ChangeStateRequest) SetState(st ChangeStateRequest_State) { + m.State = st +} + +// Size returns the size of the state binary representation. +func (ChangeStateRequest_State) Size() int { + return 4 +} + +// Bytes returns the state binary representation. +func (x ChangeStateRequest_State) Bytes() []byte { + data := make([]byte, x.Size()) + + binary.BigEndian.PutUint32(data, uint32(x)) + + return data +} diff --git a/state/types_test.go b/state/types_test.go new file mode 100644 index 0000000..5d5f5de --- /dev/null +++ b/state/types_test.go @@ -0,0 +1,18 @@ +package state + +import ( + "testing" + + "github.com/stretchr/testify/require" +) + +func TestChangeStateRequestGettersSetters(t *testing.T) { + t.Run("state", func(t *testing.T) { + st := ChangeStateRequest_State(1) + m := new(ChangeStateRequest) + + m.SetState(st) + + require.Equal(t, st, m.GetState()) + }) +} From e01fb0cc625ab164b3d15cc951c49b5aeab50a9a Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 11 May 2020 17:28:44 +0300 Subject: [PATCH 0212/1196] Implement signed data calculating function from SignedDataReader --- accounting/sign.go | 42 +++-------------- bootstrap/sign.go | 14 +++--- container/sign.go | 34 +++----------- object/sign.go | 103 ++++++++++++++++++------------------------ service/errors.go | 4 ++ service/token.go | 6 +-- service/utils.go | 18 ++++++++ service/utils_test.go | 34 ++++++++++++++ session/request.go | 10 +--- state/sign.go | 10 ++-- 10 files changed, 126 insertions(+), 149 deletions(-) create mode 100644 service/utils.go create mode 100644 service/utils_test.go diff --git a/accounting/sign.go b/accounting/sign.go index 4c6452d..1eabed4 100644 --- a/accounting/sign.go +++ b/accounting/sign.go @@ -3,17 +3,13 @@ package accounting import ( "encoding/binary" "io" + + "github.com/nspcc-dev/neofs-api-go/service" ) // SignedData returns payload bytes of the request. func (m BalanceRequest) SignedData() ([]byte, error) { - data := make([]byte, m.SignedDataSize()) - - if _, err := m.ReadSignedData(data); err != nil { - return nil, err - } - - return data, nil + return service.SignedDataFromReader(m) } // SignedDataSize returns payload size of the request. @@ -37,13 +33,7 @@ func (m BalanceRequest) ReadSignedData(p []byte) (int, error) { // SignedData returns payload bytes of the request. func (m GetRequest) SignedData() ([]byte, error) { - data := make([]byte, m.SignedDataSize()) - - if _, err := m.ReadSignedData(data); err != nil { - return nil, err - } - - return data, nil + return service.SignedDataFromReader(m) } // SignedDataSize returns payload size of the request. @@ -71,13 +61,7 @@ func (m GetRequest) ReadSignedData(p []byte) (int, error) { // SignedData returns payload bytes of the request. func (m PutRequest) SignedData() ([]byte, error) { - data := make([]byte, m.SignedDataSize()) - - if _, err := m.ReadSignedData(data); err != nil { - return nil, err - } - - return data, nil + return service.SignedDataFromReader(m) } // SignedDataSize returns payload size of the request. @@ -125,13 +109,7 @@ func (m PutRequest) ReadSignedData(p []byte) (int, error) { // SignedData returns payload bytes of the request. func (m ListRequest) SignedData() ([]byte, error) { - data := make([]byte, m.SignedDataSize()) - - if _, err := m.ReadSignedData(data); err != nil { - return nil, err - } - - return data, nil + return service.SignedDataFromReader(m) } // SignedDataSize returns payload size of the request. @@ -155,13 +133,7 @@ func (m ListRequest) ReadSignedData(p []byte) (int, error) { // SignedData returns payload bytes of the request. func (m DeleteRequest) SignedData() ([]byte, error) { - data := make([]byte, m.SignedDataSize()) - - if _, err := m.ReadSignedData(data); err != nil { - return nil, err - } - - return data, nil + return service.SignedDataFromReader(m) } // SignedDataSize returns payload size of the request. diff --git a/bootstrap/sign.go b/bootstrap/sign.go index 97d8640..34f7fc2 100644 --- a/bootstrap/sign.go +++ b/bootstrap/sign.go @@ -1,16 +1,14 @@ package bootstrap -import "io" +import ( + "io" + + "github.com/nspcc-dev/neofs-api-go/service" +) // SignedData returns payload bytes of the request. func (m Request) SignedData() ([]byte, error) { - data := make([]byte, m.SignedDataSize()) - - if _, err := m.ReadSignedData(data); err != nil { - return nil, err - } - - return data, nil + return service.SignedDataFromReader(m) } // SignedDataSize returns payload size of the request. diff --git a/container/sign.go b/container/sign.go index 0f5fc93..eafd93c 100644 --- a/container/sign.go +++ b/container/sign.go @@ -3,19 +3,15 @@ package container import ( "encoding/binary" "io" + + service "github.com/nspcc-dev/neofs-api-go/service" ) var requestEndianness = binary.BigEndian // SignedData returns payload bytes of the request. func (m PutRequest) SignedData() ([]byte, error) { - data := make([]byte, m.SignedDataSize()) - - if _, err := m.ReadSignedData(data); err != nil { - return nil, err - } - - return data, nil + return service.SignedDataFromReader(m) } // SignedDataSize returns payload size of the request. @@ -67,13 +63,7 @@ func (m PutRequest) ReadSignedData(p []byte) (int, error) { // SignedData returns payload bytes of the request. func (m DeleteRequest) SignedData() ([]byte, error) { - data := make([]byte, m.SignedDataSize()) - - if _, err := m.ReadSignedData(data); err != nil { - return nil, err - } - - return data, nil + return service.SignedDataFromReader(m) } // SignedDataSize returns payload size of the request. @@ -98,13 +88,7 @@ func (m DeleteRequest) ReadSignedData(p []byte) (int, error) { // SignedData returns payload bytes of the request. func (m GetRequest) SignedData() ([]byte, error) { - data := make([]byte, m.SignedDataSize()) - - if _, err := m.ReadSignedData(data); err != nil { - return nil, err - } - - return data, nil + return service.SignedDataFromReader(m) } // SignedDataSize returns payload size of the request. @@ -129,13 +113,7 @@ func (m GetRequest) ReadSignedData(p []byte) (int, error) { // SignedData returns payload bytes of the request. func (m ListRequest) SignedData() ([]byte, error) { - data := make([]byte, m.SignedDataSize()) - - if _, err := m.ReadSignedData(data); err != nil { - return nil, err - } - - return data, nil + return service.SignedDataFromReader(m) } // SignedDataSize returns payload size of the request. diff --git a/object/sign.go b/object/sign.go index 25d0b2f..1ed3efa 100644 --- a/object/sign.go +++ b/object/sign.go @@ -3,34 +3,27 @@ package object import ( "encoding/binary" "io" + + "github.com/nspcc-dev/neofs-api-go/service" ) // SignedData returns payload bytes of the request. // // If payload is nil, ErrHeaderNotFound returns. func (m PutRequest) SignedData() ([]byte, error) { - sz := m.SignedDataSize() - if sz < 0 { - return nil, ErrHeaderNotFound - } - - data := make([]byte, sz) - - return data, m.ReadSignedData(data) + return service.SignedDataFromReader(m) } // ReadSignedData copies payload bytes to passed buffer. // // If the buffer size is insufficient, io.ErrUnexpectedEOF returns. -func (m PutRequest) ReadSignedData(p []byte) error { +func (m PutRequest) ReadSignedData(p []byte) (int, error) { r := m.GetR() if r == nil { - return ErrHeaderNotFound + return 0, ErrHeaderNotFound } - _, err := r.MarshalTo(p) - - return err + return r.MarshalTo(p) } // SignedDataSize returns the size of payload of the Put request. @@ -47,26 +40,26 @@ func (m PutRequest) SignedDataSize() int { // SignedData returns payload bytes of the request. func (m GetRequest) SignedData() ([]byte, error) { - data := make([]byte, m.SignedDataSize()) - - return data, m.ReadSignedData(data) + return service.SignedDataFromReader(m) } // ReadSignedData copies payload bytes to passed buffer. // // If the buffer size is insufficient, io.ErrUnexpectedEOF returns. -func (m GetRequest) ReadSignedData(p []byte) error { +func (m GetRequest) ReadSignedData(p []byte) (int, error) { addr := m.GetAddress() if len(p) < m.SignedDataSize() { - return io.ErrUnexpectedEOF + return 0, io.ErrUnexpectedEOF } - off := copy(p, addr.CID.Bytes()) + var off int - copy(p[off:], addr.ObjectID.Bytes()) + off += copy(p[off:], addr.CID.Bytes()) - return nil + off += copy(p[off:], addr.ObjectID.Bytes()) + + return off, nil } // SignedDataSize returns payload size of the request. @@ -76,28 +69,28 @@ func (m GetRequest) SignedDataSize() int { // SignedData returns payload bytes of the request. func (m HeadRequest) SignedData() ([]byte, error) { - data := make([]byte, m.SignedDataSize()) - - return data, m.ReadSignedData(data) + return service.SignedDataFromReader(m) } // ReadSignedData copies payload bytes to passed buffer. // // If the buffer size is insufficient, io.ErrUnexpectedEOF returns. -func (m HeadRequest) ReadSignedData(p []byte) error { +func (m HeadRequest) ReadSignedData(p []byte) (int, error) { if len(p) < m.SignedDataSize() { - return io.ErrUnexpectedEOF + return 0, io.ErrUnexpectedEOF } if m.GetFullHeaders() { p[0] = 1 } - off := 1 + copy(p[1:], m.Address.CID.Bytes()) + off := 1 - copy(p[off:], m.Address.ObjectID.Bytes()) + off += copy(p[off:], m.Address.CID.Bytes()) - return nil + off += copy(p[off:], m.Address.ObjectID.Bytes()) + + return off, nil } // SignedDataSize returns payload size of the request. @@ -107,24 +100,24 @@ func (m HeadRequest) SignedDataSize() int { // SignedData returns payload bytes of the request. func (m DeleteRequest) SignedData() ([]byte, error) { - data := make([]byte, m.SignedDataSize()) - - return data, m.ReadSignedData(data) + return service.SignedDataFromReader(m) } // ReadSignedData copies payload bytes to passed buffer. // // If the buffer size is insufficient, io.ErrUnexpectedEOF returns. -func (m DeleteRequest) ReadSignedData(p []byte) error { +func (m DeleteRequest) ReadSignedData(p []byte) (int, error) { if len(p) < m.SignedDataSize() { - return io.ErrUnexpectedEOF + return 0, io.ErrUnexpectedEOF } - off := copy(p, m.OwnerID.Bytes()) + var off int - copy(p[off:], addressBytes(m.Address)) + off += copy(p[off:], m.OwnerID.Bytes()) - return nil + off += copy(p[off:], addressBytes(m.Address)) + + return off, nil } // SignedDataSize returns payload size of the request. @@ -134,27 +127,25 @@ func (m DeleteRequest) SignedDataSize() int { // SignedData returns payload bytes of the request. func (m GetRangeRequest) SignedData() ([]byte, error) { - data := make([]byte, m.SignedDataSize()) - - return data, m.ReadSignedData(data) + return service.SignedDataFromReader(m) } // ReadSignedData copies payload bytes to passed buffer. // // If the buffer size is insufficient, io.ErrUnexpectedEOF returns. -func (m GetRangeRequest) ReadSignedData(p []byte) error { +func (m GetRangeRequest) ReadSignedData(p []byte) (int, error) { if len(p) < m.SignedDataSize() { - return io.ErrUnexpectedEOF + return 0, io.ErrUnexpectedEOF } n, err := (&m.Range).MarshalTo(p) if err != nil { - return err + return 0, err } - copy(p[n:], addressBytes(m.GetAddress())) + n += copy(p[n:], addressBytes(m.GetAddress())) - return nil + return n, nil } // SignedDataSize returns payload size of the request. @@ -164,17 +155,15 @@ func (m GetRangeRequest) SignedDataSize() int { // SignedData returns payload bytes of the request. func (m GetRangeHashRequest) SignedData() ([]byte, error) { - data := make([]byte, m.SignedDataSize()) - - return data, m.ReadSignedData(data) + return service.SignedDataFromReader(m) } // ReadSignedData copies payload bytes to passed buffer. // // If the buffer size is insufficient, io.ErrUnexpectedEOF returns. -func (m GetRangeHashRequest) ReadSignedData(p []byte) error { +func (m GetRangeHashRequest) ReadSignedData(p []byte) (int, error) { if len(p) < m.SignedDataSize() { - return io.ErrUnexpectedEOF + return 0, io.ErrUnexpectedEOF } var off int @@ -185,7 +174,7 @@ func (m GetRangeHashRequest) ReadSignedData(p []byte) error { off += copy(p[off:], m.GetSalt()) - return nil + return off, nil } // SignedDataSize returns payload size of the request. @@ -203,17 +192,15 @@ func (m GetRangeHashRequest) SignedDataSize() int { // SignedData returns payload bytes of the request. func (m SearchRequest) SignedData() ([]byte, error) { - data := make([]byte, m.SignedDataSize()) - - return data, m.ReadSignedData(data) + return service.SignedDataFromReader(m) } // ReadSignedData copies payload bytes to passed buffer. // // If the buffer size is insufficient, io.ErrUnexpectedEOF returns. -func (m SearchRequest) ReadSignedData(p []byte) error { +func (m SearchRequest) ReadSignedData(p []byte) (int, error) { if len(p) < m.SignedDataSize() { - return io.ErrUnexpectedEOF + return 0, io.ErrUnexpectedEOF } var off int @@ -223,9 +210,9 @@ func (m SearchRequest) ReadSignedData(p []byte) error { binary.BigEndian.PutUint32(p[off:], m.GetQueryVersion()) off += 4 - copy(p[off:], m.GetQuery()) + off += copy(p[off:], m.GetQuery()) - return nil + return off, nil } // SignedDataSize returns payload size of the request. diff --git a/service/errors.go b/service/errors.go index 6241ad2..f3a0dfc 100644 --- a/service/errors.go +++ b/service/errors.go @@ -43,3 +43,7 @@ const ErrNilDataWithTokenSignAccumulator = internal.Error("signed data with toke // ErrNilSignatureKeySourceWithToken is returned by functions that expect // a non-nil SignatureKeySourceWithToken, but received nil. const ErrNilSignatureKeySourceWithToken = internal.Error("key-signature source with token is nil") + +// ErrNilSignedDataReader is returned by functions that expect +// a non-nil SignedDataReader, but received nil. +const ErrNilSignedDataReader = internal.Error("signed data reader is nil") diff --git a/service/token.go b/service/token.go index 78fccfa..32c390f 100644 --- a/service/token.go +++ b/service/token.go @@ -123,11 +123,7 @@ func (m *Token) AddSignKey(sig []byte, _ *ecdsa.PublicKey) { // SignedData returns token information in a binary representation. func (m *Token) SignedData() ([]byte, error) { - data := make([]byte, m.SignedDataSize()) - - copyTokenSignedData(data, m) - - return data, nil + return SignedDataFromReader(m) } // ReadSignedData copies a binary representation of the token information to passed buffer. diff --git a/service/utils.go b/service/utils.go new file mode 100644 index 0000000..17b23bb --- /dev/null +++ b/service/utils.go @@ -0,0 +1,18 @@ +package service + +// SignedDataFromReader allocates buffer and reads bytes from passed reader to it. +// +// If passed SignedDataReader is nil, ErrNilSignedDataReader returns. +func SignedDataFromReader(r SignedDataReader) ([]byte, error) { + if r == nil { + return nil, ErrNilSignedDataReader + } + + data := make([]byte, r.SignedDataSize()) + + if _, err := r.ReadSignedData(data); err != nil { + return nil, err + } + + return data, nil +} diff --git a/service/utils_test.go b/service/utils_test.go new file mode 100644 index 0000000..60a2352 --- /dev/null +++ b/service/utils_test.go @@ -0,0 +1,34 @@ +package service + +import ( + "testing" + + "github.com/pkg/errors" + "github.com/stretchr/testify/require" +) + +func TestSignedDataFromReader(t *testing.T) { + // nil SignedDataReader + _, err := SignedDataFromReader(nil) + require.EqualError(t, err, ErrNilSignedDataReader.Error()) + + rdr := &testSignedDataReader{ + testSignedDataSrc: new(testSignedDataSrc), + } + + // make reader to return an error + rdr.err = errors.New("test error") + + _, err = SignedDataFromReader(rdr) + require.EqualError(t, err, rdr.err.Error()) + + // remove the error + rdr.err = nil + + // fill the data + rdr.data = testData(t, 10) + + res, err := SignedDataFromReader(rdr) + require.NoError(t, err) + require.Equal(t, rdr.data, res) +} diff --git a/session/request.go b/session/request.go index 0bb5176..73c05e5 100644 --- a/session/request.go +++ b/session/request.go @@ -5,6 +5,7 @@ import ( "io" "github.com/nspcc-dev/neofs-api-go/refs" + "github.com/nspcc-dev/neofs-api-go/service" ) const signedRequestDataSize = 0 + @@ -31,14 +32,7 @@ func (m *CreateRequest) SetOwnerID(id OwnerID) { // SignedData returns payload bytes of the request. func (m CreateRequest) SignedData() ([]byte, error) { - data := make([]byte, m.SignedDataSize()) - - _, err := m.ReadSignedData(data) - if err != nil { - return nil, err - } - - return data, nil + return service.SignedDataFromReader(m) } // SignedDataSize returns payload size of the request. diff --git a/state/sign.go b/state/sign.go index 9193ebc..88f038c 100644 --- a/state/sign.go +++ b/state/sign.go @@ -2,6 +2,8 @@ package state import ( "io" + + "github.com/nspcc-dev/neofs-api-go/service" ) // SignedData returns payload bytes of the request. @@ -41,13 +43,7 @@ func (m DumpVarsRequest) SignedData() ([]byte, error) { // SignedData returns payload bytes of the request. func (m ChangeStateRequest) SignedData() ([]byte, error) { - data := make([]byte, m.SignedDataSize()) - - if _, err := m.ReadSignedData(data); err != nil { - return nil, err - } - - return data, nil + return service.SignedDataFromReader(m) } // SignedDataSize returns payload size of the request. From b2543c073977b63d8e73f5a2bef9865897fcdecd Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 11 May 2020 17:44:59 +0300 Subject: [PATCH 0213/1196] fix comments --- bootstrap/types.go | 2 ++ service/role.go | 2 ++ 2 files changed, 4 insertions(+) diff --git a/bootstrap/types.go b/bootstrap/types.go index eacc41e..7ad3ec2 100644 --- a/bootstrap/types.go +++ b/bootstrap/types.go @@ -122,10 +122,12 @@ func (m *Request) SetInfo(info NodeInfo) { m.Info = info } +// Size returns the size necessary for a binary representation of the state. func (x Request_State) Size() int { return 4 } +// Bytes returns a binary representation of the state. func (x Request_State) Bytes() []byte { data := make([]byte, x.Size()) diff --git a/service/role.go b/service/role.go index 3af09ab..64a0074 100644 --- a/service/role.go +++ b/service/role.go @@ -22,10 +22,12 @@ func (nt NodeRole) String() string { } } +// Size returns the size necessary for a binary representation of the NodeRole. func (nt NodeRole) Size() int { return 4 } +// Bytes returns a binary representation of the NodeRole. func (nt NodeRole) Bytes() []byte { data := make([]byte, nt.Size()) From 877db6be32edb6237f5505ccd42ed669f40db3e9 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 12 May 2020 10:40:48 +0300 Subject: [PATCH 0214/1196] service: remove no longer used Sign/Verify methods and functions --- service/sign.go | 7 ++ service/verify.go | 181 ------------------------------ service/verify_test.go | 243 +++++++++++++---------------------------- 3 files changed, 85 insertions(+), 346 deletions(-) diff --git a/service/sign.go b/service/sign.go index f5cdc0b..5b1548f 100644 --- a/service/sign.go +++ b/service/sign.go @@ -2,6 +2,7 @@ package service import ( "crypto/ecdsa" + "sync" crypto "github.com/nspcc-dev/neofs-crypto" ) @@ -11,6 +12,12 @@ type keySign struct { sign []byte } +var bytesPool = sync.Pool{ + New: func() interface{} { + return make([]byte, 5<<20) + }, +} + // GetSignature is a sign field getter. func (s keySign) GetSignature() []byte { return s.sign diff --git a/service/verify.go b/service/verify.go index beca992..62db2f5 100644 --- a/service/verify.go +++ b/service/verify.go @@ -2,37 +2,9 @@ package service import ( "crypto/ecdsa" - "sync" "github.com/nspcc-dev/neofs-api-go/internal" - "github.com/nspcc-dev/neofs-api-go/refs" crypto "github.com/nspcc-dev/neofs-crypto" - "github.com/pkg/errors" -) - -type ( - // VerifiableRequest adds possibility to sign and verify request header. - VerifiableRequest interface { - Size() int - MarshalTo([]byte) (int, error) - AddSignature(*RequestVerificationHeader_Signature) - GetSignatures() []*RequestVerificationHeader_Signature - SetSignatures([]*RequestVerificationHeader_Signature) - } - - // MaintainableRequest adds possibility to set and get (+validate) - // owner (client) public key from RequestVerificationHeader. - MaintainableRequest interface { - GetOwner() (*ecdsa.PublicKey, error) - SetOwner(*ecdsa.PublicKey, []byte) - GetLastPeer() (*ecdsa.PublicKey, error) - } - - // TokenHeader is an interface of the container of a Token pointer value - TokenHeader interface { - GetToken() *Token - SetToken(*Token) - } ) // GetSessionToken returns SessionToken interface of Token field. @@ -90,164 +62,11 @@ func (m *RequestVerificationHeader) SetSignatures(signatures []*RequestVerificat m.Signatures = signatures } -// AddSignature adds new Signature into RequestVerificationHeader. -func (m *RequestVerificationHeader) AddSignature(sig *RequestVerificationHeader_Signature) { - if sig == nil { - return - } - m.Signatures = append(m.Signatures, sig) -} - -// CheckOwner validates, that passed OwnerID is equal to present PublicKey of owner. -func (m *RequestVerificationHeader) CheckOwner(owner refs.OwnerID) error { - if key, err := m.GetOwner(); err != nil { - return err - } else if user, err := refs.NewOwnerID(key); err != nil { - return err - } else if !user.Equal(owner) { - return ErrWrongOwner - } - return nil -} - -// GetOwner tries to get owner (client) public key from signatures. -// If signatures contains not empty Origin, we should try to validate, -// that session key was signed by owner (client), otherwise return error. -func (m *RequestVerificationHeader) GetOwner() (*ecdsa.PublicKey, error) { - if len(m.Signatures) == 0 { - return nil, ErrCannotFindOwner - } else if key := crypto.UnmarshalPublicKey(m.Signatures[0].Peer); key != nil { - return key, nil - } - - return nil, ErrInvalidPublicKeyBytes -} - -// GetLastPeer tries to get last peer public key from signatures. -// If signatures has zero length, returns ErrCannotFindOwner. -// If signatures has length equal to one, uses GetOwner. -// Otherwise tries to unmarshal last peer public key. -func (m *RequestVerificationHeader) GetLastPeer() (*ecdsa.PublicKey, error) { - switch ln := len(m.Signatures); ln { - case 0: - return nil, ErrCannotFindOwner - case 1: - return m.GetOwner() - default: - if key := crypto.UnmarshalPublicKey(m.Signatures[ln-1].Peer); key != nil { - return key, nil - } - - return nil, ErrInvalidPublicKeyBytes - } -} - // SetToken is a Token field setter. func (m *RequestVerificationHeader) SetToken(token *Token) { m.Token = token } -func newSignature(key *ecdsa.PrivateKey, data []byte) (*RequestVerificationHeader_Signature, error) { - sign, err := crypto.Sign(key, data) - if err != nil { - return nil, err - } - - return &RequestVerificationHeader_Signature{ - Sign: sign, - Peer: crypto.MarshalPublicKey(&key.PublicKey), - }, nil -} - -var bytesPool = sync.Pool{New: func() interface{} { - return make([]byte, 4.5*1024*1024) // 4.5MB -}} - -// SignRequestHeader receives private key and request with RequestVerificationHeader, -// tries to marshal and sign request with passed PrivateKey, after that adds -// new signature to headers. If something went wrong, returns error. -func SignRequestHeader(key *ecdsa.PrivateKey, msg VerifiableRequest) error { - // ignore meta header - if meta, ok := msg.(SeizedRequestMetaContainer); ok { - h := meta.CutMeta() - - defer func() { - meta.RestoreMeta(h) - }() - } - - data := bytesPool.Get().([]byte) - defer func() { - bytesPool.Put(data) - }() - - if size := msg.Size(); size <= cap(data) { - data = data[:size] - } else { - data = make([]byte, size) - } - - size, err := msg.MarshalTo(data) - if err != nil { - return err - } - - signature, err := newSignature(key, data[:size]) - if err != nil { - return err - } - - msg.AddSignature(signature) - - return nil -} - -// VerifyRequestHeader receives request with RequestVerificationHeader, -// tries to marshal and verify each signature from request. -// If something went wrong, returns error. -func VerifyRequestHeader(msg VerifiableRequest) error { - // ignore meta header - if meta, ok := msg.(SeizedRequestMetaContainer); ok { - h := meta.CutMeta() - - defer func() { - meta.RestoreMeta(h) - }() - } - - data := bytesPool.Get().([]byte) - signatures := msg.GetSignatures() - defer func() { - bytesPool.Put(data) - msg.SetSignatures(signatures) - }() - - for i := range signatures { - msg.SetSignatures(signatures[:i]) - peer := signatures[i].GetPeer() - sign := signatures[i].GetSign() - - key := crypto.UnmarshalPublicKey(peer) - if key == nil { - return errors.Wrapf(ErrInvalidPublicKeyBytes, "%d: %02x", i, peer) - } - - if size := msg.Size(); size <= cap(data) { - data = data[:size] - } else { - data = make([]byte, size) - } - - if size, err := msg.MarshalTo(data); err != nil { - return errors.Wrapf(err, "%d: %02x", i, peer) - } else if err := crypto.Verify(key, data[:size], sign); err != nil { - return errors.Wrapf(err, "%d: %02x", i, peer) - } - } - - return nil -} - // testCustomField for test usage only. type testCustomField [8]uint32 diff --git a/service/verify_test.go b/service/verify_test.go index 107416b..c6e4d61 100644 --- a/service/verify_test.go +++ b/service/verify_test.go @@ -1,194 +1,107 @@ package service import ( - "bytes" - "log" + "encoding/binary" + "io" "math" "testing" - "github.com/gogo/protobuf/proto" "github.com/nspcc-dev/neofs-api-go/refs" - crypto "github.com/nspcc-dev/neofs-crypto" "github.com/nspcc-dev/neofs-crypto/test" - "github.com/pkg/errors" "github.com/stretchr/testify/require" ) -func BenchmarkSignRequestHeader(b *testing.B) { +func (m TestRequest) SignedData() ([]byte, error) { + return SignedDataFromReader(m) +} + +func (m TestRequest) SignedDataSize() (sz int) { + sz += 4 + + sz += len(m.StringField) + + sz += len(m.BytesField) + + sz += m.CustomField.Size() + + return +} + +func (m TestRequest) ReadSignedData(p []byte) (int, error) { + if len(p) < m.SignedDataSize() { + return 0, io.ErrUnexpectedEOF + } + + var off int + + binary.BigEndian.PutUint32(p[off:], uint32(m.IntField)) + off += 4 + + off += copy(p[off:], []byte(m.StringField)) + + off += copy(p[off:], m.BytesField) + + n, err := m.CustomField.MarshalTo(p[off:]) + off += n + + return off, err +} + +func BenchmarkSignDataWithSessionToken(b *testing.B) { key := test.DecodeKey(0) - custom := testCustomField{1, 2, 3, 4, 5, 6, 7, 8} + customField := testCustomField{1, 2, 3, 4, 5, 6, 7, 8} - some := &TestRequest{ + token := new(Token) + + req := &TestRequest{ IntField: math.MaxInt32, StringField: "TestRequestStringField", BytesField: make([]byte, 1<<22), - CustomField: &custom, - RequestMetaHeader: RequestMetaHeader{ - TTL: math.MaxInt32 - 8, - Epoch: math.MaxInt64 - 12, - }, + CustomField: &customField, + } + + req.SetTTL(math.MaxInt32 - 8) + req.SetEpoch(math.MaxInt64 - 12) + req.SetToken(token) + + b.ResetTimer() + b.ReportAllocs() + + for i := 0; i < b.N; i++ { + require.NoError(b, SignDataWithSessionToken(key, req)) + } +} + +func BenchmarkVerifyAccumulatedSignaturesWithToken(b *testing.B) { + customField := testCustomField{1, 2, 3, 4, 5, 6, 7, 8} + + token := new(Token) + + req := &TestRequest{ + IntField: math.MaxInt32, + StringField: "TestRequestStringField", + BytesField: make([]byte, 1<<22), + CustomField: &customField, + } + + req.SetTTL(math.MaxInt32 - 8) + req.SetEpoch(math.MaxInt64 - 12) + req.SetToken(token) + + for i := 0; i < 10; i++ { + key := test.DecodeKey(i) + require.NoError(b, SignDataWithSessionToken(key, req)) } b.ResetTimer() b.ReportAllocs() for i := 0; i < b.N; i++ { - require.NoError(b, SignRequestHeader(key, some)) + require.NoError(b, VerifyAccumulatedSignaturesWithToken(req)) } } -func BenchmarkVerifyRequestHeader(b *testing.B) { - custom := testCustomField{1, 2, 3, 4, 5, 6, 7, 8} - - some := &TestRequest{ - IntField: math.MaxInt32, - StringField: "TestRequestStringField", - BytesField: make([]byte, 1<<22), - CustomField: &custom, - RequestMetaHeader: RequestMetaHeader{ - TTL: math.MaxInt32 - 8, - Epoch: math.MaxInt64 - 12, - }, - } - - for i := 0; i < 10; i++ { - key := test.DecodeKey(i) - require.NoError(b, SignRequestHeader(key, some)) - } - - b.ResetTimer() - b.ReportAllocs() - - for i := 0; i < b.N; i++ { - require.NoError(b, VerifyRequestHeader(some)) - } -} - -func TestSignRequestHeader(t *testing.T) { - req := &TestRequest{ - IntField: math.MaxInt32, - StringField: "TestRequestStringField", - BytesField: []byte("TestRequestBytesField"), - } - - key := test.DecodeKey(0) - peer := crypto.MarshalPublicKey(&key.PublicKey) - - data, err := req.Marshal() - require.NoError(t, err) - - require.NoError(t, SignRequestHeader(key, req)) - - require.Len(t, req.Signatures, 1) - for i := range req.Signatures { - sign := req.Signatures[i].GetSign() - require.Equal(t, peer, req.Signatures[i].GetPeer()) - require.NoError(t, crypto.Verify(&key.PublicKey, data, sign)) - } -} - -func TestVerifyRequestHeader(t *testing.T) { - req := &TestRequest{ - IntField: math.MaxInt32, - StringField: "TestRequestStringField", - BytesField: []byte("TestRequestBytesField"), - RequestMetaHeader: RequestMetaHeader{TTL: 10}, - } - - for i := 0; i < 10; i++ { - req.TTL-- - require.NoError(t, SignRequestHeader(test.DecodeKey(i), req)) - } - - require.NoError(t, VerifyRequestHeader(req)) -} - -func TestMaintainableRequest(t *testing.T) { - req := &TestRequest{ - IntField: math.MaxInt32, - StringField: "TestRequestStringField", - BytesField: []byte("TestRequestBytesField"), - RequestMetaHeader: RequestMetaHeader{TTL: 10}, - } - - count := 10 - owner := test.DecodeKey(count + 1) - - for i := 0; i < count; i++ { - req.TTL-- - - key := test.DecodeKey(i) - - // sign first key (session key) by owner key - if i == 0 { - key = owner - } - - require.NoError(t, SignRequestHeader(key, req)) - } - - { // Validate owner - user, err := refs.NewOwnerID(&owner.PublicKey) - require.NoError(t, err) - require.NoError(t, req.CheckOwner(user)) - } - - { // Good case: - require.NoError(t, VerifyRequestHeader(req)) - - // validate, that first key (session key) was signed with owner - signatures := req.GetSignatures() - - require.Len(t, signatures, count) - - pub, err := req.GetOwner() - require.NoError(t, err) - - require.Equal(t, &owner.PublicKey, pub) - } - - { // Wrong signatures: - copy(req.Signatures[count-1].Sign, req.Signatures[count-2].Sign) - err := VerifyRequestHeader(req) - require.EqualError(t, errors.Cause(err), crypto.ErrInvalidSignature.Error()) - } -} - -func TestVerifyAndSignRequestHeaderWithoutCloning(t *testing.T) { - key := test.DecodeKey(0) - - custom := testCustomField{1, 2, 3, 4, 5, 6, 7, 8} - - b := &TestRequest{ - IntField: math.MaxInt32, - StringField: "TestRequestStringField", - BytesField: []byte("TestRequestBytesField"), - CustomField: &custom, - RequestMetaHeader: RequestMetaHeader{ - TTL: math.MaxInt32 - 8, - Epoch: math.MaxInt64 - 12, - }, - } - - require.NoError(t, SignRequestHeader(key, b)) - require.NoError(t, VerifyRequestHeader(b)) - - require.Len(t, b.Signatures, 1) - require.Equal(t, custom, *b.CustomField) - require.Equal(t, uint32(math.MaxInt32-8), b.GetTTL()) - require.Equal(t, uint64(math.MaxInt64-12), b.GetEpoch()) - - buf := bytes.NewBuffer(nil) - log.SetOutput(buf) - - cp, ok := proto.Clone(b).(*TestRequest) - require.True(t, ok) - require.NotEqual(t, b, cp) - - require.Contains(t, buf.String(), "proto: don't know how to copy") -} - func TestRequestVerificationHeader_SetToken(t *testing.T) { id, err := refs.NewUUID() require.NoError(t, err) From 798c3ae658e60bd994939be2f5008904746ef8d8 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 12 May 2020 11:08:03 +0300 Subject: [PATCH 0215/1196] Update changelog for v0.7.4 --- CHANGELOG.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 14b7a11..8abbc14 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,22 @@ # Changelog This is the changelog for NeoFS-API-Go +## [0.7.4] - 2020-05-12 + +### Added + +- Stringify for `object.Object`. + +### Changed + +- Mechanism for creating and verifying request message signatures. +- Implementation and interface of private token storage. +- File structure of packages. + +### Updated + +- NeoFS API v0.7.4 + ## [0.7.1] - 2020-04-20 ### Added @@ -273,3 +289,4 @@ Initial public release [0.6.2]: https://github.com/nspcc-dev/neofs-api-go/compare/v0.6.1...v0.6.2 [0.7.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v0.6.2...v0.7.0 [0.7.1]: https://github.com/nspcc-dev/neofs-api-go/compare/v0.7.0...v0.7.1 +[0.7.4]: https://github.com/nspcc-dev/neofs-api-go/compare/v0.7.1...v0.7.4 From 0b5c4299aa4d15da128450dc361496fb788c75ba Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 13 May 2020 18:49:15 +0300 Subject: [PATCH 0216/1196] service: implement SessionToken wrapper for Sign/Verify support --- service/token.go | 46 ++++++++++++++++++++++++++++++++----------- service/token_test.go | 13 +++++++----- 2 files changed, 43 insertions(+), 16 deletions(-) diff --git a/service/token.go b/service/token.go index 32c390f..cce1059 100644 --- a/service/token.go +++ b/service/token.go @@ -26,6 +26,10 @@ type signDataReaderWithToken struct { token SessionToken } +type signedSessionToken struct { + SessionToken +} + const verbSize = 4 const fixedTokenDataSize = 0 + @@ -116,33 +120,53 @@ func (x Token_Info_Verb) Bytes() []byte { return data } -// AddSignKey calls a Signature field setter with passed signature. -func (m *Token) AddSignKey(sig []byte, _ *ecdsa.PublicKey) { - m.SetSignature(sig) +// AddSignKey calls a Signature field setter of token with passed signature. +func (s signedSessionToken) AddSignKey(sig []byte, _ *ecdsa.PublicKey) { + if s.SessionToken != nil { + s.SessionToken.SetSignature(sig) + } } // SignedData returns token information in a binary representation. -func (m *Token) SignedData() ([]byte, error) { - return SignedDataFromReader(m) +func (s signedSessionToken) SignedData() ([]byte, error) { + return SignedDataFromReader(s) +} + +// SignedDataSize returns the length of signed token information slice. +func (s signedSessionToken) SignedDataSize() int { + return tokenInfoSize(s.SessionToken) } // ReadSignedData copies a binary representation of the token information to passed buffer. // // If buffer length is less than required, io.ErrUnexpectedEOF returns. -func (m *Token_Info) ReadSignedData(p []byte) (int, error) { - sz := m.SignedDataSize() +func (s signedSessionToken) ReadSignedData(p []byte) (int, error) { + sz := s.SignedDataSize() if len(p) < sz { return 0, io.ErrUnexpectedEOF } - copyTokenSignedData(p, m) + copyTokenSignedData(p, s.SessionToken) return sz, nil } -// SignedDataSize returns the length of signed token information slice. -func (m *Token_Info) SignedDataSize() int { - return tokenInfoSize(m) +// NewSignedSessionToken wraps passed SessionToken in a component suitable for signing. +// +// Result can be used in AddSignatureWithKey function. +func NewSignedSessionToken(token SessionToken) DataWithSignKeyAccumulator { + return &signedSessionToken{ + SessionToken: token, + } +} + +// NewVerifiedSessionToken wraps passed SessionToken in a component suitable for signature verification. +// +// Result can be used in VerifySignatureWithKey function. +func NewVerifiedSessionToken(token SessionToken) DataWithSignature { + return &signedSessionToken{ + SessionToken: token, + } } func tokenInfoSize(v SessionKeySource) int { diff --git a/service/token_test.go b/service/token_test.go index ce3d2c8..e8599e7 100644 --- a/service/token_test.go +++ b/service/token_test.go @@ -89,7 +89,7 @@ func TestTokenGettersSetters(t *testing.T) { } func TestSignToken(t *testing.T) { - token := new(Token) + var token SessionToken = new(Token) // create private key for signing sk := test.DecodeKey(0) @@ -126,9 +126,12 @@ func TestSignToken(t *testing.T) { require.NoError(t, err) token.SetSessionKey(sessionKey) + signedToken := NewSignedSessionToken(token) + verifiedToken := NewVerifiedSessionToken(token) + // sign and verify token - require.NoError(t, AddSignatureWithKey(sk, token)) - require.NoError(t, VerifySignatureWithKey(pk, token)) + require.NoError(t, AddSignatureWithKey(sk, signedToken)) + require.NoError(t, VerifySignatureWithKey(pk, verifiedToken)) items := []struct { corrupt func() @@ -212,8 +215,8 @@ func TestSignToken(t *testing.T) { for _, v := range items { v.corrupt() - require.Error(t, VerifySignatureWithKey(pk, token)) + require.Error(t, VerifySignatureWithKey(pk, verifiedToken)) v.restore() - require.NoError(t, VerifySignatureWithKey(pk, token)) + require.NoError(t, VerifySignatureWithKey(pk, verifiedToken)) } } From c8625b2c862c5f91cd419e82c39277ce5e7816c7 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 15 May 2020 16:00:02 +0300 Subject: [PATCH 0217/1196] Update to neofs-api v0.7.5 --- Makefile | 2 +- docs/service.md | 1 + service/verify.pb.go | 131 ++++++++++++++++++++++++++++++------------- service/verify.proto | 3 + 4 files changed, 98 insertions(+), 39 deletions(-) diff --git a/Makefile b/Makefile index b99682b..6b1ab7a 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -PROTO_VERSION=v0.7.4 +PROTO_VERSION=v0.7.5 PROTO_URL=https://github.com/nspcc-dev/neofs-api/archive/$(PROTO_VERSION).tar.gz B=\033[0;1m diff --git a/docs/service.md b/docs/service.md index 9ed548e..0765f04 100644 --- a/docs/service.md +++ b/docs/service.md @@ -132,6 +132,7 @@ User token granting rights for object manipulation | Address | [refs.Address](#refs.Address) | | Address is an object address for which token is issued | | Lifetime | [TokenLifetime](#service.TokenLifetime) | | Lifetime is a lifetime of the session | | SessionKey | [bytes](#bytes) | | SessionKey is a public key of session key | +| OwnerKey | [bytes](#bytes) | | OwnerKey is a public key of the token owner | diff --git a/service/verify.pb.go b/service/verify.pb.go index 3dadf0b..d198302 100644 --- a/service/verify.pb.go +++ b/service/verify.pb.go @@ -239,7 +239,9 @@ type Token_Info struct { // Lifetime is a lifetime of the session TokenLifetime `protobuf:"bytes,5,opt,name=Lifetime,proto3,embedded=Lifetime" json:"Lifetime"` // SessionKey is a public key of session key - SessionKey []byte `protobuf:"bytes,6,opt,name=SessionKey,proto3" json:"SessionKey,omitempty"` + SessionKey []byte `protobuf:"bytes,6,opt,name=SessionKey,proto3" json:"SessionKey,omitempty"` + // OwnerKey is a public key of the token owner + OwnerKey []byte `protobuf:"bytes,7,opt,name=OwnerKey,proto3" json:"OwnerKey,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -288,6 +290,13 @@ func (m *Token_Info) GetSessionKey() []byte { return nil } +func (m *Token_Info) GetOwnerKey() []byte { + if m != nil { + return m.OwnerKey + } + return nil +} + // TokenLifetime carries a group of lifetime parameters of the token type TokenLifetime struct { // Created carries an initial epoch of token lifetime @@ -354,43 +363,44 @@ func init() { func init() { proto.RegisterFile("service/verify.proto", fileDescriptor_4bdd5bc50ec96238) } var fileDescriptor_4bdd5bc50ec96238 = []byte{ - // 567 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x53, 0x4d, 0x6f, 0xd3, 0x40, - 0x10, 0xed, 0x26, 0xce, 0xd7, 0xf4, 0x03, 0xb3, 0x20, 0x64, 0x22, 0x94, 0x44, 0x11, 0x87, 0x54, - 0x22, 0x8e, 0x94, 0x4a, 0x08, 0x09, 0x2e, 0x0d, 0x11, 0x34, 0xa2, 0x82, 0x6a, 0x53, 0x7a, 0xe0, - 0xe6, 0xd8, 0x63, 0x77, 0x45, 0xeb, 0x0d, 0xbb, 0x9b, 0xa0, 0xfe, 0x13, 0x7e, 0x03, 0xbf, 0x83, - 0x43, 0x8f, 0x3d, 0x22, 0x24, 0x22, 0x14, 0xfe, 0x04, 0x47, 0xe4, 0xb5, 0x93, 0xb8, 0x12, 0xdc, - 0xde, 0xbc, 0x99, 0x37, 0xef, 0x65, 0xe2, 0x85, 0xfb, 0x0a, 0xe5, 0x9c, 0xfb, 0xd8, 0x9b, 0xa3, - 0xe4, 0xe1, 0x95, 0x3b, 0x95, 0x42, 0x0b, 0x5a, 0xc9, 0xd8, 0xba, 0x2d, 0x31, 0x54, 0x3d, 0x7d, - 0x35, 0x45, 0x95, 0xb6, 0xea, 0xdd, 0x88, 0xeb, 0xf3, 0xd9, 0xc4, 0xf5, 0xc5, 0x65, 0x2f, 0x12, - 0x91, 0xe8, 0x19, 0x7a, 0x32, 0x0b, 0x4d, 0x65, 0x0a, 0x83, 0xd2, 0xf1, 0xf6, 0x37, 0x02, 0x0f, - 0x19, 0x7e, 0x9a, 0xa1, 0xd2, 0x67, 0x89, 0x03, 0xf7, 0x3d, 0xcd, 0x45, 0x7c, 0x84, 0x5e, 0x80, - 0x92, 0x1e, 0x03, 0x8c, 0x79, 0x14, 0x7b, 0x7a, 0x26, 0x51, 0x39, 0xa4, 0x55, 0xec, 0x6c, 0xf7, - 0x9f, 0xb8, 0x99, 0xb9, 0xfb, 0x5f, 0x9d, 0xbb, 0x16, 0xb1, 0x9c, 0x9e, 0x3e, 0x86, 0xd2, 0xa9, - 0xf8, 0x88, 0xb1, 0x53, 0x68, 0x91, 0xce, 0x76, 0x7f, 0x6f, 0xbd, 0xc8, 0xb0, 0x2c, 0x6d, 0xd6, - 0x0f, 0xa0, 0xb6, 0xd6, 0x50, 0x0a, 0x56, 0x52, 0x38, 0xa4, 0x45, 0x3a, 0x3b, 0xcc, 0xe0, 0x84, - 0x3b, 0x41, 0x94, 0x66, 0xcb, 0x0e, 0x33, 0xb8, 0xfd, 0xb3, 0x98, 0xed, 0xa6, 0xcf, 0xa1, 0x66, - 0xc0, 0x28, 0x0e, 0x85, 0x91, 0x6d, 0xf7, 0xef, 0xdd, 0x36, 0x72, 0x93, 0xd6, 0xa0, 0x7a, 0xbd, - 0x68, 0x6e, 0xdd, 0x2c, 0x9a, 0x84, 0x6d, 0xe6, 0xe9, 0xa3, 0x9c, 0xb7, 0x53, 0x35, 0xfb, 0x37, - 0x44, 0xfd, 0x4f, 0x01, 0x2c, 0x33, 0xd6, 0x84, 0xc2, 0x68, 0x98, 0x66, 0x1a, 0xdc, 0x49, 0xf6, - 0xfc, 0x58, 0x34, 0x2b, 0xe9, 0x96, 0x21, 0x2b, 0x8c, 0x86, 0x74, 0x1f, 0x2a, 0xef, 0x3e, 0xc7, - 0x28, 0x47, 0xc3, 0x34, 0xe5, 0x66, 0x2a, 0xa3, 0xd9, 0x0a, 0xd0, 0xa7, 0x60, 0xcd, 0x51, 0x4e, - 0x9c, 0x62, 0x8b, 0x74, 0xf6, 0xfa, 0xce, 0x3f, 0xa2, 0xba, 0x67, 0x28, 0x27, 0x83, 0xea, 0x72, - 0xd1, 0xb4, 0x12, 0xc4, 0xcc, 0x3c, 0x7d, 0x06, 0x95, 0xc3, 0x20, 0x90, 0xa8, 0x94, 0x63, 0x99, - 0x5f, 0xb9, 0xeb, 0x26, 0xdf, 0x82, 0x9b, 0x91, 0x1b, 0xc7, 0x8c, 0x60, 0x2b, 0x40, 0x5f, 0x40, - 0xf5, 0x98, 0x87, 0xa8, 0xf9, 0x25, 0x3a, 0x25, 0x23, 0x7d, 0x70, 0xdb, 0x75, 0xd5, 0xcd, 0xdd, - 0x68, 0xad, 0xa0, 0x0d, 0x80, 0x31, 0x2a, 0xc5, 0x45, 0xfc, 0x06, 0xaf, 0x9c, 0xb2, 0xb9, 0x51, - 0x8e, 0x69, 0x9f, 0x82, 0x49, 0x49, 0x2b, 0x50, 0x3c, 0x99, 0x69, 0x7b, 0x2b, 0x01, 0xaf, 0x51, - 0xdb, 0x84, 0x56, 0xc1, 0x4a, 0x3e, 0x0f, 0xbb, 0x40, 0x01, 0xca, 0x63, 0xf4, 0xa4, 0x7f, 0x6e, - 0x17, 0x13, 0x3c, 0xc4, 0x0b, 0xd4, 0x68, 0x5b, 0xb4, 0x06, 0x25, 0xe6, 0xc5, 0x11, 0xda, 0x25, - 0xba, 0x0b, 0x35, 0x03, 0x8f, 0x3c, 0x75, 0x6e, 0x97, 0xdb, 0x23, 0xd8, 0xbd, 0x15, 0x8d, 0x3a, - 0x50, 0x79, 0x29, 0xd1, 0xd3, 0x18, 0x98, 0xff, 0xc1, 0x62, 0xab, 0x32, 0x09, 0x78, 0xe6, 0x5d, - 0xf0, 0xe0, 0x7d, 0xac, 0xf9, 0x85, 0x39, 0xbf, 0xc5, 0x72, 0xcc, 0x60, 0x7c, 0xbd, 0x6c, 0x90, - 0x9b, 0x65, 0x83, 0x7c, 0x5f, 0x36, 0xc8, 0xaf, 0x65, 0x83, 0x7c, 0xf9, 0xdd, 0xd8, 0xfa, 0xb0, - 0x9f, 0x7b, 0x36, 0xb1, 0x9a, 0xfa, 0x7e, 0x37, 0xc0, 0x79, 0x2f, 0x46, 0x11, 0xaa, 0xae, 0x37, - 0xe5, 0xdd, 0x48, 0xf4, 0xb2, 0x1b, 0x7d, 0x2d, 0xdc, 0x7d, 0x8b, 0xe2, 0xd5, 0xd8, 0x3d, 0x3c, - 0x19, 0xb9, 0xe3, 0x94, 0x9b, 0x94, 0xcd, 0x6b, 0x3a, 0xf8, 0x1b, 0x00, 0x00, 0xff, 0xff, 0x13, - 0xf0, 0xba, 0xcc, 0xaf, 0x03, 0x00, 0x00, + // 579 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x53, 0x4f, 0x6f, 0x12, 0x41, + 0x14, 0xef, 0xc0, 0xc2, 0xc2, 0xeb, 0x1f, 0xd7, 0xd1, 0x98, 0x95, 0x18, 0x20, 0xc4, 0x03, 0x4d, + 0x64, 0x49, 0x68, 0x62, 0x4c, 0xf4, 0x52, 0x24, 0x5a, 0x62, 0xa3, 0xcd, 0x50, 0x7b, 0xf0, 0xb6, + 0xc0, 0x63, 0x3b, 0xb1, 0xdd, 0xc1, 0x99, 0x01, 0xd3, 0xef, 0xe1, 0xc1, 0xcf, 0xe0, 0xe7, 0xf0, + 0xd0, 0x63, 0x8f, 0xc6, 0x03, 0x31, 0xf8, 0x29, 0xbc, 0x99, 0x99, 0x5d, 0x60, 0x9b, 0xe8, 0xed, + 0xf7, 0x7e, 0xef, 0xfd, 0xde, 0xef, 0xcd, 0x9b, 0x19, 0xb8, 0xaf, 0x50, 0xce, 0xf9, 0x08, 0xdb, + 0x73, 0x94, 0x7c, 0x72, 0x15, 0x4c, 0xa5, 0xd0, 0x82, 0xba, 0x29, 0x5b, 0xf1, 0x24, 0x4e, 0x54, + 0x5b, 0x5f, 0x4d, 0x51, 0x25, 0xa9, 0x4a, 0x2b, 0xe2, 0xfa, 0x7c, 0x36, 0x0c, 0x46, 0xe2, 0xb2, + 0x1d, 0x89, 0x48, 0xb4, 0x2d, 0x3d, 0x9c, 0x4d, 0x6c, 0x64, 0x03, 0x8b, 0x92, 0xf2, 0xc6, 0x77, + 0x02, 0x0f, 0x19, 0x7e, 0x9a, 0xa1, 0xd2, 0x67, 0xc6, 0x81, 0x8f, 0x42, 0xcd, 0x45, 0x7c, 0x84, + 0xe1, 0x18, 0x25, 0x3d, 0x06, 0x18, 0xf0, 0x28, 0x0e, 0xf5, 0x4c, 0xa2, 0xf2, 0x49, 0x3d, 0xdf, + 0xdc, 0xee, 0x3c, 0x09, 0x52, 0xf3, 0xe0, 0xbf, 0xba, 0x60, 0x2d, 0x62, 0x19, 0x3d, 0x7d, 0x0c, + 0x85, 0x53, 0xf1, 0x11, 0x63, 0x3f, 0x57, 0x27, 0xcd, 0xed, 0xce, 0xde, 0xba, 0x91, 0x65, 0x59, + 0x92, 0xac, 0x1c, 0x40, 0x79, 0xad, 0xa1, 0x14, 0x1c, 0x13, 0xf8, 0xa4, 0x4e, 0x9a, 0x3b, 0xcc, + 0x62, 0xc3, 0x9d, 0x20, 0x4a, 0xdb, 0x65, 0x87, 0x59, 0xdc, 0xf8, 0x93, 0x4f, 0x7b, 0xd3, 0xe7, + 0x50, 0xb6, 0xa0, 0x1f, 0x4f, 0x84, 0x95, 0x6d, 0x77, 0xee, 0xdd, 0x36, 0x0a, 0x4c, 0xaa, 0x5b, + 0xba, 0x5e, 0xd4, 0xb6, 0x6e, 0x16, 0x35, 0xc2, 0x36, 0xf5, 0xf4, 0x51, 0xc6, 0xdb, 0x2f, 0xd9, + 0xfe, 0x1b, 0xa2, 0xf2, 0x25, 0x0f, 0x8e, 0x2d, 0xab, 0x41, 0xae, 0xdf, 0x4b, 0x66, 0xea, 0xde, + 0x31, 0x7d, 0x7e, 0x2e, 0x6a, 0x6e, 0xd2, 0xa5, 0xc7, 0x72, 0xfd, 0x1e, 0xdd, 0x07, 0xf7, 0xdd, + 0xe7, 0x18, 0x65, 0xbf, 0x97, 0x4c, 0xb9, 0xa9, 0x4a, 0x69, 0xb6, 0x02, 0xf4, 0x29, 0x38, 0x73, + 0x94, 0x43, 0x3f, 0x5f, 0x27, 0xcd, 0xbd, 0x8e, 0xff, 0x8f, 0x51, 0x83, 0x33, 0x94, 0xc3, 0x6e, + 0x69, 0xb9, 0xa8, 0x39, 0x06, 0x31, 0x5b, 0x4f, 0x9f, 0x81, 0x7b, 0x38, 0x1e, 0x4b, 0x54, 0xca, + 0x77, 0xec, 0x29, 0x77, 0x03, 0xf3, 0x16, 0x82, 0x94, 0xdc, 0x38, 0xa6, 0x04, 0x5b, 0x01, 0xfa, + 0x02, 0x4a, 0xc7, 0x7c, 0x82, 0x9a, 0x5f, 0xa2, 0x5f, 0xb0, 0xd2, 0x07, 0xb7, 0x5d, 0x57, 0xd9, + 0xcc, 0x8e, 0xd6, 0x0a, 0x5a, 0x05, 0x18, 0xa0, 0x52, 0x5c, 0xc4, 0x6f, 0xf0, 0xca, 0x2f, 0xda, + 0x1d, 0x65, 0x18, 0x5a, 0x81, 0x92, 0x3d, 0x9a, 0xc9, 0xba, 0x36, 0xbb, 0x8e, 0x1b, 0xa7, 0x60, + 0x4f, 0x40, 0x5d, 0xc8, 0x9f, 0xcc, 0xb4, 0xb7, 0x65, 0xc0, 0x6b, 0xd4, 0x1e, 0xa1, 0x25, 0x70, + 0xcc, 0xd3, 0xf1, 0x72, 0x14, 0xa0, 0x38, 0xc0, 0x50, 0x8e, 0xce, 0xbd, 0xbc, 0xc1, 0x3d, 0xbc, + 0x40, 0x8d, 0x9e, 0x43, 0xcb, 0x50, 0x60, 0x61, 0x1c, 0xa1, 0x57, 0xa0, 0xbb, 0x50, 0xb6, 0xf0, + 0x28, 0x54, 0xe7, 0x5e, 0xb1, 0xd1, 0x87, 0xdd, 0x5b, 0x63, 0x53, 0x1f, 0xdc, 0x97, 0x12, 0x43, + 0x8d, 0x63, 0x7b, 0x47, 0x0e, 0x5b, 0x85, 0x66, 0xf8, 0xb3, 0xf0, 0x82, 0x8f, 0xdf, 0xc7, 0x9a, + 0x5f, 0xd8, 0xab, 0x71, 0x58, 0x86, 0xe9, 0x0e, 0xae, 0x97, 0x55, 0x72, 0xb3, 0xac, 0x92, 0x1f, + 0xcb, 0x2a, 0xf9, 0xb5, 0xac, 0x92, 0xaf, 0xbf, 0xab, 0x5b, 0x1f, 0xf6, 0x33, 0x5f, 0x2a, 0x56, + 0xd3, 0xd1, 0xa8, 0x35, 0xc6, 0x79, 0x3b, 0x46, 0x31, 0x51, 0xad, 0x70, 0xca, 0x5b, 0x91, 0x68, + 0xa7, 0xfb, 0xfb, 0x96, 0xbb, 0xfb, 0x16, 0xc5, 0xab, 0x41, 0x70, 0x78, 0xd2, 0x0f, 0x06, 0x09, + 0x37, 0x2c, 0xda, 0x9f, 0x76, 0xf0, 0x37, 0x00, 0x00, 0xff, 0xff, 0xcb, 0xab, 0x17, 0xd9, 0xcb, + 0x03, 0x00, 0x00, } func (m *RequestVerificationHeader) Marshal() (dAtA []byte, err error) { @@ -555,6 +565,13 @@ func (m *Token_Info) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } + if len(m.OwnerKey) > 0 { + i -= len(m.OwnerKey) + copy(dAtA[i:], m.OwnerKey) + i = encodeVarintVerify(dAtA, i, uint64(len(m.OwnerKey))) + i-- + dAtA[i] = 0x3a + } if len(m.SessionKey) > 0 { i -= len(m.SessionKey) copy(dAtA[i:], m.SessionKey) @@ -739,6 +756,10 @@ func (m *Token_Info) Size() (n int) { if l > 0 { n += 1 + l + sovVerify(uint64(l)) } + l = len(m.OwnerKey) + if l > 0 { + n += 1 + l + sovVerify(uint64(l)) + } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -1350,6 +1371,40 @@ func (m *Token_Info) Unmarshal(dAtA []byte) error { m.SessionKey = []byte{} } iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OwnerKey", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVerify + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthVerify + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthVerify + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OwnerKey = append(m.OwnerKey[:0], dAtA[iNdEx:postIndex]...) + if m.OwnerKey == nil { + m.OwnerKey = []byte{} + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipVerify(dAtA[iNdEx:]) diff --git a/service/verify.proto b/service/verify.proto index ed360be..a6619a6 100644 --- a/service/verify.proto +++ b/service/verify.proto @@ -63,6 +63,9 @@ message Token { // SessionKey is a public key of session key bytes SessionKey = 6; + + // OwnerKey is a public key of the token owner + bytes OwnerKey = 7; } // TokenInfo is a grouped information about token From bc413f628071b1ff529da97a1ce959e7632d1c04 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 15 May 2020 16:03:47 +0300 Subject: [PATCH 0218/1196] service: defined OwnerKeyContainer and embed it to SessionInfo interface --- service/token.go | 5 +++++ service/types.go | 15 ++++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/service/token.go b/service/token.go index cce1059..2497718 100644 --- a/service/token.go +++ b/service/token.go @@ -103,6 +103,11 @@ func (m *Token_Info) SetSessionKey(key []byte) { m.SessionKey = key } +// SetOwnerKey is an OwnerKey field setter. +func (m *Token_Info) SetOwnerKey(key []byte) { + m.OwnerKey = key +} + // SetSignature is a Signature field setter. func (m *Token) SetSignature(sig []byte) { m.Signature = sig diff --git a/service/types.go b/service/types.go index 31f4507..66582f5 100644 --- a/service/types.go +++ b/service/types.go @@ -158,6 +158,17 @@ type SignatureContainer interface { SetSignature([]byte) } +// OwnerKeySource is an interface of the container of owner key bytes with read access. +type OwnerKeySource interface { + GetOwnerKey() []byte +} + +// OwnerKeyContainer is an interface of the container of owner key bytes. +type OwnerKeyContainer interface { + OwnerKeySource + SetOwnerKey([]byte) +} + // SessionTokenSource is an interface of the container of a SessionToken with read access. type SessionTokenSource interface { GetSessionToken() SessionToken @@ -170,7 +181,8 @@ type SessionTokenSource interface { // - verb of the session; // - address of the session object; // - token lifetime; -// - public session key bytes. +// - public session key bytes; +// - owner's public key bytes. type SessionTokenInfo interface { TokenIDContainer OwnerIDContainer @@ -178,6 +190,7 @@ type SessionTokenInfo interface { AddressContainer LifetimeContainer SessionKeyContainer + OwnerKeyContainer } // SessionToken is an interface of token information and signature pair. From 1896264f8c43dfe257d4efdca32ece3c3d1619b9 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 15 May 2020 16:05:02 +0300 Subject: [PATCH 0219/1196] service: add owner key to a signed payload of SessionToken --- service/token.go | 8 +++++--- service/token_test.go | 27 +++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/service/token.go b/service/token.go index 2497718..a5dd5da 100644 --- a/service/token.go +++ b/service/token.go @@ -174,11 +174,11 @@ func NewVerifiedSessionToken(token SessionToken) DataWithSignature { } } -func tokenInfoSize(v SessionKeySource) int { +func tokenInfoSize(v SessionTokenInfo) int { if v == nil { return 0 } - return fixedTokenDataSize + len(v.GetSessionKey()) + return fixedTokenDataSize + len(v.GetSessionKey()) + len(v.GetOwnerKey()) } // Fills passed buffer with signing token information bytes. @@ -208,7 +208,9 @@ func copyTokenSignedData(buf []byte, token SessionTokenInfo) { tokenEndianness.PutUint64(buf[off:], token.ExpirationEpoch()) off += 8 - copy(buf[off:], token.GetSessionKey()) + off += copy(buf[off:], token.GetSessionKey()) + + copy(buf[off:], token.GetOwnerKey()) } // SignedData concatenates signed data with session token information. Returns concatenation result. diff --git a/service/token_test.go b/service/token_test.go index e8599e7..43e380d 100644 --- a/service/token_test.go +++ b/service/token_test.go @@ -77,6 +77,16 @@ func TestTokenGettersSetters(t *testing.T) { require.Equal(t, key, tok.GetSessionKey()) } + { + key := make([]byte, 10) + _, err := rand.Read(key) + require.NoError(t, err) + + tok.SetOwnerKey(key) + + require.Equal(t, key, tok.GetOwnerKey()) + } + { // Signature sig := make([]byte, 10) _, err := rand.Read(sig) @@ -126,6 +136,11 @@ func TestSignToken(t *testing.T) { require.NoError(t, err) token.SetSessionKey(sessionKey) + ownerKey := make([]byte, 10) + _, err = rand.Read(ownerKey[:]) + require.NoError(t, err) + token.SetOwnerKey(ownerKey) + signedToken := NewSignedSessionToken(token) verifiedToken := NewVerifiedSessionToken(token) @@ -211,6 +226,18 @@ func TestSignToken(t *testing.T) { token.SetSessionKey(sessionKey) }, }, + { // Owner key + corrupt: func() { + ownerKey := token.GetOwnerKey() + ownerKey[0]++ + token.SetOwnerKey(ownerKey) + }, + restore: func() { + ownerKey := token.GetOwnerKey() + ownerKey[0]-- + token.SetOwnerKey(ownerKey) + }, + }, } for _, v := range items { From 5b50c8000c5b932471e5ec4c39f0d01b96ac2f3d Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Sat, 16 May 2020 14:39:21 +0300 Subject: [PATCH 0220/1196] Update changelog for v0.7.5 --- CHANGELOG.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8abbc14..bdb994e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,20 @@ # Changelog This is the changelog for NeoFS-API-Go +## [0.7.5] - 2020-05-16 + +### Added + +- Owner key to the `SessionToken` signed payload. + +### Changed + +- `OwnerKeyContainer` interface embedded to `SessionTokenInfo` interface. + +### Updated + +- NeoFS API v0.7.5 + ## [0.7.4] - 2020-05-12 ### Added @@ -290,3 +304,4 @@ Initial public release [0.7.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v0.6.2...v0.7.0 [0.7.1]: https://github.com/nspcc-dev/neofs-api-go/compare/v0.7.0...v0.7.1 [0.7.4]: https://github.com/nspcc-dev/neofs-api-go/compare/v0.7.1...v0.7.4 +[0.7.5]: https://github.com/nspcc-dev/neofs-api-go/compare/v0.7.4...v0.7.5 From 22af538c9895896bc324f51493e6d9d46b3b83fc Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Sat, 16 May 2020 15:28:35 +0300 Subject: [PATCH 0221/1196] Revert "service: add owner key to a signed payload of SessionToken" This reverts commit 1896264f --- service/token.go | 8 +++----- service/token_test.go | 27 --------------------------- 2 files changed, 3 insertions(+), 32 deletions(-) diff --git a/service/token.go b/service/token.go index a5dd5da..2497718 100644 --- a/service/token.go +++ b/service/token.go @@ -174,11 +174,11 @@ func NewVerifiedSessionToken(token SessionToken) DataWithSignature { } } -func tokenInfoSize(v SessionTokenInfo) int { +func tokenInfoSize(v SessionKeySource) int { if v == nil { return 0 } - return fixedTokenDataSize + len(v.GetSessionKey()) + len(v.GetOwnerKey()) + return fixedTokenDataSize + len(v.GetSessionKey()) } // Fills passed buffer with signing token information bytes. @@ -208,9 +208,7 @@ func copyTokenSignedData(buf []byte, token SessionTokenInfo) { tokenEndianness.PutUint64(buf[off:], token.ExpirationEpoch()) off += 8 - off += copy(buf[off:], token.GetSessionKey()) - - copy(buf[off:], token.GetOwnerKey()) + copy(buf[off:], token.GetSessionKey()) } // SignedData concatenates signed data with session token information. Returns concatenation result. diff --git a/service/token_test.go b/service/token_test.go index 43e380d..e8599e7 100644 --- a/service/token_test.go +++ b/service/token_test.go @@ -77,16 +77,6 @@ func TestTokenGettersSetters(t *testing.T) { require.Equal(t, key, tok.GetSessionKey()) } - { - key := make([]byte, 10) - _, err := rand.Read(key) - require.NoError(t, err) - - tok.SetOwnerKey(key) - - require.Equal(t, key, tok.GetOwnerKey()) - } - { // Signature sig := make([]byte, 10) _, err := rand.Read(sig) @@ -136,11 +126,6 @@ func TestSignToken(t *testing.T) { require.NoError(t, err) token.SetSessionKey(sessionKey) - ownerKey := make([]byte, 10) - _, err = rand.Read(ownerKey[:]) - require.NoError(t, err) - token.SetOwnerKey(ownerKey) - signedToken := NewSignedSessionToken(token) verifiedToken := NewVerifiedSessionToken(token) @@ -226,18 +211,6 @@ func TestSignToken(t *testing.T) { token.SetSessionKey(sessionKey) }, }, - { // Owner key - corrupt: func() { - ownerKey := token.GetOwnerKey() - ownerKey[0]++ - token.SetOwnerKey(ownerKey) - }, - restore: func() { - ownerKey := token.GetOwnerKey() - ownerKey[0]-- - token.SetOwnerKey(ownerKey) - }, - }, } for _, v := range items { From bd261cf56659247d41b5a437a6c2d35e96f84c66 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Sat, 16 May 2020 15:29:44 +0300 Subject: [PATCH 0222/1196] service: call OwnerKey setter in AddSignKey method implementation --- service/token.go | 9 +++++++-- service/token_test.go | 26 ++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/service/token.go b/service/token.go index 2497718..638539f 100644 --- a/service/token.go +++ b/service/token.go @@ -6,6 +6,7 @@ import ( "io" "github.com/nspcc-dev/neofs-api-go/refs" + crypto "github.com/nspcc-dev/neofs-crypto" ) type signAccumWithToken struct { @@ -125,10 +126,14 @@ func (x Token_Info_Verb) Bytes() []byte { return data } -// AddSignKey calls a Signature field setter of token with passed signature. -func (s signedSessionToken) AddSignKey(sig []byte, _ *ecdsa.PublicKey) { +// AddSignKey calls a Signature field setter and an OwnerKey field setter with corresponding arguments. +func (s signedSessionToken) AddSignKey(sig []byte, key *ecdsa.PublicKey) { if s.SessionToken != nil { s.SessionToken.SetSignature(sig) + + s.SessionToken.SetOwnerKey( + crypto.MarshalPublicKey(key), + ) } } diff --git a/service/token_test.go b/service/token_test.go index e8599e7..4fb430a 100644 --- a/service/token_test.go +++ b/service/token_test.go @@ -5,6 +5,7 @@ import ( "testing" "github.com/nspcc-dev/neofs-api-go/refs" + crypto "github.com/nspcc-dev/neofs-crypto" "github.com/nspcc-dev/neofs-crypto/test" "github.com/stretchr/testify/require" ) @@ -220,3 +221,28 @@ func TestSignToken(t *testing.T) { require.NoError(t, VerifySignatureWithKey(pk, verifiedToken)) } } + +func TestSignedSessionToken_AddSignKey(t *testing.T) { + // nil SessionToken + s := new(signedSessionToken) + + require.NotPanics(t, func() { + s.AddSignKey(nil, nil) + }) + + // create test public key and signature + pk := &test.DecodeKey(0).PublicKey + sig := []byte{1, 2, 3} + + s.SessionToken = new(Token) + + // add key-signature pair to SessionToken + s.AddSignKey(sig, pk) + + require.Equal(t, sig, s.GetSignature()) + + require.Equal(t, + crypto.MarshalPublicKey(pk), + s.GetOwnerKey(), + ) +} From 2c571718d06d635f1cb5ca7f8bcb134a222f5357 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 18 May 2020 12:47:13 +0300 Subject: [PATCH 0223/1196] object: add unit test of HeadRequest.ReadSignedData method --- object/sign_test.go | 26 ++++++++++++++++++++++++++ object/types.go | 5 +++++ 2 files changed, 31 insertions(+) diff --git a/object/sign_test.go b/object/sign_test.go index 4df1c2b..fb57baa 100644 --- a/object/sign_test.go +++ b/object/sign_test.go @@ -187,3 +187,29 @@ func TestSignVerifyRequests(t *testing.T) { } } } + +func TestHeadRequest_ReadSignedData(t *testing.T) { + t.Run("full headers", func(t *testing.T) { + req := new(HeadRequest) + + // allocate buffer for reading + buf := make([]byte, req.SignedDataSize()) + buf[0] = 2 + + // set FullHeaders option + req.SetFullHeaders(true) + + _, err := req.ReadSignedData(buf) + require.NoError(t, err) + + require.Equal(t, byte(1), buf[0]) + + // unset FullHeaders option + req.SetFullHeaders(false) + + _, err = req.ReadSignedData(buf) + require.NoError(t, err) + + require.Equal(t, byte(0), buf[0]) + }) +} diff --git a/object/types.go b/object/types.go index c8d3f25..4edf5f4 100644 --- a/object/types.go +++ b/object/types.go @@ -386,3 +386,8 @@ func Stringify(dst io.Writer, obj *Object) error { return nil } + +// SetFullHeaders is a FullHeaders field setter. +func (m *HeadRequest) SetFullHeaders(v bool) { + m.FullHeaders = v +} From 1931bd590dbcee33e904a99d822ee3e494b777d5 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 18 May 2020 12:48:04 +0300 Subject: [PATCH 0224/1196] object: fix signed payload calculation of HeadRequest message In previous implementation first byte of buffer for HeadRequest signed payload was set to 1 if FullHeaders flag was set. Otherwise, this byte remained unchanged. For correct recording of a signed payload, it is necessary to explicitly set the first byte with the unset flag. --- object/sign.go | 2 ++ object/sign_test.go | 36 +++++++++++++++++++++--------------- 2 files changed, 23 insertions(+), 15 deletions(-) diff --git a/object/sign.go b/object/sign.go index 1ed3efa..def7bc3 100644 --- a/object/sign.go +++ b/object/sign.go @@ -82,6 +82,8 @@ func (m HeadRequest) ReadSignedData(p []byte) (int, error) { if m.GetFullHeaders() { p[0] = 1 + } else { + p[0] = 0 } off := 1 diff --git a/object/sign_test.go b/object/sign_test.go index fb57baa..abf4549 100644 --- a/object/sign_test.go +++ b/object/sign_test.go @@ -1,6 +1,7 @@ package object import ( + "crypto/rand" "testing" "github.com/nspcc-dev/neofs-api-go/service" @@ -192,24 +193,29 @@ func TestHeadRequest_ReadSignedData(t *testing.T) { t.Run("full headers", func(t *testing.T) { req := new(HeadRequest) - // allocate buffer for reading - buf := make([]byte, req.SignedDataSize()) - buf[0] = 2 - - // set FullHeaders option - req.SetFullHeaders(true) - - _, err := req.ReadSignedData(buf) - require.NoError(t, err) - - require.Equal(t, byte(1), buf[0]) - - // unset FullHeaders option + // unset FullHeaders flag req.SetFullHeaders(false) - _, err = req.ReadSignedData(buf) + // allocate two different buffers for reading + buf1 := testData(t, req.SignedDataSize()) + buf2 := testData(t, req.SignedDataSize()) + + // read to both buffers + n1, err := req.ReadSignedData(buf1) require.NoError(t, err) - require.Equal(t, byte(0), buf[0]) + n2, err := req.ReadSignedData(buf2) + require.NoError(t, err) + + require.Equal(t, buf1[:n1], buf2[:n2]) }) } + +func testData(t *testing.T, sz int) []byte { + data := make([]byte, sz) + + _, err := rand.Read(data) + require.NoError(t, err) + + return data +} From af28735ca6f1eb95d6964a77fe0e07bb5fe63ce8 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 18 May 2020 13:11:39 +0300 Subject: [PATCH 0225/1196] session: change PrivateToken interface methods This commit replaces PublicKey() and SignData() methods of PrivateToken with PrivateKey() in order to have the ability to sign data with session key using service package functions. --- session/private.go | 13 +++---------- session/private_test.go | 23 ++--------------------- session/types.go | 10 ++-------- 3 files changed, 7 insertions(+), 39 deletions(-) diff --git a/session/private.go b/session/private.go index 42bb205..6c9c68d 100644 --- a/session/private.go +++ b/session/private.go @@ -4,8 +4,6 @@ import ( "crypto/ecdsa" "crypto/elliptic" "crypto/rand" - - crypto "github.com/nspcc-dev/neofs-crypto" ) type pToken struct { @@ -30,14 +28,9 @@ func NewPrivateToken(validUntil uint64) (PrivateToken, error) { }, nil } -// Sign signs data with session private key. -func (t *pToken) Sign(data []byte) ([]byte, error) { - return crypto.Sign(t.sessionKey, data) -} - -// PublicKey returns a binary representation of the session public key. -func (t *pToken) PublicKey() []byte { - return crypto.MarshalPublicKey(&t.sessionKey.PublicKey) +// PrivateKey returns a binary representation of the session public key. +func (t *pToken) PrivateKey() *ecdsa.PrivateKey { + return t.sessionKey } func (t *pToken) Expired(epoch uint64) bool { diff --git a/session/private_test.go b/session/private_test.go index 8097b97..9dedc29 100644 --- a/session/private_test.go +++ b/session/private_test.go @@ -1,35 +1,16 @@ package session import ( - "crypto/rand" "testing" - crypto "github.com/nspcc-dev/neofs-crypto" "github.com/stretchr/testify/require" ) -func TestPrivateToken(t *testing.T) { +func TestPToken_PrivateKey(t *testing.T) { // create new private token pToken, err := NewPrivateToken(0) require.NoError(t, err) - - // generate data to sign - data := make([]byte, 10) - _, err = rand.Read(data) - require.NoError(t, err) - - // sign data via private token - sig, err := pToken.Sign(data) - require.NoError(t, err) - - // check signature - require.NoError(t, - crypto.Verify( - crypto.UnmarshalPublicKey(pToken.PublicKey()), - data, - sig, - ), - ) + require.NotNil(t, pToken.PrivateKey()) } func TestPToken_Expired(t *testing.T) { diff --git a/session/types.go b/session/types.go index ee13b92..95a0065 100644 --- a/session/types.go +++ b/session/types.go @@ -10,14 +10,8 @@ import ( // PrivateToken is an interface of session private part. type PrivateToken interface { - // PublicKey must return a binary representation of session public key. - PublicKey() []byte - - // Sign must return the signature of passed data. - // - // Resulting signature must be verified by crypto.Verify function - // with the session public key. - Sign([]byte) ([]byte, error) + // PrivateKey must return session private key. + PrivateKey() *ecdsa.PrivateKey // Expired must return true if and only if private token is expired in the given epoch number. Expired(uint64) bool From 291d5128400266fc5fc4192d2b6f30338ebfbe8a Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 18 May 2020 13:14:18 +0300 Subject: [PATCH 0226/1196] session: implement function for receiving session public key bytes After recent changes PrivateToken cannot directly return public key bytes. In order to provide this ability, this commit implements a function over PrivateToken interface. --- session/errors.go | 4 ++++ session/private.go | 21 ++++++++++++++++++++- session/private_test.go | 25 +++++++++++++++++++++++++ 3 files changed, 49 insertions(+), 1 deletion(-) diff --git a/session/errors.go b/session/errors.go index 3a9c129..d35bed4 100644 --- a/session/errors.go +++ b/session/errors.go @@ -13,3 +13,7 @@ const ErrNilGPRCClientConn = internal.Error("gRPC client connection is nil") // ErrPrivateTokenNotFound is returned when addressed private token was // not found in storage. const ErrPrivateTokenNotFound = internal.Error("private token not found") + +// ErrNilPrivateToken is returned by functions that expect a non-nil +// PrivateToken, but received nil. +const ErrNilPrivateToken = internal.Error("private token is nil") diff --git a/session/private.go b/session/private.go index 6c9c68d..bb9242f 100644 --- a/session/private.go +++ b/session/private.go @@ -4,6 +4,8 @@ import ( "crypto/ecdsa" "crypto/elliptic" "crypto/rand" + + crypto "github.com/nspcc-dev/neofs-crypto" ) type pToken struct { @@ -28,7 +30,24 @@ func NewPrivateToken(validUntil uint64) (PrivateToken, error) { }, nil } -// PrivateKey returns a binary representation of the session public key. +// PublicSessionToken returns a binary representation of session public key. +// +// If passed PrivateToken is nil, ErrNilPrivateToken returns. +// If passed PrivateToken carries nil private key, crypto.ErrEmptyPrivateKey returns. +func PublicSessionToken(pToken PrivateToken) ([]byte, error) { + if pToken == nil { + return nil, ErrNilPrivateToken + } + + sk := pToken.PrivateKey() + if sk == nil { + return nil, crypto.ErrEmptyPrivateKey + } + + return crypto.MarshalPublicKey(&sk.PublicKey), nil +} + +// PrivateKey is a session private key getter. func (t *pToken) PrivateKey() *ecdsa.PrivateKey { return t.sessionKey } diff --git a/session/private_test.go b/session/private_test.go index 9dedc29..c6f8125 100644 --- a/session/private_test.go +++ b/session/private_test.go @@ -3,6 +3,7 @@ package session import ( "testing" + crypto "github.com/nspcc-dev/neofs-crypto" "github.com/stretchr/testify/require" ) @@ -49,3 +50,27 @@ func TestPrivateTokenKey_SetTokenID(t *testing.T) { require.Equal(t, tokenID, s.token) } + +func TestPublicSessionToken(t *testing.T) { + var err error + + // nil PrivateToken + _, err = PublicSessionToken(nil) + require.EqualError(t, err, ErrNilPrivateToken.Error()) + + // empty private key + var pToken PrivateToken = new(pToken) + _, err = PublicSessionToken(pToken) + require.EqualError(t, err, crypto.ErrEmptyPrivateKey.Error()) + + // correct PrivateToken + pToken, err = NewPrivateToken(0) + require.NoError(t, err) + + key := pToken.PrivateKey() + require.NotNil(t, key) + + res, err := PublicSessionToken(pToken) + require.NoError(t, err) + require.Equal(t, res, crypto.MarshalPublicKey(&key.PublicKey)) +} From 96a6bb484207ea65b0184a99a626781d2edba104 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 18 May 2020 13:44:32 +0300 Subject: [PATCH 0227/1196] object: implement SignedData() and AddSignKey() methods on IntegrityHeader --- object/sign.go | 11 +++++++++++ object/sign_test.go | 18 ++++++++++++++++++ object/types.go | 15 +++++++++++++++ object/types_test.go | 20 ++++++++++++++++++++ 4 files changed, 64 insertions(+) diff --git a/object/sign.go b/object/sign.go index def7bc3..3cdf94f 100644 --- a/object/sign.go +++ b/object/sign.go @@ -1,6 +1,7 @@ package object import ( + "crypto/ecdsa" "encoding/binary" "io" @@ -259,3 +260,13 @@ func addressSize(addr Address) int { func addressBytes(addr Address) []byte { return append(addr.CID.Bytes(), addr.ObjectID.Bytes()...) } + +// SignedData returns the result of the ChecksumSignature field getter. +func (m IntegrityHeader) SignedData() ([]byte, error) { + return m.GetHeadersChecksum(), nil +} + +// AddSignKey calls the ChecksumSignature field setter with signature argument. +func (m *IntegrityHeader) AddSignKey(sign []byte, _ *ecdsa.PublicKey) { + m.SetSignature(sign) +} diff --git a/object/sign_test.go b/object/sign_test.go index abf4549..9480fda 100644 --- a/object/sign_test.go +++ b/object/sign_test.go @@ -219,3 +219,21 @@ func testData(t *testing.T, sz int) []byte { return data } + +func TestIntegrityHeaderSignMethods(t *testing.T) { + // create new IntegrityHeader + s := new(IntegrityHeader) + + // set test headers checksum + s.SetHeadersChecksum([]byte{1, 2, 3}) + + data, err := s.SignedData() + require.NoError(t, err) + require.Equal(t, data, s.GetHeadersChecksum()) + + // add signature + sig := []byte{4, 5, 6} + s.AddSignKey(sig, nil) + + require.Equal(t, sig, s.GetSignature()) +} diff --git a/object/types.go b/object/types.go index 4edf5f4..058cd70 100644 --- a/object/types.go +++ b/object/types.go @@ -391,3 +391,18 @@ func Stringify(dst io.Writer, obj *Object) error { func (m *HeadRequest) SetFullHeaders(v bool) { m.FullHeaders = v } + +// GetSignature is a ChecksumSignature field getter. +func (m IntegrityHeader) GetSignature() []byte { + return m.ChecksumSignature +} + +// SetSignature is a ChecksumSignature field setter. +func (m *IntegrityHeader) SetSignature(v []byte) { + m.ChecksumSignature = v +} + +// SetHeadersChecksum is a HeadersChecksum field setter. +func (m *IntegrityHeader) SetHeadersChecksum(v []byte) { + m.HeadersChecksum = v +} diff --git a/object/types_test.go b/object/types_test.go index 3f9292d..0a7085f 100644 --- a/object/types_test.go +++ b/object/types_test.go @@ -199,3 +199,23 @@ func TestObject_Copy(t *testing.T) { require.Equal(t, token, h.GetValue().(*Header_Token).Token) }) } + +func TestIntegrityHeaderGettersSetters(t *testing.T) { + t.Run("headers checksum", func(t *testing.T) { + data := []byte{1, 2, 3} + + v := new(IntegrityHeader) + + v.SetHeadersChecksum(data) + require.Equal(t, data, v.GetHeadersChecksum()) + }) + + t.Run("headers checksum", func(t *testing.T) { + data := []byte{1, 2, 3} + + v := new(IntegrityHeader) + + v.SetSignature(data) + require.Equal(t, data, v.GetSignature()) + }) +} From 114144646baed7fe68ad265fd0aa1df8358c522a Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 19 May 2020 13:29:27 +0300 Subject: [PATCH 0228/1196] Update changelog for v0.7.6 --- CHANGELOG.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index bdb994e..498e028 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,26 @@ # Changelog This is the changelog for NeoFS-API-Go +## [0.7.6] - 2020-05-19 + +### Added + +- `session.PublicSessionToken` function for session public key bytes receiving. +- The implementation of `service.DataWithSignKeyAccumulator` methods on `object.IntegrityHeader`. + +### Changed + +- The implementation of `AddSignKey` method on `service.signedSessionToken` structure. +- `session.PrivateTOken` interface methods group. + +### Removed + +- `OwnerKey` from `service.SessionToken` signed payload. + +### Fixed + +- Incorrect `object.HeadRequest.ReadSignedData` method implementation. + ## [0.7.5] - 2020-05-16 ### Added @@ -305,3 +325,4 @@ Initial public release [0.7.1]: https://github.com/nspcc-dev/neofs-api-go/compare/v0.7.0...v0.7.1 [0.7.4]: https://github.com/nspcc-dev/neofs-api-go/compare/v0.7.1...v0.7.4 [0.7.5]: https://github.com/nspcc-dev/neofs-api-go/compare/v0.7.4...v0.7.5 +[0.7.6]: https://github.com/nspcc-dev/neofs-api-go/compare/v0.7.5...v0.7.6 From a50442199a94688f678bc21c8435b88e866f0e6d Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Tue, 26 May 2020 13:06:43 +0300 Subject: [PATCH 0229/1196] Bump major release --- CHANGELOG.md | 12 ++++ Makefile | 2 +- go.mod | 8 +-- go.sum | 173 +++++++++++++++++++++++++++++++++++++++++++++------ 4 files changed, 172 insertions(+), 23 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 498e028..858295a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,18 @@ # Changelog This is the changelog for NeoFS-API-Go +## [1.0.0] - 2020-05-26 + +- Bump major release + +### Updated + +- NeoFS API v0.7.5 => v1.0.0 +- github.com/golang/protobuf v1.4.0 => v1.4.2 +- github.com/prometheus/client_golang v1.5.1 => v1.6.0 +- github.com/spf13/viper v1.6.2 => v1.7.0 +- google.golang.org/grpc v1.28.1 => v1.29.1 + ## [0.7.6] - 2020-05-19 ### Added diff --git a/Makefile b/Makefile index 6b1ab7a..3dcd690 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -PROTO_VERSION=v0.7.5 +PROTO_VERSION=v1.0.0 PROTO_URL=https://github.com/nspcc-dev/neofs-api/archive/$(PROTO_VERSION).tar.gz B=\033[0;1m diff --git a/go.mod b/go.mod index 5ddf1f0..eae84be 100644 --- a/go.mod +++ b/go.mod @@ -4,19 +4,19 @@ go 1.14 require ( github.com/gogo/protobuf v1.3.1 - github.com/golang/protobuf v1.4.0 + github.com/golang/protobuf v1.4.2 github.com/google/uuid v1.1.1 github.com/mr-tron/base58 v1.1.3 github.com/nspcc-dev/neofs-crypto v0.3.0 github.com/nspcc-dev/netmap v1.7.0 github.com/nspcc-dev/tzhash v1.4.0 github.com/pkg/errors v0.9.1 - github.com/prometheus/client_golang v1.5.1 + github.com/prometheus/client_golang v1.6.0 github.com/prometheus/client_model v0.2.0 - github.com/spf13/viper v1.6.2 + github.com/spf13/viper v1.7.0 github.com/stretchr/testify v1.5.1 golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550 - google.golang.org/grpc v1.28.1 + google.golang.org/grpc v1.29.1 ) // Used for debug reasons diff --git a/go.sum b/go.sum index a9ca4af..a3ed30b 100644 --- a/go.sum +++ b/go.sum @@ -1,6 +1,19 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= +cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= +cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= +cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= +cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= +cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= +cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= +cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk= +cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= +cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= +dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/abiosoft/ishell v2.0.0+incompatible/go.mod h1:HQR9AqF2R3P4XXpMpI0NAzgHf/aS6+zVXRj14cVk9qg= github.com/abiosoft/readline v0.0.0-20180607040430-155bce2042db/go.mod h1:rB3B4rKii8V21ydCbIzH5hZiCQE7f5E9SzUb/ZZx530= @@ -8,13 +21,17 @@ github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuy github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= +github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= +github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= +github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/awalterschulze/gographviz v0.0.0-20181013152038-b2885df04310 h1:t+qxRrRtwNiUYA+Xh2jSXhoG2grnMCMKX4Fg6lx9X1U= github.com/awalterschulze/gographviz v0.0.0-20181013152038-b2885df04310/go.mod h1:GEV5wmg4YquNw7v1kkyoX9etIk8yVmXj+AkDHuuETHs= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= +github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= +github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= @@ -25,8 +42,8 @@ github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMn github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= -github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= -github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= +github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= +github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= @@ -43,6 +60,7 @@ github.com/flynn-archive/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:r github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= @@ -57,6 +75,8 @@ github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekf github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs= @@ -69,6 +89,9 @@ github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrU github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= github.com/golang/protobuf v1.4.0 h1:oOuy+ugB+P/kBdUnG5QaMXSIyJ1q38wWSojYCb3z5VQ= github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.2 h1:+Z5KGCizgyZCbGh1KZqA0fcLLkwbsjIzS4aV2v7wJX0= +github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= @@ -76,19 +99,45 @@ github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= +github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= +github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= -github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= +github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= +github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q= +github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= +github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= +github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= +github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= +github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= +github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= +github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= +github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= +github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= +github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90= +github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= +github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= +github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= +github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= +github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= @@ -105,9 +154,17 @@ github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/magiconair/properties v1.8.1 h1:ZC2Vc7/ZFkGmsVC9KvOjumD+G5lXy2RtTKyzRKO2BQ4= github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= +github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= +github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= +github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= +github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= +github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg= +github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= +github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= @@ -130,6 +187,7 @@ github.com/nspcc-dev/rfc6979 v0.2.0/go.mod h1:exhIh1PdpDC5vQmyEsGvc4YDM/lyQp/452 github.com/nspcc-dev/tzhash v1.4.0 h1:RVIR+mxOBHl58CE99+DXtE31ylD5PEkZSoWqoj4fVjg= github.com/nspcc-dev/tzhash v1.4.0/go.mod h1:Z8gp/VZbyWgPhaMp/KTmeoW5UTynp/N60g0jTtSzBws= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= +github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181zc= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= @@ -139,11 +197,12 @@ github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= -github.com/prometheus/client_golang v1.5.1 h1:bdHYieyGlH+6OLEk2YQha8THib30KP0/yD0YH9m6xcA= -github.com/prometheus/client_golang v1.5.1/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= +github.com/prometheus/client_golang v1.6.0 h1:YVPodQOcK15POxhgARIvnDRVpLcuK8mglnMrWfyrw6A= +github.com/prometheus/client_golang v1.6.0/go.mod h1:ZLOG9ck3JLRdB5MgO8f+lLTe83AXG6ro35rLTxvnIl4= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4 h1:gQz4mCbXsO+nc9n1hCxHcGA3Zx3Eo+UHZoInFGUIXNM= @@ -158,10 +217,13 @@ github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8b github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= -github.com/prometheus/procfs v0.0.8 h1:+fpWZdT24pJBiqJdAwYBjPSk+5YmQzYNPYzQsdzLkt8= -github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= +github.com/prometheus/procfs v0.0.11 h1:DhHlBtkHWPYi8O2y31JkK0TF+DGM+51OopZjH/Ia5qI= +github.com/prometheus/procfs v0.0.11/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= +github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= +github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM= @@ -180,8 +242,8 @@ github.com/spf13/jwalterweatherman v1.0.0 h1:XHEdyB+EcvlqZamSM4ZOMGlc93t6AcsBEu9 github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg= github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= -github.com/spf13/viper v1.6.2 h1:7aKfF+e8/k68gda3LOjo5RxiUqddoFxVq4BKBPrxk5E= -github.com/spf13/viper v1.6.2/go.mod h1:t3iDnF5Jlj76alVNuyFBk5oUMCvsrkbvZK0WQdfDi5k= +github.com/spf13/viper v1.7.0 h1:xVKxvI7ouOI5I+U9s2eeiUfMaWBVoXA3AWskkrqK0VM= +github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= @@ -193,80 +255,150 @@ github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5 github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= -github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= -github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= +go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= +go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550 h1:ObdrDkeb4kJdCP557AjRjq69pTHfNouLtWZG7j9rPN8= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= +golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= +golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= +golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= +golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= +golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= +golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= +golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3 h1:0GoQqolDA55aaLxZyTzK/Y2ePZzZTUrRacwib7cNsYQ= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190613194153-d28f0bde5980 h1:dfGZHvZk057jK2MCeWus/TowKpJ8y4AmooUzdBSR9GU= golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859 h1:R/3boaszxrf1GEUWTVDzSKVwLmSJpwZ1yqXm8j0v2QI= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181228144115-9a3f9b0469bb/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d h1:+R4KGOnez64A81RvjARKc4UT5/tI9ujCIVX+P5KiHuI= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200122134326-e047566fdf82 h1:ywK/j/KkyTHcdyYSZNXGjMwgmDSfjglYZ3vStQ/gSCU= -golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200420163511-1957bb5e6d1f h1:gWF768j/LaZugp8dyS4UwsslYCYz9XgFxvlgsn0n9H8= +golang.org/x/sys v0.0.0-20200420163511-1957bb5e6d1f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= +google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= +google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8 h1:Nw54tB0rB7hY/N0NQvRW8DG4Yk3Q6T9cu9RcFQDu1tc= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55 h1:gSJIx1SDwno+2ElGhA4+qG2zF97qiUzTM+rQ0klBOcE= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= +google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a h1:Ob5/580gVHBJZgXnff1cZDbG+xLtMVE5mDRTe+nIsX4= +google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= +google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= +google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= -google.golang.org/grpc v1.28.1 h1:C1QC6KzgSiLyBabDi87BbjaGreoRgGUF5nOyvfrAZ1k= -google.golang.org/grpc v1.28.1/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= +google.golang.org/grpc v1.29.1 h1:EC2SB8S04d2r73uptxphDSUG+kTKVgjRPF+N3xpxRB4= +google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= google.golang.org/protobuf v1.21.0 h1:qdOKuR/EIArgaWNjetjgTzgVTAZ+S/WXVrq9HW9zimw= google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.23.0 h1:4MY060fB1DLGMB/7MBTLnwQUY6+F09GEiz6SsrNqyzM= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= gopkg.in/abiosoft/ishell.v2 v2.0.0/go.mod h1:sFp+cGtH6o4s1FtpVPTMcHq2yue+c4DGOVohJCPUzwY= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= @@ -275,6 +407,7 @@ gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33 gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/ini.v1 v1.51.0 h1:AQvPpx3LzTDM0AjnIRlVFwFFGC+npRopjZxLJj6gdno= gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= @@ -287,4 +420,8 @@ gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.5 h1:ymVxjfMaHvXD8RqPRmzHHsB3VvucivSkIAvJFDI5O3c= gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= +rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= From e5fccc5f25f86cb382d7d8c2e7af2b44286f0933 Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Tue, 26 May 2020 13:11:55 +0300 Subject: [PATCH 0230/1196] CHANGELOG --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 858295a..bbd6afb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -338,3 +338,4 @@ Initial public release [0.7.4]: https://github.com/nspcc-dev/neofs-api-go/compare/v0.7.1...v0.7.4 [0.7.5]: https://github.com/nspcc-dev/neofs-api-go/compare/v0.7.4...v0.7.5 [0.7.6]: https://github.com/nspcc-dev/neofs-api-go/compare/v0.7.5...v0.7.6 +[1.0.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v0.7.6...v1.0.0 From 74e917810a306e361e9809cc421303ba28f4c69c Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 10 Jun 2020 20:22:34 +0300 Subject: [PATCH 0231/1196] service: support broken apart signable payload of the requests In previous implementation service package provided types and functions that wrapped signing/verification of data with session token. This allowed us to use these functions for signing / verification of service requests of other packages. To support the expansion of messages with additional parts that need to be signed, you must be able to easily expand the signed data with new parts. To achieve the described goal, this commit makes the following changes: * adds GroupSignedPayloads and GroupVerifyPayloads functions; * renames SignedDataWithToken to RequestData, DataWithTokenSignAccumulator to RequestSignedData, DataWithTokenSignSource to RequestVerifyData; * renames SignDataWithSessionToken/VerifyAccumulatedSignaturesWithToken function to SignRequestData/VerifyRequestData and makes it to use GroupSignedPayloads/GroupVerifyPayloads internally. --- accounting/sign_test.go | 14 +-- bootstrap/sign_test.go | 14 +-- container/sign_test.go | 14 +-- object/sign_test.go | 14 +-- service/errors.go | 16 +-- service/sign.go | 225 +++++++++++++++++++++++++++++++++------- service/sign_test.go | 26 ++--- service/types.go | 16 +-- service/verify_test.go | 6 +- session/create.go | 2 +- session/create_test.go | 2 +- state/sign_test.go | 14 +-- 12 files changed, 260 insertions(+), 103 deletions(-) diff --git a/accounting/sign_test.go b/accounting/sign_test.go index dd7a819..ebc683b 100644 --- a/accounting/sign_test.go +++ b/accounting/sign_test.go @@ -13,7 +13,7 @@ func TestSignBalanceRequest(t *testing.T) { sk := test.DecodeKey(0) type sigType interface { - service.SignedDataWithToken + service.RequestData service.SignKeyPairAccumulator service.SignKeyPairSource SetToken(*service.Token) @@ -159,26 +159,26 @@ func TestSignBalanceRequest(t *testing.T) { token := new(service.Token) v.SetToken(token) - require.NoError(t, service.SignDataWithSessionToken(sk, v)) + require.NoError(t, service.SignRequestData(sk, v)) - require.NoError(t, service.VerifyAccumulatedSignaturesWithToken(v)) + require.NoError(t, service.VerifyRequestData(v)) token.SetSessionKey(append(token.GetSessionKey(), 1)) - require.Error(t, service.VerifyAccumulatedSignaturesWithToken(v)) + require.Error(t, service.VerifyRequestData(v)) } { // payload corruptions for _, corruption := range item.payloadCorrupt { v := item.constructor() - require.NoError(t, service.SignDataWithSessionToken(sk, v)) + require.NoError(t, service.SignRequestData(sk, v)) - require.NoError(t, service.VerifyAccumulatedSignaturesWithToken(v)) + require.NoError(t, service.VerifyRequestData(v)) corruption(v) - require.Error(t, service.VerifyAccumulatedSignaturesWithToken(v)) + require.Error(t, service.VerifyRequestData(v)) } } } diff --git a/bootstrap/sign_test.go b/bootstrap/sign_test.go index 2c76117..3812130 100644 --- a/bootstrap/sign_test.go +++ b/bootstrap/sign_test.go @@ -12,7 +12,7 @@ func TestRequestSign(t *testing.T) { sk := test.DecodeKey(0) type sigType interface { - service.SignedDataWithToken + service.RequestData service.SignKeyPairAccumulator service.SignKeyPairSource SetToken(*service.Token) @@ -56,26 +56,26 @@ func TestRequestSign(t *testing.T) { token := new(service.Token) v.SetToken(token) - require.NoError(t, service.SignDataWithSessionToken(sk, v)) + require.NoError(t, service.SignRequestData(sk, v)) - require.NoError(t, service.VerifyAccumulatedSignaturesWithToken(v)) + require.NoError(t, service.VerifyRequestData(v)) token.SetSessionKey(append(token.GetSessionKey(), 1)) - require.Error(t, service.VerifyAccumulatedSignaturesWithToken(v)) + require.Error(t, service.VerifyRequestData(v)) } { // payload corruptions for _, corruption := range item.payloadCorrupt { v := item.constructor() - require.NoError(t, service.SignDataWithSessionToken(sk, v)) + require.NoError(t, service.SignRequestData(sk, v)) - require.NoError(t, service.VerifyAccumulatedSignaturesWithToken(v)) + require.NoError(t, service.VerifyRequestData(v)) corruption(v) - require.Error(t, service.VerifyAccumulatedSignaturesWithToken(v)) + require.Error(t, service.VerifyRequestData(v)) } } } diff --git a/container/sign_test.go b/container/sign_test.go index e469399..d9b7d26 100644 --- a/container/sign_test.go +++ b/container/sign_test.go @@ -12,7 +12,7 @@ func TestRequestSign(t *testing.T) { sk := test.DecodeKey(0) type sigType interface { - service.SignedDataWithToken + service.RequestData service.SignKeyPairAccumulator service.SignKeyPairSource SetToken(*service.Token) @@ -117,26 +117,26 @@ func TestRequestSign(t *testing.T) { token := new(service.Token) v.SetToken(token) - require.NoError(t, service.SignDataWithSessionToken(sk, v)) + require.NoError(t, service.SignRequestData(sk, v)) - require.NoError(t, service.VerifyAccumulatedSignaturesWithToken(v)) + require.NoError(t, service.VerifyRequestData(v)) token.SetSessionKey(append(token.GetSessionKey(), 1)) - require.Error(t, service.VerifyAccumulatedSignaturesWithToken(v)) + require.Error(t, service.VerifyRequestData(v)) } { // payload corruptions for _, corruption := range item.payloadCorrupt { v := item.constructor() - require.NoError(t, service.SignDataWithSessionToken(sk, v)) + require.NoError(t, service.SignRequestData(sk, v)) - require.NoError(t, service.VerifyAccumulatedSignaturesWithToken(v)) + require.NoError(t, service.VerifyRequestData(v)) corruption(v) - require.Error(t, service.VerifyAccumulatedSignaturesWithToken(v)) + require.Error(t, service.VerifyRequestData(v)) } } } diff --git a/object/sign_test.go b/object/sign_test.go index 9480fda..dcfbd7e 100644 --- a/object/sign_test.go +++ b/object/sign_test.go @@ -13,7 +13,7 @@ func TestSignVerifyRequests(t *testing.T) { sk := test.DecodeKey(0) type sigType interface { - service.SignedDataWithToken + service.RequestData service.SignKeyPairAccumulator service.SignKeyPairSource SetToken(*Token) @@ -164,26 +164,26 @@ func TestSignVerifyRequests(t *testing.T) { token := new(Token) v.SetToken(token) - require.NoError(t, service.SignDataWithSessionToken(sk, v)) + require.NoError(t, service.SignRequestData(sk, v)) - require.NoError(t, service.VerifyAccumulatedSignaturesWithToken(v)) + require.NoError(t, service.VerifyRequestData(v)) token.SetSessionKey(append(token.GetSessionKey(), 1)) - require.Error(t, service.VerifyAccumulatedSignaturesWithToken(v)) + require.Error(t, service.VerifyRequestData(v)) } { // payload corruptions for _, corruption := range item.payloadCorrupt { v := item.constructor() - require.NoError(t, service.SignDataWithSessionToken(sk, v)) + require.NoError(t, service.SignRequestData(sk, v)) - require.NoError(t, service.VerifyAccumulatedSignaturesWithToken(v)) + require.NoError(t, service.VerifyRequestData(v)) corruption(v) - require.Error(t, service.VerifyAccumulatedSignaturesWithToken(v)) + require.Error(t, service.VerifyRequestData(v)) } } } diff --git a/service/errors.go b/service/errors.go index f3a0dfc..e1c4900 100644 --- a/service/errors.go +++ b/service/errors.go @@ -36,14 +36,18 @@ const ErrEmptyDataWithSignature = internal.Error("empty data with signature") // negative length for slice allocation. const ErrNegativeLength = internal.Error("negative slice length") -// ErrNilDataWithTokenSignAccumulator is returned by functions that expect -// a non-nil DataWithTokenSignAccumulator, but received nil. -const ErrNilDataWithTokenSignAccumulator = internal.Error("signed data with token is nil") +// ErrNilRequestSignedData is returned by functions that expect +// a non-nil RequestSignedData, but received nil. +const ErrNilRequestSignedData = internal.Error("request signed data is nil") -// ErrNilSignatureKeySourceWithToken is returned by functions that expect -// a non-nil SignatureKeySourceWithToken, but received nil. -const ErrNilSignatureKeySourceWithToken = internal.Error("key-signature source with token is nil") +// ErrNilRequestVerifyData is returned by functions that expect +// a non-nil RequestVerifyData, but received nil. +const ErrNilRequestVerifyData = internal.Error("request verification data is nil") // ErrNilSignedDataReader is returned by functions that expect // a non-nil SignedDataReader, but received nil. const ErrNilSignedDataReader = internal.Error("signed data reader is nil") + +// ErrNilSignKeyPairAccumulator is returned by functions that expect +// a non-nil SignKeyPairAccumulator, but received nil. +const ErrNilSignKeyPairAccumulator = internal.Error("signature-key pair accumulator is nil") diff --git a/service/sign.go b/service/sign.go index 5b1548f..eb1c16d 100644 --- a/service/sign.go +++ b/service/sign.go @@ -2,9 +2,11 @@ package service import ( "crypto/ecdsa" + "io" "sync" crypto "github.com/nspcc-dev/neofs-crypto" + "github.com/pkg/errors" ) type keySign struct { @@ -12,6 +14,20 @@ type keySign struct { sign []byte } +type signSourceGroup struct { + SignKeyPairSource + SignKeyPairAccumulator + + sources []SignedDataSource +} + +type signReadersGroup struct { + SignKeyPairSource + SignKeyPairAccumulator + + readers []SignedDataReader +} + var bytesPool = sync.Pool{ New: func() interface{} { return make([]byte, 5<<20) @@ -176,54 +192,191 @@ func VerifySignatureWithKey(key *ecdsa.PublicKey, src DataWithSignature) error { ) } -// SignDataWithSessionToken calculates data with token signature and adds it to accumulator. +// SignRequestData calculates request data signature and adds it to accumulator. // -// Any change of data or session token info provoke signature breakdown. +// Any change of request data provoke signature breakdown. // // If passed private key is nil, crypto.ErrEmptyPrivateKey returns. -// If passed DataWithTokenSignAccumulator is nil, ErrNilDataWithTokenSignAccumulator returns. -func SignDataWithSessionToken(key *ecdsa.PrivateKey, src DataWithTokenSignAccumulator) error { +// If passed RequestSignedData is nil, ErrNilRequestSignedData returns. +func SignRequestData(key *ecdsa.PrivateKey, src RequestSignedData) error { if src == nil { - return ErrNilDataWithTokenSignAccumulator - } else if r, ok := src.(SignedDataReader); ok { - return AddSignatureWithKey(key, &signDataReaderWithToken{ - SignedDataSource: src, - SignKeyPairAccumulator: src, - - rdr: r, - token: src.GetSessionToken(), - }, - ) + return ErrNilRequestSignedData } - return AddSignatureWithKey(key, &signAccumWithToken{ - SignedDataSource: src, - SignKeyPairAccumulator: src, + sigSrc, err := GroupSignedPayloads( + src, + src, + NewSignedSessionToken( + src.GetSessionToken(), + ), + ) + if err != nil { + return err + } - token: src.GetSessionToken(), - }) + return AddSignatureWithKey(key, sigSrc) } -// VerifyAccumulatedSignaturesWithToken checks if accumulated key-signature pairs of data with token are valid. +// VerifyRequestData checks if accumulated key-signature pairs of data with token are valid. // -// If passed DataWithTokenSignSource is nil, ErrNilSignatureKeySourceWithToken returns. -func VerifyAccumulatedSignaturesWithToken(src DataWithTokenSignSource) error { +// If passed RequestVerifyData is nil, ErrNilRequestVerifyData returns. +func VerifyRequestData(src RequestVerifyData) error { if src == nil { - return ErrNilSignatureKeySourceWithToken - } else if r, ok := src.(SignedDataReader); ok { - return VerifyAccumulatedSignatures(&signDataReaderWithToken{ - SignedDataSource: src, - SignKeyPairSource: src, - - rdr: r, - token: src.GetSessionToken(), - }) + return ErrNilRequestVerifyData } - return VerifyAccumulatedSignatures(&signAccumWithToken{ - SignedDataSource: src, - SignKeyPairSource: src, + verSrc, err := GroupVerifyPayloads( + src, + src, + NewVerifiedSessionToken( + src.GetSessionToken(), + ), + ) + if err != nil { + return err + } - token: src.GetSessionToken(), - }) + return VerifyAccumulatedSignatures(verSrc) +} + +// SignedData returns payload bytes concatenation from all sources keeping order. +func (s signSourceGroup) SignedData() ([]byte, error) { + chunks := make([][]byte, 0, len(s.sources)) + sz := 0 + + for i := range s.sources { + data, err := s.sources[i].SignedData() + if err != nil { + return nil, errors.Wrapf(err, "could not get signed payload of element #%d", i) + } + + chunks = append(chunks, data) + + sz += len(data) + } + + res := make([]byte, sz) + off := 0 + + for i := range chunks { + off += copy(res[off:], chunks[i]) + } + + return res, nil +} + +// SignedData returns payload bytes concatenation from all readers. +func (s signReadersGroup) SignedData() ([]byte, error) { + return SignedDataFromReader(s) +} + +// SignedDataSize returns the sum of sizes of all readers. +func (s signReadersGroup) SignedDataSize() (sz int) { + for i := range s.readers { + sz += s.readers[i].SignedDataSize() + } + + return +} + +// ReadSignedData reads data from all readers to passed buffer keeping order. +// +// If the buffer size is insufficient, io.ErrUnexpectedEOF returns. +func (s signReadersGroup) ReadSignedData(p []byte) (int, error) { + sz := s.SignedDataSize() + if len(p) < sz { + return 0, io.ErrUnexpectedEOF + } + + off := 0 + + for i := range s.readers { + n, err := s.readers[i].ReadSignedData(p[off:]) + off += n + if err != nil { + return off, errors.Wrapf(err, "could not read signed payload of element #%d", i) + } + } + + return off, nil +} + +// GroupSignedPayloads groups SignKeyPairAccumulator and SignedDataSource list to DataWithSignKeyAccumulator. +// +// If passed SignKeyPairAccumulator is nil, ErrNilSignKeyPairAccumulator returns. +// +// Signed payload of the result is a concatenation of payloads of list elements keeping order. +// Nil elements in list are ignored. +// +// If all elements implement SignedDataReader, result implements it too. +func GroupSignedPayloads(acc SignKeyPairAccumulator, sources ...SignedDataSource) (DataWithSignKeyAccumulator, error) { + if acc == nil { + return nil, ErrNilSignKeyPairAccumulator + } + + return groupPayloads(acc, nil, sources...), nil +} + +// GroupVerifyPayloads groups SignKeyPairSource and SignedDataSource list to DataWithSignKeySource. +// +// If passed SignKeyPairSource is nil, ErrNilSignatureKeySource returns. +// +// Signed payload of the result is a concatenation of payloads of list elements keeping order. +// Nil elements in list are ignored. +// +// If all elements implement SignedDataReader, result implements it too. +func GroupVerifyPayloads(src SignKeyPairSource, sources ...SignedDataSource) (DataWithSignKeySource, error) { + if src == nil { + return nil, ErrNilSignatureKeySource + } + + return groupPayloads(nil, src, sources...), nil +} + +func groupPayloads(acc SignKeyPairAccumulator, src SignKeyPairSource, sources ...SignedDataSource) interface { + SignedDataSource + SignKeyPairSource + SignKeyPairAccumulator +} { + var allReaders bool + + for i := range sources { + if sources[i] == nil { + continue + } else if _, allReaders = sources[i].(SignedDataReader); !allReaders { + break + } + } + + if !allReaders { + res := &signSourceGroup{ + SignKeyPairSource: src, + SignKeyPairAccumulator: acc, + + sources: make([]SignedDataSource, 0, len(sources)), + } + + for i := range sources { + if sources[i] != nil { + res.sources = append(res.sources, sources[i]) + } + } + + return res + } + + res := &signReadersGroup{ + SignKeyPairSource: src, + SignKeyPairAccumulator: acc, + + readers: make([]SignedDataReader, 0, len(sources)), + } + + for i := range sources { + if sources[i] != nil { + res.readers = append(res.readers, sources[i].(SignedDataReader)) + } + } + + return res } diff --git a/service/sign_test.go b/service/sign_test.go index 5cb7c40..ca469b8 100644 --- a/service/sign_test.go +++ b/service/sign_test.go @@ -257,16 +257,16 @@ func TestVerifySignatureWithKey(t *testing.T) { } func TestSignVerifyDataWithSessionToken(t *testing.T) { - // sign with empty DataWithTokenSignAccumulator + // sign with empty RequestSignedData require.EqualError(t, - SignDataWithSessionToken(nil, nil), - ErrNilDataWithTokenSignAccumulator.Error(), + SignRequestData(nil, nil), + ErrNilRequestSignedData.Error(), ) - // verify with empty DataWithTokenSignSource + // verify with empty RequestVerifyData require.EqualError(t, - VerifyAccumulatedSignaturesWithToken(nil), - ErrNilSignatureKeySourceWithToken.Error(), + VerifyRequestData(nil), + ErrNilRequestVerifyData.Error(), ) // create test session token @@ -287,16 +287,16 @@ func TestSignVerifyDataWithSessionToken(t *testing.T) { sk := test.DecodeKey(0) // sign with private key - require.NoError(t, SignDataWithSessionToken(sk, src)) + require.NoError(t, SignRequestData(sk, src)) // ascertain that verification is passed - require.NoError(t, VerifyAccumulatedSignaturesWithToken(src)) + require.NoError(t, VerifyRequestData(src)) // break the data src.data[0]++ // ascertain that verification is failed - require.Error(t, VerifyAccumulatedSignaturesWithToken(src)) + require.Error(t, VerifyRequestData(src)) // restore the data src.data[0]-- @@ -305,13 +305,13 @@ func TestSignVerifyDataWithSessionToken(t *testing.T) { token.SetVerb(initVerb + 1) // ascertain that verification is failed - require.Error(t, VerifyAccumulatedSignaturesWithToken(src)) + require.Error(t, VerifyRequestData(src)) // restore the token token.SetVerb(initVerb) // ascertain that verification is passed - require.NoError(t, VerifyAccumulatedSignaturesWithToken(src)) + require.NoError(t, VerifyRequestData(src)) // wrap to data reader rdr := &testSignedDataReader{ @@ -319,8 +319,8 @@ func TestSignVerifyDataWithSessionToken(t *testing.T) { } // sign with private key - require.NoError(t, SignDataWithSessionToken(sk, rdr)) + require.NoError(t, SignRequestData(sk, rdr)) // ascertain that verification is passed - require.NoError(t, VerifyAccumulatedSignaturesWithToken(rdr)) + require.NoError(t, VerifyRequestData(rdr)) } diff --git a/service/types.go b/service/types.go index 66582f5..257b0ca 100644 --- a/service/types.go +++ b/service/types.go @@ -250,20 +250,20 @@ type DataWithSignKeySource interface { SignKeyPairSource } -// SignedDataWithToken is an interface of data-token pair with read access. -type SignedDataWithToken interface { +// RequestData is an interface of the request information with read access. +type RequestData interface { SignedDataSource SessionTokenSource } -// DataWithTokenSignAccumulator is an interface of data-token pair with signature write access. -type DataWithTokenSignAccumulator interface { - SignedDataWithToken +// RequestSignedData is an interface of request information with signature write access. +type RequestSignedData interface { + RequestData SignKeyPairAccumulator } -// DataWithTokenSignSource is an interface of data-token pair with signature read access. -type DataWithTokenSignSource interface { - SignedDataWithToken +// RequestVerifyData is an interface of request information with signature read access. +type RequestVerifyData interface { + RequestData SignKeyPairSource } diff --git a/service/verify_test.go b/service/verify_test.go index c6e4d61..e13f316 100644 --- a/service/verify_test.go +++ b/service/verify_test.go @@ -69,7 +69,7 @@ func BenchmarkSignDataWithSessionToken(b *testing.B) { b.ReportAllocs() for i := 0; i < b.N; i++ { - require.NoError(b, SignDataWithSessionToken(key, req)) + require.NoError(b, SignRequestData(key, req)) } } @@ -91,14 +91,14 @@ func BenchmarkVerifyAccumulatedSignaturesWithToken(b *testing.B) { for i := 0; i < 10; i++ { key := test.DecodeKey(i) - require.NoError(b, SignDataWithSessionToken(key, req)) + require.NoError(b, SignRequestData(key, req)) } b.ResetTimer() b.ReportAllocs() for i := 0; i < b.N; i++ { - require.NoError(b, VerifyAccumulatedSignaturesWithToken(req)) + require.NoError(b, VerifyRequestData(req)) } } diff --git a/session/create.go b/session/create.go index 35d0540..412d1fd 100644 --- a/session/create.go +++ b/session/create.go @@ -53,7 +53,7 @@ func (s gRPCCreator) Create(ctx context.Context, p CreateParamsSource) (CreateRe req.SetExpirationEpoch(p.ExpirationEpoch()) // sign with private key - if err := service.SignDataWithSessionToken(s.key, req); err != nil { + if err := service.SignRequestData(s.key, req); err != nil { return nil, err } diff --git a/session/create_test.go b/session/create_test.go index 732d4fd..943c5da 100644 --- a/session/create_test.go +++ b/session/create_test.go @@ -84,7 +84,7 @@ func TestGRPCCreator_Create(t *testing.T) { require.Equal(t, ownerID, req.GetOwnerID()) require.Equal(t, created, req.CreationEpoch()) require.Equal(t, expired, req.ExpirationEpoch()) - require.NoError(t, service.VerifyAccumulatedSignaturesWithToken(req)) + require.NoError(t, service.VerifyRequestData(req)) }, resp: &CreateResponse{ ID: TokenID{1, 2, 3}, diff --git a/state/sign_test.go b/state/sign_test.go index 9b2bca9..05af654 100644 --- a/state/sign_test.go +++ b/state/sign_test.go @@ -12,7 +12,7 @@ func TestRequestSign(t *testing.T) { sk := test.DecodeKey(0) type sigType interface { - service.SignedDataWithToken + service.RequestData service.SignKeyPairAccumulator service.SignKeyPairSource SetToken(*service.Token) @@ -68,26 +68,26 @@ func TestRequestSign(t *testing.T) { token := new(service.Token) v.SetToken(token) - require.NoError(t, service.SignDataWithSessionToken(sk, v)) + require.NoError(t, service.SignRequestData(sk, v)) - require.NoError(t, service.VerifyAccumulatedSignaturesWithToken(v)) + require.NoError(t, service.VerifyRequestData(v)) token.SetSessionKey(append(token.GetSessionKey(), 1)) - require.Error(t, service.VerifyAccumulatedSignaturesWithToken(v)) + require.Error(t, service.VerifyRequestData(v)) } { // payload corruptions for _, corruption := range item.payloadCorrupt { v := item.constructor() - require.NoError(t, service.SignDataWithSessionToken(sk, v)) + require.NoError(t, service.SignRequestData(sk, v)) - require.NoError(t, service.VerifyAccumulatedSignaturesWithToken(v)) + require.NoError(t, service.VerifyRequestData(v)) corruption(v) - require.Error(t, service.VerifyAccumulatedSignaturesWithToken(v)) + require.Error(t, service.VerifyRequestData(v)) } } } From 55c3b714c0cd6032011932162fbfd0cfe3281f55 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 18 Jun 2020 14:25:19 +0300 Subject: [PATCH 0232/1196] service: define BearerToken interface --- service/bearer.go | 96 +++++++++++++++++++++++ service/bearer_test.go | 172 +++++++++++++++++++++++++++++++++++++++++ service/types.go | 34 ++++++++ 3 files changed, 302 insertions(+) create mode 100644 service/bearer.go create mode 100644 service/bearer_test.go diff --git a/service/bearer.go b/service/bearer.go new file mode 100644 index 0000000..bc8aaa5 --- /dev/null +++ b/service/bearer.go @@ -0,0 +1,96 @@ +package service + +import ( + "crypto/ecdsa" + "io" + + "github.com/nspcc-dev/neofs-api-go/refs" + crypto "github.com/nspcc-dev/neofs-crypto" +) + +type signedBearerToken struct { + BearerToken +} + +const fixedBearerTokenDataSize = 0 + + refs.OwnerIDSize + + 8 + +// NewSignedBearerToken wraps passed BearerToken in a component suitable for signing. +// +// Result can be used in AddSignatureWithKey function. +func NewSignedBearerToken(token BearerToken) DataWithSignKeyAccumulator { + return &signedBearerToken{ + BearerToken: token, + } +} + +// NewVerifiedBearerToken wraps passed SessionToken in a component suitable for signature verification. +// +// Result can be used in VerifySignatureWithKey function. +func NewVerifiedBearerToken(token BearerToken) DataWithSignature { + return &signedBearerToken{ + BearerToken: token, + } +} + +// AddSignKey calls a Signature field setter and an OwnerKey field setter with corresponding arguments. +func (s signedBearerToken) AddSignKey(sig []byte, key *ecdsa.PublicKey) { + if s.BearerToken != nil { + s.SetSignature(sig) + + s.SetOwnerKey( + crypto.MarshalPublicKey(key), + ) + } +} + +// SignedData returns token information in a binary representation. +func (s signedBearerToken) SignedData() ([]byte, error) { + return SignedDataFromReader(s) +} + +// SignedDataSize returns the length of signed token information slice. +func (s signedBearerToken) SignedDataSize() int { + return bearerTokenInfoSize(s.BearerToken) +} + +// ReadSignedData copies a binary representation of the token information to passed buffer. +// +// If buffer length is less than required, io.ErrUnexpectedEOF returns. +func (s signedBearerToken) ReadSignedData(p []byte) (int, error) { + sz := s.SignedDataSize() + if len(p) < sz { + return 0, io.ErrUnexpectedEOF + } + + copyBearerTokenSignedData(p, s.BearerToken) + + return sz, nil +} + +func bearerTokenInfoSize(v ACLRulesSource) int { + if v == nil { + return 0 + } + return fixedBearerTokenDataSize + len(v.GetACLRules()) +} + +// Fills passed buffer with signing token information bytes. +// Does not check buffer length, it is understood that enough space is allocated in it. +// +// If passed BearerTokenInfo, buffer remains unchanged. +func copyBearerTokenSignedData(buf []byte, token BearerTokenInfo) { + if token == nil { + return + } + + var off int + + off += copy(buf[off:], token.GetACLRules()) + + off += copy(buf[off:], token.GetOwnerID().Bytes()) + + tokenEndianness.PutUint64(buf[off:], token.ExpirationEpoch()) + off += 8 +} diff --git a/service/bearer_test.go b/service/bearer_test.go new file mode 100644 index 0000000..da359f2 --- /dev/null +++ b/service/bearer_test.go @@ -0,0 +1,172 @@ +package service + +import ( + "crypto/rand" + "testing" + + "github.com/nspcc-dev/neofs-crypto/test" + "github.com/stretchr/testify/require" +) + +type testBearerToken struct { + aclRules []byte + expEpoch uint64 + owner OwnerID + key []byte + sig []byte +} + +func (s testBearerToken) GetACLRules() []byte { + return s.aclRules +} + +func (s *testBearerToken) SetACLRules(v []byte) { + s.aclRules = v +} + +func (s testBearerToken) ExpirationEpoch() uint64 { + return s.expEpoch +} + +func (s *testBearerToken) SetExpirationEpoch(v uint64) { + s.expEpoch = v +} + +func (s testBearerToken) GetOwnerID() OwnerID { + return s.owner +} + +func (s *testBearerToken) SetOwnerID(v OwnerID) { + s.owner = v +} + +func (s testBearerToken) GetOwnerKey() []byte { + return s.key +} + +func (s *testBearerToken) SetOwnerKey(v []byte) { + s.key = v +} + +func (s testBearerToken) GetSignature() []byte { + return s.sig +} + +func (s *testBearerToken) SetSignature(v []byte) { + s.sig = v +} + +func TestBearerTokenMsgGettersSetters(t *testing.T) { + var tok BearerToken = new(testBearerToken) + + { // ACLRules + rules := []byte{1, 2, 3} + + tok.SetACLRules(rules) + + require.Equal(t, rules, tok.GetACLRules()) + } + + { // OwnerID + ownerID := OwnerID{} + _, err := rand.Read(ownerID[:]) + require.NoError(t, err) + + tok.SetOwnerID(ownerID) + + require.Equal(t, ownerID, tok.GetOwnerID()) + } + + { // ValidUntil + e := uint64(5) + + tok.SetExpirationEpoch(e) + + require.Equal(t, e, tok.ExpirationEpoch()) + } + + { // OwnerKey + key := make([]byte, 10) + _, err := rand.Read(key) + require.NoError(t, err) + + tok.SetOwnerKey(key) + + require.Equal(t, key, tok.GetOwnerKey()) + } + + { // Signature + sig := make([]byte, 10) + _, err := rand.Read(sig) + require.NoError(t, err) + + tok.SetSignature(sig) + + require.Equal(t, sig, tok.GetSignature()) + } +} + +func TestSignVerifyBearerToken(t *testing.T) { + var token BearerToken = new(testBearerToken) + + // create private key for signing + sk := test.DecodeKey(0) + pk := &sk.PublicKey + + rules := []byte{1, 2, 3} + token.SetACLRules(rules) + + ownerID := OwnerID{} + _, err := rand.Read(ownerID[:]) + require.NoError(t, err) + token.SetOwnerID(ownerID) + + fEpoch := uint64(2) + token.SetExpirationEpoch(fEpoch) + + signedToken := NewSignedBearerToken(token) + verifiedToken := NewVerifiedBearerToken(token) + + // sign and verify token + require.NoError(t, AddSignatureWithKey(sk, signedToken)) + require.NoError(t, VerifySignatureWithKey(pk, verifiedToken)) + + items := []struct { + corrupt func() + restore func() + }{ + { // ACLRules + corrupt: func() { + token.SetACLRules(append(rules, 1)) + }, + restore: func() { + token.SetACLRules(rules) + }, + }, + { // Owner ID + corrupt: func() { + ownerID[0]++ + token.SetOwnerID(ownerID) + }, + restore: func() { + ownerID[0]-- + token.SetOwnerID(ownerID) + }, + }, + { // Expiration epoch + corrupt: func() { + token.SetExpirationEpoch(fEpoch + 1) + }, + restore: func() { + token.SetExpirationEpoch(fEpoch) + }, + }, + } + + for _, v := range items { + v.corrupt() + require.Error(t, VerifySignatureWithKey(pk, verifiedToken)) + v.restore() + require.NoError(t, VerifySignatureWithKey(pk, verifiedToken)) + } +} diff --git a/service/types.go b/service/types.go index 257b0ca..dada0c8 100644 --- a/service/types.go +++ b/service/types.go @@ -267,3 +267,37 @@ type RequestVerifyData interface { RequestData SignKeyPairSource } + +// ACLRulesSource is an interface of the container of binary extended ACL rules with read access. +type ACLRulesSource interface { + GetACLRules() []byte +} + +// ACLRulesContainer is an interface of the container of binary extended ACL rules. +type ACLRulesContainer interface { + ACLRulesSource + SetACLRules([]byte) +} + +// BearerTokenInfo is an interface of a fixed set of Bearer token information value containers. +// Contains: +// - binary extended ACL rules; +// - expiration epoch number; +// - ID of the token's owner. +type BearerTokenInfo interface { + ACLRulesContainer + ExpirationEpochContainer + OwnerIDContainer +} + +// BearerToken is an interface of Bearer token information and key-signature pair. +type BearerToken interface { + BearerTokenInfo + OwnerKeyContainer + SignatureContainer +} + +// BearerTokenSource is an interface of the container of a BearerToken with read access. +type BearerTokenSource interface { + GetBearerToken() BearerToken +} From 705582dbc7084c41a87aafd7d3d5d8427aff74ea Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 18 Jun 2020 14:35:14 +0300 Subject: [PATCH 0233/1196] service: define request X-headers interface --- service/meta.go | 58 ++++++++++++++++++++++++++++++++++++++++++++++++ service/types.go | 11 +++++++++ 2 files changed, 69 insertions(+) diff --git a/service/meta.go b/service/meta.go index 3f01758..f1b4613 100644 --- a/service/meta.go +++ b/service/meta.go @@ -1,5 +1,13 @@ package service +import ( + "io" +) + +type extHdrSrcWrapper struct { + extHdrSrc ExtendedHeadersSource +} + // CutMeta returns current value and sets RequestMetaHeader to empty value. func (m *RequestMetaHeader) CutMeta() RequestMetaHeader { cp := *m @@ -11,3 +19,53 @@ func (m *RequestMetaHeader) CutMeta() RequestMetaHeader { func (m *RequestMetaHeader) RestoreMeta(v RequestMetaHeader) { *m = v } + +// ExtendedHeadersSignedData wraps passed ExtendedHeadersSource and returns SignedDataSource. +func ExtendedHeadersSignedData(headers ExtendedHeadersSource) SignedDataSource { + return &extHdrSrcWrapper{ + extHdrSrc: headers, + } +} + +// SignedData returns extended headers in a binary representation. +func (s extHdrSrcWrapper) SignedData() ([]byte, error) { + return SignedDataFromReader(s) +} + +// SignedDataSize returns the length of extended headers slice. +func (s extHdrSrcWrapper) SignedDataSize() (res int) { + if s.extHdrSrc != nil { + for _, h := range s.extHdrSrc.ExtendedHeaders() { + if h != nil { + res += len(h.Key()) + len(h.Value()) + } + } + } + + return +} + +// ReadSignedData copies a binary representation of the extended headers to passed buffer. +// +// If buffer length is less than required, io.ErrUnexpectedEOF returns. +func (s extHdrSrcWrapper) ReadSignedData(p []byte) (int, error) { + sz := s.SignedDataSize() + if len(p) < sz { + return 0, io.ErrUnexpectedEOF + } + + if s.extHdrSrc != nil { + off := 0 + for _, h := range s.extHdrSrc.ExtendedHeaders() { + if h == nil { + continue + } + + off += copy(p[off:], []byte(h.Key())) + + off += copy(p[off:], []byte(h.Value())) + } + } + + return sz, nil +} diff --git a/service/types.go b/service/types.go index dada0c8..87c3a77 100644 --- a/service/types.go +++ b/service/types.go @@ -301,3 +301,14 @@ type BearerToken interface { type BearerTokenSource interface { GetBearerToken() BearerToken } + +// ExtendedHeader is an interface of string key-value pair with read access. +type ExtendedHeader interface { + Key() string + Value() string +} + +// ExtendedHeadersSource is an interface of ExtendedHeader list with read access. +type ExtendedHeadersSource interface { + ExtendedHeaders() []ExtendedHeader +} From ee584f325caa9652a8a30d7455577c59d4c08fee Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 18 Jun 2020 15:01:25 +0300 Subject: [PATCH 0234/1196] Update to neofs-api v1.1.0 --- Makefile | 2 +- container/service.pb.go | 1478 +++++++++++++++++++++++++++++++++++++-- container/service.proto | 45 ++ container/types.go | 20 + container/types_test.go | 20 + docs/container.md | 90 +++ docs/service.md | 55 ++ service/bearer.go | 30 + service/bearer_test.go | 24 + service/meta.go | 15 + service/meta.pb.go | 524 +++++++++++++- service/meta.proto | 17 + service/meta_test.go | 28 + service/verify.go | 5 + service/verify.pb.go | 701 +++++++++++++++++-- service/verify.proto | 26 + service/verify_test.go | 13 + 17 files changed, 2989 insertions(+), 104 deletions(-) diff --git a/Makefile b/Makefile index 3dcd690..159c7e3 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -PROTO_VERSION=v1.0.0 +PROTO_VERSION=v1.1.0 PROTO_URL=https://github.com/nspcc-dev/neofs-api/archive/$(PROTO_VERSION).tar.gz B=\033[0;1m diff --git a/container/service.pb.go b/container/service.pb.go index 6131254..f49f79f 100644 --- a/container/service.pb.go +++ b/container/service.pb.go @@ -377,6 +377,252 @@ func (m *ListResponse) XXX_DiscardUnknown() { var xxx_messageInfo_ListResponse proto.InternalMessageInfo +type ExtendedACLKey struct { + // ID (container id) is a SHA256 hash of the container structure + ID CID `protobuf:"bytes,1,opt,name=ID,proto3,customtype=CID" json:"ID"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ExtendedACLKey) Reset() { *m = ExtendedACLKey{} } +func (m *ExtendedACLKey) String() string { return proto.CompactTextString(m) } +func (*ExtendedACLKey) ProtoMessage() {} +func (*ExtendedACLKey) Descriptor() ([]byte, []int) { + return fileDescriptor_e1fa9d7ab2e7ae06, []int{8} +} +func (m *ExtendedACLKey) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ExtendedACLKey) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *ExtendedACLKey) XXX_Merge(src proto.Message) { + xxx_messageInfo_ExtendedACLKey.Merge(m, src) +} +func (m *ExtendedACLKey) XXX_Size() int { + return m.Size() +} +func (m *ExtendedACLKey) XXX_DiscardUnknown() { + xxx_messageInfo_ExtendedACLKey.DiscardUnknown(m) +} + +var xxx_messageInfo_ExtendedACLKey proto.InternalMessageInfo + +type ExtendedACLValue struct { + // EACL carries binary representation of the table of extended ACL rules + EACL []byte `protobuf:"bytes,1,opt,name=EACL,proto3" json:"EACL,omitempty"` + // Signature carries EACL field signature + Signature []byte `protobuf:"bytes,2,opt,name=Signature,proto3" json:"Signature,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ExtendedACLValue) Reset() { *m = ExtendedACLValue{} } +func (m *ExtendedACLValue) String() string { return proto.CompactTextString(m) } +func (*ExtendedACLValue) ProtoMessage() {} +func (*ExtendedACLValue) Descriptor() ([]byte, []int) { + return fileDescriptor_e1fa9d7ab2e7ae06, []int{9} +} +func (m *ExtendedACLValue) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ExtendedACLValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *ExtendedACLValue) XXX_Merge(src proto.Message) { + xxx_messageInfo_ExtendedACLValue.Merge(m, src) +} +func (m *ExtendedACLValue) XXX_Size() int { + return m.Size() +} +func (m *ExtendedACLValue) XXX_DiscardUnknown() { + xxx_messageInfo_ExtendedACLValue.DiscardUnknown(m) +} + +var xxx_messageInfo_ExtendedACLValue proto.InternalMessageInfo + +func (m *ExtendedACLValue) GetEACL() []byte { + if m != nil { + return m.EACL + } + return nil +} + +func (m *ExtendedACLValue) GetSignature() []byte { + if m != nil { + return m.Signature + } + return nil +} + +type SetExtendedACLRequest struct { + // Key carries key to extended ACL information + ExtendedACLKey `protobuf:"bytes,1,opt,name=Key,proto3,embedded=Key" json:"Key"` + // Value carries extended ACL information + ExtendedACLValue `protobuf:"bytes,2,opt,name=Value,proto3,embedded=Value" json:"Value"` + // RequestMetaHeader contains information about request meta headers (should be embedded into message) + service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` + // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) + service.RequestVerificationHeader `protobuf:"bytes,99,opt,name=Verify,proto3,embedded=Verify" json:"Verify"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SetExtendedACLRequest) Reset() { *m = SetExtendedACLRequest{} } +func (m *SetExtendedACLRequest) String() string { return proto.CompactTextString(m) } +func (*SetExtendedACLRequest) ProtoMessage() {} +func (*SetExtendedACLRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_e1fa9d7ab2e7ae06, []int{10} +} +func (m *SetExtendedACLRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *SetExtendedACLRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *SetExtendedACLRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_SetExtendedACLRequest.Merge(m, src) +} +func (m *SetExtendedACLRequest) XXX_Size() int { + return m.Size() +} +func (m *SetExtendedACLRequest) XXX_DiscardUnknown() { + xxx_messageInfo_SetExtendedACLRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_SetExtendedACLRequest proto.InternalMessageInfo + +type SetExtendedACLResponse struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SetExtendedACLResponse) Reset() { *m = SetExtendedACLResponse{} } +func (m *SetExtendedACLResponse) String() string { return proto.CompactTextString(m) } +func (*SetExtendedACLResponse) ProtoMessage() {} +func (*SetExtendedACLResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_e1fa9d7ab2e7ae06, []int{11} +} +func (m *SetExtendedACLResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *SetExtendedACLResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *SetExtendedACLResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_SetExtendedACLResponse.Merge(m, src) +} +func (m *SetExtendedACLResponse) XXX_Size() int { + return m.Size() +} +func (m *SetExtendedACLResponse) XXX_DiscardUnknown() { + xxx_messageInfo_SetExtendedACLResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_SetExtendedACLResponse proto.InternalMessageInfo + +type GetExtendedACLRequest struct { + // Key carries key to extended ACL information + ExtendedACLKey `protobuf:"bytes,1,opt,name=Key,proto3,embedded=Key" json:"Key"` + // RequestMetaHeader contains information about request meta headers (should be embedded into message) + service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` + // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) + service.RequestVerificationHeader `protobuf:"bytes,99,opt,name=Verify,proto3,embedded=Verify" json:"Verify"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetExtendedACLRequest) Reset() { *m = GetExtendedACLRequest{} } +func (m *GetExtendedACLRequest) String() string { return proto.CompactTextString(m) } +func (*GetExtendedACLRequest) ProtoMessage() {} +func (*GetExtendedACLRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_e1fa9d7ab2e7ae06, []int{12} +} +func (m *GetExtendedACLRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GetExtendedACLRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *GetExtendedACLRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetExtendedACLRequest.Merge(m, src) +} +func (m *GetExtendedACLRequest) XXX_Size() int { + return m.Size() +} +func (m *GetExtendedACLRequest) XXX_DiscardUnknown() { + xxx_messageInfo_GetExtendedACLRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_GetExtendedACLRequest proto.InternalMessageInfo + +type GetExtendedACLResponse struct { + // ACL carries extended ACL information + ExtendedACLValue `protobuf:"bytes,1,opt,name=ACL,proto3,embedded=ACL" json:"ACL"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetExtendedACLResponse) Reset() { *m = GetExtendedACLResponse{} } +func (m *GetExtendedACLResponse) String() string { return proto.CompactTextString(m) } +func (*GetExtendedACLResponse) ProtoMessage() {} +func (*GetExtendedACLResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_e1fa9d7ab2e7ae06, []int{13} +} +func (m *GetExtendedACLResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GetExtendedACLResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *GetExtendedACLResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetExtendedACLResponse.Merge(m, src) +} +func (m *GetExtendedACLResponse) XXX_Size() int { + return m.Size() +} +func (m *GetExtendedACLResponse) XXX_DiscardUnknown() { + xxx_messageInfo_GetExtendedACLResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_GetExtendedACLResponse proto.InternalMessageInfo + func init() { proto.RegisterType((*PutRequest)(nil), "container.PutRequest") proto.RegisterType((*PutResponse)(nil), "container.PutResponse") @@ -386,50 +632,67 @@ func init() { proto.RegisterType((*GetResponse)(nil), "container.GetResponse") proto.RegisterType((*ListRequest)(nil), "container.ListRequest") proto.RegisterType((*ListResponse)(nil), "container.ListResponse") + proto.RegisterType((*ExtendedACLKey)(nil), "container.ExtendedACLKey") + proto.RegisterType((*ExtendedACLValue)(nil), "container.ExtendedACLValue") + proto.RegisterType((*SetExtendedACLRequest)(nil), "container.SetExtendedACLRequest") + proto.RegisterType((*SetExtendedACLResponse)(nil), "container.SetExtendedACLResponse") + proto.RegisterType((*GetExtendedACLRequest)(nil), "container.GetExtendedACLRequest") + proto.RegisterType((*GetExtendedACLResponse)(nil), "container.GetExtendedACLResponse") } func init() { proto.RegisterFile("container/service.proto", fileDescriptor_e1fa9d7ab2e7ae06) } var fileDescriptor_e1fa9d7ab2e7ae06 = []byte{ - // 596 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x54, 0xcb, 0x6e, 0xd3, 0x4c, - 0x14, 0xee, 0x34, 0xe9, 0xed, 0xb8, 0xfd, 0x7f, 0x18, 0x5a, 0x6a, 0x2c, 0x91, 0x46, 0x5e, 0x85, - 0x4b, 0x6c, 0x11, 0x2a, 0xc1, 0x86, 0x45, 0x93, 0x88, 0x52, 0xa9, 0x85, 0xc8, 0x95, 0x40, 0x62, - 0x37, 0x71, 0x4f, 0x83, 0xa5, 0xc4, 0x63, 0x3c, 0xe3, 0xa2, 0xbe, 0x09, 0xcf, 0x00, 0x12, 0x6b, - 0x1e, 0xa1, 0xcb, 0x4a, 0x6c, 0x10, 0x8b, 0x08, 0x85, 0x35, 0xef, 0x80, 0x3c, 0xbe, 0x26, 0x2d, - 0xb0, 0xac, 0xd8, 0x58, 0x33, 0xdf, 0x77, 0xbe, 0x73, 0xf7, 0xc0, 0xa6, 0xcb, 0x7d, 0xc9, 0x3c, - 0x1f, 0x43, 0x5b, 0x60, 0x78, 0xe2, 0xb9, 0x68, 0x05, 0x21, 0x97, 0x9c, 0xae, 0xe4, 0x84, 0x41, - 0x53, 0xc6, 0x1e, 0xa1, 0x64, 0x09, 0x6d, 0xac, 0x67, 0xd8, 0x09, 0x86, 0xde, 0xf1, 0x69, 0x8a, - 0x6e, 0x14, 0xde, 0xe4, 0x69, 0x80, 0x22, 0x85, 0xef, 0x0e, 0x3c, 0xf9, 0x26, 0xea, 0x5b, 0x2e, - 0x1f, 0xd9, 0xbe, 0x08, 0x5c, 0xb7, 0x79, 0x84, 0x27, 0xb6, 0x8f, 0x72, 0xc4, 0x02, 0x5b, 0xe0, - 0x10, 0x5d, 0xc9, 0xc3, 0xd4, 0xb6, 0x59, 0xb2, 0x1d, 0xf0, 0x01, 0xb7, 0x15, 0xdc, 0x8f, 0x8e, - 0xd5, 0x4d, 0x5d, 0xd4, 0x29, 0x31, 0x37, 0xbf, 0xcc, 0x03, 0xf4, 0x22, 0xe9, 0xe0, 0xdb, 0x08, - 0x85, 0xa4, 0x36, 0xac, 0x1c, 0xa0, 0x10, 0x6c, 0x80, 0x7b, 0x5d, 0x9d, 0xd4, 0x49, 0x63, 0xb5, - 0x7d, 0xfd, 0x6c, 0xbc, 0x35, 0xf7, 0x6d, 0xbc, 0x55, 0x10, 0x4e, 0x71, 0xa4, 0x06, 0x2c, 0x77, - 0x58, 0xc0, 0x5c, 0x4f, 0x9e, 0xea, 0xf3, 0x75, 0xd2, 0xa8, 0x3a, 0xf9, 0x9d, 0xde, 0x81, 0xa5, - 0x17, 0xef, 0x7c, 0x0c, 0xf7, 0xba, 0x7a, 0x45, 0xb9, 0xfa, 0x3f, 0x75, 0x95, 0xc1, 0x4e, 0x76, - 0xa0, 0x0f, 0x60, 0x21, 0x8c, 0x86, 0x28, 0xf4, 0x6a, 0x9d, 0x34, 0xb4, 0xd6, 0x86, 0x95, 0x14, - 0x67, 0xf5, 0x86, 0xcc, 0xc5, 0x11, 0xfa, 0xd2, 0x89, 0x86, 0xd8, 0xae, 0xc6, 0x7a, 0x27, 0xb1, - 0x8c, 0x23, 0xb7, 0x99, 0xf0, 0xdc, 0x9d, 0xce, 0xbe, 0xbe, 0x50, 0x27, 0x8d, 0x35, 0x27, 0xbf, - 0xd3, 0xc7, 0x50, 0x3d, 0x40, 0xc9, 0xf4, 0xbe, 0xf2, 0x66, 0x58, 0xd9, 0x68, 0xd2, 0x32, 0x63, - 0xee, 0x19, 0xb2, 0x23, 0x0c, 0xdb, 0xcb, 0xb1, 0xcb, 0xf3, 0xf1, 0x16, 0x71, 0x94, 0x82, 0x76, - 0x61, 0xf1, 0xa5, 0x9a, 0x88, 0xee, 0x2a, 0xad, 0x39, 0xab, 0x55, 0xac, 0xe7, 0x32, 0xe9, 0x71, - 0xff, 0x82, 0x8f, 0x54, 0x6b, 0xde, 0x07, 0x4d, 0x35, 0x55, 0x04, 0xdc, 0x17, 0x48, 0x6f, 0x43, - 0xa5, 0x93, 0xf7, 0x53, 0x4b, 0x9b, 0x10, 0x43, 0x4e, 0xfc, 0x31, 0x3f, 0x11, 0x58, 0xeb, 0xe2, - 0x10, 0x25, 0x66, 0x63, 0xf8, 0xb3, 0xe0, 0xca, 0xcb, 0xbb, 0x06, 0xff, 0x65, 0xf9, 0x26, 0x15, - 0x9a, 0x1f, 0x09, 0xc0, 0x2e, 0xca, 0x7f, 0x24, 0xff, 0x1d, 0xd0, 0x54, 0xb2, 0xe9, 0x78, 0x5a, - 0xb0, 0xd2, 0xc9, 0xfe, 0x3b, 0x95, 0xb3, 0xd6, 0x5a, 0xb7, 0xf2, 0x3f, 0xd1, 0xca, 0x39, 0xa7, - 0x30, 0x33, 0x3f, 0x13, 0xd0, 0xf6, 0x3d, 0x91, 0x57, 0x5c, 0xda, 0x75, 0xf2, 0x97, 0x5d, 0xbf, - 0xea, 0xea, 0x9b, 0xb0, 0x9a, 0x64, 0x3e, 0xbb, 0x9d, 0x95, 0xcb, 0x86, 0xd5, 0xfa, 0x49, 0x60, - 0xe9, 0x30, 0x09, 0x43, 0xb7, 0xa1, 0xd2, 0x8b, 0x24, 0xdd, 0x28, 0x75, 0xa7, 0x78, 0x3c, 0x8c, - 0x9b, 0xb3, 0x70, 0x1a, 0xe0, 0x09, 0x2c, 0x26, 0xeb, 0x42, 0xf5, 0x92, 0xc5, 0xd4, 0xc6, 0x1b, - 0xb7, 0x2e, 0x61, 0x52, 0xf9, 0x36, 0x54, 0x76, 0x71, 0x3a, 0x68, 0xb1, 0x6a, 0x53, 0x41, 0xcb, - 0x43, 0x7d, 0x04, 0xd5, 0xb8, 0x4a, 0x5a, 0xe6, 0x4b, 0x03, 0x33, 0x36, 0x2f, 0xe0, 0x89, 0xb0, - 0xfd, 0xea, 0x6c, 0x52, 0x23, 0xe7, 0x93, 0x1a, 0xf9, 0x3a, 0xa9, 0x91, 0xef, 0x93, 0x1a, 0x79, - 0xff, 0xa3, 0x36, 0xf7, 0xfa, 0xde, 0x6f, 0x9e, 0x60, 0x7e, 0x2c, 0x9a, 0x2c, 0xf0, 0x9a, 0x03, - 0x6e, 0xe7, 0xfe, 0x3e, 0xcc, 0xdf, 0x78, 0x8e, 0xfc, 0xe9, 0xa1, 0xb5, 0xd3, 0xdb, 0x2b, 0xb6, - 0xa7, 0xbf, 0xa8, 0x5e, 0xdc, 0x87, 0xbf, 0x02, 0x00, 0x00, 0xff, 0xff, 0x5b, 0x68, 0x23, 0x86, - 0x33, 0x06, 0x00, 0x00, + // 773 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x56, 0xcb, 0x6e, 0xdb, 0x46, + 0x14, 0x35, 0x45, 0xf9, 0xa1, 0x2b, 0xdb, 0x75, 0xa7, 0x96, 0x4d, 0xd3, 0xad, 0xac, 0x72, 0xa5, + 0x3e, 0x44, 0xa2, 0xaa, 0x0b, 0x17, 0x28, 0xba, 0xd0, 0xc3, 0x55, 0x05, 0xdb, 0xad, 0x4a, 0xa1, + 0x0e, 0x90, 0x1d, 0x45, 0x5d, 0x2b, 0x04, 0x24, 0x52, 0x21, 0x87, 0x4e, 0xf4, 0x0d, 0xf9, 0x81, + 0x00, 0xf9, 0x83, 0x04, 0xc8, 0x3a, 0x9f, 0xe0, 0x55, 0x60, 0x20, 0x9b, 0x20, 0x0b, 0x23, 0x50, + 0x7e, 0x24, 0xe0, 0xf0, 0x29, 0x59, 0xb6, 0xb3, 0x08, 0x20, 0x64, 0x23, 0xcc, 0xdc, 0x7b, 0xcf, + 0x99, 0xfb, 0x16, 0x61, 0x5b, 0xb7, 0x4c, 0xaa, 0x19, 0x26, 0xda, 0x8a, 0x83, 0xf6, 0xb9, 0xa1, + 0xa3, 0x3c, 0xb4, 0x2d, 0x6a, 0x91, 0x4c, 0xa4, 0x10, 0x49, 0xa0, 0x51, 0x06, 0x48, 0x35, 0x5f, + 0x2d, 0x6e, 0x86, 0xb2, 0x73, 0xb4, 0x8d, 0xb3, 0x51, 0x20, 0xcd, 0xc5, 0x6c, 0x74, 0x34, 0x44, + 0x27, 0x10, 0xff, 0xd8, 0x33, 0xe8, 0x03, 0xb7, 0x23, 0xeb, 0xd6, 0x40, 0x31, 0x9d, 0xa1, 0xae, + 0x97, 0xba, 0x78, 0xae, 0x98, 0x48, 0x07, 0xda, 0x50, 0x71, 0xb0, 0x8f, 0x3a, 0xb5, 0xec, 0xc0, + 0xb6, 0x94, 0xb0, 0xed, 0x59, 0x3d, 0x4b, 0x61, 0xe2, 0x8e, 0x7b, 0xc6, 0x6e, 0xec, 0xc2, 0x4e, + 0xbe, 0xb9, 0xf4, 0x26, 0x05, 0xd0, 0x72, 0xa9, 0x8a, 0x0f, 0x5d, 0x74, 0x28, 0x51, 0x20, 0x73, + 0x82, 0x8e, 0xa3, 0xf5, 0xb0, 0x59, 0x17, 0xb8, 0x02, 0x57, 0x5c, 0xad, 0x7e, 0x7d, 0x71, 0xb5, + 0xb7, 0xf0, 0xee, 0x6a, 0x2f, 0x56, 0xa8, 0xf1, 0x91, 0x88, 0xb0, 0x52, 0xd3, 0x86, 0x9a, 0x6e, + 0xd0, 0x91, 0x90, 0x2a, 0x70, 0xc5, 0xb4, 0x1a, 0xdd, 0xc9, 0x0f, 0xb0, 0xfc, 0xef, 0x23, 0x13, + 0xed, 0x66, 0x5d, 0xe0, 0x19, 0xd5, 0x57, 0x01, 0x55, 0x28, 0x56, 0xc3, 0x03, 0xf9, 0x05, 0x16, + 0x6d, 0xb7, 0x8f, 0x8e, 0x90, 0x2e, 0x70, 0xc5, 0x6c, 0x39, 0x27, 0xfb, 0xc1, 0xc9, 0xad, 0xbe, + 0xa6, 0xe3, 0x00, 0x4d, 0xaa, 0xba, 0x7d, 0xac, 0xa6, 0x3d, 0xbc, 0xea, 0x5b, 0x7a, 0x2f, 0x57, + 0x35, 0xc7, 0xd0, 0x2b, 0xb5, 0x63, 0x61, 0xb1, 0xc0, 0x15, 0xd7, 0xd4, 0xe8, 0x4e, 0x7e, 0x87, + 0xf4, 0x09, 0x52, 0x4d, 0xe8, 0x30, 0x36, 0x51, 0x0e, 0x4b, 0x13, 0x84, 0xe9, 0xe9, 0xfe, 0x46, + 0xad, 0x8b, 0x76, 0x75, 0xc5, 0xa3, 0xbc, 0xbc, 0xda, 0xe3, 0x54, 0x86, 0x20, 0x75, 0x58, 0x3a, + 0x65, 0x15, 0x11, 0x74, 0x86, 0x95, 0xa6, 0xb1, 0x4c, 0x6b, 0xe8, 0x1a, 0x35, 0x2c, 0xf3, 0x1a, + 0x47, 0x80, 0x95, 0x7e, 0x86, 0x2c, 0x4b, 0xaa, 0x33, 0xb4, 0x4c, 0x07, 0xc9, 0x77, 0xc0, 0xd7, + 0xa2, 0x7c, 0x66, 0x83, 0x24, 0x78, 0x22, 0xd5, 0xfb, 0x91, 0x5e, 0x72, 0xb0, 0x56, 0xc7, 0x3e, + 0x52, 0x0c, 0xcb, 0x70, 0x3b, 0x60, 0xee, 0xe1, 0x6d, 0xc0, 0x7a, 0xe8, 0xaf, 0x1f, 0xa1, 0xf4, + 0x82, 0x03, 0x68, 0x20, 0xfd, 0x42, 0xfc, 0xaf, 0x40, 0x96, 0x39, 0x1b, 0x94, 0xa7, 0x0c, 0x99, + 0x5a, 0x38, 0x77, 0xcc, 0xe7, 0x6c, 0x79, 0x53, 0x8e, 0x26, 0x51, 0x8e, 0x74, 0x6a, 0x6c, 0x26, + 0xbd, 0xe2, 0x20, 0x7b, 0x6c, 0x38, 0x51, 0xc4, 0x89, 0x5e, 0xe7, 0xee, 0xe8, 0xf5, 0x79, 0x47, + 0x5f, 0x82, 0x55, 0xdf, 0xf3, 0xe9, 0xee, 0xe4, 0x67, 0x76, 0x67, 0x09, 0xd6, 0x0f, 0x1f, 0x53, + 0x34, 0xbb, 0xd8, 0xad, 0xd4, 0x8e, 0x8f, 0x70, 0x44, 0x76, 0x21, 0x35, 0xbb, 0xb8, 0xa9, 0x66, + 0x5d, 0xaa, 0xc3, 0x46, 0xc2, 0xfc, 0x54, 0xeb, 0xbb, 0x48, 0x08, 0xa4, 0x0f, 0xbd, 0x31, 0x65, + 0x10, 0x95, 0x9d, 0xc9, 0xb7, 0x90, 0x69, 0x1b, 0x3d, 0x53, 0xa3, 0xae, 0x8d, 0x6c, 0x73, 0xac, + 0xaa, 0xb1, 0x40, 0x7a, 0x92, 0x82, 0x5c, 0x1b, 0x69, 0x82, 0x29, 0x4c, 0xf4, 0x6f, 0xc0, 0x1f, + 0xe1, 0x28, 0x28, 0xd3, 0x4e, 0xa2, 0x4c, 0x93, 0x4e, 0x26, 0xe2, 0xf6, 0xec, 0xc9, 0x1f, 0xb0, + 0xc8, 0x7c, 0x61, 0x4f, 0x65, 0xcb, 0xbb, 0xb3, 0x81, 0xcc, 0x24, 0x01, 0xf5, 0x31, 0x73, 0xaf, + 0x98, 0x00, 0x5b, 0xd3, 0xc9, 0x08, 0xe6, 0xee, 0x35, 0x07, 0xb9, 0xc6, 0xe7, 0xcc, 0xd3, 0xbc, + 0x43, 0xfd, 0x0f, 0xb6, 0x1a, 0x33, 0x43, 0x25, 0x07, 0xc0, 0x87, 0x3d, 0xf4, 0xc9, 0xf5, 0xf3, + 0x10, 0xe5, 0x67, 0x3c, 0x2c, 0xb7, 0x7d, 0x57, 0xc8, 0x3e, 0xf0, 0x2d, 0x97, 0x92, 0x5c, 0x02, + 0x1e, 0xff, 0xfb, 0x89, 0x5b, 0xd3, 0xe2, 0xe0, 0xe9, 0x3f, 0x61, 0xc9, 0xdf, 0x77, 0x44, 0x48, + 0x58, 0x4c, 0xac, 0x6c, 0x71, 0x67, 0x86, 0x26, 0x80, 0xef, 0x03, 0xdf, 0xc0, 0xc9, 0x47, 0xe3, + 0x5d, 0x39, 0xf1, 0x68, 0x72, 0x2b, 0x1d, 0x40, 0xda, 0x1b, 0x53, 0x92, 0xd4, 0x27, 0x36, 0x8e, + 0xb8, 0x7d, 0x4d, 0x1e, 0x00, 0xff, 0x87, 0xf5, 0xc9, 0x6e, 0x21, 0x85, 0x84, 0xe9, 0xcc, 0xa9, + 0x12, 0xbf, 0xbf, 0xc5, 0x22, 0xa6, 0x6d, 0xdc, 0x4c, 0xdb, 0xb8, 0x93, 0x76, 0x76, 0x59, 0xab, + 0xf7, 0x2e, 0xc6, 0x79, 0xee, 0x72, 0x9c, 0xe7, 0xde, 0x8e, 0xf3, 0xdc, 0xfb, 0x71, 0x9e, 0x7b, + 0xfa, 0x21, 0xbf, 0x70, 0xff, 0xa7, 0x1b, 0xbe, 0x78, 0xac, 0x33, 0xa7, 0xa4, 0x0d, 0x8d, 0x52, + 0xcf, 0x52, 0x22, 0xe6, 0xe7, 0xa9, 0x6f, 0xfe, 0x41, 0xeb, 0xaf, 0xb6, 0x5c, 0x69, 0x35, 0xe3, + 0x65, 0xdd, 0x59, 0x62, 0x1f, 0x38, 0xbf, 0x7e, 0x0c, 0x00, 0x00, 0xff, 0xff, 0x16, 0xc1, 0x2d, + 0xa9, 0xa2, 0x09, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -455,6 +718,10 @@ type ServiceClient interface { Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*GetResponse, error) // List returns all user's containers List(ctx context.Context, in *ListRequest, opts ...grpc.CallOption) (*ListResponse, error) + // SetExtendedACL changes extended ACL rules of the container + SetExtendedACL(ctx context.Context, in *SetExtendedACLRequest, opts ...grpc.CallOption) (*SetExtendedACLResponse, error) + // GetExtendedACL returns extended ACL rules of the container + GetExtendedACL(ctx context.Context, in *GetExtendedACLRequest, opts ...grpc.CallOption) (*GetExtendedACLResponse, error) } type serviceClient struct { @@ -501,6 +768,24 @@ func (c *serviceClient) List(ctx context.Context, in *ListRequest, opts ...grpc. return out, nil } +func (c *serviceClient) SetExtendedACL(ctx context.Context, in *SetExtendedACLRequest, opts ...grpc.CallOption) (*SetExtendedACLResponse, error) { + out := new(SetExtendedACLResponse) + err := c.cc.Invoke(ctx, "/container.Service/SetExtendedACL", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) GetExtendedACL(ctx context.Context, in *GetExtendedACLRequest, opts ...grpc.CallOption) (*GetExtendedACLResponse, error) { + out := new(GetExtendedACLResponse) + err := c.cc.Invoke(ctx, "/container.Service/GetExtendedACL", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // ServiceServer is the server API for Service service. type ServiceServer interface { // Put request proposes container to the inner ring nodes. They will @@ -514,6 +799,10 @@ type ServiceServer interface { Get(context.Context, *GetRequest) (*GetResponse, error) // List returns all user's containers List(context.Context, *ListRequest) (*ListResponse, error) + // SetExtendedACL changes extended ACL rules of the container + SetExtendedACL(context.Context, *SetExtendedACLRequest) (*SetExtendedACLResponse, error) + // GetExtendedACL returns extended ACL rules of the container + GetExtendedACL(context.Context, *GetExtendedACLRequest) (*GetExtendedACLResponse, error) } // UnimplementedServiceServer can be embedded to have forward compatible implementations. @@ -532,6 +821,12 @@ func (*UnimplementedServiceServer) Get(ctx context.Context, req *GetRequest) (*G func (*UnimplementedServiceServer) List(ctx context.Context, req *ListRequest) (*ListResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method List not implemented") } +func (*UnimplementedServiceServer) SetExtendedACL(ctx context.Context, req *SetExtendedACLRequest) (*SetExtendedACLResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SetExtendedACL not implemented") +} +func (*UnimplementedServiceServer) GetExtendedACL(ctx context.Context, req *GetExtendedACLRequest) (*GetExtendedACLResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetExtendedACL not implemented") +} func RegisterServiceServer(s *grpc.Server, srv ServiceServer) { s.RegisterService(&_Service_serviceDesc, srv) @@ -609,6 +904,42 @@ func _Service_List_Handler(srv interface{}, ctx context.Context, dec func(interf return interceptor(ctx, in, info, handler) } +func _Service_SetExtendedACL_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SetExtendedACLRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ServiceServer).SetExtendedACL(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/container.Service/SetExtendedACL", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ServiceServer).SetExtendedACL(ctx, req.(*SetExtendedACLRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Service_GetExtendedACL_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetExtendedACLRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ServiceServer).GetExtendedACL(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/container.Service/GetExtendedACL", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ServiceServer).GetExtendedACL(ctx, req.(*GetExtendedACLRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _Service_serviceDesc = grpc.ServiceDesc{ ServiceName: "container.Service", HandlerType: (*ServiceServer)(nil), @@ -629,6 +960,14 @@ var _Service_serviceDesc = grpc.ServiceDesc{ MethodName: "List", Handler: _Service_List_Handler, }, + { + MethodName: "SetExtendedACL", + Handler: _Service_SetExtendedACL_Handler, + }, + { + MethodName: "GetExtendedACL", + Handler: _Service_GetExtendedACL_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "container/service.proto", @@ -1052,6 +1391,280 @@ func (m *ListResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *ExtendedACLKey) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ExtendedACLKey) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ExtendedACLKey) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + { + size := m.ID.Size() + i -= size + if _, err := m.ID.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *ExtendedACLValue) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ExtendedACLValue) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ExtendedACLValue) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Signature) > 0 { + i -= len(m.Signature) + copy(dAtA[i:], m.Signature) + i = encodeVarintService(dAtA, i, uint64(len(m.Signature))) + i-- + dAtA[i] = 0x12 + } + if len(m.EACL) > 0 { + i -= len(m.EACL) + copy(dAtA[i:], m.EACL) + i = encodeVarintService(dAtA, i, uint64(len(m.EACL))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *SetExtendedACLRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *SetExtendedACLRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *SetExtendedACLRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + { + size, err := m.RequestVerificationHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x9a + { + size, err := m.RequestMetaHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x92 + { + size, err := m.ExtendedACLValue.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size, err := m.ExtendedACLKey.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *SetExtendedACLResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *SetExtendedACLResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *SetExtendedACLResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + return len(dAtA) - i, nil +} + +func (m *GetExtendedACLRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetExtendedACLRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GetExtendedACLRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + { + size, err := m.RequestVerificationHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x9a + { + size, err := m.RequestMetaHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x92 + { + size, err := m.ExtendedACLKey.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *GetExtendedACLResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetExtendedACLResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GetExtendedACLResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + { + size, err := m.ExtendedACLValue.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + func encodeVarintService(dAtA []byte, offset int, v uint64) int { offset -= sovService(v) base := offset @@ -1205,6 +1818,104 @@ func (m *ListResponse) Size() (n int) { return n } +func (m *ExtendedACLKey) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.ID.Size() + n += 1 + l + sovService(uint64(l)) + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *ExtendedACLValue) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.EACL) + if l > 0 { + n += 1 + l + sovService(uint64(l)) + } + l = len(m.Signature) + if l > 0 { + n += 1 + l + sovService(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *SetExtendedACLRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.ExtendedACLKey.Size() + n += 1 + l + sovService(uint64(l)) + l = m.ExtendedACLValue.Size() + n += 1 + l + sovService(uint64(l)) + l = m.RequestMetaHeader.Size() + n += 2 + l + sovService(uint64(l)) + l = m.RequestVerificationHeader.Size() + n += 2 + l + sovService(uint64(l)) + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *SetExtendedACLResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *GetExtendedACLRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.ExtendedACLKey.Size() + n += 1 + l + sovService(uint64(l)) + l = m.RequestMetaHeader.Size() + n += 2 + l + sovService(uint64(l)) + l = m.RequestVerificationHeader.Size() + n += 2 + l + sovService(uint64(l)) + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *GetExtendedACLResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.ExtendedACLValue.Size() + n += 1 + l + sovService(uint64(l)) + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + func sovService(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -2247,6 +2958,695 @@ func (m *ListResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *ExtendedACLKey) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ExtendedACLKey: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ExtendedACLKey: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ExtendedACLValue) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ExtendedACLValue: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ExtendedACLValue: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field EACL", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.EACL = append(m.EACL[:0], dAtA[iNdEx:postIndex]...) + if m.EACL == nil { + m.EACL = []byte{} + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signature", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Signature = append(m.Signature[:0], dAtA[iNdEx:postIndex]...) + if m.Signature == nil { + m.Signature = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *SetExtendedACLRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: SetExtendedACLRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SetExtendedACLRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ExtendedACLKey", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ExtendedACLKey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ExtendedACLValue", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ExtendedACLValue.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 98: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RequestMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 99: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestVerificationHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RequestVerificationHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *SetExtendedACLResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: SetExtendedACLResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SetExtendedACLResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GetExtendedACLRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GetExtendedACLRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetExtendedACLRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ExtendedACLKey", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ExtendedACLKey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 98: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RequestMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 99: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestVerificationHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RequestVerificationHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GetExtendedACLResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GetExtendedACLResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetExtendedACLResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ExtendedACLValue", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ExtendedACLValue.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipService(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/container/service.proto b/container/service.proto index 7df2c66..b174052 100644 --- a/container/service.proto +++ b/container/service.proto @@ -27,6 +27,12 @@ service Service { // List returns all user's containers rpc List(ListRequest) returns (ListResponse); + + // SetExtendedACL changes extended ACL rules of the container + rpc SetExtendedACL(SetExtendedACLRequest) returns (SetExtendedACLResponse); + + // GetExtendedACL returns extended ACL rules of the container + rpc GetExtendedACL(GetExtendedACLRequest) returns (GetExtendedACLResponse); } message PutRequest { @@ -99,3 +105,42 @@ message ListResponse { // CID (container id) is list of SHA256 hashes of the container structures repeated bytes CID = 1 [(gogoproto.customtype) = "CID", (gogoproto.nullable) = false]; } + +message ExtendedACLKey { + // ID (container id) is a SHA256 hash of the container structure + bytes ID = 1 [(gogoproto.customtype) = "CID", (gogoproto.nullable) = false]; +} + +message ExtendedACLValue { + // EACL carries binary representation of the table of extended ACL rules + bytes EACL = 1; + // Signature carries EACL field signature + bytes Signature = 2; +} + +message SetExtendedACLRequest { + // Key carries key to extended ACL information + ExtendedACLKey Key = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + // Value carries extended ACL information + ExtendedACLValue Value = 2 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + // RequestMetaHeader contains information about request meta headers (should be embedded into message) + service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) + service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; +} + +message SetExtendedACLResponse {} + +message GetExtendedACLRequest { + // Key carries key to extended ACL information + ExtendedACLKey Key = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + // RequestMetaHeader contains information about request meta headers (should be embedded into message) + service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) + service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; +} + +message GetExtendedACLResponse { + // ACL carries extended ACL information + ExtendedACLValue ACL = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; +} diff --git a/container/types.go b/container/types.go index f340aa5..38bdcff 100644 --- a/container/types.go +++ b/container/types.go @@ -158,3 +158,23 @@ func (m ListRequest) GetOwnerID() OwnerID { func (m *ListRequest) SetOwnerID(owner OwnerID) { m.OwnerID = owner } + +// GetID is an ID field getter. +func (m ExtendedACLKey) GetID() CID { + return m.ID +} + +// SetID is an ID field setter. +func (m *ExtendedACLKey) SetID(v CID) { + m.ID = v +} + +// SetEACL is an EACL field setter. +func (m *ExtendedACLValue) SetEACL(v []byte) { + m.EACL = v +} + +// SetSignature is a Signature field setter. +func (m *ExtendedACLValue) SetSignature(sig []byte) { + m.Signature = sig +} diff --git a/container/types_test.go b/container/types_test.go index cc171cb..76bbe1c 100644 --- a/container/types_test.go +++ b/container/types_test.go @@ -140,3 +140,23 @@ func TestListRequestGettersSetters(t *testing.T) { require.Equal(t, owner, m.GetOwnerID()) }) } + +func TestExtendedACLKey(t *testing.T) { + s := new(ExtendedACLKey) + + id := CID{1, 2, 3} + s.SetID(id) + require.Equal(t, id, s.GetID()) +} + +func TestExtendedACLValue(t *testing.T) { + s := new(ExtendedACLValue) + + acl := []byte{1, 2, 3} + s.SetEACL(acl) + require.Equal(t, acl, s.GetEACL()) + + sig := []byte{4, 5, 6} + s.SetSignature(sig) + require.Equal(t, sig, s.GetSignature()) +} diff --git a/docs/container.md b/docs/container.md index f0188ca..fd89acd 100644 --- a/docs/container.md +++ b/docs/container.md @@ -10,12 +10,18 @@ - Messages - [DeleteRequest](#container.DeleteRequest) - [DeleteResponse](#container.DeleteResponse) + - [ExtendedACLKey](#container.ExtendedACLKey) + - [ExtendedACLValue](#container.ExtendedACLValue) + - [GetExtendedACLRequest](#container.GetExtendedACLRequest) + - [GetExtendedACLResponse](#container.GetExtendedACLResponse) - [GetRequest](#container.GetRequest) - [GetResponse](#container.GetResponse) - [ListRequest](#container.ListRequest) - [ListResponse](#container.ListResponse) - [PutRequest](#container.PutRequest) - [PutResponse](#container.PutResponse) + - [SetExtendedACLRequest](#container.SetExtendedACLRequest) + - [SetExtendedACLResponse](#container.SetExtendedACLResponse) - [container/types.proto](#container/types.proto) @@ -46,6 +52,8 @@ rpc Put(PutRequest) returns (PutResponse); rpc Delete(DeleteRequest) returns (DeleteResponse); rpc Get(GetRequest) returns (GetResponse); rpc List(ListRequest) returns (ListResponse); +rpc SetExtendedACL(SetExtendedACLRequest) returns (SetExtendedACLResponse); +rpc GetExtendedACL(GetExtendedACLRequest) returns (GetExtendedACLResponse); ``` @@ -80,6 +88,20 @@ List returns all user's containers | Name | Input | Output | | ---- | ----- | ------ | | List | [ListRequest](#container.ListRequest) | [ListResponse](#container.ListResponse) | +#### Method SetExtendedACL + +SetExtendedACL changes extended ACL rules of the container + +| Name | Input | Output | +| ---- | ----- | ------ | +| SetExtendedACL | [SetExtendedACLRequest](#container.SetExtendedACLRequest) | [SetExtendedACLResponse](#container.SetExtendedACLResponse) | +#### Method GetExtendedACL + +GetExtendedACL returns extended ACL rules of the container + +| Name | Input | Output | +| ---- | ----- | ------ | +| GetExtendedACL | [GetExtendedACLRequest](#container.GetExtendedACLRequest) | [GetExtendedACLResponse](#container.GetExtendedACLResponse) | @@ -104,6 +126,53 @@ via consensus in inner ring nodes + + +### Message ExtendedACLKey + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| ID | [bytes](#bytes) | | ID (container id) is a SHA256 hash of the container structure | + + + + +### Message ExtendedACLValue + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| EACL | [bytes](#bytes) | | EACL carries binary representation of the table of extended ACL rules | +| Signature | [bytes](#bytes) | | Signature carries EACL field signature | + + + + +### Message GetExtendedACLRequest + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| Key | [ExtendedACLKey](#container.ExtendedACLKey) | | Key carries key to extended ACL information | +| Meta | [service.RequestMetaHeader](#service.RequestMetaHeader) | | RequestMetaHeader contains information about request meta headers (should be embedded into message) | +| Verify | [service.RequestVerificationHeader](#service.RequestVerificationHeader) | | RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) | + + + + +### Message GetExtendedACLResponse + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| ACL | [ExtendedACLValue](#container.ExtendedACLValue) | | ACL carries extended ACL information | + + ### Message GetRequest @@ -179,6 +248,27 @@ via consensus in inner ring nodes | ----- | ---- | ----- | ----------- | | CID | [bytes](#bytes) | | CID (container id) is a SHA256 hash of the container structure | + + + +### Message SetExtendedACLRequest + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| Key | [ExtendedACLKey](#container.ExtendedACLKey) | | Key carries key to extended ACL information | +| Value | [ExtendedACLValue](#container.ExtendedACLValue) | | Value carries extended ACL information | +| Meta | [service.RequestMetaHeader](#service.RequestMetaHeader) | | RequestMetaHeader contains information about request meta headers (should be embedded into message) | +| Verify | [service.RequestVerificationHeader](#service.RequestVerificationHeader) | | RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) | + + + + +### Message SetExtendedACLResponse + + + diff --git a/docs/service.md b/docs/service.md index 0765f04..223ddd1 100644 --- a/docs/service.md +++ b/docs/service.md @@ -6,6 +6,8 @@ - [service/meta.proto](#service/meta.proto) - Messages + - [RequestExtendedHeader](#service.RequestExtendedHeader) + - [RequestExtendedHeader.KV](#service.RequestExtendedHeader.KV) - [RequestMetaHeader](#service.RequestMetaHeader) - [ResponseMetaHeader](#service.ResponseMetaHeader) @@ -13,6 +15,8 @@ - [service/verify.proto](#service/verify.proto) - Messages + - [BearerTokenMsg](#service.BearerTokenMsg) + - [BearerTokenMsg.Info](#service.BearerTokenMsg.Info) - [RequestVerificationHeader](#service.RequestVerificationHeader) - [RequestVerificationHeader.Signature](#service.RequestVerificationHeader.Signature) - [Token](#service.Token) @@ -39,6 +43,29 @@ + + +### Message RequestExtendedHeader +RequestExtendedHeader contains extended headers of request + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| Headers | [RequestExtendedHeader.KV](#service.RequestExtendedHeader.KV) | repeated | Headers carries list of key-value headers | + + + + +### Message RequestExtendedHeader.KV +KV contains string key-value pair + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| K | [string](#string) | | K carries extended header key | +| V | [string](#string) | | V carries extended header value | + + ### Message RequestMetaHeader @@ -52,6 +79,7 @@ RequestMetaHeader contains information about request meta headers | Epoch | [uint64](#uint64) | | Epoch for user can be empty, because node sets epoch to the actual value | | Version | [uint32](#uint32) | | Version defines protocol version TODO: not used for now, should be implemented in future | | Raw | [bool](#bool) | | Raw determines whether the request is raw or not | +| ExtendedHeader | [RequestExtendedHeader](#service.RequestExtendedHeader) | | ExtendedHeader carries extended headers of the request | @@ -81,6 +109,32 @@ ResponseMetaHeader contains meta information based on request processing by serv + + +### Message BearerTokenMsg +BearerTokenMsg carries information about request ACL rules with limited lifetime + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| TokenInfo | [BearerTokenMsg.Info](#service.BearerTokenMsg.Info) | | TokenInfo is a grouped information about token | +| OwnerKey | [bytes](#bytes) | | OwnerKey is a public key of the token owner | +| Signature | [bytes](#bytes) | | Signature is a signature of token information | + + + + +### Message BearerTokenMsg.Info + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| ACLRules | [bytes](#bytes) | | ACLRules carries a binary representation of the table of extended ACL rules | +| OwnerID | [bytes](#bytes) | | OwnerID is an owner of token | +| ValidUntil | [uint64](#uint64) | | ValidUntil carries a last epoch of token lifetime | + + ### Message RequestVerificationHeader @@ -92,6 +146,7 @@ RequestVerificationHeader is a set of signatures of every NeoFS Node that proces | ----- | ---- | ----- | ----------- | | Signatures | [RequestVerificationHeader.Signature](#service.RequestVerificationHeader.Signature) | repeated | Signatures is a set of signatures of every passed NeoFS Node | | Token | [Token](#service.Token) | | Token is a token of the session within which the request is sent | +| Bearer | [BearerTokenMsg](#service.BearerTokenMsg) | | Bearer is a Bearer token of the request | diff --git a/service/bearer.go b/service/bearer.go index bc8aaa5..6013e03 100644 --- a/service/bearer.go +++ b/service/bearer.go @@ -94,3 +94,33 @@ func copyBearerTokenSignedData(buf []byte, token BearerTokenInfo) { tokenEndianness.PutUint64(buf[off:], token.ExpirationEpoch()) off += 8 } + +// SetACLRules is an ACLRules field setter. +func (m *BearerTokenMsg_Info) SetACLRules(v []byte) { + m.ACLRules = v +} + +// SetValidUntil is a ValidUntil field setter. +func (m *BearerTokenMsg_Info) SetValidUntil(v uint64) { + m.ValidUntil = v +} + +// GetOwnerID if an OwnerID field getter. +func (m BearerTokenMsg_Info) GetOwnerID() OwnerID { + return m.OwnerID +} + +// SetOwnerID is an OwnerID field setter. +func (m *BearerTokenMsg_Info) SetOwnerID(v OwnerID) { + m.OwnerID = v +} + +// SetOwnerKey is an OwnerKey field setter. +func (m *BearerTokenMsg) SetOwnerKey(v []byte) { + m.OwnerKey = v +} + +// SetSignature is a Signature field setter. +func (m *BearerTokenMsg) SetSignature(v []byte) { + m.Signature = v +} diff --git a/service/bearer_test.go b/service/bearer_test.go index da359f2..9ece9c8 100644 --- a/service/bearer_test.go +++ b/service/bearer_test.go @@ -170,3 +170,27 @@ func TestSignVerifyBearerToken(t *testing.T) { require.NoError(t, VerifySignatureWithKey(pk, verifiedToken)) } } + +func TestBearerTokenMsg_Setters(t *testing.T) { + s := new(BearerTokenMsg) + + aclRules := []byte{1, 2, 3} + s.SetACLRules(aclRules) + require.Equal(t, aclRules, s.GetACLRules()) + + validUntil := uint64(6) + s.SetValidUntil(validUntil) + require.Equal(t, validUntil, s.GetValidUntil()) + + ownerID := OwnerID{1, 2, 3} + s.SetOwnerID(ownerID) + require.Equal(t, ownerID, s.GetOwnerID()) + + ownerKey := []byte{4, 5, 6} + s.SetOwnerKey(ownerKey) + require.Equal(t, ownerKey, s.GetOwnerKey()) + + sig := []byte{7, 8, 9} + s.SetSignature(sig) + require.Equal(t, sig, s.GetSignature()) +} diff --git a/service/meta.go b/service/meta.go index f1b4613..e838cec 100644 --- a/service/meta.go +++ b/service/meta.go @@ -69,3 +69,18 @@ func (s extHdrSrcWrapper) ReadSignedData(p []byte) (int, error) { return sz, nil } + +// SetK is a K field setter. +func (m *RequestExtendedHeader_KV) SetK(v string) { + m.K = v +} + +// SetV is a V field setter. +func (m *RequestExtendedHeader_KV) SetV(v string) { + m.V = v +} + +// SetHeaders is a Headers field setter. +func (m *RequestExtendedHeader) SetHeaders(v []RequestExtendedHeader_KV) { + m.Headers = v +} diff --git a/service/meta.pb.go b/service/meta.pb.go index 25a5469..0d63077 100644 --- a/service/meta.pb.go +++ b/service/meta.pb.go @@ -34,10 +34,12 @@ type RequestMetaHeader struct { // TODO: not used for now, should be implemented in future Version uint32 `protobuf:"varint,3,opt,name=Version,proto3" json:"Version,omitempty"` // Raw determines whether the request is raw or not - Raw bool `protobuf:"varint,4,opt,name=Raw,proto3" json:"Raw,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Raw bool `protobuf:"varint,4,opt,name=Raw,proto3" json:"Raw,omitempty"` + // ExtendedHeader carries extended headers of the request + RequestExtendedHeader `protobuf:"bytes,5,opt,name=ExtendedHeader,proto3,embedded=ExtendedHeader" json:"ExtendedHeader"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *RequestMetaHeader) Reset() { *m = RequestMetaHeader{} } @@ -153,32 +155,139 @@ func (m *ResponseMetaHeader) GetVersion() uint32 { return 0 } +// RequestExtendedHeader contains extended headers of request +type RequestExtendedHeader struct { + // Headers carries list of key-value headers + Headers []RequestExtendedHeader_KV `protobuf:"bytes,1,rep,name=Headers,proto3" json:"Headers"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *RequestExtendedHeader) Reset() { *m = RequestExtendedHeader{} } +func (m *RequestExtendedHeader) String() string { return proto.CompactTextString(m) } +func (*RequestExtendedHeader) ProtoMessage() {} +func (*RequestExtendedHeader) Descriptor() ([]byte, []int) { + return fileDescriptor_a638867e7b43457c, []int{2} +} +func (m *RequestExtendedHeader) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RequestExtendedHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *RequestExtendedHeader) XXX_Merge(src proto.Message) { + xxx_messageInfo_RequestExtendedHeader.Merge(m, src) +} +func (m *RequestExtendedHeader) XXX_Size() int { + return m.Size() +} +func (m *RequestExtendedHeader) XXX_DiscardUnknown() { + xxx_messageInfo_RequestExtendedHeader.DiscardUnknown(m) +} + +var xxx_messageInfo_RequestExtendedHeader proto.InternalMessageInfo + +func (m *RequestExtendedHeader) GetHeaders() []RequestExtendedHeader_KV { + if m != nil { + return m.Headers + } + return nil +} + +// KV contains string key-value pair +type RequestExtendedHeader_KV struct { + // K carries extended header key + K string `protobuf:"bytes,1,opt,name=K,proto3" json:"K,omitempty"` + // V carries extended header value + V string `protobuf:"bytes,2,opt,name=V,proto3" json:"V,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *RequestExtendedHeader_KV) Reset() { *m = RequestExtendedHeader_KV{} } +func (m *RequestExtendedHeader_KV) String() string { return proto.CompactTextString(m) } +func (*RequestExtendedHeader_KV) ProtoMessage() {} +func (*RequestExtendedHeader_KV) Descriptor() ([]byte, []int) { + return fileDescriptor_a638867e7b43457c, []int{2, 0} +} +func (m *RequestExtendedHeader_KV) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RequestExtendedHeader_KV) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *RequestExtendedHeader_KV) XXX_Merge(src proto.Message) { + xxx_messageInfo_RequestExtendedHeader_KV.Merge(m, src) +} +func (m *RequestExtendedHeader_KV) XXX_Size() int { + return m.Size() +} +func (m *RequestExtendedHeader_KV) XXX_DiscardUnknown() { + xxx_messageInfo_RequestExtendedHeader_KV.DiscardUnknown(m) +} + +var xxx_messageInfo_RequestExtendedHeader_KV proto.InternalMessageInfo + +func (m *RequestExtendedHeader_KV) GetK() string { + if m != nil { + return m.K + } + return "" +} + +func (m *RequestExtendedHeader_KV) GetV() string { + if m != nil { + return m.V + } + return "" +} + func init() { proto.RegisterType((*RequestMetaHeader)(nil), "service.RequestMetaHeader") proto.RegisterType((*ResponseMetaHeader)(nil), "service.ResponseMetaHeader") + proto.RegisterType((*RequestExtendedHeader)(nil), "service.RequestExtendedHeader") + proto.RegisterType((*RequestExtendedHeader_KV)(nil), "service.RequestExtendedHeader.KV") } func init() { proto.RegisterFile("service/meta.proto", fileDescriptor_a638867e7b43457c) } var fileDescriptor_a638867e7b43457c = []byte{ - // 261 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x2a, 0x4e, 0x2d, 0x2a, - 0xcb, 0x4c, 0x4e, 0xd5, 0xcf, 0x4d, 0x2d, 0x49, 0xd4, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, - 0x87, 0x8a, 0x49, 0xe9, 0xa6, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0xa7, - 0xe7, 0xa7, 0xe7, 0xeb, 0x83, 0xe5, 0x93, 0x4a, 0xd3, 0xc0, 0x3c, 0x30, 0x07, 0xcc, 0x82, 0xe8, - 0x53, 0x4a, 0xe7, 0x12, 0x0c, 0x4a, 0x2d, 0x2c, 0x4d, 0x2d, 0x2e, 0xf1, 0x4d, 0x2d, 0x49, 0xf4, - 0x48, 0x4d, 0x4c, 0x49, 0x2d, 0x12, 0x12, 0xe0, 0x62, 0x0e, 0x09, 0xf1, 0x91, 0x60, 0x54, 0x60, - 0xd4, 0xe0, 0x0d, 0x02, 0x31, 0x85, 0x44, 0xb8, 0x58, 0x5d, 0x0b, 0xf2, 0x93, 0x33, 0x24, 0x98, - 0x14, 0x18, 0x35, 0x58, 0x82, 0x20, 0x1c, 0x21, 0x09, 0x2e, 0xf6, 0xb0, 0xd4, 0xa2, 0xe2, 0xcc, - 0xfc, 0x3c, 0x09, 0x66, 0xb0, 0x5a, 0x18, 0x17, 0x64, 0x42, 0x50, 0x62, 0xb9, 0x04, 0x8b, 0x02, - 0xa3, 0x06, 0x47, 0x10, 0x88, 0xa9, 0xe4, 0xc2, 0x25, 0x14, 0x94, 0x5a, 0x5c, 0x90, 0x9f, 0x57, - 0x9c, 0x8a, 0x64, 0x13, 0xdc, 0x5c, 0x46, 0x1c, 0xe6, 0x32, 0xa1, 0x98, 0xeb, 0x14, 0x7c, 0xe2, - 0x91, 0x1c, 0xe3, 0x85, 0x47, 0x72, 0x8c, 0x37, 0x1e, 0xc9, 0x31, 0x3e, 0x78, 0x24, 0xc7, 0x38, - 0xe3, 0xb1, 0x1c, 0x43, 0x94, 0x26, 0x92, 0x9f, 0xf3, 0x8a, 0x0b, 0x92, 0x93, 0x75, 0x53, 0x52, - 0xcb, 0xf4, 0xf3, 0x52, 0xf3, 0xd3, 0x8a, 0x75, 0x13, 0x0b, 0x32, 0x75, 0xd3, 0xf3, 0xf5, 0xa1, - 0xc1, 0xb3, 0x8a, 0x49, 0xd0, 0x2f, 0x35, 0xdf, 0x2d, 0x58, 0xcf, 0x31, 0xc0, 0x53, 0x2f, 0x18, - 0x22, 0x96, 0xc4, 0x06, 0x0e, 0x0a, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0xb2, 0x12, 0x93, - 0x5e, 0x58, 0x01, 0x00, 0x00, + // 362 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x91, 0xb1, 0x8e, 0xda, 0x40, + 0x10, 0x86, 0x19, 0x03, 0x01, 0x96, 0x24, 0x0a, 0xab, 0x44, 0xb2, 0x28, 0x8c, 0x43, 0xe5, 0x14, + 0xb6, 0x25, 0xf2, 0x04, 0xa0, 0x10, 0x25, 0x72, 0x12, 0xa1, 0x05, 0xb9, 0x48, 0x67, 0xec, 0xc1, + 0xb8, 0xc0, 0xeb, 0x78, 0x0d, 0x49, 0x91, 0x07, 0xc9, 0x33, 0xe4, 0x0d, 0xee, 0x0d, 0x28, 0x29, + 0xaf, 0x42, 0x27, 0xdf, 0x8b, 0x9c, 0xbc, 0x36, 0x27, 0x38, 0xdd, 0x5d, 0xf7, 0x7f, 0xb3, 0x33, + 0x3b, 0x9f, 0x34, 0x84, 0x0a, 0x4c, 0x77, 0x91, 0x8f, 0xf6, 0x06, 0x33, 0xcf, 0x4a, 0x52, 0x9e, + 0x71, 0xda, 0xaa, 0x6a, 0x7d, 0x33, 0x8c, 0xb2, 0xf5, 0x76, 0x69, 0xf9, 0x7c, 0x63, 0x87, 0x3c, + 0xe4, 0xb6, 0x7c, 0x5f, 0x6e, 0x57, 0x92, 0x24, 0xc8, 0x54, 0xce, 0x0d, 0xaf, 0x80, 0xf4, 0x18, + 0xfe, 0xda, 0xa2, 0xc8, 0xbe, 0x63, 0xe6, 0x7d, 0x41, 0x2f, 0xc0, 0x94, 0xbe, 0x21, 0xf5, 0xc5, + 0xe2, 0x9b, 0x0a, 0x3a, 0x18, 0xaf, 0x58, 0x11, 0xe9, 0x5b, 0xd2, 0x9c, 0x26, 0xdc, 0x5f, 0xab, + 0x8a, 0x0e, 0x46, 0x83, 0x95, 0x40, 0x55, 0xd2, 0x72, 0x31, 0x15, 0x11, 0x8f, 0xd5, 0xba, 0xec, + 0x3d, 0x61, 0xf1, 0x03, 0xf3, 0x7e, 0xab, 0x0d, 0x1d, 0x8c, 0x36, 0x2b, 0x22, 0x9d, 0x91, 0xd7, + 0xd3, 0x3f, 0x19, 0xc6, 0x01, 0x06, 0xe5, 0x16, 0xb5, 0xa9, 0x83, 0xd1, 0x1d, 0x69, 0x56, 0xa5, + 0x6e, 0x55, 0x1e, 0x97, 0x5d, 0x93, 0xf6, 0xfe, 0x38, 0xa8, 0x1d, 0x8e, 0x03, 0x60, 0x0f, 0xe6, + 0x87, 0x9f, 0x08, 0x65, 0x28, 0x12, 0x1e, 0x0b, 0x3c, 0x73, 0xbf, 0x37, 0x85, 0x27, 0x4c, 0x95, + 0x0b, 0xd3, 0xe1, 0x5f, 0xf2, 0xee, 0xd1, 0xc5, 0x74, 0x4c, 0x5a, 0x65, 0x12, 0x2a, 0xe8, 0x75, + 0xa3, 0x3b, 0x7a, 0xff, 0xbc, 0xa9, 0xe5, 0xb8, 0x93, 0x46, 0x21, 0xcb, 0x4e, 0x73, 0x7d, 0x9d, + 0x28, 0x8e, 0x4b, 0x5f, 0x12, 0x70, 0xa4, 0x4d, 0x87, 0x81, 0x53, 0x90, 0x2b, 0x1d, 0x3a, 0x0c, + 0xdc, 0xc9, 0x7c, 0x9f, 0x6b, 0x70, 0xc8, 0x35, 0xb8, 0xce, 0x35, 0xb8, 0xc9, 0x35, 0xf8, 0x77, + 0xab, 0xd5, 0x7e, 0x7e, 0x38, 0x3b, 0x62, 0x2c, 0x12, 0xdf, 0x37, 0x03, 0xdc, 0xd9, 0x31, 0xf2, + 0x95, 0x30, 0xbd, 0x24, 0x32, 0x43, 0x6e, 0x57, 0x2a, 0xff, 0x95, 0xde, 0x0f, 0xe4, 0x9f, 0xe7, + 0xd6, 0x78, 0xf6, 0xd5, 0x9a, 0x97, 0xb5, 0xe5, 0x0b, 0x79, 0xdb, 0x8f, 0x77, 0x01, 0x00, 0x00, + 0xff, 0xff, 0xf3, 0xf7, 0x0a, 0xb8, 0x29, 0x02, 0x00, 0x00, } func (m *RequestMetaHeader) Marshal() (dAtA []byte, err error) { @@ -205,6 +314,16 @@ func (m *RequestMetaHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } + { + size, err := m.RequestExtendedHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintMeta(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a if m.Raw { i-- if m.Raw { @@ -270,6 +389,88 @@ func (m *ResponseMetaHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *RequestExtendedHeader) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *RequestExtendedHeader) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RequestExtendedHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Headers) > 0 { + for iNdEx := len(m.Headers) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Headers[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintMeta(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *RequestExtendedHeader_KV) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *RequestExtendedHeader_KV) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RequestExtendedHeader_KV) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.V) > 0 { + i -= len(m.V) + copy(dAtA[i:], m.V) + i = encodeVarintMeta(dAtA, i, uint64(len(m.V))) + i-- + dAtA[i] = 0x12 + } + if len(m.K) > 0 { + i -= len(m.K) + copy(dAtA[i:], m.K) + i = encodeVarintMeta(dAtA, i, uint64(len(m.K))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func encodeVarintMeta(dAtA []byte, offset int, v uint64) int { offset -= sovMeta(v) base := offset @@ -299,6 +500,8 @@ func (m *RequestMetaHeader) Size() (n int) { if m.Raw { n += 2 } + l = m.RequestExtendedHeader.Size() + n += 1 + l + sovMeta(uint64(l)) if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -323,6 +526,44 @@ func (m *ResponseMetaHeader) Size() (n int) { return n } +func (m *RequestExtendedHeader) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Headers) > 0 { + for _, e := range m.Headers { + l = e.Size() + n += 1 + l + sovMeta(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *RequestExtendedHeader_KV) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.K) + if l > 0 { + n += 1 + l + sovMeta(uint64(l)) + } + l = len(m.V) + if l > 0 { + n += 1 + l + sovMeta(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + func sovMeta(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -435,6 +676,39 @@ func (m *RequestMetaHeader) Unmarshal(dAtA []byte) error { } } m.Raw = bool(v != 0) + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestExtendedHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMeta + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthMeta + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthMeta + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RequestExtendedHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipMeta(dAtA[iNdEx:]) @@ -552,6 +826,212 @@ func (m *ResponseMetaHeader) Unmarshal(dAtA []byte) error { } return nil } +func (m *RequestExtendedHeader) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMeta + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: RequestExtendedHeader: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RequestExtendedHeader: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Headers", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMeta + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthMeta + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthMeta + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Headers = append(m.Headers, RequestExtendedHeader_KV{}) + if err := m.Headers[len(m.Headers)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipMeta(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthMeta + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthMeta + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RequestExtendedHeader_KV) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMeta + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: KV: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: KV: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field K", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMeta + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthMeta + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthMeta + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.K = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field V", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMeta + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthMeta + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthMeta + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.V = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipMeta(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthMeta + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthMeta + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipMeta(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/service/meta.proto b/service/meta.proto index 093f118..8171980 100644 --- a/service/meta.proto +++ b/service/meta.proto @@ -19,6 +19,8 @@ message RequestMetaHeader { uint32 Version = 3; // Raw determines whether the request is raw or not bool Raw = 4; + // ExtendedHeader carries extended headers of the request + RequestExtendedHeader ExtendedHeader = 5 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; } // ResponseMetaHeader contains meta information based on request processing by server @@ -30,3 +32,18 @@ message ResponseMetaHeader { // TODO: not used for now, should be implemented in future uint32 Version = 2; } + +// RequestExtendedHeader contains extended headers of request +message RequestExtendedHeader { + // KV contains string key-value pair + message KV { + // K carries extended header key + string K = 1; + + // V carries extended header value + string V = 2; + } + + // Headers carries list of key-value headers + repeated KV Headers = 1 [(gogoproto.nullable) = false]; +} diff --git a/service/meta_test.go b/service/meta_test.go index a0b85ef..7c3853a 100644 --- a/service/meta_test.go +++ b/service/meta_test.go @@ -23,3 +23,31 @@ func TestCutRestoreMeta(t *testing.T) { require.Equal(t, item(), v1) } } + +func TestRequestExtendedHeader_KV_Setters(t *testing.T) { + s := new(RequestExtendedHeader_KV) + + key := "key" + s.SetK(key) + require.Equal(t, key, s.GetK()) + + val := "val" + s.SetV(val) + require.Equal(t, val, s.GetV()) +} + +func TestRequestExtendedHeader_SetHeaders(t *testing.T) { + s := new(RequestExtendedHeader) + + hdr := RequestExtendedHeader_KV{} + hdr.SetK("key") + hdr.SetV("val") + + hdrs := []RequestExtendedHeader_KV{ + hdr, + } + + s.SetHeaders(hdrs) + + require.Equal(t, hdrs, s.GetHeaders()) +} diff --git a/service/verify.go b/service/verify.go index 62db2f5..0673a01 100644 --- a/service/verify.go +++ b/service/verify.go @@ -67,6 +67,11 @@ func (m *RequestVerificationHeader) SetToken(token *Token) { m.Token = token } +// SetBearer is a Bearer field setter. +func (m *RequestVerificationHeader) SetBearer(v *BearerTokenMsg) { + m.Bearer = v +} + // testCustomField for test usage only. type testCustomField [8]uint32 diff --git a/service/verify.pb.go b/service/verify.pb.go index d198302..02f3f39 100644 --- a/service/verify.pb.go +++ b/service/verify.pb.go @@ -78,10 +78,12 @@ type RequestVerificationHeader struct { // Signatures is a set of signatures of every passed NeoFS Node Signatures []*RequestVerificationHeader_Signature `protobuf:"bytes,1,rep,name=Signatures,proto3" json:"Signatures,omitempty"` // Token is a token of the session within which the request is sent - Token *Token `protobuf:"bytes,2,opt,name=Token,proto3" json:"Token,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Token *Token `protobuf:"bytes,2,opt,name=Token,proto3" json:"Token,omitempty"` + // Bearer is a Bearer token of the request + Bearer *BearerTokenMsg `protobuf:"bytes,3,opt,name=Bearer,proto3" json:"Bearer,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *RequestVerificationHeader) Reset() { *m = RequestVerificationHeader{} } @@ -127,6 +129,13 @@ func (m *RequestVerificationHeader) GetToken() *Token { return nil } +func (m *RequestVerificationHeader) GetBearer() *BearerTokenMsg { + if m != nil { + return m.Bearer + } + return nil +} + type RequestVerificationHeader_Signature struct { // Sign is signature of the request or session key. Sign []byte `protobuf:"bytes,1,opt,name=Sign,proto3" json:"Sign,omitempty"` @@ -351,6 +360,117 @@ func (m *TokenLifetime) GetValidUntil() uint64 { return 0 } +// BearerTokenMsg carries information about request ACL rules with limited lifetime +type BearerTokenMsg struct { + // TokenInfo is a grouped information about token + BearerTokenMsg_Info `protobuf:"bytes,1,opt,name=TokenInfo,proto3,embedded=TokenInfo" json:"TokenInfo"` + // OwnerKey is a public key of the token owner + OwnerKey []byte `protobuf:"bytes,2,opt,name=OwnerKey,proto3" json:"OwnerKey,omitempty"` + // Signature is a signature of token information + Signature []byte `protobuf:"bytes,3,opt,name=Signature,proto3" json:"Signature,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *BearerTokenMsg) Reset() { *m = BearerTokenMsg{} } +func (m *BearerTokenMsg) String() string { return proto.CompactTextString(m) } +func (*BearerTokenMsg) ProtoMessage() {} +func (*BearerTokenMsg) Descriptor() ([]byte, []int) { + return fileDescriptor_4bdd5bc50ec96238, []int{3} +} +func (m *BearerTokenMsg) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *BearerTokenMsg) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *BearerTokenMsg) XXX_Merge(src proto.Message) { + xxx_messageInfo_BearerTokenMsg.Merge(m, src) +} +func (m *BearerTokenMsg) XXX_Size() int { + return m.Size() +} +func (m *BearerTokenMsg) XXX_DiscardUnknown() { + xxx_messageInfo_BearerTokenMsg.DiscardUnknown(m) +} + +var xxx_messageInfo_BearerTokenMsg proto.InternalMessageInfo + +func (m *BearerTokenMsg) GetOwnerKey() []byte { + if m != nil { + return m.OwnerKey + } + return nil +} + +func (m *BearerTokenMsg) GetSignature() []byte { + if m != nil { + return m.Signature + } + return nil +} + +type BearerTokenMsg_Info struct { + // ACLRules carries a binary representation of the table of extended ACL rules + ACLRules []byte `protobuf:"bytes,1,opt,name=ACLRules,proto3" json:"ACLRules,omitempty"` + // OwnerID is an owner of token + OwnerID OwnerID `protobuf:"bytes,2,opt,name=OwnerID,proto3,customtype=OwnerID" json:"OwnerID"` + // ValidUntil carries a last epoch of token lifetime + ValidUntil uint64 `protobuf:"varint,3,opt,name=ValidUntil,proto3" json:"ValidUntil,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *BearerTokenMsg_Info) Reset() { *m = BearerTokenMsg_Info{} } +func (m *BearerTokenMsg_Info) String() string { return proto.CompactTextString(m) } +func (*BearerTokenMsg_Info) ProtoMessage() {} +func (*BearerTokenMsg_Info) Descriptor() ([]byte, []int) { + return fileDescriptor_4bdd5bc50ec96238, []int{3, 0} +} +func (m *BearerTokenMsg_Info) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *BearerTokenMsg_Info) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *BearerTokenMsg_Info) XXX_Merge(src proto.Message) { + xxx_messageInfo_BearerTokenMsg_Info.Merge(m, src) +} +func (m *BearerTokenMsg_Info) XXX_Size() int { + return m.Size() +} +func (m *BearerTokenMsg_Info) XXX_DiscardUnknown() { + xxx_messageInfo_BearerTokenMsg_Info.DiscardUnknown(m) +} + +var xxx_messageInfo_BearerTokenMsg_Info proto.InternalMessageInfo + +func (m *BearerTokenMsg_Info) GetACLRules() []byte { + if m != nil { + return m.ACLRules + } + return nil +} + +func (m *BearerTokenMsg_Info) GetValidUntil() uint64 { + if m != nil { + return m.ValidUntil + } + return 0 +} + func init() { proto.RegisterEnum("service.Token_Info_Verb", Token_Info_Verb_name, Token_Info_Verb_value) proto.RegisterType((*RequestVerificationHeader)(nil), "service.RequestVerificationHeader") @@ -358,49 +478,56 @@ func init() { proto.RegisterType((*Token)(nil), "service.Token") proto.RegisterType((*Token_Info)(nil), "service.Token.Info") proto.RegisterType((*TokenLifetime)(nil), "service.TokenLifetime") + proto.RegisterType((*BearerTokenMsg)(nil), "service.BearerTokenMsg") + proto.RegisterType((*BearerTokenMsg_Info)(nil), "service.BearerTokenMsg.Info") } func init() { proto.RegisterFile("service/verify.proto", fileDescriptor_4bdd5bc50ec96238) } var fileDescriptor_4bdd5bc50ec96238 = []byte{ - // 579 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x53, 0x4f, 0x6f, 0x12, 0x41, - 0x14, 0xef, 0xc0, 0xc2, 0xc2, 0xeb, 0x1f, 0xd7, 0xd1, 0x98, 0x95, 0x18, 0x20, 0xc4, 0x03, 0x4d, - 0x64, 0x49, 0x68, 0x62, 0x4c, 0xf4, 0x52, 0x24, 0x5a, 0x62, 0xa3, 0xcd, 0x50, 0x7b, 0xf0, 0xb6, - 0xc0, 0x63, 0x3b, 0xb1, 0xdd, 0xc1, 0x99, 0x01, 0xd3, 0xef, 0xe1, 0xc1, 0xcf, 0xe0, 0xe7, 0xf0, - 0xd0, 0x63, 0x8f, 0xc6, 0x03, 0x31, 0xf8, 0x29, 0xbc, 0x99, 0x99, 0x5d, 0x60, 0x9b, 0xe8, 0xed, - 0xf7, 0x7e, 0xef, 0xfd, 0xde, 0xef, 0xcd, 0x9b, 0x19, 0xb8, 0xaf, 0x50, 0xce, 0xf9, 0x08, 0xdb, - 0x73, 0x94, 0x7c, 0x72, 0x15, 0x4c, 0xa5, 0xd0, 0x82, 0xba, 0x29, 0x5b, 0xf1, 0x24, 0x4e, 0x54, - 0x5b, 0x5f, 0x4d, 0x51, 0x25, 0xa9, 0x4a, 0x2b, 0xe2, 0xfa, 0x7c, 0x36, 0x0c, 0x46, 0xe2, 0xb2, - 0x1d, 0x89, 0x48, 0xb4, 0x2d, 0x3d, 0x9c, 0x4d, 0x6c, 0x64, 0x03, 0x8b, 0x92, 0xf2, 0xc6, 0x77, - 0x02, 0x0f, 0x19, 0x7e, 0x9a, 0xa1, 0xd2, 0x67, 0xc6, 0x81, 0x8f, 0x42, 0xcd, 0x45, 0x7c, 0x84, - 0xe1, 0x18, 0x25, 0x3d, 0x06, 0x18, 0xf0, 0x28, 0x0e, 0xf5, 0x4c, 0xa2, 0xf2, 0x49, 0x3d, 0xdf, - 0xdc, 0xee, 0x3c, 0x09, 0x52, 0xf3, 0xe0, 0xbf, 0xba, 0x60, 0x2d, 0x62, 0x19, 0x3d, 0x7d, 0x0c, - 0x85, 0x53, 0xf1, 0x11, 0x63, 0x3f, 0x57, 0x27, 0xcd, 0xed, 0xce, 0xde, 0xba, 0x91, 0x65, 0x59, - 0x92, 0xac, 0x1c, 0x40, 0x79, 0xad, 0xa1, 0x14, 0x1c, 0x13, 0xf8, 0xa4, 0x4e, 0x9a, 0x3b, 0xcc, - 0x62, 0xc3, 0x9d, 0x20, 0x4a, 0xdb, 0x65, 0x87, 0x59, 0xdc, 0xf8, 0x93, 0x4f, 0x7b, 0xd3, 0xe7, - 0x50, 0xb6, 0xa0, 0x1f, 0x4f, 0x84, 0x95, 0x6d, 0x77, 0xee, 0xdd, 0x36, 0x0a, 0x4c, 0xaa, 0x5b, - 0xba, 0x5e, 0xd4, 0xb6, 0x6e, 0x16, 0x35, 0xc2, 0x36, 0xf5, 0xf4, 0x51, 0xc6, 0xdb, 0x2f, 0xd9, - 0xfe, 0x1b, 0xa2, 0xf2, 0x25, 0x0f, 0x8e, 0x2d, 0xab, 0x41, 0xae, 0xdf, 0x4b, 0x66, 0xea, 0xde, - 0x31, 0x7d, 0x7e, 0x2e, 0x6a, 0x6e, 0xd2, 0xa5, 0xc7, 0x72, 0xfd, 0x1e, 0xdd, 0x07, 0xf7, 0xdd, - 0xe7, 0x18, 0x65, 0xbf, 0x97, 0x4c, 0xb9, 0xa9, 0x4a, 0x69, 0xb6, 0x02, 0xf4, 0x29, 0x38, 0x73, - 0x94, 0x43, 0x3f, 0x5f, 0x27, 0xcd, 0xbd, 0x8e, 0xff, 0x8f, 0x51, 0x83, 0x33, 0x94, 0xc3, 0x6e, - 0x69, 0xb9, 0xa8, 0x39, 0x06, 0x31, 0x5b, 0x4f, 0x9f, 0x81, 0x7b, 0x38, 0x1e, 0x4b, 0x54, 0xca, - 0x77, 0xec, 0x29, 0x77, 0x03, 0xf3, 0x16, 0x82, 0x94, 0xdc, 0x38, 0xa6, 0x04, 0x5b, 0x01, 0xfa, - 0x02, 0x4a, 0xc7, 0x7c, 0x82, 0x9a, 0x5f, 0xa2, 0x5f, 0xb0, 0xd2, 0x07, 0xb7, 0x5d, 0x57, 0xd9, - 0xcc, 0x8e, 0xd6, 0x0a, 0x5a, 0x05, 0x18, 0xa0, 0x52, 0x5c, 0xc4, 0x6f, 0xf0, 0xca, 0x2f, 0xda, - 0x1d, 0x65, 0x18, 0x5a, 0x81, 0x92, 0x3d, 0x9a, 0xc9, 0xba, 0x36, 0xbb, 0x8e, 0x1b, 0xa7, 0x60, - 0x4f, 0x40, 0x5d, 0xc8, 0x9f, 0xcc, 0xb4, 0xb7, 0x65, 0xc0, 0x6b, 0xd4, 0x1e, 0xa1, 0x25, 0x70, - 0xcc, 0xd3, 0xf1, 0x72, 0x14, 0xa0, 0x38, 0xc0, 0x50, 0x8e, 0xce, 0xbd, 0xbc, 0xc1, 0x3d, 0xbc, - 0x40, 0x8d, 0x9e, 0x43, 0xcb, 0x50, 0x60, 0x61, 0x1c, 0xa1, 0x57, 0xa0, 0xbb, 0x50, 0xb6, 0xf0, - 0x28, 0x54, 0xe7, 0x5e, 0xb1, 0xd1, 0x87, 0xdd, 0x5b, 0x63, 0x53, 0x1f, 0xdc, 0x97, 0x12, 0x43, - 0x8d, 0x63, 0x7b, 0x47, 0x0e, 0x5b, 0x85, 0x66, 0xf8, 0xb3, 0xf0, 0x82, 0x8f, 0xdf, 0xc7, 0x9a, - 0x5f, 0xd8, 0xab, 0x71, 0x58, 0x86, 0xe9, 0x0e, 0xae, 0x97, 0x55, 0x72, 0xb3, 0xac, 0x92, 0x1f, - 0xcb, 0x2a, 0xf9, 0xb5, 0xac, 0x92, 0xaf, 0xbf, 0xab, 0x5b, 0x1f, 0xf6, 0x33, 0x5f, 0x2a, 0x56, - 0xd3, 0xd1, 0xa8, 0x35, 0xc6, 0x79, 0x3b, 0x46, 0x31, 0x51, 0xad, 0x70, 0xca, 0x5b, 0x91, 0x68, - 0xa7, 0xfb, 0xfb, 0x96, 0xbb, 0xfb, 0x16, 0xc5, 0xab, 0x41, 0x70, 0x78, 0xd2, 0x0f, 0x06, 0x09, - 0x37, 0x2c, 0xda, 0x9f, 0x76, 0xf0, 0x37, 0x00, 0x00, 0xff, 0xff, 0xcb, 0xab, 0x17, 0xd9, 0xcb, - 0x03, 0x00, 0x00, + // 658 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x54, 0xcd, 0x6e, 0xd3, 0x5a, + 0x10, 0xae, 0x63, 0x27, 0x76, 0xa6, 0x3f, 0xd7, 0xf7, 0xdc, 0xab, 0x7b, 0x4d, 0x54, 0x25, 0x55, + 0xc4, 0xa2, 0x95, 0x88, 0x2d, 0xa5, 0x12, 0x42, 0x82, 0x4d, 0xd3, 0x08, 0x1a, 0x51, 0xa0, 0x3a, + 0x29, 0x5d, 0xb0, 0x73, 0x92, 0x89, 0x6b, 0x91, 0xda, 0xe1, 0x1c, 0x27, 0xa8, 0xef, 0xc1, 0x82, + 0x67, 0xe0, 0x49, 0xba, 0xec, 0x12, 0xb1, 0x88, 0x50, 0x78, 0x06, 0x16, 0xac, 0x40, 0x1e, 0x3b, + 0x89, 0x5d, 0x28, 0x12, 0xbb, 0x6f, 0xbe, 0xf9, 0xe6, 0xe7, 0x4c, 0xbe, 0x18, 0xfe, 0x95, 0x28, + 0xa6, 0x7e, 0x1f, 0x9d, 0x29, 0x0a, 0x7f, 0x78, 0x69, 0x8f, 0x45, 0x18, 0x85, 0x4c, 0x4f, 0xd9, + 0x8a, 0x29, 0x70, 0x28, 0x9d, 0xe8, 0x72, 0x8c, 0x32, 0x49, 0x55, 0x1a, 0x9e, 0x1f, 0x9d, 0x4f, + 0x7a, 0x76, 0x3f, 0xbc, 0x70, 0xbc, 0xd0, 0x0b, 0x1d, 0xa2, 0x7b, 0x93, 0x21, 0x45, 0x14, 0x10, + 0x4a, 0xe4, 0xf5, 0xaf, 0x0a, 0xdc, 0xe1, 0xf8, 0x66, 0x82, 0x32, 0x3a, 0x8b, 0x27, 0xf8, 0x7d, + 0x37, 0xf2, 0xc3, 0xe0, 0x08, 0xdd, 0x01, 0x0a, 0x76, 0x0c, 0xd0, 0xf5, 0xbd, 0xc0, 0x8d, 0x26, + 0x02, 0xa5, 0xa5, 0xec, 0xa8, 0xbb, 0xeb, 0xcd, 0x7b, 0x76, 0x3a, 0xdc, 0xbe, 0xb5, 0xce, 0x5e, + 0x16, 0xf1, 0x4c, 0x3d, 0xbb, 0x0b, 0xc5, 0xd3, 0xf0, 0x35, 0x06, 0x56, 0x61, 0x47, 0xd9, 0x5d, + 0x6f, 0x6e, 0x2d, 0x1b, 0x11, 0xcb, 0x93, 0x24, 0x73, 0xa0, 0xd4, 0x42, 0x57, 0xa0, 0xb0, 0x54, + 0x92, 0xfd, 0xbf, 0x94, 0x25, 0x34, 0xa9, 0x9e, 0x49, 0x8f, 0xa7, 0xb2, 0xca, 0x3e, 0x94, 0x97, + 0x43, 0x18, 0x03, 0x2d, 0x0e, 0x2c, 0x65, 0x47, 0xd9, 0xdd, 0xe0, 0x84, 0x63, 0xee, 0x04, 0x51, + 0xd0, 0xd8, 0x0d, 0x4e, 0xb8, 0xfe, 0x4d, 0x4d, 0x97, 0x61, 0x0f, 0xa1, 0x4c, 0xa0, 0x13, 0x0c, + 0x43, 0x2a, 0x5b, 0x6f, 0xfe, 0x93, 0xdf, 0xcc, 0x8e, 0x53, 0x2d, 0xe3, 0x6a, 0x56, 0x5b, 0xbb, + 0x9e, 0xd5, 0x14, 0xbe, 0xd2, 0xb3, 0xed, 0xcc, 0x6c, 0xcb, 0xa0, 0xfe, 0x2b, 0xa2, 0xf2, 0x4e, + 0x05, 0x8d, 0x64, 0x35, 0x28, 0x74, 0xda, 0xc9, 0x4e, 0xad, 0xbf, 0xe2, 0x3e, 0x9f, 0x66, 0x35, + 0x3d, 0xe9, 0xd2, 0xe6, 0x85, 0x4e, 0x9b, 0xed, 0x81, 0xfe, 0xe2, 0x6d, 0x80, 0xa2, 0xd3, 0x4e, + 0xb6, 0x5c, 0xa9, 0x52, 0x9a, 0x2f, 0x00, 0xbb, 0x0f, 0xda, 0x14, 0x45, 0x8f, 0xae, 0xb3, 0xd5, + 0xb4, 0x7e, 0xb1, 0xaa, 0x7d, 0x86, 0xa2, 0xd7, 0x32, 0xe6, 0xb3, 0x9a, 0x16, 0x23, 0x4e, 0x7a, + 0xf6, 0x00, 0xf4, 0x83, 0xc1, 0x40, 0xa0, 0x94, 0x96, 0x46, 0xaf, 0xdc, 0xb4, 0x63, 0xf3, 0xd8, + 0x29, 0xb9, 0x9a, 0x98, 0x12, 0x7c, 0x01, 0xd8, 0x23, 0x30, 0x8e, 0xfd, 0x21, 0x46, 0xfe, 0x05, + 0x5a, 0x45, 0x2a, 0xfd, 0x2f, 0x3f, 0x75, 0x91, 0xcd, 0xdc, 0x68, 0x59, 0xc1, 0xaa, 0x00, 0x5d, + 0x94, 0xd2, 0x0f, 0x83, 0xa7, 0x78, 0x69, 0x95, 0xe8, 0x46, 0x19, 0x86, 0x55, 0xc0, 0xa0, 0xa7, + 0xc5, 0x59, 0x9d, 0xb2, 0xcb, 0xb8, 0x7e, 0x0a, 0xf4, 0x02, 0xa6, 0x83, 0x7a, 0x32, 0x89, 0xcc, + 0xb5, 0x18, 0x3c, 0xc1, 0xc8, 0x54, 0x98, 0x01, 0x5a, 0xec, 0x35, 0xb3, 0xc0, 0x00, 0x4a, 0x5d, + 0x74, 0x45, 0xff, 0xdc, 0x54, 0x63, 0xdc, 0xc6, 0x11, 0x46, 0x68, 0x6a, 0xac, 0x0c, 0x45, 0xee, + 0x06, 0x1e, 0x9a, 0x45, 0xb6, 0x09, 0x65, 0x82, 0x47, 0xae, 0x3c, 0x37, 0x4b, 0xf5, 0x0e, 0x6c, + 0xe6, 0xd6, 0x66, 0x16, 0xe8, 0x87, 0x02, 0xdd, 0x08, 0x07, 0xf4, 0x1b, 0x69, 0x7c, 0x11, 0xc6, + 0xcb, 0x9f, 0xb9, 0x23, 0x7f, 0xf0, 0x32, 0x88, 0xfc, 0x11, 0xfd, 0x34, 0x1a, 0xcf, 0x30, 0xf5, + 0xef, 0x0a, 0x6c, 0xe5, 0x6d, 0xc9, 0xda, 0x3f, 0xfb, 0x69, 0xfb, 0x16, 0x0b, 0xff, 0xc6, 0x58, + 0xd9, 0xab, 0x14, 0xf2, 0x57, 0xc9, 0x9b, 0x4e, 0xbd, 0x69, 0xba, 0x8b, 0xd4, 0x73, 0x15, 0x30, + 0x0e, 0x0e, 0x8f, 0xf9, 0x64, 0x44, 0xff, 0x5c, 0xea, 0xb0, 0x88, 0xff, 0xc4, 0x6e, 0xf9, 0x0b, + 0xa8, 0x37, 0x2f, 0xd0, 0xea, 0x5e, 0xcd, 0xab, 0xca, 0xf5, 0xbc, 0xaa, 0x7c, 0x9c, 0x57, 0x95, + 0xcf, 0xf3, 0xaa, 0xf2, 0xfe, 0x4b, 0x75, 0xed, 0xd5, 0x5e, 0xe6, 0x2b, 0x14, 0xc8, 0x71, 0xbf, + 0xdf, 0x18, 0xe0, 0xd4, 0x09, 0x30, 0x1c, 0xca, 0x86, 0x3b, 0xf6, 0x1b, 0x5e, 0xe8, 0xa4, 0x27, + 0xf9, 0x50, 0xf8, 0xfb, 0x39, 0x86, 0x8f, 0xbb, 0xf6, 0xc1, 0x49, 0xc7, 0xee, 0x26, 0x5c, 0xaf, + 0x44, 0x1f, 0xa7, 0xfd, 0x1f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x3b, 0x49, 0xb9, 0x3e, 0xfe, 0x04, + 0x00, 0x00, } func (m *RequestVerificationHeader) Marshal() (dAtA []byte, err error) { @@ -427,6 +554,18 @@ func (m *RequestVerificationHeader) MarshalToSizedBuffer(dAtA []byte) (int, erro i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } + if m.Bearer != nil { + { + size, err := m.Bearer.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintVerify(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } if m.Token != nil { { size, err := m.Token.MarshalToSizedBuffer(dAtA[:i]) @@ -664,6 +803,106 @@ func (m *TokenLifetime) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *BearerTokenMsg) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *BearerTokenMsg) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BearerTokenMsg) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Signature) > 0 { + i -= len(m.Signature) + copy(dAtA[i:], m.Signature) + i = encodeVarintVerify(dAtA, i, uint64(len(m.Signature))) + i-- + dAtA[i] = 0x1a + } + if len(m.OwnerKey) > 0 { + i -= len(m.OwnerKey) + copy(dAtA[i:], m.OwnerKey) + i = encodeVarintVerify(dAtA, i, uint64(len(m.OwnerKey))) + i-- + dAtA[i] = 0x12 + } + { + size, err := m.BearerTokenMsg_Info.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintVerify(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *BearerTokenMsg_Info) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *BearerTokenMsg_Info) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BearerTokenMsg_Info) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.ValidUntil != 0 { + i = encodeVarintVerify(dAtA, i, uint64(m.ValidUntil)) + i-- + dAtA[i] = 0x18 + } + { + size := m.OwnerID.Size() + i -= size + if _, err := m.OwnerID.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintVerify(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.ACLRules) > 0 { + i -= len(m.ACLRules) + copy(dAtA[i:], m.ACLRules) + i = encodeVarintVerify(dAtA, i, uint64(len(m.ACLRules))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func encodeVarintVerify(dAtA []byte, offset int, v uint64) int { offset -= sovVerify(v) base := offset @@ -691,6 +930,10 @@ func (m *RequestVerificationHeader) Size() (n int) { l = m.Token.Size() n += 1 + l + sovVerify(uint64(l)) } + if m.Bearer != nil { + l = m.Bearer.Size() + n += 1 + l + sovVerify(uint64(l)) + } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -784,6 +1027,49 @@ func (m *TokenLifetime) Size() (n int) { return n } +func (m *BearerTokenMsg) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.BearerTokenMsg_Info.Size() + n += 1 + l + sovVerify(uint64(l)) + l = len(m.OwnerKey) + if l > 0 { + n += 1 + l + sovVerify(uint64(l)) + } + l = len(m.Signature) + if l > 0 { + n += 1 + l + sovVerify(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *BearerTokenMsg_Info) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ACLRules) + if l > 0 { + n += 1 + l + sovVerify(uint64(l)) + } + l = m.OwnerID.Size() + n += 1 + l + sovVerify(uint64(l)) + if m.ValidUntil != 0 { + n += 1 + sovVerify(uint64(m.ValidUntil)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + func sovVerify(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -889,6 +1175,42 @@ func (m *RequestVerificationHeader) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Bearer", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVerify + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthVerify + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthVerify + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Bearer == nil { + m.Bearer = &BearerTokenMsg{} + } + if err := m.Bearer.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipVerify(dAtA[iNdEx:]) @@ -1522,6 +1844,301 @@ func (m *TokenLifetime) Unmarshal(dAtA []byte) error { } return nil } +func (m *BearerTokenMsg) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVerify + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: BearerTokenMsg: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BearerTokenMsg: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BearerTokenMsg_Info", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVerify + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthVerify + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthVerify + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.BearerTokenMsg_Info.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OwnerKey", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVerify + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthVerify + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthVerify + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OwnerKey = append(m.OwnerKey[:0], dAtA[iNdEx:postIndex]...) + if m.OwnerKey == nil { + m.OwnerKey = []byte{} + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signature", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVerify + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthVerify + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthVerify + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Signature = append(m.Signature[:0], dAtA[iNdEx:postIndex]...) + if m.Signature == nil { + m.Signature = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipVerify(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthVerify + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthVerify + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *BearerTokenMsg_Info) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVerify + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Info: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Info: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ACLRules", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVerify + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthVerify + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthVerify + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ACLRules = append(m.ACLRules[:0], dAtA[iNdEx:postIndex]...) + if m.ACLRules == nil { + m.ACLRules = []byte{} + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OwnerID", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVerify + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthVerify + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthVerify + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.OwnerID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidUntil", wireType) + } + m.ValidUntil = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVerify + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ValidUntil |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipVerify(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthVerify + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthVerify + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipVerify(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/service/verify.proto b/service/verify.proto index a6619a6..a7e694f 100644 --- a/service/verify.proto +++ b/service/verify.proto @@ -23,6 +23,9 @@ message RequestVerificationHeader { // Token is a token of the session within which the request is sent Token Token = 2; + + // Bearer is a Bearer token of the request + BearerTokenMsg Bearer = 3; } // User token granting rights for object manipulation @@ -91,3 +94,26 @@ message TokenLifetime { // uint32 Version = 2; // bytes Data = 3; // } + +// BearerTokenMsg carries information about request ACL rules with limited lifetime +message BearerTokenMsg { + message Info { + // ACLRules carries a binary representation of the table of extended ACL rules + bytes ACLRules = 1; + + // OwnerID is an owner of token + bytes OwnerID = 2 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false]; + + // ValidUntil carries a last epoch of token lifetime + uint64 ValidUntil = 3; + } + + // TokenInfo is a grouped information about token + Info TokenInfo = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + + // OwnerKey is a public key of the token owner + bytes OwnerKey = 2; + + // Signature is a signature of token information + bytes Signature = 3; +} diff --git a/service/verify_test.go b/service/verify_test.go index e13f316..55ec65f 100644 --- a/service/verify_test.go +++ b/service/verify_test.go @@ -115,3 +115,16 @@ func TestRequestVerificationHeader_SetToken(t *testing.T) { require.Equal(t, token, h.GetToken()) } + +func TestRequestVerificationHeader_SetBearer(t *testing.T) { + aclRules := []byte{1, 2, 3} + + token := new(BearerTokenMsg) + token.SetACLRules(aclRules) + + h := new(RequestVerificationHeader) + + h.SetBearer(token) + + require.Equal(t, token, h.GetBearer()) +} From 3f7d3f8a86d5df90e222e64f16b735b81766407c Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 18 Jun 2020 15:24:17 +0300 Subject: [PATCH 0235/1196] service: make RequestData to provide BearerTokenSource interface --- service/bearer.go | 30 ++++++++++++++++++++++++++++++ service/bearer_test.go | 15 +++++++++++++++ service/sign_test.go | 6 ++++++ service/types.go | 1 + service/verify.go | 11 +++++++++++ service/verify_test.go | 10 ++++++++++ 6 files changed, 73 insertions(+) diff --git a/service/bearer.go b/service/bearer.go index 6013e03..dc556ce 100644 --- a/service/bearer.go +++ b/service/bearer.go @@ -12,6 +12,10 @@ type signedBearerToken struct { BearerToken } +type bearerMsgWrapper struct { + *BearerTokenMsg +} + const fixedBearerTokenDataSize = 0 + refs.OwnerIDSize + 8 @@ -124,3 +128,29 @@ func (m *BearerTokenMsg) SetOwnerKey(v []byte) { func (m *BearerTokenMsg) SetSignature(v []byte) { m.Signature = v } + +func wrapBearerTokenMsg(msg *BearerTokenMsg) bearerMsgWrapper { + return bearerMsgWrapper{ + BearerTokenMsg: msg, + } +} + +// ExpirationEpoch returns the result of ValidUntil field getter. +// +// If message is nil, 0 returns. +func (s bearerMsgWrapper) ExpirationEpoch() uint64 { + if s.BearerTokenMsg != nil { + return s.GetValidUntil() + } + + return 0 +} + +// SetExpirationEpoch passes argument to ValidUntil field setter. +// +// If message is nil, nothing changes. +func (s bearerMsgWrapper) SetExpirationEpoch(v uint64) { + if s.BearerTokenMsg != nil { + s.SetValidUntil(v) + } +} diff --git a/service/bearer_test.go b/service/bearer_test.go index 9ece9c8..381f190 100644 --- a/service/bearer_test.go +++ b/service/bearer_test.go @@ -194,3 +194,18 @@ func TestBearerTokenMsg_Setters(t *testing.T) { s.SetSignature(sig) require.Equal(t, sig, s.GetSignature()) } + +func TestBearerMsgWrapper_ExpirationEpoch(t *testing.T) { + s := wrapBearerTokenMsg(nil) + require.Zero(t, s.ExpirationEpoch()) + require.NotPanics(t, func() { + s.SetExpirationEpoch(1) + }) + + msg := new(BearerTokenMsg) + s = wrapBearerTokenMsg(msg) + + epoch := uint64(7) + s.SetExpirationEpoch(epoch) + require.Equal(t, epoch, s.ExpirationEpoch()) +} diff --git a/service/sign_test.go b/service/sign_test.go index ca469b8..8b67e5b 100644 --- a/service/sign_test.go +++ b/service/sign_test.go @@ -18,6 +18,8 @@ type testSignedDataSrc struct { sig []byte key *ecdsa.PublicKey token SessionToken + + bearer BearerToken } type testSignedDataReader struct { @@ -54,6 +56,10 @@ func (s testSignedDataSrc) GetSessionToken() SessionToken { return s.token } +func (s testSignedDataSrc) GetBearerToken() BearerToken { + return s.bearer +} + func (s testSignedDataReader) SignedDataSize() int { return len(s.data) } diff --git a/service/types.go b/service/types.go index 87c3a77..feba2e3 100644 --- a/service/types.go +++ b/service/types.go @@ -254,6 +254,7 @@ type DataWithSignKeySource interface { type RequestData interface { SignedDataSource SessionTokenSource + BearerTokenSource } // RequestSignedData is an interface of request information with signature write access. diff --git a/service/verify.go b/service/verify.go index 0673a01..9fbdfdf 100644 --- a/service/verify.go +++ b/service/verify.go @@ -103,3 +103,14 @@ func (t testCustomField) MarshalTo(data []byte) (int, error) { return 0, nil } // Marshal skip, it's for test usage only. func (t testCustomField) Marshal() ([]byte, error) { return nil, nil } + +// GetBearerToken returns wraps Bearer field and return BearerToken interface. +// +// If Bearer field value is nil, nil returns. +func (m RequestVerificationHeader) GetBearerToken() BearerToken { + if t := m.GetBearer(); t != nil { + return wrapBearerTokenMsg(t) + } + + return nil +} diff --git a/service/verify_test.go b/service/verify_test.go index 55ec65f..b42bb79 100644 --- a/service/verify_test.go +++ b/service/verify_test.go @@ -128,3 +128,13 @@ func TestRequestVerificationHeader_SetBearer(t *testing.T) { require.Equal(t, token, h.GetBearer()) } + +func TestRequestVerificationHeader_GetBearerToken(t *testing.T) { + s := new(RequestVerificationHeader) + + require.Nil(t, s.GetBearerToken()) + + bearer := new(BearerTokenMsg) + s.SetBearer(bearer) + require.Equal(t, wrapBearerTokenMsg(bearer), s.GetBearerToken()) +} From a3569ad99e7f016cc59e20d9f41ef08bdd98c72c Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 18 Jun 2020 15:26:56 +0300 Subject: [PATCH 0236/1196] service: ad BearerToken to signed payload of the requests --- service/sign.go | 6 ++++++ service/sign_test.go | 19 +++++++++++++++++++ service/verify.go | 2 +- 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/service/sign.go b/service/sign.go index eb1c16d..a0bb7e5 100644 --- a/service/sign.go +++ b/service/sign.go @@ -209,6 +209,9 @@ func SignRequestData(key *ecdsa.PrivateKey, src RequestSignedData) error { NewSignedSessionToken( src.GetSessionToken(), ), + NewSignedBearerToken( + src.GetBearerToken(), + ), ) if err != nil { return err @@ -231,6 +234,9 @@ func VerifyRequestData(src RequestVerifyData) error { NewVerifiedSessionToken( src.GetSessionToken(), ), + NewVerifiedBearerToken( + src.GetBearerToken(), + ), ) if err != nil { return err diff --git a/service/sign_test.go b/service/sign_test.go index 8b67e5b..80c0d19 100644 --- a/service/sign_test.go +++ b/service/sign_test.go @@ -279,14 +279,21 @@ func TestSignVerifyDataWithSessionToken(t *testing.T) { var ( token = new(Token) initVerb = Token_Info_Verb(1) + + bearer = wrapBearerTokenMsg(new(BearerTokenMsg)) + bearerEpoch = uint64(8) ) token.SetVerb(initVerb) + bearer.SetExpirationEpoch(bearerEpoch) + // create test data with token src := &testSignedDataSrc{ data: testData(t, 10), token: token, + + bearer: bearer, } // create test private key @@ -319,6 +326,18 @@ func TestSignVerifyDataWithSessionToken(t *testing.T) { // ascertain that verification is passed require.NoError(t, VerifyRequestData(src)) + // break the Bearer token + bearer.SetExpirationEpoch(bearerEpoch + 1) + + // ascertain that verification is failed + require.Error(t, VerifyRequestData(src)) + + // restore the Bearer token + bearer.SetExpirationEpoch(bearerEpoch) + + // ascertain that verification is passed + require.NoError(t, VerifyRequestData(src)) + // wrap to data reader rdr := &testSignedDataReader{ testSignedDataSrc: src, diff --git a/service/verify.go b/service/verify.go index 9fbdfdf..ee2eecc 100644 --- a/service/verify.go +++ b/service/verify.go @@ -104,7 +104,7 @@ func (t testCustomField) MarshalTo(data []byte) (int, error) { return 0, nil } // Marshal skip, it's for test usage only. func (t testCustomField) Marshal() ([]byte, error) { return nil, nil } -// GetBearerToken returns wraps Bearer field and return BearerToken interface. +// GetBearerToken wraps Bearer field and return BearerToken interface. // // If Bearer field value is nil, nil returns. func (m RequestVerificationHeader) GetBearerToken() BearerToken { From db53e2ea39ab6ab7c2a6d0a5980a018a40e0aa6b Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 18 Jun 2020 15:47:55 +0300 Subject: [PATCH 0237/1196] service: make RequestData to provide ExtendedHeadersSource interface --- service/meta.go | 45 +++++++++++++++++++++++++++++++++++++++++++ service/meta_test.go | 46 ++++++++++++++++++++++++++++++++++++++++++++ service/sign_test.go | 6 ++++++ service/types.go | 1 + 4 files changed, 98 insertions(+) diff --git a/service/meta.go b/service/meta.go index e838cec..557d076 100644 --- a/service/meta.go +++ b/service/meta.go @@ -4,6 +4,10 @@ import ( "io" ) +type extHdrWrapper struct { + msg *RequestExtendedHeader_KV +} + type extHdrSrcWrapper struct { extHdrSrc ExtendedHeadersSource } @@ -84,3 +88,44 @@ func (m *RequestExtendedHeader_KV) SetV(v string) { func (m *RequestExtendedHeader) SetHeaders(v []RequestExtendedHeader_KV) { m.Headers = v } + +func wrapExtendedHeaderKV(msg *RequestExtendedHeader_KV) extHdrWrapper { + return extHdrWrapper{ + msg: msg, + } +} + +// Key returns the result of K field getter. +// +// If message is nil, empty string returns. +func (m extHdrWrapper) Key() string { + if m.msg != nil { + return m.msg.GetK() + } + + return "" +} + +// Value returns the result of V field getter. +// +// If message is nil, empty string returns. +func (m extHdrWrapper) Value() string { + if m.msg != nil { + return m.msg.GetV() + } + + return "" +} + +// ExtendedHeaders composes ExtendedHeader list from the Headers field getter result. +func (m RequestExtendedHeader) ExtendedHeaders() []ExtendedHeader { + hs := m.GetHeaders() + + res := make([]ExtendedHeader, 0, len(hs)) + + for i := range hs { + res = append(res, wrapExtendedHeaderKV(&hs[i])) + } + + return res +} diff --git a/service/meta_test.go b/service/meta_test.go index 7c3853a..9e9c012 100644 --- a/service/meta_test.go +++ b/service/meta_test.go @@ -51,3 +51,49 @@ func TestRequestExtendedHeader_SetHeaders(t *testing.T) { require.Equal(t, hdrs, s.GetHeaders()) } + +func TestExtHdrWrapper(t *testing.T) { + s := wrapExtendedHeaderKV(nil) + require.Empty(t, s.Key()) + require.Empty(t, s.Value()) + + msg := new(RequestExtendedHeader_KV) + s = wrapExtendedHeaderKV(msg) + + key := "key" + msg.SetK(key) + require.Equal(t, key, s.Key()) + + val := "val" + msg.SetV(val) + require.Equal(t, val, s.Value()) +} + +func TestRequestExtendedHeader_ExtendedHeaders(t *testing.T) { + var ( + k1, v1 = "key1", "value1" + k2, v2 = "key2", "value2" + h1 = new(RequestExtendedHeader_KV) + h2 = new(RequestExtendedHeader_KV) + ) + + h1.SetK(k1) + h1.SetV(v1) + + h2.SetK(k2) + h2.SetV(v2) + + s := new(RequestExtendedHeader) + s.SetHeaders([]RequestExtendedHeader_KV{ + *h1, *h2, + }) + + xHdrs := s.ExtendedHeaders() + require.Len(t, xHdrs, 2) + + require.Equal(t, k1, xHdrs[0].Key()) + require.Equal(t, v1, xHdrs[0].Value()) + + require.Equal(t, k2, xHdrs[1].Key()) + require.Equal(t, v2, xHdrs[1].Value()) +} diff --git a/service/sign_test.go b/service/sign_test.go index 80c0d19..023412f 100644 --- a/service/sign_test.go +++ b/service/sign_test.go @@ -20,6 +20,8 @@ type testSignedDataSrc struct { token SessionToken bearer BearerToken + + extHdrs []ExtendedHeader } type testSignedDataReader struct { @@ -60,6 +62,10 @@ func (s testSignedDataSrc) GetBearerToken() BearerToken { return s.bearer } +func (s testSignedDataSrc) ExtendedHeaders() []ExtendedHeader { + return s.extHdrs +} + func (s testSignedDataReader) SignedDataSize() int { return len(s.data) } diff --git a/service/types.go b/service/types.go index feba2e3..75a5a0a 100644 --- a/service/types.go +++ b/service/types.go @@ -255,6 +255,7 @@ type RequestData interface { SignedDataSource SessionTokenSource BearerTokenSource + ExtendedHeadersSource } // RequestSignedData is an interface of request information with signature write access. From c360b7d19cc253a233dfe2df8c434a6063c3ce29 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 18 Jun 2020 15:50:01 +0300 Subject: [PATCH 0238/1196] service: add ExtendedHeader list to signed payload of the requests --- service/sign.go | 2 ++ service/sign_test.go | 23 ++++++++++++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/service/sign.go b/service/sign.go index a0bb7e5..50453b9 100644 --- a/service/sign.go +++ b/service/sign.go @@ -212,6 +212,7 @@ func SignRequestData(key *ecdsa.PrivateKey, src RequestSignedData) error { NewSignedBearerToken( src.GetBearerToken(), ), + ExtendedHeadersSignedData(src), ) if err != nil { return err @@ -237,6 +238,7 @@ func VerifyRequestData(src RequestVerifyData) error { NewVerifiedBearerToken( src.GetBearerToken(), ), + ExtendedHeadersSignedData(src), ) if err != nil { return err diff --git a/service/sign_test.go b/service/sign_test.go index 023412f..724c068 100644 --- a/service/sign_test.go +++ b/service/sign_test.go @@ -268,7 +268,7 @@ func TestVerifySignatureWithKey(t *testing.T) { require.Error(t, VerifySignatureWithKey(&sk.PublicKey, src)) } -func TestSignVerifyDataWithSessionToken(t *testing.T) { +func TestSignVerifyRequestData(t *testing.T) { // sign with empty RequestSignedData require.EqualError(t, SignRequestData(nil, nil), @@ -288,18 +288,27 @@ func TestSignVerifyDataWithSessionToken(t *testing.T) { bearer = wrapBearerTokenMsg(new(BearerTokenMsg)) bearerEpoch = uint64(8) + + extHdrKey = "key" + extHdr = new(RequestExtendedHeader_KV) ) token.SetVerb(initVerb) bearer.SetExpirationEpoch(bearerEpoch) + extHdr.SetK(extHdrKey) + // create test data with token src := &testSignedDataSrc{ data: testData(t, 10), token: token, bearer: bearer, + + extHdrs: []ExtendedHeader{ + wrapExtendedHeaderKV(extHdr), + }, } // create test private key @@ -344,6 +353,18 @@ func TestSignVerifyDataWithSessionToken(t *testing.T) { // ascertain that verification is passed require.NoError(t, VerifyRequestData(src)) + // break the extended header + extHdr.SetK(extHdrKey + "1") + + // ascertain that verification is failed + require.Error(t, VerifyRequestData(src)) + + // restore the extended header + extHdr.SetK(extHdrKey) + + // ascertain that verification is passed + require.NoError(t, VerifyRequestData(src)) + // wrap to data reader rdr := &testSignedDataReader{ testSignedDataSrc: src, From a3c488994521ae9282de58c762de46bbc7ab4a21 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 18 Jun 2020 16:06:47 +0300 Subject: [PATCH 0239/1196] service: implement BearerToken interface on BearerTokenMsg message This commit: * implements (Set)ExpirationEpoch methods on BearerTokenMsg; * removes BearerTokenMsg wrapper. --- service/bearer.go | 36 ++++++++++-------------------------- service/bearer_test.go | 18 +++--------------- service/sign_test.go | 2 +- service/verify.go | 2 +- service/verify_test.go | 2 +- 5 files changed, 16 insertions(+), 44 deletions(-) diff --git a/service/bearer.go b/service/bearer.go index dc556ce..327f74f 100644 --- a/service/bearer.go +++ b/service/bearer.go @@ -119,6 +119,16 @@ func (m *BearerTokenMsg_Info) SetOwnerID(v OwnerID) { m.OwnerID = v } +// ExpirationEpoch returns the result of ValidUntil field getter. +func (m BearerTokenMsg_Info) ExpirationEpoch() uint64 { + return m.GetValidUntil() +} + +// SetExpirationEpoch passes argument to ValidUntil field setter. +func (m *BearerTokenMsg_Info) SetExpirationEpoch(v uint64) { + m.SetValidUntil(v) +} + // SetOwnerKey is an OwnerKey field setter. func (m *BearerTokenMsg) SetOwnerKey(v []byte) { m.OwnerKey = v @@ -128,29 +138,3 @@ func (m *BearerTokenMsg) SetOwnerKey(v []byte) { func (m *BearerTokenMsg) SetSignature(v []byte) { m.Signature = v } - -func wrapBearerTokenMsg(msg *BearerTokenMsg) bearerMsgWrapper { - return bearerMsgWrapper{ - BearerTokenMsg: msg, - } -} - -// ExpirationEpoch returns the result of ValidUntil field getter. -// -// If message is nil, 0 returns. -func (s bearerMsgWrapper) ExpirationEpoch() uint64 { - if s.BearerTokenMsg != nil { - return s.GetValidUntil() - } - - return 0 -} - -// SetExpirationEpoch passes argument to ValidUntil field setter. -// -// If message is nil, nothing changes. -func (s bearerMsgWrapper) SetExpirationEpoch(v uint64) { - if s.BearerTokenMsg != nil { - s.SetValidUntil(v) - } -} diff --git a/service/bearer_test.go b/service/bearer_test.go index 381f190..d6985cb 100644 --- a/service/bearer_test.go +++ b/service/bearer_test.go @@ -182,6 +182,9 @@ func TestBearerTokenMsg_Setters(t *testing.T) { s.SetValidUntil(validUntil) require.Equal(t, validUntil, s.GetValidUntil()) + s.SetExpirationEpoch(validUntil + 1) + require.Equal(t, validUntil+1, s.ExpirationEpoch()) + ownerID := OwnerID{1, 2, 3} s.SetOwnerID(ownerID) require.Equal(t, ownerID, s.GetOwnerID()) @@ -194,18 +197,3 @@ func TestBearerTokenMsg_Setters(t *testing.T) { s.SetSignature(sig) require.Equal(t, sig, s.GetSignature()) } - -func TestBearerMsgWrapper_ExpirationEpoch(t *testing.T) { - s := wrapBearerTokenMsg(nil) - require.Zero(t, s.ExpirationEpoch()) - require.NotPanics(t, func() { - s.SetExpirationEpoch(1) - }) - - msg := new(BearerTokenMsg) - s = wrapBearerTokenMsg(msg) - - epoch := uint64(7) - s.SetExpirationEpoch(epoch) - require.Equal(t, epoch, s.ExpirationEpoch()) -} diff --git a/service/sign_test.go b/service/sign_test.go index 724c068..6f1e913 100644 --- a/service/sign_test.go +++ b/service/sign_test.go @@ -286,7 +286,7 @@ func TestSignVerifyRequestData(t *testing.T) { token = new(Token) initVerb = Token_Info_Verb(1) - bearer = wrapBearerTokenMsg(new(BearerTokenMsg)) + bearer = new(BearerTokenMsg) bearerEpoch = uint64(8) extHdrKey = "key" diff --git a/service/verify.go b/service/verify.go index ee2eecc..e1caa06 100644 --- a/service/verify.go +++ b/service/verify.go @@ -109,7 +109,7 @@ func (t testCustomField) Marshal() ([]byte, error) { return nil, nil } // If Bearer field value is nil, nil returns. func (m RequestVerificationHeader) GetBearerToken() BearerToken { if t := m.GetBearer(); t != nil { - return wrapBearerTokenMsg(t) + return t } return nil diff --git a/service/verify_test.go b/service/verify_test.go index b42bb79..5ab8753 100644 --- a/service/verify_test.go +++ b/service/verify_test.go @@ -136,5 +136,5 @@ func TestRequestVerificationHeader_GetBearerToken(t *testing.T) { bearer := new(BearerTokenMsg) s.SetBearer(bearer) - require.Equal(t, wrapBearerTokenMsg(bearer), s.GetBearerToken()) + require.Equal(t, bearer, s.GetBearerToken()) } From 03bc5c5f895f299d63a6a02e6b4117aef2f63639 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 18 Jun 2020 16:26:44 +0300 Subject: [PATCH 0240/1196] container: implement SignedDataSource interface on EACL messages --- container/sign.go | 57 ++++++++++++++++++++++++++++++++++++++++++ container/sign_test.go | 44 ++++++++++++++++++++++++++++++++ 2 files changed, 101 insertions(+) diff --git a/container/sign.go b/container/sign.go index eafd93c..f538f2d 100644 --- a/container/sign.go +++ b/container/sign.go @@ -135,3 +135,60 @@ func (m ListRequest) ReadSignedData(p []byte) (int, error) { return off, nil } + +// SignedData returns payload bytes of the request. +func (m GetExtendedACLRequest) SignedData() ([]byte, error) { + return service.SignedDataFromReader(m) +} + +// SignedDataSize returns payload size of the request. +func (m GetExtendedACLRequest) SignedDataSize() int { + return m.GetID().Size() +} + +// ReadSignedData copies payload bytes to passed buffer. +// +// If the Request size is insufficient, io.ErrUnexpectedEOF returns. +func (m GetExtendedACLRequest) ReadSignedData(p []byte) (int, error) { + if len(p) < m.SignedDataSize() { + return 0, io.ErrUnexpectedEOF + } + + var off int + + off += copy(p[off:], m.GetID().Bytes()) + + return off, nil +} + +// SignedData returns payload bytes of the request. +func (m SetExtendedACLRequest) SignedData() ([]byte, error) { + return service.SignedDataFromReader(m) +} + +// SignedDataSize returns payload size of the request. +func (m SetExtendedACLRequest) SignedDataSize() int { + return 0 + + m.GetID().Size() + + len(m.GetEACL()) + + len(m.GetSignature()) +} + +// ReadSignedData copies payload bytes to passed buffer. +// +// If the Request size is insufficient, io.ErrUnexpectedEOF returns. +func (m SetExtendedACLRequest) ReadSignedData(p []byte) (int, error) { + if len(p) < m.SignedDataSize() { + return 0, io.ErrUnexpectedEOF + } + + var off int + + off += copy(p[off:], m.GetID().Bytes()) + + off += copy(p[off:], m.GetEACL()) + + off += copy(p[off:], m.GetSignature()) + + return off, nil +} diff --git a/container/sign_test.go b/container/sign_test.go index d9b7d26..d04a698 100644 --- a/container/sign_test.go +++ b/container/sign_test.go @@ -108,6 +108,50 @@ func TestRequestSign(t *testing.T) { }, }, }, + { // GetExtendedACLRequest + constructor: func() sigType { + return new(GetExtendedACLRequest) + }, + payloadCorrupt: []func(sigType){ + func(s sigType) { + req := s.(*GetExtendedACLRequest) + + id := req.GetID() + id[0]++ + + req.SetID(id) + }, + }, + }, + { // SetExtendedACLRequest + constructor: func() sigType { + return new(SetExtendedACLRequest) + }, + payloadCorrupt: []func(sigType){ + func(s sigType) { + req := s.(*SetExtendedACLRequest) + + id := req.GetID() + id[0]++ + + req.SetID(id) + }, + func(s sigType) { + req := s.(*SetExtendedACLRequest) + + req.SetEACL( + append(req.GetEACL(), 1), + ) + }, + func(s sigType) { + req := s.(*SetExtendedACLRequest) + + req.SetSignature( + append(req.GetSignature(), 1), + ) + }, + }, + }, } for _, item := range items { From d3984cf236e822c361055e08c96783ffd6d4df4d Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 18 Jun 2020 17:25:39 +0300 Subject: [PATCH 0241/1196] Update changelog and readme for v1.1.0 --- CHANGELOG.md | 18 ++++++++++++++++++ README.md | 6 ++++++ 2 files changed, 24 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index bbd6afb..e771c19 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,23 @@ # Changelog This is the changelog for NeoFS-API-Go +## [1.1.0] - 2020-06-18 + +### Added + +- `container.SetExtendedACL` rpc. +- `container.GetExtendedACL` rpc. +- Bearer token to all request messages. +- X-headers to all request messages. + +### Changed + +- Implementation and signatures of Sign/Verify request functions. + +### Updated + +- NeoFS API v1.0.0 => 1.1.0 + ## [1.0.0] - 2020-05-26 - Bump major release @@ -339,3 +356,4 @@ Initial public release [0.7.5]: https://github.com/nspcc-dev/neofs-api-go/compare/v0.7.4...v0.7.5 [0.7.6]: https://github.com/nspcc-dev/neofs-api-go/compare/v0.7.5...v0.7.6 [1.0.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v0.7.6...v1.0.0 +[1.1.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.0.0...v1.1.0 diff --git a/README.md b/README.md index fac04d0..d44e057 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,12 @@ NeoFS API repository contains implementation of core NeoFS structures that can be used for integration with NeoFS. +## Сompatibility + +[neofs-api v1.1.0]: https://github.com/nspcc-dev/neofs-api/releases/tag/v1.1.0 +[neofs-api-go v1.1.0]: https://github.com/nspcc-dev/neofs-api-go/releases/tag/v1.1.0 +[neofs-api-go v1.1.0] supports [neofs-api v1.1.0] + ## Description Repository contains 13 packages that implement NeoFS core structures. These From 5e1e220988677aa166738ad1f6194e8ea4132744 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 22 Jun 2020 17:26:59 +0300 Subject: [PATCH 0242/1196] service: sign requests on the principle of Matryoshka This commit changes SignRequestData / VerifyRequestData functions to add the list of previous public keys to a signed message for all requests. --- service/sign.go | 20 +++++++++++++++--- service/sign_test.go | 48 ++++++++++++++++++++++++++++++------------ service/types.go | 1 + service/verify.go | 50 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 103 insertions(+), 16 deletions(-) diff --git a/service/sign.go b/service/sign.go index 50453b9..796a4cd 100644 --- a/service/sign.go +++ b/service/sign.go @@ -137,11 +137,24 @@ func verifySignatures(src SignedDataSource, items ...SignKeyPair) error { } defer bytesPool.Put(data) - for _, signKey := range items { + for i := range items { + if i > 0 { + // add previous key bytes to the signed message + + signKeyDataSrc := SignKeyPairsSignedData(items[i-1]) + + signKeyData, err := signKeyDataSrc.SignedData() + if err != nil { + return errors.Wrapf(err, "could not get signed data of key-signature #%d", i) + } + + data = append(data, signKeyData...) + } + if err := crypto.Verify( - signKey.GetPublicKey(), + items[i].GetPublicKey(), data, - signKey.GetSignature(), + items[i].GetSignature(), ); err != nil { return err } @@ -213,6 +226,7 @@ func SignRequestData(key *ecdsa.PrivateKey, src RequestSignedData) error { src.GetBearerToken(), ), ExtendedHeadersSignedData(src), + SignKeyPairsSignedData(src.GetSignKeyPairs()...), ) if err != nil { return err diff --git a/service/sign_test.go b/service/sign_test.go index 6f1e913..3c54e8c 100644 --- a/service/sign_test.go +++ b/service/sign_test.go @@ -15,13 +15,13 @@ import ( type testSignedDataSrc struct { err error data []byte - sig []byte - key *ecdsa.PublicKey token SessionToken bearer BearerToken extHdrs []ExtendedHeader + + signKeys []SignKeyPair } type testSignedDataReader struct { @@ -29,13 +29,15 @@ type testSignedDataReader struct { } func (s testSignedDataSrc) GetSignature() []byte { - return s.sig + if len(s.signKeys) > 0 { + return s.signKeys[0].GetSignature() + } + + return nil } func (s testSignedDataSrc) GetSignKeyPairs() []SignKeyPair { - return []SignKeyPair{ - newSignatureKeyPair(s.key, s.sig), - } + return s.signKeys } func (s testSignedDataSrc) SignedData() ([]byte, error) { @@ -43,8 +45,9 @@ func (s testSignedDataSrc) SignedData() ([]byte, error) { } func (s *testSignedDataSrc) AddSignKey(sig []byte, key *ecdsa.PublicKey) { - s.key = key - s.sig = sig + s.signKeys = append(s.signKeys, + newSignatureKeyPair(key, sig), + ) } func testData(t *testing.T, sz int) []byte { @@ -209,23 +212,27 @@ func TestVerifyAccumulatedSignatures(t *testing.T) { // create test private key sk := test.DecodeKey(0) + signKey := new(RequestVerificationHeader_Signature) + signKey.Peer = crypto.MarshalPublicKey(&sk.PublicKey) + // create signature source src := &testSignedDataSrc{ data: testData(t, 10), - key: &sk.PublicKey, + + signKeys: []SignKeyPair{signKey}, } var err error // calculate a signature - src.sig, err = crypto.Sign(sk, src.data) + signKey.Sign, err = crypto.Sign(sk, src.data) require.NoError(t, err) // ascertain that verification is passed require.NoError(t, VerifyAccumulatedSignatures(src)) // break the signature - src.sig[0]++ + signKey.Sign[0]++ // ascertain that verification is failed require.Error(t, VerifyAccumulatedSignatures(src)) @@ -238,9 +245,13 @@ func TestVerifySignatureWithKey(t *testing.T) { ErrEmptyDataWithSignature.Error(), ) + signKey := new(RequestVerificationHeader_Signature) + // create test signature source src := &testSignedDataSrc{ data: testData(t, 10), + + signKeys: []SignKeyPair{signKey}, } // nil public key @@ -255,14 +266,14 @@ func TestVerifySignatureWithKey(t *testing.T) { var err error // calculate a signature - src.sig, err = crypto.Sign(sk, src.data) + signKey.Sign, err = crypto.Sign(sk, src.data) require.NoError(t, err) // ascertain that verification is passed require.NoError(t, VerifySignatureWithKey(&sk.PublicKey, src)) // break the signature - src.sig[0]++ + signKey.Sign[0]++ // ascertain that verification is failed require.Error(t, VerifySignatureWithKey(&sk.PublicKey, src)) @@ -375,4 +386,15 @@ func TestSignVerifyRequestData(t *testing.T) { // ascertain that verification is passed require.NoError(t, VerifyRequestData(rdr)) + + if len(rdr.GetSignKeyPairs()) < 2 { + // add one more signature + require.NoError(t, SignRequestData(test.DecodeKey(1), rdr)) + } + + // change key-signature order + rdr.signKeys[0], rdr.signKeys[1] = rdr.signKeys[1], rdr.signKeys[0] + + // ascertain that verification is failed + require.Error(t, VerifyRequestData(src)) } diff --git a/service/types.go b/service/types.go index 75a5a0a..785a30a 100644 --- a/service/types.go +++ b/service/types.go @@ -262,6 +262,7 @@ type RequestData interface { type RequestSignedData interface { RequestData SignKeyPairAccumulator + SignKeyPairSource } // RequestVerifyData is an interface of request information with signature read access. diff --git a/service/verify.go b/service/verify.go index e1caa06..7691220 100644 --- a/service/verify.go +++ b/service/verify.go @@ -2,11 +2,16 @@ package service import ( "crypto/ecdsa" + "io" "github.com/nspcc-dev/neofs-api-go/internal" crypto "github.com/nspcc-dev/neofs-crypto" ) +type signKeyPairsWrapper struct { + items []SignKeyPair +} + // GetSessionToken returns SessionToken interface of Token field. // // If token field value is nil, nil returns. @@ -114,3 +119,48 @@ func (m RequestVerificationHeader) GetBearerToken() BearerToken { return nil } + +// SignKeyPairsSignedData wraps passed SignKeyPair slice and returns SignedDataSource interface. +func SignKeyPairsSignedData(v ...SignKeyPair) SignedDataSource { + return &signKeyPairsWrapper{ + items: v, + } +} + +// SignedData returns signed SignKeyPair slice in a binary representation. +func (s signKeyPairsWrapper) SignedData() ([]byte, error) { + return SignedDataFromReader(s) +} + +// SignedDataSize returns the length of signed SignKeyPair slice. +func (s signKeyPairsWrapper) SignedDataSize() (sz int) { + for i := range s.items { + // add key length + sz += len( + crypto.MarshalPublicKey(s.items[i].GetPublicKey()), + ) + } + + return +} + +// ReadSignedData copies a binary representation of the signed SignKeyPair slice to passed buffer. +// +// If buffer length is less than required, io.ErrUnexpectedEOF returns. +func (s signKeyPairsWrapper) ReadSignedData(p []byte) (int, error) { + sz := s.SignedDataSize() + if len(p) < sz { + return 0, io.ErrUnexpectedEOF + } + + off := 0 + + for i := range s.items { + // copy public key bytes + off += copy(p[off:], crypto.MarshalPublicKey( + s.items[i].GetPublicKey(), + )) + } + + return off, nil +} From d45548c43b8f4eb69ad95445d340ce77e1518902 Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Fri, 3 Jul 2020 09:12:02 +0300 Subject: [PATCH 0243/1196] Implementing proto.Clone --- container/types.go | 8 ++++++++ hash/hash.go | 8 ++++++++ internal/proto.go | 3 +++ object/types.go | 26 ++++++++++++++++++++------ object/types_test.go | 21 +++++++++++++++++---- refs/address.go | 12 ++++++++++++ refs/cid.go | 8 ++++++++ refs/owner.go | 8 ++++++++ refs/types_test.go | 29 +++++++++++++++++++++++++++++ refs/uuid.go | 8 ++++++++ service/verify.go | 8 ++++++++ 11 files changed, 129 insertions(+), 10 deletions(-) diff --git a/container/types.go b/container/types.go index 38bdcff..be06b53 100644 --- a/container/types.go +++ b/container/types.go @@ -3,6 +3,7 @@ package container import ( "bytes" + "github.com/gogo/protobuf/proto" "github.com/google/uuid" "github.com/nspcc-dev/neofs-api-go/internal" "github.com/nspcc-dev/neofs-api-go/refs" @@ -63,6 +64,13 @@ func (m *Container) ID() (CID, error) { return refs.CIDForBytes(data), nil } +// Merge used by proto.Clone +func (m *Container) Merge(src proto.Message) { + if tmp, ok := src.(*Container); ok { + *m = *tmp + } +} + // Empty checks that container is empty. func (m *Container) Empty() bool { return m.Capacity == 0 || bytes.Equal(m.Salt.Bytes(), emptySalt) || bytes.Equal(m.OwnerID.Bytes(), emptyOwner) diff --git a/hash/hash.go b/hash/hash.go index 9d75278..4e2fb05 100644 --- a/hash/hash.go +++ b/hash/hash.go @@ -3,6 +3,7 @@ package hash import ( "bytes" + "github.com/gogo/protobuf/proto" "github.com/mr-tron/base58" "github.com/nspcc-dev/neofs-api-go/internal" "github.com/nspcc-dev/tzhash/tz" @@ -78,6 +79,13 @@ func (h Hash) Validate(hashes []Hash) bool { return err == nil && ok } +// Merge used by proto.Clone +func (h *Hash) Merge(src proto.Message) { + if tmp, ok := src.(*Hash); ok { + *h = *tmp + } +} + // Sum returns Tillich-Zémor checksum of data. func Sum(data []byte) Hash { return tz.Sum(data) } diff --git a/internal/proto.go b/internal/proto.go index 951168b..9a924b5 100644 --- a/internal/proto.go +++ b/internal/proto.go @@ -13,4 +13,7 @@ type Custom interface { MarshalTo(data []byte) (int, error) Unmarshal(data []byte) error proto.Message + + // Should contains for proto.Clone + proto.Merger } diff --git a/object/types.go b/object/types.go index 058cd70..392e624 100644 --- a/object/types.go +++ b/object/types.go @@ -163,6 +163,13 @@ func (m *Object) SetHeader(h *Header) { m.AddHeader(h) } +// Merge used by proto.Clone +func (m *Object) Merge(src proto.Message) { + if tmp, ok := src.(*Object); ok { + tmp.CopyTo(m) + } +} + func (m Header) typeOf(t isHeader_Value) (ok bool) { switch t.(type) { case *Header_Link: @@ -233,8 +240,15 @@ func (m *Object) Copy() (obj *Object) { // This function creates copies on every available data slice. func (m *Object) CopyTo(o *Object) { o.SystemHeader = m.SystemHeader - o.Headers = make([]Header, len(m.Headers)) - o.Payload = make([]byte, len(m.Payload)) + + if m.Headers != nil { + o.Headers = make([]Header, len(m.Headers)) + } + + if m.Payload != nil { + o.Payload = make([]byte, len(m.Payload)) + copy(o.Payload, m.Payload) + } for i := range m.Headers { switch v := m.Headers[i].Value.(type) { @@ -246,23 +260,23 @@ func (m *Object) CopyTo(o *Object) { }, } case *Header_HomoHash: + hash := proto.Clone(&v.HomoHash).(*Hash) o.Headers[i] = Header{ Value: &Header_HomoHash{ - HomoHash: v.HomoHash, + HomoHash: *hash, }, } case *Header_Token: + token := *v.Token o.Headers[i] = Header{ Value: &Header_Token{ - Token: v.Token, + Token: &token, }, } default: o.Headers[i] = *proto.Clone(&m.Headers[i]).(*Header) } } - - copy(o.Payload, m.Payload) } // Address returns object's address. diff --git a/object/types_test.go b/object/types_test.go index 0a7085f..18c13f1 100644 --- a/object/types_test.go +++ b/object/types_test.go @@ -4,6 +4,7 @@ import ( "bytes" "testing" + "github.com/gogo/protobuf/proto" "github.com/nspcc-dev/neofs-api-go/refs" "github.com/nspcc-dev/neofs-api-go/service" "github.com/nspcc-dev/neofs-api-go/storagegroup" @@ -192,11 +193,23 @@ func TestObject_Copy(t *testing.T) { }, }) - cp := obj.Copy() + { // Copying + cp := obj.Copy() - _, h := cp.LastHeader(HeaderType(TokenHdr)) - require.NotNil(t, h) - require.Equal(t, token, h.GetValue().(*Header_Token).Token) + _, h := cp.LastHeader(HeaderType(TokenHdr)) + require.NotNil(t, h) + require.Equal(t, token, h.GetValue().(*Header_Token).Token) + } + + { // Cloning + cl := proto.Clone(obj).(*Object) + require.Equal(t, obj, cl) + + _, h := cl.LastHeader(HeaderType(TokenHdr)) + h.GetToken().SetID(service.TokenID{3, 2, 1}) + + require.NotEqual(t, token, h.GetToken()) + } }) } diff --git a/refs/address.go b/refs/address.go index f07e317..ad5f420 100644 --- a/refs/address.go +++ b/refs/address.go @@ -4,6 +4,7 @@ import ( "crypto/sha256" "strings" + "github.com/gogo/protobuf/proto" "github.com/nspcc-dev/neofs-api-go/internal" ) @@ -66,3 +67,14 @@ func (m Address) Hash() ([]byte, error) { h := sha256.Sum256(append(m.ObjectID.Bytes(), m.CID.Bytes()...)) return h[:], nil } + +// Merge used by proto.Clone +func (m *Address) Merge(src proto.Message) { + if addr, ok := src.(*Address); ok { + cid := proto.Clone(&addr.CID).(*CID) + oid := proto.Clone(&addr.ObjectID).(*ObjectID) + + m.CID = *cid + m.ObjectID = *oid + } +} diff --git a/refs/cid.go b/refs/cid.go index 4f0cf39..83450a9 100644 --- a/refs/cid.go +++ b/refs/cid.go @@ -4,6 +4,7 @@ import ( "bytes" "crypto/sha256" + "github.com/gogo/protobuf/proto" "github.com/mr-tron/base58" "github.com/pkg/errors" ) @@ -94,3 +95,10 @@ func (c CID) Verify(data []byte) error { } return nil } + +// Merge used by proto.Clone +func (c *CID) Merge(src proto.Message) { + if cid, ok := src.(*CID); ok { + *c = *cid + } +} diff --git a/refs/owner.go b/refs/owner.go index 1aed00c..6534c35 100644 --- a/refs/owner.go +++ b/refs/owner.go @@ -4,6 +4,7 @@ import ( "bytes" "crypto/ecdsa" + "github.com/gogo/protobuf/proto" "github.com/mr-tron/base58" "github.com/nspcc-dev/neofs-api-go/chain" "github.com/pkg/errors" @@ -63,3 +64,10 @@ func (o *OwnerID) Unmarshal(data []byte) error { copy((*o)[:], data) return nil } + +// Merge used by proto.Clone +func (o *OwnerID) Merge(src proto.Message) { + if uid, ok := src.(*OwnerID); ok { + *o = *uid + } +} diff --git a/refs/types_test.go b/refs/types_test.go index 2fd3ced..5bba5b8 100644 --- a/refs/types_test.go +++ b/refs/types_test.go @@ -23,6 +23,19 @@ func TestSGID(t *testing.T) { require.NoError(t, sgid2.Unmarshal(data)) require.Equal(t, sgid1, sgid2) }) + + t.Run("check that proto.Clone works like expected", func(t *testing.T) { + var ( + sgid1 UUID + sgid2 *UUID + ) + + sgid1, err := NewSGID() + require.NoError(t, err) + + sgid2 = proto.Clone(&sgid1).(*SGID) + require.Equal(t, sgid1, *sgid2) + }) } func TestUUID(t *testing.T) { @@ -80,6 +93,18 @@ func TestOwnerID(t *testing.T) { require.NoError(t, u2.Unmarshal(data)) require.Equal(t, u1, u2) }) + + t.Run("check that proto.Clone works like expected", func(t *testing.T) { + var u2 *OwnerID + + key := test.DecodeKey(0) + + u1, err := NewOwnerID(&key.PublicKey) + require.NoError(t, err) + + u2 = proto.Clone(&u1).(*OwnerID) + require.Equal(t, u1, *u2) + }) } func TestAddress(t *testing.T) { @@ -109,4 +134,8 @@ func TestAddress(t *testing.T) { actual, err := ParseAddress(expect) require.NoError(t, err) require.Equal(t, expect, actual.String()) + + addr := proto.Clone(actual).(*Address) + require.Equal(t, actual, addr) + require.Equal(t, expect, addr.String()) } diff --git a/refs/uuid.go b/refs/uuid.go index 2ffc525..5a49b92 100644 --- a/refs/uuid.go +++ b/refs/uuid.go @@ -4,6 +4,7 @@ import ( "bytes" "encoding/hex" + "github.com/gogo/protobuf/proto" "github.com/google/uuid" "github.com/pkg/errors" ) @@ -74,3 +75,10 @@ func (u *UUID) Parse(id string) error { copy((*u)[:], tmp[:]) return nil } + +// Merge used by proto.Clone +func (u *UUID) Merge(src proto.Message) { + if tmp, ok := src.(*UUID); ok { + *u = *tmp + } +} diff --git a/service/verify.go b/service/verify.go index e1caa06..4a6ec3f 100644 --- a/service/verify.go +++ b/service/verify.go @@ -3,6 +3,7 @@ package service import ( "crypto/ecdsa" + "github.com/gogo/protobuf/proto" "github.com/nspcc-dev/neofs-api-go/internal" crypto "github.com/nspcc-dev/neofs-crypto" ) @@ -104,6 +105,13 @@ func (t testCustomField) MarshalTo(data []byte) (int, error) { return 0, nil } // Marshal skip, it's for test usage only. func (t testCustomField) Marshal() ([]byte, error) { return nil, nil } +// Merge used by proto.Clone +func (t *testCustomField) Merge(src proto.Message) { + if tmp, ok := src.(*testCustomField); ok { + *t = *tmp + } +} + // GetBearerToken wraps Bearer field and return BearerToken interface. // // If Bearer field value is nil, nil returns. From 1dd4d48b5f8057cfc69df599403d4087fe61cf35 Mon Sep 17 00:00:00 2001 From: Pavel Korotkov Date: Tue, 7 Jul 2020 18:13:56 +0300 Subject: [PATCH 0244/1196] alc: add a rich functionality to manage Extended ACL --- acl/action.go | 38 ++ acl/action_test.go | 76 +++ acl/extended.go | 120 ++++ acl/header.go | 290 +++++++++ acl/headers_test.go | 59 ++ acl/match.go | 29 + acl/match_test.go | 44 ++ acl/types.go | 56 ++ acl/types.pb.go | 1350 +++++++++++++++++++++++++++++++++++++++++- acl/types.proto | 79 +++ acl/wrappers.go | 498 ++++++++++++++++ acl/wrappers_test.go | 139 +++++ 12 files changed, 2763 insertions(+), 15 deletions(-) create mode 100644 acl/action.go create mode 100644 acl/action_test.go create mode 100644 acl/extended.go create mode 100644 acl/header.go create mode 100644 acl/headers_test.go create mode 100644 acl/match.go create mode 100644 acl/match_test.go create mode 100644 acl/types.go create mode 100644 acl/wrappers.go create mode 100644 acl/wrappers_test.go diff --git a/acl/action.go b/acl/action.go new file mode 100644 index 0000000..b2986e2 --- /dev/null +++ b/acl/action.go @@ -0,0 +1,38 @@ +package acl + +// RequestInfo is an interface of request information needed for extended ACL check. +type RequestInfo interface { + TypedHeaderSource + + // Must return the binary representation of request initiator's key. + Key() []byte + + // Must return true if request corresponds to operation type. + TypeOf(OperationType) bool + + // Must return true if request has passed target. + TargetOf(Target) bool +} + +// ExtendedACLChecker is an interface of extended ACL checking tool. +type ExtendedACLChecker interface { + // Must return an action according to the results of applying the ACL table rules to request. + // + // Must return ActionUndefined if it is unable to explicitly calculate the action. + Action(ExtendedACLTable, RequestInfo) ExtendedACLAction +} + +type extendedACLChecker struct{} + +const ( + // ActionUndefined is ExtendedACLAction used to mark value as undefined. + // Most of the tools consider ActionUndefined as incalculable. + // Using ActionUndefined in ExtendedACLRecord is unsafe. + ActionUndefined ExtendedACLAction = iota + + // ActionAllow is ExtendedACLAction used to mark an applicability of ACL rule. + ActionAllow + + // ActionDeny is ExtendedACLAction used to mark an inapplicability of ACL rule. + ActionDeny +) diff --git a/acl/action_test.go b/acl/action_test.go new file mode 100644 index 0000000..83022e3 --- /dev/null +++ b/acl/action_test.go @@ -0,0 +1,76 @@ +package acl + +type testExtendedACLTable struct { + records []ExtendedACLRecord +} + +type testRequestInfo struct { + headers []TypedHeader + key []byte + opType OperationType + target Target +} + +type testEACLRecord struct { + opType OperationType + filters []HeaderFilter + targets []ExtendedACLTarget + action ExtendedACLAction +} + +type testEACLTarget struct { + target Target + keys [][]byte +} + +func (s testEACLTarget) Target() Target { + return s.target +} + +func (s testEACLTarget) KeyList() [][]byte { + return s.keys +} + +func (s testEACLRecord) OperationType() OperationType { + return s.opType +} + +func (s testEACLRecord) HeaderFilters() []HeaderFilter { + return s.filters +} + +func (s testEACLRecord) TargetList() []ExtendedACLTarget { + return s.targets +} + +func (s testEACLRecord) Action() ExtendedACLAction { + return s.action +} + +func (s testRequestInfo) HeadersOfType(typ HeaderType) ([]Header, bool) { + res := make([]Header, 0, len(s.headers)) + + for i := range s.headers { + if s.headers[i].HeaderType() == typ { + res = append(res, s.headers[i]) + } + } + + return res, true +} + +func (s testRequestInfo) Key() []byte { + return s.key +} + +func (s testRequestInfo) TypeOf(t OperationType) bool { + return s.opType == t +} + +func (s testRequestInfo) TargetOf(t Target) bool { + return s.target == t +} + +func (s testExtendedACLTable) Records() []ExtendedACLRecord { + return s.records +} diff --git a/acl/extended.go b/acl/extended.go new file mode 100644 index 0000000..61ccbcf --- /dev/null +++ b/acl/extended.go @@ -0,0 +1,120 @@ +package acl + +import ( + "context" + + "github.com/nspcc-dev/neofs-api-go/refs" +) + +// OperationType is an enumeration of operation types for extended ACL. +type OperationType uint32 + +// HeaderType is an enumeration of header types for extended ACL. +type HeaderType uint32 + +// MatchType is an enumeration of match types for extended ACL. +type MatchType uint32 + +// ExtendedACLAction is an enumeration of extended ACL actions. +type ExtendedACLAction uint32 + +// Header is an interface of string key-value pair, +type Header interface { + // Must return string identifier of header. + Name() string + + // Must return string value of header. + Value() string +} + +// TypedHeader is an interface of Header and HeaderType pair. +type TypedHeader interface { + Header + + // Must return type of filtered header. + HeaderType() HeaderType +} + +// TypedHeaderSource is a various types of header set interface. +type TypedHeaderSource interface { + // Must return list of Header of particular type. + // Must return false if there is no ability to compose header list. + HeadersOfType(HeaderType) ([]Header, bool) +} + +// HeaderFilter is an interface of grouped information about filtered header. +type HeaderFilter interface { + // Must return match type of filter. + MatchType() MatchType + + TypedHeader +} + +// ExtendedACLTarget is an interface of grouped information about extended ACL rule target. +type ExtendedACLTarget interface { + // Must return ACL target type. + Target() Target + + // Must return public key list of ACL targets. + KeyList() [][]byte +} + +// ExtendedACLRecord is an interface of record of extended ACL rule table. +type ExtendedACLRecord interface { + // Must return operation type of extended ACL rule. + OperationType() OperationType + + // Must return list of header filters of extended ACL rule. + HeaderFilters() []HeaderFilter + + // Must return target list of extended ACL rule. + TargetList() []ExtendedACLTarget + + // Must return action of extended ACL rule. + Action() ExtendedACLAction +} + +// ExtendedACLTable is an interface of extended ACL table. +type ExtendedACLTable interface { + // Must return list of extended ACL rules. + Records() []ExtendedACLRecord +} + +// ExtendedACLSource is an interface of storage of extended ACL tables with read access. +type ExtendedACLSource interface { + // Must return extended ACL table by container ID key. + GetExtendedACLTable(context.Context, refs.CID) (ExtendedACLTable, error) +} + +// ExtendedACLStore is an interface of storage of extended ACL tables. +type ExtendedACLStore interface { + ExtendedACLSource + + // Must store extended ACL table for container ID key. + PutExtendedACLTable(context.Context, refs.CID, ExtendedACLTable) error +} + +const ( + _ OperationType = iota + + // OpTypeGet is an OperationType for object.Get RPC + OpTypeGet + + // OpTypePut is an OperationType for object.Put RPC + OpTypePut + + // OpTypeHead is an OperationType for object.Head RPC + OpTypeHead + + // OpTypeSearch is an OperationType for object.Search RPC + OpTypeSearch + + // OpTypeDelete is an OperationType for object.Delete RPC + OpTypeDelete + + // OpTypeRange is an OperationType for object.GetRange RPC + OpTypeRange + + // OpTypeRangeHash is an OperationType for object.GetRangeHash RPC + OpTypeRangeHash +) diff --git a/acl/header.go b/acl/header.go new file mode 100644 index 0000000..9dff79e --- /dev/null +++ b/acl/header.go @@ -0,0 +1,290 @@ +package acl + +import ( + "strconv" + + "github.com/nspcc-dev/neofs-api-go/object" + "github.com/nspcc-dev/neofs-api-go/service" +) + +type objectHeaderSource struct { + obj *object.Object +} + +type typedHeader struct { + n string + v string + t HeaderType +} + +type extendedHeadersWrapper struct { + hdrSrc service.ExtendedHeadersSource +} + +type typedExtendedHeader struct { + hdr service.ExtendedHeader +} + +const ( + _ HeaderType = iota + + // HdrTypeRequest is a HeaderType for request header. + HdrTypeRequest + + // HdrTypeObjSys is a HeaderType for system headers of object. + HdrTypeObjSys + + // HdrTypeObjUsr is a HeaderType for user headers of object. + HdrTypeObjUsr +) + +const ( + // HdrObjSysNameID is a name of ID field in system header of object. + HdrObjSysNameID = "ID" + + // HdrObjSysNameCID is a name of CID field in system header of object. + HdrObjSysNameCID = "CID" + + // HdrObjSysNameOwnerID is a name of OwnerID field in system header of object. + HdrObjSysNameOwnerID = "OWNER_ID" + + // HdrObjSysNameVersion is a name of Version field in system header of object. + HdrObjSysNameVersion = "VERSION" + + // HdrObjSysNamePayloadLength is a name of PayloadLength field in system header of object. + HdrObjSysNamePayloadLength = "PAYLOAD_LENGTH" + + // HdrObjSysNameCreatedUnix is a name of CreatedAt.UnitTime field in system header of object. + HdrObjSysNameCreatedUnix = "CREATED_UNIX" + + // HdrObjSysNameCreatedEpoch is a name of CreatedAt.Epoch field in system header of object. + HdrObjSysNameCreatedEpoch = "CREATED_EPOCH" + + // HdrObjSysLinkPrev is a name of previous link header in extended headers of object. + HdrObjSysLinkPrev = "LINK_PREV" + + // HdrObjSysLinkNext is a name of next link header in extended headers of object. + HdrObjSysLinkNext = "LINK_NEXT" + + // HdrObjSysLinkChild is a name of child link header in extended headers of object. + HdrObjSysLinkChild = "LINK_CHILD" + + // HdrObjSysLinkPar is a name of parent link header in extended headers of object. + HdrObjSysLinkPar = "LINK_PAR" + + // HdrObjSysLinkSG is a name of storage group link header in extended headers of object. + HdrObjSysLinkSG = "LINK_SG" +) + +func newTypedHeader(name, value string, typ HeaderType) TypedHeader { + return &typedHeader{ + n: name, + v: value, + t: typ, + } +} + +// Name is a name field getter. +func (s typedHeader) Name() string { + return s.n +} + +// Value is a value field getter. +func (s typedHeader) Value() string { + return s.v +} + +// HeaderType is a type field getter. +func (s typedHeader) HeaderType() HeaderType { + return s.t +} + +// TypedHeaderSourceFromObject wraps passed object and returns TypedHeaderSource interface. +func TypedHeaderSourceFromObject(obj *object.Object) TypedHeaderSource { + return &objectHeaderSource{ + obj: obj, + } +} + +// HeaderOfType gathers object headers of passed type and returns Header list. +// +// If value of some header can not be calculated (e.g. nil extended header), it does not appear in list. +// +// Always returns true. +func (s objectHeaderSource) HeadersOfType(typ HeaderType) ([]Header, bool) { + if s.obj == nil { + return nil, true + } + + var res []Header + + switch typ { + case HdrTypeObjUsr: + objHeaders := s.obj.GetHeaders() + + res = make([]Header, 0, len(objHeaders)) // 7 system header fields + + for _, extHdr := range objHeaders { + if h := newTypedObjectExtendedHeader(extHdr); h != nil { + res = append(res, h) + } + } + case HdrTypeObjSys: + res = make([]Header, 0, 7) + + sysHdr := s.obj.GetSystemHeader() + + // ID + res = append(res, newTypedHeader( + HdrObjSysNameID, + sysHdr.ID.String(), + HdrTypeObjSys), + ) + + // CID + res = append(res, newTypedHeader( + HdrObjSysNameCID, + sysHdr.CID.String(), + HdrTypeObjSys), + ) + + // OwnerID + res = append(res, newTypedHeader( + HdrObjSysNameOwnerID, + sysHdr.OwnerID.String(), + HdrTypeObjSys), + ) + + // Version + res = append(res, newTypedHeader( + HdrObjSysNameVersion, + strconv.FormatUint(sysHdr.GetVersion(), 10), + HdrTypeObjSys), + ) + + // PayloadLength + res = append(res, newTypedHeader( + HdrObjSysNamePayloadLength, + strconv.FormatUint(sysHdr.GetPayloadLength(), 10), + HdrTypeObjSys), + ) + + created := sysHdr.GetCreatedAt() + + // CreatedAt.UnitTime + res = append(res, newTypedHeader( + HdrObjSysNameCreatedUnix, + strconv.FormatUint(uint64(created.GetUnixTime()), 10), + HdrTypeObjSys), + ) + + // CreatedAt.Epoch + res = append(res, newTypedHeader( + HdrObjSysNameCreatedEpoch, + strconv.FormatUint(created.GetEpoch(), 10), + HdrTypeObjSys), + ) + } + + return res, true +} + +func newTypedObjectExtendedHeader(h object.Header) TypedHeader { + val := h.GetValue() + if val == nil { + return nil + } + + res := new(typedHeader) + res.t = HdrTypeObjSys + + switch hdr := val.(type) { + case *object.Header_UserHeader: + if hdr.UserHeader == nil { + return nil + } + + res.t = HdrTypeObjUsr + res.n = hdr.UserHeader.GetKey() + res.v = hdr.UserHeader.GetValue() + case *object.Header_Link: + if hdr.Link == nil { + return nil + } + + switch hdr.Link.GetType() { + case object.Link_Previous: + res.n = HdrObjSysLinkPrev + case object.Link_Next: + res.n = HdrObjSysLinkNext + case object.Link_Child: + res.n = HdrObjSysLinkChild + case object.Link_Parent: + res.n = HdrObjSysLinkPar + case object.Link_StorageGroup: + res.n = HdrObjSysLinkSG + default: + return nil + } + + res.v = hdr.Link.ID.String() + default: + return nil + } + + return res +} + +// TypedHeaderSourceFromExtendedHeaders wraps passed ExtendedHeadersSource and returns TypedHeaderSource interface. +func TypedHeaderSourceFromExtendedHeaders(hdrSrc service.ExtendedHeadersSource) TypedHeaderSource { + return &extendedHeadersWrapper{ + hdrSrc: hdrSrc, + } +} + +// Name returns the result of Key method. +func (s typedExtendedHeader) Name() string { + return s.hdr.Key() +} + +// Value returns the result of Value method. +func (s typedExtendedHeader) Value() string { + return s.hdr.Value() +} + +// HeaderType always returns HdrTypeRequest. +func (s typedExtendedHeader) HeaderType() HeaderType { + return HdrTypeRequest +} + +// TypedHeaders gathers extended request headers and returns TypedHeader list. +// +// Nil headers are ignored. +// +// Always returns true. +func (s extendedHeadersWrapper) HeadersOfType(typ HeaderType) ([]Header, bool) { + if s.hdrSrc == nil { + return nil, true + } + + var res []Header + + switch typ { + case HdrTypeRequest: + hs := s.hdrSrc.ExtendedHeaders() + + res = make([]Header, 0, len(hs)) + + for i := range hs { + if hs[i] == nil { + continue + } + + res = append(res, &typedExtendedHeader{ + hdr: hs[i], + }) + } + } + + return res, true +} diff --git a/acl/headers_test.go b/acl/headers_test.go new file mode 100644 index 0000000..500d9a4 --- /dev/null +++ b/acl/headers_test.go @@ -0,0 +1,59 @@ +package acl + +import ( + "testing" + + "github.com/nspcc-dev/neofs-api-go/object" + "github.com/stretchr/testify/require" +) + +func TestNewTypedObjectExtendedHeader(t *testing.T) { + var res TypedHeader + + hdr := object.Header{} + + // nil value + require.Nil(t, newTypedObjectExtendedHeader(hdr)) + + // UserHeader + { + key := "key" + val := "val" + hdr.Value = &object.Header_UserHeader{ + UserHeader: &object.UserHeader{ + Key: key, + Value: val, + }, + } + + res = newTypedObjectExtendedHeader(hdr) + require.Equal(t, HdrTypeObjUsr, res.HeaderType()) + require.Equal(t, key, res.Name()) + require.Equal(t, val, res.Value()) + } + + { // Link + link := new(object.Link) + link.ID = object.ID{1, 2, 3} + + hdr.Value = &object.Header_Link{ + Link: link, + } + + check := func(lt object.Link_Type, name string) { + link.Type = lt + + res = newTypedObjectExtendedHeader(hdr) + + require.Equal(t, HdrTypeObjSys, res.HeaderType()) + require.Equal(t, name, res.Name()) + require.Equal(t, link.ID.String(), res.Value()) + } + + check(object.Link_Previous, HdrObjSysLinkPrev) + check(object.Link_Next, HdrObjSysLinkNext) + check(object.Link_Parent, HdrObjSysLinkPar) + check(object.Link_Child, HdrObjSysLinkChild) + check(object.Link_StorageGroup, HdrObjSysLinkSG) + } +} diff --git a/acl/match.go b/acl/match.go new file mode 100644 index 0000000..bddee89 --- /dev/null +++ b/acl/match.go @@ -0,0 +1,29 @@ +package acl + +const ( + _ MatchType = iota + StringEqual + StringNotEqual +) + +// Maps MatchType to corresponding function. +// 1st argument of function - header value, 2nd - header filter. +var mMatchFns = map[MatchType]func(Header, Header) bool{ + StringEqual: stringEqual, + + StringNotEqual: stringNotEqual, +} + +const ( + mResUndefined = iota + mResMatch + mResMismatch +) + +func stringEqual(header, filter Header) bool { + return header.Value() == filter.Value() +} + +func stringNotEqual(header, filter Header) bool { + return header.Value() != filter.Value() +} diff --git a/acl/match_test.go b/acl/match_test.go new file mode 100644 index 0000000..6975722 --- /dev/null +++ b/acl/match_test.go @@ -0,0 +1,44 @@ +package acl + +type testTypedHeader struct { + t HeaderType + k string + v string +} + +type testHeaderSrc struct { + hs []TypedHeader +} + +type testHeaderFilter struct { + TypedHeader + t MatchType +} + +func (s testHeaderFilter) MatchType() MatchType { + return s.t +} + +func (s testHeaderSrc) HeadersOfType(typ HeaderType) ([]Header, bool) { + res := make([]Header, 0, len(s.hs)) + + for i := range s.hs { + if s.hs[i].HeaderType() == typ { + res = append(res, s.hs[i]) + } + } + + return res, true +} + +func (s testTypedHeader) Name() string { + return s.k +} + +func (s testTypedHeader) Value() string { + return s.v +} + +func (s testTypedHeader) HeaderType() HeaderType { + return s.t +} diff --git a/acl/types.go b/acl/types.go new file mode 100644 index 0000000..0587b9b --- /dev/null +++ b/acl/types.go @@ -0,0 +1,56 @@ +package acl + +// SetMatchType is MatchType field setter. +func (m *EACLRecord_FilterInfo) SetMatchType(v EACLRecord_FilterInfo_MatchType) { + m.MatchType = v +} + +// SetHeader is a Header field setter. +func (m *EACLRecord_FilterInfo) SetHeader(v EACLRecord_FilterInfo_Header) { + m.Header = v +} + +// SetHeaderName is a HeaderName field setter. +func (m *EACLRecord_FilterInfo) SetHeaderName(v string) { + m.HeaderName = v +} + +// SetHeaderVal is a HeaderVal field setter. +func (m *EACLRecord_FilterInfo) SetHeaderVal(v string) { + m.HeaderVal = v +} + +// SetTarget is a Target field setter. +func (m *EACLRecord_TargetInfo) SetTarget(v Target) { + m.Target = v +} + +// SetKeyList is a KeyList field setter. +func (m *EACLRecord_TargetInfo) SetKeyList(v [][]byte) { + m.KeyList = v +} + +// SetOperation is an Operation field setter. +func (m *EACLRecord) SetOperation(v EACLRecord_Operation) { + m.Operation = v +} + +// SetAction is an Action field setter. +func (m *EACLRecord) SetAction(v EACLRecord_Action) { + m.Action = v +} + +// SetFilters is a Filters field setter. +func (m *EACLRecord) SetFilters(v []*EACLRecord_FilterInfo) { + m.Filters = v +} + +// SetTargets is a Targets field setter. +func (m *EACLRecord) SetTargets(v []*EACLRecord_TargetInfo) { + m.Targets = v +} + +// SetRecords is a Records field setter. +func (m *EACLTable) SetRecords(v []*EACLRecord) { + m.Records = v +} diff --git a/acl/types.pb.go b/acl/types.pb.go index bcbd199..24ecf28 100644 --- a/acl/types.pb.go +++ b/acl/types.pb.go @@ -7,7 +7,9 @@ import ( fmt "fmt" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/golang/protobuf/proto" + io "io" math "math" + math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. @@ -63,26 +65,1344 @@ func (Target) EnumDescriptor() ([]byte, []int) { return fileDescriptor_9b63aff5f3a35e32, []int{0} } +// Operation is an enumeration of operation types. +type EACLRecord_Operation int32 + +const ( + EACLRecord_OPERATION_UNKNOWN EACLRecord_Operation = 0 + EACLRecord_GET EACLRecord_Operation = 1 + EACLRecord_HEAD EACLRecord_Operation = 2 + EACLRecord_PUT EACLRecord_Operation = 3 + EACLRecord_DELETE EACLRecord_Operation = 4 + EACLRecord_SEARCH EACLRecord_Operation = 5 + EACLRecord_GETRANGE EACLRecord_Operation = 6 + EACLRecord_GETRANGEHASH EACLRecord_Operation = 7 +) + +var EACLRecord_Operation_name = map[int32]string{ + 0: "OPERATION_UNKNOWN", + 1: "GET", + 2: "HEAD", + 3: "PUT", + 4: "DELETE", + 5: "SEARCH", + 6: "GETRANGE", + 7: "GETRANGEHASH", +} + +var EACLRecord_Operation_value = map[string]int32{ + "OPERATION_UNKNOWN": 0, + "GET": 1, + "HEAD": 2, + "PUT": 3, + "DELETE": 4, + "SEARCH": 5, + "GETRANGE": 6, + "GETRANGEHASH": 7, +} + +func (x EACLRecord_Operation) String() string { + return proto.EnumName(EACLRecord_Operation_name, int32(x)) +} + +func (EACLRecord_Operation) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_9b63aff5f3a35e32, []int{0, 0} +} + +// Action is an enumeration of EACL actions. +type EACLRecord_Action int32 + +const ( + EACLRecord_ActionUnknown EACLRecord_Action = 0 + EACLRecord_Allow EACLRecord_Action = 1 + EACLRecord_Deny EACLRecord_Action = 2 +) + +var EACLRecord_Action_name = map[int32]string{ + 0: "ActionUnknown", + 1: "Allow", + 2: "Deny", +} + +var EACLRecord_Action_value = map[string]int32{ + "ActionUnknown": 0, + "Allow": 1, + "Deny": 2, +} + +func (x EACLRecord_Action) String() string { + return proto.EnumName(EACLRecord_Action_name, int32(x)) +} + +func (EACLRecord_Action) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_9b63aff5f3a35e32, []int{0, 1} +} + +// Header is an enumeration of filtering header types. +type EACLRecord_FilterInfo_Header int32 + +const ( + EACLRecord_FilterInfo_HeaderUnknown EACLRecord_FilterInfo_Header = 0 + EACLRecord_FilterInfo_Request EACLRecord_FilterInfo_Header = 1 + EACLRecord_FilterInfo_ObjectSystem EACLRecord_FilterInfo_Header = 2 + EACLRecord_FilterInfo_ObjectUser EACLRecord_FilterInfo_Header = 3 +) + +var EACLRecord_FilterInfo_Header_name = map[int32]string{ + 0: "HeaderUnknown", + 1: "Request", + 2: "ObjectSystem", + 3: "ObjectUser", +} + +var EACLRecord_FilterInfo_Header_value = map[string]int32{ + "HeaderUnknown": 0, + "Request": 1, + "ObjectSystem": 2, + "ObjectUser": 3, +} + +func (x EACLRecord_FilterInfo_Header) String() string { + return proto.EnumName(EACLRecord_FilterInfo_Header_name, int32(x)) +} + +func (EACLRecord_FilterInfo_Header) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_9b63aff5f3a35e32, []int{0, 0, 0} +} + +// MatchType is an enumeration of match types. +type EACLRecord_FilterInfo_MatchType int32 + +const ( + EACLRecord_FilterInfo_MatchUnknown EACLRecord_FilterInfo_MatchType = 0 + EACLRecord_FilterInfo_StringEqual EACLRecord_FilterInfo_MatchType = 1 + EACLRecord_FilterInfo_StringNotEqual EACLRecord_FilterInfo_MatchType = 2 +) + +var EACLRecord_FilterInfo_MatchType_name = map[int32]string{ + 0: "MatchUnknown", + 1: "StringEqual", + 2: "StringNotEqual", +} + +var EACLRecord_FilterInfo_MatchType_value = map[string]int32{ + "MatchUnknown": 0, + "StringEqual": 1, + "StringNotEqual": 2, +} + +func (x EACLRecord_FilterInfo_MatchType) String() string { + return proto.EnumName(EACLRecord_FilterInfo_MatchType_name, int32(x)) +} + +func (EACLRecord_FilterInfo_MatchType) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_9b63aff5f3a35e32, []int{0, 0, 1} +} + +// EACLRecord groups information about extended ACL rule. +type EACLRecord struct { + // Operation carries type of operation. + Operation EACLRecord_Operation `protobuf:"varint,1,opt,name=operation,json=Operation,proto3,enum=acl.EACLRecord_Operation" json:"operation,omitempty"` + // Action carries ACL target action. + Action EACLRecord_Action `protobuf:"varint,2,opt,name=action,json=Action,proto3,enum=acl.EACLRecord_Action" json:"action,omitempty"` + // Filters carries set of filters. + Filters []*EACLRecord_FilterInfo `protobuf:"bytes,3,rep,name=Filters,proto3" json:"Filters,omitempty"` + // Targets carries information about extended ACL target list. + Targets []*EACLRecord_TargetInfo `protobuf:"bytes,4,rep,name=Targets,proto3" json:"Targets,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *EACLRecord) Reset() { *m = EACLRecord{} } +func (m *EACLRecord) String() string { return proto.CompactTextString(m) } +func (*EACLRecord) ProtoMessage() {} +func (*EACLRecord) Descriptor() ([]byte, []int) { + return fileDescriptor_9b63aff5f3a35e32, []int{0} +} +func (m *EACLRecord) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EACLRecord) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *EACLRecord) XXX_Merge(src proto.Message) { + xxx_messageInfo_EACLRecord.Merge(m, src) +} +func (m *EACLRecord) XXX_Size() int { + return m.Size() +} +func (m *EACLRecord) XXX_DiscardUnknown() { + xxx_messageInfo_EACLRecord.DiscardUnknown(m) +} + +var xxx_messageInfo_EACLRecord proto.InternalMessageInfo + +func (m *EACLRecord) GetOperation() EACLRecord_Operation { + if m != nil { + return m.Operation + } + return EACLRecord_OPERATION_UNKNOWN +} + +func (m *EACLRecord) GetAction() EACLRecord_Action { + if m != nil { + return m.Action + } + return EACLRecord_ActionUnknown +} + +func (m *EACLRecord) GetFilters() []*EACLRecord_FilterInfo { + if m != nil { + return m.Filters + } + return nil +} + +func (m *EACLRecord) GetTargets() []*EACLRecord_TargetInfo { + if m != nil { + return m.Targets + } + return nil +} + +// FilterInfo groups information about filter. +type EACLRecord_FilterInfo struct { + // Header carries type of header. + Header EACLRecord_FilterInfo_Header `protobuf:"varint,1,opt,name=header,json=HeaderType,proto3,enum=acl.EACLRecord_FilterInfo_Header" json:"header,omitempty"` + // MatchType carries type of match. + MatchType EACLRecord_FilterInfo_MatchType `protobuf:"varint,2,opt,name=matchType,json=MatchType,proto3,enum=acl.EACLRecord_FilterInfo_MatchType" json:"matchType,omitempty"` + // HeaderName carries name of filtering header. + HeaderName string `protobuf:"bytes,3,opt,name=HeaderName,json=Name,proto3" json:"HeaderName,omitempty"` + // HeaderVal carries value of filtering header. + HeaderVal string `protobuf:"bytes,4,opt,name=HeaderVal,json=Value,proto3" json:"HeaderVal,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *EACLRecord_FilterInfo) Reset() { *m = EACLRecord_FilterInfo{} } +func (m *EACLRecord_FilterInfo) String() string { return proto.CompactTextString(m) } +func (*EACLRecord_FilterInfo) ProtoMessage() {} +func (*EACLRecord_FilterInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_9b63aff5f3a35e32, []int{0, 0} +} +func (m *EACLRecord_FilterInfo) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EACLRecord_FilterInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *EACLRecord_FilterInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_EACLRecord_FilterInfo.Merge(m, src) +} +func (m *EACLRecord_FilterInfo) XXX_Size() int { + return m.Size() +} +func (m *EACLRecord_FilterInfo) XXX_DiscardUnknown() { + xxx_messageInfo_EACLRecord_FilterInfo.DiscardUnknown(m) +} + +var xxx_messageInfo_EACLRecord_FilterInfo proto.InternalMessageInfo + +func (m *EACLRecord_FilterInfo) GetHeader() EACLRecord_FilterInfo_Header { + if m != nil { + return m.Header + } + return EACLRecord_FilterInfo_HeaderUnknown +} + +func (m *EACLRecord_FilterInfo) GetMatchType() EACLRecord_FilterInfo_MatchType { + if m != nil { + return m.MatchType + } + return EACLRecord_FilterInfo_MatchUnknown +} + +func (m *EACLRecord_FilterInfo) GetHeaderName() string { + if m != nil { + return m.HeaderName + } + return "" +} + +func (m *EACLRecord_FilterInfo) GetHeaderVal() string { + if m != nil { + return m.HeaderVal + } + return "" +} + +// TargetInfo groups information about extended ACL target. +type EACLRecord_TargetInfo struct { + // Target carries target of ACL rule. + Target Target `protobuf:"varint,1,opt,name=Target,json=Role,proto3,enum=acl.Target" json:"Target,omitempty"` + // KeyList carries public keys of ACL target. + KeyList [][]byte `protobuf:"bytes,2,rep,name=KeyList,json=Keys,proto3" json:"KeyList,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *EACLRecord_TargetInfo) Reset() { *m = EACLRecord_TargetInfo{} } +func (m *EACLRecord_TargetInfo) String() string { return proto.CompactTextString(m) } +func (*EACLRecord_TargetInfo) ProtoMessage() {} +func (*EACLRecord_TargetInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_9b63aff5f3a35e32, []int{0, 1} +} +func (m *EACLRecord_TargetInfo) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EACLRecord_TargetInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *EACLRecord_TargetInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_EACLRecord_TargetInfo.Merge(m, src) +} +func (m *EACLRecord_TargetInfo) XXX_Size() int { + return m.Size() +} +func (m *EACLRecord_TargetInfo) XXX_DiscardUnknown() { + xxx_messageInfo_EACLRecord_TargetInfo.DiscardUnknown(m) +} + +var xxx_messageInfo_EACLRecord_TargetInfo proto.InternalMessageInfo + +func (m *EACLRecord_TargetInfo) GetTarget() Target { + if m != nil { + return m.Target + } + return Target_Unknown +} + +func (m *EACLRecord_TargetInfo) GetKeyList() [][]byte { + if m != nil { + return m.KeyList + } + return nil +} + +// EACLRecord carries the information about extended ACL rules. +type EACLTable struct { + // Records carries list of extended ACL rule records. + Records []*EACLRecord `protobuf:"bytes,1,rep,name=Records,proto3" json:"Records,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *EACLTable) Reset() { *m = EACLTable{} } +func (m *EACLTable) String() string { return proto.CompactTextString(m) } +func (*EACLTable) ProtoMessage() {} +func (*EACLTable) Descriptor() ([]byte, []int) { + return fileDescriptor_9b63aff5f3a35e32, []int{1} +} +func (m *EACLTable) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EACLTable) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *EACLTable) XXX_Merge(src proto.Message) { + xxx_messageInfo_EACLTable.Merge(m, src) +} +func (m *EACLTable) XXX_Size() int { + return m.Size() +} +func (m *EACLTable) XXX_DiscardUnknown() { + xxx_messageInfo_EACLTable.DiscardUnknown(m) +} + +var xxx_messageInfo_EACLTable proto.InternalMessageInfo + +func (m *EACLTable) GetRecords() []*EACLRecord { + if m != nil { + return m.Records + } + return nil +} + func init() { proto.RegisterEnum("acl.Target", Target_name, Target_value) + proto.RegisterEnum("acl.EACLRecord_Operation", EACLRecord_Operation_name, EACLRecord_Operation_value) + proto.RegisterEnum("acl.EACLRecord_Action", EACLRecord_Action_name, EACLRecord_Action_value) + proto.RegisterEnum("acl.EACLRecord_FilterInfo_Header", EACLRecord_FilterInfo_Header_name, EACLRecord_FilterInfo_Header_value) + proto.RegisterEnum("acl.EACLRecord_FilterInfo_MatchType", EACLRecord_FilterInfo_MatchType_name, EACLRecord_FilterInfo_MatchType_value) + proto.RegisterType((*EACLRecord)(nil), "acl.EACLRecord") + proto.RegisterType((*EACLRecord_FilterInfo)(nil), "acl.EACLRecord.FilterInfo") + proto.RegisterType((*EACLRecord_TargetInfo)(nil), "acl.EACLRecord.TargetInfo") + proto.RegisterType((*EACLTable)(nil), "acl.EACLTable") } func init() { proto.RegisterFile("acl/types.proto", fileDescriptor_9b63aff5f3a35e32) } var fileDescriptor_9b63aff5f3a35e32 = []byte{ - // 216 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x4f, 0x4c, 0xce, 0xd1, - 0x2f, 0xa9, 0x2c, 0x48, 0x2d, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x4e, 0x4c, 0xce, - 0x91, 0xd2, 0x4d, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x4f, 0xcf, 0x4f, - 0xcf, 0xd7, 0x07, 0xcb, 0x25, 0x95, 0xa6, 0x81, 0x79, 0x60, 0x0e, 0x98, 0x05, 0xd1, 0xa3, 0xe5, - 0xcc, 0xc5, 0x16, 0x92, 0x58, 0x94, 0x9e, 0x5a, 0x22, 0xc4, 0xcd, 0xc5, 0x1e, 0x9a, 0x97, 0x9d, - 0x97, 0x5f, 0x9e, 0x27, 0xc0, 0x20, 0xc4, 0xc1, 0xc5, 0x12, 0x5a, 0x9c, 0x5a, 0x24, 0xc0, 0x28, - 0xc4, 0xc5, 0xc5, 0x16, 0x5c, 0x59, 0x5c, 0x92, 0x9a, 0x2b, 0xc0, 0x04, 0x62, 0xfb, 0x97, 0x64, - 0xa4, 0x16, 0x15, 0x0b, 0x30, 0x83, 0xd8, 0x01, 0xa5, 0x49, 0xde, 0xa9, 0x95, 0x02, 0x2c, 0x4e, - 0xde, 0x27, 0x1e, 0xc9, 0x31, 0x5e, 0x78, 0x24, 0xc7, 0x78, 0xe3, 0x91, 0x1c, 0xe3, 0x83, 0x47, - 0x72, 0x8c, 0x33, 0x1e, 0xcb, 0x31, 0x44, 0xa9, 0x22, 0xb9, 0x24, 0xaf, 0xb8, 0x20, 0x39, 0x59, - 0x37, 0x25, 0xb5, 0x4c, 0x3f, 0x2f, 0x35, 0x3f, 0xad, 0x58, 0x37, 0xb1, 0x20, 0x53, 0x37, 0x3d, - 0x5f, 0x3f, 0x31, 0x39, 0x67, 0x15, 0x13, 0xaf, 0x5f, 0x6a, 0xbe, 0x5b, 0xb0, 0x9e, 0x63, 0x80, - 0xa7, 0x9e, 0x63, 0x72, 0x4e, 0x12, 0x1b, 0xd8, 0x61, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, - 0xb3, 0xda, 0x09, 0x81, 0xdf, 0x00, 0x00, 0x00, + // 676 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x54, 0xcd, 0x6e, 0xda, 0x58, + 0x14, 0x8e, 0x7f, 0x62, 0xc2, 0x01, 0x92, 0x9b, 0x2b, 0x65, 0xe4, 0x61, 0x41, 0x08, 0x9a, 0x91, + 0x98, 0x91, 0x30, 0xa3, 0x4c, 0xd5, 0x45, 0x77, 0x26, 0x31, 0x81, 0x92, 0x1a, 0x6a, 0x4c, 0x2a, + 0x75, 0x53, 0x5d, 0x9c, 0x1b, 0xa0, 0x35, 0xbe, 0xc4, 0x36, 0x89, 0x78, 0x93, 0x3e, 0x43, 0x9f, + 0xa4, 0xcb, 0x2e, 0xbb, 0x4a, 0x2b, 0xba, 0xef, 0x33, 0x54, 0xbe, 0x17, 0xc7, 0x51, 0xd4, 0x76, + 0xe5, 0xef, 0x3b, 0xbf, 0xf7, 0x7c, 0xe7, 0xc8, 0xb0, 0x47, 0x3c, 0xbf, 0x19, 0xaf, 0x16, 0x34, + 0x32, 0x16, 0x21, 0x8b, 0x19, 0x56, 0x88, 0xe7, 0x97, 0x1b, 0x93, 0x59, 0x3c, 0x5d, 0x8e, 0x0d, + 0x8f, 0xcd, 0x9b, 0x13, 0x36, 0x61, 0x4d, 0xee, 0x1b, 0x2f, 0xaf, 0x38, 0xe3, 0x84, 0x23, 0x91, + 0x53, 0xfb, 0xa2, 0x01, 0x58, 0xe6, 0xc9, 0xb9, 0x43, 0x3d, 0x16, 0x5e, 0xe2, 0x36, 0xe4, 0xd9, + 0x82, 0x86, 0x24, 0x9e, 0xb1, 0x40, 0x97, 0xaa, 0x52, 0x7d, 0xf7, 0xf8, 0x4f, 0x83, 0x78, 0xbe, + 0x91, 0xc5, 0x18, 0xfd, 0x34, 0xa0, 0x55, 0x5a, 0xdf, 0x1d, 0xe6, 0xef, 0xa9, 0x93, 0x41, 0xfc, + 0x0c, 0x34, 0xe2, 0xf1, 0x22, 0x32, 0x2f, 0xf2, 0xc7, 0xe3, 0x22, 0x26, 0xf7, 0xb6, 0x60, 0x7d, + 0x77, 0xa8, 0x09, 0xec, 0x6c, 0xbe, 0xf8, 0x09, 0xe4, 0xda, 0x33, 0x3f, 0xa6, 0x61, 0xa4, 0x2b, + 0x55, 0xa5, 0x5e, 0x38, 0x2e, 0x3f, 0x4e, 0x16, 0xee, 0x6e, 0x70, 0xc5, 0x9c, 0x34, 0x34, 0xc9, + 0x72, 0x49, 0x38, 0xa1, 0x71, 0xa4, 0xab, 0x3f, 0xcf, 0x12, 0x6e, 0x91, 0xb5, 0x09, 0x2d, 0x7f, + 0x97, 0x01, 0xb2, 0x6a, 0xb8, 0x0b, 0xda, 0x94, 0x92, 0x4b, 0x1a, 0x6e, 0x66, 0x3f, 0xfa, 0x75, + 0x67, 0xa3, 0xc3, 0x03, 0xc5, 0x04, 0x02, 0x3b, 0x20, 0xbe, 0xee, 0x6a, 0x41, 0xf1, 0x4b, 0xc8, + 0xcf, 0x49, 0xec, 0x4d, 0x13, 0xb2, 0x11, 0xe1, 0xaf, 0xdf, 0x54, 0x7b, 0x91, 0xc6, 0x0a, 0x51, + 0xef, 0xa9, 0x93, 0x41, 0xac, 0xc3, 0xa6, 0x81, 0x4d, 0xe6, 0x54, 0x57, 0xaa, 0x52, 0x3d, 0xef, + 0xa8, 0x09, 0xc6, 0x3a, 0xe4, 0x85, 0xe7, 0x82, 0xf8, 0xba, 0xca, 0x1d, 0xdb, 0x17, 0xc4, 0x5f, + 0xd2, 0xda, 0x73, 0xd8, 0x3c, 0x0e, 0xef, 0x43, 0x49, 0xa0, 0x51, 0xf0, 0x2e, 0x60, 0xb7, 0x01, + 0xda, 0xc2, 0x05, 0xc8, 0x39, 0xf4, 0x7a, 0x49, 0xa3, 0x18, 0x49, 0x18, 0x41, 0xb1, 0x3f, 0x7e, + 0x4b, 0xbd, 0x78, 0xb8, 0x8a, 0x62, 0x3a, 0x47, 0x32, 0xde, 0x05, 0x10, 0x96, 0x51, 0x44, 0x43, + 0xa4, 0xd4, 0x5a, 0xf0, 0xe0, 0x31, 0x08, 0x8a, 0x9c, 0x64, 0xd5, 0xf6, 0xa0, 0x30, 0x8c, 0xc3, + 0x59, 0x30, 0xb1, 0xae, 0x97, 0xc4, 0x47, 0x12, 0xc6, 0xb0, 0x2b, 0x0c, 0x36, 0x8b, 0x85, 0x4d, + 0x2e, 0xb7, 0x01, 0xb2, 0x3d, 0xe0, 0x23, 0xd0, 0x04, 0xdb, 0xe8, 0x5d, 0xe0, 0x0a, 0x09, 0x93, + 0xa3, 0x3a, 0xcc, 0xa7, 0xf8, 0x00, 0x72, 0x3d, 0xba, 0x3a, 0x9f, 0x45, 0xb1, 0x2e, 0x57, 0x95, + 0x7a, 0xd1, 0x51, 0x7b, 0x74, 0x15, 0xd5, 0x6e, 0xe0, 0xc1, 0xb5, 0x1d, 0xc0, 0x7e, 0x7f, 0x60, + 0x39, 0xa6, 0xdb, 0xed, 0xdb, 0x6f, 0x46, 0x76, 0xcf, 0xee, 0xbf, 0xb2, 0xd1, 0x16, 0xce, 0x81, + 0x72, 0x66, 0xb9, 0x48, 0xc2, 0x3b, 0xa0, 0x76, 0x2c, 0xf3, 0x14, 0xc9, 0x89, 0x69, 0x30, 0x72, + 0x91, 0x82, 0x01, 0xb4, 0x53, 0xeb, 0xdc, 0x72, 0x2d, 0xa4, 0x26, 0x78, 0x68, 0x99, 0xce, 0x49, + 0x07, 0x6d, 0xe3, 0x22, 0xec, 0x9c, 0x59, 0xae, 0x63, 0xda, 0x67, 0x16, 0xd2, 0x92, 0x21, 0x53, + 0xd6, 0x31, 0x87, 0x1d, 0x94, 0xab, 0xfd, 0x07, 0xe9, 0x99, 0xee, 0x43, 0x49, 0xa0, 0x4c, 0x81, + 0x3c, 0x6c, 0x9b, 0xbe, 0xcf, 0x6e, 0x45, 0xcb, 0x53, 0x1a, 0xac, 0x90, 0x5c, 0x7b, 0x0a, 0xf9, + 0x64, 0xe5, 0x2e, 0x19, 0xfb, 0x14, 0xff, 0x93, 0x28, 0x9e, 0xec, 0x3e, 0xd2, 0x25, 0x7e, 0xa5, + 0x7b, 0x8f, 0x6e, 0xc2, 0x49, 0xfd, 0xff, 0x9e, 0xa4, 0xda, 0x24, 0x6b, 0xca, 0x7a, 0xec, 0x80, + 0xca, 0xd7, 0x21, 0xf1, 0x67, 0xa7, 0xab, 0x02, 0xd0, 0xfa, 0xf1, 0x94, 0x86, 0x91, 0x18, 0x6d, + 0xb0, 0x1c, 0xf7, 0xe8, 0x0a, 0xa9, 0xad, 0xde, 0xc7, 0x75, 0x45, 0xfa, 0xb4, 0xae, 0x48, 0x9f, + 0xd7, 0x15, 0xe9, 0xeb, 0xba, 0x22, 0xbd, 0xff, 0x56, 0xd9, 0x7a, 0xfd, 0xf7, 0x83, 0x7f, 0x44, + 0x10, 0x2d, 0x3c, 0xaf, 0x71, 0x49, 0x6f, 0x9a, 0x01, 0x65, 0x57, 0x51, 0x83, 0x2c, 0x66, 0x8d, + 0x09, 0x6b, 0x12, 0xcf, 0xff, 0x20, 0x97, 0x6c, 0xca, 0xda, 0x43, 0xc3, 0x1c, 0x74, 0x0d, 0xd3, + 0xf3, 0xc7, 0x1a, 0xff, 0x65, 0xfc, 0xff, 0x23, 0x00, 0x00, 0xff, 0xff, 0x39, 0x7b, 0x27, 0xe6, + 0x79, 0x04, 0x00, 0x00, } + +func (m *EACLRecord) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *EACLRecord) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EACLRecord) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Targets) > 0 { + for iNdEx := len(m.Targets) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Targets[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + } + if len(m.Filters) > 0 { + for iNdEx := len(m.Filters) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Filters[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } + if m.Action != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Action)) + i-- + dAtA[i] = 0x10 + } + if m.Operation != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Operation)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *EACLRecord_FilterInfo) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *EACLRecord_FilterInfo) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EACLRecord_FilterInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.HeaderVal) > 0 { + i -= len(m.HeaderVal) + copy(dAtA[i:], m.HeaderVal) + i = encodeVarintTypes(dAtA, i, uint64(len(m.HeaderVal))) + i-- + dAtA[i] = 0x22 + } + if len(m.HeaderName) > 0 { + i -= len(m.HeaderName) + copy(dAtA[i:], m.HeaderName) + i = encodeVarintTypes(dAtA, i, uint64(len(m.HeaderName))) + i-- + dAtA[i] = 0x1a + } + if m.MatchType != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.MatchType)) + i-- + dAtA[i] = 0x10 + } + if m.Header != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Header)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *EACLRecord_TargetInfo) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *EACLRecord_TargetInfo) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EACLRecord_TargetInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.KeyList) > 0 { + for iNdEx := len(m.KeyList) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.KeyList[iNdEx]) + copy(dAtA[i:], m.KeyList[iNdEx]) + i = encodeVarintTypes(dAtA, i, uint64(len(m.KeyList[iNdEx]))) + i-- + dAtA[i] = 0x12 + } + } + if m.Target != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Target)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *EACLTable) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *EACLTable) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EACLTable) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Records) > 0 { + for iNdEx := len(m.Records) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Records[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func encodeVarintTypes(dAtA []byte, offset int, v uint64) int { + offset -= sovTypes(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *EACLRecord) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Operation != 0 { + n += 1 + sovTypes(uint64(m.Operation)) + } + if m.Action != 0 { + n += 1 + sovTypes(uint64(m.Action)) + } + if len(m.Filters) > 0 { + for _, e := range m.Filters { + l = e.Size() + n += 1 + l + sovTypes(uint64(l)) + } + } + if len(m.Targets) > 0 { + for _, e := range m.Targets { + l = e.Size() + n += 1 + l + sovTypes(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *EACLRecord_FilterInfo) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Header != 0 { + n += 1 + sovTypes(uint64(m.Header)) + } + if m.MatchType != 0 { + n += 1 + sovTypes(uint64(m.MatchType)) + } + l = len(m.HeaderName) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.HeaderVal) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *EACLRecord_TargetInfo) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Target != 0 { + n += 1 + sovTypes(uint64(m.Target)) + } + if len(m.KeyList) > 0 { + for _, b := range m.KeyList { + l = len(b) + n += 1 + l + sovTypes(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *EACLTable) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Records) > 0 { + for _, e := range m.Records { + l = e.Size() + n += 1 + l + sovTypes(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovTypes(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozTypes(x uint64) (n int) { + return sovTypes(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *EACLRecord) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: EACLRecord: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EACLRecord: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Operation", wireType) + } + m.Operation = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Operation |= EACLRecord_Operation(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Action", wireType) + } + m.Action = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Action |= EACLRecord_Action(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Filters", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Filters = append(m.Filters, &EACLRecord_FilterInfo{}) + if err := m.Filters[len(m.Filters)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Targets", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Targets = append(m.Targets, &EACLRecord_TargetInfo{}) + if err := m.Targets[len(m.Targets)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *EACLRecord_FilterInfo) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: FilterInfo: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: FilterInfo: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType) + } + m.Header = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Header |= EACLRecord_FilterInfo_Header(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MatchType", wireType) + } + m.MatchType = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MatchType |= EACLRecord_FilterInfo_MatchType(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field HeaderName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.HeaderName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field HeaderVal", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.HeaderVal = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *EACLRecord_TargetInfo) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: TargetInfo: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TargetInfo: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Target", wireType) + } + m.Target = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Target |= Target(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field KeyList", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.KeyList = append(m.KeyList, make([]byte, postIndex-iNdEx)) + copy(m.KeyList[len(m.KeyList)-1], dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *EACLTable) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: EACLTable: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EACLTable: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Records", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Records = append(m.Records, &EACLRecord{}) + if err := m.Records[len(m.Records)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipTypes(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthTypes + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTypes + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthTypes + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthTypes = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTypes = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTypes = fmt.Errorf("proto: unexpected end of group") +) diff --git a/acl/types.proto b/acl/types.proto index f20423f..6934b36 100644 --- a/acl/types.proto +++ b/acl/types.proto @@ -25,3 +25,82 @@ enum Target { // extended ACL. PubKey = 4; } + +// EACLRecord groups information about extended ACL rule. +message EACLRecord { + // Operation is an enumeration of operation types. + enum Operation { + OPERATION_UNKNOWN = 0; + GET = 1; + HEAD = 2; + PUT = 3; + DELETE = 4; + SEARCH = 5; + GETRANGE = 6; + GETRANGEHASH = 7; + } + + // Operation carries type of operation. + Operation operation = 1 [(gogoproto.customname) = "Operation", json_name="Operation"]; + + // Action is an enumeration of EACL actions. + enum Action { + ActionUnknown = 0; + Allow = 1; + Deny = 2; + } + + // Action carries ACL target action. + Action action = 2 [(gogoproto.customname) = "Action", json_name="Action"]; + + // FilterInfo groups information about filter. + message FilterInfo { + // Header is an enumeration of filtering header types. + enum Header { + HeaderUnknown = 0; + Request = 1; + ObjectSystem = 2; + ObjectUser = 3; + } + + // Header carries type of header. + Header header = 1 [(gogoproto.customname) = "Header", json_name="HeaderType"]; + + // MatchType is an enumeration of match types. + enum MatchType { + MatchUnknown = 0; + StringEqual = 1; + StringNotEqual = 2; + } + + // MatchType carries type of match. + MatchType matchType = 2 [(gogoproto.customname) = "MatchType", json_name="MatchType"]; + + // HeaderName carries name of filtering header. + string HeaderName = 3 [json_name="Name"]; + + // HeaderVal carries value of filtering header. + string HeaderVal = 4 [json_name="Value"]; + } + + // Filters carries set of filters. + repeated FilterInfo Filters = 3 [json_name="Filters"]; + + // TargetInfo groups information about extended ACL target. + message TargetInfo { + // Target carries target of ACL rule. + acl.Target Target = 1 [json_name="Role"]; + + // KeyList carries public keys of ACL target. + repeated bytes KeyList = 2 [json_name="Keys"]; + } + + // Targets carries information about extended ACL target list. + repeated TargetInfo Targets = 4 [json_name="Targets"]; +} + +// EACLRecord carries the information about extended ACL rules. +message EACLTable { + // Records carries list of extended ACL rule records. + repeated EACLRecord Records = 1 [json_name="Records"]; +} \ No newline at end of file diff --git a/acl/wrappers.go b/acl/wrappers.go new file mode 100644 index 0000000..b0481f4 --- /dev/null +++ b/acl/wrappers.go @@ -0,0 +1,498 @@ +package acl + +// EACLFilterWrapper is a wrapper over EACLRecord_FilterInfo pointer. +type EACLFilterWrapper struct { + filter *EACLRecord_FilterInfo +} + +// EACLTargetWrapper is a wrapper over EACLRecord_TargetInfo pointer. +type EACLTargetWrapper struct { + target *EACLRecord_TargetInfo +} + +// EACLRecordWrapper is a wrapper over EACLRecord pointer. +type EACLRecordWrapper struct { + record *EACLRecord +} + +// EACLTableWrapper is a wrapper over EACLTable pointer. +type EACLTableWrapper struct { + table *EACLTable +} + +// WrapFilterInfo wraps EACLRecord_FilterInfo pointer. +// +// If argument is nil, new EACLRecord_FilterInfo is initialized. +func WrapFilterInfo(v *EACLRecord_FilterInfo) EACLFilterWrapper { + if v == nil { + v = new(EACLRecord_FilterInfo) + } + + return EACLFilterWrapper{ + filter: v, + } +} + +// WrapEACLTarget wraps EACLRecord_TargetInfo pointer. +// +// If argument is nil, new EACLRecord_TargetInfo is initialized. +func WrapEACLTarget(v *EACLRecord_TargetInfo) EACLTargetWrapper { + if v == nil { + v = new(EACLRecord_TargetInfo) + } + + return EACLTargetWrapper{ + target: v, + } +} + +// WrapEACLRecord wraps EACLRecord pointer. +// +// If argument is nil, new EACLRecord is initialized. +func WrapEACLRecord(v *EACLRecord) EACLRecordWrapper { + if v == nil { + v = new(EACLRecord) + } + + return EACLRecordWrapper{ + record: v, + } +} + +// WrapEACLTable wraps EACLTable pointer. +// +// If argument is nil, new EACLTable is initialized. +func WrapEACLTable(v *EACLTable) EACLTableWrapper { + if v == nil { + v = new(EACLTable) + } + + return EACLTableWrapper{ + table: v, + } +} + +// MatchType returns casted result of MatchType field getter. +// +// If filter is not initialized, 0 returns. +// +// Returns 0 if MatchType is not one of: +// - EACLRecord_FilterInfo_StringEqual; +// - EACLRecord_FilterInfo_StringNotEqual. +func (s EACLFilterWrapper) MatchType() (res MatchType) { + if s.filter != nil { + switch s.filter.GetMatchType() { + case EACLRecord_FilterInfo_StringEqual: + res = StringEqual + case EACLRecord_FilterInfo_StringNotEqual: + res = StringNotEqual + } + } + + return +} + +// SetMatchType passes casted argument to MatchType field setter. +// +// If filter is not initialized, nothing changes. +// +// MatchType is set to EACLRecord_FilterInfo_MatchUnknown if argument is not one of: +// - StringEqual; +// - StringNotEqual. +func (s EACLFilterWrapper) SetMatchType(v MatchType) { + if s.filter != nil { + switch v { + case StringEqual: + s.filter.SetMatchType(EACLRecord_FilterInfo_StringEqual) + case StringNotEqual: + s.filter.SetMatchType(EACLRecord_FilterInfo_StringNotEqual) + default: + s.filter.SetMatchType(EACLRecord_FilterInfo_MatchUnknown) + } + } +} + +// Name returns the result of HeaderName field getter. +// +// If filter is not initialized, empty string returns. +func (s EACLFilterWrapper) Name() string { + if s.filter == nil { + return "" + } + + return s.filter.GetHeaderName() +} + +// SetName passes argument to HeaderName field setter. +// +// If filter is not initialized, nothing changes. +func (s EACLFilterWrapper) SetName(v string) { + if s.filter != nil { + s.filter.SetHeaderName(v) + } +} + +// Value returns the result of HeaderVal field getter. +// +// If filter is not initialized, empty string returns. +func (s EACLFilterWrapper) Value() string { + if s.filter == nil { + return "" + } + + return s.filter.GetHeaderVal() +} + +// SetValue passes argument to HeaderVal field setter. +// +// If filter is not initialized, nothing changes. +func (s EACLFilterWrapper) SetValue(v string) { + if s.filter != nil { + s.filter.SetHeaderVal(v) + } +} + +// HeaderType returns the result of Header field getter. +// +// If filter is not initialized, 0 returns. +// +// Returns 0 if Header is not one of: +// - EACLRecord_FilterInfo_Request; +// - EACLRecord_FilterInfo_ObjectSystem; +// - EACLRecord_FilterInfo_ObjectUser. +func (s EACLFilterWrapper) HeaderType() (res HeaderType) { + if s.filter != nil { + switch s.filter.GetHeader() { + case EACLRecord_FilterInfo_Request: + res = HdrTypeRequest + case EACLRecord_FilterInfo_ObjectSystem: + res = HdrTypeObjSys + case EACLRecord_FilterInfo_ObjectUser: + res = HdrTypeObjUsr + } + } + + return +} + +// SetHeaderType passes casted argument to Header field setter. +// +// If filter is not initialized, nothing changes. +// +// Header is set to EACLRecord_FilterInfo_HeaderUnknown if argument is not one of: +// - HdrTypeRequest; +// - HdrTypeObjSys; +// - HdrTypeObjUsr. +func (s EACLFilterWrapper) SetHeaderType(t HeaderType) { + if s.filter != nil { + switch t { + case HdrTypeRequest: + s.filter.SetHeader(EACLRecord_FilterInfo_Request) + case HdrTypeObjSys: + s.filter.SetHeader(EACLRecord_FilterInfo_ObjectSystem) + case HdrTypeObjUsr: + s.filter.SetHeader(EACLRecord_FilterInfo_ObjectUser) + default: + s.filter.SetHeader(EACLRecord_FilterInfo_HeaderUnknown) + } + } +} + +// Target returns the result of Target field getter. +// +// If target is not initialized, Target_Unknown returns. +func (s EACLTargetWrapper) Target() Target { + if s.target == nil { + return Target_Unknown + } + + return s.target.GetTarget() +} + +// SetTarget passes argument to Target field setter. +// +// If target is not initialized, nothing changes. +func (s EACLTargetWrapper) SetTarget(v Target) { + if s.target != nil { + s.target.SetTarget(v) + } +} + +// KeyList returns the result of KeyList field getter. +// +// If target is not initialized, nil returns. +func (s EACLTargetWrapper) KeyList() [][]byte { + if s.target == nil { + return nil + } + + return s.target.GetKeyList() +} + +// SetKeyList passes argument to KeyList field setter. +// +// If target is not initialized, nothing changes. +func (s EACLTargetWrapper) SetKeyList(v [][]byte) { + if s.target != nil { + s.target.SetKeyList(v) + } +} + +// KeyList returns casted result of Operation field getter. +// +// If record is not initialized, 0 returns. +// +// Returns 0 if Operation is not one of: +// - EACLRecord_HEAD; +// - EACLRecord_PUT; +// - EACLRecord_SEARCH; +// - EACLRecord_GET; +// - EACLRecord_GETRANGE; +// - EACLRecord_GETRANGEHASH; +// - EACLRecord_DELETE. +func (s EACLRecordWrapper) OperationType() (res OperationType) { + if s.record != nil { + switch s.record.GetOperation() { + case EACLRecord_HEAD: + res = OpTypeHead + case EACLRecord_PUT: + res = OpTypePut + case EACLRecord_SEARCH: + res = OpTypeSearch + case EACLRecord_GET: + res = OpTypeGet + case EACLRecord_GETRANGE: + res = OpTypeRange + case EACLRecord_GETRANGEHASH: + res = OpTypeRangeHash + case EACLRecord_DELETE: + res = OpTypeDelete + } + } + + return +} + +// SetOperationType passes casted argument to Operation field setter. +// +// If record is not initialized, nothing changes. +// +// Operation is set to EACLRecord_OPERATION_UNKNOWN if argument is not one of: +// - OpTypeHead; +// - OpTypePut; +// - OpTypeSearch; +// - OpTypeGet; +// - OpTypeRange; +// - OpTypeRangeHash; +// - OpTypeDelete. +func (s EACLRecordWrapper) SetOperationType(v OperationType) { + if s.record != nil { + switch v { + case OpTypeHead: + s.record.SetOperation(EACLRecord_HEAD) + case OpTypePut: + s.record.SetOperation(EACLRecord_PUT) + case OpTypeSearch: + s.record.SetOperation(EACLRecord_SEARCH) + case OpTypeGet: + s.record.SetOperation(EACLRecord_GET) + case OpTypeRange: + s.record.SetOperation(EACLRecord_GETRANGE) + case OpTypeRangeHash: + s.record.SetOperation(EACLRecord_GETRANGEHASH) + case OpTypeDelete: + s.record.SetOperation(EACLRecord_DELETE) + default: + s.record.SetOperation(EACLRecord_OPERATION_UNKNOWN) + } + } +} + +// Action returns casted result of Action field getter. +// +// If record is not initialized, 0 returns. +// +// Returns 0 if Action is not one of: +// - EACLRecord_Deny; +// - EACLRecord_Allow. +func (s EACLRecordWrapper) Action() (res ExtendedACLAction) { + if s.record != nil { + switch s.record.GetAction() { + case EACLRecord_Deny: + res = ActionDeny + case EACLRecord_Allow: + res = ActionAllow + } + } + + return +} + +// SetAction passes casted argument to Action field setter. +// +// If record is not initialized, nothing changes. +// +// Action is set to EACLRecord_ActionUnknown if argument is not one of: +// - ActionDeny; +// - ActionAllow. +func (s EACLRecordWrapper) SetAction(v ExtendedACLAction) { + if s.record != nil { + switch v { + case ActionDeny: + s.record.SetAction(EACLRecord_Deny) + case ActionAllow: + s.record.SetAction(EACLRecord_Allow) + default: + s.record.SetAction(EACLRecord_ActionUnknown) + } + } +} + +// HeaderFilters wraps all elements from Filters field getter result and returns HeaderFilter list. +// +// If record is not initialized, nil returns. +func (s EACLRecordWrapper) HeaderFilters() []HeaderFilter { + if s.record == nil { + return nil + } + + filters := s.record.GetFilters() + + res := make([]HeaderFilter, 0, len(filters)) + + for i := range filters { + res = append(res, WrapFilterInfo(filters[i])) + } + + return res +} + +// SetHeaderFilters converts HeaderFilter list to EACLRecord_FilterInfo list and passes it to Filters field setter. +// +// Ignores nil elements of argument. +// If record is not initialized, nothing changes. +func (s EACLRecordWrapper) SetHeaderFilters(v []HeaderFilter) { + if s.record == nil { + return + } + + filters := make([]*EACLRecord_FilterInfo, 0, len(v)) + + for i := range v { + if v[i] == nil { + continue + } + + w := WrapFilterInfo(nil) + w.SetMatchType(v[i].MatchType()) + w.SetHeaderType(v[i].HeaderType()) + w.SetName(v[i].Name()) + w.SetValue(v[i].Value()) + + filters = append(filters, w.filter) + } + + s.record.SetFilters(filters) +} + +// TargetList wraps all elements from Targets field getter result and returns ExtendedACLTarget list. +// +// If record is not initialized, nil returns. +func (s EACLRecordWrapper) TargetList() []ExtendedACLTarget { + if s.record == nil { + return nil + } + + targets := s.record.GetTargets() + + res := make([]ExtendedACLTarget, 0, len(targets)) + + for i := range targets { + res = append(res, WrapEACLTarget(targets[i])) + } + + return res +} + +// SetTargetList converts ExtendedACLTarget list to EACLRecord_TargetInfo list and passes it to Targets field setter. +// +// Ignores nil elements of argument. +// If record is not initialized, nothing changes. +func (s EACLRecordWrapper) SetTargetList(v []ExtendedACLTarget) { + if s.record == nil { + return + } + + targets := make([]*EACLRecord_TargetInfo, 0, len(v)) + + for i := range v { + if v[i] == nil { + continue + } + + w := WrapEACLTarget(nil) + w.SetTarget(v[i].Target()) + w.SetKeyList(v[i].KeyList()) + + targets = append(targets, w.target) + } + + s.record.SetTargets(targets) +} + +// Records wraps all elements from Records field getter result and returns ExtendedACLRecord list. +// +// If table is not initialized, nil returns. +func (s EACLTableWrapper) Records() []ExtendedACLRecord { + if s.table == nil { + return nil + } + + records := s.table.GetRecords() + + res := make([]ExtendedACLRecord, 0, len(records)) + + for i := range records { + res = append(res, WrapEACLRecord(records[i])) + } + + return res +} + +// SetRecords converts ExtendedACLRecord list to EACLRecord list and passes it to Records field setter. +// +// Ignores nil elements of argument. +// If table is not initialized, nothing changes. +func (s EACLTableWrapper) SetRecords(v []ExtendedACLRecord) { + if s.table == nil { + return + } + + records := make([]*EACLRecord, 0, len(v)) + + for i := range v { + if v[i] == nil { + continue + } + + w := WrapEACLRecord(nil) + w.SetOperationType(v[i].OperationType()) + w.SetAction(v[i].Action()) + w.SetHeaderFilters(v[i].HeaderFilters()) + w.SetTargetList(v[i].TargetList()) + + records = append(records, w.record) + } + + s.table.SetRecords(records) +} + +// MarshalBinary returns the result of Marshal method. +func (s EACLTableWrapper) MarshalBinary() ([]byte, error) { + return s.table.Marshal() +} + +// UnmarshalBinary passes argument to Unmarshal method and returns its result. +func (s EACLTableWrapper) UnmarshalBinary(data []byte) error { + return s.table.Unmarshal(data) +} diff --git a/acl/wrappers_test.go b/acl/wrappers_test.go new file mode 100644 index 0000000..b7dbbe0 --- /dev/null +++ b/acl/wrappers_test.go @@ -0,0 +1,139 @@ +package acl + +import ( + "testing" + + "github.com/stretchr/testify/require" +) + +func TestEACLFilterWrapper(t *testing.T) { + s := WrapFilterInfo(nil) + + mt := StringEqual + s.SetMatchType(mt) + require.Equal(t, mt, s.MatchType()) + + ht := HdrTypeObjUsr + s.SetHeaderType(ht) + require.Equal(t, ht, s.HeaderType()) + + n := "name" + s.SetName(n) + require.Equal(t, n, s.Name()) + + v := "value" + s.SetValue(v) + require.Equal(t, v, s.Value()) +} + +func TestEACLTargetWrapper(t *testing.T) { + s := WrapEACLTarget(nil) + + target := Target(10) + s.SetTarget(target) + require.Equal(t, target, s.Target()) + + keys := [][]byte{ + {1, 2, 3}, + {4, 5, 6}, + } + s.SetKeyList(keys) + require.Equal(t, keys, s.KeyList()) +} + +func TestEACLRecordWrapper(t *testing.T) { + s := WrapEACLRecord(nil) + + action := ActionAllow + s.SetAction(action) + require.Equal(t, action, s.Action()) + + opType := OperationType(5) + s.SetOperationType(opType) + require.Equal(t, opType, s.OperationType()) + + f1Name := "name1" + f1 := WrapFilterInfo(nil) + f1.SetName(f1Name) + + f2Name := "name2" + f2 := WrapFilterInfo(nil) + f2.SetName(f2Name) + + s.SetHeaderFilters([]HeaderFilter{f1, f2}) + + filters := s.HeaderFilters() + require.Len(t, filters, 2) + require.Equal(t, f1Name, filters[0].Name()) + require.Equal(t, f2Name, filters[1].Name()) + + target1 := Target(1) + t1 := WrapEACLTarget(nil) + t1.SetTarget(target1) + + target2 := Target(2) + t2 := WrapEACLTarget(nil) + t2.SetTarget(target2) + + s.SetTargetList([]ExtendedACLTarget{t1, t2}) + + targets := s.TargetList() + require.Len(t, targets, 2) + require.Equal(t, target1, targets[0].Target()) + require.Equal(t, target2, targets[1].Target()) +} + +func TestEACLTableWrapper(t *testing.T) { + s := WrapEACLTable(nil) + + action1 := ExtendedACLAction(1) + r1 := WrapEACLRecord(nil) + r1.SetAction(action1) + + action2 := ExtendedACLAction(2) + r2 := WrapEACLRecord(nil) + r2.SetAction(action2) + + s.SetRecords([]ExtendedACLRecord{r1, r2}) + + records := s.Records() + require.Len(t, records, 2) + require.Equal(t, action1, records[0].Action()) + require.Equal(t, action2, records[1].Action()) + + data, err := s.MarshalBinary() + require.NoError(t, err) + + s2 := WrapEACLTable(nil) + require.NoError(t, s2.UnmarshalBinary(data)) + + records1 := s.Records() + records2 := s2.Records() + require.Len(t, records1, len(records2)) + + for i := range records1 { + require.Equal(t, records1[i].Action(), records2[i].Action()) + require.Equal(t, records1[i].OperationType(), records2[i].OperationType()) + + targets1 := records1[i].TargetList() + targets2 := records2[i].TargetList() + require.Len(t, targets1, len(targets2)) + + for j := range targets1 { + require.Equal(t, targets1[j].Target(), targets2[j].Target()) + require.Equal(t, targets1[j].KeyList(), targets2[j].KeyList()) + } + + filters1 := records1[i].HeaderFilters() + filters2 := records2[i].HeaderFilters() + require.Len(t, filters1, len(filters2)) + + for j := range filters1 { + require.Equal(t, filters1[j].MatchType(), filters2[j].MatchType()) + require.Equal(t, filters1[j].HeaderType(), filters2[j].HeaderType()) + require.Equal(t, filters1[j].Name(), filters2[j].Name()) + require.Equal(t, filters1[j].Value(), filters2[j].Value()) + require.Equal(t, filters1[j].Value(), filters2[j].Value()) + } + } +} From ec4fb22e30f26319e162d6454d7b2b28974220bb Mon Sep 17 00:00:00 2001 From: Pavel Korotkov Date: Tue, 7 Jul 2020 18:17:50 +0300 Subject: [PATCH 0245/1196] acl: fix an erroneous method name in comments --- acl/wrappers.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/acl/wrappers.go b/acl/wrappers.go index b0481f4..30c2ee3 100644 --- a/acl/wrappers.go +++ b/acl/wrappers.go @@ -238,7 +238,7 @@ func (s EACLTargetWrapper) SetKeyList(v [][]byte) { } } -// KeyList returns casted result of Operation field getter. +// OperationType returns casted result of Operation field getter. // // If record is not initialized, 0 returns. // From 0db55d31ae0a24a7a603d827522d6960381b582f Mon Sep 17 00:00:00 2001 From: Pavel Korotkov Date: Tue, 7 Jul 2020 19:43:16 +0300 Subject: [PATCH 0246/1196] acl: remove tests --- acl/action_test.go | 76 --------------------------------------------- acl/headers_test.go | 59 ----------------------------------- acl/match_test.go | 44 -------------------------- 3 files changed, 179 deletions(-) delete mode 100644 acl/action_test.go delete mode 100644 acl/headers_test.go delete mode 100644 acl/match_test.go diff --git a/acl/action_test.go b/acl/action_test.go deleted file mode 100644 index 83022e3..0000000 --- a/acl/action_test.go +++ /dev/null @@ -1,76 +0,0 @@ -package acl - -type testExtendedACLTable struct { - records []ExtendedACLRecord -} - -type testRequestInfo struct { - headers []TypedHeader - key []byte - opType OperationType - target Target -} - -type testEACLRecord struct { - opType OperationType - filters []HeaderFilter - targets []ExtendedACLTarget - action ExtendedACLAction -} - -type testEACLTarget struct { - target Target - keys [][]byte -} - -func (s testEACLTarget) Target() Target { - return s.target -} - -func (s testEACLTarget) KeyList() [][]byte { - return s.keys -} - -func (s testEACLRecord) OperationType() OperationType { - return s.opType -} - -func (s testEACLRecord) HeaderFilters() []HeaderFilter { - return s.filters -} - -func (s testEACLRecord) TargetList() []ExtendedACLTarget { - return s.targets -} - -func (s testEACLRecord) Action() ExtendedACLAction { - return s.action -} - -func (s testRequestInfo) HeadersOfType(typ HeaderType) ([]Header, bool) { - res := make([]Header, 0, len(s.headers)) - - for i := range s.headers { - if s.headers[i].HeaderType() == typ { - res = append(res, s.headers[i]) - } - } - - return res, true -} - -func (s testRequestInfo) Key() []byte { - return s.key -} - -func (s testRequestInfo) TypeOf(t OperationType) bool { - return s.opType == t -} - -func (s testRequestInfo) TargetOf(t Target) bool { - return s.target == t -} - -func (s testExtendedACLTable) Records() []ExtendedACLRecord { - return s.records -} diff --git a/acl/headers_test.go b/acl/headers_test.go deleted file mode 100644 index 500d9a4..0000000 --- a/acl/headers_test.go +++ /dev/null @@ -1,59 +0,0 @@ -package acl - -import ( - "testing" - - "github.com/nspcc-dev/neofs-api-go/object" - "github.com/stretchr/testify/require" -) - -func TestNewTypedObjectExtendedHeader(t *testing.T) { - var res TypedHeader - - hdr := object.Header{} - - // nil value - require.Nil(t, newTypedObjectExtendedHeader(hdr)) - - // UserHeader - { - key := "key" - val := "val" - hdr.Value = &object.Header_UserHeader{ - UserHeader: &object.UserHeader{ - Key: key, - Value: val, - }, - } - - res = newTypedObjectExtendedHeader(hdr) - require.Equal(t, HdrTypeObjUsr, res.HeaderType()) - require.Equal(t, key, res.Name()) - require.Equal(t, val, res.Value()) - } - - { // Link - link := new(object.Link) - link.ID = object.ID{1, 2, 3} - - hdr.Value = &object.Header_Link{ - Link: link, - } - - check := func(lt object.Link_Type, name string) { - link.Type = lt - - res = newTypedObjectExtendedHeader(hdr) - - require.Equal(t, HdrTypeObjSys, res.HeaderType()) - require.Equal(t, name, res.Name()) - require.Equal(t, link.ID.String(), res.Value()) - } - - check(object.Link_Previous, HdrObjSysLinkPrev) - check(object.Link_Next, HdrObjSysLinkNext) - check(object.Link_Parent, HdrObjSysLinkPar) - check(object.Link_Child, HdrObjSysLinkChild) - check(object.Link_StorageGroup, HdrObjSysLinkSG) - } -} diff --git a/acl/match_test.go b/acl/match_test.go deleted file mode 100644 index 6975722..0000000 --- a/acl/match_test.go +++ /dev/null @@ -1,44 +0,0 @@ -package acl - -type testTypedHeader struct { - t HeaderType - k string - v string -} - -type testHeaderSrc struct { - hs []TypedHeader -} - -type testHeaderFilter struct { - TypedHeader - t MatchType -} - -func (s testHeaderFilter) MatchType() MatchType { - return s.t -} - -func (s testHeaderSrc) HeadersOfType(typ HeaderType) ([]Header, bool) { - res := make([]Header, 0, len(s.hs)) - - for i := range s.hs { - if s.hs[i].HeaderType() == typ { - res = append(res, s.hs[i]) - } - } - - return res, true -} - -func (s testTypedHeader) Name() string { - return s.k -} - -func (s testTypedHeader) Value() string { - return s.v -} - -func (s testTypedHeader) HeaderType() HeaderType { - return s.t -} From d0f56e504448b2f820e1c79038796b2d2ac3b5cf Mon Sep 17 00:00:00 2001 From: Pavel Korotkov Date: Tue, 7 Jul 2020 19:44:09 +0300 Subject: [PATCH 0247/1196] acl: reorganize files --- acl/action.go | 38 ------ acl/header.go | 290 ------------------------------------------- acl/match.go | 29 ----- acl/types.go | 116 +++++++++++++++++ acl/wrappers.go | 8 +- acl/wrappers_test.go | 2 +- 6 files changed, 121 insertions(+), 362 deletions(-) delete mode 100644 acl/action.go delete mode 100644 acl/header.go delete mode 100644 acl/match.go diff --git a/acl/action.go b/acl/action.go deleted file mode 100644 index b2986e2..0000000 --- a/acl/action.go +++ /dev/null @@ -1,38 +0,0 @@ -package acl - -// RequestInfo is an interface of request information needed for extended ACL check. -type RequestInfo interface { - TypedHeaderSource - - // Must return the binary representation of request initiator's key. - Key() []byte - - // Must return true if request corresponds to operation type. - TypeOf(OperationType) bool - - // Must return true if request has passed target. - TargetOf(Target) bool -} - -// ExtendedACLChecker is an interface of extended ACL checking tool. -type ExtendedACLChecker interface { - // Must return an action according to the results of applying the ACL table rules to request. - // - // Must return ActionUndefined if it is unable to explicitly calculate the action. - Action(ExtendedACLTable, RequestInfo) ExtendedACLAction -} - -type extendedACLChecker struct{} - -const ( - // ActionUndefined is ExtendedACLAction used to mark value as undefined. - // Most of the tools consider ActionUndefined as incalculable. - // Using ActionUndefined in ExtendedACLRecord is unsafe. - ActionUndefined ExtendedACLAction = iota - - // ActionAllow is ExtendedACLAction used to mark an applicability of ACL rule. - ActionAllow - - // ActionDeny is ExtendedACLAction used to mark an inapplicability of ACL rule. - ActionDeny -) diff --git a/acl/header.go b/acl/header.go deleted file mode 100644 index 9dff79e..0000000 --- a/acl/header.go +++ /dev/null @@ -1,290 +0,0 @@ -package acl - -import ( - "strconv" - - "github.com/nspcc-dev/neofs-api-go/object" - "github.com/nspcc-dev/neofs-api-go/service" -) - -type objectHeaderSource struct { - obj *object.Object -} - -type typedHeader struct { - n string - v string - t HeaderType -} - -type extendedHeadersWrapper struct { - hdrSrc service.ExtendedHeadersSource -} - -type typedExtendedHeader struct { - hdr service.ExtendedHeader -} - -const ( - _ HeaderType = iota - - // HdrTypeRequest is a HeaderType for request header. - HdrTypeRequest - - // HdrTypeObjSys is a HeaderType for system headers of object. - HdrTypeObjSys - - // HdrTypeObjUsr is a HeaderType for user headers of object. - HdrTypeObjUsr -) - -const ( - // HdrObjSysNameID is a name of ID field in system header of object. - HdrObjSysNameID = "ID" - - // HdrObjSysNameCID is a name of CID field in system header of object. - HdrObjSysNameCID = "CID" - - // HdrObjSysNameOwnerID is a name of OwnerID field in system header of object. - HdrObjSysNameOwnerID = "OWNER_ID" - - // HdrObjSysNameVersion is a name of Version field in system header of object. - HdrObjSysNameVersion = "VERSION" - - // HdrObjSysNamePayloadLength is a name of PayloadLength field in system header of object. - HdrObjSysNamePayloadLength = "PAYLOAD_LENGTH" - - // HdrObjSysNameCreatedUnix is a name of CreatedAt.UnitTime field in system header of object. - HdrObjSysNameCreatedUnix = "CREATED_UNIX" - - // HdrObjSysNameCreatedEpoch is a name of CreatedAt.Epoch field in system header of object. - HdrObjSysNameCreatedEpoch = "CREATED_EPOCH" - - // HdrObjSysLinkPrev is a name of previous link header in extended headers of object. - HdrObjSysLinkPrev = "LINK_PREV" - - // HdrObjSysLinkNext is a name of next link header in extended headers of object. - HdrObjSysLinkNext = "LINK_NEXT" - - // HdrObjSysLinkChild is a name of child link header in extended headers of object. - HdrObjSysLinkChild = "LINK_CHILD" - - // HdrObjSysLinkPar is a name of parent link header in extended headers of object. - HdrObjSysLinkPar = "LINK_PAR" - - // HdrObjSysLinkSG is a name of storage group link header in extended headers of object. - HdrObjSysLinkSG = "LINK_SG" -) - -func newTypedHeader(name, value string, typ HeaderType) TypedHeader { - return &typedHeader{ - n: name, - v: value, - t: typ, - } -} - -// Name is a name field getter. -func (s typedHeader) Name() string { - return s.n -} - -// Value is a value field getter. -func (s typedHeader) Value() string { - return s.v -} - -// HeaderType is a type field getter. -func (s typedHeader) HeaderType() HeaderType { - return s.t -} - -// TypedHeaderSourceFromObject wraps passed object and returns TypedHeaderSource interface. -func TypedHeaderSourceFromObject(obj *object.Object) TypedHeaderSource { - return &objectHeaderSource{ - obj: obj, - } -} - -// HeaderOfType gathers object headers of passed type and returns Header list. -// -// If value of some header can not be calculated (e.g. nil extended header), it does not appear in list. -// -// Always returns true. -func (s objectHeaderSource) HeadersOfType(typ HeaderType) ([]Header, bool) { - if s.obj == nil { - return nil, true - } - - var res []Header - - switch typ { - case HdrTypeObjUsr: - objHeaders := s.obj.GetHeaders() - - res = make([]Header, 0, len(objHeaders)) // 7 system header fields - - for _, extHdr := range objHeaders { - if h := newTypedObjectExtendedHeader(extHdr); h != nil { - res = append(res, h) - } - } - case HdrTypeObjSys: - res = make([]Header, 0, 7) - - sysHdr := s.obj.GetSystemHeader() - - // ID - res = append(res, newTypedHeader( - HdrObjSysNameID, - sysHdr.ID.String(), - HdrTypeObjSys), - ) - - // CID - res = append(res, newTypedHeader( - HdrObjSysNameCID, - sysHdr.CID.String(), - HdrTypeObjSys), - ) - - // OwnerID - res = append(res, newTypedHeader( - HdrObjSysNameOwnerID, - sysHdr.OwnerID.String(), - HdrTypeObjSys), - ) - - // Version - res = append(res, newTypedHeader( - HdrObjSysNameVersion, - strconv.FormatUint(sysHdr.GetVersion(), 10), - HdrTypeObjSys), - ) - - // PayloadLength - res = append(res, newTypedHeader( - HdrObjSysNamePayloadLength, - strconv.FormatUint(sysHdr.GetPayloadLength(), 10), - HdrTypeObjSys), - ) - - created := sysHdr.GetCreatedAt() - - // CreatedAt.UnitTime - res = append(res, newTypedHeader( - HdrObjSysNameCreatedUnix, - strconv.FormatUint(uint64(created.GetUnixTime()), 10), - HdrTypeObjSys), - ) - - // CreatedAt.Epoch - res = append(res, newTypedHeader( - HdrObjSysNameCreatedEpoch, - strconv.FormatUint(created.GetEpoch(), 10), - HdrTypeObjSys), - ) - } - - return res, true -} - -func newTypedObjectExtendedHeader(h object.Header) TypedHeader { - val := h.GetValue() - if val == nil { - return nil - } - - res := new(typedHeader) - res.t = HdrTypeObjSys - - switch hdr := val.(type) { - case *object.Header_UserHeader: - if hdr.UserHeader == nil { - return nil - } - - res.t = HdrTypeObjUsr - res.n = hdr.UserHeader.GetKey() - res.v = hdr.UserHeader.GetValue() - case *object.Header_Link: - if hdr.Link == nil { - return nil - } - - switch hdr.Link.GetType() { - case object.Link_Previous: - res.n = HdrObjSysLinkPrev - case object.Link_Next: - res.n = HdrObjSysLinkNext - case object.Link_Child: - res.n = HdrObjSysLinkChild - case object.Link_Parent: - res.n = HdrObjSysLinkPar - case object.Link_StorageGroup: - res.n = HdrObjSysLinkSG - default: - return nil - } - - res.v = hdr.Link.ID.String() - default: - return nil - } - - return res -} - -// TypedHeaderSourceFromExtendedHeaders wraps passed ExtendedHeadersSource and returns TypedHeaderSource interface. -func TypedHeaderSourceFromExtendedHeaders(hdrSrc service.ExtendedHeadersSource) TypedHeaderSource { - return &extendedHeadersWrapper{ - hdrSrc: hdrSrc, - } -} - -// Name returns the result of Key method. -func (s typedExtendedHeader) Name() string { - return s.hdr.Key() -} - -// Value returns the result of Value method. -func (s typedExtendedHeader) Value() string { - return s.hdr.Value() -} - -// HeaderType always returns HdrTypeRequest. -func (s typedExtendedHeader) HeaderType() HeaderType { - return HdrTypeRequest -} - -// TypedHeaders gathers extended request headers and returns TypedHeader list. -// -// Nil headers are ignored. -// -// Always returns true. -func (s extendedHeadersWrapper) HeadersOfType(typ HeaderType) ([]Header, bool) { - if s.hdrSrc == nil { - return nil, true - } - - var res []Header - - switch typ { - case HdrTypeRequest: - hs := s.hdrSrc.ExtendedHeaders() - - res = make([]Header, 0, len(hs)) - - for i := range hs { - if hs[i] == nil { - continue - } - - res = append(res, &typedExtendedHeader{ - hdr: hs[i], - }) - } - } - - return res, true -} diff --git a/acl/match.go b/acl/match.go deleted file mode 100644 index bddee89..0000000 --- a/acl/match.go +++ /dev/null @@ -1,29 +0,0 @@ -package acl - -const ( - _ MatchType = iota - StringEqual - StringNotEqual -) - -// Maps MatchType to corresponding function. -// 1st argument of function - header value, 2nd - header filter. -var mMatchFns = map[MatchType]func(Header, Header) bool{ - StringEqual: stringEqual, - - StringNotEqual: stringNotEqual, -} - -const ( - mResUndefined = iota - mResMatch - mResMismatch -) - -func stringEqual(header, filter Header) bool { - return header.Value() == filter.Value() -} - -func stringNotEqual(header, filter Header) bool { - return header.Value() != filter.Value() -} diff --git a/acl/types.go b/acl/types.go index 0587b9b..6a418bc 100644 --- a/acl/types.go +++ b/acl/types.go @@ -1,5 +1,121 @@ package acl +import ( + "github.com/nspcc-dev/neofs-api-go/object" + "github.com/nspcc-dev/neofs-api-go/service" +) + +const ( + _ MatchType = iota + stringEqual + stringNotEqual +) + +const ( + // ActionUndefined is ExtendedACLAction used to mark value as undefined. + // Most of the tools consider ActionUndefined as incalculable. + // Using ActionUndefined in ExtendedACLRecord is unsafe. + ActionUndefined ExtendedACLAction = iota + + // ActionAllow is ExtendedACLAction used to mark an applicability of ACL rule. + ActionAllow + + // ActionDeny is ExtendedACLAction used to mark an inapplicability of ACL rule. + ActionDeny +) + +const ( + _ HeaderType = iota + + // HdrTypeRequest is a HeaderType for request header. + HdrTypeRequest + + // HdrTypeObjSys is a HeaderType for system headers of object. + HdrTypeObjSys + + // HdrTypeObjUsr is a HeaderType for user headers of object. + HdrTypeObjUsr +) + +const ( + // HdrObjSysNameID is a name of ID field in system header of object. + HdrObjSysNameID = "ID" + + // HdrObjSysNameCID is a name of CID field in system header of object. + HdrObjSysNameCID = "CID" + + // HdrObjSysNameOwnerID is a name of OwnerID field in system header of object. + HdrObjSysNameOwnerID = "OWNER_ID" + + // HdrObjSysNameVersion is a name of Version field in system header of object. + HdrObjSysNameVersion = "VERSION" + + // HdrObjSysNamePayloadLength is a name of PayloadLength field in system header of object. + HdrObjSysNamePayloadLength = "PAYLOAD_LENGTH" + + // HdrObjSysNameCreatedUnix is a name of CreatedAt.UnitTime field in system header of object. + HdrObjSysNameCreatedUnix = "CREATED_UNIX" + + // HdrObjSysNameCreatedEpoch is a name of CreatedAt.Epoch field in system header of object. + HdrObjSysNameCreatedEpoch = "CREATED_EPOCH" + + // HdrObjSysLinkPrev is a name of previous link header in extended headers of object. + HdrObjSysLinkPrev = "LINK_PREV" + + // HdrObjSysLinkNext is a name of next link header in extended headers of object. + HdrObjSysLinkNext = "LINK_NEXT" + + // HdrObjSysLinkChild is a name of child link header in extended headers of object. + HdrObjSysLinkChild = "LINK_CHILD" + + // HdrObjSysLinkPar is a name of parent link header in extended headers of object. + HdrObjSysLinkPar = "LINK_PAR" + + // HdrObjSysLinkSG is a name of storage group link header in extended headers of object. + HdrObjSysLinkSG = "LINK_SG" +) + +type objectHeaderSource struct { + obj *object.Object +} + +type typedHeader struct { + n string + v string + t HeaderType +} + +type extendedHeadersWrapper struct { + hdrSrc service.ExtendedHeadersSource +} + +type typedExtendedHeader struct { + hdr service.ExtendedHeader +} + +func newTypedHeader(name, value string, typ HeaderType) TypedHeader { + return &typedHeader{ + n: name, + v: value, + t: typ, + } +} + +// Name is a name field getter. +func (s typedHeader) Name() string { + return s.n +} + +// Value is a value field getter. +func (s typedHeader) Value() string { + return s.v +} + +// HeaderType is a type field getter. +func (s typedHeader) HeaderType() HeaderType { + return s.t +} + // SetMatchType is MatchType field setter. func (m *EACLRecord_FilterInfo) SetMatchType(v EACLRecord_FilterInfo_MatchType) { m.MatchType = v diff --git a/acl/wrappers.go b/acl/wrappers.go index 30c2ee3..94e420a 100644 --- a/acl/wrappers.go +++ b/acl/wrappers.go @@ -83,9 +83,9 @@ func (s EACLFilterWrapper) MatchType() (res MatchType) { if s.filter != nil { switch s.filter.GetMatchType() { case EACLRecord_FilterInfo_StringEqual: - res = StringEqual + res = stringEqual case EACLRecord_FilterInfo_StringNotEqual: - res = StringNotEqual + res = stringNotEqual } } @@ -102,9 +102,9 @@ func (s EACLFilterWrapper) MatchType() (res MatchType) { func (s EACLFilterWrapper) SetMatchType(v MatchType) { if s.filter != nil { switch v { - case StringEqual: + case stringEqual: s.filter.SetMatchType(EACLRecord_FilterInfo_StringEqual) - case StringNotEqual: + case stringNotEqual: s.filter.SetMatchType(EACLRecord_FilterInfo_StringNotEqual) default: s.filter.SetMatchType(EACLRecord_FilterInfo_MatchUnknown) diff --git a/acl/wrappers_test.go b/acl/wrappers_test.go index b7dbbe0..a55db8c 100644 --- a/acl/wrappers_test.go +++ b/acl/wrappers_test.go @@ -9,7 +9,7 @@ import ( func TestEACLFilterWrapper(t *testing.T) { s := WrapFilterInfo(nil) - mt := StringEqual + mt := stringEqual s.SetMatchType(mt) require.Equal(t, mt, s.MatchType()) From f82651720726fe9fdc27f7f4fffa5b56b793e4d9 Mon Sep 17 00:00:00 2001 From: Pavel Korotkov Date: Tue, 7 Jul 2020 22:16:56 +0300 Subject: [PATCH 0248/1196] acl: delete unused types --- acl/extended.go | 27 --------------------------- acl/types.go | 46 ---------------------------------------------- 2 files changed, 73 deletions(-) diff --git a/acl/extended.go b/acl/extended.go index 61ccbcf..df8402a 100644 --- a/acl/extended.go +++ b/acl/extended.go @@ -1,11 +1,5 @@ package acl -import ( - "context" - - "github.com/nspcc-dev/neofs-api-go/refs" -) - // OperationType is an enumeration of operation types for extended ACL. type OperationType uint32 @@ -35,13 +29,6 @@ type TypedHeader interface { HeaderType() HeaderType } -// TypedHeaderSource is a various types of header set interface. -type TypedHeaderSource interface { - // Must return list of Header of particular type. - // Must return false if there is no ability to compose header list. - HeadersOfType(HeaderType) ([]Header, bool) -} - // HeaderFilter is an interface of grouped information about filtered header. type HeaderFilter interface { // Must return match type of filter. @@ -80,20 +67,6 @@ type ExtendedACLTable interface { Records() []ExtendedACLRecord } -// ExtendedACLSource is an interface of storage of extended ACL tables with read access. -type ExtendedACLSource interface { - // Must return extended ACL table by container ID key. - GetExtendedACLTable(context.Context, refs.CID) (ExtendedACLTable, error) -} - -// ExtendedACLStore is an interface of storage of extended ACL tables. -type ExtendedACLStore interface { - ExtendedACLSource - - // Must store extended ACL table for container ID key. - PutExtendedACLTable(context.Context, refs.CID, ExtendedACLTable) error -} - const ( _ OperationType = iota diff --git a/acl/types.go b/acl/types.go index 6a418bc..c9bbfd3 100644 --- a/acl/types.go +++ b/acl/types.go @@ -1,10 +1,5 @@ package acl -import ( - "github.com/nspcc-dev/neofs-api-go/object" - "github.com/nspcc-dev/neofs-api-go/service" -) - const ( _ MatchType = iota stringEqual @@ -75,47 +70,6 @@ const ( HdrObjSysLinkSG = "LINK_SG" ) -type objectHeaderSource struct { - obj *object.Object -} - -type typedHeader struct { - n string - v string - t HeaderType -} - -type extendedHeadersWrapper struct { - hdrSrc service.ExtendedHeadersSource -} - -type typedExtendedHeader struct { - hdr service.ExtendedHeader -} - -func newTypedHeader(name, value string, typ HeaderType) TypedHeader { - return &typedHeader{ - n: name, - v: value, - t: typ, - } -} - -// Name is a name field getter. -func (s typedHeader) Name() string { - return s.n -} - -// Value is a value field getter. -func (s typedHeader) Value() string { - return s.v -} - -// HeaderType is a type field getter. -func (s typedHeader) HeaderType() HeaderType { - return s.t -} - // SetMatchType is MatchType field setter. func (m *EACLRecord_FilterInfo) SetMatchType(v EACLRecord_FilterInfo_MatchType) { m.MatchType = v From 2fba8cb7b33f8cdc1396a143aa6684e69b230eba Mon Sep 17 00:00:00 2001 From: Pavel Korotkov Date: Tue, 7 Jul 2020 23:03:53 +0300 Subject: [PATCH 0249/1196] acl: make MatchType's constants public back --- acl/types.go | 8 ++++++-- acl/wrappers.go | 8 ++++---- acl/wrappers_test.go | 2 +- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/acl/types.go b/acl/types.go index c9bbfd3..c80c9cd 100644 --- a/acl/types.go +++ b/acl/types.go @@ -2,8 +2,12 @@ package acl const ( _ MatchType = iota - stringEqual - stringNotEqual + + // StringEqual is a MatchType of string equality. + StringEqual + + // StringNotEqual is a MatchType of string inequality. + StringNotEqual ) const ( diff --git a/acl/wrappers.go b/acl/wrappers.go index 94e420a..30c2ee3 100644 --- a/acl/wrappers.go +++ b/acl/wrappers.go @@ -83,9 +83,9 @@ func (s EACLFilterWrapper) MatchType() (res MatchType) { if s.filter != nil { switch s.filter.GetMatchType() { case EACLRecord_FilterInfo_StringEqual: - res = stringEqual + res = StringEqual case EACLRecord_FilterInfo_StringNotEqual: - res = stringNotEqual + res = StringNotEqual } } @@ -102,9 +102,9 @@ func (s EACLFilterWrapper) MatchType() (res MatchType) { func (s EACLFilterWrapper) SetMatchType(v MatchType) { if s.filter != nil { switch v { - case stringEqual: + case StringEqual: s.filter.SetMatchType(EACLRecord_FilterInfo_StringEqual) - case stringNotEqual: + case StringNotEqual: s.filter.SetMatchType(EACLRecord_FilterInfo_StringNotEqual) default: s.filter.SetMatchType(EACLRecord_FilterInfo_MatchUnknown) diff --git a/acl/wrappers_test.go b/acl/wrappers_test.go index a55db8c..b7dbbe0 100644 --- a/acl/wrappers_test.go +++ b/acl/wrappers_test.go @@ -9,7 +9,7 @@ import ( func TestEACLFilterWrapper(t *testing.T) { s := WrapFilterInfo(nil) - mt := stringEqual + mt := StringEqual s.SetMatchType(mt) require.Equal(t, mt, s.MatchType()) From 504804f80604ad8c2222300dbd5266a9b76308d6 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 8 Jul 2020 10:50:58 +0300 Subject: [PATCH 0250/1196] Update to neofs-api v1.2.0 --- Makefile | 2 +- acl/types.proto | 2 +- docs/acl.md | 116 +++++++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 117 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 159c7e3..600586e 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -PROTO_VERSION=v1.1.0 +PROTO_VERSION=v1.2.0 PROTO_URL=https://github.com/nspcc-dev/neofs-api/archive/$(PROTO_VERSION).tar.gz B=\033[0;1m diff --git a/acl/types.proto b/acl/types.proto index 6934b36..7f3efc9 100644 --- a/acl/types.proto +++ b/acl/types.proto @@ -103,4 +103,4 @@ message EACLRecord { message EACLTable { // Records carries list of extended ACL rule records. repeated EACLRecord Records = 1 [json_name="Records"]; -} \ No newline at end of file +} diff --git a/docs/acl.md b/docs/acl.md index 38f328b..f63758b 100644 --- a/docs/acl.md +++ b/docs/acl.md @@ -5,7 +5,12 @@ - [acl/types.proto](#acl/types.proto) - + - Messages + - [EACLRecord](#acl.EACLRecord) + - [EACLRecord.FilterInfo](#acl.EACLRecord.FilterInfo) + - [EACLRecord.TargetInfo](#acl.EACLRecord.TargetInfo) + - [EACLTable](#acl.EACLTable) + - [Scalar Value Types](#scalar-value-types) @@ -19,9 +24,118 @@ + + + +### Message EACLRecord +EACLRecord groups information about extended ACL rule. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| operation | [EACLRecord.Operation](#acl.EACLRecord.Operation) | | Operation carries type of operation. | +| action | [EACLRecord.Action](#acl.EACLRecord.Action) | | Action carries ACL target action. | +| Filters | [EACLRecord.FilterInfo](#acl.EACLRecord.FilterInfo) | repeated | Filters carries set of filters. | +| Targets | [EACLRecord.TargetInfo](#acl.EACLRecord.TargetInfo) | repeated | Targets carries information about extended ACL target list. | + + + + +### Message EACLRecord.FilterInfo +FilterInfo groups information about filter. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| header | [EACLRecord.FilterInfo.Header](#acl.EACLRecord.FilterInfo.Header) | | Header carries type of header. | +| matchType | [EACLRecord.FilterInfo.MatchType](#acl.EACLRecord.FilterInfo.MatchType) | | MatchType carries type of match. | +| HeaderName | [string](#string) | | HeaderName carries name of filtering header. | +| HeaderVal | [string](#string) | | HeaderVal carries value of filtering header. | + + + + +### Message EACLRecord.TargetInfo +TargetInfo groups information about extended ACL target. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| Target | [Target](#acl.Target) | | Target carries target of ACL rule. | +| KeyList | [bytes](#bytes) | repeated | KeyList carries public keys of ACL target. | + + + + +### Message EACLTable +EACLRecord carries the information about extended ACL rules. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| Records | [EACLRecord](#acl.EACLRecord) | repeated | Records carries list of extended ACL rule records. | + + + +### EACLRecord.Action +Action is an enumeration of EACL actions. + +| Name | Number | Description | +| ---- | ------ | ----------- | +| ActionUnknown | 0 | | +| Allow | 1 | | +| Deny | 2 | | + + + + + +### EACLRecord.FilterInfo.Header +Header is an enumeration of filtering header types. + +| Name | Number | Description | +| ---- | ------ | ----------- | +| HeaderUnknown | 0 | | +| Request | 1 | | +| ObjectSystem | 2 | | +| ObjectUser | 3 | | + + + + + +### EACLRecord.FilterInfo.MatchType +MatchType is an enumeration of match types. + +| Name | Number | Description | +| ---- | ------ | ----------- | +| MatchUnknown | 0 | | +| StringEqual | 1 | | +| StringNotEqual | 2 | | + + + + + +### EACLRecord.Operation +Operation is an enumeration of operation types. + +| Name | Number | Description | +| ---- | ------ | ----------- | +| OPERATION_UNKNOWN | 0 | | +| GET | 1 | | +| HEAD | 2 | | +| PUT | 3 | | +| DELETE | 4 | | +| SEARCH | 5 | | +| GETRANGE | 6 | | +| GETRANGEHASH | 7 | | + + + ### Target From 2bf5a0c30b228e68e567bbb1f12716e77b0eb46a Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 8 Jul 2020 11:09:29 +0300 Subject: [PATCH 0251/1196] Update changelog and readme for v1.2.0 --- CHANGELOG.md | 18 ++++++++++++++++++ README.md | 6 +++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e771c19..898dcce 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,23 @@ # Changelog This is the changelog for NeoFS-API-Go +## [1.2.0] - 2020-07-08 + +### Added + +- Extended ACL types. +- Getters and setters of ```EACLTable``` and its internal messages. +- Wrappers over ```EACLTable``` and its internal messages. +- Getters, setters and marshaling methods of wrappers. + +### Changed + +- Mechanism for signing requests on the principle of Matryoshka. + +### Updated + +- NeoFS API v1.1.0 => 1.2.0 + ## [1.1.0] - 2020-06-18 ### Added @@ -357,3 +374,4 @@ Initial public release [0.7.6]: https://github.com/nspcc-dev/neofs-api-go/compare/v0.7.5...v0.7.6 [1.0.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v0.7.6...v1.0.0 [1.1.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.0.0...v1.1.0 +[1.2.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.1.0...v1.2.0 diff --git a/README.md b/README.md index d44e057..4c768b2 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,11 @@ can be used for integration with NeoFS. [neofs-api v1.1.0]: https://github.com/nspcc-dev/neofs-api/releases/tag/v1.1.0 [neofs-api-go v1.1.0]: https://github.com/nspcc-dev/neofs-api-go/releases/tag/v1.1.0 -[neofs-api-go v1.1.0] supports [neofs-api v1.1.0] +* [neofs-api-go v1.1.0] supports [neofs-api v1.1.0] + +[neofs-api v1.2.0]: https://github.com/nspcc-dev/neofs-api/releases/tag/v1.2.0 +[neofs-api-go v1.2.0]: https://github.com/nspcc-dev/neofs-api-go/releases/tag/v1.2.0 +* [neofs-api-go v1.2.0] supports [neofs-api v1.2.0] ## Description From 1958ff8c37e2e1c9b2f07d5f20be0b472ae48f3c Mon Sep 17 00:00:00 2001 From: alexvanin Date: Fri, 17 Jul 2020 17:59:19 +0300 Subject: [PATCH 0252/1196] Use NEO3 based address generation With neo-go v0.90.0 there are new event subscription component and new verification script routines based on NEO3. These features allow to avoid using low-level neo-vm code in NeoFS and corresponding projects. This commit removes unused function: - FetchPublicKeys (used in neofs indexer), - VerificationScript (used in KeysToAddress), - Address (used in KeysToAddress), - ReversedScriptHashToAddress (used in neofs indexer), - IsAddress (used in neofs indexer), - ReverseBytes (used in neofs indexer), - DecodeScriptHash (used in neofs indexer). KeysToAddress changed into KeyToAddress because NeoFS won't work with multisignature owners for now and it is not supported in neo-go library. --- chain/address.go | 173 ++----------------------- chain/address_test.go | 289 +++--------------------------------------- go.mod | 1 + go.sum | 83 ++++++++++++ object/types_test.go | 4 +- refs/owner.go | 14 +- refs/types_test.go | 2 +- 7 files changed, 124 insertions(+), 442 deletions(-) diff --git a/chain/address.go b/chain/address.go index e10301f..0a56b8e 100644 --- a/chain/address.go +++ b/chain/address.go @@ -1,16 +1,9 @@ package chain import ( - "bytes" "crypto/ecdsa" - "crypto/sha256" - "encoding/hex" - "github.com/mr-tron/base58" - "github.com/nspcc-dev/neofs-api-go/internal" - crypto "github.com/nspcc-dev/neofs-crypto" - "github.com/pkg/errors" - "golang.org/x/crypto/ripemd160" + "github.com/nspcc-dev/neo-go/pkg/crypto/keys" ) // WalletAddress implements NEO address. @@ -18,168 +11,20 @@ type WalletAddress [AddressLength]byte const ( // AddressLength contains size of address, - // 0x17 byte (address version) + 20 bytes of ScriptHash + 4 bytes of checksum. + // 1 byte of address version + 20 bytes of ScriptHash + 4 bytes of checksum. AddressLength = 25 - - // ScriptHashLength contains size of ScriptHash. - ScriptHashLength = 20 - - // ErrEmptyAddress is raised when empty Address is passed. - ErrEmptyAddress = internal.Error("empty address") - - // ErrAddressLength is raised when passed address has wrong size. - ErrAddressLength = internal.Error("wrong address length") ) -func checksum(sign []byte) []byte { - hash := sha256.Sum256(sign) - hash = sha256.Sum256(hash[:]) - return hash[:4] -} - -// FetchPublicKeys tries to parse public keys from verification script. -func FetchPublicKeys(vs []byte) []*ecdsa.PublicKey { - var ( - count int - offset int - ln = len(vs) - result []*ecdsa.PublicKey - ) - - switch { - case ln < 1: // wrong data size - return nil - case vs[ln-1] == 0xac: // last byte is CHECKSIG - count = 1 - case vs[ln-1] == 0xae: // last byte is CHECKMULTISIG - // 2nd byte from the end indicates about PK's count - count = int(vs[ln-2] - 0x50) - // ignores CHECKMULTISIG - offset = 1 - default: // unknown type - return nil - } - - result = make([]*ecdsa.PublicKey, 0, count) - for i := 0; i < count; i++ { - // ignores PUSHBYTE33 and tries to parse - from, to := offset+1, offset+1+crypto.PublicKeyCompressedSize - - // when passed VerificationScript has wrong size - if len(vs) < to { - return nil - } - - key := crypto.UnmarshalPublicKey(vs[from:to]) - // when wrong public key is passed - if key == nil { - return nil - } - result = append(result, key) - - offset += 1 + crypto.PublicKeyCompressedSize - } - return result -} - -// VerificationScript returns VerificationScript composed from public keys. -func VerificationScript(pubs ...*ecdsa.PublicKey) []byte { - var ( - pre []byte - suf []byte - body []byte - offset int - lnPK = len(pubs) - ln = crypto.PublicKeyCompressedSize*lnPK + lnPK // 33 * count + count * 1 (PUSHBYTES33) - ) - - if len(pubs) > 1 { - pre = []byte{0x51} // one address - suf = []byte{byte(0x50 + lnPK), 0xae} // count of PK's + CHECKMULTISIG - } else { - suf = []byte{0xac} // CHECKSIG - } - - ln += len(pre) + len(suf) - - body = make([]byte, ln) - offset += copy(body, pre) - - for i := range pubs { - body[offset] = 0x21 - offset++ - offset += copy(body[offset:], crypto.MarshalPublicKey(pubs[i])) - } - - copy(body[offset:], suf) - - return body -} - -// KeysToAddress return NEO address composed from public keys. -func KeysToAddress(pubs ...*ecdsa.PublicKey) string { - if len(pubs) == 0 { +// KeyToAddress returns NEO address composed from public key. +func KeyToAddress(key *ecdsa.PublicKey) string { + if key == nil { return "" } - return Address(VerificationScript(pubs...)) -} -// Address returns NEO address based on passed VerificationScript. -func Address(verificationScript []byte) string { - sign := [AddressLength]byte{0x17} - hash := sha256.Sum256(verificationScript) - ripe := ripemd160.New() - ripe.Write(hash[:]) - copy(sign[1:], ripe.Sum(nil)) - copy(sign[21:], checksum(sign[:21])) - return base58.Encode(sign[:]) -} - -// ReversedScriptHashToAddress parses script hash and returns valid NEO address. -func ReversedScriptHashToAddress(sc string) (addr string, err error) { - var data []byte - if data, err = DecodeScriptHash(sc); err != nil { - return - } - sign := [AddressLength]byte{0x17} - copy(sign[1:], data) - copy(sign[1+ScriptHashLength:], checksum(sign[:1+ScriptHashLength])) - return base58.Encode(sign[:]), nil -} - -// IsAddress checks that passed NEO Address is valid. -func IsAddress(s string) error { - if s == "" { - return ErrEmptyAddress - } else if addr, err := base58.Decode(s); err != nil { - return errors.Wrap(err, "base58 decode") - } else if ln := len(addr); ln != AddressLength { - return errors.Wrapf(ErrAddressLength, "length %d != %d", AddressLength, ln) - } else if sum := checksum(addr[:21]); !bytes.Equal(addr[21:], sum) { - return errors.Errorf("wrong checksum %0x != %0x", - addr[21:], sum) + neoPublicKey := keys.PublicKey{ + X: key.X, + Y: key.Y, } - return nil -} - -// ReverseBytes returns reversed []byte of given. -func ReverseBytes(data []byte) []byte { - for i, j := 0, len(data)-1; i < j; i, j = i+1, j-1 { - data[i], data[j] = data[j], data[i] - } - return data -} - -// DecodeScriptHash parses script hash into slice of bytes. -func DecodeScriptHash(s string) ([]byte, error) { - if s == "" { - return nil, ErrEmptyAddress - } else if addr, err := hex.DecodeString(s); err != nil { - return nil, errors.Wrap(err, "hex decode") - } else if ln := len(addr); ln != ScriptHashLength { - return nil, errors.Wrapf(ErrAddressLength, "length %d != %d", ScriptHashLength, ln) - } else { - return addr, nil - } + return neoPublicKey.Address() } diff --git a/chain/address_test.go b/chain/address_test.go index f83b1dd..a998a11 100644 --- a/chain/address_test.go +++ b/chain/address_test.go @@ -1,292 +1,41 @@ package chain import ( - "crypto/ecdsa" "encoding/hex" "testing" crypto "github.com/nspcc-dev/neofs-crypto" - "github.com/nspcc-dev/neofs-crypto/test" "github.com/stretchr/testify/require" ) -func TestAddress(t *testing.T) { - var ( - multiSigVerificationScript = "512103c02a93134f98d9c78ec54b1b1f97fc64cd81360f53a293f41e4ad54aac3c57172103fea219d4ccfd7641cebbb2439740bb4bd7c4730c1abd6ca1dc44386533816df952ae" - multiSigAddress = "ANbvKqa2SfgTUkq43NRUhCiyxPrpUPn7S3" - - normalVerificationScript = "2102a33413277a319cc6fd4c54a2feb9032eba668ec587f307e319dc48733087fa61ac" - normalAddress = "AcraNnCuPKnUYtPYyrACRCVJhLpvskbfhu" - ) - - t.Run("check multi-sig address", func(t *testing.T) { - data, err := hex.DecodeString(multiSigVerificationScript) - require.NoError(t, err) - require.Equal(t, multiSigAddress, Address(data)) - }) - - t.Run("check normal address", func(t *testing.T) { - data, err := hex.DecodeString(normalVerificationScript) - require.NoError(t, err) - require.Equal(t, normalAddress, Address(data)) - }) +type addressTestCase struct { + name string + publicKey string + wallet string } -func TestVerificationScript(t *testing.T) { - t.Run("check normal", func(t *testing.T) { - pkString := "02a33413277a319cc6fd4c54a2feb9032eba668ec587f307e319dc48733087fa61" - - pkBytes, err := hex.DecodeString(pkString) - require.NoError(t, err) - - pk := crypto.UnmarshalPublicKey(pkBytes) - - expect, err := hex.DecodeString( - "21" + pkString + // PUSHBYTES33 - "ac", // CHECKSIG - ) - - require.Equal(t, expect, VerificationScript(pk)) - }) - - t.Run("check multisig", func(t *testing.T) { - pk1String := "03c02a93134f98d9c78ec54b1b1f97fc64cd81360f53a293f41e4ad54aac3c5717" - pk2String := "03fea219d4ccfd7641cebbb2439740bb4bd7c4730c1abd6ca1dc44386533816df9" - - pk1Bytes, err := hex.DecodeString(pk1String) - require.NoError(t, err) - - pk1 := crypto.UnmarshalPublicKey(pk1Bytes) - - pk2Bytes, err := hex.DecodeString(pk2String) - require.NoError(t, err) - - pk2 := crypto.UnmarshalPublicKey(pk2Bytes) - - expect, err := hex.DecodeString( - "51" + // one address - "21" + pk1String + // PUSHBYTES33 - "21" + pk2String + // PUSHBYTES33 - "52" + // 2 PublicKeys - "ae", // CHECKMULTISIG - ) - - require.Equal(t, expect, VerificationScript(pk1, pk2)) - }) -} - -func TestKeysToAddress(t *testing.T) { - t.Run("check normal", func(t *testing.T) { - pkString := "02a33413277a319cc6fd4c54a2feb9032eba668ec587f307e319dc48733087fa61" - - pkBytes, err := hex.DecodeString(pkString) - require.NoError(t, err) - - pk := crypto.UnmarshalPublicKey(pkBytes) - - expect := "AcraNnCuPKnUYtPYyrACRCVJhLpvskbfhu" - - actual := KeysToAddress(pk) - require.Equal(t, expect, actual) - require.NoError(t, IsAddress(actual)) - }) - - t.Run("check multisig", func(t *testing.T) { - pk1String := "03c02a93134f98d9c78ec54b1b1f97fc64cd81360f53a293f41e4ad54aac3c5717" - pk2String := "03fea219d4ccfd7641cebbb2439740bb4bd7c4730c1abd6ca1dc44386533816df9" - - pk1Bytes, err := hex.DecodeString(pk1String) - require.NoError(t, err) - - pk1 := crypto.UnmarshalPublicKey(pk1Bytes) - - pk2Bytes, err := hex.DecodeString(pk2String) - require.NoError(t, err) - - pk2 := crypto.UnmarshalPublicKey(pk2Bytes) - - expect := "ANbvKqa2SfgTUkq43NRUhCiyxPrpUPn7S3" - actual := KeysToAddress(pk1, pk2) - require.Equal(t, expect, actual) - require.NoError(t, IsAddress(actual)) - }) -} - -func TestFetchPublicKeys(t *testing.T) { - var ( - multiSigVerificationScript = "512103c02a93134f98d9c78ec54b1b1f97fc64cd81360f53a293f41e4ad54aac3c57172103fea219d4ccfd7641cebbb2439740bb4bd7c4730c1abd6ca1dc44386533816df952ae" - normalVerificationScript = "2102a33413277a319cc6fd4c54a2feb9032eba668ec587f307e319dc48733087fa61ac" - - pk1String = "03c02a93134f98d9c78ec54b1b1f97fc64cd81360f53a293f41e4ad54aac3c5717" - pk2String = "03fea219d4ccfd7641cebbb2439740bb4bd7c4730c1abd6ca1dc44386533816df9" - pk3String = "02a33413277a319cc6fd4c54a2feb9032eba668ec587f307e319dc48733087fa61" - ) - - t.Run("shouls not fail", func(t *testing.T) { - wrongVS, err := hex.DecodeString(multiSigVerificationScript) - require.NoError(t, err) - - wrongVS[len(wrongVS)-1] = 0x1 - - wrongPK, err := hex.DecodeString(multiSigVerificationScript) - require.NoError(t, err) - wrongPK[2] = 0x1 - - var testCases = []struct { - name string - value []byte - }{ - {name: "empty VerificationScript"}, - { - name: "wrong size VerificationScript", - value: []byte{0x1}, - }, - { - name: "wrong VerificationScript type", - value: wrongVS, - }, - { - name: "wrong public key in VerificationScript", - value: wrongPK, - }, - } - - for i := range testCases { - tt := testCases[i] - t.Run(tt.name, func(t *testing.T) { - var keys []*ecdsa.PublicKey - require.NotPanics(t, func() { - keys = FetchPublicKeys(tt.value) - }) - require.Nil(t, keys) - }) - } - }) - - t.Run("check multi-sig address", func(t *testing.T) { - data, err := hex.DecodeString(multiSigVerificationScript) - require.NoError(t, err) - - pk1Bytes, err := hex.DecodeString(pk1String) - require.NoError(t, err) - - pk2Bytes, err := hex.DecodeString(pk2String) - require.NoError(t, err) - - pk1 := crypto.UnmarshalPublicKey(pk1Bytes) - pk2 := crypto.UnmarshalPublicKey(pk2Bytes) - - keys := FetchPublicKeys(data) - require.Len(t, keys, 2) - require.Equal(t, keys[0], pk1) - require.Equal(t, keys[1], pk2) - }) - - t.Run("check normal address", func(t *testing.T) { - data, err := hex.DecodeString(normalVerificationScript) - require.NoError(t, err) - - pkBytes, err := hex.DecodeString(pk3String) - require.NoError(t, err) - - pk := crypto.UnmarshalPublicKey(pkBytes) - - keys := FetchPublicKeys(data) - require.Len(t, keys, 1) - require.Equal(t, keys[0], pk) - }) - - t.Run("generate 10 keys VerificationScript and try parse it", func(t *testing.T) { - var ( - count = 10 - expect = make([]*ecdsa.PublicKey, 0, count) - ) - - for i := 0; i < count; i++ { - key := test.DecodeKey(i) - expect = append(expect, &key.PublicKey) - } - - vs := VerificationScript(expect...) - - actual := FetchPublicKeys(vs) - require.Equal(t, expect, actual) - }) -} - -func TestReversedScriptHashToAddress(t *testing.T) { - var testCases = []struct { - name string - value string - expect string - }{ +func TestKeyToAddress(t *testing.T) { + tests := []addressTestCase{ { - name: "first", - expect: "APfiG5imQgn8dzTTfaDfqHnxo3QDUkF69A", - value: "5696acd07f0927fd5f01946828638c9e2c90c5dc", + "nil key", + "", + "", }, - { - name: "second", - expect: "AK2nJJpJr6o664CWJKi1QRXjqeic2zRp8y", - value: "23ba2703c53263e8d6e522dc32203339dcd8eee9", + "correct key", + "031a6c6fbbdf02ca351745fa86b9ba5a9452d785ac4f7fc2b7548ca2a46c4fcf4a", + "NgzuJWWGVEwFGsRrgzj8knswEYRJrTe7sm", }, } - for i := range testCases { - tt := testCases[i] - t.Run(tt.name, func(t *testing.T) { - actual, err := ReversedScriptHashToAddress(tt.value) + for i := range tests { + t.Run(tests[i].name, func(t *testing.T) { + data, err := hex.DecodeString(tests[i].publicKey) require.NoError(t, err) - require.Equal(t, tt.expect, actual) - require.NoError(t, IsAddress(actual)) - }) - } -} - -func TestReverseBytes(t *testing.T) { - var testCases = []struct { - name string - value []byte - expect []byte - }{ - {name: "empty"}, - { - name: "single byte", - expect: []byte{0x1}, - value: []byte{0x1}, - }, - - { - name: "two bytes", - expect: []byte{0x2, 0x1}, - value: []byte{0x1, 0x2}, - }, - - { - name: "three bytes", - expect: []byte{0x3, 0x2, 0x1}, - value: []byte{0x1, 0x2, 0x3}, - }, - - { - name: "five bytes", - expect: []byte{0x5, 0x4, 0x3, 0x2, 0x1}, - value: []byte{0x1, 0x2, 0x3, 0x4, 0x5}, - }, - - { - name: "eight bytes", - expect: []byte{0x8, 0x7, 0x6, 0x5, 0x4, 0x3, 0x2, 0x1}, - value: []byte{0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8}, - }, - } - - for i := range testCases { - tt := testCases[i] - t.Run(tt.name, func(t *testing.T) { - actual := ReverseBytes(tt.value) - require.Equal(t, tt.expect, actual) + + key := crypto.UnmarshalPublicKey(data) + + require.Equal(t, tests[i].wallet, KeyToAddress(key)) }) } } diff --git a/go.mod b/go.mod index eae84be..df12fcf 100644 --- a/go.mod +++ b/go.mod @@ -7,6 +7,7 @@ require ( github.com/golang/protobuf v1.4.2 github.com/google/uuid v1.1.1 github.com/mr-tron/base58 v1.1.3 + github.com/nspcc-dev/neo-go v0.90.0 github.com/nspcc-dev/neofs-crypto v0.3.0 github.com/nspcc-dev/netmap v1.7.0 github.com/nspcc-dev/tzhash v1.4.0 diff --git a/go.sum b/go.sum index a3ed30b..ec6cd1f 100644 --- a/go.sum +++ b/go.sum @@ -14,14 +14,23 @@ dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7 github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= +github.com/CityOfZion/neo-go v0.62.1-pre.0.20191114145240-e740fbe708f8/go.mod h1:MJCkWUBhi9pn/CrYO1Q3P687y2KeahrOPS9BD9LDGb0= +github.com/CityOfZion/neo-go v0.70.1-pre.0.20191209120015-fccb0085941e/go.mod h1:0enZl0az8xA6PVkwzEOwPWVJGqlt/GO4hA4kmQ5Xzig= +github.com/CityOfZion/neo-go v0.70.1-pre.0.20191212173117-32ac01130d4c/go.mod h1:JtlHfeqLywZLswKIKFnAp+yzezY4Dji9qlfQKB2OD/I= +github.com/CityOfZion/neo-go v0.71.1-pre.0.20200129171427-f773ec69fb84/go.mod h1:FLI526IrRWHmcsO+mHsCbj64pJZhwQFTLJZu+A4PGOA= +github.com/DataDog/zstd v1.4.1/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= +github.com/Workiva/go-datastructures v1.0.50/go.mod h1:Z+F2Rca0qCsVYDS8z7bAGm8f3UkzuWYS/oBZz5a7VVA= github.com/abiosoft/ishell v2.0.0+incompatible/go.mod h1:HQR9AqF2R3P4XXpMpI0NAzgHf/aS6+zVXRj14cVk9qg= github.com/abiosoft/readline v0.0.0-20180607040430-155bce2042db/go.mod h1:rB3B4rKii8V21ydCbIzH5hZiCQE7f5E9SzUb/ZZx530= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/alicebob/gopher-json v0.0.0-20180125190556-5a6b3ba71ee6/go.mod h1:SGnFV6hVsYE877CKEZ6tDNTjaSXYUk6QqoIK6PrAtcc= +github.com/alicebob/miniredis v2.5.0+incompatible/go.mod h1:8HZjEj4yU0dwhYHky+DxYx+6BMjkBbe5ONFIF1MXffk= github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= +github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/awalterschulze/gographviz v0.0.0-20181013152038-b2885df04310 h1:t+qxRrRtwNiUYA+Xh2jSXhoG2grnMCMKX4Fg6lx9X1U= @@ -35,28 +44,40 @@ github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJm github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= +github.com/cespare/xxhash/v2 v2.1.0/go.mod h1:dgIUBU3pDso/gPgZ1osOZ0iQf77oPR28Tjxl5dIMyVM= github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= +github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= +github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= +github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= +github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= +github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/dgraph-io/badger/v2 v2.0.3/go.mod h1:3KY8+bsP8wI0OEnQJAKpd4wIJW/Mm32yw2j/9FUVnIM= +github.com/dgraph-io/ristretto v0.0.2-0.20200115201040-8f368f2f2ab3/go.mod h1:KPxhHT9ZxKefz+PCeOGsrHpl1qZ7i70dGTu2u+Ahh6E= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= +github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= +github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/etcd-io/bbolt v1.3.3/go.mod h1:ZF2nL25h33cCyBtcyWeZ2/I3HQOfTP+0PIEvHjkjCrw= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/flynn-archive/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:rZfgFAXFS/z/lEd6LJmf9HVZ1LkgYiHx5pHhV5DR16M= +github.com/frankban/quicktest v1.10.0/go.mod h1:ui7WezCLWMWxVWr1GETZY3smRy0G4KWq9vcPtJmFl7Y= github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= @@ -65,7 +86,9 @@ github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2 github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= +github.com/go-redis/redis v6.10.2+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/go-yaml/yaml v2.1.0+incompatible/go.mod h1:w2MrLa16VYP0jy6N7M5kHaCkaLENm+P+Tv+MfurjSw0= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= github.com/gogo/protobuf v1.3.0/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= @@ -91,6 +114,9 @@ github.com/golang/protobuf v1.4.0 h1:oOuy+ugB+P/kBdUnG5QaMXSIyJ1q38wWSojYCb3z5VQ github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= github.com/golang/protobuf v1.4.2 h1:+Z5KGCizgyZCbGh1KZqA0fcLLkwbsjIzS4aV2v7wJX0= github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/snappy v0.0.0-20170215233205-553a64147049/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/gomodule/redigo v2.0.0+incompatible/go.mod h1:B4C85qUVwatsJoIUNIfCRsp7qO0iAmpGFZ4EELWSbC4= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= @@ -134,8 +160,11 @@ github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= +github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= +github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= @@ -148,19 +177,27 @@ github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxv github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/magiconair/properties v1.8.1 h1:ZC2Vc7/ZFkGmsVC9KvOjumD+G5lXy2RtTKyzRKO2BQ4= github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= +github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= +github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= +github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ= +github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84= github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg= github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= @@ -176,20 +213,36 @@ github.com/mr-tron/base58 v1.1.2/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjW github.com/mr-tron/base58 v1.1.3 h1:v+sk57XuaCKGXpWtVBX8YJzO7hMGx4Aajh4TQbdEFdc= github.com/mr-tron/base58 v1.1.3/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/nspcc-dev/dbft v0.0.0-20191205084618-dacb1a30c254/go.mod h1:w1Ln2aT+dBlPhLnuZhBV+DfPEdS2CHWWLp5JTScY3bw= +github.com/nspcc-dev/dbft v0.0.0-20191209120240-0d6b7568d9ae/go.mod h1:3FjXOoHmA51EGfb5GS/HOv7VdmngNRTssSeQ729dvGY= +github.com/nspcc-dev/dbft v0.0.0-20200117124306-478e5cfbf03a/go.mod h1:/YFK+XOxxg0Bfm6P92lY5eDSLYfp06XOdL8KAVgXjVk= +github.com/nspcc-dev/dbft v0.0.0-20200219114139-199d286ed6c1/go.mod h1:O0qtn62prQSqizzoagHmuuKoz8QMkU3SzBoKdEvm3aQ= +github.com/nspcc-dev/dbft v0.0.0-20200711144034-c526ccc6f570/go.mod h1:1FYQXSbb6/9HQIkoF8XO7W/S8N7AZRkBsgwbcXRvk0E= github.com/nspcc-dev/hrw v1.0.8 h1:vwRuJXZXgkMvf473vFzeWGCfY1WBVeSHAEHvR4u3/Cg= github.com/nspcc-dev/hrw v1.0.8/go.mod h1:l/W2vx83vMQo6aStyx2AuZrJ+07lGv2JQGlVkPG06MU= +github.com/nspcc-dev/neo-go v0.73.1-pre.0.20200303142215-f5a1b928ce09/go.mod h1:pPYwPZ2ks+uMnlRLUyXOpLieaDQSEaf4NM3zHVbRjmg= +github.com/nspcc-dev/neo-go v0.90.0 h1:ABNDrJuF9C1XuLQu0q9DKSVMlg9eQn/g6rX8Jbr31bo= +github.com/nspcc-dev/neo-go v0.90.0/go.mod h1:pPFdnApJwUSRAnpdiPBZl7I7jv0doDg5naecpSPK4+Q= +github.com/nspcc-dev/neofs-crypto v0.2.0/go.mod h1:F/96fUzPM3wR+UGsPi3faVNmFlA9KAEAUQR7dMxZmNA= +github.com/nspcc-dev/neofs-crypto v0.2.3/go.mod h1:8w16GEJbH6791ktVqHN9YRNH3s9BEEKYxGhlFnp0cDw= github.com/nspcc-dev/neofs-crypto v0.3.0 h1:zlr3pgoxuzrmGCxc5W8dGVfA9Rro8diFvVnBg0L4ifM= github.com/nspcc-dev/neofs-crypto v0.3.0/go.mod h1:8w16GEJbH6791ktVqHN9YRNH3s9BEEKYxGhlFnp0cDw= github.com/nspcc-dev/netmap v1.7.0 h1:ak64xn/gPdgYw4tsqSSF7kAGQGbEpeuJEF3XwBX4L9Y= github.com/nspcc-dev/netmap v1.7.0/go.mod h1:mhV3UOg9ljQmu0teQShD6+JYX09XY5gu2I4hIByCH9M= +github.com/nspcc-dev/rfc6979 v0.1.0/go.mod h1:exhIh1PdpDC5vQmyEsGvc4YDM/lyQp/452QxGq/UEso= github.com/nspcc-dev/rfc6979 v0.2.0 h1:3e1WNxrN60/6N0DW7+UYisLeZJyfqZTNOjeV/toYvOE= github.com/nspcc-dev/rfc6979 v0.2.0/go.mod h1:exhIh1PdpDC5vQmyEsGvc4YDM/lyQp/452QxGq/UEso= github.com/nspcc-dev/tzhash v1.4.0 h1:RVIR+mxOBHl58CE99+DXtE31ylD5PEkZSoWqoj4fVjg= github.com/nspcc-dev/tzhash v1.4.0/go.mod h1:Z8gp/VZbyWgPhaMp/KTmeoW5UTynp/N60g0jTtSzBws= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= +github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.10.3/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/gomega v1.4.2/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= +github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181zc= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= +github.com/pierrec/lz4 v2.5.2+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= @@ -201,6 +254,7 @@ github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndr github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= +github.com/prometheus/client_golang v1.2.1/go.mod h1:XMU6Z2MjaRKVu/dC1qupJI9SiNkDYzz3xecMgSW/F+U= github.com/prometheus/client_golang v1.6.0 h1:YVPodQOcK15POxhgARIvnDRVpLcuK8mglnMrWfyrw6A= github.com/prometheus/client_golang v1.6.0/go.mod h1:ZLOG9ck3JLRdB5MgO8f+lLTe83AXG6ro35rLTxvnIl4= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= @@ -212,16 +266,19 @@ github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6T github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt26CguLLsqA= github.com/prometheus/common v0.9.1 h1:KOMtN28tlbam3/7ZKEYKHhKoJZYYj3gMH4uc62x7X7U= github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= +github.com/prometheus/procfs v0.0.5/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDaekg4FpcdQ= github.com/prometheus/procfs v0.0.11 h1:DhHlBtkHWPYi8O2y31JkK0TF+DGM+51OopZjH/Ia5qI= github.com/prometheus/procfs v0.0.11/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= @@ -238,10 +295,12 @@ github.com/spf13/afero v1.1.2 h1:m8/z1t7/fwjysjQRYbP0RD+bUIF/8tJwPdEZsI83ACI= github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= github.com/spf13/cast v1.3.0 h1:oget//CVOEoFewqQxwr0Ej5yjygnqGkvggSE/gB35Q8= github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= +github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= github.com/spf13/jwalterweatherman v1.0.0 h1:XHEdyB+EcvlqZamSM4ZOMGlc93t6AcsBEu9Gc1vn7yk= github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg= github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= github.com/spf13/viper v1.7.0 h1:xVKxvI7ouOI5I+U9s2eeiUfMaWBVoXA3AWskkrqK0VM= github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= @@ -254,9 +313,17 @@ github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= +github.com/syndtr/goleveldb v0.0.0-20180307113352-169b1b37be73/go.mod h1:Z4AUp2Km+PwemOoO/VB5AOx9XSsIItzFjoJlOSiYmn0= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= +github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= +github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= +github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= +github.com/yuin/gopher-lua v0.0.0-20190514113301-1cd887cd7036/go.mod h1:gqRgreBUhTSL0GeU64rtZ3Uq3wtjOa/TB2YfrtkCbVQ= +github.com/yuin/gopher-lua v0.0.0-20191128022950-c6266f4fe8d7/go.mod h1:gqRgreBUhTSL0GeU64rtZ3Uq3wtjOa/TB2YfrtkCbVQ= go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= +go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= +go.etcd.io/bbolt v1.3.4/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= @@ -264,9 +331,11 @@ go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/ go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550 h1:ObdrDkeb4kJdCP557AjRjq69pTHfNouLtWZG7j9rPN8= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -289,6 +358,7 @@ golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKG golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -317,11 +387,15 @@ golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181228144115-9a3f9b0469bb/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190204203706-41f3e6584952/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d h1:+R4KGOnez64A81RvjARKc4UT5/tI9ujCIVX+P5KiHuI= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -330,8 +404,14 @@ golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191008105621-543471e840be/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191010194322-b09406accb47/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200420163511-1957bb5e6d1f h1:gWF768j/LaZugp8dyS4UwsslYCYz9XgFxvlgsn0n9H8= golang.org/x/sys v0.0.0-20200420163511-1957bb5e6d1f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= @@ -342,6 +422,7 @@ golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20180318012157-96caea41033d/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -408,9 +489,11 @@ gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8 gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= +gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/ini.v1 v1.51.0 h1:AQvPpx3LzTDM0AjnIRlVFwFFGC+npRopjZxLJj6gdno= gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= diff --git a/object/types_test.go b/object/types_test.go index 0a7085f..d7b2db8 100644 --- a/object/types_test.go +++ b/object/types_test.go @@ -17,7 +17,7 @@ Object: SystemHeader: - ID=7e0b9c6c-aabc-4985-949e-2680e577b48b - CID=11111111111111111111111111111111 - - OwnerID=ALYeYC41emF6MrmUMc4a8obEPdgFhq9ran + - OwnerID=NQHKh7fKGieCPrPuiEkY58ucRFwWMyU1Mc - Version=1 - PayloadLength=1 - CreatedAt={UnixTime=1 Epoch=1} @@ -33,7 +33,7 @@ Object: - Type=Tombstone Value=MARKED - Type=Token - Value={ID=7e0b9c6c-aabc-4985-949e-2680e577b48b OwnerID=ALYeYC41emF6MrmUMc4a8obEPdgFhq9ran Verb=Search Address=11111111111111111111111111111111/7e0b9c6c-aabc-4985-949e-2680e577b48b Created=1 ValidUntil=2 SessionKey=010203040506 Signature=010203040506} + Value={ID=7e0b9c6c-aabc-4985-949e-2680e577b48b OwnerID=NQHKh7fKGieCPrPuiEkY58ucRFwWMyU1Mc Verb=Search Address=11111111111111111111111111111111/7e0b9c6c-aabc-4985-949e-2680e577b48b Created=1 ValidUntil=2 SessionKey=010203040506 Signature=010203040506} - Type=HomoHash Value=1111111111111111111111111111111111111111111111111111111111111111 - Type=PayloadChecksum diff --git a/refs/owner.go b/refs/owner.go index 1aed00c..d5924c8 100644 --- a/refs/owner.go +++ b/refs/owner.go @@ -9,18 +9,22 @@ import ( "github.com/pkg/errors" ) -// NewOwnerID returns generated OwnerID from passed public keys. -func NewOwnerID(keys ...*ecdsa.PublicKey) (owner OwnerID, err error) { - if len(keys) == 0 { +// NewOwnerID returns generated OwnerID from passed public key. +func NewOwnerID(key *ecdsa.PublicKey) (owner OwnerID, err error) { + if key == nil { return } + var d []byte - d, err = base58.Decode(chain.KeysToAddress(keys...)) + + d, err = base58.Decode(chain.KeyToAddress(key)) if err != nil { return } + copy(owner[:], d) - return owner, nil + + return } // Size returns OwnerID size in bytes (OwnerIDSize). diff --git a/refs/types_test.go b/refs/types_test.go index 2fd3ced..2ef9baf 100644 --- a/refs/types_test.go +++ b/refs/types_test.go @@ -66,7 +66,7 @@ func TestOwnerID(t *testing.T) { t.Run("check that marshal/unmarshal works like expected", func(t *testing.T) { var u1, u2 OwnerID - owner, err := NewOwnerID() + owner, err := NewOwnerID(nil) require.NoError(t, err) require.True(t, owner.Empty()) From befb34a9ffe459e220cf8659e305f5ec9cfe210b Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 23 Jul 2020 14:36:50 +0300 Subject: [PATCH 0253/1196] acl: refactor the package This commit: * replaces the wrappers of the messages to eacl sub-package; * renames Target to Group in eacl package; * defines Group constants; * replaces EACLTable message marshaler (unmarshaler) with custom MarshalTable (UnmarshalTable) of the Table. --- acl/extended/enum.go | 126 ++++++ acl/extended/marshal.go | 333 ++++++++++++++++ acl/{extended.go => extended/types.go} | 52 +-- acl/extended/wrappers.go | 528 +++++++++++++++++++++++++ acl/{ => extended}/wrappers_test.go | 49 ++- acl/types.go | 73 ---- acl/wrappers.go | 498 ----------------------- 7 files changed, 1026 insertions(+), 633 deletions(-) create mode 100644 acl/extended/enum.go create mode 100644 acl/extended/marshal.go rename acl/{extended.go => extended/types.go} (53%) create mode 100644 acl/extended/wrappers.go rename acl/{ => extended}/wrappers_test.go (75%) delete mode 100644 acl/wrappers.go diff --git a/acl/extended/enum.go b/acl/extended/enum.go new file mode 100644 index 0000000..e803476 --- /dev/null +++ b/acl/extended/enum.go @@ -0,0 +1,126 @@ +package eacl + +const ( + // MatchUnknown is a MatchType value used to mark value as undefined. + // Most of the tools consider MatchUnknown as incalculable. + // Using MatchUnknown in HeaderFilter is unsafe. + MatchUnknown MatchType = iota + + // StringEqual is a MatchType of string equality. + StringEqual + + // StringNotEqual is a MatchType of string inequality. + StringNotEqual +) + +const ( + // ActionUnknown is Action used to mark value as undefined. + // Most of the tools consider ActionUnknown as incalculable. + // Using ActionUnknown in Record is unsafe. + ActionUnknown Action = iota + + // ActionAllow is Action used to mark an applicability of ACL rule. + ActionAllow + + // ActionDeny is Action used to mark an inapplicability of ACL rule. + ActionDeny +) + +const ( + // GroupUnknown is a Group value used to mark value as undefined. + // Most of the tools consider GroupUnknown as incalculable. + // Using GroupUnknown in Target is unsafe. + GroupUnknown Group = iota + + // GroupUser is a Group value for User access group. + GroupUser + + // GroupSystem is a Group value for System access group. + GroupSystem + + // GroupOthers is a Group value for Others access group. + GroupOthers +) + +const ( + // HdrTypeUnknown is a HeaderType value used to mark value as undefined. + // Most of the tools consider HdrTypeUnknown as incalculable. + // Using HdrTypeUnknown in HeaderFilter is unsafe. + HdrTypeUnknown HeaderType = iota + + // HdrTypeRequest is a HeaderType for request header. + HdrTypeRequest + + // HdrTypeObjSys is a HeaderType for system headers of object. + HdrTypeObjSys + + // HdrTypeObjUsr is a HeaderType for user headers of object. + HdrTypeObjUsr +) + +const ( + // OpTypeUnknown is a OperationType value used to mark value as undefined. + // Most of the tools consider OpTypeUnknown as incalculable. + // Using OpTypeUnknown in Record is unsafe. + OpTypeUnknown OperationType = iota + + // OpTypeGet is an OperationType for object.Get RPC + OpTypeGet + + // OpTypePut is an OperationType for object.Put RPC + OpTypePut + + // OpTypeHead is an OperationType for object.Head RPC + OpTypeHead + + // OpTypeSearch is an OperationType for object.Search RPC + OpTypeSearch + + // OpTypeDelete is an OperationType for object.Delete RPC + OpTypeDelete + + // OpTypeRange is an OperationType for object.GetRange RPC + OpTypeRange + + // OpTypeRangeHash is an OperationType for object.GetRangeHash RPC + OpTypeRangeHash +) + +const ( + // HdrObjSysNameID is a name of ID field in system header of object. + HdrObjSysNameID = "ID" + + // HdrObjSysNameCID is a name of CID field in system header of object. + HdrObjSysNameCID = "CID" + + // HdrObjSysNameOwnerID is a name of OwnerID field in system header of object. + HdrObjSysNameOwnerID = "OWNER_ID" + + // HdrObjSysNameVersion is a name of Version field in system header of object. + HdrObjSysNameVersion = "VERSION" + + // HdrObjSysNamePayloadLength is a name of PayloadLength field in system header of object. + HdrObjSysNamePayloadLength = "PAYLOAD_LENGTH" + + // HdrObjSysNameCreatedUnix is a name of CreatedAt.UnitTime field in system header of object. + HdrObjSysNameCreatedUnix = "CREATED_UNIX" + + // HdrObjSysNameCreatedEpoch is a name of CreatedAt.Epoch field in system header of object. + HdrObjSysNameCreatedEpoch = "CREATED_EPOCH" + + // HdrObjSysLinkPrev is a name of previous link header in extended headers of object. + HdrObjSysLinkPrev = "LINK_PREV" + + // HdrObjSysLinkNext is a name of next link header in extended headers of object. + HdrObjSysLinkNext = "LINK_NEXT" + + // HdrObjSysLinkChild is a name of child link header in extended headers of object. + HdrObjSysLinkChild = "LINK_CHILD" + + // HdrObjSysLinkPar is a name of parent link header in extended headers of object. + HdrObjSysLinkPar = "LINK_PAR" + + // HdrObjSysLinkSG is a name of storage group link header in extended headers of object. + HdrObjSysLinkSG = "LINK_SG" +) + diff --git a/acl/extended/marshal.go b/acl/extended/marshal.go new file mode 100644 index 0000000..d1fac07 --- /dev/null +++ b/acl/extended/marshal.go @@ -0,0 +1,333 @@ +package eacl + +import ( + "encoding/binary" + + "github.com/pkg/errors" +) + +const ( + sliceLenSize = 2 // uint16 for len() + actionSize = 4 // uint32 + opTypeSize = 4 // uint32 + hdrTypeSize = 4 // uint32 + matchTypeSize = 4 // uint32 + targetSize = 4 // uint32 +) + +// MarshalTable encodes Table into a +// binary form and returns the result. +// +// If table is nil, empty slice is returned. +func MarshalTable(table Table) []byte { + if table == nil { + return make([]byte, 0) + } + + // allocate buffer + buf := make([]byte, tableBinSize(table)) + + records := table.Records() + + // write record number + binary.BigEndian.PutUint16(buf, uint16(len(records))) + off := sliceLenSize + + // write all records + for _, record := range records { + // write action + binary.BigEndian.PutUint32(buf[off:], uint32(record.Action())) + off += actionSize + + // write operation type + binary.BigEndian.PutUint32(buf[off:], uint32(record.OperationType())) + off += actionSize + + filters := record.HeaderFilters() + + // write filter number + binary.BigEndian.PutUint16(buf[off:], uint16(len(filters))) + off += sliceLenSize + + // write all filters + for _, filter := range filters { + // write header type + binary.BigEndian.PutUint32(buf[off:], uint32(filter.HeaderType())) + off += hdrTypeSize + + // write match type + binary.BigEndian.PutUint32(buf[off:], uint32(filter.MatchType())) + off += matchTypeSize + + // write header name size + name := []byte(filter.Name()) + binary.BigEndian.PutUint16(buf[off:], uint16(len(name))) + off += sliceLenSize + + // write header name bytes + off += copy(buf[off:], name) + + // write header value size + val := []byte(filter.Value()) + binary.BigEndian.PutUint16(buf[off:], uint16(len(val))) + off += sliceLenSize + + // write header value bytes + off += copy(buf[off:], val) + } + + targets := record.TargetList() + + // write target number + binary.BigEndian.PutUint16(buf[off:], uint16(len(targets))) + off += sliceLenSize + + // write all targets + for _, target := range targets { + // write target group + binary.BigEndian.PutUint32(buf[off:], uint32(target.Group())) + off += targetSize + + keys := target.KeyList() + + // write key number + binary.BigEndian.PutUint16(buf[off:], uint16(len(keys))) + off += sliceLenSize + + // write keys + for i := range keys { + // write key size + binary.BigEndian.PutUint16(buf[off:], uint16(len(keys[i]))) + off += sliceLenSize + + // write key bytes + off += copy(buf[off:], keys[i]) + } + } + } + + return buf +} + +// returns the size of Table in a binary format. +func tableBinSize(table Table) (sz int) { + sz = sliceLenSize // number of records + + records := table.Records() + ln := len(records) + + sz += ln * actionSize // action type of each record + sz += ln * opTypeSize // operation type of each record + + for _, record := range records { + sz += sliceLenSize // number of filters + + filters := record.HeaderFilters() + ln := len(filters) + + sz += ln * hdrTypeSize // header type of each filter + sz += ln * matchTypeSize // match type of each filter + + for _, filter := range filters { + sz += sliceLenSize // header name size + sz += len(filter.Name()) // header name bytes + + sz += sliceLenSize // header value size + sz += len(filter.Value()) // header value bytes + } + + sz += sliceLenSize // number of targets + + targets := record.TargetList() + ln = len(targets) + + sz += ln * targetSize // target group of each target + + for _, target := range targets { + sz += sliceLenSize // number of keys + + for _, key := range target.KeyList() { + sz += sliceLenSize // key size + sz += len(key) // key bytes + } + } + } + + return +} + +// UnmarshalTable unmarshals Table from +// a binary representation. +// +// If data is empty, table w/o records is returned. +func UnmarshalTable(data []byte) (Table, error) { + table := WrapTable(nil) + + if len(data) == 0 { + return table, nil + } + + // decode record number + if len(data) < sliceLenSize { + return nil, errors.New("could not decode record number") + } + + recordNum := binary.BigEndian.Uint16(data) + records := make([]Record, 0, recordNum) + + off := sliceLenSize + + // decode all records one by one + for i := uint16(0); i < recordNum; i++ { + record := WrapRecord(nil) + + // decode action + if len(data[off:]) < actionSize { + return nil, errors.Errorf("could not decode action of record #%d", i) + } + + record.SetAction(Action(binary.BigEndian.Uint32(data[off:]))) + off += actionSize + + // decode operation type + if len(data[off:]) < opTypeSize { + return nil, errors.Errorf("could not decode operation type of record #%d", i) + } + + record.SetOperationType(OperationType(binary.BigEndian.Uint32(data[off:]))) + off += opTypeSize + + // decode filter number + if len(data[off:]) < sliceLenSize { + return nil, errors.Errorf("could not decode filter number of record #%d", i) + } + + filterNum := binary.BigEndian.Uint16(data[off:]) + off += sliceLenSize + filters := make([]HeaderFilter, 0, filterNum) + + // decode filters one by one + for j := uint16(0); j < filterNum; j++ { + filter := WrapFilterInfo(nil) + + // decode header type + if len(data[off:]) < hdrTypeSize { + return nil, errors.Errorf("could not decode header type of filter #%d of record #%d", j, i) + } + + filter.SetHeaderType(HeaderType(binary.BigEndian.Uint32(data[off:])) ) + off += hdrTypeSize + + // decode match type + if len(data[off:]) < matchTypeSize { + return nil, errors.Errorf("could not decode match type of filter #%d of record #%d", j, i) + } + + filter.SetMatchType(MatchType(binary.BigEndian.Uint32(data[off:])) ) + off += matchTypeSize + + // decode header name size + if len(data[off:]) < sliceLenSize { + return nil, errors.Errorf("could not decode header name size of filter #%d of record #%d", j, i) + } + + hdrNameSize := int(binary.BigEndian.Uint16(data[off:])) + off += sliceLenSize + + // decode header name + if len(data[off:]) < hdrNameSize { + return nil, errors.Errorf("could not decode header name of filter #%d of record #%d", j, i) + } + + filter.SetName(string(data[off : off+hdrNameSize])) + + off += hdrNameSize + + // decode header value size + if len(data[off:]) < sliceLenSize { + return nil, errors.Errorf("could not decode header value size of filter #%d of record #%d", j, i) + } + + hdrValSize := int(binary.BigEndian.Uint16(data[off:])) + off += sliceLenSize + + // decode header value + if len(data[off:]) < hdrValSize { + return nil, errors.Errorf("could not decode header value of filter #%d of record #%d", j, i) + } + + filter.SetValue(string(data[off : off+hdrValSize])) + + off += hdrValSize + + filters = append(filters, filter) + } + + record.SetHeaderFilters(filters) + + // decode target number + if len(data[off:]) < sliceLenSize { + return nil, errors.Errorf("could not decode target number of record #%d", i) + } + + targetNum := int(binary.BigEndian.Uint16(data[off:])) + off += sliceLenSize + + targets := make([]Target, 0, targetNum) + + // decode targets one by one + for j := 0; j < targetNum; j++ { + target := WrapTarget(nil) + + // decode target group + if len(data[off:]) < targetSize { + return nil, errors.Errorf("could not decode target group of target #%d of record #%d", j, i) + } + + target.SetGroup( Group(binary.BigEndian.Uint32(data[off:])), ) + off += targetSize + + // decode key number + if len(data[off:]) < sliceLenSize { + return nil, errors.Errorf("could not decode key number of target #%d of record #%d", j, i) + } + + keyNum := int(binary.BigEndian.Uint16(data[off:])) + off += sliceLenSize + keys := make([][]byte, 0, keyNum) + + for k := 0; k < keyNum; k++ { + // decode key size + if len(data[off:]) < sliceLenSize { + return nil, errors.Errorf("could not decode size of key #%d target #%d of record #%d", k, j, i) + } + + keySz := int(binary.BigEndian.Uint16(data[off:])) + off += sliceLenSize + + // decode key + if len(data[off:]) < keySz { + return nil, errors.Errorf("could not decode key #%d target #%d of record #%d", k, j, i) + } + + key := make([]byte, keySz) + + off += copy(key, data[off:off+keySz]) + + keys = append(keys, key) + } + + target.SetKeyList(keys) + + targets = append(targets, target) + } + + record.SetTargetList(targets) + + records = append(records, record) + } + + table.SetRecords(records) + + return table, nil +} diff --git a/acl/extended.go b/acl/extended/types.go similarity index 53% rename from acl/extended.go rename to acl/extended/types.go index df8402a..6b1b74b 100644 --- a/acl/extended.go +++ b/acl/extended/types.go @@ -1,4 +1,4 @@ -package acl +package eacl // OperationType is an enumeration of operation types for extended ACL. type OperationType uint32 @@ -9,8 +9,11 @@ type HeaderType uint32 // MatchType is an enumeration of match types for extended ACL. type MatchType uint32 -// ExtendedACLAction is an enumeration of extended ACL actions. -type ExtendedACLAction uint32 +// Action is an enumeration of extended ACL actions. +type Action uint32 + +// Group is an enumeration of access groups. +type Group uint32 // Header is an interface of string key-value pair, type Header interface { @@ -37,17 +40,17 @@ type HeaderFilter interface { TypedHeader } -// ExtendedACLTarget is an interface of grouped information about extended ACL rule target. -type ExtendedACLTarget interface { +// Target is an interface of grouped information about extended ACL rule target. +type Target interface { // Must return ACL target type. - Target() Target + Group() Group // Must return public key list of ACL targets. KeyList() [][]byte } -// ExtendedACLRecord is an interface of record of extended ACL rule table. -type ExtendedACLRecord interface { +// Record is an interface of record of extended ACL rule table. +type Record interface { // Must return operation type of extended ACL rule. OperationType() OperationType @@ -55,39 +58,16 @@ type ExtendedACLRecord interface { HeaderFilters() []HeaderFilter // Must return target list of extended ACL rule. - TargetList() []ExtendedACLTarget + TargetList() []Target // Must return action of extended ACL rule. - Action() ExtendedACLAction + Action() Action } -// ExtendedACLTable is an interface of extended ACL table. -type ExtendedACLTable interface { +// Table is an interface of extended ACL table. +type Table interface { // Must return list of extended ACL rules. - Records() []ExtendedACLRecord + Records() []Record } -const ( - _ OperationType = iota - // OpTypeGet is an OperationType for object.Get RPC - OpTypeGet - - // OpTypePut is an OperationType for object.Put RPC - OpTypePut - - // OpTypeHead is an OperationType for object.Head RPC - OpTypeHead - - // OpTypeSearch is an OperationType for object.Search RPC - OpTypeSearch - - // OpTypeDelete is an OperationType for object.Delete RPC - OpTypeDelete - - // OpTypeRange is an OperationType for object.GetRange RPC - OpTypeRange - - // OpTypeRangeHash is an OperationType for object.GetRangeHash RPC - OpTypeRangeHash -) diff --git a/acl/extended/wrappers.go b/acl/extended/wrappers.go new file mode 100644 index 0000000..2c8ff2e --- /dev/null +++ b/acl/extended/wrappers.go @@ -0,0 +1,528 @@ +package eacl + +import ( + "github.com/nspcc-dev/neofs-api-go/acl" +) + +// FilterWrapper is a wrapper over acl.EACLRecord_FilterInfo pointer. +type FilterWrapper struct { + filter *acl.EACLRecord_FilterInfo +} + +// TargetWrapper is a wrapper over acl.EACLRecord_TargetInfo pointer. +type TargetWrapper struct { + target *acl.EACLRecord_TargetInfo +} + +// RecordWrapper is a wrapper over acl.EACLRecord pointer. +type RecordWrapper struct { + record *acl.EACLRecord +} + +// TableWrapper is a wrapper over acl.EACLTable pointer. +type TableWrapper struct { + table *acl.EACLTable +} + +// WrapFilterInfo wraps EACLRecord_FilterInfo pointer. +// +// If argument is nil, new EACLRecord_FilterInfo is initialized. +func WrapFilterInfo(v *acl.EACLRecord_FilterInfo) FilterWrapper { + if v == nil { + v = new(acl.EACLRecord_FilterInfo) + } + + return FilterWrapper{ + filter: v, + } +} + +// WrapTarget wraps EACLRecord_TargetInfo pointer. +// +// If argument is nil, new EACLRecord_TargetInfo is initialized. +func WrapTarget(v *acl.EACLRecord_TargetInfo) TargetWrapper { + if v == nil { + v = new(acl.EACLRecord_TargetInfo) + } + + return TargetWrapper{ + target: v, + } +} + +// WrapRecord wraps EACLRecord pointer. +// +// If argument is nil, new EACLRecord is initialized. +func WrapRecord(v *acl.EACLRecord) RecordWrapper { + if v == nil { + v = new(acl.EACLRecord) + } + + return RecordWrapper{ + record: v, + } +} + +// WrapTable wraps EACLTable pointer. +// +// If argument is nil, new EACLTable is initialized. +func WrapTable(v *acl.EACLTable) TableWrapper { + if v == nil { + v = new(acl.EACLTable) + } + + return TableWrapper{ + table: v, + } +} + +// MatchType returns the match type of the filter. +// +// If filter is not initialized, 0 returns. +// +// Returns 0 if MatchType is not one of: +// - EACLRecord_FilterInfo_StringEqual; +// - EACLRecord_FilterInfo_StringNotEqual. +func (s FilterWrapper) MatchType() (res MatchType) { + if s.filter != nil { + switch s.filter.GetMatchType() { + case acl.EACLRecord_FilterInfo_StringEqual: + res = StringEqual + case acl.EACLRecord_FilterInfo_StringNotEqual: + res = StringNotEqual + } + } + + return +} + +// SetMatchType sets the match type of the filter. +// +// If filter is not initialized, nothing changes. +// +// MatchType is set to EACLRecord_FilterInfo_MatchUnknown if argument is not one of: +// - StringEqual; +// - StringNotEqual. +func (s FilterWrapper) SetMatchType(v MatchType) { + if s.filter != nil { + switch v { + case StringEqual: + s.filter.SetMatchType(acl.EACLRecord_FilterInfo_StringEqual) + case StringNotEqual: + s.filter.SetMatchType(acl.EACLRecord_FilterInfo_StringNotEqual) + default: + s.filter.SetMatchType(acl.EACLRecord_FilterInfo_MatchUnknown) + } + } +} + +// Name returns the name of filtering header. +// +// If filter is not initialized, empty string returns. +func (s FilterWrapper) Name() string { + if s.filter == nil { + return "" + } + + return s.filter.GetHeaderName() +} + +// SetName sets the name of the filtering header. +// +// If filter is not initialized, nothing changes. +func (s FilterWrapper) SetName(v string) { + if s.filter != nil { + s.filter.SetHeaderName(v) + } +} + +// Value returns the value of filtering header. +// +// If filter is not initialized, empty string returns. +func (s FilterWrapper) Value() string { + if s.filter == nil { + return "" + } + + return s.filter.GetHeaderVal() +} + +// SetValue sets the value of filtering header. +// +// If filter is not initialized, nothing changes. +func (s FilterWrapper) SetValue(v string) { + if s.filter != nil { + s.filter.SetHeaderVal(v) + } +} + +// HeaderType returns the header type of the filter. +// +// If filter is not initialized, HdrTypeUnknown returns. +// +// Returns HdrTypeUnknown if Header is not one of: +// - EACLRecord_FilterInfo_Request; +// - EACLRecord_FilterInfo_ObjectSystem; +// - EACLRecord_FilterInfo_ObjectUser. +func (s FilterWrapper) HeaderType() (res HeaderType) { + res = HdrTypeUnknown + + if s.filter != nil { + switch s.filter.GetHeader() { + case acl.EACLRecord_FilterInfo_Request: + res = HdrTypeRequest + case acl.EACLRecord_FilterInfo_ObjectSystem: + res = HdrTypeObjSys + case acl.EACLRecord_FilterInfo_ObjectUser: + res = HdrTypeObjUsr + } + } + + return +} + +// SetHeaderType sets the header type of the filter. +// +// If filter is not initialized, nothing changes. +// +// Header is set to EACLRecord_FilterInfo_HeaderUnknown if argument is not one of: +// - HdrTypeRequest; +// - HdrTypeObjSys; +// - HdrTypeObjUsr. +func (s FilterWrapper) SetHeaderType(t HeaderType) { + if s.filter != nil { + switch t { + case HdrTypeRequest: + s.filter.SetHeader(acl.EACLRecord_FilterInfo_Request) + case HdrTypeObjSys: + s.filter.SetHeader(acl.EACLRecord_FilterInfo_ObjectSystem) + case HdrTypeObjUsr: + s.filter.SetHeader(acl.EACLRecord_FilterInfo_ObjectUser) + default: + s.filter.SetHeader(acl.EACLRecord_FilterInfo_HeaderUnknown) + } + } +} + +// Group returns the access group of the target. +// +// If target is not initialized, GroupUnknown returns. +// +// Returns GroupUnknown if Target is not one of: +// - Target_User; +// - GroupSystem; +// - GroupOthers. +func (s TargetWrapper) Group() (res Group) { + res = GroupUnknown + + if s.target != nil { + switch s.target.GetTarget() { + case acl.Target_User: + res = GroupUser + case acl.Target_System: + res = GroupSystem + case acl.Target_Others: + res = GroupOthers + } + } + + return +} + +// SetGroup sets the access group of the target. +// +// If target is not initialized, nothing changes. +// +// Target is set to Target_Unknown if argument is not one of: +// - GroupUser; +// - GroupSystem; +// - GroupOthers. +func (s TargetWrapper) SetGroup(g Group) { + if s.target != nil { + switch g { + case GroupUser: + s.target.SetTarget(acl.Target_User) + case GroupSystem: + s.target.SetTarget(acl.Target_System) + case GroupOthers: + s.target.SetTarget(acl.Target_Others) + default: + s.target.SetTarget(acl.Target_Unknown) + } + } +} + +// KeyList returns the key list of the target. +// +// If target is not initialized, nil returns. +func (s TargetWrapper) KeyList() [][]byte { + if s.target == nil { + return nil + } + + return s.target.GetKeyList() +} + +// SetKeyList sets the key list of the target. +// +// If target is not initialized, nothing changes. +func (s TargetWrapper) SetKeyList(v [][]byte) { + if s.target != nil { + s.target.SetKeyList(v) + } +} + +// OperationType returns the operation type of the record. +// +// If record is not initialized, OpTypeUnknown returns. +// +// Returns OpTypeUnknown if Operation is not one of: +// - EACLRecord_HEAD; +// - EACLRecord_PUT; +// - EACLRecord_SEARCH; +// - EACLRecord_GET; +// - EACLRecord_GETRANGE; +// - EACLRecord_GETRANGEHASH; +// - EACLRecord_DELETE. +func (s RecordWrapper) OperationType() (res OperationType) { + res = OpTypeUnknown + + if s.record != nil { + switch s.record.GetOperation() { + case acl.EACLRecord_HEAD: + res = OpTypeHead + case acl.EACLRecord_PUT: + res = OpTypePut + case acl.EACLRecord_SEARCH: + res = OpTypeSearch + case acl.EACLRecord_GET: + res = OpTypeGet + case acl.EACLRecord_GETRANGE: + res = OpTypeRange + case acl.EACLRecord_GETRANGEHASH: + res = OpTypeRangeHash + case acl.EACLRecord_DELETE: + res = OpTypeDelete + } + } + + return +} + +// SetOperationType sets the operation type of the record. +// +// If record is not initialized, nothing changes. +// +// Operation is set to EACLRecord_OPERATION_UNKNOWN if argument is not one of: +// - OpTypeHead; +// - OpTypePut; +// - OpTypeSearch; +// - OpTypeGet; +// - OpTypeRange; +// - OpTypeRangeHash; +// - OpTypeDelete. +func (s RecordWrapper) SetOperationType(v OperationType) { + if s.record != nil { + switch v { + case OpTypeHead: + s.record.SetOperation(acl.EACLRecord_HEAD) + case OpTypePut: + s.record.SetOperation(acl.EACLRecord_PUT) + case OpTypeSearch: + s.record.SetOperation(acl.EACLRecord_SEARCH) + case OpTypeGet: + s.record.SetOperation(acl.EACLRecord_GET) + case OpTypeRange: + s.record.SetOperation(acl.EACLRecord_GETRANGE) + case OpTypeRangeHash: + s.record.SetOperation(acl.EACLRecord_GETRANGEHASH) + case OpTypeDelete: + s.record.SetOperation(acl.EACLRecord_DELETE) + default: + s.record.SetOperation(acl.EACLRecord_OPERATION_UNKNOWN) + } + } +} + +// Action returns the action of the record. +// +// If record is not initialized, ActionUnknown returns. +// +// Returns ActionUnknown if Action is not one of: +// - EACLRecord_Deny; +// - EACLRecord_Allow. +func (s RecordWrapper) Action() (res Action) { + res = ActionUnknown + + if s.record != nil { + switch s.record.GetAction() { + case acl.EACLRecord_Deny: + res = ActionDeny + case acl.EACLRecord_Allow: + res = ActionAllow + } + } + + return +} + +// SetAction sets the action of the record. +// +// If record is not initialized, nothing changes. +// +// Action is set to EACLRecord_ActionUnknown if argument is not one of: +// - ActionDeny; +// - ActionAllow. +func (s RecordWrapper) SetAction(v Action) { + if s.record != nil { + switch v { + case ActionDeny: + s.record.SetAction(acl.EACLRecord_Deny) + case ActionAllow: + s.record.SetAction(acl.EACLRecord_Allow) + default: + s.record.SetAction(acl.EACLRecord_ActionUnknown) + } + } +} + +// HeaderFilters returns the header filter list of the record. +// +// If record is not initialized, nil returns. +func (s RecordWrapper) HeaderFilters() []HeaderFilter { + if s.record == nil { + return nil + } + + filters := s.record.GetFilters() + + res := make([]HeaderFilter, 0, len(filters)) + + for i := range filters { + res = append(res, WrapFilterInfo(filters[i])) + } + + return res +} + +// SetHeaderFilters sets the header filter list of the record. +// +// Ignores nil elements of argument. +// If record is not initialized, nothing changes. +func (s RecordWrapper) SetHeaderFilters(v []HeaderFilter) { + if s.record == nil { + return + } + + filters := make([]*acl.EACLRecord_FilterInfo, 0, len(v)) + + for i := range v { + if v[i] == nil { + continue + } + + w := WrapFilterInfo(nil) + w.SetMatchType(v[i].MatchType()) + w.SetHeaderType(v[i].HeaderType()) + w.SetName(v[i].Name()) + w.SetValue(v[i].Value()) + + filters = append(filters, w.filter) + } + + s.record.SetFilters(filters) +} + +// TargetList returns the target list of the record. +// +// If record is not initialized, nil returns. +func (s RecordWrapper) TargetList() []Target { + if s.record == nil { + return nil + } + + targets := s.record.GetTargets() + + res := make([]Target, 0, len(targets)) + + for i := range targets { + res = append(res, WrapTarget(targets[i])) + } + + return res +} + +// SetTargetList sets the target list of the record. +// +// Ignores nil elements of argument. +// If record is not initialized, nothing changes. +func (s RecordWrapper) SetTargetList(v []Target) { + if s.record == nil { + return + } + + targets := make([]*acl.EACLRecord_TargetInfo, 0, len(v)) + + for i := range v { + if v[i] == nil { + continue + } + + w := WrapTarget(nil) + w.SetGroup(v[i].Group()) + w.SetKeyList(v[i].KeyList()) + + targets = append(targets, w.target) + } + + s.record.SetTargets(targets) +} + +// Records returns the record list of the table. +// +// If table is not initialized, nil returns. +func (s TableWrapper) Records() []Record { + if s.table == nil { + return nil + } + + records := s.table.GetRecords() + + res := make([]Record, 0, len(records)) + + for i := range records { + res = append(res, WrapRecord(records[i])) + } + + return res +} + +// SetRecords sets the record list of the table. +// +// Ignores nil elements of argument. +// If table is not initialized, nothing changes. +func (s TableWrapper) SetRecords(v []Record) { + if s.table == nil { + return + } + + records := make([]*acl.EACLRecord, 0, len(v)) + + for i := range v { + if v[i] == nil { + continue + } + + w := WrapRecord(nil) + w.SetOperationType(v[i].OperationType()) + w.SetAction(v[i].Action()) + w.SetHeaderFilters(v[i].HeaderFilters()) + w.SetTargetList(v[i].TargetList()) + + records = append(records, w.record) + } + + s.table.SetRecords(records) +} + + diff --git a/acl/wrappers_test.go b/acl/extended/wrappers_test.go similarity index 75% rename from acl/wrappers_test.go rename to acl/extended/wrappers_test.go index b7dbbe0..b139e59 100644 --- a/acl/wrappers_test.go +++ b/acl/extended/wrappers_test.go @@ -1,4 +1,4 @@ -package acl +package eacl import ( "testing" @@ -27,11 +27,11 @@ func TestEACLFilterWrapper(t *testing.T) { } func TestEACLTargetWrapper(t *testing.T) { - s := WrapEACLTarget(nil) + s := WrapTarget(nil) - target := Target(10) - s.SetTarget(target) - require.Equal(t, target, s.Target()) + group := Group(3) + s.SetGroup(group) + require.Equal(t, group, s.Group()) keys := [][]byte{ {1, 2, 3}, @@ -42,7 +42,7 @@ func TestEACLTargetWrapper(t *testing.T) { } func TestEACLRecordWrapper(t *testing.T) { - s := WrapEACLRecord(nil) + s := WrapRecord(nil) action := ActionAllow s.SetAction(action) @@ -67,46 +67,43 @@ func TestEACLRecordWrapper(t *testing.T) { require.Equal(t, f1Name, filters[0].Name()) require.Equal(t, f2Name, filters[1].Name()) - target1 := Target(1) - t1 := WrapEACLTarget(nil) - t1.SetTarget(target1) + group1 := Group(1) + t1 := WrapTarget(nil) + t1.SetGroup(group1) - target2 := Target(2) - t2 := WrapEACLTarget(nil) - t2.SetTarget(target2) + group2 := Group(2) + t2 := WrapTarget(nil) + t2.SetGroup(group2) - s.SetTargetList([]ExtendedACLTarget{t1, t2}) + s.SetTargetList([]Target{t1, t2}) targets := s.TargetList() require.Len(t, targets, 2) - require.Equal(t, target1, targets[0].Target()) - require.Equal(t, target2, targets[1].Target()) + require.Equal(t, group1, targets[0].Group()) + require.Equal(t, group2, targets[1].Group()) } func TestEACLTableWrapper(t *testing.T) { - s := WrapEACLTable(nil) + s := WrapTable(nil) - action1 := ExtendedACLAction(1) - r1 := WrapEACLRecord(nil) + action1 := Action(1) + r1 := WrapRecord(nil) r1.SetAction(action1) - action2 := ExtendedACLAction(2) - r2 := WrapEACLRecord(nil) + action2 := Action(2) + r2 := WrapRecord(nil) r2.SetAction(action2) - s.SetRecords([]ExtendedACLRecord{r1, r2}) + s.SetRecords([]Record{r1, r2}) records := s.Records() require.Len(t, records, 2) require.Equal(t, action1, records[0].Action()) require.Equal(t, action2, records[1].Action()) - data, err := s.MarshalBinary() + s2, err := UnmarshalTable(MarshalTable(s)) require.NoError(t, err) - s2 := WrapEACLTable(nil) - require.NoError(t, s2.UnmarshalBinary(data)) - records1 := s.Records() records2 := s2.Records() require.Len(t, records1, len(records2)) @@ -120,7 +117,7 @@ func TestEACLTableWrapper(t *testing.T) { require.Len(t, targets1, len(targets2)) for j := range targets1 { - require.Equal(t, targets1[j].Target(), targets2[j].Target()) + require.Equal(t, targets1[j].Group(), targets2[j].Group()) require.Equal(t, targets1[j].KeyList(), targets2[j].KeyList()) } diff --git a/acl/types.go b/acl/types.go index c80c9cd..4aaf8fb 100644 --- a/acl/types.go +++ b/acl/types.go @@ -1,78 +1,5 @@ package acl -const ( - _ MatchType = iota - - // StringEqual is a MatchType of string equality. - StringEqual - - // StringNotEqual is a MatchType of string inequality. - StringNotEqual -) - -const ( - // ActionUndefined is ExtendedACLAction used to mark value as undefined. - // Most of the tools consider ActionUndefined as incalculable. - // Using ActionUndefined in ExtendedACLRecord is unsafe. - ActionUndefined ExtendedACLAction = iota - - // ActionAllow is ExtendedACLAction used to mark an applicability of ACL rule. - ActionAllow - - // ActionDeny is ExtendedACLAction used to mark an inapplicability of ACL rule. - ActionDeny -) - -const ( - _ HeaderType = iota - - // HdrTypeRequest is a HeaderType for request header. - HdrTypeRequest - - // HdrTypeObjSys is a HeaderType for system headers of object. - HdrTypeObjSys - - // HdrTypeObjUsr is a HeaderType for user headers of object. - HdrTypeObjUsr -) - -const ( - // HdrObjSysNameID is a name of ID field in system header of object. - HdrObjSysNameID = "ID" - - // HdrObjSysNameCID is a name of CID field in system header of object. - HdrObjSysNameCID = "CID" - - // HdrObjSysNameOwnerID is a name of OwnerID field in system header of object. - HdrObjSysNameOwnerID = "OWNER_ID" - - // HdrObjSysNameVersion is a name of Version field in system header of object. - HdrObjSysNameVersion = "VERSION" - - // HdrObjSysNamePayloadLength is a name of PayloadLength field in system header of object. - HdrObjSysNamePayloadLength = "PAYLOAD_LENGTH" - - // HdrObjSysNameCreatedUnix is a name of CreatedAt.UnitTime field in system header of object. - HdrObjSysNameCreatedUnix = "CREATED_UNIX" - - // HdrObjSysNameCreatedEpoch is a name of CreatedAt.Epoch field in system header of object. - HdrObjSysNameCreatedEpoch = "CREATED_EPOCH" - - // HdrObjSysLinkPrev is a name of previous link header in extended headers of object. - HdrObjSysLinkPrev = "LINK_PREV" - - // HdrObjSysLinkNext is a name of next link header in extended headers of object. - HdrObjSysLinkNext = "LINK_NEXT" - - // HdrObjSysLinkChild is a name of child link header in extended headers of object. - HdrObjSysLinkChild = "LINK_CHILD" - - // HdrObjSysLinkPar is a name of parent link header in extended headers of object. - HdrObjSysLinkPar = "LINK_PAR" - - // HdrObjSysLinkSG is a name of storage group link header in extended headers of object. - HdrObjSysLinkSG = "LINK_SG" -) // SetMatchType is MatchType field setter. func (m *EACLRecord_FilterInfo) SetMatchType(v EACLRecord_FilterInfo_MatchType) { diff --git a/acl/wrappers.go b/acl/wrappers.go deleted file mode 100644 index 30c2ee3..0000000 --- a/acl/wrappers.go +++ /dev/null @@ -1,498 +0,0 @@ -package acl - -// EACLFilterWrapper is a wrapper over EACLRecord_FilterInfo pointer. -type EACLFilterWrapper struct { - filter *EACLRecord_FilterInfo -} - -// EACLTargetWrapper is a wrapper over EACLRecord_TargetInfo pointer. -type EACLTargetWrapper struct { - target *EACLRecord_TargetInfo -} - -// EACLRecordWrapper is a wrapper over EACLRecord pointer. -type EACLRecordWrapper struct { - record *EACLRecord -} - -// EACLTableWrapper is a wrapper over EACLTable pointer. -type EACLTableWrapper struct { - table *EACLTable -} - -// WrapFilterInfo wraps EACLRecord_FilterInfo pointer. -// -// If argument is nil, new EACLRecord_FilterInfo is initialized. -func WrapFilterInfo(v *EACLRecord_FilterInfo) EACLFilterWrapper { - if v == nil { - v = new(EACLRecord_FilterInfo) - } - - return EACLFilterWrapper{ - filter: v, - } -} - -// WrapEACLTarget wraps EACLRecord_TargetInfo pointer. -// -// If argument is nil, new EACLRecord_TargetInfo is initialized. -func WrapEACLTarget(v *EACLRecord_TargetInfo) EACLTargetWrapper { - if v == nil { - v = new(EACLRecord_TargetInfo) - } - - return EACLTargetWrapper{ - target: v, - } -} - -// WrapEACLRecord wraps EACLRecord pointer. -// -// If argument is nil, new EACLRecord is initialized. -func WrapEACLRecord(v *EACLRecord) EACLRecordWrapper { - if v == nil { - v = new(EACLRecord) - } - - return EACLRecordWrapper{ - record: v, - } -} - -// WrapEACLTable wraps EACLTable pointer. -// -// If argument is nil, new EACLTable is initialized. -func WrapEACLTable(v *EACLTable) EACLTableWrapper { - if v == nil { - v = new(EACLTable) - } - - return EACLTableWrapper{ - table: v, - } -} - -// MatchType returns casted result of MatchType field getter. -// -// If filter is not initialized, 0 returns. -// -// Returns 0 if MatchType is not one of: -// - EACLRecord_FilterInfo_StringEqual; -// - EACLRecord_FilterInfo_StringNotEqual. -func (s EACLFilterWrapper) MatchType() (res MatchType) { - if s.filter != nil { - switch s.filter.GetMatchType() { - case EACLRecord_FilterInfo_StringEqual: - res = StringEqual - case EACLRecord_FilterInfo_StringNotEqual: - res = StringNotEqual - } - } - - return -} - -// SetMatchType passes casted argument to MatchType field setter. -// -// If filter is not initialized, nothing changes. -// -// MatchType is set to EACLRecord_FilterInfo_MatchUnknown if argument is not one of: -// - StringEqual; -// - StringNotEqual. -func (s EACLFilterWrapper) SetMatchType(v MatchType) { - if s.filter != nil { - switch v { - case StringEqual: - s.filter.SetMatchType(EACLRecord_FilterInfo_StringEqual) - case StringNotEqual: - s.filter.SetMatchType(EACLRecord_FilterInfo_StringNotEqual) - default: - s.filter.SetMatchType(EACLRecord_FilterInfo_MatchUnknown) - } - } -} - -// Name returns the result of HeaderName field getter. -// -// If filter is not initialized, empty string returns. -func (s EACLFilterWrapper) Name() string { - if s.filter == nil { - return "" - } - - return s.filter.GetHeaderName() -} - -// SetName passes argument to HeaderName field setter. -// -// If filter is not initialized, nothing changes. -func (s EACLFilterWrapper) SetName(v string) { - if s.filter != nil { - s.filter.SetHeaderName(v) - } -} - -// Value returns the result of HeaderVal field getter. -// -// If filter is not initialized, empty string returns. -func (s EACLFilterWrapper) Value() string { - if s.filter == nil { - return "" - } - - return s.filter.GetHeaderVal() -} - -// SetValue passes argument to HeaderVal field setter. -// -// If filter is not initialized, nothing changes. -func (s EACLFilterWrapper) SetValue(v string) { - if s.filter != nil { - s.filter.SetHeaderVal(v) - } -} - -// HeaderType returns the result of Header field getter. -// -// If filter is not initialized, 0 returns. -// -// Returns 0 if Header is not one of: -// - EACLRecord_FilterInfo_Request; -// - EACLRecord_FilterInfo_ObjectSystem; -// - EACLRecord_FilterInfo_ObjectUser. -func (s EACLFilterWrapper) HeaderType() (res HeaderType) { - if s.filter != nil { - switch s.filter.GetHeader() { - case EACLRecord_FilterInfo_Request: - res = HdrTypeRequest - case EACLRecord_FilterInfo_ObjectSystem: - res = HdrTypeObjSys - case EACLRecord_FilterInfo_ObjectUser: - res = HdrTypeObjUsr - } - } - - return -} - -// SetHeaderType passes casted argument to Header field setter. -// -// If filter is not initialized, nothing changes. -// -// Header is set to EACLRecord_FilterInfo_HeaderUnknown if argument is not one of: -// - HdrTypeRequest; -// - HdrTypeObjSys; -// - HdrTypeObjUsr. -func (s EACLFilterWrapper) SetHeaderType(t HeaderType) { - if s.filter != nil { - switch t { - case HdrTypeRequest: - s.filter.SetHeader(EACLRecord_FilterInfo_Request) - case HdrTypeObjSys: - s.filter.SetHeader(EACLRecord_FilterInfo_ObjectSystem) - case HdrTypeObjUsr: - s.filter.SetHeader(EACLRecord_FilterInfo_ObjectUser) - default: - s.filter.SetHeader(EACLRecord_FilterInfo_HeaderUnknown) - } - } -} - -// Target returns the result of Target field getter. -// -// If target is not initialized, Target_Unknown returns. -func (s EACLTargetWrapper) Target() Target { - if s.target == nil { - return Target_Unknown - } - - return s.target.GetTarget() -} - -// SetTarget passes argument to Target field setter. -// -// If target is not initialized, nothing changes. -func (s EACLTargetWrapper) SetTarget(v Target) { - if s.target != nil { - s.target.SetTarget(v) - } -} - -// KeyList returns the result of KeyList field getter. -// -// If target is not initialized, nil returns. -func (s EACLTargetWrapper) KeyList() [][]byte { - if s.target == nil { - return nil - } - - return s.target.GetKeyList() -} - -// SetKeyList passes argument to KeyList field setter. -// -// If target is not initialized, nothing changes. -func (s EACLTargetWrapper) SetKeyList(v [][]byte) { - if s.target != nil { - s.target.SetKeyList(v) - } -} - -// OperationType returns casted result of Operation field getter. -// -// If record is not initialized, 0 returns. -// -// Returns 0 if Operation is not one of: -// - EACLRecord_HEAD; -// - EACLRecord_PUT; -// - EACLRecord_SEARCH; -// - EACLRecord_GET; -// - EACLRecord_GETRANGE; -// - EACLRecord_GETRANGEHASH; -// - EACLRecord_DELETE. -func (s EACLRecordWrapper) OperationType() (res OperationType) { - if s.record != nil { - switch s.record.GetOperation() { - case EACLRecord_HEAD: - res = OpTypeHead - case EACLRecord_PUT: - res = OpTypePut - case EACLRecord_SEARCH: - res = OpTypeSearch - case EACLRecord_GET: - res = OpTypeGet - case EACLRecord_GETRANGE: - res = OpTypeRange - case EACLRecord_GETRANGEHASH: - res = OpTypeRangeHash - case EACLRecord_DELETE: - res = OpTypeDelete - } - } - - return -} - -// SetOperationType passes casted argument to Operation field setter. -// -// If record is not initialized, nothing changes. -// -// Operation is set to EACLRecord_OPERATION_UNKNOWN if argument is not one of: -// - OpTypeHead; -// - OpTypePut; -// - OpTypeSearch; -// - OpTypeGet; -// - OpTypeRange; -// - OpTypeRangeHash; -// - OpTypeDelete. -func (s EACLRecordWrapper) SetOperationType(v OperationType) { - if s.record != nil { - switch v { - case OpTypeHead: - s.record.SetOperation(EACLRecord_HEAD) - case OpTypePut: - s.record.SetOperation(EACLRecord_PUT) - case OpTypeSearch: - s.record.SetOperation(EACLRecord_SEARCH) - case OpTypeGet: - s.record.SetOperation(EACLRecord_GET) - case OpTypeRange: - s.record.SetOperation(EACLRecord_GETRANGE) - case OpTypeRangeHash: - s.record.SetOperation(EACLRecord_GETRANGEHASH) - case OpTypeDelete: - s.record.SetOperation(EACLRecord_DELETE) - default: - s.record.SetOperation(EACLRecord_OPERATION_UNKNOWN) - } - } -} - -// Action returns casted result of Action field getter. -// -// If record is not initialized, 0 returns. -// -// Returns 0 if Action is not one of: -// - EACLRecord_Deny; -// - EACLRecord_Allow. -func (s EACLRecordWrapper) Action() (res ExtendedACLAction) { - if s.record != nil { - switch s.record.GetAction() { - case EACLRecord_Deny: - res = ActionDeny - case EACLRecord_Allow: - res = ActionAllow - } - } - - return -} - -// SetAction passes casted argument to Action field setter. -// -// If record is not initialized, nothing changes. -// -// Action is set to EACLRecord_ActionUnknown if argument is not one of: -// - ActionDeny; -// - ActionAllow. -func (s EACLRecordWrapper) SetAction(v ExtendedACLAction) { - if s.record != nil { - switch v { - case ActionDeny: - s.record.SetAction(EACLRecord_Deny) - case ActionAllow: - s.record.SetAction(EACLRecord_Allow) - default: - s.record.SetAction(EACLRecord_ActionUnknown) - } - } -} - -// HeaderFilters wraps all elements from Filters field getter result and returns HeaderFilter list. -// -// If record is not initialized, nil returns. -func (s EACLRecordWrapper) HeaderFilters() []HeaderFilter { - if s.record == nil { - return nil - } - - filters := s.record.GetFilters() - - res := make([]HeaderFilter, 0, len(filters)) - - for i := range filters { - res = append(res, WrapFilterInfo(filters[i])) - } - - return res -} - -// SetHeaderFilters converts HeaderFilter list to EACLRecord_FilterInfo list and passes it to Filters field setter. -// -// Ignores nil elements of argument. -// If record is not initialized, nothing changes. -func (s EACLRecordWrapper) SetHeaderFilters(v []HeaderFilter) { - if s.record == nil { - return - } - - filters := make([]*EACLRecord_FilterInfo, 0, len(v)) - - for i := range v { - if v[i] == nil { - continue - } - - w := WrapFilterInfo(nil) - w.SetMatchType(v[i].MatchType()) - w.SetHeaderType(v[i].HeaderType()) - w.SetName(v[i].Name()) - w.SetValue(v[i].Value()) - - filters = append(filters, w.filter) - } - - s.record.SetFilters(filters) -} - -// TargetList wraps all elements from Targets field getter result and returns ExtendedACLTarget list. -// -// If record is not initialized, nil returns. -func (s EACLRecordWrapper) TargetList() []ExtendedACLTarget { - if s.record == nil { - return nil - } - - targets := s.record.GetTargets() - - res := make([]ExtendedACLTarget, 0, len(targets)) - - for i := range targets { - res = append(res, WrapEACLTarget(targets[i])) - } - - return res -} - -// SetTargetList converts ExtendedACLTarget list to EACLRecord_TargetInfo list and passes it to Targets field setter. -// -// Ignores nil elements of argument. -// If record is not initialized, nothing changes. -func (s EACLRecordWrapper) SetTargetList(v []ExtendedACLTarget) { - if s.record == nil { - return - } - - targets := make([]*EACLRecord_TargetInfo, 0, len(v)) - - for i := range v { - if v[i] == nil { - continue - } - - w := WrapEACLTarget(nil) - w.SetTarget(v[i].Target()) - w.SetKeyList(v[i].KeyList()) - - targets = append(targets, w.target) - } - - s.record.SetTargets(targets) -} - -// Records wraps all elements from Records field getter result and returns ExtendedACLRecord list. -// -// If table is not initialized, nil returns. -func (s EACLTableWrapper) Records() []ExtendedACLRecord { - if s.table == nil { - return nil - } - - records := s.table.GetRecords() - - res := make([]ExtendedACLRecord, 0, len(records)) - - for i := range records { - res = append(res, WrapEACLRecord(records[i])) - } - - return res -} - -// SetRecords converts ExtendedACLRecord list to EACLRecord list and passes it to Records field setter. -// -// Ignores nil elements of argument. -// If table is not initialized, nothing changes. -func (s EACLTableWrapper) SetRecords(v []ExtendedACLRecord) { - if s.table == nil { - return - } - - records := make([]*EACLRecord, 0, len(v)) - - for i := range v { - if v[i] == nil { - continue - } - - w := WrapEACLRecord(nil) - w.SetOperationType(v[i].OperationType()) - w.SetAction(v[i].Action()) - w.SetHeaderFilters(v[i].HeaderFilters()) - w.SetTargetList(v[i].TargetList()) - - records = append(records, w.record) - } - - s.table.SetRecords(records) -} - -// MarshalBinary returns the result of Marshal method. -func (s EACLTableWrapper) MarshalBinary() ([]byte, error) { - return s.table.Marshal() -} - -// UnmarshalBinary passes argument to Unmarshal method and returns its result. -func (s EACLTableWrapper) UnmarshalBinary(data []byte) error { - return s.table.Unmarshal(data) -} From e5ded9cd0f9e459708f99fc6549745f05748a2b7 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 23 Jul 2020 17:59:06 +0300 Subject: [PATCH 0254/1196] Update changelog and readme for v1.3.0 --- CHANGELOG.md | 9 +++++++++ README.md | 3 +++ 2 files changed, 12 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 898dcce..2cafb35 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,14 @@ # Changelog This is the changelog for NeoFS-API-Go +## [1.3.0] - 2020-07-23 + +### Changed + +- Format of ```refs.OwnerID``` based on NEO3. +- Binary format of extended ACL table. +- ```acl``` package structure. + ## [1.2.0] - 2020-07-08 ### Added @@ -375,3 +383,4 @@ Initial public release [1.0.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v0.7.6...v1.0.0 [1.1.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.0.0...v1.1.0 [1.2.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.1.0...v1.2.0 +[1.3.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.2.0...v1.3.0 diff --git a/README.md b/README.md index 4c768b2..31c87f6 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,9 @@ can be used for integration with NeoFS. [neofs-api-go v1.2.0]: https://github.com/nspcc-dev/neofs-api-go/releases/tag/v1.2.0 * [neofs-api-go v1.2.0] supports [neofs-api v1.2.0] +[neofs-api-go v1.3.0]: https://github.com/nspcc-dev/neofs-api-go/releases/tag/v1.3.0 +* [neofs-api-go v1.3.0] supports [neofs-api v1.2.0] + ## Description Repository contains 13 packages that implement NeoFS core structures. These From ed7879a89ed5c5f1ffe5105ca404976d769281a8 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Wed, 12 Aug 2020 12:49:11 +0300 Subject: [PATCH 0255/1196] Add script to prepare multiversion structure --- Makefile | 2 +- prepare.sh | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 1 deletion(-) create mode 100755 prepare.sh diff --git a/Makefile b/Makefile index 600586e..0847abe 100644 --- a/Makefile +++ b/Makefile @@ -47,7 +47,7 @@ docgen: deps done # Regenerate proto files: -protoc: deps +protoc: @echo "${B}${G}⇒ Cleanup old files ${R}" @find . -type f -name '*.pb.go' -not -path './vendor/*' -exec rm {} \; diff --git a/prepare.sh b/prepare.sh new file mode 100755 index 0000000..75af3e3 --- /dev/null +++ b/prepare.sh @@ -0,0 +1,47 @@ +#!/bin/bash + +prefix=v2 + +if [ -z "$1" ]; then + echo "usage: ./prepare.sh path/to/neofs-api" + exit 1 +fi + +API_GO_PATH=$(pwd) +API_PATH=$1 + +# MOVE FILES FROM API REPO +cd $API_PATH +ARGS=$(find ./ -name '*.proto') +for file in $ARGS; do + dir=$(dirname $file) + cp -r $dir $API_GO_PATH +done +cd $API_GO_PATH + +# MODIFY FILES +for file in $ARGS; do + TYPES=$(grep '^import' $file | sed 's/import\ \"\(.*\)\/.*/\1/' | sort | uniq) + PKG=$(grep '^package' $file | sed 's/package\ \(.*\);/\1/') + + TYPES=( "${TYPES[@]}" "${PKG[@]}") # merge two arrays + TYPES=$(printf "%s\n" "${TYPES[@]}" | sort | uniq) # left only uniq elemetns + + for t in $TYPES; do + sed -i "s/$t\./$t\.$prefix\./" $file + sed -i "s/$t\//$t\/$prefix\//" $file + done + + sed -i "s/^package\(.*\);/package\1.$prefix;/" $file + sed -i "s/go_package\(.*\)\";$/go_package\1\/$prefix\";/" $file + + dir=$(dirname $file) + mkdir $dir/v2 2>/dev/null + mv $file $dir/v2 +done + +# COMPILE +make protoc + +# REMOVE PROTO FILES +# TO BE DONE AS NEOFS-API WILL BE STABLE From 0a5d0ff1a2212af7100c98573fd375bf69dd1a3b Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Wed, 12 Aug 2020 09:37:59 +0300 Subject: [PATCH 0256/1196] Remove v1 code --- accounting/fixtures/cheque.sh | 8 - accounting/fixtures/cheque_data | Bin 650 -> 0 bytes accounting/service.go | 46 - accounting/service.pb.go | 776 ----- accounting/service.proto | 36 - accounting/sign.go | 167 - accounting/sign_test.go | 185 -- accounting/types.go | 453 --- accounting/types.pb.go | 3463 --------------------- accounting/types.proto | 125 - accounting/types_test.go | 193 -- accounting/withdraw.go | 35 - accounting/withdraw.pb.go | 2819 ----------------- accounting/withdraw.proto | 101 - acl/extended/enum.go | 126 - acl/extended/marshal.go | 333 -- acl/extended/types.go | 73 - acl/extended/wrappers.go | 528 ---- acl/extended/wrappers_test.go | 136 - acl/types.go | 57 - acl/types.pb.go | 1408 --------- acl/types.proto | 106 - bootstrap/service.go | 8 - bootstrap/service.pb.go | 628 ---- bootstrap/service.proto | 42 - bootstrap/sign.go | 46 - bootstrap/sign_test.go | 82 - bootstrap/types.go | 137 - bootstrap/types.pb.go | 705 ----- bootstrap/types.proto | 29 - bootstrap/types_test.go | 39 - chain/address.go | 30 - chain/address_test.go | 41 - container/service.go | 60 - container/service.pb.go | 3733 ----------------------- container/service.proto | 146 - container/sign.go | 194 -- container/sign_test.go | 187 -- container/types.go | 188 -- container/types.pb.go | 507 ---- container/types.proto | 24 - container/types_test.go | 162 - decimal/decimal.go | 110 - decimal/decimal.pb.go | 349 --- decimal/decimal.proto | 18 - decimal/decimal_test.go | 445 --- hash/hash.go | 106 - hash/hash_test.go | 166 - hash/hashesslice.go | 20 - hash/salt.go | 17 - internal/error.go | 7 - internal/proto.go | 19 - object/doc.go | 143 - object/extensions.go | 64 - object/service.go | 196 -- object/service.pb.go | 5050 ------------------------------- object/service.proto | 197 -- object/service_test.go | 43 - object/sg.go | 43 - object/sg_test.go | 88 - object/sign.go | 272 -- object/sign_test.go | 239 -- object/types.go | 422 --- object/types.pb.go | 3568 ---------------------- object/types.proto | 134 - object/types_test.go | 234 -- object/utils.go | 100 - object/utils_test.go | 53 - object/verification.go | 149 - object/verification_test.go | 144 - query/types.go | 43 - query/types.pb.go | 641 ---- query/types.proto | 33 - refs/address.go | 80 - refs/cid.go | 104 - refs/owner.go | 77 - refs/sgid.go | 14 - refs/types.go | 123 - refs/types.pb.go | 372 --- refs/types.proto | 19 - refs/types_test.go | 141 - refs/uuid.go | 84 - service/alias.go | 20 - service/bearer.go | 140 - service/bearer_test.go | 199 -- service/epoch.go | 11 - service/epoch_test.go | 21 - service/errors.go | 53 - service/meta.go | 131 - service/meta.pb.go | 1118 ------- service/meta.proto | 49 - service/meta_test.go | 99 - service/raw.go | 6 - service/raw_test.go | 24 - service/role.go | 37 - service/role_test.go | 23 - service/sign.go | 404 --- service/sign_test.go | 400 --- service/token.go | 265 -- service/token_test.go | 248 -- service/ttl.go | 63 - service/ttl_test.go | 99 - service/types.go | 317 -- service/utils.go | 18 - service/utils_test.go | 34 - service/verify.go | 174 -- service/verify.pb.go | 2225 -------------- service/verify.proto | 119 - service/verify_test.go | 140 - service/verify_test.pb.go | 572 ---- service/verify_test.proto | 18 - service/version.go | 11 - service/version_test.go | 21 - session/alias.go | 15 - session/create.go | 62 - session/create_test.go | 103 - session/errors.go | 19 - session/private.go | 67 - session/private_test.go | 76 - session/request.go | 62 - session/request_test.go | 92 - session/response.go | 16 - session/response_test.go | 27 - session/service.pb.go | 800 ----- session/service.proto | 39 - session/store.go | 64 - session/store_test.go | 111 - session/types.go | 80 - state/service.go | 88 - state/service.pb.go | 2811 ----------------- state/service.proto | 124 - state/service_test.go | 118 - state/sign.go | 67 - state/sign_test.go | 94 - state/types.go | 24 - state/types_test.go | 18 - storagegroup/storage.go | 39 - storagegroup/types.go | 97 - storagegroup/types.pb.go | 664 ---- storagegroup/types.proto | 36 - 140 files changed, 45161 deletions(-) delete mode 100755 accounting/fixtures/cheque.sh delete mode 100644 accounting/fixtures/cheque_data delete mode 100644 accounting/service.go delete mode 100644 accounting/service.pb.go delete mode 100644 accounting/service.proto delete mode 100644 accounting/sign.go delete mode 100644 accounting/sign_test.go delete mode 100644 accounting/types.go delete mode 100644 accounting/types.pb.go delete mode 100644 accounting/types.proto delete mode 100644 accounting/types_test.go delete mode 100644 accounting/withdraw.go delete mode 100644 accounting/withdraw.pb.go delete mode 100644 accounting/withdraw.proto delete mode 100644 acl/extended/enum.go delete mode 100644 acl/extended/marshal.go delete mode 100644 acl/extended/types.go delete mode 100644 acl/extended/wrappers.go delete mode 100644 acl/extended/wrappers_test.go delete mode 100644 acl/types.go delete mode 100644 acl/types.pb.go delete mode 100644 acl/types.proto delete mode 100644 bootstrap/service.go delete mode 100644 bootstrap/service.pb.go delete mode 100644 bootstrap/service.proto delete mode 100644 bootstrap/sign.go delete mode 100644 bootstrap/sign_test.go delete mode 100644 bootstrap/types.go delete mode 100644 bootstrap/types.pb.go delete mode 100644 bootstrap/types.proto delete mode 100644 bootstrap/types_test.go delete mode 100644 chain/address.go delete mode 100644 chain/address_test.go delete mode 100644 container/service.go delete mode 100644 container/service.pb.go delete mode 100644 container/service.proto delete mode 100644 container/sign.go delete mode 100644 container/sign_test.go delete mode 100644 container/types.go delete mode 100644 container/types.pb.go delete mode 100644 container/types.proto delete mode 100644 container/types_test.go delete mode 100644 decimal/decimal.go delete mode 100644 decimal/decimal.pb.go delete mode 100644 decimal/decimal.proto delete mode 100644 decimal/decimal_test.go delete mode 100644 hash/hash.go delete mode 100644 hash/hash_test.go delete mode 100644 hash/hashesslice.go delete mode 100644 hash/salt.go delete mode 100644 internal/error.go delete mode 100644 internal/proto.go delete mode 100644 object/doc.go delete mode 100644 object/extensions.go delete mode 100644 object/service.go delete mode 100644 object/service.pb.go delete mode 100644 object/service.proto delete mode 100644 object/service_test.go delete mode 100644 object/sg.go delete mode 100644 object/sg_test.go delete mode 100644 object/sign.go delete mode 100644 object/sign_test.go delete mode 100644 object/types.go delete mode 100644 object/types.pb.go delete mode 100644 object/types.proto delete mode 100644 object/types_test.go delete mode 100644 object/utils.go delete mode 100644 object/utils_test.go delete mode 100644 object/verification.go delete mode 100644 object/verification_test.go delete mode 100644 query/types.go delete mode 100644 query/types.pb.go delete mode 100644 query/types.proto delete mode 100644 refs/address.go delete mode 100644 refs/cid.go delete mode 100644 refs/owner.go delete mode 100644 refs/sgid.go delete mode 100644 refs/types.go delete mode 100644 refs/types.pb.go delete mode 100644 refs/types.proto delete mode 100644 refs/types_test.go delete mode 100644 refs/uuid.go delete mode 100644 service/alias.go delete mode 100644 service/bearer.go delete mode 100644 service/bearer_test.go delete mode 100644 service/epoch.go delete mode 100644 service/epoch_test.go delete mode 100644 service/errors.go delete mode 100644 service/meta.go delete mode 100644 service/meta.pb.go delete mode 100644 service/meta.proto delete mode 100644 service/meta_test.go delete mode 100644 service/raw.go delete mode 100644 service/raw_test.go delete mode 100644 service/role.go delete mode 100644 service/role_test.go delete mode 100644 service/sign.go delete mode 100644 service/sign_test.go delete mode 100644 service/token.go delete mode 100644 service/token_test.go delete mode 100644 service/ttl.go delete mode 100644 service/ttl_test.go delete mode 100644 service/types.go delete mode 100644 service/utils.go delete mode 100644 service/utils_test.go delete mode 100644 service/verify.go delete mode 100644 service/verify.pb.go delete mode 100644 service/verify.proto delete mode 100644 service/verify_test.go delete mode 100644 service/verify_test.pb.go delete mode 100644 service/verify_test.proto delete mode 100644 service/version.go delete mode 100644 service/version_test.go delete mode 100644 session/alias.go delete mode 100644 session/create.go delete mode 100644 session/create_test.go delete mode 100644 session/errors.go delete mode 100644 session/private.go delete mode 100644 session/private_test.go delete mode 100644 session/request.go delete mode 100644 session/request_test.go delete mode 100644 session/response.go delete mode 100644 session/response_test.go delete mode 100644 session/service.pb.go delete mode 100644 session/service.proto delete mode 100644 session/store.go delete mode 100644 session/store_test.go delete mode 100644 session/types.go delete mode 100644 state/service.go delete mode 100644 state/service.pb.go delete mode 100644 state/service.proto delete mode 100644 state/service_test.go delete mode 100644 state/sign.go delete mode 100644 state/sign_test.go delete mode 100644 state/types.go delete mode 100644 state/types_test.go delete mode 100644 storagegroup/storage.go delete mode 100644 storagegroup/types.go delete mode 100644 storagegroup/types.pb.go delete mode 100644 storagegroup/types.proto diff --git a/accounting/fixtures/cheque.sh b/accounting/fixtures/cheque.sh deleted file mode 100755 index 581402a..0000000 --- a/accounting/fixtures/cheque.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash - -CHEQUE=7849b02d01cc7f7734295fa815ea64ec4d2012e45b8781eb891723ba2703c53263e8d6e522dc32203339dcd8eee9c6b7439a00ea56fa00000000611e000000000000060003012d47e76210aec73be39ab3d186e0a40fe8d86bfa3d4fabfda57ba13b88f96a8ebe4360627a1326f13fb9516c0dbc4af90f116e44bd33f4d04a0d1633afa243ad4f2fa9cd933e7631a619b5132cec6983906aba757af5590434124b232a43e302f7528ce97c9a93558efe7d4f62577aabdf771c931f54a71be6ad21e7d9cc177744b4b9781cf0c29adb503f33d2df9f810ebf33a774849848984cf7e2bbebd48ef0cd8592fbf9b6aee1dc74803e31c95a02dbbd5fd9783f9ecbcbf444b5942f830368a6f5829fb2a34fa03d0308ae6b05f433f2904d9a852fed1f5d2eb598ca794770adb1ece9dccd1c7ad98f709cfb890e3bdd5973dcdd838111fae2efa4c3c09ea2133e5d7c6eac6ae24afcce46db7c9f4dc154f123c835adff4e0b7e19bcffda0340750b92789821683283bcb98e32b7e032b94f267b6964613fc31a7ce5813fddad8298f71dfdc4f9b3e353f969727af476d43b12a25727cf6b9c73ae7152266d995bec807068ad2156288c4d946aeb17ebca787d498a1b87b9dae1bcd935763403fef27f744e829131d0ec980829fafa51db1714c2761d9f78762c008c323e9d66db9b5086d355897e52fe065e14f1cc70334248349aa4c7a3e6e3dc8f8693b1511c73dc88e6d6e8b6c6c68de922f351b5b1543917af2f2a3588aebfbd1ff3fac6023e00f03a16e8707ce045eb42ee80d392451541ee510dc18e1c8befbac54d742648b58f379b5337d9b74c5a61afb8ef3db7f3eb0454d6823777b613a3ee22cd6ce47e4fa72170d49267b773cc09c123654e0bcd7278aa2ae1e7c85d049b557a3c -DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) - -echo $CHEQUE | xxd -p -r > $DIR/cheque_data - -exit 0 diff --git a/accounting/fixtures/cheque_data b/accounting/fixtures/cheque_data deleted file mode 100644 index a1530960f321d4d6d1cb7f11f9cf1de82006ffc4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 650 zcmV;50(Jd(Nw6&e%zt+@DPO1+>SXLqAQI$Thk@&f7bChS1I039=+@;T+%h0DIo#Op z>BhH1ngHrn`Tzg`0AU^g0000000sa90WC-8Vi2y!JL8(O(T3op59ruy`aMsp{iS=M zJBayej=n=+VtNxM@jtmyYz@3h`416pM7=Zg&`J#!Gq0jUtxqqh&67TMF{T-{6D;g$ zgOF;vb$az#1T+#$BPv7V0{2pk>3o`#RgV6BPhwYktKWAVlOI&48|JMc=h@5`cSN+g zcpUJ;n%hu6Gt%Fmfeybjr*wpvNSI9b;=AkAj_}QelKc6#uHoEtfIczFS_0d>U)gv+ zp3BShM75MJg9B)$^@5+Wqfekc0|>5b1@trWkWHF}FYO;)F147-c}H-qvFz#G%^Z5! zk8qs(i4Hs6S##XogMktH;_sxxz@DNLK3#lntZL#){LV((e4kChRPiIoHLd?n3w{~A z|JnmUbqkVsm?3B~gS@$pGPmF|xlbm0X=GtP!y0_$fj`}?f|&Om{lxjR<5T%*a(eW3 z)H@QQS0~SFoO7;mQYLMgTkL>vXssbuD2z>%YU>y4%6NTAiW`Ty+Tpy}HFh)u{_=lx zPJ)p!(CnB9Df;?R+ZPnVb{(I1b}RslGCrMV+nZ2^(^ZLnQvL>B6!FY(GeSr-nxx00 z=HuLthLf>T9CO@==GN%8#>S25BJ)wTu~a!1uP-V!h_1iAAM^Ug0zLrnIu__~eBedv zLhgXml0_9k?okcFjvR~cy2VX&CP=l9H=9#8*|$tuVXwIFJ-74g1XR|7H+QxZqwXTj kY~+4Vry+3El4rMb%n89GWljsta(JpL;pfO*1e;ZQJiRSO_W%F@ diff --git a/accounting/service.go b/accounting/service.go deleted file mode 100644 index 229707f..0000000 --- a/accounting/service.go +++ /dev/null @@ -1,46 +0,0 @@ -package accounting - -import ( - "github.com/nspcc-dev/neofs-api-go/decimal" - "github.com/nspcc-dev/neofs-api-go/internal" - "github.com/nspcc-dev/neofs-api-go/refs" -) - -type ( - // OwnerID type alias. - OwnerID = refs.OwnerID - - // Decimal type alias. - Decimal = decimal.Decimal - - // Filter is used to filter accounts by criteria. - Filter func(acc *Account) bool -) - -const ( - // ErrEmptyAddress is raised when passed Address is empty. - ErrEmptyAddress = internal.Error("empty address") - - // ErrEmptyLockTarget is raised when passed LockTarget is empty. - ErrEmptyLockTarget = internal.Error("empty lock target") - - // ErrEmptyContainerID is raised when passed CID is empty. - ErrEmptyContainerID = internal.Error("empty container ID") - - // ErrEmptyParentAddress is raised when passed ParentAddress is empty. - ErrEmptyParentAddress = internal.Error("empty parent address") -) - -// SumFunds goes through all accounts and sums up active funds. -func SumFunds(accounts []*Account) (res *decimal.Decimal) { - res = decimal.Zero.Copy() - - for i := range accounts { - if accounts[i] == nil { - continue - } - - res = res.Add(accounts[i].ActiveFunds) - } - return -} diff --git a/accounting/service.pb.go b/accounting/service.pb.go deleted file mode 100644 index 8dd146b..0000000 --- a/accounting/service.pb.go +++ /dev/null @@ -1,776 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: accounting/service.proto - -package accounting - -import ( - context "context" - fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/golang/protobuf/proto" - decimal "github.com/nspcc-dev/neofs-api-go/decimal" - service "github.com/nspcc-dev/neofs-api-go/service" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package - -type BalanceRequest struct { - // OwnerID is a wallet address - OwnerID OwnerID `protobuf:"bytes,1,opt,name=OwnerID,proto3,customtype=OwnerID" json:"OwnerID"` - // RequestMetaHeader contains information about request meta headers (should be embedded into message) - service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` - // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) - service.RequestVerificationHeader `protobuf:"bytes,99,opt,name=Verify,proto3,embedded=Verify" json:"Verify"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *BalanceRequest) Reset() { *m = BalanceRequest{} } -func (m *BalanceRequest) String() string { return proto.CompactTextString(m) } -func (*BalanceRequest) ProtoMessage() {} -func (*BalanceRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_7f9514b8f1d4c7fe, []int{0} -} -func (m *BalanceRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *BalanceRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *BalanceRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_BalanceRequest.Merge(m, src) -} -func (m *BalanceRequest) XXX_Size() int { - return m.Size() -} -func (m *BalanceRequest) XXX_DiscardUnknown() { - xxx_messageInfo_BalanceRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_BalanceRequest proto.InternalMessageInfo - -type BalanceResponse struct { - // Balance contains current account balance state - Balance *decimal.Decimal `protobuf:"bytes,1,opt,name=Balance,proto3" json:"Balance,omitempty"` - // LockAccounts contains information about locked funds. Locked funds appear - // when user pays for storage or withdraw assets. - LockAccounts []*Account `protobuf:"bytes,2,rep,name=LockAccounts,proto3" json:"LockAccounts,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *BalanceResponse) Reset() { *m = BalanceResponse{} } -func (m *BalanceResponse) String() string { return proto.CompactTextString(m) } -func (*BalanceResponse) ProtoMessage() {} -func (*BalanceResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_7f9514b8f1d4c7fe, []int{1} -} -func (m *BalanceResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *BalanceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *BalanceResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_BalanceResponse.Merge(m, src) -} -func (m *BalanceResponse) XXX_Size() int { - return m.Size() -} -func (m *BalanceResponse) XXX_DiscardUnknown() { - xxx_messageInfo_BalanceResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_BalanceResponse proto.InternalMessageInfo - -func (m *BalanceResponse) GetBalance() *decimal.Decimal { - if m != nil { - return m.Balance - } - return nil -} - -func (m *BalanceResponse) GetLockAccounts() []*Account { - if m != nil { - return m.LockAccounts - } - return nil -} - -func init() { - proto.RegisterType((*BalanceRequest)(nil), "accounting.BalanceRequest") - proto.RegisterType((*BalanceResponse)(nil), "accounting.BalanceResponse") -} - -func init() { proto.RegisterFile("accounting/service.proto", fileDescriptor_7f9514b8f1d4c7fe) } - -var fileDescriptor_7f9514b8f1d4c7fe = []byte{ - // 399 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x51, 0xcd, 0x8e, 0xd3, 0x30, - 0x18, 0x5c, 0x2f, 0x68, 0x17, 0xb9, 0x2b, 0x16, 0x99, 0x05, 0x45, 0x41, 0x4a, 0xab, 0x9e, 0x0a, - 0x22, 0x8e, 0x14, 0x0e, 0x70, 0x6d, 0x54, 0x21, 0x56, 0xe2, 0x67, 0x15, 0x24, 0x24, 0xb8, 0x39, - 0xee, 0xd7, 0x60, 0xb1, 0xb5, 0x43, 0xec, 0x04, 0xed, 0x9b, 0xf0, 0x0c, 0xbc, 0x02, 0x2f, 0xb0, - 0xc7, 0x1e, 0x11, 0x87, 0x0a, 0x85, 0x17, 0x41, 0x75, 0x9c, 0xa6, 0x05, 0x4e, 0xb6, 0x67, 0xbe, - 0x19, 0x8f, 0xc7, 0xd8, 0x63, 0x9c, 0xab, 0x4a, 0x1a, 0x21, 0xf3, 0x48, 0x43, 0x59, 0x0b, 0x0e, - 0xb4, 0x28, 0x95, 0x51, 0x04, 0xf7, 0x8c, 0x4f, 0x1c, 0x15, 0x2d, 0xc1, 0xb0, 0x96, 0xf7, 0xcf, - 0x3a, 0xac, 0x86, 0x52, 0x2c, 0xae, 0x1c, 0x7a, 0x6f, 0x0e, 0x5c, 0x2c, 0xd9, 0x65, 0xe4, 0x56, - 0x07, 0xdf, 0xdf, 0xb9, 0xc6, 0x5c, 0x15, 0xa0, 0x1d, 0x1e, 0xe6, 0xc2, 0x7c, 0xac, 0x32, 0xca, - 0xd5, 0x32, 0xca, 0x55, 0xae, 0x22, 0x0b, 0x67, 0xd5, 0xc2, 0x9e, 0xec, 0xc1, 0xee, 0xda, 0xf1, - 0xf1, 0x77, 0x84, 0x6f, 0x27, 0xec, 0x92, 0x49, 0x0e, 0x29, 0x7c, 0xae, 0x40, 0x1b, 0xf2, 0x10, - 0x1f, 0xbf, 0xf9, 0x22, 0xa1, 0x3c, 0x9f, 0x79, 0x68, 0x84, 0x26, 0x27, 0xc9, 0xe9, 0xf5, 0x7a, - 0x78, 0xf0, 0x73, 0x3d, 0xec, 0xe0, 0xb4, 0xdb, 0x90, 0x67, 0xf8, 0xe6, 0x2b, 0x30, 0xcc, 0xcb, - 0x46, 0x68, 0x32, 0x88, 0x7d, 0xda, 0xbd, 0xd7, 0x59, 0x6d, 0xb8, 0x17, 0xc0, 0xe6, 0x50, 0x26, - 0xb7, 0x36, 0x1e, 0xab, 0xf5, 0x10, 0xa5, 0x56, 0x41, 0x66, 0xf8, 0xe8, 0x9d, 0x7d, 0xa5, 0xc7, - 0xad, 0x76, 0xfc, 0xb7, 0xd6, 0xb2, 0x82, 0x33, 0x23, 0x94, 0xfc, 0xc7, 0xc3, 0x69, 0xc7, 0x35, - 0x3e, 0xdd, 0x86, 0xd7, 0x85, 0x92, 0x1a, 0xc8, 0x23, 0x7c, 0xec, 0x20, 0x9b, 0x7e, 0x10, 0xdf, - 0xa1, 0x5d, 0x71, 0xb3, 0x76, 0x4d, 0xbb, 0x01, 0xf2, 0x14, 0x9f, 0xbc, 0x54, 0xfc, 0xd3, 0xb4, - 0x6d, 0x52, 0x7b, 0x87, 0xa3, 0x1b, 0x93, 0x41, 0x7c, 0x97, 0xf6, 0xd5, 0x52, 0xc7, 0xa5, 0x7b, - 0x83, 0xf1, 0x05, 0xc6, 0xd3, 0xed, 0x0c, 0x49, 0xb6, 0x57, 0x12, 0x7f, 0x57, 0xbb, 0xdf, 0xab, - 0xff, 0xe0, 0xbf, 0x5c, 0x1b, 0x3b, 0x79, 0x7f, 0xdd, 0x04, 0x68, 0xd5, 0x04, 0xe8, 0x47, 0x13, - 0xa0, 0x5f, 0x4d, 0x80, 0xbe, 0xfe, 0x0e, 0x0e, 0x3e, 0x3c, 0xde, 0xf9, 0x4c, 0xa9, 0x0b, 0xce, - 0xc3, 0x39, 0xd4, 0x91, 0x04, 0xb5, 0xd0, 0x21, 0x2b, 0x44, 0x98, 0xab, 0xa8, 0xf7, 0xfc, 0x76, - 0x78, 0xf6, 0x1a, 0xd4, 0xf3, 0xb7, 0x74, 0x7a, 0x71, 0x4e, 0xfb, 0x78, 0xd9, 0x91, 0xfd, 0xe9, - 0x27, 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff, 0xc8, 0x81, 0x29, 0x02, 0x99, 0x02, 0x00, 0x00, -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 - -// AccountingClient is the client API for Accounting service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type AccountingClient interface { - // Balance returns current balance status of the NeoFS user - Balance(ctx context.Context, in *BalanceRequest, opts ...grpc.CallOption) (*BalanceResponse, error) -} - -type accountingClient struct { - cc *grpc.ClientConn -} - -func NewAccountingClient(cc *grpc.ClientConn) AccountingClient { - return &accountingClient{cc} -} - -func (c *accountingClient) Balance(ctx context.Context, in *BalanceRequest, opts ...grpc.CallOption) (*BalanceResponse, error) { - out := new(BalanceResponse) - err := c.cc.Invoke(ctx, "/accounting.Accounting/Balance", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// AccountingServer is the server API for Accounting service. -type AccountingServer interface { - // Balance returns current balance status of the NeoFS user - Balance(context.Context, *BalanceRequest) (*BalanceResponse, error) -} - -// UnimplementedAccountingServer can be embedded to have forward compatible implementations. -type UnimplementedAccountingServer struct { -} - -func (*UnimplementedAccountingServer) Balance(ctx context.Context, req *BalanceRequest) (*BalanceResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Balance not implemented") -} - -func RegisterAccountingServer(s *grpc.Server, srv AccountingServer) { - s.RegisterService(&_Accounting_serviceDesc, srv) -} - -func _Accounting_Balance_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(BalanceRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(AccountingServer).Balance(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/accounting.Accounting/Balance", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(AccountingServer).Balance(ctx, req.(*BalanceRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _Accounting_serviceDesc = grpc.ServiceDesc{ - ServiceName: "accounting.Accounting", - HandlerType: (*AccountingServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Balance", - Handler: _Accounting_Balance_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "accounting/service.proto", -} - -func (m *BalanceRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *BalanceRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *BalanceRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - { - size, err := m.RequestVerificationHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x6 - i-- - dAtA[i] = 0x9a - { - size, err := m.RequestMetaHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x6 - i-- - dAtA[i] = 0x92 - { - size := m.OwnerID.Size() - i -= size - if _, err := m.OwnerID.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *BalanceResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *BalanceResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *BalanceResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.LockAccounts) > 0 { - for iNdEx := len(m.LockAccounts) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.LockAccounts[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - if m.Balance != nil { - { - size, err := m.Balance.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func encodeVarintService(dAtA []byte, offset int, v uint64) int { - offset -= sovService(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *BalanceRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.OwnerID.Size() - n += 1 + l + sovService(uint64(l)) - l = m.RequestMetaHeader.Size() - n += 2 + l + sovService(uint64(l)) - l = m.RequestVerificationHeader.Size() - n += 2 + l + sovService(uint64(l)) - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *BalanceResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Balance != nil { - l = m.Balance.Size() - n += 1 + l + sovService(uint64(l)) - } - if len(m.LockAccounts) > 0 { - for _, e := range m.LockAccounts { - l = e.Size() - n += 1 + l + sovService(uint64(l)) - } - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func sovService(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozService(x uint64) (n int) { - return sovService(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *BalanceRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: BalanceRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: BalanceRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OwnerID", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.OwnerID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 98: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.RequestMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 99: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RequestVerificationHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.RequestVerificationHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *BalanceResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: BalanceResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: BalanceResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Balance", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Balance == nil { - m.Balance = &decimal.Decimal{} - } - if err := m.Balance.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field LockAccounts", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.LockAccounts = append(m.LockAccounts, &Account{}) - if err := m.LockAccounts[len(m.LockAccounts)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipService(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowService - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowService - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowService - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthService - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupService - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthService - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthService = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowService = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupService = fmt.Errorf("proto: unexpected end of group") -) diff --git a/accounting/service.proto b/accounting/service.proto deleted file mode 100644 index d1540c4..0000000 --- a/accounting/service.proto +++ /dev/null @@ -1,36 +0,0 @@ -syntax = "proto3"; -package accounting; -option go_package = "github.com/nspcc-dev/neofs-api-go/accounting"; -option csharp_namespace = "NeoFS.API.Accounting"; - -import "service/meta.proto"; -import "service/verify.proto"; -import "decimal/decimal.proto"; -import "accounting/types.proto"; -import "github.com/gogo/protobuf/gogoproto/gogo.proto"; - -option (gogoproto.stable_marshaler_all) = true; - -// Accounting is a service that provides access for accounting balance -// information -service Accounting { - // Balance returns current balance status of the NeoFS user - rpc Balance(BalanceRequest) returns (BalanceResponse); -} - -message BalanceRequest { - // OwnerID is a wallet address - bytes OwnerID = 1 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false]; - // RequestMetaHeader contains information about request meta headers (should be embedded into message) - service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; - // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) - service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; -} - -message BalanceResponse { - // Balance contains current account balance state - decimal.Decimal Balance = 1; - // LockAccounts contains information about locked funds. Locked funds appear - // when user pays for storage or withdraw assets. - repeated Account LockAccounts = 2; -} diff --git a/accounting/sign.go b/accounting/sign.go deleted file mode 100644 index 1eabed4..0000000 --- a/accounting/sign.go +++ /dev/null @@ -1,167 +0,0 @@ -package accounting - -import ( - "encoding/binary" - "io" - - "github.com/nspcc-dev/neofs-api-go/service" -) - -// SignedData returns payload bytes of the request. -func (m BalanceRequest) SignedData() ([]byte, error) { - return service.SignedDataFromReader(m) -} - -// SignedDataSize returns payload size of the request. -func (m BalanceRequest) SignedDataSize() int { - return m.GetOwnerID().Size() -} - -// ReadSignedData copies payload bytes to passed buffer. -// -// If the buffer size is insufficient, io.ErrUnexpectedEOF returns. -func (m BalanceRequest) ReadSignedData(p []byte) (int, error) { - sz := m.SignedDataSize() - if len(p) < sz { - return 0, io.ErrUnexpectedEOF - } - - copy(p, m.GetOwnerID().Bytes()) - - return sz, nil -} - -// SignedData returns payload bytes of the request. -func (m GetRequest) SignedData() ([]byte, error) { - return service.SignedDataFromReader(m) -} - -// SignedDataSize returns payload size of the request. -func (m GetRequest) SignedDataSize() int { - return m.GetID().Size() + m.GetOwnerID().Size() -} - -// ReadSignedData copies payload bytes to passed buffer. -// -// If the buffer size is insufficient, io.ErrUnexpectedEOF returns. -func (m GetRequest) ReadSignedData(p []byte) (int, error) { - sz := m.SignedDataSize() - if len(p) < sz { - return 0, io.ErrUnexpectedEOF - } - - var off int - - off += copy(p[off:], m.GetID().Bytes()) - - copy(p[off:], m.GetOwnerID().Bytes()) - - return sz, nil -} - -// SignedData returns payload bytes of the request. -func (m PutRequest) SignedData() ([]byte, error) { - return service.SignedDataFromReader(m) -} - -// SignedDataSize returns payload size of the request. -func (m PutRequest) SignedDataSize() (sz int) { - sz += m.GetOwnerID().Size() - - sz += m.GetMessageID().Size() - - sz += 8 - - if amount := m.GetAmount(); amount != nil { - sz += amount.Size() - } - - return -} - -// ReadSignedData copies payload bytes to passed buffer. -// -// If the buffer size is insufficient, io.ErrUnexpectedEOF returns. -func (m PutRequest) ReadSignedData(p []byte) (int, error) { - if len(p) < m.SignedDataSize() { - return 0, io.ErrUnexpectedEOF - } - - var off int - - off += copy(p[off:], m.GetOwnerID().Bytes()) - - off += copy(p[off:], m.GetMessageID().Bytes()) - - binary.BigEndian.PutUint64(p[off:], m.GetHeight()) - off += 8 - - if amount := m.GetAmount(); amount != nil { - n, err := amount.MarshalTo(p[off:]) - off += n - if err != nil { - return off + n, err - } - } - - return off, nil -} - -// SignedData returns payload bytes of the request. -func (m ListRequest) SignedData() ([]byte, error) { - return service.SignedDataFromReader(m) -} - -// SignedDataSize returns payload size of the request. -func (m ListRequest) SignedDataSize() int { - return m.GetOwnerID().Size() -} - -// ReadSignedData copies payload bytes to passed buffer. -// -// If the buffer size is insufficient, io.ErrUnexpectedEOF returns. -func (m ListRequest) ReadSignedData(p []byte) (int, error) { - sz := m.SignedDataSize() - if len(p) < sz { - return 0, io.ErrUnexpectedEOF - } - - copy(p, m.GetOwnerID().Bytes()) - - return sz, nil -} - -// SignedData returns payload bytes of the request. -func (m DeleteRequest) SignedData() ([]byte, error) { - return service.SignedDataFromReader(m) -} - -// SignedDataSize returns payload size of the request. -func (m DeleteRequest) SignedDataSize() (sz int) { - sz += m.GetID().Size() - - sz += m.GetOwnerID().Size() - - sz += m.GetMessageID().Size() - - return -} - -// ReadSignedData copies payload bytes to passed buffer. -// -// If the buffer size is insufficient, io.ErrUnexpectedEOF returns. -func (m DeleteRequest) ReadSignedData(p []byte) (int, error) { - if len(p) < m.SignedDataSize() { - return 0, io.ErrUnexpectedEOF - } - - var off int - - off += copy(p[off:], m.GetID().Bytes()) - - off += copy(p[off:], m.GetOwnerID().Bytes()) - - off += copy(p[off:], m.GetMessageID().Bytes()) - - return off, nil -} diff --git a/accounting/sign_test.go b/accounting/sign_test.go deleted file mode 100644 index ebc683b..0000000 --- a/accounting/sign_test.go +++ /dev/null @@ -1,185 +0,0 @@ -package accounting - -import ( - "testing" - - "github.com/nspcc-dev/neofs-api-go/decimal" - "github.com/nspcc-dev/neofs-api-go/service" - "github.com/nspcc-dev/neofs-crypto/test" - "github.com/stretchr/testify/require" -) - -func TestSignBalanceRequest(t *testing.T) { - sk := test.DecodeKey(0) - - type sigType interface { - service.RequestData - service.SignKeyPairAccumulator - service.SignKeyPairSource - SetToken(*service.Token) - } - - items := []struct { - constructor func() sigType - payloadCorrupt []func(sigType) - }{ - { // BalanceRequest - constructor: func() sigType { - return new(BalanceRequest) - }, - payloadCorrupt: []func(sigType){ - func(s sigType) { - req := s.(*BalanceRequest) - - owner := req.GetOwnerID() - owner[0]++ - - req.SetOwnerID(owner) - }, - }, - }, - { // GetRequest - constructor: func() sigType { - return new(GetRequest) - }, - payloadCorrupt: []func(sigType){ - func(s sigType) { - req := s.(*GetRequest) - - id, err := NewChequeID() - require.NoError(t, err) - - req.SetID(id) - }, - func(s sigType) { - req := s.(*GetRequest) - - id := req.GetOwnerID() - id[0]++ - - req.SetOwnerID(id) - }, - }, - }, - { // PutRequest - constructor: func() sigType { - req := new(PutRequest) - - amount := decimal.New(1) - req.SetAmount(amount) - - return req - }, - payloadCorrupt: []func(sigType){ - func(s sigType) { - req := s.(*PutRequest) - - owner := req.GetOwnerID() - owner[0]++ - - req.SetOwnerID(owner) - }, - func(s sigType) { - req := s.(*PutRequest) - - mid := req.GetMessageID() - mid[0]++ - - req.SetMessageID(mid) - }, - func(s sigType) { - req := s.(*PutRequest) - - req.SetHeight(req.GetHeight() + 1) - }, - func(s sigType) { - req := s.(*PutRequest) - - amount := req.GetAmount() - if amount == nil { - req.SetAmount(decimal.New(0)) - } else { - req.SetAmount(amount.Add(decimal.New(amount.GetValue()))) - } - }, - }, - }, - { // ListRequest - constructor: func() sigType { - return new(ListRequest) - }, - payloadCorrupt: []func(sigType){ - func(s sigType) { - req := s.(*ListRequest) - - owner := req.GetOwnerID() - owner[0]++ - - req.SetOwnerID(owner) - }, - }, - }, - { - constructor: func() sigType { - return new(DeleteRequest) - }, - payloadCorrupt: []func(sigType){ - func(s sigType) { - req := s.(*DeleteRequest) - - id, err := NewChequeID() - require.NoError(t, err) - - req.SetID(id) - }, - func(s sigType) { - req := s.(*DeleteRequest) - - owner := req.GetOwnerID() - owner[0]++ - - req.SetOwnerID(owner) - }, - func(s sigType) { - req := s.(*DeleteRequest) - - mid := req.GetMessageID() - mid[0]++ - - req.SetMessageID(mid) - }, - }, - }, - } - - for _, item := range items { - { // token corruptions - v := item.constructor() - - token := new(service.Token) - v.SetToken(token) - - require.NoError(t, service.SignRequestData(sk, v)) - - require.NoError(t, service.VerifyRequestData(v)) - - token.SetSessionKey(append(token.GetSessionKey(), 1)) - - require.Error(t, service.VerifyRequestData(v)) - } - - { // payload corruptions - for _, corruption := range item.payloadCorrupt { - v := item.constructor() - - require.NoError(t, service.SignRequestData(sk, v)) - - require.NoError(t, service.VerifyRequestData(v)) - - corruption(v) - - require.Error(t, service.VerifyRequestData(v)) - } - } - } -} diff --git a/accounting/types.go b/accounting/types.go deleted file mode 100644 index e16fa99..0000000 --- a/accounting/types.go +++ /dev/null @@ -1,453 +0,0 @@ -package accounting - -import ( - "crypto/ecdsa" - "crypto/rand" - "encoding/binary" - "reflect" - - "github.com/mr-tron/base58" - "github.com/nspcc-dev/neofs-api-go/chain" - "github.com/nspcc-dev/neofs-api-go/decimal" - "github.com/nspcc-dev/neofs-api-go/internal" - "github.com/nspcc-dev/neofs-api-go/refs" - crypto "github.com/nspcc-dev/neofs-crypto" - "github.com/pkg/errors" -) - -type ( - // Cheque structure that describes a user request for withdrawal of funds. - Cheque struct { - ID ChequeID - Owner refs.OwnerID - Amount *decimal.Decimal - Height uint64 - Signatures []ChequeSignature - } - - // BalanceReceiver interface that is used to retrieve user balance by address. - BalanceReceiver interface { - Balance(accountAddress string) (*Account, error) - } - - // ChequeID is identifier of user request for withdrawal of funds. - ChequeID string - - // CID type alias. - CID = refs.CID - - // SGID type alias. - SGID = refs.SGID - - // ChequeSignature contains public key and hash, and is used to verify signatures. - ChequeSignature struct { - Key *ecdsa.PublicKey - Hash []byte - } -) - -const ( - // ErrWrongSignature is raised when wrong signature is passed. - ErrWrongSignature = internal.Error("wrong signature") - - // ErrWrongPublicKey is raised when wrong public key is passed. - ErrWrongPublicKey = internal.Error("wrong public key") - - // ErrWrongChequeData is raised when passed bytes cannot not be parsed as valid Cheque. - ErrWrongChequeData = internal.Error("wrong cheque data") - - // ErrInvalidLength is raised when passed bytes cannot not be parsed as valid ChequeID. - ErrInvalidLength = internal.Error("invalid length") - - u16size = 2 - u64size = 8 - - signaturesOffset = chain.AddressLength + refs.OwnerIDSize + u64size + u64size -) - -// NewChequeID generates valid random ChequeID using crypto/rand.Reader. -func NewChequeID() (ChequeID, error) { - d := make([]byte, chain.AddressLength) - if _, err := rand.Read(d); err != nil { - return "", err - } - - id := base58.Encode(d) - - return ChequeID(id), nil -} - -// String returns string representation of ChequeID. -func (b ChequeID) String() string { return string(b) } - -// Empty returns true, if ChequeID is empty. -func (b ChequeID) Empty() bool { return len(b) == 0 } - -// Valid validates ChequeID. -func (b ChequeID) Valid() bool { - d, err := base58.Decode(string(b)) - return err == nil && len(d) == chain.AddressLength -} - -// Bytes returns bytes representation of ChequeID. -func (b ChequeID) Bytes() []byte { - d, err := base58.Decode(string(b)) - if err != nil { - return make([]byte, chain.AddressLength) - } - return d -} - -// Equal checks that current ChequeID is equal to passed ChequeID. -func (b ChequeID) Equal(b2 ChequeID) bool { - return b.Valid() && b2.Valid() && string(b) == string(b2) -} - -// Unmarshal tries to parse []byte into valid ChequeID. -func (b *ChequeID) Unmarshal(data []byte) error { - *b = ChequeID(base58.Encode(data)) - if !b.Valid() { - return ErrInvalidLength - } - return nil -} - -// Size returns size (chain.AddressLength). -func (b ChequeID) Size() int { - return chain.AddressLength -} - -// MarshalTo tries to marshal ChequeID into passed bytes and returns -// count of copied bytes or error, if bytes len is not enough to contain ChequeID. -func (b ChequeID) MarshalTo(data []byte) (int, error) { - if len(data) < chain.AddressLength { - return 0, ErrInvalidLength - } - return copy(data, b.Bytes()), nil -} - -// Equals checks that m and tx are valid and equal Tx values. -func (m Tx) Equals(tx Tx) bool { - return m.From == tx.From && - m.To == tx.To && - m.Type == tx.Type && - m.Amount == tx.Amount -} - -// Verify validates current Cheque and Signatures that are generated for current Cheque. -func (b Cheque) Verify() error { - data := b.marshalBody() - for i, sign := range b.Signatures { - if err := crypto.VerifyRFC6979(sign.Key, data, sign.Hash); err != nil { - return errors.Wrapf(ErrWrongSignature, "item #%d: %s", i, err.Error()) - } - } - - return nil -} - -// Sign is used to sign current Cheque and stores result inside b.Signatures. -func (b *Cheque) Sign(key *ecdsa.PrivateKey) error { - hash, err := crypto.SignRFC6979(key, b.marshalBody()) - if err != nil { - return err - } - - b.Signatures = append(b.Signatures, ChequeSignature{ - Key: &key.PublicKey, - Hash: hash, - }) - - return nil -} - -func (b *Cheque) marshalBody() []byte { - buf := make([]byte, signaturesOffset) - - var offset int - - offset += copy(buf, b.ID.Bytes()) - offset += copy(buf[offset:], b.Owner.Bytes()) - - binary.LittleEndian.PutUint64(buf[offset:], uint64(b.Amount.Value)) - offset += u64size - - binary.LittleEndian.PutUint64(buf[offset:], b.Height) - - return buf -} - -func (b *Cheque) unmarshalBody(buf []byte) error { - var offset int - - if len(buf) < signaturesOffset { - return ErrWrongChequeData - } - - { // unmarshal UUID - if err := b.ID.Unmarshal(buf[offset : offset+chain.AddressLength]); err != nil { - return err - } - offset += chain.AddressLength - } - - { // unmarshal OwnerID - if err := b.Owner.Unmarshal(buf[offset : offset+refs.OwnerIDSize]); err != nil { - return err - } - offset += refs.OwnerIDSize - } - - { // unmarshal amount - amount := int64(binary.LittleEndian.Uint64(buf[offset:])) - b.Amount = decimal.New(amount) - offset += u64size - } - - { // unmarshal height - b.Height = binary.LittleEndian.Uint64(buf[offset:]) - offset += u64size - } - - return nil -} - -// MarshalBinary is used to marshal Cheque into bytes. -func (b Cheque) MarshalBinary() ([]byte, error) { - var ( - count = len(b.Signatures) - buf = make([]byte, b.Size()) - offset = copy(buf, b.marshalBody()) - ) - - binary.LittleEndian.PutUint16(buf[offset:], uint16(count)) - offset += u16size - - for _, sign := range b.Signatures { - key := crypto.MarshalPublicKey(sign.Key) - offset += copy(buf[offset:], key) - offset += copy(buf[offset:], sign.Hash) - } - - return buf, nil -} - -// Size returns size of Cheque (count of bytes needs to store it). -func (b Cheque) Size() int { - return signaturesOffset + u16size + - len(b.Signatures)*(crypto.PublicKeyCompressedSize+crypto.RFC6979SignatureSize) -} - -// UnmarshalBinary tries to parse []byte into valid Cheque. -func (b *Cheque) UnmarshalBinary(buf []byte) error { - if err := b.unmarshalBody(buf); err != nil { - return err - } - - body := buf[:signaturesOffset] - - count := int64(binary.LittleEndian.Uint16(buf[signaturesOffset:])) - offset := signaturesOffset + u16size - - if ln := count * int64(crypto.PublicKeyCompressedSize+crypto.RFC6979SignatureSize); ln > int64(len(buf[offset:])) { - return ErrWrongChequeData - } - - for i := int64(0); i < count; i++ { - sign := ChequeSignature{ - Key: crypto.UnmarshalPublicKey(buf[offset : offset+crypto.PublicKeyCompressedSize]), - Hash: make([]byte, crypto.RFC6979SignatureSize), - } - - offset += crypto.PublicKeyCompressedSize - if sign.Key == nil { - return errors.Wrapf(ErrWrongPublicKey, "item #%d", i) - } - - offset += copy(sign.Hash, buf[offset:offset+crypto.RFC6979SignatureSize]) - if err := crypto.VerifyRFC6979(sign.Key, body, sign.Hash); err != nil { - return errors.Wrapf(ErrWrongSignature, "item #%d: %s (offset=%d, len=%d)", i, err.Error(), offset, len(sign.Hash)) - } - - b.Signatures = append(b.Signatures, sign) - } - - return nil -} - -// ErrNotEnoughFunds generates error using address and amounts. -func ErrNotEnoughFunds(addr string, needed, residue *decimal.Decimal) error { - return errors.Errorf("not enough funds (requested=%s, residue=%s, addr=%s", needed, residue, addr) -} - -func (m *Account) hasLockAcc(addr string) bool { - for i := range m.LockAccounts { - if m.LockAccounts[i].Address == addr { - return true - } - } - return false -} - -// ValidateLock checks that account can be locked. -func (m *Account) ValidateLock() error { - switch { - case m.Address == "": - return ErrEmptyAddress - case m.ParentAddress == "": - return ErrEmptyParentAddress - case m.LockTarget == nil: - return ErrEmptyLockTarget - } - - switch v := m.LockTarget.Target.(type) { - case *LockTarget_WithdrawTarget: - if v.WithdrawTarget.Cheque != m.Address { - return errors.Errorf("wrong cheque ID: expected %s, has %s", m.Address, v.WithdrawTarget.Cheque) - } - case *LockTarget_ContainerCreateTarget: - switch { - case v.ContainerCreateTarget.CID.Empty(): - return ErrEmptyContainerID - } - } - return nil -} - -// CanLock checks possibility to lock funds. -func (m *Account) CanLock(lockAcc *Account) error { - switch { - case m.ActiveFunds.LT(lockAcc.ActiveFunds): - return ErrNotEnoughFunds(lockAcc.ParentAddress, lockAcc.ActiveFunds, m.ActiveFunds) - case m.hasLockAcc(lockAcc.Address): - return errors.Errorf("could not lock account(%s) funds: duplicating lock(%s)", m.Address, lockAcc.Address) - default: - return nil - } -} - -// LockForWithdraw checks that account contains locked funds by passed ChequeID. -func (m *Account) LockForWithdraw(chequeID string) bool { - switch v := m.LockTarget.Target.(type) { - case *LockTarget_WithdrawTarget: - return v.WithdrawTarget.Cheque == chequeID - } - return false -} - -// LockForContainerCreate checks that account contains locked funds for container creation. -func (m *Account) LockForContainerCreate(cid refs.CID) bool { - switch v := m.LockTarget.Target.(type) { - case *LockTarget_ContainerCreateTarget: - return v.ContainerCreateTarget.CID.Equal(cid) - } - return false -} - -// Equal checks that current Settlement is equal to passed Settlement. -func (m *Settlement) Equal(s *Settlement) bool { - if s == nil || m.Epoch != s.Epoch || len(m.Transactions) != len(s.Transactions) { - return false - } - return len(m.Transactions) == 0 || reflect.DeepEqual(m.Transactions, s.Transactions) -} - -// GetOwnerID is an OwnerID field getter. -func (m BalanceRequest) GetOwnerID() OwnerID { - return m.OwnerID -} - -// SetOwnerID is an OwnerID field setter. -func (m *BalanceRequest) SetOwnerID(owner OwnerID) { - m.OwnerID = owner -} - -// GetID is an ID field getter. -func (m GetRequest) GetID() ChequeID { - return m.ID -} - -// SetID is an ID field setter. -func (m *GetRequest) SetID(id ChequeID) { - m.ID = id -} - -// GetOwnerID is an OwnerID field getter. -func (m GetRequest) GetOwnerID() OwnerID { - return m.OwnerID -} - -// SetOwnerID is an OwnerID field setter. -func (m *GetRequest) SetOwnerID(id OwnerID) { - m.OwnerID = id -} - -// GetOwnerID is an OwnerID field getter. -func (m PutRequest) GetOwnerID() OwnerID { - return m.OwnerID -} - -// SetOwnerID is an OwnerID field setter. -func (m *PutRequest) SetOwnerID(id OwnerID) { - m.OwnerID = id -} - -// GetMessageID is a MessageID field getter. -func (m PutRequest) GetMessageID() MessageID { - return m.MessageID -} - -// SetMessageID is a MessageID field setter. -func (m *PutRequest) SetMessageID(id MessageID) { - m.MessageID = id -} - -// SetAmount is an Amount field setter. -func (m *PutRequest) SetAmount(amount *decimal.Decimal) { - m.Amount = amount -} - -// SetHeight is a Height field setter. -func (m *PutRequest) SetHeight(h uint64) { - m.Height = h -} - -// GetOwnerID is an OwnerID field getter. -func (m ListRequest) GetOwnerID() OwnerID { - return m.OwnerID -} - -// SetOwnerID is an OwnerID field setter. -func (m *ListRequest) SetOwnerID(id OwnerID) { - m.OwnerID = id -} - -// GetID is an ID field getter. -func (m DeleteRequest) GetID() ChequeID { - return m.ID -} - -// SetID is an ID field setter. -func (m *DeleteRequest) SetID(id ChequeID) { - m.ID = id -} - -// GetOwnerID is an OwnerID field getter. -func (m DeleteRequest) GetOwnerID() OwnerID { - return m.OwnerID -} - -// SetOwnerID is an OwnerID field setter. -func (m *DeleteRequest) SetOwnerID(id OwnerID) { - m.OwnerID = id -} - -// GetMessageID is a MessageID field getter. -func (m DeleteRequest) GetMessageID() MessageID { - return m.MessageID -} - -// SetMessageID is a MessageID field setter. -func (m *DeleteRequest) SetMessageID(id MessageID) { - m.MessageID = id -} diff --git a/accounting/types.pb.go b/accounting/types.pb.go deleted file mode 100644 index 576ba1f..0000000 --- a/accounting/types.pb.go +++ /dev/null @@ -1,3463 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: accounting/types.proto - -package accounting - -import ( - fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/golang/protobuf/proto" - decimal "github.com/nspcc-dev/neofs-api-go/decimal" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package - -// Unit can be Unlimited, based on NeoFS epoch or Neo block -type Lifetime_Unit int32 - -const ( - Lifetime_Unlimited Lifetime_Unit = 0 - Lifetime_NeoFSEpoch Lifetime_Unit = 1 - Lifetime_NeoBlock Lifetime_Unit = 2 -) - -var Lifetime_Unit_name = map[int32]string{ - 0: "Unlimited", - 1: "NeoFSEpoch", - 2: "NeoBlock", -} - -var Lifetime_Unit_value = map[string]int32{ - "Unlimited": 0, - "NeoFSEpoch": 1, - "NeoBlock": 2, -} - -func (x Lifetime_Unit) String() string { - return proto.EnumName(Lifetime_Unit_name, int32(x)) -} - -func (Lifetime_Unit) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_437c556d7375b726, []int{4, 0} -} - -// Type can be withdrawal, payIO or inner -type Tx_Type int32 - -const ( - Tx_Unknown Tx_Type = 0 - Tx_Withdraw Tx_Type = 1 - Tx_PayIO Tx_Type = 2 - Tx_Inner Tx_Type = 3 -) - -var Tx_Type_name = map[int32]string{ - 0: "Unknown", - 1: "Withdraw", - 2: "PayIO", - 3: "Inner", -} - -var Tx_Type_value = map[string]int32{ - "Unknown": 0, - "Withdraw": 1, - "PayIO": 2, - "Inner": 3, -} - -func (x Tx_Type) String() string { - return proto.EnumName(Tx_Type_name, int32(x)) -} - -func (Tx_Type) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_437c556d7375b726, []int{5, 0} -} - -type Account struct { - // OwnerID is a wallet address - OwnerID OwnerID `protobuf:"bytes,1,opt,name=OwnerID,proto3,customtype=OwnerID" json:"OwnerID"` - // Address is identifier of accounting record - Address string `protobuf:"bytes,2,opt,name=Address,proto3" json:"Address,omitempty"` - // ParentAddress is identifier of parent accounting record - ParentAddress string `protobuf:"bytes,3,opt,name=ParentAddress,proto3" json:"ParentAddress,omitempty"` - // ActiveFunds is amount of active (non locked) funds for account - ActiveFunds *decimal.Decimal `protobuf:"bytes,4,opt,name=ActiveFunds,proto3" json:"ActiveFunds,omitempty"` - // Lifetime is time until account is valid (used for lock accounts) - Lifetime Lifetime `protobuf:"bytes,5,opt,name=Lifetime,proto3" json:"Lifetime"` - // LockTarget is the purpose of lock funds (it might be withdraw or payment for storage) - LockTarget *LockTarget `protobuf:"bytes,6,opt,name=LockTarget,proto3" json:"LockTarget,omitempty"` - // LockAccounts contains child accounts with locked funds - LockAccounts []*Account `protobuf:"bytes,7,rep,name=LockAccounts,proto3" json:"LockAccounts,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Account) Reset() { *m = Account{} } -func (m *Account) String() string { return proto.CompactTextString(m) } -func (*Account) ProtoMessage() {} -func (*Account) Descriptor() ([]byte, []int) { - return fileDescriptor_437c556d7375b726, []int{0} -} -func (m *Account) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Account) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *Account) XXX_Merge(src proto.Message) { - xxx_messageInfo_Account.Merge(m, src) -} -func (m *Account) XXX_Size() int { - return m.Size() -} -func (m *Account) XXX_DiscardUnknown() { - xxx_messageInfo_Account.DiscardUnknown(m) -} - -var xxx_messageInfo_Account proto.InternalMessageInfo - -func (m *Account) GetAddress() string { - if m != nil { - return m.Address - } - return "" -} - -func (m *Account) GetParentAddress() string { - if m != nil { - return m.ParentAddress - } - return "" -} - -func (m *Account) GetActiveFunds() *decimal.Decimal { - if m != nil { - return m.ActiveFunds - } - return nil -} - -func (m *Account) GetLifetime() Lifetime { - if m != nil { - return m.Lifetime - } - return Lifetime{} -} - -func (m *Account) GetLockTarget() *LockTarget { - if m != nil { - return m.LockTarget - } - return nil -} - -func (m *Account) GetLockAccounts() []*Account { - if m != nil { - return m.LockAccounts - } - return nil -} - -// LockTarget must be one of two options -type LockTarget struct { - // Types that are valid to be assigned to Target: - // *LockTarget_WithdrawTarget - // *LockTarget_ContainerCreateTarget - Target isLockTarget_Target `protobuf_oneof:"Target"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *LockTarget) Reset() { *m = LockTarget{} } -func (m *LockTarget) String() string { return proto.CompactTextString(m) } -func (*LockTarget) ProtoMessage() {} -func (*LockTarget) Descriptor() ([]byte, []int) { - return fileDescriptor_437c556d7375b726, []int{1} -} -func (m *LockTarget) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *LockTarget) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *LockTarget) XXX_Merge(src proto.Message) { - xxx_messageInfo_LockTarget.Merge(m, src) -} -func (m *LockTarget) XXX_Size() int { - return m.Size() -} -func (m *LockTarget) XXX_DiscardUnknown() { - xxx_messageInfo_LockTarget.DiscardUnknown(m) -} - -var xxx_messageInfo_LockTarget proto.InternalMessageInfo - -type isLockTarget_Target interface { - isLockTarget_Target() - MarshalTo([]byte) (int, error) - Size() int -} - -type LockTarget_WithdrawTarget struct { - WithdrawTarget *WithdrawTarget `protobuf:"bytes,1,opt,name=WithdrawTarget,proto3,oneof" json:"WithdrawTarget,omitempty"` -} -type LockTarget_ContainerCreateTarget struct { - ContainerCreateTarget *ContainerCreateTarget `protobuf:"bytes,2,opt,name=ContainerCreateTarget,proto3,oneof" json:"ContainerCreateTarget,omitempty"` -} - -func (*LockTarget_WithdrawTarget) isLockTarget_Target() {} -func (*LockTarget_ContainerCreateTarget) isLockTarget_Target() {} - -func (m *LockTarget) GetTarget() isLockTarget_Target { - if m != nil { - return m.Target - } - return nil -} - -func (m *LockTarget) GetWithdrawTarget() *WithdrawTarget { - if x, ok := m.GetTarget().(*LockTarget_WithdrawTarget); ok { - return x.WithdrawTarget - } - return nil -} - -func (m *LockTarget) GetContainerCreateTarget() *ContainerCreateTarget { - if x, ok := m.GetTarget().(*LockTarget_ContainerCreateTarget); ok { - return x.ContainerCreateTarget - } - return nil -} - -// XXX_OneofWrappers is for the internal use of the proto package. -func (*LockTarget) XXX_OneofWrappers() []interface{} { - return []interface{}{ - (*LockTarget_WithdrawTarget)(nil), - (*LockTarget_ContainerCreateTarget)(nil), - } -} - -type Balances struct { - // Accounts contains multiple account snapshots - Accounts []Account `protobuf:"bytes,1,rep,name=Accounts,proto3" json:"Accounts"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Balances) Reset() { *m = Balances{} } -func (m *Balances) String() string { return proto.CompactTextString(m) } -func (*Balances) ProtoMessage() {} -func (*Balances) Descriptor() ([]byte, []int) { - return fileDescriptor_437c556d7375b726, []int{2} -} -func (m *Balances) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Balances) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *Balances) XXX_Merge(src proto.Message) { - xxx_messageInfo_Balances.Merge(m, src) -} -func (m *Balances) XXX_Size() int { - return m.Size() -} -func (m *Balances) XXX_DiscardUnknown() { - xxx_messageInfo_Balances.DiscardUnknown(m) -} - -var xxx_messageInfo_Balances proto.InternalMessageInfo - -func (m *Balances) GetAccounts() []Account { - if m != nil { - return m.Accounts - } - return nil -} - -type PayIO struct { - // BlockID contains id of the NEO block where withdraw or deposit - // call was invoked - BlockID uint64 `protobuf:"varint,1,opt,name=BlockID,proto3" json:"BlockID,omitempty"` - // Transactions contains all transactions that founded in block - // and used for PayIO - Transactions []Tx `protobuf:"bytes,2,rep,name=Transactions,proto3" json:"Transactions"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *PayIO) Reset() { *m = PayIO{} } -func (m *PayIO) String() string { return proto.CompactTextString(m) } -func (*PayIO) ProtoMessage() {} -func (*PayIO) Descriptor() ([]byte, []int) { - return fileDescriptor_437c556d7375b726, []int{3} -} -func (m *PayIO) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *PayIO) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *PayIO) XXX_Merge(src proto.Message) { - xxx_messageInfo_PayIO.Merge(m, src) -} -func (m *PayIO) XXX_Size() int { - return m.Size() -} -func (m *PayIO) XXX_DiscardUnknown() { - xxx_messageInfo_PayIO.DiscardUnknown(m) -} - -var xxx_messageInfo_PayIO proto.InternalMessageInfo - -func (m *PayIO) GetBlockID() uint64 { - if m != nil { - return m.BlockID - } - return 0 -} - -func (m *PayIO) GetTransactions() []Tx { - if m != nil { - return m.Transactions - } - return nil -} - -type Lifetime struct { - // Unit describes how lifetime is measured in account - Unit Lifetime_Unit `protobuf:"varint,1,opt,name=unit,proto3,enum=accounting.Lifetime_Unit" json:"unit,omitempty"` - // Value describes how long lifetime will be valid - Value int64 `protobuf:"varint,2,opt,name=Value,proto3" json:"Value,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Lifetime) Reset() { *m = Lifetime{} } -func (m *Lifetime) String() string { return proto.CompactTextString(m) } -func (*Lifetime) ProtoMessage() {} -func (*Lifetime) Descriptor() ([]byte, []int) { - return fileDescriptor_437c556d7375b726, []int{4} -} -func (m *Lifetime) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Lifetime) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *Lifetime) XXX_Merge(src proto.Message) { - xxx_messageInfo_Lifetime.Merge(m, src) -} -func (m *Lifetime) XXX_Size() int { - return m.Size() -} -func (m *Lifetime) XXX_DiscardUnknown() { - xxx_messageInfo_Lifetime.DiscardUnknown(m) -} - -var xxx_messageInfo_Lifetime proto.InternalMessageInfo - -func (m *Lifetime) GetUnit() Lifetime_Unit { - if m != nil { - return m.Unit - } - return Lifetime_Unlimited -} - -func (m *Lifetime) GetValue() int64 { - if m != nil { - return m.Value - } - return 0 -} - -type Tx struct { - // Type describes target of transaction - Type Tx_Type `protobuf:"varint,1,opt,name=type,proto3,enum=accounting.Tx_Type" json:"type,omitempty"` - // From describes sender of funds - From string `protobuf:"bytes,2,opt,name=From,proto3" json:"From,omitempty"` - // To describes receiver of funds - To string `protobuf:"bytes,3,opt,name=To,proto3" json:"To,omitempty"` - // Amount describes amount of funds - Amount *decimal.Decimal `protobuf:"bytes,4,opt,name=Amount,proto3" json:"Amount,omitempty"` - // PublicKeys contains public key of sender - PublicKeys []byte `protobuf:"bytes,5,opt,name=PublicKeys,proto3" json:"PublicKeys,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Tx) Reset() { *m = Tx{} } -func (m *Tx) String() string { return proto.CompactTextString(m) } -func (*Tx) ProtoMessage() {} -func (*Tx) Descriptor() ([]byte, []int) { - return fileDescriptor_437c556d7375b726, []int{5} -} -func (m *Tx) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Tx) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *Tx) XXX_Merge(src proto.Message) { - xxx_messageInfo_Tx.Merge(m, src) -} -func (m *Tx) XXX_Size() int { - return m.Size() -} -func (m *Tx) XXX_DiscardUnknown() { - xxx_messageInfo_Tx.DiscardUnknown(m) -} - -var xxx_messageInfo_Tx proto.InternalMessageInfo - -func (m *Tx) GetType() Tx_Type { - if m != nil { - return m.Type - } - return Tx_Unknown -} - -func (m *Tx) GetFrom() string { - if m != nil { - return m.From - } - return "" -} - -func (m *Tx) GetTo() string { - if m != nil { - return m.To - } - return "" -} - -func (m *Tx) GetAmount() *decimal.Decimal { - if m != nil { - return m.Amount - } - return nil -} - -func (m *Tx) GetPublicKeys() []byte { - if m != nil { - return m.PublicKeys - } - return nil -} - -type Settlement struct { - // Epoch contains an epoch when settlement was accepted - Epoch uint64 `protobuf:"varint,1,opt,name=Epoch,proto3" json:"Epoch,omitempty"` - // Transactions is a set of transactions - Transactions []*Settlement_Tx `protobuf:"bytes,2,rep,name=Transactions,proto3" json:"Transactions,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Settlement) Reset() { *m = Settlement{} } -func (m *Settlement) String() string { return proto.CompactTextString(m) } -func (*Settlement) ProtoMessage() {} -func (*Settlement) Descriptor() ([]byte, []int) { - return fileDescriptor_437c556d7375b726, []int{6} -} -func (m *Settlement) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Settlement) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *Settlement) XXX_Merge(src proto.Message) { - xxx_messageInfo_Settlement.Merge(m, src) -} -func (m *Settlement) XXX_Size() int { - return m.Size() -} -func (m *Settlement) XXX_DiscardUnknown() { - xxx_messageInfo_Settlement.DiscardUnknown(m) -} - -var xxx_messageInfo_Settlement proto.InternalMessageInfo - -func (m *Settlement) GetEpoch() uint64 { - if m != nil { - return m.Epoch - } - return 0 -} - -func (m *Settlement) GetTransactions() []*Settlement_Tx { - if m != nil { - return m.Transactions - } - return nil -} - -type Settlement_Receiver struct { - // To is the address of funds recipient - To string `protobuf:"bytes,1,opt,name=To,proto3" json:"To,omitempty"` - // Amount is the amount of funds that will be sent - Amount *decimal.Decimal `protobuf:"bytes,2,opt,name=Amount,proto3" json:"Amount,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Settlement_Receiver) Reset() { *m = Settlement_Receiver{} } -func (m *Settlement_Receiver) String() string { return proto.CompactTextString(m) } -func (*Settlement_Receiver) ProtoMessage() {} -func (*Settlement_Receiver) Descriptor() ([]byte, []int) { - return fileDescriptor_437c556d7375b726, []int{6, 0} -} -func (m *Settlement_Receiver) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Settlement_Receiver) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *Settlement_Receiver) XXX_Merge(src proto.Message) { - xxx_messageInfo_Settlement_Receiver.Merge(m, src) -} -func (m *Settlement_Receiver) XXX_Size() int { - return m.Size() -} -func (m *Settlement_Receiver) XXX_DiscardUnknown() { - xxx_messageInfo_Settlement_Receiver.DiscardUnknown(m) -} - -var xxx_messageInfo_Settlement_Receiver proto.InternalMessageInfo - -func (m *Settlement_Receiver) GetTo() string { - if m != nil { - return m.To - } - return "" -} - -func (m *Settlement_Receiver) GetAmount() *decimal.Decimal { - if m != nil { - return m.Amount - } - return nil -} - -type Settlement_Container struct { - // CID is container identifier - CID CID `protobuf:"bytes,1,opt,name=CID,proto3,customtype=CID" json:"CID"` - // SGIDs is a set of storage groups that successfully passed the audit - SGIDs []SGID `protobuf:"bytes,2,rep,name=SGIDs,proto3,customtype=SGID" json:"SGIDs"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Settlement_Container) Reset() { *m = Settlement_Container{} } -func (m *Settlement_Container) String() string { return proto.CompactTextString(m) } -func (*Settlement_Container) ProtoMessage() {} -func (*Settlement_Container) Descriptor() ([]byte, []int) { - return fileDescriptor_437c556d7375b726, []int{6, 1} -} -func (m *Settlement_Container) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Settlement_Container) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *Settlement_Container) XXX_Merge(src proto.Message) { - xxx_messageInfo_Settlement_Container.Merge(m, src) -} -func (m *Settlement_Container) XXX_Size() int { - return m.Size() -} -func (m *Settlement_Container) XXX_DiscardUnknown() { - xxx_messageInfo_Settlement_Container.DiscardUnknown(m) -} - -var xxx_messageInfo_Settlement_Container proto.InternalMessageInfo - -type Settlement_Tx struct { - // From is the address of the sender of funds - From string `protobuf:"bytes,1,opt,name=From,proto3" json:"From,omitempty"` - // Container that successfully had passed the audit - Container Settlement_Container `protobuf:"bytes,2,opt,name=Container,proto3" json:"Container"` - // Receivers is a set of addresses of funds recipients - Receivers []Settlement_Receiver `protobuf:"bytes,3,rep,name=Receivers,proto3" json:"Receivers"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Settlement_Tx) Reset() { *m = Settlement_Tx{} } -func (m *Settlement_Tx) String() string { return proto.CompactTextString(m) } -func (*Settlement_Tx) ProtoMessage() {} -func (*Settlement_Tx) Descriptor() ([]byte, []int) { - return fileDescriptor_437c556d7375b726, []int{6, 2} -} -func (m *Settlement_Tx) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Settlement_Tx) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *Settlement_Tx) XXX_Merge(src proto.Message) { - xxx_messageInfo_Settlement_Tx.Merge(m, src) -} -func (m *Settlement_Tx) XXX_Size() int { - return m.Size() -} -func (m *Settlement_Tx) XXX_DiscardUnknown() { - xxx_messageInfo_Settlement_Tx.DiscardUnknown(m) -} - -var xxx_messageInfo_Settlement_Tx proto.InternalMessageInfo - -func (m *Settlement_Tx) GetFrom() string { - if m != nil { - return m.From - } - return "" -} - -func (m *Settlement_Tx) GetContainer() Settlement_Container { - if m != nil { - return m.Container - } - return Settlement_Container{} -} - -func (m *Settlement_Tx) GetReceivers() []Settlement_Receiver { - if m != nil { - return m.Receivers - } - return nil -} - -type ContainerCreateTarget struct { - // CID is container identifier - CID CID `protobuf:"bytes,1,opt,name=CID,proto3,customtype=CID" json:"CID"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ContainerCreateTarget) Reset() { *m = ContainerCreateTarget{} } -func (m *ContainerCreateTarget) String() string { return proto.CompactTextString(m) } -func (*ContainerCreateTarget) ProtoMessage() {} -func (*ContainerCreateTarget) Descriptor() ([]byte, []int) { - return fileDescriptor_437c556d7375b726, []int{7} -} -func (m *ContainerCreateTarget) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ContainerCreateTarget) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *ContainerCreateTarget) XXX_Merge(src proto.Message) { - xxx_messageInfo_ContainerCreateTarget.Merge(m, src) -} -func (m *ContainerCreateTarget) XXX_Size() int { - return m.Size() -} -func (m *ContainerCreateTarget) XXX_DiscardUnknown() { - xxx_messageInfo_ContainerCreateTarget.DiscardUnknown(m) -} - -var xxx_messageInfo_ContainerCreateTarget proto.InternalMessageInfo - -type WithdrawTarget struct { - // Cheque is a string representation of cheque id - Cheque string `protobuf:"bytes,1,opt,name=Cheque,proto3" json:"Cheque,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *WithdrawTarget) Reset() { *m = WithdrawTarget{} } -func (m *WithdrawTarget) String() string { return proto.CompactTextString(m) } -func (*WithdrawTarget) ProtoMessage() {} -func (*WithdrawTarget) Descriptor() ([]byte, []int) { - return fileDescriptor_437c556d7375b726, []int{8} -} -func (m *WithdrawTarget) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *WithdrawTarget) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *WithdrawTarget) XXX_Merge(src proto.Message) { - xxx_messageInfo_WithdrawTarget.Merge(m, src) -} -func (m *WithdrawTarget) XXX_Size() int { - return m.Size() -} -func (m *WithdrawTarget) XXX_DiscardUnknown() { - xxx_messageInfo_WithdrawTarget.DiscardUnknown(m) -} - -var xxx_messageInfo_WithdrawTarget proto.InternalMessageInfo - -func (m *WithdrawTarget) GetCheque() string { - if m != nil { - return m.Cheque - } - return "" -} - -func init() { - proto.RegisterEnum("accounting.Lifetime_Unit", Lifetime_Unit_name, Lifetime_Unit_value) - proto.RegisterEnum("accounting.Tx_Type", Tx_Type_name, Tx_Type_value) - proto.RegisterType((*Account)(nil), "accounting.Account") - proto.RegisterType((*LockTarget)(nil), "accounting.LockTarget") - proto.RegisterType((*Balances)(nil), "accounting.Balances") - proto.RegisterType((*PayIO)(nil), "accounting.PayIO") - proto.RegisterType((*Lifetime)(nil), "accounting.Lifetime") - proto.RegisterType((*Tx)(nil), "accounting.Tx") - proto.RegisterType((*Settlement)(nil), "accounting.Settlement") - proto.RegisterType((*Settlement_Receiver)(nil), "accounting.Settlement.Receiver") - proto.RegisterType((*Settlement_Container)(nil), "accounting.Settlement.Container") - proto.RegisterType((*Settlement_Tx)(nil), "accounting.Settlement.Tx") - proto.RegisterType((*ContainerCreateTarget)(nil), "accounting.ContainerCreateTarget") - proto.RegisterType((*WithdrawTarget)(nil), "accounting.WithdrawTarget") -} - -func init() { proto.RegisterFile("accounting/types.proto", fileDescriptor_437c556d7375b726) } - -var fileDescriptor_437c556d7375b726 = []byte{ - // 840 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x55, 0xcb, 0x6e, 0x23, 0x45, - 0x14, 0x75, 0xb5, 0x1d, 0x3f, 0xae, 0x3d, 0xc6, 0xaa, 0xc9, 0x44, 0xc6, 0x12, 0x8e, 0x69, 0xb1, - 0x30, 0x12, 0x69, 0x8b, 0x8c, 0x48, 0xd8, 0xb0, 0xf0, 0x83, 0x30, 0x16, 0xa3, 0x4c, 0x54, 0x71, - 0x40, 0x03, 0xab, 0x4e, 0xbb, 0xe2, 0x94, 0x62, 0x57, 0x99, 0xee, 0xea, 0x3c, 0x7e, 0x82, 0x35, - 0x1b, 0x56, 0xec, 0xf8, 0x01, 0x7e, 0x61, 0x96, 0xb0, 0x43, 0x2c, 0x22, 0x64, 0x7e, 0x04, 0x55, - 0x75, 0x75, 0xbb, 0x3b, 0xb2, 0x61, 0x63, 0xdf, 0xc7, 0xb9, 0xa7, 0xee, 0xab, 0xaa, 0x61, 0xcf, - 0xf5, 0x3c, 0x11, 0x72, 0xc9, 0xf8, 0xac, 0x27, 0x1f, 0x96, 0x34, 0x70, 0x96, 0xbe, 0x90, 0x02, - 0xc3, 0xda, 0xde, 0x7a, 0x31, 0xa5, 0x1e, 0x5b, 0xb8, 0xf3, 0x9e, 0xf9, 0x8f, 0x20, 0xad, 0x83, - 0x19, 0x93, 0xd7, 0xe1, 0xa5, 0xe3, 0x89, 0x45, 0x6f, 0x26, 0x66, 0xa2, 0xa7, 0xcd, 0x97, 0xe1, - 0x95, 0xd6, 0xb4, 0xa2, 0xa5, 0x08, 0x6e, 0xff, 0x61, 0x41, 0xa9, 0x1f, 0x91, 0xe2, 0x8f, 0xa1, - 0xf4, 0xe6, 0x8e, 0x53, 0x7f, 0x3c, 0x6a, 0xa2, 0x0e, 0xea, 0xd6, 0x06, 0xef, 0xbd, 0x7b, 0xdc, - 0xcf, 0xfd, 0xf5, 0xb8, 0x1f, 0x9b, 0x49, 0x2c, 0xe0, 0x26, 0x94, 0xfa, 0xd3, 0xa9, 0x4f, 0x83, - 0xa0, 0x69, 0x75, 0x50, 0xb7, 0x42, 0x62, 0x15, 0x7f, 0x04, 0xcf, 0xce, 0x5c, 0x9f, 0x72, 0x19, - 0xfb, 0xf3, 0xda, 0x9f, 0x35, 0xe2, 0x43, 0xa8, 0xf6, 0x3d, 0xc9, 0x6e, 0xe9, 0x49, 0xc8, 0xa7, - 0x41, 0xb3, 0xd0, 0x41, 0xdd, 0xea, 0x61, 0xc3, 0x89, 0x4b, 0x19, 0x45, 0xff, 0x24, 0x0d, 0xc2, - 0x47, 0x50, 0x7e, 0xcd, 0xae, 0xa8, 0x64, 0x0b, 0xda, 0xdc, 0xd1, 0x01, 0xbb, 0xce, 0xba, 0x1f, - 0x4e, 0xec, 0x1b, 0x14, 0x54, 0xd6, 0x24, 0xc1, 0xe2, 0x23, 0x80, 0xd7, 0xc2, 0xbb, 0x99, 0xb8, - 0xfe, 0x8c, 0xca, 0x66, 0x51, 0x47, 0xee, 0x65, 0x22, 0x13, 0x2f, 0x49, 0x21, 0xf1, 0x31, 0xd4, - 0x94, 0x66, 0xba, 0x13, 0x34, 0x4b, 0x9d, 0x7c, 0xb7, 0x7a, 0xf8, 0x3c, 0x1d, 0x69, 0x7c, 0x24, - 0x03, 0xb4, 0x7f, 0x43, 0xe9, 0x13, 0xf1, 0x08, 0xea, 0xdf, 0x32, 0x79, 0x3d, 0xf5, 0xdd, 0x3b, - 0x93, 0x03, 0xd2, 0x39, 0xb4, 0xd2, 0x4c, 0x59, 0xc4, 0xab, 0x1c, 0x79, 0x12, 0x83, 0xdf, 0xc2, - 0x8b, 0xa1, 0xe0, 0xd2, 0x65, 0x9c, 0xfa, 0x43, 0x9f, 0xba, 0x92, 0x1a, 0x32, 0x4b, 0x93, 0x7d, - 0x98, 0x26, 0xdb, 0x08, 0x7c, 0x95, 0x23, 0x9b, 0x19, 0x06, 0x65, 0x28, 0x46, 0x92, 0xdd, 0x87, - 0xf2, 0xc0, 0x9d, 0xbb, 0xdc, 0xa3, 0x01, 0xfe, 0x0c, 0xca, 0x49, 0xe9, 0x68, 0x6b, 0xe9, 0x71, - 0xb7, 0x93, 0xe2, 0xbf, 0x87, 0x9d, 0x33, 0xf7, 0x61, 0xfc, 0x46, 0xad, 0xc8, 0x60, 0x2e, 0xbc, - 0x1b, 0xb3, 0x4d, 0x05, 0x12, 0xab, 0xf8, 0x73, 0xa8, 0x4d, 0x7c, 0x97, 0x07, 0xae, 0x27, 0x99, - 0xe0, 0x6a, 0x83, 0x14, 0x7b, 0x3d, 0xcd, 0x3e, 0xb9, 0x37, 0xc4, 0x19, 0xa4, 0xfd, 0x23, 0x5a, - 0xef, 0x00, 0x3e, 0x86, 0x42, 0xc8, 0x59, 0xd4, 0xcd, 0xfa, 0xe1, 0xfb, 0x9b, 0x76, 0xc1, 0xb9, - 0xe0, 0x4c, 0x0e, 0xca, 0xab, 0xc7, 0xfd, 0x82, 0x92, 0x88, 0x0e, 0xc0, 0xbb, 0xb0, 0xf3, 0x8d, - 0x3b, 0x0f, 0xa9, 0x6e, 0x5d, 0x9e, 0x44, 0x8a, 0xfd, 0x12, 0x34, 0x06, 0x3f, 0x83, 0xca, 0x05, - 0x9f, 0xb3, 0x05, 0x93, 0x74, 0xda, 0xc8, 0xe1, 0x3a, 0xc0, 0x29, 0x15, 0x27, 0xe7, 0x5f, 0x2e, - 0x85, 0x77, 0xdd, 0x40, 0xb8, 0x06, 0xe5, 0x53, 0x2a, 0x74, 0x29, 0x0d, 0xcb, 0x7e, 0x44, 0x60, - 0x4d, 0xee, 0xf1, 0xa7, 0x50, 0x50, 0xd7, 0xd4, 0xa4, 0xf2, 0x3c, 0x5b, 0x89, 0x33, 0x79, 0x58, - 0xd2, 0x28, 0x09, 0x25, 0x11, 0x0d, 0xc5, 0x18, 0x0a, 0x27, 0xbe, 0x58, 0x98, 0xeb, 0xa3, 0x65, - 0x5c, 0x07, 0x6b, 0x22, 0xcc, 0x85, 0xb1, 0x26, 0x02, 0x77, 0xa1, 0xd8, 0x5f, 0x28, 0xa2, 0xad, - 0x17, 0xc4, 0xf8, 0x71, 0x1b, 0xe0, 0x2c, 0xbc, 0x9c, 0x33, 0xef, 0x6b, 0xfa, 0x10, 0xe8, 0xdb, - 0x51, 0x23, 0x29, 0x8b, 0x7d, 0x0c, 0xfa, 0x6c, 0x5c, 0x85, 0xd2, 0x05, 0xbf, 0xe1, 0xe2, 0x8e, - 0x37, 0x72, 0xaa, 0x94, 0x78, 0xc9, 0x1a, 0x08, 0x57, 0xcc, 0xe0, 0x1a, 0x96, 0x12, 0xc7, 0x9c, - 0x53, 0xbf, 0x91, 0xb7, 0x7f, 0xce, 0x03, 0x9c, 0x53, 0x29, 0xe7, 0x74, 0x41, 0xb9, 0x6e, 0x9d, - 0x6e, 0x84, 0x19, 0x69, 0xa4, 0xe0, 0x2f, 0x36, 0x0e, 0x34, 0x33, 0x91, 0x35, 0x87, 0x33, 0xb9, - 0xcf, 0x4e, 0xb5, 0x35, 0x82, 0x32, 0xa1, 0x1e, 0x65, 0xb7, 0xd4, 0x37, 0x2d, 0x40, 0x1b, 0x5a, - 0x60, 0xfd, 0x77, 0x0b, 0x5a, 0xa7, 0x50, 0x49, 0xd6, 0x1b, 0x7f, 0x00, 0xf9, 0x61, 0xf2, 0x8c, - 0x55, 0xcd, 0x33, 0xa6, 0x4c, 0x44, 0xfd, 0x60, 0x1b, 0x76, 0xce, 0xbf, 0x1a, 0x8f, 0xa2, 0x4c, - 0x6b, 0x83, 0x9a, 0x01, 0x14, 0x94, 0x91, 0x44, 0xae, 0xd6, 0x2f, 0xd1, 0x68, 0xe3, 0x39, 0xa1, - 0xd4, 0x9c, 0x46, 0xa9, 0xa3, 0x4c, 0x5e, 0x9d, 0x2d, 0xc5, 0x26, 0x38, 0xb3, 0xcf, 0xa9, 0x1c, - 0x87, 0x50, 0x89, 0xcb, 0x56, 0xaf, 0xa4, 0x6a, 0xd9, 0xfe, 0x16, 0x96, 0x18, 0x17, 0x93, 0x24, - 0x71, 0xf6, 0xd1, 0x96, 0x67, 0xe1, 0x7f, 0x3a, 0x60, 0x77, 0x9f, 0x3e, 0x4a, 0x78, 0x0f, 0x8a, - 0xc3, 0x6b, 0xfa, 0x43, 0x48, 0x4d, 0xa9, 0x46, 0x1b, 0xbc, 0x7d, 0xb7, 0x6a, 0xa3, 0xdf, 0x57, - 0x6d, 0xf4, 0xe7, 0xaa, 0x8d, 0xfe, 0x5e, 0xb5, 0xd1, 0x4f, 0xff, 0xb4, 0x73, 0xdf, 0x7d, 0x92, - 0xfa, 0xcc, 0xf0, 0x60, 0xe9, 0x79, 0x07, 0x53, 0x7a, 0xdb, 0xe3, 0x54, 0x5c, 0x05, 0x07, 0xee, - 0x92, 0x1d, 0xcc, 0x44, 0x6f, 0x5d, 0xca, 0xaf, 0xd6, 0xae, 0xbe, 0x43, 0x4e, 0xff, 0x6c, 0x1c, - 0x3f, 0x1c, 0x8c, 0xcf, 0x2e, 0x8b, 0xfa, 0x1b, 0xf4, 0xf2, 0xdf, 0x00, 0x00, 0x00, 0xff, 0xff, - 0xc4, 0xae, 0x74, 0x80, 0xef, 0x06, 0x00, 0x00, -} - -func (m *Account) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Account) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Account) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.LockAccounts) > 0 { - for iNdEx := len(m.LockAccounts) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.LockAccounts[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x3a - } - } - if m.LockTarget != nil { - { - size, err := m.LockTarget.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x32 - } - { - size, err := m.Lifetime.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2a - if m.ActiveFunds != nil { - { - size, err := m.ActiveFunds.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } - if len(m.ParentAddress) > 0 { - i -= len(m.ParentAddress) - copy(dAtA[i:], m.ParentAddress) - i = encodeVarintTypes(dAtA, i, uint64(len(m.ParentAddress))) - i-- - dAtA[i] = 0x1a - } - if len(m.Address) > 0 { - i -= len(m.Address) - copy(dAtA[i:], m.Address) - i = encodeVarintTypes(dAtA, i, uint64(len(m.Address))) - i-- - dAtA[i] = 0x12 - } - { - size := m.OwnerID.Size() - i -= size - if _, err := m.OwnerID.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *LockTarget) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *LockTarget) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *LockTarget) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.Target != nil { - { - size := m.Target.Size() - i -= size - if _, err := m.Target.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - } - } - return len(dAtA) - i, nil -} - -func (m *LockTarget_WithdrawTarget) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *LockTarget_WithdrawTarget) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.WithdrawTarget != nil { - { - size, err := m.WithdrawTarget.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} -func (m *LockTarget_ContainerCreateTarget) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *LockTarget_ContainerCreateTarget) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.ContainerCreateTarget != nil { - { - size, err := m.ContainerCreateTarget.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - return len(dAtA) - i, nil -} -func (m *Balances) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Balances) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Balances) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.Accounts) > 0 { - for iNdEx := len(m.Accounts) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Accounts[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *PayIO) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *PayIO) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *PayIO) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.Transactions) > 0 { - for iNdEx := len(m.Transactions) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Transactions[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - if m.BlockID != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.BlockID)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *Lifetime) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Lifetime) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Lifetime) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.Value != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.Value)) - i-- - dAtA[i] = 0x10 - } - if m.Unit != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.Unit)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *Tx) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Tx) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Tx) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.PublicKeys) > 0 { - i -= len(m.PublicKeys) - copy(dAtA[i:], m.PublicKeys) - i = encodeVarintTypes(dAtA, i, uint64(len(m.PublicKeys))) - i-- - dAtA[i] = 0x2a - } - if m.Amount != nil { - { - size, err := m.Amount.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } - if len(m.To) > 0 { - i -= len(m.To) - copy(dAtA[i:], m.To) - i = encodeVarintTypes(dAtA, i, uint64(len(m.To))) - i-- - dAtA[i] = 0x1a - } - if len(m.From) > 0 { - i -= len(m.From) - copy(dAtA[i:], m.From) - i = encodeVarintTypes(dAtA, i, uint64(len(m.From))) - i-- - dAtA[i] = 0x12 - } - if m.Type != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.Type)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *Settlement) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Settlement) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Settlement) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.Transactions) > 0 { - for iNdEx := len(m.Transactions) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Transactions[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - if m.Epoch != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.Epoch)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *Settlement_Receiver) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Settlement_Receiver) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Settlement_Receiver) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.Amount != nil { - { - size, err := m.Amount.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if len(m.To) > 0 { - i -= len(m.To) - copy(dAtA[i:], m.To) - i = encodeVarintTypes(dAtA, i, uint64(len(m.To))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Settlement_Container) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Settlement_Container) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Settlement_Container) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.SGIDs) > 0 { - for iNdEx := len(m.SGIDs) - 1; iNdEx >= 0; iNdEx-- { - { - size := m.SGIDs[iNdEx].Size() - i -= size - if _, err := m.SGIDs[iNdEx].MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - { - size := m.CID.Size() - i -= size - if _, err := m.CID.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *Settlement_Tx) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Settlement_Tx) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Settlement_Tx) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.Receivers) > 0 { - for iNdEx := len(m.Receivers) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Receivers[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - } - { - size, err := m.Container.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - if len(m.From) > 0 { - i -= len(m.From) - copy(dAtA[i:], m.From) - i = encodeVarintTypes(dAtA, i, uint64(len(m.From))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *ContainerCreateTarget) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ContainerCreateTarget) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ContainerCreateTarget) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - { - size := m.CID.Size() - i -= size - if _, err := m.CID.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *WithdrawTarget) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *WithdrawTarget) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *WithdrawTarget) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.Cheque) > 0 { - i -= len(m.Cheque) - copy(dAtA[i:], m.Cheque) - i = encodeVarintTypes(dAtA, i, uint64(len(m.Cheque))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func encodeVarintTypes(dAtA []byte, offset int, v uint64) int { - offset -= sovTypes(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *Account) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.OwnerID.Size() - n += 1 + l + sovTypes(uint64(l)) - l = len(m.Address) - if l > 0 { - n += 1 + l + sovTypes(uint64(l)) - } - l = len(m.ParentAddress) - if l > 0 { - n += 1 + l + sovTypes(uint64(l)) - } - if m.ActiveFunds != nil { - l = m.ActiveFunds.Size() - n += 1 + l + sovTypes(uint64(l)) - } - l = m.Lifetime.Size() - n += 1 + l + sovTypes(uint64(l)) - if m.LockTarget != nil { - l = m.LockTarget.Size() - n += 1 + l + sovTypes(uint64(l)) - } - if len(m.LockAccounts) > 0 { - for _, e := range m.LockAccounts { - l = e.Size() - n += 1 + l + sovTypes(uint64(l)) - } - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *LockTarget) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Target != nil { - n += m.Target.Size() - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *LockTarget_WithdrawTarget) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.WithdrawTarget != nil { - l = m.WithdrawTarget.Size() - n += 1 + l + sovTypes(uint64(l)) - } - return n -} -func (m *LockTarget_ContainerCreateTarget) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ContainerCreateTarget != nil { - l = m.ContainerCreateTarget.Size() - n += 1 + l + sovTypes(uint64(l)) - } - return n -} -func (m *Balances) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Accounts) > 0 { - for _, e := range m.Accounts { - l = e.Size() - n += 1 + l + sovTypes(uint64(l)) - } - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *PayIO) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.BlockID != 0 { - n += 1 + sovTypes(uint64(m.BlockID)) - } - if len(m.Transactions) > 0 { - for _, e := range m.Transactions { - l = e.Size() - n += 1 + l + sovTypes(uint64(l)) - } - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *Lifetime) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Unit != 0 { - n += 1 + sovTypes(uint64(m.Unit)) - } - if m.Value != 0 { - n += 1 + sovTypes(uint64(m.Value)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *Tx) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Type != 0 { - n += 1 + sovTypes(uint64(m.Type)) - } - l = len(m.From) - if l > 0 { - n += 1 + l + sovTypes(uint64(l)) - } - l = len(m.To) - if l > 0 { - n += 1 + l + sovTypes(uint64(l)) - } - if m.Amount != nil { - l = m.Amount.Size() - n += 1 + l + sovTypes(uint64(l)) - } - l = len(m.PublicKeys) - if l > 0 { - n += 1 + l + sovTypes(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *Settlement) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Epoch != 0 { - n += 1 + sovTypes(uint64(m.Epoch)) - } - if len(m.Transactions) > 0 { - for _, e := range m.Transactions { - l = e.Size() - n += 1 + l + sovTypes(uint64(l)) - } - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *Settlement_Receiver) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.To) - if l > 0 { - n += 1 + l + sovTypes(uint64(l)) - } - if m.Amount != nil { - l = m.Amount.Size() - n += 1 + l + sovTypes(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *Settlement_Container) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.CID.Size() - n += 1 + l + sovTypes(uint64(l)) - if len(m.SGIDs) > 0 { - for _, e := range m.SGIDs { - l = e.Size() - n += 1 + l + sovTypes(uint64(l)) - } - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *Settlement_Tx) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.From) - if l > 0 { - n += 1 + l + sovTypes(uint64(l)) - } - l = m.Container.Size() - n += 1 + l + sovTypes(uint64(l)) - if len(m.Receivers) > 0 { - for _, e := range m.Receivers { - l = e.Size() - n += 1 + l + sovTypes(uint64(l)) - } - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *ContainerCreateTarget) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.CID.Size() - n += 1 + l + sovTypes(uint64(l)) - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *WithdrawTarget) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Cheque) - if l > 0 { - n += 1 + l + sovTypes(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func sovTypes(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozTypes(x uint64) (n int) { - return sovTypes(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *Account) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Account: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Account: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OwnerID", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.OwnerID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Address = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ParentAddress", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ParentAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ActiveFunds", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.ActiveFunds == nil { - m.ActiveFunds = &decimal.Decimal{} - } - if err := m.ActiveFunds.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Lifetime", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Lifetime.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field LockTarget", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.LockTarget == nil { - m.LockTarget = &LockTarget{} - } - if err := m.LockTarget.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field LockAccounts", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.LockAccounts = append(m.LockAccounts, &Account{}) - if err := m.LockAccounts[len(m.LockAccounts)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *LockTarget) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: LockTarget: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: LockTarget: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field WithdrawTarget", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := &WithdrawTarget{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Target = &LockTarget_WithdrawTarget{v} - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ContainerCreateTarget", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := &ContainerCreateTarget{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Target = &LockTarget_ContainerCreateTarget{v} - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Balances) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Balances: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Balances: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Accounts", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Accounts = append(m.Accounts, Account{}) - if err := m.Accounts[len(m.Accounts)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *PayIO) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: PayIO: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: PayIO: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field BlockID", wireType) - } - m.BlockID = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.BlockID |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Transactions", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Transactions = append(m.Transactions, Tx{}) - if err := m.Transactions[len(m.Transactions)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Lifetime) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Lifetime: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Lifetime: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Unit", wireType) - } - m.Unit = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Unit |= Lifetime_Unit(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) - } - m.Value = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Value |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Tx) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Tx: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Tx: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) - } - m.Type = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Type |= Tx_Type(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field From", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.From = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field To", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.To = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Amount == nil { - m.Amount = &decimal.Decimal{} - } - if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PublicKeys", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.PublicKeys = append(m.PublicKeys[:0], dAtA[iNdEx:postIndex]...) - if m.PublicKeys == nil { - m.PublicKeys = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Settlement) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Settlement: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Settlement: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Epoch", wireType) - } - m.Epoch = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Epoch |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Transactions", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Transactions = append(m.Transactions, &Settlement_Tx{}) - if err := m.Transactions[len(m.Transactions)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Settlement_Receiver) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Receiver: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Receiver: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field To", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.To = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Amount == nil { - m.Amount = &decimal.Decimal{} - } - if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Settlement_Container) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Container: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Container: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CID", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.CID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SGIDs", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - var v SGID - m.SGIDs = append(m.SGIDs, v) - if err := m.SGIDs[len(m.SGIDs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Settlement_Tx) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Tx: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Tx: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field From", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.From = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Container", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Container.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Receivers", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Receivers = append(m.Receivers, Settlement_Receiver{}) - if err := m.Receivers[len(m.Receivers)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ContainerCreateTarget) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ContainerCreateTarget: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ContainerCreateTarget: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CID", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.CID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *WithdrawTarget) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: WithdrawTarget: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: WithdrawTarget: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Cheque", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Cheque = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipTypes(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTypes - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTypes - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTypes - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthTypes - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupTypes - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthTypes - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthTypes = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowTypes = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupTypes = fmt.Errorf("proto: unexpected end of group") -) diff --git a/accounting/types.proto b/accounting/types.proto deleted file mode 100644 index 02fb691..0000000 --- a/accounting/types.proto +++ /dev/null @@ -1,125 +0,0 @@ -syntax = "proto3"; -package accounting; -option go_package = "github.com/nspcc-dev/neofs-api-go/accounting"; -option csharp_namespace = "NeoFS.API.Accounting"; - -import "decimal/decimal.proto"; -import "github.com/gogo/protobuf/gogoproto/gogo.proto"; - -option (gogoproto.stable_marshaler_all) = true; - -message Account { - // OwnerID is a wallet address - bytes OwnerID = 1 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false]; - // Address is identifier of accounting record - string Address = 2; - // ParentAddress is identifier of parent accounting record - string ParentAddress = 3; - // ActiveFunds is amount of active (non locked) funds for account - decimal.Decimal ActiveFunds = 4; - // Lifetime is time until account is valid (used for lock accounts) - Lifetime Lifetime = 5 [(gogoproto.nullable) = false]; - // LockTarget is the purpose of lock funds (it might be withdraw or payment for storage) - LockTarget LockTarget = 6; - // LockAccounts contains child accounts with locked funds - repeated Account LockAccounts = 7; -} - -// LockTarget must be one of two options -message LockTarget { - oneof Target { - // WithdrawTarget used when user requested withdraw - WithdrawTarget WithdrawTarget = 1; - // ContainerCreateTarget used when user requested creation of container - ContainerCreateTarget ContainerCreateTarget = 2; - } -} - -message Balances { - // Accounts contains multiple account snapshots - repeated Account Accounts = 1 [(gogoproto.nullable) = false]; -} - -message PayIO { - // BlockID contains id of the NEO block where withdraw or deposit - // call was invoked - uint64 BlockID = 1; - // Transactions contains all transactions that founded in block - // and used for PayIO - repeated Tx Transactions = 2 [(gogoproto.nullable) = false]; -} - -message Lifetime { - // Unit can be Unlimited, based on NeoFS epoch or Neo block - enum Unit { - Unlimited = 0; - NeoFSEpoch = 1; - NeoBlock = 2; - } - - // Unit describes how lifetime is measured in account - Unit unit = 1 [(gogoproto.customname) = "Unit"]; - // Value describes how long lifetime will be valid - int64 Value = 2; -} - -message Tx { - // Type can be withdrawal, payIO or inner - enum Type { - Unknown = 0; - Withdraw = 1; - PayIO = 2; - Inner = 3; - } - - // Type describes target of transaction - Type type = 1 [(gogoproto.customname) = "Type"]; - // From describes sender of funds - string From = 2; - // To describes receiver of funds - string To = 3; - // Amount describes amount of funds - decimal.Decimal Amount = 4; - // PublicKeys contains public key of sender - bytes PublicKeys = 5; -} - -message Settlement { - message Receiver { - // To is the address of funds recipient - string To = 1; - // Amount is the amount of funds that will be sent - decimal.Decimal Amount = 2; - } - - message Container { - // CID is container identifier - bytes CID = 1 [(gogoproto.customtype) = "CID", (gogoproto.nullable) = false]; - // SGIDs is a set of storage groups that successfully passed the audit - repeated bytes SGIDs = 2 [(gogoproto.customtype) = "SGID", (gogoproto.nullable) = false]; - } - - message Tx { - // From is the address of the sender of funds - string From = 1; - // Container that successfully had passed the audit - Container Container = 2 [(gogoproto.nullable) = false]; - // Receivers is a set of addresses of funds recipients - repeated Receiver Receivers = 3 [(gogoproto.nullable) = false]; - } - - // Epoch contains an epoch when settlement was accepted - uint64 Epoch = 1; - // Transactions is a set of transactions - repeated Tx Transactions = 2; -} - -message ContainerCreateTarget { - // CID is container identifier - bytes CID = 1 [(gogoproto.customtype) = "CID", (gogoproto.nullable) = false]; -} - -message WithdrawTarget { - // Cheque is a string representation of cheque id - string Cheque = 1; -} diff --git a/accounting/types_test.go b/accounting/types_test.go deleted file mode 100644 index a440028..0000000 --- a/accounting/types_test.go +++ /dev/null @@ -1,193 +0,0 @@ -package accounting - -import ( - "io/ioutil" - "testing" - - "github.com/mr-tron/base58" - "github.com/nspcc-dev/neofs-api-go/chain" - "github.com/nspcc-dev/neofs-api-go/decimal" - "github.com/nspcc-dev/neofs-api-go/refs" - "github.com/nspcc-dev/neofs-crypto/test" - "github.com/stretchr/testify/require" -) - -func TestCheque(t *testing.T) { - t.Run("new/valid", func(t *testing.T) { - id, err := NewChequeID() - require.NoError(t, err) - require.True(t, id.Valid()) - - d := make([]byte, chain.AddressLength+1) - - // expected size + 1 byte - str := base58.Encode(d) - require.False(t, ChequeID(str).Valid()) - - // expected size - 1 byte - str = base58.Encode(d[:len(d)-2]) - require.False(t, ChequeID(str).Valid()) - - // wrong encoding - d = d[:len(d)-1] // normal size - require.False(t, ChequeID(string(d)).Valid()) - }) - - t.Run("marshal/unmarshal", func(t *testing.T) { - b2 := new(Cheque) - - key1 := test.DecodeKey(0) - key2 := test.DecodeKey(1) - - id, err := NewChequeID() - require.NoError(t, err) - - owner, err := refs.NewOwnerID(&key1.PublicKey) - require.NoError(t, err) - - b1 := &Cheque{ - ID: id, - Owner: owner, - Height: 100, - Amount: decimal.NewGAS(100), - } - - require.NoError(t, b1.Sign(key1)) - require.NoError(t, b1.Sign(key2)) - - data, err := b1.MarshalBinary() - require.NoError(t, err) - - require.Len(t, data, b1.Size()) - require.NoError(t, b2.UnmarshalBinary(data)) - require.Equal(t, b1, b2) - - require.NoError(t, b1.Verify()) - require.NoError(t, b2.Verify()) - }) - - t.Run("example from SC", func(t *testing.T) { - pathToCheque := "fixtures/cheque_data" - expect, err := ioutil.ReadFile(pathToCheque) - require.NoError(t, err) - - var cheque Cheque - require.NoError(t, cheque.UnmarshalBinary(expect)) - - actual, err := cheque.MarshalBinary() - require.NoError(t, err) - - require.Equal(t, expect, actual) - - require.NoError(t, cheque.Verify()) - require.Equal(t, cheque.Height, uint64(7777)) - require.Equal(t, cheque.Amount, decimal.NewGAS(42)) - }) -} - -func TestBalanceRequest_SetOwnerID(t *testing.T) { - ownerID := OwnerID{1, 2, 3} - m := new(BalanceRequest) - - m.SetOwnerID(ownerID) - - require.Equal(t, ownerID, m.GetOwnerID()) -} - -func TestGetRequestGettersSetters(t *testing.T) { - t.Run("id", func(t *testing.T) { - id := ChequeID("test id") - m := new(GetRequest) - - m.SetID(id) - - require.Equal(t, id, m.GetID()) - }) - - t.Run("owner", func(t *testing.T) { - id := OwnerID{1, 2, 3} - m := new(GetRequest) - - m.SetOwnerID(id) - - require.Equal(t, id, m.GetOwnerID()) - }) -} - -func TestPutRequestGettersSetters(t *testing.T) { - t.Run("owner", func(t *testing.T) { - id := OwnerID{1, 2, 3} - m := new(PutRequest) - - m.SetOwnerID(id) - - require.Equal(t, id, m.GetOwnerID()) - }) - - t.Run("message ID", func(t *testing.T) { - id, err := refs.NewUUID() - require.NoError(t, err) - - m := new(PutRequest) - m.SetMessageID(id) - - require.Equal(t, id, m.GetMessageID()) - }) - - t.Run("amount", func(t *testing.T) { - amount := decimal.New(1) - m := new(PutRequest) - - m.SetAmount(amount) - - require.Equal(t, amount, m.GetAmount()) - }) - - t.Run("height", func(t *testing.T) { - h := uint64(3) - m := new(PutRequest) - - m.SetHeight(h) - - require.Equal(t, h, m.GetHeight()) - }) -} - -func TestListRequestGettersSetters(t *testing.T) { - ownerID := OwnerID{1, 2, 3} - m := new(ListRequest) - - m.SetOwnerID(ownerID) - - require.Equal(t, ownerID, m.GetOwnerID()) -} - -func TestDeleteRequestGettersSetters(t *testing.T) { - t.Run("id", func(t *testing.T) { - id := ChequeID("test id") - m := new(DeleteRequest) - - m.SetID(id) - - require.Equal(t, id, m.GetID()) - }) - - t.Run("owner", func(t *testing.T) { - id := OwnerID{1, 2, 3} - m := new(DeleteRequest) - - m.SetOwnerID(id) - - require.Equal(t, id, m.GetOwnerID()) - }) - - t.Run("message ID", func(t *testing.T) { - id, err := refs.NewUUID() - require.NoError(t, err) - - m := new(DeleteRequest) - m.SetMessageID(id) - - require.Equal(t, id, m.GetMessageID()) - }) -} diff --git a/accounting/withdraw.go b/accounting/withdraw.go deleted file mode 100644 index 1077395..0000000 --- a/accounting/withdraw.go +++ /dev/null @@ -1,35 +0,0 @@ -package accounting - -import ( - "encoding/binary" - - "github.com/nspcc-dev/neofs-api-go/refs" -) - -type ( - // MessageID type alias. - MessageID = refs.MessageID -) - -// PrepareData prepares bytes representation of PutRequest to satisfy SignedRequest interface. -func (m *PutRequest) PrepareData() ([]byte, error) { - var offset int - // MessageID-len + OwnerID-len + Amount + Height - buf := make([]byte, refs.UUIDSize+refs.OwnerIDSize+binary.MaxVarintLen64+binary.MaxVarintLen64) - offset += copy(buf[offset:], m.MessageID.Bytes()) - offset += copy(buf[offset:], m.OwnerID.Bytes()) - offset += binary.PutVarint(buf[offset:], m.Amount.Value) - binary.PutUvarint(buf[offset:], m.Height) - return buf, nil -} - -// PrepareData prepares bytes representation of DeleteRequest to satisfy SignedRequest interface. -func (m *DeleteRequest) PrepareData() ([]byte, error) { - var offset int - // ID-len + OwnerID-len + MessageID-len - buf := make([]byte, refs.UUIDSize+refs.OwnerIDSize+refs.UUIDSize) - offset += copy(buf[offset:], m.ID.Bytes()) - offset += copy(buf[offset:], m.OwnerID.Bytes()) - copy(buf[offset:], m.MessageID.Bytes()) - return buf, nil -} diff --git a/accounting/withdraw.pb.go b/accounting/withdraw.pb.go deleted file mode 100644 index e0825f5..0000000 --- a/accounting/withdraw.pb.go +++ /dev/null @@ -1,2819 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: accounting/withdraw.proto - -package accounting - -import ( - context "context" - fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/golang/protobuf/proto" - decimal "github.com/nspcc-dev/neofs-api-go/decimal" - service "github.com/nspcc-dev/neofs-api-go/service" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package - -type Item struct { - // ID is a cheque identifier - ID ChequeID `protobuf:"bytes,1,opt,name=ID,proto3,customtype=ChequeID" json:"ID"` - // OwnerID is a wallet address - OwnerID OwnerID `protobuf:"bytes,2,opt,name=OwnerID,proto3,customtype=OwnerID" json:"OwnerID"` - // Amount of funds - Amount *decimal.Decimal `protobuf:"bytes,3,opt,name=Amount,proto3" json:"Amount,omitempty"` - // Height is the neo blockchain height until the cheque is valid - Height uint64 `protobuf:"varint,4,opt,name=Height,proto3" json:"Height,omitempty"` - // Payload contains cheque representation in bytes - Payload []byte `protobuf:"bytes,5,opt,name=Payload,proto3" json:"Payload,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Item) Reset() { *m = Item{} } -func (m *Item) String() string { return proto.CompactTextString(m) } -func (*Item) ProtoMessage() {} -func (*Item) Descriptor() ([]byte, []int) { - return fileDescriptor_b3a38a4dc2575267, []int{0} -} -func (m *Item) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Item) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *Item) XXX_Merge(src proto.Message) { - xxx_messageInfo_Item.Merge(m, src) -} -func (m *Item) XXX_Size() int { - return m.Size() -} -func (m *Item) XXX_DiscardUnknown() { - xxx_messageInfo_Item.DiscardUnknown(m) -} - -var xxx_messageInfo_Item proto.InternalMessageInfo - -func (m *Item) GetAmount() *decimal.Decimal { - if m != nil { - return m.Amount - } - return nil -} - -func (m *Item) GetHeight() uint64 { - if m != nil { - return m.Height - } - return 0 -} - -func (m *Item) GetPayload() []byte { - if m != nil { - return m.Payload - } - return nil -} - -type GetRequest struct { - // ID is cheque identifier - ID ChequeID `protobuf:"bytes,1,opt,name=ID,proto3,customtype=ChequeID" json:"ID"` - // OwnerID is a wallet address - OwnerID OwnerID `protobuf:"bytes,2,opt,name=OwnerID,proto3,customtype=OwnerID" json:"OwnerID"` - // RequestMetaHeader contains information about request meta headers (should be embedded into message) - service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` - // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) - service.RequestVerificationHeader `protobuf:"bytes,99,opt,name=Verify,proto3,embedded=Verify" json:"Verify"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GetRequest) Reset() { *m = GetRequest{} } -func (m *GetRequest) String() string { return proto.CompactTextString(m) } -func (*GetRequest) ProtoMessage() {} -func (*GetRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_b3a38a4dc2575267, []int{1} -} -func (m *GetRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *GetRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *GetRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetRequest.Merge(m, src) -} -func (m *GetRequest) XXX_Size() int { - return m.Size() -} -func (m *GetRequest) XXX_DiscardUnknown() { - xxx_messageInfo_GetRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_GetRequest proto.InternalMessageInfo - -type GetResponse struct { - // Withdraw is cheque with meta information - Withdraw *Item `protobuf:"bytes,1,opt,name=Withdraw,proto3" json:"Withdraw,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GetResponse) Reset() { *m = GetResponse{} } -func (m *GetResponse) String() string { return proto.CompactTextString(m) } -func (*GetResponse) ProtoMessage() {} -func (*GetResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_b3a38a4dc2575267, []int{2} -} -func (m *GetResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *GetResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *GetResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetResponse.Merge(m, src) -} -func (m *GetResponse) XXX_Size() int { - return m.Size() -} -func (m *GetResponse) XXX_DiscardUnknown() { - xxx_messageInfo_GetResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_GetResponse proto.InternalMessageInfo - -func (m *GetResponse) GetWithdraw() *Item { - if m != nil { - return m.Withdraw - } - return nil -} - -type PutRequest struct { - // OwnerID is a wallet address - OwnerID OwnerID `protobuf:"bytes,1,opt,name=OwnerID,proto3,customtype=OwnerID" json:"OwnerID"` - // Amount of funds - Amount *decimal.Decimal `protobuf:"bytes,2,opt,name=Amount,proto3" json:"Amount,omitempty"` - // Height is the neo blockchain height until the cheque is valid - Height uint64 `protobuf:"varint,3,opt,name=Height,proto3" json:"Height,omitempty"` - // MessageID is a nonce for uniq request (UUIDv4) - MessageID MessageID `protobuf:"bytes,4,opt,name=MessageID,proto3,customtype=MessageID" json:"MessageID"` - // RequestMetaHeader contains information about request meta headers (should be embedded into message) - service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` - // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) - service.RequestVerificationHeader `protobuf:"bytes,99,opt,name=Verify,proto3,embedded=Verify" json:"Verify"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *PutRequest) Reset() { *m = PutRequest{} } -func (m *PutRequest) String() string { return proto.CompactTextString(m) } -func (*PutRequest) ProtoMessage() {} -func (*PutRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_b3a38a4dc2575267, []int{3} -} -func (m *PutRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *PutRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *PutRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_PutRequest.Merge(m, src) -} -func (m *PutRequest) XXX_Size() int { - return m.Size() -} -func (m *PutRequest) XXX_DiscardUnknown() { - xxx_messageInfo_PutRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_PutRequest proto.InternalMessageInfo - -func (m *PutRequest) GetAmount() *decimal.Decimal { - if m != nil { - return m.Amount - } - return nil -} - -func (m *PutRequest) GetHeight() uint64 { - if m != nil { - return m.Height - } - return 0 -} - -type PutResponse struct { - // ID is cheque identifier - ID ChequeID `protobuf:"bytes,1,opt,name=ID,proto3,customtype=ChequeID" json:"ID"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *PutResponse) Reset() { *m = PutResponse{} } -func (m *PutResponse) String() string { return proto.CompactTextString(m) } -func (*PutResponse) ProtoMessage() {} -func (*PutResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_b3a38a4dc2575267, []int{4} -} -func (m *PutResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *PutResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *PutResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_PutResponse.Merge(m, src) -} -func (m *PutResponse) XXX_Size() int { - return m.Size() -} -func (m *PutResponse) XXX_DiscardUnknown() { - xxx_messageInfo_PutResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_PutResponse proto.InternalMessageInfo - -type ListRequest struct { - // OwnerID is a wallet address - OwnerID OwnerID `protobuf:"bytes,1,opt,name=OwnerID,proto3,customtype=OwnerID" json:"OwnerID"` - // RequestMetaHeader contains information about request meta headers (should be embedded into message) - service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` - // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) - service.RequestVerificationHeader `protobuf:"bytes,99,opt,name=Verify,proto3,embedded=Verify" json:"Verify"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ListRequest) Reset() { *m = ListRequest{} } -func (m *ListRequest) String() string { return proto.CompactTextString(m) } -func (*ListRequest) ProtoMessage() {} -func (*ListRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_b3a38a4dc2575267, []int{5} -} -func (m *ListRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ListRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *ListRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_ListRequest.Merge(m, src) -} -func (m *ListRequest) XXX_Size() int { - return m.Size() -} -func (m *ListRequest) XXX_DiscardUnknown() { - xxx_messageInfo_ListRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_ListRequest proto.InternalMessageInfo - -type ListResponse struct { - // Items is a set of cheques with meta information - Items []*Item `protobuf:"bytes,1,rep,name=Items,proto3" json:"Items,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ListResponse) Reset() { *m = ListResponse{} } -func (m *ListResponse) String() string { return proto.CompactTextString(m) } -func (*ListResponse) ProtoMessage() {} -func (*ListResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_b3a38a4dc2575267, []int{6} -} -func (m *ListResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ListResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *ListResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_ListResponse.Merge(m, src) -} -func (m *ListResponse) XXX_Size() int { - return m.Size() -} -func (m *ListResponse) XXX_DiscardUnknown() { - xxx_messageInfo_ListResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_ListResponse proto.InternalMessageInfo - -func (m *ListResponse) GetItems() []*Item { - if m != nil { - return m.Items - } - return nil -} - -type DeleteRequest struct { - // ID is cheque identifier - ID ChequeID `protobuf:"bytes,1,opt,name=ID,proto3,customtype=ChequeID" json:"ID"` - // OwnerID is a wallet address - OwnerID OwnerID `protobuf:"bytes,2,opt,name=OwnerID,proto3,customtype=OwnerID" json:"OwnerID"` - // MessageID is a nonce for uniq request (UUIDv4) - MessageID MessageID `protobuf:"bytes,3,opt,name=MessageID,proto3,customtype=MessageID" json:"MessageID"` - // RequestMetaHeader contains information about request meta headers (should be embedded into message) - service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` - // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) - service.RequestVerificationHeader `protobuf:"bytes,99,opt,name=Verify,proto3,embedded=Verify" json:"Verify"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *DeleteRequest) Reset() { *m = DeleteRequest{} } -func (m *DeleteRequest) String() string { return proto.CompactTextString(m) } -func (*DeleteRequest) ProtoMessage() {} -func (*DeleteRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_b3a38a4dc2575267, []int{7} -} -func (m *DeleteRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *DeleteRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *DeleteRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_DeleteRequest.Merge(m, src) -} -func (m *DeleteRequest) XXX_Size() int { - return m.Size() -} -func (m *DeleteRequest) XXX_DiscardUnknown() { - xxx_messageInfo_DeleteRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_DeleteRequest proto.InternalMessageInfo - -// DeleteResponse is empty -type DeleteResponse struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *DeleteResponse) Reset() { *m = DeleteResponse{} } -func (m *DeleteResponse) String() string { return proto.CompactTextString(m) } -func (*DeleteResponse) ProtoMessage() {} -func (*DeleteResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_b3a38a4dc2575267, []int{8} -} -func (m *DeleteResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *DeleteResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *DeleteResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_DeleteResponse.Merge(m, src) -} -func (m *DeleteResponse) XXX_Size() int { - return m.Size() -} -func (m *DeleteResponse) XXX_DiscardUnknown() { - xxx_messageInfo_DeleteResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_DeleteResponse proto.InternalMessageInfo - -func init() { - proto.RegisterType((*Item)(nil), "accounting.Item") - proto.RegisterType((*GetRequest)(nil), "accounting.GetRequest") - proto.RegisterType((*GetResponse)(nil), "accounting.GetResponse") - proto.RegisterType((*PutRequest)(nil), "accounting.PutRequest") - proto.RegisterType((*PutResponse)(nil), "accounting.PutResponse") - proto.RegisterType((*ListRequest)(nil), "accounting.ListRequest") - proto.RegisterType((*ListResponse)(nil), "accounting.ListResponse") - proto.RegisterType((*DeleteRequest)(nil), "accounting.DeleteRequest") - proto.RegisterType((*DeleteResponse)(nil), "accounting.DeleteResponse") -} - -func init() { proto.RegisterFile("accounting/withdraw.proto", fileDescriptor_b3a38a4dc2575267) } - -var fileDescriptor_b3a38a4dc2575267 = []byte{ - // 620 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x55, 0xc1, 0x6e, 0xd3, 0x4c, - 0x10, 0xee, 0xda, 0x69, 0xda, 0x7f, 0xd2, 0x1f, 0xca, 0xaa, 0x14, 0xd7, 0x87, 0x34, 0xf2, 0x01, - 0x05, 0xa9, 0xb1, 0xa5, 0x22, 0x55, 0x20, 0x0e, 0xa8, 0xc1, 0xa2, 0xb5, 0x44, 0x21, 0x32, 0x12, - 0x08, 0x6e, 0x8e, 0x33, 0x75, 0x2c, 0x35, 0xde, 0x60, 0xaf, 0x5b, 0xf5, 0x21, 0xb8, 0xf3, 0x0c, - 0xbd, 0x70, 0xe5, 0x11, 0x7a, 0xec, 0x11, 0x38, 0x54, 0x28, 0xbc, 0x03, 0x67, 0xe4, 0xf5, 0xba, - 0x76, 0xda, 0x4a, 0x54, 0x08, 0x54, 0x71, 0xca, 0xee, 0x7c, 0x33, 0xbb, 0x33, 0xdf, 0xf7, 0x6d, - 0x0c, 0x2b, 0x9e, 0xef, 0xb3, 0x34, 0xe2, 0x61, 0x14, 0x58, 0x07, 0x21, 0x1f, 0x0e, 0x62, 0xef, - 0xc0, 0x1c, 0xc7, 0x8c, 0x33, 0x0a, 0x25, 0xa4, 0xd3, 0x04, 0xe3, 0xfd, 0xd0, 0x47, 0x6b, 0x84, - 0xdc, 0xcb, 0x71, 0x7d, 0xa9, 0x88, 0xed, 0x63, 0x1c, 0xee, 0x1e, 0xca, 0xe8, 0xed, 0x01, 0xfa, - 0xe1, 0xc8, 0xdb, 0xb3, 0xe4, 0xaf, 0x0c, 0x77, 0x82, 0x90, 0x0f, 0xd3, 0xbe, 0xe9, 0xb3, 0x91, - 0x15, 0xb0, 0x80, 0x59, 0x22, 0xdc, 0x4f, 0x77, 0xc5, 0x4e, 0x6c, 0xc4, 0x2a, 0x4f, 0x37, 0x3e, - 0x12, 0xa8, 0x39, 0x1c, 0x47, 0xb4, 0x05, 0x8a, 0x63, 0x6b, 0xa4, 0x45, 0xda, 0x0b, 0xdd, 0xc5, - 0xe3, 0xd3, 0xd5, 0x99, 0xaf, 0xa7, 0xab, 0xf3, 0x4f, 0x86, 0xf8, 0x2e, 0x45, 0xc7, 0x76, 0x15, - 0xc7, 0xa6, 0xf7, 0x60, 0xee, 0xc5, 0x41, 0x84, 0xb1, 0x63, 0x6b, 0x8a, 0x48, 0xbb, 0x29, 0xd3, - 0x8a, 0xb0, 0x5b, 0x2c, 0x68, 0x1b, 0xea, 0x9b, 0xa3, 0x6c, 0x24, 0x4d, 0x6d, 0x91, 0x76, 0x63, - 0x7d, 0xd1, 0x2c, 0x9a, 0xb4, 0xf3, 0x5f, 0x57, 0xe2, 0x74, 0x19, 0xea, 0xdb, 0x18, 0x06, 0x43, - 0xae, 0xd5, 0x5a, 0xa4, 0x5d, 0x73, 0xe5, 0x8e, 0x6a, 0x30, 0xd7, 0xf3, 0x0e, 0xf7, 0x98, 0x37, - 0xd0, 0x66, 0xb3, 0xcb, 0xdc, 0x62, 0x6b, 0x7c, 0x21, 0x00, 0x5b, 0xc8, 0xdd, 0xac, 0xb3, 0x84, - 0xff, 0xd9, 0xbe, 0x1f, 0x40, 0x6d, 0x07, 0xb9, 0xa7, 0xf5, 0x45, 0xd7, 0xba, 0x29, 0x89, 0x37, - 0xe5, 0x65, 0x19, 0xb6, 0x8d, 0xde, 0x00, 0xe3, 0xee, 0x7c, 0x76, 0xc6, 0xc9, 0xe9, 0x2a, 0x71, - 0x45, 0x05, 0xb5, 0xa1, 0xfe, 0x4a, 0xa8, 0xa3, 0xf9, 0xa2, 0xd6, 0x38, 0x5f, 0x2b, 0xd0, 0xd0, - 0xf7, 0x78, 0xc8, 0xa2, 0x0b, 0x67, 0xc8, 0x5a, 0xe3, 0x11, 0x34, 0xc4, 0x68, 0xc9, 0x98, 0x45, - 0x09, 0xd2, 0x35, 0x98, 0x7f, 0x2d, 0xad, 0x22, 0x26, 0xcc, 0x88, 0x2c, 0xbd, 0x62, 0x66, 0xba, - 0xb9, 0x67, 0x19, 0xc6, 0x91, 0x02, 0xd0, 0x4b, 0xcf, 0x88, 0xa9, 0x8c, 0x4d, 0xae, 0x2c, 0x97, - 0x72, 0x65, 0xb9, 0xd4, 0x29, 0xb9, 0x2c, 0xf8, 0x6f, 0x07, 0x93, 0xc4, 0x0b, 0xd0, 0xb1, 0x85, - 0x92, 0x0b, 0xdd, 0x5b, 0xf2, 0xba, 0x12, 0x70, 0xcb, 0xe5, 0xb5, 0x33, 0x6d, 0x41, 0x43, 0x70, - 0x25, 0x99, 0xfe, 0xa5, 0x8b, 0x8c, 0x4f, 0x04, 0x1a, 0xcf, 0xc2, 0xe4, 0x77, 0xe8, 0xbd, 0xee, - 0x59, 0x37, 0x60, 0x21, 0xef, 0x5c, 0x0e, 0x7b, 0x17, 0x66, 0x33, 0xeb, 0x24, 0x1a, 0x69, 0xa9, - 0x97, 0x7a, 0x2a, 0x87, 0x8d, 0xf7, 0x0a, 0xfc, 0x6f, 0xe3, 0x1e, 0x72, 0xfc, 0x2b, 0x8f, 0x6d, - 0xca, 0x33, 0xea, 0x3f, 0xe0, 0x99, 0x45, 0xb8, 0x51, 0xd0, 0x91, 0x33, 0xb9, 0xfe, 0x83, 0x94, - 0x2f, 0x94, 0x6e, 0x80, 0xba, 0x85, 0x9c, 0x2e, 0x57, 0xe9, 0x2c, 0xff, 0xa8, 0xf4, 0x3b, 0x17, - 0xe2, 0x52, 0x8e, 0x0d, 0x50, 0x7b, 0xe9, 0xb9, 0xba, 0xf2, 0x1d, 0x4f, 0xd7, 0x55, 0x3d, 0xfb, - 0x10, 0x6a, 0x99, 0xac, 0x74, 0x2a, 0xa1, 0x62, 0x51, 0x5d, 0xbb, 0x08, 0xc8, 0xd2, 0xc7, 0x50, - 0xcf, 0x27, 0xa1, 0x2b, 0xd5, 0x9c, 0x29, 0xb1, 0x75, 0xfd, 0x32, 0x28, 0x3f, 0xa0, 0xfb, 0xe6, - 0x78, 0xd2, 0x24, 0x27, 0x93, 0x26, 0xf9, 0x3c, 0x69, 0x92, 0x6f, 0x93, 0x26, 0xf9, 0xf0, 0xbd, - 0x39, 0xf3, 0x76, 0xad, 0xf2, 0xed, 0x89, 0x92, 0xb1, 0xef, 0x77, 0x06, 0xb8, 0x6f, 0x45, 0xc8, - 0x76, 0x93, 0x8e, 0x37, 0x0e, 0x3b, 0x01, 0xb3, 0xca, 0x23, 0x8f, 0x94, 0xa5, 0xe7, 0xc8, 0x9e, - 0xbe, 0x34, 0x37, 0x7b, 0x8e, 0xb9, 0x79, 0x16, 0xee, 0xd7, 0xc5, 0x87, 0xe9, 0xfe, 0xcf, 0x00, - 0x00, 0x00, 0xff, 0xff, 0x87, 0x9f, 0x16, 0xf3, 0x31, 0x07, 0x00, 0x00, -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 - -// WithdrawClient is the client API for Withdraw service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type WithdrawClient interface { - // Get returns cheque if it was signed by inner ring nodes - Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*GetResponse, error) - // Put ask inner ring nodes to sign a cheque for withdraw invoke - Put(ctx context.Context, in *PutRequest, opts ...grpc.CallOption) (*PutResponse, error) - // List shows all user's checks - List(ctx context.Context, in *ListRequest, opts ...grpc.CallOption) (*ListResponse, error) - // Delete allows user to remove unused cheque - Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteResponse, error) -} - -type withdrawClient struct { - cc *grpc.ClientConn -} - -func NewWithdrawClient(cc *grpc.ClientConn) WithdrawClient { - return &withdrawClient{cc} -} - -func (c *withdrawClient) Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*GetResponse, error) { - out := new(GetResponse) - err := c.cc.Invoke(ctx, "/accounting.Withdraw/Get", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *withdrawClient) Put(ctx context.Context, in *PutRequest, opts ...grpc.CallOption) (*PutResponse, error) { - out := new(PutResponse) - err := c.cc.Invoke(ctx, "/accounting.Withdraw/Put", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *withdrawClient) List(ctx context.Context, in *ListRequest, opts ...grpc.CallOption) (*ListResponse, error) { - out := new(ListResponse) - err := c.cc.Invoke(ctx, "/accounting.Withdraw/List", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *withdrawClient) Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteResponse, error) { - out := new(DeleteResponse) - err := c.cc.Invoke(ctx, "/accounting.Withdraw/Delete", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// WithdrawServer is the server API for Withdraw service. -type WithdrawServer interface { - // Get returns cheque if it was signed by inner ring nodes - Get(context.Context, *GetRequest) (*GetResponse, error) - // Put ask inner ring nodes to sign a cheque for withdraw invoke - Put(context.Context, *PutRequest) (*PutResponse, error) - // List shows all user's checks - List(context.Context, *ListRequest) (*ListResponse, error) - // Delete allows user to remove unused cheque - Delete(context.Context, *DeleteRequest) (*DeleteResponse, error) -} - -// UnimplementedWithdrawServer can be embedded to have forward compatible implementations. -type UnimplementedWithdrawServer struct { -} - -func (*UnimplementedWithdrawServer) Get(ctx context.Context, req *GetRequest) (*GetResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Get not implemented") -} -func (*UnimplementedWithdrawServer) Put(ctx context.Context, req *PutRequest) (*PutResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Put not implemented") -} -func (*UnimplementedWithdrawServer) List(ctx context.Context, req *ListRequest) (*ListResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method List not implemented") -} -func (*UnimplementedWithdrawServer) Delete(ctx context.Context, req *DeleteRequest) (*DeleteResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Delete not implemented") -} - -func RegisterWithdrawServer(s *grpc.Server, srv WithdrawServer) { - s.RegisterService(&_Withdraw_serviceDesc, srv) -} - -func _Withdraw_Get_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(WithdrawServer).Get(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/accounting.Withdraw/Get", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(WithdrawServer).Get(ctx, req.(*GetRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Withdraw_Put_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(PutRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(WithdrawServer).Put(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/accounting.Withdraw/Put", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(WithdrawServer).Put(ctx, req.(*PutRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Withdraw_List_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ListRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(WithdrawServer).List(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/accounting.Withdraw/List", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(WithdrawServer).List(ctx, req.(*ListRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Withdraw_Delete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(DeleteRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(WithdrawServer).Delete(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/accounting.Withdraw/Delete", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(WithdrawServer).Delete(ctx, req.(*DeleteRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _Withdraw_serviceDesc = grpc.ServiceDesc{ - ServiceName: "accounting.Withdraw", - HandlerType: (*WithdrawServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Get", - Handler: _Withdraw_Get_Handler, - }, - { - MethodName: "Put", - Handler: _Withdraw_Put_Handler, - }, - { - MethodName: "List", - Handler: _Withdraw_List_Handler, - }, - { - MethodName: "Delete", - Handler: _Withdraw_Delete_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "accounting/withdraw.proto", -} - -func (m *Item) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Item) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Item) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.Payload) > 0 { - i -= len(m.Payload) - copy(dAtA[i:], m.Payload) - i = encodeVarintWithdraw(dAtA, i, uint64(len(m.Payload))) - i-- - dAtA[i] = 0x2a - } - if m.Height != 0 { - i = encodeVarintWithdraw(dAtA, i, uint64(m.Height)) - i-- - dAtA[i] = 0x20 - } - if m.Amount != nil { - { - size, err := m.Amount.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintWithdraw(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - { - size := m.OwnerID.Size() - i -= size - if _, err := m.OwnerID.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintWithdraw(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size := m.ID.Size() - i -= size - if _, err := m.ID.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintWithdraw(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *GetRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *GetRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *GetRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - { - size, err := m.RequestVerificationHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintWithdraw(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x6 - i-- - dAtA[i] = 0x9a - { - size, err := m.RequestMetaHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintWithdraw(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x6 - i-- - dAtA[i] = 0x92 - { - size := m.OwnerID.Size() - i -= size - if _, err := m.OwnerID.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintWithdraw(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size := m.ID.Size() - i -= size - if _, err := m.ID.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintWithdraw(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *GetResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *GetResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *GetResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.Withdraw != nil { - { - size, err := m.Withdraw.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintWithdraw(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *PutRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *PutRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *PutRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - { - size, err := m.RequestVerificationHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintWithdraw(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x6 - i-- - dAtA[i] = 0x9a - { - size, err := m.RequestMetaHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintWithdraw(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x6 - i-- - dAtA[i] = 0x92 - { - size := m.MessageID.Size() - i -= size - if _, err := m.MessageID.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintWithdraw(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - if m.Height != 0 { - i = encodeVarintWithdraw(dAtA, i, uint64(m.Height)) - i-- - dAtA[i] = 0x18 - } - if m.Amount != nil { - { - size, err := m.Amount.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintWithdraw(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - { - size := m.OwnerID.Size() - i -= size - if _, err := m.OwnerID.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintWithdraw(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *PutResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *PutResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *PutResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - { - size := m.ID.Size() - i -= size - if _, err := m.ID.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintWithdraw(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *ListRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ListRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ListRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - { - size, err := m.RequestVerificationHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintWithdraw(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x6 - i-- - dAtA[i] = 0x9a - { - size, err := m.RequestMetaHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintWithdraw(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x6 - i-- - dAtA[i] = 0x92 - { - size := m.OwnerID.Size() - i -= size - if _, err := m.OwnerID.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintWithdraw(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *ListResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ListResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ListResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.Items) > 0 { - for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintWithdraw(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *DeleteRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *DeleteRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *DeleteRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - { - size, err := m.RequestVerificationHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintWithdraw(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x6 - i-- - dAtA[i] = 0x9a - { - size, err := m.RequestMetaHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintWithdraw(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x6 - i-- - dAtA[i] = 0x92 - { - size := m.MessageID.Size() - i -= size - if _, err := m.MessageID.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintWithdraw(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - { - size := m.OwnerID.Size() - i -= size - if _, err := m.OwnerID.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintWithdraw(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size := m.ID.Size() - i -= size - if _, err := m.ID.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintWithdraw(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *DeleteResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *DeleteResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *DeleteResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - return len(dAtA) - i, nil -} - -func encodeVarintWithdraw(dAtA []byte, offset int, v uint64) int { - offset -= sovWithdraw(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *Item) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ID.Size() - n += 1 + l + sovWithdraw(uint64(l)) - l = m.OwnerID.Size() - n += 1 + l + sovWithdraw(uint64(l)) - if m.Amount != nil { - l = m.Amount.Size() - n += 1 + l + sovWithdraw(uint64(l)) - } - if m.Height != 0 { - n += 1 + sovWithdraw(uint64(m.Height)) - } - l = len(m.Payload) - if l > 0 { - n += 1 + l + sovWithdraw(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *GetRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ID.Size() - n += 1 + l + sovWithdraw(uint64(l)) - l = m.OwnerID.Size() - n += 1 + l + sovWithdraw(uint64(l)) - l = m.RequestMetaHeader.Size() - n += 2 + l + sovWithdraw(uint64(l)) - l = m.RequestVerificationHeader.Size() - n += 2 + l + sovWithdraw(uint64(l)) - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *GetResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Withdraw != nil { - l = m.Withdraw.Size() - n += 1 + l + sovWithdraw(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *PutRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.OwnerID.Size() - n += 1 + l + sovWithdraw(uint64(l)) - if m.Amount != nil { - l = m.Amount.Size() - n += 1 + l + sovWithdraw(uint64(l)) - } - if m.Height != 0 { - n += 1 + sovWithdraw(uint64(m.Height)) - } - l = m.MessageID.Size() - n += 1 + l + sovWithdraw(uint64(l)) - l = m.RequestMetaHeader.Size() - n += 2 + l + sovWithdraw(uint64(l)) - l = m.RequestVerificationHeader.Size() - n += 2 + l + sovWithdraw(uint64(l)) - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *PutResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ID.Size() - n += 1 + l + sovWithdraw(uint64(l)) - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *ListRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.OwnerID.Size() - n += 1 + l + sovWithdraw(uint64(l)) - l = m.RequestMetaHeader.Size() - n += 2 + l + sovWithdraw(uint64(l)) - l = m.RequestVerificationHeader.Size() - n += 2 + l + sovWithdraw(uint64(l)) - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *ListResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Items) > 0 { - for _, e := range m.Items { - l = e.Size() - n += 1 + l + sovWithdraw(uint64(l)) - } - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *DeleteRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ID.Size() - n += 1 + l + sovWithdraw(uint64(l)) - l = m.OwnerID.Size() - n += 1 + l + sovWithdraw(uint64(l)) - l = m.MessageID.Size() - n += 1 + l + sovWithdraw(uint64(l)) - l = m.RequestMetaHeader.Size() - n += 2 + l + sovWithdraw(uint64(l)) - l = m.RequestVerificationHeader.Size() - n += 2 + l + sovWithdraw(uint64(l)) - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *DeleteResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func sovWithdraw(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozWithdraw(x uint64) (n int) { - return sovWithdraw(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *Item) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWithdraw - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Item: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Item: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWithdraw - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthWithdraw - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthWithdraw - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OwnerID", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWithdraw - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthWithdraw - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthWithdraw - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.OwnerID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWithdraw - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthWithdraw - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthWithdraw - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Amount == nil { - m.Amount = &decimal.Decimal{} - } - if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType) - } - m.Height = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWithdraw - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Height |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Payload", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWithdraw - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthWithdraw - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthWithdraw - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Payload = append(m.Payload[:0], dAtA[iNdEx:postIndex]...) - if m.Payload == nil { - m.Payload = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipWithdraw(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthWithdraw - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthWithdraw - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *GetRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWithdraw - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: GetRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GetRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWithdraw - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthWithdraw - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthWithdraw - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OwnerID", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWithdraw - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthWithdraw - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthWithdraw - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.OwnerID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 98: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWithdraw - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthWithdraw - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthWithdraw - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.RequestMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 99: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RequestVerificationHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWithdraw - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthWithdraw - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthWithdraw - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.RequestVerificationHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipWithdraw(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthWithdraw - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthWithdraw - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *GetResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWithdraw - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: GetResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GetResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Withdraw", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWithdraw - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthWithdraw - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthWithdraw - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Withdraw == nil { - m.Withdraw = &Item{} - } - if err := m.Withdraw.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipWithdraw(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthWithdraw - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthWithdraw - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *PutRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWithdraw - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: PutRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: PutRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OwnerID", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWithdraw - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthWithdraw - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthWithdraw - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.OwnerID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWithdraw - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthWithdraw - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthWithdraw - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Amount == nil { - m.Amount = &decimal.Decimal{} - } - if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType) - } - m.Height = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWithdraw - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Height |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MessageID", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWithdraw - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthWithdraw - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthWithdraw - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.MessageID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 98: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWithdraw - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthWithdraw - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthWithdraw - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.RequestMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 99: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RequestVerificationHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWithdraw - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthWithdraw - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthWithdraw - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.RequestVerificationHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipWithdraw(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthWithdraw - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthWithdraw - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *PutResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWithdraw - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: PutResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: PutResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWithdraw - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthWithdraw - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthWithdraw - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipWithdraw(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthWithdraw - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthWithdraw - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ListRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWithdraw - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ListRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ListRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OwnerID", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWithdraw - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthWithdraw - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthWithdraw - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.OwnerID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 98: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWithdraw - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthWithdraw - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthWithdraw - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.RequestMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 99: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RequestVerificationHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWithdraw - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthWithdraw - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthWithdraw - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.RequestVerificationHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipWithdraw(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthWithdraw - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthWithdraw - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ListResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWithdraw - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ListResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ListResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWithdraw - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthWithdraw - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthWithdraw - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Items = append(m.Items, &Item{}) - if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipWithdraw(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthWithdraw - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthWithdraw - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *DeleteRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWithdraw - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: DeleteRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: DeleteRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWithdraw - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthWithdraw - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthWithdraw - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OwnerID", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWithdraw - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthWithdraw - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthWithdraw - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.OwnerID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MessageID", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWithdraw - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthWithdraw - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthWithdraw - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.MessageID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 98: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWithdraw - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthWithdraw - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthWithdraw - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.RequestMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 99: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RequestVerificationHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWithdraw - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthWithdraw - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthWithdraw - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.RequestVerificationHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipWithdraw(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthWithdraw - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthWithdraw - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *DeleteResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWithdraw - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: DeleteResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: DeleteResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipWithdraw(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthWithdraw - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthWithdraw - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipWithdraw(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowWithdraw - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowWithdraw - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowWithdraw - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthWithdraw - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupWithdraw - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthWithdraw - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthWithdraw = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowWithdraw = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupWithdraw = fmt.Errorf("proto: unexpected end of group") -) diff --git a/accounting/withdraw.proto b/accounting/withdraw.proto deleted file mode 100644 index 080a100..0000000 --- a/accounting/withdraw.proto +++ /dev/null @@ -1,101 +0,0 @@ -syntax = "proto3"; -package accounting; -option go_package = "github.com/nspcc-dev/neofs-api-go/accounting"; -option csharp_namespace = "NeoFS.API.Accounting"; - -import "service/meta.proto"; -import "service/verify.proto"; -import "decimal/decimal.proto"; -import "github.com/gogo/protobuf/gogoproto/gogo.proto"; - -option (gogoproto.stable_marshaler_all) = true; - -// Withdraw is a service that provides withdraw assets operations from the NeoFS -service Withdraw { - // Get returns cheque if it was signed by inner ring nodes - rpc Get(GetRequest) returns (GetResponse); - // Put ask inner ring nodes to sign a cheque for withdraw invoke - rpc Put(PutRequest) returns (PutResponse); - // List shows all user's checks - rpc List(ListRequest) returns (ListResponse); - // Delete allows user to remove unused cheque - rpc Delete(DeleteRequest) returns (DeleteResponse); -} - -message Item { - // ID is a cheque identifier - bytes ID = 1 [(gogoproto.customtype) = "ChequeID", (gogoproto.nullable) = false]; - // OwnerID is a wallet address - bytes OwnerID = 2 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false]; - // Amount of funds - decimal.Decimal Amount = 3; - // Height is the neo blockchain height until the cheque is valid - uint64 Height = 4; - // Payload contains cheque representation in bytes - bytes Payload = 5; -} - -message GetRequest { - // ID is cheque identifier - bytes ID = 1 [(gogoproto.customtype) = "ChequeID", (gogoproto.nullable) = false]; - // OwnerID is a wallet address - bytes OwnerID = 2 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false]; - // RequestMetaHeader contains information about request meta headers (should be embedded into message) - service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; - // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) - service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; -} - -message GetResponse { - // Withdraw is cheque with meta information - Item Withdraw = 1; -} - -message PutRequest { - // OwnerID is a wallet address - bytes OwnerID = 1 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false]; - // Amount of funds - decimal.Decimal Amount = 2; - // Height is the neo blockchain height until the cheque is valid - uint64 Height = 3; - // MessageID is a nonce for uniq request (UUIDv4) - bytes MessageID = 4 [(gogoproto.customtype) = "MessageID", (gogoproto.nullable) = false]; - // RequestMetaHeader contains information about request meta headers (should be embedded into message) - service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; - // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) - service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; -} -message PutResponse { - // ID is cheque identifier - bytes ID = 1 [(gogoproto.customtype) = "ChequeID", (gogoproto.nullable) = false]; -} - -message ListRequest { - // OwnerID is a wallet address - bytes OwnerID = 1 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false]; - // RequestMetaHeader contains information about request meta headers (should be embedded into message) - service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; - // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) - service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; -} - -message ListResponse { - // Items is a set of cheques with meta information - repeated Item Items = 1; -} - -message DeleteRequest { - // ID is cheque identifier - bytes ID = 1 [(gogoproto.customtype) = "ChequeID", (gogoproto.nullable) = false]; - // OwnerID is a wallet address - bytes OwnerID = 2 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false]; - // MessageID is a nonce for uniq request (UUIDv4) - bytes MessageID = 3 [(gogoproto.customtype) = "MessageID", (gogoproto.nullable) = false]; - // RequestMetaHeader contains information about request meta headers (should be embedded into message) - service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; - // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) - service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; -} - -// DeleteResponse is empty -message DeleteResponse {} diff --git a/acl/extended/enum.go b/acl/extended/enum.go deleted file mode 100644 index e803476..0000000 --- a/acl/extended/enum.go +++ /dev/null @@ -1,126 +0,0 @@ -package eacl - -const ( - // MatchUnknown is a MatchType value used to mark value as undefined. - // Most of the tools consider MatchUnknown as incalculable. - // Using MatchUnknown in HeaderFilter is unsafe. - MatchUnknown MatchType = iota - - // StringEqual is a MatchType of string equality. - StringEqual - - // StringNotEqual is a MatchType of string inequality. - StringNotEqual -) - -const ( - // ActionUnknown is Action used to mark value as undefined. - // Most of the tools consider ActionUnknown as incalculable. - // Using ActionUnknown in Record is unsafe. - ActionUnknown Action = iota - - // ActionAllow is Action used to mark an applicability of ACL rule. - ActionAllow - - // ActionDeny is Action used to mark an inapplicability of ACL rule. - ActionDeny -) - -const ( - // GroupUnknown is a Group value used to mark value as undefined. - // Most of the tools consider GroupUnknown as incalculable. - // Using GroupUnknown in Target is unsafe. - GroupUnknown Group = iota - - // GroupUser is a Group value for User access group. - GroupUser - - // GroupSystem is a Group value for System access group. - GroupSystem - - // GroupOthers is a Group value for Others access group. - GroupOthers -) - -const ( - // HdrTypeUnknown is a HeaderType value used to mark value as undefined. - // Most of the tools consider HdrTypeUnknown as incalculable. - // Using HdrTypeUnknown in HeaderFilter is unsafe. - HdrTypeUnknown HeaderType = iota - - // HdrTypeRequest is a HeaderType for request header. - HdrTypeRequest - - // HdrTypeObjSys is a HeaderType for system headers of object. - HdrTypeObjSys - - // HdrTypeObjUsr is a HeaderType for user headers of object. - HdrTypeObjUsr -) - -const ( - // OpTypeUnknown is a OperationType value used to mark value as undefined. - // Most of the tools consider OpTypeUnknown as incalculable. - // Using OpTypeUnknown in Record is unsafe. - OpTypeUnknown OperationType = iota - - // OpTypeGet is an OperationType for object.Get RPC - OpTypeGet - - // OpTypePut is an OperationType for object.Put RPC - OpTypePut - - // OpTypeHead is an OperationType for object.Head RPC - OpTypeHead - - // OpTypeSearch is an OperationType for object.Search RPC - OpTypeSearch - - // OpTypeDelete is an OperationType for object.Delete RPC - OpTypeDelete - - // OpTypeRange is an OperationType for object.GetRange RPC - OpTypeRange - - // OpTypeRangeHash is an OperationType for object.GetRangeHash RPC - OpTypeRangeHash -) - -const ( - // HdrObjSysNameID is a name of ID field in system header of object. - HdrObjSysNameID = "ID" - - // HdrObjSysNameCID is a name of CID field in system header of object. - HdrObjSysNameCID = "CID" - - // HdrObjSysNameOwnerID is a name of OwnerID field in system header of object. - HdrObjSysNameOwnerID = "OWNER_ID" - - // HdrObjSysNameVersion is a name of Version field in system header of object. - HdrObjSysNameVersion = "VERSION" - - // HdrObjSysNamePayloadLength is a name of PayloadLength field in system header of object. - HdrObjSysNamePayloadLength = "PAYLOAD_LENGTH" - - // HdrObjSysNameCreatedUnix is a name of CreatedAt.UnitTime field in system header of object. - HdrObjSysNameCreatedUnix = "CREATED_UNIX" - - // HdrObjSysNameCreatedEpoch is a name of CreatedAt.Epoch field in system header of object. - HdrObjSysNameCreatedEpoch = "CREATED_EPOCH" - - // HdrObjSysLinkPrev is a name of previous link header in extended headers of object. - HdrObjSysLinkPrev = "LINK_PREV" - - // HdrObjSysLinkNext is a name of next link header in extended headers of object. - HdrObjSysLinkNext = "LINK_NEXT" - - // HdrObjSysLinkChild is a name of child link header in extended headers of object. - HdrObjSysLinkChild = "LINK_CHILD" - - // HdrObjSysLinkPar is a name of parent link header in extended headers of object. - HdrObjSysLinkPar = "LINK_PAR" - - // HdrObjSysLinkSG is a name of storage group link header in extended headers of object. - HdrObjSysLinkSG = "LINK_SG" -) - diff --git a/acl/extended/marshal.go b/acl/extended/marshal.go deleted file mode 100644 index d1fac07..0000000 --- a/acl/extended/marshal.go +++ /dev/null @@ -1,333 +0,0 @@ -package eacl - -import ( - "encoding/binary" - - "github.com/pkg/errors" -) - -const ( - sliceLenSize = 2 // uint16 for len() - actionSize = 4 // uint32 - opTypeSize = 4 // uint32 - hdrTypeSize = 4 // uint32 - matchTypeSize = 4 // uint32 - targetSize = 4 // uint32 -) - -// MarshalTable encodes Table into a -// binary form and returns the result. -// -// If table is nil, empty slice is returned. -func MarshalTable(table Table) []byte { - if table == nil { - return make([]byte, 0) - } - - // allocate buffer - buf := make([]byte, tableBinSize(table)) - - records := table.Records() - - // write record number - binary.BigEndian.PutUint16(buf, uint16(len(records))) - off := sliceLenSize - - // write all records - for _, record := range records { - // write action - binary.BigEndian.PutUint32(buf[off:], uint32(record.Action())) - off += actionSize - - // write operation type - binary.BigEndian.PutUint32(buf[off:], uint32(record.OperationType())) - off += actionSize - - filters := record.HeaderFilters() - - // write filter number - binary.BigEndian.PutUint16(buf[off:], uint16(len(filters))) - off += sliceLenSize - - // write all filters - for _, filter := range filters { - // write header type - binary.BigEndian.PutUint32(buf[off:], uint32(filter.HeaderType())) - off += hdrTypeSize - - // write match type - binary.BigEndian.PutUint32(buf[off:], uint32(filter.MatchType())) - off += matchTypeSize - - // write header name size - name := []byte(filter.Name()) - binary.BigEndian.PutUint16(buf[off:], uint16(len(name))) - off += sliceLenSize - - // write header name bytes - off += copy(buf[off:], name) - - // write header value size - val := []byte(filter.Value()) - binary.BigEndian.PutUint16(buf[off:], uint16(len(val))) - off += sliceLenSize - - // write header value bytes - off += copy(buf[off:], val) - } - - targets := record.TargetList() - - // write target number - binary.BigEndian.PutUint16(buf[off:], uint16(len(targets))) - off += sliceLenSize - - // write all targets - for _, target := range targets { - // write target group - binary.BigEndian.PutUint32(buf[off:], uint32(target.Group())) - off += targetSize - - keys := target.KeyList() - - // write key number - binary.BigEndian.PutUint16(buf[off:], uint16(len(keys))) - off += sliceLenSize - - // write keys - for i := range keys { - // write key size - binary.BigEndian.PutUint16(buf[off:], uint16(len(keys[i]))) - off += sliceLenSize - - // write key bytes - off += copy(buf[off:], keys[i]) - } - } - } - - return buf -} - -// returns the size of Table in a binary format. -func tableBinSize(table Table) (sz int) { - sz = sliceLenSize // number of records - - records := table.Records() - ln := len(records) - - sz += ln * actionSize // action type of each record - sz += ln * opTypeSize // operation type of each record - - for _, record := range records { - sz += sliceLenSize // number of filters - - filters := record.HeaderFilters() - ln := len(filters) - - sz += ln * hdrTypeSize // header type of each filter - sz += ln * matchTypeSize // match type of each filter - - for _, filter := range filters { - sz += sliceLenSize // header name size - sz += len(filter.Name()) // header name bytes - - sz += sliceLenSize // header value size - sz += len(filter.Value()) // header value bytes - } - - sz += sliceLenSize // number of targets - - targets := record.TargetList() - ln = len(targets) - - sz += ln * targetSize // target group of each target - - for _, target := range targets { - sz += sliceLenSize // number of keys - - for _, key := range target.KeyList() { - sz += sliceLenSize // key size - sz += len(key) // key bytes - } - } - } - - return -} - -// UnmarshalTable unmarshals Table from -// a binary representation. -// -// If data is empty, table w/o records is returned. -func UnmarshalTable(data []byte) (Table, error) { - table := WrapTable(nil) - - if len(data) == 0 { - return table, nil - } - - // decode record number - if len(data) < sliceLenSize { - return nil, errors.New("could not decode record number") - } - - recordNum := binary.BigEndian.Uint16(data) - records := make([]Record, 0, recordNum) - - off := sliceLenSize - - // decode all records one by one - for i := uint16(0); i < recordNum; i++ { - record := WrapRecord(nil) - - // decode action - if len(data[off:]) < actionSize { - return nil, errors.Errorf("could not decode action of record #%d", i) - } - - record.SetAction(Action(binary.BigEndian.Uint32(data[off:]))) - off += actionSize - - // decode operation type - if len(data[off:]) < opTypeSize { - return nil, errors.Errorf("could not decode operation type of record #%d", i) - } - - record.SetOperationType(OperationType(binary.BigEndian.Uint32(data[off:]))) - off += opTypeSize - - // decode filter number - if len(data[off:]) < sliceLenSize { - return nil, errors.Errorf("could not decode filter number of record #%d", i) - } - - filterNum := binary.BigEndian.Uint16(data[off:]) - off += sliceLenSize - filters := make([]HeaderFilter, 0, filterNum) - - // decode filters one by one - for j := uint16(0); j < filterNum; j++ { - filter := WrapFilterInfo(nil) - - // decode header type - if len(data[off:]) < hdrTypeSize { - return nil, errors.Errorf("could not decode header type of filter #%d of record #%d", j, i) - } - - filter.SetHeaderType(HeaderType(binary.BigEndian.Uint32(data[off:])) ) - off += hdrTypeSize - - // decode match type - if len(data[off:]) < matchTypeSize { - return nil, errors.Errorf("could not decode match type of filter #%d of record #%d", j, i) - } - - filter.SetMatchType(MatchType(binary.BigEndian.Uint32(data[off:])) ) - off += matchTypeSize - - // decode header name size - if len(data[off:]) < sliceLenSize { - return nil, errors.Errorf("could not decode header name size of filter #%d of record #%d", j, i) - } - - hdrNameSize := int(binary.BigEndian.Uint16(data[off:])) - off += sliceLenSize - - // decode header name - if len(data[off:]) < hdrNameSize { - return nil, errors.Errorf("could not decode header name of filter #%d of record #%d", j, i) - } - - filter.SetName(string(data[off : off+hdrNameSize])) - - off += hdrNameSize - - // decode header value size - if len(data[off:]) < sliceLenSize { - return nil, errors.Errorf("could not decode header value size of filter #%d of record #%d", j, i) - } - - hdrValSize := int(binary.BigEndian.Uint16(data[off:])) - off += sliceLenSize - - // decode header value - if len(data[off:]) < hdrValSize { - return nil, errors.Errorf("could not decode header value of filter #%d of record #%d", j, i) - } - - filter.SetValue(string(data[off : off+hdrValSize])) - - off += hdrValSize - - filters = append(filters, filter) - } - - record.SetHeaderFilters(filters) - - // decode target number - if len(data[off:]) < sliceLenSize { - return nil, errors.Errorf("could not decode target number of record #%d", i) - } - - targetNum := int(binary.BigEndian.Uint16(data[off:])) - off += sliceLenSize - - targets := make([]Target, 0, targetNum) - - // decode targets one by one - for j := 0; j < targetNum; j++ { - target := WrapTarget(nil) - - // decode target group - if len(data[off:]) < targetSize { - return nil, errors.Errorf("could not decode target group of target #%d of record #%d", j, i) - } - - target.SetGroup( Group(binary.BigEndian.Uint32(data[off:])), ) - off += targetSize - - // decode key number - if len(data[off:]) < sliceLenSize { - return nil, errors.Errorf("could not decode key number of target #%d of record #%d", j, i) - } - - keyNum := int(binary.BigEndian.Uint16(data[off:])) - off += sliceLenSize - keys := make([][]byte, 0, keyNum) - - for k := 0; k < keyNum; k++ { - // decode key size - if len(data[off:]) < sliceLenSize { - return nil, errors.Errorf("could not decode size of key #%d target #%d of record #%d", k, j, i) - } - - keySz := int(binary.BigEndian.Uint16(data[off:])) - off += sliceLenSize - - // decode key - if len(data[off:]) < keySz { - return nil, errors.Errorf("could not decode key #%d target #%d of record #%d", k, j, i) - } - - key := make([]byte, keySz) - - off += copy(key, data[off:off+keySz]) - - keys = append(keys, key) - } - - target.SetKeyList(keys) - - targets = append(targets, target) - } - - record.SetTargetList(targets) - - records = append(records, record) - } - - table.SetRecords(records) - - return table, nil -} diff --git a/acl/extended/types.go b/acl/extended/types.go deleted file mode 100644 index 6b1b74b..0000000 --- a/acl/extended/types.go +++ /dev/null @@ -1,73 +0,0 @@ -package eacl - -// OperationType is an enumeration of operation types for extended ACL. -type OperationType uint32 - -// HeaderType is an enumeration of header types for extended ACL. -type HeaderType uint32 - -// MatchType is an enumeration of match types for extended ACL. -type MatchType uint32 - -// Action is an enumeration of extended ACL actions. -type Action uint32 - -// Group is an enumeration of access groups. -type Group uint32 - -// Header is an interface of string key-value pair, -type Header interface { - // Must return string identifier of header. - Name() string - - // Must return string value of header. - Value() string -} - -// TypedHeader is an interface of Header and HeaderType pair. -type TypedHeader interface { - Header - - // Must return type of filtered header. - HeaderType() HeaderType -} - -// HeaderFilter is an interface of grouped information about filtered header. -type HeaderFilter interface { - // Must return match type of filter. - MatchType() MatchType - - TypedHeader -} - -// Target is an interface of grouped information about extended ACL rule target. -type Target interface { - // Must return ACL target type. - Group() Group - - // Must return public key list of ACL targets. - KeyList() [][]byte -} - -// Record is an interface of record of extended ACL rule table. -type Record interface { - // Must return operation type of extended ACL rule. - OperationType() OperationType - - // Must return list of header filters of extended ACL rule. - HeaderFilters() []HeaderFilter - - // Must return target list of extended ACL rule. - TargetList() []Target - - // Must return action of extended ACL rule. - Action() Action -} - -// Table is an interface of extended ACL table. -type Table interface { - // Must return list of extended ACL rules. - Records() []Record -} - - diff --git a/acl/extended/wrappers.go b/acl/extended/wrappers.go deleted file mode 100644 index 2c8ff2e..0000000 --- a/acl/extended/wrappers.go +++ /dev/null @@ -1,528 +0,0 @@ -package eacl - -import ( - "github.com/nspcc-dev/neofs-api-go/acl" -) - -// FilterWrapper is a wrapper over acl.EACLRecord_FilterInfo pointer. -type FilterWrapper struct { - filter *acl.EACLRecord_FilterInfo -} - -// TargetWrapper is a wrapper over acl.EACLRecord_TargetInfo pointer. -type TargetWrapper struct { - target *acl.EACLRecord_TargetInfo -} - -// RecordWrapper is a wrapper over acl.EACLRecord pointer. -type RecordWrapper struct { - record *acl.EACLRecord -} - -// TableWrapper is a wrapper over acl.EACLTable pointer. -type TableWrapper struct { - table *acl.EACLTable -} - -// WrapFilterInfo wraps EACLRecord_FilterInfo pointer. -// -// If argument is nil, new EACLRecord_FilterInfo is initialized. -func WrapFilterInfo(v *acl.EACLRecord_FilterInfo) FilterWrapper { - if v == nil { - v = new(acl.EACLRecord_FilterInfo) - } - - return FilterWrapper{ - filter: v, - } -} - -// WrapTarget wraps EACLRecord_TargetInfo pointer. -// -// If argument is nil, new EACLRecord_TargetInfo is initialized. -func WrapTarget(v *acl.EACLRecord_TargetInfo) TargetWrapper { - if v == nil { - v = new(acl.EACLRecord_TargetInfo) - } - - return TargetWrapper{ - target: v, - } -} - -// WrapRecord wraps EACLRecord pointer. -// -// If argument is nil, new EACLRecord is initialized. -func WrapRecord(v *acl.EACLRecord) RecordWrapper { - if v == nil { - v = new(acl.EACLRecord) - } - - return RecordWrapper{ - record: v, - } -} - -// WrapTable wraps EACLTable pointer. -// -// If argument is nil, new EACLTable is initialized. -func WrapTable(v *acl.EACLTable) TableWrapper { - if v == nil { - v = new(acl.EACLTable) - } - - return TableWrapper{ - table: v, - } -} - -// MatchType returns the match type of the filter. -// -// If filter is not initialized, 0 returns. -// -// Returns 0 if MatchType is not one of: -// - EACLRecord_FilterInfo_StringEqual; -// - EACLRecord_FilterInfo_StringNotEqual. -func (s FilterWrapper) MatchType() (res MatchType) { - if s.filter != nil { - switch s.filter.GetMatchType() { - case acl.EACLRecord_FilterInfo_StringEqual: - res = StringEqual - case acl.EACLRecord_FilterInfo_StringNotEqual: - res = StringNotEqual - } - } - - return -} - -// SetMatchType sets the match type of the filter. -// -// If filter is not initialized, nothing changes. -// -// MatchType is set to EACLRecord_FilterInfo_MatchUnknown if argument is not one of: -// - StringEqual; -// - StringNotEqual. -func (s FilterWrapper) SetMatchType(v MatchType) { - if s.filter != nil { - switch v { - case StringEqual: - s.filter.SetMatchType(acl.EACLRecord_FilterInfo_StringEqual) - case StringNotEqual: - s.filter.SetMatchType(acl.EACLRecord_FilterInfo_StringNotEqual) - default: - s.filter.SetMatchType(acl.EACLRecord_FilterInfo_MatchUnknown) - } - } -} - -// Name returns the name of filtering header. -// -// If filter is not initialized, empty string returns. -func (s FilterWrapper) Name() string { - if s.filter == nil { - return "" - } - - return s.filter.GetHeaderName() -} - -// SetName sets the name of the filtering header. -// -// If filter is not initialized, nothing changes. -func (s FilterWrapper) SetName(v string) { - if s.filter != nil { - s.filter.SetHeaderName(v) - } -} - -// Value returns the value of filtering header. -// -// If filter is not initialized, empty string returns. -func (s FilterWrapper) Value() string { - if s.filter == nil { - return "" - } - - return s.filter.GetHeaderVal() -} - -// SetValue sets the value of filtering header. -// -// If filter is not initialized, nothing changes. -func (s FilterWrapper) SetValue(v string) { - if s.filter != nil { - s.filter.SetHeaderVal(v) - } -} - -// HeaderType returns the header type of the filter. -// -// If filter is not initialized, HdrTypeUnknown returns. -// -// Returns HdrTypeUnknown if Header is not one of: -// - EACLRecord_FilterInfo_Request; -// - EACLRecord_FilterInfo_ObjectSystem; -// - EACLRecord_FilterInfo_ObjectUser. -func (s FilterWrapper) HeaderType() (res HeaderType) { - res = HdrTypeUnknown - - if s.filter != nil { - switch s.filter.GetHeader() { - case acl.EACLRecord_FilterInfo_Request: - res = HdrTypeRequest - case acl.EACLRecord_FilterInfo_ObjectSystem: - res = HdrTypeObjSys - case acl.EACLRecord_FilterInfo_ObjectUser: - res = HdrTypeObjUsr - } - } - - return -} - -// SetHeaderType sets the header type of the filter. -// -// If filter is not initialized, nothing changes. -// -// Header is set to EACLRecord_FilterInfo_HeaderUnknown if argument is not one of: -// - HdrTypeRequest; -// - HdrTypeObjSys; -// - HdrTypeObjUsr. -func (s FilterWrapper) SetHeaderType(t HeaderType) { - if s.filter != nil { - switch t { - case HdrTypeRequest: - s.filter.SetHeader(acl.EACLRecord_FilterInfo_Request) - case HdrTypeObjSys: - s.filter.SetHeader(acl.EACLRecord_FilterInfo_ObjectSystem) - case HdrTypeObjUsr: - s.filter.SetHeader(acl.EACLRecord_FilterInfo_ObjectUser) - default: - s.filter.SetHeader(acl.EACLRecord_FilterInfo_HeaderUnknown) - } - } -} - -// Group returns the access group of the target. -// -// If target is not initialized, GroupUnknown returns. -// -// Returns GroupUnknown if Target is not one of: -// - Target_User; -// - GroupSystem; -// - GroupOthers. -func (s TargetWrapper) Group() (res Group) { - res = GroupUnknown - - if s.target != nil { - switch s.target.GetTarget() { - case acl.Target_User: - res = GroupUser - case acl.Target_System: - res = GroupSystem - case acl.Target_Others: - res = GroupOthers - } - } - - return -} - -// SetGroup sets the access group of the target. -// -// If target is not initialized, nothing changes. -// -// Target is set to Target_Unknown if argument is not one of: -// - GroupUser; -// - GroupSystem; -// - GroupOthers. -func (s TargetWrapper) SetGroup(g Group) { - if s.target != nil { - switch g { - case GroupUser: - s.target.SetTarget(acl.Target_User) - case GroupSystem: - s.target.SetTarget(acl.Target_System) - case GroupOthers: - s.target.SetTarget(acl.Target_Others) - default: - s.target.SetTarget(acl.Target_Unknown) - } - } -} - -// KeyList returns the key list of the target. -// -// If target is not initialized, nil returns. -func (s TargetWrapper) KeyList() [][]byte { - if s.target == nil { - return nil - } - - return s.target.GetKeyList() -} - -// SetKeyList sets the key list of the target. -// -// If target is not initialized, nothing changes. -func (s TargetWrapper) SetKeyList(v [][]byte) { - if s.target != nil { - s.target.SetKeyList(v) - } -} - -// OperationType returns the operation type of the record. -// -// If record is not initialized, OpTypeUnknown returns. -// -// Returns OpTypeUnknown if Operation is not one of: -// - EACLRecord_HEAD; -// - EACLRecord_PUT; -// - EACLRecord_SEARCH; -// - EACLRecord_GET; -// - EACLRecord_GETRANGE; -// - EACLRecord_GETRANGEHASH; -// - EACLRecord_DELETE. -func (s RecordWrapper) OperationType() (res OperationType) { - res = OpTypeUnknown - - if s.record != nil { - switch s.record.GetOperation() { - case acl.EACLRecord_HEAD: - res = OpTypeHead - case acl.EACLRecord_PUT: - res = OpTypePut - case acl.EACLRecord_SEARCH: - res = OpTypeSearch - case acl.EACLRecord_GET: - res = OpTypeGet - case acl.EACLRecord_GETRANGE: - res = OpTypeRange - case acl.EACLRecord_GETRANGEHASH: - res = OpTypeRangeHash - case acl.EACLRecord_DELETE: - res = OpTypeDelete - } - } - - return -} - -// SetOperationType sets the operation type of the record. -// -// If record is not initialized, nothing changes. -// -// Operation is set to EACLRecord_OPERATION_UNKNOWN if argument is not one of: -// - OpTypeHead; -// - OpTypePut; -// - OpTypeSearch; -// - OpTypeGet; -// - OpTypeRange; -// - OpTypeRangeHash; -// - OpTypeDelete. -func (s RecordWrapper) SetOperationType(v OperationType) { - if s.record != nil { - switch v { - case OpTypeHead: - s.record.SetOperation(acl.EACLRecord_HEAD) - case OpTypePut: - s.record.SetOperation(acl.EACLRecord_PUT) - case OpTypeSearch: - s.record.SetOperation(acl.EACLRecord_SEARCH) - case OpTypeGet: - s.record.SetOperation(acl.EACLRecord_GET) - case OpTypeRange: - s.record.SetOperation(acl.EACLRecord_GETRANGE) - case OpTypeRangeHash: - s.record.SetOperation(acl.EACLRecord_GETRANGEHASH) - case OpTypeDelete: - s.record.SetOperation(acl.EACLRecord_DELETE) - default: - s.record.SetOperation(acl.EACLRecord_OPERATION_UNKNOWN) - } - } -} - -// Action returns the action of the record. -// -// If record is not initialized, ActionUnknown returns. -// -// Returns ActionUnknown if Action is not one of: -// - EACLRecord_Deny; -// - EACLRecord_Allow. -func (s RecordWrapper) Action() (res Action) { - res = ActionUnknown - - if s.record != nil { - switch s.record.GetAction() { - case acl.EACLRecord_Deny: - res = ActionDeny - case acl.EACLRecord_Allow: - res = ActionAllow - } - } - - return -} - -// SetAction sets the action of the record. -// -// If record is not initialized, nothing changes. -// -// Action is set to EACLRecord_ActionUnknown if argument is not one of: -// - ActionDeny; -// - ActionAllow. -func (s RecordWrapper) SetAction(v Action) { - if s.record != nil { - switch v { - case ActionDeny: - s.record.SetAction(acl.EACLRecord_Deny) - case ActionAllow: - s.record.SetAction(acl.EACLRecord_Allow) - default: - s.record.SetAction(acl.EACLRecord_ActionUnknown) - } - } -} - -// HeaderFilters returns the header filter list of the record. -// -// If record is not initialized, nil returns. -func (s RecordWrapper) HeaderFilters() []HeaderFilter { - if s.record == nil { - return nil - } - - filters := s.record.GetFilters() - - res := make([]HeaderFilter, 0, len(filters)) - - for i := range filters { - res = append(res, WrapFilterInfo(filters[i])) - } - - return res -} - -// SetHeaderFilters sets the header filter list of the record. -// -// Ignores nil elements of argument. -// If record is not initialized, nothing changes. -func (s RecordWrapper) SetHeaderFilters(v []HeaderFilter) { - if s.record == nil { - return - } - - filters := make([]*acl.EACLRecord_FilterInfo, 0, len(v)) - - for i := range v { - if v[i] == nil { - continue - } - - w := WrapFilterInfo(nil) - w.SetMatchType(v[i].MatchType()) - w.SetHeaderType(v[i].HeaderType()) - w.SetName(v[i].Name()) - w.SetValue(v[i].Value()) - - filters = append(filters, w.filter) - } - - s.record.SetFilters(filters) -} - -// TargetList returns the target list of the record. -// -// If record is not initialized, nil returns. -func (s RecordWrapper) TargetList() []Target { - if s.record == nil { - return nil - } - - targets := s.record.GetTargets() - - res := make([]Target, 0, len(targets)) - - for i := range targets { - res = append(res, WrapTarget(targets[i])) - } - - return res -} - -// SetTargetList sets the target list of the record. -// -// Ignores nil elements of argument. -// If record is not initialized, nothing changes. -func (s RecordWrapper) SetTargetList(v []Target) { - if s.record == nil { - return - } - - targets := make([]*acl.EACLRecord_TargetInfo, 0, len(v)) - - for i := range v { - if v[i] == nil { - continue - } - - w := WrapTarget(nil) - w.SetGroup(v[i].Group()) - w.SetKeyList(v[i].KeyList()) - - targets = append(targets, w.target) - } - - s.record.SetTargets(targets) -} - -// Records returns the record list of the table. -// -// If table is not initialized, nil returns. -func (s TableWrapper) Records() []Record { - if s.table == nil { - return nil - } - - records := s.table.GetRecords() - - res := make([]Record, 0, len(records)) - - for i := range records { - res = append(res, WrapRecord(records[i])) - } - - return res -} - -// SetRecords sets the record list of the table. -// -// Ignores nil elements of argument. -// If table is not initialized, nothing changes. -func (s TableWrapper) SetRecords(v []Record) { - if s.table == nil { - return - } - - records := make([]*acl.EACLRecord, 0, len(v)) - - for i := range v { - if v[i] == nil { - continue - } - - w := WrapRecord(nil) - w.SetOperationType(v[i].OperationType()) - w.SetAction(v[i].Action()) - w.SetHeaderFilters(v[i].HeaderFilters()) - w.SetTargetList(v[i].TargetList()) - - records = append(records, w.record) - } - - s.table.SetRecords(records) -} - - diff --git a/acl/extended/wrappers_test.go b/acl/extended/wrappers_test.go deleted file mode 100644 index b139e59..0000000 --- a/acl/extended/wrappers_test.go +++ /dev/null @@ -1,136 +0,0 @@ -package eacl - -import ( - "testing" - - "github.com/stretchr/testify/require" -) - -func TestEACLFilterWrapper(t *testing.T) { - s := WrapFilterInfo(nil) - - mt := StringEqual - s.SetMatchType(mt) - require.Equal(t, mt, s.MatchType()) - - ht := HdrTypeObjUsr - s.SetHeaderType(ht) - require.Equal(t, ht, s.HeaderType()) - - n := "name" - s.SetName(n) - require.Equal(t, n, s.Name()) - - v := "value" - s.SetValue(v) - require.Equal(t, v, s.Value()) -} - -func TestEACLTargetWrapper(t *testing.T) { - s := WrapTarget(nil) - - group := Group(3) - s.SetGroup(group) - require.Equal(t, group, s.Group()) - - keys := [][]byte{ - {1, 2, 3}, - {4, 5, 6}, - } - s.SetKeyList(keys) - require.Equal(t, keys, s.KeyList()) -} - -func TestEACLRecordWrapper(t *testing.T) { - s := WrapRecord(nil) - - action := ActionAllow - s.SetAction(action) - require.Equal(t, action, s.Action()) - - opType := OperationType(5) - s.SetOperationType(opType) - require.Equal(t, opType, s.OperationType()) - - f1Name := "name1" - f1 := WrapFilterInfo(nil) - f1.SetName(f1Name) - - f2Name := "name2" - f2 := WrapFilterInfo(nil) - f2.SetName(f2Name) - - s.SetHeaderFilters([]HeaderFilter{f1, f2}) - - filters := s.HeaderFilters() - require.Len(t, filters, 2) - require.Equal(t, f1Name, filters[0].Name()) - require.Equal(t, f2Name, filters[1].Name()) - - group1 := Group(1) - t1 := WrapTarget(nil) - t1.SetGroup(group1) - - group2 := Group(2) - t2 := WrapTarget(nil) - t2.SetGroup(group2) - - s.SetTargetList([]Target{t1, t2}) - - targets := s.TargetList() - require.Len(t, targets, 2) - require.Equal(t, group1, targets[0].Group()) - require.Equal(t, group2, targets[1].Group()) -} - -func TestEACLTableWrapper(t *testing.T) { - s := WrapTable(nil) - - action1 := Action(1) - r1 := WrapRecord(nil) - r1.SetAction(action1) - - action2 := Action(2) - r2 := WrapRecord(nil) - r2.SetAction(action2) - - s.SetRecords([]Record{r1, r2}) - - records := s.Records() - require.Len(t, records, 2) - require.Equal(t, action1, records[0].Action()) - require.Equal(t, action2, records[1].Action()) - - s2, err := UnmarshalTable(MarshalTable(s)) - require.NoError(t, err) - - records1 := s.Records() - records2 := s2.Records() - require.Len(t, records1, len(records2)) - - for i := range records1 { - require.Equal(t, records1[i].Action(), records2[i].Action()) - require.Equal(t, records1[i].OperationType(), records2[i].OperationType()) - - targets1 := records1[i].TargetList() - targets2 := records2[i].TargetList() - require.Len(t, targets1, len(targets2)) - - for j := range targets1 { - require.Equal(t, targets1[j].Group(), targets2[j].Group()) - require.Equal(t, targets1[j].KeyList(), targets2[j].KeyList()) - } - - filters1 := records1[i].HeaderFilters() - filters2 := records2[i].HeaderFilters() - require.Len(t, filters1, len(filters2)) - - for j := range filters1 { - require.Equal(t, filters1[j].MatchType(), filters2[j].MatchType()) - require.Equal(t, filters1[j].HeaderType(), filters2[j].HeaderType()) - require.Equal(t, filters1[j].Name(), filters2[j].Name()) - require.Equal(t, filters1[j].Value(), filters2[j].Value()) - require.Equal(t, filters1[j].Value(), filters2[j].Value()) - } - } -} diff --git a/acl/types.go b/acl/types.go deleted file mode 100644 index 4aaf8fb..0000000 --- a/acl/types.go +++ /dev/null @@ -1,57 +0,0 @@ -package acl - - -// SetMatchType is MatchType field setter. -func (m *EACLRecord_FilterInfo) SetMatchType(v EACLRecord_FilterInfo_MatchType) { - m.MatchType = v -} - -// SetHeader is a Header field setter. -func (m *EACLRecord_FilterInfo) SetHeader(v EACLRecord_FilterInfo_Header) { - m.Header = v -} - -// SetHeaderName is a HeaderName field setter. -func (m *EACLRecord_FilterInfo) SetHeaderName(v string) { - m.HeaderName = v -} - -// SetHeaderVal is a HeaderVal field setter. -func (m *EACLRecord_FilterInfo) SetHeaderVal(v string) { - m.HeaderVal = v -} - -// SetTarget is a Target field setter. -func (m *EACLRecord_TargetInfo) SetTarget(v Target) { - m.Target = v -} - -// SetKeyList is a KeyList field setter. -func (m *EACLRecord_TargetInfo) SetKeyList(v [][]byte) { - m.KeyList = v -} - -// SetOperation is an Operation field setter. -func (m *EACLRecord) SetOperation(v EACLRecord_Operation) { - m.Operation = v -} - -// SetAction is an Action field setter. -func (m *EACLRecord) SetAction(v EACLRecord_Action) { - m.Action = v -} - -// SetFilters is a Filters field setter. -func (m *EACLRecord) SetFilters(v []*EACLRecord_FilterInfo) { - m.Filters = v -} - -// SetTargets is a Targets field setter. -func (m *EACLRecord) SetTargets(v []*EACLRecord_TargetInfo) { - m.Targets = v -} - -// SetRecords is a Records field setter. -func (m *EACLTable) SetRecords(v []*EACLRecord) { - m.Records = v -} diff --git a/acl/types.pb.go b/acl/types.pb.go deleted file mode 100644 index 24ecf28..0000000 --- a/acl/types.pb.go +++ /dev/null @@ -1,1408 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: acl/types.proto - -package acl - -import ( - fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/golang/protobuf/proto" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package - -// Target of the access control rule in access control list. -type Target int32 - -const ( - // Unknown target, default value. - Target_Unknown Target = 0 - // User target rule is applied if sender is the owner of the container. - Target_User Target = 1 - // System target rule is applied if sender is the storage node within the - // container or inner ring node. - Target_System Target = 2 - // Others target rule is applied if sender is not user or system target. - Target_Others Target = 3 - // PubKey target rule is applied if sender has public key provided in - // extended ACL. - Target_PubKey Target = 4 -) - -var Target_name = map[int32]string{ - 0: "Unknown", - 1: "User", - 2: "System", - 3: "Others", - 4: "PubKey", -} - -var Target_value = map[string]int32{ - "Unknown": 0, - "User": 1, - "System": 2, - "Others": 3, - "PubKey": 4, -} - -func (x Target) String() string { - return proto.EnumName(Target_name, int32(x)) -} - -func (Target) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_9b63aff5f3a35e32, []int{0} -} - -// Operation is an enumeration of operation types. -type EACLRecord_Operation int32 - -const ( - EACLRecord_OPERATION_UNKNOWN EACLRecord_Operation = 0 - EACLRecord_GET EACLRecord_Operation = 1 - EACLRecord_HEAD EACLRecord_Operation = 2 - EACLRecord_PUT EACLRecord_Operation = 3 - EACLRecord_DELETE EACLRecord_Operation = 4 - EACLRecord_SEARCH EACLRecord_Operation = 5 - EACLRecord_GETRANGE EACLRecord_Operation = 6 - EACLRecord_GETRANGEHASH EACLRecord_Operation = 7 -) - -var EACLRecord_Operation_name = map[int32]string{ - 0: "OPERATION_UNKNOWN", - 1: "GET", - 2: "HEAD", - 3: "PUT", - 4: "DELETE", - 5: "SEARCH", - 6: "GETRANGE", - 7: "GETRANGEHASH", -} - -var EACLRecord_Operation_value = map[string]int32{ - "OPERATION_UNKNOWN": 0, - "GET": 1, - "HEAD": 2, - "PUT": 3, - "DELETE": 4, - "SEARCH": 5, - "GETRANGE": 6, - "GETRANGEHASH": 7, -} - -func (x EACLRecord_Operation) String() string { - return proto.EnumName(EACLRecord_Operation_name, int32(x)) -} - -func (EACLRecord_Operation) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_9b63aff5f3a35e32, []int{0, 0} -} - -// Action is an enumeration of EACL actions. -type EACLRecord_Action int32 - -const ( - EACLRecord_ActionUnknown EACLRecord_Action = 0 - EACLRecord_Allow EACLRecord_Action = 1 - EACLRecord_Deny EACLRecord_Action = 2 -) - -var EACLRecord_Action_name = map[int32]string{ - 0: "ActionUnknown", - 1: "Allow", - 2: "Deny", -} - -var EACLRecord_Action_value = map[string]int32{ - "ActionUnknown": 0, - "Allow": 1, - "Deny": 2, -} - -func (x EACLRecord_Action) String() string { - return proto.EnumName(EACLRecord_Action_name, int32(x)) -} - -func (EACLRecord_Action) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_9b63aff5f3a35e32, []int{0, 1} -} - -// Header is an enumeration of filtering header types. -type EACLRecord_FilterInfo_Header int32 - -const ( - EACLRecord_FilterInfo_HeaderUnknown EACLRecord_FilterInfo_Header = 0 - EACLRecord_FilterInfo_Request EACLRecord_FilterInfo_Header = 1 - EACLRecord_FilterInfo_ObjectSystem EACLRecord_FilterInfo_Header = 2 - EACLRecord_FilterInfo_ObjectUser EACLRecord_FilterInfo_Header = 3 -) - -var EACLRecord_FilterInfo_Header_name = map[int32]string{ - 0: "HeaderUnknown", - 1: "Request", - 2: "ObjectSystem", - 3: "ObjectUser", -} - -var EACLRecord_FilterInfo_Header_value = map[string]int32{ - "HeaderUnknown": 0, - "Request": 1, - "ObjectSystem": 2, - "ObjectUser": 3, -} - -func (x EACLRecord_FilterInfo_Header) String() string { - return proto.EnumName(EACLRecord_FilterInfo_Header_name, int32(x)) -} - -func (EACLRecord_FilterInfo_Header) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_9b63aff5f3a35e32, []int{0, 0, 0} -} - -// MatchType is an enumeration of match types. -type EACLRecord_FilterInfo_MatchType int32 - -const ( - EACLRecord_FilterInfo_MatchUnknown EACLRecord_FilterInfo_MatchType = 0 - EACLRecord_FilterInfo_StringEqual EACLRecord_FilterInfo_MatchType = 1 - EACLRecord_FilterInfo_StringNotEqual EACLRecord_FilterInfo_MatchType = 2 -) - -var EACLRecord_FilterInfo_MatchType_name = map[int32]string{ - 0: "MatchUnknown", - 1: "StringEqual", - 2: "StringNotEqual", -} - -var EACLRecord_FilterInfo_MatchType_value = map[string]int32{ - "MatchUnknown": 0, - "StringEqual": 1, - "StringNotEqual": 2, -} - -func (x EACLRecord_FilterInfo_MatchType) String() string { - return proto.EnumName(EACLRecord_FilterInfo_MatchType_name, int32(x)) -} - -func (EACLRecord_FilterInfo_MatchType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_9b63aff5f3a35e32, []int{0, 0, 1} -} - -// EACLRecord groups information about extended ACL rule. -type EACLRecord struct { - // Operation carries type of operation. - Operation EACLRecord_Operation `protobuf:"varint,1,opt,name=operation,json=Operation,proto3,enum=acl.EACLRecord_Operation" json:"operation,omitempty"` - // Action carries ACL target action. - Action EACLRecord_Action `protobuf:"varint,2,opt,name=action,json=Action,proto3,enum=acl.EACLRecord_Action" json:"action,omitempty"` - // Filters carries set of filters. - Filters []*EACLRecord_FilterInfo `protobuf:"bytes,3,rep,name=Filters,proto3" json:"Filters,omitempty"` - // Targets carries information about extended ACL target list. - Targets []*EACLRecord_TargetInfo `protobuf:"bytes,4,rep,name=Targets,proto3" json:"Targets,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *EACLRecord) Reset() { *m = EACLRecord{} } -func (m *EACLRecord) String() string { return proto.CompactTextString(m) } -func (*EACLRecord) ProtoMessage() {} -func (*EACLRecord) Descriptor() ([]byte, []int) { - return fileDescriptor_9b63aff5f3a35e32, []int{0} -} -func (m *EACLRecord) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *EACLRecord) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *EACLRecord) XXX_Merge(src proto.Message) { - xxx_messageInfo_EACLRecord.Merge(m, src) -} -func (m *EACLRecord) XXX_Size() int { - return m.Size() -} -func (m *EACLRecord) XXX_DiscardUnknown() { - xxx_messageInfo_EACLRecord.DiscardUnknown(m) -} - -var xxx_messageInfo_EACLRecord proto.InternalMessageInfo - -func (m *EACLRecord) GetOperation() EACLRecord_Operation { - if m != nil { - return m.Operation - } - return EACLRecord_OPERATION_UNKNOWN -} - -func (m *EACLRecord) GetAction() EACLRecord_Action { - if m != nil { - return m.Action - } - return EACLRecord_ActionUnknown -} - -func (m *EACLRecord) GetFilters() []*EACLRecord_FilterInfo { - if m != nil { - return m.Filters - } - return nil -} - -func (m *EACLRecord) GetTargets() []*EACLRecord_TargetInfo { - if m != nil { - return m.Targets - } - return nil -} - -// FilterInfo groups information about filter. -type EACLRecord_FilterInfo struct { - // Header carries type of header. - Header EACLRecord_FilterInfo_Header `protobuf:"varint,1,opt,name=header,json=HeaderType,proto3,enum=acl.EACLRecord_FilterInfo_Header" json:"header,omitempty"` - // MatchType carries type of match. - MatchType EACLRecord_FilterInfo_MatchType `protobuf:"varint,2,opt,name=matchType,json=MatchType,proto3,enum=acl.EACLRecord_FilterInfo_MatchType" json:"matchType,omitempty"` - // HeaderName carries name of filtering header. - HeaderName string `protobuf:"bytes,3,opt,name=HeaderName,json=Name,proto3" json:"HeaderName,omitempty"` - // HeaderVal carries value of filtering header. - HeaderVal string `protobuf:"bytes,4,opt,name=HeaderVal,json=Value,proto3" json:"HeaderVal,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *EACLRecord_FilterInfo) Reset() { *m = EACLRecord_FilterInfo{} } -func (m *EACLRecord_FilterInfo) String() string { return proto.CompactTextString(m) } -func (*EACLRecord_FilterInfo) ProtoMessage() {} -func (*EACLRecord_FilterInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_9b63aff5f3a35e32, []int{0, 0} -} -func (m *EACLRecord_FilterInfo) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *EACLRecord_FilterInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *EACLRecord_FilterInfo) XXX_Merge(src proto.Message) { - xxx_messageInfo_EACLRecord_FilterInfo.Merge(m, src) -} -func (m *EACLRecord_FilterInfo) XXX_Size() int { - return m.Size() -} -func (m *EACLRecord_FilterInfo) XXX_DiscardUnknown() { - xxx_messageInfo_EACLRecord_FilterInfo.DiscardUnknown(m) -} - -var xxx_messageInfo_EACLRecord_FilterInfo proto.InternalMessageInfo - -func (m *EACLRecord_FilterInfo) GetHeader() EACLRecord_FilterInfo_Header { - if m != nil { - return m.Header - } - return EACLRecord_FilterInfo_HeaderUnknown -} - -func (m *EACLRecord_FilterInfo) GetMatchType() EACLRecord_FilterInfo_MatchType { - if m != nil { - return m.MatchType - } - return EACLRecord_FilterInfo_MatchUnknown -} - -func (m *EACLRecord_FilterInfo) GetHeaderName() string { - if m != nil { - return m.HeaderName - } - return "" -} - -func (m *EACLRecord_FilterInfo) GetHeaderVal() string { - if m != nil { - return m.HeaderVal - } - return "" -} - -// TargetInfo groups information about extended ACL target. -type EACLRecord_TargetInfo struct { - // Target carries target of ACL rule. - Target Target `protobuf:"varint,1,opt,name=Target,json=Role,proto3,enum=acl.Target" json:"Target,omitempty"` - // KeyList carries public keys of ACL target. - KeyList [][]byte `protobuf:"bytes,2,rep,name=KeyList,json=Keys,proto3" json:"KeyList,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *EACLRecord_TargetInfo) Reset() { *m = EACLRecord_TargetInfo{} } -func (m *EACLRecord_TargetInfo) String() string { return proto.CompactTextString(m) } -func (*EACLRecord_TargetInfo) ProtoMessage() {} -func (*EACLRecord_TargetInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_9b63aff5f3a35e32, []int{0, 1} -} -func (m *EACLRecord_TargetInfo) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *EACLRecord_TargetInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *EACLRecord_TargetInfo) XXX_Merge(src proto.Message) { - xxx_messageInfo_EACLRecord_TargetInfo.Merge(m, src) -} -func (m *EACLRecord_TargetInfo) XXX_Size() int { - return m.Size() -} -func (m *EACLRecord_TargetInfo) XXX_DiscardUnknown() { - xxx_messageInfo_EACLRecord_TargetInfo.DiscardUnknown(m) -} - -var xxx_messageInfo_EACLRecord_TargetInfo proto.InternalMessageInfo - -func (m *EACLRecord_TargetInfo) GetTarget() Target { - if m != nil { - return m.Target - } - return Target_Unknown -} - -func (m *EACLRecord_TargetInfo) GetKeyList() [][]byte { - if m != nil { - return m.KeyList - } - return nil -} - -// EACLRecord carries the information about extended ACL rules. -type EACLTable struct { - // Records carries list of extended ACL rule records. - Records []*EACLRecord `protobuf:"bytes,1,rep,name=Records,proto3" json:"Records,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *EACLTable) Reset() { *m = EACLTable{} } -func (m *EACLTable) String() string { return proto.CompactTextString(m) } -func (*EACLTable) ProtoMessage() {} -func (*EACLTable) Descriptor() ([]byte, []int) { - return fileDescriptor_9b63aff5f3a35e32, []int{1} -} -func (m *EACLTable) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *EACLTable) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *EACLTable) XXX_Merge(src proto.Message) { - xxx_messageInfo_EACLTable.Merge(m, src) -} -func (m *EACLTable) XXX_Size() int { - return m.Size() -} -func (m *EACLTable) XXX_DiscardUnknown() { - xxx_messageInfo_EACLTable.DiscardUnknown(m) -} - -var xxx_messageInfo_EACLTable proto.InternalMessageInfo - -func (m *EACLTable) GetRecords() []*EACLRecord { - if m != nil { - return m.Records - } - return nil -} - -func init() { - proto.RegisterEnum("acl.Target", Target_name, Target_value) - proto.RegisterEnum("acl.EACLRecord_Operation", EACLRecord_Operation_name, EACLRecord_Operation_value) - proto.RegisterEnum("acl.EACLRecord_Action", EACLRecord_Action_name, EACLRecord_Action_value) - proto.RegisterEnum("acl.EACLRecord_FilterInfo_Header", EACLRecord_FilterInfo_Header_name, EACLRecord_FilterInfo_Header_value) - proto.RegisterEnum("acl.EACLRecord_FilterInfo_MatchType", EACLRecord_FilterInfo_MatchType_name, EACLRecord_FilterInfo_MatchType_value) - proto.RegisterType((*EACLRecord)(nil), "acl.EACLRecord") - proto.RegisterType((*EACLRecord_FilterInfo)(nil), "acl.EACLRecord.FilterInfo") - proto.RegisterType((*EACLRecord_TargetInfo)(nil), "acl.EACLRecord.TargetInfo") - proto.RegisterType((*EACLTable)(nil), "acl.EACLTable") -} - -func init() { proto.RegisterFile("acl/types.proto", fileDescriptor_9b63aff5f3a35e32) } - -var fileDescriptor_9b63aff5f3a35e32 = []byte{ - // 676 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x54, 0xcd, 0x6e, 0xda, 0x58, - 0x14, 0x8e, 0x7f, 0x62, 0xc2, 0x01, 0x92, 0x9b, 0x2b, 0x65, 0xe4, 0x61, 0x41, 0x08, 0x9a, 0x91, - 0x98, 0x91, 0x30, 0xa3, 0x4c, 0xd5, 0x45, 0x77, 0x26, 0x31, 0x81, 0x92, 0x1a, 0x6a, 0x4c, 0x2a, - 0x75, 0x53, 0x5d, 0x9c, 0x1b, 0xa0, 0x35, 0xbe, 0xc4, 0x36, 0x89, 0x78, 0x93, 0x3e, 0x43, 0x9f, - 0xa4, 0xcb, 0x2e, 0xbb, 0x4a, 0x2b, 0xba, 0xef, 0x33, 0x54, 0xbe, 0x17, 0xc7, 0x51, 0xd4, 0x76, - 0xe5, 0xef, 0x3b, 0xbf, 0xf7, 0x7c, 0xe7, 0xc8, 0xb0, 0x47, 0x3c, 0xbf, 0x19, 0xaf, 0x16, 0x34, - 0x32, 0x16, 0x21, 0x8b, 0x19, 0x56, 0x88, 0xe7, 0x97, 0x1b, 0x93, 0x59, 0x3c, 0x5d, 0x8e, 0x0d, - 0x8f, 0xcd, 0x9b, 0x13, 0x36, 0x61, 0x4d, 0xee, 0x1b, 0x2f, 0xaf, 0x38, 0xe3, 0x84, 0x23, 0x91, - 0x53, 0xfb, 0xa2, 0x01, 0x58, 0xe6, 0xc9, 0xb9, 0x43, 0x3d, 0x16, 0x5e, 0xe2, 0x36, 0xe4, 0xd9, - 0x82, 0x86, 0x24, 0x9e, 0xb1, 0x40, 0x97, 0xaa, 0x52, 0x7d, 0xf7, 0xf8, 0x4f, 0x83, 0x78, 0xbe, - 0x91, 0xc5, 0x18, 0xfd, 0x34, 0xa0, 0x55, 0x5a, 0xdf, 0x1d, 0xe6, 0xef, 0xa9, 0x93, 0x41, 0xfc, - 0x0c, 0x34, 0xe2, 0xf1, 0x22, 0x32, 0x2f, 0xf2, 0xc7, 0xe3, 0x22, 0x26, 0xf7, 0xb6, 0x60, 0x7d, - 0x77, 0xa8, 0x09, 0xec, 0x6c, 0xbe, 0xf8, 0x09, 0xe4, 0xda, 0x33, 0x3f, 0xa6, 0x61, 0xa4, 0x2b, - 0x55, 0xa5, 0x5e, 0x38, 0x2e, 0x3f, 0x4e, 0x16, 0xee, 0x6e, 0x70, 0xc5, 0x9c, 0x34, 0x34, 0xc9, - 0x72, 0x49, 0x38, 0xa1, 0x71, 0xa4, 0xab, 0x3f, 0xcf, 0x12, 0x6e, 0x91, 0xb5, 0x09, 0x2d, 0x7f, - 0x97, 0x01, 0xb2, 0x6a, 0xb8, 0x0b, 0xda, 0x94, 0x92, 0x4b, 0x1a, 0x6e, 0x66, 0x3f, 0xfa, 0x75, - 0x67, 0xa3, 0xc3, 0x03, 0xc5, 0x04, 0x02, 0x3b, 0x20, 0xbe, 0xee, 0x6a, 0x41, 0xf1, 0x4b, 0xc8, - 0xcf, 0x49, 0xec, 0x4d, 0x13, 0xb2, 0x11, 0xe1, 0xaf, 0xdf, 0x54, 0x7b, 0x91, 0xc6, 0x0a, 0x51, - 0xef, 0xa9, 0x93, 0x41, 0xac, 0xc3, 0xa6, 0x81, 0x4d, 0xe6, 0x54, 0x57, 0xaa, 0x52, 0x3d, 0xef, - 0xa8, 0x09, 0xc6, 0x3a, 0xe4, 0x85, 0xe7, 0x82, 0xf8, 0xba, 0xca, 0x1d, 0xdb, 0x17, 0xc4, 0x5f, - 0xd2, 0xda, 0x73, 0xd8, 0x3c, 0x0e, 0xef, 0x43, 0x49, 0xa0, 0x51, 0xf0, 0x2e, 0x60, 0xb7, 0x01, - 0xda, 0xc2, 0x05, 0xc8, 0x39, 0xf4, 0x7a, 0x49, 0xa3, 0x18, 0x49, 0x18, 0x41, 0xb1, 0x3f, 0x7e, - 0x4b, 0xbd, 0x78, 0xb8, 0x8a, 0x62, 0x3a, 0x47, 0x32, 0xde, 0x05, 0x10, 0x96, 0x51, 0x44, 0x43, - 0xa4, 0xd4, 0x5a, 0xf0, 0xe0, 0x31, 0x08, 0x8a, 0x9c, 0x64, 0xd5, 0xf6, 0xa0, 0x30, 0x8c, 0xc3, - 0x59, 0x30, 0xb1, 0xae, 0x97, 0xc4, 0x47, 0x12, 0xc6, 0xb0, 0x2b, 0x0c, 0x36, 0x8b, 0x85, 0x4d, - 0x2e, 0xb7, 0x01, 0xb2, 0x3d, 0xe0, 0x23, 0xd0, 0x04, 0xdb, 0xe8, 0x5d, 0xe0, 0x0a, 0x09, 0x93, - 0xa3, 0x3a, 0xcc, 0xa7, 0xf8, 0x00, 0x72, 0x3d, 0xba, 0x3a, 0x9f, 0x45, 0xb1, 0x2e, 0x57, 0x95, - 0x7a, 0xd1, 0x51, 0x7b, 0x74, 0x15, 0xd5, 0x6e, 0xe0, 0xc1, 0xb5, 0x1d, 0xc0, 0x7e, 0x7f, 0x60, - 0x39, 0xa6, 0xdb, 0xed, 0xdb, 0x6f, 0x46, 0x76, 0xcf, 0xee, 0xbf, 0xb2, 0xd1, 0x16, 0xce, 0x81, - 0x72, 0x66, 0xb9, 0x48, 0xc2, 0x3b, 0xa0, 0x76, 0x2c, 0xf3, 0x14, 0xc9, 0x89, 0x69, 0x30, 0x72, - 0x91, 0x82, 0x01, 0xb4, 0x53, 0xeb, 0xdc, 0x72, 0x2d, 0xa4, 0x26, 0x78, 0x68, 0x99, 0xce, 0x49, - 0x07, 0x6d, 0xe3, 0x22, 0xec, 0x9c, 0x59, 0xae, 0x63, 0xda, 0x67, 0x16, 0xd2, 0x92, 0x21, 0x53, - 0xd6, 0x31, 0x87, 0x1d, 0x94, 0xab, 0xfd, 0x07, 0xe9, 0x99, 0xee, 0x43, 0x49, 0xa0, 0x4c, 0x81, - 0x3c, 0x6c, 0x9b, 0xbe, 0xcf, 0x6e, 0x45, 0xcb, 0x53, 0x1a, 0xac, 0x90, 0x5c, 0x7b, 0x0a, 0xf9, - 0x64, 0xe5, 0x2e, 0x19, 0xfb, 0x14, 0xff, 0x93, 0x28, 0x9e, 0xec, 0x3e, 0xd2, 0x25, 0x7e, 0xa5, - 0x7b, 0x8f, 0x6e, 0xc2, 0x49, 0xfd, 0xff, 0x9e, 0xa4, 0xda, 0x24, 0x6b, 0xca, 0x7a, 0xec, 0x80, - 0xca, 0xd7, 0x21, 0xf1, 0x67, 0xa7, 0xab, 0x02, 0xd0, 0xfa, 0xf1, 0x94, 0x86, 0x91, 0x18, 0x6d, - 0xb0, 0x1c, 0xf7, 0xe8, 0x0a, 0xa9, 0xad, 0xde, 0xc7, 0x75, 0x45, 0xfa, 0xb4, 0xae, 0x48, 0x9f, - 0xd7, 0x15, 0xe9, 0xeb, 0xba, 0x22, 0xbd, 0xff, 0x56, 0xd9, 0x7a, 0xfd, 0xf7, 0x83, 0x7f, 0x44, - 0x10, 0x2d, 0x3c, 0xaf, 0x71, 0x49, 0x6f, 0x9a, 0x01, 0x65, 0x57, 0x51, 0x83, 0x2c, 0x66, 0x8d, - 0x09, 0x6b, 0x12, 0xcf, 0xff, 0x20, 0x97, 0x6c, 0xca, 0xda, 0x43, 0xc3, 0x1c, 0x74, 0x0d, 0xd3, - 0xf3, 0xc7, 0x1a, 0xff, 0x65, 0xfc, 0xff, 0x23, 0x00, 0x00, 0xff, 0xff, 0x39, 0x7b, 0x27, 0xe6, - 0x79, 0x04, 0x00, 0x00, -} - -func (m *EACLRecord) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *EACLRecord) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *EACLRecord) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.Targets) > 0 { - for iNdEx := len(m.Targets) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Targets[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } - } - if len(m.Filters) > 0 { - for iNdEx := len(m.Filters) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Filters[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - } - if m.Action != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.Action)) - i-- - dAtA[i] = 0x10 - } - if m.Operation != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.Operation)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *EACLRecord_FilterInfo) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *EACLRecord_FilterInfo) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *EACLRecord_FilterInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.HeaderVal) > 0 { - i -= len(m.HeaderVal) - copy(dAtA[i:], m.HeaderVal) - i = encodeVarintTypes(dAtA, i, uint64(len(m.HeaderVal))) - i-- - dAtA[i] = 0x22 - } - if len(m.HeaderName) > 0 { - i -= len(m.HeaderName) - copy(dAtA[i:], m.HeaderName) - i = encodeVarintTypes(dAtA, i, uint64(len(m.HeaderName))) - i-- - dAtA[i] = 0x1a - } - if m.MatchType != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.MatchType)) - i-- - dAtA[i] = 0x10 - } - if m.Header != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.Header)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *EACLRecord_TargetInfo) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *EACLRecord_TargetInfo) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *EACLRecord_TargetInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.KeyList) > 0 { - for iNdEx := len(m.KeyList) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.KeyList[iNdEx]) - copy(dAtA[i:], m.KeyList[iNdEx]) - i = encodeVarintTypes(dAtA, i, uint64(len(m.KeyList[iNdEx]))) - i-- - dAtA[i] = 0x12 - } - } - if m.Target != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.Target)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *EACLTable) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *EACLTable) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *EACLTable) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.Records) > 0 { - for iNdEx := len(m.Records) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Records[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func encodeVarintTypes(dAtA []byte, offset int, v uint64) int { - offset -= sovTypes(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *EACLRecord) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Operation != 0 { - n += 1 + sovTypes(uint64(m.Operation)) - } - if m.Action != 0 { - n += 1 + sovTypes(uint64(m.Action)) - } - if len(m.Filters) > 0 { - for _, e := range m.Filters { - l = e.Size() - n += 1 + l + sovTypes(uint64(l)) - } - } - if len(m.Targets) > 0 { - for _, e := range m.Targets { - l = e.Size() - n += 1 + l + sovTypes(uint64(l)) - } - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *EACLRecord_FilterInfo) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Header != 0 { - n += 1 + sovTypes(uint64(m.Header)) - } - if m.MatchType != 0 { - n += 1 + sovTypes(uint64(m.MatchType)) - } - l = len(m.HeaderName) - if l > 0 { - n += 1 + l + sovTypes(uint64(l)) - } - l = len(m.HeaderVal) - if l > 0 { - n += 1 + l + sovTypes(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *EACLRecord_TargetInfo) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Target != 0 { - n += 1 + sovTypes(uint64(m.Target)) - } - if len(m.KeyList) > 0 { - for _, b := range m.KeyList { - l = len(b) - n += 1 + l + sovTypes(uint64(l)) - } - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *EACLTable) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Records) > 0 { - for _, e := range m.Records { - l = e.Size() - n += 1 + l + sovTypes(uint64(l)) - } - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func sovTypes(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozTypes(x uint64) (n int) { - return sovTypes(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *EACLRecord) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: EACLRecord: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: EACLRecord: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Operation", wireType) - } - m.Operation = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Operation |= EACLRecord_Operation(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Action", wireType) - } - m.Action = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Action |= EACLRecord_Action(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Filters", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Filters = append(m.Filters, &EACLRecord_FilterInfo{}) - if err := m.Filters[len(m.Filters)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Targets", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Targets = append(m.Targets, &EACLRecord_TargetInfo{}) - if err := m.Targets[len(m.Targets)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *EACLRecord_FilterInfo) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: FilterInfo: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: FilterInfo: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType) - } - m.Header = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Header |= EACLRecord_FilterInfo_Header(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MatchType", wireType) - } - m.MatchType = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MatchType |= EACLRecord_FilterInfo_MatchType(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field HeaderName", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.HeaderName = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field HeaderVal", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.HeaderVal = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *EACLRecord_TargetInfo) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: TargetInfo: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: TargetInfo: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Target", wireType) - } - m.Target = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Target |= Target(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field KeyList", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.KeyList = append(m.KeyList, make([]byte, postIndex-iNdEx)) - copy(m.KeyList[len(m.KeyList)-1], dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *EACLTable) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: EACLTable: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: EACLTable: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Records", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Records = append(m.Records, &EACLRecord{}) - if err := m.Records[len(m.Records)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipTypes(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTypes - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTypes - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTypes - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthTypes - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupTypes - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthTypes - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthTypes = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowTypes = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupTypes = fmt.Errorf("proto: unexpected end of group") -) diff --git a/acl/types.proto b/acl/types.proto deleted file mode 100644 index 7f3efc9..0000000 --- a/acl/types.proto +++ /dev/null @@ -1,106 +0,0 @@ -syntax = "proto3"; -package acl; -option go_package = "github.com/nspcc-dev/neofs-api-go/acl"; -option csharp_namespace = "NeoFS.API.Acl"; - -import "github.com/gogo/protobuf/gogoproto/gogo.proto"; -option (gogoproto.stable_marshaler_all) = true; - -// Target of the access control rule in access control list. -enum Target { - // Unknown target, default value. - Unknown = 0; - - // User target rule is applied if sender is the owner of the container. - User = 1; - - // System target rule is applied if sender is the storage node within the - // container or inner ring node. - System = 2; - - // Others target rule is applied if sender is not user or system target. - Others = 3; - - // PubKey target rule is applied if sender has public key provided in - // extended ACL. - PubKey = 4; -} - -// EACLRecord groups information about extended ACL rule. -message EACLRecord { - // Operation is an enumeration of operation types. - enum Operation { - OPERATION_UNKNOWN = 0; - GET = 1; - HEAD = 2; - PUT = 3; - DELETE = 4; - SEARCH = 5; - GETRANGE = 6; - GETRANGEHASH = 7; - } - - // Operation carries type of operation. - Operation operation = 1 [(gogoproto.customname) = "Operation", json_name="Operation"]; - - // Action is an enumeration of EACL actions. - enum Action { - ActionUnknown = 0; - Allow = 1; - Deny = 2; - } - - // Action carries ACL target action. - Action action = 2 [(gogoproto.customname) = "Action", json_name="Action"]; - - // FilterInfo groups information about filter. - message FilterInfo { - // Header is an enumeration of filtering header types. - enum Header { - HeaderUnknown = 0; - Request = 1; - ObjectSystem = 2; - ObjectUser = 3; - } - - // Header carries type of header. - Header header = 1 [(gogoproto.customname) = "Header", json_name="HeaderType"]; - - // MatchType is an enumeration of match types. - enum MatchType { - MatchUnknown = 0; - StringEqual = 1; - StringNotEqual = 2; - } - - // MatchType carries type of match. - MatchType matchType = 2 [(gogoproto.customname) = "MatchType", json_name="MatchType"]; - - // HeaderName carries name of filtering header. - string HeaderName = 3 [json_name="Name"]; - - // HeaderVal carries value of filtering header. - string HeaderVal = 4 [json_name="Value"]; - } - - // Filters carries set of filters. - repeated FilterInfo Filters = 3 [json_name="Filters"]; - - // TargetInfo groups information about extended ACL target. - message TargetInfo { - // Target carries target of ACL rule. - acl.Target Target = 1 [json_name="Role"]; - - // KeyList carries public keys of ACL target. - repeated bytes KeyList = 2 [json_name="Keys"]; - } - - // Targets carries information about extended ACL target list. - repeated TargetInfo Targets = 4 [json_name="Targets"]; -} - -// EACLRecord carries the information about extended ACL rules. -message EACLTable { - // Records carries list of extended ACL rule records. - repeated EACLRecord Records = 1 [json_name="Records"]; -} diff --git a/bootstrap/service.go b/bootstrap/service.go deleted file mode 100644 index 929d9b3..0000000 --- a/bootstrap/service.go +++ /dev/null @@ -1,8 +0,0 @@ -package bootstrap - -import ( - "github.com/nspcc-dev/neofs-api-go/service" -) - -// NodeType type alias. -type NodeType = service.NodeRole diff --git a/bootstrap/service.pb.go b/bootstrap/service.pb.go deleted file mode 100644 index 50e6c67..0000000 --- a/bootstrap/service.pb.go +++ /dev/null @@ -1,628 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: bootstrap/service.proto - -package bootstrap - -import ( - context "context" - fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/golang/protobuf/proto" - service "github.com/nspcc-dev/neofs-api-go/service" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package - -// Node state -type Request_State int32 - -const ( - // used by default - Request_Unknown Request_State = 0 - // used to inform that node online - Request_Online Request_State = 1 - // used to inform that node offline - Request_Offline Request_State = 2 -) - -var Request_State_name = map[int32]string{ - 0: "Unknown", - 1: "Online", - 2: "Offline", -} - -var Request_State_value = map[string]int32{ - "Unknown": 0, - "Online": 1, - "Offline": 2, -} - -func (x Request_State) String() string { - return proto.EnumName(Request_State_name, int32(x)) -} - -func (Request_State) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_21bce759c9d8eb63, []int{0, 0} -} - -type Request struct { - // Type is NodeType, can be InnerRingNode (type=1) or StorageNode (type=2) - Type NodeType `protobuf:"varint,1,opt,name=type,proto3,customtype=NodeType" json:"type"` - // Info contains information about node - Info NodeInfo `protobuf:"bytes,2,opt,name=info,proto3" json:"info"` - // State contains node status - State Request_State `protobuf:"varint,3,opt,name=state,proto3,enum=bootstrap.Request_State" json:"state,omitempty"` - // RequestMetaHeader contains information about request meta headers (should be embedded into message) - service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` - // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) - service.RequestVerificationHeader `protobuf:"bytes,99,opt,name=Verify,proto3,embedded=Verify" json:"Verify"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Request) Reset() { *m = Request{} } -func (m *Request) String() string { return proto.CompactTextString(m) } -func (*Request) ProtoMessage() {} -func (*Request) Descriptor() ([]byte, []int) { - return fileDescriptor_21bce759c9d8eb63, []int{0} -} -func (m *Request) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Request) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *Request) XXX_Merge(src proto.Message) { - xxx_messageInfo_Request.Merge(m, src) -} -func (m *Request) XXX_Size() int { - return m.Size() -} -func (m *Request) XXX_DiscardUnknown() { - xxx_messageInfo_Request.DiscardUnknown(m) -} - -var xxx_messageInfo_Request proto.InternalMessageInfo - -func (m *Request) GetInfo() NodeInfo { - if m != nil { - return m.Info - } - return NodeInfo{} -} - -func (m *Request) GetState() Request_State { - if m != nil { - return m.State - } - return Request_Unknown -} - -func init() { - proto.RegisterEnum("bootstrap.Request_State", Request_State_name, Request_State_value) - proto.RegisterType((*Request)(nil), "bootstrap.Request") -} - -func init() { proto.RegisterFile("bootstrap/service.proto", fileDescriptor_21bce759c9d8eb63) } - -var fileDescriptor_21bce759c9d8eb63 = []byte{ - // 420 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x51, 0x4d, 0x8b, 0xd3, 0x40, - 0x18, 0xee, 0xd4, 0xb4, 0xdd, 0x9d, 0x05, 0x59, 0x66, 0x57, 0x0c, 0x3d, 0xa4, 0xa5, 0xa7, 0x82, - 0x66, 0x02, 0xdd, 0x8b, 0x47, 0x0d, 0x22, 0xee, 0x61, 0x3f, 0x48, 0xfd, 0x00, 0x6f, 0x93, 0xf4, - 0x4d, 0x1d, 0x74, 0xe7, 0x1d, 0x33, 0xd3, 0x4a, 0xff, 0x89, 0xbf, 0xc1, 0xff, 0x21, 0xec, 0x71, - 0x8f, 0xe2, 0xa1, 0x48, 0xfc, 0x23, 0x32, 0xd3, 0xb4, 0x16, 0xf7, 0x94, 0xbc, 0xcf, 0xd7, 0xbc, - 0x1f, 0xf4, 0x71, 0x8e, 0x68, 0x8d, 0xad, 0x84, 0x4e, 0x0c, 0x54, 0x4b, 0x59, 0x00, 0xd7, 0x15, - 0x5a, 0x64, 0x87, 0x3b, 0xa2, 0xcf, 0x1a, 0x26, 0xb9, 0x01, 0x2b, 0x36, 0x74, 0xff, 0x74, 0x8b, - 0x2d, 0xa1, 0x92, 0xe5, 0xaa, 0x41, 0x1f, 0xfd, 0x4b, 0xb3, 0x2b, 0x0d, 0xa6, 0x81, 0xe3, 0xb9, - 0xb4, 0x1f, 0x17, 0x39, 0x2f, 0xf0, 0x26, 0x99, 0xe3, 0x1c, 0x13, 0x0f, 0xe7, 0x8b, 0xd2, 0x57, - 0xbe, 0xf0, 0x7f, 0x1b, 0xf9, 0xe8, 0x47, 0x9b, 0xf6, 0x32, 0xf8, 0xb2, 0x00, 0x63, 0xd9, 0x53, - 0x1a, 0xb8, 0xa4, 0x90, 0x0c, 0xc9, 0xb8, 0x93, 0x86, 0xb7, 0xeb, 0x41, 0xeb, 0xd7, 0x7a, 0x70, - 0x70, 0x89, 0x33, 0x78, 0xb3, 0xd2, 0x50, 0xaf, 0x07, 0x81, 0xfb, 0x66, 0x5e, 0xc5, 0x62, 0x1a, - 0x48, 0x55, 0x62, 0xd8, 0x1e, 0x92, 0xf1, 0xd1, 0xe4, 0x84, 0xef, 0xda, 0xe1, 0xce, 0x70, 0xae, - 0x4a, 0x4c, 0x03, 0x17, 0x91, 0x79, 0x19, 0xe3, 0xb4, 0x63, 0xac, 0xb0, 0x10, 0x3e, 0x18, 0x92, - 0xf1, 0xc3, 0x49, 0xb8, 0xa7, 0x6f, 0xde, 0xe7, 0x53, 0xc7, 0x67, 0x1b, 0x19, 0x7b, 0x46, 0x83, - 0x0b, 0xb0, 0x22, 0xcc, 0x7d, 0x7c, 0x9f, 0x6f, 0x37, 0xd6, 0x88, 0x1d, 0xf7, 0x1a, 0xc4, 0x0c, - 0xaa, 0xf4, 0xc0, 0xbd, 0x72, 0xb7, 0x1e, 0x90, 0xcc, 0x3b, 0xd8, 0x4b, 0xda, 0x7d, 0xe7, 0x17, - 0x15, 0x16, 0xde, 0x3b, 0xfa, 0xdf, 0xeb, 0x59, 0x59, 0x08, 0x2b, 0x51, 0xdd, 0xcb, 0x68, 0xbc, - 0xa3, 0x98, 0x76, 0x7c, 0x3f, 0xec, 0x88, 0xf6, 0xde, 0xaa, 0x4f, 0x0a, 0xbf, 0xaa, 0xe3, 0x16, - 0xa3, 0xb4, 0x7b, 0xa5, 0x3e, 0x4b, 0x05, 0xc7, 0xc4, 0x11, 0x57, 0x65, 0xe9, 0x8b, 0xf6, 0xe4, - 0x39, 0x3d, 0x4c, 0xb7, 0x03, 0xb1, 0x33, 0xda, 0xbb, 0xae, 0xb0, 0x00, 0x63, 0x18, 0xbb, 0x3f, - 0x67, 0xff, 0x74, 0x0f, 0x9b, 0xea, 0x0a, 0xc4, 0xec, 0x42, 0xe8, 0xf4, 0xfd, 0x6d, 0x1d, 0x91, - 0xbb, 0x3a, 0x22, 0x3f, 0xeb, 0x88, 0xfc, 0xae, 0x23, 0xf2, 0xed, 0x4f, 0xd4, 0xfa, 0xf0, 0x64, - 0xef, 0x9c, 0xca, 0xe8, 0xa2, 0x88, 0x67, 0xb0, 0x4c, 0x14, 0x60, 0x69, 0x62, 0xa1, 0x65, 0x3c, - 0xc7, 0x64, 0x17, 0xf6, 0xbd, 0x7d, 0x72, 0x09, 0xf8, 0x6a, 0xca, 0x5f, 0x5c, 0x9f, 0xf3, 0x5d, - 0x37, 0x79, 0xd7, 0x5f, 0xfa, 0xec, 0x6f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x74, 0xc6, 0xb6, 0xb6, - 0x7f, 0x02, 0x00, 0x00, -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 - -// BootstrapClient is the client API for Bootstrap service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type BootstrapClient interface { - // Process is method that allows to register node in the network and receive actual netmap - Process(ctx context.Context, in *Request, opts ...grpc.CallOption) (*SpreadMap, error) -} - -type bootstrapClient struct { - cc *grpc.ClientConn -} - -func NewBootstrapClient(cc *grpc.ClientConn) BootstrapClient { - return &bootstrapClient{cc} -} - -func (c *bootstrapClient) Process(ctx context.Context, in *Request, opts ...grpc.CallOption) (*SpreadMap, error) { - out := new(SpreadMap) - err := c.cc.Invoke(ctx, "/bootstrap.Bootstrap/Process", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// BootstrapServer is the server API for Bootstrap service. -type BootstrapServer interface { - // Process is method that allows to register node in the network and receive actual netmap - Process(context.Context, *Request) (*SpreadMap, error) -} - -// UnimplementedBootstrapServer can be embedded to have forward compatible implementations. -type UnimplementedBootstrapServer struct { -} - -func (*UnimplementedBootstrapServer) Process(ctx context.Context, req *Request) (*SpreadMap, error) { - return nil, status.Errorf(codes.Unimplemented, "method Process not implemented") -} - -func RegisterBootstrapServer(s *grpc.Server, srv BootstrapServer) { - s.RegisterService(&_Bootstrap_serviceDesc, srv) -} - -func _Bootstrap_Process_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(BootstrapServer).Process(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/bootstrap.Bootstrap/Process", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(BootstrapServer).Process(ctx, req.(*Request)) - } - return interceptor(ctx, in, info, handler) -} - -var _Bootstrap_serviceDesc = grpc.ServiceDesc{ - ServiceName: "bootstrap.Bootstrap", - HandlerType: (*BootstrapServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Process", - Handler: _Bootstrap_Process_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "bootstrap/service.proto", -} - -func (m *Request) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Request) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Request) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - { - size, err := m.RequestVerificationHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x6 - i-- - dAtA[i] = 0x9a - { - size, err := m.RequestMetaHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x6 - i-- - dAtA[i] = 0x92 - if m.State != 0 { - i = encodeVarintService(dAtA, i, uint64(m.State)) - i-- - dAtA[i] = 0x18 - } - { - size, err := m.Info.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - if m.Type != 0 { - i = encodeVarintService(dAtA, i, uint64(m.Type)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func encodeVarintService(dAtA []byte, offset int, v uint64) int { - offset -= sovService(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *Request) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Type != 0 { - n += 1 + sovService(uint64(m.Type)) - } - l = m.Info.Size() - n += 1 + l + sovService(uint64(l)) - if m.State != 0 { - n += 1 + sovService(uint64(m.State)) - } - l = m.RequestMetaHeader.Size() - n += 2 + l + sovService(uint64(l)) - l = m.RequestVerificationHeader.Size() - n += 2 + l + sovService(uint64(l)) - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func sovService(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozService(x uint64) (n int) { - return sovService(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *Request) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Request: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Request: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) - } - m.Type = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Type |= NodeType(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Info", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Info.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field State", wireType) - } - m.State = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.State |= Request_State(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 98: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.RequestMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 99: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RequestVerificationHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.RequestVerificationHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipService(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowService - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowService - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowService - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthService - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupService - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthService - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthService = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowService = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupService = fmt.Errorf("proto: unexpected end of group") -) diff --git a/bootstrap/service.proto b/bootstrap/service.proto deleted file mode 100644 index 6918bef..0000000 --- a/bootstrap/service.proto +++ /dev/null @@ -1,42 +0,0 @@ -syntax = "proto3"; -package bootstrap; -option go_package = "github.com/nspcc-dev/neofs-api-go/bootstrap"; -option csharp_namespace = "NeoFS.API.Bootstrap"; - -import "service/meta.proto"; -import "service/verify.proto"; -import "bootstrap/types.proto"; -import "github.com/gogo/protobuf/gogoproto/gogo.proto"; - -option (gogoproto.stable_marshaler_all) = true; - -// Bootstrap service allows neofs-node to connect to the network. Node should -// perform at least one bootstrap request in the epoch to stay in the network -// for the next epoch. -service Bootstrap { - // Process is method that allows to register node in the network and receive actual netmap - rpc Process(Request) returns (bootstrap.SpreadMap); -} - -message Request { - // Node state - enum State { - // used by default - Unknown = 0; - // used to inform that node online - Online = 1; - // used to inform that node offline - Offline = 2; - } - - // Type is NodeType, can be InnerRingNode (type=1) or StorageNode (type=2) - int32 type = 1 [(gogoproto.customname) = "Type" , (gogoproto.nullable) = false, (gogoproto.customtype) = "NodeType"]; - // Info contains information about node - bootstrap.NodeInfo info = 2 [(gogoproto.nullable) = false]; - // State contains node status - State state = 3; - // RequestMetaHeader contains information about request meta headers (should be embedded into message) - service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; - // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) - service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; -} diff --git a/bootstrap/sign.go b/bootstrap/sign.go deleted file mode 100644 index 34f7fc2..0000000 --- a/bootstrap/sign.go +++ /dev/null @@ -1,46 +0,0 @@ -package bootstrap - -import ( - "io" - - "github.com/nspcc-dev/neofs-api-go/service" -) - -// SignedData returns payload bytes of the request. -func (m Request) SignedData() ([]byte, error) { - return service.SignedDataFromReader(m) -} - -// SignedDataSize returns payload size of the request. -func (m Request) SignedDataSize() (sz int) { - sz += m.GetType().Size() - - sz += m.GetState().Size() - - info := m.GetInfo() - sz += info.Size() - - return -} - -// ReadSignedData copies payload bytes to passed buffer. -// -// If the Request size is insufficient, io.ErrUnexpectedEOF returns. -func (m Request) ReadSignedData(p []byte) (int, error) { - if len(p) < m.SignedDataSize() { - return 0, io.ErrUnexpectedEOF - } - - var off int - - off += copy(p[off:], m.GetType().Bytes()) - - off += copy(p[off:], m.GetState().Bytes()) - - info := m.GetInfo() - // FIXME: implement and use stable functions - n, err := info.MarshalTo(p[off:]) - off += n - - return off, err -} diff --git a/bootstrap/sign_test.go b/bootstrap/sign_test.go deleted file mode 100644 index 3812130..0000000 --- a/bootstrap/sign_test.go +++ /dev/null @@ -1,82 +0,0 @@ -package bootstrap - -import ( - "testing" - - "github.com/nspcc-dev/neofs-api-go/service" - "github.com/nspcc-dev/neofs-crypto/test" - "github.com/stretchr/testify/require" -) - -func TestRequestSign(t *testing.T) { - sk := test.DecodeKey(0) - - type sigType interface { - service.RequestData - service.SignKeyPairAccumulator - service.SignKeyPairSource - SetToken(*service.Token) - } - - items := []struct { - constructor func() sigType - payloadCorrupt []func(sigType) - }{ - { // Request - constructor: func() sigType { - return new(Request) - }, - payloadCorrupt: []func(sigType){ - func(s sigType) { - req := s.(*Request) - - req.SetType(req.GetType() + 1) - }, - func(s sigType) { - req := s.(*Request) - - req.SetState(req.GetState() + 1) - }, - func(s sigType) { - req := s.(*Request) - - info := req.GetInfo() - info.Address += "1" - - req.SetInfo(info) - }, - }, - }, - } - - for _, item := range items { - { // token corruptions - v := item.constructor() - - token := new(service.Token) - v.SetToken(token) - - require.NoError(t, service.SignRequestData(sk, v)) - - require.NoError(t, service.VerifyRequestData(v)) - - token.SetSessionKey(append(token.GetSessionKey(), 1)) - - require.Error(t, service.VerifyRequestData(v)) - } - - { // payload corruptions - for _, corruption := range item.payloadCorrupt { - v := item.constructor() - - require.NoError(t, service.SignRequestData(sk, v)) - - require.NoError(t, service.VerifyRequestData(v)) - - corruption(v) - - require.Error(t, service.VerifyRequestData(v)) - } - } - } -} diff --git a/bootstrap/types.go b/bootstrap/types.go deleted file mode 100644 index 7ad3ec2..0000000 --- a/bootstrap/types.go +++ /dev/null @@ -1,137 +0,0 @@ -package bootstrap - -import ( - "bytes" - "encoding/binary" - "encoding/hex" - "strconv" - "strings" - - "github.com/golang/protobuf/proto" - "github.com/nspcc-dev/neofs-api-go/object" -) - -type ( - // NodeStatus is a bitwise status field of the node. - NodeStatus uint64 -) - -const ( - storageFullMask = 0x1 - - optionCapacity = "/Capacity:" - optionPrice = "/Price:" -) - -var ( - _ proto.Message = (*NodeInfo)(nil) - _ proto.Message = (*SpreadMap)(nil) -) - -var requestEndianness = binary.BigEndian - -// Equals checks whether two NodeInfo has same address. -func (m NodeInfo) Equals(n1 NodeInfo) bool { - return m.Address == n1.Address && bytes.Equal(m.PubKey, n1.PubKey) -} - -// Full checks if node has enough space for storing users objects. -func (n NodeStatus) Full() bool { - return n&storageFullMask > 0 -} - -// SetFull changes state of node to indicate if node has enough space for storing users objects. -// If value is true - there's not enough space. -func (n *NodeStatus) SetFull(value bool) { - switch value { - case true: - *n |= NodeStatus(storageFullMask) - case false: - *n &= NodeStatus(^uint64(storageFullMask)) - } -} - -// Price returns price in 1e-8*GAS/Megabyte per month. -// User set price in GAS/Terabyte per month. -func (m NodeInfo) Price() uint64 { - for i := range m.Options { - if strings.HasPrefix(m.Options[i], optionPrice) { - n, err := strconv.ParseFloat(m.Options[i][len(optionPrice):], 64) - if err != nil { - return 0 - } - return uint64(n*1e8) / uint64(object.UnitsMB) // UnitsMB == megabytes in 1 terabyte - } - } - return 0 -} - -// Capacity returns node's capacity as reported by user. -func (m NodeInfo) Capacity() uint64 { - for i := range m.Options { - if strings.HasPrefix(m.Options[i], optionCapacity) { - n, err := strconv.ParseUint(m.Options[i][len(optionCapacity):], 10, 64) - if err != nil { - return 0 - } - return n - } - } - return 0 -} - -// String returns string representation of NodeInfo. -func (m NodeInfo) String() string { - return "(NodeInfo)<" + - "Address:" + m.Address + - ", " + - "PublicKey:" + hex.EncodeToString(m.PubKey) + - ", " + - "Options: [" + strings.Join(m.Options, ",") + "]>" -} - -// String returns string representation of SpreadMap. -func (m SpreadMap) String() string { - result := make([]string, 0, len(m.NetMap)) - for i := range m.NetMap { - result = append(result, m.NetMap[i].String()) - } - return "(SpreadMap)<" + - "Epoch: " + strconv.FormatUint(m.Epoch, 10) + - ", " + - "Netmap: [" + strings.Join(result, ",") + "]>" -} - -// GetType is a Type field getter. -func (m Request) GetType() NodeType { - return m.Type -} - -// SetType is a Type field setter. -func (m *Request) SetType(t NodeType) { - m.Type = t -} - -// SetState is a State field setter. -func (m *Request) SetState(state Request_State) { - m.State = state -} - -// SetInfo is an Info field getter. -func (m *Request) SetInfo(info NodeInfo) { - m.Info = info -} - -// Size returns the size necessary for a binary representation of the state. -func (x Request_State) Size() int { - return 4 -} - -// Bytes returns a binary representation of the state. -func (x Request_State) Bytes() []byte { - data := make([]byte, x.Size()) - - requestEndianness.PutUint32(data, uint32(x)) - - return data -} diff --git a/bootstrap/types.pb.go b/bootstrap/types.pb.go deleted file mode 100644 index fcd8848..0000000 --- a/bootstrap/types.pb.go +++ /dev/null @@ -1,705 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: bootstrap/types.proto - -package bootstrap - -import ( - fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/golang/protobuf/proto" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package - -type SpreadMap struct { - // Epoch is current epoch for netmap - Epoch uint64 `protobuf:"varint,1,opt,name=Epoch,proto3" json:"Epoch,omitempty"` - // NetMap is a set of NodeInfos - NetMap []NodeInfo `protobuf:"bytes,2,rep,name=NetMap,proto3" json:"NetMap"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *SpreadMap) Reset() { *m = SpreadMap{} } -func (*SpreadMap) ProtoMessage() {} -func (*SpreadMap) Descriptor() ([]byte, []int) { - return fileDescriptor_423083266369adee, []int{0} -} -func (m *SpreadMap) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *SpreadMap) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *SpreadMap) XXX_Merge(src proto.Message) { - xxx_messageInfo_SpreadMap.Merge(m, src) -} -func (m *SpreadMap) XXX_Size() int { - return m.Size() -} -func (m *SpreadMap) XXX_DiscardUnknown() { - xxx_messageInfo_SpreadMap.DiscardUnknown(m) -} - -var xxx_messageInfo_SpreadMap proto.InternalMessageInfo - -func (m *SpreadMap) GetEpoch() uint64 { - if m != nil { - return m.Epoch - } - return 0 -} - -func (m *SpreadMap) GetNetMap() []NodeInfo { - if m != nil { - return m.NetMap - } - return nil -} - -type NodeInfo struct { - // Address is a node [multi-address](https://github.com/multiformats/multiaddr) - Address string `protobuf:"bytes,1,opt,name=Address,proto3" json:"address"` - // PubKey is a compressed public key representation in bytes - PubKey []byte `protobuf:"bytes,2,opt,name=PubKey,proto3" json:"pubkey,omitempty"` - // Options is set of node optional information, such as storage capacity, node location, price and etc - Options []string `protobuf:"bytes,3,rep,name=Options,proto3" json:"options,omitempty"` - // Status is bitmap status of the node - Status NodeStatus `protobuf:"varint,4,opt,name=Status,proto3,customtype=NodeStatus" json:"status"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *NodeInfo) Reset() { *m = NodeInfo{} } -func (*NodeInfo) ProtoMessage() {} -func (*NodeInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_423083266369adee, []int{1} -} -func (m *NodeInfo) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *NodeInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *NodeInfo) XXX_Merge(src proto.Message) { - xxx_messageInfo_NodeInfo.Merge(m, src) -} -func (m *NodeInfo) XXX_Size() int { - return m.Size() -} -func (m *NodeInfo) XXX_DiscardUnknown() { - xxx_messageInfo_NodeInfo.DiscardUnknown(m) -} - -var xxx_messageInfo_NodeInfo proto.InternalMessageInfo - -func (m *NodeInfo) GetAddress() string { - if m != nil { - return m.Address - } - return "" -} - -func (m *NodeInfo) GetPubKey() []byte { - if m != nil { - return m.PubKey - } - return nil -} - -func (m *NodeInfo) GetOptions() []string { - if m != nil { - return m.Options - } - return nil -} - -func init() { - proto.RegisterType((*SpreadMap)(nil), "bootstrap.SpreadMap") - proto.RegisterType((*NodeInfo)(nil), "bootstrap.NodeInfo") -} - -func init() { proto.RegisterFile("bootstrap/types.proto", fileDescriptor_423083266369adee) } - -var fileDescriptor_423083266369adee = []byte{ - // 370 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x4c, 0x91, 0xdf, 0x8a, 0x9b, 0x40, - 0x14, 0xc6, 0x9d, 0x24, 0x35, 0x75, 0xd2, 0x8b, 0xd6, 0x24, 0x20, 0xa5, 0xa8, 0x04, 0x0a, 0x42, - 0xa3, 0xd2, 0x3f, 0x2f, 0x10, 0xa1, 0x85, 0x50, 0x92, 0x06, 0xd3, 0xab, 0xde, 0x14, 0xff, 0x4c, - 0x8c, 0x2c, 0xf1, 0x0c, 0xce, 0xb8, 0xe0, 0xdd, 0x3e, 0xc6, 0x3e, 0xc3, 0x3e, 0xc8, 0x92, 0xcb, - 0xbd, 0x0c, 0x7b, 0x21, 0xbb, 0xee, 0x9d, 0x4f, 0xb1, 0x44, 0x63, 0xc8, 0xdd, 0xf9, 0xbe, 0xef, - 0x37, 0x33, 0x67, 0xce, 0xc1, 0x63, 0x1f, 0x80, 0x33, 0x9e, 0x7a, 0xd4, 0xe6, 0x39, 0x25, 0xcc, - 0xa2, 0x29, 0x70, 0x90, 0xa5, 0xb3, 0xfd, 0xd1, 0x8c, 0x62, 0xbe, 0xcd, 0x7c, 0x2b, 0x80, 0x9d, - 0x1d, 0x41, 0x04, 0x76, 0x4d, 0xf8, 0xd9, 0xa6, 0x56, 0xb5, 0xa8, 0xab, 0xe6, 0xe4, 0xe4, 0x2f, - 0x96, 0xd6, 0x34, 0x25, 0x5e, 0xb8, 0xf0, 0xa8, 0x3c, 0xc2, 0x6f, 0x7e, 0x52, 0x08, 0xb6, 0x0a, - 0xd2, 0x91, 0xd1, 0x73, 0x1b, 0x21, 0x7f, 0xc5, 0xe2, 0x92, 0xf0, 0x85, 0x47, 0x95, 0x8e, 0xde, - 0x35, 0x06, 0xdf, 0x86, 0xd6, 0xf9, 0x35, 0x6b, 0x09, 0x21, 0x99, 0x27, 0x1b, 0x70, 0x7a, 0xfb, - 0x42, 0x13, 0xdc, 0x13, 0x38, 0xb9, 0x47, 0xf8, 0x6d, 0x1b, 0xc9, 0x9f, 0x71, 0x7f, 0x16, 0x86, - 0x29, 0x61, 0xac, 0xbe, 0x57, 0x72, 0x06, 0x55, 0xa1, 0xf5, 0xbd, 0xc6, 0x72, 0xdb, 0x4c, 0x9e, - 0x62, 0x71, 0x95, 0xf9, 0xbf, 0x49, 0xae, 0x74, 0x74, 0x64, 0xbc, 0x73, 0x46, 0x55, 0xa1, 0xbd, - 0xa7, 0x99, 0x7f, 0x45, 0xf2, 0x29, 0xec, 0x62, 0x4e, 0x76, 0x94, 0xe7, 0xee, 0x89, 0x91, 0x6d, - 0xdc, 0xff, 0x43, 0x79, 0x0c, 0x09, 0x53, 0xba, 0x7a, 0xd7, 0x90, 0x9c, 0x71, 0x55, 0x68, 0x1f, - 0xa0, 0xb1, 0x2e, 0xf8, 0x96, 0x92, 0x7f, 0x60, 0x71, 0xcd, 0x3d, 0x9e, 0x31, 0xa5, 0x77, 0xfc, - 0x9c, 0xf3, 0xe9, 0xd8, 0xf0, 0x63, 0xa1, 0xe1, 0x63, 0x9f, 0x4d, 0x52, 0x15, 0x9a, 0xc8, 0xea, - 0xca, 0x3d, 0xb1, 0xce, 0xff, 0xc3, 0xb3, 0x2a, 0xdc, 0x94, 0xaa, 0xb0, 0x2f, 0x55, 0xf4, 0x50, - 0xaa, 0xe8, 0x50, 0xaa, 0xe8, 0xa9, 0x54, 0xd1, 0xed, 0x8b, 0x2a, 0xfc, 0xfb, 0x72, 0x31, 0xeb, - 0x84, 0xd1, 0x20, 0x30, 0x43, 0x72, 0x6d, 0x27, 0x04, 0x36, 0xcc, 0xf4, 0x68, 0x6c, 0x46, 0x60, - 0x9f, 0x47, 0x75, 0xd7, 0x19, 0x2e, 0x09, 0xfc, 0x5a, 0x5b, 0xb3, 0xd5, 0xdc, 0x72, 0x5a, 0xd7, - 0x17, 0xeb, 0x35, 0x7c, 0x7f, 0x0d, 0x00, 0x00, 0xff, 0xff, 0xef, 0x9f, 0x22, 0x25, 0xd9, 0x01, - 0x00, 0x00, -} - -func (m *SpreadMap) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *SpreadMap) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *SpreadMap) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.NetMap) > 0 { - for iNdEx := len(m.NetMap) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.NetMap[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - if m.Epoch != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.Epoch)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *NodeInfo) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *NodeInfo) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *NodeInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.Status != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.Status)) - i-- - dAtA[i] = 0x20 - } - if len(m.Options) > 0 { - for iNdEx := len(m.Options) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Options[iNdEx]) - copy(dAtA[i:], m.Options[iNdEx]) - i = encodeVarintTypes(dAtA, i, uint64(len(m.Options[iNdEx]))) - i-- - dAtA[i] = 0x1a - } - } - if len(m.PubKey) > 0 { - i -= len(m.PubKey) - copy(dAtA[i:], m.PubKey) - i = encodeVarintTypes(dAtA, i, uint64(len(m.PubKey))) - i-- - dAtA[i] = 0x12 - } - if len(m.Address) > 0 { - i -= len(m.Address) - copy(dAtA[i:], m.Address) - i = encodeVarintTypes(dAtA, i, uint64(len(m.Address))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func encodeVarintTypes(dAtA []byte, offset int, v uint64) int { - offset -= sovTypes(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *SpreadMap) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Epoch != 0 { - n += 1 + sovTypes(uint64(m.Epoch)) - } - if len(m.NetMap) > 0 { - for _, e := range m.NetMap { - l = e.Size() - n += 1 + l + sovTypes(uint64(l)) - } - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *NodeInfo) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Address) - if l > 0 { - n += 1 + l + sovTypes(uint64(l)) - } - l = len(m.PubKey) - if l > 0 { - n += 1 + l + sovTypes(uint64(l)) - } - if len(m.Options) > 0 { - for _, s := range m.Options { - l = len(s) - n += 1 + l + sovTypes(uint64(l)) - } - } - if m.Status != 0 { - n += 1 + sovTypes(uint64(m.Status)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func sovTypes(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozTypes(x uint64) (n int) { - return sovTypes(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *SpreadMap) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: SpreadMap: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: SpreadMap: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Epoch", wireType) - } - m.Epoch = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Epoch |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NetMap", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.NetMap = append(m.NetMap, NodeInfo{}) - if err := m.NetMap[len(m.NetMap)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *NodeInfo) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: NodeInfo: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: NodeInfo: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Address = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PubKey", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.PubKey = append(m.PubKey[:0], dAtA[iNdEx:postIndex]...) - if m.PubKey == nil { - m.PubKey = []byte{} - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Options", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Options = append(m.Options, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) - } - m.Status = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Status |= NodeStatus(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipTypes(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTypes - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTypes - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTypes - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthTypes - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupTypes - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthTypes - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthTypes = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowTypes = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupTypes = fmt.Errorf("proto: unexpected end of group") -) diff --git a/bootstrap/types.proto b/bootstrap/types.proto deleted file mode 100644 index 4ef0fff..0000000 --- a/bootstrap/types.proto +++ /dev/null @@ -1,29 +0,0 @@ -syntax = "proto3"; -package bootstrap; -option go_package = "github.com/nspcc-dev/neofs-api-go/bootstrap"; -option csharp_namespace = "NeoFS.API.Bootstrap"; - -import "github.com/gogo/protobuf/gogoproto/gogo.proto"; - -option (gogoproto.stable_marshaler_all) = true; - -option (gogoproto.stringer_all) = false; -option (gogoproto.goproto_stringer_all) = false; - -message SpreadMap { - // Epoch is current epoch for netmap - uint64 Epoch = 1; - // NetMap is a set of NodeInfos - repeated NodeInfo NetMap = 2 [(gogoproto.nullable) = false]; -} - -message NodeInfo { - // Address is a node [multi-address](https://github.com/multiformats/multiaddr) - string Address = 1 [(gogoproto.jsontag) = "address"]; - // PubKey is a compressed public key representation in bytes - bytes PubKey = 2 [(gogoproto.jsontag) = "pubkey,omitempty"]; - // Options is set of node optional information, such as storage capacity, node location, price and etc - repeated string Options = 3 [(gogoproto.jsontag) = "options,omitempty"]; - // Status is bitmap status of the node - uint64 Status = 4 [(gogoproto.jsontag) = "status", (gogoproto.nullable) = false, (gogoproto.customtype) = "NodeStatus"]; -} diff --git a/bootstrap/types_test.go b/bootstrap/types_test.go deleted file mode 100644 index 20b1b1a..0000000 --- a/bootstrap/types_test.go +++ /dev/null @@ -1,39 +0,0 @@ -package bootstrap - -import ( - "testing" - - "github.com/stretchr/testify/require" -) - -func TestRequestGettersSetters(t *testing.T) { - t.Run("type", func(t *testing.T) { - rt := NodeType(1) - m := new(Request) - - m.SetType(rt) - - require.Equal(t, rt, m.GetType()) - }) - - t.Run("state", func(t *testing.T) { - st := Request_State(1) - m := new(Request) - - m.SetState(st) - - require.Equal(t, st, m.GetState()) - }) - - t.Run("info", func(t *testing.T) { - info := NodeInfo{ - Address: "some address", - } - - m := new(Request) - - m.SetInfo(info) - - require.Equal(t, info, m.GetInfo()) - }) -} diff --git a/chain/address.go b/chain/address.go deleted file mode 100644 index 0a56b8e..0000000 --- a/chain/address.go +++ /dev/null @@ -1,30 +0,0 @@ -package chain - -import ( - "crypto/ecdsa" - - "github.com/nspcc-dev/neo-go/pkg/crypto/keys" -) - -// WalletAddress implements NEO address. -type WalletAddress [AddressLength]byte - -const ( - // AddressLength contains size of address, - // 1 byte of address version + 20 bytes of ScriptHash + 4 bytes of checksum. - AddressLength = 25 -) - -// KeyToAddress returns NEO address composed from public key. -func KeyToAddress(key *ecdsa.PublicKey) string { - if key == nil { - return "" - } - - neoPublicKey := keys.PublicKey{ - X: key.X, - Y: key.Y, - } - - return neoPublicKey.Address() -} diff --git a/chain/address_test.go b/chain/address_test.go deleted file mode 100644 index a998a11..0000000 --- a/chain/address_test.go +++ /dev/null @@ -1,41 +0,0 @@ -package chain - -import ( - "encoding/hex" - "testing" - - crypto "github.com/nspcc-dev/neofs-crypto" - "github.com/stretchr/testify/require" -) - -type addressTestCase struct { - name string - publicKey string - wallet string -} - -func TestKeyToAddress(t *testing.T) { - tests := []addressTestCase{ - { - "nil key", - "", - "", - }, - { - "correct key", - "031a6c6fbbdf02ca351745fa86b9ba5a9452d785ac4f7fc2b7548ca2a46c4fcf4a", - "NgzuJWWGVEwFGsRrgzj8knswEYRJrTe7sm", - }, - } - - for i := range tests { - t.Run(tests[i].name, func(t *testing.T) { - data, err := hex.DecodeString(tests[i].publicKey) - require.NoError(t, err) - - key := crypto.UnmarshalPublicKey(data) - - require.Equal(t, tests[i].wallet, KeyToAddress(key)) - }) - } -} diff --git a/container/service.go b/container/service.go deleted file mode 100644 index 2f36dc1..0000000 --- a/container/service.go +++ /dev/null @@ -1,60 +0,0 @@ -package container - -import ( - "bytes" - "encoding/binary" - - "github.com/nspcc-dev/neofs-api-go/internal" - "github.com/nspcc-dev/neofs-api-go/refs" - "github.com/pkg/errors" -) - -type ( - // CID type alias. - CID = refs.CID - // UUID type alias. - UUID = refs.UUID - // OwnerID type alias. - OwnerID = refs.OwnerID - // MessageID type alias. - MessageID = refs.MessageID -) - -const ( - // ErrNotFound is raised when container could not be found. - ErrNotFound = internal.Error("could not find container") -) - -// PrepareData prepares bytes representation of PutRequest to satisfy SignedRequest interface. -func (m *PutRequest) PrepareData() ([]byte, error) { - var ( - err error - buf = new(bytes.Buffer) - capBytes = make([]byte, 8) - aclBytes = make([]byte, 4) - ) - - binary.BigEndian.PutUint64(capBytes, m.Capacity) - binary.BigEndian.PutUint32(capBytes, m.BasicACL) - - if _, err = buf.Write(m.MessageID.Bytes()); err != nil { - return nil, errors.Wrap(err, "could not write message id") - } else if _, err = buf.Write(capBytes); err != nil { - return nil, errors.Wrap(err, "could not write capacity") - } else if _, err = buf.Write(m.OwnerID.Bytes()); err != nil { - return nil, errors.Wrap(err, "could not write pub") - } else if data, err := m.Rules.Marshal(); err != nil { - return nil, errors.Wrap(err, "could not marshal placement") - } else if _, err = buf.Write(data); err != nil { - return nil, errors.Wrap(err, "could not write placement") - } else if _, err = buf.Write(aclBytes); err != nil { - return nil, errors.Wrap(err, "could not write basic acl") - } - - return buf.Bytes(), nil -} - -// PrepareData prepares bytes representation of DeleteRequest to satisfy SignedRequest interface. -func (m *DeleteRequest) PrepareData() ([]byte, error) { - return m.CID.Bytes(), nil -} diff --git a/container/service.pb.go b/container/service.pb.go deleted file mode 100644 index f49f79f..0000000 --- a/container/service.pb.go +++ /dev/null @@ -1,3733 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: container/service.proto - -package container - -import ( - context "context" - fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/golang/protobuf/proto" - service "github.com/nspcc-dev/neofs-api-go/service" - netmap "github.com/nspcc-dev/netmap" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package - -type PutRequest struct { - // MessageID is a nonce for uniq container id calculation - MessageID MessageID `protobuf:"bytes,1,opt,name=MessageID,proto3,customtype=MessageID" json:"MessageID"` - // Capacity defines amount of data that can be stored in the container (doesn't used for now). - Capacity uint64 `protobuf:"varint,2,opt,name=Capacity,proto3" json:"Capacity,omitempty"` - // OwnerID is a wallet address - OwnerID OwnerID `protobuf:"bytes,3,opt,name=OwnerID,proto3,customtype=OwnerID" json:"OwnerID"` - // Rules define storage policy for the object inside the container. - Rules netmap.PlacementRule `protobuf:"bytes,4,opt,name=rules,proto3" json:"rules"` - // BasicACL of the container. - BasicACL uint32 `protobuf:"varint,5,opt,name=BasicACL,proto3" json:"BasicACL,omitempty"` - // RequestMetaHeader contains information about request meta headers (should be embedded into message) - service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` - // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) - service.RequestVerificationHeader `protobuf:"bytes,99,opt,name=Verify,proto3,embedded=Verify" json:"Verify"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *PutRequest) Reset() { *m = PutRequest{} } -func (m *PutRequest) String() string { return proto.CompactTextString(m) } -func (*PutRequest) ProtoMessage() {} -func (*PutRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_e1fa9d7ab2e7ae06, []int{0} -} -func (m *PutRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *PutRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *PutRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_PutRequest.Merge(m, src) -} -func (m *PutRequest) XXX_Size() int { - return m.Size() -} -func (m *PutRequest) XXX_DiscardUnknown() { - xxx_messageInfo_PutRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_PutRequest proto.InternalMessageInfo - -func (m *PutRequest) GetCapacity() uint64 { - if m != nil { - return m.Capacity - } - return 0 -} - -func (m *PutRequest) GetRules() netmap.PlacementRule { - if m != nil { - return m.Rules - } - return netmap.PlacementRule{} -} - -func (m *PutRequest) GetBasicACL() uint32 { - if m != nil { - return m.BasicACL - } - return 0 -} - -type PutResponse struct { - // CID (container id) is a SHA256 hash of the container structure - CID CID `protobuf:"bytes,1,opt,name=CID,proto3,customtype=CID" json:"CID"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *PutResponse) Reset() { *m = PutResponse{} } -func (m *PutResponse) String() string { return proto.CompactTextString(m) } -func (*PutResponse) ProtoMessage() {} -func (*PutResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_e1fa9d7ab2e7ae06, []int{1} -} -func (m *PutResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *PutResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *PutResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_PutResponse.Merge(m, src) -} -func (m *PutResponse) XXX_Size() int { - return m.Size() -} -func (m *PutResponse) XXX_DiscardUnknown() { - xxx_messageInfo_PutResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_PutResponse proto.InternalMessageInfo - -type DeleteRequest struct { - // CID (container id) is a SHA256 hash of the container structure - CID CID `protobuf:"bytes,1,opt,name=CID,proto3,customtype=CID" json:"CID"` - // RequestMetaHeader contains information about request meta headers (should be embedded into message) - service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` - // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) - service.RequestVerificationHeader `protobuf:"bytes,99,opt,name=Verify,proto3,embedded=Verify" json:"Verify"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *DeleteRequest) Reset() { *m = DeleteRequest{} } -func (m *DeleteRequest) String() string { return proto.CompactTextString(m) } -func (*DeleteRequest) ProtoMessage() {} -func (*DeleteRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_e1fa9d7ab2e7ae06, []int{2} -} -func (m *DeleteRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *DeleteRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *DeleteRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_DeleteRequest.Merge(m, src) -} -func (m *DeleteRequest) XXX_Size() int { - return m.Size() -} -func (m *DeleteRequest) XXX_DiscardUnknown() { - xxx_messageInfo_DeleteRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_DeleteRequest proto.InternalMessageInfo - -// DeleteResponse is empty because delete operation is asynchronous and done -// via consensus in inner ring nodes -type DeleteResponse struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *DeleteResponse) Reset() { *m = DeleteResponse{} } -func (m *DeleteResponse) String() string { return proto.CompactTextString(m) } -func (*DeleteResponse) ProtoMessage() {} -func (*DeleteResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_e1fa9d7ab2e7ae06, []int{3} -} -func (m *DeleteResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *DeleteResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *DeleteResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_DeleteResponse.Merge(m, src) -} -func (m *DeleteResponse) XXX_Size() int { - return m.Size() -} -func (m *DeleteResponse) XXX_DiscardUnknown() { - xxx_messageInfo_DeleteResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_DeleteResponse proto.InternalMessageInfo - -type GetRequest struct { - // CID (container id) is a SHA256 hash of the container structure - CID CID `protobuf:"bytes,1,opt,name=CID,proto3,customtype=CID" json:"CID"` - // RequestMetaHeader contains information about request meta headers (should be embedded into message) - service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` - // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) - service.RequestVerificationHeader `protobuf:"bytes,99,opt,name=Verify,proto3,embedded=Verify" json:"Verify"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GetRequest) Reset() { *m = GetRequest{} } -func (m *GetRequest) String() string { return proto.CompactTextString(m) } -func (*GetRequest) ProtoMessage() {} -func (*GetRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_e1fa9d7ab2e7ae06, []int{4} -} -func (m *GetRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *GetRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *GetRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetRequest.Merge(m, src) -} -func (m *GetRequest) XXX_Size() int { - return m.Size() -} -func (m *GetRequest) XXX_DiscardUnknown() { - xxx_messageInfo_GetRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_GetRequest proto.InternalMessageInfo - -type GetResponse struct { - // Container is a structure that contains placement rules and owner id - Container *Container `protobuf:"bytes,1,opt,name=Container,proto3" json:"Container,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GetResponse) Reset() { *m = GetResponse{} } -func (m *GetResponse) String() string { return proto.CompactTextString(m) } -func (*GetResponse) ProtoMessage() {} -func (*GetResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_e1fa9d7ab2e7ae06, []int{5} -} -func (m *GetResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *GetResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *GetResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetResponse.Merge(m, src) -} -func (m *GetResponse) XXX_Size() int { - return m.Size() -} -func (m *GetResponse) XXX_DiscardUnknown() { - xxx_messageInfo_GetResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_GetResponse proto.InternalMessageInfo - -func (m *GetResponse) GetContainer() *Container { - if m != nil { - return m.Container - } - return nil -} - -type ListRequest struct { - // OwnerID is a wallet address - OwnerID OwnerID `protobuf:"bytes,1,opt,name=OwnerID,proto3,customtype=OwnerID" json:"OwnerID"` - // RequestMetaHeader contains information about request meta headers (should be embedded into message) - service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` - // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) - service.RequestVerificationHeader `protobuf:"bytes,99,opt,name=Verify,proto3,embedded=Verify" json:"Verify"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ListRequest) Reset() { *m = ListRequest{} } -func (m *ListRequest) String() string { return proto.CompactTextString(m) } -func (*ListRequest) ProtoMessage() {} -func (*ListRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_e1fa9d7ab2e7ae06, []int{6} -} -func (m *ListRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ListRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *ListRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_ListRequest.Merge(m, src) -} -func (m *ListRequest) XXX_Size() int { - return m.Size() -} -func (m *ListRequest) XXX_DiscardUnknown() { - xxx_messageInfo_ListRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_ListRequest proto.InternalMessageInfo - -type ListResponse struct { - // CID (container id) is list of SHA256 hashes of the container structures - CID []CID `protobuf:"bytes,1,rep,name=CID,proto3,customtype=CID" json:"CID"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ListResponse) Reset() { *m = ListResponse{} } -func (m *ListResponse) String() string { return proto.CompactTextString(m) } -func (*ListResponse) ProtoMessage() {} -func (*ListResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_e1fa9d7ab2e7ae06, []int{7} -} -func (m *ListResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ListResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *ListResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_ListResponse.Merge(m, src) -} -func (m *ListResponse) XXX_Size() int { - return m.Size() -} -func (m *ListResponse) XXX_DiscardUnknown() { - xxx_messageInfo_ListResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_ListResponse proto.InternalMessageInfo - -type ExtendedACLKey struct { - // ID (container id) is a SHA256 hash of the container structure - ID CID `protobuf:"bytes,1,opt,name=ID,proto3,customtype=CID" json:"ID"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ExtendedACLKey) Reset() { *m = ExtendedACLKey{} } -func (m *ExtendedACLKey) String() string { return proto.CompactTextString(m) } -func (*ExtendedACLKey) ProtoMessage() {} -func (*ExtendedACLKey) Descriptor() ([]byte, []int) { - return fileDescriptor_e1fa9d7ab2e7ae06, []int{8} -} -func (m *ExtendedACLKey) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ExtendedACLKey) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *ExtendedACLKey) XXX_Merge(src proto.Message) { - xxx_messageInfo_ExtendedACLKey.Merge(m, src) -} -func (m *ExtendedACLKey) XXX_Size() int { - return m.Size() -} -func (m *ExtendedACLKey) XXX_DiscardUnknown() { - xxx_messageInfo_ExtendedACLKey.DiscardUnknown(m) -} - -var xxx_messageInfo_ExtendedACLKey proto.InternalMessageInfo - -type ExtendedACLValue struct { - // EACL carries binary representation of the table of extended ACL rules - EACL []byte `protobuf:"bytes,1,opt,name=EACL,proto3" json:"EACL,omitempty"` - // Signature carries EACL field signature - Signature []byte `protobuf:"bytes,2,opt,name=Signature,proto3" json:"Signature,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ExtendedACLValue) Reset() { *m = ExtendedACLValue{} } -func (m *ExtendedACLValue) String() string { return proto.CompactTextString(m) } -func (*ExtendedACLValue) ProtoMessage() {} -func (*ExtendedACLValue) Descriptor() ([]byte, []int) { - return fileDescriptor_e1fa9d7ab2e7ae06, []int{9} -} -func (m *ExtendedACLValue) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ExtendedACLValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *ExtendedACLValue) XXX_Merge(src proto.Message) { - xxx_messageInfo_ExtendedACLValue.Merge(m, src) -} -func (m *ExtendedACLValue) XXX_Size() int { - return m.Size() -} -func (m *ExtendedACLValue) XXX_DiscardUnknown() { - xxx_messageInfo_ExtendedACLValue.DiscardUnknown(m) -} - -var xxx_messageInfo_ExtendedACLValue proto.InternalMessageInfo - -func (m *ExtendedACLValue) GetEACL() []byte { - if m != nil { - return m.EACL - } - return nil -} - -func (m *ExtendedACLValue) GetSignature() []byte { - if m != nil { - return m.Signature - } - return nil -} - -type SetExtendedACLRequest struct { - // Key carries key to extended ACL information - ExtendedACLKey `protobuf:"bytes,1,opt,name=Key,proto3,embedded=Key" json:"Key"` - // Value carries extended ACL information - ExtendedACLValue `protobuf:"bytes,2,opt,name=Value,proto3,embedded=Value" json:"Value"` - // RequestMetaHeader contains information about request meta headers (should be embedded into message) - service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` - // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) - service.RequestVerificationHeader `protobuf:"bytes,99,opt,name=Verify,proto3,embedded=Verify" json:"Verify"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *SetExtendedACLRequest) Reset() { *m = SetExtendedACLRequest{} } -func (m *SetExtendedACLRequest) String() string { return proto.CompactTextString(m) } -func (*SetExtendedACLRequest) ProtoMessage() {} -func (*SetExtendedACLRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_e1fa9d7ab2e7ae06, []int{10} -} -func (m *SetExtendedACLRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *SetExtendedACLRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *SetExtendedACLRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_SetExtendedACLRequest.Merge(m, src) -} -func (m *SetExtendedACLRequest) XXX_Size() int { - return m.Size() -} -func (m *SetExtendedACLRequest) XXX_DiscardUnknown() { - xxx_messageInfo_SetExtendedACLRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_SetExtendedACLRequest proto.InternalMessageInfo - -type SetExtendedACLResponse struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *SetExtendedACLResponse) Reset() { *m = SetExtendedACLResponse{} } -func (m *SetExtendedACLResponse) String() string { return proto.CompactTextString(m) } -func (*SetExtendedACLResponse) ProtoMessage() {} -func (*SetExtendedACLResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_e1fa9d7ab2e7ae06, []int{11} -} -func (m *SetExtendedACLResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *SetExtendedACLResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *SetExtendedACLResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_SetExtendedACLResponse.Merge(m, src) -} -func (m *SetExtendedACLResponse) XXX_Size() int { - return m.Size() -} -func (m *SetExtendedACLResponse) XXX_DiscardUnknown() { - xxx_messageInfo_SetExtendedACLResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_SetExtendedACLResponse proto.InternalMessageInfo - -type GetExtendedACLRequest struct { - // Key carries key to extended ACL information - ExtendedACLKey `protobuf:"bytes,1,opt,name=Key,proto3,embedded=Key" json:"Key"` - // RequestMetaHeader contains information about request meta headers (should be embedded into message) - service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` - // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) - service.RequestVerificationHeader `protobuf:"bytes,99,opt,name=Verify,proto3,embedded=Verify" json:"Verify"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GetExtendedACLRequest) Reset() { *m = GetExtendedACLRequest{} } -func (m *GetExtendedACLRequest) String() string { return proto.CompactTextString(m) } -func (*GetExtendedACLRequest) ProtoMessage() {} -func (*GetExtendedACLRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_e1fa9d7ab2e7ae06, []int{12} -} -func (m *GetExtendedACLRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *GetExtendedACLRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *GetExtendedACLRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetExtendedACLRequest.Merge(m, src) -} -func (m *GetExtendedACLRequest) XXX_Size() int { - return m.Size() -} -func (m *GetExtendedACLRequest) XXX_DiscardUnknown() { - xxx_messageInfo_GetExtendedACLRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_GetExtendedACLRequest proto.InternalMessageInfo - -type GetExtendedACLResponse struct { - // ACL carries extended ACL information - ExtendedACLValue `protobuf:"bytes,1,opt,name=ACL,proto3,embedded=ACL" json:"ACL"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GetExtendedACLResponse) Reset() { *m = GetExtendedACLResponse{} } -func (m *GetExtendedACLResponse) String() string { return proto.CompactTextString(m) } -func (*GetExtendedACLResponse) ProtoMessage() {} -func (*GetExtendedACLResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_e1fa9d7ab2e7ae06, []int{13} -} -func (m *GetExtendedACLResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *GetExtendedACLResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *GetExtendedACLResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetExtendedACLResponse.Merge(m, src) -} -func (m *GetExtendedACLResponse) XXX_Size() int { - return m.Size() -} -func (m *GetExtendedACLResponse) XXX_DiscardUnknown() { - xxx_messageInfo_GetExtendedACLResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_GetExtendedACLResponse proto.InternalMessageInfo - -func init() { - proto.RegisterType((*PutRequest)(nil), "container.PutRequest") - proto.RegisterType((*PutResponse)(nil), "container.PutResponse") - proto.RegisterType((*DeleteRequest)(nil), "container.DeleteRequest") - proto.RegisterType((*DeleteResponse)(nil), "container.DeleteResponse") - proto.RegisterType((*GetRequest)(nil), "container.GetRequest") - proto.RegisterType((*GetResponse)(nil), "container.GetResponse") - proto.RegisterType((*ListRequest)(nil), "container.ListRequest") - proto.RegisterType((*ListResponse)(nil), "container.ListResponse") - proto.RegisterType((*ExtendedACLKey)(nil), "container.ExtendedACLKey") - proto.RegisterType((*ExtendedACLValue)(nil), "container.ExtendedACLValue") - proto.RegisterType((*SetExtendedACLRequest)(nil), "container.SetExtendedACLRequest") - proto.RegisterType((*SetExtendedACLResponse)(nil), "container.SetExtendedACLResponse") - proto.RegisterType((*GetExtendedACLRequest)(nil), "container.GetExtendedACLRequest") - proto.RegisterType((*GetExtendedACLResponse)(nil), "container.GetExtendedACLResponse") -} - -func init() { proto.RegisterFile("container/service.proto", fileDescriptor_e1fa9d7ab2e7ae06) } - -var fileDescriptor_e1fa9d7ab2e7ae06 = []byte{ - // 773 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x56, 0xcb, 0x6e, 0xdb, 0x46, - 0x14, 0x35, 0x45, 0xf9, 0xa1, 0x2b, 0xdb, 0x75, 0xa7, 0x96, 0x4d, 0xd3, 0xad, 0xac, 0x72, 0xa5, - 0x3e, 0x44, 0xa2, 0xaa, 0x0b, 0x17, 0x28, 0xba, 0xd0, 0xc3, 0x55, 0x05, 0xdb, 0xad, 0x4a, 0xa1, - 0x0e, 0x90, 0x1d, 0x45, 0x5d, 0x2b, 0x04, 0x24, 0x52, 0x21, 0x87, 0x4e, 0xf4, 0x0d, 0xf9, 0x81, - 0x00, 0xf9, 0x83, 0x04, 0xc8, 0x3a, 0x9f, 0xe0, 0x55, 0x60, 0x20, 0x9b, 0x20, 0x0b, 0x23, 0x50, - 0x7e, 0x24, 0xe0, 0xf0, 0x29, 0x59, 0xb6, 0xb3, 0x08, 0x20, 0x64, 0x23, 0xcc, 0xdc, 0x7b, 0xcf, - 0x99, 0xfb, 0x16, 0x61, 0x5b, 0xb7, 0x4c, 0xaa, 0x19, 0x26, 0xda, 0x8a, 0x83, 0xf6, 0xb9, 0xa1, - 0xa3, 0x3c, 0xb4, 0x2d, 0x6a, 0x91, 0x4c, 0xa4, 0x10, 0x49, 0xa0, 0x51, 0x06, 0x48, 0x35, 0x5f, - 0x2d, 0x6e, 0x86, 0xb2, 0x73, 0xb4, 0x8d, 0xb3, 0x51, 0x20, 0xcd, 0xc5, 0x6c, 0x74, 0x34, 0x44, - 0x27, 0x10, 0xff, 0xd8, 0x33, 0xe8, 0x03, 0xb7, 0x23, 0xeb, 0xd6, 0x40, 0x31, 0x9d, 0xa1, 0xae, - 0x97, 0xba, 0x78, 0xae, 0x98, 0x48, 0x07, 0xda, 0x50, 0x71, 0xb0, 0x8f, 0x3a, 0xb5, 0xec, 0xc0, - 0xb6, 0x94, 0xb0, 0xed, 0x59, 0x3d, 0x4b, 0x61, 0xe2, 0x8e, 0x7b, 0xc6, 0x6e, 0xec, 0xc2, 0x4e, - 0xbe, 0xb9, 0xf4, 0x26, 0x05, 0xd0, 0x72, 0xa9, 0x8a, 0x0f, 0x5d, 0x74, 0x28, 0x51, 0x20, 0x73, - 0x82, 0x8e, 0xa3, 0xf5, 0xb0, 0x59, 0x17, 0xb8, 0x02, 0x57, 0x5c, 0xad, 0x7e, 0x7d, 0x71, 0xb5, - 0xb7, 0xf0, 0xee, 0x6a, 0x2f, 0x56, 0xa8, 0xf1, 0x91, 0x88, 0xb0, 0x52, 0xd3, 0x86, 0x9a, 0x6e, - 0xd0, 0x91, 0x90, 0x2a, 0x70, 0xc5, 0xb4, 0x1a, 0xdd, 0xc9, 0x0f, 0xb0, 0xfc, 0xef, 0x23, 0x13, - 0xed, 0x66, 0x5d, 0xe0, 0x19, 0xd5, 0x57, 0x01, 0x55, 0x28, 0x56, 0xc3, 0x03, 0xf9, 0x05, 0x16, - 0x6d, 0xb7, 0x8f, 0x8e, 0x90, 0x2e, 0x70, 0xc5, 0x6c, 0x39, 0x27, 0xfb, 0xc1, 0xc9, 0xad, 0xbe, - 0xa6, 0xe3, 0x00, 0x4d, 0xaa, 0xba, 0x7d, 0xac, 0xa6, 0x3d, 0xbc, 0xea, 0x5b, 0x7a, 0x2f, 0x57, - 0x35, 0xc7, 0xd0, 0x2b, 0xb5, 0x63, 0x61, 0xb1, 0xc0, 0x15, 0xd7, 0xd4, 0xe8, 0x4e, 0x7e, 0x87, - 0xf4, 0x09, 0x52, 0x4d, 0xe8, 0x30, 0x36, 0x51, 0x0e, 0x4b, 0x13, 0x84, 0xe9, 0xe9, 0xfe, 0x46, - 0xad, 0x8b, 0x76, 0x75, 0xc5, 0xa3, 0xbc, 0xbc, 0xda, 0xe3, 0x54, 0x86, 0x20, 0x75, 0x58, 0x3a, - 0x65, 0x15, 0x11, 0x74, 0x86, 0x95, 0xa6, 0xb1, 0x4c, 0x6b, 0xe8, 0x1a, 0x35, 0x2c, 0xf3, 0x1a, - 0x47, 0x80, 0x95, 0x7e, 0x86, 0x2c, 0x4b, 0xaa, 0x33, 0xb4, 0x4c, 0x07, 0xc9, 0x77, 0xc0, 0xd7, - 0xa2, 0x7c, 0x66, 0x83, 0x24, 0x78, 0x22, 0xd5, 0xfb, 0x91, 0x5e, 0x72, 0xb0, 0x56, 0xc7, 0x3e, - 0x52, 0x0c, 0xcb, 0x70, 0x3b, 0x60, 0xee, 0xe1, 0x6d, 0xc0, 0x7a, 0xe8, 0xaf, 0x1f, 0xa1, 0xf4, - 0x82, 0x03, 0x68, 0x20, 0xfd, 0x42, 0xfc, 0xaf, 0x40, 0x96, 0x39, 0x1b, 0x94, 0xa7, 0x0c, 0x99, - 0x5a, 0x38, 0x77, 0xcc, 0xe7, 0x6c, 0x79, 0x53, 0x8e, 0x26, 0x51, 0x8e, 0x74, 0x6a, 0x6c, 0x26, - 0xbd, 0xe2, 0x20, 0x7b, 0x6c, 0x38, 0x51, 0xc4, 0x89, 0x5e, 0xe7, 0xee, 0xe8, 0xf5, 0x79, 0x47, - 0x5f, 0x82, 0x55, 0xdf, 0xf3, 0xe9, 0xee, 0xe4, 0x67, 0x76, 0x67, 0x09, 0xd6, 0x0f, 0x1f, 0x53, - 0x34, 0xbb, 0xd8, 0xad, 0xd4, 0x8e, 0x8f, 0x70, 0x44, 0x76, 0x21, 0x35, 0xbb, 0xb8, 0xa9, 0x66, - 0x5d, 0xaa, 0xc3, 0x46, 0xc2, 0xfc, 0x54, 0xeb, 0xbb, 0x48, 0x08, 0xa4, 0x0f, 0xbd, 0x31, 0x65, - 0x10, 0x95, 0x9d, 0xc9, 0xb7, 0x90, 0x69, 0x1b, 0x3d, 0x53, 0xa3, 0xae, 0x8d, 0x6c, 0x73, 0xac, - 0xaa, 0xb1, 0x40, 0x7a, 0x92, 0x82, 0x5c, 0x1b, 0x69, 0x82, 0x29, 0x4c, 0xf4, 0x6f, 0xc0, 0x1f, - 0xe1, 0x28, 0x28, 0xd3, 0x4e, 0xa2, 0x4c, 0x93, 0x4e, 0x26, 0xe2, 0xf6, 0xec, 0xc9, 0x1f, 0xb0, - 0xc8, 0x7c, 0x61, 0x4f, 0x65, 0xcb, 0xbb, 0xb3, 0x81, 0xcc, 0x24, 0x01, 0xf5, 0x31, 0x73, 0xaf, - 0x98, 0x00, 0x5b, 0xd3, 0xc9, 0x08, 0xe6, 0xee, 0x35, 0x07, 0xb9, 0xc6, 0xe7, 0xcc, 0xd3, 0xbc, - 0x43, 0xfd, 0x0f, 0xb6, 0x1a, 0x33, 0x43, 0x25, 0x07, 0xc0, 0x87, 0x3d, 0xf4, 0xc9, 0xf5, 0xf3, - 0x10, 0xe5, 0x67, 0x3c, 0x2c, 0xb7, 0x7d, 0x57, 0xc8, 0x3e, 0xf0, 0x2d, 0x97, 0x92, 0x5c, 0x02, - 0x1e, 0xff, 0xfb, 0x89, 0x5b, 0xd3, 0xe2, 0xe0, 0xe9, 0x3f, 0x61, 0xc9, 0xdf, 0x77, 0x44, 0x48, - 0x58, 0x4c, 0xac, 0x6c, 0x71, 0x67, 0x86, 0x26, 0x80, 0xef, 0x03, 0xdf, 0xc0, 0xc9, 0x47, 0xe3, - 0x5d, 0x39, 0xf1, 0x68, 0x72, 0x2b, 0x1d, 0x40, 0xda, 0x1b, 0x53, 0x92, 0xd4, 0x27, 0x36, 0x8e, - 0xb8, 0x7d, 0x4d, 0x1e, 0x00, 0xff, 0x87, 0xf5, 0xc9, 0x6e, 0x21, 0x85, 0x84, 0xe9, 0xcc, 0xa9, - 0x12, 0xbf, 0xbf, 0xc5, 0x22, 0xa6, 0x6d, 0xdc, 0x4c, 0xdb, 0xb8, 0x93, 0x76, 0x76, 0x59, 0xab, - 0xf7, 0x2e, 0xc6, 0x79, 0xee, 0x72, 0x9c, 0xe7, 0xde, 0x8e, 0xf3, 0xdc, 0xfb, 0x71, 0x9e, 0x7b, - 0xfa, 0x21, 0xbf, 0x70, 0xff, 0xa7, 0x1b, 0xbe, 0x78, 0xac, 0x33, 0xa7, 0xa4, 0x0d, 0x8d, 0x52, - 0xcf, 0x52, 0x22, 0xe6, 0xe7, 0xa9, 0x6f, 0xfe, 0x41, 0xeb, 0xaf, 0xb6, 0x5c, 0x69, 0x35, 0xe3, - 0x65, 0xdd, 0x59, 0x62, 0x1f, 0x38, 0xbf, 0x7e, 0x0c, 0x00, 0x00, 0xff, 0xff, 0x16, 0xc1, 0x2d, - 0xa9, 0xa2, 0x09, 0x00, 0x00, -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 - -// ServiceClient is the client API for Service service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type ServiceClient interface { - // Put request proposes container to the inner ring nodes. They will - // accept new container if user has enough deposit. All containers - // are accepted by the consensus, therefore it is asynchronous process. - Put(ctx context.Context, in *PutRequest, opts ...grpc.CallOption) (*PutResponse, error) - // Delete container removes it from the inner ring container storage. It - // also asynchronous process done by consensus. - Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteResponse, error) - // Get container returns container instance - Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*GetResponse, error) - // List returns all user's containers - List(ctx context.Context, in *ListRequest, opts ...grpc.CallOption) (*ListResponse, error) - // SetExtendedACL changes extended ACL rules of the container - SetExtendedACL(ctx context.Context, in *SetExtendedACLRequest, opts ...grpc.CallOption) (*SetExtendedACLResponse, error) - // GetExtendedACL returns extended ACL rules of the container - GetExtendedACL(ctx context.Context, in *GetExtendedACLRequest, opts ...grpc.CallOption) (*GetExtendedACLResponse, error) -} - -type serviceClient struct { - cc *grpc.ClientConn -} - -func NewServiceClient(cc *grpc.ClientConn) ServiceClient { - return &serviceClient{cc} -} - -func (c *serviceClient) Put(ctx context.Context, in *PutRequest, opts ...grpc.CallOption) (*PutResponse, error) { - out := new(PutResponse) - err := c.cc.Invoke(ctx, "/container.Service/Put", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteResponse, error) { - out := new(DeleteResponse) - err := c.cc.Invoke(ctx, "/container.Service/Delete", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*GetResponse, error) { - out := new(GetResponse) - err := c.cc.Invoke(ctx, "/container.Service/Get", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) List(ctx context.Context, in *ListRequest, opts ...grpc.CallOption) (*ListResponse, error) { - out := new(ListResponse) - err := c.cc.Invoke(ctx, "/container.Service/List", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) SetExtendedACL(ctx context.Context, in *SetExtendedACLRequest, opts ...grpc.CallOption) (*SetExtendedACLResponse, error) { - out := new(SetExtendedACLResponse) - err := c.cc.Invoke(ctx, "/container.Service/SetExtendedACL", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) GetExtendedACL(ctx context.Context, in *GetExtendedACLRequest, opts ...grpc.CallOption) (*GetExtendedACLResponse, error) { - out := new(GetExtendedACLResponse) - err := c.cc.Invoke(ctx, "/container.Service/GetExtendedACL", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// ServiceServer is the server API for Service service. -type ServiceServer interface { - // Put request proposes container to the inner ring nodes. They will - // accept new container if user has enough deposit. All containers - // are accepted by the consensus, therefore it is asynchronous process. - Put(context.Context, *PutRequest) (*PutResponse, error) - // Delete container removes it from the inner ring container storage. It - // also asynchronous process done by consensus. - Delete(context.Context, *DeleteRequest) (*DeleteResponse, error) - // Get container returns container instance - Get(context.Context, *GetRequest) (*GetResponse, error) - // List returns all user's containers - List(context.Context, *ListRequest) (*ListResponse, error) - // SetExtendedACL changes extended ACL rules of the container - SetExtendedACL(context.Context, *SetExtendedACLRequest) (*SetExtendedACLResponse, error) - // GetExtendedACL returns extended ACL rules of the container - GetExtendedACL(context.Context, *GetExtendedACLRequest) (*GetExtendedACLResponse, error) -} - -// UnimplementedServiceServer can be embedded to have forward compatible implementations. -type UnimplementedServiceServer struct { -} - -func (*UnimplementedServiceServer) Put(ctx context.Context, req *PutRequest) (*PutResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Put not implemented") -} -func (*UnimplementedServiceServer) Delete(ctx context.Context, req *DeleteRequest) (*DeleteResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Delete not implemented") -} -func (*UnimplementedServiceServer) Get(ctx context.Context, req *GetRequest) (*GetResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Get not implemented") -} -func (*UnimplementedServiceServer) List(ctx context.Context, req *ListRequest) (*ListResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method List not implemented") -} -func (*UnimplementedServiceServer) SetExtendedACL(ctx context.Context, req *SetExtendedACLRequest) (*SetExtendedACLResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method SetExtendedACL not implemented") -} -func (*UnimplementedServiceServer) GetExtendedACL(ctx context.Context, req *GetExtendedACLRequest) (*GetExtendedACLResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetExtendedACL not implemented") -} - -func RegisterServiceServer(s *grpc.Server, srv ServiceServer) { - s.RegisterService(&_Service_serviceDesc, srv) -} - -func _Service_Put_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(PutRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ServiceServer).Put(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/container.Service/Put", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ServiceServer).Put(ctx, req.(*PutRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Service_Delete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(DeleteRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ServiceServer).Delete(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/container.Service/Delete", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ServiceServer).Delete(ctx, req.(*DeleteRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Service_Get_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ServiceServer).Get(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/container.Service/Get", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ServiceServer).Get(ctx, req.(*GetRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Service_List_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ListRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ServiceServer).List(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/container.Service/List", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ServiceServer).List(ctx, req.(*ListRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Service_SetExtendedACL_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(SetExtendedACLRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ServiceServer).SetExtendedACL(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/container.Service/SetExtendedACL", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ServiceServer).SetExtendedACL(ctx, req.(*SetExtendedACLRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Service_GetExtendedACL_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetExtendedACLRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ServiceServer).GetExtendedACL(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/container.Service/GetExtendedACL", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ServiceServer).GetExtendedACL(ctx, req.(*GetExtendedACLRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _Service_serviceDesc = grpc.ServiceDesc{ - ServiceName: "container.Service", - HandlerType: (*ServiceServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Put", - Handler: _Service_Put_Handler, - }, - { - MethodName: "Delete", - Handler: _Service_Delete_Handler, - }, - { - MethodName: "Get", - Handler: _Service_Get_Handler, - }, - { - MethodName: "List", - Handler: _Service_List_Handler, - }, - { - MethodName: "SetExtendedACL", - Handler: _Service_SetExtendedACL_Handler, - }, - { - MethodName: "GetExtendedACL", - Handler: _Service_GetExtendedACL_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "container/service.proto", -} - -func (m *PutRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *PutRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *PutRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - { - size, err := m.RequestVerificationHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x6 - i-- - dAtA[i] = 0x9a - { - size, err := m.RequestMetaHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x6 - i-- - dAtA[i] = 0x92 - if m.BasicACL != 0 { - i = encodeVarintService(dAtA, i, uint64(m.BasicACL)) - i-- - dAtA[i] = 0x28 - } - { - size, err := m.Rules.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - { - size := m.OwnerID.Size() - i -= size - if _, err := m.OwnerID.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - if m.Capacity != 0 { - i = encodeVarintService(dAtA, i, uint64(m.Capacity)) - i-- - dAtA[i] = 0x10 - } - { - size := m.MessageID.Size() - i -= size - if _, err := m.MessageID.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *PutResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *PutResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *PutResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - { - size := m.CID.Size() - i -= size - if _, err := m.CID.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *DeleteRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *DeleteRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *DeleteRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - { - size, err := m.RequestVerificationHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x6 - i-- - dAtA[i] = 0x9a - { - size, err := m.RequestMetaHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x6 - i-- - dAtA[i] = 0x92 - { - size := m.CID.Size() - i -= size - if _, err := m.CID.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *DeleteResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *DeleteResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *DeleteResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - return len(dAtA) - i, nil -} - -func (m *GetRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *GetRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *GetRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - { - size, err := m.RequestVerificationHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x6 - i-- - dAtA[i] = 0x9a - { - size, err := m.RequestMetaHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x6 - i-- - dAtA[i] = 0x92 - { - size := m.CID.Size() - i -= size - if _, err := m.CID.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *GetResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *GetResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *GetResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.Container != nil { - { - size, err := m.Container.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *ListRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ListRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ListRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - { - size, err := m.RequestVerificationHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x6 - i-- - dAtA[i] = 0x9a - { - size, err := m.RequestMetaHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x6 - i-- - dAtA[i] = 0x92 - { - size := m.OwnerID.Size() - i -= size - if _, err := m.OwnerID.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *ListResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ListResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ListResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.CID) > 0 { - for iNdEx := len(m.CID) - 1; iNdEx >= 0; iNdEx-- { - { - size := m.CID[iNdEx].Size() - i -= size - if _, err := m.CID[iNdEx].MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *ExtendedACLKey) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ExtendedACLKey) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ExtendedACLKey) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - { - size := m.ID.Size() - i -= size - if _, err := m.ID.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *ExtendedACLValue) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ExtendedACLValue) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ExtendedACLValue) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.Signature) > 0 { - i -= len(m.Signature) - copy(dAtA[i:], m.Signature) - i = encodeVarintService(dAtA, i, uint64(len(m.Signature))) - i-- - dAtA[i] = 0x12 - } - if len(m.EACL) > 0 { - i -= len(m.EACL) - copy(dAtA[i:], m.EACL) - i = encodeVarintService(dAtA, i, uint64(len(m.EACL))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *SetExtendedACLRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *SetExtendedACLRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *SetExtendedACLRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - { - size, err := m.RequestVerificationHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x6 - i-- - dAtA[i] = 0x9a - { - size, err := m.RequestMetaHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x6 - i-- - dAtA[i] = 0x92 - { - size, err := m.ExtendedACLValue.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size, err := m.ExtendedACLKey.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *SetExtendedACLResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *SetExtendedACLResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *SetExtendedACLResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - return len(dAtA) - i, nil -} - -func (m *GetExtendedACLRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *GetExtendedACLRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *GetExtendedACLRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - { - size, err := m.RequestVerificationHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x6 - i-- - dAtA[i] = 0x9a - { - size, err := m.RequestMetaHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x6 - i-- - dAtA[i] = 0x92 - { - size, err := m.ExtendedACLKey.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *GetExtendedACLResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *GetExtendedACLResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *GetExtendedACLResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - { - size, err := m.ExtendedACLValue.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func encodeVarintService(dAtA []byte, offset int, v uint64) int { - offset -= sovService(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *PutRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.MessageID.Size() - n += 1 + l + sovService(uint64(l)) - if m.Capacity != 0 { - n += 1 + sovService(uint64(m.Capacity)) - } - l = m.OwnerID.Size() - n += 1 + l + sovService(uint64(l)) - l = m.Rules.Size() - n += 1 + l + sovService(uint64(l)) - if m.BasicACL != 0 { - n += 1 + sovService(uint64(m.BasicACL)) - } - l = m.RequestMetaHeader.Size() - n += 2 + l + sovService(uint64(l)) - l = m.RequestVerificationHeader.Size() - n += 2 + l + sovService(uint64(l)) - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *PutResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.CID.Size() - n += 1 + l + sovService(uint64(l)) - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *DeleteRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.CID.Size() - n += 1 + l + sovService(uint64(l)) - l = m.RequestMetaHeader.Size() - n += 2 + l + sovService(uint64(l)) - l = m.RequestVerificationHeader.Size() - n += 2 + l + sovService(uint64(l)) - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *DeleteResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *GetRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.CID.Size() - n += 1 + l + sovService(uint64(l)) - l = m.RequestMetaHeader.Size() - n += 2 + l + sovService(uint64(l)) - l = m.RequestVerificationHeader.Size() - n += 2 + l + sovService(uint64(l)) - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *GetResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Container != nil { - l = m.Container.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *ListRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.OwnerID.Size() - n += 1 + l + sovService(uint64(l)) - l = m.RequestMetaHeader.Size() - n += 2 + l + sovService(uint64(l)) - l = m.RequestVerificationHeader.Size() - n += 2 + l + sovService(uint64(l)) - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *ListResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.CID) > 0 { - for _, e := range m.CID { - l = e.Size() - n += 1 + l + sovService(uint64(l)) - } - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *ExtendedACLKey) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ID.Size() - n += 1 + l + sovService(uint64(l)) - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *ExtendedACLValue) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.EACL) - if l > 0 { - n += 1 + l + sovService(uint64(l)) - } - l = len(m.Signature) - if l > 0 { - n += 1 + l + sovService(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *SetExtendedACLRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ExtendedACLKey.Size() - n += 1 + l + sovService(uint64(l)) - l = m.ExtendedACLValue.Size() - n += 1 + l + sovService(uint64(l)) - l = m.RequestMetaHeader.Size() - n += 2 + l + sovService(uint64(l)) - l = m.RequestVerificationHeader.Size() - n += 2 + l + sovService(uint64(l)) - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *SetExtendedACLResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *GetExtendedACLRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ExtendedACLKey.Size() - n += 1 + l + sovService(uint64(l)) - l = m.RequestMetaHeader.Size() - n += 2 + l + sovService(uint64(l)) - l = m.RequestVerificationHeader.Size() - n += 2 + l + sovService(uint64(l)) - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *GetExtendedACLResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ExtendedACLValue.Size() - n += 1 + l + sovService(uint64(l)) - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func sovService(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozService(x uint64) (n int) { - return sovService(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *PutRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: PutRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: PutRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MessageID", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.MessageID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Capacity", wireType) - } - m.Capacity = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Capacity |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OwnerID", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.OwnerID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Rules", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Rules.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field BasicACL", wireType) - } - m.BasicACL = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.BasicACL |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 98: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.RequestMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 99: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RequestVerificationHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.RequestVerificationHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *PutResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: PutResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: PutResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CID", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.CID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *DeleteRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: DeleteRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: DeleteRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CID", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.CID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 98: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.RequestMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 99: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RequestVerificationHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.RequestVerificationHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *DeleteResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: DeleteResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: DeleteResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *GetRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: GetRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GetRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CID", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.CID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 98: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.RequestMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 99: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RequestVerificationHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.RequestVerificationHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *GetResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: GetResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GetResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Container", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Container == nil { - m.Container = &Container{} - } - if err := m.Container.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ListRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ListRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ListRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OwnerID", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.OwnerID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 98: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.RequestMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 99: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RequestVerificationHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.RequestVerificationHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ListResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ListResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ListResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CID", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - var v CID - m.CID = append(m.CID, v) - if err := m.CID[len(m.CID)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ExtendedACLKey) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ExtendedACLKey: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ExtendedACLKey: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ExtendedACLValue) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ExtendedACLValue: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ExtendedACLValue: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field EACL", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.EACL = append(m.EACL[:0], dAtA[iNdEx:postIndex]...) - if m.EACL == nil { - m.EACL = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Signature", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Signature = append(m.Signature[:0], dAtA[iNdEx:postIndex]...) - if m.Signature == nil { - m.Signature = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *SetExtendedACLRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: SetExtendedACLRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: SetExtendedACLRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ExtendedACLKey", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ExtendedACLKey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ExtendedACLValue", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ExtendedACLValue.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 98: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.RequestMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 99: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RequestVerificationHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.RequestVerificationHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *SetExtendedACLResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: SetExtendedACLResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: SetExtendedACLResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *GetExtendedACLRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: GetExtendedACLRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GetExtendedACLRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ExtendedACLKey", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ExtendedACLKey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 98: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.RequestMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 99: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RequestVerificationHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.RequestVerificationHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *GetExtendedACLResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: GetExtendedACLResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GetExtendedACLResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ExtendedACLValue", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ExtendedACLValue.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipService(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowService - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowService - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowService - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthService - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupService - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthService - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthService = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowService = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupService = fmt.Errorf("proto: unexpected end of group") -) diff --git a/container/service.proto b/container/service.proto deleted file mode 100644 index b174052..0000000 --- a/container/service.proto +++ /dev/null @@ -1,146 +0,0 @@ -syntax = "proto3"; -package container; -option go_package = "github.com/nspcc-dev/neofs-api-go/container"; -option csharp_namespace = "NeoFS.API.Container"; - -import "service/meta.proto"; -import "service/verify.proto"; -import "container/types.proto"; -import "github.com/nspcc-dev/netmap/selector.proto"; -import "github.com/gogo/protobuf/gogoproto/gogo.proto"; - -option (gogoproto.stable_marshaler_all) = true; - -// Container service provides API for manipulating with the container. -service Service { - // Put request proposes container to the inner ring nodes. They will - // accept new container if user has enough deposit. All containers - // are accepted by the consensus, therefore it is asynchronous process. - rpc Put(PutRequest) returns (PutResponse); - - // Delete container removes it from the inner ring container storage. It - // also asynchronous process done by consensus. - rpc Delete(DeleteRequest) returns (DeleteResponse); - - // Get container returns container instance - rpc Get(GetRequest) returns (GetResponse); - - // List returns all user's containers - rpc List(ListRequest) returns (ListResponse); - - // SetExtendedACL changes extended ACL rules of the container - rpc SetExtendedACL(SetExtendedACLRequest) returns (SetExtendedACLResponse); - - // GetExtendedACL returns extended ACL rules of the container - rpc GetExtendedACL(GetExtendedACLRequest) returns (GetExtendedACLResponse); -} - -message PutRequest { - // MessageID is a nonce for uniq container id calculation - bytes MessageID = 1 [(gogoproto.customtype) = "MessageID", (gogoproto.nullable) = false]; - - // Capacity defines amount of data that can be stored in the container (doesn't used for now). - uint64 Capacity = 2; - - // OwnerID is a wallet address - bytes OwnerID = 3 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false]; - - // Rules define storage policy for the object inside the container. - netmap.PlacementRule rules = 4 [(gogoproto.nullable) = false]; - - // BasicACL of the container. - uint32 BasicACL = 5; - - // RequestMetaHeader contains information about request meta headers (should be embedded into message) - service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; - // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) - service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; -} - -message PutResponse { - // CID (container id) is a SHA256 hash of the container structure - bytes CID = 1 [(gogoproto.customtype) = "CID", (gogoproto.nullable) = false]; -} - -message DeleteRequest { - // CID (container id) is a SHA256 hash of the container structure - bytes CID = 1 [(gogoproto.customtype) = "CID", (gogoproto.nullable) = false]; - - // RequestMetaHeader contains information about request meta headers (should be embedded into message) - service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; - // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) - service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; -} - -// DeleteResponse is empty because delete operation is asynchronous and done -// via consensus in inner ring nodes -message DeleteResponse { } - - -message GetRequest { - // CID (container id) is a SHA256 hash of the container structure - bytes CID = 1 [(gogoproto.customtype) = "CID", (gogoproto.nullable) = false]; - - // RequestMetaHeader contains information about request meta headers (should be embedded into message) - service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; - // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) - service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; -} - -message GetResponse { - // Container is a structure that contains placement rules and owner id - container.Container Container = 1; -} - -message ListRequest { - // OwnerID is a wallet address - bytes OwnerID = 1 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false]; - // RequestMetaHeader contains information about request meta headers (should be embedded into message) - service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; - // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) - service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; -} - -message ListResponse { - // CID (container id) is list of SHA256 hashes of the container structures - repeated bytes CID = 1 [(gogoproto.customtype) = "CID", (gogoproto.nullable) = false]; -} - -message ExtendedACLKey { - // ID (container id) is a SHA256 hash of the container structure - bytes ID = 1 [(gogoproto.customtype) = "CID", (gogoproto.nullable) = false]; -} - -message ExtendedACLValue { - // EACL carries binary representation of the table of extended ACL rules - bytes EACL = 1; - // Signature carries EACL field signature - bytes Signature = 2; -} - -message SetExtendedACLRequest { - // Key carries key to extended ACL information - ExtendedACLKey Key = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; - // Value carries extended ACL information - ExtendedACLValue Value = 2 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; - // RequestMetaHeader contains information about request meta headers (should be embedded into message) - service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; - // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) - service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; -} - -message SetExtendedACLResponse {} - -message GetExtendedACLRequest { - // Key carries key to extended ACL information - ExtendedACLKey Key = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; - // RequestMetaHeader contains information about request meta headers (should be embedded into message) - service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; - // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) - service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; -} - -message GetExtendedACLResponse { - // ACL carries extended ACL information - ExtendedACLValue ACL = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; -} diff --git a/container/sign.go b/container/sign.go deleted file mode 100644 index f538f2d..0000000 --- a/container/sign.go +++ /dev/null @@ -1,194 +0,0 @@ -package container - -import ( - "encoding/binary" - "io" - - service "github.com/nspcc-dev/neofs-api-go/service" -) - -var requestEndianness = binary.BigEndian - -// SignedData returns payload bytes of the request. -func (m PutRequest) SignedData() ([]byte, error) { - return service.SignedDataFromReader(m) -} - -// SignedDataSize returns payload size of the request. -func (m PutRequest) SignedDataSize() (sz int) { - sz += m.GetMessageID().Size() - - sz += 8 - - sz += m.GetOwnerID().Size() - - rules := m.GetRules() - sz += rules.Size() - - sz += 4 - - return -} - -// ReadSignedData copies payload bytes to passed buffer. -// -// If the Request size is insufficient, io.ErrUnexpectedEOF returns. -func (m PutRequest) ReadSignedData(p []byte) (int, error) { - if len(p) < m.SignedDataSize() { - return 0, io.ErrUnexpectedEOF - } - - var off int - - off += copy(p[off:], m.GetMessageID().Bytes()) - - requestEndianness.PutUint64(p[off:], m.GetCapacity()) - off += 8 - - off += copy(p[off:], m.GetOwnerID().Bytes()) - - rules := m.GetRules() - // FIXME: implement and use stable functions - n, err := rules.MarshalTo(p[off:]) - off += n - if err != nil { - return off, err - } - - requestEndianness.PutUint32(p[off:], m.GetBasicACL()) - off += 4 - - return off, nil -} - -// SignedData returns payload bytes of the request. -func (m DeleteRequest) SignedData() ([]byte, error) { - return service.SignedDataFromReader(m) -} - -// SignedDataSize returns payload size of the request. -func (m DeleteRequest) SignedDataSize() int { - return m.GetCID().Size() -} - -// ReadSignedData copies payload bytes to passed buffer. -// -// If the Request size is insufficient, io.ErrUnexpectedEOF returns. -func (m DeleteRequest) ReadSignedData(p []byte) (int, error) { - if len(p) < m.SignedDataSize() { - return 0, io.ErrUnexpectedEOF - } - - var off int - - off += copy(p[off:], m.GetCID().Bytes()) - - return off, nil -} - -// SignedData returns payload bytes of the request. -func (m GetRequest) SignedData() ([]byte, error) { - return service.SignedDataFromReader(m) -} - -// SignedDataSize returns payload size of the request. -func (m GetRequest) SignedDataSize() int { - return m.GetCID().Size() -} - -// ReadSignedData copies payload bytes to passed buffer. -// -// If the Request size is insufficient, io.ErrUnexpectedEOF returns. -func (m GetRequest) ReadSignedData(p []byte) (int, error) { - if len(p) < m.SignedDataSize() { - return 0, io.ErrUnexpectedEOF - } - - var off int - - off += copy(p[off:], m.GetCID().Bytes()) - - return off, nil -} - -// SignedData returns payload bytes of the request. -func (m ListRequest) SignedData() ([]byte, error) { - return service.SignedDataFromReader(m) -} - -// SignedDataSize returns payload size of the request. -func (m ListRequest) SignedDataSize() int { - return m.GetOwnerID().Size() -} - -// ReadSignedData copies payload bytes to passed buffer. -// -// If the Request size is insufficient, io.ErrUnexpectedEOF returns. -func (m ListRequest) ReadSignedData(p []byte) (int, error) { - if len(p) < m.SignedDataSize() { - return 0, io.ErrUnexpectedEOF - } - - var off int - - off += copy(p[off:], m.GetOwnerID().Bytes()) - - return off, nil -} - -// SignedData returns payload bytes of the request. -func (m GetExtendedACLRequest) SignedData() ([]byte, error) { - return service.SignedDataFromReader(m) -} - -// SignedDataSize returns payload size of the request. -func (m GetExtendedACLRequest) SignedDataSize() int { - return m.GetID().Size() -} - -// ReadSignedData copies payload bytes to passed buffer. -// -// If the Request size is insufficient, io.ErrUnexpectedEOF returns. -func (m GetExtendedACLRequest) ReadSignedData(p []byte) (int, error) { - if len(p) < m.SignedDataSize() { - return 0, io.ErrUnexpectedEOF - } - - var off int - - off += copy(p[off:], m.GetID().Bytes()) - - return off, nil -} - -// SignedData returns payload bytes of the request. -func (m SetExtendedACLRequest) SignedData() ([]byte, error) { - return service.SignedDataFromReader(m) -} - -// SignedDataSize returns payload size of the request. -func (m SetExtendedACLRequest) SignedDataSize() int { - return 0 + - m.GetID().Size() + - len(m.GetEACL()) + - len(m.GetSignature()) -} - -// ReadSignedData copies payload bytes to passed buffer. -// -// If the Request size is insufficient, io.ErrUnexpectedEOF returns. -func (m SetExtendedACLRequest) ReadSignedData(p []byte) (int, error) { - if len(p) < m.SignedDataSize() { - return 0, io.ErrUnexpectedEOF - } - - var off int - - off += copy(p[off:], m.GetID().Bytes()) - - off += copy(p[off:], m.GetEACL()) - - off += copy(p[off:], m.GetSignature()) - - return off, nil -} diff --git a/container/sign_test.go b/container/sign_test.go deleted file mode 100644 index d04a698..0000000 --- a/container/sign_test.go +++ /dev/null @@ -1,187 +0,0 @@ -package container - -import ( - "testing" - - "github.com/nspcc-dev/neofs-api-go/service" - "github.com/nspcc-dev/neofs-crypto/test" - "github.com/stretchr/testify/require" -) - -func TestRequestSign(t *testing.T) { - sk := test.DecodeKey(0) - - type sigType interface { - service.RequestData - service.SignKeyPairAccumulator - service.SignKeyPairSource - SetToken(*service.Token) - } - - items := []struct { - constructor func() sigType - payloadCorrupt []func(sigType) - }{ - { // PutRequest - constructor: func() sigType { - return new(PutRequest) - }, - payloadCorrupt: []func(sigType){ - func(s sigType) { - req := s.(*PutRequest) - - id := req.GetMessageID() - id[0]++ - - req.SetMessageID(id) - }, - func(s sigType) { - req := s.(*PutRequest) - - req.SetCapacity(req.GetCapacity() + 1) - }, - func(s sigType) { - req := s.(*PutRequest) - - owner := req.GetOwnerID() - owner[0]++ - - req.SetOwnerID(owner) - }, - func(s sigType) { - req := s.(*PutRequest) - - rules := req.GetRules() - rules.ReplFactor++ - - req.SetRules(rules) - }, - func(s sigType) { - req := s.(*PutRequest) - - req.SetBasicACL(req.GetBasicACL() + 1) - }, - }, - }, - { // DeleteRequest - constructor: func() sigType { - return new(DeleteRequest) - }, - payloadCorrupt: []func(sigType){ - func(s sigType) { - req := s.(*DeleteRequest) - - cid := req.GetCID() - cid[0]++ - - req.SetCID(cid) - }, - }, - }, - { // GetRequest - constructor: func() sigType { - return new(GetRequest) - }, - payloadCorrupt: []func(sigType){ - func(s sigType) { - req := s.(*GetRequest) - - cid := req.GetCID() - cid[0]++ - - req.SetCID(cid) - }, - }, - }, - { // ListRequest - constructor: func() sigType { - return new(ListRequest) - }, - payloadCorrupt: []func(sigType){ - func(s sigType) { - req := s.(*ListRequest) - - owner := req.GetOwnerID() - owner[0]++ - - req.SetOwnerID(owner) - }, - }, - }, - { // GetExtendedACLRequest - constructor: func() sigType { - return new(GetExtendedACLRequest) - }, - payloadCorrupt: []func(sigType){ - func(s sigType) { - req := s.(*GetExtendedACLRequest) - - id := req.GetID() - id[0]++ - - req.SetID(id) - }, - }, - }, - { // SetExtendedACLRequest - constructor: func() sigType { - return new(SetExtendedACLRequest) - }, - payloadCorrupt: []func(sigType){ - func(s sigType) { - req := s.(*SetExtendedACLRequest) - - id := req.GetID() - id[0]++ - - req.SetID(id) - }, - func(s sigType) { - req := s.(*SetExtendedACLRequest) - - req.SetEACL( - append(req.GetEACL(), 1), - ) - }, - func(s sigType) { - req := s.(*SetExtendedACLRequest) - - req.SetSignature( - append(req.GetSignature(), 1), - ) - }, - }, - }, - } - - for _, item := range items { - { // token corruptions - v := item.constructor() - - token := new(service.Token) - v.SetToken(token) - - require.NoError(t, service.SignRequestData(sk, v)) - - require.NoError(t, service.VerifyRequestData(v)) - - token.SetSessionKey(append(token.GetSessionKey(), 1)) - - require.Error(t, service.VerifyRequestData(v)) - } - - { // payload corruptions - for _, corruption := range item.payloadCorrupt { - v := item.constructor() - - require.NoError(t, service.SignRequestData(sk, v)) - - require.NoError(t, service.VerifyRequestData(v)) - - corruption(v) - - require.Error(t, service.VerifyRequestData(v)) - } - } - } -} diff --git a/container/types.go b/container/types.go deleted file mode 100644 index be06b53..0000000 --- a/container/types.go +++ /dev/null @@ -1,188 +0,0 @@ -package container - -import ( - "bytes" - - "github.com/gogo/protobuf/proto" - "github.com/google/uuid" - "github.com/nspcc-dev/neofs-api-go/internal" - "github.com/nspcc-dev/neofs-api-go/refs" - "github.com/nspcc-dev/neofs-crypto/test" - "github.com/nspcc-dev/netmap" - "github.com/pkg/errors" -) - -var ( - _ internal.Custom = (*Container)(nil) - - emptySalt = (UUID{}).Bytes() - emptyOwner = (OwnerID{}).Bytes() -) - -// New creates new user container based on capacity, OwnerID, ACL and PlacementRules. -func New(cap uint64, owner OwnerID, acl uint32, rules netmap.PlacementRule) (*Container, error) { - if bytes.Equal(owner[:], emptyOwner) { - return nil, refs.ErrEmptyOwner - } else if cap == 0 { - return nil, refs.ErrEmptyCapacity - } - - salt, err := uuid.NewRandom() - if err != nil { - return nil, errors.Wrap(err, "could not create salt") - } - - return &Container{ - OwnerID: owner, - Salt: UUID(salt), - Capacity: cap, - Rules: rules, - BasicACL: acl, - }, nil -} - -// Bytes returns bytes representation of Container. -func (m *Container) Bytes() []byte { - data, err := m.Marshal() - if err != nil { - return nil - } - - return data -} - -// ID returns generated ContainerID based on Container (data). -func (m *Container) ID() (CID, error) { - if m.Empty() { - return CID{}, refs.ErrEmptyContainer - } - data, err := m.Marshal() - if err != nil { - return CID{}, err - } - - return refs.CIDForBytes(data), nil -} - -// Merge used by proto.Clone -func (m *Container) Merge(src proto.Message) { - if tmp, ok := src.(*Container); ok { - *m = *tmp - } -} - -// Empty checks that container is empty. -func (m *Container) Empty() bool { - return m.Capacity == 0 || bytes.Equal(m.Salt.Bytes(), emptySalt) || bytes.Equal(m.OwnerID.Bytes(), emptyOwner) -} - -// -- Test container definition -- // - -// NewTestContainer returns test container. -// WARNING: DON'T USE THIS OUTSIDE TESTS. -func NewTestContainer() (*Container, error) { - key := test.DecodeKey(0) - owner, err := refs.NewOwnerID(&key.PublicKey) - if err != nil { - return nil, err - } - return New(100, owner, 0xFFFFFFFF, netmap.PlacementRule{ - ReplFactor: 2, - SFGroups: []netmap.SFGroup{ - { - Selectors: []netmap.Select{ - {Key: "Country", Count: 1}, - {Key: netmap.NodesBucket, Count: 2}, - }, - Filters: []netmap.Filter{ - {Key: "Country", F: netmap.FilterIn("USA")}, - }, - }, - }, - }) -} - -// GetMessageID is a MessageID field getter. -func (m PutRequest) GetMessageID() MessageID { - return m.MessageID -} - -// SetMessageID is a MessageID field getter. -func (m *PutRequest) SetMessageID(id MessageID) { - m.MessageID = id -} - -// SetCapacity is a Capacity field setter. -func (m *PutRequest) SetCapacity(c uint64) { - m.Capacity = c -} - -// GetOwnerID is an OwnerID field getter. -func (m PutRequest) GetOwnerID() OwnerID { - return m.OwnerID -} - -// SetOwnerID is an OwnerID field setter. -func (m *PutRequest) SetOwnerID(owner OwnerID) { - m.OwnerID = owner -} - -// SetRules is a Rules field setter. -func (m *PutRequest) SetRules(rules netmap.PlacementRule) { - m.Rules = rules -} - -// SetBasicACL is a BasicACL field setter. -func (m *PutRequest) SetBasicACL(acl uint32) { - m.BasicACL = acl -} - -// GetCID is a CID field getter. -func (m DeleteRequest) GetCID() CID { - return m.CID -} - -// SetCID is a CID field setter. -func (m *DeleteRequest) SetCID(cid CID) { - m.CID = cid -} - -// GetCID is a CID field getter. -func (m GetRequest) GetCID() CID { - return m.CID -} - -// SetCID is a CID field setter. -func (m *GetRequest) SetCID(cid CID) { - m.CID = cid -} - -// GetOwnerID is an OwnerID field getter. -func (m ListRequest) GetOwnerID() OwnerID { - return m.OwnerID -} - -// SetOwnerID is an OwnerID field setter. -func (m *ListRequest) SetOwnerID(owner OwnerID) { - m.OwnerID = owner -} - -// GetID is an ID field getter. -func (m ExtendedACLKey) GetID() CID { - return m.ID -} - -// SetID is an ID field setter. -func (m *ExtendedACLKey) SetID(v CID) { - m.ID = v -} - -// SetEACL is an EACL field setter. -func (m *ExtendedACLValue) SetEACL(v []byte) { - m.EACL = v -} - -// SetSignature is a Signature field setter. -func (m *ExtendedACLValue) SetSignature(sig []byte) { - m.Signature = sig -} diff --git a/container/types.pb.go b/container/types.pb.go deleted file mode 100644 index 391656c..0000000 --- a/container/types.pb.go +++ /dev/null @@ -1,507 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: container/types.proto - -package container - -import ( - fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/golang/protobuf/proto" - netmap "github.com/nspcc-dev/netmap" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package - -// The Container service definition. -type Container struct { - // OwnerID is a wallet address. - OwnerID OwnerID `protobuf:"bytes,1,opt,name=OwnerID,proto3,customtype=OwnerID" json:"OwnerID"` - // Salt is a nonce for unique container id calculation. - Salt UUID `protobuf:"bytes,2,opt,name=Salt,proto3,customtype=UUID" json:"Salt"` - // Capacity defines amount of data that can be stored in the container (doesn't used for now). - Capacity uint64 `protobuf:"varint,3,opt,name=Capacity,proto3" json:"Capacity,omitempty"` - // Rules define storage policy for the object inside the container. - Rules netmap.PlacementRule `protobuf:"bytes,4,opt,name=Rules,proto3" json:"Rules"` - // BasicACL with access control rules for owner, system, others and - // permission bits for bearer token and extended ACL. - BasicACL uint32 `protobuf:"varint,5,opt,name=BasicACL,proto3" json:"BasicACL,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Container) Reset() { *m = Container{} } -func (m *Container) String() string { return proto.CompactTextString(m) } -func (*Container) ProtoMessage() {} -func (*Container) Descriptor() ([]byte, []int) { - return fileDescriptor_1432e52ab0b53e3e, []int{0} -} -func (m *Container) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Container) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *Container) XXX_Merge(src proto.Message) { - xxx_messageInfo_Container.Merge(m, src) -} -func (m *Container) XXX_Size() int { - return m.Size() -} -func (m *Container) XXX_DiscardUnknown() { - xxx_messageInfo_Container.DiscardUnknown(m) -} - -var xxx_messageInfo_Container proto.InternalMessageInfo - -func (m *Container) GetCapacity() uint64 { - if m != nil { - return m.Capacity - } - return 0 -} - -func (m *Container) GetRules() netmap.PlacementRule { - if m != nil { - return m.Rules - } - return netmap.PlacementRule{} -} - -func (m *Container) GetBasicACL() uint32 { - if m != nil { - return m.BasicACL - } - return 0 -} - -func init() { - proto.RegisterType((*Container)(nil), "container.Container") -} - -func init() { proto.RegisterFile("container/types.proto", fileDescriptor_1432e52ab0b53e3e) } - -var fileDescriptor_1432e52ab0b53e3e = []byte{ - // 315 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x4d, 0xce, 0xcf, 0x2b, - 0x49, 0xcc, 0xcc, 0x4b, 0x2d, 0xd2, 0x2f, 0xa9, 0x2c, 0x48, 0x2d, 0xd6, 0x2b, 0x28, 0xca, 0x2f, - 0xc9, 0x17, 0xe2, 0x84, 0x0b, 0x4b, 0x69, 0xa5, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, - 0xe7, 0xea, 0xe7, 0x15, 0x17, 0x24, 0x27, 0xeb, 0xa6, 0xa4, 0x96, 0xe9, 0xe7, 0xa5, 0x96, 0xe4, - 0x26, 0x16, 0xe8, 0x17, 0xa7, 0xe6, 0xa4, 0x26, 0x97, 0xe4, 0x17, 0x41, 0xb4, 0x49, 0xe9, 0x22, - 0xa9, 0x4d, 0xcf, 0x4f, 0xcf, 0xd7, 0x07, 0x0b, 0x27, 0x95, 0xa6, 0x81, 0x79, 0x60, 0x0e, 0x98, - 0x05, 0x51, 0xae, 0x74, 0x98, 0x91, 0x8b, 0xd3, 0x19, 0x66, 0x91, 0x90, 0x26, 0x17, 0xbb, 0x7f, - 0x79, 0x5e, 0x6a, 0x91, 0xa7, 0x8b, 0x04, 0xa3, 0x02, 0xa3, 0x06, 0x8f, 0x13, 0xff, 0x89, 0x7b, - 0xf2, 0x0c, 0xb7, 0xee, 0xc9, 0xc3, 0x84, 0x83, 0x60, 0x0c, 0x21, 0x05, 0x2e, 0x96, 0xe0, 0xc4, - 0x9c, 0x12, 0x09, 0x26, 0xb0, 0x3a, 0x1e, 0xa8, 0x3a, 0x96, 0xd0, 0x50, 0x4f, 0x97, 0x20, 0xb0, - 0x8c, 0x90, 0x14, 0x17, 0x87, 0x73, 0x62, 0x41, 0x62, 0x72, 0x66, 0x49, 0xa5, 0x04, 0xb3, 0x02, - 0xa3, 0x06, 0x4b, 0x10, 0x9c, 0x2f, 0x64, 0xc8, 0xc5, 0x1a, 0x54, 0x9a, 0x93, 0x5a, 0x2c, 0xc1, - 0xa2, 0xc0, 0xa8, 0xc1, 0x6d, 0x24, 0xaa, 0x07, 0xf1, 0x8c, 0x5e, 0x40, 0x4e, 0x62, 0x72, 0x6a, - 0x6e, 0x6a, 0x5e, 0x09, 0x48, 0xd6, 0x89, 0x05, 0x64, 0x6a, 0x10, 0x44, 0x25, 0xc8, 0x38, 0xa7, - 0xc4, 0xe2, 0xcc, 0x64, 0x47, 0x67, 0x1f, 0x09, 0x56, 0x05, 0x46, 0x0d, 0xde, 0x20, 0x38, 0xdf, - 0x29, 0xfc, 0xc4, 0x23, 0x39, 0xc6, 0x0b, 0x8f, 0xe4, 0x18, 0x6f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, - 0x48, 0x8e, 0x71, 0xc6, 0x63, 0x39, 0x86, 0x28, 0x6d, 0x1c, 0xc1, 0x96, 0x9f, 0x56, 0xac, 0x9b, - 0x58, 0x90, 0xa9, 0x9b, 0x9e, 0xaf, 0x0f, 0x0f, 0xe3, 0x55, 0x4c, 0xc2, 0x7e, 0xa9, 0xf9, 0x6e, - 0xc1, 0x7a, 0x8e, 0x01, 0x9e, 0x7a, 0xf0, 0x00, 0x49, 0x62, 0x03, 0x87, 0x92, 0x31, 0x20, 0x00, - 0x00, 0xff, 0xff, 0xfc, 0x81, 0x55, 0xd6, 0xa4, 0x01, 0x00, 0x00, -} - -func (m *Container) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Container) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Container) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.BasicACL != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.BasicACL)) - i-- - dAtA[i] = 0x28 - } - { - size, err := m.Rules.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - if m.Capacity != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.Capacity)) - i-- - dAtA[i] = 0x18 - } - { - size := m.Salt.Size() - i -= size - if _, err := m.Salt.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size := m.OwnerID.Size() - i -= size - if _, err := m.OwnerID.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func encodeVarintTypes(dAtA []byte, offset int, v uint64) int { - offset -= sovTypes(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *Container) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.OwnerID.Size() - n += 1 + l + sovTypes(uint64(l)) - l = m.Salt.Size() - n += 1 + l + sovTypes(uint64(l)) - if m.Capacity != 0 { - n += 1 + sovTypes(uint64(m.Capacity)) - } - l = m.Rules.Size() - n += 1 + l + sovTypes(uint64(l)) - if m.BasicACL != 0 { - n += 1 + sovTypes(uint64(m.BasicACL)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func sovTypes(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozTypes(x uint64) (n int) { - return sovTypes(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *Container) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Container: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Container: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OwnerID", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.OwnerID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Salt", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Salt.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Capacity", wireType) - } - m.Capacity = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Capacity |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Rules", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Rules.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field BasicACL", wireType) - } - m.BasicACL = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.BasicACL |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipTypes(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTypes - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTypes - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTypes - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthTypes - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupTypes - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthTypes - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthTypes = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowTypes = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupTypes = fmt.Errorf("proto: unexpected end of group") -) diff --git a/container/types.proto b/container/types.proto deleted file mode 100644 index dc79bd3..0000000 --- a/container/types.proto +++ /dev/null @@ -1,24 +0,0 @@ -syntax = "proto3"; -package container; -option go_package = "github.com/nspcc-dev/neofs-api-go/container"; -option csharp_namespace = "NeoFS.API.Container"; - -import "github.com/nspcc-dev/netmap/selector.proto"; -import "github.com/gogo/protobuf/gogoproto/gogo.proto"; - -option (gogoproto.stable_marshaler_all) = true; - -// The Container service definition. -message Container { - // OwnerID is a wallet address. - bytes OwnerID = 1 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false]; - // Salt is a nonce for unique container id calculation. - bytes Salt = 2 [(gogoproto.customtype) = "UUID", (gogoproto.nullable) = false]; - // Capacity defines amount of data that can be stored in the container (doesn't used for now). - uint64 Capacity = 3; - // Rules define storage policy for the object inside the container. - netmap.PlacementRule Rules = 4 [(gogoproto.nullable) = false]; - // BasicACL with access control rules for owner, system, others and - // permission bits for bearer token and extended ACL. - uint32 BasicACL = 5; -} diff --git a/container/types_test.go b/container/types_test.go deleted file mode 100644 index 76bbe1c..0000000 --- a/container/types_test.go +++ /dev/null @@ -1,162 +0,0 @@ -package container - -import ( - "testing" - - "github.com/gogo/protobuf/proto" - "github.com/nspcc-dev/neofs-api-go/refs" - "github.com/nspcc-dev/neofs-crypto/test" - "github.com/nspcc-dev/netmap" - "github.com/stretchr/testify/require" -) - -func TestCID(t *testing.T) { - t.Run("check that marshal/unmarshal works like expected", func(t *testing.T) { - var ( - c2 Container - cid2 CID - key = test.DecodeKey(0) - ) - - rules := netmap.PlacementRule{ - ReplFactor: 2, - SFGroups: []netmap.SFGroup{ - { - Selectors: []netmap.Select{ - {Key: "Country", Count: 1}, - {Key: netmap.NodesBucket, Count: 2}, - }, - Filters: []netmap.Filter{ - {Key: "Country", F: netmap.FilterIn("USA")}, - }, - }, - }, - } - - owner, err := refs.NewOwnerID(&key.PublicKey) - require.NoError(t, err) - - c1, err := New(10, owner, 0xDEADBEEF, rules) - require.NoError(t, err) - - data, err := proto.Marshal(c1) - require.NoError(t, err) - - require.NoError(t, c2.Unmarshal(data)) - require.Equal(t, c1, &c2) - - cid1, err := c1.ID() - require.NoError(t, err) - - data, err = proto.Marshal(&cid1) - require.NoError(t, err) - require.NoError(t, cid2.Unmarshal(data)) - - require.Equal(t, cid1, cid2) - }) -} - -func TestPutRequestGettersSetters(t *testing.T) { - t.Run("owner", func(t *testing.T) { - owner := OwnerID{1, 2, 3} - m := new(PutRequest) - - m.SetOwnerID(owner) - - require.Equal(t, owner, m.GetOwnerID()) - }) - - t.Run("capacity", func(t *testing.T) { - cp := uint64(3) - m := new(PutRequest) - - m.SetCapacity(cp) - - require.Equal(t, cp, m.GetCapacity()) - }) - - t.Run("message ID", func(t *testing.T) { - id, err := refs.NewUUID() - require.NoError(t, err) - - m := new(PutRequest) - - m.SetMessageID(id) - - require.Equal(t, id, m.GetMessageID()) - }) - - t.Run("rules", func(t *testing.T) { - rules := netmap.PlacementRule{ - ReplFactor: 1, - } - - m := new(PutRequest) - - m.SetRules(rules) - - require.Equal(t, rules, m.GetRules()) - }) - - t.Run("basic ACL", func(t *testing.T) { - bACL := uint32(5) - m := new(PutRequest) - - m.SetBasicACL(bACL) - - require.Equal(t, bACL, m.GetBasicACL()) - }) -} - -func TestDeleteRequestGettersSetters(t *testing.T) { - t.Run("cid", func(t *testing.T) { - cid := CID{1, 2, 3} - m := new(DeleteRequest) - - m.SetCID(cid) - - require.Equal(t, cid, m.GetCID()) - }) -} - -func TestGetRequestGettersSetters(t *testing.T) { - t.Run("cid", func(t *testing.T) { - cid := CID{1, 2, 3} - m := new(GetRequest) - - m.SetCID(cid) - - require.Equal(t, cid, m.GetCID()) - }) -} - -func TestListRequestGettersSetters(t *testing.T) { - t.Run("owner", func(t *testing.T) { - owner := OwnerID{1, 2, 3} - m := new(PutRequest) - - m.SetOwnerID(owner) - - require.Equal(t, owner, m.GetOwnerID()) - }) -} - -func TestExtendedACLKey(t *testing.T) { - s := new(ExtendedACLKey) - - id := CID{1, 2, 3} - s.SetID(id) - require.Equal(t, id, s.GetID()) -} - -func TestExtendedACLValue(t *testing.T) { - s := new(ExtendedACLValue) - - acl := []byte{1, 2, 3} - s.SetEACL(acl) - require.Equal(t, acl, s.GetEACL()) - - sig := []byte{4, 5, 6} - s.SetSignature(sig) - require.Equal(t, sig, s.GetSignature()) -} diff --git a/decimal/decimal.go b/decimal/decimal.go deleted file mode 100644 index 2ee0088..0000000 --- a/decimal/decimal.go +++ /dev/null @@ -1,110 +0,0 @@ -package decimal - -import ( - "math" - "strconv" - "strings" -) - -// GASPrecision contains precision for NEO Gas token. -const GASPrecision = 8 - -// Zero is empty Decimal value. -var Zero = &Decimal{} - -// New returns new Decimal (in satoshi). -func New(v int64) *Decimal { - return NewWithPrecision(v, GASPrecision) -} - -// NewGAS returns new Decimal * 1e8 (in GAS). -func NewGAS(v int64) *Decimal { - v *= int64(math.Pow10(GASPrecision)) - return NewWithPrecision(v, GASPrecision) -} - -// NewWithPrecision returns new Decimal with custom precision. -func NewWithPrecision(v int64, p uint32) *Decimal { - return &Decimal{Value: v, Precision: p} -} - -// ParseFloat return new Decimal parsed from float64 * 1e8 (in GAS). -func ParseFloat(v float64) *Decimal { - return new(Decimal).Parse(v, GASPrecision) -} - -// ParseFloatWithPrecision returns new Decimal parsed from float64 * 1^p. -func ParseFloatWithPrecision(v float64, p int) *Decimal { - return new(Decimal).Parse(v, p) -} - -// Copy returns copy of current Decimal. -func (m *Decimal) Copy() *Decimal { return &Decimal{Value: m.Value, Precision: m.Precision} } - -// Parse returns parsed Decimal from float64 * 1^p. -func (m *Decimal) Parse(v float64, p int) *Decimal { - m.Value = int64(v * math.Pow10(p)) - m.Precision = uint32(p) - return m -} - -// String returns string representation of Decimal. -func (m Decimal) String() string { - buf := new(strings.Builder) - val := m.Value - dec := int64(math.Pow10(int(m.Precision))) - if val < 0 { - buf.WriteRune('-') - val = -val - } - str := strconv.FormatInt(val/dec, 10) - buf.WriteString(str) - val %= dec - if val > 0 { - buf.WriteRune('.') - str = strconv.FormatInt(val, 10) - for i := len(str); i < int(m.Precision); i++ { - buf.WriteRune('0') - } - buf.WriteString(strings.TrimRight(str, "0")) - } - return buf.String() -} - -// Add returns d + m. -func (m Decimal) Add(d *Decimal) *Decimal { - precision := m.Precision - if precision < d.Precision { - precision = d.Precision - } - return &Decimal{ - Value: m.Value + d.Value, - Precision: precision, - } -} - -// Zero checks that Decimal is empty. -func (m Decimal) Zero() bool { return m.Value == 0 } - -// Equal checks that current Decimal is equal to passed Decimal. -func (m Decimal) Equal(v *Decimal) bool { return m.Value == v.Value && m.Precision == v.Precision } - -// GT checks that m > v. -func (m Decimal) GT(v *Decimal) bool { return m.Value > v.Value } - -// GTE checks that m >= v. -func (m Decimal) GTE(v *Decimal) bool { return m.Value >= v.Value } - -// LT checks that m < v. -func (m Decimal) LT(v *Decimal) bool { return m.Value < v.Value } - -// LTE checks that m <= v. -func (m Decimal) LTE(v *Decimal) bool { return m.Value <= v.Value } - -// Neg returns negative representation of current Decimal (m * -1). -func (m Decimal) Neg() *Decimal { - return &Decimal{ - Value: m.Value * -1, - Precision: m.Precision, - } -} diff --git a/decimal/decimal.pb.go b/decimal/decimal.pb.go deleted file mode 100644 index 9108e61..0000000 --- a/decimal/decimal.pb.go +++ /dev/null @@ -1,349 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: decimal/decimal.proto - -package decimal - -import ( - fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/golang/protobuf/proto" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package - -// Decimal is a structure used for representation of assets amount -type Decimal struct { - // Value is value number - Value int64 `protobuf:"varint,1,opt,name=Value,proto3" json:"Value,omitempty"` - // Precision is precision number - Precision uint32 `protobuf:"varint,2,opt,name=Precision,proto3" json:"Precision,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Decimal) Reset() { *m = Decimal{} } -func (*Decimal) ProtoMessage() {} -func (*Decimal) Descriptor() ([]byte, []int) { - return fileDescriptor_e7e70e1773836c80, []int{0} -} -func (m *Decimal) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Decimal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *Decimal) XXX_Merge(src proto.Message) { - xxx_messageInfo_Decimal.Merge(m, src) -} -func (m *Decimal) XXX_Size() int { - return m.Size() -} -func (m *Decimal) XXX_DiscardUnknown() { - xxx_messageInfo_Decimal.DiscardUnknown(m) -} - -var xxx_messageInfo_Decimal proto.InternalMessageInfo - -func (m *Decimal) GetValue() int64 { - if m != nil { - return m.Value - } - return 0 -} - -func (m *Decimal) GetPrecision() uint32 { - if m != nil { - return m.Precision - } - return 0 -} - -func init() { - proto.RegisterType((*Decimal)(nil), "decimal.Decimal") -} - -func init() { proto.RegisterFile("decimal/decimal.proto", fileDescriptor_e7e70e1773836c80) } - -var fileDescriptor_e7e70e1773836c80 = []byte{ - // 201 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x4d, 0x49, 0x4d, 0xce, - 0xcc, 0x4d, 0xcc, 0xd1, 0x87, 0xd2, 0x7a, 0x05, 0x45, 0xf9, 0x25, 0xf9, 0x42, 0xec, 0x50, 0xae, - 0x94, 0x6e, 0x7a, 0x66, 0x49, 0x46, 0x69, 0x92, 0x5e, 0x72, 0x7e, 0xae, 0x7e, 0x7a, 0x7e, 0x7a, - 0xbe, 0x3e, 0x58, 0x3e, 0xa9, 0x34, 0x0d, 0xcc, 0x03, 0x73, 0xc0, 0x2c, 0x88, 0x3e, 0x25, 0x67, - 0x2e, 0x76, 0x17, 0x88, 0x4e, 0x21, 0x11, 0x2e, 0xd6, 0xb0, 0xc4, 0x9c, 0xd2, 0x54, 0x09, 0x46, - 0x05, 0x46, 0x0d, 0xe6, 0x20, 0x08, 0x47, 0x48, 0x86, 0x8b, 0x33, 0xa0, 0x28, 0x35, 0x39, 0xb3, - 0x38, 0x33, 0x3f, 0x4f, 0x82, 0x49, 0x81, 0x51, 0x83, 0x37, 0x08, 0x21, 0x60, 0xc5, 0x32, 0x63, - 0x81, 0x3c, 0x83, 0x53, 0xf0, 0x89, 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, 0x31, 0xde, 0x78, 0x24, - 0xc7, 0xf8, 0xe0, 0x91, 0x1c, 0xe3, 0x8c, 0xc7, 0x72, 0x0c, 0x51, 0x9a, 0x48, 0x2e, 0xc9, 0x2b, - 0x2e, 0x48, 0x4e, 0xd6, 0x4d, 0x49, 0x2d, 0xd3, 0xcf, 0x4b, 0xcd, 0x4f, 0x2b, 0xd6, 0x4d, 0x2c, - 0xc8, 0xd4, 0x4d, 0xcf, 0x87, 0xf9, 0x61, 0x15, 0x93, 0xa0, 0x5f, 0x6a, 0xbe, 0x5b, 0xb0, 0x9e, - 0x63, 0x80, 0xa7, 0x1e, 0xd4, 0x39, 0x49, 0x6c, 0x60, 0x07, 0x1a, 0x03, 0x02, 0x00, 0x00, 0xff, - 0xff, 0xa5, 0x41, 0x4c, 0x9f, 0xf1, 0x00, 0x00, 0x00, -} - -func (m *Decimal) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Decimal) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Decimal) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.Precision != 0 { - i = encodeVarintDecimal(dAtA, i, uint64(m.Precision)) - i-- - dAtA[i] = 0x10 - } - if m.Value != 0 { - i = encodeVarintDecimal(dAtA, i, uint64(m.Value)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func encodeVarintDecimal(dAtA []byte, offset int, v uint64) int { - offset -= sovDecimal(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *Decimal) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Value != 0 { - n += 1 + sovDecimal(uint64(m.Value)) - } - if m.Precision != 0 { - n += 1 + sovDecimal(uint64(m.Precision)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func sovDecimal(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozDecimal(x uint64) (n int) { - return sovDecimal(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *Decimal) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowDecimal - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Decimal: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Decimal: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) - } - m.Value = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowDecimal - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Value |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Precision", wireType) - } - m.Precision = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowDecimal - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Precision |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipDecimal(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthDecimal - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthDecimal - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipDecimal(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowDecimal - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowDecimal - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowDecimal - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthDecimal - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupDecimal - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthDecimal - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthDecimal = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowDecimal = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupDecimal = fmt.Errorf("proto: unexpected end of group") -) diff --git a/decimal/decimal.proto b/decimal/decimal.proto deleted file mode 100644 index f3d5c00..0000000 --- a/decimal/decimal.proto +++ /dev/null @@ -1,18 +0,0 @@ -syntax = "proto3"; -package decimal; -option go_package = "github.com/nspcc-dev/neofs-api-go/decimal"; -option csharp_namespace = "NeoFS.API.Decimal"; - -import "github.com/gogo/protobuf/gogoproto/gogo.proto"; - -option (gogoproto.stable_marshaler_all) = true; - -// Decimal is a structure used for representation of assets amount -message Decimal { - option (gogoproto.goproto_stringer) = false; - - // Value is value number - int64 Value = 1; - // Precision is precision number - uint32 Precision = 2; -} diff --git a/decimal/decimal_test.go b/decimal/decimal_test.go deleted file mode 100644 index c5ffef7..0000000 --- a/decimal/decimal_test.go +++ /dev/null @@ -1,445 +0,0 @@ -package decimal - -import ( - "testing" - - "github.com/stretchr/testify/require" -) - -func TestDecimal_Parse(t *testing.T) { - tests := []struct { - value float64 - name string - expect *Decimal - }{ - {name: "empty", expect: &Decimal{Precision: GASPrecision}}, - - { - value: 100, - name: "100 GAS", - expect: &Decimal{Value: 1e10, Precision: GASPrecision}, - }, - } - for i := range tests { - tt := tests[i] - t.Run(tt.name, func(t *testing.T) { - require.Equal(t, tt.expect, ParseFloat(tt.value)) - }) - } -} - -func TestDecimal_ParseWithPrecision(t *testing.T) { - type args struct { - v float64 - p int - } - tests := []struct { - args args - name string - expect *Decimal - }{ - {name: "empty", expect: &Decimal{}}, - - { - name: "empty precision", - expect: &Decimal{Value: 0, Precision: 0}, - }, - - { - name: "100 GAS", - args: args{100, GASPrecision}, - expect: &Decimal{Value: 1e10, Precision: GASPrecision}, - }, - } - for i := range tests { - tt := tests[i] - t.Run(tt.name, func(t *testing.T) { - require.Equal(t, tt.expect, - ParseFloatWithPrecision(tt.args.v, tt.args.p)) - }) - } -} - -func TestNew(t *testing.T) { - tests := []struct { - name string - val int64 - expect *Decimal - }{ - {name: "empty", expect: &Decimal{Value: 0, Precision: GASPrecision}}, - {name: "100 GAS", val: 1e10, expect: &Decimal{Value: 1e10, Precision: GASPrecision}}, - } - for i := range tests { - tt := tests[i] - t.Run(tt.name, func(t *testing.T) { - require.Equalf(t, tt.expect, New(tt.val), tt.name) - }) - } -} - -func TestNewGAS(t *testing.T) { - tests := []struct { - name string - val int64 - expect *Decimal - }{ - {name: "empty", expect: &Decimal{Value: 0, Precision: GASPrecision}}, - {name: "100 GAS", val: 100, expect: &Decimal{Value: 1e10, Precision: GASPrecision}}, - } - for i := range tests { - tt := tests[i] - t.Run(tt.name, func(t *testing.T) { - require.Equalf(t, tt.expect, NewGAS(tt.val), tt.name) - }) - } -} -func TestNewWithPrecision(t *testing.T) { - tests := []struct { - name string - val int64 - pre uint32 - expect *Decimal - }{ - {name: "empty", expect: &Decimal{}}, - {name: "100 GAS", val: 1e10, pre: GASPrecision, expect: &Decimal{Value: 1e10, Precision: GASPrecision}}, - } - for i := range tests { - tt := tests[i] - t.Run(tt.name, func(t *testing.T) { - require.Equalf(t, tt.expect, NewWithPrecision(tt.val, tt.pre), tt.name) - }) - } -} - -func TestDecimal_Neg(t *testing.T) { - tests := []struct { - name string - val int64 - expect *Decimal - }{ - {name: "empty", expect: &Decimal{Value: 0, Precision: GASPrecision}}, - {name: "100 GAS", val: 1e10, expect: &Decimal{Value: -1e10, Precision: GASPrecision}}, - } - for i := range tests { - tt := tests[i] - t.Run(tt.name, func(t *testing.T) { - require.NotPanicsf(t, func() { - require.Equalf(t, tt.expect, New(tt.val).Neg(), tt.name) - }, tt.name) - }) - } -} - -func TestDecimal_String(t *testing.T) { - tests := []struct { - name string - expect string - value *Decimal - }{ - {name: "empty", expect: "0", value: &Decimal{}}, - {name: "100 GAS", expect: "100", value: &Decimal{Value: 1e10, Precision: GASPrecision}}, - {name: "-100 GAS", expect: "-100", value: &Decimal{Value: -1e10, Precision: GASPrecision}}, - } - for i := range tests { - tt := tests[i] - t.Run(tt.name, func(t *testing.T) { - require.Equalf(t, tt.expect, tt.value.String(), tt.name) - }) - } -} - -const SomethingElsePrecision = 5 - -func TestDecimal_Add(t *testing.T) { - tests := []struct { - name string - expect *Decimal - values [2]*Decimal - }{ - {name: "empty", expect: &Decimal{}, values: [2]*Decimal{{}, {}}}, - { - name: "5 GAS + 2 GAS", - expect: &Decimal{Value: 7e8, Precision: GASPrecision}, - values: [2]*Decimal{ - {Value: 2e8, Precision: GASPrecision}, - {Value: 5e8, Precision: GASPrecision}, - }, - }, - { - name: "1e2 + 1e3", - expect: &Decimal{Value: 1.1e3, Precision: 3}, - values: [2]*Decimal{ - {Value: 1e2, Precision: 2}, - {Value: 1e3, Precision: 3}, - }, - }, - { - name: "5 GAS + 10 SomethingElse", - expect: &Decimal{Value: 5.01e8, Precision: GASPrecision}, - values: [2]*Decimal{ - {Value: 5e8, Precision: GASPrecision}, - {Value: 1e6, Precision: SomethingElsePrecision}, - }, - }, - } - for i := range tests { - tt := tests[i] - t.Run(tt.name, func(t *testing.T) { - require.NotPanicsf(t, func() { - { // A + B - one := tt.values[0] - two := tt.values[1] - require.Equalf(t, tt.expect, one.Add(two), tt.name) - t.Log(one.Add(two)) - } - - { // B + A - one := tt.values[0] - two := tt.values[1] - require.Equalf(t, tt.expect, two.Add(one), tt.name) - t.Log(two.Add(one)) - } - }, tt.name) - }) - } -} - -func TestDecimal_Copy(t *testing.T) { - tests := []struct { - name string - expect *Decimal - value *Decimal - }{ - {name: "zero", expect: Zero}, - { - name: "5 GAS", - expect: &Decimal{Value: 5e8, Precision: GASPrecision}, - }, - { - name: "100 GAS", - expect: &Decimal{Value: 1e10, Precision: GASPrecision}, - }, - } - for i := range tests { - tt := tests[i] - t.Run(tt.name, func(t *testing.T) { - require.NotPanicsf(t, func() { - require.Equal(t, tt.expect, tt.expect.Copy()) - }, tt.name) - }) - } -} - -func TestDecimal_Zero(t *testing.T) { - tests := []struct { - name string - expect bool - value *Decimal - }{ - {name: "zero", expect: true, value: Zero}, - { - name: "5 GAS", - expect: false, - value: &Decimal{Value: 5e8, Precision: GASPrecision}, - }, - { - name: "100 GAS", - expect: false, - value: &Decimal{Value: 1e10, Precision: GASPrecision}, - }, - } - for i := range tests { - tt := tests[i] - t.Run(tt.name, func(t *testing.T) { - require.NotPanicsf(t, func() { - require.Truef(t, tt.expect == tt.value.Zero(), tt.name) - }, tt.name) - }) - } -} - -func TestDecimal_Equal(t *testing.T) { - tests := []struct { - name string - expect bool - values [2]*Decimal - }{ - {name: "zero == zero", expect: true, values: [2]*Decimal{Zero, Zero}}, - { - name: "5 GAS != 2 GAS", - expect: false, - values: [2]*Decimal{ - {Value: 5e8, Precision: GASPrecision}, - {Value: 2e8, Precision: GASPrecision}, - }, - }, - { - name: "100 GAS == 100 GAS", - expect: true, - values: [2]*Decimal{ - {Value: 1e10, Precision: GASPrecision}, - {Value: 1e10, Precision: GASPrecision}, - }, - }, - } - for i := range tests { - tt := tests[i] - t.Run(tt.name, func(t *testing.T) { - require.NotPanicsf(t, func() { - require.Truef(t, tt.expect == (tt.values[0].Equal(tt.values[1])), tt.name) - }, tt.name) - }) - } -} - -func TestDecimal_GT(t *testing.T) { - tests := []struct { - name string - expect bool - values [2]*Decimal - }{ - {name: "two zeros", expect: false, values: [2]*Decimal{Zero, Zero}}, - { - name: "5 GAS > 2 GAS", - expect: true, - values: [2]*Decimal{ - {Value: 5e8, Precision: GASPrecision}, - {Value: 2e8, Precision: GASPrecision}, - }, - }, - { - name: "100 GAS !> 100 GAS", - expect: false, - values: [2]*Decimal{ - {Value: 1e10, Precision: GASPrecision}, - {Value: 1e10, Precision: GASPrecision}, - }, - }, - } - for i := range tests { - tt := tests[i] - t.Run(tt.name, func(t *testing.T) { - require.NotPanicsf(t, func() { - require.Truef(t, tt.expect == (tt.values[0].GT(tt.values[1])), tt.name) - }, tt.name) - }) - } -} - -func TestDecimal_GTE(t *testing.T) { - tests := []struct { - name string - expect bool - values [2]*Decimal - }{ - {name: "two zeros", expect: true, values: [2]*Decimal{Zero, Zero}}, - { - name: "5 GAS >= 2 GAS", - expect: true, - values: [2]*Decimal{ - {Value: 5e8, Precision: GASPrecision}, - {Value: 2e8, Precision: GASPrecision}, - }, - }, - { - name: "1 GAS !>= 100 GAS", - expect: false, - values: [2]*Decimal{ - {Value: 1e8, Precision: GASPrecision}, - {Value: 1e10, Precision: GASPrecision}, - }, - }, - } - for i := range tests { - tt := tests[i] - t.Run(tt.name, func(t *testing.T) { - require.NotPanicsf(t, func() { - require.Truef(t, tt.expect == (tt.values[0].GTE(tt.values[1])), tt.name) - }, tt.name) - }) - } -} - -func TestDecimal_LT(t *testing.T) { - tests := []struct { - name string - expect bool - values [2]*Decimal - }{ - {name: "two zeros", expect: false, values: [2]*Decimal{Zero, Zero}}, - { - name: "5 GAS !< 2 GAS", - expect: false, - values: [2]*Decimal{ - {Value: 5e8, Precision: GASPrecision}, - {Value: 2e8, Precision: GASPrecision}, - }, - }, - { - name: "1 GAS < 100 GAS", - expect: true, - values: [2]*Decimal{ - {Value: 1e8, Precision: GASPrecision}, - {Value: 1e10, Precision: GASPrecision}, - }, - }, - { - name: "100 GAS !< 100 GAS", - expect: false, - values: [2]*Decimal{ - {Value: 1e10, Precision: GASPrecision}, - {Value: 1e10, Precision: GASPrecision}, - }, - }, - } - for i := range tests { - tt := tests[i] - t.Run(tt.name, func(t *testing.T) { - require.NotPanicsf(t, func() { - require.Truef(t, tt.expect == (tt.values[0].LT(tt.values[1])), tt.name) - }, tt.name) - }) - } -} - -func TestDecimal_LTE(t *testing.T) { - tests := []struct { - name string - expect bool - values [2]*Decimal - }{ - {name: "two zeros", expect: true, values: [2]*Decimal{Zero, Zero}}, - { - name: "5 GAS <= 2 GAS", - expect: false, - values: [2]*Decimal{ - {Value: 5e8, Precision: GASPrecision}, - {Value: 2e8, Precision: GASPrecision}, - }, - }, - { - name: "1 GAS <= 100 GAS", - expect: true, - values: [2]*Decimal{ - {Value: 1e8, Precision: GASPrecision}, - {Value: 1e10, Precision: GASPrecision}, - }, - }, - { - name: "100 GAS !<= 1 GAS", - expect: false, - values: [2]*Decimal{ - {Value: 1e10, Precision: GASPrecision}, - {Value: 1e8, Precision: GASPrecision}, - }, - }, - } - for i := range tests { - tt := tests[i] - t.Run(tt.name, func(t *testing.T) { - require.NotPanicsf(t, func() { - require.Truef(t, tt.expect == (tt.values[0].LTE(tt.values[1])), tt.name) - }, tt.name) - }) - } -} diff --git a/hash/hash.go b/hash/hash.go deleted file mode 100644 index 4e2fb05..0000000 --- a/hash/hash.go +++ /dev/null @@ -1,106 +0,0 @@ -package hash - -import ( - "bytes" - - "github.com/gogo/protobuf/proto" - "github.com/mr-tron/base58" - "github.com/nspcc-dev/neofs-api-go/internal" - "github.com/nspcc-dev/tzhash/tz" - "github.com/pkg/errors" -) - -// HomomorphicHashSize contains size of HH. -const HomomorphicHashSize = 64 - -// Hash is implementation of HomomorphicHash. -type Hash [HomomorphicHashSize]byte - -// ErrWrongDataSize raised when wrong size of bytes is passed to unmarshal HH. -const ErrWrongDataSize = internal.Error("wrong data size") - -var ( - _ internal.Custom = (*Hash)(nil) - - emptyHH [HomomorphicHashSize]byte -) - -// Size returns size of Hash (HomomorphicHashSize). -func (h Hash) Size() int { return HomomorphicHashSize } - -// Empty checks that Hash is empty. -func (h Hash) Empty() bool { return bytes.Equal(h.Bytes(), emptyHH[:]) } - -// Reset sets current Hash to empty value. -func (h *Hash) Reset() { *h = Hash{} } - -// ProtoMessage method to satisfy proto.Message interface. -func (h Hash) ProtoMessage() {} - -// Bytes represents Hash as bytes. -func (h Hash) Bytes() []byte { - buf := make([]byte, HomomorphicHashSize) - copy(buf, h[:]) - return h[:] -} - -// Marshal returns bytes representation of Hash. -func (h Hash) Marshal() ([]byte, error) { return h.Bytes(), nil } - -// MarshalTo tries to marshal Hash into passed bytes and returns count of copied bytes. -func (h *Hash) MarshalTo(data []byte) (int, error) { return copy(data, h.Bytes()), nil } - -// Unmarshal tries to parse bytes into valid Hash. -func (h *Hash) Unmarshal(data []byte) error { - if ln := len(data); ln != HomomorphicHashSize { - return errors.Wrapf(ErrWrongDataSize, "expect=%d, actual=%d", HomomorphicHashSize, ln) - } - - copy((*h)[:], data) - return nil -} - -// String returns string representation of Hash. -func (h Hash) String() string { return base58.Encode(h[:]) } - -// Equal checks that current Hash is equal to passed Hash. -func (h Hash) Equal(hash Hash) bool { return h == hash } - -// Verify validates if current hash generated from passed data. -func (h Hash) Verify(data []byte) bool { return h.Equal(Sum(data)) } - -// Validate checks if combined hashes are equal to current Hash. -func (h Hash) Validate(hashes []Hash) bool { - hashBytes := make([][]byte, 0, len(hashes)) - for i := range hashes { - hashBytes = append(hashBytes, hashes[i].Bytes()) - } - ok, err := tz.Validate(h.Bytes(), hashBytes) - return err == nil && ok -} - -// Merge used by proto.Clone -func (h *Hash) Merge(src proto.Message) { - if tmp, ok := src.(*Hash); ok { - *h = *tmp - } -} - -// Sum returns Tillich-Zémor checksum of data. -func Sum(data []byte) Hash { return tz.Sum(data) } - -// Concat combines hashes based on homomorphic property. -func Concat(hashes []Hash) (Hash, error) { - var ( - hash Hash - h = make([][]byte, 0, len(hashes)) - ) - for i := range hashes { - h = append(h, hashes[i].Bytes()) - } - cat, err := tz.Concat(h) - if err != nil { - return hash, err - } - return hash, hash.Unmarshal(cat) -} diff --git a/hash/hash_test.go b/hash/hash_test.go deleted file mode 100644 index b3ef703..0000000 --- a/hash/hash_test.go +++ /dev/null @@ -1,166 +0,0 @@ -package hash - -import ( - "bytes" - "crypto/rand" - "testing" - - "github.com/pkg/errors" - "github.com/stretchr/testify/require" -) - -func Test_Sum(t *testing.T) { - var ( - data = []byte("Hello world") - sum = Sum(data) - hash = []byte{0, 0, 0, 0, 1, 79, 16, 173, 134, 90, 176, 77, 114, 165, 253, 114, 0, 0, 0, 0, 0, 148, - 172, 222, 98, 248, 15, 99, 205, 129, 66, 91, 0, 0, 0, 0, 0, 138, 173, 39, 228, 231, 239, 123, - 170, 96, 186, 61, 0, 0, 0, 0, 0, 90, 69, 237, 131, 90, 161, 73, 38, 164, 185, 55} - ) - - require.Equal(t, hash, sum.Bytes()) -} - -func Test_Validate(t *testing.T) { - var ( - data = []byte("Hello world") - hash = Sum(data) - pieces = splitData(data, 2) - ln = len(pieces) - hashes = make([]Hash, 0, ln) - ) - - for i := 0; i < ln; i++ { - hashes = append(hashes, Sum(pieces[i])) - } - - require.True(t, hash.Validate(hashes)) -} - -func Test_Concat(t *testing.T) { - var ( - data = []byte("Hello world") - hash = Sum(data) - pieces = splitData(data, 2) - ln = len(pieces) - hashes = make([]Hash, 0, ln) - ) - - for i := 0; i < ln; i++ { - hashes = append(hashes, Sum(pieces[i])) - } - - res, err := Concat(hashes) - require.NoError(t, err) - require.Equal(t, hash, res) -} - -func Test_HashChunks(t *testing.T) { - var ( - chars = []byte("+") - size = 1400 - data = bytes.Repeat(chars, size) - hash = Sum(data) - count = 150 - ) - - hashes, err := dataHashes(data, count) - require.NoError(t, err) - require.Len(t, hashes, count) - - require.True(t, hash.Validate(hashes)) - - // 100 / 150 = 0 - hashes, err = dataHashes(data[:100], count) - require.Error(t, err) - require.Nil(t, hashes) -} - -func TestXOR(t *testing.T) { - var ( - dl = 10 - data = make([]byte, dl) - ) - - _, err := rand.Read(data) - require.NoError(t, err) - - t.Run("XOR with salt", func(t *testing.T) { - res := SaltXOR(data, nil) - require.Equal(t, res, data) - }) - - t.Run("XOR with empty salt", func(t *testing.T) { - xorWithSalt(t, data, 0) - }) - - t.Run("XOR with salt same data size", func(t *testing.T) { - xorWithSalt(t, data, dl) - }) - - t.Run("XOR with salt shorter than data aliquot", func(t *testing.T) { - xorWithSalt(t, data, dl/2) - }) - - t.Run("XOR with salt shorter than data aliquant", func(t *testing.T) { - xorWithSalt(t, data, dl/3/+1) - }) - - t.Run("XOR with salt longer than data aliquot", func(t *testing.T) { - xorWithSalt(t, data, dl*2) - }) - - t.Run("XOR with salt longer than data aliquant", func(t *testing.T) { - xorWithSalt(t, data, dl*2-1) - }) -} - -func xorWithSalt(t *testing.T, data []byte, saltSize int) { - var ( - direct, reverse []byte - salt = make([]byte, saltSize) - ) - - _, err := rand.Read(salt) - require.NoError(t, err) - - direct = SaltXOR(data, salt) - require.Len(t, direct, len(data)) - - reverse = SaltXOR(direct, salt) - require.Len(t, reverse, len(data)) - - require.Equal(t, reverse, data) -} - -func splitData(buf []byte, lim int) [][]byte { - var piece []byte - pieces := make([][]byte, 0, len(buf)/lim+1) - for len(buf) >= lim { - piece, buf = buf[:lim], buf[lim:] - pieces = append(pieces, piece) - } - if len(buf) > 0 { - pieces = append(pieces, buf) - } - return pieces -} - -func dataHashes(data []byte, count int) ([]Hash, error) { - var ( - ln = len(data) - mis = ln / count - off = (count - 1) * mis - hashes = make([]Hash, 0, count) - ) - if mis == 0 { - return nil, errors.Errorf("could not split %d bytes to %d pieces", ln, count) - } - - pieces := splitData(data[:off], mis) - pieces = append(pieces, data[off:]) - for i := 0; i < count; i++ { - hashes = append(hashes, Sum(pieces[i])) - } - return hashes, nil -} diff --git a/hash/hashesslice.go b/hash/hashesslice.go deleted file mode 100644 index 83bf4c5..0000000 --- a/hash/hashesslice.go +++ /dev/null @@ -1,20 +0,0 @@ -package hash - -import ( - "bytes" -) - -// HashesSlice is a collection that satisfies sort.Interface and can be -// sorted by the routines in sort package. -type HashesSlice []Hash - -// -- HashesSlice -- an inner type to sort Objects -// Len is the number of elements in the collection. -func (hs HashesSlice) Len() int { return len(hs) } - -// Less reports whether the element with -// index i should be sorted before the element with index j. -func (hs HashesSlice) Less(i, j int) bool { return bytes.Compare(hs[i].Bytes(), hs[j].Bytes()) == -1 } - -// Swap swaps the elements with indexes i and j. -func (hs HashesSlice) Swap(i, j int) { hs[i], hs[j] = hs[j], hs[i] } diff --git a/hash/salt.go b/hash/salt.go deleted file mode 100644 index 5b6eeb0..0000000 --- a/hash/salt.go +++ /dev/null @@ -1,17 +0,0 @@ -package hash - -// SaltXOR xors bits of data with salt -// repeating salt if necessary. -func SaltXOR(data, salt []byte) (result []byte) { - result = make([]byte, len(data)) - ls := len(salt) - if ls == 0 { - copy(result, data) - return - } - - for i := range result { - result[i] = data[i] ^ salt[i%ls] - } - return -} diff --git a/internal/error.go b/internal/error.go deleted file mode 100644 index 7df1603..0000000 --- a/internal/error.go +++ /dev/null @@ -1,7 +0,0 @@ -package internal - -// Error is a custom error. -type Error string - -// Error is an implementation of error interface. -func (e Error) Error() string { return string(e) } diff --git a/internal/proto.go b/internal/proto.go deleted file mode 100644 index 9a924b5..0000000 --- a/internal/proto.go +++ /dev/null @@ -1,19 +0,0 @@ -package internal - -import "github.com/gogo/protobuf/proto" - -// Custom contains methods to satisfy proto.Message -// including custom methods to satisfy protobuf for -// non-proto defined types. -type Custom interface { - Size() int - Empty() bool - Bytes() []byte - Marshal() ([]byte, error) - MarshalTo(data []byte) (int, error) - Unmarshal(data []byte) error - proto.Message - - // Should contains for proto.Clone - proto.Merger -} diff --git a/object/doc.go b/object/doc.go deleted file mode 100644 index d81495b..0000000 --- a/object/doc.go +++ /dev/null @@ -1,143 +0,0 @@ -/* -Package object manages main storage structure in the system. All storage -operations are performed with the objects. During lifetime object might be -transformed into another object by cutting its payload or adding meta -information. All transformation may be reversed, therefore source object -will be able to restore. - -Object structure - -Object consists of Payload and Header. Payload is unlimited but storage nodes -may have a policy to store objects with a limited payload. In this case object -with large payload will be transformed into the chain of objects with small -payload. - -Headers are simple key-value fields that divided into two groups: system -headers and extended headers. System headers contain information about -protocol version, object id, payload length in bytes, owner id, container id -and object creation timestamp (both in epochs and unix time). All these fields -must be set up in the correct object. - - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- - | System Headers | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- - | Version : 1 | - | Payload Length : 21673465 | - | Object ID : 465208e2-ba4f-4f99-ad47-82a59f4192d4 | - | Owner ID : AShvoCbSZ7VfRiPkVb1tEcBLiJrcbts1tt | - | Container ID : FGobtRZA6sBZv2i9k4L7TiTtnuP6E788qa278xfj3Fxj | - | Created At : Epoch#10, 1573033162 | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- - | Extended Headers | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- - | User Header : , | - | Verification Header : , | - | Homomorphic Hash : 0x23d35a56ae... | - | Payload Checksum : 0x1bd34abs75... | - | Integrity Header :
, | - | Transformation : Payload Split | - | Link-parent : cae08935-b4ba-499a-bf6c-98276c1e6c0b | - | Link-next : c3b40fbf-3798-4b61-a189-2992b5fb5070 | - | Payload Checksum : 0x1f387a5c36... | - | Integrity Header :
, | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- - | Payload | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- - | 0xd1581963a342d231... | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- - -There are different kinds of extended headers. A correct object must contain -verification header, homomorphic hash header, payload checksum and -integrity header. The order of headers is matter. Let's look through all -these headers. - -Link header points to the connected objects. During object transformation, large -object might be transformed into the chain of smaller objects. One of these -objects drops payload and has several "Child" links. We call this object as -zero-object. Others will have "Parent" link to the zero-object, "Previous" -and "Next" links in the payload chain. - - [ Object ID:1 ] = > transformed - `- [ Zero-Object ID:1 ] - `- Link-child ID:2 - `- Link-child ID:3 - `- Link-child ID:4 - `- Payload [null] - `- [ Object ID:2 ] - `- Link-parent ID:1 - `- Link-next ID:3 - `- Payload [ 0x13ba... ] - `- [ Object ID:3 ] - `- Link-parent ID:1 - `- Link-previous ID:2 - `- Link-next ID:4 - `- Payload [ 0xcd34... ] - `- [ Object ID:4 ] - `- Link-parent ID:1 - `- Link-previous ID:3 - `- Payload [ 0xef86... ] - -Storage groups are also objects. They have "Storage Group" links to all -objects in the group. Links are set by nodes during transformations and, -in general, they should not be set by user manually. - -Redirect headers are not used yet, they will be implemented and described -later. - -User header is a key-value pair of string that can be defined by user. User -can use these headers as search attribute. You can store any meta information -about object there, e.g. object's nicename. - -Transformation header notifies that object was transformed by some pre-defined -way. This header sets up before object is transformed and all headers after -transformation must be located after transformation header. During reverse -transformation, all headers under transformation header will be cut out. - - +-+-+-+-+-+-+-+-+-+- +-+-+-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+-+-+ - | Payload checksum | | Payload checksum | | Payload checksum | - | Integrity header | => | Integrity header | + | Integrity header | - +-+-+-+-+-+-+-+-+-+- | Transformation | | Transformation | - | Large payload | | New Checksum | | New Checksum | - +-+-+-+-+-+-+-+-+-+- | New Integrity | | New Integrity | - +-+-+-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+-+-+ - | Small payload | | Small payload | - +-+-+-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+-+-+ - -For now, we use only one type of transformation: payload split transformation. -This header set up by node automatically. - -Tombstone header notifies that this object was deleted by user. Objects with -tombstone header do not have payload, but they still contain meta information -in the headers. This way we implement two-phase commit for object removal. -Storage nodes will eventually delete all tombstone objects. If you want to -delete object, you must create new object with the same object id, with -tombstone header, correct signatures and without payload. - -Verification header contains session information. To put the object in -the system user must create session. It is required because objects might -be transformed and therefore must be re-signed. To do that node creates -a pair of session public and private keys. Object owner delegates permission to -re-sign objects by signing session public key. This header contains session -public key and owner's signature of this key. You must specify this header -manually. - -Homomorphic hash header contains homomorphic hash of the source object. -Transformations do not affect this header. This header used by data audit and -set by node automatically. - -Payload checksum contains checksum of the actual object payload. All payload -transformation must set new payload checksum headers. This header set by node -automatically. - -Integrity header contains checksum of the header and signature of the -session key. This header must be last in the list of extended headers. -Checksum is calculated by marshaling all above headers, including system -headers. This header set by node automatically. - -Storage group header is presented in storage group objects. It contains -information for data audit: size of validated data, homomorphic has of this -data, storage group expiration time in epochs or unix time. - - -*/ -package object diff --git a/object/extensions.go b/object/extensions.go deleted file mode 100644 index be755c6..0000000 --- a/object/extensions.go +++ /dev/null @@ -1,64 +0,0 @@ -package object - -// todo: all extensions must be transferred to the separate util library - -import "github.com/nspcc-dev/neofs-api-go/storagegroup" - -// IsLinking checks if object has children links to another objects. -// We have to check payload size because zero-object must have zero -// payload and non-zero payload length field in system header. -func (m Object) IsLinking() bool { - for i := range m.Headers { - switch v := m.Headers[i].Value.(type) { - case *Header_Link: - if v.Link.GetType() == Link_Child { - return m.SystemHeader.PayloadLength > 0 && len(m.Payload) == 0 - } - } - } - return false -} - -// Links returns slice of ids of specified link type -func (m *Object) Links(t Link_Type) []ID { - var res []ID - for i := range m.Headers { - switch v := m.Headers[i].Value.(type) { - case *Header_Link: - if v.Link.GetType() == t { - res = append(res, v.Link.ID) - } - } - } - return res -} - -// Tombstone returns tombstone header if it is presented in extended headers. -func (m Object) Tombstone() *Tombstone { - _, h := m.LastHeader(HeaderType(TombstoneHdr)) - if h != nil { - return h.Value.(*Header_Tombstone).Tombstone - } - return nil -} - -// IsTombstone checks if object has tombstone header. -func (m Object) IsTombstone() bool { - n, _ := m.LastHeader(HeaderType(TombstoneHdr)) - return n != -1 -} - -// StorageGroup returns storage group structure if it is presented in extended headers. -func (m Object) StorageGroup() (*storagegroup.StorageGroup, error) { - _, sgHdr := m.LastHeader(HeaderType(StorageGroupHdr)) - if sgHdr == nil { - return nil, ErrHeaderNotFound - } - return sgHdr.Value.(*Header_StorageGroup).StorageGroup, nil -} - -// SetStorageGroup sets storage group header in the object. -// It will replace existing storage group header or add a new one. -func (m *Object) SetStorageGroup(group *storagegroup.StorageGroup) { - m.SetHeader(&Header{Value: &Header_StorageGroup{StorageGroup: group}}) -} diff --git a/object/service.go b/object/service.go deleted file mode 100644 index 0e38d70..0000000 --- a/object/service.go +++ /dev/null @@ -1,196 +0,0 @@ -package object - -import ( - "github.com/nspcc-dev/neofs-api-go/hash" - "github.com/nspcc-dev/neofs-api-go/internal" - "github.com/nspcc-dev/neofs-api-go/refs" - "github.com/nspcc-dev/neofs-api-go/service" - "github.com/nspcc-dev/neofs-api-go/session" -) - -type ( - // ID is a type alias of object id. - ID = refs.ObjectID - - // CID is a type alias of container id. - CID = refs.CID - - // SGID is a type alias of storage group id. - SGID = refs.SGID - - // OwnerID is a type alias of owner id. - OwnerID = refs.OwnerID - - // Hash is a type alias of Homomorphic hash. - Hash = hash.Hash - - // Token is a type alias of session token. - Token = session.Token - - // Request defines object rpc requests. - // All object operations must have TTL, Epoch, Type, Container ID and - // permission of usage previous network map. - Request interface { - service.SeizedRequestMetaContainer - - CID() CID - Type() RequestType - AllowPreviousNetMap() bool - } -) - -const ( - // starts enum for amount of bytes. - _ int64 = 1 << (10 * iota) - - // UnitsKB defines amount of bytes in one kilobyte. - UnitsKB - - // UnitsMB defines amount of bytes in one megabyte. - UnitsMB - - // UnitsGB defines amount of bytes in one gigabyte. - UnitsGB - - // UnitsTB defines amount of bytes in one terabyte. - UnitsTB -) - -const ( - // ErrNotFound is raised when object is not found in the system. - ErrNotFound = internal.Error("could not find object") - - // ErrHeaderExpected is raised when first message in protobuf stream does not contain user header. - ErrHeaderExpected = internal.Error("expected header as a first message in stream") - - // KeyStorageGroup is a key for a search object by storage group id. - KeyStorageGroup = "STORAGE_GROUP" - - // KeyNoChildren is a key for searching object that have no children links. - KeyNoChildren = "LEAF" - - // KeyParent is a key for searching object by id of parent object. - KeyParent = "PARENT" - - // KeyHasParent is a key for searching object that have parent link. - KeyHasParent = "HAS_PAR" - - // KeyTombstone is a key for searching object that have tombstone header. - KeyTombstone = "TOMBSTONE" - - // KeyChild is a key for searching object by id of child link. - KeyChild = "CHILD" - - // KeyPrev is a key for searching object by id of previous link. - KeyPrev = "PREV" - - // KeyNext is a key for searching object by id of next link. - KeyNext = "NEXT" - - // KeyID is a key for searching object by object id. - KeyID = "ID" - - // KeyCID is a key for searching object by container id. - KeyCID = "CID" - - // KeyOwnerID is a key for searching object by owner id. - KeyOwnerID = "OWNERID" - - // KeyRootObject is a key for searching object that are zero-object or do - // not have any children. - KeyRootObject = "ROOT_OBJECT" -) - -func checkIsNotFull(v interface{}) bool { - var obj *Object - - switch t := v.(type) { - case *GetResponse: - obj = t.GetObject() - case *PutRequest: - if h := t.GetHeader(); h != nil { - obj = h.Object - } - default: - panic("unknown type") - } - - return obj == nil || obj.SystemHeader.PayloadLength != uint64(len(obj.Payload)) && !obj.IsLinking() -} - -// NotFull checks if protobuf stream provided whole object for get operation. -func (m *GetResponse) NotFull() bool { return checkIsNotFull(m) } - -// NotFull checks if protobuf stream provided whole object for put operation. -func (m *PutRequest) NotFull() bool { return checkIsNotFull(m) } - -// CID returns container id value from object put request. -func (m *PutRequest) CID() (cid CID) { - if header := m.GetHeader(); header == nil { - return - } else if obj := header.GetObject(); obj == nil { - return - } else { - return obj.SystemHeader.CID - } -} - -// CID returns container id value from object get request. -func (m *GetRequest) CID() CID { return m.Address.CID } - -// CID returns container id value from object head request. -func (m *HeadRequest) CID() CID { return m.Address.CID } - -// CID returns container id value from object search request. -func (m *SearchRequest) CID() CID { return m.ContainerID } - -// CID returns container id value from object delete request. -func (m *DeleteRequest) CID() CID { return m.Address.CID } - -// CID returns container id value from object get range request. -func (m *GetRangeRequest) CID() CID { return m.Address.CID } - -// CID returns container id value from object get range hash request. -func (m *GetRangeHashRequest) CID() CID { return m.Address.CID } - -// AllowPreviousNetMap returns permission to use previous network map in object put request. -func (m *PutRequest) AllowPreviousNetMap() bool { return false } - -// AllowPreviousNetMap returns permission to use previous network map in object get request. -func (m *GetRequest) AllowPreviousNetMap() bool { return true } - -// AllowPreviousNetMap returns permission to use previous network map in object head request. -func (m *HeadRequest) AllowPreviousNetMap() bool { return true } - -// AllowPreviousNetMap returns permission to use previous network map in object search request. -func (m *SearchRequest) AllowPreviousNetMap() bool { return true } - -// AllowPreviousNetMap returns permission to use previous network map in object delete request. -func (m *DeleteRequest) AllowPreviousNetMap() bool { return false } - -// AllowPreviousNetMap returns permission to use previous network map in object get range request. -func (m *GetRangeRequest) AllowPreviousNetMap() bool { return false } - -// AllowPreviousNetMap returns permission to use previous network map in object get range hash request. -func (m *GetRangeHashRequest) AllowPreviousNetMap() bool { return false } - -// Type returns type of the object put request. -func (m *PutRequest) Type() RequestType { return RequestPut } - -// Type returns type of the object get request. -func (m *GetRequest) Type() RequestType { return RequestGet } - -// Type returns type of the object head request. -func (m *HeadRequest) Type() RequestType { return RequestHead } - -// Type returns type of the object search request. -func (m *SearchRequest) Type() RequestType { return RequestSearch } - -// Type returns type of the object delete request. -func (m *DeleteRequest) Type() RequestType { return RequestDelete } - -// Type returns type of the object get range request. -func (m *GetRangeRequest) Type() RequestType { return RequestRange } - -// Type returns type of the object get range hash request. -func (m *GetRangeHashRequest) Type() RequestType { return RequestRangeHash } diff --git a/object/service.pb.go b/object/service.pb.go deleted file mode 100644 index f882f5e..0000000 --- a/object/service.pb.go +++ /dev/null @@ -1,5050 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: object/service.proto - -package object - -import ( - context "context" - fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/golang/protobuf/proto" - refs "github.com/nspcc-dev/neofs-api-go/refs" - service "github.com/nspcc-dev/neofs-api-go/service" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package - -type GetRequest struct { - // Address of object (container id + object id) - Address refs.Address `protobuf:"bytes,1,opt,name=Address,proto3" json:"Address"` - // RequestMetaHeader contains information about request meta headers (should be embedded into message) - service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` - // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) - service.RequestVerificationHeader `protobuf:"bytes,99,opt,name=Verify,proto3,embedded=Verify" json:"Verify"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GetRequest) Reset() { *m = GetRequest{} } -func (m *GetRequest) String() string { return proto.CompactTextString(m) } -func (*GetRequest) ProtoMessage() {} -func (*GetRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_dfcdf610ade6a9ce, []int{0} -} -func (m *GetRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *GetRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *GetRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetRequest.Merge(m, src) -} -func (m *GetRequest) XXX_Size() int { - return m.Size() -} -func (m *GetRequest) XXX_DiscardUnknown() { - xxx_messageInfo_GetRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_GetRequest proto.InternalMessageInfo - -func (m *GetRequest) GetAddress() refs.Address { - if m != nil { - return m.Address - } - return refs.Address{} -} - -type GetResponse struct { - // Types that are valid to be assigned to R: - // *GetResponse_Object - // *GetResponse_Chunk - R isGetResponse_R `protobuf_oneof:"R"` - // ResponseMetaHeader contains meta information based on request processing by server (should be embedded into message) - service.ResponseMetaHeader `protobuf:"bytes,99,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GetResponse) Reset() { *m = GetResponse{} } -func (m *GetResponse) String() string { return proto.CompactTextString(m) } -func (*GetResponse) ProtoMessage() {} -func (*GetResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_dfcdf610ade6a9ce, []int{1} -} -func (m *GetResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *GetResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *GetResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetResponse.Merge(m, src) -} -func (m *GetResponse) XXX_Size() int { - return m.Size() -} -func (m *GetResponse) XXX_DiscardUnknown() { - xxx_messageInfo_GetResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_GetResponse proto.InternalMessageInfo - -type isGetResponse_R interface { - isGetResponse_R() - MarshalTo([]byte) (int, error) - Size() int -} - -type GetResponse_Object struct { - Object *Object `protobuf:"bytes,1,opt,name=object,proto3,oneof" json:"object,omitempty"` -} -type GetResponse_Chunk struct { - Chunk []byte `protobuf:"bytes,2,opt,name=Chunk,proto3,oneof" json:"Chunk,omitempty"` -} - -func (*GetResponse_Object) isGetResponse_R() {} -func (*GetResponse_Chunk) isGetResponse_R() {} - -func (m *GetResponse) GetR() isGetResponse_R { - if m != nil { - return m.R - } - return nil -} - -func (m *GetResponse) GetObject() *Object { - if x, ok := m.GetR().(*GetResponse_Object); ok { - return x.Object - } - return nil -} - -func (m *GetResponse) GetChunk() []byte { - if x, ok := m.GetR().(*GetResponse_Chunk); ok { - return x.Chunk - } - return nil -} - -// XXX_OneofWrappers is for the internal use of the proto package. -func (*GetResponse) XXX_OneofWrappers() []interface{} { - return []interface{}{ - (*GetResponse_Object)(nil), - (*GetResponse_Chunk)(nil), - } -} - -type PutRequest struct { - // Types that are valid to be assigned to R: - // *PutRequest_Header - // *PutRequest_Chunk - R isPutRequest_R `protobuf_oneof:"R"` - // RequestMetaHeader contains information about request meta headers (should be embedded into message) - service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` - // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) - service.RequestVerificationHeader `protobuf:"bytes,99,opt,name=Verify,proto3,embedded=Verify" json:"Verify"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *PutRequest) Reset() { *m = PutRequest{} } -func (m *PutRequest) String() string { return proto.CompactTextString(m) } -func (*PutRequest) ProtoMessage() {} -func (*PutRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_dfcdf610ade6a9ce, []int{2} -} -func (m *PutRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *PutRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *PutRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_PutRequest.Merge(m, src) -} -func (m *PutRequest) XXX_Size() int { - return m.Size() -} -func (m *PutRequest) XXX_DiscardUnknown() { - xxx_messageInfo_PutRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_PutRequest proto.InternalMessageInfo - -type isPutRequest_R interface { - isPutRequest_R() - MarshalTo([]byte) (int, error) - Size() int -} - -type PutRequest_Header struct { - Header *PutRequest_PutHeader `protobuf:"bytes,1,opt,name=Header,proto3,oneof" json:"Header,omitempty"` -} -type PutRequest_Chunk struct { - Chunk []byte `protobuf:"bytes,2,opt,name=Chunk,proto3,oneof" json:"Chunk,omitempty"` -} - -func (*PutRequest_Header) isPutRequest_R() {} -func (*PutRequest_Chunk) isPutRequest_R() {} - -func (m *PutRequest) GetR() isPutRequest_R { - if m != nil { - return m.R - } - return nil -} - -func (m *PutRequest) GetHeader() *PutRequest_PutHeader { - if x, ok := m.GetR().(*PutRequest_Header); ok { - return x.Header - } - return nil -} - -func (m *PutRequest) GetChunk() []byte { - if x, ok := m.GetR().(*PutRequest_Chunk); ok { - return x.Chunk - } - return nil -} - -// XXX_OneofWrappers is for the internal use of the proto package. -func (*PutRequest) XXX_OneofWrappers() []interface{} { - return []interface{}{ - (*PutRequest_Header)(nil), - (*PutRequest_Chunk)(nil), - } -} - -type PutRequest_PutHeader struct { - // Object with at least container id and owner id fields - Object *Object `protobuf:"bytes,1,opt,name=Object,proto3" json:"Object,omitempty"` - // Number of the object copies to store within the RPC call (zero is processed according to the placement rules) - CopiesNumber uint32 `protobuf:"varint,2,opt,name=CopiesNumber,proto3" json:"CopiesNumber,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *PutRequest_PutHeader) Reset() { *m = PutRequest_PutHeader{} } -func (m *PutRequest_PutHeader) String() string { return proto.CompactTextString(m) } -func (*PutRequest_PutHeader) ProtoMessage() {} -func (*PutRequest_PutHeader) Descriptor() ([]byte, []int) { - return fileDescriptor_dfcdf610ade6a9ce, []int{2, 0} -} -func (m *PutRequest_PutHeader) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *PutRequest_PutHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *PutRequest_PutHeader) XXX_Merge(src proto.Message) { - xxx_messageInfo_PutRequest_PutHeader.Merge(m, src) -} -func (m *PutRequest_PutHeader) XXX_Size() int { - return m.Size() -} -func (m *PutRequest_PutHeader) XXX_DiscardUnknown() { - xxx_messageInfo_PutRequest_PutHeader.DiscardUnknown(m) -} - -var xxx_messageInfo_PutRequest_PutHeader proto.InternalMessageInfo - -func (m *PutRequest_PutHeader) GetObject() *Object { - if m != nil { - return m.Object - } - return nil -} - -func (m *PutRequest_PutHeader) GetCopiesNumber() uint32 { - if m != nil { - return m.CopiesNumber - } - return 0 -} - -type PutResponse struct { - // Address of object (container id + object id) - Address refs.Address `protobuf:"bytes,1,opt,name=Address,proto3" json:"Address"` - // ResponseMetaHeader contains meta information based on request processing by server (should be embedded into message) - service.ResponseMetaHeader `protobuf:"bytes,99,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *PutResponse) Reset() { *m = PutResponse{} } -func (m *PutResponse) String() string { return proto.CompactTextString(m) } -func (*PutResponse) ProtoMessage() {} -func (*PutResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_dfcdf610ade6a9ce, []int{3} -} -func (m *PutResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *PutResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *PutResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_PutResponse.Merge(m, src) -} -func (m *PutResponse) XXX_Size() int { - return m.Size() -} -func (m *PutResponse) XXX_DiscardUnknown() { - xxx_messageInfo_PutResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_PutResponse proto.InternalMessageInfo - -func (m *PutResponse) GetAddress() refs.Address { - if m != nil { - return m.Address - } - return refs.Address{} -} - -type DeleteRequest struct { - // Address of object (container id + object id) - Address refs.Address `protobuf:"bytes,1,opt,name=Address,proto3" json:"Address"` - // OwnerID is a wallet address - OwnerID OwnerID `protobuf:"bytes,2,opt,name=OwnerID,proto3,customtype=OwnerID" json:"OwnerID"` - // RequestMetaHeader contains information about request meta headers (should be embedded into message) - service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` - // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) - service.RequestVerificationHeader `protobuf:"bytes,99,opt,name=Verify,proto3,embedded=Verify" json:"Verify"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *DeleteRequest) Reset() { *m = DeleteRequest{} } -func (m *DeleteRequest) String() string { return proto.CompactTextString(m) } -func (*DeleteRequest) ProtoMessage() {} -func (*DeleteRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_dfcdf610ade6a9ce, []int{4} -} -func (m *DeleteRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *DeleteRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *DeleteRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_DeleteRequest.Merge(m, src) -} -func (m *DeleteRequest) XXX_Size() int { - return m.Size() -} -func (m *DeleteRequest) XXX_DiscardUnknown() { - xxx_messageInfo_DeleteRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_DeleteRequest proto.InternalMessageInfo - -func (m *DeleteRequest) GetAddress() refs.Address { - if m != nil { - return m.Address - } - return refs.Address{} -} - -// DeleteResponse is empty because we cannot guarantee permanent object removal -// in distributed system. -type DeleteResponse struct { - // ResponseMetaHeader contains meta information based on request processing by server (should be embedded into message) - service.ResponseMetaHeader `protobuf:"bytes,99,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *DeleteResponse) Reset() { *m = DeleteResponse{} } -func (m *DeleteResponse) String() string { return proto.CompactTextString(m) } -func (*DeleteResponse) ProtoMessage() {} -func (*DeleteResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_dfcdf610ade6a9ce, []int{5} -} -func (m *DeleteResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *DeleteResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *DeleteResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_DeleteResponse.Merge(m, src) -} -func (m *DeleteResponse) XXX_Size() int { - return m.Size() -} -func (m *DeleteResponse) XXX_DiscardUnknown() { - xxx_messageInfo_DeleteResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_DeleteResponse proto.InternalMessageInfo - -type HeadRequest struct { - // Address of object (container id + object id) - Address Address `protobuf:"bytes,1,opt,name=Address,proto3,customtype=Address" json:"Address"` - // FullHeaders can be set true for extended headers in the object - FullHeaders bool `protobuf:"varint,2,opt,name=FullHeaders,proto3" json:"FullHeaders,omitempty"` - // RequestMetaHeader contains information about request meta headers (should be embedded into message) - service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` - // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) - service.RequestVerificationHeader `protobuf:"bytes,99,opt,name=Verify,proto3,embedded=Verify" json:"Verify"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *HeadRequest) Reset() { *m = HeadRequest{} } -func (m *HeadRequest) String() string { return proto.CompactTextString(m) } -func (*HeadRequest) ProtoMessage() {} -func (*HeadRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_dfcdf610ade6a9ce, []int{6} -} -func (m *HeadRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *HeadRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *HeadRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_HeadRequest.Merge(m, src) -} -func (m *HeadRequest) XXX_Size() int { - return m.Size() -} -func (m *HeadRequest) XXX_DiscardUnknown() { - xxx_messageInfo_HeadRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_HeadRequest proto.InternalMessageInfo - -func (m *HeadRequest) GetFullHeaders() bool { - if m != nil { - return m.FullHeaders - } - return false -} - -type HeadResponse struct { - // Object without payload - Object *Object `protobuf:"bytes,1,opt,name=Object,proto3" json:"Object,omitempty"` - // ResponseMetaHeader contains meta information based on request processing by server (should be embedded into message) - service.ResponseMetaHeader `protobuf:"bytes,99,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *HeadResponse) Reset() { *m = HeadResponse{} } -func (m *HeadResponse) String() string { return proto.CompactTextString(m) } -func (*HeadResponse) ProtoMessage() {} -func (*HeadResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_dfcdf610ade6a9ce, []int{7} -} -func (m *HeadResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *HeadResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *HeadResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_HeadResponse.Merge(m, src) -} -func (m *HeadResponse) XXX_Size() int { - return m.Size() -} -func (m *HeadResponse) XXX_DiscardUnknown() { - xxx_messageInfo_HeadResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_HeadResponse proto.InternalMessageInfo - -func (m *HeadResponse) GetObject() *Object { - if m != nil { - return m.Object - } - return nil -} - -type SearchRequest struct { - // ContainerID for searching the object - ContainerID CID `protobuf:"bytes,1,opt,name=ContainerID,proto3,customtype=CID" json:"ContainerID"` - // Query in the binary serialized format - Query []byte `protobuf:"bytes,2,opt,name=Query,proto3" json:"Query,omitempty"` - // QueryVersion is a version of search query format - QueryVersion uint32 `protobuf:"varint,3,opt,name=QueryVersion,proto3" json:"QueryVersion,omitempty"` - // RequestMetaHeader contains information about request meta headers (should be embedded into message) - service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` - // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) - service.RequestVerificationHeader `protobuf:"bytes,99,opt,name=Verify,proto3,embedded=Verify" json:"Verify"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *SearchRequest) Reset() { *m = SearchRequest{} } -func (m *SearchRequest) String() string { return proto.CompactTextString(m) } -func (*SearchRequest) ProtoMessage() {} -func (*SearchRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_dfcdf610ade6a9ce, []int{8} -} -func (m *SearchRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *SearchRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *SearchRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_SearchRequest.Merge(m, src) -} -func (m *SearchRequest) XXX_Size() int { - return m.Size() -} -func (m *SearchRequest) XXX_DiscardUnknown() { - xxx_messageInfo_SearchRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_SearchRequest proto.InternalMessageInfo - -func (m *SearchRequest) GetQuery() []byte { - if m != nil { - return m.Query - } - return nil -} - -func (m *SearchRequest) GetQueryVersion() uint32 { - if m != nil { - return m.QueryVersion - } - return 0 -} - -type SearchResponse struct { - // Addresses of found objects - Addresses []refs.Address `protobuf:"bytes,1,rep,name=Addresses,proto3" json:"Addresses"` - // ResponseMetaHeader contains meta information based on request processing by server (should be embedded into message) - service.ResponseMetaHeader `protobuf:"bytes,99,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *SearchResponse) Reset() { *m = SearchResponse{} } -func (m *SearchResponse) String() string { return proto.CompactTextString(m) } -func (*SearchResponse) ProtoMessage() {} -func (*SearchResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_dfcdf610ade6a9ce, []int{9} -} -func (m *SearchResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *SearchResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *SearchResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_SearchResponse.Merge(m, src) -} -func (m *SearchResponse) XXX_Size() int { - return m.Size() -} -func (m *SearchResponse) XXX_DiscardUnknown() { - xxx_messageInfo_SearchResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_SearchResponse proto.InternalMessageInfo - -func (m *SearchResponse) GetAddresses() []refs.Address { - if m != nil { - return m.Addresses - } - return nil -} - -type GetRangeRequest struct { - // Address of object (container id + object id) - Address refs.Address `protobuf:"bytes,1,opt,name=Address,proto3" json:"Address"` - // Range of object's payload to return - Range Range `protobuf:"bytes,2,opt,name=Range,proto3" json:"Range"` - // RequestMetaHeader contains information about request meta headers (should be embedded into message) - service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` - // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) - service.RequestVerificationHeader `protobuf:"bytes,99,opt,name=Verify,proto3,embedded=Verify" json:"Verify"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GetRangeRequest) Reset() { *m = GetRangeRequest{} } -func (m *GetRangeRequest) String() string { return proto.CompactTextString(m) } -func (*GetRangeRequest) ProtoMessage() {} -func (*GetRangeRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_dfcdf610ade6a9ce, []int{10} -} -func (m *GetRangeRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *GetRangeRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *GetRangeRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetRangeRequest.Merge(m, src) -} -func (m *GetRangeRequest) XXX_Size() int { - return m.Size() -} -func (m *GetRangeRequest) XXX_DiscardUnknown() { - xxx_messageInfo_GetRangeRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_GetRangeRequest proto.InternalMessageInfo - -func (m *GetRangeRequest) GetAddress() refs.Address { - if m != nil { - return m.Address - } - return refs.Address{} -} - -func (m *GetRangeRequest) GetRange() Range { - if m != nil { - return m.Range - } - return Range{} -} - -type GetRangeResponse struct { - // Fragment of object's payload - Fragment []byte `protobuf:"bytes,1,opt,name=Fragment,proto3" json:"Fragment,omitempty"` - // ResponseMetaHeader contains meta information based on request processing by server (should be embedded into message) - service.ResponseMetaHeader `protobuf:"bytes,99,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GetRangeResponse) Reset() { *m = GetRangeResponse{} } -func (m *GetRangeResponse) String() string { return proto.CompactTextString(m) } -func (*GetRangeResponse) ProtoMessage() {} -func (*GetRangeResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_dfcdf610ade6a9ce, []int{11} -} -func (m *GetRangeResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *GetRangeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *GetRangeResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetRangeResponse.Merge(m, src) -} -func (m *GetRangeResponse) XXX_Size() int { - return m.Size() -} -func (m *GetRangeResponse) XXX_DiscardUnknown() { - xxx_messageInfo_GetRangeResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_GetRangeResponse proto.InternalMessageInfo - -func (m *GetRangeResponse) GetFragment() []byte { - if m != nil { - return m.Fragment - } - return nil -} - -type GetRangeHashRequest struct { - // Address of object (container id + object id) - Address refs.Address `protobuf:"bytes,1,opt,name=Address,proto3" json:"Address"` - // Ranges of object's payload to calculate homomorphic hash - Ranges []Range `protobuf:"bytes,2,rep,name=Ranges,proto3" json:"Ranges"` - // Salt is used to XOR object's payload ranges before hashing, it can be nil - Salt []byte `protobuf:"bytes,3,opt,name=Salt,proto3" json:"Salt,omitempty"` - // RequestMetaHeader contains information about request meta headers (should be embedded into message) - service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` - // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) - service.RequestVerificationHeader `protobuf:"bytes,99,opt,name=Verify,proto3,embedded=Verify" json:"Verify"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GetRangeHashRequest) Reset() { *m = GetRangeHashRequest{} } -func (m *GetRangeHashRequest) String() string { return proto.CompactTextString(m) } -func (*GetRangeHashRequest) ProtoMessage() {} -func (*GetRangeHashRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_dfcdf610ade6a9ce, []int{12} -} -func (m *GetRangeHashRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *GetRangeHashRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *GetRangeHashRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetRangeHashRequest.Merge(m, src) -} -func (m *GetRangeHashRequest) XXX_Size() int { - return m.Size() -} -func (m *GetRangeHashRequest) XXX_DiscardUnknown() { - xxx_messageInfo_GetRangeHashRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_GetRangeHashRequest proto.InternalMessageInfo - -func (m *GetRangeHashRequest) GetAddress() refs.Address { - if m != nil { - return m.Address - } - return refs.Address{} -} - -func (m *GetRangeHashRequest) GetRanges() []Range { - if m != nil { - return m.Ranges - } - return nil -} - -func (m *GetRangeHashRequest) GetSalt() []byte { - if m != nil { - return m.Salt - } - return nil -} - -type GetRangeHashResponse struct { - // Hashes is a homomorphic hashes of all ranges - Hashes []Hash `protobuf:"bytes,1,rep,name=Hashes,proto3,customtype=Hash" json:"Hashes"` - // ResponseMetaHeader contains meta information based on request processing by server (should be embedded into message) - service.ResponseMetaHeader `protobuf:"bytes,99,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GetRangeHashResponse) Reset() { *m = GetRangeHashResponse{} } -func (m *GetRangeHashResponse) String() string { return proto.CompactTextString(m) } -func (*GetRangeHashResponse) ProtoMessage() {} -func (*GetRangeHashResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_dfcdf610ade6a9ce, []int{13} -} -func (m *GetRangeHashResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *GetRangeHashResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *GetRangeHashResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetRangeHashResponse.Merge(m, src) -} -func (m *GetRangeHashResponse) XXX_Size() int { - return m.Size() -} -func (m *GetRangeHashResponse) XXX_DiscardUnknown() { - xxx_messageInfo_GetRangeHashResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_GetRangeHashResponse proto.InternalMessageInfo - -func init() { - proto.RegisterType((*GetRequest)(nil), "object.GetRequest") - proto.RegisterType((*GetResponse)(nil), "object.GetResponse") - proto.RegisterType((*PutRequest)(nil), "object.PutRequest") - proto.RegisterType((*PutRequest_PutHeader)(nil), "object.PutRequest.PutHeader") - proto.RegisterType((*PutResponse)(nil), "object.PutResponse") - proto.RegisterType((*DeleteRequest)(nil), "object.DeleteRequest") - proto.RegisterType((*DeleteResponse)(nil), "object.DeleteResponse") - proto.RegisterType((*HeadRequest)(nil), "object.HeadRequest") - proto.RegisterType((*HeadResponse)(nil), "object.HeadResponse") - proto.RegisterType((*SearchRequest)(nil), "object.SearchRequest") - proto.RegisterType((*SearchResponse)(nil), "object.SearchResponse") - proto.RegisterType((*GetRangeRequest)(nil), "object.GetRangeRequest") - proto.RegisterType((*GetRangeResponse)(nil), "object.GetRangeResponse") - proto.RegisterType((*GetRangeHashRequest)(nil), "object.GetRangeHashRequest") - proto.RegisterType((*GetRangeHashResponse)(nil), "object.GetRangeHashResponse") -} - -func init() { proto.RegisterFile("object/service.proto", fileDescriptor_dfcdf610ade6a9ce) } - -var fileDescriptor_dfcdf610ade6a9ce = []byte{ - // 876 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x56, 0x4b, 0x6f, 0x22, 0x47, - 0x10, 0xa6, 0x01, 0x8f, 0x71, 0x31, 0xd8, 0x56, 0x9b, 0x38, 0x68, 0x6c, 0x61, 0x0b, 0x45, 0x11, - 0x51, 0xc4, 0xe0, 0x38, 0x52, 0xe2, 0x9c, 0x22, 0x03, 0xb2, 0x41, 0x51, 0xfc, 0x18, 0x24, 0x47, - 0xca, 0x6d, 0x18, 0x1a, 0x98, 0x04, 0x66, 0xf0, 0x3c, 0x6c, 0xf9, 0x92, 0x5b, 0xce, 0xb9, 0xe6, - 0xb8, 0xe7, 0xfd, 0x09, 0xbb, 0x7f, 0xc0, 0x47, 0x1f, 0x57, 0x7b, 0xb0, 0x56, 0xec, 0x69, 0xb5, - 0x7f, 0x60, 0x8f, 0xab, 0xe9, 0xee, 0x79, 0xd9, 0xcb, 0x3e, 0xe0, 0xc0, 0x69, 0xba, 0xbf, 0xfa, - 0xaa, 0xba, 0xea, 0xeb, 0xea, 0xee, 0x81, 0xbc, 0xd9, 0xf9, 0x8b, 0x68, 0x4e, 0xd5, 0x26, 0xd6, - 0x95, 0xae, 0x11, 0x79, 0x6c, 0x99, 0x8e, 0x89, 0x05, 0x86, 0x4a, 0xeb, 0x16, 0xe9, 0xd9, 0x55, - 0xe7, 0x66, 0x4c, 0x6c, 0x66, 0x91, 0x30, 0xe7, 0xc7, 0x30, 0xee, 0x5c, 0x1d, 0x11, 0x47, 0xe5, - 0x58, 0xde, 0xc7, 0xae, 0x88, 0xa5, 0xf7, 0x6e, 0x38, 0x5a, 0xe9, 0xeb, 0xce, 0xc0, 0xed, 0xc8, - 0x9a, 0x39, 0xaa, 0xf6, 0xcd, 0xbe, 0x59, 0xa5, 0x70, 0xc7, 0xed, 0xd1, 0x19, 0x9d, 0xd0, 0x11, - 0xa3, 0x97, 0x9e, 0x23, 0x80, 0x63, 0xe2, 0x28, 0xe4, 0xd2, 0x25, 0xb6, 0x83, 0x2b, 0xb0, 0x7c, - 0xd8, 0xed, 0x5a, 0xc4, 0xb6, 0x0b, 0x68, 0x17, 0x95, 0xb3, 0xfb, 0x39, 0xd9, 0xcb, 0x4f, 0xe6, - 0x60, 0x2d, 0x7d, 0x7b, 0xbf, 0x93, 0x50, 0x7c, 0x0e, 0x3e, 0x80, 0xf4, 0xef, 0xc4, 0x51, 0x0b, - 0x1d, 0xca, 0x95, 0x64, 0xbf, 0x44, 0x1e, 0xce, 0xb3, 0x35, 0x89, 0xda, 0x25, 0x56, 0x2d, 0xe3, - 0x39, 0xde, 0xdd, 0xef, 0x20, 0x85, 0x7a, 0xe0, 0x06, 0x08, 0x17, 0x34, 0xed, 0x82, 0x46, 0x7d, - 0x4b, 0x0f, 0x7d, 0xa9, 0x55, 0xd7, 0x54, 0x47, 0x37, 0x8d, 0x47, 0x31, 0xb8, 0x6f, 0xe9, 0x3f, - 0x04, 0x59, 0x9a, 0xbd, 0x3d, 0x36, 0x0d, 0x9b, 0xe0, 0x32, 0x70, 0x59, 0x79, 0xf6, 0xab, 0x32, - 0x9b, 0xca, 0xa7, 0xf4, 0xd3, 0x4c, 0x28, 0xdc, 0x8e, 0x37, 0x61, 0xa9, 0x3e, 0x70, 0x8d, 0xbf, - 0x0b, 0xc9, 0x5d, 0x54, 0x16, 0x9b, 0x09, 0x85, 0x4d, 0xf1, 0x2f, 0xbc, 0x22, 0x96, 0xd5, 0x56, - 0x24, 0x2b, 0xb6, 0xc4, 0xf4, 0x92, 0x6a, 0x29, 0x40, 0x4a, 0xe9, 0x59, 0x12, 0xe0, 0xcc, 0x0d, - 0xf4, 0xfc, 0x09, 0x04, 0xc6, 0xe6, 0x09, 0x6d, 0xfb, 0x09, 0x85, 0x1c, 0x6f, 0xc8, 0x38, 0x5e, - 0x7a, 0x6c, 0x34, 0x35, 0xbd, 0x05, 0x0b, 0x2e, 0xfd, 0x01, 0x2b, 0x41, 0xba, 0xf8, 0x5b, 0x10, - 0x4e, 0x3f, 0xa2, 0xb6, 0xc2, 0xad, 0xb8, 0x04, 0x62, 0xdd, 0x1c, 0xeb, 0xc4, 0x3e, 0x71, 0x47, - 0x1d, 0x62, 0xd1, 0x9a, 0x72, 0x4a, 0x0c, 0x63, 0xe2, 0x5d, 0x43, 0x96, 0xea, 0xc2, 0x77, 0xf3, - 0x0b, 0x9b, 0x71, 0xf6, 0xad, 0x2b, 0xbd, 0x41, 0x90, 0x6b, 0x90, 0x21, 0x71, 0xc8, 0x8c, 0x07, - 0xe1, 0x3b, 0x58, 0x3e, 0xbd, 0x36, 0x88, 0xd5, 0x6a, 0xb0, 0x1d, 0xab, 0xad, 0x79, 0xf6, 0x97, - 0xf7, 0x3b, 0x3e, 0xac, 0xf8, 0x83, 0x85, 0x9f, 0x99, 0xdf, 0x60, 0xd5, 0x2f, 0x95, 0xeb, 0x3c, - 0x9f, 0x70, 0x59, 0xcf, 0xe4, 0xcb, 0x76, 0xf0, 0x09, 0xd9, 0x02, 0x59, 0x38, 0x10, 0x2a, 0xb8, - 0x0b, 0xd9, 0x23, 0x77, 0x38, 0x64, 0xeb, 0xd8, 0x54, 0xc5, 0x8c, 0x12, 0x85, 0x16, 0x2e, 0xdc, - 0x25, 0x88, 0xac, 0x54, 0x2e, 0xdb, 0xe7, 0xb6, 0xff, 0x1c, 0xf2, 0xbe, 0x43, 0x90, 0x6b, 0x13, - 0xd5, 0xd2, 0x06, 0x61, 0x5f, 0x66, 0xeb, 0xa6, 0xe1, 0xa8, 0x3a, 0x6b, 0x36, 0x44, 0x9b, 0x2d, - 0xcb, 0x55, 0x4d, 0xd5, 0x5b, 0x0d, 0x25, 0x6a, 0xc7, 0x79, 0x58, 0x3a, 0x77, 0x89, 0x75, 0xc3, - 0xba, 0x52, 0x61, 0x13, 0xef, 0x40, 0xd2, 0xc1, 0x05, 0xb1, 0x6c, 0xdd, 0x34, 0x0a, 0x29, 0x76, - 0x20, 0xa3, 0xd8, 0xc2, 0xd5, 0xfe, 0x07, 0x56, 0xfd, 0xca, 0xb9, 0xde, 0x3f, 0xc0, 0x0a, 0x6f, - 0x16, 0xe2, 0x75, 0x57, 0x6a, 0xda, 0xa1, 0x0c, 0x59, 0xf3, 0x48, 0xff, 0x16, 0xc1, 0x9a, 0xf7, - 0xb4, 0xa8, 0x46, 0x7f, 0xf6, 0x4b, 0x61, 0x89, 0xba, 0x53, 0xf1, 0x3d, 0x32, 0xef, 0x0f, 0x0a, - 0x72, 0x32, 0x63, 0x2c, 0x5c, 0x6d, 0x1d, 0xd6, 0xc3, 0x62, 0xb9, 0xde, 0x12, 0x64, 0x8e, 0x2c, - 0xb5, 0x3f, 0x22, 0x06, 0xeb, 0x70, 0x51, 0x09, 0xe6, 0xf3, 0x08, 0xfb, 0x6f, 0x12, 0x36, 0xfc, - 0xb5, 0x9a, 0xaa, 0x3d, 0x98, 0x51, 0xdc, 0xef, 0x41, 0xa0, 0x21, 0xbc, 0xab, 0x22, 0x35, 0x4d, - 0x5d, 0x4e, 0xc1, 0x18, 0xd2, 0x6d, 0x75, 0xe8, 0xd0, 0x46, 0x17, 0x15, 0x3a, 0x5e, 0xb8, 0xe4, - 0xd7, 0x90, 0x8f, 0xcb, 0xc0, 0x65, 0xff, 0x06, 0x04, 0x6f, 0xce, 0x7b, 0x5c, 0xac, 0x89, 0xfc, - 0x70, 0xa7, 0x29, 0x8b, 0xdb, 0xe6, 0xd8, 0x80, 0xfd, 0x27, 0x29, 0x58, 0x6e, 0x33, 0x3a, 0xde, - 0x83, 0xd4, 0x31, 0x71, 0x30, 0xf6, 0xc5, 0x0b, 0x7f, 0x05, 0xa5, 0x8d, 0x18, 0xc6, 0xa2, 0xee, - 0x21, 0xcf, 0xe3, 0xcc, 0x8d, 0x78, 0x84, 0x3f, 0x32, 0xa1, 0x47, 0xe4, 0x11, 0x2f, 0x23, 0xfc, - 0x33, 0x08, 0xec, 0xc1, 0xc1, 0x5f, 0xf9, 0x84, 0xd8, 0x5b, 0x2b, 0x6d, 0x3e, 0x84, 0x83, 0x03, - 0x9f, 0xf6, 0x4a, 0xc0, 0x41, 0xdc, 0xc8, 0x4b, 0x23, 0xe5, 0xe3, 0x60, 0xf0, 0x94, 0x09, 0xec, - 0xd6, 0x08, 0xd7, 0x8a, 0xdd, 0x9f, 0xe1, 0x5a, 0xf1, 0xcb, 0x65, 0x0f, 0xe1, 0x5f, 0x21, 0xe3, - 0xef, 0x07, 0xfe, 0x3a, 0x5a, 0x7b, 0xe4, 0x06, 0x90, 0x0a, 0x8f, 0x0d, 0x41, 0x80, 0x16, 0x88, - 0xd1, 0x0d, 0xc5, 0x5b, 0x0f, 0xb9, 0x91, 0x6e, 0x97, 0xb6, 0x3f, 0x6c, 0x64, 0xc1, 0x6a, 0xe7, - 0xb7, 0x93, 0x22, 0xba, 0x9b, 0x14, 0xd1, 0x8b, 0x49, 0x11, 0xbd, 0x9a, 0x14, 0xd1, 0xff, 0xaf, - 0x8b, 0x89, 0x3f, 0xcb, 0x91, 0x5f, 0x7b, 0xc3, 0x1e, 0x6b, 0x5a, 0xa5, 0x4b, 0xae, 0xaa, 0x06, - 0x31, 0x7b, 0x76, 0x45, 0x1d, 0xeb, 0x95, 0xbe, 0x59, 0x65, 0x41, 0x9f, 0x26, 0xd7, 0x4f, 0x88, - 0x79, 0xd4, 0x96, 0x0f, 0xcf, 0x5a, 0xfc, 0x35, 0xea, 0x08, 0xf4, 0x7f, 0xff, 0xc7, 0xf7, 0x01, - 0x00, 0x00, 0xff, 0xff, 0x71, 0xb8, 0x50, 0x3f, 0x8e, 0x0c, 0x00, 0x00, -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 - -// ServiceClient is the client API for Service service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type ServiceClient interface { - // Get the object from container. Response uses gRPC stream. First response - // message carry object of requested address. Chunk messages are parts of - // the object's payload if it is needed. All messages except first carry - // chunks. Requested object can be restored by concatenation of object - // message payload and all chunks keeping receiving order. - Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (Service_GetClient, error) - // Put the object into container. Request uses gRPC stream. First message - // SHOULD BE type of PutHeader. Container id and Owner id of object SHOULD - // BE set. Session token SHOULD BE obtained before put operation (see - // session package). Chunk messages considered by server as part of object - // payload. All messages except first SHOULD BE chunks. Chunk messages - // SHOULD BE sent in direct order of fragmentation. - Put(ctx context.Context, opts ...grpc.CallOption) (Service_PutClient, error) - // Delete the object from a container - Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteResponse, error) - // Head returns the object without data payload. Object in the - // response has system header only. If full headers flag is set, extended - // headers are also present. - Head(ctx context.Context, in *HeadRequest, opts ...grpc.CallOption) (*HeadResponse, error) - // Search objects in container. Version of query language format SHOULD BE - // set to 1. Search query represented in serialized format (see query - // package). - Search(ctx context.Context, in *SearchRequest, opts ...grpc.CallOption) (Service_SearchClient, error) - // GetRange of data payload. Range is a pair (offset, length). - // Requested range can be restored by concatenation of all chunks - // keeping receiving order. - GetRange(ctx context.Context, in *GetRangeRequest, opts ...grpc.CallOption) (Service_GetRangeClient, error) - // GetRangeHash returns homomorphic hash of object payload range after XOR - // operation. Ranges are set of pairs (offset, length). Hashes order in - // response corresponds to ranges order in request. Homomorphic hash is - // calculated for XORed data. - GetRangeHash(ctx context.Context, in *GetRangeHashRequest, opts ...grpc.CallOption) (*GetRangeHashResponse, error) -} - -type serviceClient struct { - cc *grpc.ClientConn -} - -func NewServiceClient(cc *grpc.ClientConn) ServiceClient { - return &serviceClient{cc} -} - -func (c *serviceClient) Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (Service_GetClient, error) { - stream, err := c.cc.NewStream(ctx, &_Service_serviceDesc.Streams[0], "/object.Service/Get", opts...) - if err != nil { - return nil, err - } - x := &serviceGetClient{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 -} - -type Service_GetClient interface { - Recv() (*GetResponse, error) - grpc.ClientStream -} - -type serviceGetClient struct { - grpc.ClientStream -} - -func (x *serviceGetClient) Recv() (*GetResponse, error) { - m := new(GetResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *serviceClient) Put(ctx context.Context, opts ...grpc.CallOption) (Service_PutClient, error) { - stream, err := c.cc.NewStream(ctx, &_Service_serviceDesc.Streams[1], "/object.Service/Put", opts...) - if err != nil { - return nil, err - } - x := &servicePutClient{stream} - return x, nil -} - -type Service_PutClient interface { - Send(*PutRequest) error - CloseAndRecv() (*PutResponse, error) - grpc.ClientStream -} - -type servicePutClient struct { - grpc.ClientStream -} - -func (x *servicePutClient) Send(m *PutRequest) error { - return x.ClientStream.SendMsg(m) -} - -func (x *servicePutClient) CloseAndRecv() (*PutResponse, error) { - if err := x.ClientStream.CloseSend(); err != nil { - return nil, err - } - m := new(PutResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *serviceClient) Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteResponse, error) { - out := new(DeleteResponse) - err := c.cc.Invoke(ctx, "/object.Service/Delete", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) Head(ctx context.Context, in *HeadRequest, opts ...grpc.CallOption) (*HeadResponse, error) { - out := new(HeadResponse) - err := c.cc.Invoke(ctx, "/object.Service/Head", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) Search(ctx context.Context, in *SearchRequest, opts ...grpc.CallOption) (Service_SearchClient, error) { - stream, err := c.cc.NewStream(ctx, &_Service_serviceDesc.Streams[2], "/object.Service/Search", opts...) - if err != nil { - return nil, err - } - x := &serviceSearchClient{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 -} - -type Service_SearchClient interface { - Recv() (*SearchResponse, error) - grpc.ClientStream -} - -type serviceSearchClient struct { - grpc.ClientStream -} - -func (x *serviceSearchClient) Recv() (*SearchResponse, error) { - m := new(SearchResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *serviceClient) GetRange(ctx context.Context, in *GetRangeRequest, opts ...grpc.CallOption) (Service_GetRangeClient, error) { - stream, err := c.cc.NewStream(ctx, &_Service_serviceDesc.Streams[3], "/object.Service/GetRange", opts...) - if err != nil { - return nil, err - } - x := &serviceGetRangeClient{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 -} - -type Service_GetRangeClient interface { - Recv() (*GetRangeResponse, error) - grpc.ClientStream -} - -type serviceGetRangeClient struct { - grpc.ClientStream -} - -func (x *serviceGetRangeClient) Recv() (*GetRangeResponse, error) { - m := new(GetRangeResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *serviceClient) GetRangeHash(ctx context.Context, in *GetRangeHashRequest, opts ...grpc.CallOption) (*GetRangeHashResponse, error) { - out := new(GetRangeHashResponse) - err := c.cc.Invoke(ctx, "/object.Service/GetRangeHash", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// ServiceServer is the server API for Service service. -type ServiceServer interface { - // Get the object from container. Response uses gRPC stream. First response - // message carry object of requested address. Chunk messages are parts of - // the object's payload if it is needed. All messages except first carry - // chunks. Requested object can be restored by concatenation of object - // message payload and all chunks keeping receiving order. - Get(*GetRequest, Service_GetServer) error - // Put the object into container. Request uses gRPC stream. First message - // SHOULD BE type of PutHeader. Container id and Owner id of object SHOULD - // BE set. Session token SHOULD BE obtained before put operation (see - // session package). Chunk messages considered by server as part of object - // payload. All messages except first SHOULD BE chunks. Chunk messages - // SHOULD BE sent in direct order of fragmentation. - Put(Service_PutServer) error - // Delete the object from a container - Delete(context.Context, *DeleteRequest) (*DeleteResponse, error) - // Head returns the object without data payload. Object in the - // response has system header only. If full headers flag is set, extended - // headers are also present. - Head(context.Context, *HeadRequest) (*HeadResponse, error) - // Search objects in container. Version of query language format SHOULD BE - // set to 1. Search query represented in serialized format (see query - // package). - Search(*SearchRequest, Service_SearchServer) error - // GetRange of data payload. Range is a pair (offset, length). - // Requested range can be restored by concatenation of all chunks - // keeping receiving order. - GetRange(*GetRangeRequest, Service_GetRangeServer) error - // GetRangeHash returns homomorphic hash of object payload range after XOR - // operation. Ranges are set of pairs (offset, length). Hashes order in - // response corresponds to ranges order in request. Homomorphic hash is - // calculated for XORed data. - GetRangeHash(context.Context, *GetRangeHashRequest) (*GetRangeHashResponse, error) -} - -// UnimplementedServiceServer can be embedded to have forward compatible implementations. -type UnimplementedServiceServer struct { -} - -func (*UnimplementedServiceServer) Get(req *GetRequest, srv Service_GetServer) error { - return status.Errorf(codes.Unimplemented, "method Get not implemented") -} -func (*UnimplementedServiceServer) Put(srv Service_PutServer) error { - return status.Errorf(codes.Unimplemented, "method Put not implemented") -} -func (*UnimplementedServiceServer) Delete(ctx context.Context, req *DeleteRequest) (*DeleteResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Delete not implemented") -} -func (*UnimplementedServiceServer) Head(ctx context.Context, req *HeadRequest) (*HeadResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Head not implemented") -} -func (*UnimplementedServiceServer) Search(req *SearchRequest, srv Service_SearchServer) error { - return status.Errorf(codes.Unimplemented, "method Search not implemented") -} -func (*UnimplementedServiceServer) GetRange(req *GetRangeRequest, srv Service_GetRangeServer) error { - return status.Errorf(codes.Unimplemented, "method GetRange not implemented") -} -func (*UnimplementedServiceServer) GetRangeHash(ctx context.Context, req *GetRangeHashRequest) (*GetRangeHashResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetRangeHash not implemented") -} - -func RegisterServiceServer(s *grpc.Server, srv ServiceServer) { - s.RegisterService(&_Service_serviceDesc, srv) -} - -func _Service_Get_Handler(srv interface{}, stream grpc.ServerStream) error { - m := new(GetRequest) - if err := stream.RecvMsg(m); err != nil { - return err - } - return srv.(ServiceServer).Get(m, &serviceGetServer{stream}) -} - -type Service_GetServer interface { - Send(*GetResponse) error - grpc.ServerStream -} - -type serviceGetServer struct { - grpc.ServerStream -} - -func (x *serviceGetServer) Send(m *GetResponse) error { - return x.ServerStream.SendMsg(m) -} - -func _Service_Put_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(ServiceServer).Put(&servicePutServer{stream}) -} - -type Service_PutServer interface { - SendAndClose(*PutResponse) error - Recv() (*PutRequest, error) - grpc.ServerStream -} - -type servicePutServer struct { - grpc.ServerStream -} - -func (x *servicePutServer) SendAndClose(m *PutResponse) error { - return x.ServerStream.SendMsg(m) -} - -func (x *servicePutServer) Recv() (*PutRequest, error) { - m := new(PutRequest) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func _Service_Delete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(DeleteRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ServiceServer).Delete(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/object.Service/Delete", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ServiceServer).Delete(ctx, req.(*DeleteRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Service_Head_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(HeadRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ServiceServer).Head(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/object.Service/Head", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ServiceServer).Head(ctx, req.(*HeadRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Service_Search_Handler(srv interface{}, stream grpc.ServerStream) error { - m := new(SearchRequest) - if err := stream.RecvMsg(m); err != nil { - return err - } - return srv.(ServiceServer).Search(m, &serviceSearchServer{stream}) -} - -type Service_SearchServer interface { - Send(*SearchResponse) error - grpc.ServerStream -} - -type serviceSearchServer struct { - grpc.ServerStream -} - -func (x *serviceSearchServer) Send(m *SearchResponse) error { - return x.ServerStream.SendMsg(m) -} - -func _Service_GetRange_Handler(srv interface{}, stream grpc.ServerStream) error { - m := new(GetRangeRequest) - if err := stream.RecvMsg(m); err != nil { - return err - } - return srv.(ServiceServer).GetRange(m, &serviceGetRangeServer{stream}) -} - -type Service_GetRangeServer interface { - Send(*GetRangeResponse) error - grpc.ServerStream -} - -type serviceGetRangeServer struct { - grpc.ServerStream -} - -func (x *serviceGetRangeServer) Send(m *GetRangeResponse) error { - return x.ServerStream.SendMsg(m) -} - -func _Service_GetRangeHash_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetRangeHashRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ServiceServer).GetRangeHash(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/object.Service/GetRangeHash", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ServiceServer).GetRangeHash(ctx, req.(*GetRangeHashRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _Service_serviceDesc = grpc.ServiceDesc{ - ServiceName: "object.Service", - HandlerType: (*ServiceServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Delete", - Handler: _Service_Delete_Handler, - }, - { - MethodName: "Head", - Handler: _Service_Head_Handler, - }, - { - MethodName: "GetRangeHash", - Handler: _Service_GetRangeHash_Handler, - }, - }, - Streams: []grpc.StreamDesc{ - { - StreamName: "Get", - Handler: _Service_Get_Handler, - ServerStreams: true, - }, - { - StreamName: "Put", - Handler: _Service_Put_Handler, - ClientStreams: true, - }, - { - StreamName: "Search", - Handler: _Service_Search_Handler, - ServerStreams: true, - }, - { - StreamName: "GetRange", - Handler: _Service_GetRange_Handler, - ServerStreams: true, - }, - }, - Metadata: "object/service.proto", -} - -func (m *GetRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *GetRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *GetRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - { - size, err := m.RequestVerificationHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x6 - i-- - dAtA[i] = 0x9a - { - size, err := m.RequestMetaHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x6 - i-- - dAtA[i] = 0x92 - { - size, err := m.Address.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *GetResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *GetResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *GetResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - { - size, err := m.ResponseMetaHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x6 - i-- - dAtA[i] = 0x9a - if m.R != nil { - { - size := m.R.Size() - i -= size - if _, err := m.R.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - } - } - return len(dAtA) - i, nil -} - -func (m *GetResponse_Object) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *GetResponse_Object) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.Object != nil { - { - size, err := m.Object.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} -func (m *GetResponse_Chunk) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *GetResponse_Chunk) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.Chunk != nil { - i -= len(m.Chunk) - copy(dAtA[i:], m.Chunk) - i = encodeVarintService(dAtA, i, uint64(len(m.Chunk))) - i-- - dAtA[i] = 0x12 - } - return len(dAtA) - i, nil -} -func (m *PutRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *PutRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *PutRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - { - size, err := m.RequestVerificationHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x6 - i-- - dAtA[i] = 0x9a - { - size, err := m.RequestMetaHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x6 - i-- - dAtA[i] = 0x92 - if m.R != nil { - { - size := m.R.Size() - i -= size - if _, err := m.R.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - } - } - return len(dAtA) - i, nil -} - -func (m *PutRequest_Header) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *PutRequest_Header) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.Header != nil { - { - size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} -func (m *PutRequest_Chunk) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *PutRequest_Chunk) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.Chunk != nil { - i -= len(m.Chunk) - copy(dAtA[i:], m.Chunk) - i = encodeVarintService(dAtA, i, uint64(len(m.Chunk))) - i-- - dAtA[i] = 0x12 - } - return len(dAtA) - i, nil -} -func (m *PutRequest_PutHeader) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *PutRequest_PutHeader) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *PutRequest_PutHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.CopiesNumber != 0 { - i = encodeVarintService(dAtA, i, uint64(m.CopiesNumber)) - i-- - dAtA[i] = 0x10 - } - if m.Object != nil { - { - size, err := m.Object.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *PutResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *PutResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *PutResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - { - size, err := m.ResponseMetaHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x6 - i-- - dAtA[i] = 0x9a - { - size, err := m.Address.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *DeleteRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *DeleteRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *DeleteRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - { - size, err := m.RequestVerificationHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x6 - i-- - dAtA[i] = 0x9a - { - size, err := m.RequestMetaHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x6 - i-- - dAtA[i] = 0x92 - { - size := m.OwnerID.Size() - i -= size - if _, err := m.OwnerID.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size, err := m.Address.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *DeleteResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *DeleteResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *DeleteResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - { - size, err := m.ResponseMetaHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x6 - i-- - dAtA[i] = 0x9a - return len(dAtA) - i, nil -} - -func (m *HeadRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *HeadRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *HeadRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - { - size, err := m.RequestVerificationHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x6 - i-- - dAtA[i] = 0x9a - { - size, err := m.RequestMetaHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x6 - i-- - dAtA[i] = 0x92 - if m.FullHeaders { - i-- - if m.FullHeaders { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x10 - } - { - size := m.Address.Size() - i -= size - if _, err := m.Address.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *HeadResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *HeadResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *HeadResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - { - size, err := m.ResponseMetaHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x6 - i-- - dAtA[i] = 0x9a - if m.Object != nil { - { - size, err := m.Object.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *SearchRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *SearchRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *SearchRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - { - size, err := m.RequestVerificationHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x6 - i-- - dAtA[i] = 0x9a - { - size, err := m.RequestMetaHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x6 - i-- - dAtA[i] = 0x92 - if m.QueryVersion != 0 { - i = encodeVarintService(dAtA, i, uint64(m.QueryVersion)) - i-- - dAtA[i] = 0x18 - } - if len(m.Query) > 0 { - i -= len(m.Query) - copy(dAtA[i:], m.Query) - i = encodeVarintService(dAtA, i, uint64(len(m.Query))) - i-- - dAtA[i] = 0x12 - } - { - size := m.ContainerID.Size() - i -= size - if _, err := m.ContainerID.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *SearchResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *SearchResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *SearchResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - { - size, err := m.ResponseMetaHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x6 - i-- - dAtA[i] = 0x9a - if len(m.Addresses) > 0 { - for iNdEx := len(m.Addresses) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Addresses[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *GetRangeRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *GetRangeRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *GetRangeRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - { - size, err := m.RequestVerificationHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x6 - i-- - dAtA[i] = 0x9a - { - size, err := m.RequestMetaHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x6 - i-- - dAtA[i] = 0x92 - { - size, err := m.Range.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size, err := m.Address.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *GetRangeResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *GetRangeResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *GetRangeResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - { - size, err := m.ResponseMetaHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x6 - i-- - dAtA[i] = 0x9a - if len(m.Fragment) > 0 { - i -= len(m.Fragment) - copy(dAtA[i:], m.Fragment) - i = encodeVarintService(dAtA, i, uint64(len(m.Fragment))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *GetRangeHashRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *GetRangeHashRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *GetRangeHashRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - { - size, err := m.RequestVerificationHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x6 - i-- - dAtA[i] = 0x9a - { - size, err := m.RequestMetaHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x6 - i-- - dAtA[i] = 0x92 - if len(m.Salt) > 0 { - i -= len(m.Salt) - copy(dAtA[i:], m.Salt) - i = encodeVarintService(dAtA, i, uint64(len(m.Salt))) - i-- - dAtA[i] = 0x1a - } - if len(m.Ranges) > 0 { - for iNdEx := len(m.Ranges) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Ranges[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - { - size, err := m.Address.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *GetRangeHashResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *GetRangeHashResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *GetRangeHashResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - { - size, err := m.ResponseMetaHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x6 - i-- - dAtA[i] = 0x9a - if len(m.Hashes) > 0 { - for iNdEx := len(m.Hashes) - 1; iNdEx >= 0; iNdEx-- { - { - size := m.Hashes[iNdEx].Size() - i -= size - if _, err := m.Hashes[iNdEx].MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func encodeVarintService(dAtA []byte, offset int, v uint64) int { - offset -= sovService(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *GetRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Address.Size() - n += 1 + l + sovService(uint64(l)) - l = m.RequestMetaHeader.Size() - n += 2 + l + sovService(uint64(l)) - l = m.RequestVerificationHeader.Size() - n += 2 + l + sovService(uint64(l)) - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *GetResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.R != nil { - n += m.R.Size() - } - l = m.ResponseMetaHeader.Size() - n += 2 + l + sovService(uint64(l)) - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *GetResponse_Object) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Object != nil { - l = m.Object.Size() - n += 1 + l + sovService(uint64(l)) - } - return n -} -func (m *GetResponse_Chunk) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Chunk != nil { - l = len(m.Chunk) - n += 1 + l + sovService(uint64(l)) - } - return n -} -func (m *PutRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.R != nil { - n += m.R.Size() - } - l = m.RequestMetaHeader.Size() - n += 2 + l + sovService(uint64(l)) - l = m.RequestVerificationHeader.Size() - n += 2 + l + sovService(uint64(l)) - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *PutRequest_Header) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Header != nil { - l = m.Header.Size() - n += 1 + l + sovService(uint64(l)) - } - return n -} -func (m *PutRequest_Chunk) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Chunk != nil { - l = len(m.Chunk) - n += 1 + l + sovService(uint64(l)) - } - return n -} -func (m *PutRequest_PutHeader) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Object != nil { - l = m.Object.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.CopiesNumber != 0 { - n += 1 + sovService(uint64(m.CopiesNumber)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *PutResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Address.Size() - n += 1 + l + sovService(uint64(l)) - l = m.ResponseMetaHeader.Size() - n += 2 + l + sovService(uint64(l)) - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *DeleteRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Address.Size() - n += 1 + l + sovService(uint64(l)) - l = m.OwnerID.Size() - n += 1 + l + sovService(uint64(l)) - l = m.RequestMetaHeader.Size() - n += 2 + l + sovService(uint64(l)) - l = m.RequestVerificationHeader.Size() - n += 2 + l + sovService(uint64(l)) - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *DeleteResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ResponseMetaHeader.Size() - n += 2 + l + sovService(uint64(l)) - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *HeadRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Address.Size() - n += 1 + l + sovService(uint64(l)) - if m.FullHeaders { - n += 2 - } - l = m.RequestMetaHeader.Size() - n += 2 + l + sovService(uint64(l)) - l = m.RequestVerificationHeader.Size() - n += 2 + l + sovService(uint64(l)) - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *HeadResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Object != nil { - l = m.Object.Size() - n += 1 + l + sovService(uint64(l)) - } - l = m.ResponseMetaHeader.Size() - n += 2 + l + sovService(uint64(l)) - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *SearchRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ContainerID.Size() - n += 1 + l + sovService(uint64(l)) - l = len(m.Query) - if l > 0 { - n += 1 + l + sovService(uint64(l)) - } - if m.QueryVersion != 0 { - n += 1 + sovService(uint64(m.QueryVersion)) - } - l = m.RequestMetaHeader.Size() - n += 2 + l + sovService(uint64(l)) - l = m.RequestVerificationHeader.Size() - n += 2 + l + sovService(uint64(l)) - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *SearchResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Addresses) > 0 { - for _, e := range m.Addresses { - l = e.Size() - n += 1 + l + sovService(uint64(l)) - } - } - l = m.ResponseMetaHeader.Size() - n += 2 + l + sovService(uint64(l)) - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *GetRangeRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Address.Size() - n += 1 + l + sovService(uint64(l)) - l = m.Range.Size() - n += 1 + l + sovService(uint64(l)) - l = m.RequestMetaHeader.Size() - n += 2 + l + sovService(uint64(l)) - l = m.RequestVerificationHeader.Size() - n += 2 + l + sovService(uint64(l)) - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *GetRangeResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Fragment) - if l > 0 { - n += 1 + l + sovService(uint64(l)) - } - l = m.ResponseMetaHeader.Size() - n += 2 + l + sovService(uint64(l)) - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *GetRangeHashRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Address.Size() - n += 1 + l + sovService(uint64(l)) - if len(m.Ranges) > 0 { - for _, e := range m.Ranges { - l = e.Size() - n += 1 + l + sovService(uint64(l)) - } - } - l = len(m.Salt) - if l > 0 { - n += 1 + l + sovService(uint64(l)) - } - l = m.RequestMetaHeader.Size() - n += 2 + l + sovService(uint64(l)) - l = m.RequestVerificationHeader.Size() - n += 2 + l + sovService(uint64(l)) - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *GetRangeHashResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Hashes) > 0 { - for _, e := range m.Hashes { - l = e.Size() - n += 1 + l + sovService(uint64(l)) - } - } - l = m.ResponseMetaHeader.Size() - n += 2 + l + sovService(uint64(l)) - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func sovService(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozService(x uint64) (n int) { - return sovService(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *GetRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: GetRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GetRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Address.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 98: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.RequestMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 99: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RequestVerificationHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.RequestVerificationHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *GetResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: GetResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GetResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Object", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := &Object{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.R = &GetResponse_Object{v} - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Chunk", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := make([]byte, postIndex-iNdEx) - copy(v, dAtA[iNdEx:postIndex]) - m.R = &GetResponse_Chunk{v} - iNdEx = postIndex - case 99: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ResponseMetaHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ResponseMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *PutRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: PutRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: PutRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := &PutRequest_PutHeader{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.R = &PutRequest_Header{v} - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Chunk", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := make([]byte, postIndex-iNdEx) - copy(v, dAtA[iNdEx:postIndex]) - m.R = &PutRequest_Chunk{v} - iNdEx = postIndex - case 98: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.RequestMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 99: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RequestVerificationHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.RequestVerificationHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *PutRequest_PutHeader) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: PutHeader: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: PutHeader: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Object", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Object == nil { - m.Object = &Object{} - } - if err := m.Object.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field CopiesNumber", wireType) - } - m.CopiesNumber = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.CopiesNumber |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *PutResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: PutResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: PutResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Address.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 99: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ResponseMetaHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ResponseMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *DeleteRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: DeleteRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: DeleteRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Address.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OwnerID", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.OwnerID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 98: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.RequestMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 99: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RequestVerificationHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.RequestVerificationHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *DeleteResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: DeleteResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: DeleteResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 99: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ResponseMetaHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ResponseMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *HeadRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: HeadRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: HeadRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Address.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field FullHeaders", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.FullHeaders = bool(v != 0) - case 98: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.RequestMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 99: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RequestVerificationHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.RequestVerificationHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *HeadResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: HeadResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: HeadResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Object", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Object == nil { - m.Object = &Object{} - } - if err := m.Object.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 99: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ResponseMetaHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ResponseMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *SearchRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: SearchRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: SearchRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ContainerID", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ContainerID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Query", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Query = append(m.Query[:0], dAtA[iNdEx:postIndex]...) - if m.Query == nil { - m.Query = []byte{} - } - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field QueryVersion", wireType) - } - m.QueryVersion = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.QueryVersion |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 98: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.RequestMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 99: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RequestVerificationHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.RequestVerificationHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *SearchResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: SearchResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: SearchResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Addresses", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Addresses = append(m.Addresses, refs.Address{}) - if err := m.Addresses[len(m.Addresses)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 99: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ResponseMetaHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ResponseMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *GetRangeRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: GetRangeRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GetRangeRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Address.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Range", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Range.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 98: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.RequestMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 99: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RequestVerificationHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.RequestVerificationHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *GetRangeResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: GetRangeResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GetRangeResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Fragment", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Fragment = append(m.Fragment[:0], dAtA[iNdEx:postIndex]...) - if m.Fragment == nil { - m.Fragment = []byte{} - } - iNdEx = postIndex - case 99: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ResponseMetaHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ResponseMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *GetRangeHashRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: GetRangeHashRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GetRangeHashRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Address.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Ranges", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Ranges = append(m.Ranges, Range{}) - if err := m.Ranges[len(m.Ranges)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Salt", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Salt = append(m.Salt[:0], dAtA[iNdEx:postIndex]...) - if m.Salt == nil { - m.Salt = []byte{} - } - iNdEx = postIndex - case 98: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.RequestMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 99: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RequestVerificationHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.RequestVerificationHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *GetRangeHashResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: GetRangeHashResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GetRangeHashResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Hashes", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - var v Hash - m.Hashes = append(m.Hashes, v) - if err := m.Hashes[len(m.Hashes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 99: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ResponseMetaHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ResponseMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipService(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowService - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowService - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowService - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthService - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupService - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthService - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthService = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowService = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupService = fmt.Errorf("proto: unexpected end of group") -) diff --git a/object/service.proto b/object/service.proto deleted file mode 100644 index 91d0b99..0000000 --- a/object/service.proto +++ /dev/null @@ -1,197 +0,0 @@ -syntax = "proto3"; -package object; -option go_package = "github.com/nspcc-dev/neofs-api-go/object"; -option csharp_namespace = "NeoFS.API.Object"; - -import "refs/types.proto"; -import "object/types.proto"; -import "service/meta.proto"; -import "service/verify.proto"; -import "github.com/gogo/protobuf/gogoproto/gogo.proto"; - -option (gogoproto.stable_marshaler_all) = true; - -// Object service provides API for manipulating with the object. -service Service { - - // Get the object from container. Response uses gRPC stream. First response - // message carry object of requested address. Chunk messages are parts of - // the object's payload if it is needed. All messages except first carry - // chunks. Requested object can be restored by concatenation of object - // message payload and all chunks keeping receiving order. - rpc Get(GetRequest) returns (stream GetResponse); - - // Put the object into container. Request uses gRPC stream. First message - // SHOULD BE type of PutHeader. Container id and Owner id of object SHOULD - // BE set. Session token SHOULD BE obtained before put operation (see - // session package). Chunk messages considered by server as part of object - // payload. All messages except first SHOULD BE chunks. Chunk messages - // SHOULD BE sent in direct order of fragmentation. - rpc Put(stream PutRequest) returns (PutResponse); - - // Delete the object from a container - rpc Delete(DeleteRequest) returns (DeleteResponse); - - // Head returns the object without data payload. Object in the - // response has system header only. If full headers flag is set, extended - // headers are also present. - rpc Head(HeadRequest) returns (HeadResponse); - - // Search objects in container. Version of query language format SHOULD BE - // set to 1. Search query represented in serialized format (see query - // package). - rpc Search(SearchRequest) returns (stream SearchResponse); - - // GetRange of data payload. Range is a pair (offset, length). - // Requested range can be restored by concatenation of all chunks - // keeping receiving order. - rpc GetRange(GetRangeRequest) returns (stream GetRangeResponse); - - // GetRangeHash returns homomorphic hash of object payload range after XOR - // operation. Ranges are set of pairs (offset, length). Hashes order in - // response corresponds to ranges order in request. Homomorphic hash is - // calculated for XORed data. - rpc GetRangeHash(GetRangeHashRequest) returns (GetRangeHashResponse); -} - -message GetRequest { - // Address of object (container id + object id) - refs.Address Address = 1 [(gogoproto.nullable) = false]; - // RequestMetaHeader contains information about request meta headers (should be embedded into message) - service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; - // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) - service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; -} - -message GetResponse { - oneof R { - // Object header and some payload - Object object = 1; - // Chunk of remaining payload - bytes Chunk = 2; - } - - // ResponseMetaHeader contains meta information based on request processing by server (should be embedded into message) - service.ResponseMetaHeader Meta = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; -} - -message PutRequest { - message PutHeader { - // Object with at least container id and owner id fields - Object Object = 1; - // Number of the object copies to store within the RPC call (zero is processed according to the placement rules) - uint32 CopiesNumber = 2; - } - - oneof R { - // Header should be the first message in the stream - PutHeader Header = 1; - // Chunk should be a remaining message in stream should be chunks - bytes Chunk = 2; - } - - // RequestMetaHeader contains information about request meta headers (should be embedded into message) - service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; - // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) - service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; -} - -message PutResponse { - // Address of object (container id + object id) - refs.Address Address = 1 [(gogoproto.nullable) = false]; - // ResponseMetaHeader contains meta information based on request processing by server (should be embedded into message) - service.ResponseMetaHeader Meta = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; -} -message DeleteRequest { - // Address of object (container id + object id) - refs.Address Address = 1 [(gogoproto.nullable) = false]; - // OwnerID is a wallet address - bytes OwnerID = 2 [(gogoproto.nullable) = false, (gogoproto.customtype) = "OwnerID"]; - // RequestMetaHeader contains information about request meta headers (should be embedded into message) - service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; - // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) - service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; -} - -// DeleteResponse is empty because we cannot guarantee permanent object removal -// in distributed system. -message DeleteResponse { - // ResponseMetaHeader contains meta information based on request processing by server (should be embedded into message) - service.ResponseMetaHeader Meta = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; -} - -message HeadRequest { - // Address of object (container id + object id) - refs.Address Address = 1 [(gogoproto.nullable) = false, (gogoproto.customtype) = "Address"]; - // FullHeaders can be set true for extended headers in the object - bool FullHeaders = 2; - // RequestMetaHeader contains information about request meta headers (should be embedded into message) - service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; - // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) - service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; -} -message HeadResponse { - // Object without payload - Object Object = 1; - // ResponseMetaHeader contains meta information based on request processing by server (should be embedded into message) - service.ResponseMetaHeader Meta = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; -} - -message SearchRequest { - // ContainerID for searching the object - bytes ContainerID = 1 [(gogoproto.nullable) = false, (gogoproto.customtype) = "CID"]; - // Query in the binary serialized format - bytes Query = 2; - // QueryVersion is a version of search query format - uint32 QueryVersion = 3; - // RequestMetaHeader contains information about request meta headers (should be embedded into message) - service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; - // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) - service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; -} - -message SearchResponse { - // Addresses of found objects - repeated refs.Address Addresses = 1 [(gogoproto.nullable) = false]; - // ResponseMetaHeader contains meta information based on request processing by server (should be embedded into message) - service.ResponseMetaHeader Meta = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; -} - -message GetRangeRequest { - // Address of object (container id + object id) - refs.Address Address = 1 [(gogoproto.nullable) = false]; - // Range of object's payload to return - Range Range = 2 [(gogoproto.nullable) = false]; - // RequestMetaHeader contains information about request meta headers (should be embedded into message) - service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; - // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) - service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; -} - -message GetRangeResponse { - // Fragment of object's payload - bytes Fragment = 1; - // ResponseMetaHeader contains meta information based on request processing by server (should be embedded into message) - service.ResponseMetaHeader Meta = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; -} - -message GetRangeHashRequest { - // Address of object (container id + object id) - refs.Address Address = 1 [(gogoproto.nullable) = false]; - // Ranges of object's payload to calculate homomorphic hash - repeated Range Ranges = 2 [(gogoproto.nullable) = false]; - // Salt is used to XOR object's payload ranges before hashing, it can be nil - bytes Salt = 3; - // RequestMetaHeader contains information about request meta headers (should be embedded into message) - service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; - // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) - service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; -} - -message GetRangeHashResponse { - // Hashes is a homomorphic hashes of all ranges - repeated bytes Hashes = 1 [(gogoproto.customtype) = "Hash", (gogoproto.nullable) = false]; - // ResponseMetaHeader contains meta information based on request processing by server (should be embedded into message) - service.ResponseMetaHeader Meta = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; -} - diff --git a/object/service_test.go b/object/service_test.go deleted file mode 100644 index 5b7a358..0000000 --- a/object/service_test.go +++ /dev/null @@ -1,43 +0,0 @@ -package object - -import ( - "fmt" - "testing" - - "github.com/stretchr/testify/require" -) - -func TestRequest(t *testing.T) { - cases := []Request{ - &PutRequest{}, - &GetRequest{}, - &HeadRequest{}, - &SearchRequest{}, - &DeleteRequest{}, - &GetRangeRequest{}, - &GetRangeHashRequest{}, - MakePutRequestHeader(nil), - MakePutRequestHeader(&Object{}), - } - - types := []RequestType{ - RequestPut, - RequestGet, - RequestHead, - RequestSearch, - RequestDelete, - RequestRange, - RequestRangeHash, - RequestPut, - RequestPut, - } - - for i := range cases { - v := cases[i] - - t.Run(fmt.Sprintf("%T_%d", v, i), func(t *testing.T) { - require.NotPanics(t, func() { v.CID() }) - require.Equal(t, types[i], v.Type()) - }) - } -} diff --git a/object/sg.go b/object/sg.go deleted file mode 100644 index a75b950..0000000 --- a/object/sg.go +++ /dev/null @@ -1,43 +0,0 @@ -package object - -import ( - "sort" - - "github.com/nspcc-dev/neofs-api-go/refs" - "github.com/nspcc-dev/neofs-api-go/storagegroup" -) - -// Here are defined getter functions for objects that contain storage group -// information. - -var _ storagegroup.Provider = (*Object)(nil) - -// Group returns slice of object ids that are part of a storage group. -func (m *Object) Group() []refs.ObjectID { - sgLinks := m.Links(Link_StorageGroup) - sort.Sort(storagegroup.IDList(sgLinks)) - return sgLinks -} - -// Zones returns validation zones of storage group. -func (m *Object) Zones() []storagegroup.ZoneInfo { - sgInfo, err := m.StorageGroup() - if err != nil { - return nil - } - return []storagegroup.ZoneInfo{ - { - Hash: sgInfo.ValidationHash, - Size: sgInfo.ValidationDataSize, - }, - } -} - -// IDInfo returns meta information about storage group. -func (m *Object) IDInfo() *storagegroup.IdentificationInfo { - return &storagegroup.IdentificationInfo{ - SGID: m.SystemHeader.ID, - CID: m.SystemHeader.CID, - OwnerID: m.SystemHeader.OwnerID, - } -} diff --git a/object/sg_test.go b/object/sg_test.go deleted file mode 100644 index 716e916..0000000 --- a/object/sg_test.go +++ /dev/null @@ -1,88 +0,0 @@ -package object - -import ( - "math/rand" - "sort" - "testing" - - "github.com/nspcc-dev/neofs-api-go/hash" - "github.com/nspcc-dev/neofs-api-go/storagegroup" - "github.com/stretchr/testify/require" -) - -func TestObject_StorageGroup(t *testing.T) { - t.Run("group method", func(t *testing.T) { - var linkCount byte = 100 - - obj := &Object{Headers: make([]Header, 0, linkCount)} - require.Empty(t, obj.Group()) - - idList := make([]ID, linkCount) - for i := byte(0); i < linkCount; i++ { - idList[i] = ID{i} - obj.Headers = append(obj.Headers, Header{ - Value: &Header_Link{Link: &Link{ - Type: Link_StorageGroup, - ID: idList[i], - }}, - }) - } - - rand.Shuffle(len(obj.Headers), func(i, j int) { obj.Headers[i], obj.Headers[j] = obj.Headers[j], obj.Headers[i] }) - sort.Sort(storagegroup.IDList(idList)) - require.Equal(t, idList, obj.Group()) - }) - t.Run("identification method", func(t *testing.T) { - oid, cid, owner := ID{1}, CID{2}, OwnerID{3} - obj := &Object{ - SystemHeader: SystemHeader{ - ID: oid, - OwnerID: owner, - CID: cid, - }, - } - - idInfo := obj.IDInfo() - require.Equal(t, oid, idInfo.SGID) - require.Equal(t, cid, idInfo.CID) - require.Equal(t, owner, idInfo.OwnerID) - }) - t.Run("zones method", func(t *testing.T) { - sgSize := uint64(100) - - d := make([]byte, sgSize) - _, err := rand.Read(d) - require.NoError(t, err) - sgHash := hash.Sum(d) - - obj := &Object{ - Headers: []Header{ - { - Value: &Header_StorageGroup{ - StorageGroup: &storagegroup.StorageGroup{ - ValidationDataSize: sgSize, - ValidationHash: sgHash, - }, - }, - }, - }, - } - - var ( - sumSize uint64 - zones = obj.Zones() - hashes = make([]Hash, len(zones)) - ) - - for i := range zones { - sumSize += zones[i].Size - hashes[i] = zones[i].Hash - } - - sumHash, err := hash.Concat(hashes) - require.NoError(t, err) - - require.Equal(t, sgSize, sumSize) - require.Equal(t, sgHash, sumHash) - }) -} diff --git a/object/sign.go b/object/sign.go deleted file mode 100644 index 3cdf94f..0000000 --- a/object/sign.go +++ /dev/null @@ -1,272 +0,0 @@ -package object - -import ( - "crypto/ecdsa" - "encoding/binary" - "io" - - "github.com/nspcc-dev/neofs-api-go/service" -) - -// SignedData returns payload bytes of the request. -// -// If payload is nil, ErrHeaderNotFound returns. -func (m PutRequest) SignedData() ([]byte, error) { - return service.SignedDataFromReader(m) -} - -// ReadSignedData copies payload bytes to passed buffer. -// -// If the buffer size is insufficient, io.ErrUnexpectedEOF returns. -func (m PutRequest) ReadSignedData(p []byte) (int, error) { - r := m.GetR() - if r == nil { - return 0, ErrHeaderNotFound - } - - return r.MarshalTo(p) -} - -// SignedDataSize returns the size of payload of the Put request. -// -// If payload is nil, -1 returns. -func (m PutRequest) SignedDataSize() int { - r := m.GetR() - if r == nil { - return -1 - } - - return r.Size() -} - -// SignedData returns payload bytes of the request. -func (m GetRequest) SignedData() ([]byte, error) { - return service.SignedDataFromReader(m) -} - -// ReadSignedData copies payload bytes to passed buffer. -// -// If the buffer size is insufficient, io.ErrUnexpectedEOF returns. -func (m GetRequest) ReadSignedData(p []byte) (int, error) { - addr := m.GetAddress() - - if len(p) < m.SignedDataSize() { - return 0, io.ErrUnexpectedEOF - } - - var off int - - off += copy(p[off:], addr.CID.Bytes()) - - off += copy(p[off:], addr.ObjectID.Bytes()) - - return off, nil -} - -// SignedDataSize returns payload size of the request. -func (m GetRequest) SignedDataSize() int { - return addressSize(m.GetAddress()) -} - -// SignedData returns payload bytes of the request. -func (m HeadRequest) SignedData() ([]byte, error) { - return service.SignedDataFromReader(m) -} - -// ReadSignedData copies payload bytes to passed buffer. -// -// If the buffer size is insufficient, io.ErrUnexpectedEOF returns. -func (m HeadRequest) ReadSignedData(p []byte) (int, error) { - if len(p) < m.SignedDataSize() { - return 0, io.ErrUnexpectedEOF - } - - if m.GetFullHeaders() { - p[0] = 1 - } else { - p[0] = 0 - } - - off := 1 - - off += copy(p[off:], m.Address.CID.Bytes()) - - off += copy(p[off:], m.Address.ObjectID.Bytes()) - - return off, nil -} - -// SignedDataSize returns payload size of the request. -func (m HeadRequest) SignedDataSize() int { - return addressSize(m.Address) + 1 -} - -// SignedData returns payload bytes of the request. -func (m DeleteRequest) SignedData() ([]byte, error) { - return service.SignedDataFromReader(m) -} - -// ReadSignedData copies payload bytes to passed buffer. -// -// If the buffer size is insufficient, io.ErrUnexpectedEOF returns. -func (m DeleteRequest) ReadSignedData(p []byte) (int, error) { - if len(p) < m.SignedDataSize() { - return 0, io.ErrUnexpectedEOF - } - - var off int - - off += copy(p[off:], m.OwnerID.Bytes()) - - off += copy(p[off:], addressBytes(m.Address)) - - return off, nil -} - -// SignedDataSize returns payload size of the request. -func (m DeleteRequest) SignedDataSize() int { - return m.OwnerID.Size() + addressSize(m.Address) -} - -// SignedData returns payload bytes of the request. -func (m GetRangeRequest) SignedData() ([]byte, error) { - return service.SignedDataFromReader(m) -} - -// ReadSignedData copies payload bytes to passed buffer. -// -// If the buffer size is insufficient, io.ErrUnexpectedEOF returns. -func (m GetRangeRequest) ReadSignedData(p []byte) (int, error) { - if len(p) < m.SignedDataSize() { - return 0, io.ErrUnexpectedEOF - } - - n, err := (&m.Range).MarshalTo(p) - if err != nil { - return 0, err - } - - n += copy(p[n:], addressBytes(m.GetAddress())) - - return n, nil -} - -// SignedDataSize returns payload size of the request. -func (m GetRangeRequest) SignedDataSize() int { - return (&m.Range).Size() + addressSize(m.GetAddress()) -} - -// SignedData returns payload bytes of the request. -func (m GetRangeHashRequest) SignedData() ([]byte, error) { - return service.SignedDataFromReader(m) -} - -// ReadSignedData copies payload bytes to passed buffer. -// -// If the buffer size is insufficient, io.ErrUnexpectedEOF returns. -func (m GetRangeHashRequest) ReadSignedData(p []byte) (int, error) { - if len(p) < m.SignedDataSize() { - return 0, io.ErrUnexpectedEOF - } - - var off int - - off += copy(p[off:], addressBytes(m.GetAddress())) - - off += copy(p[off:], rangeSetBytes(m.GetRanges())) - - off += copy(p[off:], m.GetSalt()) - - return off, nil -} - -// SignedDataSize returns payload size of the request. -func (m GetRangeHashRequest) SignedDataSize() int { - var sz int - - sz += addressSize(m.GetAddress()) - - sz += rangeSetSize(m.GetRanges()) - - sz += len(m.GetSalt()) - - return sz -} - -// SignedData returns payload bytes of the request. -func (m SearchRequest) SignedData() ([]byte, error) { - return service.SignedDataFromReader(m) -} - -// ReadSignedData copies payload bytes to passed buffer. -// -// If the buffer size is insufficient, io.ErrUnexpectedEOF returns. -func (m SearchRequest) ReadSignedData(p []byte) (int, error) { - if len(p) < m.SignedDataSize() { - return 0, io.ErrUnexpectedEOF - } - - var off int - - off += copy(p[off:], m.CID().Bytes()) - - binary.BigEndian.PutUint32(p[off:], m.GetQueryVersion()) - off += 4 - - off += copy(p[off:], m.GetQuery()) - - return off, nil -} - -// SignedDataSize returns payload size of the request. -func (m SearchRequest) SignedDataSize() int { - var sz int - - sz += m.CID().Size() - - sz += 4 // uint32 Version - - sz += len(m.GetQuery()) - - return sz -} - -func rangeSetSize(rs []Range) int { - return 4 + len(rs)*16 // two uint64 fields -} - -func rangeSetBytes(rs []Range) []byte { - data := make([]byte, rangeSetSize(rs)) - - binary.BigEndian.PutUint32(data, uint32(len(rs))) - - off := 4 - - for i := range rs { - binary.BigEndian.PutUint64(data[off:], rs[i].Offset) - off += 8 - - binary.BigEndian.PutUint64(data[off:], rs[i].Length) - off += 8 - } - - return data -} - -func addressSize(addr Address) int { - return addr.CID.Size() + addr.ObjectID.Size() -} - -func addressBytes(addr Address) []byte { - return append(addr.CID.Bytes(), addr.ObjectID.Bytes()...) -} - -// SignedData returns the result of the ChecksumSignature field getter. -func (m IntegrityHeader) SignedData() ([]byte, error) { - return m.GetHeadersChecksum(), nil -} - -// AddSignKey calls the ChecksumSignature field setter with signature argument. -func (m *IntegrityHeader) AddSignKey(sign []byte, _ *ecdsa.PublicKey) { - m.SetSignature(sign) -} diff --git a/object/sign_test.go b/object/sign_test.go deleted file mode 100644 index dcfbd7e..0000000 --- a/object/sign_test.go +++ /dev/null @@ -1,239 +0,0 @@ -package object - -import ( - "crypto/rand" - "testing" - - "github.com/nspcc-dev/neofs-api-go/service" - "github.com/nspcc-dev/neofs-crypto/test" - "github.com/stretchr/testify/require" -) - -func TestSignVerifyRequests(t *testing.T) { - sk := test.DecodeKey(0) - - type sigType interface { - service.RequestData - service.SignKeyPairAccumulator - service.SignKeyPairSource - SetToken(*Token) - } - - items := []struct { - constructor func() sigType - payloadCorrupt []func(sigType) - }{ - { // PutRequest.PutHeader - constructor: func() sigType { - return MakePutRequestHeader(new(Object)) - }, - payloadCorrupt: []func(sigType){ - func(s sigType) { - obj := s.(*PutRequest).GetR().(*PutRequest_Header).Header.GetObject() - obj.SystemHeader.PayloadLength++ - }, - }, - }, - { // PutRequest.Chunk - constructor: func() sigType { - return MakePutRequestChunk(make([]byte, 10)) - }, - payloadCorrupt: []func(sigType){ - func(s sigType) { - h := s.(*PutRequest).GetR().(*PutRequest_Chunk) - h.Chunk[0]++ - }, - }, - }, - { // GetRequest - constructor: func() sigType { - return new(GetRequest) - }, - payloadCorrupt: []func(sigType){ - func(s sigType) { - s.(*GetRequest).Address.CID[0]++ - }, - func(s sigType) { - s.(*GetRequest).Address.ObjectID[0]++ - }, - }, - }, - { // HeadRequest - constructor: func() sigType { - return new(HeadRequest) - }, - payloadCorrupt: []func(sigType){ - func(s sigType) { - s.(*HeadRequest).Address.CID[0]++ - }, - func(s sigType) { - s.(*HeadRequest).Address.ObjectID[0]++ - }, - func(s sigType) { - s.(*HeadRequest).FullHeaders = true - }, - }, - }, - { // DeleteRequest - constructor: func() sigType { - return new(DeleteRequest) - }, - payloadCorrupt: []func(sigType){ - func(s sigType) { - s.(*DeleteRequest).OwnerID[0]++ - }, - func(s sigType) { - s.(*DeleteRequest).Address.CID[0]++ - }, - func(s sigType) { - s.(*DeleteRequest).Address.ObjectID[0]++ - }, - }, - }, - { // GetRangeRequest - constructor: func() sigType { - return new(GetRangeRequest) - }, - payloadCorrupt: []func(sigType){ - func(s sigType) { - s.(*GetRangeRequest).Range.Length++ - }, - func(s sigType) { - s.(*GetRangeRequest).Range.Offset++ - }, - func(s sigType) { - s.(*GetRangeRequest).Address.CID[0]++ - }, - func(s sigType) { - s.(*GetRangeRequest).Address.ObjectID[0]++ - }, - }, - }, - { // GetRangeHashRequest - constructor: func() sigType { - return &GetRangeHashRequest{ - Ranges: []Range{{}}, - Salt: []byte{1, 2, 3}, - } - }, - payloadCorrupt: []func(sigType){ - func(s sigType) { - s.(*GetRangeHashRequest).Address.CID[0]++ - }, - func(s sigType) { - s.(*GetRangeHashRequest).Address.ObjectID[0]++ - }, - func(s sigType) { - s.(*GetRangeHashRequest).Salt[0]++ - }, - func(s sigType) { - s.(*GetRangeHashRequest).Ranges[0].Length++ - }, - func(s sigType) { - s.(*GetRangeHashRequest).Ranges[0].Offset++ - }, - func(s sigType) { - s.(*GetRangeHashRequest).Ranges = nil - }, - }, - }, - { // GetRangeHashRequest - constructor: func() sigType { - return &SearchRequest{ - Query: []byte{1, 2, 3}, - } - }, - payloadCorrupt: []func(sigType){ - func(s sigType) { - s.(*SearchRequest).ContainerID[0]++ - }, - func(s sigType) { - s.(*SearchRequest).Query[0]++ - }, - func(s sigType) { - s.(*SearchRequest).QueryVersion++ - }, - }, - }, - } - - for _, item := range items { - { // token corruptions - v := item.constructor() - - token := new(Token) - v.SetToken(token) - - require.NoError(t, service.SignRequestData(sk, v)) - - require.NoError(t, service.VerifyRequestData(v)) - - token.SetSessionKey(append(token.GetSessionKey(), 1)) - - require.Error(t, service.VerifyRequestData(v)) - } - - { // payload corruptions - for _, corruption := range item.payloadCorrupt { - v := item.constructor() - - require.NoError(t, service.SignRequestData(sk, v)) - - require.NoError(t, service.VerifyRequestData(v)) - - corruption(v) - - require.Error(t, service.VerifyRequestData(v)) - } - } - } -} - -func TestHeadRequest_ReadSignedData(t *testing.T) { - t.Run("full headers", func(t *testing.T) { - req := new(HeadRequest) - - // unset FullHeaders flag - req.SetFullHeaders(false) - - // allocate two different buffers for reading - buf1 := testData(t, req.SignedDataSize()) - buf2 := testData(t, req.SignedDataSize()) - - // read to both buffers - n1, err := req.ReadSignedData(buf1) - require.NoError(t, err) - - n2, err := req.ReadSignedData(buf2) - require.NoError(t, err) - - require.Equal(t, buf1[:n1], buf2[:n2]) - }) -} - -func testData(t *testing.T, sz int) []byte { - data := make([]byte, sz) - - _, err := rand.Read(data) - require.NoError(t, err) - - return data -} - -func TestIntegrityHeaderSignMethods(t *testing.T) { - // create new IntegrityHeader - s := new(IntegrityHeader) - - // set test headers checksum - s.SetHeadersChecksum([]byte{1, 2, 3}) - - data, err := s.SignedData() - require.NoError(t, err) - require.Equal(t, data, s.GetHeadersChecksum()) - - // add signature - sig := []byte{4, 5, 6} - s.AddSignKey(sig, nil) - - require.Equal(t, sig, s.GetSignature()) -} diff --git a/object/types.go b/object/types.go deleted file mode 100644 index 392e624..0000000 --- a/object/types.go +++ /dev/null @@ -1,422 +0,0 @@ -package object - -import ( - "bytes" - "context" - "fmt" - "io" - "reflect" - - "github.com/gogo/protobuf/proto" - "github.com/nspcc-dev/neofs-api-go/internal" - "github.com/nspcc-dev/neofs-api-go/refs" - "github.com/pkg/errors" -) - -type ( - // Pred defines a predicate function that can check if passed header - // satisfies predicate condition. It is used to find headers of - // specific type. - Pred = func(*Header) bool - - // Address is a type alias of object Address. - Address = refs.Address - - // PositionReader defines object reader that returns slice of bytes - // for specified object and data range. - PositionReader interface { - PRead(ctx context.Context, addr refs.Address, rng Range) ([]byte, error) - } - - // RequestType of the object service requests. - RequestType int - - headerType int -) - -const ( - // ErrVerifyPayload is raised when payload checksum cannot be verified. - ErrVerifyPayload = internal.Error("can't verify payload") - - // ErrVerifyHeader is raised when object integrity cannot be verified. - ErrVerifyHeader = internal.Error("can't verify header") - - // ErrHeaderNotFound is raised when requested header not found. - ErrHeaderNotFound = internal.Error("header not found") - - // ErrVerifySignature is raised when signature cannot be verified. - ErrVerifySignature = internal.Error("can't verify signature") -) - -const ( - _ headerType = iota - // LinkHdr is a link header type. - LinkHdr - // RedirectHdr is a redirect header type. - RedirectHdr - // UserHdr is a user defined header type. - UserHdr - // TransformHdr is a transformation header type. - TransformHdr - // TombstoneHdr is a tombstone header type. - TombstoneHdr - // TokenHdr is a token header type. - TokenHdr - // HomoHashHdr is a homomorphic hash header type. - HomoHashHdr - // PayloadChecksumHdr is a payload checksum header type. - PayloadChecksumHdr - // IntegrityHdr is a integrity header type. - IntegrityHdr - // StorageGroupHdr is a storage group header type. - StorageGroupHdr - // PublicKeyHdr is a public key header type. - PublicKeyHdr -) - -const ( - _ RequestType = iota - // RequestPut is a type for object put request. - RequestPut - // RequestGet is a type for object get request. - RequestGet - // RequestHead is a type for object head request. - RequestHead - // RequestSearch is a type for object search request. - RequestSearch - // RequestRange is a type for object range request. - RequestRange - // RequestRangeHash is a type for object hash range request. - RequestRangeHash - // RequestDelete is a type for object delete request. - RequestDelete -) - -var ( - _ internal.Custom = (*Object)(nil) - - emptyObject = new(Object).Bytes() -) - -// String returns printable name of the request type. -func (s RequestType) String() string { - switch s { - case RequestPut: - return "PUT" - case RequestGet: - return "GET" - case RequestHead: - return "HEAD" - case RequestSearch: - return "SEARCH" - case RequestRange: - return "RANGE" - case RequestRangeHash: - return "RANGE_HASH" - case RequestDelete: - return "DELETE" - default: - return "UNKNOWN" - } -} - -// Bytes returns marshaled object in a binary format. -func (m Object) Bytes() []byte { data, _ := m.Marshal(); return data } - -// Empty checks if object does not contain any information. -func (m Object) Empty() bool { return bytes.Equal(m.Bytes(), emptyObject) } - -// LastHeader returns last header of the specified type. Type must be -// specified as a Pred function. -func (m Object) LastHeader(f Pred) (int, *Header) { - for i := len(m.Headers) - 1; i >= 0; i-- { - if f != nil && f(&m.Headers[i]) { - return i, &m.Headers[i] - } - } - return -1, nil -} - -// AddHeader adds passed header to the end of extended header list. -func (m *Object) AddHeader(h *Header) { - m.Headers = append(m.Headers, *h) -} - -// SetPayload sets payload field and payload length in the system header. -func (m *Object) SetPayload(payload []byte) { - m.Payload = payload - m.SystemHeader.PayloadLength = uint64(len(payload)) -} - -// SetHeader replaces existing extended header or adds new one to the end of -// extended header list. -func (m *Object) SetHeader(h *Header) { - // looking for the header of that type - for i := range m.Headers { - if m.Headers[i].typeOf(h.Value) { - // if we found one - set it with new value and return - m.Headers[i] = *h - return - } - } - // if we did not find one - add this header - m.AddHeader(h) -} - -// Merge used by proto.Clone -func (m *Object) Merge(src proto.Message) { - if tmp, ok := src.(*Object); ok { - tmp.CopyTo(m) - } -} - -func (m Header) typeOf(t isHeader_Value) (ok bool) { - switch t.(type) { - case *Header_Link: - _, ok = m.Value.(*Header_Link) - case *Header_Redirect: - _, ok = m.Value.(*Header_Redirect) - case *Header_UserHeader: - _, ok = m.Value.(*Header_UserHeader) - case *Header_Transform: - _, ok = m.Value.(*Header_Transform) - case *Header_Tombstone: - _, ok = m.Value.(*Header_Tombstone) - case *Header_Token: - _, ok = m.Value.(*Header_Token) - case *Header_HomoHash: - _, ok = m.Value.(*Header_HomoHash) - case *Header_PayloadChecksum: - _, ok = m.Value.(*Header_PayloadChecksum) - case *Header_Integrity: - _, ok = m.Value.(*Header_Integrity) - case *Header_StorageGroup: - _, ok = m.Value.(*Header_StorageGroup) - case *Header_PublicKey: - _, ok = m.Value.(*Header_PublicKey) - } - return -} - -// HeaderType returns predicate that check if extended header is a header -// of specified type. -func HeaderType(t headerType) Pred { - switch t { - case LinkHdr: - return func(h *Header) bool { _, ok := h.Value.(*Header_Link); return ok } - case RedirectHdr: - return func(h *Header) bool { _, ok := h.Value.(*Header_Redirect); return ok } - case UserHdr: - return func(h *Header) bool { _, ok := h.Value.(*Header_UserHeader); return ok } - case TransformHdr: - return func(h *Header) bool { _, ok := h.Value.(*Header_Transform); return ok } - case TombstoneHdr: - return func(h *Header) bool { _, ok := h.Value.(*Header_Tombstone); return ok } - case TokenHdr: - return func(h *Header) bool { _, ok := h.Value.(*Header_Token); return ok } - case HomoHashHdr: - return func(h *Header) bool { _, ok := h.Value.(*Header_HomoHash); return ok } - case PayloadChecksumHdr: - return func(h *Header) bool { _, ok := h.Value.(*Header_PayloadChecksum); return ok } - case IntegrityHdr: - return func(h *Header) bool { _, ok := h.Value.(*Header_Integrity); return ok } - case StorageGroupHdr: - return func(h *Header) bool { _, ok := h.Value.(*Header_StorageGroup); return ok } - case PublicKeyHdr: - return func(h *Header) bool { _, ok := h.Value.(*Header_PublicKey); return ok } - default: - return nil - } -} - -// Copy creates full copy of the object. -func (m *Object) Copy() (obj *Object) { - obj = new(Object) - m.CopyTo(obj) - return -} - -// CopyTo creates fills passed object with the data from the current object. -// This function creates copies on every available data slice. -func (m *Object) CopyTo(o *Object) { - o.SystemHeader = m.SystemHeader - - if m.Headers != nil { - o.Headers = make([]Header, len(m.Headers)) - } - - if m.Payload != nil { - o.Payload = make([]byte, len(m.Payload)) - copy(o.Payload, m.Payload) - } - - for i := range m.Headers { - switch v := m.Headers[i].Value.(type) { - case *Header_Link: - link := *v.Link - o.Headers[i] = Header{ - Value: &Header_Link{ - Link: &link, - }, - } - case *Header_HomoHash: - hash := proto.Clone(&v.HomoHash).(*Hash) - o.Headers[i] = Header{ - Value: &Header_HomoHash{ - HomoHash: *hash, - }, - } - case *Header_Token: - token := *v.Token - o.Headers[i] = Header{ - Value: &Header_Token{ - Token: &token, - }, - } - default: - o.Headers[i] = *proto.Clone(&m.Headers[i]).(*Header) - } - } -} - -// Address returns object's address. -func (m Object) Address() *refs.Address { - return &refs.Address{ - ObjectID: m.SystemHeader.ID, - CID: m.SystemHeader.CID, - } -} - -func (m CreationPoint) String() string { - return fmt.Sprintf(`{UnixTime=%d Epoch=%d}`, m.UnixTime, m.Epoch) -} - -// Stringify converts object into string format. -func Stringify(dst io.Writer, obj *Object) error { - // put empty line - if _, err := fmt.Fprintln(dst); err != nil { - return err - } - - // put object line - if _, err := fmt.Fprintln(dst, "Object:"); err != nil { - return err - } - - // put system headers - if _, err := fmt.Fprintln(dst, "\tSystemHeader:"); err != nil { - return err - } - - sysHeaders := []string{"ID", "CID", "OwnerID", "Version", "PayloadLength", "CreatedAt"} - v := reflect.ValueOf(obj.SystemHeader) - for _, key := range sysHeaders { - if !v.FieldByName(key).IsValid() { - return errors.Errorf("invalid system header key: %q", key) - } - - val := v.FieldByName(key).Interface() - if _, err := fmt.Fprintf(dst, "\t\t- %s=%v\n", key, val); err != nil { - return err - } - } - - // put user headers - if _, err := fmt.Fprintln(dst, "\tUserHeaders:"); err != nil { - return err - } - - for _, header := range obj.Headers { - var ( - typ = reflect.ValueOf(header.Value) - key string - val interface{} - ) - - switch t := typ.Interface().(type) { - case *Header_Link: - key = "Link" - val = fmt.Sprintf(`{Type=%s ID=%s}`, t.Link.Type, t.Link.ID) - case *Header_Redirect: - key = "Redirect" - val = fmt.Sprintf(`{CID=%s OID=%s}`, t.Redirect.CID, t.Redirect.ObjectID) - case *Header_UserHeader: - key = "UserHeader" - val = fmt.Sprintf(`{Key=%s Val=%s}`, t.UserHeader.Key, t.UserHeader.Value) - case *Header_Transform: - key = "Transform" - val = t.Transform.Type.String() - case *Header_Tombstone: - key = "Tombstone" - val = "MARKED" - case *Header_Token: - key = "Token" - val = fmt.Sprintf("{"+ - "ID=%s OwnerID=%s Verb=%s Address=%s Created=%d ValidUntil=%d SessionKey=%02x Signature=%02x"+ - "}", - t.Token.GetID(), - t.Token.GetOwnerID(), - t.Token.GetVerb(), - t.Token.GetAddress(), - t.Token.CreationEpoch(), - t.Token.ExpirationEpoch(), - t.Token.GetSessionKey(), - t.Token.GetSignature()) - case *Header_HomoHash: - key = "HomoHash" - val = t.HomoHash - case *Header_PayloadChecksum: - key = "PayloadChecksum" - val = t.PayloadChecksum - case *Header_Integrity: - key = "Integrity" - val = fmt.Sprintf(`{Checksum=%02x Signature=%02x}`, - t.Integrity.HeadersChecksum, - t.Integrity.ChecksumSignature) - case *Header_StorageGroup: - key = "StorageGroup" - val = fmt.Sprintf(`{DataSize=%d Hash=%02x Lifetime={Unit=%s Value=%d}}`, - t.StorageGroup.ValidationDataSize, - t.StorageGroup.ValidationHash, - t.StorageGroup.Lifetime.Unit, - t.StorageGroup.Lifetime.Value) - case *Header_PublicKey: - key = "PublicKey" - val = t.PublicKey.Value - default: - key = "Unknown" - val = t - } - - if _, err := fmt.Fprintf(dst, "\t\t- Type=%s\n\t\t Value=%v\n", key, val); err != nil { - return err - } - } - - // put payload - if _, err := fmt.Fprintf(dst, "\tPayload: %#v\n", obj.Payload); err != nil { - return err - } - - return nil -} - -// SetFullHeaders is a FullHeaders field setter. -func (m *HeadRequest) SetFullHeaders(v bool) { - m.FullHeaders = v -} - -// GetSignature is a ChecksumSignature field getter. -func (m IntegrityHeader) GetSignature() []byte { - return m.ChecksumSignature -} - -// SetSignature is a ChecksumSignature field setter. -func (m *IntegrityHeader) SetSignature(v []byte) { - m.ChecksumSignature = v -} - -// SetHeadersChecksum is a HeadersChecksum field setter. -func (m *IntegrityHeader) SetHeadersChecksum(v []byte) { - m.HeadersChecksum = v -} diff --git a/object/types.pb.go b/object/types.pb.go deleted file mode 100644 index 97106c7..0000000 --- a/object/types.pb.go +++ /dev/null @@ -1,3568 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: object/types.proto - -package object - -import ( - fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/golang/protobuf/proto" - refs "github.com/nspcc-dev/neofs-api-go/refs" - service "github.com/nspcc-dev/neofs-api-go/service" - storagegroup "github.com/nspcc-dev/neofs-api-go/storagegroup" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package - -type Link_Type int32 - -const ( - Link_Unknown Link_Type = 0 - // Parent object created during object transformation - Link_Parent Link_Type = 1 - // Previous object in the linked list created during object transformation - Link_Previous Link_Type = 2 - // Next object in the linked list created during object transformation - Link_Next Link_Type = 3 - // Child object created during object transformation - Link_Child Link_Type = 4 - // Object that included into this storage group - Link_StorageGroup Link_Type = 5 -) - -var Link_Type_name = map[int32]string{ - 0: "Unknown", - 1: "Parent", - 2: "Previous", - 3: "Next", - 4: "Child", - 5: "StorageGroup", -} - -var Link_Type_value = map[string]int32{ - "Unknown": 0, - "Parent": 1, - "Previous": 2, - "Next": 3, - "Child": 4, - "StorageGroup": 5, -} - -func (x Link_Type) String() string { - return proto.EnumName(Link_Type_name, int32(x)) -} - -func (Link_Type) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_02021a1d39b1aee0, []int{7, 0} -} - -type Transform_Type int32 - -const ( - Transform_Unknown Transform_Type = 0 - // Split sets when object created after payload split - Transform_Split Transform_Type = 1 - // Sign sets when object created after re-signing (doesn't used) - Transform_Sign Transform_Type = 2 - // Mould sets when object created after filling missing headers in the object - Transform_Mould Transform_Type = 3 -) - -var Transform_Type_name = map[int32]string{ - 0: "Unknown", - 1: "Split", - 2: "Sign", - 3: "Mould", -} - -var Transform_Type_value = map[string]int32{ - "Unknown": 0, - "Split": 1, - "Sign": 2, - "Mould": 3, -} - -func (x Transform_Type) String() string { - return proto.EnumName(Transform_Type_name, int32(x)) -} - -func (Transform_Type) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_02021a1d39b1aee0, []int{8, 0} -} - -type Range struct { - // Offset of the data range - Offset uint64 `protobuf:"varint,1,opt,name=Offset,proto3" json:"Offset,omitempty"` - // Length of the data range - Length uint64 `protobuf:"varint,2,opt,name=Length,proto3" json:"Length,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Range) Reset() { *m = Range{} } -func (m *Range) String() string { return proto.CompactTextString(m) } -func (*Range) ProtoMessage() {} -func (*Range) Descriptor() ([]byte, []int) { - return fileDescriptor_02021a1d39b1aee0, []int{0} -} -func (m *Range) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Range) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *Range) XXX_Merge(src proto.Message) { - xxx_messageInfo_Range.Merge(m, src) -} -func (m *Range) XXX_Size() int { - return m.Size() -} -func (m *Range) XXX_DiscardUnknown() { - xxx_messageInfo_Range.DiscardUnknown(m) -} - -var xxx_messageInfo_Range proto.InternalMessageInfo - -func (m *Range) GetOffset() uint64 { - if m != nil { - return m.Offset - } - return 0 -} - -func (m *Range) GetLength() uint64 { - if m != nil { - return m.Length - } - return 0 -} - -type UserHeader struct { - // Key of the user's header - Key string `protobuf:"bytes,1,opt,name=Key,proto3" json:"Key,omitempty"` - // Value of the user's header - Value string `protobuf:"bytes,2,opt,name=Value,proto3" json:"Value,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *UserHeader) Reset() { *m = UserHeader{} } -func (m *UserHeader) String() string { return proto.CompactTextString(m) } -func (*UserHeader) ProtoMessage() {} -func (*UserHeader) Descriptor() ([]byte, []int) { - return fileDescriptor_02021a1d39b1aee0, []int{1} -} -func (m *UserHeader) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *UserHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *UserHeader) XXX_Merge(src proto.Message) { - xxx_messageInfo_UserHeader.Merge(m, src) -} -func (m *UserHeader) XXX_Size() int { - return m.Size() -} -func (m *UserHeader) XXX_DiscardUnknown() { - xxx_messageInfo_UserHeader.DiscardUnknown(m) -} - -var xxx_messageInfo_UserHeader proto.InternalMessageInfo - -func (m *UserHeader) GetKey() string { - if m != nil { - return m.Key - } - return "" -} - -func (m *UserHeader) GetValue() string { - if m != nil { - return m.Value - } - return "" -} - -type Header struct { - // Types that are valid to be assigned to Value: - // *Header_Link - // *Header_Redirect - // *Header_UserHeader - // *Header_Transform - // *Header_Tombstone - // *Header_Token - // *Header_HomoHash - // *Header_PayloadChecksum - // *Header_Integrity - // *Header_StorageGroup - // *Header_PublicKey - Value isHeader_Value `protobuf_oneof:"Value"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Header) Reset() { *m = Header{} } -func (m *Header) String() string { return proto.CompactTextString(m) } -func (*Header) ProtoMessage() {} -func (*Header) Descriptor() ([]byte, []int) { - return fileDescriptor_02021a1d39b1aee0, []int{2} -} -func (m *Header) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Header) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *Header) XXX_Merge(src proto.Message) { - xxx_messageInfo_Header.Merge(m, src) -} -func (m *Header) XXX_Size() int { - return m.Size() -} -func (m *Header) XXX_DiscardUnknown() { - xxx_messageInfo_Header.DiscardUnknown(m) -} - -var xxx_messageInfo_Header proto.InternalMessageInfo - -type isHeader_Value interface { - isHeader_Value() - MarshalTo([]byte) (int, error) - Size() int -} - -type Header_Link struct { - Link *Link `protobuf:"bytes,1,opt,name=Link,proto3,oneof" json:"Link,omitempty"` -} -type Header_Redirect struct { - Redirect *refs.Address `protobuf:"bytes,2,opt,name=Redirect,proto3,oneof" json:"Redirect,omitempty"` -} -type Header_UserHeader struct { - UserHeader *UserHeader `protobuf:"bytes,3,opt,name=UserHeader,proto3,oneof" json:"UserHeader,omitempty"` -} -type Header_Transform struct { - Transform *Transform `protobuf:"bytes,4,opt,name=Transform,proto3,oneof" json:"Transform,omitempty"` -} -type Header_Tombstone struct { - Tombstone *Tombstone `protobuf:"bytes,5,opt,name=Tombstone,proto3,oneof" json:"Tombstone,omitempty"` -} -type Header_Token struct { - Token *service.Token `protobuf:"bytes,6,opt,name=Token,proto3,oneof" json:"Token,omitempty"` -} -type Header_HomoHash struct { - HomoHash Hash `protobuf:"bytes,7,opt,name=HomoHash,proto3,oneof,customtype=Hash" json:"HomoHash,omitempty"` -} -type Header_PayloadChecksum struct { - PayloadChecksum []byte `protobuf:"bytes,8,opt,name=PayloadChecksum,proto3,oneof" json:"PayloadChecksum,omitempty"` -} -type Header_Integrity struct { - Integrity *IntegrityHeader `protobuf:"bytes,9,opt,name=Integrity,proto3,oneof" json:"Integrity,omitempty"` -} -type Header_StorageGroup struct { - StorageGroup *storagegroup.StorageGroup `protobuf:"bytes,10,opt,name=StorageGroup,proto3,oneof" json:"StorageGroup,omitempty"` -} -type Header_PublicKey struct { - PublicKey *PublicKey `protobuf:"bytes,11,opt,name=PublicKey,proto3,oneof" json:"PublicKey,omitempty"` -} - -func (*Header_Link) isHeader_Value() {} -func (*Header_Redirect) isHeader_Value() {} -func (*Header_UserHeader) isHeader_Value() {} -func (*Header_Transform) isHeader_Value() {} -func (*Header_Tombstone) isHeader_Value() {} -func (*Header_Token) isHeader_Value() {} -func (*Header_HomoHash) isHeader_Value() {} -func (*Header_PayloadChecksum) isHeader_Value() {} -func (*Header_Integrity) isHeader_Value() {} -func (*Header_StorageGroup) isHeader_Value() {} -func (*Header_PublicKey) isHeader_Value() {} - -func (m *Header) GetValue() isHeader_Value { - if m != nil { - return m.Value - } - return nil -} - -func (m *Header) GetLink() *Link { - if x, ok := m.GetValue().(*Header_Link); ok { - return x.Link - } - return nil -} - -func (m *Header) GetRedirect() *refs.Address { - if x, ok := m.GetValue().(*Header_Redirect); ok { - return x.Redirect - } - return nil -} - -func (m *Header) GetUserHeader() *UserHeader { - if x, ok := m.GetValue().(*Header_UserHeader); ok { - return x.UserHeader - } - return nil -} - -func (m *Header) GetTransform() *Transform { - if x, ok := m.GetValue().(*Header_Transform); ok { - return x.Transform - } - return nil -} - -func (m *Header) GetTombstone() *Tombstone { - if x, ok := m.GetValue().(*Header_Tombstone); ok { - return x.Tombstone - } - return nil -} - -func (m *Header) GetToken() *service.Token { - if x, ok := m.GetValue().(*Header_Token); ok { - return x.Token - } - return nil -} - -func (m *Header) GetPayloadChecksum() []byte { - if x, ok := m.GetValue().(*Header_PayloadChecksum); ok { - return x.PayloadChecksum - } - return nil -} - -func (m *Header) GetIntegrity() *IntegrityHeader { - if x, ok := m.GetValue().(*Header_Integrity); ok { - return x.Integrity - } - return nil -} - -func (m *Header) GetStorageGroup() *storagegroup.StorageGroup { - if x, ok := m.GetValue().(*Header_StorageGroup); ok { - return x.StorageGroup - } - return nil -} - -func (m *Header) GetPublicKey() *PublicKey { - if x, ok := m.GetValue().(*Header_PublicKey); ok { - return x.PublicKey - } - return nil -} - -// XXX_OneofWrappers is for the internal use of the proto package. -func (*Header) XXX_OneofWrappers() []interface{} { - return []interface{}{ - (*Header_Link)(nil), - (*Header_Redirect)(nil), - (*Header_UserHeader)(nil), - (*Header_Transform)(nil), - (*Header_Tombstone)(nil), - (*Header_Token)(nil), - (*Header_HomoHash)(nil), - (*Header_PayloadChecksum)(nil), - (*Header_Integrity)(nil), - (*Header_StorageGroup)(nil), - (*Header_PublicKey)(nil), - } -} - -type Tombstone struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Tombstone) Reset() { *m = Tombstone{} } -func (m *Tombstone) String() string { return proto.CompactTextString(m) } -func (*Tombstone) ProtoMessage() {} -func (*Tombstone) Descriptor() ([]byte, []int) { - return fileDescriptor_02021a1d39b1aee0, []int{3} -} -func (m *Tombstone) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Tombstone) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *Tombstone) XXX_Merge(src proto.Message) { - xxx_messageInfo_Tombstone.Merge(m, src) -} -func (m *Tombstone) XXX_Size() int { - return m.Size() -} -func (m *Tombstone) XXX_DiscardUnknown() { - xxx_messageInfo_Tombstone.DiscardUnknown(m) -} - -var xxx_messageInfo_Tombstone proto.InternalMessageInfo - -type SystemHeader struct { - // Version of the object structure - Version uint64 `protobuf:"varint,1,opt,name=Version,proto3" json:"Version,omitempty"` - // PayloadLength is an object payload length - PayloadLength uint64 `protobuf:"varint,2,opt,name=PayloadLength,proto3" json:"PayloadLength,omitempty"` - // ID is an object identifier, is a valid UUIDv4 - ID ID `protobuf:"bytes,3,opt,name=ID,proto3,customtype=ID" json:"ID"` - // OwnerID is a wallet address - OwnerID OwnerID `protobuf:"bytes,4,opt,name=OwnerID,proto3,customtype=OwnerID" json:"OwnerID"` - // CID is a SHA256 hash of the container structure (container identifier) - CID CID `protobuf:"bytes,5,opt,name=CID,proto3,customtype=CID" json:"CID"` - // CreatedAt is a timestamp of object creation - CreatedAt CreationPoint `protobuf:"bytes,6,opt,name=CreatedAt,proto3" json:"CreatedAt"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *SystemHeader) Reset() { *m = SystemHeader{} } -func (m *SystemHeader) String() string { return proto.CompactTextString(m) } -func (*SystemHeader) ProtoMessage() {} -func (*SystemHeader) Descriptor() ([]byte, []int) { - return fileDescriptor_02021a1d39b1aee0, []int{4} -} -func (m *SystemHeader) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *SystemHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *SystemHeader) XXX_Merge(src proto.Message) { - xxx_messageInfo_SystemHeader.Merge(m, src) -} -func (m *SystemHeader) XXX_Size() int { - return m.Size() -} -func (m *SystemHeader) XXX_DiscardUnknown() { - xxx_messageInfo_SystemHeader.DiscardUnknown(m) -} - -var xxx_messageInfo_SystemHeader proto.InternalMessageInfo - -func (m *SystemHeader) GetVersion() uint64 { - if m != nil { - return m.Version - } - return 0 -} - -func (m *SystemHeader) GetPayloadLength() uint64 { - if m != nil { - return m.PayloadLength - } - return 0 -} - -func (m *SystemHeader) GetCreatedAt() CreationPoint { - if m != nil { - return m.CreatedAt - } - return CreationPoint{} -} - -type CreationPoint struct { - // UnixTime is a date of creation in unixtime format - UnixTime int64 `protobuf:"varint,1,opt,name=UnixTime,proto3" json:"UnixTime,omitempty"` - // Epoch is a date of creation in NeoFS epochs - Epoch uint64 `protobuf:"varint,2,opt,name=Epoch,proto3" json:"Epoch,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *CreationPoint) Reset() { *m = CreationPoint{} } -func (*CreationPoint) ProtoMessage() {} -func (*CreationPoint) Descriptor() ([]byte, []int) { - return fileDescriptor_02021a1d39b1aee0, []int{5} -} -func (m *CreationPoint) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *CreationPoint) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *CreationPoint) XXX_Merge(src proto.Message) { - xxx_messageInfo_CreationPoint.Merge(m, src) -} -func (m *CreationPoint) XXX_Size() int { - return m.Size() -} -func (m *CreationPoint) XXX_DiscardUnknown() { - xxx_messageInfo_CreationPoint.DiscardUnknown(m) -} - -var xxx_messageInfo_CreationPoint proto.InternalMessageInfo - -func (m *CreationPoint) GetUnixTime() int64 { - if m != nil { - return m.UnixTime - } - return 0 -} - -func (m *CreationPoint) GetEpoch() uint64 { - if m != nil { - return m.Epoch - } - return 0 -} - -type IntegrityHeader struct { - // HeadersChecksum is a checksum of all above headers in the object - HeadersChecksum []byte `protobuf:"bytes,1,opt,name=HeadersChecksum,proto3" json:"HeadersChecksum,omitempty"` - // ChecksumSignature is an user's signature of checksum to verify if it is correct - ChecksumSignature []byte `protobuf:"bytes,2,opt,name=ChecksumSignature,proto3" json:"ChecksumSignature,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *IntegrityHeader) Reset() { *m = IntegrityHeader{} } -func (m *IntegrityHeader) String() string { return proto.CompactTextString(m) } -func (*IntegrityHeader) ProtoMessage() {} -func (*IntegrityHeader) Descriptor() ([]byte, []int) { - return fileDescriptor_02021a1d39b1aee0, []int{6} -} -func (m *IntegrityHeader) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *IntegrityHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *IntegrityHeader) XXX_Merge(src proto.Message) { - xxx_messageInfo_IntegrityHeader.Merge(m, src) -} -func (m *IntegrityHeader) XXX_Size() int { - return m.Size() -} -func (m *IntegrityHeader) XXX_DiscardUnknown() { - xxx_messageInfo_IntegrityHeader.DiscardUnknown(m) -} - -var xxx_messageInfo_IntegrityHeader proto.InternalMessageInfo - -func (m *IntegrityHeader) GetHeadersChecksum() []byte { - if m != nil { - return m.HeadersChecksum - } - return nil -} - -func (m *IntegrityHeader) GetChecksumSignature() []byte { - if m != nil { - return m.ChecksumSignature - } - return nil -} - -type Link struct { - // Type of link - Type Link_Type `protobuf:"varint,1,opt,name=type,proto3,enum=object.Link_Type" json:"type,omitempty"` - // ID is an object identifier, is a valid UUIDv4 - ID ID `protobuf:"bytes,2,opt,name=ID,proto3,customtype=ID" json:"ID"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Link) Reset() { *m = Link{} } -func (m *Link) String() string { return proto.CompactTextString(m) } -func (*Link) ProtoMessage() {} -func (*Link) Descriptor() ([]byte, []int) { - return fileDescriptor_02021a1d39b1aee0, []int{7} -} -func (m *Link) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Link) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *Link) XXX_Merge(src proto.Message) { - xxx_messageInfo_Link.Merge(m, src) -} -func (m *Link) XXX_Size() int { - return m.Size() -} -func (m *Link) XXX_DiscardUnknown() { - xxx_messageInfo_Link.DiscardUnknown(m) -} - -var xxx_messageInfo_Link proto.InternalMessageInfo - -func (m *Link) GetType() Link_Type { - if m != nil { - return m.Type - } - return Link_Unknown -} - -type Transform struct { - // Type of object transformation - Type Transform_Type `protobuf:"varint,1,opt,name=type,proto3,enum=object.Transform_Type" json:"type,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Transform) Reset() { *m = Transform{} } -func (m *Transform) String() string { return proto.CompactTextString(m) } -func (*Transform) ProtoMessage() {} -func (*Transform) Descriptor() ([]byte, []int) { - return fileDescriptor_02021a1d39b1aee0, []int{8} -} -func (m *Transform) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Transform) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *Transform) XXX_Merge(src proto.Message) { - xxx_messageInfo_Transform.Merge(m, src) -} -func (m *Transform) XXX_Size() int { - return m.Size() -} -func (m *Transform) XXX_DiscardUnknown() { - xxx_messageInfo_Transform.DiscardUnknown(m) -} - -var xxx_messageInfo_Transform proto.InternalMessageInfo - -func (m *Transform) GetType() Transform_Type { - if m != nil { - return m.Type - } - return Transform_Unknown -} - -type Object struct { - // SystemHeader describes system header - SystemHeader SystemHeader `protobuf:"bytes,1,opt,name=SystemHeader,proto3" json:"SystemHeader"` - // Headers describes a set of an extended headers - Headers []Header `protobuf:"bytes,2,rep,name=Headers,proto3" json:"Headers"` - // Payload is an object's payload - Payload []byte `protobuf:"bytes,3,opt,name=Payload,proto3" json:"Payload,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Object) Reset() { *m = Object{} } -func (m *Object) String() string { return proto.CompactTextString(m) } -func (*Object) ProtoMessage() {} -func (*Object) Descriptor() ([]byte, []int) { - return fileDescriptor_02021a1d39b1aee0, []int{9} -} -func (m *Object) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Object) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *Object) XXX_Merge(src proto.Message) { - xxx_messageInfo_Object.Merge(m, src) -} -func (m *Object) XXX_Size() int { - return m.Size() -} -func (m *Object) XXX_DiscardUnknown() { - xxx_messageInfo_Object.DiscardUnknown(m) -} - -var xxx_messageInfo_Object proto.InternalMessageInfo - -func (m *Object) GetSystemHeader() SystemHeader { - if m != nil { - return m.SystemHeader - } - return SystemHeader{} -} - -func (m *Object) GetHeaders() []Header { - if m != nil { - return m.Headers - } - return nil -} - -func (m *Object) GetPayload() []byte { - if m != nil { - return m.Payload - } - return nil -} - -type PublicKey struct { - // Value contains marshaled ecdsa public key - Value []byte `protobuf:"bytes,1,opt,name=Value,proto3" json:"Value,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *PublicKey) Reset() { *m = PublicKey{} } -func (m *PublicKey) String() string { return proto.CompactTextString(m) } -func (*PublicKey) ProtoMessage() {} -func (*PublicKey) Descriptor() ([]byte, []int) { - return fileDescriptor_02021a1d39b1aee0, []int{10} -} -func (m *PublicKey) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *PublicKey) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *PublicKey) XXX_Merge(src proto.Message) { - xxx_messageInfo_PublicKey.Merge(m, src) -} -func (m *PublicKey) XXX_Size() int { - return m.Size() -} -func (m *PublicKey) XXX_DiscardUnknown() { - xxx_messageInfo_PublicKey.DiscardUnknown(m) -} - -var xxx_messageInfo_PublicKey proto.InternalMessageInfo - -func (m *PublicKey) GetValue() []byte { - if m != nil { - return m.Value - } - return nil -} - -func init() { - proto.RegisterEnum("object.Link_Type", Link_Type_name, Link_Type_value) - proto.RegisterEnum("object.Transform_Type", Transform_Type_name, Transform_Type_value) - proto.RegisterType((*Range)(nil), "object.Range") - proto.RegisterType((*UserHeader)(nil), "object.UserHeader") - proto.RegisterType((*Header)(nil), "object.Header") - proto.RegisterType((*Tombstone)(nil), "object.Tombstone") - proto.RegisterType((*SystemHeader)(nil), "object.SystemHeader") - proto.RegisterType((*CreationPoint)(nil), "object.CreationPoint") - proto.RegisterType((*IntegrityHeader)(nil), "object.IntegrityHeader") - proto.RegisterType((*Link)(nil), "object.Link") - proto.RegisterType((*Transform)(nil), "object.Transform") - proto.RegisterType((*Object)(nil), "object.Object") - proto.RegisterType((*PublicKey)(nil), "object.PublicKey") -} - -func init() { proto.RegisterFile("object/types.proto", fileDescriptor_02021a1d39b1aee0) } - -var fileDescriptor_02021a1d39b1aee0 = []byte{ - // 916 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x55, 0x4f, 0x8f, 0xdb, 0x44, - 0x14, 0xb7, 0x13, 0xe7, 0xdf, 0x8b, 0xb7, 0xeb, 0x8e, 0x96, 0x62, 0x45, 0x22, 0xbb, 0x58, 0x50, - 0x2d, 0x85, 0x75, 0x44, 0x8b, 0x54, 0xc1, 0x01, 0xb1, 0xd9, 0x40, 0x1d, 0x51, 0xba, 0x61, 0x92, - 0xed, 0x81, 0x9b, 0x93, 0x4c, 0x1c, 0xb3, 0xc9, 0x4c, 0x34, 0x33, 0xd9, 0x36, 0x5f, 0x83, 0x53, - 0x6f, 0x70, 0x44, 0x7c, 0x92, 0x1e, 0x39, 0xa2, 0x1e, 0x56, 0x68, 0xf9, 0x00, 0x7c, 0x85, 0x6a, - 0xc6, 0x76, 0x62, 0x6f, 0x7b, 0x89, 0xe6, 0xbd, 0xdf, 0xef, 0x37, 0x7e, 0xf3, 0xde, 0x6f, 0x26, - 0x80, 0xd8, 0xf8, 0x57, 0x32, 0x91, 0x1d, 0xb9, 0x59, 0x11, 0xe1, 0xaf, 0x38, 0x93, 0x0c, 0x55, - 0x93, 0x5c, 0xcb, 0xe1, 0x64, 0x26, 0xf2, 0x48, 0xeb, 0x40, 0x10, 0x7e, 0x15, 0x4f, 0x48, 0xe7, - 0x8a, 0xf0, 0x78, 0xb6, 0x49, 0xb3, 0xae, 0x90, 0x8c, 0x87, 0x11, 0x89, 0x38, 0x5b, 0xaf, 0x0a, - 0xfc, 0x93, 0x28, 0x96, 0xf3, 0xf5, 0xd8, 0x9f, 0xb0, 0x65, 0x27, 0x62, 0x11, 0xeb, 0xe8, 0xf4, - 0x78, 0x3d, 0xd3, 0x91, 0x0e, 0xf4, 0x2a, 0xa1, 0x7b, 0x8f, 0xa1, 0x82, 0x43, 0x1a, 0x11, 0x74, - 0x0f, 0xaa, 0xe7, 0xb3, 0x99, 0x20, 0xd2, 0x35, 0x8f, 0xcc, 0x63, 0x0b, 0xa7, 0x91, 0xca, 0x3f, - 0x25, 0x34, 0x92, 0x73, 0xb7, 0x94, 0xe4, 0x93, 0xc8, 0xfb, 0x0a, 0xe0, 0x42, 0x10, 0x1e, 0x90, - 0x70, 0x4a, 0x38, 0x72, 0xa0, 0xfc, 0x23, 0xd9, 0x68, 0x69, 0x03, 0xab, 0x25, 0x3a, 0x80, 0xca, - 0xf3, 0x70, 0xb1, 0x26, 0x5a, 0xd6, 0xc0, 0x49, 0xe0, 0xfd, 0x69, 0x41, 0x35, 0x95, 0x78, 0x60, - 0x3d, 0x8d, 0xe9, 0xa5, 0xd6, 0x34, 0x1f, 0xda, 0x7e, 0xd2, 0x01, 0x5f, 0xe5, 0x02, 0x03, 0x6b, - 0x0c, 0x7d, 0x0e, 0x75, 0x4c, 0xa6, 0x31, 0x27, 0x13, 0xa9, 0xf7, 0x69, 0x3e, 0xdc, 0xf3, 0x55, - 0x87, 0xfc, 0xd3, 0xe9, 0x94, 0x13, 0x21, 0x02, 0x03, 0x6f, 0x09, 0xa8, 0x50, 0x91, 0x5b, 0xd6, - 0x74, 0x94, 0x6d, 0xbb, 0x43, 0x02, 0x03, 0xe7, 0x2b, 0xff, 0x12, 0x1a, 0x23, 0x1e, 0x52, 0x31, - 0x63, 0x7c, 0xe9, 0x5a, 0x5a, 0x74, 0x37, 0x13, 0x6d, 0x81, 0xc0, 0xc0, 0x3b, 0x96, 0x96, 0xb0, - 0xe5, 0x58, 0x48, 0x46, 0x89, 0x5b, 0xb9, 0x25, 0xc9, 0x00, 0x2d, 0xc9, 0x02, 0x74, 0x1f, 0x2a, - 0x23, 0x76, 0x49, 0xa8, 0x5b, 0xd5, 0xf4, 0x3b, 0x7e, 0x3a, 0x55, 0x5f, 0x67, 0x03, 0x03, 0x27, - 0x30, 0xba, 0x0f, 0xf5, 0x80, 0x2d, 0x59, 0x10, 0x8a, 0xb9, 0x5b, 0x3b, 0x32, 0x8f, 0xed, 0x6e, - 0xfd, 0xcd, 0xf5, 0xa1, 0xa5, 0x62, 0x75, 0xd6, 0x0c, 0x43, 0x0f, 0x60, 0x7f, 0x10, 0x6e, 0x16, - 0x2c, 0x9c, 0x9e, 0xcd, 0xc9, 0xe4, 0x52, 0xac, 0x97, 0x6e, 0x5d, 0xd1, 0x03, 0x03, 0xdf, 0x06, - 0xd0, 0x63, 0x68, 0xf4, 0xa9, 0x24, 0x11, 0x8f, 0xe5, 0xc6, 0x6d, 0xe8, 0xef, 0x7f, 0x98, 0x95, - 0xbb, 0x05, 0xb6, 0xbd, 0xd9, 0x71, 0xd1, 0x77, 0x60, 0x0f, 0x13, 0x9b, 0x3d, 0x51, 0x36, 0x73, - 0x41, 0x6b, 0x5b, 0x7e, 0xde, 0x7b, 0x7e, 0x9e, 0x11, 0x18, 0xb8, 0xa0, 0x50, 0x9d, 0x1a, 0xac, - 0xc7, 0x8b, 0x78, 0xa2, 0xcc, 0xd1, 0x2c, 0x76, 0x6a, 0x0b, 0xa8, 0x8f, 0x6e, 0x83, 0x6e, 0x2d, - 0xf5, 0x8d, 0xd7, 0xcc, 0x75, 0xd9, 0xfb, 0xdf, 0x04, 0x7b, 0xb8, 0x11, 0x92, 0x2c, 0xd3, 0xb1, - 0xb9, 0x50, 0x7b, 0x4e, 0xb8, 0x88, 0x19, 0x4d, 0xfd, 0x9a, 0x85, 0xe8, 0x13, 0xd8, 0x4b, 0x3b, - 0x50, 0xf0, 0x6d, 0x31, 0x89, 0x5a, 0x50, 0xea, 0xf7, 0xb4, 0x49, 0xec, 0x2e, 0xbc, 0xbe, 0x3e, - 0x34, 0xde, 0x5c, 0x1f, 0x96, 0xfa, 0x3d, 0x5c, 0xea, 0xf7, 0xd0, 0x67, 0x50, 0x3b, 0x7f, 0x41, - 0x09, 0xef, 0xf7, 0xb4, 0x21, 0xec, 0xee, 0x7e, 0x4a, 0xc8, 0xd2, 0x38, 0x5b, 0xa0, 0x8f, 0xa0, - 0x7c, 0xd6, 0xef, 0x69, 0x13, 0xd8, 0xdd, 0x66, 0x4a, 0x53, 0x29, 0xac, 0x7e, 0xd0, 0xd7, 0xd0, - 0x38, 0xe3, 0x24, 0x94, 0x64, 0x7a, 0x2a, 0xd3, 0xd1, 0x7f, 0x90, 0x9d, 0x5f, 0x03, 0x31, 0xa3, - 0x03, 0x16, 0x53, 0xd9, 0xb5, 0x94, 0x16, 0xef, 0xd8, 0xde, 0x13, 0xd8, 0x2b, 0x30, 0x50, 0x0b, - 0xea, 0x17, 0x34, 0x7e, 0x39, 0x8a, 0x97, 0x44, 0x1f, 0xb9, 0x8c, 0xb7, 0xb1, 0xba, 0x6c, 0xdf, - 0xaf, 0xd8, 0x24, 0x3b, 0x6b, 0x12, 0x7c, 0x63, 0xbd, 0xfa, 0xe3, 0xd0, 0xf0, 0x62, 0xd8, 0xbf, - 0x35, 0x65, 0x74, 0x0c, 0xfb, 0xc9, 0x4a, 0x6c, 0xdd, 0xa3, 0x76, 0xb4, 0xf1, 0xed, 0x34, 0xfa, - 0x02, 0xee, 0x66, 0xeb, 0x61, 0x1c, 0xd1, 0x50, 0xae, 0x79, 0x72, 0xa3, 0x6d, 0xfc, 0x2e, 0xe0, - 0xfd, 0x6e, 0x26, 0x77, 0x1a, 0x7d, 0x0a, 0x96, 0x7a, 0x93, 0xf4, 0xae, 0x77, 0x76, 0x23, 0x57, - 0x98, 0x3f, 0xda, 0xac, 0x08, 0xd6, 0x70, 0x3a, 0x84, 0xd2, 0xfb, 0x86, 0xe0, 0x8d, 0xc0, 0x52, - 0x4c, 0xd4, 0x84, 0xda, 0x05, 0xbd, 0xa4, 0xec, 0x05, 0x75, 0x0c, 0x04, 0x50, 0x1d, 0x84, 0x9c, - 0x50, 0xe9, 0x98, 0xc8, 0x86, 0xfa, 0x80, 0x93, 0xab, 0x98, 0xad, 0x85, 0x53, 0x42, 0x75, 0xb0, - 0x9e, 0x91, 0x97, 0xd2, 0x29, 0xa3, 0x06, 0x54, 0xce, 0xe6, 0xf1, 0x62, 0xea, 0x58, 0xc8, 0x29, - 0x1a, 0xd8, 0xa9, 0x78, 0x8b, 0xdc, 0x6d, 0x47, 0x0f, 0x0a, 0x55, 0xde, 0x7b, 0xe7, 0xd6, 0xe7, - 0x4a, 0xf5, 0x1e, 0xbd, 0xaf, 0x9c, 0x06, 0x54, 0x86, 0xab, 0x45, 0xac, 0xaa, 0xa9, 0x83, 0xa5, - 0xfa, 0xe0, 0x94, 0x54, 0xf2, 0x27, 0xb6, 0x5e, 0x4c, 0x9d, 0xb2, 0xf7, 0x9b, 0x09, 0xd5, 0x73, - 0xbd, 0x29, 0xfa, 0xb6, 0xe8, 0xdf, 0xf4, 0xd5, 0x3b, 0xc8, 0xbe, 0x99, 0xc7, 0x52, 0x2f, 0x14, - 0xfd, 0xee, 0x43, 0x2d, 0x9d, 0x8d, 0x5b, 0x3a, 0x2a, 0xeb, 0x27, 0x24, 0x95, 0x16, 0x44, 0x19, - 0x49, 0xdd, 0x8f, 0xd4, 0xf0, 0x89, 0xc9, 0x71, 0x16, 0x7a, 0x1f, 0xe7, 0xee, 0xe4, 0xee, 0x95, - 0x4e, 0xe6, 0x9f, 0x04, 0xdd, 0x9f, 0x5f, 0xdf, 0xb4, 0xcd, 0xbf, 0x6f, 0xda, 0xe6, 0x3f, 0x37, - 0x6d, 0xf3, 0xdf, 0x9b, 0xb6, 0xf9, 0xea, 0xbf, 0xb6, 0xf1, 0xcb, 0x71, 0xee, 0x9f, 0x85, 0x8a, - 0xd5, 0x64, 0x72, 0x32, 0x25, 0x57, 0x1d, 0x4a, 0xd8, 0x4c, 0x9c, 0x84, 0xab, 0xf8, 0x24, 0x62, - 0x9d, 0xa4, 0xa4, 0xbf, 0x4a, 0xce, 0x33, 0xc2, 0x7e, 0x18, 0xfa, 0xa7, 0x83, 0xbe, 0x9f, 0x9c, - 0x7f, 0x5c, 0xd5, 0x7f, 0x37, 0x8f, 0xde, 0x06, 0x00, 0x00, 0xff, 0xff, 0x4e, 0xcb, 0xd2, 0xde, - 0xfd, 0x06, 0x00, 0x00, -} - -func (m *Range) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Range) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Range) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.Length != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.Length)) - i-- - dAtA[i] = 0x10 - } - if m.Offset != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.Offset)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *UserHeader) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *UserHeader) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *UserHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.Value) > 0 { - i -= len(m.Value) - copy(dAtA[i:], m.Value) - i = encodeVarintTypes(dAtA, i, uint64(len(m.Value))) - i-- - dAtA[i] = 0x12 - } - if len(m.Key) > 0 { - i -= len(m.Key) - copy(dAtA[i:], m.Key) - i = encodeVarintTypes(dAtA, i, uint64(len(m.Key))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Header) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Header) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Header) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.Value != nil { - { - size := m.Value.Size() - i -= size - if _, err := m.Value.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - } - } - return len(dAtA) - i, nil -} - -func (m *Header_Link) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Header_Link) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.Link != nil { - { - size, err := m.Link.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} -func (m *Header_Redirect) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Header_Redirect) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.Redirect != nil { - { - size, err := m.Redirect.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - return len(dAtA) - i, nil -} -func (m *Header_UserHeader) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Header_UserHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.UserHeader != nil { - { - size, err := m.UserHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - return len(dAtA) - i, nil -} -func (m *Header_Transform) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Header_Transform) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.Transform != nil { - { - size, err := m.Transform.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } - return len(dAtA) - i, nil -} -func (m *Header_Tombstone) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Header_Tombstone) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.Tombstone != nil { - { - size, err := m.Tombstone.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2a - } - return len(dAtA) - i, nil -} -func (m *Header_Token) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Header_Token) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.Token != nil { - { - size, err := m.Token.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x32 - } - return len(dAtA) - i, nil -} -func (m *Header_HomoHash) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Header_HomoHash) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - { - size := m.HomoHash.Size() - i -= size - if _, err := m.HomoHash.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x3a - return len(dAtA) - i, nil -} -func (m *Header_PayloadChecksum) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Header_PayloadChecksum) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.PayloadChecksum != nil { - i -= len(m.PayloadChecksum) - copy(dAtA[i:], m.PayloadChecksum) - i = encodeVarintTypes(dAtA, i, uint64(len(m.PayloadChecksum))) - i-- - dAtA[i] = 0x42 - } - return len(dAtA) - i, nil -} -func (m *Header_Integrity) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Header_Integrity) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.Integrity != nil { - { - size, err := m.Integrity.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x4a - } - return len(dAtA) - i, nil -} -func (m *Header_StorageGroup) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Header_StorageGroup) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.StorageGroup != nil { - { - size, err := m.StorageGroup.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x52 - } - return len(dAtA) - i, nil -} -func (m *Header_PublicKey) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Header_PublicKey) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.PublicKey != nil { - { - size, err := m.PublicKey.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x5a - } - return len(dAtA) - i, nil -} -func (m *Tombstone) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Tombstone) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Tombstone) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - return len(dAtA) - i, nil -} - -func (m *SystemHeader) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *SystemHeader) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *SystemHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - { - size, err := m.CreatedAt.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x32 - { - size := m.CID.Size() - i -= size - if _, err := m.CID.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2a - { - size := m.OwnerID.Size() - i -= size - if _, err := m.OwnerID.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - { - size := m.ID.Size() - i -= size - if _, err := m.ID.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - if m.PayloadLength != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.PayloadLength)) - i-- - dAtA[i] = 0x10 - } - if m.Version != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.Version)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *CreationPoint) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *CreationPoint) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *CreationPoint) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.Epoch != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.Epoch)) - i-- - dAtA[i] = 0x10 - } - if m.UnixTime != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.UnixTime)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *IntegrityHeader) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *IntegrityHeader) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *IntegrityHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.ChecksumSignature) > 0 { - i -= len(m.ChecksumSignature) - copy(dAtA[i:], m.ChecksumSignature) - i = encodeVarintTypes(dAtA, i, uint64(len(m.ChecksumSignature))) - i-- - dAtA[i] = 0x12 - } - if len(m.HeadersChecksum) > 0 { - i -= len(m.HeadersChecksum) - copy(dAtA[i:], m.HeadersChecksum) - i = encodeVarintTypes(dAtA, i, uint64(len(m.HeadersChecksum))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Link) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Link) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Link) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - { - size := m.ID.Size() - i -= size - if _, err := m.ID.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - if m.Type != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.Type)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *Transform) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Transform) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Transform) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.Type != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.Type)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *Object) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Object) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Object) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.Payload) > 0 { - i -= len(m.Payload) - copy(dAtA[i:], m.Payload) - i = encodeVarintTypes(dAtA, i, uint64(len(m.Payload))) - i-- - dAtA[i] = 0x1a - } - if len(m.Headers) > 0 { - for iNdEx := len(m.Headers) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Headers[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - { - size, err := m.SystemHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *PublicKey) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *PublicKey) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *PublicKey) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.Value) > 0 { - i -= len(m.Value) - copy(dAtA[i:], m.Value) - i = encodeVarintTypes(dAtA, i, uint64(len(m.Value))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func encodeVarintTypes(dAtA []byte, offset int, v uint64) int { - offset -= sovTypes(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *Range) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Offset != 0 { - n += 1 + sovTypes(uint64(m.Offset)) - } - if m.Length != 0 { - n += 1 + sovTypes(uint64(m.Length)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *UserHeader) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Key) - if l > 0 { - n += 1 + l + sovTypes(uint64(l)) - } - l = len(m.Value) - if l > 0 { - n += 1 + l + sovTypes(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *Header) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Value != nil { - n += m.Value.Size() - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *Header_Link) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Link != nil { - l = m.Link.Size() - n += 1 + l + sovTypes(uint64(l)) - } - return n -} -func (m *Header_Redirect) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Redirect != nil { - l = m.Redirect.Size() - n += 1 + l + sovTypes(uint64(l)) - } - return n -} -func (m *Header_UserHeader) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.UserHeader != nil { - l = m.UserHeader.Size() - n += 1 + l + sovTypes(uint64(l)) - } - return n -} -func (m *Header_Transform) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Transform != nil { - l = m.Transform.Size() - n += 1 + l + sovTypes(uint64(l)) - } - return n -} -func (m *Header_Tombstone) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Tombstone != nil { - l = m.Tombstone.Size() - n += 1 + l + sovTypes(uint64(l)) - } - return n -} -func (m *Header_Token) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Token != nil { - l = m.Token.Size() - n += 1 + l + sovTypes(uint64(l)) - } - return n -} -func (m *Header_HomoHash) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.HomoHash.Size() - n += 1 + l + sovTypes(uint64(l)) - return n -} -func (m *Header_PayloadChecksum) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.PayloadChecksum != nil { - l = len(m.PayloadChecksum) - n += 1 + l + sovTypes(uint64(l)) - } - return n -} -func (m *Header_Integrity) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Integrity != nil { - l = m.Integrity.Size() - n += 1 + l + sovTypes(uint64(l)) - } - return n -} -func (m *Header_StorageGroup) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.StorageGroup != nil { - l = m.StorageGroup.Size() - n += 1 + l + sovTypes(uint64(l)) - } - return n -} -func (m *Header_PublicKey) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.PublicKey != nil { - l = m.PublicKey.Size() - n += 1 + l + sovTypes(uint64(l)) - } - return n -} -func (m *Tombstone) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *SystemHeader) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Version != 0 { - n += 1 + sovTypes(uint64(m.Version)) - } - if m.PayloadLength != 0 { - n += 1 + sovTypes(uint64(m.PayloadLength)) - } - l = m.ID.Size() - n += 1 + l + sovTypes(uint64(l)) - l = m.OwnerID.Size() - n += 1 + l + sovTypes(uint64(l)) - l = m.CID.Size() - n += 1 + l + sovTypes(uint64(l)) - l = m.CreatedAt.Size() - n += 1 + l + sovTypes(uint64(l)) - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *CreationPoint) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.UnixTime != 0 { - n += 1 + sovTypes(uint64(m.UnixTime)) - } - if m.Epoch != 0 { - n += 1 + sovTypes(uint64(m.Epoch)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *IntegrityHeader) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.HeadersChecksum) - if l > 0 { - n += 1 + l + sovTypes(uint64(l)) - } - l = len(m.ChecksumSignature) - if l > 0 { - n += 1 + l + sovTypes(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *Link) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Type != 0 { - n += 1 + sovTypes(uint64(m.Type)) - } - l = m.ID.Size() - n += 1 + l + sovTypes(uint64(l)) - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *Transform) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Type != 0 { - n += 1 + sovTypes(uint64(m.Type)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *Object) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.SystemHeader.Size() - n += 1 + l + sovTypes(uint64(l)) - if len(m.Headers) > 0 { - for _, e := range m.Headers { - l = e.Size() - n += 1 + l + sovTypes(uint64(l)) - } - } - l = len(m.Payload) - if l > 0 { - n += 1 + l + sovTypes(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *PublicKey) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Value) - if l > 0 { - n += 1 + l + sovTypes(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func sovTypes(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozTypes(x uint64) (n int) { - return sovTypes(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *Range) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Range: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Range: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Offset", wireType) - } - m.Offset = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Offset |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Length", wireType) - } - m.Length = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Length |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *UserHeader) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: UserHeader: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: UserHeader: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Key = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Value = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Header) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Header: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Header: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Link", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := &Link{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Value = &Header_Link{v} - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Redirect", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := &refs.Address{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Value = &Header_Redirect{v} - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field UserHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := &UserHeader{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Value = &Header_UserHeader{v} - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Transform", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := &Transform{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Value = &Header_Transform{v} - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Tombstone", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := &Tombstone{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Value = &Header_Tombstone{v} - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Token", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := &service.Token{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Value = &Header_Token{v} - iNdEx = postIndex - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field HomoHash", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - var vv Hash - v := &vv - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Value = &Header_HomoHash{*v} - iNdEx = postIndex - case 8: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PayloadChecksum", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := make([]byte, postIndex-iNdEx) - copy(v, dAtA[iNdEx:postIndex]) - m.Value = &Header_PayloadChecksum{v} - iNdEx = postIndex - case 9: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Integrity", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := &IntegrityHeader{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Value = &Header_Integrity{v} - iNdEx = postIndex - case 10: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field StorageGroup", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := &storagegroup.StorageGroup{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Value = &Header_StorageGroup{v} - iNdEx = postIndex - case 11: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PublicKey", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := &PublicKey{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Value = &Header_PublicKey{v} - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Tombstone) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Tombstone: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Tombstone: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *SystemHeader) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: SystemHeader: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: SystemHeader: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) - } - m.Version = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Version |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field PayloadLength", wireType) - } - m.PayloadLength = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.PayloadLength |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OwnerID", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.OwnerID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CID", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.CID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CreatedAt", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.CreatedAt.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *CreationPoint) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: CreationPoint: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: CreationPoint: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field UnixTime", wireType) - } - m.UnixTime = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.UnixTime |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Epoch", wireType) - } - m.Epoch = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Epoch |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *IntegrityHeader) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: IntegrityHeader: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: IntegrityHeader: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field HeadersChecksum", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.HeadersChecksum = append(m.HeadersChecksum[:0], dAtA[iNdEx:postIndex]...) - if m.HeadersChecksum == nil { - m.HeadersChecksum = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ChecksumSignature", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ChecksumSignature = append(m.ChecksumSignature[:0], dAtA[iNdEx:postIndex]...) - if m.ChecksumSignature == nil { - m.ChecksumSignature = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Link) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Link: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Link: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) - } - m.Type = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Type |= Link_Type(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Transform) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Transform: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Transform: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) - } - m.Type = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Type |= Transform_Type(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Object) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Object: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Object: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SystemHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.SystemHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Headers", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Headers = append(m.Headers, Header{}) - if err := m.Headers[len(m.Headers)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Payload", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Payload = append(m.Payload[:0], dAtA[iNdEx:postIndex]...) - if m.Payload == nil { - m.Payload = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *PublicKey) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: PublicKey: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: PublicKey: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Value = append(m.Value[:0], dAtA[iNdEx:postIndex]...) - if m.Value == nil { - m.Value = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipTypes(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTypes - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTypes - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTypes - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthTypes - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupTypes - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthTypes - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthTypes = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowTypes = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupTypes = fmt.Errorf("proto: unexpected end of group") -) diff --git a/object/types.proto b/object/types.proto deleted file mode 100644 index 46e1549..0000000 --- a/object/types.proto +++ /dev/null @@ -1,134 +0,0 @@ -syntax = "proto3"; -package object; -option go_package = "github.com/nspcc-dev/neofs-api-go/object"; -option csharp_namespace = "NeoFS.API.Object"; - -import "refs/types.proto"; -import "service/verify.proto"; -import "storagegroup/types.proto"; -import "github.com/gogo/protobuf/gogoproto/gogo.proto"; - -option (gogoproto.stable_marshaler_all) = true; - -message Range { - // Offset of the data range - uint64 Offset = 1; - // Length of the data range - uint64 Length = 2; -} - -message UserHeader { - // Key of the user's header - string Key = 1; - // Value of the user's header - string Value = 2; -} - -message Header { - oneof Value { - // Link to other objects - Link Link = 1; - // Redirect not used yet - refs.Address Redirect = 2; - // UserHeader is a set of KV headers defined by user - UserHeader UserHeader = 3; - // Transform defines transform operation (e.g. payload split) - Transform Transform = 4; - // Tombstone header that set up in deleted objects - Tombstone Tombstone = 5; - // Token header contains token of the session within which the object was created - service.Token Token = 6; - // HomoHash is a homomorphic hash of original object payload - bytes HomoHash = 7 [(gogoproto.customtype) = "Hash"]; - // PayloadChecksum of actual object's payload - bytes PayloadChecksum = 8; - // Integrity header with checksum of all above headers in the object - IntegrityHeader Integrity = 9; - // StorageGroup contains meta information for the data audit - storagegroup.StorageGroup StorageGroup = 10; - // PublicKey of owner of the object. Key is used for verification and can be based on NeoID or x509 cert. - PublicKey PublicKey = 11; - } -} - -message Tombstone {} - -message SystemHeader { - // Version of the object structure - uint64 Version = 1; - // PayloadLength is an object payload length - uint64 PayloadLength = 2; - - // ID is an object identifier, is a valid UUIDv4 - bytes ID = 3 [(gogoproto.customtype) = "ID", (gogoproto.nullable) = false]; - // OwnerID is a wallet address - bytes OwnerID = 4 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false]; - // CID is a SHA256 hash of the container structure (container identifier) - bytes CID = 5 [(gogoproto.customtype) = "CID", (gogoproto.nullable) = false]; - // CreatedAt is a timestamp of object creation - CreationPoint CreatedAt = 6 [(gogoproto.nullable) = false]; -} - -message CreationPoint { - option (gogoproto.goproto_stringer) = false; - - // UnixTime is a date of creation in unixtime format - int64 UnixTime = 1; - // Epoch is a date of creation in NeoFS epochs - uint64 Epoch = 2; -} - -message IntegrityHeader { - // HeadersChecksum is a checksum of all above headers in the object - bytes HeadersChecksum = 1; - // ChecksumSignature is an user's signature of checksum to verify if it is correct - bytes ChecksumSignature = 2; -} - -message Link { - enum Type { - Unknown = 0; - // Parent object created during object transformation - Parent = 1; - // Previous object in the linked list created during object transformation - Previous = 2; - // Next object in the linked list created during object transformation - Next = 3; - // Child object created during object transformation - Child = 4; - // Object that included into this storage group - StorageGroup = 5; - } - // Type of link - Type type = 1; - // ID is an object identifier, is a valid UUIDv4 - bytes ID = 2 [(gogoproto.customtype) = "ID", (gogoproto.nullable) = false]; -} - -message Transform { - enum Type { - Unknown = 0; - // Split sets when object created after payload split - Split = 1; - // Sign sets when object created after re-signing (doesn't used) - Sign = 2; - // Mould sets when object created after filling missing headers in the object - Mould = 3; - } - // Type of object transformation - Type type = 1; -} - -message Object { - // SystemHeader describes system header - SystemHeader SystemHeader = 1 [(gogoproto.nullable) = false]; - // Headers describes a set of an extended headers - repeated Header Headers = 2 [(gogoproto.nullable) = false]; - // Payload is an object's payload - bytes Payload = 3; -} - -message PublicKey { - // Value contains marshaled ecdsa public key - bytes Value = 1; -} diff --git a/object/types_test.go b/object/types_test.go deleted file mode 100644 index 4a2ca92..0000000 --- a/object/types_test.go +++ /dev/null @@ -1,234 +0,0 @@ -package object - -import ( - "bytes" - "testing" - - "github.com/gogo/protobuf/proto" - "github.com/nspcc-dev/neofs-api-go/refs" - "github.com/nspcc-dev/neofs-api-go/service" - "github.com/nspcc-dev/neofs-api-go/storagegroup" - "github.com/nspcc-dev/neofs-crypto/test" - "github.com/stretchr/testify/require" -) - -func TestStringify(t *testing.T) { - res := ` -Object: - SystemHeader: - - ID=7e0b9c6c-aabc-4985-949e-2680e577b48b - - CID=11111111111111111111111111111111 - - OwnerID=NQHKh7fKGieCPrPuiEkY58ucRFwWMyU1Mc - - Version=1 - - PayloadLength=1 - - CreatedAt={UnixTime=1 Epoch=1} - UserHeaders: - - Type=Link - Value={Type=Child ID=7e0b9c6c-aabc-4985-949e-2680e577b48b} - - Type=Redirect - Value={CID=11111111111111111111111111111111 OID=7e0b9c6c-aabc-4985-949e-2680e577b48b} - - Type=UserHeader - Value={Key=test_key Val=test_value} - - Type=Transform - Value=Split - - Type=Tombstone - Value=MARKED - - Type=Token - Value={ID=7e0b9c6c-aabc-4985-949e-2680e577b48b OwnerID=NQHKh7fKGieCPrPuiEkY58ucRFwWMyU1Mc Verb=Search Address=11111111111111111111111111111111/7e0b9c6c-aabc-4985-949e-2680e577b48b Created=1 ValidUntil=2 SessionKey=010203040506 Signature=010203040506} - - Type=HomoHash - Value=1111111111111111111111111111111111111111111111111111111111111111 - - Type=PayloadChecksum - Value=[1 2 3 4 5 6] - - Type=Integrity - Value={Checksum=010203040506 Signature=010203040506} - - Type=StorageGroup - Value={DataSize=5 Hash=31313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131 Lifetime={Unit=UnixTime Value=555}} - - Type=PublicKey - Value=[1 2 3 4 5 6] - Payload: []byte{0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7} -` - - key := test.DecodeKey(0) - - uid, err := refs.NewOwnerID(&key.PublicKey) - require.NoError(t, err) - - var oid refs.UUID - - require.NoError(t, oid.Parse("7e0b9c6c-aabc-4985-949e-2680e577b48b")) - - obj := &Object{ - SystemHeader: SystemHeader{ - Version: 1, - PayloadLength: 1, - ID: oid, - OwnerID: uid, - CID: CID{}, - CreatedAt: CreationPoint{ - UnixTime: 1, - Epoch: 1, - }, - }, - Payload: []byte{1, 2, 3, 4, 5, 6, 7}, - } - - // *Header_Link - obj.Headers = append(obj.Headers, Header{ - Value: &Header_Link{ - Link: &Link{ID: oid, Type: Link_Child}, - }, - }) - - // *Header_Redirect - obj.Headers = append(obj.Headers, Header{ - Value: &Header_Redirect{ - Redirect: &Address{ObjectID: oid, CID: CID{}}, - }, - }) - - // *Header_UserHeader - obj.Headers = append(obj.Headers, Header{ - Value: &Header_UserHeader{ - UserHeader: &UserHeader{ - Key: "test_key", - Value: "test_value", - }, - }, - }) - - // *Header_Transform - obj.Headers = append(obj.Headers, Header{ - Value: &Header_Transform{ - Transform: &Transform{ - Type: Transform_Split, - }, - }, - }) - - // *Header_Tombstone - obj.Headers = append(obj.Headers, Header{ - Value: &Header_Tombstone{ - Tombstone: &Tombstone{}, - }, - }) - - token := new(Token) - token.SetID(oid) - token.SetOwnerID(uid) - token.SetVerb(service.Token_Info_Search) - token.SetAddress(Address{ObjectID: oid, CID: refs.CID{}}) - token.SetCreationEpoch(1) - token.SetExpirationEpoch(2) - token.SetSessionKey([]byte{1, 2, 3, 4, 5, 6}) - token.SetSignature([]byte{1, 2, 3, 4, 5, 6}) - - // *Header_Token - obj.Headers = append(obj.Headers, Header{ - Value: &Header_Token{ - Token: token, - }, - }) - - // *Header_HomoHash - obj.Headers = append(obj.Headers, Header{ - Value: &Header_HomoHash{ - HomoHash: Hash{}, - }, - }) - - // *Header_PayloadChecksum - obj.Headers = append(obj.Headers, Header{ - Value: &Header_PayloadChecksum{ - PayloadChecksum: []byte{1, 2, 3, 4, 5, 6}, - }, - }) - - // *Header_Integrity - obj.Headers = append(obj.Headers, Header{ - Value: &Header_Integrity{ - Integrity: &IntegrityHeader{ - HeadersChecksum: []byte{1, 2, 3, 4, 5, 6}, - ChecksumSignature: []byte{1, 2, 3, 4, 5, 6}, - }, - }, - }) - - // *Header_StorageGroup - obj.Headers = append(obj.Headers, Header{ - Value: &Header_StorageGroup{ - StorageGroup: &storagegroup.StorageGroup{ - ValidationDataSize: 5, - ValidationHash: storagegroup.Hash{}, - Lifetime: &storagegroup.StorageGroup_Lifetime{ - Unit: storagegroup.StorageGroup_Lifetime_UnixTime, - Value: 555, - }, - }, - }, - }) - - // *Header_PublicKey - obj.Headers = append(obj.Headers, Header{ - Value: &Header_PublicKey{ - PublicKey: &PublicKey{Value: []byte{1, 2, 3, 4, 5, 6}}, - }, - }) - - buf := new(bytes.Buffer) - - require.NoError(t, Stringify(buf, obj)) - require.Equal(t, res, buf.String()) -} - -func TestObject_Copy(t *testing.T) { - t.Run("token header", func(t *testing.T) { - token := new(Token) - token.SetID(service.TokenID{1, 2, 3}) - - obj := new(Object) - - obj.AddHeader(&Header{ - Value: &Header_Token{ - Token: token, - }, - }) - - { // Copying - cp := obj.Copy() - - _, h := cp.LastHeader(HeaderType(TokenHdr)) - require.NotNil(t, h) - require.Equal(t, token, h.GetValue().(*Header_Token).Token) - } - - { // Cloning - cl := proto.Clone(obj).(*Object) - require.Equal(t, obj, cl) - - _, h := cl.LastHeader(HeaderType(TokenHdr)) - h.GetToken().SetID(service.TokenID{3, 2, 1}) - - require.NotEqual(t, token, h.GetToken()) - } - }) -} - -func TestIntegrityHeaderGettersSetters(t *testing.T) { - t.Run("headers checksum", func(t *testing.T) { - data := []byte{1, 2, 3} - - v := new(IntegrityHeader) - - v.SetHeadersChecksum(data) - require.Equal(t, data, v.GetHeadersChecksum()) - }) - - t.Run("headers checksum", func(t *testing.T) { - data := []byte{1, 2, 3} - - v := new(IntegrityHeader) - - v.SetSignature(data) - require.Equal(t, data, v.GetSignature()) - }) -} diff --git a/object/utils.go b/object/utils.go deleted file mode 100644 index 33423aa..0000000 --- a/object/utils.go +++ /dev/null @@ -1,100 +0,0 @@ -package object - -import ( - "io" - "strconv" - - "github.com/pkg/errors" -) - -// FilenameHeader is a user header key for names of files, stored by third -// party apps. We recommend to use this header to be compatible with neofs -// http gate, neofs minio gate and neofs-dropper application. -const FilenameHeader = "filename" - -// ByteSize used to format bytes -type ByteSize uint64 - -// String represents ByteSize in string format -func (b ByteSize) String() string { - var ( - dec int64 - unit string - num = int64(b) - ) - - switch { - case num > UnitsTB: - unit = "TB" - dec = UnitsTB - case num > UnitsGB: - unit = "GB" - dec = UnitsGB - case num > UnitsMB: - unit = "MB" - dec = UnitsMB - case num > UnitsKB: - unit = "KB" - dec = UnitsKB - default: - dec = 1 - } - - return strconv.FormatFloat(float64(num)/float64(dec), 'g', 6, 64) + unit -} - -// MakePutRequestHeader combines object and session token value -// into header of object put request. -func MakePutRequestHeader(obj *Object) *PutRequest { - return &PutRequest{ - R: &PutRequest_Header{Header: &PutRequest_PutHeader{ - Object: obj, - }}, - } -} - -// MakePutRequestChunk splits data into chunks that will be transferred -// in the protobuf stream. -func MakePutRequestChunk(chunk []byte) *PutRequest { - return &PutRequest{R: &PutRequest_Chunk{Chunk: chunk}} -} - -func errMaxSizeExceeded(size uint64) error { - return errors.Errorf("object payload size exceed: %s", ByteSize(size).String()) -} - -// ReceiveGetResponse receives object by chunks from the protobuf stream -// and combine it into single get response structure. -func ReceiveGetResponse(c Service_GetClient, maxSize uint64) (*GetResponse, error) { - res, err := c.Recv() - if err == io.EOF { - return res, err - } else if err != nil { - return nil, err - } - - obj := res.GetObject() - if obj == nil { - return nil, ErrHeaderExpected - } - - if obj.SystemHeader.PayloadLength > maxSize { - return nil, errMaxSizeExceeded(maxSize) - } - - if res.NotFull() { - payload := make([]byte, obj.SystemHeader.PayloadLength) - offset := copy(payload, obj.Payload) - - var r *GetResponse - for r, err = c.Recv(); err == nil; r, err = c.Recv() { - offset += copy(payload[offset:], r.GetChunk()) - } - if err != io.EOF { - return nil, err - } - obj.Payload = payload - } - - return res, nil -} diff --git a/object/utils_test.go b/object/utils_test.go deleted file mode 100644 index d4d7fe2..0000000 --- a/object/utils_test.go +++ /dev/null @@ -1,53 +0,0 @@ -package object - -import ( - "testing" - - "github.com/stretchr/testify/require" -) - -func TestByteSize_String(t *testing.T) { - cases := []struct { - name string - expect string - actual ByteSize - }{ - { - name: "0 bytes", - expect: "0", - actual: ByteSize(0), - }, - { - name: "101 bytes", - expect: "101", - actual: ByteSize(101), - }, - { - name: "112.84KB", - expect: "112.84KB", - actual: ByteSize(115548), - }, - { - name: "80.44MB", - expect: "80.44MB", - actual: ByteSize(84347453), - }, - { - name: "905.144GB", - expect: "905.144GB", - actual: ByteSize(971891061884), - }, - { - name: "1.857TB", - expect: "1.857TB", - actual: ByteSize(2041793092780), - }, - } - - for i := range cases { - tt := cases[i] - t.Run(tt.name, func(t *testing.T) { - require.Equal(t, tt.expect, tt.actual.String()) - }) - } -} diff --git a/object/verification.go b/object/verification.go deleted file mode 100644 index 0bcbc7c..0000000 --- a/object/verification.go +++ /dev/null @@ -1,149 +0,0 @@ -package object - -import ( - "bytes" - "crypto/ecdsa" - "crypto/sha256" - - crypto "github.com/nspcc-dev/neofs-crypto" - "github.com/pkg/errors" -) - -func (m Object) headersData(check bool) ([]byte, error) { - var bytebuf = new(bytes.Buffer) - - // fixme: we must marshal fields one by one without protobuf marshaling - // protobuf marshaling does not guarantee the same result - - if sysheader, err := m.SystemHeader.Marshal(); err != nil { - return nil, err - } else if _, err := bytebuf.Write(sysheader); err != nil { - return nil, err - } - - n, _ := m.LastHeader(HeaderType(IntegrityHdr)) - for i := range m.Headers { - if check && i == n { - // ignore last integrity header in order to check headers data - continue - } - - if header, err := m.Headers[i].Marshal(); err != nil { - return nil, err - } else if _, err := bytebuf.Write(header); err != nil { - return nil, err - } - } - return bytebuf.Bytes(), nil -} - -func (m Object) headersChecksum(check bool) ([]byte, error) { - data, err := m.headersData(check) - if err != nil { - return nil, err - } - checksum := sha256.Sum256(data) - return checksum[:], nil -} - -// PayloadChecksum calculates sha256 checksum of object payload. -func (m Object) PayloadChecksum() []byte { - checksum := sha256.Sum256(m.Payload) - return checksum[:] -} - -func (m Object) verifySignature(key []byte, ih *IntegrityHeader) error { - pk := crypto.UnmarshalPublicKey(key) - if crypto.Verify(pk, ih.HeadersChecksum, ih.ChecksumSignature) == nil { - return nil - } - return ErrVerifySignature -} - -// Verify performs local integrity check by finding verification header and -// integrity header. If header integrity is passed, function verifies -// checksum of the object payload. -// todo: move this verification logic into separate library -func (m Object) Verify() error { - var ( - err error - checksum []byte - pubkey []byte - ) - ind, ih := m.LastHeader(HeaderType(IntegrityHdr)) - if ih == nil || ind != len(m.Headers)-1 { - return ErrHeaderNotFound - } - integrity := ih.Value.(*Header_Integrity).Integrity - - // Prepare structures - _, vh := m.LastHeader(HeaderType(TokenHdr)) - if vh == nil { - _, pkh := m.LastHeader(HeaderType(PublicKeyHdr)) - if pkh == nil { - return ErrHeaderNotFound - } - pubkey = pkh.Value.(*Header_PublicKey).PublicKey.Value - } else { - pubkey = vh.Value.(*Header_Token).Token.GetSessionKey() - } - - // Verify signature - err = m.verifySignature(pubkey, integrity) - if err != nil { - return errors.Wrapf(err, "public key: %x", pubkey) - } - - // Verify checksum of header - checksum, err = m.headersChecksum(true) - if err != nil { - return err - } - if !bytes.Equal(integrity.HeadersChecksum, checksum) { - return ErrVerifyHeader - } - - // Verify checksum of payload - if m.SystemHeader.PayloadLength > 0 && !m.IsLinking() { - checksum = m.PayloadChecksum() - - _, ph := m.LastHeader(HeaderType(PayloadChecksumHdr)) - if ph == nil { - return ErrHeaderNotFound - } - if !bytes.Equal(ph.Value.(*Header_PayloadChecksum).PayloadChecksum, checksum) { - return ErrVerifyPayload - } - } - return nil -} - -// CreateIntegrityHeader returns signed integrity header for the object -func CreateIntegrityHeader(obj *Object, key *ecdsa.PrivateKey) (*Header, error) { - headerChecksum, err := obj.headersChecksum(false) - if err != nil { - return nil, err - } - headerChecksumSignature, err := crypto.Sign(key, headerChecksum) - if err != nil { - return nil, err - } - - return &Header{Value: &Header_Integrity{ - Integrity: &IntegrityHeader{ - HeadersChecksum: headerChecksum, - ChecksumSignature: headerChecksumSignature, - }, - }}, nil -} - -// Sign creates new integrity header and adds it to the end of the list of -// extended headers. -func (m *Object) Sign(key *ecdsa.PrivateKey) error { - ih, err := CreateIntegrityHeader(m, key) - if err != nil { - return err - } - m.AddHeader(ih) - return nil -} diff --git a/object/verification_test.go b/object/verification_test.go deleted file mode 100644 index 95a6d32..0000000 --- a/object/verification_test.go +++ /dev/null @@ -1,144 +0,0 @@ -package object - -import ( - "testing" - - "github.com/google/uuid" - "github.com/nspcc-dev/neofs-api-go/container" - "github.com/nspcc-dev/neofs-api-go/refs" - crypto "github.com/nspcc-dev/neofs-crypto" - "github.com/nspcc-dev/neofs-crypto/test" - "github.com/stretchr/testify/require" -) - -func TestObject_Verify(t *testing.T) { - key := test.DecodeKey(0) - sessionkey := test.DecodeKey(1) - - payload := make([]byte, 1024*1024) - - cnr, err := container.NewTestContainer() - require.NoError(t, err) - - cid, err := cnr.ID() - require.NoError(t, err) - - id, err := uuid.NewRandom() - uid := refs.UUID(id) - require.NoError(t, err) - - obj := &Object{ - SystemHeader: SystemHeader{ - ID: uid, - CID: cid, - OwnerID: refs.OwnerID([refs.OwnerIDSize]byte{}), - }, - Headers: []Header{ - { - Value: &Header_UserHeader{ - UserHeader: &UserHeader{ - Key: "Profession", - Value: "Developer", - }, - }, - }, - { - Value: &Header_UserHeader{ - UserHeader: &UserHeader{ - Key: "Language", - Value: "GO", - }, - }, - }, - }, - } - obj.SetPayload(payload) - obj.SetHeader(&Header{Value: &Header_PayloadChecksum{[]byte("incorrect checksum")}}) - - t.Run("error no integrity header and pubkey", func(t *testing.T) { - err = obj.Verify() - require.EqualError(t, err, ErrHeaderNotFound.Error()) - }) - - badHeaderChecksum := []byte("incorrect checksum") - signature, err := crypto.Sign(sessionkey, badHeaderChecksum) - require.NoError(t, err) - ih := &IntegrityHeader{ - HeadersChecksum: badHeaderChecksum, - ChecksumSignature: signature, - } - obj.SetHeader(&Header{Value: &Header_Integrity{ih}}) - - t.Run("error no validation header", func(t *testing.T) { - err = obj.Verify() - require.EqualError(t, err, ErrHeaderNotFound.Error()) - }) - - dataPK := crypto.MarshalPublicKey(&sessionkey.PublicKey) - signature, err = crypto.Sign(key, dataPK) - tok := new(Token) - tok.SetSignature(signature) - tok.SetSessionKey(dataPK) - obj.AddHeader(&Header{Value: &Header_Token{Token: tok}}) - - // validation header is not last - t.Run("error validation header is not last", func(t *testing.T) { - err = obj.Verify() - require.EqualError(t, err, ErrHeaderNotFound.Error()) - }) - - obj.Headers = obj.Headers[:len(obj.Headers)-2] - obj.AddHeader(&Header{Value: &Header_Token{Token: tok}}) - obj.SetHeader(&Header{Value: &Header_Integrity{ih}}) - - t.Run("error invalid header checksum", func(t *testing.T) { - err = obj.Verify() - require.EqualError(t, err, ErrVerifyHeader.Error()) - }) - - obj.Headers = obj.Headers[:len(obj.Headers)-1] - genIH, err := CreateIntegrityHeader(obj, sessionkey) - require.NoError(t, err) - obj.SetHeader(genIH) - - t.Run("error invalid payload checksum", func(t *testing.T) { - err = obj.Verify() - require.EqualError(t, err, ErrVerifyPayload.Error()) - }) - - obj.SetHeader(&Header{Value: &Header_PayloadChecksum{obj.PayloadChecksum()}}) - - obj.Headers = obj.Headers[:len(obj.Headers)-1] - genIH, err = CreateIntegrityHeader(obj, sessionkey) - require.NoError(t, err) - obj.SetHeader(genIH) - - t.Run("correct with tok", func(t *testing.T) { - err = obj.Verify() - require.NoError(t, err) - }) - - pkh := Header{Value: &Header_PublicKey{&PublicKey{ - Value: crypto.MarshalPublicKey(&key.PublicKey), - }}} - // replace tok with pkh - obj.Headers[len(obj.Headers)-2] = pkh - // re-sign object - obj.Sign(sessionkey) - - t.Run("incorrect with bad public key", func(t *testing.T) { - err = obj.Verify() - require.Error(t, err) - }) - - obj.SetHeader(&Header{Value: &Header_PublicKey{&PublicKey{ - Value: dataPK, - }}}) - obj.Sign(sessionkey) - - t.Run("correct with good public key", func(t *testing.T) { - err = obj.Verify() - require.NoError(t, err) - }) - -} diff --git a/query/types.go b/query/types.go deleted file mode 100644 index 15a54f6..0000000 --- a/query/types.go +++ /dev/null @@ -1,43 +0,0 @@ -package query - -import ( - "strings" - - "github.com/gogo/protobuf/proto" -) - -var ( - _ proto.Message = (*Query)(nil) - _ proto.Message = (*Filter)(nil) -) - -// String returns string representation of Filter. -func (m Filter) String() string { - b := new(strings.Builder) - b.WriteString("") - return b.String() -} - -// String returns string representation of Query. -func (m Query) String() string { - b := new(strings.Builder) - b.WriteString(" 0 { - i -= len(m.Value) - copy(dAtA[i:], m.Value) - i = encodeVarintTypes(dAtA, i, uint64(len(m.Value))) - i-- - dAtA[i] = 0x1a - } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintTypes(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0x12 - } - if m.Type != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.Type)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *Query) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Query) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Query) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.Filters) > 0 { - for iNdEx := len(m.Filters) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Filters[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func encodeVarintTypes(dAtA []byte, offset int, v uint64) int { - offset -= sovTypes(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *Filter) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Type != 0 { - n += 1 + sovTypes(uint64(m.Type)) - } - l = len(m.Name) - if l > 0 { - n += 1 + l + sovTypes(uint64(l)) - } - l = len(m.Value) - if l > 0 { - n += 1 + l + sovTypes(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *Query) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Filters) > 0 { - for _, e := range m.Filters { - l = e.Size() - n += 1 + l + sovTypes(uint64(l)) - } - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func sovTypes(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozTypes(x uint64) (n int) { - return sovTypes(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *Filter) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Filter: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Filter: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) - } - m.Type = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Type |= Filter_Type(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Value = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Query) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Query: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Query: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Filters", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Filters = append(m.Filters, Filter{}) - if err := m.Filters[len(m.Filters)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipTypes(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTypes - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTypes - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTypes - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthTypes - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupTypes - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthTypes - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthTypes = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowTypes = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupTypes = fmt.Errorf("proto: unexpected end of group") -) diff --git a/query/types.proto b/query/types.proto deleted file mode 100644 index ebc0d64..0000000 --- a/query/types.proto +++ /dev/null @@ -1,33 +0,0 @@ -syntax = "proto3"; -package query; -option go_package = "github.com/nspcc-dev/neofs-api-go/query"; -option csharp_namespace = "NeoFS.API.Query"; - -import "github.com/gogo/protobuf/gogoproto/gogo.proto"; - -option (gogoproto.stable_marshaler_all) = true; - -message Filter { - option (gogoproto.goproto_stringer) = false; - - enum Type { - // Exact sets when value of filter should be equal to the header value - Exact = 0; - // Regex sets when value of filter should match the header value by the regular expression - Regex = 1; - } - - // Type of filter - Type type = 1 [(gogoproto.customname) = "Type"]; - // Name of field that should be filtered - string Name = 2; - // Value that should be used for filter - string Value = 3; -} - -message Query { - option (gogoproto.goproto_stringer) = false; - - // Filters is set of filters, should not be empty - repeated Filter Filters = 1 [(gogoproto.nullable) = false]; -} diff --git a/refs/address.go b/refs/address.go deleted file mode 100644 index ad5f420..0000000 --- a/refs/address.go +++ /dev/null @@ -1,80 +0,0 @@ -package refs - -import ( - "crypto/sha256" - "strings" - - "github.com/gogo/protobuf/proto" - "github.com/nspcc-dev/neofs-api-go/internal" -) - -const ( - joinSeparator = "/" - - // ErrWrongAddress is raised when wrong address is passed to Address.Parse ParseAddress. - ErrWrongAddress = internal.Error("wrong address") - - // ErrEmptyAddress is raised when empty address is passed to Address.Parse ParseAddress. - ErrEmptyAddress = internal.Error("empty address") -) - -// ParseAddress parses address from string representation into new Address. -func ParseAddress(str string) (*Address, error) { - var addr Address - return &addr, addr.Parse(str) -} - -// Parse parses address from string representation into current Address. -func (m *Address) Parse(addr string) error { - if m == nil { - return ErrEmptyAddress - } - - items := strings.Split(addr, joinSeparator) - if len(items) != 2 { - return ErrWrongAddress - } - - if err := m.CID.Parse(items[0]); err != nil { - return err - } else if err := m.ObjectID.Parse(items[1]); err != nil { - return err - } - - return nil -} - -// String returns string representation of Address. -func (m Address) String() string { - return strings.Join([]string{m.CID.String(), m.ObjectID.String()}, joinSeparator) -} - -// IsFull checks that ContainerID and ObjectID is not empty. -func (m Address) IsFull() bool { - return !m.CID.Empty() && !m.ObjectID.Empty() -} - -// Equal checks that current Address is equal to passed Address. -func (m Address) Equal(a2 *Address) bool { - return m.CID.Equal(a2.CID) && m.ObjectID.Equal(a2.ObjectID) -} - -// Hash returns []byte that used as a key for storage bucket. -func (m Address) Hash() ([]byte, error) { - if !m.IsFull() { - return nil, ErrEmptyAddress - } - h := sha256.Sum256(append(m.ObjectID.Bytes(), m.CID.Bytes()...)) - return h[:], nil -} - -// Merge used by proto.Clone -func (m *Address) Merge(src proto.Message) { - if addr, ok := src.(*Address); ok { - cid := proto.Clone(&addr.CID).(*CID) - oid := proto.Clone(&addr.ObjectID).(*ObjectID) - - m.CID = *cid - m.ObjectID = *oid - } -} diff --git a/refs/cid.go b/refs/cid.go deleted file mode 100644 index 83450a9..0000000 --- a/refs/cid.go +++ /dev/null @@ -1,104 +0,0 @@ -package refs - -import ( - "bytes" - "crypto/sha256" - - "github.com/gogo/protobuf/proto" - "github.com/mr-tron/base58" - "github.com/pkg/errors" -) - -// CIDForBytes creates CID for passed bytes. -func CIDForBytes(data []byte) CID { return sha256.Sum256(data) } - -// CIDFromBytes parses CID from passed bytes. -func CIDFromBytes(data []byte) (cid CID, err error) { - if ln := len(data); ln != CIDSize { - return CID{}, errors.Wrapf(ErrWrongDataSize, "expect=%d, actual=%d", CIDSize, ln) - } - - copy(cid[:], data) - return -} - -// CIDFromString parses CID from string representation of CID. -func CIDFromString(c string) (CID, error) { - var cid CID - decoded, err := base58.Decode(c) - if err != nil { - return cid, err - } - return CIDFromBytes(decoded) -} - -// Size returns size of CID (CIDSize). -func (c CID) Size() int { return CIDSize } - -// Parse tries to parse CID from string representation. -func (c *CID) Parse(cid string) error { - var err error - if *c, err = CIDFromString(cid); err != nil { - return err - } - return nil -} - -// Empty checks that current CID is empty. -func (c CID) Empty() bool { return bytes.Equal(c.Bytes(), emptyCID) } - -// Equal checks that current CID is equal to passed CID. -func (c CID) Equal(cid CID) bool { return bytes.Equal(c.Bytes(), cid.Bytes()) } - -// Marshal returns CID bytes representation. -func (c CID) Marshal() ([]byte, error) { return c.Bytes(), nil } - -// MarshalBinary returns CID bytes representation. -func (c CID) MarshalBinary() ([]byte, error) { return c.Bytes(), nil } - -// MarshalTo marshal CID to bytes representation into passed bytes. -func (c *CID) MarshalTo(data []byte) (int, error) { return copy(data, c.Bytes()), nil } - -// ProtoMessage method to satisfy proto.Message interface. -func (c CID) ProtoMessage() {} - -// String returns string representation of CID. -func (c CID) String() string { return base58.Encode(c[:]) } - -// Reset resets current CID to zero value. -func (c *CID) Reset() { *c = CID{} } - -// Bytes returns CID bytes representation. -func (c CID) Bytes() []byte { - buf := make([]byte, CIDSize) - copy(buf, c[:]) - return buf -} - -// UnmarshalBinary tries to parse bytes representation of CID. -func (c *CID) UnmarshalBinary(data []byte) error { return c.Unmarshal(data) } - -// Unmarshal tries to parse bytes representation of CID. -func (c *CID) Unmarshal(data []byte) error { - if ln := len(data); ln != CIDSize { - return errors.Wrapf(ErrWrongDataSize, "expect=%d, actual=%d", CIDSize, ln) - } - - copy((*c)[:], data) - return nil -} - -// Verify validates that current CID is generated for passed bytes data. -func (c CID) Verify(data []byte) error { - if id := CIDForBytes(data); !bytes.Equal(c[:], id[:]) { - return errors.New("wrong hash for data") - } - return nil -} - -// Merge used by proto.Clone -func (c *CID) Merge(src proto.Message) { - if cid, ok := src.(*CID); ok { - *c = *cid - } -} diff --git a/refs/owner.go b/refs/owner.go deleted file mode 100644 index 0e599e9..0000000 --- a/refs/owner.go +++ /dev/null @@ -1,77 +0,0 @@ -package refs - -import ( - "bytes" - "crypto/ecdsa" - - "github.com/gogo/protobuf/proto" - "github.com/mr-tron/base58" - "github.com/nspcc-dev/neofs-api-go/chain" - "github.com/pkg/errors" -) - -// NewOwnerID returns generated OwnerID from passed public key. -func NewOwnerID(key *ecdsa.PublicKey) (owner OwnerID, err error) { - if key == nil { - return - } - - var d []byte - - d, err = base58.Decode(chain.KeyToAddress(key)) - if err != nil { - return - } - - copy(owner[:], d) - - return -} - -// Size returns OwnerID size in bytes (OwnerIDSize). -func (OwnerID) Size() int { return OwnerIDSize } - -// Empty checks that current OwnerID is empty value. -func (o OwnerID) Empty() bool { return bytes.Equal(o.Bytes(), emptyOwner) } - -// Equal checks that current OwnerID is equal to passed OwnerID. -func (o OwnerID) Equal(id OwnerID) bool { return bytes.Equal(o.Bytes(), id.Bytes()) } - -// Reset sets current OwnerID to empty value. -func (o *OwnerID) Reset() { *o = OwnerID{} } - -// ProtoMessage method to satisfy proto.Message interface. -func (OwnerID) ProtoMessage() {} - -// Marshal returns OwnerID bytes representation. -func (o OwnerID) Marshal() ([]byte, error) { return o.Bytes(), nil } - -// MarshalTo copies OwnerID bytes representation into passed slice of bytes. -func (o OwnerID) MarshalTo(data []byte) (int, error) { return copy(data, o.Bytes()), nil } - -// String returns string representation of OwnerID. -func (o OwnerID) String() string { return base58.Encode(o[:]) } - -// Bytes returns OwnerID bytes representation. -func (o OwnerID) Bytes() []byte { - buf := make([]byte, OwnerIDSize) - copy(buf, o[:]) - return buf -} - -// Unmarshal tries to parse OwnerID bytes representation into current OwnerID. -func (o *OwnerID) Unmarshal(data []byte) error { - if ln := len(data); ln != OwnerIDSize { - return errors.Wrapf(ErrWrongDataSize, "expect=%d, actual=%d", OwnerIDSize, ln) - } - - copy((*o)[:], data) - return nil -} - -// Merge used by proto.Clone -func (o *OwnerID) Merge(src proto.Message) { - if uid, ok := src.(*OwnerID); ok { - *o = *uid - } -} diff --git a/refs/sgid.go b/refs/sgid.go deleted file mode 100644 index d6fcf2d..0000000 --- a/refs/sgid.go +++ /dev/null @@ -1,14 +0,0 @@ -package refs - -import ( - "github.com/pkg/errors" -) - -// SGIDFromBytes parse bytes representation of SGID into new SGID value. -func SGIDFromBytes(data []byte) (sgid SGID, err error) { - if ln := len(data); ln != SGIDSize { - return SGID{}, errors.Wrapf(ErrWrongDataSize, "expect=%d, actual=%d", SGIDSize, ln) - } - copy(sgid[:], data) - return -} diff --git a/refs/types.go b/refs/types.go deleted file mode 100644 index 417eec3..0000000 --- a/refs/types.go +++ /dev/null @@ -1,123 +0,0 @@ -// This package contains basic structures implemented in Go, such as -// -// CID - container id -// OwnerID - owner id -// ObjectID - object id -// SGID - storage group id -// Address - contains object id and container id -// UUID - a 128 bit (16 byte) Universal Unique Identifier as defined in RFC 4122 - -package refs - -import ( - "crypto/sha256" - - "github.com/google/uuid" - "github.com/nspcc-dev/neofs-api-go/chain" - "github.com/nspcc-dev/neofs-api-go/internal" -) - -type ( - // CID is implementation of ContainerID. - CID [CIDSize]byte - - // UUID wrapper over github.com/google/uuid.UUID. - UUID uuid.UUID - - // SGID is type alias of UUID. - SGID = UUID - - // ObjectID is type alias of UUID. - ObjectID = UUID - - // MessageID is type alias of UUID. - MessageID = UUID - - // OwnerID is wrapper over neofs-proto/chain.WalletAddress. - OwnerID chain.WalletAddress -) - -// OwnerIDSource is an interface of the container of an OwnerID value with read access. -type OwnerIDSource interface { - GetOwnerID() OwnerID -} - -// OwnerIDContainer is an interface of the container of an OwnerID value. -type OwnerIDContainer interface { - OwnerIDSource - SetOwnerID(OwnerID) -} - -// AddressContainer is an interface of the container of object address value. -type AddressContainer interface { - GetAddress() Address - SetAddress(Address) -} - -const ( - // UUIDSize contains size of UUID. - UUIDSize = 16 - - // SGIDSize contains size of SGID. - SGIDSize = UUIDSize - - // CIDSize contains size of CID. - CIDSize = sha256.Size - - // OwnerIDSize contains size of OwnerID. - OwnerIDSize = chain.AddressLength - - // ErrWrongDataSize is raised when passed bytes into Unmarshal have wrong size. - ErrWrongDataSize = internal.Error("wrong data size") - - // ErrEmptyOwner is raised when empty OwnerID is passed into container.New. - ErrEmptyOwner = internal.Error("owner cant be empty") - - // ErrEmptyCapacity is raised when empty Capacity is passed container.New. - ErrEmptyCapacity = internal.Error("capacity cant be empty") - - // ErrEmptyContainer is raised when it CID method is called for an empty container. - ErrEmptyContainer = internal.Error("cannot return ID for empty container") -) - -var ( - emptyCID = (CID{}).Bytes() - emptyUUID = (UUID{}).Bytes() - emptyOwner = (OwnerID{}).Bytes() - - _ internal.Custom = (*CID)(nil) - _ internal.Custom = (*SGID)(nil) - _ internal.Custom = (*UUID)(nil) - _ internal.Custom = (*OwnerID)(nil) - _ internal.Custom = (*ObjectID)(nil) - _ internal.Custom = (*MessageID)(nil) - - // NewSGID method alias. - NewSGID = NewUUID - - // NewObjectID method alias. - NewObjectID = NewUUID - - // NewMessageID method alias. - NewMessageID = NewUUID -) - -// NewUUID returns a Random (Version 4) UUID. -// -// The strength of the UUIDs is based on the strength of the crypto/rand -// package. -// -// A note about uniqueness derived from the UUID Wikipedia entry: -// -// Randomly generated UUIDs have 122 random bits. One's annual risk of being -// hit by a meteorite is estimated to be one chance in 17 billion, that -// means the probability is about 0.00000000006 (6 × 10−11), -// equivalent to the odds of creating a few tens of trillions of UUIDs in a -// year and having one duplicate. -func NewUUID() (UUID, error) { - id, err := uuid.NewRandom() - if err != nil { - return UUID{}, err - } - return UUID(id), nil -} diff --git a/refs/types.pb.go b/refs/types.pb.go deleted file mode 100644 index 1b483cd..0000000 --- a/refs/types.pb.go +++ /dev/null @@ -1,372 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: refs/types.proto - -package refs - -import ( - fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/golang/protobuf/proto" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package - -// Address of object (container id + object id) -type Address struct { - // ObjectID is an object identifier, valid UUIDv4 represented in bytes - ObjectID ObjectID `protobuf:"bytes,1,opt,name=ObjectID,proto3,customtype=ObjectID" json:"ObjectID"` - // CID is container identifier - CID CID `protobuf:"bytes,2,opt,name=CID,proto3,customtype=CID" json:"CID"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Address) Reset() { *m = Address{} } -func (*Address) ProtoMessage() {} -func (*Address) Descriptor() ([]byte, []int) { - return fileDescriptor_063a64a96d952d31, []int{0} -} -func (m *Address) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Address) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *Address) XXX_Merge(src proto.Message) { - xxx_messageInfo_Address.Merge(m, src) -} -func (m *Address) XXX_Size() int { - return m.Size() -} -func (m *Address) XXX_DiscardUnknown() { - xxx_messageInfo_Address.DiscardUnknown(m) -} - -var xxx_messageInfo_Address proto.InternalMessageInfo - -func init() { - proto.RegisterType((*Address)(nil), "refs.Address") -} - -func init() { proto.RegisterFile("refs/types.proto", fileDescriptor_063a64a96d952d31) } - -var fileDescriptor_063a64a96d952d31 = []byte{ - // 221 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x28, 0x4a, 0x4d, 0x2b, - 0xd6, 0x2f, 0xa9, 0x2c, 0x48, 0x2d, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x01, 0x89, - 0x48, 0xe9, 0xa6, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0xa7, 0xe7, 0xa7, - 0xe7, 0xeb, 0x83, 0x25, 0x93, 0x4a, 0xd3, 0xc0, 0x3c, 0x30, 0x07, 0xcc, 0x82, 0x68, 0x52, 0x0a, - 0xe3, 0x62, 0x77, 0x4c, 0x49, 0x29, 0x4a, 0x2d, 0x2e, 0x16, 0xd2, 0xe1, 0xe2, 0xf0, 0x4f, 0xca, - 0x4a, 0x4d, 0x2e, 0xf1, 0x74, 0x91, 0x60, 0x54, 0x60, 0xd4, 0xe0, 0x71, 0x12, 0x38, 0x71, 0x4f, - 0x9e, 0xe1, 0xd6, 0x3d, 0x79, 0xb8, 0x78, 0x10, 0x9c, 0x25, 0x24, 0xcb, 0xc5, 0xec, 0xec, 0xe9, - 0x22, 0xc1, 0x04, 0x56, 0xc8, 0x0d, 0x55, 0x08, 0x12, 0x0a, 0x02, 0x11, 0x4e, 0xa1, 0x37, 0x1e, - 0xca, 0x31, 0x34, 0x3c, 0x92, 0x63, 0x38, 0xf1, 0x48, 0x8e, 0xf1, 0xc2, 0x23, 0x39, 0xc6, 0x1b, - 0x8f, 0xe4, 0x18, 0x1f, 0x3c, 0x92, 0x63, 0x9c, 0xf1, 0x58, 0x8e, 0x21, 0x4a, 0x0d, 0xc9, 0x91, - 0x79, 0xc5, 0x05, 0xc9, 0xc9, 0xba, 0x29, 0xa9, 0x65, 0xfa, 0x79, 0xa9, 0xf9, 0x69, 0xc5, 0xba, - 0x89, 0x05, 0x99, 0xba, 0xe9, 0xf9, 0xfa, 0x20, 0xcf, 0xac, 0x62, 0xe2, 0xf3, 0x4b, 0xcd, 0x77, - 0x0b, 0xd6, 0x73, 0x0c, 0xf0, 0xd4, 0x0b, 0x4a, 0x4d, 0x2b, 0x4e, 0x62, 0x03, 0xbb, 0xda, 0x18, - 0x10, 0x00, 0x00, 0xff, 0xff, 0xae, 0x9a, 0x6d, 0x68, 0xfe, 0x00, 0x00, 0x00, -} - -func (m *Address) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Address) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Address) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - { - size := m.CID.Size() - i -= size - if _, err := m.CID.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size := m.ObjectID.Size() - i -= size - if _, err := m.ObjectID.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func encodeVarintTypes(dAtA []byte, offset int, v uint64) int { - offset -= sovTypes(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *Address) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ObjectID.Size() - n += 1 + l + sovTypes(uint64(l)) - l = m.CID.Size() - n += 1 + l + sovTypes(uint64(l)) - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func sovTypes(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozTypes(x uint64) (n int) { - return sovTypes(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *Address) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Address: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Address: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ObjectID", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ObjectID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CID", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.CID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipTypes(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTypes - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTypes - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTypes - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthTypes - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupTypes - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthTypes - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthTypes = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowTypes = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupTypes = fmt.Errorf("proto: unexpected end of group") -) diff --git a/refs/types.proto b/refs/types.proto deleted file mode 100644 index 6b001c0..0000000 --- a/refs/types.proto +++ /dev/null @@ -1,19 +0,0 @@ -syntax = "proto3"; -package refs; -option go_package = "github.com/nspcc-dev/neofs-api-go/refs"; -option csharp_namespace = "NeoFS.API.Refs"; - -import "github.com/gogo/protobuf/gogoproto/gogo.proto"; - -option (gogoproto.stable_marshaler_all) = true; - -option (gogoproto.stringer_all) = false; -option (gogoproto.goproto_stringer_all) = false; - -// Address of object (container id + object id) -message Address { - // ObjectID is an object identifier, valid UUIDv4 represented in bytes - bytes ObjectID = 1[(gogoproto.customtype) = "ObjectID", (gogoproto.nullable) = false]; - // CID is container identifier - bytes CID = 2[(gogoproto.customtype) = "CID", (gogoproto.nullable) = false]; -} diff --git a/refs/types_test.go b/refs/types_test.go deleted file mode 100644 index 948a48b..0000000 --- a/refs/types_test.go +++ /dev/null @@ -1,141 +0,0 @@ -package refs - -import ( - "strings" - "testing" - - "github.com/gogo/protobuf/proto" - "github.com/google/uuid" - "github.com/nspcc-dev/neofs-crypto/test" - "github.com/stretchr/testify/require" -) - -func TestSGID(t *testing.T) { - t.Run("check that marshal/unmarshal works like expected", func(t *testing.T) { - var sgid1, sgid2 UUID - - sgid1, err := NewSGID() - require.NoError(t, err) - - data, err := proto.Marshal(&sgid1) - require.NoError(t, err) - - require.NoError(t, sgid2.Unmarshal(data)) - require.Equal(t, sgid1, sgid2) - }) - - t.Run("check that proto.Clone works like expected", func(t *testing.T) { - var ( - sgid1 UUID - sgid2 *UUID - ) - - sgid1, err := NewSGID() - require.NoError(t, err) - - sgid2 = proto.Clone(&sgid1).(*SGID) - require.Equal(t, sgid1, *sgid2) - }) -} - -func TestUUID(t *testing.T) { - t.Run("parse should work like expected", func(t *testing.T) { - var u UUID - - id, err := uuid.NewRandom() - require.NoError(t, err) - - require.NoError(t, u.Parse(id.String())) - require.Equal(t, id.String(), u.String()) - }) - - t.Run("check that marshal/unmarshal works like expected", func(t *testing.T) { - var u1, u2 UUID - - u1 = UUID{0x8f, 0xe4, 0xeb, 0xa0, 0xb8, 0xfb, 0x49, 0x3b, 0xbb, 0x1d, 0x1d, 0x13, 0x6e, 0x69, 0xfc, 0xf7} - - data, err := proto.Marshal(&u1) - require.NoError(t, err) - - require.NoError(t, u2.Unmarshal(data)) - require.Equal(t, u1, u2) - }) - - t.Run("check that marshal/unmarshal works like expected even for msg id", func(t *testing.T) { - var u2 MessageID - - u1, err := NewMessageID() - require.NoError(t, err) - - data, err := proto.Marshal(&u1) - require.NoError(t, err) - - require.NoError(t, u2.Unmarshal(data)) - require.Equal(t, u1, u2) - }) -} - -func TestOwnerID(t *testing.T) { - t.Run("check that marshal/unmarshal works like expected", func(t *testing.T) { - var u1, u2 OwnerID - - owner, err := NewOwnerID(nil) - require.NoError(t, err) - require.True(t, owner.Empty()) - - key := test.DecodeKey(0) - - u1, err = NewOwnerID(&key.PublicKey) - require.NoError(t, err) - data, err := proto.Marshal(&u1) - require.NoError(t, err) - - require.NoError(t, u2.Unmarshal(data)) - require.Equal(t, u1, u2) - }) - - t.Run("check that proto.Clone works like expected", func(t *testing.T) { - var u2 *OwnerID - - key := test.DecodeKey(0) - - u1, err := NewOwnerID(&key.PublicKey) - require.NoError(t, err) - - u2 = proto.Clone(&u1).(*OwnerID) - require.Equal(t, u1, *u2) - }) -} - -func TestAddress(t *testing.T) { - cid := CIDForBytes([]byte("test")) - - id, err := NewObjectID() - require.NoError(t, err) - - expect := strings.Join([]string{ - cid.String(), - id.String(), - }, joinSeparator) - - require.NotPanics(t, func() { - actual := (Address{ - ObjectID: id, - CID: cid, - }).String() - - require.Equal(t, expect, actual) - }) - - var temp Address - require.NoError(t, temp.Parse(expect)) - require.Equal(t, expect, temp.String()) - - actual, err := ParseAddress(expect) - require.NoError(t, err) - require.Equal(t, expect, actual.String()) - - addr := proto.Clone(actual).(*Address) - require.Equal(t, actual, addr) - require.Equal(t, expect, addr.String()) -} diff --git a/refs/uuid.go b/refs/uuid.go deleted file mode 100644 index 5a49b92..0000000 --- a/refs/uuid.go +++ /dev/null @@ -1,84 +0,0 @@ -package refs - -import ( - "bytes" - "encoding/hex" - - "github.com/gogo/protobuf/proto" - "github.com/google/uuid" - "github.com/pkg/errors" -) - -func encodeHex(dst []byte, uuid UUID) { - hex.Encode(dst, uuid[:4]) - dst[8] = '-' - hex.Encode(dst[9:13], uuid[4:6]) - dst[13] = '-' - hex.Encode(dst[14:18], uuid[6:8]) - dst[18] = '-' - hex.Encode(dst[19:23], uuid[8:10]) - dst[23] = '-' - hex.Encode(dst[24:], uuid[10:]) -} - -// Size returns size in bytes of UUID (UUIDSize). -func (UUID) Size() int { return UUIDSize } - -// Empty checks that current UUID is empty value. -func (u UUID) Empty() bool { return bytes.Equal(u.Bytes(), emptyUUID) } - -// Reset sets current UUID to empty value. -func (u *UUID) Reset() { *u = [UUIDSize]byte{} } - -// ProtoMessage method to satisfy proto.Message. -func (UUID) ProtoMessage() {} - -// Marshal returns UUID bytes representation. -func (u UUID) Marshal() ([]byte, error) { return u.Bytes(), nil } - -// MarshalTo returns UUID bytes representation. -func (u UUID) MarshalTo(data []byte) (int, error) { return copy(data, u[:]), nil } - -// Bytes returns UUID bytes representation. -func (u UUID) Bytes() []byte { - buf := make([]byte, UUIDSize) - copy(buf, u[:]) - return buf -} - -// Equal checks that current UUID is equal to passed UUID. -func (u UUID) Equal(u2 UUID) bool { return bytes.Equal(u.Bytes(), u2.Bytes()) } - -func (u UUID) String() string { - var buf [36]byte - encodeHex(buf[:], u) - return string(buf[:]) -} - -// Unmarshal tries to parse UUID bytes representation. -func (u *UUID) Unmarshal(data []byte) error { - if ln := len(data); ln != UUIDSize { - return errors.Wrapf(ErrWrongDataSize, "expect=%d, actual=%d", UUIDSize, ln) - } - - copy((*u)[:], data) - return nil -} - -// Parse tries to parse UUID string representation. -func (u *UUID) Parse(id string) error { - tmp, err := uuid.Parse(id) - if err != nil { - return errors.Wrapf(err, "could not parse `%s`", id) - } - - copy((*u)[:], tmp[:]) - return nil -} - -// Merge used by proto.Clone -func (u *UUID) Merge(src proto.Message) { - if tmp, ok := src.(*UUID); ok { - *u = *tmp - } -} diff --git a/service/alias.go b/service/alias.go deleted file mode 100644 index 9a40702..0000000 --- a/service/alias.go +++ /dev/null @@ -1,20 +0,0 @@ -package service - -import ( - "github.com/nspcc-dev/neofs-api-go/refs" -) - -// TokenID is a type alias of UUID ref. -type TokenID = refs.UUID - -// OwnerID is a type alias of OwnerID ref. -type OwnerID = refs.OwnerID - -// Address is a type alias of Address ref. -type Address = refs.Address - -// AddressContainer is a type alias of refs.AddressContainer. -type AddressContainer = refs.AddressContainer - -// OwnerIDContainer is a type alias of refs.OwnerIDContainer. -type OwnerIDContainer = refs.OwnerIDContainer diff --git a/service/bearer.go b/service/bearer.go deleted file mode 100644 index 327f74f..0000000 --- a/service/bearer.go +++ /dev/null @@ -1,140 +0,0 @@ -package service - -import ( - "crypto/ecdsa" - "io" - - "github.com/nspcc-dev/neofs-api-go/refs" - crypto "github.com/nspcc-dev/neofs-crypto" -) - -type signedBearerToken struct { - BearerToken -} - -type bearerMsgWrapper struct { - *BearerTokenMsg -} - -const fixedBearerTokenDataSize = 0 + - refs.OwnerIDSize + - 8 - -// NewSignedBearerToken wraps passed BearerToken in a component suitable for signing. -// -// Result can be used in AddSignatureWithKey function. -func NewSignedBearerToken(token BearerToken) DataWithSignKeyAccumulator { - return &signedBearerToken{ - BearerToken: token, - } -} - -// NewVerifiedBearerToken wraps passed SessionToken in a component suitable for signature verification. -// -// Result can be used in VerifySignatureWithKey function. -func NewVerifiedBearerToken(token BearerToken) DataWithSignature { - return &signedBearerToken{ - BearerToken: token, - } -} - -// AddSignKey calls a Signature field setter and an OwnerKey field setter with corresponding arguments. -func (s signedBearerToken) AddSignKey(sig []byte, key *ecdsa.PublicKey) { - if s.BearerToken != nil { - s.SetSignature(sig) - - s.SetOwnerKey( - crypto.MarshalPublicKey(key), - ) - } -} - -// SignedData returns token information in a binary representation. -func (s signedBearerToken) SignedData() ([]byte, error) { - return SignedDataFromReader(s) -} - -// SignedDataSize returns the length of signed token information slice. -func (s signedBearerToken) SignedDataSize() int { - return bearerTokenInfoSize(s.BearerToken) -} - -// ReadSignedData copies a binary representation of the token information to passed buffer. -// -// If buffer length is less than required, io.ErrUnexpectedEOF returns. -func (s signedBearerToken) ReadSignedData(p []byte) (int, error) { - sz := s.SignedDataSize() - if len(p) < sz { - return 0, io.ErrUnexpectedEOF - } - - copyBearerTokenSignedData(p, s.BearerToken) - - return sz, nil -} - -func bearerTokenInfoSize(v ACLRulesSource) int { - if v == nil { - return 0 - } - return fixedBearerTokenDataSize + len(v.GetACLRules()) -} - -// Fills passed buffer with signing token information bytes. -// Does not check buffer length, it is understood that enough space is allocated in it. -// -// If passed BearerTokenInfo, buffer remains unchanged. -func copyBearerTokenSignedData(buf []byte, token BearerTokenInfo) { - if token == nil { - return - } - - var off int - - off += copy(buf[off:], token.GetACLRules()) - - off += copy(buf[off:], token.GetOwnerID().Bytes()) - - tokenEndianness.PutUint64(buf[off:], token.ExpirationEpoch()) - off += 8 -} - -// SetACLRules is an ACLRules field setter. -func (m *BearerTokenMsg_Info) SetACLRules(v []byte) { - m.ACLRules = v -} - -// SetValidUntil is a ValidUntil field setter. -func (m *BearerTokenMsg_Info) SetValidUntil(v uint64) { - m.ValidUntil = v -} - -// GetOwnerID if an OwnerID field getter. -func (m BearerTokenMsg_Info) GetOwnerID() OwnerID { - return m.OwnerID -} - -// SetOwnerID is an OwnerID field setter. -func (m *BearerTokenMsg_Info) SetOwnerID(v OwnerID) { - m.OwnerID = v -} - -// ExpirationEpoch returns the result of ValidUntil field getter. -func (m BearerTokenMsg_Info) ExpirationEpoch() uint64 { - return m.GetValidUntil() -} - -// SetExpirationEpoch passes argument to ValidUntil field setter. -func (m *BearerTokenMsg_Info) SetExpirationEpoch(v uint64) { - m.SetValidUntil(v) -} - -// SetOwnerKey is an OwnerKey field setter. -func (m *BearerTokenMsg) SetOwnerKey(v []byte) { - m.OwnerKey = v -} - -// SetSignature is a Signature field setter. -func (m *BearerTokenMsg) SetSignature(v []byte) { - m.Signature = v -} diff --git a/service/bearer_test.go b/service/bearer_test.go deleted file mode 100644 index d6985cb..0000000 --- a/service/bearer_test.go +++ /dev/null @@ -1,199 +0,0 @@ -package service - -import ( - "crypto/rand" - "testing" - - "github.com/nspcc-dev/neofs-crypto/test" - "github.com/stretchr/testify/require" -) - -type testBearerToken struct { - aclRules []byte - expEpoch uint64 - owner OwnerID - key []byte - sig []byte -} - -func (s testBearerToken) GetACLRules() []byte { - return s.aclRules -} - -func (s *testBearerToken) SetACLRules(v []byte) { - s.aclRules = v -} - -func (s testBearerToken) ExpirationEpoch() uint64 { - return s.expEpoch -} - -func (s *testBearerToken) SetExpirationEpoch(v uint64) { - s.expEpoch = v -} - -func (s testBearerToken) GetOwnerID() OwnerID { - return s.owner -} - -func (s *testBearerToken) SetOwnerID(v OwnerID) { - s.owner = v -} - -func (s testBearerToken) GetOwnerKey() []byte { - return s.key -} - -func (s *testBearerToken) SetOwnerKey(v []byte) { - s.key = v -} - -func (s testBearerToken) GetSignature() []byte { - return s.sig -} - -func (s *testBearerToken) SetSignature(v []byte) { - s.sig = v -} - -func TestBearerTokenMsgGettersSetters(t *testing.T) { - var tok BearerToken = new(testBearerToken) - - { // ACLRules - rules := []byte{1, 2, 3} - - tok.SetACLRules(rules) - - require.Equal(t, rules, tok.GetACLRules()) - } - - { // OwnerID - ownerID := OwnerID{} - _, err := rand.Read(ownerID[:]) - require.NoError(t, err) - - tok.SetOwnerID(ownerID) - - require.Equal(t, ownerID, tok.GetOwnerID()) - } - - { // ValidUntil - e := uint64(5) - - tok.SetExpirationEpoch(e) - - require.Equal(t, e, tok.ExpirationEpoch()) - } - - { // OwnerKey - key := make([]byte, 10) - _, err := rand.Read(key) - require.NoError(t, err) - - tok.SetOwnerKey(key) - - require.Equal(t, key, tok.GetOwnerKey()) - } - - { // Signature - sig := make([]byte, 10) - _, err := rand.Read(sig) - require.NoError(t, err) - - tok.SetSignature(sig) - - require.Equal(t, sig, tok.GetSignature()) - } -} - -func TestSignVerifyBearerToken(t *testing.T) { - var token BearerToken = new(testBearerToken) - - // create private key for signing - sk := test.DecodeKey(0) - pk := &sk.PublicKey - - rules := []byte{1, 2, 3} - token.SetACLRules(rules) - - ownerID := OwnerID{} - _, err := rand.Read(ownerID[:]) - require.NoError(t, err) - token.SetOwnerID(ownerID) - - fEpoch := uint64(2) - token.SetExpirationEpoch(fEpoch) - - signedToken := NewSignedBearerToken(token) - verifiedToken := NewVerifiedBearerToken(token) - - // sign and verify token - require.NoError(t, AddSignatureWithKey(sk, signedToken)) - require.NoError(t, VerifySignatureWithKey(pk, verifiedToken)) - - items := []struct { - corrupt func() - restore func() - }{ - { // ACLRules - corrupt: func() { - token.SetACLRules(append(rules, 1)) - }, - restore: func() { - token.SetACLRules(rules) - }, - }, - { // Owner ID - corrupt: func() { - ownerID[0]++ - token.SetOwnerID(ownerID) - }, - restore: func() { - ownerID[0]-- - token.SetOwnerID(ownerID) - }, - }, - { // Expiration epoch - corrupt: func() { - token.SetExpirationEpoch(fEpoch + 1) - }, - restore: func() { - token.SetExpirationEpoch(fEpoch) - }, - }, - } - - for _, v := range items { - v.corrupt() - require.Error(t, VerifySignatureWithKey(pk, verifiedToken)) - v.restore() - require.NoError(t, VerifySignatureWithKey(pk, verifiedToken)) - } -} - -func TestBearerTokenMsg_Setters(t *testing.T) { - s := new(BearerTokenMsg) - - aclRules := []byte{1, 2, 3} - s.SetACLRules(aclRules) - require.Equal(t, aclRules, s.GetACLRules()) - - validUntil := uint64(6) - s.SetValidUntil(validUntil) - require.Equal(t, validUntil, s.GetValidUntil()) - - s.SetExpirationEpoch(validUntil + 1) - require.Equal(t, validUntil+1, s.ExpirationEpoch()) - - ownerID := OwnerID{1, 2, 3} - s.SetOwnerID(ownerID) - require.Equal(t, ownerID, s.GetOwnerID()) - - ownerKey := []byte{4, 5, 6} - s.SetOwnerKey(ownerKey) - require.Equal(t, ownerKey, s.GetOwnerKey()) - - sig := []byte{7, 8, 9} - s.SetSignature(sig) - require.Equal(t, sig, s.GetSignature()) -} diff --git a/service/epoch.go b/service/epoch.go deleted file mode 100644 index 7a7a556..0000000 --- a/service/epoch.go +++ /dev/null @@ -1,11 +0,0 @@ -package service - -// SetEpoch is an Epoch field setter. -func (m *ResponseMetaHeader) SetEpoch(v uint64) { - m.Epoch = v -} - -// SetEpoch is an Epoch field setter. -func (m *RequestMetaHeader) SetEpoch(v uint64) { - m.Epoch = v -} diff --git a/service/epoch_test.go b/service/epoch_test.go deleted file mode 100644 index 47316c0..0000000 --- a/service/epoch_test.go +++ /dev/null @@ -1,21 +0,0 @@ -package service - -import ( - "testing" - - "github.com/stretchr/testify/require" -) - -func TestGetSetEpoch(t *testing.T) { - v := uint64(5) - - items := []EpochContainer{ - new(ResponseMetaHeader), - new(RequestMetaHeader), - } - - for _, item := range items { - item.SetEpoch(v) - require.Equal(t, v, item.GetEpoch()) - } -} diff --git a/service/errors.go b/service/errors.go deleted file mode 100644 index e1c4900..0000000 --- a/service/errors.go +++ /dev/null @@ -1,53 +0,0 @@ -package service - -import "github.com/nspcc-dev/neofs-api-go/internal" - -// ErrNilToken is returned by functions that expect -// a non-nil token argument, but received nil. -const ErrNilToken = internal.Error("token is nil") - -// ErrInvalidTTL means that the TTL value does not -// satisfy a specific criterion. -const ErrInvalidTTL = internal.Error("invalid TTL value") - -// ErrInvalidPublicKeyBytes means that the public key could not be unmarshaled. -const ErrInvalidPublicKeyBytes = internal.Error("cannot load public key") - -// ErrCannotFindOwner is raised when signatures empty in GetOwner. -const ErrCannotFindOwner = internal.Error("cannot find owner public key") - -// ErrWrongOwner is raised when passed OwnerID -// not equal to present PublicKey -const ErrWrongOwner = internal.Error("wrong owner") - -// ErrNilSignedDataSource returned by functions that expect a non-nil -// SignedDataSource, but received nil. -const ErrNilSignedDataSource = internal.Error("signed data source is nil") - -// ErrNilSignatureKeySource is returned by functions that expect a non-nil -// SignatureKeySource, but received nil. -const ErrNilSignatureKeySource = internal.Error("empty key-signature source") - -// ErrEmptyDataWithSignature is returned by functions that expect -// a non-nil DataWithSignature, but received nil. -const ErrEmptyDataWithSignature = internal.Error("empty data with signature") - -// ErrNegativeLength is returned by functions that received -// negative length for slice allocation. -const ErrNegativeLength = internal.Error("negative slice length") - -// ErrNilRequestSignedData is returned by functions that expect -// a non-nil RequestSignedData, but received nil. -const ErrNilRequestSignedData = internal.Error("request signed data is nil") - -// ErrNilRequestVerifyData is returned by functions that expect -// a non-nil RequestVerifyData, but received nil. -const ErrNilRequestVerifyData = internal.Error("request verification data is nil") - -// ErrNilSignedDataReader is returned by functions that expect -// a non-nil SignedDataReader, but received nil. -const ErrNilSignedDataReader = internal.Error("signed data reader is nil") - -// ErrNilSignKeyPairAccumulator is returned by functions that expect -// a non-nil SignKeyPairAccumulator, but received nil. -const ErrNilSignKeyPairAccumulator = internal.Error("signature-key pair accumulator is nil") diff --git a/service/meta.go b/service/meta.go deleted file mode 100644 index 557d076..0000000 --- a/service/meta.go +++ /dev/null @@ -1,131 +0,0 @@ -package service - -import ( - "io" -) - -type extHdrWrapper struct { - msg *RequestExtendedHeader_KV -} - -type extHdrSrcWrapper struct { - extHdrSrc ExtendedHeadersSource -} - -// CutMeta returns current value and sets RequestMetaHeader to empty value. -func (m *RequestMetaHeader) CutMeta() RequestMetaHeader { - cp := *m - m.Reset() - return cp -} - -// RestoreMeta sets current RequestMetaHeader to passed value. -func (m *RequestMetaHeader) RestoreMeta(v RequestMetaHeader) { - *m = v -} - -// ExtendedHeadersSignedData wraps passed ExtendedHeadersSource and returns SignedDataSource. -func ExtendedHeadersSignedData(headers ExtendedHeadersSource) SignedDataSource { - return &extHdrSrcWrapper{ - extHdrSrc: headers, - } -} - -// SignedData returns extended headers in a binary representation. -func (s extHdrSrcWrapper) SignedData() ([]byte, error) { - return SignedDataFromReader(s) -} - -// SignedDataSize returns the length of extended headers slice. -func (s extHdrSrcWrapper) SignedDataSize() (res int) { - if s.extHdrSrc != nil { - for _, h := range s.extHdrSrc.ExtendedHeaders() { - if h != nil { - res += len(h.Key()) + len(h.Value()) - } - } - } - - return -} - -// ReadSignedData copies a binary representation of the extended headers to passed buffer. -// -// If buffer length is less than required, io.ErrUnexpectedEOF returns. -func (s extHdrSrcWrapper) ReadSignedData(p []byte) (int, error) { - sz := s.SignedDataSize() - if len(p) < sz { - return 0, io.ErrUnexpectedEOF - } - - if s.extHdrSrc != nil { - off := 0 - for _, h := range s.extHdrSrc.ExtendedHeaders() { - if h == nil { - continue - } - - off += copy(p[off:], []byte(h.Key())) - - off += copy(p[off:], []byte(h.Value())) - } - } - - return sz, nil -} - -// SetK is a K field setter. -func (m *RequestExtendedHeader_KV) SetK(v string) { - m.K = v -} - -// SetV is a V field setter. -func (m *RequestExtendedHeader_KV) SetV(v string) { - m.V = v -} - -// SetHeaders is a Headers field setter. -func (m *RequestExtendedHeader) SetHeaders(v []RequestExtendedHeader_KV) { - m.Headers = v -} - -func wrapExtendedHeaderKV(msg *RequestExtendedHeader_KV) extHdrWrapper { - return extHdrWrapper{ - msg: msg, - } -} - -// Key returns the result of K field getter. -// -// If message is nil, empty string returns. -func (m extHdrWrapper) Key() string { - if m.msg != nil { - return m.msg.GetK() - } - - return "" -} - -// Value returns the result of V field getter. -// -// If message is nil, empty string returns. -func (m extHdrWrapper) Value() string { - if m.msg != nil { - return m.msg.GetV() - } - - return "" -} - -// ExtendedHeaders composes ExtendedHeader list from the Headers field getter result. -func (m RequestExtendedHeader) ExtendedHeaders() []ExtendedHeader { - hs := m.GetHeaders() - - res := make([]ExtendedHeader, 0, len(hs)) - - for i := range hs { - res = append(res, wrapExtendedHeaderKV(&hs[i])) - } - - return res -} diff --git a/service/meta.pb.go b/service/meta.pb.go deleted file mode 100644 index 0d63077..0000000 --- a/service/meta.pb.go +++ /dev/null @@ -1,1118 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: service/meta.proto - -package service - -import ( - fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/golang/protobuf/proto" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package - -// RequestMetaHeader contains information about request meta headers -// (should be embedded into message) -type RequestMetaHeader struct { - // TTL must be larger than zero, it decreased in every NeoFS Node - TTL uint32 `protobuf:"varint,1,opt,name=TTL,proto3" json:"TTL,omitempty"` - // Epoch for user can be empty, because node sets epoch to the actual value - Epoch uint64 `protobuf:"varint,2,opt,name=Epoch,proto3" json:"Epoch,omitempty"` - // Version defines protocol version - // TODO: not used for now, should be implemented in future - Version uint32 `protobuf:"varint,3,opt,name=Version,proto3" json:"Version,omitempty"` - // Raw determines whether the request is raw or not - Raw bool `protobuf:"varint,4,opt,name=Raw,proto3" json:"Raw,omitempty"` - // ExtendedHeader carries extended headers of the request - RequestExtendedHeader `protobuf:"bytes,5,opt,name=ExtendedHeader,proto3,embedded=ExtendedHeader" json:"ExtendedHeader"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *RequestMetaHeader) Reset() { *m = RequestMetaHeader{} } -func (m *RequestMetaHeader) String() string { return proto.CompactTextString(m) } -func (*RequestMetaHeader) ProtoMessage() {} -func (*RequestMetaHeader) Descriptor() ([]byte, []int) { - return fileDescriptor_a638867e7b43457c, []int{0} -} -func (m *RequestMetaHeader) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *RequestMetaHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *RequestMetaHeader) XXX_Merge(src proto.Message) { - xxx_messageInfo_RequestMetaHeader.Merge(m, src) -} -func (m *RequestMetaHeader) XXX_Size() int { - return m.Size() -} -func (m *RequestMetaHeader) XXX_DiscardUnknown() { - xxx_messageInfo_RequestMetaHeader.DiscardUnknown(m) -} - -var xxx_messageInfo_RequestMetaHeader proto.InternalMessageInfo - -func (m *RequestMetaHeader) GetTTL() uint32 { - if m != nil { - return m.TTL - } - return 0 -} - -func (m *RequestMetaHeader) GetEpoch() uint64 { - if m != nil { - return m.Epoch - } - return 0 -} - -func (m *RequestMetaHeader) GetVersion() uint32 { - if m != nil { - return m.Version - } - return 0 -} - -func (m *RequestMetaHeader) GetRaw() bool { - if m != nil { - return m.Raw - } - return false -} - -// ResponseMetaHeader contains meta information based on request processing by server -// (should be embedded into message) -type ResponseMetaHeader struct { - // Current NeoFS epoch on server - Epoch uint64 `protobuf:"varint,1,opt,name=Epoch,proto3" json:"Epoch,omitempty"` - // Version defines protocol version - // TODO: not used for now, should be implemented in future - Version uint32 `protobuf:"varint,2,opt,name=Version,proto3" json:"Version,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ResponseMetaHeader) Reset() { *m = ResponseMetaHeader{} } -func (m *ResponseMetaHeader) String() string { return proto.CompactTextString(m) } -func (*ResponseMetaHeader) ProtoMessage() {} -func (*ResponseMetaHeader) Descriptor() ([]byte, []int) { - return fileDescriptor_a638867e7b43457c, []int{1} -} -func (m *ResponseMetaHeader) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ResponseMetaHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *ResponseMetaHeader) XXX_Merge(src proto.Message) { - xxx_messageInfo_ResponseMetaHeader.Merge(m, src) -} -func (m *ResponseMetaHeader) XXX_Size() int { - return m.Size() -} -func (m *ResponseMetaHeader) XXX_DiscardUnknown() { - xxx_messageInfo_ResponseMetaHeader.DiscardUnknown(m) -} - -var xxx_messageInfo_ResponseMetaHeader proto.InternalMessageInfo - -func (m *ResponseMetaHeader) GetEpoch() uint64 { - if m != nil { - return m.Epoch - } - return 0 -} - -func (m *ResponseMetaHeader) GetVersion() uint32 { - if m != nil { - return m.Version - } - return 0 -} - -// RequestExtendedHeader contains extended headers of request -type RequestExtendedHeader struct { - // Headers carries list of key-value headers - Headers []RequestExtendedHeader_KV `protobuf:"bytes,1,rep,name=Headers,proto3" json:"Headers"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *RequestExtendedHeader) Reset() { *m = RequestExtendedHeader{} } -func (m *RequestExtendedHeader) String() string { return proto.CompactTextString(m) } -func (*RequestExtendedHeader) ProtoMessage() {} -func (*RequestExtendedHeader) Descriptor() ([]byte, []int) { - return fileDescriptor_a638867e7b43457c, []int{2} -} -func (m *RequestExtendedHeader) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *RequestExtendedHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *RequestExtendedHeader) XXX_Merge(src proto.Message) { - xxx_messageInfo_RequestExtendedHeader.Merge(m, src) -} -func (m *RequestExtendedHeader) XXX_Size() int { - return m.Size() -} -func (m *RequestExtendedHeader) XXX_DiscardUnknown() { - xxx_messageInfo_RequestExtendedHeader.DiscardUnknown(m) -} - -var xxx_messageInfo_RequestExtendedHeader proto.InternalMessageInfo - -func (m *RequestExtendedHeader) GetHeaders() []RequestExtendedHeader_KV { - if m != nil { - return m.Headers - } - return nil -} - -// KV contains string key-value pair -type RequestExtendedHeader_KV struct { - // K carries extended header key - K string `protobuf:"bytes,1,opt,name=K,proto3" json:"K,omitempty"` - // V carries extended header value - V string `protobuf:"bytes,2,opt,name=V,proto3" json:"V,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *RequestExtendedHeader_KV) Reset() { *m = RequestExtendedHeader_KV{} } -func (m *RequestExtendedHeader_KV) String() string { return proto.CompactTextString(m) } -func (*RequestExtendedHeader_KV) ProtoMessage() {} -func (*RequestExtendedHeader_KV) Descriptor() ([]byte, []int) { - return fileDescriptor_a638867e7b43457c, []int{2, 0} -} -func (m *RequestExtendedHeader_KV) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *RequestExtendedHeader_KV) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *RequestExtendedHeader_KV) XXX_Merge(src proto.Message) { - xxx_messageInfo_RequestExtendedHeader_KV.Merge(m, src) -} -func (m *RequestExtendedHeader_KV) XXX_Size() int { - return m.Size() -} -func (m *RequestExtendedHeader_KV) XXX_DiscardUnknown() { - xxx_messageInfo_RequestExtendedHeader_KV.DiscardUnknown(m) -} - -var xxx_messageInfo_RequestExtendedHeader_KV proto.InternalMessageInfo - -func (m *RequestExtendedHeader_KV) GetK() string { - if m != nil { - return m.K - } - return "" -} - -func (m *RequestExtendedHeader_KV) GetV() string { - if m != nil { - return m.V - } - return "" -} - -func init() { - proto.RegisterType((*RequestMetaHeader)(nil), "service.RequestMetaHeader") - proto.RegisterType((*ResponseMetaHeader)(nil), "service.ResponseMetaHeader") - proto.RegisterType((*RequestExtendedHeader)(nil), "service.RequestExtendedHeader") - proto.RegisterType((*RequestExtendedHeader_KV)(nil), "service.RequestExtendedHeader.KV") -} - -func init() { proto.RegisterFile("service/meta.proto", fileDescriptor_a638867e7b43457c) } - -var fileDescriptor_a638867e7b43457c = []byte{ - // 362 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x91, 0xb1, 0x8e, 0xda, 0x40, - 0x10, 0x86, 0x19, 0x03, 0x01, 0x96, 0x24, 0x0a, 0xab, 0x44, 0xb2, 0x28, 0x8c, 0x43, 0xe5, 0x14, - 0xb6, 0x25, 0xf2, 0x04, 0xa0, 0x10, 0x25, 0x72, 0x12, 0xa1, 0x05, 0xb9, 0x48, 0x67, 0xec, 0xc1, - 0xb8, 0xc0, 0xeb, 0x78, 0x0d, 0x49, 0x91, 0x07, 0xc9, 0x33, 0xe4, 0x0d, 0xee, 0x0d, 0x28, 0x29, - 0xaf, 0x42, 0x27, 0xdf, 0x8b, 0x9c, 0xbc, 0x36, 0x27, 0x38, 0xdd, 0x5d, 0xf7, 0x7f, 0xb3, 0x33, - 0x3b, 0x9f, 0x34, 0x84, 0x0a, 0x4c, 0x77, 0x91, 0x8f, 0xf6, 0x06, 0x33, 0xcf, 0x4a, 0x52, 0x9e, - 0x71, 0xda, 0xaa, 0x6a, 0x7d, 0x33, 0x8c, 0xb2, 0xf5, 0x76, 0x69, 0xf9, 0x7c, 0x63, 0x87, 0x3c, - 0xe4, 0xb6, 0x7c, 0x5f, 0x6e, 0x57, 0x92, 0x24, 0xc8, 0x54, 0xce, 0x0d, 0xaf, 0x80, 0xf4, 0x18, - 0xfe, 0xda, 0xa2, 0xc8, 0xbe, 0x63, 0xe6, 0x7d, 0x41, 0x2f, 0xc0, 0x94, 0xbe, 0x21, 0xf5, 0xc5, - 0xe2, 0x9b, 0x0a, 0x3a, 0x18, 0xaf, 0x58, 0x11, 0xe9, 0x5b, 0xd2, 0x9c, 0x26, 0xdc, 0x5f, 0xab, - 0x8a, 0x0e, 0x46, 0x83, 0x95, 0x40, 0x55, 0xd2, 0x72, 0x31, 0x15, 0x11, 0x8f, 0xd5, 0xba, 0xec, - 0x3d, 0x61, 0xf1, 0x03, 0xf3, 0x7e, 0xab, 0x0d, 0x1d, 0x8c, 0x36, 0x2b, 0x22, 0x9d, 0x91, 0xd7, - 0xd3, 0x3f, 0x19, 0xc6, 0x01, 0x06, 0xe5, 0x16, 0xb5, 0xa9, 0x83, 0xd1, 0x1d, 0x69, 0x56, 0xa5, - 0x6e, 0x55, 0x1e, 0x97, 0x5d, 0x93, 0xf6, 0xfe, 0x38, 0xa8, 0x1d, 0x8e, 0x03, 0x60, 0x0f, 0xe6, - 0x87, 0x9f, 0x08, 0x65, 0x28, 0x12, 0x1e, 0x0b, 0x3c, 0x73, 0xbf, 0x37, 0x85, 0x27, 0x4c, 0x95, - 0x0b, 0xd3, 0xe1, 0x5f, 0xf2, 0xee, 0xd1, 0xc5, 0x74, 0x4c, 0x5a, 0x65, 0x12, 0x2a, 0xe8, 0x75, - 0xa3, 0x3b, 0x7a, 0xff, 0xbc, 0xa9, 0xe5, 0xb8, 0x93, 0x46, 0x21, 0xcb, 0x4e, 0x73, 0x7d, 0x9d, - 0x28, 0x8e, 0x4b, 0x5f, 0x12, 0x70, 0xa4, 0x4d, 0x87, 0x81, 0x53, 0x90, 0x2b, 0x1d, 0x3a, 0x0c, - 0xdc, 0xc9, 0x7c, 0x9f, 0x6b, 0x70, 0xc8, 0x35, 0xb8, 0xce, 0x35, 0xb8, 0xc9, 0x35, 0xf8, 0x77, - 0xab, 0xd5, 0x7e, 0x7e, 0x38, 0x3b, 0x62, 0x2c, 0x12, 0xdf, 0x37, 0x03, 0xdc, 0xd9, 0x31, 0xf2, - 0x95, 0x30, 0xbd, 0x24, 0x32, 0x43, 0x6e, 0x57, 0x2a, 0xff, 0x95, 0xde, 0x0f, 0xe4, 0x9f, 0xe7, - 0xd6, 0x78, 0xf6, 0xd5, 0x9a, 0x97, 0xb5, 0xe5, 0x0b, 0x79, 0xdb, 0x8f, 0x77, 0x01, 0x00, 0x00, - 0xff, 0xff, 0xf3, 0xf7, 0x0a, 0xb8, 0x29, 0x02, 0x00, 0x00, -} - -func (m *RequestMetaHeader) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *RequestMetaHeader) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *RequestMetaHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - { - size, err := m.RequestExtendedHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintMeta(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2a - if m.Raw { - i-- - if m.Raw { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x20 - } - if m.Version != 0 { - i = encodeVarintMeta(dAtA, i, uint64(m.Version)) - i-- - dAtA[i] = 0x18 - } - if m.Epoch != 0 { - i = encodeVarintMeta(dAtA, i, uint64(m.Epoch)) - i-- - dAtA[i] = 0x10 - } - if m.TTL != 0 { - i = encodeVarintMeta(dAtA, i, uint64(m.TTL)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *ResponseMetaHeader) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ResponseMetaHeader) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ResponseMetaHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.Version != 0 { - i = encodeVarintMeta(dAtA, i, uint64(m.Version)) - i-- - dAtA[i] = 0x10 - } - if m.Epoch != 0 { - i = encodeVarintMeta(dAtA, i, uint64(m.Epoch)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *RequestExtendedHeader) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *RequestExtendedHeader) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *RequestExtendedHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.Headers) > 0 { - for iNdEx := len(m.Headers) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Headers[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintMeta(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *RequestExtendedHeader_KV) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *RequestExtendedHeader_KV) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *RequestExtendedHeader_KV) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.V) > 0 { - i -= len(m.V) - copy(dAtA[i:], m.V) - i = encodeVarintMeta(dAtA, i, uint64(len(m.V))) - i-- - dAtA[i] = 0x12 - } - if len(m.K) > 0 { - i -= len(m.K) - copy(dAtA[i:], m.K) - i = encodeVarintMeta(dAtA, i, uint64(len(m.K))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func encodeVarintMeta(dAtA []byte, offset int, v uint64) int { - offset -= sovMeta(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *RequestMetaHeader) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.TTL != 0 { - n += 1 + sovMeta(uint64(m.TTL)) - } - if m.Epoch != 0 { - n += 1 + sovMeta(uint64(m.Epoch)) - } - if m.Version != 0 { - n += 1 + sovMeta(uint64(m.Version)) - } - if m.Raw { - n += 2 - } - l = m.RequestExtendedHeader.Size() - n += 1 + l + sovMeta(uint64(l)) - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *ResponseMetaHeader) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Epoch != 0 { - n += 1 + sovMeta(uint64(m.Epoch)) - } - if m.Version != 0 { - n += 1 + sovMeta(uint64(m.Version)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *RequestExtendedHeader) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Headers) > 0 { - for _, e := range m.Headers { - l = e.Size() - n += 1 + l + sovMeta(uint64(l)) - } - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *RequestExtendedHeader_KV) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.K) - if l > 0 { - n += 1 + l + sovMeta(uint64(l)) - } - l = len(m.V) - if l > 0 { - n += 1 + l + sovMeta(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func sovMeta(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozMeta(x uint64) (n int) { - return sovMeta(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *RequestMetaHeader) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMeta - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: RequestMetaHeader: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: RequestMetaHeader: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TTL", wireType) - } - m.TTL = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMeta - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.TTL |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Epoch", wireType) - } - m.Epoch = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMeta - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Epoch |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) - } - m.Version = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMeta - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Version |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Raw", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMeta - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Raw = bool(v != 0) - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RequestExtendedHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMeta - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthMeta - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthMeta - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.RequestExtendedHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipMeta(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthMeta - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthMeta - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ResponseMetaHeader) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMeta - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ResponseMetaHeader: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ResponseMetaHeader: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Epoch", wireType) - } - m.Epoch = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMeta - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Epoch |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) - } - m.Version = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMeta - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Version |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipMeta(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthMeta - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthMeta - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *RequestExtendedHeader) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMeta - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: RequestExtendedHeader: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: RequestExtendedHeader: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Headers", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMeta - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthMeta - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthMeta - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Headers = append(m.Headers, RequestExtendedHeader_KV{}) - if err := m.Headers[len(m.Headers)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipMeta(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthMeta - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthMeta - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *RequestExtendedHeader_KV) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMeta - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: KV: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: KV: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field K", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMeta - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthMeta - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthMeta - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.K = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field V", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMeta - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthMeta - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthMeta - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.V = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipMeta(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthMeta - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthMeta - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipMeta(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowMeta - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowMeta - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowMeta - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthMeta - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupMeta - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthMeta - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthMeta = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowMeta = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupMeta = fmt.Errorf("proto: unexpected end of group") -) diff --git a/service/meta.proto b/service/meta.proto deleted file mode 100644 index 8171980..0000000 --- a/service/meta.proto +++ /dev/null @@ -1,49 +0,0 @@ -syntax = "proto3"; -package service; -option go_package = "github.com/nspcc-dev/neofs-api-go/service"; -option csharp_namespace = "NeoFS.API.Service"; - -import "github.com/gogo/protobuf/gogoproto/gogo.proto"; - -option (gogoproto.stable_marshaler_all) = true; - -// RequestMetaHeader contains information about request meta headers -// (should be embedded into message) -message RequestMetaHeader { - // TTL must be larger than zero, it decreased in every NeoFS Node - uint32 TTL = 1; - // Epoch for user can be empty, because node sets epoch to the actual value - uint64 Epoch = 2; - // Version defines protocol version - // TODO: not used for now, should be implemented in future - uint32 Version = 3; - // Raw determines whether the request is raw or not - bool Raw = 4; - // ExtendedHeader carries extended headers of the request - RequestExtendedHeader ExtendedHeader = 5 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; -} - -// ResponseMetaHeader contains meta information based on request processing by server -// (should be embedded into message) -message ResponseMetaHeader { - // Current NeoFS epoch on server - uint64 Epoch = 1; - // Version defines protocol version - // TODO: not used for now, should be implemented in future - uint32 Version = 2; -} - -// RequestExtendedHeader contains extended headers of request -message RequestExtendedHeader { - // KV contains string key-value pair - message KV { - // K carries extended header key - string K = 1; - - // V carries extended header value - string V = 2; - } - - // Headers carries list of key-value headers - repeated KV Headers = 1 [(gogoproto.nullable) = false]; -} diff --git a/service/meta_test.go b/service/meta_test.go deleted file mode 100644 index 9e9c012..0000000 --- a/service/meta_test.go +++ /dev/null @@ -1,99 +0,0 @@ -package service - -import ( - "testing" - - "github.com/stretchr/testify/require" -) - -func TestCutRestoreMeta(t *testing.T) { - items := []func() SeizedMetaHeaderContainer{ - func() SeizedMetaHeaderContainer { - m := new(RequestMetaHeader) - m.SetEpoch(1) - return m - }, - } - - for _, item := range items { - v1 := item() - m1 := v1.CutMeta() - v1.RestoreMeta(m1) - - require.Equal(t, item(), v1) - } -} - -func TestRequestExtendedHeader_KV_Setters(t *testing.T) { - s := new(RequestExtendedHeader_KV) - - key := "key" - s.SetK(key) - require.Equal(t, key, s.GetK()) - - val := "val" - s.SetV(val) - require.Equal(t, val, s.GetV()) -} - -func TestRequestExtendedHeader_SetHeaders(t *testing.T) { - s := new(RequestExtendedHeader) - - hdr := RequestExtendedHeader_KV{} - hdr.SetK("key") - hdr.SetV("val") - - hdrs := []RequestExtendedHeader_KV{ - hdr, - } - - s.SetHeaders(hdrs) - - require.Equal(t, hdrs, s.GetHeaders()) -} - -func TestExtHdrWrapper(t *testing.T) { - s := wrapExtendedHeaderKV(nil) - require.Empty(t, s.Key()) - require.Empty(t, s.Value()) - - msg := new(RequestExtendedHeader_KV) - s = wrapExtendedHeaderKV(msg) - - key := "key" - msg.SetK(key) - require.Equal(t, key, s.Key()) - - val := "val" - msg.SetV(val) - require.Equal(t, val, s.Value()) -} - -func TestRequestExtendedHeader_ExtendedHeaders(t *testing.T) { - var ( - k1, v1 = "key1", "value1" - k2, v2 = "key2", "value2" - h1 = new(RequestExtendedHeader_KV) - h2 = new(RequestExtendedHeader_KV) - ) - - h1.SetK(k1) - h1.SetV(v1) - - h2.SetK(k2) - h2.SetV(v2) - - s := new(RequestExtendedHeader) - s.SetHeaders([]RequestExtendedHeader_KV{ - *h1, *h2, - }) - - xHdrs := s.ExtendedHeaders() - require.Len(t, xHdrs, 2) - - require.Equal(t, k1, xHdrs[0].Key()) - require.Equal(t, v1, xHdrs[0].Value()) - - require.Equal(t, k2, xHdrs[1].Key()) - require.Equal(t, v2, xHdrs[1].Value()) -} diff --git a/service/raw.go b/service/raw.go deleted file mode 100644 index 0bb4b27..0000000 --- a/service/raw.go +++ /dev/null @@ -1,6 +0,0 @@ -package service - -// SetRaw is a Raw field setter. -func (m *RequestMetaHeader) SetRaw(raw bool) { - m.Raw = raw -} diff --git a/service/raw_test.go b/service/raw_test.go deleted file mode 100644 index ad595ed..0000000 --- a/service/raw_test.go +++ /dev/null @@ -1,24 +0,0 @@ -package service - -import ( - "testing" - - "github.com/stretchr/testify/require" -) - -func TestGetSetRaw(t *testing.T) { - items := []RawContainer{ - new(RequestMetaHeader), - } - - for _, item := range items { - // init with false - item.SetRaw(false) - - item.SetRaw(true) - require.True(t, item.GetRaw()) - - item.SetRaw(false) - require.False(t, item.GetRaw()) - } -} diff --git a/service/role.go b/service/role.go deleted file mode 100644 index 64a0074..0000000 --- a/service/role.go +++ /dev/null @@ -1,37 +0,0 @@ -package service - -import "encoding/binary" - -const ( - _ NodeRole = iota - // InnerRingNode that work like IR node. - InnerRingNode - // StorageNode that work like a storage node. - StorageNode -) - -// String is method, that represent NodeRole as string. -func (nt NodeRole) String() string { - switch nt { - case InnerRingNode: - return "InnerRingNode" - case StorageNode: - return "StorageNode" - default: - return "Unknown" - } -} - -// Size returns the size necessary for a binary representation of the NodeRole. -func (nt NodeRole) Size() int { - return 4 -} - -// Bytes returns a binary representation of the NodeRole. -func (nt NodeRole) Bytes() []byte { - data := make([]byte, nt.Size()) - - binary.BigEndian.PutUint32(data, uint32(nt)) - - return data -} diff --git a/service/role_test.go b/service/role_test.go deleted file mode 100644 index 01dbee2..0000000 --- a/service/role_test.go +++ /dev/null @@ -1,23 +0,0 @@ -package service - -import ( - "testing" - - "github.com/stretchr/testify/require" -) - -func TestNodeRole_String(t *testing.T) { - tests := []struct { - nt NodeRole - want string - }{ - {want: "Unknown"}, - {nt: StorageNode, want: "StorageNode"}, - {nt: InnerRingNode, want: "InnerRingNode"}, - } - for _, tt := range tests { - t.Run(tt.want, func(t *testing.T) { - require.Equal(t, tt.want, tt.nt.String()) - }) - } -} diff --git a/service/sign.go b/service/sign.go deleted file mode 100644 index 796a4cd..0000000 --- a/service/sign.go +++ /dev/null @@ -1,404 +0,0 @@ -package service - -import ( - "crypto/ecdsa" - "io" - "sync" - - crypto "github.com/nspcc-dev/neofs-crypto" - "github.com/pkg/errors" -) - -type keySign struct { - key *ecdsa.PublicKey - sign []byte -} - -type signSourceGroup struct { - SignKeyPairSource - SignKeyPairAccumulator - - sources []SignedDataSource -} - -type signReadersGroup struct { - SignKeyPairSource - SignKeyPairAccumulator - - readers []SignedDataReader -} - -var bytesPool = sync.Pool{ - New: func() interface{} { - return make([]byte, 5<<20) - }, -} - -// GetSignature is a sign field getter. -func (s keySign) GetSignature() []byte { - return s.sign -} - -// GetPublicKey is a key field getter, -func (s keySign) GetPublicKey() *ecdsa.PublicKey { - return s.key -} - -// Unites passed key with signature and returns SignKeyPair interface. -func newSignatureKeyPair(key *ecdsa.PublicKey, sign []byte) SignKeyPair { - return &keySign{ - key: key, - sign: sign, - } -} - -// Returns data from DataSignatureAccumulator for signature creation/verification. -// -// If passed DataSignatureAccumulator provides a SignedDataReader interface, data for signature is obtained -// using this interface for optimization. In this case, it is understood that reading into the slice D -// that the method DataForSignature returns does not change D. -// -// If returned length of data is negative, ErrNegativeLength returns. -func dataForSignature(src SignedDataSource) ([]byte, error) { - if src == nil { - return nil, ErrNilSignedDataSource - } - - r, ok := src.(SignedDataReader) - if !ok { - return src.SignedData() - } - - buf := bytesPool.Get().([]byte) - - if size := r.SignedDataSize(); size < 0 { - return nil, ErrNegativeLength - } else if size <= cap(buf) { - buf = buf[:size] - } else { - buf = make([]byte, size) - } - - n, err := r.ReadSignedData(buf) - if err != nil { - return nil, err - } - - return buf[:n], nil - -} - -// DataSignature returns the signature of data obtained using the private key. -// -// If passed data container is nil, ErrNilSignedDataSource returns. -// If passed private key is nil, crypto.ErrEmptyPrivateKey returns. -// If the data container or the signature function returns an error, it is returned directly. -func DataSignature(key *ecdsa.PrivateKey, src SignedDataSource) ([]byte, error) { - if key == nil { - return nil, crypto.ErrEmptyPrivateKey - } - - data, err := dataForSignature(src) - if err != nil { - return nil, err - } - defer bytesPool.Put(data) - - return crypto.Sign(key, data) -} - -// AddSignatureWithKey calculates the data signature and adds it to accumulator with public key. -// -// Any change of data provoke signature breakdown. -// -// Returns signing errors only. -func AddSignatureWithKey(key *ecdsa.PrivateKey, v DataWithSignKeyAccumulator) error { - sign, err := DataSignature(key, v) - if err != nil { - return err - } - - v.AddSignKey(sign, &key.PublicKey) - - return nil -} - -// Checks passed key-signature pairs for data from the passed container. -// -// If passed key-signatures pair set is empty, nil returns immediately. -func verifySignatures(src SignedDataSource, items ...SignKeyPair) error { - if len(items) <= 0 { - return nil - } - - data, err := dataForSignature(src) - if err != nil { - return err - } - defer bytesPool.Put(data) - - for i := range items { - if i > 0 { - // add previous key bytes to the signed message - - signKeyDataSrc := SignKeyPairsSignedData(items[i-1]) - - signKeyData, err := signKeyDataSrc.SignedData() - if err != nil { - return errors.Wrapf(err, "could not get signed data of key-signature #%d", i) - } - - data = append(data, signKeyData...) - } - - if err := crypto.Verify( - items[i].GetPublicKey(), - data, - items[i].GetSignature(), - ); err != nil { - return err - } - } - - return nil -} - -// VerifySignatures checks passed key-signature pairs for data from the passed container. -// -// If passed data source is nil, ErrNilSignedDataSource returns. -// If check data is not ready, corresponding error returns. -// If at least one of the pairs is invalid, an error returns. -func VerifySignatures(src SignedDataSource, items ...SignKeyPair) error { - return verifySignatures(src, items...) -} - -// VerifyAccumulatedSignatures checks if accumulated key-signature pairs are valid. -// -// Behaves like VerifySignatures. -// If passed key-signature source is empty, ErrNilSignatureKeySource returns. -func VerifyAccumulatedSignatures(src DataWithSignKeySource) error { - if src == nil { - return ErrNilSignatureKeySource - } - - return verifySignatures(src, src.GetSignKeyPairs()...) -} - -// VerifySignatureWithKey checks data signature from the passed container with passed key. -// -// If passed data with signature is nil, ErrEmptyDataWithSignature returns. -// If passed key is nil, crypto.ErrEmptyPublicKey returns. -// A non-nil error returns if and only if the signature does not pass verification. -func VerifySignatureWithKey(key *ecdsa.PublicKey, src DataWithSignature) error { - if src == nil { - return ErrEmptyDataWithSignature - } else if key == nil { - return crypto.ErrEmptyPublicKey - } - - return verifySignatures( - src, - newSignatureKeyPair( - key, - src.GetSignature(), - ), - ) -} - -// SignRequestData calculates request data signature and adds it to accumulator. -// -// Any change of request data provoke signature breakdown. -// -// If passed private key is nil, crypto.ErrEmptyPrivateKey returns. -// If passed RequestSignedData is nil, ErrNilRequestSignedData returns. -func SignRequestData(key *ecdsa.PrivateKey, src RequestSignedData) error { - if src == nil { - return ErrNilRequestSignedData - } - - sigSrc, err := GroupSignedPayloads( - src, - src, - NewSignedSessionToken( - src.GetSessionToken(), - ), - NewSignedBearerToken( - src.GetBearerToken(), - ), - ExtendedHeadersSignedData(src), - SignKeyPairsSignedData(src.GetSignKeyPairs()...), - ) - if err != nil { - return err - } - - return AddSignatureWithKey(key, sigSrc) -} - -// VerifyRequestData checks if accumulated key-signature pairs of data with token are valid. -// -// If passed RequestVerifyData is nil, ErrNilRequestVerifyData returns. -func VerifyRequestData(src RequestVerifyData) error { - if src == nil { - return ErrNilRequestVerifyData - } - - verSrc, err := GroupVerifyPayloads( - src, - src, - NewVerifiedSessionToken( - src.GetSessionToken(), - ), - NewVerifiedBearerToken( - src.GetBearerToken(), - ), - ExtendedHeadersSignedData(src), - ) - if err != nil { - return err - } - - return VerifyAccumulatedSignatures(verSrc) -} - -// SignedData returns payload bytes concatenation from all sources keeping order. -func (s signSourceGroup) SignedData() ([]byte, error) { - chunks := make([][]byte, 0, len(s.sources)) - sz := 0 - - for i := range s.sources { - data, err := s.sources[i].SignedData() - if err != nil { - return nil, errors.Wrapf(err, "could not get signed payload of element #%d", i) - } - - chunks = append(chunks, data) - - sz += len(data) - } - - res := make([]byte, sz) - off := 0 - - for i := range chunks { - off += copy(res[off:], chunks[i]) - } - - return res, nil -} - -// SignedData returns payload bytes concatenation from all readers. -func (s signReadersGroup) SignedData() ([]byte, error) { - return SignedDataFromReader(s) -} - -// SignedDataSize returns the sum of sizes of all readers. -func (s signReadersGroup) SignedDataSize() (sz int) { - for i := range s.readers { - sz += s.readers[i].SignedDataSize() - } - - return -} - -// ReadSignedData reads data from all readers to passed buffer keeping order. -// -// If the buffer size is insufficient, io.ErrUnexpectedEOF returns. -func (s signReadersGroup) ReadSignedData(p []byte) (int, error) { - sz := s.SignedDataSize() - if len(p) < sz { - return 0, io.ErrUnexpectedEOF - } - - off := 0 - - for i := range s.readers { - n, err := s.readers[i].ReadSignedData(p[off:]) - off += n - if err != nil { - return off, errors.Wrapf(err, "could not read signed payload of element #%d", i) - } - } - - return off, nil -} - -// GroupSignedPayloads groups SignKeyPairAccumulator and SignedDataSource list to DataWithSignKeyAccumulator. -// -// If passed SignKeyPairAccumulator is nil, ErrNilSignKeyPairAccumulator returns. -// -// Signed payload of the result is a concatenation of payloads of list elements keeping order. -// Nil elements in list are ignored. -// -// If all elements implement SignedDataReader, result implements it too. -func GroupSignedPayloads(acc SignKeyPairAccumulator, sources ...SignedDataSource) (DataWithSignKeyAccumulator, error) { - if acc == nil { - return nil, ErrNilSignKeyPairAccumulator - } - - return groupPayloads(acc, nil, sources...), nil -} - -// GroupVerifyPayloads groups SignKeyPairSource and SignedDataSource list to DataWithSignKeySource. -// -// If passed SignKeyPairSource is nil, ErrNilSignatureKeySource returns. -// -// Signed payload of the result is a concatenation of payloads of list elements keeping order. -// Nil elements in list are ignored. -// -// If all elements implement SignedDataReader, result implements it too. -func GroupVerifyPayloads(src SignKeyPairSource, sources ...SignedDataSource) (DataWithSignKeySource, error) { - if src == nil { - return nil, ErrNilSignatureKeySource - } - - return groupPayloads(nil, src, sources...), nil -} - -func groupPayloads(acc SignKeyPairAccumulator, src SignKeyPairSource, sources ...SignedDataSource) interface { - SignedDataSource - SignKeyPairSource - SignKeyPairAccumulator -} { - var allReaders bool - - for i := range sources { - if sources[i] == nil { - continue - } else if _, allReaders = sources[i].(SignedDataReader); !allReaders { - break - } - } - - if !allReaders { - res := &signSourceGroup{ - SignKeyPairSource: src, - SignKeyPairAccumulator: acc, - - sources: make([]SignedDataSource, 0, len(sources)), - } - - for i := range sources { - if sources[i] != nil { - res.sources = append(res.sources, sources[i]) - } - } - - return res - } - - res := &signReadersGroup{ - SignKeyPairSource: src, - SignKeyPairAccumulator: acc, - - readers: make([]SignedDataReader, 0, len(sources)), - } - - for i := range sources { - if sources[i] != nil { - res.readers = append(res.readers, sources[i].(SignedDataReader)) - } - } - - return res -} diff --git a/service/sign_test.go b/service/sign_test.go deleted file mode 100644 index 3c54e8c..0000000 --- a/service/sign_test.go +++ /dev/null @@ -1,400 +0,0 @@ -package service - -import ( - "crypto/ecdsa" - "crypto/rand" - "errors" - "io" - "testing" - - crypto "github.com/nspcc-dev/neofs-crypto" - "github.com/nspcc-dev/neofs-crypto/test" - "github.com/stretchr/testify/require" -) - -type testSignedDataSrc struct { - err error - data []byte - token SessionToken - - bearer BearerToken - - extHdrs []ExtendedHeader - - signKeys []SignKeyPair -} - -type testSignedDataReader struct { - *testSignedDataSrc -} - -func (s testSignedDataSrc) GetSignature() []byte { - if len(s.signKeys) > 0 { - return s.signKeys[0].GetSignature() - } - - return nil -} - -func (s testSignedDataSrc) GetSignKeyPairs() []SignKeyPair { - return s.signKeys -} - -func (s testSignedDataSrc) SignedData() ([]byte, error) { - return s.data, s.err -} - -func (s *testSignedDataSrc) AddSignKey(sig []byte, key *ecdsa.PublicKey) { - s.signKeys = append(s.signKeys, - newSignatureKeyPair(key, sig), - ) -} - -func testData(t *testing.T, sz int) []byte { - d := make([]byte, sz) - _, err := rand.Read(d) - require.NoError(t, err) - return d -} - -func (s testSignedDataSrc) GetSessionToken() SessionToken { - return s.token -} - -func (s testSignedDataSrc) GetBearerToken() BearerToken { - return s.bearer -} - -func (s testSignedDataSrc) ExtendedHeaders() []ExtendedHeader { - return s.extHdrs -} - -func (s testSignedDataReader) SignedDataSize() int { - return len(s.data) -} - -func (s testSignedDataReader) ReadSignedData(buf []byte) (int, error) { - if s.err != nil { - return 0, s.err - } - - var err error - if len(buf) < len(s.data) { - err = io.ErrUnexpectedEOF - } - return copy(buf, s.data), err -} - -func TestDataSignature(t *testing.T) { - var err error - - // nil private key - _, err = DataSignature(nil, nil) - require.EqualError(t, err, crypto.ErrEmptyPrivateKey.Error()) - - // create test private key - sk := test.DecodeKey(0) - - // nil private key - _, err = DataSignature(sk, nil) - require.EqualError(t, err, ErrNilSignedDataSource.Error()) - - t.Run("common signed data source", func(t *testing.T) { - // create test data source - src := &testSignedDataSrc{ - data: testData(t, 10), - } - - // create custom error for data source - src.err = errors.New("test error for data source") - - _, err = DataSignature(sk, src) - require.EqualError(t, err, src.err.Error()) - - // reset error to nil - src.err = nil - - // calculate data signature - sig, err := DataSignature(sk, src) - require.NoError(t, err) - - // ascertain that the signature passes verification - require.NoError(t, crypto.Verify(&sk.PublicKey, src.data, sig)) - }) - - t.Run("signed data reader", func(t *testing.T) { - // create test signed data reader - src := &testSignedDataSrc{ - data: testData(t, 10), - } - - // create custom error for signed data reader - src.err = errors.New("test error for signed data reader") - - sig, err := DataSignature(sk, src) - require.EqualError(t, err, src.err.Error()) - - // reset error to nil - src.err = nil - - // calculate data signature - sig, err = DataSignature(sk, src) - require.NoError(t, err) - - // ascertain that the signature passes verification - require.NoError(t, crypto.Verify(&sk.PublicKey, src.data, sig)) - }) -} - -func TestAddSignatureWithKey(t *testing.T) { - require.NoError(t, - AddSignatureWithKey( - test.DecodeKey(0), - &testSignedDataSrc{ - data: testData(t, 10), - }, - ), - ) -} - -func TestVerifySignatures(t *testing.T) { - // empty signatures - require.NoError(t, VerifySignatures(nil)) - - // create test signature source - src := &testSignedDataSrc{ - data: testData(t, 10), - } - - // create private key for test - sk := test.DecodeKey(0) - - // calculate a signature of the data - sig, err := crypto.Sign(sk, src.data) - require.NoError(t, err) - - // ascertain that verification is passed - require.NoError(t, - VerifySignatures( - src, - newSignatureKeyPair(&sk.PublicKey, sig), - ), - ) - - // break the signature - sig[0]++ - - require.Error(t, - VerifySignatures( - src, - newSignatureKeyPair(&sk.PublicKey, sig), - ), - ) - - // restore the signature - sig[0]-- - - // empty data source - require.EqualError(t, - VerifySignatures(nil, nil), - ErrNilSignedDataSource.Error(), - ) - -} - -func TestVerifyAccumulatedSignatures(t *testing.T) { - // nil signature source - require.EqualError(t, - VerifyAccumulatedSignatures(nil), - ErrNilSignatureKeySource.Error(), - ) - - // create test private key - sk := test.DecodeKey(0) - - signKey := new(RequestVerificationHeader_Signature) - signKey.Peer = crypto.MarshalPublicKey(&sk.PublicKey) - - // create signature source - src := &testSignedDataSrc{ - data: testData(t, 10), - - signKeys: []SignKeyPair{signKey}, - } - - var err error - - // calculate a signature - signKey.Sign, err = crypto.Sign(sk, src.data) - require.NoError(t, err) - - // ascertain that verification is passed - require.NoError(t, VerifyAccumulatedSignatures(src)) - - // break the signature - signKey.Sign[0]++ - - // ascertain that verification is failed - require.Error(t, VerifyAccumulatedSignatures(src)) -} - -func TestVerifySignatureWithKey(t *testing.T) { - // nil signature source - require.EqualError(t, - VerifySignatureWithKey(nil, nil), - ErrEmptyDataWithSignature.Error(), - ) - - signKey := new(RequestVerificationHeader_Signature) - - // create test signature source - src := &testSignedDataSrc{ - data: testData(t, 10), - - signKeys: []SignKeyPair{signKey}, - } - - // nil public key - require.EqualError(t, - VerifySignatureWithKey(nil, src), - crypto.ErrEmptyPublicKey.Error(), - ) - - // create test private key - sk := test.DecodeKey(0) - - var err error - - // calculate a signature - signKey.Sign, err = crypto.Sign(sk, src.data) - require.NoError(t, err) - - // ascertain that verification is passed - require.NoError(t, VerifySignatureWithKey(&sk.PublicKey, src)) - - // break the signature - signKey.Sign[0]++ - - // ascertain that verification is failed - require.Error(t, VerifySignatureWithKey(&sk.PublicKey, src)) -} - -func TestSignVerifyRequestData(t *testing.T) { - // sign with empty RequestSignedData - require.EqualError(t, - SignRequestData(nil, nil), - ErrNilRequestSignedData.Error(), - ) - - // verify with empty RequestVerifyData - require.EqualError(t, - VerifyRequestData(nil), - ErrNilRequestVerifyData.Error(), - ) - - // create test session token - var ( - token = new(Token) - initVerb = Token_Info_Verb(1) - - bearer = new(BearerTokenMsg) - bearerEpoch = uint64(8) - - extHdrKey = "key" - extHdr = new(RequestExtendedHeader_KV) - ) - - token.SetVerb(initVerb) - - bearer.SetExpirationEpoch(bearerEpoch) - - extHdr.SetK(extHdrKey) - - // create test data with token - src := &testSignedDataSrc{ - data: testData(t, 10), - token: token, - - bearer: bearer, - - extHdrs: []ExtendedHeader{ - wrapExtendedHeaderKV(extHdr), - }, - } - - // create test private key - sk := test.DecodeKey(0) - - // sign with private key - require.NoError(t, SignRequestData(sk, src)) - - // ascertain that verification is passed - require.NoError(t, VerifyRequestData(src)) - - // break the data - src.data[0]++ - - // ascertain that verification is failed - require.Error(t, VerifyRequestData(src)) - - // restore the data - src.data[0]-- - - // break the token - token.SetVerb(initVerb + 1) - - // ascertain that verification is failed - require.Error(t, VerifyRequestData(src)) - - // restore the token - token.SetVerb(initVerb) - - // ascertain that verification is passed - require.NoError(t, VerifyRequestData(src)) - - // break the Bearer token - bearer.SetExpirationEpoch(bearerEpoch + 1) - - // ascertain that verification is failed - require.Error(t, VerifyRequestData(src)) - - // restore the Bearer token - bearer.SetExpirationEpoch(bearerEpoch) - - // ascertain that verification is passed - require.NoError(t, VerifyRequestData(src)) - - // break the extended header - extHdr.SetK(extHdrKey + "1") - - // ascertain that verification is failed - require.Error(t, VerifyRequestData(src)) - - // restore the extended header - extHdr.SetK(extHdrKey) - - // ascertain that verification is passed - require.NoError(t, VerifyRequestData(src)) - - // wrap to data reader - rdr := &testSignedDataReader{ - testSignedDataSrc: src, - } - - // sign with private key - require.NoError(t, SignRequestData(sk, rdr)) - - // ascertain that verification is passed - require.NoError(t, VerifyRequestData(rdr)) - - if len(rdr.GetSignKeyPairs()) < 2 { - // add one more signature - require.NoError(t, SignRequestData(test.DecodeKey(1), rdr)) - } - - // change key-signature order - rdr.signKeys[0], rdr.signKeys[1] = rdr.signKeys[1], rdr.signKeys[0] - - // ascertain that verification is failed - require.Error(t, VerifyRequestData(src)) -} diff --git a/service/token.go b/service/token.go deleted file mode 100644 index 638539f..0000000 --- a/service/token.go +++ /dev/null @@ -1,265 +0,0 @@ -package service - -import ( - "crypto/ecdsa" - "encoding/binary" - "io" - - "github.com/nspcc-dev/neofs-api-go/refs" - crypto "github.com/nspcc-dev/neofs-crypto" -) - -type signAccumWithToken struct { - SignedDataSource - SignKeyPairAccumulator - SignKeyPairSource - - token SessionToken -} - -type signDataReaderWithToken struct { - SignedDataSource - SignKeyPairAccumulator - SignKeyPairSource - - rdr SignedDataReader - - token SessionToken -} - -type signedSessionToken struct { - SessionToken -} - -const verbSize = 4 - -const fixedTokenDataSize = 0 + - refs.UUIDSize + - refs.OwnerIDSize + - verbSize + - refs.UUIDSize + - refs.CIDSize + - 8 + - 8 - -var tokenEndianness = binary.BigEndian - -// GetID is an ID field getter. -func (m Token_Info) GetID() TokenID { - return m.ID -} - -// SetID is an ID field setter. -func (m *Token_Info) SetID(id TokenID) { - m.ID = id -} - -// GetOwnerID is an OwnerID field getter. -func (m Token_Info) GetOwnerID() OwnerID { - return m.OwnerID -} - -// SetOwnerID is an OwnerID field setter. -func (m *Token_Info) SetOwnerID(id OwnerID) { - m.OwnerID = id -} - -// SetVerb is a Verb field setter. -func (m *Token_Info) SetVerb(verb Token_Info_Verb) { - m.Verb = verb -} - -// GetAddress is an Address field getter. -func (m Token_Info) GetAddress() Address { - return m.Address -} - -// SetAddress is an Address field setter. -func (m *Token_Info) SetAddress(addr Address) { - m.Address = addr -} - -// CreationEpoch is a Created field getter. -func (m TokenLifetime) CreationEpoch() uint64 { - return m.Created -} - -// SetCreationEpoch is a Created field setter. -func (m *TokenLifetime) SetCreationEpoch(e uint64) { - m.Created = e -} - -// ExpirationEpoch is a ValidUntil field getter. -func (m TokenLifetime) ExpirationEpoch() uint64 { - return m.ValidUntil -} - -// SetExpirationEpoch is a ValidUntil field setter. -func (m *TokenLifetime) SetExpirationEpoch(e uint64) { - m.ValidUntil = e -} - -// SetSessionKey is a SessionKey field setter. -func (m *Token_Info) SetSessionKey(key []byte) { - m.SessionKey = key -} - -// SetOwnerKey is an OwnerKey field setter. -func (m *Token_Info) SetOwnerKey(key []byte) { - m.OwnerKey = key -} - -// SetSignature is a Signature field setter. -func (m *Token) SetSignature(sig []byte) { - m.Signature = sig -} - -// Size returns the size of a binary representation of the verb. -func (x Token_Info_Verb) Size() int { - return verbSize -} - -// Bytes returns a binary representation of the verb. -func (x Token_Info_Verb) Bytes() []byte { - data := make([]byte, verbSize) - tokenEndianness.PutUint32(data, uint32(x)) - return data -} - -// AddSignKey calls a Signature field setter and an OwnerKey field setter with corresponding arguments. -func (s signedSessionToken) AddSignKey(sig []byte, key *ecdsa.PublicKey) { - if s.SessionToken != nil { - s.SessionToken.SetSignature(sig) - - s.SessionToken.SetOwnerKey( - crypto.MarshalPublicKey(key), - ) - } -} - -// SignedData returns token information in a binary representation. -func (s signedSessionToken) SignedData() ([]byte, error) { - return SignedDataFromReader(s) -} - -// SignedDataSize returns the length of signed token information slice. -func (s signedSessionToken) SignedDataSize() int { - return tokenInfoSize(s.SessionToken) -} - -// ReadSignedData copies a binary representation of the token information to passed buffer. -// -// If buffer length is less than required, io.ErrUnexpectedEOF returns. -func (s signedSessionToken) ReadSignedData(p []byte) (int, error) { - sz := s.SignedDataSize() - if len(p) < sz { - return 0, io.ErrUnexpectedEOF - } - - copyTokenSignedData(p, s.SessionToken) - - return sz, nil -} - -// NewSignedSessionToken wraps passed SessionToken in a component suitable for signing. -// -// Result can be used in AddSignatureWithKey function. -func NewSignedSessionToken(token SessionToken) DataWithSignKeyAccumulator { - return &signedSessionToken{ - SessionToken: token, - } -} - -// NewVerifiedSessionToken wraps passed SessionToken in a component suitable for signature verification. -// -// Result can be used in VerifySignatureWithKey function. -func NewVerifiedSessionToken(token SessionToken) DataWithSignature { - return &signedSessionToken{ - SessionToken: token, - } -} - -func tokenInfoSize(v SessionKeySource) int { - if v == nil { - return 0 - } - return fixedTokenDataSize + len(v.GetSessionKey()) -} - -// Fills passed buffer with signing token information bytes. -// Does not check buffer length, it is understood that enough space is allocated in it. -// -// If passed SessionTokenInfo, buffer remains unchanged. -func copyTokenSignedData(buf []byte, token SessionTokenInfo) { - if token == nil { - return - } - - var off int - - off += copy(buf[off:], token.GetID().Bytes()) - - off += copy(buf[off:], token.GetOwnerID().Bytes()) - - off += copy(buf[off:], token.GetVerb().Bytes()) - - addr := token.GetAddress() - off += copy(buf[off:], addr.CID.Bytes()) - off += copy(buf[off:], addr.ObjectID.Bytes()) - - tokenEndianness.PutUint64(buf[off:], token.CreationEpoch()) - off += 8 - - tokenEndianness.PutUint64(buf[off:], token.ExpirationEpoch()) - off += 8 - - copy(buf[off:], token.GetSessionKey()) -} - -// SignedData concatenates signed data with session token information. Returns concatenation result. -// -// Token bytes are added if and only if token is not nil. -func (s signAccumWithToken) SignedData() ([]byte, error) { - data, err := s.SignedDataSource.SignedData() - if err != nil { - return nil, err - } - - tokenData := make([]byte, tokenInfoSize(s.token)) - - copyTokenSignedData(tokenData, s.token) - - return append(data, tokenData...), nil -} - -func (s signDataReaderWithToken) SignedDataSize() int { - sz := s.rdr.SignedDataSize() - if sz < 0 { - return -1 - } - - sz += tokenInfoSize(s.token) - - return sz -} - -func (s signDataReaderWithToken) ReadSignedData(p []byte) (int, error) { - dataSize := s.rdr.SignedDataSize() - if dataSize < 0 { - return 0, ErrNegativeLength - } - - sumSize := dataSize + tokenInfoSize(s.token) - - if len(p) < sumSize { - return 0, io.ErrUnexpectedEOF - } - - if n, err := s.rdr.ReadSignedData(p); err != nil { - return n, err - } - - copyTokenSignedData(p[dataSize:], s.token) - - return sumSize, nil -} diff --git a/service/token_test.go b/service/token_test.go deleted file mode 100644 index 4fb430a..0000000 --- a/service/token_test.go +++ /dev/null @@ -1,248 +0,0 @@ -package service - -import ( - "crypto/rand" - "testing" - - "github.com/nspcc-dev/neofs-api-go/refs" - crypto "github.com/nspcc-dev/neofs-crypto" - "github.com/nspcc-dev/neofs-crypto/test" - "github.com/stretchr/testify/require" -) - -func TestTokenGettersSetters(t *testing.T) { - var tok SessionToken = new(Token) - - { // ID - id, err := refs.NewUUID() - require.NoError(t, err) - - tok.SetID(id) - - require.Equal(t, id, tok.GetID()) - } - - { // OwnerID - ownerID := OwnerID{} - _, err := rand.Read(ownerID[:]) - require.NoError(t, err) - - tok.SetOwnerID(ownerID) - - require.Equal(t, ownerID, tok.GetOwnerID()) - } - - { // Verb - verb := Token_Info_Verb(3) - - tok.SetVerb(verb) - - require.Equal(t, verb, tok.GetVerb()) - } - - { // Address - addr := Address{} - _, err := rand.Read(addr.CID[:]) - require.NoError(t, err) - _, err = rand.Read(addr.ObjectID[:]) - require.NoError(t, err) - - tok.SetAddress(addr) - - require.Equal(t, addr, tok.GetAddress()) - } - - { // Created - e := uint64(5) - - tok.SetCreationEpoch(e) - - require.Equal(t, e, tok.CreationEpoch()) - } - - { // ValidUntil - e := uint64(5) - - tok.SetExpirationEpoch(e) - - require.Equal(t, e, tok.ExpirationEpoch()) - } - - { // SessionKey - key := make([]byte, 10) - _, err := rand.Read(key) - require.NoError(t, err) - - tok.SetSessionKey(key) - - require.Equal(t, key, tok.GetSessionKey()) - } - - { // Signature - sig := make([]byte, 10) - _, err := rand.Read(sig) - require.NoError(t, err) - - tok.SetSignature(sig) - - require.Equal(t, sig, tok.GetSignature()) - } -} - -func TestSignToken(t *testing.T) { - var token SessionToken = new(Token) - - // create private key for signing - sk := test.DecodeKey(0) - pk := &sk.PublicKey - - id := TokenID{} - _, err := rand.Read(id[:]) - require.NoError(t, err) - token.SetID(id) - - ownerID := OwnerID{} - _, err = rand.Read(ownerID[:]) - require.NoError(t, err) - token.SetOwnerID(ownerID) - - verb := Token_Info_Verb(1) - token.SetVerb(verb) - - addr := Address{} - _, err = rand.Read(addr.ObjectID[:]) - require.NoError(t, err) - _, err = rand.Read(addr.CID[:]) - require.NoError(t, err) - token.SetAddress(addr) - - cEpoch := uint64(1) - token.SetCreationEpoch(cEpoch) - - fEpoch := uint64(2) - token.SetExpirationEpoch(fEpoch) - - sessionKey := make([]byte, 10) - _, err = rand.Read(sessionKey[:]) - require.NoError(t, err) - token.SetSessionKey(sessionKey) - - signedToken := NewSignedSessionToken(token) - verifiedToken := NewVerifiedSessionToken(token) - - // sign and verify token - require.NoError(t, AddSignatureWithKey(sk, signedToken)) - require.NoError(t, VerifySignatureWithKey(pk, verifiedToken)) - - items := []struct { - corrupt func() - restore func() - }{ - { // ID - corrupt: func() { - id[0]++ - token.SetID(id) - }, - restore: func() { - id[0]-- - token.SetID(id) - }, - }, - { // Owner ID - corrupt: func() { - ownerID[0]++ - token.SetOwnerID(ownerID) - }, - restore: func() { - ownerID[0]-- - token.SetOwnerID(ownerID) - }, - }, - { // Verb - corrupt: func() { - token.SetVerb(verb + 1) - }, - restore: func() { - token.SetVerb(verb) - }, - }, - { // ObjectID - corrupt: func() { - addr.ObjectID[0]++ - token.SetAddress(addr) - }, - restore: func() { - addr.ObjectID[0]-- - token.SetAddress(addr) - }, - }, - { // CID - corrupt: func() { - addr.CID[0]++ - token.SetAddress(addr) - }, - restore: func() { - addr.CID[0]-- - token.SetAddress(addr) - }, - }, - { // Creation epoch - corrupt: func() { - token.SetCreationEpoch(cEpoch + 1) - }, - restore: func() { - token.SetCreationEpoch(cEpoch) - }, - }, - { // Expiration epoch - corrupt: func() { - token.SetExpirationEpoch(fEpoch + 1) - }, - restore: func() { - token.SetExpirationEpoch(fEpoch) - }, - }, - { // Session key - corrupt: func() { - sessionKey[0]++ - token.SetSessionKey(sessionKey) - }, - restore: func() { - sessionKey[0]-- - token.SetSessionKey(sessionKey) - }, - }, - } - - for _, v := range items { - v.corrupt() - require.Error(t, VerifySignatureWithKey(pk, verifiedToken)) - v.restore() - require.NoError(t, VerifySignatureWithKey(pk, verifiedToken)) - } -} - -func TestSignedSessionToken_AddSignKey(t *testing.T) { - // nil SessionToken - s := new(signedSessionToken) - - require.NotPanics(t, func() { - s.AddSignKey(nil, nil) - }) - - // create test public key and signature - pk := &test.DecodeKey(0).PublicKey - sig := []byte{1, 2, 3} - - s.SessionToken = new(Token) - - // add key-signature pair to SessionToken - s.AddSignKey(sig, pk) - - require.Equal(t, sig, s.GetSignature()) - - require.Equal(t, - crypto.MarshalPublicKey(pk), - s.GetOwnerKey(), - ) -} diff --git a/service/ttl.go b/service/ttl.go deleted file mode 100644 index 28a5092..0000000 --- a/service/ttl.go +++ /dev/null @@ -1,63 +0,0 @@ -package service - -import ( - "github.com/pkg/errors" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" -) - -// TTL constants. -const ( - // ZeroTTL is an upper bound of invalid TTL values. - ZeroTTL = iota - - // NonForwardingTTL is a TTL value that does not imply a request forwarding. - NonForwardingTTL - - // SingleForwardingTTL is a TTL value that imply potential forwarding with NonForwardingTTL. - SingleForwardingTTL -) - -// SetTTL is a TTL field setter. -func (m *RequestMetaHeader) SetTTL(v uint32) { - m.TTL = v -} - -// IRNonForwarding condition that allows NonForwardingTTL only for IR. -func IRNonForwarding(role NodeRole) TTLCondition { - return func(ttl uint32) error { - if ttl == NonForwardingTTL && role != InnerRingNode { - return ErrInvalidTTL - } - - return nil - } -} - -// ProcessRequestTTL validates and updates requests with TTL. -func ProcessRequestTTL(req TTLContainer, cond ...TTLCondition) error { - ttl := req.GetTTL() - - if ttl == ZeroTTL { - return status.New(codes.InvalidArgument, ErrInvalidTTL.Error()).Err() - } - - for i := range cond { - if cond[i] == nil { - continue - } - - // check specific condition: - if err := cond[i](ttl); err != nil { - if st, ok := status.FromError(errors.Cause(err)); ok { - return st.Err() - } - - return status.New(codes.InvalidArgument, err.Error()).Err() - } - } - - req.SetTTL(ttl - 1) - - return nil -} diff --git a/service/ttl_test.go b/service/ttl_test.go deleted file mode 100644 index 1c982f5..0000000 --- a/service/ttl_test.go +++ /dev/null @@ -1,99 +0,0 @@ -package service - -import ( - "testing" - - "github.com/pkg/errors" - "github.com/stretchr/testify/require" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" -) - -type mockedRequest struct { - msg string - name string - code codes.Code - handler TTLCondition - RequestMetaHeader -} - -func TestMetaRequest(t *testing.T) { - tests := []mockedRequest{ - { - name: "direct to ir node", - handler: IRNonForwarding(InnerRingNode), - RequestMetaHeader: RequestMetaHeader{TTL: NonForwardingTTL}, - }, - { - code: codes.InvalidArgument, - msg: ErrInvalidTTL.Error(), - name: "direct to storage node", - handler: IRNonForwarding(StorageNode), - RequestMetaHeader: RequestMetaHeader{TTL: NonForwardingTTL}, - }, - { - msg: ErrInvalidTTL.Error(), - code: codes.InvalidArgument, - name: "zero ttl", - handler: IRNonForwarding(StorageNode), - RequestMetaHeader: RequestMetaHeader{TTL: ZeroTTL}, - }, - { - name: "default to ir node", - handler: IRNonForwarding(InnerRingNode), - RequestMetaHeader: RequestMetaHeader{TTL: SingleForwardingTTL}, - }, - { - name: "default to storage node", - handler: IRNonForwarding(StorageNode), - RequestMetaHeader: RequestMetaHeader{TTL: SingleForwardingTTL}, - }, - { - msg: "not found", - code: codes.NotFound, - name: "custom status error", - RequestMetaHeader: RequestMetaHeader{TTL: SingleForwardingTTL}, - handler: func(_ uint32) error { return status.Error(codes.NotFound, "not found") }, - }, - { - msg: "not found", - code: codes.NotFound, - name: "custom wrapped status error", - RequestMetaHeader: RequestMetaHeader{TTL: SingleForwardingTTL}, - handler: func(_ uint32) error { - err := status.Error(codes.NotFound, "not found") - err = errors.Wrap(err, "some error context") - err = errors.Wrap(err, "another error context") - return err - }, - }, - } - - for i := range tests { - tt := tests[i] - t.Run(tt.name, func(t *testing.T) { - before := tt.GetTTL() - err := ProcessRequestTTL(&tt, tt.handler) - if tt.msg != "" { - require.Errorf(t, err, tt.msg) - - state, ok := status.FromError(err) - require.True(t, ok) - require.Equal(t, tt.code, state.Code()) - require.Equal(t, tt.msg, state.Message()) - } else { - require.NoError(t, err) - require.NotEqualf(t, before, tt.GetTTL(), "ttl should be changed: %d vs %d", before, tt.GetTTL()) - } - }) - } -} - -func TestRequestMetaHeader_SetTTL(t *testing.T) { - m := new(RequestMetaHeader) - ttl := uint32(3) - - m.SetTTL(ttl) - - require.Equal(t, ttl, m.GetTTL()) -} diff --git a/service/types.go b/service/types.go deleted file mode 100644 index 785a30a..0000000 --- a/service/types.go +++ /dev/null @@ -1,317 +0,0 @@ -package service - -import ( - "crypto/ecdsa" -) - -// NodeRole to identify in Bootstrap service. -type NodeRole int32 - -// TTLCondition is a function type that used to verify that TTL values match a specific criterion. -// Nil error indicates compliance with the criterion. -type TTLCondition func(uint32) error - -// RawSource is an interface of the container of a boolean Raw value with read access. -type RawSource interface { - GetRaw() bool -} - -// RawContainer is an interface of the container of a boolean Raw value. -type RawContainer interface { - RawSource - SetRaw(bool) -} - -// VersionSource is an interface of the container of a numerical Version value with read access. -type VersionSource interface { - GetVersion() uint32 -} - -// VersionContainer is an interface of the container of a numerical Version value. -type VersionContainer interface { - VersionSource - SetVersion(uint32) -} - -// EpochSource is an interface of the container of a NeoFS epoch number with read access. -type EpochSource interface { - GetEpoch() uint64 -} - -// EpochContainer is an interface of the container of a NeoFS epoch number. -type EpochContainer interface { - EpochSource - SetEpoch(uint64) -} - -// TTLSource is an interface of the container of a numerical TTL value with read access. -type TTLSource interface { - GetTTL() uint32 -} - -// TTLContainer is an interface of the container of a numerical TTL value. -type TTLContainer interface { - TTLSource - SetTTL(uint32) -} - -// SeizedMetaHeaderContainer is an interface of container of RequestMetaHeader that can be cut and restored. -type SeizedMetaHeaderContainer interface { - CutMeta() RequestMetaHeader - RestoreMeta(RequestMetaHeader) -} - -// RequestMetaContainer is an interface of a fixed set of request meta value containers. -// Contains: -// - TTL value; -// - NeoFS epoch number; -// - Protocol version; -// - Raw toggle option. -type RequestMetaContainer interface { - TTLContainer - EpochContainer - VersionContainer - RawContainer -} - -// SeizedRequestMetaContainer is a RequestMetaContainer with seized meta. -type SeizedRequestMetaContainer interface { - RequestMetaContainer - SeizedMetaHeaderContainer -} - -// VerbSource is an interface of the container of a token verb value with read access. -type VerbSource interface { - GetVerb() Token_Info_Verb -} - -// VerbContainer is an interface of the container of a token verb value. -type VerbContainer interface { - VerbSource - SetVerb(Token_Info_Verb) -} - -// TokenIDSource is an interface of the container of a token ID value with read access. -type TokenIDSource interface { - GetID() TokenID -} - -// TokenIDContainer is an interface of the container of a token ID value. -type TokenIDContainer interface { - TokenIDSource - SetID(TokenID) -} - -// CreationEpochSource is an interface of the container of a creation epoch number with read access. -type CreationEpochSource interface { - CreationEpoch() uint64 -} - -// CreationEpochContainer is an interface of the container of a creation epoch number. -type CreationEpochContainer interface { - CreationEpochSource - SetCreationEpoch(uint64) -} - -// ExpirationEpochSource is an interface of the container of an expiration epoch number with read access. -type ExpirationEpochSource interface { - ExpirationEpoch() uint64 -} - -// ExpirationEpochContainer is an interface of the container of an expiration epoch number. -type ExpirationEpochContainer interface { - ExpirationEpochSource - SetExpirationEpoch(uint64) -} - -// LifetimeSource is an interface of the container of creation-expiration epoch pair with read access. -type LifetimeSource interface { - CreationEpochSource - ExpirationEpochSource -} - -// LifetimeContainer is an interface of the container of creation-expiration epoch pair. -type LifetimeContainer interface { - CreationEpochContainer - ExpirationEpochContainer -} - -// SessionKeySource is an interface of the container of session key bytes with read access. -type SessionKeySource interface { - GetSessionKey() []byte -} - -// SessionKeyContainer is an interface of the container of public session key bytes. -type SessionKeyContainer interface { - SessionKeySource - SetSessionKey([]byte) -} - -// SignatureSource is an interface of the container of signature bytes with read access. -type SignatureSource interface { - GetSignature() []byte -} - -// SignatureContainer is an interface of the container of signature bytes. -type SignatureContainer interface { - SignatureSource - SetSignature([]byte) -} - -// OwnerKeySource is an interface of the container of owner key bytes with read access. -type OwnerKeySource interface { - GetOwnerKey() []byte -} - -// OwnerKeyContainer is an interface of the container of owner key bytes. -type OwnerKeyContainer interface { - OwnerKeySource - SetOwnerKey([]byte) -} - -// SessionTokenSource is an interface of the container of a SessionToken with read access. -type SessionTokenSource interface { - GetSessionToken() SessionToken -} - -// SessionTokenInfo is an interface of a fixed set of token information value containers. -// Contains: -// - ID of the token; -// - ID of the token's owner; -// - verb of the session; -// - address of the session object; -// - token lifetime; -// - public session key bytes; -// - owner's public key bytes. -type SessionTokenInfo interface { - TokenIDContainer - OwnerIDContainer - VerbContainer - AddressContainer - LifetimeContainer - SessionKeyContainer - OwnerKeyContainer -} - -// SessionToken is an interface of token information and signature pair. -type SessionToken interface { - SessionTokenInfo - SignatureContainer -} - -// SignedDataSource is an interface of the container of a data for signing. -type SignedDataSource interface { - // Must return the required for signature byte slice. - // A non-nil error indicates that the data is not ready for signature. - SignedData() ([]byte, error) -} - -// SignedDataReader is an interface of signed data reader. -type SignedDataReader interface { - // Must return the minimum length of the slice for full reading. - // Must return a negative value if the length cannot be calculated. - SignedDataSize() int - - // Must behave like Read method of io.Reader and differ only in the reading of the signed data. - ReadSignedData([]byte) (int, error) -} - -// SignKeyPairAccumulator is an interface of a set of key-signature pairs with append access. -type SignKeyPairAccumulator interface { - AddSignKey([]byte, *ecdsa.PublicKey) -} - -// SignKeyPairSource is an interface of a set of key-signature pairs with read access. -type SignKeyPairSource interface { - GetSignKeyPairs() []SignKeyPair -} - -// SignKeyPair is an interface of key-signature pair with read access. -type SignKeyPair interface { - SignatureSource - GetPublicKey() *ecdsa.PublicKey -} - -// DataWithSignature is an interface of data-signature pair with read access. -type DataWithSignature interface { - SignedDataSource - SignatureSource -} - -// DataWithSignKeyAccumulator is an interface of data and key-signature accumulator pair. -type DataWithSignKeyAccumulator interface { - SignedDataSource - SignKeyPairAccumulator -} - -// DataWithSignKeySource is an interface of data and key-signature source pair. -type DataWithSignKeySource interface { - SignedDataSource - SignKeyPairSource -} - -// RequestData is an interface of the request information with read access. -type RequestData interface { - SignedDataSource - SessionTokenSource - BearerTokenSource - ExtendedHeadersSource -} - -// RequestSignedData is an interface of request information with signature write access. -type RequestSignedData interface { - RequestData - SignKeyPairAccumulator - SignKeyPairSource -} - -// RequestVerifyData is an interface of request information with signature read access. -type RequestVerifyData interface { - RequestData - SignKeyPairSource -} - -// ACLRulesSource is an interface of the container of binary extended ACL rules with read access. -type ACLRulesSource interface { - GetACLRules() []byte -} - -// ACLRulesContainer is an interface of the container of binary extended ACL rules. -type ACLRulesContainer interface { - ACLRulesSource - SetACLRules([]byte) -} - -// BearerTokenInfo is an interface of a fixed set of Bearer token information value containers. -// Contains: -// - binary extended ACL rules; -// - expiration epoch number; -// - ID of the token's owner. -type BearerTokenInfo interface { - ACLRulesContainer - ExpirationEpochContainer - OwnerIDContainer -} - -// BearerToken is an interface of Bearer token information and key-signature pair. -type BearerToken interface { - BearerTokenInfo - OwnerKeyContainer - SignatureContainer -} - -// BearerTokenSource is an interface of the container of a BearerToken with read access. -type BearerTokenSource interface { - GetBearerToken() BearerToken -} - -// ExtendedHeader is an interface of string key-value pair with read access. -type ExtendedHeader interface { - Key() string - Value() string -} - -// ExtendedHeadersSource is an interface of ExtendedHeader list with read access. -type ExtendedHeadersSource interface { - ExtendedHeaders() []ExtendedHeader -} diff --git a/service/utils.go b/service/utils.go deleted file mode 100644 index 17b23bb..0000000 --- a/service/utils.go +++ /dev/null @@ -1,18 +0,0 @@ -package service - -// SignedDataFromReader allocates buffer and reads bytes from passed reader to it. -// -// If passed SignedDataReader is nil, ErrNilSignedDataReader returns. -func SignedDataFromReader(r SignedDataReader) ([]byte, error) { - if r == nil { - return nil, ErrNilSignedDataReader - } - - data := make([]byte, r.SignedDataSize()) - - if _, err := r.ReadSignedData(data); err != nil { - return nil, err - } - - return data, nil -} diff --git a/service/utils_test.go b/service/utils_test.go deleted file mode 100644 index 60a2352..0000000 --- a/service/utils_test.go +++ /dev/null @@ -1,34 +0,0 @@ -package service - -import ( - "testing" - - "github.com/pkg/errors" - "github.com/stretchr/testify/require" -) - -func TestSignedDataFromReader(t *testing.T) { - // nil SignedDataReader - _, err := SignedDataFromReader(nil) - require.EqualError(t, err, ErrNilSignedDataReader.Error()) - - rdr := &testSignedDataReader{ - testSignedDataSrc: new(testSignedDataSrc), - } - - // make reader to return an error - rdr.err = errors.New("test error") - - _, err = SignedDataFromReader(rdr) - require.EqualError(t, err, rdr.err.Error()) - - // remove the error - rdr.err = nil - - // fill the data - rdr.data = testData(t, 10) - - res, err := SignedDataFromReader(rdr) - require.NoError(t, err) - require.Equal(t, rdr.data, res) -} diff --git a/service/verify.go b/service/verify.go deleted file mode 100644 index 2aca7cb..0000000 --- a/service/verify.go +++ /dev/null @@ -1,174 +0,0 @@ -package service - -import ( - "crypto/ecdsa" - "io" - - "github.com/gogo/protobuf/proto" - "github.com/nspcc-dev/neofs-api-go/internal" - crypto "github.com/nspcc-dev/neofs-crypto" -) - -type signKeyPairsWrapper struct { - items []SignKeyPair -} - -// GetSessionToken returns SessionToken interface of Token field. -// -// If token field value is nil, nil returns. -func (m RequestVerificationHeader) GetSessionToken() SessionToken { - if t := m.GetToken(); t != nil { - return t - } - - return nil -} - -// AddSignKey adds new element to Signatures field. -// -// Sets Sign field to passed sign. Set Peer field to marshaled passed key. -func (m *RequestVerificationHeader) AddSignKey(sign []byte, key *ecdsa.PublicKey) { - m.SetSignatures( - append( - m.GetSignatures(), - &RequestVerificationHeader_Signature{ - Sign: sign, - Peer: crypto.MarshalPublicKey(key), - }, - ), - ) -} - -// GetSignKeyPairs returns the elements of Signatures field as SignKeyPair slice. -func (m RequestVerificationHeader) GetSignKeyPairs() []SignKeyPair { - var ( - signs = m.GetSignatures() - res = make([]SignKeyPair, len(signs)) - ) - - for i := range signs { - res[i] = signs[i] - } - - return res -} - -// GetSignature returns the result of a Sign field getter. -func (m RequestVerificationHeader_Signature) GetSignature() []byte { - return m.GetSign() -} - -// GetPublicKey unmarshals and returns the result of a Peer field getter. -func (m RequestVerificationHeader_Signature) GetPublicKey() *ecdsa.PublicKey { - return crypto.UnmarshalPublicKey(m.GetPeer()) -} - -// SetSignatures replaces signatures stored in RequestVerificationHeader. -func (m *RequestVerificationHeader) SetSignatures(signatures []*RequestVerificationHeader_Signature) { - m.Signatures = signatures -} - -// SetToken is a Token field setter. -func (m *RequestVerificationHeader) SetToken(token *Token) { - m.Token = token -} - -// SetBearer is a Bearer field setter. -func (m *RequestVerificationHeader) SetBearer(v *BearerTokenMsg) { - m.Bearer = v -} - -// testCustomField for test usage only. -type testCustomField [8]uint32 - -var _ internal.Custom = (*testCustomField)(nil) - -// Reset skip, it's for test usage only. -func (t testCustomField) Reset() {} - -// ProtoMessage skip, it's for test usage only. -func (t testCustomField) ProtoMessage() {} - -// Size skip, it's for test usage only. -func (t testCustomField) Size() int { return 32 } - -// String skip, it's for test usage only. -func (t testCustomField) String() string { return "" } - -// Bytes skip, it's for test usage only. -func (t testCustomField) Bytes() []byte { return nil } - -// Unmarshal skip, it's for test usage only. -func (t testCustomField) Unmarshal(data []byte) error { return nil } - -// Empty skip, it's for test usage only. -func (t testCustomField) Empty() bool { return false } - -// UnmarshalTo skip, it's for test usage only. -func (t testCustomField) MarshalTo(data []byte) (int, error) { return 0, nil } - -// Marshal skip, it's for test usage only. -func (t testCustomField) Marshal() ([]byte, error) { return nil, nil } - -// Merge used by proto.Clone -func (t *testCustomField) Merge(src proto.Message) { - if tmp, ok := src.(*testCustomField); ok { - *t = *tmp - } -} - -// GetBearerToken wraps Bearer field and return BearerToken interface. -// -// If Bearer field value is nil, nil returns. -func (m RequestVerificationHeader) GetBearerToken() BearerToken { - if t := m.GetBearer(); t != nil { - return t - } - - return nil -} - -// SignKeyPairsSignedData wraps passed SignKeyPair slice and returns SignedDataSource interface. -func SignKeyPairsSignedData(v ...SignKeyPair) SignedDataSource { - return &signKeyPairsWrapper{ - items: v, - } -} - -// SignedData returns signed SignKeyPair slice in a binary representation. -func (s signKeyPairsWrapper) SignedData() ([]byte, error) { - return SignedDataFromReader(s) -} - -// SignedDataSize returns the length of signed SignKeyPair slice. -func (s signKeyPairsWrapper) SignedDataSize() (sz int) { - for i := range s.items { - // add key length - sz += len( - crypto.MarshalPublicKey(s.items[i].GetPublicKey()), - ) - } - - return -} - -// ReadSignedData copies a binary representation of the signed SignKeyPair slice to passed buffer. -// -// If buffer length is less than required, io.ErrUnexpectedEOF returns. -func (s signKeyPairsWrapper) ReadSignedData(p []byte) (int, error) { - sz := s.SignedDataSize() - if len(p) < sz { - return 0, io.ErrUnexpectedEOF - } - - off := 0 - - for i := range s.items { - // copy public key bytes - off += copy(p[off:], crypto.MarshalPublicKey( - s.items[i].GetPublicKey(), - )) - } - - return off, nil -} diff --git a/service/verify.pb.go b/service/verify.pb.go deleted file mode 100644 index 02f3f39..0000000 --- a/service/verify.pb.go +++ /dev/null @@ -1,2225 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: service/verify.proto - -package service - -import ( - fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/golang/protobuf/proto" - _ "github.com/nspcc-dev/neofs-api-go/refs" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package - -// Verb is an enumeration of session request types -type Token_Info_Verb int32 - -const ( - // Put refers to object.Put RPC call - Token_Info_Put Token_Info_Verb = 0 - // Get refers to object.Get RPC call - Token_Info_Get Token_Info_Verb = 1 - // Head refers to object.Head RPC call - Token_Info_Head Token_Info_Verb = 2 - // Search refers to object.Search RPC call - Token_Info_Search Token_Info_Verb = 3 - // Delete refers to object.Delete RPC call - Token_Info_Delete Token_Info_Verb = 4 - // Range refers to object.GetRange RPC call - Token_Info_Range Token_Info_Verb = 5 - // RangeHash refers to object.GetRangeHash RPC call - Token_Info_RangeHash Token_Info_Verb = 6 -) - -var Token_Info_Verb_name = map[int32]string{ - 0: "Put", - 1: "Get", - 2: "Head", - 3: "Search", - 4: "Delete", - 5: "Range", - 6: "RangeHash", -} - -var Token_Info_Verb_value = map[string]int32{ - "Put": 0, - "Get": 1, - "Head": 2, - "Search": 3, - "Delete": 4, - "Range": 5, - "RangeHash": 6, -} - -func (x Token_Info_Verb) String() string { - return proto.EnumName(Token_Info_Verb_name, int32(x)) -} - -func (Token_Info_Verb) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_4bdd5bc50ec96238, []int{1, 0, 0} -} - -// RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request -// (should be embedded into message). -type RequestVerificationHeader struct { - // Signatures is a set of signatures of every passed NeoFS Node - Signatures []*RequestVerificationHeader_Signature `protobuf:"bytes,1,rep,name=Signatures,proto3" json:"Signatures,omitempty"` - // Token is a token of the session within which the request is sent - Token *Token `protobuf:"bytes,2,opt,name=Token,proto3" json:"Token,omitempty"` - // Bearer is a Bearer token of the request - Bearer *BearerTokenMsg `protobuf:"bytes,3,opt,name=Bearer,proto3" json:"Bearer,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *RequestVerificationHeader) Reset() { *m = RequestVerificationHeader{} } -func (m *RequestVerificationHeader) String() string { return proto.CompactTextString(m) } -func (*RequestVerificationHeader) ProtoMessage() {} -func (*RequestVerificationHeader) Descriptor() ([]byte, []int) { - return fileDescriptor_4bdd5bc50ec96238, []int{0} -} -func (m *RequestVerificationHeader) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *RequestVerificationHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *RequestVerificationHeader) XXX_Merge(src proto.Message) { - xxx_messageInfo_RequestVerificationHeader.Merge(m, src) -} -func (m *RequestVerificationHeader) XXX_Size() int { - return m.Size() -} -func (m *RequestVerificationHeader) XXX_DiscardUnknown() { - xxx_messageInfo_RequestVerificationHeader.DiscardUnknown(m) -} - -var xxx_messageInfo_RequestVerificationHeader proto.InternalMessageInfo - -func (m *RequestVerificationHeader) GetSignatures() []*RequestVerificationHeader_Signature { - if m != nil { - return m.Signatures - } - return nil -} - -func (m *RequestVerificationHeader) GetToken() *Token { - if m != nil { - return m.Token - } - return nil -} - -func (m *RequestVerificationHeader) GetBearer() *BearerTokenMsg { - if m != nil { - return m.Bearer - } - return nil -} - -type RequestVerificationHeader_Signature struct { - // Sign is signature of the request or session key. - Sign []byte `protobuf:"bytes,1,opt,name=Sign,proto3" json:"Sign,omitempty"` - // Peer is compressed public key used for signature. - Peer []byte `protobuf:"bytes,2,opt,name=Peer,proto3" json:"Peer,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *RequestVerificationHeader_Signature) Reset() { *m = RequestVerificationHeader_Signature{} } -func (m *RequestVerificationHeader_Signature) String() string { return proto.CompactTextString(m) } -func (*RequestVerificationHeader_Signature) ProtoMessage() {} -func (*RequestVerificationHeader_Signature) Descriptor() ([]byte, []int) { - return fileDescriptor_4bdd5bc50ec96238, []int{0, 0} -} -func (m *RequestVerificationHeader_Signature) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *RequestVerificationHeader_Signature) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *RequestVerificationHeader_Signature) XXX_Merge(src proto.Message) { - xxx_messageInfo_RequestVerificationHeader_Signature.Merge(m, src) -} -func (m *RequestVerificationHeader_Signature) XXX_Size() int { - return m.Size() -} -func (m *RequestVerificationHeader_Signature) XXX_DiscardUnknown() { - xxx_messageInfo_RequestVerificationHeader_Signature.DiscardUnknown(m) -} - -var xxx_messageInfo_RequestVerificationHeader_Signature proto.InternalMessageInfo - -func (m *RequestVerificationHeader_Signature) GetSign() []byte { - if m != nil { - return m.Sign - } - return nil -} - -func (m *RequestVerificationHeader_Signature) GetPeer() []byte { - if m != nil { - return m.Peer - } - return nil -} - -// User token granting rights for object manipulation -type Token struct { - // TokenInfo is a grouped information about token - Token_Info `protobuf:"bytes,1,opt,name=TokenInfo,proto3,embedded=TokenInfo" json:"TokenInfo"` - // Signature is a signature of session token information - Signature []byte `protobuf:"bytes,8,opt,name=Signature,proto3" json:"Signature,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Token) Reset() { *m = Token{} } -func (m *Token) String() string { return proto.CompactTextString(m) } -func (*Token) ProtoMessage() {} -func (*Token) Descriptor() ([]byte, []int) { - return fileDescriptor_4bdd5bc50ec96238, []int{1} -} -func (m *Token) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Token) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *Token) XXX_Merge(src proto.Message) { - xxx_messageInfo_Token.Merge(m, src) -} -func (m *Token) XXX_Size() int { - return m.Size() -} -func (m *Token) XXX_DiscardUnknown() { - xxx_messageInfo_Token.DiscardUnknown(m) -} - -var xxx_messageInfo_Token proto.InternalMessageInfo - -func (m *Token) GetSignature() []byte { - if m != nil { - return m.Signature - } - return nil -} - -type Token_Info struct { - // ID is a token identifier. valid UUIDv4 represented in bytes - ID TokenID `protobuf:"bytes,1,opt,name=ID,proto3,customtype=TokenID" json:"ID"` - // OwnerID is an owner of manipulation object - OwnerID OwnerID `protobuf:"bytes,2,opt,name=OwnerID,proto3,customtype=OwnerID" json:"OwnerID"` - // Verb is a type of request for which the token is issued - Verb Token_Info_Verb `protobuf:"varint,3,opt,name=verb,proto3,enum=service.Token_Info_Verb" json:"verb,omitempty"` - // Address is an object address for which token is issued - Address Address `protobuf:"bytes,4,opt,name=Address,proto3,customtype=Address" json:"Address"` - // Lifetime is a lifetime of the session - TokenLifetime `protobuf:"bytes,5,opt,name=Lifetime,proto3,embedded=Lifetime" json:"Lifetime"` - // SessionKey is a public key of session key - SessionKey []byte `protobuf:"bytes,6,opt,name=SessionKey,proto3" json:"SessionKey,omitempty"` - // OwnerKey is a public key of the token owner - OwnerKey []byte `protobuf:"bytes,7,opt,name=OwnerKey,proto3" json:"OwnerKey,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Token_Info) Reset() { *m = Token_Info{} } -func (m *Token_Info) String() string { return proto.CompactTextString(m) } -func (*Token_Info) ProtoMessage() {} -func (*Token_Info) Descriptor() ([]byte, []int) { - return fileDescriptor_4bdd5bc50ec96238, []int{1, 0} -} -func (m *Token_Info) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Token_Info) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *Token_Info) XXX_Merge(src proto.Message) { - xxx_messageInfo_Token_Info.Merge(m, src) -} -func (m *Token_Info) XXX_Size() int { - return m.Size() -} -func (m *Token_Info) XXX_DiscardUnknown() { - xxx_messageInfo_Token_Info.DiscardUnknown(m) -} - -var xxx_messageInfo_Token_Info proto.InternalMessageInfo - -func (m *Token_Info) GetVerb() Token_Info_Verb { - if m != nil { - return m.Verb - } - return Token_Info_Put -} - -func (m *Token_Info) GetSessionKey() []byte { - if m != nil { - return m.SessionKey - } - return nil -} - -func (m *Token_Info) GetOwnerKey() []byte { - if m != nil { - return m.OwnerKey - } - return nil -} - -// TokenLifetime carries a group of lifetime parameters of the token -type TokenLifetime struct { - // Created carries an initial epoch of token lifetime - Created uint64 `protobuf:"varint,1,opt,name=Created,proto3" json:"Created,omitempty"` - // ValidUntil carries a last epoch of token lifetime - ValidUntil uint64 `protobuf:"varint,2,opt,name=ValidUntil,proto3" json:"ValidUntil,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *TokenLifetime) Reset() { *m = TokenLifetime{} } -func (m *TokenLifetime) String() string { return proto.CompactTextString(m) } -func (*TokenLifetime) ProtoMessage() {} -func (*TokenLifetime) Descriptor() ([]byte, []int) { - return fileDescriptor_4bdd5bc50ec96238, []int{2} -} -func (m *TokenLifetime) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *TokenLifetime) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *TokenLifetime) XXX_Merge(src proto.Message) { - xxx_messageInfo_TokenLifetime.Merge(m, src) -} -func (m *TokenLifetime) XXX_Size() int { - return m.Size() -} -func (m *TokenLifetime) XXX_DiscardUnknown() { - xxx_messageInfo_TokenLifetime.DiscardUnknown(m) -} - -var xxx_messageInfo_TokenLifetime proto.InternalMessageInfo - -func (m *TokenLifetime) GetCreated() uint64 { - if m != nil { - return m.Created - } - return 0 -} - -func (m *TokenLifetime) GetValidUntil() uint64 { - if m != nil { - return m.ValidUntil - } - return 0 -} - -// BearerTokenMsg carries information about request ACL rules with limited lifetime -type BearerTokenMsg struct { - // TokenInfo is a grouped information about token - BearerTokenMsg_Info `protobuf:"bytes,1,opt,name=TokenInfo,proto3,embedded=TokenInfo" json:"TokenInfo"` - // OwnerKey is a public key of the token owner - OwnerKey []byte `protobuf:"bytes,2,opt,name=OwnerKey,proto3" json:"OwnerKey,omitempty"` - // Signature is a signature of token information - Signature []byte `protobuf:"bytes,3,opt,name=Signature,proto3" json:"Signature,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *BearerTokenMsg) Reset() { *m = BearerTokenMsg{} } -func (m *BearerTokenMsg) String() string { return proto.CompactTextString(m) } -func (*BearerTokenMsg) ProtoMessage() {} -func (*BearerTokenMsg) Descriptor() ([]byte, []int) { - return fileDescriptor_4bdd5bc50ec96238, []int{3} -} -func (m *BearerTokenMsg) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *BearerTokenMsg) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *BearerTokenMsg) XXX_Merge(src proto.Message) { - xxx_messageInfo_BearerTokenMsg.Merge(m, src) -} -func (m *BearerTokenMsg) XXX_Size() int { - return m.Size() -} -func (m *BearerTokenMsg) XXX_DiscardUnknown() { - xxx_messageInfo_BearerTokenMsg.DiscardUnknown(m) -} - -var xxx_messageInfo_BearerTokenMsg proto.InternalMessageInfo - -func (m *BearerTokenMsg) GetOwnerKey() []byte { - if m != nil { - return m.OwnerKey - } - return nil -} - -func (m *BearerTokenMsg) GetSignature() []byte { - if m != nil { - return m.Signature - } - return nil -} - -type BearerTokenMsg_Info struct { - // ACLRules carries a binary representation of the table of extended ACL rules - ACLRules []byte `protobuf:"bytes,1,opt,name=ACLRules,proto3" json:"ACLRules,omitempty"` - // OwnerID is an owner of token - OwnerID OwnerID `protobuf:"bytes,2,opt,name=OwnerID,proto3,customtype=OwnerID" json:"OwnerID"` - // ValidUntil carries a last epoch of token lifetime - ValidUntil uint64 `protobuf:"varint,3,opt,name=ValidUntil,proto3" json:"ValidUntil,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *BearerTokenMsg_Info) Reset() { *m = BearerTokenMsg_Info{} } -func (m *BearerTokenMsg_Info) String() string { return proto.CompactTextString(m) } -func (*BearerTokenMsg_Info) ProtoMessage() {} -func (*BearerTokenMsg_Info) Descriptor() ([]byte, []int) { - return fileDescriptor_4bdd5bc50ec96238, []int{3, 0} -} -func (m *BearerTokenMsg_Info) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *BearerTokenMsg_Info) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *BearerTokenMsg_Info) XXX_Merge(src proto.Message) { - xxx_messageInfo_BearerTokenMsg_Info.Merge(m, src) -} -func (m *BearerTokenMsg_Info) XXX_Size() int { - return m.Size() -} -func (m *BearerTokenMsg_Info) XXX_DiscardUnknown() { - xxx_messageInfo_BearerTokenMsg_Info.DiscardUnknown(m) -} - -var xxx_messageInfo_BearerTokenMsg_Info proto.InternalMessageInfo - -func (m *BearerTokenMsg_Info) GetACLRules() []byte { - if m != nil { - return m.ACLRules - } - return nil -} - -func (m *BearerTokenMsg_Info) GetValidUntil() uint64 { - if m != nil { - return m.ValidUntil - } - return 0 -} - -func init() { - proto.RegisterEnum("service.Token_Info_Verb", Token_Info_Verb_name, Token_Info_Verb_value) - proto.RegisterType((*RequestVerificationHeader)(nil), "service.RequestVerificationHeader") - proto.RegisterType((*RequestVerificationHeader_Signature)(nil), "service.RequestVerificationHeader.Signature") - proto.RegisterType((*Token)(nil), "service.Token") - proto.RegisterType((*Token_Info)(nil), "service.Token.Info") - proto.RegisterType((*TokenLifetime)(nil), "service.TokenLifetime") - proto.RegisterType((*BearerTokenMsg)(nil), "service.BearerTokenMsg") - proto.RegisterType((*BearerTokenMsg_Info)(nil), "service.BearerTokenMsg.Info") -} - -func init() { proto.RegisterFile("service/verify.proto", fileDescriptor_4bdd5bc50ec96238) } - -var fileDescriptor_4bdd5bc50ec96238 = []byte{ - // 658 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x54, 0xcd, 0x6e, 0xd3, 0x5a, - 0x10, 0xae, 0x63, 0x27, 0x76, 0xa6, 0x3f, 0xd7, 0xf7, 0xdc, 0xab, 0x7b, 0x4d, 0x54, 0x25, 0x55, - 0xc4, 0xa2, 0x95, 0x88, 0x2d, 0xa5, 0x12, 0x42, 0x82, 0x4d, 0xd3, 0x08, 0x1a, 0x51, 0xa0, 0x3a, - 0x29, 0x5d, 0xb0, 0x73, 0x92, 0x89, 0x6b, 0x91, 0xda, 0xe1, 0x1c, 0x27, 0xa8, 0xef, 0xc1, 0x82, - 0x67, 0xe0, 0x49, 0xba, 0xec, 0x12, 0xb1, 0x88, 0x50, 0x78, 0x06, 0x16, 0xac, 0x40, 0x1e, 0x3b, - 0x89, 0x5d, 0x28, 0x12, 0xbb, 0x6f, 0xbe, 0xf9, 0xe6, 0xe7, 0x4c, 0xbe, 0x18, 0xfe, 0x95, 0x28, - 0xa6, 0x7e, 0x1f, 0x9d, 0x29, 0x0a, 0x7f, 0x78, 0x69, 0x8f, 0x45, 0x18, 0x85, 0x4c, 0x4f, 0xd9, - 0x8a, 0x29, 0x70, 0x28, 0x9d, 0xe8, 0x72, 0x8c, 0x32, 0x49, 0x55, 0x1a, 0x9e, 0x1f, 0x9d, 0x4f, - 0x7a, 0x76, 0x3f, 0xbc, 0x70, 0xbc, 0xd0, 0x0b, 0x1d, 0xa2, 0x7b, 0x93, 0x21, 0x45, 0x14, 0x10, - 0x4a, 0xe4, 0xf5, 0xaf, 0x0a, 0xdc, 0xe1, 0xf8, 0x66, 0x82, 0x32, 0x3a, 0x8b, 0x27, 0xf8, 0x7d, - 0x37, 0xf2, 0xc3, 0xe0, 0x08, 0xdd, 0x01, 0x0a, 0x76, 0x0c, 0xd0, 0xf5, 0xbd, 0xc0, 0x8d, 0x26, - 0x02, 0xa5, 0xa5, 0xec, 0xa8, 0xbb, 0xeb, 0xcd, 0x7b, 0x76, 0x3a, 0xdc, 0xbe, 0xb5, 0xce, 0x5e, - 0x16, 0xf1, 0x4c, 0x3d, 0xbb, 0x0b, 0xc5, 0xd3, 0xf0, 0x35, 0x06, 0x56, 0x61, 0x47, 0xd9, 0x5d, - 0x6f, 0x6e, 0x2d, 0x1b, 0x11, 0xcb, 0x93, 0x24, 0x73, 0xa0, 0xd4, 0x42, 0x57, 0xa0, 0xb0, 0x54, - 0x92, 0xfd, 0xbf, 0x94, 0x25, 0x34, 0xa9, 0x9e, 0x49, 0x8f, 0xa7, 0xb2, 0xca, 0x3e, 0x94, 0x97, - 0x43, 0x18, 0x03, 0x2d, 0x0e, 0x2c, 0x65, 0x47, 0xd9, 0xdd, 0xe0, 0x84, 0x63, 0xee, 0x04, 0x51, - 0xd0, 0xd8, 0x0d, 0x4e, 0xb8, 0xfe, 0x4d, 0x4d, 0x97, 0x61, 0x0f, 0xa1, 0x4c, 0xa0, 0x13, 0x0c, - 0x43, 0x2a, 0x5b, 0x6f, 0xfe, 0x93, 0xdf, 0xcc, 0x8e, 0x53, 0x2d, 0xe3, 0x6a, 0x56, 0x5b, 0xbb, - 0x9e, 0xd5, 0x14, 0xbe, 0xd2, 0xb3, 0xed, 0xcc, 0x6c, 0xcb, 0xa0, 0xfe, 0x2b, 0xa2, 0xf2, 0x4e, - 0x05, 0x8d, 0x64, 0x35, 0x28, 0x74, 0xda, 0xc9, 0x4e, 0xad, 0xbf, 0xe2, 0x3e, 0x9f, 0x66, 0x35, - 0x3d, 0xe9, 0xd2, 0xe6, 0x85, 0x4e, 0x9b, 0xed, 0x81, 0xfe, 0xe2, 0x6d, 0x80, 0xa2, 0xd3, 0x4e, - 0xb6, 0x5c, 0xa9, 0x52, 0x9a, 0x2f, 0x00, 0xbb, 0x0f, 0xda, 0x14, 0x45, 0x8f, 0xae, 0xb3, 0xd5, - 0xb4, 0x7e, 0xb1, 0xaa, 0x7d, 0x86, 0xa2, 0xd7, 0x32, 0xe6, 0xb3, 0x9a, 0x16, 0x23, 0x4e, 0x7a, - 0xf6, 0x00, 0xf4, 0x83, 0xc1, 0x40, 0xa0, 0x94, 0x96, 0x46, 0xaf, 0xdc, 0xb4, 0x63, 0xf3, 0xd8, - 0x29, 0xb9, 0x9a, 0x98, 0x12, 0x7c, 0x01, 0xd8, 0x23, 0x30, 0x8e, 0xfd, 0x21, 0x46, 0xfe, 0x05, - 0x5a, 0x45, 0x2a, 0xfd, 0x2f, 0x3f, 0x75, 0x91, 0xcd, 0xdc, 0x68, 0x59, 0xc1, 0xaa, 0x00, 0x5d, - 0x94, 0xd2, 0x0f, 0x83, 0xa7, 0x78, 0x69, 0x95, 0xe8, 0x46, 0x19, 0x86, 0x55, 0xc0, 0xa0, 0xa7, - 0xc5, 0x59, 0x9d, 0xb2, 0xcb, 0xb8, 0x7e, 0x0a, 0xf4, 0x02, 0xa6, 0x83, 0x7a, 0x32, 0x89, 0xcc, - 0xb5, 0x18, 0x3c, 0xc1, 0xc8, 0x54, 0x98, 0x01, 0x5a, 0xec, 0x35, 0xb3, 0xc0, 0x00, 0x4a, 0x5d, - 0x74, 0x45, 0xff, 0xdc, 0x54, 0x63, 0xdc, 0xc6, 0x11, 0x46, 0x68, 0x6a, 0xac, 0x0c, 0x45, 0xee, - 0x06, 0x1e, 0x9a, 0x45, 0xb6, 0x09, 0x65, 0x82, 0x47, 0xae, 0x3c, 0x37, 0x4b, 0xf5, 0x0e, 0x6c, - 0xe6, 0xd6, 0x66, 0x16, 0xe8, 0x87, 0x02, 0xdd, 0x08, 0x07, 0xf4, 0x1b, 0x69, 0x7c, 0x11, 0xc6, - 0xcb, 0x9f, 0xb9, 0x23, 0x7f, 0xf0, 0x32, 0x88, 0xfc, 0x11, 0xfd, 0x34, 0x1a, 0xcf, 0x30, 0xf5, - 0xef, 0x0a, 0x6c, 0xe5, 0x6d, 0xc9, 0xda, 0x3f, 0xfb, 0x69, 0xfb, 0x16, 0x0b, 0xff, 0xc6, 0x58, - 0xd9, 0xab, 0x14, 0xf2, 0x57, 0xc9, 0x9b, 0x4e, 0xbd, 0x69, 0xba, 0x8b, 0xd4, 0x73, 0x15, 0x30, - 0x0e, 0x0e, 0x8f, 0xf9, 0x64, 0x44, 0xff, 0x5c, 0xea, 0xb0, 0x88, 0xff, 0xc4, 0x6e, 0xf9, 0x0b, - 0xa8, 0x37, 0x2f, 0xd0, 0xea, 0x5e, 0xcd, 0xab, 0xca, 0xf5, 0xbc, 0xaa, 0x7c, 0x9c, 0x57, 0x95, - 0xcf, 0xf3, 0xaa, 0xf2, 0xfe, 0x4b, 0x75, 0xed, 0xd5, 0x5e, 0xe6, 0x2b, 0x14, 0xc8, 0x71, 0xbf, - 0xdf, 0x18, 0xe0, 0xd4, 0x09, 0x30, 0x1c, 0xca, 0x86, 0x3b, 0xf6, 0x1b, 0x5e, 0xe8, 0xa4, 0x27, - 0xf9, 0x50, 0xf8, 0xfb, 0x39, 0x86, 0x8f, 0xbb, 0xf6, 0xc1, 0x49, 0xc7, 0xee, 0x26, 0x5c, 0xaf, - 0x44, 0x1f, 0xa7, 0xfd, 0x1f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x3b, 0x49, 0xb9, 0x3e, 0xfe, 0x04, - 0x00, 0x00, -} - -func (m *RequestVerificationHeader) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *RequestVerificationHeader) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *RequestVerificationHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.Bearer != nil { - { - size, err := m.Bearer.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintVerify(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if m.Token != nil { - { - size, err := m.Token.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintVerify(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if len(m.Signatures) > 0 { - for iNdEx := len(m.Signatures) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Signatures[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintVerify(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *RequestVerificationHeader_Signature) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *RequestVerificationHeader_Signature) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *RequestVerificationHeader_Signature) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.Peer) > 0 { - i -= len(m.Peer) - copy(dAtA[i:], m.Peer) - i = encodeVarintVerify(dAtA, i, uint64(len(m.Peer))) - i-- - dAtA[i] = 0x12 - } - if len(m.Sign) > 0 { - i -= len(m.Sign) - copy(dAtA[i:], m.Sign) - i = encodeVarintVerify(dAtA, i, uint64(len(m.Sign))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Token) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Token) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Token) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.Signature) > 0 { - i -= len(m.Signature) - copy(dAtA[i:], m.Signature) - i = encodeVarintVerify(dAtA, i, uint64(len(m.Signature))) - i-- - dAtA[i] = 0x42 - } - { - size, err := m.Token_Info.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintVerify(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *Token_Info) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Token_Info) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Token_Info) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.OwnerKey) > 0 { - i -= len(m.OwnerKey) - copy(dAtA[i:], m.OwnerKey) - i = encodeVarintVerify(dAtA, i, uint64(len(m.OwnerKey))) - i-- - dAtA[i] = 0x3a - } - if len(m.SessionKey) > 0 { - i -= len(m.SessionKey) - copy(dAtA[i:], m.SessionKey) - i = encodeVarintVerify(dAtA, i, uint64(len(m.SessionKey))) - i-- - dAtA[i] = 0x32 - } - { - size, err := m.TokenLifetime.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintVerify(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2a - { - size := m.Address.Size() - i -= size - if _, err := m.Address.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintVerify(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - if m.Verb != 0 { - i = encodeVarintVerify(dAtA, i, uint64(m.Verb)) - i-- - dAtA[i] = 0x18 - } - { - size := m.OwnerID.Size() - i -= size - if _, err := m.OwnerID.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintVerify(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size := m.ID.Size() - i -= size - if _, err := m.ID.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintVerify(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *TokenLifetime) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *TokenLifetime) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *TokenLifetime) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.ValidUntil != 0 { - i = encodeVarintVerify(dAtA, i, uint64(m.ValidUntil)) - i-- - dAtA[i] = 0x10 - } - if m.Created != 0 { - i = encodeVarintVerify(dAtA, i, uint64(m.Created)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *BearerTokenMsg) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *BearerTokenMsg) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *BearerTokenMsg) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.Signature) > 0 { - i -= len(m.Signature) - copy(dAtA[i:], m.Signature) - i = encodeVarintVerify(dAtA, i, uint64(len(m.Signature))) - i-- - dAtA[i] = 0x1a - } - if len(m.OwnerKey) > 0 { - i -= len(m.OwnerKey) - copy(dAtA[i:], m.OwnerKey) - i = encodeVarintVerify(dAtA, i, uint64(len(m.OwnerKey))) - i-- - dAtA[i] = 0x12 - } - { - size, err := m.BearerTokenMsg_Info.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintVerify(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *BearerTokenMsg_Info) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *BearerTokenMsg_Info) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *BearerTokenMsg_Info) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.ValidUntil != 0 { - i = encodeVarintVerify(dAtA, i, uint64(m.ValidUntil)) - i-- - dAtA[i] = 0x18 - } - { - size := m.OwnerID.Size() - i -= size - if _, err := m.OwnerID.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintVerify(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - if len(m.ACLRules) > 0 { - i -= len(m.ACLRules) - copy(dAtA[i:], m.ACLRules) - i = encodeVarintVerify(dAtA, i, uint64(len(m.ACLRules))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func encodeVarintVerify(dAtA []byte, offset int, v uint64) int { - offset -= sovVerify(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *RequestVerificationHeader) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Signatures) > 0 { - for _, e := range m.Signatures { - l = e.Size() - n += 1 + l + sovVerify(uint64(l)) - } - } - if m.Token != nil { - l = m.Token.Size() - n += 1 + l + sovVerify(uint64(l)) - } - if m.Bearer != nil { - l = m.Bearer.Size() - n += 1 + l + sovVerify(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *RequestVerificationHeader_Signature) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Sign) - if l > 0 { - n += 1 + l + sovVerify(uint64(l)) - } - l = len(m.Peer) - if l > 0 { - n += 1 + l + sovVerify(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *Token) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Token_Info.Size() - n += 1 + l + sovVerify(uint64(l)) - l = len(m.Signature) - if l > 0 { - n += 1 + l + sovVerify(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *Token_Info) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ID.Size() - n += 1 + l + sovVerify(uint64(l)) - l = m.OwnerID.Size() - n += 1 + l + sovVerify(uint64(l)) - if m.Verb != 0 { - n += 1 + sovVerify(uint64(m.Verb)) - } - l = m.Address.Size() - n += 1 + l + sovVerify(uint64(l)) - l = m.TokenLifetime.Size() - n += 1 + l + sovVerify(uint64(l)) - l = len(m.SessionKey) - if l > 0 { - n += 1 + l + sovVerify(uint64(l)) - } - l = len(m.OwnerKey) - if l > 0 { - n += 1 + l + sovVerify(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *TokenLifetime) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Created != 0 { - n += 1 + sovVerify(uint64(m.Created)) - } - if m.ValidUntil != 0 { - n += 1 + sovVerify(uint64(m.ValidUntil)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *BearerTokenMsg) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.BearerTokenMsg_Info.Size() - n += 1 + l + sovVerify(uint64(l)) - l = len(m.OwnerKey) - if l > 0 { - n += 1 + l + sovVerify(uint64(l)) - } - l = len(m.Signature) - if l > 0 { - n += 1 + l + sovVerify(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *BearerTokenMsg_Info) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ACLRules) - if l > 0 { - n += 1 + l + sovVerify(uint64(l)) - } - l = m.OwnerID.Size() - n += 1 + l + sovVerify(uint64(l)) - if m.ValidUntil != 0 { - n += 1 + sovVerify(uint64(m.ValidUntil)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func sovVerify(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozVerify(x uint64) (n int) { - return sovVerify(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *RequestVerificationHeader) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowVerify - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: RequestVerificationHeader: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: RequestVerificationHeader: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Signatures", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowVerify - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthVerify - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthVerify - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Signatures = append(m.Signatures, &RequestVerificationHeader_Signature{}) - if err := m.Signatures[len(m.Signatures)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Token", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowVerify - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthVerify - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthVerify - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Token == nil { - m.Token = &Token{} - } - if err := m.Token.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Bearer", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowVerify - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthVerify - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthVerify - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Bearer == nil { - m.Bearer = &BearerTokenMsg{} - } - if err := m.Bearer.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipVerify(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthVerify - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthVerify - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *RequestVerificationHeader_Signature) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowVerify - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Signature: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Signature: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Sign", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowVerify - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthVerify - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthVerify - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Sign = append(m.Sign[:0], dAtA[iNdEx:postIndex]...) - if m.Sign == nil { - m.Sign = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Peer", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowVerify - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthVerify - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthVerify - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Peer = append(m.Peer[:0], dAtA[iNdEx:postIndex]...) - if m.Peer == nil { - m.Peer = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipVerify(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthVerify - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthVerify - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Token) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowVerify - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Token: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Token: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Token_Info", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowVerify - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthVerify - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthVerify - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Token_Info.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 8: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Signature", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowVerify - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthVerify - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthVerify - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Signature = append(m.Signature[:0], dAtA[iNdEx:postIndex]...) - if m.Signature == nil { - m.Signature = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipVerify(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthVerify - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthVerify - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Token_Info) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowVerify - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Info: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Info: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowVerify - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthVerify - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthVerify - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OwnerID", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowVerify - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthVerify - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthVerify - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.OwnerID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Verb", wireType) - } - m.Verb = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowVerify - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Verb |= Token_Info_Verb(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowVerify - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthVerify - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthVerify - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Address.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TokenLifetime", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowVerify - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthVerify - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthVerify - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.TokenLifetime.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SessionKey", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowVerify - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthVerify - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthVerify - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.SessionKey = append(m.SessionKey[:0], dAtA[iNdEx:postIndex]...) - if m.SessionKey == nil { - m.SessionKey = []byte{} - } - iNdEx = postIndex - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OwnerKey", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowVerify - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthVerify - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthVerify - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.OwnerKey = append(m.OwnerKey[:0], dAtA[iNdEx:postIndex]...) - if m.OwnerKey == nil { - m.OwnerKey = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipVerify(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthVerify - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthVerify - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *TokenLifetime) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowVerify - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: TokenLifetime: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: TokenLifetime: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Created", wireType) - } - m.Created = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowVerify - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Created |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ValidUntil", wireType) - } - m.ValidUntil = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowVerify - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ValidUntil |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipVerify(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthVerify - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthVerify - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *BearerTokenMsg) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowVerify - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: BearerTokenMsg: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: BearerTokenMsg: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BearerTokenMsg_Info", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowVerify - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthVerify - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthVerify - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.BearerTokenMsg_Info.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OwnerKey", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowVerify - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthVerify - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthVerify - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.OwnerKey = append(m.OwnerKey[:0], dAtA[iNdEx:postIndex]...) - if m.OwnerKey == nil { - m.OwnerKey = []byte{} - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Signature", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowVerify - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthVerify - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthVerify - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Signature = append(m.Signature[:0], dAtA[iNdEx:postIndex]...) - if m.Signature == nil { - m.Signature = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipVerify(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthVerify - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthVerify - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *BearerTokenMsg_Info) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowVerify - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Info: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Info: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ACLRules", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowVerify - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthVerify - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthVerify - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ACLRules = append(m.ACLRules[:0], dAtA[iNdEx:postIndex]...) - if m.ACLRules == nil { - m.ACLRules = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OwnerID", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowVerify - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthVerify - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthVerify - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.OwnerID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ValidUntil", wireType) - } - m.ValidUntil = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowVerify - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ValidUntil |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipVerify(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthVerify - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthVerify - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipVerify(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowVerify - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowVerify - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowVerify - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthVerify - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupVerify - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthVerify - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthVerify = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowVerify = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupVerify = fmt.Errorf("proto: unexpected end of group") -) diff --git a/service/verify.proto b/service/verify.proto deleted file mode 100644 index a7e694f..0000000 --- a/service/verify.proto +++ /dev/null @@ -1,119 +0,0 @@ -syntax = "proto3"; -package service; -option go_package = "github.com/nspcc-dev/neofs-api-go/service"; -option csharp_namespace = "NeoFS.API.Service"; - -import "refs/types.proto"; -import "github.com/gogo/protobuf/gogoproto/gogo.proto"; - -option (gogoproto.stable_marshaler_all) = true; - -// RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request -// (should be embedded into message). -message RequestVerificationHeader { - message Signature { - // Sign is signature of the request or session key. - bytes Sign = 1; - // Peer is compressed public key used for signature. - bytes Peer = 2; - } - - // Signatures is a set of signatures of every passed NeoFS Node - repeated Signature Signatures = 1; - - // Token is a token of the session within which the request is sent - Token Token = 2; - - // Bearer is a Bearer token of the request - BearerTokenMsg Bearer = 3; -} - -// User token granting rights for object manipulation -message Token { - message Info { - // ID is a token identifier. valid UUIDv4 represented in bytes - bytes ID = 1 [(gogoproto.customtype) = "TokenID", (gogoproto.nullable) = false]; - - // OwnerID is an owner of manipulation object - bytes OwnerID = 2 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false]; - - // Verb is an enumeration of session request types - enum Verb { - // Put refers to object.Put RPC call - Put = 0; - // Get refers to object.Get RPC call - Get = 1; - // Head refers to object.Head RPC call - Head = 2; - // Search refers to object.Search RPC call - Search = 3; - // Delete refers to object.Delete RPC call - Delete = 4; - // Range refers to object.GetRange RPC call - Range = 5; - // RangeHash refers to object.GetRangeHash RPC call - RangeHash = 6; - } - - // Verb is a type of request for which the token is issued - Verb verb = 3 [(gogoproto.customname) = "Verb"]; - - // Address is an object address for which token is issued - refs.Address Address = 4 [(gogoproto.nullable) = false, (gogoproto.customtype) = "Address"]; - - // Lifetime is a lifetime of the session - TokenLifetime Lifetime = 5 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; - - // SessionKey is a public key of session key - bytes SessionKey = 6; - - // OwnerKey is a public key of the token owner - bytes OwnerKey = 7; - } - - // TokenInfo is a grouped information about token - Info TokenInfo = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; - - // Signature is a signature of session token information - bytes Signature = 8; -} - -// TokenLifetime carries a group of lifetime parameters of the token -message TokenLifetime { - // Created carries an initial epoch of token lifetime - uint64 Created = 1; - - // ValidUntil carries a last epoch of token lifetime - uint64 ValidUntil = 2; -} - -// TODO: for variable token types and version redefine message -// Example: -// message Token { -// TokenType TokenType = 1; -// uint32 Version = 2; -// bytes Data = 3; -// } - -// BearerTokenMsg carries information about request ACL rules with limited lifetime -message BearerTokenMsg { - message Info { - // ACLRules carries a binary representation of the table of extended ACL rules - bytes ACLRules = 1; - - // OwnerID is an owner of token - bytes OwnerID = 2 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false]; - - // ValidUntil carries a last epoch of token lifetime - uint64 ValidUntil = 3; - } - - // TokenInfo is a grouped information about token - Info TokenInfo = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; - - // OwnerKey is a public key of the token owner - bytes OwnerKey = 2; - - // Signature is a signature of token information - bytes Signature = 3; -} diff --git a/service/verify_test.go b/service/verify_test.go deleted file mode 100644 index 5ab8753..0000000 --- a/service/verify_test.go +++ /dev/null @@ -1,140 +0,0 @@ -package service - -import ( - "encoding/binary" - "io" - "math" - "testing" - - "github.com/nspcc-dev/neofs-api-go/refs" - "github.com/nspcc-dev/neofs-crypto/test" - "github.com/stretchr/testify/require" -) - -func (m TestRequest) SignedData() ([]byte, error) { - return SignedDataFromReader(m) -} - -func (m TestRequest) SignedDataSize() (sz int) { - sz += 4 - - sz += len(m.StringField) - - sz += len(m.BytesField) - - sz += m.CustomField.Size() - - return -} - -func (m TestRequest) ReadSignedData(p []byte) (int, error) { - if len(p) < m.SignedDataSize() { - return 0, io.ErrUnexpectedEOF - } - - var off int - - binary.BigEndian.PutUint32(p[off:], uint32(m.IntField)) - off += 4 - - off += copy(p[off:], []byte(m.StringField)) - - off += copy(p[off:], m.BytesField) - - n, err := m.CustomField.MarshalTo(p[off:]) - off += n - - return off, err -} - -func BenchmarkSignDataWithSessionToken(b *testing.B) { - key := test.DecodeKey(0) - - customField := testCustomField{1, 2, 3, 4, 5, 6, 7, 8} - - token := new(Token) - - req := &TestRequest{ - IntField: math.MaxInt32, - StringField: "TestRequestStringField", - BytesField: make([]byte, 1<<22), - CustomField: &customField, - } - - req.SetTTL(math.MaxInt32 - 8) - req.SetEpoch(math.MaxInt64 - 12) - req.SetToken(token) - - b.ResetTimer() - b.ReportAllocs() - - for i := 0; i < b.N; i++ { - require.NoError(b, SignRequestData(key, req)) - } -} - -func BenchmarkVerifyAccumulatedSignaturesWithToken(b *testing.B) { - customField := testCustomField{1, 2, 3, 4, 5, 6, 7, 8} - - token := new(Token) - - req := &TestRequest{ - IntField: math.MaxInt32, - StringField: "TestRequestStringField", - BytesField: make([]byte, 1<<22), - CustomField: &customField, - } - - req.SetTTL(math.MaxInt32 - 8) - req.SetEpoch(math.MaxInt64 - 12) - req.SetToken(token) - - for i := 0; i < 10; i++ { - key := test.DecodeKey(i) - require.NoError(b, SignRequestData(key, req)) - } - - b.ResetTimer() - b.ReportAllocs() - - for i := 0; i < b.N; i++ { - require.NoError(b, VerifyRequestData(req)) - } -} - -func TestRequestVerificationHeader_SetToken(t *testing.T) { - id, err := refs.NewUUID() - require.NoError(t, err) - - token := new(Token) - token.SetID(id) - - h := new(RequestVerificationHeader) - - h.SetToken(token) - - require.Equal(t, token, h.GetToken()) -} - -func TestRequestVerificationHeader_SetBearer(t *testing.T) { - aclRules := []byte{1, 2, 3} - - token := new(BearerTokenMsg) - token.SetACLRules(aclRules) - - h := new(RequestVerificationHeader) - - h.SetBearer(token) - - require.Equal(t, token, h.GetBearer()) -} - -func TestRequestVerificationHeader_GetBearerToken(t *testing.T) { - s := new(RequestVerificationHeader) - - require.Nil(t, s.GetBearerToken()) - - bearer := new(BearerTokenMsg) - s.SetBearer(bearer) - require.Equal(t, bearer, s.GetBearerToken()) -} diff --git a/service/verify_test.pb.go b/service/verify_test.pb.go deleted file mode 100644 index 6bc8748..0000000 --- a/service/verify_test.pb.go +++ /dev/null @@ -1,572 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: service/verify_test.proto - -package service - -import ( - fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/golang/protobuf/proto" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package - -type TestRequest struct { - IntField int32 `protobuf:"varint,1,opt,name=IntField,proto3" json:"IntField,omitempty"` - StringField string `protobuf:"bytes,2,opt,name=StringField,proto3" json:"StringField,omitempty"` - BytesField []byte `protobuf:"bytes,3,opt,name=BytesField,proto3" json:"BytesField,omitempty"` - CustomField *testCustomField `protobuf:"bytes,4,opt,name=CustomField,proto3,customtype=testCustomField" json:"CustomField,omitempty"` - RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` - RequestVerificationHeader `protobuf:"bytes,99,opt,name=Header,proto3,embedded=Header" json:"Header"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *TestRequest) Reset() { *m = TestRequest{} } -func (m *TestRequest) String() string { return proto.CompactTextString(m) } -func (*TestRequest) ProtoMessage() {} -func (*TestRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_1effa83201a30d75, []int{0} -} -func (m *TestRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *TestRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *TestRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_TestRequest.Merge(m, src) -} -func (m *TestRequest) XXX_Size() int { - return m.Size() -} -func (m *TestRequest) XXX_DiscardUnknown() { - xxx_messageInfo_TestRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_TestRequest proto.InternalMessageInfo - -func (m *TestRequest) GetIntField() int32 { - if m != nil { - return m.IntField - } - return 0 -} - -func (m *TestRequest) GetStringField() string { - if m != nil { - return m.StringField - } - return "" -} - -func (m *TestRequest) GetBytesField() []byte { - if m != nil { - return m.BytesField - } - return nil -} - -func init() { - proto.RegisterType((*TestRequest)(nil), "service.TestRequest") -} - -func init() { proto.RegisterFile("service/verify_test.proto", fileDescriptor_1effa83201a30d75) } - -var fileDescriptor_1effa83201a30d75 = []byte{ - // 328 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x90, 0xb1, 0x4e, 0xf3, 0x30, - 0x14, 0x85, 0xeb, 0xfe, 0xfd, 0x4b, 0x71, 0x90, 0x90, 0x0c, 0x43, 0xc9, 0x90, 0x46, 0x9d, 0xc2, - 0x90, 0x44, 0x02, 0x21, 0xb1, 0x21, 0x05, 0x84, 0x60, 0x60, 0x09, 0x88, 0x81, 0x05, 0x25, 0xe9, - 0x6d, 0xb0, 0x44, 0xe3, 0x12, 0xdf, 0x54, 0xea, 0x9b, 0x30, 0xf3, 0x34, 0x1d, 0x3b, 0x22, 0x86, - 0x08, 0x85, 0x17, 0x41, 0x71, 0x0c, 0x0a, 0xb0, 0xf9, 0x9e, 0xf3, 0x1d, 0xdb, 0xf7, 0xd0, 0x3d, - 0x09, 0xf9, 0x82, 0x27, 0xe0, 0x2f, 0x20, 0xe7, 0xd3, 0xe5, 0x3d, 0x82, 0x44, 0x6f, 0x9e, 0x0b, - 0x14, 0x6c, 0x43, 0x5b, 0x26, 0xfb, 0x62, 0x66, 0x80, 0x51, 0x63, 0x9a, 0xbb, 0x3f, 0x73, 0x5a, - 0x75, 0x53, 0x8e, 0x0f, 0x45, 0xec, 0x25, 0x62, 0xe6, 0xa7, 0x22, 0x15, 0xbe, 0x92, 0xe3, 0x62, - 0xaa, 0x26, 0x35, 0xa8, 0x53, 0x83, 0x8f, 0x5f, 0xba, 0xd4, 0xb8, 0x01, 0x89, 0x21, 0x3c, 0x15, - 0x20, 0x91, 0x99, 0x74, 0x70, 0x99, 0xe1, 0x39, 0x87, 0xc7, 0xc9, 0x90, 0xd8, 0xc4, 0xf9, 0x1f, - 0x7e, 0xcf, 0xcc, 0xa6, 0xc6, 0x35, 0xe6, 0x3c, 0x4b, 0x1b, 0xbb, 0x6b, 0x13, 0x67, 0x33, 0x6c, - 0x4b, 0xcc, 0xa2, 0x34, 0x58, 0x22, 0xc8, 0x06, 0xf8, 0x67, 0x13, 0x67, 0x2b, 0x6c, 0x29, 0xec, - 0x88, 0x1a, 0xa7, 0x85, 0x44, 0x31, 0x6b, 0x80, 0x5e, 0x0d, 0x04, 0x3b, 0x6f, 0xe5, 0x68, 0xbb, - 0x5e, 0xba, 0x65, 0x85, 0x6d, 0x8e, 0x1d, 0xd3, 0xde, 0x15, 0x60, 0x34, 0x8c, 0x6d, 0xe2, 0x18, - 0x07, 0xa6, 0xa7, 0x17, 0xf7, 0xf4, 0xa7, 0x6b, 0xef, 0x02, 0xa2, 0x09, 0xe4, 0xc1, 0x60, 0x55, - 0x8e, 0x3a, 0xeb, 0x72, 0x44, 0x42, 0x95, 0x60, 0x67, 0xb4, 0xdf, 0x38, 0xc3, 0x44, 0x65, 0xc7, - 0xbf, 0xb3, 0xb7, 0x75, 0x77, 0x3c, 0x89, 0x90, 0x8b, 0xec, 0xcf, 0x1d, 0x3a, 0x1b, 0x9c, 0xac, - 0x2a, 0x8b, 0xac, 0x2b, 0x8b, 0xbc, 0x56, 0x16, 0x79, 0xaf, 0x2c, 0xf2, 0xfc, 0x61, 0x75, 0xee, - 0xf6, 0x5b, 0x4d, 0x67, 0x72, 0x9e, 0x24, 0xee, 0x04, 0x16, 0x7e, 0x06, 0x62, 0x2a, 0xdd, 0x68, - 0xce, 0xdd, 0x54, 0xf8, 0xfa, 0xb1, 0xb8, 0xaf, 0xca, 0x3e, 0xfc, 0x0c, 0x00, 0x00, 0xff, 0xff, - 0xcb, 0xae, 0x78, 0xc0, 0xeb, 0x01, 0x00, 0x00, -} - -func (m *TestRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *TestRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *TestRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - { - size, err := m.RequestVerificationHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintVerifyTest(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x6 - i-- - dAtA[i] = 0x9a - { - size, err := m.RequestMetaHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintVerifyTest(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x6 - i-- - dAtA[i] = 0x92 - if m.CustomField != nil { - { - size := m.CustomField.Size() - i -= size - if _, err := m.CustomField.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintVerifyTest(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } - if len(m.BytesField) > 0 { - i -= len(m.BytesField) - copy(dAtA[i:], m.BytesField) - i = encodeVarintVerifyTest(dAtA, i, uint64(len(m.BytesField))) - i-- - dAtA[i] = 0x1a - } - if len(m.StringField) > 0 { - i -= len(m.StringField) - copy(dAtA[i:], m.StringField) - i = encodeVarintVerifyTest(dAtA, i, uint64(len(m.StringField))) - i-- - dAtA[i] = 0x12 - } - if m.IntField != 0 { - i = encodeVarintVerifyTest(dAtA, i, uint64(m.IntField)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func encodeVarintVerifyTest(dAtA []byte, offset int, v uint64) int { - offset -= sovVerifyTest(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *TestRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.IntField != 0 { - n += 1 + sovVerifyTest(uint64(m.IntField)) - } - l = len(m.StringField) - if l > 0 { - n += 1 + l + sovVerifyTest(uint64(l)) - } - l = len(m.BytesField) - if l > 0 { - n += 1 + l + sovVerifyTest(uint64(l)) - } - if m.CustomField != nil { - l = m.CustomField.Size() - n += 1 + l + sovVerifyTest(uint64(l)) - } - l = m.RequestMetaHeader.Size() - n += 2 + l + sovVerifyTest(uint64(l)) - l = m.RequestVerificationHeader.Size() - n += 2 + l + sovVerifyTest(uint64(l)) - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func sovVerifyTest(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozVerifyTest(x uint64) (n int) { - return sovVerifyTest(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *TestRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowVerifyTest - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: TestRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: TestRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field IntField", wireType) - } - m.IntField = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowVerifyTest - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.IntField |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field StringField", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowVerifyTest - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthVerifyTest - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthVerifyTest - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.StringField = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BytesField", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowVerifyTest - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthVerifyTest - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthVerifyTest - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.BytesField = append(m.BytesField[:0], dAtA[iNdEx:postIndex]...) - if m.BytesField == nil { - m.BytesField = []byte{} - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CustomField", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowVerifyTest - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthVerifyTest - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthVerifyTest - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - var v testCustomField - m.CustomField = &v - if err := m.CustomField.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 98: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowVerifyTest - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthVerifyTest - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthVerifyTest - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.RequestMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 99: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RequestVerificationHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowVerifyTest - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthVerifyTest - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthVerifyTest - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.RequestVerificationHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipVerifyTest(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthVerifyTest - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthVerifyTest - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipVerifyTest(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowVerifyTest - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowVerifyTest - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowVerifyTest - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthVerifyTest - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupVerifyTest - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthVerifyTest - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthVerifyTest = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowVerifyTest = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupVerifyTest = fmt.Errorf("proto: unexpected end of group") -) diff --git a/service/verify_test.proto b/service/verify_test.proto deleted file mode 100644 index 901d6fd..0000000 --- a/service/verify_test.proto +++ /dev/null @@ -1,18 +0,0 @@ -syntax = "proto3"; -package service; -option go_package = "github.com/nspcc-dev/neofs-api-go/service"; - -import "service/meta.proto"; -import "service/verify.proto"; -import "github.com/gogo/protobuf/gogoproto/gogo.proto"; - -option (gogoproto.stable_marshaler_all) = true; - -message TestRequest { - int32 IntField = 1; - string StringField = 2; - bytes BytesField = 3; - bytes CustomField = 4 [(gogoproto.customtype) = "testCustomField"]; - RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; - RequestVerificationHeader Header = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; -} diff --git a/service/version.go b/service/version.go deleted file mode 100644 index 6f4839c..0000000 --- a/service/version.go +++ /dev/null @@ -1,11 +0,0 @@ -package service - -// SetVersion is a Version field setter. -func (m *ResponseMetaHeader) SetVersion(v uint32) { - m.Version = v -} - -// SetVersion is a Version field setter. -func (m *RequestMetaHeader) SetVersion(v uint32) { - m.Version = v -} diff --git a/service/version_test.go b/service/version_test.go deleted file mode 100644 index d102d30..0000000 --- a/service/version_test.go +++ /dev/null @@ -1,21 +0,0 @@ -package service - -import ( - "testing" - - "github.com/stretchr/testify/require" -) - -func TestGetSetVersion(t *testing.T) { - v := uint32(7) - - items := []VersionContainer{ - new(ResponseMetaHeader), - new(RequestMetaHeader), - } - - for _, item := range items { - item.SetVersion(v) - require.Equal(t, v, item.GetVersion()) - } -} diff --git a/session/alias.go b/session/alias.go deleted file mode 100644 index aa49d55..0000000 --- a/session/alias.go +++ /dev/null @@ -1,15 +0,0 @@ -package session - -import ( - "github.com/nspcc-dev/neofs-api-go/refs" - "github.com/nspcc-dev/neofs-api-go/service" -) - -// OwnerID is a type alias of OwnerID ref. -type OwnerID = refs.OwnerID - -// TokenID is a type alias of TokenID ref. -type TokenID = service.TokenID - -// Token is a type alias of Token. -type Token = service.Token diff --git a/session/create.go b/session/create.go deleted file mode 100644 index 412d1fd..0000000 --- a/session/create.go +++ /dev/null @@ -1,62 +0,0 @@ -package session - -import ( - "context" - "crypto/ecdsa" - - "github.com/nspcc-dev/neofs-api-go/service" - crypto "github.com/nspcc-dev/neofs-crypto" - "google.golang.org/grpc" -) - -type gRPCCreator struct { - conn *grpc.ClientConn - - key *ecdsa.PrivateKey - - clientFunc func(*grpc.ClientConn) SessionClient -} - -// NewGRPCCreator unites virtual gRPC client with private ket and returns Creator interface. -// -// If passed ClientConn is nil, ErrNilGPRCClientConn returns. -// If passed private key is nil, crypto.ErrEmptyPrivateKey returns. -func NewGRPCCreator(conn *grpc.ClientConn, key *ecdsa.PrivateKey) (Creator, error) { - if conn == nil { - return nil, ErrNilGPRCClientConn - } else if key == nil { - return nil, crypto.ErrEmptyPrivateKey - } - - return &gRPCCreator{ - conn: conn, - - key: key, - - clientFunc: NewSessionClient, - }, nil -} - -// Create constructs message, signs it with private key and sends it to a gRPC client. -// -// If passed CreateParamsSource is nil, ErrNilCreateParamsSource returns. -// If message could not be signed, an error returns. -func (s gRPCCreator) Create(ctx context.Context, p CreateParamsSource) (CreateResult, error) { - if p == nil { - return nil, ErrNilCreateParamsSource - } - - // create and fill a message - req := new(CreateRequest) - req.SetOwnerID(p.GetOwnerID()) - req.SetCreationEpoch(p.CreationEpoch()) - req.SetExpirationEpoch(p.ExpirationEpoch()) - - // sign with private key - if err := service.SignRequestData(s.key, req); err != nil { - return nil, err - } - - // make gRPC call - return s.clientFunc(s.conn).Create(ctx, req) -} diff --git a/session/create_test.go b/session/create_test.go deleted file mode 100644 index 943c5da..0000000 --- a/session/create_test.go +++ /dev/null @@ -1,103 +0,0 @@ -package session - -import ( - "context" - "crypto/ecdsa" - "testing" - - "github.com/nspcc-dev/neofs-api-go/service" - crypto "github.com/nspcc-dev/neofs-crypto" - "github.com/nspcc-dev/neofs-crypto/test" - "github.com/pkg/errors" - "github.com/stretchr/testify/require" - "google.golang.org/grpc" -) - -type testSessionClient struct { - fn func(*CreateRequest) - resp *CreateResponse - err error -} - -func (s testSessionClient) Create(ctx context.Context, in *CreateRequest, opts ...grpc.CallOption) (*CreateResponse, error) { - if s.fn != nil { - s.fn(in) - } - - return s.resp, s.err -} - -func TestNewGRPCCreator(t *testing.T) { - var ( - err error - conn = new(grpc.ClientConn) - sk = new(ecdsa.PrivateKey) - ) - - // nil client connection - _, err = NewGRPCCreator(nil, sk) - require.EqualError(t, err, ErrNilGPRCClientConn.Error()) - - // nil private key - _, err = NewGRPCCreator(conn, nil) - require.EqualError(t, err, crypto.ErrEmptyPrivateKey.Error()) - - // valid params - res, err := NewGRPCCreator(conn, sk) - require.NoError(t, err) - - v := res.(*gRPCCreator) - require.Equal(t, conn, v.conn) - require.Equal(t, sk, v.key) - require.NotNil(t, v.clientFunc) -} - -func TestGRPCCreator_Create(t *testing.T) { - ctx := context.TODO() - s := new(gRPCCreator) - - // nil CreateParamsSource - _, err := s.Create(ctx, nil) - require.EqualError(t, err, ErrNilCreateParamsSource.Error()) - - var ( - ownerID = OwnerID{1, 2, 3} - created = uint64(2) - expired = uint64(4) - ) - - p := NewParams() - p.SetOwnerID(ownerID) - p.SetCreationEpoch(created) - p.SetExpirationEpoch(expired) - - // nil private key - _, err = s.Create(ctx, p) - require.Error(t, err) - - // create test private key - s.key = test.DecodeKey(0) - - // create test client - c := &testSessionClient{ - fn: func(req *CreateRequest) { - require.Equal(t, ownerID, req.GetOwnerID()) - require.Equal(t, created, req.CreationEpoch()) - require.Equal(t, expired, req.ExpirationEpoch()) - require.NoError(t, service.VerifyRequestData(req)) - }, - resp: &CreateResponse{ - ID: TokenID{1, 2, 3}, - SessionKey: []byte{1, 2, 3}, - }, - err: errors.New("test error"), - } - - s.clientFunc = func(*grpc.ClientConn) SessionClient { - return c - } - - res, err := s.Create(ctx, p) - require.EqualError(t, err, c.err.Error()) - require.Equal(t, c.resp, res) -} diff --git a/session/errors.go b/session/errors.go deleted file mode 100644 index d35bed4..0000000 --- a/session/errors.go +++ /dev/null @@ -1,19 +0,0 @@ -package session - -import "github.com/nspcc-dev/neofs-api-go/internal" - -// ErrNilCreateParamsSource is returned by functions that expect a non-nil -// CreateParamsSource, but received nil. -const ErrNilCreateParamsSource = internal.Error("create params source is nil") - -// ErrNilGPRCClientConn is returned by functions that expect a non-nil -// grpc.ClientConn, but received nil. -const ErrNilGPRCClientConn = internal.Error("gRPC client connection is nil") - -// ErrPrivateTokenNotFound is returned when addressed private token was -// not found in storage. -const ErrPrivateTokenNotFound = internal.Error("private token not found") - -// ErrNilPrivateToken is returned by functions that expect a non-nil -// PrivateToken, but received nil. -const ErrNilPrivateToken = internal.Error("private token is nil") diff --git a/session/private.go b/session/private.go deleted file mode 100644 index bb9242f..0000000 --- a/session/private.go +++ /dev/null @@ -1,67 +0,0 @@ -package session - -import ( - "crypto/ecdsa" - "crypto/elliptic" - "crypto/rand" - - crypto "github.com/nspcc-dev/neofs-crypto" -) - -type pToken struct { - // private session token - sessionKey *ecdsa.PrivateKey - // last epoch of the lifetime - validUntil uint64 -} - -// NewPrivateToken creates PrivateToken instance that expires after passed epoch. -// -// Returns non-nil error on key generation error. -func NewPrivateToken(validUntil uint64) (PrivateToken, error) { - sk, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader) - if err != nil { - return nil, err - } - - return &pToken{ - sessionKey: sk, - validUntil: validUntil, - }, nil -} - -// PublicSessionToken returns a binary representation of session public key. -// -// If passed PrivateToken is nil, ErrNilPrivateToken returns. -// If passed PrivateToken carries nil private key, crypto.ErrEmptyPrivateKey returns. -func PublicSessionToken(pToken PrivateToken) ([]byte, error) { - if pToken == nil { - return nil, ErrNilPrivateToken - } - - sk := pToken.PrivateKey() - if sk == nil { - return nil, crypto.ErrEmptyPrivateKey - } - - return crypto.MarshalPublicKey(&sk.PublicKey), nil -} - -// PrivateKey is a session private key getter. -func (t *pToken) PrivateKey() *ecdsa.PrivateKey { - return t.sessionKey -} - -func (t *pToken) Expired(epoch uint64) bool { - return t.validUntil < epoch -} - -// SetOwnerID is an owner ID field setter. -func (s *PrivateTokenKey) SetOwnerID(id OwnerID) { - s.owner = id -} - -// SetTokenID is a token ID field setter. -func (s *PrivateTokenKey) SetTokenID(id TokenID) { - s.token = id -} diff --git a/session/private_test.go b/session/private_test.go deleted file mode 100644 index c6f8125..0000000 --- a/session/private_test.go +++ /dev/null @@ -1,76 +0,0 @@ -package session - -import ( - "testing" - - crypto "github.com/nspcc-dev/neofs-crypto" - "github.com/stretchr/testify/require" -) - -func TestPToken_PrivateKey(t *testing.T) { - // create new private token - pToken, err := NewPrivateToken(0) - require.NoError(t, err) - require.NotNil(t, pToken.PrivateKey()) -} - -func TestPToken_Expired(t *testing.T) { - e := uint64(10) - - var token PrivateToken = &pToken{ - validUntil: e, - } - - // must not be expired in the epoch before last - require.False(t, token.Expired(e-1)) - - // must not be expired in the last epoch - require.False(t, token.Expired(e)) - - // must be expired in the epoch after last - require.True(t, token.Expired(e+1)) -} - -func TestPrivateTokenKey_SetOwnerID(t *testing.T) { - ownerID := OwnerID{1, 2, 3} - - s := new(PrivateTokenKey) - - s.SetOwnerID(ownerID) - - require.Equal(t, ownerID, s.owner) -} - -func TestPrivateTokenKey_SetTokenID(t *testing.T) { - tokenID := TokenID{1, 2, 3} - - s := new(PrivateTokenKey) - - s.SetTokenID(tokenID) - - require.Equal(t, tokenID, s.token) -} - -func TestPublicSessionToken(t *testing.T) { - var err error - - // nil PrivateToken - _, err = PublicSessionToken(nil) - require.EqualError(t, err, ErrNilPrivateToken.Error()) - - // empty private key - var pToken PrivateToken = new(pToken) - _, err = PublicSessionToken(pToken) - require.EqualError(t, err, crypto.ErrEmptyPrivateKey.Error()) - - // correct PrivateToken - pToken, err = NewPrivateToken(0) - require.NoError(t, err) - - key := pToken.PrivateKey() - require.NotNil(t, key) - - res, err := PublicSessionToken(pToken) - require.NoError(t, err) - require.Equal(t, res, crypto.MarshalPublicKey(&key.PublicKey)) -} diff --git a/session/request.go b/session/request.go deleted file mode 100644 index 73c05e5..0000000 --- a/session/request.go +++ /dev/null @@ -1,62 +0,0 @@ -package session - -import ( - "encoding/binary" - "io" - - "github.com/nspcc-dev/neofs-api-go/refs" - "github.com/nspcc-dev/neofs-api-go/service" -) - -const signedRequestDataSize = 0 + - refs.OwnerIDSize + - 8 + - 8 - -var requestEndianness = binary.BigEndian - -// NewParams creates a new CreateRequest message and returns CreateParamsContainer interface. -func NewParams() CreateParamsContainer { - return new(CreateRequest) -} - -// GetOwnerID is an OwnerID field getter. -func (m CreateRequest) GetOwnerID() OwnerID { - return m.OwnerID -} - -// SetOwnerID is an OwnerID field setter. -func (m *CreateRequest) SetOwnerID(id OwnerID) { - m.OwnerID = id -} - -// SignedData returns payload bytes of the request. -func (m CreateRequest) SignedData() ([]byte, error) { - return service.SignedDataFromReader(m) -} - -// SignedDataSize returns payload size of the request. -func (m CreateRequest) SignedDataSize() int { - return signedRequestDataSize -} - -// ReadSignedData copies payload bytes to passed buffer. -// -// If the buffer size is insufficient, io.ErrUnexpectedEOF returns. -func (m CreateRequest) ReadSignedData(p []byte) (int, error) { - sz := m.SignedDataSize() - if len(p) < sz { - return 0, io.ErrUnexpectedEOF - } - - var off int - - off += copy(p[off:], m.GetOwnerID().Bytes()) - - requestEndianness.PutUint64(p[off:], m.CreationEpoch()) - off += 8 - - requestEndianness.PutUint64(p[off:], m.ExpirationEpoch()) - - return sz, nil -} diff --git a/session/request_test.go b/session/request_test.go deleted file mode 100644 index 094ca66..0000000 --- a/session/request_test.go +++ /dev/null @@ -1,92 +0,0 @@ -package session - -import ( - "testing" - - "github.com/stretchr/testify/require" -) - -func TestCreateRequestGettersSetters(t *testing.T) { - t.Run("owner ID", func(t *testing.T) { - id := OwnerID{1, 2, 3} - m := new(CreateRequest) - - m.SetOwnerID(id) - - require.Equal(t, id, m.GetOwnerID()) - }) - - t.Run("lifetime", func(t *testing.T) { - e1, e2 := uint64(3), uint64(4) - m := new(CreateRequest) - - m.SetCreationEpoch(e1) - m.SetExpirationEpoch(e2) - - require.Equal(t, e1, m.CreationEpoch()) - require.Equal(t, e2, m.ExpirationEpoch()) - }) -} - -func TestCreateRequest_SignedData(t *testing.T) { - var ( - id = OwnerID{1, 2, 3} - e1 = uint64(1) - e2 = uint64(2) - ) - - // create new message - m := new(CreateRequest) - - // fill the fields - m.SetOwnerID(id) - m.SetCreationEpoch(e1) - m.SetExpirationEpoch(e2) - - // calculate initial signed data - d, err := m.SignedData() - require.NoError(t, err) - - items := []struct { - change func() - reset func() - }{ - { // OwnerID - change: func() { - id2 := id - id2[0]++ - m.SetOwnerID(id2) - }, - reset: func() { - m.SetOwnerID(id) - }, - }, - { // CreationEpoch - change: func() { - m.SetCreationEpoch(e1 + 1) - }, - reset: func() { - m.SetCreationEpoch(e1) - }, - }, - { // ExpirationEpoch - change: func() { - m.SetExpirationEpoch(e2 + 1) - }, - reset: func() { - m.SetExpirationEpoch(e2) - }, - }, - } - - for _, item := range items { - item.change() - - d2, err := m.SignedData() - require.NoError(t, err) - - require.NotEqual(t, d, d2) - - item.reset() - } -} diff --git a/session/response.go b/session/response.go deleted file mode 100644 index 3426d7c..0000000 --- a/session/response.go +++ /dev/null @@ -1,16 +0,0 @@ -package session - -// GetID is an ID field getter. -func (m CreateResponse) GetID() TokenID { - return m.ID -} - -// SetID is an ID field setter. -func (m *CreateResponse) SetID(id TokenID) { - m.ID = id -} - -// SetSessionKey is a SessionKey field setter. -func (m *CreateResponse) SetSessionKey(key []byte) { - m.SessionKey = key -} diff --git a/session/response_test.go b/session/response_test.go deleted file mode 100644 index 0e1de0b..0000000 --- a/session/response_test.go +++ /dev/null @@ -1,27 +0,0 @@ -package session - -import ( - "testing" - - "github.com/stretchr/testify/require" -) - -func TestCreateResponseGettersSetters(t *testing.T) { - t.Run("id", func(t *testing.T) { - id := TokenID{1, 2, 3} - m := new(CreateResponse) - - m.SetID(id) - - require.Equal(t, id, m.GetID()) - }) - - t.Run("session key", func(t *testing.T) { - key := []byte{1, 2, 3} - m := new(CreateResponse) - - m.SetSessionKey(key) - - require.Equal(t, key, m.GetSessionKey()) - }) -} diff --git a/session/service.pb.go b/session/service.pb.go deleted file mode 100644 index e68c0fd..0000000 --- a/session/service.pb.go +++ /dev/null @@ -1,800 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: session/service.proto - -package session - -import ( - context "context" - fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/golang/protobuf/proto" - service "github.com/nspcc-dev/neofs-api-go/service" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package - -// CreateRequest carries an information necessary for opening a session -type CreateRequest struct { - // OwnerID carries an identifier of a session initiator - OwnerID OwnerID `protobuf:"bytes,1,opt,name=OwnerID,proto3,customtype=OwnerID" json:"OwnerID"` - // Lifetime carries a lifetime of the session - service.TokenLifetime `protobuf:"bytes,2,opt,name=Lifetime,proto3,embedded=Lifetime" json:"Lifetime"` - // RequestMetaHeader contains information about request meta headers (should be embedded into message) - service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` - // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) - service.RequestVerificationHeader `protobuf:"bytes,99,opt,name=Verify,proto3,embedded=Verify" json:"Verify"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *CreateRequest) Reset() { *m = CreateRequest{} } -func (m *CreateRequest) String() string { return proto.CompactTextString(m) } -func (*CreateRequest) ProtoMessage() {} -func (*CreateRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_b329bee0fd1148e0, []int{0} -} -func (m *CreateRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *CreateRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *CreateRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_CreateRequest.Merge(m, src) -} -func (m *CreateRequest) XXX_Size() int { - return m.Size() -} -func (m *CreateRequest) XXX_DiscardUnknown() { - xxx_messageInfo_CreateRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_CreateRequest proto.InternalMessageInfo - -// CreateResponse carries an information about the opened session -type CreateResponse struct { - // ID carries an identifier of session token - ID TokenID `protobuf:"bytes,1,opt,name=ID,proto3,customtype=TokenID" json:"ID"` - // SessionKey carries a session public key - SessionKey []byte `protobuf:"bytes,2,opt,name=SessionKey,proto3" json:"SessionKey,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *CreateResponse) Reset() { *m = CreateResponse{} } -func (m *CreateResponse) String() string { return proto.CompactTextString(m) } -func (*CreateResponse) ProtoMessage() {} -func (*CreateResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_b329bee0fd1148e0, []int{1} -} -func (m *CreateResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *CreateResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *CreateResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_CreateResponse.Merge(m, src) -} -func (m *CreateResponse) XXX_Size() int { - return m.Size() -} -func (m *CreateResponse) XXX_DiscardUnknown() { - xxx_messageInfo_CreateResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_CreateResponse proto.InternalMessageInfo - -func (m *CreateResponse) GetSessionKey() []byte { - if m != nil { - return m.SessionKey - } - return nil -} - -func init() { - proto.RegisterType((*CreateRequest)(nil), "session.CreateRequest") - proto.RegisterType((*CreateResponse)(nil), "session.CreateResponse") -} - -func init() { proto.RegisterFile("session/service.proto", fileDescriptor_b329bee0fd1148e0) } - -var fileDescriptor_b329bee0fd1148e0 = []byte{ - // 386 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x91, 0xcf, 0x6e, 0xda, 0x40, - 0x10, 0xc6, 0x59, 0xab, 0x02, 0xb4, 0xa5, 0xad, 0xba, 0xea, 0x1f, 0xcb, 0x07, 0x1b, 0x71, 0x82, - 0x83, 0x6d, 0x89, 0x5e, 0x5a, 0xa9, 0x97, 0x52, 0xab, 0xaa, 0xd5, 0xe6, 0x9f, 0x89, 0x72, 0xc8, - 0xcd, 0x36, 0x63, 0x67, 0x15, 0xe1, 0x75, 0xbc, 0x0b, 0x11, 0x6f, 0x92, 0x67, 0xc8, 0x93, 0x70, - 0xe4, 0x18, 0xe5, 0x80, 0x22, 0xe7, 0x25, 0x72, 0x8c, 0x58, 0xaf, 0x11, 0x09, 0xb7, 0x9d, 0xdf, - 0xec, 0xf7, 0x69, 0xbe, 0x19, 0xfc, 0x99, 0x03, 0xe7, 0x94, 0x65, 0x2e, 0x87, 0x62, 0x4e, 0x63, - 0x70, 0xf2, 0x82, 0x09, 0x46, 0x5a, 0x0a, 0x1b, 0x44, 0x71, 0x77, 0x0a, 0x22, 0xac, 0x9a, 0xc6, - 0xa7, 0x9a, 0xcd, 0xa1, 0xa0, 0xc9, 0x42, 0x51, 0x3b, 0xa5, 0xe2, 0x62, 0x16, 0x39, 0x31, 0x9b, - 0xba, 0x29, 0x4b, 0x99, 0x2b, 0x71, 0x34, 0x4b, 0x64, 0x25, 0x0b, 0xf9, 0xaa, 0xbe, 0xf7, 0x9e, - 0x10, 0x7e, 0xf7, 0xbb, 0x80, 0x50, 0x40, 0x00, 0x57, 0x33, 0xe0, 0x82, 0x0c, 0x70, 0xeb, 0xe8, - 0x3a, 0x83, 0xc2, 0xf7, 0x74, 0xd4, 0x45, 0xfd, 0xce, 0xe8, 0xc3, 0x72, 0x6d, 0x35, 0xee, 0xd7, - 0x56, 0x8d, 0x83, 0xfa, 0x41, 0x7e, 0xe2, 0xf6, 0x7f, 0x9a, 0x80, 0xa0, 0x53, 0xd0, 0xb5, 0x2e, - 0xea, 0xbf, 0x1d, 0x7e, 0x71, 0xea, 0x00, 0xa7, 0xec, 0x12, 0xb2, 0xba, 0x3b, 0x6a, 0x6f, 0x3c, - 0x56, 0x6b, 0x0b, 0x05, 0x5b, 0x05, 0xf9, 0x8e, 0xdf, 0x1c, 0x80, 0x08, 0xf5, 0x48, 0x2a, 0x8d, - 0xad, 0x52, 0x0d, 0xb2, 0xe9, 0xfd, 0x85, 0x70, 0x02, 0xc5, 0x8e, 0x5a, 0x2a, 0x88, 0x87, 0x9b, - 0x67, 0x32, 0xb3, 0x1e, 0x4b, 0x6d, 0xef, 0xb5, 0x56, 0x76, 0x69, 0x1c, 0x0a, 0xca, 0xb2, 0x3d, - 0x0f, 0xa5, 0xed, 0x9d, 0xe0, 0xf7, 0x75, 0x72, 0x9e, 0xb3, 0x8c, 0x03, 0xb1, 0xb0, 0xb6, 0x9f, - 0x5a, 0x06, 0xf1, 0xbd, 0x40, 0xf3, 0x3d, 0x62, 0x62, 0x3c, 0xae, 0x2e, 0xf2, 0x0f, 0x16, 0x32, - 0x72, 0x27, 0xd8, 0x21, 0x43, 0x0f, 0xb7, 0x54, 0x45, 0x7e, 0xe0, 0x66, 0xe5, 0x4e, 0x36, 0x3b, - 0x91, 0xcc, 0x79, 0xb1, 0x68, 0xe3, 0xeb, 0x1e, 0xaf, 0xc6, 0x18, 0x8d, 0x97, 0xa5, 0x89, 0x56, - 0xa5, 0x89, 0xee, 0x4a, 0x13, 0x3d, 0x94, 0x26, 0xba, 0x79, 0x34, 0x1b, 0xe7, 0x83, 0x9d, 0xc3, - 0x66, 0x3c, 0x8f, 0x63, 0x7b, 0x02, 0x73, 0x37, 0x03, 0x96, 0x70, 0x3b, 0xcc, 0xa9, 0x9d, 0x32, - 0x57, 0xf9, 0xdd, 0x6a, 0x1f, 0x0f, 0x81, 0xfd, 0x19, 0x3b, 0xbf, 0x8e, 0x7d, 0x47, 0xcd, 0x13, - 0x35, 0xe5, 0xbd, 0xbf, 0x3d, 0x07, 0x00, 0x00, 0xff, 0xff, 0xf5, 0x66, 0xc9, 0x19, 0x6a, 0x02, - 0x00, 0x00, -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 - -// SessionClient is the client API for Session service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type SessionClient interface { - // Create opens new session between the client and the server - Create(ctx context.Context, in *CreateRequest, opts ...grpc.CallOption) (*CreateResponse, error) -} - -type sessionClient struct { - cc *grpc.ClientConn -} - -func NewSessionClient(cc *grpc.ClientConn) SessionClient { - return &sessionClient{cc} -} - -func (c *sessionClient) Create(ctx context.Context, in *CreateRequest, opts ...grpc.CallOption) (*CreateResponse, error) { - out := new(CreateResponse) - err := c.cc.Invoke(ctx, "/session.Session/Create", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// SessionServer is the server API for Session service. -type SessionServer interface { - // Create opens new session between the client and the server - Create(context.Context, *CreateRequest) (*CreateResponse, error) -} - -// UnimplementedSessionServer can be embedded to have forward compatible implementations. -type UnimplementedSessionServer struct { -} - -func (*UnimplementedSessionServer) Create(ctx context.Context, req *CreateRequest) (*CreateResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Create not implemented") -} - -func RegisterSessionServer(s *grpc.Server, srv SessionServer) { - s.RegisterService(&_Session_serviceDesc, srv) -} - -func _Session_Create_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(CreateRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(SessionServer).Create(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/session.Session/Create", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(SessionServer).Create(ctx, req.(*CreateRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _Session_serviceDesc = grpc.ServiceDesc{ - ServiceName: "session.Session", - HandlerType: (*SessionServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Create", - Handler: _Session_Create_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "session/service.proto", -} - -func (m *CreateRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *CreateRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *CreateRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - { - size, err := m.RequestVerificationHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x6 - i-- - dAtA[i] = 0x9a - { - size, err := m.RequestMetaHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x6 - i-- - dAtA[i] = 0x92 - { - size, err := m.TokenLifetime.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size := m.OwnerID.Size() - i -= size - if _, err := m.OwnerID.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *CreateResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *CreateResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *CreateResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.SessionKey) > 0 { - i -= len(m.SessionKey) - copy(dAtA[i:], m.SessionKey) - i = encodeVarintService(dAtA, i, uint64(len(m.SessionKey))) - i-- - dAtA[i] = 0x12 - } - { - size := m.ID.Size() - i -= size - if _, err := m.ID.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func encodeVarintService(dAtA []byte, offset int, v uint64) int { - offset -= sovService(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *CreateRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.OwnerID.Size() - n += 1 + l + sovService(uint64(l)) - l = m.TokenLifetime.Size() - n += 1 + l + sovService(uint64(l)) - l = m.RequestMetaHeader.Size() - n += 2 + l + sovService(uint64(l)) - l = m.RequestVerificationHeader.Size() - n += 2 + l + sovService(uint64(l)) - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *CreateResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ID.Size() - n += 1 + l + sovService(uint64(l)) - l = len(m.SessionKey) - if l > 0 { - n += 1 + l + sovService(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func sovService(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozService(x uint64) (n int) { - return sovService(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *CreateRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: CreateRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: CreateRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OwnerID", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.OwnerID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TokenLifetime", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.TokenLifetime.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 98: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.RequestMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 99: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RequestVerificationHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.RequestVerificationHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *CreateResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: CreateResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: CreateResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SessionKey", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.SessionKey = append(m.SessionKey[:0], dAtA[iNdEx:postIndex]...) - if m.SessionKey == nil { - m.SessionKey = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipService(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowService - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowService - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowService - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthService - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupService - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthService - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthService = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowService = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupService = fmt.Errorf("proto: unexpected end of group") -) diff --git a/session/service.proto b/session/service.proto deleted file mode 100644 index b7eb0df..0000000 --- a/session/service.proto +++ /dev/null @@ -1,39 +0,0 @@ -syntax = "proto3"; -package session; -option go_package = "github.com/nspcc-dev/neofs-api-go/session"; -option csharp_namespace = "NeoFS.API.Session"; - -import "service/meta.proto"; -import "service/verify.proto"; -import "github.com/gogo/protobuf/gogoproto/gogo.proto"; - -option (gogoproto.stable_marshaler_all) = true; - - -service Session { - // Create opens new session between the client and the server - rpc Create (CreateRequest) returns (CreateResponse); -} - -// CreateRequest carries an information necessary for opening a session -message CreateRequest { - // OwnerID carries an identifier of a session initiator - bytes OwnerID = 1 [(gogoproto.nullable) = false, (gogoproto.customtype) = "OwnerID"]; - - // Lifetime carries a lifetime of the session - service.TokenLifetime Lifetime = 2 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; - - // RequestMetaHeader contains information about request meta headers (should be embedded into message) - service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; - // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) - service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; -} - -// CreateResponse carries an information about the opened session -message CreateResponse { - // ID carries an identifier of session token - bytes ID = 1 [(gogoproto.customtype) = "TokenID", (gogoproto.nullable) = false]; - - // SessionKey carries a session public key - bytes SessionKey = 2; -} diff --git a/session/store.go b/session/store.go deleted file mode 100644 index fa33b7e..0000000 --- a/session/store.go +++ /dev/null @@ -1,64 +0,0 @@ -package session - -import ( - "sync" -) - -type mapTokenStore struct { - *sync.RWMutex - - tokens map[PrivateTokenKey]PrivateToken -} - -// NewMapTokenStore creates new PrivateTokenStore instance. -// -// The elements of the instance are stored in the map. -func NewMapTokenStore() PrivateTokenStore { - return &mapTokenStore{ - RWMutex: new(sync.RWMutex), - tokens: make(map[PrivateTokenKey]PrivateToken), - } -} - -// Store adds passed token to the map. -// -// Resulting error is always nil. -func (s *mapTokenStore) Store(key PrivateTokenKey, token PrivateToken) error { - s.Lock() - s.tokens[key] = token - s.Unlock() - - return nil -} - -// Fetch returns the map element corresponding to the given key. -// -// Returns ErrPrivateTokenNotFound is there is no element in map. -func (s *mapTokenStore) Fetch(key PrivateTokenKey) (PrivateToken, error) { - s.RLock() - defer s.RUnlock() - - t, ok := s.tokens[key] - if !ok { - return nil, ErrPrivateTokenNotFound - } - - return t, nil -} - -// RemoveExpired removes all the map elements that are expired in the passed epoch. -// -// Resulting error is always nil. -func (s *mapTokenStore) RemoveExpired(epoch uint64) error { - s.Lock() - - for key, token := range s.tokens { - if token.Expired(epoch) { - delete(s.tokens, key) - } - } - - s.Unlock() - - return nil -} diff --git a/session/store_test.go b/session/store_test.go deleted file mode 100644 index 74e0023..0000000 --- a/session/store_test.go +++ /dev/null @@ -1,111 +0,0 @@ -package session - -import ( - "testing" - - "github.com/nspcc-dev/neofs-api-go/refs" - "github.com/stretchr/testify/require" -) - -func TestMapTokenStore(t *testing.T) { - // create new private token - pToken, err := NewPrivateToken(0) - require.NoError(t, err) - - // create map token store - s := NewMapTokenStore() - - // create test TokenID - tid, err := refs.NewUUID() - require.NoError(t, err) - - // create test OwnerID - ownerID := OwnerID{1, 2, 3} - - key := PrivateTokenKey{} - key.SetOwnerID(ownerID) - key.SetTokenID(tid) - - // ascertain that there is no record for the key - _, err = s.Fetch(key) - require.EqualError(t, err, ErrPrivateTokenNotFound.Error()) - - // save private token record - require.NoError(t, s.Store(key, pToken)) - - // fetch private token by the key - res, err := s.Fetch(key) - require.NoError(t, err) - - // ascertain that returned token equals to initial - require.Equal(t, pToken, res) -} - -func TestMapTokenStore_RemoveExpired(t *testing.T) { - // create some epoch number - e1 := uint64(1) - - // create private token that expires after e1 - tok1, err := NewPrivateToken(e1) - require.NoError(t, err) - - // create some greater than e1 epoch number - e2 := e1 + 1 - - // create private token that expires after e2 - tok2, err := NewPrivateToken(e2) - require.NoError(t, err) - - // create token store instance - s := NewMapTokenStore() - - // create test PrivateTokenKey - key := PrivateTokenKey{} - key.SetOwnerID(OwnerID{1, 2, 3}) - - // create IDs for tokens - id1, err := refs.NewUUID() - require.NoError(t, err) - id2, err := refs.NewUUID() - require.NoError(t, err) - - assertPresence := func(ids ...TokenID) { - for i := range ids { - key.SetTokenID(ids[i]) - _, err = s.Fetch(key) - require.NoError(t, err) - } - } - - assertAbsence := func(ids ...TokenID) { - for i := range ids { - key.SetTokenID(ids[i]) - _, err = s.Fetch(key) - require.EqualError(t, err, ErrPrivateTokenNotFound.Error()) - } - } - - // store both tokens - key.SetTokenID(id1) - require.NoError(t, s.Store(key, tok1)) - key.SetTokenID(id2) - require.NoError(t, s.Store(key, tok2)) - - // ascertain that both tokens are available - assertPresence(id1, id2) - - // perform cleaning for epoch in which both tokens are not expired - require.NoError(t, s.RemoveExpired(e1)) - - // ascertain that both tokens are still available - assertPresence(id1, id2) - - // perform cleaning for epoch greater than e1 and not greater than e2 - require.NoError(t, s.RemoveExpired(e1+1)) - - // ascertain that tok1 was removed - assertAbsence(id1) - - // ascertain that tok2 was not removed - assertPresence(id2) -} diff --git a/session/types.go b/session/types.go deleted file mode 100644 index 95a0065..0000000 --- a/session/types.go +++ /dev/null @@ -1,80 +0,0 @@ -package session - -import ( - "context" - "crypto/ecdsa" - - "github.com/nspcc-dev/neofs-api-go/refs" - "github.com/nspcc-dev/neofs-api-go/service" -) - -// PrivateToken is an interface of session private part. -type PrivateToken interface { - // PrivateKey must return session private key. - PrivateKey() *ecdsa.PrivateKey - - // Expired must return true if and only if private token is expired in the given epoch number. - Expired(uint64) bool -} - -// PrivateTokenKey is a structure of private token storage key. -type PrivateTokenKey struct { - owner OwnerID - token TokenID -} - -// PrivateTokenSource is an interface of private token storage with read access. -type PrivateTokenSource interface { - // Fetch must return the storage record corresponding to the passed key. - // - // Resulting error must be ErrPrivateTokenNotFound if there is no corresponding record. - Fetch(PrivateTokenKey) (PrivateToken, error) -} - -// EpochLifetimeStore is an interface of the storage of elements that lifetime is limited by NeoFS epoch. -type EpochLifetimeStore interface { - // RemoveExpired must remove all elements that are expired in the given epoch. - RemoveExpired(uint64) error -} - -// PrivateTokenStore is an interface of the storage of private tokens addressable by TokenID. -type PrivateTokenStore interface { - PrivateTokenSource - EpochLifetimeStore - - // Store must save passed private token in the storage under the given key. - // - // Resulting error must be nil if private token was stored successfully. - Store(PrivateTokenKey, PrivateToken) error -} - -// KeyStore is an interface of the storage of public keys addressable by OwnerID, -type KeyStore interface { - // Get must return the storage record corresponding to the passed key. - // - // Resulting error must be ErrKeyNotFound if there is no corresponding record. - Get(context.Context, OwnerID) ([]*ecdsa.PublicKey, error) -} - -// CreateParamsSource is an interface of the container of session parameters with read access. -type CreateParamsSource interface { - refs.OwnerIDSource - service.LifetimeSource -} - -// CreateParamsContainer is an interface of the container of session parameters. -type CreateParamsContainer interface { - refs.OwnerIDContainer - service.LifetimeContainer -} - -// CreateResult is an interface of the container of an opened session info with read access. -type CreateResult interface { - service.TokenIDSource - service.SessionKeySource -} - -// Creator is an interface of the tool for a session opening. -type Creator interface { - Create(context.Context, CreateParamsSource) (CreateResult, error) -} diff --git a/state/service.go b/state/service.go deleted file mode 100644 index 577046c..0000000 --- a/state/service.go +++ /dev/null @@ -1,88 +0,0 @@ -package state - -import ( - "bytes" - "encoding/json" - "expvar" - "fmt" - - "github.com/golang/protobuf/proto" - "github.com/prometheus/client_golang/prometheus" - dto "github.com/prometheus/client_model/go" - "github.com/spf13/viper" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" -) - -// MetricFamily is type alias for proto.Message generated -// from github.com/prometheus/client_model/metrics.proto. -type MetricFamily = dto.MetricFamily - -// EncodeMetrics encodes metrics from gatherer into MetricsResponse message, -// if something went wrong returns gRPC Status error (can be returned from service). -func EncodeMetrics(g prometheus.Gatherer) (*MetricsResponse, error) { - metrics, err := g.Gather() - if err != nil { - return nil, status.New(codes.Internal, err.Error()).Err() - } - - results := make([][]byte, 0, len(metrics)) - for _, mf := range metrics { - item, err := proto.Marshal(mf) - if err != nil { - return nil, status.New(codes.Internal, err.Error()).Err() - } - - results = append(results, item) - } - - return &MetricsResponse{Metrics: results}, nil -} - -// DecodeMetrics decodes metrics from MetricsResponse to []MetricFamily, -// if something went wrong returns error. -func DecodeMetrics(r *MetricsResponse) ([]*MetricFamily, error) { - metrics := make([]*dto.MetricFamily, 0, len(r.Metrics)) - for i := range r.Metrics { - mf := new(MetricFamily) - if err := proto.Unmarshal(r.Metrics[i], mf); err != nil { - return nil, err - } - metrics = append(metrics, mf) - } - - return metrics, nil -} - -// EncodeConfig encodes viper settings into DumpConfig message, -// if something went wrong returns gRPC Status error (can be returned from service). -func EncodeConfig(v *viper.Viper) (*DumpResponse, error) { - data, err := json.Marshal(v.AllSettings()) - if err != nil { - return nil, status.Error(codes.Internal, err.Error()) - } - - return &DumpResponse{Config: data}, nil -} - -// EncodeVariables encodes debug variables into DumpVarsResponse message. -// Variables encoded into JSON and stored as slice of bytes. -func EncodeVariables() *DumpVarsResponse { - buf := new(bytes.Buffer) - buf.WriteString("{\n") - first := true - - expvar.Do(func(kv expvar.KeyValue) { - if !first { - buf.WriteString(",\n") - } - - first = false - - _, _ = fmt.Fprintf(buf, "%q: %s", kv.Key, kv.Value) - }) - - buf.WriteString("\n}\n") - - return &DumpVarsResponse{Variables: buf.Bytes()} -} diff --git a/state/service.pb.go b/state/service.pb.go deleted file mode 100644 index 187949b..0000000 --- a/state/service.pb.go +++ /dev/null @@ -1,2811 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: state/service.proto - -package state - -import ( - context "context" - fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/golang/protobuf/proto" - bootstrap "github.com/nspcc-dev/neofs-api-go/bootstrap" - service "github.com/nspcc-dev/neofs-api-go/service" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package - -type ChangeStateRequest_State int32 - -const ( - // Unknown is default value. Does nothing. - ChangeStateRequest_Unknown ChangeStateRequest_State = 0 - // Online used when need to set node to the online state. - ChangeStateRequest_Online ChangeStateRequest_State = 1 - // Offline used when need to set node to the offline state. - ChangeStateRequest_Offline ChangeStateRequest_State = 2 -) - -var ChangeStateRequest_State_name = map[int32]string{ - 0: "Unknown", - 1: "Online", - 2: "Offline", -} - -var ChangeStateRequest_State_value = map[string]int32{ - "Unknown": 0, - "Online": 1, - "Offline": 2, -} - -func (x ChangeStateRequest_State) String() string { - return proto.EnumName(ChangeStateRequest_State_name, int32(x)) -} - -func (ChangeStateRequest_State) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_695592f6f2fc97b7, []int{9, 0} -} - -// NetmapRequest message to request current node netmap -type NetmapRequest struct { - // RequestMetaHeader contains information about request meta headers (should be embedded into message) - service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` - // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) - service.RequestVerificationHeader `protobuf:"bytes,99,opt,name=Verify,proto3,embedded=Verify" json:"Verify"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *NetmapRequest) Reset() { *m = NetmapRequest{} } -func (m *NetmapRequest) String() string { return proto.CompactTextString(m) } -func (*NetmapRequest) ProtoMessage() {} -func (*NetmapRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_695592f6f2fc97b7, []int{0} -} -func (m *NetmapRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *NetmapRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *NetmapRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_NetmapRequest.Merge(m, src) -} -func (m *NetmapRequest) XXX_Size() int { - return m.Size() -} -func (m *NetmapRequest) XXX_DiscardUnknown() { - xxx_messageInfo_NetmapRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_NetmapRequest proto.InternalMessageInfo - -// MetricsRequest message to request node metrics -type MetricsRequest struct { - // RequestMetaHeader contains information about request meta headers (should be embedded into message) - service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` - // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) - service.RequestVerificationHeader `protobuf:"bytes,99,opt,name=Verify,proto3,embedded=Verify" json:"Verify"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *MetricsRequest) Reset() { *m = MetricsRequest{} } -func (m *MetricsRequest) String() string { return proto.CompactTextString(m) } -func (*MetricsRequest) ProtoMessage() {} -func (*MetricsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_695592f6f2fc97b7, []int{1} -} -func (m *MetricsRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MetricsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *MetricsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_MetricsRequest.Merge(m, src) -} -func (m *MetricsRequest) XXX_Size() int { - return m.Size() -} -func (m *MetricsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_MetricsRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_MetricsRequest proto.InternalMessageInfo - -// MetricsResponse contains [][]byte, -// every []byte is marshaled MetricFamily proto message -// from github.com/prometheus/client_model/metrics.proto -type MetricsResponse struct { - Metrics [][]byte `protobuf:"bytes,1,rep,name=Metrics,proto3" json:"Metrics,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *MetricsResponse) Reset() { *m = MetricsResponse{} } -func (m *MetricsResponse) String() string { return proto.CompactTextString(m) } -func (*MetricsResponse) ProtoMessage() {} -func (*MetricsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_695592f6f2fc97b7, []int{2} -} -func (m *MetricsResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MetricsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *MetricsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MetricsResponse.Merge(m, src) -} -func (m *MetricsResponse) XXX_Size() int { - return m.Size() -} -func (m *MetricsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MetricsResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MetricsResponse proto.InternalMessageInfo - -func (m *MetricsResponse) GetMetrics() [][]byte { - if m != nil { - return m.Metrics - } - return nil -} - -// HealthRequest message to check current state -type HealthRequest struct { - // RequestMetaHeader contains information about request meta headers (should be embedded into message) - service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` - // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) - service.RequestVerificationHeader `protobuf:"bytes,99,opt,name=Verify,proto3,embedded=Verify" json:"Verify"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *HealthRequest) Reset() { *m = HealthRequest{} } -func (m *HealthRequest) String() string { return proto.CompactTextString(m) } -func (*HealthRequest) ProtoMessage() {} -func (*HealthRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_695592f6f2fc97b7, []int{3} -} -func (m *HealthRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *HealthRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *HealthRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_HealthRequest.Merge(m, src) -} -func (m *HealthRequest) XXX_Size() int { - return m.Size() -} -func (m *HealthRequest) XXX_DiscardUnknown() { - xxx_messageInfo_HealthRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_HealthRequest proto.InternalMessageInfo - -// HealthResponse message with current state -type HealthResponse struct { - // Healthy is true when node alive and healthy - Healthy bool `protobuf:"varint,1,opt,name=Healthy,proto3" json:"Healthy,omitempty"` - // Status contains detailed information about health status - Status string `protobuf:"bytes,2,opt,name=Status,proto3" json:"Status,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *HealthResponse) Reset() { *m = HealthResponse{} } -func (m *HealthResponse) String() string { return proto.CompactTextString(m) } -func (*HealthResponse) ProtoMessage() {} -func (*HealthResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_695592f6f2fc97b7, []int{4} -} -func (m *HealthResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *HealthResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *HealthResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_HealthResponse.Merge(m, src) -} -func (m *HealthResponse) XXX_Size() int { - return m.Size() -} -func (m *HealthResponse) XXX_DiscardUnknown() { - xxx_messageInfo_HealthResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_HealthResponse proto.InternalMessageInfo - -func (m *HealthResponse) GetHealthy() bool { - if m != nil { - return m.Healthy - } - return false -} - -func (m *HealthResponse) GetStatus() string { - if m != nil { - return m.Status - } - return "" -} - -// DumpRequest message to fetch current server config. -type DumpRequest struct { - // RequestMetaHeader contains information about request meta headers (should be embedded into message) - service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` - // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) - service.RequestVerificationHeader `protobuf:"bytes,99,opt,name=Verify,proto3,embedded=Verify" json:"Verify"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *DumpRequest) Reset() { *m = DumpRequest{} } -func (m *DumpRequest) String() string { return proto.CompactTextString(m) } -func (*DumpRequest) ProtoMessage() {} -func (*DumpRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_695592f6f2fc97b7, []int{5} -} -func (m *DumpRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *DumpRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *DumpRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_DumpRequest.Merge(m, src) -} -func (m *DumpRequest) XXX_Size() int { - return m.Size() -} -func (m *DumpRequest) XXX_DiscardUnknown() { - xxx_messageInfo_DumpRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_DumpRequest proto.InternalMessageInfo - -// DumpResponse message contains current server config. -// Config stored in JSON encoded into slice of bytes. -type DumpResponse struct { - Config []byte `protobuf:"bytes,1,opt,name=Config,proto3" json:"Config,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *DumpResponse) Reset() { *m = DumpResponse{} } -func (m *DumpResponse) String() string { return proto.CompactTextString(m) } -func (*DumpResponse) ProtoMessage() {} -func (*DumpResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_695592f6f2fc97b7, []int{6} -} -func (m *DumpResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *DumpResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *DumpResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_DumpResponse.Merge(m, src) -} -func (m *DumpResponse) XXX_Size() int { - return m.Size() -} -func (m *DumpResponse) XXX_DiscardUnknown() { - xxx_messageInfo_DumpResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_DumpResponse proto.InternalMessageInfo - -func (m *DumpResponse) GetConfig() []byte { - if m != nil { - return m.Config - } - return nil -} - -// DumpVarsRequest message to fetch current server debug variables. -type DumpVarsRequest struct { - // RequestMetaHeader contains information about request meta headers (should be embedded into message) - service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` - // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) - service.RequestVerificationHeader `protobuf:"bytes,99,opt,name=Verify,proto3,embedded=Verify" json:"Verify"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *DumpVarsRequest) Reset() { *m = DumpVarsRequest{} } -func (m *DumpVarsRequest) String() string { return proto.CompactTextString(m) } -func (*DumpVarsRequest) ProtoMessage() {} -func (*DumpVarsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_695592f6f2fc97b7, []int{7} -} -func (m *DumpVarsRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *DumpVarsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *DumpVarsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_DumpVarsRequest.Merge(m, src) -} -func (m *DumpVarsRequest) XXX_Size() int { - return m.Size() -} -func (m *DumpVarsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_DumpVarsRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_DumpVarsRequest proto.InternalMessageInfo - -// DumpVarsResponse message contains current server debug variables. -// Variables stored in JSON encoded into slice of bytes. -type DumpVarsResponse struct { - Variables []byte `protobuf:"bytes,1,opt,name=Variables,proto3" json:"Variables,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *DumpVarsResponse) Reset() { *m = DumpVarsResponse{} } -func (m *DumpVarsResponse) String() string { return proto.CompactTextString(m) } -func (*DumpVarsResponse) ProtoMessage() {} -func (*DumpVarsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_695592f6f2fc97b7, []int{8} -} -func (m *DumpVarsResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *DumpVarsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *DumpVarsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_DumpVarsResponse.Merge(m, src) -} -func (m *DumpVarsResponse) XXX_Size() int { - return m.Size() -} -func (m *DumpVarsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_DumpVarsResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_DumpVarsResponse proto.InternalMessageInfo - -func (m *DumpVarsResponse) GetVariables() []byte { - if m != nil { - return m.Variables - } - return nil -} - -// ChangeStateRequest contains a new state of node. -type ChangeStateRequest struct { - // State is a new state of node. - State ChangeStateRequest_State `protobuf:"varint,1,opt,name=state,proto3,enum=state.ChangeStateRequest_State" json:"state,omitempty"` - // RequestMetaHeader contains information about request meta headers (should be embedded into message) - service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` - // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) - service.RequestVerificationHeader `protobuf:"bytes,99,opt,name=Verify,proto3,embedded=Verify" json:"Verify"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ChangeStateRequest) Reset() { *m = ChangeStateRequest{} } -func (m *ChangeStateRequest) String() string { return proto.CompactTextString(m) } -func (*ChangeStateRequest) ProtoMessage() {} -func (*ChangeStateRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_695592f6f2fc97b7, []int{9} -} -func (m *ChangeStateRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ChangeStateRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *ChangeStateRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_ChangeStateRequest.Merge(m, src) -} -func (m *ChangeStateRequest) XXX_Size() int { - return m.Size() -} -func (m *ChangeStateRequest) XXX_DiscardUnknown() { - xxx_messageInfo_ChangeStateRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_ChangeStateRequest proto.InternalMessageInfo - -func (m *ChangeStateRequest) GetState() ChangeStateRequest_State { - if m != nil { - return m.State - } - return ChangeStateRequest_Unknown -} - -// ChangeStateResponse is an empty response, that returns when RPC invoked without errors. -type ChangeStateResponse struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ChangeStateResponse) Reset() { *m = ChangeStateResponse{} } -func (m *ChangeStateResponse) String() string { return proto.CompactTextString(m) } -func (*ChangeStateResponse) ProtoMessage() {} -func (*ChangeStateResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_695592f6f2fc97b7, []int{10} -} -func (m *ChangeStateResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ChangeStateResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *ChangeStateResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_ChangeStateResponse.Merge(m, src) -} -func (m *ChangeStateResponse) XXX_Size() int { - return m.Size() -} -func (m *ChangeStateResponse) XXX_DiscardUnknown() { - xxx_messageInfo_ChangeStateResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_ChangeStateResponse proto.InternalMessageInfo - -func init() { - proto.RegisterEnum("state.ChangeStateRequest_State", ChangeStateRequest_State_name, ChangeStateRequest_State_value) - proto.RegisterType((*NetmapRequest)(nil), "state.NetmapRequest") - proto.RegisterType((*MetricsRequest)(nil), "state.MetricsRequest") - proto.RegisterType((*MetricsResponse)(nil), "state.MetricsResponse") - proto.RegisterType((*HealthRequest)(nil), "state.HealthRequest") - proto.RegisterType((*HealthResponse)(nil), "state.HealthResponse") - proto.RegisterType((*DumpRequest)(nil), "state.DumpRequest") - proto.RegisterType((*DumpResponse)(nil), "state.DumpResponse") - proto.RegisterType((*DumpVarsRequest)(nil), "state.DumpVarsRequest") - proto.RegisterType((*DumpVarsResponse)(nil), "state.DumpVarsResponse") - proto.RegisterType((*ChangeStateRequest)(nil), "state.ChangeStateRequest") - proto.RegisterType((*ChangeStateResponse)(nil), "state.ChangeStateResponse") -} - -func init() { proto.RegisterFile("state/service.proto", fileDescriptor_695592f6f2fc97b7) } - -var fileDescriptor_695592f6f2fc97b7 = []byte{ - // 619 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x55, 0xc1, 0x6e, 0xd3, 0x4c, - 0x10, 0xee, 0xe6, 0xff, 0xeb, 0xb6, 0x93, 0xd2, 0x56, 0xdb, 0x26, 0x18, 0x0b, 0xa5, 0x91, 0x0f, - 0x10, 0x09, 0xc5, 0x46, 0x85, 0x4a, 0x15, 0x9c, 0x68, 0x2b, 0x54, 0x0e, 0x6d, 0x91, 0x2b, 0x7a, - 0xe0, 0xb6, 0x76, 0xc7, 0x8e, 0xd5, 0xc6, 0x6b, 0xbc, 0x9b, 0xa2, 0x3e, 0x04, 0x02, 0x6e, 0x3c, - 0x03, 0x4f, 0xd2, 0x63, 0x8f, 0x9c, 0x2a, 0x14, 0xee, 0x3c, 0x00, 0x27, 0x94, 0xdd, 0x75, 0x9a, - 0x34, 0x70, 0x26, 0xb7, 0x7c, 0xdf, 0xcc, 0xb7, 0xf9, 0x66, 0x77, 0x66, 0x0c, 0xab, 0x42, 0x32, - 0x89, 0xbe, 0xc0, 0xe2, 0x3c, 0x8d, 0xd0, 0xcb, 0x0b, 0x2e, 0x39, 0x9d, 0x55, 0xa4, 0x43, 0x0d, - 0xeb, 0x77, 0x51, 0x32, 0x1d, 0x72, 0xd6, 0x4a, 0xee, 0x1c, 0x8b, 0x34, 0xbe, 0x30, 0x6c, 0x2d, - 0xe4, 0x5c, 0x0a, 0x59, 0xb0, 0xdc, 0x97, 0x17, 0x39, 0x0a, 0x43, 0xb7, 0x93, 0x54, 0x76, 0x7a, - 0xa1, 0x17, 0xf1, 0xae, 0x9f, 0xf0, 0x84, 0xfb, 0x8a, 0x0e, 0x7b, 0xb1, 0x42, 0x0a, 0xa8, 0x5f, - 0x3a, 0xdd, 0xfd, 0x48, 0xe0, 0xce, 0x01, 0xca, 0x2e, 0xcb, 0x03, 0x7c, 0xd7, 0x43, 0x21, 0xe9, - 0x16, 0xfc, 0xbf, 0x8f, 0x92, 0xd9, 0x61, 0x93, 0xb4, 0xaa, 0x1b, 0x8e, 0x57, 0xda, 0x34, 0xf1, - 0x41, 0x6c, 0x0f, 0xd9, 0x09, 0x16, 0xdb, 0xf3, 0x97, 0xd7, 0xeb, 0x33, 0x57, 0xd7, 0xeb, 0x24, - 0x50, 0x0a, 0xba, 0x0b, 0xd6, 0xb1, 0x72, 0x68, 0x47, 0x4a, 0xeb, 0xde, 0xd6, 0xaa, 0x68, 0x1a, - 0x31, 0x99, 0xf2, 0x6c, 0xe2, 0x0c, 0xa3, 0x75, 0x3f, 0x11, 0x58, 0xda, 0x47, 0x59, 0xa4, 0x91, - 0x98, 0x16, 0x4b, 0x8f, 0x60, 0x79, 0xe8, 0x48, 0xe4, 0x3c, 0x13, 0x48, 0x6d, 0x98, 0x33, 0x94, - 0x4d, 0x9a, 0xff, 0xb5, 0x16, 0x83, 0x12, 0xaa, 0x1b, 0xdd, 0x43, 0x76, 0x26, 0x3b, 0xd3, 0x62, - 0x7f, 0x1b, 0x96, 0x4a, 0x43, 0x37, 0xee, 0x35, 0x73, 0x61, 0x93, 0x26, 0x69, 0xcd, 0x07, 0x25, - 0xa4, 0x75, 0xb0, 0x8e, 0x24, 0x93, 0x3d, 0x61, 0x57, 0x9a, 0xa4, 0xb5, 0x10, 0x18, 0xe4, 0x7e, - 0x20, 0x50, 0xdd, 0xed, 0x75, 0xa7, 0xa6, 0x4b, 0x1e, 0xc0, 0xa2, 0xb6, 0x63, 0x2a, 0xaa, 0x83, - 0xb5, 0xc3, 0xb3, 0x38, 0x4d, 0x54, 0x41, 0x8b, 0x81, 0x41, 0xee, 0x67, 0x02, 0xcb, 0x83, 0xc4, - 0x63, 0x56, 0x4c, 0x4d, 0x3b, 0x3d, 0x86, 0x95, 0x1b, 0x4b, 0xc6, 0xff, 0x7d, 0x58, 0x38, 0x66, - 0x45, 0xca, 0xc2, 0x33, 0x14, 0xa6, 0x84, 0x1b, 0xc2, 0xfd, 0x45, 0x80, 0xee, 0x74, 0x58, 0x96, - 0xe0, 0xe0, 0x39, 0xb0, 0x2c, 0x64, 0x13, 0xf4, 0xd6, 0x50, 0x82, 0xa5, 0x8d, 0x75, 0x4f, 0x21, - 0x6f, 0x32, 0xd3, 0xd3, 0x40, 0x67, 0xff, 0xf3, 0xfa, 0xdb, 0x30, 0xab, 0xfc, 0xd0, 0x2a, 0xcc, - 0xbd, 0xc9, 0x4e, 0x33, 0xfe, 0x3e, 0x5b, 0x99, 0xa1, 0x00, 0xd6, 0x61, 0x76, 0x96, 0x66, 0xb8, - 0x42, 0x06, 0x81, 0xc3, 0x38, 0x56, 0xa0, 0xe2, 0xd6, 0x60, 0x75, 0xac, 0x22, 0x7d, 0x63, 0x1b, - 0x3f, 0x2b, 0x65, 0xab, 0xd2, 0xa7, 0x60, 0xe9, 0x1d, 0x46, 0xd7, 0xcc, 0x15, 0x8c, 0xad, 0x34, - 0x67, 0xcd, 0x1b, 0xee, 0x4a, 0xef, 0x28, 0x2f, 0x90, 0x9d, 0xec, 0xb3, 0x9c, 0x6e, 0x0d, 0x47, - 0x98, 0xd6, 0x8c, 0x6c, 0x7c, 0xef, 0x38, 0xf5, 0xdb, 0xb4, 0x79, 0xac, 0x67, 0x50, 0xd5, 0xf3, - 0xb2, 0xd3, 0xc1, 0xe8, 0x74, 0xf8, 0xa7, 0x63, 0x53, 0xef, 0xd4, 0x6e, 0xb1, 0x46, 0xbb, 0x09, - 0x30, 0x78, 0x7c, 0xdd, 0x9e, 0x94, 0x9a, 0xa4, 0x91, 0xd1, 0x72, 0x56, 0xc7, 0x38, 0x23, 0x7b, - 0x0e, 0xf3, 0x65, 0xcf, 0xd0, 0xfa, 0x48, 0xc2, 0x48, 0x5f, 0x3b, 0x77, 0x27, 0x78, 0x23, 0xde, - 0x85, 0xea, 0xc8, 0x0d, 0xd2, 0x7b, 0x7f, 0xed, 0x13, 0xc7, 0xf9, 0x53, 0x48, 0x9f, 0xb2, 0x7d, - 0x78, 0xd9, 0x6f, 0x90, 0xab, 0x7e, 0x83, 0x7c, 0xeb, 0x37, 0xc8, 0xf7, 0x7e, 0x83, 0x7c, 0xf9, - 0xd1, 0x98, 0x79, 0xfb, 0x70, 0xe4, 0x7b, 0x93, 0x89, 0x3c, 0x8a, 0xda, 0x27, 0x78, 0xee, 0x67, - 0xc8, 0x63, 0xd1, 0x66, 0x79, 0xda, 0x4e, 0xb8, 0xaf, 0x8e, 0xfc, 0x5a, 0x59, 0x3e, 0x40, 0xfe, - 0xf2, 0xc8, 0x7b, 0xf1, 0xfa, 0x95, 0x6e, 0xc7, 0xd0, 0x52, 0x9f, 0xa0, 0x27, 0xbf, 0x03, 0x00, - 0x00, 0xff, 0xff, 0x8c, 0xdd, 0xa7, 0x55, 0x10, 0x07, 0x00, 0x00, -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 - -// StatusClient is the client API for Status service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type StatusClient interface { - // Netmap request allows to receive current [bootstrap.SpreadMap](bootstrap.md#bootstrap.SpreadMap) - Netmap(ctx context.Context, in *NetmapRequest, opts ...grpc.CallOption) (*bootstrap.SpreadMap, error) - // Metrics request allows to receive metrics in prometheus format - Metrics(ctx context.Context, in *MetricsRequest, opts ...grpc.CallOption) (*MetricsResponse, error) - // HealthCheck request allows to check health status of the node. - // If node unhealthy field Status would contains detailed info. - HealthCheck(ctx context.Context, in *HealthRequest, opts ...grpc.CallOption) (*HealthResponse, error) - // DumpConfig request allows dumping settings for the current node. - // To permit access, used server config options. - // The request should be signed. - DumpConfig(ctx context.Context, in *DumpRequest, opts ...grpc.CallOption) (*DumpResponse, error) - // DumpVars returns debug variables for the current node. - // To permit access, used server config options. - // The request should be signed. - DumpVars(ctx context.Context, in *DumpVarsRequest, opts ...grpc.CallOption) (*DumpVarsResponse, error) - // ChangeState allows to change current node state of node. - // To permit access, used server config options. - // The request should be signed. - ChangeState(ctx context.Context, in *ChangeStateRequest, opts ...grpc.CallOption) (*ChangeStateResponse, error) -} - -type statusClient struct { - cc *grpc.ClientConn -} - -func NewStatusClient(cc *grpc.ClientConn) StatusClient { - return &statusClient{cc} -} - -func (c *statusClient) Netmap(ctx context.Context, in *NetmapRequest, opts ...grpc.CallOption) (*bootstrap.SpreadMap, error) { - out := new(bootstrap.SpreadMap) - err := c.cc.Invoke(ctx, "/state.Status/Netmap", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *statusClient) Metrics(ctx context.Context, in *MetricsRequest, opts ...grpc.CallOption) (*MetricsResponse, error) { - out := new(MetricsResponse) - err := c.cc.Invoke(ctx, "/state.Status/Metrics", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *statusClient) HealthCheck(ctx context.Context, in *HealthRequest, opts ...grpc.CallOption) (*HealthResponse, error) { - out := new(HealthResponse) - err := c.cc.Invoke(ctx, "/state.Status/HealthCheck", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *statusClient) DumpConfig(ctx context.Context, in *DumpRequest, opts ...grpc.CallOption) (*DumpResponse, error) { - out := new(DumpResponse) - err := c.cc.Invoke(ctx, "/state.Status/DumpConfig", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *statusClient) DumpVars(ctx context.Context, in *DumpVarsRequest, opts ...grpc.CallOption) (*DumpVarsResponse, error) { - out := new(DumpVarsResponse) - err := c.cc.Invoke(ctx, "/state.Status/DumpVars", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *statusClient) ChangeState(ctx context.Context, in *ChangeStateRequest, opts ...grpc.CallOption) (*ChangeStateResponse, error) { - out := new(ChangeStateResponse) - err := c.cc.Invoke(ctx, "/state.Status/ChangeState", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// StatusServer is the server API for Status service. -type StatusServer interface { - // Netmap request allows to receive current [bootstrap.SpreadMap](bootstrap.md#bootstrap.SpreadMap) - Netmap(context.Context, *NetmapRequest) (*bootstrap.SpreadMap, error) - // Metrics request allows to receive metrics in prometheus format - Metrics(context.Context, *MetricsRequest) (*MetricsResponse, error) - // HealthCheck request allows to check health status of the node. - // If node unhealthy field Status would contains detailed info. - HealthCheck(context.Context, *HealthRequest) (*HealthResponse, error) - // DumpConfig request allows dumping settings for the current node. - // To permit access, used server config options. - // The request should be signed. - DumpConfig(context.Context, *DumpRequest) (*DumpResponse, error) - // DumpVars returns debug variables for the current node. - // To permit access, used server config options. - // The request should be signed. - DumpVars(context.Context, *DumpVarsRequest) (*DumpVarsResponse, error) - // ChangeState allows to change current node state of node. - // To permit access, used server config options. - // The request should be signed. - ChangeState(context.Context, *ChangeStateRequest) (*ChangeStateResponse, error) -} - -// UnimplementedStatusServer can be embedded to have forward compatible implementations. -type UnimplementedStatusServer struct { -} - -func (*UnimplementedStatusServer) Netmap(ctx context.Context, req *NetmapRequest) (*bootstrap.SpreadMap, error) { - return nil, status.Errorf(codes.Unimplemented, "method Netmap not implemented") -} -func (*UnimplementedStatusServer) Metrics(ctx context.Context, req *MetricsRequest) (*MetricsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Metrics not implemented") -} -func (*UnimplementedStatusServer) HealthCheck(ctx context.Context, req *HealthRequest) (*HealthResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method HealthCheck not implemented") -} -func (*UnimplementedStatusServer) DumpConfig(ctx context.Context, req *DumpRequest) (*DumpResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method DumpConfig not implemented") -} -func (*UnimplementedStatusServer) DumpVars(ctx context.Context, req *DumpVarsRequest) (*DumpVarsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method DumpVars not implemented") -} -func (*UnimplementedStatusServer) ChangeState(ctx context.Context, req *ChangeStateRequest) (*ChangeStateResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ChangeState not implemented") -} - -func RegisterStatusServer(s *grpc.Server, srv StatusServer) { - s.RegisterService(&_Status_serviceDesc, srv) -} - -func _Status_Netmap_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(NetmapRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(StatusServer).Netmap(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/state.Status/Netmap", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(StatusServer).Netmap(ctx, req.(*NetmapRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Status_Metrics_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MetricsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(StatusServer).Metrics(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/state.Status/Metrics", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(StatusServer).Metrics(ctx, req.(*MetricsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Status_HealthCheck_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(HealthRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(StatusServer).HealthCheck(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/state.Status/HealthCheck", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(StatusServer).HealthCheck(ctx, req.(*HealthRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Status_DumpConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(DumpRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(StatusServer).DumpConfig(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/state.Status/DumpConfig", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(StatusServer).DumpConfig(ctx, req.(*DumpRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Status_DumpVars_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(DumpVarsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(StatusServer).DumpVars(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/state.Status/DumpVars", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(StatusServer).DumpVars(ctx, req.(*DumpVarsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Status_ChangeState_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ChangeStateRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(StatusServer).ChangeState(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/state.Status/ChangeState", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(StatusServer).ChangeState(ctx, req.(*ChangeStateRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _Status_serviceDesc = grpc.ServiceDesc{ - ServiceName: "state.Status", - HandlerType: (*StatusServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Netmap", - Handler: _Status_Netmap_Handler, - }, - { - MethodName: "Metrics", - Handler: _Status_Metrics_Handler, - }, - { - MethodName: "HealthCheck", - Handler: _Status_HealthCheck_Handler, - }, - { - MethodName: "DumpConfig", - Handler: _Status_DumpConfig_Handler, - }, - { - MethodName: "DumpVars", - Handler: _Status_DumpVars_Handler, - }, - { - MethodName: "ChangeState", - Handler: _Status_ChangeState_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "state/service.proto", -} - -func (m *NetmapRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *NetmapRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *NetmapRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - { - size, err := m.RequestVerificationHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x6 - i-- - dAtA[i] = 0x9a - { - size, err := m.RequestMetaHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x6 - i-- - dAtA[i] = 0x92 - return len(dAtA) - i, nil -} - -func (m *MetricsRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MetricsRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MetricsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - { - size, err := m.RequestVerificationHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x6 - i-- - dAtA[i] = 0x9a - { - size, err := m.RequestMetaHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x6 - i-- - dAtA[i] = 0x92 - return len(dAtA) - i, nil -} - -func (m *MetricsResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MetricsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MetricsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.Metrics) > 0 { - for iNdEx := len(m.Metrics) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Metrics[iNdEx]) - copy(dAtA[i:], m.Metrics[iNdEx]) - i = encodeVarintService(dAtA, i, uint64(len(m.Metrics[iNdEx]))) - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *HealthRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *HealthRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *HealthRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - { - size, err := m.RequestVerificationHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x6 - i-- - dAtA[i] = 0x9a - { - size, err := m.RequestMetaHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x6 - i-- - dAtA[i] = 0x92 - return len(dAtA) - i, nil -} - -func (m *HealthResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *HealthResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *HealthResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.Status) > 0 { - i -= len(m.Status) - copy(dAtA[i:], m.Status) - i = encodeVarintService(dAtA, i, uint64(len(m.Status))) - i-- - dAtA[i] = 0x12 - } - if m.Healthy { - i-- - if m.Healthy { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *DumpRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *DumpRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *DumpRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - { - size, err := m.RequestVerificationHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x6 - i-- - dAtA[i] = 0x9a - { - size, err := m.RequestMetaHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x6 - i-- - dAtA[i] = 0x92 - return len(dAtA) - i, nil -} - -func (m *DumpResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *DumpResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *DumpResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.Config) > 0 { - i -= len(m.Config) - copy(dAtA[i:], m.Config) - i = encodeVarintService(dAtA, i, uint64(len(m.Config))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *DumpVarsRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *DumpVarsRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *DumpVarsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - { - size, err := m.RequestVerificationHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x6 - i-- - dAtA[i] = 0x9a - { - size, err := m.RequestMetaHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x6 - i-- - dAtA[i] = 0x92 - return len(dAtA) - i, nil -} - -func (m *DumpVarsResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *DumpVarsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *DumpVarsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.Variables) > 0 { - i -= len(m.Variables) - copy(dAtA[i:], m.Variables) - i = encodeVarintService(dAtA, i, uint64(len(m.Variables))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *ChangeStateRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ChangeStateRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ChangeStateRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - { - size, err := m.RequestVerificationHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x6 - i-- - dAtA[i] = 0x9a - { - size, err := m.RequestMetaHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x6 - i-- - dAtA[i] = 0x92 - if m.State != 0 { - i = encodeVarintService(dAtA, i, uint64(m.State)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *ChangeStateResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ChangeStateResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ChangeStateResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - return len(dAtA) - i, nil -} - -func encodeVarintService(dAtA []byte, offset int, v uint64) int { - offset -= sovService(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *NetmapRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.RequestMetaHeader.Size() - n += 2 + l + sovService(uint64(l)) - l = m.RequestVerificationHeader.Size() - n += 2 + l + sovService(uint64(l)) - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *MetricsRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.RequestMetaHeader.Size() - n += 2 + l + sovService(uint64(l)) - l = m.RequestVerificationHeader.Size() - n += 2 + l + sovService(uint64(l)) - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *MetricsResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Metrics) > 0 { - for _, b := range m.Metrics { - l = len(b) - n += 1 + l + sovService(uint64(l)) - } - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *HealthRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.RequestMetaHeader.Size() - n += 2 + l + sovService(uint64(l)) - l = m.RequestVerificationHeader.Size() - n += 2 + l + sovService(uint64(l)) - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *HealthResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Healthy { - n += 2 - } - l = len(m.Status) - if l > 0 { - n += 1 + l + sovService(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *DumpRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.RequestMetaHeader.Size() - n += 2 + l + sovService(uint64(l)) - l = m.RequestVerificationHeader.Size() - n += 2 + l + sovService(uint64(l)) - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *DumpResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Config) - if l > 0 { - n += 1 + l + sovService(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *DumpVarsRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.RequestMetaHeader.Size() - n += 2 + l + sovService(uint64(l)) - l = m.RequestVerificationHeader.Size() - n += 2 + l + sovService(uint64(l)) - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *DumpVarsResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Variables) - if l > 0 { - n += 1 + l + sovService(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *ChangeStateRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.State != 0 { - n += 1 + sovService(uint64(m.State)) - } - l = m.RequestMetaHeader.Size() - n += 2 + l + sovService(uint64(l)) - l = m.RequestVerificationHeader.Size() - n += 2 + l + sovService(uint64(l)) - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *ChangeStateResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func sovService(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozService(x uint64) (n int) { - return sovService(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *NetmapRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: NetmapRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: NetmapRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 98: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.RequestMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 99: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RequestVerificationHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.RequestVerificationHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MetricsRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MetricsRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MetricsRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 98: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.RequestMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 99: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RequestVerificationHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.RequestVerificationHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MetricsResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MetricsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MetricsResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Metrics", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Metrics = append(m.Metrics, make([]byte, postIndex-iNdEx)) - copy(m.Metrics[len(m.Metrics)-1], dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *HealthRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: HealthRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: HealthRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 98: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.RequestMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 99: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RequestVerificationHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.RequestVerificationHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *HealthResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: HealthResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: HealthResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Healthy", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Healthy = bool(v != 0) - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Status = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *DumpRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: DumpRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: DumpRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 98: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.RequestMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 99: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RequestVerificationHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.RequestVerificationHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *DumpResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: DumpResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: DumpResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Config", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Config = append(m.Config[:0], dAtA[iNdEx:postIndex]...) - if m.Config == nil { - m.Config = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *DumpVarsRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: DumpVarsRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: DumpVarsRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 98: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.RequestMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 99: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RequestVerificationHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.RequestVerificationHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *DumpVarsResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: DumpVarsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: DumpVarsResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Variables", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Variables = append(m.Variables[:0], dAtA[iNdEx:postIndex]...) - if m.Variables == nil { - m.Variables = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ChangeStateRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ChangeStateRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ChangeStateRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field State", wireType) - } - m.State = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.State |= ChangeStateRequest_State(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 98: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.RequestMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 99: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RequestVerificationHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.RequestVerificationHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ChangeStateResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ChangeStateResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ChangeStateResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipService(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowService - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowService - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowService - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthService - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupService - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthService - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthService = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowService = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupService = fmt.Errorf("proto: unexpected end of group") -) diff --git a/state/service.proto b/state/service.proto deleted file mode 100644 index 410a000..0000000 --- a/state/service.proto +++ /dev/null @@ -1,124 +0,0 @@ -syntax = "proto3"; -package state; -option go_package = "github.com/nspcc-dev/neofs-api-go/state"; -option csharp_namespace = "NeoFS.API.State"; - -import "service/meta.proto"; -import "service/verify.proto"; -import "bootstrap/types.proto"; -import "github.com/gogo/protobuf/gogoproto/gogo.proto"; - -option (gogoproto.stable_marshaler_all) = true; - -// Status service provides node's healthcheck and status info. -// TODO: decide how to describe auth and were contains permissions. -service Status { - // Netmap request allows to receive current [bootstrap.SpreadMap](bootstrap.md#bootstrap.SpreadMap) - rpc Netmap(NetmapRequest) returns (bootstrap.SpreadMap); - // Metrics request allows to receive metrics in prometheus format - rpc Metrics(MetricsRequest) returns (MetricsResponse); - // HealthCheck request allows to check health status of the node. - // If node unhealthy field Status would contains detailed info. - rpc HealthCheck(HealthRequest) returns (HealthResponse); - // DumpConfig request allows dumping settings for the current node. - // To permit access, used server config options. - // The request should be signed. - rpc DumpConfig(DumpRequest) returns (DumpResponse); - // DumpVars returns debug variables for the current node. - // To permit access, used server config options. - // The request should be signed. - rpc DumpVars(DumpVarsRequest) returns (DumpVarsResponse); - // ChangeState allows to change current node state of node. - // To permit access, used server config options. - // The request should be signed. - rpc ChangeState(ChangeStateRequest) returns (ChangeStateResponse); -} - -// NetmapRequest message to request current node netmap -message NetmapRequest { - // RequestMetaHeader contains information about request meta headers (should be embedded into message) - service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; - // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) - service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; -} - -// MetricsRequest message to request node metrics -message MetricsRequest { - // RequestMetaHeader contains information about request meta headers (should be embedded into message) - service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; - // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) - service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; -} - -// MetricsResponse contains [][]byte, -// every []byte is marshaled MetricFamily proto message -// from github.com/prometheus/client_model/metrics.proto -message MetricsResponse { - repeated bytes Metrics = 1; -} - -// HealthRequest message to check current state -message HealthRequest { - // RequestMetaHeader contains information about request meta headers (should be embedded into message) - service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; - // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) - service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; -} - -// HealthResponse message with current state -message HealthResponse { - // Healthy is true when node alive and healthy - bool Healthy = 1; - // Status contains detailed information about health status - string Status = 2; -} - -// DumpRequest message to fetch current server config. -message DumpRequest { - // RequestMetaHeader contains information about request meta headers (should be embedded into message) - service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; - // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) - service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; -} - -// DumpResponse message contains current server config. -// Config stored in JSON encoded into slice of bytes. -message DumpResponse { - bytes Config = 1; -} - -// DumpVarsRequest message to fetch current server debug variables. -message DumpVarsRequest { - // RequestMetaHeader contains information about request meta headers (should be embedded into message) - service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; - // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) - service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; -} - -// DumpVarsResponse message contains current server debug variables. -// Variables stored in JSON encoded into slice of bytes. -message DumpVarsResponse { - bytes Variables = 1; -} - -// ChangeStateRequest contains a new state of node. -message ChangeStateRequest { - enum State { - // Unknown is default value. Does nothing. - Unknown = 0; - // Online used when need to set node to the online state. - Online = 1; - // Offline used when need to set node to the offline state. - Offline = 2; - } - - // State is a new state of node. - State state = 1; - // RequestMetaHeader contains information about request meta headers (should be embedded into message) - service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; - // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) - service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; -} - -// ChangeStateResponse is an empty response, that returns when RPC invoked without errors. -message ChangeStateResponse {} \ No newline at end of file diff --git a/state/service_test.go b/state/service_test.go deleted file mode 100644 index d545cb0..0000000 --- a/state/service_test.go +++ /dev/null @@ -1,118 +0,0 @@ -package state - -import ( - "bytes" - "encoding/json" - "expvar" - "testing" - - "github.com/prometheus/client_golang/prometheus" - "github.com/spf13/viper" - "github.com/stretchr/testify/require" -) - -type testCollector struct { - testA *prometheus.Desc - testB *prometheus.Desc -} - -func (c *testCollector) Describe(ch chan<- *prometheus.Desc) { - ch <- c.testA - ch <- c.testB -} - -func (c *testCollector) Collect(ch chan<- prometheus.Metric) { - ch <- prometheus.MustNewConstMetric(c.testA, prometheus.GaugeValue, 1, "label_1") - ch <- prometheus.MustNewConstMetric(c.testB, prometheus.GaugeValue, 2, "label_2") -} - -func TestEncodeVariables(t *testing.T) { - dump := make(map[string]interface{}) - - expvar.NewString("test1").Set("test1") - expvar.NewString("test2").Set("test2") - - res := EncodeVariables() - - require.NoError(t, json.Unmarshal(res.Variables, &dump)) - require.NotEmpty(t, dump) - - // dump should contains keys `test1` and `test2` - require.Contains(t, dump, "test1") - require.Equal(t, "test1", dump["test1"]) - - require.Contains(t, dump, "test2") - require.Equal(t, "test2", dump["test2"]) -} - -func TestEncodeConfig(t *testing.T) { - v := viper.New() - v.Set("test1", "test1") - v.Set("test2", "test2") - - res, err := EncodeConfig(v) - require.NoError(t, err) - - dump := make(map[string]interface{}) - require.NoError(t, json.Unmarshal(res.Config, &dump)) - - require.NotEmpty(t, dump) - - require.Contains(t, dump, "test1") - require.Equal(t, dump["test1"], "test1") - - require.Contains(t, dump, "test2") - require.Equal(t, dump["test2"], "test2") -} - -func TestEncodeAndDecodeMetrics(t *testing.T) { - registry := prometheus.NewRegistry() - - collector := &testCollector{ - testA: prometheus.NewDesc("test1", "test1", []string{"test1"}, prometheus.Labels{"label_1": "test1"}), - testB: prometheus.NewDesc("test2", "test2", []string{"test2"}, prometheus.Labels{"label_2": "test2"}), - } - - require.NoError(t, registry.Register(collector)) - - gather, err := registry.Gather() - require.NoError(t, err) - - res, err := EncodeMetrics(registry) - require.NoError(t, err) - - metrics, err := DecodeMetrics(res) - require.NoError(t, err) - - require.Len(t, metrics, len(gather)) - - { // Check that JSON encoded metrics are equal: - expect := new(bytes.Buffer) - actual := new(bytes.Buffer) - - require.NoError(t, json.NewEncoder(expect).Encode(gather)) - require.NoError(t, json.NewEncoder(actual).Encode(metrics)) - - require.Equal(t, expect.Bytes(), actual.Bytes()) - } - - { // Deep comparison of metrics: - for i := range metrics { - require.Equal(t, gather[i].Help, metrics[i].Help) - require.Equal(t, gather[i].Name, metrics[i].Name) - require.Equal(t, gather[i].Type, metrics[i].Type) - - require.Len(t, metrics[i].Metric, len(gather[i].Metric)) - - for j := range metrics[i].Metric { - require.Equal(t, gather[i].Metric[j].Gauge, metrics[i].Metric[j].Gauge) - require.Len(t, metrics[i].Metric[j].Label, len(gather[i].Metric[j].Label)) - - for k := range metrics[i].Metric[j].Label { - require.Equal(t, gather[i].Metric[j].Label[k].Name, metrics[i].Metric[j].Label[k].Name) - require.Equal(t, gather[i].Metric[j].Label[k].Value, metrics[i].Metric[j].Label[k].Value) - } - } - } - } -} diff --git a/state/sign.go b/state/sign.go deleted file mode 100644 index 88f038c..0000000 --- a/state/sign.go +++ /dev/null @@ -1,67 +0,0 @@ -package state - -import ( - "io" - - "github.com/nspcc-dev/neofs-api-go/service" -) - -// SignedData returns payload bytes of the request. -// -// Always returns an empty slice. -func (m NetmapRequest) SignedData() ([]byte, error) { - return make([]byte, 0), nil -} - -// SignedData returns payload bytes of the request. -// -// Always returns an empty slice. -func (m MetricsRequest) SignedData() ([]byte, error) { - return make([]byte, 0), nil -} - -// SignedData returns payload bytes of the request. -// -// Always returns an empty slice. -func (m HealthRequest) SignedData() ([]byte, error) { - return make([]byte, 0), nil -} - -// SignedData returns payload bytes of the request. -// -// Always returns an empty slice. -func (m DumpRequest) SignedData() ([]byte, error) { - return make([]byte, 0), nil -} - -// SignedData returns payload bytes of the request. -// -// Always returns an empty slice. -func (m DumpVarsRequest) SignedData() ([]byte, error) { - return make([]byte, 0), nil -} - -// SignedData returns payload bytes of the request. -func (m ChangeStateRequest) SignedData() ([]byte, error) { - return service.SignedDataFromReader(m) -} - -// SignedDataSize returns payload size of the request. -func (m ChangeStateRequest) SignedDataSize() int { - return m.GetState().Size() -} - -// ReadSignedData copies payload bytes to passed buffer. -// -// If the Request size is insufficient, io.ErrUnexpectedEOF returns. -func (m ChangeStateRequest) ReadSignedData(p []byte) (int, error) { - if len(p) < m.SignedDataSize() { - return 0, io.ErrUnexpectedEOF - } - - var off int - - off += copy(p[off:], m.GetState().Bytes()) - - return off, nil -} diff --git a/state/sign_test.go b/state/sign_test.go deleted file mode 100644 index 05af654..0000000 --- a/state/sign_test.go +++ /dev/null @@ -1,94 +0,0 @@ -package state - -import ( - "testing" - - "github.com/nspcc-dev/neofs-api-go/service" - "github.com/nspcc-dev/neofs-crypto/test" - "github.com/stretchr/testify/require" -) - -func TestRequestSign(t *testing.T) { - sk := test.DecodeKey(0) - - type sigType interface { - service.RequestData - service.SignKeyPairAccumulator - service.SignKeyPairSource - SetToken(*service.Token) - } - - items := []struct { - constructor func() sigType - payloadCorrupt []func(sigType) - }{ - { // NetmapRequest - constructor: func() sigType { - return new(NetmapRequest) - }, - }, - { // MetricsRequest - constructor: func() sigType { - return new(MetricsRequest) - }, - }, - { // HealthRequest - constructor: func() sigType { - return new(HealthRequest) - }, - }, - { // DumpRequest - constructor: func() sigType { - return new(DumpRequest) - }, - }, - { // DumpVarsRequest - constructor: func() sigType { - return new(DumpVarsRequest) - }, - }, - { - constructor: func() sigType { - return new(ChangeStateRequest) - }, - payloadCorrupt: []func(sigType){ - func(s sigType) { - req := s.(*ChangeStateRequest) - - req.SetState(req.GetState() + 1) - }, - }, - }, - } - - for _, item := range items { - { // token corruptions - v := item.constructor() - - token := new(service.Token) - v.SetToken(token) - - require.NoError(t, service.SignRequestData(sk, v)) - - require.NoError(t, service.VerifyRequestData(v)) - - token.SetSessionKey(append(token.GetSessionKey(), 1)) - - require.Error(t, service.VerifyRequestData(v)) - } - - { // payload corruptions - for _, corruption := range item.payloadCorrupt { - v := item.constructor() - - require.NoError(t, service.SignRequestData(sk, v)) - - require.NoError(t, service.VerifyRequestData(v)) - - corruption(v) - - require.Error(t, service.VerifyRequestData(v)) - } - } - } -} diff --git a/state/types.go b/state/types.go deleted file mode 100644 index 6b572db..0000000 --- a/state/types.go +++ /dev/null @@ -1,24 +0,0 @@ -package state - -import ( - "encoding/binary" -) - -// SetState is a State field setter. -func (m *ChangeStateRequest) SetState(st ChangeStateRequest_State) { - m.State = st -} - -// Size returns the size of the state binary representation. -func (ChangeStateRequest_State) Size() int { - return 4 -} - -// Bytes returns the state binary representation. -func (x ChangeStateRequest_State) Bytes() []byte { - data := make([]byte, x.Size()) - - binary.BigEndian.PutUint32(data, uint32(x)) - - return data -} diff --git a/state/types_test.go b/state/types_test.go deleted file mode 100644 index 5d5f5de..0000000 --- a/state/types_test.go +++ /dev/null @@ -1,18 +0,0 @@ -package state - -import ( - "testing" - - "github.com/stretchr/testify/require" -) - -func TestChangeStateRequestGettersSetters(t *testing.T) { - t.Run("state", func(t *testing.T) { - st := ChangeStateRequest_State(1) - m := new(ChangeStateRequest) - - m.SetState(st) - - require.Equal(t, st, m.GetState()) - }) -} diff --git a/storagegroup/storage.go b/storagegroup/storage.go deleted file mode 100644 index 7438b2b..0000000 --- a/storagegroup/storage.go +++ /dev/null @@ -1,39 +0,0 @@ -package storagegroup - -import ( - "context" - - "github.com/nspcc-dev/neofs-api-go/refs" -) - -type ( - // Store is a interface for storing users storage group - Store interface { - Lister - Receiver - Receptacle - } - - // Lister defines list function that returns all storage groups - // created for the passed container - Lister interface { - List(ctx context.Context, cid refs.CID) ([]refs.SGID, error) - } - - // Receiver defines get function that returns asked storage group - Receiver interface { - Get(ctx context.Context, cid refs.CID, sgid refs.SGID) (Provider, error) - } - - // Receptacle defines put function that places storage group in the - // store. - Receptacle interface { - Put(ctx context.Context, sg Provider) error - } - - // InfoReceiver defines GetSGInfo function that returns storage group - // that contains passed object ids. - InfoReceiver interface { - GetSGInfo(ctx context.Context, cid refs.CID, group []refs.ObjectID) (*StorageGroup, error) - } -) diff --git a/storagegroup/types.go b/storagegroup/types.go deleted file mode 100644 index d16382b..0000000 --- a/storagegroup/types.go +++ /dev/null @@ -1,97 +0,0 @@ -package storagegroup - -import ( - "bytes" - "strconv" - "strings" - - "github.com/gogo/protobuf/proto" - "github.com/mr-tron/base58" - "github.com/nspcc-dev/neofs-api-go/hash" - "github.com/nspcc-dev/neofs-api-go/refs" -) - -type ( - // Hash is alias of hash.Hash for proto definition. - Hash = hash.Hash - - // Provider is an interface that defines storage group instance. - // There was different storage group implementation. Right now it - // is implemented as extended header in the object. - Provider interface { - // Group returns list of object ids of the storage group. - // This list **should be** sorted. - Group() []refs.ObjectID - - IDInfo() *IdentificationInfo - Zones() []ZoneInfo - } - - // ZoneInfo provides validation information of storage group. - ZoneInfo struct { - hash.Hash - Size uint64 - } - - // IdentificationInfo provides meta information about storage group. - IdentificationInfo struct { - CID refs.CID - SGID refs.SGID - OwnerID refs.OwnerID - } - - // IDList is a slice of object ids, that can be sorted. - IDList []refs.ObjectID -) - -var _ proto.Message = (*StorageGroup)(nil) - -// String returns string representation of StorageGroup. -func (m *StorageGroup) String() string { - b := new(strings.Builder) - b.WriteString("') - return b.String() -} - -// Empty checks if storage group has some data for validation. -func (m StorageGroup) Empty() bool { - return m.ValidationDataSize == 0 && m.ValidationHash.Equal(hash.Hash{}) -} - -// Len returns amount of object ids in IDList. -func (s IDList) Len() int { return len(s) } - -// Less returns byte comparision between IDList[i] and IDList[j]. -func (s IDList) Less(i, j int) bool { return bytes.Compare(s[i].Bytes(), s[j].Bytes()) == -1 } - -// Swap swaps element with i and j index in IDList. -func (s IDList) Swap(i, j int) { s[i], s[j] = s[j], s[i] } - -// CalculateSize combines length of all zones in storage group. -func CalculateSize(sg Provider) (size uint64) { - zoneList := sg.Zones() - for i := range zoneList { - size += zoneList[i].Size - } - return -} - -// CalculateHash returns homomorphic sum of hashes -// fromm all zones in storage group. -func CalculateHash(sg Provider) (hash.Hash, error) { - var ( - zones = sg.Zones() - hashes = make([]hash.Hash, len(zones)) - ) - for i := range zones { - hashes[i] = zones[i].Hash - } - return hash.Concat(hashes) -} diff --git a/storagegroup/types.pb.go b/storagegroup/types.pb.go deleted file mode 100644 index fa4b248..0000000 --- a/storagegroup/types.pb.go +++ /dev/null @@ -1,664 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: storagegroup/types.proto - -package storagegroup - -import ( - fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/golang/protobuf/proto" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package - -type StorageGroup_Lifetime_Unit int32 - -const ( - // Unlimited set if storage group always valid - StorageGroup_Lifetime_Unlimited StorageGroup_Lifetime_Unit = 0 - // NeoFSEpoch set if storage group is valid until lifetime NeoFS epoch - StorageGroup_Lifetime_NeoFSEpoch StorageGroup_Lifetime_Unit = 1 - // UnixTime set if storage group is valid until lifetime unix timestamp - StorageGroup_Lifetime_UnixTime StorageGroup_Lifetime_Unit = 2 -) - -var StorageGroup_Lifetime_Unit_name = map[int32]string{ - 0: "Unlimited", - 1: "NeoFSEpoch", - 2: "UnixTime", -} - -var StorageGroup_Lifetime_Unit_value = map[string]int32{ - "Unlimited": 0, - "NeoFSEpoch": 1, - "UnixTime": 2, -} - -func (x StorageGroup_Lifetime_Unit) String() string { - return proto.EnumName(StorageGroup_Lifetime_Unit_name, int32(x)) -} - -func (StorageGroup_Lifetime_Unit) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_cfa54edc899249a8, []int{0, 0, 0} -} - -type StorageGroup struct { - // ValidationDataSize is size of the all object's payloads included into storage group - ValidationDataSize uint64 `protobuf:"varint,1,opt,name=ValidationDataSize,proto3" json:"ValidationDataSize,omitempty"` - // ValidationHash is homomorphic hash of all object's payloads included into storage group - ValidationHash Hash `protobuf:"bytes,2,opt,name=ValidationHash,proto3,customtype=Hash" json:"ValidationHash"` - // Lifetime is time until storage group is valid - Lifetime *StorageGroup_Lifetime `protobuf:"bytes,3,opt,name=lifetime,proto3" json:"lifetime,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *StorageGroup) Reset() { *m = StorageGroup{} } -func (*StorageGroup) ProtoMessage() {} -func (*StorageGroup) Descriptor() ([]byte, []int) { - return fileDescriptor_cfa54edc899249a8, []int{0} -} -func (m *StorageGroup) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *StorageGroup) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *StorageGroup) XXX_Merge(src proto.Message) { - xxx_messageInfo_StorageGroup.Merge(m, src) -} -func (m *StorageGroup) XXX_Size() int { - return m.Size() -} -func (m *StorageGroup) XXX_DiscardUnknown() { - xxx_messageInfo_StorageGroup.DiscardUnknown(m) -} - -var xxx_messageInfo_StorageGroup proto.InternalMessageInfo - -func (m *StorageGroup) GetValidationDataSize() uint64 { - if m != nil { - return m.ValidationDataSize - } - return 0 -} - -func (m *StorageGroup) GetLifetime() *StorageGroup_Lifetime { - if m != nil { - return m.Lifetime - } - return nil -} - -type StorageGroup_Lifetime struct { - // Unit is lifetime type - Unit StorageGroup_Lifetime_Unit `protobuf:"varint,1,opt,name=unit,proto3,enum=storagegroup.StorageGroup_Lifetime_Unit" json:"unit,omitempty"` - // Value for lifetime - Value int64 `protobuf:"varint,2,opt,name=Value,proto3" json:"Value,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *StorageGroup_Lifetime) Reset() { *m = StorageGroup_Lifetime{} } -func (m *StorageGroup_Lifetime) String() string { return proto.CompactTextString(m) } -func (*StorageGroup_Lifetime) ProtoMessage() {} -func (*StorageGroup_Lifetime) Descriptor() ([]byte, []int) { - return fileDescriptor_cfa54edc899249a8, []int{0, 0} -} -func (m *StorageGroup_Lifetime) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *StorageGroup_Lifetime) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *StorageGroup_Lifetime) XXX_Merge(src proto.Message) { - xxx_messageInfo_StorageGroup_Lifetime.Merge(m, src) -} -func (m *StorageGroup_Lifetime) XXX_Size() int { - return m.Size() -} -func (m *StorageGroup_Lifetime) XXX_DiscardUnknown() { - xxx_messageInfo_StorageGroup_Lifetime.DiscardUnknown(m) -} - -var xxx_messageInfo_StorageGroup_Lifetime proto.InternalMessageInfo - -func (m *StorageGroup_Lifetime) GetUnit() StorageGroup_Lifetime_Unit { - if m != nil { - return m.Unit - } - return StorageGroup_Lifetime_Unlimited -} - -func (m *StorageGroup_Lifetime) GetValue() int64 { - if m != nil { - return m.Value - } - return 0 -} - -func init() { - proto.RegisterEnum("storagegroup.StorageGroup_Lifetime_Unit", StorageGroup_Lifetime_Unit_name, StorageGroup_Lifetime_Unit_value) - proto.RegisterType((*StorageGroup)(nil), "storagegroup.StorageGroup") - proto.RegisterType((*StorageGroup_Lifetime)(nil), "storagegroup.StorageGroup.Lifetime") -} - -func init() { proto.RegisterFile("storagegroup/types.proto", fileDescriptor_cfa54edc899249a8) } - -var fileDescriptor_cfa54edc899249a8 = []byte{ - // 377 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x51, 0x31, 0x6b, 0xdb, 0x40, - 0x14, 0xd6, 0xc9, 0x6a, 0x51, 0xaf, 0xaa, 0x31, 0x47, 0x29, 0xc2, 0x83, 0x64, 0xdc, 0x45, 0x8b, - 0x4e, 0x60, 0x77, 0xea, 0x56, 0xd1, 0xba, 0x2d, 0x24, 0x21, 0xc8, 0xb1, 0x87, 0x40, 0x86, 0xb3, - 0x7c, 0x96, 0x0f, 0x24, 0x9d, 0xb0, 0x4e, 0x21, 0xc9, 0x2f, 0xf1, 0x12, 0xc8, 0x9c, 0x5f, 0xe2, - 0x31, 0x63, 0xc8, 0x20, 0x82, 0x32, 0xe5, 0x5f, 0x04, 0x9f, 0x13, 0x47, 0x09, 0x19, 0xb2, 0xbd, - 0xef, 0x7b, 0xdf, 0xf7, 0xde, 0xfb, 0x78, 0xd0, 0xcc, 0x05, 0x5f, 0x90, 0x88, 0x46, 0x0b, 0x5e, - 0x64, 0x9e, 0x38, 0xcd, 0x68, 0x8e, 0xb3, 0x05, 0x17, 0x1c, 0x19, 0xf5, 0x4e, 0xdb, 0x8d, 0x98, - 0x98, 0x17, 0x13, 0x1c, 0xf2, 0xc4, 0x8b, 0x78, 0xc4, 0x3d, 0x29, 0x9a, 0x14, 0x33, 0x89, 0x24, - 0x90, 0xd5, 0xc6, 0xdc, 0xbd, 0x57, 0xa1, 0x31, 0xdc, 0xf8, 0xff, 0xae, 0xfd, 0x08, 0x43, 0x34, - 0x26, 0x31, 0x9b, 0x12, 0xc1, 0x78, 0xfa, 0x9b, 0x08, 0x32, 0x64, 0x67, 0xd4, 0x04, 0x1d, 0xe0, - 0x68, 0xc1, 0x1b, 0x1d, 0xf4, 0x03, 0x36, 0x9f, 0xd9, 0x7f, 0x24, 0x9f, 0x9b, 0x6a, 0x07, 0x38, - 0x86, 0x6f, 0xac, 0x4a, 0x5b, 0xb9, 0x29, 0x6d, 0x6d, 0xcd, 0x05, 0xaf, 0x34, 0x68, 0x17, 0xea, - 0x31, 0x9b, 0x51, 0xc1, 0x12, 0x6a, 0x36, 0x3a, 0xc0, 0xf9, 0xdc, 0xfb, 0x8e, 0xeb, 0x31, 0x70, - 0xfd, 0x26, 0xbc, 0xf3, 0x28, 0xf5, 0x8d, 0xaa, 0xb4, 0xf5, 0x27, 0x14, 0x6c, 0x47, 0xb4, 0xcf, - 0x01, 0xdc, 0xd2, 0x68, 0x00, 0xb5, 0x22, 0x65, 0x42, 0xde, 0xdc, 0xec, 0x39, 0xef, 0x98, 0x8b, - 0x47, 0x29, 0x13, 0xbe, 0x5e, 0x95, 0xb6, 0xb6, 0xae, 0x02, 0xe9, 0x47, 0x5f, 0xe1, 0x87, 0x31, - 0x89, 0x0b, 0x2a, 0x03, 0x35, 0x82, 0x0d, 0xe8, 0xf6, 0xa1, 0xd4, 0xa0, 0x2f, 0xf0, 0xd3, 0x28, - 0x8d, 0x59, 0xc2, 0x04, 0x9d, 0xb6, 0x14, 0xd4, 0x84, 0x70, 0x8f, 0xf2, 0xc1, 0xf0, 0x4f, 0xc6, - 0xc3, 0x79, 0x0b, 0x20, 0x03, 0xea, 0xa3, 0x94, 0x9d, 0x1c, 0xb0, 0x84, 0xb6, 0xd4, 0x9f, 0xda, - 0xf2, 0xc2, 0x56, 0xfc, 0xa3, 0x55, 0x65, 0x81, 0xab, 0xca, 0x02, 0xd7, 0x95, 0x05, 0x6e, 0x2b, - 0x0b, 0x2c, 0xef, 0x2c, 0xe5, 0x10, 0xd7, 0x1e, 0x96, 0xe6, 0x59, 0x18, 0xba, 0x53, 0x7a, 0xec, - 0xa5, 0x94, 0xcf, 0x72, 0x97, 0x64, 0xcc, 0x8d, 0xb8, 0x57, 0x4f, 0x70, 0xa9, 0x7e, 0x93, 0x8b, - 0xf0, 0xaf, 0xfd, 0xff, 0x2f, 0xd2, 0x4c, 0x3e, 0xca, 0x8f, 0xf6, 0x1f, 0x02, 0x00, 0x00, 0xff, - 0xff, 0xf8, 0x32, 0x27, 0x9d, 0x2a, 0x02, 0x00, 0x00, -} - -func (m *StorageGroup) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *StorageGroup) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *StorageGroup) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.Lifetime != nil { - { - size, err := m.Lifetime.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - { - size := m.ValidationHash.Size() - i -= size - if _, err := m.ValidationHash.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - if m.ValidationDataSize != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.ValidationDataSize)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *StorageGroup_Lifetime) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *StorageGroup_Lifetime) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *StorageGroup_Lifetime) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.Value != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.Value)) - i-- - dAtA[i] = 0x10 - } - if m.Unit != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.Unit)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func encodeVarintTypes(dAtA []byte, offset int, v uint64) int { - offset -= sovTypes(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *StorageGroup) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ValidationDataSize != 0 { - n += 1 + sovTypes(uint64(m.ValidationDataSize)) - } - l = m.ValidationHash.Size() - n += 1 + l + sovTypes(uint64(l)) - if m.Lifetime != nil { - l = m.Lifetime.Size() - n += 1 + l + sovTypes(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *StorageGroup_Lifetime) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Unit != 0 { - n += 1 + sovTypes(uint64(m.Unit)) - } - if m.Value != 0 { - n += 1 + sovTypes(uint64(m.Value)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func sovTypes(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozTypes(x uint64) (n int) { - return sovTypes(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *StorageGroup) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: StorageGroup: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: StorageGroup: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ValidationDataSize", wireType) - } - m.ValidationDataSize = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ValidationDataSize |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ValidationHash", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ValidationHash.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Lifetime", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Lifetime == nil { - m.Lifetime = &StorageGroup_Lifetime{} - } - if err := m.Lifetime.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *StorageGroup_Lifetime) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Lifetime: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Lifetime: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Unit", wireType) - } - m.Unit = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Unit |= StorageGroup_Lifetime_Unit(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) - } - m.Value = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Value |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipTypes(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTypes - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTypes - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTypes - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthTypes - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupTypes - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthTypes - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthTypes = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowTypes = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupTypes = fmt.Errorf("proto: unexpected end of group") -) diff --git a/storagegroup/types.proto b/storagegroup/types.proto deleted file mode 100644 index fde33aa..0000000 --- a/storagegroup/types.proto +++ /dev/null @@ -1,36 +0,0 @@ -syntax = "proto3"; -package storagegroup; -option go_package = "github.com/nspcc-dev/neofs-api-go/storagegroup"; -option csharp_namespace = "NeoFS.API.StorageGroup"; - -import "github.com/gogo/protobuf/gogoproto/gogo.proto"; - -option (gogoproto.stable_marshaler_all) = true; - -message StorageGroup { - option (gogoproto.goproto_stringer) = false; - - // ValidationDataSize is size of the all object's payloads included into storage group - uint64 ValidationDataSize = 1; - // ValidationHash is homomorphic hash of all object's payloads included into storage group - bytes ValidationHash = 2 [(gogoproto.customtype) = "Hash", (gogoproto.nullable) = false]; - - message Lifetime { - enum Unit { - // Unlimited set if storage group always valid - Unlimited = 0; - // NeoFSEpoch set if storage group is valid until lifetime NeoFS epoch - NeoFSEpoch = 1; - // UnixTime set if storage group is valid until lifetime unix timestamp - UnixTime = 2; - } - - // Unit is lifetime type - Unit unit = 1 [(gogoproto.customname) = "Unit"]; - // Value for lifetime - int64 Value = 2; - } - - // Lifetime is time until storage group is valid - Lifetime lifetime = 3 [(gogoproto.customname) = "Lifetime"]; -} From fabdd78d634f0e1eaaa5576085b63810e2fedea1 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Wed, 12 Aug 2020 12:57:28 +0300 Subject: [PATCH 0257/1196] Add pre-release jindo branch --- accounting/v2/service.pb.go | 1494 +++++ accounting/v2/service.proto | 75 + acl/v2/types.pb.go | 1478 +++++ acl/v2/types.proto | 106 + container/v2/service.pb.go | 6794 ++++++++++++++++++++++ container/v2/service.proto | 285 + container/v2/types.pb.go | 808 +++ container/v2/types.proto | 40 + netmap/v2/types.pb.go | 2448 ++++++++ netmap/v2/types.proto | 92 + object/v2/service.pb.go | 10393 ++++++++++++++++++++++++++++++++++ object/v2/service.proto | 407 ++ object/v2/types.pb.go | 1986 +++++++ object/v2/types.proto | 85 + refs/v2/types.pb.go | 970 ++++ refs/v2/types.proto | 32 + service/v2/meta.pb.go | 3168 +++++++++++ service/v2/meta.proto | 129 + service/v2/verify.pb.go | 1156 ++++ service/v2/verify.proto | 43 + session/v2/service.pb.go | 1385 +++++ session/v2/service.proto | 60 + storagegroup/v2/types.pb.go | 483 ++ storagegroup/v2/types.proto | 30 + 24 files changed, 33947 insertions(+) create mode 100644 accounting/v2/service.pb.go create mode 100644 accounting/v2/service.proto create mode 100644 acl/v2/types.pb.go create mode 100644 acl/v2/types.proto create mode 100644 container/v2/service.pb.go create mode 100644 container/v2/service.proto create mode 100644 container/v2/types.pb.go create mode 100644 container/v2/types.proto create mode 100644 netmap/v2/types.pb.go create mode 100644 netmap/v2/types.proto create mode 100644 object/v2/service.pb.go create mode 100644 object/v2/service.proto create mode 100644 object/v2/types.pb.go create mode 100644 object/v2/types.proto create mode 100644 refs/v2/types.pb.go create mode 100644 refs/v2/types.proto create mode 100644 service/v2/meta.pb.go create mode 100644 service/v2/meta.proto create mode 100644 service/v2/verify.pb.go create mode 100644 service/v2/verify.proto create mode 100644 session/v2/service.pb.go create mode 100644 session/v2/service.proto create mode 100644 storagegroup/v2/types.pb.go create mode 100644 storagegroup/v2/types.proto diff --git a/accounting/v2/service.pb.go b/accounting/v2/service.pb.go new file mode 100644 index 0000000..7d8eba9 --- /dev/null +++ b/accounting/v2/service.pb.go @@ -0,0 +1,1494 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: accounting/v2/service.proto + +package v2 + +import ( + context "context" + fmt "fmt" + proto "github.com/golang/protobuf/proto" + v21 "github.com/nspcc-dev/neofs-api-go/refs/v2" + v2 "github.com/nspcc-dev/neofs-api-go/service/v2" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package + +// Message defines the request body of Balance method. +// +// To indicate the account for which the balance is requested, it's identifier +// is used. +// +// To gain access to the requested information, the request body must be formed +// according to the requirements from the system specification. +type BalanceRequest struct { + // Body of the balance request message. + Body *BalanceRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` + // Carries request meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *v2.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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 *v2.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *BalanceRequest) Reset() { *m = BalanceRequest{} } +func (m *BalanceRequest) String() string { return proto.CompactTextString(m) } +func (*BalanceRequest) ProtoMessage() {} +func (*BalanceRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_bac189e9286e823b, []int{0} +} +func (m *BalanceRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *BalanceRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_BalanceRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *BalanceRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_BalanceRequest.Merge(m, src) +} +func (m *BalanceRequest) XXX_Size() int { + return m.Size() +} +func (m *BalanceRequest) XXX_DiscardUnknown() { + xxx_messageInfo_BalanceRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_BalanceRequest proto.InternalMessageInfo + +func (m *BalanceRequest) GetBody() *BalanceRequest_Body { + if m != nil { + return m.Body + } + return nil +} + +func (m *BalanceRequest) GetMetaHeader() *v2.RequestMetaHeader { + if m != nil { + return m.MetaHeader + } + return nil +} + +func (m *BalanceRequest) GetVerifyHeader() *v2.RequestVerificationHeader { + if m != nil { + return m.VerifyHeader + } + return nil +} + +type BalanceRequest_Body struct { + // Carries user identifier in NeoFS system for which the balance + // is requested. + OwnerId *v21.OwnerID `protobuf:"bytes,1,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *BalanceRequest_Body) Reset() { *m = BalanceRequest_Body{} } +func (m *BalanceRequest_Body) String() string { return proto.CompactTextString(m) } +func (*BalanceRequest_Body) ProtoMessage() {} +func (*BalanceRequest_Body) Descriptor() ([]byte, []int) { + return fileDescriptor_bac189e9286e823b, []int{0, 0} +} +func (m *BalanceRequest_Body) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *BalanceRequest_Body) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_BalanceRequest_Body.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *BalanceRequest_Body) XXX_Merge(src proto.Message) { + xxx_messageInfo_BalanceRequest_Body.Merge(m, src) +} +func (m *BalanceRequest_Body) XXX_Size() int { + return m.Size() +} +func (m *BalanceRequest_Body) XXX_DiscardUnknown() { + xxx_messageInfo_BalanceRequest_Body.DiscardUnknown(m) +} + +var xxx_messageInfo_BalanceRequest_Body proto.InternalMessageInfo + +func (m *BalanceRequest_Body) GetOwnerId() *v21.OwnerID { + if m != nil { + return m.OwnerId + } + return nil +} + +// Decimal represents the decimal numbers. +type Decimal struct { + // value carries number value. + Value int64 `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"` + // precision carries value precision. + Precision uint32 `protobuf:"varint,2,opt,name=precision,proto3" json:"precision,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Decimal) Reset() { *m = Decimal{} } +func (m *Decimal) String() string { return proto.CompactTextString(m) } +func (*Decimal) ProtoMessage() {} +func (*Decimal) Descriptor() ([]byte, []int) { + return fileDescriptor_bac189e9286e823b, []int{1} +} +func (m *Decimal) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Decimal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Decimal.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Decimal) XXX_Merge(src proto.Message) { + xxx_messageInfo_Decimal.Merge(m, src) +} +func (m *Decimal) XXX_Size() int { + return m.Size() +} +func (m *Decimal) XXX_DiscardUnknown() { + xxx_messageInfo_Decimal.DiscardUnknown(m) +} + +var xxx_messageInfo_Decimal proto.InternalMessageInfo + +func (m *Decimal) GetValue() int64 { + if m != nil { + return m.Value + } + return 0 +} + +func (m *Decimal) GetPrecision() uint32 { + if m != nil { + return m.Precision + } + return 0 +} + +// Message defines the response body of Balance method. +// +// The amount of funds is calculated in decimal numbers. +type BalanceResponse struct { + // Body of the balance response message. + Body *BalanceResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` + // Carries response meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *v2.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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 *v2.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *BalanceResponse) Reset() { *m = BalanceResponse{} } +func (m *BalanceResponse) String() string { return proto.CompactTextString(m) } +func (*BalanceResponse) ProtoMessage() {} +func (*BalanceResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_bac189e9286e823b, []int{2} +} +func (m *BalanceResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *BalanceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_BalanceResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *BalanceResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_BalanceResponse.Merge(m, src) +} +func (m *BalanceResponse) XXX_Size() int { + return m.Size() +} +func (m *BalanceResponse) XXX_DiscardUnknown() { + xxx_messageInfo_BalanceResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_BalanceResponse proto.InternalMessageInfo + +func (m *BalanceResponse) GetBody() *BalanceResponse_Body { + if m != nil { + return m.Body + } + return nil +} + +func (m *BalanceResponse) GetMetaHeader() *v2.ResponseMetaHeader { + if m != nil { + return m.MetaHeader + } + return nil +} + +func (m *BalanceResponse) GetVerifyHeader() *v2.ResponseVerificationHeader { + if m != nil { + return m.VerifyHeader + } + return nil +} + +type BalanceResponse_Body struct { + // Carries the amount of funds on the account. + Balance *Decimal `protobuf:"bytes,1,opt,name=balance,proto3" json:"balance,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *BalanceResponse_Body) Reset() { *m = BalanceResponse_Body{} } +func (m *BalanceResponse_Body) String() string { return proto.CompactTextString(m) } +func (*BalanceResponse_Body) ProtoMessage() {} +func (*BalanceResponse_Body) Descriptor() ([]byte, []int) { + return fileDescriptor_bac189e9286e823b, []int{2, 0} +} +func (m *BalanceResponse_Body) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *BalanceResponse_Body) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_BalanceResponse_Body.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *BalanceResponse_Body) XXX_Merge(src proto.Message) { + xxx_messageInfo_BalanceResponse_Body.Merge(m, src) +} +func (m *BalanceResponse_Body) XXX_Size() int { + return m.Size() +} +func (m *BalanceResponse_Body) XXX_DiscardUnknown() { + xxx_messageInfo_BalanceResponse_Body.DiscardUnknown(m) +} + +var xxx_messageInfo_BalanceResponse_Body proto.InternalMessageInfo + +func (m *BalanceResponse_Body) GetBalance() *Decimal { + if m != nil { + return m.Balance + } + return nil +} + +func init() { + proto.RegisterType((*BalanceRequest)(nil), "accounting.v2.BalanceRequest") + proto.RegisterType((*BalanceRequest_Body)(nil), "accounting.v2.BalanceRequest.Body") + proto.RegisterType((*Decimal)(nil), "accounting.v2.Decimal") + proto.RegisterType((*BalanceResponse)(nil), "accounting.v2.BalanceResponse") + proto.RegisterType((*BalanceResponse_Body)(nil), "accounting.v2.BalanceResponse.Body") +} + +func init() { proto.RegisterFile("accounting/v2/service.proto", fileDescriptor_bac189e9286e823b) } + +var fileDescriptor_bac189e9286e823b = []byte{ + // 457 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x93, 0xdf, 0x6a, 0x13, 0x41, + 0x14, 0xc6, 0xdd, 0xb4, 0x1a, 0x3d, 0x35, 0x2a, 0x63, 0xd5, 0x12, 0xed, 0x22, 0x11, 0x45, 0x90, + 0xcc, 0xca, 0x16, 0xd4, 0x1b, 0x95, 0x86, 0x22, 0x8d, 0xe2, 0x1f, 0x56, 0x28, 0xe2, 0x4d, 0x99, + 0xcc, 0x9e, 0xa4, 0x03, 0xc9, 0xcc, 0xba, 0xb3, 0x59, 0xc9, 0x23, 0x78, 0xeb, 0x95, 0xcf, 0xe0, + 0x93, 0x78, 0xe9, 0x23, 0x48, 0x7c, 0x11, 0x99, 0x3f, 0x49, 0xba, 0xb2, 0x6d, 0xef, 0x76, 0xce, + 0xf9, 0xce, 0x37, 0xe7, 0xfb, 0xb1, 0x03, 0xb7, 0x19, 0xe7, 0x6a, 0x2a, 0x0b, 0x21, 0x47, 0x51, + 0x19, 0x47, 0x1a, 0xf3, 0x52, 0x70, 0xa4, 0x59, 0xae, 0x0a, 0x45, 0x5a, 0xab, 0x26, 0x2d, 0xe3, + 0xf6, 0xf5, 0x1c, 0x87, 0xda, 0xa8, 0x8a, 0x59, 0x86, 0xda, 0x69, 0xda, 0x37, 0xfc, 0x88, 0xa9, + 0x4f, 0xb0, 0x60, 0xbe, 0x7c, 0xeb, 0x58, 0xb9, 0xc4, 0x5c, 0x0c, 0x67, 0xae, 0xd1, 0xf9, 0xd6, + 0x80, 0x2b, 0x3d, 0x36, 0x66, 0x92, 0x63, 0x82, 0x5f, 0xa6, 0xa8, 0x0b, 0xf2, 0x04, 0xd6, 0x07, + 0x2a, 0x9d, 0x6d, 0x05, 0x77, 0x83, 0x87, 0x1b, 0x71, 0x87, 0x56, 0x6e, 0xa5, 0x55, 0x31, 0xed, + 0xa9, 0x74, 0x96, 0x58, 0x3d, 0x79, 0x01, 0x1b, 0xe6, 0xc6, 0xc3, 0x23, 0x64, 0x29, 0xe6, 0x5b, + 0x0d, 0x3b, 0xbe, 0x4d, 0x17, 0x19, 0xca, 0x98, 0xfa, 0xa1, 0xb7, 0x58, 0xb0, 0x7d, 0x2b, 0x4a, + 0x60, 0xb2, 0xfc, 0x26, 0xaf, 0xa1, 0xe5, 0x56, 0x5b, 0x38, 0xac, 0x59, 0x87, 0xfb, 0x35, 0x0e, + 0x07, 0x46, 0x27, 0x38, 0x2b, 0x84, 0x92, 0xde, 0xe9, 0xb2, 0x9b, 0x75, 0xa7, 0xf6, 0x0e, 0xac, + 0x9b, 0xcd, 0xc8, 0x23, 0xb8, 0xa8, 0xbe, 0x4a, 0xcc, 0x0f, 0x45, 0xea, 0xf3, 0x5c, 0xa3, 0x06, + 0x9b, 0xf1, 0x7a, 0x6f, 0x1a, 0xfd, 0xbd, 0xa4, 0x69, 0x15, 0xfd, 0xb4, 0xf3, 0x1c, 0x9a, 0x7b, + 0xc8, 0xc5, 0x84, 0x8d, 0xc9, 0x26, 0x9c, 0x2f, 0xd9, 0x78, 0x8a, 0x76, 0x68, 0x2d, 0x71, 0x07, + 0x72, 0x07, 0x2e, 0x65, 0x39, 0x72, 0xa1, 0x85, 0x92, 0x36, 0x5f, 0x2b, 0x59, 0x15, 0x3a, 0xdf, + 0x1b, 0x70, 0x75, 0x49, 0x47, 0x67, 0x4a, 0x6a, 0x24, 0x4f, 0x2b, 0x2c, 0xef, 0x9d, 0xc4, 0xd2, + 0xa9, 0x8f, 0xc3, 0x7c, 0x59, 0x07, 0x33, 0xac, 0xa2, 0x70, 0x53, 0x27, 0xd0, 0x7c, 0x53, 0x4f, + 0xf3, 0x41, 0x9d, 0xc5, 0x99, 0x38, 0x9f, 0x79, 0x9c, 0x8f, 0xa1, 0x39, 0x70, 0x3b, 0xfb, 0x44, + 0x37, 0xff, 0x4b, 0xe4, 0xf9, 0x25, 0x0b, 0x59, 0x7c, 0x00, 0xb0, 0xbb, 0x54, 0x90, 0x7d, 0x68, + 0xfa, 0xcc, 0x64, 0xfb, 0xd4, 0xff, 0xaa, 0x1d, 0x9e, 0x8e, 0xaa, 0xf7, 0xe9, 0xd7, 0x3c, 0x0c, + 0x7e, 0xcf, 0xc3, 0xe0, 0xcf, 0x3c, 0x0c, 0x7e, 0xfc, 0x0d, 0xcf, 0x7d, 0x8e, 0x46, 0xa2, 0x38, + 0x9a, 0x0e, 0x28, 0x57, 0x93, 0x48, 0xea, 0x8c, 0xf3, 0x6e, 0x8a, 0x65, 0x24, 0x51, 0x0d, 0x75, + 0x97, 0x65, 0xa2, 0x3b, 0x52, 0x51, 0xe5, 0x71, 0xfd, 0x6c, 0x6c, 0xbe, 0x43, 0xf5, 0xea, 0x23, + 0xdd, 0xfd, 0xd0, 0xa7, 0xab, 0x1d, 0x07, 0x17, 0xec, 0xc3, 0xd8, 0xf9, 0x17, 0x00, 0x00, 0xff, + 0xff, 0x07, 0x70, 0x83, 0xd8, 0x8b, 0x03, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// AccountingClient is the client API for Accounting service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type AccountingClient interface { + // Returns the amount of funds for the requested NeoFS account. + Balance(ctx context.Context, in *BalanceRequest, opts ...grpc.CallOption) (*BalanceResponse, error) +} + +type accountingClient struct { + cc *grpc.ClientConn +} + +func NewAccountingClient(cc *grpc.ClientConn) AccountingClient { + return &accountingClient{cc} +} + +func (c *accountingClient) Balance(ctx context.Context, in *BalanceRequest, opts ...grpc.CallOption) (*BalanceResponse, error) { + out := new(BalanceResponse) + err := c.cc.Invoke(ctx, "/accounting.v2.Accounting/Balance", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// AccountingServer is the server API for Accounting service. +type AccountingServer interface { + // Returns the amount of funds for the requested NeoFS account. + Balance(context.Context, *BalanceRequest) (*BalanceResponse, error) +} + +// UnimplementedAccountingServer can be embedded to have forward compatible implementations. +type UnimplementedAccountingServer struct { +} + +func (*UnimplementedAccountingServer) Balance(ctx context.Context, req *BalanceRequest) (*BalanceResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Balance not implemented") +} + +func RegisterAccountingServer(s *grpc.Server, srv AccountingServer) { + s.RegisterService(&_Accounting_serviceDesc, srv) +} + +func _Accounting_Balance_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(BalanceRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AccountingServer).Balance(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/accounting.v2.Accounting/Balance", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AccountingServer).Balance(ctx, req.(*BalanceRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Accounting_serviceDesc = grpc.ServiceDesc{ + ServiceName: "accounting.v2.Accounting", + HandlerType: (*AccountingServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Balance", + Handler: _Accounting_Balance_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "accounting/v2/service.proto", +} + +func (m *BalanceRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *BalanceRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BalanceRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.VerifyHeader != nil { + { + size, err := m.VerifyHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + if m.MetaHeader != nil { + { + size, err := m.MetaHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.Body != nil { + { + size, err := m.Body.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *BalanceRequest_Body) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *BalanceRequest_Body) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BalanceRequest_Body) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.OwnerId != nil { + { + size, err := m.OwnerId.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Decimal) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Decimal) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Decimal) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.Precision != 0 { + i = encodeVarintService(dAtA, i, uint64(m.Precision)) + i-- + dAtA[i] = 0x10 + } + if m.Value != 0 { + i = encodeVarintService(dAtA, i, uint64(m.Value)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *BalanceResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *BalanceResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BalanceResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.VerifyHeader != nil { + { + size, err := m.VerifyHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + if m.MetaHeader != nil { + { + size, err := m.MetaHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.Body != nil { + { + size, err := m.Body.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *BalanceResponse_Body) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *BalanceResponse_Body) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BalanceResponse_Body) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.Balance != nil { + { + size, err := m.Balance.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintService(dAtA []byte, offset int, v uint64) int { + offset -= sovService(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *BalanceRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Body != nil { + l = m.Body.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.MetaHeader != nil { + l = m.MetaHeader.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.VerifyHeader != nil { + l = m.VerifyHeader.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *BalanceRequest_Body) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.OwnerId != nil { + l = m.OwnerId.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *Decimal) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Value != 0 { + n += 1 + sovService(uint64(m.Value)) + } + if m.Precision != 0 { + n += 1 + sovService(uint64(m.Precision)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *BalanceResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Body != nil { + l = m.Body.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.MetaHeader != nil { + l = m.MetaHeader.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.VerifyHeader != nil { + l = m.VerifyHeader.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *BalanceResponse_Body) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Balance != nil { + l = m.Balance.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovService(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozService(x uint64) (n int) { + return sovService(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *BalanceRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: BalanceRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BalanceRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Body", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Body == nil { + m.Body = &BalanceRequest_Body{} + } + if err := m.Body.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MetaHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.MetaHeader == nil { + m.MetaHeader = &v2.RequestMetaHeader{} + } + if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field VerifyHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.VerifyHeader == nil { + m.VerifyHeader = &v2.RequestVerificationHeader{} + } + if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *BalanceRequest_Body) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Body: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Body: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OwnerId", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.OwnerId == nil { + m.OwnerId = &v21.OwnerID{} + } + if err := m.OwnerId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Decimal) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Decimal: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Decimal: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + m.Value = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Value |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Precision", wireType) + } + m.Precision = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Precision |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *BalanceResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: BalanceResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BalanceResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Body", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Body == nil { + m.Body = &BalanceResponse_Body{} + } + if err := m.Body.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MetaHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.MetaHeader == nil { + m.MetaHeader = &v2.ResponseMetaHeader{} + } + if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field VerifyHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.VerifyHeader == nil { + m.VerifyHeader = &v2.ResponseVerificationHeader{} + } + if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *BalanceResponse_Body) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Body: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Body: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Balance", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Balance == nil { + m.Balance = &Decimal{} + } + if err := m.Balance.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipService(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowService + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowService + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowService + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthService + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupService + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthService + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthService = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowService = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupService = fmt.Errorf("proto: unexpected end of group") +) diff --git a/accounting/v2/service.proto b/accounting/v2/service.proto new file mode 100644 index 0000000..6c12c6b --- /dev/null +++ b/accounting/v2/service.proto @@ -0,0 +1,75 @@ +syntax = "proto3"; + +package accounting.v2; + +option go_package = "github.com/nspcc-dev/neofs-api-go/accounting/v2"; +option csharp_namespace = "NeoFS.API.Accounting"; + +import "refs/v2/types.proto"; +import "service/v2/meta.proto"; +import "service/v2/verify.proto"; + +// The service provides methods for obtaining information +// about the account balance in NeoFS system. +service Accounting { + // Returns the amount of funds for the requested NeoFS account. + rpc Balance (BalanceRequest) returns (BalanceResponse); +} + +// Message defines the request body of Balance method. +// +// To indicate the account for which the balance is requested, it's identifier +// is used. +// +// To gain access to the requested information, the request body must be formed +// according to the requirements from the system specification. +message BalanceRequest { + message Body { + // Carries user identifier in NeoFS system for which the balance + // is requested. + refs.v2.OwnerID owner_id = 1; + } + + // Body of the balance request message. + Body body = 1; + + // Carries request meta information. Header data is used only to regulate + // message transport and does not affect request execution. + service.v2.RequestMetaHeader meta_header = 2; + + // Carries request verification information. This header is used to + // authenticate the nodes of the message route and check the correctness + // of transmission. + service.v2.RequestVerificationHeader verify_header = 3; +} + +// Decimal represents the decimal numbers. +message Decimal { + // value carries number value. + int64 value = 1; + + // precision carries value precision. + uint32 precision = 2; +} + +// Message defines the response body of Balance method. +// +// The amount of funds is calculated in decimal numbers. +message BalanceResponse { + message Body { + // Carries the amount of funds on the account. + Decimal balance = 1; + } + + // Body of the balance response message. + Body body = 1; + + // Carries response meta information. Header data is used only to regulate + // message transport and does not affect request execution. + service.v2.ResponseMetaHeader meta_header = 2; + + // Carries response verification information. This header is used to + // authenticate the nodes of the message route and check the correctness + // of transmission. + service.v2.ResponseVerificationHeader verify_header = 3; +} diff --git a/acl/v2/types.pb.go b/acl/v2/types.pb.go new file mode 100644 index 0000000..06711e2 --- /dev/null +++ b/acl/v2/types.pb.go @@ -0,0 +1,1478 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: acl/v2/types.proto + +package v2 + +import ( + fmt "fmt" + proto "github.com/golang/protobuf/proto" + v2 "github.com/nspcc-dev/neofs-api-go/refs/v2" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package + +// Target of the access control rule in access control list. +type Target int32 + +const ( + // Unknown target, default value. + Target_UNKNOWN Target = 0 + // User target rule is applied if sender is the owner of the container.v2. + Target_USER Target = 1 + // System target rule is applied if sender is the storage node within the + // container or inner ring node. + Target_SYSTEM Target = 2 + // Others target rule is applied if sender is not user or system target. + Target_OTHERS Target = 3 +) + +var Target_name = map[int32]string{ + 0: "UNKNOWN", + 1: "USER", + 2: "SYSTEM", + 3: "OTHERS", +} + +var Target_value = map[string]int32{ + "UNKNOWN": 0, + "USER": 1, + "SYSTEM": 2, + "OTHERS": 3, +} + +func (x Target) String() string { + return proto.EnumName(Target_name, int32(x)) +} + +func (Target) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_ab60484daff20d3c, []int{0} +} + +// Operation is an enumeration of operation types. +type EACLRecord_Operation int32 + +const ( + EACLRecord_OPERATION_UNKNOWN EACLRecord_Operation = 0 + EACLRecord_GET EACLRecord_Operation = 1 + EACLRecord_HEAD EACLRecord_Operation = 2 + EACLRecord_PUT EACLRecord_Operation = 3 + EACLRecord_DELETE EACLRecord_Operation = 4 + EACLRecord_SEARCH EACLRecord_Operation = 5 + EACLRecord_GETRANGE EACLRecord_Operation = 6 + EACLRecord_GETRANGEHASH EACLRecord_Operation = 7 +) + +var EACLRecord_Operation_name = map[int32]string{ + 0: "OPERATION_UNKNOWN", + 1: "GET", + 2: "HEAD", + 3: "PUT", + 4: "DELETE", + 5: "SEARCH", + 6: "GETRANGE", + 7: "GETRANGEHASH", +} + +var EACLRecord_Operation_value = map[string]int32{ + "OPERATION_UNKNOWN": 0, + "GET": 1, + "HEAD": 2, + "PUT": 3, + "DELETE": 4, + "SEARCH": 5, + "GETRANGE": 6, + "GETRANGEHASH": 7, +} + +func (x EACLRecord_Operation) String() string { + return proto.EnumName(EACLRecord_Operation_name, int32(x)) +} + +func (EACLRecord_Operation) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_ab60484daff20d3c, []int{0, 0} +} + +// Action is an enumeration of EACL actions. +type EACLRecord_Action int32 + +const ( + EACLRecord_ACTION_UNKNOWN EACLRecord_Action = 0 + EACLRecord_ALLOW EACLRecord_Action = 1 + EACLRecord_DENY EACLRecord_Action = 2 +) + +var EACLRecord_Action_name = map[int32]string{ + 0: "ACTION_UNKNOWN", + 1: "ALLOW", + 2: "DENY", +} + +var EACLRecord_Action_value = map[string]int32{ + "ACTION_UNKNOWN": 0, + "ALLOW": 1, + "DENY": 2, +} + +func (x EACLRecord_Action) String() string { + return proto.EnumName(EACLRecord_Action_name, int32(x)) +} + +func (EACLRecord_Action) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_ab60484daff20d3c, []int{0, 1} +} + +// Header is an enumeration of filtering header types. +type EACLRecord_FilterInfo_Header int32 + +const ( + EACLRecord_FilterInfo_HEADER_UNKNOWN EACLRecord_FilterInfo_Header = 0 + EACLRecord_FilterInfo_REQUEST EACLRecord_FilterInfo_Header = 1 + EACLRecord_FilterInfo_OBJECT EACLRecord_FilterInfo_Header = 2 +) + +var EACLRecord_FilterInfo_Header_name = map[int32]string{ + 0: "HEADER_UNKNOWN", + 1: "REQUEST", + 2: "OBJECT", +} + +var EACLRecord_FilterInfo_Header_value = map[string]int32{ + "HEADER_UNKNOWN": 0, + "REQUEST": 1, + "OBJECT": 2, +} + +func (x EACLRecord_FilterInfo_Header) String() string { + return proto.EnumName(EACLRecord_FilterInfo_Header_name, int32(x)) +} + +func (EACLRecord_FilterInfo_Header) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_ab60484daff20d3c, []int{0, 0, 0} +} + +// MatchType is an enumeration of match types. +type EACLRecord_FilterInfo_MatchType int32 + +const ( + EACLRecord_FilterInfo_MATCH_UNKNOWN EACLRecord_FilterInfo_MatchType = 0 + EACLRecord_FilterInfo_STRING_EQUAL EACLRecord_FilterInfo_MatchType = 1 + EACLRecord_FilterInfo_STRING_NOT_EQUAL EACLRecord_FilterInfo_MatchType = 2 +) + +var EACLRecord_FilterInfo_MatchType_name = map[int32]string{ + 0: "MATCH_UNKNOWN", + 1: "STRING_EQUAL", + 2: "STRING_NOT_EQUAL", +} + +var EACLRecord_FilterInfo_MatchType_value = map[string]int32{ + "MATCH_UNKNOWN": 0, + "STRING_EQUAL": 1, + "STRING_NOT_EQUAL": 2, +} + +func (x EACLRecord_FilterInfo_MatchType) String() string { + return proto.EnumName(EACLRecord_FilterInfo_MatchType_name, int32(x)) +} + +func (EACLRecord_FilterInfo_MatchType) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_ab60484daff20d3c, []int{0, 0, 1} +} + +// EACLRecord groups information about extended ACL rule. +type EACLRecord struct { + // Operation carries type of operation. + Operation EACLRecord_Operation `protobuf:"varint,1,opt,name=operation,json=Operation,proto3,enum=acl.v2.EACLRecord_Operation" json:"operation,omitempty"` + // Action carries ACL target action. + Action EACLRecord_Action `protobuf:"varint,2,opt,name=action,json=Action,proto3,enum=acl.v2.EACLRecord_Action" json:"action,omitempty"` + // filters carries set of filters. + Filters []*EACLRecord_FilterInfo `protobuf:"bytes,3,rep,name=filters,json=Filters,proto3" json:"filters,omitempty"` + // targets carries information about extended ACL target list. + Targets []*EACLRecord_TargetInfo `protobuf:"bytes,4,rep,name=targets,json=Targets,proto3" json:"targets,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *EACLRecord) Reset() { *m = EACLRecord{} } +func (m *EACLRecord) String() string { return proto.CompactTextString(m) } +func (*EACLRecord) ProtoMessage() {} +func (*EACLRecord) Descriptor() ([]byte, []int) { + return fileDescriptor_ab60484daff20d3c, []int{0} +} +func (m *EACLRecord) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EACLRecord) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EACLRecord.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *EACLRecord) XXX_Merge(src proto.Message) { + xxx_messageInfo_EACLRecord.Merge(m, src) +} +func (m *EACLRecord) XXX_Size() int { + return m.Size() +} +func (m *EACLRecord) XXX_DiscardUnknown() { + xxx_messageInfo_EACLRecord.DiscardUnknown(m) +} + +var xxx_messageInfo_EACLRecord proto.InternalMessageInfo + +func (m *EACLRecord) GetOperation() EACLRecord_Operation { + if m != nil { + return m.Operation + } + return EACLRecord_OPERATION_UNKNOWN +} + +func (m *EACLRecord) GetAction() EACLRecord_Action { + if m != nil { + return m.Action + } + return EACLRecord_ACTION_UNKNOWN +} + +func (m *EACLRecord) GetFilters() []*EACLRecord_FilterInfo { + if m != nil { + return m.Filters + } + return nil +} + +func (m *EACLRecord) GetTargets() []*EACLRecord_TargetInfo { + if m != nil { + return m.Targets + } + return nil +} + +// FilterInfo groups information about filter. +type EACLRecord_FilterInfo struct { + // Header carries type of header. + Header EACLRecord_FilterInfo_Header `protobuf:"varint,1,opt,name=header,json=HeaderType,proto3,enum=acl.v2.EACLRecord_FilterInfo_Header" json:"header,omitempty"` + // MatchType carries type of match. + MatchType EACLRecord_FilterInfo_MatchType `protobuf:"varint,2,opt,name=match_type,json=MatchType,proto3,enum=acl.v2.EACLRecord_FilterInfo_MatchType" json:"match_type,omitempty"` + // header_name carries name of filtering header. + HeaderName string `protobuf:"bytes,3,opt,name=header_name,json=Name,proto3" json:"header_name,omitempty"` + // header_val carries value of filtering header. + HeaderVal string `protobuf:"bytes,4,opt,name=header_val,json=Value,proto3" json:"header_val,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *EACLRecord_FilterInfo) Reset() { *m = EACLRecord_FilterInfo{} } +func (m *EACLRecord_FilterInfo) String() string { return proto.CompactTextString(m) } +func (*EACLRecord_FilterInfo) ProtoMessage() {} +func (*EACLRecord_FilterInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_ab60484daff20d3c, []int{0, 0} +} +func (m *EACLRecord_FilterInfo) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EACLRecord_FilterInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EACLRecord_FilterInfo.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *EACLRecord_FilterInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_EACLRecord_FilterInfo.Merge(m, src) +} +func (m *EACLRecord_FilterInfo) XXX_Size() int { + return m.Size() +} +func (m *EACLRecord_FilterInfo) XXX_DiscardUnknown() { + xxx_messageInfo_EACLRecord_FilterInfo.DiscardUnknown(m) +} + +var xxx_messageInfo_EACLRecord_FilterInfo proto.InternalMessageInfo + +func (m *EACLRecord_FilterInfo) GetHeader() EACLRecord_FilterInfo_Header { + if m != nil { + return m.Header + } + return EACLRecord_FilterInfo_HEADER_UNKNOWN +} + +func (m *EACLRecord_FilterInfo) GetMatchType() EACLRecord_FilterInfo_MatchType { + if m != nil { + return m.MatchType + } + return EACLRecord_FilterInfo_MATCH_UNKNOWN +} + +func (m *EACLRecord_FilterInfo) GetHeaderName() string { + if m != nil { + return m.HeaderName + } + return "" +} + +func (m *EACLRecord_FilterInfo) GetHeaderVal() string { + if m != nil { + return m.HeaderVal + } + return "" +} + +// TargetInfo groups information about extended ACL target. +type EACLRecord_TargetInfo struct { + // target carries target of ACL rule. + Target Target `protobuf:"varint,1,opt,name=target,json=Role,proto3,enum=acl.v2.Target" json:"target,omitempty"` + // key_list carries public keys of ACL target. + KeyList [][]byte `protobuf:"bytes,2,rep,name=key_list,json=Keys,proto3" json:"key_list,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *EACLRecord_TargetInfo) Reset() { *m = EACLRecord_TargetInfo{} } +func (m *EACLRecord_TargetInfo) String() string { return proto.CompactTextString(m) } +func (*EACLRecord_TargetInfo) ProtoMessage() {} +func (*EACLRecord_TargetInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_ab60484daff20d3c, []int{0, 1} +} +func (m *EACLRecord_TargetInfo) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EACLRecord_TargetInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EACLRecord_TargetInfo.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *EACLRecord_TargetInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_EACLRecord_TargetInfo.Merge(m, src) +} +func (m *EACLRecord_TargetInfo) XXX_Size() int { + return m.Size() +} +func (m *EACLRecord_TargetInfo) XXX_DiscardUnknown() { + xxx_messageInfo_EACLRecord_TargetInfo.DiscardUnknown(m) +} + +var xxx_messageInfo_EACLRecord_TargetInfo proto.InternalMessageInfo + +func (m *EACLRecord_TargetInfo) GetTarget() Target { + if m != nil { + return m.Target + } + return Target_UNKNOWN +} + +func (m *EACLRecord_TargetInfo) GetKeyList() [][]byte { + if m != nil { + return m.KeyList + } + return nil +} + +// EACLRecord carries the information about extended ACL rules. +type EACLTable struct { + // Carries identifier of the container that should use given + // access control rules. + ContainerId *v2.ContainerID `protobuf:"bytes,1,opt,name=container_id,json=ContainerID,proto3" json:"container_id,omitempty"` + // Records carries list of extended ACL rule records. + Records []*EACLRecord `protobuf:"bytes,2,rep,name=records,json=Records,proto3" json:"records,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *EACLTable) Reset() { *m = EACLTable{} } +func (m *EACLTable) String() string { return proto.CompactTextString(m) } +func (*EACLTable) ProtoMessage() {} +func (*EACLTable) Descriptor() ([]byte, []int) { + return fileDescriptor_ab60484daff20d3c, []int{1} +} +func (m *EACLTable) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EACLTable) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EACLTable.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *EACLTable) XXX_Merge(src proto.Message) { + xxx_messageInfo_EACLTable.Merge(m, src) +} +func (m *EACLTable) XXX_Size() int { + return m.Size() +} +func (m *EACLTable) XXX_DiscardUnknown() { + xxx_messageInfo_EACLTable.DiscardUnknown(m) +} + +var xxx_messageInfo_EACLTable proto.InternalMessageInfo + +func (m *EACLTable) GetContainerId() *v2.ContainerID { + if m != nil { + return m.ContainerId + } + return nil +} + +func (m *EACLTable) GetRecords() []*EACLRecord { + if m != nil { + return m.Records + } + return nil +} + +func init() { + proto.RegisterEnum("acl.v2.Target", Target_name, Target_value) + proto.RegisterEnum("acl.v2.EACLRecord_Operation", EACLRecord_Operation_name, EACLRecord_Operation_value) + proto.RegisterEnum("acl.v2.EACLRecord_Action", EACLRecord_Action_name, EACLRecord_Action_value) + proto.RegisterEnum("acl.v2.EACLRecord_FilterInfo_Header", EACLRecord_FilterInfo_Header_name, EACLRecord_FilterInfo_Header_value) + proto.RegisterEnum("acl.v2.EACLRecord_FilterInfo_MatchType", EACLRecord_FilterInfo_MatchType_name, EACLRecord_FilterInfo_MatchType_value) + proto.RegisterType((*EACLRecord)(nil), "acl.v2.EACLRecord") + proto.RegisterType((*EACLRecord_FilterInfo)(nil), "acl.v2.EACLRecord.FilterInfo") + proto.RegisterType((*EACLRecord_TargetInfo)(nil), "acl.v2.EACLRecord.TargetInfo") + proto.RegisterType((*EACLTable)(nil), "acl.v2.EACLTable") +} + +func init() { proto.RegisterFile("acl/v2/types.proto", fileDescriptor_ab60484daff20d3c) } + +var fileDescriptor_ab60484daff20d3c = []byte{ + // 674 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x54, 0xdd, 0x6e, 0xda, 0x4a, + 0x10, 0x8e, 0x8d, 0x63, 0x60, 0x20, 0x68, 0xb3, 0x27, 0xe7, 0x88, 0x44, 0xa7, 0x08, 0xa1, 0x48, + 0x45, 0x55, 0x63, 0x14, 0xaa, 0x2a, 0x52, 0xaf, 0xea, 0xc0, 0xf2, 0x93, 0x10, 0x93, 0xac, 0x4d, + 0xa3, 0xf4, 0x06, 0x6d, 0xcc, 0x92, 0xa0, 0x1a, 0x8c, 0x6c, 0x07, 0x89, 0x37, 0xe9, 0x33, 0xf4, + 0xb2, 0x4f, 0x51, 0xa9, 0x37, 0x7d, 0x84, 0x2a, 0x7d, 0x91, 0x6a, 0xbd, 0x10, 0x50, 0x9a, 0xe6, + 0x6a, 0xc7, 0x33, 0xdf, 0xb7, 0x33, 0xdf, 0xcc, 0x78, 0x01, 0x33, 0xd7, 0xab, 0xcc, 0xaa, 0x95, + 0x68, 0x3e, 0xe5, 0xa1, 0x31, 0x0d, 0xfc, 0xc8, 0xc7, 0x3a, 0x73, 0x3d, 0x63, 0x56, 0xdd, 0xfb, + 0x27, 0xe0, 0xc3, 0xf0, 0x51, 0xb0, 0xf4, 0x55, 0x07, 0x20, 0x66, 0xad, 0x43, 0xb9, 0xeb, 0x07, + 0x03, 0xfc, 0x0e, 0xd2, 0xfe, 0x94, 0x07, 0x2c, 0x1a, 0xf9, 0x93, 0xbc, 0x52, 0x54, 0xca, 0xb9, + 0xea, 0xff, 0x86, 0xe4, 0x1b, 0x2b, 0x98, 0xd1, 0x5d, 0x62, 0x68, 0xfa, 0xc1, 0xc4, 0x87, 0xa0, + 0x33, 0x37, 0x26, 0xaa, 0x31, 0x71, 0xf7, 0x09, 0xa2, 0x19, 0x03, 0xa8, 0x2e, 0x4f, 0x7c, 0x04, + 0xc9, 0xe1, 0xc8, 0x8b, 0x78, 0x10, 0xe6, 0x13, 0xc5, 0x44, 0x39, 0x53, 0x7d, 0xf1, 0x04, 0xa7, + 0x11, 0x23, 0xda, 0x93, 0xa1, 0x4f, 0x93, 0xd2, 0x0e, 0x05, 0x31, 0x62, 0xc1, 0x0d, 0x8f, 0xc2, + 0xbc, 0xf6, 0x57, 0xa2, 0x13, 0x23, 0x24, 0x51, 0xda, 0xe1, 0xde, 0x77, 0x15, 0x60, 0x75, 0x21, + 0x7e, 0x0f, 0xfa, 0x2d, 0x67, 0x03, 0x1e, 0x2c, 0xc4, 0xee, 0x3f, 0x9b, 0xdf, 0x68, 0xc5, 0x58, + 0x0a, 0xf2, 0x74, 0xe6, 0x53, 0x8e, 0x1b, 0x00, 0x63, 0x16, 0xb9, 0xb7, 0x7d, 0xd1, 0xd5, 0x85, + 0xf2, 0x97, 0xcf, 0xdf, 0x72, 0x26, 0xf0, 0x82, 0x4c, 0xd3, 0x0f, 0x26, 0xde, 0x85, 0x8c, 0xac, + 0xa4, 0x3f, 0x61, 0x63, 0x9e, 0x4f, 0x14, 0x95, 0x72, 0x9a, 0x6a, 0x16, 0x1b, 0x8b, 0x10, 0x2c, + 0x42, 0x33, 0xe6, 0xe5, 0xb5, 0x38, 0xb2, 0xf9, 0x81, 0x79, 0x77, 0xbc, 0xf4, 0x16, 0x74, 0x59, + 0x0b, 0xc6, 0x90, 0x6b, 0x11, 0xb3, 0x4e, 0x68, 0xbf, 0x67, 0x9d, 0x5a, 0xdd, 0x4b, 0x0b, 0x6d, + 0xe0, 0x0c, 0x24, 0x29, 0xb9, 0xe8, 0x11, 0xdb, 0x41, 0x0a, 0x06, 0xd0, 0xbb, 0xc7, 0x27, 0xa4, + 0xe6, 0x20, 0xb5, 0xd4, 0x80, 0xb5, 0xcc, 0xdb, 0xb0, 0x75, 0x66, 0x3a, 0xb5, 0xd6, 0x1a, 0x11, + 0x41, 0xd6, 0x76, 0x68, 0xdb, 0x6a, 0xf6, 0xc9, 0x45, 0xcf, 0xec, 0x20, 0x05, 0xef, 0x00, 0x5a, + 0x78, 0xac, 0xae, 0xb3, 0xf0, 0xaa, 0x7b, 0x27, 0x00, 0xab, 0x26, 0xe3, 0x7d, 0xd0, 0xe5, 0x50, + 0x16, 0xcd, 0xcc, 0x2d, 0xdb, 0x20, 0x31, 0x54, 0xa3, 0xbe, 0xc7, 0xf1, 0x7f, 0x90, 0xfa, 0xc4, + 0xe7, 0x7d, 0x6f, 0x14, 0x46, 0x79, 0xb5, 0x98, 0x28, 0x67, 0xa9, 0x76, 0xca, 0xe7, 0x61, 0x69, + 0x06, 0x6b, 0xbb, 0xf4, 0x2f, 0x6c, 0x77, 0xcf, 0x09, 0x35, 0x9d, 0x76, 0xd7, 0x5a, 0xab, 0x2b, + 0x09, 0x89, 0x26, 0x11, 0x62, 0x52, 0xa0, 0x09, 0xb5, 0x48, 0x15, 0xae, 0xf3, 0x9e, 0x83, 0x12, + 0x42, 0x5f, 0x9d, 0x74, 0x88, 0x43, 0x90, 0x26, 0x6c, 0x9b, 0x98, 0xb4, 0xd6, 0x42, 0x9b, 0x38, + 0x0b, 0xa9, 0x26, 0x71, 0xa8, 0x69, 0x35, 0x09, 0xd2, 0x85, 0xb2, 0xe5, 0x57, 0xcb, 0xb4, 0x5b, + 0x28, 0x59, 0x3a, 0x84, 0xe5, 0x36, 0x62, 0xc8, 0x99, 0xb5, 0x47, 0x19, 0xd3, 0xb0, 0x69, 0x76, + 0x3a, 0xdd, 0x4b, 0x99, 0xb3, 0x4e, 0xac, 0x2b, 0xa4, 0x96, 0x02, 0x48, 0x8b, 0xc9, 0x3a, 0xec, + 0xda, 0xe3, 0xf8, 0x08, 0xb2, 0xae, 0x3f, 0x89, 0xd8, 0x68, 0xc2, 0x83, 0xfe, 0x68, 0x10, 0x6b, + 0xcf, 0x54, 0x77, 0x0c, 0xf1, 0xb7, 0x09, 0xf1, 0xb5, 0x65, 0xb0, 0x5d, 0xa7, 0x99, 0xb5, 0x0f, + 0xfc, 0x1a, 0x92, 0x41, 0xbc, 0x1b, 0x61, 0xdc, 0x87, 0x4c, 0x15, 0xff, 0xb9, 0x36, 0x34, 0x29, + 0xcf, 0xf0, 0xd5, 0x11, 0xe8, 0xb2, 0x8d, 0x62, 0xaa, 0xab, 0xfa, 0x52, 0xa0, 0xf5, 0x6c, 0x42, + 0xe5, 0x7c, 0xed, 0x2b, 0xdb, 0x21, 0x67, 0x48, 0x8d, 0x67, 0xed, 0xb4, 0x08, 0xb5, 0x51, 0xe2, + 0xf8, 0xe4, 0xdb, 0x7d, 0x41, 0xf9, 0x71, 0x5f, 0x50, 0x7e, 0xde, 0x17, 0x94, 0xcf, 0xbf, 0x0a, + 0x1b, 0x1f, 0xcb, 0x37, 0xa3, 0xe8, 0xf6, 0xee, 0xda, 0x70, 0xfd, 0x71, 0x65, 0x12, 0x4e, 0x5d, + 0xf7, 0x60, 0xc0, 0x67, 0x95, 0x09, 0xf7, 0x87, 0xe1, 0x01, 0x9b, 0x8e, 0x0e, 0x6e, 0xfc, 0x8a, + 0x7c, 0x46, 0xbe, 0xa8, 0x5b, 0x16, 0xf7, 0x1b, 0xb6, 0x61, 0x9e, 0xb7, 0x0d, 0xd3, 0xf5, 0xae, + 0xf5, 0xf8, 0xd1, 0x78, 0xf3, 0x3b, 0x00, 0x00, 0xff, 0xff, 0xc3, 0x1e, 0x3c, 0xb6, 0x67, 0x04, + 0x00, 0x00, +} + +func (m *EACLRecord) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *EACLRecord) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EACLRecord) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Targets) > 0 { + for iNdEx := len(m.Targets) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Targets[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + } + if len(m.Filters) > 0 { + for iNdEx := len(m.Filters) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Filters[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } + if m.Action != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Action)) + i-- + dAtA[i] = 0x10 + } + if m.Operation != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Operation)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *EACLRecord_FilterInfo) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *EACLRecord_FilterInfo) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EACLRecord_FilterInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.HeaderVal) > 0 { + i -= len(m.HeaderVal) + copy(dAtA[i:], m.HeaderVal) + i = encodeVarintTypes(dAtA, i, uint64(len(m.HeaderVal))) + i-- + dAtA[i] = 0x22 + } + if len(m.HeaderName) > 0 { + i -= len(m.HeaderName) + copy(dAtA[i:], m.HeaderName) + i = encodeVarintTypes(dAtA, i, uint64(len(m.HeaderName))) + i-- + dAtA[i] = 0x1a + } + if m.MatchType != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.MatchType)) + i-- + dAtA[i] = 0x10 + } + if m.Header != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Header)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *EACLRecord_TargetInfo) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *EACLRecord_TargetInfo) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EACLRecord_TargetInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.KeyList) > 0 { + for iNdEx := len(m.KeyList) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.KeyList[iNdEx]) + copy(dAtA[i:], m.KeyList[iNdEx]) + i = encodeVarintTypes(dAtA, i, uint64(len(m.KeyList[iNdEx]))) + i-- + dAtA[i] = 0x12 + } + } + if m.Target != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Target)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *EACLTable) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *EACLTable) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EACLTable) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Records) > 0 { + for iNdEx := len(m.Records) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Records[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if m.ContainerId != nil { + { + size, err := m.ContainerId.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintTypes(dAtA []byte, offset int, v uint64) int { + offset -= sovTypes(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *EACLRecord) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Operation != 0 { + n += 1 + sovTypes(uint64(m.Operation)) + } + if m.Action != 0 { + n += 1 + sovTypes(uint64(m.Action)) + } + if len(m.Filters) > 0 { + for _, e := range m.Filters { + l = e.Size() + n += 1 + l + sovTypes(uint64(l)) + } + } + if len(m.Targets) > 0 { + for _, e := range m.Targets { + l = e.Size() + n += 1 + l + sovTypes(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *EACLRecord_FilterInfo) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Header != 0 { + n += 1 + sovTypes(uint64(m.Header)) + } + if m.MatchType != 0 { + n += 1 + sovTypes(uint64(m.MatchType)) + } + l = len(m.HeaderName) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.HeaderVal) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *EACLRecord_TargetInfo) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Target != 0 { + n += 1 + sovTypes(uint64(m.Target)) + } + if len(m.KeyList) > 0 { + for _, b := range m.KeyList { + l = len(b) + n += 1 + l + sovTypes(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *EACLTable) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ContainerId != nil { + l = m.ContainerId.Size() + n += 1 + l + sovTypes(uint64(l)) + } + if len(m.Records) > 0 { + for _, e := range m.Records { + l = e.Size() + n += 1 + l + sovTypes(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovTypes(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozTypes(x uint64) (n int) { + return sovTypes(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *EACLRecord) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: EACLRecord: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EACLRecord: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Operation", wireType) + } + m.Operation = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Operation |= EACLRecord_Operation(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Action", wireType) + } + m.Action = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Action |= EACLRecord_Action(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Filters", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Filters = append(m.Filters, &EACLRecord_FilterInfo{}) + if err := m.Filters[len(m.Filters)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Targets", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Targets = append(m.Targets, &EACLRecord_TargetInfo{}) + if err := m.Targets[len(m.Targets)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *EACLRecord_FilterInfo) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: FilterInfo: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: FilterInfo: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType) + } + m.Header = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Header |= EACLRecord_FilterInfo_Header(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MatchType", wireType) + } + m.MatchType = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MatchType |= EACLRecord_FilterInfo_MatchType(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field HeaderName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.HeaderName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field HeaderVal", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.HeaderVal = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *EACLRecord_TargetInfo) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: TargetInfo: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TargetInfo: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Target", wireType) + } + m.Target = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Target |= Target(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field KeyList", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.KeyList = append(m.KeyList, make([]byte, postIndex-iNdEx)) + copy(m.KeyList[len(m.KeyList)-1], dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *EACLTable) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: EACLTable: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EACLTable: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ContainerId", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.ContainerId == nil { + m.ContainerId = &v2.ContainerID{} + } + if err := m.ContainerId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Records", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Records = append(m.Records, &EACLRecord{}) + if err := m.Records[len(m.Records)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipTypes(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthTypes + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTypes + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthTypes + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthTypes = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTypes = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTypes = fmt.Errorf("proto: unexpected end of group") +) diff --git a/acl/v2/types.proto b/acl/v2/types.proto new file mode 100644 index 0000000..58bbe25 --- /dev/null +++ b/acl/v2/types.proto @@ -0,0 +1,106 @@ +syntax = "proto3"; + +package acl.v2; + +option go_package = "github.com/nspcc-dev/neofs-api-go/acl/v2"; +option csharp_namespace = "NeoFS.API.Acl"; + +import "refs/v2/types.proto"; + +// Target of the access control rule in access control list. +enum Target { + // Unknown target, default value. + UNKNOWN = 0; + + // User target rule is applied if sender is the owner of the container.v2. + USER = 1; + + // System target rule is applied if sender is the storage node within the + // container or inner ring node. + SYSTEM = 2; + + // Others target rule is applied if sender is not user or system target. + OTHERS = 3; +} + +// EACLRecord groups information about extended ACL rule. +message EACLRecord { + // Operation is an enumeration of operation types. + enum Operation { + OPERATION_UNKNOWN = 0; + GET = 1; + HEAD = 2; + PUT = 3; + DELETE = 4; + SEARCH = 5; + GETRANGE = 6; + GETRANGEHASH = 7; + } + + // Operation carries type of operation. + Operation operation = 1 [json_name = "Operation"]; + + // Action is an enumeration of EACL actions. + enum Action { + ACTION_UNKNOWN = 0; + ALLOW = 1; + DENY = 2; + } + + // Action carries ACL target action. + Action action = 2 [json_name = "Action"]; + + // FilterInfo groups information about filter. + message FilterInfo { + // Header is an enumeration of filtering header types. + enum Header { + HEADER_UNKNOWN = 0; + REQUEST = 1; + OBJECT = 2; + } + + // Header carries type of header. + Header header = 1 [json_name = "HeaderType"]; + + // MatchType is an enumeration of match types. + enum MatchType { + MATCH_UNKNOWN = 0; + STRING_EQUAL = 1; + STRING_NOT_EQUAL = 2; + } + + // MatchType carries type of match. + MatchType match_type = 2 [json_name = "MatchType"]; + + // header_name carries name of filtering header. + string header_name = 3 [json_name="Name"]; + + // header_val carries value of filtering header. + string header_val = 4 [json_name="Value"]; + } + + // filters carries set of filters. + repeated FilterInfo filters = 3 [json_name="Filters"]; + + // TargetInfo groups information about extended ACL target. + message TargetInfo { + // target carries target of ACL rule. + acl.v2.Target target = 1 [json_name="Role"]; + + // key_list carries public keys of ACL target. + repeated bytes key_list = 2 [json_name="Keys"]; + } + + // targets carries information about extended ACL target list. + repeated TargetInfo targets = 4 [json_name="Targets"]; +} + +// EACLRecord carries the information about extended ACL rules. +message EACLTable { + // Carries identifier of the container that should use given + // access control rules. + refs.v2.ContainerID container_id = 1 [json_name="ContainerID"]; + + // Records carries list of extended ACL rule records. + repeated EACLRecord records = 2 [json_name="Records"]; +} diff --git a/container/v2/service.pb.go b/container/v2/service.pb.go new file mode 100644 index 0000000..29fd633 --- /dev/null +++ b/container/v2/service.pb.go @@ -0,0 +1,6794 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: container/v2/service.proto + +package v2 + +import ( + context "context" + fmt "fmt" + proto "github.com/golang/protobuf/proto" + v22 "github.com/nspcc-dev/neofs-api-go/acl/v2" + v21 "github.com/nspcc-dev/neofs-api-go/refs/v2" + v2 "github.com/nspcc-dev/neofs-api-go/service/v2" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package + +type PutRequest struct { + // Body of container put request message. + Body *PutRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` + // Carries request meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *v2.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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 *v2.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *PutRequest) Reset() { *m = PutRequest{} } +func (m *PutRequest) String() string { return proto.CompactTextString(m) } +func (*PutRequest) ProtoMessage() {} +func (*PutRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_1c484d370787a129, []int{0} +} +func (m *PutRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *PutRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_PutRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *PutRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_PutRequest.Merge(m, src) +} +func (m *PutRequest) XXX_Size() int { + return m.Size() +} +func (m *PutRequest) XXX_DiscardUnknown() { + xxx_messageInfo_PutRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_PutRequest proto.InternalMessageInfo + +func (m *PutRequest) GetBody() *PutRequest_Body { + if m != nil { + return m.Body + } + return nil +} + +func (m *PutRequest) GetMetaHeader() *v2.RequestMetaHeader { + if m != nil { + return m.MetaHeader + } + return nil +} + +func (m *PutRequest) GetVerifyHeader() *v2.RequestVerificationHeader { + if m != nil { + return m.VerifyHeader + } + return nil +} + +type PutRequest_Body struct { + // Container to create in NeoFS. + Container *Container `protobuf:"bytes,1,opt,name=container,proto3" json:"container,omitempty"` + // Public Key of container owner. It can be public key of the owner + // or it can be public key that bound in neofs.id smart-contract. + PublicKey []byte `protobuf:"bytes,2,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"` + // Signature of stable-marshalled container according to RFC-6979. + Signature []byte `protobuf:"bytes,3,opt,name=signature,proto3" json:"signature,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *PutRequest_Body) Reset() { *m = PutRequest_Body{} } +func (m *PutRequest_Body) String() string { return proto.CompactTextString(m) } +func (*PutRequest_Body) ProtoMessage() {} +func (*PutRequest_Body) Descriptor() ([]byte, []int) { + return fileDescriptor_1c484d370787a129, []int{0, 0} +} +func (m *PutRequest_Body) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *PutRequest_Body) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_PutRequest_Body.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *PutRequest_Body) XXX_Merge(src proto.Message) { + xxx_messageInfo_PutRequest_Body.Merge(m, src) +} +func (m *PutRequest_Body) XXX_Size() int { + return m.Size() +} +func (m *PutRequest_Body) XXX_DiscardUnknown() { + xxx_messageInfo_PutRequest_Body.DiscardUnknown(m) +} + +var xxx_messageInfo_PutRequest_Body proto.InternalMessageInfo + +func (m *PutRequest_Body) GetContainer() *Container { + if m != nil { + return m.Container + } + return nil +} + +func (m *PutRequest_Body) GetPublicKey() []byte { + if m != nil { + return m.PublicKey + } + return nil +} + +func (m *PutRequest_Body) GetSignature() []byte { + if m != nil { + return m.Signature + } + return nil +} + +type PutResponse struct { + // Body of container put response message. + Body *PutResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` + // Carries response meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *v2.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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 *v2.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *PutResponse) Reset() { *m = PutResponse{} } +func (m *PutResponse) String() string { return proto.CompactTextString(m) } +func (*PutResponse) ProtoMessage() {} +func (*PutResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_1c484d370787a129, []int{1} +} +func (m *PutResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *PutResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_PutResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *PutResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_PutResponse.Merge(m, src) +} +func (m *PutResponse) XXX_Size() int { + return m.Size() +} +func (m *PutResponse) XXX_DiscardUnknown() { + xxx_messageInfo_PutResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_PutResponse proto.InternalMessageInfo + +func (m *PutResponse) GetBody() *PutResponse_Body { + if m != nil { + return m.Body + } + return nil +} + +func (m *PutResponse) GetMetaHeader() *v2.ResponseMetaHeader { + if m != nil { + return m.MetaHeader + } + return nil +} + +func (m *PutResponse) GetVerifyHeader() *v2.ResponseVerificationHeader { + if m != nil { + return m.VerifyHeader + } + return nil +} + +type PutResponse_Body struct { + // container_id carries identifier of the new container.v2. + ContainerId *v21.ContainerID `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *PutResponse_Body) Reset() { *m = PutResponse_Body{} } +func (m *PutResponse_Body) String() string { return proto.CompactTextString(m) } +func (*PutResponse_Body) ProtoMessage() {} +func (*PutResponse_Body) Descriptor() ([]byte, []int) { + return fileDescriptor_1c484d370787a129, []int{1, 0} +} +func (m *PutResponse_Body) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *PutResponse_Body) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_PutResponse_Body.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *PutResponse_Body) XXX_Merge(src proto.Message) { + xxx_messageInfo_PutResponse_Body.Merge(m, src) +} +func (m *PutResponse_Body) XXX_Size() int { + return m.Size() +} +func (m *PutResponse_Body) XXX_DiscardUnknown() { + xxx_messageInfo_PutResponse_Body.DiscardUnknown(m) +} + +var xxx_messageInfo_PutResponse_Body proto.InternalMessageInfo + +func (m *PutResponse_Body) GetContainerId() *v21.ContainerID { + if m != nil { + return m.ContainerId + } + return nil +} + +type DeleteRequest struct { + // Body of container delete request message. + Body *DeleteRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` + // Carries request meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *v2.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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 *v2.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DeleteRequest) Reset() { *m = DeleteRequest{} } +func (m *DeleteRequest) String() string { return proto.CompactTextString(m) } +func (*DeleteRequest) ProtoMessage() {} +func (*DeleteRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_1c484d370787a129, []int{2} +} +func (m *DeleteRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DeleteRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_DeleteRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *DeleteRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_DeleteRequest.Merge(m, src) +} +func (m *DeleteRequest) XXX_Size() int { + return m.Size() +} +func (m *DeleteRequest) XXX_DiscardUnknown() { + xxx_messageInfo_DeleteRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_DeleteRequest proto.InternalMessageInfo + +func (m *DeleteRequest) GetBody() *DeleteRequest_Body { + if m != nil { + return m.Body + } + return nil +} + +func (m *DeleteRequest) GetMetaHeader() *v2.RequestMetaHeader { + if m != nil { + return m.MetaHeader + } + return nil +} + +func (m *DeleteRequest) GetVerifyHeader() *v2.RequestVerificationHeader { + if m != nil { + return m.VerifyHeader + } + return nil +} + +type DeleteRequest_Body struct { + // container_id carries identifier of the container to delete + // from NeoFS. + ContainerId *v21.ContainerID `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` + // Signature of container id according to RFC-6979. + Signature []byte `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DeleteRequest_Body) Reset() { *m = DeleteRequest_Body{} } +func (m *DeleteRequest_Body) String() string { return proto.CompactTextString(m) } +func (*DeleteRequest_Body) ProtoMessage() {} +func (*DeleteRequest_Body) Descriptor() ([]byte, []int) { + return fileDescriptor_1c484d370787a129, []int{2, 0} +} +func (m *DeleteRequest_Body) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DeleteRequest_Body) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_DeleteRequest_Body.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *DeleteRequest_Body) XXX_Merge(src proto.Message) { + xxx_messageInfo_DeleteRequest_Body.Merge(m, src) +} +func (m *DeleteRequest_Body) XXX_Size() int { + return m.Size() +} +func (m *DeleteRequest_Body) XXX_DiscardUnknown() { + xxx_messageInfo_DeleteRequest_Body.DiscardUnknown(m) +} + +var xxx_messageInfo_DeleteRequest_Body proto.InternalMessageInfo + +func (m *DeleteRequest_Body) GetContainerId() *v21.ContainerID { + if m != nil { + return m.ContainerId + } + return nil +} + +func (m *DeleteRequest_Body) GetSignature() []byte { + if m != nil { + return m.Signature + } + return nil +} + +// DeleteResponse is empty because delete operation is asynchronous and done +// via consensus in inner ring nodes +type DeleteResponse struct { + // Body of container delete response message. + Body *DeleteResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` + // Carries response meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *v2.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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 *v2.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DeleteResponse) Reset() { *m = DeleteResponse{} } +func (m *DeleteResponse) String() string { return proto.CompactTextString(m) } +func (*DeleteResponse) ProtoMessage() {} +func (*DeleteResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_1c484d370787a129, []int{3} +} +func (m *DeleteResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DeleteResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_DeleteResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *DeleteResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_DeleteResponse.Merge(m, src) +} +func (m *DeleteResponse) XXX_Size() int { + return m.Size() +} +func (m *DeleteResponse) XXX_DiscardUnknown() { + xxx_messageInfo_DeleteResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_DeleteResponse proto.InternalMessageInfo + +func (m *DeleteResponse) GetBody() *DeleteResponse_Body { + if m != nil { + return m.Body + } + return nil +} + +func (m *DeleteResponse) GetMetaHeader() *v2.ResponseMetaHeader { + if m != nil { + return m.MetaHeader + } + return nil +} + +func (m *DeleteResponse) GetVerifyHeader() *v2.ResponseVerificationHeader { + if m != nil { + return m.VerifyHeader + } + return nil +} + +type DeleteResponse_Body struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DeleteResponse_Body) Reset() { *m = DeleteResponse_Body{} } +func (m *DeleteResponse_Body) String() string { return proto.CompactTextString(m) } +func (*DeleteResponse_Body) ProtoMessage() {} +func (*DeleteResponse_Body) Descriptor() ([]byte, []int) { + return fileDescriptor_1c484d370787a129, []int{3, 0} +} +func (m *DeleteResponse_Body) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DeleteResponse_Body) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_DeleteResponse_Body.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *DeleteResponse_Body) XXX_Merge(src proto.Message) { + xxx_messageInfo_DeleteResponse_Body.Merge(m, src) +} +func (m *DeleteResponse_Body) XXX_Size() int { + return m.Size() +} +func (m *DeleteResponse_Body) XXX_DiscardUnknown() { + xxx_messageInfo_DeleteResponse_Body.DiscardUnknown(m) +} + +var xxx_messageInfo_DeleteResponse_Body proto.InternalMessageInfo + +type GetRequest struct { + // Body of container get request message. + Body *GetRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` + // Carries request meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *v2.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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 *v2.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetRequest) Reset() { *m = GetRequest{} } +func (m *GetRequest) String() string { return proto.CompactTextString(m) } +func (*GetRequest) ProtoMessage() {} +func (*GetRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_1c484d370787a129, []int{4} +} +func (m *GetRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GetRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GetRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *GetRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetRequest.Merge(m, src) +} +func (m *GetRequest) XXX_Size() int { + return m.Size() +} +func (m *GetRequest) XXX_DiscardUnknown() { + xxx_messageInfo_GetRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_GetRequest proto.InternalMessageInfo + +func (m *GetRequest) GetBody() *GetRequest_Body { + if m != nil { + return m.Body + } + return nil +} + +func (m *GetRequest) GetMetaHeader() *v2.RequestMetaHeader { + if m != nil { + return m.MetaHeader + } + return nil +} + +func (m *GetRequest) GetVerifyHeader() *v2.RequestVerificationHeader { + if m != nil { + return m.VerifyHeader + } + return nil +} + +type GetRequest_Body struct { + // container_id carries identifier of the container to get. + ContainerId *v21.ContainerID `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetRequest_Body) Reset() { *m = GetRequest_Body{} } +func (m *GetRequest_Body) String() string { return proto.CompactTextString(m) } +func (*GetRequest_Body) ProtoMessage() {} +func (*GetRequest_Body) Descriptor() ([]byte, []int) { + return fileDescriptor_1c484d370787a129, []int{4, 0} +} +func (m *GetRequest_Body) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GetRequest_Body) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GetRequest_Body.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *GetRequest_Body) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetRequest_Body.Merge(m, src) +} +func (m *GetRequest_Body) XXX_Size() int { + return m.Size() +} +func (m *GetRequest_Body) XXX_DiscardUnknown() { + xxx_messageInfo_GetRequest_Body.DiscardUnknown(m) +} + +var xxx_messageInfo_GetRequest_Body proto.InternalMessageInfo + +func (m *GetRequest_Body) GetContainerId() *v21.ContainerID { + if m != nil { + return m.ContainerId + } + return nil +} + +type GetResponse struct { + // Body of container get response message. + Body *GetResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` + // Carries response meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *v2.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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 *v2.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetResponse) Reset() { *m = GetResponse{} } +func (m *GetResponse) String() string { return proto.CompactTextString(m) } +func (*GetResponse) ProtoMessage() {} +func (*GetResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_1c484d370787a129, []int{5} +} +func (m *GetResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GetResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GetResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *GetResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetResponse.Merge(m, src) +} +func (m *GetResponse) XXX_Size() int { + return m.Size() +} +func (m *GetResponse) XXX_DiscardUnknown() { + xxx_messageInfo_GetResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_GetResponse proto.InternalMessageInfo + +func (m *GetResponse) GetBody() *GetResponse_Body { + if m != nil { + return m.Body + } + return nil +} + +func (m *GetResponse) GetMetaHeader() *v2.ResponseMetaHeader { + if m != nil { + return m.MetaHeader + } + return nil +} + +func (m *GetResponse) GetVerifyHeader() *v2.ResponseVerificationHeader { + if m != nil { + return m.VerifyHeader + } + return nil +} + +type GetResponse_Body struct { + // Container that has been requested. + Container *Container `protobuf:"bytes,1,opt,name=container,proto3" json:"container,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetResponse_Body) Reset() { *m = GetResponse_Body{} } +func (m *GetResponse_Body) String() string { return proto.CompactTextString(m) } +func (*GetResponse_Body) ProtoMessage() {} +func (*GetResponse_Body) Descriptor() ([]byte, []int) { + return fileDescriptor_1c484d370787a129, []int{5, 0} +} +func (m *GetResponse_Body) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GetResponse_Body) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GetResponse_Body.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *GetResponse_Body) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetResponse_Body.Merge(m, src) +} +func (m *GetResponse_Body) XXX_Size() int { + return m.Size() +} +func (m *GetResponse_Body) XXX_DiscardUnknown() { + xxx_messageInfo_GetResponse_Body.DiscardUnknown(m) +} + +var xxx_messageInfo_GetResponse_Body proto.InternalMessageInfo + +func (m *GetResponse_Body) GetContainer() *Container { + if m != nil { + return m.Container + } + return nil +} + +type ListRequest struct { + // Body of list containers request message. + Body *ListRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` + // Carries request meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *v2.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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 *v2.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ListRequest) Reset() { *m = ListRequest{} } +func (m *ListRequest) String() string { return proto.CompactTextString(m) } +func (*ListRequest) ProtoMessage() {} +func (*ListRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_1c484d370787a129, []int{6} +} +func (m *ListRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ListRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ListRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ListRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_ListRequest.Merge(m, src) +} +func (m *ListRequest) XXX_Size() int { + return m.Size() +} +func (m *ListRequest) XXX_DiscardUnknown() { + xxx_messageInfo_ListRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_ListRequest proto.InternalMessageInfo + +func (m *ListRequest) GetBody() *ListRequest_Body { + if m != nil { + return m.Body + } + return nil +} + +func (m *ListRequest) GetMetaHeader() *v2.RequestMetaHeader { + if m != nil { + return m.MetaHeader + } + return nil +} + +func (m *ListRequest) GetVerifyHeader() *v2.RequestVerificationHeader { + if m != nil { + return m.VerifyHeader + } + return nil +} + +type ListRequest_Body struct { + // owner_id carries identifier of the container owner. + OwnerId *v21.OwnerID `protobuf:"bytes,1,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ListRequest_Body) Reset() { *m = ListRequest_Body{} } +func (m *ListRequest_Body) String() string { return proto.CompactTextString(m) } +func (*ListRequest_Body) ProtoMessage() {} +func (*ListRequest_Body) Descriptor() ([]byte, []int) { + return fileDescriptor_1c484d370787a129, []int{6, 0} +} +func (m *ListRequest_Body) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ListRequest_Body) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ListRequest_Body.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ListRequest_Body) XXX_Merge(src proto.Message) { + xxx_messageInfo_ListRequest_Body.Merge(m, src) +} +func (m *ListRequest_Body) XXX_Size() int { + return m.Size() +} +func (m *ListRequest_Body) XXX_DiscardUnknown() { + xxx_messageInfo_ListRequest_Body.DiscardUnknown(m) +} + +var xxx_messageInfo_ListRequest_Body proto.InternalMessageInfo + +func (m *ListRequest_Body) GetOwnerId() *v21.OwnerID { + if m != nil { + return m.OwnerId + } + return nil +} + +type ListResponse struct { + // Body of list containers response message. + Body *ListResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` + // Carries response meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *v2.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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 *v2.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ListResponse) Reset() { *m = ListResponse{} } +func (m *ListResponse) String() string { return proto.CompactTextString(m) } +func (*ListResponse) ProtoMessage() {} +func (*ListResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_1c484d370787a129, []int{7} +} +func (m *ListResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ListResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ListResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ListResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_ListResponse.Merge(m, src) +} +func (m *ListResponse) XXX_Size() int { + return m.Size() +} +func (m *ListResponse) XXX_DiscardUnknown() { + xxx_messageInfo_ListResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_ListResponse proto.InternalMessageInfo + +func (m *ListResponse) GetBody() *ListResponse_Body { + if m != nil { + return m.Body + } + return nil +} + +func (m *ListResponse) GetMetaHeader() *v2.ResponseMetaHeader { + if m != nil { + return m.MetaHeader + } + return nil +} + +func (m *ListResponse) GetVerifyHeader() *v2.ResponseVerificationHeader { + if m != nil { + return m.VerifyHeader + } + return nil +} + +type ListResponse_Body struct { + // ContainerIDs carries list of identifiers of the containers that belong to the owner. + ContainerIds []*v21.ContainerID `protobuf:"bytes,1,rep,name=container_ids,json=containerIds,proto3" json:"container_ids,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ListResponse_Body) Reset() { *m = ListResponse_Body{} } +func (m *ListResponse_Body) String() string { return proto.CompactTextString(m) } +func (*ListResponse_Body) ProtoMessage() {} +func (*ListResponse_Body) Descriptor() ([]byte, []int) { + return fileDescriptor_1c484d370787a129, []int{7, 0} +} +func (m *ListResponse_Body) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ListResponse_Body) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ListResponse_Body.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ListResponse_Body) XXX_Merge(src proto.Message) { + xxx_messageInfo_ListResponse_Body.Merge(m, src) +} +func (m *ListResponse_Body) XXX_Size() int { + return m.Size() +} +func (m *ListResponse_Body) XXX_DiscardUnknown() { + xxx_messageInfo_ListResponse_Body.DiscardUnknown(m) +} + +var xxx_messageInfo_ListResponse_Body proto.InternalMessageInfo + +func (m *ListResponse_Body) GetContainerIds() []*v21.ContainerID { + if m != nil { + return m.ContainerIds + } + return nil +} + +type SetExtendedACLRequest struct { + // Body of set extended acl request message. + Body *SetExtendedACLRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` + // Carries request meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *v2.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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 *v2.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SetExtendedACLRequest) Reset() { *m = SetExtendedACLRequest{} } +func (m *SetExtendedACLRequest) String() string { return proto.CompactTextString(m) } +func (*SetExtendedACLRequest) ProtoMessage() {} +func (*SetExtendedACLRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_1c484d370787a129, []int{8} +} +func (m *SetExtendedACLRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *SetExtendedACLRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_SetExtendedACLRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *SetExtendedACLRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_SetExtendedACLRequest.Merge(m, src) +} +func (m *SetExtendedACLRequest) XXX_Size() int { + return m.Size() +} +func (m *SetExtendedACLRequest) XXX_DiscardUnknown() { + xxx_messageInfo_SetExtendedACLRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_SetExtendedACLRequest proto.InternalMessageInfo + +func (m *SetExtendedACLRequest) GetBody() *SetExtendedACLRequest_Body { + if m != nil { + return m.Body + } + return nil +} + +func (m *SetExtendedACLRequest) GetMetaHeader() *v2.RequestMetaHeader { + if m != nil { + return m.MetaHeader + } + return nil +} + +func (m *SetExtendedACLRequest) GetVerifyHeader() *v2.RequestVerificationHeader { + if m != nil { + return m.VerifyHeader + } + return nil +} + +type SetExtendedACLRequest_Body struct { + // Extended ACL to set for the container.v2. + Eacl *v22.EACLTable `protobuf:"bytes,1,opt,name=eacl,proto3" json:"eacl,omitempty"` + // Signature of stable-marshalled Extended ACL according to RFC-6979. + Signature []byte `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SetExtendedACLRequest_Body) Reset() { *m = SetExtendedACLRequest_Body{} } +func (m *SetExtendedACLRequest_Body) String() string { return proto.CompactTextString(m) } +func (*SetExtendedACLRequest_Body) ProtoMessage() {} +func (*SetExtendedACLRequest_Body) Descriptor() ([]byte, []int) { + return fileDescriptor_1c484d370787a129, []int{8, 0} +} +func (m *SetExtendedACLRequest_Body) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *SetExtendedACLRequest_Body) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_SetExtendedACLRequest_Body.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *SetExtendedACLRequest_Body) XXX_Merge(src proto.Message) { + xxx_messageInfo_SetExtendedACLRequest_Body.Merge(m, src) +} +func (m *SetExtendedACLRequest_Body) XXX_Size() int { + return m.Size() +} +func (m *SetExtendedACLRequest_Body) XXX_DiscardUnknown() { + xxx_messageInfo_SetExtendedACLRequest_Body.DiscardUnknown(m) +} + +var xxx_messageInfo_SetExtendedACLRequest_Body proto.InternalMessageInfo + +func (m *SetExtendedACLRequest_Body) GetEacl() *v22.EACLTable { + if m != nil { + return m.Eacl + } + return nil +} + +func (m *SetExtendedACLRequest_Body) GetSignature() []byte { + if m != nil { + return m.Signature + } + return nil +} + +type SetExtendedACLResponse struct { + // Body of set extended acl response message. + Body *SetExtendedACLResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` + // Carries response meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *v2.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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 *v2.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SetExtendedACLResponse) Reset() { *m = SetExtendedACLResponse{} } +func (m *SetExtendedACLResponse) String() string { return proto.CompactTextString(m) } +func (*SetExtendedACLResponse) ProtoMessage() {} +func (*SetExtendedACLResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_1c484d370787a129, []int{9} +} +func (m *SetExtendedACLResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *SetExtendedACLResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_SetExtendedACLResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *SetExtendedACLResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_SetExtendedACLResponse.Merge(m, src) +} +func (m *SetExtendedACLResponse) XXX_Size() int { + return m.Size() +} +func (m *SetExtendedACLResponse) XXX_DiscardUnknown() { + xxx_messageInfo_SetExtendedACLResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_SetExtendedACLResponse proto.InternalMessageInfo + +func (m *SetExtendedACLResponse) GetBody() *SetExtendedACLResponse_Body { + if m != nil { + return m.Body + } + return nil +} + +func (m *SetExtendedACLResponse) GetMetaHeader() *v2.ResponseMetaHeader { + if m != nil { + return m.MetaHeader + } + return nil +} + +func (m *SetExtendedACLResponse) GetVerifyHeader() *v2.ResponseVerificationHeader { + if m != nil { + return m.VerifyHeader + } + return nil +} + +type SetExtendedACLResponse_Body struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SetExtendedACLResponse_Body) Reset() { *m = SetExtendedACLResponse_Body{} } +func (m *SetExtendedACLResponse_Body) String() string { return proto.CompactTextString(m) } +func (*SetExtendedACLResponse_Body) ProtoMessage() {} +func (*SetExtendedACLResponse_Body) Descriptor() ([]byte, []int) { + return fileDescriptor_1c484d370787a129, []int{9, 0} +} +func (m *SetExtendedACLResponse_Body) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *SetExtendedACLResponse_Body) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_SetExtendedACLResponse_Body.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *SetExtendedACLResponse_Body) XXX_Merge(src proto.Message) { + xxx_messageInfo_SetExtendedACLResponse_Body.Merge(m, src) +} +func (m *SetExtendedACLResponse_Body) XXX_Size() int { + return m.Size() +} +func (m *SetExtendedACLResponse_Body) XXX_DiscardUnknown() { + xxx_messageInfo_SetExtendedACLResponse_Body.DiscardUnknown(m) +} + +var xxx_messageInfo_SetExtendedACLResponse_Body proto.InternalMessageInfo + +type GetExtendedACLRequest struct { + // Body of get extended acl request message. + Body *GetExtendedACLRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` + // Carries request meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *v2.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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 *v2.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetExtendedACLRequest) Reset() { *m = GetExtendedACLRequest{} } +func (m *GetExtendedACLRequest) String() string { return proto.CompactTextString(m) } +func (*GetExtendedACLRequest) ProtoMessage() {} +func (*GetExtendedACLRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_1c484d370787a129, []int{10} +} +func (m *GetExtendedACLRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GetExtendedACLRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GetExtendedACLRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *GetExtendedACLRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetExtendedACLRequest.Merge(m, src) +} +func (m *GetExtendedACLRequest) XXX_Size() int { + return m.Size() +} +func (m *GetExtendedACLRequest) XXX_DiscardUnknown() { + xxx_messageInfo_GetExtendedACLRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_GetExtendedACLRequest proto.InternalMessageInfo + +func (m *GetExtendedACLRequest) GetBody() *GetExtendedACLRequest_Body { + if m != nil { + return m.Body + } + return nil +} + +func (m *GetExtendedACLRequest) GetMetaHeader() *v2.RequestMetaHeader { + if m != nil { + return m.MetaHeader + } + return nil +} + +func (m *GetExtendedACLRequest) GetVerifyHeader() *v2.RequestVerificationHeader { + if m != nil { + return m.VerifyHeader + } + return nil +} + +type GetExtendedACLRequest_Body struct { + // container_id carries identifier of the container that has Extended ACL. + ContainerId *v21.ContainerID `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetExtendedACLRequest_Body) Reset() { *m = GetExtendedACLRequest_Body{} } +func (m *GetExtendedACLRequest_Body) String() string { return proto.CompactTextString(m) } +func (*GetExtendedACLRequest_Body) ProtoMessage() {} +func (*GetExtendedACLRequest_Body) Descriptor() ([]byte, []int) { + return fileDescriptor_1c484d370787a129, []int{10, 0} +} +func (m *GetExtendedACLRequest_Body) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GetExtendedACLRequest_Body) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GetExtendedACLRequest_Body.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *GetExtendedACLRequest_Body) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetExtendedACLRequest_Body.Merge(m, src) +} +func (m *GetExtendedACLRequest_Body) XXX_Size() int { + return m.Size() +} +func (m *GetExtendedACLRequest_Body) XXX_DiscardUnknown() { + xxx_messageInfo_GetExtendedACLRequest_Body.DiscardUnknown(m) +} + +var xxx_messageInfo_GetExtendedACLRequest_Body proto.InternalMessageInfo + +func (m *GetExtendedACLRequest_Body) GetContainerId() *v21.ContainerID { + if m != nil { + return m.ContainerId + } + return nil +} + +type GetExtendedACLResponse struct { + // Body of get extended acl response message. + Body *GetExtendedACLResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` + // Carries response meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *v2.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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 *v2.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetExtendedACLResponse) Reset() { *m = GetExtendedACLResponse{} } +func (m *GetExtendedACLResponse) String() string { return proto.CompactTextString(m) } +func (*GetExtendedACLResponse) ProtoMessage() {} +func (*GetExtendedACLResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_1c484d370787a129, []int{11} +} +func (m *GetExtendedACLResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GetExtendedACLResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GetExtendedACLResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *GetExtendedACLResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetExtendedACLResponse.Merge(m, src) +} +func (m *GetExtendedACLResponse) XXX_Size() int { + return m.Size() +} +func (m *GetExtendedACLResponse) XXX_DiscardUnknown() { + xxx_messageInfo_GetExtendedACLResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_GetExtendedACLResponse proto.InternalMessageInfo + +func (m *GetExtendedACLResponse) GetBody() *GetExtendedACLResponse_Body { + if m != nil { + return m.Body + } + return nil +} + +func (m *GetExtendedACLResponse) GetMetaHeader() *v2.ResponseMetaHeader { + if m != nil { + return m.MetaHeader + } + return nil +} + +func (m *GetExtendedACLResponse) GetVerifyHeader() *v2.ResponseVerificationHeader { + if m != nil { + return m.VerifyHeader + } + return nil +} + +type GetExtendedACLResponse_Body struct { + // Extended ACL that has been requested if it was set up. + Eacl *v22.EACLTable `protobuf:"bytes,1,opt,name=eacl,proto3" json:"eacl,omitempty"` + // Signature of stable-marshalled Extended ACL according to RFC-6979. + Signature []byte `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetExtendedACLResponse_Body) Reset() { *m = GetExtendedACLResponse_Body{} } +func (m *GetExtendedACLResponse_Body) String() string { return proto.CompactTextString(m) } +func (*GetExtendedACLResponse_Body) ProtoMessage() {} +func (*GetExtendedACLResponse_Body) Descriptor() ([]byte, []int) { + return fileDescriptor_1c484d370787a129, []int{11, 0} +} +func (m *GetExtendedACLResponse_Body) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GetExtendedACLResponse_Body) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GetExtendedACLResponse_Body.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *GetExtendedACLResponse_Body) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetExtendedACLResponse_Body.Merge(m, src) +} +func (m *GetExtendedACLResponse_Body) XXX_Size() int { + return m.Size() +} +func (m *GetExtendedACLResponse_Body) XXX_DiscardUnknown() { + xxx_messageInfo_GetExtendedACLResponse_Body.DiscardUnknown(m) +} + +var xxx_messageInfo_GetExtendedACLResponse_Body proto.InternalMessageInfo + +func (m *GetExtendedACLResponse_Body) GetEacl() *v22.EACLTable { + if m != nil { + return m.Eacl + } + return nil +} + +func (m *GetExtendedACLResponse_Body) GetSignature() []byte { + if m != nil { + return m.Signature + } + return nil +} + +func init() { + proto.RegisterType((*PutRequest)(nil), "container.v2.PutRequest") + proto.RegisterType((*PutRequest_Body)(nil), "container.v2.PutRequest.Body") + proto.RegisterType((*PutResponse)(nil), "container.v2.PutResponse") + proto.RegisterType((*PutResponse_Body)(nil), "container.v2.PutResponse.Body") + proto.RegisterType((*DeleteRequest)(nil), "container.v2.DeleteRequest") + proto.RegisterType((*DeleteRequest_Body)(nil), "container.v2.DeleteRequest.Body") + proto.RegisterType((*DeleteResponse)(nil), "container.v2.DeleteResponse") + proto.RegisterType((*DeleteResponse_Body)(nil), "container.v2.DeleteResponse.Body") + proto.RegisterType((*GetRequest)(nil), "container.v2.GetRequest") + proto.RegisterType((*GetRequest_Body)(nil), "container.v2.GetRequest.Body") + proto.RegisterType((*GetResponse)(nil), "container.v2.GetResponse") + proto.RegisterType((*GetResponse_Body)(nil), "container.v2.GetResponse.Body") + proto.RegisterType((*ListRequest)(nil), "container.v2.ListRequest") + proto.RegisterType((*ListRequest_Body)(nil), "container.v2.ListRequest.Body") + proto.RegisterType((*ListResponse)(nil), "container.v2.ListResponse") + proto.RegisterType((*ListResponse_Body)(nil), "container.v2.ListResponse.Body") + proto.RegisterType((*SetExtendedACLRequest)(nil), "container.v2.SetExtendedACLRequest") + proto.RegisterType((*SetExtendedACLRequest_Body)(nil), "container.v2.SetExtendedACLRequest.Body") + proto.RegisterType((*SetExtendedACLResponse)(nil), "container.v2.SetExtendedACLResponse") + proto.RegisterType((*SetExtendedACLResponse_Body)(nil), "container.v2.SetExtendedACLResponse.Body") + proto.RegisterType((*GetExtendedACLRequest)(nil), "container.v2.GetExtendedACLRequest") + proto.RegisterType((*GetExtendedACLRequest_Body)(nil), "container.v2.GetExtendedACLRequest.Body") + proto.RegisterType((*GetExtendedACLResponse)(nil), "container.v2.GetExtendedACLResponse") + proto.RegisterType((*GetExtendedACLResponse_Body)(nil), "container.v2.GetExtendedACLResponse.Body") +} + +func init() { proto.RegisterFile("container/v2/service.proto", fileDescriptor_1c484d370787a129) } + +var fileDescriptor_1c484d370787a129 = []byte{ + // 811 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x97, 0x41, 0x4f, 0x13, 0x41, + 0x14, 0xc7, 0xdd, 0x6d, 0x03, 0xf2, 0x5a, 0x88, 0x0e, 0x02, 0x65, 0x85, 0x8a, 0x55, 0x0c, 0xc6, + 0xb0, 0x8d, 0x45, 0x62, 0x34, 0x22, 0x29, 0x05, 0xd7, 0x0a, 0x2a, 0x59, 0x0c, 0x07, 0x8d, 0x21, + 0xdb, 0xdd, 0x07, 0x6c, 0x2c, 0xbb, 0xb5, 0xbb, 0x2d, 0xd6, 0xa3, 0x67, 0x63, 0x3c, 0x78, 0xf0, + 0xec, 0xd1, 0x83, 0x31, 0x7e, 0x01, 0x8f, 0x7a, 0xf4, 0x0b, 0x98, 0x18, 0x3c, 0xfb, 0x1d, 0xcc, + 0xee, 0x4e, 0xdb, 0x9d, 0xba, 0x2d, 0xd5, 0x7a, 0x58, 0x6e, 0xec, 0xcc, 0x7f, 0x1e, 0xef, 0xfd, + 0xfa, 0x9f, 0x99, 0x37, 0x20, 0xa8, 0xa6, 0x61, 0x2b, 0xba, 0x81, 0xe5, 0x74, 0x35, 0x93, 0xb6, + 0xb0, 0x5c, 0xd5, 0x55, 0x14, 0x4b, 0x65, 0xd3, 0x36, 0x49, 0xbc, 0x31, 0x27, 0x56, 0x33, 0x02, + 0x51, 0xd4, 0xa2, 0xa3, 0xb1, 0x6b, 0x25, 0xb4, 0x3c, 0x85, 0x90, 0x60, 0x56, 0xfb, 0x67, 0x86, + 0xcb, 0xb8, 0x6d, 0xb5, 0x0e, 0x8e, 0xd0, 0xf8, 0xce, 0xf8, 0x1e, 0xda, 0x0a, 0x1d, 0x1e, 0xf3, + 0x0d, 0x57, 0xb1, 0xac, 0x6f, 0xd7, 0xbc, 0x89, 0xd4, 0x17, 0x1e, 0x60, 0xbd, 0x62, 0xcb, 0xf8, + 0xb4, 0x82, 0x96, 0x4d, 0x2e, 0x43, 0xb4, 0x60, 0x6a, 0xb5, 0x04, 0x37, 0xc5, 0xcd, 0xc4, 0x32, + 0x93, 0xa2, 0x3f, 0x3d, 0xb1, 0xa9, 0x13, 0x97, 0x4c, 0xad, 0x26, 0xbb, 0x52, 0x72, 0x13, 0x62, + 0xce, 0x3f, 0xda, 0xda, 0x45, 0x45, 0xc3, 0x72, 0x82, 0xa7, 0x2b, 0xeb, 0x75, 0x56, 0x33, 0x22, + 0x5d, 0x74, 0x17, 0x6d, 0xe5, 0xb6, 0x2b, 0x92, 0x61, 0xaf, 0xf1, 0x37, 0xb9, 0x03, 0x83, 0x5e, + 0x46, 0xf5, 0x08, 0x11, 0x37, 0xc2, 0x74, 0x40, 0x84, 0x4d, 0x47, 0xa7, 0xab, 0x8a, 0xad, 0x9b, + 0x06, 0x8d, 0x14, 0xf7, 0xd6, 0x7a, 0x5f, 0xc2, 0x73, 0x88, 0x3a, 0x99, 0x91, 0x79, 0x18, 0x68, + 0x64, 0x4e, 0x6b, 0x19, 0x63, 0x6b, 0xc9, 0xd5, 0x3f, 0xe4, 0xa6, 0x92, 0x4c, 0x02, 0x94, 0x2a, + 0x85, 0xa2, 0xae, 0x6e, 0x3d, 0xc1, 0x9a, 0x5b, 0x49, 0x5c, 0x1e, 0xf0, 0x46, 0x56, 0xb1, 0x46, + 0x26, 0x60, 0xc0, 0xd2, 0x77, 0x0c, 0xc5, 0xae, 0x94, 0xd1, 0xcd, 0x32, 0x2e, 0x37, 0x07, 0x52, + 0xaf, 0x79, 0x88, 0xb9, 0x84, 0xac, 0x92, 0x69, 0x58, 0x48, 0x32, 0x0c, 0xca, 0x64, 0x00, 0x4a, + 0x4f, 0xe8, 0x67, 0xb9, 0x18, 0xc4, 0x32, 0xc9, 0x92, 0xf0, 0x56, 0xb5, 0x81, 0xb9, 0x1a, 0x0c, + 0xf3, 0x42, 0x50, 0x88, 0x43, 0x69, 0x2e, 0x52, 0x9a, 0x57, 0xa1, 0x69, 0xd3, 0x2d, 0x5d, 0xa3, + 0x15, 0x9d, 0x12, 0x1d, 0xff, 0x31, 0x2c, 0xf3, 0xcb, 0x72, 0xac, 0xa1, 0xcc, 0x6b, 0xa9, 0x8f, + 0x3c, 0x0c, 0x2e, 0x63, 0x11, 0x6d, 0xac, 0xfb, 0xeb, 0x0a, 0x03, 0x65, 0x8a, 0x85, 0xc2, 0x48, + 0xc3, 0x6a, 0xb1, 0xc7, 0x3d, 0x42, 0x61, 0x5d, 0xc4, 0xb7, 0xba, 0xe8, 0x3b, 0x07, 0x43, 0x75, + 0x0e, 0xd4, 0x48, 0xf3, 0x0c, 0xb3, 0xb3, 0xc1, 0xcc, 0xc2, 0xee, 0xa5, 0x3e, 0x0f, 0x5b, 0xea, + 0x25, 0x0f, 0x20, 0x61, 0x77, 0xe7, 0x4d, 0x53, 0x17, 0x56, 0x33, 0xf4, 0xbc, 0x43, 0x5e, 0xf1, + 0x10, 0x73, 0xcb, 0xec, 0xe6, 0xd0, 0xf0, 0x09, 0xc3, 0xfb, 0x43, 0x2f, 0xf4, 0x74, 0x04, 0xa7, + 0x5e, 0xf0, 0x10, 0x5b, 0xd3, 0xad, 0x86, 0x41, 0x3a, 0x02, 0xf1, 0x09, 0xc3, 0xea, 0x90, 0x39, + 0x8a, 0xe3, 0x12, 0x1c, 0x37, 0xf7, 0x19, 0x77, 0x9c, 0x68, 0xb8, 0xe3, 0xfe, 0xbe, 0xe7, 0x8c, + 0x7e, 0x57, 0x91, 0xd7, 0x52, 0x6f, 0x78, 0x88, 0x7b, 0xb5, 0x51, 0x5b, 0xcc, 0x31, 0x14, 0xce, + 0x04, 0x51, 0x08, 0xbb, 0x2f, 0xb2, 0x14, 0xc4, 0x35, 0x18, 0xf4, 0x6f, 0x15, 0x2b, 0xc1, 0x4d, + 0x45, 0xda, 0xee, 0x95, 0xb8, 0x6f, 0xaf, 0x58, 0xa9, 0x0f, 0x3c, 0x8c, 0x6c, 0xa0, 0xbd, 0xf2, + 0xcc, 0x46, 0x43, 0x43, 0x2d, 0x9b, 0x5b, 0xab, 0xbb, 0xe4, 0x06, 0xc3, 0x67, 0x86, 0xe5, 0x13, + 0xb8, 0x24, 0xac, 0x7e, 0x59, 0xa5, 0x98, 0xa6, 0x21, 0x8a, 0x8a, 0x5a, 0xa4, 0x15, 0x9d, 0x14, + 0x15, 0xb5, 0xe8, 0x84, 0x59, 0xc9, 0xe6, 0xd6, 0x1e, 0x28, 0x85, 0x22, 0xca, 0xee, 0xf4, 0x21, + 0x97, 0xc9, 0x2f, 0x0e, 0x46, 0x5b, 0xab, 0xa7, 0x8e, 0x5a, 0x60, 0x88, 0x5d, 0xec, 0x4c, 0xec, + 0xa8, 0x5c, 0x2e, 0xef, 0x78, 0x18, 0x91, 0xfe, 0xde, 0x20, 0xd2, 0x51, 0x32, 0x48, 0xcf, 0x57, + 0xce, 0x27, 0x1e, 0x46, 0xa5, 0x7f, 0x30, 0x85, 0x74, 0xc4, 0x4c, 0xf1, 0x3f, 0x77, 0x52, 0xe6, + 0x73, 0x04, 0xfa, 0x37, 0xbc, 0x24, 0xc8, 0x75, 0x88, 0xac, 0x57, 0x6c, 0x92, 0x68, 0xf7, 0x38, + 0x12, 0xc6, 0xdb, 0xf6, 0xfa, 0x24, 0x07, 0x7d, 0x5e, 0xc7, 0x46, 0x4e, 0x77, 0xe8, 0x7d, 0x85, + 0x89, 0x4e, 0x4d, 0x9e, 0x93, 0x80, 0x84, 0x7f, 0x24, 0xd0, 0xec, 0x96, 0x5a, 0x13, 0xf0, 0x37, + 0x18, 0x0b, 0x10, 0x75, 0xee, 0x0b, 0x32, 0xde, 0xf6, 0x26, 0x15, 0x84, 0xf6, 0xd7, 0x0b, 0x79, + 0x04, 0x43, 0xec, 0xe1, 0x40, 0xce, 0x75, 0x71, 0xd8, 0x0a, 0xe7, 0xbb, 0x39, 0x5f, 0x9c, 0xe0, + 0x52, 0xc7, 0xe0, 0x52, 0x37, 0xc1, 0x83, 0x7d, 0xba, 0xb4, 0xf9, 0xf5, 0x20, 0xc9, 0x7d, 0x3b, + 0x48, 0x72, 0x3f, 0x0e, 0x92, 0xdc, 0xdb, 0x9f, 0xc9, 0x63, 0x0f, 0xc5, 0x1d, 0xdd, 0xde, 0xad, + 0x14, 0x44, 0xd5, 0xdc, 0x4b, 0x1b, 0x56, 0x49, 0x55, 0x67, 0x35, 0xac, 0xa6, 0x0d, 0x34, 0xb7, + 0xad, 0x59, 0xa5, 0xa4, 0xcf, 0xee, 0x98, 0x69, 0xff, 0xdb, 0xfb, 0x3d, 0x3f, 0x7c, 0x0f, 0xcd, + 0x5b, 0x1b, 0x62, 0x76, 0x3d, 0xdf, 0xdc, 0x5d, 0x85, 0x3e, 0xf7, 0x1d, 0x3d, 0xf7, 0x3b, 0x00, + 0x00, 0xff, 0xff, 0x7e, 0x5a, 0xa3, 0x54, 0xe6, 0x0f, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// ServiceClient is the client API for Service service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type ServiceClient interface { + // Put invokes 'Put' method in container smart-contract and returns + // response immediately. After new block in morph chain, request is verified + // by inner ring nodes. After one more block in morph chain, container + // added into smart-contract storage. + Put(ctx context.Context, in *PutRequest, opts ...grpc.CallOption) (*PutResponse, error) + // Delete invokes 'Delete' method in container smart-contract and returns + // response immediately. After new block in morph chain, request is verified + // by inner ring nodes. After one more block in morph chain, container + // removed from smart-contract storage. + Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteResponse, error) + // Get returns container from container smart-contract storage. + Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*GetResponse, error) + // List returns all owner's containers from container smart-contract + // storage. + List(ctx context.Context, in *ListRequest, opts ...grpc.CallOption) (*ListResponse, error) + // SetExtendedACL invokes 'SetEACL' method in container smart-contract and + // returns response immediately. After new block in morph chain, + // Extended ACL added into smart-contract storage. + SetExtendedACL(ctx context.Context, in *SetExtendedACLRequest, opts ...grpc.CallOption) (*SetExtendedACLResponse, error) + // GetExtendedACL returns Extended ACL table and signature from container + // smart-contract storage. + GetExtendedACL(ctx context.Context, in *GetExtendedACLRequest, opts ...grpc.CallOption) (*GetExtendedACLResponse, error) +} + +type serviceClient struct { + cc *grpc.ClientConn +} + +func NewServiceClient(cc *grpc.ClientConn) ServiceClient { + return &serviceClient{cc} +} + +func (c *serviceClient) Put(ctx context.Context, in *PutRequest, opts ...grpc.CallOption) (*PutResponse, error) { + out := new(PutResponse) + err := c.cc.Invoke(ctx, "/container.v2.Service/Put", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteResponse, error) { + out := new(DeleteResponse) + err := c.cc.Invoke(ctx, "/container.v2.Service/Delete", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*GetResponse, error) { + out := new(GetResponse) + err := c.cc.Invoke(ctx, "/container.v2.Service/Get", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) List(ctx context.Context, in *ListRequest, opts ...grpc.CallOption) (*ListResponse, error) { + out := new(ListResponse) + err := c.cc.Invoke(ctx, "/container.v2.Service/List", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SetExtendedACL(ctx context.Context, in *SetExtendedACLRequest, opts ...grpc.CallOption) (*SetExtendedACLResponse, error) { + out := new(SetExtendedACLResponse) + err := c.cc.Invoke(ctx, "/container.v2.Service/SetExtendedACL", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) GetExtendedACL(ctx context.Context, in *GetExtendedACLRequest, opts ...grpc.CallOption) (*GetExtendedACLResponse, error) { + out := new(GetExtendedACLResponse) + err := c.cc.Invoke(ctx, "/container.v2.Service/GetExtendedACL", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// ServiceServer is the server API for Service service. +type ServiceServer interface { + // Put invokes 'Put' method in container smart-contract and returns + // response immediately. After new block in morph chain, request is verified + // by inner ring nodes. After one more block in morph chain, container + // added into smart-contract storage. + Put(context.Context, *PutRequest) (*PutResponse, error) + // Delete invokes 'Delete' method in container smart-contract and returns + // response immediately. After new block in morph chain, request is verified + // by inner ring nodes. After one more block in morph chain, container + // removed from smart-contract storage. + Delete(context.Context, *DeleteRequest) (*DeleteResponse, error) + // Get returns container from container smart-contract storage. + Get(context.Context, *GetRequest) (*GetResponse, error) + // List returns all owner's containers from container smart-contract + // storage. + List(context.Context, *ListRequest) (*ListResponse, error) + // SetExtendedACL invokes 'SetEACL' method in container smart-contract and + // returns response immediately. After new block in morph chain, + // Extended ACL added into smart-contract storage. + SetExtendedACL(context.Context, *SetExtendedACLRequest) (*SetExtendedACLResponse, error) + // GetExtendedACL returns Extended ACL table and signature from container + // smart-contract storage. + GetExtendedACL(context.Context, *GetExtendedACLRequest) (*GetExtendedACLResponse, error) +} + +// UnimplementedServiceServer can be embedded to have forward compatible implementations. +type UnimplementedServiceServer struct { +} + +func (*UnimplementedServiceServer) Put(ctx context.Context, req *PutRequest) (*PutResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Put not implemented") +} +func (*UnimplementedServiceServer) Delete(ctx context.Context, req *DeleteRequest) (*DeleteResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Delete not implemented") +} +func (*UnimplementedServiceServer) Get(ctx context.Context, req *GetRequest) (*GetResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Get not implemented") +} +func (*UnimplementedServiceServer) List(ctx context.Context, req *ListRequest) (*ListResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method List not implemented") +} +func (*UnimplementedServiceServer) SetExtendedACL(ctx context.Context, req *SetExtendedACLRequest) (*SetExtendedACLResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SetExtendedACL not implemented") +} +func (*UnimplementedServiceServer) GetExtendedACL(ctx context.Context, req *GetExtendedACLRequest) (*GetExtendedACLResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetExtendedACL not implemented") +} + +func RegisterServiceServer(s *grpc.Server, srv ServiceServer) { + s.RegisterService(&_Service_serviceDesc, srv) +} + +func _Service_Put_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(PutRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ServiceServer).Put(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/container.v2.Service/Put", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ServiceServer).Put(ctx, req.(*PutRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Service_Delete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ServiceServer).Delete(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/container.v2.Service/Delete", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ServiceServer).Delete(ctx, req.(*DeleteRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Service_Get_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ServiceServer).Get(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/container.v2.Service/Get", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ServiceServer).Get(ctx, req.(*GetRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Service_List_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ServiceServer).List(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/container.v2.Service/List", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ServiceServer).List(ctx, req.(*ListRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Service_SetExtendedACL_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SetExtendedACLRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ServiceServer).SetExtendedACL(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/container.v2.Service/SetExtendedACL", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ServiceServer).SetExtendedACL(ctx, req.(*SetExtendedACLRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Service_GetExtendedACL_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetExtendedACLRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ServiceServer).GetExtendedACL(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/container.v2.Service/GetExtendedACL", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ServiceServer).GetExtendedACL(ctx, req.(*GetExtendedACLRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Service_serviceDesc = grpc.ServiceDesc{ + ServiceName: "container.v2.Service", + HandlerType: (*ServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Put", + Handler: _Service_Put_Handler, + }, + { + MethodName: "Delete", + Handler: _Service_Delete_Handler, + }, + { + MethodName: "Get", + Handler: _Service_Get_Handler, + }, + { + MethodName: "List", + Handler: _Service_List_Handler, + }, + { + MethodName: "SetExtendedACL", + Handler: _Service_SetExtendedACL_Handler, + }, + { + MethodName: "GetExtendedACL", + Handler: _Service_GetExtendedACL_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "container/v2/service.proto", +} + +func (m *PutRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PutRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PutRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.VerifyHeader != nil { + { + size, err := m.VerifyHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + if m.MetaHeader != nil { + { + size, err := m.MetaHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.Body != nil { + { + size, err := m.Body.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *PutRequest_Body) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PutRequest_Body) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PutRequest_Body) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Signature) > 0 { + i -= len(m.Signature) + copy(dAtA[i:], m.Signature) + i = encodeVarintService(dAtA, i, uint64(len(m.Signature))) + i-- + dAtA[i] = 0x1a + } + if len(m.PublicKey) > 0 { + i -= len(m.PublicKey) + copy(dAtA[i:], m.PublicKey) + i = encodeVarintService(dAtA, i, uint64(len(m.PublicKey))) + i-- + dAtA[i] = 0x12 + } + if m.Container != nil { + { + size, err := m.Container.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *PutResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PutResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PutResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.VerifyHeader != nil { + { + size, err := m.VerifyHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + if m.MetaHeader != nil { + { + size, err := m.MetaHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.Body != nil { + { + size, err := m.Body.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *PutResponse_Body) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PutResponse_Body) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PutResponse_Body) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.ContainerId != nil { + { + size, err := m.ContainerId.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *DeleteRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *DeleteRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DeleteRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.VerifyHeader != nil { + { + size, err := m.VerifyHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + if m.MetaHeader != nil { + { + size, err := m.MetaHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.Body != nil { + { + size, err := m.Body.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *DeleteRequest_Body) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *DeleteRequest_Body) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DeleteRequest_Body) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Signature) > 0 { + i -= len(m.Signature) + copy(dAtA[i:], m.Signature) + i = encodeVarintService(dAtA, i, uint64(len(m.Signature))) + i-- + dAtA[i] = 0x12 + } + if m.ContainerId != nil { + { + size, err := m.ContainerId.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *DeleteResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *DeleteResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DeleteResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.VerifyHeader != nil { + { + size, err := m.VerifyHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + if m.MetaHeader != nil { + { + size, err := m.MetaHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.Body != nil { + { + size, err := m.Body.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *DeleteResponse_Body) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *DeleteResponse_Body) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DeleteResponse_Body) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + return len(dAtA) - i, nil +} + +func (m *GetRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GetRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.VerifyHeader != nil { + { + size, err := m.VerifyHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + if m.MetaHeader != nil { + { + size, err := m.MetaHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.Body != nil { + { + size, err := m.Body.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *GetRequest_Body) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetRequest_Body) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GetRequest_Body) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.ContainerId != nil { + { + size, err := m.ContainerId.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *GetResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GetResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.VerifyHeader != nil { + { + size, err := m.VerifyHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + if m.MetaHeader != nil { + { + size, err := m.MetaHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.Body != nil { + { + size, err := m.Body.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *GetResponse_Body) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetResponse_Body) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GetResponse_Body) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.Container != nil { + { + size, err := m.Container.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *ListRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ListRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ListRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.VerifyHeader != nil { + { + size, err := m.VerifyHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + if m.MetaHeader != nil { + { + size, err := m.MetaHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.Body != nil { + { + size, err := m.Body.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *ListRequest_Body) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ListRequest_Body) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ListRequest_Body) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.OwnerId != nil { + { + size, err := m.OwnerId.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *ListResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ListResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ListResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.VerifyHeader != nil { + { + size, err := m.VerifyHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + if m.MetaHeader != nil { + { + size, err := m.MetaHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.Body != nil { + { + size, err := m.Body.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *ListResponse_Body) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ListResponse_Body) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ListResponse_Body) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.ContainerIds) > 0 { + for iNdEx := len(m.ContainerIds) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.ContainerIds[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *SetExtendedACLRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *SetExtendedACLRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *SetExtendedACLRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.VerifyHeader != nil { + { + size, err := m.VerifyHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + if m.MetaHeader != nil { + { + size, err := m.MetaHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.Body != nil { + { + size, err := m.Body.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *SetExtendedACLRequest_Body) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *SetExtendedACLRequest_Body) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *SetExtendedACLRequest_Body) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Signature) > 0 { + i -= len(m.Signature) + copy(dAtA[i:], m.Signature) + i = encodeVarintService(dAtA, i, uint64(len(m.Signature))) + i-- + dAtA[i] = 0x12 + } + if m.Eacl != nil { + { + size, err := m.Eacl.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *SetExtendedACLResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *SetExtendedACLResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *SetExtendedACLResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.VerifyHeader != nil { + { + size, err := m.VerifyHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + if m.MetaHeader != nil { + { + size, err := m.MetaHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.Body != nil { + { + size, err := m.Body.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *SetExtendedACLResponse_Body) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *SetExtendedACLResponse_Body) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *SetExtendedACLResponse_Body) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + return len(dAtA) - i, nil +} + +func (m *GetExtendedACLRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetExtendedACLRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GetExtendedACLRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.VerifyHeader != nil { + { + size, err := m.VerifyHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + if m.MetaHeader != nil { + { + size, err := m.MetaHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.Body != nil { + { + size, err := m.Body.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *GetExtendedACLRequest_Body) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetExtendedACLRequest_Body) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GetExtendedACLRequest_Body) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.ContainerId != nil { + { + size, err := m.ContainerId.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *GetExtendedACLResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetExtendedACLResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GetExtendedACLResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.VerifyHeader != nil { + { + size, err := m.VerifyHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + if m.MetaHeader != nil { + { + size, err := m.MetaHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.Body != nil { + { + size, err := m.Body.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *GetExtendedACLResponse_Body) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetExtendedACLResponse_Body) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GetExtendedACLResponse_Body) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Signature) > 0 { + i -= len(m.Signature) + copy(dAtA[i:], m.Signature) + i = encodeVarintService(dAtA, i, uint64(len(m.Signature))) + i-- + dAtA[i] = 0x12 + } + if m.Eacl != nil { + { + size, err := m.Eacl.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintService(dAtA []byte, offset int, v uint64) int { + offset -= sovService(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *PutRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Body != nil { + l = m.Body.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.MetaHeader != nil { + l = m.MetaHeader.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.VerifyHeader != nil { + l = m.VerifyHeader.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *PutRequest_Body) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Container != nil { + l = m.Container.Size() + n += 1 + l + sovService(uint64(l)) + } + l = len(m.PublicKey) + if l > 0 { + n += 1 + l + sovService(uint64(l)) + } + l = len(m.Signature) + if l > 0 { + n += 1 + l + sovService(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *PutResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Body != nil { + l = m.Body.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.MetaHeader != nil { + l = m.MetaHeader.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.VerifyHeader != nil { + l = m.VerifyHeader.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *PutResponse_Body) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ContainerId != nil { + l = m.ContainerId.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *DeleteRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Body != nil { + l = m.Body.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.MetaHeader != nil { + l = m.MetaHeader.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.VerifyHeader != nil { + l = m.VerifyHeader.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *DeleteRequest_Body) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ContainerId != nil { + l = m.ContainerId.Size() + n += 1 + l + sovService(uint64(l)) + } + l = len(m.Signature) + if l > 0 { + n += 1 + l + sovService(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *DeleteResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Body != nil { + l = m.Body.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.MetaHeader != nil { + l = m.MetaHeader.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.VerifyHeader != nil { + l = m.VerifyHeader.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *DeleteResponse_Body) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *GetRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Body != nil { + l = m.Body.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.MetaHeader != nil { + l = m.MetaHeader.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.VerifyHeader != nil { + l = m.VerifyHeader.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *GetRequest_Body) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ContainerId != nil { + l = m.ContainerId.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *GetResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Body != nil { + l = m.Body.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.MetaHeader != nil { + l = m.MetaHeader.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.VerifyHeader != nil { + l = m.VerifyHeader.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *GetResponse_Body) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Container != nil { + l = m.Container.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *ListRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Body != nil { + l = m.Body.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.MetaHeader != nil { + l = m.MetaHeader.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.VerifyHeader != nil { + l = m.VerifyHeader.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *ListRequest_Body) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.OwnerId != nil { + l = m.OwnerId.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *ListResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Body != nil { + l = m.Body.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.MetaHeader != nil { + l = m.MetaHeader.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.VerifyHeader != nil { + l = m.VerifyHeader.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *ListResponse_Body) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.ContainerIds) > 0 { + for _, e := range m.ContainerIds { + l = e.Size() + n += 1 + l + sovService(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *SetExtendedACLRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Body != nil { + l = m.Body.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.MetaHeader != nil { + l = m.MetaHeader.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.VerifyHeader != nil { + l = m.VerifyHeader.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *SetExtendedACLRequest_Body) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Eacl != nil { + l = m.Eacl.Size() + n += 1 + l + sovService(uint64(l)) + } + l = len(m.Signature) + if l > 0 { + n += 1 + l + sovService(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *SetExtendedACLResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Body != nil { + l = m.Body.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.MetaHeader != nil { + l = m.MetaHeader.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.VerifyHeader != nil { + l = m.VerifyHeader.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *SetExtendedACLResponse_Body) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *GetExtendedACLRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Body != nil { + l = m.Body.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.MetaHeader != nil { + l = m.MetaHeader.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.VerifyHeader != nil { + l = m.VerifyHeader.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *GetExtendedACLRequest_Body) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ContainerId != nil { + l = m.ContainerId.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *GetExtendedACLResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Body != nil { + l = m.Body.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.MetaHeader != nil { + l = m.MetaHeader.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.VerifyHeader != nil { + l = m.VerifyHeader.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *GetExtendedACLResponse_Body) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Eacl != nil { + l = m.Eacl.Size() + n += 1 + l + sovService(uint64(l)) + } + l = len(m.Signature) + if l > 0 { + n += 1 + l + sovService(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovService(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozService(x uint64) (n int) { + return sovService(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *PutRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: PutRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PutRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Body", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Body == nil { + m.Body = &PutRequest_Body{} + } + if err := m.Body.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MetaHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.MetaHeader == nil { + m.MetaHeader = &v2.RequestMetaHeader{} + } + if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field VerifyHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.VerifyHeader == nil { + m.VerifyHeader = &v2.RequestVerificationHeader{} + } + if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *PutRequest_Body) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Body: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Body: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Container", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Container == nil { + m.Container = &Container{} + } + if err := m.Container.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PublicKey", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PublicKey = append(m.PublicKey[:0], dAtA[iNdEx:postIndex]...) + if m.PublicKey == nil { + m.PublicKey = []byte{} + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signature", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Signature = append(m.Signature[:0], dAtA[iNdEx:postIndex]...) + if m.Signature == nil { + m.Signature = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *PutResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: PutResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PutResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Body", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Body == nil { + m.Body = &PutResponse_Body{} + } + if err := m.Body.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MetaHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.MetaHeader == nil { + m.MetaHeader = &v2.ResponseMetaHeader{} + } + if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field VerifyHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.VerifyHeader == nil { + m.VerifyHeader = &v2.ResponseVerificationHeader{} + } + if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *PutResponse_Body) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Body: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Body: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ContainerId", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.ContainerId == nil { + m.ContainerId = &v21.ContainerID{} + } + if err := m.ContainerId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DeleteRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DeleteRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DeleteRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Body", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Body == nil { + m.Body = &DeleteRequest_Body{} + } + if err := m.Body.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MetaHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.MetaHeader == nil { + m.MetaHeader = &v2.RequestMetaHeader{} + } + if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field VerifyHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.VerifyHeader == nil { + m.VerifyHeader = &v2.RequestVerificationHeader{} + } + if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DeleteRequest_Body) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Body: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Body: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ContainerId", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.ContainerId == nil { + m.ContainerId = &v21.ContainerID{} + } + if err := m.ContainerId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signature", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Signature = append(m.Signature[:0], dAtA[iNdEx:postIndex]...) + if m.Signature == nil { + m.Signature = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DeleteResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DeleteResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DeleteResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Body", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Body == nil { + m.Body = &DeleteResponse_Body{} + } + if err := m.Body.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MetaHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.MetaHeader == nil { + m.MetaHeader = &v2.ResponseMetaHeader{} + } + if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field VerifyHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.VerifyHeader == nil { + m.VerifyHeader = &v2.ResponseVerificationHeader{} + } + if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DeleteResponse_Body) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Body: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Body: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GetRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GetRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Body", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Body == nil { + m.Body = &GetRequest_Body{} + } + if err := m.Body.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MetaHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.MetaHeader == nil { + m.MetaHeader = &v2.RequestMetaHeader{} + } + if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field VerifyHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.VerifyHeader == nil { + m.VerifyHeader = &v2.RequestVerificationHeader{} + } + if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GetRequest_Body) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Body: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Body: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ContainerId", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.ContainerId == nil { + m.ContainerId = &v21.ContainerID{} + } + if err := m.ContainerId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GetResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GetResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Body", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Body == nil { + m.Body = &GetResponse_Body{} + } + if err := m.Body.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MetaHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.MetaHeader == nil { + m.MetaHeader = &v2.ResponseMetaHeader{} + } + if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field VerifyHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.VerifyHeader == nil { + m.VerifyHeader = &v2.ResponseVerificationHeader{} + } + if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GetResponse_Body) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Body: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Body: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Container", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Container == nil { + m.Container = &Container{} + } + if err := m.Container.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ListRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ListRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ListRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Body", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Body == nil { + m.Body = &ListRequest_Body{} + } + if err := m.Body.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MetaHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.MetaHeader == nil { + m.MetaHeader = &v2.RequestMetaHeader{} + } + if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field VerifyHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.VerifyHeader == nil { + m.VerifyHeader = &v2.RequestVerificationHeader{} + } + if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ListRequest_Body) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Body: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Body: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OwnerId", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.OwnerId == nil { + m.OwnerId = &v21.OwnerID{} + } + if err := m.OwnerId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ListResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ListResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ListResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Body", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Body == nil { + m.Body = &ListResponse_Body{} + } + if err := m.Body.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MetaHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.MetaHeader == nil { + m.MetaHeader = &v2.ResponseMetaHeader{} + } + if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field VerifyHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.VerifyHeader == nil { + m.VerifyHeader = &v2.ResponseVerificationHeader{} + } + if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ListResponse_Body) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Body: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Body: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ContainerIds", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ContainerIds = append(m.ContainerIds, &v21.ContainerID{}) + if err := m.ContainerIds[len(m.ContainerIds)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *SetExtendedACLRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: SetExtendedACLRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SetExtendedACLRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Body", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Body == nil { + m.Body = &SetExtendedACLRequest_Body{} + } + if err := m.Body.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MetaHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.MetaHeader == nil { + m.MetaHeader = &v2.RequestMetaHeader{} + } + if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field VerifyHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.VerifyHeader == nil { + m.VerifyHeader = &v2.RequestVerificationHeader{} + } + if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *SetExtendedACLRequest_Body) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Body: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Body: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Eacl", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Eacl == nil { + m.Eacl = &v22.EACLTable{} + } + if err := m.Eacl.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signature", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Signature = append(m.Signature[:0], dAtA[iNdEx:postIndex]...) + if m.Signature == nil { + m.Signature = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *SetExtendedACLResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: SetExtendedACLResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SetExtendedACLResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Body", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Body == nil { + m.Body = &SetExtendedACLResponse_Body{} + } + if err := m.Body.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MetaHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.MetaHeader == nil { + m.MetaHeader = &v2.ResponseMetaHeader{} + } + if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field VerifyHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.VerifyHeader == nil { + m.VerifyHeader = &v2.ResponseVerificationHeader{} + } + if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *SetExtendedACLResponse_Body) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Body: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Body: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GetExtendedACLRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GetExtendedACLRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetExtendedACLRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Body", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Body == nil { + m.Body = &GetExtendedACLRequest_Body{} + } + if err := m.Body.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MetaHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.MetaHeader == nil { + m.MetaHeader = &v2.RequestMetaHeader{} + } + if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field VerifyHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.VerifyHeader == nil { + m.VerifyHeader = &v2.RequestVerificationHeader{} + } + if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GetExtendedACLRequest_Body) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Body: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Body: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ContainerId", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.ContainerId == nil { + m.ContainerId = &v21.ContainerID{} + } + if err := m.ContainerId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GetExtendedACLResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GetExtendedACLResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetExtendedACLResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Body", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Body == nil { + m.Body = &GetExtendedACLResponse_Body{} + } + if err := m.Body.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MetaHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.MetaHeader == nil { + m.MetaHeader = &v2.ResponseMetaHeader{} + } + if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field VerifyHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.VerifyHeader == nil { + m.VerifyHeader = &v2.ResponseVerificationHeader{} + } + if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GetExtendedACLResponse_Body) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Body: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Body: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Eacl", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Eacl == nil { + m.Eacl = &v22.EACLTable{} + } + if err := m.Eacl.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signature", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Signature = append(m.Signature[:0], dAtA[iNdEx:postIndex]...) + if m.Signature == nil { + m.Signature = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipService(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowService + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowService + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowService + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthService + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupService + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthService + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthService = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowService = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupService = fmt.Errorf("proto: unexpected end of group") +) diff --git a/container/v2/service.proto b/container/v2/service.proto new file mode 100644 index 0000000..720abc6 --- /dev/null +++ b/container/v2/service.proto @@ -0,0 +1,285 @@ +syntax = "proto3"; + +package container.v2; + +option go_package = "github.com/nspcc-dev/neofs-api-go/container/v2"; +option csharp_namespace = "NeoFS.API.Container"; + +import "acl/v2/types.proto"; +import "container/v2/types.proto"; +import "refs/v2/types.proto"; +import "service/v2/meta.proto"; +import "service/v2/verify.proto"; + +// Service provides API to access container smart-contract in morph chain +// via NeoFS node. +service Service { + // Put invokes 'Put' method in container smart-contract and returns + // response immediately. After new block in morph chain, request is verified + // by inner ring nodes. After one more block in morph chain, container + // added into smart-contract storage. + rpc Put(PutRequest) returns (PutResponse); + + // Delete invokes 'Delete' method in container smart-contract and returns + // response immediately. After new block in morph chain, request is verified + // by inner ring nodes. After one more block in morph chain, container + // removed from smart-contract storage. + rpc Delete(DeleteRequest) returns (DeleteResponse); + + // Get returns container from container smart-contract storage. + rpc Get(GetRequest) returns (GetResponse); + + // List returns all owner's containers from container smart-contract + // storage. + rpc List(ListRequest) returns (ListResponse); + + // SetExtendedACL invokes 'SetEACL' method in container smart-contract and + // returns response immediately. After new block in morph chain, + // Extended ACL added into smart-contract storage. + rpc SetExtendedACL(SetExtendedACLRequest) returns (SetExtendedACLResponse); + + // GetExtendedACL returns Extended ACL table and signature from container + // smart-contract storage. + rpc GetExtendedACL(GetExtendedACLRequest) returns (GetExtendedACLResponse); +} + +message PutRequest { + message Body { + // Container to create in NeoFS. + container.v2.Container container = 1; + + // Public Key of container owner. It can be public key of the owner + // or it can be public key that bound in neofs.id smart-contract. + bytes public_key = 2; + + // Signature of stable-marshalled container according to RFC-6979. + bytes signature = 3; + } + + // Body of container put request message. + Body body = 1; + + // Carries request meta information. Header data is used only to regulate + // message transport and does not affect request execution. + service.v2.RequestMetaHeader meta_header = 2; + + // Carries request verification information. This header is used to + // authenticate the nodes of the message route and check the correctness + // of transmission. + service.v2.RequestVerificationHeader verify_header = 3; +} + +message PutResponse { + message Body { + // container_id carries identifier of the new container.v2. + refs.v2.ContainerID container_id = 1; + } + + // Body of container put response message. + Body body = 1; + + // Carries response meta information. Header data is used only to regulate + // message transport and does not affect request execution. + service.v2.ResponseMetaHeader meta_header = 2; + + // Carries response verification information. This header is used to + // authenticate the nodes of the message route and check the correctness + // of transmission. + service.v2.ResponseVerificationHeader verify_header = 3; +} + +message DeleteRequest { + message Body { + // container_id carries identifier of the container to delete + // from NeoFS. + refs.v2.ContainerID container_id = 1; + + // Signature of container id according to RFC-6979. + bytes signature = 2; + } + + // Body of container delete request message. + Body body = 1; + + // Carries request meta information. Header data is used only to regulate + // message transport and does not affect request execution. + service.v2.RequestMetaHeader meta_header = 2; + + // Carries request verification information. This header is used to + // authenticate the nodes of the message route and check the correctness + // of transmission. + service.v2.RequestVerificationHeader verify_header = 3; +} + +// DeleteResponse is empty because delete operation is asynchronous and done +// via consensus in inner ring nodes +message DeleteResponse { + message Body {} + + // Body of container delete response message. + Body body = 1; + + // Carries response meta information. Header data is used only to regulate + // message transport and does not affect request execution. + service.v2.ResponseMetaHeader meta_header = 2; + + // Carries response verification information. This header is used to + // authenticate the nodes of the message route and check the correctness + // of transmission. + service.v2.ResponseVerificationHeader verify_header = 3; +} + +message GetRequest { + message Body { + // container_id carries identifier of the container to get. + refs.v2.ContainerID container_id = 1; + } + + // Body of container get request message. + Body body = 1; + + // Carries request meta information. Header data is used only to regulate + // message transport and does not affect request execution. + service.v2.RequestMetaHeader meta_header = 2; + + // Carries request verification information. This header is used to + // authenticate the nodes of the message route and check the correctness + // of transmission. + service.v2.RequestVerificationHeader verify_header = 3; +} + +message GetResponse { + message Body { + // Container that has been requested. + container.v2.Container container = 1; + } + + // Body of container get response message. + Body body = 1; + + // Carries response meta information. Header data is used only to regulate + // message transport and does not affect request execution. + service.v2.ResponseMetaHeader meta_header = 2; + + // Carries response verification information. This header is used to + // authenticate the nodes of the message route and check the correctness + // of transmission. + service.v2.ResponseVerificationHeader verify_header = 3; +} + +message ListRequest { + message Body { + // owner_id carries identifier of the container owner. + refs.v2.OwnerID owner_id = 1; + } + + // Body of list containers request message. + Body body = 1; + + // Carries request meta information. Header data is used only to regulate + // message transport and does not affect request execution. + service.v2.RequestMetaHeader meta_header = 2; + + // Carries request verification information. This header is used to + // authenticate the nodes of the message route and check the correctness + // of transmission. + service.v2.RequestVerificationHeader verify_header = 3; +} + +message ListResponse { + message Body { + // ContainerIDs carries list of identifiers of the containers that belong to the owner. + repeated refs.v2.ContainerID container_ids = 1; + } + + // Body of list containers response message. + Body body = 1; + + // Carries response meta information. Header data is used only to regulate + // message transport and does not affect request execution. + service.v2.ResponseMetaHeader meta_header = 2; + + // Carries response verification information. This header is used to + // authenticate the nodes of the message route and check the correctness + // of transmission. + service.v2.ResponseVerificationHeader verify_header = 3; +} + +message SetExtendedACLRequest { + message Body { + // Extended ACL to set for the container.v2. + acl.v2.EACLTable eacl = 1; + + // Signature of stable-marshalled Extended ACL according to RFC-6979. + bytes signature = 2; + } + + // Body of set extended acl request message. + Body body = 1; + + // Carries request meta information. Header data is used only to regulate + // message transport and does not affect request execution. + service.v2.RequestMetaHeader meta_header = 2; + + // Carries request verification information. This header is used to + // authenticate the nodes of the message route and check the correctness + // of transmission. + service.v2.RequestVerificationHeader verify_header = 3; +} + +message SetExtendedACLResponse { + message Body { } + + // Body of set extended acl response message. + Body body = 1; + + // Carries response meta information. Header data is used only to regulate + // message transport and does not affect request execution. + service.v2.ResponseMetaHeader meta_header = 2; + + // Carries response verification information. This header is used to + // authenticate the nodes of the message route and check the correctness + // of transmission. + service.v2.ResponseVerificationHeader verify_header = 3; +} + +message GetExtendedACLRequest { + message Body { + // container_id carries identifier of the container that has Extended ACL. + refs.v2.ContainerID container_id = 1; + } + + // Body of get extended acl request message. + Body body = 1; + + // Carries request meta information. Header data is used only to regulate + // message transport and does not affect request execution. + service.v2.RequestMetaHeader meta_header = 2; + + // Carries request verification information. This header is used to + // authenticate the nodes of the message route and check the correctness + // of transmission. + service.v2.RequestVerificationHeader verify_header = 3; +} + +message GetExtendedACLResponse { + message Body { + // Extended ACL that has been requested if it was set up. + acl.v2.EACLTable eacl = 1; + + // Signature of stable-marshalled Extended ACL according to RFC-6979. + bytes signature = 2; + } + + // Body of get extended acl response message. + Body body = 1; + + // Carries response meta information. Header data is used only to regulate + // message transport and does not affect request execution. + service.v2.ResponseMetaHeader meta_header = 2; + + // Carries response verification information. This header is used to + // authenticate the nodes of the message route and check the correctness + // of transmission. + service.v2.ResponseVerificationHeader verify_header = 3; +} diff --git a/container/v2/types.pb.go b/container/v2/types.pb.go new file mode 100644 index 0000000..28c03d7 --- /dev/null +++ b/container/v2/types.pb.go @@ -0,0 +1,808 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: container/v2/types.proto + +package v2 + +import ( + fmt "fmt" + proto "github.com/golang/protobuf/proto" + v21 "github.com/nspcc-dev/neofs-api-go/netmap/v2" + v2 "github.com/nspcc-dev/neofs-api-go/refs/v2" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package + +// 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. ID of the container is a 32 byte long +// SHA256 hash of stable-marshalled container message. +type Container struct { + // OwnerID carries identifier of the container owner. + OwnerId *v2.OwnerID `protobuf:"bytes,1,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"` + // Nonce is a 16 byte UUID, used to avoid collisions of container id. + Nonce []byte `protobuf:"bytes,2,opt,name=nonce,proto3" json:"nonce,omitempty"` + // BasicACL contains access control rules for owner, system, others groups and + // permission bits for bearer token and Extended ACL. + BasicAcl uint32 `protobuf:"varint,3,opt,name=basic_acl,json=basicAcl,proto3" json:"basic_acl,omitempty"` + // Attributes define any immutable characteristics of container.v2. + Attributes []*Container_Attribute `protobuf:"bytes,4,rep,name=attributes,proto3" json:"attributes,omitempty"` + // Rules define storage policy for the object inside the container.v2. + Rules *v21.PlacementRule `protobuf:"bytes,5,opt,name=rules,proto3" json:"rules,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Container) Reset() { *m = Container{} } +func (m *Container) String() string { return proto.CompactTextString(m) } +func (*Container) ProtoMessage() {} +func (*Container) Descriptor() ([]byte, []int) { + return fileDescriptor_4fee8fa43abbe82f, []int{0} +} +func (m *Container) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Container) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Container.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Container) XXX_Merge(src proto.Message) { + xxx_messageInfo_Container.Merge(m, src) +} +func (m *Container) XXX_Size() int { + return m.Size() +} +func (m *Container) XXX_DiscardUnknown() { + xxx_messageInfo_Container.DiscardUnknown(m) +} + +var xxx_messageInfo_Container proto.InternalMessageInfo + +func (m *Container) GetOwnerId() *v2.OwnerID { + if m != nil { + return m.OwnerId + } + return nil +} + +func (m *Container) GetNonce() []byte { + if m != nil { + return m.Nonce + } + return nil +} + +func (m *Container) GetBasicAcl() uint32 { + if m != nil { + return m.BasicAcl + } + return 0 +} + +func (m *Container) GetAttributes() []*Container_Attribute { + if m != nil { + return m.Attributes + } + return nil +} + +func (m *Container) GetRules() *v21.PlacementRule { + if m != nil { + return m.Rules + } + return nil +} + +// Attribute is a key-value pair of strings. +type Container_Attribute struct { + // Key of immutable container attribute. + Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + // Value of immutable container attribute. + Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Container_Attribute) Reset() { *m = Container_Attribute{} } +func (m *Container_Attribute) String() string { return proto.CompactTextString(m) } +func (*Container_Attribute) ProtoMessage() {} +func (*Container_Attribute) Descriptor() ([]byte, []int) { + return fileDescriptor_4fee8fa43abbe82f, []int{0, 0} +} +func (m *Container_Attribute) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Container_Attribute) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Container_Attribute.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Container_Attribute) XXX_Merge(src proto.Message) { + xxx_messageInfo_Container_Attribute.Merge(m, src) +} +func (m *Container_Attribute) XXX_Size() int { + return m.Size() +} +func (m *Container_Attribute) XXX_DiscardUnknown() { + xxx_messageInfo_Container_Attribute.DiscardUnknown(m) +} + +var xxx_messageInfo_Container_Attribute proto.InternalMessageInfo + +func (m *Container_Attribute) GetKey() string { + if m != nil { + return m.Key + } + return "" +} + +func (m *Container_Attribute) GetValue() string { + if m != nil { + return m.Value + } + return "" +} + +func init() { + proto.RegisterType((*Container)(nil), "container.v2.Container") + proto.RegisterType((*Container_Attribute)(nil), "container.v2.Container.Attribute") +} + +func init() { proto.RegisterFile("container/v2/types.proto", fileDescriptor_4fee8fa43abbe82f) } + +var fileDescriptor_4fee8fa43abbe82f = []byte{ + // 334 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x5c, 0x91, 0xd1, 0x4a, 0xc3, 0x30, + 0x18, 0x85, 0xed, 0xe6, 0x74, 0xcd, 0x26, 0x8c, 0x4c, 0x21, 0x4c, 0x28, 0xd5, 0xab, 0x82, 0x2c, + 0x85, 0xee, 0x09, 0xaa, 0x22, 0xec, 0x46, 0x47, 0x04, 0x2f, 0xbc, 0x19, 0x69, 0xf6, 0x6f, 0x16, + 0xbb, 0xa4, 0x34, 0x69, 0x65, 0xcf, 0xe1, 0x8d, 0xcf, 0xe0, 0x93, 0x78, 0xe9, 0x23, 0xc8, 0x7c, + 0x11, 0x69, 0xcb, 0xe6, 0xd8, 0x5d, 0xfe, 0xff, 0x9c, 0x13, 0xce, 0x97, 0x20, 0x22, 0x94, 0x34, + 0x3c, 0x96, 0x90, 0xf9, 0x45, 0xe0, 0x9b, 0x55, 0x0a, 0x9a, 0xa6, 0x99, 0x32, 0x0a, 0x77, 0xb7, + 0x0a, 0x2d, 0x82, 0xc1, 0x99, 0x04, 0xb3, 0xe4, 0xe9, 0x9e, 0x69, 0xd0, 0xcf, 0x60, 0xae, 0xf7, + 0x96, 0x97, 0xef, 0x0d, 0x64, 0xdf, 0x6c, 0xc2, 0xf8, 0x0a, 0xb5, 0xd5, 0x9b, 0x84, 0x6c, 0x1a, + 0xcf, 0x88, 0xe5, 0x5a, 0x5e, 0x27, 0xe8, 0xd1, 0x32, 0x45, 0x8b, 0x80, 0x3e, 0x94, 0xc2, 0xf8, + 0x96, 0x1d, 0x57, 0x8e, 0xf1, 0x0c, 0x9f, 0xa2, 0x96, 0x54, 0x52, 0x00, 0x69, 0xb8, 0x96, 0xd7, + 0x65, 0xf5, 0x80, 0xcf, 0x91, 0x1d, 0x71, 0x1d, 0x8b, 0x29, 0x17, 0x09, 0x69, 0xba, 0x96, 0x77, + 0xc2, 0xda, 0xd5, 0x22, 0x14, 0x09, 0x0e, 0x11, 0xe2, 0xc6, 0x64, 0x71, 0x94, 0x1b, 0xd0, 0xe4, + 0xd0, 0x6d, 0x7a, 0x9d, 0xe0, 0x82, 0xee, 0x96, 0xa7, 0xdb, 0x32, 0x34, 0xdc, 0x38, 0xd9, 0x4e, + 0x08, 0x53, 0xd4, 0xca, 0xf2, 0x04, 0x34, 0x69, 0x55, 0xfd, 0x08, 0xad, 0x61, 0xcb, 0xe8, 0x24, + 0xe1, 0x02, 0x96, 0x20, 0x0d, 0xcb, 0x13, 0x60, 0xb5, 0x6d, 0x30, 0x42, 0xf6, 0xf6, 0x22, 0xdc, + 0x43, 0xcd, 0x57, 0x58, 0x55, 0x68, 0x36, 0x2b, 0x8f, 0x25, 0x44, 0xc1, 0x93, 0xbc, 0x86, 0xb0, + 0x59, 0x3d, 0x5c, 0x3f, 0x7d, 0xad, 0x1d, 0xeb, 0x7b, 0xed, 0x58, 0x3f, 0x6b, 0xc7, 0xfa, 0xf8, + 0x75, 0x0e, 0x9e, 0xe9, 0x22, 0x36, 0x2f, 0x79, 0x44, 0x85, 0x5a, 0xfa, 0x52, 0xa7, 0x42, 0x0c, + 0x67, 0x50, 0xf8, 0x12, 0xd4, 0x5c, 0x0f, 0x79, 0x1a, 0x0f, 0x17, 0xca, 0xdf, 0xfd, 0x9d, 0xcf, + 0x46, 0xff, 0x1e, 0xd4, 0xdd, 0x23, 0x0d, 0x27, 0xe3, 0x7f, 0xa4, 0xe8, 0xa8, 0x7a, 0xf4, 0xd1, + 0x5f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x16, 0x73, 0x26, 0x7e, 0xca, 0x01, 0x00, 0x00, +} + +func (m *Container) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Container) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Container) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.Rules != nil { + { + size, err := m.Rules.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + } + if len(m.Attributes) > 0 { + for iNdEx := len(m.Attributes) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Attributes[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + } + if m.BasicAcl != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.BasicAcl)) + i-- + dAtA[i] = 0x18 + } + if len(m.Nonce) > 0 { + i -= len(m.Nonce) + copy(dAtA[i:], m.Nonce) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Nonce))) + i-- + dAtA[i] = 0x12 + } + if m.OwnerId != nil { + { + size, err := m.OwnerId.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Container_Attribute) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Container_Attribute) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Container_Attribute) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Value) > 0 { + i -= len(m.Value) + copy(dAtA[i:], m.Value) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Value))) + i-- + dAtA[i] = 0x12 + } + if len(m.Key) > 0 { + i -= len(m.Key) + copy(dAtA[i:], m.Key) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Key))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintTypes(dAtA []byte, offset int, v uint64) int { + offset -= sovTypes(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Container) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.OwnerId != nil { + l = m.OwnerId.Size() + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.Nonce) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + if m.BasicAcl != 0 { + n += 1 + sovTypes(uint64(m.BasicAcl)) + } + if len(m.Attributes) > 0 { + for _, e := range m.Attributes { + l = e.Size() + n += 1 + l + sovTypes(uint64(l)) + } + } + if m.Rules != nil { + l = m.Rules.Size() + n += 1 + l + sovTypes(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *Container_Attribute) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Key) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.Value) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovTypes(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozTypes(x uint64) (n int) { + return sovTypes(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Container) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Container: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Container: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OwnerId", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.OwnerId == nil { + m.OwnerId = &v2.OwnerID{} + } + if err := m.OwnerId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Nonce", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Nonce = append(m.Nonce[:0], dAtA[iNdEx:postIndex]...) + if m.Nonce == nil { + m.Nonce = []byte{} + } + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BasicAcl", wireType) + } + m.BasicAcl = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.BasicAcl |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Attributes", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Attributes = append(m.Attributes, &Container_Attribute{}) + if err := m.Attributes[len(m.Attributes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Rules", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Rules == nil { + m.Rules = &v21.PlacementRule{} + } + if err := m.Rules.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Container_Attribute) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Attribute: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Attribute: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Key = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Value = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipTypes(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthTypes + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTypes + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthTypes + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthTypes = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTypes = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTypes = fmt.Errorf("proto: unexpected end of group") +) diff --git a/container/v2/types.proto b/container/v2/types.proto new file mode 100644 index 0000000..5897b8c --- /dev/null +++ b/container/v2/types.proto @@ -0,0 +1,40 @@ +syntax = "proto3"; + +package container.v2; + +option go_package = "github.com/nspcc-dev/neofs-api-go/container/v2"; +option csharp_namespace = "NeoFS.API.Container"; + +import "netmap/v2/types.proto"; +import "refs/v2/types.proto"; + +// 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. ID of the container is a 32 byte long +// SHA256 hash of stable-marshalled container message. +message Container { + // OwnerID carries identifier of the container owner. + refs.v2.OwnerID owner_id = 1; + + // Nonce is a 16 byte UUID, used to avoid collisions of container id. + bytes nonce = 2; + + // BasicACL contains access control rules for owner, system, others groups and + // permission bits for bearer token and Extended ACL. + uint32 basic_acl = 3; + + // Attribute is a key-value pair of strings. + message Attribute { + // Key of immutable container attribute. + string key = 1; + + // Value of immutable container attribute. + string value = 2; + } + + // Attributes define any immutable characteristics of container.v2. + repeated Attribute attributes = 4; + + // Rules define storage policy for the object inside the container.v2. + netmap.v2.PlacementRule rules = 5; +} diff --git a/netmap/v2/types.pb.go b/netmap/v2/types.pb.go new file mode 100644 index 0000000..a83e195 --- /dev/null +++ b/netmap/v2/types.pb.go @@ -0,0 +1,2448 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: netmap/v2/types.proto + +package v2 + +import ( + fmt "fmt" + proto "github.com/golang/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package + +type PlacementRule_SFGroup_Filter_SimpleFilter_Operation int32 + +const ( + PlacementRule_SFGroup_Filter_SimpleFilter_NP PlacementRule_SFGroup_Filter_SimpleFilter_Operation = 0 + PlacementRule_SFGroup_Filter_SimpleFilter_EQ PlacementRule_SFGroup_Filter_SimpleFilter_Operation = 1 + PlacementRule_SFGroup_Filter_SimpleFilter_NE PlacementRule_SFGroup_Filter_SimpleFilter_Operation = 2 + PlacementRule_SFGroup_Filter_SimpleFilter_GT PlacementRule_SFGroup_Filter_SimpleFilter_Operation = 3 + PlacementRule_SFGroup_Filter_SimpleFilter_GE PlacementRule_SFGroup_Filter_SimpleFilter_Operation = 4 + PlacementRule_SFGroup_Filter_SimpleFilter_LT PlacementRule_SFGroup_Filter_SimpleFilter_Operation = 5 + PlacementRule_SFGroup_Filter_SimpleFilter_LE PlacementRule_SFGroup_Filter_SimpleFilter_Operation = 6 + PlacementRule_SFGroup_Filter_SimpleFilter_OR PlacementRule_SFGroup_Filter_SimpleFilter_Operation = 7 + PlacementRule_SFGroup_Filter_SimpleFilter_AND PlacementRule_SFGroup_Filter_SimpleFilter_Operation = 8 +) + +var PlacementRule_SFGroup_Filter_SimpleFilter_Operation_name = map[int32]string{ + 0: "NP", + 1: "EQ", + 2: "NE", + 3: "GT", + 4: "GE", + 5: "LT", + 6: "LE", + 7: "OR", + 8: "AND", +} + +var PlacementRule_SFGroup_Filter_SimpleFilter_Operation_value = map[string]int32{ + "NP": 0, + "EQ": 1, + "NE": 2, + "GT": 3, + "GE": 4, + "LT": 5, + "LE": 6, + "OR": 7, + "AND": 8, +} + +func (x PlacementRule_SFGroup_Filter_SimpleFilter_Operation) String() string { + return proto.EnumName(PlacementRule_SFGroup_Filter_SimpleFilter_Operation_name, int32(x)) +} + +func (PlacementRule_SFGroup_Filter_SimpleFilter_Operation) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_059adda2b6daaf64, []int{0, 0, 0, 1, 0} +} + +// Represents the enumeration of various states of the NeoFS node. +type NodeInfo_State int32 + +const ( + // Undefined state. + NodeInfo_UNKNOWN NodeInfo_State = 0 + // Active state in the network. + NodeInfo_ONLINE NodeInfo_State = 1 + // Network unavailable state. + NodeInfo_OFFLINE NodeInfo_State = 2 +) + +var NodeInfo_State_name = map[int32]string{ + 0: "UNKNOWN", + 1: "ONLINE", + 2: "OFFLINE", +} + +var NodeInfo_State_value = map[string]int32{ + "UNKNOWN": 0, + "ONLINE": 1, + "OFFLINE": 2, +} + +func (x NodeInfo_State) String() string { + return proto.EnumName(NodeInfo_State_name, int32(x)) +} + +func (NodeInfo_State) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_059adda2b6daaf64, []int{1, 0} +} + +type PlacementRule struct { + ReplFactor uint32 `protobuf:"varint,1,opt,name=repl_factor,json=replFactor,proto3" json:"repl_factor,omitempty"` + SfGroups []*PlacementRule_SFGroup `protobuf:"bytes,2,rep,name=sf_groups,json=sfGroups,proto3" json:"sf_groups,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *PlacementRule) Reset() { *m = PlacementRule{} } +func (m *PlacementRule) String() string { return proto.CompactTextString(m) } +func (*PlacementRule) ProtoMessage() {} +func (*PlacementRule) Descriptor() ([]byte, []int) { + return fileDescriptor_059adda2b6daaf64, []int{0} +} +func (m *PlacementRule) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *PlacementRule) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_PlacementRule.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *PlacementRule) XXX_Merge(src proto.Message) { + xxx_messageInfo_PlacementRule.Merge(m, src) +} +func (m *PlacementRule) XXX_Size() int { + return m.Size() +} +func (m *PlacementRule) XXX_DiscardUnknown() { + xxx_messageInfo_PlacementRule.DiscardUnknown(m) +} + +var xxx_messageInfo_PlacementRule proto.InternalMessageInfo + +func (m *PlacementRule) GetReplFactor() uint32 { + if m != nil { + return m.ReplFactor + } + return 0 +} + +func (m *PlacementRule) GetSfGroups() []*PlacementRule_SFGroup { + if m != nil { + return m.SfGroups + } + return nil +} + +type PlacementRule_SFGroup struct { + Filters []*PlacementRule_SFGroup_Filter `protobuf:"bytes,1,rep,name=filters,proto3" json:"filters,omitempty"` + Selectors []*PlacementRule_SFGroup_Selector `protobuf:"bytes,2,rep,name=selectors,proto3" json:"selectors,omitempty"` + Exclude []uint32 `protobuf:"varint,3,rep,packed,name=exclude,proto3" json:"exclude,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *PlacementRule_SFGroup) Reset() { *m = PlacementRule_SFGroup{} } +func (m *PlacementRule_SFGroup) String() string { return proto.CompactTextString(m) } +func (*PlacementRule_SFGroup) ProtoMessage() {} +func (*PlacementRule_SFGroup) Descriptor() ([]byte, []int) { + return fileDescriptor_059adda2b6daaf64, []int{0, 0} +} +func (m *PlacementRule_SFGroup) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *PlacementRule_SFGroup) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_PlacementRule_SFGroup.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *PlacementRule_SFGroup) XXX_Merge(src proto.Message) { + xxx_messageInfo_PlacementRule_SFGroup.Merge(m, src) +} +func (m *PlacementRule_SFGroup) XXX_Size() int { + return m.Size() +} +func (m *PlacementRule_SFGroup) XXX_DiscardUnknown() { + xxx_messageInfo_PlacementRule_SFGroup.DiscardUnknown(m) +} + +var xxx_messageInfo_PlacementRule_SFGroup proto.InternalMessageInfo + +func (m *PlacementRule_SFGroup) GetFilters() []*PlacementRule_SFGroup_Filter { + if m != nil { + return m.Filters + } + return nil +} + +func (m *PlacementRule_SFGroup) GetSelectors() []*PlacementRule_SFGroup_Selector { + if m != nil { + return m.Selectors + } + return nil +} + +func (m *PlacementRule_SFGroup) GetExclude() []uint32 { + if m != nil { + return m.Exclude + } + return nil +} + +type PlacementRule_SFGroup_Filter struct { + Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + F *PlacementRule_SFGroup_Filter_SimpleFilter `protobuf:"bytes,2,opt,name=f,proto3" json:"f,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *PlacementRule_SFGroup_Filter) Reset() { *m = PlacementRule_SFGroup_Filter{} } +func (m *PlacementRule_SFGroup_Filter) String() string { return proto.CompactTextString(m) } +func (*PlacementRule_SFGroup_Filter) ProtoMessage() {} +func (*PlacementRule_SFGroup_Filter) Descriptor() ([]byte, []int) { + return fileDescriptor_059adda2b6daaf64, []int{0, 0, 0} +} +func (m *PlacementRule_SFGroup_Filter) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *PlacementRule_SFGroup_Filter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_PlacementRule_SFGroup_Filter.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *PlacementRule_SFGroup_Filter) XXX_Merge(src proto.Message) { + xxx_messageInfo_PlacementRule_SFGroup_Filter.Merge(m, src) +} +func (m *PlacementRule_SFGroup_Filter) XXX_Size() int { + return m.Size() +} +func (m *PlacementRule_SFGroup_Filter) XXX_DiscardUnknown() { + xxx_messageInfo_PlacementRule_SFGroup_Filter.DiscardUnknown(m) +} + +var xxx_messageInfo_PlacementRule_SFGroup_Filter proto.InternalMessageInfo + +func (m *PlacementRule_SFGroup_Filter) GetKey() string { + if m != nil { + return m.Key + } + return "" +} + +func (m *PlacementRule_SFGroup_Filter) GetF() *PlacementRule_SFGroup_Filter_SimpleFilter { + if m != nil { + return m.F + } + return nil +} + +type PlacementRule_SFGroup_Filter_SimpleFilters struct { + Filters []*PlacementRule_SFGroup_Filter_SimpleFilter `protobuf:"bytes,1,rep,name=filters,proto3" json:"filters,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *PlacementRule_SFGroup_Filter_SimpleFilters) Reset() { + *m = PlacementRule_SFGroup_Filter_SimpleFilters{} +} +func (m *PlacementRule_SFGroup_Filter_SimpleFilters) String() string { + return proto.CompactTextString(m) +} +func (*PlacementRule_SFGroup_Filter_SimpleFilters) ProtoMessage() {} +func (*PlacementRule_SFGroup_Filter_SimpleFilters) Descriptor() ([]byte, []int) { + return fileDescriptor_059adda2b6daaf64, []int{0, 0, 0, 0} +} +func (m *PlacementRule_SFGroup_Filter_SimpleFilters) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *PlacementRule_SFGroup_Filter_SimpleFilters) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_PlacementRule_SFGroup_Filter_SimpleFilters.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *PlacementRule_SFGroup_Filter_SimpleFilters) XXX_Merge(src proto.Message) { + xxx_messageInfo_PlacementRule_SFGroup_Filter_SimpleFilters.Merge(m, src) +} +func (m *PlacementRule_SFGroup_Filter_SimpleFilters) XXX_Size() int { + return m.Size() +} +func (m *PlacementRule_SFGroup_Filter_SimpleFilters) XXX_DiscardUnknown() { + xxx_messageInfo_PlacementRule_SFGroup_Filter_SimpleFilters.DiscardUnknown(m) +} + +var xxx_messageInfo_PlacementRule_SFGroup_Filter_SimpleFilters proto.InternalMessageInfo + +func (m *PlacementRule_SFGroup_Filter_SimpleFilters) GetFilters() []*PlacementRule_SFGroup_Filter_SimpleFilter { + if m != nil { + return m.Filters + } + return nil +} + +type PlacementRule_SFGroup_Filter_SimpleFilter struct { + Op PlacementRule_SFGroup_Filter_SimpleFilter_Operation `protobuf:"varint,1,opt,name=op,proto3,enum=netmap.v2.PlacementRule_SFGroup_Filter_SimpleFilter_Operation" json:"op,omitempty"` + // Types that are valid to be assigned to Args: + // *PlacementRule_SFGroup_Filter_SimpleFilter_Value + // *PlacementRule_SFGroup_Filter_SimpleFilter_FArgs + Args isPlacementRule_SFGroup_Filter_SimpleFilter_Args `protobuf_oneof:"args"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *PlacementRule_SFGroup_Filter_SimpleFilter) Reset() { + *m = PlacementRule_SFGroup_Filter_SimpleFilter{} +} +func (m *PlacementRule_SFGroup_Filter_SimpleFilter) String() string { + return proto.CompactTextString(m) +} +func (*PlacementRule_SFGroup_Filter_SimpleFilter) ProtoMessage() {} +func (*PlacementRule_SFGroup_Filter_SimpleFilter) Descriptor() ([]byte, []int) { + return fileDescriptor_059adda2b6daaf64, []int{0, 0, 0, 1} +} +func (m *PlacementRule_SFGroup_Filter_SimpleFilter) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *PlacementRule_SFGroup_Filter_SimpleFilter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_PlacementRule_SFGroup_Filter_SimpleFilter.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *PlacementRule_SFGroup_Filter_SimpleFilter) XXX_Merge(src proto.Message) { + xxx_messageInfo_PlacementRule_SFGroup_Filter_SimpleFilter.Merge(m, src) +} +func (m *PlacementRule_SFGroup_Filter_SimpleFilter) XXX_Size() int { + return m.Size() +} +func (m *PlacementRule_SFGroup_Filter_SimpleFilter) XXX_DiscardUnknown() { + xxx_messageInfo_PlacementRule_SFGroup_Filter_SimpleFilter.DiscardUnknown(m) +} + +var xxx_messageInfo_PlacementRule_SFGroup_Filter_SimpleFilter proto.InternalMessageInfo + +type isPlacementRule_SFGroup_Filter_SimpleFilter_Args interface { + isPlacementRule_SFGroup_Filter_SimpleFilter_Args() + MarshalTo([]byte) (int, error) + Size() int +} + +type PlacementRule_SFGroup_Filter_SimpleFilter_Value struct { + Value string `protobuf:"bytes,2,opt,name=value,proto3,oneof" json:"value,omitempty"` +} +type PlacementRule_SFGroup_Filter_SimpleFilter_FArgs struct { + FArgs *PlacementRule_SFGroup_Filter_SimpleFilters `protobuf:"bytes,3,opt,name=f_args,json=fArgs,proto3,oneof" json:"f_args,omitempty"` +} + +func (*PlacementRule_SFGroup_Filter_SimpleFilter_Value) isPlacementRule_SFGroup_Filter_SimpleFilter_Args() { +} +func (*PlacementRule_SFGroup_Filter_SimpleFilter_FArgs) isPlacementRule_SFGroup_Filter_SimpleFilter_Args() { +} + +func (m *PlacementRule_SFGroup_Filter_SimpleFilter) GetArgs() isPlacementRule_SFGroup_Filter_SimpleFilter_Args { + if m != nil { + return m.Args + } + return nil +} + +func (m *PlacementRule_SFGroup_Filter_SimpleFilter) GetOp() PlacementRule_SFGroup_Filter_SimpleFilter_Operation { + if m != nil { + return m.Op + } + return PlacementRule_SFGroup_Filter_SimpleFilter_NP +} + +func (m *PlacementRule_SFGroup_Filter_SimpleFilter) GetValue() string { + if x, ok := m.GetArgs().(*PlacementRule_SFGroup_Filter_SimpleFilter_Value); ok { + return x.Value + } + return "" +} + +func (m *PlacementRule_SFGroup_Filter_SimpleFilter) GetFArgs() *PlacementRule_SFGroup_Filter_SimpleFilters { + if x, ok := m.GetArgs().(*PlacementRule_SFGroup_Filter_SimpleFilter_FArgs); ok { + return x.FArgs + } + return nil +} + +// XXX_OneofWrappers is for the internal use of the proto package. +func (*PlacementRule_SFGroup_Filter_SimpleFilter) XXX_OneofWrappers() []interface{} { + return []interface{}{ + (*PlacementRule_SFGroup_Filter_SimpleFilter_Value)(nil), + (*PlacementRule_SFGroup_Filter_SimpleFilter_FArgs)(nil), + } +} + +type PlacementRule_SFGroup_Selector struct { + Count uint32 `protobuf:"varint,1,opt,name=count,proto3" json:"count,omitempty"` + Key string `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *PlacementRule_SFGroup_Selector) Reset() { *m = PlacementRule_SFGroup_Selector{} } +func (m *PlacementRule_SFGroup_Selector) String() string { return proto.CompactTextString(m) } +func (*PlacementRule_SFGroup_Selector) ProtoMessage() {} +func (*PlacementRule_SFGroup_Selector) Descriptor() ([]byte, []int) { + return fileDescriptor_059adda2b6daaf64, []int{0, 0, 1} +} +func (m *PlacementRule_SFGroup_Selector) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *PlacementRule_SFGroup_Selector) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_PlacementRule_SFGroup_Selector.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *PlacementRule_SFGroup_Selector) XXX_Merge(src proto.Message) { + xxx_messageInfo_PlacementRule_SFGroup_Selector.Merge(m, src) +} +func (m *PlacementRule_SFGroup_Selector) XXX_Size() int { + return m.Size() +} +func (m *PlacementRule_SFGroup_Selector) XXX_DiscardUnknown() { + xxx_messageInfo_PlacementRule_SFGroup_Selector.DiscardUnknown(m) +} + +var xxx_messageInfo_PlacementRule_SFGroup_Selector proto.InternalMessageInfo + +func (m *PlacementRule_SFGroup_Selector) GetCount() uint32 { + if m != nil { + return m.Count + } + return 0 +} + +func (m *PlacementRule_SFGroup_Selector) GetKey() string { + if m != nil { + return m.Key + } + return "" +} + +// Groups the information about the NeoFS node. +type NodeInfo struct { + // Carries network address of the NeoFS node. + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + // Carries public key of the NeoFS node in a binary format. + PublicKey []byte `protobuf:"bytes,2,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"` + // Carries list of the NeoFS node attributes in a string key-value format. + Attributes []*NodeInfo_Attribute `protobuf:"bytes,3,rep,name=attributes,proto3" json:"attributes,omitempty"` + // Carries state of the NeoFS node. + State NodeInfo_State `protobuf:"varint,4,opt,name=state,proto3,enum=netmap.v2.NodeInfo_State" json:"state,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *NodeInfo) Reset() { *m = NodeInfo{} } +func (m *NodeInfo) String() string { return proto.CompactTextString(m) } +func (*NodeInfo) ProtoMessage() {} +func (*NodeInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_059adda2b6daaf64, []int{1} +} +func (m *NodeInfo) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *NodeInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_NodeInfo.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *NodeInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_NodeInfo.Merge(m, src) +} +func (m *NodeInfo) XXX_Size() int { + return m.Size() +} +func (m *NodeInfo) XXX_DiscardUnknown() { + xxx_messageInfo_NodeInfo.DiscardUnknown(m) +} + +var xxx_messageInfo_NodeInfo proto.InternalMessageInfo + +func (m *NodeInfo) GetAddress() string { + if m != nil { + return m.Address + } + return "" +} + +func (m *NodeInfo) GetPublicKey() []byte { + if m != nil { + return m.PublicKey + } + return nil +} + +func (m *NodeInfo) GetAttributes() []*NodeInfo_Attribute { + if m != nil { + return m.Attributes + } + return nil +} + +func (m *NodeInfo) GetState() NodeInfo_State { + if m != nil { + return m.State + } + return NodeInfo_UNKNOWN +} + +// Groups attributes of the NeoFS node. +type NodeInfo_Attribute struct { + // Carries string key to the node attribute. + Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + // Carries string value of the node attribute. + Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *NodeInfo_Attribute) Reset() { *m = NodeInfo_Attribute{} } +func (m *NodeInfo_Attribute) String() string { return proto.CompactTextString(m) } +func (*NodeInfo_Attribute) ProtoMessage() {} +func (*NodeInfo_Attribute) Descriptor() ([]byte, []int) { + return fileDescriptor_059adda2b6daaf64, []int{1, 0} +} +func (m *NodeInfo_Attribute) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *NodeInfo_Attribute) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_NodeInfo_Attribute.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *NodeInfo_Attribute) XXX_Merge(src proto.Message) { + xxx_messageInfo_NodeInfo_Attribute.Merge(m, src) +} +func (m *NodeInfo_Attribute) XXX_Size() int { + return m.Size() +} +func (m *NodeInfo_Attribute) XXX_DiscardUnknown() { + xxx_messageInfo_NodeInfo_Attribute.DiscardUnknown(m) +} + +var xxx_messageInfo_NodeInfo_Attribute proto.InternalMessageInfo + +func (m *NodeInfo_Attribute) GetKey() string { + if m != nil { + return m.Key + } + return "" +} + +func (m *NodeInfo_Attribute) GetValue() string { + if m != nil { + return m.Value + } + return "" +} + +func init() { + proto.RegisterEnum("netmap.v2.PlacementRule_SFGroup_Filter_SimpleFilter_Operation", PlacementRule_SFGroup_Filter_SimpleFilter_Operation_name, PlacementRule_SFGroup_Filter_SimpleFilter_Operation_value) + proto.RegisterEnum("netmap.v2.NodeInfo_State", NodeInfo_State_name, NodeInfo_State_value) + proto.RegisterType((*PlacementRule)(nil), "netmap.v2.PlacementRule") + proto.RegisterType((*PlacementRule_SFGroup)(nil), "netmap.v2.PlacementRule.SFGroup") + proto.RegisterType((*PlacementRule_SFGroup_Filter)(nil), "netmap.v2.PlacementRule.SFGroup.Filter") + proto.RegisterType((*PlacementRule_SFGroup_Filter_SimpleFilters)(nil), "netmap.v2.PlacementRule.SFGroup.Filter.SimpleFilters") + proto.RegisterType((*PlacementRule_SFGroup_Filter_SimpleFilter)(nil), "netmap.v2.PlacementRule.SFGroup.Filter.SimpleFilter") + proto.RegisterType((*PlacementRule_SFGroup_Selector)(nil), "netmap.v2.PlacementRule.SFGroup.Selector") + proto.RegisterType((*NodeInfo)(nil), "netmap.v2.NodeInfo") + proto.RegisterType((*NodeInfo_Attribute)(nil), "netmap.v2.NodeInfo.Attribute") +} + +func init() { proto.RegisterFile("netmap/v2/types.proto", fileDescriptor_059adda2b6daaf64) } + +var fileDescriptor_059adda2b6daaf64 = []byte{ + // 633 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x54, 0x41, 0x6b, 0xdb, 0x4a, + 0x10, 0xb6, 0xa4, 0x58, 0xb6, 0xc6, 0xf1, 0x43, 0x2c, 0x79, 0x0f, 0x3d, 0x43, 0xfc, 0x8c, 0x2f, + 0xcf, 0xa5, 0x58, 0x06, 0xa5, 0x3d, 0xa6, 0xe0, 0x50, 0x3b, 0x0d, 0x09, 0x6b, 0x77, 0x9d, 0x52, + 0xe8, 0xc5, 0xc8, 0xf2, 0xca, 0x15, 0x95, 0xb5, 0x42, 0xbb, 0x32, 0xcd, 0x2f, 0x69, 0x7f, 0x40, + 0x4f, 0xfd, 0x11, 0x3d, 0xf7, 0xd0, 0x43, 0x7f, 0x42, 0x49, 0xa1, 0xbf, 0xa3, 0xec, 0xda, 0x72, + 0x9d, 0x12, 0x48, 0xc9, 0x69, 0x34, 0xdf, 0xce, 0xf7, 0xcd, 0xec, 0xcc, 0x68, 0xe1, 0xef, 0x84, + 0x8a, 0xa5, 0x9f, 0xf6, 0x56, 0x5e, 0x4f, 0x5c, 0xa5, 0x94, 0xbb, 0x69, 0xc6, 0x04, 0x43, 0xd6, + 0x1a, 0x76, 0x57, 0x5e, 0xfb, 0x93, 0x09, 0xf5, 0x71, 0xec, 0x07, 0x74, 0x49, 0x13, 0x41, 0xf2, + 0x98, 0xa2, 0xff, 0xa0, 0x96, 0xd1, 0x34, 0x9e, 0x86, 0x7e, 0x20, 0x58, 0xe6, 0x68, 0x2d, 0xad, + 0x53, 0x27, 0x20, 0xa1, 0xa1, 0x42, 0xd0, 0x31, 0x58, 0x3c, 0x9c, 0x2e, 0x32, 0x96, 0xa7, 0xdc, + 0xd1, 0x5b, 0x46, 0xa7, 0xe6, 0xb5, 0xdc, 0xad, 0xa2, 0x7b, 0x43, 0xcd, 0x9d, 0x0c, 0x4f, 0x65, + 0x20, 0xa9, 0xf2, 0x50, 0x7d, 0xf0, 0xc6, 0x97, 0x32, 0x54, 0x36, 0x28, 0xea, 0x43, 0x25, 0x8c, + 0x62, 0x41, 0x33, 0xee, 0x68, 0x4a, 0xe8, 0xff, 0xbb, 0x84, 0xdc, 0xa1, 0x8a, 0x27, 0x05, 0x0f, + 0x9d, 0x82, 0xc5, 0x69, 0x4c, 0x65, 0x65, 0x45, 0x35, 0x0f, 0xee, 0x14, 0x99, 0x6c, 0x18, 0xe4, + 0x17, 0x17, 0x39, 0x50, 0xa1, 0x6f, 0x83, 0x38, 0x9f, 0x53, 0xc7, 0x68, 0x19, 0x9d, 0x3a, 0x29, + 0xdc, 0xc6, 0x0f, 0x03, 0xcc, 0x75, 0x5a, 0x64, 0x83, 0xf1, 0x86, 0x5e, 0xa9, 0xa6, 0x58, 0x44, + 0x7e, 0xa2, 0x13, 0xd0, 0x42, 0x47, 0x6f, 0x69, 0x9d, 0x9a, 0xf7, 0xe8, 0x0f, 0x8b, 0x77, 0x27, + 0xd1, 0x32, 0x8d, 0xe9, 0xe6, 0x26, 0x5a, 0xd8, 0x98, 0x42, 0x7d, 0x17, 0xe2, 0x08, 0xff, 0xde, + 0x97, 0xfb, 0x49, 0x17, 0x22, 0x8d, 0x0f, 0x3a, 0xec, 0xef, 0x9e, 0x20, 0x0c, 0x3a, 0x4b, 0xd5, + 0x35, 0xfe, 0xf2, 0x9e, 0xdc, 0x47, 0xdb, 0x1d, 0xa5, 0x34, 0xf3, 0x45, 0xc4, 0x12, 0xa2, 0xb3, + 0x14, 0xfd, 0x03, 0xe5, 0x95, 0x1f, 0xe7, 0x54, 0x75, 0xc2, 0x7a, 0x56, 0x22, 0x6b, 0x17, 0x61, + 0x30, 0xc3, 0xa9, 0x9f, 0x2d, 0xb8, 0x63, 0xa8, 0x16, 0x3d, 0xbe, 0x4f, 0x2e, 0x2e, 0xf5, 0xc2, + 0x7e, 0xb6, 0xe0, 0xed, 0x4b, 0xb0, 0xb6, 0x89, 0x91, 0x09, 0x3a, 0x1e, 0xdb, 0x25, 0x69, 0x07, + 0xcf, 0x6d, 0x4d, 0xf9, 0x03, 0x5b, 0x97, 0xf6, 0xf4, 0xd2, 0x36, 0x94, 0x1d, 0xd8, 0x7b, 0xd2, + 0x5e, 0x5c, 0xda, 0x65, 0x65, 0x07, 0xb6, 0x29, 0xed, 0x88, 0xd8, 0x15, 0x54, 0x01, 0xa3, 0x8f, + 0x9f, 0xda, 0xd5, 0x13, 0x13, 0xf6, 0x64, 0x8d, 0x0d, 0x0f, 0xaa, 0xc5, 0x66, 0xa0, 0x03, 0x28, + 0x07, 0x2c, 0x4f, 0xc4, 0xe6, 0x07, 0x58, 0x3b, 0xc5, 0xfc, 0xf5, 0xed, 0xfc, 0xdb, 0xef, 0x74, + 0xa8, 0x62, 0x36, 0xa7, 0x67, 0x49, 0xc8, 0xe4, 0x0e, 0xf9, 0xf3, 0x79, 0x46, 0x39, 0xdf, 0xac, + 0x48, 0xe1, 0xa2, 0x43, 0x80, 0x34, 0x9f, 0xc5, 0x51, 0x30, 0x2d, 0xf8, 0xfb, 0xc4, 0x5a, 0x23, + 0xe7, 0xf4, 0x0a, 0x1d, 0x03, 0xf8, 0x42, 0x64, 0xd1, 0x2c, 0x17, 0x94, 0xab, 0xfd, 0xab, 0x79, + 0x87, 0x3b, 0xbd, 0x2a, 0x32, 0xb8, 0xfd, 0x22, 0x8a, 0xec, 0x10, 0x50, 0x0f, 0xca, 0x5c, 0xf8, + 0x82, 0x3a, 0x7b, 0x6a, 0xa2, 0xff, 0xde, 0xc6, 0x9c, 0xc8, 0x00, 0xb2, 0x8e, 0x6b, 0x1c, 0x81, + 0xb5, 0x55, 0xba, 0x65, 0xa9, 0x0f, 0x6e, 0x8c, 0x73, 0x33, 0xcc, 0x76, 0x17, 0xca, 0x4a, 0x04, + 0xd5, 0xa0, 0xf2, 0x02, 0x9f, 0xe3, 0xd1, 0x4b, 0x6c, 0x97, 0x10, 0x80, 0x39, 0xc2, 0x17, 0x67, + 0x78, 0x60, 0x6b, 0xf2, 0x60, 0x34, 0x1c, 0x2a, 0x47, 0x3f, 0x19, 0x7f, 0xbe, 0x6e, 0x6a, 0x5f, + 0xaf, 0x9b, 0xda, 0xb7, 0xeb, 0xa6, 0xf6, 0xfe, 0x7b, 0xb3, 0xf4, 0xea, 0xe1, 0x22, 0x12, 0xaf, + 0xf3, 0x99, 0x1b, 0xb0, 0x65, 0x2f, 0xe1, 0x69, 0x10, 0x74, 0xe7, 0x74, 0xd5, 0x4b, 0x28, 0x0b, + 0x79, 0xd7, 0x4f, 0xa3, 0xee, 0x82, 0xf5, 0xb6, 0x0f, 0xd6, 0x47, 0xdd, 0xc6, 0x94, 0x0d, 0x27, + 0x6e, 0x7f, 0x7c, 0xe6, 0x62, 0x85, 0xce, 0x4c, 0xf5, 0x7c, 0x1d, 0xfd, 0x0c, 0x00, 0x00, 0xff, + 0xff, 0xb9, 0x8b, 0x54, 0xcf, 0xd7, 0x04, 0x00, 0x00, +} + +func (m *PlacementRule) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PlacementRule) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PlacementRule) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.SfGroups) > 0 { + for iNdEx := len(m.SfGroups) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.SfGroups[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if m.ReplFactor != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.ReplFactor)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *PlacementRule_SFGroup) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PlacementRule_SFGroup) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PlacementRule_SFGroup) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Exclude) > 0 { + dAtA2 := make([]byte, len(m.Exclude)*10) + var j1 int + for _, num := range m.Exclude { + for num >= 1<<7 { + dAtA2[j1] = uint8(uint64(num)&0x7f | 0x80) + num >>= 7 + j1++ + } + dAtA2[j1] = uint8(num) + j1++ + } + i -= j1 + copy(dAtA[i:], dAtA2[:j1]) + i = encodeVarintTypes(dAtA, i, uint64(j1)) + i-- + dAtA[i] = 0x1a + } + if len(m.Selectors) > 0 { + for iNdEx := len(m.Selectors) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Selectors[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if len(m.Filters) > 0 { + for iNdEx := len(m.Filters) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Filters[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *PlacementRule_SFGroup_Filter) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PlacementRule_SFGroup_Filter) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PlacementRule_SFGroup_Filter) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.F != nil { + { + size, err := m.F.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.Key) > 0 { + i -= len(m.Key) + copy(dAtA[i:], m.Key) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Key))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *PlacementRule_SFGroup_Filter_SimpleFilters) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PlacementRule_SFGroup_Filter_SimpleFilters) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PlacementRule_SFGroup_Filter_SimpleFilters) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Filters) > 0 { + for iNdEx := len(m.Filters) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Filters[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *PlacementRule_SFGroup_Filter_SimpleFilter) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PlacementRule_SFGroup_Filter_SimpleFilter) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PlacementRule_SFGroup_Filter_SimpleFilter) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.Args != nil { + { + size := m.Args.Size() + i -= size + if _, err := m.Args.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + } + } + if m.Op != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Op)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *PlacementRule_SFGroup_Filter_SimpleFilter_Value) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PlacementRule_SFGroup_Filter_SimpleFilter_Value) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + i -= len(m.Value) + copy(dAtA[i:], m.Value) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Value))) + i-- + dAtA[i] = 0x12 + return len(dAtA) - i, nil +} +func (m *PlacementRule_SFGroup_Filter_SimpleFilter_FArgs) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PlacementRule_SFGroup_Filter_SimpleFilter_FArgs) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.FArgs != nil { + { + size, err := m.FArgs.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + return len(dAtA) - i, nil +} +func (m *PlacementRule_SFGroup_Selector) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PlacementRule_SFGroup_Selector) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PlacementRule_SFGroup_Selector) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Key) > 0 { + i -= len(m.Key) + copy(dAtA[i:], m.Key) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Key))) + i-- + dAtA[i] = 0x12 + } + if m.Count != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Count)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *NodeInfo) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *NodeInfo) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *NodeInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.State != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.State)) + i-- + dAtA[i] = 0x20 + } + if len(m.Attributes) > 0 { + for iNdEx := len(m.Attributes) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Attributes[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } + if len(m.PublicKey) > 0 { + i -= len(m.PublicKey) + copy(dAtA[i:], m.PublicKey) + i = encodeVarintTypes(dAtA, i, uint64(len(m.PublicKey))) + i-- + dAtA[i] = 0x12 + } + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *NodeInfo_Attribute) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *NodeInfo_Attribute) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *NodeInfo_Attribute) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Value) > 0 { + i -= len(m.Value) + copy(dAtA[i:], m.Value) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Value))) + i-- + dAtA[i] = 0x12 + } + if len(m.Key) > 0 { + i -= len(m.Key) + copy(dAtA[i:], m.Key) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Key))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintTypes(dAtA []byte, offset int, v uint64) int { + offset -= sovTypes(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *PlacementRule) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ReplFactor != 0 { + n += 1 + sovTypes(uint64(m.ReplFactor)) + } + if len(m.SfGroups) > 0 { + for _, e := range m.SfGroups { + l = e.Size() + n += 1 + l + sovTypes(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *PlacementRule_SFGroup) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Filters) > 0 { + for _, e := range m.Filters { + l = e.Size() + n += 1 + l + sovTypes(uint64(l)) + } + } + if len(m.Selectors) > 0 { + for _, e := range m.Selectors { + l = e.Size() + n += 1 + l + sovTypes(uint64(l)) + } + } + if len(m.Exclude) > 0 { + l = 0 + for _, e := range m.Exclude { + l += sovTypes(uint64(e)) + } + n += 1 + sovTypes(uint64(l)) + l + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *PlacementRule_SFGroup_Filter) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Key) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + if m.F != nil { + l = m.F.Size() + n += 1 + l + sovTypes(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *PlacementRule_SFGroup_Filter_SimpleFilters) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Filters) > 0 { + for _, e := range m.Filters { + l = e.Size() + n += 1 + l + sovTypes(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *PlacementRule_SFGroup_Filter_SimpleFilter) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Op != 0 { + n += 1 + sovTypes(uint64(m.Op)) + } + if m.Args != nil { + n += m.Args.Size() + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *PlacementRule_SFGroup_Filter_SimpleFilter_Value) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Value) + n += 1 + l + sovTypes(uint64(l)) + return n +} +func (m *PlacementRule_SFGroup_Filter_SimpleFilter_FArgs) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.FArgs != nil { + l = m.FArgs.Size() + n += 1 + l + sovTypes(uint64(l)) + } + return n +} +func (m *PlacementRule_SFGroup_Selector) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Count != 0 { + n += 1 + sovTypes(uint64(m.Count)) + } + l = len(m.Key) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *NodeInfo) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Address) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.PublicKey) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + if len(m.Attributes) > 0 { + for _, e := range m.Attributes { + l = e.Size() + n += 1 + l + sovTypes(uint64(l)) + } + } + if m.State != 0 { + n += 1 + sovTypes(uint64(m.State)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *NodeInfo_Attribute) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Key) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.Value) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovTypes(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozTypes(x uint64) (n int) { + return sovTypes(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *PlacementRule) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: PlacementRule: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PlacementRule: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ReplFactor", wireType) + } + m.ReplFactor = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ReplFactor |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SfGroups", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SfGroups = append(m.SfGroups, &PlacementRule_SFGroup{}) + if err := m.SfGroups[len(m.SfGroups)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *PlacementRule_SFGroup) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: SFGroup: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SFGroup: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Filters", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Filters = append(m.Filters, &PlacementRule_SFGroup_Filter{}) + if err := m.Filters[len(m.Filters)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Selectors", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Selectors = append(m.Selectors, &PlacementRule_SFGroup_Selector{}) + if err := m.Selectors[len(m.Selectors)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType == 0 { + var v uint32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Exclude = append(m.Exclude, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.Exclude) == 0 { + m.Exclude = make([]uint32, 0, elementCount) + } + for iNdEx < postIndex { + var v uint32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Exclude = append(m.Exclude, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field Exclude", wireType) + } + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *PlacementRule_SFGroup_Filter) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Filter: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Filter: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Key = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field F", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.F == nil { + m.F = &PlacementRule_SFGroup_Filter_SimpleFilter{} + } + if err := m.F.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *PlacementRule_SFGroup_Filter_SimpleFilters) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: SimpleFilters: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SimpleFilters: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Filters", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Filters = append(m.Filters, &PlacementRule_SFGroup_Filter_SimpleFilter{}) + if err := m.Filters[len(m.Filters)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *PlacementRule_SFGroup_Filter_SimpleFilter) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: SimpleFilter: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SimpleFilter: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Op", wireType) + } + m.Op = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Op |= PlacementRule_SFGroup_Filter_SimpleFilter_Operation(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Args = &PlacementRule_SFGroup_Filter_SimpleFilter_Value{string(dAtA[iNdEx:postIndex])} + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FArgs", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &PlacementRule_SFGroup_Filter_SimpleFilters{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Args = &PlacementRule_SFGroup_Filter_SimpleFilter_FArgs{v} + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *PlacementRule_SFGroup_Selector) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Selector: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Selector: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Count", wireType) + } + m.Count = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Count |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Key = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *NodeInfo) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: NodeInfo: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: NodeInfo: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PublicKey", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PublicKey = append(m.PublicKey[:0], dAtA[iNdEx:postIndex]...) + if m.PublicKey == nil { + m.PublicKey = []byte{} + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Attributes", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Attributes = append(m.Attributes, &NodeInfo_Attribute{}) + if err := m.Attributes[len(m.Attributes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field State", wireType) + } + m.State = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.State |= NodeInfo_State(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *NodeInfo_Attribute) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Attribute: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Attribute: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Key = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Value = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipTypes(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthTypes + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTypes + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthTypes + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthTypes = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTypes = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTypes = fmt.Errorf("proto: unexpected end of group") +) diff --git a/netmap/v2/types.proto b/netmap/v2/types.proto new file mode 100644 index 0000000..2d12ea5 --- /dev/null +++ b/netmap/v2/types.proto @@ -0,0 +1,92 @@ +syntax = "proto3"; + +package netmap.v2; + +option go_package = "github.com/nspcc-dev/neofs-api-go/netmap/v2"; +option csharp_namespace = "NeoFS.API.Netmap"; + +message PlacementRule { + uint32 repl_factor = 1; + + message SFGroup { + message Filter { + string key = 1; + + message SimpleFilters { + repeated SimpleFilter filters = 1; + } + + message SimpleFilter { + enum Operation { + NP = 0; + EQ = 1; + NE = 2; + GT = 3; + GE = 4; + LT = 5; + LE = 6; + OR = 7; + AND = 8; + } + + Operation op = 1; + + oneof args { + string value = 2; + SimpleFilters f_args = 3; + } + } + + SimpleFilter f = 2; + } + + repeated Filter filters = 1; + + message Selector { + uint32 count = 1; + string key = 2; + } + + repeated Selector selectors = 2; + + repeated uint32 exclude = 3; + } + + repeated SFGroup sf_groups = 2; +} + +// Groups the information about the NeoFS node. +message NodeInfo { + // Carries network address of the NeoFS node. + string address = 1; + + // Carries public key of the NeoFS node in a binary format. + bytes public_key = 2; + + // Groups attributes of the NeoFS node. + message Attribute { + // Carries string key to the node attribute. + string key = 1; + + // Carries string value of the node attribute. + string value = 2; + } + + // Carries list of the NeoFS node attributes in a string key-value format. + repeated Attribute attributes = 3; + + // Represents the enumeration of various states of the NeoFS node. + enum State { + // Undefined state. + UNKNOWN = 0; + + // Active state in the network. + ONLINE = 1; + + // Network unavailable state. + OFFLINE = 2; + } + + // Carries state of the NeoFS node. + State state = 4; +} \ No newline at end of file diff --git a/object/v2/service.pb.go b/object/v2/service.pb.go new file mode 100644 index 0000000..ce67752 --- /dev/null +++ b/object/v2/service.pb.go @@ -0,0 +1,10393 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: object/v2/service.proto + +package v2 + +import ( + context "context" + fmt "fmt" + proto "github.com/golang/protobuf/proto" + v21 "github.com/nspcc-dev/neofs-api-go/refs/v2" + v2 "github.com/nspcc-dev/neofs-api-go/service/v2" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package + +type SearchRequest_Body_Query_Filter_MatchType int32 + +const ( + SearchRequest_Body_Query_Filter_MATCH_UNKNOWN SearchRequest_Body_Query_Filter_MatchType = 0 + SearchRequest_Body_Query_Filter_STRING_EQUAL SearchRequest_Body_Query_Filter_MatchType = 1 +) + +var SearchRequest_Body_Query_Filter_MatchType_name = map[int32]string{ + 0: "MATCH_UNKNOWN", + 1: "STRING_EQUAL", +} + +var SearchRequest_Body_Query_Filter_MatchType_value = map[string]int32{ + "MATCH_UNKNOWN": 0, + "STRING_EQUAL": 1, +} + +func (x SearchRequest_Body_Query_Filter_MatchType) String() string { + return proto.EnumName(SearchRequest_Body_Query_Filter_MatchType_name, int32(x)) +} + +func (SearchRequest_Body_Query_Filter_MatchType) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_7c0929a7db2b025b, []int{8, 0, 0, 0, 0} +} + +type GetRequest struct { + // Body of get object request message. + Body *GetRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` + // Carries request meta information. Header data is used only to regulate message + // transport and does not affect request execution. + MetaHeader *v2.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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 *v2.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetRequest) Reset() { *m = GetRequest{} } +func (m *GetRequest) String() string { return proto.CompactTextString(m) } +func (*GetRequest) ProtoMessage() {} +func (*GetRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_7c0929a7db2b025b, []int{0} +} +func (m *GetRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GetRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GetRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *GetRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetRequest.Merge(m, src) +} +func (m *GetRequest) XXX_Size() int { + return m.Size() +} +func (m *GetRequest) XXX_DiscardUnknown() { + xxx_messageInfo_GetRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_GetRequest proto.InternalMessageInfo + +func (m *GetRequest) GetBody() *GetRequest_Body { + if m != nil { + return m.Body + } + return nil +} + +func (m *GetRequest) GetMetaHeader() *v2.RequestMetaHeader { + if m != nil { + return m.MetaHeader + } + return nil +} + +func (m *GetRequest) GetVerifyHeader() *v2.RequestVerificationHeader { + if m != nil { + return m.VerifyHeader + } + return nil +} + +type GetRequest_Body struct { + // Address of the requested object.v2. + Address *v21.Address `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + // Carries the raw option flag of the request. + // Raw request is sent to receive only the objects + // that are physically stored on the server. + Raw bool `protobuf:"varint,2,opt,name=raw,proto3" json:"raw,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetRequest_Body) Reset() { *m = GetRequest_Body{} } +func (m *GetRequest_Body) String() string { return proto.CompactTextString(m) } +func (*GetRequest_Body) ProtoMessage() {} +func (*GetRequest_Body) Descriptor() ([]byte, []int) { + return fileDescriptor_7c0929a7db2b025b, []int{0, 0} +} +func (m *GetRequest_Body) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GetRequest_Body) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GetRequest_Body.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *GetRequest_Body) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetRequest_Body.Merge(m, src) +} +func (m *GetRequest_Body) XXX_Size() int { + return m.Size() +} +func (m *GetRequest_Body) XXX_DiscardUnknown() { + xxx_messageInfo_GetRequest_Body.DiscardUnknown(m) +} + +var xxx_messageInfo_GetRequest_Body proto.InternalMessageInfo + +func (m *GetRequest_Body) GetAddress() *v21.Address { + if m != nil { + return m.Address + } + return nil +} + +func (m *GetRequest_Body) GetRaw() bool { + if m != nil { + return m.Raw + } + return false +} + +type GetResponse struct { + // Body of get object response message. + Body *GetResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` + // Carries response meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *v2.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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 *v2.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetResponse) Reset() { *m = GetResponse{} } +func (m *GetResponse) String() string { return proto.CompactTextString(m) } +func (*GetResponse) ProtoMessage() {} +func (*GetResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_7c0929a7db2b025b, []int{1} +} +func (m *GetResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GetResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GetResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *GetResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetResponse.Merge(m, src) +} +func (m *GetResponse) XXX_Size() int { + return m.Size() +} +func (m *GetResponse) XXX_DiscardUnknown() { + xxx_messageInfo_GetResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_GetResponse proto.InternalMessageInfo + +func (m *GetResponse) GetBody() *GetResponse_Body { + if m != nil { + return m.Body + } + return nil +} + +func (m *GetResponse) GetMetaHeader() *v2.ResponseMetaHeader { + if m != nil { + return m.MetaHeader + } + return nil +} + +func (m *GetResponse) GetVerifyHeader() *v2.ResponseVerificationHeader { + if m != nil { + return m.VerifyHeader + } + return nil +} + +type GetResponse_Body struct { + // Carries the single message of the response stream. + // + // Types that are valid to be assigned to ObjectPart: + // *GetResponse_Body_Init_ + // *GetResponse_Body_Chunk + ObjectPart isGetResponse_Body_ObjectPart `protobuf_oneof:"object_part"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetResponse_Body) Reset() { *m = GetResponse_Body{} } +func (m *GetResponse_Body) String() string { return proto.CompactTextString(m) } +func (*GetResponse_Body) ProtoMessage() {} +func (*GetResponse_Body) Descriptor() ([]byte, []int) { + return fileDescriptor_7c0929a7db2b025b, []int{1, 0} +} +func (m *GetResponse_Body) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GetResponse_Body) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GetResponse_Body.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *GetResponse_Body) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetResponse_Body.Merge(m, src) +} +func (m *GetResponse_Body) XXX_Size() int { + return m.Size() +} +func (m *GetResponse_Body) XXX_DiscardUnknown() { + xxx_messageInfo_GetResponse_Body.DiscardUnknown(m) +} + +var xxx_messageInfo_GetResponse_Body proto.InternalMessageInfo + +type isGetResponse_Body_ObjectPart interface { + isGetResponse_Body_ObjectPart() + MarshalTo([]byte) (int, error) + Size() int +} + +type GetResponse_Body_Init_ struct { + Init *GetResponse_Body_Init `protobuf:"bytes,1,opt,name=init,proto3,oneof" json:"init,omitempty"` +} +type GetResponse_Body_Chunk struct { + Chunk []byte `protobuf:"bytes,2,opt,name=chunk,proto3,oneof" json:"chunk,omitempty"` +} + +func (*GetResponse_Body_Init_) isGetResponse_Body_ObjectPart() {} +func (*GetResponse_Body_Chunk) isGetResponse_Body_ObjectPart() {} + +func (m *GetResponse_Body) GetObjectPart() isGetResponse_Body_ObjectPart { + if m != nil { + return m.ObjectPart + } + return nil +} + +func (m *GetResponse_Body) GetInit() *GetResponse_Body_Init { + if x, ok := m.GetObjectPart().(*GetResponse_Body_Init_); ok { + return x.Init + } + return nil +} + +func (m *GetResponse_Body) GetChunk() []byte { + if x, ok := m.GetObjectPart().(*GetResponse_Body_Chunk); ok { + return x.Chunk + } + return nil +} + +// XXX_OneofWrappers is for the internal use of the proto package. +func (*GetResponse_Body) XXX_OneofWrappers() []interface{} { + return []interface{}{ + (*GetResponse_Body_Init_)(nil), + (*GetResponse_Body_Chunk)(nil), + } +} + +// Initialization parameters of the object got from NeoFS. +type GetResponse_Body_Init struct { + // Object ID + ObjectId *v21.ObjectID `protobuf:"bytes,1,opt,name=object_id,json=objectId,proto3" json:"object_id,omitempty"` + // Object signature + Signature *v2.Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` + // Object header. + Header *Header `protobuf:"bytes,3,opt,name=header,proto3" json:"header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetResponse_Body_Init) Reset() { *m = GetResponse_Body_Init{} } +func (m *GetResponse_Body_Init) String() string { return proto.CompactTextString(m) } +func (*GetResponse_Body_Init) ProtoMessage() {} +func (*GetResponse_Body_Init) Descriptor() ([]byte, []int) { + return fileDescriptor_7c0929a7db2b025b, []int{1, 0, 0} +} +func (m *GetResponse_Body_Init) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GetResponse_Body_Init) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GetResponse_Body_Init.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *GetResponse_Body_Init) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetResponse_Body_Init.Merge(m, src) +} +func (m *GetResponse_Body_Init) XXX_Size() int { + return m.Size() +} +func (m *GetResponse_Body_Init) XXX_DiscardUnknown() { + xxx_messageInfo_GetResponse_Body_Init.DiscardUnknown(m) +} + +var xxx_messageInfo_GetResponse_Body_Init proto.InternalMessageInfo + +func (m *GetResponse_Body_Init) GetObjectId() *v21.ObjectID { + if m != nil { + return m.ObjectId + } + return nil +} + +func (m *GetResponse_Body_Init) GetSignature() *v2.Signature { + if m != nil { + return m.Signature + } + return nil +} + +func (m *GetResponse_Body_Init) GetHeader() *Header { + if m != nil { + return m.Header + } + return nil +} + +type PutRequest struct { + // Body of put object request message. + Body *PutRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` + // Carries request meta information. Header data is used only to regulate message + // transport and does not affect request execution. + MetaHeader *v2.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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 *v2.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *PutRequest) Reset() { *m = PutRequest{} } +func (m *PutRequest) String() string { return proto.CompactTextString(m) } +func (*PutRequest) ProtoMessage() {} +func (*PutRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_7c0929a7db2b025b, []int{2} +} +func (m *PutRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *PutRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_PutRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *PutRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_PutRequest.Merge(m, src) +} +func (m *PutRequest) XXX_Size() int { + return m.Size() +} +func (m *PutRequest) XXX_DiscardUnknown() { + xxx_messageInfo_PutRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_PutRequest proto.InternalMessageInfo + +func (m *PutRequest) GetBody() *PutRequest_Body { + if m != nil { + return m.Body + } + return nil +} + +func (m *PutRequest) GetMetaHeader() *v2.RequestMetaHeader { + if m != nil { + return m.MetaHeader + } + return nil +} + +func (m *PutRequest) GetVerifyHeader() *v2.RequestVerificationHeader { + if m != nil { + return m.VerifyHeader + } + return nil +} + +type PutRequest_Body struct { + // Carries the single part of the query stream. + // + // Types that are valid to be assigned to ObjectPart: + // *PutRequest_Body_Init_ + // *PutRequest_Body_Chunk + ObjectPart isPutRequest_Body_ObjectPart `protobuf_oneof:"object_part"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *PutRequest_Body) Reset() { *m = PutRequest_Body{} } +func (m *PutRequest_Body) String() string { return proto.CompactTextString(m) } +func (*PutRequest_Body) ProtoMessage() {} +func (*PutRequest_Body) Descriptor() ([]byte, []int) { + return fileDescriptor_7c0929a7db2b025b, []int{2, 0} +} +func (m *PutRequest_Body) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *PutRequest_Body) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_PutRequest_Body.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *PutRequest_Body) XXX_Merge(src proto.Message) { + xxx_messageInfo_PutRequest_Body.Merge(m, src) +} +func (m *PutRequest_Body) XXX_Size() int { + return m.Size() +} +func (m *PutRequest_Body) XXX_DiscardUnknown() { + xxx_messageInfo_PutRequest_Body.DiscardUnknown(m) +} + +var xxx_messageInfo_PutRequest_Body proto.InternalMessageInfo + +type isPutRequest_Body_ObjectPart interface { + isPutRequest_Body_ObjectPart() + MarshalTo([]byte) (int, error) + Size() int +} + +type PutRequest_Body_Init_ struct { + Init *PutRequest_Body_Init `protobuf:"bytes,1,opt,name=init,proto3,oneof" json:"init,omitempty"` +} +type PutRequest_Body_Chunk struct { + Chunk []byte `protobuf:"bytes,2,opt,name=chunk,proto3,oneof" json:"chunk,omitempty"` +} + +func (*PutRequest_Body_Init_) isPutRequest_Body_ObjectPart() {} +func (*PutRequest_Body_Chunk) isPutRequest_Body_ObjectPart() {} + +func (m *PutRequest_Body) GetObjectPart() isPutRequest_Body_ObjectPart { + if m != nil { + return m.ObjectPart + } + return nil +} + +func (m *PutRequest_Body) GetInit() *PutRequest_Body_Init { + if x, ok := m.GetObjectPart().(*PutRequest_Body_Init_); ok { + return x.Init + } + return nil +} + +func (m *PutRequest_Body) GetChunk() []byte { + if x, ok := m.GetObjectPart().(*PutRequest_Body_Chunk); ok { + return x.Chunk + } + return nil +} + +// XXX_OneofWrappers is for the internal use of the proto package. +func (*PutRequest_Body) XXX_OneofWrappers() []interface{} { + return []interface{}{ + (*PutRequest_Body_Init_)(nil), + (*PutRequest_Body_Chunk)(nil), + } +} + +// Groups initialization parameters of object placement in NeoFS. +type PutRequest_Body_Init struct { + // Object ID, where available + ObjectId *v21.ObjectID `protobuf:"bytes,1,opt,name=object_id,json=objectId,proto3" json:"object_id,omitempty"` + // Object signature, were available + Signature *v2.Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` + // Header of the object to save in the system. + Header *Header `protobuf:"bytes,3,opt,name=header,proto3" json:"header,omitempty"` + // Number of the object copies to store within the RPC call. + // Default zero value is processed according to the + // container placement rules. + CopiesNumber uint32 `protobuf:"varint,4,opt,name=copies_number,json=copiesNumber,proto3" json:"copies_number,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *PutRequest_Body_Init) Reset() { *m = PutRequest_Body_Init{} } +func (m *PutRequest_Body_Init) String() string { return proto.CompactTextString(m) } +func (*PutRequest_Body_Init) ProtoMessage() {} +func (*PutRequest_Body_Init) Descriptor() ([]byte, []int) { + return fileDescriptor_7c0929a7db2b025b, []int{2, 0, 0} +} +func (m *PutRequest_Body_Init) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *PutRequest_Body_Init) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_PutRequest_Body_Init.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *PutRequest_Body_Init) XXX_Merge(src proto.Message) { + xxx_messageInfo_PutRequest_Body_Init.Merge(m, src) +} +func (m *PutRequest_Body_Init) XXX_Size() int { + return m.Size() +} +func (m *PutRequest_Body_Init) XXX_DiscardUnknown() { + xxx_messageInfo_PutRequest_Body_Init.DiscardUnknown(m) +} + +var xxx_messageInfo_PutRequest_Body_Init proto.InternalMessageInfo + +func (m *PutRequest_Body_Init) GetObjectId() *v21.ObjectID { + if m != nil { + return m.ObjectId + } + return nil +} + +func (m *PutRequest_Body_Init) GetSignature() *v2.Signature { + if m != nil { + return m.Signature + } + return nil +} + +func (m *PutRequest_Body_Init) GetHeader() *Header { + if m != nil { + return m.Header + } + return nil +} + +func (m *PutRequest_Body_Init) GetCopiesNumber() uint32 { + if m != nil { + return m.CopiesNumber + } + return 0 +} + +type PutResponse struct { + // Body of put object response message. + Body *PutResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` + // Carries response meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *v2.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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 *v2.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *PutResponse) Reset() { *m = PutResponse{} } +func (m *PutResponse) String() string { return proto.CompactTextString(m) } +func (*PutResponse) ProtoMessage() {} +func (*PutResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_7c0929a7db2b025b, []int{3} +} +func (m *PutResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *PutResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_PutResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *PutResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_PutResponse.Merge(m, src) +} +func (m *PutResponse) XXX_Size() int { + return m.Size() +} +func (m *PutResponse) XXX_DiscardUnknown() { + xxx_messageInfo_PutResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_PutResponse proto.InternalMessageInfo + +func (m *PutResponse) GetBody() *PutResponse_Body { + if m != nil { + return m.Body + } + return nil +} + +func (m *PutResponse) GetMetaHeader() *v2.ResponseMetaHeader { + if m != nil { + return m.MetaHeader + } + return nil +} + +func (m *PutResponse) GetVerifyHeader() *v2.ResponseVerificationHeader { + if m != nil { + return m.VerifyHeader + } + return nil +} + +type PutResponse_Body struct { + // Carries identifier of the saved object.v2. + // It is used to access an object in the container.v2. + ObjectId *v21.ObjectID `protobuf:"bytes,1,opt,name=object_id,json=objectId,proto3" json:"object_id,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *PutResponse_Body) Reset() { *m = PutResponse_Body{} } +func (m *PutResponse_Body) String() string { return proto.CompactTextString(m) } +func (*PutResponse_Body) ProtoMessage() {} +func (*PutResponse_Body) Descriptor() ([]byte, []int) { + return fileDescriptor_7c0929a7db2b025b, []int{3, 0} +} +func (m *PutResponse_Body) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *PutResponse_Body) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_PutResponse_Body.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *PutResponse_Body) XXX_Merge(src proto.Message) { + xxx_messageInfo_PutResponse_Body.Merge(m, src) +} +func (m *PutResponse_Body) XXX_Size() int { + return m.Size() +} +func (m *PutResponse_Body) XXX_DiscardUnknown() { + xxx_messageInfo_PutResponse_Body.DiscardUnknown(m) +} + +var xxx_messageInfo_PutResponse_Body proto.InternalMessageInfo + +func (m *PutResponse_Body) GetObjectId() *v21.ObjectID { + if m != nil { + return m.ObjectId + } + return nil +} + +type DeleteRequest struct { + // Body of delete object request message. + Body *DeleteRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` + // Carries request meta information. Header data is used only to regulate message + // transport and does not affect request execution. + MetaHeader *v2.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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 *v2.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DeleteRequest) Reset() { *m = DeleteRequest{} } +func (m *DeleteRequest) String() string { return proto.CompactTextString(m) } +func (*DeleteRequest) ProtoMessage() {} +func (*DeleteRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_7c0929a7db2b025b, []int{4} +} +func (m *DeleteRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DeleteRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_DeleteRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *DeleteRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_DeleteRequest.Merge(m, src) +} +func (m *DeleteRequest) XXX_Size() int { + return m.Size() +} +func (m *DeleteRequest) XXX_DiscardUnknown() { + xxx_messageInfo_DeleteRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_DeleteRequest proto.InternalMessageInfo + +func (m *DeleteRequest) GetBody() *DeleteRequest_Body { + if m != nil { + return m.Body + } + return nil +} + +func (m *DeleteRequest) GetMetaHeader() *v2.RequestMetaHeader { + if m != nil { + return m.MetaHeader + } + return nil +} + +func (m *DeleteRequest) GetVerifyHeader() *v2.RequestVerificationHeader { + if m != nil { + return m.VerifyHeader + } + return nil +} + +type DeleteRequest_Body struct { + // Carries the address of the object to be deleted. + Address *v21.Address `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + // Carries identifier the object owner. + OwnerId *v21.OwnerID `protobuf:"bytes,2,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DeleteRequest_Body) Reset() { *m = DeleteRequest_Body{} } +func (m *DeleteRequest_Body) String() string { return proto.CompactTextString(m) } +func (*DeleteRequest_Body) ProtoMessage() {} +func (*DeleteRequest_Body) Descriptor() ([]byte, []int) { + return fileDescriptor_7c0929a7db2b025b, []int{4, 0} +} +func (m *DeleteRequest_Body) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DeleteRequest_Body) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_DeleteRequest_Body.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *DeleteRequest_Body) XXX_Merge(src proto.Message) { + xxx_messageInfo_DeleteRequest_Body.Merge(m, src) +} +func (m *DeleteRequest_Body) XXX_Size() int { + return m.Size() +} +func (m *DeleteRequest_Body) XXX_DiscardUnknown() { + xxx_messageInfo_DeleteRequest_Body.DiscardUnknown(m) +} + +var xxx_messageInfo_DeleteRequest_Body proto.InternalMessageInfo + +func (m *DeleteRequest_Body) GetAddress() *v21.Address { + if m != nil { + return m.Address + } + return nil +} + +func (m *DeleteRequest_Body) GetOwnerId() *v21.OwnerID { + if m != nil { + return m.OwnerId + } + return nil +} + +// DeleteResponse is empty because we cannot guarantee permanent object removal +// in distributed system. +type DeleteResponse struct { + // Body of delete object response message. + Body *DeleteResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` + // Carries response meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *v2.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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 *v2.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DeleteResponse) Reset() { *m = DeleteResponse{} } +func (m *DeleteResponse) String() string { return proto.CompactTextString(m) } +func (*DeleteResponse) ProtoMessage() {} +func (*DeleteResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_7c0929a7db2b025b, []int{5} +} +func (m *DeleteResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DeleteResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_DeleteResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *DeleteResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_DeleteResponse.Merge(m, src) +} +func (m *DeleteResponse) XXX_Size() int { + return m.Size() +} +func (m *DeleteResponse) XXX_DiscardUnknown() { + xxx_messageInfo_DeleteResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_DeleteResponse proto.InternalMessageInfo + +func (m *DeleteResponse) GetBody() *DeleteResponse_Body { + if m != nil { + return m.Body + } + return nil +} + +func (m *DeleteResponse) GetMetaHeader() *v2.ResponseMetaHeader { + if m != nil { + return m.MetaHeader + } + return nil +} + +func (m *DeleteResponse) GetVerifyHeader() *v2.ResponseVerificationHeader { + if m != nil { + return m.VerifyHeader + } + return nil +} + +type DeleteResponse_Body struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DeleteResponse_Body) Reset() { *m = DeleteResponse_Body{} } +func (m *DeleteResponse_Body) String() string { return proto.CompactTextString(m) } +func (*DeleteResponse_Body) ProtoMessage() {} +func (*DeleteResponse_Body) Descriptor() ([]byte, []int) { + return fileDescriptor_7c0929a7db2b025b, []int{5, 0} +} +func (m *DeleteResponse_Body) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DeleteResponse_Body) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_DeleteResponse_Body.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *DeleteResponse_Body) XXX_Merge(src proto.Message) { + xxx_messageInfo_DeleteResponse_Body.Merge(m, src) +} +func (m *DeleteResponse_Body) XXX_Size() int { + return m.Size() +} +func (m *DeleteResponse_Body) XXX_DiscardUnknown() { + xxx_messageInfo_DeleteResponse_Body.DiscardUnknown(m) +} + +var xxx_messageInfo_DeleteResponse_Body proto.InternalMessageInfo + +type HeadRequest struct { + // Body of head object request message. + Body *HeadRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` + // Carries request meta information. Header data is used only to regulate message + // transport and does not affect request execution. + MetaHeader *v2.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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 *v2.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *HeadRequest) Reset() { *m = HeadRequest{} } +func (m *HeadRequest) String() string { return proto.CompactTextString(m) } +func (*HeadRequest) ProtoMessage() {} +func (*HeadRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_7c0929a7db2b025b, []int{6} +} +func (m *HeadRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *HeadRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_HeadRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *HeadRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_HeadRequest.Merge(m, src) +} +func (m *HeadRequest) XXX_Size() int { + return m.Size() +} +func (m *HeadRequest) XXX_DiscardUnknown() { + xxx_messageInfo_HeadRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_HeadRequest proto.InternalMessageInfo + +func (m *HeadRequest) GetBody() *HeadRequest_Body { + if m != nil { + return m.Body + } + return nil +} + +func (m *HeadRequest) GetMetaHeader() *v2.RequestMetaHeader { + if m != nil { + return m.MetaHeader + } + return nil +} + +func (m *HeadRequest) GetVerifyHeader() *v2.RequestVerificationHeader { + if m != nil { + return m.VerifyHeader + } + return nil +} + +type HeadRequest_Body struct { + // Address of the object with the requested header. + Address *v21.Address `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + // Return only minimal header subset + MainOnly bool `protobuf:"varint,2,opt,name=main_only,json=mainOnly,proto3" json:"main_only,omitempty"` + // Carries the raw option flag of the request. + // Raw request is sent to receive only the headers of the objects + // that are physically stored on the server. + Raw bool `protobuf:"varint,3,opt,name=raw,proto3" json:"raw,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *HeadRequest_Body) Reset() { *m = HeadRequest_Body{} } +func (m *HeadRequest_Body) String() string { return proto.CompactTextString(m) } +func (*HeadRequest_Body) ProtoMessage() {} +func (*HeadRequest_Body) Descriptor() ([]byte, []int) { + return fileDescriptor_7c0929a7db2b025b, []int{6, 0} +} +func (m *HeadRequest_Body) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *HeadRequest_Body) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_HeadRequest_Body.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *HeadRequest_Body) XXX_Merge(src proto.Message) { + xxx_messageInfo_HeadRequest_Body.Merge(m, src) +} +func (m *HeadRequest_Body) XXX_Size() int { + return m.Size() +} +func (m *HeadRequest_Body) XXX_DiscardUnknown() { + xxx_messageInfo_HeadRequest_Body.DiscardUnknown(m) +} + +var xxx_messageInfo_HeadRequest_Body proto.InternalMessageInfo + +func (m *HeadRequest_Body) GetAddress() *v21.Address { + if m != nil { + return m.Address + } + return nil +} + +func (m *HeadRequest_Body) GetMainOnly() bool { + if m != nil { + return m.MainOnly + } + return false +} + +func (m *HeadRequest_Body) GetRaw() bool { + if m != nil { + return m.Raw + } + return false +} + +type HeadResponse struct { + // Body of head object response message. + Body *HeadResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` + // Carries response meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *v2.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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 *v2.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *HeadResponse) Reset() { *m = HeadResponse{} } +func (m *HeadResponse) String() string { return proto.CompactTextString(m) } +func (*HeadResponse) ProtoMessage() {} +func (*HeadResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_7c0929a7db2b025b, []int{7} +} +func (m *HeadResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *HeadResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_HeadResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *HeadResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_HeadResponse.Merge(m, src) +} +func (m *HeadResponse) XXX_Size() int { + return m.Size() +} +func (m *HeadResponse) XXX_DiscardUnknown() { + xxx_messageInfo_HeadResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_HeadResponse proto.InternalMessageInfo + +func (m *HeadResponse) GetBody() *HeadResponse_Body { + if m != nil { + return m.Body + } + return nil +} + +func (m *HeadResponse) GetMetaHeader() *v2.ResponseMetaHeader { + if m != nil { + return m.MetaHeader + } + return nil +} + +func (m *HeadResponse) GetVerifyHeader() *v2.ResponseVerificationHeader { + if m != nil { + return m.VerifyHeader + } + return nil +} + +type HeadResponse_Body struct { + // Carries the requested object header or it's part + // + // Types that are valid to be assigned to Head: + // *HeadResponse_Body_Header + // *HeadResponse_Body_ShortHeader_ + Head isHeadResponse_Body_Head `protobuf_oneof:"head"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *HeadResponse_Body) Reset() { *m = HeadResponse_Body{} } +func (m *HeadResponse_Body) String() string { return proto.CompactTextString(m) } +func (*HeadResponse_Body) ProtoMessage() {} +func (*HeadResponse_Body) Descriptor() ([]byte, []int) { + return fileDescriptor_7c0929a7db2b025b, []int{7, 0} +} +func (m *HeadResponse_Body) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *HeadResponse_Body) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_HeadResponse_Body.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *HeadResponse_Body) XXX_Merge(src proto.Message) { + xxx_messageInfo_HeadResponse_Body.Merge(m, src) +} +func (m *HeadResponse_Body) XXX_Size() int { + return m.Size() +} +func (m *HeadResponse_Body) XXX_DiscardUnknown() { + xxx_messageInfo_HeadResponse_Body.DiscardUnknown(m) +} + +var xxx_messageInfo_HeadResponse_Body proto.InternalMessageInfo + +type isHeadResponse_Body_Head interface { + isHeadResponse_Body_Head() + MarshalTo([]byte) (int, error) + Size() int +} + +type HeadResponse_Body_Header struct { + Header *Header `protobuf:"bytes,1,opt,name=header,proto3,oneof" json:"header,omitempty"` +} +type HeadResponse_Body_ShortHeader_ struct { + ShortHeader *HeadResponse_Body_ShortHeader `protobuf:"bytes,2,opt,name=short_header,json=shortHeader,proto3,oneof" json:"short_header,omitempty"` +} + +func (*HeadResponse_Body_Header) isHeadResponse_Body_Head() {} +func (*HeadResponse_Body_ShortHeader_) isHeadResponse_Body_Head() {} + +func (m *HeadResponse_Body) GetHead() isHeadResponse_Body_Head { + if m != nil { + return m.Head + } + return nil +} + +func (m *HeadResponse_Body) GetHeader() *Header { + if x, ok := m.GetHead().(*HeadResponse_Body_Header); ok { + return x.Header + } + return nil +} + +func (m *HeadResponse_Body) GetShortHeader() *HeadResponse_Body_ShortHeader { + if x, ok := m.GetHead().(*HeadResponse_Body_ShortHeader_); ok { + return x.ShortHeader + } + return nil +} + +// XXX_OneofWrappers is for the internal use of the proto package. +func (*HeadResponse_Body) XXX_OneofWrappers() []interface{} { + return []interface{}{ + (*HeadResponse_Body_Header)(nil), + (*HeadResponse_Body_ShortHeader_)(nil), + } +} + +type HeadResponse_Body_ShortHeader struct { + // Object format version. + Version *v2.Version `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` + // Epoch when the object was created + CreationEpoch uint64 `protobuf:"varint,2,opt,name=creation_epoch,json=creationEpoch,proto3" json:"creation_epoch,omitempty"` + // Object's owner + OwnerId *v21.OwnerID `protobuf:"bytes,3,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"` + // Type of the object payload content + ObjectType ObjectType `protobuf:"varint,4,opt,name=object_type,json=objectType,proto3,enum=object.v2.ObjectType" json:"object_type,omitempty"` + // Size of payload in bytes. + // 0xFFFFFFFFFFFFFFFF means `payload_length` is unknown + PayloadLength uint64 `protobuf:"varint,5,opt,name=payload_length,json=payloadLength,proto3" json:"payload_length,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *HeadResponse_Body_ShortHeader) Reset() { *m = HeadResponse_Body_ShortHeader{} } +func (m *HeadResponse_Body_ShortHeader) String() string { return proto.CompactTextString(m) } +func (*HeadResponse_Body_ShortHeader) ProtoMessage() {} +func (*HeadResponse_Body_ShortHeader) Descriptor() ([]byte, []int) { + return fileDescriptor_7c0929a7db2b025b, []int{7, 0, 0} +} +func (m *HeadResponse_Body_ShortHeader) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *HeadResponse_Body_ShortHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_HeadResponse_Body_ShortHeader.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *HeadResponse_Body_ShortHeader) XXX_Merge(src proto.Message) { + xxx_messageInfo_HeadResponse_Body_ShortHeader.Merge(m, src) +} +func (m *HeadResponse_Body_ShortHeader) XXX_Size() int { + return m.Size() +} +func (m *HeadResponse_Body_ShortHeader) XXX_DiscardUnknown() { + xxx_messageInfo_HeadResponse_Body_ShortHeader.DiscardUnknown(m) +} + +var xxx_messageInfo_HeadResponse_Body_ShortHeader proto.InternalMessageInfo + +func (m *HeadResponse_Body_ShortHeader) GetVersion() *v2.Version { + if m != nil { + return m.Version + } + return nil +} + +func (m *HeadResponse_Body_ShortHeader) GetCreationEpoch() uint64 { + if m != nil { + return m.CreationEpoch + } + return 0 +} + +func (m *HeadResponse_Body_ShortHeader) GetOwnerId() *v21.OwnerID { + if m != nil { + return m.OwnerId + } + return nil +} + +func (m *HeadResponse_Body_ShortHeader) GetObjectType() ObjectType { + if m != nil { + return m.ObjectType + } + return ObjectType_REGULAR +} + +func (m *HeadResponse_Body_ShortHeader) GetPayloadLength() uint64 { + if m != nil { + return m.PayloadLength + } + return 0 +} + +type SearchRequest struct { + // Body of search object request message. + Body *SearchRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` + // Carries request meta information. Header data is used only to regulate message + // transport and does not affect request execution. + MetaHeader *v2.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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 *v2.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SearchRequest) Reset() { *m = SearchRequest{} } +func (m *SearchRequest) String() string { return proto.CompactTextString(m) } +func (*SearchRequest) ProtoMessage() {} +func (*SearchRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_7c0929a7db2b025b, []int{8} +} +func (m *SearchRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *SearchRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_SearchRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *SearchRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_SearchRequest.Merge(m, src) +} +func (m *SearchRequest) XXX_Size() int { + return m.Size() +} +func (m *SearchRequest) XXX_DiscardUnknown() { + xxx_messageInfo_SearchRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_SearchRequest proto.InternalMessageInfo + +func (m *SearchRequest) GetBody() *SearchRequest_Body { + if m != nil { + return m.Body + } + return nil +} + +func (m *SearchRequest) GetMetaHeader() *v2.RequestMetaHeader { + if m != nil { + return m.MetaHeader + } + return nil +} + +func (m *SearchRequest) GetVerifyHeader() *v2.RequestVerificationHeader { + if m != nil { + return m.VerifyHeader + } + return nil +} + +type SearchRequest_Body struct { + // Carries search container identifier. + ContainerId *v21.ContainerID `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` + Query *SearchRequest_Body_Query `protobuf:"bytes,2,opt,name=query,proto3" json:"query,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SearchRequest_Body) Reset() { *m = SearchRequest_Body{} } +func (m *SearchRequest_Body) String() string { return proto.CompactTextString(m) } +func (*SearchRequest_Body) ProtoMessage() {} +func (*SearchRequest_Body) Descriptor() ([]byte, []int) { + return fileDescriptor_7c0929a7db2b025b, []int{8, 0} +} +func (m *SearchRequest_Body) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *SearchRequest_Body) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_SearchRequest_Body.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *SearchRequest_Body) XXX_Merge(src proto.Message) { + xxx_messageInfo_SearchRequest_Body.Merge(m, src) +} +func (m *SearchRequest_Body) XXX_Size() int { + return m.Size() +} +func (m *SearchRequest_Body) XXX_DiscardUnknown() { + xxx_messageInfo_SearchRequest_Body.DiscardUnknown(m) +} + +var xxx_messageInfo_SearchRequest_Body proto.InternalMessageInfo + +func (m *SearchRequest_Body) GetContainerId() *v21.ContainerID { + if m != nil { + return m.ContainerId + } + return nil +} + +func (m *SearchRequest_Body) GetQuery() *SearchRequest_Body_Query { + if m != nil { + return m.Query + } + return nil +} + +type SearchRequest_Body_Query struct { + Version uint32 `protobuf:"varint,1,opt,name=version,proto3" json:"version,omitempty"` + Filters []*SearchRequest_Body_Query_Filter `protobuf:"bytes,2,rep,name=filters,proto3" json:"filters,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SearchRequest_Body_Query) Reset() { *m = SearchRequest_Body_Query{} } +func (m *SearchRequest_Body_Query) String() string { return proto.CompactTextString(m) } +func (*SearchRequest_Body_Query) ProtoMessage() {} +func (*SearchRequest_Body_Query) Descriptor() ([]byte, []int) { + return fileDescriptor_7c0929a7db2b025b, []int{8, 0, 0} +} +func (m *SearchRequest_Body_Query) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *SearchRequest_Body_Query) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_SearchRequest_Body_Query.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *SearchRequest_Body_Query) XXX_Merge(src proto.Message) { + xxx_messageInfo_SearchRequest_Body_Query.Merge(m, src) +} +func (m *SearchRequest_Body_Query) XXX_Size() int { + return m.Size() +} +func (m *SearchRequest_Body_Query) XXX_DiscardUnknown() { + xxx_messageInfo_SearchRequest_Body_Query.DiscardUnknown(m) +} + +var xxx_messageInfo_SearchRequest_Body_Query proto.InternalMessageInfo + +func (m *SearchRequest_Body_Query) GetVersion() uint32 { + if m != nil { + return m.Version + } + return 0 +} + +func (m *SearchRequest_Body_Query) GetFilters() []*SearchRequest_Body_Query_Filter { + if m != nil { + return m.Filters + } + return nil +} + +type SearchRequest_Body_Query_Filter struct { + MatchType SearchRequest_Body_Query_Filter_MatchType `protobuf:"varint,1,opt,name=match_type,json=matchType,proto3,enum=object.v2.SearchRequest_Body_Query_Filter_MatchType" json:"match_type,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + Value string `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SearchRequest_Body_Query_Filter) Reset() { *m = SearchRequest_Body_Query_Filter{} } +func (m *SearchRequest_Body_Query_Filter) String() string { return proto.CompactTextString(m) } +func (*SearchRequest_Body_Query_Filter) ProtoMessage() {} +func (*SearchRequest_Body_Query_Filter) Descriptor() ([]byte, []int) { + return fileDescriptor_7c0929a7db2b025b, []int{8, 0, 0, 0} +} +func (m *SearchRequest_Body_Query_Filter) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *SearchRequest_Body_Query_Filter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_SearchRequest_Body_Query_Filter.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *SearchRequest_Body_Query_Filter) XXX_Merge(src proto.Message) { + xxx_messageInfo_SearchRequest_Body_Query_Filter.Merge(m, src) +} +func (m *SearchRequest_Body_Query_Filter) XXX_Size() int { + return m.Size() +} +func (m *SearchRequest_Body_Query_Filter) XXX_DiscardUnknown() { + xxx_messageInfo_SearchRequest_Body_Query_Filter.DiscardUnknown(m) +} + +var xxx_messageInfo_SearchRequest_Body_Query_Filter proto.InternalMessageInfo + +func (m *SearchRequest_Body_Query_Filter) GetMatchType() SearchRequest_Body_Query_Filter_MatchType { + if m != nil { + return m.MatchType + } + return SearchRequest_Body_Query_Filter_MATCH_UNKNOWN +} + +func (m *SearchRequest_Body_Query_Filter) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *SearchRequest_Body_Query_Filter) GetValue() string { + if m != nil { + return m.Value + } + return "" +} + +type SearchResponse struct { + // Body of search object response message. + Body *SearchResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` + // Carries response meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *v2.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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 *v2.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SearchResponse) Reset() { *m = SearchResponse{} } +func (m *SearchResponse) String() string { return proto.CompactTextString(m) } +func (*SearchResponse) ProtoMessage() {} +func (*SearchResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_7c0929a7db2b025b, []int{9} +} +func (m *SearchResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *SearchResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_SearchResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *SearchResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_SearchResponse.Merge(m, src) +} +func (m *SearchResponse) XXX_Size() int { + return m.Size() +} +func (m *SearchResponse) XXX_DiscardUnknown() { + xxx_messageInfo_SearchResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_SearchResponse proto.InternalMessageInfo + +func (m *SearchResponse) GetBody() *SearchResponse_Body { + if m != nil { + return m.Body + } + return nil +} + +func (m *SearchResponse) GetMetaHeader() *v2.ResponseMetaHeader { + if m != nil { + return m.MetaHeader + } + return nil +} + +func (m *SearchResponse) GetVerifyHeader() *v2.ResponseVerificationHeader { + if m != nil { + return m.VerifyHeader + } + return nil +} + +type SearchResponse_Body struct { + // Carries list of object identifiers that match the search query. + IdList []*v21.ObjectID `protobuf:"bytes,1,rep,name=id_list,json=idList,proto3" json:"id_list,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SearchResponse_Body) Reset() { *m = SearchResponse_Body{} } +func (m *SearchResponse_Body) String() string { return proto.CompactTextString(m) } +func (*SearchResponse_Body) ProtoMessage() {} +func (*SearchResponse_Body) Descriptor() ([]byte, []int) { + return fileDescriptor_7c0929a7db2b025b, []int{9, 0} +} +func (m *SearchResponse_Body) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *SearchResponse_Body) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_SearchResponse_Body.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *SearchResponse_Body) XXX_Merge(src proto.Message) { + xxx_messageInfo_SearchResponse_Body.Merge(m, src) +} +func (m *SearchResponse_Body) XXX_Size() int { + return m.Size() +} +func (m *SearchResponse_Body) XXX_DiscardUnknown() { + xxx_messageInfo_SearchResponse_Body.DiscardUnknown(m) +} + +var xxx_messageInfo_SearchResponse_Body proto.InternalMessageInfo + +func (m *SearchResponse_Body) GetIdList() []*v21.ObjectID { + if m != nil { + return m.IdList + } + return nil +} + +// Range groups the parameters of object payload range. +type Range struct { + // Carries the offset of the range from the object payload start. + Offset uint64 `protobuf:"varint,1,opt,name=offset,proto3" json:"offset,omitempty"` + // Carries the length of the object payload range. + Length uint64 `protobuf:"varint,2,opt,name=length,proto3" json:"length,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Range) Reset() { *m = Range{} } +func (m *Range) String() string { return proto.CompactTextString(m) } +func (*Range) ProtoMessage() {} +func (*Range) Descriptor() ([]byte, []int) { + return fileDescriptor_7c0929a7db2b025b, []int{10} +} +func (m *Range) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Range) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Range.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Range) XXX_Merge(src proto.Message) { + xxx_messageInfo_Range.Merge(m, src) +} +func (m *Range) XXX_Size() int { + return m.Size() +} +func (m *Range) XXX_DiscardUnknown() { + xxx_messageInfo_Range.DiscardUnknown(m) +} + +var xxx_messageInfo_Range proto.InternalMessageInfo + +func (m *Range) GetOffset() uint64 { + if m != nil { + return m.Offset + } + return 0 +} + +func (m *Range) GetLength() uint64 { + if m != nil { + return m.Length + } + return 0 +} + +type GetRangeRequest struct { + // Body of get range object request message. + Body *GetRangeRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` + // Carries request meta information. Header data is used only to regulate message + // transport and does not affect request execution. + MetaHeader *v2.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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 *v2.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetRangeRequest) Reset() { *m = GetRangeRequest{} } +func (m *GetRangeRequest) String() string { return proto.CompactTextString(m) } +func (*GetRangeRequest) ProtoMessage() {} +func (*GetRangeRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_7c0929a7db2b025b, []int{11} +} +func (m *GetRangeRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GetRangeRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GetRangeRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *GetRangeRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetRangeRequest.Merge(m, src) +} +func (m *GetRangeRequest) XXX_Size() int { + return m.Size() +} +func (m *GetRangeRequest) XXX_DiscardUnknown() { + xxx_messageInfo_GetRangeRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_GetRangeRequest proto.InternalMessageInfo + +func (m *GetRangeRequest) GetBody() *GetRangeRequest_Body { + if m != nil { + return m.Body + } + return nil +} + +func (m *GetRangeRequest) GetMetaHeader() *v2.RequestMetaHeader { + if m != nil { + return m.MetaHeader + } + return nil +} + +func (m *GetRangeRequest) GetVerifyHeader() *v2.RequestVerificationHeader { + if m != nil { + return m.VerifyHeader + } + return nil +} + +type GetRangeRequest_Body struct { + // Address carries address of the object that contains the requested payload range. + Address *v21.Address `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + // Range carries the parameters of the requested payload range. + Range *Range `protobuf:"bytes,2,opt,name=range,proto3" json:"range,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetRangeRequest_Body) Reset() { *m = GetRangeRequest_Body{} } +func (m *GetRangeRequest_Body) String() string { return proto.CompactTextString(m) } +func (*GetRangeRequest_Body) ProtoMessage() {} +func (*GetRangeRequest_Body) Descriptor() ([]byte, []int) { + return fileDescriptor_7c0929a7db2b025b, []int{11, 0} +} +func (m *GetRangeRequest_Body) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GetRangeRequest_Body) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GetRangeRequest_Body.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *GetRangeRequest_Body) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetRangeRequest_Body.Merge(m, src) +} +func (m *GetRangeRequest_Body) XXX_Size() int { + return m.Size() +} +func (m *GetRangeRequest_Body) XXX_DiscardUnknown() { + xxx_messageInfo_GetRangeRequest_Body.DiscardUnknown(m) +} + +var xxx_messageInfo_GetRangeRequest_Body proto.InternalMessageInfo + +func (m *GetRangeRequest_Body) GetAddress() *v21.Address { + if m != nil { + return m.Address + } + return nil +} + +func (m *GetRangeRequest_Body) GetRange() *Range { + if m != nil { + return m.Range + } + return nil +} + +type GetRangeResponse struct { + // Body of get range object response message. + Body *GetRangeResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` + // Carries response meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *v2.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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 *v2.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetRangeResponse) Reset() { *m = GetRangeResponse{} } +func (m *GetRangeResponse) String() string { return proto.CompactTextString(m) } +func (*GetRangeResponse) ProtoMessage() {} +func (*GetRangeResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_7c0929a7db2b025b, []int{12} +} +func (m *GetRangeResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GetRangeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GetRangeResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *GetRangeResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetRangeResponse.Merge(m, src) +} +func (m *GetRangeResponse) XXX_Size() int { + return m.Size() +} +func (m *GetRangeResponse) XXX_DiscardUnknown() { + xxx_messageInfo_GetRangeResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_GetRangeResponse proto.InternalMessageInfo + +func (m *GetRangeResponse) GetBody() *GetRangeResponse_Body { + if m != nil { + return m.Body + } + return nil +} + +func (m *GetRangeResponse) GetMetaHeader() *v2.ResponseMetaHeader { + if m != nil { + return m.MetaHeader + } + return nil +} + +func (m *GetRangeResponse) GetVerifyHeader() *v2.ResponseVerificationHeader { + if m != nil { + return m.VerifyHeader + } + return nil +} + +type GetRangeResponse_Body struct { + // Carries part of the object payload. + Chunk []byte `protobuf:"bytes,1,opt,name=chunk,proto3" json:"chunk,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetRangeResponse_Body) Reset() { *m = GetRangeResponse_Body{} } +func (m *GetRangeResponse_Body) String() string { return proto.CompactTextString(m) } +func (*GetRangeResponse_Body) ProtoMessage() {} +func (*GetRangeResponse_Body) Descriptor() ([]byte, []int) { + return fileDescriptor_7c0929a7db2b025b, []int{12, 0} +} +func (m *GetRangeResponse_Body) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GetRangeResponse_Body) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GetRangeResponse_Body.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *GetRangeResponse_Body) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetRangeResponse_Body.Merge(m, src) +} +func (m *GetRangeResponse_Body) XXX_Size() int { + return m.Size() +} +func (m *GetRangeResponse_Body) XXX_DiscardUnknown() { + xxx_messageInfo_GetRangeResponse_Body.DiscardUnknown(m) +} + +var xxx_messageInfo_GetRangeResponse_Body proto.InternalMessageInfo + +func (m *GetRangeResponse_Body) GetChunk() []byte { + if m != nil { + return m.Chunk + } + return nil +} + +type GetRangeHashRequest struct { + // Body of get range hash object request message. + Body *GetRangeHashRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` + // Carries request meta information. Header data is used only to regulate message + // transport and does not affect request execution. + MetaHeader *v2.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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 *v2.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetRangeHashRequest) Reset() { *m = GetRangeHashRequest{} } +func (m *GetRangeHashRequest) String() string { return proto.CompactTextString(m) } +func (*GetRangeHashRequest) ProtoMessage() {} +func (*GetRangeHashRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_7c0929a7db2b025b, []int{13} +} +func (m *GetRangeHashRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GetRangeHashRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GetRangeHashRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *GetRangeHashRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetRangeHashRequest.Merge(m, src) +} +func (m *GetRangeHashRequest) XXX_Size() int { + return m.Size() +} +func (m *GetRangeHashRequest) XXX_DiscardUnknown() { + xxx_messageInfo_GetRangeHashRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_GetRangeHashRequest proto.InternalMessageInfo + +func (m *GetRangeHashRequest) GetBody() *GetRangeHashRequest_Body { + if m != nil { + return m.Body + } + return nil +} + +func (m *GetRangeHashRequest) GetMetaHeader() *v2.RequestMetaHeader { + if m != nil { + return m.MetaHeader + } + return nil +} + +func (m *GetRangeHashRequest) GetVerifyHeader() *v2.RequestVerificationHeader { + if m != nil { + return m.VerifyHeader + } + return nil +} + +type GetRangeHashRequest_Body struct { + // Carries address of the object that contains the requested payload range. + Address *v21.Address `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + // Carries the list of object payload range to calculate homomorphic hash. + Ranges []*Range `protobuf:"bytes,2,rep,name=ranges,proto3" json:"ranges,omitempty"` + // Carries binary salt to XOR object payload ranges before hash calculation. + Salt []byte `protobuf:"bytes,3,opt,name=salt,proto3" json:"salt,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetRangeHashRequest_Body) Reset() { *m = GetRangeHashRequest_Body{} } +func (m *GetRangeHashRequest_Body) String() string { return proto.CompactTextString(m) } +func (*GetRangeHashRequest_Body) ProtoMessage() {} +func (*GetRangeHashRequest_Body) Descriptor() ([]byte, []int) { + return fileDescriptor_7c0929a7db2b025b, []int{13, 0} +} +func (m *GetRangeHashRequest_Body) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GetRangeHashRequest_Body) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GetRangeHashRequest_Body.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *GetRangeHashRequest_Body) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetRangeHashRequest_Body.Merge(m, src) +} +func (m *GetRangeHashRequest_Body) XXX_Size() int { + return m.Size() +} +func (m *GetRangeHashRequest_Body) XXX_DiscardUnknown() { + xxx_messageInfo_GetRangeHashRequest_Body.DiscardUnknown(m) +} + +var xxx_messageInfo_GetRangeHashRequest_Body proto.InternalMessageInfo + +func (m *GetRangeHashRequest_Body) GetAddress() *v21.Address { + if m != nil { + return m.Address + } + return nil +} + +func (m *GetRangeHashRequest_Body) GetRanges() []*Range { + if m != nil { + return m.Ranges + } + return nil +} + +func (m *GetRangeHashRequest_Body) GetSalt() []byte { + if m != nil { + return m.Salt + } + return nil +} + +type GetRangeHashResponse struct { + // Body of get range hash object response message. + Body *GetRangeHashResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` + // Carries response meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *v2.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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 *v2.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetRangeHashResponse) Reset() { *m = GetRangeHashResponse{} } +func (m *GetRangeHashResponse) String() string { return proto.CompactTextString(m) } +func (*GetRangeHashResponse) ProtoMessage() {} +func (*GetRangeHashResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_7c0929a7db2b025b, []int{14} +} +func (m *GetRangeHashResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GetRangeHashResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GetRangeHashResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *GetRangeHashResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetRangeHashResponse.Merge(m, src) +} +func (m *GetRangeHashResponse) XXX_Size() int { + return m.Size() +} +func (m *GetRangeHashResponse) XXX_DiscardUnknown() { + xxx_messageInfo_GetRangeHashResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_GetRangeHashResponse proto.InternalMessageInfo + +func (m *GetRangeHashResponse) GetBody() *GetRangeHashResponse_Body { + if m != nil { + return m.Body + } + return nil +} + +func (m *GetRangeHashResponse) GetMetaHeader() *v2.ResponseMetaHeader { + if m != nil { + return m.MetaHeader + } + return nil +} + +func (m *GetRangeHashResponse) GetVerifyHeader() *v2.ResponseVerificationHeader { + if m != nil { + return m.VerifyHeader + } + return nil +} + +type GetRangeHashResponse_Body struct { + // Carries list of homomorphic hashes in a binary format. + HashList [][]byte `protobuf:"bytes,1,rep,name=hash_list,json=hashList,proto3" json:"hash_list,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetRangeHashResponse_Body) Reset() { *m = GetRangeHashResponse_Body{} } +func (m *GetRangeHashResponse_Body) String() string { return proto.CompactTextString(m) } +func (*GetRangeHashResponse_Body) ProtoMessage() {} +func (*GetRangeHashResponse_Body) Descriptor() ([]byte, []int) { + return fileDescriptor_7c0929a7db2b025b, []int{14, 0} +} +func (m *GetRangeHashResponse_Body) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GetRangeHashResponse_Body) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GetRangeHashResponse_Body.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *GetRangeHashResponse_Body) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetRangeHashResponse_Body.Merge(m, src) +} +func (m *GetRangeHashResponse_Body) XXX_Size() int { + return m.Size() +} +func (m *GetRangeHashResponse_Body) XXX_DiscardUnknown() { + xxx_messageInfo_GetRangeHashResponse_Body.DiscardUnknown(m) +} + +var xxx_messageInfo_GetRangeHashResponse_Body proto.InternalMessageInfo + +func (m *GetRangeHashResponse_Body) GetHashList() [][]byte { + if m != nil { + return m.HashList + } + return nil +} + +func init() { + proto.RegisterEnum("object.v2.SearchRequest_Body_Query_Filter_MatchType", SearchRequest_Body_Query_Filter_MatchType_name, SearchRequest_Body_Query_Filter_MatchType_value) + proto.RegisterType((*GetRequest)(nil), "object.v2.GetRequest") + proto.RegisterType((*GetRequest_Body)(nil), "object.v2.GetRequest.Body") + proto.RegisterType((*GetResponse)(nil), "object.v2.GetResponse") + proto.RegisterType((*GetResponse_Body)(nil), "object.v2.GetResponse.Body") + proto.RegisterType((*GetResponse_Body_Init)(nil), "object.v2.GetResponse.Body.Init") + proto.RegisterType((*PutRequest)(nil), "object.v2.PutRequest") + proto.RegisterType((*PutRequest_Body)(nil), "object.v2.PutRequest.Body") + proto.RegisterType((*PutRequest_Body_Init)(nil), "object.v2.PutRequest.Body.Init") + proto.RegisterType((*PutResponse)(nil), "object.v2.PutResponse") + proto.RegisterType((*PutResponse_Body)(nil), "object.v2.PutResponse.Body") + proto.RegisterType((*DeleteRequest)(nil), "object.v2.DeleteRequest") + proto.RegisterType((*DeleteRequest_Body)(nil), "object.v2.DeleteRequest.Body") + proto.RegisterType((*DeleteResponse)(nil), "object.v2.DeleteResponse") + proto.RegisterType((*DeleteResponse_Body)(nil), "object.v2.DeleteResponse.Body") + proto.RegisterType((*HeadRequest)(nil), "object.v2.HeadRequest") + proto.RegisterType((*HeadRequest_Body)(nil), "object.v2.HeadRequest.Body") + proto.RegisterType((*HeadResponse)(nil), "object.v2.HeadResponse") + proto.RegisterType((*HeadResponse_Body)(nil), "object.v2.HeadResponse.Body") + proto.RegisterType((*HeadResponse_Body_ShortHeader)(nil), "object.v2.HeadResponse.Body.ShortHeader") + proto.RegisterType((*SearchRequest)(nil), "object.v2.SearchRequest") + proto.RegisterType((*SearchRequest_Body)(nil), "object.v2.SearchRequest.Body") + proto.RegisterType((*SearchRequest_Body_Query)(nil), "object.v2.SearchRequest.Body.Query") + proto.RegisterType((*SearchRequest_Body_Query_Filter)(nil), "object.v2.SearchRequest.Body.Query.Filter") + proto.RegisterType((*SearchResponse)(nil), "object.v2.SearchResponse") + proto.RegisterType((*SearchResponse_Body)(nil), "object.v2.SearchResponse.Body") + proto.RegisterType((*Range)(nil), "object.v2.Range") + proto.RegisterType((*GetRangeRequest)(nil), "object.v2.GetRangeRequest") + proto.RegisterType((*GetRangeRequest_Body)(nil), "object.v2.GetRangeRequest.Body") + proto.RegisterType((*GetRangeResponse)(nil), "object.v2.GetRangeResponse") + proto.RegisterType((*GetRangeResponse_Body)(nil), "object.v2.GetRangeResponse.Body") + proto.RegisterType((*GetRangeHashRequest)(nil), "object.v2.GetRangeHashRequest") + proto.RegisterType((*GetRangeHashRequest_Body)(nil), "object.v2.GetRangeHashRequest.Body") + proto.RegisterType((*GetRangeHashResponse)(nil), "object.v2.GetRangeHashResponse") + proto.RegisterType((*GetRangeHashResponse_Body)(nil), "object.v2.GetRangeHashResponse.Body") +} + +func init() { proto.RegisterFile("object/v2/service.proto", fileDescriptor_7c0929a7db2b025b) } + +var fileDescriptor_7c0929a7db2b025b = []byte{ + // 1387 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x58, 0xcd, 0x6f, 0x1b, 0xc5, + 0x1b, 0xce, 0xae, 0x3f, 0x12, 0xbf, 0xb6, 0xf3, 0x73, 0xa7, 0x49, 0xea, 0xdf, 0xa6, 0x75, 0xa3, + 0x0d, 0xad, 0x42, 0xab, 0x6c, 0x82, 0x5b, 0x52, 0x38, 0x40, 0x95, 0x34, 0x6d, 0x63, 0xda, 0x7c, + 0x74, 0xdd, 0x16, 0xa9, 0x17, 0x6b, 0xb3, 0x3b, 0x89, 0x17, 0xec, 0x5d, 0x77, 0x77, 0xed, 0xca, + 0x67, 0x10, 0x47, 0x8e, 0x88, 0x23, 0x82, 0x1b, 0x12, 0x70, 0x46, 0xfc, 0x03, 0x08, 0x81, 0xc4, + 0x99, 0x13, 0x0a, 0x67, 0x84, 0x90, 0x38, 0x22, 0x84, 0xe6, 0x63, 0xd7, 0x3b, 0xa9, 0x1d, 0x87, + 0x9c, 0xf6, 0xb6, 0xfb, 0xce, 0xf3, 0xce, 0xce, 0xf3, 0xcc, 0x33, 0xef, 0xcc, 0x2c, 0x5c, 0x70, + 0xf7, 0xdf, 0xc3, 0x66, 0xb0, 0xd2, 0xab, 0xae, 0xf8, 0xd8, 0xeb, 0xd9, 0x26, 0xd6, 0x3a, 0x9e, + 0x1b, 0xb8, 0x28, 0xc7, 0x1a, 0xb4, 0x5e, 0x55, 0x99, 0x1d, 0x60, 0x82, 0x7e, 0x07, 0xfb, 0x0c, + 0xa1, 0x9c, 0xf7, 0xf0, 0x81, 0x7f, 0x3c, 0x38, 0xcb, 0x7b, 0x21, 0xf1, 0x36, 0x0e, 0x0c, 0x1e, + 0xbe, 0x10, 0x0b, 0xf7, 0xb0, 0x67, 0x1f, 0xf4, 0x59, 0x83, 0xfa, 0xb1, 0x0c, 0x70, 0x1f, 0x07, + 0x3a, 0x7e, 0xde, 0xc5, 0x7e, 0x80, 0x34, 0x48, 0xef, 0xbb, 0x56, 0xbf, 0x2c, 0x2d, 0x48, 0x4b, + 0xf9, 0xaa, 0xa2, 0x45, 0x83, 0xd0, 0x06, 0x20, 0x6d, 0xc3, 0xb5, 0xfa, 0x3a, 0xc5, 0xa1, 0xb7, + 0x21, 0x4f, 0xbe, 0xd2, 0x68, 0x62, 0xc3, 0xc2, 0x5e, 0x59, 0xa6, 0x69, 0x97, 0xb4, 0x90, 0x4a, + 0xaf, 0xaa, 0xf1, 0xa4, 0x6d, 0x1c, 0x18, 0x5b, 0x14, 0xa4, 0x43, 0x3b, 0x7a, 0x46, 0xef, 0x40, + 0x91, 0x0d, 0x27, 0xec, 0x21, 0x45, 0x7b, 0xb8, 0x32, 0xa4, 0x87, 0xa7, 0x04, 0x67, 0x9b, 0x46, + 0x60, 0xbb, 0x0e, 0xef, 0xa9, 0xc0, 0x72, 0xd9, 0x9b, 0xb2, 0x09, 0x69, 0x32, 0x32, 0x74, 0x0d, + 0x26, 0x0d, 0xcb, 0xf2, 0xb0, 0xef, 0x73, 0x1a, 0x25, 0x8d, 0x28, 0x45, 0xba, 0x5a, 0x67, 0x71, + 0x3d, 0x04, 0xa0, 0x12, 0xa4, 0x3c, 0xe3, 0x05, 0x1d, 0xf7, 0x94, 0x4e, 0x1e, 0xd5, 0x9f, 0x52, + 0x90, 0xa7, 0x5c, 0xfd, 0x8e, 0xeb, 0xf8, 0x18, 0xad, 0x08, 0x8a, 0xcc, 0x1f, 0x57, 0x84, 0xa1, + 0xe2, 0x92, 0xdc, 0x1e, 0x26, 0x49, 0x45, 0x24, 0xc4, 0xb2, 0x46, 0x68, 0xf2, 0x60, 0xb8, 0x26, + 0x57, 0x87, 0x75, 0x31, 0x56, 0x94, 0x7f, 0x24, 0xae, 0xca, 0x1a, 0xa4, 0x6d, 0xc7, 0x0e, 0x38, + 0x8f, 0x85, 0x13, 0x78, 0x68, 0x35, 0xc7, 0x0e, 0xb6, 0x26, 0x74, 0x8a, 0x47, 0x73, 0x90, 0x31, + 0x9b, 0x5d, 0xe7, 0x7d, 0x4a, 0xa4, 0xb0, 0x35, 0xa1, 0xb3, 0x57, 0xe5, 0x13, 0x09, 0xd2, 0x04, + 0x88, 0x34, 0xe0, 0x56, 0x6d, 0xd8, 0x16, 0xef, 0xfd, 0x5c, 0x24, 0xf8, 0x2e, 0x6d, 0xa9, 0x6d, + 0xea, 0x53, 0x0c, 0x53, 0xb3, 0xd0, 0x0d, 0xc8, 0xf9, 0xf6, 0xa1, 0x63, 0x04, 0x5d, 0x0f, 0x73, + 0x75, 0x66, 0xe3, 0xd4, 0xea, 0x61, 0xa3, 0x3e, 0xc0, 0xa1, 0x57, 0x21, 0x2b, 0x88, 0x71, 0x2e, + 0x36, 0x7e, 0xce, 0x9b, 0x03, 0x36, 0x8a, 0x90, 0xe7, 0xe3, 0xe9, 0x18, 0x5e, 0xa0, 0xfe, 0x9e, + 0x02, 0xd8, 0xeb, 0x9e, 0xc2, 0xe0, 0x03, 0x50, 0x52, 0x0d, 0xfe, 0xb9, 0xcc, 0xe7, 0xf2, 0x75, + 0x61, 0x2e, 0x2f, 0x8f, 0x26, 0x71, 0xba, 0xa9, 0xfc, 0x2e, 0xa1, 0x53, 0x89, 0x16, 0xa1, 0x68, + 0xba, 0x1d, 0x1b, 0xfb, 0x0d, 0xa7, 0xdb, 0xde, 0xc7, 0x5e, 0x39, 0xbd, 0x20, 0x2d, 0x15, 0xf5, + 0x02, 0x0b, 0xee, 0xd0, 0xd8, 0xf1, 0xf9, 0xfe, 0x50, 0x86, 0x3c, 0x55, 0x61, 0xec, 0xfa, 0x8d, + 0xa1, 0x92, 0xbb, 0x7e, 0xd7, 0xf8, 0x94, 0xff, 0xc7, 0xa9, 0x51, 0xbf, 0x91, 0xa1, 0xb8, 0x89, + 0x5b, 0x38, 0xc0, 0xa1, 0xf3, 0x5f, 0x13, 0x84, 0xb8, 0x14, 0x13, 0x42, 0xc0, 0x25, 0xd5, 0xfc, + 0x8d, 0x33, 0x54, 0xf7, 0xeb, 0x30, 0xe5, 0xbe, 0x70, 0xb0, 0x47, 0x34, 0x93, 0x8f, 0x81, 0x77, + 0x49, 0x43, 0x6d, 0x53, 0x9f, 0xa4, 0x88, 0x9a, 0xa5, 0xfe, 0x22, 0xc1, 0x74, 0xa8, 0x04, 0xf7, + 0x4e, 0x55, 0x90, 0xac, 0x32, 0x44, 0xb2, 0xa4, 0xdb, 0x27, 0xcb, 0x54, 0x53, 0xbf, 0x92, 0x21, + 0x4f, 0x42, 0xa1, 0x19, 0x46, 0xaf, 0x8a, 0x18, 0x2a, 0xa9, 0x56, 0x30, 0xce, 0x60, 0x85, 0x79, + 0xc8, 0xb5, 0x0d, 0xdb, 0x69, 0xb8, 0x4e, 0xab, 0xcf, 0xb7, 0xfb, 0x29, 0x12, 0xd8, 0x75, 0x5a, + 0xfd, 0xf0, 0x14, 0x90, 0x8a, 0x9d, 0x02, 0xd2, 0x50, 0x60, 0x4a, 0x70, 0x2b, 0xac, 0x0a, 0x82, + 0x5d, 0x7c, 0x49, 0xb0, 0xa4, 0x1b, 0xe1, 0xef, 0x70, 0xef, 0xb8, 0x1e, 0x95, 0x5f, 0x69, 0x44, + 0xf9, 0xdd, 0x9a, 0x88, 0x0a, 0xf0, 0x36, 0x14, 0xfc, 0xa6, 0xeb, 0x05, 0x22, 0x89, 0xa5, 0x93, + 0xd8, 0x6b, 0x75, 0x92, 0x10, 0xf5, 0x94, 0xf7, 0x07, 0xaf, 0xca, 0x1f, 0x12, 0xe4, 0x63, 0xcd, + 0x68, 0x19, 0x26, 0x7b, 0xd8, 0xf3, 0x6d, 0xd7, 0xe1, 0x83, 0x39, 0x1f, 0xe7, 0xf6, 0x94, 0x35, + 0xe9, 0x21, 0x06, 0x5d, 0x81, 0x69, 0xd3, 0xc3, 0x94, 0x63, 0x03, 0x77, 0x5c, 0xb3, 0x49, 0xc7, + 0x93, 0xd6, 0x8b, 0x61, 0xf4, 0x2e, 0x09, 0x0a, 0xab, 0x3e, 0x35, 0x66, 0xd5, 0xa3, 0xb5, 0x68, + 0xf7, 0x20, 0xa7, 0x68, 0xba, 0xc1, 0x4c, 0x57, 0x67, 0x63, 0x04, 0x59, 0x6d, 0x7d, 0xdc, 0xef, + 0x60, 0x1d, 0xdc, 0xe8, 0x99, 0x8c, 0xa5, 0x63, 0xf4, 0x5b, 0xae, 0x61, 0x35, 0x5a, 0xd8, 0x39, + 0x0c, 0x9a, 0xe5, 0x0c, 0x1b, 0x0b, 0x8f, 0x3e, 0xa4, 0xc1, 0x8d, 0x2c, 0xa4, 0x89, 0x74, 0xea, + 0x9f, 0x69, 0x28, 0xd6, 0xb1, 0xe1, 0x99, 0xcd, 0xf1, 0xe5, 0x58, 0xc0, 0x25, 0x75, 0x0d, 0x7e, + 0x96, 0xe2, 0x7e, 0xba, 0x05, 0x05, 0xd3, 0x75, 0x02, 0xc3, 0xe6, 0x8a, 0x33, 0x3e, 0x33, 0x91, + 0xe2, 0x77, 0xc2, 0xc6, 0xda, 0xa6, 0x9e, 0x8f, 0x90, 0x35, 0x0b, 0xbd, 0x09, 0x99, 0xe7, 0x5d, + 0xec, 0xf5, 0x39, 0x8f, 0xc5, 0x13, 0x15, 0xd0, 0x1e, 0x11, 0xa8, 0xce, 0x32, 0x94, 0x2f, 0x64, + 0xc8, 0xd0, 0x00, 0x2a, 0x8b, 0x0e, 0x2a, 0x0e, 0xcc, 0xb2, 0x09, 0x93, 0x07, 0x76, 0x2b, 0xc0, + 0x9e, 0x5f, 0x96, 0x17, 0x52, 0x4b, 0xf9, 0xea, 0xb5, 0x53, 0x7c, 0x40, 0xbb, 0x47, 0x53, 0xf4, + 0x30, 0x55, 0xf9, 0x56, 0x82, 0x2c, 0x8b, 0xa1, 0x3a, 0x40, 0xdb, 0x08, 0xcc, 0x26, 0x33, 0x8a, + 0x44, 0x8d, 0x72, 0xf3, 0xf4, 0x7d, 0x6a, 0xdb, 0x24, 0x99, 0xfa, 0x28, 0xd7, 0x0e, 0x1f, 0x11, + 0x82, 0xb4, 0x63, 0xb4, 0xd9, 0xe1, 0x29, 0xa7, 0xd3, 0x67, 0x34, 0x03, 0x99, 0x9e, 0xd1, 0xea, + 0x62, 0x3a, 0x3d, 0x39, 0x9d, 0xbd, 0xa8, 0xab, 0x90, 0x8b, 0x7a, 0x40, 0xe7, 0xa0, 0xb8, 0xbd, + 0xfe, 0xf8, 0xce, 0x56, 0xe3, 0xc9, 0xce, 0x83, 0x9d, 0xdd, 0x77, 0x77, 0x4a, 0x13, 0xa8, 0x04, + 0x85, 0xfa, 0x63, 0xbd, 0xb6, 0x73, 0xbf, 0x71, 0xf7, 0xd1, 0x93, 0xf5, 0x87, 0x25, 0x49, 0xfd, + 0x48, 0x86, 0xe9, 0x70, 0x50, 0x63, 0x37, 0x34, 0x11, 0x98, 0xdc, 0x3a, 0x56, 0x1d, 0xd4, 0x7e, + 0xdb, 0x6a, 0xb4, 0x6c, 0x9f, 0x9c, 0x82, 0x53, 0xc3, 0x4f, 0x43, 0x59, 0xdb, 0x7a, 0x68, 0xfb, + 0x81, 0x7a, 0x0b, 0x32, 0xba, 0xe1, 0x1c, 0x62, 0x34, 0x07, 0x59, 0xf7, 0xe0, 0xc0, 0xc7, 0xec, + 0xe4, 0x9c, 0xd6, 0xf9, 0x1b, 0x89, 0xf3, 0x45, 0xcc, 0x0a, 0x0a, 0x7f, 0x53, 0xbf, 0x96, 0xe1, + 0x7f, 0xe4, 0x76, 0x44, 0x92, 0xc3, 0x75, 0x7b, 0x43, 0x90, 0xf0, 0xf2, 0xb1, 0x7b, 0x54, 0x0c, + 0x99, 0xd4, 0x95, 0xfb, 0xec, 0x0c, 0xbb, 0xe7, 0x55, 0xc8, 0x78, 0x84, 0x5a, 0x74, 0x8a, 0x1a, + 0xb0, 0x66, 0x94, 0x59, 0xb3, 0xfa, 0x97, 0x04, 0xa5, 0x81, 0x0c, 0xdc, 0x74, 0x37, 0x05, 0xc5, + 0x16, 0x86, 0x2a, 0x96, 0x74, 0xdb, 0x5d, 0xe4, 0xa2, 0xcd, 0x84, 0x57, 0x28, 0x42, 0xa6, 0xc0, + 0x2f, 0x50, 0xea, 0x8f, 0x32, 0x9c, 0x0f, 0xb9, 0x6c, 0x19, 0x7e, 0x54, 0xe3, 0x6f, 0x09, 0xcc, + 0x17, 0x87, 0x30, 0x8f, 0xa1, 0x93, 0xea, 0x97, 0xce, 0x19, 0xfc, 0xb2, 0x04, 0x59, 0x6a, 0x88, + 0xb0, 0xf6, 0xbe, 0x6c, 0x18, 0xde, 0x4e, 0x0a, 0xa0, 0x6f, 0xb4, 0x02, 0x3a, 0xc0, 0x82, 0x4e, + 0x9f, 0xd5, 0x0f, 0x64, 0x98, 0x11, 0x05, 0xe2, 0x4e, 0x7a, 0x43, 0xd0, 0xf3, 0x95, 0x91, 0x7a, + 0x26, 0xdd, 0x4d, 0x8b, 0x5c, 0xd2, 0x79, 0xc8, 0x35, 0x0d, 0xbf, 0x39, 0x28, 0x63, 0x05, 0x7d, + 0x8a, 0x04, 0x48, 0xd5, 0xaa, 0xfe, 0x90, 0x82, 0xc9, 0x3a, 0xeb, 0x1c, 0xad, 0x41, 0xea, 0x3e, + 0x0e, 0xd0, 0xec, 0xd0, 0xff, 0x71, 0xca, 0xdc, 0xf0, 0x9f, 0x39, 0xab, 0x12, 0xc9, 0xdb, 0xeb, + 0x8a, 0x79, 0x83, 0x3f, 0x04, 0x42, 0x5e, 0xec, 0x32, 0xbc, 0x24, 0xa1, 0xb7, 0x20, 0xcb, 0x6e, + 0x38, 0xa8, 0x3c, 0xea, 0x9e, 0xa8, 0xfc, 0x7f, 0xe4, 0x75, 0x88, 0xf8, 0x9e, 0x30, 0x45, 0x73, + 0xc3, 0xef, 0x15, 0xca, 0x85, 0x11, 0x07, 0x48, 0x74, 0x1b, 0xb2, 0x6c, 0x23, 0x12, 0xbe, 0x2b, + 0xec, 0xac, 0xc2, 0x77, 0xc5, 0x5d, 0x6b, 0x55, 0x42, 0x77, 0x61, 0x2a, 0xb4, 0x02, 0x52, 0x46, + 0xd7, 0x66, 0x65, 0xfe, 0x84, 0x2a, 0xb4, 0x2a, 0xa1, 0x5d, 0x28, 0xc4, 0x1d, 0x85, 0x2a, 0x27, + 0x2f, 0x5d, 0xe5, 0xf2, 0x18, 0x2b, 0x6e, 0xec, 0x7d, 0x7f, 0x54, 0x91, 0x7e, 0x3e, 0xaa, 0x48, + 0xbf, 0x1e, 0x55, 0xa4, 0x4f, 0x7f, 0xab, 0x4c, 0x3c, 0xbb, 0x7e, 0x68, 0x07, 0xcd, 0xee, 0xbe, + 0x66, 0xba, 0xed, 0x15, 0xc7, 0xef, 0x98, 0xe6, 0xb2, 0x85, 0x7b, 0x2b, 0x0e, 0x76, 0x0f, 0xfc, + 0x65, 0xa3, 0x63, 0x2f, 0x1f, 0xba, 0x2b, 0xd1, 0x6f, 0xdf, 0x2f, 0xe5, 0xd2, 0x0e, 0x76, 0xef, + 0xd5, 0xb5, 0xf5, 0xbd, 0x1a, 0xdf, 0xde, 0xf6, 0xb3, 0xf4, 0xff, 0xed, 0x8d, 0x7f, 0x03, 0x00, + 0x00, 0xff, 0xff, 0x6e, 0xcf, 0x5c, 0x4e, 0x41, 0x16, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// ServiceClient is the client API for Service service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type ServiceClient interface { + // Get the object from container.v2. Response uses gRPC stream. First response + // message carry object of requested address. Chunk messages are parts of + // the object's payload if it is needed. All messages except first carry + // chunks. Requested object can be restored by concatenation of object + // message payload and all chunks keeping receiving order. + Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (Service_GetClient, error) + // Put the object into container.v2. Request uses gRPC stream. First message + // SHOULD BE type of PutHeader. Container id and Owner id of object SHOULD + // BE set. Session token SHOULD BE obtained before put operation (see + // session package). Chunk messages considered by server as part of object + // payload. All messages except first SHOULD BE chunks. Chunk messages + // SHOULD BE sent in direct order of fragmentation. + Put(ctx context.Context, opts ...grpc.CallOption) (Service_PutClient, error) + // Delete the object from a container + Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteResponse, error) + // Head returns the object without data payload. Object in the + // response has system header only. If full headers flag is set, extended + // headers are also present. + Head(ctx context.Context, in *HeadRequest, opts ...grpc.CallOption) (*HeadResponse, error) + // Search objects in container.v2. Version of query language format SHOULD BE + // set to 1. Search query represented in serialized format (see query + // package). + Search(ctx context.Context, in *SearchRequest, opts ...grpc.CallOption) (Service_SearchClient, error) + // GetRange of data payload. Range is a pair (offset, length). + // Requested range can be restored by concatenation of all chunks + // keeping receiving order. + GetRange(ctx context.Context, in *GetRangeRequest, opts ...grpc.CallOption) (Service_GetRangeClient, error) + // GetRangeHash returns homomorphic hash of object payload range after XOR + // operation. Ranges are set of pairs (offset, length). Hashes order in + // response corresponds to ranges order in request. Homomorphic hash is + // calculated for XORed data. + GetRangeHash(ctx context.Context, in *GetRangeHashRequest, opts ...grpc.CallOption) (*GetRangeHashResponse, error) +} + +type serviceClient struct { + cc *grpc.ClientConn +} + +func NewServiceClient(cc *grpc.ClientConn) ServiceClient { + return &serviceClient{cc} +} + +func (c *serviceClient) Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (Service_GetClient, error) { + stream, err := c.cc.NewStream(ctx, &_Service_serviceDesc.Streams[0], "/object.v2.Service/Get", opts...) + if err != nil { + return nil, err + } + x := &serviceGetClient{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 +} + +type Service_GetClient interface { + Recv() (*GetResponse, error) + grpc.ClientStream +} + +type serviceGetClient struct { + grpc.ClientStream +} + +func (x *serviceGetClient) Recv() (*GetResponse, error) { + m := new(GetResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *serviceClient) Put(ctx context.Context, opts ...grpc.CallOption) (Service_PutClient, error) { + stream, err := c.cc.NewStream(ctx, &_Service_serviceDesc.Streams[1], "/object.v2.Service/Put", opts...) + if err != nil { + return nil, err + } + x := &servicePutClient{stream} + return x, nil +} + +type Service_PutClient interface { + Send(*PutRequest) error + CloseAndRecv() (*PutResponse, error) + grpc.ClientStream +} + +type servicePutClient struct { + grpc.ClientStream +} + +func (x *servicePutClient) Send(m *PutRequest) error { + return x.ClientStream.SendMsg(m) +} + +func (x *servicePutClient) CloseAndRecv() (*PutResponse, error) { + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + m := new(PutResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *serviceClient) Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteResponse, error) { + out := new(DeleteResponse) + err := c.cc.Invoke(ctx, "/object.v2.Service/Delete", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Head(ctx context.Context, in *HeadRequest, opts ...grpc.CallOption) (*HeadResponse, error) { + out := new(HeadResponse) + err := c.cc.Invoke(ctx, "/object.v2.Service/Head", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Search(ctx context.Context, in *SearchRequest, opts ...grpc.CallOption) (Service_SearchClient, error) { + stream, err := c.cc.NewStream(ctx, &_Service_serviceDesc.Streams[2], "/object.v2.Service/Search", opts...) + if err != nil { + return nil, err + } + x := &serviceSearchClient{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 +} + +type Service_SearchClient interface { + Recv() (*SearchResponse, error) + grpc.ClientStream +} + +type serviceSearchClient struct { + grpc.ClientStream +} + +func (x *serviceSearchClient) Recv() (*SearchResponse, error) { + m := new(SearchResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *serviceClient) GetRange(ctx context.Context, in *GetRangeRequest, opts ...grpc.CallOption) (Service_GetRangeClient, error) { + stream, err := c.cc.NewStream(ctx, &_Service_serviceDesc.Streams[3], "/object.v2.Service/GetRange", opts...) + if err != nil { + return nil, err + } + x := &serviceGetRangeClient{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 +} + +type Service_GetRangeClient interface { + Recv() (*GetRangeResponse, error) + grpc.ClientStream +} + +type serviceGetRangeClient struct { + grpc.ClientStream +} + +func (x *serviceGetRangeClient) Recv() (*GetRangeResponse, error) { + m := new(GetRangeResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *serviceClient) GetRangeHash(ctx context.Context, in *GetRangeHashRequest, opts ...grpc.CallOption) (*GetRangeHashResponse, error) { + out := new(GetRangeHashResponse) + err := c.cc.Invoke(ctx, "/object.v2.Service/GetRangeHash", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// ServiceServer is the server API for Service service. +type ServiceServer interface { + // Get the object from container.v2. Response uses gRPC stream. First response + // message carry object of requested address. Chunk messages are parts of + // the object's payload if it is needed. All messages except first carry + // chunks. Requested object can be restored by concatenation of object + // message payload and all chunks keeping receiving order. + Get(*GetRequest, Service_GetServer) error + // Put the object into container.v2. Request uses gRPC stream. First message + // SHOULD BE type of PutHeader. Container id and Owner id of object SHOULD + // BE set. Session token SHOULD BE obtained before put operation (see + // session package). Chunk messages considered by server as part of object + // payload. All messages except first SHOULD BE chunks. Chunk messages + // SHOULD BE sent in direct order of fragmentation. + Put(Service_PutServer) error + // Delete the object from a container + Delete(context.Context, *DeleteRequest) (*DeleteResponse, error) + // Head returns the object without data payload. Object in the + // response has system header only. If full headers flag is set, extended + // headers are also present. + Head(context.Context, *HeadRequest) (*HeadResponse, error) + // Search objects in container.v2. Version of query language format SHOULD BE + // set to 1. Search query represented in serialized format (see query + // package). + Search(*SearchRequest, Service_SearchServer) error + // GetRange of data payload. Range is a pair (offset, length). + // Requested range can be restored by concatenation of all chunks + // keeping receiving order. + GetRange(*GetRangeRequest, Service_GetRangeServer) error + // GetRangeHash returns homomorphic hash of object payload range after XOR + // operation. Ranges are set of pairs (offset, length). Hashes order in + // response corresponds to ranges order in request. Homomorphic hash is + // calculated for XORed data. + GetRangeHash(context.Context, *GetRangeHashRequest) (*GetRangeHashResponse, error) +} + +// UnimplementedServiceServer can be embedded to have forward compatible implementations. +type UnimplementedServiceServer struct { +} + +func (*UnimplementedServiceServer) Get(req *GetRequest, srv Service_GetServer) error { + return status.Errorf(codes.Unimplemented, "method Get not implemented") +} +func (*UnimplementedServiceServer) Put(srv Service_PutServer) error { + return status.Errorf(codes.Unimplemented, "method Put not implemented") +} +func (*UnimplementedServiceServer) Delete(ctx context.Context, req *DeleteRequest) (*DeleteResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Delete not implemented") +} +func (*UnimplementedServiceServer) Head(ctx context.Context, req *HeadRequest) (*HeadResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Head not implemented") +} +func (*UnimplementedServiceServer) Search(req *SearchRequest, srv Service_SearchServer) error { + return status.Errorf(codes.Unimplemented, "method Search not implemented") +} +func (*UnimplementedServiceServer) GetRange(req *GetRangeRequest, srv Service_GetRangeServer) error { + return status.Errorf(codes.Unimplemented, "method GetRange not implemented") +} +func (*UnimplementedServiceServer) GetRangeHash(ctx context.Context, req *GetRangeHashRequest) (*GetRangeHashResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetRangeHash not implemented") +} + +func RegisterServiceServer(s *grpc.Server, srv ServiceServer) { + s.RegisterService(&_Service_serviceDesc, srv) +} + +func _Service_Get_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(GetRequest) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(ServiceServer).Get(m, &serviceGetServer{stream}) +} + +type Service_GetServer interface { + Send(*GetResponse) error + grpc.ServerStream +} + +type serviceGetServer struct { + grpc.ServerStream +} + +func (x *serviceGetServer) Send(m *GetResponse) error { + return x.ServerStream.SendMsg(m) +} + +func _Service_Put_Handler(srv interface{}, stream grpc.ServerStream) error { + return srv.(ServiceServer).Put(&servicePutServer{stream}) +} + +type Service_PutServer interface { + SendAndClose(*PutResponse) error + Recv() (*PutRequest, error) + grpc.ServerStream +} + +type servicePutServer struct { + grpc.ServerStream +} + +func (x *servicePutServer) SendAndClose(m *PutResponse) error { + return x.ServerStream.SendMsg(m) +} + +func (x *servicePutServer) Recv() (*PutRequest, error) { + m := new(PutRequest) + if err := x.ServerStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func _Service_Delete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ServiceServer).Delete(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/object.v2.Service/Delete", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ServiceServer).Delete(ctx, req.(*DeleteRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Service_Head_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(HeadRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ServiceServer).Head(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/object.v2.Service/Head", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ServiceServer).Head(ctx, req.(*HeadRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Service_Search_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(SearchRequest) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(ServiceServer).Search(m, &serviceSearchServer{stream}) +} + +type Service_SearchServer interface { + Send(*SearchResponse) error + grpc.ServerStream +} + +type serviceSearchServer struct { + grpc.ServerStream +} + +func (x *serviceSearchServer) Send(m *SearchResponse) error { + return x.ServerStream.SendMsg(m) +} + +func _Service_GetRange_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(GetRangeRequest) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(ServiceServer).GetRange(m, &serviceGetRangeServer{stream}) +} + +type Service_GetRangeServer interface { + Send(*GetRangeResponse) error + grpc.ServerStream +} + +type serviceGetRangeServer struct { + grpc.ServerStream +} + +func (x *serviceGetRangeServer) Send(m *GetRangeResponse) error { + return x.ServerStream.SendMsg(m) +} + +func _Service_GetRangeHash_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetRangeHashRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ServiceServer).GetRangeHash(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/object.v2.Service/GetRangeHash", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ServiceServer).GetRangeHash(ctx, req.(*GetRangeHashRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Service_serviceDesc = grpc.ServiceDesc{ + ServiceName: "object.v2.Service", + HandlerType: (*ServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Delete", + Handler: _Service_Delete_Handler, + }, + { + MethodName: "Head", + Handler: _Service_Head_Handler, + }, + { + MethodName: "GetRangeHash", + Handler: _Service_GetRangeHash_Handler, + }, + }, + Streams: []grpc.StreamDesc{ + { + StreamName: "Get", + Handler: _Service_Get_Handler, + ServerStreams: true, + }, + { + StreamName: "Put", + Handler: _Service_Put_Handler, + ClientStreams: true, + }, + { + StreamName: "Search", + Handler: _Service_Search_Handler, + ServerStreams: true, + }, + { + StreamName: "GetRange", + Handler: _Service_GetRange_Handler, + ServerStreams: true, + }, + }, + Metadata: "object/v2/service.proto", +} + +func (m *GetRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GetRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.VerifyHeader != nil { + { + size, err := m.VerifyHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + if m.MetaHeader != nil { + { + size, err := m.MetaHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.Body != nil { + { + size, err := m.Body.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *GetRequest_Body) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetRequest_Body) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GetRequest_Body) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.Raw { + i-- + if m.Raw { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x10 + } + if m.Address != nil { + { + size, err := m.Address.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *GetResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GetResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.VerifyHeader != nil { + { + size, err := m.VerifyHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + if m.MetaHeader != nil { + { + size, err := m.MetaHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.Body != nil { + { + size, err := m.Body.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *GetResponse_Body) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetResponse_Body) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GetResponse_Body) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.ObjectPart != nil { + { + size := m.ObjectPart.Size() + i -= size + if _, err := m.ObjectPart.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + } + } + return len(dAtA) - i, nil +} + +func (m *GetResponse_Body_Init_) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GetResponse_Body_Init_) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.Init != nil { + { + size, err := m.Init.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} +func (m *GetResponse_Body_Chunk) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GetResponse_Body_Chunk) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.Chunk != nil { + i -= len(m.Chunk) + copy(dAtA[i:], m.Chunk) + i = encodeVarintService(dAtA, i, uint64(len(m.Chunk))) + i-- + dAtA[i] = 0x12 + } + return len(dAtA) - i, nil +} +func (m *GetResponse_Body_Init) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetResponse_Body_Init) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GetResponse_Body_Init) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.Header != nil { + { + size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + if m.Signature != nil { + { + size, err := m.Signature.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.ObjectId != nil { + { + size, err := m.ObjectId.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *PutRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PutRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PutRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.VerifyHeader != nil { + { + size, err := m.VerifyHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + if m.MetaHeader != nil { + { + size, err := m.MetaHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.Body != nil { + { + size, err := m.Body.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *PutRequest_Body) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PutRequest_Body) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PutRequest_Body) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.ObjectPart != nil { + { + size := m.ObjectPart.Size() + i -= size + if _, err := m.ObjectPart.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + } + } + return len(dAtA) - i, nil +} + +func (m *PutRequest_Body_Init_) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PutRequest_Body_Init_) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.Init != nil { + { + size, err := m.Init.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} +func (m *PutRequest_Body_Chunk) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PutRequest_Body_Chunk) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.Chunk != nil { + i -= len(m.Chunk) + copy(dAtA[i:], m.Chunk) + i = encodeVarintService(dAtA, i, uint64(len(m.Chunk))) + i-- + dAtA[i] = 0x12 + } + return len(dAtA) - i, nil +} +func (m *PutRequest_Body_Init) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PutRequest_Body_Init) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PutRequest_Body_Init) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.CopiesNumber != 0 { + i = encodeVarintService(dAtA, i, uint64(m.CopiesNumber)) + i-- + dAtA[i] = 0x20 + } + if m.Header != nil { + { + size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + if m.Signature != nil { + { + size, err := m.Signature.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.ObjectId != nil { + { + size, err := m.ObjectId.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *PutResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PutResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PutResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.VerifyHeader != nil { + { + size, err := m.VerifyHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + if m.MetaHeader != nil { + { + size, err := m.MetaHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.Body != nil { + { + size, err := m.Body.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *PutResponse_Body) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PutResponse_Body) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PutResponse_Body) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.ObjectId != nil { + { + size, err := m.ObjectId.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *DeleteRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *DeleteRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DeleteRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.VerifyHeader != nil { + { + size, err := m.VerifyHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + if m.MetaHeader != nil { + { + size, err := m.MetaHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.Body != nil { + { + size, err := m.Body.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *DeleteRequest_Body) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *DeleteRequest_Body) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DeleteRequest_Body) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.OwnerId != nil { + { + size, err := m.OwnerId.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.Address != nil { + { + size, err := m.Address.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *DeleteResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *DeleteResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DeleteResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.VerifyHeader != nil { + { + size, err := m.VerifyHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + if m.MetaHeader != nil { + { + size, err := m.MetaHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.Body != nil { + { + size, err := m.Body.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *DeleteResponse_Body) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *DeleteResponse_Body) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DeleteResponse_Body) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + return len(dAtA) - i, nil +} + +func (m *HeadRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *HeadRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *HeadRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.VerifyHeader != nil { + { + size, err := m.VerifyHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + if m.MetaHeader != nil { + { + size, err := m.MetaHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.Body != nil { + { + size, err := m.Body.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *HeadRequest_Body) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *HeadRequest_Body) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *HeadRequest_Body) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.Raw { + i-- + if m.Raw { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x18 + } + if m.MainOnly { + i-- + if m.MainOnly { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x10 + } + if m.Address != nil { + { + size, err := m.Address.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *HeadResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *HeadResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *HeadResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.VerifyHeader != nil { + { + size, err := m.VerifyHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + if m.MetaHeader != nil { + { + size, err := m.MetaHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.Body != nil { + { + size, err := m.Body.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *HeadResponse_Body) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *HeadResponse_Body) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *HeadResponse_Body) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.Head != nil { + { + size := m.Head.Size() + i -= size + if _, err := m.Head.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + } + } + return len(dAtA) - i, nil +} + +func (m *HeadResponse_Body_Header) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *HeadResponse_Body_Header) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.Header != nil { + { + size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} +func (m *HeadResponse_Body_ShortHeader_) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *HeadResponse_Body_ShortHeader_) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.ShortHeader != nil { + { + size, err := m.ShortHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + return len(dAtA) - i, nil +} +func (m *HeadResponse_Body_ShortHeader) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *HeadResponse_Body_ShortHeader) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *HeadResponse_Body_ShortHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.PayloadLength != 0 { + i = encodeVarintService(dAtA, i, uint64(m.PayloadLength)) + i-- + dAtA[i] = 0x28 + } + if m.ObjectType != 0 { + i = encodeVarintService(dAtA, i, uint64(m.ObjectType)) + i-- + dAtA[i] = 0x20 + } + if m.OwnerId != nil { + { + size, err := m.OwnerId.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + if m.CreationEpoch != 0 { + i = encodeVarintService(dAtA, i, uint64(m.CreationEpoch)) + i-- + dAtA[i] = 0x10 + } + if m.Version != nil { + { + size, err := m.Version.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *SearchRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *SearchRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *SearchRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.VerifyHeader != nil { + { + size, err := m.VerifyHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + if m.MetaHeader != nil { + { + size, err := m.MetaHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.Body != nil { + { + size, err := m.Body.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *SearchRequest_Body) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *SearchRequest_Body) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *SearchRequest_Body) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.Query != nil { + { + size, err := m.Query.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.ContainerId != nil { + { + size, err := m.ContainerId.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *SearchRequest_Body_Query) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *SearchRequest_Body_Query) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *SearchRequest_Body_Query) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Filters) > 0 { + for iNdEx := len(m.Filters) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Filters[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if m.Version != 0 { + i = encodeVarintService(dAtA, i, uint64(m.Version)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *SearchRequest_Body_Query_Filter) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *SearchRequest_Body_Query_Filter) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *SearchRequest_Body_Query_Filter) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Value) > 0 { + i -= len(m.Value) + copy(dAtA[i:], m.Value) + i = encodeVarintService(dAtA, i, uint64(len(m.Value))) + i-- + dAtA[i] = 0x1a + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintService(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0x12 + } + if m.MatchType != 0 { + i = encodeVarintService(dAtA, i, uint64(m.MatchType)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *SearchResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *SearchResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *SearchResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.VerifyHeader != nil { + { + size, err := m.VerifyHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + if m.MetaHeader != nil { + { + size, err := m.MetaHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.Body != nil { + { + size, err := m.Body.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *SearchResponse_Body) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *SearchResponse_Body) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *SearchResponse_Body) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.IdList) > 0 { + for iNdEx := len(m.IdList) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.IdList[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *Range) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Range) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Range) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.Length != 0 { + i = encodeVarintService(dAtA, i, uint64(m.Length)) + i-- + dAtA[i] = 0x10 + } + if m.Offset != 0 { + i = encodeVarintService(dAtA, i, uint64(m.Offset)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *GetRangeRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetRangeRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GetRangeRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.VerifyHeader != nil { + { + size, err := m.VerifyHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + if m.MetaHeader != nil { + { + size, err := m.MetaHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.Body != nil { + { + size, err := m.Body.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *GetRangeRequest_Body) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetRangeRequest_Body) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GetRangeRequest_Body) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.Range != nil { + { + size, err := m.Range.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.Address != nil { + { + size, err := m.Address.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *GetRangeResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetRangeResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GetRangeResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.VerifyHeader != nil { + { + size, err := m.VerifyHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + if m.MetaHeader != nil { + { + size, err := m.MetaHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.Body != nil { + { + size, err := m.Body.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *GetRangeResponse_Body) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetRangeResponse_Body) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GetRangeResponse_Body) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Chunk) > 0 { + i -= len(m.Chunk) + copy(dAtA[i:], m.Chunk) + i = encodeVarintService(dAtA, i, uint64(len(m.Chunk))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *GetRangeHashRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetRangeHashRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GetRangeHashRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.VerifyHeader != nil { + { + size, err := m.VerifyHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + if m.MetaHeader != nil { + { + size, err := m.MetaHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.Body != nil { + { + size, err := m.Body.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *GetRangeHashRequest_Body) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetRangeHashRequest_Body) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GetRangeHashRequest_Body) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Salt) > 0 { + i -= len(m.Salt) + copy(dAtA[i:], m.Salt) + i = encodeVarintService(dAtA, i, uint64(len(m.Salt))) + i-- + dAtA[i] = 0x1a + } + if len(m.Ranges) > 0 { + for iNdEx := len(m.Ranges) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Ranges[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if m.Address != nil { + { + size, err := m.Address.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *GetRangeHashResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetRangeHashResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GetRangeHashResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.VerifyHeader != nil { + { + size, err := m.VerifyHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + if m.MetaHeader != nil { + { + size, err := m.MetaHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.Body != nil { + { + size, err := m.Body.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *GetRangeHashResponse_Body) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetRangeHashResponse_Body) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GetRangeHashResponse_Body) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.HashList) > 0 { + for iNdEx := len(m.HashList) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.HashList[iNdEx]) + copy(dAtA[i:], m.HashList[iNdEx]) + i = encodeVarintService(dAtA, i, uint64(len(m.HashList[iNdEx]))) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func encodeVarintService(dAtA []byte, offset int, v uint64) int { + offset -= sovService(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *GetRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Body != nil { + l = m.Body.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.MetaHeader != nil { + l = m.MetaHeader.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.VerifyHeader != nil { + l = m.VerifyHeader.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *GetRequest_Body) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Address != nil { + l = m.Address.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.Raw { + n += 2 + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *GetResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Body != nil { + l = m.Body.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.MetaHeader != nil { + l = m.MetaHeader.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.VerifyHeader != nil { + l = m.VerifyHeader.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *GetResponse_Body) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ObjectPart != nil { + n += m.ObjectPart.Size() + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *GetResponse_Body_Init_) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Init != nil { + l = m.Init.Size() + n += 1 + l + sovService(uint64(l)) + } + return n +} +func (m *GetResponse_Body_Chunk) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Chunk != nil { + l = len(m.Chunk) + n += 1 + l + sovService(uint64(l)) + } + return n +} +func (m *GetResponse_Body_Init) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ObjectId != nil { + l = m.ObjectId.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.Signature != nil { + l = m.Signature.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.Header != nil { + l = m.Header.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *PutRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Body != nil { + l = m.Body.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.MetaHeader != nil { + l = m.MetaHeader.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.VerifyHeader != nil { + l = m.VerifyHeader.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *PutRequest_Body) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ObjectPart != nil { + n += m.ObjectPart.Size() + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *PutRequest_Body_Init_) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Init != nil { + l = m.Init.Size() + n += 1 + l + sovService(uint64(l)) + } + return n +} +func (m *PutRequest_Body_Chunk) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Chunk != nil { + l = len(m.Chunk) + n += 1 + l + sovService(uint64(l)) + } + return n +} +func (m *PutRequest_Body_Init) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ObjectId != nil { + l = m.ObjectId.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.Signature != nil { + l = m.Signature.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.Header != nil { + l = m.Header.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.CopiesNumber != 0 { + n += 1 + sovService(uint64(m.CopiesNumber)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *PutResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Body != nil { + l = m.Body.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.MetaHeader != nil { + l = m.MetaHeader.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.VerifyHeader != nil { + l = m.VerifyHeader.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *PutResponse_Body) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ObjectId != nil { + l = m.ObjectId.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *DeleteRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Body != nil { + l = m.Body.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.MetaHeader != nil { + l = m.MetaHeader.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.VerifyHeader != nil { + l = m.VerifyHeader.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *DeleteRequest_Body) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Address != nil { + l = m.Address.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.OwnerId != nil { + l = m.OwnerId.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *DeleteResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Body != nil { + l = m.Body.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.MetaHeader != nil { + l = m.MetaHeader.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.VerifyHeader != nil { + l = m.VerifyHeader.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *DeleteResponse_Body) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *HeadRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Body != nil { + l = m.Body.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.MetaHeader != nil { + l = m.MetaHeader.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.VerifyHeader != nil { + l = m.VerifyHeader.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *HeadRequest_Body) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Address != nil { + l = m.Address.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.MainOnly { + n += 2 + } + if m.Raw { + n += 2 + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *HeadResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Body != nil { + l = m.Body.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.MetaHeader != nil { + l = m.MetaHeader.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.VerifyHeader != nil { + l = m.VerifyHeader.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *HeadResponse_Body) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Head != nil { + n += m.Head.Size() + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *HeadResponse_Body_Header) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Header != nil { + l = m.Header.Size() + n += 1 + l + sovService(uint64(l)) + } + return n +} +func (m *HeadResponse_Body_ShortHeader_) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ShortHeader != nil { + l = m.ShortHeader.Size() + n += 1 + l + sovService(uint64(l)) + } + return n +} +func (m *HeadResponse_Body_ShortHeader) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Version != nil { + l = m.Version.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.CreationEpoch != 0 { + n += 1 + sovService(uint64(m.CreationEpoch)) + } + if m.OwnerId != nil { + l = m.OwnerId.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.ObjectType != 0 { + n += 1 + sovService(uint64(m.ObjectType)) + } + if m.PayloadLength != 0 { + n += 1 + sovService(uint64(m.PayloadLength)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *SearchRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Body != nil { + l = m.Body.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.MetaHeader != nil { + l = m.MetaHeader.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.VerifyHeader != nil { + l = m.VerifyHeader.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *SearchRequest_Body) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ContainerId != nil { + l = m.ContainerId.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.Query != nil { + l = m.Query.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *SearchRequest_Body_Query) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Version != 0 { + n += 1 + sovService(uint64(m.Version)) + } + if len(m.Filters) > 0 { + for _, e := range m.Filters { + l = e.Size() + n += 1 + l + sovService(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *SearchRequest_Body_Query_Filter) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.MatchType != 0 { + n += 1 + sovService(uint64(m.MatchType)) + } + l = len(m.Name) + if l > 0 { + n += 1 + l + sovService(uint64(l)) + } + l = len(m.Value) + if l > 0 { + n += 1 + l + sovService(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *SearchResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Body != nil { + l = m.Body.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.MetaHeader != nil { + l = m.MetaHeader.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.VerifyHeader != nil { + l = m.VerifyHeader.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *SearchResponse_Body) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.IdList) > 0 { + for _, e := range m.IdList { + l = e.Size() + n += 1 + l + sovService(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *Range) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Offset != 0 { + n += 1 + sovService(uint64(m.Offset)) + } + if m.Length != 0 { + n += 1 + sovService(uint64(m.Length)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *GetRangeRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Body != nil { + l = m.Body.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.MetaHeader != nil { + l = m.MetaHeader.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.VerifyHeader != nil { + l = m.VerifyHeader.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *GetRangeRequest_Body) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Address != nil { + l = m.Address.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.Range != nil { + l = m.Range.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *GetRangeResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Body != nil { + l = m.Body.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.MetaHeader != nil { + l = m.MetaHeader.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.VerifyHeader != nil { + l = m.VerifyHeader.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *GetRangeResponse_Body) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Chunk) + if l > 0 { + n += 1 + l + sovService(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *GetRangeHashRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Body != nil { + l = m.Body.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.MetaHeader != nil { + l = m.MetaHeader.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.VerifyHeader != nil { + l = m.VerifyHeader.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *GetRangeHashRequest_Body) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Address != nil { + l = m.Address.Size() + n += 1 + l + sovService(uint64(l)) + } + if len(m.Ranges) > 0 { + for _, e := range m.Ranges { + l = e.Size() + n += 1 + l + sovService(uint64(l)) + } + } + l = len(m.Salt) + if l > 0 { + n += 1 + l + sovService(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *GetRangeHashResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Body != nil { + l = m.Body.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.MetaHeader != nil { + l = m.MetaHeader.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.VerifyHeader != nil { + l = m.VerifyHeader.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *GetRangeHashResponse_Body) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.HashList) > 0 { + for _, b := range m.HashList { + l = len(b) + n += 1 + l + sovService(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovService(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozService(x uint64) (n int) { + return sovService(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *GetRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GetRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Body", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Body == nil { + m.Body = &GetRequest_Body{} + } + if err := m.Body.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MetaHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.MetaHeader == nil { + m.MetaHeader = &v2.RequestMetaHeader{} + } + if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field VerifyHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.VerifyHeader == nil { + m.VerifyHeader = &v2.RequestVerificationHeader{} + } + if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GetRequest_Body) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Body: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Body: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Address == nil { + m.Address = &v21.Address{} + } + if err := m.Address.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Raw", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Raw = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GetResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GetResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Body", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Body == nil { + m.Body = &GetResponse_Body{} + } + if err := m.Body.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MetaHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.MetaHeader == nil { + m.MetaHeader = &v2.ResponseMetaHeader{} + } + if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field VerifyHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.VerifyHeader == nil { + m.VerifyHeader = &v2.ResponseVerificationHeader{} + } + if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GetResponse_Body) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Body: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Body: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Init", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &GetResponse_Body_Init{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.ObjectPart = &GetResponse_Body_Init_{v} + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Chunk", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := make([]byte, postIndex-iNdEx) + copy(v, dAtA[iNdEx:postIndex]) + m.ObjectPart = &GetResponse_Body_Chunk{v} + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GetResponse_Body_Init) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Init: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Init: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ObjectId", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.ObjectId == nil { + m.ObjectId = &v21.ObjectID{} + } + if err := m.ObjectId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signature", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Signature == nil { + m.Signature = &v2.Signature{} + } + if err := m.Signature.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Header == nil { + m.Header = &Header{} + } + if err := m.Header.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *PutRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: PutRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PutRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Body", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Body == nil { + m.Body = &PutRequest_Body{} + } + if err := m.Body.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MetaHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.MetaHeader == nil { + m.MetaHeader = &v2.RequestMetaHeader{} + } + if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field VerifyHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.VerifyHeader == nil { + m.VerifyHeader = &v2.RequestVerificationHeader{} + } + if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *PutRequest_Body) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Body: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Body: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Init", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &PutRequest_Body_Init{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.ObjectPart = &PutRequest_Body_Init_{v} + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Chunk", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := make([]byte, postIndex-iNdEx) + copy(v, dAtA[iNdEx:postIndex]) + m.ObjectPart = &PutRequest_Body_Chunk{v} + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *PutRequest_Body_Init) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Init: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Init: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ObjectId", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.ObjectId == nil { + m.ObjectId = &v21.ObjectID{} + } + if err := m.ObjectId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signature", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Signature == nil { + m.Signature = &v2.Signature{} + } + if err := m.Signature.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Header == nil { + m.Header = &Header{} + } + if err := m.Header.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CopiesNumber", wireType) + } + m.CopiesNumber = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.CopiesNumber |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *PutResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: PutResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PutResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Body", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Body == nil { + m.Body = &PutResponse_Body{} + } + if err := m.Body.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MetaHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.MetaHeader == nil { + m.MetaHeader = &v2.ResponseMetaHeader{} + } + if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field VerifyHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.VerifyHeader == nil { + m.VerifyHeader = &v2.ResponseVerificationHeader{} + } + if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *PutResponse_Body) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Body: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Body: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ObjectId", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.ObjectId == nil { + m.ObjectId = &v21.ObjectID{} + } + if err := m.ObjectId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DeleteRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DeleteRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DeleteRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Body", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Body == nil { + m.Body = &DeleteRequest_Body{} + } + if err := m.Body.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MetaHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.MetaHeader == nil { + m.MetaHeader = &v2.RequestMetaHeader{} + } + if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field VerifyHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.VerifyHeader == nil { + m.VerifyHeader = &v2.RequestVerificationHeader{} + } + if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DeleteRequest_Body) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Body: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Body: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Address == nil { + m.Address = &v21.Address{} + } + if err := m.Address.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OwnerId", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.OwnerId == nil { + m.OwnerId = &v21.OwnerID{} + } + if err := m.OwnerId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DeleteResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DeleteResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DeleteResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Body", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Body == nil { + m.Body = &DeleteResponse_Body{} + } + if err := m.Body.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MetaHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.MetaHeader == nil { + m.MetaHeader = &v2.ResponseMetaHeader{} + } + if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field VerifyHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.VerifyHeader == nil { + m.VerifyHeader = &v2.ResponseVerificationHeader{} + } + if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DeleteResponse_Body) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Body: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Body: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *HeadRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: HeadRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: HeadRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Body", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Body == nil { + m.Body = &HeadRequest_Body{} + } + if err := m.Body.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MetaHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.MetaHeader == nil { + m.MetaHeader = &v2.RequestMetaHeader{} + } + if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field VerifyHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.VerifyHeader == nil { + m.VerifyHeader = &v2.RequestVerificationHeader{} + } + if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *HeadRequest_Body) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Body: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Body: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Address == nil { + m.Address = &v21.Address{} + } + if err := m.Address.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MainOnly", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.MainOnly = bool(v != 0) + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Raw", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Raw = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *HeadResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: HeadResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: HeadResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Body", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Body == nil { + m.Body = &HeadResponse_Body{} + } + if err := m.Body.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MetaHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.MetaHeader == nil { + m.MetaHeader = &v2.ResponseMetaHeader{} + } + if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field VerifyHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.VerifyHeader == nil { + m.VerifyHeader = &v2.ResponseVerificationHeader{} + } + if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *HeadResponse_Body) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Body: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Body: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &Header{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Head = &HeadResponse_Body_Header{v} + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ShortHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &HeadResponse_Body_ShortHeader{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Head = &HeadResponse_Body_ShortHeader_{v} + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *HeadResponse_Body_ShortHeader) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ShortHeader: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ShortHeader: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Version == nil { + m.Version = &v2.Version{} + } + if err := m.Version.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CreationEpoch", wireType) + } + m.CreationEpoch = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.CreationEpoch |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OwnerId", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.OwnerId == nil { + m.OwnerId = &v21.OwnerID{} + } + if err := m.OwnerId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ObjectType", wireType) + } + m.ObjectType = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ObjectType |= ObjectType(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PayloadLength", wireType) + } + m.PayloadLength = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.PayloadLength |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *SearchRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: SearchRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SearchRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Body", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Body == nil { + m.Body = &SearchRequest_Body{} + } + if err := m.Body.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MetaHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.MetaHeader == nil { + m.MetaHeader = &v2.RequestMetaHeader{} + } + if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field VerifyHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.VerifyHeader == nil { + m.VerifyHeader = &v2.RequestVerificationHeader{} + } + if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *SearchRequest_Body) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Body: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Body: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ContainerId", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.ContainerId == nil { + m.ContainerId = &v21.ContainerID{} + } + if err := m.ContainerId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Query", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Query == nil { + m.Query = &SearchRequest_Body_Query{} + } + if err := m.Query.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *SearchRequest_Body_Query) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Query: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Query: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) + } + m.Version = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Version |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Filters", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Filters = append(m.Filters, &SearchRequest_Body_Query_Filter{}) + if err := m.Filters[len(m.Filters)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *SearchRequest_Body_Query_Filter) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Filter: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Filter: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MatchType", wireType) + } + m.MatchType = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MatchType |= SearchRequest_Body_Query_Filter_MatchType(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Value = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *SearchResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: SearchResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SearchResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Body", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Body == nil { + m.Body = &SearchResponse_Body{} + } + if err := m.Body.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MetaHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.MetaHeader == nil { + m.MetaHeader = &v2.ResponseMetaHeader{} + } + if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field VerifyHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.VerifyHeader == nil { + m.VerifyHeader = &v2.ResponseVerificationHeader{} + } + if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *SearchResponse_Body) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Body: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Body: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field IdList", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.IdList = append(m.IdList, &v21.ObjectID{}) + if err := m.IdList[len(m.IdList)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Range) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Range: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Range: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Offset", wireType) + } + m.Offset = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Offset |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Length", wireType) + } + m.Length = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Length |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GetRangeRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GetRangeRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetRangeRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Body", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Body == nil { + m.Body = &GetRangeRequest_Body{} + } + if err := m.Body.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MetaHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.MetaHeader == nil { + m.MetaHeader = &v2.RequestMetaHeader{} + } + if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field VerifyHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.VerifyHeader == nil { + m.VerifyHeader = &v2.RequestVerificationHeader{} + } + if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GetRangeRequest_Body) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Body: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Body: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Address == nil { + m.Address = &v21.Address{} + } + if err := m.Address.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Range", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Range == nil { + m.Range = &Range{} + } + if err := m.Range.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GetRangeResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GetRangeResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetRangeResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Body", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Body == nil { + m.Body = &GetRangeResponse_Body{} + } + if err := m.Body.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MetaHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.MetaHeader == nil { + m.MetaHeader = &v2.ResponseMetaHeader{} + } + if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field VerifyHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.VerifyHeader == nil { + m.VerifyHeader = &v2.ResponseVerificationHeader{} + } + if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GetRangeResponse_Body) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Body: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Body: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Chunk", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Chunk = append(m.Chunk[:0], dAtA[iNdEx:postIndex]...) + if m.Chunk == nil { + m.Chunk = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GetRangeHashRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GetRangeHashRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetRangeHashRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Body", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Body == nil { + m.Body = &GetRangeHashRequest_Body{} + } + if err := m.Body.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MetaHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.MetaHeader == nil { + m.MetaHeader = &v2.RequestMetaHeader{} + } + if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field VerifyHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.VerifyHeader == nil { + m.VerifyHeader = &v2.RequestVerificationHeader{} + } + if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GetRangeHashRequest_Body) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Body: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Body: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Address == nil { + m.Address = &v21.Address{} + } + if err := m.Address.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Ranges", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Ranges = append(m.Ranges, &Range{}) + if err := m.Ranges[len(m.Ranges)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Salt", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Salt = append(m.Salt[:0], dAtA[iNdEx:postIndex]...) + if m.Salt == nil { + m.Salt = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GetRangeHashResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GetRangeHashResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetRangeHashResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Body", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Body == nil { + m.Body = &GetRangeHashResponse_Body{} + } + if err := m.Body.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MetaHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.MetaHeader == nil { + m.MetaHeader = &v2.ResponseMetaHeader{} + } + if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field VerifyHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.VerifyHeader == nil { + m.VerifyHeader = &v2.ResponseVerificationHeader{} + } + if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GetRangeHashResponse_Body) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Body: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Body: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field HashList", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.HashList = append(m.HashList, make([]byte, postIndex-iNdEx)) + copy(m.HashList[len(m.HashList)-1], dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipService(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowService + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowService + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowService + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthService + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupService + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthService + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthService = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowService = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupService = fmt.Errorf("proto: unexpected end of group") +) diff --git a/object/v2/service.proto b/object/v2/service.proto new file mode 100644 index 0000000..85e6d3e --- /dev/null +++ b/object/v2/service.proto @@ -0,0 +1,407 @@ +syntax = "proto3"; + +package object.v2; + +option go_package = "github.com/nspcc-dev/neofs-api-go/object/v2"; +option csharp_namespace = "NeoFS.API.Object"; + +import "object/v2/types.proto"; +import "refs/v2/types.proto"; +import "service/v2/meta.proto"; +import "service/v2/verify.proto"; + +// Object service provides API for manipulating with the object.v2. +service Service { + // Get the object from container.v2. Response uses gRPC stream. First response + // message carry object of requested address. Chunk messages are parts of + // the object's payload if it is needed. All messages except first carry + // chunks. Requested object can be restored by concatenation of object + // message payload and all chunks keeping receiving order. + rpc Get(GetRequest) returns (stream GetResponse); + + // Put the object into container.v2. Request uses gRPC stream. First message + // SHOULD BE type of PutHeader. Container id and Owner id of object SHOULD + // BE set. Session token SHOULD BE obtained before put operation (see + // session package). Chunk messages considered by server as part of object + // payload. All messages except first SHOULD BE chunks. Chunk messages + // SHOULD BE sent in direct order of fragmentation. + rpc Put(stream PutRequest) returns (PutResponse); + + // Delete the object from a container + rpc Delete(DeleteRequest) returns (DeleteResponse); + + // Head returns the object without data payload. Object in the + // response has system header only. If full headers flag is set, extended + // headers are also present. + rpc Head(HeadRequest) returns (HeadResponse); + + // Search objects in container.v2. Version of query language format SHOULD BE + // set to 1. Search query represented in serialized format (see query + // package). + rpc Search(SearchRequest) returns (stream SearchResponse); + + // GetRange of data payload. Range is a pair (offset, length). + // Requested range can be restored by concatenation of all chunks + // keeping receiving order. + rpc GetRange(GetRangeRequest) returns (stream GetRangeResponse); + + // GetRangeHash returns homomorphic hash of object payload range after XOR + // operation. Ranges are set of pairs (offset, length). Hashes order in + // response corresponds to ranges order in request. Homomorphic hash is + // calculated for XORed data. + rpc GetRangeHash(GetRangeHashRequest) returns (GetRangeHashResponse); +} + +message GetRequest { + message Body { + // Address of the requested object.v2. + refs.v2.Address address = 1; + + // Carries the raw option flag of the request. + // Raw request is sent to receive only the objects + // that are physically stored on the server. + bool raw = 2; + } + // Body of get object request message. + Body body = 1; + + // Carries request meta information. Header data is used only to regulate message + // transport and does not affect request execution. + service.v2.RequestMetaHeader meta_header = 2; + + // Carries request verification information. This header is used to authenticate + // the nodes of the message route and check the correctness of transmission. + service.v2.RequestVerificationHeader verify_header = 3; +} + +message GetResponse { + message Body { + // Initialization parameters of the object got from NeoFS. + message Init { + // Object ID + refs.v2.ObjectID object_id = 1; + // Object signature + service.v2.Signature signature =2; + // Object header. + Header header = 3; + } + // Carries the single message of the response stream. + oneof object_part { + // Initialization parameters of the object stream. + Init init =1; + // Part of the object payload. + bytes chunk = 2; + } + } + // Body of get object response message. + Body body = 1; + + // Carries response meta information. Header data is used only to regulate + // message transport and does not affect request execution. + service.v2.ResponseMetaHeader meta_header = 2; + + // Carries response verification information. This header is used to + // authenticate the nodes of the message route and check the correctness + // of transmission. + service.v2.ResponseVerificationHeader verify_header = 3; +} + +message PutRequest { + message Body { + // Groups initialization parameters of object placement in NeoFS. + message Init { + // Object ID, where available + refs.v2.ObjectID object_id = 1; + // Object signature, were available + service.v2.Signature signature =2; + // Header of the object to save in the system. + Header header = 3; + // Number of the object copies to store within the RPC call. + // Default zero value is processed according to the + // container placement rules. + uint32 copies_number = 4; + } + + // Carries the single part of the query stream. + oneof object_part { + // Carries the initialization parameters of the object stream. + Init init = 1; + // Carries part of the object payload. + bytes chunk = 2; + } + } + // Body of put object request message. + Body body = 1; + + // Carries request meta information. Header data is used only to regulate message + // transport and does not affect request execution. + service.v2.RequestMetaHeader meta_header = 2; + + // Carries request verification information. This header is used to authenticate + // the nodes of the message route and check the correctness of transmission. + service.v2.RequestVerificationHeader verify_header = 3; +} + +message PutResponse { + message Body { + // Carries identifier of the saved object.v2. + // It is used to access an object in the container.v2. + refs.v2.ObjectID object_id = 1; + } + // Body of put object response message. + Body body = 1; + + // Carries response meta information. Header data is used only to regulate + // message transport and does not affect request execution. + service.v2.ResponseMetaHeader meta_header = 2; + + // Carries response verification information. This header is used to + // authenticate the nodes of the message route and check the correctness + // of transmission. + service.v2.ResponseVerificationHeader verify_header = 3; +} + +message DeleteRequest { + message Body { + // Carries the address of the object to be deleted. + refs.v2.Address address = 1; + // Carries identifier the object owner. + refs.v2.OwnerID owner_id = 2; + } + // Body of delete object request message. + Body body = 1; + + // Carries request meta information. Header data is used only to regulate message + // transport and does not affect request execution. + service.v2.RequestMetaHeader meta_header = 2; + + // Carries request verification information. This header is used to authenticate + // the nodes of the message route and check the correctness of transmission. + service.v2.RequestVerificationHeader verify_header = 3; +} + +// DeleteResponse is empty because we cannot guarantee permanent object removal +// in distributed system. +message DeleteResponse { + message Body { } + + // Body of delete object response message. + Body body = 1; + + // Carries response meta information. Header data is used only to regulate + // message transport and does not affect request execution. + service.v2.ResponseMetaHeader meta_header = 2; + + // Carries response verification information. This header is used to + // authenticate the nodes of the message route and check the correctness + // of transmission. + service.v2.ResponseVerificationHeader verify_header = 3; +} + +message HeadRequest { + message Body { + // Address of the object with the requested header. + refs.v2.Address address = 1; + // Return only minimal header subset + bool main_only = 2; + // Carries the raw option flag of the request. + // Raw request is sent to receive only the headers of the objects + // that are physically stored on the server. + bool raw = 3; + } + // Body of head object request message. + Body body = 1; + + // Carries request meta information. Header data is used only to regulate message + // transport and does not affect request execution. + service.v2.RequestMetaHeader meta_header = 2; + + // Carries request verification information. This header is used to authenticate + // the nodes of the message route and check the correctness of transmission. + service.v2.RequestVerificationHeader verify_header = 3; +} + +message HeadResponse { + message Body { + message ShortHeader { + // Object format version. + service.v2.Version version = 1; + // Epoch when the object was created + uint64 creation_epoch = 2; + // Object's owner + refs.v2.OwnerID owner_id = 3; + // Type of the object payload content + ObjectType object_type = 4; + // Size of payload in bytes. + // 0xFFFFFFFFFFFFFFFF means `payload_length` is unknown + uint64 payload_length = 5; + } + // Carries the requested object header or it's part + oneof head{ + Header header = 1; + ShortHeader short_header = 2; + } + } + // Body of head object response message. + Body body = 1; + + // Carries response meta information. Header data is used only to regulate + // message transport and does not affect request execution. + service.v2.ResponseMetaHeader meta_header = 2; + + // Carries response verification information. This header is used to + // authenticate the nodes of the message route and check the correctness + // of transmission. + service.v2.ResponseVerificationHeader verify_header = 3; +} + +message SearchRequest { + message Body { + // Carries search container identifier. + refs.v2.ContainerID container_id = 1; + + message Query { + uint32 version = 1; + + message Filter { + enum MatchType { + MATCH_UNKNOWN = 0; + STRING_EQUAL = 1; + } + + MatchType match_type = 1; + + string name = 2; + + string value = 3; + } + + repeated Filter filters = 2; + } + + Query query = 2; + } + + // Body of search object request message. + Body body = 1; + + // Carries request meta information. Header data is used only to regulate message + // transport and does not affect request execution. + service.v2.RequestMetaHeader meta_header = 2; + + // Carries request verification information. This header is used to authenticate + // the nodes of the message route and check the correctness of transmission. + service.v2.RequestVerificationHeader verify_header = 3; +} + +message SearchResponse { + message Body { + // Carries list of object identifiers that match the search query. + repeated refs.v2.ObjectID id_list = 1; + } + + // Body of search object response message. + Body body = 1; + + // Carries response meta information. Header data is used only to regulate + // message transport and does not affect request execution. + service.v2.ResponseMetaHeader meta_header = 2; + + // Carries response verification information. This header is used to + // authenticate the nodes of the message route and check the correctness + // of transmission. + service.v2.ResponseVerificationHeader verify_header = 3; +} + +// Range groups the parameters of object payload range. +message Range { + // Carries the offset of the range from the object payload start. + uint64 offset = 1; + + // Carries the length of the object payload range. + uint64 length = 2; +} + +message GetRangeRequest { + message Body { + // Address carries address of the object that contains the requested payload range. + refs.v2.Address address = 1; + + // Range carries the parameters of the requested payload range. + Range range = 2; + } + + // Body of get range object request message. + Body body = 1; + + // Carries request meta information. Header data is used only to regulate message + // transport and does not affect request execution. + service.v2.RequestMetaHeader meta_header = 2; + + // Carries request verification information. This header is used to authenticate + // the nodes of the message route and check the correctness of transmission. + service.v2.RequestVerificationHeader verify_header = 3; +} + +message GetRangeResponse { + message Body { + // Carries part of the object payload. + bytes chunk = 1; + } + + // Body of get range object response message. + Body body = 1; + + // Carries response meta information. Header data is used only to regulate + // message transport and does not affect request execution. + service.v2.ResponseMetaHeader meta_header = 2; + + // Carries response verification information. This header is used to + // authenticate the nodes of the message route and check the correctness + // of transmission. + service.v2.ResponseVerificationHeader verify_header = 3; +} + +message GetRangeHashRequest { + message Body { + // Carries address of the object that contains the requested payload range. + refs.v2.Address address = 1; + + // Carries the list of object payload range to calculate homomorphic hash. + repeated Range ranges = 2; + + // Carries binary salt to XOR object payload ranges before hash calculation. + bytes salt = 3; + } + + // Body of get range hash object request message. + Body body = 1; + + // Carries request meta information. Header data is used only to regulate message + // transport and does not affect request execution. + service.v2.RequestMetaHeader meta_header = 2; + + // Carries request verification information. This header is used to authenticate + // the nodes of the message route and check the correctness of transmission. + service.v2.RequestVerificationHeader verify_header = 3; +} + +message GetRangeHashResponse { + message Body { + // Carries list of homomorphic hashes in a binary format. + repeated bytes hash_list = 1; + } + + // Body of get range hash object response message. + Body body = 1; + + // Carries response meta information. Header data is used only to regulate + // message transport and does not affect request execution. + service.v2.ResponseMetaHeader meta_header = 2; + + // Carries response verification information. This header is used to + // authenticate the nodes of the message route and check the correctness + // of transmission. + service.v2.ResponseVerificationHeader verify_header = 3; +} + diff --git a/object/v2/types.pb.go b/object/v2/types.pb.go new file mode 100644 index 0000000..bae2d04 --- /dev/null +++ b/object/v2/types.pb.go @@ -0,0 +1,1986 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: object/v2/types.proto + +package v2 + +import ( + fmt "fmt" + proto "github.com/golang/protobuf/proto" + v2 "github.com/nspcc-dev/neofs-api-go/refs/v2" + v21 "github.com/nspcc-dev/neofs-api-go/service/v2" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package + +// Type of the object payload content +type ObjectType int32 + +const ( + // Just a normal object + ObjectType_REGULAR ObjectType = 0 + // Used internally to identify deleted objects + ObjectType_TOMBSTONE ObjectType = 1 + // Identifies that the object holds StorageGroup information + ObjectType_STORAGE_GROUP ObjectType = 2 +) + +var ObjectType_name = map[int32]string{ + 0: "REGULAR", + 1: "TOMBSTONE", + 2: "STORAGE_GROUP", +} + +var ObjectType_value = map[string]int32{ + "REGULAR": 0, + "TOMBSTONE": 1, + "STORAGE_GROUP": 2, +} + +func (x ObjectType) String() string { + return proto.EnumName(ObjectType_name, int32(x)) +} + +func (ObjectType) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_666bf7c1dc0e676f, []int{0} +} + +type Header struct { + // Object's container + ContainerId *v2.ContainerID `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` + // Object's owner + OwnerId *v2.OwnerID `protobuf:"bytes,2,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"` + // Epoch when the object was created + CreationEpoch uint64 `protobuf:"varint,3,opt,name=creation_epoch,json=creationEpoch,proto3" json:"creation_epoch,omitempty"` + // Object format version. + // Effectively the version of API library used to create particular object + Version *v21.Version `protobuf:"bytes,4,opt,name=version,proto3" json:"version,omitempty"` + // Size of payload in bytes. + // 0xFFFFFFFFFFFFFFFF means `payload_length` is unknown + PayloadLength uint64 `protobuf:"varint,5,opt,name=payload_length,json=payloadLength,proto3" json:"payload_length,omitempty"` + // Hash of payload bytes + PayloadHash []byte `protobuf:"bytes,6,opt,name=payload_hash,json=payloadHash,proto3" json:"payload_hash,omitempty"` + ObjectType ObjectType `protobuf:"varint,7,opt,name=object_type,json=objectType,proto3,enum=object.v2.ObjectType" json:"object_type,omitempty"` + // Homomorphic hash of the object payload. + HomomorphicHash []byte `protobuf:"bytes,8,opt,name=homomorphic_hash,json=homomorphicHash,proto3" json:"homomorphic_hash,omitempty"` + // Session token, if it was used during Object creation. + // Need it to verify integrity and authenticity out of Request scope. + SessionToken *v21.SessionToken `protobuf:"bytes,9,opt,name=session_token,json=sessionToken,proto3" json:"session_token,omitempty"` + Attributes []*Header_Attribute `protobuf:"bytes,10,rep,name=attributes,proto3" json:"attributes,omitempty"` + // Position of the object in the split hierarchy. + Split *Header_Split `protobuf:"bytes,11,opt,name=split,proto3" json:"split,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Header) Reset() { *m = Header{} } +func (m *Header) String() string { return proto.CompactTextString(m) } +func (*Header) ProtoMessage() {} +func (*Header) Descriptor() ([]byte, []int) { + return fileDescriptor_666bf7c1dc0e676f, []int{0} +} +func (m *Header) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Header) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Header.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Header) XXX_Merge(src proto.Message) { + xxx_messageInfo_Header.Merge(m, src) +} +func (m *Header) XXX_Size() int { + return m.Size() +} +func (m *Header) XXX_DiscardUnknown() { + xxx_messageInfo_Header.DiscardUnknown(m) +} + +var xxx_messageInfo_Header proto.InternalMessageInfo + +func (m *Header) GetContainerId() *v2.ContainerID { + if m != nil { + return m.ContainerId + } + return nil +} + +func (m *Header) GetOwnerId() *v2.OwnerID { + if m != nil { + return m.OwnerId + } + return nil +} + +func (m *Header) GetCreationEpoch() uint64 { + if m != nil { + return m.CreationEpoch + } + return 0 +} + +func (m *Header) GetVersion() *v21.Version { + if m != nil { + return m.Version + } + return nil +} + +func (m *Header) GetPayloadLength() uint64 { + if m != nil { + return m.PayloadLength + } + return 0 +} + +func (m *Header) GetPayloadHash() []byte { + if m != nil { + return m.PayloadHash + } + return nil +} + +func (m *Header) GetObjectType() ObjectType { + if m != nil { + return m.ObjectType + } + return ObjectType_REGULAR +} + +func (m *Header) GetHomomorphicHash() []byte { + if m != nil { + return m.HomomorphicHash + } + return nil +} + +func (m *Header) GetSessionToken() *v21.SessionToken { + if m != nil { + return m.SessionToken + } + return nil +} + +func (m *Header) GetAttributes() []*Header_Attribute { + if m != nil { + return m.Attributes + } + return nil +} + +func (m *Header) GetSplit() *Header_Split { + if m != nil { + return m.Split + } + return nil +} + +// Attribute groups the user-defined Key-Value pairs attached to the object +type Header_Attribute struct { + // string key to the object attribute + Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + // string value of the object attribute + Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Header_Attribute) Reset() { *m = Header_Attribute{} } +func (m *Header_Attribute) String() string { return proto.CompactTextString(m) } +func (*Header_Attribute) ProtoMessage() {} +func (*Header_Attribute) Descriptor() ([]byte, []int) { + return fileDescriptor_666bf7c1dc0e676f, []int{0, 0} +} +func (m *Header_Attribute) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Header_Attribute) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Header_Attribute.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Header_Attribute) XXX_Merge(src proto.Message) { + xxx_messageInfo_Header_Attribute.Merge(m, src) +} +func (m *Header_Attribute) XXX_Size() int { + return m.Size() +} +func (m *Header_Attribute) XXX_DiscardUnknown() { + xxx_messageInfo_Header_Attribute.DiscardUnknown(m) +} + +var xxx_messageInfo_Header_Attribute proto.InternalMessageInfo + +func (m *Header_Attribute) GetKey() string { + if m != nil { + return m.Key + } + return "" +} + +func (m *Header_Attribute) GetValue() string { + if m != nil { + return m.Value + } + return "" +} + +// Information about spawning the objects through a payload splitting. +type Header_Split struct { + // Identifier of the origin object.v2. + // Parent and children objects must be within the same container.v2. + // Parent object_id is known only to the minor child. + Parent *v2.ObjectID `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"` + // Previous carries identifier of the left split neighbor. + Previous *v2.ObjectID `protobuf:"bytes,2,opt,name=previous,proto3" json:"previous,omitempty"` + // `signature` field of the parent object.v2. Used to reconstruct parent. + ParentSignature *v21.Signature `protobuf:"bytes,3,opt,name=parent_signature,json=parentSignature,proto3" json:"parent_signature,omitempty"` + // `header` field of the parent object.v2. Used to reconstruct parent. + ParentHeader *Header `protobuf:"bytes,4,opt,name=parent_header,json=parentHeader,proto3" json:"parent_header,omitempty"` + // Children carries list of identifiers of the objects generated by splitting the current. + Children []*v2.ObjectID `protobuf:"bytes,5,rep,name=children,proto3" json:"children,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Header_Split) Reset() { *m = Header_Split{} } +func (m *Header_Split) String() string { return proto.CompactTextString(m) } +func (*Header_Split) ProtoMessage() {} +func (*Header_Split) Descriptor() ([]byte, []int) { + return fileDescriptor_666bf7c1dc0e676f, []int{0, 1} +} +func (m *Header_Split) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Header_Split) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Header_Split.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Header_Split) XXX_Merge(src proto.Message) { + xxx_messageInfo_Header_Split.Merge(m, src) +} +func (m *Header_Split) XXX_Size() int { + return m.Size() +} +func (m *Header_Split) XXX_DiscardUnknown() { + xxx_messageInfo_Header_Split.DiscardUnknown(m) +} + +var xxx_messageInfo_Header_Split proto.InternalMessageInfo + +func (m *Header_Split) GetParent() *v2.ObjectID { + if m != nil { + return m.Parent + } + return nil +} + +func (m *Header_Split) GetPrevious() *v2.ObjectID { + if m != nil { + return m.Previous + } + return nil +} + +func (m *Header_Split) GetParentSignature() *v21.Signature { + if m != nil { + return m.ParentSignature + } + return nil +} + +func (m *Header_Split) GetParentHeader() *Header { + if m != nil { + return m.ParentHeader + } + return nil +} + +func (m *Header_Split) GetChildren() []*v2.ObjectID { + if m != nil { + return m.Children + } + return nil +} + +// Object structure. +type Object struct { + // Object's unique identifier. + // Object is content-addressed. It means id will change if header or payload + // changes. It's calculated as a hash of header field, which contains hash of + // object's payload + ObjectId *v2.ObjectID `protobuf:"bytes,1,opt,name=object_id,json=objectId,proto3" json:"object_id,omitempty"` + // Signed object_id + Signature *v21.Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` + // Object metadata headers + Header *Header `protobuf:"bytes,3,opt,name=header,proto3" json:"header,omitempty"` + // Payload bytes. + Payload []byte `protobuf:"bytes,4,opt,name=payload,proto3" json:"payload,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Object) Reset() { *m = Object{} } +func (m *Object) String() string { return proto.CompactTextString(m) } +func (*Object) ProtoMessage() {} +func (*Object) Descriptor() ([]byte, []int) { + return fileDescriptor_666bf7c1dc0e676f, []int{1} +} +func (m *Object) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Object) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Object.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Object) XXX_Merge(src proto.Message) { + xxx_messageInfo_Object.Merge(m, src) +} +func (m *Object) XXX_Size() int { + return m.Size() +} +func (m *Object) XXX_DiscardUnknown() { + xxx_messageInfo_Object.DiscardUnknown(m) +} + +var xxx_messageInfo_Object proto.InternalMessageInfo + +func (m *Object) GetObjectId() *v2.ObjectID { + if m != nil { + return m.ObjectId + } + return nil +} + +func (m *Object) GetSignature() *v21.Signature { + if m != nil { + return m.Signature + } + return nil +} + +func (m *Object) GetHeader() *Header { + if m != nil { + return m.Header + } + return nil +} + +func (m *Object) GetPayload() []byte { + if m != nil { + return m.Payload + } + return nil +} + +func init() { + proto.RegisterEnum("object.v2.ObjectType", ObjectType_name, ObjectType_value) + proto.RegisterType((*Header)(nil), "object.v2.Header") + proto.RegisterType((*Header_Attribute)(nil), "object.v2.Header.Attribute") + proto.RegisterType((*Header_Split)(nil), "object.v2.Header.Split") + proto.RegisterType((*Object)(nil), "object.v2.Object") +} + +func init() { proto.RegisterFile("object/v2/types.proto", fileDescriptor_666bf7c1dc0e676f) } + +var fileDescriptor_666bf7c1dc0e676f = []byte{ + // 704 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x94, 0x5f, 0x4e, 0xdb, 0x4a, + 0x14, 0xc6, 0x71, 0x42, 0xfe, 0x1d, 0x27, 0x60, 0x06, 0x22, 0xac, 0x5c, 0x29, 0xca, 0x45, 0xba, + 0x52, 0xb8, 0x28, 0x8e, 0x14, 0x24, 0xee, 0x03, 0xba, 0x52, 0x43, 0x49, 0x21, 0x12, 0x25, 0x68, + 0x12, 0xfa, 0xd0, 0x97, 0xc8, 0xb1, 0x87, 0xd8, 0x25, 0xf1, 0x58, 0xf6, 0xc4, 0x28, 0x5b, 0xe8, + 0x0a, 0xba, 0x86, 0x3e, 0x76, 0x15, 0x7d, 0xec, 0x0a, 0xaa, 0x8a, 0x6e, 0xa4, 0xf2, 0xcc, 0xd8, + 0x49, 0x0b, 0xed, 0xdb, 0xcc, 0x77, 0x7e, 0xe7, 0xcc, 0x7c, 0xc7, 0x67, 0x0c, 0x55, 0x3a, 0x79, + 0x47, 0x2c, 0xd6, 0x8e, 0x3a, 0x6d, 0xb6, 0xf4, 0x49, 0x68, 0xf8, 0x01, 0x65, 0x14, 0x95, 0x84, + 0x6c, 0x44, 0x9d, 0xda, 0x6e, 0x40, 0xee, 0xc2, 0x5f, 0xe2, 0xb5, 0x6a, 0x48, 0x82, 0xc8, 0xb5, + 0x48, 0xac, 0xcf, 0x09, 0x33, 0xa5, 0xbc, 0xbf, 0x26, 0x47, 0x24, 0x70, 0xef, 0x96, 0x22, 0x70, + 0xf0, 0x35, 0x0f, 0xf9, 0x4b, 0x62, 0xda, 0x24, 0x40, 0xff, 0x41, 0xd9, 0xa2, 0x1e, 0x33, 0x5d, + 0x8f, 0x04, 0x63, 0xd7, 0xd6, 0x95, 0x86, 0xd2, 0x54, 0x3b, 0x7b, 0x46, 0x7c, 0x8c, 0x11, 0x75, + 0x8c, 0x97, 0x49, 0xb0, 0x7f, 0x8e, 0xd5, 0x94, 0xec, 0xdb, 0xe8, 0x08, 0x8a, 0xf4, 0x41, 0x26, + 0x65, 0x78, 0x92, 0x96, 0x26, 0x0d, 0x1e, 0x44, 0x42, 0x81, 0x13, 0x7d, 0x1b, 0xfd, 0x03, 0x5b, + 0x56, 0x40, 0x4c, 0xe6, 0x52, 0x6f, 0x4c, 0x7c, 0x6a, 0x39, 0x7a, 0xb6, 0xa1, 0x34, 0x37, 0x71, + 0x25, 0x51, 0x7b, 0xb1, 0x88, 0x5a, 0x50, 0x88, 0x48, 0x10, 0xba, 0xd4, 0xd3, 0x37, 0x79, 0xc9, + 0x5d, 0x43, 0x5a, 0x88, 0xab, 0xbe, 0x11, 0x21, 0x9c, 0x30, 0x71, 0x55, 0xdf, 0x5c, 0xce, 0xa8, + 0x69, 0x8f, 0x67, 0xc4, 0x9b, 0x32, 0x47, 0xcf, 0x89, 0xaa, 0x52, 0xbd, 0xe2, 0x22, 0xfa, 0x1b, + 0xca, 0x09, 0xe6, 0x98, 0xa1, 0xa3, 0xe7, 0x1b, 0x4a, 0xb3, 0x8c, 0x55, 0xa9, 0x5d, 0x9a, 0xa1, + 0x83, 0x4e, 0x40, 0x15, 0x2d, 0x1e, 0xc7, 0x6d, 0xd5, 0x0b, 0x0d, 0xa5, 0xb9, 0xd5, 0xa9, 0x1a, + 0x69, 0xdb, 0x8d, 0x01, 0x5f, 0x8d, 0x96, 0x3e, 0xc1, 0x40, 0xd3, 0x35, 0x3a, 0x04, 0xcd, 0xa1, + 0x73, 0x3a, 0xa7, 0x81, 0xef, 0xb8, 0x96, 0x28, 0x5f, 0xe4, 0xe5, 0xb7, 0xd7, 0x74, 0x7e, 0xc4, + 0xff, 0x50, 0x09, 0x49, 0x18, 0xdf, 0x7b, 0xcc, 0xe8, 0x3d, 0xf1, 0xf4, 0x12, 0x77, 0xa8, 0xaf, + 0x3b, 0x1c, 0x0a, 0x60, 0x14, 0xc7, 0x71, 0x39, 0x5c, 0xdb, 0xa1, 0x53, 0x00, 0x93, 0xb1, 0xc0, + 0x9d, 0x2c, 0x18, 0x09, 0x75, 0x68, 0x64, 0x9b, 0x6a, 0xe7, 0xaf, 0xb5, 0x0b, 0x8a, 0xcf, 0x69, + 0x74, 0x13, 0x06, 0xaf, 0xe1, 0xa8, 0x05, 0xb9, 0xd0, 0x9f, 0xb9, 0x4c, 0x57, 0xf9, 0x99, 0xfb, + 0x4f, 0xf3, 0x86, 0x71, 0x18, 0x0b, 0xaa, 0x76, 0x0c, 0xa5, 0xb4, 0x0e, 0xd2, 0x20, 0x7b, 0x4f, + 0x96, 0x7c, 0x2e, 0x4a, 0x38, 0x5e, 0xa2, 0x3d, 0xc8, 0x45, 0xe6, 0x6c, 0x41, 0xf8, 0x67, 0x2f, + 0x61, 0xb1, 0xa9, 0xbd, 0xcf, 0x40, 0x8e, 0x57, 0x41, 0x87, 0x90, 0xf7, 0xcd, 0x80, 0x78, 0x4c, + 0x0e, 0xd3, 0xce, 0x6a, 0x2e, 0xf8, 0xb1, 0xfd, 0x73, 0x2c, 0x01, 0xd4, 0x82, 0xa2, 0x1f, 0x90, + 0xc8, 0xa5, 0x8b, 0x50, 0x0e, 0xd1, 0x33, 0x70, 0x8a, 0xa0, 0x17, 0xa0, 0x89, 0xc4, 0x71, 0xe8, + 0x4e, 0x3d, 0x93, 0x2d, 0x02, 0xc2, 0x07, 0x49, 0xed, 0x54, 0x7f, 0x6a, 0x63, 0x12, 0xc4, 0xdb, + 0x02, 0x4f, 0x05, 0x74, 0x02, 0x15, 0x59, 0xc1, 0xe1, 0xc6, 0xe5, 0x9c, 0xed, 0x3c, 0xe9, 0x08, + 0x2e, 0x0b, 0x4e, 0x3e, 0x93, 0x16, 0x14, 0x2d, 0xc7, 0x9d, 0xd9, 0x01, 0xf1, 0xf4, 0x1c, 0x6f, + 0xfe, 0x73, 0x17, 0x4d, 0x90, 0x83, 0x4f, 0x0a, 0xe4, 0x85, 0x8c, 0x0c, 0x90, 0xaf, 0x77, 0xf5, + 0xba, 0x9e, 0x4b, 0x15, 0x4c, 0xdf, 0x46, 0xc7, 0x50, 0x5a, 0x99, 0xcb, 0xfc, 0xc9, 0xdc, 0x8a, + 0x8b, 0x5b, 0x2e, 0xfd, 0x64, 0x7f, 0xe7, 0x47, 0x02, 0x48, 0x87, 0x82, 0x9c, 0x7c, 0xee, 0xbd, + 0x8c, 0x93, 0xed, 0xbf, 0xa7, 0x00, 0xab, 0x31, 0x47, 0x2a, 0x14, 0x70, 0xef, 0xe2, 0xf6, 0xaa, + 0x8b, 0xb5, 0x0d, 0x54, 0x81, 0xd2, 0x68, 0xf0, 0xfa, 0x6c, 0x38, 0x1a, 0x5c, 0xf7, 0x34, 0x05, + 0xed, 0x40, 0x65, 0x38, 0x1a, 0xe0, 0xee, 0x45, 0x6f, 0x7c, 0x81, 0x07, 0xb7, 0x37, 0x5a, 0xe6, + 0xec, 0xe6, 0xf3, 0x63, 0x5d, 0xf9, 0xf2, 0x58, 0x57, 0xbe, 0x3d, 0xd6, 0x95, 0x0f, 0xdf, 0xeb, + 0x1b, 0x6f, 0x8f, 0xa6, 0x2e, 0x73, 0x16, 0x13, 0xc3, 0xa2, 0xf3, 0xb6, 0x17, 0xfa, 0x96, 0xd5, + 0xb2, 0x49, 0xd4, 0xf6, 0x08, 0xbd, 0x0b, 0x5b, 0xa6, 0xef, 0xb6, 0xa6, 0xb4, 0x9d, 0xfe, 0xed, + 0x3e, 0x66, 0xb4, 0x6b, 0x42, 0x5f, 0x0d, 0x8d, 0xee, 0x4d, 0x5f, 0x36, 0x65, 0x92, 0xe7, 0xff, + 0xaa, 0xe3, 0x1f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xeb, 0x34, 0x17, 0x81, 0x14, 0x05, 0x00, 0x00, +} + +func (m *Header) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Header) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Header) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.Split != nil { + { + size, err := m.Split.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x5a + } + if len(m.Attributes) > 0 { + for iNdEx := len(m.Attributes) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Attributes[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x52 + } + } + if m.SessionToken != nil { + { + size, err := m.SessionToken.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x4a + } + if len(m.HomomorphicHash) > 0 { + i -= len(m.HomomorphicHash) + copy(dAtA[i:], m.HomomorphicHash) + i = encodeVarintTypes(dAtA, i, uint64(len(m.HomomorphicHash))) + i-- + dAtA[i] = 0x42 + } + if m.ObjectType != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.ObjectType)) + i-- + dAtA[i] = 0x38 + } + if len(m.PayloadHash) > 0 { + i -= len(m.PayloadHash) + copy(dAtA[i:], m.PayloadHash) + i = encodeVarintTypes(dAtA, i, uint64(len(m.PayloadHash))) + i-- + dAtA[i] = 0x32 + } + if m.PayloadLength != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.PayloadLength)) + i-- + dAtA[i] = 0x28 + } + if m.Version != nil { + { + size, err := m.Version.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + if m.CreationEpoch != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.CreationEpoch)) + i-- + dAtA[i] = 0x18 + } + if m.OwnerId != nil { + { + size, err := m.OwnerId.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.ContainerId != nil { + { + size, err := m.ContainerId.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Header_Attribute) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Header_Attribute) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Header_Attribute) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Value) > 0 { + i -= len(m.Value) + copy(dAtA[i:], m.Value) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Value))) + i-- + dAtA[i] = 0x12 + } + if len(m.Key) > 0 { + i -= len(m.Key) + copy(dAtA[i:], m.Key) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Key))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Header_Split) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Header_Split) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Header_Split) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Children) > 0 { + for iNdEx := len(m.Children) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Children[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + } + } + if m.ParentHeader != nil { + { + size, err := m.ParentHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + if m.ParentSignature != nil { + { + size, err := m.ParentSignature.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + if m.Previous != nil { + { + size, err := m.Previous.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.Parent != nil { + { + size, err := m.Parent.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Object) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Object) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Object) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Payload) > 0 { + i -= len(m.Payload) + copy(dAtA[i:], m.Payload) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Payload))) + i-- + dAtA[i] = 0x22 + } + if m.Header != nil { + { + size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + if m.Signature != nil { + { + size, err := m.Signature.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.ObjectId != nil { + { + size, err := m.ObjectId.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintTypes(dAtA []byte, offset int, v uint64) int { + offset -= sovTypes(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Header) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ContainerId != nil { + l = m.ContainerId.Size() + n += 1 + l + sovTypes(uint64(l)) + } + if m.OwnerId != nil { + l = m.OwnerId.Size() + n += 1 + l + sovTypes(uint64(l)) + } + if m.CreationEpoch != 0 { + n += 1 + sovTypes(uint64(m.CreationEpoch)) + } + if m.Version != nil { + l = m.Version.Size() + n += 1 + l + sovTypes(uint64(l)) + } + if m.PayloadLength != 0 { + n += 1 + sovTypes(uint64(m.PayloadLength)) + } + l = len(m.PayloadHash) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + if m.ObjectType != 0 { + n += 1 + sovTypes(uint64(m.ObjectType)) + } + l = len(m.HomomorphicHash) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + if m.SessionToken != nil { + l = m.SessionToken.Size() + n += 1 + l + sovTypes(uint64(l)) + } + if len(m.Attributes) > 0 { + for _, e := range m.Attributes { + l = e.Size() + n += 1 + l + sovTypes(uint64(l)) + } + } + if m.Split != nil { + l = m.Split.Size() + n += 1 + l + sovTypes(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *Header_Attribute) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Key) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.Value) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *Header_Split) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Parent != nil { + l = m.Parent.Size() + n += 1 + l + sovTypes(uint64(l)) + } + if m.Previous != nil { + l = m.Previous.Size() + n += 1 + l + sovTypes(uint64(l)) + } + if m.ParentSignature != nil { + l = m.ParentSignature.Size() + n += 1 + l + sovTypes(uint64(l)) + } + if m.ParentHeader != nil { + l = m.ParentHeader.Size() + n += 1 + l + sovTypes(uint64(l)) + } + if len(m.Children) > 0 { + for _, e := range m.Children { + l = e.Size() + n += 1 + l + sovTypes(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *Object) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ObjectId != nil { + l = m.ObjectId.Size() + n += 1 + l + sovTypes(uint64(l)) + } + if m.Signature != nil { + l = m.Signature.Size() + n += 1 + l + sovTypes(uint64(l)) + } + if m.Header != nil { + l = m.Header.Size() + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.Payload) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovTypes(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozTypes(x uint64) (n int) { + return sovTypes(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Header) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Header: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Header: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ContainerId", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.ContainerId == nil { + m.ContainerId = &v2.ContainerID{} + } + if err := m.ContainerId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OwnerId", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.OwnerId == nil { + m.OwnerId = &v2.OwnerID{} + } + if err := m.OwnerId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CreationEpoch", wireType) + } + m.CreationEpoch = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.CreationEpoch |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Version == nil { + m.Version = &v21.Version{} + } + if err := m.Version.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PayloadLength", wireType) + } + m.PayloadLength = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.PayloadLength |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PayloadHash", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PayloadHash = append(m.PayloadHash[:0], dAtA[iNdEx:postIndex]...) + if m.PayloadHash == nil { + m.PayloadHash = []byte{} + } + iNdEx = postIndex + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ObjectType", wireType) + } + m.ObjectType = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ObjectType |= ObjectType(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field HomomorphicHash", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.HomomorphicHash = append(m.HomomorphicHash[:0], dAtA[iNdEx:postIndex]...) + if m.HomomorphicHash == nil { + m.HomomorphicHash = []byte{} + } + iNdEx = postIndex + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SessionToken", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.SessionToken == nil { + m.SessionToken = &v21.SessionToken{} + } + if err := m.SessionToken.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 10: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Attributes", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Attributes = append(m.Attributes, &Header_Attribute{}) + if err := m.Attributes[len(m.Attributes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 11: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Split", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Split == nil { + m.Split = &Header_Split{} + } + if err := m.Split.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Header_Attribute) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Attribute: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Attribute: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Key = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Value = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Header_Split) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Split: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Split: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Parent", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Parent == nil { + m.Parent = &v2.ObjectID{} + } + if err := m.Parent.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Previous", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Previous == nil { + m.Previous = &v2.ObjectID{} + } + if err := m.Previous.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ParentSignature", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.ParentSignature == nil { + m.ParentSignature = &v21.Signature{} + } + if err := m.ParentSignature.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ParentHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.ParentHeader == nil { + m.ParentHeader = &Header{} + } + if err := m.ParentHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Children", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Children = append(m.Children, &v2.ObjectID{}) + if err := m.Children[len(m.Children)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Object) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Object: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Object: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ObjectId", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.ObjectId == nil { + m.ObjectId = &v2.ObjectID{} + } + if err := m.ObjectId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signature", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Signature == nil { + m.Signature = &v21.Signature{} + } + if err := m.Signature.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Header == nil { + m.Header = &Header{} + } + if err := m.Header.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Payload", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Payload = append(m.Payload[:0], dAtA[iNdEx:postIndex]...) + if m.Payload == nil { + m.Payload = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipTypes(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthTypes + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTypes + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthTypes + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthTypes = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTypes = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTypes = fmt.Errorf("proto: unexpected end of group") +) diff --git a/object/v2/types.proto b/object/v2/types.proto new file mode 100644 index 0000000..9462bc0 --- /dev/null +++ b/object/v2/types.proto @@ -0,0 +1,85 @@ +syntax = "proto3"; + +package object.v2; + +option go_package = "github.com/nspcc-dev/neofs-api-go/object/v2"; +option csharp_namespace = "NeoFS.API.Object"; + +import "refs/v2/types.proto"; +import "service/v2/meta.proto"; +import "service/v2/verify.proto"; + +// Type of the object payload content +enum ObjectType { + // Just a normal object + REGULAR = 0; + // Used internally to identify deleted objects + TOMBSTONE = 1; + // Identifies that the object holds StorageGroup information + STORAGE_GROUP = 2; +} + +message Header { + // Object's container + refs.v2.ContainerID container_id = 1; + // Object's owner + refs.v2.OwnerID owner_id = 2; + // Epoch when the object was created + uint64 creation_epoch = 3; + // Object format version. + // Effectively the version of API library used to create particular object + service.v2.Version version = 4; + // Size of payload in bytes. + // 0xFFFFFFFFFFFFFFFF means `payload_length` is unknown + uint64 payload_length = 5; + // Hash of payload bytes + bytes payload_hash = 6; + ObjectType object_type = 7; + // Homomorphic hash of the object payload. + bytes homomorphic_hash = 8; + // Session token, if it was used during Object creation. + // Need it to verify integrity and authenticity out of Request scope. + service.v2.SessionToken session_token = 9; + + // Attribute groups the user-defined Key-Value pairs attached to the object + message Attribute { + // string key to the object attribute + string key = 1; + // string value of the object attribute + string value = 2; + } + repeated Attribute attributes = 10; + + // Information about spawning the objects through a payload splitting. + message Split { + // Identifier of the origin object.v2. + // Parent and children objects must be within the same container.v2. + // Parent object_id is known only to the minor child. + refs.v2.ObjectID parent = 1; + // Previous carries identifier of the left split neighbor. + refs.v2.ObjectID previous = 2; + // `signature` field of the parent object.v2. Used to reconstruct parent. + service.v2.Signature parent_signature = 3; + // `header` field of the parent object.v2. Used to reconstruct parent. + Header parent_header = 4; + // Children carries list of identifiers of the objects generated by splitting the current. + repeated refs.v2.ObjectID children = 5; + } + // Position of the object in the split hierarchy. + Split split = 11; +} + +// Object structure. +message Object { + // Object's unique identifier. + // Object is content-addressed. It means id will change if header or payload + // changes. It's calculated as a hash of header field, which contains hash of + // object's payload + refs.v2.ObjectID object_id = 1; + // Signed object_id + service.v2.Signature signature = 2; + // Object metadata headers + Header header = 3; + // Payload bytes. + bytes payload = 4; +} diff --git a/refs/v2/types.pb.go b/refs/v2/types.pb.go new file mode 100644 index 0000000..c76f97c --- /dev/null +++ b/refs/v2/types.pb.go @@ -0,0 +1,970 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: refs/v2/types.proto + +package v2 + +import ( + fmt "fmt" + proto "github.com/golang/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package + +// Address of object (container id + object id) +type Address struct { + // container_id carries container identifier. + ContainerId *ContainerID `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` + // object_id carries object identifier. + ObjectId *ObjectID `protobuf:"bytes,2,opt,name=object_id,json=objectId,proto3" json:"object_id,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Address) Reset() { *m = Address{} } +func (m *Address) String() string { return proto.CompactTextString(m) } +func (*Address) ProtoMessage() {} +func (*Address) Descriptor() ([]byte, []int) { + return fileDescriptor_e9faa6bee2355acc, []int{0} +} +func (m *Address) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Address) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Address.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Address) XXX_Merge(src proto.Message) { + xxx_messageInfo_Address.Merge(m, src) +} +func (m *Address) XXX_Size() int { + return m.Size() +} +func (m *Address) XXX_DiscardUnknown() { + xxx_messageInfo_Address.DiscardUnknown(m) +} + +var xxx_messageInfo_Address proto.InternalMessageInfo + +func (m *Address) GetContainerId() *ContainerID { + if m != nil { + return m.ContainerId + } + return nil +} + +func (m *Address) GetObjectId() *ObjectID { + if m != nil { + return m.ObjectId + } + return nil +} + +// NeoFS object identifier. +type ObjectID struct { + // value carries the object identifier in a binary format. + Value []byte `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ObjectID) Reset() { *m = ObjectID{} } +func (m *ObjectID) String() string { return proto.CompactTextString(m) } +func (*ObjectID) ProtoMessage() {} +func (*ObjectID) Descriptor() ([]byte, []int) { + return fileDescriptor_e9faa6bee2355acc, []int{1} +} +func (m *ObjectID) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ObjectID) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ObjectID.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ObjectID) XXX_Merge(src proto.Message) { + xxx_messageInfo_ObjectID.Merge(m, src) +} +func (m *ObjectID) XXX_Size() int { + return m.Size() +} +func (m *ObjectID) XXX_DiscardUnknown() { + xxx_messageInfo_ObjectID.DiscardUnknown(m) +} + +var xxx_messageInfo_ObjectID proto.InternalMessageInfo + +func (m *ObjectID) GetValue() []byte { + if m != nil { + return m.Value + } + return nil +} + +// NeoFS container identifier. +type ContainerID struct { + // value carries the container identifier in a binary format. + Value []byte `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ContainerID) Reset() { *m = ContainerID{} } +func (m *ContainerID) String() string { return proto.CompactTextString(m) } +func (*ContainerID) ProtoMessage() {} +func (*ContainerID) Descriptor() ([]byte, []int) { + return fileDescriptor_e9faa6bee2355acc, []int{2} +} +func (m *ContainerID) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ContainerID) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ContainerID.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ContainerID) XXX_Merge(src proto.Message) { + xxx_messageInfo_ContainerID.Merge(m, src) +} +func (m *ContainerID) XXX_Size() int { + return m.Size() +} +func (m *ContainerID) XXX_DiscardUnknown() { + xxx_messageInfo_ContainerID.DiscardUnknown(m) +} + +var xxx_messageInfo_ContainerID proto.InternalMessageInfo + +func (m *ContainerID) GetValue() []byte { + if m != nil { + return m.Value + } + return nil +} + +// OwnerID group information about the owner of the NeoFS container.v2. +type OwnerID struct { + // value carries the identifier of the container owner in a binary format. + Value []byte `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *OwnerID) Reset() { *m = OwnerID{} } +func (m *OwnerID) String() string { return proto.CompactTextString(m) } +func (*OwnerID) ProtoMessage() {} +func (*OwnerID) Descriptor() ([]byte, []int) { + return fileDescriptor_e9faa6bee2355acc, []int{3} +} +func (m *OwnerID) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *OwnerID) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_OwnerID.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *OwnerID) XXX_Merge(src proto.Message) { + xxx_messageInfo_OwnerID.Merge(m, src) +} +func (m *OwnerID) XXX_Size() int { + return m.Size() +} +func (m *OwnerID) XXX_DiscardUnknown() { + xxx_messageInfo_OwnerID.DiscardUnknown(m) +} + +var xxx_messageInfo_OwnerID proto.InternalMessageInfo + +func (m *OwnerID) GetValue() []byte { + if m != nil { + return m.Value + } + return nil +} + +func init() { + proto.RegisterType((*Address)(nil), "refs.v2.Address") + proto.RegisterType((*ObjectID)(nil), "refs.v2.ObjectID") + proto.RegisterType((*ContainerID)(nil), "refs.v2.ContainerID") + proto.RegisterType((*OwnerID)(nil), "refs.v2.OwnerID") +} + +func init() { proto.RegisterFile("refs/v2/types.proto", fileDescriptor_e9faa6bee2355acc) } + +var fileDescriptor_e9faa6bee2355acc = []byte{ + // 247 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x2e, 0x4a, 0x4d, 0x2b, + 0xd6, 0x2f, 0x33, 0xd2, 0x2f, 0xa9, 0x2c, 0x48, 0x2d, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, + 0x62, 0x07, 0x09, 0xea, 0x95, 0x19, 0x29, 0x15, 0x71, 0xb1, 0x3b, 0xa6, 0xa4, 0x14, 0xa5, 0x16, + 0x17, 0x0b, 0x99, 0x73, 0xf1, 0x24, 0xe7, 0xe7, 0x95, 0x24, 0x66, 0xe6, 0xa5, 0x16, 0xc5, 0x67, + 0xa6, 0x48, 0x30, 0x2a, 0x30, 0x6a, 0x70, 0x1b, 0x89, 0xe8, 0x41, 0x95, 0xea, 0x39, 0xc3, 0x24, + 0x3d, 0x5d, 0x82, 0xb8, 0xe1, 0x2a, 0x3d, 0x53, 0x84, 0xf4, 0xb8, 0x38, 0xf3, 0x93, 0xb2, 0x52, + 0x93, 0x4b, 0x40, 0xba, 0x98, 0xc0, 0xba, 0x04, 0xe1, 0xba, 0xfc, 0xc1, 0x32, 0x9e, 0x2e, 0x41, + 0x1c, 0x10, 0x35, 0x9e, 0x29, 0x4a, 0x0a, 0x5c, 0x1c, 0x30, 0x51, 0x21, 0x11, 0x2e, 0xd6, 0xb2, + 0xc4, 0x9c, 0xd2, 0x54, 0xb0, 0x6d, 0x3c, 0x41, 0x10, 0x8e, 0x92, 0x32, 0x17, 0x37, 0x92, 0x6d, + 0x38, 0x14, 0xc9, 0x73, 0xb1, 0xfb, 0x97, 0xe3, 0x51, 0xe0, 0xe4, 0x73, 0xe2, 0x91, 0x1c, 0xe3, + 0x85, 0x47, 0x72, 0x8c, 0x0f, 0x1e, 0xc9, 0x31, 0xce, 0x78, 0x2c, 0xc7, 0x10, 0xa5, 0x99, 0x9e, + 0x59, 0x92, 0x51, 0x9a, 0xa4, 0x97, 0x9c, 0x9f, 0xab, 0x9f, 0x57, 0x5c, 0x90, 0x9c, 0xac, 0x9b, + 0x92, 0x5a, 0xa6, 0x9f, 0x97, 0x9a, 0x9f, 0x56, 0xac, 0x9b, 0x58, 0x90, 0xa9, 0x9b, 0x9e, 0xaf, + 0x0f, 0x0d, 0xad, 0x55, 0x4c, 0x7c, 0x7e, 0xa9, 0xf9, 0x6e, 0xc1, 0x7a, 0x8e, 0x01, 0x9e, 0x7a, + 0x41, 0xa9, 0x69, 0xc5, 0x49, 0x6c, 0xe0, 0x90, 0x33, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0xd2, + 0xd4, 0x5b, 0x91, 0x50, 0x01, 0x00, 0x00, +} + +func (m *Address) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Address) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Address) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.ObjectId != nil { + { + size, err := m.ObjectId.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.ContainerId != nil { + { + size, err := m.ContainerId.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *ObjectID) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ObjectID) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ObjectID) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Value) > 0 { + i -= len(m.Value) + copy(dAtA[i:], m.Value) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Value))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *ContainerID) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ContainerID) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ContainerID) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Value) > 0 { + i -= len(m.Value) + copy(dAtA[i:], m.Value) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Value))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *OwnerID) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *OwnerID) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *OwnerID) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Value) > 0 { + i -= len(m.Value) + copy(dAtA[i:], m.Value) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Value))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintTypes(dAtA []byte, offset int, v uint64) int { + offset -= sovTypes(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Address) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ContainerId != nil { + l = m.ContainerId.Size() + n += 1 + l + sovTypes(uint64(l)) + } + if m.ObjectId != nil { + l = m.ObjectId.Size() + n += 1 + l + sovTypes(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *ObjectID) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Value) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *ContainerID) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Value) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *OwnerID) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Value) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovTypes(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozTypes(x uint64) (n int) { + return sovTypes(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Address) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Address: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Address: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ContainerId", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.ContainerId == nil { + m.ContainerId = &ContainerID{} + } + if err := m.ContainerId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ObjectId", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.ObjectId == nil { + m.ObjectId = &ObjectID{} + } + if err := m.ObjectId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ObjectID) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ObjectID: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ObjectID: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Value = append(m.Value[:0], dAtA[iNdEx:postIndex]...) + if m.Value == nil { + m.Value = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ContainerID) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ContainerID: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ContainerID: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Value = append(m.Value[:0], dAtA[iNdEx:postIndex]...) + if m.Value == nil { + m.Value = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *OwnerID) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: OwnerID: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: OwnerID: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Value = append(m.Value[:0], dAtA[iNdEx:postIndex]...) + if m.Value == nil { + m.Value = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipTypes(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthTypes + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTypes + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthTypes + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthTypes = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTypes = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTypes = fmt.Errorf("proto: unexpected end of group") +) diff --git a/refs/v2/types.proto b/refs/v2/types.proto new file mode 100644 index 0000000..82049b4 --- /dev/null +++ b/refs/v2/types.proto @@ -0,0 +1,32 @@ +syntax = "proto3"; + +package refs.v2; + +option go_package = "github.com/nspcc-dev/neofs-api-go/refs/v2"; +option csharp_namespace = "NeoFS.API.Refs"; + +// Address of object (container id + object id) +message Address { + // container_id carries container identifier. + ContainerID container_id = 1; + // object_id carries object identifier. + ObjectID object_id = 2; +} + +// NeoFS object identifier. +message ObjectID { + // value carries the object identifier in a binary format. + bytes value = 1; +} + +// NeoFS container identifier. +message ContainerID { + // value carries the container identifier in a binary format. + bytes value = 1; +} + +// OwnerID group information about the owner of the NeoFS container.v2. +message OwnerID { + // value carries the identifier of the container owner in a binary format. + bytes value = 1; +} \ No newline at end of file diff --git a/service/v2/meta.pb.go b/service/v2/meta.pb.go new file mode 100644 index 0000000..34d2eb7 --- /dev/null +++ b/service/v2/meta.pb.go @@ -0,0 +1,3168 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: service/v2/meta.proto + +package v2 + +import ( + fmt "fmt" + proto "github.com/golang/protobuf/proto" + v21 "github.com/nspcc-dev/neofs-api-go/acl/v2" + v2 "github.com/nspcc-dev/neofs-api-go/refs/v2" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package + +// Verb is an enumeration of session request types +type SessionToken_Body_Verb int32 + +const ( + // Refers to object.Put RPC call + SessionToken_Body_OBJECT_PUT SessionToken_Body_Verb = 0 + // Refers to object.Get RPC call + SessionToken_Body_OBJECT_GET SessionToken_Body_Verb = 1 + // Refers to object.Head RPC call + SessionToken_Body_OBJECT_HEAD SessionToken_Body_Verb = 2 + // Refers to object.Search RPC call + SessionToken_Body_OBJECT_SEARCH SessionToken_Body_Verb = 3 + // Refers to object.Delete RPC call + SessionToken_Body_OBJECT_DELETE SessionToken_Body_Verb = 4 + // Refers to object.GetRange RPC call + SessionToken_Body_OBJECT_RANGE SessionToken_Body_Verb = 5 + // Refers to object.GetRangeHash RPC call + SessionToken_Body_OBJECT_RANGEHASH SessionToken_Body_Verb = 6 +) + +var SessionToken_Body_Verb_name = map[int32]string{ + 0: "OBJECT_PUT", + 1: "OBJECT_GET", + 2: "OBJECT_HEAD", + 3: "OBJECT_SEARCH", + 4: "OBJECT_DELETE", + 5: "OBJECT_RANGE", + 6: "OBJECT_RANGEHASH", +} + +var SessionToken_Body_Verb_value = map[string]int32{ + "OBJECT_PUT": 0, + "OBJECT_GET": 1, + "OBJECT_HEAD": 2, + "OBJECT_SEARCH": 3, + "OBJECT_DELETE": 4, + "OBJECT_RANGE": 5, + "OBJECT_RANGEHASH": 6, +} + +func (x SessionToken_Body_Verb) String() string { + return proto.EnumName(SessionToken_Body_Verb_name, int32(x)) +} + +func (SessionToken_Body_Verb) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_44cb230373b42f12, []int{3, 0, 0} +} + +type XHeader struct { + // Key of the X-Header. + Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + // Value of the X-Header. + Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *XHeader) Reset() { *m = XHeader{} } +func (m *XHeader) String() string { return proto.CompactTextString(m) } +func (*XHeader) ProtoMessage() {} +func (*XHeader) Descriptor() ([]byte, []int) { + return fileDescriptor_44cb230373b42f12, []int{0} +} +func (m *XHeader) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *XHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_XHeader.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *XHeader) XXX_Merge(src proto.Message) { + xxx_messageInfo_XHeader.Merge(m, src) +} +func (m *XHeader) XXX_Size() int { + return m.Size() +} +func (m *XHeader) XXX_DiscardUnknown() { + xxx_messageInfo_XHeader.DiscardUnknown(m) +} + +var xxx_messageInfo_XHeader proto.InternalMessageInfo + +func (m *XHeader) GetKey() string { + if m != nil { + return m.Key + } + return "" +} + +func (m *XHeader) GetValue() string { + if m != nil { + return m.Value + } + return "" +} + +// Represents API version used by node. +type Version struct { + // Major API version. + Major uint32 `protobuf:"varint,1,opt,name=major,proto3" json:"major,omitempty"` + // Minor API version. + Minor uint32 `protobuf:"varint,2,opt,name=minor,proto3" json:"minor,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Version) Reset() { *m = Version{} } +func (m *Version) String() string { return proto.CompactTextString(m) } +func (*Version) ProtoMessage() {} +func (*Version) Descriptor() ([]byte, []int) { + return fileDescriptor_44cb230373b42f12, []int{1} +} +func (m *Version) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Version) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Version.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Version) XXX_Merge(src proto.Message) { + xxx_messageInfo_Version.Merge(m, src) +} +func (m *Version) XXX_Size() int { + return m.Size() +} +func (m *Version) XXX_DiscardUnknown() { + xxx_messageInfo_Version.DiscardUnknown(m) +} + +var xxx_messageInfo_Version proto.InternalMessageInfo + +func (m *Version) GetMajor() uint32 { + if m != nil { + return m.Major + } + return 0 +} + +func (m *Version) GetMinor() uint32 { + if m != nil { + return m.Minor + } + return 0 +} + +// Lifetime parameters of the token. Filed names taken from rfc7519. +type TokenLifetime struct { + // Expiration Epoch + Exp uint64 `protobuf:"varint,1,opt,name=exp,proto3" json:"exp,omitempty"` + // Not valid before Epoch + Nbf uint64 `protobuf:"varint,2,opt,name=nbf,proto3" json:"nbf,omitempty"` + // Issued at Epoch + Iat uint64 `protobuf:"varint,3,opt,name=iat,proto3" json:"iat,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *TokenLifetime) Reset() { *m = TokenLifetime{} } +func (m *TokenLifetime) String() string { return proto.CompactTextString(m) } +func (*TokenLifetime) ProtoMessage() {} +func (*TokenLifetime) Descriptor() ([]byte, []int) { + return fileDescriptor_44cb230373b42f12, []int{2} +} +func (m *TokenLifetime) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *TokenLifetime) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_TokenLifetime.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *TokenLifetime) XXX_Merge(src proto.Message) { + xxx_messageInfo_TokenLifetime.Merge(m, src) +} +func (m *TokenLifetime) XXX_Size() int { + return m.Size() +} +func (m *TokenLifetime) XXX_DiscardUnknown() { + xxx_messageInfo_TokenLifetime.DiscardUnknown(m) +} + +var xxx_messageInfo_TokenLifetime proto.InternalMessageInfo + +func (m *TokenLifetime) GetExp() uint64 { + if m != nil { + return m.Exp + } + return 0 +} + +func (m *TokenLifetime) GetNbf() uint64 { + if m != nil { + return m.Nbf + } + return 0 +} + +func (m *TokenLifetime) GetIat() uint64 { + if m != nil { + return m.Iat + } + return 0 +} + +// NeoFS session token. +type SessionToken struct { + // Session Token body + Token *SessionToken_Body `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"` + // Signature is a signature of session token information + Signature *Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SessionToken) Reset() { *m = SessionToken{} } +func (m *SessionToken) String() string { return proto.CompactTextString(m) } +func (*SessionToken) ProtoMessage() {} +func (*SessionToken) Descriptor() ([]byte, []int) { + return fileDescriptor_44cb230373b42f12, []int{3} +} +func (m *SessionToken) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *SessionToken) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_SessionToken.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *SessionToken) XXX_Merge(src proto.Message) { + xxx_messageInfo_SessionToken.Merge(m, src) +} +func (m *SessionToken) XXX_Size() int { + return m.Size() +} +func (m *SessionToken) XXX_DiscardUnknown() { + xxx_messageInfo_SessionToken.DiscardUnknown(m) +} + +var xxx_messageInfo_SessionToken proto.InternalMessageInfo + +func (m *SessionToken) GetToken() *SessionToken_Body { + if m != nil { + return m.Token + } + return nil +} + +func (m *SessionToken) GetSignature() *Signature { + if m != nil { + return m.Signature + } + return nil +} + +type SessionToken_Body struct { + // ID is a token identifier. valid UUIDv4 represented in bytes + Id []byte `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + // OwnerID carries identifier of the session initiator. + OwnerId *v2.OwnerID `protobuf:"bytes,2,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"` + // Verb is a type of request for which the token is issued + Verb SessionToken_Body_Verb `protobuf:"varint,3,opt,name=verb,proto3,enum=service.v2.SessionToken_Body_Verb" json:"verb,omitempty"` + // Lifetime is a lifetime of the session + Lifetime *TokenLifetime `protobuf:"bytes,4,opt,name=lifetime,proto3" json:"lifetime,omitempty"` + // SessionKey is a public key of session key + SessionKey []byte `protobuf:"bytes,5,opt,name=session_key,json=sessionKey,proto3" json:"session_key,omitempty"` + // Carries context of the session. + // + // Types that are valid to be assigned to Context: + // *SessionToken_Body_ObjectAddress + Context isSessionToken_Body_Context `protobuf_oneof:"context"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SessionToken_Body) Reset() { *m = SessionToken_Body{} } +func (m *SessionToken_Body) String() string { return proto.CompactTextString(m) } +func (*SessionToken_Body) ProtoMessage() {} +func (*SessionToken_Body) Descriptor() ([]byte, []int) { + return fileDescriptor_44cb230373b42f12, []int{3, 0} +} +func (m *SessionToken_Body) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *SessionToken_Body) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_SessionToken_Body.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *SessionToken_Body) XXX_Merge(src proto.Message) { + xxx_messageInfo_SessionToken_Body.Merge(m, src) +} +func (m *SessionToken_Body) XXX_Size() int { + return m.Size() +} +func (m *SessionToken_Body) XXX_DiscardUnknown() { + xxx_messageInfo_SessionToken_Body.DiscardUnknown(m) +} + +var xxx_messageInfo_SessionToken_Body proto.InternalMessageInfo + +type isSessionToken_Body_Context interface { + isSessionToken_Body_Context() + MarshalTo([]byte) (int, error) + Size() int +} + +type SessionToken_Body_ObjectAddress struct { + ObjectAddress *v2.Address `protobuf:"bytes,6,opt,name=object_address,json=objectAddress,proto3,oneof" json:"object_address,omitempty"` +} + +func (*SessionToken_Body_ObjectAddress) isSessionToken_Body_Context() {} + +func (m *SessionToken_Body) GetContext() isSessionToken_Body_Context { + if m != nil { + return m.Context + } + return nil +} + +func (m *SessionToken_Body) GetId() []byte { + if m != nil { + return m.Id + } + return nil +} + +func (m *SessionToken_Body) GetOwnerId() *v2.OwnerID { + if m != nil { + return m.OwnerId + } + return nil +} + +func (m *SessionToken_Body) GetVerb() SessionToken_Body_Verb { + if m != nil { + return m.Verb + } + return SessionToken_Body_OBJECT_PUT +} + +func (m *SessionToken_Body) GetLifetime() *TokenLifetime { + if m != nil { + return m.Lifetime + } + return nil +} + +func (m *SessionToken_Body) GetSessionKey() []byte { + if m != nil { + return m.SessionKey + } + return nil +} + +func (m *SessionToken_Body) GetObjectAddress() *v2.Address { + if x, ok := m.GetContext().(*SessionToken_Body_ObjectAddress); ok { + return x.ObjectAddress + } + return nil +} + +// XXX_OneofWrappers is for the internal use of the proto package. +func (*SessionToken_Body) XXX_OneofWrappers() []interface{} { + return []interface{}{ + (*SessionToken_Body_ObjectAddress)(nil), + } +} + +// BearerToken has information about request ACL rules with limited lifetime +type BearerToken struct { + // Bearer Token body + Token *BearerToken_Body `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"` + // Signature of BearerToken body + Signature *Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *BearerToken) Reset() { *m = BearerToken{} } +func (m *BearerToken) String() string { return proto.CompactTextString(m) } +func (*BearerToken) ProtoMessage() {} +func (*BearerToken) Descriptor() ([]byte, []int) { + return fileDescriptor_44cb230373b42f12, []int{4} +} +func (m *BearerToken) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *BearerToken) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_BearerToken.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *BearerToken) XXX_Merge(src proto.Message) { + xxx_messageInfo_BearerToken.Merge(m, src) +} +func (m *BearerToken) XXX_Size() int { + return m.Size() +} +func (m *BearerToken) XXX_DiscardUnknown() { + xxx_messageInfo_BearerToken.DiscardUnknown(m) +} + +var xxx_messageInfo_BearerToken proto.InternalMessageInfo + +func (m *BearerToken) GetToken() *BearerToken_Body { + if m != nil { + return m.Token + } + return nil +} + +func (m *BearerToken) GetSignature() *Signature { + if m != nil { + return m.Signature + } + return nil +} + +type BearerToken_Body struct { + // EACLTable carries table of extended ACL rules + EaclTable *v21.EACLTable `protobuf:"bytes,1,opt,name=eacl_table,json=eaclTable,proto3" json:"eacl_table,omitempty"` + // OwnerID carries identifier of the token owner + OwnerId *v2.OwnerID `protobuf:"bytes,2,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"` + // Token expiration and valid time period parameters + Lifetime *TokenLifetime `protobuf:"bytes,3,opt,name=lifetime,proto3" json:"lifetime,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *BearerToken_Body) Reset() { *m = BearerToken_Body{} } +func (m *BearerToken_Body) String() string { return proto.CompactTextString(m) } +func (*BearerToken_Body) ProtoMessage() {} +func (*BearerToken_Body) Descriptor() ([]byte, []int) { + return fileDescriptor_44cb230373b42f12, []int{4, 0} +} +func (m *BearerToken_Body) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *BearerToken_Body) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_BearerToken_Body.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *BearerToken_Body) XXX_Merge(src proto.Message) { + xxx_messageInfo_BearerToken_Body.Merge(m, src) +} +func (m *BearerToken_Body) XXX_Size() int { + return m.Size() +} +func (m *BearerToken_Body) XXX_DiscardUnknown() { + xxx_messageInfo_BearerToken_Body.DiscardUnknown(m) +} + +var xxx_messageInfo_BearerToken_Body proto.InternalMessageInfo + +func (m *BearerToken_Body) GetEaclTable() *v21.EACLTable { + if m != nil { + return m.EaclTable + } + return nil +} + +func (m *BearerToken_Body) GetOwnerId() *v2.OwnerID { + if m != nil { + return m.OwnerId + } + return nil +} + +func (m *BearerToken_Body) GetLifetime() *TokenLifetime { + if m != nil { + return m.Lifetime + } + return nil +} + +// Information about the request +type RequestMetaHeader struct { + // Client API version. + Version *Version `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` + // Client local epoch number. Set to 0 if unknown. + Epoch uint64 `protobuf:"varint,2,opt,name=epoch,proto3" json:"epoch,omitempty"` + // Maximum number of nodes in the request route. + Ttl uint32 `protobuf:"varint,3,opt,name=ttl,proto3" json:"ttl,omitempty"` + // Request X-Headers. + XHeaders []*XHeader `protobuf:"bytes,4,rep,name=x_headers,json=xHeaders,proto3" json:"x_headers,omitempty"` + // Token is a token of the session within which the request is sent + Token *SessionToken `protobuf:"bytes,5,opt,name=token,proto3" json:"token,omitempty"` + // Bearer is a Bearer token of the request + Bearer *BearerToken `protobuf:"bytes,6,opt,name=bearer,proto3" json:"bearer,omitempty"` + // RequestMetaHeader of the origin request. + Origin *RequestMetaHeader `protobuf:"bytes,7,opt,name=origin,proto3" json:"origin,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *RequestMetaHeader) Reset() { *m = RequestMetaHeader{} } +func (m *RequestMetaHeader) String() string { return proto.CompactTextString(m) } +func (*RequestMetaHeader) ProtoMessage() {} +func (*RequestMetaHeader) Descriptor() ([]byte, []int) { + return fileDescriptor_44cb230373b42f12, []int{5} +} +func (m *RequestMetaHeader) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RequestMetaHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_RequestMetaHeader.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *RequestMetaHeader) XXX_Merge(src proto.Message) { + xxx_messageInfo_RequestMetaHeader.Merge(m, src) +} +func (m *RequestMetaHeader) XXX_Size() int { + return m.Size() +} +func (m *RequestMetaHeader) XXX_DiscardUnknown() { + xxx_messageInfo_RequestMetaHeader.DiscardUnknown(m) +} + +var xxx_messageInfo_RequestMetaHeader proto.InternalMessageInfo + +func (m *RequestMetaHeader) GetVersion() *Version { + if m != nil { + return m.Version + } + return nil +} + +func (m *RequestMetaHeader) GetEpoch() uint64 { + if m != nil { + return m.Epoch + } + return 0 +} + +func (m *RequestMetaHeader) GetTtl() uint32 { + if m != nil { + return m.Ttl + } + return 0 +} + +func (m *RequestMetaHeader) GetXHeaders() []*XHeader { + if m != nil { + return m.XHeaders + } + return nil +} + +func (m *RequestMetaHeader) GetToken() *SessionToken { + if m != nil { + return m.Token + } + return nil +} + +func (m *RequestMetaHeader) GetBearer() *BearerToken { + if m != nil { + return m.Bearer + } + return nil +} + +func (m *RequestMetaHeader) GetOrigin() *RequestMetaHeader { + if m != nil { + return m.Origin + } + return nil +} + +// Information about the response +type ResponseMetaHeader struct { + // Server API version. + Version *Version `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` + // Server local epoch number. + Epoch uint64 `protobuf:"varint,2,opt,name=epoch,proto3" json:"epoch,omitempty"` + // Maximum number of nodes in the response route. + Ttl uint32 `protobuf:"varint,3,opt,name=ttl,proto3" json:"ttl,omitempty"` + // Response X-Headers. + XHeaders []*XHeader `protobuf:"bytes,4,rep,name=x_headers,json=xHeaders,proto3" json:"x_headers,omitempty"` + // Carries response meta header of the origin response. + Origin *ResponseMetaHeader `protobuf:"bytes,5,opt,name=origin,proto3" json:"origin,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ResponseMetaHeader) Reset() { *m = ResponseMetaHeader{} } +func (m *ResponseMetaHeader) String() string { return proto.CompactTextString(m) } +func (*ResponseMetaHeader) ProtoMessage() {} +func (*ResponseMetaHeader) Descriptor() ([]byte, []int) { + return fileDescriptor_44cb230373b42f12, []int{6} +} +func (m *ResponseMetaHeader) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ResponseMetaHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ResponseMetaHeader.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ResponseMetaHeader) XXX_Merge(src proto.Message) { + xxx_messageInfo_ResponseMetaHeader.Merge(m, src) +} +func (m *ResponseMetaHeader) XXX_Size() int { + return m.Size() +} +func (m *ResponseMetaHeader) XXX_DiscardUnknown() { + xxx_messageInfo_ResponseMetaHeader.DiscardUnknown(m) +} + +var xxx_messageInfo_ResponseMetaHeader proto.InternalMessageInfo + +func (m *ResponseMetaHeader) GetVersion() *Version { + if m != nil { + return m.Version + } + return nil +} + +func (m *ResponseMetaHeader) GetEpoch() uint64 { + if m != nil { + return m.Epoch + } + return 0 +} + +func (m *ResponseMetaHeader) GetTtl() uint32 { + if m != nil { + return m.Ttl + } + return 0 +} + +func (m *ResponseMetaHeader) GetXHeaders() []*XHeader { + if m != nil { + return m.XHeaders + } + return nil +} + +func (m *ResponseMetaHeader) GetOrigin() *ResponseMetaHeader { + if m != nil { + return m.Origin + } + return nil +} + +func init() { + proto.RegisterEnum("service.v2.SessionToken_Body_Verb", SessionToken_Body_Verb_name, SessionToken_Body_Verb_value) + proto.RegisterType((*XHeader)(nil), "service.v2.XHeader") + proto.RegisterType((*Version)(nil), "service.v2.Version") + proto.RegisterType((*TokenLifetime)(nil), "service.v2.TokenLifetime") + proto.RegisterType((*SessionToken)(nil), "service.v2.SessionToken") + proto.RegisterType((*SessionToken_Body)(nil), "service.v2.SessionToken.Body") + proto.RegisterType((*BearerToken)(nil), "service.v2.BearerToken") + proto.RegisterType((*BearerToken_Body)(nil), "service.v2.BearerToken.Body") + proto.RegisterType((*RequestMetaHeader)(nil), "service.v2.RequestMetaHeader") + proto.RegisterType((*ResponseMetaHeader)(nil), "service.v2.ResponseMetaHeader") +} + +func init() { proto.RegisterFile("service/v2/meta.proto", fileDescriptor_44cb230373b42f12) } + +var fileDescriptor_44cb230373b42f12 = []byte{ + // 778 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x55, 0x4f, 0x6f, 0x1b, 0x45, + 0x14, 0xcf, 0xda, 0x6b, 0x3b, 0x7e, 0x8e, 0xc3, 0x66, 0xda, 0xaa, 0x26, 0x02, 0x53, 0xed, 0x09, + 0x09, 0xb2, 0x2e, 0x8e, 0x52, 0x89, 0xa3, 0x9d, 0x2c, 0x75, 0x20, 0xb4, 0xd5, 0xd8, 0x54, 0x88, + 0x8b, 0xb5, 0xde, 0x7d, 0x4e, 0xa6, 0x75, 0x76, 0xcc, 0xcc, 0x64, 0x89, 0x3f, 0x00, 0x1f, 0x01, + 0x89, 0x43, 0x2f, 0x5c, 0x39, 0xf3, 0x21, 0x38, 0x72, 0xe1, 0x8e, 0xc2, 0x17, 0x41, 0xf3, 0xc7, + 0xcd, 0x26, 0x55, 0x11, 0x88, 0x0b, 0xb7, 0x37, 0xbf, 0xf7, 0x7b, 0xff, 0xdf, 0xdb, 0x85, 0x7b, + 0x12, 0x45, 0xc1, 0x52, 0xec, 0x15, 0xfd, 0xde, 0x39, 0xaa, 0x24, 0x5a, 0x0a, 0xae, 0x38, 0x01, + 0x07, 0x47, 0x45, 0x7f, 0x97, 0x24, 0xe9, 0x42, 0xab, 0xd5, 0x6a, 0x89, 0xd2, 0xea, 0x77, 0xef, + 0x08, 0x9c, 0xcb, 0xdb, 0xe0, 0xfd, 0x92, 0xaf, 0x02, 0x05, 0x9b, 0xaf, 0xac, 0x22, 0xfc, 0x04, + 0x1a, 0x5f, 0x8f, 0x30, 0xc9, 0x50, 0x90, 0x00, 0xaa, 0x2f, 0x71, 0xd5, 0xf1, 0x1e, 0x78, 0x1f, + 0x36, 0xa9, 0x16, 0xc9, 0x5d, 0xa8, 0x15, 0xc9, 0xe2, 0x02, 0x3b, 0x15, 0x83, 0xd9, 0x47, 0x78, + 0x00, 0x8d, 0xe7, 0x28, 0x24, 0xe3, 0xb9, 0x26, 0x9c, 0x27, 0x2f, 0xb8, 0x30, 0x46, 0x6d, 0x6a, + 0x1f, 0x06, 0x65, 0x39, 0x17, 0xc6, 0x4c, 0xa3, 0xfa, 0x11, 0xc6, 0xd0, 0x9e, 0xf0, 0x97, 0x98, + 0x9f, 0xb0, 0x39, 0x2a, 0x76, 0x8e, 0x3a, 0x1e, 0x5e, 0x2e, 0x8d, 0xa9, 0x4f, 0xb5, 0xa8, 0x91, + 0x7c, 0x36, 0x37, 0x66, 0x3e, 0xd5, 0xa2, 0x46, 0x58, 0xa2, 0x3a, 0x55, 0x8b, 0xb0, 0x44, 0x85, + 0xaf, 0x7c, 0xd8, 0x1a, 0xa3, 0xd4, 0xe1, 0x8d, 0x3b, 0xb2, 0x0f, 0x35, 0xa5, 0x05, 0xe3, 0xa8, + 0xd5, 0x7f, 0x3f, 0xba, 0xee, 0x4f, 0x54, 0x26, 0x46, 0x43, 0x9e, 0xad, 0xa8, 0xe5, 0x92, 0x7d, + 0x68, 0x4a, 0x76, 0x9a, 0x27, 0xea, 0x42, 0xd8, 0xea, 0x5a, 0xfd, 0x7b, 0x37, 0x0c, 0xd7, 0x4a, + 0x7a, 0xcd, 0xdb, 0xfd, 0xa9, 0x0a, 0xbe, 0x76, 0x42, 0xb6, 0xa1, 0xc2, 0x32, 0x13, 0x6f, 0x8b, + 0x56, 0x58, 0x46, 0x3e, 0x82, 0x4d, 0xfe, 0x5d, 0x8e, 0x62, 0xca, 0x32, 0xe7, 0x2c, 0x88, 0xf4, + 0x14, 0xb4, 0xa7, 0xa7, 0x5a, 0x71, 0x7c, 0x44, 0x1b, 0x86, 0x71, 0x9c, 0x91, 0x47, 0xe0, 0x17, + 0x28, 0x66, 0xa6, 0xa6, 0xed, 0x7e, 0xf8, 0xb7, 0xe9, 0x46, 0xcf, 0x51, 0xcc, 0xa8, 0xe1, 0x93, + 0x03, 0xd8, 0x5c, 0xb8, 0xd6, 0x75, 0x7c, 0x13, 0xe4, 0xdd, 0xb2, 0xed, 0x8d, 0xde, 0xd2, 0xd7, + 0x54, 0xf2, 0x01, 0xb4, 0xa4, 0x75, 0x3b, 0xd5, 0xd3, 0xad, 0x99, 0xa4, 0xc1, 0x41, 0x5f, 0xe0, + 0x8a, 0x7c, 0x0a, 0xdb, 0x7c, 0xf6, 0x02, 0x53, 0x35, 0x4d, 0xb2, 0x4c, 0xa0, 0x94, 0x9d, 0xfa, + 0xad, 0x12, 0x06, 0x16, 0x1f, 0x6d, 0xd0, 0xb6, 0x65, 0x3a, 0x20, 0xfc, 0xde, 0x03, 0x5f, 0x67, + 0x48, 0xb6, 0x01, 0x9e, 0x0e, 0x3f, 0x8f, 0x0f, 0x27, 0xd3, 0x67, 0x5f, 0x4d, 0x82, 0x8d, 0xd2, + 0xfb, 0x71, 0x3c, 0x09, 0x3c, 0xf2, 0x0e, 0xb4, 0xdc, 0x7b, 0x14, 0x0f, 0x8e, 0x82, 0x0a, 0xd9, + 0x81, 0xb6, 0x03, 0xc6, 0xf1, 0x80, 0x1e, 0x8e, 0x82, 0x6a, 0x09, 0x3a, 0x8a, 0x4f, 0xe2, 0x49, + 0x1c, 0xf8, 0x24, 0x80, 0x2d, 0x07, 0xd1, 0xc1, 0x93, 0xc7, 0x71, 0x50, 0x23, 0x77, 0x21, 0x28, + 0x23, 0xa3, 0xc1, 0x78, 0x14, 0xd4, 0x87, 0x4d, 0x68, 0xa4, 0x3c, 0x57, 0x78, 0xa9, 0xc2, 0x1f, + 0x2a, 0xd0, 0x1a, 0x62, 0x22, 0x50, 0xd8, 0xed, 0xe8, 0xdf, 0xdc, 0x8e, 0xf7, 0xca, 0x2d, 0x2b, + 0xf1, 0xfe, 0xfb, 0x72, 0xbc, 0xf2, 0xdc, 0x72, 0x3c, 0x04, 0xc0, 0x24, 0x5d, 0x4c, 0x55, 0x32, + 0x5b, 0xa0, 0x0b, 0xbb, 0x13, 0x25, 0xe9, 0x42, 0x9b, 0xc6, 0x83, 0xc3, 0x93, 0x89, 0x56, 0xd0, + 0xa6, 0x26, 0x19, 0xf1, 0xdf, 0xad, 0x4f, 0x79, 0x0d, 0xaa, 0xff, 0x78, 0x0d, 0xc2, 0x5f, 0x2a, + 0xb0, 0x43, 0xf1, 0xdb, 0x0b, 0x94, 0xea, 0x4b, 0x54, 0x89, 0x3b, 0xf9, 0x3d, 0x68, 0x14, 0xf6, + 0x94, 0x5d, 0xa2, 0x77, 0xca, 0xbe, 0xdc, 0x95, 0xd3, 0x35, 0x47, 0x1f, 0x36, 0x2e, 0x79, 0x7a, + 0xe6, 0x2e, 0xd4, 0x3e, 0xf4, 0x8d, 0x2a, 0xb5, 0x30, 0xc9, 0xb4, 0xa9, 0x16, 0xc9, 0x43, 0x68, + 0x5e, 0x4e, 0xcf, 0x4c, 0x08, 0xd9, 0xf1, 0x1f, 0x54, 0x6f, 0x3b, 0x76, 0x5f, 0x1c, 0xba, 0x79, + 0x69, 0x05, 0x49, 0xa2, 0xf5, 0x98, 0x6a, 0x26, 0x8d, 0xce, 0xdb, 0xae, 0x62, 0x3d, 0xa2, 0x1e, + 0xd4, 0x67, 0x66, 0x7a, 0x6e, 0x59, 0xef, 0xbf, 0x65, 0xae, 0xd4, 0xd1, 0xc8, 0x01, 0xd4, 0xb9, + 0x60, 0xa7, 0x2c, 0xef, 0x34, 0xde, 0xfc, 0x4c, 0xbc, 0xd1, 0x18, 0xea, 0xc8, 0xe1, 0xef, 0x1e, + 0x10, 0x8a, 0x72, 0xc9, 0x73, 0x89, 0xff, 0xc7, 0xbe, 0x3d, 0x7a, 0x5d, 0x96, 0x6d, 0x5c, 0xf7, + 0x66, 0x59, 0xb7, 0x13, 0x5f, 0xd7, 0x35, 0xa4, 0xbf, 0x5e, 0x75, 0xbd, 0xdf, 0xae, 0xba, 0xde, + 0x1f, 0x57, 0x5d, 0xef, 0xc7, 0x3f, 0xbb, 0x1b, 0xdf, 0x7c, 0x7c, 0xca, 0xd4, 0xd9, 0xc5, 0x2c, + 0x4a, 0xf9, 0x79, 0x2f, 0x97, 0xcb, 0x34, 0xdd, 0xcb, 0xb0, 0xe8, 0xe5, 0xc8, 0xe7, 0x72, 0x2f, + 0x59, 0xb2, 0xbd, 0x53, 0xde, 0xbb, 0xfe, 0x87, 0xfc, 0x5c, 0xd9, 0x79, 0x82, 0xfc, 0xb3, 0x71, + 0x34, 0x78, 0x76, 0x1c, 0x8d, 0x2d, 0x3c, 0xab, 0x9b, 0x3f, 0xca, 0xfe, 0x5f, 0x01, 0x00, 0x00, + 0xff, 0xff, 0x35, 0x2b, 0x57, 0xef, 0xb8, 0x06, 0x00, 0x00, +} + +func (m *XHeader) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *XHeader) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *XHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Value) > 0 { + i -= len(m.Value) + copy(dAtA[i:], m.Value) + i = encodeVarintMeta(dAtA, i, uint64(len(m.Value))) + i-- + dAtA[i] = 0x12 + } + if len(m.Key) > 0 { + i -= len(m.Key) + copy(dAtA[i:], m.Key) + i = encodeVarintMeta(dAtA, i, uint64(len(m.Key))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Version) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Version) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Version) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.Minor != 0 { + i = encodeVarintMeta(dAtA, i, uint64(m.Minor)) + i-- + dAtA[i] = 0x10 + } + if m.Major != 0 { + i = encodeVarintMeta(dAtA, i, uint64(m.Major)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *TokenLifetime) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *TokenLifetime) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TokenLifetime) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.Iat != 0 { + i = encodeVarintMeta(dAtA, i, uint64(m.Iat)) + i-- + dAtA[i] = 0x18 + } + if m.Nbf != 0 { + i = encodeVarintMeta(dAtA, i, uint64(m.Nbf)) + i-- + dAtA[i] = 0x10 + } + if m.Exp != 0 { + i = encodeVarintMeta(dAtA, i, uint64(m.Exp)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *SessionToken) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *SessionToken) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *SessionToken) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.Signature != nil { + { + size, err := m.Signature.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintMeta(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.Token != nil { + { + size, err := m.Token.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintMeta(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *SessionToken_Body) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *SessionToken_Body) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *SessionToken_Body) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.Context != nil { + { + size := m.Context.Size() + i -= size + if _, err := m.Context.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + } + } + if len(m.SessionKey) > 0 { + i -= len(m.SessionKey) + copy(dAtA[i:], m.SessionKey) + i = encodeVarintMeta(dAtA, i, uint64(len(m.SessionKey))) + i-- + dAtA[i] = 0x2a + } + if m.Lifetime != nil { + { + size, err := m.Lifetime.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintMeta(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + if m.Verb != 0 { + i = encodeVarintMeta(dAtA, i, uint64(m.Verb)) + i-- + dAtA[i] = 0x18 + } + if m.OwnerId != nil { + { + size, err := m.OwnerId.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintMeta(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.Id) > 0 { + i -= len(m.Id) + copy(dAtA[i:], m.Id) + i = encodeVarintMeta(dAtA, i, uint64(len(m.Id))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *SessionToken_Body_ObjectAddress) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *SessionToken_Body_ObjectAddress) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.ObjectAddress != nil { + { + size, err := m.ObjectAddress.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintMeta(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + } + return len(dAtA) - i, nil +} +func (m *BearerToken) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *BearerToken) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BearerToken) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.Signature != nil { + { + size, err := m.Signature.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintMeta(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.Token != nil { + { + size, err := m.Token.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintMeta(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *BearerToken_Body) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *BearerToken_Body) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BearerToken_Body) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.Lifetime != nil { + { + size, err := m.Lifetime.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintMeta(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + if m.OwnerId != nil { + { + size, err := m.OwnerId.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintMeta(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.EaclTable != nil { + { + size, err := m.EaclTable.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintMeta(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *RequestMetaHeader) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *RequestMetaHeader) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RequestMetaHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.Origin != nil { + { + size, err := m.Origin.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintMeta(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3a + } + if m.Bearer != nil { + { + size, err := m.Bearer.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintMeta(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + } + if m.Token != nil { + { + size, err := m.Token.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintMeta(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + } + if len(m.XHeaders) > 0 { + for iNdEx := len(m.XHeaders) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.XHeaders[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintMeta(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + } + if m.Ttl != 0 { + i = encodeVarintMeta(dAtA, i, uint64(m.Ttl)) + i-- + dAtA[i] = 0x18 + } + if m.Epoch != 0 { + i = encodeVarintMeta(dAtA, i, uint64(m.Epoch)) + i-- + dAtA[i] = 0x10 + } + if m.Version != nil { + { + size, err := m.Version.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintMeta(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *ResponseMetaHeader) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ResponseMetaHeader) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ResponseMetaHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.Origin != nil { + { + size, err := m.Origin.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintMeta(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + } + if len(m.XHeaders) > 0 { + for iNdEx := len(m.XHeaders) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.XHeaders[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintMeta(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + } + if m.Ttl != 0 { + i = encodeVarintMeta(dAtA, i, uint64(m.Ttl)) + i-- + dAtA[i] = 0x18 + } + if m.Epoch != 0 { + i = encodeVarintMeta(dAtA, i, uint64(m.Epoch)) + i-- + dAtA[i] = 0x10 + } + if m.Version != nil { + { + size, err := m.Version.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintMeta(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintMeta(dAtA []byte, offset int, v uint64) int { + offset -= sovMeta(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *XHeader) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Key) + if l > 0 { + n += 1 + l + sovMeta(uint64(l)) + } + l = len(m.Value) + if l > 0 { + n += 1 + l + sovMeta(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *Version) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Major != 0 { + n += 1 + sovMeta(uint64(m.Major)) + } + if m.Minor != 0 { + n += 1 + sovMeta(uint64(m.Minor)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *TokenLifetime) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Exp != 0 { + n += 1 + sovMeta(uint64(m.Exp)) + } + if m.Nbf != 0 { + n += 1 + sovMeta(uint64(m.Nbf)) + } + if m.Iat != 0 { + n += 1 + sovMeta(uint64(m.Iat)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *SessionToken) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Token != nil { + l = m.Token.Size() + n += 1 + l + sovMeta(uint64(l)) + } + if m.Signature != nil { + l = m.Signature.Size() + n += 1 + l + sovMeta(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *SessionToken_Body) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Id) + if l > 0 { + n += 1 + l + sovMeta(uint64(l)) + } + if m.OwnerId != nil { + l = m.OwnerId.Size() + n += 1 + l + sovMeta(uint64(l)) + } + if m.Verb != 0 { + n += 1 + sovMeta(uint64(m.Verb)) + } + if m.Lifetime != nil { + l = m.Lifetime.Size() + n += 1 + l + sovMeta(uint64(l)) + } + l = len(m.SessionKey) + if l > 0 { + n += 1 + l + sovMeta(uint64(l)) + } + if m.Context != nil { + n += m.Context.Size() + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *SessionToken_Body_ObjectAddress) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ObjectAddress != nil { + l = m.ObjectAddress.Size() + n += 1 + l + sovMeta(uint64(l)) + } + return n +} +func (m *BearerToken) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Token != nil { + l = m.Token.Size() + n += 1 + l + sovMeta(uint64(l)) + } + if m.Signature != nil { + l = m.Signature.Size() + n += 1 + l + sovMeta(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *BearerToken_Body) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.EaclTable != nil { + l = m.EaclTable.Size() + n += 1 + l + sovMeta(uint64(l)) + } + if m.OwnerId != nil { + l = m.OwnerId.Size() + n += 1 + l + sovMeta(uint64(l)) + } + if m.Lifetime != nil { + l = m.Lifetime.Size() + n += 1 + l + sovMeta(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *RequestMetaHeader) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Version != nil { + l = m.Version.Size() + n += 1 + l + sovMeta(uint64(l)) + } + if m.Epoch != 0 { + n += 1 + sovMeta(uint64(m.Epoch)) + } + if m.Ttl != 0 { + n += 1 + sovMeta(uint64(m.Ttl)) + } + if len(m.XHeaders) > 0 { + for _, e := range m.XHeaders { + l = e.Size() + n += 1 + l + sovMeta(uint64(l)) + } + } + if m.Token != nil { + l = m.Token.Size() + n += 1 + l + sovMeta(uint64(l)) + } + if m.Bearer != nil { + l = m.Bearer.Size() + n += 1 + l + sovMeta(uint64(l)) + } + if m.Origin != nil { + l = m.Origin.Size() + n += 1 + l + sovMeta(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *ResponseMetaHeader) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Version != nil { + l = m.Version.Size() + n += 1 + l + sovMeta(uint64(l)) + } + if m.Epoch != 0 { + n += 1 + sovMeta(uint64(m.Epoch)) + } + if m.Ttl != 0 { + n += 1 + sovMeta(uint64(m.Ttl)) + } + if len(m.XHeaders) > 0 { + for _, e := range m.XHeaders { + l = e.Size() + n += 1 + l + sovMeta(uint64(l)) + } + } + if m.Origin != nil { + l = m.Origin.Size() + n += 1 + l + sovMeta(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovMeta(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozMeta(x uint64) (n int) { + return sovMeta(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *XHeader) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMeta + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: XHeader: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: XHeader: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMeta + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthMeta + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthMeta + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Key = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMeta + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthMeta + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthMeta + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Value = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipMeta(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthMeta + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthMeta + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Version) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMeta + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Version: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Version: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Major", wireType) + } + m.Major = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMeta + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Major |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Minor", wireType) + } + m.Minor = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMeta + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Minor |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipMeta(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthMeta + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthMeta + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TokenLifetime) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMeta + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: TokenLifetime: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TokenLifetime: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Exp", wireType) + } + m.Exp = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMeta + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Exp |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Nbf", wireType) + } + m.Nbf = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMeta + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Nbf |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Iat", wireType) + } + m.Iat = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMeta + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Iat |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipMeta(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthMeta + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthMeta + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *SessionToken) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMeta + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: SessionToken: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SessionToken: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Token", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMeta + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthMeta + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthMeta + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Token == nil { + m.Token = &SessionToken_Body{} + } + if err := m.Token.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signature", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMeta + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthMeta + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthMeta + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Signature == nil { + m.Signature = &Signature{} + } + if err := m.Signature.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipMeta(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthMeta + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthMeta + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *SessionToken_Body) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMeta + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Body: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Body: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMeta + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthMeta + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthMeta + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Id = append(m.Id[:0], dAtA[iNdEx:postIndex]...) + if m.Id == nil { + m.Id = []byte{} + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OwnerId", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMeta + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthMeta + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthMeta + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.OwnerId == nil { + m.OwnerId = &v2.OwnerID{} + } + if err := m.OwnerId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Verb", wireType) + } + m.Verb = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMeta + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Verb |= SessionToken_Body_Verb(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Lifetime", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMeta + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthMeta + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthMeta + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Lifetime == nil { + m.Lifetime = &TokenLifetime{} + } + if err := m.Lifetime.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SessionKey", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMeta + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthMeta + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthMeta + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SessionKey = append(m.SessionKey[:0], dAtA[iNdEx:postIndex]...) + if m.SessionKey == nil { + m.SessionKey = []byte{} + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ObjectAddress", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMeta + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthMeta + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthMeta + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &v2.Address{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Context = &SessionToken_Body_ObjectAddress{v} + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipMeta(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthMeta + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthMeta + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *BearerToken) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMeta + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: BearerToken: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BearerToken: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Token", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMeta + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthMeta + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthMeta + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Token == nil { + m.Token = &BearerToken_Body{} + } + if err := m.Token.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signature", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMeta + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthMeta + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthMeta + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Signature == nil { + m.Signature = &Signature{} + } + if err := m.Signature.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipMeta(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthMeta + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthMeta + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *BearerToken_Body) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMeta + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Body: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Body: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field EaclTable", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMeta + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthMeta + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthMeta + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.EaclTable == nil { + m.EaclTable = &v21.EACLTable{} + } + if err := m.EaclTable.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OwnerId", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMeta + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthMeta + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthMeta + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.OwnerId == nil { + m.OwnerId = &v2.OwnerID{} + } + if err := m.OwnerId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Lifetime", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMeta + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthMeta + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthMeta + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Lifetime == nil { + m.Lifetime = &TokenLifetime{} + } + if err := m.Lifetime.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipMeta(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthMeta + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthMeta + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RequestMetaHeader) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMeta + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: RequestMetaHeader: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RequestMetaHeader: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMeta + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthMeta + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthMeta + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Version == nil { + m.Version = &Version{} + } + if err := m.Version.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Epoch", wireType) + } + m.Epoch = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMeta + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Epoch |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Ttl", wireType) + } + m.Ttl = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMeta + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Ttl |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field XHeaders", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMeta + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthMeta + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthMeta + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.XHeaders = append(m.XHeaders, &XHeader{}) + if err := m.XHeaders[len(m.XHeaders)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Token", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMeta + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthMeta + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthMeta + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Token == nil { + m.Token = &SessionToken{} + } + if err := m.Token.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Bearer", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMeta + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthMeta + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthMeta + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Bearer == nil { + m.Bearer = &BearerToken{} + } + if err := m.Bearer.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Origin", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMeta + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthMeta + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthMeta + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Origin == nil { + m.Origin = &RequestMetaHeader{} + } + if err := m.Origin.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipMeta(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthMeta + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthMeta + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ResponseMetaHeader) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMeta + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ResponseMetaHeader: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ResponseMetaHeader: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMeta + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthMeta + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthMeta + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Version == nil { + m.Version = &Version{} + } + if err := m.Version.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Epoch", wireType) + } + m.Epoch = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMeta + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Epoch |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Ttl", wireType) + } + m.Ttl = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMeta + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Ttl |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field XHeaders", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMeta + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthMeta + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthMeta + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.XHeaders = append(m.XHeaders, &XHeader{}) + if err := m.XHeaders[len(m.XHeaders)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Origin", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMeta + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthMeta + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthMeta + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Origin == nil { + m.Origin = &ResponseMetaHeader{} + } + if err := m.Origin.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipMeta(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthMeta + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthMeta + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipMeta(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowMeta + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowMeta + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowMeta + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthMeta + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupMeta + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthMeta + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthMeta = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowMeta = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupMeta = fmt.Errorf("proto: unexpected end of group") +) diff --git a/service/v2/meta.proto b/service/v2/meta.proto new file mode 100644 index 0000000..c1a4ddf --- /dev/null +++ b/service/v2/meta.proto @@ -0,0 +1,129 @@ +syntax = "proto3"; + +package service.v2; + +option go_package = "github.com/nspcc-dev/neofs-api-go/service/v2"; +option csharp_namespace = "NeoFS.API.Service"; + +import "acl/v2/types.proto"; +import "refs/v2/types.proto"; +import "service/v2/verify.proto"; + +message XHeader { + // Key of the X-Header. + string key = 1; + // Value of the X-Header. + string value = 2; +} + +// Represents API version used by node. +message Version { + // Major API version. + uint32 major = 1; + // Minor API version. + uint32 minor = 2; +} + +// Lifetime parameters of the token. Filed names taken from rfc7519. +message TokenLifetime { + // Expiration Epoch + uint64 exp = 1; + // Not valid before Epoch + uint64 nbf = 2; + // Issued at Epoch + uint64 iat = 3; +} + +// NeoFS session token. +message SessionToken { + message Body { + // ID is a token identifier. valid UUIDv4 represented in bytes + bytes id = 1; + // OwnerID carries identifier of the session initiator. + refs.v2.OwnerID owner_id = 2; + // Verb is an enumeration of session request types + enum Verb { + // Refers to object.Put RPC call + OBJECT_PUT = 0; + // Refers to object.Get RPC call + OBJECT_GET = 1; + // Refers to object.Head RPC call + OBJECT_HEAD = 2; + // Refers to object.Search RPC call + OBJECT_SEARCH = 3; + // Refers to object.Delete RPC call + OBJECT_DELETE = 4; + // Refers to object.GetRange RPC call + OBJECT_RANGE = 5; + // Refers to object.GetRangeHash RPC call + OBJECT_RANGEHASH = 6; + } + // Verb is a type of request for which the token is issued + Verb verb = 3; + // Lifetime is a lifetime of the session + TokenLifetime lifetime = 4; + // SessionKey is a public key of session key + bytes session_key = 5; + // Carries context of the session. + oneof context { + // object_address represents the object session context. + refs.v2.Address object_address = 6; + } + } + // Session Token body + Body token = 1; + + // Signature is a signature of session token information + Signature signature = 2; +} + +// BearerToken has information about request ACL rules with limited lifetime +message BearerToken { + message Body { + // EACLTable carries table of extended ACL rules + acl.v2.EACLTable eacl_table = 1; + // OwnerID carries identifier of the token owner + refs.v2.OwnerID owner_id = 2; + // Token expiration and valid time period parameters + TokenLifetime lifetime = 3; + } + // Bearer Token body + Body token = 1; + + // Signature of BearerToken body + Signature signature = 2; +} + +// Information about the request +message RequestMetaHeader { + // Client API version. + Version version = 1; + // Client local epoch number. Set to 0 if unknown. + uint64 epoch = 2; + // Maximum number of nodes in the request route. + uint32 ttl = 3; + // Request X-Headers. + repeated XHeader x_headers = 4; + // Token is a token of the session within which the request is sent + SessionToken token = 5; + // Bearer is a Bearer token of the request + BearerToken bearer = 6; + + // RequestMetaHeader of the origin request. + RequestMetaHeader origin = 7; +} + +// Information about the response +message ResponseMetaHeader { + // Server API version. + Version version = 1; + // Server local epoch number. + uint64 epoch = 2; + // Maximum number of nodes in the response route. + uint32 ttl = 3; + // Response X-Headers. + repeated XHeader x_headers = 4; + + // Carries response meta header of the origin response. + ResponseMetaHeader origin = 5; +} diff --git a/service/v2/verify.pb.go b/service/v2/verify.pb.go new file mode 100644 index 0000000..6f1cd42 --- /dev/null +++ b/service/v2/verify.pb.go @@ -0,0 +1,1156 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: service/v2/verify.proto + +package v2 + +import ( + fmt "fmt" + proto "github.com/golang/protobuf/proto" + _ "github.com/nspcc-dev/neofs-api-go/acl/v2" + _ "github.com/nspcc-dev/neofs-api-go/refs/v2" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package + +// Signature of something in NeoFS +type Signature struct { + // Public key used for signing. + Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + // Signature + Sign []byte `protobuf:"bytes,2,opt,name=sign,proto3" json:"sign,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Signature) Reset() { *m = Signature{} } +func (m *Signature) String() string { return proto.CompactTextString(m) } +func (*Signature) ProtoMessage() {} +func (*Signature) Descriptor() ([]byte, []int) { + return fileDescriptor_7ea2d606af3f2456, []int{0} +} +func (m *Signature) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Signature) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Signature.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Signature) XXX_Merge(src proto.Message) { + xxx_messageInfo_Signature.Merge(m, src) +} +func (m *Signature) XXX_Size() int { + return m.Size() +} +func (m *Signature) XXX_DiscardUnknown() { + xxx_messageInfo_Signature.DiscardUnknown(m) +} + +var xxx_messageInfo_Signature proto.InternalMessageInfo + +func (m *Signature) GetKey() []byte { + if m != nil { + return m.Key + } + return nil +} + +func (m *Signature) GetSign() []byte { + if m != nil { + return m.Sign + } + return nil +} + +// Verification info for request signed by all intermediate nodes +type RequestVerificationHeader struct { + // Request Body signature. Should be generated once by request initiator. + BodySignature *Signature `protobuf:"bytes,1,opt,name=body_signature,json=bodySignature,proto3" json:"body_signature,omitempty"` + // Request Meta signature is added and signed by any intermediate node + MetaSignature *Signature `protobuf:"bytes,2,opt,name=meta_signature,json=metaSignature,proto3" json:"meta_signature,omitempty"` + // Sign previous hops + OriginSignature *Signature `protobuf:"bytes,3,opt,name=origin_signature,json=originSignature,proto3" json:"origin_signature,omitempty"` + // Chain of previous hops signatures + Origin *RequestVerificationHeader `protobuf:"bytes,4,opt,name=origin,proto3" json:"origin,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *RequestVerificationHeader) Reset() { *m = RequestVerificationHeader{} } +func (m *RequestVerificationHeader) String() string { return proto.CompactTextString(m) } +func (*RequestVerificationHeader) ProtoMessage() {} +func (*RequestVerificationHeader) Descriptor() ([]byte, []int) { + return fileDescriptor_7ea2d606af3f2456, []int{1} +} +func (m *RequestVerificationHeader) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RequestVerificationHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_RequestVerificationHeader.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *RequestVerificationHeader) XXX_Merge(src proto.Message) { + xxx_messageInfo_RequestVerificationHeader.Merge(m, src) +} +func (m *RequestVerificationHeader) XXX_Size() int { + return m.Size() +} +func (m *RequestVerificationHeader) XXX_DiscardUnknown() { + xxx_messageInfo_RequestVerificationHeader.DiscardUnknown(m) +} + +var xxx_messageInfo_RequestVerificationHeader proto.InternalMessageInfo + +func (m *RequestVerificationHeader) GetBodySignature() *Signature { + if m != nil { + return m.BodySignature + } + return nil +} + +func (m *RequestVerificationHeader) GetMetaSignature() *Signature { + if m != nil { + return m.MetaSignature + } + return nil +} + +func (m *RequestVerificationHeader) GetOriginSignature() *Signature { + if m != nil { + return m.OriginSignature + } + return nil +} + +func (m *RequestVerificationHeader) GetOrigin() *RequestVerificationHeader { + if m != nil { + return m.Origin + } + return nil +} + +// Verification info for response signed by all intermediate nodes +type ResponseVerificationHeader struct { + // Response Body signature. Should be generated once by answering node. + BodySignature *Signature `protobuf:"bytes,1,opt,name=body_signature,json=bodySignature,proto3" json:"body_signature,omitempty"` + // Response Meta signature is added and signed by any intermediate node + MetaSignature *Signature `protobuf:"bytes,2,opt,name=meta_signature,json=metaSignature,proto3" json:"meta_signature,omitempty"` + // Sign previous hops + OriginSignature *Signature `protobuf:"bytes,3,opt,name=origin_signature,json=originSignature,proto3" json:"origin_signature,omitempty"` + // Chain of previous hops signatures + Origin *ResponseVerificationHeader `protobuf:"bytes,4,opt,name=origin,proto3" json:"origin,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ResponseVerificationHeader) Reset() { *m = ResponseVerificationHeader{} } +func (m *ResponseVerificationHeader) String() string { return proto.CompactTextString(m) } +func (*ResponseVerificationHeader) ProtoMessage() {} +func (*ResponseVerificationHeader) Descriptor() ([]byte, []int) { + return fileDescriptor_7ea2d606af3f2456, []int{2} +} +func (m *ResponseVerificationHeader) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ResponseVerificationHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ResponseVerificationHeader.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ResponseVerificationHeader) XXX_Merge(src proto.Message) { + xxx_messageInfo_ResponseVerificationHeader.Merge(m, src) +} +func (m *ResponseVerificationHeader) XXX_Size() int { + return m.Size() +} +func (m *ResponseVerificationHeader) XXX_DiscardUnknown() { + xxx_messageInfo_ResponseVerificationHeader.DiscardUnknown(m) +} + +var xxx_messageInfo_ResponseVerificationHeader proto.InternalMessageInfo + +func (m *ResponseVerificationHeader) GetBodySignature() *Signature { + if m != nil { + return m.BodySignature + } + return nil +} + +func (m *ResponseVerificationHeader) GetMetaSignature() *Signature { + if m != nil { + return m.MetaSignature + } + return nil +} + +func (m *ResponseVerificationHeader) GetOriginSignature() *Signature { + if m != nil { + return m.OriginSignature + } + return nil +} + +func (m *ResponseVerificationHeader) GetOrigin() *ResponseVerificationHeader { + if m != nil { + return m.Origin + } + return nil +} + +func init() { + proto.RegisterType((*Signature)(nil), "service.v2.Signature") + proto.RegisterType((*RequestVerificationHeader)(nil), "service.v2.RequestVerificationHeader") + proto.RegisterType((*ResponseVerificationHeader)(nil), "service.v2.ResponseVerificationHeader") +} + +func init() { proto.RegisterFile("service/v2/verify.proto", fileDescriptor_7ea2d606af3f2456) } + +var fileDescriptor_7ea2d606af3f2456 = []byte{ + // 339 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x2f, 0x4e, 0x2d, 0x2a, + 0xcb, 0x4c, 0x4e, 0xd5, 0x2f, 0x33, 0xd2, 0x2f, 0x4b, 0x2d, 0xca, 0x4c, 0xab, 0xd4, 0x2b, 0x28, + 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x82, 0x4a, 0xe8, 0x95, 0x19, 0x49, 0x09, 0x25, 0x26, 0xe7, 0x80, + 0x14, 0x94, 0x54, 0x16, 0xa4, 0x16, 0x43, 0xe4, 0xa5, 0x84, 0x8b, 0x52, 0xd3, 0x8a, 0xd1, 0x04, + 0x95, 0x0c, 0xb9, 0x38, 0x83, 0x33, 0xd3, 0xf3, 0x12, 0x4b, 0x4a, 0x8b, 0x52, 0x85, 0x04, 0xb8, + 0x98, 0xb3, 0x53, 0x2b, 0x25, 0x18, 0x15, 0x18, 0x35, 0x78, 0x82, 0x40, 0x4c, 0x21, 0x21, 0x2e, + 0x96, 0xe2, 0xcc, 0xf4, 0x3c, 0x09, 0x26, 0xb0, 0x10, 0x98, 0xad, 0x34, 0x83, 0x89, 0x4b, 0x32, + 0x28, 0xb5, 0xb0, 0x34, 0xb5, 0xb8, 0x24, 0x0c, 0x64, 0x7f, 0x66, 0x72, 0x62, 0x49, 0x66, 0x7e, + 0x9e, 0x47, 0x6a, 0x62, 0x4a, 0x6a, 0x91, 0x90, 0x0d, 0x17, 0x5f, 0x52, 0x7e, 0x4a, 0x65, 0x7c, + 0x31, 0xcc, 0x54, 0xb0, 0x71, 0xdc, 0x46, 0xa2, 0x7a, 0x08, 0xe7, 0xe9, 0xc1, 0xad, 0x0c, 0xe2, + 0x05, 0x29, 0x46, 0xb8, 0xc0, 0x86, 0x8b, 0x2f, 0x37, 0xb5, 0x24, 0x11, 0x49, 0x37, 0x13, 0x5e, + 0xdd, 0x20, 0xc5, 0x08, 0xdd, 0x0e, 0x5c, 0x02, 0xf9, 0x45, 0x99, 0xe9, 0x99, 0x79, 0x48, 0xfa, + 0x99, 0xf1, 0xe9, 0xe7, 0x87, 0x28, 0x47, 0x98, 0x60, 0xcb, 0xc5, 0x06, 0x11, 0x92, 0x60, 0x01, + 0xeb, 0x53, 0x45, 0xd6, 0x87, 0xd3, 0xd3, 0x41, 0x50, 0x4d, 0x4a, 0xb3, 0x98, 0xb8, 0xa4, 0x82, + 0x52, 0x8b, 0x0b, 0xf2, 0xf3, 0x8a, 0x53, 0x87, 0x5d, 0xd8, 0xd8, 0xa1, 0x85, 0x8d, 0x1a, 0x6a, + 0xd8, 0xe0, 0xf2, 0x35, 0x2c, 0x70, 0x9c, 0x82, 0x4e, 0x3c, 0x92, 0x63, 0xbc, 0xf0, 0x48, 0x8e, + 0xf1, 0xc1, 0x23, 0x39, 0xc6, 0x19, 0x8f, 0xe5, 0x18, 0xa2, 0x74, 0xd2, 0x33, 0x4b, 0x32, 0x4a, + 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, 0xf3, 0x8a, 0x0b, 0x92, 0x93, 0x75, 0x53, 0x52, 0xcb, 0xf4, + 0xf3, 0x52, 0xf3, 0xd3, 0x8a, 0x75, 0x13, 0x0b, 0x32, 0x75, 0xd3, 0xf3, 0xf5, 0x11, 0x89, 0x7d, + 0x15, 0x93, 0xa0, 0x5f, 0x6a, 0xbe, 0x5b, 0xb0, 0x9e, 0x63, 0x80, 0xa7, 0x5e, 0x30, 0x44, 0x38, + 0x89, 0x0d, 0x9c, 0x8a, 0x8d, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0x0e, 0xde, 0xf9, 0x4c, 0x15, + 0x03, 0x00, 0x00, +} + +func (m *Signature) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Signature) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Signature) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Sign) > 0 { + i -= len(m.Sign) + copy(dAtA[i:], m.Sign) + i = encodeVarintVerify(dAtA, i, uint64(len(m.Sign))) + i-- + dAtA[i] = 0x12 + } + if len(m.Key) > 0 { + i -= len(m.Key) + copy(dAtA[i:], m.Key) + i = encodeVarintVerify(dAtA, i, uint64(len(m.Key))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *RequestVerificationHeader) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *RequestVerificationHeader) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RequestVerificationHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.Origin != nil { + { + size, err := m.Origin.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintVerify(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + if m.OriginSignature != nil { + { + size, err := m.OriginSignature.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintVerify(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + if m.MetaSignature != nil { + { + size, err := m.MetaSignature.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintVerify(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.BodySignature != nil { + { + size, err := m.BodySignature.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintVerify(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *ResponseVerificationHeader) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ResponseVerificationHeader) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ResponseVerificationHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.Origin != nil { + { + size, err := m.Origin.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintVerify(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + if m.OriginSignature != nil { + { + size, err := m.OriginSignature.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintVerify(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + if m.MetaSignature != nil { + { + size, err := m.MetaSignature.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintVerify(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.BodySignature != nil { + { + size, err := m.BodySignature.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintVerify(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintVerify(dAtA []byte, offset int, v uint64) int { + offset -= sovVerify(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Signature) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Key) + if l > 0 { + n += 1 + l + sovVerify(uint64(l)) + } + l = len(m.Sign) + if l > 0 { + n += 1 + l + sovVerify(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *RequestVerificationHeader) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.BodySignature != nil { + l = m.BodySignature.Size() + n += 1 + l + sovVerify(uint64(l)) + } + if m.MetaSignature != nil { + l = m.MetaSignature.Size() + n += 1 + l + sovVerify(uint64(l)) + } + if m.OriginSignature != nil { + l = m.OriginSignature.Size() + n += 1 + l + sovVerify(uint64(l)) + } + if m.Origin != nil { + l = m.Origin.Size() + n += 1 + l + sovVerify(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *ResponseVerificationHeader) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.BodySignature != nil { + l = m.BodySignature.Size() + n += 1 + l + sovVerify(uint64(l)) + } + if m.MetaSignature != nil { + l = m.MetaSignature.Size() + n += 1 + l + sovVerify(uint64(l)) + } + if m.OriginSignature != nil { + l = m.OriginSignature.Size() + n += 1 + l + sovVerify(uint64(l)) + } + if m.Origin != nil { + l = m.Origin.Size() + n += 1 + l + sovVerify(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovVerify(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozVerify(x uint64) (n int) { + return sovVerify(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Signature) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVerify + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Signature: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Signature: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVerify + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthVerify + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthVerify + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Key = append(m.Key[:0], dAtA[iNdEx:postIndex]...) + if m.Key == nil { + m.Key = []byte{} + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sign", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVerify + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthVerify + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthVerify + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Sign = append(m.Sign[:0], dAtA[iNdEx:postIndex]...) + if m.Sign == nil { + m.Sign = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipVerify(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthVerify + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthVerify + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RequestVerificationHeader) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVerify + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: RequestVerificationHeader: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RequestVerificationHeader: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BodySignature", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVerify + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthVerify + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthVerify + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.BodySignature == nil { + m.BodySignature = &Signature{} + } + if err := m.BodySignature.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MetaSignature", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVerify + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthVerify + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthVerify + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.MetaSignature == nil { + m.MetaSignature = &Signature{} + } + if err := m.MetaSignature.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OriginSignature", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVerify + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthVerify + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthVerify + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.OriginSignature == nil { + m.OriginSignature = &Signature{} + } + if err := m.OriginSignature.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Origin", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVerify + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthVerify + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthVerify + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Origin == nil { + m.Origin = &RequestVerificationHeader{} + } + if err := m.Origin.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipVerify(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthVerify + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthVerify + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ResponseVerificationHeader) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVerify + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ResponseVerificationHeader: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ResponseVerificationHeader: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BodySignature", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVerify + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthVerify + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthVerify + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.BodySignature == nil { + m.BodySignature = &Signature{} + } + if err := m.BodySignature.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MetaSignature", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVerify + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthVerify + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthVerify + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.MetaSignature == nil { + m.MetaSignature = &Signature{} + } + if err := m.MetaSignature.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OriginSignature", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVerify + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthVerify + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthVerify + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.OriginSignature == nil { + m.OriginSignature = &Signature{} + } + if err := m.OriginSignature.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Origin", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVerify + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthVerify + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthVerify + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Origin == nil { + m.Origin = &ResponseVerificationHeader{} + } + if err := m.Origin.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipVerify(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthVerify + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthVerify + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipVerify(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowVerify + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowVerify + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowVerify + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthVerify + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupVerify + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthVerify + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthVerify = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowVerify = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupVerify = fmt.Errorf("proto: unexpected end of group") +) diff --git a/service/v2/verify.proto b/service/v2/verify.proto new file mode 100644 index 0000000..2933896 --- /dev/null +++ b/service/v2/verify.proto @@ -0,0 +1,43 @@ +syntax = "proto3"; + +package service.v2; + +option go_package = "github.com/nspcc-dev/neofs-api-go/service/v2"; +option csharp_namespace = "NeoFS.API.Service"; + +import "acl/v2/types.proto"; +import "refs/v2/types.proto"; + +// Signature of something in NeoFS +message Signature { + // Public key used for signing. + bytes key = 1; + // Signature + bytes sign = 2; +} + +// Verification info for request signed by all intermediate nodes +message RequestVerificationHeader { + // Request Body signature. Should be generated once by request initiator. + Signature body_signature = 1; + // Request Meta signature is added and signed by any intermediate node + Signature meta_signature = 2; + // Sign previous hops + Signature origin_signature = 3; + + // Chain of previous hops signatures + RequestVerificationHeader origin = 4; +} + +// Verification info for response signed by all intermediate nodes +message ResponseVerificationHeader { + // Response Body signature. Should be generated once by answering node. + Signature body_signature = 1; + // Response Meta signature is added and signed by any intermediate node + Signature meta_signature = 2; + // Sign previous hops + Signature origin_signature = 3; + + // Chain of previous hops signatures + ResponseVerificationHeader origin = 4; +} diff --git a/session/v2/service.pb.go b/session/v2/service.pb.go new file mode 100644 index 0000000..9d5d8af --- /dev/null +++ b/session/v2/service.pb.go @@ -0,0 +1,1385 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: session/v2/service.proto + +package v2 + +import ( + context "context" + fmt "fmt" + proto "github.com/golang/protobuf/proto" + v21 "github.com/nspcc-dev/neofs-api-go/refs/v2" + v2 "github.com/nspcc-dev/neofs-api-go/service/v2" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package + +// CreateRequest carries an information necessary for opening a session.v2. +type CreateRequest struct { + // Body of create session token request message. + Body *CreateRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` + // Carries request meta information. Header data is used only to regulate message + // transport and does not affect request execution. + MetaHeader *v2.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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 *v2.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *CreateRequest) Reset() { *m = CreateRequest{} } +func (m *CreateRequest) String() string { return proto.CompactTextString(m) } +func (*CreateRequest) ProtoMessage() {} +func (*CreateRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_dc9d885cd3f2324e, []int{0} +} +func (m *CreateRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *CreateRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_CreateRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *CreateRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_CreateRequest.Merge(m, src) +} +func (m *CreateRequest) XXX_Size() int { + return m.Size() +} +func (m *CreateRequest) XXX_DiscardUnknown() { + xxx_messageInfo_CreateRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_CreateRequest proto.InternalMessageInfo + +func (m *CreateRequest) GetBody() *CreateRequest_Body { + if m != nil { + return m.Body + } + return nil +} + +func (m *CreateRequest) GetMetaHeader() *v2.RequestMetaHeader { + if m != nil { + return m.MetaHeader + } + return nil +} + +func (m *CreateRequest) GetVerifyHeader() *v2.RequestVerificationHeader { + if m != nil { + return m.VerifyHeader + } + return nil +} + +type CreateRequest_Body struct { + // Carries an identifier of a session initiator. + OwnerId *v21.OwnerID `protobuf:"bytes,1,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"` + // Carries a lifetime of the session.v2. + Lifetime *v2.TokenLifetime `protobuf:"bytes,2,opt,name=lifetime,proto3" json:"lifetime,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *CreateRequest_Body) Reset() { *m = CreateRequest_Body{} } +func (m *CreateRequest_Body) String() string { return proto.CompactTextString(m) } +func (*CreateRequest_Body) ProtoMessage() {} +func (*CreateRequest_Body) Descriptor() ([]byte, []int) { + return fileDescriptor_dc9d885cd3f2324e, []int{0, 0} +} +func (m *CreateRequest_Body) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *CreateRequest_Body) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_CreateRequest_Body.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *CreateRequest_Body) XXX_Merge(src proto.Message) { + xxx_messageInfo_CreateRequest_Body.Merge(m, src) +} +func (m *CreateRequest_Body) XXX_Size() int { + return m.Size() +} +func (m *CreateRequest_Body) XXX_DiscardUnknown() { + xxx_messageInfo_CreateRequest_Body.DiscardUnknown(m) +} + +var xxx_messageInfo_CreateRequest_Body proto.InternalMessageInfo + +func (m *CreateRequest_Body) GetOwnerId() *v21.OwnerID { + if m != nil { + return m.OwnerId + } + return nil +} + +func (m *CreateRequest_Body) GetLifetime() *v2.TokenLifetime { + if m != nil { + return m.Lifetime + } + return nil +} + +// CreateResponse carries an information about the opened session.v2. +type CreateResponse struct { + // Body of create session token response message. + Body *CreateResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` + // Carries response meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *v2.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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 *v2.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *CreateResponse) Reset() { *m = CreateResponse{} } +func (m *CreateResponse) String() string { return proto.CompactTextString(m) } +func (*CreateResponse) ProtoMessage() {} +func (*CreateResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_dc9d885cd3f2324e, []int{1} +} +func (m *CreateResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *CreateResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_CreateResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *CreateResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_CreateResponse.Merge(m, src) +} +func (m *CreateResponse) XXX_Size() int { + return m.Size() +} +func (m *CreateResponse) XXX_DiscardUnknown() { + xxx_messageInfo_CreateResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_CreateResponse proto.InternalMessageInfo + +func (m *CreateResponse) GetBody() *CreateResponse_Body { + if m != nil { + return m.Body + } + return nil +} + +func (m *CreateResponse) GetMetaHeader() *v2.ResponseMetaHeader { + if m != nil { + return m.MetaHeader + } + return nil +} + +func (m *CreateResponse) GetVerifyHeader() *v2.ResponseVerificationHeader { + if m != nil { + return m.VerifyHeader + } + return nil +} + +type CreateResponse_Body struct { + // id carries an identifier of session token. + Id []byte `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + // session_key carries a session public key. + SessionKey []byte `protobuf:"bytes,2,opt,name=session_key,json=sessionKey,proto3" json:"session_key,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *CreateResponse_Body) Reset() { *m = CreateResponse_Body{} } +func (m *CreateResponse_Body) String() string { return proto.CompactTextString(m) } +func (*CreateResponse_Body) ProtoMessage() {} +func (*CreateResponse_Body) Descriptor() ([]byte, []int) { + return fileDescriptor_dc9d885cd3f2324e, []int{1, 0} +} +func (m *CreateResponse_Body) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *CreateResponse_Body) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_CreateResponse_Body.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *CreateResponse_Body) XXX_Merge(src proto.Message) { + xxx_messageInfo_CreateResponse_Body.Merge(m, src) +} +func (m *CreateResponse_Body) XXX_Size() int { + return m.Size() +} +func (m *CreateResponse_Body) XXX_DiscardUnknown() { + xxx_messageInfo_CreateResponse_Body.DiscardUnknown(m) +} + +var xxx_messageInfo_CreateResponse_Body proto.InternalMessageInfo + +func (m *CreateResponse_Body) GetId() []byte { + if m != nil { + return m.Id + } + return nil +} + +func (m *CreateResponse_Body) GetSessionKey() []byte { + if m != nil { + return m.SessionKey + } + return nil +} + +func init() { + proto.RegisterType((*CreateRequest)(nil), "session.v2.CreateRequest") + proto.RegisterType((*CreateRequest_Body)(nil), "session.v2.CreateRequest.Body") + proto.RegisterType((*CreateResponse)(nil), "session.v2.CreateResponse") + proto.RegisterType((*CreateResponse_Body)(nil), "session.v2.CreateResponse.Body") +} + +func init() { proto.RegisterFile("session/v2/service.proto", fileDescriptor_dc9d885cd3f2324e) } + +var fileDescriptor_dc9d885cd3f2324e = []byte{ + // 448 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x93, 0xdf, 0x8a, 0xd3, 0x40, + 0x14, 0xc6, 0x4d, 0x5c, 0x76, 0x97, 0x69, 0x77, 0xd1, 0x11, 0xb1, 0x1b, 0x30, 0x2b, 0x0b, 0x8a, + 0xa0, 0x9d, 0x40, 0x16, 0xf1, 0xce, 0x62, 0x15, 0xb1, 0xad, 0xff, 0x98, 0x8a, 0x17, 0xde, 0x94, + 0x34, 0x39, 0x69, 0xc7, 0x9a, 0x4c, 0xcc, 0x4c, 0x23, 0x79, 0x07, 0x1f, 0xc0, 0x67, 0xf0, 0x15, + 0x7c, 0x01, 0x2f, 0x7d, 0x04, 0xa9, 0x2f, 0x22, 0x93, 0x99, 0xf4, 0x0f, 0xa4, 0x78, 0x97, 0x99, + 0xf9, 0xce, 0x77, 0xbe, 0xf3, 0xe3, 0x04, 0x75, 0x04, 0x08, 0xc1, 0x78, 0xea, 0x15, 0xbe, 0x27, + 0x20, 0x2f, 0x58, 0x08, 0x24, 0xcb, 0xb9, 0xe4, 0x18, 0x99, 0x17, 0x52, 0xf8, 0xce, 0x8d, 0x1c, + 0x62, 0xa1, 0x24, 0xb2, 0xcc, 0x40, 0x68, 0x81, 0x73, 0xd3, 0xe8, 0xd5, 0x7d, 0x02, 0x32, 0x30, + 0xd7, 0xb7, 0xb6, 0xae, 0x0b, 0xc8, 0x59, 0x5c, 0xea, 0x87, 0x8b, 0x9f, 0x36, 0x3a, 0x79, 0x96, + 0x43, 0x20, 0x81, 0xc2, 0x97, 0x25, 0x08, 0x89, 0x7d, 0x74, 0x30, 0xe5, 0x51, 0xd9, 0xb1, 0xee, + 0x58, 0xf7, 0x5b, 0xbe, 0x4b, 0x36, 0x1d, 0xc9, 0x8e, 0x90, 0xf4, 0x79, 0x54, 0xd2, 0x4a, 0x8b, + 0x9f, 0xa0, 0x96, 0x6a, 0x36, 0x99, 0x43, 0x10, 0x41, 0xde, 0xb1, 0xab, 0xd2, 0xdb, 0xa4, 0xce, + 0x5e, 0xf8, 0xc4, 0x14, 0xbd, 0x06, 0x19, 0xbc, 0xac, 0x44, 0x14, 0x25, 0xeb, 0x6f, 0x3c, 0x44, + 0x27, 0x3a, 0x55, 0xed, 0x70, 0xb5, 0x72, 0xb8, 0xdb, 0xe0, 0xf0, 0x41, 0xe9, 0x58, 0x18, 0x48, + 0xc6, 0x53, 0xe3, 0xd4, 0xd6, 0xb5, 0xfa, 0xe4, 0x7c, 0x42, 0x07, 0x2a, 0x19, 0x7e, 0x80, 0x8e, + 0xf9, 0xd7, 0x14, 0xf2, 0x09, 0x8b, 0xcc, 0x2c, 0xd7, 0x88, 0x22, 0xa6, 0xbc, 0xde, 0xaa, 0x87, + 0xc1, 0x73, 0x7a, 0x54, 0x29, 0x06, 0x11, 0x7e, 0x84, 0x8e, 0x3f, 0xb3, 0x18, 0x24, 0x4b, 0xc0, + 0xa4, 0x3f, 0xdb, 0xee, 0xfd, 0x9e, 0x2f, 0x20, 0x7d, 0x65, 0x04, 0x74, 0x2d, 0xbd, 0xf8, 0x66, + 0xa3, 0xd3, 0x1a, 0x8a, 0xc8, 0x78, 0x2a, 0x00, 0x5f, 0xee, 0xe0, 0x3b, 0x6f, 0xc2, 0xa7, 0x95, + 0xdb, 0xfc, 0x7a, 0x4d, 0xfc, 0xdc, 0xdd, 0xe9, 0x75, 0xd5, 0x1e, 0x80, 0xa3, 0x66, 0x80, 0xf7, + 0x9a, 0x2c, 0xfe, 0x4b, 0xf0, 0xb1, 0x21, 0x78, 0x8a, 0x6c, 0xc3, 0xae, 0x4d, 0x6d, 0x16, 0xe1, + 0x73, 0xd4, 0x32, 0xd3, 0x4c, 0x16, 0x50, 0x56, 0x29, 0xdb, 0xb4, 0xde, 0xc8, 0x11, 0x94, 0xfe, + 0x10, 0x1d, 0x8d, 0xf5, 0x09, 0xf7, 0xd0, 0xa1, 0x1e, 0x17, 0x9f, 0xed, 0xdd, 0x20, 0xc7, 0xd9, + 0x4f, 0xa7, 0x4f, 0x7f, 0xad, 0x5c, 0xeb, 0xf7, 0xca, 0xb5, 0xfe, 0xac, 0x5c, 0xeb, 0xfb, 0x5f, + 0xf7, 0xca, 0xc7, 0x87, 0x33, 0x26, 0xe7, 0xcb, 0x29, 0x09, 0x79, 0xe2, 0xa5, 0x22, 0x0b, 0xc3, + 0x6e, 0x04, 0x85, 0x97, 0x02, 0x8f, 0x45, 0x37, 0xc8, 0x58, 0x77, 0xc6, 0xbd, 0xcd, 0x7f, 0xf3, + 0xc3, 0xbe, 0xfe, 0x06, 0xf8, 0x8b, 0x31, 0x79, 0xfa, 0x6e, 0x40, 0x4c, 0xa8, 0xe9, 0x61, 0xb5, + 0xf3, 0x97, 0xff, 0x02, 0x00, 0x00, 0xff, 0xff, 0x41, 0x43, 0x09, 0xb3, 0x60, 0x03, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// SessionClient is the client API for Session service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type SessionClient interface { + // Create opens new session between the client and the server. + Create(ctx context.Context, in *CreateRequest, opts ...grpc.CallOption) (*CreateResponse, error) +} + +type sessionClient struct { + cc *grpc.ClientConn +} + +func NewSessionClient(cc *grpc.ClientConn) SessionClient { + return &sessionClient{cc} +} + +func (c *sessionClient) Create(ctx context.Context, in *CreateRequest, opts ...grpc.CallOption) (*CreateResponse, error) { + out := new(CreateResponse) + err := c.cc.Invoke(ctx, "/session.v2.Session/Create", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// SessionServer is the server API for Session service. +type SessionServer interface { + // Create opens new session between the client and the server. + Create(context.Context, *CreateRequest) (*CreateResponse, error) +} + +// UnimplementedSessionServer can be embedded to have forward compatible implementations. +type UnimplementedSessionServer struct { +} + +func (*UnimplementedSessionServer) Create(ctx context.Context, req *CreateRequest) (*CreateResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Create not implemented") +} + +func RegisterSessionServer(s *grpc.Server, srv SessionServer) { + s.RegisterService(&_Session_serviceDesc, srv) +} + +func _Session_Create_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SessionServer).Create(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/session.v2.Session/Create", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SessionServer).Create(ctx, req.(*CreateRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Session_serviceDesc = grpc.ServiceDesc{ + ServiceName: "session.v2.Session", + HandlerType: (*SessionServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Create", + Handler: _Session_Create_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "session/v2/service.proto", +} + +func (m *CreateRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *CreateRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *CreateRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.VerifyHeader != nil { + { + size, err := m.VerifyHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + if m.MetaHeader != nil { + { + size, err := m.MetaHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.Body != nil { + { + size, err := m.Body.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *CreateRequest_Body) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *CreateRequest_Body) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *CreateRequest_Body) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.Lifetime != nil { + { + size, err := m.Lifetime.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.OwnerId != nil { + { + size, err := m.OwnerId.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *CreateResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *CreateResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *CreateResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.VerifyHeader != nil { + { + size, err := m.VerifyHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + if m.MetaHeader != nil { + { + size, err := m.MetaHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.Body != nil { + { + size, err := m.Body.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *CreateResponse_Body) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *CreateResponse_Body) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *CreateResponse_Body) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.SessionKey) > 0 { + i -= len(m.SessionKey) + copy(dAtA[i:], m.SessionKey) + i = encodeVarintService(dAtA, i, uint64(len(m.SessionKey))) + i-- + dAtA[i] = 0x12 + } + if len(m.Id) > 0 { + i -= len(m.Id) + copy(dAtA[i:], m.Id) + i = encodeVarintService(dAtA, i, uint64(len(m.Id))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintService(dAtA []byte, offset int, v uint64) int { + offset -= sovService(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *CreateRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Body != nil { + l = m.Body.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.MetaHeader != nil { + l = m.MetaHeader.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.VerifyHeader != nil { + l = m.VerifyHeader.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *CreateRequest_Body) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.OwnerId != nil { + l = m.OwnerId.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.Lifetime != nil { + l = m.Lifetime.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *CreateResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Body != nil { + l = m.Body.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.MetaHeader != nil { + l = m.MetaHeader.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.VerifyHeader != nil { + l = m.VerifyHeader.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *CreateResponse_Body) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Id) + if l > 0 { + n += 1 + l + sovService(uint64(l)) + } + l = len(m.SessionKey) + if l > 0 { + n += 1 + l + sovService(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovService(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozService(x uint64) (n int) { + return sovService(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *CreateRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CreateRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CreateRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Body", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Body == nil { + m.Body = &CreateRequest_Body{} + } + if err := m.Body.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MetaHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.MetaHeader == nil { + m.MetaHeader = &v2.RequestMetaHeader{} + } + if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field VerifyHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.VerifyHeader == nil { + m.VerifyHeader = &v2.RequestVerificationHeader{} + } + if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CreateRequest_Body) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Body: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Body: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OwnerId", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.OwnerId == nil { + m.OwnerId = &v21.OwnerID{} + } + if err := m.OwnerId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Lifetime", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Lifetime == nil { + m.Lifetime = &v2.TokenLifetime{} + } + if err := m.Lifetime.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CreateResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CreateResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CreateResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Body", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Body == nil { + m.Body = &CreateResponse_Body{} + } + if err := m.Body.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MetaHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.MetaHeader == nil { + m.MetaHeader = &v2.ResponseMetaHeader{} + } + if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field VerifyHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.VerifyHeader == nil { + m.VerifyHeader = &v2.ResponseVerificationHeader{} + } + if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CreateResponse_Body) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Body: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Body: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Id = append(m.Id[:0], dAtA[iNdEx:postIndex]...) + if m.Id == nil { + m.Id = []byte{} + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SessionKey", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SessionKey = append(m.SessionKey[:0], dAtA[iNdEx:postIndex]...) + if m.SessionKey == nil { + m.SessionKey = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipService(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowService + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowService + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowService + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthService + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupService + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthService + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthService = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowService = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupService = fmt.Errorf("proto: unexpected end of group") +) diff --git a/session/v2/service.proto b/session/v2/service.proto new file mode 100644 index 0000000..c980dcf --- /dev/null +++ b/session/v2/service.proto @@ -0,0 +1,60 @@ +syntax = "proto3"; + +package session.v2; + +option go_package = "github.com/nspcc-dev/neofs-api-go/session/v2"; +option csharp_namespace = "NeoFS.API.Session"; + +import "refs/v2/types.proto"; +import "service/v2/meta.proto"; +import "service/v2/verify.proto"; + +service Session { + // Create opens new session between the client and the server. + rpc Create (CreateRequest) returns (CreateResponse); +} + +// CreateRequest carries an information necessary for opening a session.v2. +message CreateRequest { + message Body { + // Carries an identifier of a session initiator. + refs.v2.OwnerID owner_id = 1; + + // Carries a lifetime of the session.v2. + service.v2.TokenLifetime lifetime = 2; + } + + // Body of create session token request message. + Body body = 1; + + // Carries request meta information. Header data is used only to regulate message + // transport and does not affect request execution. + service.v2.RequestMetaHeader meta_header = 2; + + // Carries request verification information. This header is used to authenticate + // the nodes of the message route and check the correctness of transmission. + service.v2.RequestVerificationHeader verify_header = 3; +} + +// CreateResponse carries an information about the opened session.v2. +message CreateResponse { + message Body { + // id carries an identifier of session token. + bytes id = 1; + + // session_key carries a session public key. + bytes session_key = 2; + } + + // Body of create session token response message. + Body body = 1; + + // Carries response meta information. Header data is used only to regulate + // message transport and does not affect request execution. + service.v2.ResponseMetaHeader meta_header = 2; + + // Carries response verification information. This header is used to + // authenticate the nodes of the message route and check the correctness + // of transmission. + service.v2.ResponseVerificationHeader verify_header = 3; +} diff --git a/storagegroup/v2/types.pb.go b/storagegroup/v2/types.pb.go new file mode 100644 index 0000000..e099149 --- /dev/null +++ b/storagegroup/v2/types.pb.go @@ -0,0 +1,483 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: storagegroup/v2/types.proto + +package v2 + +import ( + fmt "fmt" + proto "github.com/golang/protobuf/proto" + v2 "github.com/nspcc-dev/neofs-api-go/refs/v2" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package + +// StorageGroup groups the information about the NeoFS storage group. +// The storage group consists of objects from single container. +type StorageGroup struct { + // validation_data_size carries the total size of the payloads of the storage + // group members. + ValidationDataSize uint64 `protobuf:"varint,1,opt,name=validation_data_size,json=validationDataSize,proto3" json:"validation_data_size,omitempty"` + // validation_hash carries homomorphic hash from the concatenation of the + // payloads of the storage group members + // The order of concatenation is the same as the order of the members in the + // Members field. + ValidationHash []byte `protobuf:"bytes,2,opt,name=validation_hash,json=validationHash,proto3" json:"validation_hash,omitempty"` + // expiration_epoch carries last NeoFS epoch number of the storage group + // lifetime. + ExpirationEpoch uint64 `protobuf:"varint,3,opt,name=expiration_epoch,json=expirationEpoch,proto3" json:"expiration_epoch,omitempty"` + // Members carries the list of identifiers of the object storage group members. + // The list is strictly ordered. + Members []*v2.ObjectID `protobuf:"bytes,4,rep,name=members,proto3" json:"members,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *StorageGroup) Reset() { *m = StorageGroup{} } +func (m *StorageGroup) String() string { return proto.CompactTextString(m) } +func (*StorageGroup) ProtoMessage() {} +func (*StorageGroup) Descriptor() ([]byte, []int) { + return fileDescriptor_e6cea1f26229f4f1, []int{0} +} +func (m *StorageGroup) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *StorageGroup) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_StorageGroup.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *StorageGroup) XXX_Merge(src proto.Message) { + xxx_messageInfo_StorageGroup.Merge(m, src) +} +func (m *StorageGroup) XXX_Size() int { + return m.Size() +} +func (m *StorageGroup) XXX_DiscardUnknown() { + xxx_messageInfo_StorageGroup.DiscardUnknown(m) +} + +var xxx_messageInfo_StorageGroup proto.InternalMessageInfo + +func (m *StorageGroup) GetValidationDataSize() uint64 { + if m != nil { + return m.ValidationDataSize + } + return 0 +} + +func (m *StorageGroup) GetValidationHash() []byte { + if m != nil { + return m.ValidationHash + } + return nil +} + +func (m *StorageGroup) GetExpirationEpoch() uint64 { + if m != nil { + return m.ExpirationEpoch + } + return 0 +} + +func (m *StorageGroup) GetMembers() []*v2.ObjectID { + if m != nil { + return m.Members + } + return nil +} + +func init() { + proto.RegisterType((*StorageGroup)(nil), "storagegroup.v2.StorageGroup") +} + +func init() { proto.RegisterFile("storagegroup/v2/types.proto", fileDescriptor_e6cea1f26229f4f1) } + +var fileDescriptor_e6cea1f26229f4f1 = []byte{ + // 287 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x2e, 0x2e, 0xc9, 0x2f, + 0x4a, 0x4c, 0x4f, 0x4d, 0x2f, 0xca, 0x2f, 0x2d, 0xd0, 0x2f, 0x33, 0xd2, 0x2f, 0xa9, 0x2c, 0x48, + 0x2d, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x47, 0x96, 0xd4, 0x2b, 0x33, 0x92, 0x12, + 0x2e, 0x4a, 0x4d, 0x2b, 0x46, 0x53, 0xa5, 0x74, 0x90, 0x91, 0x8b, 0x27, 0x18, 0xa2, 0xd0, 0x1d, + 0xa4, 0x50, 0xc8, 0x80, 0x4b, 0xa4, 0x2c, 0x31, 0x27, 0x33, 0x25, 0xb1, 0x24, 0x33, 0x3f, 0x2f, + 0x3e, 0x25, 0xb1, 0x24, 0x31, 0xbe, 0x38, 0xb3, 0x2a, 0x55, 0x82, 0x51, 0x81, 0x51, 0x83, 0x25, + 0x48, 0x08, 0x21, 0xe7, 0x92, 0x58, 0x92, 0x18, 0x9c, 0x59, 0x95, 0x2a, 0xa4, 0xce, 0xc5, 0x8f, + 0xa4, 0x23, 0x23, 0xb1, 0x38, 0x43, 0x82, 0x49, 0x81, 0x51, 0x83, 0x27, 0x88, 0x0f, 0x21, 0xec, + 0x91, 0x58, 0x9c, 0x21, 0xa4, 0xc9, 0x25, 0x90, 0x5a, 0x51, 0x90, 0x59, 0x04, 0x51, 0x98, 0x5a, + 0x90, 0x9f, 0x9c, 0x21, 0xc1, 0x0c, 0x36, 0x96, 0x1f, 0x21, 0xee, 0x0a, 0x12, 0x16, 0xd2, 0xe6, + 0x62, 0xcf, 0x4d, 0xcd, 0x4d, 0x4a, 0x2d, 0x2a, 0x96, 0x60, 0x51, 0x60, 0xd6, 0xe0, 0x36, 0x12, + 0xd4, 0x03, 0xb9, 0x5e, 0xaf, 0xcc, 0x48, 0xcf, 0x3f, 0x29, 0x2b, 0x35, 0xb9, 0xc4, 0xd3, 0x25, + 0x08, 0xa6, 0xc2, 0x29, 0xe6, 0xc4, 0x23, 0x39, 0xc6, 0x0b, 0x8f, 0xe4, 0x18, 0x1f, 0x3c, 0x92, + 0x63, 0x9c, 0xf1, 0x58, 0x8e, 0x21, 0xca, 0x30, 0x3d, 0xb3, 0x24, 0xa3, 0x34, 0x49, 0x2f, 0x39, + 0x3f, 0x57, 0x3f, 0xaf, 0xb8, 0x20, 0x39, 0x59, 0x37, 0x25, 0xb5, 0x4c, 0x3f, 0x2f, 0x35, 0x3f, + 0xad, 0x58, 0x37, 0xb1, 0x20, 0x53, 0x37, 0x3d, 0x5f, 0x1f, 0x2d, 0xe8, 0x56, 0x31, 0x89, 0xf9, + 0xa5, 0xe6, 0xbb, 0x05, 0xeb, 0x39, 0x06, 0x78, 0xea, 0x21, 0x07, 0x48, 0x12, 0x1b, 0x38, 0xa0, + 0x8c, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xe8, 0xae, 0xc0, 0x6d, 0x6d, 0x01, 0x00, 0x00, +} + +func (m *StorageGroup) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *StorageGroup) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *StorageGroup) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Members) > 0 { + for iNdEx := len(m.Members) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Members[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + } + if m.ExpirationEpoch != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.ExpirationEpoch)) + i-- + dAtA[i] = 0x18 + } + if len(m.ValidationHash) > 0 { + i -= len(m.ValidationHash) + copy(dAtA[i:], m.ValidationHash) + i = encodeVarintTypes(dAtA, i, uint64(len(m.ValidationHash))) + i-- + dAtA[i] = 0x12 + } + if m.ValidationDataSize != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.ValidationDataSize)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func encodeVarintTypes(dAtA []byte, offset int, v uint64) int { + offset -= sovTypes(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *StorageGroup) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ValidationDataSize != 0 { + n += 1 + sovTypes(uint64(m.ValidationDataSize)) + } + l = len(m.ValidationHash) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + if m.ExpirationEpoch != 0 { + n += 1 + sovTypes(uint64(m.ExpirationEpoch)) + } + if len(m.Members) > 0 { + for _, e := range m.Members { + l = e.Size() + n += 1 + l + sovTypes(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovTypes(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozTypes(x uint64) (n int) { + return sovTypes(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *StorageGroup) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: StorageGroup: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: StorageGroup: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidationDataSize", wireType) + } + m.ValidationDataSize = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ValidationDataSize |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidationHash", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ValidationHash = append(m.ValidationHash[:0], dAtA[iNdEx:postIndex]...) + if m.ValidationHash == nil { + m.ValidationHash = []byte{} + } + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ExpirationEpoch", wireType) + } + m.ExpirationEpoch = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ExpirationEpoch |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Members", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Members = append(m.Members, &v2.ObjectID{}) + if err := m.Members[len(m.Members)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipTypes(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthTypes + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTypes + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthTypes + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthTypes = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTypes = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTypes = fmt.Errorf("proto: unexpected end of group") +) diff --git a/storagegroup/v2/types.proto b/storagegroup/v2/types.proto new file mode 100644 index 0000000..3d89a67 --- /dev/null +++ b/storagegroup/v2/types.proto @@ -0,0 +1,30 @@ +syntax = "proto3"; + +package storagegroup.v2; + +option go_package = "github.com/nspcc-dev/neofs-api-go/storagegroup/v2"; +option csharp_namespace = "NeoFS.API.StorageGroup"; + +import "refs/v2/types.proto"; + +// StorageGroup groups the information about the NeoFS storage group. +// The storage group consists of objects from single container. +message StorageGroup { + // validation_data_size carries the total size of the payloads of the storage + // group members. + uint64 validation_data_size = 1; + + // validation_hash carries homomorphic hash from the concatenation of the + // payloads of the storage group members + // The order of concatenation is the same as the order of the members in the + // Members field. + bytes validation_hash = 2; + + // expiration_epoch carries last NeoFS epoch number of the storage group + // lifetime. + uint64 expiration_epoch = 3; + + // Members carries the list of identifiers of the object storage group members. + // The list is strictly ordered. + repeated refs.v2.ObjectID members = 4; +} From ea7c6a22dada158ba55e884c88e93f1978c2d9d6 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Wed, 12 Aug 2020 13:19:59 +0300 Subject: [PATCH 0258/1196] Ignore vendor dir in prepare structure script --- prepare.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/prepare.sh b/prepare.sh index 75af3e3..3594c72 100755 --- a/prepare.sh +++ b/prepare.sh @@ -12,7 +12,7 @@ API_PATH=$1 # MOVE FILES FROM API REPO cd $API_PATH -ARGS=$(find ./ -name '*.proto') +ARGS=$(find ./ -name '*.proto' -not -path './vendor/*') for file in $ARGS; do dir=$(dirname $file) cp -r $dir $API_GO_PATH From 297212886db6e5381b3144576bba5d9deadc7de8 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 12 Aug 2020 17:03:11 +0300 Subject: [PATCH 0259/1196] service: Add updated Sign/Verify mechanism --- service/signature/data.go | 85 ++++++++++++++++++++++++++++++++++++ service/signature/options.go | 26 +++++++++++ service/signature/request.go | 64 +++++++++++++++++++++++++++ service/signature/util.go | 31 +++++++++++++ 4 files changed, 206 insertions(+) create mode 100644 service/signature/data.go create mode 100644 service/signature/options.go create mode 100644 service/signature/request.go create mode 100644 service/signature/util.go diff --git a/service/signature/data.go b/service/signature/data.go new file mode 100644 index 0000000..f42b06f --- /dev/null +++ b/service/signature/data.go @@ -0,0 +1,85 @@ +package signature + +import ( + "crypto/ecdsa" + + crypto "github.com/nspcc-dev/neofs-crypto" +) + +type DataSource interface { + ReadSignedData([]byte) ([]byte, error) + SignedDataLength() int +} + +type DataWithSignature interface { + DataSource + GetSignatureWithKey() (key, sig []byte) + SetSignatureWithKey(key, sig []byte) +} + +type SignOption func(*cfg) + +type KeySignatureHandler func(key []byte, sig []byte) + +type KeySignatureSource func() (key, sig []byte) + +func DataSignature(key *ecdsa.PrivateKey, src DataSource, opts ...SignOption) ([]byte, error) { + if key == nil { + return nil, crypto.ErrEmptyPrivateKey + } + + data, err := dataForSignature(src) + if err != nil { + return nil, err + } + defer bytesPool.Put(data) + + cfg := defaultCfg() + + for i := range opts { + opts[i](cfg) + } + + return cfg.signFunc(key, data) +} + +func SignDataWithHandler(key *ecdsa.PrivateKey, src DataSource, handler KeySignatureHandler, opts ...SignOption) error { + sig, err := DataSignature(key, src, opts...) + if err != nil { + return err + } + + handler(crypto.MarshalPublicKey(&key.PublicKey), sig) + + return nil +} + +func VerifyDataWithSource(dataSrc DataSource, sigSrc KeySignatureSource, opts ...SignOption) error { + data, err := dataForSignature(dataSrc) + if err != nil { + return err + } + defer bytesPool.Put(data) + + cfg := defaultCfg() + + for i := range opts { + opts[i](cfg) + } + + key, sig := sigSrc() + + return cfg.verifyFunc( + crypto.UnmarshalPublicKey(key), + data, + sig, + ) +} + +func SignData(key *ecdsa.PrivateKey, v DataWithSignature, opts ...SignOption) error { + return SignDataWithHandler(key, v, v.SetSignatureWithKey, opts...) +} + +func VerifyData(src DataWithSignature, opts ...SignOption) error { + return VerifyDataWithSource(src, src.GetSignatureWithKey, opts...) +} diff --git a/service/signature/options.go b/service/signature/options.go new file mode 100644 index 0000000..16d6330 --- /dev/null +++ b/service/signature/options.go @@ -0,0 +1,26 @@ +package signature + +import ( + "crypto/ecdsa" + + crypto "github.com/nspcc-dev/neofs-crypto" +) + +type cfg struct { + signFunc func(key *ecdsa.PrivateKey, msg []byte) ([]byte, error) + verifyFunc func(key *ecdsa.PublicKey, msg []byte, sig []byte) error +} + +func defaultCfg() *cfg { + return &cfg{ + signFunc: crypto.Sign, + verifyFunc: crypto.Verify, + } +} + +func SignWithRFC6979() SignOption { + return func(c *cfg) { + c.signFunc = crypto.SignRFC6979 + c.verifyFunc = crypto.VerifyRFC6979 + } +} diff --git a/service/signature/request.go b/service/signature/request.go new file mode 100644 index 0000000..9dd34a9 --- /dev/null +++ b/service/signature/request.go @@ -0,0 +1,64 @@ +package signature + +import ( + "crypto/ecdsa" + + "github.com/pkg/errors" +) + +type SignedRequest interface { + Body() DataSource + MetaHeader() DataSource + OriginVerificationHeader() DataSource + + SetBodySignatureWithKey(key, sig []byte) + BodySignatureWithKey() (key, sig []byte) + + SetMetaSignatureWithKey(key, sig []byte) + MetaSignatureWithKey() (key, sig []byte) + + SetOriginSignatureWithKey(key, sig []byte) + OriginSignatureWithKey() (key, sig []byte) +} + +func SignRequest(key *ecdsa.PrivateKey, src SignedRequest) error { + if src == nil { + return errors.New("nil source") + } + + // sign body + if err := SignDataWithHandler(key, src.Body(), src.SetBodySignatureWithKey); err != nil { + return errors.Wrap(err, "could not sign body") + } + + // sign meta + if err := SignDataWithHandler(key, src.Body(), src.SetMetaSignatureWithKey); err != nil { + return errors.Wrap(err, "could not sign meta header") + } + + // sign verify origin + if err := SignDataWithHandler(key, src.OriginVerificationHeader(), src.SetOriginSignatureWithKey); err != nil { + return errors.Wrap(err, "could not sign verification header origin") + } + + return nil +} + +func VerifyRequest(src SignedRequest) error { + // verify body signature + if err := VerifyDataWithSource(src.Body(), src.BodySignatureWithKey); err != nil { + return errors.Wrap(err, "could not verify body") + } + + // verify meta header + if err := VerifyDataWithSource(src.MetaHeader(), src.MetaSignatureWithKey); err != nil { + return errors.Wrap(err, "could not verify meta header") + } + + // verify verification header origin + if err := VerifyDataWithSource(src.OriginVerificationHeader(), src.OriginSignatureWithKey); err != nil { + return errors.Wrap(err, "could not verify verification header origin") + } + + return nil +} diff --git a/service/signature/util.go b/service/signature/util.go new file mode 100644 index 0000000..c86fd00 --- /dev/null +++ b/service/signature/util.go @@ -0,0 +1,31 @@ +package signature + +import ( + "sync" + + "github.com/pkg/errors" +) + +var bytesPool = sync.Pool{ + New: func() interface{} { + return make([]byte, 5<<20) + }, +} + +func dataForSignature(src DataSource) ([]byte, error) { + if src == nil { + return nil, errors.New("nil source") + } + + buf := bytesPool.Get().([]byte) + + if size := src.SignedDataLength(); size < 0 { + return nil, errors.New("negative length") + } else if size <= cap(buf) { + buf = buf[:size] + } else { + buf = make([]byte, size) + } + + return src.ReadSignedData(buf) +} From 696e263e4dc71f8eb1c5a710ebb28f163a07402b Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Wed, 12 Aug 2020 13:34:15 +0300 Subject: [PATCH 0260/1196] Add stable marshal for placement rule Signed-off-by: Alex Vanin --- netmap/v2/marshal.go | 362 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 362 insertions(+) create mode 100644 netmap/v2/marshal.go diff --git a/netmap/v2/marshal.go b/netmap/v2/marshal.go new file mode 100644 index 0000000..11c6e50 --- /dev/null +++ b/netmap/v2/marshal.go @@ -0,0 +1,362 @@ +package v2 + +import ( + "encoding/binary" + "math/bits" + + "github.com/pkg/errors" +) + +func (m *PlacementRule) StableMarshal(buf []byte) ([]byte, error) { + if m == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, m.StableSize()) + } + + var ( + i, n, offset int + ) + + // Write replication factor field. + + buf[i] = 0x08 // id:0x1 << 3 | wiretype:0x0 + offset = binary.PutUvarint(buf[i+1:], uint64(m.ReplFactor)) + i += 1 + offset + + // write select/filter groups field + for j := range m.SfGroups { + buf[i] = 0x12 // id:0x2 << 3 | wiretype:0x2 + + n, _ = m.SfGroups[j].stableSizeWithExclude() + offset = binary.PutUvarint(buf[i+1:], uint64(n)) + + _, err := m.SfGroups[j].StableMarshal(buf[i+1+offset:]) + if err != nil { + return nil, errors.Wrapf(err, "can't marshal SFGroup id:%d", j) + } + + i += 1 + offset + n + } + + return buf, nil +} + +func (m *PlacementRule) StableSize() int { + if m == nil { + return 0 + } + + var ( + ln, size int + ) + _ = ln + + // size of replication factor field + size += 1 + uvarIntSize(uint64(m.ReplFactor)) // wiretype + varint + + for i := range m.SfGroups { + ln, _ = m.SfGroups[i].stableSizeWithExclude() + size += 1 + uvarIntSize(uint64(ln)) + ln // wiretype + size of struct + struct + } + + return size +} + +func (m *PlacementRule_SFGroup) StableMarshal(buf []byte) ([]byte, error) { + if m == nil { + return []byte{}, nil + } + + size, excludeSize := m.stableSizeWithExclude() + if buf == nil { + buf = make([]byte, size) + } + + var ( + i, n, offset int + ) + + // write filters field + for j := range m.Filters { + buf[i] = 0x0A // id:0x1 << 3 | wiretype:0x2 + n = m.Filters[j].stableSize() + offset = binary.PutUvarint(buf[i+1:], uint64(n)) + _, err := m.Filters[j].StableMarshal(buf[i+1+offset:]) + if err != nil { + return nil, errors.Wrapf(err, "can't marshal Filter id:%d", j) + } + i += 1 + offset + n + } + + // write selectors field + for j := range m.Selectors { + buf[i] = 0x12 // id:0x2 << 3 | wiretype:0x2 + n = m.Selectors[j].stableSize() + offset = binary.PutUvarint(buf[i+1:], uint64(n)) + _, err := m.Selectors[j].StableMarshal(buf[i+1+offset:]) + if err != nil { + return nil, errors.Wrapf(err, "can't marshal Selector id:%d", j) + } + i += 1 + offset + n + } + + // write excluded field in packed format + buf[i] = 0x1A // id:0x3 << 3 | wiretype:0x2 + offset = binary.PutUvarint(buf[i+1:], uint64(excludeSize)) + i += 1 + offset + for j := range m.Exclude { + offset = binary.PutUvarint(buf[i:], uint64(m.Exclude[j])) + i += offset + } + + return buf, nil +} + +func (m *PlacementRule_SFGroup) stableSizeWithExclude() (int, int) { + if m == nil { + return 0, 0 + } + + var ( + ln, size int + ) + + // size of filters field + for i := range m.Filters { + ln = m.Filters[i].stableSize() + size += 1 + uvarIntSize(uint64(ln)) + ln // wiretype + size of struct + struct + } + + // size of selectors field + for i := range m.Selectors { + ln = m.Selectors[i].stableSize() + size += 1 + uvarIntSize(uint64(ln)) + ln // wiretype + size of struct + struct + } + + // size of exclude field + ln = 0 + for i := range m.Exclude { + ln += uvarIntSize(uint64(m.Exclude[i])) + } + size += 1 + uvarIntSize(uint64(ln)) + ln // wiretype + packed varints size + packed varints + + return size, ln +} + +func (m *PlacementRule_SFGroup_Selector) StableMarshal(buf []byte) ([]byte, error) { + if m == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, m.stableSize()) + } + + var ( + i, offset int + ) + + // write count field + buf[i] = 0x8 // id:0x1 << 3 | wiretype:0x0 + offset = binary.PutUvarint(buf[i+1:], uint64(m.Count)) + i += 1 + offset + + // write key field + buf[i] = 0x12 // id:0x2 << 3 | wiretype:0x2 + offset = binary.PutUvarint(buf[i+1:], uint64(len(m.Key))) + copy(buf[i+1+offset:], m.Key) + + return buf, nil +} + +func (m *PlacementRule_SFGroup_Selector) stableSize() int { + if m == nil { + return 0 + } + + var ( + ln, size int + ) + + // size of count field + size += 1 + uvarIntSize(uint64(m.Count)) + + // size of key field + ln = len(m.Key) + size += 1 + uvarIntSize(uint64(ln)) + ln + + return size +} + +func (m *PlacementRule_SFGroup_Filter) StableMarshal(buf []byte) ([]byte, error) { + if m == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, m.stableSize()) + } + + var ( + i, n, offset int + ) + + // write key field + buf[i] = 0x0A // id:0x1 << 3 | wiretype:0x2 + offset = binary.PutUvarint(buf[i+1:], uint64(len(m.Key))) + n = copy(buf[i+1+offset:], m.Key) + i += 1 + offset + n + + // write simple filter field + if m.F != nil { + buf[i] = 0x12 // id:0x2 << 3 | wiretype:0x2 + n = m.F.stableSize() + offset = binary.PutUvarint(buf[i+1:], uint64(n)) + _, err := m.F.StableMarshal(buf[i+1+offset:]) + if err != nil { + return nil, errors.Wrap(err, "can't marshal netmap filter") + } + } + + return buf, nil +} + +func (m *PlacementRule_SFGroup_Filter) stableSize() int { + if m == nil { + return 0 + } + + var ( + ln, size int + ) + + // size of key field + ln = len(m.Key) + size += 1 + uvarIntSize(uint64(ln)) + ln + + // size of simple filter + if m.F != nil { + ln = m.F.stableSize() + size += 1 + uvarIntSize(uint64(ln)) + ln + } + + return size +} + +func (m *PlacementRule_SFGroup_Filter_SimpleFilter) StableMarshal(buf []byte) ([]byte, error) { + if m == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, m.stableSize()) + } + + var ( + i, n, offset int + ) + + // write key field + buf[i] = 0x08 // id:0x1 << 3 | wiretype:0x0 + offset = binary.PutUvarint(buf[i+1:], uint64(m.Op)) + i += 1 + offset + + // write value if present + if val, ok := m.Args.(*PlacementRule_SFGroup_Filter_SimpleFilter_Value); ok { + buf[i] = 0x12 // id:0x2 << 3 | wiretype:0x2 + offset = binary.PutUvarint(buf[i+1:], uint64(len(val.Value))) + copy(buf[i+1+offset:], val.Value) + } else if filters, ok := m.Args.(*PlacementRule_SFGroup_Filter_SimpleFilter_FArgs); ok { + if filters.FArgs != nil { + buf[i] = 0x1A // id:0x3 << 3 | wiretype:0x2 + n = filters.FArgs.stableSize() + offset = binary.PutUvarint(buf[i+1:], uint64(n)) + _, err := filters.FArgs.StableMarshal(buf[i+1+offset:]) + if err != nil { + return nil, errors.Wrap(err, "can't marshal simple filters") + } + } + } + + return buf, nil +} + +func (m *PlacementRule_SFGroup_Filter_SimpleFilter) stableSize() int { + if m == nil { + return 0 + } + + var ( + ln, size int + ) + + // size of key field + size += 1 + uvarIntSize(uint64(m.Op)) + + if val, ok := m.Args.(*PlacementRule_SFGroup_Filter_SimpleFilter_Value); ok { + // size of value if present + ln = len(val.Value) + size += 1 + uvarIntSize(uint64(ln)) + ln + } else if filters, ok := m.Args.(*PlacementRule_SFGroup_Filter_SimpleFilter_FArgs); ok { + // size of simple filters if present + if filters.FArgs != nil { + ln = filters.FArgs.stableSize() + size += 1 + uvarIntSize(uint64(ln)) + ln + } + } + + return size +} + +func (m *PlacementRule_SFGroup_Filter_SimpleFilters) StableMarshal(buf []byte) ([]byte, error) { + if m == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, m.stableSize()) + } + + var ( + i, n, offset int + ) + + // write filters field + for j := range m.Filters { + buf[i] = 0x0A // id:0x1 << 3 | wiretype:0x2 + n = m.Filters[j].stableSize() + offset = binary.PutUvarint(buf[i+1:], uint64(n)) + _, err := m.Filters[j].StableMarshal(buf[i+1+offset:]) + if err != nil { + return nil, errors.Wrapf(err, "can't marshal simple filter id:%d", j) + } + i += 1 + offset + n + } + + return buf, nil +} + +func (m *PlacementRule_SFGroup_Filter_SimpleFilters) stableSize() int { + if m == nil { + return 0 + } + var ( + ln, size int + ) + + // size of key field + for i := range m.Filters { + ln = m.Filters[i].stableSize() + size += 1 + uvarIntSize(uint64(ln)) + ln + } + + return size +} + +// uvarIntSize returns length of varint byte sequence for uint64 value 'x'. +func uvarIntSize(x uint64) int { + return (bits.Len64(x|1) + 6) / 7 +} From 18df156e61c656f9c8afc98b8b1741fe62597a36 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Wed, 12 Aug 2020 15:17:44 +0300 Subject: [PATCH 0261/1196] Add stable marshal for owner id Signed-off-by: Alex Vanin --- refs/v2/marshal.go | 49 +++++++++++++++++++++++++++++++++++++++++ refs/v2/marshal_test.go | 44 ++++++++++++++++++++++++++++++++++++ 2 files changed, 93 insertions(+) create mode 100644 refs/v2/marshal.go create mode 100644 refs/v2/marshal_test.go diff --git a/refs/v2/marshal.go b/refs/v2/marshal.go new file mode 100644 index 0000000..e2abec1 --- /dev/null +++ b/refs/v2/marshal.go @@ -0,0 +1,49 @@ +package v2 + +import ( + "encoding/binary" + "math/bits" +) + +func (m *OwnerID) StableMarshal(buf []byte) ([]byte, error) { + if m == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, m.StableSize()) + } + + var ( + i, n, offset int + ) + + // Write key field. + + buf[i] = 0x0A // id:0x1 << 3 | wiretype:0x2 + offset = binary.PutUvarint(buf[i+1:], uint64(len(m.Value))) + n = copy(buf[i+1+offset:], m.Value) + i += 1 + offset + n + + return buf, nil +} + +func (m *OwnerID) StableSize() int { + if m == nil { + return 0 + } + + var ( + ln, size int + ) + + ln = len(m.Value) // size of key field + size += 1 + uvarIntSize(uint64(ln)) + ln // wiretype + size of string + string + + return size +} + +// uvarIntSize returns length of varint byte sequence for uint64 value 'x'. +func uvarIntSize(x uint64) int { + return (bits.Len64(x|1) + 6) / 7 +} diff --git a/refs/v2/marshal_test.go b/refs/v2/marshal_test.go new file mode 100644 index 0000000..c38b3ec --- /dev/null +++ b/refs/v2/marshal_test.go @@ -0,0 +1,44 @@ +package v2 + +import ( + "crypto/rand" + "testing" + + "github.com/stretchr/testify/require" +) + +func TestOwnerID_StableMarshal(t *testing.T) { + owner := make([]byte, 25) + _, err := rand.Read(owner) + require.NoError(t, err) + + expectedOwner := new(OwnerID) + expectedOwner.Value = owner + + gotOwner := new(OwnerID) + + t.Run("small buffer", func(t *testing.T) { + _, err = expectedOwner.StableMarshal(make([]byte, 1)) + require.Error(t, err) + }) + + t.Run("empty owner", func(t *testing.T) { + data, err := new(OwnerID).StableMarshal(nil) + require.NoError(t, err) + + err = gotOwner.Unmarshal(data) + require.NoError(t, err) + + require.Len(t, gotOwner.Value, 0) + }) + + t.Run("non empty owner", func(t *testing.T) { + data, err := expectedOwner.StableMarshal(nil) + require.NoError(t, err) + + err = gotOwner.Unmarshal(data) + require.NoError(t, err) + + require.Equal(t, expectedOwner, gotOwner) + }) +} From c37fca9e0dc3e80cff745f34d598a0f3d667f1e6 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Wed, 12 Aug 2020 15:18:00 +0300 Subject: [PATCH 0262/1196] Add stable marshal for container structure Signed-off-by: Alex Vanin --- container/v2/marshal.go | 238 ++++++++++++++++++++ container/v2/marshal_test.go | 77 +++++++ go.mod | 16 +- go.sum | 411 +---------------------------------- 4 files changed, 324 insertions(+), 418 deletions(-) create mode 100644 container/v2/marshal.go create mode 100644 container/v2/marshal_test.go diff --git a/container/v2/marshal.go b/container/v2/marshal.go new file mode 100644 index 0000000..7dd25d2 --- /dev/null +++ b/container/v2/marshal.go @@ -0,0 +1,238 @@ +package v2 + +import ( + "encoding/binary" + "math/bits" + + "github.com/pkg/errors" +) + +// StableMarshal marshals auto-generated container structure into +// protobuf-compatible stable byte sequence. +func (m *Container) StableMarshal(buf []byte) ([]byte, error) { + if m == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, m.StableSize()) + } + + var ( + i, n, offset int + ) + + // Write owner id field. + + if m.OwnerId != nil { + buf[i] = 0x0A // id:0x1 << 3 | wiretype:0x2 + n = m.OwnerId.StableSize() + offset = binary.PutUvarint(buf[i+1:], uint64(n)) + + _, err := m.OwnerId.StableMarshal(buf[i+1+offset:]) + if err != nil { + return nil, errors.Wrapf(err, "can't marshal owner id") + } + + i += 1 + offset + n + } + + // Write salt field. + + buf[i] = 0x12 // id:0x2 << 3 | wiretype:0x2 + offset = binary.PutUvarint(buf[i+1:], uint64(len(m.Nonce))) + n = copy(buf[i+1+offset:], m.Nonce) + i += 1 + offset + n + + // Write basic acl field. + + buf[i] = 0x18 // id:0x3 << 3 | wiretype:0x0 + offset = binary.PutUvarint(buf[i+1:], uint64(m.BasicAcl)) + i += 1 + offset + + // Write attributes field. + + for j := range m.Attributes { + buf[i] = 0x22 // id:0x4 << 3 | wiretype:0x2 + n = m.Attributes[j].StableSize() + offset = binary.PutUvarint(buf[i+1:], uint64(n)) + + _, err := m.Attributes[j].StableMarshal(buf[i+1+offset:]) + if err != nil { + return nil, errors.Wrapf(err, "can't marshal attribute %v", + m.Attributes[i].Key) + } + + i += 1 + offset + n + } + + // Write placement rule field. + + if m.Rules != nil { + buf[i] = 0x2A // id:0x5 << 3 | wiretype:0x2 + n = m.Rules.StableSize() + offset = binary.PutUvarint(buf[i+1:], uint64(n)) + + _, err := m.Rules.StableMarshal(buf[i+1+offset:]) + if err != nil { + return nil, errors.Wrapf(err, "can't marshal attribute %v", + m.Attributes[i].Key) + } + } + + return buf, nil +} + +func (m *Container) StableSize() int { + if m == nil { + return 0 + } + + var ( + ln, size int + ) + + if m.OwnerId != nil { + ln = m.OwnerId.StableSize() + } + size += 1 + uvarIntSize(uint64(ln)) + ln // wiretype + bytes length + bytes + + ln = len(m.Nonce) // size of salt field + size += 1 + uvarIntSize(uint64(ln)) + ln // wiretype + bytes length + bytes + + // size of basic acl field + size += 1 + uvarIntSize(uint64(m.BasicAcl)) // wiretype + varint + + // size of attributes + for i := range m.Attributes { + ln = m.Attributes[i].StableSize() + size += 1 + uvarIntSize(uint64(ln)) + ln // wiretype + size of struct + struct + } + + // size of placement rule + if m.Rules != nil { + ln = m.Rules.StableSize() + size += 1 + uvarIntSize(uint64(ln)) + ln // wiretype + size of struct + struct + } + + return size +} + +func (m *Container_Attribute) StableMarshal(buf []byte) ([]byte, error) { + if m == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, m.StableSize()) + } + + var ( + i, n, offset int + ) + + // Write key field. + + buf[i] = 0x0A // id:0x1 << 3 | wiretype:0x2 + offset = binary.PutUvarint(buf[i+1:], uint64(len(m.Key))) + n = copy(buf[i+1+offset:], m.Key) + i += 1 + offset + n + + // Write value field. + + buf[i] = 0x12 // id:0x2 << 3 | wiretype:0x2 + offset = binary.PutUvarint(buf[i+1:], uint64(len(m.Value))) + copy(buf[i+1+offset:], m.Value) + + return buf, nil +} + +func (m *Container_Attribute) StableSize() int { + if m == nil { + return 0 + } + + var ( + ln, size int + ) + + ln = len(m.Key) // size of key field + size += 1 + uvarIntSize(uint64(ln)) + ln // wiretype + size of string + string + + ln = len(m.Value) // size of value field + size += 1 + uvarIntSize(uint64(ln)) + ln // wiretype + size of string + string + + return size +} + +func (m *PutRequest_Body) StableMarshal(buf []byte) ([]byte, error) { + if m == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, m.StableSize()) + } + + var ( + i, n, offset int + ) + + // Write container field. + + if m.Container != nil { + buf[i] = 0x0A // id:0x1 << 3 | wiretype:0x2 + n = m.Container.StableSize() + offset = binary.PutUvarint(buf[i+1:], uint64(n)) + + _, err := m.Container.StableMarshal(buf[i+1+offset:]) + if err != nil { + return nil, errors.Wrapf(err, "can't marshal container") + } + + i += 1 + offset + n + } + + // Write public key field. + + buf[i] = 0x12 // id:0x2 << 3 | wiretype:0x2 + offset = binary.PutUvarint(buf[i+1:], uint64(len(m.PublicKey))) + n = copy(buf[i+1+offset:], m.PublicKey) + i += 1 + offset + n + + // Write signature field. + + buf[i] = 0x1A // id:0x3 << 3 | wiretype:0x2 + offset = binary.PutUvarint(buf[i+1:], uint64(len(m.Signature))) + copy(buf[i+1+offset:], m.Signature) + + return buf, nil +} + +func (m *PutRequest_Body) StableSize() int { + if m == nil { + return 0 + } + + var ( + ln, size int + ) + + if m.Container != nil { + ln = m.Container.StableSize() + size += 1 + uvarIntSize(uint64(ln)) + ln // wiretype + size of string + string + } + + ln = len(m.PublicKey) + size += 1 + uvarIntSize(uint64(ln)) + ln // wiretype + size of string + string + + ln = len(m.Signature) + size += 1 + uvarIntSize(uint64(ln)) + ln // wiretype + size of string + string + + return size +} + +// uvarIntSize returns length of varint byte sequence for uint64 value 'x'. +func uvarIntSize(x uint64) int { + return (bits.Len64(x|1) + 6) / 7 +} diff --git a/container/v2/marshal_test.go b/container/v2/marshal_test.go new file mode 100644 index 0000000..180dcb1 --- /dev/null +++ b/container/v2/marshal_test.go @@ -0,0 +1,77 @@ +package v2 + +import ( + "testing" + + netmap "github.com/nspcc-dev/neofs-api-go/netmap/v2" + refs "github.com/nspcc-dev/neofs-api-go/refs/v2" + "github.com/stretchr/testify/require" +) + +var ( + cnr = &Container{ + OwnerId: &refs.OwnerID{Value: []byte("Owner")}, + Nonce: []byte("Salt"), + BasicAcl: 505, + Attributes: []*Container_Attribute{ + { + Key: "Hello", + Value: "World", + }, + { + Key: "Privet", + Value: "Mir", + }, + }, + Rules: &netmap.PlacementRule{ + ReplFactor: 4, + SfGroups: []*netmap.PlacementRule_SFGroup{ + { + Selectors: []*netmap.PlacementRule_SFGroup_Selector{ + { + Count: 1, + Key: "Node", + }, + }, + Filters: []*netmap.PlacementRule_SFGroup_Filter{ + { + Key: "City", + }, + { + Key: "Datacenter", + }, + }, + Exclude: []uint32{4, 5, 6}, + }, + }, + }, + } +) + +func TestContainer_StableMarshal(t *testing.T) { + newCnr := new(Container) + + wire, err := cnr.StableMarshal(nil) + require.NoError(t, err) + + err = newCnr.Unmarshal(wire) + require.NoError(t, err) + + require.Equal(t, cnr, newCnr) +} + +func TestPutRequest_Body_StableMarshal(t *testing.T) { + expectedBody := new(PutRequest_Body) + expectedBody.Container = cnr + expectedBody.PublicKey = []byte{1, 2, 3, 4} + expectedBody.Signature = []byte{5, 6, 7, 8} + + wire, err := expectedBody.StableMarshal(nil) + require.NoError(t, err) + + gotBody := new(PutRequest_Body) + err = gotBody.Unmarshal(wire) + require.NoError(t, err) + + require.Equal(t, expectedBody, gotBody) +} diff --git a/go.mod b/go.mod index df12fcf..79453da 100644 --- a/go.mod +++ b/go.mod @@ -3,20 +3,14 @@ module github.com/nspcc-dev/neofs-api-go go 1.14 require ( - github.com/gogo/protobuf v1.3.1 github.com/golang/protobuf v1.4.2 - github.com/google/uuid v1.1.1 - github.com/mr-tron/base58 v1.1.3 - github.com/nspcc-dev/neo-go v0.90.0 github.com/nspcc-dev/neofs-crypto v0.3.0 - github.com/nspcc-dev/netmap v1.7.0 - github.com/nspcc-dev/tzhash v1.4.0 github.com/pkg/errors v0.9.1 - github.com/prometheus/client_golang v1.6.0 - github.com/prometheus/client_model v0.2.0 - github.com/spf13/viper v1.7.0 - github.com/stretchr/testify v1.5.1 - golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550 + github.com/stretchr/testify v1.6.1 + golang.org/x/net v0.0.0-20190620200207-3b0461eec859 // indirect + golang.org/x/sys v0.0.0-20200420163511-1957bb5e6d1f // indirect + golang.org/x/text v0.3.2 // indirect + google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a // indirect google.golang.org/grpc v1.29.1 ) diff --git a/go.sum b/go.sum index ec6cd1f..469e942 100644 --- a/go.sum +++ b/go.sum @@ -1,107 +1,18 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= -cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= -cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= -cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= -cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= -cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= -cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= -cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk= -cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= -cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= -dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= -github.com/CityOfZion/neo-go v0.62.1-pre.0.20191114145240-e740fbe708f8/go.mod h1:MJCkWUBhi9pn/CrYO1Q3P687y2KeahrOPS9BD9LDGb0= -github.com/CityOfZion/neo-go v0.70.1-pre.0.20191209120015-fccb0085941e/go.mod h1:0enZl0az8xA6PVkwzEOwPWVJGqlt/GO4hA4kmQ5Xzig= -github.com/CityOfZion/neo-go v0.70.1-pre.0.20191212173117-32ac01130d4c/go.mod h1:JtlHfeqLywZLswKIKFnAp+yzezY4Dji9qlfQKB2OD/I= -github.com/CityOfZion/neo-go v0.71.1-pre.0.20200129171427-f773ec69fb84/go.mod h1:FLI526IrRWHmcsO+mHsCbj64pJZhwQFTLJZu+A4PGOA= -github.com/DataDog/zstd v1.4.1/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo= -github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= -github.com/Workiva/go-datastructures v1.0.50/go.mod h1:Z+F2Rca0qCsVYDS8z7bAGm8f3UkzuWYS/oBZz5a7VVA= -github.com/abiosoft/ishell v2.0.0+incompatible/go.mod h1:HQR9AqF2R3P4XXpMpI0NAzgHf/aS6+zVXRj14cVk9qg= -github.com/abiosoft/readline v0.0.0-20180607040430-155bce2042db/go.mod h1:rB3B4rKii8V21ydCbIzH5hZiCQE7f5E9SzUb/ZZx530= -github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/alicebob/gopher-json v0.0.0-20180125190556-5a6b3ba71ee6/go.mod h1:SGnFV6hVsYE877CKEZ6tDNTjaSXYUk6QqoIK6PrAtcc= -github.com/alicebob/miniredis v2.5.0+incompatible/go.mod h1:8HZjEj4yU0dwhYHky+DxYx+6BMjkBbe5ONFIF1MXffk= -github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= -github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= -github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= -github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= -github.com/awalterschulze/gographviz v0.0.0-20181013152038-b2885df04310 h1:t+qxRrRtwNiUYA+Xh2jSXhoG2grnMCMKX4Fg6lx9X1U= -github.com/awalterschulze/gographviz v0.0.0-20181013152038-b2885df04310/go.mod h1:GEV5wmg4YquNw7v1kkyoX9etIk8yVmXj+AkDHuuETHs= -github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= -github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= -github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= -github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= -github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= -github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= -github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= -github.com/cespare/xxhash/v2 v2.1.0/go.mod h1:dgIUBU3pDso/gPgZ1osOZ0iQf77oPR28Tjxl5dIMyVM= -github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY= -github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= -github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= -github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= -github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= -github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= -github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= -github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= -github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= -github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= -github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dgraph-io/badger/v2 v2.0.3/go.mod h1:3KY8+bsP8wI0OEnQJAKpd4wIJW/Mm32yw2j/9FUVnIM= -github.com/dgraph-io/ristretto v0.0.2-0.20200115201040-8f368f2f2ab3/go.mod h1:KPxhHT9ZxKefz+PCeOGsrHpl1qZ7i70dGTu2u+Ahh6E= -github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= -github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= -github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= -github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/etcd-io/bbolt v1.3.3/go.mod h1:ZF2nL25h33cCyBtcyWeZ2/I3HQOfTP+0PIEvHjkjCrw= -github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= -github.com/flynn-archive/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:rZfgFAXFS/z/lEd6LJmf9HVZ1LkgYiHx5pHhV5DR16M= -github.com/frankban/quicktest v1.10.0/go.mod h1:ui7WezCLWMWxVWr1GETZY3smRy0G4KWq9vcPtJmFl7Y= -github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= -github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= -github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= -github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= -github.com/go-redis/redis v6.10.2+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA= -github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= -github.com/go-yaml/yaml v2.1.0+incompatible/go.mod h1:w2MrLa16VYP0jy6N7M5kHaCkaLENm+P+Tv+MfurjSw0= -github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= -github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= -github.com/gogo/protobuf v1.3.0/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= -github.com/gogo/protobuf v1.3.1 h1:DqDEcV5aeaTmdFBePNpYsp3FlcVH/2ISVVM9Qf8PSls= -github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.3 h1:gyjaxf+svBWX08ZjK86iN9geUJF0H6gp2IRKX6Nf6/I= @@ -114,360 +25,67 @@ github.com/golang/protobuf v1.4.0 h1:oOuy+ugB+P/kBdUnG5QaMXSIyJ1q38wWSojYCb3z5VQ github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= github.com/golang/protobuf v1.4.2 h1:+Z5KGCizgyZCbGh1KZqA0fcLLkwbsjIzS4aV2v7wJX0= github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/snappy v0.0.0-20170215233205-553a64147049/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/gomodule/redigo v2.0.0+incompatible/go.mod h1:B4C85qUVwatsJoIUNIfCRsp7qO0iAmpGFZ4EELWSbC4= -github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= -github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= -github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= -github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= -github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= -github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= -github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8= -github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= -github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= -github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= -github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= -github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q= -github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= -github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= -github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= -github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= -github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= -github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= -github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= -github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= -github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= -github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90= -github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= -github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= -github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= -github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= -github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= -github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= -github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= -github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= -github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= -github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= -github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= -github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= -github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= -github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= -github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= -github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= -github.com/magiconair/properties v1.8.1 h1:ZC2Vc7/ZFkGmsVC9KvOjumD+G5lXy2RtTKyzRKO2BQ4= -github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= -github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= -github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= -github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= -github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= -github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= -github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ= -github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84= -github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= -github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= -github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= -github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= -github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= -github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= -github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= -github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg= -github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= -github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE= -github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/mr-tron/base58 v1.1.2 h1:ZEw4I2EgPKDJ2iEw0cNmLB3ROrEmkOtXIkaG7wZg+78= github.com/mr-tron/base58 v1.1.2/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= -github.com/mr-tron/base58 v1.1.3 h1:v+sk57XuaCKGXpWtVBX8YJzO7hMGx4Aajh4TQbdEFdc= -github.com/mr-tron/base58 v1.1.3/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= -github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= -github.com/nspcc-dev/dbft v0.0.0-20191205084618-dacb1a30c254/go.mod h1:w1Ln2aT+dBlPhLnuZhBV+DfPEdS2CHWWLp5JTScY3bw= -github.com/nspcc-dev/dbft v0.0.0-20191209120240-0d6b7568d9ae/go.mod h1:3FjXOoHmA51EGfb5GS/HOv7VdmngNRTssSeQ729dvGY= -github.com/nspcc-dev/dbft v0.0.0-20200117124306-478e5cfbf03a/go.mod h1:/YFK+XOxxg0Bfm6P92lY5eDSLYfp06XOdL8KAVgXjVk= -github.com/nspcc-dev/dbft v0.0.0-20200219114139-199d286ed6c1/go.mod h1:O0qtn62prQSqizzoagHmuuKoz8QMkU3SzBoKdEvm3aQ= -github.com/nspcc-dev/dbft v0.0.0-20200711144034-c526ccc6f570/go.mod h1:1FYQXSbb6/9HQIkoF8XO7W/S8N7AZRkBsgwbcXRvk0E= -github.com/nspcc-dev/hrw v1.0.8 h1:vwRuJXZXgkMvf473vFzeWGCfY1WBVeSHAEHvR4u3/Cg= -github.com/nspcc-dev/hrw v1.0.8/go.mod h1:l/W2vx83vMQo6aStyx2AuZrJ+07lGv2JQGlVkPG06MU= -github.com/nspcc-dev/neo-go v0.73.1-pre.0.20200303142215-f5a1b928ce09/go.mod h1:pPYwPZ2ks+uMnlRLUyXOpLieaDQSEaf4NM3zHVbRjmg= -github.com/nspcc-dev/neo-go v0.90.0 h1:ABNDrJuF9C1XuLQu0q9DKSVMlg9eQn/g6rX8Jbr31bo= -github.com/nspcc-dev/neo-go v0.90.0/go.mod h1:pPFdnApJwUSRAnpdiPBZl7I7jv0doDg5naecpSPK4+Q= -github.com/nspcc-dev/neofs-crypto v0.2.0/go.mod h1:F/96fUzPM3wR+UGsPi3faVNmFlA9KAEAUQR7dMxZmNA= -github.com/nspcc-dev/neofs-crypto v0.2.3/go.mod h1:8w16GEJbH6791ktVqHN9YRNH3s9BEEKYxGhlFnp0cDw= github.com/nspcc-dev/neofs-crypto v0.3.0 h1:zlr3pgoxuzrmGCxc5W8dGVfA9Rro8diFvVnBg0L4ifM= github.com/nspcc-dev/neofs-crypto v0.3.0/go.mod h1:8w16GEJbH6791ktVqHN9YRNH3s9BEEKYxGhlFnp0cDw= -github.com/nspcc-dev/netmap v1.7.0 h1:ak64xn/gPdgYw4tsqSSF7kAGQGbEpeuJEF3XwBX4L9Y= -github.com/nspcc-dev/netmap v1.7.0/go.mod h1:mhV3UOg9ljQmu0teQShD6+JYX09XY5gu2I4hIByCH9M= -github.com/nspcc-dev/rfc6979 v0.1.0/go.mod h1:exhIh1PdpDC5vQmyEsGvc4YDM/lyQp/452QxGq/UEso= github.com/nspcc-dev/rfc6979 v0.2.0 h1:3e1WNxrN60/6N0DW7+UYisLeZJyfqZTNOjeV/toYvOE= github.com/nspcc-dev/rfc6979 v0.2.0/go.mod h1:exhIh1PdpDC5vQmyEsGvc4YDM/lyQp/452QxGq/UEso= -github.com/nspcc-dev/tzhash v1.4.0 h1:RVIR+mxOBHl58CE99+DXtE31ylD5PEkZSoWqoj4fVjg= -github.com/nspcc-dev/tzhash v1.4.0/go.mod h1:Z8gp/VZbyWgPhaMp/KTmeoW5UTynp/N60g0jTtSzBws= -github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= -github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.10.3/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/gomega v1.4.2/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= -github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= -github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181zc= -github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= -github.com/pierrec/lz4 v2.5.2+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= -github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= -github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= -github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= -github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= -github.com/prometheus/client_golang v1.2.1/go.mod h1:XMU6Z2MjaRKVu/dC1qupJI9SiNkDYzz3xecMgSW/F+U= -github.com/prometheus/client_golang v1.6.0 h1:YVPodQOcK15POxhgARIvnDRVpLcuK8mglnMrWfyrw6A= -github.com/prometheus/client_golang v1.6.0/go.mod h1:ZLOG9ck3JLRdB5MgO8f+lLTe83AXG6ro35rLTxvnIl4= -github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= -github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4 h1:gQz4mCbXsO+nc9n1hCxHcGA3Zx3Eo+UHZoInFGUIXNM= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.2.0 h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2dUR+/W/M= -github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= -github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= -github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= -github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt26CguLLsqA= -github.com/prometheus/common v0.9.1 h1:KOMtN28tlbam3/7ZKEYKHhKoJZYYj3gMH4uc62x7X7U= -github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= -github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= -github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= -github.com/prometheus/procfs v0.0.5/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDaekg4FpcdQ= -github.com/prometheus/procfs v0.0.11 h1:DhHlBtkHWPYi8O2y31JkK0TF+DGM+51OopZjH/Ia5qI= -github.com/prometheus/procfs v0.0.11/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= -github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= -github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= -github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= -github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= -github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= -github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= -github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= -github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM= -github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= -github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s= -github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= -github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= -github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= -github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/spf13/afero v1.1.2 h1:m8/z1t7/fwjysjQRYbP0RD+bUIF/8tJwPdEZsI83ACI= -github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= -github.com/spf13/cast v1.3.0 h1:oget//CVOEoFewqQxwr0Ej5yjygnqGkvggSE/gB35Q8= -github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= -github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= -github.com/spf13/jwalterweatherman v1.0.0 h1:XHEdyB+EcvlqZamSM4ZOMGlc93t6AcsBEu9Gc1vn7yk= -github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= -github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg= -github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= -github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= -github.com/spf13/viper v1.7.0 h1:xVKxvI7ouOI5I+U9s2eeiUfMaWBVoXA3AWskkrqK0VM= -github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4= -github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s= -github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= -github.com/syndtr/goleveldb v0.0.0-20180307113352-169b1b37be73/go.mod h1:Z4AUp2Km+PwemOoO/VB5AOx9XSsIItzFjoJlOSiYmn0= -github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= -github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= -github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= -github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= -github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= -github.com/yuin/gopher-lua v0.0.0-20190514113301-1cd887cd7036/go.mod h1:gqRgreBUhTSL0GeU64rtZ3Uq3wtjOa/TB2YfrtkCbVQ= -github.com/yuin/gopher-lua v0.0.0-20191128022950-c6266f4fe8d7/go.mod h1:gqRgreBUhTSL0GeU64rtZ3Uq3wtjOa/TB2YfrtkCbVQ= -go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= -go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= -go.etcd.io/bbolt v1.3.4/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ= -go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= -go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= -go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= -go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= -go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= -golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0= +github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550 h1:ObdrDkeb4kJdCP557AjRjq69pTHfNouLtWZG7j9rPN8= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= -golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= -golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= -golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= -golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= -golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= -golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= -golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= -golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3 h1:0GoQqolDA55aaLxZyTzK/Y2ePZzZTUrRacwib7cNsYQ= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= -golang.org/x/net v0.0.0-20190613194153-d28f0bde5980 h1:dfGZHvZk057jK2MCeWus/TowKpJ8y4AmooUzdBSR9GU= -golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859 h1:R/3boaszxrf1GEUWTVDzSKVwLmSJpwZ1yqXm8j0v2QI= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181228144115-9a3f9b0469bb/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190204203706-41f3e6584952/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190412213103-97732733099d h1:+R4KGOnez64A81RvjARKc4UT5/tI9ujCIVX+P5KiHuI= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191008105621-543471e840be/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191010194322-b09406accb47/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200420163511-1957bb5e6d1f h1:gWF768j/LaZugp8dyS4UwsslYCYz9XgFxvlgsn0n9H8= golang.org/x/sys v0.0.0-20200420163511-1957bb5e6d1f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20180318012157-96caea41033d/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= -google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= -google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= -google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= -google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8 h1:Nw54tB0rB7hY/N0NQvRW8DG4Yk3Q6T9cu9RcFQDu1tc= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55 h1:gSJIx1SDwno+2ElGhA4+qG2zF97qiUzTM+rQ0klBOcE= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a h1:Ob5/580gVHBJZgXnff1cZDbG+xLtMVE5mDRTe+nIsX4= google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= -google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= google.golang.org/grpc v1.29.1 h1:EC2SB8S04d2r73uptxphDSUG+kTKVgjRPF+N3xpxRB4= @@ -480,31 +98,10 @@ google.golang.org/protobuf v1.21.0 h1:qdOKuR/EIArgaWNjetjgTzgVTAZ+S/WXVrq9HW9zim google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= google.golang.org/protobuf v1.23.0 h1:4MY060fB1DLGMB/7MBTLnwQUY6+F09GEiz6SsrNqyzM= google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -gopkg.in/abiosoft/ishell.v2 v2.0.0/go.mod h1:sFp+cGtH6o4s1FtpVPTMcHq2yue+c4DGOVohJCPUzwY= -gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= -gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= -gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -gopkg.in/ini.v1 v1.51.0 h1:AQvPpx3LzTDM0AjnIRlVFwFFGC+npRopjZxLJj6gdno= -gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= -gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= -gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I= -gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.5 h1:ymVxjfMaHvXD8RqPRmzHHsB3VvucivSkIAvJFDI5O3c= -gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= -rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= From 0ae952fcc62b1a72a4f4320f94cb61157ffb9377 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Wed, 12 Aug 2020 16:18:33 +0300 Subject: [PATCH 0263/1196] Add stable marshal of meta & verify headers It uses unstable implementation for now. Signed-off-by: Alex Vanin --- service/v2/marshal.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 service/v2/marshal.go diff --git a/service/v2/marshal.go b/service/v2/marshal.go new file mode 100644 index 0000000..54b7d10 --- /dev/null +++ b/service/v2/marshal.go @@ -0,0 +1,21 @@ +package v2 + +func (m *RequestMetaHeader) StableMarshal(buf []byte) ([]byte, error) { + // fixme: implement stable + return m.Marshal() +} + +func (m *RequestMetaHeader) StableSize() int { + // fixme: implement stable + return m.Size() +} + +func (m *RequestVerificationHeader) StableMarshal(buf []byte) ([]byte, error) { + // fixme: implement stable + return m.Marshal() +} + +func (m *RequestVerificationHeader) StableSize() int { + // fixme: implement stable + return m.Size() +} From 4a6ea486f7a9774bb0b9059f9d44df6e189438d7 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Wed, 12 Aug 2020 16:19:17 +0300 Subject: [PATCH 0264/1196] Implement signature interface for container put request Signed-off-by: Alex Vanin --- container/v2/signature.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 container/v2/signature.go diff --git a/container/v2/signature.go b/container/v2/signature.go new file mode 100644 index 0000000..ca19ee6 --- /dev/null +++ b/container/v2/signature.go @@ -0,0 +1,17 @@ +package v2 + +func (m *Container) ReadSignedData(buf []byte) ([]byte, error) { + return m.StableMarshal(buf) +} + +func (m *Container) SignedDataSize() int { + return m.StableSize() +} + +func (m *PutRequest_Body) ReadSignedData(buf []byte) ([]byte, error) { + return m.StableMarshal(buf) +} + +func (m *PutRequest_Body) SignedDataSize() int { + return m.StableSize() +} From 746419e85f0621f14a812da16be0038b2d66799e Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Wed, 12 Aug 2020 16:19:35 +0300 Subject: [PATCH 0265/1196] Implement signature interface in request headers Signed-off-by: Alex Vanin --- service/v2/signature.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 service/v2/signature.go diff --git a/service/v2/signature.go b/service/v2/signature.go new file mode 100644 index 0000000..5470bea --- /dev/null +++ b/service/v2/signature.go @@ -0,0 +1,17 @@ +package v2 + +func (m *RequestMetaHeader) ReadSignedData(buf []byte) ([]byte, error) { + return m.StableMarshal(buf) +} + +func (m *RequestMetaHeader) SignedDataSize() int { + return m.StableSize() +} + +func (m *RequestVerificationHeader) ReadSignedData(buf []byte) ([]byte, error) { + return m.StableMarshal(buf) +} + +func (m *RequestVerificationHeader) SignedDataSize() int { + return m.StableSize() +} From 2ccfe34a20493729435c260fbc2a86d9cf46d28f Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 12 Aug 2020 18:20:04 +0300 Subject: [PATCH 0266/1196] service/signature: Rename interface methods Signed-off-by: Leonard Lyubich --- service/signature/data.go | 2 +- service/signature/request.go | 12 ++++++------ service/signature/util.go | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/service/signature/data.go b/service/signature/data.go index f42b06f..00d591e 100644 --- a/service/signature/data.go +++ b/service/signature/data.go @@ -8,7 +8,7 @@ import ( type DataSource interface { ReadSignedData([]byte) ([]byte, error) - SignedDataLength() int + SignedDataSize() int } type DataWithSignature interface { diff --git a/service/signature/request.go b/service/signature/request.go index 9dd34a9..fc72be7 100644 --- a/service/signature/request.go +++ b/service/signature/request.go @@ -7,8 +7,8 @@ import ( ) type SignedRequest interface { - Body() DataSource - MetaHeader() DataSource + RequestBody() DataSource + RequestMetaHeader() DataSource OriginVerificationHeader() DataSource SetBodySignatureWithKey(key, sig []byte) @@ -27,12 +27,12 @@ func SignRequest(key *ecdsa.PrivateKey, src SignedRequest) error { } // sign body - if err := SignDataWithHandler(key, src.Body(), src.SetBodySignatureWithKey); err != nil { + if err := SignDataWithHandler(key, src.RequestBody(), src.SetBodySignatureWithKey); err != nil { return errors.Wrap(err, "could not sign body") } // sign meta - if err := SignDataWithHandler(key, src.Body(), src.SetMetaSignatureWithKey); err != nil { + if err := SignDataWithHandler(key, src.RequestMetaHeader(), src.SetMetaSignatureWithKey); err != nil { return errors.Wrap(err, "could not sign meta header") } @@ -46,12 +46,12 @@ func SignRequest(key *ecdsa.PrivateKey, src SignedRequest) error { func VerifyRequest(src SignedRequest) error { // verify body signature - if err := VerifyDataWithSource(src.Body(), src.BodySignatureWithKey); err != nil { + if err := VerifyDataWithSource(src.RequestBody(), src.BodySignatureWithKey); err != nil { return errors.Wrap(err, "could not verify body") } // verify meta header - if err := VerifyDataWithSource(src.MetaHeader(), src.MetaSignatureWithKey); err != nil { + if err := VerifyDataWithSource(src.RequestMetaHeader(), src.MetaSignatureWithKey); err != nil { return errors.Wrap(err, "could not verify meta header") } diff --git a/service/signature/util.go b/service/signature/util.go index c86fd00..9033eab 100644 --- a/service/signature/util.go +++ b/service/signature/util.go @@ -19,7 +19,7 @@ func dataForSignature(src DataSource) ([]byte, error) { buf := bytesPool.Get().([]byte) - if size := src.SignedDataLength(); size < 0 { + if size := src.SignedDataSize(); size < 0 { return nil, errors.New("negative length") } else if size <= cap(buf) { buf = buf[:size] From 0ee1c3653d97f38ddf438a81ea3f278e7c4a719f Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 12 Aug 2020 22:06:10 +0300 Subject: [PATCH 0267/1196] Implement field setters on all protobuf messages Signed-off-by: Leonard Lyubich --- accounting/v2/service.go | 76 +++++ acl/v2/types.go | 89 ++++++ container/v2/service.go | 362 ++++++++++++++++++++++++ container/v2/types.go | 55 ++++ netmap/v2/types.go | 138 +++++++++ object/v2/service.go | 585 +++++++++++++++++++++++++++++++++++++++ object/v2/types.go | 160 +++++++++++ refs/v2/types.go | 36 +++ service/v2/meta.go | 232 ++++++++++++++++ service/v2/verify.go | 71 +++++ session/v2/service.go | 76 +++++ storagegroup/v2/types.go | 33 +++ 12 files changed, 1913 insertions(+) create mode 100644 accounting/v2/service.go create mode 100644 acl/v2/types.go create mode 100644 container/v2/service.go create mode 100644 container/v2/types.go create mode 100644 netmap/v2/types.go create mode 100644 object/v2/service.go create mode 100644 object/v2/types.go create mode 100644 refs/v2/types.go create mode 100644 service/v2/meta.go create mode 100644 service/v2/verify.go create mode 100644 session/v2/service.go create mode 100644 storagegroup/v2/types.go diff --git a/accounting/v2/service.go b/accounting/v2/service.go new file mode 100644 index 0000000..8898217 --- /dev/null +++ b/accounting/v2/service.go @@ -0,0 +1,76 @@ +package v2 + +import ( + refs "github.com/nspcc-dev/neofs-api-go/refs/v2" + service "github.com/nspcc-dev/neofs-api-go/service/v2" +) + +// SetValue sets value of the decimal number. +func (m *Decimal) SetValue(v int64) { + if m != nil { + m.Value = v + } +} + +// SetPrecision sets precision of the decimal number. +func (m *Decimal) SetPrecision(v uint32) { + if m != nil { + m.Precision = v + } +} + +// SetOwnerId sets identifier of the account owner. +func (m *BalanceRequest_Body) SetOwnerId(v *refs.OwnerID) { + if m != nil { + m.OwnerId = v + } +} + +// SetBody sets body of the request. +func (m *BalanceRequest) SetBody(v *BalanceRequest_Body) { + if m != nil { + m.Body = v + } +} + +// SetMetaHeader sets meta header of the request. +func (m *BalanceRequest) SetMetaHeader(v *service.RequestMetaHeader) { + if m != nil { + m.MetaHeader = v + } +} + +// SetVerifyHeader sets verification header of the request. +func (m *BalanceRequest) SetVerifyHeader(v *service.RequestVerificationHeader) { + if m != nil { + m.VerifyHeader = v + } +} + +// SetBalance sets balance value of the response. +func (m *BalanceResponse_Body) SetBalance(v *Decimal) { + if m != nil { + m.Balance = v + } +} + +// SetBody sets body of the response. +func (m *BalanceResponse) SetBody(v *BalanceResponse_Body) { + if m != nil { + m.Body = v + } +} + +// SetMetaHeader sets meta header of the response. +func (m *BalanceResponse) SetMetaHeader(v *service.ResponseMetaHeader) { + if m != nil { + m.MetaHeader = v + } +} + +// SetVerifyHeader sets verification header of the response. +func (m *BalanceResponse) SetVerifyHeader(v *service.ResponseVerificationHeader) { + if m != nil { + m.VerifyHeader = v + } +} diff --git a/acl/v2/types.go b/acl/v2/types.go new file mode 100644 index 0000000..58eaf2e --- /dev/null +++ b/acl/v2/types.go @@ -0,0 +1,89 @@ +package v2 + +import ( + refs "github.com/nspcc-dev/neofs-api-go/refs/v2" +) + +// SetContainerId sets container identifier of the eACL table. +func (m *EACLTable) SetContainerId(v *refs.ContainerID) { + if m != nil { + m.ContainerId = v + } +} + +// SetRecords sets record list of the eACL table. +func (m *EACLTable) SetRecords(v []*EACLRecord) { + if m != nil { + m.Records = v + } +} + +// SetOperation sets operation of the eACL record. +func (m *EACLRecord) SetOperation(v EACLRecord_Operation) { + if m != nil { + m.Operation = v + } +} + +// SetAction sets action of the eACL record. +func (m *EACLRecord) SetAction(v EACLRecord_Action) { + if m != nil { + m.Action = v + } +} + +// SetFilters sets filter list of the eACL record. +func (m *EACLRecord) SetFilters(v []*EACLRecord_FilterInfo) { + if m != nil { + m.Filters = v + } +} + +// SetTargets sets target list of the eACL record. +func (m *EACLRecord) SetTargets(v []*EACLRecord_TargetInfo) { + if m != nil { + m.Targets = v + } +} + +// SetHeader sets header type of the eACL filter. +func (m *EACLRecord_FilterInfo) SetHeader(v EACLRecord_FilterInfo_Header) { + if m != nil { + m.Header = v + } +} + +// SetMatchType sets match type of the eACL filter. +func (m *EACLRecord_FilterInfo) SetMatchType(v EACLRecord_FilterInfo_MatchType) { + if m != nil { + m.MatchType = v + } +} + +// SetHeaderName sets header name of the eACL filter. +func (m *EACLRecord_FilterInfo) SetHeaderName(v string) { + if m != nil { + m.HeaderName = v + } +} + +// SetHeaderVal sets header value of the eACL filter. +func (m *EACLRecord_FilterInfo) SetHeaderVal(v string) { + if m != nil { + m.HeaderVal = v + } +} + +// SetTarget sets target group of the eACL target. +func (m *EACLRecord_TargetInfo) SetTarget(v Target) { + if m != nil { + m.Target = v + } +} + +// SetKeyList sets key list of the eACL target. +func (m *EACLRecord_TargetInfo) SetKeyList(v [][]byte) { + if m != nil { + m.KeyList = v + } +} diff --git a/container/v2/service.go b/container/v2/service.go new file mode 100644 index 0000000..1995b48 --- /dev/null +++ b/container/v2/service.go @@ -0,0 +1,362 @@ +package v2 + +import ( + acl "github.com/nspcc-dev/neofs-api-go/acl/v2" + refs "github.com/nspcc-dev/neofs-api-go/refs/v2" + service "github.com/nspcc-dev/neofs-api-go/service/v2" +) + +// SetContainer sets container of the request. +func (m *PutRequest_Body) SetContainer(v *Container) { + if m != nil { + m.Container = v + } +} + +// SetPublicKey sets public key of the container owner. +func (m *PutRequest_Body) SetPublicKey(v []byte) { + if m != nil { + m.PublicKey = v + } +} + +// SetSignature sets signature of the container structure. +func (m *PutRequest_Body) SetSignature(v []byte) { + if m != nil { + m.Signature = v + } +} + +// SetBody sets body of the request. +func (m *PutRequest) SetBody(v *PutRequest_Body) { + if m != nil { + m.Body = v + } +} + +// SetMetaHeader sets meta header of the request. +func (m *PutRequest) SetMetaHeader(v *service.RequestMetaHeader) { + if m != nil { + m.MetaHeader = v + } +} + +// SetVerifyHeader sets verification header of the request. +func (m *PutRequest) SetVerifyHeader(v *service.RequestVerificationHeader) { + if m != nil { + m.VerifyHeader = v + } +} + +// SetContainerId sets identifier of the container. +func (m *PutResponse_Body) SetContainerId(v *refs.ContainerID) { + if m != nil { + m.ContainerId = v + } +} + +// SetBody sets body of the response. +func (m *PutResponse) SetBody(v *PutResponse_Body) { + if m != nil { + m.Body = v + } +} + +// SetMetaHeader sets meta header of the response. +func (m *PutResponse) SetMetaHeader(v *service.ResponseMetaHeader) { + if m != nil { + m.MetaHeader = v + } +} + +// SetVerifyHeader sets verification header of the response. +func (m *PutResponse) SetVerifyHeader(v *service.ResponseVerificationHeader) { + if m != nil { + m.VerifyHeader = v + } +} + +// SetContainerId sets identifier of the container. +func (m *DeleteRequest_Body) SetContainerId(v *refs.ContainerID) { + if m != nil { + m.ContainerId = v + } +} + +// SetSignature sets signature of the container identifier. +func (m *DeleteRequest_Body) SetSignature(v []byte) { + if m != nil { + m.Signature = v + } +} + +// SetBody sets body of the request. +func (m *DeleteRequest) SetBody(v *DeleteRequest_Body) { + if m != nil { + m.Body = v + } +} + +// SetMetaHeader sets meta header of the request. +func (m *DeleteRequest) SetMetaHeader(v *service.RequestMetaHeader) { + if m != nil { + m.MetaHeader = v + } +} + +// SetVerifyHeader sets verification header of the request. +func (m *DeleteRequest) SetVerifyHeader(v *service.RequestVerificationHeader) { + if m != nil { + m.VerifyHeader = v + } +} + +// SetBody sets body of the response. +func (m *DeleteResponse) SetBody(v *DeleteResponse_Body) { + if m != nil { + m.Body = v + } +} + +// SetMetaHeader sets meta header of the response. +func (m *DeleteResponse) SetMetaHeader(v *service.ResponseMetaHeader) { + if m != nil { + m.MetaHeader = v + } +} + +// SetVerifyHeader sets verification header of the response. +func (m *DeleteResponse) SetVerifyHeader(v *service.ResponseVerificationHeader) { + if m != nil { + m.VerifyHeader = v + } +} + +// SetContainerId sets identifier of the container. +func (m *GetRequest_Body) SetContainerId(v *refs.ContainerID) { + m.ContainerId = v +} + +// SetBody sets body of the request. +func (m *GetRequest) SetBody(v *GetRequest_Body) { + if m != nil { + m.Body = v + } +} + +// SetMetaHeader sets meta header of the request. +func (m *GetRequest) SetMetaHeader(v *service.RequestMetaHeader) { + if m != nil { + m.MetaHeader = v + } +} + +// SetVerifyHeader sets verification header of the request. +func (m *GetRequest) SetVerifyHeader(v *service.RequestVerificationHeader) { + if m != nil { + m.VerifyHeader = v + } +} + +// SetContainer sets the container structure. +func (m *GetResponse_Body) SetContainer(v *Container) { + if m != nil { + m.Container = v + } +} + +// SetBody sets body of the response. +func (m *GetResponse) SetBody(v *GetResponse_Body) { + if m != nil { + m.Body = v + } +} + +// SetMetaHeader sets meta header of the response. +func (m *GetResponse) SetMetaHeader(v *service.ResponseMetaHeader) { + if m != nil { + m.MetaHeader = v + } +} + +// SetVerifyHeader sets verification header of the response. +func (m *GetResponse) SetVerifyHeader(v *service.ResponseVerificationHeader) { + if m != nil { + m.VerifyHeader = v + } +} + +// SetOwnerId sets identifier of the container owner. +func (m *ListRequest_Body) SetOwnerId(v *refs.OwnerID) { + if m != nil { + m.OwnerId = v + } +} + +// SetBody sets body of the request. +func (m *ListRequest) SetBody(v *ListRequest_Body) { + if m != nil { + m.Body = v + } +} + +// SetMetaHeader sets meta header of the request. +func (m *ListRequest) SetMetaHeader(v *service.RequestMetaHeader) { + if m != nil { + m.MetaHeader = v + } +} + +// SetVerifyHeader sets verification header of the request. +func (m *ListRequest) SetVerifyHeader(v *service.RequestVerificationHeader) { + if m != nil { + m.VerifyHeader = v + } +} + +// SetContainerIds sets list of the container identifiers. +func (m *ListResponse_Body) SetContainerIds(v []*refs.ContainerID) { + if m != nil { + m.ContainerIds = v + } +} + +// SetBody sets body of the response. +func (m *ListResponse) SetBody(v *ListResponse_Body) { + if m != nil { + m.Body = v + } +} + +// SetMetaHeader sets meta header of the response. +func (m *ListResponse) SetMetaHeader(v *service.ResponseMetaHeader) { + if m != nil { + m.MetaHeader = v + } +} + +// SetVerifyHeader sets verification header of the response. +func (m *ListResponse) SetVerifyHeader(v *service.ResponseVerificationHeader) { + if m != nil { + m.VerifyHeader = v + } +} + +// SetEacl sets eACL table structure. +func (m *SetExtendedACLRequest_Body) SetEacl(v *acl.EACLTable) { + if m != nil { + m.Eacl = v + } +} + +// SetSignature sets signature of the eACL table. +func (m *SetExtendedACLRequest_Body) SetSignature(v []byte) { + if m != nil { + m.Signature = v + } +} + +// SetBody sets body of the request. +func (m *SetExtendedACLRequest) SetBody(v *SetExtendedACLRequest_Body) { + if m != nil { + m.Body = v + } +} + +// SetMetaHeader sets meta header of the request. +func (m *SetExtendedACLRequest) SetMetaHeader(v *service.RequestMetaHeader) { + if m != nil { + m.MetaHeader = v + } +} + +// SetVerifyHeader sets verification header of the request. +func (m *SetExtendedACLRequest) SetVerifyHeader(v *service.RequestVerificationHeader) { + if m != nil { + m.VerifyHeader = v + } +} + +// SetBody sets body of the response. +func (m *SetExtendedACLResponse) SetBody(v *SetExtendedACLResponse_Body) { + if m != nil { + m.Body = v + } +} + +// SetMetaHeader sets meta header of the response. +func (m *SetExtendedACLResponse) SetMetaHeader(v *service.ResponseMetaHeader) { + if m != nil { + m.MetaHeader = v + } +} + +// SetVerifyHeader sets verification header of the response. +func (m *SetExtendedACLResponse) SetVerifyHeader(v *service.ResponseVerificationHeader) { + if m != nil { + m.VerifyHeader = v + } +} + +// SetContainerId sets identifier of the container. +func (m *GetExtendedACLRequest_Body) SetContainerId(v *refs.ContainerID) { + if m != nil { + m.ContainerId = v + } +} + +// SetBody sets body of the request. +func (m *GetExtendedACLRequest) SetBody(v *GetExtendedACLRequest_Body) { + if m != nil { + m.Body = v + } +} + +// SetMetaHeader sets meta header of the request. +func (m *GetExtendedACLRequest) SetMetaHeader(v *service.RequestMetaHeader) { + if m != nil { + m.MetaHeader = v + } +} + +// SetVerifyHeader sets verification header of the request. +func (m *GetExtendedACLRequest) SetVerifyHeader(v *service.RequestVerificationHeader) { + if m != nil { + m.VerifyHeader = v + } +} + +// SetEacl sets eACL table structure. +func (m *GetExtendedACLResponse_Body) SetEacl(v *acl.EACLTable) { + if m != nil { + m.Eacl = v + } +} + +// SetSignature sets signature of the eACL table. +func (m *GetExtendedACLResponse_Body) SetSignature(v []byte) { + if m != nil { + m.Signature = v + } +} + +// SetBody sets body of the response. +func (m *GetExtendedACLResponse) SetBody(v *GetExtendedACLResponse_Body) { + if m != nil { + m.Body = v + } +} + +// SetMetaHeader sets meta header of the response. +func (m *GetExtendedACLResponse) SetMetaHeader(v *service.ResponseMetaHeader) { + if m != nil { + m.MetaHeader = v + } +} + +// SetVerifyHeader sets verification header of the response. +func (m *GetExtendedACLResponse) SetVerifyHeader(v *service.ResponseVerificationHeader) { + if m != nil { + m.VerifyHeader = v + } +} diff --git a/container/v2/types.go b/container/v2/types.go new file mode 100644 index 0000000..1379be9 --- /dev/null +++ b/container/v2/types.go @@ -0,0 +1,55 @@ +package v2 + +import ( + netmap "github.com/nspcc-dev/neofs-api-go/netmap/v2" + refs "github.com/nspcc-dev/neofs-api-go/refs/v2" +) + +// SetKey sets key to the container attribute. +func (m *Container_Attribute) SetKey(v string) { + if m != nil { + m.Key = v + } +} + +// SetValue sets value of the container attribute. +func (m *Container_Attribute) SetValue(v string) { + if m != nil { + m.Value = v + } +} + +// SetOwnerId sets identifier of the container owner, +func (m *Container) SetOwnerId(v *refs.OwnerID) { + if m != nil { + m.OwnerId = v + } +} + +// SetNonce sets nonce of the container structure. +func (m *Container) SetNonce(v []byte) { + if m != nil { + m.Nonce = v + } +} + +// SetBasicAcl sets basic ACL of the container. +func (m *Container) SetBasicAcl(v uint32) { + if m != nil { + m.BasicAcl = v + } +} + +// SetAttributes sets list of the container attributes. +func (m *Container) SetAttributes(v []*Container_Attribute) { + if m != nil { + m.Attributes = v + } +} + +// SetRules sets placement rules of the container. +func (m *Container) SetRules(v *netmap.PlacementRule) { + if m != nil { + m.Rules = v + } +} diff --git a/netmap/v2/types.go b/netmap/v2/types.go new file mode 100644 index 0000000..81e63f8 --- /dev/null +++ b/netmap/v2/types.go @@ -0,0 +1,138 @@ +package v2 + +// SetOp sets operation of the simple filter. +func (m *PlacementRule_SFGroup_Filter_SimpleFilter) SetOp(v PlacementRule_SFGroup_Filter_SimpleFilter_Operation) { + if m != nil { + m.Op = v + } +} + +// SetValue sets value of the simple filter. +func (m *PlacementRule_SFGroup_Filter_SimpleFilter) SetValue(v string) { + if m != nil { + m.Args = &PlacementRule_SFGroup_Filter_SimpleFilter_Value{ + Value: v, + } + } +} + +// SetFArgs sets filter args of the simple filter. +func (m *PlacementRule_SFGroup_Filter_SimpleFilter) SetFArgs(v *PlacementRule_SFGroup_Filter_SimpleFilters) { + if m != nil { + m.Args = &PlacementRule_SFGroup_Filter_SimpleFilter_FArgs{ + FArgs: v, + } + } +} + +// SetFilters sets list of the simple filters. +func (m *PlacementRule_SFGroup_Filter_SimpleFilters) SetFilters(v []*PlacementRule_SFGroup_Filter_SimpleFilter) { + if m != nil { + m.Filters = v + } +} + +// SeyKey sets key of the filter. +func (m *PlacementRule_SFGroup_Filter) SeyKey(v string) { + if m != nil { + m.Key = v + } +} + +// SetF sets simple filter of the filter. +func (m *PlacementRule_SFGroup_Filter) SetF(v *PlacementRule_SFGroup_Filter_SimpleFilter) { + if m != nil { + m.F = v + } +} + +// SetCount sets count value of the selector. +func (m *PlacementRule_SFGroup_Selector) SetCount(v uint32) { + if m != nil { + m.Count = v + } +} + +// SetKey sets key of the selector. +func (m *PlacementRule_SFGroup_Selector) SetKey(v string) { + if m != nil { + m.Key = v + } +} + +// SetFilters sets list of the filters. +func (m *PlacementRule_SFGroup) SetFilters(v []*PlacementRule_SFGroup_Filter) { + if m != nil { + m.Filters = v + } +} + +// SetSelectors sets list of the selectors. +func (m *PlacementRule_SFGroup) SetSelectors(v []*PlacementRule_SFGroup_Selector) { + if m != nil { + m.Selectors = v + } +} + +// SetExclude sets exclude list. +func (m *PlacementRule_SFGroup) SetExclude(v []uint32) { + if m != nil { + m.Exclude = v + } +} + +// SetReplFactor sets replication factor of the placement rule. +func (m *PlacementRule) SetReplFactor(v uint32) { + if m != nil { + m.ReplFactor = v + } +} + +// SetSfGroups sets list of the selector-filter groups. +func (m *PlacementRule) SetSfGroups(v []*PlacementRule_SFGroup) { + if m != nil { + m.SfGroups = v + } +} + +// SetKey sets key to the node attribute. +func (m *NodeInfo_Attribute) SetKey(v string) { + if m != nil { + m.Key = v + } +} + +// SetValue sets value of the node attribute. +func (m *NodeInfo_Attribute) SetValue(v string) { + if m != nil { + m.Value = v + } +} + +// SetAddress sets node network address. +func (m *NodeInfo) SetAddress(v string) { + if m != nil { + m.Address = v + } +} + +// SetPublicKey sets node public key in a binary format. +func (m *NodeInfo) SetPublicKey(v []byte) { + if m != nil { + m.PublicKey = v + } +} + +// SetAttributes sets list of the node attributes. +func (m *NodeInfo) SetAttributes(v []*NodeInfo_Attribute) { + if m != nil { + m.Attributes = v + } +} + +// SetState sets node state. +func (m *NodeInfo) SetState(v NodeInfo_State) { + if m != nil { + m.State = v + } +} diff --git a/object/v2/service.go b/object/v2/service.go new file mode 100644 index 0000000..b6e372f --- /dev/null +++ b/object/v2/service.go @@ -0,0 +1,585 @@ +package v2 + +import ( + refs "github.com/nspcc-dev/neofs-api-go/refs/v2" + service "github.com/nspcc-dev/neofs-api-go/service/v2" +) + +// SetAddress sets address of the requested object. +func (m *GetRequest_Body) SetAddress(v *refs.Address) { + if m != nil { + m.Address = v + } +} + +// SetRaw sets raw flag of the request. +func (m *GetRequest_Body) SetRaw(v bool) { + if m != nil { + m.Raw = v + } +} + +// SetBody sets body of the request. +func (m *GetRequest) SetBody(v *GetRequest_Body) { + if m != nil { + m.Body = v + } +} + +// SetMetaHeader sets meta header of the request. +func (m *GetRequest) SetMetaHeader(v *service.RequestMetaHeader) { + if m != nil { + m.MetaHeader = v + } +} + +// SetVerifyHeader sets verification header of the request. +func (m *GetRequest) SetVerifyHeader(v *service.RequestVerificationHeader) { + if m != nil { + m.VerifyHeader = v + } +} + +// SetObjectId sets identifier of the object. +func (m *GetResponse_Body_Init) SetObjectId(v *refs.ObjectID) { + if m != nil { + m.ObjectId = v + } +} + +// SetSignature sets signature of the object identifier. +func (m *GetResponse_Body_Init) SetSignature(v *service.Signature) { + if m != nil { + m.Signature = v + } +} + +// SetHeader sets header of the object. +func (m *GetResponse_Body_Init) SetHeader(v *Header) { + if m != nil { + m.Header = v + } +} + +// SetInit sets initial part of the object. +func (m *GetResponse_Body) SetInit(v *GetResponse_Body_Init) { + if m != nil { + m.ObjectPart = &GetResponse_Body_Init_{ + Init: v, + } + } +} + +// SetChunk sets chunk of the object payload bytes. +func (m *GetResponse_Body) SetChunk(v []byte) { + if m != nil { + m.ObjectPart = &GetResponse_Body_Chunk{ + Chunk: v, + } + } +} + +// SetBody sets body of the response. +func (m *GetResponse) SetBody(v *GetResponse_Body) { + if m != nil { + m.Body = v + } +} + +// SetMetaHeader sets meta header of the response. +func (m *GetResponse) SetMetaHeader(v *service.ResponseMetaHeader) { + if m != nil { + m.MetaHeader = v + } +} + +// SetVerifyHeader sets verification header of the response. +func (m *GetResponse) SetVerifyHeader(v *service.ResponseVerificationHeader) { + if m != nil { + m.VerifyHeader = v + } +} + +// SetObjectId sets identifier of the object. +func (m *PutRequest_Body_Init) SetObjectId(v *refs.ObjectID) { + if m != nil { + m.ObjectId = v + } +} + +// SetSignature sets signature of the object identifier. +func (m *PutRequest_Body_Init) SetSignature(v *service.Signature) { + if m != nil { + m.Signature = v + } +} + +// SetHeader sets header of the object. +func (m *PutRequest_Body_Init) SetHeader(v *Header) { + if m != nil { + m.Header = v + } +} + +// SetCopiesNumber sets number of the copies to save. +func (m *PutRequest_Body_Init) SetCopiesNumber(v uint32) { + if m != nil { + m.CopiesNumber = v + } +} + +// SetInit sets initial part of the object. +func (m *PutRequest_Body) SetInit(v *PutRequest_Body_Init) { + if m != nil { + m.ObjectPart = &PutRequest_Body_Init_{ + Init: v, + } + } +} + +// SetChunk sets chunk of the object paloyad bytes. +func (m *PutRequest_Body) SetChunk(v []byte) { + if m != nil { + m.ObjectPart = &PutRequest_Body_Chunk{ + Chunk: v, + } + } +} + +// SetBody sets body of the request. +func (m *PutRequest) SetBody(v *PutRequest_Body) { + if m != nil { + m.Body = v + } +} + +// SetMetaHeader sets meta header of the request. +func (m *PutRequest) SetMetaHeader(v *service.RequestMetaHeader) { + if m != nil { + m.MetaHeader = v + } +} + +// SetVerifyHeader sets verification header of the request. +func (m *PutRequest) SetVerifyHeader(v *service.RequestVerificationHeader) { + if m != nil { + m.VerifyHeader = v + } +} + +// SetObjectId sets identifier of the saved object. +func (m *PutResponse_Body) SetObjectId(v *refs.ObjectID) { + if m != nil { + m.ObjectId = v + } +} + +// SetBody sets body of the response. +func (m *PutResponse) SetBody(v *PutResponse_Body) { + if m != nil { + m.Body = v + } +} + +// SetMetaHeader sets meta header of the response. +func (m *PutResponse) SetMetaHeader(v *service.ResponseMetaHeader) { + if m != nil { + m.MetaHeader = v + } +} + +// SetVerifyHeader sets verification header of the response. +func (m *PutResponse) SetVerifyHeader(v *service.ResponseVerificationHeader) { + if m != nil { + m.VerifyHeader = v + } +} + +// SetAddress sets address of the object to delete. +func (m *DeleteRequest_Body) SetAddress(v *refs.Address) { + if m != nil { + m.Address = v + } +} + +// SetOwnerId sets identifier of the removing object owner. +func (m *DeleteRequest_Body) SetOwnerId(v *refs.OwnerID) { + if m != nil { + m.OwnerId = v + } +} + +// SetBody sets body of the request. +func (m *DeleteRequest) SetBody(v *DeleteRequest_Body) { + if m != nil { + m.Body = v + } +} + +// SetMetaHeader sets meta header of the request. +func (m *DeleteRequest) SetMetaHeader(v *service.RequestMetaHeader) { + if m != nil { + m.MetaHeader = v + } +} + +// SetVerifyHeader sets verification header of the request. +func (m *DeleteRequest) SetVerifyHeader(v *service.RequestVerificationHeader) { + if m != nil { + m.VerifyHeader = v + } +} + +// SetBody sets body of the response. +func (m *DeleteResponse) SetBody(v *DeleteResponse_Body) { + if m != nil { + m.Body = v + } +} + +// SetMetaHeader sets meta header of the response. +func (m *DeleteResponse) SetMetaHeader(v *service.ResponseMetaHeader) { + if m != nil { + m.MetaHeader = v + } +} + +// SetVerifyHeader sets verification header of the response. +func (m *DeleteResponse) SetVerifyHeader(v *service.ResponseVerificationHeader) { + if m != nil { + m.VerifyHeader = v + } +} + +// SetOwnerId sets identifier of the object with the requested header. +func (m *HeadRequest_Body) SetOwnerId(v *refs.Address) { + if m != nil { + m.Address = v + } +} + +// SetMainOnly sets flag to return the minimal header subset. +func (m *HeadRequest_Body) SetMainOnly(v bool) { + if m != nil { + m.MainOnly = v + } +} + +// SetRaw sets raw flag of the request. +func (m *HeadRequest_Body) SetRaw(v bool) { + if m != nil { + m.Raw = v + } +} + +// SetBody sets body of the request. +func (m *HeadRequest) SetBody(v *HeadRequest_Body) { + if m != nil { + m.Body = v + } +} + +// SetMetaHeader sets meta header of the request. +func (m *HeadRequest) SetMetaHeader(v *service.RequestMetaHeader) { + if m != nil { + m.MetaHeader = v + } +} + +// SetVerifyHeader sets verification header of the request. +func (m *HeadRequest) SetVerifyHeader(v *service.RequestVerificationHeader) { + if m != nil { + m.VerifyHeader = v + } +} + +// SetVersion sets version of the object format. +func (m *HeadResponse_Body_ShortHeader) SetVersion(v *service.Version) { + if m != nil { + m.Version = v + } +} + +// SetCreationEpoch sets creation epoch number of the object. +func (m *HeadResponse_Body_ShortHeader) SetCreationEpoch(v uint64) { + if m != nil { + m.CreationEpoch = v + } +} + +// SetOwnerId sets identifier of the object owner. +func (m *HeadResponse_Body_ShortHeader) SetOwnerId(v *refs.OwnerID) { + if m != nil { + m.OwnerId = v + } +} + +// SetObjectType sets type of the object. +func (m *HeadResponse_Body_ShortHeader) SetObjectType(v ObjectType) { + if m != nil { + m.ObjectType = v + } +} + +// SetPayloadLength sets length of the object payload. +func (m *HeadResponse_Body_ShortHeader) SetPayloadLength(v uint64) { + if m != nil { + m.PayloadLength = v + } +} + +// SetHeader sets full header of the object. +func (m *HeadResponse_Body) SetHeader(v *Header) { + if m != nil { + m.Head = &HeadResponse_Body_Header{ + Header: v, + } + } +} + +// SetShortHeader sets short header of the object. +func (m *HeadResponse_Body) SetShortHeader(v *HeadResponse_Body_ShortHeader) { + if m != nil { + m.Head = &HeadResponse_Body_ShortHeader_{ + ShortHeader: v, + } + } +} + +// SetBody sets body of the response. +func (m *HeadResponse) SetBody(v *HeadResponse_Body) { + if m != nil { + m.Body = v + } +} + +// SetMetaHeader sets meta header of the response. +func (m *HeadResponse) SetMetaHeader(v *service.ResponseMetaHeader) { + if m != nil { + m.MetaHeader = v + } +} + +// SetVerifyHeader sets verification header of the response. +func (m *HeadResponse) SetVerifyHeader(v *service.ResponseVerificationHeader) { + if m != nil { + m.VerifyHeader = v + } +} + +// SetMatchType sets match type of the filter. +func (m *SearchRequest_Body_Query_Filter) SetMatchType(v SearchRequest_Body_Query_Filter_MatchType) { + if m != nil { + m.MatchType = v + } +} + +// SetName sets name of the filtering header. +func (m *SearchRequest_Body_Query_Filter) SetName(v string) { + if m != nil { + m.Name = v + } +} + +// SetValue sets value of the filtering header. +func (m *SearchRequest_Body_Query_Filter) SetValue(v string) { + if m != nil { + m.Value = v + } +} + +// SetVersion sets version of the search query. +func (m *SearchRequest_Body_Query) SetVersion(v uint32) { + if m != nil { + m.Version = v + } +} + +// SetFilters sets list of the query filters. +func (m *SearchRequest_Body_Query) SetFilters(v []*SearchRequest_Body_Query_Filter) { + if m != nil { + m.Filters = v + } +} + +// SetRaw sets raw flag of the request. +func (m *SearchRequest_Body) SetContainerId(v *refs.ContainerID) { + if m != nil { + m.ContainerId = v + } +} + +// SetQuery sets search query structure. +func (m *SearchRequest_Body) SetQuery(v *SearchRequest_Body_Query) { + if m != nil { + m.Query = v + } +} + +// SetBody sets body of the request. +func (m *SearchRequest) SetBody(v *SearchRequest_Body) { + if m != nil { + m.Body = v + } +} + +// SetMetaHeader sets meta header of the request. +func (m *SearchRequest) SetMetaHeader(v *service.RequestMetaHeader) { + if m != nil { + m.MetaHeader = v + } +} + +// SetVerifyHeader sets verification header of the request. +func (m *SearchRequest) SetVerifyHeader(v *service.RequestVerificationHeader) { + if m != nil { + m.VerifyHeader = v + } +} + +// SetIdList sets list of the identifiers of the matched objects. +func (m *SearchResponse_Body) SetIdList(v []*refs.ObjectID) { + if m != nil { + m.IdList = v + } +} + +// SetBody sets body of the response. +func (m *SearchResponse) SetBody(v *SearchResponse_Body) { + if m != nil { + m.Body = v + } +} + +// SetMetaHeader sets meta header of the response. +func (m *SearchResponse) SetMetaHeader(v *service.ResponseMetaHeader) { + if m != nil { + m.MetaHeader = v + } +} + +// SetVerifyHeader sets verification header of the response. +func (m *SearchResponse) SetVerifyHeader(v *service.ResponseVerificationHeader) { + if m != nil { + m.VerifyHeader = v + } +} + +// SetOffset sets offset of the payload range. +func (m *Range) SetOffset(v uint64) { + if m != nil { + m.Offset = v + } +} + +// SetLength sets length of the payload range. +func (m *Range) SetLength(v uint64) { + if m != nil { + m.Length = v + } +} + +// SetAddress sets address of the object with the request payload range. +func (m *GetRangeRequest_Body) SetAddress(v *refs.Address) { + if m != nil { + m.Address = v + } +} + +// SetRange sets range of the object payload. +func (m *GetRangeRequest_Body) SetRange(v *Range) { + if m != nil { + m.Range = v + } +} + +// SetBody sets body of the request. +func (m *GetRangeRequest) SetBody(v *GetRangeRequest_Body) { + if m != nil { + m.Body = v + } +} + +// SetMetaHeader sets meta header of the request. +func (m *GetRangeRequest) SetMetaHeader(v *service.RequestMetaHeader) { + if m != nil { + m.MetaHeader = v + } +} + +// SetVerifyHeader sets verification header of the request. +func (m *GetRangeRequest) SetVerifyHeader(v *service.RequestVerificationHeader) { + if m != nil { + m.VerifyHeader = v + } +} + +// SetChunk sets chunk of the object payload. +func (m *GetRangeResponse_Body) SetChunk(v []byte) { + if m != nil { + m.Chunk = v + } +} + +// SetBody sets body of the response. +func (m *GetRangeResponse) SetBody(v *GetRangeResponse_Body) { + if m != nil { + m.Body = v + } +} + +// SetMetaHeader sets meta header of the response. +func (m *GetRangeResponse) SetMetaHeader(v *service.ResponseMetaHeader) { + if m != nil { + m.MetaHeader = v + } +} + +// SetVerifyHeader sets verification header of the response. +func (m *GetRangeResponse) SetVerifyHeader(v *service.ResponseVerificationHeader) { + if m != nil { + m.VerifyHeader = v + } +} + +// SetAddress sets address of the object with the request payload range. +func (m *GetRangeHashRequest_Body) SetAddress(v *refs.Address) { + if m != nil { + m.Address = v + } +} + +// SetRanges sets list of the ranges of the object payload. +func (m *GetRangeHashRequest_Body) SetRanges(v []*Range) { + if m != nil { + m.Ranges = v + } +} + +// SetSalt sets salt for the object payload ranges. +func (m *GetRangeHashRequest_Body) SetSalt(v []byte) { + if m != nil { + m.Salt = v + } +} + +// SetBody sets body of the request. +func (m *GetRangeHashRequest) SetBody(v *GetRangeHashRequest_Body) { + if m != nil { + m.Body = v + } +} + +// SetMetaHeader sets meta header of the request. +func (m *GetRangeHashRequest) SetMetaHeader(v *service.RequestMetaHeader) { + if m != nil { + m.MetaHeader = v + } +} + +// SetVerifyHeader sets verification header of the request. +func (m *GetRangeHashRequest) SetVerifyHeader(v *service.RequestVerificationHeader) { + if m != nil { + m.VerifyHeader = v + } +} diff --git a/object/v2/types.go b/object/v2/types.go new file mode 100644 index 0000000..9acd3fd --- /dev/null +++ b/object/v2/types.go @@ -0,0 +1,160 @@ +package v2 + +import ( + refs "github.com/nspcc-dev/neofs-api-go/refs/v2" + service "github.com/nspcc-dev/neofs-api-go/service/v2" +) + +// SetKey sets key to the object attribute. +func (m *Header_Attribute) SetKey(v string) { + if m != nil { + m.Key = v + } +} + +// SetValue sets value of the object attribute. +func (m *Header_Attribute) SetValue(v string) { + if m != nil { + m.Value = v + } +} + +// SetParent sets identifier of the parent object. +func (m *Header_Split) SetParent(v *refs.ObjectID) { + if m != nil { + m.Parent = v + } +} + +// SetPrevious sets identifier of the previous object in split-chain. +func (m *Header_Split) SetPrevious(v *refs.ObjectID) { + if m != nil { + m.Previous = v + } +} + +// SetParentSignature sets signature of the parent object header. +func (m *Header_Split) SetParentSignature(v *service.Signature) { + if m != nil { + m.ParentSignature = v + } +} + +// SetParentHeader sets parent header structure. +func (m *Header_Split) SetParentHeader(v *Header) { + if m != nil { + m.ParentHeader = v + } +} + +// SetChildren sets list of the identifiers of the child objects. +func (m *Header_Split) SetChildren(v []*refs.ObjectID) { + if m != nil { + m.Children = v + } +} + +// SetContainerId sets identifier of the container. +func (m *Header) SetContainerId(v *refs.ContainerID) { + if m != nil { + m.ContainerId = v + } +} + +// SetOwnerId sets identifier of the object owner. +func (m *Header) SetOwnerId(v *refs.OwnerID) { + if m != nil { + m.OwnerId = v + } +} + +// SetCreationEpoch sets creation epoch number. +func (m *Header) SetCreationEpoch(v uint64) { + if m != nil { + m.CreationEpoch = v + } +} + +// SetVersion sets version of the object format. +func (m *Header) SetVersion(v *service.Version) { + if m != nil { + m.Version = v + } +} + +// SetPayloadLength sets length of the object payload. +func (m *Header) SetPayloadLength(v uint64) { + if m != nil { + m.PayloadLength = v + } +} + +// SetPayloadHash sets hash of the object payload. +func (m *Header) SetPayloadHash(v []byte) { + if m != nil { + m.PayloadHash = v + } +} + +// SetObjectType sets type of the object. +func (m *Header) SetObjectType(v ObjectType) { + if m != nil { + m.ObjectType = v + } +} + +// SetHomomorphicHash sets homomorphic hash of the object payload. +func (m *Header) SetHomomorphicHash(v []byte) { + if m != nil { + m.HomomorphicHash = v + } +} + +// SetSessionToken sets session token. +func (m *Header) SetSessionToken(v *service.SessionToken) { + if m != nil { + m.SessionToken = v + } +} + +// SetAttributes sets list of the object attributes. +func (m *Header) SetAttributes(v []*Header_Attribute) { + if m != nil { + m.Attributes = v + } +} + +// SetSplit sets split header. +func (m *Header) SetSplit(v *Header_Split) { + if m != nil { + m.Split = v + } +} + +// SetObjectId sets identifier of the object. +func (m *Object) SetObjectId(v *refs.ObjectID) { + if m != nil { + m.ObjectId = v + } +} + +// SetSignature sets signature of the object identifier. +func (m *Object) SetSignature(v *service.Signature) { + if m != nil { + m.Signature = v + } +} + +// SetHeader sets header of the object. +func (m *Object) SetHeader(v *Header) { + if m != nil { + m.Header = v + } +} + +// SetPayload sets payload bytes of the object. +func (m *Object) SetPayload(v []byte) { + if m != nil { + m.Payload = v + } +} diff --git a/refs/v2/types.go b/refs/v2/types.go new file mode 100644 index 0000000..9381202 --- /dev/null +++ b/refs/v2/types.go @@ -0,0 +1,36 @@ +package v2 + +// SetValue sets container identifier in a binary format. +func (m *ContainerID) SetValue(v []byte) { + if m != nil { + m.Value = v + } +} + +// SetValue sets object identifier in a binary format. +func (m *ObjectID) SetValue(v []byte) { + if m != nil { + m.Value = v + } +} + +// SetValue sets owner identifier in a binary format. +func (m *OwnerID) SetValue(v []byte) { + if m != nil { + m.Value = v + } +} + +// SetContainerId sets container identifier of the address. +func (m *Address) SetContainerId(v *ContainerID) { + if m != nil { + m.ContainerId = v + } +} + +// SetObjectId sets object identifier of the address. +func (m *Address) SetObjectId(v *ObjectID) { + if m != nil { + m.ObjectId = v + } +} diff --git a/service/v2/meta.go b/service/v2/meta.go new file mode 100644 index 0000000..b9ac619 --- /dev/null +++ b/service/v2/meta.go @@ -0,0 +1,232 @@ +package v2 + +import ( + acl "github.com/nspcc-dev/neofs-api-go/acl/v2" + refs "github.com/nspcc-dev/neofs-api-go/refs/v2" +) + +// SetKey sets key to the X-Header. +func (m *XHeader) SetKey(v string) { + if m != nil { + m.Key = v + } +} + +// SetValue sets value of the X-Header. +func (m *XHeader) SetValue(v string) { + if m != nil { + m.Value = v + } +} + +// SetMajor sets major version number. +func (m *Version) SetMajor(v uint32) { + if m != nil { + m.Major = v + } +} + +// SetMinor sets minor version number. +func (m *Version) SetMinor(v uint32) { + if m != nil { + m.Minor = v + } +} + +// SetExp sets epoch number of the token expiration. +func (m *TokenLifetime) SetExp(v uint64) { + if m != nil { + m.Exp = v + } +} + +// SetNbf sets starting epoch number of the token. +func (m *TokenLifetime) SetNbf(v uint64) { + if m != nil { + m.Nbf = v + } +} + +// SetIat sets the number of the epoch in which the token was issued. +func (m *TokenLifetime) SetIat(v uint64) { + if m != nil { + m.Iat = v + } +} + +// SetId sets identifier of the session token. +func (m *SessionToken_Body) SetId(v []byte) { + if m != nil { + m.Id = v + } +} + +// SetOwnerId sets identifier of the session token owner. +func (m *SessionToken_Body) SetOwnerId(v *refs.OwnerID) { + if m != nil { + m.OwnerId = v + } +} + +// SetVerb sets verb of the session token. +func (m *SessionToken_Body) SetVerb(v SessionToken_Body_Verb) { + if m != nil { + m.Verb = v + } +} + +// SetLifetime sets lifetime of the session token. +func (m *SessionToken_Body) SetLifetime(v *TokenLifetime) { + if m != nil { + m.Lifetime = v + } +} + +// SetSessionKey sets public session key in a binary format. +func (m *SessionToken_Body) SetSessionKey(v []byte) { + if m != nil { + m.SessionKey = v + } +} + +// SetObjectAddressContext sets object context of the session token. +func (m *SessionToken_Body) SetObjectAddressContext(v *refs.Address) { + if m != nil { + m.Context = &SessionToken_Body_ObjectAddress{ + ObjectAddress: v, + } + } +} + +// SetBody sets session token body. +func (m *SessionToken) SetBody(v *SessionToken_Body) { + if m != nil { + m.Token = v + } +} + +// SetSignature sets session token signature. +func (m *SessionToken) SetSignature(v *Signature) { + if m != nil { + m.Signature = v + } +} + +// SetEaclTable sets eACL table of the bearer token. +func (m *BearerToken_Body) SetEaclTable(v *acl.EACLTable) { + if m != nil { + m.EaclTable = v + } +} + +// SetOwnerId sets identifier of the bearer token owner. +func (m *BearerToken_Body) SetOwnerId(v *refs.OwnerID) { + if m != nil { + m.OwnerId = v + } +} + +// SetLifetime sets lifetime of the bearer token. +func (m *BearerToken_Body) SetLifetime(v *TokenLifetime) { + if m != nil { + m.Lifetime = v + } +} + +// SetBody sets bearer token body. +func (m *BearerToken) SetBody(v *BearerToken_Body) { + if m != nil { + m.Token = v + } +} + +// SetSignature sets bearer token signature. +func (m *BearerToken) SetSignature(v *Signature) { + if m != nil { + m.Signature = v + } +} + +// SetVersion sets client protocol version. +func (m *RequestMetaHeader) SetVersion(v *Version) { + if m != nil { + m.Version = v + } +} + +// SetEpoch sets client local epoch. +func (m *RequestMetaHeader) SetEpoch(v uint64) { + if m != nil { + m.Epoch = v + } +} + +// SetTtl sets request TTL. +func (m *RequestMetaHeader) SetTtl(v uint32) { + if m != nil { + m.Ttl = v + } +} + +// SetXHeaders sets request X-Headers. +func (m *RequestMetaHeader) SetXHeaders(v []*XHeader) { + if m != nil { + m.XHeaders = v + } +} + +// SetSessionToken sets session token of the request. +func (m *RequestMetaHeader) SetSessionToken(v *SessionToken) { + if m != nil { + m.Token = v + } +} + +// SetBearerToken sets bearer token of the request. +func (m *RequestMetaHeader) SetBearerToken(v *BearerToken) { + if m != nil { + m.Bearer = v + } +} + +// SetOrigin sets origin request meta header. +func (m *RequestMetaHeader) SetOrigin(v *RequestMetaHeader) { + if m != nil { + m.Origin = v + } +} + +// SetVersion sets server protocol version. +func (m *ResponseMetaHeader) SetVersion(v *Version) { + if m != nil { + m.Version = v + } +} + +// SetEpoch sets server local epoch. +func (m *ResponseMetaHeader) SetEpoch(v uint64) { + if m != nil { + m.Epoch = v + } +} + +// SetTtl sets response TTL. +func (m *ResponseMetaHeader) SetTtl(v uint32) { + if m != nil { + m.Ttl = v + } +} + +// SetXHeaders sets response X-Headers. +func (m *ResponseMetaHeader) SetXHeaders(v []*XHeader) { + if m != nil { + m.XHeaders = v + } +} + +// SetOrigin sets origin response meta header. +func (m *ResponseMetaHeader) SetOrigin(v *ResponseMetaHeader) { + if m != nil { + m.Origin = v + } +} diff --git a/service/v2/verify.go b/service/v2/verify.go new file mode 100644 index 0000000..8e7e2cf --- /dev/null +++ b/service/v2/verify.go @@ -0,0 +1,71 @@ +package v2 + +// SetKey sets public key in a binary format. +func (m *Signature) SetKey(v []byte) { + if m != nil { + m.Key = v + } +} + +// SetSign sets signature. +func (m *Signature) SetSign(v []byte) { + if m != nil { + m.Sign = v + } +} + +// SetBodySignature sets signature of the request body. +func (m *RequestVerificationHeader) SetBodySignature(v *Signature) { + if m != nil { + m.BodySignature = v + } +} + +// SetMetaSignature sets signature of the request meta. +func (m *RequestVerificationHeader) SetMetaSignature(v *Signature) { + if m != nil { + m.MetaSignature = v + } +} + +// SetOriginSignature sets signature of the origin verification header of the request. +func (m *RequestVerificationHeader) SetOriginSignature(v *Signature) { + if m != nil { + m.OriginSignature = v + } +} + +// SetOrigin sets origin verification header of the request. +func (m *RequestVerificationHeader) SetOrigin(v *RequestVerificationHeader) { + if m != nil { + m.Origin = v + } +} + +// SetBodySignature sets signature of the response body. +func (m *ResponseVerificationHeader) SetBodySignature(v *Signature) { + if m != nil { + m.BodySignature = v + } +} + +// SetMetaSignature sets signature of the response meta. +func (m *ResponseVerificationHeader) SetMetaSignature(v *Signature) { + if m != nil { + m.MetaSignature = v + } +} + +// SetOriginSignature sets signature of the origin verification header of the response. +func (m *ResponseVerificationHeader) SetOriginSignature(v *Signature) { + if m != nil { + m.OriginSignature = v + } +} + +// SetOrigin sets origin verification header of the response. +func (m *ResponseVerificationHeader) SetOrigin(v *ResponseVerificationHeader) { + if m != nil { + m.Origin = v + } +} diff --git a/session/v2/service.go b/session/v2/service.go new file mode 100644 index 0000000..3c1b812 --- /dev/null +++ b/session/v2/service.go @@ -0,0 +1,76 @@ +package v2 + +import ( + refs "github.com/nspcc-dev/neofs-api-go/refs/v2" + service "github.com/nspcc-dev/neofs-api-go/service/v2" +) + +// SetOwnerId sets identifier of the session initiator. +func (m *CreateRequest_Body) SetOwnerId(v *refs.OwnerID) { + if m != nil { + m.OwnerId = v + } +} + +// SetLifetime sets lifetime of the session. +func (m *CreateRequest_Body) SetLifetime(v *service.TokenLifetime) { + if m != nil { + m.Lifetime = v + } +} + +// SetBody sets body of the request. +func (m *CreateRequest) SetBody(v *CreateRequest_Body) { + if m != nil { + m.Body = v + } +} + +// SetMetaHeader sets meta header of the request. +func (m *CreateRequest) SetMetaHeader(v *service.RequestMetaHeader) { + if m != nil { + m.MetaHeader = v + } +} + +// SetVerifyHeader sets verification header of the request. +func (m *CreateRequest) SetVerifyHeader(v *service.RequestVerificationHeader) { + if m != nil { + m.VerifyHeader = v + } +} + +// SetId sets identifier of the session token. +func (m *CreateResponse_Body) SetId(v []byte) { + if m != nil { + m.Id = v + } +} + +// SetSessionKey sets session public key in a binary format. +func (m *CreateResponse_Body) SetSessionKey(v []byte) { + if m != nil { + m.SessionKey = v + } +} + +// SetBody sets body of the response. +func (m *CreateResponse) SetBody(v *CreateResponse_Body) { + if m != nil { + m.Body = v + } +} + +// SetMetaHeader sets meta header of the response. +func (m *CreateResponse) SetMetaHeader(v *service.ResponseMetaHeader) { + if m != nil { + m.MetaHeader = v + } +} + +// SetVerifyHeader sets verification header of the response. +func (m *CreateResponse) SetVerifyHeader(v *service.ResponseVerificationHeader) { + if m != nil { + m.VerifyHeader = v + } +} diff --git a/storagegroup/v2/types.go b/storagegroup/v2/types.go new file mode 100644 index 0000000..a46acfb --- /dev/null +++ b/storagegroup/v2/types.go @@ -0,0 +1,33 @@ +package v2 + +import ( + refs "github.com/nspcc-dev/neofs-api-go/refs/v2" +) + +// SetValidationDataSize sets the total size of the payloads of the storage group. +func (m *StorageGroup) SetValidationDataSize(v uint64) { + if m != nil { + m.ValidationDataSize = v + } +} + +// SetValidationHash sets total homomorphic hash of the storage group payloads. +func (m *StorageGroup) SetValidationHash(v []byte) { + if m != nil { + m.ValidationHash = v + } +} + +// SetExpirationEpoch sets number of the last epoch of the storage group lifetime. +func (m *StorageGroup) SetExpirationEpoch(v uint64) { + if m != nil { + m.ExpirationEpoch = v + } +} + +// SetMembers sets list of the identifiers of the storage group members. +func (m *StorageGroup) SetMembers(v []*refs.ObjectID) { + if m != nil { + m.Members = v + } +} From 1f143e54bd63c13ca55631eb378598e012b4366b Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Thu, 13 Aug 2020 15:43:47 +0300 Subject: [PATCH 0268/1196] Move api-v2 files into v2 subdir This subdir contains generated proto files and small wrappers. --- {service => pkg}/signature/data.go | 0 {service => pkg}/signature/options.go | 0 {service => pkg}/signature/request.go | 0 {service => pkg}/signature/util.go | 0 service/v2/marshal.go | 21 - service/v2/signature.go | 17 - {accounting/v2 => v2/accounting}/service.go | 6 +- .../v2 => v2/accounting}/service.pb.go | 148 ++-- .../v2 => v2/accounting}/service.proto | 20 +- {acl/v2 => v2/acl}/types.go | 4 +- {acl/v2 => v2/acl}/types.pb.go | 152 ++-- {acl/v2 => v2/acl}/types.proto | 12 +- {container/v2 => v2/container}/marshal.go | 2 +- .../v2 => v2/container}/marshal_test.go | 6 +- {container/v2 => v2/container}/service.go | 8 +- {container/v2 => v2/container}/service.pb.go | 541 ++++++------- {container/v2 => v2/container}/service.proto | 86 +- {container/v2 => v2/container}/signature.go | 2 +- {container/v2 => v2/container}/types.go | 6 +- {container/v2 => v2/container}/types.pb.go | 87 ++- {container/v2 => v2/container}/types.proto | 16 +- {netmap/v2 => v2/netmap}/marshal.go | 2 +- {netmap/v2 => v2/netmap}/types.go | 2 +- {netmap/v2 => v2/netmap}/types.pb.go | 135 ++-- {netmap/v2 => v2/netmap}/types.proto | 4 +- {object/v2 => v2/object}/service.go | 6 +- {object/v2 => v2/object}/service.pb.go | 735 +++++++++--------- {object/v2 => v2/object}/service.proto | 112 +-- {object/v2 => v2/object}/types.go | 6 +- {object/v2 => v2/object}/types.pb.go | 201 ++--- {object/v2 => v2/object}/types.proto | 38 +- {refs/v2 => v2/refs}/marshal.go | 2 +- {refs/v2 => v2/refs}/marshal_test.go | 2 +- {refs/v2 => v2/refs}/types.go | 2 +- {refs/v2 => v2/refs}/types.pb.go | 60 +- {refs/v2 => v2/refs}/types.proto | 6 +- {service/v2 => v2/service}/meta.go | 6 +- {service/v2 => v2/service}/meta.pb.go | 180 ++--- {service/v2 => v2/service}/meta.proto | 18 +- {service/v2 => v2/service}/verify.go | 2 +- {service/v2 => v2/service}/verify.pb.go | 67 +- {service/v2 => v2/service}/verify.proto | 7 +- {session/v2 => v2/session}/service.go | 6 +- {session/v2 => v2/session}/service.pb.go | 155 ++-- {session/v2 => v2/session}/service.proto | 29 +- {storagegroup/v2 => v2/storagegroup}/types.go | 4 +- .../v2 => v2/storagegroup}/types.pb.go | 65 +- .../v2 => v2/storagegroup}/types.proto | 8 +- 48 files changed, 1479 insertions(+), 1515 deletions(-) rename {service => pkg}/signature/data.go (100%) rename {service => pkg}/signature/options.go (100%) rename {service => pkg}/signature/request.go (100%) rename {service => pkg}/signature/util.go (100%) delete mode 100644 service/v2/marshal.go delete mode 100644 service/v2/signature.go rename {accounting/v2 => v2/accounting}/service.go (92%) rename {accounting/v2 => v2/accounting}/service.pb.go (84%) rename {accounting/v2 => v2/accounting}/service.proto (79%) rename {acl/v2 => v2/acl}/types.go (96%) rename {acl/v2 => v2/acl}/types.pb.go (83%) rename {acl/v2 => v2/acl}/types.proto (91%) rename {container/v2 => v2/container}/marshal.go (99%) rename {container/v2 => v2/container}/marshal_test.go (92%) rename {container/v2 => v2/container}/service.go (97%) rename {container/v2 => v2/container}/service.pb.go (87%) rename {container/v2 => v2/container}/service.proto (77%) rename {container/v2 => v2/container}/signature.go (95%) rename {container/v2 => v2/container}/types.go (89%) rename {container/v2 => v2/container}/types.pb.go (84%) rename {container/v2 => v2/container}/types.proto (80%) rename {netmap/v2 => v2/netmap}/marshal.go (99%) rename {netmap/v2 => v2/netmap}/types.go (99%) rename {netmap/v2 => v2/netmap}/types.pb.go (90%) rename {netmap/v2 => v2/netmap}/types.proto (95%) rename {object/v2 => v2/object}/service.go (99%) rename {object/v2 => v2/object}/service.pb.go (88%) rename {object/v2 => v2/object}/service.proto (79%) rename {object/v2 => v2/object}/types.go (96%) rename {object/v2 => v2/object}/types.pb.go (84%) rename {object/v2 => v2/object}/types.proto (71%) rename {refs/v2 => v2/refs}/marshal.go (98%) rename {refs/v2 => v2/refs}/marshal_test.go (98%) rename {refs/v2 => v2/refs}/types.go (98%) rename {refs/v2 => v2/refs}/types.pb.go (90%) rename {refs/v2 => v2/refs}/types.proto (88%) rename {service/v2 => v2/service}/meta.go (97%) rename {service/v2 => v2/service}/meta.pb.go (90%) rename {service/v2 => v2/service}/meta.proto (89%) rename {service/v2 => v2/service}/verify.go (99%) rename {service/v2 => v2/service}/verify.pb.go (90%) rename {service/v2 => v2/service}/verify.proto (88%) rename {session/v2 => v2/session}/service.go (92%) rename {session/v2 => v2/session}/service.pb.go (83%) rename {session/v2 => v2/session}/service.proto (70%) rename {storagegroup/v2 => v2/storagegroup}/types.go (91%) rename {storagegroup/v2 => v2/storagegroup}/types.pb.go (80%) rename {storagegroup/v2 => v2/storagegroup}/types.proto (82%) diff --git a/service/signature/data.go b/pkg/signature/data.go similarity index 100% rename from service/signature/data.go rename to pkg/signature/data.go diff --git a/service/signature/options.go b/pkg/signature/options.go similarity index 100% rename from service/signature/options.go rename to pkg/signature/options.go diff --git a/service/signature/request.go b/pkg/signature/request.go similarity index 100% rename from service/signature/request.go rename to pkg/signature/request.go diff --git a/service/signature/util.go b/pkg/signature/util.go similarity index 100% rename from service/signature/util.go rename to pkg/signature/util.go diff --git a/service/v2/marshal.go b/service/v2/marshal.go deleted file mode 100644 index 54b7d10..0000000 --- a/service/v2/marshal.go +++ /dev/null @@ -1,21 +0,0 @@ -package v2 - -func (m *RequestMetaHeader) StableMarshal(buf []byte) ([]byte, error) { - // fixme: implement stable - return m.Marshal() -} - -func (m *RequestMetaHeader) StableSize() int { - // fixme: implement stable - return m.Size() -} - -func (m *RequestVerificationHeader) StableMarshal(buf []byte) ([]byte, error) { - // fixme: implement stable - return m.Marshal() -} - -func (m *RequestVerificationHeader) StableSize() int { - // fixme: implement stable - return m.Size() -} diff --git a/service/v2/signature.go b/service/v2/signature.go deleted file mode 100644 index 5470bea..0000000 --- a/service/v2/signature.go +++ /dev/null @@ -1,17 +0,0 @@ -package v2 - -func (m *RequestMetaHeader) ReadSignedData(buf []byte) ([]byte, error) { - return m.StableMarshal(buf) -} - -func (m *RequestMetaHeader) SignedDataSize() int { - return m.StableSize() -} - -func (m *RequestVerificationHeader) ReadSignedData(buf []byte) ([]byte, error) { - return m.StableMarshal(buf) -} - -func (m *RequestVerificationHeader) SignedDataSize() int { - return m.StableSize() -} diff --git a/accounting/v2/service.go b/v2/accounting/service.go similarity index 92% rename from accounting/v2/service.go rename to v2/accounting/service.go index 8898217..456d0e2 100644 --- a/accounting/v2/service.go +++ b/v2/accounting/service.go @@ -1,8 +1,8 @@ -package v2 +package accounting import ( - refs "github.com/nspcc-dev/neofs-api-go/refs/v2" - service "github.com/nspcc-dev/neofs-api-go/service/v2" + "github.com/nspcc-dev/neofs-api-go/v2/refs" + "github.com/nspcc-dev/neofs-api-go/v2/service" ) // SetValue sets value of the decimal number. diff --git a/accounting/v2/service.pb.go b/v2/accounting/service.pb.go similarity index 84% rename from accounting/v2/service.pb.go rename to v2/accounting/service.pb.go index 7d8eba9..0a4deda 100644 --- a/accounting/v2/service.pb.go +++ b/v2/accounting/service.pb.go @@ -1,14 +1,14 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: accounting/v2/service.proto +// source: v2/accounting/service.proto -package v2 +package accounting import ( context "context" fmt "fmt" proto "github.com/golang/protobuf/proto" - v21 "github.com/nspcc-dev/neofs-api-go/refs/v2" - v2 "github.com/nspcc-dev/neofs-api-go/service/v2" + refs "github.com/nspcc-dev/neofs-api-go/v2/refs" + service "github.com/nspcc-dev/neofs-api-go/v2/service" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" @@ -40,21 +40,21 @@ type BalanceRequest struct { Body *BalanceRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` // Carries request meta information. Header data is used only to regulate // message transport and does not affect request execution. - MetaHeader *v2.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" json:"meta_header,omitempty"` + MetaHeader *service.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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 *v2.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + VerifyHeader *service.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *BalanceRequest) Reset() { *m = BalanceRequest{} } func (m *BalanceRequest) String() string { return proto.CompactTextString(m) } func (*BalanceRequest) ProtoMessage() {} func (*BalanceRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_bac189e9286e823b, []int{0} + return fileDescriptor_484f6b0e24e3172f, []int{0} } func (m *BalanceRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -90,14 +90,14 @@ func (m *BalanceRequest) GetBody() *BalanceRequest_Body { return nil } -func (m *BalanceRequest) GetMetaHeader() *v2.RequestMetaHeader { +func (m *BalanceRequest) GetMetaHeader() *service.RequestMetaHeader { if m != nil { return m.MetaHeader } return nil } -func (m *BalanceRequest) GetVerifyHeader() *v2.RequestVerificationHeader { +func (m *BalanceRequest) GetVerifyHeader() *service.RequestVerificationHeader { if m != nil { return m.VerifyHeader } @@ -107,17 +107,17 @@ func (m *BalanceRequest) GetVerifyHeader() *v2.RequestVerificationHeader { type BalanceRequest_Body struct { // Carries user identifier in NeoFS system for which the balance // is requested. - OwnerId *v21.OwnerID `protobuf:"bytes,1,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + OwnerId *refs.OwnerID `protobuf:"bytes,1,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *BalanceRequest_Body) Reset() { *m = BalanceRequest_Body{} } func (m *BalanceRequest_Body) String() string { return proto.CompactTextString(m) } func (*BalanceRequest_Body) ProtoMessage() {} func (*BalanceRequest_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_bac189e9286e823b, []int{0, 0} + return fileDescriptor_484f6b0e24e3172f, []int{0, 0} } func (m *BalanceRequest_Body) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -146,7 +146,7 @@ func (m *BalanceRequest_Body) XXX_DiscardUnknown() { var xxx_messageInfo_BalanceRequest_Body proto.InternalMessageInfo -func (m *BalanceRequest_Body) GetOwnerId() *v21.OwnerID { +func (m *BalanceRequest_Body) GetOwnerId() *refs.OwnerID { if m != nil { return m.OwnerId } @@ -168,7 +168,7 @@ func (m *Decimal) Reset() { *m = Decimal{} } func (m *Decimal) String() string { return proto.CompactTextString(m) } func (*Decimal) ProtoMessage() {} func (*Decimal) Descriptor() ([]byte, []int) { - return fileDescriptor_bac189e9286e823b, []int{1} + return fileDescriptor_484f6b0e24e3172f, []int{1} } func (m *Decimal) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -219,21 +219,21 @@ type BalanceResponse struct { Body *BalanceResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` // Carries response meta information. Header data is used only to regulate // message transport and does not affect request execution. - MetaHeader *v2.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" json:"meta_header,omitempty"` + MetaHeader *service.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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 *v2.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + VerifyHeader *service.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *BalanceResponse) Reset() { *m = BalanceResponse{} } func (m *BalanceResponse) String() string { return proto.CompactTextString(m) } func (*BalanceResponse) ProtoMessage() {} func (*BalanceResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_bac189e9286e823b, []int{2} + return fileDescriptor_484f6b0e24e3172f, []int{2} } func (m *BalanceResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -269,14 +269,14 @@ func (m *BalanceResponse) GetBody() *BalanceResponse_Body { return nil } -func (m *BalanceResponse) GetMetaHeader() *v2.ResponseMetaHeader { +func (m *BalanceResponse) GetMetaHeader() *service.ResponseMetaHeader { if m != nil { return m.MetaHeader } return nil } -func (m *BalanceResponse) GetVerifyHeader() *v2.ResponseVerificationHeader { +func (m *BalanceResponse) GetVerifyHeader() *service.ResponseVerificationHeader { if m != nil { return m.VerifyHeader } @@ -295,7 +295,7 @@ func (m *BalanceResponse_Body) Reset() { *m = BalanceResponse_Body{} } func (m *BalanceResponse_Body) String() string { return proto.CompactTextString(m) } func (*BalanceResponse_Body) ProtoMessage() {} func (*BalanceResponse_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_bac189e9286e823b, []int{2, 0} + return fileDescriptor_484f6b0e24e3172f, []int{2, 0} } func (m *BalanceResponse_Body) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -332,46 +332,46 @@ func (m *BalanceResponse_Body) GetBalance() *Decimal { } func init() { - proto.RegisterType((*BalanceRequest)(nil), "accounting.v2.BalanceRequest") - proto.RegisterType((*BalanceRequest_Body)(nil), "accounting.v2.BalanceRequest.Body") - proto.RegisterType((*Decimal)(nil), "accounting.v2.Decimal") - proto.RegisterType((*BalanceResponse)(nil), "accounting.v2.BalanceResponse") - proto.RegisterType((*BalanceResponse_Body)(nil), "accounting.v2.BalanceResponse.Body") + proto.RegisterType((*BalanceRequest)(nil), "neo.fs.v2.accounting.BalanceRequest") + proto.RegisterType((*BalanceRequest_Body)(nil), "neo.fs.v2.accounting.BalanceRequest.Body") + proto.RegisterType((*Decimal)(nil), "neo.fs.v2.accounting.Decimal") + proto.RegisterType((*BalanceResponse)(nil), "neo.fs.v2.accounting.BalanceResponse") + proto.RegisterType((*BalanceResponse_Body)(nil), "neo.fs.v2.accounting.BalanceResponse.Body") } -func init() { proto.RegisterFile("accounting/v2/service.proto", fileDescriptor_bac189e9286e823b) } +func init() { proto.RegisterFile("v2/accounting/service.proto", fileDescriptor_484f6b0e24e3172f) } -var fileDescriptor_bac189e9286e823b = []byte{ - // 457 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x93, 0xdf, 0x6a, 0x13, 0x41, - 0x14, 0xc6, 0xdd, 0xb4, 0x1a, 0x3d, 0x35, 0x2a, 0x63, 0xd5, 0x12, 0xed, 0x22, 0x11, 0x45, 0x90, - 0xcc, 0xca, 0x16, 0xd4, 0x1b, 0x95, 0x86, 0x22, 0x8d, 0xe2, 0x1f, 0x56, 0x28, 0xe2, 0x4d, 0x99, - 0xcc, 0x9e, 0xa4, 0x03, 0xc9, 0xcc, 0xba, 0xb3, 0x59, 0xc9, 0x23, 0x78, 0xeb, 0x95, 0xcf, 0xe0, - 0x93, 0x78, 0xe9, 0x23, 0x48, 0x7c, 0x11, 0x99, 0x3f, 0x49, 0xba, 0xb2, 0x6d, 0xef, 0x76, 0xce, - 0xf9, 0xce, 0x37, 0xe7, 0xfb, 0xb1, 0x03, 0xb7, 0x19, 0xe7, 0x6a, 0x2a, 0x0b, 0x21, 0x47, 0x51, - 0x19, 0x47, 0x1a, 0xf3, 0x52, 0x70, 0xa4, 0x59, 0xae, 0x0a, 0x45, 0x5a, 0xab, 0x26, 0x2d, 0xe3, - 0xf6, 0xf5, 0x1c, 0x87, 0xda, 0xa8, 0x8a, 0x59, 0x86, 0xda, 0x69, 0xda, 0x37, 0xfc, 0x88, 0xa9, - 0x4f, 0xb0, 0x60, 0xbe, 0x7c, 0xeb, 0x58, 0xb9, 0xc4, 0x5c, 0x0c, 0x67, 0xae, 0xd1, 0xf9, 0xd6, - 0x80, 0x2b, 0x3d, 0x36, 0x66, 0x92, 0x63, 0x82, 0x5f, 0xa6, 0xa8, 0x0b, 0xf2, 0x04, 0xd6, 0x07, - 0x2a, 0x9d, 0x6d, 0x05, 0x77, 0x83, 0x87, 0x1b, 0x71, 0x87, 0x56, 0x6e, 0xa5, 0x55, 0x31, 0xed, - 0xa9, 0x74, 0x96, 0x58, 0x3d, 0x79, 0x01, 0x1b, 0xe6, 0xc6, 0xc3, 0x23, 0x64, 0x29, 0xe6, 0x5b, - 0x0d, 0x3b, 0xbe, 0x4d, 0x17, 0x19, 0xca, 0x98, 0xfa, 0xa1, 0xb7, 0x58, 0xb0, 0x7d, 0x2b, 0x4a, - 0x60, 0xb2, 0xfc, 0x26, 0xaf, 0xa1, 0xe5, 0x56, 0x5b, 0x38, 0xac, 0x59, 0x87, 0xfb, 0x35, 0x0e, - 0x07, 0x46, 0x27, 0x38, 0x2b, 0x84, 0x92, 0xde, 0xe9, 0xb2, 0x9b, 0x75, 0xa7, 0xf6, 0x0e, 0xac, - 0x9b, 0xcd, 0xc8, 0x23, 0xb8, 0xa8, 0xbe, 0x4a, 0xcc, 0x0f, 0x45, 0xea, 0xf3, 0x5c, 0xa3, 0x06, - 0x9b, 0xf1, 0x7a, 0x6f, 0x1a, 0xfd, 0xbd, 0xa4, 0x69, 0x15, 0xfd, 0xb4, 0xf3, 0x1c, 0x9a, 0x7b, - 0xc8, 0xc5, 0x84, 0x8d, 0xc9, 0x26, 0x9c, 0x2f, 0xd9, 0x78, 0x8a, 0x76, 0x68, 0x2d, 0x71, 0x07, - 0x72, 0x07, 0x2e, 0x65, 0x39, 0x72, 0xa1, 0x85, 0x92, 0x36, 0x5f, 0x2b, 0x59, 0x15, 0x3a, 0xdf, - 0x1b, 0x70, 0x75, 0x49, 0x47, 0x67, 0x4a, 0x6a, 0x24, 0x4f, 0x2b, 0x2c, 0xef, 0x9d, 0xc4, 0xd2, - 0xa9, 0x8f, 0xc3, 0x7c, 0x59, 0x07, 0x33, 0xac, 0xa2, 0x70, 0x53, 0x27, 0xd0, 0x7c, 0x53, 0x4f, - 0xf3, 0x41, 0x9d, 0xc5, 0x99, 0x38, 0x9f, 0x79, 0x9c, 0x8f, 0xa1, 0x39, 0x70, 0x3b, 0xfb, 0x44, - 0x37, 0xff, 0x4b, 0xe4, 0xf9, 0x25, 0x0b, 0x59, 0x7c, 0x00, 0xb0, 0xbb, 0x54, 0x90, 0x7d, 0x68, - 0xfa, 0xcc, 0x64, 0xfb, 0xd4, 0xff, 0xaa, 0x1d, 0x9e, 0x8e, 0xaa, 0xf7, 0xe9, 0xd7, 0x3c, 0x0c, - 0x7e, 0xcf, 0xc3, 0xe0, 0xcf, 0x3c, 0x0c, 0x7e, 0xfc, 0x0d, 0xcf, 0x7d, 0x8e, 0x46, 0xa2, 0x38, - 0x9a, 0x0e, 0x28, 0x57, 0x93, 0x48, 0xea, 0x8c, 0xf3, 0x6e, 0x8a, 0x65, 0x24, 0x51, 0x0d, 0x75, - 0x97, 0x65, 0xa2, 0x3b, 0x52, 0x51, 0xe5, 0x71, 0xfd, 0x6c, 0x6c, 0xbe, 0x43, 0xf5, 0xea, 0x23, - 0xdd, 0xfd, 0xd0, 0xa7, 0xab, 0x1d, 0x07, 0x17, 0xec, 0xc3, 0xd8, 0xf9, 0x17, 0x00, 0x00, 0xff, - 0xff, 0x07, 0x70, 0x83, 0xd8, 0x8b, 0x03, 0x00, 0x00, +var fileDescriptor_484f6b0e24e3172f = []byte{ + // 464 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x93, 0xdf, 0x6a, 0x13, 0x41, + 0x18, 0xc5, 0xdd, 0xb4, 0x1a, 0xfd, 0x6a, 0x15, 0xc6, 0x48, 0x4b, 0xd4, 0x20, 0xa1, 0x05, 0x15, + 0x33, 0x03, 0xeb, 0x85, 0x20, 0x54, 0x69, 0xa8, 0xc5, 0x5c, 0xf8, 0x6f, 0x85, 0x22, 0xde, 0x94, + 0xc9, 0xec, 0x97, 0x74, 0x20, 0x99, 0x59, 0x77, 0x36, 0x2b, 0x79, 0x13, 0x5f, 0xc0, 0x1b, 0x2f, + 0x7c, 0x0e, 0x2f, 0x7d, 0x04, 0x89, 0x2f, 0x22, 0x3b, 0x33, 0x49, 0x36, 0xb0, 0x6d, 0x73, 0xb7, + 0x33, 0x73, 0xce, 0x99, 0xef, 0xfc, 0xd8, 0x81, 0x7b, 0x79, 0xc8, 0xb8, 0x10, 0x7a, 0xa2, 0x32, + 0xa9, 0x86, 0xcc, 0x60, 0x9a, 0x4b, 0x81, 0x34, 0x49, 0x75, 0xa6, 0x49, 0x43, 0xa1, 0xa6, 0x03, + 0x43, 0xf3, 0x90, 0x2e, 0x35, 0xcd, 0x3b, 0x79, 0xc8, 0x52, 0x1c, 0x18, 0x96, 0x4d, 0x13, 0x34, + 0x4e, 0xda, 0xbc, 0x9b, 0x87, 0x73, 0x33, 0x1b, 0x63, 0xc6, 0xfd, 0xf6, 0x4e, 0x69, 0x3b, 0xc7, + 0x54, 0x0e, 0xa6, 0xee, 0xa0, 0xfd, 0xa3, 0x06, 0xb7, 0xba, 0x7c, 0xc4, 0x95, 0xc0, 0x08, 0xbf, + 0x4e, 0xd0, 0x64, 0xe4, 0x00, 0x36, 0xfb, 0x3a, 0x9e, 0xee, 0x06, 0x0f, 0x83, 0x47, 0x5b, 0xe1, + 0x63, 0x5a, 0x75, 0x39, 0x5d, 0xf5, 0xd0, 0xae, 0x8e, 0xa7, 0x91, 0xb5, 0x91, 0xd7, 0xb0, 0x55, + 0x5c, 0x7c, 0x7a, 0x86, 0x3c, 0xc6, 0x74, 0xb7, 0x66, 0x53, 0xf6, 0x4a, 0x29, 0xf3, 0x6e, 0xde, + 0xfb, 0x16, 0x33, 0xfe, 0xc6, 0x6a, 0x23, 0x18, 0x2f, 0xbe, 0xc9, 0x47, 0xd8, 0x76, 0x83, 0xce, + 0x83, 0x36, 0x6c, 0xd0, 0xd3, 0xf3, 0x83, 0x4e, 0x0a, 0xb9, 0x14, 0x3c, 0x93, 0x5a, 0xf9, 0xc0, + 0x9b, 0x2e, 0xc2, 0xad, 0x9a, 0x2f, 0x60, 0xb3, 0x98, 0x93, 0x84, 0x70, 0x5d, 0x7f, 0x53, 0x98, + 0x9e, 0xca, 0xd8, 0x97, 0xdc, 0x29, 0xa5, 0x16, 0x48, 0xe9, 0xfb, 0xe2, 0xbc, 0x77, 0x14, 0xd5, + 0xad, 0xb0, 0x17, 0xb7, 0x0f, 0xa0, 0x7e, 0x84, 0x42, 0x8e, 0xf9, 0x88, 0x34, 0xe0, 0x6a, 0xce, + 0x47, 0x13, 0xb4, 0xde, 0x8d, 0xc8, 0x2d, 0xc8, 0x7d, 0xb8, 0x91, 0xa4, 0x28, 0xa4, 0x91, 0x5a, + 0xd9, 0xd2, 0xdb, 0xd1, 0x72, 0xa3, 0xfd, 0xab, 0x06, 0xb7, 0x17, 0xc8, 0x4c, 0xa2, 0x95, 0x41, + 0xf2, 0x72, 0x85, 0xf3, 0x93, 0x4b, 0x38, 0x3b, 0x53, 0x19, 0xf4, 0x71, 0x15, 0xe8, 0xfd, 0x4a, + 0x3e, 0xce, 0x7c, 0x0e, 0xe9, 0xa8, 0x9a, 0x74, 0xe7, 0x82, 0xa4, 0x4b, 0x51, 0xbf, 0xf2, 0xa8, + 0x9f, 0x43, 0xbd, 0xef, 0x1a, 0xf8, 0x9a, 0x0f, 0xaa, 0x6b, 0x7a, 0xb6, 0xd1, 0x5c, 0x1d, 0xc6, + 0x00, 0x87, 0x8b, 0x63, 0x72, 0x02, 0x75, 0x0f, 0x82, 0xec, 0xad, 0xf3, 0x3f, 0x36, 0xf7, 0xd7, + 0xa2, 0xd9, 0xfd, 0xfc, 0x7b, 0xd6, 0x0a, 0xfe, 0xcc, 0x5a, 0xc1, 0xdf, 0x59, 0x2b, 0xf8, 0xfe, + 0xaf, 0x75, 0xe5, 0x0b, 0x1b, 0xca, 0xec, 0x6c, 0xd2, 0xa7, 0x42, 0x8f, 0x99, 0x32, 0x89, 0x10, + 0x9d, 0x18, 0x73, 0xa6, 0x50, 0x0f, 0x4c, 0x87, 0x27, 0xb2, 0x33, 0xd4, 0x6c, 0xe5, 0xa5, 0xfe, + 0xac, 0x35, 0xde, 0xa1, 0x3e, 0xfe, 0x44, 0x0f, 0x3f, 0xf4, 0xe8, 0x72, 0xe2, 0xfe, 0x35, 0xfb, + 0xbc, 0x9e, 0xfd, 0x0f, 0x00, 0x00, 0xff, 0xff, 0x4f, 0x91, 0xf3, 0x3d, 0xd8, 0x03, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -400,7 +400,7 @@ func NewAccountingClient(cc *grpc.ClientConn) AccountingClient { func (c *accountingClient) Balance(ctx context.Context, in *BalanceRequest, opts ...grpc.CallOption) (*BalanceResponse, error) { out := new(BalanceResponse) - err := c.cc.Invoke(ctx, "/accounting.v2.Accounting/Balance", in, out, opts...) + err := c.cc.Invoke(ctx, "/neo.fs.v2.accounting.Accounting/Balance", in, out, opts...) if err != nil { return nil, err } @@ -435,7 +435,7 @@ func _Accounting_Balance_Handler(srv interface{}, ctx context.Context, dec func( } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/accounting.v2.Accounting/Balance", + FullMethod: "/neo.fs.v2.accounting.Accounting/Balance", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(AccountingServer).Balance(ctx, req.(*BalanceRequest)) @@ -444,7 +444,7 @@ func _Accounting_Balance_Handler(srv interface{}, ctx context.Context, dec func( } var _Accounting_serviceDesc = grpc.ServiceDesc{ - ServiceName: "accounting.v2.Accounting", + ServiceName: "neo.fs.v2.accounting.Accounting", HandlerType: (*AccountingServer)(nil), Methods: []grpc.MethodDesc{ { @@ -453,7 +453,7 @@ var _Accounting_serviceDesc = grpc.ServiceDesc{ }, }, Streams: []grpc.StreamDesc{}, - Metadata: "accounting/v2/service.proto", + Metadata: "v2/accounting/service.proto", } func (m *BalanceRequest) Marshal() (dAtA []byte, err error) { @@ -907,7 +907,7 @@ func (m *BalanceRequest) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.MetaHeader == nil { - m.MetaHeader = &v2.RequestMetaHeader{} + m.MetaHeader = &service.RequestMetaHeader{} } if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -943,7 +943,7 @@ func (m *BalanceRequest) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.VerifyHeader == nil { - m.VerifyHeader = &v2.RequestVerificationHeader{} + m.VerifyHeader = &service.RequestVerificationHeader{} } if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -1033,7 +1033,7 @@ func (m *BalanceRequest_Body) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.OwnerId == nil { - m.OwnerId = &v21.OwnerID{} + m.OwnerId = &refs.OwnerID{} } if err := m.OwnerId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -1251,7 +1251,7 @@ func (m *BalanceResponse) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.MetaHeader == nil { - m.MetaHeader = &v2.ResponseMetaHeader{} + m.MetaHeader = &service.ResponseMetaHeader{} } if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -1287,7 +1287,7 @@ func (m *BalanceResponse) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.VerifyHeader == nil { - m.VerifyHeader = &v2.ResponseVerificationHeader{} + m.VerifyHeader = &service.ResponseVerificationHeader{} } if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err diff --git a/accounting/v2/service.proto b/v2/accounting/service.proto similarity index 79% rename from accounting/v2/service.proto rename to v2/accounting/service.proto index 6c12c6b..35d55a7 100644 --- a/accounting/v2/service.proto +++ b/v2/accounting/service.proto @@ -1,13 +1,13 @@ syntax = "proto3"; -package accounting.v2; +package neo.fs.v2.accounting; -option go_package = "github.com/nspcc-dev/neofs-api-go/accounting/v2"; +option go_package = "github.com/nspcc-dev/neofs-api-go/v2/accounting"; option csharp_namespace = "NeoFS.API.Accounting"; -import "refs/v2/types.proto"; -import "service/v2/meta.proto"; -import "service/v2/verify.proto"; +import "v2/refs/types.proto"; +import "v2/service/meta.proto"; +import "v2/service/verify.proto"; // The service provides methods for obtaining information // about the account balance in NeoFS system. @@ -27,7 +27,7 @@ message BalanceRequest { message Body { // Carries user identifier in NeoFS system for which the balance // is requested. - refs.v2.OwnerID owner_id = 1; + neo.fs.v2.refs.OwnerID owner_id = 1; } // Body of the balance request message. @@ -35,12 +35,12 @@ message BalanceRequest { // Carries request meta information. Header data is used only to regulate // message transport and does not affect request execution. - service.v2.RequestMetaHeader meta_header = 2; + neo.fs.v2.service.RequestMetaHeader meta_header = 2; // Carries request verification information. This header is used to // authenticate the nodes of the message route and check the correctness // of transmission. - service.v2.RequestVerificationHeader verify_header = 3; + neo.fs.v2.service.RequestVerificationHeader verify_header = 3; } // Decimal represents the decimal numbers. @@ -66,10 +66,10 @@ message BalanceResponse { // Carries response meta information. Header data is used only to regulate // message transport and does not affect request execution. - service.v2.ResponseMetaHeader meta_header = 2; + neo.fs.v2.service.ResponseMetaHeader meta_header = 2; // Carries response verification information. This header is used to // authenticate the nodes of the message route and check the correctness // of transmission. - service.v2.ResponseVerificationHeader verify_header = 3; + neo.fs.v2.service.ResponseVerificationHeader verify_header = 3; } diff --git a/acl/v2/types.go b/v2/acl/types.go similarity index 96% rename from acl/v2/types.go rename to v2/acl/types.go index 58eaf2e..6374787 100644 --- a/acl/v2/types.go +++ b/v2/acl/types.go @@ -1,7 +1,7 @@ -package v2 +package acl import ( - refs "github.com/nspcc-dev/neofs-api-go/refs/v2" + "github.com/nspcc-dev/neofs-api-go/v2/refs" ) // SetContainerId sets container identifier of the eACL table. diff --git a/acl/v2/types.pb.go b/v2/acl/types.pb.go similarity index 83% rename from acl/v2/types.pb.go rename to v2/acl/types.pb.go index 06711e2..e05fcf5 100644 --- a/acl/v2/types.pb.go +++ b/v2/acl/types.pb.go @@ -1,12 +1,12 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: acl/v2/types.proto +// source: v2/acl/types.proto -package v2 +package acl import ( fmt "fmt" proto "github.com/golang/protobuf/proto" - v2 "github.com/nspcc-dev/neofs-api-go/refs/v2" + refs "github.com/nspcc-dev/neofs-api-go/v2/refs" io "io" math "math" math_bits "math/bits" @@ -29,7 +29,7 @@ type Target int32 const ( // Unknown target, default value. Target_UNKNOWN Target = 0 - // User target rule is applied if sender is the owner of the container.v2. + // User target rule is applied if sender is the owner of the container. Target_USER Target = 1 // System target rule is applied if sender is the storage node within the // container or inner ring node. @@ -57,7 +57,7 @@ func (x Target) String() string { } func (Target) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_ab60484daff20d3c, []int{0} + return fileDescriptor_d237ab7979f0d6cf, []int{0} } // Operation is an enumeration of operation types. @@ -101,7 +101,7 @@ func (x EACLRecord_Operation) String() string { } func (EACLRecord_Operation) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_ab60484daff20d3c, []int{0, 0} + return fileDescriptor_d237ab7979f0d6cf, []int{0, 0} } // Action is an enumeration of EACL actions. @@ -130,7 +130,7 @@ func (x EACLRecord_Action) String() string { } func (EACLRecord_Action) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_ab60484daff20d3c, []int{0, 1} + return fileDescriptor_d237ab7979f0d6cf, []int{0, 1} } // Header is an enumeration of filtering header types. @@ -159,7 +159,7 @@ func (x EACLRecord_FilterInfo_Header) String() string { } func (EACLRecord_FilterInfo_Header) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_ab60484daff20d3c, []int{0, 0, 0} + return fileDescriptor_d237ab7979f0d6cf, []int{0, 0, 0} } // MatchType is an enumeration of match types. @@ -188,15 +188,15 @@ func (x EACLRecord_FilterInfo_MatchType) String() string { } func (EACLRecord_FilterInfo_MatchType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_ab60484daff20d3c, []int{0, 0, 1} + return fileDescriptor_d237ab7979f0d6cf, []int{0, 0, 1} } // EACLRecord groups information about extended ACL rule. type EACLRecord struct { // Operation carries type of operation. - Operation EACLRecord_Operation `protobuf:"varint,1,opt,name=operation,json=Operation,proto3,enum=acl.v2.EACLRecord_Operation" json:"operation,omitempty"` + Operation EACLRecord_Operation `protobuf:"varint,1,opt,name=operation,json=Operation,proto3,enum=neo.fs.v2.acl.EACLRecord_Operation" json:"operation,omitempty"` // Action carries ACL target action. - Action EACLRecord_Action `protobuf:"varint,2,opt,name=action,json=Action,proto3,enum=acl.v2.EACLRecord_Action" json:"action,omitempty"` + Action EACLRecord_Action `protobuf:"varint,2,opt,name=action,json=Action,proto3,enum=neo.fs.v2.acl.EACLRecord_Action" json:"action,omitempty"` // filters carries set of filters. Filters []*EACLRecord_FilterInfo `protobuf:"bytes,3,rep,name=filters,json=Filters,proto3" json:"filters,omitempty"` // targets carries information about extended ACL target list. @@ -210,7 +210,7 @@ func (m *EACLRecord) Reset() { *m = EACLRecord{} } func (m *EACLRecord) String() string { return proto.CompactTextString(m) } func (*EACLRecord) ProtoMessage() {} func (*EACLRecord) Descriptor() ([]byte, []int) { - return fileDescriptor_ab60484daff20d3c, []int{0} + return fileDescriptor_d237ab7979f0d6cf, []int{0} } func (m *EACLRecord) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -270,9 +270,9 @@ func (m *EACLRecord) GetTargets() []*EACLRecord_TargetInfo { // FilterInfo groups information about filter. type EACLRecord_FilterInfo struct { // Header carries type of header. - Header EACLRecord_FilterInfo_Header `protobuf:"varint,1,opt,name=header,json=HeaderType,proto3,enum=acl.v2.EACLRecord_FilterInfo_Header" json:"header,omitempty"` + Header EACLRecord_FilterInfo_Header `protobuf:"varint,1,opt,name=header,json=HeaderType,proto3,enum=neo.fs.v2.acl.EACLRecord_FilterInfo_Header" json:"header,omitempty"` // MatchType carries type of match. - MatchType EACLRecord_FilterInfo_MatchType `protobuf:"varint,2,opt,name=match_type,json=MatchType,proto3,enum=acl.v2.EACLRecord_FilterInfo_MatchType" json:"match_type,omitempty"` + MatchType EACLRecord_FilterInfo_MatchType `protobuf:"varint,2,opt,name=match_type,json=MatchType,proto3,enum=neo.fs.v2.acl.EACLRecord_FilterInfo_MatchType" json:"match_type,omitempty"` // header_name carries name of filtering header. HeaderName string `protobuf:"bytes,3,opt,name=header_name,json=Name,proto3" json:"header_name,omitempty"` // header_val carries value of filtering header. @@ -286,7 +286,7 @@ func (m *EACLRecord_FilterInfo) Reset() { *m = EACLRecord_FilterInfo{} } func (m *EACLRecord_FilterInfo) String() string { return proto.CompactTextString(m) } func (*EACLRecord_FilterInfo) ProtoMessage() {} func (*EACLRecord_FilterInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_ab60484daff20d3c, []int{0, 0} + return fileDescriptor_d237ab7979f0d6cf, []int{0, 0} } func (m *EACLRecord_FilterInfo) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -346,7 +346,7 @@ func (m *EACLRecord_FilterInfo) GetHeaderVal() string { // TargetInfo groups information about extended ACL target. type EACLRecord_TargetInfo struct { // target carries target of ACL rule. - Target Target `protobuf:"varint,1,opt,name=target,json=Role,proto3,enum=acl.v2.Target" json:"target,omitempty"` + Target Target `protobuf:"varint,1,opt,name=target,json=Role,proto3,enum=neo.fs.v2.acl.Target" json:"target,omitempty"` // key_list carries public keys of ACL target. KeyList [][]byte `protobuf:"bytes,2,rep,name=key_list,json=Keys,proto3" json:"key_list,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` @@ -358,7 +358,7 @@ func (m *EACLRecord_TargetInfo) Reset() { *m = EACLRecord_TargetInfo{} } func (m *EACLRecord_TargetInfo) String() string { return proto.CompactTextString(m) } func (*EACLRecord_TargetInfo) ProtoMessage() {} func (*EACLRecord_TargetInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_ab60484daff20d3c, []int{0, 1} + return fileDescriptor_d237ab7979f0d6cf, []int{0, 1} } func (m *EACLRecord_TargetInfo) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -405,7 +405,7 @@ func (m *EACLRecord_TargetInfo) GetKeyList() [][]byte { type EACLTable struct { // Carries identifier of the container that should use given // access control rules. - ContainerId *v2.ContainerID `protobuf:"bytes,1,opt,name=container_id,json=ContainerID,proto3" json:"container_id,omitempty"` + ContainerId *refs.ContainerID `protobuf:"bytes,1,opt,name=container_id,json=ContainerID,proto3" json:"container_id,omitempty"` // Records carries list of extended ACL rule records. Records []*EACLRecord `protobuf:"bytes,2,rep,name=records,json=Records,proto3" json:"records,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` @@ -417,7 +417,7 @@ func (m *EACLTable) Reset() { *m = EACLTable{} } func (m *EACLTable) String() string { return proto.CompactTextString(m) } func (*EACLTable) ProtoMessage() {} func (*EACLTable) Descriptor() ([]byte, []int) { - return fileDescriptor_ab60484daff20d3c, []int{1} + return fileDescriptor_d237ab7979f0d6cf, []int{1} } func (m *EACLTable) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -446,7 +446,7 @@ func (m *EACLTable) XXX_DiscardUnknown() { var xxx_messageInfo_EACLTable proto.InternalMessageInfo -func (m *EACLTable) GetContainerId() *v2.ContainerID { +func (m *EACLTable) GetContainerId() *refs.ContainerID { if m != nil { return m.ContainerId } @@ -461,64 +461,64 @@ func (m *EACLTable) GetRecords() []*EACLRecord { } func init() { - proto.RegisterEnum("acl.v2.Target", Target_name, Target_value) - proto.RegisterEnum("acl.v2.EACLRecord_Operation", EACLRecord_Operation_name, EACLRecord_Operation_value) - proto.RegisterEnum("acl.v2.EACLRecord_Action", EACLRecord_Action_name, EACLRecord_Action_value) - proto.RegisterEnum("acl.v2.EACLRecord_FilterInfo_Header", EACLRecord_FilterInfo_Header_name, EACLRecord_FilterInfo_Header_value) - proto.RegisterEnum("acl.v2.EACLRecord_FilterInfo_MatchType", EACLRecord_FilterInfo_MatchType_name, EACLRecord_FilterInfo_MatchType_value) - proto.RegisterType((*EACLRecord)(nil), "acl.v2.EACLRecord") - proto.RegisterType((*EACLRecord_FilterInfo)(nil), "acl.v2.EACLRecord.FilterInfo") - proto.RegisterType((*EACLRecord_TargetInfo)(nil), "acl.v2.EACLRecord.TargetInfo") - proto.RegisterType((*EACLTable)(nil), "acl.v2.EACLTable") + proto.RegisterEnum("neo.fs.v2.acl.Target", Target_name, Target_value) + proto.RegisterEnum("neo.fs.v2.acl.EACLRecord_Operation", EACLRecord_Operation_name, EACLRecord_Operation_value) + proto.RegisterEnum("neo.fs.v2.acl.EACLRecord_Action", EACLRecord_Action_name, EACLRecord_Action_value) + proto.RegisterEnum("neo.fs.v2.acl.EACLRecord_FilterInfo_Header", EACLRecord_FilterInfo_Header_name, EACLRecord_FilterInfo_Header_value) + proto.RegisterEnum("neo.fs.v2.acl.EACLRecord_FilterInfo_MatchType", EACLRecord_FilterInfo_MatchType_name, EACLRecord_FilterInfo_MatchType_value) + proto.RegisterType((*EACLRecord)(nil), "neo.fs.v2.acl.EACLRecord") + proto.RegisterType((*EACLRecord_FilterInfo)(nil), "neo.fs.v2.acl.EACLRecord.FilterInfo") + proto.RegisterType((*EACLRecord_TargetInfo)(nil), "neo.fs.v2.acl.EACLRecord.TargetInfo") + proto.RegisterType((*EACLTable)(nil), "neo.fs.v2.acl.EACLTable") } -func init() { proto.RegisterFile("acl/v2/types.proto", fileDescriptor_ab60484daff20d3c) } +func init() { proto.RegisterFile("v2/acl/types.proto", fileDescriptor_d237ab7979f0d6cf) } -var fileDescriptor_ab60484daff20d3c = []byte{ - // 674 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x54, 0xdd, 0x6e, 0xda, 0x4a, - 0x10, 0x8e, 0x8d, 0x63, 0x60, 0x20, 0x68, 0xb3, 0x27, 0xe7, 0x88, 0x44, 0xa7, 0x08, 0xa1, 0x48, - 0x45, 0x55, 0x63, 0x14, 0xaa, 0x2a, 0x52, 0xaf, 0xea, 0xc0, 0xf2, 0x93, 0x10, 0x93, 0xac, 0x4d, - 0xa3, 0xf4, 0x06, 0x6d, 0xcc, 0x92, 0xa0, 0x1a, 0x8c, 0x6c, 0x07, 0x89, 0x37, 0xe9, 0x33, 0xf4, - 0xb2, 0x4f, 0x51, 0xa9, 0x37, 0x7d, 0x84, 0x2a, 0x7d, 0x91, 0x6a, 0xbd, 0x10, 0x50, 0x9a, 0xe6, - 0x6a, 0xc7, 0x33, 0xdf, 0xb7, 0x33, 0xdf, 0xcc, 0x78, 0x01, 0x33, 0xd7, 0xab, 0xcc, 0xaa, 0x95, - 0x68, 0x3e, 0xe5, 0xa1, 0x31, 0x0d, 0xfc, 0xc8, 0xc7, 0x3a, 0x73, 0x3d, 0x63, 0x56, 0xdd, 0xfb, - 0x27, 0xe0, 0xc3, 0xf0, 0x51, 0xb0, 0xf4, 0x55, 0x07, 0x20, 0x66, 0xad, 0x43, 0xb9, 0xeb, 0x07, - 0x03, 0xfc, 0x0e, 0xd2, 0xfe, 0x94, 0x07, 0x2c, 0x1a, 0xf9, 0x93, 0xbc, 0x52, 0x54, 0xca, 0xb9, - 0xea, 0xff, 0x86, 0xe4, 0x1b, 0x2b, 0x98, 0xd1, 0x5d, 0x62, 0x68, 0xfa, 0xc1, 0xc4, 0x87, 0xa0, - 0x33, 0x37, 0x26, 0xaa, 0x31, 0x71, 0xf7, 0x09, 0xa2, 0x19, 0x03, 0xa8, 0x2e, 0x4f, 0x7c, 0x04, - 0xc9, 0xe1, 0xc8, 0x8b, 0x78, 0x10, 0xe6, 0x13, 0xc5, 0x44, 0x39, 0x53, 0x7d, 0xf1, 0x04, 0xa7, - 0x11, 0x23, 0xda, 0x93, 0xa1, 0x4f, 0x93, 0xd2, 0x0e, 0x05, 0x31, 0x62, 0xc1, 0x0d, 0x8f, 0xc2, - 0xbc, 0xf6, 0x57, 0xa2, 0x13, 0x23, 0x24, 0x51, 0xda, 0xe1, 0xde, 0x77, 0x15, 0x60, 0x75, 0x21, - 0x7e, 0x0f, 0xfa, 0x2d, 0x67, 0x03, 0x1e, 0x2c, 0xc4, 0xee, 0x3f, 0x9b, 0xdf, 0x68, 0xc5, 0x58, - 0x0a, 0xf2, 0x74, 0xe6, 0x53, 0x8e, 0x1b, 0x00, 0x63, 0x16, 0xb9, 0xb7, 0x7d, 0xd1, 0xd5, 0x85, - 0xf2, 0x97, 0xcf, 0xdf, 0x72, 0x26, 0xf0, 0x82, 0x4c, 0xd3, 0x0f, 0x26, 0xde, 0x85, 0x8c, 0xac, - 0xa4, 0x3f, 0x61, 0x63, 0x9e, 0x4f, 0x14, 0x95, 0x72, 0x9a, 0x6a, 0x16, 0x1b, 0x8b, 0x10, 0x2c, - 0x42, 0x33, 0xe6, 0xe5, 0xb5, 0x38, 0xb2, 0xf9, 0x81, 0x79, 0x77, 0xbc, 0xf4, 0x16, 0x74, 0x59, - 0x0b, 0xc6, 0x90, 0x6b, 0x11, 0xb3, 0x4e, 0x68, 0xbf, 0x67, 0x9d, 0x5a, 0xdd, 0x4b, 0x0b, 0x6d, - 0xe0, 0x0c, 0x24, 0x29, 0xb9, 0xe8, 0x11, 0xdb, 0x41, 0x0a, 0x06, 0xd0, 0xbb, 0xc7, 0x27, 0xa4, - 0xe6, 0x20, 0xb5, 0xd4, 0x80, 0xb5, 0xcc, 0xdb, 0xb0, 0x75, 0x66, 0x3a, 0xb5, 0xd6, 0x1a, 0x11, - 0x41, 0xd6, 0x76, 0x68, 0xdb, 0x6a, 0xf6, 0xc9, 0x45, 0xcf, 0xec, 0x20, 0x05, 0xef, 0x00, 0x5a, - 0x78, 0xac, 0xae, 0xb3, 0xf0, 0xaa, 0x7b, 0x27, 0x00, 0xab, 0x26, 0xe3, 0x7d, 0xd0, 0xe5, 0x50, - 0x16, 0xcd, 0xcc, 0x2d, 0xdb, 0x20, 0x31, 0x54, 0xa3, 0xbe, 0xc7, 0xf1, 0x7f, 0x90, 0xfa, 0xc4, - 0xe7, 0x7d, 0x6f, 0x14, 0x46, 0x79, 0xb5, 0x98, 0x28, 0x67, 0xa9, 0x76, 0xca, 0xe7, 0x61, 0x69, - 0x06, 0x6b, 0xbb, 0xf4, 0x2f, 0x6c, 0x77, 0xcf, 0x09, 0x35, 0x9d, 0x76, 0xd7, 0x5a, 0xab, 0x2b, - 0x09, 0x89, 0x26, 0x11, 0x62, 0x52, 0xa0, 0x09, 0xb5, 0x48, 0x15, 0xae, 0xf3, 0x9e, 0x83, 0x12, - 0x42, 0x5f, 0x9d, 0x74, 0x88, 0x43, 0x90, 0x26, 0x6c, 0x9b, 0x98, 0xb4, 0xd6, 0x42, 0x9b, 0x38, - 0x0b, 0xa9, 0x26, 0x71, 0xa8, 0x69, 0x35, 0x09, 0xd2, 0x85, 0xb2, 0xe5, 0x57, 0xcb, 0xb4, 0x5b, - 0x28, 0x59, 0x3a, 0x84, 0xe5, 0x36, 0x62, 0xc8, 0x99, 0xb5, 0x47, 0x19, 0xd3, 0xb0, 0x69, 0x76, - 0x3a, 0xdd, 0x4b, 0x99, 0xb3, 0x4e, 0xac, 0x2b, 0xa4, 0x96, 0x02, 0x48, 0x8b, 0xc9, 0x3a, 0xec, - 0xda, 0xe3, 0xf8, 0x08, 0xb2, 0xae, 0x3f, 0x89, 0xd8, 0x68, 0xc2, 0x83, 0xfe, 0x68, 0x10, 0x6b, - 0xcf, 0x54, 0x77, 0x0c, 0xf1, 0xb7, 0x09, 0xf1, 0xb5, 0x65, 0xb0, 0x5d, 0xa7, 0x99, 0xb5, 0x0f, - 0xfc, 0x1a, 0x92, 0x41, 0xbc, 0x1b, 0x61, 0xdc, 0x87, 0x4c, 0x15, 0xff, 0xb9, 0x36, 0x34, 0x29, - 0xcf, 0xf0, 0xd5, 0x11, 0xe8, 0xb2, 0x8d, 0x62, 0xaa, 0xab, 0xfa, 0x52, 0xa0, 0xf5, 0x6c, 0x42, - 0xe5, 0x7c, 0xed, 0x2b, 0xdb, 0x21, 0x67, 0x48, 0x8d, 0x67, 0xed, 0xb4, 0x08, 0xb5, 0x51, 0xe2, - 0xf8, 0xe4, 0xdb, 0x7d, 0x41, 0xf9, 0x71, 0x5f, 0x50, 0x7e, 0xde, 0x17, 0x94, 0xcf, 0xbf, 0x0a, - 0x1b, 0x1f, 0xcb, 0x37, 0xa3, 0xe8, 0xf6, 0xee, 0xda, 0x70, 0xfd, 0x71, 0x65, 0x12, 0x4e, 0x5d, - 0xf7, 0x60, 0xc0, 0x67, 0x95, 0x09, 0xf7, 0x87, 0xe1, 0x01, 0x9b, 0x8e, 0x0e, 0x6e, 0xfc, 0x8a, - 0x7c, 0x46, 0xbe, 0xa8, 0x5b, 0x16, 0xf7, 0x1b, 0xb6, 0x61, 0x9e, 0xb7, 0x0d, 0xd3, 0xf5, 0xae, - 0xf5, 0xf8, 0xd1, 0x78, 0xf3, 0x3b, 0x00, 0x00, 0xff, 0xff, 0xc3, 0x1e, 0x3c, 0xb6, 0x67, 0x04, - 0x00, 0x00, +var fileDescriptor_d237ab7979f0d6cf = []byte{ + // 683 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x54, 0xcd, 0x6e, 0xda, 0x40, + 0x10, 0x8e, 0x8d, 0x63, 0x60, 0x20, 0xd1, 0x66, 0xdb, 0x54, 0x24, 0x95, 0x10, 0xa2, 0x3d, 0xa0, + 0x46, 0x31, 0x2a, 0x51, 0xd5, 0x9e, 0x22, 0x39, 0xb0, 0x01, 0x12, 0x30, 0xc9, 0xda, 0x34, 0x4a, + 0x2f, 0xc8, 0x31, 0x4b, 0x82, 0x6a, 0x6c, 0x64, 0x3b, 0x48, 0xdc, 0xfa, 0x18, 0x7d, 0x86, 0x3e, + 0x49, 0x8f, 0xbd, 0xf6, 0x56, 0x25, 0x2f, 0x52, 0xad, 0x17, 0x82, 0x1b, 0x29, 0x6a, 0x4e, 0x3b, + 0xde, 0xf9, 0xbe, 0xf9, 0xf9, 0x66, 0xbc, 0x80, 0x67, 0xb5, 0xaa, 0xed, 0xb8, 0xd5, 0x68, 0x3e, + 0x65, 0xa1, 0x36, 0x0d, 0xfc, 0xc8, 0xc7, 0x1b, 0x1e, 0xf3, 0xb5, 0x51, 0xa8, 0xcd, 0x6a, 0x9a, + 0xed, 0xb8, 0xbb, 0x2f, 0x66, 0xb5, 0x6a, 0xc0, 0x46, 0x61, 0x12, 0x53, 0xbe, 0x57, 0x01, 0x88, + 0x5e, 0xef, 0x50, 0xe6, 0xf8, 0xc1, 0x10, 0xeb, 0x90, 0xf5, 0xa7, 0x2c, 0xb0, 0xa3, 0xb1, 0xef, + 0x15, 0xa4, 0x92, 0x54, 0xd9, 0xac, 0xbd, 0xd1, 0xfe, 0x09, 0xa3, 0xad, 0xd0, 0x5a, 0x6f, 0x09, + 0xa5, 0xd9, 0x07, 0x13, 0x7f, 0x02, 0xd5, 0x76, 0x62, 0xbe, 0x1c, 0xf3, 0x4b, 0x4f, 0xf3, 0xf5, + 0x18, 0x47, 0x55, 0x71, 0xe2, 0x43, 0x48, 0x8f, 0xc6, 0x6e, 0xc4, 0x82, 0xb0, 0x90, 0x2a, 0xa5, + 0x2a, 0xb9, 0xda, 0xdb, 0xa7, 0xa9, 0xc7, 0x31, 0xb0, 0xed, 0x8d, 0x7c, 0x9a, 0x16, 0x76, 0xc8, + 0xf9, 0x91, 0x1d, 0x5c, 0xb3, 0x28, 0x2c, 0x28, 0xff, 0xe3, 0x5b, 0x31, 0x50, 0xf0, 0x85, 0x1d, + 0xee, 0xfe, 0x96, 0x01, 0x56, 0x71, 0x71, 0x13, 0xd4, 0x1b, 0x66, 0x0f, 0x59, 0xb0, 0x10, 0x62, + 0xef, 0x39, 0xd5, 0x68, 0xad, 0x98, 0x42, 0x41, 0x9c, 0xd6, 0x7c, 0xca, 0x70, 0x17, 0x60, 0x62, + 0x47, 0xce, 0xcd, 0x80, 0x0b, 0xbf, 0x50, 0x45, 0x7b, 0x56, 0xb0, 0x2e, 0xa7, 0xf1, 0x18, 0x34, + 0xfb, 0x60, 0xe2, 0x1d, 0xc8, 0x89, 0xba, 0x06, 0x9e, 0x3d, 0x61, 0x85, 0x54, 0x49, 0xaa, 0x64, + 0xa9, 0x62, 0xd8, 0x13, 0xee, 0x82, 0x85, 0x6b, 0x66, 0xbb, 0x05, 0x25, 0xf6, 0xac, 0x7f, 0xb6, + 0xdd, 0x5b, 0x56, 0xfe, 0x00, 0xaa, 0x28, 0x09, 0x63, 0xd8, 0x6c, 0x11, 0xbd, 0x41, 0xe8, 0xa0, + 0x6f, 0x9c, 0x1a, 0xbd, 0x0b, 0x03, 0xad, 0xe1, 0x1c, 0xa4, 0x29, 0x39, 0xef, 0x13, 0xd3, 0x42, + 0x12, 0x06, 0x50, 0x7b, 0x47, 0x27, 0xa4, 0x6e, 0x21, 0xb9, 0x7c, 0x0c, 0x89, 0xcc, 0x5b, 0xb0, + 0xd1, 0xd5, 0xad, 0x7a, 0x2b, 0x41, 0x44, 0x90, 0x37, 0x2d, 0xda, 0x36, 0x9a, 0x03, 0x72, 0xde, + 0xd7, 0x3b, 0x48, 0xc2, 0x2f, 0x01, 0x2d, 0x6e, 0x8c, 0x9e, 0xb5, 0xb8, 0x95, 0x77, 0xcf, 0x01, + 0x56, 0x92, 0xe3, 0x3d, 0x50, 0xc5, 0xa4, 0x16, 0xd2, 0x6e, 0x3f, 0x52, 0x43, 0x40, 0xa9, 0x42, + 0x7d, 0x97, 0xe1, 0x57, 0x90, 0xf9, 0xca, 0xe6, 0x03, 0x77, 0x1c, 0x46, 0x05, 0xb9, 0x94, 0xaa, + 0xe4, 0xa9, 0x72, 0xca, 0xe6, 0x61, 0x79, 0x06, 0x89, 0xad, 0xdb, 0x86, 0xad, 0xde, 0x19, 0xa1, + 0xba, 0xd5, 0xee, 0x19, 0x89, 0xf2, 0xd2, 0x90, 0x6a, 0x12, 0xde, 0x53, 0x06, 0x14, 0xde, 0x34, + 0x92, 0xf9, 0xd5, 0x59, 0xdf, 0x42, 0x29, 0xde, 0x66, 0x83, 0x74, 0x88, 0x45, 0x90, 0xc2, 0x6d, + 0x93, 0xe8, 0xb4, 0xde, 0x42, 0xeb, 0x38, 0x0f, 0x99, 0x26, 0xb1, 0xa8, 0x6e, 0x34, 0x09, 0x52, + 0x79, 0x83, 0xcb, 0xaf, 0x96, 0x6e, 0xb6, 0x50, 0xba, 0xfc, 0x1e, 0x96, 0x0b, 0x8b, 0x61, 0x53, + 0xaf, 0x3f, 0xca, 0x98, 0x85, 0x75, 0xbd, 0xd3, 0xe9, 0x5d, 0x88, 0x9c, 0x0d, 0x62, 0x5c, 0x22, + 0xb9, 0xfc, 0x4d, 0x82, 0x2c, 0x9f, 0xb0, 0x65, 0x5f, 0xb9, 0x0c, 0x1f, 0x42, 0xde, 0xf1, 0xbd, + 0xc8, 0x1e, 0x7b, 0x2c, 0x18, 0x8c, 0x87, 0xb1, 0x06, 0xb9, 0xda, 0xeb, 0x84, 0x06, 0xfc, 0x37, + 0xd5, 0xea, 0x4b, 0x4c, 0xbb, 0x41, 0x73, 0x89, 0x0f, 0x7c, 0x00, 0xe9, 0x20, 0x5e, 0x95, 0x30, + 0xd6, 0x23, 0x57, 0xdb, 0x79, 0x72, 0x99, 0x68, 0x5a, 0x9c, 0xe1, 0xbb, 0x8f, 0xa0, 0x0a, 0x55, + 0xf9, 0xac, 0x57, 0xe5, 0x66, 0x40, 0xe9, 0x9b, 0x84, 0x8a, 0xa9, 0x9b, 0x97, 0xa6, 0x45, 0xba, + 0x48, 0x8e, 0x37, 0xc0, 0x6a, 0x11, 0x6a, 0xa2, 0xd4, 0xd1, 0xc9, 0xcf, 0xbb, 0xa2, 0xf4, 0xeb, + 0xae, 0x28, 0xfd, 0xb9, 0x2b, 0x4a, 0xdf, 0xef, 0x8b, 0x6b, 0x5f, 0x2a, 0xd7, 0xe3, 0xe8, 0xe6, + 0xf6, 0x4a, 0x73, 0xfc, 0x49, 0xd5, 0x0b, 0xa7, 0x8e, 0xb3, 0x3f, 0x64, 0xb3, 0xaa, 0xc7, 0xfc, + 0x51, 0xb8, 0x6f, 0x4f, 0xc7, 0xfb, 0xd7, 0x7e, 0x55, 0xbc, 0x46, 0x3f, 0xe4, 0x0d, 0x83, 0xf9, + 0xc7, 0xa6, 0xa6, 0x9f, 0xb5, 0x35, 0xdd, 0x71, 0xaf, 0xd4, 0xf8, 0xd1, 0x39, 0xf8, 0x1b, 0x00, + 0x00, 0xff, 0xff, 0x60, 0xb0, 0x68, 0x1a, 0xae, 0x04, 0x00, 0x00, } func (m *EACLRecord) Marshal() (dAtA []byte, err error) { @@ -1327,7 +1327,7 @@ func (m *EACLTable) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.ContainerId == nil { - m.ContainerId = &v2.ContainerID{} + m.ContainerId = &refs.ContainerID{} } if err := m.ContainerId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err diff --git a/acl/v2/types.proto b/v2/acl/types.proto similarity index 91% rename from acl/v2/types.proto rename to v2/acl/types.proto index 58bbe25..a0a4c0b 100644 --- a/acl/v2/types.proto +++ b/v2/acl/types.proto @@ -1,18 +1,18 @@ syntax = "proto3"; -package acl.v2; +package neo.fs.v2.acl; -option go_package = "github.com/nspcc-dev/neofs-api-go/acl/v2"; +option go_package = "github.com/nspcc-dev/neofs-api-go/v2/acl"; option csharp_namespace = "NeoFS.API.Acl"; -import "refs/v2/types.proto"; +import "v2/refs/types.proto"; // Target of the access control rule in access control list. enum Target { // Unknown target, default value. UNKNOWN = 0; - // User target rule is applied if sender is the owner of the container.v2. + // User target rule is applied if sender is the owner of the container. USER = 1; // System target rule is applied if sender is the storage node within the @@ -85,7 +85,7 @@ message EACLRecord { // TargetInfo groups information about extended ACL target. message TargetInfo { // target carries target of ACL rule. - acl.v2.Target target = 1 [json_name="Role"]; + Target target = 1 [json_name="Role"]; // key_list carries public keys of ACL target. repeated bytes key_list = 2 [json_name="Keys"]; @@ -99,7 +99,7 @@ message EACLRecord { message EACLTable { // Carries identifier of the container that should use given // access control rules. - refs.v2.ContainerID container_id = 1 [json_name="ContainerID"]; + neo.fs.v2.refs.ContainerID container_id = 1 [json_name="ContainerID"]; // Records carries list of extended ACL rule records. repeated EACLRecord records = 2 [json_name="Records"]; diff --git a/container/v2/marshal.go b/v2/container/marshal.go similarity index 99% rename from container/v2/marshal.go rename to v2/container/marshal.go index 7dd25d2..2d8e1d0 100644 --- a/container/v2/marshal.go +++ b/v2/container/marshal.go @@ -1,4 +1,4 @@ -package v2 +package container import ( "encoding/binary" diff --git a/container/v2/marshal_test.go b/v2/container/marshal_test.go similarity index 92% rename from container/v2/marshal_test.go rename to v2/container/marshal_test.go index 180dcb1..43fa57f 100644 --- a/container/v2/marshal_test.go +++ b/v2/container/marshal_test.go @@ -1,10 +1,10 @@ -package v2 +package container import ( "testing" - netmap "github.com/nspcc-dev/neofs-api-go/netmap/v2" - refs "github.com/nspcc-dev/neofs-api-go/refs/v2" + "github.com/nspcc-dev/neofs-api-go/v2/netmap" + "github.com/nspcc-dev/neofs-api-go/v2/refs" "github.com/stretchr/testify/require" ) diff --git a/container/v2/service.go b/v2/container/service.go similarity index 97% rename from container/v2/service.go rename to v2/container/service.go index 1995b48..bde2b48 100644 --- a/container/v2/service.go +++ b/v2/container/service.go @@ -1,9 +1,9 @@ -package v2 +package container import ( - acl "github.com/nspcc-dev/neofs-api-go/acl/v2" - refs "github.com/nspcc-dev/neofs-api-go/refs/v2" - service "github.com/nspcc-dev/neofs-api-go/service/v2" + "github.com/nspcc-dev/neofs-api-go/v2/acl" + "github.com/nspcc-dev/neofs-api-go/v2/refs" + "github.com/nspcc-dev/neofs-api-go/v2/service" ) // SetContainer sets container of the request. diff --git a/container/v2/service.pb.go b/v2/container/service.pb.go similarity index 87% rename from container/v2/service.pb.go rename to v2/container/service.pb.go index 29fd633..2c7861d 100644 --- a/container/v2/service.pb.go +++ b/v2/container/service.pb.go @@ -1,15 +1,15 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: container/v2/service.proto +// source: v2/container/service.proto -package v2 +package container import ( context "context" fmt "fmt" proto "github.com/golang/protobuf/proto" - v22 "github.com/nspcc-dev/neofs-api-go/acl/v2" - v21 "github.com/nspcc-dev/neofs-api-go/refs/v2" - v2 "github.com/nspcc-dev/neofs-api-go/service/v2" + acl "github.com/nspcc-dev/neofs-api-go/v2/acl" + refs "github.com/nspcc-dev/neofs-api-go/v2/refs" + service "github.com/nspcc-dev/neofs-api-go/v2/service" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" @@ -34,21 +34,21 @@ type PutRequest struct { Body *PutRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` // Carries request meta information. Header data is used only to regulate // message transport and does not affect request execution. - MetaHeader *v2.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" json:"meta_header,omitempty"` + MetaHeader *service.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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 *v2.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + VerifyHeader *service.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *PutRequest) Reset() { *m = PutRequest{} } func (m *PutRequest) String() string { return proto.CompactTextString(m) } func (*PutRequest) ProtoMessage() {} func (*PutRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_1c484d370787a129, []int{0} + return fileDescriptor_6e23291a5a71033a, []int{0} } func (m *PutRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -84,14 +84,14 @@ func (m *PutRequest) GetBody() *PutRequest_Body { return nil } -func (m *PutRequest) GetMetaHeader() *v2.RequestMetaHeader { +func (m *PutRequest) GetMetaHeader() *service.RequestMetaHeader { if m != nil { return m.MetaHeader } return nil } -func (m *PutRequest) GetVerifyHeader() *v2.RequestVerificationHeader { +func (m *PutRequest) GetVerifyHeader() *service.RequestVerificationHeader { if m != nil { return m.VerifyHeader } @@ -115,7 +115,7 @@ func (m *PutRequest_Body) Reset() { *m = PutRequest_Body{} } func (m *PutRequest_Body) String() string { return proto.CompactTextString(m) } func (*PutRequest_Body) ProtoMessage() {} func (*PutRequest_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_1c484d370787a129, []int{0, 0} + return fileDescriptor_6e23291a5a71033a, []int{0, 0} } func (m *PutRequest_Body) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -170,21 +170,21 @@ type PutResponse struct { Body *PutResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` // Carries response meta information. Header data is used only to regulate // message transport and does not affect request execution. - MetaHeader *v2.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" json:"meta_header,omitempty"` + MetaHeader *service.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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 *v2.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + VerifyHeader *service.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *PutResponse) Reset() { *m = PutResponse{} } func (m *PutResponse) String() string { return proto.CompactTextString(m) } func (*PutResponse) ProtoMessage() {} func (*PutResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_1c484d370787a129, []int{1} + return fileDescriptor_6e23291a5a71033a, []int{1} } func (m *PutResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -220,14 +220,14 @@ func (m *PutResponse) GetBody() *PutResponse_Body { return nil } -func (m *PutResponse) GetMetaHeader() *v2.ResponseMetaHeader { +func (m *PutResponse) GetMetaHeader() *service.ResponseMetaHeader { if m != nil { return m.MetaHeader } return nil } -func (m *PutResponse) GetVerifyHeader() *v2.ResponseVerificationHeader { +func (m *PutResponse) GetVerifyHeader() *service.ResponseVerificationHeader { if m != nil { return m.VerifyHeader } @@ -235,18 +235,18 @@ func (m *PutResponse) GetVerifyHeader() *v2.ResponseVerificationHeader { } type PutResponse_Body struct { - // container_id carries identifier of the new container.v2. - ContainerId *v21.ContainerID `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + // container_id carries identifier of the new container. + ContainerId *refs.ContainerID `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *PutResponse_Body) Reset() { *m = PutResponse_Body{} } func (m *PutResponse_Body) String() string { return proto.CompactTextString(m) } func (*PutResponse_Body) ProtoMessage() {} func (*PutResponse_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_1c484d370787a129, []int{1, 0} + return fileDescriptor_6e23291a5a71033a, []int{1, 0} } func (m *PutResponse_Body) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -275,7 +275,7 @@ func (m *PutResponse_Body) XXX_DiscardUnknown() { var xxx_messageInfo_PutResponse_Body proto.InternalMessageInfo -func (m *PutResponse_Body) GetContainerId() *v21.ContainerID { +func (m *PutResponse_Body) GetContainerId() *refs.ContainerID { if m != nil { return m.ContainerId } @@ -287,21 +287,21 @@ type DeleteRequest struct { Body *DeleteRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` // Carries request meta information. Header data is used only to regulate // message transport and does not affect request execution. - MetaHeader *v2.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" json:"meta_header,omitempty"` + MetaHeader *service.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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 *v2.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + VerifyHeader *service.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *DeleteRequest) Reset() { *m = DeleteRequest{} } func (m *DeleteRequest) String() string { return proto.CompactTextString(m) } func (*DeleteRequest) ProtoMessage() {} func (*DeleteRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_1c484d370787a129, []int{2} + return fileDescriptor_6e23291a5a71033a, []int{2} } func (m *DeleteRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -337,14 +337,14 @@ func (m *DeleteRequest) GetBody() *DeleteRequest_Body { return nil } -func (m *DeleteRequest) GetMetaHeader() *v2.RequestMetaHeader { +func (m *DeleteRequest) GetMetaHeader() *service.RequestMetaHeader { if m != nil { return m.MetaHeader } return nil } -func (m *DeleteRequest) GetVerifyHeader() *v2.RequestVerificationHeader { +func (m *DeleteRequest) GetVerifyHeader() *service.RequestVerificationHeader { if m != nil { return m.VerifyHeader } @@ -354,7 +354,7 @@ func (m *DeleteRequest) GetVerifyHeader() *v2.RequestVerificationHeader { type DeleteRequest_Body struct { // container_id carries identifier of the container to delete // from NeoFS. - ContainerId *v21.ContainerID `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` + ContainerId *refs.ContainerID `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` // Signature of container id according to RFC-6979. Signature []byte `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` @@ -366,7 +366,7 @@ func (m *DeleteRequest_Body) Reset() { *m = DeleteRequest_Body{} } func (m *DeleteRequest_Body) String() string { return proto.CompactTextString(m) } func (*DeleteRequest_Body) ProtoMessage() {} func (*DeleteRequest_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_1c484d370787a129, []int{2, 0} + return fileDescriptor_6e23291a5a71033a, []int{2, 0} } func (m *DeleteRequest_Body) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -395,7 +395,7 @@ func (m *DeleteRequest_Body) XXX_DiscardUnknown() { var xxx_messageInfo_DeleteRequest_Body proto.InternalMessageInfo -func (m *DeleteRequest_Body) GetContainerId() *v21.ContainerID { +func (m *DeleteRequest_Body) GetContainerId() *refs.ContainerID { if m != nil { return m.ContainerId } @@ -416,21 +416,21 @@ type DeleteResponse struct { Body *DeleteResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` // Carries response meta information. Header data is used only to regulate // message transport and does not affect request execution. - MetaHeader *v2.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" json:"meta_header,omitempty"` + MetaHeader *service.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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 *v2.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + VerifyHeader *service.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *DeleteResponse) Reset() { *m = DeleteResponse{} } func (m *DeleteResponse) String() string { return proto.CompactTextString(m) } func (*DeleteResponse) ProtoMessage() {} func (*DeleteResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_1c484d370787a129, []int{3} + return fileDescriptor_6e23291a5a71033a, []int{3} } func (m *DeleteResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -466,14 +466,14 @@ func (m *DeleteResponse) GetBody() *DeleteResponse_Body { return nil } -func (m *DeleteResponse) GetMetaHeader() *v2.ResponseMetaHeader { +func (m *DeleteResponse) GetMetaHeader() *service.ResponseMetaHeader { if m != nil { return m.MetaHeader } return nil } -func (m *DeleteResponse) GetVerifyHeader() *v2.ResponseVerificationHeader { +func (m *DeleteResponse) GetVerifyHeader() *service.ResponseVerificationHeader { if m != nil { return m.VerifyHeader } @@ -490,7 +490,7 @@ func (m *DeleteResponse_Body) Reset() { *m = DeleteResponse_Body{} } func (m *DeleteResponse_Body) String() string { return proto.CompactTextString(m) } func (*DeleteResponse_Body) ProtoMessage() {} func (*DeleteResponse_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_1c484d370787a129, []int{3, 0} + return fileDescriptor_6e23291a5a71033a, []int{3, 0} } func (m *DeleteResponse_Body) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -524,21 +524,21 @@ type GetRequest struct { Body *GetRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` // Carries request meta information. Header data is used only to regulate // message transport and does not affect request execution. - MetaHeader *v2.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" json:"meta_header,omitempty"` + MetaHeader *service.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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 *v2.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + VerifyHeader *service.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetRequest) Reset() { *m = GetRequest{} } func (m *GetRequest) String() string { return proto.CompactTextString(m) } func (*GetRequest) ProtoMessage() {} func (*GetRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_1c484d370787a129, []int{4} + return fileDescriptor_6e23291a5a71033a, []int{4} } func (m *GetRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -574,14 +574,14 @@ func (m *GetRequest) GetBody() *GetRequest_Body { return nil } -func (m *GetRequest) GetMetaHeader() *v2.RequestMetaHeader { +func (m *GetRequest) GetMetaHeader() *service.RequestMetaHeader { if m != nil { return m.MetaHeader } return nil } -func (m *GetRequest) GetVerifyHeader() *v2.RequestVerificationHeader { +func (m *GetRequest) GetVerifyHeader() *service.RequestVerificationHeader { if m != nil { return m.VerifyHeader } @@ -590,17 +590,17 @@ func (m *GetRequest) GetVerifyHeader() *v2.RequestVerificationHeader { type GetRequest_Body struct { // container_id carries identifier of the container to get. - ContainerId *v21.ContainerID `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + ContainerId *refs.ContainerID `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetRequest_Body) Reset() { *m = GetRequest_Body{} } func (m *GetRequest_Body) String() string { return proto.CompactTextString(m) } func (*GetRequest_Body) ProtoMessage() {} func (*GetRequest_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_1c484d370787a129, []int{4, 0} + return fileDescriptor_6e23291a5a71033a, []int{4, 0} } func (m *GetRequest_Body) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -629,7 +629,7 @@ func (m *GetRequest_Body) XXX_DiscardUnknown() { var xxx_messageInfo_GetRequest_Body proto.InternalMessageInfo -func (m *GetRequest_Body) GetContainerId() *v21.ContainerID { +func (m *GetRequest_Body) GetContainerId() *refs.ContainerID { if m != nil { return m.ContainerId } @@ -641,21 +641,21 @@ type GetResponse struct { Body *GetResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` // Carries response meta information. Header data is used only to regulate // message transport and does not affect request execution. - MetaHeader *v2.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" json:"meta_header,omitempty"` + MetaHeader *service.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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 *v2.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + VerifyHeader *service.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetResponse) Reset() { *m = GetResponse{} } func (m *GetResponse) String() string { return proto.CompactTextString(m) } func (*GetResponse) ProtoMessage() {} func (*GetResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_1c484d370787a129, []int{5} + return fileDescriptor_6e23291a5a71033a, []int{5} } func (m *GetResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -691,14 +691,14 @@ func (m *GetResponse) GetBody() *GetResponse_Body { return nil } -func (m *GetResponse) GetMetaHeader() *v2.ResponseMetaHeader { +func (m *GetResponse) GetMetaHeader() *service.ResponseMetaHeader { if m != nil { return m.MetaHeader } return nil } -func (m *GetResponse) GetVerifyHeader() *v2.ResponseVerificationHeader { +func (m *GetResponse) GetVerifyHeader() *service.ResponseVerificationHeader { if m != nil { return m.VerifyHeader } @@ -717,7 +717,7 @@ func (m *GetResponse_Body) Reset() { *m = GetResponse_Body{} } func (m *GetResponse_Body) String() string { return proto.CompactTextString(m) } func (*GetResponse_Body) ProtoMessage() {} func (*GetResponse_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_1c484d370787a129, []int{5, 0} + return fileDescriptor_6e23291a5a71033a, []int{5, 0} } func (m *GetResponse_Body) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -758,21 +758,21 @@ type ListRequest struct { Body *ListRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` // Carries request meta information. Header data is used only to regulate // message transport and does not affect request execution. - MetaHeader *v2.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" json:"meta_header,omitempty"` + MetaHeader *service.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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 *v2.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + VerifyHeader *service.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *ListRequest) Reset() { *m = ListRequest{} } func (m *ListRequest) String() string { return proto.CompactTextString(m) } func (*ListRequest) ProtoMessage() {} func (*ListRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_1c484d370787a129, []int{6} + return fileDescriptor_6e23291a5a71033a, []int{6} } func (m *ListRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -808,14 +808,14 @@ func (m *ListRequest) GetBody() *ListRequest_Body { return nil } -func (m *ListRequest) GetMetaHeader() *v2.RequestMetaHeader { +func (m *ListRequest) GetMetaHeader() *service.RequestMetaHeader { if m != nil { return m.MetaHeader } return nil } -func (m *ListRequest) GetVerifyHeader() *v2.RequestVerificationHeader { +func (m *ListRequest) GetVerifyHeader() *service.RequestVerificationHeader { if m != nil { return m.VerifyHeader } @@ -824,17 +824,17 @@ func (m *ListRequest) GetVerifyHeader() *v2.RequestVerificationHeader { type ListRequest_Body struct { // owner_id carries identifier of the container owner. - OwnerId *v21.OwnerID `protobuf:"bytes,1,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + OwnerId *refs.OwnerID `protobuf:"bytes,1,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *ListRequest_Body) Reset() { *m = ListRequest_Body{} } func (m *ListRequest_Body) String() string { return proto.CompactTextString(m) } func (*ListRequest_Body) ProtoMessage() {} func (*ListRequest_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_1c484d370787a129, []int{6, 0} + return fileDescriptor_6e23291a5a71033a, []int{6, 0} } func (m *ListRequest_Body) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -863,7 +863,7 @@ func (m *ListRequest_Body) XXX_DiscardUnknown() { var xxx_messageInfo_ListRequest_Body proto.InternalMessageInfo -func (m *ListRequest_Body) GetOwnerId() *v21.OwnerID { +func (m *ListRequest_Body) GetOwnerId() *refs.OwnerID { if m != nil { return m.OwnerId } @@ -875,21 +875,21 @@ type ListResponse struct { Body *ListResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` // Carries response meta information. Header data is used only to regulate // message transport and does not affect request execution. - MetaHeader *v2.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" json:"meta_header,omitempty"` + MetaHeader *service.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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 *v2.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + VerifyHeader *service.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *ListResponse) Reset() { *m = ListResponse{} } func (m *ListResponse) String() string { return proto.CompactTextString(m) } func (*ListResponse) ProtoMessage() {} func (*ListResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_1c484d370787a129, []int{7} + return fileDescriptor_6e23291a5a71033a, []int{7} } func (m *ListResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -925,14 +925,14 @@ func (m *ListResponse) GetBody() *ListResponse_Body { return nil } -func (m *ListResponse) GetMetaHeader() *v2.ResponseMetaHeader { +func (m *ListResponse) GetMetaHeader() *service.ResponseMetaHeader { if m != nil { return m.MetaHeader } return nil } -func (m *ListResponse) GetVerifyHeader() *v2.ResponseVerificationHeader { +func (m *ListResponse) GetVerifyHeader() *service.ResponseVerificationHeader { if m != nil { return m.VerifyHeader } @@ -941,17 +941,17 @@ func (m *ListResponse) GetVerifyHeader() *v2.ResponseVerificationHeader { type ListResponse_Body struct { // ContainerIDs carries list of identifiers of the containers that belong to the owner. - ContainerIds []*v21.ContainerID `protobuf:"bytes,1,rep,name=container_ids,json=containerIds,proto3" json:"container_ids,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + ContainerIds []*refs.ContainerID `protobuf:"bytes,1,rep,name=container_ids,json=containerIds,proto3" json:"container_ids,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *ListResponse_Body) Reset() { *m = ListResponse_Body{} } func (m *ListResponse_Body) String() string { return proto.CompactTextString(m) } func (*ListResponse_Body) ProtoMessage() {} func (*ListResponse_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_1c484d370787a129, []int{7, 0} + return fileDescriptor_6e23291a5a71033a, []int{7, 0} } func (m *ListResponse_Body) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -980,7 +980,7 @@ func (m *ListResponse_Body) XXX_DiscardUnknown() { var xxx_messageInfo_ListResponse_Body proto.InternalMessageInfo -func (m *ListResponse_Body) GetContainerIds() []*v21.ContainerID { +func (m *ListResponse_Body) GetContainerIds() []*refs.ContainerID { if m != nil { return m.ContainerIds } @@ -992,21 +992,21 @@ type SetExtendedACLRequest struct { Body *SetExtendedACLRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` // Carries request meta information. Header data is used only to regulate // message transport and does not affect request execution. - MetaHeader *v2.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" json:"meta_header,omitempty"` + MetaHeader *service.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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 *v2.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + VerifyHeader *service.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *SetExtendedACLRequest) Reset() { *m = SetExtendedACLRequest{} } func (m *SetExtendedACLRequest) String() string { return proto.CompactTextString(m) } func (*SetExtendedACLRequest) ProtoMessage() {} func (*SetExtendedACLRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_1c484d370787a129, []int{8} + return fileDescriptor_6e23291a5a71033a, []int{8} } func (m *SetExtendedACLRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1042,14 +1042,14 @@ func (m *SetExtendedACLRequest) GetBody() *SetExtendedACLRequest_Body { return nil } -func (m *SetExtendedACLRequest) GetMetaHeader() *v2.RequestMetaHeader { +func (m *SetExtendedACLRequest) GetMetaHeader() *service.RequestMetaHeader { if m != nil { return m.MetaHeader } return nil } -func (m *SetExtendedACLRequest) GetVerifyHeader() *v2.RequestVerificationHeader { +func (m *SetExtendedACLRequest) GetVerifyHeader() *service.RequestVerificationHeader { if m != nil { return m.VerifyHeader } @@ -1057,8 +1057,8 @@ func (m *SetExtendedACLRequest) GetVerifyHeader() *v2.RequestVerificationHeader } type SetExtendedACLRequest_Body struct { - // Extended ACL to set for the container.v2. - Eacl *v22.EACLTable `protobuf:"bytes,1,opt,name=eacl,proto3" json:"eacl,omitempty"` + // Extended ACL to set for the container. + Eacl *acl.EACLTable `protobuf:"bytes,1,opt,name=eacl,proto3" json:"eacl,omitempty"` // Signature of stable-marshalled Extended ACL according to RFC-6979. Signature []byte `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` @@ -1070,7 +1070,7 @@ func (m *SetExtendedACLRequest_Body) Reset() { *m = SetExtendedACLReques func (m *SetExtendedACLRequest_Body) String() string { return proto.CompactTextString(m) } func (*SetExtendedACLRequest_Body) ProtoMessage() {} func (*SetExtendedACLRequest_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_1c484d370787a129, []int{8, 0} + return fileDescriptor_6e23291a5a71033a, []int{8, 0} } func (m *SetExtendedACLRequest_Body) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1099,7 +1099,7 @@ func (m *SetExtendedACLRequest_Body) XXX_DiscardUnknown() { var xxx_messageInfo_SetExtendedACLRequest_Body proto.InternalMessageInfo -func (m *SetExtendedACLRequest_Body) GetEacl() *v22.EACLTable { +func (m *SetExtendedACLRequest_Body) GetEacl() *acl.EACLTable { if m != nil { return m.Eacl } @@ -1118,21 +1118,21 @@ type SetExtendedACLResponse struct { Body *SetExtendedACLResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` // Carries response meta information. Header data is used only to regulate // message transport and does not affect request execution. - MetaHeader *v2.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" json:"meta_header,omitempty"` + MetaHeader *service.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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 *v2.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + VerifyHeader *service.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *SetExtendedACLResponse) Reset() { *m = SetExtendedACLResponse{} } func (m *SetExtendedACLResponse) String() string { return proto.CompactTextString(m) } func (*SetExtendedACLResponse) ProtoMessage() {} func (*SetExtendedACLResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_1c484d370787a129, []int{9} + return fileDescriptor_6e23291a5a71033a, []int{9} } func (m *SetExtendedACLResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1168,14 +1168,14 @@ func (m *SetExtendedACLResponse) GetBody() *SetExtendedACLResponse_Body { return nil } -func (m *SetExtendedACLResponse) GetMetaHeader() *v2.ResponseMetaHeader { +func (m *SetExtendedACLResponse) GetMetaHeader() *service.ResponseMetaHeader { if m != nil { return m.MetaHeader } return nil } -func (m *SetExtendedACLResponse) GetVerifyHeader() *v2.ResponseVerificationHeader { +func (m *SetExtendedACLResponse) GetVerifyHeader() *service.ResponseVerificationHeader { if m != nil { return m.VerifyHeader } @@ -1192,7 +1192,7 @@ func (m *SetExtendedACLResponse_Body) Reset() { *m = SetExtendedACLRespo func (m *SetExtendedACLResponse_Body) String() string { return proto.CompactTextString(m) } func (*SetExtendedACLResponse_Body) ProtoMessage() {} func (*SetExtendedACLResponse_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_1c484d370787a129, []int{9, 0} + return fileDescriptor_6e23291a5a71033a, []int{9, 0} } func (m *SetExtendedACLResponse_Body) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1226,21 +1226,21 @@ type GetExtendedACLRequest struct { Body *GetExtendedACLRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` // Carries request meta information. Header data is used only to regulate // message transport and does not affect request execution. - MetaHeader *v2.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" json:"meta_header,omitempty"` + MetaHeader *service.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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 *v2.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + VerifyHeader *service.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetExtendedACLRequest) Reset() { *m = GetExtendedACLRequest{} } func (m *GetExtendedACLRequest) String() string { return proto.CompactTextString(m) } func (*GetExtendedACLRequest) ProtoMessage() {} func (*GetExtendedACLRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_1c484d370787a129, []int{10} + return fileDescriptor_6e23291a5a71033a, []int{10} } func (m *GetExtendedACLRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1276,14 +1276,14 @@ func (m *GetExtendedACLRequest) GetBody() *GetExtendedACLRequest_Body { return nil } -func (m *GetExtendedACLRequest) GetMetaHeader() *v2.RequestMetaHeader { +func (m *GetExtendedACLRequest) GetMetaHeader() *service.RequestMetaHeader { if m != nil { return m.MetaHeader } return nil } -func (m *GetExtendedACLRequest) GetVerifyHeader() *v2.RequestVerificationHeader { +func (m *GetExtendedACLRequest) GetVerifyHeader() *service.RequestVerificationHeader { if m != nil { return m.VerifyHeader } @@ -1292,17 +1292,17 @@ func (m *GetExtendedACLRequest) GetVerifyHeader() *v2.RequestVerificationHeader type GetExtendedACLRequest_Body struct { // container_id carries identifier of the container that has Extended ACL. - ContainerId *v21.ContainerID `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + ContainerId *refs.ContainerID `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetExtendedACLRequest_Body) Reset() { *m = GetExtendedACLRequest_Body{} } func (m *GetExtendedACLRequest_Body) String() string { return proto.CompactTextString(m) } func (*GetExtendedACLRequest_Body) ProtoMessage() {} func (*GetExtendedACLRequest_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_1c484d370787a129, []int{10, 0} + return fileDescriptor_6e23291a5a71033a, []int{10, 0} } func (m *GetExtendedACLRequest_Body) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1331,7 +1331,7 @@ func (m *GetExtendedACLRequest_Body) XXX_DiscardUnknown() { var xxx_messageInfo_GetExtendedACLRequest_Body proto.InternalMessageInfo -func (m *GetExtendedACLRequest_Body) GetContainerId() *v21.ContainerID { +func (m *GetExtendedACLRequest_Body) GetContainerId() *refs.ContainerID { if m != nil { return m.ContainerId } @@ -1343,21 +1343,21 @@ type GetExtendedACLResponse struct { Body *GetExtendedACLResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` // Carries response meta information. Header data is used only to regulate // message transport and does not affect request execution. - MetaHeader *v2.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" json:"meta_header,omitempty"` + MetaHeader *service.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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 *v2.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + VerifyHeader *service.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetExtendedACLResponse) Reset() { *m = GetExtendedACLResponse{} } func (m *GetExtendedACLResponse) String() string { return proto.CompactTextString(m) } func (*GetExtendedACLResponse) ProtoMessage() {} func (*GetExtendedACLResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_1c484d370787a129, []int{11} + return fileDescriptor_6e23291a5a71033a, []int{11} } func (m *GetExtendedACLResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1393,14 +1393,14 @@ func (m *GetExtendedACLResponse) GetBody() *GetExtendedACLResponse_Body { return nil } -func (m *GetExtendedACLResponse) GetMetaHeader() *v2.ResponseMetaHeader { +func (m *GetExtendedACLResponse) GetMetaHeader() *service.ResponseMetaHeader { if m != nil { return m.MetaHeader } return nil } -func (m *GetExtendedACLResponse) GetVerifyHeader() *v2.ResponseVerificationHeader { +func (m *GetExtendedACLResponse) GetVerifyHeader() *service.ResponseVerificationHeader { if m != nil { return m.VerifyHeader } @@ -1409,7 +1409,7 @@ func (m *GetExtendedACLResponse) GetVerifyHeader() *v2.ResponseVerificationHeade type GetExtendedACLResponse_Body struct { // Extended ACL that has been requested if it was set up. - Eacl *v22.EACLTable `protobuf:"bytes,1,opt,name=eacl,proto3" json:"eacl,omitempty"` + Eacl *acl.EACLTable `protobuf:"bytes,1,opt,name=eacl,proto3" json:"eacl,omitempty"` // Signature of stable-marshalled Extended ACL according to RFC-6979. Signature []byte `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` @@ -1421,7 +1421,7 @@ func (m *GetExtendedACLResponse_Body) Reset() { *m = GetExtendedACLRespo func (m *GetExtendedACLResponse_Body) String() string { return proto.CompactTextString(m) } func (*GetExtendedACLResponse_Body) ProtoMessage() {} func (*GetExtendedACLResponse_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_1c484d370787a129, []int{11, 0} + return fileDescriptor_6e23291a5a71033a, []int{11, 0} } func (m *GetExtendedACLResponse_Body) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1450,7 +1450,7 @@ func (m *GetExtendedACLResponse_Body) XXX_DiscardUnknown() { var xxx_messageInfo_GetExtendedACLResponse_Body proto.InternalMessageInfo -func (m *GetExtendedACLResponse_Body) GetEacl() *v22.EACLTable { +func (m *GetExtendedACLResponse_Body) GetEacl() *acl.EACLTable { if m != nil { return m.Eacl } @@ -1465,87 +1465,88 @@ func (m *GetExtendedACLResponse_Body) GetSignature() []byte { } func init() { - proto.RegisterType((*PutRequest)(nil), "container.v2.PutRequest") - proto.RegisterType((*PutRequest_Body)(nil), "container.v2.PutRequest.Body") - proto.RegisterType((*PutResponse)(nil), "container.v2.PutResponse") - proto.RegisterType((*PutResponse_Body)(nil), "container.v2.PutResponse.Body") - proto.RegisterType((*DeleteRequest)(nil), "container.v2.DeleteRequest") - proto.RegisterType((*DeleteRequest_Body)(nil), "container.v2.DeleteRequest.Body") - proto.RegisterType((*DeleteResponse)(nil), "container.v2.DeleteResponse") - proto.RegisterType((*DeleteResponse_Body)(nil), "container.v2.DeleteResponse.Body") - proto.RegisterType((*GetRequest)(nil), "container.v2.GetRequest") - proto.RegisterType((*GetRequest_Body)(nil), "container.v2.GetRequest.Body") - proto.RegisterType((*GetResponse)(nil), "container.v2.GetResponse") - proto.RegisterType((*GetResponse_Body)(nil), "container.v2.GetResponse.Body") - proto.RegisterType((*ListRequest)(nil), "container.v2.ListRequest") - proto.RegisterType((*ListRequest_Body)(nil), "container.v2.ListRequest.Body") - proto.RegisterType((*ListResponse)(nil), "container.v2.ListResponse") - proto.RegisterType((*ListResponse_Body)(nil), "container.v2.ListResponse.Body") - proto.RegisterType((*SetExtendedACLRequest)(nil), "container.v2.SetExtendedACLRequest") - proto.RegisterType((*SetExtendedACLRequest_Body)(nil), "container.v2.SetExtendedACLRequest.Body") - proto.RegisterType((*SetExtendedACLResponse)(nil), "container.v2.SetExtendedACLResponse") - proto.RegisterType((*SetExtendedACLResponse_Body)(nil), "container.v2.SetExtendedACLResponse.Body") - proto.RegisterType((*GetExtendedACLRequest)(nil), "container.v2.GetExtendedACLRequest") - proto.RegisterType((*GetExtendedACLRequest_Body)(nil), "container.v2.GetExtendedACLRequest.Body") - proto.RegisterType((*GetExtendedACLResponse)(nil), "container.v2.GetExtendedACLResponse") - proto.RegisterType((*GetExtendedACLResponse_Body)(nil), "container.v2.GetExtendedACLResponse.Body") + proto.RegisterType((*PutRequest)(nil), "neo.fs.v2.container.PutRequest") + proto.RegisterType((*PutRequest_Body)(nil), "neo.fs.v2.container.PutRequest.Body") + proto.RegisterType((*PutResponse)(nil), "neo.fs.v2.container.PutResponse") + proto.RegisterType((*PutResponse_Body)(nil), "neo.fs.v2.container.PutResponse.Body") + proto.RegisterType((*DeleteRequest)(nil), "neo.fs.v2.container.DeleteRequest") + proto.RegisterType((*DeleteRequest_Body)(nil), "neo.fs.v2.container.DeleteRequest.Body") + proto.RegisterType((*DeleteResponse)(nil), "neo.fs.v2.container.DeleteResponse") + proto.RegisterType((*DeleteResponse_Body)(nil), "neo.fs.v2.container.DeleteResponse.Body") + proto.RegisterType((*GetRequest)(nil), "neo.fs.v2.container.GetRequest") + proto.RegisterType((*GetRequest_Body)(nil), "neo.fs.v2.container.GetRequest.Body") + proto.RegisterType((*GetResponse)(nil), "neo.fs.v2.container.GetResponse") + proto.RegisterType((*GetResponse_Body)(nil), "neo.fs.v2.container.GetResponse.Body") + proto.RegisterType((*ListRequest)(nil), "neo.fs.v2.container.ListRequest") + proto.RegisterType((*ListRequest_Body)(nil), "neo.fs.v2.container.ListRequest.Body") + proto.RegisterType((*ListResponse)(nil), "neo.fs.v2.container.ListResponse") + proto.RegisterType((*ListResponse_Body)(nil), "neo.fs.v2.container.ListResponse.Body") + proto.RegisterType((*SetExtendedACLRequest)(nil), "neo.fs.v2.container.SetExtendedACLRequest") + proto.RegisterType((*SetExtendedACLRequest_Body)(nil), "neo.fs.v2.container.SetExtendedACLRequest.Body") + proto.RegisterType((*SetExtendedACLResponse)(nil), "neo.fs.v2.container.SetExtendedACLResponse") + proto.RegisterType((*SetExtendedACLResponse_Body)(nil), "neo.fs.v2.container.SetExtendedACLResponse.Body") + proto.RegisterType((*GetExtendedACLRequest)(nil), "neo.fs.v2.container.GetExtendedACLRequest") + proto.RegisterType((*GetExtendedACLRequest_Body)(nil), "neo.fs.v2.container.GetExtendedACLRequest.Body") + proto.RegisterType((*GetExtendedACLResponse)(nil), "neo.fs.v2.container.GetExtendedACLResponse") + proto.RegisterType((*GetExtendedACLResponse_Body)(nil), "neo.fs.v2.container.GetExtendedACLResponse.Body") } -func init() { proto.RegisterFile("container/v2/service.proto", fileDescriptor_1c484d370787a129) } +func init() { proto.RegisterFile("v2/container/service.proto", fileDescriptor_6e23291a5a71033a) } -var fileDescriptor_1c484d370787a129 = []byte{ - // 811 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x97, 0x41, 0x4f, 0x13, 0x41, - 0x14, 0xc7, 0xdd, 0x6d, 0x03, 0xf2, 0x5a, 0x88, 0x0e, 0x02, 0x65, 0x85, 0x8a, 0x55, 0x0c, 0xc6, - 0xb0, 0x8d, 0x45, 0x62, 0x34, 0x22, 0x29, 0x05, 0xd7, 0x0a, 0x2a, 0x59, 0x0c, 0x07, 0x8d, 0x21, - 0xdb, 0xdd, 0x07, 0x6c, 0x2c, 0xbb, 0xb5, 0xbb, 0x2d, 0xd6, 0xa3, 0x67, 0x63, 0x3c, 0x78, 0xf0, - 0xec, 0xd1, 0x83, 0x31, 0x7e, 0x01, 0x8f, 0x7a, 0xf4, 0x0b, 0x98, 0x18, 0x3c, 0xfb, 0x1d, 0xcc, - 0xee, 0x4e, 0xdb, 0x9d, 0xba, 0x2d, 0xd5, 0x7a, 0x58, 0x6e, 0xec, 0xcc, 0x7f, 0x1e, 0xef, 0xfd, - 0xfa, 0x9f, 0x99, 0x37, 0x20, 0xa8, 0xa6, 0x61, 0x2b, 0xba, 0x81, 0xe5, 0x74, 0x35, 0x93, 0xb6, - 0xb0, 0x5c, 0xd5, 0x55, 0x14, 0x4b, 0x65, 0xd3, 0x36, 0x49, 0xbc, 0x31, 0x27, 0x56, 0x33, 0x02, - 0x51, 0xd4, 0xa2, 0xa3, 0xb1, 0x6b, 0x25, 0xb4, 0x3c, 0x85, 0x90, 0x60, 0x56, 0xfb, 0x67, 0x86, - 0xcb, 0xb8, 0x6d, 0xb5, 0x0e, 0x8e, 0xd0, 0xf8, 0xce, 0xf8, 0x1e, 0xda, 0x0a, 0x1d, 0x1e, 0xf3, - 0x0d, 0x57, 0xb1, 0xac, 0x6f, 0xd7, 0xbc, 0x89, 0xd4, 0x17, 0x1e, 0x60, 0xbd, 0x62, 0xcb, 0xf8, - 0xb4, 0x82, 0x96, 0x4d, 0x2e, 0x43, 0xb4, 0x60, 0x6a, 0xb5, 0x04, 0x37, 0xc5, 0xcd, 0xc4, 0x32, - 0x93, 0xa2, 0x3f, 0x3d, 0xb1, 0xa9, 0x13, 0x97, 0x4c, 0xad, 0x26, 0xbb, 0x52, 0x72, 0x13, 0x62, - 0xce, 0x3f, 0xda, 0xda, 0x45, 0x45, 0xc3, 0x72, 0x82, 0xa7, 0x2b, 0xeb, 0x75, 0x56, 0x33, 0x22, - 0x5d, 0x74, 0x17, 0x6d, 0xe5, 0xb6, 0x2b, 0x92, 0x61, 0xaf, 0xf1, 0x37, 0xb9, 0x03, 0x83, 0x5e, - 0x46, 0xf5, 0x08, 0x11, 0x37, 0xc2, 0x74, 0x40, 0x84, 0x4d, 0x47, 0xa7, 0xab, 0x8a, 0xad, 0x9b, - 0x06, 0x8d, 0x14, 0xf7, 0xd6, 0x7a, 0x5f, 0xc2, 0x73, 0x88, 0x3a, 0x99, 0x91, 0x79, 0x18, 0x68, - 0x64, 0x4e, 0x6b, 0x19, 0x63, 0x6b, 0xc9, 0xd5, 0x3f, 0xe4, 0xa6, 0x92, 0x4c, 0x02, 0x94, 0x2a, - 0x85, 0xa2, 0xae, 0x6e, 0x3d, 0xc1, 0x9a, 0x5b, 0x49, 0x5c, 0x1e, 0xf0, 0x46, 0x56, 0xb1, 0x46, - 0x26, 0x60, 0xc0, 0xd2, 0x77, 0x0c, 0xc5, 0xae, 0x94, 0xd1, 0xcd, 0x32, 0x2e, 0x37, 0x07, 0x52, - 0xaf, 0x79, 0x88, 0xb9, 0x84, 0xac, 0x92, 0x69, 0x58, 0x48, 0x32, 0x0c, 0xca, 0x64, 0x00, 0x4a, - 0x4f, 0xe8, 0x67, 0xb9, 0x18, 0xc4, 0x32, 0xc9, 0x92, 0xf0, 0x56, 0xb5, 0x81, 0xb9, 0x1a, 0x0c, - 0xf3, 0x42, 0x50, 0x88, 0x43, 0x69, 0x2e, 0x52, 0x9a, 0x57, 0xa1, 0x69, 0xd3, 0x2d, 0x5d, 0xa3, - 0x15, 0x9d, 0x12, 0x1d, 0xff, 0x31, 0x2c, 0xf3, 0xcb, 0x72, 0xac, 0xa1, 0xcc, 0x6b, 0xa9, 0x8f, - 0x3c, 0x0c, 0x2e, 0x63, 0x11, 0x6d, 0xac, 0xfb, 0xeb, 0x0a, 0x03, 0x65, 0x8a, 0x85, 0xc2, 0x48, - 0xc3, 0x6a, 0xb1, 0xc7, 0x3d, 0x42, 0x61, 0x5d, 0xc4, 0xb7, 0xba, 0xe8, 0x3b, 0x07, 0x43, 0x75, - 0x0e, 0xd4, 0x48, 0xf3, 0x0c, 0xb3, 0xb3, 0xc1, 0xcc, 0xc2, 0xee, 0xa5, 0x3e, 0x0f, 0x5b, 0xea, - 0x25, 0x0f, 0x20, 0x61, 0x77, 0xe7, 0x4d, 0x53, 0x17, 0x56, 0x33, 0xf4, 0xbc, 0x43, 0x5e, 0xf1, - 0x10, 0x73, 0xcb, 0xec, 0xe6, 0xd0, 0xf0, 0x09, 0xc3, 0xfb, 0x43, 0x2f, 0xf4, 0x74, 0x04, 0xa7, - 0x5e, 0xf0, 0x10, 0x5b, 0xd3, 0xad, 0x86, 0x41, 0x3a, 0x02, 0xf1, 0x09, 0xc3, 0xea, 0x90, 0x39, - 0x8a, 0xe3, 0x12, 0x1c, 0x37, 0xf7, 0x19, 0x77, 0x9c, 0x68, 0xb8, 0xe3, 0xfe, 0xbe, 0xe7, 0x8c, - 0x7e, 0x57, 0x91, 0xd7, 0x52, 0x6f, 0x78, 0x88, 0x7b, 0xb5, 0x51, 0x5b, 0xcc, 0x31, 0x14, 0xce, - 0x04, 0x51, 0x08, 0xbb, 0x2f, 0xb2, 0x14, 0xc4, 0x35, 0x18, 0xf4, 0x6f, 0x15, 0x2b, 0xc1, 0x4d, - 0x45, 0xda, 0xee, 0x95, 0xb8, 0x6f, 0xaf, 0x58, 0xa9, 0x0f, 0x3c, 0x8c, 0x6c, 0xa0, 0xbd, 0xf2, - 0xcc, 0x46, 0x43, 0x43, 0x2d, 0x9b, 0x5b, 0xab, 0xbb, 0xe4, 0x06, 0xc3, 0x67, 0x86, 0xe5, 0x13, - 0xb8, 0x24, 0xac, 0x7e, 0x59, 0xa5, 0x98, 0xa6, 0x21, 0x8a, 0x8a, 0x5a, 0xa4, 0x15, 0x9d, 0x14, - 0x15, 0xb5, 0xe8, 0x84, 0x59, 0xc9, 0xe6, 0xd6, 0x1e, 0x28, 0x85, 0x22, 0xca, 0xee, 0xf4, 0x21, - 0x97, 0xc9, 0x2f, 0x0e, 0x46, 0x5b, 0xab, 0xa7, 0x8e, 0x5a, 0x60, 0x88, 0x5d, 0xec, 0x4c, 0xec, - 0xa8, 0x5c, 0x2e, 0xef, 0x78, 0x18, 0x91, 0xfe, 0xde, 0x20, 0xd2, 0x51, 0x32, 0x48, 0xcf, 0x57, - 0xce, 0x27, 0x1e, 0x46, 0xa5, 0x7f, 0x30, 0x85, 0x74, 0xc4, 0x4c, 0xf1, 0x3f, 0x77, 0x52, 0xe6, - 0x73, 0x04, 0xfa, 0x37, 0xbc, 0x24, 0xc8, 0x75, 0x88, 0xac, 0x57, 0x6c, 0x92, 0x68, 0xf7, 0x38, - 0x12, 0xc6, 0xdb, 0xf6, 0xfa, 0x24, 0x07, 0x7d, 0x5e, 0xc7, 0x46, 0x4e, 0x77, 0xe8, 0x7d, 0x85, - 0x89, 0x4e, 0x4d, 0x9e, 0x93, 0x80, 0x84, 0x7f, 0x24, 0xd0, 0xec, 0x96, 0x5a, 0x13, 0xf0, 0x37, - 0x18, 0x0b, 0x10, 0x75, 0xee, 0x0b, 0x32, 0xde, 0xf6, 0x26, 0x15, 0x84, 0xf6, 0xd7, 0x0b, 0x79, - 0x04, 0x43, 0xec, 0xe1, 0x40, 0xce, 0x75, 0x71, 0xd8, 0x0a, 0xe7, 0xbb, 0x39, 0x5f, 0x9c, 0xe0, - 0x52, 0xc7, 0xe0, 0x52, 0x37, 0xc1, 0x83, 0x7d, 0xba, 0xb4, 0xf9, 0xf5, 0x20, 0xc9, 0x7d, 0x3b, - 0x48, 0x72, 0x3f, 0x0e, 0x92, 0xdc, 0xdb, 0x9f, 0xc9, 0x63, 0x0f, 0xc5, 0x1d, 0xdd, 0xde, 0xad, - 0x14, 0x44, 0xd5, 0xdc, 0x4b, 0x1b, 0x56, 0x49, 0x55, 0x67, 0x35, 0xac, 0xa6, 0x0d, 0x34, 0xb7, - 0xad, 0x59, 0xa5, 0xa4, 0xcf, 0xee, 0x98, 0x69, 0xff, 0xdb, 0xfb, 0x3d, 0x3f, 0x7c, 0x0f, 0xcd, - 0x5b, 0x1b, 0x62, 0x76, 0x3d, 0xdf, 0xdc, 0x5d, 0x85, 0x3e, 0xf7, 0x1d, 0x3d, 0xf7, 0x3b, 0x00, - 0x00, 0xff, 0xff, 0x7e, 0x5a, 0xa3, 0x54, 0xe6, 0x0f, 0x00, 0x00, +var fileDescriptor_6e23291a5a71033a = []byte{ + // 823 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x98, 0xc1, 0x52, 0xd3, 0x5c, + 0x14, 0xc7, 0xbf, 0x84, 0x0e, 0x7c, 0x9c, 0x16, 0x16, 0x97, 0x01, 0x3a, 0x51, 0x6b, 0x8d, 0xa2, + 0x8c, 0xd2, 0xc4, 0x89, 0x1b, 0x45, 0xc6, 0x11, 0x5a, 0x08, 0x1d, 0x50, 0x21, 0x38, 0x2c, 0xdc, + 0x30, 0x69, 0x72, 0x0a, 0x19, 0x4b, 0x52, 0x9b, 0x34, 0xd8, 0xa5, 0xbe, 0x82, 0x1b, 0x57, 0xae, + 0x1d, 0xc6, 0x85, 0x4f, 0xe0, 0xda, 0x71, 0x1c, 0xc7, 0x47, 0x70, 0xd0, 0x27, 0xf0, 0x09, 0x9c, + 0x26, 0x69, 0x93, 0x60, 0x4a, 0x5a, 0xa6, 0x2e, 0xb2, 0x6b, 0x6f, 0xce, 0x39, 0xf7, 0x9c, 0xdf, + 0xfc, 0xcf, 0x3d, 0x37, 0x01, 0xc6, 0x16, 0x78, 0xc5, 0xd0, 0x2d, 0x59, 0xd3, 0xb1, 0xc1, 0x9b, + 0xd8, 0xb0, 0x35, 0x05, 0xb9, 0x7a, 0xc3, 0xb0, 0x0c, 0x32, 0xa5, 0xa3, 0xc1, 0x55, 0x4d, 0xce, + 0x16, 0xb8, 0xae, 0x09, 0x43, 0x6c, 0x81, 0x97, 0x95, 0x1a, 0x6f, 0xb5, 0xea, 0x68, 0xba, 0x86, + 0x4c, 0x36, 0x14, 0x24, 0xf8, 0x64, 0xca, 0x16, 0xf8, 0x06, 0x56, 0xcd, 0xd0, 0xe2, 0xb4, 0x2d, + 0x74, 0x76, 0xe2, 0x0f, 0xd1, 0x92, 0xbd, 0xe5, 0xd9, 0xc0, 0xb2, 0x8d, 0x0d, 0xad, 0xda, 0x72, + 0x1f, 0xb0, 0xbf, 0x68, 0x80, 0xad, 0xa6, 0x25, 0xe1, 0x8b, 0x26, 0x9a, 0x16, 0xb9, 0x0b, 0xa9, + 0x8a, 0xa1, 0xb6, 0xb2, 0x54, 0x9e, 0x9a, 0x4f, 0x0b, 0xd7, 0xb8, 0x88, 0x2c, 0x39, 0xdf, 0x9c, + 0x5b, 0x31, 0xd4, 0x96, 0xe4, 0x78, 0x90, 0x55, 0x48, 0xb7, 0xf7, 0xdb, 0x3b, 0x40, 0x59, 0xc5, + 0x46, 0x96, 0xfe, 0x2b, 0x40, 0xa7, 0x7e, 0xcf, 0xf7, 0x11, 0x5a, 0xf2, 0xba, 0x63, 0x2b, 0xc1, + 0x61, 0xf7, 0x37, 0xd9, 0x86, 0x09, 0x37, 0xbf, 0x4e, 0xa0, 0x11, 0x27, 0xd0, 0x42, 0xef, 0x40, + 0xbb, 0x6d, 0x73, 0x4d, 0x91, 0x2d, 0xcd, 0xd0, 0xbd, 0x80, 0x19, 0x37, 0x84, 0xfb, 0x8f, 0x79, + 0x45, 0x41, 0xaa, 0x9d, 0x28, 0x59, 0x82, 0xf1, 0x6e, 0x15, 0x5e, 0x85, 0xb9, 0xc8, 0x0a, 0x8b, + 0x9d, 0x5f, 0x92, 0xef, 0x40, 0x2e, 0x01, 0xd4, 0x9b, 0x95, 0x9a, 0xa6, 0xec, 0x3d, 0xc7, 0x96, + 0x53, 0x5f, 0x46, 0x1a, 0x77, 0x57, 0x36, 0xb0, 0x45, 0x2e, 0xc2, 0xb8, 0xa9, 0xed, 0xeb, 0xb2, + 0xd5, 0x6c, 0xa0, 0x93, 0x74, 0x46, 0xf2, 0x17, 0xd8, 0x0f, 0x34, 0xa4, 0x1d, 0x6e, 0x66, 0xdd, + 0xd0, 0x4d, 0x24, 0xf7, 0x42, 0x9c, 0xe7, 0x7a, 0x73, 0x76, 0xed, 0x83, 0xa0, 0xd7, 0xa2, 0x40, + 0xcf, 0x45, 0xf2, 0x71, 0x9d, 0x7b, 0x90, 0x96, 0xa2, 0x49, 0x17, 0xce, 0x88, 0x14, 0x8b, 0x7a, + 0xcd, 0x23, 0xfd, 0x00, 0x32, 0xdd, 0x3a, 0xf6, 0x34, 0xd5, 0x2b, 0xf3, 0x42, 0x20, 0x74, 0x5b, + 0xb8, 0x3e, 0xe7, 0x72, 0x49, 0x4a, 0x77, 0x1d, 0xca, 0x2a, 0xfb, 0x95, 0x86, 0x89, 0x12, 0xd6, + 0xd0, 0xc2, 0x8e, 0x30, 0xef, 0x87, 0x80, 0xdd, 0x88, 0x04, 0x16, 0xf2, 0x48, 0x86, 0x36, 0xd5, + 0xe1, 0x00, 0x0b, 0xab, 0x8f, 0x3e, 0xad, 0xbe, 0xdf, 0x14, 0x4c, 0x76, 0xe0, 0x78, 0x02, 0x5c, + 0x0a, 0xf1, 0x9c, 0x3f, 0x93, 0x67, 0xb2, 0x34, 0x38, 0xea, 0x22, 0x65, 0xdf, 0xd3, 0x00, 0x22, + 0x0e, 0x74, 0xb2, 0xf9, 0xe6, 0xc9, 0x50, 0xcf, 0xb0, 0xda, 0xed, 0x98, 0x86, 0xb4, 0x53, 0xfb, + 0x00, 0xa7, 0x53, 0xc0, 0x3e, 0x29, 0xca, 0x28, 0x0d, 0x63, 0x0e, 0xb0, 0xef, 0x68, 0x48, 0x6f, + 0x6a, 0x66, 0x57, 0x58, 0xfd, 0xc0, 0x0a, 0xd8, 0x27, 0x43, 0x59, 0x8b, 0x1e, 0x2a, 0x01, 0xfe, + 0x37, 0x8e, 0x42, 0xaa, 0x9a, 0x3d, 0xad, 0xaa, 0x27, 0x47, 0xae, 0xa2, 0xc6, 0x1c, 0xc3, 0xb2, + 0xca, 0x7e, 0xa4, 0x21, 0xe3, 0x16, 0xec, 0xc9, 0x69, 0x31, 0x44, 0xe8, 0xfa, 0x19, 0x84, 0x92, + 0xa5, 0xa7, 0x75, 0x0f, 0xd2, 0x43, 0x98, 0x08, 0xb6, 0x9f, 0x99, 0xa5, 0xf2, 0x23, 0x71, 0xfd, + 0x97, 0x09, 0xf4, 0x9f, 0xc9, 0x7e, 0xa1, 0x61, 0x7a, 0x07, 0xad, 0xd5, 0x97, 0x16, 0xea, 0x2a, + 0xaa, 0xcb, 0xc5, 0xcd, 0x8e, 0xba, 0x8a, 0x21, 0x76, 0x7c, 0x24, 0xbb, 0x48, 0xcf, 0x64, 0xe8, + 0x4c, 0xf2, 0x10, 0x2e, 0x40, 0x0a, 0x65, 0xa5, 0xe6, 0x95, 0x99, 0x0d, 0x44, 0x94, 0x95, 0x1a, + 0xb7, 0xba, 0x5c, 0xdc, 0x7c, 0x2a, 0x57, 0x6a, 0x28, 0x39, 0x56, 0x31, 0xd3, 0xee, 0x35, 0x0d, + 0x33, 0xa7, 0x91, 0x78, 0x4a, 0x2c, 0x85, 0x68, 0xde, 0xee, 0x8b, 0x66, 0x32, 0xa7, 0xdf, 0x27, + 0x1a, 0xa6, 0xc5, 0x73, 0x2b, 0x4a, 0x4c, 0xae, 0xa2, 0x86, 0x35, 0x13, 0xbf, 0xd1, 0x30, 0x23, + 0x9e, 0x5f, 0x45, 0x62, 0xa2, 0x55, 0xf4, 0x0f, 0xda, 0x52, 0x78, 0x93, 0x82, 0xb1, 0x1d, 0x37, + 0x11, 0xb2, 0x0e, 0x23, 0x5b, 0x4d, 0x8b, 0x5c, 0x8e, 0x79, 0xbf, 0x64, 0xf2, 0x71, 0x2f, 0x46, + 0x64, 0x1b, 0x46, 0xdd, 0x6b, 0x2a, 0x61, 0xe3, 0xdf, 0x09, 0x98, 0xab, 0x7d, 0xdc, 0x73, 0xdb, + 0xc9, 0x89, 0xd8, 0x2b, 0x39, 0xff, 0x8a, 0xd8, 0x23, 0xb9, 0xe0, 0x3d, 0x6a, 0x03, 0x52, 0xed, + 0xb9, 0x46, 0xf2, 0x71, 0x97, 0x02, 0xe6, 0x4a, 0xec, 0x50, 0x24, 0x1a, 0x4c, 0x86, 0x8f, 0x26, + 0x72, 0xb3, 0xff, 0x69, 0xc0, 0xdc, 0x1a, 0xe0, 0xac, 0x6b, 0x6f, 0x25, 0xf6, 0xb3, 0x95, 0x38, + 0xc0, 0x56, 0xd1, 0x0d, 0xb1, 0xb2, 0xfb, 0xf9, 0x24, 0x47, 0x7d, 0x3f, 0xc9, 0x51, 0x3f, 0x4e, + 0x72, 0xd4, 0xdb, 0x9f, 0xb9, 0xff, 0x9e, 0x71, 0xfb, 0x9a, 0x75, 0xd0, 0xac, 0x70, 0x8a, 0x71, + 0xc8, 0xeb, 0x66, 0x5d, 0x51, 0x0a, 0x2a, 0xda, 0xbc, 0x8e, 0x46, 0xd5, 0x2c, 0xc8, 0x75, 0xad, + 0xb0, 0x6f, 0xf0, 0xc1, 0x4f, 0x22, 0xc7, 0xf4, 0xd4, 0x63, 0x34, 0xd6, 0x76, 0xb8, 0xe5, 0xad, + 0xb2, 0xdf, 0xcd, 0x95, 0x51, 0xe7, 0xf3, 0xc6, 0x9d, 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xbb, + 0x23, 0x10, 0x87, 0x84, 0x11, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1594,7 +1595,7 @@ func NewServiceClient(cc *grpc.ClientConn) ServiceClient { func (c *serviceClient) Put(ctx context.Context, in *PutRequest, opts ...grpc.CallOption) (*PutResponse, error) { out := new(PutResponse) - err := c.cc.Invoke(ctx, "/container.v2.Service/Put", in, out, opts...) + err := c.cc.Invoke(ctx, "/neo.fs.v2.container.Service/Put", in, out, opts...) if err != nil { return nil, err } @@ -1603,7 +1604,7 @@ func (c *serviceClient) Put(ctx context.Context, in *PutRequest, opts ...grpc.Ca func (c *serviceClient) Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteResponse, error) { out := new(DeleteResponse) - err := c.cc.Invoke(ctx, "/container.v2.Service/Delete", in, out, opts...) + err := c.cc.Invoke(ctx, "/neo.fs.v2.container.Service/Delete", in, out, opts...) if err != nil { return nil, err } @@ -1612,7 +1613,7 @@ func (c *serviceClient) Delete(ctx context.Context, in *DeleteRequest, opts ...g func (c *serviceClient) Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*GetResponse, error) { out := new(GetResponse) - err := c.cc.Invoke(ctx, "/container.v2.Service/Get", in, out, opts...) + err := c.cc.Invoke(ctx, "/neo.fs.v2.container.Service/Get", in, out, opts...) if err != nil { return nil, err } @@ -1621,7 +1622,7 @@ func (c *serviceClient) Get(ctx context.Context, in *GetRequest, opts ...grpc.Ca func (c *serviceClient) List(ctx context.Context, in *ListRequest, opts ...grpc.CallOption) (*ListResponse, error) { out := new(ListResponse) - err := c.cc.Invoke(ctx, "/container.v2.Service/List", in, out, opts...) + err := c.cc.Invoke(ctx, "/neo.fs.v2.container.Service/List", in, out, opts...) if err != nil { return nil, err } @@ -1630,7 +1631,7 @@ func (c *serviceClient) List(ctx context.Context, in *ListRequest, opts ...grpc. func (c *serviceClient) SetExtendedACL(ctx context.Context, in *SetExtendedACLRequest, opts ...grpc.CallOption) (*SetExtendedACLResponse, error) { out := new(SetExtendedACLResponse) - err := c.cc.Invoke(ctx, "/container.v2.Service/SetExtendedACL", in, out, opts...) + err := c.cc.Invoke(ctx, "/neo.fs.v2.container.Service/SetExtendedACL", in, out, opts...) if err != nil { return nil, err } @@ -1639,7 +1640,7 @@ func (c *serviceClient) SetExtendedACL(ctx context.Context, in *SetExtendedACLRe func (c *serviceClient) GetExtendedACL(ctx context.Context, in *GetExtendedACLRequest, opts ...grpc.CallOption) (*GetExtendedACLResponse, error) { out := new(GetExtendedACLResponse) - err := c.cc.Invoke(ctx, "/container.v2.Service/GetExtendedACL", in, out, opts...) + err := c.cc.Invoke(ctx, "/neo.fs.v2.container.Service/GetExtendedACL", in, out, opts...) if err != nil { return nil, err } @@ -1709,7 +1710,7 @@ func _Service_Put_Handler(srv interface{}, ctx context.Context, dec func(interfa } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/container.v2.Service/Put", + FullMethod: "/neo.fs.v2.container.Service/Put", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ServiceServer).Put(ctx, req.(*PutRequest)) @@ -1727,7 +1728,7 @@ func _Service_Delete_Handler(srv interface{}, ctx context.Context, dec func(inte } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/container.v2.Service/Delete", + FullMethod: "/neo.fs.v2.container.Service/Delete", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ServiceServer).Delete(ctx, req.(*DeleteRequest)) @@ -1745,7 +1746,7 @@ func _Service_Get_Handler(srv interface{}, ctx context.Context, dec func(interfa } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/container.v2.Service/Get", + FullMethod: "/neo.fs.v2.container.Service/Get", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ServiceServer).Get(ctx, req.(*GetRequest)) @@ -1763,7 +1764,7 @@ func _Service_List_Handler(srv interface{}, ctx context.Context, dec func(interf } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/container.v2.Service/List", + FullMethod: "/neo.fs.v2.container.Service/List", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ServiceServer).List(ctx, req.(*ListRequest)) @@ -1781,7 +1782,7 @@ func _Service_SetExtendedACL_Handler(srv interface{}, ctx context.Context, dec f } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/container.v2.Service/SetExtendedACL", + FullMethod: "/neo.fs.v2.container.Service/SetExtendedACL", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ServiceServer).SetExtendedACL(ctx, req.(*SetExtendedACLRequest)) @@ -1799,7 +1800,7 @@ func _Service_GetExtendedACL_Handler(srv interface{}, ctx context.Context, dec f } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/container.v2.Service/GetExtendedACL", + FullMethod: "/neo.fs.v2.container.Service/GetExtendedACL", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ServiceServer).GetExtendedACL(ctx, req.(*GetExtendedACLRequest)) @@ -1808,7 +1809,7 @@ func _Service_GetExtendedACL_Handler(srv interface{}, ctx context.Context, dec f } var _Service_serviceDesc = grpc.ServiceDesc{ - ServiceName: "container.v2.Service", + ServiceName: "neo.fs.v2.container.Service", HandlerType: (*ServiceServer)(nil), Methods: []grpc.MethodDesc{ { @@ -1837,7 +1838,7 @@ var _Service_serviceDesc = grpc.ServiceDesc{ }, }, Streams: []grpc.StreamDesc{}, - Metadata: "container/v2/service.proto", + Metadata: "v2/container/service.proto", } func (m *PutRequest) Marshal() (dAtA []byte, err error) { @@ -3683,7 +3684,7 @@ func (m *PutRequest) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.MetaHeader == nil { - m.MetaHeader = &v2.RequestMetaHeader{} + m.MetaHeader = &service.RequestMetaHeader{} } if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -3719,7 +3720,7 @@ func (m *PutRequest) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.VerifyHeader == nil { - m.VerifyHeader = &v2.RequestVerificationHeader{} + m.VerifyHeader = &service.RequestVerificationHeader{} } if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -4003,7 +4004,7 @@ func (m *PutResponse) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.MetaHeader == nil { - m.MetaHeader = &v2.ResponseMetaHeader{} + m.MetaHeader = &service.ResponseMetaHeader{} } if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -4039,7 +4040,7 @@ func (m *PutResponse) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.VerifyHeader == nil { - m.VerifyHeader = &v2.ResponseVerificationHeader{} + m.VerifyHeader = &service.ResponseVerificationHeader{} } if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -4129,7 +4130,7 @@ func (m *PutResponse_Body) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.ContainerId == nil { - m.ContainerId = &v21.ContainerID{} + m.ContainerId = &refs.ContainerID{} } if err := m.ContainerId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -4255,7 +4256,7 @@ func (m *DeleteRequest) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.MetaHeader == nil { - m.MetaHeader = &v2.RequestMetaHeader{} + m.MetaHeader = &service.RequestMetaHeader{} } if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -4291,7 +4292,7 @@ func (m *DeleteRequest) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.VerifyHeader == nil { - m.VerifyHeader = &v2.RequestVerificationHeader{} + m.VerifyHeader = &service.RequestVerificationHeader{} } if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -4381,7 +4382,7 @@ func (m *DeleteRequest_Body) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.ContainerId == nil { - m.ContainerId = &v21.ContainerID{} + m.ContainerId = &refs.ContainerID{} } if err := m.ContainerId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -4541,7 +4542,7 @@ func (m *DeleteResponse) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.MetaHeader == nil { - m.MetaHeader = &v2.ResponseMetaHeader{} + m.MetaHeader = &service.ResponseMetaHeader{} } if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -4577,7 +4578,7 @@ func (m *DeleteResponse) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.VerifyHeader == nil { - m.VerifyHeader = &v2.ResponseVerificationHeader{} + m.VerifyHeader = &service.ResponseVerificationHeader{} } if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -4757,7 +4758,7 @@ func (m *GetRequest) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.MetaHeader == nil { - m.MetaHeader = &v2.RequestMetaHeader{} + m.MetaHeader = &service.RequestMetaHeader{} } if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -4793,7 +4794,7 @@ func (m *GetRequest) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.VerifyHeader == nil { - m.VerifyHeader = &v2.RequestVerificationHeader{} + m.VerifyHeader = &service.RequestVerificationHeader{} } if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -4883,7 +4884,7 @@ func (m *GetRequest_Body) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.ContainerId == nil { - m.ContainerId = &v21.ContainerID{} + m.ContainerId = &refs.ContainerID{} } if err := m.ContainerId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -5009,7 +5010,7 @@ func (m *GetResponse) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.MetaHeader == nil { - m.MetaHeader = &v2.ResponseMetaHeader{} + m.MetaHeader = &service.ResponseMetaHeader{} } if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -5045,7 +5046,7 @@ func (m *GetResponse) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.VerifyHeader == nil { - m.VerifyHeader = &v2.ResponseVerificationHeader{} + m.VerifyHeader = &service.ResponseVerificationHeader{} } if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -5261,7 +5262,7 @@ func (m *ListRequest) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.MetaHeader == nil { - m.MetaHeader = &v2.RequestMetaHeader{} + m.MetaHeader = &service.RequestMetaHeader{} } if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -5297,7 +5298,7 @@ func (m *ListRequest) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.VerifyHeader == nil { - m.VerifyHeader = &v2.RequestVerificationHeader{} + m.VerifyHeader = &service.RequestVerificationHeader{} } if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -5387,7 +5388,7 @@ func (m *ListRequest_Body) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.OwnerId == nil { - m.OwnerId = &v21.OwnerID{} + m.OwnerId = &refs.OwnerID{} } if err := m.OwnerId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -5513,7 +5514,7 @@ func (m *ListResponse) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.MetaHeader == nil { - m.MetaHeader = &v2.ResponseMetaHeader{} + m.MetaHeader = &service.ResponseMetaHeader{} } if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -5549,7 +5550,7 @@ func (m *ListResponse) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.VerifyHeader == nil { - m.VerifyHeader = &v2.ResponseVerificationHeader{} + m.VerifyHeader = &service.ResponseVerificationHeader{} } if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -5638,7 +5639,7 @@ func (m *ListResponse_Body) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ContainerIds = append(m.ContainerIds, &v21.ContainerID{}) + m.ContainerIds = append(m.ContainerIds, &refs.ContainerID{}) if err := m.ContainerIds[len(m.ContainerIds)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -5763,7 +5764,7 @@ func (m *SetExtendedACLRequest) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.MetaHeader == nil { - m.MetaHeader = &v2.RequestMetaHeader{} + m.MetaHeader = &service.RequestMetaHeader{} } if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -5799,7 +5800,7 @@ func (m *SetExtendedACLRequest) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.VerifyHeader == nil { - m.VerifyHeader = &v2.RequestVerificationHeader{} + m.VerifyHeader = &service.RequestVerificationHeader{} } if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -5889,7 +5890,7 @@ func (m *SetExtendedACLRequest_Body) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.Eacl == nil { - m.Eacl = &v22.EACLTable{} + m.Eacl = &acl.EACLTable{} } if err := m.Eacl.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -6049,7 +6050,7 @@ func (m *SetExtendedACLResponse) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.MetaHeader == nil { - m.MetaHeader = &v2.ResponseMetaHeader{} + m.MetaHeader = &service.ResponseMetaHeader{} } if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -6085,7 +6086,7 @@ func (m *SetExtendedACLResponse) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.VerifyHeader == nil { - m.VerifyHeader = &v2.ResponseVerificationHeader{} + m.VerifyHeader = &service.ResponseVerificationHeader{} } if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -6265,7 +6266,7 @@ func (m *GetExtendedACLRequest) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.MetaHeader == nil { - m.MetaHeader = &v2.RequestMetaHeader{} + m.MetaHeader = &service.RequestMetaHeader{} } if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -6301,7 +6302,7 @@ func (m *GetExtendedACLRequest) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.VerifyHeader == nil { - m.VerifyHeader = &v2.RequestVerificationHeader{} + m.VerifyHeader = &service.RequestVerificationHeader{} } if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -6391,7 +6392,7 @@ func (m *GetExtendedACLRequest_Body) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.ContainerId == nil { - m.ContainerId = &v21.ContainerID{} + m.ContainerId = &refs.ContainerID{} } if err := m.ContainerId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -6517,7 +6518,7 @@ func (m *GetExtendedACLResponse) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.MetaHeader == nil { - m.MetaHeader = &v2.ResponseMetaHeader{} + m.MetaHeader = &service.ResponseMetaHeader{} } if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -6553,7 +6554,7 @@ func (m *GetExtendedACLResponse) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.VerifyHeader == nil { - m.VerifyHeader = &v2.ResponseVerificationHeader{} + m.VerifyHeader = &service.ResponseVerificationHeader{} } if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -6643,7 +6644,7 @@ func (m *GetExtendedACLResponse_Body) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.Eacl == nil { - m.Eacl = &v22.EACLTable{} + m.Eacl = &acl.EACLTable{} } if err := m.Eacl.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err diff --git a/container/v2/service.proto b/v2/container/service.proto similarity index 77% rename from container/v2/service.proto rename to v2/container/service.proto index 720abc6..3d6c9c2 100644 --- a/container/v2/service.proto +++ b/v2/container/service.proto @@ -1,15 +1,15 @@ syntax = "proto3"; -package container.v2; +package neo.fs.v2.container; -option go_package = "github.com/nspcc-dev/neofs-api-go/container/v2"; +option go_package = "github.com/nspcc-dev/neofs-api-go/v2/container"; option csharp_namespace = "NeoFS.API.Container"; -import "acl/v2/types.proto"; -import "container/v2/types.proto"; -import "refs/v2/types.proto"; -import "service/v2/meta.proto"; -import "service/v2/verify.proto"; +import "v2/acl/types.proto"; +import "v2/container/types.proto"; +import "v2/refs/types.proto"; +import "v2/service/meta.proto"; +import "v2/service/verify.proto"; // Service provides API to access container smart-contract in morph chain // via NeoFS node. @@ -46,7 +46,7 @@ service Service { message PutRequest { message Body { // Container to create in NeoFS. - container.v2.Container container = 1; + neo.fs.v2.container.Container container = 1; // Public Key of container owner. It can be public key of the owner // or it can be public key that bound in neofs.id smart-contract. @@ -61,18 +61,18 @@ message PutRequest { // Carries request meta information. Header data is used only to regulate // message transport and does not affect request execution. - service.v2.RequestMetaHeader meta_header = 2; + neo.fs.v2.service.RequestMetaHeader meta_header = 2; // Carries request verification information. This header is used to // authenticate the nodes of the message route and check the correctness // of transmission. - service.v2.RequestVerificationHeader verify_header = 3; + neo.fs.v2.service.RequestVerificationHeader verify_header = 3; } message PutResponse { message Body { - // container_id carries identifier of the new container.v2. - refs.v2.ContainerID container_id = 1; + // container_id carries identifier of the new container. + neo.fs.v2.refs.ContainerID container_id = 1; } // Body of container put response message. @@ -80,19 +80,19 @@ message PutResponse { // Carries response meta information. Header data is used only to regulate // message transport and does not affect request execution. - service.v2.ResponseMetaHeader meta_header = 2; + neo.fs.v2.service.ResponseMetaHeader meta_header = 2; // Carries response verification information. This header is used to // authenticate the nodes of the message route and check the correctness // of transmission. - service.v2.ResponseVerificationHeader verify_header = 3; + neo.fs.v2.service.ResponseVerificationHeader verify_header = 3; } message DeleteRequest { message Body { // container_id carries identifier of the container to delete // from NeoFS. - refs.v2.ContainerID container_id = 1; + neo.fs.v2.refs.ContainerID container_id = 1; // Signature of container id according to RFC-6979. bytes signature = 2; @@ -103,12 +103,12 @@ message DeleteRequest { // Carries request meta information. Header data is used only to regulate // message transport and does not affect request execution. - service.v2.RequestMetaHeader meta_header = 2; + neo.fs.v2.service.RequestMetaHeader meta_header = 2; // Carries request verification information. This header is used to // authenticate the nodes of the message route and check the correctness // of transmission. - service.v2.RequestVerificationHeader verify_header = 3; + neo.fs.v2.service.RequestVerificationHeader verify_header = 3; } // DeleteResponse is empty because delete operation is asynchronous and done @@ -121,18 +121,18 @@ message DeleteResponse { // Carries response meta information. Header data is used only to regulate // message transport and does not affect request execution. - service.v2.ResponseMetaHeader meta_header = 2; + neo.fs.v2.service.ResponseMetaHeader meta_header = 2; // Carries response verification information. This header is used to // authenticate the nodes of the message route and check the correctness // of transmission. - service.v2.ResponseVerificationHeader verify_header = 3; + neo.fs.v2.service.ResponseVerificationHeader verify_header = 3; } message GetRequest { message Body { // container_id carries identifier of the container to get. - refs.v2.ContainerID container_id = 1; + neo.fs.v2.refs.ContainerID container_id = 1; } // Body of container get request message. @@ -140,18 +140,18 @@ message GetRequest { // Carries request meta information. Header data is used only to regulate // message transport and does not affect request execution. - service.v2.RequestMetaHeader meta_header = 2; + neo.fs.v2.service.RequestMetaHeader meta_header = 2; // Carries request verification information. This header is used to // authenticate the nodes of the message route and check the correctness // of transmission. - service.v2.RequestVerificationHeader verify_header = 3; + neo.fs.v2.service.RequestVerificationHeader verify_header = 3; } message GetResponse { message Body { // Container that has been requested. - container.v2.Container container = 1; + neo.fs.v2.container.Container container = 1; } // Body of container get response message. @@ -159,18 +159,18 @@ message GetResponse { // Carries response meta information. Header data is used only to regulate // message transport and does not affect request execution. - service.v2.ResponseMetaHeader meta_header = 2; + neo.fs.v2.service.ResponseMetaHeader meta_header = 2; // Carries response verification information. This header is used to // authenticate the nodes of the message route and check the correctness // of transmission. - service.v2.ResponseVerificationHeader verify_header = 3; + neo.fs.v2.service.ResponseVerificationHeader verify_header = 3; } message ListRequest { message Body { // owner_id carries identifier of the container owner. - refs.v2.OwnerID owner_id = 1; + neo.fs.v2.refs.OwnerID owner_id = 1; } // Body of list containers request message. @@ -178,18 +178,18 @@ message ListRequest { // Carries request meta information. Header data is used only to regulate // message transport and does not affect request execution. - service.v2.RequestMetaHeader meta_header = 2; + neo.fs.v2.service.RequestMetaHeader meta_header = 2; // Carries request verification information. This header is used to // authenticate the nodes of the message route and check the correctness // of transmission. - service.v2.RequestVerificationHeader verify_header = 3; + neo.fs.v2.service.RequestVerificationHeader verify_header = 3; } message ListResponse { message Body { // ContainerIDs carries list of identifiers of the containers that belong to the owner. - repeated refs.v2.ContainerID container_ids = 1; + repeated refs.ContainerID container_ids = 1; } // Body of list containers response message. @@ -197,18 +197,18 @@ message ListResponse { // Carries response meta information. Header data is used only to regulate // message transport and does not affect request execution. - service.v2.ResponseMetaHeader meta_header = 2; + neo.fs.v2.service.ResponseMetaHeader meta_header = 2; // Carries response verification information. This header is used to // authenticate the nodes of the message route and check the correctness // of transmission. - service.v2.ResponseVerificationHeader verify_header = 3; + neo.fs.v2.service.ResponseVerificationHeader verify_header = 3; } message SetExtendedACLRequest { message Body { - // Extended ACL to set for the container.v2. - acl.v2.EACLTable eacl = 1; + // Extended ACL to set for the container. + neo.fs.v2.acl.EACLTable eacl = 1; // Signature of stable-marshalled Extended ACL according to RFC-6979. bytes signature = 2; @@ -219,12 +219,12 @@ message SetExtendedACLRequest { // Carries request meta information. Header data is used only to regulate // message transport and does not affect request execution. - service.v2.RequestMetaHeader meta_header = 2; + neo.fs.v2.service.RequestMetaHeader meta_header = 2; // Carries request verification information. This header is used to // authenticate the nodes of the message route and check the correctness // of transmission. - service.v2.RequestVerificationHeader verify_header = 3; + neo.fs.v2.service.RequestVerificationHeader verify_header = 3; } message SetExtendedACLResponse { @@ -235,18 +235,18 @@ message SetExtendedACLResponse { // Carries response meta information. Header data is used only to regulate // message transport and does not affect request execution. - service.v2.ResponseMetaHeader meta_header = 2; + neo.fs.v2.service.ResponseMetaHeader meta_header = 2; // Carries response verification information. This header is used to // authenticate the nodes of the message route and check the correctness // of transmission. - service.v2.ResponseVerificationHeader verify_header = 3; + neo.fs.v2.service.ResponseVerificationHeader verify_header = 3; } message GetExtendedACLRequest { message Body { // container_id carries identifier of the container that has Extended ACL. - refs.v2.ContainerID container_id = 1; + neo.fs.v2.refs.ContainerID container_id = 1; } // Body of get extended acl request message. @@ -254,18 +254,18 @@ message GetExtendedACLRequest { // Carries request meta information. Header data is used only to regulate // message transport and does not affect request execution. - service.v2.RequestMetaHeader meta_header = 2; + neo.fs.v2.service.RequestMetaHeader meta_header = 2; // Carries request verification information. This header is used to // authenticate the nodes of the message route and check the correctness // of transmission. - service.v2.RequestVerificationHeader verify_header = 3; + neo.fs.v2.service.RequestVerificationHeader verify_header = 3; } message GetExtendedACLResponse { message Body { // Extended ACL that has been requested if it was set up. - acl.v2.EACLTable eacl = 1; + neo.fs.v2.acl.EACLTable eacl = 1; // Signature of stable-marshalled Extended ACL according to RFC-6979. bytes signature = 2; @@ -276,10 +276,10 @@ message GetExtendedACLResponse { // Carries response meta information. Header data is used only to regulate // message transport and does not affect request execution. - service.v2.ResponseMetaHeader meta_header = 2; + neo.fs.v2.service.ResponseMetaHeader meta_header = 2; // Carries response verification information. This header is used to // authenticate the nodes of the message route and check the correctness // of transmission. - service.v2.ResponseVerificationHeader verify_header = 3; + neo.fs.v2.service.ResponseVerificationHeader verify_header = 3; } diff --git a/container/v2/signature.go b/v2/container/signature.go similarity index 95% rename from container/v2/signature.go rename to v2/container/signature.go index ca19ee6..0bdb334 100644 --- a/container/v2/signature.go +++ b/v2/container/signature.go @@ -1,4 +1,4 @@ -package v2 +package container func (m *Container) ReadSignedData(buf []byte) ([]byte, error) { return m.StableMarshal(buf) diff --git a/container/v2/types.go b/v2/container/types.go similarity index 89% rename from container/v2/types.go rename to v2/container/types.go index 1379be9..dd64a54 100644 --- a/container/v2/types.go +++ b/v2/container/types.go @@ -1,8 +1,8 @@ -package v2 +package container import ( - netmap "github.com/nspcc-dev/neofs-api-go/netmap/v2" - refs "github.com/nspcc-dev/neofs-api-go/refs/v2" + "github.com/nspcc-dev/neofs-api-go/v2/netmap" + "github.com/nspcc-dev/neofs-api-go/v2/refs" ) // SetKey sets key to the container attribute. diff --git a/container/v2/types.pb.go b/v2/container/types.pb.go similarity index 84% rename from container/v2/types.pb.go rename to v2/container/types.pb.go index 28c03d7..50a0a36 100644 --- a/container/v2/types.pb.go +++ b/v2/container/types.pb.go @@ -1,13 +1,13 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: container/v2/types.proto +// source: v2/container/types.proto -package v2 +package container import ( fmt "fmt" proto "github.com/golang/protobuf/proto" - v21 "github.com/nspcc-dev/neofs-api-go/netmap/v2" - v2 "github.com/nspcc-dev/neofs-api-go/refs/v2" + netmap "github.com/nspcc-dev/neofs-api-go/v2/netmap" + refs "github.com/nspcc-dev/neofs-api-go/v2/refs" io "io" math "math" math_bits "math/bits" @@ -30,26 +30,26 @@ const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package // SHA256 hash of stable-marshalled container message. type Container struct { // OwnerID carries identifier of the container owner. - OwnerId *v2.OwnerID `protobuf:"bytes,1,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"` + OwnerId *refs.OwnerID `protobuf:"bytes,1,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"` // Nonce is a 16 byte UUID, used to avoid collisions of container id. Nonce []byte `protobuf:"bytes,2,opt,name=nonce,proto3" json:"nonce,omitempty"` // BasicACL contains access control rules for owner, system, others groups and // permission bits for bearer token and Extended ACL. BasicAcl uint32 `protobuf:"varint,3,opt,name=basic_acl,json=basicAcl,proto3" json:"basic_acl,omitempty"` - // Attributes define any immutable characteristics of container.v2. + // Attributes define any immutable characteristics of container. Attributes []*Container_Attribute `protobuf:"bytes,4,rep,name=attributes,proto3" json:"attributes,omitempty"` - // Rules define storage policy for the object inside the container.v2. - Rules *v21.PlacementRule `protobuf:"bytes,5,opt,name=rules,proto3" json:"rules,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + // Rules define storage policy for the object inside the container. + Rules *netmap.PlacementRule `protobuf:"bytes,5,opt,name=rules,proto3" json:"rules,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *Container) Reset() { *m = Container{} } func (m *Container) String() string { return proto.CompactTextString(m) } func (*Container) ProtoMessage() {} func (*Container) Descriptor() ([]byte, []int) { - return fileDescriptor_4fee8fa43abbe82f, []int{0} + return fileDescriptor_ece71f25e6ae314e, []int{0} } func (m *Container) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -78,7 +78,7 @@ func (m *Container) XXX_DiscardUnknown() { var xxx_messageInfo_Container proto.InternalMessageInfo -func (m *Container) GetOwnerId() *v2.OwnerID { +func (m *Container) GetOwnerId() *refs.OwnerID { if m != nil { return m.OwnerId } @@ -106,7 +106,7 @@ func (m *Container) GetAttributes() []*Container_Attribute { return nil } -func (m *Container) GetRules() *v21.PlacementRule { +func (m *Container) GetRules() *netmap.PlacementRule { if m != nil { return m.Rules } @@ -128,7 +128,7 @@ func (m *Container_Attribute) Reset() { *m = Container_Attribute{} } func (m *Container_Attribute) String() string { return proto.CompactTextString(m) } func (*Container_Attribute) ProtoMessage() {} func (*Container_Attribute) Descriptor() ([]byte, []int) { - return fileDescriptor_4fee8fa43abbe82f, []int{0, 0} + return fileDescriptor_ece71f25e6ae314e, []int{0, 0} } func (m *Container_Attribute) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -172,35 +172,36 @@ func (m *Container_Attribute) GetValue() string { } func init() { - proto.RegisterType((*Container)(nil), "container.v2.Container") - proto.RegisterType((*Container_Attribute)(nil), "container.v2.Container.Attribute") + proto.RegisterType((*Container)(nil), "neo.fs.v2.container.Container") + proto.RegisterType((*Container_Attribute)(nil), "neo.fs.v2.container.Container.Attribute") } -func init() { proto.RegisterFile("container/v2/types.proto", fileDescriptor_4fee8fa43abbe82f) } +func init() { proto.RegisterFile("v2/container/types.proto", fileDescriptor_ece71f25e6ae314e) } -var fileDescriptor_4fee8fa43abbe82f = []byte{ - // 334 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x5c, 0x91, 0xd1, 0x4a, 0xc3, 0x30, - 0x18, 0x85, 0xed, 0xe6, 0x74, 0xcd, 0x26, 0x8c, 0x4c, 0x21, 0x4c, 0x28, 0xd5, 0xab, 0x82, 0x2c, - 0x85, 0xee, 0x09, 0xaa, 0x22, 0xec, 0x46, 0x47, 0x04, 0x2f, 0xbc, 0x19, 0x69, 0xf6, 0x6f, 0x16, - 0xbb, 0xa4, 0x34, 0x69, 0x65, 0xcf, 0xe1, 0x8d, 0xcf, 0xe0, 0x93, 0x78, 0xe9, 0x23, 0xc8, 0x7c, - 0x11, 0x69, 0xcb, 0xe6, 0xd8, 0x5d, 0xfe, 0xff, 0x9c, 0x13, 0xce, 0x97, 0x20, 0x22, 0x94, 0x34, - 0x3c, 0x96, 0x90, 0xf9, 0x45, 0xe0, 0x9b, 0x55, 0x0a, 0x9a, 0xa6, 0x99, 0x32, 0x0a, 0x77, 0xb7, - 0x0a, 0x2d, 0x82, 0xc1, 0x99, 0x04, 0xb3, 0xe4, 0xe9, 0x9e, 0x69, 0xd0, 0xcf, 0x60, 0xae, 0xf7, - 0x96, 0x97, 0xef, 0x0d, 0x64, 0xdf, 0x6c, 0xc2, 0xf8, 0x0a, 0xb5, 0xd5, 0x9b, 0x84, 0x6c, 0x1a, - 0xcf, 0x88, 0xe5, 0x5a, 0x5e, 0x27, 0xe8, 0xd1, 0x32, 0x45, 0x8b, 0x80, 0x3e, 0x94, 0xc2, 0xf8, - 0x96, 0x1d, 0x57, 0x8e, 0xf1, 0x0c, 0x9f, 0xa2, 0x96, 0x54, 0x52, 0x00, 0x69, 0xb8, 0x96, 0xd7, - 0x65, 0xf5, 0x80, 0xcf, 0x91, 0x1d, 0x71, 0x1d, 0x8b, 0x29, 0x17, 0x09, 0x69, 0xba, 0x96, 0x77, - 0xc2, 0xda, 0xd5, 0x22, 0x14, 0x09, 0x0e, 0x11, 0xe2, 0xc6, 0x64, 0x71, 0x94, 0x1b, 0xd0, 0xe4, - 0xd0, 0x6d, 0x7a, 0x9d, 0xe0, 0x82, 0xee, 0x96, 0xa7, 0xdb, 0x32, 0x34, 0xdc, 0x38, 0xd9, 0x4e, - 0x08, 0x53, 0xd4, 0xca, 0xf2, 0x04, 0x34, 0x69, 0x55, 0xfd, 0x08, 0xad, 0x61, 0xcb, 0xe8, 0x24, - 0xe1, 0x02, 0x96, 0x20, 0x0d, 0xcb, 0x13, 0x60, 0xb5, 0x6d, 0x30, 0x42, 0xf6, 0xf6, 0x22, 0xdc, - 0x43, 0xcd, 0x57, 0x58, 0x55, 0x68, 0x36, 0x2b, 0x8f, 0x25, 0x44, 0xc1, 0x93, 0xbc, 0x86, 0xb0, - 0x59, 0x3d, 0x5c, 0x3f, 0x7d, 0xad, 0x1d, 0xeb, 0x7b, 0xed, 0x58, 0x3f, 0x6b, 0xc7, 0xfa, 0xf8, - 0x75, 0x0e, 0x9e, 0xe9, 0x22, 0x36, 0x2f, 0x79, 0x44, 0x85, 0x5a, 0xfa, 0x52, 0xa7, 0x42, 0x0c, - 0x67, 0x50, 0xf8, 0x12, 0xd4, 0x5c, 0x0f, 0x79, 0x1a, 0x0f, 0x17, 0xca, 0xdf, 0xfd, 0x9d, 0xcf, - 0x46, 0xff, 0x1e, 0xd4, 0xdd, 0x23, 0x0d, 0x27, 0xe3, 0x7f, 0xa4, 0xe8, 0xa8, 0x7a, 0xf4, 0xd1, - 0x5f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x16, 0x73, 0x26, 0x7e, 0xca, 0x01, 0x00, 0x00, +var fileDescriptor_ece71f25e6ae314e = []byte{ + // 345 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x91, 0xd1, 0x4a, 0xc3, 0x30, + 0x14, 0x86, 0xed, 0xe6, 0x74, 0xcd, 0x14, 0xa4, 0x53, 0x2c, 0x13, 0x6a, 0xf1, 0xaa, 0x37, 0x4b, + 0x20, 0xc3, 0x07, 0x98, 0x8a, 0xb8, 0x1b, 0x1d, 0x11, 0xbc, 0xf0, 0x66, 0xa4, 0xd9, 0xd9, 0x2c, + 0x76, 0x49, 0x69, 0xd2, 0xca, 0xde, 0xc4, 0x47, 0x10, 0x9f, 0xc4, 0x4b, 0x1f, 0x41, 0xe6, 0x8b, + 0x48, 0x5b, 0xb6, 0xf5, 0xc2, 0xbb, 0x9c, 0x93, 0xff, 0x3f, 0x39, 0x5f, 0x7e, 0xe4, 0xe6, 0x94, + 0x08, 0x25, 0x0d, 0x8f, 0x24, 0xa4, 0xc4, 0x2c, 0x13, 0xd0, 0x38, 0x49, 0x95, 0x51, 0x4e, 0x57, + 0x82, 0xc2, 0x33, 0x8d, 0x73, 0x8a, 0x37, 0x82, 0xde, 0x49, 0x4e, 0x89, 0x04, 0xb3, 0xe0, 0x49, + 0x5d, 0xdb, 0xeb, 0xe6, 0x94, 0xa4, 0x30, 0xd3, 0xf5, 0xe6, 0xc5, 0x47, 0x03, 0xd9, 0xd7, 0x6b, + 0xa7, 0x43, 0x51, 0x5b, 0xbd, 0x49, 0x48, 0x27, 0xd1, 0xd4, 0xb5, 0x7c, 0x2b, 0xe8, 0xd0, 0x53, + 0xbc, 0x7d, 0xa1, 0x30, 0xe3, 0x87, 0xe2, 0x7e, 0x74, 0xc3, 0xf6, 0x4b, 0xe1, 0x68, 0xea, 0x1c, + 0xa3, 0x96, 0x54, 0x52, 0x80, 0xdb, 0xf0, 0xad, 0xe0, 0x80, 0x55, 0x85, 0x73, 0x86, 0xec, 0x90, + 0xeb, 0x48, 0x4c, 0xb8, 0x88, 0xdd, 0xa6, 0x6f, 0x05, 0x87, 0xac, 0x5d, 0x36, 0x86, 0x22, 0x76, + 0xee, 0x10, 0xe2, 0xc6, 0xa4, 0x51, 0x98, 0x19, 0xd0, 0xee, 0xae, 0xdf, 0x0c, 0x3a, 0x34, 0xc0, + 0xff, 0xa0, 0xe0, 0xcd, 0x6a, 0x78, 0xb8, 0x36, 0xb0, 0x9a, 0xd7, 0xb9, 0x44, 0xad, 0x34, 0x8b, + 0x41, 0xbb, 0xad, 0x72, 0xdb, 0xf3, 0xda, 0x90, 0xea, 0x07, 0xf0, 0x38, 0xe6, 0x02, 0x16, 0x20, + 0x0d, 0xcb, 0x62, 0x60, 0x95, 0xba, 0x37, 0x40, 0xf6, 0x66, 0x9e, 0x73, 0x84, 0x9a, 0xaf, 0xb0, + 0x2c, 0x79, 0x6d, 0x56, 0x1c, 0x0b, 0xa4, 0x9c, 0xc7, 0x59, 0x85, 0x64, 0xb3, 0xaa, 0xb8, 0x7a, + 0xfa, 0x5a, 0x79, 0xd6, 0xf7, 0xca, 0xb3, 0x7e, 0x56, 0x9e, 0xf5, 0xfe, 0xeb, 0xed, 0x3c, 0xe3, + 0x79, 0x64, 0x5e, 0xb2, 0x10, 0x0b, 0xb5, 0x20, 0x52, 0x27, 0x42, 0xf4, 0xa7, 0x90, 0x13, 0x09, + 0x6a, 0xa6, 0xfb, 0x3c, 0x89, 0xfa, 0x73, 0x45, 0xea, 0xc9, 0x7d, 0x36, 0xba, 0xf7, 0xa0, 0x6e, + 0x1f, 0xf1, 0x70, 0x3c, 0xda, 0x92, 0x85, 0x7b, 0x65, 0x12, 0x83, 0xbf, 0x00, 0x00, 0x00, 0xff, + 0xff, 0xde, 0x82, 0x60, 0x33, 0xe6, 0x01, 0x00, 0x00, } func (m *Container) Marshal() (dAtA []byte, err error) { @@ -450,7 +451,7 @@ func (m *Container) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.OwnerId == nil { - m.OwnerId = &v2.OwnerID{} + m.OwnerId = &refs.OwnerID{} } if err := m.OwnerId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -573,7 +574,7 @@ func (m *Container) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.Rules == nil { - m.Rules = &v21.PlacementRule{} + m.Rules = &netmap.PlacementRule{} } if err := m.Rules.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err diff --git a/container/v2/types.proto b/v2/container/types.proto similarity index 80% rename from container/v2/types.proto rename to v2/container/types.proto index 5897b8c..aa9fb2c 100644 --- a/container/v2/types.proto +++ b/v2/container/types.proto @@ -1,12 +1,12 @@ syntax = "proto3"; -package container.v2; +package neo.fs.v2.container; -option go_package = "github.com/nspcc-dev/neofs-api-go/container/v2"; +option go_package = "github.com/nspcc-dev/neofs-api-go/v2/container"; option csharp_namespace = "NeoFS.API.Container"; -import "netmap/v2/types.proto"; -import "refs/v2/types.proto"; +import "v2/netmap/types.proto"; +import "v2/refs/types.proto"; // Container is a structure that defines object placement behaviour. Objects // can be stored only within containers. They define placement rule, attributes @@ -14,7 +14,7 @@ import "refs/v2/types.proto"; // SHA256 hash of stable-marshalled container message. message Container { // OwnerID carries identifier of the container owner. - refs.v2.OwnerID owner_id = 1; + neo.fs.v2.refs.OwnerID owner_id = 1; // Nonce is a 16 byte UUID, used to avoid collisions of container id. bytes nonce = 2; @@ -32,9 +32,9 @@ message Container { string value = 2; } - // Attributes define any immutable characteristics of container.v2. + // Attributes define any immutable characteristics of container. repeated Attribute attributes = 4; - // Rules define storage policy for the object inside the container.v2. - netmap.v2.PlacementRule rules = 5; + // Rules define storage policy for the object inside the container. + neo.fs.v2.netmap.PlacementRule rules = 5; } diff --git a/netmap/v2/marshal.go b/v2/netmap/marshal.go similarity index 99% rename from netmap/v2/marshal.go rename to v2/netmap/marshal.go index 11c6e50..f0938c4 100644 --- a/netmap/v2/marshal.go +++ b/v2/netmap/marshal.go @@ -1,4 +1,4 @@ -package v2 +package netmap import ( "encoding/binary" diff --git a/netmap/v2/types.go b/v2/netmap/types.go similarity index 99% rename from netmap/v2/types.go rename to v2/netmap/types.go index 81e63f8..552314d 100644 --- a/netmap/v2/types.go +++ b/v2/netmap/types.go @@ -1,4 +1,4 @@ -package v2 +package netmap // SetOp sets operation of the simple filter. func (m *PlacementRule_SFGroup_Filter_SimpleFilter) SetOp(v PlacementRule_SFGroup_Filter_SimpleFilter_Operation) { diff --git a/netmap/v2/types.pb.go b/v2/netmap/types.pb.go similarity index 90% rename from netmap/v2/types.pb.go rename to v2/netmap/types.pb.go index a83e195..84e68fc 100644 --- a/netmap/v2/types.pb.go +++ b/v2/netmap/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: netmap/v2/types.proto +// source: v2/netmap/types.proto -package v2 +package netmap import ( fmt "fmt" @@ -65,7 +65,7 @@ func (x PlacementRule_SFGroup_Filter_SimpleFilter_Operation) String() string { } func (PlacementRule_SFGroup_Filter_SimpleFilter_Operation) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_059adda2b6daaf64, []int{0, 0, 0, 1, 0} + return fileDescriptor_1207dc80bd67ddec, []int{0, 0, 0, 1, 0} } // Represents the enumeration of various states of the NeoFS node. @@ -97,7 +97,7 @@ func (x NodeInfo_State) String() string { } func (NodeInfo_State) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_059adda2b6daaf64, []int{1, 0} + return fileDescriptor_1207dc80bd67ddec, []int{1, 0} } type PlacementRule struct { @@ -112,7 +112,7 @@ func (m *PlacementRule) Reset() { *m = PlacementRule{} } func (m *PlacementRule) String() string { return proto.CompactTextString(m) } func (*PlacementRule) ProtoMessage() {} func (*PlacementRule) Descriptor() ([]byte, []int) { - return fileDescriptor_059adda2b6daaf64, []int{0} + return fileDescriptor_1207dc80bd67ddec, []int{0} } func (m *PlacementRule) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -168,7 +168,7 @@ func (m *PlacementRule_SFGroup) Reset() { *m = PlacementRule_SFGroup{} } func (m *PlacementRule_SFGroup) String() string { return proto.CompactTextString(m) } func (*PlacementRule_SFGroup) ProtoMessage() {} func (*PlacementRule_SFGroup) Descriptor() ([]byte, []int) { - return fileDescriptor_059adda2b6daaf64, []int{0, 0} + return fileDescriptor_1207dc80bd67ddec, []int{0, 0} } func (m *PlacementRule_SFGroup) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -230,7 +230,7 @@ func (m *PlacementRule_SFGroup_Filter) Reset() { *m = PlacementRule_SFGr func (m *PlacementRule_SFGroup_Filter) String() string { return proto.CompactTextString(m) } func (*PlacementRule_SFGroup_Filter) ProtoMessage() {} func (*PlacementRule_SFGroup_Filter) Descriptor() ([]byte, []int) { - return fileDescriptor_059adda2b6daaf64, []int{0, 0, 0} + return fileDescriptor_1207dc80bd67ddec, []int{0, 0, 0} } func (m *PlacementRule_SFGroup_Filter) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -288,7 +288,7 @@ func (m *PlacementRule_SFGroup_Filter_SimpleFilters) String() string { } func (*PlacementRule_SFGroup_Filter_SimpleFilters) ProtoMessage() {} func (*PlacementRule_SFGroup_Filter_SimpleFilters) Descriptor() ([]byte, []int) { - return fileDescriptor_059adda2b6daaf64, []int{0, 0, 0, 0} + return fileDescriptor_1207dc80bd67ddec, []int{0, 0, 0, 0} } func (m *PlacementRule_SFGroup_Filter_SimpleFilters) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -325,7 +325,7 @@ func (m *PlacementRule_SFGroup_Filter_SimpleFilters) GetFilters() []*PlacementRu } type PlacementRule_SFGroup_Filter_SimpleFilter struct { - Op PlacementRule_SFGroup_Filter_SimpleFilter_Operation `protobuf:"varint,1,opt,name=op,proto3,enum=netmap.v2.PlacementRule_SFGroup_Filter_SimpleFilter_Operation" json:"op,omitempty"` + Op PlacementRule_SFGroup_Filter_SimpleFilter_Operation `protobuf:"varint,1,opt,name=op,proto3,enum=neo.fs.v2.netmap.PlacementRule_SFGroup_Filter_SimpleFilter_Operation" json:"op,omitempty"` // Types that are valid to be assigned to Args: // *PlacementRule_SFGroup_Filter_SimpleFilter_Value // *PlacementRule_SFGroup_Filter_SimpleFilter_FArgs @@ -343,7 +343,7 @@ func (m *PlacementRule_SFGroup_Filter_SimpleFilter) String() string { } func (*PlacementRule_SFGroup_Filter_SimpleFilter) ProtoMessage() {} func (*PlacementRule_SFGroup_Filter_SimpleFilter) Descriptor() ([]byte, []int) { - return fileDescriptor_059adda2b6daaf64, []int{0, 0, 0, 1} + return fileDescriptor_1207dc80bd67ddec, []int{0, 0, 0, 1} } func (m *PlacementRule_SFGroup_Filter_SimpleFilter) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -438,7 +438,7 @@ func (m *PlacementRule_SFGroup_Selector) Reset() { *m = PlacementRule_SF func (m *PlacementRule_SFGroup_Selector) String() string { return proto.CompactTextString(m) } func (*PlacementRule_SFGroup_Selector) ProtoMessage() {} func (*PlacementRule_SFGroup_Selector) Descriptor() ([]byte, []int) { - return fileDescriptor_059adda2b6daaf64, []int{0, 0, 1} + return fileDescriptor_1207dc80bd67ddec, []int{0, 0, 1} } func (m *PlacementRule_SFGroup_Selector) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -490,7 +490,7 @@ type NodeInfo struct { // Carries list of the NeoFS node attributes in a string key-value format. Attributes []*NodeInfo_Attribute `protobuf:"bytes,3,rep,name=attributes,proto3" json:"attributes,omitempty"` // Carries state of the NeoFS node. - State NodeInfo_State `protobuf:"varint,4,opt,name=state,proto3,enum=netmap.v2.NodeInfo_State" json:"state,omitempty"` + State NodeInfo_State `protobuf:"varint,4,opt,name=state,proto3,enum=neo.fs.v2.netmap.NodeInfo_State" json:"state,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -500,7 +500,7 @@ func (m *NodeInfo) Reset() { *m = NodeInfo{} } func (m *NodeInfo) String() string { return proto.CompactTextString(m) } func (*NodeInfo) ProtoMessage() {} func (*NodeInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_059adda2b6daaf64, []int{1} + return fileDescriptor_1207dc80bd67ddec, []int{1} } func (m *NodeInfo) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -572,7 +572,7 @@ func (m *NodeInfo_Attribute) Reset() { *m = NodeInfo_Attribute{} } func (m *NodeInfo_Attribute) String() string { return proto.CompactTextString(m) } func (*NodeInfo_Attribute) ProtoMessage() {} func (*NodeInfo_Attribute) Descriptor() ([]byte, []int) { - return fileDescriptor_059adda2b6daaf64, []int{1, 0} + return fileDescriptor_1207dc80bd67ddec, []int{1, 0} } func (m *NodeInfo_Attribute) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -616,62 +616,63 @@ func (m *NodeInfo_Attribute) GetValue() string { } func init() { - proto.RegisterEnum("netmap.v2.PlacementRule_SFGroup_Filter_SimpleFilter_Operation", PlacementRule_SFGroup_Filter_SimpleFilter_Operation_name, PlacementRule_SFGroup_Filter_SimpleFilter_Operation_value) - proto.RegisterEnum("netmap.v2.NodeInfo_State", NodeInfo_State_name, NodeInfo_State_value) - proto.RegisterType((*PlacementRule)(nil), "netmap.v2.PlacementRule") - proto.RegisterType((*PlacementRule_SFGroup)(nil), "netmap.v2.PlacementRule.SFGroup") - proto.RegisterType((*PlacementRule_SFGroup_Filter)(nil), "netmap.v2.PlacementRule.SFGroup.Filter") - proto.RegisterType((*PlacementRule_SFGroup_Filter_SimpleFilters)(nil), "netmap.v2.PlacementRule.SFGroup.Filter.SimpleFilters") - proto.RegisterType((*PlacementRule_SFGroup_Filter_SimpleFilter)(nil), "netmap.v2.PlacementRule.SFGroup.Filter.SimpleFilter") - proto.RegisterType((*PlacementRule_SFGroup_Selector)(nil), "netmap.v2.PlacementRule.SFGroup.Selector") - proto.RegisterType((*NodeInfo)(nil), "netmap.v2.NodeInfo") - proto.RegisterType((*NodeInfo_Attribute)(nil), "netmap.v2.NodeInfo.Attribute") + proto.RegisterEnum("neo.fs.v2.netmap.PlacementRule_SFGroup_Filter_SimpleFilter_Operation", PlacementRule_SFGroup_Filter_SimpleFilter_Operation_name, PlacementRule_SFGroup_Filter_SimpleFilter_Operation_value) + proto.RegisterEnum("neo.fs.v2.netmap.NodeInfo_State", NodeInfo_State_name, NodeInfo_State_value) + proto.RegisterType((*PlacementRule)(nil), "neo.fs.v2.netmap.PlacementRule") + proto.RegisterType((*PlacementRule_SFGroup)(nil), "neo.fs.v2.netmap.PlacementRule.SFGroup") + proto.RegisterType((*PlacementRule_SFGroup_Filter)(nil), "neo.fs.v2.netmap.PlacementRule.SFGroup.Filter") + proto.RegisterType((*PlacementRule_SFGroup_Filter_SimpleFilters)(nil), "neo.fs.v2.netmap.PlacementRule.SFGroup.Filter.SimpleFilters") + proto.RegisterType((*PlacementRule_SFGroup_Filter_SimpleFilter)(nil), "neo.fs.v2.netmap.PlacementRule.SFGroup.Filter.SimpleFilter") + proto.RegisterType((*PlacementRule_SFGroup_Selector)(nil), "neo.fs.v2.netmap.PlacementRule.SFGroup.Selector") + proto.RegisterType((*NodeInfo)(nil), "neo.fs.v2.netmap.NodeInfo") + proto.RegisterType((*NodeInfo_Attribute)(nil), "neo.fs.v2.netmap.NodeInfo.Attribute") } -func init() { proto.RegisterFile("netmap/v2/types.proto", fileDescriptor_059adda2b6daaf64) } +func init() { proto.RegisterFile("v2/netmap/types.proto", fileDescriptor_1207dc80bd67ddec) } -var fileDescriptor_059adda2b6daaf64 = []byte{ - // 633 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x54, 0x41, 0x6b, 0xdb, 0x4a, - 0x10, 0xb6, 0xa4, 0x58, 0xb6, 0xc6, 0xf1, 0x43, 0x2c, 0x79, 0x0f, 0x3d, 0x43, 0xfc, 0x8c, 0x2f, - 0xcf, 0xa5, 0x58, 0x06, 0xa5, 0x3d, 0xa6, 0xe0, 0x50, 0x3b, 0x0d, 0x09, 0x6b, 0x77, 0x9d, 0x52, - 0xe8, 0xc5, 0xc8, 0xf2, 0xca, 0x15, 0x95, 0xb5, 0x42, 0xbb, 0x32, 0xcd, 0x2f, 0x69, 0x7f, 0x40, - 0x4f, 0xfd, 0x11, 0x3d, 0xf7, 0xd0, 0x43, 0x7f, 0x42, 0x49, 0xa1, 0xbf, 0xa3, 0xec, 0xda, 0x72, - 0x9d, 0x12, 0x48, 0xc9, 0x69, 0x34, 0xdf, 0xce, 0xf7, 0xcd, 0xec, 0xcc, 0x68, 0xe1, 0xef, 0x84, - 0x8a, 0xa5, 0x9f, 0xf6, 0x56, 0x5e, 0x4f, 0x5c, 0xa5, 0x94, 0xbb, 0x69, 0xc6, 0x04, 0x43, 0xd6, - 0x1a, 0x76, 0x57, 0x5e, 0xfb, 0x93, 0x09, 0xf5, 0x71, 0xec, 0x07, 0x74, 0x49, 0x13, 0x41, 0xf2, - 0x98, 0xa2, 0xff, 0xa0, 0x96, 0xd1, 0x34, 0x9e, 0x86, 0x7e, 0x20, 0x58, 0xe6, 0x68, 0x2d, 0xad, - 0x53, 0x27, 0x20, 0xa1, 0xa1, 0x42, 0xd0, 0x31, 0x58, 0x3c, 0x9c, 0x2e, 0x32, 0x96, 0xa7, 0xdc, - 0xd1, 0x5b, 0x46, 0xa7, 0xe6, 0xb5, 0xdc, 0xad, 0xa2, 0x7b, 0x43, 0xcd, 0x9d, 0x0c, 0x4f, 0x65, - 0x20, 0xa9, 0xf2, 0x50, 0x7d, 0xf0, 0xc6, 0x97, 0x32, 0x54, 0x36, 0x28, 0xea, 0x43, 0x25, 0x8c, - 0x62, 0x41, 0x33, 0xee, 0x68, 0x4a, 0xe8, 0xff, 0xbb, 0x84, 0xdc, 0xa1, 0x8a, 0x27, 0x05, 0x0f, - 0x9d, 0x82, 0xc5, 0x69, 0x4c, 0x65, 0x65, 0x45, 0x35, 0x0f, 0xee, 0x14, 0x99, 0x6c, 0x18, 0xe4, - 0x17, 0x17, 0x39, 0x50, 0xa1, 0x6f, 0x83, 0x38, 0x9f, 0x53, 0xc7, 0x68, 0x19, 0x9d, 0x3a, 0x29, - 0xdc, 0xc6, 0x0f, 0x03, 0xcc, 0x75, 0x5a, 0x64, 0x83, 0xf1, 0x86, 0x5e, 0xa9, 0xa6, 0x58, 0x44, - 0x7e, 0xa2, 0x13, 0xd0, 0x42, 0x47, 0x6f, 0x69, 0x9d, 0x9a, 0xf7, 0xe8, 0x0f, 0x8b, 0x77, 0x27, - 0xd1, 0x32, 0x8d, 0xe9, 0xe6, 0x26, 0x5a, 0xd8, 0x98, 0x42, 0x7d, 0x17, 0xe2, 0x08, 0xff, 0xde, - 0x97, 0xfb, 0x49, 0x17, 0x22, 0x8d, 0x0f, 0x3a, 0xec, 0xef, 0x9e, 0x20, 0x0c, 0x3a, 0x4b, 0xd5, - 0x35, 0xfe, 0xf2, 0x9e, 0xdc, 0x47, 0xdb, 0x1d, 0xa5, 0x34, 0xf3, 0x45, 0xc4, 0x12, 0xa2, 0xb3, - 0x14, 0xfd, 0x03, 0xe5, 0x95, 0x1f, 0xe7, 0x54, 0x75, 0xc2, 0x7a, 0x56, 0x22, 0x6b, 0x17, 0x61, - 0x30, 0xc3, 0xa9, 0x9f, 0x2d, 0xb8, 0x63, 0xa8, 0x16, 0x3d, 0xbe, 0x4f, 0x2e, 0x2e, 0xf5, 0xc2, - 0x7e, 0xb6, 0xe0, 0xed, 0x4b, 0xb0, 0xb6, 0x89, 0x91, 0x09, 0x3a, 0x1e, 0xdb, 0x25, 0x69, 0x07, - 0xcf, 0x6d, 0x4d, 0xf9, 0x03, 0x5b, 0x97, 0xf6, 0xf4, 0xd2, 0x36, 0x94, 0x1d, 0xd8, 0x7b, 0xd2, - 0x5e, 0x5c, 0xda, 0x65, 0x65, 0x07, 0xb6, 0x29, 0xed, 0x88, 0xd8, 0x15, 0x54, 0x01, 0xa3, 0x8f, - 0x9f, 0xda, 0xd5, 0x13, 0x13, 0xf6, 0x64, 0x8d, 0x0d, 0x0f, 0xaa, 0xc5, 0x66, 0xa0, 0x03, 0x28, - 0x07, 0x2c, 0x4f, 0xc4, 0xe6, 0x07, 0x58, 0x3b, 0xc5, 0xfc, 0xf5, 0xed, 0xfc, 0xdb, 0xef, 0x74, - 0xa8, 0x62, 0x36, 0xa7, 0x67, 0x49, 0xc8, 0xe4, 0x0e, 0xf9, 0xf3, 0x79, 0x46, 0x39, 0xdf, 0xac, - 0x48, 0xe1, 0xa2, 0x43, 0x80, 0x34, 0x9f, 0xc5, 0x51, 0x30, 0x2d, 0xf8, 0xfb, 0xc4, 0x5a, 0x23, - 0xe7, 0xf4, 0x0a, 0x1d, 0x03, 0xf8, 0x42, 0x64, 0xd1, 0x2c, 0x17, 0x94, 0xab, 0xfd, 0xab, 0x79, - 0x87, 0x3b, 0xbd, 0x2a, 0x32, 0xb8, 0xfd, 0x22, 0x8a, 0xec, 0x10, 0x50, 0x0f, 0xca, 0x5c, 0xf8, - 0x82, 0x3a, 0x7b, 0x6a, 0xa2, 0xff, 0xde, 0xc6, 0x9c, 0xc8, 0x00, 0xb2, 0x8e, 0x6b, 0x1c, 0x81, - 0xb5, 0x55, 0xba, 0x65, 0xa9, 0x0f, 0x6e, 0x8c, 0x73, 0x33, 0xcc, 0x76, 0x17, 0xca, 0x4a, 0x04, - 0xd5, 0xa0, 0xf2, 0x02, 0x9f, 0xe3, 0xd1, 0x4b, 0x6c, 0x97, 0x10, 0x80, 0x39, 0xc2, 0x17, 0x67, - 0x78, 0x60, 0x6b, 0xf2, 0x60, 0x34, 0x1c, 0x2a, 0x47, 0x3f, 0x19, 0x7f, 0xbe, 0x6e, 0x6a, 0x5f, - 0xaf, 0x9b, 0xda, 0xb7, 0xeb, 0xa6, 0xf6, 0xfe, 0x7b, 0xb3, 0xf4, 0xea, 0xe1, 0x22, 0x12, 0xaf, - 0xf3, 0x99, 0x1b, 0xb0, 0x65, 0x2f, 0xe1, 0x69, 0x10, 0x74, 0xe7, 0x74, 0xd5, 0x4b, 0x28, 0x0b, - 0x79, 0xd7, 0x4f, 0xa3, 0xee, 0x82, 0xf5, 0xb6, 0x0f, 0xd6, 0x47, 0xdd, 0xc6, 0x94, 0x0d, 0x27, - 0x6e, 0x7f, 0x7c, 0xe6, 0x62, 0x85, 0xce, 0x4c, 0xf5, 0x7c, 0x1d, 0xfd, 0x0c, 0x00, 0x00, 0xff, - 0xff, 0xb9, 0x8b, 0x54, 0xcf, 0xd7, 0x04, 0x00, 0x00, +var fileDescriptor_1207dc80bd67ddec = []byte{ + // 641 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x54, 0xc1, 0x6e, 0xd3, 0x4c, + 0x10, 0x8e, 0xed, 0xc4, 0x89, 0x27, 0xcd, 0xaf, 0xd5, 0xaa, 0x3f, 0xb2, 0x22, 0x11, 0xa2, 0x08, + 0x89, 0x48, 0x28, 0x1b, 0xe4, 0x4a, 0x5c, 0xe0, 0x92, 0xaa, 0x49, 0x1b, 0xb5, 0x72, 0x82, 0xd3, + 0x08, 0x89, 0x4b, 0xe4, 0x38, 0xeb, 0x60, 0xe1, 0x78, 0x2d, 0xef, 0x3a, 0xa2, 0x57, 0x9e, 0x82, + 0x17, 0xe0, 0xc2, 0x91, 0xa7, 0xe0, 0xc8, 0x23, 0xa0, 0xf2, 0x00, 0xdc, 0x38, 0x23, 0x6f, 0xe2, + 0xd0, 0x16, 0x84, 0x8a, 0x7a, 0x1a, 0xcf, 0xb7, 0x33, 0xdf, 0xb7, 0x3b, 0xfb, 0x79, 0xe1, 0xff, + 0xb5, 0xd5, 0x8d, 0xa8, 0x58, 0xb9, 0x71, 0x57, 0x5c, 0xc4, 0x94, 0x93, 0x38, 0x61, 0x82, 0x61, + 0x14, 0x51, 0x46, 0x7c, 0x4e, 0xd6, 0x16, 0xd9, 0xac, 0xb6, 0xbe, 0xeb, 0x50, 0x1b, 0x87, 0xae, + 0x47, 0x57, 0x34, 0x12, 0x4e, 0x1a, 0x52, 0xfc, 0x00, 0xaa, 0x09, 0x8d, 0xc3, 0x99, 0xef, 0x7a, + 0x82, 0x25, 0xa6, 0xd2, 0x54, 0xda, 0x35, 0x07, 0x32, 0x68, 0x20, 0x11, 0x7c, 0x04, 0x06, 0xf7, + 0x67, 0xcb, 0x84, 0xa5, 0x31, 0x37, 0xd5, 0xa6, 0xd6, 0xae, 0x5a, 0x8f, 0xc8, 0x4d, 0x62, 0x72, + 0x8d, 0x94, 0x4c, 0x06, 0xc7, 0x59, 0xbd, 0x53, 0xe1, 0xbe, 0xfc, 0xe0, 0xf5, 0x1f, 0x25, 0x28, + 0x6f, 0x51, 0x7c, 0x02, 0x65, 0x3f, 0x08, 0x05, 0x4d, 0xb8, 0xa9, 0x48, 0x3e, 0x72, 0x4b, 0x3e, + 0x32, 0x90, 0x6d, 0x4e, 0xde, 0x8e, 0x6d, 0x30, 0x38, 0x0d, 0x69, 0xb6, 0xcf, 0x7c, 0x6f, 0x4f, + 0x6e, 0xcb, 0x35, 0xd9, 0x36, 0x3a, 0xbf, 0x28, 0xb0, 0x09, 0x65, 0xfa, 0xd6, 0x0b, 0xd3, 0x05, + 0x35, 0xb5, 0xa6, 0xd6, 0xae, 0x39, 0x79, 0x5a, 0x7f, 0x57, 0x04, 0x7d, 0xa3, 0x8e, 0x11, 0x68, + 0x6f, 0xe8, 0x85, 0x9c, 0x94, 0xe1, 0x64, 0x9f, 0x78, 0x08, 0x8a, 0x6f, 0xaa, 0x4d, 0xa5, 0x5d, + 0xb5, 0x9e, 0xfd, 0xdb, 0x51, 0xc8, 0x24, 0x58, 0xc5, 0x21, 0xdd, 0x9e, 0x4b, 0xf1, 0xeb, 0x3e, + 0xd4, 0xae, 0x42, 0x1c, 0x4f, 0x6f, 0x0e, 0xeb, 0x4e, 0x0a, 0x39, 0x57, 0xfd, 0x93, 0x0a, 0x7b, + 0x57, 0x57, 0xf0, 0x14, 0x54, 0x16, 0xcb, 0x43, 0xfd, 0x67, 0xf5, 0xef, 0x20, 0x41, 0x46, 0x31, + 0x4d, 0x5c, 0x11, 0xb0, 0xc8, 0x51, 0x59, 0x8c, 0xef, 0x41, 0x69, 0xed, 0x86, 0x29, 0x95, 0xe3, + 0x31, 0x4e, 0x0a, 0xce, 0x26, 0xc5, 0x53, 0xd0, 0xfd, 0x99, 0x9b, 0x2c, 0xb9, 0xa9, 0xc9, 0xb9, + 0x3d, 0xbf, 0x83, 0x24, 0xcf, 0x68, 0xfd, 0x5e, 0xb2, 0xe4, 0xad, 0x73, 0x30, 0x76, 0xfa, 0x58, + 0x07, 0xd5, 0x1e, 0xa3, 0x42, 0x16, 0xfb, 0x2f, 0x90, 0x22, 0xf3, 0x3e, 0x52, 0xb3, 0x78, 0x7c, + 0x8e, 0x34, 0x19, 0xfb, 0xa8, 0x98, 0xc5, 0xb3, 0x73, 0x54, 0x92, 0xb1, 0x8f, 0xf4, 0x2c, 0x8e, + 0x1c, 0x54, 0xc6, 0x65, 0xd0, 0x7a, 0xf6, 0x11, 0xaa, 0x1c, 0xea, 0x50, 0xcc, 0xb6, 0x5a, 0xb7, + 0xa0, 0x92, 0xbb, 0x06, 0xef, 0x43, 0xc9, 0x63, 0x69, 0x24, 0xb6, 0x7f, 0xcc, 0x26, 0xc9, 0xbd, + 0xa1, 0xee, 0xbc, 0xd1, 0xfa, 0xa0, 0x42, 0xc5, 0x66, 0x0b, 0x3a, 0x8c, 0x7c, 0x96, 0xf9, 0xcb, + 0x5d, 0x2c, 0x12, 0xca, 0xf9, 0xd6, 0x3e, 0x79, 0x8a, 0xef, 0x03, 0xc4, 0xe9, 0x3c, 0x0c, 0xbc, + 0x59, 0xde, 0xbf, 0xe7, 0x18, 0x1b, 0xe4, 0x94, 0x5e, 0xe0, 0x23, 0x00, 0x57, 0x88, 0x24, 0x98, + 0xa7, 0x82, 0x72, 0xe9, 0xcd, 0xaa, 0xf5, 0xf0, 0xf7, 0x91, 0xe5, 0x42, 0xa4, 0x97, 0x17, 0x3b, + 0x57, 0xfa, 0xf0, 0x53, 0x28, 0x71, 0xe1, 0x0a, 0x6a, 0x16, 0xe5, 0x35, 0x37, 0xff, 0x42, 0x30, + 0xc9, 0xea, 0x9c, 0x4d, 0x79, 0xfd, 0x00, 0x8c, 0x1d, 0xe1, 0x1f, 0xec, 0xbf, 0x7f, 0xed, 0x8e, + 0xb7, 0x37, 0xdc, 0xea, 0x40, 0x49, 0x92, 0xe0, 0x2a, 0x94, 0xa7, 0xf6, 0xa9, 0x3d, 0x7a, 0x69, + 0xa3, 0x02, 0x06, 0xd0, 0x47, 0xf6, 0xd9, 0xd0, 0xee, 0x23, 0x25, 0x5b, 0x18, 0x0d, 0x06, 0x32, + 0x51, 0x0f, 0xc7, 0x9f, 0x2f, 0x1b, 0xca, 0x97, 0xcb, 0x86, 0xf2, 0xf5, 0xb2, 0xa1, 0xbc, 0xff, + 0xd6, 0x28, 0xbc, 0x7a, 0xbc, 0x0c, 0xc4, 0xeb, 0x74, 0x4e, 0x3c, 0xb6, 0xea, 0x46, 0x3c, 0xf6, + 0xbc, 0xce, 0x82, 0xae, 0xbb, 0x11, 0x65, 0x3e, 0xef, 0xb8, 0x71, 0xd0, 0x59, 0xb2, 0xee, 0xee, + 0xd9, 0xfb, 0xa8, 0x22, 0x9b, 0xb2, 0xc1, 0x84, 0xf4, 0xc6, 0x43, 0x62, 0x4b, 0x68, 0xae, 0xcb, + 0x47, 0xf0, 0xe0, 0x67, 0x00, 0x00, 0x00, 0xff, 0xff, 0x8c, 0x8c, 0xb2, 0x91, 0x1d, 0x05, 0x00, + 0x00, } func (m *PlacementRule) Marshal() (dAtA []byte, err error) { diff --git a/netmap/v2/types.proto b/v2/netmap/types.proto similarity index 95% rename from netmap/v2/types.proto rename to v2/netmap/types.proto index 2d12ea5..0807cf4 100644 --- a/netmap/v2/types.proto +++ b/v2/netmap/types.proto @@ -1,8 +1,8 @@ syntax = "proto3"; -package netmap.v2; +package neo.fs.v2.netmap; -option go_package = "github.com/nspcc-dev/neofs-api-go/netmap/v2"; +option go_package = "github.com/nspcc-dev/neofs-api-go/v2/netmap"; option csharp_namespace = "NeoFS.API.Netmap"; message PlacementRule { diff --git a/object/v2/service.go b/v2/object/service.go similarity index 99% rename from object/v2/service.go rename to v2/object/service.go index b6e372f..9ec8941 100644 --- a/object/v2/service.go +++ b/v2/object/service.go @@ -1,8 +1,8 @@ -package v2 +package object import ( - refs "github.com/nspcc-dev/neofs-api-go/refs/v2" - service "github.com/nspcc-dev/neofs-api-go/service/v2" + "github.com/nspcc-dev/neofs-api-go/v2/refs" + "github.com/nspcc-dev/neofs-api-go/v2/service" ) // SetAddress sets address of the requested object. diff --git a/object/v2/service.pb.go b/v2/object/service.pb.go similarity index 88% rename from object/v2/service.pb.go rename to v2/object/service.pb.go index ce67752..18a68ce 100644 --- a/object/v2/service.pb.go +++ b/v2/object/service.pb.go @@ -1,14 +1,14 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: object/v2/service.proto +// source: v2/object/service.proto -package v2 +package object import ( context "context" fmt "fmt" proto "github.com/golang/protobuf/proto" - v21 "github.com/nspcc-dev/neofs-api-go/refs/v2" - v2 "github.com/nspcc-dev/neofs-api-go/service/v2" + refs "github.com/nspcc-dev/neofs-api-go/v2/refs" + service "github.com/nspcc-dev/neofs-api-go/v2/service" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" @@ -50,7 +50,7 @@ func (x SearchRequest_Body_Query_Filter_MatchType) String() string { } func (SearchRequest_Body_Query_Filter_MatchType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_7c0929a7db2b025b, []int{8, 0, 0, 0, 0} + return fileDescriptor_6233c87a2945599e, []int{8, 0, 0, 0, 0} } type GetRequest struct { @@ -58,20 +58,20 @@ type GetRequest struct { Body *GetRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` // Carries request meta information. Header data is used only to regulate message // transport and does not affect request execution. - MetaHeader *v2.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" json:"meta_header,omitempty"` + MetaHeader *service.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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 *v2.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + VerifyHeader *service.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetRequest) Reset() { *m = GetRequest{} } func (m *GetRequest) String() string { return proto.CompactTextString(m) } func (*GetRequest) ProtoMessage() {} func (*GetRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_7c0929a7db2b025b, []int{0} + return fileDescriptor_6233c87a2945599e, []int{0} } func (m *GetRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -107,14 +107,14 @@ func (m *GetRequest) GetBody() *GetRequest_Body { return nil } -func (m *GetRequest) GetMetaHeader() *v2.RequestMetaHeader { +func (m *GetRequest) GetMetaHeader() *service.RequestMetaHeader { if m != nil { return m.MetaHeader } return nil } -func (m *GetRequest) GetVerifyHeader() *v2.RequestVerificationHeader { +func (m *GetRequest) GetVerifyHeader() *service.RequestVerificationHeader { if m != nil { return m.VerifyHeader } @@ -122,8 +122,8 @@ func (m *GetRequest) GetVerifyHeader() *v2.RequestVerificationHeader { } type GetRequest_Body struct { - // Address of the requested object.v2. - Address *v21.Address `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + // Address of the requested object. + Address *refs.Address `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` // Carries the raw option flag of the request. // Raw request is sent to receive only the objects // that are physically stored on the server. @@ -137,7 +137,7 @@ func (m *GetRequest_Body) Reset() { *m = GetRequest_Body{} } func (m *GetRequest_Body) String() string { return proto.CompactTextString(m) } func (*GetRequest_Body) ProtoMessage() {} func (*GetRequest_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_7c0929a7db2b025b, []int{0, 0} + return fileDescriptor_6233c87a2945599e, []int{0, 0} } func (m *GetRequest_Body) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -166,7 +166,7 @@ func (m *GetRequest_Body) XXX_DiscardUnknown() { var xxx_messageInfo_GetRequest_Body proto.InternalMessageInfo -func (m *GetRequest_Body) GetAddress() *v21.Address { +func (m *GetRequest_Body) GetAddress() *refs.Address { if m != nil { return m.Address } @@ -185,21 +185,21 @@ type GetResponse struct { Body *GetResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` // Carries response meta information. Header data is used only to regulate // message transport and does not affect request execution. - MetaHeader *v2.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" json:"meta_header,omitempty"` + MetaHeader *service.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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 *v2.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + VerifyHeader *service.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetResponse) Reset() { *m = GetResponse{} } func (m *GetResponse) String() string { return proto.CompactTextString(m) } func (*GetResponse) ProtoMessage() {} func (*GetResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_7c0929a7db2b025b, []int{1} + return fileDescriptor_6233c87a2945599e, []int{1} } func (m *GetResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -235,14 +235,14 @@ func (m *GetResponse) GetBody() *GetResponse_Body { return nil } -func (m *GetResponse) GetMetaHeader() *v2.ResponseMetaHeader { +func (m *GetResponse) GetMetaHeader() *service.ResponseMetaHeader { if m != nil { return m.MetaHeader } return nil } -func (m *GetResponse) GetVerifyHeader() *v2.ResponseVerificationHeader { +func (m *GetResponse) GetVerifyHeader() *service.ResponseVerificationHeader { if m != nil { return m.VerifyHeader } @@ -265,7 +265,7 @@ func (m *GetResponse_Body) Reset() { *m = GetResponse_Body{} } func (m *GetResponse_Body) String() string { return proto.CompactTextString(m) } func (*GetResponse_Body) ProtoMessage() {} func (*GetResponse_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_7c0929a7db2b025b, []int{1, 0} + return fileDescriptor_6233c87a2945599e, []int{1, 0} } func (m *GetResponse_Body) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -342,9 +342,9 @@ func (*GetResponse_Body) XXX_OneofWrappers() []interface{} { // Initialization parameters of the object got from NeoFS. type GetResponse_Body_Init struct { // Object ID - ObjectId *v21.ObjectID `protobuf:"bytes,1,opt,name=object_id,json=objectId,proto3" json:"object_id,omitempty"` + ObjectId *refs.ObjectID `protobuf:"bytes,1,opt,name=object_id,json=objectId,proto3" json:"object_id,omitempty"` // Object signature - Signature *v2.Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` + Signature *service.Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` // Object header. Header *Header `protobuf:"bytes,3,opt,name=header,proto3" json:"header,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` @@ -356,7 +356,7 @@ func (m *GetResponse_Body_Init) Reset() { *m = GetResponse_Body_Init{} } func (m *GetResponse_Body_Init) String() string { return proto.CompactTextString(m) } func (*GetResponse_Body_Init) ProtoMessage() {} func (*GetResponse_Body_Init) Descriptor() ([]byte, []int) { - return fileDescriptor_7c0929a7db2b025b, []int{1, 0, 0} + return fileDescriptor_6233c87a2945599e, []int{1, 0, 0} } func (m *GetResponse_Body_Init) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -385,14 +385,14 @@ func (m *GetResponse_Body_Init) XXX_DiscardUnknown() { var xxx_messageInfo_GetResponse_Body_Init proto.InternalMessageInfo -func (m *GetResponse_Body_Init) GetObjectId() *v21.ObjectID { +func (m *GetResponse_Body_Init) GetObjectId() *refs.ObjectID { if m != nil { return m.ObjectId } return nil } -func (m *GetResponse_Body_Init) GetSignature() *v2.Signature { +func (m *GetResponse_Body_Init) GetSignature() *service.Signature { if m != nil { return m.Signature } @@ -411,20 +411,20 @@ type PutRequest struct { Body *PutRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` // Carries request meta information. Header data is used only to regulate message // transport and does not affect request execution. - MetaHeader *v2.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" json:"meta_header,omitempty"` + MetaHeader *service.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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 *v2.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + VerifyHeader *service.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *PutRequest) Reset() { *m = PutRequest{} } func (m *PutRequest) String() string { return proto.CompactTextString(m) } func (*PutRequest) ProtoMessage() {} func (*PutRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_7c0929a7db2b025b, []int{2} + return fileDescriptor_6233c87a2945599e, []int{2} } func (m *PutRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -460,14 +460,14 @@ func (m *PutRequest) GetBody() *PutRequest_Body { return nil } -func (m *PutRequest) GetMetaHeader() *v2.RequestMetaHeader { +func (m *PutRequest) GetMetaHeader() *service.RequestMetaHeader { if m != nil { return m.MetaHeader } return nil } -func (m *PutRequest) GetVerifyHeader() *v2.RequestVerificationHeader { +func (m *PutRequest) GetVerifyHeader() *service.RequestVerificationHeader { if m != nil { return m.VerifyHeader } @@ -490,7 +490,7 @@ func (m *PutRequest_Body) Reset() { *m = PutRequest_Body{} } func (m *PutRequest_Body) String() string { return proto.CompactTextString(m) } func (*PutRequest_Body) ProtoMessage() {} func (*PutRequest_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_7c0929a7db2b025b, []int{2, 0} + return fileDescriptor_6233c87a2945599e, []int{2, 0} } func (m *PutRequest_Body) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -567,9 +567,9 @@ func (*PutRequest_Body) XXX_OneofWrappers() []interface{} { // Groups initialization parameters of object placement in NeoFS. type PutRequest_Body_Init struct { // Object ID, where available - ObjectId *v21.ObjectID `protobuf:"bytes,1,opt,name=object_id,json=objectId,proto3" json:"object_id,omitempty"` + ObjectId *refs.ObjectID `protobuf:"bytes,1,opt,name=object_id,json=objectId,proto3" json:"object_id,omitempty"` // Object signature, were available - Signature *v2.Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` + Signature *service.Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` // Header of the object to save in the system. Header *Header `protobuf:"bytes,3,opt,name=header,proto3" json:"header,omitempty"` // Number of the object copies to store within the RPC call. @@ -585,7 +585,7 @@ func (m *PutRequest_Body_Init) Reset() { *m = PutRequest_Body_Init{} } func (m *PutRequest_Body_Init) String() string { return proto.CompactTextString(m) } func (*PutRequest_Body_Init) ProtoMessage() {} func (*PutRequest_Body_Init) Descriptor() ([]byte, []int) { - return fileDescriptor_7c0929a7db2b025b, []int{2, 0, 0} + return fileDescriptor_6233c87a2945599e, []int{2, 0, 0} } func (m *PutRequest_Body_Init) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -614,14 +614,14 @@ func (m *PutRequest_Body_Init) XXX_DiscardUnknown() { var xxx_messageInfo_PutRequest_Body_Init proto.InternalMessageInfo -func (m *PutRequest_Body_Init) GetObjectId() *v21.ObjectID { +func (m *PutRequest_Body_Init) GetObjectId() *refs.ObjectID { if m != nil { return m.ObjectId } return nil } -func (m *PutRequest_Body_Init) GetSignature() *v2.Signature { +func (m *PutRequest_Body_Init) GetSignature() *service.Signature { if m != nil { return m.Signature } @@ -647,21 +647,21 @@ type PutResponse struct { Body *PutResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` // Carries response meta information. Header data is used only to regulate // message transport and does not affect request execution. - MetaHeader *v2.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" json:"meta_header,omitempty"` + MetaHeader *service.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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 *v2.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + VerifyHeader *service.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *PutResponse) Reset() { *m = PutResponse{} } func (m *PutResponse) String() string { return proto.CompactTextString(m) } func (*PutResponse) ProtoMessage() {} func (*PutResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_7c0929a7db2b025b, []int{3} + return fileDescriptor_6233c87a2945599e, []int{3} } func (m *PutResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -697,14 +697,14 @@ func (m *PutResponse) GetBody() *PutResponse_Body { return nil } -func (m *PutResponse) GetMetaHeader() *v2.ResponseMetaHeader { +func (m *PutResponse) GetMetaHeader() *service.ResponseMetaHeader { if m != nil { return m.MetaHeader } return nil } -func (m *PutResponse) GetVerifyHeader() *v2.ResponseVerificationHeader { +func (m *PutResponse) GetVerifyHeader() *service.ResponseVerificationHeader { if m != nil { return m.VerifyHeader } @@ -712,19 +712,19 @@ func (m *PutResponse) GetVerifyHeader() *v2.ResponseVerificationHeader { } type PutResponse_Body struct { - // Carries identifier of the saved object.v2. - // It is used to access an object in the container.v2. - ObjectId *v21.ObjectID `protobuf:"bytes,1,opt,name=object_id,json=objectId,proto3" json:"object_id,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + // Carries identifier of the saved object. + // It is used to access an object in the container. + ObjectId *refs.ObjectID `protobuf:"bytes,1,opt,name=object_id,json=objectId,proto3" json:"object_id,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *PutResponse_Body) Reset() { *m = PutResponse_Body{} } func (m *PutResponse_Body) String() string { return proto.CompactTextString(m) } func (*PutResponse_Body) ProtoMessage() {} func (*PutResponse_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_7c0929a7db2b025b, []int{3, 0} + return fileDescriptor_6233c87a2945599e, []int{3, 0} } func (m *PutResponse_Body) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -753,7 +753,7 @@ func (m *PutResponse_Body) XXX_DiscardUnknown() { var xxx_messageInfo_PutResponse_Body proto.InternalMessageInfo -func (m *PutResponse_Body) GetObjectId() *v21.ObjectID { +func (m *PutResponse_Body) GetObjectId() *refs.ObjectID { if m != nil { return m.ObjectId } @@ -765,20 +765,20 @@ type DeleteRequest struct { Body *DeleteRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` // Carries request meta information. Header data is used only to regulate message // transport and does not affect request execution. - MetaHeader *v2.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" json:"meta_header,omitempty"` + MetaHeader *service.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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 *v2.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + VerifyHeader *service.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *DeleteRequest) Reset() { *m = DeleteRequest{} } func (m *DeleteRequest) String() string { return proto.CompactTextString(m) } func (*DeleteRequest) ProtoMessage() {} func (*DeleteRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_7c0929a7db2b025b, []int{4} + return fileDescriptor_6233c87a2945599e, []int{4} } func (m *DeleteRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -814,14 +814,14 @@ func (m *DeleteRequest) GetBody() *DeleteRequest_Body { return nil } -func (m *DeleteRequest) GetMetaHeader() *v2.RequestMetaHeader { +func (m *DeleteRequest) GetMetaHeader() *service.RequestMetaHeader { if m != nil { return m.MetaHeader } return nil } -func (m *DeleteRequest) GetVerifyHeader() *v2.RequestVerificationHeader { +func (m *DeleteRequest) GetVerifyHeader() *service.RequestVerificationHeader { if m != nil { return m.VerifyHeader } @@ -830,19 +830,19 @@ func (m *DeleteRequest) GetVerifyHeader() *v2.RequestVerificationHeader { type DeleteRequest_Body struct { // Carries the address of the object to be deleted. - Address *v21.Address `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + Address *refs.Address `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` // Carries identifier the object owner. - OwnerId *v21.OwnerID `protobuf:"bytes,2,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + OwnerId *refs.OwnerID `protobuf:"bytes,2,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *DeleteRequest_Body) Reset() { *m = DeleteRequest_Body{} } func (m *DeleteRequest_Body) String() string { return proto.CompactTextString(m) } func (*DeleteRequest_Body) ProtoMessage() {} func (*DeleteRequest_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_7c0929a7db2b025b, []int{4, 0} + return fileDescriptor_6233c87a2945599e, []int{4, 0} } func (m *DeleteRequest_Body) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -871,14 +871,14 @@ func (m *DeleteRequest_Body) XXX_DiscardUnknown() { var xxx_messageInfo_DeleteRequest_Body proto.InternalMessageInfo -func (m *DeleteRequest_Body) GetAddress() *v21.Address { +func (m *DeleteRequest_Body) GetAddress() *refs.Address { if m != nil { return m.Address } return nil } -func (m *DeleteRequest_Body) GetOwnerId() *v21.OwnerID { +func (m *DeleteRequest_Body) GetOwnerId() *refs.OwnerID { if m != nil { return m.OwnerId } @@ -892,21 +892,21 @@ type DeleteResponse struct { Body *DeleteResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` // Carries response meta information. Header data is used only to regulate // message transport and does not affect request execution. - MetaHeader *v2.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" json:"meta_header,omitempty"` + MetaHeader *service.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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 *v2.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + VerifyHeader *service.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *DeleteResponse) Reset() { *m = DeleteResponse{} } func (m *DeleteResponse) String() string { return proto.CompactTextString(m) } func (*DeleteResponse) ProtoMessage() {} func (*DeleteResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_7c0929a7db2b025b, []int{5} + return fileDescriptor_6233c87a2945599e, []int{5} } func (m *DeleteResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -942,14 +942,14 @@ func (m *DeleteResponse) GetBody() *DeleteResponse_Body { return nil } -func (m *DeleteResponse) GetMetaHeader() *v2.ResponseMetaHeader { +func (m *DeleteResponse) GetMetaHeader() *service.ResponseMetaHeader { if m != nil { return m.MetaHeader } return nil } -func (m *DeleteResponse) GetVerifyHeader() *v2.ResponseVerificationHeader { +func (m *DeleteResponse) GetVerifyHeader() *service.ResponseVerificationHeader { if m != nil { return m.VerifyHeader } @@ -966,7 +966,7 @@ func (m *DeleteResponse_Body) Reset() { *m = DeleteResponse_Body{} } func (m *DeleteResponse_Body) String() string { return proto.CompactTextString(m) } func (*DeleteResponse_Body) ProtoMessage() {} func (*DeleteResponse_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_7c0929a7db2b025b, []int{5, 0} + return fileDescriptor_6233c87a2945599e, []int{5, 0} } func (m *DeleteResponse_Body) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1000,20 +1000,20 @@ type HeadRequest struct { Body *HeadRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` // Carries request meta information. Header data is used only to regulate message // transport and does not affect request execution. - MetaHeader *v2.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" json:"meta_header,omitempty"` + MetaHeader *service.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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 *v2.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + VerifyHeader *service.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *HeadRequest) Reset() { *m = HeadRequest{} } func (m *HeadRequest) String() string { return proto.CompactTextString(m) } func (*HeadRequest) ProtoMessage() {} func (*HeadRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_7c0929a7db2b025b, []int{6} + return fileDescriptor_6233c87a2945599e, []int{6} } func (m *HeadRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1049,14 +1049,14 @@ func (m *HeadRequest) GetBody() *HeadRequest_Body { return nil } -func (m *HeadRequest) GetMetaHeader() *v2.RequestMetaHeader { +func (m *HeadRequest) GetMetaHeader() *service.RequestMetaHeader { if m != nil { return m.MetaHeader } return nil } -func (m *HeadRequest) GetVerifyHeader() *v2.RequestVerificationHeader { +func (m *HeadRequest) GetVerifyHeader() *service.RequestVerificationHeader { if m != nil { return m.VerifyHeader } @@ -1065,7 +1065,7 @@ func (m *HeadRequest) GetVerifyHeader() *v2.RequestVerificationHeader { type HeadRequest_Body struct { // Address of the object with the requested header. - Address *v21.Address `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + Address *refs.Address `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` // Return only minimal header subset MainOnly bool `protobuf:"varint,2,opt,name=main_only,json=mainOnly,proto3" json:"main_only,omitempty"` // Carries the raw option flag of the request. @@ -1081,7 +1081,7 @@ func (m *HeadRequest_Body) Reset() { *m = HeadRequest_Body{} } func (m *HeadRequest_Body) String() string { return proto.CompactTextString(m) } func (*HeadRequest_Body) ProtoMessage() {} func (*HeadRequest_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_7c0929a7db2b025b, []int{6, 0} + return fileDescriptor_6233c87a2945599e, []int{6, 0} } func (m *HeadRequest_Body) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1110,7 +1110,7 @@ func (m *HeadRequest_Body) XXX_DiscardUnknown() { var xxx_messageInfo_HeadRequest_Body proto.InternalMessageInfo -func (m *HeadRequest_Body) GetAddress() *v21.Address { +func (m *HeadRequest_Body) GetAddress() *refs.Address { if m != nil { return m.Address } @@ -1136,21 +1136,21 @@ type HeadResponse struct { Body *HeadResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` // Carries response meta information. Header data is used only to regulate // message transport and does not affect request execution. - MetaHeader *v2.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" json:"meta_header,omitempty"` + MetaHeader *service.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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 *v2.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + VerifyHeader *service.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *HeadResponse) Reset() { *m = HeadResponse{} } func (m *HeadResponse) String() string { return proto.CompactTextString(m) } func (*HeadResponse) ProtoMessage() {} func (*HeadResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_7c0929a7db2b025b, []int{7} + return fileDescriptor_6233c87a2945599e, []int{7} } func (m *HeadResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1186,14 +1186,14 @@ func (m *HeadResponse) GetBody() *HeadResponse_Body { return nil } -func (m *HeadResponse) GetMetaHeader() *v2.ResponseMetaHeader { +func (m *HeadResponse) GetMetaHeader() *service.ResponseMetaHeader { if m != nil { return m.MetaHeader } return nil } -func (m *HeadResponse) GetVerifyHeader() *v2.ResponseVerificationHeader { +func (m *HeadResponse) GetVerifyHeader() *service.ResponseVerificationHeader { if m != nil { return m.VerifyHeader } @@ -1216,7 +1216,7 @@ func (m *HeadResponse_Body) Reset() { *m = HeadResponse_Body{} } func (m *HeadResponse_Body) String() string { return proto.CompactTextString(m) } func (*HeadResponse_Body) ProtoMessage() {} func (*HeadResponse_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_7c0929a7db2b025b, []int{7, 0} + return fileDescriptor_6233c87a2945599e, []int{7, 0} } func (m *HeadResponse_Body) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1292,13 +1292,13 @@ func (*HeadResponse_Body) XXX_OneofWrappers() []interface{} { type HeadResponse_Body_ShortHeader struct { // Object format version. - Version *v2.Version `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` + Version *service.Version `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` // Epoch when the object was created CreationEpoch uint64 `protobuf:"varint,2,opt,name=creation_epoch,json=creationEpoch,proto3" json:"creation_epoch,omitempty"` // Object's owner - OwnerId *v21.OwnerID `protobuf:"bytes,3,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"` + OwnerId *refs.OwnerID `protobuf:"bytes,3,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"` // Type of the object payload content - ObjectType ObjectType `protobuf:"varint,4,opt,name=object_type,json=objectType,proto3,enum=object.v2.ObjectType" json:"object_type,omitempty"` + ObjectType ObjectType `protobuf:"varint,4,opt,name=object_type,json=objectType,proto3,enum=neo.fs.v2.object.ObjectType" json:"object_type,omitempty"` // Size of payload in bytes. // 0xFFFFFFFFFFFFFFFF means `payload_length` is unknown PayloadLength uint64 `protobuf:"varint,5,opt,name=payload_length,json=payloadLength,proto3" json:"payload_length,omitempty"` @@ -1311,7 +1311,7 @@ func (m *HeadResponse_Body_ShortHeader) Reset() { *m = HeadResponse_Body func (m *HeadResponse_Body_ShortHeader) String() string { return proto.CompactTextString(m) } func (*HeadResponse_Body_ShortHeader) ProtoMessage() {} func (*HeadResponse_Body_ShortHeader) Descriptor() ([]byte, []int) { - return fileDescriptor_7c0929a7db2b025b, []int{7, 0, 0} + return fileDescriptor_6233c87a2945599e, []int{7, 0, 0} } func (m *HeadResponse_Body_ShortHeader) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1340,7 +1340,7 @@ func (m *HeadResponse_Body_ShortHeader) XXX_DiscardUnknown() { var xxx_messageInfo_HeadResponse_Body_ShortHeader proto.InternalMessageInfo -func (m *HeadResponse_Body_ShortHeader) GetVersion() *v2.Version { +func (m *HeadResponse_Body_ShortHeader) GetVersion() *service.Version { if m != nil { return m.Version } @@ -1354,7 +1354,7 @@ func (m *HeadResponse_Body_ShortHeader) GetCreationEpoch() uint64 { return 0 } -func (m *HeadResponse_Body_ShortHeader) GetOwnerId() *v21.OwnerID { +func (m *HeadResponse_Body_ShortHeader) GetOwnerId() *refs.OwnerID { if m != nil { return m.OwnerId } @@ -1380,20 +1380,20 @@ type SearchRequest struct { Body *SearchRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` // Carries request meta information. Header data is used only to regulate message // transport and does not affect request execution. - MetaHeader *v2.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" json:"meta_header,omitempty"` + MetaHeader *service.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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 *v2.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + VerifyHeader *service.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *SearchRequest) Reset() { *m = SearchRequest{} } func (m *SearchRequest) String() string { return proto.CompactTextString(m) } func (*SearchRequest) ProtoMessage() {} func (*SearchRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_7c0929a7db2b025b, []int{8} + return fileDescriptor_6233c87a2945599e, []int{8} } func (m *SearchRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1429,14 +1429,14 @@ func (m *SearchRequest) GetBody() *SearchRequest_Body { return nil } -func (m *SearchRequest) GetMetaHeader() *v2.RequestMetaHeader { +func (m *SearchRequest) GetMetaHeader() *service.RequestMetaHeader { if m != nil { return m.MetaHeader } return nil } -func (m *SearchRequest) GetVerifyHeader() *v2.RequestVerificationHeader { +func (m *SearchRequest) GetVerifyHeader() *service.RequestVerificationHeader { if m != nil { return m.VerifyHeader } @@ -1445,7 +1445,7 @@ func (m *SearchRequest) GetVerifyHeader() *v2.RequestVerificationHeader { type SearchRequest_Body struct { // Carries search container identifier. - ContainerId *v21.ContainerID `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` + ContainerId *refs.ContainerID `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` Query *SearchRequest_Body_Query `protobuf:"bytes,2,opt,name=query,proto3" json:"query,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -1456,7 +1456,7 @@ func (m *SearchRequest_Body) Reset() { *m = SearchRequest_Body{} } func (m *SearchRequest_Body) String() string { return proto.CompactTextString(m) } func (*SearchRequest_Body) ProtoMessage() {} func (*SearchRequest_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_7c0929a7db2b025b, []int{8, 0} + return fileDescriptor_6233c87a2945599e, []int{8, 0} } func (m *SearchRequest_Body) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1485,7 +1485,7 @@ func (m *SearchRequest_Body) XXX_DiscardUnknown() { var xxx_messageInfo_SearchRequest_Body proto.InternalMessageInfo -func (m *SearchRequest_Body) GetContainerId() *v21.ContainerID { +func (m *SearchRequest_Body) GetContainerId() *refs.ContainerID { if m != nil { return m.ContainerId } @@ -1511,7 +1511,7 @@ func (m *SearchRequest_Body_Query) Reset() { *m = SearchRequest_Body_Que func (m *SearchRequest_Body_Query) String() string { return proto.CompactTextString(m) } func (*SearchRequest_Body_Query) ProtoMessage() {} func (*SearchRequest_Body_Query) Descriptor() ([]byte, []int) { - return fileDescriptor_7c0929a7db2b025b, []int{8, 0, 0} + return fileDescriptor_6233c87a2945599e, []int{8, 0, 0} } func (m *SearchRequest_Body_Query) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1555,7 +1555,7 @@ func (m *SearchRequest_Body_Query) GetFilters() []*SearchRequest_Body_Query_Filt } type SearchRequest_Body_Query_Filter struct { - MatchType SearchRequest_Body_Query_Filter_MatchType `protobuf:"varint,1,opt,name=match_type,json=matchType,proto3,enum=object.v2.SearchRequest_Body_Query_Filter_MatchType" json:"match_type,omitempty"` + MatchType SearchRequest_Body_Query_Filter_MatchType `protobuf:"varint,1,opt,name=match_type,json=matchType,proto3,enum=neo.fs.v2.object.SearchRequest_Body_Query_Filter_MatchType" json:"match_type,omitempty"` Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` Value string `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` @@ -1567,7 +1567,7 @@ func (m *SearchRequest_Body_Query_Filter) Reset() { *m = SearchRequest_B func (m *SearchRequest_Body_Query_Filter) String() string { return proto.CompactTextString(m) } func (*SearchRequest_Body_Query_Filter) ProtoMessage() {} func (*SearchRequest_Body_Query_Filter) Descriptor() ([]byte, []int) { - return fileDescriptor_7c0929a7db2b025b, []int{8, 0, 0, 0} + return fileDescriptor_6233c87a2945599e, []int{8, 0, 0, 0} } func (m *SearchRequest_Body_Query_Filter) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1622,21 +1622,21 @@ type SearchResponse struct { Body *SearchResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` // Carries response meta information. Header data is used only to regulate // message transport and does not affect request execution. - MetaHeader *v2.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" json:"meta_header,omitempty"` + MetaHeader *service.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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 *v2.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + VerifyHeader *service.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *SearchResponse) Reset() { *m = SearchResponse{} } func (m *SearchResponse) String() string { return proto.CompactTextString(m) } func (*SearchResponse) ProtoMessage() {} func (*SearchResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_7c0929a7db2b025b, []int{9} + return fileDescriptor_6233c87a2945599e, []int{9} } func (m *SearchResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1672,14 +1672,14 @@ func (m *SearchResponse) GetBody() *SearchResponse_Body { return nil } -func (m *SearchResponse) GetMetaHeader() *v2.ResponseMetaHeader { +func (m *SearchResponse) GetMetaHeader() *service.ResponseMetaHeader { if m != nil { return m.MetaHeader } return nil } -func (m *SearchResponse) GetVerifyHeader() *v2.ResponseVerificationHeader { +func (m *SearchResponse) GetVerifyHeader() *service.ResponseVerificationHeader { if m != nil { return m.VerifyHeader } @@ -1688,17 +1688,17 @@ func (m *SearchResponse) GetVerifyHeader() *v2.ResponseVerificationHeader { type SearchResponse_Body struct { // Carries list of object identifiers that match the search query. - IdList []*v21.ObjectID `protobuf:"bytes,1,rep,name=id_list,json=idList,proto3" json:"id_list,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + IdList []*refs.ObjectID `protobuf:"bytes,1,rep,name=id_list,json=idList,proto3" json:"id_list,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *SearchResponse_Body) Reset() { *m = SearchResponse_Body{} } func (m *SearchResponse_Body) String() string { return proto.CompactTextString(m) } func (*SearchResponse_Body) ProtoMessage() {} func (*SearchResponse_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_7c0929a7db2b025b, []int{9, 0} + return fileDescriptor_6233c87a2945599e, []int{9, 0} } func (m *SearchResponse_Body) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1727,7 +1727,7 @@ func (m *SearchResponse_Body) XXX_DiscardUnknown() { var xxx_messageInfo_SearchResponse_Body proto.InternalMessageInfo -func (m *SearchResponse_Body) GetIdList() []*v21.ObjectID { +func (m *SearchResponse_Body) GetIdList() []*refs.ObjectID { if m != nil { return m.IdList } @@ -1749,7 +1749,7 @@ func (m *Range) Reset() { *m = Range{} } func (m *Range) String() string { return proto.CompactTextString(m) } func (*Range) ProtoMessage() {} func (*Range) Descriptor() ([]byte, []int) { - return fileDescriptor_7c0929a7db2b025b, []int{10} + return fileDescriptor_6233c87a2945599e, []int{10} } func (m *Range) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1797,20 +1797,20 @@ type GetRangeRequest struct { Body *GetRangeRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` // Carries request meta information. Header data is used only to regulate message // transport and does not affect request execution. - MetaHeader *v2.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" json:"meta_header,omitempty"` + MetaHeader *service.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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 *v2.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + VerifyHeader *service.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetRangeRequest) Reset() { *m = GetRangeRequest{} } func (m *GetRangeRequest) String() string { return proto.CompactTextString(m) } func (*GetRangeRequest) ProtoMessage() {} func (*GetRangeRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_7c0929a7db2b025b, []int{11} + return fileDescriptor_6233c87a2945599e, []int{11} } func (m *GetRangeRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1846,14 +1846,14 @@ func (m *GetRangeRequest) GetBody() *GetRangeRequest_Body { return nil } -func (m *GetRangeRequest) GetMetaHeader() *v2.RequestMetaHeader { +func (m *GetRangeRequest) GetMetaHeader() *service.RequestMetaHeader { if m != nil { return m.MetaHeader } return nil } -func (m *GetRangeRequest) GetVerifyHeader() *v2.RequestVerificationHeader { +func (m *GetRangeRequest) GetVerifyHeader() *service.RequestVerificationHeader { if m != nil { return m.VerifyHeader } @@ -1862,7 +1862,7 @@ func (m *GetRangeRequest) GetVerifyHeader() *v2.RequestVerificationHeader { type GetRangeRequest_Body struct { // Address carries address of the object that contains the requested payload range. - Address *v21.Address `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + Address *refs.Address `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` // Range carries the parameters of the requested payload range. Range *Range `protobuf:"bytes,2,opt,name=range,proto3" json:"range,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` @@ -1874,7 +1874,7 @@ func (m *GetRangeRequest_Body) Reset() { *m = GetRangeRequest_Body{} } func (m *GetRangeRequest_Body) String() string { return proto.CompactTextString(m) } func (*GetRangeRequest_Body) ProtoMessage() {} func (*GetRangeRequest_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_7c0929a7db2b025b, []int{11, 0} + return fileDescriptor_6233c87a2945599e, []int{11, 0} } func (m *GetRangeRequest_Body) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1903,7 +1903,7 @@ func (m *GetRangeRequest_Body) XXX_DiscardUnknown() { var xxx_messageInfo_GetRangeRequest_Body proto.InternalMessageInfo -func (m *GetRangeRequest_Body) GetAddress() *v21.Address { +func (m *GetRangeRequest_Body) GetAddress() *refs.Address { if m != nil { return m.Address } @@ -1922,21 +1922,21 @@ type GetRangeResponse struct { Body *GetRangeResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` // Carries response meta information. Header data is used only to regulate // message transport and does not affect request execution. - MetaHeader *v2.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" json:"meta_header,omitempty"` + MetaHeader *service.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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 *v2.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + VerifyHeader *service.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetRangeResponse) Reset() { *m = GetRangeResponse{} } func (m *GetRangeResponse) String() string { return proto.CompactTextString(m) } func (*GetRangeResponse) ProtoMessage() {} func (*GetRangeResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_7c0929a7db2b025b, []int{12} + return fileDescriptor_6233c87a2945599e, []int{12} } func (m *GetRangeResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1972,14 +1972,14 @@ func (m *GetRangeResponse) GetBody() *GetRangeResponse_Body { return nil } -func (m *GetRangeResponse) GetMetaHeader() *v2.ResponseMetaHeader { +func (m *GetRangeResponse) GetMetaHeader() *service.ResponseMetaHeader { if m != nil { return m.MetaHeader } return nil } -func (m *GetRangeResponse) GetVerifyHeader() *v2.ResponseVerificationHeader { +func (m *GetRangeResponse) GetVerifyHeader() *service.ResponseVerificationHeader { if m != nil { return m.VerifyHeader } @@ -1998,7 +1998,7 @@ func (m *GetRangeResponse_Body) Reset() { *m = GetRangeResponse_Body{} } func (m *GetRangeResponse_Body) String() string { return proto.CompactTextString(m) } func (*GetRangeResponse_Body) ProtoMessage() {} func (*GetRangeResponse_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_7c0929a7db2b025b, []int{12, 0} + return fileDescriptor_6233c87a2945599e, []int{12, 0} } func (m *GetRangeResponse_Body) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -2039,20 +2039,20 @@ type GetRangeHashRequest struct { Body *GetRangeHashRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` // Carries request meta information. Header data is used only to regulate message // transport and does not affect request execution. - MetaHeader *v2.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" json:"meta_header,omitempty"` + MetaHeader *service.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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 *v2.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + VerifyHeader *service.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetRangeHashRequest) Reset() { *m = GetRangeHashRequest{} } func (m *GetRangeHashRequest) String() string { return proto.CompactTextString(m) } func (*GetRangeHashRequest) ProtoMessage() {} func (*GetRangeHashRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_7c0929a7db2b025b, []int{13} + return fileDescriptor_6233c87a2945599e, []int{13} } func (m *GetRangeHashRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -2088,14 +2088,14 @@ func (m *GetRangeHashRequest) GetBody() *GetRangeHashRequest_Body { return nil } -func (m *GetRangeHashRequest) GetMetaHeader() *v2.RequestMetaHeader { +func (m *GetRangeHashRequest) GetMetaHeader() *service.RequestMetaHeader { if m != nil { return m.MetaHeader } return nil } -func (m *GetRangeHashRequest) GetVerifyHeader() *v2.RequestVerificationHeader { +func (m *GetRangeHashRequest) GetVerifyHeader() *service.RequestVerificationHeader { if m != nil { return m.VerifyHeader } @@ -2104,7 +2104,7 @@ func (m *GetRangeHashRequest) GetVerifyHeader() *v2.RequestVerificationHeader { type GetRangeHashRequest_Body struct { // Carries address of the object that contains the requested payload range. - Address *v21.Address `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + Address *refs.Address `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` // Carries the list of object payload range to calculate homomorphic hash. Ranges []*Range `protobuf:"bytes,2,rep,name=ranges,proto3" json:"ranges,omitempty"` // Carries binary salt to XOR object payload ranges before hash calculation. @@ -2118,7 +2118,7 @@ func (m *GetRangeHashRequest_Body) Reset() { *m = GetRangeHashRequest_Bo func (m *GetRangeHashRequest_Body) String() string { return proto.CompactTextString(m) } func (*GetRangeHashRequest_Body) ProtoMessage() {} func (*GetRangeHashRequest_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_7c0929a7db2b025b, []int{13, 0} + return fileDescriptor_6233c87a2945599e, []int{13, 0} } func (m *GetRangeHashRequest_Body) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -2147,7 +2147,7 @@ func (m *GetRangeHashRequest_Body) XXX_DiscardUnknown() { var xxx_messageInfo_GetRangeHashRequest_Body proto.InternalMessageInfo -func (m *GetRangeHashRequest_Body) GetAddress() *v21.Address { +func (m *GetRangeHashRequest_Body) GetAddress() *refs.Address { if m != nil { return m.Address } @@ -2173,21 +2173,21 @@ type GetRangeHashResponse struct { Body *GetRangeHashResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` // Carries response meta information. Header data is used only to regulate // message transport and does not affect request execution. - MetaHeader *v2.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" json:"meta_header,omitempty"` + MetaHeader *service.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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 *v2.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + VerifyHeader *service.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetRangeHashResponse) Reset() { *m = GetRangeHashResponse{} } func (m *GetRangeHashResponse) String() string { return proto.CompactTextString(m) } func (*GetRangeHashResponse) ProtoMessage() {} func (*GetRangeHashResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_7c0929a7db2b025b, []int{14} + return fileDescriptor_6233c87a2945599e, []int{14} } func (m *GetRangeHashResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -2223,14 +2223,14 @@ func (m *GetRangeHashResponse) GetBody() *GetRangeHashResponse_Body { return nil } -func (m *GetRangeHashResponse) GetMetaHeader() *v2.ResponseMetaHeader { +func (m *GetRangeHashResponse) GetMetaHeader() *service.ResponseMetaHeader { if m != nil { return m.MetaHeader } return nil } -func (m *GetRangeHashResponse) GetVerifyHeader() *v2.ResponseVerificationHeader { +func (m *GetRangeHashResponse) GetVerifyHeader() *service.ResponseVerificationHeader { if m != nil { return m.VerifyHeader } @@ -2249,7 +2249,7 @@ func (m *GetRangeHashResponse_Body) Reset() { *m = GetRangeHashResponse_ func (m *GetRangeHashResponse_Body) String() string { return proto.CompactTextString(m) } func (*GetRangeHashResponse_Body) ProtoMessage() {} func (*GetRangeHashResponse_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_7c0929a7db2b025b, []int{14, 0} + return fileDescriptor_6233c87a2945599e, []int{14, 0} } func (m *GetRangeHashResponse_Body) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -2286,134 +2286,135 @@ func (m *GetRangeHashResponse_Body) GetHashList() [][]byte { } func init() { - proto.RegisterEnum("object.v2.SearchRequest_Body_Query_Filter_MatchType", SearchRequest_Body_Query_Filter_MatchType_name, SearchRequest_Body_Query_Filter_MatchType_value) - proto.RegisterType((*GetRequest)(nil), "object.v2.GetRequest") - proto.RegisterType((*GetRequest_Body)(nil), "object.v2.GetRequest.Body") - proto.RegisterType((*GetResponse)(nil), "object.v2.GetResponse") - proto.RegisterType((*GetResponse_Body)(nil), "object.v2.GetResponse.Body") - proto.RegisterType((*GetResponse_Body_Init)(nil), "object.v2.GetResponse.Body.Init") - proto.RegisterType((*PutRequest)(nil), "object.v2.PutRequest") - proto.RegisterType((*PutRequest_Body)(nil), "object.v2.PutRequest.Body") - proto.RegisterType((*PutRequest_Body_Init)(nil), "object.v2.PutRequest.Body.Init") - proto.RegisterType((*PutResponse)(nil), "object.v2.PutResponse") - proto.RegisterType((*PutResponse_Body)(nil), "object.v2.PutResponse.Body") - proto.RegisterType((*DeleteRequest)(nil), "object.v2.DeleteRequest") - proto.RegisterType((*DeleteRequest_Body)(nil), "object.v2.DeleteRequest.Body") - proto.RegisterType((*DeleteResponse)(nil), "object.v2.DeleteResponse") - proto.RegisterType((*DeleteResponse_Body)(nil), "object.v2.DeleteResponse.Body") - proto.RegisterType((*HeadRequest)(nil), "object.v2.HeadRequest") - proto.RegisterType((*HeadRequest_Body)(nil), "object.v2.HeadRequest.Body") - proto.RegisterType((*HeadResponse)(nil), "object.v2.HeadResponse") - proto.RegisterType((*HeadResponse_Body)(nil), "object.v2.HeadResponse.Body") - proto.RegisterType((*HeadResponse_Body_ShortHeader)(nil), "object.v2.HeadResponse.Body.ShortHeader") - proto.RegisterType((*SearchRequest)(nil), "object.v2.SearchRequest") - proto.RegisterType((*SearchRequest_Body)(nil), "object.v2.SearchRequest.Body") - proto.RegisterType((*SearchRequest_Body_Query)(nil), "object.v2.SearchRequest.Body.Query") - proto.RegisterType((*SearchRequest_Body_Query_Filter)(nil), "object.v2.SearchRequest.Body.Query.Filter") - proto.RegisterType((*SearchResponse)(nil), "object.v2.SearchResponse") - proto.RegisterType((*SearchResponse_Body)(nil), "object.v2.SearchResponse.Body") - proto.RegisterType((*Range)(nil), "object.v2.Range") - proto.RegisterType((*GetRangeRequest)(nil), "object.v2.GetRangeRequest") - proto.RegisterType((*GetRangeRequest_Body)(nil), "object.v2.GetRangeRequest.Body") - proto.RegisterType((*GetRangeResponse)(nil), "object.v2.GetRangeResponse") - proto.RegisterType((*GetRangeResponse_Body)(nil), "object.v2.GetRangeResponse.Body") - proto.RegisterType((*GetRangeHashRequest)(nil), "object.v2.GetRangeHashRequest") - proto.RegisterType((*GetRangeHashRequest_Body)(nil), "object.v2.GetRangeHashRequest.Body") - proto.RegisterType((*GetRangeHashResponse)(nil), "object.v2.GetRangeHashResponse") - proto.RegisterType((*GetRangeHashResponse_Body)(nil), "object.v2.GetRangeHashResponse.Body") + proto.RegisterEnum("neo.fs.v2.object.SearchRequest_Body_Query_Filter_MatchType", SearchRequest_Body_Query_Filter_MatchType_name, SearchRequest_Body_Query_Filter_MatchType_value) + proto.RegisterType((*GetRequest)(nil), "neo.fs.v2.object.GetRequest") + proto.RegisterType((*GetRequest_Body)(nil), "neo.fs.v2.object.GetRequest.Body") + proto.RegisterType((*GetResponse)(nil), "neo.fs.v2.object.GetResponse") + proto.RegisterType((*GetResponse_Body)(nil), "neo.fs.v2.object.GetResponse.Body") + proto.RegisterType((*GetResponse_Body_Init)(nil), "neo.fs.v2.object.GetResponse.Body.Init") + proto.RegisterType((*PutRequest)(nil), "neo.fs.v2.object.PutRequest") + proto.RegisterType((*PutRequest_Body)(nil), "neo.fs.v2.object.PutRequest.Body") + proto.RegisterType((*PutRequest_Body_Init)(nil), "neo.fs.v2.object.PutRequest.Body.Init") + proto.RegisterType((*PutResponse)(nil), "neo.fs.v2.object.PutResponse") + proto.RegisterType((*PutResponse_Body)(nil), "neo.fs.v2.object.PutResponse.Body") + proto.RegisterType((*DeleteRequest)(nil), "neo.fs.v2.object.DeleteRequest") + proto.RegisterType((*DeleteRequest_Body)(nil), "neo.fs.v2.object.DeleteRequest.Body") + proto.RegisterType((*DeleteResponse)(nil), "neo.fs.v2.object.DeleteResponse") + proto.RegisterType((*DeleteResponse_Body)(nil), "neo.fs.v2.object.DeleteResponse.Body") + proto.RegisterType((*HeadRequest)(nil), "neo.fs.v2.object.HeadRequest") + proto.RegisterType((*HeadRequest_Body)(nil), "neo.fs.v2.object.HeadRequest.Body") + proto.RegisterType((*HeadResponse)(nil), "neo.fs.v2.object.HeadResponse") + proto.RegisterType((*HeadResponse_Body)(nil), "neo.fs.v2.object.HeadResponse.Body") + proto.RegisterType((*HeadResponse_Body_ShortHeader)(nil), "neo.fs.v2.object.HeadResponse.Body.ShortHeader") + proto.RegisterType((*SearchRequest)(nil), "neo.fs.v2.object.SearchRequest") + proto.RegisterType((*SearchRequest_Body)(nil), "neo.fs.v2.object.SearchRequest.Body") + proto.RegisterType((*SearchRequest_Body_Query)(nil), "neo.fs.v2.object.SearchRequest.Body.Query") + proto.RegisterType((*SearchRequest_Body_Query_Filter)(nil), "neo.fs.v2.object.SearchRequest.Body.Query.Filter") + proto.RegisterType((*SearchResponse)(nil), "neo.fs.v2.object.SearchResponse") + proto.RegisterType((*SearchResponse_Body)(nil), "neo.fs.v2.object.SearchResponse.Body") + proto.RegisterType((*Range)(nil), "neo.fs.v2.object.Range") + proto.RegisterType((*GetRangeRequest)(nil), "neo.fs.v2.object.GetRangeRequest") + proto.RegisterType((*GetRangeRequest_Body)(nil), "neo.fs.v2.object.GetRangeRequest.Body") + proto.RegisterType((*GetRangeResponse)(nil), "neo.fs.v2.object.GetRangeResponse") + proto.RegisterType((*GetRangeResponse_Body)(nil), "neo.fs.v2.object.GetRangeResponse.Body") + proto.RegisterType((*GetRangeHashRequest)(nil), "neo.fs.v2.object.GetRangeHashRequest") + proto.RegisterType((*GetRangeHashRequest_Body)(nil), "neo.fs.v2.object.GetRangeHashRequest.Body") + proto.RegisterType((*GetRangeHashResponse)(nil), "neo.fs.v2.object.GetRangeHashResponse") + proto.RegisterType((*GetRangeHashResponse_Body)(nil), "neo.fs.v2.object.GetRangeHashResponse.Body") } -func init() { proto.RegisterFile("object/v2/service.proto", fileDescriptor_7c0929a7db2b025b) } +func init() { proto.RegisterFile("v2/object/service.proto", fileDescriptor_6233c87a2945599e) } -var fileDescriptor_7c0929a7db2b025b = []byte{ - // 1387 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x58, 0xcd, 0x6f, 0x1b, 0xc5, - 0x1b, 0xce, 0xae, 0x3f, 0x12, 0xbf, 0xb6, 0xf3, 0x73, 0xa7, 0x49, 0xea, 0xdf, 0xa6, 0x75, 0xa3, - 0x0d, 0xad, 0x42, 0xab, 0x6c, 0x82, 0x5b, 0x52, 0x38, 0x40, 0x95, 0x34, 0x6d, 0x63, 0xda, 0x7c, - 0x74, 0xdd, 0x16, 0xa9, 0x17, 0x6b, 0xb3, 0x3b, 0x89, 0x17, 0xec, 0x5d, 0x77, 0x77, 0xed, 0xca, - 0x67, 0x10, 0x47, 0x8e, 0x88, 0x23, 0x82, 0x1b, 0x12, 0x70, 0x46, 0xfc, 0x03, 0x08, 0x81, 0xc4, - 0x99, 0x13, 0x0a, 0x67, 0x84, 0x90, 0x38, 0x22, 0x84, 0xe6, 0x63, 0xd7, 0x3b, 0xa9, 0x1d, 0x87, - 0x9c, 0xf6, 0xb6, 0xfb, 0xce, 0xf3, 0xce, 0xce, 0xf3, 0xcc, 0x33, 0xef, 0xcc, 0x2c, 0x5c, 0x70, - 0xf7, 0xdf, 0xc3, 0x66, 0xb0, 0xd2, 0xab, 0xae, 0xf8, 0xd8, 0xeb, 0xd9, 0x26, 0xd6, 0x3a, 0x9e, - 0x1b, 0xb8, 0x28, 0xc7, 0x1a, 0xb4, 0x5e, 0x55, 0x99, 0x1d, 0x60, 0x82, 0x7e, 0x07, 0xfb, 0x0c, - 0xa1, 0x9c, 0xf7, 0xf0, 0x81, 0x7f, 0x3c, 0x38, 0xcb, 0x7b, 0x21, 0xf1, 0x36, 0x0e, 0x0c, 0x1e, - 0xbe, 0x10, 0x0b, 0xf7, 0xb0, 0x67, 0x1f, 0xf4, 0x59, 0x83, 0xfa, 0xb1, 0x0c, 0x70, 0x1f, 0x07, - 0x3a, 0x7e, 0xde, 0xc5, 0x7e, 0x80, 0x34, 0x48, 0xef, 0xbb, 0x56, 0xbf, 0x2c, 0x2d, 0x48, 0x4b, - 0xf9, 0xaa, 0xa2, 0x45, 0x83, 0xd0, 0x06, 0x20, 0x6d, 0xc3, 0xb5, 0xfa, 0x3a, 0xc5, 0xa1, 0xb7, - 0x21, 0x4f, 0xbe, 0xd2, 0x68, 0x62, 0xc3, 0xc2, 0x5e, 0x59, 0xa6, 0x69, 0x97, 0xb4, 0x90, 0x4a, - 0xaf, 0xaa, 0xf1, 0xa4, 0x6d, 0x1c, 0x18, 0x5b, 0x14, 0xa4, 0x43, 0x3b, 0x7a, 0x46, 0xef, 0x40, - 0x91, 0x0d, 0x27, 0xec, 0x21, 0x45, 0x7b, 0xb8, 0x32, 0xa4, 0x87, 0xa7, 0x04, 0x67, 0x9b, 0x46, - 0x60, 0xbb, 0x0e, 0xef, 0xa9, 0xc0, 0x72, 0xd9, 0x9b, 0xb2, 0x09, 0x69, 0x32, 0x32, 0x74, 0x0d, - 0x26, 0x0d, 0xcb, 0xf2, 0xb0, 0xef, 0x73, 0x1a, 0x25, 0x8d, 0x28, 0x45, 0xba, 0x5a, 0x67, 0x71, - 0x3d, 0x04, 0xa0, 0x12, 0xa4, 0x3c, 0xe3, 0x05, 0x1d, 0xf7, 0x94, 0x4e, 0x1e, 0xd5, 0x9f, 0x52, - 0x90, 0xa7, 0x5c, 0xfd, 0x8e, 0xeb, 0xf8, 0x18, 0xad, 0x08, 0x8a, 0xcc, 0x1f, 0x57, 0x84, 0xa1, - 0xe2, 0x92, 0xdc, 0x1e, 0x26, 0x49, 0x45, 0x24, 0xc4, 0xb2, 0x46, 0x68, 0xf2, 0x60, 0xb8, 0x26, - 0x57, 0x87, 0x75, 0x31, 0x56, 0x94, 0x7f, 0x24, 0xae, 0xca, 0x1a, 0xa4, 0x6d, 0xc7, 0x0e, 0x38, - 0x8f, 0x85, 0x13, 0x78, 0x68, 0x35, 0xc7, 0x0e, 0xb6, 0x26, 0x74, 0x8a, 0x47, 0x73, 0x90, 0x31, - 0x9b, 0x5d, 0xe7, 0x7d, 0x4a, 0xa4, 0xb0, 0x35, 0xa1, 0xb3, 0x57, 0xe5, 0x13, 0x09, 0xd2, 0x04, - 0x88, 0x34, 0xe0, 0x56, 0x6d, 0xd8, 0x16, 0xef, 0xfd, 0x5c, 0x24, 0xf8, 0x2e, 0x6d, 0xa9, 0x6d, - 0xea, 0x53, 0x0c, 0x53, 0xb3, 0xd0, 0x0d, 0xc8, 0xf9, 0xf6, 0xa1, 0x63, 0x04, 0x5d, 0x0f, 0x73, - 0x75, 0x66, 0xe3, 0xd4, 0xea, 0x61, 0xa3, 0x3e, 0xc0, 0xa1, 0x57, 0x21, 0x2b, 0x88, 0x71, 0x2e, - 0x36, 0x7e, 0xce, 0x9b, 0x03, 0x36, 0x8a, 0x90, 0xe7, 0xe3, 0xe9, 0x18, 0x5e, 0xa0, 0xfe, 0x9e, - 0x02, 0xd8, 0xeb, 0x9e, 0xc2, 0xe0, 0x03, 0x50, 0x52, 0x0d, 0xfe, 0xb9, 0xcc, 0xe7, 0xf2, 0x75, - 0x61, 0x2e, 0x2f, 0x8f, 0x26, 0x71, 0xba, 0xa9, 0xfc, 0x2e, 0xa1, 0x53, 0x89, 0x16, 0xa1, 0x68, - 0xba, 0x1d, 0x1b, 0xfb, 0x0d, 0xa7, 0xdb, 0xde, 0xc7, 0x5e, 0x39, 0xbd, 0x20, 0x2d, 0x15, 0xf5, - 0x02, 0x0b, 0xee, 0xd0, 0xd8, 0xf1, 0xf9, 0xfe, 0x50, 0x86, 0x3c, 0x55, 0x61, 0xec, 0xfa, 0x8d, - 0xa1, 0x92, 0xbb, 0x7e, 0xd7, 0xf8, 0x94, 0xff, 0xc7, 0xa9, 0x51, 0xbf, 0x91, 0xa1, 0xb8, 0x89, - 0x5b, 0x38, 0xc0, 0xa1, 0xf3, 0x5f, 0x13, 0x84, 0xb8, 0x14, 0x13, 0x42, 0xc0, 0x25, 0xd5, 0xfc, - 0x8d, 0x33, 0x54, 0xf7, 0xeb, 0x30, 0xe5, 0xbe, 0x70, 0xb0, 0x47, 0x34, 0x93, 0x8f, 0x81, 0x77, - 0x49, 0x43, 0x6d, 0x53, 0x9f, 0xa4, 0x88, 0x9a, 0xa5, 0xfe, 0x22, 0xc1, 0x74, 0xa8, 0x04, 0xf7, - 0x4e, 0x55, 0x90, 0xac, 0x32, 0x44, 0xb2, 0xa4, 0xdb, 0x27, 0xcb, 0x54, 0x53, 0xbf, 0x92, 0x21, - 0x4f, 0x42, 0xa1, 0x19, 0x46, 0xaf, 0x8a, 0x18, 0x2a, 0xa9, 0x56, 0x30, 0xce, 0x60, 0x85, 0x79, - 0xc8, 0xb5, 0x0d, 0xdb, 0x69, 0xb8, 0x4e, 0xab, 0xcf, 0xb7, 0xfb, 0x29, 0x12, 0xd8, 0x75, 0x5a, - 0xfd, 0xf0, 0x14, 0x90, 0x8a, 0x9d, 0x02, 0xd2, 0x50, 0x60, 0x4a, 0x70, 0x2b, 0xac, 0x0a, 0x82, - 0x5d, 0x7c, 0x49, 0xb0, 0xa4, 0x1b, 0xe1, 0xef, 0x70, 0xef, 0xb8, 0x1e, 0x95, 0x5f, 0x69, 0x44, - 0xf9, 0xdd, 0x9a, 0x88, 0x0a, 0xf0, 0x36, 0x14, 0xfc, 0xa6, 0xeb, 0x05, 0x22, 0x89, 0xa5, 0x93, - 0xd8, 0x6b, 0x75, 0x92, 0x10, 0xf5, 0x94, 0xf7, 0x07, 0xaf, 0xca, 0x1f, 0x12, 0xe4, 0x63, 0xcd, - 0x68, 0x19, 0x26, 0x7b, 0xd8, 0xf3, 0x6d, 0xd7, 0xe1, 0x83, 0x39, 0x1f, 0xe7, 0xf6, 0x94, 0x35, - 0xe9, 0x21, 0x06, 0x5d, 0x81, 0x69, 0xd3, 0xc3, 0x94, 0x63, 0x03, 0x77, 0x5c, 0xb3, 0x49, 0xc7, - 0x93, 0xd6, 0x8b, 0x61, 0xf4, 0x2e, 0x09, 0x0a, 0xab, 0x3e, 0x35, 0x66, 0xd5, 0xa3, 0xb5, 0x68, - 0xf7, 0x20, 0xa7, 0x68, 0xba, 0xc1, 0x4c, 0x57, 0x67, 0x63, 0x04, 0x59, 0x6d, 0x7d, 0xdc, 0xef, - 0x60, 0x1d, 0xdc, 0xe8, 0x99, 0x8c, 0xa5, 0x63, 0xf4, 0x5b, 0xae, 0x61, 0x35, 0x5a, 0xd8, 0x39, - 0x0c, 0x9a, 0xe5, 0x0c, 0x1b, 0x0b, 0x8f, 0x3e, 0xa4, 0xc1, 0x8d, 0x2c, 0xa4, 0x89, 0x74, 0xea, - 0x9f, 0x69, 0x28, 0xd6, 0xb1, 0xe1, 0x99, 0xcd, 0xf1, 0xe5, 0x58, 0xc0, 0x25, 0x75, 0x0d, 0x7e, - 0x96, 0xe2, 0x7e, 0xba, 0x05, 0x05, 0xd3, 0x75, 0x02, 0xc3, 0xe6, 0x8a, 0x33, 0x3e, 0x33, 0x91, - 0xe2, 0x77, 0xc2, 0xc6, 0xda, 0xa6, 0x9e, 0x8f, 0x90, 0x35, 0x0b, 0xbd, 0x09, 0x99, 0xe7, 0x5d, - 0xec, 0xf5, 0x39, 0x8f, 0xc5, 0x13, 0x15, 0xd0, 0x1e, 0x11, 0xa8, 0xce, 0x32, 0x94, 0x2f, 0x64, - 0xc8, 0xd0, 0x00, 0x2a, 0x8b, 0x0e, 0x2a, 0x0e, 0xcc, 0xb2, 0x09, 0x93, 0x07, 0x76, 0x2b, 0xc0, - 0x9e, 0x5f, 0x96, 0x17, 0x52, 0x4b, 0xf9, 0xea, 0xb5, 0x53, 0x7c, 0x40, 0xbb, 0x47, 0x53, 0xf4, - 0x30, 0x55, 0xf9, 0x56, 0x82, 0x2c, 0x8b, 0xa1, 0x3a, 0x40, 0xdb, 0x08, 0xcc, 0x26, 0x33, 0x8a, - 0x44, 0x8d, 0x72, 0xf3, 0xf4, 0x7d, 0x6a, 0xdb, 0x24, 0x99, 0xfa, 0x28, 0xd7, 0x0e, 0x1f, 0x11, - 0x82, 0xb4, 0x63, 0xb4, 0xd9, 0xe1, 0x29, 0xa7, 0xd3, 0x67, 0x34, 0x03, 0x99, 0x9e, 0xd1, 0xea, - 0x62, 0x3a, 0x3d, 0x39, 0x9d, 0xbd, 0xa8, 0xab, 0x90, 0x8b, 0x7a, 0x40, 0xe7, 0xa0, 0xb8, 0xbd, - 0xfe, 0xf8, 0xce, 0x56, 0xe3, 0xc9, 0xce, 0x83, 0x9d, 0xdd, 0x77, 0x77, 0x4a, 0x13, 0xa8, 0x04, - 0x85, 0xfa, 0x63, 0xbd, 0xb6, 0x73, 0xbf, 0x71, 0xf7, 0xd1, 0x93, 0xf5, 0x87, 0x25, 0x49, 0xfd, - 0x48, 0x86, 0xe9, 0x70, 0x50, 0x63, 0x37, 0x34, 0x11, 0x98, 0xdc, 0x3a, 0x56, 0x1d, 0xd4, 0x7e, - 0xdb, 0x6a, 0xb4, 0x6c, 0x9f, 0x9c, 0x82, 0x53, 0xc3, 0x4f, 0x43, 0x59, 0xdb, 0x7a, 0x68, 0xfb, - 0x81, 0x7a, 0x0b, 0x32, 0xba, 0xe1, 0x1c, 0x62, 0x34, 0x07, 0x59, 0xf7, 0xe0, 0xc0, 0xc7, 0xec, - 0xe4, 0x9c, 0xd6, 0xf9, 0x1b, 0x89, 0xf3, 0x45, 0xcc, 0x0a, 0x0a, 0x7f, 0x53, 0xbf, 0x96, 0xe1, - 0x7f, 0xe4, 0x76, 0x44, 0x92, 0xc3, 0x75, 0x7b, 0x43, 0x90, 0xf0, 0xf2, 0xb1, 0x7b, 0x54, 0x0c, - 0x99, 0xd4, 0x95, 0xfb, 0xec, 0x0c, 0xbb, 0xe7, 0x55, 0xc8, 0x78, 0x84, 0x5a, 0x74, 0x8a, 0x1a, - 0xb0, 0x66, 0x94, 0x59, 0xb3, 0xfa, 0x97, 0x04, 0xa5, 0x81, 0x0c, 0xdc, 0x74, 0x37, 0x05, 0xc5, - 0x16, 0x86, 0x2a, 0x96, 0x74, 0xdb, 0x5d, 0xe4, 0xa2, 0xcd, 0x84, 0x57, 0x28, 0x42, 0xa6, 0xc0, - 0x2f, 0x50, 0xea, 0x8f, 0x32, 0x9c, 0x0f, 0xb9, 0x6c, 0x19, 0x7e, 0x54, 0xe3, 0x6f, 0x09, 0xcc, - 0x17, 0x87, 0x30, 0x8f, 0xa1, 0x93, 0xea, 0x97, 0xce, 0x19, 0xfc, 0xb2, 0x04, 0x59, 0x6a, 0x88, - 0xb0, 0xf6, 0xbe, 0x6c, 0x18, 0xde, 0x4e, 0x0a, 0xa0, 0x6f, 0xb4, 0x02, 0x3a, 0xc0, 0x82, 0x4e, - 0x9f, 0xd5, 0x0f, 0x64, 0x98, 0x11, 0x05, 0xe2, 0x4e, 0x7a, 0x43, 0xd0, 0xf3, 0x95, 0x91, 0x7a, - 0x26, 0xdd, 0x4d, 0x8b, 0x5c, 0xd2, 0x79, 0xc8, 0x35, 0x0d, 0xbf, 0x39, 0x28, 0x63, 0x05, 0x7d, - 0x8a, 0x04, 0x48, 0xd5, 0xaa, 0xfe, 0x90, 0x82, 0xc9, 0x3a, 0xeb, 0x1c, 0xad, 0x41, 0xea, 0x3e, - 0x0e, 0xd0, 0xec, 0xd0, 0xff, 0x71, 0xca, 0xdc, 0xf0, 0x9f, 0x39, 0xab, 0x12, 0xc9, 0xdb, 0xeb, - 0x8a, 0x79, 0x83, 0x3f, 0x04, 0x42, 0x5e, 0xec, 0x32, 0xbc, 0x24, 0xa1, 0xb7, 0x20, 0xcb, 0x6e, - 0x38, 0xa8, 0x3c, 0xea, 0x9e, 0xa8, 0xfc, 0x7f, 0xe4, 0x75, 0x88, 0xf8, 0x9e, 0x30, 0x45, 0x73, - 0xc3, 0xef, 0x15, 0xca, 0x85, 0x11, 0x07, 0x48, 0x74, 0x1b, 0xb2, 0x6c, 0x23, 0x12, 0xbe, 0x2b, - 0xec, 0xac, 0xc2, 0x77, 0xc5, 0x5d, 0x6b, 0x55, 0x42, 0x77, 0x61, 0x2a, 0xb4, 0x02, 0x52, 0x46, - 0xd7, 0x66, 0x65, 0xfe, 0x84, 0x2a, 0xb4, 0x2a, 0xa1, 0x5d, 0x28, 0xc4, 0x1d, 0x85, 0x2a, 0x27, - 0x2f, 0x5d, 0xe5, 0xf2, 0x18, 0x2b, 0x6e, 0xec, 0x7d, 0x7f, 0x54, 0x91, 0x7e, 0x3e, 0xaa, 0x48, - 0xbf, 0x1e, 0x55, 0xa4, 0x4f, 0x7f, 0xab, 0x4c, 0x3c, 0xbb, 0x7e, 0x68, 0x07, 0xcd, 0xee, 0xbe, - 0x66, 0xba, 0xed, 0x15, 0xc7, 0xef, 0x98, 0xe6, 0xb2, 0x85, 0x7b, 0x2b, 0x0e, 0x76, 0x0f, 0xfc, - 0x65, 0xa3, 0x63, 0x2f, 0x1f, 0xba, 0x2b, 0xd1, 0x6f, 0xdf, 0x2f, 0xe5, 0xd2, 0x0e, 0x76, 0xef, - 0xd5, 0xb5, 0xf5, 0xbd, 0x1a, 0xdf, 0xde, 0xf6, 0xb3, 0xf4, 0xff, 0xed, 0x8d, 0x7f, 0x03, 0x00, - 0x00, 0xff, 0xff, 0x6e, 0xcf, 0x5c, 0x4e, 0x41, 0x16, 0x00, 0x00, +var fileDescriptor_6233c87a2945599e = []byte{ + // 1401 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x59, 0xcd, 0x72, 0xdb, 0x54, + 0x14, 0x8e, 0xe4, 0x9f, 0xc4, 0xc7, 0x76, 0x30, 0xb7, 0xa5, 0xf5, 0xa8, 0x6d, 0x48, 0xd5, 0xa6, + 0xcd, 0xb4, 0x44, 0x4e, 0x0d, 0xa5, 0xb4, 0xa5, 0x85, 0xa4, 0x49, 0x1b, 0x4f, 0x1a, 0x27, 0xbd, + 0x4e, 0xcb, 0x4c, 0x67, 0x18, 0x8f, 0x22, 0x5d, 0xc7, 0x02, 0x5b, 0x72, 0x25, 0xd9, 0x1d, 0x6f, + 0x58, 0xc1, 0x82, 0x37, 0xe8, 0xb0, 0x00, 0xa6, 0xcb, 0xc2, 0x86, 0x3d, 0xc3, 0xb0, 0x84, 0x5d, + 0xe1, 0x09, 0x98, 0xf0, 0x00, 0x7d, 0x03, 0x86, 0xb9, 0x3f, 0xb2, 0xad, 0xd4, 0x7f, 0x64, 0x67, + 0x76, 0xd2, 0xd1, 0x77, 0x8e, 0xcf, 0xf9, 0xee, 0xa7, 0x73, 0xee, 0x95, 0xe1, 0x64, 0x2b, 0x9f, + 0x73, 0xf6, 0x3e, 0x23, 0x86, 0x9f, 0xf3, 0x88, 0xdb, 0xb2, 0x0c, 0xa2, 0x35, 0x5c, 0xc7, 0x77, + 0x50, 0xc6, 0x26, 0x8e, 0x56, 0xf1, 0xb4, 0x56, 0x5e, 0xe3, 0xcf, 0x95, 0xb7, 0xba, 0x50, 0xbf, + 0xdd, 0x20, 0x1e, 0x07, 0x2a, 0xc7, 0x5a, 0xf9, 0x9c, 0x4b, 0x2a, 0x5e, 0xc8, 0x48, 0xb1, 0x22, + 0x5e, 0xae, 0x4e, 0x7c, 0x5d, 0x98, 0x4f, 0xf6, 0x98, 0x5b, 0xc4, 0xb5, 0x2a, 0x6d, 0xfe, 0x40, + 0x7d, 0x21, 0x03, 0xdc, 0x23, 0x3e, 0x26, 0x4f, 0x9a, 0xc4, 0xf3, 0xd1, 0x55, 0x88, 0xee, 0x39, + 0x66, 0x3b, 0x2b, 0xcd, 0x4b, 0x8b, 0xc9, 0xfc, 0x59, 0xed, 0x70, 0x2e, 0x5a, 0x17, 0xab, 0xad, + 0x3a, 0x66, 0x1b, 0x33, 0x38, 0x5a, 0x87, 0x24, 0xfd, 0xb1, 0x72, 0x95, 0xe8, 0x26, 0x71, 0xb3, + 0x32, 0xf3, 0x3e, 0xdf, 0xe3, 0x1d, 0x94, 0x28, 0x7c, 0xb7, 0x88, 0xaf, 0x6f, 0x30, 0x2c, 0x86, + 0x7a, 0xe7, 0x1a, 0x3d, 0x80, 0x34, 0x4f, 0x2e, 0x08, 0x14, 0x61, 0x81, 0xde, 0x19, 0x1c, 0xe8, + 0x11, 0x85, 0x5b, 0x86, 0xee, 0x5b, 0x8e, 0x2d, 0x02, 0xa6, 0x78, 0x08, 0x7e, 0xa7, 0x6c, 0x42, + 0x94, 0xe6, 0x89, 0xae, 0xc0, 0xb4, 0x6e, 0x9a, 0x2e, 0xf1, 0x3c, 0x51, 0xdb, 0xc9, 0x9e, 0xa0, + 0x94, 0x45, 0x6d, 0x85, 0x3f, 0xc6, 0x01, 0x0e, 0x65, 0x20, 0xe2, 0xea, 0x4f, 0x59, 0x31, 0x33, + 0x98, 0x5e, 0xaa, 0xff, 0x44, 0x20, 0xc9, 0x08, 0xf0, 0x1a, 0x8e, 0xed, 0x11, 0xf4, 0x7e, 0x88, + 0x2d, 0x75, 0x00, 0x5b, 0x1c, 0xdc, 0x4b, 0xd7, 0xdd, 0x7e, 0x74, 0x2d, 0xf4, 0xad, 0x92, 0x3b, + 0x0f, 0xe0, 0x0b, 0xf7, 0xe7, 0x6b, 0x69, 0x48, 0xa4, 0x91, 0x84, 0x7d, 0x23, 0x0b, 0xc6, 0x6e, + 0x41, 0xd4, 0xb2, 0x2d, 0x5f, 0x14, 0x77, 0x71, 0x74, 0x71, 0x5a, 0xc1, 0xb6, 0xfc, 0x8d, 0x29, + 0xcc, 0xdc, 0xd0, 0x09, 0x88, 0x19, 0xd5, 0xa6, 0xfd, 0x39, 0xab, 0x2e, 0xb5, 0x31, 0x85, 0xf9, + 0xad, 0xf2, 0x83, 0x04, 0x51, 0x0a, 0x44, 0x57, 0x21, 0xc1, 0x03, 0x95, 0x2d, 0x53, 0xfc, 0x48, + 0xf6, 0xf0, 0x9a, 0x6c, 0x33, 0x40, 0x61, 0x0d, 0xcf, 0x70, 0x68, 0xc1, 0x44, 0x37, 0x20, 0xe1, + 0x59, 0xfb, 0xb6, 0xee, 0x37, 0x5d, 0x22, 0x98, 0x3b, 0xdd, 0xa7, 0xde, 0x52, 0x80, 0xc1, 0x5d, + 0x38, 0x5a, 0x86, 0x78, 0x88, 0xa8, 0xec, 0xeb, 0x45, 0x09, 0x4e, 0x04, 0x6e, 0x35, 0x0d, 0x49, + 0x91, 0x64, 0x43, 0x77, 0x7d, 0xf5, 0xdb, 0x28, 0xc0, 0x4e, 0x73, 0xfc, 0xb7, 0xa5, 0x8b, 0x9d, + 0x8c, 0xb7, 0xe5, 0x97, 0x60, 0xf1, 0x3f, 0x0c, 0x2d, 0xfe, 0x85, 0x91, 0x95, 0x8d, 0xb7, 0xf6, + 0x2f, 0x27, 0x69, 0xed, 0xd1, 0x39, 0x48, 0x1b, 0x4e, 0xc3, 0x22, 0x5e, 0xd9, 0x6e, 0xd6, 0xf7, + 0x88, 0x9b, 0x8d, 0xce, 0x4b, 0x8b, 0x69, 0x9c, 0xe2, 0xc6, 0x22, 0xb3, 0x1d, 0x16, 0xc8, 0xf7, + 0x32, 0x24, 0x19, 0x35, 0xe3, 0x76, 0x88, 0x1e, 0xf0, 0xa4, 0x74, 0x88, 0x5b, 0x42, 0x23, 0x47, + 0x5b, 0x44, 0xf5, 0x4f, 0x19, 0xd2, 0x6b, 0xa4, 0x46, 0x7c, 0x12, 0xbc, 0x46, 0x1f, 0x84, 0x48, + 0x3a, 0xff, 0x3a, 0x49, 0x21, 0xf8, 0x64, 0xbc, 0x49, 0xf5, 0xa3, 0xcf, 0x9d, 0x3c, 0xcc, 0x38, + 0x4f, 0x6d, 0xe2, 0x52, 0x5a, 0xe5, 0xfe, 0x3e, 0xdb, 0xf4, 0x79, 0x61, 0x0d, 0x4f, 0x33, 0x60, + 0xc1, 0x54, 0x5f, 0x49, 0x30, 0x1b, 0xb0, 0x24, 0xa4, 0x77, 0x3d, 0xc4, 0xea, 0xc2, 0x60, 0x56, + 0x27, 0x4b, 0x7d, 0x71, 0x4e, 0xac, 0xfa, 0xbb, 0x0c, 0x49, 0x6a, 0x0a, 0x44, 0x34, 0xf2, 0x4d, + 0xeb, 0x01, 0x4f, 0x86, 0x84, 0xaa, 0x47, 0x97, 0xd0, 0x29, 0x48, 0xd4, 0x75, 0xcb, 0x2e, 0x3b, + 0x76, 0xad, 0x2d, 0x36, 0x30, 0x33, 0xd4, 0xb0, 0x6d, 0xd7, 0xda, 0xc1, 0xbe, 0x26, 0xd2, 0xdd, + 0xd7, 0x7c, 0x15, 0x83, 0x14, 0xa7, 0x47, 0x68, 0xe7, 0x5a, 0x88, 0xcc, 0x73, 0x83, 0xc8, 0x9c, + 0x2c, 0xe5, 0x7c, 0x17, 0x11, 0x84, 0xe6, 0x3b, 0xa3, 0x40, 0x1a, 0x3e, 0x0a, 0x36, 0xa6, 0x3a, + 0xc3, 0x60, 0x17, 0x52, 0x5e, 0xd5, 0x71, 0xfd, 0x70, 0x65, 0xb9, 0x31, 0x98, 0xd1, 0x4a, 0xd4, + 0xaf, 0x13, 0x30, 0xe9, 0x75, 0x6f, 0x95, 0x2f, 0x65, 0x48, 0xf6, 0x3c, 0x46, 0xef, 0xc1, 0x74, + 0x8b, 0xb8, 0x9e, 0xe5, 0xd8, 0x22, 0x35, 0xa5, 0x4f, 0xc1, 0x8f, 0x38, 0x02, 0x07, 0x50, 0xb4, + 0x00, 0xb3, 0x86, 0x4b, 0x58, 0xe1, 0x65, 0xd2, 0x70, 0x8c, 0x2a, 0xcb, 0x2e, 0x8a, 0xd3, 0x81, + 0x75, 0x9d, 0x1a, 0x43, 0x7d, 0x25, 0x32, 0x5e, 0x5f, 0x41, 0xb7, 0x3a, 0xe3, 0x8d, 0x1e, 0x32, + 0xd8, 0x04, 0x9c, 0x0d, 0xcd, 0x5c, 0x51, 0x35, 0xef, 0xf3, 0xbb, 0xed, 0x06, 0xc1, 0xe0, 0x74, + 0xae, 0x69, 0x66, 0x0d, 0xbd, 0x5d, 0x73, 0x74, 0xb3, 0x5c, 0x23, 0xf6, 0xbe, 0x5f, 0xcd, 0xc6, + 0x78, 0x66, 0xc2, 0x7a, 0x9f, 0x19, 0x57, 0xe3, 0x10, 0xa5, 0xb4, 0xaa, 0xcf, 0x63, 0x90, 0x2e, + 0x11, 0xdd, 0x35, 0xaa, 0x63, 0x8f, 0x86, 0x10, 0x7c, 0x32, 0xde, 0xeb, 0x9f, 0x03, 0x1d, 0xde, + 0x86, 0x94, 0xe1, 0xd8, 0xbe, 0x6e, 0x89, 0x45, 0xe1, 0x45, 0x9e, 0x3a, 0xbc, 0x28, 0x77, 0x02, + 0x4c, 0x61, 0x0d, 0x27, 0x3b, 0x0e, 0x05, 0x13, 0x7d, 0x0c, 0xb1, 0x27, 0x4d, 0xe2, 0xb6, 0x45, + 0x71, 0x97, 0xc6, 0x61, 0x47, 0x7b, 0x40, 0x3d, 0x30, 0x77, 0x54, 0x7e, 0x92, 0x21, 0xc6, 0x0c, + 0x28, 0x1b, 0x56, 0x5e, 0xba, 0xab, 0xae, 0x4d, 0x98, 0xae, 0x58, 0x35, 0x9f, 0xb8, 0x5e, 0x56, + 0x9e, 0x8f, 0x2c, 0x26, 0xf3, 0x57, 0xc6, 0xff, 0x1d, 0xed, 0x2e, 0xf3, 0xc4, 0x41, 0x04, 0xe5, + 0x57, 0x09, 0xe2, 0xdc, 0x86, 0x1e, 0x03, 0xd4, 0x75, 0xdf, 0xa8, 0x72, 0x65, 0x49, 0x4c, 0x59, + 0x37, 0xff, 0x73, 0x68, 0x6d, 0x8b, 0xc6, 0x60, 0xc2, 0x4b, 0xd4, 0x83, 0x4b, 0x84, 0x20, 0x6a, + 0xeb, 0x75, 0xbe, 0x47, 0x4c, 0x60, 0x76, 0x8d, 0x8e, 0x43, 0xac, 0xa5, 0xd7, 0x9a, 0x84, 0xad, + 0x60, 0x02, 0xf3, 0x1b, 0x75, 0x19, 0x12, 0x9d, 0x08, 0xe8, 0x4d, 0x48, 0x6f, 0xad, 0xec, 0xde, + 0xd9, 0x28, 0x3f, 0x2c, 0x6e, 0x16, 0xb7, 0x3f, 0x29, 0x66, 0xa6, 0x50, 0x06, 0x52, 0xa5, 0x5d, + 0x5c, 0x28, 0xde, 0x2b, 0xaf, 0x3f, 0x78, 0xb8, 0x72, 0x3f, 0x23, 0xa9, 0xcf, 0x65, 0x98, 0x0d, + 0x92, 0x1a, 0x77, 0xd4, 0x86, 0xf1, 0x93, 0xd2, 0x30, 0xaf, 0x77, 0x07, 0x90, 0x65, 0x96, 0x6b, + 0x96, 0x47, 0xcf, 0x03, 0x91, 0xa1, 0xdb, 0xbc, 0xb8, 0x65, 0xde, 0xb7, 0x3c, 0x5f, 0xbd, 0x06, + 0x31, 0xac, 0xdb, 0xfb, 0x04, 0x9d, 0x80, 0xb8, 0x53, 0xa9, 0x78, 0x84, 0x1f, 0x25, 0xa2, 0x58, + 0xdc, 0x51, 0xbb, 0xe8, 0x08, 0xbc, 0x57, 0x89, 0x3b, 0xf5, 0x0f, 0x19, 0xde, 0xa0, 0x07, 0x4b, + 0xea, 0x1c, 0x34, 0x81, 0x1b, 0x21, 0x7a, 0x2f, 0xf4, 0x3f, 0x89, 0xf6, 0x38, 0xfc, 0xef, 0xc7, + 0xfb, 0x12, 0xc4, 0x5c, 0x5a, 0x6f, 0x9f, 0xed, 0xa1, 0x60, 0x84, 0xd3, 0xc1, 0x51, 0xea, 0xd7, + 0x32, 0x64, 0xba, 0x14, 0x09, 0xcd, 0xde, 0x0c, 0x91, 0x7a, 0x71, 0x18, 0xa9, 0x93, 0xa5, 0xda, + 0xd3, 0x82, 0xd7, 0xe3, 0xc1, 0x21, 0x94, 0x56, 0x98, 0x12, 0x47, 0x50, 0xf5, 0x95, 0x0c, 0xc7, + 0x82, 0xca, 0x36, 0x74, 0xaf, 0x33, 0x68, 0x6e, 0x87, 0xe8, 0xb8, 0x34, 0x98, 0x8e, 0x1e, 0xa7, + 0xc9, 0xd0, 0xd9, 0x17, 0x47, 0xd7, 0x59, 0x0e, 0xe2, 0x4c, 0x41, 0x41, 0xe7, 0x1f, 0x28, 0x34, + 0x01, 0xa3, 0x7d, 0xd7, 0xd3, 0x6b, 0x3e, 0xcb, 0x3a, 0x85, 0xd9, 0xb5, 0xfa, 0x4c, 0x86, 0xe3, + 0x61, 0xf2, 0x84, 0x02, 0x3f, 0x0a, 0x51, 0x7e, 0x79, 0x14, 0xe5, 0x93, 0xa5, 0xc2, 0x73, 0x82, + 0xf5, 0x53, 0x90, 0xa8, 0xea, 0x5e, 0xb5, 0xdb, 0x3d, 0x53, 0x78, 0x86, 0x1a, 0x68, 0x97, 0xcc, + 0xff, 0x18, 0x85, 0xe9, 0x12, 0x8f, 0x8c, 0xd6, 0x20, 0x72, 0x8f, 0xf8, 0xe8, 0xf4, 0xb0, 0x4f, + 0xae, 0xca, 0x99, 0xa1, 0x5f, 0xe1, 0x96, 0x25, 0x1a, 0x65, 0xa7, 0xd9, 0x37, 0x4a, 0xf7, 0x83, + 0x4d, 0xbf, 0x28, 0x3d, 0x9f, 0x21, 0x16, 0x25, 0xb4, 0x09, 0x71, 0x7e, 0x38, 0x44, 0x6f, 0x8f, + 0x38, 0x8c, 0x2b, 0xf3, 0xa3, 0xce, 0x95, 0x68, 0x1d, 0xa2, 0x94, 0x13, 0x74, 0x66, 0xe8, 0x91, + 0x4c, 0x99, 0x1b, 0xbe, 0x95, 0x46, 0x5b, 0x10, 0xe7, 0x53, 0xb4, 0x5f, 0x4e, 0xa1, 0x4d, 0x42, + 0xbf, 0x9c, 0xc2, 0x03, 0x78, 0x59, 0x42, 0x25, 0x98, 0x09, 0xe4, 0x85, 0xce, 0x8e, 0x9c, 0x28, + 0x8a, 0x3a, 0xba, 0x3f, 0x2e, 0x4b, 0xe8, 0x53, 0x48, 0xf5, 0x6a, 0x16, 0x2d, 0x8c, 0xd5, 0x46, + 0x94, 0x0b, 0xe3, 0x49, 0x7f, 0x75, 0xe7, 0xb7, 0x83, 0x39, 0xe9, 0xe5, 0xc1, 0x9c, 0xf4, 0xd7, + 0xc1, 0x9c, 0xf4, 0xec, 0xef, 0xb9, 0xa9, 0xc7, 0x97, 0xf7, 0x2d, 0xbf, 0xda, 0xdc, 0xd3, 0x0c, + 0xa7, 0x9e, 0xb3, 0xbd, 0x86, 0x61, 0x2c, 0x99, 0xa4, 0x95, 0xb3, 0x89, 0x53, 0xf1, 0x96, 0xf4, + 0x86, 0xb5, 0xb4, 0xef, 0xe4, 0x3a, 0xff, 0x1d, 0xbc, 0x90, 0x33, 0x45, 0xe2, 0xdc, 0x2d, 0x69, + 0x2b, 0x3b, 0x05, 0x31, 0xb0, 0xf7, 0xe2, 0xec, 0x4f, 0x80, 0x77, 0xff, 0x0d, 0x00, 0x00, 0xff, + 0xff, 0xbb, 0xcd, 0x0d, 0x36, 0x8d, 0x18, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -2428,13 +2429,13 @@ const _ = grpc.SupportPackageIsVersion4 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type ServiceClient interface { - // Get the object from container.v2. Response uses gRPC stream. First response + // Get the object from container. Response uses gRPC stream. First response // message carry object of requested address. Chunk messages are parts of // the object's payload if it is needed. All messages except first carry // chunks. Requested object can be restored by concatenation of object // message payload and all chunks keeping receiving order. Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (Service_GetClient, error) - // Put the object into container.v2. Request uses gRPC stream. First message + // Put the object into container. Request uses gRPC stream. First message // SHOULD BE type of PutHeader. Container id and Owner id of object SHOULD // BE set. Session token SHOULD BE obtained before put operation (see // session package). Chunk messages considered by server as part of object @@ -2447,7 +2448,7 @@ type ServiceClient interface { // response has system header only. If full headers flag is set, extended // headers are also present. Head(ctx context.Context, in *HeadRequest, opts ...grpc.CallOption) (*HeadResponse, error) - // Search objects in container.v2. Version of query language format SHOULD BE + // Search objects in container. Version of query language format SHOULD BE // set to 1. Search query represented in serialized format (see query // package). Search(ctx context.Context, in *SearchRequest, opts ...grpc.CallOption) (Service_SearchClient, error) @@ -2471,7 +2472,7 @@ func NewServiceClient(cc *grpc.ClientConn) ServiceClient { } func (c *serviceClient) Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (Service_GetClient, error) { - stream, err := c.cc.NewStream(ctx, &_Service_serviceDesc.Streams[0], "/object.v2.Service/Get", opts...) + stream, err := c.cc.NewStream(ctx, &_Service_serviceDesc.Streams[0], "/neo.fs.v2.object.Service/Get", opts...) if err != nil { return nil, err } @@ -2503,7 +2504,7 @@ func (x *serviceGetClient) Recv() (*GetResponse, error) { } func (c *serviceClient) Put(ctx context.Context, opts ...grpc.CallOption) (Service_PutClient, error) { - stream, err := c.cc.NewStream(ctx, &_Service_serviceDesc.Streams[1], "/object.v2.Service/Put", opts...) + stream, err := c.cc.NewStream(ctx, &_Service_serviceDesc.Streams[1], "/neo.fs.v2.object.Service/Put", opts...) if err != nil { return nil, err } @@ -2538,7 +2539,7 @@ func (x *servicePutClient) CloseAndRecv() (*PutResponse, error) { func (c *serviceClient) Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteResponse, error) { out := new(DeleteResponse) - err := c.cc.Invoke(ctx, "/object.v2.Service/Delete", in, out, opts...) + err := c.cc.Invoke(ctx, "/neo.fs.v2.object.Service/Delete", in, out, opts...) if err != nil { return nil, err } @@ -2547,7 +2548,7 @@ func (c *serviceClient) Delete(ctx context.Context, in *DeleteRequest, opts ...g func (c *serviceClient) Head(ctx context.Context, in *HeadRequest, opts ...grpc.CallOption) (*HeadResponse, error) { out := new(HeadResponse) - err := c.cc.Invoke(ctx, "/object.v2.Service/Head", in, out, opts...) + err := c.cc.Invoke(ctx, "/neo.fs.v2.object.Service/Head", in, out, opts...) if err != nil { return nil, err } @@ -2555,7 +2556,7 @@ func (c *serviceClient) Head(ctx context.Context, in *HeadRequest, opts ...grpc. } func (c *serviceClient) Search(ctx context.Context, in *SearchRequest, opts ...grpc.CallOption) (Service_SearchClient, error) { - stream, err := c.cc.NewStream(ctx, &_Service_serviceDesc.Streams[2], "/object.v2.Service/Search", opts...) + stream, err := c.cc.NewStream(ctx, &_Service_serviceDesc.Streams[2], "/neo.fs.v2.object.Service/Search", opts...) if err != nil { return nil, err } @@ -2587,7 +2588,7 @@ func (x *serviceSearchClient) Recv() (*SearchResponse, error) { } func (c *serviceClient) GetRange(ctx context.Context, in *GetRangeRequest, opts ...grpc.CallOption) (Service_GetRangeClient, error) { - stream, err := c.cc.NewStream(ctx, &_Service_serviceDesc.Streams[3], "/object.v2.Service/GetRange", opts...) + stream, err := c.cc.NewStream(ctx, &_Service_serviceDesc.Streams[3], "/neo.fs.v2.object.Service/GetRange", opts...) if err != nil { return nil, err } @@ -2620,7 +2621,7 @@ func (x *serviceGetRangeClient) Recv() (*GetRangeResponse, error) { func (c *serviceClient) GetRangeHash(ctx context.Context, in *GetRangeHashRequest, opts ...grpc.CallOption) (*GetRangeHashResponse, error) { out := new(GetRangeHashResponse) - err := c.cc.Invoke(ctx, "/object.v2.Service/GetRangeHash", in, out, opts...) + err := c.cc.Invoke(ctx, "/neo.fs.v2.object.Service/GetRangeHash", in, out, opts...) if err != nil { return nil, err } @@ -2629,13 +2630,13 @@ func (c *serviceClient) GetRangeHash(ctx context.Context, in *GetRangeHashReques // ServiceServer is the server API for Service service. type ServiceServer interface { - // Get the object from container.v2. Response uses gRPC stream. First response + // Get the object from container. Response uses gRPC stream. First response // message carry object of requested address. Chunk messages are parts of // the object's payload if it is needed. All messages except first carry // chunks. Requested object can be restored by concatenation of object // message payload and all chunks keeping receiving order. Get(*GetRequest, Service_GetServer) error - // Put the object into container.v2. Request uses gRPC stream. First message + // Put the object into container. Request uses gRPC stream. First message // SHOULD BE type of PutHeader. Container id and Owner id of object SHOULD // BE set. Session token SHOULD BE obtained before put operation (see // session package). Chunk messages considered by server as part of object @@ -2648,7 +2649,7 @@ type ServiceServer interface { // response has system header only. If full headers flag is set, extended // headers are also present. Head(context.Context, *HeadRequest) (*HeadResponse, error) - // Search objects in container.v2. Version of query language format SHOULD BE + // Search objects in container. Version of query language format SHOULD BE // set to 1. Search query represented in serialized format (see query // package). Search(*SearchRequest, Service_SearchServer) error @@ -2750,7 +2751,7 @@ func _Service_Delete_Handler(srv interface{}, ctx context.Context, dec func(inte } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/object.v2.Service/Delete", + FullMethod: "/neo.fs.v2.object.Service/Delete", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ServiceServer).Delete(ctx, req.(*DeleteRequest)) @@ -2768,7 +2769,7 @@ func _Service_Head_Handler(srv interface{}, ctx context.Context, dec func(interf } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/object.v2.Service/Head", + FullMethod: "/neo.fs.v2.object.Service/Head", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ServiceServer).Head(ctx, req.(*HeadRequest)) @@ -2828,7 +2829,7 @@ func _Service_GetRangeHash_Handler(srv interface{}, ctx context.Context, dec fun } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/object.v2.Service/GetRangeHash", + FullMethod: "/neo.fs.v2.object.Service/GetRangeHash", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ServiceServer).GetRangeHash(ctx, req.(*GetRangeHashRequest)) @@ -2837,7 +2838,7 @@ func _Service_GetRangeHash_Handler(srv interface{}, ctx context.Context, dec fun } var _Service_serviceDesc = grpc.ServiceDesc{ - ServiceName: "object.v2.Service", + ServiceName: "neo.fs.v2.object.Service", HandlerType: (*ServiceServer)(nil), Methods: []grpc.MethodDesc{ { @@ -2875,7 +2876,7 @@ var _Service_serviceDesc = grpc.ServiceDesc{ ServerStreams: true, }, }, - Metadata: "object/v2/service.proto", + Metadata: "v2/object/service.proto", } func (m *GetRequest) Marshal() (dAtA []byte, err error) { @@ -5722,7 +5723,7 @@ func (m *GetRequest) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.MetaHeader == nil { - m.MetaHeader = &v2.RequestMetaHeader{} + m.MetaHeader = &service.RequestMetaHeader{} } if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -5758,7 +5759,7 @@ func (m *GetRequest) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.VerifyHeader == nil { - m.VerifyHeader = &v2.RequestVerificationHeader{} + m.VerifyHeader = &service.RequestVerificationHeader{} } if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -5848,7 +5849,7 @@ func (m *GetRequest_Body) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.Address == nil { - m.Address = &v21.Address{} + m.Address = &refs.Address{} } if err := m.Address.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -5994,7 +5995,7 @@ func (m *GetResponse) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.MetaHeader == nil { - m.MetaHeader = &v2.ResponseMetaHeader{} + m.MetaHeader = &service.ResponseMetaHeader{} } if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -6030,7 +6031,7 @@ func (m *GetResponse) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.VerifyHeader == nil { - m.VerifyHeader = &v2.ResponseVerificationHeader{} + m.VerifyHeader = &service.ResponseVerificationHeader{} } if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -6242,7 +6243,7 @@ func (m *GetResponse_Body_Init) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.ObjectId == nil { - m.ObjectId = &v21.ObjectID{} + m.ObjectId = &refs.ObjectID{} } if err := m.ObjectId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -6278,7 +6279,7 @@ func (m *GetResponse_Body_Init) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.Signature == nil { - m.Signature = &v2.Signature{} + m.Signature = &service.Signature{} } if err := m.Signature.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -6440,7 +6441,7 @@ func (m *PutRequest) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.MetaHeader == nil { - m.MetaHeader = &v2.RequestMetaHeader{} + m.MetaHeader = &service.RequestMetaHeader{} } if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -6476,7 +6477,7 @@ func (m *PutRequest) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.VerifyHeader == nil { - m.VerifyHeader = &v2.RequestVerificationHeader{} + m.VerifyHeader = &service.RequestVerificationHeader{} } if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -6688,7 +6689,7 @@ func (m *PutRequest_Body_Init) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.ObjectId == nil { - m.ObjectId = &v21.ObjectID{} + m.ObjectId = &refs.ObjectID{} } if err := m.ObjectId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -6724,7 +6725,7 @@ func (m *PutRequest_Body_Init) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.Signature == nil { - m.Signature = &v2.Signature{} + m.Signature = &service.Signature{} } if err := m.Signature.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -6905,7 +6906,7 @@ func (m *PutResponse) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.MetaHeader == nil { - m.MetaHeader = &v2.ResponseMetaHeader{} + m.MetaHeader = &service.ResponseMetaHeader{} } if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -6941,7 +6942,7 @@ func (m *PutResponse) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.VerifyHeader == nil { - m.VerifyHeader = &v2.ResponseVerificationHeader{} + m.VerifyHeader = &service.ResponseVerificationHeader{} } if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -7031,7 +7032,7 @@ func (m *PutResponse_Body) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.ObjectId == nil { - m.ObjectId = &v21.ObjectID{} + m.ObjectId = &refs.ObjectID{} } if err := m.ObjectId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -7157,7 +7158,7 @@ func (m *DeleteRequest) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.MetaHeader == nil { - m.MetaHeader = &v2.RequestMetaHeader{} + m.MetaHeader = &service.RequestMetaHeader{} } if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -7193,7 +7194,7 @@ func (m *DeleteRequest) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.VerifyHeader == nil { - m.VerifyHeader = &v2.RequestVerificationHeader{} + m.VerifyHeader = &service.RequestVerificationHeader{} } if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -7283,7 +7284,7 @@ func (m *DeleteRequest_Body) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.Address == nil { - m.Address = &v21.Address{} + m.Address = &refs.Address{} } if err := m.Address.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -7319,7 +7320,7 @@ func (m *DeleteRequest_Body) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.OwnerId == nil { - m.OwnerId = &v21.OwnerID{} + m.OwnerId = &refs.OwnerID{} } if err := m.OwnerId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -7445,7 +7446,7 @@ func (m *DeleteResponse) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.MetaHeader == nil { - m.MetaHeader = &v2.ResponseMetaHeader{} + m.MetaHeader = &service.ResponseMetaHeader{} } if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -7481,7 +7482,7 @@ func (m *DeleteResponse) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.VerifyHeader == nil { - m.VerifyHeader = &v2.ResponseVerificationHeader{} + m.VerifyHeader = &service.ResponseVerificationHeader{} } if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -7661,7 +7662,7 @@ func (m *HeadRequest) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.MetaHeader == nil { - m.MetaHeader = &v2.RequestMetaHeader{} + m.MetaHeader = &service.RequestMetaHeader{} } if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -7697,7 +7698,7 @@ func (m *HeadRequest) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.VerifyHeader == nil { - m.VerifyHeader = &v2.RequestVerificationHeader{} + m.VerifyHeader = &service.RequestVerificationHeader{} } if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -7787,7 +7788,7 @@ func (m *HeadRequest_Body) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.Address == nil { - m.Address = &v21.Address{} + m.Address = &refs.Address{} } if err := m.Address.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -7953,7 +7954,7 @@ func (m *HeadResponse) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.MetaHeader == nil { - m.MetaHeader = &v2.ResponseMetaHeader{} + m.MetaHeader = &service.ResponseMetaHeader{} } if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -7989,7 +7990,7 @@ func (m *HeadResponse) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.VerifyHeader == nil { - m.VerifyHeader = &v2.ResponseVerificationHeader{} + m.VerifyHeader = &service.ResponseVerificationHeader{} } if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -8203,7 +8204,7 @@ func (m *HeadResponse_Body_ShortHeader) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.Version == nil { - m.Version = &v2.Version{} + m.Version = &service.Version{} } if err := m.Version.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -8258,7 +8259,7 @@ func (m *HeadResponse_Body_ShortHeader) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.OwnerId == nil { - m.OwnerId = &v21.OwnerID{} + m.OwnerId = &refs.OwnerID{} } if err := m.OwnerId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -8422,7 +8423,7 @@ func (m *SearchRequest) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.MetaHeader == nil { - m.MetaHeader = &v2.RequestMetaHeader{} + m.MetaHeader = &service.RequestMetaHeader{} } if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -8458,7 +8459,7 @@ func (m *SearchRequest) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.VerifyHeader == nil { - m.VerifyHeader = &v2.RequestVerificationHeader{} + m.VerifyHeader = &service.RequestVerificationHeader{} } if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -8548,7 +8549,7 @@ func (m *SearchRequest_Body) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.ContainerId == nil { - m.ContainerId = &v21.ContainerID{} + m.ContainerId = &refs.ContainerID{} } if err := m.ContainerId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -8954,7 +8955,7 @@ func (m *SearchResponse) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.MetaHeader == nil { - m.MetaHeader = &v2.ResponseMetaHeader{} + m.MetaHeader = &service.ResponseMetaHeader{} } if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -8990,7 +8991,7 @@ func (m *SearchResponse) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.VerifyHeader == nil { - m.VerifyHeader = &v2.ResponseVerificationHeader{} + m.VerifyHeader = &service.ResponseVerificationHeader{} } if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -9079,7 +9080,7 @@ func (m *SearchResponse_Body) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.IdList = append(m.IdList, &v21.ObjectID{}) + m.IdList = append(m.IdList, &refs.ObjectID{}) if err := m.IdList[len(m.IdList)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -9296,7 +9297,7 @@ func (m *GetRangeRequest) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.MetaHeader == nil { - m.MetaHeader = &v2.RequestMetaHeader{} + m.MetaHeader = &service.RequestMetaHeader{} } if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -9332,7 +9333,7 @@ func (m *GetRangeRequest) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.VerifyHeader == nil { - m.VerifyHeader = &v2.RequestVerificationHeader{} + m.VerifyHeader = &service.RequestVerificationHeader{} } if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -9422,7 +9423,7 @@ func (m *GetRangeRequest_Body) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.Address == nil { - m.Address = &v21.Address{} + m.Address = &refs.Address{} } if err := m.Address.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -9584,7 +9585,7 @@ func (m *GetRangeResponse) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.MetaHeader == nil { - m.MetaHeader = &v2.ResponseMetaHeader{} + m.MetaHeader = &service.ResponseMetaHeader{} } if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -9620,7 +9621,7 @@ func (m *GetRangeResponse) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.VerifyHeader == nil { - m.VerifyHeader = &v2.ResponseVerificationHeader{} + m.VerifyHeader = &service.ResponseVerificationHeader{} } if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -9834,7 +9835,7 @@ func (m *GetRangeHashRequest) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.MetaHeader == nil { - m.MetaHeader = &v2.RequestMetaHeader{} + m.MetaHeader = &service.RequestMetaHeader{} } if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -9870,7 +9871,7 @@ func (m *GetRangeHashRequest) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.VerifyHeader == nil { - m.VerifyHeader = &v2.RequestVerificationHeader{} + m.VerifyHeader = &service.RequestVerificationHeader{} } if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -9960,7 +9961,7 @@ func (m *GetRangeHashRequest_Body) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.Address == nil { - m.Address = &v21.Address{} + m.Address = &refs.Address{} } if err := m.Address.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -10154,7 +10155,7 @@ func (m *GetRangeHashResponse) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.MetaHeader == nil { - m.MetaHeader = &v2.ResponseMetaHeader{} + m.MetaHeader = &service.ResponseMetaHeader{} } if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -10190,7 +10191,7 @@ func (m *GetRangeHashResponse) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.VerifyHeader == nil { - m.VerifyHeader = &v2.ResponseVerificationHeader{} + m.VerifyHeader = &service.ResponseVerificationHeader{} } if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err diff --git a/object/v2/service.proto b/v2/object/service.proto similarity index 79% rename from object/v2/service.proto rename to v2/object/service.proto index 85e6d3e..28051e3 100644 --- a/object/v2/service.proto +++ b/v2/object/service.proto @@ -1,25 +1,25 @@ syntax = "proto3"; -package object.v2; +package neo.fs.v2.object; -option go_package = "github.com/nspcc-dev/neofs-api-go/object/v2"; +option go_package = "github.com/nspcc-dev/neofs-api-go/v2/object"; option csharp_namespace = "NeoFS.API.Object"; -import "object/v2/types.proto"; -import "refs/v2/types.proto"; -import "service/v2/meta.proto"; -import "service/v2/verify.proto"; +import "v2/object/types.proto"; +import "v2/refs/types.proto"; +import "v2/service/meta.proto"; +import "v2/service/verify.proto"; -// Object service provides API for manipulating with the object.v2. +// Object service provides API for manipulating with the object. service Service { - // Get the object from container.v2. Response uses gRPC stream. First response + // Get the object from container. Response uses gRPC stream. First response // message carry object of requested address. Chunk messages are parts of // the object's payload if it is needed. All messages except first carry // chunks. Requested object can be restored by concatenation of object // message payload and all chunks keeping receiving order. rpc Get(GetRequest) returns (stream GetResponse); - // Put the object into container.v2. Request uses gRPC stream. First message + // Put the object into container. Request uses gRPC stream. First message // SHOULD BE type of PutHeader. Container id and Owner id of object SHOULD // BE set. Session token SHOULD BE obtained before put operation (see // session package). Chunk messages considered by server as part of object @@ -35,7 +35,7 @@ service Service { // headers are also present. rpc Head(HeadRequest) returns (HeadResponse); - // Search objects in container.v2. Version of query language format SHOULD BE + // Search objects in container. Version of query language format SHOULD BE // set to 1. Search query represented in serialized format (see query // package). rpc Search(SearchRequest) returns (stream SearchResponse); @@ -54,8 +54,8 @@ service Service { message GetRequest { message Body { - // Address of the requested object.v2. - refs.v2.Address address = 1; + // Address of the requested object. + neo.fs.v2.refs.Address address = 1; // Carries the raw option flag of the request. // Raw request is sent to receive only the objects @@ -67,11 +67,11 @@ message GetRequest { // Carries request meta information. Header data is used only to regulate message // transport and does not affect request execution. - service.v2.RequestMetaHeader meta_header = 2; + neo.fs.v2.service.RequestMetaHeader meta_header = 2; // Carries request verification information. This header is used to authenticate // the nodes of the message route and check the correctness of transmission. - service.v2.RequestVerificationHeader verify_header = 3; + neo.fs.v2.service.RequestVerificationHeader verify_header = 3; } message GetResponse { @@ -79,9 +79,9 @@ message GetResponse { // Initialization parameters of the object got from NeoFS. message Init { // Object ID - refs.v2.ObjectID object_id = 1; + neo.fs.v2.refs.ObjectID object_id = 1; // Object signature - service.v2.Signature signature =2; + neo.fs.v2.service.Signature signature =2; // Object header. Header header = 3; } @@ -98,12 +98,12 @@ message GetResponse { // Carries response meta information. Header data is used only to regulate // message transport and does not affect request execution. - service.v2.ResponseMetaHeader meta_header = 2; + neo.fs.v2.service.ResponseMetaHeader meta_header = 2; // Carries response verification information. This header is used to // authenticate the nodes of the message route and check the correctness // of transmission. - service.v2.ResponseVerificationHeader verify_header = 3; + neo.fs.v2.service.ResponseVerificationHeader verify_header = 3; } message PutRequest { @@ -111,9 +111,9 @@ message PutRequest { // Groups initialization parameters of object placement in NeoFS. message Init { // Object ID, where available - refs.v2.ObjectID object_id = 1; + neo.fs.v2.refs.ObjectID object_id = 1; // Object signature, were available - service.v2.Signature signature =2; + neo.fs.v2.service.Signature signature =2; // Header of the object to save in the system. Header header = 3; // Number of the object copies to store within the RPC call. @@ -135,49 +135,49 @@ message PutRequest { // Carries request meta information. Header data is used only to regulate message // transport and does not affect request execution. - service.v2.RequestMetaHeader meta_header = 2; + neo.fs.v2.service.RequestMetaHeader meta_header = 2; // Carries request verification information. This header is used to authenticate // the nodes of the message route and check the correctness of transmission. - service.v2.RequestVerificationHeader verify_header = 3; + neo.fs.v2.service.RequestVerificationHeader verify_header = 3; } message PutResponse { message Body { - // Carries identifier of the saved object.v2. - // It is used to access an object in the container.v2. - refs.v2.ObjectID object_id = 1; + // Carries identifier of the saved object. + // It is used to access an object in the container. + neo.fs.v2.refs.ObjectID object_id = 1; } // Body of put object response message. Body body = 1; // Carries response meta information. Header data is used only to regulate // message transport and does not affect request execution. - service.v2.ResponseMetaHeader meta_header = 2; + neo.fs.v2.service.ResponseMetaHeader meta_header = 2; // Carries response verification information. This header is used to // authenticate the nodes of the message route and check the correctness // of transmission. - service.v2.ResponseVerificationHeader verify_header = 3; + neo.fs.v2.service.ResponseVerificationHeader verify_header = 3; } message DeleteRequest { message Body { // Carries the address of the object to be deleted. - refs.v2.Address address = 1; + neo.fs.v2.refs.Address address = 1; // Carries identifier the object owner. - refs.v2.OwnerID owner_id = 2; + neo.fs.v2.refs.OwnerID owner_id = 2; } // Body of delete object request message. Body body = 1; // Carries request meta information. Header data is used only to regulate message // transport and does not affect request execution. - service.v2.RequestMetaHeader meta_header = 2; + neo.fs.v2.service.RequestMetaHeader meta_header = 2; // Carries request verification information. This header is used to authenticate // the nodes of the message route and check the correctness of transmission. - service.v2.RequestVerificationHeader verify_header = 3; + neo.fs.v2.service.RequestVerificationHeader verify_header = 3; } // DeleteResponse is empty because we cannot guarantee permanent object removal @@ -190,18 +190,18 @@ message DeleteResponse { // Carries response meta information. Header data is used only to regulate // message transport and does not affect request execution. - service.v2.ResponseMetaHeader meta_header = 2; + neo.fs.v2.service.ResponseMetaHeader meta_header = 2; // Carries response verification information. This header is used to // authenticate the nodes of the message route and check the correctness // of transmission. - service.v2.ResponseVerificationHeader verify_header = 3; + neo.fs.v2.service.ResponseVerificationHeader verify_header = 3; } message HeadRequest { message Body { // Address of the object with the requested header. - refs.v2.Address address = 1; + neo.fs.v2.refs.Address address = 1; // Return only minimal header subset bool main_only = 2; // Carries the raw option flag of the request. @@ -214,22 +214,22 @@ message HeadRequest { // Carries request meta information. Header data is used only to regulate message // transport and does not affect request execution. - service.v2.RequestMetaHeader meta_header = 2; + neo.fs.v2.service.RequestMetaHeader meta_header = 2; // Carries request verification information. This header is used to authenticate // the nodes of the message route and check the correctness of transmission. - service.v2.RequestVerificationHeader verify_header = 3; + neo.fs.v2.service.RequestVerificationHeader verify_header = 3; } message HeadResponse { message Body { message ShortHeader { // Object format version. - service.v2.Version version = 1; + neo.fs.v2.service.Version version = 1; // Epoch when the object was created uint64 creation_epoch = 2; // Object's owner - refs.v2.OwnerID owner_id = 3; + neo.fs.v2.refs.OwnerID owner_id = 3; // Type of the object payload content ObjectType object_type = 4; // Size of payload in bytes. @@ -247,18 +247,18 @@ message HeadResponse { // Carries response meta information. Header data is used only to regulate // message transport and does not affect request execution. - service.v2.ResponseMetaHeader meta_header = 2; + neo.fs.v2.service.ResponseMetaHeader meta_header = 2; // Carries response verification information. This header is used to // authenticate the nodes of the message route and check the correctness // of transmission. - service.v2.ResponseVerificationHeader verify_header = 3; + neo.fs.v2.service.ResponseVerificationHeader verify_header = 3; } message SearchRequest { message Body { // Carries search container identifier. - refs.v2.ContainerID container_id = 1; + neo.fs.v2.refs.ContainerID container_id = 1; message Query { uint32 version = 1; @@ -287,17 +287,17 @@ message SearchRequest { // Carries request meta information. Header data is used only to regulate message // transport and does not affect request execution. - service.v2.RequestMetaHeader meta_header = 2; + neo.fs.v2.service.RequestMetaHeader meta_header = 2; // Carries request verification information. This header is used to authenticate // the nodes of the message route and check the correctness of transmission. - service.v2.RequestVerificationHeader verify_header = 3; + neo.fs.v2.service.RequestVerificationHeader verify_header = 3; } message SearchResponse { message Body { // Carries list of object identifiers that match the search query. - repeated refs.v2.ObjectID id_list = 1; + repeated neo.fs.v2.refs.ObjectID id_list = 1; } // Body of search object response message. @@ -305,12 +305,12 @@ message SearchResponse { // Carries response meta information. Header data is used only to regulate // message transport and does not affect request execution. - service.v2.ResponseMetaHeader meta_header = 2; + neo.fs.v2.service.ResponseMetaHeader meta_header = 2; // Carries response verification information. This header is used to // authenticate the nodes of the message route and check the correctness // of transmission. - service.v2.ResponseVerificationHeader verify_header = 3; + neo.fs.v2.service.ResponseVerificationHeader verify_header = 3; } // Range groups the parameters of object payload range. @@ -325,7 +325,7 @@ message Range { message GetRangeRequest { message Body { // Address carries address of the object that contains the requested payload range. - refs.v2.Address address = 1; + neo.fs.v2.refs.Address address = 1; // Range carries the parameters of the requested payload range. Range range = 2; @@ -336,11 +336,11 @@ message GetRangeRequest { // Carries request meta information. Header data is used only to regulate message // transport and does not affect request execution. - service.v2.RequestMetaHeader meta_header = 2; + neo.fs.v2.service.RequestMetaHeader meta_header = 2; // Carries request verification information. This header is used to authenticate // the nodes of the message route and check the correctness of transmission. - service.v2.RequestVerificationHeader verify_header = 3; + neo.fs.v2.service.RequestVerificationHeader verify_header = 3; } message GetRangeResponse { @@ -354,18 +354,18 @@ message GetRangeResponse { // Carries response meta information. Header data is used only to regulate // message transport and does not affect request execution. - service.v2.ResponseMetaHeader meta_header = 2; + neo.fs.v2.service.ResponseMetaHeader meta_header = 2; // Carries response verification information. This header is used to // authenticate the nodes of the message route and check the correctness // of transmission. - service.v2.ResponseVerificationHeader verify_header = 3; + neo.fs.v2.service.ResponseVerificationHeader verify_header = 3; } message GetRangeHashRequest { message Body { // Carries address of the object that contains the requested payload range. - refs.v2.Address address = 1; + neo.fs.v2.refs.Address address = 1; // Carries the list of object payload range to calculate homomorphic hash. repeated Range ranges = 2; @@ -379,11 +379,11 @@ message GetRangeHashRequest { // Carries request meta information. Header data is used only to regulate message // transport and does not affect request execution. - service.v2.RequestMetaHeader meta_header = 2; + neo.fs.v2.service.RequestMetaHeader meta_header = 2; // Carries request verification information. This header is used to authenticate // the nodes of the message route and check the correctness of transmission. - service.v2.RequestVerificationHeader verify_header = 3; + neo.fs.v2.service.RequestVerificationHeader verify_header = 3; } message GetRangeHashResponse { @@ -397,11 +397,11 @@ message GetRangeHashResponse { // Carries response meta information. Header data is used only to regulate // message transport and does not affect request execution. - service.v2.ResponseMetaHeader meta_header = 2; + neo.fs.v2.service.ResponseMetaHeader meta_header = 2; // Carries response verification information. This header is used to // authenticate the nodes of the message route and check the correctness // of transmission. - service.v2.ResponseVerificationHeader verify_header = 3; + neo.fs.v2.service.ResponseVerificationHeader verify_header = 3; } diff --git a/object/v2/types.go b/v2/object/types.go similarity index 96% rename from object/v2/types.go rename to v2/object/types.go index 9acd3fd..7a97531 100644 --- a/object/v2/types.go +++ b/v2/object/types.go @@ -1,8 +1,8 @@ -package v2 +package object import ( - refs "github.com/nspcc-dev/neofs-api-go/refs/v2" - service "github.com/nspcc-dev/neofs-api-go/service/v2" + "github.com/nspcc-dev/neofs-api-go/v2/refs" + "github.com/nspcc-dev/neofs-api-go/v2/service" ) // SetKey sets key to the object attribute. diff --git a/object/v2/types.pb.go b/v2/object/types.pb.go similarity index 84% rename from object/v2/types.pb.go rename to v2/object/types.pb.go index bae2d04..0f083d3 100644 --- a/object/v2/types.pb.go +++ b/v2/object/types.pb.go @@ -1,13 +1,13 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: object/v2/types.proto +// source: v2/object/types.proto -package v2 +package object import ( fmt "fmt" proto "github.com/golang/protobuf/proto" - v2 "github.com/nspcc-dev/neofs-api-go/refs/v2" - v21 "github.com/nspcc-dev/neofs-api-go/service/v2" + refs "github.com/nspcc-dev/neofs-api-go/v2/refs" + service "github.com/nspcc-dev/neofs-api-go/v2/service" io "io" math "math" math_bits "math/bits" @@ -53,31 +53,31 @@ func (x ObjectType) String() string { } func (ObjectType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_666bf7c1dc0e676f, []int{0} + return fileDescriptor_fcb9e8df342f43c6, []int{0} } type Header struct { // Object's container - ContainerId *v2.ContainerID `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` + ContainerId *refs.ContainerID `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` // Object's owner - OwnerId *v2.OwnerID `protobuf:"bytes,2,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"` + OwnerId *refs.OwnerID `protobuf:"bytes,2,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"` // Epoch when the object was created CreationEpoch uint64 `protobuf:"varint,3,opt,name=creation_epoch,json=creationEpoch,proto3" json:"creation_epoch,omitempty"` // Object format version. // Effectively the version of API library used to create particular object - Version *v21.Version `protobuf:"bytes,4,opt,name=version,proto3" json:"version,omitempty"` + Version *service.Version `protobuf:"bytes,4,opt,name=version,proto3" json:"version,omitempty"` // Size of payload in bytes. // 0xFFFFFFFFFFFFFFFF means `payload_length` is unknown PayloadLength uint64 `protobuf:"varint,5,opt,name=payload_length,json=payloadLength,proto3" json:"payload_length,omitempty"` // Hash of payload bytes PayloadHash []byte `protobuf:"bytes,6,opt,name=payload_hash,json=payloadHash,proto3" json:"payload_hash,omitempty"` - ObjectType ObjectType `protobuf:"varint,7,opt,name=object_type,json=objectType,proto3,enum=object.v2.ObjectType" json:"object_type,omitempty"` + ObjectType ObjectType `protobuf:"varint,7,opt,name=object_type,json=objectType,proto3,enum=neo.fs.v2.object.ObjectType" json:"object_type,omitempty"` // Homomorphic hash of the object payload. HomomorphicHash []byte `protobuf:"bytes,8,opt,name=homomorphic_hash,json=homomorphicHash,proto3" json:"homomorphic_hash,omitempty"` // Session token, if it was used during Object creation. // Need it to verify integrity and authenticity out of Request scope. - SessionToken *v21.SessionToken `protobuf:"bytes,9,opt,name=session_token,json=sessionToken,proto3" json:"session_token,omitempty"` - Attributes []*Header_Attribute `protobuf:"bytes,10,rep,name=attributes,proto3" json:"attributes,omitempty"` + SessionToken *service.SessionToken `protobuf:"bytes,9,opt,name=session_token,json=sessionToken,proto3" json:"session_token,omitempty"` + Attributes []*Header_Attribute `protobuf:"bytes,10,rep,name=attributes,proto3" json:"attributes,omitempty"` // Position of the object in the split hierarchy. Split *Header_Split `protobuf:"bytes,11,opt,name=split,proto3" json:"split,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` @@ -89,7 +89,7 @@ func (m *Header) Reset() { *m = Header{} } func (m *Header) String() string { return proto.CompactTextString(m) } func (*Header) ProtoMessage() {} func (*Header) Descriptor() ([]byte, []int) { - return fileDescriptor_666bf7c1dc0e676f, []int{0} + return fileDescriptor_fcb9e8df342f43c6, []int{0} } func (m *Header) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -118,14 +118,14 @@ func (m *Header) XXX_DiscardUnknown() { var xxx_messageInfo_Header proto.InternalMessageInfo -func (m *Header) GetContainerId() *v2.ContainerID { +func (m *Header) GetContainerId() *refs.ContainerID { if m != nil { return m.ContainerId } return nil } -func (m *Header) GetOwnerId() *v2.OwnerID { +func (m *Header) GetOwnerId() *refs.OwnerID { if m != nil { return m.OwnerId } @@ -139,7 +139,7 @@ func (m *Header) GetCreationEpoch() uint64 { return 0 } -func (m *Header) GetVersion() *v21.Version { +func (m *Header) GetVersion() *service.Version { if m != nil { return m.Version } @@ -174,7 +174,7 @@ func (m *Header) GetHomomorphicHash() []byte { return nil } -func (m *Header) GetSessionToken() *v21.SessionToken { +func (m *Header) GetSessionToken() *service.SessionToken { if m != nil { return m.SessionToken } @@ -210,7 +210,7 @@ func (m *Header_Attribute) Reset() { *m = Header_Attribute{} } func (m *Header_Attribute) String() string { return proto.CompactTextString(m) } func (*Header_Attribute) ProtoMessage() {} func (*Header_Attribute) Descriptor() ([]byte, []int) { - return fileDescriptor_666bf7c1dc0e676f, []int{0, 0} + return fileDescriptor_fcb9e8df342f43c6, []int{0, 0} } func (m *Header_Attribute) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -255,28 +255,28 @@ func (m *Header_Attribute) GetValue() string { // Information about spawning the objects through a payload splitting. type Header_Split struct { - // Identifier of the origin object.v2. - // Parent and children objects must be within the same container.v2. + // Identifier of the origin object. + // Parent and children objects must be within the same container. // Parent object_id is known only to the minor child. - Parent *v2.ObjectID `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"` + Parent *refs.ObjectID `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"` // Previous carries identifier of the left split neighbor. - Previous *v2.ObjectID `protobuf:"bytes,2,opt,name=previous,proto3" json:"previous,omitempty"` - // `signature` field of the parent object.v2. Used to reconstruct parent. - ParentSignature *v21.Signature `protobuf:"bytes,3,opt,name=parent_signature,json=parentSignature,proto3" json:"parent_signature,omitempty"` - // `header` field of the parent object.v2. Used to reconstruct parent. + Previous *refs.ObjectID `protobuf:"bytes,2,opt,name=previous,proto3" json:"previous,omitempty"` + // `signature` field of the parent object. Used to reconstruct parent. + ParentSignature *service.Signature `protobuf:"bytes,3,opt,name=parent_signature,json=parentSignature,proto3" json:"parent_signature,omitempty"` + // `header` field of the parent object. Used to reconstruct parent. ParentHeader *Header `protobuf:"bytes,4,opt,name=parent_header,json=parentHeader,proto3" json:"parent_header,omitempty"` // Children carries list of identifiers of the objects generated by splitting the current. - Children []*v2.ObjectID `protobuf:"bytes,5,rep,name=children,proto3" json:"children,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Children []*refs.ObjectID `protobuf:"bytes,5,rep,name=children,proto3" json:"children,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *Header_Split) Reset() { *m = Header_Split{} } func (m *Header_Split) String() string { return proto.CompactTextString(m) } func (*Header_Split) ProtoMessage() {} func (*Header_Split) Descriptor() ([]byte, []int) { - return fileDescriptor_666bf7c1dc0e676f, []int{0, 1} + return fileDescriptor_fcb9e8df342f43c6, []int{0, 1} } func (m *Header_Split) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -305,21 +305,21 @@ func (m *Header_Split) XXX_DiscardUnknown() { var xxx_messageInfo_Header_Split proto.InternalMessageInfo -func (m *Header_Split) GetParent() *v2.ObjectID { +func (m *Header_Split) GetParent() *refs.ObjectID { if m != nil { return m.Parent } return nil } -func (m *Header_Split) GetPrevious() *v2.ObjectID { +func (m *Header_Split) GetPrevious() *refs.ObjectID { if m != nil { return m.Previous } return nil } -func (m *Header_Split) GetParentSignature() *v21.Signature { +func (m *Header_Split) GetParentSignature() *service.Signature { if m != nil { return m.ParentSignature } @@ -333,7 +333,7 @@ func (m *Header_Split) GetParentHeader() *Header { return nil } -func (m *Header_Split) GetChildren() []*v2.ObjectID { +func (m *Header_Split) GetChildren() []*refs.ObjectID { if m != nil { return m.Children } @@ -346,9 +346,9 @@ type Object struct { // Object is content-addressed. It means id will change if header or payload // changes. It's calculated as a hash of header field, which contains hash of // object's payload - ObjectId *v2.ObjectID `protobuf:"bytes,1,opt,name=object_id,json=objectId,proto3" json:"object_id,omitempty"` + ObjectId *refs.ObjectID `protobuf:"bytes,1,opt,name=object_id,json=objectId,proto3" json:"object_id,omitempty"` // Signed object_id - Signature *v21.Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` + Signature *service.Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` // Object metadata headers Header *Header `protobuf:"bytes,3,opt,name=header,proto3" json:"header,omitempty"` // Payload bytes. @@ -362,7 +362,7 @@ func (m *Object) Reset() { *m = Object{} } func (m *Object) String() string { return proto.CompactTextString(m) } func (*Object) ProtoMessage() {} func (*Object) Descriptor() ([]byte, []int) { - return fileDescriptor_666bf7c1dc0e676f, []int{1} + return fileDescriptor_fcb9e8df342f43c6, []int{1} } func (m *Object) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -391,14 +391,14 @@ func (m *Object) XXX_DiscardUnknown() { var xxx_messageInfo_Object proto.InternalMessageInfo -func (m *Object) GetObjectId() *v2.ObjectID { +func (m *Object) GetObjectId() *refs.ObjectID { if m != nil { return m.ObjectId } return nil } -func (m *Object) GetSignature() *v21.Signature { +func (m *Object) GetSignature() *service.Signature { if m != nil { return m.Signature } @@ -420,61 +420,62 @@ func (m *Object) GetPayload() []byte { } func init() { - proto.RegisterEnum("object.v2.ObjectType", ObjectType_name, ObjectType_value) - proto.RegisterType((*Header)(nil), "object.v2.Header") - proto.RegisterType((*Header_Attribute)(nil), "object.v2.Header.Attribute") - proto.RegisterType((*Header_Split)(nil), "object.v2.Header.Split") - proto.RegisterType((*Object)(nil), "object.v2.Object") + proto.RegisterEnum("neo.fs.v2.object.ObjectType", ObjectType_name, ObjectType_value) + proto.RegisterType((*Header)(nil), "neo.fs.v2.object.Header") + proto.RegisterType((*Header_Attribute)(nil), "neo.fs.v2.object.Header.Attribute") + proto.RegisterType((*Header_Split)(nil), "neo.fs.v2.object.Header.Split") + proto.RegisterType((*Object)(nil), "neo.fs.v2.object.Object") } -func init() { proto.RegisterFile("object/v2/types.proto", fileDescriptor_666bf7c1dc0e676f) } +func init() { proto.RegisterFile("v2/object/types.proto", fileDescriptor_fcb9e8df342f43c6) } -var fileDescriptor_666bf7c1dc0e676f = []byte{ - // 704 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x94, 0x5f, 0x4e, 0xdb, 0x4a, - 0x14, 0xc6, 0x71, 0x42, 0xfe, 0x1d, 0x27, 0x60, 0x06, 0x22, 0xac, 0x5c, 0x29, 0xca, 0x45, 0xba, - 0x52, 0xb8, 0x28, 0x8e, 0x14, 0x24, 0xee, 0x03, 0xba, 0x52, 0x43, 0x49, 0x21, 0x12, 0x25, 0x68, - 0x12, 0xfa, 0xd0, 0x97, 0xc8, 0xb1, 0x87, 0xd8, 0x25, 0xf1, 0x58, 0xf6, 0xc4, 0x28, 0x5b, 0xe8, - 0x0a, 0xba, 0x86, 0x3e, 0x76, 0x15, 0x7d, 0xec, 0x0a, 0xaa, 0x8a, 0x6e, 0xa4, 0xf2, 0xcc, 0xd8, - 0x49, 0x0b, 0xed, 0xdb, 0xcc, 0x77, 0x7e, 0xe7, 0xcc, 0x7c, 0xc7, 0x67, 0x0c, 0x55, 0x3a, 0x79, - 0x47, 0x2c, 0xd6, 0x8e, 0x3a, 0x6d, 0xb6, 0xf4, 0x49, 0x68, 0xf8, 0x01, 0x65, 0x14, 0x95, 0x84, - 0x6c, 0x44, 0x9d, 0xda, 0x6e, 0x40, 0xee, 0xc2, 0x5f, 0xe2, 0xb5, 0x6a, 0x48, 0x82, 0xc8, 0xb5, - 0x48, 0xac, 0xcf, 0x09, 0x33, 0xa5, 0xbc, 0xbf, 0x26, 0x47, 0x24, 0x70, 0xef, 0x96, 0x22, 0x70, - 0xf0, 0x35, 0x0f, 0xf9, 0x4b, 0x62, 0xda, 0x24, 0x40, 0xff, 0x41, 0xd9, 0xa2, 0x1e, 0x33, 0x5d, - 0x8f, 0x04, 0x63, 0xd7, 0xd6, 0x95, 0x86, 0xd2, 0x54, 0x3b, 0x7b, 0x46, 0x7c, 0x8c, 0x11, 0x75, - 0x8c, 0x97, 0x49, 0xb0, 0x7f, 0x8e, 0xd5, 0x94, 0xec, 0xdb, 0xe8, 0x08, 0x8a, 0xf4, 0x41, 0x26, - 0x65, 0x78, 0x92, 0x96, 0x26, 0x0d, 0x1e, 0x44, 0x42, 0x81, 0x13, 0x7d, 0x1b, 0xfd, 0x03, 0x5b, - 0x56, 0x40, 0x4c, 0xe6, 0x52, 0x6f, 0x4c, 0x7c, 0x6a, 0x39, 0x7a, 0xb6, 0xa1, 0x34, 0x37, 0x71, - 0x25, 0x51, 0x7b, 0xb1, 0x88, 0x5a, 0x50, 0x88, 0x48, 0x10, 0xba, 0xd4, 0xd3, 0x37, 0x79, 0xc9, - 0x5d, 0x43, 0x5a, 0x88, 0xab, 0xbe, 0x11, 0x21, 0x9c, 0x30, 0x71, 0x55, 0xdf, 0x5c, 0xce, 0xa8, - 0x69, 0x8f, 0x67, 0xc4, 0x9b, 0x32, 0x47, 0xcf, 0x89, 0xaa, 0x52, 0xbd, 0xe2, 0x22, 0xfa, 0x1b, - 0xca, 0x09, 0xe6, 0x98, 0xa1, 0xa3, 0xe7, 0x1b, 0x4a, 0xb3, 0x8c, 0x55, 0xa9, 0x5d, 0x9a, 0xa1, - 0x83, 0x4e, 0x40, 0x15, 0x2d, 0x1e, 0xc7, 0x6d, 0xd5, 0x0b, 0x0d, 0xa5, 0xb9, 0xd5, 0xa9, 0x1a, - 0x69, 0xdb, 0x8d, 0x01, 0x5f, 0x8d, 0x96, 0x3e, 0xc1, 0x40, 0xd3, 0x35, 0x3a, 0x04, 0xcd, 0xa1, - 0x73, 0x3a, 0xa7, 0x81, 0xef, 0xb8, 0x96, 0x28, 0x5f, 0xe4, 0xe5, 0xb7, 0xd7, 0x74, 0x7e, 0xc4, - 0xff, 0x50, 0x09, 0x49, 0x18, 0xdf, 0x7b, 0xcc, 0xe8, 0x3d, 0xf1, 0xf4, 0x12, 0x77, 0xa8, 0xaf, - 0x3b, 0x1c, 0x0a, 0x60, 0x14, 0xc7, 0x71, 0x39, 0x5c, 0xdb, 0xa1, 0x53, 0x00, 0x93, 0xb1, 0xc0, - 0x9d, 0x2c, 0x18, 0x09, 0x75, 0x68, 0x64, 0x9b, 0x6a, 0xe7, 0xaf, 0xb5, 0x0b, 0x8a, 0xcf, 0x69, - 0x74, 0x13, 0x06, 0xaf, 0xe1, 0xa8, 0x05, 0xb9, 0xd0, 0x9f, 0xb9, 0x4c, 0x57, 0xf9, 0x99, 0xfb, - 0x4f, 0xf3, 0x86, 0x71, 0x18, 0x0b, 0xaa, 0x76, 0x0c, 0xa5, 0xb4, 0x0e, 0xd2, 0x20, 0x7b, 0x4f, - 0x96, 0x7c, 0x2e, 0x4a, 0x38, 0x5e, 0xa2, 0x3d, 0xc8, 0x45, 0xe6, 0x6c, 0x41, 0xf8, 0x67, 0x2f, - 0x61, 0xb1, 0xa9, 0xbd, 0xcf, 0x40, 0x8e, 0x57, 0x41, 0x87, 0x90, 0xf7, 0xcd, 0x80, 0x78, 0x4c, - 0x0e, 0xd3, 0xce, 0x6a, 0x2e, 0xf8, 0xb1, 0xfd, 0x73, 0x2c, 0x01, 0xd4, 0x82, 0xa2, 0x1f, 0x90, - 0xc8, 0xa5, 0x8b, 0x50, 0x0e, 0xd1, 0x33, 0x70, 0x8a, 0xa0, 0x17, 0xa0, 0x89, 0xc4, 0x71, 0xe8, - 0x4e, 0x3d, 0x93, 0x2d, 0x02, 0xc2, 0x07, 0x49, 0xed, 0x54, 0x7f, 0x6a, 0x63, 0x12, 0xc4, 0xdb, - 0x02, 0x4f, 0x05, 0x74, 0x02, 0x15, 0x59, 0xc1, 0xe1, 0xc6, 0xe5, 0x9c, 0xed, 0x3c, 0xe9, 0x08, - 0x2e, 0x0b, 0x4e, 0x3e, 0x93, 0x16, 0x14, 0x2d, 0xc7, 0x9d, 0xd9, 0x01, 0xf1, 0xf4, 0x1c, 0x6f, - 0xfe, 0x73, 0x17, 0x4d, 0x90, 0x83, 0x4f, 0x0a, 0xe4, 0x85, 0x8c, 0x0c, 0x90, 0xaf, 0x77, 0xf5, - 0xba, 0x9e, 0x4b, 0x15, 0x4c, 0xdf, 0x46, 0xc7, 0x50, 0x5a, 0x99, 0xcb, 0xfc, 0xc9, 0xdc, 0x8a, - 0x8b, 0x5b, 0x2e, 0xfd, 0x64, 0x7f, 0xe7, 0x47, 0x02, 0x48, 0x87, 0x82, 0x9c, 0x7c, 0xee, 0xbd, - 0x8c, 0x93, 0xed, 0xbf, 0xa7, 0x00, 0xab, 0x31, 0x47, 0x2a, 0x14, 0x70, 0xef, 0xe2, 0xf6, 0xaa, - 0x8b, 0xb5, 0x0d, 0x54, 0x81, 0xd2, 0x68, 0xf0, 0xfa, 0x6c, 0x38, 0x1a, 0x5c, 0xf7, 0x34, 0x05, - 0xed, 0x40, 0x65, 0x38, 0x1a, 0xe0, 0xee, 0x45, 0x6f, 0x7c, 0x81, 0x07, 0xb7, 0x37, 0x5a, 0xe6, - 0xec, 0xe6, 0xf3, 0x63, 0x5d, 0xf9, 0xf2, 0x58, 0x57, 0xbe, 0x3d, 0xd6, 0x95, 0x0f, 0xdf, 0xeb, - 0x1b, 0x6f, 0x8f, 0xa6, 0x2e, 0x73, 0x16, 0x13, 0xc3, 0xa2, 0xf3, 0xb6, 0x17, 0xfa, 0x96, 0xd5, - 0xb2, 0x49, 0xd4, 0xf6, 0x08, 0xbd, 0x0b, 0x5b, 0xa6, 0xef, 0xb6, 0xa6, 0xb4, 0x9d, 0xfe, 0xed, - 0x3e, 0x66, 0xb4, 0x6b, 0x42, 0x5f, 0x0d, 0x8d, 0xee, 0x4d, 0x5f, 0x36, 0x65, 0x92, 0xe7, 0xff, - 0xaa, 0xe3, 0x1f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xeb, 0x34, 0x17, 0x81, 0x14, 0x05, 0x00, 0x00, +var fileDescriptor_fcb9e8df342f43c6 = []byte{ + // 718 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x94, 0xdf, 0x6e, 0xda, 0x48, + 0x14, 0xc6, 0x63, 0x08, 0xff, 0x8e, 0x21, 0xf1, 0xce, 0xee, 0x2a, 0x16, 0xbb, 0x62, 0xd9, 0x48, + 0x2b, 0xb1, 0xbb, 0x8a, 0x59, 0x11, 0xf6, 0xa6, 0x55, 0x2a, 0x91, 0x86, 0x12, 0xa4, 0x34, 0x44, + 0x03, 0xe9, 0x45, 0x6f, 0x90, 0xb1, 0x07, 0xec, 0x06, 0x3c, 0x96, 0xc7, 0x38, 0xe2, 0x4d, 0xfa, + 0x0c, 0x95, 0x7a, 0xd3, 0x97, 0x68, 0x2f, 0xfb, 0x08, 0x55, 0xfa, 0x22, 0x95, 0x67, 0xc6, 0x86, + 0x26, 0x4d, 0xda, 0x2b, 0x7b, 0x3e, 0xff, 0xbe, 0x73, 0xe6, 0x9c, 0x39, 0x63, 0xf8, 0x35, 0x6a, + 0x35, 0xe9, 0xe4, 0x15, 0xb1, 0xc2, 0x66, 0xb8, 0xf2, 0x09, 0x33, 0xfc, 0x80, 0x86, 0x14, 0x69, + 0x1e, 0xa1, 0xc6, 0x94, 0x19, 0x51, 0xcb, 0x10, 0x5f, 0xab, 0x3f, 0x47, 0xad, 0x66, 0x40, 0xa6, + 0x6c, 0x13, 0xab, 0xc6, 0x6e, 0x46, 0x82, 0xc8, 0xb5, 0x48, 0x73, 0x41, 0x42, 0x53, 0xca, 0x7b, + 0x1b, 0x72, 0x44, 0x02, 0x77, 0xba, 0x12, 0x1f, 0xf6, 0xdf, 0x15, 0x20, 0x7f, 0x4a, 0x4c, 0x9b, + 0x04, 0xe8, 0x09, 0x94, 0x2d, 0xea, 0x85, 0xa6, 0xeb, 0x91, 0x60, 0xec, 0xda, 0xba, 0x52, 0x57, + 0x1a, 0x6a, 0xeb, 0x37, 0x63, 0x9d, 0x38, 0xce, 0x66, 0x3c, 0x4d, 0x98, 0xfe, 0x09, 0x56, 0x53, + 0x43, 0xdf, 0x46, 0x2d, 0x28, 0xd2, 0x6b, 0xe9, 0xcd, 0x70, 0xef, 0xde, 0x6d, 0xef, 0xe0, 0x5a, + 0xf8, 0x0a, 0x1c, 0xec, 0xdb, 0xe8, 0x2f, 0xd8, 0xb1, 0x02, 0x62, 0x86, 0x2e, 0xf5, 0xc6, 0xc4, + 0xa7, 0x96, 0xa3, 0x67, 0xeb, 0x4a, 0x63, 0x1b, 0x57, 0x12, 0xb5, 0x1b, 0x8b, 0xa8, 0x0d, 0x85, + 0x88, 0x04, 0xcc, 0xa5, 0x9e, 0xbe, 0xcd, 0x23, 0x57, 0x37, 0x22, 0xcb, 0xba, 0x8c, 0x17, 0x82, + 0xc0, 0x09, 0x1a, 0x07, 0xf7, 0xcd, 0xd5, 0x9c, 0x9a, 0xf6, 0x78, 0x4e, 0xbc, 0x59, 0xe8, 0xe8, + 0x39, 0x11, 0x5c, 0xaa, 0x67, 0x5c, 0x44, 0x7f, 0x42, 0x39, 0xc1, 0x1c, 0x93, 0x39, 0x7a, 0xbe, + 0xae, 0x34, 0xca, 0x58, 0x95, 0xda, 0xa9, 0xc9, 0x1c, 0x74, 0x04, 0xaa, 0x68, 0xfa, 0x38, 0xee, + 0xb5, 0x5e, 0xa8, 0x2b, 0x8d, 0x9d, 0xd6, 0xef, 0xc6, 0xed, 0x23, 0x31, 0x06, 0xfc, 0x31, 0x5a, + 0xf9, 0x04, 0x03, 0x4d, 0xdf, 0xd1, 0xdf, 0xa0, 0x39, 0x74, 0x41, 0x17, 0x34, 0xf0, 0x1d, 0xd7, + 0x12, 0x59, 0x8a, 0x3c, 0xcb, 0xee, 0x86, 0xce, 0x33, 0x9d, 0x40, 0x85, 0x11, 0x16, 0x6f, 0x7f, + 0x1c, 0xd2, 0x2b, 0xe2, 0xe9, 0x25, 0x5e, 0xef, 0x1f, 0xdf, 0xa8, 0x77, 0x28, 0xb8, 0x51, 0x8c, + 0xe1, 0x32, 0xdb, 0x58, 0xa1, 0x63, 0x00, 0x33, 0x0c, 0x03, 0x77, 0xb2, 0x0c, 0x09, 0xd3, 0xa1, + 0x9e, 0x6d, 0xa8, 0xad, 0xfd, 0xbb, 0xdb, 0x15, 0x07, 0x6f, 0x74, 0x12, 0x14, 0x6f, 0xb8, 0x50, + 0x1b, 0x72, 0xcc, 0x9f, 0xbb, 0xa1, 0xae, 0xf2, 0x1d, 0xd4, 0xee, 0xb5, 0x0f, 0x63, 0x0a, 0x0b, + 0xb8, 0x7a, 0x08, 0xa5, 0x34, 0x1c, 0xd2, 0x20, 0x7b, 0x45, 0x56, 0x7c, 0x90, 0x4a, 0x38, 0x7e, + 0x45, 0xbf, 0x40, 0x2e, 0x32, 0xe7, 0x4b, 0xc2, 0x07, 0xa4, 0x84, 0xc5, 0xa2, 0xfa, 0x36, 0x03, + 0x39, 0x1e, 0x05, 0xfd, 0x07, 0x79, 0xdf, 0x0c, 0x88, 0x17, 0xca, 0xe9, 0xd3, 0xef, 0x4c, 0x10, + 0x4f, 0xdd, 0x3f, 0xc1, 0x92, 0x43, 0x6d, 0x28, 0xfa, 0x01, 0x89, 0x5c, 0xba, 0x64, 0x72, 0xea, + 0xee, 0xf7, 0xa4, 0x24, 0xea, 0x81, 0x26, 0xfc, 0x63, 0xe6, 0xce, 0x3c, 0x33, 0x5c, 0x06, 0x84, + 0x4f, 0x9e, 0xfa, 0xd5, 0xa9, 0xa6, 0x9d, 0x4e, 0x18, 0xbc, 0x2b, 0x5c, 0xa9, 0x80, 0x8e, 0xa0, + 0x22, 0x03, 0x39, 0xbc, 0x1b, 0x72, 0x3e, 0xf5, 0xfb, 0xba, 0x85, 0xcb, 0x02, 0x97, 0x77, 0xae, + 0x0d, 0x45, 0xcb, 0x71, 0xe7, 0x76, 0x40, 0x3c, 0x3d, 0xc7, 0x8f, 0xe9, 0x81, 0xdd, 0x27, 0xe4, + 0xfe, 0x7b, 0x05, 0xf2, 0x42, 0x46, 0xff, 0x43, 0x49, 0x4e, 0x66, 0x7a, 0x63, 0x1f, 0x88, 0x20, + 0xd0, 0xbe, 0x8d, 0x1e, 0x41, 0x69, 0x5d, 0x78, 0xe6, 0x07, 0x0a, 0x5f, 0xe3, 0xf1, 0x19, 0xc9, + 0x5a, 0xb3, 0xdf, 0xa9, 0x55, 0x72, 0x48, 0x87, 0x82, 0xbc, 0x4d, 0xbc, 0x3d, 0x65, 0x9c, 0x2c, + 0xff, 0x79, 0x0c, 0xb0, 0xbe, 0x33, 0x48, 0x85, 0x02, 0xee, 0xf6, 0x2e, 0xcf, 0x3a, 0x58, 0xdb, + 0x42, 0x15, 0x28, 0x8d, 0x06, 0xcf, 0x8f, 0x87, 0xa3, 0xc1, 0x79, 0x57, 0x53, 0xd0, 0x4f, 0x50, + 0x19, 0x8e, 0x06, 0xb8, 0xd3, 0xeb, 0x8e, 0x7b, 0x78, 0x70, 0x79, 0xa1, 0x65, 0x8e, 0x2f, 0x3e, + 0xdc, 0xd4, 0x94, 0x8f, 0x37, 0x35, 0xe5, 0xd3, 0x4d, 0x4d, 0x79, 0xfd, 0xb9, 0xb6, 0xf5, 0xf2, + 0xdf, 0x99, 0x1b, 0x3a, 0xcb, 0x89, 0x61, 0xd1, 0x45, 0xd3, 0x63, 0xbe, 0x65, 0x1d, 0xd8, 0x24, + 0x6a, 0x7a, 0x84, 0x4e, 0xd9, 0x81, 0xe9, 0xbb, 0x07, 0x33, 0xda, 0x4c, 0xff, 0xae, 0x6f, 0x32, + 0xda, 0x39, 0xa1, 0xcf, 0x86, 0x46, 0xe7, 0xa2, 0x2f, 0x5b, 0x34, 0xc9, 0xf3, 0x9f, 0xe2, 0xe1, + 0x97, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0xd0, 0xe4, 0x6c, 0x84, 0x05, 0x00, 0x00, } func (m *Header) Marshal() (dAtA []byte, err error) { @@ -1020,7 +1021,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.ContainerId == nil { - m.ContainerId = &v2.ContainerID{} + m.ContainerId = &refs.ContainerID{} } if err := m.ContainerId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -1056,7 +1057,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.OwnerId == nil { - m.OwnerId = &v2.OwnerID{} + m.OwnerId = &refs.OwnerID{} } if err := m.OwnerId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -1111,7 +1112,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.Version == nil { - m.Version = &v21.Version{} + m.Version = &service.Version{} } if err := m.Version.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -1253,7 +1254,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.SessionToken == nil { - m.SessionToken = &v21.SessionToken{} + m.SessionToken = &service.SessionToken{} } if err := m.SessionToken.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -1531,7 +1532,7 @@ func (m *Header_Split) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.Parent == nil { - m.Parent = &v2.ObjectID{} + m.Parent = &refs.ObjectID{} } if err := m.Parent.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -1567,7 +1568,7 @@ func (m *Header_Split) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.Previous == nil { - m.Previous = &v2.ObjectID{} + m.Previous = &refs.ObjectID{} } if err := m.Previous.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -1603,7 +1604,7 @@ func (m *Header_Split) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.ParentSignature == nil { - m.ParentSignature = &v21.Signature{} + m.ParentSignature = &service.Signature{} } if err := m.ParentSignature.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -1674,7 +1675,7 @@ func (m *Header_Split) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Children = append(m.Children, &v2.ObjectID{}) + m.Children = append(m.Children, &refs.ObjectID{}) if err := m.Children[len(m.Children)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -1763,7 +1764,7 @@ func (m *Object) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.ObjectId == nil { - m.ObjectId = &v2.ObjectID{} + m.ObjectId = &refs.ObjectID{} } if err := m.ObjectId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -1799,7 +1800,7 @@ func (m *Object) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.Signature == nil { - m.Signature = &v21.Signature{} + m.Signature = &service.Signature{} } if err := m.Signature.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err diff --git a/object/v2/types.proto b/v2/object/types.proto similarity index 71% rename from object/v2/types.proto rename to v2/object/types.proto index 9462bc0..2881f0f 100644 --- a/object/v2/types.proto +++ b/v2/object/types.proto @@ -1,13 +1,13 @@ syntax = "proto3"; -package object.v2; +package neo.fs.v2.object; -option go_package = "github.com/nspcc-dev/neofs-api-go/object/v2"; +option go_package = "github.com/nspcc-dev/neofs-api-go/v2/object"; option csharp_namespace = "NeoFS.API.Object"; -import "refs/v2/types.proto"; -import "service/v2/meta.proto"; -import "service/v2/verify.proto"; +import "v2/refs/types.proto"; +import "v2/service/meta.proto"; +import "v2/service/verify.proto"; // Type of the object payload content enum ObjectType { @@ -21,14 +21,14 @@ enum ObjectType { message Header { // Object's container - refs.v2.ContainerID container_id = 1; + neo.fs.v2.refs.ContainerID container_id = 1; // Object's owner - refs.v2.OwnerID owner_id = 2; + neo.fs.v2.refs.OwnerID owner_id = 2; // Epoch when the object was created uint64 creation_epoch = 3; // Object format version. // Effectively the version of API library used to create particular object - service.v2.Version version = 4; + neo.fs.v2.service.Version version = 4; // Size of payload in bytes. // 0xFFFFFFFFFFFFFFFF means `payload_length` is unknown uint64 payload_length = 5; @@ -39,7 +39,7 @@ message Header { bytes homomorphic_hash = 8; // Session token, if it was used during Object creation. // Need it to verify integrity and authenticity out of Request scope. - service.v2.SessionToken session_token = 9; + neo.fs.v2.service.SessionToken session_token = 9; // Attribute groups the user-defined Key-Value pairs attached to the object message Attribute { @@ -52,18 +52,18 @@ message Header { // Information about spawning the objects through a payload splitting. message Split { - // Identifier of the origin object.v2. - // Parent and children objects must be within the same container.v2. + // Identifier of the origin object. + // Parent and children objects must be within the same container. // Parent object_id is known only to the minor child. - refs.v2.ObjectID parent = 1; + neo.fs.v2.refs.ObjectID parent = 1; // Previous carries identifier of the left split neighbor. - refs.v2.ObjectID previous = 2; - // `signature` field of the parent object.v2. Used to reconstruct parent. - service.v2.Signature parent_signature = 3; - // `header` field of the parent object.v2. Used to reconstruct parent. + neo.fs.v2.refs.ObjectID previous = 2; + // `signature` field of the parent object. Used to reconstruct parent. + neo.fs.v2.service.Signature parent_signature = 3; + // `header` field of the parent object. Used to reconstruct parent. Header parent_header = 4; // Children carries list of identifiers of the objects generated by splitting the current. - repeated refs.v2.ObjectID children = 5; + repeated neo.fs.v2.refs.ObjectID children = 5; } // Position of the object in the split hierarchy. Split split = 11; @@ -75,9 +75,9 @@ message Object { // Object is content-addressed. It means id will change if header or payload // changes. It's calculated as a hash of header field, which contains hash of // object's payload - refs.v2.ObjectID object_id = 1; + neo.fs.v2.refs.ObjectID object_id = 1; // Signed object_id - service.v2.Signature signature = 2; + neo.fs.v2.service.Signature signature = 2; // Object metadata headers Header header = 3; // Payload bytes. diff --git a/refs/v2/marshal.go b/v2/refs/marshal.go similarity index 98% rename from refs/v2/marshal.go rename to v2/refs/marshal.go index e2abec1..3503a44 100644 --- a/refs/v2/marshal.go +++ b/v2/refs/marshal.go @@ -1,4 +1,4 @@ -package v2 +package refs import ( "encoding/binary" diff --git a/refs/v2/marshal_test.go b/v2/refs/marshal_test.go similarity index 98% rename from refs/v2/marshal_test.go rename to v2/refs/marshal_test.go index c38b3ec..7bf3d6f 100644 --- a/refs/v2/marshal_test.go +++ b/v2/refs/marshal_test.go @@ -1,4 +1,4 @@ -package v2 +package refs import ( "crypto/rand" diff --git a/refs/v2/types.go b/v2/refs/types.go similarity index 98% rename from refs/v2/types.go rename to v2/refs/types.go index 9381202..357b4da 100644 --- a/refs/v2/types.go +++ b/v2/refs/types.go @@ -1,4 +1,4 @@ -package v2 +package refs // SetValue sets container identifier in a binary format. func (m *ContainerID) SetValue(v []byte) { diff --git a/refs/v2/types.pb.go b/v2/refs/types.pb.go similarity index 90% rename from refs/v2/types.pb.go rename to v2/refs/types.pb.go index c76f97c..d5ecec6 100644 --- a/refs/v2/types.pb.go +++ b/v2/refs/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: refs/v2/types.proto +// source: v2/refs/types.proto -package v2 +package refs import ( fmt "fmt" @@ -37,7 +37,7 @@ func (m *Address) Reset() { *m = Address{} } func (m *Address) String() string { return proto.CompactTextString(m) } func (*Address) ProtoMessage() {} func (*Address) Descriptor() ([]byte, []int) { - return fileDescriptor_e9faa6bee2355acc, []int{0} + return fileDescriptor_8ea16029b13f1cfa, []int{0} } func (m *Address) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -93,7 +93,7 @@ func (m *ObjectID) Reset() { *m = ObjectID{} } func (m *ObjectID) String() string { return proto.CompactTextString(m) } func (*ObjectID) ProtoMessage() {} func (*ObjectID) Descriptor() ([]byte, []int) { - return fileDescriptor_e9faa6bee2355acc, []int{1} + return fileDescriptor_8ea16029b13f1cfa, []int{1} } func (m *ObjectID) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -142,7 +142,7 @@ func (m *ContainerID) Reset() { *m = ContainerID{} } func (m *ContainerID) String() string { return proto.CompactTextString(m) } func (*ContainerID) ProtoMessage() {} func (*ContainerID) Descriptor() ([]byte, []int) { - return fileDescriptor_e9faa6bee2355acc, []int{2} + return fileDescriptor_8ea16029b13f1cfa, []int{2} } func (m *ContainerID) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -178,7 +178,7 @@ func (m *ContainerID) GetValue() []byte { return nil } -// OwnerID group information about the owner of the NeoFS container.v2. +// OwnerID group information about the owner of the NeoFS container. type OwnerID struct { // value carries the identifier of the container owner in a binary format. Value []byte `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` @@ -191,7 +191,7 @@ func (m *OwnerID) Reset() { *m = OwnerID{} } func (m *OwnerID) String() string { return proto.CompactTextString(m) } func (*OwnerID) ProtoMessage() {} func (*OwnerID) Descriptor() ([]byte, []int) { - return fileDescriptor_e9faa6bee2355acc, []int{3} + return fileDescriptor_8ea16029b13f1cfa, []int{3} } func (m *OwnerID) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -228,32 +228,32 @@ func (m *OwnerID) GetValue() []byte { } func init() { - proto.RegisterType((*Address)(nil), "refs.v2.Address") - proto.RegisterType((*ObjectID)(nil), "refs.v2.ObjectID") - proto.RegisterType((*ContainerID)(nil), "refs.v2.ContainerID") - proto.RegisterType((*OwnerID)(nil), "refs.v2.OwnerID") + proto.RegisterType((*Address)(nil), "neo.fs.v2.refs.Address") + proto.RegisterType((*ObjectID)(nil), "neo.fs.v2.refs.ObjectID") + proto.RegisterType((*ContainerID)(nil), "neo.fs.v2.refs.ContainerID") + proto.RegisterType((*OwnerID)(nil), "neo.fs.v2.refs.OwnerID") } -func init() { proto.RegisterFile("refs/v2/types.proto", fileDescriptor_e9faa6bee2355acc) } +func init() { proto.RegisterFile("v2/refs/types.proto", fileDescriptor_8ea16029b13f1cfa) } -var fileDescriptor_e9faa6bee2355acc = []byte{ - // 247 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x2e, 0x4a, 0x4d, 0x2b, - 0xd6, 0x2f, 0x33, 0xd2, 0x2f, 0xa9, 0x2c, 0x48, 0x2d, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, - 0x62, 0x07, 0x09, 0xea, 0x95, 0x19, 0x29, 0x15, 0x71, 0xb1, 0x3b, 0xa6, 0xa4, 0x14, 0xa5, 0x16, - 0x17, 0x0b, 0x99, 0x73, 0xf1, 0x24, 0xe7, 0xe7, 0x95, 0x24, 0x66, 0xe6, 0xa5, 0x16, 0xc5, 0x67, - 0xa6, 0x48, 0x30, 0x2a, 0x30, 0x6a, 0x70, 0x1b, 0x89, 0xe8, 0x41, 0x95, 0xea, 0x39, 0xc3, 0x24, - 0x3d, 0x5d, 0x82, 0xb8, 0xe1, 0x2a, 0x3d, 0x53, 0x84, 0xf4, 0xb8, 0x38, 0xf3, 0x93, 0xb2, 0x52, - 0x93, 0x4b, 0x40, 0xba, 0x98, 0xc0, 0xba, 0x04, 0xe1, 0xba, 0xfc, 0xc1, 0x32, 0x9e, 0x2e, 0x41, - 0x1c, 0x10, 0x35, 0x9e, 0x29, 0x4a, 0x0a, 0x5c, 0x1c, 0x30, 0x51, 0x21, 0x11, 0x2e, 0xd6, 0xb2, - 0xc4, 0x9c, 0xd2, 0x54, 0xb0, 0x6d, 0x3c, 0x41, 0x10, 0x8e, 0x92, 0x32, 0x17, 0x37, 0x92, 0x6d, - 0x38, 0x14, 0xc9, 0x73, 0xb1, 0xfb, 0x97, 0xe3, 0x51, 0xe0, 0xe4, 0x73, 0xe2, 0x91, 0x1c, 0xe3, - 0x85, 0x47, 0x72, 0x8c, 0x0f, 0x1e, 0xc9, 0x31, 0xce, 0x78, 0x2c, 0xc7, 0x10, 0xa5, 0x99, 0x9e, - 0x59, 0x92, 0x51, 0x9a, 0xa4, 0x97, 0x9c, 0x9f, 0xab, 0x9f, 0x57, 0x5c, 0x90, 0x9c, 0xac, 0x9b, - 0x92, 0x5a, 0xa6, 0x9f, 0x97, 0x9a, 0x9f, 0x56, 0xac, 0x9b, 0x58, 0x90, 0xa9, 0x9b, 0x9e, 0xaf, - 0x0f, 0x0d, 0xad, 0x55, 0x4c, 0x7c, 0x7e, 0xa9, 0xf9, 0x6e, 0xc1, 0x7a, 0x8e, 0x01, 0x9e, 0x7a, - 0x41, 0xa9, 0x69, 0xc5, 0x49, 0x6c, 0xe0, 0x90, 0x33, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0xd2, - 0xd4, 0x5b, 0x91, 0x50, 0x01, 0x00, 0x00, +var fileDescriptor_8ea16029b13f1cfa = []byte{ + // 256 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x2e, 0x33, 0xd2, 0x2f, + 0x4a, 0x4d, 0x2b, 0xd6, 0x2f, 0xa9, 0x2c, 0x48, 0x2d, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, + 0xe2, 0xcb, 0x4b, 0xcd, 0xd7, 0x4b, 0x2b, 0xd6, 0x2b, 0x33, 0xd2, 0x03, 0xc9, 0x29, 0x35, 0x30, + 0x72, 0xb1, 0x3b, 0xa6, 0xa4, 0x14, 0xa5, 0x16, 0x17, 0x0b, 0xd9, 0x71, 0xf1, 0x24, 0xe7, 0xe7, + 0x95, 0x24, 0x66, 0xe6, 0xa5, 0x16, 0xc5, 0x67, 0xa6, 0x48, 0x30, 0x2a, 0x30, 0x6a, 0x70, 0x1b, + 0x49, 0xeb, 0xa1, 0x6a, 0xd1, 0x73, 0x86, 0xa9, 0xf1, 0x74, 0x09, 0xe2, 0x86, 0x6b, 0xf0, 0x4c, + 0x11, 0x32, 0xe5, 0xe2, 0xcc, 0x4f, 0xca, 0x4a, 0x4d, 0x2e, 0x01, 0x69, 0x66, 0x02, 0x6b, 0x96, + 0x40, 0xd7, 0xec, 0x0f, 0x56, 0xe0, 0xe9, 0x12, 0xc4, 0x01, 0x51, 0xea, 0x99, 0xa2, 0xa4, 0xc0, + 0xc5, 0x01, 0x13, 0x15, 0x12, 0xe1, 0x62, 0x2d, 0x4b, 0xcc, 0x29, 0x4d, 0x05, 0xdb, 0xcd, 0x13, + 0x04, 0xe1, 0x28, 0x29, 0x73, 0x71, 0x23, 0x59, 0x8a, 0x43, 0x91, 0x3c, 0x17, 0xbb, 0x7f, 0x39, + 0x1e, 0x05, 0x4e, 0x3e, 0x27, 0x1e, 0xc9, 0x31, 0x5e, 0x78, 0x24, 0xc7, 0xf8, 0xe0, 0x91, 0x1c, + 0xe3, 0x8c, 0xc7, 0x72, 0x0c, 0x51, 0x9a, 0xe9, 0x99, 0x25, 0x19, 0xa5, 0x49, 0x7a, 0xc9, 0xf9, + 0xb9, 0xfa, 0x79, 0xc5, 0x05, 0xc9, 0xc9, 0xba, 0x29, 0xa9, 0x65, 0xfa, 0x79, 0xa9, 0xf9, 0x69, + 0xc5, 0xba, 0x89, 0x05, 0x99, 0xba, 0xe9, 0xf9, 0xfa, 0xd0, 0x30, 0x5c, 0xc5, 0xc4, 0xe7, 0x97, + 0x9a, 0xef, 0x16, 0xac, 0xe7, 0x18, 0xe0, 0xa9, 0x17, 0x94, 0x9a, 0x56, 0x9c, 0xc4, 0x06, 0x0e, + 0x4f, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x4f, 0x72, 0xf0, 0x66, 0x01, 0x00, 0x00, } func (m *Address) Marshal() (dAtA []byte, err error) { diff --git a/refs/v2/types.proto b/v2/refs/types.proto similarity index 88% rename from refs/v2/types.proto rename to v2/refs/types.proto index 82049b4..eab1044 100644 --- a/refs/v2/types.proto +++ b/v2/refs/types.proto @@ -1,8 +1,8 @@ syntax = "proto3"; -package refs.v2; +package neo.fs.v2.refs; -option go_package = "github.com/nspcc-dev/neofs-api-go/refs/v2"; +option go_package = "github.com/nspcc-dev/neofs-api-go/v2/refs"; option csharp_namespace = "NeoFS.API.Refs"; // Address of object (container id + object id) @@ -25,7 +25,7 @@ message ContainerID { bytes value = 1; } -// OwnerID group information about the owner of the NeoFS container.v2. +// OwnerID group information about the owner of the NeoFS container. message OwnerID { // value carries the identifier of the container owner in a binary format. bytes value = 1; diff --git a/service/v2/meta.go b/v2/service/meta.go similarity index 97% rename from service/v2/meta.go rename to v2/service/meta.go index b9ac619..61da3fa 100644 --- a/service/v2/meta.go +++ b/v2/service/meta.go @@ -1,8 +1,8 @@ -package v2 +package service import ( - acl "github.com/nspcc-dev/neofs-api-go/acl/v2" - refs "github.com/nspcc-dev/neofs-api-go/refs/v2" + "github.com/nspcc-dev/neofs-api-go/v2/acl" + "github.com/nspcc-dev/neofs-api-go/v2/refs" ) // SetKey sets key to the X-Header. diff --git a/service/v2/meta.pb.go b/v2/service/meta.pb.go similarity index 90% rename from service/v2/meta.pb.go rename to v2/service/meta.pb.go index 34d2eb7..88d56b3 100644 --- a/service/v2/meta.pb.go +++ b/v2/service/meta.pb.go @@ -1,13 +1,13 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: service/v2/meta.proto +// source: v2/service/meta.proto -package v2 +package service import ( fmt "fmt" proto "github.com/golang/protobuf/proto" - v21 "github.com/nspcc-dev/neofs-api-go/acl/v2" - v2 "github.com/nspcc-dev/neofs-api-go/refs/v2" + acl "github.com/nspcc-dev/neofs-api-go/v2/acl" + refs "github.com/nspcc-dev/neofs-api-go/v2/refs" io "io" math "math" math_bits "math/bits" @@ -69,7 +69,7 @@ func (x SessionToken_Body_Verb) String() string { } func (SessionToken_Body_Verb) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_44cb230373b42f12, []int{3, 0, 0} + return fileDescriptor_932e020d69aee3f0, []int{3, 0, 0} } type XHeader struct { @@ -86,7 +86,7 @@ func (m *XHeader) Reset() { *m = XHeader{} } func (m *XHeader) String() string { return proto.CompactTextString(m) } func (*XHeader) ProtoMessage() {} func (*XHeader) Descriptor() ([]byte, []int) { - return fileDescriptor_44cb230373b42f12, []int{0} + return fileDescriptor_932e020d69aee3f0, []int{0} } func (m *XHeader) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -144,7 +144,7 @@ func (m *Version) Reset() { *m = Version{} } func (m *Version) String() string { return proto.CompactTextString(m) } func (*Version) ProtoMessage() {} func (*Version) Descriptor() ([]byte, []int) { - return fileDescriptor_44cb230373b42f12, []int{1} + return fileDescriptor_932e020d69aee3f0, []int{1} } func (m *Version) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -204,7 +204,7 @@ func (m *TokenLifetime) Reset() { *m = TokenLifetime{} } func (m *TokenLifetime) String() string { return proto.CompactTextString(m) } func (*TokenLifetime) ProtoMessage() {} func (*TokenLifetime) Descriptor() ([]byte, []int) { - return fileDescriptor_44cb230373b42f12, []int{2} + return fileDescriptor_932e020d69aee3f0, []int{2} } func (m *TokenLifetime) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -269,7 +269,7 @@ func (m *SessionToken) Reset() { *m = SessionToken{} } func (m *SessionToken) String() string { return proto.CompactTextString(m) } func (*SessionToken) ProtoMessage() {} func (*SessionToken) Descriptor() ([]byte, []int) { - return fileDescriptor_44cb230373b42f12, []int{3} + return fileDescriptor_932e020d69aee3f0, []int{3} } func (m *SessionToken) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -316,9 +316,9 @@ type SessionToken_Body struct { // ID is a token identifier. valid UUIDv4 represented in bytes Id []byte `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` // OwnerID carries identifier of the session initiator. - OwnerId *v2.OwnerID `protobuf:"bytes,2,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"` + OwnerId *refs.OwnerID `protobuf:"bytes,2,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"` // Verb is a type of request for which the token is issued - Verb SessionToken_Body_Verb `protobuf:"varint,3,opt,name=verb,proto3,enum=service.v2.SessionToken_Body_Verb" json:"verb,omitempty"` + Verb SessionToken_Body_Verb `protobuf:"varint,3,opt,name=verb,proto3,enum=neo.fs.v2.service.SessionToken_Body_Verb" json:"verb,omitempty"` // Lifetime is a lifetime of the session Lifetime *TokenLifetime `protobuf:"bytes,4,opt,name=lifetime,proto3" json:"lifetime,omitempty"` // SessionKey is a public key of session key @@ -337,7 +337,7 @@ func (m *SessionToken_Body) Reset() { *m = SessionToken_Body{} } func (m *SessionToken_Body) String() string { return proto.CompactTextString(m) } func (*SessionToken_Body) ProtoMessage() {} func (*SessionToken_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_44cb230373b42f12, []int{3, 0} + return fileDescriptor_932e020d69aee3f0, []int{3, 0} } func (m *SessionToken_Body) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -373,7 +373,7 @@ type isSessionToken_Body_Context interface { } type SessionToken_Body_ObjectAddress struct { - ObjectAddress *v2.Address `protobuf:"bytes,6,opt,name=object_address,json=objectAddress,proto3,oneof" json:"object_address,omitempty"` + ObjectAddress *refs.Address `protobuf:"bytes,6,opt,name=object_address,json=objectAddress,proto3,oneof" json:"object_address,omitempty"` } func (*SessionToken_Body_ObjectAddress) isSessionToken_Body_Context() {} @@ -392,7 +392,7 @@ func (m *SessionToken_Body) GetId() []byte { return nil } -func (m *SessionToken_Body) GetOwnerId() *v2.OwnerID { +func (m *SessionToken_Body) GetOwnerId() *refs.OwnerID { if m != nil { return m.OwnerId } @@ -420,7 +420,7 @@ func (m *SessionToken_Body) GetSessionKey() []byte { return nil } -func (m *SessionToken_Body) GetObjectAddress() *v2.Address { +func (m *SessionToken_Body) GetObjectAddress() *refs.Address { if x, ok := m.GetContext().(*SessionToken_Body_ObjectAddress); ok { return x.ObjectAddress } @@ -449,7 +449,7 @@ func (m *BearerToken) Reset() { *m = BearerToken{} } func (m *BearerToken) String() string { return proto.CompactTextString(m) } func (*BearerToken) ProtoMessage() {} func (*BearerToken) Descriptor() ([]byte, []int) { - return fileDescriptor_44cb230373b42f12, []int{4} + return fileDescriptor_932e020d69aee3f0, []int{4} } func (m *BearerToken) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -494,9 +494,9 @@ func (m *BearerToken) GetSignature() *Signature { type BearerToken_Body struct { // EACLTable carries table of extended ACL rules - EaclTable *v21.EACLTable `protobuf:"bytes,1,opt,name=eacl_table,json=eaclTable,proto3" json:"eacl_table,omitempty"` + EaclTable *acl.EACLTable `protobuf:"bytes,1,opt,name=eacl_table,json=eaclTable,proto3" json:"eacl_table,omitempty"` // OwnerID carries identifier of the token owner - OwnerId *v2.OwnerID `protobuf:"bytes,2,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"` + OwnerId *refs.OwnerID `protobuf:"bytes,2,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"` // Token expiration and valid time period parameters Lifetime *TokenLifetime `protobuf:"bytes,3,opt,name=lifetime,proto3" json:"lifetime,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` @@ -508,7 +508,7 @@ func (m *BearerToken_Body) Reset() { *m = BearerToken_Body{} } func (m *BearerToken_Body) String() string { return proto.CompactTextString(m) } func (*BearerToken_Body) ProtoMessage() {} func (*BearerToken_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_44cb230373b42f12, []int{4, 0} + return fileDescriptor_932e020d69aee3f0, []int{4, 0} } func (m *BearerToken_Body) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -537,14 +537,14 @@ func (m *BearerToken_Body) XXX_DiscardUnknown() { var xxx_messageInfo_BearerToken_Body proto.InternalMessageInfo -func (m *BearerToken_Body) GetEaclTable() *v21.EACLTable { +func (m *BearerToken_Body) GetEaclTable() *acl.EACLTable { if m != nil { return m.EaclTable } return nil } -func (m *BearerToken_Body) GetOwnerId() *v2.OwnerID { +func (m *BearerToken_Body) GetOwnerId() *refs.OwnerID { if m != nil { return m.OwnerId } @@ -583,7 +583,7 @@ func (m *RequestMetaHeader) Reset() { *m = RequestMetaHeader{} } func (m *RequestMetaHeader) String() string { return proto.CompactTextString(m) } func (*RequestMetaHeader) ProtoMessage() {} func (*RequestMetaHeader) Descriptor() ([]byte, []int) { - return fileDescriptor_44cb230373b42f12, []int{5} + return fileDescriptor_932e020d69aee3f0, []int{5} } func (m *RequestMetaHeader) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -682,7 +682,7 @@ func (m *ResponseMetaHeader) Reset() { *m = ResponseMetaHeader{} } func (m *ResponseMetaHeader) String() string { return proto.CompactTextString(m) } func (*ResponseMetaHeader) ProtoMessage() {} func (*ResponseMetaHeader) Descriptor() ([]byte, []int) { - return fileDescriptor_44cb230373b42f12, []int{6} + return fileDescriptor_932e020d69aee3f0, []int{6} } func (m *ResponseMetaHeader) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -747,71 +747,73 @@ func (m *ResponseMetaHeader) GetOrigin() *ResponseMetaHeader { } func init() { - proto.RegisterEnum("service.v2.SessionToken_Body_Verb", SessionToken_Body_Verb_name, SessionToken_Body_Verb_value) - proto.RegisterType((*XHeader)(nil), "service.v2.XHeader") - proto.RegisterType((*Version)(nil), "service.v2.Version") - proto.RegisterType((*TokenLifetime)(nil), "service.v2.TokenLifetime") - proto.RegisterType((*SessionToken)(nil), "service.v2.SessionToken") - proto.RegisterType((*SessionToken_Body)(nil), "service.v2.SessionToken.Body") - proto.RegisterType((*BearerToken)(nil), "service.v2.BearerToken") - proto.RegisterType((*BearerToken_Body)(nil), "service.v2.BearerToken.Body") - proto.RegisterType((*RequestMetaHeader)(nil), "service.v2.RequestMetaHeader") - proto.RegisterType((*ResponseMetaHeader)(nil), "service.v2.ResponseMetaHeader") + proto.RegisterEnum("neo.fs.v2.service.SessionToken_Body_Verb", SessionToken_Body_Verb_name, SessionToken_Body_Verb_value) + proto.RegisterType((*XHeader)(nil), "neo.fs.v2.service.XHeader") + proto.RegisterType((*Version)(nil), "neo.fs.v2.service.Version") + proto.RegisterType((*TokenLifetime)(nil), "neo.fs.v2.service.TokenLifetime") + proto.RegisterType((*SessionToken)(nil), "neo.fs.v2.service.SessionToken") + proto.RegisterType((*SessionToken_Body)(nil), "neo.fs.v2.service.SessionToken.Body") + proto.RegisterType((*BearerToken)(nil), "neo.fs.v2.service.BearerToken") + proto.RegisterType((*BearerToken_Body)(nil), "neo.fs.v2.service.BearerToken.Body") + proto.RegisterType((*RequestMetaHeader)(nil), "neo.fs.v2.service.RequestMetaHeader") + proto.RegisterType((*ResponseMetaHeader)(nil), "neo.fs.v2.service.ResponseMetaHeader") } -func init() { proto.RegisterFile("service/v2/meta.proto", fileDescriptor_44cb230373b42f12) } +func init() { proto.RegisterFile("v2/service/meta.proto", fileDescriptor_932e020d69aee3f0) } -var fileDescriptor_44cb230373b42f12 = []byte{ - // 778 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x55, 0x4f, 0x6f, 0x1b, 0x45, - 0x14, 0xcf, 0xda, 0x6b, 0x3b, 0x7e, 0x8e, 0xc3, 0x66, 0xda, 0xaa, 0x26, 0x02, 0x53, 0xed, 0x09, - 0x09, 0xb2, 0x2e, 0x8e, 0x52, 0x89, 0xa3, 0x9d, 0x2c, 0x75, 0x20, 0xb4, 0xd5, 0xd8, 0x54, 0x88, - 0x8b, 0xb5, 0xde, 0x7d, 0x4e, 0xa6, 0x75, 0x76, 0xcc, 0xcc, 0x64, 0x89, 0x3f, 0x00, 0x1f, 0x01, - 0x89, 0x43, 0x2f, 0x5c, 0x39, 0xf3, 0x21, 0x38, 0x72, 0xe1, 0x8e, 0xc2, 0x17, 0x41, 0xf3, 0xc7, - 0xcd, 0x26, 0x55, 0x11, 0x88, 0x0b, 0xb7, 0x37, 0xbf, 0xf7, 0x7b, 0xff, 0xdf, 0xdb, 0x85, 0x7b, - 0x12, 0x45, 0xc1, 0x52, 0xec, 0x15, 0xfd, 0xde, 0x39, 0xaa, 0x24, 0x5a, 0x0a, 0xae, 0x38, 0x01, - 0x07, 0x47, 0x45, 0x7f, 0x97, 0x24, 0xe9, 0x42, 0xab, 0xd5, 0x6a, 0x89, 0xd2, 0xea, 0x77, 0xef, - 0x08, 0x9c, 0xcb, 0xdb, 0xe0, 0xfd, 0x92, 0xaf, 0x02, 0x05, 0x9b, 0xaf, 0xac, 0x22, 0xfc, 0x04, - 0x1a, 0x5f, 0x8f, 0x30, 0xc9, 0x50, 0x90, 0x00, 0xaa, 0x2f, 0x71, 0xd5, 0xf1, 0x1e, 0x78, 0x1f, - 0x36, 0xa9, 0x16, 0xc9, 0x5d, 0xa8, 0x15, 0xc9, 0xe2, 0x02, 0x3b, 0x15, 0x83, 0xd9, 0x47, 0x78, - 0x00, 0x8d, 0xe7, 0x28, 0x24, 0xe3, 0xb9, 0x26, 0x9c, 0x27, 0x2f, 0xb8, 0x30, 0x46, 0x6d, 0x6a, - 0x1f, 0x06, 0x65, 0x39, 0x17, 0xc6, 0x4c, 0xa3, 0xfa, 0x11, 0xc6, 0xd0, 0x9e, 0xf0, 0x97, 0x98, - 0x9f, 0xb0, 0x39, 0x2a, 0x76, 0x8e, 0x3a, 0x1e, 0x5e, 0x2e, 0x8d, 0xa9, 0x4f, 0xb5, 0xa8, 0x91, - 0x7c, 0x36, 0x37, 0x66, 0x3e, 0xd5, 0xa2, 0x46, 0x58, 0xa2, 0x3a, 0x55, 0x8b, 0xb0, 0x44, 0x85, - 0xaf, 0x7c, 0xd8, 0x1a, 0xa3, 0xd4, 0xe1, 0x8d, 0x3b, 0xb2, 0x0f, 0x35, 0xa5, 0x05, 0xe3, 0xa8, - 0xd5, 0x7f, 0x3f, 0xba, 0xee, 0x4f, 0x54, 0x26, 0x46, 0x43, 0x9e, 0xad, 0xa8, 0xe5, 0x92, 0x7d, - 0x68, 0x4a, 0x76, 0x9a, 0x27, 0xea, 0x42, 0xd8, 0xea, 0x5a, 0xfd, 0x7b, 0x37, 0x0c, 0xd7, 0x4a, - 0x7a, 0xcd, 0xdb, 0xfd, 0xa9, 0x0a, 0xbe, 0x76, 0x42, 0xb6, 0xa1, 0xc2, 0x32, 0x13, 0x6f, 0x8b, - 0x56, 0x58, 0x46, 0x3e, 0x82, 0x4d, 0xfe, 0x5d, 0x8e, 0x62, 0xca, 0x32, 0xe7, 0x2c, 0x88, 0xf4, - 0x14, 0xb4, 0xa7, 0xa7, 0x5a, 0x71, 0x7c, 0x44, 0x1b, 0x86, 0x71, 0x9c, 0x91, 0x47, 0xe0, 0x17, - 0x28, 0x66, 0xa6, 0xa6, 0xed, 0x7e, 0xf8, 0xb7, 0xe9, 0x46, 0xcf, 0x51, 0xcc, 0xa8, 0xe1, 0x93, - 0x03, 0xd8, 0x5c, 0xb8, 0xd6, 0x75, 0x7c, 0x13, 0xe4, 0xdd, 0xb2, 0xed, 0x8d, 0xde, 0xd2, 0xd7, - 0x54, 0xf2, 0x01, 0xb4, 0xa4, 0x75, 0x3b, 0xd5, 0xd3, 0xad, 0x99, 0xa4, 0xc1, 0x41, 0x5f, 0xe0, - 0x8a, 0x7c, 0x0a, 0xdb, 0x7c, 0xf6, 0x02, 0x53, 0x35, 0x4d, 0xb2, 0x4c, 0xa0, 0x94, 0x9d, 0xfa, - 0xad, 0x12, 0x06, 0x16, 0x1f, 0x6d, 0xd0, 0xb6, 0x65, 0x3a, 0x20, 0xfc, 0xde, 0x03, 0x5f, 0x67, - 0x48, 0xb6, 0x01, 0x9e, 0x0e, 0x3f, 0x8f, 0x0f, 0x27, 0xd3, 0x67, 0x5f, 0x4d, 0x82, 0x8d, 0xd2, - 0xfb, 0x71, 0x3c, 0x09, 0x3c, 0xf2, 0x0e, 0xb4, 0xdc, 0x7b, 0x14, 0x0f, 0x8e, 0x82, 0x0a, 0xd9, - 0x81, 0xb6, 0x03, 0xc6, 0xf1, 0x80, 0x1e, 0x8e, 0x82, 0x6a, 0x09, 0x3a, 0x8a, 0x4f, 0xe2, 0x49, - 0x1c, 0xf8, 0x24, 0x80, 0x2d, 0x07, 0xd1, 0xc1, 0x93, 0xc7, 0x71, 0x50, 0x23, 0x77, 0x21, 0x28, - 0x23, 0xa3, 0xc1, 0x78, 0x14, 0xd4, 0x87, 0x4d, 0x68, 0xa4, 0x3c, 0x57, 0x78, 0xa9, 0xc2, 0x1f, - 0x2a, 0xd0, 0x1a, 0x62, 0x22, 0x50, 0xd8, 0xed, 0xe8, 0xdf, 0xdc, 0x8e, 0xf7, 0xca, 0x2d, 0x2b, - 0xf1, 0xfe, 0xfb, 0x72, 0xbc, 0xf2, 0xdc, 0x72, 0x3c, 0x04, 0xc0, 0x24, 0x5d, 0x4c, 0x55, 0x32, - 0x5b, 0xa0, 0x0b, 0xbb, 0x13, 0x25, 0xe9, 0x42, 0x9b, 0xc6, 0x83, 0xc3, 0x93, 0x89, 0x56, 0xd0, - 0xa6, 0x26, 0x19, 0xf1, 0xdf, 0xad, 0x4f, 0x79, 0x0d, 0xaa, 0xff, 0x78, 0x0d, 0xc2, 0x5f, 0x2a, - 0xb0, 0x43, 0xf1, 0xdb, 0x0b, 0x94, 0xea, 0x4b, 0x54, 0x89, 0x3b, 0xf9, 0x3d, 0x68, 0x14, 0xf6, - 0x94, 0x5d, 0xa2, 0x77, 0xca, 0xbe, 0xdc, 0x95, 0xd3, 0x35, 0x47, 0x1f, 0x36, 0x2e, 0x79, 0x7a, - 0xe6, 0x2e, 0xd4, 0x3e, 0xf4, 0x8d, 0x2a, 0xb5, 0x30, 0xc9, 0xb4, 0xa9, 0x16, 0xc9, 0x43, 0x68, - 0x5e, 0x4e, 0xcf, 0x4c, 0x08, 0xd9, 0xf1, 0x1f, 0x54, 0x6f, 0x3b, 0x76, 0x5f, 0x1c, 0xba, 0x79, - 0x69, 0x05, 0x49, 0xa2, 0xf5, 0x98, 0x6a, 0x26, 0x8d, 0xce, 0xdb, 0xae, 0x62, 0x3d, 0xa2, 0x1e, - 0xd4, 0x67, 0x66, 0x7a, 0x6e, 0x59, 0xef, 0xbf, 0x65, 0xae, 0xd4, 0xd1, 0xc8, 0x01, 0xd4, 0xb9, - 0x60, 0xa7, 0x2c, 0xef, 0x34, 0xde, 0xfc, 0x4c, 0xbc, 0xd1, 0x18, 0xea, 0xc8, 0xe1, 0xef, 0x1e, - 0x10, 0x8a, 0x72, 0xc9, 0x73, 0x89, 0xff, 0xc7, 0xbe, 0x3d, 0x7a, 0x5d, 0x96, 0x6d, 0x5c, 0xf7, - 0x66, 0x59, 0xb7, 0x13, 0x5f, 0xd7, 0x35, 0xa4, 0xbf, 0x5e, 0x75, 0xbd, 0xdf, 0xae, 0xba, 0xde, - 0x1f, 0x57, 0x5d, 0xef, 0xc7, 0x3f, 0xbb, 0x1b, 0xdf, 0x7c, 0x7c, 0xca, 0xd4, 0xd9, 0xc5, 0x2c, - 0x4a, 0xf9, 0x79, 0x2f, 0x97, 0xcb, 0x34, 0xdd, 0xcb, 0xb0, 0xe8, 0xe5, 0xc8, 0xe7, 0x72, 0x2f, - 0x59, 0xb2, 0xbd, 0x53, 0xde, 0xbb, 0xfe, 0x87, 0xfc, 0x5c, 0xd9, 0x79, 0x82, 0xfc, 0xb3, 0x71, - 0x34, 0x78, 0x76, 0x1c, 0x8d, 0x2d, 0x3c, 0xab, 0x9b, 0x3f, 0xca, 0xfe, 0x5f, 0x01, 0x00, 0x00, - 0xff, 0xff, 0x35, 0x2b, 0x57, 0xef, 0xb8, 0x06, 0x00, 0x00, +var fileDescriptor_932e020d69aee3f0 = []byte{ + // 801 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x55, 0xcd, 0x8e, 0x1b, 0x45, + 0x10, 0xde, 0xb1, 0xc7, 0xf6, 0xba, 0xbc, 0x5e, 0x66, 0x9b, 0xa0, 0x58, 0x2b, 0xe4, 0xac, 0x0c, + 0x48, 0x20, 0xb1, 0x63, 0x61, 0x08, 0x11, 0x51, 0x22, 0x61, 0xef, 0x0e, 0xf1, 0xc2, 0x92, 0x44, + 0x6d, 0x13, 0x21, 0x2e, 0xd6, 0xfc, 0x94, 0x77, 0x27, 0xf1, 0x4e, 0x9b, 0xee, 0xde, 0xc1, 0x7e, + 0x00, 0xde, 0x81, 0x67, 0xe0, 0xc6, 0x8d, 0x0b, 0x57, 0xc4, 0x91, 0x1b, 0x57, 0xb4, 0xdc, 0x78, + 0x0a, 0xd4, 0x3f, 0x4e, 0x66, 0x89, 0x97, 0x3f, 0x71, 0xc8, 0xad, 0xea, 0xeb, 0xaa, 0xaf, 0xab, + 0xaa, 0xbf, 0xa9, 0x81, 0x57, 0xf2, 0x5e, 0x57, 0x20, 0xcf, 0xd3, 0x18, 0xbb, 0x67, 0x28, 0x43, + 0x7f, 0xce, 0x99, 0x64, 0x64, 0x27, 0x43, 0xe6, 0x4f, 0x85, 0x9f, 0xf7, 0x7c, 0x7b, 0xba, 0x4b, + 0xf2, 0x5e, 0x37, 0x8c, 0x67, 0x5d, 0xb9, 0x9c, 0xa3, 0x30, 0x61, 0xbb, 0x2f, 0xe7, 0xbd, 0x2e, + 0xc7, 0xa9, 0xb8, 0x04, 0x5e, 0x2f, 0x50, 0xe6, 0xc8, 0xd3, 0xe9, 0xd2, 0x1c, 0x74, 0xde, 0x81, + 0xda, 0xe7, 0x43, 0x0c, 0x13, 0xe4, 0xc4, 0x83, 0xf2, 0x13, 0x5c, 0xb6, 0x9c, 0x3d, 0xe7, 0xcd, + 0x3a, 0x55, 0x26, 0xb9, 0x06, 0x95, 0x3c, 0x9c, 0x9d, 0x63, 0xab, 0xa4, 0x31, 0xe3, 0x74, 0x6e, + 0x42, 0xed, 0x11, 0x72, 0x91, 0xb2, 0x4c, 0x05, 0x9c, 0x85, 0x8f, 0x19, 0xd7, 0x49, 0x4d, 0x6a, + 0x1c, 0x8d, 0xa6, 0x19, 0xe3, 0x3a, 0x4d, 0xa1, 0xca, 0xe9, 0x04, 0xd0, 0x1c, 0xb3, 0x27, 0x98, + 0x1d, 0xa7, 0x53, 0x94, 0xe9, 0x19, 0xaa, 0xfb, 0x70, 0x31, 0xd7, 0xa9, 0x2e, 0x55, 0xa6, 0x42, + 0xb2, 0x68, 0xaa, 0xd3, 0x5c, 0xaa, 0x4c, 0x85, 0xa4, 0xa1, 0x6c, 0x95, 0x0d, 0x92, 0x86, 0xb2, + 0xf3, 0xa3, 0x0b, 0x5b, 0x23, 0x14, 0xea, 0x7a, 0x4d, 0x47, 0x6e, 0x43, 0x45, 0x2a, 0x43, 0x13, + 0x35, 0x7a, 0xaf, 0xfb, 0xcf, 0x8d, 0xc9, 0x2f, 0xc6, 0xfb, 0x03, 0x96, 0x2c, 0xa9, 0x49, 0x21, + 0xb7, 0xa1, 0x2e, 0xd2, 0x93, 0x2c, 0x94, 0xe7, 0xdc, 0x34, 0xd9, 0xe8, 0xbd, 0xba, 0x2e, 0x7f, + 0x15, 0x43, 0x9f, 0x85, 0xef, 0xfe, 0x50, 0x06, 0x57, 0x71, 0x91, 0x6d, 0x28, 0xa5, 0x89, 0xbe, + 0x7d, 0x8b, 0x96, 0xd2, 0x84, 0xf4, 0x60, 0x93, 0x7d, 0x95, 0x21, 0x9f, 0xa4, 0x89, 0xe5, 0xbc, + 0x5e, 0xe0, 0x54, 0x4f, 0xe3, 0x3f, 0x50, 0xe7, 0x47, 0x87, 0xb4, 0xa6, 0x03, 0x8f, 0x12, 0x72, + 0x17, 0xdc, 0x1c, 0x79, 0xa4, 0x1b, 0xdd, 0xee, 0xbd, 0xf5, 0x4f, 0x7a, 0xf0, 0x1f, 0x21, 0x8f, + 0xa8, 0x4e, 0x23, 0x77, 0x60, 0x73, 0x66, 0xc7, 0xda, 0x72, 0xf5, 0x95, 0x7b, 0x6b, 0x28, 0x2e, + 0x8d, 0x9f, 0x3e, 0xcd, 0x20, 0x37, 0xa0, 0x21, 0x0c, 0xfb, 0x44, 0x09, 0xa0, 0xa2, 0x3b, 0x01, + 0x0b, 0x7d, 0x82, 0x4b, 0xf2, 0x21, 0x6c, 0xb3, 0xe8, 0x31, 0xc6, 0x72, 0x12, 0x26, 0x09, 0x47, + 0x21, 0x5a, 0xd5, 0xf5, 0x7d, 0xf5, 0xcd, 0xf1, 0x70, 0x83, 0x36, 0x4d, 0x82, 0x05, 0x3a, 0x5f, + 0x3b, 0xe0, 0xaa, 0x7a, 0xc9, 0x36, 0xc0, 0x83, 0xc1, 0xc7, 0xc1, 0xc1, 0x78, 0xf2, 0xf0, 0xb3, + 0xb1, 0xb7, 0x51, 0xf0, 0xef, 0x05, 0x63, 0xcf, 0x21, 0x2f, 0x41, 0xc3, 0xfa, 0xc3, 0xa0, 0x7f, + 0xe8, 0x95, 0xc8, 0x0e, 0x34, 0x2d, 0x30, 0x0a, 0xfa, 0xf4, 0x60, 0xe8, 0x95, 0x0b, 0xd0, 0x61, + 0x70, 0x1c, 0x8c, 0x03, 0xcf, 0x25, 0x1e, 0x6c, 0x59, 0x88, 0xf6, 0xef, 0xdf, 0x0b, 0xbc, 0x0a, + 0xb9, 0x06, 0x5e, 0x11, 0x19, 0xf6, 0x47, 0x43, 0xaf, 0x3a, 0xa8, 0x43, 0x2d, 0x66, 0x99, 0xc4, + 0x85, 0xec, 0x7c, 0x5f, 0x82, 0xc6, 0x00, 0x43, 0x8e, 0xdc, 0xe8, 0xe8, 0x83, 0xcb, 0x3a, 0x7a, + 0x6d, 0xcd, 0x00, 0x0b, 0xe1, 0xff, 0x9b, 0x8c, 0xbe, 0x73, 0xac, 0x8c, 0x6e, 0x01, 0x60, 0x18, + 0xcf, 0x26, 0x32, 0x8c, 0x66, 0x68, 0x8b, 0x68, 0x15, 0x58, 0xc2, 0x78, 0xe6, 0x07, 0xfd, 0x83, + 0xe3, 0xb1, 0x3a, 0xa7, 0x75, 0x15, 0xab, 0xcd, 0xff, 0xa4, 0xb7, 0xa2, 0x60, 0xca, 0xff, 0x56, + 0x30, 0x9d, 0x5f, 0x4a, 0xb0, 0x43, 0xf1, 0xcb, 0x73, 0x14, 0xf2, 0x53, 0x94, 0xa1, 0xdd, 0x1f, + 0xef, 0x41, 0x2d, 0x37, 0x7b, 0xc1, 0x56, 0xbf, 0xbb, 0x86, 0xd2, 0x6e, 0x0e, 0xba, 0x0a, 0x55, + 0xcb, 0x02, 0xe7, 0x2c, 0x3e, 0xb5, 0x5f, 0xbd, 0x71, 0xd4, 0x77, 0x2f, 0xe5, 0x4c, 0x97, 0xd6, + 0xa4, 0xca, 0x24, 0xb7, 0xa0, 0xbe, 0x98, 0x9c, 0xea, 0x9b, 0x44, 0xcb, 0xdd, 0x2b, 0x5f, 0xc1, + 0x6f, 0x97, 0x19, 0xdd, 0x5c, 0x18, 0x43, 0x90, 0x9b, 0xab, 0x77, 0xad, 0xe8, 0xa2, 0x6e, 0xfc, + 0xcd, 0xb7, 0xb5, 0x7a, 0xd3, 0xf7, 0xa1, 0x1a, 0xe9, 0xe7, 0xb6, 0x5a, 0x6f, 0xff, 0xb5, 0x1e, + 0xa8, 0x8d, 0x26, 0x77, 0xa0, 0xca, 0x78, 0x7a, 0x92, 0x66, 0xad, 0xda, 0x95, 0xfb, 0xe8, 0xb9, + 0xd9, 0x51, 0x9b, 0xd3, 0xf9, 0xdd, 0x01, 0x42, 0x51, 0xcc, 0x59, 0x26, 0xf0, 0xc5, 0x1f, 0xed, + 0xdd, 0xa7, 0xbd, 0x9a, 0xd9, 0xbe, 0xb1, 0xb6, 0xd7, 0x3f, 0x77, 0xb3, 0x6a, 0x76, 0x40, 0x7f, + 0xba, 0x68, 0x3b, 0x3f, 0x5f, 0xb4, 0x9d, 0x5f, 0x2f, 0xda, 0xce, 0x37, 0xbf, 0xb5, 0x37, 0xbe, + 0x78, 0xfb, 0x24, 0x95, 0xa7, 0xe7, 0x91, 0x1f, 0xb3, 0xb3, 0x6e, 0x26, 0xe6, 0x71, 0xbc, 0x9f, + 0x60, 0xde, 0xcd, 0x90, 0x4d, 0xc5, 0x7e, 0x38, 0x4f, 0xf7, 0x4f, 0x58, 0xf7, 0xd9, 0x8f, 0xec, + 0xdb, 0xd2, 0xce, 0x7d, 0x64, 0x1f, 0x8d, 0xfc, 0xfe, 0xc3, 0x23, 0x7f, 0x64, 0xb0, 0xa8, 0xaa, + 0x7f, 0x6b, 0xef, 0xfe, 0x11, 0x00, 0x00, 0xff, 0xff, 0x1a, 0xf8, 0x0e, 0x53, 0x44, 0x07, 0x00, + 0x00, } func (m *XHeader) Marshal() (dAtA []byte, err error) { @@ -2171,7 +2173,7 @@ func (m *SessionToken_Body) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.OwnerId == nil { - m.OwnerId = &v2.OwnerID{} + m.OwnerId = &refs.OwnerID{} } if err := m.OwnerId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -2295,7 +2297,7 @@ func (m *SessionToken_Body) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &v2.Address{} + v := &refs.Address{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -2511,7 +2513,7 @@ func (m *BearerToken_Body) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.EaclTable == nil { - m.EaclTable = &v21.EACLTable{} + m.EaclTable = &acl.EACLTable{} } if err := m.EaclTable.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -2547,7 +2549,7 @@ func (m *BearerToken_Body) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.OwnerId == nil { - m.OwnerId = &v2.OwnerID{} + m.OwnerId = &refs.OwnerID{} } if err := m.OwnerId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err diff --git a/service/v2/meta.proto b/v2/service/meta.proto similarity index 89% rename from service/v2/meta.proto rename to v2/service/meta.proto index c1a4ddf..203e7ce 100644 --- a/service/v2/meta.proto +++ b/v2/service/meta.proto @@ -1,13 +1,13 @@ syntax = "proto3"; -package service.v2; +package neo.fs.v2.service; -option go_package = "github.com/nspcc-dev/neofs-api-go/service/v2"; +option go_package = "github.com/nspcc-dev/neofs-api-go/v2/service"; option csharp_namespace = "NeoFS.API.Service"; -import "acl/v2/types.proto"; -import "refs/v2/types.proto"; -import "service/v2/verify.proto"; +import "v2/acl/types.proto"; +import "v2/refs/types.proto"; +import "v2/service/verify.proto"; message XHeader { // Key of the X-Header. @@ -40,7 +40,7 @@ message SessionToken { // ID is a token identifier. valid UUIDv4 represented in bytes bytes id = 1; // OwnerID carries identifier of the session initiator. - refs.v2.OwnerID owner_id = 2; + neo.fs.v2.refs.OwnerID owner_id = 2; // Verb is an enumeration of session request types enum Verb { // Refers to object.Put RPC call @@ -67,7 +67,7 @@ message SessionToken { // Carries context of the session. oneof context { // object_address represents the object session context. - refs.v2.Address object_address = 6; + neo.fs.v2.refs.Address object_address = 6; } } // Session Token body @@ -81,9 +81,9 @@ message SessionToken { message BearerToken { message Body { // EACLTable carries table of extended ACL rules - acl.v2.EACLTable eacl_table = 1; + neo.fs.v2.acl.EACLTable eacl_table = 1; // OwnerID carries identifier of the token owner - refs.v2.OwnerID owner_id = 2; + neo.fs.v2.refs.OwnerID owner_id = 2; // Token expiration and valid time period parameters TokenLifetime lifetime = 3; } diff --git a/service/v2/verify.go b/v2/service/verify.go similarity index 99% rename from service/v2/verify.go rename to v2/service/verify.go index 8e7e2cf..c9081fd 100644 --- a/service/v2/verify.go +++ b/v2/service/verify.go @@ -1,4 +1,4 @@ -package v2 +package service // SetKey sets public key in a binary format. func (m *Signature) SetKey(v []byte) { diff --git a/service/v2/verify.pb.go b/v2/service/verify.pb.go similarity index 90% rename from service/v2/verify.pb.go rename to v2/service/verify.pb.go index 6f1cd42..34913d7 100644 --- a/service/v2/verify.pb.go +++ b/v2/service/verify.pb.go @@ -1,13 +1,11 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: service/v2/verify.proto +// source: v2/service/verify.proto -package v2 +package service import ( fmt "fmt" proto "github.com/golang/protobuf/proto" - _ "github.com/nspcc-dev/neofs-api-go/acl/v2" - _ "github.com/nspcc-dev/neofs-api-go/refs/v2" io "io" math "math" math_bits "math/bits" @@ -39,7 +37,7 @@ func (m *Signature) Reset() { *m = Signature{} } func (m *Signature) String() string { return proto.CompactTextString(m) } func (*Signature) ProtoMessage() {} func (*Signature) Descriptor() ([]byte, []int) { - return fileDescriptor_7ea2d606af3f2456, []int{0} + return fileDescriptor_848d62e0ecc8b6b6, []int{0} } func (m *Signature) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -101,7 +99,7 @@ func (m *RequestVerificationHeader) Reset() { *m = RequestVerificationHe func (m *RequestVerificationHeader) String() string { return proto.CompactTextString(m) } func (*RequestVerificationHeader) ProtoMessage() {} func (*RequestVerificationHeader) Descriptor() ([]byte, []int) { - return fileDescriptor_7ea2d606af3f2456, []int{1} + return fileDescriptor_848d62e0ecc8b6b6, []int{1} } func (m *RequestVerificationHeader) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -177,7 +175,7 @@ func (m *ResponseVerificationHeader) Reset() { *m = ResponseVerification func (m *ResponseVerificationHeader) String() string { return proto.CompactTextString(m) } func (*ResponseVerificationHeader) ProtoMessage() {} func (*ResponseVerificationHeader) Descriptor() ([]byte, []int) { - return fileDescriptor_7ea2d606af3f2456, []int{2} + return fileDescriptor_848d62e0ecc8b6b6, []int{2} } func (m *ResponseVerificationHeader) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -235,37 +233,36 @@ func (m *ResponseVerificationHeader) GetOrigin() *ResponseVerificationHeader { } func init() { - proto.RegisterType((*Signature)(nil), "service.v2.Signature") - proto.RegisterType((*RequestVerificationHeader)(nil), "service.v2.RequestVerificationHeader") - proto.RegisterType((*ResponseVerificationHeader)(nil), "service.v2.ResponseVerificationHeader") + proto.RegisterType((*Signature)(nil), "neo.fs.v2.service.Signature") + proto.RegisterType((*RequestVerificationHeader)(nil), "neo.fs.v2.service.RequestVerificationHeader") + proto.RegisterType((*ResponseVerificationHeader)(nil), "neo.fs.v2.service.ResponseVerificationHeader") } -func init() { proto.RegisterFile("service/v2/verify.proto", fileDescriptor_7ea2d606af3f2456) } +func init() { proto.RegisterFile("v2/service/verify.proto", fileDescriptor_848d62e0ecc8b6b6) } -var fileDescriptor_7ea2d606af3f2456 = []byte{ - // 339 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x2f, 0x4e, 0x2d, 0x2a, - 0xcb, 0x4c, 0x4e, 0xd5, 0x2f, 0x33, 0xd2, 0x2f, 0x4b, 0x2d, 0xca, 0x4c, 0xab, 0xd4, 0x2b, 0x28, - 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x82, 0x4a, 0xe8, 0x95, 0x19, 0x49, 0x09, 0x25, 0x26, 0xe7, 0x80, - 0x14, 0x94, 0x54, 0x16, 0xa4, 0x16, 0x43, 0xe4, 0xa5, 0x84, 0x8b, 0x52, 0xd3, 0x8a, 0xd1, 0x04, - 0x95, 0x0c, 0xb9, 0x38, 0x83, 0x33, 0xd3, 0xf3, 0x12, 0x4b, 0x4a, 0x8b, 0x52, 0x85, 0x04, 0xb8, - 0x98, 0xb3, 0x53, 0x2b, 0x25, 0x18, 0x15, 0x18, 0x35, 0x78, 0x82, 0x40, 0x4c, 0x21, 0x21, 0x2e, - 0x96, 0xe2, 0xcc, 0xf4, 0x3c, 0x09, 0x26, 0xb0, 0x10, 0x98, 0xad, 0x34, 0x83, 0x89, 0x4b, 0x32, - 0x28, 0xb5, 0xb0, 0x34, 0xb5, 0xb8, 0x24, 0x0c, 0x64, 0x7f, 0x66, 0x72, 0x62, 0x49, 0x66, 0x7e, - 0x9e, 0x47, 0x6a, 0x62, 0x4a, 0x6a, 0x91, 0x90, 0x0d, 0x17, 0x5f, 0x52, 0x7e, 0x4a, 0x65, 0x7c, - 0x31, 0xcc, 0x54, 0xb0, 0x71, 0xdc, 0x46, 0xa2, 0x7a, 0x08, 0xe7, 0xe9, 0xc1, 0xad, 0x0c, 0xe2, - 0x05, 0x29, 0x46, 0xb8, 0xc0, 0x86, 0x8b, 0x2f, 0x37, 0xb5, 0x24, 0x11, 0x49, 0x37, 0x13, 0x5e, - 0xdd, 0x20, 0xc5, 0x08, 0xdd, 0x0e, 0x5c, 0x02, 0xf9, 0x45, 0x99, 0xe9, 0x99, 0x79, 0x48, 0xfa, - 0x99, 0xf1, 0xe9, 0xe7, 0x87, 0x28, 0x47, 0x98, 0x60, 0xcb, 0xc5, 0x06, 0x11, 0x92, 0x60, 0x01, - 0xeb, 0x53, 0x45, 0xd6, 0x87, 0xd3, 0xd3, 0x41, 0x50, 0x4d, 0x4a, 0xb3, 0x98, 0xb8, 0xa4, 0x82, - 0x52, 0x8b, 0x0b, 0xf2, 0xf3, 0x8a, 0x53, 0x87, 0x5d, 0xd8, 0xd8, 0xa1, 0x85, 0x8d, 0x1a, 0x6a, - 0xd8, 0xe0, 0xf2, 0x35, 0x2c, 0x70, 0x9c, 0x82, 0x4e, 0x3c, 0x92, 0x63, 0xbc, 0xf0, 0x48, 0x8e, - 0xf1, 0xc1, 0x23, 0x39, 0xc6, 0x19, 0x8f, 0xe5, 0x18, 0xa2, 0x74, 0xd2, 0x33, 0x4b, 0x32, 0x4a, - 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, 0xf3, 0x8a, 0x0b, 0x92, 0x93, 0x75, 0x53, 0x52, 0xcb, 0xf4, - 0xf3, 0x52, 0xf3, 0xd3, 0x8a, 0x75, 0x13, 0x0b, 0x32, 0x75, 0xd3, 0xf3, 0xf5, 0x11, 0x89, 0x7d, - 0x15, 0x93, 0xa0, 0x5f, 0x6a, 0xbe, 0x5b, 0xb0, 0x9e, 0x63, 0x80, 0xa7, 0x5e, 0x30, 0x44, 0x38, - 0x89, 0x0d, 0x9c, 0x8a, 0x8d, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0x0e, 0xde, 0xf9, 0x4c, 0x15, - 0x03, 0x00, 0x00, +var fileDescriptor_848d62e0ecc8b6b6 = []byte{ + // 325 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x2f, 0x33, 0xd2, 0x2f, + 0x4e, 0x2d, 0x2a, 0xcb, 0x4c, 0x4e, 0xd5, 0x2f, 0x4b, 0x2d, 0xca, 0x4c, 0xab, 0xd4, 0x2b, 0x28, + 0xca, 0x2f, 0xc9, 0x17, 0x12, 0xcc, 0x4b, 0xcd, 0xd7, 0x4b, 0x2b, 0xd6, 0x2b, 0x33, 0xd2, 0x83, + 0xca, 0x2b, 0x19, 0x72, 0x71, 0x06, 0x67, 0xa6, 0xe7, 0x25, 0x96, 0x94, 0x16, 0xa5, 0x0a, 0x09, + 0x70, 0x31, 0x67, 0xa7, 0x56, 0x4a, 0x30, 0x2a, 0x30, 0x6a, 0xf0, 0x04, 0x81, 0x98, 0x42, 0x42, + 0x5c, 0x2c, 0xc5, 0x99, 0xe9, 0x79, 0x12, 0x4c, 0x60, 0x21, 0x30, 0x5b, 0x69, 0x0b, 0x13, 0x97, + 0x64, 0x50, 0x6a, 0x61, 0x69, 0x6a, 0x71, 0x49, 0x18, 0xc8, 0xf4, 0xcc, 0xe4, 0xc4, 0x92, 0xcc, + 0xfc, 0x3c, 0x8f, 0xd4, 0xc4, 0x94, 0xd4, 0x22, 0x21, 0x67, 0x2e, 0xbe, 0xa4, 0xfc, 0x94, 0xca, + 0xf8, 0x62, 0x98, 0xa9, 0x60, 0xe3, 0xb8, 0x8d, 0x64, 0xf4, 0x30, 0x2c, 0xd7, 0x83, 0xdb, 0x1c, + 0xc4, 0x0b, 0xd2, 0x83, 0x70, 0x88, 0x33, 0x17, 0x5f, 0x6e, 0x6a, 0x49, 0x22, 0x92, 0x21, 0x4c, + 0xc4, 0x18, 0x02, 0xd2, 0x83, 0x30, 0xc4, 0x9d, 0x4b, 0x20, 0xbf, 0x28, 0x33, 0x3d, 0x33, 0x0f, + 0xc9, 0x18, 0x66, 0x22, 0x8c, 0xe1, 0x87, 0xe8, 0x42, 0x18, 0xe4, 0xc2, 0xc5, 0x06, 0x11, 0x92, + 0x60, 0x01, 0x6b, 0xd7, 0xc1, 0xa2, 0x1d, 0x67, 0x80, 0x04, 0x41, 0xf5, 0x2a, 0x6d, 0x63, 0xe2, + 0x92, 0x0a, 0x4a, 0x2d, 0x2e, 0xc8, 0xcf, 0x2b, 0x4e, 0x1d, 0x19, 0xe1, 0xe6, 0x8a, 0x16, 0x6e, + 0xba, 0x58, 0xc3, 0x0d, 0x57, 0x88, 0xc0, 0x02, 0xce, 0x29, 0xe8, 0xc4, 0x23, 0x39, 0xc6, 0x0b, + 0x8f, 0xe4, 0x18, 0x1f, 0x3c, 0x92, 0x63, 0x9c, 0xf1, 0x58, 0x8e, 0x21, 0x4a, 0x27, 0x3d, 0xb3, + 0x24, 0xa3, 0x34, 0x49, 0x2f, 0x39, 0x3f, 0x57, 0x3f, 0xaf, 0xb8, 0x20, 0x39, 0x59, 0x37, 0x25, + 0xb5, 0x4c, 0x3f, 0x2f, 0x35, 0x3f, 0xad, 0x58, 0x37, 0xb1, 0x20, 0x53, 0x37, 0x3d, 0x5f, 0x1f, + 0x91, 0x05, 0x56, 0x31, 0x09, 0xfa, 0xa5, 0xe6, 0xbb, 0x05, 0xeb, 0x39, 0x06, 0x78, 0xea, 0x05, + 0x43, 0xc4, 0x92, 0xd8, 0xc0, 0x19, 0xc2, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, 0x93, 0x01, 0xa7, + 0xcb, 0x2b, 0x03, 0x00, 0x00, } func (m *Signature) Marshal() (dAtA []byte, err error) { diff --git a/service/v2/verify.proto b/v2/service/verify.proto similarity index 88% rename from service/v2/verify.proto rename to v2/service/verify.proto index 2933896..0b9b87c 100644 --- a/service/v2/verify.proto +++ b/v2/service/verify.proto @@ -1,13 +1,10 @@ syntax = "proto3"; -package service.v2; +package neo.fs.v2.service; -option go_package = "github.com/nspcc-dev/neofs-api-go/service/v2"; +option go_package = "github.com/nspcc-dev/neofs-api-go/v2/service"; option csharp_namespace = "NeoFS.API.Service"; -import "acl/v2/types.proto"; -import "refs/v2/types.proto"; - // Signature of something in NeoFS message Signature { // Public key used for signing. diff --git a/session/v2/service.go b/v2/session/service.go similarity index 92% rename from session/v2/service.go rename to v2/session/service.go index 3c1b812..41a050d 100644 --- a/session/v2/service.go +++ b/v2/session/service.go @@ -1,8 +1,8 @@ -package v2 +package session import ( - refs "github.com/nspcc-dev/neofs-api-go/refs/v2" - service "github.com/nspcc-dev/neofs-api-go/service/v2" + "github.com/nspcc-dev/neofs-api-go/v2/refs" + "github.com/nspcc-dev/neofs-api-go/v2/service" ) // SetOwnerId sets identifier of the session initiator. diff --git a/session/v2/service.pb.go b/v2/session/service.pb.go similarity index 83% rename from session/v2/service.pb.go rename to v2/session/service.pb.go index 9d5d8af..7759f67 100644 --- a/session/v2/service.pb.go +++ b/v2/session/service.pb.go @@ -1,14 +1,14 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: session/v2/service.proto +// source: v2/session/service.proto -package v2 +package session import ( context "context" fmt "fmt" proto "github.com/golang/protobuf/proto" - v21 "github.com/nspcc-dev/neofs-api-go/refs/v2" - v2 "github.com/nspcc-dev/neofs-api-go/service/v2" + refs "github.com/nspcc-dev/neofs-api-go/v2/refs" + service "github.com/nspcc-dev/neofs-api-go/v2/service" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" @@ -28,26 +28,26 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package -// CreateRequest carries an information necessary for opening a session.v2. +// CreateRequest carries an information necessary for opening a session. type CreateRequest struct { // Body of create session token request message. Body *CreateRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` // Carries request meta information. Header data is used only to regulate message // transport and does not affect request execution. - MetaHeader *v2.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" json:"meta_header,omitempty"` + MetaHeader *service.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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 *v2.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + VerifyHeader *service.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *CreateRequest) Reset() { *m = CreateRequest{} } func (m *CreateRequest) String() string { return proto.CompactTextString(m) } func (*CreateRequest) ProtoMessage() {} func (*CreateRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_dc9d885cd3f2324e, []int{0} + return fileDescriptor_ab0074a16885b32c, []int{0} } func (m *CreateRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -83,14 +83,14 @@ func (m *CreateRequest) GetBody() *CreateRequest_Body { return nil } -func (m *CreateRequest) GetMetaHeader() *v2.RequestMetaHeader { +func (m *CreateRequest) GetMetaHeader() *service.RequestMetaHeader { if m != nil { return m.MetaHeader } return nil } -func (m *CreateRequest) GetVerifyHeader() *v2.RequestVerificationHeader { +func (m *CreateRequest) GetVerifyHeader() *service.RequestVerificationHeader { if m != nil { return m.VerifyHeader } @@ -99,19 +99,19 @@ func (m *CreateRequest) GetVerifyHeader() *v2.RequestVerificationHeader { type CreateRequest_Body struct { // Carries an identifier of a session initiator. - OwnerId *v21.OwnerID `protobuf:"bytes,1,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"` - // Carries a lifetime of the session.v2. - Lifetime *v2.TokenLifetime `protobuf:"bytes,2,opt,name=lifetime,proto3" json:"lifetime,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + OwnerId *refs.OwnerID `protobuf:"bytes,1,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"` + // Carries a lifetime of the session. + Lifetime *service.TokenLifetime `protobuf:"bytes,2,opt,name=lifetime,proto3" json:"lifetime,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *CreateRequest_Body) Reset() { *m = CreateRequest_Body{} } func (m *CreateRequest_Body) String() string { return proto.CompactTextString(m) } func (*CreateRequest_Body) ProtoMessage() {} func (*CreateRequest_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_dc9d885cd3f2324e, []int{0, 0} + return fileDescriptor_ab0074a16885b32c, []int{0, 0} } func (m *CreateRequest_Body) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -140,41 +140,41 @@ func (m *CreateRequest_Body) XXX_DiscardUnknown() { var xxx_messageInfo_CreateRequest_Body proto.InternalMessageInfo -func (m *CreateRequest_Body) GetOwnerId() *v21.OwnerID { +func (m *CreateRequest_Body) GetOwnerId() *refs.OwnerID { if m != nil { return m.OwnerId } return nil } -func (m *CreateRequest_Body) GetLifetime() *v2.TokenLifetime { +func (m *CreateRequest_Body) GetLifetime() *service.TokenLifetime { if m != nil { return m.Lifetime } return nil } -// CreateResponse carries an information about the opened session.v2. +// CreateResponse carries an information about the opened session. type CreateResponse struct { // Body of create session token response message. Body *CreateResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` // Carries response meta information. Header data is used only to regulate // message transport and does not affect request execution. - MetaHeader *v2.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" json:"meta_header,omitempty"` + MetaHeader *service.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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 *v2.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + VerifyHeader *service.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *CreateResponse) Reset() { *m = CreateResponse{} } func (m *CreateResponse) String() string { return proto.CompactTextString(m) } func (*CreateResponse) ProtoMessage() {} func (*CreateResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_dc9d885cd3f2324e, []int{1} + return fileDescriptor_ab0074a16885b32c, []int{1} } func (m *CreateResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -210,14 +210,14 @@ func (m *CreateResponse) GetBody() *CreateResponse_Body { return nil } -func (m *CreateResponse) GetMetaHeader() *v2.ResponseMetaHeader { +func (m *CreateResponse) GetMetaHeader() *service.ResponseMetaHeader { if m != nil { return m.MetaHeader } return nil } -func (m *CreateResponse) GetVerifyHeader() *v2.ResponseVerificationHeader { +func (m *CreateResponse) GetVerifyHeader() *service.ResponseVerificationHeader { if m != nil { return m.VerifyHeader } @@ -238,7 +238,7 @@ func (m *CreateResponse_Body) Reset() { *m = CreateResponse_Body{} } func (m *CreateResponse_Body) String() string { return proto.CompactTextString(m) } func (*CreateResponse_Body) ProtoMessage() {} func (*CreateResponse_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_dc9d885cd3f2324e, []int{1, 0} + return fileDescriptor_ab0074a16885b32c, []int{1, 0} } func (m *CreateResponse_Body) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -282,44 +282,45 @@ func (m *CreateResponse_Body) GetSessionKey() []byte { } func init() { - proto.RegisterType((*CreateRequest)(nil), "session.v2.CreateRequest") - proto.RegisterType((*CreateRequest_Body)(nil), "session.v2.CreateRequest.Body") - proto.RegisterType((*CreateResponse)(nil), "session.v2.CreateResponse") - proto.RegisterType((*CreateResponse_Body)(nil), "session.v2.CreateResponse.Body") + proto.RegisterType((*CreateRequest)(nil), "neo.fs.v2.session.CreateRequest") + proto.RegisterType((*CreateRequest_Body)(nil), "neo.fs.v2.session.CreateRequest.Body") + proto.RegisterType((*CreateResponse)(nil), "neo.fs.v2.session.CreateResponse") + proto.RegisterType((*CreateResponse_Body)(nil), "neo.fs.v2.session.CreateResponse.Body") } -func init() { proto.RegisterFile("session/v2/service.proto", fileDescriptor_dc9d885cd3f2324e) } +func init() { proto.RegisterFile("v2/session/service.proto", fileDescriptor_ab0074a16885b32c) } -var fileDescriptor_dc9d885cd3f2324e = []byte{ - // 448 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x93, 0xdf, 0x8a, 0xd3, 0x40, - 0x14, 0xc6, 0x4d, 0x5c, 0x76, 0x97, 0x69, 0x77, 0xd1, 0x11, 0xb1, 0x1b, 0x30, 0x2b, 0x0b, 0x8a, - 0xa0, 0x9d, 0x40, 0x16, 0xf1, 0xce, 0x62, 0x15, 0xb1, 0xad, 0xff, 0x98, 0x8a, 0x17, 0xde, 0x94, - 0x34, 0x39, 0x69, 0xc7, 0x9a, 0x4c, 0xcc, 0x4c, 0x23, 0x79, 0x07, 0x1f, 0xc0, 0x67, 0xf0, 0x15, - 0x7c, 0x01, 0x2f, 0x7d, 0x04, 0xa9, 0x2f, 0x22, 0x93, 0x99, 0xf4, 0x0f, 0xa4, 0x78, 0x97, 0x99, - 0xf9, 0xce, 0x77, 0xbe, 0xf3, 0xe3, 0x04, 0x75, 0x04, 0x08, 0xc1, 0x78, 0xea, 0x15, 0xbe, 0x27, - 0x20, 0x2f, 0x58, 0x08, 0x24, 0xcb, 0xb9, 0xe4, 0x18, 0x99, 0x17, 0x52, 0xf8, 0xce, 0x8d, 0x1c, - 0x62, 0xa1, 0x24, 0xb2, 0xcc, 0x40, 0x68, 0x81, 0x73, 0xd3, 0xe8, 0xd5, 0x7d, 0x02, 0x32, 0x30, - 0xd7, 0xb7, 0xb6, 0xae, 0x0b, 0xc8, 0x59, 0x5c, 0xea, 0x87, 0x8b, 0x9f, 0x36, 0x3a, 0x79, 0x96, - 0x43, 0x20, 0x81, 0xc2, 0x97, 0x25, 0x08, 0x89, 0x7d, 0x74, 0x30, 0xe5, 0x51, 0xd9, 0xb1, 0xee, - 0x58, 0xf7, 0x5b, 0xbe, 0x4b, 0x36, 0x1d, 0xc9, 0x8e, 0x90, 0xf4, 0x79, 0x54, 0xd2, 0x4a, 0x8b, - 0x9f, 0xa0, 0x96, 0x6a, 0x36, 0x99, 0x43, 0x10, 0x41, 0xde, 0xb1, 0xab, 0xd2, 0xdb, 0xa4, 0xce, - 0x5e, 0xf8, 0xc4, 0x14, 0xbd, 0x06, 0x19, 0xbc, 0xac, 0x44, 0x14, 0x25, 0xeb, 0x6f, 0x3c, 0x44, - 0x27, 0x3a, 0x55, 0xed, 0x70, 0xb5, 0x72, 0xb8, 0xdb, 0xe0, 0xf0, 0x41, 0xe9, 0x58, 0x18, 0x48, - 0xc6, 0x53, 0xe3, 0xd4, 0xd6, 0xb5, 0xfa, 0xe4, 0x7c, 0x42, 0x07, 0x2a, 0x19, 0x7e, 0x80, 0x8e, - 0xf9, 0xd7, 0x14, 0xf2, 0x09, 0x8b, 0xcc, 0x2c, 0xd7, 0x88, 0x22, 0xa6, 0xbc, 0xde, 0xaa, 0x87, - 0xc1, 0x73, 0x7a, 0x54, 0x29, 0x06, 0x11, 0x7e, 0x84, 0x8e, 0x3f, 0xb3, 0x18, 0x24, 0x4b, 0xc0, - 0xa4, 0x3f, 0xdb, 0xee, 0xfd, 0x9e, 0x2f, 0x20, 0x7d, 0x65, 0x04, 0x74, 0x2d, 0xbd, 0xf8, 0x66, - 0xa3, 0xd3, 0x1a, 0x8a, 0xc8, 0x78, 0x2a, 0x00, 0x5f, 0xee, 0xe0, 0x3b, 0x6f, 0xc2, 0xa7, 0x95, - 0xdb, 0xfc, 0x7a, 0x4d, 0xfc, 0xdc, 0xdd, 0xe9, 0x75, 0xd5, 0x1e, 0x80, 0xa3, 0x66, 0x80, 0xf7, - 0x9a, 0x2c, 0xfe, 0x4b, 0xf0, 0xb1, 0x21, 0x78, 0x8a, 0x6c, 0xc3, 0xae, 0x4d, 0x6d, 0x16, 0xe1, - 0x73, 0xd4, 0x32, 0xd3, 0x4c, 0x16, 0x50, 0x56, 0x29, 0xdb, 0xb4, 0xde, 0xc8, 0x11, 0x94, 0xfe, - 0x10, 0x1d, 0x8d, 0xf5, 0x09, 0xf7, 0xd0, 0xa1, 0x1e, 0x17, 0x9f, 0xed, 0xdd, 0x20, 0xc7, 0xd9, - 0x4f, 0xa7, 0x4f, 0x7f, 0xad, 0x5c, 0xeb, 0xf7, 0xca, 0xb5, 0xfe, 0xac, 0x5c, 0xeb, 0xfb, 0x5f, - 0xf7, 0xca, 0xc7, 0x87, 0x33, 0x26, 0xe7, 0xcb, 0x29, 0x09, 0x79, 0xe2, 0xa5, 0x22, 0x0b, 0xc3, - 0x6e, 0x04, 0x85, 0x97, 0x02, 0x8f, 0x45, 0x37, 0xc8, 0x58, 0x77, 0xc6, 0xbd, 0xcd, 0x7f, 0xf3, - 0xc3, 0xbe, 0xfe, 0x06, 0xf8, 0x8b, 0x31, 0x79, 0xfa, 0x6e, 0x40, 0x4c, 0xa8, 0xe9, 0x61, 0xb5, - 0xf3, 0x97, 0xff, 0x02, 0x00, 0x00, 0xff, 0xff, 0x41, 0x43, 0x09, 0xb3, 0x60, 0x03, 0x00, 0x00, +var fileDescriptor_ab0074a16885b32c = []byte{ + // 454 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x93, 0x4f, 0x6f, 0xd3, 0x30, + 0x18, 0xc6, 0x49, 0x98, 0xb6, 0xc9, 0xed, 0x26, 0xcd, 0x08, 0xad, 0xca, 0x21, 0x94, 0x89, 0x21, + 0x0e, 0x8b, 0x2d, 0x85, 0x03, 0x02, 0x71, 0x61, 0xc0, 0x44, 0x05, 0xe3, 0x8f, 0x87, 0x10, 0xe2, + 0x52, 0xa5, 0xc9, 0x9b, 0xcd, 0x1a, 0xb1, 0x43, 0xec, 0x05, 0xf2, 0x4d, 0xb8, 0x72, 0xe5, 0x93, + 0x70, 0xe4, 0x13, 0x20, 0x54, 0xbe, 0x08, 0x8a, 0xed, 0x8d, 0x56, 0x64, 0xed, 0x2d, 0xb6, 0x9f, + 0xe7, 0xf1, 0xfb, 0xfc, 0x14, 0xa3, 0x41, 0x1d, 0x53, 0x05, 0x4a, 0x71, 0x29, 0xa8, 0x82, 0xaa, + 0xe6, 0x29, 0x90, 0xb2, 0x92, 0x5a, 0xe2, 0x2d, 0x01, 0x92, 0xe4, 0x8a, 0xd4, 0x31, 0x71, 0x82, + 0xe0, 0x5a, 0x1d, 0xd3, 0x0a, 0x72, 0x45, 0x75, 0x53, 0x82, 0xb2, 0xba, 0xe0, 0xba, 0x49, 0x30, + 0x4e, 0x5a, 0x80, 0x4e, 0xdc, 0xf6, 0xf6, 0xcc, 0x76, 0x0d, 0x15, 0xcf, 0x1b, 0x7b, 0xb0, 0xf3, + 0xcb, 0x47, 0x1b, 0x8f, 0x2b, 0x48, 0x34, 0x30, 0xf8, 0x74, 0x06, 0x4a, 0xe3, 0xfb, 0x68, 0x65, + 0x22, 0xb3, 0x66, 0xe0, 0x0d, 0xbd, 0x3b, 0xbd, 0x78, 0x97, 0xfc, 0x77, 0x31, 0x99, 0xd3, 0x93, + 0x7d, 0x99, 0x35, 0xcc, 0x58, 0xf0, 0x53, 0xd4, 0x6b, 0xef, 0x1c, 0x9f, 0x40, 0x92, 0x41, 0x35, + 0xf0, 0x4d, 0xc2, 0xad, 0xb9, 0x04, 0xdb, 0xc9, 0x79, 0x0f, 0x41, 0x27, 0xcf, 0x8c, 0x96, 0xa1, + 0xe2, 0xe2, 0x1b, 0xbf, 0x41, 0x1b, 0x76, 0xc6, 0xf3, 0xa0, 0xab, 0x26, 0x68, 0xef, 0xf2, 0xa0, + 0x77, 0xad, 0x9c, 0xa7, 0x89, 0xe6, 0x52, 0xb8, 0xc0, 0xbe, 0x8d, 0xb0, 0xab, 0xe0, 0x0b, 0x5a, + 0x69, 0xe7, 0xc4, 0x31, 0x5a, 0x97, 0x9f, 0x05, 0x54, 0x63, 0x9e, 0xb9, 0x82, 0xdb, 0x33, 0xa9, + 0x2d, 0x4d, 0xf2, 0xaa, 0x3d, 0x1f, 0x3d, 0x61, 0x6b, 0x46, 0x38, 0xca, 0xf0, 0x43, 0xb4, 0xfe, + 0x91, 0xe7, 0xa0, 0x79, 0x01, 0xae, 0xd2, 0xb0, 0x63, 0x92, 0xb7, 0xf2, 0x14, 0xc4, 0x0b, 0xa7, + 0x63, 0x17, 0x8e, 0x9d, 0x6f, 0x3e, 0xda, 0x3c, 0x07, 0xa6, 0x4a, 0x29, 0x14, 0xe0, 0x07, 0x73, + 0x84, 0x6f, 0x2f, 0x20, 0x6c, 0x0d, 0xb3, 0x88, 0x0f, 0xba, 0x10, 0xef, 0x76, 0x92, 0xb1, 0xe6, + 0x4b, 0x18, 0xb3, 0x6e, 0xc6, 0xd1, 0x82, 0xa4, 0xa5, 0x90, 0xef, 0x39, 0xc8, 0x9b, 0xc8, 0x77, + 0x78, 0xfb, 0xcc, 0xe7, 0x19, 0xbe, 0x81, 0x7a, 0xae, 0xd8, 0xf8, 0x14, 0x1a, 0x33, 0x73, 0x9f, + 0x21, 0xb7, 0xf5, 0x1c, 0x9a, 0xf8, 0x3d, 0x5a, 0x3b, 0xb2, 0x2b, 0x7c, 0x88, 0x56, 0x6d, 0x79, + 0x3c, 0x5c, 0xf6, 0xe7, 0x05, 0x37, 0x97, 0x92, 0xdb, 0x67, 0x3f, 0xa6, 0xa1, 0xf7, 0x73, 0x1a, + 0x7a, 0xbf, 0xa7, 0xa1, 0xf7, 0xf5, 0x4f, 0x78, 0xe5, 0xc3, 0xde, 0x31, 0xd7, 0x27, 0x67, 0x13, + 0x92, 0xca, 0x82, 0x0a, 0x55, 0xa6, 0x69, 0x94, 0x41, 0x4d, 0x05, 0xc8, 0x5c, 0x45, 0x49, 0xc9, + 0xa3, 0x63, 0x49, 0xff, 0x3d, 0xc2, 0xef, 0xfe, 0xd6, 0x4b, 0x90, 0x07, 0x47, 0xe4, 0xd1, 0xeb, + 0x11, 0x71, 0x23, 0x4e, 0x56, 0xcd, 0xcb, 0xb9, 0xfb, 0x37, 0x00, 0x00, 0xff, 0xff, 0xf2, 0xbe, + 0x3b, 0xbe, 0xad, 0x03, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -348,7 +349,7 @@ func NewSessionClient(cc *grpc.ClientConn) SessionClient { func (c *sessionClient) Create(ctx context.Context, in *CreateRequest, opts ...grpc.CallOption) (*CreateResponse, error) { out := new(CreateResponse) - err := c.cc.Invoke(ctx, "/session.v2.Session/Create", in, out, opts...) + err := c.cc.Invoke(ctx, "/neo.fs.v2.session.Session/Create", in, out, opts...) if err != nil { return nil, err } @@ -383,7 +384,7 @@ func _Session_Create_Handler(srv interface{}, ctx context.Context, dec func(inte } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/session.v2.Session/Create", + FullMethod: "/neo.fs.v2.session.Session/Create", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(SessionServer).Create(ctx, req.(*CreateRequest)) @@ -392,7 +393,7 @@ func _Session_Create_Handler(srv interface{}, ctx context.Context, dec func(inte } var _Session_serviceDesc = grpc.ServiceDesc{ - ServiceName: "session.v2.Session", + ServiceName: "neo.fs.v2.session.Session", HandlerType: (*SessionServer)(nil), Methods: []grpc.MethodDesc{ { @@ -401,7 +402,7 @@ var _Session_serviceDesc = grpc.ServiceDesc{ }, }, Streams: []grpc.StreamDesc{}, - Metadata: "session/v2/service.proto", + Metadata: "v2/session/service.proto", } func (m *CreateRequest) Marshal() (dAtA []byte, err error) { @@ -822,7 +823,7 @@ func (m *CreateRequest) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.MetaHeader == nil { - m.MetaHeader = &v2.RequestMetaHeader{} + m.MetaHeader = &service.RequestMetaHeader{} } if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -858,7 +859,7 @@ func (m *CreateRequest) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.VerifyHeader == nil { - m.VerifyHeader = &v2.RequestVerificationHeader{} + m.VerifyHeader = &service.RequestVerificationHeader{} } if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -948,7 +949,7 @@ func (m *CreateRequest_Body) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.OwnerId == nil { - m.OwnerId = &v21.OwnerID{} + m.OwnerId = &refs.OwnerID{} } if err := m.OwnerId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -984,7 +985,7 @@ func (m *CreateRequest_Body) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.Lifetime == nil { - m.Lifetime = &v2.TokenLifetime{} + m.Lifetime = &service.TokenLifetime{} } if err := m.Lifetime.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -1110,7 +1111,7 @@ func (m *CreateResponse) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.MetaHeader == nil { - m.MetaHeader = &v2.ResponseMetaHeader{} + m.MetaHeader = &service.ResponseMetaHeader{} } if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -1146,7 +1147,7 @@ func (m *CreateResponse) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.VerifyHeader == nil { - m.VerifyHeader = &v2.ResponseVerificationHeader{} + m.VerifyHeader = &service.ResponseVerificationHeader{} } if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err diff --git a/session/v2/service.proto b/v2/session/service.proto similarity index 70% rename from session/v2/service.proto rename to v2/session/service.proto index c980dcf..39650cf 100644 --- a/session/v2/service.proto +++ b/v2/session/service.proto @@ -1,27 +1,26 @@ syntax = "proto3"; -package session.v2; - -option go_package = "github.com/nspcc-dev/neofs-api-go/session/v2"; +package neo.fs.v2.session; +option go_package = "github.com/nspcc-dev/neofs-api-go/v2/session"; option csharp_namespace = "NeoFS.API.Session"; -import "refs/v2/types.proto"; -import "service/v2/meta.proto"; -import "service/v2/verify.proto"; +import "v2/refs/types.proto"; +import "v2/service/meta.proto"; +import "v2/service/verify.proto"; service Session { // Create opens new session between the client and the server. rpc Create (CreateRequest) returns (CreateResponse); } -// CreateRequest carries an information necessary for opening a session.v2. +// CreateRequest carries an information necessary for opening a session. message CreateRequest { message Body { // Carries an identifier of a session initiator. - refs.v2.OwnerID owner_id = 1; + neo.fs.v2.refs.OwnerID owner_id = 1; - // Carries a lifetime of the session.v2. - service.v2.TokenLifetime lifetime = 2; + // Carries a lifetime of the session. + neo.fs.v2.service.TokenLifetime lifetime = 2; } // Body of create session token request message. @@ -29,14 +28,14 @@ message CreateRequest { // Carries request meta information. Header data is used only to regulate message // transport and does not affect request execution. - service.v2.RequestMetaHeader meta_header = 2; + neo.fs.v2.service.RequestMetaHeader meta_header = 2; // Carries request verification information. This header is used to authenticate // the nodes of the message route and check the correctness of transmission. - service.v2.RequestVerificationHeader verify_header = 3; + neo.fs.v2.service.RequestVerificationHeader verify_header = 3; } -// CreateResponse carries an information about the opened session.v2. +// CreateResponse carries an information about the opened session. message CreateResponse { message Body { // id carries an identifier of session token. @@ -51,10 +50,10 @@ message CreateResponse { // Carries response meta information. Header data is used only to regulate // message transport and does not affect request execution. - service.v2.ResponseMetaHeader meta_header = 2; + neo.fs.v2.service.ResponseMetaHeader meta_header = 2; // Carries response verification information. This header is used to // authenticate the nodes of the message route and check the correctness // of transmission. - service.v2.ResponseVerificationHeader verify_header = 3; + neo.fs.v2.service.ResponseVerificationHeader verify_header = 3; } diff --git a/storagegroup/v2/types.go b/v2/storagegroup/types.go similarity index 91% rename from storagegroup/v2/types.go rename to v2/storagegroup/types.go index a46acfb..5f4bd37 100644 --- a/storagegroup/v2/types.go +++ b/v2/storagegroup/types.go @@ -1,7 +1,7 @@ -package v2 +package storagegroup import ( - refs "github.com/nspcc-dev/neofs-api-go/refs/v2" + "github.com/nspcc-dev/neofs-api-go/v2/refs" ) // SetValidationDataSize sets the total size of the payloads of the storage group. diff --git a/storagegroup/v2/types.pb.go b/v2/storagegroup/types.pb.go similarity index 80% rename from storagegroup/v2/types.pb.go rename to v2/storagegroup/types.pb.go index e099149..e206d31 100644 --- a/storagegroup/v2/types.pb.go +++ b/v2/storagegroup/types.pb.go @@ -1,12 +1,12 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: storagegroup/v2/types.proto +// source: v2/storagegroup/types.proto -package v2 +package storagegroup import ( fmt "fmt" proto "github.com/golang/protobuf/proto" - v2 "github.com/nspcc-dev/neofs-api-go/refs/v2" + refs "github.com/nspcc-dev/neofs-api-go/v2/refs" io "io" math "math" math_bits "math/bits" @@ -39,17 +39,17 @@ type StorageGroup struct { ExpirationEpoch uint64 `protobuf:"varint,3,opt,name=expiration_epoch,json=expirationEpoch,proto3" json:"expiration_epoch,omitempty"` // Members carries the list of identifiers of the object storage group members. // The list is strictly ordered. - Members []*v2.ObjectID `protobuf:"bytes,4,rep,name=members,proto3" json:"members,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Members []*refs.ObjectID `protobuf:"bytes,4,rep,name=members,proto3" json:"members,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *StorageGroup) Reset() { *m = StorageGroup{} } func (m *StorageGroup) String() string { return proto.CompactTextString(m) } func (*StorageGroup) ProtoMessage() {} func (*StorageGroup) Descriptor() ([]byte, []int) { - return fileDescriptor_e6cea1f26229f4f1, []int{0} + return fileDescriptor_593772eae6c18cdf, []int{0} } func (m *StorageGroup) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -99,7 +99,7 @@ func (m *StorageGroup) GetExpirationEpoch() uint64 { return 0 } -func (m *StorageGroup) GetMembers() []*v2.ObjectID { +func (m *StorageGroup) GetMembers() []*refs.ObjectID { if m != nil { return m.Members } @@ -107,31 +107,32 @@ func (m *StorageGroup) GetMembers() []*v2.ObjectID { } func init() { - proto.RegisterType((*StorageGroup)(nil), "storagegroup.v2.StorageGroup") + proto.RegisterType((*StorageGroup)(nil), "neo.fs.v2.storagegroup.StorageGroup") } -func init() { proto.RegisterFile("storagegroup/v2/types.proto", fileDescriptor_e6cea1f26229f4f1) } +func init() { proto.RegisterFile("v2/storagegroup/types.proto", fileDescriptor_593772eae6c18cdf) } -var fileDescriptor_e6cea1f26229f4f1 = []byte{ - // 287 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x2e, 0x2e, 0xc9, 0x2f, - 0x4a, 0x4c, 0x4f, 0x4d, 0x2f, 0xca, 0x2f, 0x2d, 0xd0, 0x2f, 0x33, 0xd2, 0x2f, 0xa9, 0x2c, 0x48, - 0x2d, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x47, 0x96, 0xd4, 0x2b, 0x33, 0x92, 0x12, - 0x2e, 0x4a, 0x4d, 0x2b, 0x46, 0x53, 0xa5, 0x74, 0x90, 0x91, 0x8b, 0x27, 0x18, 0xa2, 0xd0, 0x1d, - 0xa4, 0x50, 0xc8, 0x80, 0x4b, 0xa4, 0x2c, 0x31, 0x27, 0x33, 0x25, 0xb1, 0x24, 0x33, 0x3f, 0x2f, - 0x3e, 0x25, 0xb1, 0x24, 0x31, 0xbe, 0x38, 0xb3, 0x2a, 0x55, 0x82, 0x51, 0x81, 0x51, 0x83, 0x25, - 0x48, 0x08, 0x21, 0xe7, 0x92, 0x58, 0x92, 0x18, 0x9c, 0x59, 0x95, 0x2a, 0xa4, 0xce, 0xc5, 0x8f, - 0xa4, 0x23, 0x23, 0xb1, 0x38, 0x43, 0x82, 0x49, 0x81, 0x51, 0x83, 0x27, 0x88, 0x0f, 0x21, 0xec, - 0x91, 0x58, 0x9c, 0x21, 0xa4, 0xc9, 0x25, 0x90, 0x5a, 0x51, 0x90, 0x59, 0x04, 0x51, 0x98, 0x5a, - 0x90, 0x9f, 0x9c, 0x21, 0xc1, 0x0c, 0x36, 0x96, 0x1f, 0x21, 0xee, 0x0a, 0x12, 0x16, 0xd2, 0xe6, - 0x62, 0xcf, 0x4d, 0xcd, 0x4d, 0x4a, 0x2d, 0x2a, 0x96, 0x60, 0x51, 0x60, 0xd6, 0xe0, 0x36, 0x12, - 0xd4, 0x03, 0xb9, 0x5e, 0xaf, 0xcc, 0x48, 0xcf, 0x3f, 0x29, 0x2b, 0x35, 0xb9, 0xc4, 0xd3, 0x25, - 0x08, 0xa6, 0xc2, 0x29, 0xe6, 0xc4, 0x23, 0x39, 0xc6, 0x0b, 0x8f, 0xe4, 0x18, 0x1f, 0x3c, 0x92, - 0x63, 0x9c, 0xf1, 0x58, 0x8e, 0x21, 0xca, 0x30, 0x3d, 0xb3, 0x24, 0xa3, 0x34, 0x49, 0x2f, 0x39, - 0x3f, 0x57, 0x3f, 0xaf, 0xb8, 0x20, 0x39, 0x59, 0x37, 0x25, 0xb5, 0x4c, 0x3f, 0x2f, 0x35, 0x3f, - 0xad, 0x58, 0x37, 0xb1, 0x20, 0x53, 0x37, 0x3d, 0x5f, 0x1f, 0x2d, 0xe8, 0x56, 0x31, 0x89, 0xf9, - 0xa5, 0xe6, 0xbb, 0x05, 0xeb, 0x39, 0x06, 0x78, 0xea, 0x21, 0x07, 0x48, 0x12, 0x1b, 0x38, 0xa0, - 0x8c, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xe8, 0xae, 0xc0, 0x6d, 0x6d, 0x01, 0x00, 0x00, +var fileDescriptor_593772eae6c18cdf = []byte{ + // 293 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x5c, 0xd0, 0xdf, 0x4a, 0xf3, 0x30, + 0x18, 0x06, 0xf0, 0x2f, 0xdb, 0xf8, 0x84, 0x38, 0x9c, 0x44, 0x19, 0x45, 0xa1, 0x0c, 0x4f, 0x9c, + 0x07, 0x4b, 0xb4, 0x5e, 0x81, 0x32, 0xff, 0xec, 0x44, 0xa5, 0x3d, 0x13, 0x61, 0xa4, 0xed, 0xdb, + 0x36, 0x62, 0x9b, 0x90, 0x64, 0x45, 0x77, 0x25, 0x5e, 0x83, 0x57, 0xb2, 0x43, 0x2f, 0x41, 0xea, + 0x8d, 0x48, 0x37, 0xa4, 0xc5, 0xd3, 0x27, 0xbf, 0xbc, 0xf0, 0x3c, 0xf8, 0xb0, 0xf4, 0x98, 0xb1, + 0x52, 0xf3, 0x14, 0x52, 0x2d, 0x17, 0x8a, 0xd9, 0x37, 0x05, 0x86, 0x2a, 0x2d, 0xad, 0x24, 0xc3, + 0x02, 0x24, 0x4d, 0x0c, 0x2d, 0x3d, 0xda, 0x36, 0x07, 0x7b, 0xa5, 0xc7, 0x34, 0x24, 0xa6, 0x8d, + 0x8f, 0x56, 0x08, 0xf7, 0x83, 0x8d, 0xba, 0xa9, 0x15, 0x39, 0xc5, 0xfb, 0x25, 0x7f, 0x11, 0x31, + 0xb7, 0x42, 0x16, 0xf3, 0x98, 0x5b, 0x3e, 0x37, 0x62, 0x09, 0x0e, 0x1a, 0xa1, 0x71, 0xcf, 0x27, + 0xcd, 0xdb, 0x94, 0x5b, 0x1e, 0x88, 0x25, 0x90, 0x63, 0x3c, 0x68, 0xfd, 0xc8, 0xb8, 0xc9, 0x9c, + 0xce, 0x08, 0x8d, 0xfb, 0xfe, 0x4e, 0x13, 0xdf, 0x72, 0x93, 0x91, 0x13, 0xbc, 0x0b, 0xaf, 0x4a, + 0xe8, 0x0d, 0x04, 0x25, 0xa3, 0xcc, 0xe9, 0xae, 0xcf, 0x0e, 0x9a, 0xfc, 0xaa, 0x8e, 0x89, 0x87, + 0xb7, 0x72, 0xc8, 0x43, 0xd0, 0xc6, 0xe9, 0x8d, 0xba, 0xe3, 0x6d, 0xcf, 0xa1, 0x4d, 0xab, 0xba, + 0x04, 0xbd, 0x0f, 0x9f, 0x21, 0xb2, 0xb3, 0xa9, 0xff, 0x0b, 0x2f, 0x9f, 0x56, 0x95, 0x8b, 0x3e, + 0x2b, 0x17, 0x7d, 0x55, 0x2e, 0x7a, 0xff, 0x76, 0xff, 0x3d, 0x9e, 0xa5, 0xc2, 0x66, 0x8b, 0x90, + 0x46, 0x32, 0x67, 0x85, 0x51, 0x51, 0x34, 0x89, 0xa1, 0x64, 0x05, 0xc8, 0xc4, 0x4c, 0xb8, 0x12, + 0x93, 0x54, 0xb2, 0x3f, 0x43, 0x7e, 0x74, 0x86, 0x77, 0x20, 0xaf, 0x03, 0x7a, 0xf1, 0x30, 0xa3, + 0xed, 0x5d, 0xc2, 0xff, 0xeb, 0xbd, 0xce, 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff, 0xe7, 0x71, 0xf1, + 0x6b, 0x7b, 0x01, 0x00, 0x00, } func (m *StorageGroup) Marshal() (dAtA []byte, err error) { @@ -367,7 +368,7 @@ func (m *StorageGroup) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Members = append(m.Members, &v2.ObjectID{}) + m.Members = append(m.Members, &refs.ObjectID{}) if err := m.Members[len(m.Members)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } diff --git a/storagegroup/v2/types.proto b/v2/storagegroup/types.proto similarity index 82% rename from storagegroup/v2/types.proto rename to v2/storagegroup/types.proto index 3d89a67..5086621 100644 --- a/storagegroup/v2/types.proto +++ b/v2/storagegroup/types.proto @@ -1,11 +1,11 @@ syntax = "proto3"; -package storagegroup.v2; +package neo.fs.v2.storagegroup; -option go_package = "github.com/nspcc-dev/neofs-api-go/storagegroup/v2"; +option go_package = "github.com/nspcc-dev/neofs-api-go/v2/storagegroup"; option csharp_namespace = "NeoFS.API.StorageGroup"; -import "refs/v2/types.proto"; +import "v2/refs/types.proto"; // StorageGroup groups the information about the NeoFS storage group. // The storage group consists of objects from single container. @@ -26,5 +26,5 @@ message StorageGroup { // Members carries the list of identifiers of the object storage group members. // The list is strictly ordered. - repeated refs.v2.ObjectID members = 4; + repeated neo.fs.v2.refs.ObjectID members = 4; } From f87e5fe831d96d58904e5575eaab8ed41534fa53 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Thu, 13 Aug 2020 16:23:13 +0300 Subject: [PATCH 0269/1196] Use v2 subdir in prepare script --- prepare.sh | 25 +++++-------------------- 1 file changed, 5 insertions(+), 20 deletions(-) diff --git a/prepare.sh b/prepare.sh index 3594c72..e9cfb22 100755 --- a/prepare.sh +++ b/prepare.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/bash prefix=v2 @@ -9,35 +9,20 @@ fi API_GO_PATH=$(pwd) API_PATH=$1 +mkdir $API_GO_PATH/$prefix 2>/dev/null # MOVE FILES FROM API REPO cd $API_PATH ARGS=$(find ./ -name '*.proto' -not -path './vendor/*') for file in $ARGS; do dir=$(dirname $file) - cp -r $dir $API_GO_PATH + cp -r $dir $API_GO_PATH/$prefix done -cd $API_GO_PATH +cd $API_GO_PATH/$prefix # MODIFY FILES for file in $ARGS; do - TYPES=$(grep '^import' $file | sed 's/import\ \"\(.*\)\/.*/\1/' | sort | uniq) - PKG=$(grep '^package' $file | sed 's/package\ \(.*\);/\1/') - - TYPES=( "${TYPES[@]}" "${PKG[@]}") # merge two arrays - TYPES=$(printf "%s\n" "${TYPES[@]}" | sort | uniq) # left only uniq elemetns - - for t in $TYPES; do - sed -i "s/$t\./$t\.$prefix\./" $file - sed -i "s/$t\//$t\/$prefix\//" $file - done - - sed -i "s/^package\(.*\);/package\1.$prefix;/" $file - sed -i "s/go_package\(.*\)\";$/go_package\1\/$prefix\";/" $file - - dir=$(dirname $file) - mkdir $dir/v2 2>/dev/null - mv $file $dir/v2 + sed -i "s/import\ \"\(.*\)\";/import\ \"$prefix\/\1\";/" $file done # COMPILE From ff866195c4aeb922efe04ad949b86960fd67a892 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Thu, 13 Aug 2020 16:27:03 +0300 Subject: [PATCH 0270/1196] Add version constsant to v2 --- v2/service/version.go | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 v2/service/version.go diff --git a/v2/service/version.go b/v2/service/version.go new file mode 100644 index 0000000..cca5fe4 --- /dev/null +++ b/v2/service/version.go @@ -0,0 +1,3 @@ +package service + +var APIVersion = Version{Major: 2, Minor: 0} From 12e7b5f16b5dbdbcddd4d0d9fd44aa20615e9cb9 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Thu, 13 Aug 2020 16:39:10 +0300 Subject: [PATCH 0271/1196] Remove proto files from the repo --- prepare.sh | 12 +- v2/accounting/service.proto | 75 ------- v2/acl/types.proto | 106 ---------- v2/container/service.proto | 285 ------------------------- v2/container/types.proto | 40 ---- v2/netmap/types.proto | 92 -------- v2/object/service.proto | 407 ------------------------------------ v2/object/types.proto | 85 -------- v2/refs/types.proto | 32 --- v2/service/meta.proto | 129 ------------ v2/service/verify.proto | 40 ---- v2/session/service.proto | 59 ------ v2/storagegroup/types.proto | 30 --- 13 files changed, 8 insertions(+), 1384 deletions(-) delete mode 100644 v2/accounting/service.proto delete mode 100644 v2/acl/types.proto delete mode 100644 v2/container/service.proto delete mode 100644 v2/container/types.proto delete mode 100644 v2/netmap/types.proto delete mode 100644 v2/object/service.proto delete mode 100644 v2/object/types.proto delete mode 100644 v2/refs/types.proto delete mode 100644 v2/service/meta.proto delete mode 100644 v2/service/verify.proto delete mode 100644 v2/session/service.proto delete mode 100644 v2/storagegroup/types.proto diff --git a/prepare.sh b/prepare.sh index e9cfb22..5962123 100755 --- a/prepare.sh +++ b/prepare.sh @@ -18,15 +18,19 @@ for file in $ARGS; do dir=$(dirname $file) cp -r $dir $API_GO_PATH/$prefix done -cd $API_GO_PATH/$prefix # MODIFY FILES +cd $API_GO_PATH/$prefix for file in $ARGS; do - sed -i "s/import\ \"\(.*\)\";/import\ \"$prefix\/\1\";/" $file + sed -i "s/import\ \"\(.*\)\";/import\ \"$prefix\/\1\";/" $file done +cd $API_GO_PATH # COMPILE make protoc -# REMOVE PROTO FILES -# TO BE DONE AS NEOFS-API WILL BE STABLE +# REMOVE PROTO DEFINITIONS +ARGS=$(find ./ -name '*.proto' -not -path './vendor/*') +for file in $ARGS; do + rm $file +done diff --git a/v2/accounting/service.proto b/v2/accounting/service.proto deleted file mode 100644 index 35d55a7..0000000 --- a/v2/accounting/service.proto +++ /dev/null @@ -1,75 +0,0 @@ -syntax = "proto3"; - -package neo.fs.v2.accounting; - -option go_package = "github.com/nspcc-dev/neofs-api-go/v2/accounting"; -option csharp_namespace = "NeoFS.API.Accounting"; - -import "v2/refs/types.proto"; -import "v2/service/meta.proto"; -import "v2/service/verify.proto"; - -// The service provides methods for obtaining information -// about the account balance in NeoFS system. -service Accounting { - // Returns the amount of funds for the requested NeoFS account. - rpc Balance (BalanceRequest) returns (BalanceResponse); -} - -// Message defines the request body of Balance method. -// -// To indicate the account for which the balance is requested, it's identifier -// is used. -// -// To gain access to the requested information, the request body must be formed -// according to the requirements from the system specification. -message BalanceRequest { - message Body { - // Carries user identifier in NeoFS system for which the balance - // is requested. - neo.fs.v2.refs.OwnerID owner_id = 1; - } - - // Body of the balance request message. - Body body = 1; - - // Carries request meta information. Header data is used only to regulate - // message transport and does not affect request execution. - neo.fs.v2.service.RequestMetaHeader meta_header = 2; - - // Carries request verification information. This header is used to - // authenticate the nodes of the message route and check the correctness - // of transmission. - neo.fs.v2.service.RequestVerificationHeader verify_header = 3; -} - -// Decimal represents the decimal numbers. -message Decimal { - // value carries number value. - int64 value = 1; - - // precision carries value precision. - uint32 precision = 2; -} - -// Message defines the response body of Balance method. -// -// The amount of funds is calculated in decimal numbers. -message BalanceResponse { - message Body { - // Carries the amount of funds on the account. - Decimal balance = 1; - } - - // Body of the balance response message. - Body body = 1; - - // Carries response meta information. Header data is used only to regulate - // message transport and does not affect request execution. - neo.fs.v2.service.ResponseMetaHeader meta_header = 2; - - // Carries response verification information. This header is used to - // authenticate the nodes of the message route and check the correctness - // of transmission. - neo.fs.v2.service.ResponseVerificationHeader verify_header = 3; -} diff --git a/v2/acl/types.proto b/v2/acl/types.proto deleted file mode 100644 index a0a4c0b..0000000 --- a/v2/acl/types.proto +++ /dev/null @@ -1,106 +0,0 @@ -syntax = "proto3"; - -package neo.fs.v2.acl; - -option go_package = "github.com/nspcc-dev/neofs-api-go/v2/acl"; -option csharp_namespace = "NeoFS.API.Acl"; - -import "v2/refs/types.proto"; - -// Target of the access control rule in access control list. -enum Target { - // Unknown target, default value. - UNKNOWN = 0; - - // User target rule is applied if sender is the owner of the container. - USER = 1; - - // System target rule is applied if sender is the storage node within the - // container or inner ring node. - SYSTEM = 2; - - // Others target rule is applied if sender is not user or system target. - OTHERS = 3; -} - -// EACLRecord groups information about extended ACL rule. -message EACLRecord { - // Operation is an enumeration of operation types. - enum Operation { - OPERATION_UNKNOWN = 0; - GET = 1; - HEAD = 2; - PUT = 3; - DELETE = 4; - SEARCH = 5; - GETRANGE = 6; - GETRANGEHASH = 7; - } - - // Operation carries type of operation. - Operation operation = 1 [json_name = "Operation"]; - - // Action is an enumeration of EACL actions. - enum Action { - ACTION_UNKNOWN = 0; - ALLOW = 1; - DENY = 2; - } - - // Action carries ACL target action. - Action action = 2 [json_name = "Action"]; - - // FilterInfo groups information about filter. - message FilterInfo { - // Header is an enumeration of filtering header types. - enum Header { - HEADER_UNKNOWN = 0; - REQUEST = 1; - OBJECT = 2; - } - - // Header carries type of header. - Header header = 1 [json_name = "HeaderType"]; - - // MatchType is an enumeration of match types. - enum MatchType { - MATCH_UNKNOWN = 0; - STRING_EQUAL = 1; - STRING_NOT_EQUAL = 2; - } - - // MatchType carries type of match. - MatchType match_type = 2 [json_name = "MatchType"]; - - // header_name carries name of filtering header. - string header_name = 3 [json_name="Name"]; - - // header_val carries value of filtering header. - string header_val = 4 [json_name="Value"]; - } - - // filters carries set of filters. - repeated FilterInfo filters = 3 [json_name="Filters"]; - - // TargetInfo groups information about extended ACL target. - message TargetInfo { - // target carries target of ACL rule. - Target target = 1 [json_name="Role"]; - - // key_list carries public keys of ACL target. - repeated bytes key_list = 2 [json_name="Keys"]; - } - - // targets carries information about extended ACL target list. - repeated TargetInfo targets = 4 [json_name="Targets"]; -} - -// EACLRecord carries the information about extended ACL rules. -message EACLTable { - // Carries identifier of the container that should use given - // access control rules. - neo.fs.v2.refs.ContainerID container_id = 1 [json_name="ContainerID"]; - - // Records carries list of extended ACL rule records. - repeated EACLRecord records = 2 [json_name="Records"]; -} diff --git a/v2/container/service.proto b/v2/container/service.proto deleted file mode 100644 index 3d6c9c2..0000000 --- a/v2/container/service.proto +++ /dev/null @@ -1,285 +0,0 @@ -syntax = "proto3"; - -package neo.fs.v2.container; - -option go_package = "github.com/nspcc-dev/neofs-api-go/v2/container"; -option csharp_namespace = "NeoFS.API.Container"; - -import "v2/acl/types.proto"; -import "v2/container/types.proto"; -import "v2/refs/types.proto"; -import "v2/service/meta.proto"; -import "v2/service/verify.proto"; - -// Service provides API to access container smart-contract in morph chain -// via NeoFS node. -service Service { - // Put invokes 'Put' method in container smart-contract and returns - // response immediately. After new block in morph chain, request is verified - // by inner ring nodes. After one more block in morph chain, container - // added into smart-contract storage. - rpc Put(PutRequest) returns (PutResponse); - - // Delete invokes 'Delete' method in container smart-contract and returns - // response immediately. After new block in morph chain, request is verified - // by inner ring nodes. After one more block in morph chain, container - // removed from smart-contract storage. - rpc Delete(DeleteRequest) returns (DeleteResponse); - - // Get returns container from container smart-contract storage. - rpc Get(GetRequest) returns (GetResponse); - - // List returns all owner's containers from container smart-contract - // storage. - rpc List(ListRequest) returns (ListResponse); - - // SetExtendedACL invokes 'SetEACL' method in container smart-contract and - // returns response immediately. After new block in morph chain, - // Extended ACL added into smart-contract storage. - rpc SetExtendedACL(SetExtendedACLRequest) returns (SetExtendedACLResponse); - - // GetExtendedACL returns Extended ACL table and signature from container - // smart-contract storage. - rpc GetExtendedACL(GetExtendedACLRequest) returns (GetExtendedACLResponse); -} - -message PutRequest { - message Body { - // Container to create in NeoFS. - neo.fs.v2.container.Container container = 1; - - // Public Key of container owner. It can be public key of the owner - // or it can be public key that bound in neofs.id smart-contract. - bytes public_key = 2; - - // Signature of stable-marshalled container according to RFC-6979. - bytes signature = 3; - } - - // Body of container put request message. - Body body = 1; - - // Carries request meta information. Header data is used only to regulate - // message transport and does not affect request execution. - neo.fs.v2.service.RequestMetaHeader meta_header = 2; - - // Carries request verification information. This header is used to - // authenticate the nodes of the message route and check the correctness - // of transmission. - neo.fs.v2.service.RequestVerificationHeader verify_header = 3; -} - -message PutResponse { - message Body { - // container_id carries identifier of the new container. - neo.fs.v2.refs.ContainerID container_id = 1; - } - - // Body of container put response message. - Body body = 1; - - // Carries response meta information. Header data is used only to regulate - // message transport and does not affect request execution. - neo.fs.v2.service.ResponseMetaHeader meta_header = 2; - - // Carries response verification information. This header is used to - // authenticate the nodes of the message route and check the correctness - // of transmission. - neo.fs.v2.service.ResponseVerificationHeader verify_header = 3; -} - -message DeleteRequest { - message Body { - // container_id carries identifier of the container to delete - // from NeoFS. - neo.fs.v2.refs.ContainerID container_id = 1; - - // Signature of container id according to RFC-6979. - bytes signature = 2; - } - - // Body of container delete request message. - Body body = 1; - - // Carries request meta information. Header data is used only to regulate - // message transport and does not affect request execution. - neo.fs.v2.service.RequestMetaHeader meta_header = 2; - - // Carries request verification information. This header is used to - // authenticate the nodes of the message route and check the correctness - // of transmission. - neo.fs.v2.service.RequestVerificationHeader verify_header = 3; -} - -// DeleteResponse is empty because delete operation is asynchronous and done -// via consensus in inner ring nodes -message DeleteResponse { - message Body {} - - // Body of container delete response message. - Body body = 1; - - // Carries response meta information. Header data is used only to regulate - // message transport and does not affect request execution. - neo.fs.v2.service.ResponseMetaHeader meta_header = 2; - - // Carries response verification information. This header is used to - // authenticate the nodes of the message route and check the correctness - // of transmission. - neo.fs.v2.service.ResponseVerificationHeader verify_header = 3; -} - -message GetRequest { - message Body { - // container_id carries identifier of the container to get. - neo.fs.v2.refs.ContainerID container_id = 1; - } - - // Body of container get request message. - Body body = 1; - - // Carries request meta information. Header data is used only to regulate - // message transport and does not affect request execution. - neo.fs.v2.service.RequestMetaHeader meta_header = 2; - - // Carries request verification information. This header is used to - // authenticate the nodes of the message route and check the correctness - // of transmission. - neo.fs.v2.service.RequestVerificationHeader verify_header = 3; -} - -message GetResponse { - message Body { - // Container that has been requested. - neo.fs.v2.container.Container container = 1; - } - - // Body of container get response message. - Body body = 1; - - // Carries response meta information. Header data is used only to regulate - // message transport and does not affect request execution. - neo.fs.v2.service.ResponseMetaHeader meta_header = 2; - - // Carries response verification information. This header is used to - // authenticate the nodes of the message route and check the correctness - // of transmission. - neo.fs.v2.service.ResponseVerificationHeader verify_header = 3; -} - -message ListRequest { - message Body { - // owner_id carries identifier of the container owner. - neo.fs.v2.refs.OwnerID owner_id = 1; - } - - // Body of list containers request message. - Body body = 1; - - // Carries request meta information. Header data is used only to regulate - // message transport and does not affect request execution. - neo.fs.v2.service.RequestMetaHeader meta_header = 2; - - // Carries request verification information. This header is used to - // authenticate the nodes of the message route and check the correctness - // of transmission. - neo.fs.v2.service.RequestVerificationHeader verify_header = 3; -} - -message ListResponse { - message Body { - // ContainerIDs carries list of identifiers of the containers that belong to the owner. - repeated refs.ContainerID container_ids = 1; - } - - // Body of list containers response message. - Body body = 1; - - // Carries response meta information. Header data is used only to regulate - // message transport and does not affect request execution. - neo.fs.v2.service.ResponseMetaHeader meta_header = 2; - - // Carries response verification information. This header is used to - // authenticate the nodes of the message route and check the correctness - // of transmission. - neo.fs.v2.service.ResponseVerificationHeader verify_header = 3; -} - -message SetExtendedACLRequest { - message Body { - // Extended ACL to set for the container. - neo.fs.v2.acl.EACLTable eacl = 1; - - // Signature of stable-marshalled Extended ACL according to RFC-6979. - bytes signature = 2; - } - - // Body of set extended acl request message. - Body body = 1; - - // Carries request meta information. Header data is used only to regulate - // message transport and does not affect request execution. - neo.fs.v2.service.RequestMetaHeader meta_header = 2; - - // Carries request verification information. This header is used to - // authenticate the nodes of the message route and check the correctness - // of transmission. - neo.fs.v2.service.RequestVerificationHeader verify_header = 3; -} - -message SetExtendedACLResponse { - message Body { } - - // Body of set extended acl response message. - Body body = 1; - - // Carries response meta information. Header data is used only to regulate - // message transport and does not affect request execution. - neo.fs.v2.service.ResponseMetaHeader meta_header = 2; - - // Carries response verification information. This header is used to - // authenticate the nodes of the message route and check the correctness - // of transmission. - neo.fs.v2.service.ResponseVerificationHeader verify_header = 3; -} - -message GetExtendedACLRequest { - message Body { - // container_id carries identifier of the container that has Extended ACL. - neo.fs.v2.refs.ContainerID container_id = 1; - } - - // Body of get extended acl request message. - Body body = 1; - - // Carries request meta information. Header data is used only to regulate - // message transport and does not affect request execution. - neo.fs.v2.service.RequestMetaHeader meta_header = 2; - - // Carries request verification information. This header is used to - // authenticate the nodes of the message route and check the correctness - // of transmission. - neo.fs.v2.service.RequestVerificationHeader verify_header = 3; -} - -message GetExtendedACLResponse { - message Body { - // Extended ACL that has been requested if it was set up. - neo.fs.v2.acl.EACLTable eacl = 1; - - // Signature of stable-marshalled Extended ACL according to RFC-6979. - bytes signature = 2; - } - - // Body of get extended acl response message. - Body body = 1; - - // Carries response meta information. Header data is used only to regulate - // message transport and does not affect request execution. - neo.fs.v2.service.ResponseMetaHeader meta_header = 2; - - // Carries response verification information. This header is used to - // authenticate the nodes of the message route and check the correctness - // of transmission. - neo.fs.v2.service.ResponseVerificationHeader verify_header = 3; -} diff --git a/v2/container/types.proto b/v2/container/types.proto deleted file mode 100644 index aa9fb2c..0000000 --- a/v2/container/types.proto +++ /dev/null @@ -1,40 +0,0 @@ -syntax = "proto3"; - -package neo.fs.v2.container; - -option go_package = "github.com/nspcc-dev/neofs-api-go/v2/container"; -option csharp_namespace = "NeoFS.API.Container"; - -import "v2/netmap/types.proto"; -import "v2/refs/types.proto"; - -// 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. ID of the container is a 32 byte long -// SHA256 hash of stable-marshalled container message. -message Container { - // OwnerID carries identifier of the container owner. - neo.fs.v2.refs.OwnerID owner_id = 1; - - // Nonce is a 16 byte UUID, used to avoid collisions of container id. - bytes nonce = 2; - - // BasicACL contains access control rules for owner, system, others groups and - // permission bits for bearer token and Extended ACL. - uint32 basic_acl = 3; - - // Attribute is a key-value pair of strings. - message Attribute { - // Key of immutable container attribute. - string key = 1; - - // Value of immutable container attribute. - string value = 2; - } - - // Attributes define any immutable characteristics of container. - repeated Attribute attributes = 4; - - // Rules define storage policy for the object inside the container. - neo.fs.v2.netmap.PlacementRule rules = 5; -} diff --git a/v2/netmap/types.proto b/v2/netmap/types.proto deleted file mode 100644 index 0807cf4..0000000 --- a/v2/netmap/types.proto +++ /dev/null @@ -1,92 +0,0 @@ -syntax = "proto3"; - -package neo.fs.v2.netmap; - -option go_package = "github.com/nspcc-dev/neofs-api-go/v2/netmap"; -option csharp_namespace = "NeoFS.API.Netmap"; - -message PlacementRule { - uint32 repl_factor = 1; - - message SFGroup { - message Filter { - string key = 1; - - message SimpleFilters { - repeated SimpleFilter filters = 1; - } - - message SimpleFilter { - enum Operation { - NP = 0; - EQ = 1; - NE = 2; - GT = 3; - GE = 4; - LT = 5; - LE = 6; - OR = 7; - AND = 8; - } - - Operation op = 1; - - oneof args { - string value = 2; - SimpleFilters f_args = 3; - } - } - - SimpleFilter f = 2; - } - - repeated Filter filters = 1; - - message Selector { - uint32 count = 1; - string key = 2; - } - - repeated Selector selectors = 2; - - repeated uint32 exclude = 3; - } - - repeated SFGroup sf_groups = 2; -} - -// Groups the information about the NeoFS node. -message NodeInfo { - // Carries network address of the NeoFS node. - string address = 1; - - // Carries public key of the NeoFS node in a binary format. - bytes public_key = 2; - - // Groups attributes of the NeoFS node. - message Attribute { - // Carries string key to the node attribute. - string key = 1; - - // Carries string value of the node attribute. - string value = 2; - } - - // Carries list of the NeoFS node attributes in a string key-value format. - repeated Attribute attributes = 3; - - // Represents the enumeration of various states of the NeoFS node. - enum State { - // Undefined state. - UNKNOWN = 0; - - // Active state in the network. - ONLINE = 1; - - // Network unavailable state. - OFFLINE = 2; - } - - // Carries state of the NeoFS node. - State state = 4; -} \ No newline at end of file diff --git a/v2/object/service.proto b/v2/object/service.proto deleted file mode 100644 index 28051e3..0000000 --- a/v2/object/service.proto +++ /dev/null @@ -1,407 +0,0 @@ -syntax = "proto3"; - -package neo.fs.v2.object; - -option go_package = "github.com/nspcc-dev/neofs-api-go/v2/object"; -option csharp_namespace = "NeoFS.API.Object"; - -import "v2/object/types.proto"; -import "v2/refs/types.proto"; -import "v2/service/meta.proto"; -import "v2/service/verify.proto"; - -// Object service provides API for manipulating with the object. -service Service { - // Get the object from container. Response uses gRPC stream. First response - // message carry object of requested address. Chunk messages are parts of - // the object's payload if it is needed. All messages except first carry - // chunks. Requested object can be restored by concatenation of object - // message payload and all chunks keeping receiving order. - rpc Get(GetRequest) returns (stream GetResponse); - - // Put the object into container. Request uses gRPC stream. First message - // SHOULD BE type of PutHeader. Container id and Owner id of object SHOULD - // BE set. Session token SHOULD BE obtained before put operation (see - // session package). Chunk messages considered by server as part of object - // payload. All messages except first SHOULD BE chunks. Chunk messages - // SHOULD BE sent in direct order of fragmentation. - rpc Put(stream PutRequest) returns (PutResponse); - - // Delete the object from a container - rpc Delete(DeleteRequest) returns (DeleteResponse); - - // Head returns the object without data payload. Object in the - // response has system header only. If full headers flag is set, extended - // headers are also present. - rpc Head(HeadRequest) returns (HeadResponse); - - // Search objects in container. Version of query language format SHOULD BE - // set to 1. Search query represented in serialized format (see query - // package). - rpc Search(SearchRequest) returns (stream SearchResponse); - - // GetRange of data payload. Range is a pair (offset, length). - // Requested range can be restored by concatenation of all chunks - // keeping receiving order. - rpc GetRange(GetRangeRequest) returns (stream GetRangeResponse); - - // GetRangeHash returns homomorphic hash of object payload range after XOR - // operation. Ranges are set of pairs (offset, length). Hashes order in - // response corresponds to ranges order in request. Homomorphic hash is - // calculated for XORed data. - rpc GetRangeHash(GetRangeHashRequest) returns (GetRangeHashResponse); -} - -message GetRequest { - message Body { - // Address of the requested object. - neo.fs.v2.refs.Address address = 1; - - // Carries the raw option flag of the request. - // Raw request is sent to receive only the objects - // that are physically stored on the server. - bool raw = 2; - } - // Body of get object request message. - Body body = 1; - - // Carries request meta information. Header data is used only to regulate message - // transport and does not affect request execution. - neo.fs.v2.service.RequestMetaHeader meta_header = 2; - - // Carries request verification information. This header is used to authenticate - // the nodes of the message route and check the correctness of transmission. - neo.fs.v2.service.RequestVerificationHeader verify_header = 3; -} - -message GetResponse { - message Body { - // Initialization parameters of the object got from NeoFS. - message Init { - // Object ID - neo.fs.v2.refs.ObjectID object_id = 1; - // Object signature - neo.fs.v2.service.Signature signature =2; - // Object header. - Header header = 3; - } - // Carries the single message of the response stream. - oneof object_part { - // Initialization parameters of the object stream. - Init init =1; - // Part of the object payload. - bytes chunk = 2; - } - } - // Body of get object response message. - Body body = 1; - - // Carries response meta information. Header data is used only to regulate - // message transport and does not affect request execution. - neo.fs.v2.service.ResponseMetaHeader meta_header = 2; - - // Carries response verification information. This header is used to - // authenticate the nodes of the message route and check the correctness - // of transmission. - neo.fs.v2.service.ResponseVerificationHeader verify_header = 3; -} - -message PutRequest { - message Body { - // Groups initialization parameters of object placement in NeoFS. - message Init { - // Object ID, where available - neo.fs.v2.refs.ObjectID object_id = 1; - // Object signature, were available - neo.fs.v2.service.Signature signature =2; - // Header of the object to save in the system. - Header header = 3; - // Number of the object copies to store within the RPC call. - // Default zero value is processed according to the - // container placement rules. - uint32 copies_number = 4; - } - - // Carries the single part of the query stream. - oneof object_part { - // Carries the initialization parameters of the object stream. - Init init = 1; - // Carries part of the object payload. - bytes chunk = 2; - } - } - // Body of put object request message. - Body body = 1; - - // Carries request meta information. Header data is used only to regulate message - // transport and does not affect request execution. - neo.fs.v2.service.RequestMetaHeader meta_header = 2; - - // Carries request verification information. This header is used to authenticate - // the nodes of the message route and check the correctness of transmission. - neo.fs.v2.service.RequestVerificationHeader verify_header = 3; -} - -message PutResponse { - message Body { - // Carries identifier of the saved object. - // It is used to access an object in the container. - neo.fs.v2.refs.ObjectID object_id = 1; - } - // Body of put object response message. - Body body = 1; - - // Carries response meta information. Header data is used only to regulate - // message transport and does not affect request execution. - neo.fs.v2.service.ResponseMetaHeader meta_header = 2; - - // Carries response verification information. This header is used to - // authenticate the nodes of the message route and check the correctness - // of transmission. - neo.fs.v2.service.ResponseVerificationHeader verify_header = 3; -} - -message DeleteRequest { - message Body { - // Carries the address of the object to be deleted. - neo.fs.v2.refs.Address address = 1; - // Carries identifier the object owner. - neo.fs.v2.refs.OwnerID owner_id = 2; - } - // Body of delete object request message. - Body body = 1; - - // Carries request meta information. Header data is used only to regulate message - // transport and does not affect request execution. - neo.fs.v2.service.RequestMetaHeader meta_header = 2; - - // Carries request verification information. This header is used to authenticate - // the nodes of the message route and check the correctness of transmission. - neo.fs.v2.service.RequestVerificationHeader verify_header = 3; -} - -// DeleteResponse is empty because we cannot guarantee permanent object removal -// in distributed system. -message DeleteResponse { - message Body { } - - // Body of delete object response message. - Body body = 1; - - // Carries response meta information. Header data is used only to regulate - // message transport and does not affect request execution. - neo.fs.v2.service.ResponseMetaHeader meta_header = 2; - - // Carries response verification information. This header is used to - // authenticate the nodes of the message route and check the correctness - // of transmission. - neo.fs.v2.service.ResponseVerificationHeader verify_header = 3; -} - -message HeadRequest { - message Body { - // Address of the object with the requested header. - neo.fs.v2.refs.Address address = 1; - // Return only minimal header subset - bool main_only = 2; - // Carries the raw option flag of the request. - // Raw request is sent to receive only the headers of the objects - // that are physically stored on the server. - bool raw = 3; - } - // Body of head object request message. - Body body = 1; - - // Carries request meta information. Header data is used only to regulate message - // transport and does not affect request execution. - neo.fs.v2.service.RequestMetaHeader meta_header = 2; - - // Carries request verification information. This header is used to authenticate - // the nodes of the message route and check the correctness of transmission. - neo.fs.v2.service.RequestVerificationHeader verify_header = 3; -} - -message HeadResponse { - message Body { - message ShortHeader { - // Object format version. - neo.fs.v2.service.Version version = 1; - // Epoch when the object was created - uint64 creation_epoch = 2; - // Object's owner - neo.fs.v2.refs.OwnerID owner_id = 3; - // Type of the object payload content - ObjectType object_type = 4; - // Size of payload in bytes. - // 0xFFFFFFFFFFFFFFFF means `payload_length` is unknown - uint64 payload_length = 5; - } - // Carries the requested object header or it's part - oneof head{ - Header header = 1; - ShortHeader short_header = 2; - } - } - // Body of head object response message. - Body body = 1; - - // Carries response meta information. Header data is used only to regulate - // message transport and does not affect request execution. - neo.fs.v2.service.ResponseMetaHeader meta_header = 2; - - // Carries response verification information. This header is used to - // authenticate the nodes of the message route and check the correctness - // of transmission. - neo.fs.v2.service.ResponseVerificationHeader verify_header = 3; -} - -message SearchRequest { - message Body { - // Carries search container identifier. - neo.fs.v2.refs.ContainerID container_id = 1; - - message Query { - uint32 version = 1; - - message Filter { - enum MatchType { - MATCH_UNKNOWN = 0; - STRING_EQUAL = 1; - } - - MatchType match_type = 1; - - string name = 2; - - string value = 3; - } - - repeated Filter filters = 2; - } - - Query query = 2; - } - - // Body of search object request message. - Body body = 1; - - // Carries request meta information. Header data is used only to regulate message - // transport and does not affect request execution. - neo.fs.v2.service.RequestMetaHeader meta_header = 2; - - // Carries request verification information. This header is used to authenticate - // the nodes of the message route and check the correctness of transmission. - neo.fs.v2.service.RequestVerificationHeader verify_header = 3; -} - -message SearchResponse { - message Body { - // Carries list of object identifiers that match the search query. - repeated neo.fs.v2.refs.ObjectID id_list = 1; - } - - // Body of search object response message. - Body body = 1; - - // Carries response meta information. Header data is used only to regulate - // message transport and does not affect request execution. - neo.fs.v2.service.ResponseMetaHeader meta_header = 2; - - // Carries response verification information. This header is used to - // authenticate the nodes of the message route and check the correctness - // of transmission. - neo.fs.v2.service.ResponseVerificationHeader verify_header = 3; -} - -// Range groups the parameters of object payload range. -message Range { - // Carries the offset of the range from the object payload start. - uint64 offset = 1; - - // Carries the length of the object payload range. - uint64 length = 2; -} - -message GetRangeRequest { - message Body { - // Address carries address of the object that contains the requested payload range. - neo.fs.v2.refs.Address address = 1; - - // Range carries the parameters of the requested payload range. - Range range = 2; - } - - // Body of get range object request message. - Body body = 1; - - // Carries request meta information. Header data is used only to regulate message - // transport and does not affect request execution. - neo.fs.v2.service.RequestMetaHeader meta_header = 2; - - // Carries request verification information. This header is used to authenticate - // the nodes of the message route and check the correctness of transmission. - neo.fs.v2.service.RequestVerificationHeader verify_header = 3; -} - -message GetRangeResponse { - message Body { - // Carries part of the object payload. - bytes chunk = 1; - } - - // Body of get range object response message. - Body body = 1; - - // Carries response meta information. Header data is used only to regulate - // message transport and does not affect request execution. - neo.fs.v2.service.ResponseMetaHeader meta_header = 2; - - // Carries response verification information. This header is used to - // authenticate the nodes of the message route and check the correctness - // of transmission. - neo.fs.v2.service.ResponseVerificationHeader verify_header = 3; -} - -message GetRangeHashRequest { - message Body { - // Carries address of the object that contains the requested payload range. - neo.fs.v2.refs.Address address = 1; - - // Carries the list of object payload range to calculate homomorphic hash. - repeated Range ranges = 2; - - // Carries binary salt to XOR object payload ranges before hash calculation. - bytes salt = 3; - } - - // Body of get range hash object request message. - Body body = 1; - - // Carries request meta information. Header data is used only to regulate message - // transport and does not affect request execution. - neo.fs.v2.service.RequestMetaHeader meta_header = 2; - - // Carries request verification information. This header is used to authenticate - // the nodes of the message route and check the correctness of transmission. - neo.fs.v2.service.RequestVerificationHeader verify_header = 3; -} - -message GetRangeHashResponse { - message Body { - // Carries list of homomorphic hashes in a binary format. - repeated bytes hash_list = 1; - } - - // Body of get range hash object response message. - Body body = 1; - - // Carries response meta information. Header data is used only to regulate - // message transport and does not affect request execution. - neo.fs.v2.service.ResponseMetaHeader meta_header = 2; - - // Carries response verification information. This header is used to - // authenticate the nodes of the message route and check the correctness - // of transmission. - neo.fs.v2.service.ResponseVerificationHeader verify_header = 3; -} - diff --git a/v2/object/types.proto b/v2/object/types.proto deleted file mode 100644 index 2881f0f..0000000 --- a/v2/object/types.proto +++ /dev/null @@ -1,85 +0,0 @@ -syntax = "proto3"; - -package neo.fs.v2.object; - -option go_package = "github.com/nspcc-dev/neofs-api-go/v2/object"; -option csharp_namespace = "NeoFS.API.Object"; - -import "v2/refs/types.proto"; -import "v2/service/meta.proto"; -import "v2/service/verify.proto"; - -// Type of the object payload content -enum ObjectType { - // Just a normal object - REGULAR = 0; - // Used internally to identify deleted objects - TOMBSTONE = 1; - // Identifies that the object holds StorageGroup information - STORAGE_GROUP = 2; -} - -message Header { - // Object's container - neo.fs.v2.refs.ContainerID container_id = 1; - // Object's owner - neo.fs.v2.refs.OwnerID owner_id = 2; - // Epoch when the object was created - uint64 creation_epoch = 3; - // Object format version. - // Effectively the version of API library used to create particular object - neo.fs.v2.service.Version version = 4; - // Size of payload in bytes. - // 0xFFFFFFFFFFFFFFFF means `payload_length` is unknown - uint64 payload_length = 5; - // Hash of payload bytes - bytes payload_hash = 6; - ObjectType object_type = 7; - // Homomorphic hash of the object payload. - bytes homomorphic_hash = 8; - // Session token, if it was used during Object creation. - // Need it to verify integrity and authenticity out of Request scope. - neo.fs.v2.service.SessionToken session_token = 9; - - // Attribute groups the user-defined Key-Value pairs attached to the object - message Attribute { - // string key to the object attribute - string key = 1; - // string value of the object attribute - string value = 2; - } - repeated Attribute attributes = 10; - - // Information about spawning the objects through a payload splitting. - message Split { - // Identifier of the origin object. - // Parent and children objects must be within the same container. - // Parent object_id is known only to the minor child. - neo.fs.v2.refs.ObjectID parent = 1; - // Previous carries identifier of the left split neighbor. - neo.fs.v2.refs.ObjectID previous = 2; - // `signature` field of the parent object. Used to reconstruct parent. - neo.fs.v2.service.Signature parent_signature = 3; - // `header` field of the parent object. Used to reconstruct parent. - Header parent_header = 4; - // Children carries list of identifiers of the objects generated by splitting the current. - repeated neo.fs.v2.refs.ObjectID children = 5; - } - // Position of the object in the split hierarchy. - Split split = 11; -} - -// Object structure. -message Object { - // Object's unique identifier. - // Object is content-addressed. It means id will change if header or payload - // changes. It's calculated as a hash of header field, which contains hash of - // object's payload - neo.fs.v2.refs.ObjectID object_id = 1; - // Signed object_id - neo.fs.v2.service.Signature signature = 2; - // Object metadata headers - Header header = 3; - // Payload bytes. - bytes payload = 4; -} diff --git a/v2/refs/types.proto b/v2/refs/types.proto deleted file mode 100644 index eab1044..0000000 --- a/v2/refs/types.proto +++ /dev/null @@ -1,32 +0,0 @@ -syntax = "proto3"; - -package neo.fs.v2.refs; - -option go_package = "github.com/nspcc-dev/neofs-api-go/v2/refs"; -option csharp_namespace = "NeoFS.API.Refs"; - -// Address of object (container id + object id) -message Address { - // container_id carries container identifier. - ContainerID container_id = 1; - // object_id carries object identifier. - ObjectID object_id = 2; -} - -// NeoFS object identifier. -message ObjectID { - // value carries the object identifier in a binary format. - bytes value = 1; -} - -// NeoFS container identifier. -message ContainerID { - // value carries the container identifier in a binary format. - bytes value = 1; -} - -// OwnerID group information about the owner of the NeoFS container. -message OwnerID { - // value carries the identifier of the container owner in a binary format. - bytes value = 1; -} \ No newline at end of file diff --git a/v2/service/meta.proto b/v2/service/meta.proto deleted file mode 100644 index 203e7ce..0000000 --- a/v2/service/meta.proto +++ /dev/null @@ -1,129 +0,0 @@ -syntax = "proto3"; - -package neo.fs.v2.service; - -option go_package = "github.com/nspcc-dev/neofs-api-go/v2/service"; -option csharp_namespace = "NeoFS.API.Service"; - -import "v2/acl/types.proto"; -import "v2/refs/types.proto"; -import "v2/service/verify.proto"; - -message XHeader { - // Key of the X-Header. - string key = 1; - // Value of the X-Header. - string value = 2; -} - -// Represents API version used by node. -message Version { - // Major API version. - uint32 major = 1; - // Minor API version. - uint32 minor = 2; -} - -// Lifetime parameters of the token. Filed names taken from rfc7519. -message TokenLifetime { - // Expiration Epoch - uint64 exp = 1; - // Not valid before Epoch - uint64 nbf = 2; - // Issued at Epoch - uint64 iat = 3; -} - -// NeoFS session token. -message SessionToken { - message Body { - // ID is a token identifier. valid UUIDv4 represented in bytes - bytes id = 1; - // OwnerID carries identifier of the session initiator. - neo.fs.v2.refs.OwnerID owner_id = 2; - // Verb is an enumeration of session request types - enum Verb { - // Refers to object.Put RPC call - OBJECT_PUT = 0; - // Refers to object.Get RPC call - OBJECT_GET = 1; - // Refers to object.Head RPC call - OBJECT_HEAD = 2; - // Refers to object.Search RPC call - OBJECT_SEARCH = 3; - // Refers to object.Delete RPC call - OBJECT_DELETE = 4; - // Refers to object.GetRange RPC call - OBJECT_RANGE = 5; - // Refers to object.GetRangeHash RPC call - OBJECT_RANGEHASH = 6; - } - // Verb is a type of request for which the token is issued - Verb verb = 3; - // Lifetime is a lifetime of the session - TokenLifetime lifetime = 4; - // SessionKey is a public key of session key - bytes session_key = 5; - // Carries context of the session. - oneof context { - // object_address represents the object session context. - neo.fs.v2.refs.Address object_address = 6; - } - } - // Session Token body - Body token = 1; - - // Signature is a signature of session token information - Signature signature = 2; -} - -// BearerToken has information about request ACL rules with limited lifetime -message BearerToken { - message Body { - // EACLTable carries table of extended ACL rules - neo.fs.v2.acl.EACLTable eacl_table = 1; - // OwnerID carries identifier of the token owner - neo.fs.v2.refs.OwnerID owner_id = 2; - // Token expiration and valid time period parameters - TokenLifetime lifetime = 3; - } - // Bearer Token body - Body token = 1; - - // Signature of BearerToken body - Signature signature = 2; -} - -// Information about the request -message RequestMetaHeader { - // Client API version. - Version version = 1; - // Client local epoch number. Set to 0 if unknown. - uint64 epoch = 2; - // Maximum number of nodes in the request route. - uint32 ttl = 3; - // Request X-Headers. - repeated XHeader x_headers = 4; - // Token is a token of the session within which the request is sent - SessionToken token = 5; - // Bearer is a Bearer token of the request - BearerToken bearer = 6; - - // RequestMetaHeader of the origin request. - RequestMetaHeader origin = 7; -} - -// Information about the response -message ResponseMetaHeader { - // Server API version. - Version version = 1; - // Server local epoch number. - uint64 epoch = 2; - // Maximum number of nodes in the response route. - uint32 ttl = 3; - // Response X-Headers. - repeated XHeader x_headers = 4; - - // Carries response meta header of the origin response. - ResponseMetaHeader origin = 5; -} diff --git a/v2/service/verify.proto b/v2/service/verify.proto deleted file mode 100644 index 0b9b87c..0000000 --- a/v2/service/verify.proto +++ /dev/null @@ -1,40 +0,0 @@ -syntax = "proto3"; - -package neo.fs.v2.service; - -option go_package = "github.com/nspcc-dev/neofs-api-go/v2/service"; -option csharp_namespace = "NeoFS.API.Service"; - -// Signature of something in NeoFS -message Signature { - // Public key used for signing. - bytes key = 1; - // Signature - bytes sign = 2; -} - -// Verification info for request signed by all intermediate nodes -message RequestVerificationHeader { - // Request Body signature. Should be generated once by request initiator. - Signature body_signature = 1; - // Request Meta signature is added and signed by any intermediate node - Signature meta_signature = 2; - // Sign previous hops - Signature origin_signature = 3; - - // Chain of previous hops signatures - RequestVerificationHeader origin = 4; -} - -// Verification info for response signed by all intermediate nodes -message ResponseVerificationHeader { - // Response Body signature. Should be generated once by answering node. - Signature body_signature = 1; - // Response Meta signature is added and signed by any intermediate node - Signature meta_signature = 2; - // Sign previous hops - Signature origin_signature = 3; - - // Chain of previous hops signatures - ResponseVerificationHeader origin = 4; -} diff --git a/v2/session/service.proto b/v2/session/service.proto deleted file mode 100644 index 39650cf..0000000 --- a/v2/session/service.proto +++ /dev/null @@ -1,59 +0,0 @@ -syntax = "proto3"; - -package neo.fs.v2.session; -option go_package = "github.com/nspcc-dev/neofs-api-go/v2/session"; -option csharp_namespace = "NeoFS.API.Session"; - -import "v2/refs/types.proto"; -import "v2/service/meta.proto"; -import "v2/service/verify.proto"; - -service Session { - // Create opens new session between the client and the server. - rpc Create (CreateRequest) returns (CreateResponse); -} - -// CreateRequest carries an information necessary for opening a session. -message CreateRequest { - message Body { - // Carries an identifier of a session initiator. - neo.fs.v2.refs.OwnerID owner_id = 1; - - // Carries a lifetime of the session. - neo.fs.v2.service.TokenLifetime lifetime = 2; - } - - // Body of create session token request message. - Body body = 1; - - // Carries request meta information. Header data is used only to regulate message - // transport and does not affect request execution. - neo.fs.v2.service.RequestMetaHeader meta_header = 2; - - // Carries request verification information. This header is used to authenticate - // the nodes of the message route and check the correctness of transmission. - neo.fs.v2.service.RequestVerificationHeader verify_header = 3; -} - -// CreateResponse carries an information about the opened session. -message CreateResponse { - message Body { - // id carries an identifier of session token. - bytes id = 1; - - // session_key carries a session public key. - bytes session_key = 2; - } - - // Body of create session token response message. - Body body = 1; - - // Carries response meta information. Header data is used only to regulate - // message transport and does not affect request execution. - neo.fs.v2.service.ResponseMetaHeader meta_header = 2; - - // Carries response verification information. This header is used to - // authenticate the nodes of the message route and check the correctness - // of transmission. - neo.fs.v2.service.ResponseVerificationHeader verify_header = 3; -} diff --git a/v2/storagegroup/types.proto b/v2/storagegroup/types.proto deleted file mode 100644 index 5086621..0000000 --- a/v2/storagegroup/types.proto +++ /dev/null @@ -1,30 +0,0 @@ -syntax = "proto3"; - -package neo.fs.v2.storagegroup; - -option go_package = "github.com/nspcc-dev/neofs-api-go/v2/storagegroup"; -option csharp_namespace = "NeoFS.API.StorageGroup"; - -import "v2/refs/types.proto"; - -// StorageGroup groups the information about the NeoFS storage group. -// The storage group consists of objects from single container. -message StorageGroup { - // validation_data_size carries the total size of the payloads of the storage - // group members. - uint64 validation_data_size = 1; - - // validation_hash carries homomorphic hash from the concatenation of the - // payloads of the storage group members - // The order of concatenation is the same as the order of the members in the - // Members field. - bytes validation_hash = 2; - - // expiration_epoch carries last NeoFS epoch number of the storage group - // lifetime. - uint64 expiration_epoch = 3; - - // Members carries the list of identifiers of the object storage group members. - // The list is strictly ordered. - repeated neo.fs.v2.refs.ObjectID members = 4; -} From 7d0a189721626b854d69755d16bafd4a9c5ce2d2 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Thu, 13 Aug 2020 16:39:58 +0300 Subject: [PATCH 0272/1196] Remove docs from neofs-api These docs should be about sdk --- docs/accounting.md | 491 -------------------------------------- docs/acl.md | 176 -------------- docs/bootstrap.md | 147 ------------ docs/container.md | 326 -------------------------- docs/decimal.md | 61 ----- docs/object.md | 545 ------------------------------------------- docs/query.md | 86 ------- docs/refs.md | 61 ----- docs/service.md | 276 ---------------------- docs/session.md | 97 -------- docs/state.md | 270 --------------------- docs/storagegroup.md | 88 ------- 12 files changed, 2624 deletions(-) delete mode 100644 docs/accounting.md delete mode 100644 docs/acl.md delete mode 100644 docs/bootstrap.md delete mode 100644 docs/container.md delete mode 100644 docs/decimal.md delete mode 100644 docs/object.md delete mode 100644 docs/query.md delete mode 100644 docs/refs.md delete mode 100644 docs/service.md delete mode 100644 docs/session.md delete mode 100644 docs/state.md delete mode 100644 docs/storagegroup.md diff --git a/docs/accounting.md b/docs/accounting.md deleted file mode 100644 index bcae136..0000000 --- a/docs/accounting.md +++ /dev/null @@ -1,491 +0,0 @@ -# Protocol Documentation - - -## Table of Contents - -- [accounting/service.proto](#accounting/service.proto) - - Services - - [Accounting](#accounting.Accounting) - - - Messages - - [BalanceRequest](#accounting.BalanceRequest) - - [BalanceResponse](#accounting.BalanceResponse) - - -- [accounting/types.proto](#accounting/types.proto) - - - Messages - - [Account](#accounting.Account) - - [Balances](#accounting.Balances) - - [ContainerCreateTarget](#accounting.ContainerCreateTarget) - - [Lifetime](#accounting.Lifetime) - - [LockTarget](#accounting.LockTarget) - - [PayIO](#accounting.PayIO) - - [Settlement](#accounting.Settlement) - - [Settlement.Container](#accounting.Settlement.Container) - - [Settlement.Receiver](#accounting.Settlement.Receiver) - - [Settlement.Tx](#accounting.Settlement.Tx) - - [Tx](#accounting.Tx) - - [WithdrawTarget](#accounting.WithdrawTarget) - - -- [accounting/withdraw.proto](#accounting/withdraw.proto) - - Services - - [Withdraw](#accounting.Withdraw) - - - Messages - - [DeleteRequest](#accounting.DeleteRequest) - - [DeleteResponse](#accounting.DeleteResponse) - - [GetRequest](#accounting.GetRequest) - - [GetResponse](#accounting.GetResponse) - - [Item](#accounting.Item) - - [ListRequest](#accounting.ListRequest) - - [ListResponse](#accounting.ListResponse) - - [PutRequest](#accounting.PutRequest) - - [PutResponse](#accounting.PutResponse) - - -- [Scalar Value Types](#scalar-value-types) - - - - -

Top

- -## accounting/service.proto - - - - - - -### Service "accounting.Accounting" -Accounting is a service that provides access for accounting balance -information - -``` -rpc Balance(BalanceRequest) returns (BalanceResponse); - -``` - -#### Method Balance - -Balance returns current balance status of the NeoFS user - -| Name | Input | Output | -| ---- | ----- | ------ | -| Balance | [BalanceRequest](#accounting.BalanceRequest) | [BalanceResponse](#accounting.BalanceResponse) | - - - - - -### Message BalanceRequest - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| OwnerID | [bytes](#bytes) | | OwnerID is a wallet address | -| Meta | [service.RequestMetaHeader](#service.RequestMetaHeader) | | RequestMetaHeader contains information about request meta headers (should be embedded into message) | -| Verify | [service.RequestVerificationHeader](#service.RequestVerificationHeader) | | RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) | - - - - -### Message BalanceResponse - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| Balance | [decimal.Decimal](#decimal.Decimal) | | Balance contains current account balance state | -| LockAccounts | [Account](#accounting.Account) | repeated | LockAccounts contains information about locked funds. Locked funds appear when user pays for storage or withdraw assets. | - - - - - - - - -

Top

- -## accounting/types.proto - - - - - - - -### Message Account - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| OwnerID | [bytes](#bytes) | | OwnerID is a wallet address | -| Address | [string](#string) | | Address is identifier of accounting record | -| ParentAddress | [string](#string) | | ParentAddress is identifier of parent accounting record | -| ActiveFunds | [decimal.Decimal](#decimal.Decimal) | | ActiveFunds is amount of active (non locked) funds for account | -| Lifetime | [Lifetime](#accounting.Lifetime) | | Lifetime is time until account is valid (used for lock accounts) | -| LockTarget | [LockTarget](#accounting.LockTarget) | | LockTarget is the purpose of lock funds (it might be withdraw or payment for storage) | -| LockAccounts | [Account](#accounting.Account) | repeated | LockAccounts contains child accounts with locked funds | - - - - -### Message Balances - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| Accounts | [Account](#accounting.Account) | repeated | Accounts contains multiple account snapshots | - - - - -### Message ContainerCreateTarget - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| CID | [bytes](#bytes) | | CID is container identifier | - - - - -### Message Lifetime - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| unit | [Lifetime.Unit](#accounting.Lifetime.Unit) | | Unit describes how lifetime is measured in account | -| Value | [int64](#int64) | | Value describes how long lifetime will be valid | - - - - -### Message LockTarget -LockTarget must be one of two options - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| WithdrawTarget | [WithdrawTarget](#accounting.WithdrawTarget) | | WithdrawTarget used when user requested withdraw | -| ContainerCreateTarget | [ContainerCreateTarget](#accounting.ContainerCreateTarget) | | ContainerCreateTarget used when user requested creation of container | - - - - -### Message PayIO - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| BlockID | [uint64](#uint64) | | BlockID contains id of the NEO block where withdraw or deposit call was invoked | -| Transactions | [Tx](#accounting.Tx) | repeated | Transactions contains all transactions that founded in block and used for PayIO | - - - - -### Message Settlement - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| Epoch | [uint64](#uint64) | | Epoch contains an epoch when settlement was accepted | -| Transactions | [Settlement.Tx](#accounting.Settlement.Tx) | repeated | Transactions is a set of transactions | - - - - -### Message Settlement.Container - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| CID | [bytes](#bytes) | | CID is container identifier | -| SGIDs | [bytes](#bytes) | repeated | SGIDs is a set of storage groups that successfully passed the audit | - - - - -### Message Settlement.Receiver - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| To | [string](#string) | | To is the address of funds recipient | -| Amount | [decimal.Decimal](#decimal.Decimal) | | Amount is the amount of funds that will be sent | - - - - -### Message Settlement.Tx - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| From | [string](#string) | | From is the address of the sender of funds | -| Container | [Settlement.Container](#accounting.Settlement.Container) | | Container that successfully had passed the audit | -| Receivers | [Settlement.Receiver](#accounting.Settlement.Receiver) | repeated | Receivers is a set of addresses of funds recipients | - - - - -### Message Tx - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| type | [Tx.Type](#accounting.Tx.Type) | | Type describes target of transaction | -| From | [string](#string) | | From describes sender of funds | -| To | [string](#string) | | To describes receiver of funds | -| Amount | [decimal.Decimal](#decimal.Decimal) | | Amount describes amount of funds | -| PublicKeys | [bytes](#bytes) | | PublicKeys contains public key of sender | - - - - -### Message WithdrawTarget - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| Cheque | [string](#string) | | Cheque is a string representation of cheque id | - - - - - - -### Lifetime.Unit -Unit can be Unlimited, based on NeoFS epoch or Neo block - -| Name | Number | Description | -| ---- | ------ | ----------- | -| Unlimited | 0 | | -| NeoFSEpoch | 1 | | -| NeoBlock | 2 | | - - - - - -### Tx.Type -Type can be withdrawal, payIO or inner - -| Name | Number | Description | -| ---- | ------ | ----------- | -| Unknown | 0 | | -| Withdraw | 1 | | -| PayIO | 2 | | -| Inner | 3 | | - - - - - - - -

Top

- -## accounting/withdraw.proto - - - - - - -### Service "accounting.Withdraw" -Withdraw is a service that provides withdraw assets operations from the NeoFS - -``` -rpc Get(GetRequest) returns (GetResponse); -rpc Put(PutRequest) returns (PutResponse); -rpc List(ListRequest) returns (ListResponse); -rpc Delete(DeleteRequest) returns (DeleteResponse); - -``` - -#### Method Get - -Get returns cheque if it was signed by inner ring nodes - -| Name | Input | Output | -| ---- | ----- | ------ | -| Get | [GetRequest](#accounting.GetRequest) | [GetResponse](#accounting.GetResponse) | -#### Method Put - -Put ask inner ring nodes to sign a cheque for withdraw invoke - -| Name | Input | Output | -| ---- | ----- | ------ | -| Put | [PutRequest](#accounting.PutRequest) | [PutResponse](#accounting.PutResponse) | -#### Method List - -List shows all user's checks - -| Name | Input | Output | -| ---- | ----- | ------ | -| List | [ListRequest](#accounting.ListRequest) | [ListResponse](#accounting.ListResponse) | -#### Method Delete - -Delete allows user to remove unused cheque - -| Name | Input | Output | -| ---- | ----- | ------ | -| Delete | [DeleteRequest](#accounting.DeleteRequest) | [DeleteResponse](#accounting.DeleteResponse) | - - - - - -### Message DeleteRequest - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| ID | [bytes](#bytes) | | ID is cheque identifier | -| OwnerID | [bytes](#bytes) | | OwnerID is a wallet address | -| MessageID | [bytes](#bytes) | | MessageID is a nonce for uniq request (UUIDv4) | -| Meta | [service.RequestMetaHeader](#service.RequestMetaHeader) | | RequestMetaHeader contains information about request meta headers (should be embedded into message) | -| Verify | [service.RequestVerificationHeader](#service.RequestVerificationHeader) | | RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) | - - - - -### Message DeleteResponse -DeleteResponse is empty - - - - - -### Message GetRequest - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| ID | [bytes](#bytes) | | ID is cheque identifier | -| OwnerID | [bytes](#bytes) | | OwnerID is a wallet address | -| Meta | [service.RequestMetaHeader](#service.RequestMetaHeader) | | RequestMetaHeader contains information about request meta headers (should be embedded into message) | -| Verify | [service.RequestVerificationHeader](#service.RequestVerificationHeader) | | RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) | - - - - -### Message GetResponse - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| Withdraw | [Item](#accounting.Item) | | Withdraw is cheque with meta information | - - - - -### Message Item - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| ID | [bytes](#bytes) | | ID is a cheque identifier | -| OwnerID | [bytes](#bytes) | | OwnerID is a wallet address | -| Amount | [decimal.Decimal](#decimal.Decimal) | | Amount of funds | -| Height | [uint64](#uint64) | | Height is the neo blockchain height until the cheque is valid | -| Payload | [bytes](#bytes) | | Payload contains cheque representation in bytes | - - - - -### Message ListRequest - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| OwnerID | [bytes](#bytes) | | OwnerID is a wallet address | -| Meta | [service.RequestMetaHeader](#service.RequestMetaHeader) | | RequestMetaHeader contains information about request meta headers (should be embedded into message) | -| Verify | [service.RequestVerificationHeader](#service.RequestVerificationHeader) | | RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) | - - - - -### Message ListResponse - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| Items | [Item](#accounting.Item) | repeated | Items is a set of cheques with meta information | - - - - -### Message PutRequest - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| OwnerID | [bytes](#bytes) | | OwnerID is a wallet address | -| Amount | [decimal.Decimal](#decimal.Decimal) | | Amount of funds | -| Height | [uint64](#uint64) | | Height is the neo blockchain height until the cheque is valid | -| MessageID | [bytes](#bytes) | | MessageID is a nonce for uniq request (UUIDv4) | -| Meta | [service.RequestMetaHeader](#service.RequestMetaHeader) | | RequestMetaHeader contains information about request meta headers (should be embedded into message) | -| Verify | [service.RequestVerificationHeader](#service.RequestVerificationHeader) | | RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) | - - - - -### Message PutResponse - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| ID | [bytes](#bytes) | | ID is cheque identifier | - - - - - - - -## Scalar Value Types - -| .proto Type | Notes | C++ Type | Java Type | Python Type | -| ----------- | ----- | -------- | --------- | ----------- | -| double | | double | double | float | -| float | | float | float | float | -| int32 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint32 instead. | int32 | int | int | -| int64 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint64 instead. | int64 | long | int/long | -| uint32 | Uses variable-length encoding. | uint32 | int | int/long | -| uint64 | Uses variable-length encoding. | uint64 | long | int/long | -| sint32 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s. | int32 | int | int | -| sint64 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s. | int64 | long | int/long | -| fixed32 | Always four bytes. More efficient than uint32 if values are often greater than 2^28. | uint32 | int | int | -| fixed64 | Always eight bytes. More efficient than uint64 if values are often greater than 2^56. | uint64 | long | int/long | -| sfixed32 | Always four bytes. | int32 | int | int | -| sfixed64 | Always eight bytes. | int64 | long | int/long | -| bool | | bool | boolean | boolean | -| string | A string must always contain UTF-8 encoded or 7-bit ASCII text. | string | String | str/unicode | -| bytes | May contain any arbitrary sequence of bytes. | string | ByteString | str | - diff --git a/docs/acl.md b/docs/acl.md deleted file mode 100644 index f63758b..0000000 --- a/docs/acl.md +++ /dev/null @@ -1,176 +0,0 @@ -# Protocol Documentation - - -## Table of Contents - -- [acl/types.proto](#acl/types.proto) - - - Messages - - [EACLRecord](#acl.EACLRecord) - - [EACLRecord.FilterInfo](#acl.EACLRecord.FilterInfo) - - [EACLRecord.TargetInfo](#acl.EACLRecord.TargetInfo) - - [EACLTable](#acl.EACLTable) - - -- [Scalar Value Types](#scalar-value-types) - - - - -

Top

- -## acl/types.proto - - - - - - - -### Message EACLRecord -EACLRecord groups information about extended ACL rule. - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| operation | [EACLRecord.Operation](#acl.EACLRecord.Operation) | | Operation carries type of operation. | -| action | [EACLRecord.Action](#acl.EACLRecord.Action) | | Action carries ACL target action. | -| Filters | [EACLRecord.FilterInfo](#acl.EACLRecord.FilterInfo) | repeated | Filters carries set of filters. | -| Targets | [EACLRecord.TargetInfo](#acl.EACLRecord.TargetInfo) | repeated | Targets carries information about extended ACL target list. | - - - - -### Message EACLRecord.FilterInfo -FilterInfo groups information about filter. - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| header | [EACLRecord.FilterInfo.Header](#acl.EACLRecord.FilterInfo.Header) | | Header carries type of header. | -| matchType | [EACLRecord.FilterInfo.MatchType](#acl.EACLRecord.FilterInfo.MatchType) | | MatchType carries type of match. | -| HeaderName | [string](#string) | | HeaderName carries name of filtering header. | -| HeaderVal | [string](#string) | | HeaderVal carries value of filtering header. | - - - - -### Message EACLRecord.TargetInfo -TargetInfo groups information about extended ACL target. - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| Target | [Target](#acl.Target) | | Target carries target of ACL rule. | -| KeyList | [bytes](#bytes) | repeated | KeyList carries public keys of ACL target. | - - - - -### Message EACLTable -EACLRecord carries the information about extended ACL rules. - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| Records | [EACLRecord](#acl.EACLRecord) | repeated | Records carries list of extended ACL rule records. | - - - - - - -### EACLRecord.Action -Action is an enumeration of EACL actions. - -| Name | Number | Description | -| ---- | ------ | ----------- | -| ActionUnknown | 0 | | -| Allow | 1 | | -| Deny | 2 | | - - - - - -### EACLRecord.FilterInfo.Header -Header is an enumeration of filtering header types. - -| Name | Number | Description | -| ---- | ------ | ----------- | -| HeaderUnknown | 0 | | -| Request | 1 | | -| ObjectSystem | 2 | | -| ObjectUser | 3 | | - - - - - -### EACLRecord.FilterInfo.MatchType -MatchType is an enumeration of match types. - -| Name | Number | Description | -| ---- | ------ | ----------- | -| MatchUnknown | 0 | | -| StringEqual | 1 | | -| StringNotEqual | 2 | | - - - - - -### EACLRecord.Operation -Operation is an enumeration of operation types. - -| Name | Number | Description | -| ---- | ------ | ----------- | -| OPERATION_UNKNOWN | 0 | | -| GET | 1 | | -| HEAD | 2 | | -| PUT | 3 | | -| DELETE | 4 | | -| SEARCH | 5 | | -| GETRANGE | 6 | | -| GETRANGEHASH | 7 | | - - - - - -### Target -Target of the access control rule in access control list. - -| Name | Number | Description | -| ---- | ------ | ----------- | -| Unknown | 0 | Unknown target, default value. | -| User | 1 | User target rule is applied if sender is the owner of the container. | -| System | 2 | System target rule is applied if sender is the storage node within the container or inner ring node. | -| Others | 3 | Others target rule is applied if sender is not user or system target. | -| PubKey | 4 | PubKey target rule is applied if sender has public key provided in extended ACL. | - - - - - - -## Scalar Value Types - -| .proto Type | Notes | C++ Type | Java Type | Python Type | -| ----------- | ----- | -------- | --------- | ----------- | -| double | | double | double | float | -| float | | float | float | float | -| int32 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint32 instead. | int32 | int | int | -| int64 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint64 instead. | int64 | long | int/long | -| uint32 | Uses variable-length encoding. | uint32 | int | int/long | -| uint64 | Uses variable-length encoding. | uint64 | long | int/long | -| sint32 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s. | int32 | int | int | -| sint64 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s. | int64 | long | int/long | -| fixed32 | Always four bytes. More efficient than uint32 if values are often greater than 2^28. | uint32 | int | int | -| fixed64 | Always eight bytes. More efficient than uint64 if values are often greater than 2^56. | uint64 | long | int/long | -| sfixed32 | Always four bytes. | int32 | int | int | -| sfixed64 | Always eight bytes. | int64 | long | int/long | -| bool | | bool | boolean | boolean | -| string | A string must always contain UTF-8 encoded or 7-bit ASCII text. | string | String | str/unicode | -| bytes | May contain any arbitrary sequence of bytes. | string | ByteString | str | - diff --git a/docs/bootstrap.md b/docs/bootstrap.md deleted file mode 100644 index 80aa109..0000000 --- a/docs/bootstrap.md +++ /dev/null @@ -1,147 +0,0 @@ -# Protocol Documentation - - -## Table of Contents - -- [bootstrap/service.proto](#bootstrap/service.proto) - - Services - - [Bootstrap](#bootstrap.Bootstrap) - - - Messages - - [Request](#bootstrap.Request) - - -- [bootstrap/types.proto](#bootstrap/types.proto) - - - Messages - - [NodeInfo](#bootstrap.NodeInfo) - - [SpreadMap](#bootstrap.SpreadMap) - - -- [Scalar Value Types](#scalar-value-types) - - - - -

Top

- -## bootstrap/service.proto - - - - - - -### Service "bootstrap.Bootstrap" -Bootstrap service allows neofs-node to connect to the network. Node should -perform at least one bootstrap request in the epoch to stay in the network -for the next epoch. - -``` -rpc Process(Request) returns (SpreadMap); - -``` - -#### Method Process - -Process is method that allows to register node in the network and receive actual netmap - -| Name | Input | Output | -| ---- | ----- | ------ | -| Process | [Request](#bootstrap.Request) | [SpreadMap](#bootstrap.SpreadMap) | - - - - - -### Message Request - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| type | [int32](#int32) | | Type is NodeType, can be InnerRingNode (type=1) or StorageNode (type=2) | -| info | [NodeInfo](#bootstrap.NodeInfo) | | Info contains information about node | -| state | [Request.State](#bootstrap.Request.State) | | State contains node status | -| Meta | [service.RequestMetaHeader](#service.RequestMetaHeader) | | RequestMetaHeader contains information about request meta headers (should be embedded into message) | -| Verify | [service.RequestVerificationHeader](#service.RequestVerificationHeader) | | RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) | - - - - - - -### Request.State -Node state - -| Name | Number | Description | -| ---- | ------ | ----------- | -| Unknown | 0 | used by default | -| Online | 1 | used to inform that node online | -| Offline | 2 | used to inform that node offline | - - - - - - - -

Top

- -## bootstrap/types.proto - - - - - - - -### Message NodeInfo - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| Address | [string](#string) | | Address is a node [multi-address](https://github.com/multiformats/multiaddr) | -| PubKey | [bytes](#bytes) | | PubKey is a compressed public key representation in bytes | -| Options | [string](#string) | repeated | Options is set of node optional information, such as storage capacity, node location, price and etc | -| Status | [uint64](#uint64) | | Status is bitmap status of the node | - - - - -### Message SpreadMap - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| Epoch | [uint64](#uint64) | | Epoch is current epoch for netmap | -| NetMap | [NodeInfo](#bootstrap.NodeInfo) | repeated | NetMap is a set of NodeInfos | - - - - - - - -## Scalar Value Types - -| .proto Type | Notes | C++ Type | Java Type | Python Type | -| ----------- | ----- | -------- | --------- | ----------- | -| double | | double | double | float | -| float | | float | float | float | -| int32 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint32 instead. | int32 | int | int | -| int64 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint64 instead. | int64 | long | int/long | -| uint32 | Uses variable-length encoding. | uint32 | int | int/long | -| uint64 | Uses variable-length encoding. | uint64 | long | int/long | -| sint32 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s. | int32 | int | int | -| sint64 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s. | int64 | long | int/long | -| fixed32 | Always four bytes. More efficient than uint32 if values are often greater than 2^28. | uint32 | int | int | -| fixed64 | Always eight bytes. More efficient than uint64 if values are often greater than 2^56. | uint64 | long | int/long | -| sfixed32 | Always four bytes. | int32 | int | int | -| sfixed64 | Always eight bytes. | int64 | long | int/long | -| bool | | bool | boolean | boolean | -| string | A string must always contain UTF-8 encoded or 7-bit ASCII text. | string | String | str/unicode | -| bytes | May contain any arbitrary sequence of bytes. | string | ByteString | str | - diff --git a/docs/container.md b/docs/container.md deleted file mode 100644 index fd89acd..0000000 --- a/docs/container.md +++ /dev/null @@ -1,326 +0,0 @@ -# Protocol Documentation - - -## Table of Contents - -- [container/service.proto](#container/service.proto) - - Services - - [Service](#container.Service) - - - Messages - - [DeleteRequest](#container.DeleteRequest) - - [DeleteResponse](#container.DeleteResponse) - - [ExtendedACLKey](#container.ExtendedACLKey) - - [ExtendedACLValue](#container.ExtendedACLValue) - - [GetExtendedACLRequest](#container.GetExtendedACLRequest) - - [GetExtendedACLResponse](#container.GetExtendedACLResponse) - - [GetRequest](#container.GetRequest) - - [GetResponse](#container.GetResponse) - - [ListRequest](#container.ListRequest) - - [ListResponse](#container.ListResponse) - - [PutRequest](#container.PutRequest) - - [PutResponse](#container.PutResponse) - - [SetExtendedACLRequest](#container.SetExtendedACLRequest) - - [SetExtendedACLResponse](#container.SetExtendedACLResponse) - - -- [container/types.proto](#container/types.proto) - - - Messages - - [Container](#container.Container) - - -- [Scalar Value Types](#scalar-value-types) - - - - -

Top

- -## container/service.proto - - - - - - -### Service "container.Service" -Container service provides API for manipulating with the container. - -``` -rpc Put(PutRequest) returns (PutResponse); -rpc Delete(DeleteRequest) returns (DeleteResponse); -rpc Get(GetRequest) returns (GetResponse); -rpc List(ListRequest) returns (ListResponse); -rpc SetExtendedACL(SetExtendedACLRequest) returns (SetExtendedACLResponse); -rpc GetExtendedACL(GetExtendedACLRequest) returns (GetExtendedACLResponse); - -``` - -#### Method Put - -Put request proposes container to the inner ring nodes. They will -accept new container if user has enough deposit. All containers -are accepted by the consensus, therefore it is asynchronous process. - -| Name | Input | Output | -| ---- | ----- | ------ | -| Put | [PutRequest](#container.PutRequest) | [PutResponse](#container.PutResponse) | -#### Method Delete - -Delete container removes it from the inner ring container storage. It -also asynchronous process done by consensus. - -| Name | Input | Output | -| ---- | ----- | ------ | -| Delete | [DeleteRequest](#container.DeleteRequest) | [DeleteResponse](#container.DeleteResponse) | -#### Method Get - -Get container returns container instance - -| Name | Input | Output | -| ---- | ----- | ------ | -| Get | [GetRequest](#container.GetRequest) | [GetResponse](#container.GetResponse) | -#### Method List - -List returns all user's containers - -| Name | Input | Output | -| ---- | ----- | ------ | -| List | [ListRequest](#container.ListRequest) | [ListResponse](#container.ListResponse) | -#### Method SetExtendedACL - -SetExtendedACL changes extended ACL rules of the container - -| Name | Input | Output | -| ---- | ----- | ------ | -| SetExtendedACL | [SetExtendedACLRequest](#container.SetExtendedACLRequest) | [SetExtendedACLResponse](#container.SetExtendedACLResponse) | -#### Method GetExtendedACL - -GetExtendedACL returns extended ACL rules of the container - -| Name | Input | Output | -| ---- | ----- | ------ | -| GetExtendedACL | [GetExtendedACLRequest](#container.GetExtendedACLRequest) | [GetExtendedACLResponse](#container.GetExtendedACLResponse) | - - - - - -### Message DeleteRequest - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| CID | [bytes](#bytes) | | CID (container id) is a SHA256 hash of the container structure | -| Meta | [service.RequestMetaHeader](#service.RequestMetaHeader) | | RequestMetaHeader contains information about request meta headers (should be embedded into message) | -| Verify | [service.RequestVerificationHeader](#service.RequestVerificationHeader) | | RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) | - - - - -### Message DeleteResponse -DeleteResponse is empty because delete operation is asynchronous and done -via consensus in inner ring nodes - - - - - -### Message ExtendedACLKey - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| ID | [bytes](#bytes) | | ID (container id) is a SHA256 hash of the container structure | - - - - -### Message ExtendedACLValue - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| EACL | [bytes](#bytes) | | EACL carries binary representation of the table of extended ACL rules | -| Signature | [bytes](#bytes) | | Signature carries EACL field signature | - - - - -### Message GetExtendedACLRequest - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| Key | [ExtendedACLKey](#container.ExtendedACLKey) | | Key carries key to extended ACL information | -| Meta | [service.RequestMetaHeader](#service.RequestMetaHeader) | | RequestMetaHeader contains information about request meta headers (should be embedded into message) | -| Verify | [service.RequestVerificationHeader](#service.RequestVerificationHeader) | | RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) | - - - - -### Message GetExtendedACLResponse - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| ACL | [ExtendedACLValue](#container.ExtendedACLValue) | | ACL carries extended ACL information | - - - - -### Message GetRequest - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| CID | [bytes](#bytes) | | CID (container id) is a SHA256 hash of the container structure | -| Meta | [service.RequestMetaHeader](#service.RequestMetaHeader) | | RequestMetaHeader contains information about request meta headers (should be embedded into message) | -| Verify | [service.RequestVerificationHeader](#service.RequestVerificationHeader) | | RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) | - - - - -### Message GetResponse - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| Container | [Container](#container.Container) | | Container is a structure that contains placement rules and owner id | - - - - -### Message ListRequest - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| OwnerID | [bytes](#bytes) | | OwnerID is a wallet address | -| Meta | [service.RequestMetaHeader](#service.RequestMetaHeader) | | RequestMetaHeader contains information about request meta headers (should be embedded into message) | -| Verify | [service.RequestVerificationHeader](#service.RequestVerificationHeader) | | RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) | - - - - -### Message ListResponse - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| CID | [bytes](#bytes) | repeated | CID (container id) is list of SHA256 hashes of the container structures | - - - - -### Message PutRequest - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| MessageID | [bytes](#bytes) | | MessageID is a nonce for uniq container id calculation | -| Capacity | [uint64](#uint64) | | Capacity defines amount of data that can be stored in the container (doesn't used for now). | -| OwnerID | [bytes](#bytes) | | OwnerID is a wallet address | -| rules | [netmap.PlacementRule](#netmap.PlacementRule) | | Rules define storage policy for the object inside the container. | -| BasicACL | [uint32](#uint32) | | BasicACL of the container. | -| Meta | [service.RequestMetaHeader](#service.RequestMetaHeader) | | RequestMetaHeader contains information about request meta headers (should be embedded into message) | -| Verify | [service.RequestVerificationHeader](#service.RequestVerificationHeader) | | RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) | - - - - -### Message PutResponse - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| CID | [bytes](#bytes) | | CID (container id) is a SHA256 hash of the container structure | - - - - -### Message SetExtendedACLRequest - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| Key | [ExtendedACLKey](#container.ExtendedACLKey) | | Key carries key to extended ACL information | -| Value | [ExtendedACLValue](#container.ExtendedACLValue) | | Value carries extended ACL information | -| Meta | [service.RequestMetaHeader](#service.RequestMetaHeader) | | RequestMetaHeader contains information about request meta headers (should be embedded into message) | -| Verify | [service.RequestVerificationHeader](#service.RequestVerificationHeader) | | RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) | - - - - -### Message SetExtendedACLResponse - - - - - - - - - - -

Top

- -## container/types.proto - - - - - - - -### Message Container -The Container service definition. - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| OwnerID | [bytes](#bytes) | | OwnerID is a wallet address. | -| Salt | [bytes](#bytes) | | Salt is a nonce for unique container id calculation. | -| Capacity | [uint64](#uint64) | | Capacity defines amount of data that can be stored in the container (doesn't used for now). | -| Rules | [netmap.PlacementRule](#netmap.PlacementRule) | | Rules define storage policy for the object inside the container. | -| BasicACL | [uint32](#uint32) | | BasicACL with access control rules for owner, system, others and permission bits for bearer token and extended ACL. | - - - - - - - -## Scalar Value Types - -| .proto Type | Notes | C++ Type | Java Type | Python Type | -| ----------- | ----- | -------- | --------- | ----------- | -| double | | double | double | float | -| float | | float | float | float | -| int32 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint32 instead. | int32 | int | int | -| int64 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint64 instead. | int64 | long | int/long | -| uint32 | Uses variable-length encoding. | uint32 | int | int/long | -| uint64 | Uses variable-length encoding. | uint64 | long | int/long | -| sint32 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s. | int32 | int | int | -| sint64 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s. | int64 | long | int/long | -| fixed32 | Always four bytes. More efficient than uint32 if values are often greater than 2^28. | uint32 | int | int | -| fixed64 | Always eight bytes. More efficient than uint64 if values are often greater than 2^56. | uint64 | long | int/long | -| sfixed32 | Always four bytes. | int32 | int | int | -| sfixed64 | Always eight bytes. | int64 | long | int/long | -| bool | | bool | boolean | boolean | -| string | A string must always contain UTF-8 encoded or 7-bit ASCII text. | string | String | str/unicode | -| bytes | May contain any arbitrary sequence of bytes. | string | ByteString | str | - diff --git a/docs/decimal.md b/docs/decimal.md deleted file mode 100644 index 62acb86..0000000 --- a/docs/decimal.md +++ /dev/null @@ -1,61 +0,0 @@ -# Protocol Documentation - - -## Table of Contents - -- [decimal/decimal.proto](#decimal/decimal.proto) - - - Messages - - [Decimal](#decimal.Decimal) - - -- [Scalar Value Types](#scalar-value-types) - - - - -

Top

- -## decimal/decimal.proto - - - - - - - -### Message Decimal -Decimal is a structure used for representation of assets amount - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| Value | [int64](#int64) | | Value is value number | -| Precision | [uint32](#uint32) | | Precision is precision number | - - - - - - - -## Scalar Value Types - -| .proto Type | Notes | C++ Type | Java Type | Python Type | -| ----------- | ----- | -------- | --------- | ----------- | -| double | | double | double | float | -| float | | float | float | float | -| int32 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint32 instead. | int32 | int | int | -| int64 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint64 instead. | int64 | long | int/long | -| uint32 | Uses variable-length encoding. | uint32 | int | int/long | -| uint64 | Uses variable-length encoding. | uint64 | long | int/long | -| sint32 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s. | int32 | int | int | -| sint64 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s. | int64 | long | int/long | -| fixed32 | Always four bytes. More efficient than uint32 if values are often greater than 2^28. | uint32 | int | int | -| fixed64 | Always eight bytes. More efficient than uint64 if values are often greater than 2^56. | uint64 | long | int/long | -| sfixed32 | Always four bytes. | int32 | int | int | -| sfixed64 | Always eight bytes. | int64 | long | int/long | -| bool | | bool | boolean | boolean | -| string | A string must always contain UTF-8 encoded or 7-bit ASCII text. | string | String | str/unicode | -| bytes | May contain any arbitrary sequence of bytes. | string | ByteString | str | - diff --git a/docs/object.md b/docs/object.md deleted file mode 100644 index 27e4bcf..0000000 --- a/docs/object.md +++ /dev/null @@ -1,545 +0,0 @@ -# Protocol Documentation - - -## Table of Contents - -- [object/service.proto](#object/service.proto) - - Services - - [Service](#object.Service) - - - Messages - - [DeleteRequest](#object.DeleteRequest) - - [DeleteResponse](#object.DeleteResponse) - - [GetRangeHashRequest](#object.GetRangeHashRequest) - - [GetRangeHashResponse](#object.GetRangeHashResponse) - - [GetRangeRequest](#object.GetRangeRequest) - - [GetRangeResponse](#object.GetRangeResponse) - - [GetRequest](#object.GetRequest) - - [GetResponse](#object.GetResponse) - - [HeadRequest](#object.HeadRequest) - - [HeadResponse](#object.HeadResponse) - - [PutRequest](#object.PutRequest) - - [PutRequest.PutHeader](#object.PutRequest.PutHeader) - - [PutResponse](#object.PutResponse) - - [SearchRequest](#object.SearchRequest) - - [SearchResponse](#object.SearchResponse) - - -- [object/types.proto](#object/types.proto) - - - Messages - - [CreationPoint](#object.CreationPoint) - - [Header](#object.Header) - - [IntegrityHeader](#object.IntegrityHeader) - - [Link](#object.Link) - - [Object](#object.Object) - - [PublicKey](#object.PublicKey) - - [Range](#object.Range) - - [SystemHeader](#object.SystemHeader) - - [Tombstone](#object.Tombstone) - - [Transform](#object.Transform) - - [UserHeader](#object.UserHeader) - - -- [Scalar Value Types](#scalar-value-types) - - - - -

Top

- -## object/service.proto - - - - - - -### Service "object.Service" -Object service provides API for manipulating with the object. - -``` -rpc Get(GetRequest) returns (stream GetResponse); -rpc Put(stream PutRequest) returns (PutResponse); -rpc Delete(DeleteRequest) returns (DeleteResponse); -rpc Head(HeadRequest) returns (HeadResponse); -rpc Search(SearchRequest) returns (stream SearchResponse); -rpc GetRange(GetRangeRequest) returns (stream GetRangeResponse); -rpc GetRangeHash(GetRangeHashRequest) returns (GetRangeHashResponse); - -``` - -#### Method Get - -Get the object from container. Response uses gRPC stream. First response -message carry object of requested address. Chunk messages are parts of -the object's payload if it is needed. All messages except first carry -chunks. Requested object can be restored by concatenation of object -message payload and all chunks keeping receiving order. - -| Name | Input | Output | -| ---- | ----- | ------ | -| Get | [GetRequest](#object.GetRequest) | [GetResponse](#object.GetResponse) | -#### Method Put - -Put the object into container. Request uses gRPC stream. First message -SHOULD BE type of PutHeader. Container id and Owner id of object SHOULD -BE set. Session token SHOULD BE obtained before put operation (see -session package). Chunk messages considered by server as part of object -payload. All messages except first SHOULD BE chunks. Chunk messages -SHOULD BE sent in direct order of fragmentation. - -| Name | Input | Output | -| ---- | ----- | ------ | -| Put | [PutRequest](#object.PutRequest) | [PutResponse](#object.PutResponse) | -#### Method Delete - -Delete the object from a container - -| Name | Input | Output | -| ---- | ----- | ------ | -| Delete | [DeleteRequest](#object.DeleteRequest) | [DeleteResponse](#object.DeleteResponse) | -#### Method Head - -Head returns the object without data payload. Object in the -response has system header only. If full headers flag is set, extended -headers are also present. - -| Name | Input | Output | -| ---- | ----- | ------ | -| Head | [HeadRequest](#object.HeadRequest) | [HeadResponse](#object.HeadResponse) | -#### Method Search - -Search objects in container. Version of query language format SHOULD BE -set to 1. Search query represented in serialized format (see query -package). - -| Name | Input | Output | -| ---- | ----- | ------ | -| Search | [SearchRequest](#object.SearchRequest) | [SearchResponse](#object.SearchResponse) | -#### Method GetRange - -GetRange of data payload. Range is a pair (offset, length). -Requested range can be restored by concatenation of all chunks -keeping receiving order. - -| Name | Input | Output | -| ---- | ----- | ------ | -| GetRange | [GetRangeRequest](#object.GetRangeRequest) | [GetRangeResponse](#object.GetRangeResponse) | -#### Method GetRangeHash - -GetRangeHash returns homomorphic hash of object payload range after XOR -operation. Ranges are set of pairs (offset, length). Hashes order in -response corresponds to ranges order in request. Homomorphic hash is -calculated for XORed data. - -| Name | Input | Output | -| ---- | ----- | ------ | -| GetRangeHash | [GetRangeHashRequest](#object.GetRangeHashRequest) | [GetRangeHashResponse](#object.GetRangeHashResponse) | - - - - - -### Message DeleteRequest - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| Address | [refs.Address](#refs.Address) | | Address of object (container id + object id) | -| OwnerID | [bytes](#bytes) | | OwnerID is a wallet address | -| Meta | [service.RequestMetaHeader](#service.RequestMetaHeader) | | RequestMetaHeader contains information about request meta headers (should be embedded into message) | -| Verify | [service.RequestVerificationHeader](#service.RequestVerificationHeader) | | RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) | - - - - -### Message DeleteResponse -DeleteResponse is empty because we cannot guarantee permanent object removal -in distributed system. - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| Meta | [service.ResponseMetaHeader](#service.ResponseMetaHeader) | | ResponseMetaHeader contains meta information based on request processing by server (should be embedded into message) | - - - - -### Message GetRangeHashRequest - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| Address | [refs.Address](#refs.Address) | | Address of object (container id + object id) | -| Ranges | [Range](#object.Range) | repeated | Ranges of object's payload to calculate homomorphic hash | -| Salt | [bytes](#bytes) | | Salt is used to XOR object's payload ranges before hashing, it can be nil | -| Meta | [service.RequestMetaHeader](#service.RequestMetaHeader) | | RequestMetaHeader contains information about request meta headers (should be embedded into message) | -| Verify | [service.RequestVerificationHeader](#service.RequestVerificationHeader) | | RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) | - - - - -### Message GetRangeHashResponse - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| Hashes | [bytes](#bytes) | repeated | Hashes is a homomorphic hashes of all ranges | -| Meta | [service.ResponseMetaHeader](#service.ResponseMetaHeader) | | ResponseMetaHeader contains meta information based on request processing by server (should be embedded into message) | - - - - -### Message GetRangeRequest - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| Address | [refs.Address](#refs.Address) | | Address of object (container id + object id) | -| Range | [Range](#object.Range) | | Range of object's payload to return | -| Meta | [service.RequestMetaHeader](#service.RequestMetaHeader) | | RequestMetaHeader contains information about request meta headers (should be embedded into message) | -| Verify | [service.RequestVerificationHeader](#service.RequestVerificationHeader) | | RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) | - - - - -### Message GetRangeResponse - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| Fragment | [bytes](#bytes) | | Fragment of object's payload | -| Meta | [service.ResponseMetaHeader](#service.ResponseMetaHeader) | | ResponseMetaHeader contains meta information based on request processing by server (should be embedded into message) | - - - - -### Message GetRequest - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| Address | [refs.Address](#refs.Address) | | Address of object (container id + object id) | -| Meta | [service.RequestMetaHeader](#service.RequestMetaHeader) | | RequestMetaHeader contains information about request meta headers (should be embedded into message) | -| Verify | [service.RequestVerificationHeader](#service.RequestVerificationHeader) | | RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) | - - - - -### Message GetResponse - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| object | [Object](#object.Object) | | Object header and some payload | -| Chunk | [bytes](#bytes) | | Chunk of remaining payload | -| Meta | [service.ResponseMetaHeader](#service.ResponseMetaHeader) | | ResponseMetaHeader contains meta information based on request processing by server (should be embedded into message) | - - - - -### Message HeadRequest - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| Address | [refs.Address](#refs.Address) | | Address of object (container id + object id) | -| FullHeaders | [bool](#bool) | | FullHeaders can be set true for extended headers in the object | -| Meta | [service.RequestMetaHeader](#service.RequestMetaHeader) | | RequestMetaHeader contains information about request meta headers (should be embedded into message) | -| Verify | [service.RequestVerificationHeader](#service.RequestVerificationHeader) | | RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) | - - - - -### Message HeadResponse - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| Object | [Object](#object.Object) | | Object without payload | -| Meta | [service.ResponseMetaHeader](#service.ResponseMetaHeader) | | ResponseMetaHeader contains meta information based on request processing by server (should be embedded into message) | - - - - -### Message PutRequest - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| Header | [PutRequest.PutHeader](#object.PutRequest.PutHeader) | | Header should be the first message in the stream | -| Chunk | [bytes](#bytes) | | Chunk should be a remaining message in stream should be chunks | -| Meta | [service.RequestMetaHeader](#service.RequestMetaHeader) | | RequestMetaHeader contains information about request meta headers (should be embedded into message) | -| Verify | [service.RequestVerificationHeader](#service.RequestVerificationHeader) | | RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) | - - - - -### Message PutRequest.PutHeader - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| Object | [Object](#object.Object) | | Object with at least container id and owner id fields | -| CopiesNumber | [uint32](#uint32) | | Number of the object copies to store within the RPC call (zero is processed according to the placement rules) | - - - - -### Message PutResponse - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| Address | [refs.Address](#refs.Address) | | Address of object (container id + object id) | -| Meta | [service.ResponseMetaHeader](#service.ResponseMetaHeader) | | ResponseMetaHeader contains meta information based on request processing by server (should be embedded into message) | - - - - -### Message SearchRequest - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| ContainerID | [bytes](#bytes) | | ContainerID for searching the object | -| Query | [bytes](#bytes) | | Query in the binary serialized format | -| QueryVersion | [uint32](#uint32) | | QueryVersion is a version of search query format | -| Meta | [service.RequestMetaHeader](#service.RequestMetaHeader) | | RequestMetaHeader contains information about request meta headers (should be embedded into message) | -| Verify | [service.RequestVerificationHeader](#service.RequestVerificationHeader) | | RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) | - - - - -### Message SearchResponse - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| Addresses | [refs.Address](#refs.Address) | repeated | Addresses of found objects | -| Meta | [service.ResponseMetaHeader](#service.ResponseMetaHeader) | | ResponseMetaHeader contains meta information based on request processing by server (should be embedded into message) | - - - - - - - - -

Top

- -## object/types.proto - - - - - - - -### Message CreationPoint - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| UnixTime | [int64](#int64) | | UnixTime is a date of creation in unixtime format | -| Epoch | [uint64](#uint64) | | Epoch is a date of creation in NeoFS epochs | - - - - -### Message Header - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| Link | [Link](#object.Link) | | Link to other objects | -| Redirect | [refs.Address](#refs.Address) | | Redirect not used yet | -| UserHeader | [UserHeader](#object.UserHeader) | | UserHeader is a set of KV headers defined by user | -| Transform | [Transform](#object.Transform) | | Transform defines transform operation (e.g. payload split) | -| Tombstone | [Tombstone](#object.Tombstone) | | Tombstone header that set up in deleted objects | -| Token | [service.Token](#service.Token) | | Token header contains token of the session within which the object was created | -| HomoHash | [bytes](#bytes) | | HomoHash is a homomorphic hash of original object payload | -| PayloadChecksum | [bytes](#bytes) | | PayloadChecksum of actual object's payload | -| Integrity | [IntegrityHeader](#object.IntegrityHeader) | | Integrity header with checksum of all above headers in the object | -| StorageGroup | [storagegroup.StorageGroup](#storagegroup.StorageGroup) | | StorageGroup contains meta information for the data audit | -| PublicKey | [PublicKey](#object.PublicKey) | | PublicKey of owner of the object. Key is used for verification and can be based on NeoID or x509 cert. | - - - - -### Message IntegrityHeader - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| HeadersChecksum | [bytes](#bytes) | | HeadersChecksum is a checksum of all above headers in the object | -| ChecksumSignature | [bytes](#bytes) | | ChecksumSignature is an user's signature of checksum to verify if it is correct | - - - - -### Message Link - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| type | [Link.Type](#object.Link.Type) | | Type of link | -| ID | [bytes](#bytes) | | ID is an object identifier, is a valid UUIDv4 | - - - - -### Message Object - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| SystemHeader | [SystemHeader](#object.SystemHeader) | | SystemHeader describes system header | -| Headers | [Header](#object.Header) | repeated | Headers describes a set of an extended headers | -| Payload | [bytes](#bytes) | | Payload is an object's payload | - - - - -### Message PublicKey - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| Value | [bytes](#bytes) | | Value contains marshaled ecdsa public key | - - - - -### Message Range - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| Offset | [uint64](#uint64) | | Offset of the data range | -| Length | [uint64](#uint64) | | Length of the data range | - - - - -### Message SystemHeader - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| Version | [uint64](#uint64) | | Version of the object structure | -| PayloadLength | [uint64](#uint64) | | PayloadLength is an object payload length | -| ID | [bytes](#bytes) | | ID is an object identifier, is a valid UUIDv4 | -| OwnerID | [bytes](#bytes) | | OwnerID is a wallet address | -| CID | [bytes](#bytes) | | CID is a SHA256 hash of the container structure (container identifier) | -| CreatedAt | [CreationPoint](#object.CreationPoint) | | CreatedAt is a timestamp of object creation | - - - - -### Message Tombstone - - - - - - -### Message Transform - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| type | [Transform.Type](#object.Transform.Type) | | Type of object transformation | - - - - -### Message UserHeader - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| Key | [string](#string) | | Key of the user's header | -| Value | [string](#string) | | Value of the user's header | - - - - - - -### Link.Type - - -| Name | Number | Description | -| ---- | ------ | ----------- | -| Unknown | 0 | | -| Parent | 1 | Parent object created during object transformation | -| Previous | 2 | Previous object in the linked list created during object transformation | -| Next | 3 | Next object in the linked list created during object transformation | -| Child | 4 | Child object created during object transformation | -| StorageGroup | 5 | Object that included into this storage group | - - - - - -### Transform.Type - - -| Name | Number | Description | -| ---- | ------ | ----------- | -| Unknown | 0 | | -| Split | 1 | Split sets when object created after payload split | -| Sign | 2 | Sign sets when object created after re-signing (doesn't used) | -| Mould | 3 | Mould sets when object created after filling missing headers in the object | - - - - - - -## Scalar Value Types - -| .proto Type | Notes | C++ Type | Java Type | Python Type | -| ----------- | ----- | -------- | --------- | ----------- | -| double | | double | double | float | -| float | | float | float | float | -| int32 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint32 instead. | int32 | int | int | -| int64 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint64 instead. | int64 | long | int/long | -| uint32 | Uses variable-length encoding. | uint32 | int | int/long | -| uint64 | Uses variable-length encoding. | uint64 | long | int/long | -| sint32 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s. | int32 | int | int | -| sint64 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s. | int64 | long | int/long | -| fixed32 | Always four bytes. More efficient than uint32 if values are often greater than 2^28. | uint32 | int | int | -| fixed64 | Always eight bytes. More efficient than uint64 if values are often greater than 2^56. | uint64 | long | int/long | -| sfixed32 | Always four bytes. | int32 | int | int | -| sfixed64 | Always eight bytes. | int64 | long | int/long | -| bool | | bool | boolean | boolean | -| string | A string must always contain UTF-8 encoded or 7-bit ASCII text. | string | String | str/unicode | -| bytes | May contain any arbitrary sequence of bytes. | string | ByteString | str | - diff --git a/docs/query.md b/docs/query.md deleted file mode 100644 index c014c6c..0000000 --- a/docs/query.md +++ /dev/null @@ -1,86 +0,0 @@ -# Protocol Documentation - - -## Table of Contents - -- [query/types.proto](#query/types.proto) - - - Messages - - [Filter](#query.Filter) - - [Query](#query.Query) - - -- [Scalar Value Types](#scalar-value-types) - - - - -

Top

- -## query/types.proto - - - - - - - -### Message Filter - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| type | [Filter.Type](#query.Filter.Type) | | Type of filter | -| Name | [string](#string) | | Name of field that should be filtered | -| Value | [string](#string) | | Value that should be used for filter | - - - - -### Message Query - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| Filters | [Filter](#query.Filter) | repeated | Filters is set of filters, should not be empty | - - - - - - -### Filter.Type - - -| Name | Number | Description | -| ---- | ------ | ----------- | -| Exact | 0 | Exact sets when value of filter should be equal to the header value | -| Regex | 1 | Regex sets when value of filter should match the header value by the regular expression | - - - - - - -## Scalar Value Types - -| .proto Type | Notes | C++ Type | Java Type | Python Type | -| ----------- | ----- | -------- | --------- | ----------- | -| double | | double | double | float | -| float | | float | float | float | -| int32 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint32 instead. | int32 | int | int | -| int64 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint64 instead. | int64 | long | int/long | -| uint32 | Uses variable-length encoding. | uint32 | int | int/long | -| uint64 | Uses variable-length encoding. | uint64 | long | int/long | -| sint32 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s. | int32 | int | int | -| sint64 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s. | int64 | long | int/long | -| fixed32 | Always four bytes. More efficient than uint32 if values are often greater than 2^28. | uint32 | int | int | -| fixed64 | Always eight bytes. More efficient than uint64 if values are often greater than 2^56. | uint64 | long | int/long | -| sfixed32 | Always four bytes. | int32 | int | int | -| sfixed64 | Always eight bytes. | int64 | long | int/long | -| bool | | bool | boolean | boolean | -| string | A string must always contain UTF-8 encoded or 7-bit ASCII text. | string | String | str/unicode | -| bytes | May contain any arbitrary sequence of bytes. | string | ByteString | str | - diff --git a/docs/refs.md b/docs/refs.md deleted file mode 100644 index b808482..0000000 --- a/docs/refs.md +++ /dev/null @@ -1,61 +0,0 @@ -# Protocol Documentation - - -## Table of Contents - -- [refs/types.proto](#refs/types.proto) - - - Messages - - [Address](#refs.Address) - - -- [Scalar Value Types](#scalar-value-types) - - - - -

Top

- -## refs/types.proto - - - - - - - -### Message Address -Address of object (container id + object id) - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| ObjectID | [bytes](#bytes) | | ObjectID is an object identifier, valid UUIDv4 represented in bytes | -| CID | [bytes](#bytes) | | CID is container identifier | - - - - - - - -## Scalar Value Types - -| .proto Type | Notes | C++ Type | Java Type | Python Type | -| ----------- | ----- | -------- | --------- | ----------- | -| double | | double | double | float | -| float | | float | float | float | -| int32 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint32 instead. | int32 | int | int | -| int64 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint64 instead. | int64 | long | int/long | -| uint32 | Uses variable-length encoding. | uint32 | int | int/long | -| uint64 | Uses variable-length encoding. | uint64 | long | int/long | -| sint32 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s. | int32 | int | int | -| sint64 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s. | int64 | long | int/long | -| fixed32 | Always four bytes. More efficient than uint32 if values are often greater than 2^28. | uint32 | int | int | -| fixed64 | Always eight bytes. More efficient than uint64 if values are often greater than 2^56. | uint64 | long | int/long | -| sfixed32 | Always four bytes. | int32 | int | int | -| sfixed64 | Always eight bytes. | int64 | long | int/long | -| bool | | bool | boolean | boolean | -| string | A string must always contain UTF-8 encoded or 7-bit ASCII text. | string | String | str/unicode | -| bytes | May contain any arbitrary sequence of bytes. | string | ByteString | str | - diff --git a/docs/service.md b/docs/service.md deleted file mode 100644 index 223ddd1..0000000 --- a/docs/service.md +++ /dev/null @@ -1,276 +0,0 @@ -# Protocol Documentation - - -## Table of Contents - -- [service/meta.proto](#service/meta.proto) - - - Messages - - [RequestExtendedHeader](#service.RequestExtendedHeader) - - [RequestExtendedHeader.KV](#service.RequestExtendedHeader.KV) - - [RequestMetaHeader](#service.RequestMetaHeader) - - [ResponseMetaHeader](#service.ResponseMetaHeader) - - -- [service/verify.proto](#service/verify.proto) - - - Messages - - [BearerTokenMsg](#service.BearerTokenMsg) - - [BearerTokenMsg.Info](#service.BearerTokenMsg.Info) - - [RequestVerificationHeader](#service.RequestVerificationHeader) - - [RequestVerificationHeader.Signature](#service.RequestVerificationHeader.Signature) - - [Token](#service.Token) - - [Token.Info](#service.Token.Info) - - [TokenLifetime](#service.TokenLifetime) - - -- [service/verify_test.proto](#service/verify_test.proto) - - - Messages - - [TestRequest](#service.TestRequest) - - -- [Scalar Value Types](#scalar-value-types) - - - - -

Top

- -## service/meta.proto - - - - - - - -### Message RequestExtendedHeader -RequestExtendedHeader contains extended headers of request - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| Headers | [RequestExtendedHeader.KV](#service.RequestExtendedHeader.KV) | repeated | Headers carries list of key-value headers | - - - - -### Message RequestExtendedHeader.KV -KV contains string key-value pair - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| K | [string](#string) | | K carries extended header key | -| V | [string](#string) | | V carries extended header value | - - - - -### Message RequestMetaHeader -RequestMetaHeader contains information about request meta headers -(should be embedded into message) - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| TTL | [uint32](#uint32) | | TTL must be larger than zero, it decreased in every NeoFS Node | -| Epoch | [uint64](#uint64) | | Epoch for user can be empty, because node sets epoch to the actual value | -| Version | [uint32](#uint32) | | Version defines protocol version TODO: not used for now, should be implemented in future | -| Raw | [bool](#bool) | | Raw determines whether the request is raw or not | -| ExtendedHeader | [RequestExtendedHeader](#service.RequestExtendedHeader) | | ExtendedHeader carries extended headers of the request | - - - - -### Message ResponseMetaHeader -ResponseMetaHeader contains meta information based on request processing by server -(should be embedded into message) - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| Epoch | [uint64](#uint64) | | Current NeoFS epoch on server | -| Version | [uint32](#uint32) | | Version defines protocol version TODO: not used for now, should be implemented in future | - - - - - - - - -

Top

- -## service/verify.proto - - - - - - - -### Message BearerTokenMsg -BearerTokenMsg carries information about request ACL rules with limited lifetime - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| TokenInfo | [BearerTokenMsg.Info](#service.BearerTokenMsg.Info) | | TokenInfo is a grouped information about token | -| OwnerKey | [bytes](#bytes) | | OwnerKey is a public key of the token owner | -| Signature | [bytes](#bytes) | | Signature is a signature of token information | - - - - -### Message BearerTokenMsg.Info - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| ACLRules | [bytes](#bytes) | | ACLRules carries a binary representation of the table of extended ACL rules | -| OwnerID | [bytes](#bytes) | | OwnerID is an owner of token | -| ValidUntil | [uint64](#uint64) | | ValidUntil carries a last epoch of token lifetime | - - - - -### Message RequestVerificationHeader -RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request -(should be embedded into message). - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| Signatures | [RequestVerificationHeader.Signature](#service.RequestVerificationHeader.Signature) | repeated | Signatures is a set of signatures of every passed NeoFS Node | -| Token | [Token](#service.Token) | | Token is a token of the session within which the request is sent | -| Bearer | [BearerTokenMsg](#service.BearerTokenMsg) | | Bearer is a Bearer token of the request | - - - - -### Message RequestVerificationHeader.Signature - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| Sign | [bytes](#bytes) | | Sign is signature of the request or session key. | -| Peer | [bytes](#bytes) | | Peer is compressed public key used for signature. | - - - - -### Message Token -User token granting rights for object manipulation - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| TokenInfo | [Token.Info](#service.Token.Info) | | TokenInfo is a grouped information about token | -| Signature | [bytes](#bytes) | | Signature is a signature of session token information | - - - - -### Message Token.Info - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| ID | [bytes](#bytes) | | ID is a token identifier. valid UUIDv4 represented in bytes | -| OwnerID | [bytes](#bytes) | | OwnerID is an owner of manipulation object | -| verb | [Token.Info.Verb](#service.Token.Info.Verb) | | Verb is a type of request for which the token is issued | -| Address | [refs.Address](#refs.Address) | | Address is an object address for which token is issued | -| Lifetime | [TokenLifetime](#service.TokenLifetime) | | Lifetime is a lifetime of the session | -| SessionKey | [bytes](#bytes) | | SessionKey is a public key of session key | -| OwnerKey | [bytes](#bytes) | | OwnerKey is a public key of the token owner | - - - - -### Message TokenLifetime -TokenLifetime carries a group of lifetime parameters of the token - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| Created | [uint64](#uint64) | | Created carries an initial epoch of token lifetime | -| ValidUntil | [uint64](#uint64) | | ValidUntil carries a last epoch of token lifetime | - - - - - - -### Token.Info.Verb -Verb is an enumeration of session request types - -| Name | Number | Description | -| ---- | ------ | ----------- | -| Put | 0 | Put refers to object.Put RPC call | -| Get | 1 | Get refers to object.Get RPC call | -| Head | 2 | Head refers to object.Head RPC call | -| Search | 3 | Search refers to object.Search RPC call | -| Delete | 4 | Delete refers to object.Delete RPC call | -| Range | 5 | Range refers to object.GetRange RPC call | -| RangeHash | 6 | RangeHash refers to object.GetRangeHash RPC call | - - - - - - - -

Top

- -## service/verify_test.proto - - - - - - - -### Message TestRequest - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| IntField | [int32](#int32) | | | -| StringField | [string](#string) | | | -| BytesField | [bytes](#bytes) | | | -| CustomField | [bytes](#bytes) | | | -| Meta | [RequestMetaHeader](#service.RequestMetaHeader) | | | -| Header | [RequestVerificationHeader](#service.RequestVerificationHeader) | | | - - - - - - - -## Scalar Value Types - -| .proto Type | Notes | C++ Type | Java Type | Python Type | -| ----------- | ----- | -------- | --------- | ----------- | -| double | | double | double | float | -| float | | float | float | float | -| int32 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint32 instead. | int32 | int | int | -| int64 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint64 instead. | int64 | long | int/long | -| uint32 | Uses variable-length encoding. | uint32 | int | int/long | -| uint64 | Uses variable-length encoding. | uint64 | long | int/long | -| sint32 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s. | int32 | int | int | -| sint64 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s. | int64 | long | int/long | -| fixed32 | Always four bytes. More efficient than uint32 if values are often greater than 2^28. | uint32 | int | int | -| fixed64 | Always eight bytes. More efficient than uint64 if values are often greater than 2^56. | uint64 | long | int/long | -| sfixed32 | Always four bytes. | int32 | int | int | -| sfixed64 | Always eight bytes. | int64 | long | int/long | -| bool | | bool | boolean | boolean | -| string | A string must always contain UTF-8 encoded or 7-bit ASCII text. | string | String | str/unicode | -| bytes | May contain any arbitrary sequence of bytes. | string | ByteString | str | - diff --git a/docs/session.md b/docs/session.md deleted file mode 100644 index 5ec7402..0000000 --- a/docs/session.md +++ /dev/null @@ -1,97 +0,0 @@ -# Protocol Documentation - - -## Table of Contents - -- [session/service.proto](#session/service.proto) - - Services - - [Session](#session.Session) - - - Messages - - [CreateRequest](#session.CreateRequest) - - [CreateResponse](#session.CreateResponse) - - -- [Scalar Value Types](#scalar-value-types) - - - - -

Top

- -## session/service.proto - - - - - - -### Service "session.Session" - - -``` -rpc Create(CreateRequest) returns (CreateResponse); - -``` - -#### Method Create - -Create opens new session between the client and the server - -| Name | Input | Output | -| ---- | ----- | ------ | -| Create | [CreateRequest](#session.CreateRequest) | [CreateResponse](#session.CreateResponse) | - - - - - -### Message CreateRequest -CreateRequest carries an information necessary for opening a session - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| OwnerID | [bytes](#bytes) | | OwnerID carries an identifier of a session initiator | -| Lifetime | [service.TokenLifetime](#service.TokenLifetime) | | Lifetime carries a lifetime of the session | -| Meta | [service.RequestMetaHeader](#service.RequestMetaHeader) | | RequestMetaHeader contains information about request meta headers (should be embedded into message) | -| Verify | [service.RequestVerificationHeader](#service.RequestVerificationHeader) | | RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) | - - - - -### Message CreateResponse -CreateResponse carries an information about the opened session - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| ID | [bytes](#bytes) | | ID carries an identifier of session token | -| SessionKey | [bytes](#bytes) | | SessionKey carries a session public key | - - - - - - - -## Scalar Value Types - -| .proto Type | Notes | C++ Type | Java Type | Python Type | -| ----------- | ----- | -------- | --------- | ----------- | -| double | | double | double | float | -| float | | float | float | float | -| int32 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint32 instead. | int32 | int | int | -| int64 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint64 instead. | int64 | long | int/long | -| uint32 | Uses variable-length encoding. | uint32 | int | int/long | -| uint64 | Uses variable-length encoding. | uint64 | long | int/long | -| sint32 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s. | int32 | int | int | -| sint64 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s. | int64 | long | int/long | -| fixed32 | Always four bytes. More efficient than uint32 if values are often greater than 2^28. | uint32 | int | int | -| fixed64 | Always eight bytes. More efficient than uint64 if values are often greater than 2^56. | uint64 | long | int/long | -| sfixed32 | Always four bytes. | int32 | int | int | -| sfixed64 | Always eight bytes. | int64 | long | int/long | -| bool | | bool | boolean | boolean | -| string | A string must always contain UTF-8 encoded or 7-bit ASCII text. | string | String | str/unicode | -| bytes | May contain any arbitrary sequence of bytes. | string | ByteString | str | - diff --git a/docs/state.md b/docs/state.md deleted file mode 100644 index 3b7b89d..0000000 --- a/docs/state.md +++ /dev/null @@ -1,270 +0,0 @@ -# Protocol Documentation - - -## Table of Contents - -- [state/service.proto](#state/service.proto) - - Services - - [Status](#state.Status) - - - Messages - - [ChangeStateRequest](#state.ChangeStateRequest) - - [ChangeStateResponse](#state.ChangeStateResponse) - - [DumpRequest](#state.DumpRequest) - - [DumpResponse](#state.DumpResponse) - - [DumpVarsRequest](#state.DumpVarsRequest) - - [DumpVarsResponse](#state.DumpVarsResponse) - - [HealthRequest](#state.HealthRequest) - - [HealthResponse](#state.HealthResponse) - - [MetricsRequest](#state.MetricsRequest) - - [MetricsResponse](#state.MetricsResponse) - - [NetmapRequest](#state.NetmapRequest) - - -- [Scalar Value Types](#scalar-value-types) - - - - -

Top

- -## state/service.proto - - - - - - -### Service "state.Status" -Status service provides node's healthcheck and status info. -TODO: decide how to describe auth and were contains permissions. - -``` -rpc Netmap(NetmapRequest) returns (.bootstrap.SpreadMap); -rpc Metrics(MetricsRequest) returns (MetricsResponse); -rpc HealthCheck(HealthRequest) returns (HealthResponse); -rpc DumpConfig(DumpRequest) returns (DumpResponse); -rpc DumpVars(DumpVarsRequest) returns (DumpVarsResponse); -rpc ChangeState(ChangeStateRequest) returns (ChangeStateResponse); - -``` - -#### Method Netmap - -Netmap request allows to receive current [bootstrap.SpreadMap](bootstrap.md#bootstrap.SpreadMap) - -| Name | Input | Output | -| ---- | ----- | ------ | -| Netmap | [NetmapRequest](#state.NetmapRequest) | [.bootstrap.SpreadMap](#bootstrap.SpreadMap) | -#### Method Metrics - -Metrics request allows to receive metrics in prometheus format - -| Name | Input | Output | -| ---- | ----- | ------ | -| Metrics | [MetricsRequest](#state.MetricsRequest) | [MetricsResponse](#state.MetricsResponse) | -#### Method HealthCheck - -HealthCheck request allows to check health status of the node. -If node unhealthy field Status would contains detailed info. - -| Name | Input | Output | -| ---- | ----- | ------ | -| HealthCheck | [HealthRequest](#state.HealthRequest) | [HealthResponse](#state.HealthResponse) | -#### Method DumpConfig - -DumpConfig request allows dumping settings for the current node. -To permit access, used server config options. -The request should be signed. - -| Name | Input | Output | -| ---- | ----- | ------ | -| DumpConfig | [DumpRequest](#state.DumpRequest) | [DumpResponse](#state.DumpResponse) | -#### Method DumpVars - -DumpVars returns debug variables for the current node. -To permit access, used server config options. -The request should be signed. - -| Name | Input | Output | -| ---- | ----- | ------ | -| DumpVars | [DumpVarsRequest](#state.DumpVarsRequest) | [DumpVarsResponse](#state.DumpVarsResponse) | -#### Method ChangeState - -ChangeState allows to change current node state of node. -To permit access, used server config options. -The request should be signed. - -| Name | Input | Output | -| ---- | ----- | ------ | -| ChangeState | [ChangeStateRequest](#state.ChangeStateRequest) | [ChangeStateResponse](#state.ChangeStateResponse) | - - - - - -### Message ChangeStateRequest -ChangeStateRequest contains a new state of node. - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| state | [ChangeStateRequest.State](#state.ChangeStateRequest.State) | | State is a new state of node. | -| Meta | [service.RequestMetaHeader](#service.RequestMetaHeader) | | RequestMetaHeader contains information about request meta headers (should be embedded into message) | -| Verify | [service.RequestVerificationHeader](#service.RequestVerificationHeader) | | RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) | - - - - -### Message ChangeStateResponse -ChangeStateResponse is an empty response, that returns when RPC invoked without errors. - - - - - -### Message DumpRequest -DumpRequest message to fetch current server config. - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| Meta | [service.RequestMetaHeader](#service.RequestMetaHeader) | | RequestMetaHeader contains information about request meta headers (should be embedded into message) | -| Verify | [service.RequestVerificationHeader](#service.RequestVerificationHeader) | | RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) | - - - - -### Message DumpResponse -DumpResponse message contains current server config. -Config stored in JSON encoded into slice of bytes. - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| Config | [bytes](#bytes) | | | - - - - -### Message DumpVarsRequest -DumpVarsRequest message to fetch current server debug variables. - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| Meta | [service.RequestMetaHeader](#service.RequestMetaHeader) | | RequestMetaHeader contains information about request meta headers (should be embedded into message) | -| Verify | [service.RequestVerificationHeader](#service.RequestVerificationHeader) | | RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) | - - - - -### Message DumpVarsResponse -DumpVarsResponse message contains current server debug variables. -Variables stored in JSON encoded into slice of bytes. - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| Variables | [bytes](#bytes) | | | - - - - -### Message HealthRequest -HealthRequest message to check current state - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| Meta | [service.RequestMetaHeader](#service.RequestMetaHeader) | | RequestMetaHeader contains information about request meta headers (should be embedded into message) | -| Verify | [service.RequestVerificationHeader](#service.RequestVerificationHeader) | | RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) | - - - - -### Message HealthResponse -HealthResponse message with current state - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| Healthy | [bool](#bool) | | Healthy is true when node alive and healthy | -| Status | [string](#string) | | Status contains detailed information about health status | - - - - -### Message MetricsRequest -MetricsRequest message to request node metrics - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| Meta | [service.RequestMetaHeader](#service.RequestMetaHeader) | | RequestMetaHeader contains information about request meta headers (should be embedded into message) | -| Verify | [service.RequestVerificationHeader](#service.RequestVerificationHeader) | | RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) | - - - - -### Message MetricsResponse -MetricsResponse contains [][]byte, -every []byte is marshaled MetricFamily proto message -from github.com/prometheus/client_model/metrics.proto - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| Metrics | [bytes](#bytes) | repeated | | - - - - -### Message NetmapRequest -NetmapRequest message to request current node netmap - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| Meta | [service.RequestMetaHeader](#service.RequestMetaHeader) | | RequestMetaHeader contains information about request meta headers (should be embedded into message) | -| Verify | [service.RequestVerificationHeader](#service.RequestVerificationHeader) | | RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) | - - - - - - -### ChangeStateRequest.State - - -| Name | Number | Description | -| ---- | ------ | ----------- | -| Unknown | 0 | Unknown is default value. Does nothing. | -| Online | 1 | Online used when need to set node to the online state. | -| Offline | 2 | Offline used when need to set node to the offline state. | - - - - - - -## Scalar Value Types - -| .proto Type | Notes | C++ Type | Java Type | Python Type | -| ----------- | ----- | -------- | --------- | ----------- | -| double | | double | double | float | -| float | | float | float | float | -| int32 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint32 instead. | int32 | int | int | -| int64 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint64 instead. | int64 | long | int/long | -| uint32 | Uses variable-length encoding. | uint32 | int | int/long | -| uint64 | Uses variable-length encoding. | uint64 | long | int/long | -| sint32 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s. | int32 | int | int | -| sint64 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s. | int64 | long | int/long | -| fixed32 | Always four bytes. More efficient than uint32 if values are often greater than 2^28. | uint32 | int | int | -| fixed64 | Always eight bytes. More efficient than uint64 if values are often greater than 2^56. | uint64 | long | int/long | -| sfixed32 | Always four bytes. | int32 | int | int | -| sfixed64 | Always eight bytes. | int64 | long | int/long | -| bool | | bool | boolean | boolean | -| string | A string must always contain UTF-8 encoded or 7-bit ASCII text. | string | String | str/unicode | -| bytes | May contain any arbitrary sequence of bytes. | string | ByteString | str | - diff --git a/docs/storagegroup.md b/docs/storagegroup.md deleted file mode 100644 index 7522902..0000000 --- a/docs/storagegroup.md +++ /dev/null @@ -1,88 +0,0 @@ -# Protocol Documentation - - -## Table of Contents - -- [storagegroup/types.proto](#storagegroup/types.proto) - - - Messages - - [StorageGroup](#storagegroup.StorageGroup) - - [StorageGroup.Lifetime](#storagegroup.StorageGroup.Lifetime) - - -- [Scalar Value Types](#scalar-value-types) - - - - -

Top

- -## storagegroup/types.proto - - - - - - - -### Message StorageGroup - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| ValidationDataSize | [uint64](#uint64) | | ValidationDataSize is size of the all object's payloads included into storage group | -| ValidationHash | [bytes](#bytes) | | ValidationHash is homomorphic hash of all object's payloads included into storage group | -| lifetime | [StorageGroup.Lifetime](#storagegroup.StorageGroup.Lifetime) | | Lifetime is time until storage group is valid | - - - - -### Message StorageGroup.Lifetime - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| unit | [StorageGroup.Lifetime.Unit](#storagegroup.StorageGroup.Lifetime.Unit) | | Unit is lifetime type | -| Value | [int64](#int64) | | Value for lifetime | - - - - - - -### StorageGroup.Lifetime.Unit - - -| Name | Number | Description | -| ---- | ------ | ----------- | -| Unlimited | 0 | Unlimited set if storage group always valid | -| NeoFSEpoch | 1 | NeoFSEpoch set if storage group is valid until lifetime NeoFS epoch | -| UnixTime | 2 | UnixTime set if storage group is valid until lifetime unix timestamp | - - - - - - -## Scalar Value Types - -| .proto Type | Notes | C++ Type | Java Type | Python Type | -| ----------- | ----- | -------- | --------- | ----------- | -| double | | double | double | float | -| float | | float | float | float | -| int32 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint32 instead. | int32 | int | int | -| int64 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint64 instead. | int64 | long | int/long | -| uint32 | Uses variable-length encoding. | uint32 | int | int/long | -| uint64 | Uses variable-length encoding. | uint64 | long | int/long | -| sint32 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s. | int32 | int | int | -| sint64 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s. | int64 | long | int/long | -| fixed32 | Always four bytes. More efficient than uint32 if values are often greater than 2^28. | uint32 | int | int | -| fixed64 | Always eight bytes. More efficient than uint64 if values are often greater than 2^56. | uint64 | long | int/long | -| sfixed32 | Always four bytes. | int32 | int | int | -| sfixed64 | Always eight bytes. | int64 | long | int/long | -| bool | | bool | boolean | boolean | -| string | A string must always contain UTF-8 encoded or 7-bit ASCII text. | string | String | str/unicode | -| bytes | May contain any arbitrary sequence of bytes. | string | ByteString | str | - From ca917e42d03a91ef368b3bca1037300910baf179 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Thu, 13 Aug 2020 16:44:01 +0300 Subject: [PATCH 0273/1196] Fix marshaller test --- v2/refs/marshal_test.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/v2/refs/marshal_test.go b/v2/refs/marshal_test.go index 7bf3d6f..8f822fb 100644 --- a/v2/refs/marshal_test.go +++ b/v2/refs/marshal_test.go @@ -18,8 +18,9 @@ func TestOwnerID_StableMarshal(t *testing.T) { gotOwner := new(OwnerID) t.Run("small buffer", func(t *testing.T) { - _, err = expectedOwner.StableMarshal(make([]byte, 1)) - require.Error(t, err) + require.Panics(t, func() { + expectedOwner.StableMarshal(make([]byte, 1)) + }) }) t.Run("empty owner", func(t *testing.T) { From 8aca8c57873fc6efa2193c4ce545041191da43a5 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Fri, 14 Aug 2020 09:49:05 +0300 Subject: [PATCH 0274/1196] Update proto files from latest jindo --- Makefile | 7 +- v2/accounting/service.pb.go | 107 ++-- v2/acl/types.pb.go | 204 ++++--- v2/container/service.pb.go | 254 +++++---- v2/container/types.pb.go | 77 +-- v2/netmap/types.pb.go | 1056 ++++++++++++++++++----------------- v2/object/service.pb.go | 750 ++++++++++--------------- v2/object/types.pb.go | 101 ++-- v2/refs/types.pb.go | 13 +- v2/service/meta.pb.go | 245 ++++---- v2/service/verify.pb.go | 48 +- v2/session/service.pb.go | 106 ++-- v2/storagegroup/types.pb.go | 40 +- 13 files changed, 1471 insertions(+), 1537 deletions(-) diff --git a/Makefile b/Makefile index 0847abe..f4a54c4 100644 --- a/Makefile +++ b/Makefile @@ -50,17 +50,12 @@ docgen: deps protoc: @echo "${B}${G}⇒ Cleanup old files ${R}" @find . -type f -name '*.pb.go' -not -path './vendor/*' -exec rm {} \; - - @echo "${B}${G}⇒ Install specific version for gogo-proto ${R}" - @go list -f '{{.Path}}/...@{{.Version}}' -m github.com/gogo/protobuf | xargs go get -v - @echo "${B}${G}⇒ Install specific version for protobuf lib ${R}" - @go list -f '{{.Path}}/...@{{.Version}}' -m github.com/golang/protobuf | xargs go get -v @echo "${B}${G}⇒ Protoc generate ${R}" @for f in `find . -type f -name '*.proto' -not -path './vendor/*'`; do \ echo "${B}${G}⇒ Processing $$f ${R}"; \ protoc \ --proto_path=.:./vendor:/usr/local/include \ - --gofast_out=plugins=grpc,paths=source_relative:. $$f; \ + --gofast_out=plugins=grpc,paths=source_relative:. $$f; \ done update: docgen protoc diff --git a/v2/accounting/service.pb.go b/v2/accounting/service.pb.go index 0a4deda..f8a40e8 100644 --- a/v2/accounting/service.pb.go +++ b/v2/accounting/service.pb.go @@ -104,6 +104,7 @@ func (m *BalanceRequest) GetVerifyHeader() *service.RequestVerificationHeader { return nil } +//Request body type BalanceRequest_Body struct { // Carries user identifier in NeoFS system for which the balance // is requested. @@ -283,6 +284,7 @@ func (m *BalanceResponse) GetVerifyHeader() *service.ResponseVerificationHeader return nil } +//Request body type BalanceResponse_Body struct { // Carries the amount of funds on the account. Balance *Decimal `protobuf:"bytes,1,opt,name=balance,proto3" json:"balance,omitempty"` @@ -342,36 +344,37 @@ func init() { func init() { proto.RegisterFile("v2/accounting/service.proto", fileDescriptor_484f6b0e24e3172f) } var fileDescriptor_484f6b0e24e3172f = []byte{ - // 464 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x93, 0xdf, 0x6a, 0x13, 0x41, - 0x18, 0xc5, 0xdd, 0xb4, 0x1a, 0xfd, 0x6a, 0x15, 0xc6, 0x48, 0x4b, 0xd4, 0x20, 0xa1, 0x05, 0x15, - 0x33, 0x03, 0xeb, 0x85, 0x20, 0x54, 0x69, 0xa8, 0xc5, 0x5c, 0xf8, 0x6f, 0x85, 0x22, 0xde, 0x94, - 0xc9, 0xec, 0x97, 0x74, 0x20, 0x99, 0x59, 0x77, 0x36, 0x2b, 0x79, 0x13, 0x5f, 0xc0, 0x1b, 0x2f, - 0x7c, 0x0e, 0x2f, 0x7d, 0x04, 0x89, 0x2f, 0x22, 0x3b, 0x33, 0x49, 0x36, 0xb0, 0x6d, 0x73, 0xb7, - 0x33, 0x73, 0xce, 0x99, 0xef, 0xfc, 0xd8, 0x81, 0x7b, 0x79, 0xc8, 0xb8, 0x10, 0x7a, 0xa2, 0x32, - 0xa9, 0x86, 0xcc, 0x60, 0x9a, 0x4b, 0x81, 0x34, 0x49, 0x75, 0xa6, 0x49, 0x43, 0xa1, 0xa6, 0x03, - 0x43, 0xf3, 0x90, 0x2e, 0x35, 0xcd, 0x3b, 0x79, 0xc8, 0x52, 0x1c, 0x18, 0x96, 0x4d, 0x13, 0x34, - 0x4e, 0xda, 0xbc, 0x9b, 0x87, 0x73, 0x33, 0x1b, 0x63, 0xc6, 0xfd, 0xf6, 0x4e, 0x69, 0x3b, 0xc7, - 0x54, 0x0e, 0xa6, 0xee, 0xa0, 0xfd, 0xa3, 0x06, 0xb7, 0xba, 0x7c, 0xc4, 0x95, 0xc0, 0x08, 0xbf, - 0x4e, 0xd0, 0x64, 0xe4, 0x00, 0x36, 0xfb, 0x3a, 0x9e, 0xee, 0x06, 0x0f, 0x83, 0x47, 0x5b, 0xe1, - 0x63, 0x5a, 0x75, 0x39, 0x5d, 0xf5, 0xd0, 0xae, 0x8e, 0xa7, 0x91, 0xb5, 0x91, 0xd7, 0xb0, 0x55, - 0x5c, 0x7c, 0x7a, 0x86, 0x3c, 0xc6, 0x74, 0xb7, 0x66, 0x53, 0xf6, 0x4a, 0x29, 0xf3, 0x6e, 0xde, - 0xfb, 0x16, 0x33, 0xfe, 0xc6, 0x6a, 0x23, 0x18, 0x2f, 0xbe, 0xc9, 0x47, 0xd8, 0x76, 0x83, 0xce, - 0x83, 0x36, 0x6c, 0xd0, 0xd3, 0xf3, 0x83, 0x4e, 0x0a, 0xb9, 0x14, 0x3c, 0x93, 0x5a, 0xf9, 0xc0, - 0x9b, 0x2e, 0xc2, 0xad, 0x9a, 0x2f, 0x60, 0xb3, 0x98, 0x93, 0x84, 0x70, 0x5d, 0x7f, 0x53, 0x98, - 0x9e, 0xca, 0xd8, 0x97, 0xdc, 0x29, 0xa5, 0x16, 0x48, 0xe9, 0xfb, 0xe2, 0xbc, 0x77, 0x14, 0xd5, - 0xad, 0xb0, 0x17, 0xb7, 0x0f, 0xa0, 0x7e, 0x84, 0x42, 0x8e, 0xf9, 0x88, 0x34, 0xe0, 0x6a, 0xce, - 0x47, 0x13, 0xb4, 0xde, 0x8d, 0xc8, 0x2d, 0xc8, 0x7d, 0xb8, 0x91, 0xa4, 0x28, 0xa4, 0x91, 0x5a, - 0xd9, 0xd2, 0xdb, 0xd1, 0x72, 0xa3, 0xfd, 0xab, 0x06, 0xb7, 0x17, 0xc8, 0x4c, 0xa2, 0x95, 0x41, - 0xf2, 0x72, 0x85, 0xf3, 0x93, 0x4b, 0x38, 0x3b, 0x53, 0x19, 0xf4, 0x71, 0x15, 0xe8, 0xfd, 0x4a, - 0x3e, 0xce, 0x7c, 0x0e, 0xe9, 0xa8, 0x9a, 0x74, 0xe7, 0x82, 0xa4, 0x4b, 0x51, 0xbf, 0xf2, 0xa8, - 0x9f, 0x43, 0xbd, 0xef, 0x1a, 0xf8, 0x9a, 0x0f, 0xaa, 0x6b, 0x7a, 0xb6, 0xd1, 0x5c, 0x1d, 0xc6, - 0x00, 0x87, 0x8b, 0x63, 0x72, 0x02, 0x75, 0x0f, 0x82, 0xec, 0xad, 0xf3, 0x3f, 0x36, 0xf7, 0xd7, - 0xa2, 0xd9, 0xfd, 0xfc, 0x7b, 0xd6, 0x0a, 0xfe, 0xcc, 0x5a, 0xc1, 0xdf, 0x59, 0x2b, 0xf8, 0xfe, - 0xaf, 0x75, 0xe5, 0x0b, 0x1b, 0xca, 0xec, 0x6c, 0xd2, 0xa7, 0x42, 0x8f, 0x99, 0x32, 0x89, 0x10, - 0x9d, 0x18, 0x73, 0xa6, 0x50, 0x0f, 0x4c, 0x87, 0x27, 0xb2, 0x33, 0xd4, 0x6c, 0xe5, 0xa5, 0xfe, - 0xac, 0x35, 0xde, 0xa1, 0x3e, 0xfe, 0x44, 0x0f, 0x3f, 0xf4, 0xe8, 0x72, 0xe2, 0xfe, 0x35, 0xfb, - 0xbc, 0x9e, 0xfd, 0x0f, 0x00, 0x00, 0xff, 0xff, 0x4f, 0x91, 0xf3, 0x3d, 0xd8, 0x03, 0x00, 0x00, + // 472 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x93, 0xdf, 0x6e, 0xd3, 0x30, + 0x18, 0xc5, 0x49, 0x37, 0x28, 0x78, 0x0c, 0x84, 0x19, 0xea, 0x54, 0xa0, 0x42, 0xd5, 0x26, 0x01, + 0xa2, 0x8e, 0x14, 0x2e, 0x90, 0x86, 0x06, 0x5a, 0x35, 0x26, 0x7a, 0xc1, 0xbf, 0x4c, 0xda, 0x05, + 0x37, 0x93, 0xeb, 0x7c, 0xe9, 0x2c, 0x5a, 0x3b, 0xc4, 0xae, 0x51, 0xdf, 0x84, 0x17, 0xe0, 0x86, + 0x0b, 0x9e, 0x83, 0x4b, 0x1e, 0x01, 0x95, 0x17, 0x41, 0xb1, 0xdd, 0x36, 0x95, 0xb2, 0xad, 0x77, + 0xb1, 0x7d, 0xce, 0xf9, 0x7c, 0x7e, 0x8a, 0xd1, 0x7d, 0x13, 0x85, 0x94, 0x31, 0x39, 0x16, 0x9a, + 0x8b, 0x41, 0xa8, 0x20, 0x37, 0x9c, 0x01, 0xc9, 0x72, 0xa9, 0x25, 0xde, 0x12, 0x20, 0x49, 0xaa, + 0x88, 0x89, 0xc8, 0x42, 0xd3, 0xbc, 0x6b, 0xa2, 0x30, 0x87, 0x54, 0x85, 0x7a, 0x92, 0x81, 0x72, + 0xd2, 0xe6, 0x3d, 0x13, 0xcd, 0xcc, 0xe1, 0x08, 0x34, 0xf5, 0xdb, 0x8d, 0xd2, 0xb6, 0x81, 0x9c, + 0xa7, 0x13, 0x77, 0xd0, 0xfe, 0x51, 0x43, 0xb7, 0xba, 0x74, 0x48, 0x05, 0x83, 0x18, 0xbe, 0x8e, + 0x41, 0x69, 0xbc, 0x8f, 0xd6, 0xfb, 0x32, 0x99, 0x6c, 0x07, 0x8f, 0x82, 0xc7, 0x1b, 0xd1, 0x13, + 0x52, 0x35, 0x9c, 0x2c, 0x7b, 0x48, 0x57, 0x26, 0x93, 0xd8, 0xda, 0xf0, 0x1b, 0xb4, 0x51, 0x0c, + 0x3e, 0x3d, 0x03, 0x9a, 0x40, 0xbe, 0x5d, 0xb3, 0x29, 0x3b, 0xa5, 0x94, 0x59, 0x37, 0xef, 0x7d, + 0x07, 0x9a, 0xbe, 0xb5, 0xda, 0x18, 0x8d, 0xe6, 0xdf, 0xf8, 0x13, 0xda, 0x74, 0x17, 0x9d, 0x05, + 0xad, 0xd9, 0xa0, 0x67, 0xe7, 0x07, 0x9d, 0x14, 0x72, 0xce, 0xa8, 0xe6, 0x52, 0xf8, 0xc0, 0x9b, + 0x2e, 0xc2, 0xad, 0x9a, 0x7b, 0x68, 0xbd, 0xb8, 0x27, 0x8e, 0xd0, 0x75, 0xf9, 0x4d, 0x40, 0x7e, + 0xca, 0x13, 0x5f, 0xb2, 0x51, 0x4a, 0x2d, 0x90, 0x92, 0x0f, 0xc5, 0x79, 0xef, 0x30, 0xae, 0x5b, + 0x61, 0x2f, 0x69, 0xef, 0xa3, 0xfa, 0x21, 0x30, 0x3e, 0xa2, 0x43, 0xbc, 0x85, 0xae, 0x1a, 0x3a, + 0x1c, 0x83, 0xf5, 0xae, 0xc5, 0x6e, 0x81, 0x1f, 0xa0, 0x1b, 0x59, 0x0e, 0x8c, 0x2b, 0x2e, 0x85, + 0x2d, 0xbd, 0x19, 0x2f, 0x36, 0xda, 0xbf, 0x6a, 0xe8, 0xf6, 0x1c, 0x99, 0xca, 0xa4, 0x50, 0x80, + 0x5f, 0x2d, 0x71, 0x7e, 0x7a, 0x09, 0x67, 0x67, 0x2a, 0x83, 0x3e, 0xaa, 0x02, 0xbd, 0x5b, 0xc9, + 0xc7, 0x99, 0xcf, 0x21, 0x1d, 0x57, 0x93, 0xee, 0x5c, 0x90, 0x74, 0x29, 0xea, 0xd7, 0x1e, 0xf5, + 0x0b, 0x54, 0xef, 0xbb, 0x06, 0xbe, 0xe6, 0xc3, 0xea, 0x9a, 0x9e, 0x6d, 0x3c, 0x53, 0x47, 0x5f, + 0xd0, 0x9d, 0x83, 0xf9, 0xf1, 0xb1, 0x1b, 0x8f, 0x4f, 0x50, 0xdd, 0xf3, 0xc0, 0x3b, 0xab, 0xfc, + 0x96, 0xcd, 0xdd, 0x95, 0xa0, 0x76, 0xd3, 0xdf, 0xd3, 0x56, 0xf0, 0x67, 0xda, 0x0a, 0xfe, 0x4e, + 0x5b, 0xc1, 0xf7, 0x7f, 0xad, 0x2b, 0x9f, 0xf7, 0x06, 0x5c, 0x9f, 0x8d, 0xfb, 0x84, 0xc9, 0x51, + 0x28, 0x54, 0xc6, 0x58, 0x27, 0x01, 0x13, 0x0a, 0x90, 0xa9, 0xea, 0xd0, 0x8c, 0x77, 0x06, 0x32, + 0x5c, 0x7a, 0xb0, 0x2f, 0x17, 0x9f, 0x3f, 0x6b, 0x8d, 0xf7, 0x20, 0x8f, 0x8e, 0xc9, 0xc1, 0xc7, + 0x5e, 0x31, 0x77, 0x51, 0xa3, 0x7f, 0xcd, 0xbe, 0xb9, 0xe7, 0xff, 0x03, 0x00, 0x00, 0xff, 0xff, + 0x1e, 0x24, 0x48, 0xec, 0xed, 0x03, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -382,74 +385,74 @@ var _ grpc.ClientConn // is compatible with the grpc package it is being compiled against. const _ = grpc.SupportPackageIsVersion4 -// AccountingClient is the client API for Accounting service. +// AccountingServiceClient is the client API for AccountingService service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type AccountingClient interface { +type AccountingServiceClient interface { // Returns the amount of funds for the requested NeoFS account. Balance(ctx context.Context, in *BalanceRequest, opts ...grpc.CallOption) (*BalanceResponse, error) } -type accountingClient struct { +type accountingServiceClient struct { cc *grpc.ClientConn } -func NewAccountingClient(cc *grpc.ClientConn) AccountingClient { - return &accountingClient{cc} +func NewAccountingServiceClient(cc *grpc.ClientConn) AccountingServiceClient { + return &accountingServiceClient{cc} } -func (c *accountingClient) Balance(ctx context.Context, in *BalanceRequest, opts ...grpc.CallOption) (*BalanceResponse, error) { +func (c *accountingServiceClient) Balance(ctx context.Context, in *BalanceRequest, opts ...grpc.CallOption) (*BalanceResponse, error) { out := new(BalanceResponse) - err := c.cc.Invoke(ctx, "/neo.fs.v2.accounting.Accounting/Balance", in, out, opts...) + err := c.cc.Invoke(ctx, "/neo.fs.v2.accounting.AccountingService/Balance", in, out, opts...) if err != nil { return nil, err } return out, nil } -// AccountingServer is the server API for Accounting service. -type AccountingServer interface { +// AccountingServiceServer is the server API for AccountingService service. +type AccountingServiceServer interface { // Returns the amount of funds for the requested NeoFS account. Balance(context.Context, *BalanceRequest) (*BalanceResponse, error) } -// UnimplementedAccountingServer can be embedded to have forward compatible implementations. -type UnimplementedAccountingServer struct { +// UnimplementedAccountingServiceServer can be embedded to have forward compatible implementations. +type UnimplementedAccountingServiceServer struct { } -func (*UnimplementedAccountingServer) Balance(ctx context.Context, req *BalanceRequest) (*BalanceResponse, error) { +func (*UnimplementedAccountingServiceServer) Balance(ctx context.Context, req *BalanceRequest) (*BalanceResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Balance not implemented") } -func RegisterAccountingServer(s *grpc.Server, srv AccountingServer) { - s.RegisterService(&_Accounting_serviceDesc, srv) +func RegisterAccountingServiceServer(s *grpc.Server, srv AccountingServiceServer) { + s.RegisterService(&_AccountingService_serviceDesc, srv) } -func _Accounting_Balance_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _AccountingService_Balance_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(BalanceRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(AccountingServer).Balance(ctx, in) + return srv.(AccountingServiceServer).Balance(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/neo.fs.v2.accounting.Accounting/Balance", + FullMethod: "/neo.fs.v2.accounting.AccountingService/Balance", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(AccountingServer).Balance(ctx, req.(*BalanceRequest)) + return srv.(AccountingServiceServer).Balance(ctx, req.(*BalanceRequest)) } return interceptor(ctx, in, info, handler) } -var _Accounting_serviceDesc = grpc.ServiceDesc{ - ServiceName: "neo.fs.v2.accounting.Accounting", - HandlerType: (*AccountingServer)(nil), +var _AccountingService_serviceDesc = grpc.ServiceDesc{ + ServiceName: "neo.fs.v2.accounting.AccountingService", + HandlerType: (*AccountingServiceServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "Balance", - Handler: _Accounting_Balance_Handler, + Handler: _AccountingService_Balance_Handler, }, }, Streams: []grpc.StreamDesc{}, diff --git a/v2/acl/types.pb.go b/v2/acl/types.pb.go index e05fcf5..0425329 100644 --- a/v2/acl/types.pb.go +++ b/v2/acl/types.pb.go @@ -27,8 +27,8 @@ const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package type Target int32 const ( - // Unknown target, default value. - Target_UNKNOWN Target = 0 + // Unspecified target, default value. + Target_TARGET_UNSPECIFIED Target = 0 // User target rule is applied if sender is the owner of the container. Target_USER Target = 1 // System target rule is applied if sender is the storage node within the @@ -39,17 +39,17 @@ const ( ) var Target_name = map[int32]string{ - 0: "UNKNOWN", + 0: "TARGET_UNSPECIFIED", 1: "USER", 2: "SYSTEM", 3: "OTHERS", } var Target_value = map[string]int32{ - "UNKNOWN": 0, - "USER": 1, - "SYSTEM": 2, - "OTHERS": 3, + "TARGET_UNSPECIFIED": 0, + "USER": 1, + "SYSTEM": 2, + "OTHERS": 3, } func (x Target) String() string { @@ -64,18 +64,26 @@ func (Target) EnumDescriptor() ([]byte, []int) { type EACLRecord_Operation int32 const ( - EACLRecord_OPERATION_UNKNOWN EACLRecord_Operation = 0 - EACLRecord_GET EACLRecord_Operation = 1 - EACLRecord_HEAD EACLRecord_Operation = 2 - EACLRecord_PUT EACLRecord_Operation = 3 - EACLRecord_DELETE EACLRecord_Operation = 4 - EACLRecord_SEARCH EACLRecord_Operation = 5 - EACLRecord_GETRANGE EACLRecord_Operation = 6 - EACLRecord_GETRANGEHASH EACLRecord_Operation = 7 + // Unspecified operation, default value. + EACLRecord_OPERATION_UNSPECIFIED EACLRecord_Operation = 0 + // Get + EACLRecord_GET EACLRecord_Operation = 1 + // Head + EACLRecord_HEAD EACLRecord_Operation = 2 + // Put + EACLRecord_PUT EACLRecord_Operation = 3 + // Delete + EACLRecord_DELETE EACLRecord_Operation = 4 + // Search + EACLRecord_SEARCH EACLRecord_Operation = 5 + // GetRange + EACLRecord_GETRANGE EACLRecord_Operation = 6 + // GetRangeHash + EACLRecord_GETRANGEHASH EACLRecord_Operation = 7 ) var EACLRecord_Operation_name = map[int32]string{ - 0: "OPERATION_UNKNOWN", + 0: "OPERATION_UNSPECIFIED", 1: "GET", 2: "HEAD", 3: "PUT", @@ -86,14 +94,14 @@ var EACLRecord_Operation_name = map[int32]string{ } var EACLRecord_Operation_value = map[string]int32{ - "OPERATION_UNKNOWN": 0, - "GET": 1, - "HEAD": 2, - "PUT": 3, - "DELETE": 4, - "SEARCH": 5, - "GETRANGE": 6, - "GETRANGEHASH": 7, + "OPERATION_UNSPECIFIED": 0, + "GET": 1, + "HEAD": 2, + "PUT": 3, + "DELETE": 4, + "SEARCH": 5, + "GETRANGE": 6, + "GETRANGEHASH": 7, } func (x EACLRecord_Operation) String() string { @@ -108,21 +116,24 @@ func (EACLRecord_Operation) EnumDescriptor() ([]byte, []int) { type EACLRecord_Action int32 const ( - EACLRecord_ACTION_UNKNOWN EACLRecord_Action = 0 - EACLRecord_ALLOW EACLRecord_Action = 1 - EACLRecord_DENY EACLRecord_Action = 2 + // Unspecified action, default value. + EACLRecord_ACTION_UNSPECIFIED EACLRecord_Action = 0 + // Allow action + EACLRecord_ALLOW EACLRecord_Action = 1 + // Deny action + EACLRecord_DENY EACLRecord_Action = 2 ) var EACLRecord_Action_name = map[int32]string{ - 0: "ACTION_UNKNOWN", + 0: "ACTION_UNSPECIFIED", 1: "ALLOW", 2: "DENY", } var EACLRecord_Action_value = map[string]int32{ - "ACTION_UNKNOWN": 0, - "ALLOW": 1, - "DENY": 2, + "ACTION_UNSPECIFIED": 0, + "ALLOW": 1, + "DENY": 2, } func (x EACLRecord_Action) String() string { @@ -137,21 +148,24 @@ func (EACLRecord_Action) EnumDescriptor() ([]byte, []int) { type EACLRecord_FilterInfo_Header int32 const ( - EACLRecord_FilterInfo_HEADER_UNKNOWN EACLRecord_FilterInfo_Header = 0 - EACLRecord_FilterInfo_REQUEST EACLRecord_FilterInfo_Header = 1 - EACLRecord_FilterInfo_OBJECT EACLRecord_FilterInfo_Header = 2 + // Unspecified header, default value. + EACLRecord_FilterInfo_HEADER_UNSPECIFIED EACLRecord_FilterInfo_Header = 0 + // Filter request headers + EACLRecord_FilterInfo_REQUEST EACLRecord_FilterInfo_Header = 1 + // Filter object headers + EACLRecord_FilterInfo_OBJECT EACLRecord_FilterInfo_Header = 2 ) var EACLRecord_FilterInfo_Header_name = map[int32]string{ - 0: "HEADER_UNKNOWN", + 0: "HEADER_UNSPECIFIED", 1: "REQUEST", 2: "OBJECT", } var EACLRecord_FilterInfo_Header_value = map[string]int32{ - "HEADER_UNKNOWN": 0, - "REQUEST": 1, - "OBJECT": 2, + "HEADER_UNSPECIFIED": 0, + "REQUEST": 1, + "OBJECT": 2, } func (x EACLRecord_FilterInfo_Header) String() string { @@ -166,21 +180,24 @@ func (EACLRecord_FilterInfo_Header) EnumDescriptor() ([]byte, []int) { type EACLRecord_FilterInfo_MatchType int32 const ( - EACLRecord_FilterInfo_MATCH_UNKNOWN EACLRecord_FilterInfo_MatchType = 0 - EACLRecord_FilterInfo_STRING_EQUAL EACLRecord_FilterInfo_MatchType = 1 + // Unspecified match type, default value. + EACLRecord_FilterInfo_MATCH_TYPE_UNSPECIFIED EACLRecord_FilterInfo_MatchType = 0 + // Return true if strings are equal + EACLRecord_FilterInfo_STRING_EQUAL EACLRecord_FilterInfo_MatchType = 1 + // Return true if strings are different EACLRecord_FilterInfo_STRING_NOT_EQUAL EACLRecord_FilterInfo_MatchType = 2 ) var EACLRecord_FilterInfo_MatchType_name = map[int32]string{ - 0: "MATCH_UNKNOWN", + 0: "MATCH_TYPE_UNSPECIFIED", 1: "STRING_EQUAL", 2: "STRING_NOT_EQUAL", } var EACLRecord_FilterInfo_MatchType_value = map[string]int32{ - "MATCH_UNKNOWN": 0, - "STRING_EQUAL": 1, - "STRING_NOT_EQUAL": 2, + "MATCH_TYPE_UNSPECIFIED": 0, + "STRING_EQUAL": 1, + "STRING_NOT_EQUAL": 2, } func (x EACLRecord_FilterInfo_MatchType) String() string { @@ -243,14 +260,14 @@ func (m *EACLRecord) GetOperation() EACLRecord_Operation { if m != nil { return m.Operation } - return EACLRecord_OPERATION_UNKNOWN + return EACLRecord_OPERATION_UNSPECIFIED } func (m *EACLRecord) GetAction() EACLRecord_Action { if m != nil { return m.Action } - return EACLRecord_ACTION_UNKNOWN + return EACLRecord_ACTION_UNSPECIFIED } func (m *EACLRecord) GetFilters() []*EACLRecord_FilterInfo { @@ -319,14 +336,14 @@ func (m *EACLRecord_FilterInfo) GetHeader() EACLRecord_FilterInfo_Header { if m != nil { return m.Header } - return EACLRecord_FilterInfo_HEADER_UNKNOWN + return EACLRecord_FilterInfo_HEADER_UNSPECIFIED } func (m *EACLRecord_FilterInfo) GetMatchType() EACLRecord_FilterInfo_MatchType { if m != nil { return m.MatchType } - return EACLRecord_FilterInfo_MATCH_UNKNOWN + return EACLRecord_FilterInfo_MATCH_TYPE_UNSPECIFIED } func (m *EACLRecord_FilterInfo) GetHeaderName() string { @@ -391,7 +408,7 @@ func (m *EACLRecord_TargetInfo) GetTarget() Target { if m != nil { return m.Target } - return Target_UNKNOWN + return Target_TARGET_UNSPECIFIED } func (m *EACLRecord_TargetInfo) GetKeyList() [][]byte { @@ -475,50 +492,51 @@ func init() { func init() { proto.RegisterFile("v2/acl/types.proto", fileDescriptor_d237ab7979f0d6cf) } var fileDescriptor_d237ab7979f0d6cf = []byte{ - // 683 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x54, 0xcd, 0x6e, 0xda, 0x40, - 0x10, 0x8e, 0x8d, 0x63, 0x60, 0x20, 0xd1, 0x66, 0xdb, 0x54, 0x24, 0x95, 0x10, 0xa2, 0x3d, 0xa0, - 0x46, 0x31, 0x2a, 0x51, 0xd5, 0x9e, 0x22, 0x39, 0xb0, 0x01, 0x12, 0x30, 0xc9, 0xda, 0x34, 0x4a, - 0x2f, 0xc8, 0x31, 0x4b, 0x82, 0x6a, 0x6c, 0x64, 0x3b, 0x48, 0xdc, 0xfa, 0x18, 0x7d, 0x86, 0x3e, - 0x49, 0x8f, 0xbd, 0xf6, 0x56, 0x25, 0x2f, 0x52, 0xad, 0x17, 0x82, 0x1b, 0x29, 0x6a, 0x4e, 0x3b, - 0xde, 0xf9, 0xbe, 0xf9, 0xf9, 0x66, 0xbc, 0x80, 0x67, 0xb5, 0xaa, 0xed, 0xb8, 0xd5, 0x68, 0x3e, - 0x65, 0xa1, 0x36, 0x0d, 0xfc, 0xc8, 0xc7, 0x1b, 0x1e, 0xf3, 0xb5, 0x51, 0xa8, 0xcd, 0x6a, 0x9a, - 0xed, 0xb8, 0xbb, 0x2f, 0x66, 0xb5, 0x6a, 0xc0, 0x46, 0x61, 0x12, 0x53, 0xbe, 0x57, 0x01, 0x88, - 0x5e, 0xef, 0x50, 0xe6, 0xf8, 0xc1, 0x10, 0xeb, 0x90, 0xf5, 0xa7, 0x2c, 0xb0, 0xa3, 0xb1, 0xef, - 0x15, 0xa4, 0x92, 0x54, 0xd9, 0xac, 0xbd, 0xd1, 0xfe, 0x09, 0xa3, 0xad, 0xd0, 0x5a, 0x6f, 0x09, - 0xa5, 0xd9, 0x07, 0x13, 0x7f, 0x02, 0xd5, 0x76, 0x62, 0xbe, 0x1c, 0xf3, 0x4b, 0x4f, 0xf3, 0xf5, - 0x18, 0x47, 0x55, 0x71, 0xe2, 0x43, 0x48, 0x8f, 0xc6, 0x6e, 0xc4, 0x82, 0xb0, 0x90, 0x2a, 0xa5, - 0x2a, 0xb9, 0xda, 0xdb, 0xa7, 0xa9, 0xc7, 0x31, 0xb0, 0xed, 0x8d, 0x7c, 0x9a, 0x16, 0x76, 0xc8, - 0xf9, 0x91, 0x1d, 0x5c, 0xb3, 0x28, 0x2c, 0x28, 0xff, 0xe3, 0x5b, 0x31, 0x50, 0xf0, 0x85, 0x1d, - 0xee, 0xfe, 0x96, 0x01, 0x56, 0x71, 0x71, 0x13, 0xd4, 0x1b, 0x66, 0x0f, 0x59, 0xb0, 0x10, 0x62, - 0xef, 0x39, 0xd5, 0x68, 0xad, 0x98, 0x42, 0x41, 0x9c, 0xd6, 0x7c, 0xca, 0x70, 0x17, 0x60, 0x62, - 0x47, 0xce, 0xcd, 0x80, 0x0b, 0xbf, 0x50, 0x45, 0x7b, 0x56, 0xb0, 0x2e, 0xa7, 0xf1, 0x18, 0x34, - 0xfb, 0x60, 0xe2, 0x1d, 0xc8, 0x89, 0xba, 0x06, 0x9e, 0x3d, 0x61, 0x85, 0x54, 0x49, 0xaa, 0x64, - 0xa9, 0x62, 0xd8, 0x13, 0xee, 0x82, 0x85, 0x6b, 0x66, 0xbb, 0x05, 0x25, 0xf6, 0xac, 0x7f, 0xb6, - 0xdd, 0x5b, 0x56, 0xfe, 0x00, 0xaa, 0x28, 0x09, 0x63, 0xd8, 0x6c, 0x11, 0xbd, 0x41, 0xe8, 0xa0, - 0x6f, 0x9c, 0x1a, 0xbd, 0x0b, 0x03, 0xad, 0xe1, 0x1c, 0xa4, 0x29, 0x39, 0xef, 0x13, 0xd3, 0x42, - 0x12, 0x06, 0x50, 0x7b, 0x47, 0x27, 0xa4, 0x6e, 0x21, 0xb9, 0x7c, 0x0c, 0x89, 0xcc, 0x5b, 0xb0, - 0xd1, 0xd5, 0xad, 0x7a, 0x2b, 0x41, 0x44, 0x90, 0x37, 0x2d, 0xda, 0x36, 0x9a, 0x03, 0x72, 0xde, - 0xd7, 0x3b, 0x48, 0xc2, 0x2f, 0x01, 0x2d, 0x6e, 0x8c, 0x9e, 0xb5, 0xb8, 0x95, 0x77, 0xcf, 0x01, - 0x56, 0x92, 0xe3, 0x3d, 0x50, 0xc5, 0xa4, 0x16, 0xd2, 0x6e, 0x3f, 0x52, 0x43, 0x40, 0xa9, 0x42, - 0x7d, 0x97, 0xe1, 0x57, 0x90, 0xf9, 0xca, 0xe6, 0x03, 0x77, 0x1c, 0x46, 0x05, 0xb9, 0x94, 0xaa, - 0xe4, 0xa9, 0x72, 0xca, 0xe6, 0x61, 0x79, 0x06, 0x89, 0xad, 0xdb, 0x86, 0xad, 0xde, 0x19, 0xa1, - 0xba, 0xd5, 0xee, 0x19, 0x89, 0xf2, 0xd2, 0x90, 0x6a, 0x12, 0xde, 0x53, 0x06, 0x14, 0xde, 0x34, - 0x92, 0xf9, 0xd5, 0x59, 0xdf, 0x42, 0x29, 0xde, 0x66, 0x83, 0x74, 0x88, 0x45, 0x90, 0xc2, 0x6d, - 0x93, 0xe8, 0xb4, 0xde, 0x42, 0xeb, 0x38, 0x0f, 0x99, 0x26, 0xb1, 0xa8, 0x6e, 0x34, 0x09, 0x52, - 0x79, 0x83, 0xcb, 0xaf, 0x96, 0x6e, 0xb6, 0x50, 0xba, 0xfc, 0x1e, 0x96, 0x0b, 0x8b, 0x61, 0x53, - 0xaf, 0x3f, 0xca, 0x98, 0x85, 0x75, 0xbd, 0xd3, 0xe9, 0x5d, 0x88, 0x9c, 0x0d, 0x62, 0x5c, 0x22, - 0xb9, 0xfc, 0x4d, 0x82, 0x2c, 0x9f, 0xb0, 0x65, 0x5f, 0xb9, 0x0c, 0x1f, 0x42, 0xde, 0xf1, 0xbd, - 0xc8, 0x1e, 0x7b, 0x2c, 0x18, 0x8c, 0x87, 0xb1, 0x06, 0xb9, 0xda, 0xeb, 0x84, 0x06, 0xfc, 0x37, - 0xd5, 0xea, 0x4b, 0x4c, 0xbb, 0x41, 0x73, 0x89, 0x0f, 0x7c, 0x00, 0xe9, 0x20, 0x5e, 0x95, 0x30, - 0xd6, 0x23, 0x57, 0xdb, 0x79, 0x72, 0x99, 0x68, 0x5a, 0x9c, 0xe1, 0xbb, 0x8f, 0xa0, 0x0a, 0x55, - 0xf9, 0xac, 0x57, 0xe5, 0x66, 0x40, 0xe9, 0x9b, 0x84, 0x8a, 0xa9, 0x9b, 0x97, 0xa6, 0x45, 0xba, - 0x48, 0x8e, 0x37, 0xc0, 0x6a, 0x11, 0x6a, 0xa2, 0xd4, 0xd1, 0xc9, 0xcf, 0xbb, 0xa2, 0xf4, 0xeb, - 0xae, 0x28, 0xfd, 0xb9, 0x2b, 0x4a, 0xdf, 0xef, 0x8b, 0x6b, 0x5f, 0x2a, 0xd7, 0xe3, 0xe8, 0xe6, - 0xf6, 0x4a, 0x73, 0xfc, 0x49, 0xd5, 0x0b, 0xa7, 0x8e, 0xb3, 0x3f, 0x64, 0xb3, 0xaa, 0xc7, 0xfc, - 0x51, 0xb8, 0x6f, 0x4f, 0xc7, 0xfb, 0xd7, 0x7e, 0x55, 0xbc, 0x46, 0x3f, 0xe4, 0x0d, 0x83, 0xf9, - 0xc7, 0xa6, 0xa6, 0x9f, 0xb5, 0x35, 0xdd, 0x71, 0xaf, 0xd4, 0xf8, 0xd1, 0x39, 0xf8, 0x1b, 0x00, - 0x00, 0xff, 0xff, 0x60, 0xb0, 0x68, 0x1a, 0xae, 0x04, 0x00, 0x00, + // 703 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x54, 0xd1, 0x6e, 0xda, 0x3c, + 0x18, 0x6d, 0x42, 0x1a, 0xe0, 0x83, 0xff, 0x97, 0xe5, 0xad, 0x88, 0x32, 0x09, 0x21, 0xb6, 0x0b, + 0xb4, 0xae, 0x41, 0xa2, 0x9a, 0xb4, 0x69, 0x52, 0xa5, 0x14, 0x5c, 0x60, 0x83, 0x00, 0x8e, 0xd9, + 0xd4, 0xdd, 0xa0, 0x34, 0x98, 0x16, 0x2d, 0x24, 0x28, 0x49, 0x91, 0xd8, 0xd5, 0x1e, 0x63, 0xcf, + 0xb0, 0x27, 0xd9, 0xe5, 0x1e, 0x61, 0xea, 0xa4, 0x3d, 0xc3, 0x2e, 0x27, 0x27, 0xd0, 0x32, 0xb4, + 0x6a, 0xbd, 0xf2, 0x17, 0xfb, 0x9c, 0xcf, 0xc7, 0xc7, 0x27, 0x06, 0xbc, 0xa8, 0x55, 0x2d, 0xdb, + 0xa9, 0x86, 0xcb, 0x39, 0x0f, 0xb4, 0xb9, 0xef, 0x85, 0x1e, 0xfe, 0xcf, 0xe5, 0x9e, 0x36, 0x09, + 0xb4, 0x45, 0x4d, 0xb3, 0x6c, 0xa7, 0xf0, 0x60, 0x51, 0xab, 0xfa, 0x7c, 0x12, 0x6c, 0x62, 0xca, + 0xbf, 0x54, 0x00, 0xa2, 0xd7, 0x3b, 0x94, 0xdb, 0x9e, 0x3f, 0xc6, 0x3a, 0xa4, 0xbd, 0x39, 0xf7, + 0xad, 0x70, 0xea, 0xb9, 0x79, 0xa9, 0x24, 0x55, 0xfe, 0xaf, 0x3d, 0xd6, 0xfe, 0x68, 0xa3, 0xdd, + 0xa2, 0xb5, 0xde, 0x1a, 0x4a, 0xd3, 0x37, 0x25, 0x7e, 0x01, 0xaa, 0x65, 0x47, 0x7c, 0x39, 0xe2, + 0x97, 0xee, 0xe6, 0xeb, 0x11, 0x8e, 0xaa, 0xf1, 0x88, 0x8f, 0x21, 0x39, 0x99, 0x3a, 0x21, 0xf7, + 0x83, 0x7c, 0xa2, 0x94, 0xa8, 0x64, 0x6a, 0x4f, 0xee, 0xa6, 0x9e, 0x46, 0xc0, 0xb6, 0x3b, 0xf1, + 0x68, 0x32, 0xae, 0x03, 0xc1, 0x0f, 0x2d, 0xff, 0x82, 0x87, 0x41, 0x5e, 0xf9, 0x17, 0x9f, 0x45, + 0xc0, 0x98, 0x1f, 0xd7, 0x41, 0xe1, 0xa7, 0x0c, 0x70, 0xdb, 0x17, 0x37, 0x41, 0xbd, 0xe4, 0xd6, + 0x98, 0xfb, 0x2b, 0x23, 0x0e, 0xee, 0xa3, 0x46, 0x6b, 0x45, 0x14, 0x0a, 0xf1, 0xc8, 0x96, 0x73, + 0x8e, 0xbb, 0x00, 0x33, 0x2b, 0xb4, 0x2f, 0x47, 0xc2, 0xf8, 0x95, 0x2b, 0xda, 0xbd, 0x9a, 0x75, + 0x05, 0x4d, 0xf4, 0xa0, 0xe9, 0x9b, 0x12, 0xef, 0x43, 0x26, 0xd6, 0x35, 0x72, 0xad, 0x19, 0xcf, + 0x27, 0x4a, 0x52, 0x25, 0x4d, 0x15, 0xc3, 0x9a, 0x89, 0x25, 0x58, 0x2d, 0x2d, 0x2c, 0x27, 0xaf, + 0x44, 0x2b, 0xbb, 0x6f, 0x2d, 0xe7, 0x8a, 0x97, 0x5f, 0x82, 0x1a, 0x4b, 0xc2, 0x39, 0xc0, 0x2d, + 0xa2, 0x37, 0x08, 0x1d, 0x0d, 0x0d, 0xb3, 0x4f, 0xea, 0xed, 0xd3, 0x36, 0x69, 0xa0, 0x1d, 0x9c, + 0x81, 0x24, 0x25, 0x83, 0x21, 0x31, 0x19, 0x92, 0x30, 0x80, 0xda, 0x3b, 0x79, 0x4d, 0xea, 0x0c, + 0xc9, 0xe5, 0x1e, 0x6c, 0xec, 0x5e, 0x80, 0x5c, 0x57, 0x67, 0xf5, 0xd6, 0x88, 0x9d, 0xf5, 0xc9, + 0x56, 0x07, 0x04, 0x59, 0x93, 0xd1, 0xb6, 0xd1, 0x1c, 0x91, 0xc1, 0x50, 0xef, 0x20, 0x09, 0x3f, + 0x04, 0xb4, 0x9a, 0x31, 0x7a, 0x6c, 0x35, 0x2b, 0x17, 0x06, 0x00, 0xb7, 0xfe, 0xe3, 0x03, 0x50, + 0xe3, 0x6b, 0x5b, 0xf9, 0xbc, 0xb7, 0x65, 0x4d, 0x0c, 0xa5, 0x0a, 0xf5, 0x1c, 0x8e, 0x73, 0x90, + 0xfa, 0xc0, 0x97, 0x23, 0x67, 0x1a, 0x84, 0x79, 0xb9, 0x94, 0xa8, 0x64, 0xa9, 0xf2, 0x86, 0x2f, + 0x83, 0xf2, 0x47, 0xd8, 0x88, 0xe0, 0x3e, 0xec, 0xf5, 0xfa, 0x84, 0xea, 0xac, 0xdd, 0x33, 0xb6, + 0x24, 0x26, 0x21, 0xd1, 0x24, 0xe2, 0x80, 0x29, 0x50, 0x84, 0x0b, 0x48, 0x16, 0x53, 0xfd, 0x21, + 0x43, 0x09, 0x71, 0xe6, 0x06, 0xe9, 0x10, 0x46, 0x90, 0x22, 0x6a, 0x93, 0xe8, 0xb4, 0xde, 0x42, + 0xbb, 0x38, 0x0b, 0xa9, 0x26, 0x61, 0x54, 0x37, 0x9a, 0x04, 0xa9, 0xe2, 0x90, 0xeb, 0xaf, 0x96, + 0x6e, 0xb6, 0x50, 0xb2, 0xfc, 0x1c, 0xd6, 0x09, 0xce, 0x01, 0xd6, 0xeb, 0x7f, 0xd9, 0x35, 0x0d, + 0xbb, 0x7a, 0xa7, 0xd3, 0x7b, 0x17, 0xef, 0xdb, 0x20, 0xc6, 0x19, 0x92, 0xcb, 0x9f, 0x24, 0x48, + 0x8b, 0x6b, 0x67, 0xd6, 0xb9, 0xc3, 0xf1, 0x31, 0x64, 0x6d, 0xcf, 0x0d, 0xad, 0xa9, 0xcb, 0xfd, + 0xd1, 0x74, 0x1c, 0x79, 0x91, 0xa9, 0x3d, 0xda, 0xf0, 0x42, 0xfc, 0xbb, 0x5a, 0x7d, 0x8d, 0x69, + 0x37, 0x68, 0x66, 0xe3, 0x03, 0x1f, 0x41, 0xd2, 0x8f, 0xf2, 0x13, 0x44, 0xbe, 0x64, 0x6a, 0xfb, + 0x77, 0x26, 0x8c, 0x26, 0xe3, 0x31, 0x78, 0x7a, 0x02, 0x6a, 0xec, 0xae, 0x50, 0xce, 0x74, 0xda, + 0x24, 0x6c, 0x4b, 0x79, 0x0a, 0x94, 0xa1, 0x49, 0x68, 0x9c, 0x08, 0xf3, 0xcc, 0x64, 0xa4, 0x8b, + 0xe4, 0x28, 0x1d, 0xac, 0x45, 0xa8, 0x89, 0x12, 0x27, 0x83, 0xaf, 0xd7, 0x45, 0xe9, 0xdb, 0x75, + 0x51, 0xfa, 0x7e, 0x5d, 0x94, 0x3e, 0xff, 0x28, 0xee, 0xbc, 0x7f, 0x76, 0x31, 0x0d, 0x2f, 0xaf, + 0xce, 0x35, 0xdb, 0x9b, 0x55, 0xdd, 0x60, 0x6e, 0xdb, 0x87, 0x63, 0xbe, 0xa8, 0xba, 0xdc, 0x9b, + 0x04, 0x87, 0xd6, 0x7c, 0x7a, 0x78, 0xe1, 0x55, 0xe3, 0xd7, 0xea, 0x95, 0x65, 0x3b, 0x5f, 0x64, + 0x64, 0x70, 0xef, 0xd4, 0xd4, 0xf4, 0x7e, 0x5b, 0x48, 0xd5, 0x6d, 0xe7, 0x5c, 0x8d, 0xde, 0xa6, + 0xa3, 0xdf, 0x01, 0x00, 0x00, 0xff, 0xff, 0xaa, 0x0d, 0x90, 0x3a, 0xd5, 0x04, 0x00, 0x00, } func (m *EACLRecord) Marshal() (dAtA []byte, err error) { diff --git a/v2/container/service.pb.go b/v2/container/service.pb.go index 2c7861d..50a9347 100644 --- a/v2/container/service.pb.go +++ b/v2/container/service.pb.go @@ -29,6 +29,7 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +// New NeoFS Container creation request type PutRequest struct { // Body of container put request message. Body *PutRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` @@ -98,6 +99,7 @@ func (m *PutRequest) GetVerifyHeader() *service.RequestVerificationHeader { return nil } +// Request body type PutRequest_Body struct { // Container to create in NeoFS. Container *Container `protobuf:"bytes,1,opt,name=container,proto3" json:"container,omitempty"` @@ -165,6 +167,7 @@ func (m *PutRequest_Body) GetSignature() []byte { return nil } +// New NeoFS Container creation response type PutResponse struct { // Body of container put response message. Body *PutResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` @@ -234,6 +237,7 @@ func (m *PutResponse) GetVerifyHeader() *service.ResponseVerificationHeader { return nil } +// Response body type PutResponse_Body struct { // container_id carries identifier of the new container. ContainerId *refs.ContainerID `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` @@ -282,6 +286,7 @@ func (m *PutResponse_Body) GetContainerId() *refs.ContainerID { return nil } +// Container removal request type DeleteRequest struct { // Body of container delete request message. Body *DeleteRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` @@ -351,6 +356,7 @@ func (m *DeleteRequest) GetVerifyHeader() *service.RequestVerificationHeader { return nil } +// Request body type DeleteRequest_Body struct { // container_id carries identifier of the container to delete // from NeoFS. @@ -480,6 +486,7 @@ func (m *DeleteResponse) GetVerifyHeader() *service.ResponseVerificationHeader { return nil } +// Response body type DeleteResponse_Body struct { XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -519,6 +526,7 @@ func (m *DeleteResponse_Body) XXX_DiscardUnknown() { var xxx_messageInfo_DeleteResponse_Body proto.InternalMessageInfo +// Get container structure type GetRequest struct { // Body of container get request message. Body *GetRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` @@ -588,6 +596,7 @@ func (m *GetRequest) GetVerifyHeader() *service.RequestVerificationHeader { return nil } +// Request body type GetRequest_Body struct { // container_id carries identifier of the container to get. ContainerId *refs.ContainerID `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` @@ -636,6 +645,7 @@ func (m *GetRequest_Body) GetContainerId() *refs.ContainerID { return nil } +// Get container structure type GetResponse struct { // Body of container get response message. Body *GetResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` @@ -705,6 +715,7 @@ func (m *GetResponse) GetVerifyHeader() *service.ResponseVerificationHeader { return nil } +// Response body type GetResponse_Body struct { // Container that has been requested. Container *Container `protobuf:"bytes,1,opt,name=container,proto3" json:"container,omitempty"` @@ -753,6 +764,7 @@ func (m *GetResponse_Body) GetContainer() *Container { return nil } +// List containers type ListRequest struct { // Body of list containers request message. Body *ListRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` @@ -822,6 +834,7 @@ func (m *ListRequest) GetVerifyHeader() *service.RequestVerificationHeader { return nil } +// Request body type ListRequest_Body struct { // owner_id carries identifier of the container owner. OwnerId *refs.OwnerID `protobuf:"bytes,1,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"` @@ -870,6 +883,7 @@ func (m *ListRequest_Body) GetOwnerId() *refs.OwnerID { return nil } +// List containers type ListResponse struct { // Body of list containers response message. Body *ListResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` @@ -939,6 +953,7 @@ func (m *ListResponse) GetVerifyHeader() *service.ResponseVerificationHeader { return nil } +// Response body type ListResponse_Body struct { // ContainerIDs carries list of identifiers of the containers that belong to the owner. ContainerIds []*refs.ContainerID `protobuf:"bytes,1,rep,name=container_ids,json=containerIds,proto3" json:"container_ids,omitempty"` @@ -987,6 +1002,7 @@ func (m *ListResponse_Body) GetContainerIds() []*refs.ContainerID { return nil } +// Set Extended ACL type SetExtendedACLRequest struct { // Body of set extended acl request message. Body *SetExtendedACLRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` @@ -1056,6 +1072,7 @@ func (m *SetExtendedACLRequest) GetVerifyHeader() *service.RequestVerificationHe return nil } +// Request body type SetExtendedACLRequest_Body struct { // Extended ACL to set for the container. Eacl *acl.EACLTable `protobuf:"bytes,1,opt,name=eacl,proto3" json:"eacl,omitempty"` @@ -1113,6 +1130,7 @@ func (m *SetExtendedACLRequest_Body) GetSignature() []byte { return nil } +// Set Extended ACL type SetExtendedACLResponse struct { // Body of set extended acl response message. Body *SetExtendedACLResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` @@ -1182,6 +1200,7 @@ func (m *SetExtendedACLResponse) GetVerifyHeader() *service.ResponseVerification return nil } +// Response body type SetExtendedACLResponse_Body struct { XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -1221,6 +1240,7 @@ func (m *SetExtendedACLResponse_Body) XXX_DiscardUnknown() { var xxx_messageInfo_SetExtendedACLResponse_Body proto.InternalMessageInfo +// Get Extended ACL type GetExtendedACLRequest struct { // Body of get extended acl request message. Body *GetExtendedACLRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` @@ -1290,6 +1310,7 @@ func (m *GetExtendedACLRequest) GetVerifyHeader() *service.RequestVerificationHe return nil } +// Request body type GetExtendedACLRequest_Body struct { // container_id carries identifier of the container that has Extended ACL. ContainerId *refs.ContainerID `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` @@ -1338,6 +1359,7 @@ func (m *GetExtendedACLRequest_Body) GetContainerId() *refs.ContainerID { return nil } +// Get Extended ACL type GetExtendedACLResponse struct { // Body of get extended acl response message. Body *GetExtendedACLResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` @@ -1407,6 +1429,7 @@ func (m *GetExtendedACLResponse) GetVerifyHeader() *service.ResponseVerification return nil } +// Response body type GetExtendedACLResponse_Body struct { // Extended ACL that has been requested if it was set up. Eacl *acl.EACLTable `protobuf:"bytes,1,opt,name=eacl,proto3" json:"eacl,omitempty"` @@ -1494,59 +1517,60 @@ func init() { func init() { proto.RegisterFile("v2/container/service.proto", fileDescriptor_6e23291a5a71033a) } var fileDescriptor_6e23291a5a71033a = []byte{ - // 823 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x98, 0xc1, 0x52, 0xd3, 0x5c, - 0x14, 0xc7, 0xbf, 0x84, 0x0e, 0x7c, 0x9c, 0x16, 0x16, 0x97, 0x01, 0x3a, 0x51, 0x6b, 0x8d, 0xa2, - 0x8c, 0xd2, 0xc4, 0x89, 0x1b, 0x45, 0xc6, 0x11, 0x5a, 0x08, 0x1d, 0x50, 0x21, 0x38, 0x2c, 0xdc, - 0x30, 0x69, 0x72, 0x0a, 0x19, 0x4b, 0x52, 0x9b, 0x34, 0xd8, 0xa5, 0xbe, 0x82, 0x1b, 0x57, 0xae, - 0x1d, 0xc6, 0x85, 0x4f, 0xe0, 0xda, 0x71, 0x1c, 0xc7, 0x47, 0x70, 0xd0, 0x27, 0xf0, 0x09, 0x9c, - 0x26, 0x69, 0x93, 0x60, 0x4a, 0x5a, 0xa6, 0x2e, 0xb2, 0x6b, 0x6f, 0xce, 0x39, 0xf7, 0x9c, 0xdf, - 0xfc, 0xcf, 0x3d, 0x37, 0x01, 0xc6, 0x16, 0x78, 0xc5, 0xd0, 0x2d, 0x59, 0xd3, 0xb1, 0xc1, 0x9b, - 0xd8, 0xb0, 0x35, 0x05, 0xb9, 0x7a, 0xc3, 0xb0, 0x0c, 0x32, 0xa5, 0xa3, 0xc1, 0x55, 0x4d, 0xce, - 0x16, 0xb8, 0xae, 0x09, 0x43, 0x6c, 0x81, 0x97, 0x95, 0x1a, 0x6f, 0xb5, 0xea, 0x68, 0xba, 0x86, - 0x4c, 0x36, 0x14, 0x24, 0xf8, 0x64, 0xca, 0x16, 0xf8, 0x06, 0x56, 0xcd, 0xd0, 0xe2, 0xb4, 0x2d, - 0x74, 0x76, 0xe2, 0x0f, 0xd1, 0x92, 0xbd, 0xe5, 0xd9, 0xc0, 0xb2, 0x8d, 0x0d, 0xad, 0xda, 0x72, - 0x1f, 0xb0, 0xbf, 0x68, 0x80, 0xad, 0xa6, 0x25, 0xe1, 0x8b, 0x26, 0x9a, 0x16, 0xb9, 0x0b, 0xa9, - 0x8a, 0xa1, 0xb6, 0xb2, 0x54, 0x9e, 0x9a, 0x4f, 0x0b, 0xd7, 0xb8, 0x88, 0x2c, 0x39, 0xdf, 0x9c, - 0x5b, 0x31, 0xd4, 0x96, 0xe4, 0x78, 0x90, 0x55, 0x48, 0xb7, 0xf7, 0xdb, 0x3b, 0x40, 0x59, 0xc5, - 0x46, 0x96, 0xfe, 0x2b, 0x40, 0xa7, 0x7e, 0xcf, 0xf7, 0x11, 0x5a, 0xf2, 0xba, 0x63, 0x2b, 0xc1, - 0x61, 0xf7, 0x37, 0xd9, 0x86, 0x09, 0x37, 0xbf, 0x4e, 0xa0, 0x11, 0x27, 0xd0, 0x42, 0xef, 0x40, - 0xbb, 0x6d, 0x73, 0x4d, 0x91, 0x2d, 0xcd, 0xd0, 0xbd, 0x80, 0x19, 0x37, 0x84, 0xfb, 0x8f, 0x79, - 0x45, 0x41, 0xaa, 0x9d, 0x28, 0x59, 0x82, 0xf1, 0x6e, 0x15, 0x5e, 0x85, 0xb9, 0xc8, 0x0a, 0x8b, - 0x9d, 0x5f, 0x92, 0xef, 0x40, 0x2e, 0x01, 0xd4, 0x9b, 0x95, 0x9a, 0xa6, 0xec, 0x3d, 0xc7, 0x96, - 0x53, 0x5f, 0x46, 0x1a, 0x77, 0x57, 0x36, 0xb0, 0x45, 0x2e, 0xc2, 0xb8, 0xa9, 0xed, 0xeb, 0xb2, - 0xd5, 0x6c, 0xa0, 0x93, 0x74, 0x46, 0xf2, 0x17, 0xd8, 0x0f, 0x34, 0xa4, 0x1d, 0x6e, 0x66, 0xdd, - 0xd0, 0x4d, 0x24, 0xf7, 0x42, 0x9c, 0xe7, 0x7a, 0x73, 0x76, 0xed, 0x83, 0xa0, 0xd7, 0xa2, 0x40, - 0xcf, 0x45, 0xf2, 0x71, 0x9d, 0x7b, 0x90, 0x96, 0xa2, 0x49, 0x17, 0xce, 0x88, 0x14, 0x8b, 0x7a, - 0xcd, 0x23, 0xfd, 0x00, 0x32, 0xdd, 0x3a, 0xf6, 0x34, 0xd5, 0x2b, 0xf3, 0x42, 0x20, 0x74, 0x5b, - 0xb8, 0x3e, 0xe7, 0x72, 0x49, 0x4a, 0x77, 0x1d, 0xca, 0x2a, 0xfb, 0x95, 0x86, 0x89, 0x12, 0xd6, - 0xd0, 0xc2, 0x8e, 0x30, 0xef, 0x87, 0x80, 0xdd, 0x88, 0x04, 0x16, 0xf2, 0x48, 0x86, 0x36, 0xd5, - 0xe1, 0x00, 0x0b, 0xab, 0x8f, 0x3e, 0xad, 0xbe, 0xdf, 0x14, 0x4c, 0x76, 0xe0, 0x78, 0x02, 0x5c, - 0x0a, 0xf1, 0x9c, 0x3f, 0x93, 0x67, 0xb2, 0x34, 0x38, 0xea, 0x22, 0x65, 0xdf, 0xd3, 0x00, 0x22, - 0x0e, 0x74, 0xb2, 0xf9, 0xe6, 0xc9, 0x50, 0xcf, 0xb0, 0xda, 0xed, 0x98, 0x86, 0xb4, 0x53, 0xfb, - 0x00, 0xa7, 0x53, 0xc0, 0x3e, 0x29, 0xca, 0x28, 0x0d, 0x63, 0x0e, 0xb0, 0xef, 0x68, 0x48, 0x6f, - 0x6a, 0x66, 0x57, 0x58, 0xfd, 0xc0, 0x0a, 0xd8, 0x27, 0x43, 0x59, 0x8b, 0x1e, 0x2a, 0x01, 0xfe, - 0x37, 0x8e, 0x42, 0xaa, 0x9a, 0x3d, 0xad, 0xaa, 0x27, 0x47, 0xae, 0xa2, 0xc6, 0x1c, 0xc3, 0xb2, - 0xca, 0x7e, 0xa4, 0x21, 0xe3, 0x16, 0xec, 0xc9, 0x69, 0x31, 0x44, 0xe8, 0xfa, 0x19, 0x84, 0x92, - 0xa5, 0xa7, 0x75, 0x0f, 0xd2, 0x43, 0x98, 0x08, 0xb6, 0x9f, 0x99, 0xa5, 0xf2, 0x23, 0x71, 0xfd, - 0x97, 0x09, 0xf4, 0x9f, 0xc9, 0x7e, 0xa1, 0x61, 0x7a, 0x07, 0xad, 0xd5, 0x97, 0x16, 0xea, 0x2a, - 0xaa, 0xcb, 0xc5, 0xcd, 0x8e, 0xba, 0x8a, 0x21, 0x76, 0x7c, 0x24, 0xbb, 0x48, 0xcf, 0x64, 0xe8, - 0x4c, 0xf2, 0x10, 0x2e, 0x40, 0x0a, 0x65, 0xa5, 0xe6, 0x95, 0x99, 0x0d, 0x44, 0x94, 0x95, 0x1a, - 0xb7, 0xba, 0x5c, 0xdc, 0x7c, 0x2a, 0x57, 0x6a, 0x28, 0x39, 0x56, 0x31, 0xd3, 0xee, 0x35, 0x0d, - 0x33, 0xa7, 0x91, 0x78, 0x4a, 0x2c, 0x85, 0x68, 0xde, 0xee, 0x8b, 0x66, 0x32, 0xa7, 0xdf, 0x27, - 0x1a, 0xa6, 0xc5, 0x73, 0x2b, 0x4a, 0x4c, 0xae, 0xa2, 0x86, 0x35, 0x13, 0xbf, 0xd1, 0x30, 0x23, - 0x9e, 0x5f, 0x45, 0x62, 0xa2, 0x55, 0xf4, 0x0f, 0xda, 0x52, 0x78, 0x93, 0x82, 0xb1, 0x1d, 0x37, - 0x11, 0xb2, 0x0e, 0x23, 0x5b, 0x4d, 0x8b, 0x5c, 0x8e, 0x79, 0xbf, 0x64, 0xf2, 0x71, 0x2f, 0x46, - 0x64, 0x1b, 0x46, 0xdd, 0x6b, 0x2a, 0x61, 0xe3, 0xdf, 0x09, 0x98, 0xab, 0x7d, 0xdc, 0x73, 0xdb, - 0xc9, 0x89, 0xd8, 0x2b, 0x39, 0xff, 0x8a, 0xd8, 0x23, 0xb9, 0xe0, 0x3d, 0x6a, 0x03, 0x52, 0xed, - 0xb9, 0x46, 0xf2, 0x71, 0x97, 0x02, 0xe6, 0x4a, 0xec, 0x50, 0x24, 0x1a, 0x4c, 0x86, 0x8f, 0x26, - 0x72, 0xb3, 0xff, 0x69, 0xc0, 0xdc, 0x1a, 0xe0, 0xac, 0x6b, 0x6f, 0x25, 0xf6, 0xb3, 0x95, 0x38, - 0xc0, 0x56, 0xd1, 0x0d, 0xb1, 0xb2, 0xfb, 0xf9, 0x24, 0x47, 0x7d, 0x3f, 0xc9, 0x51, 0x3f, 0x4e, - 0x72, 0xd4, 0xdb, 0x9f, 0xb9, 0xff, 0x9e, 0x71, 0xfb, 0x9a, 0x75, 0xd0, 0xac, 0x70, 0x8a, 0x71, - 0xc8, 0xeb, 0x66, 0x5d, 0x51, 0x0a, 0x2a, 0xda, 0xbc, 0x8e, 0x46, 0xd5, 0x2c, 0xc8, 0x75, 0xad, - 0xb0, 0x6f, 0xf0, 0xc1, 0x4f, 0x22, 0xc7, 0xf4, 0xd4, 0x63, 0x34, 0xd6, 0x76, 0xb8, 0xe5, 0xad, - 0xb2, 0xdf, 0xcd, 0x95, 0x51, 0xe7, 0xf3, 0xc6, 0x9d, 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xbb, - 0x23, 0x10, 0x87, 0x84, 0x11, 0x00, 0x00, + // 833 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x98, 0xcd, 0x6e, 0xd3, 0x58, + 0x14, 0xc7, 0xc7, 0x6e, 0xd4, 0x99, 0x9e, 0xa4, 0xd5, 0xe8, 0x56, 0x6d, 0x23, 0xcf, 0x4c, 0x26, + 0xe3, 0x99, 0x0e, 0x15, 0x34, 0x36, 0x32, 0x9b, 0xd2, 0x56, 0x88, 0x36, 0x69, 0xdd, 0xa8, 0x05, + 0x5a, 0x17, 0xb1, 0x60, 0x53, 0x39, 0xf6, 0x49, 0x6b, 0x91, 0xda, 0x21, 0x76, 0x5c, 0xb2, 0x84, + 0xa7, 0x60, 0x81, 0x58, 0xa3, 0x8a, 0x05, 0x4f, 0xc0, 0x1a, 0x21, 0x84, 0x78, 0x04, 0x54, 0x78, + 0x02, 0x9e, 0x00, 0xf9, 0x23, 0x8e, 0x5d, 0x9c, 0x3a, 0xa9, 0xc2, 0xc2, 0x3b, 0xe7, 0xe6, 0x9c, + 0x73, 0xcf, 0xf9, 0xe9, 0x7f, 0xee, 0xb9, 0x36, 0x30, 0xb6, 0xc0, 0x2b, 0x86, 0x6e, 0xc9, 0x9a, + 0x8e, 0x2d, 0xde, 0xc4, 0x96, 0xad, 0x29, 0xc8, 0x35, 0x5b, 0x86, 0x65, 0x90, 0x69, 0x1d, 0x0d, + 0xae, 0x6e, 0x72, 0xb6, 0xc0, 0x05, 0x26, 0x0c, 0xb1, 0x05, 0x5e, 0x56, 0x1a, 0xbc, 0xd5, 0x69, + 0xa2, 0xe9, 0x19, 0x32, 0xf9, 0x48, 0x90, 0xf0, 0x3f, 0xd3, 0xb6, 0xc0, 0xb7, 0xb0, 0x6e, 0x46, + 0x16, 0x67, 0x6c, 0xa1, 0xbb, 0x13, 0x7f, 0x8c, 0x96, 0xec, 0x2f, 0xcf, 0x85, 0x96, 0x6d, 0x6c, + 0x69, 0xf5, 0x8e, 0xf7, 0x07, 0xfb, 0x95, 0x06, 0xd8, 0x6d, 0x5b, 0x12, 0x3e, 0x6e, 0xa3, 0x69, + 0x91, 0x25, 0xc8, 0xd4, 0x0c, 0xb5, 0x93, 0xa7, 0x8a, 0xd4, 0x42, 0x56, 0xf8, 0x8f, 0x8b, 0xc9, + 0x92, 0xeb, 0x99, 0x73, 0xeb, 0x86, 0xda, 0x91, 0x5c, 0x0f, 0xb2, 0x01, 0x59, 0x67, 0xbf, 0x83, + 0x23, 0x94, 0x55, 0x6c, 0xe5, 0xe9, 0x1f, 0x02, 0x74, 0xeb, 0xf7, 0x7d, 0xef, 0xa0, 0x25, 0x6f, + 0xb9, 0xb6, 0x12, 0x1c, 0x07, 0xcf, 0x64, 0x0f, 0x26, 0xbd, 0xfc, 0xba, 0x81, 0xc6, 0xdc, 0x40, + 0x8b, 0xfd, 0x03, 0x3d, 0x70, 0xcc, 0x35, 0x45, 0xb6, 0x34, 0x43, 0xf7, 0x03, 0xe6, 0xbc, 0x10, + 0xde, 0x2f, 0xe6, 0x29, 0x05, 0x19, 0x27, 0x51, 0xb2, 0x0a, 0x13, 0x41, 0x15, 0x7e, 0x85, 0x85, + 0xd8, 0x0a, 0xcb, 0xdd, 0x27, 0xa9, 0xe7, 0x40, 0xfe, 0x02, 0x68, 0xb6, 0x6b, 0x0d, 0x4d, 0x39, + 0x78, 0x84, 0x1d, 0xb7, 0xbe, 0x9c, 0x34, 0xe1, 0xad, 0x6c, 0x63, 0x87, 0xfc, 0x09, 0x13, 0xa6, + 0x76, 0xa8, 0xcb, 0x56, 0xbb, 0x85, 0x6e, 0xd2, 0x39, 0xa9, 0xb7, 0xc0, 0xbe, 0xa6, 0x21, 0xeb, + 0x72, 0x33, 0x9b, 0x86, 0x6e, 0x22, 0xb9, 0x19, 0xe1, 0x3c, 0xdf, 0x9f, 0xb3, 0x67, 0x1f, 0x06, + 0xbd, 0x19, 0x07, 0x7a, 0x3e, 0x96, 0x8f, 0xe7, 0xdc, 0x87, 0xb4, 0x14, 0x4f, 0xba, 0x74, 0x41, + 0xa4, 0x44, 0xd4, 0x9b, 0x3e, 0xe9, 0x5b, 0x90, 0x0b, 0xea, 0x38, 0xd0, 0x54, 0xbf, 0xcc, 0x3f, + 0x42, 0xa1, 0x1d, 0xe1, 0xf6, 0x38, 0x57, 0x2b, 0x52, 0x36, 0x70, 0xa8, 0xaa, 0xec, 0x07, 0x1a, + 0x26, 0x2b, 0xd8, 0x40, 0x0b, 0xbb, 0xc2, 0x5c, 0x89, 0x00, 0xbb, 0x12, 0x0b, 0x2c, 0xe2, 0x91, + 0x0e, 0x6d, 0xaa, 0xa3, 0x01, 0x16, 0x55, 0x1f, 0x7d, 0x5e, 0x7d, 0xdf, 0x28, 0x98, 0xea, 0xc2, + 0xf1, 0x05, 0xb8, 0x1a, 0xe1, 0xb9, 0x70, 0x21, 0xcf, 0x74, 0x69, 0x70, 0xdc, 0x43, 0xca, 0xbe, + 0xa2, 0x01, 0x44, 0x1c, 0xea, 0x64, 0xeb, 0x99, 0xa7, 0x43, 0x3d, 0xa3, 0x6a, 0xb7, 0x53, 0x1a, + 0xb2, 0x6e, 0xed, 0x43, 0x9c, 0x4e, 0x21, 0xfb, 0xb4, 0x28, 0xa3, 0x32, 0x8a, 0x39, 0xc0, 0xbe, + 0xa4, 0x21, 0xbb, 0xa3, 0x99, 0x81, 0xb0, 0x06, 0x81, 0x15, 0xb2, 0x4f, 0x87, 0xb2, 0x96, 0x7d, + 0x54, 0x02, 0xfc, 0x66, 0x9c, 0x44, 0x54, 0x35, 0x77, 0x5e, 0x55, 0xf7, 0x4e, 0x3c, 0x45, 0xfd, + 0xea, 0x1a, 0x56, 0x55, 0xf6, 0x0d, 0x0d, 0x39, 0xaf, 0x60, 0x5f, 0x4e, 0xcb, 0x11, 0x42, 0xff, + 0x5f, 0x40, 0x28, 0x5d, 0x7a, 0xda, 0xf2, 0x21, 0xdd, 0x86, 0xc9, 0x70, 0xfb, 0x99, 0x79, 0xaa, + 0x38, 0x96, 0xd4, 0x7f, 0xb9, 0x50, 0xff, 0x99, 0xec, 0x7b, 0x1a, 0x66, 0xf6, 0xd1, 0xda, 0x78, + 0x62, 0xa1, 0xae, 0xa2, 0xba, 0x56, 0xde, 0xe9, 0xaa, 0xab, 0x1c, 0x61, 0xc7, 0xc7, 0xb2, 0x8b, + 0xf5, 0x4c, 0x87, 0xce, 0x24, 0x1f, 0xe1, 0x22, 0x64, 0x50, 0x56, 0x1a, 0x7e, 0x99, 0xf9, 0x50, + 0x44, 0x59, 0x69, 0x70, 0x1b, 0x6b, 0xe5, 0x9d, 0xfb, 0x72, 0xad, 0x81, 0x92, 0x6b, 0x95, 0x30, + 0xed, 0x9e, 0xd1, 0x30, 0x7b, 0x1e, 0x89, 0xaf, 0xc4, 0x4a, 0x84, 0xe6, 0xf5, 0x81, 0x68, 0xa6, + 0x73, 0xfa, 0xbd, 0xa5, 0x61, 0x46, 0xbc, 0xb4, 0xa2, 0xc4, 0xf4, 0x2a, 0x6a, 0x54, 0x33, 0xf1, + 0x23, 0x0d, 0xb3, 0xe2, 0xe5, 0x55, 0x24, 0xa6, 0x5a, 0x45, 0x3f, 0xa1, 0x2d, 0x85, 0x17, 0x19, + 0xf8, 0x3d, 0xa0, 0xbd, 0xef, 0x65, 0x44, 0xb6, 0x60, 0x6c, 0xb7, 0x6d, 0x91, 0xbf, 0x13, 0x5e, + 0x34, 0x99, 0x62, 0xd2, 0x1b, 0x12, 0xd9, 0x83, 0x71, 0xef, 0xbe, 0x4a, 0xd8, 0xe4, 0x97, 0x03, + 0xe6, 0xdf, 0x01, 0x2e, 0xbc, 0x4e, 0x72, 0x22, 0xf6, 0x4b, 0xae, 0x77, 0x57, 0xec, 0x93, 0x5c, + 0xf8, 0x42, 0xb5, 0x0d, 0x19, 0x67, 0xc0, 0x91, 0x62, 0xd2, 0xed, 0x80, 0xf9, 0x27, 0x71, 0x3a, + 0x12, 0x0d, 0xa6, 0xa2, 0x67, 0x14, 0xb9, 0x3a, 0xf8, 0x58, 0x60, 0xae, 0x0d, 0x71, 0xe8, 0x39, + 0x5b, 0x89, 0x83, 0x6c, 0x25, 0x0e, 0xb1, 0x55, 0x7c, 0x67, 0xac, 0x2b, 0xef, 0xce, 0x0a, 0xd4, + 0xa7, 0xb3, 0x02, 0xf5, 0xf9, 0xac, 0x40, 0x3d, 0xff, 0x52, 0xf8, 0xe5, 0xe1, 0xd2, 0xa1, 0x66, + 0x1d, 0xb5, 0x6b, 0x9c, 0x62, 0x1c, 0xf3, 0xba, 0xd9, 0x54, 0x94, 0x92, 0x8a, 0x36, 0xaf, 0xa3, + 0x51, 0x37, 0x4b, 0x72, 0x53, 0x2b, 0x1d, 0x1a, 0x7c, 0xf8, 0xdb, 0xc8, 0x4a, 0xf0, 0x74, 0x4a, + 0xcf, 0xde, 0x45, 0x63, 0x73, 0x9f, 0x5b, 0xdb, 0xad, 0x3a, 0x7b, 0x07, 0xaa, 0xab, 0x8d, 0xbb, + 0x1f, 0x3d, 0x6e, 0x7c, 0x0f, 0x00, 0x00, 0xff, 0xff, 0x12, 0xb4, 0xb7, 0x71, 0x9a, 0x11, 0x00, + 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1557,10 +1581,10 @@ var _ grpc.ClientConn // is compatible with the grpc package it is being compiled against. const _ = grpc.SupportPackageIsVersion4 -// ServiceClient is the client API for Service service. +// ContainerServiceClient is the client API for ContainerService service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type ServiceClient interface { +type ContainerServiceClient interface { // Put invokes 'Put' method in container smart-contract and returns // response immediately. After new block in morph chain, request is verified // by inner ring nodes. After one more block in morph chain, container @@ -1585,70 +1609,70 @@ type ServiceClient interface { GetExtendedACL(ctx context.Context, in *GetExtendedACLRequest, opts ...grpc.CallOption) (*GetExtendedACLResponse, error) } -type serviceClient struct { +type containerServiceClient struct { cc *grpc.ClientConn } -func NewServiceClient(cc *grpc.ClientConn) ServiceClient { - return &serviceClient{cc} +func NewContainerServiceClient(cc *grpc.ClientConn) ContainerServiceClient { + return &containerServiceClient{cc} } -func (c *serviceClient) Put(ctx context.Context, in *PutRequest, opts ...grpc.CallOption) (*PutResponse, error) { +func (c *containerServiceClient) Put(ctx context.Context, in *PutRequest, opts ...grpc.CallOption) (*PutResponse, error) { out := new(PutResponse) - err := c.cc.Invoke(ctx, "/neo.fs.v2.container.Service/Put", in, out, opts...) + err := c.cc.Invoke(ctx, "/neo.fs.v2.container.ContainerService/Put", in, out, opts...) if err != nil { return nil, err } return out, nil } -func (c *serviceClient) Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteResponse, error) { +func (c *containerServiceClient) Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteResponse, error) { out := new(DeleteResponse) - err := c.cc.Invoke(ctx, "/neo.fs.v2.container.Service/Delete", in, out, opts...) + err := c.cc.Invoke(ctx, "/neo.fs.v2.container.ContainerService/Delete", in, out, opts...) if err != nil { return nil, err } return out, nil } -func (c *serviceClient) Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*GetResponse, error) { +func (c *containerServiceClient) Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*GetResponse, error) { out := new(GetResponse) - err := c.cc.Invoke(ctx, "/neo.fs.v2.container.Service/Get", in, out, opts...) + err := c.cc.Invoke(ctx, "/neo.fs.v2.container.ContainerService/Get", in, out, opts...) if err != nil { return nil, err } return out, nil } -func (c *serviceClient) List(ctx context.Context, in *ListRequest, opts ...grpc.CallOption) (*ListResponse, error) { +func (c *containerServiceClient) List(ctx context.Context, in *ListRequest, opts ...grpc.CallOption) (*ListResponse, error) { out := new(ListResponse) - err := c.cc.Invoke(ctx, "/neo.fs.v2.container.Service/List", in, out, opts...) + err := c.cc.Invoke(ctx, "/neo.fs.v2.container.ContainerService/List", in, out, opts...) if err != nil { return nil, err } return out, nil } -func (c *serviceClient) SetExtendedACL(ctx context.Context, in *SetExtendedACLRequest, opts ...grpc.CallOption) (*SetExtendedACLResponse, error) { +func (c *containerServiceClient) SetExtendedACL(ctx context.Context, in *SetExtendedACLRequest, opts ...grpc.CallOption) (*SetExtendedACLResponse, error) { out := new(SetExtendedACLResponse) - err := c.cc.Invoke(ctx, "/neo.fs.v2.container.Service/SetExtendedACL", in, out, opts...) + err := c.cc.Invoke(ctx, "/neo.fs.v2.container.ContainerService/SetExtendedACL", in, out, opts...) if err != nil { return nil, err } return out, nil } -func (c *serviceClient) GetExtendedACL(ctx context.Context, in *GetExtendedACLRequest, opts ...grpc.CallOption) (*GetExtendedACLResponse, error) { +func (c *containerServiceClient) GetExtendedACL(ctx context.Context, in *GetExtendedACLRequest, opts ...grpc.CallOption) (*GetExtendedACLResponse, error) { out := new(GetExtendedACLResponse) - err := c.cc.Invoke(ctx, "/neo.fs.v2.container.Service/GetExtendedACL", in, out, opts...) + err := c.cc.Invoke(ctx, "/neo.fs.v2.container.ContainerService/GetExtendedACL", in, out, opts...) if err != nil { return nil, err } return out, nil } -// ServiceServer is the server API for Service service. -type ServiceServer interface { +// ContainerServiceServer is the server API for ContainerService service. +type ContainerServiceServer interface { // Put invokes 'Put' method in container smart-contract and returns // response immediately. After new block in morph chain, request is verified // by inner ring nodes. After one more block in morph chain, container @@ -1673,168 +1697,168 @@ type ServiceServer interface { GetExtendedACL(context.Context, *GetExtendedACLRequest) (*GetExtendedACLResponse, error) } -// UnimplementedServiceServer can be embedded to have forward compatible implementations. -type UnimplementedServiceServer struct { +// UnimplementedContainerServiceServer can be embedded to have forward compatible implementations. +type UnimplementedContainerServiceServer struct { } -func (*UnimplementedServiceServer) Put(ctx context.Context, req *PutRequest) (*PutResponse, error) { +func (*UnimplementedContainerServiceServer) Put(ctx context.Context, req *PutRequest) (*PutResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Put not implemented") } -func (*UnimplementedServiceServer) Delete(ctx context.Context, req *DeleteRequest) (*DeleteResponse, error) { +func (*UnimplementedContainerServiceServer) Delete(ctx context.Context, req *DeleteRequest) (*DeleteResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Delete not implemented") } -func (*UnimplementedServiceServer) Get(ctx context.Context, req *GetRequest) (*GetResponse, error) { +func (*UnimplementedContainerServiceServer) Get(ctx context.Context, req *GetRequest) (*GetResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Get not implemented") } -func (*UnimplementedServiceServer) List(ctx context.Context, req *ListRequest) (*ListResponse, error) { +func (*UnimplementedContainerServiceServer) List(ctx context.Context, req *ListRequest) (*ListResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method List not implemented") } -func (*UnimplementedServiceServer) SetExtendedACL(ctx context.Context, req *SetExtendedACLRequest) (*SetExtendedACLResponse, error) { +func (*UnimplementedContainerServiceServer) SetExtendedACL(ctx context.Context, req *SetExtendedACLRequest) (*SetExtendedACLResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method SetExtendedACL not implemented") } -func (*UnimplementedServiceServer) GetExtendedACL(ctx context.Context, req *GetExtendedACLRequest) (*GetExtendedACLResponse, error) { +func (*UnimplementedContainerServiceServer) GetExtendedACL(ctx context.Context, req *GetExtendedACLRequest) (*GetExtendedACLResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method GetExtendedACL not implemented") } -func RegisterServiceServer(s *grpc.Server, srv ServiceServer) { - s.RegisterService(&_Service_serviceDesc, srv) +func RegisterContainerServiceServer(s *grpc.Server, srv ContainerServiceServer) { + s.RegisterService(&_ContainerService_serviceDesc, srv) } -func _Service_Put_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _ContainerService_Put_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(PutRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(ServiceServer).Put(ctx, in) + return srv.(ContainerServiceServer).Put(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/neo.fs.v2.container.Service/Put", + FullMethod: "/neo.fs.v2.container.ContainerService/Put", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ServiceServer).Put(ctx, req.(*PutRequest)) + return srv.(ContainerServiceServer).Put(ctx, req.(*PutRequest)) } return interceptor(ctx, in, info, handler) } -func _Service_Delete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _ContainerService_Delete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(DeleteRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(ServiceServer).Delete(ctx, in) + return srv.(ContainerServiceServer).Delete(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/neo.fs.v2.container.Service/Delete", + FullMethod: "/neo.fs.v2.container.ContainerService/Delete", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ServiceServer).Delete(ctx, req.(*DeleteRequest)) + return srv.(ContainerServiceServer).Delete(ctx, req.(*DeleteRequest)) } return interceptor(ctx, in, info, handler) } -func _Service_Get_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _ContainerService_Get_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(GetRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(ServiceServer).Get(ctx, in) + return srv.(ContainerServiceServer).Get(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/neo.fs.v2.container.Service/Get", + FullMethod: "/neo.fs.v2.container.ContainerService/Get", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ServiceServer).Get(ctx, req.(*GetRequest)) + return srv.(ContainerServiceServer).Get(ctx, req.(*GetRequest)) } return interceptor(ctx, in, info, handler) } -func _Service_List_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _ContainerService_List_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(ListRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(ServiceServer).List(ctx, in) + return srv.(ContainerServiceServer).List(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/neo.fs.v2.container.Service/List", + FullMethod: "/neo.fs.v2.container.ContainerService/List", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ServiceServer).List(ctx, req.(*ListRequest)) + return srv.(ContainerServiceServer).List(ctx, req.(*ListRequest)) } return interceptor(ctx, in, info, handler) } -func _Service_SetExtendedACL_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _ContainerService_SetExtendedACL_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(SetExtendedACLRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(ServiceServer).SetExtendedACL(ctx, in) + return srv.(ContainerServiceServer).SetExtendedACL(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/neo.fs.v2.container.Service/SetExtendedACL", + FullMethod: "/neo.fs.v2.container.ContainerService/SetExtendedACL", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ServiceServer).SetExtendedACL(ctx, req.(*SetExtendedACLRequest)) + return srv.(ContainerServiceServer).SetExtendedACL(ctx, req.(*SetExtendedACLRequest)) } return interceptor(ctx, in, info, handler) } -func _Service_GetExtendedACL_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _ContainerService_GetExtendedACL_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(GetExtendedACLRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(ServiceServer).GetExtendedACL(ctx, in) + return srv.(ContainerServiceServer).GetExtendedACL(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/neo.fs.v2.container.Service/GetExtendedACL", + FullMethod: "/neo.fs.v2.container.ContainerService/GetExtendedACL", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ServiceServer).GetExtendedACL(ctx, req.(*GetExtendedACLRequest)) + return srv.(ContainerServiceServer).GetExtendedACL(ctx, req.(*GetExtendedACLRequest)) } return interceptor(ctx, in, info, handler) } -var _Service_serviceDesc = grpc.ServiceDesc{ - ServiceName: "neo.fs.v2.container.Service", - HandlerType: (*ServiceServer)(nil), +var _ContainerService_serviceDesc = grpc.ServiceDesc{ + ServiceName: "neo.fs.v2.container.ContainerService", + HandlerType: (*ContainerServiceServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "Put", - Handler: _Service_Put_Handler, + Handler: _ContainerService_Put_Handler, }, { MethodName: "Delete", - Handler: _Service_Delete_Handler, + Handler: _ContainerService_Delete_Handler, }, { MethodName: "Get", - Handler: _Service_Get_Handler, + Handler: _ContainerService_Get_Handler, }, { MethodName: "List", - Handler: _Service_List_Handler, + Handler: _ContainerService_List_Handler, }, { MethodName: "SetExtendedACL", - Handler: _Service_SetExtendedACL_Handler, + Handler: _ContainerService_SetExtendedACL_Handler, }, { MethodName: "GetExtendedACL", - Handler: _Service_GetExtendedACL_Handler, + Handler: _ContainerService_GetExtendedACL_Handler, }, }, Streams: []grpc.StreamDesc{}, diff --git a/v2/container/types.pb.go b/v2/container/types.pb.go index 50a0a36..175aeeb 100644 --- a/v2/container/types.pb.go +++ b/v2/container/types.pb.go @@ -38,11 +38,11 @@ type Container struct { BasicAcl uint32 `protobuf:"varint,3,opt,name=basic_acl,json=basicAcl,proto3" json:"basic_acl,omitempty"` // Attributes define any immutable characteristics of container. Attributes []*Container_Attribute `protobuf:"bytes,4,rep,name=attributes,proto3" json:"attributes,omitempty"` - // Rules define storage policy for the object inside the container. - Rules *netmap.PlacementRule `protobuf:"bytes,5,opt,name=rules,proto3" json:"rules,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + // Placement policy for the object inside the container. + PlacementPolicy *netmap.PlacementPolicy `protobuf:"bytes,5,opt,name=placement_policy,json=placementPolicy,proto3" json:"placement_policy,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *Container) Reset() { *m = Container{} } @@ -106,9 +106,9 @@ func (m *Container) GetAttributes() []*Container_Attribute { return nil } -func (m *Container) GetRules() *netmap.PlacementRule { +func (m *Container) GetPlacementPolicy() *netmap.PlacementPolicy { if m != nil { - return m.Rules + return m.PlacementPolicy } return nil } @@ -179,29 +179,30 @@ func init() { func init() { proto.RegisterFile("v2/container/types.proto", fileDescriptor_ece71f25e6ae314e) } var fileDescriptor_ece71f25e6ae314e = []byte{ - // 345 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x91, 0xd1, 0x4a, 0xc3, 0x30, - 0x14, 0x86, 0xed, 0xe6, 0x74, 0xcd, 0x14, 0xa4, 0x53, 0x2c, 0x13, 0x6a, 0xf1, 0xaa, 0x37, 0x4b, - 0x20, 0xc3, 0x07, 0x98, 0x8a, 0xb8, 0x1b, 0x1d, 0x11, 0xbc, 0xf0, 0x66, 0xa4, 0xd9, 0xd9, 0x2c, - 0x76, 0x49, 0x69, 0xd2, 0xca, 0xde, 0xc4, 0x47, 0x10, 0x9f, 0xc4, 0x4b, 0x1f, 0x41, 0xe6, 0x8b, - 0x48, 0x5b, 0xb6, 0xf5, 0xc2, 0xbb, 0x9c, 0x93, 0xff, 0x3f, 0x39, 0x5f, 0x7e, 0xe4, 0xe6, 0x94, - 0x08, 0x25, 0x0d, 0x8f, 0x24, 0xa4, 0xc4, 0x2c, 0x13, 0xd0, 0x38, 0x49, 0x95, 0x51, 0x4e, 0x57, - 0x82, 0xc2, 0x33, 0x8d, 0x73, 0x8a, 0x37, 0x82, 0xde, 0x49, 0x4e, 0x89, 0x04, 0xb3, 0xe0, 0x49, - 0x5d, 0xdb, 0xeb, 0xe6, 0x94, 0xa4, 0x30, 0xd3, 0xf5, 0xe6, 0xc5, 0x47, 0x03, 0xd9, 0xd7, 0x6b, - 0xa7, 0x43, 0x51, 0x5b, 0xbd, 0x49, 0x48, 0x27, 0xd1, 0xd4, 0xb5, 0x7c, 0x2b, 0xe8, 0xd0, 0x53, - 0xbc, 0x7d, 0xa1, 0x30, 0xe3, 0x87, 0xe2, 0x7e, 0x74, 0xc3, 0xf6, 0x4b, 0xe1, 0x68, 0xea, 0x1c, - 0xa3, 0x96, 0x54, 0x52, 0x80, 0xdb, 0xf0, 0xad, 0xe0, 0x80, 0x55, 0x85, 0x73, 0x86, 0xec, 0x90, - 0xeb, 0x48, 0x4c, 0xb8, 0x88, 0xdd, 0xa6, 0x6f, 0x05, 0x87, 0xac, 0x5d, 0x36, 0x86, 0x22, 0x76, - 0xee, 0x10, 0xe2, 0xc6, 0xa4, 0x51, 0x98, 0x19, 0xd0, 0xee, 0xae, 0xdf, 0x0c, 0x3a, 0x34, 0xc0, - 0xff, 0xa0, 0xe0, 0xcd, 0x6a, 0x78, 0xb8, 0x36, 0xb0, 0x9a, 0xd7, 0xb9, 0x44, 0xad, 0x34, 0x8b, - 0x41, 0xbb, 0xad, 0x72, 0xdb, 0xf3, 0xda, 0x90, 0xea, 0x07, 0xf0, 0x38, 0xe6, 0x02, 0x16, 0x20, - 0x0d, 0xcb, 0x62, 0x60, 0x95, 0xba, 0x37, 0x40, 0xf6, 0x66, 0x9e, 0x73, 0x84, 0x9a, 0xaf, 0xb0, - 0x2c, 0x79, 0x6d, 0x56, 0x1c, 0x0b, 0xa4, 0x9c, 0xc7, 0x59, 0x85, 0x64, 0xb3, 0xaa, 0xb8, 0x7a, - 0xfa, 0x5a, 0x79, 0xd6, 0xf7, 0xca, 0xb3, 0x7e, 0x56, 0x9e, 0xf5, 0xfe, 0xeb, 0xed, 0x3c, 0xe3, - 0x79, 0x64, 0x5e, 0xb2, 0x10, 0x0b, 0xb5, 0x20, 0x52, 0x27, 0x42, 0xf4, 0xa7, 0x90, 0x13, 0x09, - 0x6a, 0xa6, 0xfb, 0x3c, 0x89, 0xfa, 0x73, 0x45, 0xea, 0xc9, 0x7d, 0x36, 0xba, 0xf7, 0xa0, 0x6e, - 0x1f, 0xf1, 0x70, 0x3c, 0xda, 0x92, 0x85, 0x7b, 0x65, 0x12, 0x83, 0xbf, 0x00, 0x00, 0x00, 0xff, - 0xff, 0xde, 0x82, 0x60, 0x33, 0xe6, 0x01, 0x00, 0x00, + // 357 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x51, 0xcd, 0x4a, 0xc3, 0x40, + 0x10, 0x36, 0xad, 0xd5, 0x66, 0xab, 0x58, 0x52, 0x7f, 0x42, 0x85, 0x10, 0x3d, 0xe5, 0xd2, 0x0d, + 0xa4, 0x17, 0xc1, 0x53, 0x55, 0xc4, 0x82, 0x68, 0x89, 0x37, 0x2f, 0x65, 0xb3, 0x9d, 0xd6, 0xc5, + 0x74, 0x77, 0xc9, 0x6e, 0x23, 0x7d, 0x13, 0x9f, 0xc1, 0x97, 0xf0, 0xea, 0xd1, 0x47, 0x90, 0xfa, + 0x22, 0x92, 0x84, 0xc6, 0x08, 0xde, 0x66, 0xbe, 0xfd, 0xbe, 0x9d, 0xef, 0x9b, 0x41, 0x76, 0x1a, + 0xf8, 0x54, 0x70, 0x4d, 0x18, 0x87, 0xc4, 0xd7, 0x4b, 0x09, 0x0a, 0xcb, 0x44, 0x68, 0x61, 0x75, + 0x38, 0x08, 0x3c, 0x55, 0x38, 0x0d, 0x70, 0x49, 0xe8, 0x1e, 0xa4, 0x81, 0xcf, 0x41, 0xcf, 0x89, + 0xac, 0x72, 0xbb, 0x9d, 0x34, 0xf0, 0x13, 0x98, 0xaa, 0x2a, 0x78, 0xfa, 0x5e, 0x43, 0xe6, 0xe5, + 0x5a, 0x69, 0x05, 0xa8, 0x29, 0x5e, 0x38, 0x24, 0x63, 0x36, 0xb1, 0x0d, 0xd7, 0xf0, 0x5a, 0xc1, + 0x11, 0xfe, 0x9d, 0x90, 0x89, 0xf1, 0x7d, 0xf6, 0x3e, 0xbc, 0x0a, 0xb7, 0x73, 0xe2, 0x70, 0x62, + 0xed, 0xa3, 0x06, 0x17, 0x9c, 0x82, 0x5d, 0x73, 0x0d, 0x6f, 0x27, 0x2c, 0x1a, 0xeb, 0x18, 0x99, + 0x11, 0x51, 0x8c, 0x8e, 0x09, 0x8d, 0xed, 0xba, 0x6b, 0x78, 0xbb, 0x61, 0x33, 0x07, 0x06, 0x34, + 0xb6, 0x6e, 0x10, 0x22, 0x5a, 0x27, 0x2c, 0x5a, 0x68, 0x50, 0xf6, 0xa6, 0x5b, 0xf7, 0x5a, 0x81, + 0x87, 0xff, 0x89, 0x82, 0x4b, 0x6b, 0x78, 0xb0, 0x16, 0x84, 0x15, 0xad, 0x75, 0x8b, 0xda, 0x32, + 0x26, 0x14, 0xe6, 0xc0, 0xf5, 0x58, 0x8a, 0x98, 0xd1, 0xa5, 0xdd, 0xc8, 0x8d, 0x9f, 0x54, 0xfe, + 0x2b, 0x96, 0x81, 0x47, 0x6b, 0xe6, 0x28, 0x27, 0x86, 0x7b, 0xf2, 0x2f, 0xd0, 0xed, 0x23, 0xb3, + 0x1c, 0x63, 0xb5, 0x51, 0xfd, 0x19, 0x96, 0xf9, 0x1a, 0xcc, 0x30, 0x2b, 0xb3, 0xa4, 0x29, 0x89, + 0x17, 0x45, 0x52, 0x33, 0x2c, 0x9a, 0x0b, 0xfa, 0xb1, 0x72, 0x8c, 0xcf, 0x95, 0x63, 0x7c, 0xad, + 0x1c, 0xe3, 0xf5, 0xdb, 0xd9, 0x78, 0x3c, 0x9b, 0x31, 0xfd, 0xb4, 0x88, 0x30, 0x15, 0x73, 0x9f, + 0x2b, 0x49, 0x69, 0x6f, 0x02, 0xa9, 0xcf, 0x41, 0x4c, 0x55, 0x8f, 0x48, 0xd6, 0x9b, 0x09, 0xbf, + 0x7a, 0xd0, 0xf3, 0xb2, 0x7a, 0xab, 0x1d, 0xde, 0x81, 0xb8, 0x7e, 0xc0, 0x83, 0xd1, 0x30, 0xf3, + 0x5d, 0xa6, 0x8f, 0xb6, 0xf2, 0x6b, 0xf5, 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff, 0x38, 0xf7, 0x99, + 0x45, 0x0a, 0x02, 0x00, 0x00, } func (m *Container) Marshal() (dAtA []byte, err error) { @@ -228,9 +229,9 @@ func (m *Container) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } - if m.Rules != nil { + if m.PlacementPolicy != nil { { - size, err := m.Rules.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.PlacementPolicy.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -356,8 +357,8 @@ func (m *Container) Size() (n int) { n += 1 + l + sovTypes(uint64(l)) } } - if m.Rules != nil { - l = m.Rules.Size() + if m.PlacementPolicy != nil { + l = m.PlacementPolicy.Size() n += 1 + l + sovTypes(uint64(l)) } if m.XXX_unrecognized != nil { @@ -546,7 +547,7 @@ func (m *Container) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 5: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Rules", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field PlacementPolicy", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -573,10 +574,10 @@ func (m *Container) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.Rules == nil { - m.Rules = &netmap.PlacementRule{} + if m.PlacementPolicy == nil { + m.PlacementPolicy = &netmap.PlacementPolicy{} } - if err := m.Rules.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.PlacementPolicy.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/v2/netmap/types.pb.go b/v2/netmap/types.pb.go index 84e68fc..bfc2e9e 100644 --- a/v2/netmap/types.pb.go +++ b/v2/netmap/types.pb.go @@ -22,22 +22,32 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package -type PlacementRule_SFGroup_Filter_SimpleFilter_Operation int32 +// Filtering operation +type PlacementPolicy_FilterGroup_Filter_SimpleFilter_Operation int32 const ( - PlacementRule_SFGroup_Filter_SimpleFilter_NP PlacementRule_SFGroup_Filter_SimpleFilter_Operation = 0 - PlacementRule_SFGroup_Filter_SimpleFilter_EQ PlacementRule_SFGroup_Filter_SimpleFilter_Operation = 1 - PlacementRule_SFGroup_Filter_SimpleFilter_NE PlacementRule_SFGroup_Filter_SimpleFilter_Operation = 2 - PlacementRule_SFGroup_Filter_SimpleFilter_GT PlacementRule_SFGroup_Filter_SimpleFilter_Operation = 3 - PlacementRule_SFGroup_Filter_SimpleFilter_GE PlacementRule_SFGroup_Filter_SimpleFilter_Operation = 4 - PlacementRule_SFGroup_Filter_SimpleFilter_LT PlacementRule_SFGroup_Filter_SimpleFilter_Operation = 5 - PlacementRule_SFGroup_Filter_SimpleFilter_LE PlacementRule_SFGroup_Filter_SimpleFilter_Operation = 6 - PlacementRule_SFGroup_Filter_SimpleFilter_OR PlacementRule_SFGroup_Filter_SimpleFilter_Operation = 7 - PlacementRule_SFGroup_Filter_SimpleFilter_AND PlacementRule_SFGroup_Filter_SimpleFilter_Operation = 8 + // No Operation defined + PlacementPolicy_FilterGroup_Filter_SimpleFilter_OPERATION_UNSPECIFIED PlacementPolicy_FilterGroup_Filter_SimpleFilter_Operation = 0 + // Equal + PlacementPolicy_FilterGroup_Filter_SimpleFilter_EQ PlacementPolicy_FilterGroup_Filter_SimpleFilter_Operation = 1 + // Not Equal + PlacementPolicy_FilterGroup_Filter_SimpleFilter_NE PlacementPolicy_FilterGroup_Filter_SimpleFilter_Operation = 2 + // Greater then + PlacementPolicy_FilterGroup_Filter_SimpleFilter_GT PlacementPolicy_FilterGroup_Filter_SimpleFilter_Operation = 3 + // Greater or equal + PlacementPolicy_FilterGroup_Filter_SimpleFilter_GE PlacementPolicy_FilterGroup_Filter_SimpleFilter_Operation = 4 + // Less then + PlacementPolicy_FilterGroup_Filter_SimpleFilter_LT PlacementPolicy_FilterGroup_Filter_SimpleFilter_Operation = 5 + // Less or equal + PlacementPolicy_FilterGroup_Filter_SimpleFilter_LE PlacementPolicy_FilterGroup_Filter_SimpleFilter_Operation = 6 + // Logical OR + PlacementPolicy_FilterGroup_Filter_SimpleFilter_OR PlacementPolicy_FilterGroup_Filter_SimpleFilter_Operation = 7 + // Logical AND + PlacementPolicy_FilterGroup_Filter_SimpleFilter_AND PlacementPolicy_FilterGroup_Filter_SimpleFilter_Operation = 8 ) -var PlacementRule_SFGroup_Filter_SimpleFilter_Operation_name = map[int32]string{ - 0: "NP", +var PlacementPolicy_FilterGroup_Filter_SimpleFilter_Operation_name = map[int32]string{ + 0: "OPERATION_UNSPECIFIED", 1: "EQ", 2: "NE", 3: "GT", @@ -48,32 +58,32 @@ var PlacementRule_SFGroup_Filter_SimpleFilter_Operation_name = map[int32]string{ 8: "AND", } -var PlacementRule_SFGroup_Filter_SimpleFilter_Operation_value = map[string]int32{ - "NP": 0, - "EQ": 1, - "NE": 2, - "GT": 3, - "GE": 4, - "LT": 5, - "LE": 6, - "OR": 7, - "AND": 8, +var PlacementPolicy_FilterGroup_Filter_SimpleFilter_Operation_value = map[string]int32{ + "OPERATION_UNSPECIFIED": 0, + "EQ": 1, + "NE": 2, + "GT": 3, + "GE": 4, + "LT": 5, + "LE": 6, + "OR": 7, + "AND": 8, } -func (x PlacementRule_SFGroup_Filter_SimpleFilter_Operation) String() string { - return proto.EnumName(PlacementRule_SFGroup_Filter_SimpleFilter_Operation_name, int32(x)) +func (x PlacementPolicy_FilterGroup_Filter_SimpleFilter_Operation) String() string { + return proto.EnumName(PlacementPolicy_FilterGroup_Filter_SimpleFilter_Operation_name, int32(x)) } -func (PlacementRule_SFGroup_Filter_SimpleFilter_Operation) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_1207dc80bd67ddec, []int{0, 0, 0, 1, 0} +func (PlacementPolicy_FilterGroup_Filter_SimpleFilter_Operation) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_1207dc80bd67ddec, []int{0, 0, 0, 0, 0} } // Represents the enumeration of various states of the NeoFS node. type NodeInfo_State int32 const ( - // Undefined state. - NodeInfo_UNKNOWN NodeInfo_State = 0 + // Unknown state. + NodeInfo_UNSPECIFIED NodeInfo_State = 0 // Active state in the network. NodeInfo_ONLINE NodeInfo_State = 1 // Network unavailable state. @@ -81,15 +91,15 @@ const ( ) var NodeInfo_State_name = map[int32]string{ - 0: "UNKNOWN", + 0: "UNSPECIFIED", 1: "ONLINE", 2: "OFFLINE", } var NodeInfo_State_value = map[string]int32{ - "UNKNOWN": 0, - "ONLINE": 1, - "OFFLINE": 2, + "UNSPECIFIED": 0, + "ONLINE": 1, + "OFFLINE": 2, } func (x NodeInfo_State) String() string { @@ -100,26 +110,29 @@ func (NodeInfo_State) EnumDescriptor() ([]byte, []int) { return fileDescriptor_1207dc80bd67ddec, []int{1, 0} } -type PlacementRule struct { - ReplFactor uint32 `protobuf:"varint,1,opt,name=repl_factor,json=replFactor,proto3" json:"repl_factor,omitempty"` - SfGroups []*PlacementRule_SFGroup `protobuf:"bytes,2,rep,name=sf_groups,json=sfGroups,proto3" json:"sf_groups,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` +// Set of rules to select a subset of nodes able to store container's objects +type PlacementPolicy struct { + // Replication factor + ReplFactor uint32 `protobuf:"varint,1,opt,name=repl_factor,json=replFactor,proto3" json:"repl_factor,omitempty"` + // List of filter groups + FilterGroups []*PlacementPolicy_FilterGroup `protobuf:"bytes,2,rep,name=filter_groups,json=filterGroups,proto3" json:"filter_groups,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *PlacementRule) Reset() { *m = PlacementRule{} } -func (m *PlacementRule) String() string { return proto.CompactTextString(m) } -func (*PlacementRule) ProtoMessage() {} -func (*PlacementRule) Descriptor() ([]byte, []int) { +func (m *PlacementPolicy) Reset() { *m = PlacementPolicy{} } +func (m *PlacementPolicy) String() string { return proto.CompactTextString(m) } +func (*PlacementPolicy) ProtoMessage() {} +func (*PlacementPolicy) Descriptor() ([]byte, []int) { return fileDescriptor_1207dc80bd67ddec, []int{0} } -func (m *PlacementRule) XXX_Unmarshal(b []byte) error { +func (m *PlacementPolicy) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *PlacementRule) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *PlacementPolicy) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_PlacementRule.Marshal(b, m, deterministic) + return xxx_messageInfo_PlacementPolicy.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -129,53 +142,57 @@ func (m *PlacementRule) XXX_Marshal(b []byte, deterministic bool) ([]byte, error return b[:n], nil } } -func (m *PlacementRule) XXX_Merge(src proto.Message) { - xxx_messageInfo_PlacementRule.Merge(m, src) +func (m *PlacementPolicy) XXX_Merge(src proto.Message) { + xxx_messageInfo_PlacementPolicy.Merge(m, src) } -func (m *PlacementRule) XXX_Size() int { +func (m *PlacementPolicy) XXX_Size() int { return m.Size() } -func (m *PlacementRule) XXX_DiscardUnknown() { - xxx_messageInfo_PlacementRule.DiscardUnknown(m) +func (m *PlacementPolicy) XXX_DiscardUnknown() { + xxx_messageInfo_PlacementPolicy.DiscardUnknown(m) } -var xxx_messageInfo_PlacementRule proto.InternalMessageInfo +var xxx_messageInfo_PlacementPolicy proto.InternalMessageInfo -func (m *PlacementRule) GetReplFactor() uint32 { +func (m *PlacementPolicy) GetReplFactor() uint32 { if m != nil { return m.ReplFactor } return 0 } -func (m *PlacementRule) GetSfGroups() []*PlacementRule_SFGroup { +func (m *PlacementPolicy) GetFilterGroups() []*PlacementPolicy_FilterGroup { if m != nil { - return m.SfGroups + return m.FilterGroups } return nil } -type PlacementRule_SFGroup struct { - Filters []*PlacementRule_SFGroup_Filter `protobuf:"bytes,1,rep,name=filters,proto3" json:"filters,omitempty"` - Selectors []*PlacementRule_SFGroup_Selector `protobuf:"bytes,2,rep,name=selectors,proto3" json:"selectors,omitempty"` - Exclude []uint32 `protobuf:"varint,3,rep,packed,name=exclude,proto3" json:"exclude,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` +// Filters to apply to Network Map +type PlacementPolicy_FilterGroup struct { + // Resulting filter list + Filters []*PlacementPolicy_FilterGroup_Filter `protobuf:"bytes,1,rep,name=filters,proto3" json:"filters,omitempty"` + // List of selectors + Selectors []*PlacementPolicy_FilterGroup_Selector `protobuf:"bytes,2,rep,name=selectors,proto3" json:"selectors,omitempty"` + // Parts of graph to exclude. Internal use. + Exclude []uint32 `protobuf:"varint,3,rep,packed,name=exclude,proto3" json:"exclude,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *PlacementRule_SFGroup) Reset() { *m = PlacementRule_SFGroup{} } -func (m *PlacementRule_SFGroup) String() string { return proto.CompactTextString(m) } -func (*PlacementRule_SFGroup) ProtoMessage() {} -func (*PlacementRule_SFGroup) Descriptor() ([]byte, []int) { +func (m *PlacementPolicy_FilterGroup) Reset() { *m = PlacementPolicy_FilterGroup{} } +func (m *PlacementPolicy_FilterGroup) String() string { return proto.CompactTextString(m) } +func (*PlacementPolicy_FilterGroup) ProtoMessage() {} +func (*PlacementPolicy_FilterGroup) Descriptor() ([]byte, []int) { return fileDescriptor_1207dc80bd67ddec, []int{0, 0} } -func (m *PlacementRule_SFGroup) XXX_Unmarshal(b []byte) error { +func (m *PlacementPolicy_FilterGroup) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *PlacementRule_SFGroup) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *PlacementPolicy_FilterGroup) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_PlacementRule_SFGroup.Marshal(b, m, deterministic) + return xxx_messageInfo_PlacementPolicy_FilterGroup.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -185,59 +202,62 @@ func (m *PlacementRule_SFGroup) XXX_Marshal(b []byte, deterministic bool) ([]byt return b[:n], nil } } -func (m *PlacementRule_SFGroup) XXX_Merge(src proto.Message) { - xxx_messageInfo_PlacementRule_SFGroup.Merge(m, src) +func (m *PlacementPolicy_FilterGroup) XXX_Merge(src proto.Message) { + xxx_messageInfo_PlacementPolicy_FilterGroup.Merge(m, src) } -func (m *PlacementRule_SFGroup) XXX_Size() int { +func (m *PlacementPolicy_FilterGroup) XXX_Size() int { return m.Size() } -func (m *PlacementRule_SFGroup) XXX_DiscardUnknown() { - xxx_messageInfo_PlacementRule_SFGroup.DiscardUnknown(m) +func (m *PlacementPolicy_FilterGroup) XXX_DiscardUnknown() { + xxx_messageInfo_PlacementPolicy_FilterGroup.DiscardUnknown(m) } -var xxx_messageInfo_PlacementRule_SFGroup proto.InternalMessageInfo +var xxx_messageInfo_PlacementPolicy_FilterGroup proto.InternalMessageInfo -func (m *PlacementRule_SFGroup) GetFilters() []*PlacementRule_SFGroup_Filter { +func (m *PlacementPolicy_FilterGroup) GetFilters() []*PlacementPolicy_FilterGroup_Filter { if m != nil { return m.Filters } return nil } -func (m *PlacementRule_SFGroup) GetSelectors() []*PlacementRule_SFGroup_Selector { +func (m *PlacementPolicy_FilterGroup) GetSelectors() []*PlacementPolicy_FilterGroup_Selector { if m != nil { return m.Selectors } return nil } -func (m *PlacementRule_SFGroup) GetExclude() []uint32 { +func (m *PlacementPolicy_FilterGroup) GetExclude() []uint32 { if m != nil { return m.Exclude } return nil } -type PlacementRule_SFGroup_Filter struct { - Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - F *PlacementRule_SFGroup_Filter_SimpleFilter `protobuf:"bytes,2,opt,name=f,proto3" json:"f,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` +// Filter definition +type PlacementPolicy_FilterGroup_Filter struct { + // Filter identifier + Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + // The rest of filter + F *PlacementPolicy_FilterGroup_Filter_SimpleFilter `protobuf:"bytes,2,opt,name=f,proto3" json:"f,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *PlacementRule_SFGroup_Filter) Reset() { *m = PlacementRule_SFGroup_Filter{} } -func (m *PlacementRule_SFGroup_Filter) String() string { return proto.CompactTextString(m) } -func (*PlacementRule_SFGroup_Filter) ProtoMessage() {} -func (*PlacementRule_SFGroup_Filter) Descriptor() ([]byte, []int) { +func (m *PlacementPolicy_FilterGroup_Filter) Reset() { *m = PlacementPolicy_FilterGroup_Filter{} } +func (m *PlacementPolicy_FilterGroup_Filter) String() string { return proto.CompactTextString(m) } +func (*PlacementPolicy_FilterGroup_Filter) ProtoMessage() {} +func (*PlacementPolicy_FilterGroup_Filter) Descriptor() ([]byte, []int) { return fileDescriptor_1207dc80bd67ddec, []int{0, 0, 0} } -func (m *PlacementRule_SFGroup_Filter) XXX_Unmarshal(b []byte) error { +func (m *PlacementPolicy_FilterGroup_Filter) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *PlacementRule_SFGroup_Filter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *PlacementPolicy_FilterGroup_Filter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_PlacementRule_SFGroup_Filter.Marshal(b, m, deterministic) + return xxx_messageInfo_PlacementPolicy_FilterGroup_Filter.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -247,55 +267,63 @@ func (m *PlacementRule_SFGroup_Filter) XXX_Marshal(b []byte, deterministic bool) return b[:n], nil } } -func (m *PlacementRule_SFGroup_Filter) XXX_Merge(src proto.Message) { - xxx_messageInfo_PlacementRule_SFGroup_Filter.Merge(m, src) +func (m *PlacementPolicy_FilterGroup_Filter) XXX_Merge(src proto.Message) { + xxx_messageInfo_PlacementPolicy_FilterGroup_Filter.Merge(m, src) } -func (m *PlacementRule_SFGroup_Filter) XXX_Size() int { +func (m *PlacementPolicy_FilterGroup_Filter) XXX_Size() int { return m.Size() } -func (m *PlacementRule_SFGroup_Filter) XXX_DiscardUnknown() { - xxx_messageInfo_PlacementRule_SFGroup_Filter.DiscardUnknown(m) +func (m *PlacementPolicy_FilterGroup_Filter) XXX_DiscardUnknown() { + xxx_messageInfo_PlacementPolicy_FilterGroup_Filter.DiscardUnknown(m) } -var xxx_messageInfo_PlacementRule_SFGroup_Filter proto.InternalMessageInfo +var xxx_messageInfo_PlacementPolicy_FilterGroup_Filter proto.InternalMessageInfo -func (m *PlacementRule_SFGroup_Filter) GetKey() string { +func (m *PlacementPolicy_FilterGroup_Filter) GetKey() string { if m != nil { return m.Key } return "" } -func (m *PlacementRule_SFGroup_Filter) GetF() *PlacementRule_SFGroup_Filter_SimpleFilter { +func (m *PlacementPolicy_FilterGroup_Filter) GetF() *PlacementPolicy_FilterGroup_Filter_SimpleFilter { if m != nil { return m.F } return nil } -type PlacementRule_SFGroup_Filter_SimpleFilters struct { - Filters []*PlacementRule_SFGroup_Filter_SimpleFilter `protobuf:"bytes,1,rep,name=filters,proto3" json:"filters,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` +// Minimal simple filter +type PlacementPolicy_FilterGroup_Filter_SimpleFilter struct { + // Filtering operation + Op PlacementPolicy_FilterGroup_Filter_SimpleFilter_Operation `protobuf:"varint,1,opt,name=op,proto3,enum=neo.fs.v2.netmap.PlacementPolicy_FilterGroup_Filter_SimpleFilter_Operation" json:"op,omitempty"` + // Filtering operation argument + // + // Types that are valid to be assigned to Args: + // *PlacementPolicy_FilterGroup_Filter_SimpleFilter_Value + // *PlacementPolicy_FilterGroup_Filter_SimpleFilter_FArgs + Args isPlacementPolicy_FilterGroup_Filter_SimpleFilter_Args `protobuf_oneof:"args"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *PlacementRule_SFGroup_Filter_SimpleFilters) Reset() { - *m = PlacementRule_SFGroup_Filter_SimpleFilters{} +func (m *PlacementPolicy_FilterGroup_Filter_SimpleFilter) Reset() { + *m = PlacementPolicy_FilterGroup_Filter_SimpleFilter{} } -func (m *PlacementRule_SFGroup_Filter_SimpleFilters) String() string { +func (m *PlacementPolicy_FilterGroup_Filter_SimpleFilter) String() string { return proto.CompactTextString(m) } -func (*PlacementRule_SFGroup_Filter_SimpleFilters) ProtoMessage() {} -func (*PlacementRule_SFGroup_Filter_SimpleFilters) Descriptor() ([]byte, []int) { +func (*PlacementPolicy_FilterGroup_Filter_SimpleFilter) ProtoMessage() {} +func (*PlacementPolicy_FilterGroup_Filter_SimpleFilter) Descriptor() ([]byte, []int) { return fileDescriptor_1207dc80bd67ddec, []int{0, 0, 0, 0} } -func (m *PlacementRule_SFGroup_Filter_SimpleFilters) XXX_Unmarshal(b []byte) error { +func (m *PlacementPolicy_FilterGroup_Filter_SimpleFilter) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *PlacementRule_SFGroup_Filter_SimpleFilters) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *PlacementPolicy_FilterGroup_Filter_SimpleFilter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_PlacementRule_SFGroup_Filter_SimpleFilters.Marshal(b, m, deterministic) + return xxx_messageInfo_PlacementPolicy_FilterGroup_Filter_SimpleFilter.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -305,147 +333,97 @@ func (m *PlacementRule_SFGroup_Filter_SimpleFilters) XXX_Marshal(b []byte, deter return b[:n], nil } } -func (m *PlacementRule_SFGroup_Filter_SimpleFilters) XXX_Merge(src proto.Message) { - xxx_messageInfo_PlacementRule_SFGroup_Filter_SimpleFilters.Merge(m, src) +func (m *PlacementPolicy_FilterGroup_Filter_SimpleFilter) XXX_Merge(src proto.Message) { + xxx_messageInfo_PlacementPolicy_FilterGroup_Filter_SimpleFilter.Merge(m, src) } -func (m *PlacementRule_SFGroup_Filter_SimpleFilters) XXX_Size() int { +func (m *PlacementPolicy_FilterGroup_Filter_SimpleFilter) XXX_Size() int { return m.Size() } -func (m *PlacementRule_SFGroup_Filter_SimpleFilters) XXX_DiscardUnknown() { - xxx_messageInfo_PlacementRule_SFGroup_Filter_SimpleFilters.DiscardUnknown(m) +func (m *PlacementPolicy_FilterGroup_Filter_SimpleFilter) XXX_DiscardUnknown() { + xxx_messageInfo_PlacementPolicy_FilterGroup_Filter_SimpleFilter.DiscardUnknown(m) } -var xxx_messageInfo_PlacementRule_SFGroup_Filter_SimpleFilters proto.InternalMessageInfo +var xxx_messageInfo_PlacementPolicy_FilterGroup_Filter_SimpleFilter proto.InternalMessageInfo -func (m *PlacementRule_SFGroup_Filter_SimpleFilters) GetFilters() []*PlacementRule_SFGroup_Filter_SimpleFilter { - if m != nil { - return m.Filters - } - return nil -} - -type PlacementRule_SFGroup_Filter_SimpleFilter struct { - Op PlacementRule_SFGroup_Filter_SimpleFilter_Operation `protobuf:"varint,1,opt,name=op,proto3,enum=neo.fs.v2.netmap.PlacementRule_SFGroup_Filter_SimpleFilter_Operation" json:"op,omitempty"` - // Types that are valid to be assigned to Args: - // *PlacementRule_SFGroup_Filter_SimpleFilter_Value - // *PlacementRule_SFGroup_Filter_SimpleFilter_FArgs - Args isPlacementRule_SFGroup_Filter_SimpleFilter_Args `protobuf_oneof:"args"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *PlacementRule_SFGroup_Filter_SimpleFilter) Reset() { - *m = PlacementRule_SFGroup_Filter_SimpleFilter{} -} -func (m *PlacementRule_SFGroup_Filter_SimpleFilter) String() string { - return proto.CompactTextString(m) -} -func (*PlacementRule_SFGroup_Filter_SimpleFilter) ProtoMessage() {} -func (*PlacementRule_SFGroup_Filter_SimpleFilter) Descriptor() ([]byte, []int) { - return fileDescriptor_1207dc80bd67ddec, []int{0, 0, 0, 1} -} -func (m *PlacementRule_SFGroup_Filter_SimpleFilter) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *PlacementRule_SFGroup_Filter_SimpleFilter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_PlacementRule_SFGroup_Filter_SimpleFilter.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *PlacementRule_SFGroup_Filter_SimpleFilter) XXX_Merge(src proto.Message) { - xxx_messageInfo_PlacementRule_SFGroup_Filter_SimpleFilter.Merge(m, src) -} -func (m *PlacementRule_SFGroup_Filter_SimpleFilter) XXX_Size() int { - return m.Size() -} -func (m *PlacementRule_SFGroup_Filter_SimpleFilter) XXX_DiscardUnknown() { - xxx_messageInfo_PlacementRule_SFGroup_Filter_SimpleFilter.DiscardUnknown(m) -} - -var xxx_messageInfo_PlacementRule_SFGroup_Filter_SimpleFilter proto.InternalMessageInfo - -type isPlacementRule_SFGroup_Filter_SimpleFilter_Args interface { - isPlacementRule_SFGroup_Filter_SimpleFilter_Args() +type isPlacementPolicy_FilterGroup_Filter_SimpleFilter_Args interface { + isPlacementPolicy_FilterGroup_Filter_SimpleFilter_Args() MarshalTo([]byte) (int, error) Size() int } -type PlacementRule_SFGroup_Filter_SimpleFilter_Value struct { +type PlacementPolicy_FilterGroup_Filter_SimpleFilter_Value struct { Value string `protobuf:"bytes,2,opt,name=value,proto3,oneof" json:"value,omitempty"` } -type PlacementRule_SFGroup_Filter_SimpleFilter_FArgs struct { - FArgs *PlacementRule_SFGroup_Filter_SimpleFilters `protobuf:"bytes,3,opt,name=f_args,json=fArgs,proto3,oneof" json:"f_args,omitempty"` +type PlacementPolicy_FilterGroup_Filter_SimpleFilter_FArgs struct { + FArgs *PlacementPolicy_FilterGroup_Filter_SimpleFilter_SimpleFilters `protobuf:"bytes,3,opt,name=f_args,json=fArgs,proto3,oneof" json:"f_args,omitempty"` } -func (*PlacementRule_SFGroup_Filter_SimpleFilter_Value) isPlacementRule_SFGroup_Filter_SimpleFilter_Args() { +func (*PlacementPolicy_FilterGroup_Filter_SimpleFilter_Value) isPlacementPolicy_FilterGroup_Filter_SimpleFilter_Args() { } -func (*PlacementRule_SFGroup_Filter_SimpleFilter_FArgs) isPlacementRule_SFGroup_Filter_SimpleFilter_Args() { +func (*PlacementPolicy_FilterGroup_Filter_SimpleFilter_FArgs) isPlacementPolicy_FilterGroup_Filter_SimpleFilter_Args() { } -func (m *PlacementRule_SFGroup_Filter_SimpleFilter) GetArgs() isPlacementRule_SFGroup_Filter_SimpleFilter_Args { +func (m *PlacementPolicy_FilterGroup_Filter_SimpleFilter) GetArgs() isPlacementPolicy_FilterGroup_Filter_SimpleFilter_Args { if m != nil { return m.Args } return nil } -func (m *PlacementRule_SFGroup_Filter_SimpleFilter) GetOp() PlacementRule_SFGroup_Filter_SimpleFilter_Operation { +func (m *PlacementPolicy_FilterGroup_Filter_SimpleFilter) GetOp() PlacementPolicy_FilterGroup_Filter_SimpleFilter_Operation { if m != nil { return m.Op } - return PlacementRule_SFGroup_Filter_SimpleFilter_NP + return PlacementPolicy_FilterGroup_Filter_SimpleFilter_OPERATION_UNSPECIFIED } -func (m *PlacementRule_SFGroup_Filter_SimpleFilter) GetValue() string { - if x, ok := m.GetArgs().(*PlacementRule_SFGroup_Filter_SimpleFilter_Value); ok { +func (m *PlacementPolicy_FilterGroup_Filter_SimpleFilter) GetValue() string { + if x, ok := m.GetArgs().(*PlacementPolicy_FilterGroup_Filter_SimpleFilter_Value); ok { return x.Value } return "" } -func (m *PlacementRule_SFGroup_Filter_SimpleFilter) GetFArgs() *PlacementRule_SFGroup_Filter_SimpleFilters { - if x, ok := m.GetArgs().(*PlacementRule_SFGroup_Filter_SimpleFilter_FArgs); ok { +func (m *PlacementPolicy_FilterGroup_Filter_SimpleFilter) GetFArgs() *PlacementPolicy_FilterGroup_Filter_SimpleFilter_SimpleFilters { + if x, ok := m.GetArgs().(*PlacementPolicy_FilterGroup_Filter_SimpleFilter_FArgs); ok { return x.FArgs } return nil } // XXX_OneofWrappers is for the internal use of the proto package. -func (*PlacementRule_SFGroup_Filter_SimpleFilter) XXX_OneofWrappers() []interface{} { +func (*PlacementPolicy_FilterGroup_Filter_SimpleFilter) XXX_OneofWrappers() []interface{} { return []interface{}{ - (*PlacementRule_SFGroup_Filter_SimpleFilter_Value)(nil), - (*PlacementRule_SFGroup_Filter_SimpleFilter_FArgs)(nil), + (*PlacementPolicy_FilterGroup_Filter_SimpleFilter_Value)(nil), + (*PlacementPolicy_FilterGroup_Filter_SimpleFilter_FArgs)(nil), } } -type PlacementRule_SFGroup_Selector struct { - Count uint32 `protobuf:"varint,1,opt,name=count,proto3" json:"count,omitempty"` - Key string `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` +// List of filters +type PlacementPolicy_FilterGroup_Filter_SimpleFilter_SimpleFilters struct { + // List of filters + Filters []*PlacementPolicy_FilterGroup_Filter_SimpleFilter `protobuf:"bytes,1,rep,name=filters,proto3" json:"filters,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *PlacementRule_SFGroup_Selector) Reset() { *m = PlacementRule_SFGroup_Selector{} } -func (m *PlacementRule_SFGroup_Selector) String() string { return proto.CompactTextString(m) } -func (*PlacementRule_SFGroup_Selector) ProtoMessage() {} -func (*PlacementRule_SFGroup_Selector) Descriptor() ([]byte, []int) { - return fileDescriptor_1207dc80bd67ddec, []int{0, 0, 1} +func (m *PlacementPolicy_FilterGroup_Filter_SimpleFilter_SimpleFilters) Reset() { + *m = PlacementPolicy_FilterGroup_Filter_SimpleFilter_SimpleFilters{} } -func (m *PlacementRule_SFGroup_Selector) XXX_Unmarshal(b []byte) error { +func (m *PlacementPolicy_FilterGroup_Filter_SimpleFilter_SimpleFilters) String() string { + return proto.CompactTextString(m) +} +func (*PlacementPolicy_FilterGroup_Filter_SimpleFilter_SimpleFilters) ProtoMessage() {} +func (*PlacementPolicy_FilterGroup_Filter_SimpleFilter_SimpleFilters) Descriptor() ([]byte, []int) { + return fileDescriptor_1207dc80bd67ddec, []int{0, 0, 0, 0, 0} +} +func (m *PlacementPolicy_FilterGroup_Filter_SimpleFilter_SimpleFilters) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *PlacementRule_SFGroup_Selector) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *PlacementPolicy_FilterGroup_Filter_SimpleFilter_SimpleFilters) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_PlacementRule_SFGroup_Selector.Marshal(b, m, deterministic) + return xxx_messageInfo_PlacementPolicy_FilterGroup_Filter_SimpleFilter_SimpleFilters.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -455,37 +433,88 @@ func (m *PlacementRule_SFGroup_Selector) XXX_Marshal(b []byte, deterministic boo return b[:n], nil } } -func (m *PlacementRule_SFGroup_Selector) XXX_Merge(src proto.Message) { - xxx_messageInfo_PlacementRule_SFGroup_Selector.Merge(m, src) +func (m *PlacementPolicy_FilterGroup_Filter_SimpleFilter_SimpleFilters) XXX_Merge(src proto.Message) { + xxx_messageInfo_PlacementPolicy_FilterGroup_Filter_SimpleFilter_SimpleFilters.Merge(m, src) } -func (m *PlacementRule_SFGroup_Selector) XXX_Size() int { +func (m *PlacementPolicy_FilterGroup_Filter_SimpleFilter_SimpleFilters) XXX_Size() int { return m.Size() } -func (m *PlacementRule_SFGroup_Selector) XXX_DiscardUnknown() { - xxx_messageInfo_PlacementRule_SFGroup_Selector.DiscardUnknown(m) +func (m *PlacementPolicy_FilterGroup_Filter_SimpleFilter_SimpleFilters) XXX_DiscardUnknown() { + xxx_messageInfo_PlacementPolicy_FilterGroup_Filter_SimpleFilter_SimpleFilters.DiscardUnknown(m) } -var xxx_messageInfo_PlacementRule_SFGroup_Selector proto.InternalMessageInfo +var xxx_messageInfo_PlacementPolicy_FilterGroup_Filter_SimpleFilter_SimpleFilters proto.InternalMessageInfo -func (m *PlacementRule_SFGroup_Selector) GetCount() uint32 { +func (m *PlacementPolicy_FilterGroup_Filter_SimpleFilter_SimpleFilters) GetFilters() []*PlacementPolicy_FilterGroup_Filter_SimpleFilter { + if m != nil { + return m.Filters + } + return nil +} + +// Selector +type PlacementPolicy_FilterGroup_Selector struct { + // How many to select + Count uint32 `protobuf:"varint,1,opt,name=count,proto3" json:"count,omitempty"` + // Key to select + Key string `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *PlacementPolicy_FilterGroup_Selector) Reset() { *m = PlacementPolicy_FilterGroup_Selector{} } +func (m *PlacementPolicy_FilterGroup_Selector) String() string { return proto.CompactTextString(m) } +func (*PlacementPolicy_FilterGroup_Selector) ProtoMessage() {} +func (*PlacementPolicy_FilterGroup_Selector) Descriptor() ([]byte, []int) { + return fileDescriptor_1207dc80bd67ddec, []int{0, 0, 1} +} +func (m *PlacementPolicy_FilterGroup_Selector) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *PlacementPolicy_FilterGroup_Selector) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_PlacementPolicy_FilterGroup_Selector.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *PlacementPolicy_FilterGroup_Selector) XXX_Merge(src proto.Message) { + xxx_messageInfo_PlacementPolicy_FilterGroup_Selector.Merge(m, src) +} +func (m *PlacementPolicy_FilterGroup_Selector) XXX_Size() int { + return m.Size() +} +func (m *PlacementPolicy_FilterGroup_Selector) XXX_DiscardUnknown() { + xxx_messageInfo_PlacementPolicy_FilterGroup_Selector.DiscardUnknown(m) +} + +var xxx_messageInfo_PlacementPolicy_FilterGroup_Selector proto.InternalMessageInfo + +func (m *PlacementPolicy_FilterGroup_Selector) GetCount() uint32 { if m != nil { return m.Count } return 0 } -func (m *PlacementRule_SFGroup_Selector) GetKey() string { +func (m *PlacementPolicy_FilterGroup_Selector) GetKey() string { if m != nil { return m.Key } return "" } -// Groups the information about the NeoFS node. +// NeoFS node description type NodeInfo struct { - // Carries network address of the NeoFS node. + // Ways to connect to a node Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` - // Carries public key of the NeoFS node in a binary format. + // Public key of the NeoFS node in a binary format. PublicKey []byte `protobuf:"bytes,2,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"` // Carries list of the NeoFS node attributes in a string key-value format. Attributes []*NodeInfo_Attribute `protobuf:"bytes,3,rep,name=attributes,proto3" json:"attributes,omitempty"` @@ -554,14 +583,14 @@ func (m *NodeInfo) GetState() NodeInfo_State { if m != nil { return m.State } - return NodeInfo_UNKNOWN + return NodeInfo_UNSPECIFIED } -// Groups attributes of the NeoFS node. +// Attributes of the NeoFS node. type NodeInfo_Attribute struct { - // Carries string key to the node attribute. + // Key of the node attribute. Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - // Carries string value of the node attribute. + // Value of the node attribute. Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -616,14 +645,14 @@ func (m *NodeInfo_Attribute) GetValue() string { } func init() { - proto.RegisterEnum("neo.fs.v2.netmap.PlacementRule_SFGroup_Filter_SimpleFilter_Operation", PlacementRule_SFGroup_Filter_SimpleFilter_Operation_name, PlacementRule_SFGroup_Filter_SimpleFilter_Operation_value) + proto.RegisterEnum("neo.fs.v2.netmap.PlacementPolicy_FilterGroup_Filter_SimpleFilter_Operation", PlacementPolicy_FilterGroup_Filter_SimpleFilter_Operation_name, PlacementPolicy_FilterGroup_Filter_SimpleFilter_Operation_value) proto.RegisterEnum("neo.fs.v2.netmap.NodeInfo_State", NodeInfo_State_name, NodeInfo_State_value) - proto.RegisterType((*PlacementRule)(nil), "neo.fs.v2.netmap.PlacementRule") - proto.RegisterType((*PlacementRule_SFGroup)(nil), "neo.fs.v2.netmap.PlacementRule.SFGroup") - proto.RegisterType((*PlacementRule_SFGroup_Filter)(nil), "neo.fs.v2.netmap.PlacementRule.SFGroup.Filter") - proto.RegisterType((*PlacementRule_SFGroup_Filter_SimpleFilters)(nil), "neo.fs.v2.netmap.PlacementRule.SFGroup.Filter.SimpleFilters") - proto.RegisterType((*PlacementRule_SFGroup_Filter_SimpleFilter)(nil), "neo.fs.v2.netmap.PlacementRule.SFGroup.Filter.SimpleFilter") - proto.RegisterType((*PlacementRule_SFGroup_Selector)(nil), "neo.fs.v2.netmap.PlacementRule.SFGroup.Selector") + proto.RegisterType((*PlacementPolicy)(nil), "neo.fs.v2.netmap.PlacementPolicy") + proto.RegisterType((*PlacementPolicy_FilterGroup)(nil), "neo.fs.v2.netmap.PlacementPolicy.FilterGroup") + proto.RegisterType((*PlacementPolicy_FilterGroup_Filter)(nil), "neo.fs.v2.netmap.PlacementPolicy.FilterGroup.Filter") + proto.RegisterType((*PlacementPolicy_FilterGroup_Filter_SimpleFilter)(nil), "neo.fs.v2.netmap.PlacementPolicy.FilterGroup.Filter.SimpleFilter") + proto.RegisterType((*PlacementPolicy_FilterGroup_Filter_SimpleFilter_SimpleFilters)(nil), "neo.fs.v2.netmap.PlacementPolicy.FilterGroup.Filter.SimpleFilter.SimpleFilters") + proto.RegisterType((*PlacementPolicy_FilterGroup_Selector)(nil), "neo.fs.v2.netmap.PlacementPolicy.FilterGroup.Selector") proto.RegisterType((*NodeInfo)(nil), "neo.fs.v2.netmap.NodeInfo") proto.RegisterType((*NodeInfo_Attribute)(nil), "neo.fs.v2.netmap.NodeInfo.Attribute") } @@ -631,51 +660,52 @@ func init() { func init() { proto.RegisterFile("v2/netmap/types.proto", fileDescriptor_1207dc80bd67ddec) } var fileDescriptor_1207dc80bd67ddec = []byte{ - // 641 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x54, 0xc1, 0x6e, 0xd3, 0x4c, - 0x10, 0x8e, 0xed, 0xc4, 0x89, 0x27, 0xcd, 0xaf, 0xd5, 0xaa, 0x3f, 0xb2, 0x22, 0x11, 0xa2, 0x08, - 0x89, 0x48, 0x28, 0x1b, 0xe4, 0x4a, 0x5c, 0xe0, 0x92, 0xaa, 0x49, 0x1b, 0xb5, 0x72, 0x82, 0xd3, - 0x08, 0x89, 0x4b, 0xe4, 0x38, 0xeb, 0x60, 0xe1, 0x78, 0x2d, 0xef, 0x3a, 0xa2, 0x57, 0x9e, 0x82, - 0x17, 0xe0, 0xc2, 0x91, 0xa7, 0xe0, 0xc8, 0x23, 0xa0, 0xf2, 0x00, 0xdc, 0x38, 0x23, 0x6f, 0xe2, - 0xd0, 0x16, 0x84, 0x8a, 0x7a, 0x1a, 0xcf, 0xb7, 0x33, 0xdf, 0xb7, 0x3b, 0xfb, 0x79, 0xe1, 0xff, - 0xb5, 0xd5, 0x8d, 0xa8, 0x58, 0xb9, 0x71, 0x57, 0x5c, 0xc4, 0x94, 0x93, 0x38, 0x61, 0x82, 0x61, - 0x14, 0x51, 0x46, 0x7c, 0x4e, 0xd6, 0x16, 0xd9, 0xac, 0xb6, 0xbe, 0xeb, 0x50, 0x1b, 0x87, 0xae, - 0x47, 0x57, 0x34, 0x12, 0x4e, 0x1a, 0x52, 0xfc, 0x00, 0xaa, 0x09, 0x8d, 0xc3, 0x99, 0xef, 0x7a, - 0x82, 0x25, 0xa6, 0xd2, 0x54, 0xda, 0x35, 0x07, 0x32, 0x68, 0x20, 0x11, 0x7c, 0x04, 0x06, 0xf7, - 0x67, 0xcb, 0x84, 0xa5, 0x31, 0x37, 0xd5, 0xa6, 0xd6, 0xae, 0x5a, 0x8f, 0xc8, 0x4d, 0x62, 0x72, - 0x8d, 0x94, 0x4c, 0x06, 0xc7, 0x59, 0xbd, 0x53, 0xe1, 0xbe, 0xfc, 0xe0, 0xf5, 0x1f, 0x25, 0x28, - 0x6f, 0x51, 0x7c, 0x02, 0x65, 0x3f, 0x08, 0x05, 0x4d, 0xb8, 0xa9, 0x48, 0x3e, 0x72, 0x4b, 0x3e, - 0x32, 0x90, 0x6d, 0x4e, 0xde, 0x8e, 0x6d, 0x30, 0x38, 0x0d, 0x69, 0xb6, 0xcf, 0x7c, 0x6f, 0x4f, - 0x6e, 0xcb, 0x35, 0xd9, 0x36, 0x3a, 0xbf, 0x28, 0xb0, 0x09, 0x65, 0xfa, 0xd6, 0x0b, 0xd3, 0x05, - 0x35, 0xb5, 0xa6, 0xd6, 0xae, 0x39, 0x79, 0x5a, 0x7f, 0x57, 0x04, 0x7d, 0xa3, 0x8e, 0x11, 0x68, - 0x6f, 0xe8, 0x85, 0x9c, 0x94, 0xe1, 0x64, 0x9f, 0x78, 0x08, 0x8a, 0x6f, 0xaa, 0x4d, 0xa5, 0x5d, - 0xb5, 0x9e, 0xfd, 0xdb, 0x51, 0xc8, 0x24, 0x58, 0xc5, 0x21, 0xdd, 0x9e, 0x4b, 0xf1, 0xeb, 0x3e, - 0xd4, 0xae, 0x42, 0x1c, 0x4f, 0x6f, 0x0e, 0xeb, 0x4e, 0x0a, 0x39, 0x57, 0xfd, 0x93, 0x0a, 0x7b, - 0x57, 0x57, 0xf0, 0x14, 0x54, 0x16, 0xcb, 0x43, 0xfd, 0x67, 0xf5, 0xef, 0x20, 0x41, 0x46, 0x31, - 0x4d, 0x5c, 0x11, 0xb0, 0xc8, 0x51, 0x59, 0x8c, 0xef, 0x41, 0x69, 0xed, 0x86, 0x29, 0x95, 0xe3, - 0x31, 0x4e, 0x0a, 0xce, 0x26, 0xc5, 0x53, 0xd0, 0xfd, 0x99, 0x9b, 0x2c, 0xb9, 0xa9, 0xc9, 0xb9, - 0x3d, 0xbf, 0x83, 0x24, 0xcf, 0x68, 0xfd, 0x5e, 0xb2, 0xe4, 0xad, 0x73, 0x30, 0x76, 0xfa, 0x58, - 0x07, 0xd5, 0x1e, 0xa3, 0x42, 0x16, 0xfb, 0x2f, 0x90, 0x22, 0xf3, 0x3e, 0x52, 0xb3, 0x78, 0x7c, - 0x8e, 0x34, 0x19, 0xfb, 0xa8, 0x98, 0xc5, 0xb3, 0x73, 0x54, 0x92, 0xb1, 0x8f, 0xf4, 0x2c, 0x8e, - 0x1c, 0x54, 0xc6, 0x65, 0xd0, 0x7a, 0xf6, 0x11, 0xaa, 0x1c, 0xea, 0x50, 0xcc, 0xb6, 0x5a, 0xb7, - 0xa0, 0x92, 0xbb, 0x06, 0xef, 0x43, 0xc9, 0x63, 0x69, 0x24, 0xb6, 0x7f, 0xcc, 0x26, 0xc9, 0xbd, - 0xa1, 0xee, 0xbc, 0xd1, 0xfa, 0xa0, 0x42, 0xc5, 0x66, 0x0b, 0x3a, 0x8c, 0x7c, 0x96, 0xf9, 0xcb, - 0x5d, 0x2c, 0x12, 0xca, 0xf9, 0xd6, 0x3e, 0x79, 0x8a, 0xef, 0x03, 0xc4, 0xe9, 0x3c, 0x0c, 0xbc, - 0x59, 0xde, 0xbf, 0xe7, 0x18, 0x1b, 0xe4, 0x94, 0x5e, 0xe0, 0x23, 0x00, 0x57, 0x88, 0x24, 0x98, - 0xa7, 0x82, 0x72, 0xe9, 0xcd, 0xaa, 0xf5, 0xf0, 0xf7, 0x91, 0xe5, 0x42, 0xa4, 0x97, 0x17, 0x3b, - 0x57, 0xfa, 0xf0, 0x53, 0x28, 0x71, 0xe1, 0x0a, 0x6a, 0x16, 0xe5, 0x35, 0x37, 0xff, 0x42, 0x30, - 0xc9, 0xea, 0x9c, 0x4d, 0x79, 0xfd, 0x00, 0x8c, 0x1d, 0xe1, 0x1f, 0xec, 0xbf, 0x7f, 0xed, 0x8e, - 0xb7, 0x37, 0xdc, 0xea, 0x40, 0x49, 0x92, 0xe0, 0x2a, 0x94, 0xa7, 0xf6, 0xa9, 0x3d, 0x7a, 0x69, - 0xa3, 0x02, 0x06, 0xd0, 0x47, 0xf6, 0xd9, 0xd0, 0xee, 0x23, 0x25, 0x5b, 0x18, 0x0d, 0x06, 0x32, - 0x51, 0x0f, 0xc7, 0x9f, 0x2f, 0x1b, 0xca, 0x97, 0xcb, 0x86, 0xf2, 0xf5, 0xb2, 0xa1, 0xbc, 0xff, - 0xd6, 0x28, 0xbc, 0x7a, 0xbc, 0x0c, 0xc4, 0xeb, 0x74, 0x4e, 0x3c, 0xb6, 0xea, 0x46, 0x3c, 0xf6, - 0xbc, 0xce, 0x82, 0xae, 0xbb, 0x11, 0x65, 0x3e, 0xef, 0xb8, 0x71, 0xd0, 0x59, 0xb2, 0xee, 0xee, - 0xd9, 0xfb, 0xa8, 0x22, 0x9b, 0xb2, 0xc1, 0x84, 0xf4, 0xc6, 0x43, 0x62, 0x4b, 0x68, 0xae, 0xcb, - 0x47, 0xf0, 0xe0, 0x67, 0x00, 0x00, 0x00, 0xff, 0xff, 0x8c, 0x8c, 0xb2, 0x91, 0x1d, 0x05, 0x00, - 0x00, + // 660 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x54, 0xc1, 0x6e, 0xd3, 0x4c, + 0x10, 0xae, 0xed, 0xc4, 0x69, 0x26, 0xcd, 0x5f, 0x6b, 0xff, 0x16, 0x99, 0x48, 0x84, 0x28, 0xe2, + 0x90, 0x4b, 0x1c, 0xe1, 0xa2, 0x5e, 0x38, 0xa5, 0xd4, 0x29, 0x51, 0x2b, 0x3b, 0x38, 0xe1, 0xd2, + 0x1e, 0x22, 0xc7, 0x59, 0xa7, 0x16, 0x8e, 0xd7, 0xf2, 0xae, 0x23, 0xf2, 0x26, 0xbc, 0x02, 0x3c, + 0x02, 0x07, 0xae, 0x70, 0xe0, 0xc0, 0x23, 0xa0, 0xf2, 0x22, 0xc8, 0xeb, 0x38, 0x4d, 0x0b, 0x42, + 0x2a, 0xe5, 0xf4, 0xf9, 0x9b, 0xd9, 0xf9, 0xc6, 0x33, 0xfe, 0xbc, 0xb0, 0xbf, 0xd0, 0x3b, 0x21, + 0x66, 0x73, 0x27, 0xea, 0xb0, 0x65, 0x84, 0xa9, 0x16, 0xc5, 0x84, 0x11, 0xa4, 0x84, 0x98, 0x68, + 0x1e, 0xd5, 0x16, 0xba, 0x96, 0x65, 0x9b, 0x9f, 0x4b, 0xb0, 0x3b, 0x08, 0x1c, 0x17, 0xcf, 0x71, + 0xc8, 0x06, 0x24, 0xf0, 0xdd, 0x25, 0x7a, 0x0c, 0x95, 0x18, 0x47, 0xc1, 0xd8, 0x73, 0x5c, 0x46, + 0x62, 0x55, 0x68, 0x08, 0xad, 0xaa, 0x0d, 0x69, 0xa8, 0xc7, 0x23, 0xc8, 0x86, 0xaa, 0xe7, 0x07, + 0x0c, 0xc7, 0xe3, 0x59, 0x4c, 0x92, 0x88, 0xaa, 0x62, 0x43, 0x6a, 0x55, 0xf4, 0xb6, 0x76, 0x5b, + 0x5e, 0xbb, 0x25, 0xad, 0xf5, 0x78, 0xd9, 0x49, 0x5a, 0x65, 0xef, 0x78, 0xd7, 0x84, 0xd6, 0x3e, + 0xc9, 0x50, 0xd9, 0xc8, 0x22, 0x13, 0x4a, 0x59, 0x9e, 0xaa, 0x02, 0x57, 0x7f, 0x76, 0x27, 0xf5, + 0xd5, 0xb3, 0x9d, 0x8b, 0xa0, 0x11, 0x94, 0x29, 0x0e, 0x70, 0xfa, 0xfe, 0xf9, 0xfb, 0x1e, 0xde, + 0x4d, 0x71, 0xb8, 0x2a, 0xb7, 0xaf, 0x85, 0x90, 0x0a, 0x25, 0xfc, 0xd6, 0x0d, 0x92, 0x29, 0x56, + 0xa5, 0x86, 0xd4, 0xaa, 0xda, 0x39, 0xad, 0x7d, 0x2c, 0x80, 0x9c, 0x55, 0x23, 0x05, 0xa4, 0x37, + 0x78, 0xc9, 0xf7, 0x58, 0xb6, 0xd3, 0x47, 0x64, 0x81, 0xe0, 0xa9, 0x62, 0x43, 0x68, 0x55, 0xf4, + 0xee, 0xdf, 0x8c, 0xa5, 0x0d, 0xfd, 0x79, 0x14, 0xe0, 0xd5, 0x8c, 0x82, 0x57, 0xfb, 0x2a, 0xc1, + 0xce, 0x66, 0x0c, 0x5d, 0x80, 0x48, 0x22, 0xde, 0xf2, 0x3f, 0xfd, 0xf4, 0xde, 0x2d, 0x34, 0x2b, + 0xc2, 0xb1, 0xc3, 0x7c, 0x12, 0xda, 0x22, 0x89, 0xd0, 0x03, 0x28, 0x2e, 0x9c, 0x20, 0xc1, 0x7c, + 0x84, 0xf2, 0xcb, 0x2d, 0x3b, 0xa3, 0xe8, 0x12, 0x64, 0x6f, 0xec, 0xc4, 0x33, 0xaa, 0x4a, 0x7c, + 0x36, 0xeb, 0xfe, 0x8d, 0x37, 0x09, 0x4d, 0x3b, 0x79, 0xdd, 0x78, 0x46, 0x6b, 0x01, 0x54, 0x6f, + 0x64, 0xd0, 0xc5, 0x6d, 0xbb, 0xfc, 0x83, 0xbd, 0xe6, 0x8a, 0xcd, 0x19, 0x94, 0xd7, 0x0b, 0x40, + 0x0f, 0x61, 0xdf, 0x1a, 0x18, 0x76, 0x77, 0xd4, 0xb7, 0xcc, 0xf1, 0x6b, 0x73, 0x38, 0x30, 0x5e, + 0xf4, 0x7b, 0x7d, 0xe3, 0x58, 0xd9, 0x42, 0x32, 0x88, 0xc6, 0x2b, 0x45, 0x48, 0xd1, 0x34, 0x14, + 0x31, 0xc5, 0x93, 0x91, 0x22, 0x71, 0x34, 0x94, 0x42, 0x8a, 0x67, 0x23, 0xa5, 0xc8, 0xd1, 0x50, + 0xe4, 0x14, 0x2d, 0x5b, 0x29, 0xa1, 0x12, 0x48, 0x5d, 0xf3, 0x58, 0xd9, 0x3e, 0x92, 0xa1, 0x90, + 0xae, 0xaf, 0xa6, 0xc3, 0x76, 0xee, 0x36, 0xb4, 0x07, 0x45, 0x97, 0x24, 0x21, 0x5b, 0xfd, 0x87, + 0x19, 0xc9, 0x3d, 0x25, 0xae, 0x3d, 0xd5, 0x7c, 0x2f, 0xc2, 0xb6, 0x49, 0xa6, 0xb8, 0x1f, 0x7a, + 0x24, 0xf5, 0xa5, 0x33, 0x9d, 0xc6, 0x98, 0xd2, 0x95, 0xed, 0x72, 0x8a, 0x1e, 0x01, 0x44, 0xc9, + 0x24, 0xf0, 0xdd, 0x71, 0x5e, 0xbf, 0x63, 0x97, 0xb3, 0xc8, 0x29, 0x5e, 0xa2, 0x63, 0x00, 0x87, + 0xb1, 0xd8, 0x9f, 0x24, 0x0c, 0x53, 0xee, 0xe9, 0x8a, 0xfe, 0xe4, 0xd7, 0x55, 0xe6, 0x8d, 0xb4, + 0x6e, 0x7e, 0xd8, 0xde, 0xa8, 0x43, 0x87, 0x50, 0xa4, 0xcc, 0x61, 0x58, 0x2d, 0x70, 0x03, 0x36, + 0xfe, 0x20, 0x30, 0x4c, 0xcf, 0xd9, 0xd9, 0xf1, 0xda, 0x01, 0x94, 0xd7, 0x82, 0xbf, 0xf9, 0x6d, + 0xf6, 0x6e, 0xf8, 0x6e, 0xe5, 0xba, 0xe6, 0x53, 0x28, 0x72, 0x11, 0xb4, 0x0b, 0x95, 0x9b, 0xdf, + 0x03, 0x40, 0xb6, 0xcc, 0xb3, 0xbe, 0x69, 0x28, 0x02, 0xaa, 0x40, 0xc9, 0xea, 0xf5, 0x38, 0x11, + 0x8f, 0xce, 0xbf, 0x5c, 0xd5, 0x85, 0x6f, 0x57, 0x75, 0xe1, 0xfb, 0x55, 0x5d, 0x78, 0xf7, 0xa3, + 0xbe, 0x75, 0xae, 0xcf, 0x7c, 0x76, 0x99, 0x4c, 0x34, 0x97, 0xcc, 0x3b, 0x21, 0x8d, 0x5c, 0xb7, + 0x3d, 0xc5, 0x8b, 0x4e, 0x88, 0x89, 0x47, 0xdb, 0x4e, 0xe4, 0xb7, 0x67, 0xa4, 0xb3, 0xbe, 0x52, + 0x9f, 0x67, 0xf0, 0x41, 0xfc, 0xdf, 0xc4, 0xa4, 0x37, 0xd4, 0xba, 0x83, 0x7e, 0x3a, 0x99, 0xc9, + 0xa3, 0x13, 0x99, 0x5f, 0xb5, 0x07, 0x3f, 0x03, 0x00, 0x00, 0xff, 0xff, 0x2d, 0xc4, 0x82, 0xde, + 0x83, 0x05, 0x00, 0x00, } -func (m *PlacementRule) Marshal() (dAtA []byte, err error) { +func (m *PlacementPolicy) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -685,12 +715,12 @@ func (m *PlacementRule) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *PlacementRule) MarshalTo(dAtA []byte) (int, error) { +func (m *PlacementPolicy) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *PlacementRule) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *PlacementPolicy) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -699,10 +729,10 @@ func (m *PlacementRule) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } - if len(m.SfGroups) > 0 { - for iNdEx := len(m.SfGroups) - 1; iNdEx >= 0; iNdEx-- { + if len(m.FilterGroups) > 0 { + for iNdEx := len(m.FilterGroups) - 1; iNdEx >= 0; iNdEx-- { { - size, err := m.SfGroups[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + size, err := m.FilterGroups[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -721,7 +751,7 @@ func (m *PlacementRule) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *PlacementRule_SFGroup) Marshal() (dAtA []byte, err error) { +func (m *PlacementPolicy_FilterGroup) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -731,12 +761,12 @@ func (m *PlacementRule_SFGroup) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *PlacementRule_SFGroup) MarshalTo(dAtA []byte) (int, error) { +func (m *PlacementPolicy_FilterGroup) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *PlacementRule_SFGroup) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *PlacementPolicy_FilterGroup) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -794,7 +824,7 @@ func (m *PlacementRule_SFGroup) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *PlacementRule_SFGroup_Filter) Marshal() (dAtA []byte, err error) { +func (m *PlacementPolicy_FilterGroup_Filter) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -804,12 +834,12 @@ func (m *PlacementRule_SFGroup_Filter) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *PlacementRule_SFGroup_Filter) MarshalTo(dAtA []byte) (int, error) { +func (m *PlacementPolicy_FilterGroup_Filter) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *PlacementRule_SFGroup_Filter) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *PlacementPolicy_FilterGroup_Filter) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -840,7 +870,7 @@ func (m *PlacementRule_SFGroup_Filter) MarshalToSizedBuffer(dAtA []byte) (int, e return len(dAtA) - i, nil } -func (m *PlacementRule_SFGroup_Filter_SimpleFilters) Marshal() (dAtA []byte, err error) { +func (m *PlacementPolicy_FilterGroup_Filter_SimpleFilter) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -850,53 +880,12 @@ func (m *PlacementRule_SFGroup_Filter_SimpleFilters) Marshal() (dAtA []byte, err return dAtA[:n], nil } -func (m *PlacementRule_SFGroup_Filter_SimpleFilters) MarshalTo(dAtA []byte) (int, error) { +func (m *PlacementPolicy_FilterGroup_Filter_SimpleFilter) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *PlacementRule_SFGroup_Filter_SimpleFilters) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.Filters) > 0 { - for iNdEx := len(m.Filters) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Filters[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *PlacementRule_SFGroup_Filter_SimpleFilter) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *PlacementRule_SFGroup_Filter_SimpleFilter) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *PlacementRule_SFGroup_Filter_SimpleFilter) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *PlacementPolicy_FilterGroup_Filter_SimpleFilter) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -922,12 +911,12 @@ func (m *PlacementRule_SFGroup_Filter_SimpleFilter) MarshalToSizedBuffer(dAtA [] return len(dAtA) - i, nil } -func (m *PlacementRule_SFGroup_Filter_SimpleFilter_Value) MarshalTo(dAtA []byte) (int, error) { +func (m *PlacementPolicy_FilterGroup_Filter_SimpleFilter_Value) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *PlacementRule_SFGroup_Filter_SimpleFilter_Value) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *PlacementPolicy_FilterGroup_Filter_SimpleFilter_Value) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) i -= len(m.Value) copy(dAtA[i:], m.Value) @@ -936,12 +925,12 @@ func (m *PlacementRule_SFGroup_Filter_SimpleFilter_Value) MarshalToSizedBuffer(d dAtA[i] = 0x12 return len(dAtA) - i, nil } -func (m *PlacementRule_SFGroup_Filter_SimpleFilter_FArgs) MarshalTo(dAtA []byte) (int, error) { +func (m *PlacementPolicy_FilterGroup_Filter_SimpleFilter_FArgs) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *PlacementRule_SFGroup_Filter_SimpleFilter_FArgs) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *PlacementPolicy_FilterGroup_Filter_SimpleFilter_FArgs) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) if m.FArgs != nil { { @@ -957,7 +946,7 @@ func (m *PlacementRule_SFGroup_Filter_SimpleFilter_FArgs) MarshalToSizedBuffer(d } return len(dAtA) - i, nil } -func (m *PlacementRule_SFGroup_Selector) Marshal() (dAtA []byte, err error) { +func (m *PlacementPolicy_FilterGroup_Filter_SimpleFilter_SimpleFilters) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -967,12 +956,53 @@ func (m *PlacementRule_SFGroup_Selector) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *PlacementRule_SFGroup_Selector) MarshalTo(dAtA []byte) (int, error) { +func (m *PlacementPolicy_FilterGroup_Filter_SimpleFilter_SimpleFilters) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *PlacementRule_SFGroup_Selector) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *PlacementPolicy_FilterGroup_Filter_SimpleFilter_SimpleFilters) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Filters) > 0 { + for iNdEx := len(m.Filters) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Filters[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *PlacementPolicy_FilterGroup_Selector) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PlacementPolicy_FilterGroup_Selector) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PlacementPolicy_FilterGroup_Selector) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1108,7 +1138,7 @@ func encodeVarintTypes(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } -func (m *PlacementRule) Size() (n int) { +func (m *PlacementPolicy) Size() (n int) { if m == nil { return 0 } @@ -1117,8 +1147,8 @@ func (m *PlacementRule) Size() (n int) { if m.ReplFactor != 0 { n += 1 + sovTypes(uint64(m.ReplFactor)) } - if len(m.SfGroups) > 0 { - for _, e := range m.SfGroups { + if len(m.FilterGroups) > 0 { + for _, e := range m.FilterGroups { l = e.Size() n += 1 + l + sovTypes(uint64(l)) } @@ -1129,7 +1159,7 @@ func (m *PlacementRule) Size() (n int) { return n } -func (m *PlacementRule_SFGroup) Size() (n int) { +func (m *PlacementPolicy_FilterGroup) Size() (n int) { if m == nil { return 0 } @@ -1160,7 +1190,7 @@ func (m *PlacementRule_SFGroup) Size() (n int) { return n } -func (m *PlacementRule_SFGroup_Filter) Size() (n int) { +func (m *PlacementPolicy_FilterGroup_Filter) Size() (n int) { if m == nil { return 0 } @@ -1180,25 +1210,7 @@ func (m *PlacementRule_SFGroup_Filter) Size() (n int) { return n } -func (m *PlacementRule_SFGroup_Filter_SimpleFilters) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Filters) > 0 { - for _, e := range m.Filters { - l = e.Size() - n += 1 + l + sovTypes(uint64(l)) - } - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *PlacementRule_SFGroup_Filter_SimpleFilter) Size() (n int) { +func (m *PlacementPolicy_FilterGroup_Filter_SimpleFilter) Size() (n int) { if m == nil { return 0 } @@ -1216,7 +1228,7 @@ func (m *PlacementRule_SFGroup_Filter_SimpleFilter) Size() (n int) { return n } -func (m *PlacementRule_SFGroup_Filter_SimpleFilter_Value) Size() (n int) { +func (m *PlacementPolicy_FilterGroup_Filter_SimpleFilter_Value) Size() (n int) { if m == nil { return 0 } @@ -1226,7 +1238,7 @@ func (m *PlacementRule_SFGroup_Filter_SimpleFilter_Value) Size() (n int) { n += 1 + l + sovTypes(uint64(l)) return n } -func (m *PlacementRule_SFGroup_Filter_SimpleFilter_FArgs) Size() (n int) { +func (m *PlacementPolicy_FilterGroup_Filter_SimpleFilter_FArgs) Size() (n int) { if m == nil { return 0 } @@ -1238,7 +1250,25 @@ func (m *PlacementRule_SFGroup_Filter_SimpleFilter_FArgs) Size() (n int) { } return n } -func (m *PlacementRule_SFGroup_Selector) Size() (n int) { +func (m *PlacementPolicy_FilterGroup_Filter_SimpleFilter_SimpleFilters) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Filters) > 0 { + for _, e := range m.Filters { + l = e.Size() + n += 1 + l + sovTypes(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *PlacementPolicy_FilterGroup_Selector) Size() (n int) { if m == nil { return 0 } @@ -1312,7 +1342,7 @@ func sovTypes(x uint64) (n int) { func sozTypes(x uint64) (n int) { return sovTypes(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } -func (m *PlacementRule) Unmarshal(dAtA []byte) error { +func (m *PlacementPolicy) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1335,10 +1365,10 @@ func (m *PlacementRule) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: PlacementRule: wiretype end group for non-group") + return fmt.Errorf("proto: PlacementPolicy: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: PlacementRule: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: PlacementPolicy: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -1362,7 +1392,7 @@ func (m *PlacementRule) Unmarshal(dAtA []byte) error { } case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SfGroups", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field FilterGroups", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -1389,8 +1419,8 @@ func (m *PlacementRule) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.SfGroups = append(m.SfGroups, &PlacementRule_SFGroup{}) - if err := m.SfGroups[len(m.SfGroups)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.FilterGroups = append(m.FilterGroups, &PlacementPolicy_FilterGroup{}) + if err := m.FilterGroups[len(m.FilterGroups)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -1419,7 +1449,7 @@ func (m *PlacementRule) Unmarshal(dAtA []byte) error { } return nil } -func (m *PlacementRule_SFGroup) Unmarshal(dAtA []byte) error { +func (m *PlacementPolicy_FilterGroup) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1442,10 +1472,10 @@ func (m *PlacementRule_SFGroup) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: SFGroup: wiretype end group for non-group") + return fmt.Errorf("proto: FilterGroup: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: SFGroup: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: FilterGroup: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -1477,7 +1507,7 @@ func (m *PlacementRule_SFGroup) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Filters = append(m.Filters, &PlacementRule_SFGroup_Filter{}) + m.Filters = append(m.Filters, &PlacementPolicy_FilterGroup_Filter{}) if err := m.Filters[len(m.Filters)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -1511,7 +1541,7 @@ func (m *PlacementRule_SFGroup) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Selectors = append(m.Selectors, &PlacementRule_SFGroup_Selector{}) + m.Selectors = append(m.Selectors, &PlacementPolicy_FilterGroup_Selector{}) if err := m.Selectors[len(m.Selectors)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -1617,7 +1647,7 @@ func (m *PlacementRule_SFGroup) Unmarshal(dAtA []byte) error { } return nil } -func (m *PlacementRule_SFGroup_Filter) Unmarshal(dAtA []byte) error { +func (m *PlacementPolicy_FilterGroup_Filter) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1708,7 +1738,7 @@ func (m *PlacementRule_SFGroup_Filter) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.F == nil { - m.F = &PlacementRule_SFGroup_Filter_SimpleFilter{} + m.F = &PlacementPolicy_FilterGroup_Filter_SimpleFilter{} } if err := m.F.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -1739,7 +1769,147 @@ func (m *PlacementRule_SFGroup_Filter) Unmarshal(dAtA []byte) error { } return nil } -func (m *PlacementRule_SFGroup_Filter_SimpleFilters) Unmarshal(dAtA []byte) error { +func (m *PlacementPolicy_FilterGroup_Filter_SimpleFilter) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: SimpleFilter: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SimpleFilter: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Op", wireType) + } + m.Op = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Op |= PlacementPolicy_FilterGroup_Filter_SimpleFilter_Operation(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Args = &PlacementPolicy_FilterGroup_Filter_SimpleFilter_Value{string(dAtA[iNdEx:postIndex])} + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FArgs", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &PlacementPolicy_FilterGroup_Filter_SimpleFilter_SimpleFilters{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Args = &PlacementPolicy_FilterGroup_Filter_SimpleFilter_FArgs{v} + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *PlacementPolicy_FilterGroup_Filter_SimpleFilter_SimpleFilters) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1797,7 +1967,7 @@ func (m *PlacementRule_SFGroup_Filter_SimpleFilters) Unmarshal(dAtA []byte) erro if postIndex > l { return io.ErrUnexpectedEOF } - m.Filters = append(m.Filters, &PlacementRule_SFGroup_Filter_SimpleFilter{}) + m.Filters = append(m.Filters, &PlacementPolicy_FilterGroup_Filter_SimpleFilter{}) if err := m.Filters[len(m.Filters)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -1827,147 +1997,7 @@ func (m *PlacementRule_SFGroup_Filter_SimpleFilters) Unmarshal(dAtA []byte) erro } return nil } -func (m *PlacementRule_SFGroup_Filter_SimpleFilter) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: SimpleFilter: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: SimpleFilter: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Op", wireType) - } - m.Op = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Op |= PlacementRule_SFGroup_Filter_SimpleFilter_Operation(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Args = &PlacementRule_SFGroup_Filter_SimpleFilter_Value{string(dAtA[iNdEx:postIndex])} - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field FArgs", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := &PlacementRule_SFGroup_Filter_SimpleFilters{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Args = &PlacementRule_SFGroup_Filter_SimpleFilter_FArgs{v} - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *PlacementRule_SFGroup_Selector) Unmarshal(dAtA []byte) error { +func (m *PlacementPolicy_FilterGroup_Selector) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { diff --git a/v2/object/service.pb.go b/v2/object/service.pb.go index 18a68ce..1865e41 100644 --- a/v2/object/service.pb.go +++ b/v2/object/service.pb.go @@ -28,31 +28,35 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package -type SearchRequest_Body_Query_Filter_MatchType int32 +// Type of match expression +type SearchRequest_Body_Filter_MatchType int32 const ( - SearchRequest_Body_Query_Filter_MATCH_UNKNOWN SearchRequest_Body_Query_Filter_MatchType = 0 - SearchRequest_Body_Query_Filter_STRING_EQUAL SearchRequest_Body_Query_Filter_MatchType = 1 + // Unknown. Not used + SearchRequest_Body_Filter_MATCH_TYPE_UNSPECIFIED SearchRequest_Body_Filter_MatchType = 0 + // Full string match + SearchRequest_Body_Filter_STRING_EQUAL SearchRequest_Body_Filter_MatchType = 1 ) -var SearchRequest_Body_Query_Filter_MatchType_name = map[int32]string{ - 0: "MATCH_UNKNOWN", +var SearchRequest_Body_Filter_MatchType_name = map[int32]string{ + 0: "MATCH_TYPE_UNSPECIFIED", 1: "STRING_EQUAL", } -var SearchRequest_Body_Query_Filter_MatchType_value = map[string]int32{ - "MATCH_UNKNOWN": 0, - "STRING_EQUAL": 1, +var SearchRequest_Body_Filter_MatchType_value = map[string]int32{ + "MATCH_TYPE_UNSPECIFIED": 0, + "STRING_EQUAL": 1, } -func (x SearchRequest_Body_Query_Filter_MatchType) String() string { - return proto.EnumName(SearchRequest_Body_Query_Filter_MatchType_name, int32(x)) +func (x SearchRequest_Body_Filter_MatchType) String() string { + return proto.EnumName(SearchRequest_Body_Filter_MatchType_name, int32(x)) } -func (SearchRequest_Body_Query_Filter_MatchType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_6233c87a2945599e, []int{8, 0, 0, 0, 0} +func (SearchRequest_Body_Filter_MatchType) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_6233c87a2945599e, []int{8, 0, 0, 0} } +// Get object request type GetRequest struct { // Body of get object request message. Body *GetRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` @@ -121,6 +125,7 @@ func (m *GetRequest) GetVerifyHeader() *service.RequestVerificationHeader { return nil } +// Request body type GetRequest_Body struct { // Address of the requested object. Address *refs.Address `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` @@ -180,6 +185,7 @@ func (m *GetRequest_Body) GetRaw() bool { return false } +// get object response type GetResponse struct { // Body of get object response message. Body *GetResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` @@ -249,6 +255,7 @@ func (m *GetResponse) GetVerifyHeader() *service.ResponseVerificationHeader { return nil } +// Response body type GetResponse_Body struct { // Carries the single message of the response stream. // @@ -406,6 +413,7 @@ func (m *GetResponse_Body_Init) GetHeader() *Header { return nil } +// Put object request type PutRequest struct { // Body of put object request message. Body *PutRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` @@ -474,6 +482,7 @@ func (m *PutRequest) GetVerifyHeader() *service.RequestVerificationHeader { return nil } +// Request body type PutRequest_Body struct { // Carries the single part of the query stream. // @@ -642,6 +651,7 @@ func (m *PutRequest_Body_Init) GetCopiesNumber() uint32 { return 0 } +// Put object response type PutResponse struct { // Body of put object response message. Body *PutResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` @@ -711,6 +721,7 @@ func (m *PutResponse) GetVerifyHeader() *service.ResponseVerificationHeader { return nil } +// Response body type PutResponse_Body struct { // Carries identifier of the saved object. // It is used to access an object in the container. @@ -760,6 +771,7 @@ func (m *PutResponse_Body) GetObjectId() *refs.ObjectID { return nil } +// Object Delete request type DeleteRequest struct { // Body of delete object request message. Body *DeleteRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` @@ -828,6 +840,7 @@ func (m *DeleteRequest) GetVerifyHeader() *service.RequestVerificationHeader { return nil } +// Request body type DeleteRequest_Body struct { // Carries the address of the object to be deleted. Address *refs.Address `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` @@ -956,6 +969,7 @@ func (m *DeleteResponse) GetVerifyHeader() *service.ResponseVerificationHeader { return nil } +// Response body type DeleteResponse_Body struct { XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -995,6 +1009,7 @@ func (m *DeleteResponse_Body) XXX_DiscardUnknown() { var xxx_messageInfo_DeleteResponse_Body proto.InternalMessageInfo +// Object head request type HeadRequest struct { // Body of head object request message. Body *HeadRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` @@ -1063,6 +1078,7 @@ func (m *HeadRequest) GetVerifyHeader() *service.RequestVerificationHeader { return nil } +// Request body type HeadRequest_Body struct { // Address of the object with the requested header. Address *refs.Address `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` @@ -1131,6 +1147,7 @@ func (m *HeadRequest_Body) GetRaw() bool { return false } +// Head response type HeadResponse struct { // Body of head object response message. Body *HeadResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` @@ -1200,6 +1217,7 @@ func (m *HeadResponse) GetVerifyHeader() *service.ResponseVerificationHeader { return nil } +// Response body type HeadResponse_Body struct { // Carries the requested object header or it's part // @@ -1290,6 +1308,7 @@ func (*HeadResponse_Body) XXX_OneofWrappers() []interface{} { } } +// Short header fields type HeadResponse_Body_ShortHeader struct { // Object format version. Version *service.Version `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` @@ -1375,6 +1394,7 @@ func (m *HeadResponse_Body_ShortHeader) GetPayloadLength() uint64 { return 0 } +// Search objects request type SearchRequest struct { // Body of search object request message. Body *SearchRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` @@ -1443,13 +1463,17 @@ func (m *SearchRequest) GetVerifyHeader() *service.RequestVerificationHeader { return nil } +// Request body type SearchRequest_Body struct { // Carries search container identifier. - ContainerId *refs.ContainerID `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` - Query *SearchRequest_Body_Query `protobuf:"bytes,2,opt,name=query,proto3" json:"query,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + ContainerId *refs.ContainerID `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` + // Version of the Query Language used + Version uint32 `protobuf:"varint,2,opt,name=version,proto3" json:"version,omitempty"` + // List of search expressions + Filters []*SearchRequest_Body_Filter `protobuf:"bytes,3,rep,name=filters,proto3" json:"filters,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *SearchRequest_Body) Reset() { *m = SearchRequest_Body{} } @@ -1492,89 +1516,45 @@ func (m *SearchRequest_Body) GetContainerId() *refs.ContainerID { return nil } -func (m *SearchRequest_Body) GetQuery() *SearchRequest_Body_Query { - if m != nil { - return m.Query - } - return nil -} - -type SearchRequest_Body_Query struct { - Version uint32 `protobuf:"varint,1,opt,name=version,proto3" json:"version,omitempty"` - Filters []*SearchRequest_Body_Query_Filter `protobuf:"bytes,2,rep,name=filters,proto3" json:"filters,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *SearchRequest_Body_Query) Reset() { *m = SearchRequest_Body_Query{} } -func (m *SearchRequest_Body_Query) String() string { return proto.CompactTextString(m) } -func (*SearchRequest_Body_Query) ProtoMessage() {} -func (*SearchRequest_Body_Query) Descriptor() ([]byte, []int) { - return fileDescriptor_6233c87a2945599e, []int{8, 0, 0} -} -func (m *SearchRequest_Body_Query) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *SearchRequest_Body_Query) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_SearchRequest_Body_Query.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *SearchRequest_Body_Query) XXX_Merge(src proto.Message) { - xxx_messageInfo_SearchRequest_Body_Query.Merge(m, src) -} -func (m *SearchRequest_Body_Query) XXX_Size() int { - return m.Size() -} -func (m *SearchRequest_Body_Query) XXX_DiscardUnknown() { - xxx_messageInfo_SearchRequest_Body_Query.DiscardUnknown(m) -} - -var xxx_messageInfo_SearchRequest_Body_Query proto.InternalMessageInfo - -func (m *SearchRequest_Body_Query) GetVersion() uint32 { +func (m *SearchRequest_Body) GetVersion() uint32 { if m != nil { return m.Version } return 0 } -func (m *SearchRequest_Body_Query) GetFilters() []*SearchRequest_Body_Query_Filter { +func (m *SearchRequest_Body) GetFilters() []*SearchRequest_Body_Filter { if m != nil { return m.Filters } return nil } -type SearchRequest_Body_Query_Filter struct { - MatchType SearchRequest_Body_Query_Filter_MatchType `protobuf:"varint,1,opt,name=match_type,json=matchType,proto3,enum=neo.fs.v2.object.SearchRequest_Body_Query_Filter_MatchType" json:"match_type,omitempty"` - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` - Value string `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` +// Filter structure +type SearchRequest_Body_Filter struct { + // Match type to use + MatchType SearchRequest_Body_Filter_MatchType `protobuf:"varint,1,opt,name=match_type,json=matchType,proto3,enum=neo.fs.v2.object.SearchRequest_Body_Filter_MatchType" json:"match_type,omitempty"` + // Header name to match + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + // Header value to match + Value string `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *SearchRequest_Body_Query_Filter) Reset() { *m = SearchRequest_Body_Query_Filter{} } -func (m *SearchRequest_Body_Query_Filter) String() string { return proto.CompactTextString(m) } -func (*SearchRequest_Body_Query_Filter) ProtoMessage() {} -func (*SearchRequest_Body_Query_Filter) Descriptor() ([]byte, []int) { - return fileDescriptor_6233c87a2945599e, []int{8, 0, 0, 0} +func (m *SearchRequest_Body_Filter) Reset() { *m = SearchRequest_Body_Filter{} } +func (m *SearchRequest_Body_Filter) String() string { return proto.CompactTextString(m) } +func (*SearchRequest_Body_Filter) ProtoMessage() {} +func (*SearchRequest_Body_Filter) Descriptor() ([]byte, []int) { + return fileDescriptor_6233c87a2945599e, []int{8, 0, 0} } -func (m *SearchRequest_Body_Query_Filter) XXX_Unmarshal(b []byte) error { +func (m *SearchRequest_Body_Filter) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *SearchRequest_Body_Query_Filter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *SearchRequest_Body_Filter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_SearchRequest_Body_Query_Filter.Marshal(b, m, deterministic) + return xxx_messageInfo_SearchRequest_Body_Filter.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -1584,39 +1564,40 @@ func (m *SearchRequest_Body_Query_Filter) XXX_Marshal(b []byte, deterministic bo return b[:n], nil } } -func (m *SearchRequest_Body_Query_Filter) XXX_Merge(src proto.Message) { - xxx_messageInfo_SearchRequest_Body_Query_Filter.Merge(m, src) +func (m *SearchRequest_Body_Filter) XXX_Merge(src proto.Message) { + xxx_messageInfo_SearchRequest_Body_Filter.Merge(m, src) } -func (m *SearchRequest_Body_Query_Filter) XXX_Size() int { +func (m *SearchRequest_Body_Filter) XXX_Size() int { return m.Size() } -func (m *SearchRequest_Body_Query_Filter) XXX_DiscardUnknown() { - xxx_messageInfo_SearchRequest_Body_Query_Filter.DiscardUnknown(m) +func (m *SearchRequest_Body_Filter) XXX_DiscardUnknown() { + xxx_messageInfo_SearchRequest_Body_Filter.DiscardUnknown(m) } -var xxx_messageInfo_SearchRequest_Body_Query_Filter proto.InternalMessageInfo +var xxx_messageInfo_SearchRequest_Body_Filter proto.InternalMessageInfo -func (m *SearchRequest_Body_Query_Filter) GetMatchType() SearchRequest_Body_Query_Filter_MatchType { +func (m *SearchRequest_Body_Filter) GetMatchType() SearchRequest_Body_Filter_MatchType { if m != nil { return m.MatchType } - return SearchRequest_Body_Query_Filter_MATCH_UNKNOWN + return SearchRequest_Body_Filter_MATCH_TYPE_UNSPECIFIED } -func (m *SearchRequest_Body_Query_Filter) GetName() string { +func (m *SearchRequest_Body_Filter) GetName() string { if m != nil { return m.Name } return "" } -func (m *SearchRequest_Body_Query_Filter) GetValue() string { +func (m *SearchRequest_Body_Filter) GetValue() string { if m != nil { return m.Value } return "" } +// Search response type SearchResponse struct { // Body of search object response message. Body *SearchResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` @@ -1686,8 +1667,9 @@ func (m *SearchResponse) GetVerifyHeader() *service.ResponseVerificationHeader { return nil } +// Response body type SearchResponse_Body struct { - // Carries list of object identifiers that match the search query. + // Carries list of object identifiers that match the search query IdList []*refs.ObjectID `protobuf:"bytes,1,rep,name=id_list,json=idList,proto3" json:"id_list,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -1792,6 +1774,7 @@ func (m *Range) GetLength() uint64 { return 0 } +// Request to get part of object's payload type GetRangeRequest struct { // Body of get range object request message. Body *GetRangeRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` @@ -1860,6 +1843,7 @@ func (m *GetRangeRequest) GetVerifyHeader() *service.RequestVerificationHeader { return nil } +// Request Body type GetRangeRequest_Body struct { // Address carries address of the object that contains the requested payload range. Address *refs.Address `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` @@ -1917,6 +1901,7 @@ func (m *GetRangeRequest_Body) GetRange() *Range { return nil } +// Get part of object's payload type GetRangeResponse struct { // Body of get range object response message. Body *GetRangeResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` @@ -1986,6 +1971,7 @@ func (m *GetRangeResponse) GetVerifyHeader() *service.ResponseVerificationHeader return nil } +// Response body type GetRangeResponse_Body struct { // Carries part of the object payload. Chunk []byte `protobuf:"bytes,1,opt,name=chunk,proto3" json:"chunk,omitempty"` @@ -2034,6 +2020,7 @@ func (m *GetRangeResponse_Body) GetChunk() []byte { return nil } +// Get hash of object's payload part type GetRangeHashRequest struct { // Body of get range hash object request message. Body *GetRangeHashRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` @@ -2102,6 +2089,7 @@ func (m *GetRangeHashRequest) GetVerifyHeader() *service.RequestVerificationHead return nil } +// Request body type GetRangeHashRequest_Body struct { // Carries address of the object that contains the requested payload range. Address *refs.Address `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` @@ -2168,6 +2156,7 @@ func (m *GetRangeHashRequest_Body) GetSalt() []byte { return nil } +// Get hash of object's payload part type GetRangeHashResponse struct { // Body of get range hash object response message. Body *GetRangeHashResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` @@ -2237,6 +2226,7 @@ func (m *GetRangeHashResponse) GetVerifyHeader() *service.ResponseVerificationHe return nil } +// Response body type GetRangeHashResponse_Body struct { // Carries list of homomorphic hashes in a binary format. HashList [][]byte `protobuf:"bytes,1,rep,name=hash_list,json=hashList,proto3" json:"hash_list,omitempty"` @@ -2286,7 +2276,7 @@ func (m *GetRangeHashResponse_Body) GetHashList() [][]byte { } func init() { - proto.RegisterEnum("neo.fs.v2.object.SearchRequest_Body_Query_Filter_MatchType", SearchRequest_Body_Query_Filter_MatchType_name, SearchRequest_Body_Query_Filter_MatchType_value) + proto.RegisterEnum("neo.fs.v2.object.SearchRequest_Body_Filter_MatchType", SearchRequest_Body_Filter_MatchType_name, SearchRequest_Body_Filter_MatchType_value) proto.RegisterType((*GetRequest)(nil), "neo.fs.v2.object.GetRequest") proto.RegisterType((*GetRequest_Body)(nil), "neo.fs.v2.object.GetRequest.Body") proto.RegisterType((*GetResponse)(nil), "neo.fs.v2.object.GetResponse") @@ -2308,8 +2298,7 @@ func init() { proto.RegisterType((*HeadResponse_Body_ShortHeader)(nil), "neo.fs.v2.object.HeadResponse.Body.ShortHeader") proto.RegisterType((*SearchRequest)(nil), "neo.fs.v2.object.SearchRequest") proto.RegisterType((*SearchRequest_Body)(nil), "neo.fs.v2.object.SearchRequest.Body") - proto.RegisterType((*SearchRequest_Body_Query)(nil), "neo.fs.v2.object.SearchRequest.Body.Query") - proto.RegisterType((*SearchRequest_Body_Query_Filter)(nil), "neo.fs.v2.object.SearchRequest.Body.Query.Filter") + proto.RegisterType((*SearchRequest_Body_Filter)(nil), "neo.fs.v2.object.SearchRequest.Body.Filter") proto.RegisterType((*SearchResponse)(nil), "neo.fs.v2.object.SearchResponse") proto.RegisterType((*SearchResponse_Body)(nil), "neo.fs.v2.object.SearchResponse.Body") proto.RegisterType((*Range)(nil), "neo.fs.v2.object.Range") @@ -2326,95 +2315,95 @@ func init() { func init() { proto.RegisterFile("v2/object/service.proto", fileDescriptor_6233c87a2945599e) } var fileDescriptor_6233c87a2945599e = []byte{ - // 1401 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x59, 0xcd, 0x72, 0xdb, 0x54, - 0x14, 0x8e, 0xe4, 0x9f, 0xc4, 0xc7, 0x76, 0x30, 0xb7, 0xa5, 0xf5, 0xa8, 0x6d, 0x48, 0xd5, 0xa6, - 0xcd, 0xb4, 0x44, 0x4e, 0x0d, 0xa5, 0xb4, 0xa5, 0x85, 0xa4, 0x49, 0x1b, 0x4f, 0x1a, 0x27, 0xbd, - 0x4e, 0xcb, 0x4c, 0x67, 0x18, 0x8f, 0x22, 0x5d, 0xc7, 0x02, 0x5b, 0x72, 0x25, 0xd9, 0x1d, 0x6f, - 0x58, 0xc1, 0x82, 0x37, 0xe8, 0xb0, 0x00, 0xa6, 0xcb, 0xc2, 0x86, 0x3d, 0xc3, 0xb0, 0x84, 0x5d, - 0xe1, 0x09, 0x98, 0xf0, 0x00, 0x7d, 0x03, 0x86, 0xb9, 0x3f, 0xb2, 0xad, 0xd4, 0x7f, 0x64, 0x67, - 0x76, 0xd2, 0xd1, 0x77, 0x8e, 0xcf, 0xf9, 0xee, 0xa7, 0x73, 0xee, 0x95, 0xe1, 0x64, 0x2b, 0x9f, - 0x73, 0xf6, 0x3e, 0x23, 0x86, 0x9f, 0xf3, 0x88, 0xdb, 0xb2, 0x0c, 0xa2, 0x35, 0x5c, 0xc7, 0x77, - 0x50, 0xc6, 0x26, 0x8e, 0x56, 0xf1, 0xb4, 0x56, 0x5e, 0xe3, 0xcf, 0x95, 0xb7, 0xba, 0x50, 0xbf, - 0xdd, 0x20, 0x1e, 0x07, 0x2a, 0xc7, 0x5a, 0xf9, 0x9c, 0x4b, 0x2a, 0x5e, 0xc8, 0x48, 0xb1, 0x22, - 0x5e, 0xae, 0x4e, 0x7c, 0x5d, 0x98, 0x4f, 0xf6, 0x98, 0x5b, 0xc4, 0xb5, 0x2a, 0x6d, 0xfe, 0x40, - 0x7d, 0x21, 0x03, 0xdc, 0x23, 0x3e, 0x26, 0x4f, 0x9a, 0xc4, 0xf3, 0xd1, 0x55, 0x88, 0xee, 0x39, - 0x66, 0x3b, 0x2b, 0xcd, 0x4b, 0x8b, 0xc9, 0xfc, 0x59, 0xed, 0x70, 0x2e, 0x5a, 0x17, 0xab, 0xad, - 0x3a, 0x66, 0x1b, 0x33, 0x38, 0x5a, 0x87, 0x24, 0xfd, 0xb1, 0x72, 0x95, 0xe8, 0x26, 0x71, 0xb3, - 0x32, 0xf3, 0x3e, 0xdf, 0xe3, 0x1d, 0x94, 0x28, 0x7c, 0xb7, 0x88, 0xaf, 0x6f, 0x30, 0x2c, 0x86, - 0x7a, 0xe7, 0x1a, 0x3d, 0x80, 0x34, 0x4f, 0x2e, 0x08, 0x14, 0x61, 0x81, 0xde, 0x19, 0x1c, 0xe8, - 0x11, 0x85, 0x5b, 0x86, 0xee, 0x5b, 0x8e, 0x2d, 0x02, 0xa6, 0x78, 0x08, 0x7e, 0xa7, 0x6c, 0x42, - 0x94, 0xe6, 0x89, 0xae, 0xc0, 0xb4, 0x6e, 0x9a, 0x2e, 0xf1, 0x3c, 0x51, 0xdb, 0xc9, 0x9e, 0xa0, - 0x94, 0x45, 0x6d, 0x85, 0x3f, 0xc6, 0x01, 0x0e, 0x65, 0x20, 0xe2, 0xea, 0x4f, 0x59, 0x31, 0x33, - 0x98, 0x5e, 0xaa, 0xff, 0x44, 0x20, 0xc9, 0x08, 0xf0, 0x1a, 0x8e, 0xed, 0x11, 0xf4, 0x7e, 0x88, - 0x2d, 0x75, 0x00, 0x5b, 0x1c, 0xdc, 0x4b, 0xd7, 0xdd, 0x7e, 0x74, 0x2d, 0xf4, 0xad, 0x92, 0x3b, - 0x0f, 0xe0, 0x0b, 0xf7, 0xe7, 0x6b, 0x69, 0x48, 0xa4, 0x91, 0x84, 0x7d, 0x23, 0x0b, 0xc6, 0x6e, - 0x41, 0xd4, 0xb2, 0x2d, 0x5f, 0x14, 0x77, 0x71, 0x74, 0x71, 0x5a, 0xc1, 0xb6, 0xfc, 0x8d, 0x29, - 0xcc, 0xdc, 0xd0, 0x09, 0x88, 0x19, 0xd5, 0xa6, 0xfd, 0x39, 0xab, 0x2e, 0xb5, 0x31, 0x85, 0xf9, - 0xad, 0xf2, 0x83, 0x04, 0x51, 0x0a, 0x44, 0x57, 0x21, 0xc1, 0x03, 0x95, 0x2d, 0x53, 0xfc, 0x48, - 0xf6, 0xf0, 0x9a, 0x6c, 0x33, 0x40, 0x61, 0x0d, 0xcf, 0x70, 0x68, 0xc1, 0x44, 0x37, 0x20, 0xe1, - 0x59, 0xfb, 0xb6, 0xee, 0x37, 0x5d, 0x22, 0x98, 0x3b, 0xdd, 0xa7, 0xde, 0x52, 0x80, 0xc1, 0x5d, - 0x38, 0x5a, 0x86, 0x78, 0x88, 0xa8, 0xec, 0xeb, 0x45, 0x09, 0x4e, 0x04, 0x6e, 0x35, 0x0d, 0x49, - 0x91, 0x64, 0x43, 0x77, 0x7d, 0xf5, 0xdb, 0x28, 0xc0, 0x4e, 0x73, 0xfc, 0xb7, 0xa5, 0x8b, 0x9d, - 0x8c, 0xb7, 0xe5, 0x97, 0x60, 0xf1, 0x3f, 0x0c, 0x2d, 0xfe, 0x85, 0x91, 0x95, 0x8d, 0xb7, 0xf6, - 0x2f, 0x27, 0x69, 0xed, 0xd1, 0x39, 0x48, 0x1b, 0x4e, 0xc3, 0x22, 0x5e, 0xd9, 0x6e, 0xd6, 0xf7, - 0x88, 0x9b, 0x8d, 0xce, 0x4b, 0x8b, 0x69, 0x9c, 0xe2, 0xc6, 0x22, 0xb3, 0x1d, 0x16, 0xc8, 0xf7, - 0x32, 0x24, 0x19, 0x35, 0xe3, 0x76, 0x88, 0x1e, 0xf0, 0xa4, 0x74, 0x88, 0x5b, 0x42, 0x23, 0x47, - 0x5b, 0x44, 0xf5, 0x4f, 0x19, 0xd2, 0x6b, 0xa4, 0x46, 0x7c, 0x12, 0xbc, 0x46, 0x1f, 0x84, 0x48, - 0x3a, 0xff, 0x3a, 0x49, 0x21, 0xf8, 0x64, 0xbc, 0x49, 0xf5, 0xa3, 0xcf, 0x9d, 0x3c, 0xcc, 0x38, - 0x4f, 0x6d, 0xe2, 0x52, 0x5a, 0xe5, 0xfe, 0x3e, 0xdb, 0xf4, 0x79, 0x61, 0x0d, 0x4f, 0x33, 0x60, - 0xc1, 0x54, 0x5f, 0x49, 0x30, 0x1b, 0xb0, 0x24, 0xa4, 0x77, 0x3d, 0xc4, 0xea, 0xc2, 0x60, 0x56, - 0x27, 0x4b, 0x7d, 0x71, 0x4e, 0xac, 0xfa, 0xbb, 0x0c, 0x49, 0x6a, 0x0a, 0x44, 0x34, 0xf2, 0x4d, - 0xeb, 0x01, 0x4f, 0x86, 0x84, 0xaa, 0x47, 0x97, 0xd0, 0x29, 0x48, 0xd4, 0x75, 0xcb, 0x2e, 0x3b, - 0x76, 0xad, 0x2d, 0x36, 0x30, 0x33, 0xd4, 0xb0, 0x6d, 0xd7, 0xda, 0xc1, 0xbe, 0x26, 0xd2, 0xdd, - 0xd7, 0x7c, 0x15, 0x83, 0x14, 0xa7, 0x47, 0x68, 0xe7, 0x5a, 0x88, 0xcc, 0x73, 0x83, 0xc8, 0x9c, - 0x2c, 0xe5, 0x7c, 0x17, 0x11, 0x84, 0xe6, 0x3b, 0xa3, 0x40, 0x1a, 0x3e, 0x0a, 0x36, 0xa6, 0x3a, - 0xc3, 0x60, 0x17, 0x52, 0x5e, 0xd5, 0x71, 0xfd, 0x70, 0x65, 0xb9, 0x31, 0x98, 0xd1, 0x4a, 0xd4, - 0xaf, 0x13, 0x30, 0xe9, 0x75, 0x6f, 0x95, 0x2f, 0x65, 0x48, 0xf6, 0x3c, 0x46, 0xef, 0xc1, 0x74, - 0x8b, 0xb8, 0x9e, 0xe5, 0xd8, 0x22, 0x35, 0xa5, 0x4f, 0xc1, 0x8f, 0x38, 0x02, 0x07, 0x50, 0xb4, - 0x00, 0xb3, 0x86, 0x4b, 0x58, 0xe1, 0x65, 0xd2, 0x70, 0x8c, 0x2a, 0xcb, 0x2e, 0x8a, 0xd3, 0x81, - 0x75, 0x9d, 0x1a, 0x43, 0x7d, 0x25, 0x32, 0x5e, 0x5f, 0x41, 0xb7, 0x3a, 0xe3, 0x8d, 0x1e, 0x32, - 0xd8, 0x04, 0x9c, 0x0d, 0xcd, 0x5c, 0x51, 0x35, 0xef, 0xf3, 0xbb, 0xed, 0x06, 0xc1, 0xe0, 0x74, - 0xae, 0x69, 0x66, 0x0d, 0xbd, 0x5d, 0x73, 0x74, 0xb3, 0x5c, 0x23, 0xf6, 0xbe, 0x5f, 0xcd, 0xc6, - 0x78, 0x66, 0xc2, 0x7a, 0x9f, 0x19, 0x57, 0xe3, 0x10, 0xa5, 0xb4, 0xaa, 0xcf, 0x63, 0x90, 0x2e, - 0x11, 0xdd, 0x35, 0xaa, 0x63, 0x8f, 0x86, 0x10, 0x7c, 0x32, 0xde, 0xeb, 0x9f, 0x03, 0x1d, 0xde, - 0x86, 0x94, 0xe1, 0xd8, 0xbe, 0x6e, 0x89, 0x45, 0xe1, 0x45, 0x9e, 0x3a, 0xbc, 0x28, 0x77, 0x02, - 0x4c, 0x61, 0x0d, 0x27, 0x3b, 0x0e, 0x05, 0x13, 0x7d, 0x0c, 0xb1, 0x27, 0x4d, 0xe2, 0xb6, 0x45, - 0x71, 0x97, 0xc6, 0x61, 0x47, 0x7b, 0x40, 0x3d, 0x30, 0x77, 0x54, 0x7e, 0x92, 0x21, 0xc6, 0x0c, - 0x28, 0x1b, 0x56, 0x5e, 0xba, 0xab, 0xae, 0x4d, 0x98, 0xae, 0x58, 0x35, 0x9f, 0xb8, 0x5e, 0x56, - 0x9e, 0x8f, 0x2c, 0x26, 0xf3, 0x57, 0xc6, 0xff, 0x1d, 0xed, 0x2e, 0xf3, 0xc4, 0x41, 0x04, 0xe5, - 0x57, 0x09, 0xe2, 0xdc, 0x86, 0x1e, 0x03, 0xd4, 0x75, 0xdf, 0xa8, 0x72, 0x65, 0x49, 0x4c, 0x59, - 0x37, 0xff, 0x73, 0x68, 0x6d, 0x8b, 0xc6, 0x60, 0xc2, 0x4b, 0xd4, 0x83, 0x4b, 0x84, 0x20, 0x6a, - 0xeb, 0x75, 0xbe, 0x47, 0x4c, 0x60, 0x76, 0x8d, 0x8e, 0x43, 0xac, 0xa5, 0xd7, 0x9a, 0x84, 0xad, - 0x60, 0x02, 0xf3, 0x1b, 0x75, 0x19, 0x12, 0x9d, 0x08, 0xe8, 0x4d, 0x48, 0x6f, 0xad, 0xec, 0xde, - 0xd9, 0x28, 0x3f, 0x2c, 0x6e, 0x16, 0xb7, 0x3f, 0x29, 0x66, 0xa6, 0x50, 0x06, 0x52, 0xa5, 0x5d, - 0x5c, 0x28, 0xde, 0x2b, 0xaf, 0x3f, 0x78, 0xb8, 0x72, 0x3f, 0x23, 0xa9, 0xcf, 0x65, 0x98, 0x0d, - 0x92, 0x1a, 0x77, 0xd4, 0x86, 0xf1, 0x93, 0xd2, 0x30, 0xaf, 0x77, 0x07, 0x90, 0x65, 0x96, 0x6b, - 0x96, 0x47, 0xcf, 0x03, 0x91, 0xa1, 0xdb, 0xbc, 0xb8, 0x65, 0xde, 0xb7, 0x3c, 0x5f, 0xbd, 0x06, - 0x31, 0xac, 0xdb, 0xfb, 0x04, 0x9d, 0x80, 0xb8, 0x53, 0xa9, 0x78, 0x84, 0x1f, 0x25, 0xa2, 0x58, - 0xdc, 0x51, 0xbb, 0xe8, 0x08, 0xbc, 0x57, 0x89, 0x3b, 0xf5, 0x0f, 0x19, 0xde, 0xa0, 0x07, 0x4b, - 0xea, 0x1c, 0x34, 0x81, 0x1b, 0x21, 0x7a, 0x2f, 0xf4, 0x3f, 0x89, 0xf6, 0x38, 0xfc, 0xef, 0xc7, - 0xfb, 0x12, 0xc4, 0x5c, 0x5a, 0x6f, 0x9f, 0xed, 0xa1, 0x60, 0x84, 0xd3, 0xc1, 0x51, 0xea, 0xd7, - 0x32, 0x64, 0xba, 0x14, 0x09, 0xcd, 0xde, 0x0c, 0x91, 0x7a, 0x71, 0x18, 0xa9, 0x93, 0xa5, 0xda, - 0xd3, 0x82, 0xd7, 0xe3, 0xc1, 0x21, 0x94, 0x56, 0x98, 0x12, 0x47, 0x50, 0xf5, 0x95, 0x0c, 0xc7, - 0x82, 0xca, 0x36, 0x74, 0xaf, 0x33, 0x68, 0x6e, 0x87, 0xe8, 0xb8, 0x34, 0x98, 0x8e, 0x1e, 0xa7, - 0xc9, 0xd0, 0xd9, 0x17, 0x47, 0xd7, 0x59, 0x0e, 0xe2, 0x4c, 0x41, 0x41, 0xe7, 0x1f, 0x28, 0x34, - 0x01, 0xa3, 0x7d, 0xd7, 0xd3, 0x6b, 0x3e, 0xcb, 0x3a, 0x85, 0xd9, 0xb5, 0xfa, 0x4c, 0x86, 0xe3, - 0x61, 0xf2, 0x84, 0x02, 0x3f, 0x0a, 0x51, 0x7e, 0x79, 0x14, 0xe5, 0x93, 0xa5, 0xc2, 0x73, 0x82, - 0xf5, 0x53, 0x90, 0xa8, 0xea, 0x5e, 0xb5, 0xdb, 0x3d, 0x53, 0x78, 0x86, 0x1a, 0x68, 0x97, 0xcc, - 0xff, 0x18, 0x85, 0xe9, 0x12, 0x8f, 0x8c, 0xd6, 0x20, 0x72, 0x8f, 0xf8, 0xe8, 0xf4, 0xb0, 0x4f, - 0xae, 0xca, 0x99, 0xa1, 0x5f, 0xe1, 0x96, 0x25, 0x1a, 0x65, 0xa7, 0xd9, 0x37, 0x4a, 0xf7, 0x83, - 0x4d, 0xbf, 0x28, 0x3d, 0x9f, 0x21, 0x16, 0x25, 0xb4, 0x09, 0x71, 0x7e, 0x38, 0x44, 0x6f, 0x8f, - 0x38, 0x8c, 0x2b, 0xf3, 0xa3, 0xce, 0x95, 0x68, 0x1d, 0xa2, 0x94, 0x13, 0x74, 0x66, 0xe8, 0x91, - 0x4c, 0x99, 0x1b, 0xbe, 0x95, 0x46, 0x5b, 0x10, 0xe7, 0x53, 0xb4, 0x5f, 0x4e, 0xa1, 0x4d, 0x42, - 0xbf, 0x9c, 0xc2, 0x03, 0x78, 0x59, 0x42, 0x25, 0x98, 0x09, 0xe4, 0x85, 0xce, 0x8e, 0x9c, 0x28, - 0x8a, 0x3a, 0xba, 0x3f, 0x2e, 0x4b, 0xe8, 0x53, 0x48, 0xf5, 0x6a, 0x16, 0x2d, 0x8c, 0xd5, 0x46, - 0x94, 0x0b, 0xe3, 0x49, 0x7f, 0x75, 0xe7, 0xb7, 0x83, 0x39, 0xe9, 0xe5, 0xc1, 0x9c, 0xf4, 0xd7, - 0xc1, 0x9c, 0xf4, 0xec, 0xef, 0xb9, 0xa9, 0xc7, 0x97, 0xf7, 0x2d, 0xbf, 0xda, 0xdc, 0xd3, 0x0c, - 0xa7, 0x9e, 0xb3, 0xbd, 0x86, 0x61, 0x2c, 0x99, 0xa4, 0x95, 0xb3, 0x89, 0x53, 0xf1, 0x96, 0xf4, - 0x86, 0xb5, 0xb4, 0xef, 0xe4, 0x3a, 0xff, 0x1d, 0xbc, 0x90, 0x33, 0x45, 0xe2, 0xdc, 0x2d, 0x69, - 0x2b, 0x3b, 0x05, 0x31, 0xb0, 0xf7, 0xe2, 0xec, 0x4f, 0x80, 0x77, 0xff, 0x0d, 0x00, 0x00, 0xff, - 0xff, 0xbb, 0xcd, 0x0d, 0x36, 0x8d, 0x18, 0x00, 0x00, + // 1396 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x58, 0x4f, 0x73, 0xdb, 0x44, + 0x14, 0x8f, 0x64, 0xc5, 0x89, 0x9f, 0xed, 0x90, 0xd9, 0x96, 0xd6, 0xa3, 0xb6, 0x21, 0x55, 0x9b, + 0x36, 0x43, 0x89, 0x1c, 0x0c, 0xa5, 0xb4, 0xa5, 0x65, 0x92, 0xc6, 0x69, 0x3c, 0x6d, 0xd2, 0x54, + 0x4e, 0x3b, 0x43, 0x67, 0x18, 0x8f, 0x22, 0xad, 0x63, 0x81, 0x2d, 0x19, 0xad, 0xec, 0x8e, 0x2f, + 0x9c, 0xe0, 0xc0, 0x37, 0xe8, 0x70, 0x00, 0x86, 0x63, 0xb9, 0xf1, 0x01, 0xb8, 0x70, 0x81, 0x5b, + 0x81, 0x2f, 0xc0, 0x84, 0x33, 0xd3, 0x6f, 0xc0, 0x30, 0xfb, 0x47, 0xb6, 0x95, 0xfa, 0x1f, 0xb9, + 0x89, 0x93, 0xa5, 0xa7, 0xdf, 0x7b, 0xde, 0xf7, 0xdb, 0xdf, 0xbe, 0xb7, 0xbb, 0x70, 0xba, 0x5d, + 0xc8, 0x7b, 0xfb, 0x9f, 0x60, 0x2b, 0xc8, 0x13, 0xec, 0xb7, 0x1d, 0x0b, 0xeb, 0x4d, 0xdf, 0x0b, + 0x3c, 0x34, 0xef, 0x62, 0x4f, 0xaf, 0x12, 0xbd, 0x5d, 0xd0, 0xf9, 0x77, 0xf5, 0xf5, 0x1e, 0x34, + 0xe8, 0x34, 0x31, 0xe1, 0x40, 0xf5, 0x44, 0xbb, 0x90, 0xf7, 0x71, 0x95, 0x44, 0x8c, 0x14, 0x2b, + 0xe2, 0xe5, 0x1b, 0x38, 0x30, 0x85, 0xf9, 0x74, 0x9f, 0xb9, 0x8d, 0x7d, 0xa7, 0xda, 0xe1, 0x1f, + 0xb4, 0xe7, 0x32, 0xc0, 0x5d, 0x1c, 0x18, 0xf8, 0xb3, 0x16, 0x26, 0x01, 0xba, 0x0a, 0xca, 0xbe, + 0x67, 0x77, 0x72, 0xd2, 0xa2, 0xb4, 0x9c, 0x2e, 0x9c, 0xd7, 0x8f, 0x8e, 0x45, 0xef, 0x61, 0xf5, + 0x75, 0xcf, 0xee, 0x18, 0x0c, 0x8e, 0x8a, 0x90, 0xa6, 0x7f, 0x56, 0xa9, 0x61, 0xd3, 0xc6, 0x7e, + 0x4e, 0x66, 0xde, 0x17, 0xfb, 0xbc, 0xc3, 0x14, 0x85, 0xef, 0x36, 0x0e, 0xcc, 0x2d, 0x86, 0x35, + 0xa0, 0xd1, 0x7d, 0x46, 0x0f, 0x21, 0xcb, 0x07, 0x17, 0x06, 0x4a, 0xb0, 0x40, 0x6f, 0x0d, 0x0f, + 0xf4, 0x98, 0xc2, 0x1d, 0xcb, 0x0c, 0x1c, 0xcf, 0x15, 0x01, 0x33, 0x3c, 0x04, 0x7f, 0x53, 0xef, + 0x81, 0x42, 0xc7, 0x89, 0xde, 0x86, 0x19, 0xd3, 0xb6, 0x7d, 0x4c, 0x88, 0xc8, 0xed, 0x74, 0x5f, + 0x50, 0xca, 0xa2, 0xbe, 0xc6, 0x3f, 0x1b, 0x21, 0x0e, 0xcd, 0x43, 0xc2, 0x37, 0x9f, 0xb2, 0x64, + 0x66, 0x0d, 0xfa, 0xa8, 0xfd, 0x93, 0x80, 0x34, 0x23, 0x80, 0x34, 0x3d, 0x97, 0x60, 0xf4, 0x5e, + 0x84, 0x2d, 0x6d, 0x08, 0x5b, 0x1c, 0xdc, 0x4f, 0xd7, 0xe6, 0x20, 0xba, 0x96, 0x06, 0x66, 0xc9, + 0x9d, 0x87, 0xf0, 0x65, 0x0c, 0xe6, 0x6b, 0x65, 0x44, 0xa4, 0xb1, 0x84, 0x7d, 0x2d, 0x0b, 0xc6, + 0x6e, 0x81, 0xe2, 0xb8, 0x4e, 0x20, 0x92, 0xbb, 0x3c, 0x3e, 0x39, 0xbd, 0xe4, 0x3a, 0xc1, 0xd6, + 0x94, 0xc1, 0xdc, 0xd0, 0x29, 0x98, 0xb6, 0x6a, 0x2d, 0xf7, 0x53, 0x96, 0x5d, 0x66, 0x6b, 0xca, + 0xe0, 0xaf, 0xea, 0x0f, 0x12, 0x28, 0x14, 0x88, 0xae, 0x42, 0x8a, 0x07, 0xaa, 0x38, 0xb6, 0xf8, + 0x93, 0xdc, 0xd1, 0x39, 0x79, 0xc0, 0x00, 0xa5, 0x0d, 0x63, 0x96, 0x43, 0x4b, 0x36, 0xba, 0x01, + 0x29, 0xe2, 0x1c, 0xb8, 0x66, 0xd0, 0xf2, 0xb1, 0x60, 0xee, 0xec, 0x80, 0x7c, 0xcb, 0x21, 0xc6, + 0xe8, 0xc1, 0xd1, 0x2a, 0x24, 0x23, 0x44, 0xe5, 0x5e, 0x4d, 0x4a, 0x70, 0x22, 0x70, 0xeb, 0x59, + 0x48, 0x8b, 0x41, 0x36, 0x4d, 0x3f, 0xd0, 0xbe, 0x51, 0x00, 0x76, 0x5b, 0x93, 0xaf, 0x96, 0x1e, + 0x36, 0x1e, 0xab, 0xe5, 0xa7, 0x70, 0xf2, 0x3f, 0x88, 0x4c, 0xfe, 0xa5, 0xb1, 0x99, 0x4d, 0x36, + 0xf7, 0x2f, 0xe2, 0x34, 0xf7, 0xe8, 0x02, 0x64, 0x2d, 0xaf, 0xe9, 0x60, 0x52, 0x71, 0x5b, 0x8d, + 0x7d, 0xec, 0xe7, 0x94, 0x45, 0x69, 0x39, 0x6b, 0x64, 0xb8, 0x71, 0x87, 0xd9, 0x8e, 0x0a, 0xe4, + 0x3b, 0x19, 0xd2, 0x8c, 0x9a, 0x49, 0x2b, 0x44, 0x1f, 0x38, 0x2e, 0x15, 0xe2, 0x96, 0xd0, 0xc8, + 0xf1, 0x26, 0x51, 0xfb, 0x5d, 0x86, 0xec, 0x06, 0xae, 0xe3, 0x00, 0x87, 0xcb, 0xe8, 0xfd, 0x08, + 0x49, 0x17, 0x5f, 0x25, 0x29, 0x02, 0x8f, 0xc7, 0x4a, 0x6a, 0x1c, 0xbf, 0xef, 0x14, 0x60, 0xd6, + 0x7b, 0xea, 0x62, 0x9f, 0xd2, 0x2a, 0x0f, 0xf6, 0x79, 0x40, 0xbf, 0x97, 0x36, 0x8c, 0x19, 0x06, + 0x2c, 0xd9, 0xda, 0x4b, 0x09, 0xe6, 0x42, 0x96, 0x84, 0xf4, 0xae, 0x47, 0x58, 0x5d, 0x1a, 0xce, + 0x6a, 0xbc, 0xd4, 0x97, 0xe4, 0xc4, 0x6a, 0xbf, 0xca, 0x90, 0xa6, 0xa6, 0x50, 0x44, 0x63, 0x57, + 0x5a, 0x1f, 0x38, 0x1e, 0x12, 0xaa, 0x1d, 0x5f, 0x42, 0x67, 0x20, 0xd5, 0x30, 0x1d, 0xb7, 0xe2, + 0xb9, 0xf5, 0x8e, 0xd8, 0xc0, 0xcc, 0x52, 0xc3, 0x03, 0xb7, 0xde, 0x09, 0xf7, 0x35, 0x89, 0xde, + 0xbe, 0xe6, 0xcb, 0x69, 0xc8, 0x70, 0x7a, 0x84, 0x76, 0xae, 0x45, 0xc8, 0xbc, 0x30, 0x8c, 0xcc, + 0x78, 0x29, 0xe7, 0xdb, 0x84, 0x20, 0xb4, 0xd0, 0x6d, 0x05, 0xd2, 0xe8, 0x56, 0xb0, 0x35, 0xd5, + 0x6d, 0x06, 0x7b, 0x90, 0x21, 0x35, 0xcf, 0x0f, 0xa2, 0x99, 0xe5, 0x27, 0x60, 0x46, 0x2f, 0x53, + 0xbf, 0x6e, 0xc0, 0x34, 0xe9, 0xbd, 0xaa, 0x5f, 0xc8, 0x90, 0xee, 0xfb, 0x8c, 0xde, 0x85, 0x99, + 0x36, 0xf6, 0x89, 0xe3, 0xb9, 0x62, 0x68, 0xea, 0x80, 0x84, 0x1f, 0x73, 0x84, 0x11, 0x42, 0xd1, + 0x12, 0xcc, 0x59, 0x3e, 0x66, 0x89, 0x57, 0x70, 0xd3, 0xb3, 0x6a, 0x6c, 0x74, 0x8a, 0x91, 0x0d, + 0xad, 0x45, 0x6a, 0x8c, 0xd4, 0x95, 0xc4, 0x64, 0x75, 0x05, 0xdd, 0xea, 0xb6, 0x37, 0x7a, 0xc8, + 0x60, 0x1d, 0x70, 0x2e, 0xd2, 0x73, 0x45, 0xd6, 0xbc, 0xce, 0xef, 0x75, 0x9a, 0xd8, 0x00, 0xaf, + 0xfb, 0x4c, 0x47, 0xd6, 0x34, 0x3b, 0x75, 0xcf, 0xb4, 0x2b, 0x75, 0xec, 0x1e, 0x04, 0xb5, 0xdc, + 0x34, 0x1f, 0x99, 0xb0, 0xde, 0x67, 0xc6, 0xf5, 0x24, 0x28, 0x94, 0x56, 0xed, 0x0f, 0x05, 0xb2, + 0x65, 0x6c, 0xfa, 0x56, 0x6d, 0xe2, 0xd6, 0x10, 0x81, 0xc7, 0x63, 0x5d, 0xff, 0x1d, 0x6e, 0xb2, + 0x6e, 0x43, 0xc6, 0xf2, 0xdc, 0xc0, 0x74, 0xc4, 0xa4, 0xf0, 0x24, 0xcf, 0x1c, 0x9d, 0x94, 0x3b, + 0x21, 0xa6, 0xb4, 0x61, 0xa4, 0xbb, 0x0e, 0x25, 0x1b, 0xe5, 0x7a, 0x6a, 0x91, 0xd9, 0xd6, 0xa4, + 0xab, 0x88, 0x22, 0xcc, 0x54, 0x9d, 0x7a, 0x80, 0x7d, 0x92, 0x4b, 0x2c, 0x26, 0x96, 0xd3, 0x85, + 0x2b, 0x93, 0x30, 0xa7, 0x6f, 0x32, 0x1f, 0x23, 0xf4, 0x55, 0x7f, 0x96, 0x20, 0xc9, 0x6d, 0x68, + 0x0f, 0xa0, 0x61, 0x06, 0x56, 0x8d, 0xeb, 0x40, 0x62, 0x3a, 0xb8, 0xfa, 0x1f, 0x82, 0xea, 0xdb, + 0xd4, 0x9b, 0x09, 0x24, 0xd5, 0x08, 0x1f, 0x11, 0x02, 0xc5, 0x35, 0x1b, 0x7c, 0x2f, 0x97, 0x32, + 0xd8, 0x33, 0x3a, 0x09, 0xd3, 0x6d, 0xb3, 0xde, 0xc2, 0x8c, 0xe9, 0x94, 0xc1, 0x5f, 0xb4, 0xeb, + 0x90, 0xea, 0x46, 0x40, 0x2a, 0x9c, 0xda, 0x5e, 0xdb, 0xbb, 0xb3, 0x55, 0xd9, 0xfb, 0x68, 0xb7, + 0x58, 0x79, 0xb4, 0x53, 0xde, 0x2d, 0xde, 0x29, 0x6d, 0x96, 0x8a, 0x1b, 0xf3, 0x53, 0x68, 0x1e, + 0x32, 0xe5, 0x3d, 0xa3, 0xb4, 0x73, 0xb7, 0x52, 0x7c, 0xf8, 0x68, 0xed, 0xfe, 0xbc, 0xa4, 0x7d, + 0x2f, 0xc3, 0x5c, 0x38, 0xae, 0x49, 0x7b, 0x63, 0x14, 0x1f, 0x97, 0x0a, 0x77, 0xbd, 0xd7, 0x31, + 0x1c, 0xbb, 0x52, 0x77, 0x08, 0xdd, 0xc0, 0x27, 0x46, 0xee, 0xcb, 0x92, 0x8e, 0x7d, 0xdf, 0x21, + 0x81, 0x76, 0x0d, 0xa6, 0x0d, 0xd3, 0x3d, 0xc0, 0xe8, 0x14, 0x24, 0xbd, 0x6a, 0x95, 0x60, 0xbe, + 0xf7, 0x57, 0x0c, 0xf1, 0x46, 0xed, 0x62, 0x09, 0xf3, 0xe2, 0x22, 0xde, 0xb4, 0xdf, 0x64, 0x78, + 0x8d, 0x9e, 0x04, 0xa9, 0x73, 0xb8, 0x6a, 0x6f, 0x44, 0xe8, 0xbd, 0x34, 0xf8, 0xe8, 0xd8, 0xe7, + 0xf0, 0xbf, 0xef, 0xc7, 0x2b, 0x30, 0xed, 0xd3, 0x7c, 0x07, 0xec, 0xe7, 0x04, 0x23, 0x9c, 0x0e, + 0x8e, 0xd2, 0xbe, 0x92, 0x61, 0xbe, 0x47, 0x91, 0xd0, 0xec, 0xcd, 0x08, 0xa9, 0x97, 0x47, 0x91, + 0x1a, 0x2f, 0xd5, 0x9e, 0x15, 0xbc, 0x9e, 0x0c, 0x4f, 0x8d, 0x34, 0xc3, 0x8c, 0x38, 0x33, 0x6a, + 0x2f, 0x65, 0x38, 0x11, 0x66, 0xb6, 0x65, 0x92, 0x6e, 0x67, 0xb8, 0x1d, 0xa1, 0xe3, 0xcd, 0xe1, + 0x74, 0xf4, 0x39, 0xc5, 0x43, 0x67, 0x9f, 0x1f, 0x5f, 0x67, 0x79, 0x48, 0x32, 0x05, 0x91, 0x9c, + 0xcc, 0xd6, 0xfd, 0x50, 0xa1, 0x09, 0x18, 0x2d, 0xc0, 0xc4, 0xac, 0x07, 0x6c, 0xd4, 0x19, 0x83, + 0x3d, 0x6b, 0xcf, 0x64, 0x38, 0x19, 0x25, 0x4f, 0x28, 0xf0, 0xc3, 0x08, 0xe5, 0x57, 0xc6, 0x51, + 0x1e, 0x2f, 0x15, 0x5e, 0x10, 0xac, 0x9f, 0x81, 0x54, 0xcd, 0x24, 0xb5, 0x5e, 0xf5, 0xcc, 0x18, + 0xb3, 0xd4, 0x40, 0xab, 0x64, 0xe1, 0x47, 0x05, 0xb2, 0xbc, 0x74, 0x96, 0x79, 0x7c, 0xb4, 0x01, + 0x89, 0xbb, 0x38, 0x40, 0x67, 0x47, 0xdd, 0x94, 0xaa, 0xe7, 0x46, 0x5e, 0x9e, 0xad, 0x4a, 0x34, + 0xca, 0x6e, 0x6b, 0x60, 0x94, 0xde, 0x3d, 0xcb, 0xa0, 0x28, 0x7d, 0xb7, 0x07, 0xcb, 0x12, 0xba, + 0x07, 0x49, 0x7e, 0xa6, 0x43, 0x6f, 0x8c, 0x39, 0x43, 0xab, 0x8b, 0xe3, 0x8e, 0x83, 0xa8, 0x08, + 0x0a, 0x65, 0x06, 0x9d, 0x1b, 0x79, 0x92, 0x52, 0x17, 0x46, 0xef, 0x80, 0xd1, 0x36, 0x24, 0x79, + 0x2f, 0x1d, 0x34, 0xa6, 0xc8, 0x6e, 0x61, 0xd0, 0x98, 0xa2, 0x6d, 0x78, 0x55, 0x42, 0x65, 0x98, + 0x0d, 0x45, 0x86, 0xce, 0x8f, 0xed, 0x2b, 0xaa, 0x36, 0xbe, 0x4a, 0xae, 0x4a, 0xe8, 0x63, 0xc8, + 0xf4, 0x2b, 0x17, 0x2d, 0x4d, 0x54, 0x4c, 0xd4, 0x4b, 0x93, 0x2d, 0x80, 0xf5, 0x27, 0xbf, 0x1c, + 0x2e, 0x48, 0x2f, 0x0e, 0x17, 0xa4, 0x3f, 0x0f, 0x17, 0xa4, 0x67, 0x7f, 0x2d, 0x4c, 0x3d, 0x29, + 0x1c, 0x38, 0x41, 0xad, 0xb5, 0xaf, 0x5b, 0x5e, 0x23, 0xef, 0x92, 0xa6, 0x65, 0xad, 0xd8, 0xb8, + 0x9d, 0x77, 0xb1, 0x57, 0x25, 0x2b, 0x66, 0xd3, 0x59, 0x39, 0xf0, 0xf2, 0xdd, 0x2b, 0xff, 0x9b, + 0xfc, 0xe7, 0xb9, 0x7c, 0x62, 0x07, 0x7b, 0x9b, 0x65, 0x7d, 0x6d, 0xb7, 0x44, 0xff, 0x90, 0xab, + 0x70, 0x3f, 0xc9, 0x6e, 0xf1, 0xdf, 0xf9, 0x37, 0x00, 0x00, 0xff, 0xff, 0xd6, 0xca, 0xeb, 0x7d, + 0x4e, 0x18, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -2425,23 +2414,23 @@ var _ grpc.ClientConn // is compatible with the grpc package it is being compiled against. const _ = grpc.SupportPackageIsVersion4 -// ServiceClient is the client API for Service service. +// ObjectServiceClient is the client API for ObjectService service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type ServiceClient interface { +type ObjectServiceClient interface { // Get the object from container. Response uses gRPC stream. First response // message carry object of requested address. Chunk messages are parts of // the object's payload if it is needed. All messages except first carry // chunks. Requested object can be restored by concatenation of object // message payload and all chunks keeping receiving order. - Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (Service_GetClient, error) + Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (ObjectService_GetClient, error) // Put the object into container. Request uses gRPC stream. First message // SHOULD BE type of PutHeader. Container id and Owner id of object SHOULD // BE set. Session token SHOULD BE obtained before put operation (see // session package). Chunk messages considered by server as part of object // payload. All messages except first SHOULD BE chunks. Chunk messages // SHOULD BE sent in direct order of fragmentation. - Put(ctx context.Context, opts ...grpc.CallOption) (Service_PutClient, error) + Put(ctx context.Context, opts ...grpc.CallOption) (ObjectService_PutClient, error) // Delete the object from a container Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteResponse, error) // Head returns the object without data payload. Object in the @@ -2451,11 +2440,11 @@ type ServiceClient interface { // Search objects in container. Version of query language format SHOULD BE // set to 1. Search query represented in serialized format (see query // package). - Search(ctx context.Context, in *SearchRequest, opts ...grpc.CallOption) (Service_SearchClient, error) + Search(ctx context.Context, in *SearchRequest, opts ...grpc.CallOption) (ObjectService_SearchClient, error) // GetRange of data payload. Range is a pair (offset, length). // Requested range can be restored by concatenation of all chunks // keeping receiving order. - GetRange(ctx context.Context, in *GetRangeRequest, opts ...grpc.CallOption) (Service_GetRangeClient, error) + GetRange(ctx context.Context, in *GetRangeRequest, opts ...grpc.CallOption) (ObjectService_GetRangeClient, error) // GetRangeHash returns homomorphic hash of object payload range after XOR // operation. Ranges are set of pairs (offset, length). Hashes order in // response corresponds to ranges order in request. Homomorphic hash is @@ -2463,20 +2452,20 @@ type ServiceClient interface { GetRangeHash(ctx context.Context, in *GetRangeHashRequest, opts ...grpc.CallOption) (*GetRangeHashResponse, error) } -type serviceClient struct { +type objectServiceClient struct { cc *grpc.ClientConn } -func NewServiceClient(cc *grpc.ClientConn) ServiceClient { - return &serviceClient{cc} +func NewObjectServiceClient(cc *grpc.ClientConn) ObjectServiceClient { + return &objectServiceClient{cc} } -func (c *serviceClient) Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (Service_GetClient, error) { - stream, err := c.cc.NewStream(ctx, &_Service_serviceDesc.Streams[0], "/neo.fs.v2.object.Service/Get", opts...) +func (c *objectServiceClient) Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (ObjectService_GetClient, error) { + stream, err := c.cc.NewStream(ctx, &_ObjectService_serviceDesc.Streams[0], "/neo.fs.v2.object.ObjectService/Get", opts...) if err != nil { return nil, err } - x := &serviceGetClient{stream} + x := &objectServiceGetClient{stream} if err := x.ClientStream.SendMsg(in); err != nil { return nil, err } @@ -2486,16 +2475,16 @@ func (c *serviceClient) Get(ctx context.Context, in *GetRequest, opts ...grpc.Ca return x, nil } -type Service_GetClient interface { +type ObjectService_GetClient interface { Recv() (*GetResponse, error) grpc.ClientStream } -type serviceGetClient struct { +type objectServiceGetClient struct { grpc.ClientStream } -func (x *serviceGetClient) Recv() (*GetResponse, error) { +func (x *objectServiceGetClient) Recv() (*GetResponse, error) { m := new(GetResponse) if err := x.ClientStream.RecvMsg(m); err != nil { return nil, err @@ -2503,30 +2492,30 @@ func (x *serviceGetClient) Recv() (*GetResponse, error) { return m, nil } -func (c *serviceClient) Put(ctx context.Context, opts ...grpc.CallOption) (Service_PutClient, error) { - stream, err := c.cc.NewStream(ctx, &_Service_serviceDesc.Streams[1], "/neo.fs.v2.object.Service/Put", opts...) +func (c *objectServiceClient) Put(ctx context.Context, opts ...grpc.CallOption) (ObjectService_PutClient, error) { + stream, err := c.cc.NewStream(ctx, &_ObjectService_serviceDesc.Streams[1], "/neo.fs.v2.object.ObjectService/Put", opts...) if err != nil { return nil, err } - x := &servicePutClient{stream} + x := &objectServicePutClient{stream} return x, nil } -type Service_PutClient interface { +type ObjectService_PutClient interface { Send(*PutRequest) error CloseAndRecv() (*PutResponse, error) grpc.ClientStream } -type servicePutClient struct { +type objectServicePutClient struct { grpc.ClientStream } -func (x *servicePutClient) Send(m *PutRequest) error { +func (x *objectServicePutClient) Send(m *PutRequest) error { return x.ClientStream.SendMsg(m) } -func (x *servicePutClient) CloseAndRecv() (*PutResponse, error) { +func (x *objectServicePutClient) CloseAndRecv() (*PutResponse, error) { if err := x.ClientStream.CloseSend(); err != nil { return nil, err } @@ -2537,30 +2526,30 @@ func (x *servicePutClient) CloseAndRecv() (*PutResponse, error) { return m, nil } -func (c *serviceClient) Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteResponse, error) { +func (c *objectServiceClient) Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteResponse, error) { out := new(DeleteResponse) - err := c.cc.Invoke(ctx, "/neo.fs.v2.object.Service/Delete", in, out, opts...) + err := c.cc.Invoke(ctx, "/neo.fs.v2.object.ObjectService/Delete", in, out, opts...) if err != nil { return nil, err } return out, nil } -func (c *serviceClient) Head(ctx context.Context, in *HeadRequest, opts ...grpc.CallOption) (*HeadResponse, error) { +func (c *objectServiceClient) Head(ctx context.Context, in *HeadRequest, opts ...grpc.CallOption) (*HeadResponse, error) { out := new(HeadResponse) - err := c.cc.Invoke(ctx, "/neo.fs.v2.object.Service/Head", in, out, opts...) + err := c.cc.Invoke(ctx, "/neo.fs.v2.object.ObjectService/Head", in, out, opts...) if err != nil { return nil, err } return out, nil } -func (c *serviceClient) Search(ctx context.Context, in *SearchRequest, opts ...grpc.CallOption) (Service_SearchClient, error) { - stream, err := c.cc.NewStream(ctx, &_Service_serviceDesc.Streams[2], "/neo.fs.v2.object.Service/Search", opts...) +func (c *objectServiceClient) Search(ctx context.Context, in *SearchRequest, opts ...grpc.CallOption) (ObjectService_SearchClient, error) { + stream, err := c.cc.NewStream(ctx, &_ObjectService_serviceDesc.Streams[2], "/neo.fs.v2.object.ObjectService/Search", opts...) if err != nil { return nil, err } - x := &serviceSearchClient{stream} + x := &objectServiceSearchClient{stream} if err := x.ClientStream.SendMsg(in); err != nil { return nil, err } @@ -2570,16 +2559,16 @@ func (c *serviceClient) Search(ctx context.Context, in *SearchRequest, opts ...g return x, nil } -type Service_SearchClient interface { +type ObjectService_SearchClient interface { Recv() (*SearchResponse, error) grpc.ClientStream } -type serviceSearchClient struct { +type objectServiceSearchClient struct { grpc.ClientStream } -func (x *serviceSearchClient) Recv() (*SearchResponse, error) { +func (x *objectServiceSearchClient) Recv() (*SearchResponse, error) { m := new(SearchResponse) if err := x.ClientStream.RecvMsg(m); err != nil { return nil, err @@ -2587,12 +2576,12 @@ func (x *serviceSearchClient) Recv() (*SearchResponse, error) { return m, nil } -func (c *serviceClient) GetRange(ctx context.Context, in *GetRangeRequest, opts ...grpc.CallOption) (Service_GetRangeClient, error) { - stream, err := c.cc.NewStream(ctx, &_Service_serviceDesc.Streams[3], "/neo.fs.v2.object.Service/GetRange", opts...) +func (c *objectServiceClient) GetRange(ctx context.Context, in *GetRangeRequest, opts ...grpc.CallOption) (ObjectService_GetRangeClient, error) { + stream, err := c.cc.NewStream(ctx, &_ObjectService_serviceDesc.Streams[3], "/neo.fs.v2.object.ObjectService/GetRange", opts...) if err != nil { return nil, err } - x := &serviceGetRangeClient{stream} + x := &objectServiceGetRangeClient{stream} if err := x.ClientStream.SendMsg(in); err != nil { return nil, err } @@ -2602,16 +2591,16 @@ func (c *serviceClient) GetRange(ctx context.Context, in *GetRangeRequest, opts return x, nil } -type Service_GetRangeClient interface { +type ObjectService_GetRangeClient interface { Recv() (*GetRangeResponse, error) grpc.ClientStream } -type serviceGetRangeClient struct { +type objectServiceGetRangeClient struct { grpc.ClientStream } -func (x *serviceGetRangeClient) Recv() (*GetRangeResponse, error) { +func (x *objectServiceGetRangeClient) Recv() (*GetRangeResponse, error) { m := new(GetRangeResponse) if err := x.ClientStream.RecvMsg(m); err != nil { return nil, err @@ -2619,30 +2608,30 @@ func (x *serviceGetRangeClient) Recv() (*GetRangeResponse, error) { return m, nil } -func (c *serviceClient) GetRangeHash(ctx context.Context, in *GetRangeHashRequest, opts ...grpc.CallOption) (*GetRangeHashResponse, error) { +func (c *objectServiceClient) GetRangeHash(ctx context.Context, in *GetRangeHashRequest, opts ...grpc.CallOption) (*GetRangeHashResponse, error) { out := new(GetRangeHashResponse) - err := c.cc.Invoke(ctx, "/neo.fs.v2.object.Service/GetRangeHash", in, out, opts...) + err := c.cc.Invoke(ctx, "/neo.fs.v2.object.ObjectService/GetRangeHash", in, out, opts...) if err != nil { return nil, err } return out, nil } -// ServiceServer is the server API for Service service. -type ServiceServer interface { +// ObjectServiceServer is the server API for ObjectService service. +type ObjectServiceServer interface { // Get the object from container. Response uses gRPC stream. First response // message carry object of requested address. Chunk messages are parts of // the object's payload if it is needed. All messages except first carry // chunks. Requested object can be restored by concatenation of object // message payload and all chunks keeping receiving order. - Get(*GetRequest, Service_GetServer) error + Get(*GetRequest, ObjectService_GetServer) error // Put the object into container. Request uses gRPC stream. First message // SHOULD BE type of PutHeader. Container id and Owner id of object SHOULD // BE set. Session token SHOULD BE obtained before put operation (see // session package). Chunk messages considered by server as part of object // payload. All messages except first SHOULD BE chunks. Chunk messages // SHOULD BE sent in direct order of fragmentation. - Put(Service_PutServer) error + Put(ObjectService_PutServer) error // Delete the object from a container Delete(context.Context, *DeleteRequest) (*DeleteResponse, error) // Head returns the object without data payload. Object in the @@ -2652,11 +2641,11 @@ type ServiceServer interface { // Search objects in container. Version of query language format SHOULD BE // set to 1. Search query represented in serialized format (see query // package). - Search(*SearchRequest, Service_SearchServer) error + Search(*SearchRequest, ObjectService_SearchServer) error // GetRange of data payload. Range is a pair (offset, length). // Requested range can be restored by concatenation of all chunks // keeping receiving order. - GetRange(*GetRangeRequest, Service_GetRangeServer) error + GetRange(*GetRangeRequest, ObjectService_GetRangeServer) error // GetRangeHash returns homomorphic hash of object payload range after XOR // operation. Ranges are set of pairs (offset, length). Hashes order in // response corresponds to ranges order in request. Homomorphic hash is @@ -2664,76 +2653,76 @@ type ServiceServer interface { GetRangeHash(context.Context, *GetRangeHashRequest) (*GetRangeHashResponse, error) } -// UnimplementedServiceServer can be embedded to have forward compatible implementations. -type UnimplementedServiceServer struct { +// UnimplementedObjectServiceServer can be embedded to have forward compatible implementations. +type UnimplementedObjectServiceServer struct { } -func (*UnimplementedServiceServer) Get(req *GetRequest, srv Service_GetServer) error { +func (*UnimplementedObjectServiceServer) Get(req *GetRequest, srv ObjectService_GetServer) error { return status.Errorf(codes.Unimplemented, "method Get not implemented") } -func (*UnimplementedServiceServer) Put(srv Service_PutServer) error { +func (*UnimplementedObjectServiceServer) Put(srv ObjectService_PutServer) error { return status.Errorf(codes.Unimplemented, "method Put not implemented") } -func (*UnimplementedServiceServer) Delete(ctx context.Context, req *DeleteRequest) (*DeleteResponse, error) { +func (*UnimplementedObjectServiceServer) Delete(ctx context.Context, req *DeleteRequest) (*DeleteResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Delete not implemented") } -func (*UnimplementedServiceServer) Head(ctx context.Context, req *HeadRequest) (*HeadResponse, error) { +func (*UnimplementedObjectServiceServer) Head(ctx context.Context, req *HeadRequest) (*HeadResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Head not implemented") } -func (*UnimplementedServiceServer) Search(req *SearchRequest, srv Service_SearchServer) error { +func (*UnimplementedObjectServiceServer) Search(req *SearchRequest, srv ObjectService_SearchServer) error { return status.Errorf(codes.Unimplemented, "method Search not implemented") } -func (*UnimplementedServiceServer) GetRange(req *GetRangeRequest, srv Service_GetRangeServer) error { +func (*UnimplementedObjectServiceServer) GetRange(req *GetRangeRequest, srv ObjectService_GetRangeServer) error { return status.Errorf(codes.Unimplemented, "method GetRange not implemented") } -func (*UnimplementedServiceServer) GetRangeHash(ctx context.Context, req *GetRangeHashRequest) (*GetRangeHashResponse, error) { +func (*UnimplementedObjectServiceServer) GetRangeHash(ctx context.Context, req *GetRangeHashRequest) (*GetRangeHashResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method GetRangeHash not implemented") } -func RegisterServiceServer(s *grpc.Server, srv ServiceServer) { - s.RegisterService(&_Service_serviceDesc, srv) +func RegisterObjectServiceServer(s *grpc.Server, srv ObjectServiceServer) { + s.RegisterService(&_ObjectService_serviceDesc, srv) } -func _Service_Get_Handler(srv interface{}, stream grpc.ServerStream) error { +func _ObjectService_Get_Handler(srv interface{}, stream grpc.ServerStream) error { m := new(GetRequest) if err := stream.RecvMsg(m); err != nil { return err } - return srv.(ServiceServer).Get(m, &serviceGetServer{stream}) + return srv.(ObjectServiceServer).Get(m, &objectServiceGetServer{stream}) } -type Service_GetServer interface { +type ObjectService_GetServer interface { Send(*GetResponse) error grpc.ServerStream } -type serviceGetServer struct { +type objectServiceGetServer struct { grpc.ServerStream } -func (x *serviceGetServer) Send(m *GetResponse) error { +func (x *objectServiceGetServer) Send(m *GetResponse) error { return x.ServerStream.SendMsg(m) } -func _Service_Put_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(ServiceServer).Put(&servicePutServer{stream}) +func _ObjectService_Put_Handler(srv interface{}, stream grpc.ServerStream) error { + return srv.(ObjectServiceServer).Put(&objectServicePutServer{stream}) } -type Service_PutServer interface { +type ObjectService_PutServer interface { SendAndClose(*PutResponse) error Recv() (*PutRequest, error) grpc.ServerStream } -type servicePutServer struct { +type objectServicePutServer struct { grpc.ServerStream } -func (x *servicePutServer) SendAndClose(m *PutResponse) error { +func (x *objectServicePutServer) SendAndClose(m *PutResponse) error { return x.ServerStream.SendMsg(m) } -func (x *servicePutServer) Recv() (*PutRequest, error) { +func (x *objectServicePutServer) Recv() (*PutRequest, error) { m := new(PutRequest) if err := x.ServerStream.RecvMsg(m); err != nil { return nil, err @@ -2741,138 +2730,138 @@ func (x *servicePutServer) Recv() (*PutRequest, error) { return m, nil } -func _Service_Delete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _ObjectService_Delete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(DeleteRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(ServiceServer).Delete(ctx, in) + return srv.(ObjectServiceServer).Delete(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/neo.fs.v2.object.Service/Delete", + FullMethod: "/neo.fs.v2.object.ObjectService/Delete", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ServiceServer).Delete(ctx, req.(*DeleteRequest)) + return srv.(ObjectServiceServer).Delete(ctx, req.(*DeleteRequest)) } return interceptor(ctx, in, info, handler) } -func _Service_Head_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _ObjectService_Head_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(HeadRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(ServiceServer).Head(ctx, in) + return srv.(ObjectServiceServer).Head(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/neo.fs.v2.object.Service/Head", + FullMethod: "/neo.fs.v2.object.ObjectService/Head", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ServiceServer).Head(ctx, req.(*HeadRequest)) + return srv.(ObjectServiceServer).Head(ctx, req.(*HeadRequest)) } return interceptor(ctx, in, info, handler) } -func _Service_Search_Handler(srv interface{}, stream grpc.ServerStream) error { +func _ObjectService_Search_Handler(srv interface{}, stream grpc.ServerStream) error { m := new(SearchRequest) if err := stream.RecvMsg(m); err != nil { return err } - return srv.(ServiceServer).Search(m, &serviceSearchServer{stream}) + return srv.(ObjectServiceServer).Search(m, &objectServiceSearchServer{stream}) } -type Service_SearchServer interface { +type ObjectService_SearchServer interface { Send(*SearchResponse) error grpc.ServerStream } -type serviceSearchServer struct { +type objectServiceSearchServer struct { grpc.ServerStream } -func (x *serviceSearchServer) Send(m *SearchResponse) error { +func (x *objectServiceSearchServer) Send(m *SearchResponse) error { return x.ServerStream.SendMsg(m) } -func _Service_GetRange_Handler(srv interface{}, stream grpc.ServerStream) error { +func _ObjectService_GetRange_Handler(srv interface{}, stream grpc.ServerStream) error { m := new(GetRangeRequest) if err := stream.RecvMsg(m); err != nil { return err } - return srv.(ServiceServer).GetRange(m, &serviceGetRangeServer{stream}) + return srv.(ObjectServiceServer).GetRange(m, &objectServiceGetRangeServer{stream}) } -type Service_GetRangeServer interface { +type ObjectService_GetRangeServer interface { Send(*GetRangeResponse) error grpc.ServerStream } -type serviceGetRangeServer struct { +type objectServiceGetRangeServer struct { grpc.ServerStream } -func (x *serviceGetRangeServer) Send(m *GetRangeResponse) error { +func (x *objectServiceGetRangeServer) Send(m *GetRangeResponse) error { return x.ServerStream.SendMsg(m) } -func _Service_GetRangeHash_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _ObjectService_GetRangeHash_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(GetRangeHashRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(ServiceServer).GetRangeHash(ctx, in) + return srv.(ObjectServiceServer).GetRangeHash(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/neo.fs.v2.object.Service/GetRangeHash", + FullMethod: "/neo.fs.v2.object.ObjectService/GetRangeHash", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ServiceServer).GetRangeHash(ctx, req.(*GetRangeHashRequest)) + return srv.(ObjectServiceServer).GetRangeHash(ctx, req.(*GetRangeHashRequest)) } return interceptor(ctx, in, info, handler) } -var _Service_serviceDesc = grpc.ServiceDesc{ - ServiceName: "neo.fs.v2.object.Service", - HandlerType: (*ServiceServer)(nil), +var _ObjectService_serviceDesc = grpc.ServiceDesc{ + ServiceName: "neo.fs.v2.object.ObjectService", + HandlerType: (*ObjectServiceServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "Delete", - Handler: _Service_Delete_Handler, + Handler: _ObjectService_Delete_Handler, }, { MethodName: "Head", - Handler: _Service_Head_Handler, + Handler: _ObjectService_Head_Handler, }, { MethodName: "GetRangeHash", - Handler: _Service_GetRangeHash_Handler, + Handler: _ObjectService_GetRangeHash_Handler, }, }, Streams: []grpc.StreamDesc{ { StreamName: "Get", - Handler: _Service_Get_Handler, + Handler: _ObjectService_Get_Handler, ServerStreams: true, }, { StreamName: "Put", - Handler: _Service_Put_Handler, + Handler: _ObjectService_Put_Handler, ClientStreams: true, }, { StreamName: "Search", - Handler: _Service_Search_Handler, + Handler: _ObjectService_Search_Handler, ServerStreams: true, }, { StreamName: "GetRange", - Handler: _Service_GetRange_Handler, + Handler: _ObjectService_GetRange_Handler, ServerStreams: true, }, }, @@ -4116,17 +4105,24 @@ func (m *SearchRequest_Body) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } - if m.Query != nil { - { - size, err := m.Query.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err + if len(m.Filters) > 0 { + for iNdEx := len(m.Filters) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Filters[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x1a } + } + if m.Version != 0 { + i = encodeVarintService(dAtA, i, uint64(m.Version)) i-- - dAtA[i] = 0x12 + dAtA[i] = 0x10 } if m.ContainerId != nil { { @@ -4143,7 +4139,7 @@ func (m *SearchRequest_Body) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *SearchRequest_Body_Query) Marshal() (dAtA []byte, err error) { +func (m *SearchRequest_Body_Filter) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -4153,58 +4149,12 @@ func (m *SearchRequest_Body_Query) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *SearchRequest_Body_Query) MarshalTo(dAtA []byte) (int, error) { +func (m *SearchRequest_Body_Filter) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *SearchRequest_Body_Query) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.Filters) > 0 { - for iNdEx := len(m.Filters) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Filters[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - if m.Version != 0 { - i = encodeVarintService(dAtA, i, uint64(m.Version)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *SearchRequest_Body_Query_Filter) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *SearchRequest_Body_Query_Filter) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *SearchRequest_Body_Query_Filter) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *SearchRequest_Body_Filter) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -5332,22 +5282,6 @@ func (m *SearchRequest_Body) Size() (n int) { l = m.ContainerId.Size() n += 1 + l + sovService(uint64(l)) } - if m.Query != nil { - l = m.Query.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *SearchRequest_Body_Query) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l if m.Version != 0 { n += 1 + sovService(uint64(m.Version)) } @@ -5363,7 +5297,7 @@ func (m *SearchRequest_Body_Query) Size() (n int) { return n } -func (m *SearchRequest_Body_Query_Filter) Size() (n int) { +func (m *SearchRequest_Body_Filter) Size() (n int) { if m == nil { return 0 } @@ -8556,96 +8490,6 @@ func (m *SearchRequest_Body) Unmarshal(dAtA []byte) error { } iNdEx = postIndex case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Query", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Query == nil { - m.Query = &SearchRequest_Body_Query{} - } - if err := m.Query.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *SearchRequest_Body_Query) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Query: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Query: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) } @@ -8664,7 +8508,7 @@ func (m *SearchRequest_Body_Query) Unmarshal(dAtA []byte) error { break } } - case 2: + case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Filters", wireType) } @@ -8693,7 +8537,7 @@ func (m *SearchRequest_Body_Query) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Filters = append(m.Filters, &SearchRequest_Body_Query_Filter{}) + m.Filters = append(m.Filters, &SearchRequest_Body_Filter{}) if err := m.Filters[len(m.Filters)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -8723,7 +8567,7 @@ func (m *SearchRequest_Body_Query) Unmarshal(dAtA []byte) error { } return nil } -func (m *SearchRequest_Body_Query_Filter) Unmarshal(dAtA []byte) error { +func (m *SearchRequest_Body_Filter) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -8766,7 +8610,7 @@ func (m *SearchRequest_Body_Query_Filter) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.MatchType |= SearchRequest_Body_Query_Filter_MatchType(b&0x7F) << shift + m.MatchType |= SearchRequest_Body_Filter_MatchType(b&0x7F) << shift if b < 0x80 { break } diff --git a/v2/object/types.pb.go b/v2/object/types.pb.go index 0f083d3..a3712b5 100644 --- a/v2/object/types.pb.go +++ b/v2/object/types.pb.go @@ -56,6 +56,7 @@ func (ObjectType) EnumDescriptor() ([]byte, []int) { return fileDescriptor_fcb9e8df342f43c6, []int{0} } +// Object Headers type Header struct { // Object's container ContainerId *refs.ContainerID `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` @@ -70,14 +71,16 @@ type Header struct { // 0xFFFFFFFFFFFFFFFF means `payload_length` is unknown PayloadLength uint64 `protobuf:"varint,5,opt,name=payload_length,json=payloadLength,proto3" json:"payload_length,omitempty"` // Hash of payload bytes - PayloadHash []byte `protobuf:"bytes,6,opt,name=payload_hash,json=payloadHash,proto3" json:"payload_hash,omitempty"` - ObjectType ObjectType `protobuf:"varint,7,opt,name=object_type,json=objectType,proto3,enum=neo.fs.v2.object.ObjectType" json:"object_type,omitempty"` + PayloadHash []byte `protobuf:"bytes,6,opt,name=payload_hash,json=payloadHash,proto3" json:"payload_hash,omitempty"` + // Special object type + ObjectType ObjectType `protobuf:"varint,7,opt,name=object_type,json=objectType,proto3,enum=neo.fs.v2.object.ObjectType" json:"object_type,omitempty"` // Homomorphic hash of the object payload. HomomorphicHash []byte `protobuf:"bytes,8,opt,name=homomorphic_hash,json=homomorphicHash,proto3" json:"homomorphic_hash,omitempty"` // Session token, if it was used during Object creation. // Need it to verify integrity and authenticity out of Request scope. SessionToken *service.SessionToken `protobuf:"bytes,9,opt,name=session_token,json=sessionToken,proto3" json:"session_token,omitempty"` - Attributes []*Header_Attribute `protobuf:"bytes,10,rep,name=attributes,proto3" json:"attributes,omitempty"` + // User-defined object attributes + Attributes []*Header_Attribute `protobuf:"bytes,10,rep,name=attributes,proto3" json:"attributes,omitempty"` // Position of the object in the split hierarchy. Split *Header_Split `protobuf:"bytes,11,opt,name=split,proto3" json:"split,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` @@ -430,52 +433,52 @@ func init() { func init() { proto.RegisterFile("v2/object/types.proto", fileDescriptor_fcb9e8df342f43c6) } var fileDescriptor_fcb9e8df342f43c6 = []byte{ - // 718 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x94, 0xdf, 0x6e, 0xda, 0x48, - 0x14, 0xc6, 0x63, 0x08, 0xff, 0x8e, 0x21, 0xf1, 0xce, 0xee, 0x2a, 0x16, 0xbb, 0x62, 0xd9, 0x48, - 0x2b, 0xb1, 0xbb, 0x8a, 0x59, 0x11, 0xf6, 0xa6, 0x55, 0x2a, 0x91, 0x86, 0x12, 0xa4, 0x34, 0x44, - 0x03, 0xe9, 0x45, 0x6f, 0x90, 0xb1, 0x07, 0xec, 0x06, 0x3c, 0x96, 0xc7, 0x38, 0xe2, 0x4d, 0xfa, - 0x0c, 0x95, 0x7a, 0xd3, 0x97, 0x68, 0x2f, 0xfb, 0x08, 0x55, 0xfa, 0x22, 0x95, 0x67, 0xc6, 0x86, - 0x26, 0x4d, 0xda, 0x2b, 0x7b, 0x3e, 0xff, 0xbe, 0x73, 0xe6, 0x9c, 0x39, 0x63, 0xf8, 0x35, 0x6a, - 0x35, 0xe9, 0xe4, 0x15, 0xb1, 0xc2, 0x66, 0xb8, 0xf2, 0x09, 0x33, 0xfc, 0x80, 0x86, 0x14, 0x69, - 0x1e, 0xa1, 0xc6, 0x94, 0x19, 0x51, 0xcb, 0x10, 0x5f, 0xab, 0x3f, 0x47, 0xad, 0x66, 0x40, 0xa6, - 0x6c, 0x13, 0xab, 0xc6, 0x6e, 0x46, 0x82, 0xc8, 0xb5, 0x48, 0x73, 0x41, 0x42, 0x53, 0xca, 0x7b, - 0x1b, 0x72, 0x44, 0x02, 0x77, 0xba, 0x12, 0x1f, 0xf6, 0xdf, 0x15, 0x20, 0x7f, 0x4a, 0x4c, 0x9b, - 0x04, 0xe8, 0x09, 0x94, 0x2d, 0xea, 0x85, 0xa6, 0xeb, 0x91, 0x60, 0xec, 0xda, 0xba, 0x52, 0x57, - 0x1a, 0x6a, 0xeb, 0x37, 0x63, 0x9d, 0x38, 0xce, 0x66, 0x3c, 0x4d, 0x98, 0xfe, 0x09, 0x56, 0x53, - 0x43, 0xdf, 0x46, 0x2d, 0x28, 0xd2, 0x6b, 0xe9, 0xcd, 0x70, 0xef, 0xde, 0x6d, 0xef, 0xe0, 0x5a, - 0xf8, 0x0a, 0x1c, 0xec, 0xdb, 0xe8, 0x2f, 0xd8, 0xb1, 0x02, 0x62, 0x86, 0x2e, 0xf5, 0xc6, 0xc4, - 0xa7, 0x96, 0xa3, 0x67, 0xeb, 0x4a, 0x63, 0x1b, 0x57, 0x12, 0xb5, 0x1b, 0x8b, 0xa8, 0x0d, 0x85, - 0x88, 0x04, 0xcc, 0xa5, 0x9e, 0xbe, 0xcd, 0x23, 0x57, 0x37, 0x22, 0xcb, 0xba, 0x8c, 0x17, 0x82, - 0xc0, 0x09, 0x1a, 0x07, 0xf7, 0xcd, 0xd5, 0x9c, 0x9a, 0xf6, 0x78, 0x4e, 0xbc, 0x59, 0xe8, 0xe8, - 0x39, 0x11, 0x5c, 0xaa, 0x67, 0x5c, 0x44, 0x7f, 0x42, 0x39, 0xc1, 0x1c, 0x93, 0x39, 0x7a, 0xbe, - 0xae, 0x34, 0xca, 0x58, 0x95, 0xda, 0xa9, 0xc9, 0x1c, 0x74, 0x04, 0xaa, 0x68, 0xfa, 0x38, 0xee, - 0xb5, 0x5e, 0xa8, 0x2b, 0x8d, 0x9d, 0xd6, 0xef, 0xc6, 0xed, 0x23, 0x31, 0x06, 0xfc, 0x31, 0x5a, - 0xf9, 0x04, 0x03, 0x4d, 0xdf, 0xd1, 0xdf, 0xa0, 0x39, 0x74, 0x41, 0x17, 0x34, 0xf0, 0x1d, 0xd7, - 0x12, 0x59, 0x8a, 0x3c, 0xcb, 0xee, 0x86, 0xce, 0x33, 0x9d, 0x40, 0x85, 0x11, 0x16, 0x6f, 0x7f, - 0x1c, 0xd2, 0x2b, 0xe2, 0xe9, 0x25, 0x5e, 0xef, 0x1f, 0xdf, 0xa8, 0x77, 0x28, 0xb8, 0x51, 0x8c, - 0xe1, 0x32, 0xdb, 0x58, 0xa1, 0x63, 0x00, 0x33, 0x0c, 0x03, 0x77, 0xb2, 0x0c, 0x09, 0xd3, 0xa1, - 0x9e, 0x6d, 0xa8, 0xad, 0xfd, 0xbb, 0xdb, 0x15, 0x07, 0x6f, 0x74, 0x12, 0x14, 0x6f, 0xb8, 0x50, - 0x1b, 0x72, 0xcc, 0x9f, 0xbb, 0xa1, 0xae, 0xf2, 0x1d, 0xd4, 0xee, 0xb5, 0x0f, 0x63, 0x0a, 0x0b, - 0xb8, 0x7a, 0x08, 0xa5, 0x34, 0x1c, 0xd2, 0x20, 0x7b, 0x45, 0x56, 0x7c, 0x90, 0x4a, 0x38, 0x7e, - 0x45, 0xbf, 0x40, 0x2e, 0x32, 0xe7, 0x4b, 0xc2, 0x07, 0xa4, 0x84, 0xc5, 0xa2, 0xfa, 0x36, 0x03, - 0x39, 0x1e, 0x05, 0xfd, 0x07, 0x79, 0xdf, 0x0c, 0x88, 0x17, 0xca, 0xe9, 0xd3, 0xef, 0x4c, 0x10, - 0x4f, 0xdd, 0x3f, 0xc1, 0x92, 0x43, 0x6d, 0x28, 0xfa, 0x01, 0x89, 0x5c, 0xba, 0x64, 0x72, 0xea, - 0xee, 0xf7, 0xa4, 0x24, 0xea, 0x81, 0x26, 0xfc, 0x63, 0xe6, 0xce, 0x3c, 0x33, 0x5c, 0x06, 0x84, - 0x4f, 0x9e, 0xfa, 0xd5, 0xa9, 0xa6, 0x9d, 0x4e, 0x18, 0xbc, 0x2b, 0x5c, 0xa9, 0x80, 0x8e, 0xa0, - 0x22, 0x03, 0x39, 0xbc, 0x1b, 0x72, 0x3e, 0xf5, 0xfb, 0xba, 0x85, 0xcb, 0x02, 0x97, 0x77, 0xae, - 0x0d, 0x45, 0xcb, 0x71, 0xe7, 0x76, 0x40, 0x3c, 0x3d, 0xc7, 0x8f, 0xe9, 0x81, 0xdd, 0x27, 0xe4, - 0xfe, 0x7b, 0x05, 0xf2, 0x42, 0x46, 0xff, 0x43, 0x49, 0x4e, 0x66, 0x7a, 0x63, 0x1f, 0x88, 0x20, - 0xd0, 0xbe, 0x8d, 0x1e, 0x41, 0x69, 0x5d, 0x78, 0xe6, 0x07, 0x0a, 0x5f, 0xe3, 0xf1, 0x19, 0xc9, - 0x5a, 0xb3, 0xdf, 0xa9, 0x55, 0x72, 0x48, 0x87, 0x82, 0xbc, 0x4d, 0xbc, 0x3d, 0x65, 0x9c, 0x2c, - 0xff, 0x79, 0x0c, 0xb0, 0xbe, 0x33, 0x48, 0x85, 0x02, 0xee, 0xf6, 0x2e, 0xcf, 0x3a, 0x58, 0xdb, - 0x42, 0x15, 0x28, 0x8d, 0x06, 0xcf, 0x8f, 0x87, 0xa3, 0xc1, 0x79, 0x57, 0x53, 0xd0, 0x4f, 0x50, - 0x19, 0x8e, 0x06, 0xb8, 0xd3, 0xeb, 0x8e, 0x7b, 0x78, 0x70, 0x79, 0xa1, 0x65, 0x8e, 0x2f, 0x3e, - 0xdc, 0xd4, 0x94, 0x8f, 0x37, 0x35, 0xe5, 0xd3, 0x4d, 0x4d, 0x79, 0xfd, 0xb9, 0xb6, 0xf5, 0xf2, - 0xdf, 0x99, 0x1b, 0x3a, 0xcb, 0x89, 0x61, 0xd1, 0x45, 0xd3, 0x63, 0xbe, 0x65, 0x1d, 0xd8, 0x24, - 0x6a, 0x7a, 0x84, 0x4e, 0xd9, 0x81, 0xe9, 0xbb, 0x07, 0x33, 0xda, 0x4c, 0xff, 0xae, 0x6f, 0x32, - 0xda, 0x39, 0xa1, 0xcf, 0x86, 0x46, 0xe7, 0xa2, 0x2f, 0x5b, 0x34, 0xc9, 0xf3, 0x9f, 0xe2, 0xe1, - 0x97, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0xd0, 0xe4, 0x6c, 0x84, 0x05, 0x00, 0x00, + // 720 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x94, 0xcf, 0x6e, 0xd3, 0x4e, + 0x10, 0xc7, 0xeb, 0xa4, 0xf9, 0x37, 0x4e, 0xda, 0xfc, 0xb6, 0x3f, 0x54, 0x2b, 0xa0, 0x10, 0x2a, + 0x21, 0x05, 0xa4, 0x3a, 0xc8, 0x0d, 0x17, 0xaa, 0x22, 0xa5, 0x34, 0xa4, 0x91, 0x4a, 0x53, 0x6d, + 0x52, 0x0e, 0xbd, 0x44, 0x8e, 0xbd, 0x89, 0x4d, 0x13, 0xaf, 0xe5, 0x75, 0x5c, 0xe5, 0x4d, 0x78, + 0x06, 0x24, 0x2e, 0xbc, 0x04, 0x1c, 0x79, 0x04, 0x54, 0x5e, 0x04, 0x79, 0xd7, 0x76, 0x42, 0x4b, + 0x0b, 0x27, 0x7b, 0xbf, 0xfe, 0x7c, 0x67, 0x76, 0x66, 0x67, 0x0d, 0x0f, 0x02, 0xad, 0x41, 0x47, + 0x1f, 0x88, 0xe1, 0x37, 0xfc, 0x85, 0x4b, 0x98, 0xea, 0x7a, 0xd4, 0xa7, 0xa8, 0xec, 0x10, 0xaa, + 0x8e, 0x99, 0x1a, 0x68, 0xaa, 0xf8, 0x5a, 0xd9, 0x0a, 0xb4, 0x86, 0x47, 0xc6, 0x6c, 0x15, 0xab, + 0x84, 0x6e, 0x46, 0xbc, 0xc0, 0x36, 0x48, 0x63, 0x46, 0x7c, 0x3d, 0x92, 0xb7, 0x57, 0xe4, 0x80, + 0x78, 0xf6, 0x78, 0x21, 0x3e, 0xec, 0x7c, 0xc9, 0x41, 0xf6, 0x98, 0xe8, 0x26, 0xf1, 0xd0, 0x6b, + 0x28, 0x1a, 0xd4, 0xf1, 0x75, 0xdb, 0x21, 0xde, 0xd0, 0x36, 0x15, 0xa9, 0x26, 0xd5, 0x65, 0xed, + 0xa1, 0xba, 0x4c, 0x1c, 0x66, 0x53, 0xdf, 0xc4, 0x4c, 0xf7, 0x08, 0xcb, 0x89, 0xa1, 0x6b, 0x22, + 0x0d, 0xf2, 0xf4, 0x2a, 0xf2, 0xa6, 0xb8, 0x77, 0xfb, 0xa6, 0xb7, 0x77, 0x25, 0x7c, 0x39, 0x0e, + 0x76, 0x4d, 0xf4, 0x14, 0x36, 0x0c, 0x8f, 0xe8, 0xbe, 0x4d, 0x9d, 0x21, 0x71, 0xa9, 0x61, 0x29, + 0xe9, 0x9a, 0x54, 0x5f, 0xc7, 0xa5, 0x58, 0x6d, 0x87, 0x22, 0x6a, 0x42, 0x2e, 0x20, 0x1e, 0xb3, + 0xa9, 0xa3, 0xac, 0xf3, 0xc8, 0x95, 0x95, 0xc8, 0x51, 0x5d, 0xea, 0x7b, 0x41, 0xe0, 0x18, 0x0d, + 0x83, 0xbb, 0xfa, 0x62, 0x4a, 0x75, 0x73, 0x38, 0x25, 0xce, 0xc4, 0xb7, 0x94, 0x8c, 0x08, 0x1e, + 0xa9, 0x27, 0x5c, 0x44, 0x4f, 0xa0, 0x18, 0x63, 0x96, 0xce, 0x2c, 0x25, 0x5b, 0x93, 0xea, 0x45, + 0x2c, 0x47, 0xda, 0xb1, 0xce, 0x2c, 0x74, 0x00, 0xb2, 0x68, 0xfa, 0x30, 0xec, 0xb5, 0x92, 0xab, + 0x49, 0xf5, 0x0d, 0xed, 0x91, 0x7a, 0xf3, 0x48, 0xd4, 0x1e, 0x7f, 0x0c, 0x16, 0x2e, 0xc1, 0x40, + 0x93, 0x77, 0xf4, 0x0c, 0xca, 0x16, 0x9d, 0xd1, 0x19, 0xf5, 0x5c, 0xcb, 0x36, 0x44, 0x96, 0x3c, + 0xcf, 0xb2, 0xb9, 0xa2, 0xf3, 0x4c, 0x47, 0x50, 0x62, 0x84, 0x85, 0xdb, 0x1f, 0xfa, 0xf4, 0x92, + 0x38, 0x4a, 0x81, 0xd7, 0xfb, 0xf8, 0x0f, 0xf5, 0xf6, 0x05, 0x37, 0x08, 0x31, 0x5c, 0x64, 0x2b, + 0x2b, 0x74, 0x08, 0xa0, 0xfb, 0xbe, 0x67, 0x8f, 0xe6, 0x3e, 0x61, 0x0a, 0xd4, 0xd2, 0x75, 0x59, + 0xdb, 0xb9, 0xbd, 0x5d, 0x71, 0xf0, 0x6a, 0x2b, 0x46, 0xf1, 0x8a, 0x0b, 0x35, 0x21, 0xc3, 0xdc, + 0xa9, 0xed, 0x2b, 0x32, 0xdf, 0x41, 0xf5, 0x4e, 0x7b, 0x3f, 0xa4, 0xb0, 0x80, 0x2b, 0x7b, 0x50, + 0x48, 0xc2, 0xa1, 0x32, 0xa4, 0x2f, 0xc9, 0x82, 0x0f, 0x52, 0x01, 0x87, 0xaf, 0xe8, 0x7f, 0xc8, + 0x04, 0xfa, 0x74, 0x4e, 0xf8, 0x80, 0x14, 0xb0, 0x58, 0x54, 0x3e, 0xa7, 0x20, 0xc3, 0xa3, 0xa0, + 0x17, 0x90, 0x75, 0x75, 0x8f, 0x38, 0x7e, 0x34, 0x7d, 0xca, 0xad, 0x09, 0xe2, 0xa9, 0xbb, 0x47, + 0x38, 0xe2, 0x50, 0x13, 0xf2, 0xae, 0x47, 0x02, 0x9b, 0xce, 0x59, 0x34, 0x75, 0x77, 0x7b, 0x12, + 0x12, 0x75, 0xa0, 0x2c, 0xfc, 0x43, 0x66, 0x4f, 0x1c, 0xdd, 0x9f, 0x7b, 0x84, 0x4f, 0x9e, 0xfc, + 0xdb, 0xa9, 0x26, 0x9d, 0x8e, 0x19, 0xbc, 0x29, 0x5c, 0x89, 0x80, 0x0e, 0xa0, 0x14, 0x05, 0xb2, + 0x78, 0x37, 0xa2, 0xf9, 0x54, 0xee, 0xea, 0x16, 0x2e, 0x0a, 0x3c, 0xba, 0x73, 0x4d, 0xc8, 0x1b, + 0x96, 0x3d, 0x35, 0x3d, 0xe2, 0x28, 0x19, 0x7e, 0x4c, 0xf7, 0xec, 0x3e, 0x26, 0x77, 0xbe, 0x4a, + 0x90, 0x15, 0x32, 0x7a, 0x09, 0x85, 0x68, 0x32, 0x93, 0x1b, 0x7b, 0x4f, 0x04, 0x81, 0x76, 0x4d, + 0xf4, 0x0a, 0x0a, 0xcb, 0xc2, 0x53, 0xff, 0x50, 0xf8, 0x12, 0x0f, 0xcf, 0x28, 0xaa, 0x35, 0xfd, + 0x97, 0x5a, 0x23, 0x0e, 0x29, 0x90, 0x8b, 0x6e, 0x13, 0x6f, 0x4f, 0x11, 0xc7, 0xcb, 0xe7, 0xfb, + 0x00, 0xcb, 0x3b, 0x83, 0x64, 0xc8, 0xe1, 0x76, 0xe7, 0xfc, 0xa4, 0x85, 0xcb, 0x6b, 0xa8, 0x04, + 0x85, 0x41, 0xef, 0xdd, 0x61, 0x7f, 0xd0, 0x3b, 0x6d, 0x97, 0x25, 0xf4, 0x1f, 0x94, 0xfa, 0x83, + 0x1e, 0x6e, 0x75, 0xda, 0xc3, 0x0e, 0xee, 0x9d, 0x9f, 0x95, 0x53, 0x87, 0x17, 0xdf, 0xae, 0xab, + 0xd2, 0xf7, 0xeb, 0xaa, 0xf4, 0xe3, 0xba, 0x2a, 0x7d, 0xfc, 0x59, 0x5d, 0xbb, 0xd0, 0x26, 0xb6, + 0x6f, 0xcd, 0x47, 0xaa, 0x41, 0x67, 0x0d, 0x87, 0xb9, 0x86, 0xb1, 0x6b, 0x92, 0xa0, 0xe1, 0x10, + 0x3a, 0x66, 0xbb, 0xba, 0x6b, 0xef, 0x4e, 0x68, 0x23, 0xf9, 0xbb, 0xee, 0x8b, 0xc7, 0xa7, 0xd4, + 0xd6, 0x29, 0xa1, 0x6f, 0xfb, 0x6a, 0xeb, 0xac, 0x1b, 0x56, 0x20, 0xb6, 0x33, 0xca, 0xf2, 0xdf, + 0xe3, 0xde, 0xaf, 0x00, 0x00, 0x00, 0xff, 0xff, 0xd6, 0x66, 0x06, 0xbc, 0x8e, 0x05, 0x00, 0x00, } func (m *Header) Marshal() (dAtA []byte, err error) { diff --git a/v2/refs/types.pb.go b/v2/refs/types.pb.go index d5ecec6..5e57a4b 100644 --- a/v2/refs/types.pb.go +++ b/v2/refs/types.pb.go @@ -237,7 +237,7 @@ func init() { func init() { proto.RegisterFile("v2/refs/types.proto", fileDescriptor_8ea16029b13f1cfa) } var fileDescriptor_8ea16029b13f1cfa = []byte{ - // 256 bytes of a gzipped FileDescriptorProto + // 259 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x2e, 0x33, 0xd2, 0x2f, 0x4a, 0x4d, 0x2b, 0xd6, 0x2f, 0xa9, 0x2c, 0x48, 0x2d, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0xcb, 0x4b, 0xcd, 0xd7, 0x4b, 0x2b, 0xd6, 0x2b, 0x33, 0xd2, 0x03, 0xc9, 0x29, 0x35, 0x30, @@ -248,12 +248,13 @@ var fileDescriptor_8ea16029b13f1cfa = []byte{ 0x40, 0xd7, 0xec, 0x0f, 0x56, 0xe0, 0xe9, 0x12, 0xc4, 0x01, 0x51, 0xea, 0x99, 0xa2, 0xa4, 0xc0, 0xc5, 0x01, 0x13, 0x15, 0x12, 0xe1, 0x62, 0x2d, 0x4b, 0xcc, 0x29, 0x4d, 0x05, 0xdb, 0xcd, 0x13, 0x04, 0xe1, 0x28, 0x29, 0x73, 0x71, 0x23, 0x59, 0x8a, 0x43, 0x91, 0x3c, 0x17, 0xbb, 0x7f, 0x39, - 0x1e, 0x05, 0x4e, 0x3e, 0x27, 0x1e, 0xc9, 0x31, 0x5e, 0x78, 0x24, 0xc7, 0xf8, 0xe0, 0x91, 0x1c, - 0xe3, 0x8c, 0xc7, 0x72, 0x0c, 0x51, 0x9a, 0xe9, 0x99, 0x25, 0x19, 0xa5, 0x49, 0x7a, 0xc9, 0xf9, + 0x1e, 0x05, 0x4e, 0x21, 0x27, 0x1e, 0xc9, 0x31, 0x5e, 0x78, 0x24, 0xc7, 0xf8, 0xe0, 0x91, 0x1c, + 0xe3, 0x8c, 0xc7, 0x72, 0x0c, 0x51, 0x7a, 0xe9, 0x99, 0x25, 0x19, 0xa5, 0x49, 0x7a, 0xc9, 0xf9, 0xb9, 0xfa, 0x79, 0xc5, 0x05, 0xc9, 0xc9, 0xba, 0x29, 0xa9, 0x65, 0xfa, 0x79, 0xa9, 0xf9, 0x69, - 0xc5, 0xba, 0x89, 0x05, 0x99, 0xba, 0xe9, 0xf9, 0xfa, 0xd0, 0x30, 0x5c, 0xc5, 0xc4, 0xe7, 0x97, - 0x9a, 0xef, 0x16, 0xac, 0xe7, 0x18, 0xe0, 0xa9, 0x17, 0x94, 0x9a, 0x56, 0x9c, 0xc4, 0x06, 0x0e, - 0x4f, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x4f, 0x72, 0xf0, 0x66, 0x01, 0x00, 0x00, + 0xc5, 0xba, 0x89, 0x05, 0x99, 0xba, 0xe9, 0xf9, 0xfa, 0xd0, 0x30, 0xb4, 0x06, 0x11, 0xab, 0x98, + 0x04, 0xfd, 0x52, 0xf3, 0xdd, 0x82, 0xf5, 0x1c, 0x03, 0x3c, 0x41, 0x1e, 0x0a, 0x4a, 0x4d, 0x2b, + 0x4e, 0x62, 0x03, 0x87, 0xab, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0xd0, 0xa5, 0x8b, 0x04, 0x6e, + 0x01, 0x00, 0x00, } func (m *Address) Marshal() (dAtA []byte, err error) { diff --git a/v2/service/meta.pb.go b/v2/service/meta.pb.go index 88d56b3..648f7f0 100644 --- a/v2/service/meta.pb.go +++ b/v2/service/meta.pb.go @@ -28,40 +28,44 @@ const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package type SessionToken_Body_Verb int32 const ( + // Unknown verb + SessionToken_Body_VERB_UNSPECIFIED SessionToken_Body_Verb = 0 // Refers to object.Put RPC call - SessionToken_Body_OBJECT_PUT SessionToken_Body_Verb = 0 + SessionToken_Body_OBJECT_PUT SessionToken_Body_Verb = 1 // Refers to object.Get RPC call - SessionToken_Body_OBJECT_GET SessionToken_Body_Verb = 1 + SessionToken_Body_OBJECT_GET SessionToken_Body_Verb = 2 // Refers to object.Head RPC call - SessionToken_Body_OBJECT_HEAD SessionToken_Body_Verb = 2 + SessionToken_Body_OBJECT_HEAD SessionToken_Body_Verb = 3 // Refers to object.Search RPC call - SessionToken_Body_OBJECT_SEARCH SessionToken_Body_Verb = 3 + SessionToken_Body_OBJECT_SEARCH SessionToken_Body_Verb = 4 // Refers to object.Delete RPC call - SessionToken_Body_OBJECT_DELETE SessionToken_Body_Verb = 4 + SessionToken_Body_OBJECT_DELETE SessionToken_Body_Verb = 5 // Refers to object.GetRange RPC call - SessionToken_Body_OBJECT_RANGE SessionToken_Body_Verb = 5 + SessionToken_Body_OBJECT_RANGE SessionToken_Body_Verb = 6 // Refers to object.GetRangeHash RPC call - SessionToken_Body_OBJECT_RANGEHASH SessionToken_Body_Verb = 6 + SessionToken_Body_OBJECT_RANGEHASH SessionToken_Body_Verb = 7 ) var SessionToken_Body_Verb_name = map[int32]string{ - 0: "OBJECT_PUT", - 1: "OBJECT_GET", - 2: "OBJECT_HEAD", - 3: "OBJECT_SEARCH", - 4: "OBJECT_DELETE", - 5: "OBJECT_RANGE", - 6: "OBJECT_RANGEHASH", + 0: "VERB_UNSPECIFIED", + 1: "OBJECT_PUT", + 2: "OBJECT_GET", + 3: "OBJECT_HEAD", + 4: "OBJECT_SEARCH", + 5: "OBJECT_DELETE", + 6: "OBJECT_RANGE", + 7: "OBJECT_RANGEHASH", } var SessionToken_Body_Verb_value = map[string]int32{ - "OBJECT_PUT": 0, - "OBJECT_GET": 1, - "OBJECT_HEAD": 2, - "OBJECT_SEARCH": 3, - "OBJECT_DELETE": 4, - "OBJECT_RANGE": 5, - "OBJECT_RANGEHASH": 6, + "VERB_UNSPECIFIED": 0, + "OBJECT_PUT": 1, + "OBJECT_GET": 2, + "OBJECT_HEAD": 3, + "OBJECT_SEARCH": 4, + "OBJECT_DELETE": 5, + "OBJECT_RANGE": 6, + "OBJECT_RANGEHASH": 7, } func (x SessionToken_Body_Verb) String() string { @@ -72,6 +76,7 @@ func (SessionToken_Body_Verb) EnumDescriptor() ([]byte, []int) { return fileDescriptor_932e020d69aee3f0, []int{3, 0, 0} } +// Extended headers for Request/Response type XHeader struct { // Key of the X-Header. Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` @@ -257,7 +262,7 @@ func (m *TokenLifetime) GetIat() uint64 { // NeoFS session token. type SessionToken struct { // Session Token body - Token *SessionToken_Body `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"` + Body *SessionToken_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` // Signature is a signature of session token information Signature *Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` @@ -298,9 +303,9 @@ func (m *SessionToken) XXX_DiscardUnknown() { var xxx_messageInfo_SessionToken proto.InternalMessageInfo -func (m *SessionToken) GetToken() *SessionToken_Body { +func (m *SessionToken) GetBody() *SessionToken_Body { if m != nil { - return m.Token + return m.Body } return nil } @@ -312,6 +317,7 @@ func (m *SessionToken) GetSignature() *Signature { return nil } +// Session token body type SessionToken_Body struct { // ID is a token identifier. valid UUIDv4 represented in bytes Id []byte `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` @@ -403,7 +409,7 @@ func (m *SessionToken_Body) GetVerb() SessionToken_Body_Verb { if m != nil { return m.Verb } - return SessionToken_Body_OBJECT_PUT + return SessionToken_Body_VERB_UNSPECIFIED } func (m *SessionToken_Body) GetLifetime() *TokenLifetime { @@ -437,7 +443,7 @@ func (*SessionToken_Body) XXX_OneofWrappers() []interface{} { // BearerToken has information about request ACL rules with limited lifetime type BearerToken struct { // Bearer Token body - Token *BearerToken_Body `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"` + Body *BearerToken_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` // Signature of BearerToken body Signature *Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` @@ -478,9 +484,9 @@ func (m *BearerToken) XXX_DiscardUnknown() { var xxx_messageInfo_BearerToken proto.InternalMessageInfo -func (m *BearerToken) GetToken() *BearerToken_Body { +func (m *BearerToken) GetBody() *BearerToken_Body { if m != nil { - return m.Token + return m.Body } return nil } @@ -492,6 +498,7 @@ func (m *BearerToken) GetSignature() *Signature { return nil } +// Bearer Token body type BearerToken_Body struct { // EACLTable carries table of extended ACL rules EaclTable *acl.EACLTable `protobuf:"bytes,1,opt,name=eacl_table,json=eaclTable,proto3" json:"eacl_table,omitempty"` @@ -569,9 +576,9 @@ type RequestMetaHeader struct { // Request X-Headers. XHeaders []*XHeader `protobuf:"bytes,4,rep,name=x_headers,json=xHeaders,proto3" json:"x_headers,omitempty"` // Token is a token of the session within which the request is sent - Token *SessionToken `protobuf:"bytes,5,opt,name=token,proto3" json:"token,omitempty"` + SessionToken *SessionToken `protobuf:"bytes,5,opt,name=session_token,json=sessionToken,proto3" json:"session_token,omitempty"` // Bearer is a Bearer token of the request - Bearer *BearerToken `protobuf:"bytes,6,opt,name=bearer,proto3" json:"bearer,omitempty"` + BearerToken *BearerToken `protobuf:"bytes,6,opt,name=bearer_token,json=bearerToken,proto3" json:"bearer_token,omitempty"` // RequestMetaHeader of the origin request. Origin *RequestMetaHeader `protobuf:"bytes,7,opt,name=origin,proto3" json:"origin,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` @@ -640,16 +647,16 @@ func (m *RequestMetaHeader) GetXHeaders() []*XHeader { return nil } -func (m *RequestMetaHeader) GetToken() *SessionToken { +func (m *RequestMetaHeader) GetSessionToken() *SessionToken { if m != nil { - return m.Token + return m.SessionToken } return nil } -func (m *RequestMetaHeader) GetBearer() *BearerToken { +func (m *RequestMetaHeader) GetBearerToken() *BearerToken { if m != nil { - return m.Bearer + return m.BearerToken } return nil } @@ -762,58 +769,60 @@ func init() { func init() { proto.RegisterFile("v2/service/meta.proto", fileDescriptor_932e020d69aee3f0) } var fileDescriptor_932e020d69aee3f0 = []byte{ - // 801 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x55, 0xcd, 0x8e, 0x1b, 0x45, - 0x10, 0xde, 0xb1, 0xc7, 0xf6, 0xba, 0xbc, 0x5e, 0x66, 0x9b, 0xa0, 0x58, 0x2b, 0xe4, 0xac, 0x0c, - 0x48, 0x20, 0xb1, 0x63, 0x61, 0x08, 0x11, 0x51, 0x22, 0x61, 0xef, 0x0e, 0xf1, 0xc2, 0x92, 0x44, - 0x6d, 0x13, 0x21, 0x2e, 0xd6, 0xfc, 0x94, 0x77, 0x27, 0xf1, 0x4e, 0x9b, 0xee, 0xde, 0xc1, 0x7e, - 0x00, 0xde, 0x81, 0x67, 0xe0, 0xc6, 0x8d, 0x0b, 0x57, 0xc4, 0x91, 0x1b, 0x57, 0xb4, 0xdc, 0x78, - 0x0a, 0xd4, 0x3f, 0x4e, 0x66, 0x89, 0x97, 0x3f, 0x71, 0xc8, 0xad, 0xea, 0xeb, 0xaa, 0xaf, 0xab, - 0xaa, 0xbf, 0xa9, 0x81, 0x57, 0xf2, 0x5e, 0x57, 0x20, 0xcf, 0xd3, 0x18, 0xbb, 0x67, 0x28, 0x43, - 0x7f, 0xce, 0x99, 0x64, 0x64, 0x27, 0x43, 0xe6, 0x4f, 0x85, 0x9f, 0xf7, 0x7c, 0x7b, 0xba, 0x4b, - 0xf2, 0x5e, 0x37, 0x8c, 0x67, 0x5d, 0xb9, 0x9c, 0xa3, 0x30, 0x61, 0xbb, 0x2f, 0xe7, 0xbd, 0x2e, - 0xc7, 0xa9, 0xb8, 0x04, 0x5e, 0x2f, 0x50, 0xe6, 0xc8, 0xd3, 0xe9, 0xd2, 0x1c, 0x74, 0xde, 0x81, - 0xda, 0xe7, 0x43, 0x0c, 0x13, 0xe4, 0xc4, 0x83, 0xf2, 0x13, 0x5c, 0xb6, 0x9c, 0x3d, 0xe7, 0xcd, - 0x3a, 0x55, 0x26, 0xb9, 0x06, 0x95, 0x3c, 0x9c, 0x9d, 0x63, 0xab, 0xa4, 0x31, 0xe3, 0x74, 0x6e, - 0x42, 0xed, 0x11, 0x72, 0x91, 0xb2, 0x4c, 0x05, 0x9c, 0x85, 0x8f, 0x19, 0xd7, 0x49, 0x4d, 0x6a, - 0x1c, 0x8d, 0xa6, 0x19, 0xe3, 0x3a, 0x4d, 0xa1, 0xca, 0xe9, 0x04, 0xd0, 0x1c, 0xb3, 0x27, 0x98, - 0x1d, 0xa7, 0x53, 0x94, 0xe9, 0x19, 0xaa, 0xfb, 0x70, 0x31, 0xd7, 0xa9, 0x2e, 0x55, 0xa6, 0x42, - 0xb2, 0x68, 0xaa, 0xd3, 0x5c, 0xaa, 0x4c, 0x85, 0xa4, 0xa1, 0x6c, 0x95, 0x0d, 0x92, 0x86, 0xb2, - 0xf3, 0xa3, 0x0b, 0x5b, 0x23, 0x14, 0xea, 0x7a, 0x4d, 0x47, 0x6e, 0x43, 0x45, 0x2a, 0x43, 0x13, - 0x35, 0x7a, 0xaf, 0xfb, 0xcf, 0x8d, 0xc9, 0x2f, 0xc6, 0xfb, 0x03, 0x96, 0x2c, 0xa9, 0x49, 0x21, - 0xb7, 0xa1, 0x2e, 0xd2, 0x93, 0x2c, 0x94, 0xe7, 0xdc, 0x34, 0xd9, 0xe8, 0xbd, 0xba, 0x2e, 0x7f, - 0x15, 0x43, 0x9f, 0x85, 0xef, 0xfe, 0x50, 0x06, 0x57, 0x71, 0x91, 0x6d, 0x28, 0xa5, 0x89, 0xbe, - 0x7d, 0x8b, 0x96, 0xd2, 0x84, 0xf4, 0x60, 0x93, 0x7d, 0x95, 0x21, 0x9f, 0xa4, 0x89, 0xe5, 0xbc, - 0x5e, 0xe0, 0x54, 0x4f, 0xe3, 0x3f, 0x50, 0xe7, 0x47, 0x87, 0xb4, 0xa6, 0x03, 0x8f, 0x12, 0x72, - 0x17, 0xdc, 0x1c, 0x79, 0xa4, 0x1b, 0xdd, 0xee, 0xbd, 0xf5, 0x4f, 0x7a, 0xf0, 0x1f, 0x21, 0x8f, - 0xa8, 0x4e, 0x23, 0x77, 0x60, 0x73, 0x66, 0xc7, 0xda, 0x72, 0xf5, 0x95, 0x7b, 0x6b, 0x28, 0x2e, - 0x8d, 0x9f, 0x3e, 0xcd, 0x20, 0x37, 0xa0, 0x21, 0x0c, 0xfb, 0x44, 0x09, 0xa0, 0xa2, 0x3b, 0x01, - 0x0b, 0x7d, 0x82, 0x4b, 0xf2, 0x21, 0x6c, 0xb3, 0xe8, 0x31, 0xc6, 0x72, 0x12, 0x26, 0x09, 0x47, - 0x21, 0x5a, 0xd5, 0xf5, 0x7d, 0xf5, 0xcd, 0xf1, 0x70, 0x83, 0x36, 0x4d, 0x82, 0x05, 0x3a, 0x5f, - 0x3b, 0xe0, 0xaa, 0x7a, 0xc9, 0x36, 0xc0, 0x83, 0xc1, 0xc7, 0xc1, 0xc1, 0x78, 0xf2, 0xf0, 0xb3, - 0xb1, 0xb7, 0x51, 0xf0, 0xef, 0x05, 0x63, 0xcf, 0x21, 0x2f, 0x41, 0xc3, 0xfa, 0xc3, 0xa0, 0x7f, - 0xe8, 0x95, 0xc8, 0x0e, 0x34, 0x2d, 0x30, 0x0a, 0xfa, 0xf4, 0x60, 0xe8, 0x95, 0x0b, 0xd0, 0x61, - 0x70, 0x1c, 0x8c, 0x03, 0xcf, 0x25, 0x1e, 0x6c, 0x59, 0x88, 0xf6, 0xef, 0xdf, 0x0b, 0xbc, 0x0a, - 0xb9, 0x06, 0x5e, 0x11, 0x19, 0xf6, 0x47, 0x43, 0xaf, 0x3a, 0xa8, 0x43, 0x2d, 0x66, 0x99, 0xc4, - 0x85, 0xec, 0x7c, 0x5f, 0x82, 0xc6, 0x00, 0x43, 0x8e, 0xdc, 0xe8, 0xe8, 0x83, 0xcb, 0x3a, 0x7a, - 0x6d, 0xcd, 0x00, 0x0b, 0xe1, 0xff, 0x9b, 0x8c, 0xbe, 0x73, 0xac, 0x8c, 0x6e, 0x01, 0x60, 0x18, - 0xcf, 0x26, 0x32, 0x8c, 0x66, 0x68, 0x8b, 0x68, 0x15, 0x58, 0xc2, 0x78, 0xe6, 0x07, 0xfd, 0x83, - 0xe3, 0xb1, 0x3a, 0xa7, 0x75, 0x15, 0xab, 0xcd, 0xff, 0xa4, 0xb7, 0xa2, 0x60, 0xca, 0xff, 0x56, - 0x30, 0x9d, 0x5f, 0x4a, 0xb0, 0x43, 0xf1, 0xcb, 0x73, 0x14, 0xf2, 0x53, 0x94, 0xa1, 0xdd, 0x1f, - 0xef, 0x41, 0x2d, 0x37, 0x7b, 0xc1, 0x56, 0xbf, 0xbb, 0x86, 0xd2, 0x6e, 0x0e, 0xba, 0x0a, 0x55, - 0xcb, 0x02, 0xe7, 0x2c, 0x3e, 0xb5, 0x5f, 0xbd, 0x71, 0xd4, 0x77, 0x2f, 0xe5, 0x4c, 0x97, 0xd6, - 0xa4, 0xca, 0x24, 0xb7, 0xa0, 0xbe, 0x98, 0x9c, 0xea, 0x9b, 0x44, 0xcb, 0xdd, 0x2b, 0x5f, 0xc1, - 0x6f, 0x97, 0x19, 0xdd, 0x5c, 0x18, 0x43, 0x90, 0x9b, 0xab, 0x77, 0xad, 0xe8, 0xa2, 0x6e, 0xfc, - 0xcd, 0xb7, 0xb5, 0x7a, 0xd3, 0xf7, 0xa1, 0x1a, 0xe9, 0xe7, 0xb6, 0x5a, 0x6f, 0xff, 0xb5, 0x1e, - 0xa8, 0x8d, 0x26, 0x77, 0xa0, 0xca, 0x78, 0x7a, 0x92, 0x66, 0xad, 0xda, 0x95, 0xfb, 0xe8, 0xb9, - 0xd9, 0x51, 0x9b, 0xd3, 0xf9, 0xdd, 0x01, 0x42, 0x51, 0xcc, 0x59, 0x26, 0xf0, 0xc5, 0x1f, 0xed, - 0xdd, 0xa7, 0xbd, 0x9a, 0xd9, 0xbe, 0xb1, 0xb6, 0xd7, 0x3f, 0x77, 0xb3, 0x6a, 0x76, 0x40, 0x7f, - 0xba, 0x68, 0x3b, 0x3f, 0x5f, 0xb4, 0x9d, 0x5f, 0x2f, 0xda, 0xce, 0x37, 0xbf, 0xb5, 0x37, 0xbe, - 0x78, 0xfb, 0x24, 0x95, 0xa7, 0xe7, 0x91, 0x1f, 0xb3, 0xb3, 0x6e, 0x26, 0xe6, 0x71, 0xbc, 0x9f, - 0x60, 0xde, 0xcd, 0x90, 0x4d, 0xc5, 0x7e, 0x38, 0x4f, 0xf7, 0x4f, 0x58, 0xf7, 0xd9, 0x8f, 0xec, - 0xdb, 0xd2, 0xce, 0x7d, 0x64, 0x1f, 0x8d, 0xfc, 0xfe, 0xc3, 0x23, 0x7f, 0x64, 0xb0, 0xa8, 0xaa, - 0x7f, 0x6b, 0xef, 0xfe, 0x11, 0x00, 0x00, 0xff, 0xff, 0x1a, 0xf8, 0x0e, 0x53, 0x44, 0x07, 0x00, - 0x00, + // 834 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x55, 0xcd, 0x6e, 0x23, 0x45, + 0x10, 0xce, 0xd8, 0x93, 0x38, 0x2e, 0xdb, 0x61, 0xd2, 0x04, 0xad, 0x15, 0x21, 0x6f, 0x64, 0x40, + 0x82, 0x43, 0xc6, 0x62, 0x58, 0x14, 0x04, 0xbb, 0x12, 0x76, 0x3c, 0xbb, 0x36, 0x84, 0x6c, 0xd4, + 0xf6, 0x46, 0x08, 0x09, 0x59, 0xf3, 0x53, 0x4e, 0x66, 0xd7, 0x99, 0x36, 0xd3, 0x9d, 0x21, 0x7e, + 0x13, 0x24, 0xde, 0x80, 0x1b, 0x17, 0x9e, 0x81, 0x23, 0x12, 0x37, 0x4e, 0x28, 0xdc, 0xb8, 0xf1, + 0x06, 0xa8, 0x7f, 0xbc, 0x3b, 0x61, 0xbd, 0xfc, 0x89, 0x03, 0x27, 0x57, 0x7d, 0x5d, 0xf5, 0x55, + 0x57, 0xf5, 0xe7, 0x1a, 0x78, 0x25, 0xf7, 0x3a, 0x1c, 0xb3, 0x3c, 0x89, 0xb0, 0x73, 0x81, 0x22, + 0x70, 0xe7, 0x19, 0x13, 0x8c, 0x6c, 0xa7, 0xc8, 0xdc, 0x29, 0x77, 0x73, 0xcf, 0x35, 0xa7, 0xbb, + 0x24, 0xf7, 0x3a, 0x41, 0x34, 0xeb, 0x88, 0xc5, 0x1c, 0xb9, 0x0e, 0xdb, 0x7d, 0x39, 0xf7, 0x3a, + 0x19, 0x4e, 0xf9, 0x0d, 0xf0, 0x56, 0x81, 0x32, 0xc7, 0x2c, 0x99, 0x2e, 0xf4, 0x41, 0xfb, 0x6d, + 0xa8, 0x7c, 0x3a, 0xc0, 0x20, 0xc6, 0x8c, 0x38, 0x50, 0x7e, 0x82, 0x8b, 0xa6, 0xb5, 0x67, 0xbd, + 0x59, 0xa5, 0xd2, 0x24, 0x3b, 0xb0, 0x9e, 0x07, 0xb3, 0x4b, 0x6c, 0x96, 0x14, 0xa6, 0x9d, 0xf6, + 0xbb, 0x50, 0x39, 0xc5, 0x8c, 0x27, 0x2c, 0x95, 0x01, 0x17, 0xc1, 0x63, 0x96, 0xa9, 0xa4, 0x06, + 0xd5, 0x8e, 0x42, 0x93, 0x94, 0x65, 0x2a, 0x4d, 0xa2, 0xd2, 0x69, 0xfb, 0xd0, 0x18, 0xb3, 0x27, + 0x98, 0x1e, 0x25, 0x53, 0x14, 0xc9, 0x05, 0xca, 0x7a, 0x78, 0x35, 0x57, 0xa9, 0x36, 0x95, 0xa6, + 0x44, 0xd2, 0x70, 0xaa, 0xd2, 0x6c, 0x2a, 0x4d, 0x89, 0x24, 0x81, 0x68, 0x96, 0x35, 0x92, 0x04, + 0xa2, 0xfd, 0x93, 0x0d, 0xf5, 0x11, 0x72, 0x59, 0x5e, 0xd1, 0x91, 0xf7, 0xc0, 0x0e, 0x59, 0xac, + 0xef, 0x5d, 0xf3, 0x5e, 0x77, 0x9f, 0x9b, 0x92, 0x5b, 0x0c, 0x77, 0x7b, 0x2c, 0x5e, 0x50, 0x95, + 0x41, 0xde, 0x87, 0x2a, 0x4f, 0xce, 0xd2, 0x40, 0x5c, 0x66, 0xba, 0xc5, 0x9a, 0xf7, 0xea, 0xaa, + 0xf4, 0x65, 0x0c, 0x7d, 0x16, 0xbe, 0xfb, 0x63, 0x19, 0x6c, 0x49, 0x45, 0xb6, 0xa0, 0x94, 0xc4, + 0xaa, 0x78, 0x9d, 0x96, 0x92, 0x98, 0x78, 0xb0, 0xc9, 0xbe, 0x4c, 0x31, 0x9b, 0x24, 0xb1, 0xe1, + 0xbc, 0x55, 0xe0, 0x94, 0x0f, 0xe3, 0x3e, 0x94, 0xe7, 0xc3, 0x3e, 0xad, 0xa8, 0xc0, 0x61, 0x4c, + 0xee, 0x81, 0x9d, 0x63, 0x16, 0xaa, 0x36, 0xb7, 0xbc, 0xb7, 0xfe, 0x4e, 0x0b, 0xee, 0x29, 0x66, + 0x21, 0x55, 0x69, 0xe4, 0x2e, 0x6c, 0xce, 0xcc, 0x50, 0x9b, 0xb6, 0x2a, 0xb9, 0xb7, 0x82, 0xe2, + 0xc6, 0xf0, 0xe9, 0xd3, 0x0c, 0x72, 0x1b, 0x6a, 0x5c, 0xb3, 0x4f, 0xe4, 0xf3, 0xaf, 0xab, 0x4e, + 0xc0, 0x40, 0x1f, 0xe3, 0x82, 0x7c, 0x08, 0x5b, 0x2c, 0x7c, 0x8c, 0x91, 0x98, 0x04, 0x71, 0x9c, + 0x21, 0xe7, 0xcd, 0x8d, 0xd5, 0x7d, 0x75, 0xf5, 0xf1, 0x60, 0x8d, 0x36, 0x74, 0x82, 0x01, 0xda, + 0x5f, 0x5b, 0x60, 0xcb, 0xfb, 0x92, 0x1d, 0x70, 0x4e, 0x7d, 0xda, 0x9b, 0x3c, 0x3a, 0x1e, 0x9d, + 0xf8, 0x87, 0xc3, 0xfb, 0x43, 0xbf, 0xef, 0xac, 0x91, 0x2d, 0x80, 0x87, 0xbd, 0x8f, 0xfc, 0xc3, + 0xf1, 0xe4, 0xe4, 0xd1, 0xd8, 0xb1, 0x0a, 0xfe, 0x03, 0x7f, 0xec, 0x94, 0xc8, 0x4b, 0x50, 0x33, + 0xfe, 0xc0, 0xef, 0xf6, 0x9d, 0x32, 0xd9, 0x86, 0x86, 0x01, 0x46, 0x7e, 0x97, 0x1e, 0x0e, 0x1c, + 0xbb, 0x00, 0xf5, 0xfd, 0x23, 0x7f, 0xec, 0x3b, 0xeb, 0xc4, 0x81, 0xba, 0x81, 0x68, 0xf7, 0xf8, + 0x81, 0xef, 0x6c, 0xc8, 0xf2, 0x45, 0x64, 0xd0, 0x1d, 0x0d, 0x9c, 0x4a, 0xaf, 0x0a, 0x95, 0x88, + 0xa5, 0x02, 0xaf, 0x44, 0xfb, 0xbb, 0x12, 0xd4, 0x7a, 0x18, 0x64, 0x98, 0x69, 0x6d, 0x1d, 0xdc, + 0xd0, 0xd6, 0x6b, 0x2b, 0xa6, 0x5a, 0x88, 0xfe, 0xaf, 0xa4, 0xf5, 0xad, 0x65, 0xa4, 0x75, 0x00, + 0x80, 0x41, 0x34, 0x9b, 0x88, 0x20, 0x9c, 0xa1, 0xb9, 0x43, 0xb3, 0xc0, 0x12, 0x44, 0x33, 0xd7, + 0xef, 0x1e, 0x1e, 0x8d, 0xe5, 0x39, 0xad, 0xca, 0x58, 0x65, 0xfe, 0x2b, 0x0d, 0x16, 0x45, 0x54, + 0xfe, 0xa7, 0x22, 0x6a, 0xff, 0x56, 0x82, 0x6d, 0x8a, 0x5f, 0x5c, 0x22, 0x17, 0x9f, 0xa0, 0x08, + 0xcc, 0x46, 0xb9, 0x03, 0x95, 0x5c, 0x6f, 0x0a, 0x73, 0xfb, 0xdd, 0x15, 0x94, 0x66, 0x97, 0xd0, + 0x65, 0xa8, 0x5c, 0x1f, 0x38, 0x67, 0xd1, 0xb9, 0xd9, 0x03, 0xda, 0x91, 0x9b, 0x40, 0x88, 0x99, + 0xba, 0x5a, 0x83, 0x4a, 0x93, 0x1c, 0x40, 0xf5, 0x6a, 0x72, 0xae, 0x2a, 0xf1, 0xa6, 0xbd, 0x57, + 0x7e, 0x01, 0xbf, 0x59, 0x6f, 0x74, 0xf3, 0x4a, 0x1b, 0x9c, 0xf4, 0xa1, 0xb1, 0x54, 0xbc, 0x90, + 0xfd, 0x28, 0xcd, 0xd7, 0xbc, 0xdb, 0x7f, 0xf1, 0xbf, 0xa3, 0x75, 0x5e, 0xdc, 0x3b, 0x5d, 0xa8, + 0x87, 0xea, 0xf1, 0x0d, 0x89, 0xfe, 0x53, 0xb4, 0xfe, 0x5c, 0x23, 0xb4, 0x16, 0x16, 0xe4, 0x75, + 0x17, 0x36, 0x58, 0x96, 0x9c, 0x25, 0x69, 0xb3, 0xf2, 0xc2, 0xe5, 0xf5, 0xdc, 0x54, 0xa9, 0xc9, + 0x69, 0xff, 0x6a, 0x01, 0xa1, 0xc8, 0xe7, 0x2c, 0xe5, 0xf8, 0xff, 0x1f, 0xfa, 0xbd, 0xa7, 0xbd, + 0xea, 0x69, 0xbf, 0xb1, 0xb2, 0xd7, 0x3f, 0x76, 0xb3, 0x6c, 0xb6, 0xf7, 0xf9, 0xf7, 0xd7, 0x2d, + 0xeb, 0x87, 0xeb, 0x96, 0xf5, 0xf3, 0x75, 0xcb, 0xfa, 0xea, 0x97, 0xd6, 0xda, 0x67, 0x77, 0xce, + 0x12, 0x71, 0x7e, 0x19, 0xba, 0x11, 0xbb, 0xe8, 0xa4, 0x7c, 0x1e, 0x45, 0xfb, 0x31, 0xe6, 0x9d, + 0x14, 0xd9, 0x94, 0xef, 0x07, 0xf3, 0x64, 0xff, 0x8c, 0x75, 0x9e, 0x7d, 0xf4, 0x3e, 0x30, 0xbf, + 0xdf, 0x94, 0x76, 0x8e, 0x91, 0xdd, 0x1f, 0xb9, 0xdd, 0x93, 0xa1, 0xac, 0x3c, 0xd2, 0x70, 0xb8, + 0xa1, 0xbe, 0x86, 0xef, 0xfc, 0x1e, 0x00, 0x00, 0xff, 0xff, 0xf6, 0xba, 0x8b, 0x7f, 0x7b, 0x07, + 0x00, 0x00, } func (m *XHeader) Marshal() (dAtA []byte, err error) { @@ -972,9 +981,9 @@ func (m *SessionToken) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x12 } - if m.Token != nil { + if m.Body != nil { { - size, err := m.Token.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.Body.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -1123,9 +1132,9 @@ func (m *BearerToken) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x12 } - if m.Token != nil { + if m.Body != nil { { - size, err := m.Token.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.Body.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -1237,9 +1246,9 @@ func (m *RequestMetaHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x3a } - if m.Bearer != nil { + if m.BearerToken != nil { { - size, err := m.Bearer.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.BearerToken.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -1249,9 +1258,9 @@ func (m *RequestMetaHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x32 } - if m.Token != nil { + if m.SessionToken != nil { { - size, err := m.Token.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.SessionToken.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -1451,8 +1460,8 @@ func (m *SessionToken) Size() (n int) { } var l int _ = l - if m.Token != nil { - l = m.Token.Size() + if m.Body != nil { + l = m.Body.Size() n += 1 + l + sovMeta(uint64(l)) } if m.Signature != nil { @@ -1517,8 +1526,8 @@ func (m *BearerToken) Size() (n int) { } var l int _ = l - if m.Token != nil { - l = m.Token.Size() + if m.Body != nil { + l = m.Body.Size() n += 1 + l + sovMeta(uint64(l)) } if m.Signature != nil { @@ -1577,12 +1586,12 @@ func (m *RequestMetaHeader) Size() (n int) { n += 1 + l + sovMeta(uint64(l)) } } - if m.Token != nil { - l = m.Token.Size() + if m.SessionToken != nil { + l = m.SessionToken.Size() n += 1 + l + sovMeta(uint64(l)) } - if m.Bearer != nil { - l = m.Bearer.Size() + if m.BearerToken != nil { + l = m.BearerToken.Size() n += 1 + l + sovMeta(uint64(l)) } if m.Origin != nil { @@ -1985,7 +1994,7 @@ func (m *SessionToken) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Token", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Body", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -2012,10 +2021,10 @@ func (m *SessionToken) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.Token == nil { - m.Token = &SessionToken_Body{} + if m.Body == nil { + m.Body = &SessionToken_Body{} } - if err := m.Token.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Body.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -2359,7 +2368,7 @@ func (m *BearerToken) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Token", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Body", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -2386,10 +2395,10 @@ func (m *BearerToken) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.Token == nil { - m.Token = &BearerToken_Body{} + if m.Body == nil { + m.Body = &BearerToken_Body{} } - if err := m.Token.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Body.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -2755,7 +2764,7 @@ func (m *RequestMetaHeader) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 5: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Token", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field SessionToken", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -2782,16 +2791,16 @@ func (m *RequestMetaHeader) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.Token == nil { - m.Token = &SessionToken{} + if m.SessionToken == nil { + m.SessionToken = &SessionToken{} } - if err := m.Token.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.SessionToken.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 6: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Bearer", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field BearerToken", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -2818,10 +2827,10 @@ func (m *RequestMetaHeader) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.Bearer == nil { - m.Bearer = &BearerToken{} + if m.BearerToken == nil { + m.BearerToken = &BearerToken{} } - if err := m.Bearer.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.BearerToken.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/v2/service/verify.pb.go b/v2/service/verify.pb.go index 34913d7..39a512b 100644 --- a/v2/service/verify.pb.go +++ b/v2/service/verify.pb.go @@ -6,6 +6,8 @@ package service import ( fmt "fmt" proto "github.com/golang/protobuf/proto" + _ "github.com/nspcc-dev/neofs-api-go/v2/acl" + _ "github.com/nspcc-dev/neofs-api-go/v2/refs" io "io" math "math" math_bits "math/bits" @@ -241,28 +243,30 @@ func init() { func init() { proto.RegisterFile("v2/service/verify.proto", fileDescriptor_848d62e0ecc8b6b6) } var fileDescriptor_848d62e0ecc8b6b6 = []byte{ - // 325 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x2f, 0x33, 0xd2, 0x2f, - 0x4e, 0x2d, 0x2a, 0xcb, 0x4c, 0x4e, 0xd5, 0x2f, 0x4b, 0x2d, 0xca, 0x4c, 0xab, 0xd4, 0x2b, 0x28, - 0xca, 0x2f, 0xc9, 0x17, 0x12, 0xcc, 0x4b, 0xcd, 0xd7, 0x4b, 0x2b, 0xd6, 0x2b, 0x33, 0xd2, 0x83, - 0xca, 0x2b, 0x19, 0x72, 0x71, 0x06, 0x67, 0xa6, 0xe7, 0x25, 0x96, 0x94, 0x16, 0xa5, 0x0a, 0x09, - 0x70, 0x31, 0x67, 0xa7, 0x56, 0x4a, 0x30, 0x2a, 0x30, 0x6a, 0xf0, 0x04, 0x81, 0x98, 0x42, 0x42, - 0x5c, 0x2c, 0xc5, 0x99, 0xe9, 0x79, 0x12, 0x4c, 0x60, 0x21, 0x30, 0x5b, 0x69, 0x0b, 0x13, 0x97, - 0x64, 0x50, 0x6a, 0x61, 0x69, 0x6a, 0x71, 0x49, 0x18, 0xc8, 0xf4, 0xcc, 0xe4, 0xc4, 0x92, 0xcc, - 0xfc, 0x3c, 0x8f, 0xd4, 0xc4, 0x94, 0xd4, 0x22, 0x21, 0x67, 0x2e, 0xbe, 0xa4, 0xfc, 0x94, 0xca, - 0xf8, 0x62, 0x98, 0xa9, 0x60, 0xe3, 0xb8, 0x8d, 0x64, 0xf4, 0x30, 0x2c, 0xd7, 0x83, 0xdb, 0x1c, - 0xc4, 0x0b, 0xd2, 0x83, 0x70, 0x88, 0x33, 0x17, 0x5f, 0x6e, 0x6a, 0x49, 0x22, 0x92, 0x21, 0x4c, - 0xc4, 0x18, 0x02, 0xd2, 0x83, 0x30, 0xc4, 0x9d, 0x4b, 0x20, 0xbf, 0x28, 0x33, 0x3d, 0x33, 0x0f, - 0xc9, 0x18, 0x66, 0x22, 0x8c, 0xe1, 0x87, 0xe8, 0x42, 0x18, 0xe4, 0xc2, 0xc5, 0x06, 0x11, 0x92, - 0x60, 0x01, 0x6b, 0xd7, 0xc1, 0xa2, 0x1d, 0x67, 0x80, 0x04, 0x41, 0xf5, 0x2a, 0x6d, 0x63, 0xe2, - 0x92, 0x0a, 0x4a, 0x2d, 0x2e, 0xc8, 0xcf, 0x2b, 0x4e, 0x1d, 0x19, 0xe1, 0xe6, 0x8a, 0x16, 0x6e, - 0xba, 0x58, 0xc3, 0x0d, 0x57, 0x88, 0xc0, 0x02, 0xce, 0x29, 0xe8, 0xc4, 0x23, 0x39, 0xc6, 0x0b, - 0x8f, 0xe4, 0x18, 0x1f, 0x3c, 0x92, 0x63, 0x9c, 0xf1, 0x58, 0x8e, 0x21, 0x4a, 0x27, 0x3d, 0xb3, - 0x24, 0xa3, 0x34, 0x49, 0x2f, 0x39, 0x3f, 0x57, 0x3f, 0xaf, 0xb8, 0x20, 0x39, 0x59, 0x37, 0x25, - 0xb5, 0x4c, 0x3f, 0x2f, 0x35, 0x3f, 0xad, 0x58, 0x37, 0xb1, 0x20, 0x53, 0x37, 0x3d, 0x5f, 0x1f, - 0x91, 0x05, 0x56, 0x31, 0x09, 0xfa, 0xa5, 0xe6, 0xbb, 0x05, 0xeb, 0x39, 0x06, 0x78, 0xea, 0x05, - 0x43, 0xc4, 0x92, 0xd8, 0xc0, 0x19, 0xc2, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, 0x93, 0x01, 0xa7, - 0xcb, 0x2b, 0x03, 0x00, 0x00, + // 353 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe4, 0x93, 0x4f, 0x4b, 0xc3, 0x30, + 0x18, 0xc6, 0x6d, 0x37, 0x06, 0x46, 0x9d, 0xb3, 0x0a, 0xce, 0x21, 0x45, 0x76, 0xf2, 0x60, 0x13, + 0xac, 0xde, 0x3c, 0xe9, 0xfc, 0x7b, 0x11, 0xe9, 0xc0, 0x83, 0x20, 0xd2, 0x75, 0x6f, 0x6b, 0xd0, + 0x25, 0x35, 0xc9, 0x02, 0xfd, 0x26, 0x7e, 0x06, 0xcf, 0xe2, 0x67, 0xf0, 0xe8, 0x47, 0x90, 0xf9, + 0x45, 0xa4, 0xed, 0x66, 0x87, 0x6e, 0xb0, 0xbb, 0xa7, 0xbc, 0x3c, 0xc9, 0xf3, 0xcb, 0xc3, 0x03, + 0x2f, 0x5a, 0xd7, 0x2e, 0x91, 0x20, 0x34, 0x0d, 0x80, 0x68, 0x10, 0x34, 0x4c, 0x70, 0x2c, 0xb8, + 0xe2, 0xd6, 0x0a, 0x03, 0x8e, 0x43, 0x89, 0xb5, 0x8b, 0x87, 0xf7, 0x0d, 0x4b, 0xbb, 0xc4, 0x0f, + 0x1e, 0x89, 0x4a, 0x62, 0x90, 0xf9, 0xb3, 0xc6, 0xaa, 0x76, 0x89, 0x80, 0x50, 0x8e, 0x8b, 0xcd, + 0x5d, 0x34, 0xdf, 0xa6, 0x11, 0xf3, 0x55, 0x5f, 0x80, 0x55, 0x43, 0xa5, 0x07, 0x48, 0xea, 0xc6, + 0x96, 0xb1, 0xbd, 0xe8, 0xa5, 0xa3, 0x65, 0xa1, 0xb2, 0xa4, 0x11, 0xab, 0x9b, 0x99, 0x94, 0xcd, + 0xcd, 0x57, 0x13, 0x6d, 0x78, 0xf0, 0xd4, 0x07, 0xa9, 0xae, 0xd3, 0x18, 0x34, 0xf0, 0x15, 0xe5, + 0xec, 0x1c, 0xfc, 0x2e, 0x08, 0xab, 0x85, 0xaa, 0x1d, 0xde, 0x4d, 0xee, 0xe4, 0x88, 0x9a, 0xe1, + 0x16, 0xdc, 0x4d, 0xfc, 0x27, 0x25, 0xfe, 0xf9, 0xd9, 0x5b, 0x4a, 0x3d, 0x45, 0x90, 0x16, 0xaa, + 0xf6, 0x40, 0xf9, 0x63, 0x10, 0x73, 0x16, 0x48, 0xea, 0x29, 0x20, 0x67, 0xa8, 0xc6, 0x05, 0x8d, + 0x28, 0x1b, 0xc3, 0x94, 0x66, 0xc0, 0x2c, 0xe7, 0xae, 0x02, 0x74, 0x8c, 0x2a, 0xb9, 0x54, 0x2f, + 0x67, 0xf6, 0x9d, 0x09, 0xf6, 0xa9, 0x85, 0x78, 0x43, 0x6f, 0xf3, 0xcd, 0x44, 0x0d, 0x0f, 0x64, + 0xcc, 0x99, 0x84, 0xff, 0xd1, 0xdb, 0xc9, 0xaf, 0xde, 0x9c, 0x89, 0xbd, 0x4d, 0x6b, 0x64, 0x54, + 0xdc, 0xd1, 0xed, 0xfb, 0xc0, 0x36, 0x3e, 0x06, 0xb6, 0xf1, 0x39, 0xb0, 0x8d, 0xe7, 0x2f, 0x7b, + 0xee, 0x66, 0x3f, 0xa2, 0xea, 0xbe, 0xdf, 0xc1, 0x01, 0xef, 0x11, 0x26, 0xe3, 0x20, 0x70, 0xba, + 0xa0, 0x09, 0x03, 0x1e, 0x4a, 0xc7, 0x8f, 0xa9, 0x13, 0x71, 0x52, 0xec, 0xca, 0xc1, 0xf0, 0x7c, + 0x31, 0xd7, 0x2e, 0x81, 0x9f, 0xb6, 0xf1, 0xe1, 0xd5, 0x45, 0x9a, 0xa0, 0x9d, 0xcb, 0x9d, 0x4a, + 0xb6, 0x08, 0x7b, 0xdf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x8d, 0x87, 0x6a, 0x4d, 0x5f, 0x03, 0x00, + 0x00, } func (m *Signature) Marshal() (dAtA []byte, err error) { diff --git a/v2/session/service.pb.go b/v2/session/service.pb.go index 7759f67..13b8ad5 100644 --- a/v2/session/service.pb.go +++ b/v2/session/service.pb.go @@ -97,6 +97,7 @@ func (m *CreateRequest) GetVerifyHeader() *service.RequestVerificationHeader { return nil } +// Request body type CreateRequest_Body struct { // Carries an identifier of a session initiator. OwnerId *refs.OwnerID `protobuf:"bytes,1,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"` @@ -224,6 +225,7 @@ func (m *CreateResponse) GetVerifyHeader() *service.ResponseVerificationHeader { return nil } +// Response body type CreateResponse_Body struct { // id carries an identifier of session token. Id []byte `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` @@ -291,36 +293,36 @@ func init() { func init() { proto.RegisterFile("v2/session/service.proto", fileDescriptor_ab0074a16885b32c) } var fileDescriptor_ab0074a16885b32c = []byte{ - // 454 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x93, 0x4f, 0x6f, 0xd3, 0x30, - 0x18, 0xc6, 0x49, 0x98, 0xb6, 0xc9, 0xed, 0x26, 0xcd, 0x08, 0xad, 0xca, 0x21, 0x94, 0x89, 0x21, - 0x0e, 0x8b, 0x2d, 0x85, 0x03, 0x02, 0x71, 0x61, 0xc0, 0x44, 0x05, 0xe3, 0x8f, 0x87, 0x10, 0xe2, - 0x52, 0xa5, 0xc9, 0x9b, 0xcd, 0x1a, 0xb1, 0x43, 0xec, 0x05, 0xf2, 0x4d, 0xb8, 0x72, 0xe5, 0x93, - 0x70, 0xe4, 0x13, 0x20, 0x54, 0xbe, 0x08, 0x8a, 0xed, 0x8d, 0x56, 0x64, 0xed, 0x2d, 0xb6, 0x9f, - 0xe7, 0xf1, 0xfb, 0xfc, 0x14, 0xa3, 0x41, 0x1d, 0x53, 0x05, 0x4a, 0x71, 0x29, 0xa8, 0x82, 0xaa, - 0xe6, 0x29, 0x90, 0xb2, 0x92, 0x5a, 0xe2, 0x2d, 0x01, 0x92, 0xe4, 0x8a, 0xd4, 0x31, 0x71, 0x82, - 0xe0, 0x5a, 0x1d, 0xd3, 0x0a, 0x72, 0x45, 0x75, 0x53, 0x82, 0xb2, 0xba, 0xe0, 0xba, 0x49, 0x30, - 0x4e, 0x5a, 0x80, 0x4e, 0xdc, 0xf6, 0xf6, 0xcc, 0x76, 0x0d, 0x15, 0xcf, 0x1b, 0x7b, 0xb0, 0xf3, - 0xcb, 0x47, 0x1b, 0x8f, 0x2b, 0x48, 0x34, 0x30, 0xf8, 0x74, 0x06, 0x4a, 0xe3, 0xfb, 0x68, 0x65, - 0x22, 0xb3, 0x66, 0xe0, 0x0d, 0xbd, 0x3b, 0xbd, 0x78, 0x97, 0xfc, 0x77, 0x31, 0x99, 0xd3, 0x93, - 0x7d, 0x99, 0x35, 0xcc, 0x58, 0xf0, 0x53, 0xd4, 0x6b, 0xef, 0x1c, 0x9f, 0x40, 0x92, 0x41, 0x35, - 0xf0, 0x4d, 0xc2, 0xad, 0xb9, 0x04, 0xdb, 0xc9, 0x79, 0x0f, 0x41, 0x27, 0xcf, 0x8c, 0x96, 0xa1, - 0xe2, 0xe2, 0x1b, 0xbf, 0x41, 0x1b, 0x76, 0xc6, 0xf3, 0xa0, 0xab, 0x26, 0x68, 0xef, 0xf2, 0xa0, - 0x77, 0xad, 0x9c, 0xa7, 0x89, 0xe6, 0x52, 0xb8, 0xc0, 0xbe, 0x8d, 0xb0, 0xab, 0xe0, 0x0b, 0x5a, - 0x69, 0xe7, 0xc4, 0x31, 0x5a, 0x97, 0x9f, 0x05, 0x54, 0x63, 0x9e, 0xb9, 0x82, 0xdb, 0x33, 0xa9, - 0x2d, 0x4d, 0xf2, 0xaa, 0x3d, 0x1f, 0x3d, 0x61, 0x6b, 0x46, 0x38, 0xca, 0xf0, 0x43, 0xb4, 0xfe, - 0x91, 0xe7, 0xa0, 0x79, 0x01, 0xae, 0xd2, 0xb0, 0x63, 0x92, 0xb7, 0xf2, 0x14, 0xc4, 0x0b, 0xa7, - 0x63, 0x17, 0x8e, 0x9d, 0x6f, 0x3e, 0xda, 0x3c, 0x07, 0xa6, 0x4a, 0x29, 0x14, 0xe0, 0x07, 0x73, - 0x84, 0x6f, 0x2f, 0x20, 0x6c, 0x0d, 0xb3, 0x88, 0x0f, 0xba, 0x10, 0xef, 0x76, 0x92, 0xb1, 0xe6, - 0x4b, 0x18, 0xb3, 0x6e, 0xc6, 0xd1, 0x82, 0xa4, 0xa5, 0x90, 0xef, 0x39, 0xc8, 0x9b, 0xc8, 0x77, - 0x78, 0xfb, 0xcc, 0xe7, 0x19, 0xbe, 0x81, 0x7a, 0xae, 0xd8, 0xf8, 0x14, 0x1a, 0x33, 0x73, 0x9f, - 0x21, 0xb7, 0xf5, 0x1c, 0x9a, 0xf8, 0x3d, 0x5a, 0x3b, 0xb2, 0x2b, 0x7c, 0x88, 0x56, 0x6d, 0x79, - 0x3c, 0x5c, 0xf6, 0xe7, 0x05, 0x37, 0x97, 0x92, 0xdb, 0x67, 0x3f, 0xa6, 0xa1, 0xf7, 0x73, 0x1a, - 0x7a, 0xbf, 0xa7, 0xa1, 0xf7, 0xf5, 0x4f, 0x78, 0xe5, 0xc3, 0xde, 0x31, 0xd7, 0x27, 0x67, 0x13, - 0x92, 0xca, 0x82, 0x0a, 0x55, 0xa6, 0x69, 0x94, 0x41, 0x4d, 0x05, 0xc8, 0x5c, 0x45, 0x49, 0xc9, - 0xa3, 0x63, 0x49, 0xff, 0x3d, 0xc2, 0xef, 0xfe, 0xd6, 0x4b, 0x90, 0x07, 0x47, 0xe4, 0xd1, 0xeb, - 0x11, 0x71, 0x23, 0x4e, 0x56, 0xcd, 0xcb, 0xb9, 0xfb, 0x37, 0x00, 0x00, 0xff, 0xff, 0xf2, 0xbe, - 0x3b, 0xbe, 0xad, 0x03, 0x00, 0x00, + // 463 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x93, 0xdf, 0x6e, 0xd3, 0x30, + 0x14, 0xc6, 0x49, 0x98, 0xc6, 0xe4, 0x76, 0x95, 0x30, 0xa0, 0x55, 0xbd, 0x28, 0x65, 0x62, 0x88, + 0x0b, 0x62, 0x4b, 0x01, 0x09, 0xf1, 0xe7, 0x86, 0x01, 0x13, 0x15, 0x8c, 0x3f, 0x2e, 0xe2, 0x02, + 0x09, 0x45, 0x69, 0x72, 0xb2, 0x59, 0x23, 0x76, 0x88, 0xbd, 0x40, 0xde, 0x84, 0x5b, 0x6e, 0x79, + 0x12, 0x2e, 0x79, 0x02, 0x84, 0xca, 0x8b, 0xa0, 0xd8, 0xde, 0x68, 0x45, 0xd6, 0x5e, 0xb5, 0x3e, + 0xfe, 0xbe, 0xef, 0x9c, 0xf3, 0x53, 0x8c, 0xfa, 0x55, 0x48, 0x15, 0x28, 0xc5, 0xa5, 0xa0, 0x0a, + 0xca, 0x8a, 0x27, 0x40, 0x8a, 0x52, 0x6a, 0x89, 0x2f, 0x0a, 0x90, 0x24, 0x53, 0xa4, 0x0a, 0x89, + 0x13, 0x0c, 0x2e, 0x55, 0x21, 0x2d, 0x21, 0x53, 0x54, 0xd7, 0x05, 0x28, 0xab, 0x1b, 0x5c, 0x31, + 0x09, 0xc6, 0x49, 0x73, 0xd0, 0xb1, 0x2b, 0x6f, 0xcd, 0x95, 0x2b, 0x28, 0x79, 0x56, 0xdb, 0x8b, + 0xed, 0x5f, 0x3e, 0xda, 0x7c, 0x5c, 0x42, 0xac, 0x81, 0xc1, 0xa7, 0x63, 0x50, 0x1a, 0xdf, 0x43, + 0x6b, 0x53, 0x99, 0xd6, 0x7d, 0x6f, 0xe4, 0xdd, 0xec, 0x84, 0x3b, 0xe4, 0xbf, 0xc6, 0x64, 0x41, + 0x4f, 0x76, 0x65, 0x5a, 0x33, 0x63, 0xc1, 0x4f, 0x51, 0xa7, 0xe9, 0x19, 0x1d, 0x42, 0x9c, 0x42, + 0xd9, 0xf7, 0x4d, 0xc2, 0xf5, 0x85, 0x04, 0xbb, 0x93, 0xf3, 0xee, 0x83, 0x8e, 0x9f, 0x19, 0x2d, + 0x43, 0xf9, 0xe9, 0x7f, 0xfc, 0x06, 0x6d, 0xda, 0x19, 0x4f, 0x82, 0xce, 0x9b, 0xa0, 0x5b, 0x67, + 0x07, 0xbd, 0x6b, 0xe4, 0x3c, 0x89, 0x35, 0x97, 0xc2, 0x05, 0x76, 0x6d, 0x84, 0x3d, 0x0d, 0xbe, + 0xa0, 0xb5, 0x66, 0x4e, 0x1c, 0xa2, 0x0d, 0xf9, 0x59, 0x40, 0x19, 0xf1, 0xd4, 0x2d, 0xb8, 0x35, + 0x97, 0xda, 0xd0, 0x24, 0xaf, 0x9a, 0xfb, 0xf1, 0x13, 0x76, 0xc1, 0x08, 0xc7, 0x29, 0x7e, 0x88, + 0x36, 0x3e, 0xf2, 0x0c, 0x34, 0xcf, 0xc1, 0xad, 0x34, 0x6a, 0x99, 0xe4, 0xad, 0x3c, 0x02, 0xf1, + 0xc2, 0xe9, 0xd8, 0xa9, 0x63, 0xfb, 0x9b, 0x8f, 0x7a, 0x27, 0xc0, 0x54, 0x21, 0x85, 0x02, 0x7c, + 0x7f, 0x81, 0xf0, 0x8d, 0x25, 0x84, 0xad, 0x61, 0x1e, 0xf1, 0x5e, 0x1b, 0xe2, 0x9d, 0x56, 0x32, + 0xd6, 0x7c, 0x06, 0x63, 0xd6, 0xce, 0x38, 0x58, 0x92, 0xb4, 0x12, 0xf2, 0x5d, 0x07, 0xb9, 0x87, + 0x7c, 0x87, 0xb7, 0xcb, 0x7c, 0x9e, 0xe2, 0xab, 0xa8, 0xe3, 0x16, 0x8b, 0x8e, 0xa0, 0x36, 0x33, + 0x77, 0x19, 0x72, 0xa5, 0xe7, 0x50, 0x87, 0x11, 0xea, 0x4d, 0xec, 0x69, 0x62, 0x7b, 0xe2, 0x7d, + 0xb4, 0x6e, 0x19, 0xe0, 0xd1, 0xaa, 0x0f, 0x70, 0x70, 0x6d, 0x25, 0xc0, 0xdd, 0x0f, 0x3f, 0x66, + 0x43, 0xef, 0xe7, 0x6c, 0xe8, 0xfd, 0x9e, 0x0d, 0xbd, 0xaf, 0x7f, 0x86, 0xe7, 0xde, 0xdf, 0x39, + 0xe0, 0xfa, 0xf0, 0x78, 0x4a, 0x12, 0x99, 0x53, 0xa1, 0x8a, 0x24, 0x09, 0x52, 0xa8, 0xa8, 0x00, + 0x99, 0xa9, 0x20, 0x2e, 0x78, 0x70, 0x20, 0xe9, 0xbf, 0xb7, 0xf8, 0xc0, 0xfd, 0x7e, 0xf7, 0x2f, + 0xbf, 0x04, 0xb9, 0x37, 0x21, 0x8f, 0x5e, 0x8f, 0x9b, 0x6e, 0x6e, 0xe8, 0xe9, 0xba, 0x79, 0x4b, + 0xb7, 0xff, 0x06, 0x00, 0x00, 0xff, 0xff, 0x38, 0xb7, 0xac, 0xe1, 0xbf, 0x03, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -331,74 +333,74 @@ var _ grpc.ClientConn // is compatible with the grpc package it is being compiled against. const _ = grpc.SupportPackageIsVersion4 -// SessionClient is the client API for Session service. +// SessionServiceClient is the client API for SessionService service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type SessionClient interface { +type SessionServiceClient interface { // Create opens new session between the client and the server. Create(ctx context.Context, in *CreateRequest, opts ...grpc.CallOption) (*CreateResponse, error) } -type sessionClient struct { +type sessionServiceClient struct { cc *grpc.ClientConn } -func NewSessionClient(cc *grpc.ClientConn) SessionClient { - return &sessionClient{cc} +func NewSessionServiceClient(cc *grpc.ClientConn) SessionServiceClient { + return &sessionServiceClient{cc} } -func (c *sessionClient) Create(ctx context.Context, in *CreateRequest, opts ...grpc.CallOption) (*CreateResponse, error) { +func (c *sessionServiceClient) Create(ctx context.Context, in *CreateRequest, opts ...grpc.CallOption) (*CreateResponse, error) { out := new(CreateResponse) - err := c.cc.Invoke(ctx, "/neo.fs.v2.session.Session/Create", in, out, opts...) + err := c.cc.Invoke(ctx, "/neo.fs.v2.session.SessionService/Create", in, out, opts...) if err != nil { return nil, err } return out, nil } -// SessionServer is the server API for Session service. -type SessionServer interface { +// SessionServiceServer is the server API for SessionService service. +type SessionServiceServer interface { // Create opens new session between the client and the server. Create(context.Context, *CreateRequest) (*CreateResponse, error) } -// UnimplementedSessionServer can be embedded to have forward compatible implementations. -type UnimplementedSessionServer struct { +// UnimplementedSessionServiceServer can be embedded to have forward compatible implementations. +type UnimplementedSessionServiceServer struct { } -func (*UnimplementedSessionServer) Create(ctx context.Context, req *CreateRequest) (*CreateResponse, error) { +func (*UnimplementedSessionServiceServer) Create(ctx context.Context, req *CreateRequest) (*CreateResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Create not implemented") } -func RegisterSessionServer(s *grpc.Server, srv SessionServer) { - s.RegisterService(&_Session_serviceDesc, srv) +func RegisterSessionServiceServer(s *grpc.Server, srv SessionServiceServer) { + s.RegisterService(&_SessionService_serviceDesc, srv) } -func _Session_Create_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _SessionService_Create_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(CreateRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(SessionServer).Create(ctx, in) + return srv.(SessionServiceServer).Create(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/neo.fs.v2.session.Session/Create", + FullMethod: "/neo.fs.v2.session.SessionService/Create", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(SessionServer).Create(ctx, req.(*CreateRequest)) + return srv.(SessionServiceServer).Create(ctx, req.(*CreateRequest)) } return interceptor(ctx, in, info, handler) } -var _Session_serviceDesc = grpc.ServiceDesc{ - ServiceName: "neo.fs.v2.session.Session", - HandlerType: (*SessionServer)(nil), +var _SessionService_serviceDesc = grpc.ServiceDesc{ + ServiceName: "neo.fs.v2.session.SessionService", + HandlerType: (*SessionServiceServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "Create", - Handler: _Session_Create_Handler, + Handler: _SessionService_Create_Handler, }, }, Streams: []grpc.StreamDesc{}, diff --git a/v2/storagegroup/types.pb.go b/v2/storagegroup/types.pb.go index e206d31..2622367 100644 --- a/v2/storagegroup/types.pb.go +++ b/v2/storagegroup/types.pb.go @@ -113,26 +113,26 @@ func init() { func init() { proto.RegisterFile("v2/storagegroup/types.proto", fileDescriptor_593772eae6c18cdf) } var fileDescriptor_593772eae6c18cdf = []byte{ - // 293 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x5c, 0xd0, 0xdf, 0x4a, 0xf3, 0x30, - 0x18, 0x06, 0xf0, 0x2f, 0xdb, 0xf8, 0x84, 0x38, 0x9c, 0x44, 0x19, 0x45, 0xa1, 0x0c, 0x4f, 0x9c, - 0x07, 0x4b, 0xb4, 0x5e, 0x81, 0x32, 0xff, 0xec, 0x44, 0xa5, 0x3d, 0x13, 0x61, 0xa4, 0xed, 0xdb, - 0x36, 0x62, 0x9b, 0x90, 0x64, 0x45, 0x77, 0x25, 0x5e, 0x83, 0x57, 0xb2, 0x43, 0x2f, 0x41, 0xea, - 0x8d, 0x48, 0x37, 0xa4, 0xc5, 0xd3, 0x27, 0xbf, 0xbc, 0xf0, 0x3c, 0xf8, 0xb0, 0xf4, 0x98, 0xb1, - 0x52, 0xf3, 0x14, 0x52, 0x2d, 0x17, 0x8a, 0xd9, 0x37, 0x05, 0x86, 0x2a, 0x2d, 0xad, 0x24, 0xc3, - 0x02, 0x24, 0x4d, 0x0c, 0x2d, 0x3d, 0xda, 0x36, 0x07, 0x7b, 0xa5, 0xc7, 0x34, 0x24, 0xa6, 0x8d, - 0x8f, 0x56, 0x08, 0xf7, 0x83, 0x8d, 0xba, 0xa9, 0x15, 0x39, 0xc5, 0xfb, 0x25, 0x7f, 0x11, 0x31, - 0xb7, 0x42, 0x16, 0xf3, 0x98, 0x5b, 0x3e, 0x37, 0x62, 0x09, 0x0e, 0x1a, 0xa1, 0x71, 0xcf, 0x27, - 0xcd, 0xdb, 0x94, 0x5b, 0x1e, 0x88, 0x25, 0x90, 0x63, 0x3c, 0x68, 0xfd, 0xc8, 0xb8, 0xc9, 0x9c, - 0xce, 0x08, 0x8d, 0xfb, 0xfe, 0x4e, 0x13, 0xdf, 0x72, 0x93, 0x91, 0x13, 0xbc, 0x0b, 0xaf, 0x4a, - 0xe8, 0x0d, 0x04, 0x25, 0xa3, 0xcc, 0xe9, 0xae, 0xcf, 0x0e, 0x9a, 0xfc, 0xaa, 0x8e, 0x89, 0x87, - 0xb7, 0x72, 0xc8, 0x43, 0xd0, 0xc6, 0xe9, 0x8d, 0xba, 0xe3, 0x6d, 0xcf, 0xa1, 0x4d, 0xab, 0xba, - 0x04, 0xbd, 0x0f, 0x9f, 0x21, 0xb2, 0xb3, 0xa9, 0xff, 0x0b, 0x2f, 0x9f, 0x56, 0x95, 0x8b, 0x3e, - 0x2b, 0x17, 0x7d, 0x55, 0x2e, 0x7a, 0xff, 0x76, 0xff, 0x3d, 0x9e, 0xa5, 0xc2, 0x66, 0x8b, 0x90, - 0x46, 0x32, 0x67, 0x85, 0x51, 0x51, 0x34, 0x89, 0xa1, 0x64, 0x05, 0xc8, 0xc4, 0x4c, 0xb8, 0x12, - 0x93, 0x54, 0xb2, 0x3f, 0x43, 0x7e, 0x74, 0x86, 0x77, 0x20, 0xaf, 0x03, 0x7a, 0xf1, 0x30, 0xa3, - 0xed, 0x5d, 0xc2, 0xff, 0xeb, 0xbd, 0xce, 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff, 0xe7, 0x71, 0xf1, - 0x6b, 0x7b, 0x01, 0x00, 0x00, + // 297 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x5c, 0x90, 0xdf, 0x4a, 0xc3, 0x30, + 0x14, 0xc6, 0xcd, 0x36, 0x14, 0xe2, 0x70, 0x12, 0x45, 0xaa, 0x42, 0x19, 0xde, 0x38, 0x2f, 0x96, + 0x48, 0xbd, 0x14, 0x04, 0x65, 0xfe, 0xd9, 0x8d, 0xca, 0x7a, 0xe7, 0xcd, 0x48, 0xdb, 0xd3, 0x36, + 0xb2, 0x36, 0x21, 0xc9, 0x8a, 0xee, 0x49, 0x7c, 0x06, 0x9f, 0x64, 0x97, 0x3e, 0x82, 0xd4, 0x17, + 0x91, 0x6e, 0x48, 0x8b, 0x97, 0xf9, 0xf2, 0x3b, 0xe7, 0xf0, 0xfd, 0xf0, 0x71, 0xe1, 0x31, 0x63, + 0xa5, 0xe6, 0x09, 0x24, 0x5a, 0xce, 0x15, 0xb3, 0xef, 0x0a, 0x0c, 0x55, 0x5a, 0x5a, 0x49, 0x0e, + 0x72, 0x90, 0x34, 0x36, 0xb4, 0xf0, 0x68, 0x93, 0x39, 0xda, 0x2b, 0x3c, 0xa6, 0x21, 0x36, 0x4d, + 0xf8, 0x64, 0x89, 0x70, 0xd7, 0x5f, 0x53, 0xf7, 0x15, 0x45, 0xce, 0xf1, 0x7e, 0xc1, 0x67, 0x22, + 0xe2, 0x56, 0xc8, 0x7c, 0x1a, 0x71, 0xcb, 0xa7, 0x46, 0x2c, 0xc0, 0x41, 0x7d, 0x34, 0xe8, 0x4c, + 0x48, 0xfd, 0x37, 0xe2, 0x96, 0xfb, 0x62, 0x01, 0xe4, 0x14, 0xf7, 0x1a, 0x13, 0x29, 0x37, 0xa9, + 0xd3, 0xea, 0xa3, 0x41, 0x77, 0xb2, 0x53, 0xc7, 0x0f, 0xdc, 0xa4, 0xe4, 0x0c, 0xef, 0xc2, 0x9b, + 0x12, 0x7a, 0x0d, 0x82, 0x92, 0x61, 0xea, 0xb4, 0x57, 0x6b, 0x7b, 0x75, 0x7e, 0x5b, 0xc5, 0xc4, + 0xc3, 0x5b, 0x19, 0x64, 0x01, 0x68, 0xe3, 0x74, 0xfa, 0xed, 0xc1, 0xb6, 0xe7, 0xd0, 0xba, 0x55, + 0x55, 0x82, 0x3e, 0x05, 0xaf, 0x10, 0xda, 0xf1, 0x68, 0xf2, 0x07, 0xde, 0xcc, 0x96, 0xa5, 0x8b, + 0xbe, 0x4a, 0x17, 0x7d, 0x97, 0x2e, 0xfa, 0xf8, 0x71, 0x37, 0x5e, 0xae, 0x12, 0x61, 0xd3, 0x79, + 0x40, 0x43, 0x99, 0xb1, 0xdc, 0xa8, 0x30, 0x1c, 0x46, 0x50, 0xb0, 0x1c, 0x64, 0x6c, 0x86, 0x5c, + 0x89, 0x61, 0x22, 0xd9, 0x3f, 0x91, 0x97, 0xcd, 0xc7, 0x67, 0xeb, 0xf0, 0x11, 0xe4, 0x9d, 0x4f, + 0xaf, 0x9f, 0xc7, 0xd5, 0xdd, 0xa6, 0xa7, 0x60, 0x73, 0xe5, 0xef, 0xe2, 0x37, 0x00, 0x00, 0xff, + 0xff, 0xec, 0x24, 0x17, 0x69, 0x8b, 0x01, 0x00, 0x00, } func (m *StorageGroup) Marshal() (dAtA []byte, err error) { From 59858805a8cacd643edd2a413b05dccfa783641f Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Fri, 14 Aug 2020 10:22:15 +0300 Subject: [PATCH 0275/1196] Update field names in setters and tests Signed-off-by: Alex Vanin --- v2/container/marshal.go | 10 ++++----- v2/container/marshal_test.go | 8 +++---- v2/container/types.go | 4 ++-- v2/netmap/marshal.go | 42 ++++++++++++++++++------------------ v2/netmap/types.go | 32 +++++++++++++-------------- v2/object/service.go | 17 +++++---------- v2/service/meta.go | 8 +++---- 7 files changed, 57 insertions(+), 64 deletions(-) diff --git a/v2/container/marshal.go b/v2/container/marshal.go index 2d8e1d0..aa04626 100644 --- a/v2/container/marshal.go +++ b/v2/container/marshal.go @@ -68,12 +68,12 @@ func (m *Container) StableMarshal(buf []byte) ([]byte, error) { // Write placement rule field. - if m.Rules != nil { + if m.PlacementPolicy != nil { buf[i] = 0x2A // id:0x5 << 3 | wiretype:0x2 - n = m.Rules.StableSize() + n = m.PlacementPolicy.StableSize() offset = binary.PutUvarint(buf[i+1:], uint64(n)) - _, err := m.Rules.StableMarshal(buf[i+1+offset:]) + _, err := m.PlacementPolicy.StableMarshal(buf[i+1+offset:]) if err != nil { return nil, errors.Wrapf(err, "can't marshal attribute %v", m.Attributes[i].Key) @@ -110,8 +110,8 @@ func (m *Container) StableSize() int { } // size of placement rule - if m.Rules != nil { - ln = m.Rules.StableSize() + if m.PlacementPolicy != nil { + ln = m.PlacementPolicy.StableSize() size += 1 + uvarIntSize(uint64(ln)) + ln // wiretype + size of struct + struct } diff --git a/v2/container/marshal_test.go b/v2/container/marshal_test.go index 43fa57f..a7e2888 100644 --- a/v2/container/marshal_test.go +++ b/v2/container/marshal_test.go @@ -23,17 +23,17 @@ var ( Value: "Mir", }, }, - Rules: &netmap.PlacementRule{ + PlacementPolicy: &netmap.PlacementPolicy{ ReplFactor: 4, - SfGroups: []*netmap.PlacementRule_SFGroup{ + FilterGroups: []*netmap.PlacementPolicy_FilterGroup{ { - Selectors: []*netmap.PlacementRule_SFGroup_Selector{ + Selectors: []*netmap.PlacementPolicy_FilterGroup_Selector{ { Count: 1, Key: "Node", }, }, - Filters: []*netmap.PlacementRule_SFGroup_Filter{ + Filters: []*netmap.PlacementPolicy_FilterGroup_Filter{ { Key: "City", }, diff --git a/v2/container/types.go b/v2/container/types.go index dd64a54..eb74ead 100644 --- a/v2/container/types.go +++ b/v2/container/types.go @@ -48,8 +48,8 @@ func (m *Container) SetAttributes(v []*Container_Attribute) { } // SetRules sets placement rules of the container. -func (m *Container) SetRules(v *netmap.PlacementRule) { +func (m *Container) SetRules(v *netmap.PlacementPolicy) { if m != nil { - m.Rules = v + m.PlacementPolicy = v } } diff --git a/v2/netmap/marshal.go b/v2/netmap/marshal.go index f0938c4..58b0685 100644 --- a/v2/netmap/marshal.go +++ b/v2/netmap/marshal.go @@ -7,7 +7,7 @@ import ( "github.com/pkg/errors" ) -func (m *PlacementRule) StableMarshal(buf []byte) ([]byte, error) { +func (m *PlacementPolicy) StableMarshal(buf []byte) ([]byte, error) { if m == nil { return []byte{}, nil } @@ -27,13 +27,13 @@ func (m *PlacementRule) StableMarshal(buf []byte) ([]byte, error) { i += 1 + offset // write select/filter groups field - for j := range m.SfGroups { + for j := range m.FilterGroups { buf[i] = 0x12 // id:0x2 << 3 | wiretype:0x2 - n, _ = m.SfGroups[j].stableSizeWithExclude() + n, _ = m.FilterGroups[j].stableSizeWithExclude() offset = binary.PutUvarint(buf[i+1:], uint64(n)) - _, err := m.SfGroups[j].StableMarshal(buf[i+1+offset:]) + _, err := m.FilterGroups[j].StableMarshal(buf[i+1+offset:]) if err != nil { return nil, errors.Wrapf(err, "can't marshal SFGroup id:%d", j) } @@ -44,7 +44,7 @@ func (m *PlacementRule) StableMarshal(buf []byte) ([]byte, error) { return buf, nil } -func (m *PlacementRule) StableSize() int { +func (m *PlacementPolicy) StableSize() int { if m == nil { return 0 } @@ -57,15 +57,15 @@ func (m *PlacementRule) StableSize() int { // size of replication factor field size += 1 + uvarIntSize(uint64(m.ReplFactor)) // wiretype + varint - for i := range m.SfGroups { - ln, _ = m.SfGroups[i].stableSizeWithExclude() + for i := range m.FilterGroups { + ln, _ = m.FilterGroups[i].stableSizeWithExclude() size += 1 + uvarIntSize(uint64(ln)) + ln // wiretype + size of struct + struct } return size } -func (m *PlacementRule_SFGroup) StableMarshal(buf []byte) ([]byte, error) { +func (m *PlacementPolicy_FilterGroup) StableMarshal(buf []byte) ([]byte, error) { if m == nil { return []byte{}, nil } @@ -115,7 +115,7 @@ func (m *PlacementRule_SFGroup) StableMarshal(buf []byte) ([]byte, error) { return buf, nil } -func (m *PlacementRule_SFGroup) stableSizeWithExclude() (int, int) { +func (m *PlacementPolicy_FilterGroup) stableSizeWithExclude() (int, int) { if m == nil { return 0, 0 } @@ -146,7 +146,7 @@ func (m *PlacementRule_SFGroup) stableSizeWithExclude() (int, int) { return size, ln } -func (m *PlacementRule_SFGroup_Selector) StableMarshal(buf []byte) ([]byte, error) { +func (m *PlacementPolicy_FilterGroup_Selector) StableMarshal(buf []byte) ([]byte, error) { if m == nil { return []byte{}, nil } @@ -172,7 +172,7 @@ func (m *PlacementRule_SFGroup_Selector) StableMarshal(buf []byte) ([]byte, erro return buf, nil } -func (m *PlacementRule_SFGroup_Selector) stableSize() int { +func (m *PlacementPolicy_FilterGroup_Selector) stableSize() int { if m == nil { return 0 } @@ -191,7 +191,7 @@ func (m *PlacementRule_SFGroup_Selector) stableSize() int { return size } -func (m *PlacementRule_SFGroup_Filter) StableMarshal(buf []byte) ([]byte, error) { +func (m *PlacementPolicy_FilterGroup_Filter) StableMarshal(buf []byte) ([]byte, error) { if m == nil { return []byte{}, nil } @@ -224,7 +224,7 @@ func (m *PlacementRule_SFGroup_Filter) StableMarshal(buf []byte) ([]byte, error) return buf, nil } -func (m *PlacementRule_SFGroup_Filter) stableSize() int { +func (m *PlacementPolicy_FilterGroup_Filter) stableSize() int { if m == nil { return 0 } @@ -246,7 +246,7 @@ func (m *PlacementRule_SFGroup_Filter) stableSize() int { return size } -func (m *PlacementRule_SFGroup_Filter_SimpleFilter) StableMarshal(buf []byte) ([]byte, error) { +func (m *PlacementPolicy_FilterGroup_Filter_SimpleFilter) StableMarshal(buf []byte) ([]byte, error) { if m == nil { return []byte{}, nil } @@ -265,11 +265,11 @@ func (m *PlacementRule_SFGroup_Filter_SimpleFilter) StableMarshal(buf []byte) ([ i += 1 + offset // write value if present - if val, ok := m.Args.(*PlacementRule_SFGroup_Filter_SimpleFilter_Value); ok { + if val, ok := m.Args.(*PlacementPolicy_FilterGroup_Filter_SimpleFilter_Value); ok { buf[i] = 0x12 // id:0x2 << 3 | wiretype:0x2 offset = binary.PutUvarint(buf[i+1:], uint64(len(val.Value))) copy(buf[i+1+offset:], val.Value) - } else if filters, ok := m.Args.(*PlacementRule_SFGroup_Filter_SimpleFilter_FArgs); ok { + } else if filters, ok := m.Args.(*PlacementPolicy_FilterGroup_Filter_SimpleFilter_FArgs); ok { if filters.FArgs != nil { buf[i] = 0x1A // id:0x3 << 3 | wiretype:0x2 n = filters.FArgs.stableSize() @@ -284,7 +284,7 @@ func (m *PlacementRule_SFGroup_Filter_SimpleFilter) StableMarshal(buf []byte) ([ return buf, nil } -func (m *PlacementRule_SFGroup_Filter_SimpleFilter) stableSize() int { +func (m *PlacementPolicy_FilterGroup_Filter_SimpleFilter) stableSize() int { if m == nil { return 0 } @@ -296,11 +296,11 @@ func (m *PlacementRule_SFGroup_Filter_SimpleFilter) stableSize() int { // size of key field size += 1 + uvarIntSize(uint64(m.Op)) - if val, ok := m.Args.(*PlacementRule_SFGroup_Filter_SimpleFilter_Value); ok { + if val, ok := m.Args.(*PlacementPolicy_FilterGroup_Filter_SimpleFilter_Value); ok { // size of value if present ln = len(val.Value) size += 1 + uvarIntSize(uint64(ln)) + ln - } else if filters, ok := m.Args.(*PlacementRule_SFGroup_Filter_SimpleFilter_FArgs); ok { + } else if filters, ok := m.Args.(*PlacementPolicy_FilterGroup_Filter_SimpleFilter_FArgs); ok { // size of simple filters if present if filters.FArgs != nil { ln = filters.FArgs.stableSize() @@ -311,7 +311,7 @@ func (m *PlacementRule_SFGroup_Filter_SimpleFilter) stableSize() int { return size } -func (m *PlacementRule_SFGroup_Filter_SimpleFilters) StableMarshal(buf []byte) ([]byte, error) { +func (m *PlacementPolicy_FilterGroup_Filter_SimpleFilter_SimpleFilters) StableMarshal(buf []byte) ([]byte, error) { if m == nil { return []byte{}, nil } @@ -339,7 +339,7 @@ func (m *PlacementRule_SFGroup_Filter_SimpleFilters) StableMarshal(buf []byte) ( return buf, nil } -func (m *PlacementRule_SFGroup_Filter_SimpleFilters) stableSize() int { +func (m *PlacementPolicy_FilterGroup_Filter_SimpleFilter_SimpleFilters) stableSize() int { if m == nil { return 0 } diff --git a/v2/netmap/types.go b/v2/netmap/types.go index 552314d..a5e2cb3 100644 --- a/v2/netmap/types.go +++ b/v2/netmap/types.go @@ -1,97 +1,97 @@ package netmap // SetOp sets operation of the simple filter. -func (m *PlacementRule_SFGroup_Filter_SimpleFilter) SetOp(v PlacementRule_SFGroup_Filter_SimpleFilter_Operation) { +func (m *PlacementPolicy_FilterGroup_Filter_SimpleFilter) SetOp(v PlacementPolicy_FilterGroup_Filter_SimpleFilter_Operation) { if m != nil { m.Op = v } } // SetValue sets value of the simple filter. -func (m *PlacementRule_SFGroup_Filter_SimpleFilter) SetValue(v string) { +func (m *PlacementPolicy_FilterGroup_Filter_SimpleFilter) SetValue(v string) { if m != nil { - m.Args = &PlacementRule_SFGroup_Filter_SimpleFilter_Value{ + m.Args = &PlacementPolicy_FilterGroup_Filter_SimpleFilter_Value{ Value: v, } } } // SetFArgs sets filter args of the simple filter. -func (m *PlacementRule_SFGroup_Filter_SimpleFilter) SetFArgs(v *PlacementRule_SFGroup_Filter_SimpleFilters) { +func (m *PlacementPolicy_FilterGroup_Filter_SimpleFilter) SetFArgs(v *PlacementPolicy_FilterGroup_Filter_SimpleFilter_SimpleFilters) { if m != nil { - m.Args = &PlacementRule_SFGroup_Filter_SimpleFilter_FArgs{ + m.Args = &PlacementPolicy_FilterGroup_Filter_SimpleFilter_FArgs{ FArgs: v, } } } // SetFilters sets list of the simple filters. -func (m *PlacementRule_SFGroup_Filter_SimpleFilters) SetFilters(v []*PlacementRule_SFGroup_Filter_SimpleFilter) { +func (m *PlacementPolicy_FilterGroup_Filter_SimpleFilter_SimpleFilters) SetFilters(v []*PlacementPolicy_FilterGroup_Filter_SimpleFilter) { if m != nil { m.Filters = v } } // SeyKey sets key of the filter. -func (m *PlacementRule_SFGroup_Filter) SeyKey(v string) { +func (m *PlacementPolicy_FilterGroup_Filter) SeyKey(v string) { if m != nil { m.Key = v } } // SetF sets simple filter of the filter. -func (m *PlacementRule_SFGroup_Filter) SetF(v *PlacementRule_SFGroup_Filter_SimpleFilter) { +func (m *PlacementPolicy_FilterGroup_Filter) SetF(v *PlacementPolicy_FilterGroup_Filter_SimpleFilter) { if m != nil { m.F = v } } // SetCount sets count value of the selector. -func (m *PlacementRule_SFGroup_Selector) SetCount(v uint32) { +func (m *PlacementPolicy_FilterGroup_Selector) SetCount(v uint32) { if m != nil { m.Count = v } } // SetKey sets key of the selector. -func (m *PlacementRule_SFGroup_Selector) SetKey(v string) { +func (m *PlacementPolicy_FilterGroup_Selector) SetKey(v string) { if m != nil { m.Key = v } } // SetFilters sets list of the filters. -func (m *PlacementRule_SFGroup) SetFilters(v []*PlacementRule_SFGroup_Filter) { +func (m *PlacementPolicy_FilterGroup) SetFilters(v []*PlacementPolicy_FilterGroup_Filter) { if m != nil { m.Filters = v } } // SetSelectors sets list of the selectors. -func (m *PlacementRule_SFGroup) SetSelectors(v []*PlacementRule_SFGroup_Selector) { +func (m *PlacementPolicy_FilterGroup) SetSelectors(v []*PlacementPolicy_FilterGroup_Selector) { if m != nil { m.Selectors = v } } // SetExclude sets exclude list. -func (m *PlacementRule_SFGroup) SetExclude(v []uint32) { +func (m *PlacementPolicy_FilterGroup) SetExclude(v []uint32) { if m != nil { m.Exclude = v } } // SetReplFactor sets replication factor of the placement rule. -func (m *PlacementRule) SetReplFactor(v uint32) { +func (m *PlacementPolicy) SetReplFactor(v uint32) { if m != nil { m.ReplFactor = v } } // SetSfGroups sets list of the selector-filter groups. -func (m *PlacementRule) SetSfGroups(v []*PlacementRule_SFGroup) { +func (m *PlacementPolicy) SetSfGroups(v []*PlacementPolicy_FilterGroup) { if m != nil { - m.SfGroups = v + m.FilterGroups = v } } diff --git a/v2/object/service.go b/v2/object/service.go index 9ec8941..eae7ae5 100644 --- a/v2/object/service.go +++ b/v2/object/service.go @@ -368,35 +368,35 @@ func (m *HeadResponse) SetVerifyHeader(v *service.ResponseVerificationHeader) { } // SetMatchType sets match type of the filter. -func (m *SearchRequest_Body_Query_Filter) SetMatchType(v SearchRequest_Body_Query_Filter_MatchType) { +func (m *SearchRequest_Body_Filter) SetMatchType(v SearchRequest_Body_Filter_MatchType) { if m != nil { m.MatchType = v } } // SetName sets name of the filtering header. -func (m *SearchRequest_Body_Query_Filter) SetName(v string) { +func (m *SearchRequest_Body_Filter) SetName(v string) { if m != nil { m.Name = v } } // SetValue sets value of the filtering header. -func (m *SearchRequest_Body_Query_Filter) SetValue(v string) { +func (m *SearchRequest_Body_Filter) SetValue(v string) { if m != nil { m.Value = v } } // SetVersion sets version of the search query. -func (m *SearchRequest_Body_Query) SetVersion(v uint32) { +func (m *SearchRequest_Body) SetVersion(v uint32) { if m != nil { m.Version = v } } // SetFilters sets list of the query filters. -func (m *SearchRequest_Body_Query) SetFilters(v []*SearchRequest_Body_Query_Filter) { +func (m *SearchRequest_Body) SetFilters(v []*SearchRequest_Body_Filter) { if m != nil { m.Filters = v } @@ -409,13 +409,6 @@ func (m *SearchRequest_Body) SetContainerId(v *refs.ContainerID) { } } -// SetQuery sets search query structure. -func (m *SearchRequest_Body) SetQuery(v *SearchRequest_Body_Query) { - if m != nil { - m.Query = v - } -} - // SetBody sets body of the request. func (m *SearchRequest) SetBody(v *SearchRequest_Body) { if m != nil { diff --git a/v2/service/meta.go b/v2/service/meta.go index 61da3fa..a44e464 100644 --- a/v2/service/meta.go +++ b/v2/service/meta.go @@ -101,7 +101,7 @@ func (m *SessionToken_Body) SetObjectAddressContext(v *refs.Address) { // SetBody sets session token body. func (m *SessionToken) SetBody(v *SessionToken_Body) { if m != nil { - m.Token = v + m.Body = v } } @@ -136,7 +136,7 @@ func (m *BearerToken_Body) SetLifetime(v *TokenLifetime) { // SetBody sets bearer token body. func (m *BearerToken) SetBody(v *BearerToken_Body) { if m != nil { - m.Token = v + m.Body = v } } @@ -178,14 +178,14 @@ func (m *RequestMetaHeader) SetXHeaders(v []*XHeader) { // SetSessionToken sets session token of the request. func (m *RequestMetaHeader) SetSessionToken(v *SessionToken) { if m != nil { - m.Token = v + m.SessionToken = v } } // SetBearerToken sets bearer token of the request. func (m *RequestMetaHeader) SetBearerToken(v *BearerToken) { if m != nil { - m.Bearer = v + m.BearerToken = v } } From 619190332687f6579569286b78d1ff07b54c6803 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 14 Aug 2020 15:51:10 +0300 Subject: [PATCH 0276/1196] Implement new request signing mechanism Signed-off-by: Leonard Lyubich --- pkg/.gitkeep | 0 pkg/signature/request.go | 64 ------ {pkg => util}/signature/data.go | 0 {pkg => util}/signature/options.go | 0 {pkg => util}/signature/util.go | 0 v2/accounting.go | 85 +++++++ v2/convert.go | 351 +++++++++++++++++++++++++++++ v2/service.go | 331 +++++++++++++++++++++++++++ v2/signature/sign.go | 137 +++++++++++ 9 files changed, 904 insertions(+), 64 deletions(-) create mode 100644 pkg/.gitkeep delete mode 100644 pkg/signature/request.go rename {pkg => util}/signature/data.go (100%) rename {pkg => util}/signature/options.go (100%) rename {pkg => util}/signature/util.go (100%) create mode 100644 v2/accounting.go create mode 100644 v2/convert.go create mode 100644 v2/service.go create mode 100644 v2/signature/sign.go diff --git a/pkg/.gitkeep b/pkg/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/pkg/signature/request.go b/pkg/signature/request.go deleted file mode 100644 index fc72be7..0000000 --- a/pkg/signature/request.go +++ /dev/null @@ -1,64 +0,0 @@ -package signature - -import ( - "crypto/ecdsa" - - "github.com/pkg/errors" -) - -type SignedRequest interface { - RequestBody() DataSource - RequestMetaHeader() DataSource - OriginVerificationHeader() DataSource - - SetBodySignatureWithKey(key, sig []byte) - BodySignatureWithKey() (key, sig []byte) - - SetMetaSignatureWithKey(key, sig []byte) - MetaSignatureWithKey() (key, sig []byte) - - SetOriginSignatureWithKey(key, sig []byte) - OriginSignatureWithKey() (key, sig []byte) -} - -func SignRequest(key *ecdsa.PrivateKey, src SignedRequest) error { - if src == nil { - return errors.New("nil source") - } - - // sign body - if err := SignDataWithHandler(key, src.RequestBody(), src.SetBodySignatureWithKey); err != nil { - return errors.Wrap(err, "could not sign body") - } - - // sign meta - if err := SignDataWithHandler(key, src.RequestMetaHeader(), src.SetMetaSignatureWithKey); err != nil { - return errors.Wrap(err, "could not sign meta header") - } - - // sign verify origin - if err := SignDataWithHandler(key, src.OriginVerificationHeader(), src.SetOriginSignatureWithKey); err != nil { - return errors.Wrap(err, "could not sign verification header origin") - } - - return nil -} - -func VerifyRequest(src SignedRequest) error { - // verify body signature - if err := VerifyDataWithSource(src.RequestBody(), src.BodySignatureWithKey); err != nil { - return errors.Wrap(err, "could not verify body") - } - - // verify meta header - if err := VerifyDataWithSource(src.RequestMetaHeader(), src.MetaSignatureWithKey); err != nil { - return errors.Wrap(err, "could not verify meta header") - } - - // verify verification header origin - if err := VerifyDataWithSource(src.OriginVerificationHeader(), src.OriginSignatureWithKey); err != nil { - return errors.Wrap(err, "could not verify verification header origin") - } - - return nil -} diff --git a/pkg/signature/data.go b/util/signature/data.go similarity index 100% rename from pkg/signature/data.go rename to util/signature/data.go diff --git a/pkg/signature/options.go b/util/signature/options.go similarity index 100% rename from pkg/signature/options.go rename to util/signature/options.go diff --git a/pkg/signature/util.go b/util/signature/util.go similarity index 100% rename from pkg/signature/util.go rename to util/signature/util.go diff --git a/v2/accounting.go b/v2/accounting.go new file mode 100644 index 0000000..a14e5a1 --- /dev/null +++ b/v2/accounting.go @@ -0,0 +1,85 @@ +package v2 + +type BalanceRequestBody struct { + ownerID *OwnerID +} + +type BalanceRequest struct { + body *BalanceRequestBody + + metaHeader *RequestMetaHeader + + verifyHeader *RequestVerificationHeader +} + +func (b *BalanceRequestBody) GetOwnerID() *OwnerID { + if b != nil { + return b.ownerID + } + + return nil +} + +func (b *BalanceRequestBody) SetOwnerID(v *OwnerID) { + if b != nil { + b.ownerID = v + } +} + +func (r *BalanceRequestBody) StableMarshal(buf []byte) ([]byte, error) { + if r == nil { + return nil, nil + } + + // TODO: do not use hack + _, err := BalanceRequestBodyToGRPCMessage(r).MarshalTo(buf) + + return buf, err +} + +func (r *BalanceRequestBody) StableSize() int { + // TODO: do not use hack + return BalanceRequestBodyToGRPCMessage(r).Size() +} + +func (b *BalanceRequest) GetBody() *BalanceRequestBody { + if b != nil { + return b.body + } + + return nil +} + +func (b *BalanceRequest) SetBody(v *BalanceRequestBody) { + if b != nil { + b.body = v + } +} + +func (b *BalanceRequest) GetRequestMetaHeader() *RequestMetaHeader { + if b != nil { + return b.metaHeader + } + + return nil +} + +func (b *BalanceRequest) SetRequestMetaHeader(v *RequestMetaHeader) { + if b != nil { + b.metaHeader = v + } +} + +func (b *BalanceRequest) GetRequestVerificationHeader() *RequestVerificationHeader { + if b != nil { + return b.verifyHeader + } + + return nil +} + +func (b *BalanceRequest) SetRequestVerificationHeader(v *RequestVerificationHeader) { + if b != nil { + b.verifyHeader = v + } +} diff --git a/v2/convert.go b/v2/convert.go new file mode 100644 index 0000000..8cc95a6 --- /dev/null +++ b/v2/convert.go @@ -0,0 +1,351 @@ +package v2 + +import ( + "github.com/nspcc-dev/neofs-api-go/v2/accounting" + "github.com/nspcc-dev/neofs-api-go/v2/refs" + "github.com/nspcc-dev/neofs-api-go/v2/service" +) + +func SignatureToGRPCMessage(s *Signature) *service.Signature { + if s == nil { + return nil + } + + m := new(service.Signature) + + m.SetKey(s.GetKey()) + m.SetSign(s.GetSign()) + + return m +} + +func SignatureFromGRPCMessage(m *service.Signature) *Signature { + if m == nil { + return nil + } + + s := new(Signature) + + s.SetKey(m.GetKey()) + s.SetSign(m.GetSign()) + + return s +} + +func VersionToGRPCMessage(v *Version) *service.Version { + if v == nil { + return nil + } + + msg := new(service.Version) + + msg.SetMajor(v.GetMajor()) + msg.SetMinor(v.GetMinor()) + + return msg +} + +func VersionFromGRPCMessage(m *service.Version) *Version { + if m == nil { + return nil + } + + v := new(Version) + + v.SetMajor(m.GetMajor()) + v.SetMinor(m.GetMinor()) + + return v +} + +func XHeaderToGRPCMessage(x *XHeader) *service.XHeader { + if x == nil { + return nil + } + + m := new(service.XHeader) + + m.SetKey(x.GetKey()) + m.SetValue(x.GetValue()) + + return m +} + +func XHeaderFromGRPCMessage(m *service.XHeader) *XHeader { + if m == nil { + return nil + } + + x := new(XHeader) + + x.SetKey(m.GetKey()) + x.SetValue(m.GetValue()) + + return x +} + +func SessionTokenToGRPCMessage(t *SessionToken) *service.SessionToken { + // TODO: fill me + return nil +} + +func SessionTokenFromGRPCMessage(m *service.SessionToken) *SessionToken { + // TODO: fill me + return nil +} + +func BearerTokenToGRPCMessage(t *BearerToken) *service.BearerToken { + // TODO: fill me + return nil +} + +func BearerTokenFromGRPCMessage(m *service.BearerToken) *BearerToken { + // TODO: fill me + return nil +} + +func RequestVerificationHeaderToGRPCMessage(r *RequestVerificationHeader) *service.RequestVerificationHeader { + if r == nil { + return nil + } + + m := new(service.RequestVerificationHeader) + + m.SetBodySignature( + SignatureToGRPCMessage(r.GetBodySignature()), + ) + + m.SetMetaSignature( + SignatureToGRPCMessage(r.GetMetaSignature()), + ) + + m.SetOriginSignature( + SignatureToGRPCMessage(r.GetOriginSignature()), + ) + + m.SetOrigin( + RequestVerificationHeaderToGRPCMessage(r.GetOrigin()), + ) + + return m +} + +func RequestVerificationHeaderFromGRPCMessage(m *service.RequestVerificationHeader) *RequestVerificationHeader { + if m == nil { + return nil + } + + r := new(RequestVerificationHeader) + + r.SetBodySignature( + SignatureFromGRPCMessage(m.GetBodySignature()), + ) + + r.SetMetaSignature( + SignatureFromGRPCMessage(m.GetMetaSignature()), + ) + + r.SetOriginSignature( + SignatureFromGRPCMessage(m.GetOriginSignature()), + ) + + r.SetOrigin( + RequestVerificationHeaderFromGRPCMessage(m.GetOrigin()), + ) + + return r +} + +func RequestMetaHeaderToGRPCMessage(r *RequestMetaHeader) *service.RequestMetaHeader { + if r == nil { + return nil + } + + m := new(service.RequestMetaHeader) + + m.SetTtl(r.GetTTL()) + m.SetEpoch(r.GetEpoch()) + + m.SetVersion( + VersionToGRPCMessage(r.GetVersion()), + ) + + m.SetSessionToken( + SessionTokenToGRPCMessage(r.GetSessionToken()), + ) + + m.SetBearerToken( + BearerTokenToGRPCMessage(r.GetBearerToken()), + ) + + m.SetOrigin( + RequestMetaHeaderToGRPCMessage(r.GetOrigin()), + ) + + xHeaders := r.GetXHeaders() + xHdrMsg := make([]*service.XHeader, 0, len(xHeaders)) + + for i := range xHeaders { + xHdrMsg = append(xHdrMsg, XHeaderToGRPCMessage(xHeaders[i])) + } + + return m +} + +func RequestMetaHeaderFromGRPCMessage(m *service.RequestMetaHeader) *RequestMetaHeader { + if m == nil { + return nil + } + + r := new(RequestMetaHeader) + + r.SetTTL(m.GetTtl()) + r.SetEpoch(m.GetEpoch()) + + r.SetVersion( + VersionFromGRPCMessage(m.GetVersion()), + ) + + r.SetSessionToken( + SessionTokenFromGRPCMessage(m.GetSessionToken()), + ) + + r.SetBearerToken( + BearerTokenFromGRPCMessage(m.GetBearerToken()), + ) + + r.SetOrigin( + RequestMetaHeaderFromGRPCMessage(m.GetOrigin()), + ) + + xHdrMsg := m.GetXHeaders() + xHeaders := make([]*XHeader, 0, len(xHdrMsg)) + + for i := range xHdrMsg { + xHeaders = append(xHeaders, XHeaderFromGRPCMessage(xHdrMsg[i])) + } + + return r +} + +func OwnerIDToGRPCMessage(o *OwnerID) *refs.OwnerID { + if o == nil { + return nil + } + + m := new(refs.OwnerID) + + m.SetValue(o.GetValue()) + + return m +} + +func OwnerIDFromGRPCMessage(m *refs.OwnerID) *OwnerID { + if m == nil { + return nil + } + + o := new(OwnerID) + + o.SetValue(m.GetValue()) + + return o +} + +func BalanceRequestBodyToGRPCMessage(b *BalanceRequestBody) *accounting.BalanceRequest_Body { + if b == nil { + return nil + } + + m := new(accounting.BalanceRequest_Body) + + m.SetOwnerId( + OwnerIDToGRPCMessage(b.GetOwnerID()), + ) + + return m +} + +func BalanceRequestBodyFromGRPCMessage(m *accounting.BalanceRequest_Body) *BalanceRequestBody { + if m == nil { + return nil + } + + b := new(BalanceRequestBody) + + b.SetOwnerID( + OwnerIDFromGRPCMessage(m.GetOwnerId()), + ) + + return b +} + +func headersToGRPC( + src interface { + GetRequestMetaHeader() *RequestMetaHeader + GetRequestVerificationHeader() *RequestVerificationHeader + }, + dst interface { + SetMetaHeader(*service.RequestMetaHeader) + SetVerifyHeader(*service.RequestVerificationHeader) + }, +) { + dst.SetMetaHeader( + RequestMetaHeaderToGRPCMessage(src.GetRequestMetaHeader()), + ) + + dst.SetVerifyHeader( + RequestVerificationHeaderToGRPCMessage(src.GetRequestVerificationHeader()), + ) +} + +func headersFromGRPC( + src interface { + GetMetaHeader() *service.RequestMetaHeader + GetVerifyHeader() *service.RequestVerificationHeader + }, + dst interface { + SetRequestMetaHeader(*RequestMetaHeader) + SetRequestVerificationHeader(*RequestVerificationHeader) + }, +) { + dst.SetRequestMetaHeader( + RequestMetaHeaderFromGRPCMessage(src.GetMetaHeader()), + ) + + dst.SetRequestVerificationHeader( + RequestVerificationHeaderFromGRPCMessage(src.GetVerifyHeader()), + ) +} + +func BalanceRequestToGRPCMessage(b *BalanceRequest) *accounting.BalanceRequest { + if b == nil { + return nil + } + + m := new(accounting.BalanceRequest) + + m.SetBody( + BalanceRequestBodyToGRPCMessage(b.GetBody()), + ) + + headersToGRPC(b, m) + + return m +} + +func BalanceRequestFromGRPCMessage(m *accounting.BalanceRequest) *BalanceRequest { + if m == nil { + return nil + } + + b := new(BalanceRequest) + + b.SetBody( + BalanceRequestBodyFromGRPCMessage(m.GetBody()), + ) + + headersFromGRPC(m, b) + + return b +} diff --git a/v2/service.go b/v2/service.go new file mode 100644 index 0000000..55a3947 --- /dev/null +++ b/v2/service.go @@ -0,0 +1,331 @@ +package v2 + +type Signature struct { + key, sign []byte +} + +type Version struct { + major, minor uint32 +} + +type XHeader struct { + key, val string +} + +type SessionToken struct { + // TODO: fill me +} + +type BearerToken struct { + // TODO: fill me +} + +type RequestVerificationHeader struct { + bodySig, metaSig, originSig *Signature + + origin *RequestVerificationHeader +} + +type RequestMetaHeader struct { + version *Version + + ttl uint32 + + epoch uint64 + + xHeaders []*XHeader + + sessionToken *SessionToken + + bearerToken *BearerToken + + origin *RequestMetaHeader +} + +type OwnerID struct { + val []byte +} + +func (s *Signature) GetKey() []byte { + if s != nil { + return s.key + } + + return nil +} + +func (s *Signature) SetKey(v []byte) { + if s != nil { + s.key = v + } +} + +func (s *Signature) GetSign() []byte { + if s != nil { + return s.sign + } + + return nil +} + +func (s *Signature) SetSign(v []byte) { + if s != nil { + s.sign = v + } +} + +func (v *Version) GetMajor() uint32 { + if v != nil { + return v.major + } + + return 0 +} + +func (v *Version) SetMajor(val uint32) { + if v != nil { + v.major = val + } +} + +func (v *Version) GetMinor() uint32 { + if v != nil { + return v.minor + } + + return 0 +} + +func (v *Version) SetMinor(val uint32) { + if v != nil { + v.minor = val + } +} + +func (x *XHeader) GetKey() string { + if x != nil { + return x.key + } + + return "" +} + +func (x *XHeader) SetKey(v string) { + if x != nil { + x.key = v + } +} + +func (x *XHeader) GetValue() string { + if x != nil { + return x.val + } + + return "" +} + +func (x *XHeader) SetValue(v string) { + if x != nil { + x.val = v + } +} + +func (r *RequestVerificationHeader) GetBodySignature() *Signature { + if r != nil { + return r.bodySig + } + + return nil +} + +func (r *RequestVerificationHeader) SetBodySignature(v *Signature) { + if r != nil { + r.bodySig = v + } +} + +func (r *RequestVerificationHeader) GetMetaSignature() *Signature { + if r != nil { + return r.metaSig + } + + return nil +} + +func (r *RequestVerificationHeader) SetMetaSignature(v *Signature) { + if r != nil { + r.metaSig = v + } +} + +func (r *RequestVerificationHeader) GetOriginSignature() *Signature { + if r != nil { + return r.originSig + } + + return nil +} + +func (r *RequestVerificationHeader) SetOriginSignature(v *Signature) { + if r != nil { + r.originSig = v + } +} + +func (r *RequestVerificationHeader) GetOrigin() *RequestVerificationHeader { + if r != nil { + return r.origin + } + + return nil +} + +func (r *RequestVerificationHeader) SetOrigin(v *RequestVerificationHeader) { + if r != nil { + r.origin = v + } +} + +func (r *RequestVerificationHeader) StableMarshal(buf []byte) ([]byte, error) { + if r == nil { + return nil, nil + } + + // TODO: do not use hack + _, err := RequestVerificationHeaderToGRPCMessage(r).MarshalTo(buf) + + return buf, err +} + +func (r *RequestVerificationHeader) StableSize() int { + // TODO: do not use hack + return RequestVerificationHeaderToGRPCMessage(r).Size() +} + +func (r *RequestMetaHeader) GetVersion() *Version { + if r != nil { + return r.version + } + + return nil +} + +func (r *RequestMetaHeader) SetVersion(v *Version) { + if r != nil { + r.version = v + } +} + +func (r *RequestMetaHeader) GetTTL() uint32 { + if r != nil { + return r.ttl + } + + return 0 +} + +func (r *RequestMetaHeader) SetTTL(v uint32) { + if r != nil { + r.ttl = v + } +} + +func (r *RequestMetaHeader) GetEpoch() uint64 { + if r != nil { + return r.epoch + } + + return 0 +} + +func (r *RequestMetaHeader) SetEpoch(v uint64) { + if r != nil { + r.epoch = v + } +} + +func (r *RequestMetaHeader) GetXHeaders() []*XHeader { + if r != nil { + return r.xHeaders + } + + return nil +} + +func (r *RequestMetaHeader) SetXHeaders(v []*XHeader) { + if r != nil { + r.xHeaders = v + } +} + +func (r *RequestMetaHeader) GetSessionToken() *SessionToken { + if r != nil { + return r.sessionToken + } + + return nil +} + +func (r *RequestMetaHeader) SetSessionToken(v *SessionToken) { + if r != nil { + r.sessionToken = v + } +} + +func (r *RequestMetaHeader) GetBearerToken() *BearerToken { + if r != nil { + return r.bearerToken + } + + return nil +} + +func (r *RequestMetaHeader) SetBearerToken(v *BearerToken) { + if r != nil { + r.bearerToken = v + } +} + +func (r *RequestMetaHeader) GetOrigin() *RequestMetaHeader { + if r != nil { + return r.origin + } + + return nil +} + +func (r *RequestMetaHeader) SetOrigin(v *RequestMetaHeader) { + if r != nil { + r.origin = v + } +} + +func (r *RequestMetaHeader) StableMarshal(buf []byte) ([]byte, error) { + if r == nil { + return nil, nil + } + + // TODO: do not use hack + _, err := RequestMetaHeaderToGRPCMessage(r).MarshalTo(buf) + + return buf, err +} + +func (r *RequestMetaHeader) StableSize() int { + // TODO: do not use hack + return RequestMetaHeaderToGRPCMessage(r).Size() +} + +func (o *OwnerID) GetValue() []byte { + if o != nil { + return o.val + } + + return nil +} + +func (o *OwnerID) SetValue(v []byte) { + if o != nil { + o.val = v + } +} diff --git a/v2/signature/sign.go b/v2/signature/sign.go new file mode 100644 index 0000000..79fef30 --- /dev/null +++ b/v2/signature/sign.go @@ -0,0 +1,137 @@ +package signature + +import ( + "crypto/ecdsa" + "fmt" + + "github.com/nspcc-dev/neofs-api-go/util/signature" + v2 "github.com/nspcc-dev/neofs-api-go/v2" + "github.com/pkg/errors" +) + +type SignedRequest interface { + GetRequestMetaHeader() *v2.RequestMetaHeader + GetRequestVerificationHeader() *v2.RequestVerificationHeader + SetRequestVerificationHeader(*v2.RequestVerificationHeader) +} + +type stableMarshaler interface { + StableMarshal([]byte) ([]byte, error) + StableSize() int +} + +type stableMarshalerWrapper struct { + sm stableMarshaler +} + +func (s stableMarshalerWrapper) ReadSignedData(buf []byte) ([]byte, error) { + return s.sm.StableMarshal(buf) +} + +func (s stableMarshalerWrapper) SignedDataSize() int { + return s.sm.StableSize() +} + +func keySignatureHandler(s *v2.Signature) signature.KeySignatureHandler { + return func(key []byte, sig []byte) { + s.SetKey(key) + s.SetSign(sig) + } +} + +func keySignatureSource(s *v2.Signature) signature.KeySignatureSource { + return func() ([]byte, []byte) { + return s.GetKey(), s.GetSign() + } +} + +func requestBody(req SignedRequest) stableMarshaler { + switch v := req.(type) { + case *v2.BalanceRequest: + return v.GetBody() + default: + panic(fmt.Sprintf("unknown request %T", req)) + } +} + +func SignRequest(key *ecdsa.PrivateKey, req SignedRequest) error { + if req == nil { + return nil + } + + // create new level of matryoshka + verifyHdr := new(v2.RequestVerificationHeader) + + // attach the previous matryoshka + verifyHdr.SetOrigin(req.GetRequestVerificationHeader()) + + // sign request body + if err := signRequestPart(key, requestBody(req), verifyHdr.SetBodySignature); err != nil { + return errors.Wrap(err, "could not sign request body") + } + + // sign meta header + if err := signRequestPart(key, req.GetRequestMetaHeader(), verifyHdr.SetMetaSignature); err != nil { + return errors.Wrap(err, "could not sign request meta header") + } + + // sign verification header origin + if err := signRequestPart(key, verifyHdr.GetOrigin(), verifyHdr.SetOriginSignature); err != nil { + return errors.Wrap(err, "could not sign origin of request verification header") + } + + // make a new top of the matryoshka + req.SetRequestVerificationHeader(verifyHdr) + + return nil +} + +func signRequestPart(key *ecdsa.PrivateKey, part stableMarshaler, sigWrite func(*v2.Signature)) error { + sig := new(v2.Signature) + + // sign part + if err := signature.SignDataWithHandler( + key, + &stableMarshalerWrapper{part}, + keySignatureHandler(sig), + ); err != nil { + return err + } + + // write part signature + sigWrite(sig) + + return nil +} + +func VerifyRequest(req SignedRequest) error { + verifyHdr := req.GetRequestVerificationHeader() + + // verify body signature + if err := verifyRequestPart(requestBody(req), verifyHdr.GetBodySignature); err != nil { + return errors.Wrap(err, "could not verify request body") + } + + // verify meta header + if err := verifyRequestPart(req.GetRequestMetaHeader(), verifyHdr.GetMetaSignature); err != nil { + return errors.Wrap(err, "could not verify request meta header") + } + + // verify verification header origin + if err := verifyRequestPart(verifyHdr.GetOrigin(), verifyHdr.GetOriginSignature); err != nil { + return errors.Wrap(err, "could not verify origin of request verification header") + } + + return nil +} + +func verifyRequestPart(part stableMarshaler, sigRdr func() *v2.Signature) error { + if err := signature.VerifyDataWithSource( + &stableMarshalerWrapper{part}, + keySignatureSource(sigRdr()), + ); err != nil { + return err + } + + return nil +} From 60e9c3d0d3cfcf4188925c7fa0f0efa7d9a4bfb6 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Fri, 14 Aug 2020 19:00:16 +0300 Subject: [PATCH 0277/1196] Update structure with grpc subdir Signed-off-by: Alex Vanin --- prepare.sh | 11 +- v2/{ => accounting}/accounting.go | 25 +- v2/accounting/convert.go | 106 ++++ v2/accounting/{ => grpc}/service.go | 4 +- v2/accounting/{ => grpc}/service.pb.go | 158 +++--- v2/acl/{ => grpc}/types.go | 2 +- v2/acl/{ => grpc}/types.pb.go | 123 ++-- v2/container/{ => grpc}/marshal.go | 0 v2/container/{ => grpc}/marshal_test.go | 4 +- v2/container/{ => grpc}/service.go | 6 +- v2/container/{ => grpc}/service.pb.go | 530 +++++++++--------- v2/container/{ => grpc}/signature.go | 0 v2/container/{ => grpc}/types.go | 4 +- v2/container/{ => grpc}/types.pb.go | 80 +-- v2/convert.go | 350 ------------ v2/netmap/{ => grpc}/marshal.go | 0 v2/netmap/{ => grpc}/types.go | 0 v2/netmap/{ => grpc}/types.pb.go | 112 ++-- v2/object/{ => grpc}/service.go | 4 +- v2/object/{ => grpc}/service.pb.go | 716 ++++++++++++------------ v2/object/{ => grpc}/types.go | 4 +- v2/object/{ => grpc}/types.pb.go | 173 +++--- v2/refs/convert.go | 29 + v2/refs/{ => grpc}/marshal.go | 0 v2/refs/{ => grpc}/marshal_test.go | 0 v2/refs/{ => grpc}/types.go | 0 v2/refs/{ => grpc}/types.pb.go | 50 +- v2/refs/owner.go | 19 + v2/service/convert.go | 201 +++++++ v2/service/{ => grpc}/meta.go | 4 +- v2/service/{ => grpc}/meta.pb.go | 158 +++--- v2/service/{ => grpc}/verify.go | 0 v2/service/{ => grpc}/verify.pb.go | 64 +-- v2/service/{ => grpc}/version.go | 0 v2/{ => service}/service.go | 36 +- v2/session/{ => grpc}/service.go | 4 +- v2/session/{ => grpc}/service.pb.go | 161 +++--- v2/signature/sign.go | 23 +- v2/storagegroup/{ => grpc}/types.go | 2 +- v2/storagegroup/{ => grpc}/types.pb.go | 56 +- 40 files changed, 1624 insertions(+), 1595 deletions(-) rename v2/{ => accounting}/accounting.go (57%) create mode 100644 v2/accounting/convert.go rename v2/accounting/{ => grpc}/service.go (92%) rename v2/accounting/{ => grpc}/service.pb.go (84%) rename v2/acl/{ => grpc}/types.go (97%) rename v2/acl/{ => grpc}/types.pb.go (87%) rename v2/container/{ => grpc}/marshal.go (100%) rename v2/container/{ => grpc}/marshal_test.go (92%) rename v2/container/{ => grpc}/service.go (97%) rename v2/container/{ => grpc}/service.pb.go (88%) rename v2/container/{ => grpc}/signature.go (100%) rename v2/container/{ => grpc}/types.go (89%) rename v2/container/{ => grpc}/types.pb.go (84%) rename v2/netmap/{ => grpc}/marshal.go (100%) rename v2/netmap/{ => grpc}/types.go (100%) rename v2/netmap/{ => grpc}/types.pb.go (92%) rename v2/object/{ => grpc}/service.go (99%) rename v2/object/{ => grpc}/service.pb.go (89%) rename v2/object/{ => grpc}/types.go (96%) rename v2/object/{ => grpc}/types.pb.go (86%) create mode 100644 v2/refs/convert.go rename v2/refs/{ => grpc}/marshal.go (100%) rename v2/refs/{ => grpc}/marshal_test.go (100%) rename v2/refs/{ => grpc}/types.go (100%) rename v2/refs/{ => grpc}/types.pb.go (91%) create mode 100644 v2/refs/owner.go create mode 100644 v2/service/convert.go rename v2/service/{ => grpc}/meta.go (97%) rename v2/service/{ => grpc}/meta.pb.go (91%) rename v2/service/{ => grpc}/verify.go (100%) rename v2/service/{ => grpc}/verify.pb.go (91%) rename v2/service/{ => grpc}/version.go (100%) rename v2/{ => service}/service.go (91%) rename v2/session/{ => grpc}/service.go (93%) rename v2/session/{ => grpc}/service.pb.go (83%) rename v2/storagegroup/{ => grpc}/types.go (93%) rename v2/storagegroup/{ => grpc}/types.pb.go (82%) diff --git a/prepare.sh b/prepare.sh index 5962123..c0e4a37 100755 --- a/prepare.sh +++ b/prepare.sh @@ -16,13 +16,16 @@ cd $API_PATH ARGS=$(find ./ -name '*.proto' -not -path './vendor/*') for file in $ARGS; do dir=$(dirname $file) - cp -r $dir $API_GO_PATH/$prefix + mkdir -p $API_GO_PATH/$prefix/$dir/grpc + cp -r $dir/* $API_GO_PATH/$prefix/$dir/grpc done # MODIFY FILES cd $API_GO_PATH/$prefix -for file in $ARGS; do - sed -i "s/import\ \"\(.*\)\";/import\ \"$prefix\/\1\";/" $file +ARGS2=$(find ./ -name '*.proto') +for file in $ARGS2; do + echo $file + sed -i "s/import\ \"\(.*\)\/\(.*\)\.proto\";/import\ \"$prefix\/\1\/grpc\/\2\.proto\";/" $file done cd $API_GO_PATH @@ -30,7 +33,7 @@ cd $API_GO_PATH make protoc # REMOVE PROTO DEFINITIONS -ARGS=$(find ./ -name '*.proto' -not -path './vendor/*') +ARGS=$(find ./$prefix -name '*.proto' -not -path './vendor/*') for file in $ARGS; do rm $file done diff --git a/v2/accounting.go b/v2/accounting/accounting.go similarity index 57% rename from v2/accounting.go rename to v2/accounting/accounting.go index a14e5a1..a49f79b 100644 --- a/v2/accounting.go +++ b/v2/accounting/accounting.go @@ -1,18 +1,23 @@ -package v2 +package accounting + +import ( + "github.com/nspcc-dev/neofs-api-go/v2/refs" + "github.com/nspcc-dev/neofs-api-go/v2/service" +) type BalanceRequestBody struct { - ownerID *OwnerID + ownerID *refs.OwnerID } type BalanceRequest struct { body *BalanceRequestBody - metaHeader *RequestMetaHeader + metaHeader *service.RequestMetaHeader - verifyHeader *RequestVerificationHeader + verifyHeader *service.RequestVerificationHeader } -func (b *BalanceRequestBody) GetOwnerID() *OwnerID { +func (b *BalanceRequestBody) GetOwnerID() *refs.OwnerID { if b != nil { return b.ownerID } @@ -20,7 +25,7 @@ func (b *BalanceRequestBody) GetOwnerID() *OwnerID { return nil } -func (b *BalanceRequestBody) SetOwnerID(v *OwnerID) { +func (b *BalanceRequestBody) SetOwnerID(v *refs.OwnerID) { if b != nil { b.ownerID = v } @@ -56,7 +61,7 @@ func (b *BalanceRequest) SetBody(v *BalanceRequestBody) { } } -func (b *BalanceRequest) GetRequestMetaHeader() *RequestMetaHeader { +func (b *BalanceRequest) GetRequestMetaHeader() *service.RequestMetaHeader { if b != nil { return b.metaHeader } @@ -64,13 +69,13 @@ func (b *BalanceRequest) GetRequestMetaHeader() *RequestMetaHeader { return nil } -func (b *BalanceRequest) SetRequestMetaHeader(v *RequestMetaHeader) { +func (b *BalanceRequest) SetRequestMetaHeader(v *service.RequestMetaHeader) { if b != nil { b.metaHeader = v } } -func (b *BalanceRequest) GetRequestVerificationHeader() *RequestVerificationHeader { +func (b *BalanceRequest) GetRequestVerificationHeader() *service.RequestVerificationHeader { if b != nil { return b.verifyHeader } @@ -78,7 +83,7 @@ func (b *BalanceRequest) GetRequestVerificationHeader() *RequestVerificationHead return nil } -func (b *BalanceRequest) SetRequestVerificationHeader(v *RequestVerificationHeader) { +func (b *BalanceRequest) SetRequestVerificationHeader(v *service.RequestVerificationHeader) { if b != nil { b.verifyHeader = v } diff --git a/v2/accounting/convert.go b/v2/accounting/convert.go new file mode 100644 index 0000000..9f04943 --- /dev/null +++ b/v2/accounting/convert.go @@ -0,0 +1,106 @@ +package accounting + +import ( + accounting "github.com/nspcc-dev/neofs-api-go/v2/accounting/grpc" + "github.com/nspcc-dev/neofs-api-go/v2/refs" + "github.com/nspcc-dev/neofs-api-go/v2/service" + grpcService "github.com/nspcc-dev/neofs-api-go/v2/service/grpc" +) + +func BalanceRequestBodyToGRPCMessage(b *BalanceRequestBody) *accounting.BalanceRequest_Body { + if b == nil { + return nil + } + + m := new(accounting.BalanceRequest_Body) + + m.SetOwnerId( + refs.OwnerIDToGRPCMessage(b.GetOwnerID()), + ) + + return m +} + +func BalanceRequestBodyFromGRPCMessage(m *accounting.BalanceRequest_Body) *BalanceRequestBody { + if m == nil { + return nil + } + + b := new(BalanceRequestBody) + + b.SetOwnerID( + refs.OwnerIDFromGRPCMessage(m.GetOwnerId()), + ) + + return b +} + +func headersToGRPC( + src interface { + GetRequestMetaHeader() *service.RequestMetaHeader + GetRequestVerificationHeader() *service.RequestVerificationHeader + }, + dst interface { + SetMetaHeader(*grpcService.RequestMetaHeader) + SetVerifyHeader(*grpcService.RequestVerificationHeader) + }, +) { + dst.SetMetaHeader( + service.RequestMetaHeaderToGRPCMessage(src.GetRequestMetaHeader()), + ) + + dst.SetVerifyHeader( + service.RequestVerificationHeaderToGRPCMessage(src.GetRequestVerificationHeader()), + ) +} + +func headersFromGRPC( + src interface { + GetMetaHeader() *grpcService.RequestMetaHeader + GetVerifyHeader() *grpcService.RequestVerificationHeader + }, + dst interface { + SetRequestMetaHeader(*service.RequestMetaHeader) + SetRequestVerificationHeader(*service.RequestVerificationHeader) + }, +) { + dst.SetRequestMetaHeader( + service.RequestMetaHeaderFromGRPCMessage(src.GetMetaHeader()), + ) + + dst.SetRequestVerificationHeader( + service.RequestVerificationHeaderFromGRPCMessage(src.GetVerifyHeader()), + ) +} + +func BalanceRequestToGRPCMessage(b *BalanceRequest) *accounting.BalanceRequest { + if b == nil { + return nil + } + + m := new(accounting.BalanceRequest) + + m.SetBody( + BalanceRequestBodyToGRPCMessage(b.GetBody()), + ) + + headersToGRPC(b, m) + + return m +} + +func BalanceRequestFromGRPCMessage(m *accounting.BalanceRequest) *BalanceRequest { + if m == nil { + return nil + } + + b := new(BalanceRequest) + + b.SetBody( + BalanceRequestBodyFromGRPCMessage(m.GetBody()), + ) + + headersFromGRPC(m, b) + + return b +} diff --git a/v2/accounting/service.go b/v2/accounting/grpc/service.go similarity index 92% rename from v2/accounting/service.go rename to v2/accounting/grpc/service.go index 456d0e2..0da7936 100644 --- a/v2/accounting/service.go +++ b/v2/accounting/grpc/service.go @@ -1,8 +1,8 @@ package accounting import ( - "github.com/nspcc-dev/neofs-api-go/v2/refs" - "github.com/nspcc-dev/neofs-api-go/v2/service" + refs "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" + service "github.com/nspcc-dev/neofs-api-go/v2/service/grpc" ) // SetValue sets value of the decimal number. diff --git a/v2/accounting/service.pb.go b/v2/accounting/grpc/service.pb.go similarity index 84% rename from v2/accounting/service.pb.go rename to v2/accounting/grpc/service.pb.go index f8a40e8..aa9fdbe 100644 --- a/v2/accounting/service.pb.go +++ b/v2/accounting/grpc/service.pb.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: v2/accounting/service.proto +// source: v2/accounting/grpc/service.proto package accounting @@ -7,9 +7,9 @@ import ( context "context" fmt "fmt" proto "github.com/golang/protobuf/proto" - refs "github.com/nspcc-dev/neofs-api-go/v2/refs" - service "github.com/nspcc-dev/neofs-api-go/v2/service" - grpc "google.golang.org/grpc" + grpc1 "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" + grpc "github.com/nspcc-dev/neofs-api-go/v2/service/grpc" + grpc2 "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" io "io" @@ -40,21 +40,21 @@ type BalanceRequest struct { Body *BalanceRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` // Carries request meta information. Header data is used only to regulate // message transport and does not affect request execution. - MetaHeader *service.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" json:"meta_header,omitempty"` + MetaHeader *grpc.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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 *service.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + VerifyHeader *grpc.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *BalanceRequest) Reset() { *m = BalanceRequest{} } func (m *BalanceRequest) String() string { return proto.CompactTextString(m) } func (*BalanceRequest) ProtoMessage() {} func (*BalanceRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_484f6b0e24e3172f, []int{0} + return fileDescriptor_d9dd5af2ff2bbb25, []int{0} } func (m *BalanceRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -90,14 +90,14 @@ func (m *BalanceRequest) GetBody() *BalanceRequest_Body { return nil } -func (m *BalanceRequest) GetMetaHeader() *service.RequestMetaHeader { +func (m *BalanceRequest) GetMetaHeader() *grpc.RequestMetaHeader { if m != nil { return m.MetaHeader } return nil } -func (m *BalanceRequest) GetVerifyHeader() *service.RequestVerificationHeader { +func (m *BalanceRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { if m != nil { return m.VerifyHeader } @@ -108,17 +108,17 @@ func (m *BalanceRequest) GetVerifyHeader() *service.RequestVerificationHeader { type BalanceRequest_Body struct { // Carries user identifier in NeoFS system for which the balance // is requested. - OwnerId *refs.OwnerID `protobuf:"bytes,1,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + OwnerId *grpc1.OwnerID `protobuf:"bytes,1,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *BalanceRequest_Body) Reset() { *m = BalanceRequest_Body{} } func (m *BalanceRequest_Body) String() string { return proto.CompactTextString(m) } func (*BalanceRequest_Body) ProtoMessage() {} func (*BalanceRequest_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_484f6b0e24e3172f, []int{0, 0} + return fileDescriptor_d9dd5af2ff2bbb25, []int{0, 0} } func (m *BalanceRequest_Body) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -147,7 +147,7 @@ func (m *BalanceRequest_Body) XXX_DiscardUnknown() { var xxx_messageInfo_BalanceRequest_Body proto.InternalMessageInfo -func (m *BalanceRequest_Body) GetOwnerId() *refs.OwnerID { +func (m *BalanceRequest_Body) GetOwnerId() *grpc1.OwnerID { if m != nil { return m.OwnerId } @@ -169,7 +169,7 @@ func (m *Decimal) Reset() { *m = Decimal{} } func (m *Decimal) String() string { return proto.CompactTextString(m) } func (*Decimal) ProtoMessage() {} func (*Decimal) Descriptor() ([]byte, []int) { - return fileDescriptor_484f6b0e24e3172f, []int{1} + return fileDescriptor_d9dd5af2ff2bbb25, []int{1} } func (m *Decimal) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -220,21 +220,21 @@ type BalanceResponse struct { Body *BalanceResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` // Carries response meta information. Header data is used only to regulate // message transport and does not affect request execution. - MetaHeader *service.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" json:"meta_header,omitempty"` + MetaHeader *grpc.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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 *service.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + VerifyHeader *grpc.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *BalanceResponse) Reset() { *m = BalanceResponse{} } func (m *BalanceResponse) String() string { return proto.CompactTextString(m) } func (*BalanceResponse) ProtoMessage() {} func (*BalanceResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_484f6b0e24e3172f, []int{2} + return fileDescriptor_d9dd5af2ff2bbb25, []int{2} } func (m *BalanceResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -270,14 +270,14 @@ func (m *BalanceResponse) GetBody() *BalanceResponse_Body { return nil } -func (m *BalanceResponse) GetMetaHeader() *service.ResponseMetaHeader { +func (m *BalanceResponse) GetMetaHeader() *grpc.ResponseMetaHeader { if m != nil { return m.MetaHeader } return nil } -func (m *BalanceResponse) GetVerifyHeader() *service.ResponseVerificationHeader { +func (m *BalanceResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { if m != nil { return m.VerifyHeader } @@ -297,7 +297,7 @@ func (m *BalanceResponse_Body) Reset() { *m = BalanceResponse_Body{} } func (m *BalanceResponse_Body) String() string { return proto.CompactTextString(m) } func (*BalanceResponse_Body) ProtoMessage() {} func (*BalanceResponse_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_484f6b0e24e3172f, []int{2, 0} + return fileDescriptor_d9dd5af2ff2bbb25, []int{2, 0} } func (m *BalanceResponse_Body) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -341,67 +341,67 @@ func init() { proto.RegisterType((*BalanceResponse_Body)(nil), "neo.fs.v2.accounting.BalanceResponse.Body") } -func init() { proto.RegisterFile("v2/accounting/service.proto", fileDescriptor_484f6b0e24e3172f) } +func init() { proto.RegisterFile("v2/accounting/grpc/service.proto", fileDescriptor_d9dd5af2ff2bbb25) } -var fileDescriptor_484f6b0e24e3172f = []byte{ - // 472 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x93, 0xdf, 0x6e, 0xd3, 0x30, - 0x18, 0xc5, 0x49, 0x37, 0x28, 0x78, 0x0c, 0x84, 0x19, 0xea, 0x54, 0xa0, 0x42, 0xd5, 0x26, 0x01, - 0xa2, 0x8e, 0x14, 0x2e, 0x90, 0x86, 0x06, 0x5a, 0x35, 0x26, 0x7a, 0xc1, 0xbf, 0x4c, 0xda, 0x05, - 0x37, 0x93, 0xeb, 0x7c, 0xe9, 0x2c, 0x5a, 0x3b, 0xc4, 0xae, 0x51, 0xdf, 0x84, 0x17, 0xe0, 0x86, - 0x0b, 0x9e, 0x83, 0x4b, 0x1e, 0x01, 0x95, 0x17, 0x41, 0xb1, 0xdd, 0x36, 0x95, 0xb2, 0xad, 0x77, - 0xb1, 0x7d, 0xce, 0xf9, 0x7c, 0x7e, 0x8a, 0xd1, 0x7d, 0x13, 0x85, 0x94, 0x31, 0x39, 0x16, 0x9a, - 0x8b, 0x41, 0xa8, 0x20, 0x37, 0x9c, 0x01, 0xc9, 0x72, 0xa9, 0x25, 0xde, 0x12, 0x20, 0x49, 0xaa, - 0x88, 0x89, 0xc8, 0x42, 0xd3, 0xbc, 0x6b, 0xa2, 0x30, 0x87, 0x54, 0x85, 0x7a, 0x92, 0x81, 0x72, - 0xd2, 0xe6, 0x3d, 0x13, 0xcd, 0xcc, 0xe1, 0x08, 0x34, 0xf5, 0xdb, 0x8d, 0xd2, 0xb6, 0x81, 0x9c, - 0xa7, 0x13, 0x77, 0xd0, 0xfe, 0x51, 0x43, 0xb7, 0xba, 0x74, 0x48, 0x05, 0x83, 0x18, 0xbe, 0x8e, - 0x41, 0x69, 0xbc, 0x8f, 0xd6, 0xfb, 0x32, 0x99, 0x6c, 0x07, 0x8f, 0x82, 0xc7, 0x1b, 0xd1, 0x13, - 0x52, 0x35, 0x9c, 0x2c, 0x7b, 0x48, 0x57, 0x26, 0x93, 0xd8, 0xda, 0xf0, 0x1b, 0xb4, 0x51, 0x0c, - 0x3e, 0x3d, 0x03, 0x9a, 0x40, 0xbe, 0x5d, 0xb3, 0x29, 0x3b, 0xa5, 0x94, 0x59, 0x37, 0xef, 0x7d, - 0x07, 0x9a, 0xbe, 0xb5, 0xda, 0x18, 0x8d, 0xe6, 0xdf, 0xf8, 0x13, 0xda, 0x74, 0x17, 0x9d, 0x05, - 0xad, 0xd9, 0xa0, 0x67, 0xe7, 0x07, 0x9d, 0x14, 0x72, 0xce, 0xa8, 0xe6, 0x52, 0xf8, 0xc0, 0x9b, - 0x2e, 0xc2, 0xad, 0x9a, 0x7b, 0x68, 0xbd, 0xb8, 0x27, 0x8e, 0xd0, 0x75, 0xf9, 0x4d, 0x40, 0x7e, - 0xca, 0x13, 0x5f, 0xb2, 0x51, 0x4a, 0x2d, 0x90, 0x92, 0x0f, 0xc5, 0x79, 0xef, 0x30, 0xae, 0x5b, - 0x61, 0x2f, 0x69, 0xef, 0xa3, 0xfa, 0x21, 0x30, 0x3e, 0xa2, 0x43, 0xbc, 0x85, 0xae, 0x1a, 0x3a, - 0x1c, 0x83, 0xf5, 0xae, 0xc5, 0x6e, 0x81, 0x1f, 0xa0, 0x1b, 0x59, 0x0e, 0x8c, 0x2b, 0x2e, 0x85, - 0x2d, 0xbd, 0x19, 0x2f, 0x36, 0xda, 0xbf, 0x6a, 0xe8, 0xf6, 0x1c, 0x99, 0xca, 0xa4, 0x50, 0x80, - 0x5f, 0x2d, 0x71, 0x7e, 0x7a, 0x09, 0x67, 0x67, 0x2a, 0x83, 0x3e, 0xaa, 0x02, 0xbd, 0x5b, 0xc9, - 0xc7, 0x99, 0xcf, 0x21, 0x1d, 0x57, 0x93, 0xee, 0x5c, 0x90, 0x74, 0x29, 0xea, 0xd7, 0x1e, 0xf5, - 0x0b, 0x54, 0xef, 0xbb, 0x06, 0xbe, 0xe6, 0xc3, 0xea, 0x9a, 0x9e, 0x6d, 0x3c, 0x53, 0x47, 0x5f, - 0xd0, 0x9d, 0x83, 0xf9, 0xf1, 0xb1, 0x1b, 0x8f, 0x4f, 0x50, 0xdd, 0xf3, 0xc0, 0x3b, 0xab, 0xfc, - 0x96, 0xcd, 0xdd, 0x95, 0xa0, 0x76, 0xd3, 0xdf, 0xd3, 0x56, 0xf0, 0x67, 0xda, 0x0a, 0xfe, 0x4e, - 0x5b, 0xc1, 0xf7, 0x7f, 0xad, 0x2b, 0x9f, 0xf7, 0x06, 0x5c, 0x9f, 0x8d, 0xfb, 0x84, 0xc9, 0x51, - 0x28, 0x54, 0xc6, 0x58, 0x27, 0x01, 0x13, 0x0a, 0x90, 0xa9, 0xea, 0xd0, 0x8c, 0x77, 0x06, 0x32, - 0x5c, 0x7a, 0xb0, 0x2f, 0x17, 0x9f, 0x3f, 0x6b, 0x8d, 0xf7, 0x20, 0x8f, 0x8e, 0xc9, 0xc1, 0xc7, - 0x5e, 0x31, 0x77, 0x51, 0xa3, 0x7f, 0xcd, 0xbe, 0xb9, 0xe7, 0xff, 0x03, 0x00, 0x00, 0xff, 0xff, - 0x1e, 0x24, 0x48, 0xec, 0xed, 0x03, 0x00, 0x00, +var fileDescriptor_d9dd5af2ff2bbb25 = []byte{ + // 478 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x93, 0x4f, 0x6e, 0x13, 0x31, + 0x18, 0xc5, 0x99, 0xb4, 0x10, 0x70, 0x29, 0x08, 0xab, 0x52, 0xa3, 0x51, 0x89, 0xaa, 0xa8, 0x95, + 0x00, 0x11, 0x8f, 0x34, 0x2c, 0x90, 0x40, 0xa5, 0x6a, 0x54, 0x2a, 0xb2, 0xe0, 0xdf, 0x54, 0xea, + 0x82, 0x4d, 0xe5, 0x78, 0xbe, 0xa4, 0x56, 0x13, 0x7b, 0x18, 0x3b, 0x46, 0xb9, 0x09, 0x17, 0x60, + 0xc3, 0x82, 0x73, 0xb0, 0xe4, 0x08, 0x28, 0x5c, 0x04, 0x8d, 0xed, 0x64, 0x52, 0x98, 0xb6, 0xd9, + 0xc5, 0xf9, 0xde, 0x7b, 0xfe, 0xde, 0x4f, 0x63, 0xb4, 0x6d, 0xe2, 0x88, 0x32, 0x26, 0xc7, 0x42, + 0x73, 0x31, 0x88, 0x06, 0x79, 0xc6, 0x22, 0x05, 0xb9, 0xe1, 0x0c, 0x48, 0x96, 0x4b, 0x2d, 0xf1, + 0x86, 0x00, 0x49, 0xfa, 0x8a, 0x98, 0x98, 0x94, 0xc2, 0xb0, 0x61, 0xe2, 0x28, 0x87, 0xbe, 0x72, + 0x0e, 0x3d, 0xc9, 0x40, 0x39, 0x7d, 0x18, 0x9a, 0x78, 0x96, 0xe0, 0x86, 0x23, 0xd0, 0xd4, 0xcf, + 0xb6, 0xfe, 0x9d, 0x19, 0xc8, 0x79, 0x7f, 0xe2, 0xa6, 0xad, 0x6f, 0x35, 0x74, 0xaf, 0x43, 0x87, + 0x54, 0x30, 0x48, 0xe0, 0xf3, 0x18, 0x94, 0xc6, 0x7b, 0x68, 0xb5, 0x27, 0xd3, 0x49, 0x23, 0xd8, + 0x0e, 0x1e, 0xad, 0xc5, 0x8f, 0x49, 0xd5, 0x2e, 0xe4, 0xa2, 0x87, 0x74, 0x64, 0x3a, 0x49, 0xac, + 0x0d, 0xbf, 0x46, 0x6b, 0xc5, 0xed, 0xa7, 0x67, 0x40, 0x53, 0xc8, 0x1b, 0x35, 0x9b, 0xb2, 0xb3, + 0x90, 0x32, 0xab, 0xea, 0xbd, 0x6f, 0x41, 0xd3, 0x37, 0x56, 0x9b, 0xa0, 0xd1, 0xfc, 0x37, 0xfe, + 0x88, 0xd6, 0xdd, 0xa2, 0xb3, 0xa0, 0x15, 0x1b, 0xf4, 0xf4, 0xf2, 0xa0, 0x93, 0x42, 0xce, 0x19, + 0xd5, 0x5c, 0x0a, 0x1f, 0x78, 0xd7, 0x45, 0xb8, 0x53, 0xf8, 0x02, 0xad, 0x16, 0x7b, 0xe2, 0x18, + 0xdd, 0x96, 0x5f, 0x04, 0xe4, 0xa7, 0x3c, 0xf5, 0x25, 0x37, 0x17, 0x52, 0x0b, 0xc2, 0xe4, 0x7d, + 0x31, 0xef, 0x1e, 0x26, 0x75, 0x2b, 0xec, 0xa6, 0xad, 0x3d, 0x54, 0x3f, 0x04, 0xc6, 0x47, 0x74, + 0x88, 0x37, 0xd0, 0x4d, 0x43, 0x87, 0x63, 0xb0, 0xde, 0x95, 0xc4, 0x1d, 0xf0, 0x16, 0xba, 0x93, + 0xe5, 0xc0, 0xb8, 0xe2, 0x52, 0xd8, 0xd2, 0xeb, 0x49, 0xf9, 0x47, 0xeb, 0x47, 0x0d, 0xdd, 0x9f, + 0x23, 0x53, 0x99, 0x14, 0x0a, 0xf0, 0xab, 0x0b, 0x9c, 0x9f, 0x5c, 0xc3, 0xd9, 0x99, 0x16, 0x41, + 0x1f, 0x55, 0x81, 0xde, 0xad, 0xe4, 0xe3, 0xcc, 0x97, 0x90, 0x4e, 0xaa, 0x49, 0xb7, 0xaf, 0x48, + 0xba, 0x16, 0xf5, 0xbe, 0x47, 0xfd, 0x1c, 0xd5, 0x7b, 0xae, 0x81, 0xaf, 0xf9, 0xb0, 0xba, 0xa6, + 0x67, 0x9b, 0xcc, 0xd4, 0xf1, 0x39, 0x7a, 0x70, 0x30, 0x1f, 0x1f, 0xbb, 0xeb, 0xf1, 0x09, 0xaa, + 0x7b, 0x1e, 0x78, 0x67, 0x99, 0xcf, 0x32, 0xdc, 0x5d, 0x0a, 0x6a, 0xe7, 0xfc, 0xe7, 0xb4, 0x19, + 0xfc, 0x9a, 0x36, 0x83, 0xdf, 0xd3, 0x66, 0xf0, 0xf5, 0x4f, 0xf3, 0xc6, 0xa7, 0xfd, 0x01, 0xd7, + 0x67, 0xe3, 0x1e, 0x61, 0x72, 0x14, 0x09, 0x95, 0x31, 0xd6, 0x4e, 0xc1, 0x44, 0x02, 0x64, 0x5f, + 0xb5, 0x69, 0xc6, 0xdb, 0x03, 0x19, 0xfd, 0xff, 0x88, 0x5f, 0x96, 0xe7, 0xef, 0xb5, 0xcd, 0x77, + 0x20, 0x8f, 0x8e, 0xc9, 0xc1, 0x87, 0x6e, 0x71, 0x79, 0xd9, 0xa5, 0x77, 0xcb, 0x3e, 0xbc, 0x67, + 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, 0x34, 0x56, 0xa2, 0x45, 0x06, 0x04, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. var _ context.Context -var _ grpc.ClientConn +var _ grpc2.ClientConn // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 +const _ = grpc2.SupportPackageIsVersion4 // AccountingServiceClient is the client API for AccountingService service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type AccountingServiceClient interface { // Returns the amount of funds for the requested NeoFS account. - Balance(ctx context.Context, in *BalanceRequest, opts ...grpc.CallOption) (*BalanceResponse, error) + Balance(ctx context.Context, in *BalanceRequest, opts ...grpc2.CallOption) (*BalanceResponse, error) } type accountingServiceClient struct { - cc *grpc.ClientConn + cc *grpc2.ClientConn } -func NewAccountingServiceClient(cc *grpc.ClientConn) AccountingServiceClient { +func NewAccountingServiceClient(cc *grpc2.ClientConn) AccountingServiceClient { return &accountingServiceClient{cc} } -func (c *accountingServiceClient) Balance(ctx context.Context, in *BalanceRequest, opts ...grpc.CallOption) (*BalanceResponse, error) { +func (c *accountingServiceClient) Balance(ctx context.Context, in *BalanceRequest, opts ...grpc2.CallOption) (*BalanceResponse, error) { out := new(BalanceResponse) err := c.cc.Invoke(ctx, "/neo.fs.v2.accounting.AccountingService/Balance", in, out, opts...) if err != nil { @@ -424,11 +424,11 @@ func (*UnimplementedAccountingServiceServer) Balance(ctx context.Context, req *B return nil, status.Errorf(codes.Unimplemented, "method Balance not implemented") } -func RegisterAccountingServiceServer(s *grpc.Server, srv AccountingServiceServer) { +func RegisterAccountingServiceServer(s *grpc2.Server, srv AccountingServiceServer) { s.RegisterService(&_AccountingService_serviceDesc, srv) } -func _AccountingService_Balance_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _AccountingService_Balance_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc2.UnaryServerInterceptor) (interface{}, error) { in := new(BalanceRequest) if err := dec(in); err != nil { return nil, err @@ -436,7 +436,7 @@ func _AccountingService_Balance_Handler(srv interface{}, ctx context.Context, de if interceptor == nil { return srv.(AccountingServiceServer).Balance(ctx, in) } - info := &grpc.UnaryServerInfo{ + info := &grpc2.UnaryServerInfo{ Server: srv, FullMethod: "/neo.fs.v2.accounting.AccountingService/Balance", } @@ -446,17 +446,17 @@ func _AccountingService_Balance_Handler(srv interface{}, ctx context.Context, de return interceptor(ctx, in, info, handler) } -var _AccountingService_serviceDesc = grpc.ServiceDesc{ +var _AccountingService_serviceDesc = grpc2.ServiceDesc{ ServiceName: "neo.fs.v2.accounting.AccountingService", HandlerType: (*AccountingServiceServer)(nil), - Methods: []grpc.MethodDesc{ + Methods: []grpc2.MethodDesc{ { MethodName: "Balance", Handler: _AccountingService_Balance_Handler, }, }, - Streams: []grpc.StreamDesc{}, - Metadata: "v2/accounting/service.proto", + Streams: []grpc2.StreamDesc{}, + Metadata: "v2/accounting/grpc/service.proto", } func (m *BalanceRequest) Marshal() (dAtA []byte, err error) { @@ -910,7 +910,7 @@ func (m *BalanceRequest) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.MetaHeader == nil { - m.MetaHeader = &service.RequestMetaHeader{} + m.MetaHeader = &grpc.RequestMetaHeader{} } if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -946,7 +946,7 @@ func (m *BalanceRequest) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.VerifyHeader == nil { - m.VerifyHeader = &service.RequestVerificationHeader{} + m.VerifyHeader = &grpc.RequestVerificationHeader{} } if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -1036,7 +1036,7 @@ func (m *BalanceRequest_Body) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.OwnerId == nil { - m.OwnerId = &refs.OwnerID{} + m.OwnerId = &grpc1.OwnerID{} } if err := m.OwnerId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -1254,7 +1254,7 @@ func (m *BalanceResponse) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.MetaHeader == nil { - m.MetaHeader = &service.ResponseMetaHeader{} + m.MetaHeader = &grpc.ResponseMetaHeader{} } if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -1290,7 +1290,7 @@ func (m *BalanceResponse) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.VerifyHeader == nil { - m.VerifyHeader = &service.ResponseVerificationHeader{} + m.VerifyHeader = &grpc.ResponseVerificationHeader{} } if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err diff --git a/v2/acl/types.go b/v2/acl/grpc/types.go similarity index 97% rename from v2/acl/types.go rename to v2/acl/grpc/types.go index 6374787..3091259 100644 --- a/v2/acl/types.go +++ b/v2/acl/grpc/types.go @@ -1,7 +1,7 @@ package acl import ( - "github.com/nspcc-dev/neofs-api-go/v2/refs" + refs "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" ) // SetContainerId sets container identifier of the eACL table. diff --git a/v2/acl/types.pb.go b/v2/acl/grpc/types.pb.go similarity index 87% rename from v2/acl/types.pb.go rename to v2/acl/grpc/types.pb.go index 0425329..bba96ad 100644 --- a/v2/acl/types.pb.go +++ b/v2/acl/grpc/types.pb.go @@ -1,12 +1,12 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: v2/acl/types.proto +// source: v2/acl/grpc/types.proto package acl import ( fmt "fmt" proto "github.com/golang/protobuf/proto" - refs "github.com/nspcc-dev/neofs-api-go/v2/refs" + grpc "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" io "io" math "math" math_bits "math/bits" @@ -57,7 +57,7 @@ func (x Target) String() string { } func (Target) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_d237ab7979f0d6cf, []int{0} + return fileDescriptor_8233b6696fb3e24f, []int{0} } // Operation is an enumeration of operation types. @@ -109,7 +109,7 @@ func (x EACLRecord_Operation) String() string { } func (EACLRecord_Operation) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_d237ab7979f0d6cf, []int{0, 0} + return fileDescriptor_8233b6696fb3e24f, []int{0, 0} } // Action is an enumeration of EACL actions. @@ -141,7 +141,7 @@ func (x EACLRecord_Action) String() string { } func (EACLRecord_Action) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_d237ab7979f0d6cf, []int{0, 1} + return fileDescriptor_8233b6696fb3e24f, []int{0, 1} } // Header is an enumeration of filtering header types. @@ -173,7 +173,7 @@ func (x EACLRecord_FilterInfo_Header) String() string { } func (EACLRecord_FilterInfo_Header) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_d237ab7979f0d6cf, []int{0, 0, 0} + return fileDescriptor_8233b6696fb3e24f, []int{0, 0, 0} } // MatchType is an enumeration of match types. @@ -205,7 +205,7 @@ func (x EACLRecord_FilterInfo_MatchType) String() string { } func (EACLRecord_FilterInfo_MatchType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_d237ab7979f0d6cf, []int{0, 0, 1} + return fileDescriptor_8233b6696fb3e24f, []int{0, 0, 1} } // EACLRecord groups information about extended ACL rule. @@ -227,7 +227,7 @@ func (m *EACLRecord) Reset() { *m = EACLRecord{} } func (m *EACLRecord) String() string { return proto.CompactTextString(m) } func (*EACLRecord) ProtoMessage() {} func (*EACLRecord) Descriptor() ([]byte, []int) { - return fileDescriptor_d237ab7979f0d6cf, []int{0} + return fileDescriptor_8233b6696fb3e24f, []int{0} } func (m *EACLRecord) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -303,7 +303,7 @@ func (m *EACLRecord_FilterInfo) Reset() { *m = EACLRecord_FilterInfo{} } func (m *EACLRecord_FilterInfo) String() string { return proto.CompactTextString(m) } func (*EACLRecord_FilterInfo) ProtoMessage() {} func (*EACLRecord_FilterInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_d237ab7979f0d6cf, []int{0, 0} + return fileDescriptor_8233b6696fb3e24f, []int{0, 0} } func (m *EACLRecord_FilterInfo) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -375,7 +375,7 @@ func (m *EACLRecord_TargetInfo) Reset() { *m = EACLRecord_TargetInfo{} } func (m *EACLRecord_TargetInfo) String() string { return proto.CompactTextString(m) } func (*EACLRecord_TargetInfo) ProtoMessage() {} func (*EACLRecord_TargetInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_d237ab7979f0d6cf, []int{0, 1} + return fileDescriptor_8233b6696fb3e24f, []int{0, 1} } func (m *EACLRecord_TargetInfo) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -422,7 +422,7 @@ func (m *EACLRecord_TargetInfo) GetKeyList() [][]byte { type EACLTable struct { // Carries identifier of the container that should use given // access control rules. - ContainerId *refs.ContainerID `protobuf:"bytes,1,opt,name=container_id,json=ContainerID,proto3" json:"container_id,omitempty"` + ContainerId *grpc.ContainerID `protobuf:"bytes,1,opt,name=container_id,json=ContainerID,proto3" json:"container_id,omitempty"` // Records carries list of extended ACL rule records. Records []*EACLRecord `protobuf:"bytes,2,rep,name=records,json=Records,proto3" json:"records,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` @@ -434,7 +434,7 @@ func (m *EACLTable) Reset() { *m = EACLTable{} } func (m *EACLTable) String() string { return proto.CompactTextString(m) } func (*EACLTable) ProtoMessage() {} func (*EACLTable) Descriptor() ([]byte, []int) { - return fileDescriptor_d237ab7979f0d6cf, []int{1} + return fileDescriptor_8233b6696fb3e24f, []int{1} } func (m *EACLTable) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -463,7 +463,7 @@ func (m *EACLTable) XXX_DiscardUnknown() { var xxx_messageInfo_EACLTable proto.InternalMessageInfo -func (m *EACLTable) GetContainerId() *refs.ContainerID { +func (m *EACLTable) GetContainerId() *grpc.ContainerID { if m != nil { return m.ContainerId } @@ -489,54 +489,55 @@ func init() { proto.RegisterType((*EACLTable)(nil), "neo.fs.v2.acl.EACLTable") } -func init() { proto.RegisterFile("v2/acl/types.proto", fileDescriptor_d237ab7979f0d6cf) } +func init() { proto.RegisterFile("v2/acl/grpc/types.proto", fileDescriptor_8233b6696fb3e24f) } -var fileDescriptor_d237ab7979f0d6cf = []byte{ - // 703 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x54, 0xd1, 0x6e, 0xda, 0x3c, - 0x18, 0x6d, 0x42, 0x1a, 0xe0, 0x83, 0xff, 0x97, 0xe5, 0xad, 0x88, 0x32, 0x09, 0x21, 0xb6, 0x0b, - 0xb4, 0xae, 0x41, 0xa2, 0x9a, 0xb4, 0x69, 0x52, 0xa5, 0x14, 0x5c, 0x60, 0x83, 0x00, 0x8e, 0xd9, - 0xd4, 0xdd, 0xa0, 0x34, 0x98, 0x16, 0x2d, 0x24, 0x28, 0x49, 0x91, 0xd8, 0xd5, 0x1e, 0x63, 0xcf, - 0xb0, 0x27, 0xd9, 0xe5, 0x1e, 0x61, 0xea, 0xa4, 0x3d, 0xc3, 0x2e, 0x27, 0x27, 0xd0, 0x32, 0xb4, - 0x6a, 0xbd, 0xf2, 0x17, 0xfb, 0x9c, 0xcf, 0xc7, 0xc7, 0x27, 0x06, 0xbc, 0xa8, 0x55, 0x2d, 0xdb, - 0xa9, 0x86, 0xcb, 0x39, 0x0f, 0xb4, 0xb9, 0xef, 0x85, 0x1e, 0xfe, 0xcf, 0xe5, 0x9e, 0x36, 0x09, - 0xb4, 0x45, 0x4d, 0xb3, 0x6c, 0xa7, 0xf0, 0x60, 0x51, 0xab, 0xfa, 0x7c, 0x12, 0x6c, 0x62, 0xca, - 0xbf, 0x54, 0x00, 0xa2, 0xd7, 0x3b, 0x94, 0xdb, 0x9e, 0x3f, 0xc6, 0x3a, 0xa4, 0xbd, 0x39, 0xf7, - 0xad, 0x70, 0xea, 0xb9, 0x79, 0xa9, 0x24, 0x55, 0xfe, 0xaf, 0x3d, 0xd6, 0xfe, 0x68, 0xa3, 0xdd, - 0xa2, 0xb5, 0xde, 0x1a, 0x4a, 0xd3, 0x37, 0x25, 0x7e, 0x01, 0xaa, 0x65, 0x47, 0x7c, 0x39, 0xe2, - 0x97, 0xee, 0xe6, 0xeb, 0x11, 0x8e, 0xaa, 0xf1, 0x88, 0x8f, 0x21, 0x39, 0x99, 0x3a, 0x21, 0xf7, - 0x83, 0x7c, 0xa2, 0x94, 0xa8, 0x64, 0x6a, 0x4f, 0xee, 0xa6, 0x9e, 0x46, 0xc0, 0xb6, 0x3b, 0xf1, - 0x68, 0x32, 0xae, 0x03, 0xc1, 0x0f, 0x2d, 0xff, 0x82, 0x87, 0x41, 0x5e, 0xf9, 0x17, 0x9f, 0x45, - 0xc0, 0x98, 0x1f, 0xd7, 0x41, 0xe1, 0xa7, 0x0c, 0x70, 0xdb, 0x17, 0x37, 0x41, 0xbd, 0xe4, 0xd6, - 0x98, 0xfb, 0x2b, 0x23, 0x0e, 0xee, 0xa3, 0x46, 0x6b, 0x45, 0x14, 0x0a, 0xf1, 0xc8, 0x96, 0x73, - 0x8e, 0xbb, 0x00, 0x33, 0x2b, 0xb4, 0x2f, 0x47, 0xc2, 0xf8, 0x95, 0x2b, 0xda, 0xbd, 0x9a, 0x75, - 0x05, 0x4d, 0xf4, 0xa0, 0xe9, 0x9b, 0x12, 0xef, 0x43, 0x26, 0xd6, 0x35, 0x72, 0xad, 0x19, 0xcf, - 0x27, 0x4a, 0x52, 0x25, 0x4d, 0x15, 0xc3, 0x9a, 0x89, 0x25, 0x58, 0x2d, 0x2d, 0x2c, 0x27, 0xaf, - 0x44, 0x2b, 0xbb, 0x6f, 0x2d, 0xe7, 0x8a, 0x97, 0x5f, 0x82, 0x1a, 0x4b, 0xc2, 0x39, 0xc0, 0x2d, - 0xa2, 0x37, 0x08, 0x1d, 0x0d, 0x0d, 0xb3, 0x4f, 0xea, 0xed, 0xd3, 0x36, 0x69, 0xa0, 0x1d, 0x9c, - 0x81, 0x24, 0x25, 0x83, 0x21, 0x31, 0x19, 0x92, 0x30, 0x80, 0xda, 0x3b, 0x79, 0x4d, 0xea, 0x0c, - 0xc9, 0xe5, 0x1e, 0x6c, 0xec, 0x5e, 0x80, 0x5c, 0x57, 0x67, 0xf5, 0xd6, 0x88, 0x9d, 0xf5, 0xc9, - 0x56, 0x07, 0x04, 0x59, 0x93, 0xd1, 0xb6, 0xd1, 0x1c, 0x91, 0xc1, 0x50, 0xef, 0x20, 0x09, 0x3f, - 0x04, 0xb4, 0x9a, 0x31, 0x7a, 0x6c, 0x35, 0x2b, 0x17, 0x06, 0x00, 0xb7, 0xfe, 0xe3, 0x03, 0x50, - 0xe3, 0x6b, 0x5b, 0xf9, 0xbc, 0xb7, 0x65, 0x4d, 0x0c, 0xa5, 0x0a, 0xf5, 0x1c, 0x8e, 0x73, 0x90, - 0xfa, 0xc0, 0x97, 0x23, 0x67, 0x1a, 0x84, 0x79, 0xb9, 0x94, 0xa8, 0x64, 0xa9, 0xf2, 0x86, 0x2f, - 0x83, 0xf2, 0x47, 0xd8, 0x88, 0xe0, 0x3e, 0xec, 0xf5, 0xfa, 0x84, 0xea, 0xac, 0xdd, 0x33, 0xb6, - 0x24, 0x26, 0x21, 0xd1, 0x24, 0xe2, 0x80, 0x29, 0x50, 0x84, 0x0b, 0x48, 0x16, 0x53, 0xfd, 0x21, - 0x43, 0x09, 0x71, 0xe6, 0x06, 0xe9, 0x10, 0x46, 0x90, 0x22, 0x6a, 0x93, 0xe8, 0xb4, 0xde, 0x42, - 0xbb, 0x38, 0x0b, 0xa9, 0x26, 0x61, 0x54, 0x37, 0x9a, 0x04, 0xa9, 0xe2, 0x90, 0xeb, 0xaf, 0x96, - 0x6e, 0xb6, 0x50, 0xb2, 0xfc, 0x1c, 0xd6, 0x09, 0xce, 0x01, 0xd6, 0xeb, 0x7f, 0xd9, 0x35, 0x0d, - 0xbb, 0x7a, 0xa7, 0xd3, 0x7b, 0x17, 0xef, 0xdb, 0x20, 0xc6, 0x19, 0x92, 0xcb, 0x9f, 0x24, 0x48, - 0x8b, 0x6b, 0x67, 0xd6, 0xb9, 0xc3, 0xf1, 0x31, 0x64, 0x6d, 0xcf, 0x0d, 0xad, 0xa9, 0xcb, 0xfd, - 0xd1, 0x74, 0x1c, 0x79, 0x91, 0xa9, 0x3d, 0xda, 0xf0, 0x42, 0xfc, 0xbb, 0x5a, 0x7d, 0x8d, 0x69, - 0x37, 0x68, 0x66, 0xe3, 0x03, 0x1f, 0x41, 0xd2, 0x8f, 0xf2, 0x13, 0x44, 0xbe, 0x64, 0x6a, 0xfb, - 0x77, 0x26, 0x8c, 0x26, 0xe3, 0x31, 0x78, 0x7a, 0x02, 0x6a, 0xec, 0xae, 0x50, 0xce, 0x74, 0xda, - 0x24, 0x6c, 0x4b, 0x79, 0x0a, 0x94, 0xa1, 0x49, 0x68, 0x9c, 0x08, 0xf3, 0xcc, 0x64, 0xa4, 0x8b, - 0xe4, 0x28, 0x1d, 0xac, 0x45, 0xa8, 0x89, 0x12, 0x27, 0x83, 0xaf, 0xd7, 0x45, 0xe9, 0xdb, 0x75, - 0x51, 0xfa, 0x7e, 0x5d, 0x94, 0x3e, 0xff, 0x28, 0xee, 0xbc, 0x7f, 0x76, 0x31, 0x0d, 0x2f, 0xaf, - 0xce, 0x35, 0xdb, 0x9b, 0x55, 0xdd, 0x60, 0x6e, 0xdb, 0x87, 0x63, 0xbe, 0xa8, 0xba, 0xdc, 0x9b, - 0x04, 0x87, 0xd6, 0x7c, 0x7a, 0x78, 0xe1, 0x55, 0xe3, 0xd7, 0xea, 0x95, 0x65, 0x3b, 0x5f, 0x64, - 0x64, 0x70, 0xef, 0xd4, 0xd4, 0xf4, 0x7e, 0x5b, 0x48, 0xd5, 0x6d, 0xe7, 0x5c, 0x8d, 0xde, 0xa6, - 0xa3, 0xdf, 0x01, 0x00, 0x00, 0xff, 0xff, 0xaa, 0x0d, 0x90, 0x3a, 0xd5, 0x04, 0x00, 0x00, +var fileDescriptor_8233b6696fb3e24f = []byte{ + // 710 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x54, 0xd1, 0x6e, 0xda, 0x3a, + 0x18, 0x6e, 0x42, 0x1a, 0xe0, 0x87, 0x73, 0x64, 0x59, 0xa7, 0x1c, 0xca, 0x91, 0x10, 0xe2, 0xec, + 0x02, 0xad, 0x6a, 0xd0, 0xa8, 0x26, 0x6d, 0x9a, 0x54, 0x29, 0x05, 0x17, 0xd8, 0x20, 0x50, 0xc7, + 0x74, 0xea, 0x6e, 0x50, 0x1a, 0x0c, 0x45, 0x0b, 0x09, 0x4a, 0x52, 0x24, 0x76, 0xb5, 0xc7, 0xd8, + 0x33, 0xec, 0x49, 0x76, 0xb9, 0x47, 0x98, 0x3a, 0x69, 0xcf, 0xb0, 0xcb, 0xc9, 0x09, 0xb4, 0x8c, + 0xad, 0x5a, 0xaf, 0xfc, 0xc7, 0xfe, 0xbe, 0xdf, 0x9f, 0x3f, 0x7f, 0x31, 0xfc, 0xbb, 0xa8, 0x55, + 0x2d, 0xdb, 0xa9, 0x4e, 0xfc, 0xb9, 0x5d, 0x0d, 0x97, 0x73, 0x1e, 0x68, 0x73, 0xdf, 0x0b, 0x3d, + 0xfc, 0x97, 0xcb, 0x3d, 0x6d, 0x1c, 0x68, 0x8b, 0x9a, 0x66, 0xd9, 0x4e, 0x21, 0xbf, 0xa8, 0x55, + 0x7d, 0x3e, 0x0e, 0x7e, 0x01, 0x96, 0xbf, 0xab, 0x00, 0x44, 0xaf, 0x77, 0x28, 0xb7, 0x3d, 0x7f, + 0x84, 0x75, 0x48, 0x7b, 0x73, 0xee, 0x5b, 0xe1, 0xd4, 0x73, 0xf3, 0x52, 0x49, 0xaa, 0xfc, 0x5d, + 0xfb, 0x5f, 0xfb, 0xa9, 0x97, 0x76, 0x87, 0xd6, 0x7a, 0x6b, 0x28, 0x4d, 0xdf, 0x96, 0xf8, 0x19, + 0xa8, 0x96, 0x1d, 0xf1, 0xe5, 0x88, 0x5f, 0xba, 0x9f, 0xaf, 0x47, 0x38, 0xaa, 0xc6, 0x23, 0x3e, + 0x86, 0xe4, 0x78, 0xea, 0x84, 0xdc, 0x0f, 0xf2, 0x89, 0x52, 0xa2, 0x92, 0xa9, 0x3d, 0xba, 0x9f, + 0x7a, 0x1a, 0x01, 0xdb, 0xee, 0xd8, 0xa3, 0xc9, 0xb8, 0x0e, 0x04, 0x3f, 0xb4, 0xfc, 0x09, 0x0f, + 0x83, 0xbc, 0xf2, 0x27, 0x3e, 0x8b, 0x80, 0x31, 0x3f, 0xae, 0x83, 0xc2, 0x37, 0x19, 0xe0, 0xae, + 0x2f, 0x6e, 0x82, 0x7a, 0xc5, 0xad, 0x11, 0xf7, 0x57, 0x46, 0x1c, 0x3c, 0x44, 0x8d, 0xd6, 0x8a, + 0x28, 0x14, 0xe2, 0x91, 0x2d, 0xe7, 0x1c, 0x77, 0x01, 0x66, 0x56, 0x68, 0x5f, 0x0d, 0x85, 0xf1, + 0x2b, 0x57, 0xb4, 0x07, 0x35, 0xeb, 0x0a, 0x9a, 0xe8, 0x41, 0xd3, 0xb7, 0x25, 0xde, 0x87, 0x4c, + 0xac, 0x6b, 0xe8, 0x5a, 0x33, 0x9e, 0x4f, 0x94, 0xa4, 0x4a, 0x9a, 0x2a, 0x86, 0x35, 0x13, 0x4b, + 0xb0, 0x5a, 0x5a, 0x58, 0x4e, 0x5e, 0x89, 0x56, 0x76, 0xcf, 0x2d, 0xe7, 0x9a, 0x97, 0x9f, 0x83, + 0x1a, 0x4b, 0xc2, 0x39, 0xc0, 0x2d, 0xa2, 0x37, 0x08, 0x1d, 0x0e, 0x0c, 0xb3, 0x4f, 0xea, 0xed, + 0xd3, 0x36, 0x69, 0xa0, 0x1d, 0x9c, 0x81, 0x24, 0x25, 0x67, 0x03, 0x62, 0x32, 0x24, 0x61, 0x00, + 0xb5, 0x77, 0xf2, 0x92, 0xd4, 0x19, 0x92, 0xcb, 0x3d, 0xd8, 0xd8, 0xbd, 0x00, 0xb9, 0xae, 0xce, + 0xea, 0xad, 0x21, 0xbb, 0xe8, 0x93, 0xad, 0x0e, 0x08, 0xb2, 0x26, 0xa3, 0x6d, 0xa3, 0x39, 0x24, + 0x67, 0x03, 0xbd, 0x83, 0x24, 0xfc, 0x0f, 0xa0, 0xd5, 0x8c, 0xd1, 0x63, 0xab, 0x59, 0xb9, 0x70, + 0x06, 0x70, 0xe7, 0x3f, 0x3e, 0x00, 0x35, 0xbe, 0xb6, 0x95, 0xcf, 0x7b, 0x5b, 0xd6, 0xc4, 0x50, + 0xaa, 0x50, 0xcf, 0xe1, 0x38, 0x07, 0xa9, 0xb7, 0x7c, 0x39, 0x74, 0xa6, 0x41, 0x98, 0x97, 0x4b, + 0x89, 0x4a, 0x96, 0x2a, 0xaf, 0xf8, 0x32, 0x28, 0xbf, 0x83, 0x8d, 0x08, 0xee, 0xc3, 0x5e, 0xaf, + 0x4f, 0xa8, 0xce, 0xda, 0x3d, 0x63, 0x4b, 0x62, 0x12, 0x12, 0x4d, 0x22, 0x0e, 0x98, 0x02, 0x45, + 0xb8, 0x80, 0x64, 0x31, 0xd5, 0x1f, 0x30, 0x94, 0x10, 0x67, 0x6e, 0x90, 0x0e, 0x61, 0x04, 0x29, + 0xa2, 0x36, 0x89, 0x4e, 0xeb, 0x2d, 0xb4, 0x8b, 0xb3, 0x90, 0x6a, 0x12, 0x46, 0x75, 0xa3, 0x49, + 0x90, 0x2a, 0x0e, 0xb9, 0xfe, 0x6a, 0xe9, 0x66, 0x0b, 0x25, 0xcb, 0x4f, 0x61, 0x9d, 0xe0, 0x1c, + 0x60, 0xbd, 0xfe, 0x9b, 0x5d, 0xd3, 0xb0, 0xab, 0x77, 0x3a, 0xbd, 0xd7, 0xf1, 0xbe, 0x0d, 0x62, + 0x5c, 0x20, 0xb9, 0xfc, 0x5e, 0x82, 0xb4, 0xb8, 0x76, 0x66, 0x5d, 0x3a, 0x1c, 0x1f, 0x43, 0xd6, + 0xf6, 0xdc, 0xd0, 0x9a, 0xba, 0xdc, 0x1f, 0x4e, 0x47, 0x91, 0x17, 0x99, 0xda, 0x7f, 0x1b, 0x5e, + 0x88, 0x1f, 0x58, 0xab, 0xaf, 0x31, 0xed, 0x06, 0xcd, 0x6c, 0x7c, 0xe0, 0x23, 0x48, 0xfa, 0x51, + 0x7e, 0x82, 0xc8, 0x97, 0x4c, 0x6d, 0xff, 0xde, 0x84, 0xd1, 0x64, 0x3c, 0x06, 0x8f, 0x4f, 0x40, + 0x8d, 0xdd, 0x15, 0xca, 0x99, 0x4e, 0x9b, 0x84, 0x6d, 0x29, 0x4f, 0x81, 0x32, 0x30, 0x09, 0x8d, + 0x13, 0x61, 0x5e, 0x98, 0x8c, 0x74, 0x91, 0x1c, 0xa5, 0x83, 0xb5, 0x08, 0x35, 0x51, 0xe2, 0xe4, + 0xfc, 0xd3, 0x4d, 0x51, 0xfa, 0x7c, 0x53, 0x94, 0xbe, 0xdc, 0x14, 0xa5, 0x0f, 0x5f, 0x8b, 0x3b, + 0x6f, 0x9e, 0x4c, 0xa6, 0xe1, 0xd5, 0xf5, 0xa5, 0x66, 0x7b, 0xb3, 0xaa, 0x1b, 0xcc, 0x6d, 0xfb, + 0x70, 0xc4, 0x17, 0x55, 0x97, 0x7b, 0xe3, 0xe0, 0xd0, 0x9a, 0x4f, 0x0f, 0x27, 0x5e, 0x75, 0xe3, + 0xdd, 0x7a, 0x61, 0xd9, 0xce, 0x47, 0x19, 0x19, 0xdc, 0x3b, 0x35, 0x35, 0xbd, 0xdf, 0x16, 0x7a, + 0x75, 0xdb, 0xb9, 0x54, 0xa3, 0x07, 0xea, 0xe8, 0x47, 0x00, 0x00, 0x00, 0xff, 0xff, 0xf6, 0x1c, + 0x01, 0xad, 0xe4, 0x04, 0x00, 0x00, } func (m *EACLRecord) Marshal() (dAtA []byte, err error) { @@ -1345,7 +1346,7 @@ func (m *EACLTable) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.ContainerId == nil { - m.ContainerId = &refs.ContainerID{} + m.ContainerId = &grpc.ContainerID{} } if err := m.ContainerId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err diff --git a/v2/container/marshal.go b/v2/container/grpc/marshal.go similarity index 100% rename from v2/container/marshal.go rename to v2/container/grpc/marshal.go diff --git a/v2/container/marshal_test.go b/v2/container/grpc/marshal_test.go similarity index 92% rename from v2/container/marshal_test.go rename to v2/container/grpc/marshal_test.go index a7e2888..ef8bfdd 100644 --- a/v2/container/marshal_test.go +++ b/v2/container/grpc/marshal_test.go @@ -3,8 +3,8 @@ package container import ( "testing" - "github.com/nspcc-dev/neofs-api-go/v2/netmap" - "github.com/nspcc-dev/neofs-api-go/v2/refs" + netmap "github.com/nspcc-dev/neofs-api-go/v2/netmap/grpc" + refs "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" "github.com/stretchr/testify/require" ) diff --git a/v2/container/service.go b/v2/container/grpc/service.go similarity index 97% rename from v2/container/service.go rename to v2/container/grpc/service.go index bde2b48..3cbbe58 100644 --- a/v2/container/service.go +++ b/v2/container/grpc/service.go @@ -1,9 +1,9 @@ package container import ( - "github.com/nspcc-dev/neofs-api-go/v2/acl" - "github.com/nspcc-dev/neofs-api-go/v2/refs" - "github.com/nspcc-dev/neofs-api-go/v2/service" + acl "github.com/nspcc-dev/neofs-api-go/v2/acl/grpc" + refs "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" + service "github.com/nspcc-dev/neofs-api-go/v2/service/grpc" ) // SetContainer sets container of the request. diff --git a/v2/container/service.pb.go b/v2/container/grpc/service.pb.go similarity index 88% rename from v2/container/service.pb.go rename to v2/container/grpc/service.pb.go index 50a9347..c5ae473 100644 --- a/v2/container/service.pb.go +++ b/v2/container/grpc/service.pb.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: v2/container/service.proto +// source: v2/container/grpc/service.proto package container @@ -7,10 +7,10 @@ import ( context "context" fmt "fmt" proto "github.com/golang/protobuf/proto" - acl "github.com/nspcc-dev/neofs-api-go/v2/acl" - refs "github.com/nspcc-dev/neofs-api-go/v2/refs" - service "github.com/nspcc-dev/neofs-api-go/v2/service" - grpc "google.golang.org/grpc" + grpc2 "github.com/nspcc-dev/neofs-api-go/v2/acl/grpc" + grpc1 "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" + grpc "github.com/nspcc-dev/neofs-api-go/v2/service/grpc" + grpc3 "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" io "io" @@ -35,21 +35,21 @@ type PutRequest struct { Body *PutRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` // Carries request meta information. Header data is used only to regulate // message transport and does not affect request execution. - MetaHeader *service.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" json:"meta_header,omitempty"` + MetaHeader *grpc.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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 *service.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + VerifyHeader *grpc.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *PutRequest) Reset() { *m = PutRequest{} } func (m *PutRequest) String() string { return proto.CompactTextString(m) } func (*PutRequest) ProtoMessage() {} func (*PutRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_6e23291a5a71033a, []int{0} + return fileDescriptor_364186d99410ec35, []int{0} } func (m *PutRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -85,14 +85,14 @@ func (m *PutRequest) GetBody() *PutRequest_Body { return nil } -func (m *PutRequest) GetMetaHeader() *service.RequestMetaHeader { +func (m *PutRequest) GetMetaHeader() *grpc.RequestMetaHeader { if m != nil { return m.MetaHeader } return nil } -func (m *PutRequest) GetVerifyHeader() *service.RequestVerificationHeader { +func (m *PutRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { if m != nil { return m.VerifyHeader } @@ -117,7 +117,7 @@ func (m *PutRequest_Body) Reset() { *m = PutRequest_Body{} } func (m *PutRequest_Body) String() string { return proto.CompactTextString(m) } func (*PutRequest_Body) ProtoMessage() {} func (*PutRequest_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_6e23291a5a71033a, []int{0, 0} + return fileDescriptor_364186d99410ec35, []int{0, 0} } func (m *PutRequest_Body) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -173,21 +173,21 @@ type PutResponse struct { Body *PutResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` // Carries response meta information. Header data is used only to regulate // message transport and does not affect request execution. - MetaHeader *service.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" json:"meta_header,omitempty"` + MetaHeader *grpc.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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 *service.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + VerifyHeader *grpc.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *PutResponse) Reset() { *m = PutResponse{} } func (m *PutResponse) String() string { return proto.CompactTextString(m) } func (*PutResponse) ProtoMessage() {} func (*PutResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_6e23291a5a71033a, []int{1} + return fileDescriptor_364186d99410ec35, []int{1} } func (m *PutResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -223,14 +223,14 @@ func (m *PutResponse) GetBody() *PutResponse_Body { return nil } -func (m *PutResponse) GetMetaHeader() *service.ResponseMetaHeader { +func (m *PutResponse) GetMetaHeader() *grpc.ResponseMetaHeader { if m != nil { return m.MetaHeader } return nil } -func (m *PutResponse) GetVerifyHeader() *service.ResponseVerificationHeader { +func (m *PutResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { if m != nil { return m.VerifyHeader } @@ -240,17 +240,17 @@ func (m *PutResponse) GetVerifyHeader() *service.ResponseVerificationHeader { // Response body type PutResponse_Body struct { // container_id carries identifier of the new container. - ContainerId *refs.ContainerID `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + ContainerId *grpc1.ContainerID `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *PutResponse_Body) Reset() { *m = PutResponse_Body{} } func (m *PutResponse_Body) String() string { return proto.CompactTextString(m) } func (*PutResponse_Body) ProtoMessage() {} func (*PutResponse_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_6e23291a5a71033a, []int{1, 0} + return fileDescriptor_364186d99410ec35, []int{1, 0} } func (m *PutResponse_Body) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -279,7 +279,7 @@ func (m *PutResponse_Body) XXX_DiscardUnknown() { var xxx_messageInfo_PutResponse_Body proto.InternalMessageInfo -func (m *PutResponse_Body) GetContainerId() *refs.ContainerID { +func (m *PutResponse_Body) GetContainerId() *grpc1.ContainerID { if m != nil { return m.ContainerId } @@ -292,21 +292,21 @@ type DeleteRequest struct { Body *DeleteRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` // Carries request meta information. Header data is used only to regulate // message transport and does not affect request execution. - MetaHeader *service.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" json:"meta_header,omitempty"` + MetaHeader *grpc.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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 *service.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + VerifyHeader *grpc.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *DeleteRequest) Reset() { *m = DeleteRequest{} } func (m *DeleteRequest) String() string { return proto.CompactTextString(m) } func (*DeleteRequest) ProtoMessage() {} func (*DeleteRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_6e23291a5a71033a, []int{2} + return fileDescriptor_364186d99410ec35, []int{2} } func (m *DeleteRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -342,14 +342,14 @@ func (m *DeleteRequest) GetBody() *DeleteRequest_Body { return nil } -func (m *DeleteRequest) GetMetaHeader() *service.RequestMetaHeader { +func (m *DeleteRequest) GetMetaHeader() *grpc.RequestMetaHeader { if m != nil { return m.MetaHeader } return nil } -func (m *DeleteRequest) GetVerifyHeader() *service.RequestVerificationHeader { +func (m *DeleteRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { if m != nil { return m.VerifyHeader } @@ -360,7 +360,7 @@ func (m *DeleteRequest) GetVerifyHeader() *service.RequestVerificationHeader { type DeleteRequest_Body struct { // container_id carries identifier of the container to delete // from NeoFS. - ContainerId *refs.ContainerID `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` + ContainerId *grpc1.ContainerID `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` // Signature of container id according to RFC-6979. Signature []byte `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` @@ -372,7 +372,7 @@ func (m *DeleteRequest_Body) Reset() { *m = DeleteRequest_Body{} } func (m *DeleteRequest_Body) String() string { return proto.CompactTextString(m) } func (*DeleteRequest_Body) ProtoMessage() {} func (*DeleteRequest_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_6e23291a5a71033a, []int{2, 0} + return fileDescriptor_364186d99410ec35, []int{2, 0} } func (m *DeleteRequest_Body) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -401,7 +401,7 @@ func (m *DeleteRequest_Body) XXX_DiscardUnknown() { var xxx_messageInfo_DeleteRequest_Body proto.InternalMessageInfo -func (m *DeleteRequest_Body) GetContainerId() *refs.ContainerID { +func (m *DeleteRequest_Body) GetContainerId() *grpc1.ContainerID { if m != nil { return m.ContainerId } @@ -422,21 +422,21 @@ type DeleteResponse struct { Body *DeleteResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` // Carries response meta information. Header data is used only to regulate // message transport and does not affect request execution. - MetaHeader *service.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" json:"meta_header,omitempty"` + MetaHeader *grpc.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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 *service.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + VerifyHeader *grpc.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *DeleteResponse) Reset() { *m = DeleteResponse{} } func (m *DeleteResponse) String() string { return proto.CompactTextString(m) } func (*DeleteResponse) ProtoMessage() {} func (*DeleteResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_6e23291a5a71033a, []int{3} + return fileDescriptor_364186d99410ec35, []int{3} } func (m *DeleteResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -472,14 +472,14 @@ func (m *DeleteResponse) GetBody() *DeleteResponse_Body { return nil } -func (m *DeleteResponse) GetMetaHeader() *service.ResponseMetaHeader { +func (m *DeleteResponse) GetMetaHeader() *grpc.ResponseMetaHeader { if m != nil { return m.MetaHeader } return nil } -func (m *DeleteResponse) GetVerifyHeader() *service.ResponseVerificationHeader { +func (m *DeleteResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { if m != nil { return m.VerifyHeader } @@ -497,7 +497,7 @@ func (m *DeleteResponse_Body) Reset() { *m = DeleteResponse_Body{} } func (m *DeleteResponse_Body) String() string { return proto.CompactTextString(m) } func (*DeleteResponse_Body) ProtoMessage() {} func (*DeleteResponse_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_6e23291a5a71033a, []int{3, 0} + return fileDescriptor_364186d99410ec35, []int{3, 0} } func (m *DeleteResponse_Body) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -532,21 +532,21 @@ type GetRequest struct { Body *GetRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` // Carries request meta information. Header data is used only to regulate // message transport and does not affect request execution. - MetaHeader *service.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" json:"meta_header,omitempty"` + MetaHeader *grpc.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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 *service.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + VerifyHeader *grpc.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetRequest) Reset() { *m = GetRequest{} } func (m *GetRequest) String() string { return proto.CompactTextString(m) } func (*GetRequest) ProtoMessage() {} func (*GetRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_6e23291a5a71033a, []int{4} + return fileDescriptor_364186d99410ec35, []int{4} } func (m *GetRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -582,14 +582,14 @@ func (m *GetRequest) GetBody() *GetRequest_Body { return nil } -func (m *GetRequest) GetMetaHeader() *service.RequestMetaHeader { +func (m *GetRequest) GetMetaHeader() *grpc.RequestMetaHeader { if m != nil { return m.MetaHeader } return nil } -func (m *GetRequest) GetVerifyHeader() *service.RequestVerificationHeader { +func (m *GetRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { if m != nil { return m.VerifyHeader } @@ -599,17 +599,17 @@ func (m *GetRequest) GetVerifyHeader() *service.RequestVerificationHeader { // Request body type GetRequest_Body struct { // container_id carries identifier of the container to get. - ContainerId *refs.ContainerID `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + ContainerId *grpc1.ContainerID `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetRequest_Body) Reset() { *m = GetRequest_Body{} } func (m *GetRequest_Body) String() string { return proto.CompactTextString(m) } func (*GetRequest_Body) ProtoMessage() {} func (*GetRequest_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_6e23291a5a71033a, []int{4, 0} + return fileDescriptor_364186d99410ec35, []int{4, 0} } func (m *GetRequest_Body) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -638,7 +638,7 @@ func (m *GetRequest_Body) XXX_DiscardUnknown() { var xxx_messageInfo_GetRequest_Body proto.InternalMessageInfo -func (m *GetRequest_Body) GetContainerId() *refs.ContainerID { +func (m *GetRequest_Body) GetContainerId() *grpc1.ContainerID { if m != nil { return m.ContainerId } @@ -651,21 +651,21 @@ type GetResponse struct { Body *GetResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` // Carries response meta information. Header data is used only to regulate // message transport and does not affect request execution. - MetaHeader *service.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" json:"meta_header,omitempty"` + MetaHeader *grpc.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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 *service.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + VerifyHeader *grpc.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetResponse) Reset() { *m = GetResponse{} } func (m *GetResponse) String() string { return proto.CompactTextString(m) } func (*GetResponse) ProtoMessage() {} func (*GetResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_6e23291a5a71033a, []int{5} + return fileDescriptor_364186d99410ec35, []int{5} } func (m *GetResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -701,14 +701,14 @@ func (m *GetResponse) GetBody() *GetResponse_Body { return nil } -func (m *GetResponse) GetMetaHeader() *service.ResponseMetaHeader { +func (m *GetResponse) GetMetaHeader() *grpc.ResponseMetaHeader { if m != nil { return m.MetaHeader } return nil } -func (m *GetResponse) GetVerifyHeader() *service.ResponseVerificationHeader { +func (m *GetResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { if m != nil { return m.VerifyHeader } @@ -728,7 +728,7 @@ func (m *GetResponse_Body) Reset() { *m = GetResponse_Body{} } func (m *GetResponse_Body) String() string { return proto.CompactTextString(m) } func (*GetResponse_Body) ProtoMessage() {} func (*GetResponse_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_6e23291a5a71033a, []int{5, 0} + return fileDescriptor_364186d99410ec35, []int{5, 0} } func (m *GetResponse_Body) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -770,21 +770,21 @@ type ListRequest struct { Body *ListRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` // Carries request meta information. Header data is used only to regulate // message transport and does not affect request execution. - MetaHeader *service.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" json:"meta_header,omitempty"` + MetaHeader *grpc.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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 *service.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + VerifyHeader *grpc.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *ListRequest) Reset() { *m = ListRequest{} } func (m *ListRequest) String() string { return proto.CompactTextString(m) } func (*ListRequest) ProtoMessage() {} func (*ListRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_6e23291a5a71033a, []int{6} + return fileDescriptor_364186d99410ec35, []int{6} } func (m *ListRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -820,14 +820,14 @@ func (m *ListRequest) GetBody() *ListRequest_Body { return nil } -func (m *ListRequest) GetMetaHeader() *service.RequestMetaHeader { +func (m *ListRequest) GetMetaHeader() *grpc.RequestMetaHeader { if m != nil { return m.MetaHeader } return nil } -func (m *ListRequest) GetVerifyHeader() *service.RequestVerificationHeader { +func (m *ListRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { if m != nil { return m.VerifyHeader } @@ -837,17 +837,17 @@ func (m *ListRequest) GetVerifyHeader() *service.RequestVerificationHeader { // Request body type ListRequest_Body struct { // owner_id carries identifier of the container owner. - OwnerId *refs.OwnerID `protobuf:"bytes,1,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + OwnerId *grpc1.OwnerID `protobuf:"bytes,1,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *ListRequest_Body) Reset() { *m = ListRequest_Body{} } func (m *ListRequest_Body) String() string { return proto.CompactTextString(m) } func (*ListRequest_Body) ProtoMessage() {} func (*ListRequest_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_6e23291a5a71033a, []int{6, 0} + return fileDescriptor_364186d99410ec35, []int{6, 0} } func (m *ListRequest_Body) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -876,7 +876,7 @@ func (m *ListRequest_Body) XXX_DiscardUnknown() { var xxx_messageInfo_ListRequest_Body proto.InternalMessageInfo -func (m *ListRequest_Body) GetOwnerId() *refs.OwnerID { +func (m *ListRequest_Body) GetOwnerId() *grpc1.OwnerID { if m != nil { return m.OwnerId } @@ -889,21 +889,21 @@ type ListResponse struct { Body *ListResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` // Carries response meta information. Header data is used only to regulate // message transport and does not affect request execution. - MetaHeader *service.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" json:"meta_header,omitempty"` + MetaHeader *grpc.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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 *service.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + VerifyHeader *grpc.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *ListResponse) Reset() { *m = ListResponse{} } func (m *ListResponse) String() string { return proto.CompactTextString(m) } func (*ListResponse) ProtoMessage() {} func (*ListResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_6e23291a5a71033a, []int{7} + return fileDescriptor_364186d99410ec35, []int{7} } func (m *ListResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -939,14 +939,14 @@ func (m *ListResponse) GetBody() *ListResponse_Body { return nil } -func (m *ListResponse) GetMetaHeader() *service.ResponseMetaHeader { +func (m *ListResponse) GetMetaHeader() *grpc.ResponseMetaHeader { if m != nil { return m.MetaHeader } return nil } -func (m *ListResponse) GetVerifyHeader() *service.ResponseVerificationHeader { +func (m *ListResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { if m != nil { return m.VerifyHeader } @@ -956,17 +956,17 @@ func (m *ListResponse) GetVerifyHeader() *service.ResponseVerificationHeader { // Response body type ListResponse_Body struct { // ContainerIDs carries list of identifiers of the containers that belong to the owner. - ContainerIds []*refs.ContainerID `protobuf:"bytes,1,rep,name=container_ids,json=containerIds,proto3" json:"container_ids,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + ContainerIds []*grpc1.ContainerID `protobuf:"bytes,1,rep,name=container_ids,json=containerIds,proto3" json:"container_ids,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *ListResponse_Body) Reset() { *m = ListResponse_Body{} } func (m *ListResponse_Body) String() string { return proto.CompactTextString(m) } func (*ListResponse_Body) ProtoMessage() {} func (*ListResponse_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_6e23291a5a71033a, []int{7, 0} + return fileDescriptor_364186d99410ec35, []int{7, 0} } func (m *ListResponse_Body) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -995,7 +995,7 @@ func (m *ListResponse_Body) XXX_DiscardUnknown() { var xxx_messageInfo_ListResponse_Body proto.InternalMessageInfo -func (m *ListResponse_Body) GetContainerIds() []*refs.ContainerID { +func (m *ListResponse_Body) GetContainerIds() []*grpc1.ContainerID { if m != nil { return m.ContainerIds } @@ -1008,21 +1008,21 @@ type SetExtendedACLRequest struct { Body *SetExtendedACLRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` // Carries request meta information. Header data is used only to regulate // message transport and does not affect request execution. - MetaHeader *service.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" json:"meta_header,omitempty"` + MetaHeader *grpc.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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 *service.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + VerifyHeader *grpc.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *SetExtendedACLRequest) Reset() { *m = SetExtendedACLRequest{} } func (m *SetExtendedACLRequest) String() string { return proto.CompactTextString(m) } func (*SetExtendedACLRequest) ProtoMessage() {} func (*SetExtendedACLRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_6e23291a5a71033a, []int{8} + return fileDescriptor_364186d99410ec35, []int{8} } func (m *SetExtendedACLRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1058,14 +1058,14 @@ func (m *SetExtendedACLRequest) GetBody() *SetExtendedACLRequest_Body { return nil } -func (m *SetExtendedACLRequest) GetMetaHeader() *service.RequestMetaHeader { +func (m *SetExtendedACLRequest) GetMetaHeader() *grpc.RequestMetaHeader { if m != nil { return m.MetaHeader } return nil } -func (m *SetExtendedACLRequest) GetVerifyHeader() *service.RequestVerificationHeader { +func (m *SetExtendedACLRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { if m != nil { return m.VerifyHeader } @@ -1075,7 +1075,7 @@ func (m *SetExtendedACLRequest) GetVerifyHeader() *service.RequestVerificationHe // Request body type SetExtendedACLRequest_Body struct { // Extended ACL to set for the container. - Eacl *acl.EACLTable `protobuf:"bytes,1,opt,name=eacl,proto3" json:"eacl,omitempty"` + Eacl *grpc2.EACLTable `protobuf:"bytes,1,opt,name=eacl,proto3" json:"eacl,omitempty"` // Signature of stable-marshalled Extended ACL according to RFC-6979. Signature []byte `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` @@ -1087,7 +1087,7 @@ func (m *SetExtendedACLRequest_Body) Reset() { *m = SetExtendedACLReques func (m *SetExtendedACLRequest_Body) String() string { return proto.CompactTextString(m) } func (*SetExtendedACLRequest_Body) ProtoMessage() {} func (*SetExtendedACLRequest_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_6e23291a5a71033a, []int{8, 0} + return fileDescriptor_364186d99410ec35, []int{8, 0} } func (m *SetExtendedACLRequest_Body) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1116,7 +1116,7 @@ func (m *SetExtendedACLRequest_Body) XXX_DiscardUnknown() { var xxx_messageInfo_SetExtendedACLRequest_Body proto.InternalMessageInfo -func (m *SetExtendedACLRequest_Body) GetEacl() *acl.EACLTable { +func (m *SetExtendedACLRequest_Body) GetEacl() *grpc2.EACLTable { if m != nil { return m.Eacl } @@ -1136,21 +1136,21 @@ type SetExtendedACLResponse struct { Body *SetExtendedACLResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` // Carries response meta information. Header data is used only to regulate // message transport and does not affect request execution. - MetaHeader *service.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" json:"meta_header,omitempty"` + MetaHeader *grpc.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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 *service.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + VerifyHeader *grpc.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *SetExtendedACLResponse) Reset() { *m = SetExtendedACLResponse{} } func (m *SetExtendedACLResponse) String() string { return proto.CompactTextString(m) } func (*SetExtendedACLResponse) ProtoMessage() {} func (*SetExtendedACLResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_6e23291a5a71033a, []int{9} + return fileDescriptor_364186d99410ec35, []int{9} } func (m *SetExtendedACLResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1186,14 +1186,14 @@ func (m *SetExtendedACLResponse) GetBody() *SetExtendedACLResponse_Body { return nil } -func (m *SetExtendedACLResponse) GetMetaHeader() *service.ResponseMetaHeader { +func (m *SetExtendedACLResponse) GetMetaHeader() *grpc.ResponseMetaHeader { if m != nil { return m.MetaHeader } return nil } -func (m *SetExtendedACLResponse) GetVerifyHeader() *service.ResponseVerificationHeader { +func (m *SetExtendedACLResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { if m != nil { return m.VerifyHeader } @@ -1211,7 +1211,7 @@ func (m *SetExtendedACLResponse_Body) Reset() { *m = SetExtendedACLRespo func (m *SetExtendedACLResponse_Body) String() string { return proto.CompactTextString(m) } func (*SetExtendedACLResponse_Body) ProtoMessage() {} func (*SetExtendedACLResponse_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_6e23291a5a71033a, []int{9, 0} + return fileDescriptor_364186d99410ec35, []int{9, 0} } func (m *SetExtendedACLResponse_Body) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1246,21 +1246,21 @@ type GetExtendedACLRequest struct { Body *GetExtendedACLRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` // Carries request meta information. Header data is used only to regulate // message transport and does not affect request execution. - MetaHeader *service.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" json:"meta_header,omitempty"` + MetaHeader *grpc.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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 *service.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + VerifyHeader *grpc.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetExtendedACLRequest) Reset() { *m = GetExtendedACLRequest{} } func (m *GetExtendedACLRequest) String() string { return proto.CompactTextString(m) } func (*GetExtendedACLRequest) ProtoMessage() {} func (*GetExtendedACLRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_6e23291a5a71033a, []int{10} + return fileDescriptor_364186d99410ec35, []int{10} } func (m *GetExtendedACLRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1296,14 +1296,14 @@ func (m *GetExtendedACLRequest) GetBody() *GetExtendedACLRequest_Body { return nil } -func (m *GetExtendedACLRequest) GetMetaHeader() *service.RequestMetaHeader { +func (m *GetExtendedACLRequest) GetMetaHeader() *grpc.RequestMetaHeader { if m != nil { return m.MetaHeader } return nil } -func (m *GetExtendedACLRequest) GetVerifyHeader() *service.RequestVerificationHeader { +func (m *GetExtendedACLRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { if m != nil { return m.VerifyHeader } @@ -1313,17 +1313,17 @@ func (m *GetExtendedACLRequest) GetVerifyHeader() *service.RequestVerificationHe // Request body type GetExtendedACLRequest_Body struct { // container_id carries identifier of the container that has Extended ACL. - ContainerId *refs.ContainerID `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + ContainerId *grpc1.ContainerID `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetExtendedACLRequest_Body) Reset() { *m = GetExtendedACLRequest_Body{} } func (m *GetExtendedACLRequest_Body) String() string { return proto.CompactTextString(m) } func (*GetExtendedACLRequest_Body) ProtoMessage() {} func (*GetExtendedACLRequest_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_6e23291a5a71033a, []int{10, 0} + return fileDescriptor_364186d99410ec35, []int{10, 0} } func (m *GetExtendedACLRequest_Body) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1352,7 +1352,7 @@ func (m *GetExtendedACLRequest_Body) XXX_DiscardUnknown() { var xxx_messageInfo_GetExtendedACLRequest_Body proto.InternalMessageInfo -func (m *GetExtendedACLRequest_Body) GetContainerId() *refs.ContainerID { +func (m *GetExtendedACLRequest_Body) GetContainerId() *grpc1.ContainerID { if m != nil { return m.ContainerId } @@ -1365,21 +1365,21 @@ type GetExtendedACLResponse struct { Body *GetExtendedACLResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` // Carries response meta information. Header data is used only to regulate // message transport and does not affect request execution. - MetaHeader *service.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" json:"meta_header,omitempty"` + MetaHeader *grpc.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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 *service.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + VerifyHeader *grpc.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetExtendedACLResponse) Reset() { *m = GetExtendedACLResponse{} } func (m *GetExtendedACLResponse) String() string { return proto.CompactTextString(m) } func (*GetExtendedACLResponse) ProtoMessage() {} func (*GetExtendedACLResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_6e23291a5a71033a, []int{11} + return fileDescriptor_364186d99410ec35, []int{11} } func (m *GetExtendedACLResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1415,14 +1415,14 @@ func (m *GetExtendedACLResponse) GetBody() *GetExtendedACLResponse_Body { return nil } -func (m *GetExtendedACLResponse) GetMetaHeader() *service.ResponseMetaHeader { +func (m *GetExtendedACLResponse) GetMetaHeader() *grpc.ResponseMetaHeader { if m != nil { return m.MetaHeader } return nil } -func (m *GetExtendedACLResponse) GetVerifyHeader() *service.ResponseVerificationHeader { +func (m *GetExtendedACLResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { if m != nil { return m.VerifyHeader } @@ -1432,7 +1432,7 @@ func (m *GetExtendedACLResponse) GetVerifyHeader() *service.ResponseVerification // Response body type GetExtendedACLResponse_Body struct { // Extended ACL that has been requested if it was set up. - Eacl *acl.EACLTable `protobuf:"bytes,1,opt,name=eacl,proto3" json:"eacl,omitempty"` + Eacl *grpc2.EACLTable `protobuf:"bytes,1,opt,name=eacl,proto3" json:"eacl,omitempty"` // Signature of stable-marshalled Extended ACL according to RFC-6979. Signature []byte `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` @@ -1444,7 +1444,7 @@ func (m *GetExtendedACLResponse_Body) Reset() { *m = GetExtendedACLRespo func (m *GetExtendedACLResponse_Body) String() string { return proto.CompactTextString(m) } func (*GetExtendedACLResponse_Body) ProtoMessage() {} func (*GetExtendedACLResponse_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_6e23291a5a71033a, []int{11, 0} + return fileDescriptor_364186d99410ec35, []int{11, 0} } func (m *GetExtendedACLResponse_Body) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1473,7 +1473,7 @@ func (m *GetExtendedACLResponse_Body) XXX_DiscardUnknown() { var xxx_messageInfo_GetExtendedACLResponse_Body proto.InternalMessageInfo -func (m *GetExtendedACLResponse_Body) GetEacl() *acl.EACLTable { +func (m *GetExtendedACLResponse_Body) GetEacl() *grpc2.EACLTable { if m != nil { return m.Eacl } @@ -1514,72 +1514,72 @@ func init() { proto.RegisterType((*GetExtendedACLResponse_Body)(nil), "neo.fs.v2.container.GetExtendedACLResponse.Body") } -func init() { proto.RegisterFile("v2/container/service.proto", fileDescriptor_6e23291a5a71033a) } +func init() { proto.RegisterFile("v2/container/grpc/service.proto", fileDescriptor_364186d99410ec35) } -var fileDescriptor_6e23291a5a71033a = []byte{ - // 833 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x98, 0xcd, 0x6e, 0xd3, 0x58, - 0x14, 0xc7, 0xc7, 0x6e, 0xd4, 0x99, 0x9e, 0xa4, 0xd5, 0xe8, 0x56, 0x6d, 0x23, 0xcf, 0x4c, 0x26, - 0xe3, 0x99, 0x0e, 0x15, 0x34, 0x36, 0x32, 0x9b, 0xd2, 0x56, 0x88, 0x36, 0x69, 0xdd, 0xa8, 0x05, - 0x5a, 0x17, 0xb1, 0x60, 0x53, 0x39, 0xf6, 0x49, 0x6b, 0x91, 0xda, 0x21, 0x76, 0x5c, 0xb2, 0x84, - 0xa7, 0x60, 0x81, 0x58, 0xa3, 0x8a, 0x05, 0x4f, 0xc0, 0x1a, 0x21, 0x84, 0x78, 0x04, 0x54, 0x78, - 0x02, 0x9e, 0x00, 0xf9, 0x23, 0x8e, 0x5d, 0x9c, 0x3a, 0xa9, 0xc2, 0xc2, 0x3b, 0xe7, 0xe6, 0x9c, - 0x73, 0xcf, 0xf9, 0xe9, 0x7f, 0xee, 0xb9, 0x36, 0x30, 0xb6, 0xc0, 0x2b, 0x86, 0x6e, 0xc9, 0x9a, - 0x8e, 0x2d, 0xde, 0xc4, 0x96, 0xad, 0x29, 0xc8, 0x35, 0x5b, 0x86, 0x65, 0x90, 0x69, 0x1d, 0x0d, - 0xae, 0x6e, 0x72, 0xb6, 0xc0, 0x05, 0x26, 0x0c, 0xb1, 0x05, 0x5e, 0x56, 0x1a, 0xbc, 0xd5, 0x69, - 0xa2, 0xe9, 0x19, 0x32, 0xf9, 0x48, 0x90, 0xf0, 0x3f, 0xd3, 0xb6, 0xc0, 0xb7, 0xb0, 0x6e, 0x46, - 0x16, 0x67, 0x6c, 0xa1, 0xbb, 0x13, 0x7f, 0x8c, 0x96, 0xec, 0x2f, 0xcf, 0x85, 0x96, 0x6d, 0x6c, - 0x69, 0xf5, 0x8e, 0xf7, 0x07, 0xfb, 0x95, 0x06, 0xd8, 0x6d, 0x5b, 0x12, 0x3e, 0x6e, 0xa3, 0x69, - 0x91, 0x25, 0xc8, 0xd4, 0x0c, 0xb5, 0x93, 0xa7, 0x8a, 0xd4, 0x42, 0x56, 0xf8, 0x8f, 0x8b, 0xc9, - 0x92, 0xeb, 0x99, 0x73, 0xeb, 0x86, 0xda, 0x91, 0x5c, 0x0f, 0xb2, 0x01, 0x59, 0x67, 0xbf, 0x83, - 0x23, 0x94, 0x55, 0x6c, 0xe5, 0xe9, 0x1f, 0x02, 0x74, 0xeb, 0xf7, 0x7d, 0xef, 0xa0, 0x25, 0x6f, - 0xb9, 0xb6, 0x12, 0x1c, 0x07, 0xcf, 0x64, 0x0f, 0x26, 0xbd, 0xfc, 0xba, 0x81, 0xc6, 0xdc, 0x40, - 0x8b, 0xfd, 0x03, 0x3d, 0x70, 0xcc, 0x35, 0x45, 0xb6, 0x34, 0x43, 0xf7, 0x03, 0xe6, 0xbc, 0x10, - 0xde, 0x2f, 0xe6, 0x29, 0x05, 0x19, 0x27, 0x51, 0xb2, 0x0a, 0x13, 0x41, 0x15, 0x7e, 0x85, 0x85, - 0xd8, 0x0a, 0xcb, 0xdd, 0x27, 0xa9, 0xe7, 0x40, 0xfe, 0x02, 0x68, 0xb6, 0x6b, 0x0d, 0x4d, 0x39, - 0x78, 0x84, 0x1d, 0xb7, 0xbe, 0x9c, 0x34, 0xe1, 0xad, 0x6c, 0x63, 0x87, 0xfc, 0x09, 0x13, 0xa6, - 0x76, 0xa8, 0xcb, 0x56, 0xbb, 0x85, 0x6e, 0xd2, 0x39, 0xa9, 0xb7, 0xc0, 0xbe, 0xa6, 0x21, 0xeb, - 0x72, 0x33, 0x9b, 0x86, 0x6e, 0x22, 0xb9, 0x19, 0xe1, 0x3c, 0xdf, 0x9f, 0xb3, 0x67, 0x1f, 0x06, - 0xbd, 0x19, 0x07, 0x7a, 0x3e, 0x96, 0x8f, 0xe7, 0xdc, 0x87, 0xb4, 0x14, 0x4f, 0xba, 0x74, 0x41, - 0xa4, 0x44, 0xd4, 0x9b, 0x3e, 0xe9, 0x5b, 0x90, 0x0b, 0xea, 0x38, 0xd0, 0x54, 0xbf, 0xcc, 0x3f, - 0x42, 0xa1, 0x1d, 0xe1, 0xf6, 0x38, 0x57, 0x2b, 0x52, 0x36, 0x70, 0xa8, 0xaa, 0xec, 0x07, 0x1a, - 0x26, 0x2b, 0xd8, 0x40, 0x0b, 0xbb, 0xc2, 0x5c, 0x89, 0x00, 0xbb, 0x12, 0x0b, 0x2c, 0xe2, 0x91, - 0x0e, 0x6d, 0xaa, 0xa3, 0x01, 0x16, 0x55, 0x1f, 0x7d, 0x5e, 0x7d, 0xdf, 0x28, 0x98, 0xea, 0xc2, - 0xf1, 0x05, 0xb8, 0x1a, 0xe1, 0xb9, 0x70, 0x21, 0xcf, 0x74, 0x69, 0x70, 0xdc, 0x43, 0xca, 0xbe, - 0xa2, 0x01, 0x44, 0x1c, 0xea, 0x64, 0xeb, 0x99, 0xa7, 0x43, 0x3d, 0xa3, 0x6a, 0xb7, 0x53, 0x1a, - 0xb2, 0x6e, 0xed, 0x43, 0x9c, 0x4e, 0x21, 0xfb, 0xb4, 0x28, 0xa3, 0x32, 0x8a, 0x39, 0xc0, 0xbe, - 0xa4, 0x21, 0xbb, 0xa3, 0x99, 0x81, 0xb0, 0x06, 0x81, 0x15, 0xb2, 0x4f, 0x87, 0xb2, 0x96, 0x7d, - 0x54, 0x02, 0xfc, 0x66, 0x9c, 0x44, 0x54, 0x35, 0x77, 0x5e, 0x55, 0xf7, 0x4e, 0x3c, 0x45, 0xfd, - 0xea, 0x1a, 0x56, 0x55, 0xf6, 0x0d, 0x0d, 0x39, 0xaf, 0x60, 0x5f, 0x4e, 0xcb, 0x11, 0x42, 0xff, - 0x5f, 0x40, 0x28, 0x5d, 0x7a, 0xda, 0xf2, 0x21, 0xdd, 0x86, 0xc9, 0x70, 0xfb, 0x99, 0x79, 0xaa, - 0x38, 0x96, 0xd4, 0x7f, 0xb9, 0x50, 0xff, 0x99, 0xec, 0x7b, 0x1a, 0x66, 0xf6, 0xd1, 0xda, 0x78, - 0x62, 0xa1, 0xae, 0xa2, 0xba, 0x56, 0xde, 0xe9, 0xaa, 0xab, 0x1c, 0x61, 0xc7, 0xc7, 0xb2, 0x8b, - 0xf5, 0x4c, 0x87, 0xce, 0x24, 0x1f, 0xe1, 0x22, 0x64, 0x50, 0x56, 0x1a, 0x7e, 0x99, 0xf9, 0x50, - 0x44, 0x59, 0x69, 0x70, 0x1b, 0x6b, 0xe5, 0x9d, 0xfb, 0x72, 0xad, 0x81, 0x92, 0x6b, 0x95, 0x30, - 0xed, 0x9e, 0xd1, 0x30, 0x7b, 0x1e, 0x89, 0xaf, 0xc4, 0x4a, 0x84, 0xe6, 0xf5, 0x81, 0x68, 0xa6, - 0x73, 0xfa, 0xbd, 0xa5, 0x61, 0x46, 0xbc, 0xb4, 0xa2, 0xc4, 0xf4, 0x2a, 0x6a, 0x54, 0x33, 0xf1, - 0x23, 0x0d, 0xb3, 0xe2, 0xe5, 0x55, 0x24, 0xa6, 0x5a, 0x45, 0x3f, 0xa1, 0x2d, 0x85, 0x17, 0x19, - 0xf8, 0x3d, 0xa0, 0xbd, 0xef, 0x65, 0x44, 0xb6, 0x60, 0x6c, 0xb7, 0x6d, 0x91, 0xbf, 0x13, 0x5e, - 0x34, 0x99, 0x62, 0xd2, 0x1b, 0x12, 0xd9, 0x83, 0x71, 0xef, 0xbe, 0x4a, 0xd8, 0xe4, 0x97, 0x03, - 0xe6, 0xdf, 0x01, 0x2e, 0xbc, 0x4e, 0x72, 0x22, 0xf6, 0x4b, 0xae, 0x77, 0x57, 0xec, 0x93, 0x5c, - 0xf8, 0x42, 0xb5, 0x0d, 0x19, 0x67, 0xc0, 0x91, 0x62, 0xd2, 0xed, 0x80, 0xf9, 0x27, 0x71, 0x3a, - 0x12, 0x0d, 0xa6, 0xa2, 0x67, 0x14, 0xb9, 0x3a, 0xf8, 0x58, 0x60, 0xae, 0x0d, 0x71, 0xe8, 0x39, - 0x5b, 0x89, 0x83, 0x6c, 0x25, 0x0e, 0xb1, 0x55, 0x7c, 0x67, 0xac, 0x2b, 0xef, 0xce, 0x0a, 0xd4, - 0xa7, 0xb3, 0x02, 0xf5, 0xf9, 0xac, 0x40, 0x3d, 0xff, 0x52, 0xf8, 0xe5, 0xe1, 0xd2, 0xa1, 0x66, - 0x1d, 0xb5, 0x6b, 0x9c, 0x62, 0x1c, 0xf3, 0xba, 0xd9, 0x54, 0x94, 0x92, 0x8a, 0x36, 0xaf, 0xa3, - 0x51, 0x37, 0x4b, 0x72, 0x53, 0x2b, 0x1d, 0x1a, 0x7c, 0xf8, 0xdb, 0xc8, 0x4a, 0xf0, 0x74, 0x4a, - 0xcf, 0xde, 0x45, 0x63, 0x73, 0x9f, 0x5b, 0xdb, 0xad, 0x3a, 0x7b, 0x07, 0xaa, 0xab, 0x8d, 0xbb, - 0x1f, 0x3d, 0x6e, 0x7c, 0x0f, 0x00, 0x00, 0xff, 0xff, 0x12, 0xb4, 0xb7, 0x71, 0x9a, 0x11, 0x00, - 0x00, +var fileDescriptor_364186d99410ec35 = []byte{ + // 840 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x98, 0x41, 0x6f, 0xd3, 0x4a, + 0x10, 0xc7, 0x9f, 0xdd, 0xa8, 0xef, 0x75, 0x92, 0x56, 0x4f, 0x7e, 0x6a, 0x1b, 0xf9, 0xb5, 0x69, + 0x30, 0x14, 0x2a, 0x68, 0x6c, 0x64, 0x2e, 0xd0, 0x16, 0x44, 0x9b, 0xb4, 0x6e, 0xd4, 0x02, 0xad, + 0x8b, 0x38, 0x70, 0xa9, 0x1c, 0x7b, 0x93, 0x5a, 0xa4, 0x76, 0xb0, 0x1d, 0x97, 0x1c, 0xe1, 0x53, + 0x70, 0x40, 0x9c, 0x51, 0xc5, 0x81, 0x4f, 0xc0, 0x19, 0x21, 0x84, 0xf8, 0x08, 0xa8, 0xf0, 0x09, + 0xf8, 0x04, 0xc8, 0x5e, 0xc7, 0xb1, 0x13, 0xa7, 0x4e, 0xaa, 0x70, 0xf0, 0xcd, 0xf6, 0xce, 0xcc, + 0xce, 0xfc, 0xf4, 0xdf, 0x9d, 0x5d, 0xc3, 0x82, 0xcd, 0x73, 0xb2, 0xae, 0x59, 0x92, 0xaa, 0x21, + 0x83, 0xab, 0x19, 0x0d, 0x99, 0x33, 0x91, 0x61, 0xab, 0x32, 0x62, 0x1b, 0x86, 0x6e, 0xe9, 0xd4, + 0x7f, 0x1a, 0xd2, 0xd9, 0xaa, 0xc9, 0xda, 0x3c, 0xeb, 0xdb, 0xd1, 0xb3, 0x36, 0xcf, 0x49, 0x72, + 0x1d, 0xdb, 0x5b, 0xad, 0x06, 0x32, 0xb1, 0x35, 0x3d, 0xdf, 0x1b, 0x2e, 0x38, 0x9c, 0xb5, 0x79, + 0xce, 0x40, 0x55, 0xb3, 0x77, 0x84, 0xb6, 0xf9, 0xf6, 0xc4, 0x78, 0xf0, 0x18, 0x59, 0x92, 0x37, + 0x36, 0xd7, 0x3d, 0x66, 0x23, 0x43, 0xad, 0xb6, 0xf0, 0x28, 0xf3, 0x93, 0x04, 0xd8, 0x6b, 0x5a, + 0x22, 0x7a, 0xde, 0x44, 0xa6, 0x45, 0xdd, 0x86, 0x54, 0x45, 0x57, 0x5a, 0x59, 0x22, 0x4f, 0x2c, + 0xa5, 0xf9, 0x2b, 0x6c, 0x44, 0xfa, 0x6c, 0xc7, 0x9c, 0xdd, 0xd0, 0x95, 0x96, 0xe8, 0x7a, 0x50, + 0x9b, 0x90, 0x76, 0x26, 0x3d, 0x3c, 0x42, 0x92, 0x82, 0x8c, 0x2c, 0xd9, 0x13, 0xa0, 0x0d, 0xc6, + 0xf3, 0x7d, 0x80, 0x2c, 0x69, 0xdb, 0xb5, 0x15, 0xe1, 0xd8, 0x7f, 0xa6, 0xf6, 0x61, 0x12, 0xe7, + 0xd7, 0x0e, 0x34, 0xe6, 0x06, 0x5a, 0xee, 0x1f, 0xe8, 0x89, 0x63, 0xae, 0xca, 0x92, 0xa5, 0xea, + 0x9a, 0x17, 0x30, 0x83, 0x43, 0xe0, 0x37, 0xfa, 0x25, 0x01, 0x29, 0x27, 0x51, 0x6a, 0x0d, 0x26, + 0xfc, 0x2a, 0xbc, 0x0a, 0x73, 0x91, 0x15, 0x16, 0xdb, 0x4f, 0x62, 0xc7, 0x81, 0x9a, 0x07, 0x68, + 0x34, 0x2b, 0x75, 0x55, 0x3e, 0x7c, 0x86, 0x5a, 0x6e, 0x7d, 0x19, 0x71, 0x02, 0x7f, 0xd9, 0x41, + 0x2d, 0x6a, 0x0e, 0x26, 0x4c, 0xb5, 0xa6, 0x49, 0x56, 0xd3, 0x40, 0x6e, 0xd2, 0x19, 0xb1, 0xf3, + 0x81, 0x79, 0x4f, 0x42, 0xda, 0xe5, 0x66, 0x36, 0x74, 0xcd, 0x44, 0xd4, 0x9d, 0x10, 0xe7, 0xc5, + 0xfe, 0x9c, 0xb1, 0x7d, 0x10, 0xf4, 0x56, 0x14, 0xe8, 0xc5, 0x48, 0x3e, 0xd8, 0xb9, 0x0f, 0x69, + 0x31, 0x9a, 0x74, 0xe1, 0x9c, 0x48, 0xb1, 0xa8, 0xb7, 0x3c, 0xd2, 0xf7, 0x20, 0xe3, 0xd7, 0x71, + 0xa8, 0x2a, 0x5e, 0x99, 0xff, 0x07, 0x42, 0x3b, 0x3a, 0xee, 0x70, 0x2e, 0x97, 0xc4, 0xb4, 0xef, + 0x50, 0x56, 0x98, 0x2f, 0x24, 0x4c, 0x96, 0x50, 0x1d, 0x59, 0xa8, 0x2d, 0xcc, 0xd5, 0x10, 0xb0, + 0x6b, 0x91, 0xc0, 0x42, 0x1e, 0xc9, 0xd0, 0xa6, 0x32, 0x1a, 0x60, 0x61, 0xf5, 0x91, 0xdd, 0xea, + 0xfb, 0x45, 0xc0, 0x54, 0x1b, 0x8e, 0x27, 0xc0, 0xb5, 0x10, 0xcf, 0xa5, 0x73, 0x79, 0x26, 0x4b, + 0x83, 0xe3, 0x18, 0x29, 0xf3, 0x8e, 0x04, 0x10, 0xd0, 0x50, 0x3b, 0x5b, 0xc7, 0x3c, 0x19, 0xea, + 0x19, 0xd5, 0x72, 0x3b, 0x25, 0x21, 0xed, 0xd6, 0x3e, 0xc4, 0xee, 0x14, 0xb0, 0x4f, 0x8a, 0x32, + 0x4a, 0xa3, 0xe8, 0x03, 0xcc, 0x5b, 0x12, 0xd2, 0xbb, 0xaa, 0xe9, 0x0b, 0x6b, 0x10, 0x58, 0x01, + 0xfb, 0x64, 0x28, 0x6b, 0xc5, 0x43, 0xc5, 0xc3, 0x3f, 0xfa, 0x49, 0x48, 0x55, 0xb3, 0xdd, 0xaa, + 0x7a, 0x74, 0x82, 0x15, 0xf5, 0xb7, 0x6b, 0x58, 0x56, 0x98, 0x0f, 0x24, 0x64, 0x70, 0xc1, 0x9e, + 0x9c, 0x56, 0x42, 0x84, 0xae, 0x9e, 0x43, 0x28, 0x59, 0x7a, 0xda, 0xf6, 0x20, 0xdd, 0x87, 0xc9, + 0xe0, 0xf2, 0x33, 0xb3, 0x44, 0x7e, 0x2c, 0x6e, 0xfd, 0x65, 0x02, 0xeb, 0xcf, 0x64, 0x3e, 0x93, + 0x30, 0x7d, 0x80, 0xac, 0xcd, 0x17, 0x16, 0xd2, 0x14, 0xa4, 0xac, 0x17, 0x77, 0xdb, 0xea, 0x2a, + 0x86, 0xd8, 0x71, 0x91, 0xec, 0x22, 0x3d, 0x93, 0xa1, 0x33, 0xd1, 0x43, 0xb8, 0x0c, 0x29, 0x24, + 0xc9, 0x75, 0xaf, 0xcc, 0x6c, 0x20, 0xa2, 0x24, 0xd7, 0xd9, 0xcd, 0xf5, 0xe2, 0xee, 0x63, 0xa9, + 0x52, 0x47, 0xa2, 0x6b, 0x15, 0xd3, 0xed, 0x5e, 0x91, 0x30, 0xd3, 0x8d, 0xc4, 0x53, 0x62, 0x29, + 0x44, 0xf3, 0xe6, 0x40, 0x34, 0x93, 0xd9, 0xfd, 0x3e, 0x92, 0x30, 0x2d, 0x5c, 0x58, 0x51, 0x42, + 0x72, 0x15, 0x35, 0xaa, 0x9e, 0xf8, 0x95, 0x84, 0x19, 0xe1, 0xe2, 0x2a, 0x12, 0x12, 0xad, 0xa2, + 0x3f, 0xb0, 0x2c, 0xf9, 0x37, 0x29, 0xf8, 0xd7, 0xa7, 0x7d, 0x80, 0x33, 0xa2, 0xb6, 0x61, 0x6c, + 0xaf, 0x69, 0x51, 0x0b, 0x31, 0x17, 0x4d, 0x3a, 0x1f, 0x77, 0x43, 0xa2, 0xf6, 0x61, 0x1c, 0x9f, + 0x57, 0x29, 0x26, 0xfe, 0x72, 0x40, 0x5f, 0x1e, 0xe0, 0xc0, 0xeb, 0x24, 0x27, 0xa0, 0x7e, 0xc9, + 0x75, 0xce, 0x8a, 0x7d, 0x92, 0x0b, 0x1e, 0xa8, 0x76, 0x20, 0xe5, 0x34, 0x38, 0x2a, 0x1f, 0x77, + 0x3a, 0xa0, 0x2f, 0xc5, 0x76, 0x47, 0x4a, 0x85, 0xa9, 0xf0, 0x1e, 0x45, 0x5d, 0x1f, 0xbc, 0x2d, + 0xd0, 0x37, 0x86, 0xd8, 0xf4, 0x9c, 0xa9, 0x84, 0x41, 0xa6, 0x12, 0x86, 0x98, 0x2a, 0x7a, 0x65, + 0x6c, 0x1c, 0x7d, 0x3a, 0xcb, 0x11, 0xdf, 0xce, 0x72, 0xc4, 0xf7, 0xb3, 0x1c, 0xf1, 0xfa, 0x47, + 0xee, 0xaf, 0xa7, 0x77, 0x6b, 0xaa, 0x75, 0xd4, 0xac, 0xb0, 0xb2, 0x7e, 0xcc, 0x69, 0x66, 0x43, + 0x96, 0x0b, 0x0a, 0xb2, 0x39, 0x0d, 0xe9, 0x55, 0xb3, 0x20, 0x35, 0xd4, 0x42, 0x4d, 0xe7, 0x7a, + 0xfe, 0x97, 0xac, 0xfa, 0xaf, 0xa7, 0xe4, 0xcc, 0x43, 0xa4, 0x6f, 0x1d, 0xb0, 0xeb, 0x7b, 0x65, + 0x27, 0x01, 0x5f, 0x7a, 0x95, 0x71, 0xf7, 0xcf, 0xc7, 0xad, 0xdf, 0x01, 0x00, 0x00, 0xff, 0xff, + 0x27, 0x5d, 0xa8, 0x45, 0xbd, 0x11, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. var _ context.Context -var _ grpc.ClientConn +var _ grpc3.ClientConn // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 +const _ = grpc3.SupportPackageIsVersion4 // ContainerServiceClient is the client API for ContainerService service. // @@ -1589,35 +1589,35 @@ type ContainerServiceClient interface { // response immediately. After new block in morph chain, request is verified // by inner ring nodes. After one more block in morph chain, container // added into smart-contract storage. - Put(ctx context.Context, in *PutRequest, opts ...grpc.CallOption) (*PutResponse, error) + Put(ctx context.Context, in *PutRequest, opts ...grpc3.CallOption) (*PutResponse, error) // Delete invokes 'Delete' method in container smart-contract and returns // response immediately. After new block in morph chain, request is verified // by inner ring nodes. After one more block in morph chain, container // removed from smart-contract storage. - Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteResponse, error) + Delete(ctx context.Context, in *DeleteRequest, opts ...grpc3.CallOption) (*DeleteResponse, error) // Get returns container from container smart-contract storage. - Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*GetResponse, error) + Get(ctx context.Context, in *GetRequest, opts ...grpc3.CallOption) (*GetResponse, error) // List returns all owner's containers from container smart-contract // storage. - List(ctx context.Context, in *ListRequest, opts ...grpc.CallOption) (*ListResponse, error) + List(ctx context.Context, in *ListRequest, opts ...grpc3.CallOption) (*ListResponse, error) // SetExtendedACL invokes 'SetEACL' method in container smart-contract and // returns response immediately. After new block in morph chain, // Extended ACL added into smart-contract storage. - SetExtendedACL(ctx context.Context, in *SetExtendedACLRequest, opts ...grpc.CallOption) (*SetExtendedACLResponse, error) + SetExtendedACL(ctx context.Context, in *SetExtendedACLRequest, opts ...grpc3.CallOption) (*SetExtendedACLResponse, error) // GetExtendedACL returns Extended ACL table and signature from container // smart-contract storage. - GetExtendedACL(ctx context.Context, in *GetExtendedACLRequest, opts ...grpc.CallOption) (*GetExtendedACLResponse, error) + GetExtendedACL(ctx context.Context, in *GetExtendedACLRequest, opts ...grpc3.CallOption) (*GetExtendedACLResponse, error) } type containerServiceClient struct { - cc *grpc.ClientConn + cc *grpc3.ClientConn } -func NewContainerServiceClient(cc *grpc.ClientConn) ContainerServiceClient { +func NewContainerServiceClient(cc *grpc3.ClientConn) ContainerServiceClient { return &containerServiceClient{cc} } -func (c *containerServiceClient) Put(ctx context.Context, in *PutRequest, opts ...grpc.CallOption) (*PutResponse, error) { +func (c *containerServiceClient) Put(ctx context.Context, in *PutRequest, opts ...grpc3.CallOption) (*PutResponse, error) { out := new(PutResponse) err := c.cc.Invoke(ctx, "/neo.fs.v2.container.ContainerService/Put", in, out, opts...) if err != nil { @@ -1626,7 +1626,7 @@ func (c *containerServiceClient) Put(ctx context.Context, in *PutRequest, opts . return out, nil } -func (c *containerServiceClient) Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteResponse, error) { +func (c *containerServiceClient) Delete(ctx context.Context, in *DeleteRequest, opts ...grpc3.CallOption) (*DeleteResponse, error) { out := new(DeleteResponse) err := c.cc.Invoke(ctx, "/neo.fs.v2.container.ContainerService/Delete", in, out, opts...) if err != nil { @@ -1635,7 +1635,7 @@ func (c *containerServiceClient) Delete(ctx context.Context, in *DeleteRequest, return out, nil } -func (c *containerServiceClient) Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*GetResponse, error) { +func (c *containerServiceClient) Get(ctx context.Context, in *GetRequest, opts ...grpc3.CallOption) (*GetResponse, error) { out := new(GetResponse) err := c.cc.Invoke(ctx, "/neo.fs.v2.container.ContainerService/Get", in, out, opts...) if err != nil { @@ -1644,7 +1644,7 @@ func (c *containerServiceClient) Get(ctx context.Context, in *GetRequest, opts . return out, nil } -func (c *containerServiceClient) List(ctx context.Context, in *ListRequest, opts ...grpc.CallOption) (*ListResponse, error) { +func (c *containerServiceClient) List(ctx context.Context, in *ListRequest, opts ...grpc3.CallOption) (*ListResponse, error) { out := new(ListResponse) err := c.cc.Invoke(ctx, "/neo.fs.v2.container.ContainerService/List", in, out, opts...) if err != nil { @@ -1653,7 +1653,7 @@ func (c *containerServiceClient) List(ctx context.Context, in *ListRequest, opts return out, nil } -func (c *containerServiceClient) SetExtendedACL(ctx context.Context, in *SetExtendedACLRequest, opts ...grpc.CallOption) (*SetExtendedACLResponse, error) { +func (c *containerServiceClient) SetExtendedACL(ctx context.Context, in *SetExtendedACLRequest, opts ...grpc3.CallOption) (*SetExtendedACLResponse, error) { out := new(SetExtendedACLResponse) err := c.cc.Invoke(ctx, "/neo.fs.v2.container.ContainerService/SetExtendedACL", in, out, opts...) if err != nil { @@ -1662,7 +1662,7 @@ func (c *containerServiceClient) SetExtendedACL(ctx context.Context, in *SetExte return out, nil } -func (c *containerServiceClient) GetExtendedACL(ctx context.Context, in *GetExtendedACLRequest, opts ...grpc.CallOption) (*GetExtendedACLResponse, error) { +func (c *containerServiceClient) GetExtendedACL(ctx context.Context, in *GetExtendedACLRequest, opts ...grpc3.CallOption) (*GetExtendedACLResponse, error) { out := new(GetExtendedACLResponse) err := c.cc.Invoke(ctx, "/neo.fs.v2.container.ContainerService/GetExtendedACL", in, out, opts...) if err != nil { @@ -1720,11 +1720,11 @@ func (*UnimplementedContainerServiceServer) GetExtendedACL(ctx context.Context, return nil, status.Errorf(codes.Unimplemented, "method GetExtendedACL not implemented") } -func RegisterContainerServiceServer(s *grpc.Server, srv ContainerServiceServer) { +func RegisterContainerServiceServer(s *grpc3.Server, srv ContainerServiceServer) { s.RegisterService(&_ContainerService_serviceDesc, srv) } -func _ContainerService_Put_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _ContainerService_Put_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc3.UnaryServerInterceptor) (interface{}, error) { in := new(PutRequest) if err := dec(in); err != nil { return nil, err @@ -1732,7 +1732,7 @@ func _ContainerService_Put_Handler(srv interface{}, ctx context.Context, dec fun if interceptor == nil { return srv.(ContainerServiceServer).Put(ctx, in) } - info := &grpc.UnaryServerInfo{ + info := &grpc3.UnaryServerInfo{ Server: srv, FullMethod: "/neo.fs.v2.container.ContainerService/Put", } @@ -1742,7 +1742,7 @@ func _ContainerService_Put_Handler(srv interface{}, ctx context.Context, dec fun return interceptor(ctx, in, info, handler) } -func _ContainerService_Delete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _ContainerService_Delete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc3.UnaryServerInterceptor) (interface{}, error) { in := new(DeleteRequest) if err := dec(in); err != nil { return nil, err @@ -1750,7 +1750,7 @@ func _ContainerService_Delete_Handler(srv interface{}, ctx context.Context, dec if interceptor == nil { return srv.(ContainerServiceServer).Delete(ctx, in) } - info := &grpc.UnaryServerInfo{ + info := &grpc3.UnaryServerInfo{ Server: srv, FullMethod: "/neo.fs.v2.container.ContainerService/Delete", } @@ -1760,7 +1760,7 @@ func _ContainerService_Delete_Handler(srv interface{}, ctx context.Context, dec return interceptor(ctx, in, info, handler) } -func _ContainerService_Get_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _ContainerService_Get_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc3.UnaryServerInterceptor) (interface{}, error) { in := new(GetRequest) if err := dec(in); err != nil { return nil, err @@ -1768,7 +1768,7 @@ func _ContainerService_Get_Handler(srv interface{}, ctx context.Context, dec fun if interceptor == nil { return srv.(ContainerServiceServer).Get(ctx, in) } - info := &grpc.UnaryServerInfo{ + info := &grpc3.UnaryServerInfo{ Server: srv, FullMethod: "/neo.fs.v2.container.ContainerService/Get", } @@ -1778,7 +1778,7 @@ func _ContainerService_Get_Handler(srv interface{}, ctx context.Context, dec fun return interceptor(ctx, in, info, handler) } -func _ContainerService_List_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _ContainerService_List_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc3.UnaryServerInterceptor) (interface{}, error) { in := new(ListRequest) if err := dec(in); err != nil { return nil, err @@ -1786,7 +1786,7 @@ func _ContainerService_List_Handler(srv interface{}, ctx context.Context, dec fu if interceptor == nil { return srv.(ContainerServiceServer).List(ctx, in) } - info := &grpc.UnaryServerInfo{ + info := &grpc3.UnaryServerInfo{ Server: srv, FullMethod: "/neo.fs.v2.container.ContainerService/List", } @@ -1796,7 +1796,7 @@ func _ContainerService_List_Handler(srv interface{}, ctx context.Context, dec fu return interceptor(ctx, in, info, handler) } -func _ContainerService_SetExtendedACL_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _ContainerService_SetExtendedACL_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc3.UnaryServerInterceptor) (interface{}, error) { in := new(SetExtendedACLRequest) if err := dec(in); err != nil { return nil, err @@ -1804,7 +1804,7 @@ func _ContainerService_SetExtendedACL_Handler(srv interface{}, ctx context.Conte if interceptor == nil { return srv.(ContainerServiceServer).SetExtendedACL(ctx, in) } - info := &grpc.UnaryServerInfo{ + info := &grpc3.UnaryServerInfo{ Server: srv, FullMethod: "/neo.fs.v2.container.ContainerService/SetExtendedACL", } @@ -1814,7 +1814,7 @@ func _ContainerService_SetExtendedACL_Handler(srv interface{}, ctx context.Conte return interceptor(ctx, in, info, handler) } -func _ContainerService_GetExtendedACL_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _ContainerService_GetExtendedACL_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc3.UnaryServerInterceptor) (interface{}, error) { in := new(GetExtendedACLRequest) if err := dec(in); err != nil { return nil, err @@ -1822,7 +1822,7 @@ func _ContainerService_GetExtendedACL_Handler(srv interface{}, ctx context.Conte if interceptor == nil { return srv.(ContainerServiceServer).GetExtendedACL(ctx, in) } - info := &grpc.UnaryServerInfo{ + info := &grpc3.UnaryServerInfo{ Server: srv, FullMethod: "/neo.fs.v2.container.ContainerService/GetExtendedACL", } @@ -1832,10 +1832,10 @@ func _ContainerService_GetExtendedACL_Handler(srv interface{}, ctx context.Conte return interceptor(ctx, in, info, handler) } -var _ContainerService_serviceDesc = grpc.ServiceDesc{ +var _ContainerService_serviceDesc = grpc3.ServiceDesc{ ServiceName: "neo.fs.v2.container.ContainerService", HandlerType: (*ContainerServiceServer)(nil), - Methods: []grpc.MethodDesc{ + Methods: []grpc3.MethodDesc{ { MethodName: "Put", Handler: _ContainerService_Put_Handler, @@ -1861,8 +1861,8 @@ var _ContainerService_serviceDesc = grpc.ServiceDesc{ Handler: _ContainerService_GetExtendedACL_Handler, }, }, - Streams: []grpc.StreamDesc{}, - Metadata: "v2/container/service.proto", + Streams: []grpc3.StreamDesc{}, + Metadata: "v2/container/grpc/service.proto", } func (m *PutRequest) Marshal() (dAtA []byte, err error) { @@ -3708,7 +3708,7 @@ func (m *PutRequest) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.MetaHeader == nil { - m.MetaHeader = &service.RequestMetaHeader{} + m.MetaHeader = &grpc.RequestMetaHeader{} } if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -3744,7 +3744,7 @@ func (m *PutRequest) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.VerifyHeader == nil { - m.VerifyHeader = &service.RequestVerificationHeader{} + m.VerifyHeader = &grpc.RequestVerificationHeader{} } if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -4028,7 +4028,7 @@ func (m *PutResponse) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.MetaHeader == nil { - m.MetaHeader = &service.ResponseMetaHeader{} + m.MetaHeader = &grpc.ResponseMetaHeader{} } if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -4064,7 +4064,7 @@ func (m *PutResponse) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.VerifyHeader == nil { - m.VerifyHeader = &service.ResponseVerificationHeader{} + m.VerifyHeader = &grpc.ResponseVerificationHeader{} } if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -4154,7 +4154,7 @@ func (m *PutResponse_Body) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.ContainerId == nil { - m.ContainerId = &refs.ContainerID{} + m.ContainerId = &grpc1.ContainerID{} } if err := m.ContainerId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -4280,7 +4280,7 @@ func (m *DeleteRequest) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.MetaHeader == nil { - m.MetaHeader = &service.RequestMetaHeader{} + m.MetaHeader = &grpc.RequestMetaHeader{} } if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -4316,7 +4316,7 @@ func (m *DeleteRequest) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.VerifyHeader == nil { - m.VerifyHeader = &service.RequestVerificationHeader{} + m.VerifyHeader = &grpc.RequestVerificationHeader{} } if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -4406,7 +4406,7 @@ func (m *DeleteRequest_Body) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.ContainerId == nil { - m.ContainerId = &refs.ContainerID{} + m.ContainerId = &grpc1.ContainerID{} } if err := m.ContainerId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -4566,7 +4566,7 @@ func (m *DeleteResponse) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.MetaHeader == nil { - m.MetaHeader = &service.ResponseMetaHeader{} + m.MetaHeader = &grpc.ResponseMetaHeader{} } if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -4602,7 +4602,7 @@ func (m *DeleteResponse) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.VerifyHeader == nil { - m.VerifyHeader = &service.ResponseVerificationHeader{} + m.VerifyHeader = &grpc.ResponseVerificationHeader{} } if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -4782,7 +4782,7 @@ func (m *GetRequest) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.MetaHeader == nil { - m.MetaHeader = &service.RequestMetaHeader{} + m.MetaHeader = &grpc.RequestMetaHeader{} } if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -4818,7 +4818,7 @@ func (m *GetRequest) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.VerifyHeader == nil { - m.VerifyHeader = &service.RequestVerificationHeader{} + m.VerifyHeader = &grpc.RequestVerificationHeader{} } if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -4908,7 +4908,7 @@ func (m *GetRequest_Body) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.ContainerId == nil { - m.ContainerId = &refs.ContainerID{} + m.ContainerId = &grpc1.ContainerID{} } if err := m.ContainerId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -5034,7 +5034,7 @@ func (m *GetResponse) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.MetaHeader == nil { - m.MetaHeader = &service.ResponseMetaHeader{} + m.MetaHeader = &grpc.ResponseMetaHeader{} } if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -5070,7 +5070,7 @@ func (m *GetResponse) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.VerifyHeader == nil { - m.VerifyHeader = &service.ResponseVerificationHeader{} + m.VerifyHeader = &grpc.ResponseVerificationHeader{} } if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -5286,7 +5286,7 @@ func (m *ListRequest) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.MetaHeader == nil { - m.MetaHeader = &service.RequestMetaHeader{} + m.MetaHeader = &grpc.RequestMetaHeader{} } if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -5322,7 +5322,7 @@ func (m *ListRequest) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.VerifyHeader == nil { - m.VerifyHeader = &service.RequestVerificationHeader{} + m.VerifyHeader = &grpc.RequestVerificationHeader{} } if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -5412,7 +5412,7 @@ func (m *ListRequest_Body) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.OwnerId == nil { - m.OwnerId = &refs.OwnerID{} + m.OwnerId = &grpc1.OwnerID{} } if err := m.OwnerId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -5538,7 +5538,7 @@ func (m *ListResponse) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.MetaHeader == nil { - m.MetaHeader = &service.ResponseMetaHeader{} + m.MetaHeader = &grpc.ResponseMetaHeader{} } if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -5574,7 +5574,7 @@ func (m *ListResponse) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.VerifyHeader == nil { - m.VerifyHeader = &service.ResponseVerificationHeader{} + m.VerifyHeader = &grpc.ResponseVerificationHeader{} } if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -5663,7 +5663,7 @@ func (m *ListResponse_Body) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ContainerIds = append(m.ContainerIds, &refs.ContainerID{}) + m.ContainerIds = append(m.ContainerIds, &grpc1.ContainerID{}) if err := m.ContainerIds[len(m.ContainerIds)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -5788,7 +5788,7 @@ func (m *SetExtendedACLRequest) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.MetaHeader == nil { - m.MetaHeader = &service.RequestMetaHeader{} + m.MetaHeader = &grpc.RequestMetaHeader{} } if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -5824,7 +5824,7 @@ func (m *SetExtendedACLRequest) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.VerifyHeader == nil { - m.VerifyHeader = &service.RequestVerificationHeader{} + m.VerifyHeader = &grpc.RequestVerificationHeader{} } if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -5914,7 +5914,7 @@ func (m *SetExtendedACLRequest_Body) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.Eacl == nil { - m.Eacl = &acl.EACLTable{} + m.Eacl = &grpc2.EACLTable{} } if err := m.Eacl.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -6074,7 +6074,7 @@ func (m *SetExtendedACLResponse) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.MetaHeader == nil { - m.MetaHeader = &service.ResponseMetaHeader{} + m.MetaHeader = &grpc.ResponseMetaHeader{} } if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -6110,7 +6110,7 @@ func (m *SetExtendedACLResponse) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.VerifyHeader == nil { - m.VerifyHeader = &service.ResponseVerificationHeader{} + m.VerifyHeader = &grpc.ResponseVerificationHeader{} } if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -6290,7 +6290,7 @@ func (m *GetExtendedACLRequest) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.MetaHeader == nil { - m.MetaHeader = &service.RequestMetaHeader{} + m.MetaHeader = &grpc.RequestMetaHeader{} } if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -6326,7 +6326,7 @@ func (m *GetExtendedACLRequest) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.VerifyHeader == nil { - m.VerifyHeader = &service.RequestVerificationHeader{} + m.VerifyHeader = &grpc.RequestVerificationHeader{} } if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -6416,7 +6416,7 @@ func (m *GetExtendedACLRequest_Body) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.ContainerId == nil { - m.ContainerId = &refs.ContainerID{} + m.ContainerId = &grpc1.ContainerID{} } if err := m.ContainerId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -6542,7 +6542,7 @@ func (m *GetExtendedACLResponse) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.MetaHeader == nil { - m.MetaHeader = &service.ResponseMetaHeader{} + m.MetaHeader = &grpc.ResponseMetaHeader{} } if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -6578,7 +6578,7 @@ func (m *GetExtendedACLResponse) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.VerifyHeader == nil { - m.VerifyHeader = &service.ResponseVerificationHeader{} + m.VerifyHeader = &grpc.ResponseVerificationHeader{} } if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -6668,7 +6668,7 @@ func (m *GetExtendedACLResponse_Body) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.Eacl == nil { - m.Eacl = &acl.EACLTable{} + m.Eacl = &grpc2.EACLTable{} } if err := m.Eacl.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err diff --git a/v2/container/signature.go b/v2/container/grpc/signature.go similarity index 100% rename from v2/container/signature.go rename to v2/container/grpc/signature.go diff --git a/v2/container/types.go b/v2/container/grpc/types.go similarity index 89% rename from v2/container/types.go rename to v2/container/grpc/types.go index eb74ead..3678b56 100644 --- a/v2/container/types.go +++ b/v2/container/grpc/types.go @@ -1,8 +1,8 @@ package container import ( - "github.com/nspcc-dev/neofs-api-go/v2/netmap" - "github.com/nspcc-dev/neofs-api-go/v2/refs" + netmap "github.com/nspcc-dev/neofs-api-go/v2/netmap/grpc" + refs "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" ) // SetKey sets key to the container attribute. diff --git a/v2/container/types.pb.go b/v2/container/grpc/types.pb.go similarity index 84% rename from v2/container/types.pb.go rename to v2/container/grpc/types.pb.go index 175aeeb..9cd174d 100644 --- a/v2/container/types.pb.go +++ b/v2/container/grpc/types.pb.go @@ -1,13 +1,13 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: v2/container/types.proto +// source: v2/container/grpc/types.proto package container import ( fmt "fmt" proto "github.com/golang/protobuf/proto" - netmap "github.com/nspcc-dev/neofs-api-go/v2/netmap" - refs "github.com/nspcc-dev/neofs-api-go/v2/refs" + grpc1 "github.com/nspcc-dev/neofs-api-go/v2/netmap/grpc" + grpc "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" io "io" math "math" math_bits "math/bits" @@ -30,7 +30,7 @@ const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package // SHA256 hash of stable-marshalled container message. type Container struct { // OwnerID carries identifier of the container owner. - OwnerId *refs.OwnerID `protobuf:"bytes,1,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"` + OwnerId *grpc.OwnerID `protobuf:"bytes,1,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"` // Nonce is a 16 byte UUID, used to avoid collisions of container id. Nonce []byte `protobuf:"bytes,2,opt,name=nonce,proto3" json:"nonce,omitempty"` // BasicACL contains access control rules for owner, system, others groups and @@ -39,17 +39,17 @@ type Container struct { // Attributes define any immutable characteristics of container. Attributes []*Container_Attribute `protobuf:"bytes,4,rep,name=attributes,proto3" json:"attributes,omitempty"` // Placement policy for the object inside the container. - PlacementPolicy *netmap.PlacementPolicy `protobuf:"bytes,5,opt,name=placement_policy,json=placementPolicy,proto3" json:"placement_policy,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + PlacementPolicy *grpc1.PlacementPolicy `protobuf:"bytes,5,opt,name=placement_policy,json=placementPolicy,proto3" json:"placement_policy,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *Container) Reset() { *m = Container{} } func (m *Container) String() string { return proto.CompactTextString(m) } func (*Container) ProtoMessage() {} func (*Container) Descriptor() ([]byte, []int) { - return fileDescriptor_ece71f25e6ae314e, []int{0} + return fileDescriptor_3bfd95a81c72c35c, []int{0} } func (m *Container) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -78,7 +78,7 @@ func (m *Container) XXX_DiscardUnknown() { var xxx_messageInfo_Container proto.InternalMessageInfo -func (m *Container) GetOwnerId() *refs.OwnerID { +func (m *Container) GetOwnerId() *grpc.OwnerID { if m != nil { return m.OwnerId } @@ -106,7 +106,7 @@ func (m *Container) GetAttributes() []*Container_Attribute { return nil } -func (m *Container) GetPlacementPolicy() *netmap.PlacementPolicy { +func (m *Container) GetPlacementPolicy() *grpc1.PlacementPolicy { if m != nil { return m.PlacementPolicy } @@ -128,7 +128,7 @@ func (m *Container_Attribute) Reset() { *m = Container_Attribute{} } func (m *Container_Attribute) String() string { return proto.CompactTextString(m) } func (*Container_Attribute) ProtoMessage() {} func (*Container_Attribute) Descriptor() ([]byte, []int) { - return fileDescriptor_ece71f25e6ae314e, []int{0, 0} + return fileDescriptor_3bfd95a81c72c35c, []int{0, 0} } func (m *Container_Attribute) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -176,33 +176,33 @@ func init() { proto.RegisterType((*Container_Attribute)(nil), "neo.fs.v2.container.Container.Attribute") } -func init() { proto.RegisterFile("v2/container/types.proto", fileDescriptor_ece71f25e6ae314e) } +func init() { proto.RegisterFile("v2/container/grpc/types.proto", fileDescriptor_3bfd95a81c72c35c) } -var fileDescriptor_ece71f25e6ae314e = []byte{ - // 357 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x51, 0xcd, 0x4a, 0xc3, 0x40, - 0x10, 0x36, 0xad, 0xd5, 0x66, 0xab, 0x58, 0x52, 0x7f, 0x42, 0x85, 0x10, 0x3d, 0xe5, 0xd2, 0x0d, - 0xa4, 0x17, 0xc1, 0x53, 0x55, 0xc4, 0x82, 0x68, 0x89, 0x37, 0x2f, 0x65, 0xb3, 0x9d, 0xd6, 0xc5, - 0x74, 0x77, 0xc9, 0x6e, 0x23, 0x7d, 0x13, 0x9f, 0xc1, 0x97, 0xf0, 0xea, 0xd1, 0x47, 0x90, 0xfa, - 0x22, 0x92, 0x84, 0xc6, 0x08, 0xde, 0x66, 0xbe, 0xfd, 0xbe, 0x9d, 0xef, 0x9b, 0x41, 0x76, 0x1a, - 0xf8, 0x54, 0x70, 0x4d, 0x18, 0x87, 0xc4, 0xd7, 0x4b, 0x09, 0x0a, 0xcb, 0x44, 0x68, 0x61, 0x75, - 0x38, 0x08, 0x3c, 0x55, 0x38, 0x0d, 0x70, 0x49, 0xe8, 0x1e, 0xa4, 0x81, 0xcf, 0x41, 0xcf, 0x89, - 0xac, 0x72, 0xbb, 0x9d, 0x34, 0xf0, 0x13, 0x98, 0xaa, 0x2a, 0x78, 0xfa, 0x5e, 0x43, 0xe6, 0xe5, - 0x5a, 0x69, 0x05, 0xa8, 0x29, 0x5e, 0x38, 0x24, 0x63, 0x36, 0xb1, 0x0d, 0xd7, 0xf0, 0x5a, 0xc1, - 0x11, 0xfe, 0x9d, 0x90, 0x89, 0xf1, 0x7d, 0xf6, 0x3e, 0xbc, 0x0a, 0xb7, 0x73, 0xe2, 0x70, 0x62, - 0xed, 0xa3, 0x06, 0x17, 0x9c, 0x82, 0x5d, 0x73, 0x0d, 0x6f, 0x27, 0x2c, 0x1a, 0xeb, 0x18, 0x99, - 0x11, 0x51, 0x8c, 0x8e, 0x09, 0x8d, 0xed, 0xba, 0x6b, 0x78, 0xbb, 0x61, 0x33, 0x07, 0x06, 0x34, - 0xb6, 0x6e, 0x10, 0x22, 0x5a, 0x27, 0x2c, 0x5a, 0x68, 0x50, 0xf6, 0xa6, 0x5b, 0xf7, 0x5a, 0x81, - 0x87, 0xff, 0x89, 0x82, 0x4b, 0x6b, 0x78, 0xb0, 0x16, 0x84, 0x15, 0xad, 0x75, 0x8b, 0xda, 0x32, - 0x26, 0x14, 0xe6, 0xc0, 0xf5, 0x58, 0x8a, 0x98, 0xd1, 0xa5, 0xdd, 0xc8, 0x8d, 0x9f, 0x54, 0xfe, - 0x2b, 0x96, 0x81, 0x47, 0x6b, 0xe6, 0x28, 0x27, 0x86, 0x7b, 0xf2, 0x2f, 0xd0, 0xed, 0x23, 0xb3, - 0x1c, 0x63, 0xb5, 0x51, 0xfd, 0x19, 0x96, 0xf9, 0x1a, 0xcc, 0x30, 0x2b, 0xb3, 0xa4, 0x29, 0x89, - 0x17, 0x45, 0x52, 0x33, 0x2c, 0x9a, 0x0b, 0xfa, 0xb1, 0x72, 0x8c, 0xcf, 0x95, 0x63, 0x7c, 0xad, - 0x1c, 0xe3, 0xf5, 0xdb, 0xd9, 0x78, 0x3c, 0x9b, 0x31, 0xfd, 0xb4, 0x88, 0x30, 0x15, 0x73, 0x9f, - 0x2b, 0x49, 0x69, 0x6f, 0x02, 0xa9, 0xcf, 0x41, 0x4c, 0x55, 0x8f, 0x48, 0xd6, 0x9b, 0x09, 0xbf, - 0x7a, 0xd0, 0xf3, 0xb2, 0x7a, 0xab, 0x1d, 0xde, 0x81, 0xb8, 0x7e, 0xc0, 0x83, 0xd1, 0x30, 0xf3, - 0x5d, 0xa6, 0x8f, 0xb6, 0xf2, 0x6b, 0xf5, 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff, 0x38, 0xf7, 0x99, - 0x45, 0x0a, 0x02, 0x00, 0x00, +var fileDescriptor_3bfd95a81c72c35c = []byte{ + // 363 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x51, 0xc1, 0x4e, 0xea, 0x40, + 0x14, 0x7d, 0x85, 0xc7, 0x7b, 0x74, 0xd0, 0x48, 0xaa, 0xd1, 0xa6, 0xc6, 0xa6, 0xba, 0xea, 0x86, + 0x99, 0xa4, 0x2c, 0x8d, 0x0b, 0xd4, 0x18, 0x49, 0x8c, 0x92, 0xba, 0x73, 0x43, 0xa6, 0xc3, 0x05, + 0x1a, 0xcb, 0xcc, 0xa4, 0x33, 0xd4, 0xf0, 0x27, 0x7e, 0x83, 0x3f, 0xe1, 0xd6, 0xa5, 0x9f, 0x60, + 0xf0, 0x47, 0x4c, 0xdb, 0x50, 0x31, 0xb8, 0x9b, 0x3b, 0xf7, 0xdc, 0x73, 0xcf, 0x39, 0x17, 0x1d, + 0x65, 0x01, 0x61, 0x82, 0x6b, 0x1a, 0x73, 0x48, 0xc9, 0x24, 0x95, 0x8c, 0xe8, 0x85, 0x04, 0x85, + 0x65, 0x2a, 0xb4, 0xb0, 0x76, 0x39, 0x08, 0x3c, 0x56, 0x38, 0x0b, 0x70, 0x85, 0x72, 0x9c, 0x2c, + 0x20, 0x1c, 0xf4, 0x8c, 0xca, 0x8d, 0x01, 0xc7, 0xce, 0x02, 0x92, 0xc2, 0x58, 0x6d, 0x74, 0x4e, + 0x5e, 0x6b, 0xc8, 0xbc, 0x58, 0x71, 0x58, 0x01, 0x6a, 0x8a, 0x27, 0x0e, 0xe9, 0x30, 0x1e, 0xd9, + 0x86, 0x67, 0xf8, 0xad, 0xe0, 0x00, 0x7f, 0xef, 0xca, 0x19, 0xf0, 0x5d, 0xde, 0xef, 0x5f, 0x86, + 0xff, 0x0b, 0x60, 0x7f, 0x64, 0xed, 0xa1, 0x06, 0x17, 0x9c, 0x81, 0x5d, 0xf3, 0x0c, 0x7f, 0x2b, + 0x2c, 0x0b, 0xeb, 0x10, 0x99, 0x11, 0x55, 0x31, 0x1b, 0x52, 0x96, 0xd8, 0x75, 0xcf, 0xf0, 0xb7, + 0xc3, 0x66, 0xf1, 0xd1, 0x63, 0x89, 0x75, 0x8d, 0x10, 0xd5, 0x3a, 0x8d, 0xa3, 0xb9, 0x06, 0x65, + 0xff, 0xf5, 0xea, 0x7e, 0x2b, 0xf0, 0xf1, 0x2f, 0xa6, 0x70, 0x25, 0x0d, 0xf7, 0x56, 0x03, 0xe1, + 0xda, 0xac, 0x75, 0x83, 0xda, 0x32, 0xa1, 0x0c, 0x66, 0xc0, 0xf5, 0x50, 0x8a, 0x24, 0x66, 0x0b, + 0xbb, 0x51, 0x08, 0x3f, 0x5e, 0xe3, 0x2b, 0x63, 0xc1, 0x83, 0x15, 0x72, 0x50, 0x00, 0xc3, 0x1d, + 0xf9, 0xf3, 0xc3, 0xe9, 0x22, 0xb3, 0x5a, 0x63, 0xb5, 0x51, 0xfd, 0x11, 0x16, 0x45, 0x0c, 0x66, + 0x98, 0x3f, 0x73, 0xa7, 0x19, 0x4d, 0xe6, 0xa5, 0x53, 0x33, 0x2c, 0x8b, 0xf3, 0xe9, 0xdb, 0xd2, + 0x35, 0xde, 0x97, 0xae, 0xf1, 0xb1, 0x74, 0x8d, 0xe7, 0x4f, 0xf7, 0xcf, 0xc3, 0xd9, 0x24, 0xd6, + 0xd3, 0x79, 0x84, 0x99, 0x98, 0x11, 0xae, 0x24, 0x63, 0x9d, 0x11, 0x64, 0x84, 0x83, 0x18, 0xab, + 0x0e, 0x95, 0x71, 0x67, 0x22, 0xc8, 0xc6, 0x7d, 0x4f, 0xab, 0xf2, 0xa5, 0xb6, 0x7f, 0x0b, 0xe2, + 0xea, 0x1e, 0xf7, 0x06, 0xfd, 0x5c, 0x7c, 0x15, 0x41, 0xf4, 0xaf, 0x38, 0x59, 0xf7, 0x2b, 0x00, + 0x00, 0xff, 0xff, 0x83, 0x61, 0x0e, 0xc4, 0x1e, 0x02, 0x00, 0x00, } func (m *Container) Marshal() (dAtA []byte, err error) { @@ -452,7 +452,7 @@ func (m *Container) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.OwnerId == nil { - m.OwnerId = &refs.OwnerID{} + m.OwnerId = &grpc.OwnerID{} } if err := m.OwnerId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -575,7 +575,7 @@ func (m *Container) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.PlacementPolicy == nil { - m.PlacementPolicy = &netmap.PlacementPolicy{} + m.PlacementPolicy = &grpc1.PlacementPolicy{} } if err := m.PlacementPolicy.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err diff --git a/v2/convert.go b/v2/convert.go index 8cc95a6..5ec3cc8 100644 --- a/v2/convert.go +++ b/v2/convert.go @@ -1,351 +1 @@ package v2 - -import ( - "github.com/nspcc-dev/neofs-api-go/v2/accounting" - "github.com/nspcc-dev/neofs-api-go/v2/refs" - "github.com/nspcc-dev/neofs-api-go/v2/service" -) - -func SignatureToGRPCMessage(s *Signature) *service.Signature { - if s == nil { - return nil - } - - m := new(service.Signature) - - m.SetKey(s.GetKey()) - m.SetSign(s.GetSign()) - - return m -} - -func SignatureFromGRPCMessage(m *service.Signature) *Signature { - if m == nil { - return nil - } - - s := new(Signature) - - s.SetKey(m.GetKey()) - s.SetSign(m.GetSign()) - - return s -} - -func VersionToGRPCMessage(v *Version) *service.Version { - if v == nil { - return nil - } - - msg := new(service.Version) - - msg.SetMajor(v.GetMajor()) - msg.SetMinor(v.GetMinor()) - - return msg -} - -func VersionFromGRPCMessage(m *service.Version) *Version { - if m == nil { - return nil - } - - v := new(Version) - - v.SetMajor(m.GetMajor()) - v.SetMinor(m.GetMinor()) - - return v -} - -func XHeaderToGRPCMessage(x *XHeader) *service.XHeader { - if x == nil { - return nil - } - - m := new(service.XHeader) - - m.SetKey(x.GetKey()) - m.SetValue(x.GetValue()) - - return m -} - -func XHeaderFromGRPCMessage(m *service.XHeader) *XHeader { - if m == nil { - return nil - } - - x := new(XHeader) - - x.SetKey(m.GetKey()) - x.SetValue(m.GetValue()) - - return x -} - -func SessionTokenToGRPCMessage(t *SessionToken) *service.SessionToken { - // TODO: fill me - return nil -} - -func SessionTokenFromGRPCMessage(m *service.SessionToken) *SessionToken { - // TODO: fill me - return nil -} - -func BearerTokenToGRPCMessage(t *BearerToken) *service.BearerToken { - // TODO: fill me - return nil -} - -func BearerTokenFromGRPCMessage(m *service.BearerToken) *BearerToken { - // TODO: fill me - return nil -} - -func RequestVerificationHeaderToGRPCMessage(r *RequestVerificationHeader) *service.RequestVerificationHeader { - if r == nil { - return nil - } - - m := new(service.RequestVerificationHeader) - - m.SetBodySignature( - SignatureToGRPCMessage(r.GetBodySignature()), - ) - - m.SetMetaSignature( - SignatureToGRPCMessage(r.GetMetaSignature()), - ) - - m.SetOriginSignature( - SignatureToGRPCMessage(r.GetOriginSignature()), - ) - - m.SetOrigin( - RequestVerificationHeaderToGRPCMessage(r.GetOrigin()), - ) - - return m -} - -func RequestVerificationHeaderFromGRPCMessage(m *service.RequestVerificationHeader) *RequestVerificationHeader { - if m == nil { - return nil - } - - r := new(RequestVerificationHeader) - - r.SetBodySignature( - SignatureFromGRPCMessage(m.GetBodySignature()), - ) - - r.SetMetaSignature( - SignatureFromGRPCMessage(m.GetMetaSignature()), - ) - - r.SetOriginSignature( - SignatureFromGRPCMessage(m.GetOriginSignature()), - ) - - r.SetOrigin( - RequestVerificationHeaderFromGRPCMessage(m.GetOrigin()), - ) - - return r -} - -func RequestMetaHeaderToGRPCMessage(r *RequestMetaHeader) *service.RequestMetaHeader { - if r == nil { - return nil - } - - m := new(service.RequestMetaHeader) - - m.SetTtl(r.GetTTL()) - m.SetEpoch(r.GetEpoch()) - - m.SetVersion( - VersionToGRPCMessage(r.GetVersion()), - ) - - m.SetSessionToken( - SessionTokenToGRPCMessage(r.GetSessionToken()), - ) - - m.SetBearerToken( - BearerTokenToGRPCMessage(r.GetBearerToken()), - ) - - m.SetOrigin( - RequestMetaHeaderToGRPCMessage(r.GetOrigin()), - ) - - xHeaders := r.GetXHeaders() - xHdrMsg := make([]*service.XHeader, 0, len(xHeaders)) - - for i := range xHeaders { - xHdrMsg = append(xHdrMsg, XHeaderToGRPCMessage(xHeaders[i])) - } - - return m -} - -func RequestMetaHeaderFromGRPCMessage(m *service.RequestMetaHeader) *RequestMetaHeader { - if m == nil { - return nil - } - - r := new(RequestMetaHeader) - - r.SetTTL(m.GetTtl()) - r.SetEpoch(m.GetEpoch()) - - r.SetVersion( - VersionFromGRPCMessage(m.GetVersion()), - ) - - r.SetSessionToken( - SessionTokenFromGRPCMessage(m.GetSessionToken()), - ) - - r.SetBearerToken( - BearerTokenFromGRPCMessage(m.GetBearerToken()), - ) - - r.SetOrigin( - RequestMetaHeaderFromGRPCMessage(m.GetOrigin()), - ) - - xHdrMsg := m.GetXHeaders() - xHeaders := make([]*XHeader, 0, len(xHdrMsg)) - - for i := range xHdrMsg { - xHeaders = append(xHeaders, XHeaderFromGRPCMessage(xHdrMsg[i])) - } - - return r -} - -func OwnerIDToGRPCMessage(o *OwnerID) *refs.OwnerID { - if o == nil { - return nil - } - - m := new(refs.OwnerID) - - m.SetValue(o.GetValue()) - - return m -} - -func OwnerIDFromGRPCMessage(m *refs.OwnerID) *OwnerID { - if m == nil { - return nil - } - - o := new(OwnerID) - - o.SetValue(m.GetValue()) - - return o -} - -func BalanceRequestBodyToGRPCMessage(b *BalanceRequestBody) *accounting.BalanceRequest_Body { - if b == nil { - return nil - } - - m := new(accounting.BalanceRequest_Body) - - m.SetOwnerId( - OwnerIDToGRPCMessage(b.GetOwnerID()), - ) - - return m -} - -func BalanceRequestBodyFromGRPCMessage(m *accounting.BalanceRequest_Body) *BalanceRequestBody { - if m == nil { - return nil - } - - b := new(BalanceRequestBody) - - b.SetOwnerID( - OwnerIDFromGRPCMessage(m.GetOwnerId()), - ) - - return b -} - -func headersToGRPC( - src interface { - GetRequestMetaHeader() *RequestMetaHeader - GetRequestVerificationHeader() *RequestVerificationHeader - }, - dst interface { - SetMetaHeader(*service.RequestMetaHeader) - SetVerifyHeader(*service.RequestVerificationHeader) - }, -) { - dst.SetMetaHeader( - RequestMetaHeaderToGRPCMessage(src.GetRequestMetaHeader()), - ) - - dst.SetVerifyHeader( - RequestVerificationHeaderToGRPCMessage(src.GetRequestVerificationHeader()), - ) -} - -func headersFromGRPC( - src interface { - GetMetaHeader() *service.RequestMetaHeader - GetVerifyHeader() *service.RequestVerificationHeader - }, - dst interface { - SetRequestMetaHeader(*RequestMetaHeader) - SetRequestVerificationHeader(*RequestVerificationHeader) - }, -) { - dst.SetRequestMetaHeader( - RequestMetaHeaderFromGRPCMessage(src.GetMetaHeader()), - ) - - dst.SetRequestVerificationHeader( - RequestVerificationHeaderFromGRPCMessage(src.GetVerifyHeader()), - ) -} - -func BalanceRequestToGRPCMessage(b *BalanceRequest) *accounting.BalanceRequest { - if b == nil { - return nil - } - - m := new(accounting.BalanceRequest) - - m.SetBody( - BalanceRequestBodyToGRPCMessage(b.GetBody()), - ) - - headersToGRPC(b, m) - - return m -} - -func BalanceRequestFromGRPCMessage(m *accounting.BalanceRequest) *BalanceRequest { - if m == nil { - return nil - } - - b := new(BalanceRequest) - - b.SetBody( - BalanceRequestBodyFromGRPCMessage(m.GetBody()), - ) - - headersFromGRPC(m, b) - - return b -} diff --git a/v2/netmap/marshal.go b/v2/netmap/grpc/marshal.go similarity index 100% rename from v2/netmap/marshal.go rename to v2/netmap/grpc/marshal.go diff --git a/v2/netmap/types.go b/v2/netmap/grpc/types.go similarity index 100% rename from v2/netmap/types.go rename to v2/netmap/grpc/types.go diff --git a/v2/netmap/types.pb.go b/v2/netmap/grpc/types.pb.go similarity index 92% rename from v2/netmap/types.pb.go rename to v2/netmap/grpc/types.pb.go index bfc2e9e..2893490 100644 --- a/v2/netmap/types.pb.go +++ b/v2/netmap/grpc/types.pb.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: v2/netmap/types.proto +// source: v2/netmap/grpc/types.proto package netmap @@ -75,7 +75,7 @@ func (x PlacementPolicy_FilterGroup_Filter_SimpleFilter_Operation) String() stri } func (PlacementPolicy_FilterGroup_Filter_SimpleFilter_Operation) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_1207dc80bd67ddec, []int{0, 0, 0, 0, 0} + return fileDescriptor_91a1332b2376641a, []int{0, 0, 0, 0, 0} } // Represents the enumeration of various states of the NeoFS node. @@ -107,7 +107,7 @@ func (x NodeInfo_State) String() string { } func (NodeInfo_State) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_1207dc80bd67ddec, []int{1, 0} + return fileDescriptor_91a1332b2376641a, []int{1, 0} } // Set of rules to select a subset of nodes able to store container's objects @@ -125,7 +125,7 @@ func (m *PlacementPolicy) Reset() { *m = PlacementPolicy{} } func (m *PlacementPolicy) String() string { return proto.CompactTextString(m) } func (*PlacementPolicy) ProtoMessage() {} func (*PlacementPolicy) Descriptor() ([]byte, []int) { - return fileDescriptor_1207dc80bd67ddec, []int{0} + return fileDescriptor_91a1332b2376641a, []int{0} } func (m *PlacementPolicy) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -185,7 +185,7 @@ func (m *PlacementPolicy_FilterGroup) Reset() { *m = PlacementPolicy_Fil func (m *PlacementPolicy_FilterGroup) String() string { return proto.CompactTextString(m) } func (*PlacementPolicy_FilterGroup) ProtoMessage() {} func (*PlacementPolicy_FilterGroup) Descriptor() ([]byte, []int) { - return fileDescriptor_1207dc80bd67ddec, []int{0, 0} + return fileDescriptor_91a1332b2376641a, []int{0, 0} } func (m *PlacementPolicy_FilterGroup) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -250,7 +250,7 @@ func (m *PlacementPolicy_FilterGroup_Filter) Reset() { *m = PlacementPol func (m *PlacementPolicy_FilterGroup_Filter) String() string { return proto.CompactTextString(m) } func (*PlacementPolicy_FilterGroup_Filter) ProtoMessage() {} func (*PlacementPolicy_FilterGroup_Filter) Descriptor() ([]byte, []int) { - return fileDescriptor_1207dc80bd67ddec, []int{0, 0, 0} + return fileDescriptor_91a1332b2376641a, []int{0, 0, 0} } func (m *PlacementPolicy_FilterGroup_Filter) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -316,7 +316,7 @@ func (m *PlacementPolicy_FilterGroup_Filter_SimpleFilter) String() string { } func (*PlacementPolicy_FilterGroup_Filter_SimpleFilter) ProtoMessage() {} func (*PlacementPolicy_FilterGroup_Filter_SimpleFilter) Descriptor() ([]byte, []int) { - return fileDescriptor_1207dc80bd67ddec, []int{0, 0, 0, 0} + return fileDescriptor_91a1332b2376641a, []int{0, 0, 0, 0} } func (m *PlacementPolicy_FilterGroup_Filter_SimpleFilter) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -416,7 +416,7 @@ func (m *PlacementPolicy_FilterGroup_Filter_SimpleFilter_SimpleFilters) String() } func (*PlacementPolicy_FilterGroup_Filter_SimpleFilter_SimpleFilters) ProtoMessage() {} func (*PlacementPolicy_FilterGroup_Filter_SimpleFilter_SimpleFilters) Descriptor() ([]byte, []int) { - return fileDescriptor_1207dc80bd67ddec, []int{0, 0, 0, 0, 0} + return fileDescriptor_91a1332b2376641a, []int{0, 0, 0, 0, 0} } func (m *PlacementPolicy_FilterGroup_Filter_SimpleFilter_SimpleFilters) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -467,7 +467,7 @@ func (m *PlacementPolicy_FilterGroup_Selector) Reset() { *m = PlacementP func (m *PlacementPolicy_FilterGroup_Selector) String() string { return proto.CompactTextString(m) } func (*PlacementPolicy_FilterGroup_Selector) ProtoMessage() {} func (*PlacementPolicy_FilterGroup_Selector) Descriptor() ([]byte, []int) { - return fileDescriptor_1207dc80bd67ddec, []int{0, 0, 1} + return fileDescriptor_91a1332b2376641a, []int{0, 0, 1} } func (m *PlacementPolicy_FilterGroup_Selector) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -529,7 +529,7 @@ func (m *NodeInfo) Reset() { *m = NodeInfo{} } func (m *NodeInfo) String() string { return proto.CompactTextString(m) } func (*NodeInfo) ProtoMessage() {} func (*NodeInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_1207dc80bd67ddec, []int{1} + return fileDescriptor_91a1332b2376641a, []int{1} } func (m *NodeInfo) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -601,7 +601,7 @@ func (m *NodeInfo_Attribute) Reset() { *m = NodeInfo_Attribute{} } func (m *NodeInfo_Attribute) String() string { return proto.CompactTextString(m) } func (*NodeInfo_Attribute) ProtoMessage() {} func (*NodeInfo_Attribute) Descriptor() ([]byte, []int) { - return fileDescriptor_1207dc80bd67ddec, []int{1, 0} + return fileDescriptor_91a1332b2376641a, []int{1, 0} } func (m *NodeInfo_Attribute) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -657,52 +657,52 @@ func init() { proto.RegisterType((*NodeInfo_Attribute)(nil), "neo.fs.v2.netmap.NodeInfo.Attribute") } -func init() { proto.RegisterFile("v2/netmap/types.proto", fileDescriptor_1207dc80bd67ddec) } +func init() { proto.RegisterFile("v2/netmap/grpc/types.proto", fileDescriptor_91a1332b2376641a) } -var fileDescriptor_1207dc80bd67ddec = []byte{ - // 660 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x54, 0xc1, 0x6e, 0xd3, 0x4c, - 0x10, 0xae, 0xed, 0xc4, 0x69, 0x26, 0xcd, 0x5f, 0x6b, 0xff, 0x16, 0x99, 0x48, 0x84, 0x28, 0xe2, - 0x90, 0x4b, 0x1c, 0xe1, 0xa2, 0x5e, 0x38, 0xa5, 0xd4, 0x29, 0x51, 0x2b, 0x3b, 0x38, 0xe1, 0xd2, - 0x1e, 0x22, 0xc7, 0x59, 0xa7, 0x16, 0x8e, 0xd7, 0xf2, 0xae, 0x23, 0xf2, 0x26, 0xbc, 0x02, 0x3c, - 0x02, 0x07, 0xae, 0x70, 0xe0, 0xc0, 0x23, 0xa0, 0xf2, 0x22, 0xc8, 0xeb, 0x38, 0x4d, 0x0b, 0x42, - 0x2a, 0xe5, 0xf4, 0xf9, 0x9b, 0xd9, 0xf9, 0xc6, 0x33, 0xfe, 0xbc, 0xb0, 0xbf, 0xd0, 0x3b, 0x21, - 0x66, 0x73, 0x27, 0xea, 0xb0, 0x65, 0x84, 0xa9, 0x16, 0xc5, 0x84, 0x11, 0xa4, 0x84, 0x98, 0x68, - 0x1e, 0xd5, 0x16, 0xba, 0x96, 0x65, 0x9b, 0x9f, 0x4b, 0xb0, 0x3b, 0x08, 0x1c, 0x17, 0xcf, 0x71, - 0xc8, 0x06, 0x24, 0xf0, 0xdd, 0x25, 0x7a, 0x0c, 0x95, 0x18, 0x47, 0xc1, 0xd8, 0x73, 0x5c, 0x46, - 0x62, 0x55, 0x68, 0x08, 0xad, 0xaa, 0x0d, 0x69, 0xa8, 0xc7, 0x23, 0xc8, 0x86, 0xaa, 0xe7, 0x07, - 0x0c, 0xc7, 0xe3, 0x59, 0x4c, 0x92, 0x88, 0xaa, 0x62, 0x43, 0x6a, 0x55, 0xf4, 0xb6, 0x76, 0x5b, - 0x5e, 0xbb, 0x25, 0xad, 0xf5, 0x78, 0xd9, 0x49, 0x5a, 0x65, 0xef, 0x78, 0xd7, 0x84, 0xd6, 0x3e, - 0xc9, 0x50, 0xd9, 0xc8, 0x22, 0x13, 0x4a, 0x59, 0x9e, 0xaa, 0x02, 0x57, 0x7f, 0x76, 0x27, 0xf5, - 0xd5, 0xb3, 0x9d, 0x8b, 0xa0, 0x11, 0x94, 0x29, 0x0e, 0x70, 0xfa, 0xfe, 0xf9, 0xfb, 0x1e, 0xde, - 0x4d, 0x71, 0xb8, 0x2a, 0xb7, 0xaf, 0x85, 0x90, 0x0a, 0x25, 0xfc, 0xd6, 0x0d, 0x92, 0x29, 0x56, - 0xa5, 0x86, 0xd4, 0xaa, 0xda, 0x39, 0xad, 0x7d, 0x2c, 0x80, 0x9c, 0x55, 0x23, 0x05, 0xa4, 0x37, - 0x78, 0xc9, 0xf7, 0x58, 0xb6, 0xd3, 0x47, 0x64, 0x81, 0xe0, 0xa9, 0x62, 0x43, 0x68, 0x55, 0xf4, - 0xee, 0xdf, 0x8c, 0xa5, 0x0d, 0xfd, 0x79, 0x14, 0xe0, 0xd5, 0x8c, 0x82, 0x57, 0xfb, 0x2a, 0xc1, - 0xce, 0x66, 0x0c, 0x5d, 0x80, 0x48, 0x22, 0xde, 0xf2, 0x3f, 0xfd, 0xf4, 0xde, 0x2d, 0x34, 0x2b, - 0xc2, 0xb1, 0xc3, 0x7c, 0x12, 0xda, 0x22, 0x89, 0xd0, 0x03, 0x28, 0x2e, 0x9c, 0x20, 0xc1, 0x7c, - 0x84, 0xf2, 0xcb, 0x2d, 0x3b, 0xa3, 0xe8, 0x12, 0x64, 0x6f, 0xec, 0xc4, 0x33, 0xaa, 0x4a, 0x7c, - 0x36, 0xeb, 0xfe, 0x8d, 0x37, 0x09, 0x4d, 0x3b, 0x79, 0xdd, 0x78, 0x46, 0x6b, 0x01, 0x54, 0x6f, - 0x64, 0xd0, 0xc5, 0x6d, 0xbb, 0xfc, 0x83, 0xbd, 0xe6, 0x8a, 0xcd, 0x19, 0x94, 0xd7, 0x0b, 0x40, - 0x0f, 0x61, 0xdf, 0x1a, 0x18, 0x76, 0x77, 0xd4, 0xb7, 0xcc, 0xf1, 0x6b, 0x73, 0x38, 0x30, 0x5e, - 0xf4, 0x7b, 0x7d, 0xe3, 0x58, 0xd9, 0x42, 0x32, 0x88, 0xc6, 0x2b, 0x45, 0x48, 0xd1, 0x34, 0x14, - 0x31, 0xc5, 0x93, 0x91, 0x22, 0x71, 0x34, 0x94, 0x42, 0x8a, 0x67, 0x23, 0xa5, 0xc8, 0xd1, 0x50, - 0xe4, 0x14, 0x2d, 0x5b, 0x29, 0xa1, 0x12, 0x48, 0x5d, 0xf3, 0x58, 0xd9, 0x3e, 0x92, 0xa1, 0x90, - 0xae, 0xaf, 0xa6, 0xc3, 0x76, 0xee, 0x36, 0xb4, 0x07, 0x45, 0x97, 0x24, 0x21, 0x5b, 0xfd, 0x87, - 0x19, 0xc9, 0x3d, 0x25, 0xae, 0x3d, 0xd5, 0x7c, 0x2f, 0xc2, 0xb6, 0x49, 0xa6, 0xb8, 0x1f, 0x7a, - 0x24, 0xf5, 0xa5, 0x33, 0x9d, 0xc6, 0x98, 0xd2, 0x95, 0xed, 0x72, 0x8a, 0x1e, 0x01, 0x44, 0xc9, - 0x24, 0xf0, 0xdd, 0x71, 0x5e, 0xbf, 0x63, 0x97, 0xb3, 0xc8, 0x29, 0x5e, 0xa2, 0x63, 0x00, 0x87, - 0xb1, 0xd8, 0x9f, 0x24, 0x0c, 0x53, 0xee, 0xe9, 0x8a, 0xfe, 0xe4, 0xd7, 0x55, 0xe6, 0x8d, 0xb4, - 0x6e, 0x7e, 0xd8, 0xde, 0xa8, 0x43, 0x87, 0x50, 0xa4, 0xcc, 0x61, 0x58, 0x2d, 0x70, 0x03, 0x36, - 0xfe, 0x20, 0x30, 0x4c, 0xcf, 0xd9, 0xd9, 0xf1, 0xda, 0x01, 0x94, 0xd7, 0x82, 0xbf, 0xf9, 0x6d, - 0xf6, 0x6e, 0xf8, 0x6e, 0xe5, 0xba, 0xe6, 0x53, 0x28, 0x72, 0x11, 0xb4, 0x0b, 0x95, 0x9b, 0xdf, - 0x03, 0x40, 0xb6, 0xcc, 0xb3, 0xbe, 0x69, 0x28, 0x02, 0xaa, 0x40, 0xc9, 0xea, 0xf5, 0x38, 0x11, - 0x8f, 0xce, 0xbf, 0x5c, 0xd5, 0x85, 0x6f, 0x57, 0x75, 0xe1, 0xfb, 0x55, 0x5d, 0x78, 0xf7, 0xa3, - 0xbe, 0x75, 0xae, 0xcf, 0x7c, 0x76, 0x99, 0x4c, 0x34, 0x97, 0xcc, 0x3b, 0x21, 0x8d, 0x5c, 0xb7, - 0x3d, 0xc5, 0x8b, 0x4e, 0x88, 0x89, 0x47, 0xdb, 0x4e, 0xe4, 0xb7, 0x67, 0xa4, 0xb3, 0xbe, 0x52, - 0x9f, 0x67, 0xf0, 0x41, 0xfc, 0xdf, 0xc4, 0xa4, 0x37, 0xd4, 0xba, 0x83, 0x7e, 0x3a, 0x99, 0xc9, - 0xa3, 0x13, 0x99, 0x5f, 0xb5, 0x07, 0x3f, 0x03, 0x00, 0x00, 0xff, 0xff, 0x2d, 0xc4, 0x82, 0xde, - 0x83, 0x05, 0x00, 0x00, +var fileDescriptor_91a1332b2376641a = []byte{ + // 663 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x54, 0xcd, 0x6e, 0xd3, 0x40, + 0x10, 0xae, 0xed, 0xc4, 0x69, 0x26, 0x0d, 0xb5, 0x96, 0x82, 0x4c, 0x24, 0x42, 0x14, 0x71, 0xc8, + 0x25, 0x8e, 0x48, 0x51, 0x39, 0x70, 0x4a, 0xa9, 0x53, 0xa2, 0x56, 0x76, 0xd8, 0x84, 0x0b, 0x3d, + 0x44, 0x8e, 0xb3, 0x4e, 0x2d, 0x1c, 0xaf, 0xe5, 0xdd, 0x44, 0xe4, 0x4d, 0x78, 0x05, 0x78, 0x04, + 0x0e, 0x5c, 0xe1, 0xc0, 0x81, 0x47, 0x40, 0xe5, 0x45, 0x90, 0xd7, 0x71, 0x9b, 0x14, 0x84, 0x54, + 0xca, 0x69, 0xf6, 0x9b, 0x9f, 0x6f, 0x3c, 0xe3, 0x6f, 0x17, 0x2a, 0x8b, 0x76, 0x2b, 0x24, 0x7c, + 0xe6, 0x44, 0xad, 0x69, 0x1c, 0xb9, 0x2d, 0xbe, 0x8c, 0x08, 0x33, 0xa2, 0x98, 0x72, 0x8a, 0xb4, + 0x90, 0x50, 0xc3, 0x63, 0xc6, 0xa2, 0x6d, 0xa4, 0x29, 0xf5, 0x2f, 0x05, 0xd8, 0xed, 0x07, 0x8e, + 0x4b, 0x66, 0x24, 0xe4, 0x7d, 0x1a, 0xf8, 0xee, 0x12, 0x3d, 0x82, 0x52, 0x4c, 0xa2, 0x60, 0xe4, + 0x39, 0x2e, 0xa7, 0xb1, 0x2e, 0xd5, 0xa4, 0x46, 0x19, 0x43, 0xe2, 0xea, 0x0a, 0x0f, 0xc2, 0x50, + 0xf6, 0xfc, 0x80, 0x93, 0x78, 0x34, 0x8d, 0xe9, 0x3c, 0x62, 0xba, 0x5c, 0x53, 0x1a, 0xa5, 0x76, + 0xd3, 0xb8, 0x4e, 0x6f, 0x5c, 0xa3, 0x36, 0xba, 0xa2, 0xec, 0x38, 0xa9, 0xc2, 0x3b, 0xde, 0x15, + 0x60, 0x95, 0xcf, 0x2a, 0x94, 0xd6, 0xa2, 0xc8, 0x82, 0x42, 0x1a, 0x67, 0xba, 0x24, 0xd8, 0x9f, + 0xde, 0x88, 0x7d, 0x75, 0xc6, 0x19, 0x09, 0x1a, 0x42, 0x91, 0x91, 0x80, 0x24, 0xdf, 0x9f, 0x7d, + 0xef, 0xc1, 0xcd, 0x18, 0x07, 0xab, 0x72, 0x7c, 0x45, 0x84, 0x74, 0x28, 0x90, 0x77, 0x6e, 0x30, + 0x9f, 0x10, 0x5d, 0xa9, 0x29, 0x8d, 0x32, 0xce, 0x60, 0xe5, 0x53, 0x0e, 0xd4, 0xb4, 0x1a, 0x69, + 0xa0, 0xbc, 0x25, 0x4b, 0xb1, 0xc7, 0x22, 0x4e, 0x8e, 0xc8, 0x06, 0xc9, 0xd3, 0xe5, 0x9a, 0xd4, + 0x28, 0xb5, 0x3b, 0xff, 0x32, 0x96, 0x31, 0xf0, 0x67, 0x51, 0x40, 0x56, 0x33, 0x4a, 0x5e, 0xe5, + 0x9b, 0x02, 0x3b, 0xeb, 0x3e, 0x74, 0x06, 0x32, 0x8d, 0x44, 0xcb, 0x3b, 0xed, 0x93, 0x5b, 0xb7, + 0x30, 0xec, 0x88, 0xc4, 0x0e, 0xf7, 0x69, 0x88, 0x65, 0x1a, 0xa1, 0xfb, 0x90, 0x5f, 0x38, 0xc1, + 0x9c, 0x88, 0x11, 0x8a, 0x2f, 0xb7, 0x70, 0x0a, 0xd1, 0x39, 0xa8, 0xde, 0xc8, 0x89, 0xa7, 0x4c, + 0x57, 0xc4, 0x6c, 0xf6, 0xed, 0x1b, 0xaf, 0x03, 0x96, 0x74, 0xf2, 0x3a, 0xf1, 0x94, 0x55, 0x02, + 0x28, 0x6f, 0x44, 0xd0, 0xd9, 0x75, 0xb9, 0xfc, 0x87, 0xbd, 0x66, 0x8c, 0xf5, 0x29, 0x14, 0x2f, + 0x17, 0x80, 0x1e, 0xc0, 0x3d, 0xbb, 0x6f, 0xe2, 0xce, 0xb0, 0x67, 0x5b, 0xa3, 0xd7, 0xd6, 0xa0, + 0x6f, 0xbe, 0xe8, 0x75, 0x7b, 0xe6, 0x91, 0xb6, 0x85, 0x54, 0x90, 0xcd, 0x57, 0x9a, 0x94, 0x58, + 0xcb, 0xd4, 0xe4, 0xc4, 0x1e, 0x0f, 0x35, 0x45, 0x58, 0x53, 0xcb, 0x25, 0xf6, 0x74, 0xa8, 0xe5, + 0x85, 0x35, 0x35, 0x35, 0xb1, 0x36, 0xd6, 0x0a, 0xa8, 0x00, 0x4a, 0xc7, 0x3a, 0xd2, 0xb6, 0x0f, + 0x55, 0xc8, 0x25, 0xeb, 0xab, 0xb4, 0x61, 0x3b, 0x53, 0x1b, 0xda, 0x83, 0xbc, 0x4b, 0xe7, 0x21, + 0x5f, 0xdd, 0xc3, 0x14, 0x64, 0x9a, 0x92, 0x2f, 0x35, 0x55, 0xff, 0x20, 0xc3, 0xb6, 0x45, 0x27, + 0xa4, 0x17, 0x7a, 0x34, 0xd1, 0xa5, 0x33, 0x99, 0xc4, 0x84, 0xb1, 0x95, 0xec, 0x32, 0x88, 0x1e, + 0x02, 0x44, 0xf3, 0x71, 0xe0, 0xbb, 0xa3, 0xac, 0x7e, 0x07, 0x17, 0x53, 0xcf, 0x09, 0x59, 0xa2, + 0x23, 0x00, 0x87, 0xf3, 0xd8, 0x1f, 0xcf, 0x39, 0x61, 0x42, 0xd3, 0xa5, 0xf6, 0xe3, 0xdf, 0x57, + 0x99, 0x35, 0x32, 0x3a, 0x59, 0x32, 0x5e, 0xab, 0x43, 0x07, 0x90, 0x67, 0xdc, 0xe1, 0x44, 0xcf, + 0x09, 0x01, 0xd6, 0xfe, 0x42, 0x30, 0x48, 0xf2, 0x70, 0x9a, 0x5e, 0xd9, 0x87, 0xe2, 0x25, 0xe1, + 0x1f, 0xae, 0xcd, 0xde, 0x86, 0xee, 0x56, 0xaa, 0xab, 0x3f, 0x81, 0xbc, 0x20, 0x41, 0xbb, 0x50, + 0xda, 0xfc, 0x1f, 0x00, 0xaa, 0x6d, 0x9d, 0xf6, 0x2c, 0x53, 0x93, 0x50, 0x09, 0x0a, 0x76, 0xb7, + 0x2b, 0x80, 0x7c, 0x38, 0xfa, 0x7a, 0x51, 0x95, 0xbe, 0x5f, 0x54, 0xa5, 0x1f, 0x17, 0x55, 0xe9, + 0xfd, 0xcf, 0xea, 0xd6, 0x9b, 0x67, 0x53, 0x9f, 0x9f, 0xcf, 0xc7, 0x86, 0x4b, 0x67, 0xad, 0x90, + 0x45, 0xae, 0xdb, 0x9c, 0x90, 0x45, 0x2b, 0x24, 0xd4, 0x63, 0x4d, 0x27, 0xf2, 0x9b, 0x53, 0xda, + 0xda, 0x7c, 0x57, 0x9f, 0xa7, 0xe7, 0x8f, 0xf2, 0x5d, 0x8b, 0xd0, 0xee, 0xc0, 0xe8, 0xf4, 0x7b, + 0xc9, 0x78, 0x96, 0xf0, 0x8e, 0x55, 0xf1, 0xde, 0xee, 0xff, 0x0a, 0x00, 0x00, 0xff, 0xff, 0x87, + 0xfe, 0x8e, 0x55, 0x8d, 0x05, 0x00, 0x00, } func (m *PlacementPolicy) Marshal() (dAtA []byte, err error) { diff --git a/v2/object/service.go b/v2/object/grpc/service.go similarity index 99% rename from v2/object/service.go rename to v2/object/grpc/service.go index eae7ae5..0372b3d 100644 --- a/v2/object/service.go +++ b/v2/object/grpc/service.go @@ -1,8 +1,8 @@ package object import ( - "github.com/nspcc-dev/neofs-api-go/v2/refs" - "github.com/nspcc-dev/neofs-api-go/v2/service" + refs "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" + service "github.com/nspcc-dev/neofs-api-go/v2/service/grpc" ) // SetAddress sets address of the requested object. diff --git a/v2/object/service.pb.go b/v2/object/grpc/service.pb.go similarity index 89% rename from v2/object/service.pb.go rename to v2/object/grpc/service.pb.go index 1865e41..a6f18df 100644 --- a/v2/object/service.pb.go +++ b/v2/object/grpc/service.pb.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: v2/object/service.proto +// source: v2/object/grpc/service.proto package object @@ -7,9 +7,9 @@ import ( context "context" fmt "fmt" proto "github.com/golang/protobuf/proto" - refs "github.com/nspcc-dev/neofs-api-go/v2/refs" - service "github.com/nspcc-dev/neofs-api-go/v2/service" - grpc "google.golang.org/grpc" + grpc1 "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" + grpc "github.com/nspcc-dev/neofs-api-go/v2/service/grpc" + grpc2 "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" io "io" @@ -53,7 +53,7 @@ func (x SearchRequest_Body_Filter_MatchType) String() string { } func (SearchRequest_Body_Filter_MatchType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_6233c87a2945599e, []int{8, 0, 0, 0} + return fileDescriptor_1d7d92b1e85e5b48, []int{8, 0, 0, 0} } // Get object request @@ -62,20 +62,20 @@ type GetRequest struct { Body *GetRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` // Carries request meta information. Header data is used only to regulate message // transport and does not affect request execution. - MetaHeader *service.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" json:"meta_header,omitempty"` + MetaHeader *grpc.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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 *service.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + VerifyHeader *grpc.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetRequest) Reset() { *m = GetRequest{} } func (m *GetRequest) String() string { return proto.CompactTextString(m) } func (*GetRequest) ProtoMessage() {} func (*GetRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_6233c87a2945599e, []int{0} + return fileDescriptor_1d7d92b1e85e5b48, []int{0} } func (m *GetRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -111,14 +111,14 @@ func (m *GetRequest) GetBody() *GetRequest_Body { return nil } -func (m *GetRequest) GetMetaHeader() *service.RequestMetaHeader { +func (m *GetRequest) GetMetaHeader() *grpc.RequestMetaHeader { if m != nil { return m.MetaHeader } return nil } -func (m *GetRequest) GetVerifyHeader() *service.RequestVerificationHeader { +func (m *GetRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { if m != nil { return m.VerifyHeader } @@ -128,7 +128,7 @@ func (m *GetRequest) GetVerifyHeader() *service.RequestVerificationHeader { // Request body type GetRequest_Body struct { // Address of the requested object. - Address *refs.Address `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + Address *grpc1.Address `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` // Carries the raw option flag of the request. // Raw request is sent to receive only the objects // that are physically stored on the server. @@ -142,7 +142,7 @@ func (m *GetRequest_Body) Reset() { *m = GetRequest_Body{} } func (m *GetRequest_Body) String() string { return proto.CompactTextString(m) } func (*GetRequest_Body) ProtoMessage() {} func (*GetRequest_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_6233c87a2945599e, []int{0, 0} + return fileDescriptor_1d7d92b1e85e5b48, []int{0, 0} } func (m *GetRequest_Body) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -171,7 +171,7 @@ func (m *GetRequest_Body) XXX_DiscardUnknown() { var xxx_messageInfo_GetRequest_Body proto.InternalMessageInfo -func (m *GetRequest_Body) GetAddress() *refs.Address { +func (m *GetRequest_Body) GetAddress() *grpc1.Address { if m != nil { return m.Address } @@ -191,21 +191,21 @@ type GetResponse struct { Body *GetResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` // Carries response meta information. Header data is used only to regulate // message transport and does not affect request execution. - MetaHeader *service.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" json:"meta_header,omitempty"` + MetaHeader *grpc.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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 *service.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + VerifyHeader *grpc.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetResponse) Reset() { *m = GetResponse{} } func (m *GetResponse) String() string { return proto.CompactTextString(m) } func (*GetResponse) ProtoMessage() {} func (*GetResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_6233c87a2945599e, []int{1} + return fileDescriptor_1d7d92b1e85e5b48, []int{1} } func (m *GetResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -241,14 +241,14 @@ func (m *GetResponse) GetBody() *GetResponse_Body { return nil } -func (m *GetResponse) GetMetaHeader() *service.ResponseMetaHeader { +func (m *GetResponse) GetMetaHeader() *grpc.ResponseMetaHeader { if m != nil { return m.MetaHeader } return nil } -func (m *GetResponse) GetVerifyHeader() *service.ResponseVerificationHeader { +func (m *GetResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { if m != nil { return m.VerifyHeader } @@ -272,7 +272,7 @@ func (m *GetResponse_Body) Reset() { *m = GetResponse_Body{} } func (m *GetResponse_Body) String() string { return proto.CompactTextString(m) } func (*GetResponse_Body) ProtoMessage() {} func (*GetResponse_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_6233c87a2945599e, []int{1, 0} + return fileDescriptor_1d7d92b1e85e5b48, []int{1, 0} } func (m *GetResponse_Body) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -349,9 +349,9 @@ func (*GetResponse_Body) XXX_OneofWrappers() []interface{} { // Initialization parameters of the object got from NeoFS. type GetResponse_Body_Init struct { // Object ID - ObjectId *refs.ObjectID `protobuf:"bytes,1,opt,name=object_id,json=objectId,proto3" json:"object_id,omitempty"` + ObjectId *grpc1.ObjectID `protobuf:"bytes,1,opt,name=object_id,json=objectId,proto3" json:"object_id,omitempty"` // Object signature - Signature *service.Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` + Signature *grpc.Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` // Object header. Header *Header `protobuf:"bytes,3,opt,name=header,proto3" json:"header,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` @@ -363,7 +363,7 @@ func (m *GetResponse_Body_Init) Reset() { *m = GetResponse_Body_Init{} } func (m *GetResponse_Body_Init) String() string { return proto.CompactTextString(m) } func (*GetResponse_Body_Init) ProtoMessage() {} func (*GetResponse_Body_Init) Descriptor() ([]byte, []int) { - return fileDescriptor_6233c87a2945599e, []int{1, 0, 0} + return fileDescriptor_1d7d92b1e85e5b48, []int{1, 0, 0} } func (m *GetResponse_Body_Init) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -392,14 +392,14 @@ func (m *GetResponse_Body_Init) XXX_DiscardUnknown() { var xxx_messageInfo_GetResponse_Body_Init proto.InternalMessageInfo -func (m *GetResponse_Body_Init) GetObjectId() *refs.ObjectID { +func (m *GetResponse_Body_Init) GetObjectId() *grpc1.ObjectID { if m != nil { return m.ObjectId } return nil } -func (m *GetResponse_Body_Init) GetSignature() *service.Signature { +func (m *GetResponse_Body_Init) GetSignature() *grpc.Signature { if m != nil { return m.Signature } @@ -419,20 +419,20 @@ type PutRequest struct { Body *PutRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` // Carries request meta information. Header data is used only to regulate message // transport and does not affect request execution. - MetaHeader *service.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" json:"meta_header,omitempty"` + MetaHeader *grpc.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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 *service.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + VerifyHeader *grpc.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *PutRequest) Reset() { *m = PutRequest{} } func (m *PutRequest) String() string { return proto.CompactTextString(m) } func (*PutRequest) ProtoMessage() {} func (*PutRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_6233c87a2945599e, []int{2} + return fileDescriptor_1d7d92b1e85e5b48, []int{2} } func (m *PutRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -468,14 +468,14 @@ func (m *PutRequest) GetBody() *PutRequest_Body { return nil } -func (m *PutRequest) GetMetaHeader() *service.RequestMetaHeader { +func (m *PutRequest) GetMetaHeader() *grpc.RequestMetaHeader { if m != nil { return m.MetaHeader } return nil } -func (m *PutRequest) GetVerifyHeader() *service.RequestVerificationHeader { +func (m *PutRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { if m != nil { return m.VerifyHeader } @@ -499,7 +499,7 @@ func (m *PutRequest_Body) Reset() { *m = PutRequest_Body{} } func (m *PutRequest_Body) String() string { return proto.CompactTextString(m) } func (*PutRequest_Body) ProtoMessage() {} func (*PutRequest_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_6233c87a2945599e, []int{2, 0} + return fileDescriptor_1d7d92b1e85e5b48, []int{2, 0} } func (m *PutRequest_Body) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -576,9 +576,9 @@ func (*PutRequest_Body) XXX_OneofWrappers() []interface{} { // Groups initialization parameters of object placement in NeoFS. type PutRequest_Body_Init struct { // Object ID, where available - ObjectId *refs.ObjectID `protobuf:"bytes,1,opt,name=object_id,json=objectId,proto3" json:"object_id,omitempty"` + ObjectId *grpc1.ObjectID `protobuf:"bytes,1,opt,name=object_id,json=objectId,proto3" json:"object_id,omitempty"` // Object signature, were available - Signature *service.Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` + Signature *grpc.Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` // Header of the object to save in the system. Header *Header `protobuf:"bytes,3,opt,name=header,proto3" json:"header,omitempty"` // Number of the object copies to store within the RPC call. @@ -594,7 +594,7 @@ func (m *PutRequest_Body_Init) Reset() { *m = PutRequest_Body_Init{} } func (m *PutRequest_Body_Init) String() string { return proto.CompactTextString(m) } func (*PutRequest_Body_Init) ProtoMessage() {} func (*PutRequest_Body_Init) Descriptor() ([]byte, []int) { - return fileDescriptor_6233c87a2945599e, []int{2, 0, 0} + return fileDescriptor_1d7d92b1e85e5b48, []int{2, 0, 0} } func (m *PutRequest_Body_Init) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -623,14 +623,14 @@ func (m *PutRequest_Body_Init) XXX_DiscardUnknown() { var xxx_messageInfo_PutRequest_Body_Init proto.InternalMessageInfo -func (m *PutRequest_Body_Init) GetObjectId() *refs.ObjectID { +func (m *PutRequest_Body_Init) GetObjectId() *grpc1.ObjectID { if m != nil { return m.ObjectId } return nil } -func (m *PutRequest_Body_Init) GetSignature() *service.Signature { +func (m *PutRequest_Body_Init) GetSignature() *grpc.Signature { if m != nil { return m.Signature } @@ -657,21 +657,21 @@ type PutResponse struct { Body *PutResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` // Carries response meta information. Header data is used only to regulate // message transport and does not affect request execution. - MetaHeader *service.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" json:"meta_header,omitempty"` + MetaHeader *grpc.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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 *service.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + VerifyHeader *grpc.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *PutResponse) Reset() { *m = PutResponse{} } func (m *PutResponse) String() string { return proto.CompactTextString(m) } func (*PutResponse) ProtoMessage() {} func (*PutResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_6233c87a2945599e, []int{3} + return fileDescriptor_1d7d92b1e85e5b48, []int{3} } func (m *PutResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -707,14 +707,14 @@ func (m *PutResponse) GetBody() *PutResponse_Body { return nil } -func (m *PutResponse) GetMetaHeader() *service.ResponseMetaHeader { +func (m *PutResponse) GetMetaHeader() *grpc.ResponseMetaHeader { if m != nil { return m.MetaHeader } return nil } -func (m *PutResponse) GetVerifyHeader() *service.ResponseVerificationHeader { +func (m *PutResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { if m != nil { return m.VerifyHeader } @@ -725,17 +725,17 @@ func (m *PutResponse) GetVerifyHeader() *service.ResponseVerificationHeader { type PutResponse_Body struct { // Carries identifier of the saved object. // It is used to access an object in the container. - ObjectId *refs.ObjectID `protobuf:"bytes,1,opt,name=object_id,json=objectId,proto3" json:"object_id,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + ObjectId *grpc1.ObjectID `protobuf:"bytes,1,opt,name=object_id,json=objectId,proto3" json:"object_id,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *PutResponse_Body) Reset() { *m = PutResponse_Body{} } func (m *PutResponse_Body) String() string { return proto.CompactTextString(m) } func (*PutResponse_Body) ProtoMessage() {} func (*PutResponse_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_6233c87a2945599e, []int{3, 0} + return fileDescriptor_1d7d92b1e85e5b48, []int{3, 0} } func (m *PutResponse_Body) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -764,7 +764,7 @@ func (m *PutResponse_Body) XXX_DiscardUnknown() { var xxx_messageInfo_PutResponse_Body proto.InternalMessageInfo -func (m *PutResponse_Body) GetObjectId() *refs.ObjectID { +func (m *PutResponse_Body) GetObjectId() *grpc1.ObjectID { if m != nil { return m.ObjectId } @@ -777,20 +777,20 @@ type DeleteRequest struct { Body *DeleteRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` // Carries request meta information. Header data is used only to regulate message // transport and does not affect request execution. - MetaHeader *service.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" json:"meta_header,omitempty"` + MetaHeader *grpc.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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 *service.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + VerifyHeader *grpc.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *DeleteRequest) Reset() { *m = DeleteRequest{} } func (m *DeleteRequest) String() string { return proto.CompactTextString(m) } func (*DeleteRequest) ProtoMessage() {} func (*DeleteRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_6233c87a2945599e, []int{4} + return fileDescriptor_1d7d92b1e85e5b48, []int{4} } func (m *DeleteRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -826,14 +826,14 @@ func (m *DeleteRequest) GetBody() *DeleteRequest_Body { return nil } -func (m *DeleteRequest) GetMetaHeader() *service.RequestMetaHeader { +func (m *DeleteRequest) GetMetaHeader() *grpc.RequestMetaHeader { if m != nil { return m.MetaHeader } return nil } -func (m *DeleteRequest) GetVerifyHeader() *service.RequestVerificationHeader { +func (m *DeleteRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { if m != nil { return m.VerifyHeader } @@ -843,19 +843,19 @@ func (m *DeleteRequest) GetVerifyHeader() *service.RequestVerificationHeader { // Request body type DeleteRequest_Body struct { // Carries the address of the object to be deleted. - Address *refs.Address `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + Address *grpc1.Address `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` // Carries identifier the object owner. - OwnerId *refs.OwnerID `protobuf:"bytes,2,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + OwnerId *grpc1.OwnerID `protobuf:"bytes,2,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *DeleteRequest_Body) Reset() { *m = DeleteRequest_Body{} } func (m *DeleteRequest_Body) String() string { return proto.CompactTextString(m) } func (*DeleteRequest_Body) ProtoMessage() {} func (*DeleteRequest_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_6233c87a2945599e, []int{4, 0} + return fileDescriptor_1d7d92b1e85e5b48, []int{4, 0} } func (m *DeleteRequest_Body) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -884,14 +884,14 @@ func (m *DeleteRequest_Body) XXX_DiscardUnknown() { var xxx_messageInfo_DeleteRequest_Body proto.InternalMessageInfo -func (m *DeleteRequest_Body) GetAddress() *refs.Address { +func (m *DeleteRequest_Body) GetAddress() *grpc1.Address { if m != nil { return m.Address } return nil } -func (m *DeleteRequest_Body) GetOwnerId() *refs.OwnerID { +func (m *DeleteRequest_Body) GetOwnerId() *grpc1.OwnerID { if m != nil { return m.OwnerId } @@ -905,21 +905,21 @@ type DeleteResponse struct { Body *DeleteResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` // Carries response meta information. Header data is used only to regulate // message transport and does not affect request execution. - MetaHeader *service.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" json:"meta_header,omitempty"` + MetaHeader *grpc.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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 *service.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + VerifyHeader *grpc.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *DeleteResponse) Reset() { *m = DeleteResponse{} } func (m *DeleteResponse) String() string { return proto.CompactTextString(m) } func (*DeleteResponse) ProtoMessage() {} func (*DeleteResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_6233c87a2945599e, []int{5} + return fileDescriptor_1d7d92b1e85e5b48, []int{5} } func (m *DeleteResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -955,14 +955,14 @@ func (m *DeleteResponse) GetBody() *DeleteResponse_Body { return nil } -func (m *DeleteResponse) GetMetaHeader() *service.ResponseMetaHeader { +func (m *DeleteResponse) GetMetaHeader() *grpc.ResponseMetaHeader { if m != nil { return m.MetaHeader } return nil } -func (m *DeleteResponse) GetVerifyHeader() *service.ResponseVerificationHeader { +func (m *DeleteResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { if m != nil { return m.VerifyHeader } @@ -980,7 +980,7 @@ func (m *DeleteResponse_Body) Reset() { *m = DeleteResponse_Body{} } func (m *DeleteResponse_Body) String() string { return proto.CompactTextString(m) } func (*DeleteResponse_Body) ProtoMessage() {} func (*DeleteResponse_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_6233c87a2945599e, []int{5, 0} + return fileDescriptor_1d7d92b1e85e5b48, []int{5, 0} } func (m *DeleteResponse_Body) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1015,20 +1015,20 @@ type HeadRequest struct { Body *HeadRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` // Carries request meta information. Header data is used only to regulate message // transport and does not affect request execution. - MetaHeader *service.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" json:"meta_header,omitempty"` + MetaHeader *grpc.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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 *service.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + VerifyHeader *grpc.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *HeadRequest) Reset() { *m = HeadRequest{} } func (m *HeadRequest) String() string { return proto.CompactTextString(m) } func (*HeadRequest) ProtoMessage() {} func (*HeadRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_6233c87a2945599e, []int{6} + return fileDescriptor_1d7d92b1e85e5b48, []int{6} } func (m *HeadRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1064,14 +1064,14 @@ func (m *HeadRequest) GetBody() *HeadRequest_Body { return nil } -func (m *HeadRequest) GetMetaHeader() *service.RequestMetaHeader { +func (m *HeadRequest) GetMetaHeader() *grpc.RequestMetaHeader { if m != nil { return m.MetaHeader } return nil } -func (m *HeadRequest) GetVerifyHeader() *service.RequestVerificationHeader { +func (m *HeadRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { if m != nil { return m.VerifyHeader } @@ -1081,7 +1081,7 @@ func (m *HeadRequest) GetVerifyHeader() *service.RequestVerificationHeader { // Request body type HeadRequest_Body struct { // Address of the object with the requested header. - Address *refs.Address `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + Address *grpc1.Address `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` // Return only minimal header subset MainOnly bool `protobuf:"varint,2,opt,name=main_only,json=mainOnly,proto3" json:"main_only,omitempty"` // Carries the raw option flag of the request. @@ -1097,7 +1097,7 @@ func (m *HeadRequest_Body) Reset() { *m = HeadRequest_Body{} } func (m *HeadRequest_Body) String() string { return proto.CompactTextString(m) } func (*HeadRequest_Body) ProtoMessage() {} func (*HeadRequest_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_6233c87a2945599e, []int{6, 0} + return fileDescriptor_1d7d92b1e85e5b48, []int{6, 0} } func (m *HeadRequest_Body) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1126,7 +1126,7 @@ func (m *HeadRequest_Body) XXX_DiscardUnknown() { var xxx_messageInfo_HeadRequest_Body proto.InternalMessageInfo -func (m *HeadRequest_Body) GetAddress() *refs.Address { +func (m *HeadRequest_Body) GetAddress() *grpc1.Address { if m != nil { return m.Address } @@ -1153,21 +1153,21 @@ type HeadResponse struct { Body *HeadResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` // Carries response meta information. Header data is used only to regulate // message transport and does not affect request execution. - MetaHeader *service.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" json:"meta_header,omitempty"` + MetaHeader *grpc.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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 *service.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + VerifyHeader *grpc.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *HeadResponse) Reset() { *m = HeadResponse{} } func (m *HeadResponse) String() string { return proto.CompactTextString(m) } func (*HeadResponse) ProtoMessage() {} func (*HeadResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_6233c87a2945599e, []int{7} + return fileDescriptor_1d7d92b1e85e5b48, []int{7} } func (m *HeadResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1203,14 +1203,14 @@ func (m *HeadResponse) GetBody() *HeadResponse_Body { return nil } -func (m *HeadResponse) GetMetaHeader() *service.ResponseMetaHeader { +func (m *HeadResponse) GetMetaHeader() *grpc.ResponseMetaHeader { if m != nil { return m.MetaHeader } return nil } -func (m *HeadResponse) GetVerifyHeader() *service.ResponseVerificationHeader { +func (m *HeadResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { if m != nil { return m.VerifyHeader } @@ -1234,7 +1234,7 @@ func (m *HeadResponse_Body) Reset() { *m = HeadResponse_Body{} } func (m *HeadResponse_Body) String() string { return proto.CompactTextString(m) } func (*HeadResponse_Body) ProtoMessage() {} func (*HeadResponse_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_6233c87a2945599e, []int{7, 0} + return fileDescriptor_1d7d92b1e85e5b48, []int{7, 0} } func (m *HeadResponse_Body) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1311,11 +1311,11 @@ func (*HeadResponse_Body) XXX_OneofWrappers() []interface{} { // Short header fields type HeadResponse_Body_ShortHeader struct { // Object format version. - Version *service.Version `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` + Version *grpc.Version `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` // Epoch when the object was created CreationEpoch uint64 `protobuf:"varint,2,opt,name=creation_epoch,json=creationEpoch,proto3" json:"creation_epoch,omitempty"` // Object's owner - OwnerId *refs.OwnerID `protobuf:"bytes,3,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"` + OwnerId *grpc1.OwnerID `protobuf:"bytes,3,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"` // Type of the object payload content ObjectType ObjectType `protobuf:"varint,4,opt,name=object_type,json=objectType,proto3,enum=neo.fs.v2.object.ObjectType" json:"object_type,omitempty"` // Size of payload in bytes. @@ -1330,7 +1330,7 @@ func (m *HeadResponse_Body_ShortHeader) Reset() { *m = HeadResponse_Body func (m *HeadResponse_Body_ShortHeader) String() string { return proto.CompactTextString(m) } func (*HeadResponse_Body_ShortHeader) ProtoMessage() {} func (*HeadResponse_Body_ShortHeader) Descriptor() ([]byte, []int) { - return fileDescriptor_6233c87a2945599e, []int{7, 0, 0} + return fileDescriptor_1d7d92b1e85e5b48, []int{7, 0, 0} } func (m *HeadResponse_Body_ShortHeader) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1359,7 +1359,7 @@ func (m *HeadResponse_Body_ShortHeader) XXX_DiscardUnknown() { var xxx_messageInfo_HeadResponse_Body_ShortHeader proto.InternalMessageInfo -func (m *HeadResponse_Body_ShortHeader) GetVersion() *service.Version { +func (m *HeadResponse_Body_ShortHeader) GetVersion() *grpc.Version { if m != nil { return m.Version } @@ -1373,7 +1373,7 @@ func (m *HeadResponse_Body_ShortHeader) GetCreationEpoch() uint64 { return 0 } -func (m *HeadResponse_Body_ShortHeader) GetOwnerId() *refs.OwnerID { +func (m *HeadResponse_Body_ShortHeader) GetOwnerId() *grpc1.OwnerID { if m != nil { return m.OwnerId } @@ -1400,20 +1400,20 @@ type SearchRequest struct { Body *SearchRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` // Carries request meta information. Header data is used only to regulate message // transport and does not affect request execution. - MetaHeader *service.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" json:"meta_header,omitempty"` + MetaHeader *grpc.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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 *service.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + VerifyHeader *grpc.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *SearchRequest) Reset() { *m = SearchRequest{} } func (m *SearchRequest) String() string { return proto.CompactTextString(m) } func (*SearchRequest) ProtoMessage() {} func (*SearchRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_6233c87a2945599e, []int{8} + return fileDescriptor_1d7d92b1e85e5b48, []int{8} } func (m *SearchRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1449,14 +1449,14 @@ func (m *SearchRequest) GetBody() *SearchRequest_Body { return nil } -func (m *SearchRequest) GetMetaHeader() *service.RequestMetaHeader { +func (m *SearchRequest) GetMetaHeader() *grpc.RequestMetaHeader { if m != nil { return m.MetaHeader } return nil } -func (m *SearchRequest) GetVerifyHeader() *service.RequestVerificationHeader { +func (m *SearchRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { if m != nil { return m.VerifyHeader } @@ -1466,7 +1466,7 @@ func (m *SearchRequest) GetVerifyHeader() *service.RequestVerificationHeader { // Request body type SearchRequest_Body struct { // Carries search container identifier. - ContainerId *refs.ContainerID `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` + ContainerId *grpc1.ContainerID `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` // Version of the Query Language used Version uint32 `protobuf:"varint,2,opt,name=version,proto3" json:"version,omitempty"` // List of search expressions @@ -1480,7 +1480,7 @@ func (m *SearchRequest_Body) Reset() { *m = SearchRequest_Body{} } func (m *SearchRequest_Body) String() string { return proto.CompactTextString(m) } func (*SearchRequest_Body) ProtoMessage() {} func (*SearchRequest_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_6233c87a2945599e, []int{8, 0} + return fileDescriptor_1d7d92b1e85e5b48, []int{8, 0} } func (m *SearchRequest_Body) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1509,7 +1509,7 @@ func (m *SearchRequest_Body) XXX_DiscardUnknown() { var xxx_messageInfo_SearchRequest_Body proto.InternalMessageInfo -func (m *SearchRequest_Body) GetContainerId() *refs.ContainerID { +func (m *SearchRequest_Body) GetContainerId() *grpc1.ContainerID { if m != nil { return m.ContainerId } @@ -1547,7 +1547,7 @@ func (m *SearchRequest_Body_Filter) Reset() { *m = SearchRequest_Body_Fi func (m *SearchRequest_Body_Filter) String() string { return proto.CompactTextString(m) } func (*SearchRequest_Body_Filter) ProtoMessage() {} func (*SearchRequest_Body_Filter) Descriptor() ([]byte, []int) { - return fileDescriptor_6233c87a2945599e, []int{8, 0, 0} + return fileDescriptor_1d7d92b1e85e5b48, []int{8, 0, 0} } func (m *SearchRequest_Body_Filter) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1603,21 +1603,21 @@ type SearchResponse struct { Body *SearchResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` // Carries response meta information. Header data is used only to regulate // message transport and does not affect request execution. - MetaHeader *service.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" json:"meta_header,omitempty"` + MetaHeader *grpc.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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 *service.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + VerifyHeader *grpc.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *SearchResponse) Reset() { *m = SearchResponse{} } func (m *SearchResponse) String() string { return proto.CompactTextString(m) } func (*SearchResponse) ProtoMessage() {} func (*SearchResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_6233c87a2945599e, []int{9} + return fileDescriptor_1d7d92b1e85e5b48, []int{9} } func (m *SearchResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1653,14 +1653,14 @@ func (m *SearchResponse) GetBody() *SearchResponse_Body { return nil } -func (m *SearchResponse) GetMetaHeader() *service.ResponseMetaHeader { +func (m *SearchResponse) GetMetaHeader() *grpc.ResponseMetaHeader { if m != nil { return m.MetaHeader } return nil } -func (m *SearchResponse) GetVerifyHeader() *service.ResponseVerificationHeader { +func (m *SearchResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { if m != nil { return m.VerifyHeader } @@ -1670,17 +1670,17 @@ func (m *SearchResponse) GetVerifyHeader() *service.ResponseVerificationHeader { // Response body type SearchResponse_Body struct { // Carries list of object identifiers that match the search query - IdList []*refs.ObjectID `protobuf:"bytes,1,rep,name=id_list,json=idList,proto3" json:"id_list,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + IdList []*grpc1.ObjectID `protobuf:"bytes,1,rep,name=id_list,json=idList,proto3" json:"id_list,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *SearchResponse_Body) Reset() { *m = SearchResponse_Body{} } func (m *SearchResponse_Body) String() string { return proto.CompactTextString(m) } func (*SearchResponse_Body) ProtoMessage() {} func (*SearchResponse_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_6233c87a2945599e, []int{9, 0} + return fileDescriptor_1d7d92b1e85e5b48, []int{9, 0} } func (m *SearchResponse_Body) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1709,7 +1709,7 @@ func (m *SearchResponse_Body) XXX_DiscardUnknown() { var xxx_messageInfo_SearchResponse_Body proto.InternalMessageInfo -func (m *SearchResponse_Body) GetIdList() []*refs.ObjectID { +func (m *SearchResponse_Body) GetIdList() []*grpc1.ObjectID { if m != nil { return m.IdList } @@ -1731,7 +1731,7 @@ func (m *Range) Reset() { *m = Range{} } func (m *Range) String() string { return proto.CompactTextString(m) } func (*Range) ProtoMessage() {} func (*Range) Descriptor() ([]byte, []int) { - return fileDescriptor_6233c87a2945599e, []int{10} + return fileDescriptor_1d7d92b1e85e5b48, []int{10} } func (m *Range) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1780,20 +1780,20 @@ type GetRangeRequest struct { Body *GetRangeRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` // Carries request meta information. Header data is used only to regulate message // transport and does not affect request execution. - MetaHeader *service.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" json:"meta_header,omitempty"` + MetaHeader *grpc.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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 *service.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + VerifyHeader *grpc.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetRangeRequest) Reset() { *m = GetRangeRequest{} } func (m *GetRangeRequest) String() string { return proto.CompactTextString(m) } func (*GetRangeRequest) ProtoMessage() {} func (*GetRangeRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_6233c87a2945599e, []int{11} + return fileDescriptor_1d7d92b1e85e5b48, []int{11} } func (m *GetRangeRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1829,14 +1829,14 @@ func (m *GetRangeRequest) GetBody() *GetRangeRequest_Body { return nil } -func (m *GetRangeRequest) GetMetaHeader() *service.RequestMetaHeader { +func (m *GetRangeRequest) GetMetaHeader() *grpc.RequestMetaHeader { if m != nil { return m.MetaHeader } return nil } -func (m *GetRangeRequest) GetVerifyHeader() *service.RequestVerificationHeader { +func (m *GetRangeRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { if m != nil { return m.VerifyHeader } @@ -1846,7 +1846,7 @@ func (m *GetRangeRequest) GetVerifyHeader() *service.RequestVerificationHeader { // Request Body type GetRangeRequest_Body struct { // Address carries address of the object that contains the requested payload range. - Address *refs.Address `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + Address *grpc1.Address `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` // Range carries the parameters of the requested payload range. Range *Range `protobuf:"bytes,2,opt,name=range,proto3" json:"range,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` @@ -1858,7 +1858,7 @@ func (m *GetRangeRequest_Body) Reset() { *m = GetRangeRequest_Body{} } func (m *GetRangeRequest_Body) String() string { return proto.CompactTextString(m) } func (*GetRangeRequest_Body) ProtoMessage() {} func (*GetRangeRequest_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_6233c87a2945599e, []int{11, 0} + return fileDescriptor_1d7d92b1e85e5b48, []int{11, 0} } func (m *GetRangeRequest_Body) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1887,7 +1887,7 @@ func (m *GetRangeRequest_Body) XXX_DiscardUnknown() { var xxx_messageInfo_GetRangeRequest_Body proto.InternalMessageInfo -func (m *GetRangeRequest_Body) GetAddress() *refs.Address { +func (m *GetRangeRequest_Body) GetAddress() *grpc1.Address { if m != nil { return m.Address } @@ -1907,21 +1907,21 @@ type GetRangeResponse struct { Body *GetRangeResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` // Carries response meta information. Header data is used only to regulate // message transport and does not affect request execution. - MetaHeader *service.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" json:"meta_header,omitempty"` + MetaHeader *grpc.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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 *service.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + VerifyHeader *grpc.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetRangeResponse) Reset() { *m = GetRangeResponse{} } func (m *GetRangeResponse) String() string { return proto.CompactTextString(m) } func (*GetRangeResponse) ProtoMessage() {} func (*GetRangeResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_6233c87a2945599e, []int{12} + return fileDescriptor_1d7d92b1e85e5b48, []int{12} } func (m *GetRangeResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1957,14 +1957,14 @@ func (m *GetRangeResponse) GetBody() *GetRangeResponse_Body { return nil } -func (m *GetRangeResponse) GetMetaHeader() *service.ResponseMetaHeader { +func (m *GetRangeResponse) GetMetaHeader() *grpc.ResponseMetaHeader { if m != nil { return m.MetaHeader } return nil } -func (m *GetRangeResponse) GetVerifyHeader() *service.ResponseVerificationHeader { +func (m *GetRangeResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { if m != nil { return m.VerifyHeader } @@ -1984,7 +1984,7 @@ func (m *GetRangeResponse_Body) Reset() { *m = GetRangeResponse_Body{} } func (m *GetRangeResponse_Body) String() string { return proto.CompactTextString(m) } func (*GetRangeResponse_Body) ProtoMessage() {} func (*GetRangeResponse_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_6233c87a2945599e, []int{12, 0} + return fileDescriptor_1d7d92b1e85e5b48, []int{12, 0} } func (m *GetRangeResponse_Body) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -2026,20 +2026,20 @@ type GetRangeHashRequest struct { Body *GetRangeHashRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` // Carries request meta information. Header data is used only to regulate message // transport and does not affect request execution. - MetaHeader *service.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" json:"meta_header,omitempty"` + MetaHeader *grpc.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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 *service.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + VerifyHeader *grpc.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetRangeHashRequest) Reset() { *m = GetRangeHashRequest{} } func (m *GetRangeHashRequest) String() string { return proto.CompactTextString(m) } func (*GetRangeHashRequest) ProtoMessage() {} func (*GetRangeHashRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_6233c87a2945599e, []int{13} + return fileDescriptor_1d7d92b1e85e5b48, []int{13} } func (m *GetRangeHashRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -2075,14 +2075,14 @@ func (m *GetRangeHashRequest) GetBody() *GetRangeHashRequest_Body { return nil } -func (m *GetRangeHashRequest) GetMetaHeader() *service.RequestMetaHeader { +func (m *GetRangeHashRequest) GetMetaHeader() *grpc.RequestMetaHeader { if m != nil { return m.MetaHeader } return nil } -func (m *GetRangeHashRequest) GetVerifyHeader() *service.RequestVerificationHeader { +func (m *GetRangeHashRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { if m != nil { return m.VerifyHeader } @@ -2092,7 +2092,7 @@ func (m *GetRangeHashRequest) GetVerifyHeader() *service.RequestVerificationHead // Request body type GetRangeHashRequest_Body struct { // Carries address of the object that contains the requested payload range. - Address *refs.Address `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + Address *grpc1.Address `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` // Carries the list of object payload range to calculate homomorphic hash. Ranges []*Range `protobuf:"bytes,2,rep,name=ranges,proto3" json:"ranges,omitempty"` // Carries binary salt to XOR object payload ranges before hash calculation. @@ -2106,7 +2106,7 @@ func (m *GetRangeHashRequest_Body) Reset() { *m = GetRangeHashRequest_Bo func (m *GetRangeHashRequest_Body) String() string { return proto.CompactTextString(m) } func (*GetRangeHashRequest_Body) ProtoMessage() {} func (*GetRangeHashRequest_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_6233c87a2945599e, []int{13, 0} + return fileDescriptor_1d7d92b1e85e5b48, []int{13, 0} } func (m *GetRangeHashRequest_Body) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -2135,7 +2135,7 @@ func (m *GetRangeHashRequest_Body) XXX_DiscardUnknown() { var xxx_messageInfo_GetRangeHashRequest_Body proto.InternalMessageInfo -func (m *GetRangeHashRequest_Body) GetAddress() *refs.Address { +func (m *GetRangeHashRequest_Body) GetAddress() *grpc1.Address { if m != nil { return m.Address } @@ -2162,21 +2162,21 @@ type GetRangeHashResponse struct { Body *GetRangeHashResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` // Carries response meta information. Header data is used only to regulate // message transport and does not affect request execution. - MetaHeader *service.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" json:"meta_header,omitempty"` + MetaHeader *grpc.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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 *service.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + VerifyHeader *grpc.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetRangeHashResponse) Reset() { *m = GetRangeHashResponse{} } func (m *GetRangeHashResponse) String() string { return proto.CompactTextString(m) } func (*GetRangeHashResponse) ProtoMessage() {} func (*GetRangeHashResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_6233c87a2945599e, []int{14} + return fileDescriptor_1d7d92b1e85e5b48, []int{14} } func (m *GetRangeHashResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -2212,14 +2212,14 @@ func (m *GetRangeHashResponse) GetBody() *GetRangeHashResponse_Body { return nil } -func (m *GetRangeHashResponse) GetMetaHeader() *service.ResponseMetaHeader { +func (m *GetRangeHashResponse) GetMetaHeader() *grpc.ResponseMetaHeader { if m != nil { return m.MetaHeader } return nil } -func (m *GetRangeHashResponse) GetVerifyHeader() *service.ResponseVerificationHeader { +func (m *GetRangeHashResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { if m != nil { return m.VerifyHeader } @@ -2239,7 +2239,7 @@ func (m *GetRangeHashResponse_Body) Reset() { *m = GetRangeHashResponse_ func (m *GetRangeHashResponse_Body) String() string { return proto.CompactTextString(m) } func (*GetRangeHashResponse_Body) ProtoMessage() {} func (*GetRangeHashResponse_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_6233c87a2945599e, []int{14, 0} + return fileDescriptor_1d7d92b1e85e5b48, []int{14, 0} } func (m *GetRangeHashResponse_Body) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -2312,107 +2312,107 @@ func init() { proto.RegisterType((*GetRangeHashResponse_Body)(nil), "neo.fs.v2.object.GetRangeHashResponse.Body") } -func init() { proto.RegisterFile("v2/object/service.proto", fileDescriptor_6233c87a2945599e) } +func init() { proto.RegisterFile("v2/object/grpc/service.proto", fileDescriptor_1d7d92b1e85e5b48) } -var fileDescriptor_6233c87a2945599e = []byte{ - // 1396 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x58, 0x4f, 0x73, 0xdb, 0x44, - 0x14, 0x8f, 0x64, 0xc5, 0x89, 0x9f, 0xed, 0x90, 0xd9, 0x96, 0xd6, 0xa3, 0xb6, 0x21, 0x55, 0x9b, - 0x36, 0x43, 0x89, 0x1c, 0x0c, 0xa5, 0xb4, 0xa5, 0x65, 0x92, 0xc6, 0x69, 0x3c, 0x6d, 0xd2, 0x54, - 0x4e, 0x3b, 0x43, 0x67, 0x18, 0x8f, 0x22, 0xad, 0x63, 0x81, 0x2d, 0x19, 0xad, 0xec, 0x8e, 0x2f, - 0x9c, 0xe0, 0xc0, 0x37, 0xe8, 0x70, 0x00, 0x86, 0x63, 0xb9, 0xf1, 0x01, 0xb8, 0x70, 0x81, 0x5b, - 0x81, 0x2f, 0xc0, 0x84, 0x33, 0xd3, 0x6f, 0xc0, 0x30, 0xfb, 0x47, 0xb6, 0x95, 0xfa, 0x1f, 0xb9, - 0x89, 0x93, 0xa5, 0xa7, 0xdf, 0x7b, 0xde, 0xf7, 0xdb, 0xdf, 0xbe, 0xb7, 0xbb, 0x70, 0xba, 0x5d, - 0xc8, 0x7b, 0xfb, 0x9f, 0x60, 0x2b, 0xc8, 0x13, 0xec, 0xb7, 0x1d, 0x0b, 0xeb, 0x4d, 0xdf, 0x0b, - 0x3c, 0x34, 0xef, 0x62, 0x4f, 0xaf, 0x12, 0xbd, 0x5d, 0xd0, 0xf9, 0x77, 0xf5, 0xf5, 0x1e, 0x34, - 0xe8, 0x34, 0x31, 0xe1, 0x40, 0xf5, 0x44, 0xbb, 0x90, 0xf7, 0x71, 0x95, 0x44, 0x8c, 0x14, 0x2b, - 0xe2, 0xe5, 0x1b, 0x38, 0x30, 0x85, 0xf9, 0x74, 0x9f, 0xb9, 0x8d, 0x7d, 0xa7, 0xda, 0xe1, 0x1f, - 0xb4, 0xe7, 0x32, 0xc0, 0x5d, 0x1c, 0x18, 0xf8, 0xb3, 0x16, 0x26, 0x01, 0xba, 0x0a, 0xca, 0xbe, - 0x67, 0x77, 0x72, 0xd2, 0xa2, 0xb4, 0x9c, 0x2e, 0x9c, 0xd7, 0x8f, 0x8e, 0x45, 0xef, 0x61, 0xf5, - 0x75, 0xcf, 0xee, 0x18, 0x0c, 0x8e, 0x8a, 0x90, 0xa6, 0x7f, 0x56, 0xa9, 0x61, 0xd3, 0xc6, 0x7e, - 0x4e, 0x66, 0xde, 0x17, 0xfb, 0xbc, 0xc3, 0x14, 0x85, 0xef, 0x36, 0x0e, 0xcc, 0x2d, 0x86, 0x35, - 0xa0, 0xd1, 0x7d, 0x46, 0x0f, 0x21, 0xcb, 0x07, 0x17, 0x06, 0x4a, 0xb0, 0x40, 0x6f, 0x0d, 0x0f, - 0xf4, 0x98, 0xc2, 0x1d, 0xcb, 0x0c, 0x1c, 0xcf, 0x15, 0x01, 0x33, 0x3c, 0x04, 0x7f, 0x53, 0xef, - 0x81, 0x42, 0xc7, 0x89, 0xde, 0x86, 0x19, 0xd3, 0xb6, 0x7d, 0x4c, 0x88, 0xc8, 0xed, 0x74, 0x5f, - 0x50, 0xca, 0xa2, 0xbe, 0xc6, 0x3f, 0x1b, 0x21, 0x0e, 0xcd, 0x43, 0xc2, 0x37, 0x9f, 0xb2, 0x64, - 0x66, 0x0d, 0xfa, 0xa8, 0xfd, 0x93, 0x80, 0x34, 0x23, 0x80, 0x34, 0x3d, 0x97, 0x60, 0xf4, 0x5e, - 0x84, 0x2d, 0x6d, 0x08, 0x5b, 0x1c, 0xdc, 0x4f, 0xd7, 0xe6, 0x20, 0xba, 0x96, 0x06, 0x66, 0xc9, - 0x9d, 0x87, 0xf0, 0x65, 0x0c, 0xe6, 0x6b, 0x65, 0x44, 0xa4, 0xb1, 0x84, 0x7d, 0x2d, 0x0b, 0xc6, - 0x6e, 0x81, 0xe2, 0xb8, 0x4e, 0x20, 0x92, 0xbb, 0x3c, 0x3e, 0x39, 0xbd, 0xe4, 0x3a, 0xc1, 0xd6, - 0x94, 0xc1, 0xdc, 0xd0, 0x29, 0x98, 0xb6, 0x6a, 0x2d, 0xf7, 0x53, 0x96, 0x5d, 0x66, 0x6b, 0xca, - 0xe0, 0xaf, 0xea, 0x0f, 0x12, 0x28, 0x14, 0x88, 0xae, 0x42, 0x8a, 0x07, 0xaa, 0x38, 0xb6, 0xf8, - 0x93, 0xdc, 0xd1, 0x39, 0x79, 0xc0, 0x00, 0xa5, 0x0d, 0x63, 0x96, 0x43, 0x4b, 0x36, 0xba, 0x01, - 0x29, 0xe2, 0x1c, 0xb8, 0x66, 0xd0, 0xf2, 0xb1, 0x60, 0xee, 0xec, 0x80, 0x7c, 0xcb, 0x21, 0xc6, - 0xe8, 0xc1, 0xd1, 0x2a, 0x24, 0x23, 0x44, 0xe5, 0x5e, 0x4d, 0x4a, 0x70, 0x22, 0x70, 0xeb, 0x59, - 0x48, 0x8b, 0x41, 0x36, 0x4d, 0x3f, 0xd0, 0xbe, 0x51, 0x00, 0x76, 0x5b, 0x93, 0xaf, 0x96, 0x1e, - 0x36, 0x1e, 0xab, 0xe5, 0xa7, 0x70, 0xf2, 0x3f, 0x88, 0x4c, 0xfe, 0xa5, 0xb1, 0x99, 0x4d, 0x36, - 0xf7, 0x2f, 0xe2, 0x34, 0xf7, 0xe8, 0x02, 0x64, 0x2d, 0xaf, 0xe9, 0x60, 0x52, 0x71, 0x5b, 0x8d, - 0x7d, 0xec, 0xe7, 0x94, 0x45, 0x69, 0x39, 0x6b, 0x64, 0xb8, 0x71, 0x87, 0xd9, 0x8e, 0x0a, 0xe4, - 0x3b, 0x19, 0xd2, 0x8c, 0x9a, 0x49, 0x2b, 0x44, 0x1f, 0x38, 0x2e, 0x15, 0xe2, 0x96, 0xd0, 0xc8, - 0xf1, 0x26, 0x51, 0xfb, 0x5d, 0x86, 0xec, 0x06, 0xae, 0xe3, 0x00, 0x87, 0xcb, 0xe8, 0xfd, 0x08, - 0x49, 0x17, 0x5f, 0x25, 0x29, 0x02, 0x8f, 0xc7, 0x4a, 0x6a, 0x1c, 0xbf, 0xef, 0x14, 0x60, 0xd6, - 0x7b, 0xea, 0x62, 0x9f, 0xd2, 0x2a, 0x0f, 0xf6, 0x79, 0x40, 0xbf, 0x97, 0x36, 0x8c, 0x19, 0x06, - 0x2c, 0xd9, 0xda, 0x4b, 0x09, 0xe6, 0x42, 0x96, 0x84, 0xf4, 0xae, 0x47, 0x58, 0x5d, 0x1a, 0xce, - 0x6a, 0xbc, 0xd4, 0x97, 0xe4, 0xc4, 0x6a, 0xbf, 0xca, 0x90, 0xa6, 0xa6, 0x50, 0x44, 0x63, 0x57, - 0x5a, 0x1f, 0x38, 0x1e, 0x12, 0xaa, 0x1d, 0x5f, 0x42, 0x67, 0x20, 0xd5, 0x30, 0x1d, 0xb7, 0xe2, - 0xb9, 0xf5, 0x8e, 0xd8, 0xc0, 0xcc, 0x52, 0xc3, 0x03, 0xb7, 0xde, 0x09, 0xf7, 0x35, 0x89, 0xde, - 0xbe, 0xe6, 0xcb, 0x69, 0xc8, 0x70, 0x7a, 0x84, 0x76, 0xae, 0x45, 0xc8, 0xbc, 0x30, 0x8c, 0xcc, - 0x78, 0x29, 0xe7, 0xdb, 0x84, 0x20, 0xb4, 0xd0, 0x6d, 0x05, 0xd2, 0xe8, 0x56, 0xb0, 0x35, 0xd5, - 0x6d, 0x06, 0x7b, 0x90, 0x21, 0x35, 0xcf, 0x0f, 0xa2, 0x99, 0xe5, 0x27, 0x60, 0x46, 0x2f, 0x53, - 0xbf, 0x6e, 0xc0, 0x34, 0xe9, 0xbd, 0xaa, 0x5f, 0xc8, 0x90, 0xee, 0xfb, 0x8c, 0xde, 0x85, 0x99, - 0x36, 0xf6, 0x89, 0xe3, 0xb9, 0x62, 0x68, 0xea, 0x80, 0x84, 0x1f, 0x73, 0x84, 0x11, 0x42, 0xd1, - 0x12, 0xcc, 0x59, 0x3e, 0x66, 0x89, 0x57, 0x70, 0xd3, 0xb3, 0x6a, 0x6c, 0x74, 0x8a, 0x91, 0x0d, - 0xad, 0x45, 0x6a, 0x8c, 0xd4, 0x95, 0xc4, 0x64, 0x75, 0x05, 0xdd, 0xea, 0xb6, 0x37, 0x7a, 0xc8, - 0x60, 0x1d, 0x70, 0x2e, 0xd2, 0x73, 0x45, 0xd6, 0xbc, 0xce, 0xef, 0x75, 0x9a, 0xd8, 0x00, 0xaf, - 0xfb, 0x4c, 0x47, 0xd6, 0x34, 0x3b, 0x75, 0xcf, 0xb4, 0x2b, 0x75, 0xec, 0x1e, 0x04, 0xb5, 0xdc, - 0x34, 0x1f, 0x99, 0xb0, 0xde, 0x67, 0xc6, 0xf5, 0x24, 0x28, 0x94, 0x56, 0xed, 0x0f, 0x05, 0xb2, - 0x65, 0x6c, 0xfa, 0x56, 0x6d, 0xe2, 0xd6, 0x10, 0x81, 0xc7, 0x63, 0x5d, 0xff, 0x1d, 0x6e, 0xb2, - 0x6e, 0x43, 0xc6, 0xf2, 0xdc, 0xc0, 0x74, 0xc4, 0xa4, 0xf0, 0x24, 0xcf, 0x1c, 0x9d, 0x94, 0x3b, - 0x21, 0xa6, 0xb4, 0x61, 0xa4, 0xbb, 0x0e, 0x25, 0x1b, 0xe5, 0x7a, 0x6a, 0x91, 0xd9, 0xd6, 0xa4, - 0xab, 0x88, 0x22, 0xcc, 0x54, 0x9d, 0x7a, 0x80, 0x7d, 0x92, 0x4b, 0x2c, 0x26, 0x96, 0xd3, 0x85, - 0x2b, 0x93, 0x30, 0xa7, 0x6f, 0x32, 0x1f, 0x23, 0xf4, 0x55, 0x7f, 0x96, 0x20, 0xc9, 0x6d, 0x68, - 0x0f, 0xa0, 0x61, 0x06, 0x56, 0x8d, 0xeb, 0x40, 0x62, 0x3a, 0xb8, 0xfa, 0x1f, 0x82, 0xea, 0xdb, - 0xd4, 0x9b, 0x09, 0x24, 0xd5, 0x08, 0x1f, 0x11, 0x02, 0xc5, 0x35, 0x1b, 0x7c, 0x2f, 0x97, 0x32, - 0xd8, 0x33, 0x3a, 0x09, 0xd3, 0x6d, 0xb3, 0xde, 0xc2, 0x8c, 0xe9, 0x94, 0xc1, 0x5f, 0xb4, 0xeb, - 0x90, 0xea, 0x46, 0x40, 0x2a, 0x9c, 0xda, 0x5e, 0xdb, 0xbb, 0xb3, 0x55, 0xd9, 0xfb, 0x68, 0xb7, - 0x58, 0x79, 0xb4, 0x53, 0xde, 0x2d, 0xde, 0x29, 0x6d, 0x96, 0x8a, 0x1b, 0xf3, 0x53, 0x68, 0x1e, - 0x32, 0xe5, 0x3d, 0xa3, 0xb4, 0x73, 0xb7, 0x52, 0x7c, 0xf8, 0x68, 0xed, 0xfe, 0xbc, 0xa4, 0x7d, - 0x2f, 0xc3, 0x5c, 0x38, 0xae, 0x49, 0x7b, 0x63, 0x14, 0x1f, 0x97, 0x0a, 0x77, 0xbd, 0xd7, 0x31, - 0x1c, 0xbb, 0x52, 0x77, 0x08, 0xdd, 0xc0, 0x27, 0x46, 0xee, 0xcb, 0x92, 0x8e, 0x7d, 0xdf, 0x21, - 0x81, 0x76, 0x0d, 0xa6, 0x0d, 0xd3, 0x3d, 0xc0, 0xe8, 0x14, 0x24, 0xbd, 0x6a, 0x95, 0x60, 0xbe, - 0xf7, 0x57, 0x0c, 0xf1, 0x46, 0xed, 0x62, 0x09, 0xf3, 0xe2, 0x22, 0xde, 0xb4, 0xdf, 0x64, 0x78, - 0x8d, 0x9e, 0x04, 0xa9, 0x73, 0xb8, 0x6a, 0x6f, 0x44, 0xe8, 0xbd, 0x34, 0xf8, 0xe8, 0xd8, 0xe7, - 0xf0, 0xbf, 0xef, 0xc7, 0x2b, 0x30, 0xed, 0xd3, 0x7c, 0x07, 0xec, 0xe7, 0x04, 0x23, 0x9c, 0x0e, - 0x8e, 0xd2, 0xbe, 0x92, 0x61, 0xbe, 0x47, 0x91, 0xd0, 0xec, 0xcd, 0x08, 0xa9, 0x97, 0x47, 0x91, - 0x1a, 0x2f, 0xd5, 0x9e, 0x15, 0xbc, 0x9e, 0x0c, 0x4f, 0x8d, 0x34, 0xc3, 0x8c, 0x38, 0x33, 0x6a, - 0x2f, 0x65, 0x38, 0x11, 0x66, 0xb6, 0x65, 0x92, 0x6e, 0x67, 0xb8, 0x1d, 0xa1, 0xe3, 0xcd, 0xe1, - 0x74, 0xf4, 0x39, 0xc5, 0x43, 0x67, 0x9f, 0x1f, 0x5f, 0x67, 0x79, 0x48, 0x32, 0x05, 0x91, 0x9c, - 0xcc, 0xd6, 0xfd, 0x50, 0xa1, 0x09, 0x18, 0x2d, 0xc0, 0xc4, 0xac, 0x07, 0x6c, 0xd4, 0x19, 0x83, - 0x3d, 0x6b, 0xcf, 0x64, 0x38, 0x19, 0x25, 0x4f, 0x28, 0xf0, 0xc3, 0x08, 0xe5, 0x57, 0xc6, 0x51, - 0x1e, 0x2f, 0x15, 0x5e, 0x10, 0xac, 0x9f, 0x81, 0x54, 0xcd, 0x24, 0xb5, 0x5e, 0xf5, 0xcc, 0x18, - 0xb3, 0xd4, 0x40, 0xab, 0x64, 0xe1, 0x47, 0x05, 0xb2, 0xbc, 0x74, 0x96, 0x79, 0x7c, 0xb4, 0x01, - 0x89, 0xbb, 0x38, 0x40, 0x67, 0x47, 0xdd, 0x94, 0xaa, 0xe7, 0x46, 0x5e, 0x9e, 0xad, 0x4a, 0x34, - 0xca, 0x6e, 0x6b, 0x60, 0x94, 0xde, 0x3d, 0xcb, 0xa0, 0x28, 0x7d, 0xb7, 0x07, 0xcb, 0x12, 0xba, - 0x07, 0x49, 0x7e, 0xa6, 0x43, 0x6f, 0x8c, 0x39, 0x43, 0xab, 0x8b, 0xe3, 0x8e, 0x83, 0xa8, 0x08, - 0x0a, 0x65, 0x06, 0x9d, 0x1b, 0x79, 0x92, 0x52, 0x17, 0x46, 0xef, 0x80, 0xd1, 0x36, 0x24, 0x79, - 0x2f, 0x1d, 0x34, 0xa6, 0xc8, 0x6e, 0x61, 0xd0, 0x98, 0xa2, 0x6d, 0x78, 0x55, 0x42, 0x65, 0x98, - 0x0d, 0x45, 0x86, 0xce, 0x8f, 0xed, 0x2b, 0xaa, 0x36, 0xbe, 0x4a, 0xae, 0x4a, 0xe8, 0x63, 0xc8, - 0xf4, 0x2b, 0x17, 0x2d, 0x4d, 0x54, 0x4c, 0xd4, 0x4b, 0x93, 0x2d, 0x80, 0xf5, 0x27, 0xbf, 0x1c, - 0x2e, 0x48, 0x2f, 0x0e, 0x17, 0xa4, 0x3f, 0x0f, 0x17, 0xa4, 0x67, 0x7f, 0x2d, 0x4c, 0x3d, 0x29, - 0x1c, 0x38, 0x41, 0xad, 0xb5, 0xaf, 0x5b, 0x5e, 0x23, 0xef, 0x92, 0xa6, 0x65, 0xad, 0xd8, 0xb8, - 0x9d, 0x77, 0xb1, 0x57, 0x25, 0x2b, 0x66, 0xd3, 0x59, 0x39, 0xf0, 0xf2, 0xdd, 0x2b, 0xff, 0x9b, - 0xfc, 0xe7, 0xb9, 0x7c, 0x62, 0x07, 0x7b, 0x9b, 0x65, 0x7d, 0x6d, 0xb7, 0x44, 0xff, 0x90, 0xab, - 0x70, 0x3f, 0xc9, 0x6e, 0xf1, 0xdf, 0xf9, 0x37, 0x00, 0x00, 0xff, 0xff, 0xd6, 0xca, 0xeb, 0x7d, - 0x4e, 0x18, 0x00, 0x00, +var fileDescriptor_1d7d92b1e85e5b48 = []byte{ + // 1403 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x59, 0x4d, 0x73, 0xdb, 0x54, + 0x17, 0x8e, 0x64, 0xc5, 0x89, 0x8f, 0xed, 0xbc, 0x99, 0xdb, 0x4e, 0x5f, 0x8f, 0x9a, 0x86, 0x54, + 0x6d, 0xda, 0x0c, 0x25, 0x72, 0x30, 0x94, 0xd2, 0x96, 0x96, 0x49, 0x1a, 0xa7, 0xf1, 0xb4, 0x49, + 0x53, 0x39, 0xed, 0x0c, 0xcc, 0x30, 0x1e, 0x45, 0xba, 0x8e, 0x05, 0xb6, 0x64, 0x74, 0x65, 0x77, + 0xbc, 0x61, 0x05, 0x0b, 0xfe, 0x41, 0x87, 0x05, 0x30, 0x2c, 0xcb, 0x8e, 0x1f, 0xc0, 0x86, 0x0d, + 0xec, 0x0a, 0xfc, 0x01, 0xa6, 0xac, 0x99, 0xfe, 0x03, 0x86, 0xb9, 0x1f, 0xb2, 0x2d, 0xd7, 0x5f, + 0x64, 0x27, 0x76, 0xf7, 0xe3, 0x39, 0xc7, 0xf7, 0x3c, 0xf7, 0xb9, 0xe7, 0xdc, 0x2b, 0xc3, 0x52, + 0xbb, 0x90, 0xf7, 0x8e, 0x3e, 0xc6, 0x56, 0x90, 0x3f, 0xf6, 0x9b, 0x56, 0x9e, 0x60, 0xbf, 0xed, + 0x58, 0x58, 0x6f, 0xfa, 0x5e, 0xe0, 0xa1, 0x45, 0x17, 0x7b, 0x7a, 0x95, 0xe8, 0xed, 0x82, 0xce, + 0x41, 0xaa, 0x3a, 0x80, 0x0f, 0x3a, 0x4d, 0x4c, 0x38, 0x5a, 0xcd, 0xb5, 0x0b, 0x79, 0x1f, 0x57, + 0xc9, 0xab, 0x33, 0xd4, 0x4a, 0x78, 0xe6, 0x93, 0x0d, 0x1c, 0x98, 0x62, 0x6e, 0x69, 0x70, 0xae, + 0x8d, 0x7d, 0xa7, 0xda, 0xe1, 0xb3, 0xda, 0x33, 0x19, 0xe0, 0x2e, 0x0e, 0x0c, 0xfc, 0x69, 0x0b, + 0x93, 0x00, 0x5d, 0x05, 0xe5, 0xc8, 0xb3, 0x3b, 0x39, 0x69, 0x45, 0x5a, 0x4b, 0x17, 0xce, 0xeb, + 0x83, 0xeb, 0xd3, 0x7b, 0x58, 0x7d, 0xcb, 0xb3, 0x3b, 0x06, 0x83, 0xa3, 0x22, 0xa4, 0xe9, 0x2f, + 0x56, 0x6a, 0xd8, 0xb4, 0xb1, 0x9f, 0x93, 0x99, 0xf5, 0xc5, 0x3e, 0xeb, 0x30, 0x6c, 0x61, 0xbb, + 0x87, 0x03, 0x73, 0x97, 0x61, 0x0d, 0x68, 0x74, 0xdb, 0xe8, 0x21, 0x64, 0xf9, 0xe2, 0x42, 0x47, + 0x09, 0xe6, 0xe8, 0x8d, 0xd1, 0x8e, 0x1e, 0x53, 0xb8, 0x63, 0x99, 0x81, 0xe3, 0xb9, 0xc2, 0x61, + 0x86, 0xbb, 0xe0, 0x3d, 0xf5, 0x1e, 0x28, 0x74, 0x9d, 0xe8, 0x4d, 0x98, 0x33, 0x6d, 0xdb, 0xc7, + 0x84, 0x88, 0xd8, 0xfe, 0xdf, 0xe7, 0x94, 0x92, 0xaa, 0x6f, 0xf2, 0x69, 0x23, 0xc4, 0xa1, 0x45, + 0x48, 0xf8, 0xe6, 0x13, 0x16, 0xcc, 0xbc, 0x41, 0x9b, 0xda, 0xdf, 0x09, 0x48, 0x33, 0x02, 0x48, + 0xd3, 0x73, 0x09, 0x46, 0xef, 0x44, 0xd8, 0xd2, 0x46, 0xb0, 0xc5, 0xc1, 0xfd, 0x74, 0xed, 0x0c, + 0xa3, 0x6b, 0x75, 0x68, 0x94, 0xdc, 0x78, 0x04, 0x5f, 0xc6, 0x70, 0xbe, 0xd6, 0xc7, 0x78, 0x9a, + 0x48, 0xd8, 0x57, 0xb2, 0x60, 0xec, 0x16, 0x28, 0x8e, 0xeb, 0x04, 0x22, 0xb8, 0xcb, 0x93, 0x83, + 0xd3, 0x4b, 0xae, 0x13, 0xec, 0xce, 0x18, 0xcc, 0x0c, 0x9d, 0x81, 0x59, 0xab, 0xd6, 0x72, 0x3f, + 0x61, 0xd1, 0x65, 0x76, 0x67, 0x0c, 0xde, 0x55, 0xbf, 0x97, 0x40, 0xa1, 0x40, 0x74, 0x15, 0x52, + 0xdc, 0x51, 0xc5, 0xb1, 0xc5, 0x8f, 0xe4, 0x06, 0xf7, 0xe4, 0x01, 0x03, 0x94, 0xb6, 0x8d, 0x79, + 0x0e, 0x2d, 0xd9, 0xe8, 0x06, 0xa4, 0x88, 0x73, 0xec, 0x9a, 0x41, 0xcb, 0xc7, 0x82, 0xb9, 0xa5, + 0x21, 0xf1, 0x96, 0x43, 0x8c, 0xd1, 0x83, 0xa3, 0x0d, 0x48, 0x46, 0x88, 0xca, 0xbd, 0x1a, 0x94, + 0xe0, 0x44, 0xe0, 0xb6, 0xb2, 0x90, 0x16, 0x8b, 0x6c, 0x9a, 0x7e, 0xa0, 0x7d, 0xad, 0x00, 0x1c, + 0xb4, 0xa6, 0x3f, 0x2d, 0x3d, 0x6c, 0x3c, 0x4e, 0xcb, 0x8f, 0xe1, 0xe6, 0xbf, 0x17, 0xd9, 0xfc, + 0x4b, 0x13, 0x23, 0x9b, 0x6e, 0xef, 0x9f, 0xc7, 0x69, 0xef, 0xd1, 0x05, 0xc8, 0x5a, 0x5e, 0xd3, + 0xc1, 0xa4, 0xe2, 0xb6, 0x1a, 0x47, 0xd8, 0xcf, 0x29, 0x2b, 0xd2, 0x5a, 0xd6, 0xc8, 0xf0, 0xc1, + 0x7d, 0x36, 0x36, 0x28, 0x90, 0x6f, 0x65, 0x48, 0x33, 0x6a, 0xa6, 0xcd, 0x10, 0x7d, 0xe0, 0xb8, + 0x64, 0x88, 0x5b, 0x42, 0x23, 0x27, 0xdb, 0x44, 0xed, 0x37, 0x19, 0xb2, 0xdb, 0xb8, 0x8e, 0x03, + 0x1c, 0x1e, 0xa3, 0x77, 0x23, 0x24, 0x5d, 0x7c, 0x95, 0xa4, 0x08, 0x3c, 0x1e, 0x27, 0xa9, 0x71, + 0xf2, 0xba, 0x53, 0x80, 0x79, 0xef, 0x89, 0x8b, 0x7d, 0x4a, 0xab, 0x3c, 0xdc, 0xe6, 0x01, 0x9d, + 0x2f, 0x6d, 0x1b, 0x73, 0x0c, 0x58, 0xb2, 0xb5, 0x97, 0x12, 0x2c, 0x84, 0x2c, 0x09, 0xe9, 0x5d, + 0x8f, 0xb0, 0xba, 0x3a, 0x9a, 0xd5, 0x78, 0xa9, 0x2f, 0xc9, 0x89, 0xd5, 0x7e, 0x91, 0x21, 0x4d, + 0x87, 0x42, 0x11, 0x4d, 0x3c, 0x69, 0x7d, 0xe0, 0x78, 0x48, 0xa8, 0x76, 0x72, 0x09, 0x9d, 0x85, + 0x54, 0xc3, 0x74, 0xdc, 0x8a, 0xe7, 0xd6, 0x3b, 0xe2, 0x02, 0x33, 0x4f, 0x07, 0x1e, 0xb8, 0xf5, + 0x4e, 0x78, 0xaf, 0x49, 0xf4, 0xee, 0x35, 0x5f, 0xcc, 0x42, 0x86, 0xd3, 0x23, 0xb4, 0x73, 0x2d, + 0x42, 0xe6, 0x85, 0x51, 0x64, 0xc6, 0x4b, 0x39, 0xdf, 0x24, 0x04, 0xa1, 0x85, 0x6e, 0x29, 0x90, + 0xc6, 0x97, 0x82, 0xdd, 0x99, 0x6e, 0x31, 0x38, 0x84, 0x0c, 0xa9, 0x79, 0x7e, 0x10, 0x8d, 0x2c, + 0x3f, 0x05, 0x33, 0x7a, 0x99, 0xda, 0x75, 0x1d, 0xa6, 0x49, 0xaf, 0xab, 0x7e, 0x2e, 0x43, 0xba, + 0x6f, 0x1a, 0xbd, 0x0d, 0x73, 0x6d, 0xec, 0x13, 0xc7, 0x73, 0xc5, 0xd2, 0xd4, 0x21, 0x01, 0x3f, + 0xe6, 0x08, 0x23, 0x84, 0xa2, 0x55, 0x58, 0xb0, 0x7c, 0xcc, 0x02, 0xaf, 0xe0, 0xa6, 0x67, 0xd5, + 0xd8, 0xea, 0x14, 0x23, 0x1b, 0x8e, 0x16, 0xe9, 0x60, 0x24, 0xaf, 0x24, 0xa6, 0xcb, 0x2b, 0xe8, + 0x56, 0xb7, 0xbc, 0xd1, 0xe7, 0x06, 0xab, 0x80, 0x0b, 0x91, 0x9a, 0x2b, 0xa2, 0xe6, 0x79, 0xfe, + 0xb0, 0xd3, 0xc4, 0x06, 0x78, 0xdd, 0x36, 0x5d, 0x59, 0xd3, 0xec, 0xd4, 0x3d, 0xd3, 0xae, 0xd4, + 0xb1, 0x7b, 0x1c, 0xd4, 0x72, 0xb3, 0x7c, 0x65, 0x62, 0xf4, 0x3e, 0x1b, 0xdc, 0x4a, 0x82, 0x42, + 0x69, 0xd5, 0x7e, 0x57, 0x20, 0x5b, 0xc6, 0xa6, 0x6f, 0xd5, 0xa6, 0x2e, 0x0d, 0x11, 0x78, 0x3c, + 0xce, 0xf5, 0x5f, 0xe1, 0x25, 0xeb, 0x36, 0x64, 0x2c, 0xcf, 0x0d, 0x4c, 0x47, 0x6c, 0x0a, 0x0f, + 0xf2, 0xec, 0xe0, 0xa6, 0xdc, 0x09, 0x31, 0xa5, 0x6d, 0x23, 0xdd, 0x35, 0x28, 0xd9, 0x28, 0xd7, + 0x53, 0x8b, 0xcc, 0xae, 0x26, 0x5d, 0x45, 0x14, 0x61, 0xae, 0xea, 0xd4, 0x03, 0xec, 0x93, 0x5c, + 0x62, 0x25, 0xb1, 0x96, 0x2e, 0x5c, 0x99, 0x86, 0x39, 0x7d, 0x87, 0xd9, 0x18, 0xa1, 0xad, 0xfa, + 0x93, 0x04, 0x49, 0x3e, 0x86, 0x0e, 0x01, 0x1a, 0x66, 0x60, 0xd5, 0xb8, 0x0e, 0x24, 0xa6, 0x83, + 0xab, 0xff, 0xc2, 0xa9, 0xbe, 0x47, 0xad, 0x99, 0x40, 0x52, 0x8d, 0xb0, 0x89, 0x10, 0x28, 0xae, + 0xd9, 0xe0, 0x77, 0xb9, 0x94, 0xc1, 0xda, 0xe8, 0x34, 0xcc, 0xb6, 0xcd, 0x7a, 0x0b, 0x33, 0xa6, + 0x53, 0x06, 0xef, 0x68, 0xd7, 0x21, 0xd5, 0xf5, 0x80, 0x54, 0x38, 0xb3, 0xb7, 0x79, 0x78, 0x67, + 0xb7, 0x72, 0xf8, 0xc1, 0x41, 0xb1, 0xf2, 0x68, 0xbf, 0x7c, 0x50, 0xbc, 0x53, 0xda, 0x29, 0x15, + 0xb7, 0x17, 0x67, 0xd0, 0x22, 0x64, 0xca, 0x87, 0x46, 0x69, 0xff, 0x6e, 0xa5, 0xf8, 0xf0, 0xd1, + 0xe6, 0xfd, 0x45, 0x49, 0xfb, 0x4e, 0x86, 0x85, 0x70, 0x5d, 0xd3, 0xd6, 0xc6, 0x28, 0x3e, 0x2e, + 0x19, 0xee, 0x7a, 0xaf, 0x62, 0x38, 0x76, 0xa5, 0xee, 0x10, 0x7a, 0x81, 0x4f, 0x8c, 0xbd, 0x97, + 0x25, 0x1d, 0xfb, 0xbe, 0x43, 0x02, 0xed, 0x1a, 0xcc, 0x1a, 0xa6, 0x7b, 0x8c, 0xd1, 0x19, 0x48, + 0x7a, 0xd5, 0x2a, 0xc1, 0xfc, 0xee, 0xaf, 0x18, 0xa2, 0x47, 0xc7, 0xc5, 0x11, 0xe6, 0xc9, 0x45, + 0xf4, 0xb4, 0x5f, 0x65, 0xf8, 0x1f, 0x7d, 0x09, 0x52, 0xe3, 0xf0, 0xd4, 0xde, 0x88, 0xd0, 0x7b, + 0x69, 0xf8, 0xd3, 0xb1, 0xcf, 0xe0, 0x3f, 0x5f, 0x8f, 0xd7, 0x61, 0xd6, 0xa7, 0xf1, 0x0e, 0xb9, + 0xcf, 0x09, 0x46, 0x38, 0x1d, 0x1c, 0xa5, 0x7d, 0x29, 0xc3, 0x62, 0x8f, 0x22, 0xa1, 0xd9, 0x9b, + 0x11, 0x52, 0x2f, 0x8f, 0x23, 0x35, 0x5e, 0xaa, 0x5d, 0x12, 0xbc, 0x9e, 0x0e, 0x5f, 0x8d, 0x34, + 0xc2, 0x8c, 0x78, 0x33, 0x6a, 0x2f, 0x65, 0x38, 0x15, 0x46, 0xb6, 0x6b, 0x92, 0x6e, 0x65, 0xb8, + 0x1d, 0xa1, 0xe3, 0xf5, 0xd1, 0x74, 0xf4, 0x19, 0xc5, 0x43, 0x67, 0x9f, 0x9d, 0x5c, 0x67, 0x79, + 0x48, 0x32, 0x05, 0x91, 0x9c, 0xcc, 0xce, 0xfd, 0x48, 0xa1, 0x09, 0x18, 0x4d, 0xc0, 0xc4, 0xac, + 0x07, 0x6c, 0xd5, 0x19, 0x83, 0xb5, 0xb5, 0xa7, 0x32, 0x9c, 0x8e, 0x92, 0x27, 0x14, 0xf8, 0x7e, + 0x84, 0xf2, 0x2b, 0x93, 0x28, 0x8f, 0x97, 0x0a, 0x2f, 0x08, 0xd6, 0xcf, 0x42, 0xaa, 0x66, 0x92, + 0x5a, 0x2f, 0x7b, 0x66, 0x8c, 0x79, 0x3a, 0x40, 0xb3, 0x64, 0xe1, 0x07, 0x05, 0xb2, 0x3c, 0x75, + 0x96, 0xb9, 0x7f, 0xb4, 0x0d, 0x89, 0xbb, 0x38, 0x40, 0x4b, 0xe3, 0xbe, 0x94, 0xaa, 0xe7, 0xc6, + 0x7e, 0x3c, 0xdb, 0x90, 0xa8, 0x97, 0x83, 0xd6, 0x50, 0x2f, 0xbd, 0xef, 0x2c, 0xc3, 0xbc, 0xf4, + 0x7d, 0x3d, 0x58, 0x93, 0xd0, 0x3d, 0x48, 0xf2, 0x37, 0x1d, 0x7a, 0x6d, 0xc2, 0x1b, 0x5a, 0x5d, + 0x99, 0xf4, 0x1c, 0x44, 0x45, 0x50, 0x28, 0x33, 0xe8, 0xdc, 0xd8, 0x97, 0x94, 0xba, 0x3c, 0xfe, + 0x06, 0x8c, 0xf6, 0x20, 0xc9, 0x6b, 0xe9, 0xb0, 0x35, 0x45, 0x6e, 0x0b, 0xc3, 0xd6, 0x14, 0x2d, + 0xc3, 0x1b, 0x12, 0x2a, 0xc3, 0x7c, 0x28, 0x32, 0x74, 0x7e, 0x62, 0x5d, 0x51, 0xb5, 0xc9, 0x59, + 0x72, 0x43, 0x42, 0x1f, 0x41, 0xa6, 0x5f, 0xb9, 0x68, 0x75, 0xaa, 0x64, 0xa2, 0x5e, 0x9a, 0xee, + 0x00, 0x6c, 0x55, 0x7e, 0x7e, 0xb1, 0x2c, 0x3d, 0x7f, 0xb1, 0x2c, 0xfd, 0xf1, 0x62, 0x59, 0x7a, + 0xfa, 0xe7, 0xf2, 0xcc, 0x87, 0xd7, 0x8e, 0x9d, 0xa0, 0xd6, 0x3a, 0xd2, 0x2d, 0xaf, 0x91, 0x77, + 0x49, 0xd3, 0xb2, 0xd6, 0x6d, 0xdc, 0xce, 0xbb, 0xd8, 0xab, 0x92, 0x75, 0xb3, 0xe9, 0xac, 0x1f, + 0x7b, 0xf9, 0xe8, 0xdf, 0x00, 0x37, 0x79, 0xfb, 0x99, 0x7c, 0x6a, 0x1f, 0x7b, 0x3b, 0x65, 0x7d, + 0xf3, 0xa0, 0x44, 0x7f, 0x95, 0x4b, 0xf1, 0x28, 0xc9, 0x3e, 0xe5, 0xbf, 0xf5, 0x4f, 0x00, 0x00, + 0x00, 0xff, 0xff, 0x39, 0x31, 0x0a, 0x71, 0x6c, 0x18, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. var _ context.Context -var _ grpc.ClientConn +var _ grpc2.ClientConn // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 +const _ = grpc2.SupportPackageIsVersion4 // ObjectServiceClient is the client API for ObjectService service. // @@ -2423,44 +2423,44 @@ type ObjectServiceClient interface { // the object's payload if it is needed. All messages except first carry // chunks. Requested object can be restored by concatenation of object // message payload and all chunks keeping receiving order. - Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (ObjectService_GetClient, error) + Get(ctx context.Context, in *GetRequest, opts ...grpc2.CallOption) (ObjectService_GetClient, error) // Put the object into container. Request uses gRPC stream. First message // SHOULD BE type of PutHeader. Container id and Owner id of object SHOULD // BE set. Session token SHOULD BE obtained before put operation (see // session package). Chunk messages considered by server as part of object // payload. All messages except first SHOULD BE chunks. Chunk messages // SHOULD BE sent in direct order of fragmentation. - Put(ctx context.Context, opts ...grpc.CallOption) (ObjectService_PutClient, error) + Put(ctx context.Context, opts ...grpc2.CallOption) (ObjectService_PutClient, error) // Delete the object from a container - Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteResponse, error) + Delete(ctx context.Context, in *DeleteRequest, opts ...grpc2.CallOption) (*DeleteResponse, error) // Head returns the object without data payload. Object in the // response has system header only. If full headers flag is set, extended // headers are also present. - Head(ctx context.Context, in *HeadRequest, opts ...grpc.CallOption) (*HeadResponse, error) + Head(ctx context.Context, in *HeadRequest, opts ...grpc2.CallOption) (*HeadResponse, error) // Search objects in container. Version of query language format SHOULD BE // set to 1. Search query represented in serialized format (see query // package). - Search(ctx context.Context, in *SearchRequest, opts ...grpc.CallOption) (ObjectService_SearchClient, error) + Search(ctx context.Context, in *SearchRequest, opts ...grpc2.CallOption) (ObjectService_SearchClient, error) // GetRange of data payload. Range is a pair (offset, length). // Requested range can be restored by concatenation of all chunks // keeping receiving order. - GetRange(ctx context.Context, in *GetRangeRequest, opts ...grpc.CallOption) (ObjectService_GetRangeClient, error) + GetRange(ctx context.Context, in *GetRangeRequest, opts ...grpc2.CallOption) (ObjectService_GetRangeClient, error) // GetRangeHash returns homomorphic hash of object payload range after XOR // operation. Ranges are set of pairs (offset, length). Hashes order in // response corresponds to ranges order in request. Homomorphic hash is // calculated for XORed data. - GetRangeHash(ctx context.Context, in *GetRangeHashRequest, opts ...grpc.CallOption) (*GetRangeHashResponse, error) + GetRangeHash(ctx context.Context, in *GetRangeHashRequest, opts ...grpc2.CallOption) (*GetRangeHashResponse, error) } type objectServiceClient struct { - cc *grpc.ClientConn + cc *grpc2.ClientConn } -func NewObjectServiceClient(cc *grpc.ClientConn) ObjectServiceClient { +func NewObjectServiceClient(cc *grpc2.ClientConn) ObjectServiceClient { return &objectServiceClient{cc} } -func (c *objectServiceClient) Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (ObjectService_GetClient, error) { +func (c *objectServiceClient) Get(ctx context.Context, in *GetRequest, opts ...grpc2.CallOption) (ObjectService_GetClient, error) { stream, err := c.cc.NewStream(ctx, &_ObjectService_serviceDesc.Streams[0], "/neo.fs.v2.object.ObjectService/Get", opts...) if err != nil { return nil, err @@ -2477,11 +2477,11 @@ func (c *objectServiceClient) Get(ctx context.Context, in *GetRequest, opts ...g type ObjectService_GetClient interface { Recv() (*GetResponse, error) - grpc.ClientStream + grpc2.ClientStream } type objectServiceGetClient struct { - grpc.ClientStream + grpc2.ClientStream } func (x *objectServiceGetClient) Recv() (*GetResponse, error) { @@ -2492,7 +2492,7 @@ func (x *objectServiceGetClient) Recv() (*GetResponse, error) { return m, nil } -func (c *objectServiceClient) Put(ctx context.Context, opts ...grpc.CallOption) (ObjectService_PutClient, error) { +func (c *objectServiceClient) Put(ctx context.Context, opts ...grpc2.CallOption) (ObjectService_PutClient, error) { stream, err := c.cc.NewStream(ctx, &_ObjectService_serviceDesc.Streams[1], "/neo.fs.v2.object.ObjectService/Put", opts...) if err != nil { return nil, err @@ -2504,11 +2504,11 @@ func (c *objectServiceClient) Put(ctx context.Context, opts ...grpc.CallOption) type ObjectService_PutClient interface { Send(*PutRequest) error CloseAndRecv() (*PutResponse, error) - grpc.ClientStream + grpc2.ClientStream } type objectServicePutClient struct { - grpc.ClientStream + grpc2.ClientStream } func (x *objectServicePutClient) Send(m *PutRequest) error { @@ -2526,7 +2526,7 @@ func (x *objectServicePutClient) CloseAndRecv() (*PutResponse, error) { return m, nil } -func (c *objectServiceClient) Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteResponse, error) { +func (c *objectServiceClient) Delete(ctx context.Context, in *DeleteRequest, opts ...grpc2.CallOption) (*DeleteResponse, error) { out := new(DeleteResponse) err := c.cc.Invoke(ctx, "/neo.fs.v2.object.ObjectService/Delete", in, out, opts...) if err != nil { @@ -2535,7 +2535,7 @@ func (c *objectServiceClient) Delete(ctx context.Context, in *DeleteRequest, opt return out, nil } -func (c *objectServiceClient) Head(ctx context.Context, in *HeadRequest, opts ...grpc.CallOption) (*HeadResponse, error) { +func (c *objectServiceClient) Head(ctx context.Context, in *HeadRequest, opts ...grpc2.CallOption) (*HeadResponse, error) { out := new(HeadResponse) err := c.cc.Invoke(ctx, "/neo.fs.v2.object.ObjectService/Head", in, out, opts...) if err != nil { @@ -2544,7 +2544,7 @@ func (c *objectServiceClient) Head(ctx context.Context, in *HeadRequest, opts .. return out, nil } -func (c *objectServiceClient) Search(ctx context.Context, in *SearchRequest, opts ...grpc.CallOption) (ObjectService_SearchClient, error) { +func (c *objectServiceClient) Search(ctx context.Context, in *SearchRequest, opts ...grpc2.CallOption) (ObjectService_SearchClient, error) { stream, err := c.cc.NewStream(ctx, &_ObjectService_serviceDesc.Streams[2], "/neo.fs.v2.object.ObjectService/Search", opts...) if err != nil { return nil, err @@ -2561,11 +2561,11 @@ func (c *objectServiceClient) Search(ctx context.Context, in *SearchRequest, opt type ObjectService_SearchClient interface { Recv() (*SearchResponse, error) - grpc.ClientStream + grpc2.ClientStream } type objectServiceSearchClient struct { - grpc.ClientStream + grpc2.ClientStream } func (x *objectServiceSearchClient) Recv() (*SearchResponse, error) { @@ -2576,7 +2576,7 @@ func (x *objectServiceSearchClient) Recv() (*SearchResponse, error) { return m, nil } -func (c *objectServiceClient) GetRange(ctx context.Context, in *GetRangeRequest, opts ...grpc.CallOption) (ObjectService_GetRangeClient, error) { +func (c *objectServiceClient) GetRange(ctx context.Context, in *GetRangeRequest, opts ...grpc2.CallOption) (ObjectService_GetRangeClient, error) { stream, err := c.cc.NewStream(ctx, &_ObjectService_serviceDesc.Streams[3], "/neo.fs.v2.object.ObjectService/GetRange", opts...) if err != nil { return nil, err @@ -2593,11 +2593,11 @@ func (c *objectServiceClient) GetRange(ctx context.Context, in *GetRangeRequest, type ObjectService_GetRangeClient interface { Recv() (*GetRangeResponse, error) - grpc.ClientStream + grpc2.ClientStream } type objectServiceGetRangeClient struct { - grpc.ClientStream + grpc2.ClientStream } func (x *objectServiceGetRangeClient) Recv() (*GetRangeResponse, error) { @@ -2608,7 +2608,7 @@ func (x *objectServiceGetRangeClient) Recv() (*GetRangeResponse, error) { return m, nil } -func (c *objectServiceClient) GetRangeHash(ctx context.Context, in *GetRangeHashRequest, opts ...grpc.CallOption) (*GetRangeHashResponse, error) { +func (c *objectServiceClient) GetRangeHash(ctx context.Context, in *GetRangeHashRequest, opts ...grpc2.CallOption) (*GetRangeHashResponse, error) { out := new(GetRangeHashResponse) err := c.cc.Invoke(ctx, "/neo.fs.v2.object.ObjectService/GetRangeHash", in, out, opts...) if err != nil { @@ -2679,11 +2679,11 @@ func (*UnimplementedObjectServiceServer) GetRangeHash(ctx context.Context, req * return nil, status.Errorf(codes.Unimplemented, "method GetRangeHash not implemented") } -func RegisterObjectServiceServer(s *grpc.Server, srv ObjectServiceServer) { +func RegisterObjectServiceServer(s *grpc2.Server, srv ObjectServiceServer) { s.RegisterService(&_ObjectService_serviceDesc, srv) } -func _ObjectService_Get_Handler(srv interface{}, stream grpc.ServerStream) error { +func _ObjectService_Get_Handler(srv interface{}, stream grpc2.ServerStream) error { m := new(GetRequest) if err := stream.RecvMsg(m); err != nil { return err @@ -2693,29 +2693,29 @@ func _ObjectService_Get_Handler(srv interface{}, stream grpc.ServerStream) error type ObjectService_GetServer interface { Send(*GetResponse) error - grpc.ServerStream + grpc2.ServerStream } type objectServiceGetServer struct { - grpc.ServerStream + grpc2.ServerStream } func (x *objectServiceGetServer) Send(m *GetResponse) error { return x.ServerStream.SendMsg(m) } -func _ObjectService_Put_Handler(srv interface{}, stream grpc.ServerStream) error { +func _ObjectService_Put_Handler(srv interface{}, stream grpc2.ServerStream) error { return srv.(ObjectServiceServer).Put(&objectServicePutServer{stream}) } type ObjectService_PutServer interface { SendAndClose(*PutResponse) error Recv() (*PutRequest, error) - grpc.ServerStream + grpc2.ServerStream } type objectServicePutServer struct { - grpc.ServerStream + grpc2.ServerStream } func (x *objectServicePutServer) SendAndClose(m *PutResponse) error { @@ -2730,7 +2730,7 @@ func (x *objectServicePutServer) Recv() (*PutRequest, error) { return m, nil } -func _ObjectService_Delete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _ObjectService_Delete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc2.UnaryServerInterceptor) (interface{}, error) { in := new(DeleteRequest) if err := dec(in); err != nil { return nil, err @@ -2738,7 +2738,7 @@ func _ObjectService_Delete_Handler(srv interface{}, ctx context.Context, dec fun if interceptor == nil { return srv.(ObjectServiceServer).Delete(ctx, in) } - info := &grpc.UnaryServerInfo{ + info := &grpc2.UnaryServerInfo{ Server: srv, FullMethod: "/neo.fs.v2.object.ObjectService/Delete", } @@ -2748,7 +2748,7 @@ func _ObjectService_Delete_Handler(srv interface{}, ctx context.Context, dec fun return interceptor(ctx, in, info, handler) } -func _ObjectService_Head_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _ObjectService_Head_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc2.UnaryServerInterceptor) (interface{}, error) { in := new(HeadRequest) if err := dec(in); err != nil { return nil, err @@ -2756,7 +2756,7 @@ func _ObjectService_Head_Handler(srv interface{}, ctx context.Context, dec func( if interceptor == nil { return srv.(ObjectServiceServer).Head(ctx, in) } - info := &grpc.UnaryServerInfo{ + info := &grpc2.UnaryServerInfo{ Server: srv, FullMethod: "/neo.fs.v2.object.ObjectService/Head", } @@ -2766,7 +2766,7 @@ func _ObjectService_Head_Handler(srv interface{}, ctx context.Context, dec func( return interceptor(ctx, in, info, handler) } -func _ObjectService_Search_Handler(srv interface{}, stream grpc.ServerStream) error { +func _ObjectService_Search_Handler(srv interface{}, stream grpc2.ServerStream) error { m := new(SearchRequest) if err := stream.RecvMsg(m); err != nil { return err @@ -2776,18 +2776,18 @@ func _ObjectService_Search_Handler(srv interface{}, stream grpc.ServerStream) er type ObjectService_SearchServer interface { Send(*SearchResponse) error - grpc.ServerStream + grpc2.ServerStream } type objectServiceSearchServer struct { - grpc.ServerStream + grpc2.ServerStream } func (x *objectServiceSearchServer) Send(m *SearchResponse) error { return x.ServerStream.SendMsg(m) } -func _ObjectService_GetRange_Handler(srv interface{}, stream grpc.ServerStream) error { +func _ObjectService_GetRange_Handler(srv interface{}, stream grpc2.ServerStream) error { m := new(GetRangeRequest) if err := stream.RecvMsg(m); err != nil { return err @@ -2797,18 +2797,18 @@ func _ObjectService_GetRange_Handler(srv interface{}, stream grpc.ServerStream) type ObjectService_GetRangeServer interface { Send(*GetRangeResponse) error - grpc.ServerStream + grpc2.ServerStream } type objectServiceGetRangeServer struct { - grpc.ServerStream + grpc2.ServerStream } func (x *objectServiceGetRangeServer) Send(m *GetRangeResponse) error { return x.ServerStream.SendMsg(m) } -func _ObjectService_GetRangeHash_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _ObjectService_GetRangeHash_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc2.UnaryServerInterceptor) (interface{}, error) { in := new(GetRangeHashRequest) if err := dec(in); err != nil { return nil, err @@ -2816,7 +2816,7 @@ func _ObjectService_GetRangeHash_Handler(srv interface{}, ctx context.Context, d if interceptor == nil { return srv.(ObjectServiceServer).GetRangeHash(ctx, in) } - info := &grpc.UnaryServerInfo{ + info := &grpc2.UnaryServerInfo{ Server: srv, FullMethod: "/neo.fs.v2.object.ObjectService/GetRangeHash", } @@ -2826,10 +2826,10 @@ func _ObjectService_GetRangeHash_Handler(srv interface{}, ctx context.Context, d return interceptor(ctx, in, info, handler) } -var _ObjectService_serviceDesc = grpc.ServiceDesc{ +var _ObjectService_serviceDesc = grpc2.ServiceDesc{ ServiceName: "neo.fs.v2.object.ObjectService", HandlerType: (*ObjectServiceServer)(nil), - Methods: []grpc.MethodDesc{ + Methods: []grpc2.MethodDesc{ { MethodName: "Delete", Handler: _ObjectService_Delete_Handler, @@ -2843,7 +2843,7 @@ var _ObjectService_serviceDesc = grpc.ServiceDesc{ Handler: _ObjectService_GetRangeHash_Handler, }, }, - Streams: []grpc.StreamDesc{ + Streams: []grpc2.StreamDesc{ { StreamName: "Get", Handler: _ObjectService_Get_Handler, @@ -2865,7 +2865,7 @@ var _ObjectService_serviceDesc = grpc.ServiceDesc{ ServerStreams: true, }, }, - Metadata: "v2/object/service.proto", + Metadata: "v2/object/grpc/service.proto", } func (m *GetRequest) Marshal() (dAtA []byte, err error) { @@ -5657,7 +5657,7 @@ func (m *GetRequest) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.MetaHeader == nil { - m.MetaHeader = &service.RequestMetaHeader{} + m.MetaHeader = &grpc.RequestMetaHeader{} } if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -5693,7 +5693,7 @@ func (m *GetRequest) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.VerifyHeader == nil { - m.VerifyHeader = &service.RequestVerificationHeader{} + m.VerifyHeader = &grpc.RequestVerificationHeader{} } if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -5783,7 +5783,7 @@ func (m *GetRequest_Body) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.Address == nil { - m.Address = &refs.Address{} + m.Address = &grpc1.Address{} } if err := m.Address.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -5929,7 +5929,7 @@ func (m *GetResponse) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.MetaHeader == nil { - m.MetaHeader = &service.ResponseMetaHeader{} + m.MetaHeader = &grpc.ResponseMetaHeader{} } if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -5965,7 +5965,7 @@ func (m *GetResponse) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.VerifyHeader == nil { - m.VerifyHeader = &service.ResponseVerificationHeader{} + m.VerifyHeader = &grpc.ResponseVerificationHeader{} } if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -6177,7 +6177,7 @@ func (m *GetResponse_Body_Init) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.ObjectId == nil { - m.ObjectId = &refs.ObjectID{} + m.ObjectId = &grpc1.ObjectID{} } if err := m.ObjectId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -6213,7 +6213,7 @@ func (m *GetResponse_Body_Init) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.Signature == nil { - m.Signature = &service.Signature{} + m.Signature = &grpc.Signature{} } if err := m.Signature.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -6375,7 +6375,7 @@ func (m *PutRequest) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.MetaHeader == nil { - m.MetaHeader = &service.RequestMetaHeader{} + m.MetaHeader = &grpc.RequestMetaHeader{} } if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -6411,7 +6411,7 @@ func (m *PutRequest) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.VerifyHeader == nil { - m.VerifyHeader = &service.RequestVerificationHeader{} + m.VerifyHeader = &grpc.RequestVerificationHeader{} } if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -6623,7 +6623,7 @@ func (m *PutRequest_Body_Init) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.ObjectId == nil { - m.ObjectId = &refs.ObjectID{} + m.ObjectId = &grpc1.ObjectID{} } if err := m.ObjectId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -6659,7 +6659,7 @@ func (m *PutRequest_Body_Init) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.Signature == nil { - m.Signature = &service.Signature{} + m.Signature = &grpc.Signature{} } if err := m.Signature.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -6840,7 +6840,7 @@ func (m *PutResponse) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.MetaHeader == nil { - m.MetaHeader = &service.ResponseMetaHeader{} + m.MetaHeader = &grpc.ResponseMetaHeader{} } if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -6876,7 +6876,7 @@ func (m *PutResponse) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.VerifyHeader == nil { - m.VerifyHeader = &service.ResponseVerificationHeader{} + m.VerifyHeader = &grpc.ResponseVerificationHeader{} } if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -6966,7 +6966,7 @@ func (m *PutResponse_Body) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.ObjectId == nil { - m.ObjectId = &refs.ObjectID{} + m.ObjectId = &grpc1.ObjectID{} } if err := m.ObjectId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -7092,7 +7092,7 @@ func (m *DeleteRequest) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.MetaHeader == nil { - m.MetaHeader = &service.RequestMetaHeader{} + m.MetaHeader = &grpc.RequestMetaHeader{} } if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -7128,7 +7128,7 @@ func (m *DeleteRequest) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.VerifyHeader == nil { - m.VerifyHeader = &service.RequestVerificationHeader{} + m.VerifyHeader = &grpc.RequestVerificationHeader{} } if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -7218,7 +7218,7 @@ func (m *DeleteRequest_Body) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.Address == nil { - m.Address = &refs.Address{} + m.Address = &grpc1.Address{} } if err := m.Address.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -7254,7 +7254,7 @@ func (m *DeleteRequest_Body) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.OwnerId == nil { - m.OwnerId = &refs.OwnerID{} + m.OwnerId = &grpc1.OwnerID{} } if err := m.OwnerId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -7380,7 +7380,7 @@ func (m *DeleteResponse) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.MetaHeader == nil { - m.MetaHeader = &service.ResponseMetaHeader{} + m.MetaHeader = &grpc.ResponseMetaHeader{} } if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -7416,7 +7416,7 @@ func (m *DeleteResponse) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.VerifyHeader == nil { - m.VerifyHeader = &service.ResponseVerificationHeader{} + m.VerifyHeader = &grpc.ResponseVerificationHeader{} } if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -7596,7 +7596,7 @@ func (m *HeadRequest) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.MetaHeader == nil { - m.MetaHeader = &service.RequestMetaHeader{} + m.MetaHeader = &grpc.RequestMetaHeader{} } if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -7632,7 +7632,7 @@ func (m *HeadRequest) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.VerifyHeader == nil { - m.VerifyHeader = &service.RequestVerificationHeader{} + m.VerifyHeader = &grpc.RequestVerificationHeader{} } if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -7722,7 +7722,7 @@ func (m *HeadRequest_Body) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.Address == nil { - m.Address = &refs.Address{} + m.Address = &grpc1.Address{} } if err := m.Address.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -7888,7 +7888,7 @@ func (m *HeadResponse) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.MetaHeader == nil { - m.MetaHeader = &service.ResponseMetaHeader{} + m.MetaHeader = &grpc.ResponseMetaHeader{} } if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -7924,7 +7924,7 @@ func (m *HeadResponse) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.VerifyHeader == nil { - m.VerifyHeader = &service.ResponseVerificationHeader{} + m.VerifyHeader = &grpc.ResponseVerificationHeader{} } if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -8138,7 +8138,7 @@ func (m *HeadResponse_Body_ShortHeader) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.Version == nil { - m.Version = &service.Version{} + m.Version = &grpc.Version{} } if err := m.Version.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -8193,7 +8193,7 @@ func (m *HeadResponse_Body_ShortHeader) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.OwnerId == nil { - m.OwnerId = &refs.OwnerID{} + m.OwnerId = &grpc1.OwnerID{} } if err := m.OwnerId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -8357,7 +8357,7 @@ func (m *SearchRequest) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.MetaHeader == nil { - m.MetaHeader = &service.RequestMetaHeader{} + m.MetaHeader = &grpc.RequestMetaHeader{} } if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -8393,7 +8393,7 @@ func (m *SearchRequest) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.VerifyHeader == nil { - m.VerifyHeader = &service.RequestVerificationHeader{} + m.VerifyHeader = &grpc.RequestVerificationHeader{} } if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -8483,7 +8483,7 @@ func (m *SearchRequest_Body) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.ContainerId == nil { - m.ContainerId = &refs.ContainerID{} + m.ContainerId = &grpc1.ContainerID{} } if err := m.ContainerId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -8799,7 +8799,7 @@ func (m *SearchResponse) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.MetaHeader == nil { - m.MetaHeader = &service.ResponseMetaHeader{} + m.MetaHeader = &grpc.ResponseMetaHeader{} } if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -8835,7 +8835,7 @@ func (m *SearchResponse) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.VerifyHeader == nil { - m.VerifyHeader = &service.ResponseVerificationHeader{} + m.VerifyHeader = &grpc.ResponseVerificationHeader{} } if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -8924,7 +8924,7 @@ func (m *SearchResponse_Body) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.IdList = append(m.IdList, &refs.ObjectID{}) + m.IdList = append(m.IdList, &grpc1.ObjectID{}) if err := m.IdList[len(m.IdList)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -9141,7 +9141,7 @@ func (m *GetRangeRequest) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.MetaHeader == nil { - m.MetaHeader = &service.RequestMetaHeader{} + m.MetaHeader = &grpc.RequestMetaHeader{} } if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -9177,7 +9177,7 @@ func (m *GetRangeRequest) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.VerifyHeader == nil { - m.VerifyHeader = &service.RequestVerificationHeader{} + m.VerifyHeader = &grpc.RequestVerificationHeader{} } if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -9267,7 +9267,7 @@ func (m *GetRangeRequest_Body) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.Address == nil { - m.Address = &refs.Address{} + m.Address = &grpc1.Address{} } if err := m.Address.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -9429,7 +9429,7 @@ func (m *GetRangeResponse) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.MetaHeader == nil { - m.MetaHeader = &service.ResponseMetaHeader{} + m.MetaHeader = &grpc.ResponseMetaHeader{} } if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -9465,7 +9465,7 @@ func (m *GetRangeResponse) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.VerifyHeader == nil { - m.VerifyHeader = &service.ResponseVerificationHeader{} + m.VerifyHeader = &grpc.ResponseVerificationHeader{} } if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -9679,7 +9679,7 @@ func (m *GetRangeHashRequest) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.MetaHeader == nil { - m.MetaHeader = &service.RequestMetaHeader{} + m.MetaHeader = &grpc.RequestMetaHeader{} } if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -9715,7 +9715,7 @@ func (m *GetRangeHashRequest) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.VerifyHeader == nil { - m.VerifyHeader = &service.RequestVerificationHeader{} + m.VerifyHeader = &grpc.RequestVerificationHeader{} } if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -9805,7 +9805,7 @@ func (m *GetRangeHashRequest_Body) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.Address == nil { - m.Address = &refs.Address{} + m.Address = &grpc1.Address{} } if err := m.Address.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -9999,7 +9999,7 @@ func (m *GetRangeHashResponse) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.MetaHeader == nil { - m.MetaHeader = &service.ResponseMetaHeader{} + m.MetaHeader = &grpc.ResponseMetaHeader{} } if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -10035,7 +10035,7 @@ func (m *GetRangeHashResponse) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.VerifyHeader == nil { - m.VerifyHeader = &service.ResponseVerificationHeader{} + m.VerifyHeader = &grpc.ResponseVerificationHeader{} } if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err diff --git a/v2/object/types.go b/v2/object/grpc/types.go similarity index 96% rename from v2/object/types.go rename to v2/object/grpc/types.go index 7a97531..c857b8a 100644 --- a/v2/object/types.go +++ b/v2/object/grpc/types.go @@ -1,8 +1,8 @@ package object import ( - "github.com/nspcc-dev/neofs-api-go/v2/refs" - "github.com/nspcc-dev/neofs-api-go/v2/service" + refs "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" + service "github.com/nspcc-dev/neofs-api-go/v2/service/grpc" ) // SetKey sets key to the object attribute. diff --git a/v2/object/types.pb.go b/v2/object/grpc/types.pb.go similarity index 86% rename from v2/object/types.pb.go rename to v2/object/grpc/types.pb.go index a3712b5..f4617b0 100644 --- a/v2/object/types.pb.go +++ b/v2/object/grpc/types.pb.go @@ -1,13 +1,13 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: v2/object/types.proto +// source: v2/object/grpc/types.proto package object import ( fmt "fmt" proto "github.com/golang/protobuf/proto" - refs "github.com/nspcc-dev/neofs-api-go/v2/refs" - service "github.com/nspcc-dev/neofs-api-go/v2/service" + grpc "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" + grpc1 "github.com/nspcc-dev/neofs-api-go/v2/service/grpc" io "io" math "math" math_bits "math/bits" @@ -53,20 +53,20 @@ func (x ObjectType) String() string { } func (ObjectType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_fcb9e8df342f43c6, []int{0} + return fileDescriptor_545319325da7b9b1, []int{0} } // Object Headers type Header struct { // Object's container - ContainerId *refs.ContainerID `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` + ContainerId *grpc.ContainerID `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` // Object's owner - OwnerId *refs.OwnerID `protobuf:"bytes,2,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"` + OwnerId *grpc.OwnerID `protobuf:"bytes,2,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"` // Epoch when the object was created CreationEpoch uint64 `protobuf:"varint,3,opt,name=creation_epoch,json=creationEpoch,proto3" json:"creation_epoch,omitempty"` // Object format version. // Effectively the version of API library used to create particular object - Version *service.Version `protobuf:"bytes,4,opt,name=version,proto3" json:"version,omitempty"` + Version *grpc1.Version `protobuf:"bytes,4,opt,name=version,proto3" json:"version,omitempty"` // Size of payload in bytes. // 0xFFFFFFFFFFFFFFFF means `payload_length` is unknown PayloadLength uint64 `protobuf:"varint,5,opt,name=payload_length,json=payloadLength,proto3" json:"payload_length,omitempty"` @@ -78,7 +78,7 @@ type Header struct { HomomorphicHash []byte `protobuf:"bytes,8,opt,name=homomorphic_hash,json=homomorphicHash,proto3" json:"homomorphic_hash,omitempty"` // Session token, if it was used during Object creation. // Need it to verify integrity and authenticity out of Request scope. - SessionToken *service.SessionToken `protobuf:"bytes,9,opt,name=session_token,json=sessionToken,proto3" json:"session_token,omitempty"` + SessionToken *grpc1.SessionToken `protobuf:"bytes,9,opt,name=session_token,json=sessionToken,proto3" json:"session_token,omitempty"` // User-defined object attributes Attributes []*Header_Attribute `protobuf:"bytes,10,rep,name=attributes,proto3" json:"attributes,omitempty"` // Position of the object in the split hierarchy. @@ -92,7 +92,7 @@ func (m *Header) Reset() { *m = Header{} } func (m *Header) String() string { return proto.CompactTextString(m) } func (*Header) ProtoMessage() {} func (*Header) Descriptor() ([]byte, []int) { - return fileDescriptor_fcb9e8df342f43c6, []int{0} + return fileDescriptor_545319325da7b9b1, []int{0} } func (m *Header) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -121,14 +121,14 @@ func (m *Header) XXX_DiscardUnknown() { var xxx_messageInfo_Header proto.InternalMessageInfo -func (m *Header) GetContainerId() *refs.ContainerID { +func (m *Header) GetContainerId() *grpc.ContainerID { if m != nil { return m.ContainerId } return nil } -func (m *Header) GetOwnerId() *refs.OwnerID { +func (m *Header) GetOwnerId() *grpc.OwnerID { if m != nil { return m.OwnerId } @@ -142,7 +142,7 @@ func (m *Header) GetCreationEpoch() uint64 { return 0 } -func (m *Header) GetVersion() *service.Version { +func (m *Header) GetVersion() *grpc1.Version { if m != nil { return m.Version } @@ -177,7 +177,7 @@ func (m *Header) GetHomomorphicHash() []byte { return nil } -func (m *Header) GetSessionToken() *service.SessionToken { +func (m *Header) GetSessionToken() *grpc1.SessionToken { if m != nil { return m.SessionToken } @@ -213,7 +213,7 @@ func (m *Header_Attribute) Reset() { *m = Header_Attribute{} } func (m *Header_Attribute) String() string { return proto.CompactTextString(m) } func (*Header_Attribute) ProtoMessage() {} func (*Header_Attribute) Descriptor() ([]byte, []int) { - return fileDescriptor_fcb9e8df342f43c6, []int{0, 0} + return fileDescriptor_545319325da7b9b1, []int{0, 0} } func (m *Header_Attribute) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -261,15 +261,15 @@ type Header_Split struct { // Identifier of the origin object. // Parent and children objects must be within the same container. // Parent object_id is known only to the minor child. - Parent *refs.ObjectID `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"` + Parent *grpc.ObjectID `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"` // Previous carries identifier of the left split neighbor. - Previous *refs.ObjectID `protobuf:"bytes,2,opt,name=previous,proto3" json:"previous,omitempty"` + Previous *grpc.ObjectID `protobuf:"bytes,2,opt,name=previous,proto3" json:"previous,omitempty"` // `signature` field of the parent object. Used to reconstruct parent. - ParentSignature *service.Signature `protobuf:"bytes,3,opt,name=parent_signature,json=parentSignature,proto3" json:"parent_signature,omitempty"` + ParentSignature *grpc1.Signature `protobuf:"bytes,3,opt,name=parent_signature,json=parentSignature,proto3" json:"parent_signature,omitempty"` // `header` field of the parent object. Used to reconstruct parent. ParentHeader *Header `protobuf:"bytes,4,opt,name=parent_header,json=parentHeader,proto3" json:"parent_header,omitempty"` // Children carries list of identifiers of the objects generated by splitting the current. - Children []*refs.ObjectID `protobuf:"bytes,5,rep,name=children,proto3" json:"children,omitempty"` + Children []*grpc.ObjectID `protobuf:"bytes,5,rep,name=children,proto3" json:"children,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -279,7 +279,7 @@ func (m *Header_Split) Reset() { *m = Header_Split{} } func (m *Header_Split) String() string { return proto.CompactTextString(m) } func (*Header_Split) ProtoMessage() {} func (*Header_Split) Descriptor() ([]byte, []int) { - return fileDescriptor_fcb9e8df342f43c6, []int{0, 1} + return fileDescriptor_545319325da7b9b1, []int{0, 1} } func (m *Header_Split) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -308,21 +308,21 @@ func (m *Header_Split) XXX_DiscardUnknown() { var xxx_messageInfo_Header_Split proto.InternalMessageInfo -func (m *Header_Split) GetParent() *refs.ObjectID { +func (m *Header_Split) GetParent() *grpc.ObjectID { if m != nil { return m.Parent } return nil } -func (m *Header_Split) GetPrevious() *refs.ObjectID { +func (m *Header_Split) GetPrevious() *grpc.ObjectID { if m != nil { return m.Previous } return nil } -func (m *Header_Split) GetParentSignature() *service.Signature { +func (m *Header_Split) GetParentSignature() *grpc1.Signature { if m != nil { return m.ParentSignature } @@ -336,7 +336,7 @@ func (m *Header_Split) GetParentHeader() *Header { return nil } -func (m *Header_Split) GetChildren() []*refs.ObjectID { +func (m *Header_Split) GetChildren() []*grpc.ObjectID { if m != nil { return m.Children } @@ -349,9 +349,9 @@ type Object struct { // Object is content-addressed. It means id will change if header or payload // changes. It's calculated as a hash of header field, which contains hash of // object's payload - ObjectId *refs.ObjectID `protobuf:"bytes,1,opt,name=object_id,json=objectId,proto3" json:"object_id,omitempty"` + ObjectId *grpc.ObjectID `protobuf:"bytes,1,opt,name=object_id,json=objectId,proto3" json:"object_id,omitempty"` // Signed object_id - Signature *service.Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` + Signature *grpc1.Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` // Object metadata headers Header *Header `protobuf:"bytes,3,opt,name=header,proto3" json:"header,omitempty"` // Payload bytes. @@ -365,7 +365,7 @@ func (m *Object) Reset() { *m = Object{} } func (m *Object) String() string { return proto.CompactTextString(m) } func (*Object) ProtoMessage() {} func (*Object) Descriptor() ([]byte, []int) { - return fileDescriptor_fcb9e8df342f43c6, []int{1} + return fileDescriptor_545319325da7b9b1, []int{1} } func (m *Object) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -394,14 +394,14 @@ func (m *Object) XXX_DiscardUnknown() { var xxx_messageInfo_Object proto.InternalMessageInfo -func (m *Object) GetObjectId() *refs.ObjectID { +func (m *Object) GetObjectId() *grpc.ObjectID { if m != nil { return m.ObjectId } return nil } -func (m *Object) GetSignature() *service.Signature { +func (m *Object) GetSignature() *grpc1.Signature { if m != nil { return m.Signature } @@ -430,55 +430,56 @@ func init() { proto.RegisterType((*Object)(nil), "neo.fs.v2.object.Object") } -func init() { proto.RegisterFile("v2/object/types.proto", fileDescriptor_fcb9e8df342f43c6) } +func init() { proto.RegisterFile("v2/object/grpc/types.proto", fileDescriptor_545319325da7b9b1) } -var fileDescriptor_fcb9e8df342f43c6 = []byte{ - // 720 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x94, 0xcf, 0x6e, 0xd3, 0x4e, - 0x10, 0xc7, 0xeb, 0xa4, 0xf9, 0x37, 0x4e, 0xda, 0xfc, 0xb6, 0x3f, 0x54, 0x2b, 0xa0, 0x10, 0x2a, - 0x21, 0x05, 0xa4, 0x3a, 0xc8, 0x0d, 0x17, 0xaa, 0x22, 0xa5, 0x34, 0xa4, 0x91, 0x4a, 0x53, 0x6d, - 0x52, 0x0e, 0xbd, 0x44, 0x8e, 0xbd, 0x89, 0x4d, 0x13, 0xaf, 0xe5, 0x75, 0x5c, 0xe5, 0x4d, 0x78, - 0x06, 0x24, 0x2e, 0xbc, 0x04, 0x1c, 0x79, 0x04, 0x54, 0x5e, 0x04, 0x79, 0xd7, 0x76, 0x42, 0x4b, - 0x0b, 0x27, 0x7b, 0xbf, 0xfe, 0x7c, 0x67, 0x76, 0x66, 0x67, 0x0d, 0x0f, 0x02, 0xad, 0x41, 0x47, - 0x1f, 0x88, 0xe1, 0x37, 0xfc, 0x85, 0x4b, 0x98, 0xea, 0x7a, 0xd4, 0xa7, 0xa8, 0xec, 0x10, 0xaa, - 0x8e, 0x99, 0x1a, 0x68, 0xaa, 0xf8, 0x5a, 0xd9, 0x0a, 0xb4, 0x86, 0x47, 0xc6, 0x6c, 0x15, 0xab, - 0x84, 0x6e, 0x46, 0xbc, 0xc0, 0x36, 0x48, 0x63, 0x46, 0x7c, 0x3d, 0x92, 0xb7, 0x57, 0xe4, 0x80, - 0x78, 0xf6, 0x78, 0x21, 0x3e, 0xec, 0x7c, 0xc9, 0x41, 0xf6, 0x98, 0xe8, 0x26, 0xf1, 0xd0, 0x6b, - 0x28, 0x1a, 0xd4, 0xf1, 0x75, 0xdb, 0x21, 0xde, 0xd0, 0x36, 0x15, 0xa9, 0x26, 0xd5, 0x65, 0xed, - 0xa1, 0xba, 0x4c, 0x1c, 0x66, 0x53, 0xdf, 0xc4, 0x4c, 0xf7, 0x08, 0xcb, 0x89, 0xa1, 0x6b, 0x22, - 0x0d, 0xf2, 0xf4, 0x2a, 0xf2, 0xa6, 0xb8, 0x77, 0xfb, 0xa6, 0xb7, 0x77, 0x25, 0x7c, 0x39, 0x0e, - 0x76, 0x4d, 0xf4, 0x14, 0x36, 0x0c, 0x8f, 0xe8, 0xbe, 0x4d, 0x9d, 0x21, 0x71, 0xa9, 0x61, 0x29, - 0xe9, 0x9a, 0x54, 0x5f, 0xc7, 0xa5, 0x58, 0x6d, 0x87, 0x22, 0x6a, 0x42, 0x2e, 0x20, 0x1e, 0xb3, - 0xa9, 0xa3, 0xac, 0xf3, 0xc8, 0x95, 0x95, 0xc8, 0x51, 0x5d, 0xea, 0x7b, 0x41, 0xe0, 0x18, 0x0d, - 0x83, 0xbb, 0xfa, 0x62, 0x4a, 0x75, 0x73, 0x38, 0x25, 0xce, 0xc4, 0xb7, 0x94, 0x8c, 0x08, 0x1e, - 0xa9, 0x27, 0x5c, 0x44, 0x4f, 0xa0, 0x18, 0x63, 0x96, 0xce, 0x2c, 0x25, 0x5b, 0x93, 0xea, 0x45, - 0x2c, 0x47, 0xda, 0xb1, 0xce, 0x2c, 0x74, 0x00, 0xb2, 0x68, 0xfa, 0x30, 0xec, 0xb5, 0x92, 0xab, - 0x49, 0xf5, 0x0d, 0xed, 0x91, 0x7a, 0xf3, 0x48, 0xd4, 0x1e, 0x7f, 0x0c, 0x16, 0x2e, 0xc1, 0x40, - 0x93, 0x77, 0xf4, 0x0c, 0xca, 0x16, 0x9d, 0xd1, 0x19, 0xf5, 0x5c, 0xcb, 0x36, 0x44, 0x96, 0x3c, - 0xcf, 0xb2, 0xb9, 0xa2, 0xf3, 0x4c, 0x47, 0x50, 0x62, 0x84, 0x85, 0xdb, 0x1f, 0xfa, 0xf4, 0x92, - 0x38, 0x4a, 0x81, 0xd7, 0xfb, 0xf8, 0x0f, 0xf5, 0xf6, 0x05, 0x37, 0x08, 0x31, 0x5c, 0x64, 0x2b, - 0x2b, 0x74, 0x08, 0xa0, 0xfb, 0xbe, 0x67, 0x8f, 0xe6, 0x3e, 0x61, 0x0a, 0xd4, 0xd2, 0x75, 0x59, - 0xdb, 0xb9, 0xbd, 0x5d, 0x71, 0xf0, 0x6a, 0x2b, 0x46, 0xf1, 0x8a, 0x0b, 0x35, 0x21, 0xc3, 0xdc, - 0xa9, 0xed, 0x2b, 0x32, 0xdf, 0x41, 0xf5, 0x4e, 0x7b, 0x3f, 0xa4, 0xb0, 0x80, 0x2b, 0x7b, 0x50, - 0x48, 0xc2, 0xa1, 0x32, 0xa4, 0x2f, 0xc9, 0x82, 0x0f, 0x52, 0x01, 0x87, 0xaf, 0xe8, 0x7f, 0xc8, - 0x04, 0xfa, 0x74, 0x4e, 0xf8, 0x80, 0x14, 0xb0, 0x58, 0x54, 0x3e, 0xa7, 0x20, 0xc3, 0xa3, 0xa0, - 0x17, 0x90, 0x75, 0x75, 0x8f, 0x38, 0x7e, 0x34, 0x7d, 0xca, 0xad, 0x09, 0xe2, 0xa9, 0xbb, 0x47, - 0x38, 0xe2, 0x50, 0x13, 0xf2, 0xae, 0x47, 0x02, 0x9b, 0xce, 0x59, 0x34, 0x75, 0x77, 0x7b, 0x12, - 0x12, 0x75, 0xa0, 0x2c, 0xfc, 0x43, 0x66, 0x4f, 0x1c, 0xdd, 0x9f, 0x7b, 0x84, 0x4f, 0x9e, 0xfc, - 0xdb, 0xa9, 0x26, 0x9d, 0x8e, 0x19, 0xbc, 0x29, 0x5c, 0x89, 0x80, 0x0e, 0xa0, 0x14, 0x05, 0xb2, - 0x78, 0x37, 0xa2, 0xf9, 0x54, 0xee, 0xea, 0x16, 0x2e, 0x0a, 0x3c, 0xba, 0x73, 0x4d, 0xc8, 0x1b, - 0x96, 0x3d, 0x35, 0x3d, 0xe2, 0x28, 0x19, 0x7e, 0x4c, 0xf7, 0xec, 0x3e, 0x26, 0x77, 0xbe, 0x4a, - 0x90, 0x15, 0x32, 0x7a, 0x09, 0x85, 0x68, 0x32, 0x93, 0x1b, 0x7b, 0x4f, 0x04, 0x81, 0x76, 0x4d, - 0xf4, 0x0a, 0x0a, 0xcb, 0xc2, 0x53, 0xff, 0x50, 0xf8, 0x12, 0x0f, 0xcf, 0x28, 0xaa, 0x35, 0xfd, - 0x97, 0x5a, 0x23, 0x0e, 0x29, 0x90, 0x8b, 0x6e, 0x13, 0x6f, 0x4f, 0x11, 0xc7, 0xcb, 0xe7, 0xfb, - 0x00, 0xcb, 0x3b, 0x83, 0x64, 0xc8, 0xe1, 0x76, 0xe7, 0xfc, 0xa4, 0x85, 0xcb, 0x6b, 0xa8, 0x04, - 0x85, 0x41, 0xef, 0xdd, 0x61, 0x7f, 0xd0, 0x3b, 0x6d, 0x97, 0x25, 0xf4, 0x1f, 0x94, 0xfa, 0x83, - 0x1e, 0x6e, 0x75, 0xda, 0xc3, 0x0e, 0xee, 0x9d, 0x9f, 0x95, 0x53, 0x87, 0x17, 0xdf, 0xae, 0xab, - 0xd2, 0xf7, 0xeb, 0xaa, 0xf4, 0xe3, 0xba, 0x2a, 0x7d, 0xfc, 0x59, 0x5d, 0xbb, 0xd0, 0x26, 0xb6, - 0x6f, 0xcd, 0x47, 0xaa, 0x41, 0x67, 0x0d, 0x87, 0xb9, 0x86, 0xb1, 0x6b, 0x92, 0xa0, 0xe1, 0x10, - 0x3a, 0x66, 0xbb, 0xba, 0x6b, 0xef, 0x4e, 0x68, 0x23, 0xf9, 0xbb, 0xee, 0x8b, 0xc7, 0xa7, 0xd4, - 0xd6, 0x29, 0xa1, 0x6f, 0xfb, 0x6a, 0xeb, 0xac, 0x1b, 0x56, 0x20, 0xb6, 0x33, 0xca, 0xf2, 0xdf, - 0xe3, 0xde, 0xaf, 0x00, 0x00, 0x00, 0xff, 0xff, 0xd6, 0x66, 0x06, 0xbc, 0x8e, 0x05, 0x00, 0x00, +var fileDescriptor_545319325da7b9b1 = []byte{ + // 726 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x94, 0xdd, 0x6e, 0xda, 0x48, + 0x14, 0xc7, 0x63, 0x08, 0x5f, 0xc7, 0x90, 0xb0, 0xb3, 0x2b, 0xad, 0xc5, 0x46, 0x2c, 0x1b, 0x69, + 0x25, 0x5a, 0x29, 0xa6, 0x22, 0x54, 0x95, 0x1a, 0xa5, 0x12, 0x69, 0x28, 0x41, 0x4a, 0x43, 0x34, + 0x90, 0x5e, 0xf4, 0xc6, 0x32, 0xf6, 0x80, 0xdd, 0x80, 0xc7, 0xf2, 0x18, 0x47, 0xbc, 0x49, 0x9f, + 0xa1, 0x52, 0x6f, 0xfa, 0x12, 0xed, 0x65, 0x1f, 0xa1, 0x4a, 0x5f, 0xa4, 0xf2, 0xcc, 0x18, 0x48, + 0xd2, 0xa4, 0xbd, 0xf2, 0xcc, 0x99, 0xdf, 0xff, 0xcc, 0xf9, 0x1a, 0x43, 0x25, 0x6a, 0x36, 0xe8, + 0xe8, 0x1d, 0xb1, 0xc2, 0xc6, 0x24, 0xf0, 0xad, 0x46, 0xb8, 0xf0, 0x09, 0xd3, 0xfd, 0x80, 0x86, + 0x14, 0x95, 0x3d, 0x42, 0xf5, 0x31, 0xd3, 0xa3, 0xa6, 0x2e, 0x90, 0x8a, 0x16, 0x35, 0x1b, 0x01, + 0x19, 0xb3, 0x3b, 0x6c, 0x25, 0xf6, 0xc3, 0x48, 0x10, 0xb9, 0x16, 0x11, 0x87, 0x33, 0x12, 0x9a, + 0xf2, 0x6c, 0xe7, 0xf6, 0x59, 0x44, 0x02, 0x77, 0xbc, 0x10, 0xa7, 0xbb, 0x9f, 0x72, 0x90, 0x3d, + 0x21, 0xa6, 0x4d, 0x02, 0xf4, 0x02, 0x8a, 0x16, 0xf5, 0x42, 0xd3, 0xf5, 0x48, 0x60, 0xb8, 0xb6, + 0xa6, 0xd4, 0x94, 0xba, 0xda, 0xfc, 0x47, 0x5f, 0xc5, 0x11, 0x5f, 0xae, 0xbf, 0x4c, 0x98, 0xde, + 0x31, 0x56, 0x97, 0x82, 0x9e, 0x8d, 0x9a, 0x90, 0xa7, 0x57, 0x52, 0x9b, 0xe2, 0xda, 0xbf, 0x6f, + 0x6b, 0xfb, 0x57, 0x42, 0x97, 0xe3, 0x60, 0xcf, 0x46, 0xff, 0xc3, 0x96, 0x15, 0x10, 0x33, 0x74, + 0xa9, 0x67, 0x10, 0x9f, 0x5a, 0x8e, 0x96, 0xae, 0x29, 0xf5, 0x4d, 0x5c, 0x4a, 0xac, 0x9d, 0xd8, + 0x88, 0x5a, 0x90, 0x8b, 0x48, 0xc0, 0x5c, 0xea, 0x69, 0x9b, 0xdc, 0x73, 0x65, 0xcd, 0xb3, 0x4c, + 0x4e, 0x7f, 0x23, 0x08, 0x9c, 0xa0, 0xb1, 0x73, 0xdf, 0x5c, 0x4c, 0xa9, 0x69, 0x1b, 0x53, 0xe2, + 0x4d, 0x42, 0x47, 0xcb, 0x08, 0xe7, 0xd2, 0x7a, 0xca, 0x8d, 0xe8, 0x3f, 0x28, 0x26, 0x98, 0x63, + 0x32, 0x47, 0xcb, 0xd6, 0x94, 0x7a, 0x11, 0xab, 0xd2, 0x76, 0x62, 0x32, 0x07, 0x1d, 0x82, 0x2a, + 0x7a, 0x60, 0xc4, 0x55, 0xd7, 0x72, 0x35, 0xa5, 0xbe, 0xd5, 0xdc, 0xd1, 0x6f, 0x77, 0x48, 0xef, + 0xf3, 0xcf, 0x70, 0xe1, 0x13, 0x0c, 0x74, 0xb9, 0x46, 0x8f, 0xa0, 0xec, 0xd0, 0x19, 0x9d, 0xd1, + 0xc0, 0x77, 0x5c, 0x4b, 0xdc, 0x92, 0xe7, 0xb7, 0x6c, 0xaf, 0xd9, 0xf9, 0x4d, 0xc7, 0x50, 0x62, + 0x84, 0xc5, 0xe1, 0x1b, 0x21, 0xbd, 0x24, 0x9e, 0x56, 0xe0, 0xf9, 0xfe, 0xfb, 0x93, 0x7c, 0x07, + 0x82, 0x1b, 0xc6, 0x18, 0x2e, 0xb2, 0xb5, 0x1d, 0x3a, 0x02, 0x30, 0xc3, 0x30, 0x70, 0x47, 0xf3, + 0x90, 0x30, 0x0d, 0x6a, 0xe9, 0xba, 0xda, 0xdc, 0xbd, 0x1b, 0xae, 0x68, 0xbc, 0xde, 0x4e, 0x50, + 0xbc, 0xa6, 0x42, 0x2d, 0xc8, 0x30, 0x7f, 0xea, 0x86, 0x9a, 0xca, 0x23, 0xa8, 0xde, 0x2b, 0x1f, + 0xc4, 0x14, 0x16, 0x70, 0x65, 0x1f, 0x0a, 0x4b, 0x77, 0xa8, 0x0c, 0xe9, 0x4b, 0xb2, 0xe0, 0x83, + 0x54, 0xc0, 0xf1, 0x12, 0xfd, 0x05, 0x99, 0xc8, 0x9c, 0xce, 0x09, 0x1f, 0x90, 0x02, 0x16, 0x9b, + 0xca, 0xc7, 0x14, 0x64, 0xb8, 0x17, 0xf4, 0x04, 0xb2, 0xbe, 0x19, 0x10, 0x2f, 0x94, 0xd3, 0xa7, + 0xdd, 0x99, 0x20, 0x7e, 0x75, 0xef, 0x18, 0x4b, 0x0e, 0xb5, 0x20, 0xef, 0x07, 0x24, 0x72, 0xe9, + 0x9c, 0xc9, 0xa9, 0xbb, 0x5f, 0xb3, 0x24, 0x51, 0x17, 0xca, 0x42, 0x6f, 0x30, 0x77, 0xe2, 0x99, + 0xe1, 0x3c, 0x20, 0x7c, 0xf2, 0xd4, 0x1b, 0x5d, 0x5d, 0x56, 0x3a, 0x61, 0xf0, 0xb6, 0x50, 0x2d, + 0x0d, 0xe8, 0x10, 0x4a, 0xd2, 0x91, 0xc3, 0xab, 0x21, 0xe7, 0x53, 0xbb, 0xaf, 0x5a, 0xb8, 0x28, + 0x70, 0xf9, 0xe6, 0x5a, 0x90, 0xb7, 0x1c, 0x77, 0x6a, 0x07, 0xc4, 0xd3, 0x32, 0xbc, 0x4d, 0x0f, + 0x44, 0x9f, 0x90, 0xbb, 0x9f, 0x15, 0xc8, 0x0a, 0x33, 0x7a, 0x0a, 0x05, 0x39, 0x99, 0xcb, 0x17, + 0xfb, 0x80, 0x07, 0x81, 0xf6, 0x6c, 0xf4, 0x1c, 0x0a, 0xab, 0xc4, 0x53, 0xbf, 0x91, 0xf8, 0x0a, + 0x8f, 0x7b, 0x24, 0x73, 0x4d, 0xff, 0x22, 0x57, 0xc9, 0x21, 0x0d, 0x72, 0xf2, 0x35, 0xf1, 0xf2, + 0x14, 0x71, 0xb2, 0x7d, 0x7c, 0x00, 0xb0, 0x7a, 0x33, 0x48, 0x85, 0x1c, 0xee, 0x74, 0x2f, 0x4e, + 0xdb, 0xb8, 0xbc, 0x81, 0x4a, 0x50, 0x18, 0xf6, 0x5f, 0x1f, 0x0d, 0x86, 0xfd, 0xb3, 0x4e, 0x59, + 0x41, 0x7f, 0x40, 0x69, 0x30, 0xec, 0xe3, 0x76, 0xb7, 0x63, 0x74, 0x71, 0xff, 0xe2, 0xbc, 0x9c, + 0x3a, 0x32, 0xbe, 0x5c, 0x57, 0x95, 0xaf, 0xd7, 0x55, 0xe5, 0xdb, 0x75, 0x55, 0x79, 0xff, 0xbd, + 0xba, 0xf1, 0xf6, 0xd9, 0xc4, 0x0d, 0x9d, 0xf9, 0x48, 0xb7, 0xe8, 0xac, 0xe1, 0x31, 0xdf, 0xb2, + 0xf6, 0x6c, 0x12, 0x35, 0x3c, 0x42, 0xc7, 0x6c, 0xcf, 0xf4, 0xdd, 0xbd, 0x09, 0x6d, 0xdc, 0xfc, + 0xe3, 0x1e, 0x88, 0xf5, 0x87, 0xd4, 0x9f, 0x67, 0x84, 0xbe, 0x1a, 0xe8, 0xed, 0xf3, 0x5e, 0x9c, + 0x86, 0x88, 0x69, 0x94, 0xe5, 0xff, 0xc8, 0xfd, 0x1f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x65, 0x74, + 0xce, 0xc4, 0xa7, 0x05, 0x00, 0x00, } func (m *Header) Marshal() (dAtA []byte, err error) { @@ -1024,7 +1025,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.ContainerId == nil { - m.ContainerId = &refs.ContainerID{} + m.ContainerId = &grpc.ContainerID{} } if err := m.ContainerId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -1060,7 +1061,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.OwnerId == nil { - m.OwnerId = &refs.OwnerID{} + m.OwnerId = &grpc.OwnerID{} } if err := m.OwnerId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -1115,7 +1116,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.Version == nil { - m.Version = &service.Version{} + m.Version = &grpc1.Version{} } if err := m.Version.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -1257,7 +1258,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.SessionToken == nil { - m.SessionToken = &service.SessionToken{} + m.SessionToken = &grpc1.SessionToken{} } if err := m.SessionToken.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -1535,7 +1536,7 @@ func (m *Header_Split) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.Parent == nil { - m.Parent = &refs.ObjectID{} + m.Parent = &grpc.ObjectID{} } if err := m.Parent.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -1571,7 +1572,7 @@ func (m *Header_Split) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.Previous == nil { - m.Previous = &refs.ObjectID{} + m.Previous = &grpc.ObjectID{} } if err := m.Previous.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -1607,7 +1608,7 @@ func (m *Header_Split) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.ParentSignature == nil { - m.ParentSignature = &service.Signature{} + m.ParentSignature = &grpc1.Signature{} } if err := m.ParentSignature.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -1678,7 +1679,7 @@ func (m *Header_Split) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Children = append(m.Children, &refs.ObjectID{}) + m.Children = append(m.Children, &grpc.ObjectID{}) if err := m.Children[len(m.Children)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -1767,7 +1768,7 @@ func (m *Object) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.ObjectId == nil { - m.ObjectId = &refs.ObjectID{} + m.ObjectId = &grpc.ObjectID{} } if err := m.ObjectId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -1803,7 +1804,7 @@ func (m *Object) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.Signature == nil { - m.Signature = &service.Signature{} + m.Signature = &grpc1.Signature{} } if err := m.Signature.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err diff --git a/v2/refs/convert.go b/v2/refs/convert.go new file mode 100644 index 0000000..869a0e6 --- /dev/null +++ b/v2/refs/convert.go @@ -0,0 +1,29 @@ +package refs + +import ( + refs "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" +) + +func OwnerIDToGRPCMessage(o *OwnerID) *refs.OwnerID { + if o == nil { + return nil + } + + m := new(refs.OwnerID) + + m.SetValue(o.GetValue()) + + return m +} + +func OwnerIDFromGRPCMessage(m *refs.OwnerID) *OwnerID { + if m == nil { + return nil + } + + o := new(OwnerID) + + o.SetValue(m.GetValue()) + + return o +} diff --git a/v2/refs/marshal.go b/v2/refs/grpc/marshal.go similarity index 100% rename from v2/refs/marshal.go rename to v2/refs/grpc/marshal.go diff --git a/v2/refs/marshal_test.go b/v2/refs/grpc/marshal_test.go similarity index 100% rename from v2/refs/marshal_test.go rename to v2/refs/grpc/marshal_test.go diff --git a/v2/refs/types.go b/v2/refs/grpc/types.go similarity index 100% rename from v2/refs/types.go rename to v2/refs/grpc/types.go diff --git a/v2/refs/types.pb.go b/v2/refs/grpc/types.pb.go similarity index 91% rename from v2/refs/types.pb.go rename to v2/refs/grpc/types.pb.go index 5e57a4b..7634600 100644 --- a/v2/refs/types.pb.go +++ b/v2/refs/grpc/types.pb.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: v2/refs/types.proto +// source: v2/refs/grpc/types.proto package refs @@ -37,7 +37,7 @@ func (m *Address) Reset() { *m = Address{} } func (m *Address) String() string { return proto.CompactTextString(m) } func (*Address) ProtoMessage() {} func (*Address) Descriptor() ([]byte, []int) { - return fileDescriptor_8ea16029b13f1cfa, []int{0} + return fileDescriptor_08f084e5f91ec87c, []int{0} } func (m *Address) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -93,7 +93,7 @@ func (m *ObjectID) Reset() { *m = ObjectID{} } func (m *ObjectID) String() string { return proto.CompactTextString(m) } func (*ObjectID) ProtoMessage() {} func (*ObjectID) Descriptor() ([]byte, []int) { - return fileDescriptor_8ea16029b13f1cfa, []int{1} + return fileDescriptor_08f084e5f91ec87c, []int{1} } func (m *ObjectID) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -142,7 +142,7 @@ func (m *ContainerID) Reset() { *m = ContainerID{} } func (m *ContainerID) String() string { return proto.CompactTextString(m) } func (*ContainerID) ProtoMessage() {} func (*ContainerID) Descriptor() ([]byte, []int) { - return fileDescriptor_8ea16029b13f1cfa, []int{2} + return fileDescriptor_08f084e5f91ec87c, []int{2} } func (m *ContainerID) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -191,7 +191,7 @@ func (m *OwnerID) Reset() { *m = OwnerID{} } func (m *OwnerID) String() string { return proto.CompactTextString(m) } func (*OwnerID) ProtoMessage() {} func (*OwnerID) Descriptor() ([]byte, []int) { - return fileDescriptor_8ea16029b13f1cfa, []int{3} + return fileDescriptor_08f084e5f91ec87c, []int{3} } func (m *OwnerID) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -234,27 +234,27 @@ func init() { proto.RegisterType((*OwnerID)(nil), "neo.fs.v2.refs.OwnerID") } -func init() { proto.RegisterFile("v2/refs/types.proto", fileDescriptor_8ea16029b13f1cfa) } +func init() { proto.RegisterFile("v2/refs/grpc/types.proto", fileDescriptor_08f084e5f91ec87c) } -var fileDescriptor_8ea16029b13f1cfa = []byte{ - // 259 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x2e, 0x33, 0xd2, 0x2f, - 0x4a, 0x4d, 0x2b, 0xd6, 0x2f, 0xa9, 0x2c, 0x48, 0x2d, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, - 0xe2, 0xcb, 0x4b, 0xcd, 0xd7, 0x4b, 0x2b, 0xd6, 0x2b, 0x33, 0xd2, 0x03, 0xc9, 0x29, 0x35, 0x30, - 0x72, 0xb1, 0x3b, 0xa6, 0xa4, 0x14, 0xa5, 0x16, 0x17, 0x0b, 0xd9, 0x71, 0xf1, 0x24, 0xe7, 0xe7, - 0x95, 0x24, 0x66, 0xe6, 0xa5, 0x16, 0xc5, 0x67, 0xa6, 0x48, 0x30, 0x2a, 0x30, 0x6a, 0x70, 0x1b, - 0x49, 0xeb, 0xa1, 0x6a, 0xd1, 0x73, 0x86, 0xa9, 0xf1, 0x74, 0x09, 0xe2, 0x86, 0x6b, 0xf0, 0x4c, - 0x11, 0x32, 0xe5, 0xe2, 0xcc, 0x4f, 0xca, 0x4a, 0x4d, 0x2e, 0x01, 0x69, 0x66, 0x02, 0x6b, 0x96, - 0x40, 0xd7, 0xec, 0x0f, 0x56, 0xe0, 0xe9, 0x12, 0xc4, 0x01, 0x51, 0xea, 0x99, 0xa2, 0xa4, 0xc0, - 0xc5, 0x01, 0x13, 0x15, 0x12, 0xe1, 0x62, 0x2d, 0x4b, 0xcc, 0x29, 0x4d, 0x05, 0xdb, 0xcd, 0x13, - 0x04, 0xe1, 0x28, 0x29, 0x73, 0x71, 0x23, 0x59, 0x8a, 0x43, 0x91, 0x3c, 0x17, 0xbb, 0x7f, 0x39, - 0x1e, 0x05, 0x4e, 0x21, 0x27, 0x1e, 0xc9, 0x31, 0x5e, 0x78, 0x24, 0xc7, 0xf8, 0xe0, 0x91, 0x1c, - 0xe3, 0x8c, 0xc7, 0x72, 0x0c, 0x51, 0x7a, 0xe9, 0x99, 0x25, 0x19, 0xa5, 0x49, 0x7a, 0xc9, 0xf9, - 0xb9, 0xfa, 0x79, 0xc5, 0x05, 0xc9, 0xc9, 0xba, 0x29, 0xa9, 0x65, 0xfa, 0x79, 0xa9, 0xf9, 0x69, - 0xc5, 0xba, 0x89, 0x05, 0x99, 0xba, 0xe9, 0xf9, 0xfa, 0xd0, 0x30, 0xb4, 0x06, 0x11, 0xab, 0x98, - 0x04, 0xfd, 0x52, 0xf3, 0xdd, 0x82, 0xf5, 0x1c, 0x03, 0x3c, 0x41, 0x1e, 0x0a, 0x4a, 0x4d, 0x2b, - 0x4e, 0x62, 0x03, 0x87, 0xab, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0xd0, 0xa5, 0x8b, 0x04, 0x6e, - 0x01, 0x00, 0x00, +var fileDescriptor_08f084e5f91ec87c = []byte{ + // 265 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x28, 0x33, 0xd2, 0x2f, + 0x4a, 0x4d, 0x2b, 0xd6, 0x4f, 0x2f, 0x2a, 0x48, 0xd6, 0x2f, 0xa9, 0x2c, 0x48, 0x2d, 0xd6, 0x2b, + 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0xcb, 0x4b, 0xcd, 0xd7, 0x4b, 0x2b, 0xd6, 0x2b, 0x33, 0xd2, + 0x03, 0x29, 0x50, 0x6a, 0x60, 0xe4, 0x62, 0x77, 0x4c, 0x49, 0x29, 0x4a, 0x2d, 0x2e, 0x16, 0xb2, + 0xe3, 0xe2, 0x49, 0xce, 0xcf, 0x2b, 0x49, 0xcc, 0xcc, 0x4b, 0x2d, 0x8a, 0xcf, 0x4c, 0x91, 0x60, + 0x54, 0x60, 0xd4, 0xe0, 0x36, 0x92, 0xd6, 0x43, 0xd5, 0xa2, 0xe7, 0x0c, 0x53, 0xe3, 0xe9, 0x12, + 0xc4, 0x0d, 0xd7, 0xe0, 0x99, 0x22, 0x64, 0xca, 0xc5, 0x99, 0x9f, 0x94, 0x95, 0x9a, 0x5c, 0x02, + 0xd2, 0xcc, 0x04, 0xd6, 0x2c, 0x81, 0xae, 0xd9, 0x1f, 0xac, 0xc0, 0xd3, 0x25, 0x88, 0x03, 0xa2, + 0xd4, 0x33, 0x45, 0x49, 0x81, 0x8b, 0x03, 0x26, 0x2a, 0x24, 0xc2, 0xc5, 0x5a, 0x96, 0x98, 0x53, + 0x9a, 0x0a, 0xb6, 0x9b, 0x27, 0x08, 0xc2, 0x51, 0x52, 0xe6, 0xe2, 0x46, 0xb2, 0x14, 0x87, 0x22, + 0x79, 0x2e, 0x76, 0xff, 0x72, 0x3c, 0x0a, 0x9c, 0x22, 0x4f, 0x3c, 0x92, 0x63, 0xbc, 0xf0, 0x48, + 0x8e, 0xf1, 0xc1, 0x23, 0x39, 0xc6, 0x19, 0x8f, 0xe5, 0x18, 0xa2, 0x8c, 0xd3, 0x33, 0x4b, 0x32, + 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, 0xf3, 0x8a, 0x0b, 0x92, 0x93, 0x75, 0x53, 0x52, 0xcb, + 0xf4, 0xf3, 0x52, 0xf3, 0xd3, 0x8a, 0x75, 0x13, 0x0b, 0x32, 0x75, 0xd3, 0xf3, 0xf5, 0x91, 0x03, + 0xd2, 0x1a, 0xc4, 0x5a, 0xc5, 0x24, 0xe8, 0x97, 0x9a, 0xef, 0x16, 0xac, 0xe7, 0x18, 0xe0, 0x09, + 0xf2, 0x55, 0x50, 0x6a, 0x5a, 0x71, 0x12, 0x1b, 0x38, 0x70, 0x8d, 0x01, 0x01, 0x00, 0x00, 0xff, + 0xff, 0x64, 0x50, 0x7b, 0x92, 0x78, 0x01, 0x00, 0x00, } func (m *Address) Marshal() (dAtA []byte, err error) { diff --git a/v2/refs/owner.go b/v2/refs/owner.go new file mode 100644 index 0000000..acaa692 --- /dev/null +++ b/v2/refs/owner.go @@ -0,0 +1,19 @@ +package refs + +type OwnerID struct { + val []byte +} + +func (o *OwnerID) GetValue() []byte { + if o != nil { + return o.val + } + + return nil +} + +func (o *OwnerID) SetValue(v []byte) { + if o != nil { + o.val = v + } +} diff --git a/v2/service/convert.go b/v2/service/convert.go new file mode 100644 index 0000000..bf2c3a2 --- /dev/null +++ b/v2/service/convert.go @@ -0,0 +1,201 @@ +package service + +import ( + service "github.com/nspcc-dev/neofs-api-go/v2/service/grpc" +) + +func VersionToGRPCMessage(v *Version) *service.Version { + if v == nil { + return nil + } + + msg := new(service.Version) + + msg.SetMajor(v.GetMajor()) + msg.SetMinor(v.GetMinor()) + + return msg +} + +func VersionFromGRPCMessage(m *service.Version) *Version { + if m == nil { + return nil + } + + v := new(Version) + + v.SetMajor(m.GetMajor()) + v.SetMinor(m.GetMinor()) + + return v +} + +func XHeaderToGRPCMessage(x *XHeader) *service.XHeader { + if x == nil { + return nil + } + + m := new(service.XHeader) + + m.SetKey(x.GetKey()) + m.SetValue(x.GetValue()) + + return m +} + +func XHeaderFromGRPCMessage(m *service.XHeader) *XHeader { + if m == nil { + return nil + } + + x := new(XHeader) + + x.SetKey(m.GetKey()) + x.SetValue(m.GetValue()) + + return x +} + +func SessionTokenToGRPCMessage(t *SessionToken) *service.SessionToken { + // TODO: fill me + return nil +} + +func SessionTokenFromGRPCMessage(m *service.SessionToken) *SessionToken { + // TODO: fill me + return nil +} + +func BearerTokenToGRPCMessage(t *BearerToken) *service.BearerToken { + // TODO: fill me + return nil +} + +func BearerTokenFromGRPCMessage(m *service.BearerToken) *BearerToken { + // TODO: fill me + return nil +} + +func RequestVerificationHeaderToGRPCMessage(r *RequestVerificationHeader) *service.RequestVerificationHeader { + if r == nil { + return nil + } + + m := new(service.RequestVerificationHeader) + + m.SetBodySignature( + SignatureToGRPCMessage(r.GetBodySignature()), + ) + + m.SetMetaSignature( + SignatureToGRPCMessage(r.GetMetaSignature()), + ) + + m.SetOriginSignature( + SignatureToGRPCMessage(r.GetOriginSignature()), + ) + + m.SetOrigin( + RequestVerificationHeaderToGRPCMessage(r.GetOrigin()), + ) + + return m +} + +func RequestVerificationHeaderFromGRPCMessage(m *service.RequestVerificationHeader) *RequestVerificationHeader { + if m == nil { + return nil + } + + r := new(RequestVerificationHeader) + + r.SetBodySignature( + SignatureFromGRPCMessage(m.GetBodySignature()), + ) + + r.SetMetaSignature( + SignatureFromGRPCMessage(m.GetMetaSignature()), + ) + + r.SetOriginSignature( + SignatureFromGRPCMessage(m.GetOriginSignature()), + ) + + r.SetOrigin( + RequestVerificationHeaderFromGRPCMessage(m.GetOrigin()), + ) + + return r +} + +func RequestMetaHeaderToGRPCMessage(r *RequestMetaHeader) *service.RequestMetaHeader { + if r == nil { + return nil + } + + m := new(service.RequestMetaHeader) + + m.SetTtl(r.GetTTL()) + m.SetEpoch(r.GetEpoch()) + + m.SetVersion( + VersionToGRPCMessage(r.GetVersion()), + ) + + m.SetSessionToken( + SessionTokenToGRPCMessage(r.GetSessionToken()), + ) + + m.SetBearerToken( + BearerTokenToGRPCMessage(r.GetBearerToken()), + ) + + m.SetOrigin( + RequestMetaHeaderToGRPCMessage(r.GetOrigin()), + ) + + xHeaders := r.GetXHeaders() + xHdrMsg := make([]*service.XHeader, 0, len(xHeaders)) + + for i := range xHeaders { + xHdrMsg = append(xHdrMsg, XHeaderToGRPCMessage(xHeaders[i])) + } + + return m +} + +func RequestMetaHeaderFromGRPCMessage(m *service.RequestMetaHeader) *RequestMetaHeader { + if m == nil { + return nil + } + + r := new(RequestMetaHeader) + + r.SetTTL(m.GetTtl()) + r.SetEpoch(m.GetEpoch()) + + r.SetVersion( + VersionFromGRPCMessage(m.GetVersion()), + ) + + r.SetSessionToken( + SessionTokenFromGRPCMessage(m.GetSessionToken()), + ) + + r.SetBearerToken( + BearerTokenFromGRPCMessage(m.GetBearerToken()), + ) + + r.SetOrigin( + RequestMetaHeaderFromGRPCMessage(m.GetOrigin()), + ) + + xHdrMsg := m.GetXHeaders() + xHeaders := make([]*XHeader, 0, len(xHdrMsg)) + + for i := range xHdrMsg { + xHeaders = append(xHeaders, XHeaderFromGRPCMessage(xHdrMsg[i])) + } + + return r +} diff --git a/v2/service/meta.go b/v2/service/grpc/meta.go similarity index 97% rename from v2/service/meta.go rename to v2/service/grpc/meta.go index a44e464..c5e9c78 100644 --- a/v2/service/meta.go +++ b/v2/service/grpc/meta.go @@ -1,8 +1,8 @@ package service import ( - "github.com/nspcc-dev/neofs-api-go/v2/acl" - "github.com/nspcc-dev/neofs-api-go/v2/refs" + acl "github.com/nspcc-dev/neofs-api-go/v2/acl/grpc" + refs "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" ) // SetKey sets key to the X-Header. diff --git a/v2/service/meta.pb.go b/v2/service/grpc/meta.pb.go similarity index 91% rename from v2/service/meta.pb.go rename to v2/service/grpc/meta.pb.go index 648f7f0..397dc3a 100644 --- a/v2/service/meta.pb.go +++ b/v2/service/grpc/meta.pb.go @@ -1,13 +1,13 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: v2/service/meta.proto +// source: v2/service/grpc/meta.proto package service import ( fmt "fmt" proto "github.com/golang/protobuf/proto" - acl "github.com/nspcc-dev/neofs-api-go/v2/acl" - refs "github.com/nspcc-dev/neofs-api-go/v2/refs" + grpc1 "github.com/nspcc-dev/neofs-api-go/v2/acl/grpc" + grpc "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" io "io" math "math" math_bits "math/bits" @@ -73,7 +73,7 @@ func (x SessionToken_Body_Verb) String() string { } func (SessionToken_Body_Verb) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_932e020d69aee3f0, []int{3, 0, 0} + return fileDescriptor_174eb6ef9ee2b356, []int{3, 0, 0} } // Extended headers for Request/Response @@ -91,7 +91,7 @@ func (m *XHeader) Reset() { *m = XHeader{} } func (m *XHeader) String() string { return proto.CompactTextString(m) } func (*XHeader) ProtoMessage() {} func (*XHeader) Descriptor() ([]byte, []int) { - return fileDescriptor_932e020d69aee3f0, []int{0} + return fileDescriptor_174eb6ef9ee2b356, []int{0} } func (m *XHeader) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -149,7 +149,7 @@ func (m *Version) Reset() { *m = Version{} } func (m *Version) String() string { return proto.CompactTextString(m) } func (*Version) ProtoMessage() {} func (*Version) Descriptor() ([]byte, []int) { - return fileDescriptor_932e020d69aee3f0, []int{1} + return fileDescriptor_174eb6ef9ee2b356, []int{1} } func (m *Version) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -209,7 +209,7 @@ func (m *TokenLifetime) Reset() { *m = TokenLifetime{} } func (m *TokenLifetime) String() string { return proto.CompactTextString(m) } func (*TokenLifetime) ProtoMessage() {} func (*TokenLifetime) Descriptor() ([]byte, []int) { - return fileDescriptor_932e020d69aee3f0, []int{2} + return fileDescriptor_174eb6ef9ee2b356, []int{2} } func (m *TokenLifetime) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -274,7 +274,7 @@ func (m *SessionToken) Reset() { *m = SessionToken{} } func (m *SessionToken) String() string { return proto.CompactTextString(m) } func (*SessionToken) ProtoMessage() {} func (*SessionToken) Descriptor() ([]byte, []int) { - return fileDescriptor_932e020d69aee3f0, []int{3} + return fileDescriptor_174eb6ef9ee2b356, []int{3} } func (m *SessionToken) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -322,7 +322,7 @@ type SessionToken_Body struct { // ID is a token identifier. valid UUIDv4 represented in bytes Id []byte `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` // OwnerID carries identifier of the session initiator. - OwnerId *refs.OwnerID `protobuf:"bytes,2,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"` + OwnerId *grpc.OwnerID `protobuf:"bytes,2,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"` // Verb is a type of request for which the token is issued Verb SessionToken_Body_Verb `protobuf:"varint,3,opt,name=verb,proto3,enum=neo.fs.v2.service.SessionToken_Body_Verb" json:"verb,omitempty"` // Lifetime is a lifetime of the session @@ -343,7 +343,7 @@ func (m *SessionToken_Body) Reset() { *m = SessionToken_Body{} } func (m *SessionToken_Body) String() string { return proto.CompactTextString(m) } func (*SessionToken_Body) ProtoMessage() {} func (*SessionToken_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_932e020d69aee3f0, []int{3, 0} + return fileDescriptor_174eb6ef9ee2b356, []int{3, 0} } func (m *SessionToken_Body) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -379,7 +379,7 @@ type isSessionToken_Body_Context interface { } type SessionToken_Body_ObjectAddress struct { - ObjectAddress *refs.Address `protobuf:"bytes,6,opt,name=object_address,json=objectAddress,proto3,oneof" json:"object_address,omitempty"` + ObjectAddress *grpc.Address `protobuf:"bytes,6,opt,name=object_address,json=objectAddress,proto3,oneof" json:"object_address,omitempty"` } func (*SessionToken_Body_ObjectAddress) isSessionToken_Body_Context() {} @@ -398,7 +398,7 @@ func (m *SessionToken_Body) GetId() []byte { return nil } -func (m *SessionToken_Body) GetOwnerId() *refs.OwnerID { +func (m *SessionToken_Body) GetOwnerId() *grpc.OwnerID { if m != nil { return m.OwnerId } @@ -426,7 +426,7 @@ func (m *SessionToken_Body) GetSessionKey() []byte { return nil } -func (m *SessionToken_Body) GetObjectAddress() *refs.Address { +func (m *SessionToken_Body) GetObjectAddress() *grpc.Address { if x, ok := m.GetContext().(*SessionToken_Body_ObjectAddress); ok { return x.ObjectAddress } @@ -455,7 +455,7 @@ func (m *BearerToken) Reset() { *m = BearerToken{} } func (m *BearerToken) String() string { return proto.CompactTextString(m) } func (*BearerToken) ProtoMessage() {} func (*BearerToken) Descriptor() ([]byte, []int) { - return fileDescriptor_932e020d69aee3f0, []int{4} + return fileDescriptor_174eb6ef9ee2b356, []int{4} } func (m *BearerToken) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -501,9 +501,9 @@ func (m *BearerToken) GetSignature() *Signature { // Bearer Token body type BearerToken_Body struct { // EACLTable carries table of extended ACL rules - EaclTable *acl.EACLTable `protobuf:"bytes,1,opt,name=eacl_table,json=eaclTable,proto3" json:"eacl_table,omitempty"` + EaclTable *grpc1.EACLTable `protobuf:"bytes,1,opt,name=eacl_table,json=eaclTable,proto3" json:"eacl_table,omitempty"` // OwnerID carries identifier of the token owner - OwnerId *refs.OwnerID `protobuf:"bytes,2,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"` + OwnerId *grpc.OwnerID `protobuf:"bytes,2,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"` // Token expiration and valid time period parameters Lifetime *TokenLifetime `protobuf:"bytes,3,opt,name=lifetime,proto3" json:"lifetime,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` @@ -515,7 +515,7 @@ func (m *BearerToken_Body) Reset() { *m = BearerToken_Body{} } func (m *BearerToken_Body) String() string { return proto.CompactTextString(m) } func (*BearerToken_Body) ProtoMessage() {} func (*BearerToken_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_932e020d69aee3f0, []int{4, 0} + return fileDescriptor_174eb6ef9ee2b356, []int{4, 0} } func (m *BearerToken_Body) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -544,14 +544,14 @@ func (m *BearerToken_Body) XXX_DiscardUnknown() { var xxx_messageInfo_BearerToken_Body proto.InternalMessageInfo -func (m *BearerToken_Body) GetEaclTable() *acl.EACLTable { +func (m *BearerToken_Body) GetEaclTable() *grpc1.EACLTable { if m != nil { return m.EaclTable } return nil } -func (m *BearerToken_Body) GetOwnerId() *refs.OwnerID { +func (m *BearerToken_Body) GetOwnerId() *grpc.OwnerID { if m != nil { return m.OwnerId } @@ -590,7 +590,7 @@ func (m *RequestMetaHeader) Reset() { *m = RequestMetaHeader{} } func (m *RequestMetaHeader) String() string { return proto.CompactTextString(m) } func (*RequestMetaHeader) ProtoMessage() {} func (*RequestMetaHeader) Descriptor() ([]byte, []int) { - return fileDescriptor_932e020d69aee3f0, []int{5} + return fileDescriptor_174eb6ef9ee2b356, []int{5} } func (m *RequestMetaHeader) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -689,7 +689,7 @@ func (m *ResponseMetaHeader) Reset() { *m = ResponseMetaHeader{} } func (m *ResponseMetaHeader) String() string { return proto.CompactTextString(m) } func (*ResponseMetaHeader) ProtoMessage() {} func (*ResponseMetaHeader) Descriptor() ([]byte, []int) { - return fileDescriptor_932e020d69aee3f0, []int{6} + return fileDescriptor_174eb6ef9ee2b356, []int{6} } func (m *ResponseMetaHeader) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -766,63 +766,63 @@ func init() { proto.RegisterType((*ResponseMetaHeader)(nil), "neo.fs.v2.service.ResponseMetaHeader") } -func init() { proto.RegisterFile("v2/service/meta.proto", fileDescriptor_932e020d69aee3f0) } +func init() { proto.RegisterFile("v2/service/grpc/meta.proto", fileDescriptor_174eb6ef9ee2b356) } -var fileDescriptor_932e020d69aee3f0 = []byte{ - // 834 bytes of a gzipped FileDescriptorProto +var fileDescriptor_174eb6ef9ee2b356 = []byte{ + // 838 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x55, 0xcd, 0x6e, 0x23, 0x45, - 0x10, 0xce, 0xd8, 0x93, 0x38, 0x2e, 0xdb, 0x61, 0xd2, 0x04, 0xad, 0x15, 0x21, 0x6f, 0x64, 0x40, - 0x82, 0x43, 0xc6, 0x62, 0x58, 0x14, 0x04, 0xbb, 0x12, 0x76, 0x3c, 0xbb, 0x36, 0x84, 0x6c, 0xd4, - 0xf6, 0x46, 0x08, 0x09, 0x59, 0xf3, 0x53, 0x4e, 0x66, 0xd7, 0x99, 0x36, 0xd3, 0x9d, 0x21, 0x7e, + 0x10, 0xce, 0xd8, 0x93, 0x38, 0x2e, 0xdb, 0x61, 0xd2, 0x8a, 0xb4, 0x23, 0x6b, 0xe5, 0x8d, 0x0c, + 0x48, 0x70, 0xc8, 0x58, 0x0c, 0xa0, 0xf0, 0xb3, 0x2b, 0x61, 0xc7, 0xb3, 0x6b, 0x43, 0xc8, 0x46, + 0x6d, 0x6f, 0x84, 0xb8, 0x58, 0xf3, 0x53, 0x76, 0x66, 0xd7, 0x99, 0x36, 0xd3, 0x93, 0x21, 0x7e, 0x13, 0x24, 0xde, 0x80, 0x1b, 0x17, 0x9e, 0x81, 0x23, 0x12, 0x37, 0x4e, 0x28, 0xdc, 0xb8, 0xf1, - 0x06, 0xa8, 0x7f, 0xbc, 0x3b, 0x61, 0xbd, 0xfc, 0x89, 0x03, 0x27, 0x57, 0x7d, 0x5d, 0xf5, 0x55, - 0x57, 0xf5, 0xe7, 0x1a, 0x78, 0x25, 0xf7, 0x3a, 0x1c, 0xb3, 0x3c, 0x89, 0xb0, 0x73, 0x81, 0x22, - 0x70, 0xe7, 0x19, 0x13, 0x8c, 0x6c, 0xa7, 0xc8, 0xdc, 0x29, 0x77, 0x73, 0xcf, 0x35, 0xa7, 0xbb, - 0x24, 0xf7, 0x3a, 0x41, 0x34, 0xeb, 0x88, 0xc5, 0x1c, 0xb9, 0x0e, 0xdb, 0x7d, 0x39, 0xf7, 0x3a, - 0x19, 0x4e, 0xf9, 0x0d, 0xf0, 0x56, 0x81, 0x32, 0xc7, 0x2c, 0x99, 0x2e, 0xf4, 0x41, 0xfb, 0x6d, - 0xa8, 0x7c, 0x3a, 0xc0, 0x20, 0xc6, 0x8c, 0x38, 0x50, 0x7e, 0x82, 0x8b, 0xa6, 0xb5, 0x67, 0xbd, - 0x59, 0xa5, 0xd2, 0x24, 0x3b, 0xb0, 0x9e, 0x07, 0xb3, 0x4b, 0x6c, 0x96, 0x14, 0xa6, 0x9d, 0xf6, - 0xbb, 0x50, 0x39, 0xc5, 0x8c, 0x27, 0x2c, 0x95, 0x01, 0x17, 0xc1, 0x63, 0x96, 0xa9, 0xa4, 0x06, - 0xd5, 0x8e, 0x42, 0x93, 0x94, 0x65, 0x2a, 0x4d, 0xa2, 0xd2, 0x69, 0xfb, 0xd0, 0x18, 0xb3, 0x27, - 0x98, 0x1e, 0x25, 0x53, 0x14, 0xc9, 0x05, 0xca, 0x7a, 0x78, 0x35, 0x57, 0xa9, 0x36, 0x95, 0xa6, - 0x44, 0xd2, 0x70, 0xaa, 0xd2, 0x6c, 0x2a, 0x4d, 0x89, 0x24, 0x81, 0x68, 0x96, 0x35, 0x92, 0x04, - 0xa2, 0xfd, 0x93, 0x0d, 0xf5, 0x11, 0x72, 0x59, 0x5e, 0xd1, 0x91, 0xf7, 0xc0, 0x0e, 0x59, 0xac, - 0xef, 0x5d, 0xf3, 0x5e, 0x77, 0x9f, 0x9b, 0x92, 0x5b, 0x0c, 0x77, 0x7b, 0x2c, 0x5e, 0x50, 0x95, - 0x41, 0xde, 0x87, 0x2a, 0x4f, 0xce, 0xd2, 0x40, 0x5c, 0x66, 0xba, 0xc5, 0x9a, 0xf7, 0xea, 0xaa, - 0xf4, 0x65, 0x0c, 0x7d, 0x16, 0xbe, 0xfb, 0x63, 0x19, 0x6c, 0x49, 0x45, 0xb6, 0xa0, 0x94, 0xc4, - 0xaa, 0x78, 0x9d, 0x96, 0x92, 0x98, 0x78, 0xb0, 0xc9, 0xbe, 0x4c, 0x31, 0x9b, 0x24, 0xb1, 0xe1, - 0xbc, 0x55, 0xe0, 0x94, 0x0f, 0xe3, 0x3e, 0x94, 0xe7, 0xc3, 0x3e, 0xad, 0xa8, 0xc0, 0x61, 0x4c, - 0xee, 0x81, 0x9d, 0x63, 0x16, 0xaa, 0x36, 0xb7, 0xbc, 0xb7, 0xfe, 0x4e, 0x0b, 0xee, 0x29, 0x66, - 0x21, 0x55, 0x69, 0xe4, 0x2e, 0x6c, 0xce, 0xcc, 0x50, 0x9b, 0xb6, 0x2a, 0xb9, 0xb7, 0x82, 0xe2, - 0xc6, 0xf0, 0xe9, 0xd3, 0x0c, 0x72, 0x1b, 0x6a, 0x5c, 0xb3, 0x4f, 0xe4, 0xf3, 0xaf, 0xab, 0x4e, - 0xc0, 0x40, 0x1f, 0xe3, 0x82, 0x7c, 0x08, 0x5b, 0x2c, 0x7c, 0x8c, 0x91, 0x98, 0x04, 0x71, 0x9c, - 0x21, 0xe7, 0xcd, 0x8d, 0xd5, 0x7d, 0x75, 0xf5, 0xf1, 0x60, 0x8d, 0x36, 0x74, 0x82, 0x01, 0xda, - 0x5f, 0x5b, 0x60, 0xcb, 0xfb, 0x92, 0x1d, 0x70, 0x4e, 0x7d, 0xda, 0x9b, 0x3c, 0x3a, 0x1e, 0x9d, - 0xf8, 0x87, 0xc3, 0xfb, 0x43, 0xbf, 0xef, 0xac, 0x91, 0x2d, 0x80, 0x87, 0xbd, 0x8f, 0xfc, 0xc3, - 0xf1, 0xe4, 0xe4, 0xd1, 0xd8, 0xb1, 0x0a, 0xfe, 0x03, 0x7f, 0xec, 0x94, 0xc8, 0x4b, 0x50, 0x33, - 0xfe, 0xc0, 0xef, 0xf6, 0x9d, 0x32, 0xd9, 0x86, 0x86, 0x01, 0x46, 0x7e, 0x97, 0x1e, 0x0e, 0x1c, - 0xbb, 0x00, 0xf5, 0xfd, 0x23, 0x7f, 0xec, 0x3b, 0xeb, 0xc4, 0x81, 0xba, 0x81, 0x68, 0xf7, 0xf8, - 0x81, 0xef, 0x6c, 0xc8, 0xf2, 0x45, 0x64, 0xd0, 0x1d, 0x0d, 0x9c, 0x4a, 0xaf, 0x0a, 0x95, 0x88, - 0xa5, 0x02, 0xaf, 0x44, 0xfb, 0xbb, 0x12, 0xd4, 0x7a, 0x18, 0x64, 0x98, 0x69, 0x6d, 0x1d, 0xdc, - 0xd0, 0xd6, 0x6b, 0x2b, 0xa6, 0x5a, 0x88, 0xfe, 0xaf, 0xa4, 0xf5, 0xad, 0x65, 0xa4, 0x75, 0x00, - 0x80, 0x41, 0x34, 0x9b, 0x88, 0x20, 0x9c, 0xa1, 0xb9, 0x43, 0xb3, 0xc0, 0x12, 0x44, 0x33, 0xd7, - 0xef, 0x1e, 0x1e, 0x8d, 0xe5, 0x39, 0xad, 0xca, 0x58, 0x65, 0xfe, 0x2b, 0x0d, 0x16, 0x45, 0x54, - 0xfe, 0xa7, 0x22, 0x6a, 0xff, 0x56, 0x82, 0x6d, 0x8a, 0x5f, 0x5c, 0x22, 0x17, 0x9f, 0xa0, 0x08, - 0xcc, 0x46, 0xb9, 0x03, 0x95, 0x5c, 0x6f, 0x0a, 0x73, 0xfb, 0xdd, 0x15, 0x94, 0x66, 0x97, 0xd0, - 0x65, 0xa8, 0x5c, 0x1f, 0x38, 0x67, 0xd1, 0xb9, 0xd9, 0x03, 0xda, 0x91, 0x9b, 0x40, 0x88, 0x99, - 0xba, 0x5a, 0x83, 0x4a, 0x93, 0x1c, 0x40, 0xf5, 0x6a, 0x72, 0xae, 0x2a, 0xf1, 0xa6, 0xbd, 0x57, - 0x7e, 0x01, 0xbf, 0x59, 0x6f, 0x74, 0xf3, 0x4a, 0x1b, 0x9c, 0xf4, 0xa1, 0xb1, 0x54, 0xbc, 0x90, - 0xfd, 0x28, 0xcd, 0xd7, 0xbc, 0xdb, 0x7f, 0xf1, 0xbf, 0xa3, 0x75, 0x5e, 0xdc, 0x3b, 0x5d, 0xa8, - 0x87, 0xea, 0xf1, 0x0d, 0x89, 0xfe, 0x53, 0xb4, 0xfe, 0x5c, 0x23, 0xb4, 0x16, 0x16, 0xe4, 0x75, - 0x17, 0x36, 0x58, 0x96, 0x9c, 0x25, 0x69, 0xb3, 0xf2, 0xc2, 0xe5, 0xf5, 0xdc, 0x54, 0xa9, 0xc9, - 0x69, 0xff, 0x6a, 0x01, 0xa1, 0xc8, 0xe7, 0x2c, 0xe5, 0xf8, 0xff, 0x1f, 0xfa, 0xbd, 0xa7, 0xbd, - 0xea, 0x69, 0xbf, 0xb1, 0xb2, 0xd7, 0x3f, 0x76, 0xb3, 0x6c, 0xb6, 0xf7, 0xf9, 0xf7, 0xd7, 0x2d, - 0xeb, 0x87, 0xeb, 0x96, 0xf5, 0xf3, 0x75, 0xcb, 0xfa, 0xea, 0x97, 0xd6, 0xda, 0x67, 0x77, 0xce, - 0x12, 0x71, 0x7e, 0x19, 0xba, 0x11, 0xbb, 0xe8, 0xa4, 0x7c, 0x1e, 0x45, 0xfb, 0x31, 0xe6, 0x9d, - 0x14, 0xd9, 0x94, 0xef, 0x07, 0xf3, 0x64, 0xff, 0x8c, 0x75, 0x9e, 0x7d, 0xf4, 0x3e, 0x30, 0xbf, - 0xdf, 0x94, 0x76, 0x8e, 0x91, 0xdd, 0x1f, 0xb9, 0xdd, 0x93, 0xa1, 0xac, 0x3c, 0xd2, 0x70, 0xb8, - 0xa1, 0xbe, 0x86, 0xef, 0xfc, 0x1e, 0x00, 0x00, 0xff, 0xff, 0xf6, 0xba, 0x8b, 0x7f, 0x7b, 0x07, - 0x00, 0x00, + 0x06, 0xa8, 0x7f, 0xbc, 0xcc, 0x26, 0x5e, 0xfe, 0xc4, 0x81, 0x5b, 0xd5, 0xd7, 0x5f, 0x55, 0x75, + 0x55, 0x7f, 0x53, 0x03, 0xcd, 0xdc, 0xed, 0x70, 0x4c, 0xf3, 0x38, 0xc4, 0xce, 0x2c, 0x5d, 0x84, + 0x9d, 0x0b, 0xcc, 0x7c, 0x67, 0x91, 0xb2, 0x8c, 0x91, 0xdd, 0x04, 0x99, 0x33, 0xe5, 0x4e, 0xee, + 0x3a, 0x9a, 0xd2, 0xbc, 0x93, 0xbb, 0x1d, 0x3f, 0x9c, 0x2b, 0x6a, 0xb6, 0x5c, 0x20, 0x57, 0xdc, + 0xa6, 0x9d, 0xbb, 0x9d, 0x14, 0xa7, 0xfc, 0xf6, 0xc9, 0xdd, 0x9b, 0x15, 0x72, 0x4c, 0xe3, 0xe9, + 0x52, 0x9d, 0xb6, 0xdf, 0x82, 0xca, 0x67, 0x03, 0xf4, 0x23, 0x4c, 0x89, 0x05, 0xe5, 0x67, 0xb8, + 0xb4, 0x8d, 0x7d, 0xe3, 0x8d, 0x2a, 0x15, 0x26, 0xd9, 0x83, 0xcd, 0xdc, 0x9f, 0x5f, 0xa2, 0x5d, + 0x92, 0x98, 0x72, 0xda, 0xef, 0x42, 0xe5, 0x0c, 0x53, 0x1e, 0xb3, 0x44, 0x10, 0x2e, 0xfc, 0xa7, + 0x2c, 0x95, 0x41, 0x0d, 0xaa, 0x1c, 0x89, 0xc6, 0x09, 0x4b, 0x65, 0x98, 0x40, 0x85, 0xd3, 0xf6, + 0xa0, 0x31, 0x66, 0xcf, 0x30, 0x39, 0x8e, 0xa7, 0x98, 0xc5, 0x17, 0x28, 0xea, 0xe1, 0xd5, 0x42, + 0x86, 0x9a, 0x54, 0x98, 0x02, 0x49, 0x82, 0xa9, 0x0c, 0x33, 0xa9, 0x30, 0x05, 0x12, 0xfb, 0x99, + 0x5d, 0x56, 0x48, 0xec, 0x67, 0xed, 0x9f, 0x4c, 0xa8, 0x8f, 0x90, 0x8b, 0xf2, 0x32, 0x1d, 0x79, + 0x0f, 0xcc, 0x80, 0x45, 0xea, 0xde, 0x35, 0xf7, 0x35, 0xe7, 0xd6, 0xd0, 0x9c, 0x22, 0xdd, 0xe9, + 0xb1, 0x68, 0x49, 0x65, 0x04, 0xf9, 0x00, 0xaa, 0x3c, 0x9e, 0x25, 0x7e, 0x76, 0x99, 0xaa, 0x16, + 0x6b, 0xee, 0xdd, 0x75, 0xe1, 0x2b, 0x0e, 0xfd, 0x83, 0xde, 0xfc, 0xb1, 0x0c, 0xa6, 0x48, 0x45, + 0x76, 0xa0, 0x14, 0x47, 0xb2, 0x78, 0x9d, 0x96, 0xe2, 0x88, 0xb8, 0xb0, 0xcd, 0xbe, 0x4c, 0x30, + 0x9d, 0xc4, 0x91, 0xce, 0x79, 0xa7, 0x90, 0x53, 0x3c, 0x91, 0xf3, 0x58, 0x9c, 0x0f, 0xfb, 0xb4, + 0x22, 0x89, 0xc3, 0x88, 0x3c, 0x00, 0x33, 0xc7, 0x34, 0x90, 0x6d, 0xee, 0xb8, 0x6f, 0xfe, 0x9d, + 0x16, 0x9c, 0x33, 0x4c, 0x03, 0x2a, 0xc3, 0xc8, 0x7d, 0xd8, 0x9e, 0xeb, 0xa1, 0xda, 0xa6, 0x2c, + 0xb9, 0xbf, 0x26, 0xc5, 0x0b, 0xc3, 0xa7, 0xcf, 0x23, 0xc8, 0x3d, 0xa8, 0x71, 0x95, 0x7d, 0x22, + 0x9e, 0x7f, 0x53, 0x76, 0x02, 0x1a, 0xfa, 0x04, 0x97, 0xe4, 0x23, 0xd8, 0x61, 0xc1, 0x53, 0x0c, + 0xb3, 0x89, 0x1f, 0x45, 0x29, 0x72, 0x6e, 0x6f, 0xad, 0xef, 0xab, 0xab, 0x8e, 0x07, 0x1b, 0xb4, + 0xa1, 0x02, 0x34, 0xd0, 0xfe, 0xda, 0x00, 0x53, 0xdc, 0x97, 0xec, 0x81, 0x75, 0xe6, 0xd1, 0xde, + 0xe4, 0xc9, 0xc9, 0xe8, 0xd4, 0x3b, 0x1a, 0x3e, 0x1c, 0x7a, 0x7d, 0x6b, 0x83, 0xec, 0x00, 0x3c, + 0xee, 0x7d, 0xec, 0x1d, 0x8d, 0x27, 0xa7, 0x4f, 0xc6, 0x96, 0x51, 0xf0, 0x1f, 0x79, 0x63, 0xab, + 0x44, 0x5e, 0x81, 0x9a, 0xf6, 0x07, 0x5e, 0xb7, 0x6f, 0x95, 0xc9, 0x2e, 0x34, 0x34, 0x30, 0xf2, + 0xba, 0xf4, 0x68, 0x60, 0x99, 0x05, 0xa8, 0xef, 0x1d, 0x7b, 0x63, 0xcf, 0xda, 0x24, 0x16, 0xd4, + 0x35, 0x44, 0xbb, 0x27, 0x8f, 0x3c, 0x6b, 0x4b, 0x94, 0x2f, 0x22, 0x83, 0xee, 0x68, 0x60, 0x55, + 0x7a, 0x55, 0xa8, 0x84, 0x2c, 0xc9, 0xf0, 0x2a, 0x6b, 0x7f, 0x57, 0x82, 0x5a, 0x0f, 0xfd, 0x14, + 0x53, 0xa5, 0xad, 0xc3, 0x17, 0xb4, 0xf5, 0xea, 0x9a, 0xa9, 0x16, 0xd8, 0xff, 0x95, 0xb4, 0xbe, + 0x35, 0xb4, 0xb4, 0x0e, 0x01, 0xd0, 0x0f, 0xe7, 0x93, 0xcc, 0x0f, 0xe6, 0xa8, 0xef, 0x60, 0x17, + 0xb2, 0xf8, 0xe1, 0xdc, 0xf1, 0xba, 0x47, 0xc7, 0x63, 0x71, 0x4e, 0xab, 0x82, 0x2b, 0xcd, 0x7f, + 0xa5, 0xc1, 0xa2, 0x88, 0xca, 0xff, 0x54, 0x44, 0xed, 0xdf, 0x4a, 0xb0, 0x4b, 0xf1, 0x8b, 0x4b, + 0xe4, 0xd9, 0xa7, 0x98, 0xf9, 0x7a, 0xa3, 0xbc, 0x03, 0x95, 0x5c, 0x6d, 0x0a, 0x7d, 0xfb, 0xe6, + 0x9a, 0x94, 0x7a, 0x97, 0xd0, 0x15, 0x55, 0xac, 0x0f, 0x5c, 0xb0, 0xf0, 0x5c, 0xef, 0x01, 0xe5, + 0x88, 0x4d, 0x90, 0x65, 0x73, 0x79, 0xb5, 0x06, 0x15, 0x26, 0x39, 0x84, 0xea, 0xd5, 0xe4, 0x5c, + 0x56, 0xe2, 0xb6, 0xb9, 0x5f, 0x7e, 0x49, 0x7e, 0xbd, 0xde, 0xe8, 0xf6, 0x95, 0x32, 0x38, 0xe9, + 0x43, 0x63, 0xa5, 0xf8, 0x4c, 0xf4, 0x23, 0x35, 0x5f, 0x73, 0xef, 0xfd, 0xc5, 0x77, 0x47, 0xeb, + 0xbc, 0xb8, 0x77, 0xba, 0x50, 0x0f, 0xe4, 0xe3, 0xeb, 0x24, 0xea, 0xa3, 0x68, 0xfd, 0xb9, 0x46, + 0x68, 0x2d, 0x28, 0xc8, 0xeb, 0x3e, 0x6c, 0xb1, 0x34, 0x9e, 0xc5, 0x89, 0x5d, 0x79, 0xe9, 0xf2, + 0xba, 0x35, 0x55, 0xaa, 0x63, 0xda, 0xbf, 0x1a, 0x40, 0x28, 0xf2, 0x05, 0x4b, 0x38, 0xfe, 0xff, + 0x87, 0xfe, 0xe0, 0x79, 0xaf, 0x6a, 0xda, 0xaf, 0xaf, 0xed, 0xf5, 0x66, 0x37, 0xab, 0x66, 0x7b, + 0xc1, 0xf7, 0xd7, 0x2d, 0xe3, 0x87, 0xeb, 0x96, 0xf1, 0xf3, 0x75, 0xcb, 0xf8, 0xea, 0x97, 0xd6, + 0xc6, 0xe7, 0xef, 0xcf, 0xe2, 0xec, 0xfc, 0x32, 0x70, 0x42, 0x76, 0xd1, 0x49, 0xf8, 0x22, 0x0c, + 0x0f, 0x22, 0xcc, 0x3b, 0x09, 0xb2, 0x29, 0x3f, 0xf0, 0x17, 0xf1, 0xc1, 0x8c, 0x75, 0x6e, 0xfc, + 0xf9, 0x3e, 0xd4, 0xce, 0x37, 0xa5, 0xbd, 0x13, 0x64, 0x0f, 0x47, 0x4e, 0xf7, 0x74, 0x28, 0xca, + 0x8f, 0x14, 0x1c, 0x6c, 0xc9, 0x5f, 0xe2, 0xdb, 0xbf, 0x07, 0x00, 0x00, 0xff, 0xff, 0xb8, 0xaf, + 0x1e, 0xa2, 0x94, 0x07, 0x00, 0x00, } func (m *XHeader) Marshal() (dAtA []byte, err error) { @@ -2182,7 +2182,7 @@ func (m *SessionToken_Body) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.OwnerId == nil { - m.OwnerId = &refs.OwnerID{} + m.OwnerId = &grpc.OwnerID{} } if err := m.OwnerId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -2306,7 +2306,7 @@ func (m *SessionToken_Body) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &refs.Address{} + v := &grpc.Address{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -2522,7 +2522,7 @@ func (m *BearerToken_Body) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.EaclTable == nil { - m.EaclTable = &acl.EACLTable{} + m.EaclTable = &grpc1.EACLTable{} } if err := m.EaclTable.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -2558,7 +2558,7 @@ func (m *BearerToken_Body) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.OwnerId == nil { - m.OwnerId = &refs.OwnerID{} + m.OwnerId = &grpc.OwnerID{} } if err := m.OwnerId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err diff --git a/v2/service/verify.go b/v2/service/grpc/verify.go similarity index 100% rename from v2/service/verify.go rename to v2/service/grpc/verify.go diff --git a/v2/service/verify.pb.go b/v2/service/grpc/verify.pb.go similarity index 91% rename from v2/service/verify.pb.go rename to v2/service/grpc/verify.pb.go index 39a512b..3f270b6 100644 --- a/v2/service/verify.pb.go +++ b/v2/service/grpc/verify.pb.go @@ -1,13 +1,13 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: v2/service/verify.proto +// source: v2/service/grpc/verify.proto package service import ( fmt "fmt" proto "github.com/golang/protobuf/proto" - _ "github.com/nspcc-dev/neofs-api-go/v2/acl" - _ "github.com/nspcc-dev/neofs-api-go/v2/refs" + _ "github.com/nspcc-dev/neofs-api-go/v2/acl/grpc" + _ "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" io "io" math "math" math_bits "math/bits" @@ -39,7 +39,7 @@ func (m *Signature) Reset() { *m = Signature{} } func (m *Signature) String() string { return proto.CompactTextString(m) } func (*Signature) ProtoMessage() {} func (*Signature) Descriptor() ([]byte, []int) { - return fileDescriptor_848d62e0ecc8b6b6, []int{0} + return fileDescriptor_333853833d6163d3, []int{0} } func (m *Signature) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -101,7 +101,7 @@ func (m *RequestVerificationHeader) Reset() { *m = RequestVerificationHe func (m *RequestVerificationHeader) String() string { return proto.CompactTextString(m) } func (*RequestVerificationHeader) ProtoMessage() {} func (*RequestVerificationHeader) Descriptor() ([]byte, []int) { - return fileDescriptor_848d62e0ecc8b6b6, []int{1} + return fileDescriptor_333853833d6163d3, []int{1} } func (m *RequestVerificationHeader) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -177,7 +177,7 @@ func (m *ResponseVerificationHeader) Reset() { *m = ResponseVerification func (m *ResponseVerificationHeader) String() string { return proto.CompactTextString(m) } func (*ResponseVerificationHeader) ProtoMessage() {} func (*ResponseVerificationHeader) Descriptor() ([]byte, []int) { - return fileDescriptor_848d62e0ecc8b6b6, []int{2} + return fileDescriptor_333853833d6163d3, []int{2} } func (m *ResponseVerificationHeader) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -240,33 +240,33 @@ func init() { proto.RegisterType((*ResponseVerificationHeader)(nil), "neo.fs.v2.service.ResponseVerificationHeader") } -func init() { proto.RegisterFile("v2/service/verify.proto", fileDescriptor_848d62e0ecc8b6b6) } +func init() { proto.RegisterFile("v2/service/grpc/verify.proto", fileDescriptor_333853833d6163d3) } -var fileDescriptor_848d62e0ecc8b6b6 = []byte{ - // 353 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe4, 0x93, 0x4f, 0x4b, 0xc3, 0x30, - 0x18, 0xc6, 0x6d, 0x37, 0x06, 0x46, 0x9d, 0xb3, 0x0a, 0xce, 0x21, 0x45, 0x76, 0xf2, 0x60, 0x13, - 0xac, 0xde, 0x3c, 0xe9, 0xfc, 0x7b, 0x11, 0xe9, 0xc0, 0x83, 0x20, 0xd2, 0x75, 0x6f, 0x6b, 0xd0, - 0x25, 0x35, 0xc9, 0x02, 0xfd, 0x26, 0x7e, 0x06, 0xcf, 0xe2, 0x67, 0xf0, 0xe8, 0x47, 0x90, 0xf9, - 0x45, 0xa4, 0xed, 0x66, 0x87, 0x6e, 0xb0, 0xbb, 0xa7, 0xbc, 0x3c, 0xc9, 0xf3, 0xcb, 0xc3, 0x03, - 0x2f, 0x5a, 0xd7, 0x2e, 0x91, 0x20, 0x34, 0x0d, 0x80, 0x68, 0x10, 0x34, 0x4c, 0x70, 0x2c, 0xb8, - 0xe2, 0xd6, 0x0a, 0x03, 0x8e, 0x43, 0x89, 0xb5, 0x8b, 0x87, 0xf7, 0x0d, 0x4b, 0xbb, 0xc4, 0x0f, - 0x1e, 0x89, 0x4a, 0x62, 0x90, 0xf9, 0xb3, 0xc6, 0xaa, 0x76, 0x89, 0x80, 0x50, 0x8e, 0x8b, 0xcd, - 0x5d, 0x34, 0xdf, 0xa6, 0x11, 0xf3, 0x55, 0x5f, 0x80, 0x55, 0x43, 0xa5, 0x07, 0x48, 0xea, 0xc6, - 0x96, 0xb1, 0xbd, 0xe8, 0xa5, 0xa3, 0x65, 0xa1, 0xb2, 0xa4, 0x11, 0xab, 0x9b, 0x99, 0x94, 0xcd, - 0xcd, 0x57, 0x13, 0x6d, 0x78, 0xf0, 0xd4, 0x07, 0xa9, 0xae, 0xd3, 0x18, 0x34, 0xf0, 0x15, 0xe5, - 0xec, 0x1c, 0xfc, 0x2e, 0x08, 0xab, 0x85, 0xaa, 0x1d, 0xde, 0x4d, 0xee, 0xe4, 0x88, 0x9a, 0xe1, - 0x16, 0xdc, 0x4d, 0xfc, 0x27, 0x25, 0xfe, 0xf9, 0xd9, 0x5b, 0x4a, 0x3d, 0x45, 0x90, 0x16, 0xaa, - 0xf6, 0x40, 0xf9, 0x63, 0x10, 0x73, 0x16, 0x48, 0xea, 0x29, 0x20, 0x67, 0xa8, 0xc6, 0x05, 0x8d, - 0x28, 0x1b, 0xc3, 0x94, 0x66, 0xc0, 0x2c, 0xe7, 0xae, 0x02, 0x74, 0x8c, 0x2a, 0xb9, 0x54, 0x2f, - 0x67, 0xf6, 0x9d, 0x09, 0xf6, 0xa9, 0x85, 0x78, 0x43, 0x6f, 0xf3, 0xcd, 0x44, 0x0d, 0x0f, 0x64, - 0xcc, 0x99, 0x84, 0xff, 0xd1, 0xdb, 0xc9, 0xaf, 0xde, 0x9c, 0x89, 0xbd, 0x4d, 0x6b, 0x64, 0x54, - 0xdc, 0xd1, 0xed, 0xfb, 0xc0, 0x36, 0x3e, 0x06, 0xb6, 0xf1, 0x39, 0xb0, 0x8d, 0xe7, 0x2f, 0x7b, - 0xee, 0x66, 0x3f, 0xa2, 0xea, 0xbe, 0xdf, 0xc1, 0x01, 0xef, 0x11, 0x26, 0xe3, 0x20, 0x70, 0xba, - 0xa0, 0x09, 0x03, 0x1e, 0x4a, 0xc7, 0x8f, 0xa9, 0x13, 0x71, 0x52, 0xec, 0xca, 0xc1, 0xf0, 0x7c, - 0x31, 0xd7, 0x2e, 0x81, 0x9f, 0xb6, 0xf1, 0xe1, 0xd5, 0x45, 0x9a, 0xa0, 0x9d, 0xcb, 0x9d, 0x4a, - 0xb6, 0x08, 0x7b, 0xdf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x8d, 0x87, 0x6a, 0x4d, 0x5f, 0x03, 0x00, - 0x00, +var fileDescriptor_333853833d6163d3 = []byte{ + // 361 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe4, 0x93, 0xcf, 0x4a, 0xeb, 0x40, + 0x14, 0xc6, 0x6f, 0xd2, 0x52, 0xb8, 0x73, 0xef, 0xed, 0xad, 0x41, 0x30, 0x96, 0x12, 0xa4, 0x2b, + 0x17, 0x66, 0x06, 0xe3, 0x4a, 0x5c, 0x69, 0xfd, 0xbb, 0x11, 0x49, 0xc1, 0x85, 0x1b, 0x49, 0xd2, + 0x93, 0x38, 0x68, 0x67, 0xe2, 0xcc, 0x74, 0x20, 0x6f, 0xe2, 0x33, 0xb8, 0x16, 0x9f, 0xc1, 0xa5, + 0x8f, 0x20, 0xf5, 0x45, 0x24, 0x49, 0x6b, 0x4b, 0xff, 0x40, 0xf7, 0xee, 0x4e, 0x4e, 0xbe, 0xef, + 0x37, 0x1f, 0x1f, 0x1c, 0xd4, 0xd2, 0x1e, 0x91, 0x20, 0x34, 0x8d, 0x80, 0x24, 0x22, 0x8d, 0x88, + 0x06, 0x41, 0xe3, 0x0c, 0xa7, 0x82, 0x2b, 0x6e, 0xad, 0x31, 0xe0, 0x38, 0x96, 0x58, 0x7b, 0x78, + 0x24, 0x6a, 0x6e, 0x68, 0x8f, 0x04, 0xd1, 0x43, 0x29, 0x56, 0x59, 0x0a, 0xb2, 0xd4, 0x36, 0x6d, + 0xed, 0x11, 0x01, 0xb1, 0x9c, 0xfb, 0xd3, 0xde, 0x45, 0xbf, 0xbb, 0x34, 0x61, 0x81, 0x1a, 0x08, + 0xb0, 0x1a, 0xa8, 0x72, 0x0f, 0x99, 0x6d, 0x6c, 0x19, 0xdb, 0x7f, 0xfd, 0x7c, 0xb4, 0x2c, 0x54, + 0x95, 0x34, 0x61, 0xb6, 0x59, 0xac, 0x8a, 0xb9, 0xfd, 0x62, 0xa2, 0x4d, 0x1f, 0x1e, 0x07, 0x20, + 0xd5, 0x75, 0x1e, 0x88, 0x46, 0x81, 0xa2, 0x9c, 0x9d, 0x43, 0xd0, 0x03, 0x61, 0x75, 0x50, 0x3d, + 0xe4, 0xbd, 0xec, 0x56, 0x8e, 0xa9, 0x05, 0xee, 0x8f, 0xd7, 0xc2, 0x73, 0x79, 0xf1, 0xf7, 0xcb, + 0xfe, 0xbf, 0xdc, 0x33, 0x09, 0xd2, 0x41, 0xf5, 0x3e, 0xa8, 0x60, 0x0a, 0x62, 0xae, 0x02, 0xc9, + 0x3d, 0x13, 0xc8, 0x19, 0x6a, 0x70, 0x41, 0x13, 0xca, 0xa6, 0x30, 0x95, 0x15, 0x30, 0xff, 0x4b, + 0xd7, 0x04, 0x74, 0x8c, 0x6a, 0xe5, 0xca, 0xae, 0x16, 0xf6, 0x9d, 0x05, 0xf6, 0xa5, 0x85, 0xf8, + 0x23, 0x6f, 0xfb, 0xd5, 0x44, 0x4d, 0x1f, 0x64, 0xca, 0x99, 0x84, 0x9f, 0xd1, 0xdb, 0xc9, 0x4c, + 0x6f, 0xee, 0xc2, 0xde, 0x96, 0x35, 0x32, 0x2e, 0xee, 0x28, 0x7c, 0x1b, 0x3a, 0xc6, 0xfb, 0xd0, + 0x31, 0x3e, 0x86, 0x8e, 0xf1, 0xf4, 0xe9, 0xfc, 0xba, 0xd9, 0x4f, 0xa8, 0xba, 0x1b, 0x84, 0x38, + 0xe2, 0x7d, 0xc2, 0x64, 0x1a, 0x45, 0x6e, 0x0f, 0x34, 0x61, 0xc0, 0x63, 0xe9, 0x06, 0x29, 0x75, + 0x13, 0x4e, 0x66, 0x4e, 0xe7, 0x60, 0xf4, 0xf1, 0x6c, 0xae, 0x5f, 0x02, 0x3f, 0xed, 0xe2, 0xc3, + 0xab, 0x8b, 0x3c, 0x46, 0xb7, 0x5c, 0x87, 0xb5, 0xe2, 0x1a, 0xf6, 0xbe, 0x02, 0x00, 0x00, 0xff, + 0xff, 0x66, 0xc2, 0xc4, 0xb8, 0x73, 0x03, 0x00, 0x00, } func (m *Signature) Marshal() (dAtA []byte, err error) { diff --git a/v2/service/version.go b/v2/service/grpc/version.go similarity index 100% rename from v2/service/version.go rename to v2/service/grpc/version.go diff --git a/v2/service.go b/v2/service/service.go similarity index 91% rename from v2/service.go rename to v2/service/service.go index 55a3947..39557ee 100644 --- a/v2/service.go +++ b/v2/service/service.go @@ -1,4 +1,8 @@ -package v2 +package service + +import ( + service "github.com/nspcc-dev/neofs-api-go/v2/service/grpc" +) type Signature struct { key, sign []byte @@ -42,10 +46,6 @@ type RequestMetaHeader struct { origin *RequestMetaHeader } -type OwnerID struct { - val []byte -} - func (s *Signature) GetKey() []byte { if s != nil { return s.key @@ -316,16 +316,28 @@ func (r *RequestMetaHeader) StableSize() int { return RequestMetaHeaderToGRPCMessage(r).Size() } -func (o *OwnerID) GetValue() []byte { - if o != nil { - return o.val +func SignatureToGRPCMessage(s *Signature) *service.Signature { + if s == nil { + return nil } - return nil + m := new(service.Signature) + + m.SetKey(s.GetKey()) + m.SetSign(s.GetSign()) + + return m } -func (o *OwnerID) SetValue(v []byte) { - if o != nil { - o.val = v +func SignatureFromGRPCMessage(m *service.Signature) *Signature { + if m == nil { + return nil } + + s := new(Signature) + + s.SetKey(m.GetKey()) + s.SetSign(m.GetSign()) + + return s } diff --git a/v2/session/service.go b/v2/session/grpc/service.go similarity index 93% rename from v2/session/service.go rename to v2/session/grpc/service.go index 41a050d..8c78648 100644 --- a/v2/session/service.go +++ b/v2/session/grpc/service.go @@ -1,8 +1,8 @@ package session import ( - "github.com/nspcc-dev/neofs-api-go/v2/refs" - "github.com/nspcc-dev/neofs-api-go/v2/service" + refs "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" + service "github.com/nspcc-dev/neofs-api-go/v2/service/grpc" ) // SetOwnerId sets identifier of the session initiator. diff --git a/v2/session/service.pb.go b/v2/session/grpc/service.pb.go similarity index 83% rename from v2/session/service.pb.go rename to v2/session/grpc/service.pb.go index 13b8ad5..7dd61a3 100644 --- a/v2/session/service.pb.go +++ b/v2/session/grpc/service.pb.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: v2/session/service.proto +// source: v2/session/grpc/service.proto package session @@ -7,9 +7,9 @@ import ( context "context" fmt "fmt" proto "github.com/golang/protobuf/proto" - refs "github.com/nspcc-dev/neofs-api-go/v2/refs" - service "github.com/nspcc-dev/neofs-api-go/v2/service" - grpc "google.golang.org/grpc" + grpc1 "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" + grpc "github.com/nspcc-dev/neofs-api-go/v2/service/grpc" + grpc2 "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" io "io" @@ -34,20 +34,20 @@ type CreateRequest struct { Body *CreateRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` // Carries request meta information. Header data is used only to regulate message // transport and does not affect request execution. - MetaHeader *service.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" json:"meta_header,omitempty"` + MetaHeader *grpc.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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 *service.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + VerifyHeader *grpc.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *CreateRequest) Reset() { *m = CreateRequest{} } func (m *CreateRequest) String() string { return proto.CompactTextString(m) } func (*CreateRequest) ProtoMessage() {} func (*CreateRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_ab0074a16885b32c, []int{0} + return fileDescriptor_4ed1365cc8e16cd4, []int{0} } func (m *CreateRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -83,14 +83,14 @@ func (m *CreateRequest) GetBody() *CreateRequest_Body { return nil } -func (m *CreateRequest) GetMetaHeader() *service.RequestMetaHeader { +func (m *CreateRequest) GetMetaHeader() *grpc.RequestMetaHeader { if m != nil { return m.MetaHeader } return nil } -func (m *CreateRequest) GetVerifyHeader() *service.RequestVerificationHeader { +func (m *CreateRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { if m != nil { return m.VerifyHeader } @@ -100,19 +100,19 @@ func (m *CreateRequest) GetVerifyHeader() *service.RequestVerificationHeader { // Request body type CreateRequest_Body struct { // Carries an identifier of a session initiator. - OwnerId *refs.OwnerID `protobuf:"bytes,1,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"` + OwnerId *grpc1.OwnerID `protobuf:"bytes,1,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"` // Carries a lifetime of the session. - Lifetime *service.TokenLifetime `protobuf:"bytes,2,opt,name=lifetime,proto3" json:"lifetime,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Lifetime *grpc.TokenLifetime `protobuf:"bytes,2,opt,name=lifetime,proto3" json:"lifetime,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *CreateRequest_Body) Reset() { *m = CreateRequest_Body{} } func (m *CreateRequest_Body) String() string { return proto.CompactTextString(m) } func (*CreateRequest_Body) ProtoMessage() {} func (*CreateRequest_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_ab0074a16885b32c, []int{0, 0} + return fileDescriptor_4ed1365cc8e16cd4, []int{0, 0} } func (m *CreateRequest_Body) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -141,14 +141,14 @@ func (m *CreateRequest_Body) XXX_DiscardUnknown() { var xxx_messageInfo_CreateRequest_Body proto.InternalMessageInfo -func (m *CreateRequest_Body) GetOwnerId() *refs.OwnerID { +func (m *CreateRequest_Body) GetOwnerId() *grpc1.OwnerID { if m != nil { return m.OwnerId } return nil } -func (m *CreateRequest_Body) GetLifetime() *service.TokenLifetime { +func (m *CreateRequest_Body) GetLifetime() *grpc.TokenLifetime { if m != nil { return m.Lifetime } @@ -161,21 +161,21 @@ type CreateResponse struct { Body *CreateResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` // Carries response meta information. Header data is used only to regulate // message transport and does not affect request execution. - MetaHeader *service.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" json:"meta_header,omitempty"` + MetaHeader *grpc.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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 *service.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + VerifyHeader *grpc.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *CreateResponse) Reset() { *m = CreateResponse{} } func (m *CreateResponse) String() string { return proto.CompactTextString(m) } func (*CreateResponse) ProtoMessage() {} func (*CreateResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_ab0074a16885b32c, []int{1} + return fileDescriptor_4ed1365cc8e16cd4, []int{1} } func (m *CreateResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -211,14 +211,14 @@ func (m *CreateResponse) GetBody() *CreateResponse_Body { return nil } -func (m *CreateResponse) GetMetaHeader() *service.ResponseMetaHeader { +func (m *CreateResponse) GetMetaHeader() *grpc.ResponseMetaHeader { if m != nil { return m.MetaHeader } return nil } -func (m *CreateResponse) GetVerifyHeader() *service.ResponseVerificationHeader { +func (m *CreateResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { if m != nil { return m.VerifyHeader } @@ -240,7 +240,7 @@ func (m *CreateResponse_Body) Reset() { *m = CreateResponse_Body{} } func (m *CreateResponse_Body) String() string { return proto.CompactTextString(m) } func (*CreateResponse_Body) ProtoMessage() {} func (*CreateResponse_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_ab0074a16885b32c, []int{1, 0} + return fileDescriptor_4ed1365cc8e16cd4, []int{1, 0} } func (m *CreateResponse_Body) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -290,66 +290,67 @@ func init() { proto.RegisterType((*CreateResponse_Body)(nil), "neo.fs.v2.session.CreateResponse.Body") } -func init() { proto.RegisterFile("v2/session/service.proto", fileDescriptor_ab0074a16885b32c) } +func init() { proto.RegisterFile("v2/session/grpc/service.proto", fileDescriptor_4ed1365cc8e16cd4) } -var fileDescriptor_ab0074a16885b32c = []byte{ - // 463 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x93, 0xdf, 0x6e, 0xd3, 0x30, - 0x14, 0xc6, 0x49, 0x98, 0xc6, 0xe4, 0x76, 0x95, 0x30, 0xa0, 0x55, 0xbd, 0x28, 0x65, 0x62, 0x88, - 0x0b, 0x62, 0x4b, 0x01, 0x09, 0xf1, 0xe7, 0x86, 0x01, 0x13, 0x15, 0x8c, 0x3f, 0x2e, 0xe2, 0x02, - 0x09, 0x45, 0x69, 0x72, 0xb2, 0x59, 0x23, 0x76, 0x88, 0xbd, 0x40, 0xde, 0x84, 0x5b, 0x6e, 0x79, - 0x12, 0x2e, 0x79, 0x02, 0x84, 0xca, 0x8b, 0xa0, 0xd8, 0xde, 0x68, 0x45, 0xd6, 0x5e, 0xb5, 0x3e, - 0xfe, 0xbe, 0xef, 0x9c, 0xf3, 0x53, 0x8c, 0xfa, 0x55, 0x48, 0x15, 0x28, 0xc5, 0xa5, 0xa0, 0x0a, - 0xca, 0x8a, 0x27, 0x40, 0x8a, 0x52, 0x6a, 0x89, 0x2f, 0x0a, 0x90, 0x24, 0x53, 0xa4, 0x0a, 0x89, - 0x13, 0x0c, 0x2e, 0x55, 0x21, 0x2d, 0x21, 0x53, 0x54, 0xd7, 0x05, 0x28, 0xab, 0x1b, 0x5c, 0x31, - 0x09, 0xc6, 0x49, 0x73, 0xd0, 0xb1, 0x2b, 0x6f, 0xcd, 0x95, 0x2b, 0x28, 0x79, 0x56, 0xdb, 0x8b, - 0xed, 0x5f, 0x3e, 0xda, 0x7c, 0x5c, 0x42, 0xac, 0x81, 0xc1, 0xa7, 0x63, 0x50, 0x1a, 0xdf, 0x43, - 0x6b, 0x53, 0x99, 0xd6, 0x7d, 0x6f, 0xe4, 0xdd, 0xec, 0x84, 0x3b, 0xe4, 0xbf, 0xc6, 0x64, 0x41, - 0x4f, 0x76, 0x65, 0x5a, 0x33, 0x63, 0xc1, 0x4f, 0x51, 0xa7, 0xe9, 0x19, 0x1d, 0x42, 0x9c, 0x42, - 0xd9, 0xf7, 0x4d, 0xc2, 0xf5, 0x85, 0x04, 0xbb, 0x93, 0xf3, 0xee, 0x83, 0x8e, 0x9f, 0x19, 0x2d, - 0x43, 0xf9, 0xe9, 0x7f, 0xfc, 0x06, 0x6d, 0xda, 0x19, 0x4f, 0x82, 0xce, 0x9b, 0xa0, 0x5b, 0x67, - 0x07, 0xbd, 0x6b, 0xe4, 0x3c, 0x89, 0x35, 0x97, 0xc2, 0x05, 0x76, 0x6d, 0x84, 0x3d, 0x0d, 0xbe, - 0xa0, 0xb5, 0x66, 0x4e, 0x1c, 0xa2, 0x0d, 0xf9, 0x59, 0x40, 0x19, 0xf1, 0xd4, 0x2d, 0xb8, 0x35, - 0x97, 0xda, 0xd0, 0x24, 0xaf, 0x9a, 0xfb, 0xf1, 0x13, 0x76, 0xc1, 0x08, 0xc7, 0x29, 0x7e, 0x88, - 0x36, 0x3e, 0xf2, 0x0c, 0x34, 0xcf, 0xc1, 0xad, 0x34, 0x6a, 0x99, 0xe4, 0xad, 0x3c, 0x02, 0xf1, - 0xc2, 0xe9, 0xd8, 0xa9, 0x63, 0xfb, 0x9b, 0x8f, 0x7a, 0x27, 0xc0, 0x54, 0x21, 0x85, 0x02, 0x7c, - 0x7f, 0x81, 0xf0, 0x8d, 0x25, 0x84, 0xad, 0x61, 0x1e, 0xf1, 0x5e, 0x1b, 0xe2, 0x9d, 0x56, 0x32, - 0xd6, 0x7c, 0x06, 0x63, 0xd6, 0xce, 0x38, 0x58, 0x92, 0xb4, 0x12, 0xf2, 0x5d, 0x07, 0xb9, 0x87, - 0x7c, 0x87, 0xb7, 0xcb, 0x7c, 0x9e, 0xe2, 0xab, 0xa8, 0xe3, 0x16, 0x8b, 0x8e, 0xa0, 0x36, 0x33, - 0x77, 0x19, 0x72, 0xa5, 0xe7, 0x50, 0x87, 0x11, 0xea, 0x4d, 0xec, 0x69, 0x62, 0x7b, 0xe2, 0x7d, - 0xb4, 0x6e, 0x19, 0xe0, 0xd1, 0xaa, 0x0f, 0x70, 0x70, 0x6d, 0x25, 0xc0, 0xdd, 0x0f, 0x3f, 0x66, - 0x43, 0xef, 0xe7, 0x6c, 0xe8, 0xfd, 0x9e, 0x0d, 0xbd, 0xaf, 0x7f, 0x86, 0xe7, 0xde, 0xdf, 0x39, - 0xe0, 0xfa, 0xf0, 0x78, 0x4a, 0x12, 0x99, 0x53, 0xa1, 0x8a, 0x24, 0x09, 0x52, 0xa8, 0xa8, 0x00, - 0x99, 0xa9, 0x20, 0x2e, 0x78, 0x70, 0x20, 0xe9, 0xbf, 0xb7, 0xf8, 0xc0, 0xfd, 0x7e, 0xf7, 0x2f, - 0xbf, 0x04, 0xb9, 0x37, 0x21, 0x8f, 0x5e, 0x8f, 0x9b, 0x6e, 0x6e, 0xe8, 0xe9, 0xba, 0x79, 0x4b, - 0xb7, 0xff, 0x06, 0x00, 0x00, 0xff, 0xff, 0x38, 0xb7, 0xac, 0xe1, 0xbf, 0x03, 0x00, 0x00, +var fileDescriptor_4ed1365cc8e16cd4 = []byte{ + // 466 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x93, 0x4f, 0x6f, 0xd3, 0x30, + 0x18, 0xc6, 0x49, 0x98, 0xc6, 0xe4, 0x76, 0x95, 0xb0, 0x90, 0xa8, 0x22, 0x28, 0x65, 0x62, 0x88, + 0x03, 0x75, 0xa4, 0x70, 0x40, 0x03, 0x2e, 0x0c, 0x98, 0xa8, 0x60, 0xfc, 0x71, 0x11, 0x07, 0x2e, + 0x55, 0xfe, 0xbc, 0xe9, 0xac, 0x11, 0x3b, 0xd8, 0x5e, 0x20, 0xdf, 0x84, 0x2b, 0x57, 0x3e, 0x09, + 0x47, 0x3e, 0x01, 0x42, 0xe5, 0x8b, 0xa0, 0xd8, 0xde, 0xb4, 0x6e, 0x59, 0x7b, 0xab, 0xfb, 0x3e, + 0xcf, 0xe3, 0xe7, 0xfd, 0x29, 0x46, 0x37, 0xab, 0x28, 0x54, 0xa0, 0x14, 0x13, 0x3c, 0x9c, 0xc9, + 0x32, 0x0d, 0x15, 0xc8, 0x8a, 0xa5, 0x40, 0x4a, 0x29, 0xb4, 0xc0, 0x57, 0x39, 0x08, 0x92, 0x2b, + 0x52, 0x45, 0xc4, 0xa9, 0x82, 0x7e, 0x15, 0x85, 0x12, 0x72, 0x65, 0xe5, 0xba, 0x2e, 0x41, 0x59, + 0x71, 0x10, 0x98, 0x2c, 0x63, 0xb7, 0xc3, 0x02, 0x74, 0xec, 0x66, 0x37, 0xce, 0xce, 0x2a, 0x90, + 0x2c, 0xaf, 0xed, 0x74, 0xeb, 0x8f, 0x8f, 0x36, 0x9f, 0x49, 0x88, 0x35, 0x50, 0xf8, 0x72, 0x04, + 0x4a, 0xe3, 0x1d, 0xb4, 0x96, 0x88, 0xac, 0xee, 0x7b, 0x43, 0xef, 0x5e, 0x27, 0xda, 0x26, 0xe7, + 0x7a, 0x90, 0x05, 0x3d, 0xd9, 0x15, 0x59, 0x4d, 0x8d, 0x05, 0xbf, 0x40, 0x9d, 0xe6, 0xe2, 0xe9, + 0x01, 0xc4, 0x19, 0xc8, 0xbe, 0x6f, 0x12, 0xee, 0x2c, 0x24, 0xd8, 0x15, 0x9d, 0x77, 0x1f, 0x74, + 0xfc, 0xd2, 0x68, 0x29, 0x2a, 0x4e, 0x7e, 0xe3, 0xf7, 0x68, 0xd3, 0x76, 0x3c, 0x0e, 0xba, 0x6c, + 0x82, 0xee, 0x5f, 0x1c, 0xf4, 0xb1, 0x91, 0xb3, 0x34, 0xd6, 0x4c, 0x70, 0x17, 0xd8, 0xb5, 0x11, + 0xf6, 0x14, 0x7c, 0x43, 0x6b, 0x4d, 0x4f, 0x1c, 0xa1, 0x0d, 0xf1, 0x95, 0x83, 0x9c, 0xb2, 0xcc, + 0x2d, 0x78, 0xfd, 0x54, 0x6a, 0x03, 0x97, 0xbc, 0x6d, 0xe6, 0xe3, 0xe7, 0xf4, 0x8a, 0x11, 0x8e, + 0x33, 0xfc, 0x04, 0x6d, 0x7c, 0x66, 0x39, 0x68, 0x56, 0x80, 0x5b, 0x69, 0xd8, 0xd2, 0xe4, 0x83, + 0x38, 0x04, 0xfe, 0xda, 0xe9, 0xe8, 0x89, 0x63, 0xeb, 0x87, 0x8f, 0x7a, 0xc7, 0xc0, 0x54, 0x29, + 0xb8, 0x02, 0xfc, 0x68, 0x81, 0xf0, 0xdd, 0x25, 0x84, 0xad, 0xe1, 0x34, 0xe2, 0xbd, 0x36, 0xc4, + 0xdb, 0xad, 0x64, 0xac, 0xf9, 0x02, 0xc6, 0xb4, 0x9d, 0xf1, 0x68, 0x49, 0xd2, 0x4a, 0xc8, 0x0f, + 0x1d, 0xe4, 0x1e, 0xf2, 0x1d, 0xde, 0x2e, 0xf5, 0x59, 0x86, 0x6f, 0xa1, 0x8e, 0x5b, 0x6c, 0x7a, + 0x08, 0xb5, 0xe9, 0xdc, 0xa5, 0xc8, 0xfd, 0xf5, 0x0a, 0xea, 0x68, 0x8a, 0x7a, 0x13, 0x7b, 0x9a, + 0xd8, 0x3b, 0xf1, 0x3e, 0x5a, 0xb7, 0x0c, 0xf0, 0x70, 0xd5, 0x07, 0x18, 0xdc, 0x5e, 0x09, 0x70, + 0x37, 0xf9, 0x35, 0x1f, 0x78, 0xbf, 0xe7, 0x03, 0xef, 0xef, 0x7c, 0xe0, 0x7d, 0xff, 0x37, 0xb8, + 0xf4, 0x69, 0x67, 0xc6, 0xf4, 0xc1, 0x51, 0x42, 0x52, 0x51, 0x84, 0x5c, 0x95, 0x69, 0x3a, 0xca, + 0xa0, 0x0a, 0x39, 0x88, 0x5c, 0x8d, 0xe2, 0x92, 0x8d, 0x66, 0x22, 0x3c, 0xf3, 0x3e, 0x1f, 0xbb, + 0xc3, 0x4f, 0xff, 0xda, 0x1b, 0x10, 0x7b, 0x13, 0xf2, 0xf4, 0xdd, 0xb8, 0xb9, 0xd2, 0x35, 0x4f, + 0xd6, 0xcd, 0x83, 0x7a, 0xf0, 0x3f, 0x00, 0x00, 0xff, 0xff, 0xc2, 0x58, 0x7b, 0xc5, 0xd8, 0x03, + 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. var _ context.Context -var _ grpc.ClientConn +var _ grpc2.ClientConn // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 +const _ = grpc2.SupportPackageIsVersion4 // SessionServiceClient is the client API for SessionService service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type SessionServiceClient interface { // Create opens new session between the client and the server. - Create(ctx context.Context, in *CreateRequest, opts ...grpc.CallOption) (*CreateResponse, error) + Create(ctx context.Context, in *CreateRequest, opts ...grpc2.CallOption) (*CreateResponse, error) } type sessionServiceClient struct { - cc *grpc.ClientConn + cc *grpc2.ClientConn } -func NewSessionServiceClient(cc *grpc.ClientConn) SessionServiceClient { +func NewSessionServiceClient(cc *grpc2.ClientConn) SessionServiceClient { return &sessionServiceClient{cc} } -func (c *sessionServiceClient) Create(ctx context.Context, in *CreateRequest, opts ...grpc.CallOption) (*CreateResponse, error) { +func (c *sessionServiceClient) Create(ctx context.Context, in *CreateRequest, opts ...grpc2.CallOption) (*CreateResponse, error) { out := new(CreateResponse) err := c.cc.Invoke(ctx, "/neo.fs.v2.session.SessionService/Create", in, out, opts...) if err != nil { @@ -372,11 +373,11 @@ func (*UnimplementedSessionServiceServer) Create(ctx context.Context, req *Creat return nil, status.Errorf(codes.Unimplemented, "method Create not implemented") } -func RegisterSessionServiceServer(s *grpc.Server, srv SessionServiceServer) { +func RegisterSessionServiceServer(s *grpc2.Server, srv SessionServiceServer) { s.RegisterService(&_SessionService_serviceDesc, srv) } -func _SessionService_Create_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _SessionService_Create_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc2.UnaryServerInterceptor) (interface{}, error) { in := new(CreateRequest) if err := dec(in); err != nil { return nil, err @@ -384,7 +385,7 @@ func _SessionService_Create_Handler(srv interface{}, ctx context.Context, dec fu if interceptor == nil { return srv.(SessionServiceServer).Create(ctx, in) } - info := &grpc.UnaryServerInfo{ + info := &grpc2.UnaryServerInfo{ Server: srv, FullMethod: "/neo.fs.v2.session.SessionService/Create", } @@ -394,17 +395,17 @@ func _SessionService_Create_Handler(srv interface{}, ctx context.Context, dec fu return interceptor(ctx, in, info, handler) } -var _SessionService_serviceDesc = grpc.ServiceDesc{ +var _SessionService_serviceDesc = grpc2.ServiceDesc{ ServiceName: "neo.fs.v2.session.SessionService", HandlerType: (*SessionServiceServer)(nil), - Methods: []grpc.MethodDesc{ + Methods: []grpc2.MethodDesc{ { MethodName: "Create", Handler: _SessionService_Create_Handler, }, }, - Streams: []grpc.StreamDesc{}, - Metadata: "v2/session/service.proto", + Streams: []grpc2.StreamDesc{}, + Metadata: "v2/session/grpc/service.proto", } func (m *CreateRequest) Marshal() (dAtA []byte, err error) { @@ -825,7 +826,7 @@ func (m *CreateRequest) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.MetaHeader == nil { - m.MetaHeader = &service.RequestMetaHeader{} + m.MetaHeader = &grpc.RequestMetaHeader{} } if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -861,7 +862,7 @@ func (m *CreateRequest) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.VerifyHeader == nil { - m.VerifyHeader = &service.RequestVerificationHeader{} + m.VerifyHeader = &grpc.RequestVerificationHeader{} } if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -951,7 +952,7 @@ func (m *CreateRequest_Body) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.OwnerId == nil { - m.OwnerId = &refs.OwnerID{} + m.OwnerId = &grpc1.OwnerID{} } if err := m.OwnerId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -987,7 +988,7 @@ func (m *CreateRequest_Body) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.Lifetime == nil { - m.Lifetime = &service.TokenLifetime{} + m.Lifetime = &grpc.TokenLifetime{} } if err := m.Lifetime.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -1113,7 +1114,7 @@ func (m *CreateResponse) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.MetaHeader == nil { - m.MetaHeader = &service.ResponseMetaHeader{} + m.MetaHeader = &grpc.ResponseMetaHeader{} } if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -1149,7 +1150,7 @@ func (m *CreateResponse) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.VerifyHeader == nil { - m.VerifyHeader = &service.ResponseVerificationHeader{} + m.VerifyHeader = &grpc.ResponseVerificationHeader{} } if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err diff --git a/v2/signature/sign.go b/v2/signature/sign.go index 79fef30..d2fd149 100644 --- a/v2/signature/sign.go +++ b/v2/signature/sign.go @@ -5,14 +5,15 @@ import ( "fmt" "github.com/nspcc-dev/neofs-api-go/util/signature" - v2 "github.com/nspcc-dev/neofs-api-go/v2" + "github.com/nspcc-dev/neofs-api-go/v2/accounting" + "github.com/nspcc-dev/neofs-api-go/v2/service" "github.com/pkg/errors" ) type SignedRequest interface { - GetRequestMetaHeader() *v2.RequestMetaHeader - GetRequestVerificationHeader() *v2.RequestVerificationHeader - SetRequestVerificationHeader(*v2.RequestVerificationHeader) + GetRequestMetaHeader() *service.RequestMetaHeader + GetRequestVerificationHeader() *service.RequestVerificationHeader + SetRequestVerificationHeader(*service.RequestVerificationHeader) } type stableMarshaler interface { @@ -32,14 +33,14 @@ func (s stableMarshalerWrapper) SignedDataSize() int { return s.sm.StableSize() } -func keySignatureHandler(s *v2.Signature) signature.KeySignatureHandler { +func keySignatureHandler(s *service.Signature) signature.KeySignatureHandler { return func(key []byte, sig []byte) { s.SetKey(key) s.SetSign(sig) } } -func keySignatureSource(s *v2.Signature) signature.KeySignatureSource { +func keySignatureSource(s *service.Signature) signature.KeySignatureSource { return func() ([]byte, []byte) { return s.GetKey(), s.GetSign() } @@ -47,7 +48,7 @@ func keySignatureSource(s *v2.Signature) signature.KeySignatureSource { func requestBody(req SignedRequest) stableMarshaler { switch v := req.(type) { - case *v2.BalanceRequest: + case *accounting.BalanceRequest: return v.GetBody() default: panic(fmt.Sprintf("unknown request %T", req)) @@ -60,7 +61,7 @@ func SignRequest(key *ecdsa.PrivateKey, req SignedRequest) error { } // create new level of matryoshka - verifyHdr := new(v2.RequestVerificationHeader) + verifyHdr := new(service.RequestVerificationHeader) // attach the previous matryoshka verifyHdr.SetOrigin(req.GetRequestVerificationHeader()) @@ -86,8 +87,8 @@ func SignRequest(key *ecdsa.PrivateKey, req SignedRequest) error { return nil } -func signRequestPart(key *ecdsa.PrivateKey, part stableMarshaler, sigWrite func(*v2.Signature)) error { - sig := new(v2.Signature) +func signRequestPart(key *ecdsa.PrivateKey, part stableMarshaler, sigWrite func(*service.Signature)) error { + sig := new(service.Signature) // sign part if err := signature.SignDataWithHandler( @@ -125,7 +126,7 @@ func VerifyRequest(req SignedRequest) error { return nil } -func verifyRequestPart(part stableMarshaler, sigRdr func() *v2.Signature) error { +func verifyRequestPart(part stableMarshaler, sigRdr func() *service.Signature) error { if err := signature.VerifyDataWithSource( &stableMarshalerWrapper{part}, keySignatureSource(sigRdr()), diff --git a/v2/storagegroup/types.go b/v2/storagegroup/grpc/types.go similarity index 93% rename from v2/storagegroup/types.go rename to v2/storagegroup/grpc/types.go index 5f4bd37..b1159c4 100644 --- a/v2/storagegroup/types.go +++ b/v2/storagegroup/grpc/types.go @@ -1,7 +1,7 @@ package storagegroup import ( - "github.com/nspcc-dev/neofs-api-go/v2/refs" + refs "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" ) // SetValidationDataSize sets the total size of the payloads of the storage group. diff --git a/v2/storagegroup/types.pb.go b/v2/storagegroup/grpc/types.pb.go similarity index 82% rename from v2/storagegroup/types.pb.go rename to v2/storagegroup/grpc/types.pb.go index 2622367..91dae60 100644 --- a/v2/storagegroup/types.pb.go +++ b/v2/storagegroup/grpc/types.pb.go @@ -1,12 +1,12 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: v2/storagegroup/types.proto +// source: v2/storagegroup/grpc/types.proto package storagegroup import ( fmt "fmt" proto "github.com/golang/protobuf/proto" - refs "github.com/nspcc-dev/neofs-api-go/v2/refs" + grpc "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" io "io" math "math" math_bits "math/bits" @@ -39,7 +39,7 @@ type StorageGroup struct { ExpirationEpoch uint64 `protobuf:"varint,3,opt,name=expiration_epoch,json=expirationEpoch,proto3" json:"expiration_epoch,omitempty"` // Members carries the list of identifiers of the object storage group members. // The list is strictly ordered. - Members []*refs.ObjectID `protobuf:"bytes,4,rep,name=members,proto3" json:"members,omitempty"` + Members []*grpc.ObjectID `protobuf:"bytes,4,rep,name=members,proto3" json:"members,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -49,7 +49,7 @@ func (m *StorageGroup) Reset() { *m = StorageGroup{} } func (m *StorageGroup) String() string { return proto.CompactTextString(m) } func (*StorageGroup) ProtoMessage() {} func (*StorageGroup) Descriptor() ([]byte, []int) { - return fileDescriptor_593772eae6c18cdf, []int{0} + return fileDescriptor_f1685cc94b670845, []int{0} } func (m *StorageGroup) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -99,7 +99,7 @@ func (m *StorageGroup) GetExpirationEpoch() uint64 { return 0 } -func (m *StorageGroup) GetMembers() []*refs.ObjectID { +func (m *StorageGroup) GetMembers() []*grpc.ObjectID { if m != nil { return m.Members } @@ -110,29 +110,29 @@ func init() { proto.RegisterType((*StorageGroup)(nil), "neo.fs.v2.storagegroup.StorageGroup") } -func init() { proto.RegisterFile("v2/storagegroup/types.proto", fileDescriptor_593772eae6c18cdf) } +func init() { proto.RegisterFile("v2/storagegroup/grpc/types.proto", fileDescriptor_f1685cc94b670845) } -var fileDescriptor_593772eae6c18cdf = []byte{ - // 297 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x5c, 0x90, 0xdf, 0x4a, 0xc3, 0x30, - 0x14, 0xc6, 0xcd, 0x36, 0x14, 0xe2, 0x70, 0x12, 0x45, 0xaa, 0x42, 0x19, 0xde, 0x38, 0x2f, 0x96, - 0x48, 0xbd, 0x14, 0x04, 0x65, 0xfe, 0xd9, 0x8d, 0xca, 0x7a, 0xe7, 0xcd, 0x48, 0xdb, 0xd3, 0x36, - 0xb2, 0x36, 0x21, 0xc9, 0x8a, 0xee, 0x49, 0x7c, 0x06, 0x9f, 0x64, 0x97, 0x3e, 0x82, 0xd4, 0x17, - 0x91, 0x6e, 0x48, 0x8b, 0x97, 0xf9, 0xf2, 0x3b, 0xe7, 0xf0, 0xfd, 0xf0, 0x71, 0xe1, 0x31, 0x63, - 0xa5, 0xe6, 0x09, 0x24, 0x5a, 0xce, 0x15, 0xb3, 0xef, 0x0a, 0x0c, 0x55, 0x5a, 0x5a, 0x49, 0x0e, - 0x72, 0x90, 0x34, 0x36, 0xb4, 0xf0, 0x68, 0x93, 0x39, 0xda, 0x2b, 0x3c, 0xa6, 0x21, 0x36, 0x4d, - 0xf8, 0x64, 0x89, 0x70, 0xd7, 0x5f, 0x53, 0xf7, 0x15, 0x45, 0xce, 0xf1, 0x7e, 0xc1, 0x67, 0x22, - 0xe2, 0x56, 0xc8, 0x7c, 0x1a, 0x71, 0xcb, 0xa7, 0x46, 0x2c, 0xc0, 0x41, 0x7d, 0x34, 0xe8, 0x4c, - 0x48, 0xfd, 0x37, 0xe2, 0x96, 0xfb, 0x62, 0x01, 0xe4, 0x14, 0xf7, 0x1a, 0x13, 0x29, 0x37, 0xa9, - 0xd3, 0xea, 0xa3, 0x41, 0x77, 0xb2, 0x53, 0xc7, 0x0f, 0xdc, 0xa4, 0xe4, 0x0c, 0xef, 0xc2, 0x9b, - 0x12, 0x7a, 0x0d, 0x82, 0x92, 0x61, 0xea, 0xb4, 0x57, 0x6b, 0x7b, 0x75, 0x7e, 0x5b, 0xc5, 0xc4, - 0xc3, 0x5b, 0x19, 0x64, 0x01, 0x68, 0xe3, 0x74, 0xfa, 0xed, 0xc1, 0xb6, 0xe7, 0xd0, 0xba, 0x55, - 0x55, 0x82, 0x3e, 0x05, 0xaf, 0x10, 0xda, 0xf1, 0x68, 0xf2, 0x07, 0xde, 0xcc, 0x96, 0xa5, 0x8b, - 0xbe, 0x4a, 0x17, 0x7d, 0x97, 0x2e, 0xfa, 0xf8, 0x71, 0x37, 0x5e, 0xae, 0x12, 0x61, 0xd3, 0x79, - 0x40, 0x43, 0x99, 0xb1, 0xdc, 0xa8, 0x30, 0x1c, 0x46, 0x50, 0xb0, 0x1c, 0x64, 0x6c, 0x86, 0x5c, - 0x89, 0x61, 0x22, 0xd9, 0x3f, 0x91, 0x97, 0xcd, 0xc7, 0x67, 0xeb, 0xf0, 0x11, 0xe4, 0x9d, 0x4f, - 0xaf, 0x9f, 0xc7, 0xd5, 0xdd, 0xa6, 0xa7, 0x60, 0x73, 0xe5, 0xef, 0xe2, 0x37, 0x00, 0x00, 0xff, - 0xff, 0xec, 0x24, 0x17, 0x69, 0x8b, 0x01, 0x00, 0x00, +var fileDescriptor_f1685cc94b670845 = []byte{ + // 301 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x90, 0xcd, 0x4a, 0x33, 0x31, + 0x18, 0x85, 0xbf, 0xb4, 0xe5, 0x13, 0x62, 0xb1, 0x12, 0x44, 0xa2, 0x8b, 0x61, 0x70, 0x63, 0x5d, + 0x34, 0x91, 0x71, 0xe9, 0x4a, 0xad, 0x3f, 0xdd, 0xa8, 0xb4, 0x3b, 0x37, 0x25, 0x93, 0xbe, 0x9d, + 0x89, 0xd8, 0x49, 0x4c, 0xd2, 0x41, 0x7b, 0x25, 0x5e, 0x83, 0x57, 0xd2, 0xa5, 0x97, 0x20, 0xe3, + 0x8d, 0xc8, 0xb4, 0xc8, 0x0c, 0xe8, 0xf6, 0xc9, 0x73, 0xf2, 0x72, 0x0e, 0x0e, 0xf3, 0x88, 0x3b, + 0xaf, 0xad, 0x48, 0x20, 0xb1, 0x7a, 0x6e, 0x78, 0x62, 0x8d, 0xe4, 0xfe, 0xd5, 0x80, 0x63, 0xc6, + 0x6a, 0xaf, 0xc9, 0x6e, 0x06, 0x9a, 0x4d, 0x1d, 0xcb, 0x23, 0x56, 0x17, 0xf7, 0x69, 0x1e, 0x71, + 0x0b, 0x53, 0xf7, 0x2b, 0x71, 0xb0, 0x44, 0xb8, 0x3d, 0x5a, 0xab, 0xd7, 0xa5, 0x4a, 0x8e, 0xf1, + 0x4e, 0x2e, 0x9e, 0xd4, 0x44, 0x78, 0xa5, 0xb3, 0xf1, 0x44, 0x78, 0x31, 0x76, 0x6a, 0x01, 0x14, + 0x85, 0xa8, 0xdb, 0x1a, 0x92, 0xea, 0xad, 0x2f, 0xbc, 0x18, 0xa9, 0x05, 0x90, 0x43, 0xdc, 0xa9, + 0x25, 0x52, 0xe1, 0x52, 0xda, 0x08, 0x51, 0xb7, 0x3d, 0xdc, 0xaa, 0xf0, 0x8d, 0x70, 0x29, 0x39, + 0xc2, 0xdb, 0xf0, 0x62, 0x94, 0x5d, 0x8b, 0x60, 0xb4, 0x4c, 0x69, 0x73, 0xf5, 0x6d, 0xa7, 0xe2, + 0x97, 0x25, 0x26, 0x11, 0xde, 0x98, 0xc1, 0x2c, 0x06, 0xeb, 0x68, 0x2b, 0x6c, 0x76, 0x37, 0x23, + 0xca, 0xaa, 0x6a, 0x65, 0x13, 0x76, 0x17, 0x3f, 0x82, 0xf4, 0x83, 0xfe, 0xf0, 0x47, 0x3c, 0x7f, + 0x5e, 0x16, 0x01, 0xfa, 0x28, 0x02, 0xf4, 0x59, 0x04, 0xe8, 0xed, 0x2b, 0xf8, 0xf7, 0x70, 0x91, + 0x28, 0x9f, 0xce, 0x63, 0x26, 0xf5, 0x8c, 0x67, 0xce, 0x48, 0xd9, 0x9b, 0x40, 0xce, 0x33, 0xd0, + 0x53, 0xd7, 0x13, 0x46, 0xf5, 0x12, 0xcd, 0xff, 0x9a, 0xf4, 0xb4, 0x4e, 0xde, 0x1b, 0x7b, 0xb7, + 0xa0, 0xaf, 0x46, 0xec, 0xec, 0x7e, 0x50, 0x1e, 0xaf, 0x8f, 0x15, 0xff, 0x5f, 0x8d, 0x78, 0xf2, + 0x1d, 0x00, 0x00, 0xff, 0xff, 0xcd, 0x95, 0x67, 0x64, 0x9a, 0x01, 0x00, 0x00, } func (m *StorageGroup) Marshal() (dAtA []byte, err error) { @@ -368,7 +368,7 @@ func (m *StorageGroup) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Members = append(m.Members, &refs.ObjectID{}) + m.Members = append(m.Members, &grpc.ObjectID{}) if err := m.Members[len(m.Members)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } From 51e1c3bbcba7fdf76c4a580d369d04649e28cc2b Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Fri, 14 Aug 2020 19:02:42 +0300 Subject: [PATCH 0278/1196] Remove empty v2/convert.go --- v2/convert.go | 1 - 1 file changed, 1 deletion(-) delete mode 100644 v2/convert.go diff --git a/v2/convert.go b/v2/convert.go deleted file mode 100644 index 5ec3cc8..0000000 --- a/v2/convert.go +++ /dev/null @@ -1 +0,0 @@ -package v2 From 41f9c504240dfb6f51d200d5e66f2b82af3c82e7 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Fri, 14 Aug 2020 13:57:19 +0300 Subject: [PATCH 0279/1196] Add proto marshal helper for bytes Signed-off-by: Alex Vanin --- util/proto/marshal.go | 44 +++++ util/proto/marshal_test.go | 118 +++++++++++++ util/proto/test/test.pb.go | 327 +++++++++++++++++++++++++++++++++++++ util/proto/test/test.proto | 7 + 4 files changed, 496 insertions(+) create mode 100644 util/proto/marshal.go create mode 100644 util/proto/marshal_test.go create mode 100644 util/proto/test/test.pb.go create mode 100644 util/proto/test/test.proto diff --git a/util/proto/marshal.go b/util/proto/marshal.go new file mode 100644 index 0000000..cd9c493 --- /dev/null +++ b/util/proto/marshal.go @@ -0,0 +1,44 @@ +/* +This package contains help functions for stable marshaller. Their usage is +totally optional. One can implement fast stable marshaller without these +runtime function calls. +*/ + +package proto + +import ( + "encoding/binary" + "math/bits" +) + +func BytesMarshal(field int, buf, v []byte) (int, error) { + if len(v) == 0 { + return 0, nil + } + + // buf length check can prevent panic at PutUvarint, but it will make + // marshaller a bit slower. + + prefix := field<<3 | 0x2 + i := binary.PutUvarint(buf, uint64(prefix)) + i += binary.PutUvarint(buf[i:], uint64(len(v))) + i += copy(buf[i:], v) + + return i, nil +} + +func BytesSize(field int, v []byte) int { + ln := len(v) + if ln == 0 { + return 0 + } + + prefix := field<<3 | 0x2 + + return VarUIntSize(uint64(prefix)) + VarUIntSize(uint64(ln)) + ln +} + +// varUIntSize returns length of varint byte sequence for uint64 value 'x'. +func VarUIntSize(x uint64) int { + return (bits.Len64(x|1) + 6) / 7 +} diff --git a/util/proto/marshal_test.go b/util/proto/marshal_test.go new file mode 100644 index 0000000..ccc1cca --- /dev/null +++ b/util/proto/marshal_test.go @@ -0,0 +1,118 @@ +package proto_test + +import ( + "testing" + + "github.com/nspcc-dev/neofs-api-go/util/proto" + "github.com/nspcc-dev/neofs-api-go/util/proto/test" + "github.com/pkg/errors" + "github.com/stretchr/testify/require" +) + +type stablePrimitives struct { + FieldA []byte +} + +func (s *stablePrimitives) stableMarshal(buf []byte) ([]byte, error) { + if s == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, s.stableSize()) + } + + var ( + i, offset int + ) + + offset, err := proto.BytesMarshal(1, buf, s.FieldA) + if err != nil { + return nil, errors.Wrap(err, "can't marshal field a") + } + i += offset + + return buf, nil +} + +func (s *stablePrimitives) stableMarshalWrongFieldNum(buf []byte) ([]byte, error) { + if s == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, s.stableSize()) + } + + var ( + i, offset int + ) + + offset, err := proto.BytesMarshal(1+1, buf, s.FieldA) + if err != nil { + return nil, errors.Wrap(err, "can't marshal field a") + } + i += offset + + return buf, nil +} + +func (s *stablePrimitives) stableSize() int { + return proto.BytesSize(1, s.FieldA) +} + +func TestBytesMarshal(t *testing.T) { + t.Run("not empty", func(t *testing.T) { + data := []byte("Hello World") + testBytesMarshal(t, data, false) + testBytesMarshal(t, data, true) + }) + + t.Run("empty", func(t *testing.T) { + testBytesMarshal(t, []byte{}, false) + }) + + t.Run("nil", func(t *testing.T) { + testBytesMarshal(t, nil, false) + }) +} + +func testBytesMarshal(t *testing.T, data []byte, wrongField bool) { + var ( + wire []byte + err error + + custom = stablePrimitives{FieldA: data} + transport = test.Primitives{FieldA: data} + ) + + if !wrongField { + wire, err = custom.stableMarshal(nil) + } else { + wire, err = custom.stableMarshalWrongFieldNum(nil) + } + require.NoError(t, err) + + wireGen, err := transport.Marshal() + require.NoError(t, err) + + if !wrongField { + // we can check equality because single field cannot be unstable marshalled + require.Equal(t, wireGen, wire) + } else { + require.NotEqual(t, wireGen, wire) + } + + result := new(test.Primitives) + err = result.Unmarshal(wire) + require.NoError(t, err) + + if !wrongField { + require.Len(t, result.FieldA, len(data)) + if len(data) > 0 { + require.Equal(t, data, result.FieldA) + } + } else { + require.Len(t, result.FieldA, 0) + } +} diff --git a/util/proto/test/test.pb.go b/util/proto/test/test.pb.go new file mode 100644 index 0000000..5db45e5 --- /dev/null +++ b/util/proto/test/test.pb.go @@ -0,0 +1,327 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: util/proto/test/test.proto + +package test + +import ( + fmt "fmt" + proto "github.com/golang/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package + +type Primitives struct { + FieldA []byte `protobuf:"bytes,1,opt,name=field_a,json=fieldA,proto3" json:"field_a,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Primitives) Reset() { *m = Primitives{} } +func (m *Primitives) String() string { return proto.CompactTextString(m) } +func (*Primitives) ProtoMessage() {} +func (*Primitives) Descriptor() ([]byte, []int) { + return fileDescriptor_998ad0e1a3de8558, []int{0} +} +func (m *Primitives) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Primitives) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Primitives.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Primitives) XXX_Merge(src proto.Message) { + xxx_messageInfo_Primitives.Merge(m, src) +} +func (m *Primitives) XXX_Size() int { + return m.Size() +} +func (m *Primitives) XXX_DiscardUnknown() { + xxx_messageInfo_Primitives.DiscardUnknown(m) +} + +var xxx_messageInfo_Primitives proto.InternalMessageInfo + +func (m *Primitives) GetFieldA() []byte { + if m != nil { + return m.FieldA + } + return nil +} + +func init() { + proto.RegisterType((*Primitives)(nil), "test.Primitives") +} + +func init() { proto.RegisterFile("util/proto/test/test.proto", fileDescriptor_998ad0e1a3de8558) } + +var fileDescriptor_998ad0e1a3de8558 = []byte{ + // 109 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x2a, 0x2d, 0xc9, 0xcc, + 0xd1, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0xd7, 0x2f, 0x49, 0x2d, 0x2e, 0x01, 0x13, 0x7a, 0x60, 0xbe, + 0x10, 0x0b, 0x88, 0xad, 0xa4, 0xca, 0xc5, 0x15, 0x50, 0x94, 0x99, 0x9b, 0x59, 0x92, 0x59, 0x96, + 0x5a, 0x2c, 0x24, 0xce, 0xc5, 0x9e, 0x96, 0x99, 0x9a, 0x93, 0x12, 0x9f, 0x28, 0xc1, 0xa8, 0xc0, + 0xa8, 0xc1, 0x13, 0xc4, 0x06, 0xe6, 0x3a, 0x3a, 0x09, 0x9c, 0x78, 0x24, 0xc7, 0x78, 0xe1, 0x91, + 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x33, 0x1e, 0xcb, 0x31, 0x24, 0xb1, 0x81, 0x4d, 0x31, 0x06, + 0x04, 0x00, 0x00, 0xff, 0xff, 0xe5, 0xa7, 0x6b, 0x1f, 0x63, 0x00, 0x00, 0x00, +} + +func (m *Primitives) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Primitives) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Primitives) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.FieldA) > 0 { + i -= len(m.FieldA) + copy(dAtA[i:], m.FieldA) + i = encodeVarintTest(dAtA, i, uint64(len(m.FieldA))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintTest(dAtA []byte, offset int, v uint64) int { + offset -= sovTest(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Primitives) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.FieldA) + if l > 0 { + n += 1 + l + sovTest(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovTest(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozTest(x uint64) (n int) { + return sovTest(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Primitives) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTest + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Primitives: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Primitives: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FieldA", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTest + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTest + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTest + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.FieldA = append(m.FieldA[:0], dAtA[iNdEx:postIndex]...) + if m.FieldA == nil { + m.FieldA = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTest(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTest + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTest + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipTest(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTest + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTest + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTest + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthTest + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTest + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthTest + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthTest = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTest = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTest = fmt.Errorf("proto: unexpected end of group") +) diff --git a/util/proto/test/test.proto b/util/proto/test/test.proto new file mode 100644 index 0000000..cf51a44 --- /dev/null +++ b/util/proto/test/test.proto @@ -0,0 +1,7 @@ +syntax = "proto3"; + +package test; + +message Primitives { + bytes field_a = 1; +} \ No newline at end of file From 311b76b75b1aeec29708f94c432ad81e30c9cf9c Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Fri, 14 Aug 2020 15:29:48 +0300 Subject: [PATCH 0280/1196] Add proto marshal helper for string Signed-off-by: Alex Vanin --- util/proto/marshal.go | 8 ++++ util/proto/marshal_test.go | 88 +++++++++++++++++++++++++++----------- util/proto/test/test.pb.go | 62 ++++++++++++++++++++++++--- util/proto/test/test.proto | 1 + 4 files changed, 129 insertions(+), 30 deletions(-) diff --git a/util/proto/marshal.go b/util/proto/marshal.go index cd9c493..2d5f9e6 100644 --- a/util/proto/marshal.go +++ b/util/proto/marshal.go @@ -38,6 +38,14 @@ func BytesSize(field int, v []byte) int { return VarUIntSize(uint64(prefix)) + VarUIntSize(uint64(ln)) + ln } +func StringMarshal(field int, buf []byte, v string) (int, error) { + return BytesMarshal(field, buf, []byte(v)) +} + +func StringSize(field int, v string) int { + return BytesSize(field, []byte(v)) +} + // varUIntSize returns length of varint byte sequence for uint64 value 'x'. func VarUIntSize(x uint64) int { return (bits.Len64(x|1) + 6) / 7 diff --git a/util/proto/marshal_test.go b/util/proto/marshal_test.go index ccc1cca..66a8b62 100644 --- a/util/proto/marshal_test.go +++ b/util/proto/marshal_test.go @@ -11,9 +11,10 @@ import ( type stablePrimitives struct { FieldA []byte + FieldB string } -func (s *stablePrimitives) stableMarshal(buf []byte) ([]byte, error) { +func (s *stablePrimitives) stableMarshal(buf []byte, wrongField bool) ([]byte, error) { if s == nil { return []byte{}, nil } @@ -23,32 +24,24 @@ func (s *stablePrimitives) stableMarshal(buf []byte) ([]byte, error) { } var ( - i, offset int + i, offset, fieldNum int ) - offset, err := proto.BytesMarshal(1, buf, s.FieldA) + fieldNum = 1 + if wrongField { + fieldNum++ + } + offset, err := proto.BytesMarshal(fieldNum, buf, s.FieldA) if err != nil { return nil, errors.Wrap(err, "can't marshal field a") } i += offset - return buf, nil -} - -func (s *stablePrimitives) stableMarshalWrongFieldNum(buf []byte) ([]byte, error) { - if s == nil { - return []byte{}, nil + fieldNum = 2 + if wrongField { + fieldNum++ } - - if buf == nil { - buf = make([]byte, s.stableSize()) - } - - var ( - i, offset int - ) - - offset, err := proto.BytesMarshal(1+1, buf, s.FieldA) + offset, err = proto.StringMarshal(fieldNum, buf, s.FieldB) if err != nil { return nil, errors.Wrap(err, "can't marshal field a") } @@ -58,7 +51,8 @@ func (s *stablePrimitives) stableMarshalWrongFieldNum(buf []byte) ([]byte, error } func (s *stablePrimitives) stableSize() int { - return proto.BytesSize(1, s.FieldA) + return proto.BytesSize(1, s.FieldA) + + proto.StringSize(2, s.FieldB) } func TestBytesMarshal(t *testing.T) { @@ -86,11 +80,7 @@ func testBytesMarshal(t *testing.T, data []byte, wrongField bool) { transport = test.Primitives{FieldA: data} ) - if !wrongField { - wire, err = custom.stableMarshal(nil) - } else { - wire, err = custom.stableMarshalWrongFieldNum(nil) - } + wire, err = custom.stableMarshal(nil, wrongField) require.NoError(t, err) wireGen, err := transport.Marshal() @@ -116,3 +106,51 @@ func testBytesMarshal(t *testing.T, data []byte, wrongField bool) { require.Len(t, result.FieldA, 0) } } + +func TestStringMarshal(t *testing.T) { + t.Run("not empty", func(t *testing.T) { + data := "Hello World" + testStringMarshal(t, data, false) + testStringMarshal(t, data, true) + }) + + t.Run("empty", func(t *testing.T) { + testStringMarshal(t, "", false) + }) +} + +func testStringMarshal(t *testing.T, s string, wrongField bool) { + var ( + wire []byte + err error + + custom = stablePrimitives{FieldB: s} + transport = test.Primitives{FieldB: s} + ) + + wire, err = custom.stableMarshal(nil, wrongField) + require.NoError(t, err) + + wireGen, err := transport.Marshal() + require.NoError(t, err) + + if !wrongField { + // we can check equality because single field cannot be unstable marshalled + require.Equal(t, wireGen, wire) + } else { + require.NotEqual(t, wireGen, wire) + } + + result := new(test.Primitives) + err = result.Unmarshal(wire) + require.NoError(t, err) + + if !wrongField { + require.Len(t, result.FieldB, len(s)) + if len(s) > 0 { + require.Equal(t, s, result.FieldB) + } + } else { + require.Len(t, result.FieldB, 0) + } +} diff --git a/util/proto/test/test.pb.go b/util/proto/test/test.pb.go index 5db45e5..9a1afd3 100644 --- a/util/proto/test/test.pb.go +++ b/util/proto/test/test.pb.go @@ -24,6 +24,7 @@ const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package type Primitives struct { FieldA []byte `protobuf:"bytes,1,opt,name=field_a,json=fieldA,proto3" json:"field_a,omitempty"` + FieldB string `protobuf:"bytes,2,opt,name=field_b,json=fieldB,proto3" json:"field_b,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -69,6 +70,13 @@ func (m *Primitives) GetFieldA() []byte { return nil } +func (m *Primitives) GetFieldB() string { + if m != nil { + return m.FieldB + } + return "" +} + func init() { proto.RegisterType((*Primitives)(nil), "test.Primitives") } @@ -76,14 +84,15 @@ func init() { func init() { proto.RegisterFile("util/proto/test/test.proto", fileDescriptor_998ad0e1a3de8558) } var fileDescriptor_998ad0e1a3de8558 = []byte{ - // 109 bytes of a gzipped FileDescriptorProto + // 121 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x2a, 0x2d, 0xc9, 0xcc, 0xd1, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0xd7, 0x2f, 0x49, 0x2d, 0x2e, 0x01, 0x13, 0x7a, 0x60, 0xbe, - 0x10, 0x0b, 0x88, 0xad, 0xa4, 0xca, 0xc5, 0x15, 0x50, 0x94, 0x99, 0x9b, 0x59, 0x92, 0x59, 0x96, + 0x10, 0x0b, 0x88, 0xad, 0x64, 0xc7, 0xc5, 0x15, 0x50, 0x94, 0x99, 0x9b, 0x59, 0x92, 0x59, 0x96, 0x5a, 0x2c, 0x24, 0xce, 0xc5, 0x9e, 0x96, 0x99, 0x9a, 0x93, 0x12, 0x9f, 0x28, 0xc1, 0xa8, 0xc0, - 0xa8, 0xc1, 0x13, 0xc4, 0x06, 0xe6, 0x3a, 0x3a, 0x09, 0x9c, 0x78, 0x24, 0xc7, 0x78, 0xe1, 0x91, - 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x33, 0x1e, 0xcb, 0x31, 0x24, 0xb1, 0x81, 0x4d, 0x31, 0x06, - 0x04, 0x00, 0x00, 0xff, 0xff, 0xe5, 0xa7, 0x6b, 0x1f, 0x63, 0x00, 0x00, 0x00, + 0xa8, 0xc1, 0x13, 0xc4, 0x06, 0xe6, 0x3a, 0x22, 0x24, 0x92, 0x24, 0x98, 0x14, 0x18, 0x35, 0x38, + 0xa1, 0x12, 0x4e, 0x4e, 0x02, 0x27, 0x1e, 0xc9, 0x31, 0x5e, 0x78, 0x24, 0xc7, 0xf8, 0xe0, 0x91, + 0x1c, 0xe3, 0x8c, 0xc7, 0x72, 0x0c, 0x49, 0x6c, 0x60, 0xe3, 0x8d, 0x01, 0x01, 0x00, 0x00, 0xff, + 0xff, 0x1a, 0xa1, 0x65, 0x4f, 0x7c, 0x00, 0x00, 0x00, } func (m *Primitives) Marshal() (dAtA []byte, err error) { @@ -110,6 +119,13 @@ func (m *Primitives) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } + if len(m.FieldB) > 0 { + i -= len(m.FieldB) + copy(dAtA[i:], m.FieldB) + i = encodeVarintTest(dAtA, i, uint64(len(m.FieldB))) + i-- + dAtA[i] = 0x12 + } if len(m.FieldA) > 0 { i -= len(m.FieldA) copy(dAtA[i:], m.FieldA) @@ -141,6 +157,10 @@ func (m *Primitives) Size() (n int) { if l > 0 { n += 1 + l + sovTest(uint64(l)) } + l = len(m.FieldB) + if l > 0 { + n += 1 + l + sovTest(uint64(l)) + } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -216,6 +236,38 @@ func (m *Primitives) Unmarshal(dAtA []byte) error { m.FieldA = []byte{} } iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FieldB", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTest + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTest + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTest + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.FieldB = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTest(dAtA[iNdEx:]) diff --git a/util/proto/test/test.proto b/util/proto/test/test.proto index cf51a44..81a1058 100644 --- a/util/proto/test/test.proto +++ b/util/proto/test/test.proto @@ -4,4 +4,5 @@ package test; message Primitives { bytes field_a = 1; + string field_b = 2; } \ No newline at end of file From 89bd8f39152c0cdef3e00e315e6b5edf830646b8 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Fri, 14 Aug 2020 15:53:57 +0300 Subject: [PATCH 0281/1196] Add stable marshaller helper for bool Signed-off-by: Alex Vanin --- util/proto/marshal.go | 28 ++++++++++++- util/proto/marshal_test.go | 84 +++++++++++++++++++++++++++++++------- util/proto/test/test.pb.go | 54 +++++++++++++++++++++--- util/proto/test/test.proto | 3 +- 4 files changed, 147 insertions(+), 22 deletions(-) diff --git a/util/proto/marshal.go b/util/proto/marshal.go index 2d5f9e6..8570f6a 100644 --- a/util/proto/marshal.go +++ b/util/proto/marshal.go @@ -16,10 +16,10 @@ func BytesMarshal(field int, buf, v []byte) (int, error) { return 0, nil } + prefix := field<<3 | 0x2 + // buf length check can prevent panic at PutUvarint, but it will make // marshaller a bit slower. - - prefix := field<<3 | 0x2 i := binary.PutUvarint(buf, uint64(prefix)) i += binary.PutUvarint(buf[i:], uint64(len(v))) i += copy(buf[i:], v) @@ -46,6 +46,30 @@ func StringSize(field int, v string) int { return BytesSize(field, []byte(v)) } +func BoolMarshal(field int, buf []byte, v bool) (int, error) { + if !v { + return 0, nil + } + + prefix := field << 3 + + // buf length check can prevent panic at PutUvarint, but it will make + // marshaller a bit slower. + i := binary.PutUvarint(buf, uint64(prefix)) + buf[i] = 0x1 + + return i + 1, nil +} + +func BoolSize(field int, v bool) int { + if !v { + return 0 + } + + prefix := field << 3 + return VarUIntSize(uint64(prefix)) + 1 // bool is always 1 byte long +} + // varUIntSize returns length of varint byte sequence for uint64 value 'x'. func VarUIntSize(x uint64) int { return (bits.Len64(x|1) + 6) / 7 diff --git a/util/proto/marshal_test.go b/util/proto/marshal_test.go index 66a8b62..36847dd 100644 --- a/util/proto/marshal_test.go +++ b/util/proto/marshal_test.go @@ -12,6 +12,7 @@ import ( type stablePrimitives struct { FieldA []byte FieldB string + FieldC bool } func (s *stablePrimitives) stableMarshal(buf []byte, wrongField bool) ([]byte, error) { @@ -43,7 +44,17 @@ func (s *stablePrimitives) stableMarshal(buf []byte, wrongField bool) ([]byte, e } offset, err = proto.StringMarshal(fieldNum, buf, s.FieldB) if err != nil { - return nil, errors.Wrap(err, "can't marshal field a") + return nil, errors.Wrap(err, "can't marshal field b") + } + i += offset + + fieldNum = 200 + if wrongField { + fieldNum++ + } + offset, err = proto.BoolMarshal(fieldNum, buf, s.FieldC) + if err != nil { + return nil, errors.Wrap(err, "can't marshal field c") } i += offset @@ -52,7 +63,8 @@ func (s *stablePrimitives) stableMarshal(buf []byte, wrongField bool) ([]byte, e func (s *stablePrimitives) stableSize() int { return proto.BytesSize(1, s.FieldA) + - proto.StringSize(2, s.FieldB) + proto.StringSize(2, s.FieldB) + + proto.BoolSize(200, s.FieldC) } func TestBytesMarshal(t *testing.T) { @@ -71,6 +83,29 @@ func TestBytesMarshal(t *testing.T) { }) } +func TestStringMarshal(t *testing.T) { + t.Run("not empty", func(t *testing.T) { + data := "Hello World" + testStringMarshal(t, data, false) + testStringMarshal(t, data, true) + }) + + t.Run("empty", func(t *testing.T) { + testStringMarshal(t, "", false) + }) +} + +func TestBoolMarshal(t *testing.T) { + t.Run("true", func(t *testing.T) { + testBoolMarshal(t, true, false) + testBoolMarshal(t, true, true) + }) + + t.Run("false", func(t *testing.T) { + testBoolMarshal(t, false, false) + }) +} + func testBytesMarshal(t *testing.T, data []byte, wrongField bool) { var ( wire []byte @@ -107,18 +142,6 @@ func testBytesMarshal(t *testing.T, data []byte, wrongField bool) { } } -func TestStringMarshal(t *testing.T) { - t.Run("not empty", func(t *testing.T) { - data := "Hello World" - testStringMarshal(t, data, false) - testStringMarshal(t, data, true) - }) - - t.Run("empty", func(t *testing.T) { - testStringMarshal(t, "", false) - }) -} - func testStringMarshal(t *testing.T, s string, wrongField bool) { var ( wire []byte @@ -154,3 +177,36 @@ func testStringMarshal(t *testing.T, s string, wrongField bool) { require.Len(t, result.FieldB, 0) } } + +func testBoolMarshal(t *testing.T, b bool, wrongField bool) { + var ( + wire []byte + err error + + custom = stablePrimitives{FieldC: b} + transport = test.Primitives{FieldC: b} + ) + + wire, err = custom.stableMarshal(nil, wrongField) + require.NoError(t, err) + + wireGen, err := transport.Marshal() + require.NoError(t, err) + + if !wrongField { + // we can check equality because single field cannot be unstable marshalled + require.Equal(t, wireGen, wire) + } else { + require.NotEqual(t, wireGen, wire) + } + + result := new(test.Primitives) + err = result.Unmarshal(wire) + require.NoError(t, err) + + if !wrongField { + require.Equal(t, b, result.FieldC) + } else { + require.False(t, false, result.FieldC) + } +} diff --git a/util/proto/test/test.pb.go b/util/proto/test/test.pb.go index 9a1afd3..910812c 100644 --- a/util/proto/test/test.pb.go +++ b/util/proto/test/test.pb.go @@ -25,6 +25,7 @@ const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package type Primitives struct { FieldA []byte `protobuf:"bytes,1,opt,name=field_a,json=fieldA,proto3" json:"field_a,omitempty"` FieldB string `protobuf:"bytes,2,opt,name=field_b,json=fieldB,proto3" json:"field_b,omitempty"` + FieldC bool `protobuf:"varint,200,opt,name=field_c,json=fieldC,proto3" json:"field_c,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -77,6 +78,13 @@ func (m *Primitives) GetFieldB() string { return "" } +func (m *Primitives) GetFieldC() bool { + if m != nil { + return m.FieldC + } + return false +} + func init() { proto.RegisterType((*Primitives)(nil), "test.Primitives") } @@ -84,15 +92,16 @@ func init() { func init() { proto.RegisterFile("util/proto/test/test.proto", fileDescriptor_998ad0e1a3de8558) } var fileDescriptor_998ad0e1a3de8558 = []byte{ - // 121 bytes of a gzipped FileDescriptorProto + // 134 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x2a, 0x2d, 0xc9, 0xcc, 0xd1, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0xd7, 0x2f, 0x49, 0x2d, 0x2e, 0x01, 0x13, 0x7a, 0x60, 0xbe, - 0x10, 0x0b, 0x88, 0xad, 0x64, 0xc7, 0xc5, 0x15, 0x50, 0x94, 0x99, 0x9b, 0x59, 0x92, 0x59, 0x96, + 0x10, 0x0b, 0x88, 0xad, 0x14, 0xc1, 0xc5, 0x15, 0x50, 0x94, 0x99, 0x9b, 0x59, 0x92, 0x59, 0x96, 0x5a, 0x2c, 0x24, 0xce, 0xc5, 0x9e, 0x96, 0x99, 0x9a, 0x93, 0x12, 0x9f, 0x28, 0xc1, 0xa8, 0xc0, 0xa8, 0xc1, 0x13, 0xc4, 0x06, 0xe6, 0x3a, 0x22, 0x24, 0x92, 0x24, 0x98, 0x14, 0x18, 0x35, 0x38, - 0xa1, 0x12, 0x4e, 0x4e, 0x02, 0x27, 0x1e, 0xc9, 0x31, 0x5e, 0x78, 0x24, 0xc7, 0xf8, 0xe0, 0x91, - 0x1c, 0xe3, 0x8c, 0xc7, 0x72, 0x0c, 0x49, 0x6c, 0x60, 0xe3, 0x8d, 0x01, 0x01, 0x00, 0x00, 0xff, - 0xff, 0x1a, 0xa1, 0x65, 0x4f, 0x7c, 0x00, 0x00, 0x00, + 0xa1, 0x12, 0x4e, 0x42, 0x12, 0x30, 0x89, 0x64, 0x89, 0x13, 0x20, 0x2d, 0x1c, 0x50, 0x19, 0x67, + 0x27, 0x81, 0x13, 0x8f, 0xe4, 0x18, 0x2f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e, 0x71, 0xc6, + 0x63, 0x39, 0x86, 0x24, 0x36, 0xb0, 0xc5, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0x1a, 0x10, + 0x20, 0x0a, 0x96, 0x00, 0x00, 0x00, } func (m *Primitives) Marshal() (dAtA []byte, err error) { @@ -119,6 +128,18 @@ func (m *Primitives) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } + if m.FieldC { + i-- + if m.FieldC { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0xc + i-- + dAtA[i] = 0xc0 + } if len(m.FieldB) > 0 { i -= len(m.FieldB) copy(dAtA[i:], m.FieldB) @@ -161,6 +182,9 @@ func (m *Primitives) Size() (n int) { if l > 0 { n += 1 + l + sovTest(uint64(l)) } + if m.FieldC { + n += 3 + } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -268,6 +292,26 @@ func (m *Primitives) Unmarshal(dAtA []byte) error { } m.FieldB = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 200: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field FieldC", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTest + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.FieldC = bool(v != 0) default: iNdEx = preIndex skippy, err := skipTest(dAtA[iNdEx:]) diff --git a/util/proto/test/test.proto b/util/proto/test/test.proto index 81a1058..4be07a4 100644 --- a/util/proto/test/test.proto +++ b/util/proto/test/test.proto @@ -3,6 +3,7 @@ syntax = "proto3"; package test; message Primitives { - bytes field_a = 1; + bytes field_a = 1; string field_b = 2; + bool field_c = 200; } \ No newline at end of file From f8482381fdc24141464d20eb9a70113b7c98b9ee Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Fri, 14 Aug 2020 16:32:19 +0300 Subject: [PATCH 0282/1196] Add stable marshaller helper for ints Signed-off-by: Alex Vanin --- util/proto/marshal.go | 54 +++++++++++ util/proto/marshal_test.go | 190 ++++++++++++++++++++++++++++++++++++- util/proto/test/test.pb.go | 167 ++++++++++++++++++++++++++++++-- util/proto/test/test.proto | 4 + 4 files changed, 406 insertions(+), 9 deletions(-) diff --git a/util/proto/marshal.go b/util/proto/marshal.go index 8570f6a..3200176 100644 --- a/util/proto/marshal.go +++ b/util/proto/marshal.go @@ -67,10 +67,64 @@ func BoolSize(field int, v bool) int { } prefix := field << 3 + return VarUIntSize(uint64(prefix)) + 1 // bool is always 1 byte long } +func UInt64Marshal(field int, buf []byte, v uint64) (int, error) { + if v == 0 { + return 0, nil + } + + prefix := field << 3 + + // buf length check can prevent panic at PutUvarint, but it will make + // marshaller a bit slower. + i := binary.PutUvarint(buf, uint64(prefix)) + i += binary.PutUvarint(buf[i:], v) + + return i, nil +} + +func UInt64Size(field int, v uint64) int { + if v == 0 { + return 0 + } + + prefix := field << 3 + + return VarUIntSize(uint64(prefix)) + VarUIntSize(v) +} + +func Int64Marshal(field int, buf []byte, v int64) (int, error) { + return UInt64Marshal(field, buf, uint64(v)) +} + +func Int64Size(field int, v int64) int { + return UInt64Size(field, uint64(v)) +} + +func UInt32Marshal(field int, buf []byte, v uint32) (int, error) { + return UInt64Marshal(field, buf, uint64(v)) +} + +func UInt32Size(field int, v uint32) int { + return UInt64Size(field, uint64(v)) +} + +func Int32Marshal(field int, buf []byte, v int32) (int, error) { + return UInt64Marshal(field, buf, uint64(v)) +} + +func Int32Size(field int, v int32) int { + return UInt64Size(field, uint64(v)) +} + // varUIntSize returns length of varint byte sequence for uint64 value 'x'. func VarUIntSize(x uint64) int { return (bits.Len64(x|1) + 6) / 7 } + +func NestedStructurePrefixSize(field int64) int { + return VarUIntSize(uint64(field<<3 | 0x02)) +} diff --git a/util/proto/marshal_test.go b/util/proto/marshal_test.go index 36847dd..0abcef9 100644 --- a/util/proto/marshal_test.go +++ b/util/proto/marshal_test.go @@ -1,6 +1,7 @@ package proto_test import ( + "math" "testing" "github.com/nspcc-dev/neofs-api-go/util/proto" @@ -13,6 +14,10 @@ type stablePrimitives struct { FieldA []byte FieldB string FieldC bool + FieldD int32 + FieldE uint32 + FieldF int64 + FieldG uint64 } func (s *stablePrimitives) stableMarshal(buf []byte, wrongField bool) ([]byte, error) { @@ -58,13 +63,57 @@ func (s *stablePrimitives) stableMarshal(buf []byte, wrongField bool) ([]byte, e } i += offset + fieldNum = 201 + if wrongField { + fieldNum++ + } + offset, err = proto.Int32Marshal(fieldNum, buf, s.FieldD) + if err != nil { + return nil, errors.Wrap(err, "can't marshal field d") + } + i += offset + + fieldNum = 202 + if wrongField { + fieldNum++ + } + offset, err = proto.UInt32Marshal(fieldNum, buf, s.FieldE) + if err != nil { + return nil, errors.Wrap(err, "can't marshal field e") + } + i += offset + + fieldNum = 203 + if wrongField { + fieldNum++ + } + offset, err = proto.Int64Marshal(fieldNum, buf, s.FieldF) + if err != nil { + return nil, errors.Wrap(err, "can't marshal field f") + } + i += offset + + fieldNum = 204 + if wrongField { + fieldNum++ + } + offset, err = proto.UInt64Marshal(fieldNum, buf, s.FieldG) + if err != nil { + return nil, errors.Wrap(err, "can't marshal field g") + } + i += offset + return buf, nil } func (s *stablePrimitives) stableSize() int { return proto.BytesSize(1, s.FieldA) + proto.StringSize(2, s.FieldB) + - proto.BoolSize(200, s.FieldC) + proto.BoolSize(200, s.FieldC) + + proto.Int32Size(201, s.FieldD) + + proto.UInt32Size(202, s.FieldE) + + proto.Int64Size(203, s.FieldF) + + proto.UInt64Size(204, s.FieldG) } func TestBytesMarshal(t *testing.T) { @@ -106,6 +155,60 @@ func TestBoolMarshal(t *testing.T) { }) } +func TestInt32Marshal(t *testing.T) { + t.Run("zero", func(t *testing.T) { + testInt32Marshal(t, 0, false) + }) + + t.Run("positive", func(t *testing.T) { + testInt32Marshal(t, math.MaxInt32, false) + testInt32Marshal(t, math.MaxInt32, true) + }) + + t.Run("negative", func(t *testing.T) { + testInt32Marshal(t, math.MinInt32, false) + testInt32Marshal(t, math.MinInt32, true) + }) +} + +func TestUInt32Marshal(t *testing.T) { + t.Run("zero", func(t *testing.T) { + testUInt32Marshal(t, 0, false) + }) + + t.Run("non zero", func(t *testing.T) { + testUInt32Marshal(t, math.MaxUint32, false) + testUInt32Marshal(t, math.MaxUint32, true) + }) +} + +func TestInt64Marshal(t *testing.T) { + t.Run("zero", func(t *testing.T) { + testInt32Marshal(t, 0, false) + }) + + t.Run("positive", func(t *testing.T) { + testInt64Marshal(t, math.MaxInt64, false) + testInt64Marshal(t, math.MaxInt64, true) + }) + + t.Run("negative", func(t *testing.T) { + testInt64Marshal(t, math.MinInt64, false) + testInt64Marshal(t, math.MinInt64, true) + }) +} + +func TestUInt64Marshal(t *testing.T) { + t.Run("zero", func(t *testing.T) { + testUInt64Marshal(t, 0, false) + }) + + t.Run("non zero", func(t *testing.T) { + testUInt64Marshal(t, math.MaxUint64, false) + testUInt64Marshal(t, math.MaxUint64, true) + }) +} + func testBytesMarshal(t *testing.T, data []byte, wrongField bool) { var ( wire []byte @@ -210,3 +313,88 @@ func testBoolMarshal(t *testing.T, b bool, wrongField bool) { require.False(t, false, result.FieldC) } } + +func testIntMarshal(t *testing.T, c stablePrimitives, tr test.Primitives, wrongField bool) *test.Primitives { + var ( + wire []byte + err error + ) + wire, err = c.stableMarshal(nil, wrongField) + require.NoError(t, err) + + wireGen, err := tr.Marshal() + require.NoError(t, err) + + if !wrongField { + // we can check equality because single field cannot be unstable marshalled + require.Equal(t, wireGen, wire) + } else { + require.NotEqual(t, wireGen, wire) + } + + result := new(test.Primitives) + err = result.Unmarshal(wire) + require.NoError(t, err) + + return result +} + +func testInt32Marshal(t *testing.T, n int32, wrongField bool) { + var ( + custom = stablePrimitives{FieldD: n} + transport = test.Primitives{FieldD: n} + ) + + result := testIntMarshal(t, custom, transport, wrongField) + + if !wrongField { + require.Equal(t, n, result.FieldD) + } else { + require.EqualValues(t, 0, result.FieldD) + } +} + +func testUInt32Marshal(t *testing.T, n uint32, wrongField bool) { + var ( + custom = stablePrimitives{FieldE: n} + transport = test.Primitives{FieldE: n} + ) + + result := testIntMarshal(t, custom, transport, wrongField) + + if !wrongField { + require.Equal(t, n, result.FieldE) + } else { + require.EqualValues(t, 0, result.FieldE) + } +} + +func testInt64Marshal(t *testing.T, n int64, wrongField bool) { + var ( + custom = stablePrimitives{FieldF: n} + transport = test.Primitives{FieldF: n} + ) + + result := testIntMarshal(t, custom, transport, wrongField) + + if !wrongField { + require.Equal(t, n, result.FieldF) + } else { + require.EqualValues(t, 0, result.FieldF) + } +} + +func testUInt64Marshal(t *testing.T, n uint64, wrongField bool) { + var ( + custom = stablePrimitives{FieldG: n} + transport = test.Primitives{FieldG: n} + ) + + result := testIntMarshal(t, custom, transport, wrongField) + + if !wrongField { + require.Equal(t, n, result.FieldG) + } else { + require.EqualValues(t, 0, result.FieldG) + } +} diff --git a/util/proto/test/test.pb.go b/util/proto/test/test.pb.go index 910812c..6790854 100644 --- a/util/proto/test/test.pb.go +++ b/util/proto/test/test.pb.go @@ -26,6 +26,10 @@ type Primitives struct { FieldA []byte `protobuf:"bytes,1,opt,name=field_a,json=fieldA,proto3" json:"field_a,omitempty"` FieldB string `protobuf:"bytes,2,opt,name=field_b,json=fieldB,proto3" json:"field_b,omitempty"` FieldC bool `protobuf:"varint,200,opt,name=field_c,json=fieldC,proto3" json:"field_c,omitempty"` + FieldD int32 `protobuf:"varint,201,opt,name=field_d,json=fieldD,proto3" json:"field_d,omitempty"` + FieldE uint32 `protobuf:"varint,202,opt,name=field_e,json=fieldE,proto3" json:"field_e,omitempty"` + FieldF int64 `protobuf:"varint,203,opt,name=field_f,json=fieldF,proto3" json:"field_f,omitempty"` + FieldG uint64 `protobuf:"varint,204,opt,name=field_g,json=fieldG,proto3" json:"field_g,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -85,6 +89,34 @@ func (m *Primitives) GetFieldC() bool { return false } +func (m *Primitives) GetFieldD() int32 { + if m != nil { + return m.FieldD + } + return 0 +} + +func (m *Primitives) GetFieldE() uint32 { + if m != nil { + return m.FieldE + } + return 0 +} + +func (m *Primitives) GetFieldF() int64 { + if m != nil { + return m.FieldF + } + return 0 +} + +func (m *Primitives) GetFieldG() uint64 { + if m != nil { + return m.FieldG + } + return 0 +} + func init() { proto.RegisterType((*Primitives)(nil), "test.Primitives") } @@ -92,16 +124,19 @@ func init() { func init() { proto.RegisterFile("util/proto/test/test.proto", fileDescriptor_998ad0e1a3de8558) } var fileDescriptor_998ad0e1a3de8558 = []byte{ - // 134 bytes of a gzipped FileDescriptorProto + // 178 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x2a, 0x2d, 0xc9, 0xcc, 0xd1, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0xd7, 0x2f, 0x49, 0x2d, 0x2e, 0x01, 0x13, 0x7a, 0x60, 0xbe, - 0x10, 0x0b, 0x88, 0xad, 0x14, 0xc1, 0xc5, 0x15, 0x50, 0x94, 0x99, 0x9b, 0x59, 0x92, 0x59, 0x96, - 0x5a, 0x2c, 0x24, 0xce, 0xc5, 0x9e, 0x96, 0x99, 0x9a, 0x93, 0x12, 0x9f, 0x28, 0xc1, 0xa8, 0xc0, - 0xa8, 0xc1, 0x13, 0xc4, 0x06, 0xe6, 0x3a, 0x22, 0x24, 0x92, 0x24, 0x98, 0x14, 0x18, 0x35, 0x38, - 0xa1, 0x12, 0x4e, 0x42, 0x12, 0x30, 0x89, 0x64, 0x89, 0x13, 0x20, 0x2d, 0x1c, 0x50, 0x19, 0x67, - 0x27, 0x81, 0x13, 0x8f, 0xe4, 0x18, 0x2f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e, 0x71, 0xc6, - 0x63, 0x39, 0x86, 0x24, 0x36, 0xb0, 0xc5, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0x1a, 0x10, - 0x20, 0x0a, 0x96, 0x00, 0x00, 0x00, + 0x10, 0x0b, 0x88, 0xad, 0x74, 0x80, 0x91, 0x8b, 0x2b, 0xa0, 0x28, 0x33, 0x37, 0xb3, 0x24, 0xb3, + 0x2c, 0xb5, 0x58, 0x48, 0x9c, 0x8b, 0x3d, 0x2d, 0x33, 0x35, 0x27, 0x25, 0x3e, 0x51, 0x82, 0x51, + 0x81, 0x51, 0x83, 0x27, 0x88, 0x0d, 0xcc, 0x75, 0x44, 0x48, 0x24, 0x49, 0x30, 0x29, 0x30, 0x6a, + 0x70, 0x42, 0x25, 0x9c, 0x84, 0x24, 0x60, 0x12, 0xc9, 0x12, 0x27, 0x40, 0x5a, 0x38, 0xa0, 0x32, + 0xce, 0x08, 0x99, 0x14, 0x89, 0x93, 0x20, 0x19, 0x56, 0xa8, 0x8c, 0x0b, 0x42, 0x26, 0x55, 0xe2, + 0x14, 0x48, 0x86, 0x17, 0x2a, 0xe3, 0x8a, 0x90, 0x49, 0x93, 0x38, 0x0d, 0x92, 0x61, 0x86, 0xca, + 0xb8, 0x21, 0x64, 0xd2, 0x25, 0xce, 0x80, 0x64, 0x58, 0xa0, 0x32, 0xee, 0x4e, 0x02, 0x27, 0x1e, + 0xc9, 0x31, 0x5e, 0x78, 0x24, 0xc7, 0xf8, 0xe0, 0x91, 0x1c, 0xe3, 0x8c, 0xc7, 0x72, 0x0c, 0x49, + 0x6c, 0x60, 0x1f, 0x1a, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0xcc, 0xee, 0x55, 0x82, 0xff, 0x00, + 0x00, 0x00, } func (m *Primitives) Marshal() (dAtA []byte, err error) { @@ -128,6 +163,34 @@ func (m *Primitives) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } + if m.FieldG != 0 { + i = encodeVarintTest(dAtA, i, uint64(m.FieldG)) + i-- + dAtA[i] = 0xc + i-- + dAtA[i] = 0xe0 + } + if m.FieldF != 0 { + i = encodeVarintTest(dAtA, i, uint64(m.FieldF)) + i-- + dAtA[i] = 0xc + i-- + dAtA[i] = 0xd8 + } + if m.FieldE != 0 { + i = encodeVarintTest(dAtA, i, uint64(m.FieldE)) + i-- + dAtA[i] = 0xc + i-- + dAtA[i] = 0xd0 + } + if m.FieldD != 0 { + i = encodeVarintTest(dAtA, i, uint64(m.FieldD)) + i-- + dAtA[i] = 0xc + i-- + dAtA[i] = 0xc8 + } if m.FieldC { i-- if m.FieldC { @@ -185,6 +248,18 @@ func (m *Primitives) Size() (n int) { if m.FieldC { n += 3 } + if m.FieldD != 0 { + n += 2 + sovTest(uint64(m.FieldD)) + } + if m.FieldE != 0 { + n += 2 + sovTest(uint64(m.FieldE)) + } + if m.FieldF != 0 { + n += 2 + sovTest(uint64(m.FieldF)) + } + if m.FieldG != 0 { + n += 2 + sovTest(uint64(m.FieldG)) + } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -312,6 +387,82 @@ func (m *Primitives) Unmarshal(dAtA []byte) error { } } m.FieldC = bool(v != 0) + case 201: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field FieldD", wireType) + } + m.FieldD = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTest + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.FieldD |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 202: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field FieldE", wireType) + } + m.FieldE = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTest + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.FieldE |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 203: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field FieldF", wireType) + } + m.FieldF = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTest + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.FieldF |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 204: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field FieldG", wireType) + } + m.FieldG = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTest + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.FieldG |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipTest(dAtA[iNdEx:]) diff --git a/util/proto/test/test.proto b/util/proto/test/test.proto index 4be07a4..d3b43e6 100644 --- a/util/proto/test/test.proto +++ b/util/proto/test/test.proto @@ -6,4 +6,8 @@ message Primitives { bytes field_a = 1; string field_b = 2; bool field_c = 200; + int32 field_d = 201; + uint32 field_e = 202; + int64 field_f = 203; + uint64 field_g = 204; } \ No newline at end of file From a7a8fc33bb38c799cc8db7c0ac86245518b09492 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Fri, 14 Aug 2020 17:10:15 +0300 Subject: [PATCH 0283/1196] Add stable marshaler for enums Signed-off-by: Alex Vanin --- util/proto/marshal.go | 8 +++ util/proto/marshal_test.go | 63 ++++++++++++++++++++++- util/proto/test/test.pb.go | 102 +++++++++++++++++++++++++++++++------ util/proto/test/test.proto | 7 +++ 4 files changed, 163 insertions(+), 17 deletions(-) diff --git a/util/proto/marshal.go b/util/proto/marshal.go index 3200176..025d9b4 100644 --- a/util/proto/marshal.go +++ b/util/proto/marshal.go @@ -120,6 +120,14 @@ func Int32Size(field int, v int32) int { return UInt64Size(field, uint64(v)) } +func EnumMarshal(field int, buf []byte, v int32) (int, error) { + return UInt64Marshal(field, buf, uint64(v)) +} + +func EnumSize(field int, v int32) int { + return UInt64Size(field, uint64(v)) +} + // varUIntSize returns length of varint byte sequence for uint64 value 'x'. func VarUIntSize(x uint64) int { return (bits.Len64(x|1) + 6) / 7 diff --git a/util/proto/marshal_test.go b/util/proto/marshal_test.go index 0abcef9..6802523 100644 --- a/util/proto/marshal_test.go +++ b/util/proto/marshal_test.go @@ -10,6 +10,8 @@ import ( "github.com/stretchr/testify/require" ) +type SomeEnum int32 + type stablePrimitives struct { FieldA []byte FieldB string @@ -18,8 +20,15 @@ type stablePrimitives struct { FieldE uint32 FieldF int64 FieldG uint64 + FieldH SomeEnum } +const ( + ENUM_UNKNOWN SomeEnum = 0 + ENUM_POSITIVE = 1 + ENUM_NEGATIVE = -1 +) + func (s *stablePrimitives) stableMarshal(buf []byte, wrongField bool) ([]byte, error) { if s == nil { return []byte{}, nil @@ -103,6 +112,16 @@ func (s *stablePrimitives) stableMarshal(buf []byte, wrongField bool) ([]byte, e } i += offset + fieldNum = 300 + if wrongField { + fieldNum++ + } + offset, err = proto.EnumMarshal(fieldNum, buf, int32(s.FieldH)) + if err != nil { + return nil, errors.Wrap(err, "can't marshal field g") + } + i += offset + return buf, nil } @@ -113,7 +132,8 @@ func (s *stablePrimitives) stableSize() int { proto.Int32Size(201, s.FieldD) + proto.UInt32Size(202, s.FieldE) + proto.Int64Size(203, s.FieldF) + - proto.UInt64Size(204, s.FieldG) + proto.UInt64Size(204, s.FieldG) + + proto.EnumSize(300, int32(s.FieldH)) } func TestBytesMarshal(t *testing.T) { @@ -209,6 +229,14 @@ func TestUInt64Marshal(t *testing.T) { }) } +func TestEnumMarshal(t *testing.T) { + testEnumMarshal(t, ENUM_UNKNOWN, false) + testEnumMarshal(t, ENUM_POSITIVE, false) + testEnumMarshal(t, ENUM_POSITIVE, true) + testEnumMarshal(t, ENUM_NEGATIVE, false) + testEnumMarshal(t, ENUM_NEGATIVE, true) +} + func testBytesMarshal(t *testing.T, data []byte, wrongField bool) { var ( wire []byte @@ -398,3 +426,36 @@ func testUInt64Marshal(t *testing.T, n uint64, wrongField bool) { require.EqualValues(t, 0, result.FieldG) } } + +func testEnumMarshal(t *testing.T, e SomeEnum, wrongField bool) { + var ( + wire []byte + err error + + custom = stablePrimitives{FieldH: e} + transport = test.Primitives{FieldH: test.Primitives_SomeEnum(e)} + ) + + wire, err = custom.stableMarshal(nil, wrongField) + require.NoError(t, err) + + wireGen, err := transport.Marshal() + require.NoError(t, err) + + if !wrongField { + // we can check equality because single field cannot be unstable marshalled + require.Equal(t, wireGen, wire) + } else { + require.NotEqual(t, wireGen, wire) + } + + result := new(test.Primitives) + err = result.Unmarshal(wire) + require.NoError(t, err) + + if !wrongField { + require.EqualValues(t, custom.FieldH, result.FieldH) + } else { + require.EqualValues(t, 0, result.FieldH) + } +} diff --git a/util/proto/test/test.pb.go b/util/proto/test/test.pb.go index 6790854..0c31467 100644 --- a/util/proto/test/test.pb.go +++ b/util/proto/test/test.pb.go @@ -22,17 +22,46 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +type Primitives_SomeEnum int32 + +const ( + Primitives_UNKNOWN Primitives_SomeEnum = 0 + Primitives_POSITIVE Primitives_SomeEnum = 1 + Primitives_NEGATIVE Primitives_SomeEnum = -1 +) + +var Primitives_SomeEnum_name = map[int32]string{ + 0: "UNKNOWN", + 1: "POSITIVE", + -1: "NEGATIVE", +} + +var Primitives_SomeEnum_value = map[string]int32{ + "UNKNOWN": 0, + "POSITIVE": 1, + "NEGATIVE": -1, +} + +func (x Primitives_SomeEnum) String() string { + return proto.EnumName(Primitives_SomeEnum_name, int32(x)) +} + +func (Primitives_SomeEnum) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_998ad0e1a3de8558, []int{0, 0} +} + type Primitives struct { - FieldA []byte `protobuf:"bytes,1,opt,name=field_a,json=fieldA,proto3" json:"field_a,omitempty"` - FieldB string `protobuf:"bytes,2,opt,name=field_b,json=fieldB,proto3" json:"field_b,omitempty"` - FieldC bool `protobuf:"varint,200,opt,name=field_c,json=fieldC,proto3" json:"field_c,omitempty"` - FieldD int32 `protobuf:"varint,201,opt,name=field_d,json=fieldD,proto3" json:"field_d,omitempty"` - FieldE uint32 `protobuf:"varint,202,opt,name=field_e,json=fieldE,proto3" json:"field_e,omitempty"` - FieldF int64 `protobuf:"varint,203,opt,name=field_f,json=fieldF,proto3" json:"field_f,omitempty"` - FieldG uint64 `protobuf:"varint,204,opt,name=field_g,json=fieldG,proto3" json:"field_g,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + FieldA []byte `protobuf:"bytes,1,opt,name=field_a,json=fieldA,proto3" json:"field_a,omitempty"` + FieldB string `protobuf:"bytes,2,opt,name=field_b,json=fieldB,proto3" json:"field_b,omitempty"` + FieldC bool `protobuf:"varint,200,opt,name=field_c,json=fieldC,proto3" json:"field_c,omitempty"` + FieldD int32 `protobuf:"varint,201,opt,name=field_d,json=fieldD,proto3" json:"field_d,omitempty"` + FieldE uint32 `protobuf:"varint,202,opt,name=field_e,json=fieldE,proto3" json:"field_e,omitempty"` + FieldF int64 `protobuf:"varint,203,opt,name=field_f,json=fieldF,proto3" json:"field_f,omitempty"` + FieldG uint64 `protobuf:"varint,204,opt,name=field_g,json=fieldG,proto3" json:"field_g,omitempty"` + FieldH Primitives_SomeEnum `protobuf:"varint,300,opt,name=field_h,json=fieldH,proto3,enum=test.Primitives_SomeEnum" json:"field_h,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *Primitives) Reset() { *m = Primitives{} } @@ -117,26 +146,38 @@ func (m *Primitives) GetFieldG() uint64 { return 0 } +func (m *Primitives) GetFieldH() Primitives_SomeEnum { + if m != nil { + return m.FieldH + } + return Primitives_UNKNOWN +} + func init() { + proto.RegisterEnum("test.Primitives_SomeEnum", Primitives_SomeEnum_name, Primitives_SomeEnum_value) proto.RegisterType((*Primitives)(nil), "test.Primitives") } func init() { proto.RegisterFile("util/proto/test/test.proto", fileDescriptor_998ad0e1a3de8558) } var fileDescriptor_998ad0e1a3de8558 = []byte{ - // 178 bytes of a gzipped FileDescriptorProto + // 254 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x2a, 0x2d, 0xc9, 0xcc, 0xd1, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0xd7, 0x2f, 0x49, 0x2d, 0x2e, 0x01, 0x13, 0x7a, 0x60, 0xbe, - 0x10, 0x0b, 0x88, 0xad, 0x74, 0x80, 0x91, 0x8b, 0x2b, 0xa0, 0x28, 0x33, 0x37, 0xb3, 0x24, 0xb3, + 0x10, 0x0b, 0x88, 0xad, 0xb4, 0x99, 0x89, 0x8b, 0x2b, 0xa0, 0x28, 0x33, 0x37, 0xb3, 0x24, 0xb3, 0x2c, 0xb5, 0x58, 0x48, 0x9c, 0x8b, 0x3d, 0x2d, 0x33, 0x35, 0x27, 0x25, 0x3e, 0x51, 0x82, 0x51, 0x81, 0x51, 0x83, 0x27, 0x88, 0x0d, 0xcc, 0x75, 0x44, 0x48, 0x24, 0x49, 0x30, 0x29, 0x30, 0x6a, 0x70, 0x42, 0x25, 0x9c, 0x84, 0x24, 0x60, 0x12, 0xc9, 0x12, 0x27, 0x40, 0x5a, 0x38, 0xa0, 0x32, 0xce, 0x08, 0x99, 0x14, 0x89, 0x93, 0x20, 0x19, 0x56, 0xa8, 0x8c, 0x0b, 0x42, 0x26, 0x55, 0xe2, 0x14, 0x48, 0x86, 0x17, 0x2a, 0xe3, 0x8a, 0x90, 0x49, 0x93, 0x38, 0x0d, 0x92, 0x61, 0x86, 0xca, - 0xb8, 0x21, 0x64, 0xd2, 0x25, 0xce, 0x80, 0x64, 0x58, 0xa0, 0x32, 0xee, 0x4e, 0x02, 0x27, 0x1e, - 0xc9, 0x31, 0x5e, 0x78, 0x24, 0xc7, 0xf8, 0xe0, 0x91, 0x1c, 0xe3, 0x8c, 0xc7, 0x72, 0x0c, 0x49, - 0x6c, 0x60, 0x1f, 0x1a, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0xcc, 0xee, 0x55, 0x82, 0xff, 0x00, - 0x00, 0x00, + 0xb8, 0x21, 0x64, 0xd2, 0x25, 0xce, 0x80, 0x64, 0x58, 0xa0, 0x32, 0xee, 0x42, 0xc6, 0x30, 0x99, + 0x0c, 0x89, 0x35, 0x20, 0xb7, 0xf1, 0x19, 0x49, 0xea, 0x81, 0xfd, 0x89, 0xf0, 0x97, 0x5e, 0x70, + 0x7e, 0x6e, 0xaa, 0x6b, 0x5e, 0x69, 0x2e, 0x54, 0x93, 0x87, 0x92, 0x0d, 0x17, 0x07, 0x4c, 0x4c, + 0x88, 0x9b, 0x8b, 0x3d, 0xd4, 0xcf, 0xdb, 0xcf, 0x3f, 0xdc, 0x4f, 0x80, 0x41, 0x88, 0x87, 0x8b, + 0x23, 0xc0, 0x3f, 0xd8, 0x33, 0xc4, 0x33, 0xcc, 0x55, 0x80, 0x51, 0x48, 0x94, 0x8b, 0xc3, 0xcf, + 0xd5, 0xdd, 0x11, 0xcc, 0xfb, 0x0f, 0x03, 0x8c, 0x4e, 0x02, 0x27, 0x1e, 0xc9, 0x31, 0x5e, 0x78, + 0x24, 0xc7, 0xf8, 0xe0, 0x91, 0x1c, 0xe3, 0x8c, 0xc7, 0x72, 0x0c, 0x49, 0x6c, 0xe0, 0x40, 0x35, + 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0x10, 0xfa, 0xa0, 0xf4, 0x72, 0x01, 0x00, 0x00, } func (m *Primitives) Marshal() (dAtA []byte, err error) { @@ -163,6 +204,13 @@ func (m *Primitives) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } + if m.FieldH != 0 { + i = encodeVarintTest(dAtA, i, uint64(m.FieldH)) + i-- + dAtA[i] = 0x12 + i-- + dAtA[i] = 0xe0 + } if m.FieldG != 0 { i = encodeVarintTest(dAtA, i, uint64(m.FieldG)) i-- @@ -260,6 +308,9 @@ func (m *Primitives) Size() (n int) { if m.FieldG != 0 { n += 2 + sovTest(uint64(m.FieldG)) } + if m.FieldH != 0 { + n += 2 + sovTest(uint64(m.FieldH)) + } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -463,6 +514,25 @@ func (m *Primitives) Unmarshal(dAtA []byte) error { break } } + case 300: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field FieldH", wireType) + } + m.FieldH = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTest + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.FieldH |= Primitives_SomeEnum(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipTest(dAtA[iNdEx:]) diff --git a/util/proto/test/test.proto b/util/proto/test/test.proto index d3b43e6..5aed2b2 100644 --- a/util/proto/test/test.proto +++ b/util/proto/test/test.proto @@ -10,4 +10,11 @@ message Primitives { uint32 field_e = 202; int64 field_f = 203; uint64 field_g = 204; + + enum SomeEnum { + UNKNOWN = 0; + POSITIVE = 1; + NEGATIVE = -1; + } + SomeEnum field_h = 300; } \ No newline at end of file From a68252c9562bed733391ca01c9e8b1538955cbb4 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Fri, 14 Aug 2020 17:22:47 +0300 Subject: [PATCH 0284/1196] Add stable marshal helpers for repeated fields Signed-off-by: Alex Vanin --- util/proto/marshal.go | 159 +++++++++ util/proto/marshal_test.go | 467 +++++++++++++++++++------ util/proto/test/test.pb.go | 693 ++++++++++++++++++++++++++++++++++++- util/proto/test/test.proto | 9 + 4 files changed, 1217 insertions(+), 111 deletions(-) diff --git a/util/proto/marshal.go b/util/proto/marshal.go index 025d9b4..cc055a5 100644 --- a/util/proto/marshal.go +++ b/util/proto/marshal.go @@ -128,6 +128,165 @@ func EnumSize(field int, v int32) int { return UInt64Size(field, uint64(v)) } +func RepeatedBytesMarshal(field int, buf []byte, v [][]byte) (int, error) { + var offset int + + for i := range v { + off, err := BytesMarshal(field, buf[offset:], v[i]) + if err != nil { + return 0, err + } + + offset += off + } + + return offset, nil +} + +func RepeatedBytesSize(field int, v [][]byte) (size int) { + for i := range v { + size += BytesSize(field, v[i]) + } + + return size +} + +func RepeatedStringMarshal(field int, buf []byte, v []string) (int, error) { + var offset int + + for i := range v { + off, err := StringMarshal(field, buf[offset:], v[i]) + if err != nil { + return 0, err + } + + offset += off + } + + return offset, nil +} + +func RepeatedStringSize(field int, v []string) (size int) { + for i := range v { + size += StringSize(field, v[i]) + } + + return size +} + +func RepeatedUInt64Marshal(field int, buf []byte, v []uint64) (int, error) { + if len(v) == 0 { + return 0, nil + } + + prefix := field<<3 | 0x02 + offset := binary.PutUvarint(buf, uint64(prefix)) + + _, arrSize := RepeatedUInt64Size(field, v) + offset += binary.PutUvarint(buf[offset:], uint64(arrSize)) + for i := range v { + offset += binary.PutUvarint(buf[offset:], v[i]) + } + + return offset, nil +} + +func RepeatedUInt64Size(field int, v []uint64) (size, arraySize int) { + if len(v) == 0 { + return 0, 0 + } + + for i := range v { + size += VarUIntSize(v[i]) + } + arraySize = size + + size += VarUIntSize(uint64(size)) + + prefix := field<<3 | 0x2 + size += VarUIntSize(uint64(prefix)) + + return size, arraySize +} + +func RepeatedInt64Marshal(field int, buf []byte, v []int64) (int, error) { + if len(v) == 0 { + return 0, nil + } + + convert := make([]uint64, len(v)) + for i := range v { + convert[i] = uint64(v[i]) + } + + return RepeatedUInt64Marshal(field, buf, convert) +} + +func RepeatedInt64Size(field int, v []int64) (size, arraySize int) { + if len(v) == 0 { + return 0, 0 + } + + convert := make([]uint64, len(v)) + for i := range v { + convert[i] = uint64(v[i]) + } + + return RepeatedUInt64Size(field, convert) +} + +func RepeatedUInt32Marshal(field int, buf []byte, v []uint32) (int, error) { + if len(v) == 0 { + return 0, nil + } + + convert := make([]uint64, len(v)) + for i := range v { + convert[i] = uint64(v[i]) + } + + return RepeatedUInt64Marshal(field, buf, convert) +} + +func RepeatedUInt32Size(field int, v []uint32) (size, arraySize int) { + if len(v) == 0 { + return 0, 0 + } + + convert := make([]uint64, len(v)) + for i := range v { + convert[i] = uint64(v[i]) + } + + return RepeatedUInt64Size(field, convert) +} + +func RepeatedInt32Marshal(field int, buf []byte, v []int32) (int, error) { + if len(v) == 0 { + return 0, nil + } + + convert := make([]uint64, len(v)) + for i := range v { + convert[i] = uint64(v[i]) + } + + return RepeatedUInt64Marshal(field, buf, convert) +} + +func RepeatedInt32Size(field int, v []int32) (size, arraySize int) { + if len(v) == 0 { + return 0, 0 + } + + convert := make([]uint64, len(v)) + for i := range v { + convert[i] = uint64(v[i]) + } + + return RepeatedUInt64Size(field, convert) +} + // varUIntSize returns length of varint byte sequence for uint64 value 'x'. func VarUIntSize(x uint64) int { return (bits.Len64(x|1) + 6) / 7 diff --git a/util/proto/marshal_test.go b/util/proto/marshal_test.go index 6802523..de7b1ca 100644 --- a/util/proto/marshal_test.go +++ b/util/proto/marshal_test.go @@ -23,6 +23,15 @@ type stablePrimitives struct { FieldH SomeEnum } +type stableRepPrimitives struct { + FieldA [][]byte + FieldB []string + FieldC []int32 + FieldD []uint32 + FieldE []int64 + FieldF []uint64 +} + const ( ENUM_UNKNOWN SomeEnum = 0 ENUM_POSITIVE = 1 @@ -118,7 +127,7 @@ func (s *stablePrimitives) stableMarshal(buf []byte, wrongField bool) ([]byte, e } offset, err = proto.EnumMarshal(fieldNum, buf, int32(s.FieldH)) if err != nil { - return nil, errors.Wrap(err, "can't marshal field g") + return nil, errors.Wrap(err, "can't marshal field h") } i += offset @@ -136,6 +145,93 @@ func (s *stablePrimitives) stableSize() int { proto.EnumSize(300, int32(s.FieldH)) } +func (s *stableRepPrimitives) stableMarshal(buf []byte, wrongField bool) ([]byte, error) { + if s == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, s.stableSize()) + } + + var ( + i, offset, fieldNum int + ) + + fieldNum = 1 + if wrongField { + fieldNum++ + } + offset, err := proto.RepeatedBytesMarshal(fieldNum, buf, s.FieldA) + if err != nil { + return nil, errors.Wrap(err, "can't marshal field a") + } + i += offset + + fieldNum = 2 + if wrongField { + fieldNum++ + } + offset, err = proto.RepeatedStringMarshal(fieldNum, buf, s.FieldB) + if err != nil { + return nil, errors.Wrap(err, "can't marshal field b") + } + i += offset + + fieldNum = 3 + if wrongField { + fieldNum++ + } + offset, err = proto.RepeatedInt32Marshal(fieldNum, buf, s.FieldC) + if err != nil { + return nil, errors.Wrap(err, "can't marshal field c") + } + i += offset + + fieldNum = 4 + if wrongField { + fieldNum++ + } + offset, err = proto.RepeatedUInt32Marshal(fieldNum, buf, s.FieldD) + if err != nil { + return nil, errors.Wrap(err, "can't marshal field d") + } + i += offset + + fieldNum = 5 + if wrongField { + fieldNum++ + } + offset, err = proto.RepeatedInt64Marshal(fieldNum, buf, s.FieldE) + if err != nil { + return nil, errors.Wrap(err, "can't marshal field e") + } + i += offset + + fieldNum = 6 + if wrongField { + fieldNum++ + } + offset, err = proto.RepeatedUInt64Marshal(fieldNum, buf, s.FieldF) + if err != nil { + return nil, errors.Wrap(err, "can't marshal field f") + } + i += offset + + return buf, nil +} + +func (s *stableRepPrimitives) stableSize() int { + f1 := proto.RepeatedBytesSize(1, s.FieldA) + f2 := proto.RepeatedStringSize(2, s.FieldB) + f3, _ := proto.RepeatedInt32Size(3, s.FieldC) + f4, _ := proto.RepeatedUInt32Size(4, s.FieldD) + f5, _ := proto.RepeatedInt64Size(5, s.FieldE) + f6, _ := proto.RepeatedUInt64Size(6, s.FieldF) + + return f1 + f2 + f3 + f4 + f5 + f6 +} + func TestBytesMarshal(t *testing.T) { t.Run("not empty", func(t *testing.T) { data := []byte("Hello World") @@ -237,112 +333,103 @@ func TestEnumMarshal(t *testing.T) { testEnumMarshal(t, ENUM_NEGATIVE, true) } -func testBytesMarshal(t *testing.T, data []byte, wrongField bool) { - var ( - wire []byte - err error +func TestRepeatedBytesMarshal(t *testing.T) { + t.Run("not empty", func(t *testing.T) { + data := [][]byte{[]byte("One"), []byte("Two"), []byte("Three")} + testRepeatedBytesMarshal(t, data, false) + testRepeatedBytesMarshal(t, data, true) + }) - custom = stablePrimitives{FieldA: data} - transport = test.Primitives{FieldA: data} - ) + t.Run("empty", func(t *testing.T) { + testRepeatedBytesMarshal(t, [][]byte{}, false) + }) - wire, err = custom.stableMarshal(nil, wrongField) - require.NoError(t, err) - - wireGen, err := transport.Marshal() - require.NoError(t, err) - - if !wrongField { - // we can check equality because single field cannot be unstable marshalled - require.Equal(t, wireGen, wire) - } else { - require.NotEqual(t, wireGen, wire) - } - - result := new(test.Primitives) - err = result.Unmarshal(wire) - require.NoError(t, err) - - if !wrongField { - require.Len(t, result.FieldA, len(data)) - if len(data) > 0 { - require.Equal(t, data, result.FieldA) - } - } else { - require.Len(t, result.FieldA, 0) - } + t.Run("nil", func(t *testing.T) { + testRepeatedBytesMarshal(t, nil, false) + }) } -func testStringMarshal(t *testing.T, s string, wrongField bool) { - var ( - wire []byte - err error +func TestRepeatedStringMarshal(t *testing.T) { + t.Run("not empty", func(t *testing.T) { + data := []string{"One", "Two", "Three"} + testRepeatedStringMarshal(t, data, false) + testRepeatedStringMarshal(t, data, true) + }) - custom = stablePrimitives{FieldB: s} - transport = test.Primitives{FieldB: s} - ) + t.Run("empty", func(t *testing.T) { + testRepeatedStringMarshal(t, []string{}, false) + }) - wire, err = custom.stableMarshal(nil, wrongField) - require.NoError(t, err) - - wireGen, err := transport.Marshal() - require.NoError(t, err) - - if !wrongField { - // we can check equality because single field cannot be unstable marshalled - require.Equal(t, wireGen, wire) - } else { - require.NotEqual(t, wireGen, wire) - } - - result := new(test.Primitives) - err = result.Unmarshal(wire) - require.NoError(t, err) - - if !wrongField { - require.Len(t, result.FieldB, len(s)) - if len(s) > 0 { - require.Equal(t, s, result.FieldB) - } - } else { - require.Len(t, result.FieldB, 0) - } + t.Run("nil", func(t *testing.T) { + testRepeatedStringMarshal(t, nil, false) + }) } -func testBoolMarshal(t *testing.T, b bool, wrongField bool) { - var ( - wire []byte - err error +func TestRepeatedInt32Marshal(t *testing.T) { + t.Run("not empty", func(t *testing.T) { + data := []int32{-1, 0, 1, 2, 3, 4, 5} + testRepeatedInt32Marshal(t, data, false) + testRepeatedInt32Marshal(t, data, true) + }) - custom = stablePrimitives{FieldC: b} - transport = test.Primitives{FieldC: b} - ) + t.Run("empty", func(t *testing.T) { + testRepeatedInt32Marshal(t, []int32{}, false) + }) - wire, err = custom.stableMarshal(nil, wrongField) - require.NoError(t, err) - - wireGen, err := transport.Marshal() - require.NoError(t, err) - - if !wrongField { - // we can check equality because single field cannot be unstable marshalled - require.Equal(t, wireGen, wire) - } else { - require.NotEqual(t, wireGen, wire) - } - - result := new(test.Primitives) - err = result.Unmarshal(wire) - require.NoError(t, err) - - if !wrongField { - require.Equal(t, b, result.FieldC) - } else { - require.False(t, false, result.FieldC) - } + t.Run("nil", func(t *testing.T) { + testRepeatedInt32Marshal(t, nil, false) + }) } -func testIntMarshal(t *testing.T, c stablePrimitives, tr test.Primitives, wrongField bool) *test.Primitives { +func TestRepeatedUInt32Marshal(t *testing.T) { + t.Run("not empty", func(t *testing.T) { + data := []uint32{0, 1, 2, 3, 4, 5} + testRepeatedUInt32Marshal(t, data, false) + testRepeatedUInt32Marshal(t, data, true) + }) + + t.Run("empty", func(t *testing.T) { + testRepeatedUInt32Marshal(t, []uint32{}, false) + }) + + t.Run("nil", func(t *testing.T) { + testRepeatedUInt32Marshal(t, nil, false) + }) +} + +func TestRepeatedInt64Marshal(t *testing.T) { + t.Run("not empty", func(t *testing.T) { + data := []int64{-1, 0, 1, 2, 3, 4, 5} + testRepeatedInt64Marshal(t, data, false) + testRepeatedInt64Marshal(t, data, true) + }) + + t.Run("empty", func(t *testing.T) { + testRepeatedInt64Marshal(t, []int64{}, false) + }) + + t.Run("nil", func(t *testing.T) { + testRepeatedInt64Marshal(t, nil, false) + }) +} + +func TestRepeatedUInt64Marshal(t *testing.T) { + t.Run("not empty", func(t *testing.T) { + data := []uint64{0, 1, 2, 3, 4, 5} + testRepeatedUInt64Marshal(t, data, false) + testRepeatedUInt64Marshal(t, data, true) + }) + + t.Run("empty", func(t *testing.T) { + testRepeatedUInt64Marshal(t, []uint64{}, false) + }) + + t.Run("nil", func(t *testing.T) { + testRepeatedUInt64Marshal(t, nil, false) + }) +} + +func testMarshal(t *testing.T, c stablePrimitives, tr test.Primitives, wrongField bool) *test.Primitives { var ( wire []byte err error @@ -367,13 +454,64 @@ func testIntMarshal(t *testing.T, c stablePrimitives, tr test.Primitives, wrongF return result } +func testBytesMarshal(t *testing.T, data []byte, wrongField bool) { + var ( + custom = stablePrimitives{FieldA: data} + transport = test.Primitives{FieldA: data} + ) + + result := testMarshal(t, custom, transport, wrongField) + + if !wrongField { + require.Len(t, result.FieldA, len(data)) + if len(data) > 0 { + require.Equal(t, data, result.FieldA) + } + } else { + require.Len(t, result.FieldA, 0) + } +} + +func testStringMarshal(t *testing.T, s string, wrongField bool) { + var ( + custom = stablePrimitives{FieldB: s} + transport = test.Primitives{FieldB: s} + ) + + result := testMarshal(t, custom, transport, wrongField) + + if !wrongField { + require.Len(t, result.FieldB, len(s)) + if len(s) > 0 { + require.Equal(t, s, result.FieldB) + } + } else { + require.Len(t, result.FieldB, 0) + } +} + +func testBoolMarshal(t *testing.T, b bool, wrongField bool) { + var ( + custom = stablePrimitives{FieldC: b} + transport = test.Primitives{FieldC: b} + ) + + result := testMarshal(t, custom, transport, wrongField) + + if !wrongField { + require.Equal(t, b, result.FieldC) + } else { + require.False(t, false, result.FieldC) + } +} + func testInt32Marshal(t *testing.T, n int32, wrongField bool) { var ( custom = stablePrimitives{FieldD: n} transport = test.Primitives{FieldD: n} ) - result := testIntMarshal(t, custom, transport, wrongField) + result := testMarshal(t, custom, transport, wrongField) if !wrongField { require.Equal(t, n, result.FieldD) @@ -388,7 +526,7 @@ func testUInt32Marshal(t *testing.T, n uint32, wrongField bool) { transport = test.Primitives{FieldE: n} ) - result := testIntMarshal(t, custom, transport, wrongField) + result := testMarshal(t, custom, transport, wrongField) if !wrongField { require.Equal(t, n, result.FieldE) @@ -403,7 +541,7 @@ func testInt64Marshal(t *testing.T, n int64, wrongField bool) { transport = test.Primitives{FieldF: n} ) - result := testIntMarshal(t, custom, transport, wrongField) + result := testMarshal(t, custom, transport, wrongField) if !wrongField { require.Equal(t, n, result.FieldF) @@ -418,7 +556,7 @@ func testUInt64Marshal(t *testing.T, n uint64, wrongField bool) { transport = test.Primitives{FieldG: n} ) - result := testIntMarshal(t, custom, transport, wrongField) + result := testMarshal(t, custom, transport, wrongField) if !wrongField { require.Equal(t, n, result.FieldG) @@ -429,17 +567,28 @@ func testUInt64Marshal(t *testing.T, n uint64, wrongField bool) { func testEnumMarshal(t *testing.T, e SomeEnum, wrongField bool) { var ( - wire []byte - err error - custom = stablePrimitives{FieldH: e} transport = test.Primitives{FieldH: test.Primitives_SomeEnum(e)} ) - wire, err = custom.stableMarshal(nil, wrongField) + result := testMarshal(t, custom, transport, wrongField) + + if !wrongField { + require.EqualValues(t, custom.FieldH, result.FieldH) + } else { + require.EqualValues(t, 0, result.FieldH) + } +} + +func testRepMarshal(t *testing.T, c stableRepPrimitives, tr test.RepPrimitives, wrongField bool) *test.RepPrimitives { + var ( + wire []byte + err error + ) + wire, err = c.stableMarshal(nil, wrongField) require.NoError(t, err) - wireGen, err := transport.Marshal() + wireGen, err := tr.Marshal() require.NoError(t, err) if !wrongField { @@ -449,13 +598,117 @@ func testEnumMarshal(t *testing.T, e SomeEnum, wrongField bool) { require.NotEqual(t, wireGen, wire) } - result := new(test.Primitives) + result := new(test.RepPrimitives) err = result.Unmarshal(wire) require.NoError(t, err) + return result +} + +func testRepeatedBytesMarshal(t *testing.T, data [][]byte, wrongField bool) { + var ( + custom = stableRepPrimitives{FieldA: data} + transport = test.RepPrimitives{FieldA: data} + ) + + result := testRepMarshal(t, custom, transport, wrongField) + if !wrongField { - require.EqualValues(t, custom.FieldH, result.FieldH) + require.Len(t, result.FieldA, len(data)) + if len(data) > 0 { + require.Equal(t, data, result.FieldA) + } } else { - require.EqualValues(t, 0, result.FieldH) + require.Len(t, result.FieldA, 0) + } +} + +func testRepeatedStringMarshal(t *testing.T, s []string, wrongField bool) { + var ( + custom = stableRepPrimitives{FieldB: s} + transport = test.RepPrimitives{FieldB: s} + ) + + result := testRepMarshal(t, custom, transport, wrongField) + + if !wrongField { + require.Len(t, result.FieldB, len(s)) + if len(s) > 0 { + require.Equal(t, s, result.FieldB) + } + } else { + require.Len(t, result.FieldB, 0) + } +} + +func testRepeatedInt32Marshal(t *testing.T, n []int32, wrongField bool) { + var ( + custom = stableRepPrimitives{FieldC: n} + transport = test.RepPrimitives{FieldC: n} + ) + + result := testRepMarshal(t, custom, transport, wrongField) + + if !wrongField { + require.Len(t, result.FieldC, len(n)) + if len(n) > 0 { + require.Equal(t, n, result.FieldC) + } + } else { + require.Len(t, result.FieldC, 0) + } +} + +func testRepeatedUInt32Marshal(t *testing.T, n []uint32, wrongField bool) { + var ( + custom = stableRepPrimitives{FieldD: n} + transport = test.RepPrimitives{FieldD: n} + ) + + result := testRepMarshal(t, custom, transport, wrongField) + + if !wrongField { + require.Len(t, result.FieldD, len(n)) + if len(n) > 0 { + require.Equal(t, n, result.FieldD) + } + } else { + require.Len(t, result.FieldD, 0) + } +} + +func testRepeatedInt64Marshal(t *testing.T, n []int64, wrongField bool) { + var ( + custom = stableRepPrimitives{FieldE: n} + transport = test.RepPrimitives{FieldE: n} + ) + + result := testRepMarshal(t, custom, transport, wrongField) + + if !wrongField { + require.Len(t, result.FieldE, len(n)) + if len(n) > 0 { + require.Equal(t, n, result.FieldE) + } + } else { + require.Len(t, result.FieldE, 0) + } +} + +func testRepeatedUInt64Marshal(t *testing.T, n []uint64, wrongField bool) { + var ( + custom = stableRepPrimitives{FieldF: n} + transport = test.RepPrimitives{FieldF: n} + ) + + result := testRepMarshal(t, custom, transport, wrongField) + + if !wrongField { + require.Len(t, result.FieldF, len(n)) + if len(n) > 0 { + require.Equal(t, n, result.FieldF) + } + } else { + require.Len(t, result.FieldF, 0) } } diff --git a/util/proto/test/test.pb.go b/util/proto/test/test.pb.go index 0c31467..686ef72 100644 --- a/util/proto/test/test.pb.go +++ b/util/proto/test/test.pb.go @@ -153,15 +153,103 @@ func (m *Primitives) GetFieldH() Primitives_SomeEnum { return Primitives_UNKNOWN } +type RepPrimitives struct { + FieldA [][]byte `protobuf:"bytes,1,rep,name=field_a,json=fieldA,proto3" json:"field_a,omitempty"` + FieldB []string `protobuf:"bytes,2,rep,name=field_b,json=fieldB,proto3" json:"field_b,omitempty"` + FieldC []int32 `protobuf:"varint,3,rep,packed,name=field_c,json=fieldC,proto3" json:"field_c,omitempty"` + FieldD []uint32 `protobuf:"varint,4,rep,packed,name=field_d,json=fieldD,proto3" json:"field_d,omitempty"` + FieldE []int64 `protobuf:"varint,5,rep,packed,name=field_e,json=fieldE,proto3" json:"field_e,omitempty"` + FieldF []uint64 `protobuf:"varint,6,rep,packed,name=field_f,json=fieldF,proto3" json:"field_f,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *RepPrimitives) Reset() { *m = RepPrimitives{} } +func (m *RepPrimitives) String() string { return proto.CompactTextString(m) } +func (*RepPrimitives) ProtoMessage() {} +func (*RepPrimitives) Descriptor() ([]byte, []int) { + return fileDescriptor_998ad0e1a3de8558, []int{1} +} +func (m *RepPrimitives) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RepPrimitives) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_RepPrimitives.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *RepPrimitives) XXX_Merge(src proto.Message) { + xxx_messageInfo_RepPrimitives.Merge(m, src) +} +func (m *RepPrimitives) XXX_Size() int { + return m.Size() +} +func (m *RepPrimitives) XXX_DiscardUnknown() { + xxx_messageInfo_RepPrimitives.DiscardUnknown(m) +} + +var xxx_messageInfo_RepPrimitives proto.InternalMessageInfo + +func (m *RepPrimitives) GetFieldA() [][]byte { + if m != nil { + return m.FieldA + } + return nil +} + +func (m *RepPrimitives) GetFieldB() []string { + if m != nil { + return m.FieldB + } + return nil +} + +func (m *RepPrimitives) GetFieldC() []int32 { + if m != nil { + return m.FieldC + } + return nil +} + +func (m *RepPrimitives) GetFieldD() []uint32 { + if m != nil { + return m.FieldD + } + return nil +} + +func (m *RepPrimitives) GetFieldE() []int64 { + if m != nil { + return m.FieldE + } + return nil +} + +func (m *RepPrimitives) GetFieldF() []uint64 { + if m != nil { + return m.FieldF + } + return nil +} + func init() { proto.RegisterEnum("test.Primitives_SomeEnum", Primitives_SomeEnum_name, Primitives_SomeEnum_value) proto.RegisterType((*Primitives)(nil), "test.Primitives") + proto.RegisterType((*RepPrimitives)(nil), "test.RepPrimitives") } func init() { proto.RegisterFile("util/proto/test/test.proto", fileDescriptor_998ad0e1a3de8558) } var fileDescriptor_998ad0e1a3de8558 = []byte{ - // 254 bytes of a gzipped FileDescriptorProto + // 312 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x2a, 0x2d, 0xc9, 0xcc, 0xd1, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0xd7, 0x2f, 0x49, 0x2d, 0x2e, 0x01, 0x13, 0x7a, 0x60, 0xbe, 0x10, 0x0b, 0x88, 0xad, 0xb4, 0x99, 0x89, 0x8b, 0x2b, 0xa0, 0x28, 0x33, 0x37, 0xb3, 0x24, 0xb3, @@ -175,9 +263,13 @@ var fileDescriptor_998ad0e1a3de8558 = []byte{ 0x7e, 0x6e, 0xaa, 0x6b, 0x5e, 0x69, 0x2e, 0x54, 0x93, 0x87, 0x92, 0x0d, 0x17, 0x07, 0x4c, 0x4c, 0x88, 0x9b, 0x8b, 0x3d, 0xd4, 0xcf, 0xdb, 0xcf, 0x3f, 0xdc, 0x4f, 0x80, 0x41, 0x88, 0x87, 0x8b, 0x23, 0xc0, 0x3f, 0xd8, 0x33, 0xc4, 0x33, 0xcc, 0x55, 0x80, 0x51, 0x48, 0x94, 0x8b, 0xc3, 0xcf, - 0xd5, 0xdd, 0x11, 0xcc, 0xfb, 0x0f, 0x03, 0x8c, 0x4e, 0x02, 0x27, 0x1e, 0xc9, 0x31, 0x5e, 0x78, - 0x24, 0xc7, 0xf8, 0xe0, 0x91, 0x1c, 0xe3, 0x8c, 0xc7, 0x72, 0x0c, 0x49, 0x6c, 0xe0, 0x40, 0x35, - 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0x10, 0xfa, 0xa0, 0xf4, 0x72, 0x01, 0x00, 0x00, + 0xd5, 0xdd, 0x11, 0xcc, 0xfb, 0x0f, 0x03, 0x8c, 0x4a, 0x4b, 0x19, 0xb9, 0x78, 0x83, 0x52, 0x0b, + 0x70, 0x05, 0x1c, 0x33, 0xae, 0x80, 0x63, 0x46, 0x0a, 0x38, 0x71, 0x44, 0xc0, 0x31, 0x2b, 0x30, + 0xc3, 0x43, 0xc7, 0x19, 0x21, 0x91, 0x22, 0xc1, 0xa2, 0xc0, 0x0c, 0x0f, 0x1c, 0x17, 0x84, 0x44, + 0xaa, 0x04, 0xab, 0x02, 0x33, 0x3c, 0x6c, 0x5c, 0x11, 0x12, 0x69, 0x12, 0x6c, 0x0a, 0xcc, 0xf0, + 0xa0, 0x71, 0x73, 0x12, 0x38, 0xf1, 0x48, 0x8e, 0xf1, 0xc2, 0x23, 0x39, 0xc6, 0x07, 0x8f, 0xe4, + 0x18, 0x67, 0x3c, 0x96, 0x63, 0x48, 0x62, 0x03, 0x47, 0xbe, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, + 0x56, 0x51, 0xcb, 0xb3, 0x1a, 0x02, 0x00, 0x00, } func (m *Primitives) Marshal() (dAtA []byte, err error) { @@ -268,6 +360,125 @@ func (m *Primitives) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *RepPrimitives) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *RepPrimitives) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RepPrimitives) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.FieldF) > 0 { + dAtA2 := make([]byte, len(m.FieldF)*10) + var j1 int + for _, num := range m.FieldF { + for num >= 1<<7 { + dAtA2[j1] = uint8(uint64(num)&0x7f | 0x80) + num >>= 7 + j1++ + } + dAtA2[j1] = uint8(num) + j1++ + } + i -= j1 + copy(dAtA[i:], dAtA2[:j1]) + i = encodeVarintTest(dAtA, i, uint64(j1)) + i-- + dAtA[i] = 0x32 + } + if len(m.FieldE) > 0 { + dAtA4 := make([]byte, len(m.FieldE)*10) + var j3 int + for _, num1 := range m.FieldE { + num := uint64(num1) + for num >= 1<<7 { + dAtA4[j3] = uint8(uint64(num)&0x7f | 0x80) + num >>= 7 + j3++ + } + dAtA4[j3] = uint8(num) + j3++ + } + i -= j3 + copy(dAtA[i:], dAtA4[:j3]) + i = encodeVarintTest(dAtA, i, uint64(j3)) + i-- + dAtA[i] = 0x2a + } + if len(m.FieldD) > 0 { + dAtA6 := make([]byte, len(m.FieldD)*10) + var j5 int + for _, num := range m.FieldD { + for num >= 1<<7 { + dAtA6[j5] = uint8(uint64(num)&0x7f | 0x80) + num >>= 7 + j5++ + } + dAtA6[j5] = uint8(num) + j5++ + } + i -= j5 + copy(dAtA[i:], dAtA6[:j5]) + i = encodeVarintTest(dAtA, i, uint64(j5)) + i-- + dAtA[i] = 0x22 + } + if len(m.FieldC) > 0 { + dAtA8 := make([]byte, len(m.FieldC)*10) + var j7 int + for _, num1 := range m.FieldC { + num := uint64(num1) + for num >= 1<<7 { + dAtA8[j7] = uint8(uint64(num)&0x7f | 0x80) + num >>= 7 + j7++ + } + dAtA8[j7] = uint8(num) + j7++ + } + i -= j7 + copy(dAtA[i:], dAtA8[:j7]) + i = encodeVarintTest(dAtA, i, uint64(j7)) + i-- + dAtA[i] = 0x1a + } + if len(m.FieldB) > 0 { + for iNdEx := len(m.FieldB) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.FieldB[iNdEx]) + copy(dAtA[i:], m.FieldB[iNdEx]) + i = encodeVarintTest(dAtA, i, uint64(len(m.FieldB[iNdEx]))) + i-- + dAtA[i] = 0x12 + } + } + if len(m.FieldA) > 0 { + for iNdEx := len(m.FieldA) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.FieldA[iNdEx]) + copy(dAtA[i:], m.FieldA[iNdEx]) + i = encodeVarintTest(dAtA, i, uint64(len(m.FieldA[iNdEx]))) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + func encodeVarintTest(dAtA []byte, offset int, v uint64) int { offset -= sovTest(v) base := offset @@ -317,6 +528,58 @@ func (m *Primitives) Size() (n int) { return n } +func (m *RepPrimitives) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.FieldA) > 0 { + for _, b := range m.FieldA { + l = len(b) + n += 1 + l + sovTest(uint64(l)) + } + } + if len(m.FieldB) > 0 { + for _, s := range m.FieldB { + l = len(s) + n += 1 + l + sovTest(uint64(l)) + } + } + if len(m.FieldC) > 0 { + l = 0 + for _, e := range m.FieldC { + l += sovTest(uint64(e)) + } + n += 1 + sovTest(uint64(l)) + l + } + if len(m.FieldD) > 0 { + l = 0 + for _, e := range m.FieldD { + l += sovTest(uint64(e)) + } + n += 1 + sovTest(uint64(l)) + l + } + if len(m.FieldE) > 0 { + l = 0 + for _, e := range m.FieldE { + l += sovTest(uint64(e)) + } + n += 1 + sovTest(uint64(l)) + l + } + if len(m.FieldF) > 0 { + l = 0 + for _, e := range m.FieldF { + l += sovTest(uint64(e)) + } + n += 1 + sovTest(uint64(l)) + l + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + func sovTest(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -558,6 +821,428 @@ func (m *Primitives) Unmarshal(dAtA []byte) error { } return nil } +func (m *RepPrimitives) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTest + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: RepPrimitives: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RepPrimitives: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FieldA", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTest + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTest + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTest + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.FieldA = append(m.FieldA, make([]byte, postIndex-iNdEx)) + copy(m.FieldA[len(m.FieldA)-1], dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FieldB", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTest + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTest + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTest + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.FieldB = append(m.FieldB, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 3: + if wireType == 0 { + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTest + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.FieldC = append(m.FieldC, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTest + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLengthTest + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLengthTest + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.FieldC) == 0 { + m.FieldC = make([]int32, 0, elementCount) + } + for iNdEx < postIndex { + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTest + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.FieldC = append(m.FieldC, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field FieldC", wireType) + } + case 4: + if wireType == 0 { + var v uint32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTest + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.FieldD = append(m.FieldD, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTest + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLengthTest + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLengthTest + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.FieldD) == 0 { + m.FieldD = make([]uint32, 0, elementCount) + } + for iNdEx < postIndex { + var v uint32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTest + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.FieldD = append(m.FieldD, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field FieldD", wireType) + } + case 5: + if wireType == 0 { + var v int64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTest + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.FieldE = append(m.FieldE, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTest + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLengthTest + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLengthTest + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.FieldE) == 0 { + m.FieldE = make([]int64, 0, elementCount) + } + for iNdEx < postIndex { + var v int64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTest + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.FieldE = append(m.FieldE, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field FieldE", wireType) + } + case 6: + if wireType == 0 { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTest + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.FieldF = append(m.FieldF, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTest + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLengthTest + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLengthTest + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.FieldF) == 0 { + m.FieldF = make([]uint64, 0, elementCount) + } + for iNdEx < postIndex { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTest + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.FieldF = append(m.FieldF, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field FieldF", wireType) + } + default: + iNdEx = preIndex + skippy, err := skipTest(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTest + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTest + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipTest(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/util/proto/test/test.proto b/util/proto/test/test.proto index 5aed2b2..8170b87 100644 --- a/util/proto/test/test.proto +++ b/util/proto/test/test.proto @@ -17,4 +17,13 @@ message Primitives { NEGATIVE = -1; } SomeEnum field_h = 300; +} + +message RepPrimitives { + repeated bytes field_a = 1; + repeated string field_b = 2; + repeated int32 field_c = 3; + repeated uint32 field_d = 4; + repeated int64 field_e = 5; + repeated uint64 field_f = 6; } \ No newline at end of file From 1b262fc07247a5e31321be2355006fc6c94f757d Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 17 Aug 2020 12:03:52 +0300 Subject: [PATCH 0285/1196] v2/refs: Implement remaining uni-structures Signed-off-by: Leonard Lyubich --- v2/refs/owner.go | 19 ----------- v2/refs/types.go | 89 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 89 insertions(+), 19 deletions(-) delete mode 100644 v2/refs/owner.go create mode 100644 v2/refs/types.go diff --git a/v2/refs/owner.go b/v2/refs/owner.go deleted file mode 100644 index acaa692..0000000 --- a/v2/refs/owner.go +++ /dev/null @@ -1,19 +0,0 @@ -package refs - -type OwnerID struct { - val []byte -} - -func (o *OwnerID) GetValue() []byte { - if o != nil { - return o.val - } - - return nil -} - -func (o *OwnerID) SetValue(v []byte) { - if o != nil { - o.val = v - } -} diff --git a/v2/refs/types.go b/v2/refs/types.go new file mode 100644 index 0000000..dd21c44 --- /dev/null +++ b/v2/refs/types.go @@ -0,0 +1,89 @@ +package refs + +type OwnerID struct { + val []byte +} + +type ContainerID struct { + val []byte +} + +type ObjectID struct { + val []byte +} + +type Address struct { + cid *ContainerID + + oid *ObjectID +} + +func (o *OwnerID) GetValue() []byte { + if o != nil { + return o.val + } + + return nil +} + +func (o *OwnerID) SetValue(v []byte) { + if o != nil { + o.val = v + } +} + +func (o *ContainerID) GetValue() []byte { + if o != nil { + return o.val + } + + return nil +} + +func (o *ContainerID) SetValue(v []byte) { + if o != nil { + o.val = v + } +} + +func (o *ObjectID) GetValue() []byte { + if o != nil { + return o.val + } + + return nil +} + +func (o *ObjectID) SetValue(v []byte) { + if o != nil { + o.val = v + } +} + +func (a *Address) GetContainerID() *ContainerID { + if a != nil { + return a.cid + } + + return nil +} + +func (a *Address) SetContainerID(v *ContainerID) { + if a != nil { + a.cid = v + } +} + +func (a *Address) GetObjectID() *ObjectID { + if a != nil { + return a.oid + } + + return nil +} + +func (a *Address) SetObjectID(v *ObjectID) { + if a != nil { + a.oid = v + } +} From a3f0c5537c8e95e363b263d41b4d0ef161b13ab3 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 17 Aug 2020 12:06:18 +0300 Subject: [PATCH 0286/1196] v2/refs: Implement gRPC converters Signed-off-by: Leonard Lyubich --- v2/refs/convert.go | 84 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) diff --git a/v2/refs/convert.go b/v2/refs/convert.go index 869a0e6..936a920 100644 --- a/v2/refs/convert.go +++ b/v2/refs/convert.go @@ -27,3 +27,87 @@ func OwnerIDFromGRPCMessage(m *refs.OwnerID) *OwnerID { return o } + +func ContainerIDToGRPCMessage(c *ContainerID) *refs.ContainerID { + if c == nil { + return nil + } + + m := new(refs.ContainerID) + + m.SetValue(c.GetValue()) + + return m +} + +func ContainerIDFromGRPCMessage(m *refs.ContainerID) *ContainerID { + if m == nil { + return nil + } + + c := new(ContainerID) + + c.SetValue(m.GetValue()) + + return c +} + +func ObjectIDToGRPCMessage(o *ObjectID) *refs.ObjectID { + if o == nil { + return nil + } + + m := new(refs.ObjectID) + + m.SetValue(o.GetValue()) + + return m +} + +func ObjectIDFromGRPCMessage(m *refs.ObjectID) *ObjectID { + if m == nil { + return nil + } + + o := new(ObjectID) + + o.SetValue(m.GetValue()) + + return o +} + +func AddressToGRPCMessage(a *Address) *refs.Address { + if a == nil { + return nil + } + + m := new(refs.Address) + + m.SetContainerId( + ContainerIDToGRPCMessage(a.GetContainerID()), + ) + + m.SetObjectId( + ObjectIDToGRPCMessage(a.GetObjectID()), + ) + + return m +} + +func AddressFromGRPCMessage(m *refs.Address) *Address { + if m == nil { + return nil + } + + a := new(Address) + + a.SetContainerID( + ContainerIDFromGRPCMessage(m.GetContainerId()), + ) + + a.SetObjectID( + ObjectIDFromGRPCMessage(m.GetObjectId()), + ) + + return a +} From 4b7f532e526e5c518f59ce0e0ef0f2cca498a75a Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 17 Aug 2020 12:08:11 +0300 Subject: [PATCH 0287/1196] v2/storagegroup: Implement uni-structure Signed-off-by: Leonard Lyubich --- v2/storagegroup/types.go | 71 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 v2/storagegroup/types.go diff --git a/v2/storagegroup/types.go b/v2/storagegroup/types.go new file mode 100644 index 0000000..38a09f2 --- /dev/null +++ b/v2/storagegroup/types.go @@ -0,0 +1,71 @@ +package storagegroup + +import ( + "github.com/nspcc-dev/neofs-api-go/v2/refs" +) + +type StorageGroup struct { + size uint64 + + hash []byte + + exp uint64 + + members []*refs.ObjectID +} + +func (s *StorageGroup) GetValidationDataSize() uint64 { + if s != nil { + return s.size + } + + return 0 +} + +func (s *StorageGroup) SetValidationDataSize(v uint64) { + if s != nil { + s.size = v + } +} + +func (s *StorageGroup) GetValidationHash() []byte { + if s != nil { + return s.hash + } + + return nil +} + +func (s *StorageGroup) SetValidationHash(v []byte) { + if s != nil { + s.hash = v + } +} + +func (s *StorageGroup) GetExpirationEpoch() uint64 { + if s != nil { + return s.exp + } + + return 0 +} + +func (s *StorageGroup) SetExpirationEpoch(v uint64) { + if s != nil { + s.exp = v + } +} + +func (s *StorageGroup) GetMembers() []*refs.ObjectID { + if s != nil { + return s.members + } + + return nil +} + +func (s *StorageGroup) SetMembers(v []*refs.ObjectID) { + if s != nil { + s.members = v + } +} From 8ebca8eff345c204bd8053aa6f7afd90a3e9c83d Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 17 Aug 2020 12:12:59 +0300 Subject: [PATCH 0288/1196] v2/storagegroup: Implement gRPC converters Signed-off-by: Leonard Lyubich --- v2/storagegroup/convert.go | 53 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 v2/storagegroup/convert.go diff --git a/v2/storagegroup/convert.go b/v2/storagegroup/convert.go new file mode 100644 index 0000000..4e45e34 --- /dev/null +++ b/v2/storagegroup/convert.go @@ -0,0 +1,53 @@ +package storagegroup + +import ( + "github.com/nspcc-dev/neofs-api-go/v2/refs" + refsGRPC "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" + sg "github.com/nspcc-dev/neofs-api-go/v2/storagegroup/grpc" +) + +func StorageGroupToGRPCMessage(s *StorageGroup) *sg.StorageGroup { + if s == nil { + return nil + } + + m := new(sg.StorageGroup) + + m.SetValidationDataSize(s.GetValidationDataSize()) + m.SetValidationHash(s.GetValidationHash()) + m.SetExpirationEpoch(s.GetExpirationEpoch()) + + members := s.GetMembers() + memberMsg := make([]*refsGRPC.ObjectID, 0, len(members)) + + for i := range members { + memberMsg = append(memberMsg, refs.ObjectIDToGRPCMessage(members[i])) + } + + m.SetMembers(memberMsg) + + return m +} + +func StorageGroupFromGRPCMessage(m *sg.StorageGroup) *StorageGroup { + if m == nil { + return nil + } + + s := new(StorageGroup) + + s.SetValidationDataSize(m.GetValidationDataSize()) + s.SetValidationHash(m.GetValidationHash()) + s.SetExpirationEpoch(m.GetExpirationEpoch()) + + memberMsg := m.GetMembers() + members := make([]*refs.ObjectID, 0, len(memberMsg)) + + for i := range memberMsg { + members = append(members, refs.ObjectIDFromGRPCMessage(memberMsg[i])) + } + + s.SetMembers(members) + + return s +} From 77962e1d39b838b781ef3b67ef95b2483e86d2f6 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 17 Aug 2020 12:16:52 +0300 Subject: [PATCH 0289/1196] v2/acl: Implement uni-types Signed-off-by: Leonard Lyubich --- v2/acl/types.go | 247 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 247 insertions(+) create mode 100644 v2/acl/types.go diff --git a/v2/acl/types.go b/v2/acl/types.go new file mode 100644 index 0000000..e39eecc --- /dev/null +++ b/v2/acl/types.go @@ -0,0 +1,247 @@ +package acl + +import "github.com/nspcc-dev/neofs-api-go/v2/refs" + +type HeaderFilter struct { + hdrType HeaderType + + matchType MatchType + + name, value string +} + +type TargetInfo struct { + target Target + + keys [][]byte +} + +type Record struct { + op Operation + + action Action + + filters []*HeaderFilter + + targets []*TargetInfo +} + +type Table struct { + cid *refs.ContainerID + + records []*Record +} + +type MatchType uint32 + +type HeaderType uint32 + +type Action uint32 + +type Operation uint32 + +type Target uint32 + +const ( + MatchTypeUnknown MatchType = iota + MatchTypeStringEqual + MatchTypeStringNotEqual +) + +const ( + HeaderTypeUnknown HeaderType = iota + HeaderTypeRequest + HeaderTypeObject +) + +const ( + ActionUnknown Action = iota + ActionDeny + ActionAllow +) + +const ( + OperationUnknown Operation = iota + OperationGet + OperationPut + OperationHead + OperationDelete + OperationSearch + OperationRange + OperationRangeHash +) + +const ( + TargetUnknown Target = iota + TargetUser + TargetSystem + TargetOthers +) + +func (f *HeaderFilter) GetHeaderType() HeaderType { + if f != nil { + return f.hdrType + } + + return HeaderTypeUnknown +} + +func (f *HeaderFilter) SetHeaderType(v HeaderType) { + if f != nil { + f.hdrType = v + } +} + +func (f *HeaderFilter) GetMatchType() MatchType { + if f != nil { + return f.matchType + } + + return MatchTypeUnknown +} + +func (f *HeaderFilter) SetMatchType(v MatchType) { + if f != nil { + f.matchType = v + } +} + +func (f *HeaderFilter) GetName() string { + if f != nil { + return f.name + } + + return "" +} + +func (f *HeaderFilter) SetName(v string) { + if f != nil { + f.name = v + } +} + +func (f *HeaderFilter) GetValue() string { + if f != nil { + return f.value + } + + return "" +} + +func (f *HeaderFilter) SetValue(v string) { + if f != nil { + f.value = v + } +} + +func (t *TargetInfo) GetTarget() Target { + if t != nil { + return t.target + } + + return TargetUnknown +} + +func (t *TargetInfo) SetTarget(v Target) { + if t != nil { + t.target = v + } +} + +func (t *TargetInfo) GetKeyList() [][]byte { + if t != nil { + return t.keys + } + + return nil +} + +func (t *TargetInfo) SetKeyList(v [][]byte) { + if t != nil { + t.keys = v + } +} + +func (r *Record) GetOperation() Operation { + if r != nil { + return r.op + } + + return OperationUnknown +} + +func (r *Record) SetOperation(v Operation) { + if r != nil { + r.op = v + } +} + +func (r *Record) GetAction() Action { + if r != nil { + return r.action + } + + return ActionUnknown +} + +func (r *Record) SetAction(v Action) { + if r != nil { + r.action = v + } +} + +func (r *Record) GetFilters() []*HeaderFilter { + if r != nil { + return r.filters + } + + return nil +} + +func (r *Record) SetFilters(v []*HeaderFilter) { + if r != nil { + r.filters = v + } +} + +func (r *Record) GetTargets() []*TargetInfo { + if r != nil { + return r.targets + } + + return nil +} + +func (r *Record) SetTargets(v []*TargetInfo) { + if r != nil { + r.targets = v + } +} + +func (t *Table) GetContainerID() *refs.ContainerID { + if t != nil { + return t.cid + } + + return nil +} + +func (t *Table) SetContainerID(v *refs.ContainerID) { + if t != nil { + t.cid = v + } +} + +func (t *Table) GetRecords() []*Record { + if t != nil { + return t.records + } + + return nil +} + +func (t *Table) SetRecords(v []*Record) { + if t != nil { + t.records = v + } +} From 01581443a3c29d1f28722f067e607a9b2ee951af Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 17 Aug 2020 12:22:51 +0300 Subject: [PATCH 0290/1196] v2/acl: Implement gRPC converters Signed-off-by: Leonard Lyubich --- v2/acl/convert.go | 332 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 332 insertions(+) create mode 100644 v2/acl/convert.go diff --git a/v2/acl/convert.go b/v2/acl/convert.go new file mode 100644 index 0000000..e05ee07 --- /dev/null +++ b/v2/acl/convert.go @@ -0,0 +1,332 @@ +package acl + +import ( + acl "github.com/nspcc-dev/neofs-api-go/v2/acl/grpc" + "github.com/nspcc-dev/neofs-api-go/v2/refs" +) + +func TargetToGRPCField(t Target) acl.Target { + switch t { + case TargetUser: + return acl.Target_USER + case TargetSystem: + return acl.Target_SYSTEM + case TargetOthers: + return acl.Target_OTHERS + default: + return acl.Target_TARGET_UNSPECIFIED + } +} + +func TargetFromGRPCField(t acl.Target) Target { + switch t { + case acl.Target_USER: + return TargetUser + case acl.Target_SYSTEM: + return TargetSystem + case acl.Target_OTHERS: + return TargetOthers + default: + return TargetUnknown + } +} + +func OperationToGRPCField(t Operation) acl.EACLRecord_Operation { + switch t { + case OperationPut: + return acl.EACLRecord_PUT + case OperationDelete: + return acl.EACLRecord_DELETE + case OperationGet: + return acl.EACLRecord_GET + case OperationHead: + return acl.EACLRecord_HEAD + case OperationSearch: + return acl.EACLRecord_SEARCH + case OperationRange: + return acl.EACLRecord_GETRANGE + case OperationRangeHash: + return acl.EACLRecord_GETRANGEHASH + default: + return acl.EACLRecord_OPERATION_UNSPECIFIED + } +} + +func OperationFromGRPCField(t acl.EACLRecord_Operation) Operation { + switch t { + case acl.EACLRecord_PUT: + return OperationPut + case acl.EACLRecord_DELETE: + return OperationDelete + case acl.EACLRecord_GET: + return OperationGet + case acl.EACLRecord_HEAD: + return OperationHead + case acl.EACLRecord_SEARCH: + return OperationSearch + case acl.EACLRecord_GETRANGE: + return OperationRange + case acl.EACLRecord_GETRANGEHASH: + return OperationRangeHash + default: + return OperationUnknown + } +} + +func ActionToGRPCField(t Action) acl.EACLRecord_Action { + switch t { + case ActionDeny: + return acl.EACLRecord_DENY + case ActionAllow: + return acl.EACLRecord_ALLOW + default: + return acl.EACLRecord_ACTION_UNSPECIFIED + } +} + +func ActionFromGRPCField(t acl.EACLRecord_Action) Action { + switch t { + case acl.EACLRecord_DENY: + return ActionDeny + case acl.EACLRecord_ALLOW: + return ActionAllow + default: + return ActionUnknown + } +} + +func HeaderTypeToGRPCField(t HeaderType) acl.EACLRecord_FilterInfo_Header { + switch t { + case HeaderTypeRequest: + return acl.EACLRecord_FilterInfo_REQUEST + case HeaderTypeObject: + return acl.EACLRecord_FilterInfo_OBJECT + default: + return acl.EACLRecord_FilterInfo_HEADER_UNSPECIFIED + } +} + +func HeaderTypeFromGRPCField(t acl.EACLRecord_FilterInfo_Header) HeaderType { + switch t { + case acl.EACLRecord_FilterInfo_REQUEST: + return HeaderTypeRequest + case acl.EACLRecord_FilterInfo_OBJECT: + return HeaderTypeObject + default: + return HeaderTypeUnknown + } +} + +func MatchTypeToGRPCField(t MatchType) acl.EACLRecord_FilterInfo_MatchType { + switch t { + case MatchTypeStringEqual: + return acl.EACLRecord_FilterInfo_STRING_EQUAL + case MatchTypeStringNotEqual: + return acl.EACLRecord_FilterInfo_STRING_NOT_EQUAL + default: + return acl.EACLRecord_FilterInfo_MATCH_TYPE_UNSPECIFIED + } +} + +func MatchTypeFromGRPCField(t acl.EACLRecord_FilterInfo_MatchType) MatchType { + switch t { + case acl.EACLRecord_FilterInfo_STRING_EQUAL: + return MatchTypeStringEqual + case acl.EACLRecord_FilterInfo_STRING_NOT_EQUAL: + return MatchTypeStringNotEqual + default: + return MatchTypeUnknown + } +} + +func HeaderFilterToGRPCMessage(f *HeaderFilter) *acl.EACLRecord_FilterInfo { + if f == nil { + return nil + } + + m := new(acl.EACLRecord_FilterInfo) + + m.SetHeader( + HeaderTypeToGRPCField(f.GetHeaderType()), + ) + + m.SetMatchType( + MatchTypeToGRPCField(f.GetMatchType()), + ) + + m.SetHeaderName(f.GetName()) + m.SetHeaderVal(f.GetValue()) + + return m +} + +func HeaderFilterFromGRPCMessage(m *acl.EACLRecord_FilterInfo) *HeaderFilter { + if m == nil { + return nil + } + + f := new(HeaderFilter) + + f.SetHeaderType( + HeaderTypeFromGRPCField(m.GetHeader()), + ) + + f.SetMatchType( + MatchTypeFromGRPCField(m.GetMatchType()), + ) + + f.SetName(m.GetHeaderName()) + f.SetValue(m.GetHeaderVal()) + + return f +} + +func TargetInfoToGRPCMessage(t *TargetInfo) *acl.EACLRecord_TargetInfo { + if t == nil { + return nil + } + + m := new(acl.EACLRecord_TargetInfo) + + m.SetTarget( + TargetToGRPCField(t.GetTarget()), + ) + + m.SetKeyList(t.GetKeyList()) + + return m +} + +func TargetInfoFromGRPCMessage(m *acl.EACLRecord_TargetInfo) *TargetInfo { + if m == nil { + return nil + } + + t := new(TargetInfo) + + t.SetTarget( + TargetFromGRPCField(m.GetTarget()), + ) + + t.SetKeyList(m.GetKeyList()) + + return t +} + +func RecordToGRPCMessage(r *Record) *acl.EACLRecord { + if r == nil { + return nil + } + + m := new(acl.EACLRecord) + + m.SetOperation( + OperationToGRPCField(r.GetOperation()), + ) + + m.SetAction( + ActionToGRPCField(r.GetAction()), + ) + + filters := r.GetFilters() + filterMsg := make([]*acl.EACLRecord_FilterInfo, 0, len(filters)) + + for i := range filters { + filterMsg = append(filterMsg, HeaderFilterToGRPCMessage(filters[i])) + } + + m.SetFilters(filterMsg) + + targets := r.GetTargets() + targetMsg := make([]*acl.EACLRecord_TargetInfo, 0, len(targets)) + + for i := range targets { + targetMsg = append(targetMsg, TargetInfoToGRPCMessage(targets[i])) + } + + m.SetTargets(targetMsg) + + return m +} + +func RecordFromGRPCMessage(m *acl.EACLRecord) *Record { + if m == nil { + return nil + } + + r := new(Record) + + r.SetOperation( + OperationFromGRPCField(m.GetOperation()), + ) + + r.SetAction( + ActionFromGRPCField(m.GetAction()), + ) + + filterMsg := m.GetFilters() + filters := make([]*HeaderFilter, 0, len(filterMsg)) + + for i := range filterMsg { + filters = append(filters, HeaderFilterFromGRPCMessage(filterMsg[i])) + } + + r.SetFilters(filters) + + targetMsg := m.GetTargets() + targets := make([]*TargetInfo, 0, len(targetMsg)) + + for i := range targetMsg { + targets = append(targets, TargetInfoFromGRPCMessage(targetMsg[i])) + } + + r.SetTargets(targets) + + return r +} + +func TableToGRPCMessage(t *Table) *acl.EACLTable { + if t == nil { + return nil + } + + m := new(acl.EACLTable) + + m.SetContainerId( + refs.ContainerIDToGRPCMessage(t.GetContainerID()), + ) + + records := t.GetRecords() + recordMsg := make([]*acl.EACLRecord, 0, len(records)) + + for i := range records { + recordMsg = append(recordMsg, RecordToGRPCMessage(records[i])) + } + + m.SetRecords(recordMsg) + + return m +} + +func TableFromGRPCMessage(m *acl.EACLTable) *Table { + if m == nil { + return nil + } + + t := new(Table) + + t.SetContainerID( + refs.ContainerIDFromGRPCMessage(m.GetContainerId()), + ) + + recordMsg := m.GetRecords() + records := make([]*Record, 0, len(recordMsg)) + + for i := range recordMsg { + records = append(records, RecordFromGRPCMessage(recordMsg[i])) + } + + t.SetRecords(records) + + return t +} From c55a9fa9bd9df3258c9d4414240998b7bec5c34c Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 17 Aug 2020 12:34:49 +0300 Subject: [PATCH 0291/1196] v2/service: Gather converters in one file Signed-off-by: Leonard Lyubich --- v2/service/convert.go | 26 ++++++++++++++++++++++++++ v2/service/service.go | 30 ------------------------------ 2 files changed, 26 insertions(+), 30 deletions(-) diff --git a/v2/service/convert.go b/v2/service/convert.go index bf2c3a2..2ced953 100644 --- a/v2/service/convert.go +++ b/v2/service/convert.go @@ -199,3 +199,29 @@ func RequestMetaHeaderFromGRPCMessage(m *service.RequestMetaHeader) *RequestMeta return r } + +func SignatureToGRPCMessage(s *Signature) *service.Signature { + if s == nil { + return nil + } + + m := new(service.Signature) + + m.SetKey(s.GetKey()) + m.SetSign(s.GetSign()) + + return m +} + +func SignatureFromGRPCMessage(m *service.Signature) *Signature { + if m == nil { + return nil + } + + s := new(Signature) + + s.SetKey(m.GetKey()) + s.SetSign(m.GetSign()) + + return s +} diff --git a/v2/service/service.go b/v2/service/service.go index 39557ee..1a1e0a7 100644 --- a/v2/service/service.go +++ b/v2/service/service.go @@ -1,9 +1,5 @@ package service -import ( - service "github.com/nspcc-dev/neofs-api-go/v2/service/grpc" -) - type Signature struct { key, sign []byte } @@ -315,29 +311,3 @@ func (r *RequestMetaHeader) StableSize() int { // TODO: do not use hack return RequestMetaHeaderToGRPCMessage(r).Size() } - -func SignatureToGRPCMessage(s *Signature) *service.Signature { - if s == nil { - return nil - } - - m := new(service.Signature) - - m.SetKey(s.GetKey()) - m.SetSign(s.GetSign()) - - return m -} - -func SignatureFromGRPCMessage(m *service.Signature) *Signature { - if m == nil { - return nil - } - - s := new(Signature) - - s.SetKey(m.GetKey()) - s.SetSign(m.GetSign()) - - return s -} From 18737e128c4c325cdc67922334fe7714ab63ec2d Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 17 Aug 2020 13:04:21 +0300 Subject: [PATCH 0292/1196] v2/service: Fill BearerToken uni-structure Signed-off-by: Leonard Lyubich --- v2/service/convert.go | 108 ++++++++++++++++++++++++++++++++-- v2/service/service.go | 133 +++++++++++++++++++++++++++++++++++++++++- 2 files changed, 236 insertions(+), 5 deletions(-) diff --git a/v2/service/convert.go b/v2/service/convert.go index 2ced953..eb8a10a 100644 --- a/v2/service/convert.go +++ b/v2/service/convert.go @@ -1,6 +1,8 @@ package service import ( + "github.com/nspcc-dev/neofs-api-go/v2/acl" + "github.com/nspcc-dev/neofs-api-go/v2/refs" service "github.com/nspcc-dev/neofs-api-go/v2/service/grpc" ) @@ -67,13 +69,39 @@ func SessionTokenFromGRPCMessage(m *service.SessionToken) *SessionToken { } func BearerTokenToGRPCMessage(t *BearerToken) *service.BearerToken { - // TODO: fill me - return nil + if t == nil { + return nil + } + + m := new(service.BearerToken) + + m.SetBody( + BearerTokenBodyToGRPCMessage(t.GetBody()), + ) + + m.SetSignature( + SignatureToGRPCMessage(t.GetSignature()), + ) + + return m } func BearerTokenFromGRPCMessage(m *service.BearerToken) *BearerToken { - // TODO: fill me - return nil + if m == nil { + return nil + } + + bt := new(BearerToken) + + bt.SetBody( + BearerTokenBodyFromGRPCMessage(m.GetBody()), + ) + + bt.SetSignature( + SignatureFromGRPCMessage(m.GetSignature()), + ) + + return bt } func RequestVerificationHeaderToGRPCMessage(r *RequestVerificationHeader) *service.RequestVerificationHeader { @@ -225,3 +253,75 @@ func SignatureFromGRPCMessage(m *service.Signature) *Signature { return s } + +func TokenLifetimeToGRPCMessage(tl *TokenLifetime) *service.TokenLifetime { + if tl == nil { + return nil + } + + m := new(service.TokenLifetime) + + m.SetExp(tl.GetExp()) + m.SetNbf(tl.GetNbf()) + m.SetIat(tl.GetIat()) + + return m +} + +func TokenLifetimeFromGRPCMessage(m *service.TokenLifetime) *TokenLifetime { + if m == nil { + return nil + } + + tl := new(TokenLifetime) + + tl.SetExp(m.GetExp()) + tl.SetNbf(m.GetNbf()) + tl.SetIat(m.GetIat()) + + return tl +} + +func BearerTokenBodyToGRPCMessage(v *BearerTokenBody) *service.BearerToken_Body { + if v == nil { + return nil + } + + m := new(service.BearerToken_Body) + + m.SetEaclTable( + acl.TableToGRPCMessage(v.GetEACL()), + ) + + m.SetOwnerId( + refs.OwnerIDToGRPCMessage(v.GetOwnerID()), + ) + + m.SetLifetime( + TokenLifetimeToGRPCMessage(v.GetLifetime()), + ) + + return m +} + +func BearerTokenBodyFromGRPCMessage(m *service.BearerToken_Body) *BearerTokenBody { + if m == nil { + return nil + } + + bt := new(BearerTokenBody) + + bt.SetEACL( + acl.TableFromGRPCMessage(m.GetEaclTable()), + ) + + bt.SetOwnerID( + refs.OwnerIDFromGRPCMessage(m.GetOwnerId()), + ) + + bt.SetLifetime( + TokenLifetimeFromGRPCMessage(m.GetLifetime()), + ) + + return bt +} diff --git a/v2/service/service.go b/v2/service/service.go index 1a1e0a7..a23179b 100644 --- a/v2/service/service.go +++ b/v2/service/service.go @@ -1,5 +1,10 @@ package service +import ( + "github.com/nspcc-dev/neofs-api-go/v2/acl" + "github.com/nspcc-dev/neofs-api-go/v2/refs" +) + type Signature struct { key, sign []byte } @@ -12,12 +17,26 @@ type XHeader struct { key, val string } +type TokenLifetime struct { + exp, nbf, iat uint64 +} + type SessionToken struct { // TODO: fill me } +type BearerTokenBody struct { + eacl *acl.Table + + ownerID *refs.OwnerID + + lifetime *TokenLifetime +} + type BearerToken struct { - // TODO: fill me + body *BearerTokenBody + + sig *Signature } type RequestVerificationHeader struct { @@ -311,3 +330,115 @@ func (r *RequestMetaHeader) StableSize() int { // TODO: do not use hack return RequestMetaHeaderToGRPCMessage(r).Size() } + +func (tl *TokenLifetime) GetExp() uint64 { + if tl != nil { + return tl.exp + } + + return 0 +} + +func (tl *TokenLifetime) SetExp(v uint64) { + if tl != nil { + tl.exp = v + } +} + +func (tl *TokenLifetime) GetNbf() uint64 { + if tl != nil { + return tl.nbf + } + + return 0 +} + +func (tl *TokenLifetime) SetNbf(v uint64) { + if tl != nil { + tl.nbf = v + } +} + +func (tl *TokenLifetime) GetIat() uint64 { + if tl != nil { + return tl.iat + } + + return 0 +} + +func (tl *TokenLifetime) SetIat(v uint64) { + if tl != nil { + tl.iat = v + } +} + +func (bt *BearerTokenBody) GetEACL() *acl.Table { + if bt != nil { + return bt.eacl + } + + return nil +} + +func (bt *BearerTokenBody) SetEACL(v *acl.Table) { + if bt != nil { + bt.eacl = v + } +} + +func (bt *BearerTokenBody) GetOwnerID() *refs.OwnerID { + if bt != nil { + return bt.ownerID + } + + return nil +} + +func (bt *BearerTokenBody) SetOwnerID(v *refs.OwnerID) { + if bt != nil { + bt.ownerID = v + } +} + +func (bt *BearerTokenBody) GetLifetime() *TokenLifetime { + if bt != nil { + return bt.lifetime + } + + return nil +} + +func (bt *BearerTokenBody) SetLifetime(v *TokenLifetime) { + if bt != nil { + bt.lifetime = v + } +} + +func (bt *BearerToken) GetBody() *BearerTokenBody { + if bt != nil { + return bt.body + } + + return nil +} + +func (bt *BearerToken) SetBody(v *BearerTokenBody) { + if bt != nil { + bt.body = v + } +} + +func (bt *BearerToken) GetSignature() *Signature { + if bt != nil { + return bt.sig + } + + return nil +} + +func (bt *BearerToken) SetSignature(v *Signature) { + if bt != nil { + bt.sig = v + } +} From 1d5773b6ffa0e7e4a55f0fbd079ca36e059aa502 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 17 Aug 2020 13:11:44 +0300 Subject: [PATCH 0293/1196] v2/service: Replace request header converters Signed-off-by: Leonard Lyubich --- v2/accounting/convert.go | 43 ++-------------------------------------- v2/service/convert.go | 38 +++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 41 deletions(-) diff --git a/v2/accounting/convert.go b/v2/accounting/convert.go index 9f04943..74d96c5 100644 --- a/v2/accounting/convert.go +++ b/v2/accounting/convert.go @@ -4,7 +4,6 @@ import ( accounting "github.com/nspcc-dev/neofs-api-go/v2/accounting/grpc" "github.com/nspcc-dev/neofs-api-go/v2/refs" "github.com/nspcc-dev/neofs-api-go/v2/service" - grpcService "github.com/nspcc-dev/neofs-api-go/v2/service/grpc" ) func BalanceRequestBodyToGRPCMessage(b *BalanceRequestBody) *accounting.BalanceRequest_Body { @@ -35,44 +34,6 @@ func BalanceRequestBodyFromGRPCMessage(m *accounting.BalanceRequest_Body) *Balan return b } -func headersToGRPC( - src interface { - GetRequestMetaHeader() *service.RequestMetaHeader - GetRequestVerificationHeader() *service.RequestVerificationHeader - }, - dst interface { - SetMetaHeader(*grpcService.RequestMetaHeader) - SetVerifyHeader(*grpcService.RequestVerificationHeader) - }, -) { - dst.SetMetaHeader( - service.RequestMetaHeaderToGRPCMessage(src.GetRequestMetaHeader()), - ) - - dst.SetVerifyHeader( - service.RequestVerificationHeaderToGRPCMessage(src.GetRequestVerificationHeader()), - ) -} - -func headersFromGRPC( - src interface { - GetMetaHeader() *grpcService.RequestMetaHeader - GetVerifyHeader() *grpcService.RequestVerificationHeader - }, - dst interface { - SetRequestMetaHeader(*service.RequestMetaHeader) - SetRequestVerificationHeader(*service.RequestVerificationHeader) - }, -) { - dst.SetRequestMetaHeader( - service.RequestMetaHeaderFromGRPCMessage(src.GetMetaHeader()), - ) - - dst.SetRequestVerificationHeader( - service.RequestVerificationHeaderFromGRPCMessage(src.GetVerifyHeader()), - ) -} - func BalanceRequestToGRPCMessage(b *BalanceRequest) *accounting.BalanceRequest { if b == nil { return nil @@ -84,7 +45,7 @@ func BalanceRequestToGRPCMessage(b *BalanceRequest) *accounting.BalanceRequest { BalanceRequestBodyToGRPCMessage(b.GetBody()), ) - headersToGRPC(b, m) + service.RequestHeadersToGRPC(b, m) return m } @@ -100,7 +61,7 @@ func BalanceRequestFromGRPCMessage(m *accounting.BalanceRequest) *BalanceRequest BalanceRequestBodyFromGRPCMessage(m.GetBody()), ) - headersFromGRPC(m, b) + service.RequestHeadersFromGRPC(m, b) return b } diff --git a/v2/service/convert.go b/v2/service/convert.go index eb8a10a..c3306f3 100644 --- a/v2/service/convert.go +++ b/v2/service/convert.go @@ -325,3 +325,41 @@ func BearerTokenBodyFromGRPCMessage(m *service.BearerToken_Body) *BearerTokenBod return bt } + +func RequestHeadersToGRPC( + src interface { + GetRequestMetaHeader() *RequestMetaHeader + GetRequestVerificationHeader() *RequestVerificationHeader + }, + dst interface { + SetMetaHeader(*service.RequestMetaHeader) + SetVerifyHeader(*service.RequestVerificationHeader) + }, +) { + dst.SetMetaHeader( + RequestMetaHeaderToGRPCMessage(src.GetRequestMetaHeader()), + ) + + dst.SetVerifyHeader( + RequestVerificationHeaderToGRPCMessage(src.GetRequestVerificationHeader()), + ) +} + +func RequestHeadersFromGRPC( + src interface { + GetMetaHeader() *service.RequestMetaHeader + GetVerifyHeader() *service.RequestVerificationHeader + }, + dst interface { + SetRequestMetaHeader(*RequestMetaHeader) + SetRequestVerificationHeader(*RequestVerificationHeader) + }, +) { + dst.SetRequestMetaHeader( + RequestMetaHeaderFromGRPCMessage(src.GetMetaHeader()), + ) + + dst.SetRequestVerificationHeader( + RequestVerificationHeaderFromGRPCMessage(src.GetVerifyHeader()), + ) +} From 890d8291e7b64dc40db18e92dce7b66c194a1037 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 17 Aug 2020 13:23:41 +0300 Subject: [PATCH 0294/1196] v2/service: Implement response uni-structures Signed-off-by: Leonard Lyubich --- v2/service/convert.go | 146 ++++++++++++++++++++++++++++++++++++++++++ v2/service/service.go | 144 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 290 insertions(+) diff --git a/v2/service/convert.go b/v2/service/convert.go index c3306f3..ddf94ee 100644 --- a/v2/service/convert.go +++ b/v2/service/convert.go @@ -363,3 +363,149 @@ func RequestHeadersFromGRPC( RequestVerificationHeaderFromGRPCMessage(src.GetVerifyHeader()), ) } + +func ResponseVerificationHeaderToGRPCMessage(r *ResponseVerificationHeader) *service.ResponseVerificationHeader { + if r == nil { + return nil + } + + m := new(service.ResponseVerificationHeader) + + m.SetBodySignature( + SignatureToGRPCMessage(r.GetBodySignature()), + ) + + m.SetMetaSignature( + SignatureToGRPCMessage(r.GetMetaSignature()), + ) + + m.SetOriginSignature( + SignatureToGRPCMessage(r.GetOriginSignature()), + ) + + m.SetOrigin( + ResponseVerificationHeaderToGRPCMessage(r.GetOrigin()), + ) + + return m +} + +func ResponseVerificationHeaderFromGRPCMessage(m *service.ResponseVerificationHeader) *ResponseVerificationHeader { + if m == nil { + return nil + } + + r := new(ResponseVerificationHeader) + + r.SetBodySignature( + SignatureFromGRPCMessage(m.GetBodySignature()), + ) + + r.SetMetaSignature( + SignatureFromGRPCMessage(m.GetMetaSignature()), + ) + + r.SetOriginSignature( + SignatureFromGRPCMessage(m.GetOriginSignature()), + ) + + r.SetOrigin( + ResponseVerificationHeaderFromGRPCMessage(m.GetOrigin()), + ) + + return r +} + +func ResponseMetaHeaderToGRPCMessage(r *ResponseMetaHeader) *service.ResponseMetaHeader { + if r == nil { + return nil + } + + m := new(service.ResponseMetaHeader) + + m.SetTtl(r.GetTTL()) + m.SetEpoch(r.GetEpoch()) + + m.SetVersion( + VersionToGRPCMessage(r.GetVersion()), + ) + + m.SetOrigin( + ResponseMetaHeaderToGRPCMessage(r.GetOrigin()), + ) + + xHeaders := r.GetXHeaders() + xHdrMsg := make([]*service.XHeader, 0, len(xHeaders)) + + for i := range xHeaders { + xHdrMsg = append(xHdrMsg, XHeaderToGRPCMessage(xHeaders[i])) + } + + return m +} + +func ResponseMetaHeaderFromGRPCMessage(m *service.ResponseMetaHeader) *ResponseMetaHeader { + if m == nil { + return nil + } + + r := new(ResponseMetaHeader) + + r.SetTTL(m.GetTtl()) + r.SetEpoch(m.GetEpoch()) + + r.SetVersion( + VersionFromGRPCMessage(m.GetVersion()), + ) + + r.SetOrigin( + ResponseMetaHeaderFromGRPCMessage(m.GetOrigin()), + ) + + xHdrMsg := m.GetXHeaders() + xHeaders := make([]*XHeader, 0, len(xHdrMsg)) + + for i := range xHdrMsg { + xHeaders = append(xHeaders, XHeaderFromGRPCMessage(xHdrMsg[i])) + } + + return r +} + +func ResponseHeadersToGRPC( + src interface { + GetResponseMetaHeader() *ResponseMetaHeader + GetResponseVerificationHeader() *ResponseVerificationHeader + }, + dst interface { + SetMetaHeader(*service.ResponseMetaHeader) + SetVerifyHeader(*service.ResponseVerificationHeader) + }, +) { + dst.SetMetaHeader( + ResponseMetaHeaderToGRPCMessage(src.GetResponseMetaHeader()), + ) + + dst.SetVerifyHeader( + ResponseVerificationHeaderToGRPCMessage(src.GetResponseVerificationHeader()), + ) +} + +func ResponseHeadersFromGRPC( + src interface { + GetMetaHeader() *service.ResponseMetaHeader + GetVerifyHeader() *service.ResponseVerificationHeader + }, + dst interface { + SetResponseMetaHeader(*ResponseMetaHeader) + SetResponseVerificationHeader(*ResponseVerificationHeader) + }, +) { + dst.SetResponseMetaHeader( + ResponseMetaHeaderFromGRPCMessage(src.GetMetaHeader()), + ) + + dst.SetResponseVerificationHeader( + ResponseVerificationHeaderFromGRPCMessage(src.GetVerifyHeader()), + ) +} diff --git a/v2/service/service.go b/v2/service/service.go index a23179b..89df919 100644 --- a/v2/service/service.go +++ b/v2/service/service.go @@ -61,6 +61,24 @@ type RequestMetaHeader struct { origin *RequestMetaHeader } +type ResponseVerificationHeader struct { + bodySig, metaSig, originSig *Signature + + origin *ResponseVerificationHeader +} + +type ResponseMetaHeader struct { + version *Version + + ttl uint32 + + epoch uint64 + + xHeaders []*XHeader + + origin *ResponseMetaHeader +} + func (s *Signature) GetKey() []byte { if s != nil { return s.key @@ -442,3 +460,129 @@ func (bt *BearerToken) SetSignature(v *Signature) { bt.sig = v } } + +func (r *ResponseVerificationHeader) GetBodySignature() *Signature { + if r != nil { + return r.bodySig + } + + return nil +} + +func (r *ResponseVerificationHeader) SetBodySignature(v *Signature) { + if r != nil { + r.bodySig = v + } +} + +func (r *ResponseVerificationHeader) GetMetaSignature() *Signature { + if r != nil { + return r.metaSig + } + + return nil +} + +func (r *ResponseVerificationHeader) SetMetaSignature(v *Signature) { + if r != nil { + r.metaSig = v + } +} + +func (r *ResponseVerificationHeader) GetOriginSignature() *Signature { + if r != nil { + return r.originSig + } + + return nil +} + +func (r *ResponseVerificationHeader) SetOriginSignature(v *Signature) { + if r != nil { + r.originSig = v + } +} + +func (r *ResponseVerificationHeader) GetOrigin() *ResponseVerificationHeader { + if r != nil { + return r.origin + } + + return nil +} + +func (r *ResponseVerificationHeader) SetOrigin(v *ResponseVerificationHeader) { + if r != nil { + r.origin = v + } +} + +func (r *ResponseMetaHeader) GetVersion() *Version { + if r != nil { + return r.version + } + + return nil +} + +func (r *ResponseMetaHeader) SetVersion(v *Version) { + if r != nil { + r.version = v + } +} + +func (r *ResponseMetaHeader) GetTTL() uint32 { + if r != nil { + return r.ttl + } + + return 0 +} + +func (r *ResponseMetaHeader) SetTTL(v uint32) { + if r != nil { + r.ttl = v + } +} + +func (r *ResponseMetaHeader) GetEpoch() uint64 { + if r != nil { + return r.epoch + } + + return 0 +} + +func (r *ResponseMetaHeader) SetEpoch(v uint64) { + if r != nil { + r.epoch = v + } +} + +func (r *ResponseMetaHeader) GetXHeaders() []*XHeader { + if r != nil { + return r.xHeaders + } + + return nil +} + +func (r *ResponseMetaHeader) SetXHeaders(v []*XHeader) { + if r != nil { + r.xHeaders = v + } +} + +func (r *ResponseMetaHeader) GetOrigin() *ResponseMetaHeader { + if r != nil { + return r.origin + } + + return nil +} + +func (r *ResponseMetaHeader) SetOrigin(v *ResponseMetaHeader) { + if r != nil { + r.origin = v + } +} From 9df86935f5c9a1281e21d65074b0c36481159ea0 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 17 Aug 2020 13:29:21 +0300 Subject: [PATCH 0295/1196] v2/accounting: Implement Decimal uni-structure Signed-off-by: Leonard Lyubich --- v2/accounting/accounting.go | 34 ++++++++++++++++++++++++++++++++++ v2/accounting/convert.go | 26 ++++++++++++++++++++++++++ 2 files changed, 60 insertions(+) diff --git a/v2/accounting/accounting.go b/v2/accounting/accounting.go index a49f79b..3aa2410 100644 --- a/v2/accounting/accounting.go +++ b/v2/accounting/accounting.go @@ -17,6 +17,12 @@ type BalanceRequest struct { verifyHeader *service.RequestVerificationHeader } +type Decimal struct { + val int64 + + prec uint32 +} + func (b *BalanceRequestBody) GetOwnerID() *refs.OwnerID { if b != nil { return b.ownerID @@ -88,3 +94,31 @@ func (b *BalanceRequest) SetRequestVerificationHeader(v *service.RequestVerifica b.verifyHeader = v } } + +func (d *Decimal) GetValue() int64 { + if d != nil { + return d.val + } + + return 0 +} + +func (d *Decimal) SetValue(v int64) { + if d != nil { + d.val = v + } +} + +func (d *Decimal) GetPrecision() uint32 { + if d != nil { + return d.prec + } + + return 0 +} + +func (d *Decimal) SetPrecision(v uint32) { + if d != nil { + d.prec = v + } +} diff --git a/v2/accounting/convert.go b/v2/accounting/convert.go index 74d96c5..8cc2936 100644 --- a/v2/accounting/convert.go +++ b/v2/accounting/convert.go @@ -65,3 +65,29 @@ func BalanceRequestFromGRPCMessage(m *accounting.BalanceRequest) *BalanceRequest return b } + +func DecimalToGRPCMessage(d *Decimal) *accounting.Decimal { + if d == nil { + return nil + } + + m := new(accounting.Decimal) + + m.SetValue(d.GetValue()) + m.SetPrecision(d.GetPrecision()) + + return m +} + +func DecimalFromGRPCMessage(m *accounting.Decimal) *Decimal { + if m == nil { + return nil + } + + d := new(Decimal) + + d.SetValue(m.GetValue()) + d.SetPrecision(m.GetPrecision()) + + return d +} From e84c8aee2c721cd955e846fa29033a637f706a49 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 17 Aug 2020 13:39:46 +0300 Subject: [PATCH 0296/1196] v2/accounting: Implement uni BalanceResponse Signed-off-by: Leonard Lyubich --- v2/accounting/accounting.go | 68 +++++++++++++++++++++++++++++++++++++ v2/accounting/convert.go | 60 ++++++++++++++++++++++++++++++++ 2 files changed, 128 insertions(+) diff --git a/v2/accounting/accounting.go b/v2/accounting/accounting.go index 3aa2410..505a47f 100644 --- a/v2/accounting/accounting.go +++ b/v2/accounting/accounting.go @@ -17,6 +17,18 @@ type BalanceRequest struct { verifyHeader *service.RequestVerificationHeader } +type BalanceResponseBody struct { + bal *Decimal +} + +type BalanceResponse struct { + body *BalanceResponseBody + + metaHeader *service.ResponseMetaHeader + + verifyHeader *service.ResponseVerificationHeader +} + type Decimal struct { val int64 @@ -122,3 +134,59 @@ func (d *Decimal) SetPrecision(v uint32) { d.prec = v } } + +func (br *BalanceResponseBody) GetBalance() *Decimal { + if br != nil { + return br.bal + } + + return nil +} + +func (br *BalanceResponseBody) SetBalance(v *Decimal) { + if br != nil { + br.SetBalance(v) + } +} + +func (br *BalanceResponse) GetBody() *BalanceResponseBody { + if br != nil { + return br.body + } + + return nil +} + +func (br *BalanceResponse) SetBody(v *BalanceResponseBody) { + if br != nil { + br.body = v + } +} + +func (br *BalanceResponse) GetResponseMetaHeader() *service.ResponseMetaHeader { + if br != nil { + return br.metaHeader + } + + return nil +} + +func (br *BalanceResponse) SetResponseMetaHeader(v *service.ResponseMetaHeader) { + if br != nil { + br.metaHeader = v + } +} + +func (br *BalanceResponse) GetResponseVerificationHeader() *service.ResponseVerificationHeader { + if br != nil { + return br.verifyHeader + } + + return nil +} + +func (br *BalanceResponse) SetResponseVerificationHeader(v *service.ResponseVerificationHeader) { + if br != nil { + br.verifyHeader = v + } +} diff --git a/v2/accounting/convert.go b/v2/accounting/convert.go index 8cc2936..5a0b6ed 100644 --- a/v2/accounting/convert.go +++ b/v2/accounting/convert.go @@ -91,3 +91,63 @@ func DecimalFromGRPCMessage(m *accounting.Decimal) *Decimal { return d } + +func BalanceResponseBodyToGRPCMessage(br *BalanceResponseBody) *accounting.BalanceResponse_Body { + if br == nil { + return nil + } + + m := new(accounting.BalanceResponse_Body) + + m.SetBalance( + DecimalToGRPCMessage(br.GetBalance()), + ) + + return m +} + +func BalanceResponseBodyFromGRPCMessage(m *accounting.BalanceResponse_Body) *BalanceResponseBody { + if m == nil { + return nil + } + + br := new(BalanceResponseBody) + + br.SetBalance( + DecimalFromGRPCMessage(m.GetBalance()), + ) + + return br +} + +func BalanceResponseToGRPCMessage(br *BalanceResponse) *accounting.BalanceResponse { + if br == nil { + return nil + } + + m := new(accounting.BalanceResponse) + + m.SetBody( + BalanceResponseBodyToGRPCMessage(br.GetBody()), + ) + + service.ResponseHeadersToGRPC(br, m) + + return m +} + +func BalanceResponseFromGRPCMessage(m *accounting.BalanceResponse) *BalanceResponse { + if m == nil { + return nil + } + + br := new(BalanceResponse) + + br.SetBody( + BalanceResponseBodyFromGRPCMessage(m.GetBody()), + ) + + service.ResponseHeadersFromGRPC(m, br) + + return br +} From e599468420fb52778f76c8522976614ca4e9cacf Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 17 Aug 2020 13:43:17 +0300 Subject: [PATCH 0297/1196] v2/service: Rename header setters Signed-off-by: Leonard Lyubich --- v2/accounting/accounting.go | 16 ++++++++-------- v2/service/convert.go | 32 ++++++++++++++++---------------- v2/signature/sign.go | 16 ++++++++-------- 3 files changed, 32 insertions(+), 32 deletions(-) diff --git a/v2/accounting/accounting.go b/v2/accounting/accounting.go index 505a47f..22be9ba 100644 --- a/v2/accounting/accounting.go +++ b/v2/accounting/accounting.go @@ -79,7 +79,7 @@ func (b *BalanceRequest) SetBody(v *BalanceRequestBody) { } } -func (b *BalanceRequest) GetRequestMetaHeader() *service.RequestMetaHeader { +func (b *BalanceRequest) GetMetaHeader() *service.RequestMetaHeader { if b != nil { return b.metaHeader } @@ -87,13 +87,13 @@ func (b *BalanceRequest) GetRequestMetaHeader() *service.RequestMetaHeader { return nil } -func (b *BalanceRequest) SetRequestMetaHeader(v *service.RequestMetaHeader) { +func (b *BalanceRequest) SetMetaHeader(v *service.RequestMetaHeader) { if b != nil { b.metaHeader = v } } -func (b *BalanceRequest) GetRequestVerificationHeader() *service.RequestVerificationHeader { +func (b *BalanceRequest) GetVerificationHeader() *service.RequestVerificationHeader { if b != nil { return b.verifyHeader } @@ -101,7 +101,7 @@ func (b *BalanceRequest) GetRequestVerificationHeader() *service.RequestVerifica return nil } -func (b *BalanceRequest) SetRequestVerificationHeader(v *service.RequestVerificationHeader) { +func (b *BalanceRequest) SetVerificationHeader(v *service.RequestVerificationHeader) { if b != nil { b.verifyHeader = v } @@ -163,7 +163,7 @@ func (br *BalanceResponse) SetBody(v *BalanceResponseBody) { } } -func (br *BalanceResponse) GetResponseMetaHeader() *service.ResponseMetaHeader { +func (br *BalanceResponse) GetMetaHeader() *service.ResponseMetaHeader { if br != nil { return br.metaHeader } @@ -171,13 +171,13 @@ func (br *BalanceResponse) GetResponseMetaHeader() *service.ResponseMetaHeader { return nil } -func (br *BalanceResponse) SetResponseMetaHeader(v *service.ResponseMetaHeader) { +func (br *BalanceResponse) SetMetaHeader(v *service.ResponseMetaHeader) { if br != nil { br.metaHeader = v } } -func (br *BalanceResponse) GetResponseVerificationHeader() *service.ResponseVerificationHeader { +func (br *BalanceResponse) GetVerificationHeader() *service.ResponseVerificationHeader { if br != nil { return br.verifyHeader } @@ -185,7 +185,7 @@ func (br *BalanceResponse) GetResponseVerificationHeader() *service.ResponseVeri return nil } -func (br *BalanceResponse) SetResponseVerificationHeader(v *service.ResponseVerificationHeader) { +func (br *BalanceResponse) SetVerificationHeader(v *service.ResponseVerificationHeader) { if br != nil { br.verifyHeader = v } diff --git a/v2/service/convert.go b/v2/service/convert.go index ddf94ee..e5786ed 100644 --- a/v2/service/convert.go +++ b/v2/service/convert.go @@ -328,8 +328,8 @@ func BearerTokenBodyFromGRPCMessage(m *service.BearerToken_Body) *BearerTokenBod func RequestHeadersToGRPC( src interface { - GetRequestMetaHeader() *RequestMetaHeader - GetRequestVerificationHeader() *RequestVerificationHeader + GetMetaHeader() *RequestMetaHeader + GetVerificationHeader() *RequestVerificationHeader }, dst interface { SetMetaHeader(*service.RequestMetaHeader) @@ -337,11 +337,11 @@ func RequestHeadersToGRPC( }, ) { dst.SetMetaHeader( - RequestMetaHeaderToGRPCMessage(src.GetRequestMetaHeader()), + RequestMetaHeaderToGRPCMessage(src.GetMetaHeader()), ) dst.SetVerifyHeader( - RequestVerificationHeaderToGRPCMessage(src.GetRequestVerificationHeader()), + RequestVerificationHeaderToGRPCMessage(src.GetVerificationHeader()), ) } @@ -351,15 +351,15 @@ func RequestHeadersFromGRPC( GetVerifyHeader() *service.RequestVerificationHeader }, dst interface { - SetRequestMetaHeader(*RequestMetaHeader) - SetRequestVerificationHeader(*RequestVerificationHeader) + SetMetaHeader(*RequestMetaHeader) + SetVerificationHeader(*RequestVerificationHeader) }, ) { - dst.SetRequestMetaHeader( + dst.SetMetaHeader( RequestMetaHeaderFromGRPCMessage(src.GetMetaHeader()), ) - dst.SetRequestVerificationHeader( + dst.SetVerificationHeader( RequestVerificationHeaderFromGRPCMessage(src.GetVerifyHeader()), ) } @@ -474,8 +474,8 @@ func ResponseMetaHeaderFromGRPCMessage(m *service.ResponseMetaHeader) *ResponseM func ResponseHeadersToGRPC( src interface { - GetResponseMetaHeader() *ResponseMetaHeader - GetResponseVerificationHeader() *ResponseVerificationHeader + GetMetaHeader() *ResponseMetaHeader + GetVerificationHeader() *ResponseVerificationHeader }, dst interface { SetMetaHeader(*service.ResponseMetaHeader) @@ -483,11 +483,11 @@ func ResponseHeadersToGRPC( }, ) { dst.SetMetaHeader( - ResponseMetaHeaderToGRPCMessage(src.GetResponseMetaHeader()), + ResponseMetaHeaderToGRPCMessage(src.GetMetaHeader()), ) dst.SetVerifyHeader( - ResponseVerificationHeaderToGRPCMessage(src.GetResponseVerificationHeader()), + ResponseVerificationHeaderToGRPCMessage(src.GetVerificationHeader()), ) } @@ -497,15 +497,15 @@ func ResponseHeadersFromGRPC( GetVerifyHeader() *service.ResponseVerificationHeader }, dst interface { - SetResponseMetaHeader(*ResponseMetaHeader) - SetResponseVerificationHeader(*ResponseVerificationHeader) + SetMetaHeader(*ResponseMetaHeader) + SetVerificationHeader(*ResponseVerificationHeader) }, ) { - dst.SetResponseMetaHeader( + dst.SetMetaHeader( ResponseMetaHeaderFromGRPCMessage(src.GetMetaHeader()), ) - dst.SetResponseVerificationHeader( + dst.SetVerificationHeader( ResponseVerificationHeaderFromGRPCMessage(src.GetVerifyHeader()), ) } diff --git a/v2/signature/sign.go b/v2/signature/sign.go index d2fd149..d0fddc5 100644 --- a/v2/signature/sign.go +++ b/v2/signature/sign.go @@ -11,9 +11,9 @@ import ( ) type SignedRequest interface { - GetRequestMetaHeader() *service.RequestMetaHeader - GetRequestVerificationHeader() *service.RequestVerificationHeader - SetRequestVerificationHeader(*service.RequestVerificationHeader) + GetMetaHeader() *service.RequestMetaHeader + GetVerificationHeader() *service.RequestVerificationHeader + SetVerificationHeader(*service.RequestVerificationHeader) } type stableMarshaler interface { @@ -64,7 +64,7 @@ func SignRequest(key *ecdsa.PrivateKey, req SignedRequest) error { verifyHdr := new(service.RequestVerificationHeader) // attach the previous matryoshka - verifyHdr.SetOrigin(req.GetRequestVerificationHeader()) + verifyHdr.SetOrigin(req.GetVerificationHeader()) // sign request body if err := signRequestPart(key, requestBody(req), verifyHdr.SetBodySignature); err != nil { @@ -72,7 +72,7 @@ func SignRequest(key *ecdsa.PrivateKey, req SignedRequest) error { } // sign meta header - if err := signRequestPart(key, req.GetRequestMetaHeader(), verifyHdr.SetMetaSignature); err != nil { + if err := signRequestPart(key, req.GetMetaHeader(), verifyHdr.SetMetaSignature); err != nil { return errors.Wrap(err, "could not sign request meta header") } @@ -82,7 +82,7 @@ func SignRequest(key *ecdsa.PrivateKey, req SignedRequest) error { } // make a new top of the matryoshka - req.SetRequestVerificationHeader(verifyHdr) + req.SetVerificationHeader(verifyHdr) return nil } @@ -106,7 +106,7 @@ func signRequestPart(key *ecdsa.PrivateKey, part stableMarshaler, sigWrite func( } func VerifyRequest(req SignedRequest) error { - verifyHdr := req.GetRequestVerificationHeader() + verifyHdr := req.GetVerificationHeader() // verify body signature if err := verifyRequestPart(requestBody(req), verifyHdr.GetBodySignature); err != nil { @@ -114,7 +114,7 @@ func VerifyRequest(req SignedRequest) error { } // verify meta header - if err := verifyRequestPart(req.GetRequestMetaHeader(), verifyHdr.GetMetaSignature); err != nil { + if err := verifyRequestPart(req.GetMetaHeader(), verifyHdr.GetMetaSignature); err != nil { return errors.Wrap(err, "could not verify request meta header") } From 65e5457a21f8096ed921b646dd1ab081422c92ec Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Mon, 17 Aug 2020 13:39:21 +0300 Subject: [PATCH 0298/1196] Fix pointer name in container id methods Signed-off-by: Alex Vanin --- v2/refs/types.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/v2/refs/types.go b/v2/refs/types.go index dd21c44..269edf4 100644 --- a/v2/refs/types.go +++ b/v2/refs/types.go @@ -32,17 +32,17 @@ func (o *OwnerID) SetValue(v []byte) { } } -func (o *ContainerID) GetValue() []byte { - if o != nil { - return o.val +func (c *ContainerID) GetValue() []byte { + if c != nil { + return c.val } return nil } -func (o *ContainerID) SetValue(v []byte) { - if o != nil { - o.val = v +func (c *ContainerID) SetValue(v []byte) { + if c != nil { + c.val = v } } From f8e6908e50d5c61966c68b4228f19c9e3387e09f Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Mon, 17 Aug 2020 13:40:41 +0300 Subject: [PATCH 0299/1196] Update NestedStructurePrefix helper function Return prefix and it's length for optimizations in stable marshallers. Signed-off-by: Alex Vanin --- util/proto/marshal.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/util/proto/marshal.go b/util/proto/marshal.go index cc055a5..a975e32 100644 --- a/util/proto/marshal.go +++ b/util/proto/marshal.go @@ -292,6 +292,7 @@ func VarUIntSize(x uint64) int { return (bits.Len64(x|1) + 6) / 7 } -func NestedStructurePrefixSize(field int64) int { - return VarUIntSize(uint64(field<<3 | 0x02)) +func NestedStructurePrefix(field int64) (prefix uint64, ln int) { + prefix = uint64(field<<3 | 0x02) + return prefix, VarUIntSize(prefix) } From 2c33e22db56b2cad534d136a8bcbd1670f15e1c9 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Mon, 17 Aug 2020 13:41:09 +0300 Subject: [PATCH 0300/1196] Add stable marshal for refs package Signed-off-by: Alex Vanin --- v2/refs/marshal.go | 157 ++++++++++++++++++++++++++++++++++++++++ v2/refs/marshal_test.go | 89 +++++++++++++++++++++++ 2 files changed, 246 insertions(+) create mode 100644 v2/refs/marshal.go create mode 100644 v2/refs/marshal_test.go diff --git a/v2/refs/marshal.go b/v2/refs/marshal.go new file mode 100644 index 0000000..2a835fd --- /dev/null +++ b/v2/refs/marshal.go @@ -0,0 +1,157 @@ +package refs + +import ( + "encoding/binary" + + "github.com/nspcc-dev/neofs-api-go/util/proto" +) + +const ( + OwnerIDValField = 1 + + ContainerIDValField = 1 + + ObjectIDValField = 1 + + AddressContainerField = 1 + AddressObjectField = 2 +) + +func (o *OwnerID) StableMarshal(buf []byte) ([]byte, error) { + if o == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, o.StableSize()) + } + + _, err := proto.BytesMarshal(OwnerIDValField, buf, o.val) + if err != nil { + return nil, err + } + + return buf, nil +} + +func (o *OwnerID) StableSize() int { + if o == nil { + return 0 + } + return proto.BytesSize(OwnerIDValField, o.val) +} + +func (c *ContainerID) StableMarshal(buf []byte) ([]byte, error) { + if c == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, c.StableSize()) + } + + _, err := proto.BytesMarshal(ContainerIDValField, buf, c.val) + if err != nil { + return nil, err + } + + return buf, nil +} + +func (c *ContainerID) StableSize() int { + if c == nil { + return 0 + } + return proto.BytesSize(ContainerIDValField, c.val) +} + +func (o *ObjectID) StableMarshal(buf []byte) ([]byte, error) { + if o == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, o.StableSize()) + } + + _, err := proto.BytesMarshal(ObjectIDValField, buf, o.val) + if err != nil { + return nil, err + } + + return buf, nil +} + +func (o *ObjectID) StableSize() int { + if o == nil { + return 0 + } + + return proto.BytesSize(ObjectIDValField, o.val) +} + +func (a *Address) StableMarshal(buf []byte) ([]byte, error) { + if a == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, a.StableSize()) + } + + var ( + offset, n int + prefix uint64 + err error + ) + + if a.cid != nil { + prefix, _ = proto.NestedStructurePrefix(AddressContainerField) + offset = binary.PutUvarint(buf, prefix) + + n = a.cid.StableSize() + offset += binary.PutUvarint(buf[offset:], uint64(n)) + + _, err = a.cid.StableMarshal(buf[offset:]) + if err != nil { + return nil, err + } + + offset += n + } + + if a.oid != nil { + prefix, _ = proto.NestedStructurePrefix(AddressObjectField) + offset += binary.PutUvarint(buf[offset:], prefix) + + n = a.oid.StableSize() + offset += binary.PutUvarint(buf[offset:], uint64(n)) + + _, err = a.oid.StableMarshal(buf[offset:]) + if err != nil { + return nil, err + } + } + + return buf, nil +} + +func (a *Address) StableSize() (size int) { + if a == nil { + return 0 + } + + if a.cid != nil { + _, ln := proto.NestedStructurePrefix(AddressContainerField) + n := a.cid.StableSize() + size += ln + proto.VarUIntSize(uint64(n)) + n + } + + if a.oid != nil { + _, ln := proto.NestedStructurePrefix(AddressObjectField) + n := a.oid.StableSize() + size += ln + proto.VarUIntSize(uint64(n)) + n + } + + return size +} diff --git a/v2/refs/marshal_test.go b/v2/refs/marshal_test.go new file mode 100644 index 0000000..0e9f7ac --- /dev/null +++ b/v2/refs/marshal_test.go @@ -0,0 +1,89 @@ +package refs_test + +import ( + "testing" + + "github.com/nspcc-dev/neofs-api-go/v2/refs" + grpc "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" + "github.com/stretchr/testify/require" +) + +func TestOwnerID_StableMarshal(t *testing.T) { + ownerFrom := new(refs.OwnerID) + ownerTransport := new(grpc.OwnerID) + + t.Run("non empty", func(t *testing.T) { + ownerFrom.SetValue([]byte("Owner ID")) + + wire, err := ownerFrom.StableMarshal(nil) + require.NoError(t, err) + + err = ownerTransport.Unmarshal(wire) + require.NoError(t, err) + + ownerTo := refs.OwnerIDFromGRPCMessage(ownerTransport) + require.Equal(t, ownerFrom, ownerTo) + }) +} + +func TestContainerID_StableMarshal(t *testing.T) { + cnrFrom := new(refs.ContainerID) + cnrTransport := new(grpc.ContainerID) + + t.Run("non empty", func(t *testing.T) { + cnrFrom.SetValue([]byte("Container ID")) + + wire, err := cnrFrom.StableMarshal(nil) + require.NoError(t, err) + + err = cnrTransport.Unmarshal(wire) + require.NoError(t, err) + + cnrTo := refs.ContainerIDFromGRPCMessage(cnrTransport) + require.Equal(t, cnrFrom, cnrTo) + }) +} + +func TestObjectID_StableMarshal(t *testing.T) { + objectIDFrom := new(refs.ObjectID) + objectIDTransport := new(grpc.ObjectID) + + t.Run("non empty", func(t *testing.T) { + objectIDFrom.SetValue([]byte("Object ID")) + + wire, err := objectIDFrom.StableMarshal(nil) + require.NoError(t, err) + + err = objectIDTransport.Unmarshal(wire) + require.NoError(t, err) + + objectIDTo := refs.ObjectIDFromGRPCMessage(objectIDTransport) + require.Equal(t, objectIDFrom, objectIDTo) + }) +} + +func TestAddress_StableMarshal(t *testing.T) { + addressFrom := new(refs.Address) + + cnr := new(refs.ContainerID) + cnr.SetValue([]byte("Container ID")) + + objectID := new(refs.ObjectID) + objectID.SetValue([]byte("Object ID")) + + addressTransport := new(grpc.Address) + + t.Run("non empty", func(t *testing.T) { + addressFrom.SetContainerID(cnr) + addressFrom.SetObjectID(objectID) + + wire, err := addressFrom.StableMarshal(nil) + require.NoError(t, err) + + err = addressTransport.Unmarshal(wire) + require.NoError(t, err) + + addressTo := refs.AddressFromGRPCMessage(addressTransport) + require.Equal(t, addressFrom, addressTo) + }) +} From 8a94a6344ab001648e900f22be32eaa78b9b0cd9 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Mon, 17 Aug 2020 14:29:50 +0300 Subject: [PATCH 0301/1196] Recompile proto files with latest neofs-api Signed-off-by: Alex Vanin --- v2/acl/grpc/types.pb.go | 265 +++++++------ v2/container/grpc/types.pb.go | 151 +++++--- v2/object/grpc/service.pb.go | 597 +++++------------------------ v2/object/grpc/types.pb.go | 701 ++++++++++++++++++++++++++-------- v2/service/grpc/meta.pb.go | 497 ++++++++++++++++-------- v2/service/grpc/verify.pb.go | 48 ++- 6 files changed, 1255 insertions(+), 1004 deletions(-) diff --git a/v2/acl/grpc/types.pb.go b/v2/acl/grpc/types.pb.go index bba96ad..e9932c8 100644 --- a/v2/acl/grpc/types.pb.go +++ b/v2/acl/grpc/types.pb.go @@ -60,29 +60,61 @@ func (Target) EnumDescriptor() ([]byte, []int) { return fileDescriptor_8233b6696fb3e24f, []int{0} } +// MatchType is an enumeration of match types. +type MatchType int32 + +const ( + // Unspecified match type, default value. + MatchType_MATCH_TYPE_UNSPECIFIED MatchType = 0 + // Return true if strings are equal + MatchType_STRING_EQUAL MatchType = 1 + // Return true if strings are different + MatchType_STRING_NOT_EQUAL MatchType = 2 +) + +var MatchType_name = map[int32]string{ + 0: "MATCH_TYPE_UNSPECIFIED", + 1: "STRING_EQUAL", + 2: "STRING_NOT_EQUAL", +} + +var MatchType_value = map[string]int32{ + "MATCH_TYPE_UNSPECIFIED": 0, + "STRING_EQUAL": 1, + "STRING_NOT_EQUAL": 2, +} + +func (x MatchType) String() string { + return proto.EnumName(MatchType_name, int32(x)) +} + +func (MatchType) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_8233b6696fb3e24f, []int{1} +} + // Operation is an enumeration of operation types. -type EACLRecord_Operation int32 +type Operation int32 const ( // Unspecified operation, default value. - EACLRecord_OPERATION_UNSPECIFIED EACLRecord_Operation = 0 + Operation_OPERATION_UNSPECIFIED Operation = 0 // Get - EACLRecord_GET EACLRecord_Operation = 1 + Operation_GET Operation = 1 // Head - EACLRecord_HEAD EACLRecord_Operation = 2 + Operation_HEAD Operation = 2 // Put - EACLRecord_PUT EACLRecord_Operation = 3 + Operation_PUT Operation = 3 // Delete - EACLRecord_DELETE EACLRecord_Operation = 4 + Operation_DELETE Operation = 4 // Search - EACLRecord_SEARCH EACLRecord_Operation = 5 + Operation_SEARCH Operation = 5 // GetRange - EACLRecord_GETRANGE EACLRecord_Operation = 6 + Operation_GETRANGE Operation = 6 // GetRangeHash - EACLRecord_GETRANGEHASH EACLRecord_Operation = 7 + Operation_GETRANGEHASH Operation = 7 ) -var EACLRecord_Operation_name = map[int32]string{ +var Operation_name = map[int32]string{ 0: "OPERATION_UNSPECIFIED", 1: "GET", 2: "HEAD", @@ -93,7 +125,7 @@ var EACLRecord_Operation_name = map[int32]string{ 7: "GETRANGEHASH", } -var EACLRecord_Operation_value = map[string]int32{ +var Operation_value = map[string]int32{ "OPERATION_UNSPECIFIED": 0, "GET": 1, "HEAD": 2, @@ -104,116 +136,84 @@ var EACLRecord_Operation_value = map[string]int32{ "GETRANGEHASH": 7, } -func (x EACLRecord_Operation) String() string { - return proto.EnumName(EACLRecord_Operation_name, int32(x)) +func (x Operation) String() string { + return proto.EnumName(Operation_name, int32(x)) } -func (EACLRecord_Operation) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_8233b6696fb3e24f, []int{0, 0} +func (Operation) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_8233b6696fb3e24f, []int{2} } // Action is an enumeration of EACL actions. -type EACLRecord_Action int32 +type Action int32 const ( // Unspecified action, default value. - EACLRecord_ACTION_UNSPECIFIED EACLRecord_Action = 0 + Action_ACTION_UNSPECIFIED Action = 0 // Allow action - EACLRecord_ALLOW EACLRecord_Action = 1 + Action_ALLOW Action = 1 // Deny action - EACLRecord_DENY EACLRecord_Action = 2 + Action_DENY Action = 2 ) -var EACLRecord_Action_name = map[int32]string{ +var Action_name = map[int32]string{ 0: "ACTION_UNSPECIFIED", 1: "ALLOW", 2: "DENY", } -var EACLRecord_Action_value = map[string]int32{ +var Action_value = map[string]int32{ "ACTION_UNSPECIFIED": 0, "ALLOW": 1, "DENY": 2, } -func (x EACLRecord_Action) String() string { - return proto.EnumName(EACLRecord_Action_name, int32(x)) +func (x Action) String() string { + return proto.EnumName(Action_name, int32(x)) } -func (EACLRecord_Action) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_8233b6696fb3e24f, []int{0, 1} +func (Action) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_8233b6696fb3e24f, []int{3} } // Header is an enumeration of filtering header types. -type EACLRecord_FilterInfo_Header int32 +type HeaderType int32 const ( // Unspecified header, default value. - EACLRecord_FilterInfo_HEADER_UNSPECIFIED EACLRecord_FilterInfo_Header = 0 + HeaderType_HEADER_UNSPECIFIED HeaderType = 0 // Filter request headers - EACLRecord_FilterInfo_REQUEST EACLRecord_FilterInfo_Header = 1 + HeaderType_REQUEST HeaderType = 1 // Filter object headers - EACLRecord_FilterInfo_OBJECT EACLRecord_FilterInfo_Header = 2 + HeaderType_OBJECT HeaderType = 2 ) -var EACLRecord_FilterInfo_Header_name = map[int32]string{ +var HeaderType_name = map[int32]string{ 0: "HEADER_UNSPECIFIED", 1: "REQUEST", 2: "OBJECT", } -var EACLRecord_FilterInfo_Header_value = map[string]int32{ +var HeaderType_value = map[string]int32{ "HEADER_UNSPECIFIED": 0, "REQUEST": 1, "OBJECT": 2, } -func (x EACLRecord_FilterInfo_Header) String() string { - return proto.EnumName(EACLRecord_FilterInfo_Header_name, int32(x)) +func (x HeaderType) String() string { + return proto.EnumName(HeaderType_name, int32(x)) } -func (EACLRecord_FilterInfo_Header) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_8233b6696fb3e24f, []int{0, 0, 0} -} - -// MatchType is an enumeration of match types. -type EACLRecord_FilterInfo_MatchType int32 - -const ( - // Unspecified match type, default value. - EACLRecord_FilterInfo_MATCH_TYPE_UNSPECIFIED EACLRecord_FilterInfo_MatchType = 0 - // Return true if strings are equal - EACLRecord_FilterInfo_STRING_EQUAL EACLRecord_FilterInfo_MatchType = 1 - // Return true if strings are different - EACLRecord_FilterInfo_STRING_NOT_EQUAL EACLRecord_FilterInfo_MatchType = 2 -) - -var EACLRecord_FilterInfo_MatchType_name = map[int32]string{ - 0: "MATCH_TYPE_UNSPECIFIED", - 1: "STRING_EQUAL", - 2: "STRING_NOT_EQUAL", -} - -var EACLRecord_FilterInfo_MatchType_value = map[string]int32{ - "MATCH_TYPE_UNSPECIFIED": 0, - "STRING_EQUAL": 1, - "STRING_NOT_EQUAL": 2, -} - -func (x EACLRecord_FilterInfo_MatchType) String() string { - return proto.EnumName(EACLRecord_FilterInfo_MatchType_name, int32(x)) -} - -func (EACLRecord_FilterInfo_MatchType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_8233b6696fb3e24f, []int{0, 0, 1} +func (HeaderType) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_8233b6696fb3e24f, []int{4} } // EACLRecord groups information about extended ACL rule. type EACLRecord struct { // Operation carries type of operation. - Operation EACLRecord_Operation `protobuf:"varint,1,opt,name=operation,json=Operation,proto3,enum=neo.fs.v2.acl.EACLRecord_Operation" json:"operation,omitempty"` + Operation Operation `protobuf:"varint,1,opt,name=operation,json=Operation,proto3,enum=neo.fs.v2.acl.Operation" json:"operation,omitempty"` // Action carries ACL target action. - Action EACLRecord_Action `protobuf:"varint,2,opt,name=action,json=Action,proto3,enum=neo.fs.v2.acl.EACLRecord_Action" json:"action,omitempty"` + Action Action `protobuf:"varint,2,opt,name=action,json=Action,proto3,enum=neo.fs.v2.acl.Action" json:"action,omitempty"` // filters carries set of filters. Filters []*EACLRecord_FilterInfo `protobuf:"bytes,3,rep,name=filters,json=Filters,proto3" json:"filters,omitempty"` // targets carries information about extended ACL target list. @@ -256,18 +256,18 @@ func (m *EACLRecord) XXX_DiscardUnknown() { var xxx_messageInfo_EACLRecord proto.InternalMessageInfo -func (m *EACLRecord) GetOperation() EACLRecord_Operation { +func (m *EACLRecord) GetOperation() Operation { if m != nil { return m.Operation } - return EACLRecord_OPERATION_UNSPECIFIED + return Operation_OPERATION_UNSPECIFIED } -func (m *EACLRecord) GetAction() EACLRecord_Action { +func (m *EACLRecord) GetAction() Action { if m != nil { return m.Action } - return EACLRecord_ACTION_UNSPECIFIED + return Action_ACTION_UNSPECIFIED } func (m *EACLRecord) GetFilters() []*EACLRecord_FilterInfo { @@ -287,9 +287,9 @@ func (m *EACLRecord) GetTargets() []*EACLRecord_TargetInfo { // FilterInfo groups information about filter. type EACLRecord_FilterInfo struct { // Header carries type of header. - Header EACLRecord_FilterInfo_Header `protobuf:"varint,1,opt,name=header,json=HeaderType,proto3,enum=neo.fs.v2.acl.EACLRecord_FilterInfo_Header" json:"header,omitempty"` + Header HeaderType `protobuf:"varint,1,opt,name=header,json=HeaderType,proto3,enum=neo.fs.v2.acl.HeaderType" json:"header,omitempty"` // MatchType carries type of match. - MatchType EACLRecord_FilterInfo_MatchType `protobuf:"varint,2,opt,name=match_type,json=MatchType,proto3,enum=neo.fs.v2.acl.EACLRecord_FilterInfo_MatchType" json:"match_type,omitempty"` + MatchType MatchType `protobuf:"varint,2,opt,name=match_type,json=MatchType,proto3,enum=neo.fs.v2.acl.MatchType" json:"match_type,omitempty"` // header_name carries name of filtering header. HeaderName string `protobuf:"bytes,3,opt,name=header_name,json=Name,proto3" json:"header_name,omitempty"` // header_val carries value of filtering header. @@ -332,18 +332,18 @@ func (m *EACLRecord_FilterInfo) XXX_DiscardUnknown() { var xxx_messageInfo_EACLRecord_FilterInfo proto.InternalMessageInfo -func (m *EACLRecord_FilterInfo) GetHeader() EACLRecord_FilterInfo_Header { +func (m *EACLRecord_FilterInfo) GetHeader() HeaderType { if m != nil { return m.Header } - return EACLRecord_FilterInfo_HEADER_UNSPECIFIED + return HeaderType_HEADER_UNSPECIFIED } -func (m *EACLRecord_FilterInfo) GetMatchType() EACLRecord_FilterInfo_MatchType { +func (m *EACLRecord_FilterInfo) GetMatchType() MatchType { if m != nil { return m.MatchType } - return EACLRecord_FilterInfo_MATCH_TYPE_UNSPECIFIED + return MatchType_MATCH_TYPE_UNSPECIFIED } func (m *EACLRecord_FilterInfo) GetHeaderName() string { @@ -479,10 +479,10 @@ func (m *EACLTable) GetRecords() []*EACLRecord { func init() { proto.RegisterEnum("neo.fs.v2.acl.Target", Target_name, Target_value) - proto.RegisterEnum("neo.fs.v2.acl.EACLRecord_Operation", EACLRecord_Operation_name, EACLRecord_Operation_value) - proto.RegisterEnum("neo.fs.v2.acl.EACLRecord_Action", EACLRecord_Action_name, EACLRecord_Action_value) - proto.RegisterEnum("neo.fs.v2.acl.EACLRecord_FilterInfo_Header", EACLRecord_FilterInfo_Header_name, EACLRecord_FilterInfo_Header_value) - proto.RegisterEnum("neo.fs.v2.acl.EACLRecord_FilterInfo_MatchType", EACLRecord_FilterInfo_MatchType_name, EACLRecord_FilterInfo_MatchType_value) + proto.RegisterEnum("neo.fs.v2.acl.MatchType", MatchType_name, MatchType_value) + proto.RegisterEnum("neo.fs.v2.acl.Operation", Operation_name, Operation_value) + proto.RegisterEnum("neo.fs.v2.acl.Action", Action_name, Action_value) + proto.RegisterEnum("neo.fs.v2.acl.HeaderType", HeaderType_name, HeaderType_value) proto.RegisterType((*EACLRecord)(nil), "neo.fs.v2.acl.EACLRecord") proto.RegisterType((*EACLRecord_FilterInfo)(nil), "neo.fs.v2.acl.EACLRecord.FilterInfo") proto.RegisterType((*EACLRecord_TargetInfo)(nil), "neo.fs.v2.acl.EACLRecord.TargetInfo") @@ -492,52 +492,51 @@ func init() { func init() { proto.RegisterFile("v2/acl/grpc/types.proto", fileDescriptor_8233b6696fb3e24f) } var fileDescriptor_8233b6696fb3e24f = []byte{ - // 710 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x54, 0xd1, 0x6e, 0xda, 0x3a, - 0x18, 0x6e, 0x42, 0x1a, 0xe0, 0x87, 0x73, 0x64, 0x59, 0xa7, 0x1c, 0xca, 0x91, 0x10, 0xe2, 0xec, - 0x02, 0xad, 0x6a, 0xd0, 0xa8, 0x26, 0x6d, 0x9a, 0x54, 0x29, 0x05, 0x17, 0xd8, 0x20, 0x50, 0xc7, - 0x74, 0xea, 0x6e, 0x50, 0x1a, 0x0c, 0x45, 0x0b, 0x09, 0x4a, 0x52, 0x24, 0x76, 0xb5, 0xc7, 0xd8, - 0x33, 0xec, 0x49, 0x76, 0xb9, 0x47, 0x98, 0x3a, 0x69, 0xcf, 0xb0, 0xcb, 0xc9, 0x09, 0xb4, 0x8c, - 0xad, 0x5a, 0xaf, 0xfc, 0xc7, 0xfe, 0xbe, 0xdf, 0x9f, 0x3f, 0x7f, 0x31, 0xfc, 0xbb, 0xa8, 0x55, - 0x2d, 0xdb, 0xa9, 0x4e, 0xfc, 0xb9, 0x5d, 0x0d, 0x97, 0x73, 0x1e, 0x68, 0x73, 0xdf, 0x0b, 0x3d, - 0xfc, 0x97, 0xcb, 0x3d, 0x6d, 0x1c, 0x68, 0x8b, 0x9a, 0x66, 0xd9, 0x4e, 0x21, 0xbf, 0xa8, 0x55, - 0x7d, 0x3e, 0x0e, 0x7e, 0x01, 0x96, 0xbf, 0xab, 0x00, 0x44, 0xaf, 0x77, 0x28, 0xb7, 0x3d, 0x7f, - 0x84, 0x75, 0x48, 0x7b, 0x73, 0xee, 0x5b, 0xe1, 0xd4, 0x73, 0xf3, 0x52, 0x49, 0xaa, 0xfc, 0x5d, - 0xfb, 0x5f, 0xfb, 0xa9, 0x97, 0x76, 0x87, 0xd6, 0x7a, 0x6b, 0x28, 0x4d, 0xdf, 0x96, 0xf8, 0x19, - 0xa8, 0x96, 0x1d, 0xf1, 0xe5, 0x88, 0x5f, 0xba, 0x9f, 0xaf, 0x47, 0x38, 0xaa, 0xc6, 0x23, 0x3e, - 0x86, 0xe4, 0x78, 0xea, 0x84, 0xdc, 0x0f, 0xf2, 0x89, 0x52, 0xa2, 0x92, 0xa9, 0x3d, 0xba, 0x9f, - 0x7a, 0x1a, 0x01, 0xdb, 0xee, 0xd8, 0xa3, 0xc9, 0xb8, 0x0e, 0x04, 0x3f, 0xb4, 0xfc, 0x09, 0x0f, - 0x83, 0xbc, 0xf2, 0x27, 0x3e, 0x8b, 0x80, 0x31, 0x3f, 0xae, 0x83, 0xc2, 0x37, 0x19, 0xe0, 0xae, - 0x2f, 0x6e, 0x82, 0x7a, 0xc5, 0xad, 0x11, 0xf7, 0x57, 0x46, 0x1c, 0x3c, 0x44, 0x8d, 0xd6, 0x8a, - 0x28, 0x14, 0xe2, 0x91, 0x2d, 0xe7, 0x1c, 0x77, 0x01, 0x66, 0x56, 0x68, 0x5f, 0x0d, 0x85, 0xf1, - 0x2b, 0x57, 0xb4, 0x07, 0x35, 0xeb, 0x0a, 0x9a, 0xe8, 0x41, 0xd3, 0xb7, 0x25, 0xde, 0x87, 0x4c, - 0xac, 0x6b, 0xe8, 0x5a, 0x33, 0x9e, 0x4f, 0x94, 0xa4, 0x4a, 0x9a, 0x2a, 0x86, 0x35, 0x13, 0x4b, - 0xb0, 0x5a, 0x5a, 0x58, 0x4e, 0x5e, 0x89, 0x56, 0x76, 0xcf, 0x2d, 0xe7, 0x9a, 0x97, 0x9f, 0x83, - 0x1a, 0x4b, 0xc2, 0x39, 0xc0, 0x2d, 0xa2, 0x37, 0x08, 0x1d, 0x0e, 0x0c, 0xb3, 0x4f, 0xea, 0xed, - 0xd3, 0x36, 0x69, 0xa0, 0x1d, 0x9c, 0x81, 0x24, 0x25, 0x67, 0x03, 0x62, 0x32, 0x24, 0x61, 0x00, - 0xb5, 0x77, 0xf2, 0x92, 0xd4, 0x19, 0x92, 0xcb, 0x3d, 0xd8, 0xd8, 0xbd, 0x00, 0xb9, 0xae, 0xce, - 0xea, 0xad, 0x21, 0xbb, 0xe8, 0x93, 0xad, 0x0e, 0x08, 0xb2, 0x26, 0xa3, 0x6d, 0xa3, 0x39, 0x24, - 0x67, 0x03, 0xbd, 0x83, 0x24, 0xfc, 0x0f, 0xa0, 0xd5, 0x8c, 0xd1, 0x63, 0xab, 0x59, 0xb9, 0x70, - 0x06, 0x70, 0xe7, 0x3f, 0x3e, 0x00, 0x35, 0xbe, 0xb6, 0x95, 0xcf, 0x7b, 0x5b, 0xd6, 0xc4, 0x50, - 0xaa, 0x50, 0xcf, 0xe1, 0x38, 0x07, 0xa9, 0xb7, 0x7c, 0x39, 0x74, 0xa6, 0x41, 0x98, 0x97, 0x4b, - 0x89, 0x4a, 0x96, 0x2a, 0xaf, 0xf8, 0x32, 0x28, 0xbf, 0x83, 0x8d, 0x08, 0xee, 0xc3, 0x5e, 0xaf, - 0x4f, 0xa8, 0xce, 0xda, 0x3d, 0x63, 0x4b, 0x62, 0x12, 0x12, 0x4d, 0x22, 0x0e, 0x98, 0x02, 0x45, - 0xb8, 0x80, 0x64, 0x31, 0xd5, 0x1f, 0x30, 0x94, 0x10, 0x67, 0x6e, 0x90, 0x0e, 0x61, 0x04, 0x29, - 0xa2, 0x36, 0x89, 0x4e, 0xeb, 0x2d, 0xb4, 0x8b, 0xb3, 0x90, 0x6a, 0x12, 0x46, 0x75, 0xa3, 0x49, - 0x90, 0x2a, 0x0e, 0xb9, 0xfe, 0x6a, 0xe9, 0x66, 0x0b, 0x25, 0xcb, 0x4f, 0x61, 0x9d, 0xe0, 0x1c, - 0x60, 0xbd, 0xfe, 0x9b, 0x5d, 0xd3, 0xb0, 0xab, 0x77, 0x3a, 0xbd, 0xd7, 0xf1, 0xbe, 0x0d, 0x62, - 0x5c, 0x20, 0xb9, 0xfc, 0x5e, 0x82, 0xb4, 0xb8, 0x76, 0x66, 0x5d, 0x3a, 0x1c, 0x1f, 0x43, 0xd6, - 0xf6, 0xdc, 0xd0, 0x9a, 0xba, 0xdc, 0x1f, 0x4e, 0x47, 0x91, 0x17, 0x99, 0xda, 0x7f, 0x1b, 0x5e, - 0x88, 0x1f, 0x58, 0xab, 0xaf, 0x31, 0xed, 0x06, 0xcd, 0x6c, 0x7c, 0xe0, 0x23, 0x48, 0xfa, 0x51, - 0x7e, 0x82, 0xc8, 0x97, 0x4c, 0x6d, 0xff, 0xde, 0x84, 0xd1, 0x64, 0x3c, 0x06, 0x8f, 0x4f, 0x40, - 0x8d, 0xdd, 0x15, 0xca, 0x99, 0x4e, 0x9b, 0x84, 0x6d, 0x29, 0x4f, 0x81, 0x32, 0x30, 0x09, 0x8d, - 0x13, 0x61, 0x5e, 0x98, 0x8c, 0x74, 0x91, 0x1c, 0xa5, 0x83, 0xb5, 0x08, 0x35, 0x51, 0xe2, 0xe4, - 0xfc, 0xd3, 0x4d, 0x51, 0xfa, 0x7c, 0x53, 0x94, 0xbe, 0xdc, 0x14, 0xa5, 0x0f, 0x5f, 0x8b, 0x3b, - 0x6f, 0x9e, 0x4c, 0xa6, 0xe1, 0xd5, 0xf5, 0xa5, 0x66, 0x7b, 0xb3, 0xaa, 0x1b, 0xcc, 0x6d, 0xfb, - 0x70, 0xc4, 0x17, 0x55, 0x97, 0x7b, 0xe3, 0xe0, 0xd0, 0x9a, 0x4f, 0x0f, 0x27, 0x5e, 0x75, 0xe3, - 0xdd, 0x7a, 0x61, 0xd9, 0xce, 0x47, 0x19, 0x19, 0xdc, 0x3b, 0x35, 0x35, 0xbd, 0xdf, 0x16, 0x7a, - 0x75, 0xdb, 0xb9, 0x54, 0xa3, 0x07, 0xea, 0xe8, 0x47, 0x00, 0x00, 0x00, 0xff, 0xff, 0xf6, 0x1c, - 0x01, 0xad, 0xe4, 0x04, 0x00, 0x00, + // 703 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x54, 0xd1, 0x6e, 0xda, 0x48, + 0x14, 0x8d, 0x6d, 0x62, 0xc2, 0x85, 0x5d, 0x8d, 0x46, 0x1b, 0xd6, 0x61, 0x25, 0x84, 0xa2, 0x7d, + 0x40, 0xac, 0x30, 0x5a, 0xa2, 0xec, 0x3e, 0x54, 0x8d, 0xe4, 0xc0, 0x04, 0x68, 0x89, 0x4d, 0xc6, + 0x43, 0xaa, 0xf4, 0x05, 0x39, 0x66, 0x20, 0xa8, 0xc6, 0x46, 0xb6, 0x83, 0x44, 0x9f, 0xfa, 0x19, + 0xfd, 0x86, 0x3e, 0xf6, 0x2b, 0xfa, 0xd8, 0x4f, 0xa8, 0xd2, 0xcf, 0xe8, 0x4b, 0x65, 0x1b, 0x02, + 0x75, 0x2a, 0xf5, 0xc9, 0xd7, 0x73, 0xcf, 0x39, 0xf7, 0xcc, 0xf1, 0x78, 0xe0, 0xcf, 0x65, 0xb3, + 0x61, 0xd9, 0x4e, 0x63, 0xea, 0x2f, 0xec, 0x46, 0xb8, 0x5a, 0xf0, 0x40, 0x5d, 0xf8, 0x5e, 0xe8, + 0xe1, 0xdf, 0x5c, 0xee, 0xa9, 0x93, 0x40, 0x5d, 0x36, 0x55, 0xcb, 0x76, 0x4a, 0xca, 0xb2, 0xd9, + 0xf0, 0xf9, 0x24, 0x78, 0x02, 0x3c, 0xfe, 0x26, 0x01, 0x10, 0xad, 0xd5, 0xa7, 0xdc, 0xf6, 0xfc, + 0x31, 0xfe, 0x0f, 0x72, 0xde, 0x82, 0xfb, 0x56, 0x38, 0xf3, 0x5c, 0x45, 0xa8, 0x08, 0xd5, 0xdf, + 0x9b, 0x8a, 0xfa, 0x83, 0x96, 0x6a, 0x6c, 0xfa, 0x34, 0xf7, 0x58, 0xe2, 0x3a, 0xc8, 0x96, 0x1d, + 0x93, 0xc4, 0x98, 0x74, 0x98, 0x22, 0x69, 0x71, 0x93, 0xca, 0xc9, 0x13, 0x9f, 0x41, 0x76, 0x32, + 0x73, 0x42, 0xee, 0x07, 0x8a, 0x54, 0x91, 0xaa, 0xf9, 0xe6, 0xdf, 0x29, 0xfc, 0xd6, 0x92, 0x7a, + 0x11, 0x03, 0x7b, 0xee, 0xc4, 0xa3, 0xd9, 0xa4, 0x0e, 0x22, 0x7e, 0x68, 0xf9, 0x53, 0x1e, 0x06, + 0x4a, 0xe6, 0x57, 0x7c, 0x16, 0x03, 0x13, 0x7e, 0x52, 0x07, 0xa5, 0x8f, 0x02, 0xc0, 0x56, 0x17, + 0x9f, 0x82, 0x7c, 0xc7, 0xad, 0x31, 0xf7, 0xd7, 0x5b, 0x3e, 0x4a, 0xa9, 0x75, 0xe3, 0x26, 0x5b, + 0x2d, 0x38, 0x85, 0x6d, 0x8d, 0xff, 0x07, 0x98, 0x5b, 0xa1, 0x7d, 0x37, 0x8a, 0x02, 0x5d, 0x6f, + 0x3c, 0x9d, 0xd6, 0x65, 0x04, 0x88, 0x99, 0xb9, 0xc7, 0x12, 0x1f, 0x41, 0x3e, 0x99, 0x37, 0x72, + 0xad, 0x39, 0x57, 0xa4, 0x8a, 0x50, 0xcd, 0xd1, 0x8c, 0x6e, 0xcd, 0xa3, 0x16, 0xac, 0x5b, 0x4b, + 0xcb, 0x51, 0x32, 0x71, 0x67, 0xff, 0xda, 0x72, 0xee, 0x79, 0xe9, 0x0a, 0x60, 0xbb, 0x17, 0xfc, + 0x0f, 0xc8, 0x49, 0x04, 0x6b, 0xcf, 0xe9, 0xc4, 0x13, 0x28, 0xcd, 0x50, 0xcf, 0xe1, 0xb8, 0x08, + 0x07, 0x6f, 0xf8, 0x6a, 0xe4, 0xcc, 0x82, 0x50, 0x11, 0x2b, 0x52, 0xb5, 0x40, 0x33, 0x2f, 0xf9, + 0x2a, 0x38, 0x7e, 0x27, 0x40, 0x2e, 0x8a, 0x8a, 0x59, 0xb7, 0x0e, 0xc7, 0x67, 0x50, 0xb0, 0x3d, + 0x37, 0xb4, 0x66, 0x2e, 0xf7, 0x47, 0xb3, 0x71, 0x2c, 0x9c, 0x6f, 0xfe, 0xb5, 0x23, 0x1c, 0x9d, + 0x21, 0xb5, 0xb5, 0xc1, 0xf4, 0xda, 0x34, 0xbf, 0xf3, 0x82, 0x4f, 0x20, 0xeb, 0xc7, 0x99, 0x07, + 0xf1, 0x90, 0xfc, 0x93, 0x1c, 0xb7, 0x5f, 0x85, 0x66, 0x93, 0x67, 0x50, 0x3b, 0x07, 0x39, 0xb1, + 0x8a, 0x8b, 0x80, 0x99, 0x46, 0x3b, 0x84, 0x8d, 0x86, 0xba, 0x39, 0x20, 0xad, 0xde, 0x45, 0x8f, + 0xb4, 0xd1, 0x1e, 0x3e, 0x80, 0xcc, 0xd0, 0x24, 0x14, 0x09, 0x18, 0x40, 0x36, 0x6f, 0x4c, 0x46, + 0x2e, 0x91, 0x18, 0xd5, 0x06, 0xeb, 0x12, 0x6a, 0x22, 0xa9, 0x66, 0xc0, 0x4e, 0xb8, 0x25, 0x28, + 0x5e, 0x6a, 0xac, 0xd5, 0x1d, 0xb1, 0x9b, 0x01, 0x49, 0x49, 0x21, 0x28, 0x98, 0x8c, 0xf6, 0xf4, + 0xce, 0x88, 0x5c, 0x0d, 0xb5, 0x3e, 0x12, 0xf0, 0x1f, 0x80, 0xd6, 0x2b, 0xba, 0xc1, 0xd6, 0xab, + 0x62, 0xed, 0x2d, 0xec, 0x9c, 0xed, 0x23, 0x38, 0x34, 0x06, 0x84, 0x6a, 0xac, 0x67, 0xe8, 0x29, + 0xbd, 0x2c, 0x48, 0x1d, 0xc2, 0x90, 0x10, 0x79, 0xec, 0x12, 0xad, 0x8d, 0xc4, 0x68, 0x69, 0x30, + 0x64, 0x48, 0x8a, 0x0c, 0xb6, 0x49, 0x9f, 0x30, 0x82, 0x32, 0xb1, 0x71, 0xa2, 0xd1, 0x56, 0x17, + 0xed, 0xe3, 0x02, 0x1c, 0x74, 0x08, 0xa3, 0x9a, 0xde, 0x21, 0x48, 0x8e, 0x1c, 0x6d, 0xde, 0xba, + 0x9a, 0xd9, 0x45, 0xd9, 0xda, 0x29, 0x6c, 0xfe, 0x92, 0x22, 0x60, 0xad, 0xf5, 0x93, 0xa9, 0x39, + 0xd8, 0xd7, 0xfa, 0x7d, 0xe3, 0x55, 0x32, 0xb7, 0x4d, 0xf4, 0x1b, 0x24, 0xd6, 0x9e, 0xc3, 0xee, + 0xd1, 0x2c, 0x02, 0x8e, 0xfc, 0x10, 0x9a, 0xa2, 0xe6, 0x21, 0x4b, 0xc9, 0xd5, 0x90, 0x98, 0x2c, + 0x89, 0xd3, 0x38, 0x7f, 0x41, 0x5a, 0x0c, 0x89, 0xe7, 0xd7, 0x9f, 0x1e, 0xca, 0xc2, 0xe7, 0x87, + 0xb2, 0xf0, 0xe5, 0xa1, 0x2c, 0xbc, 0xff, 0x5a, 0xde, 0x7b, 0xfd, 0xef, 0x74, 0x16, 0xde, 0xdd, + 0xdf, 0xaa, 0xb6, 0x37, 0x6f, 0xb8, 0xc1, 0xc2, 0xb6, 0xeb, 0x63, 0xbe, 0x6c, 0xb8, 0xdc, 0x9b, + 0x04, 0x75, 0x6b, 0x31, 0xab, 0x4f, 0xbd, 0xc6, 0xce, 0xed, 0xf3, 0xcc, 0xb2, 0x9d, 0x0f, 0x22, + 0xd2, 0xb9, 0x77, 0x61, 0xaa, 0xda, 0xa0, 0x17, 0x7d, 0x72, 0xcd, 0x76, 0x6e, 0xe5, 0xf8, 0x9a, + 0x39, 0xf9, 0x1e, 0x00, 0x00, 0xff, 0xff, 0xef, 0xd5, 0x9b, 0x33, 0xaa, 0x04, 0x00, 0x00, } func (m *EACLRecord) Marshal() (dAtA []byte, err error) { @@ -909,7 +908,7 @@ func (m *EACLRecord) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Operation |= EACLRecord_Operation(b&0x7F) << shift + m.Operation |= Operation(b&0x7F) << shift if b < 0x80 { break } @@ -928,7 +927,7 @@ func (m *EACLRecord) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Action |= EACLRecord_Action(b&0x7F) << shift + m.Action |= Action(b&0x7F) << shift if b < 0x80 { break } @@ -1069,7 +1068,7 @@ func (m *EACLRecord_FilterInfo) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Header |= EACLRecord_FilterInfo_Header(b&0x7F) << shift + m.Header |= HeaderType(b&0x7F) << shift if b < 0x80 { break } @@ -1088,7 +1087,7 @@ func (m *EACLRecord_FilterInfo) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.MatchType |= EACLRecord_FilterInfo_MatchType(b&0x7F) << shift + m.MatchType |= MatchType(b&0x7F) << shift if b < 0x80 { break } diff --git a/v2/container/grpc/types.pb.go b/v2/container/grpc/types.pb.go index 9cd174d..f2b1733 100644 --- a/v2/container/grpc/types.pb.go +++ b/v2/container/grpc/types.pb.go @@ -6,8 +6,9 @@ package container import ( fmt "fmt" proto "github.com/golang/protobuf/proto" - grpc1 "github.com/nspcc-dev/neofs-api-go/v2/netmap/grpc" - grpc "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" + grpc2 "github.com/nspcc-dev/neofs-api-go/v2/netmap/grpc" + grpc1 "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" + grpc "github.com/nspcc-dev/neofs-api-go/v2/service/grpc" io "io" math "math" math_bits "math/bits" @@ -29,17 +30,20 @@ const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package // and access control information. ID of the container is a 32 byte long // SHA256 hash of stable-marshalled container message. type Container struct { + // Container format version. + // Effectively the version of API library used to create container + Version *grpc.Version `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` // OwnerID carries identifier of the container owner. - OwnerId *grpc.OwnerID `protobuf:"bytes,1,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"` + OwnerId *grpc1.OwnerID `protobuf:"bytes,2,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"` // Nonce is a 16 byte UUID, used to avoid collisions of container id. - Nonce []byte `protobuf:"bytes,2,opt,name=nonce,proto3" json:"nonce,omitempty"` + Nonce []byte `protobuf:"bytes,3,opt,name=nonce,proto3" json:"nonce,omitempty"` // BasicACL contains access control rules for owner, system, others groups and // permission bits for bearer token and Extended ACL. - BasicAcl uint32 `protobuf:"varint,3,opt,name=basic_acl,json=basicAcl,proto3" json:"basic_acl,omitempty"` + BasicAcl uint32 `protobuf:"varint,4,opt,name=basic_acl,json=basicAcl,proto3" json:"basic_acl,omitempty"` // Attributes define any immutable characteristics of container. - Attributes []*Container_Attribute `protobuf:"bytes,4,rep,name=attributes,proto3" json:"attributes,omitempty"` + Attributes []*Container_Attribute `protobuf:"bytes,5,rep,name=attributes,proto3" json:"attributes,omitempty"` // Placement policy for the object inside the container. - PlacementPolicy *grpc1.PlacementPolicy `protobuf:"bytes,5,opt,name=placement_policy,json=placementPolicy,proto3" json:"placement_policy,omitempty"` + PlacementPolicy *grpc2.PlacementPolicy `protobuf:"bytes,6,opt,name=placement_policy,json=placementPolicy,proto3" json:"placement_policy,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -78,7 +82,14 @@ func (m *Container) XXX_DiscardUnknown() { var xxx_messageInfo_Container proto.InternalMessageInfo -func (m *Container) GetOwnerId() *grpc.OwnerID { +func (m *Container) GetVersion() *grpc.Version { + if m != nil { + return m.Version + } + return nil +} + +func (m *Container) GetOwnerId() *grpc1.OwnerID { if m != nil { return m.OwnerId } @@ -106,7 +117,7 @@ func (m *Container) GetAttributes() []*Container_Attribute { return nil } -func (m *Container) GetPlacementPolicy() *grpc1.PlacementPolicy { +func (m *Container) GetPlacementPolicy() *grpc2.PlacementPolicy { if m != nil { return m.PlacementPolicy } @@ -179,30 +190,32 @@ func init() { func init() { proto.RegisterFile("v2/container/grpc/types.proto", fileDescriptor_3bfd95a81c72c35c) } var fileDescriptor_3bfd95a81c72c35c = []byte{ - // 363 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x51, 0xc1, 0x4e, 0xea, 0x40, - 0x14, 0x7d, 0x85, 0xc7, 0x7b, 0x74, 0xd0, 0x48, 0xaa, 0xd1, 0xa6, 0xc6, 0xa6, 0xba, 0xea, 0x86, - 0x99, 0xa4, 0x2c, 0x8d, 0x0b, 0xd4, 0x18, 0x49, 0x8c, 0x92, 0xba, 0x73, 0x43, 0xa6, 0xc3, 0x05, - 0x1a, 0xcb, 0xcc, 0xa4, 0x33, 0xd4, 0xf0, 0x27, 0x7e, 0x83, 0x3f, 0xe1, 0xd6, 0xa5, 0x9f, 0x60, - 0xf0, 0x47, 0x4c, 0xdb, 0x50, 0x31, 0xb8, 0x9b, 0x3b, 0xf7, 0xdc, 0x73, 0xcf, 0x39, 0x17, 0x1d, - 0x65, 0x01, 0x61, 0x82, 0x6b, 0x1a, 0x73, 0x48, 0xc9, 0x24, 0x95, 0x8c, 0xe8, 0x85, 0x04, 0x85, - 0x65, 0x2a, 0xb4, 0xb0, 0x76, 0x39, 0x08, 0x3c, 0x56, 0x38, 0x0b, 0x70, 0x85, 0x72, 0x9c, 0x2c, - 0x20, 0x1c, 0xf4, 0x8c, 0xca, 0x8d, 0x01, 0xc7, 0xce, 0x02, 0x92, 0xc2, 0x58, 0x6d, 0x74, 0x4e, - 0x5e, 0x6b, 0xc8, 0xbc, 0x58, 0x71, 0x58, 0x01, 0x6a, 0x8a, 0x27, 0x0e, 0xe9, 0x30, 0x1e, 0xd9, - 0x86, 0x67, 0xf8, 0xad, 0xe0, 0x00, 0x7f, 0xef, 0xca, 0x19, 0xf0, 0x5d, 0xde, 0xef, 0x5f, 0x86, - 0xff, 0x0b, 0x60, 0x7f, 0x64, 0xed, 0xa1, 0x06, 0x17, 0x9c, 0x81, 0x5d, 0xf3, 0x0c, 0x7f, 0x2b, - 0x2c, 0x0b, 0xeb, 0x10, 0x99, 0x11, 0x55, 0x31, 0x1b, 0x52, 0x96, 0xd8, 0x75, 0xcf, 0xf0, 0xb7, - 0xc3, 0x66, 0xf1, 0xd1, 0x63, 0x89, 0x75, 0x8d, 0x10, 0xd5, 0x3a, 0x8d, 0xa3, 0xb9, 0x06, 0x65, - 0xff, 0xf5, 0xea, 0x7e, 0x2b, 0xf0, 0xf1, 0x2f, 0xa6, 0x70, 0x25, 0x0d, 0xf7, 0x56, 0x03, 0xe1, - 0xda, 0xac, 0x75, 0x83, 0xda, 0x32, 0xa1, 0x0c, 0x66, 0xc0, 0xf5, 0x50, 0x8a, 0x24, 0x66, 0x0b, - 0xbb, 0x51, 0x08, 0x3f, 0x5e, 0xe3, 0x2b, 0x63, 0xc1, 0x83, 0x15, 0x72, 0x50, 0x00, 0xc3, 0x1d, - 0xf9, 0xf3, 0xc3, 0xe9, 0x22, 0xb3, 0x5a, 0x63, 0xb5, 0x51, 0xfd, 0x11, 0x16, 0x45, 0x0c, 0x66, - 0x98, 0x3f, 0x73, 0xa7, 0x19, 0x4d, 0xe6, 0xa5, 0x53, 0x33, 0x2c, 0x8b, 0xf3, 0xe9, 0xdb, 0xd2, - 0x35, 0xde, 0x97, 0xae, 0xf1, 0xb1, 0x74, 0x8d, 0xe7, 0x4f, 0xf7, 0xcf, 0xc3, 0xd9, 0x24, 0xd6, - 0xd3, 0x79, 0x84, 0x99, 0x98, 0x11, 0xae, 0x24, 0x63, 0x9d, 0x11, 0x64, 0x84, 0x83, 0x18, 0xab, - 0x0e, 0x95, 0x71, 0x67, 0x22, 0xc8, 0xc6, 0x7d, 0x4f, 0xab, 0xf2, 0xa5, 0xb6, 0x7f, 0x0b, 0xe2, - 0xea, 0x1e, 0xf7, 0x06, 0xfd, 0x5c, 0x7c, 0x15, 0x41, 0xf4, 0xaf, 0x38, 0x59, 0xf7, 0x2b, 0x00, - 0x00, 0xff, 0xff, 0x83, 0x61, 0x0e, 0xc4, 0x1e, 0x02, 0x00, 0x00, + // 400 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x52, 0xcd, 0xaa, 0x13, 0x31, + 0x14, 0x76, 0x5a, 0xef, 0xcf, 0xe4, 0x2a, 0x5e, 0xa2, 0xe8, 0x30, 0x62, 0xa9, 0xae, 0x66, 0xd3, + 0x04, 0xe6, 0xba, 0x13, 0x17, 0x55, 0x11, 0x0b, 0xa2, 0x25, 0x82, 0x0b, 0x37, 0x25, 0x4d, 0x4f, + 0xdb, 0xe0, 0x34, 0x09, 0x49, 0x1a, 0xe9, 0x9b, 0xf8, 0x0c, 0x3e, 0x89, 0x4b, 0x1f, 0x41, 0xea, + 0x33, 0xb8, 0x97, 0xc9, 0x38, 0x63, 0xa5, 0x77, 0x97, 0x73, 0xbe, 0xef, 0x3b, 0xf9, 0xce, 0x97, + 0xa0, 0x47, 0xa1, 0xa4, 0x42, 0x2b, 0xcf, 0xa5, 0x02, 0x4b, 0x57, 0xd6, 0x08, 0xea, 0x77, 0x06, + 0x1c, 0x31, 0x56, 0x7b, 0x8d, 0xef, 0x2a, 0xd0, 0x64, 0xe9, 0x48, 0x28, 0x49, 0xc7, 0xca, 0xf3, + 0x50, 0x52, 0x05, 0x7e, 0xc3, 0xcd, 0x91, 0x20, 0xcf, 0x42, 0x49, 0x2d, 0x2c, 0xdd, 0x31, 0x52, + 0xab, 0x1c, 0xd8, 0x20, 0x05, 0x34, 0xe0, 0x06, 0x3c, 0x6f, 0xb0, 0x27, 0xbf, 0x7b, 0x28, 0x7d, + 0xd9, 0xce, 0xc7, 0x4f, 0xd1, 0x59, 0x00, 0xeb, 0xa4, 0x56, 0x59, 0x32, 0x4c, 0x8a, 0x8b, 0x32, + 0x27, 0xff, 0x6c, 0xfc, 0x1d, 0x41, 0x3e, 0x36, 0x0c, 0xd6, 0x52, 0x71, 0x89, 0xce, 0xf5, 0x17, + 0x05, 0x76, 0x26, 0x17, 0x59, 0x2f, 0xca, 0x1e, 0x1c, 0xc8, 0x6a, 0x4f, 0xe4, 0x7d, 0x8d, 0x4f, + 0x5e, 0xb1, 0xb3, 0x48, 0x9c, 0x2c, 0xf0, 0x3d, 0x74, 0xa2, 0xb4, 0x12, 0x90, 0xf5, 0x87, 0x49, + 0x71, 0x8b, 0x35, 0x05, 0x7e, 0x88, 0xd2, 0x39, 0x77, 0x52, 0xcc, 0xb8, 0xa8, 0xb2, 0x9b, 0xc3, + 0xa4, 0xb8, 0xcd, 0xce, 0x63, 0x63, 0x2c, 0x2a, 0xfc, 0x06, 0x21, 0xee, 0xbd, 0x95, 0xf3, 0xad, + 0x07, 0x97, 0x9d, 0x0c, 0xfb, 0xc5, 0x45, 0x59, 0x90, 0x6b, 0x62, 0x22, 0xdd, 0x42, 0x64, 0xdc, + 0x0a, 0xd8, 0x81, 0x16, 0xbf, 0x45, 0x97, 0xa6, 0xe2, 0x02, 0x36, 0xa0, 0xfc, 0xcc, 0xe8, 0x4a, + 0x8a, 0x5d, 0x76, 0x1a, 0x8d, 0x3f, 0x3e, 0x98, 0xd7, 0x04, 0x4d, 0xa6, 0x2d, 0x73, 0x1a, 0x89, + 0xec, 0x8e, 0xf9, 0xbf, 0x91, 0x5f, 0xa1, 0xb4, 0xbb, 0x06, 0x5f, 0xa2, 0xfe, 0x67, 0xd8, 0xc5, + 0xf4, 0x52, 0x56, 0x1f, 0xeb, 0x4d, 0x03, 0xaf, 0xb6, 0x10, 0xa3, 0x49, 0x59, 0x53, 0xbc, 0x58, + 0x7f, 0xdf, 0x0f, 0x92, 0x1f, 0xfb, 0x41, 0xf2, 0x73, 0x3f, 0x48, 0xbe, 0xfe, 0x1a, 0xdc, 0xf8, + 0xf4, 0x7c, 0x25, 0xfd, 0x7a, 0x3b, 0x27, 0x42, 0x6f, 0xa8, 0x72, 0x46, 0x88, 0xd1, 0x02, 0x02, + 0x55, 0xa0, 0x97, 0x6e, 0xc4, 0x8d, 0x1c, 0xad, 0x34, 0x3d, 0xfa, 0x31, 0xcf, 0xba, 0xf2, 0x5b, + 0xef, 0xfe, 0x3b, 0xd0, 0xaf, 0x3f, 0x90, 0xf1, 0x74, 0x52, 0x9b, 0xef, 0x22, 0x98, 0x9f, 0xc6, + 0x87, 0xbe, 0xfa, 0x13, 0x00, 0x00, 0xff, 0xff, 0xbd, 0xc4, 0xfa, 0xf8, 0x70, 0x02, 0x00, 0x00, } func (m *Container) Marshal() (dAtA []byte, err error) { @@ -239,7 +252,7 @@ func (m *Container) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintTypes(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x2a + dAtA[i] = 0x32 } if len(m.Attributes) > 0 { for iNdEx := len(m.Attributes) - 1; iNdEx >= 0; iNdEx-- { @@ -252,20 +265,20 @@ func (m *Container) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintTypes(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x22 + dAtA[i] = 0x2a } } if m.BasicAcl != 0 { i = encodeVarintTypes(dAtA, i, uint64(m.BasicAcl)) i-- - dAtA[i] = 0x18 + dAtA[i] = 0x20 } if len(m.Nonce) > 0 { i -= len(m.Nonce) copy(dAtA[i:], m.Nonce) i = encodeVarintTypes(dAtA, i, uint64(len(m.Nonce))) i-- - dAtA[i] = 0x12 + dAtA[i] = 0x1a } if m.OwnerId != nil { { @@ -277,6 +290,18 @@ func (m *Container) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintTypes(dAtA, i, uint64(size)) } i-- + dAtA[i] = 0x12 + } + if m.Version != nil { + { + size, err := m.Version.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- dAtA[i] = 0xa } return len(dAtA) - i, nil @@ -340,6 +365,10 @@ func (m *Container) Size() (n int) { } var l int _ = l + if m.Version != nil { + l = m.Version.Size() + n += 1 + l + sovTypes(uint64(l)) + } if m.OwnerId != nil { l = m.OwnerId.Size() n += 1 + l + sovTypes(uint64(l)) @@ -423,6 +452,42 @@ func (m *Container) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Version == nil { + m.Version = &grpc.Version{} + } + if err := m.Version.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field OwnerId", wireType) } @@ -452,13 +517,13 @@ func (m *Container) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.OwnerId == nil { - m.OwnerId = &grpc.OwnerID{} + m.OwnerId = &grpc1.OwnerID{} } if err := m.OwnerId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex - case 2: + case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Nonce", wireType) } @@ -492,7 +557,7 @@ func (m *Container) Unmarshal(dAtA []byte) error { m.Nonce = []byte{} } iNdEx = postIndex - case 3: + case 4: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field BasicAcl", wireType) } @@ -511,7 +576,7 @@ func (m *Container) Unmarshal(dAtA []byte) error { break } } - case 4: + case 5: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Attributes", wireType) } @@ -545,7 +610,7 @@ func (m *Container) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 5: + case 6: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field PlacementPolicy", wireType) } @@ -575,7 +640,7 @@ func (m *Container) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.PlacementPolicy == nil { - m.PlacementPolicy = &grpc1.PlacementPolicy{} + m.PlacementPolicy = &grpc2.PlacementPolicy{} } if err := m.PlacementPolicy.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err diff --git a/v2/object/grpc/service.pb.go b/v2/object/grpc/service.pb.go index a6f18df..5a398c6 100644 --- a/v2/object/grpc/service.pb.go +++ b/v2/object/grpc/service.pb.go @@ -28,34 +28,6 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package -// Type of match expression -type SearchRequest_Body_Filter_MatchType int32 - -const ( - // Unknown. Not used - SearchRequest_Body_Filter_MATCH_TYPE_UNSPECIFIED SearchRequest_Body_Filter_MatchType = 0 - // Full string match - SearchRequest_Body_Filter_STRING_EQUAL SearchRequest_Body_Filter_MatchType = 1 -) - -var SearchRequest_Body_Filter_MatchType_name = map[int32]string{ - 0: "MATCH_TYPE_UNSPECIFIED", - 1: "STRING_EQUAL", -} - -var SearchRequest_Body_Filter_MatchType_value = map[string]int32{ - "MATCH_TYPE_UNSPECIFIED": 0, - "STRING_EQUAL": 1, -} - -func (x SearchRequest_Body_Filter_MatchType) String() string { - return proto.EnumName(SearchRequest_Body_Filter_MatchType_name, int32(x)) -} - -func (SearchRequest_Body_Filter_MatchType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_1d7d92b1e85e5b48, []int{8, 0, 0, 0} -} - // Get object request type GetRequest struct { // Body of get object request message. @@ -1223,7 +1195,7 @@ type HeadResponse_Body struct { // // Types that are valid to be assigned to Head: // *HeadResponse_Body_Header - // *HeadResponse_Body_ShortHeader_ + // *HeadResponse_Body_ShortHeader Head isHeadResponse_Body_Head `protobuf_oneof:"head"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -1272,12 +1244,12 @@ type isHeadResponse_Body_Head interface { type HeadResponse_Body_Header struct { Header *Header `protobuf:"bytes,1,opt,name=header,proto3,oneof" json:"header,omitempty"` } -type HeadResponse_Body_ShortHeader_ struct { - ShortHeader *HeadResponse_Body_ShortHeader `protobuf:"bytes,2,opt,name=short_header,json=shortHeader,proto3,oneof" json:"short_header,omitempty"` +type HeadResponse_Body_ShortHeader struct { + ShortHeader *ShortHeader `protobuf:"bytes,2,opt,name=short_header,json=shortHeader,proto3,oneof" json:"short_header,omitempty"` } -func (*HeadResponse_Body_Header) isHeadResponse_Body_Head() {} -func (*HeadResponse_Body_ShortHeader_) isHeadResponse_Body_Head() {} +func (*HeadResponse_Body_Header) isHeadResponse_Body_Head() {} +func (*HeadResponse_Body_ShortHeader) isHeadResponse_Body_Head() {} func (m *HeadResponse_Body) GetHead() isHeadResponse_Body_Head { if m != nil { @@ -1293,8 +1265,8 @@ func (m *HeadResponse_Body) GetHeader() *Header { return nil } -func (m *HeadResponse_Body) GetShortHeader() *HeadResponse_Body_ShortHeader { - if x, ok := m.GetHead().(*HeadResponse_Body_ShortHeader_); ok { +func (m *HeadResponse_Body) GetShortHeader() *ShortHeader { + if x, ok := m.GetHead().(*HeadResponse_Body_ShortHeader); ok { return x.ShortHeader } return nil @@ -1304,96 +1276,10 @@ func (m *HeadResponse_Body) GetShortHeader() *HeadResponse_Body_ShortHeader { func (*HeadResponse_Body) XXX_OneofWrappers() []interface{} { return []interface{}{ (*HeadResponse_Body_Header)(nil), - (*HeadResponse_Body_ShortHeader_)(nil), + (*HeadResponse_Body_ShortHeader)(nil), } } -// Short header fields -type HeadResponse_Body_ShortHeader struct { - // Object format version. - Version *grpc.Version `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` - // Epoch when the object was created - CreationEpoch uint64 `protobuf:"varint,2,opt,name=creation_epoch,json=creationEpoch,proto3" json:"creation_epoch,omitempty"` - // Object's owner - OwnerId *grpc1.OwnerID `protobuf:"bytes,3,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"` - // Type of the object payload content - ObjectType ObjectType `protobuf:"varint,4,opt,name=object_type,json=objectType,proto3,enum=neo.fs.v2.object.ObjectType" json:"object_type,omitempty"` - // Size of payload in bytes. - // 0xFFFFFFFFFFFFFFFF means `payload_length` is unknown - PayloadLength uint64 `protobuf:"varint,5,opt,name=payload_length,json=payloadLength,proto3" json:"payload_length,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *HeadResponse_Body_ShortHeader) Reset() { *m = HeadResponse_Body_ShortHeader{} } -func (m *HeadResponse_Body_ShortHeader) String() string { return proto.CompactTextString(m) } -func (*HeadResponse_Body_ShortHeader) ProtoMessage() {} -func (*HeadResponse_Body_ShortHeader) Descriptor() ([]byte, []int) { - return fileDescriptor_1d7d92b1e85e5b48, []int{7, 0, 0} -} -func (m *HeadResponse_Body_ShortHeader) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *HeadResponse_Body_ShortHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_HeadResponse_Body_ShortHeader.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *HeadResponse_Body_ShortHeader) XXX_Merge(src proto.Message) { - xxx_messageInfo_HeadResponse_Body_ShortHeader.Merge(m, src) -} -func (m *HeadResponse_Body_ShortHeader) XXX_Size() int { - return m.Size() -} -func (m *HeadResponse_Body_ShortHeader) XXX_DiscardUnknown() { - xxx_messageInfo_HeadResponse_Body_ShortHeader.DiscardUnknown(m) -} - -var xxx_messageInfo_HeadResponse_Body_ShortHeader proto.InternalMessageInfo - -func (m *HeadResponse_Body_ShortHeader) GetVersion() *grpc.Version { - if m != nil { - return m.Version - } - return nil -} - -func (m *HeadResponse_Body_ShortHeader) GetCreationEpoch() uint64 { - if m != nil { - return m.CreationEpoch - } - return 0 -} - -func (m *HeadResponse_Body_ShortHeader) GetOwnerId() *grpc1.OwnerID { - if m != nil { - return m.OwnerId - } - return nil -} - -func (m *HeadResponse_Body_ShortHeader) GetObjectType() ObjectType { - if m != nil { - return m.ObjectType - } - return ObjectType_REGULAR -} - -func (m *HeadResponse_Body_ShortHeader) GetPayloadLength() uint64 { - if m != nil { - return m.PayloadLength - } - return 0 -} - // Search objects request type SearchRequest struct { // Body of search object request message. @@ -1533,7 +1419,7 @@ func (m *SearchRequest_Body) GetFilters() []*SearchRequest_Body_Filter { // Filter structure type SearchRequest_Body_Filter struct { // Match type to use - MatchType SearchRequest_Body_Filter_MatchType `protobuf:"varint,1,opt,name=match_type,json=matchType,proto3,enum=neo.fs.v2.object.SearchRequest_Body_Filter_MatchType" json:"match_type,omitempty"` + MatchType MatchType `protobuf:"varint,1,opt,name=match_type,json=matchType,proto3,enum=neo.fs.v2.object.MatchType" json:"match_type,omitempty"` // Header name to match Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` // Header value to match @@ -1576,11 +1462,11 @@ func (m *SearchRequest_Body_Filter) XXX_DiscardUnknown() { var xxx_messageInfo_SearchRequest_Body_Filter proto.InternalMessageInfo -func (m *SearchRequest_Body_Filter) GetMatchType() SearchRequest_Body_Filter_MatchType { +func (m *SearchRequest_Body_Filter) GetMatchType() MatchType { if m != nil { return m.MatchType } - return SearchRequest_Body_Filter_MATCH_TYPE_UNSPECIFIED + return MatchType_MATCH_TYPE_UNSPECIFIED } func (m *SearchRequest_Body_Filter) GetName() string { @@ -2276,7 +2162,6 @@ func (m *GetRangeHashResponse_Body) GetHashList() [][]byte { } func init() { - proto.RegisterEnum("neo.fs.v2.object.SearchRequest_Body_Filter_MatchType", SearchRequest_Body_Filter_MatchType_name, SearchRequest_Body_Filter_MatchType_value) proto.RegisterType((*GetRequest)(nil), "neo.fs.v2.object.GetRequest") proto.RegisterType((*GetRequest_Body)(nil), "neo.fs.v2.object.GetRequest.Body") proto.RegisterType((*GetResponse)(nil), "neo.fs.v2.object.GetResponse") @@ -2295,7 +2180,6 @@ func init() { proto.RegisterType((*HeadRequest_Body)(nil), "neo.fs.v2.object.HeadRequest.Body") proto.RegisterType((*HeadResponse)(nil), "neo.fs.v2.object.HeadResponse") proto.RegisterType((*HeadResponse_Body)(nil), "neo.fs.v2.object.HeadResponse.Body") - proto.RegisterType((*HeadResponse_Body_ShortHeader)(nil), "neo.fs.v2.object.HeadResponse.Body.ShortHeader") proto.RegisterType((*SearchRequest)(nil), "neo.fs.v2.object.SearchRequest") proto.RegisterType((*SearchRequest_Body)(nil), "neo.fs.v2.object.SearchRequest.Body") proto.RegisterType((*SearchRequest_Body_Filter)(nil), "neo.fs.v2.object.SearchRequest.Body.Filter") @@ -2315,95 +2199,86 @@ func init() { func init() { proto.RegisterFile("v2/object/grpc/service.proto", fileDescriptor_1d7d92b1e85e5b48) } var fileDescriptor_1d7d92b1e85e5b48 = []byte{ - // 1403 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x59, 0x4d, 0x73, 0xdb, 0x54, - 0x17, 0x8e, 0x64, 0xc5, 0x89, 0x8f, 0xed, 0xbc, 0x99, 0xdb, 0x4e, 0x5f, 0x8f, 0x9a, 0x86, 0x54, - 0x6d, 0xda, 0x0c, 0x25, 0x72, 0x30, 0x94, 0xd2, 0x96, 0x96, 0x49, 0x1a, 0xa7, 0xf1, 0xb4, 0x49, - 0x53, 0x39, 0xed, 0x0c, 0xcc, 0x30, 0x1e, 0x45, 0xba, 0x8e, 0x05, 0xb6, 0x64, 0x74, 0x65, 0x77, - 0xbc, 0x61, 0x05, 0x0b, 0xfe, 0x41, 0x87, 0x05, 0x30, 0x2c, 0xcb, 0x8e, 0x1f, 0xc0, 0x86, 0x0d, - 0xec, 0x0a, 0xfc, 0x01, 0xa6, 0xac, 0x99, 0xfe, 0x03, 0x86, 0xb9, 0x1f, 0xb2, 0x2d, 0xd7, 0x5f, - 0x64, 0x27, 0x76, 0xf7, 0xe3, 0x39, 0xc7, 0xf7, 0x3c, 0xf7, 0xb9, 0xe7, 0xdc, 0x2b, 0xc3, 0x52, - 0xbb, 0x90, 0xf7, 0x8e, 0x3e, 0xc6, 0x56, 0x90, 0x3f, 0xf6, 0x9b, 0x56, 0x9e, 0x60, 0xbf, 0xed, - 0x58, 0x58, 0x6f, 0xfa, 0x5e, 0xe0, 0xa1, 0x45, 0x17, 0x7b, 0x7a, 0x95, 0xe8, 0xed, 0x82, 0xce, - 0x41, 0xaa, 0x3a, 0x80, 0x0f, 0x3a, 0x4d, 0x4c, 0x38, 0x5a, 0xcd, 0xb5, 0x0b, 0x79, 0x1f, 0x57, - 0xc9, 0xab, 0x33, 0xd4, 0x4a, 0x78, 0xe6, 0x93, 0x0d, 0x1c, 0x98, 0x62, 0x6e, 0x69, 0x70, 0xae, - 0x8d, 0x7d, 0xa7, 0xda, 0xe1, 0xb3, 0xda, 0x33, 0x19, 0xe0, 0x2e, 0x0e, 0x0c, 0xfc, 0x69, 0x0b, - 0x93, 0x00, 0x5d, 0x05, 0xe5, 0xc8, 0xb3, 0x3b, 0x39, 0x69, 0x45, 0x5a, 0x4b, 0x17, 0xce, 0xeb, - 0x83, 0xeb, 0xd3, 0x7b, 0x58, 0x7d, 0xcb, 0xb3, 0x3b, 0x06, 0x83, 0xa3, 0x22, 0xa4, 0xe9, 0x2f, - 0x56, 0x6a, 0xd8, 0xb4, 0xb1, 0x9f, 0x93, 0x99, 0xf5, 0xc5, 0x3e, 0xeb, 0x30, 0x6c, 0x61, 0xbb, - 0x87, 0x03, 0x73, 0x97, 0x61, 0x0d, 0x68, 0x74, 0xdb, 0xe8, 0x21, 0x64, 0xf9, 0xe2, 0x42, 0x47, - 0x09, 0xe6, 0xe8, 0x8d, 0xd1, 0x8e, 0x1e, 0x53, 0xb8, 0x63, 0x99, 0x81, 0xe3, 0xb9, 0xc2, 0x61, - 0x86, 0xbb, 0xe0, 0x3d, 0xf5, 0x1e, 0x28, 0x74, 0x9d, 0xe8, 0x4d, 0x98, 0x33, 0x6d, 0xdb, 0xc7, - 0x84, 0x88, 0xd8, 0xfe, 0xdf, 0xe7, 0x94, 0x92, 0xaa, 0x6f, 0xf2, 0x69, 0x23, 0xc4, 0xa1, 0x45, - 0x48, 0xf8, 0xe6, 0x13, 0x16, 0xcc, 0xbc, 0x41, 0x9b, 0xda, 0xdf, 0x09, 0x48, 0x33, 0x02, 0x48, - 0xd3, 0x73, 0x09, 0x46, 0xef, 0x44, 0xd8, 0xd2, 0x46, 0xb0, 0xc5, 0xc1, 0xfd, 0x74, 0xed, 0x0c, - 0xa3, 0x6b, 0x75, 0x68, 0x94, 0xdc, 0x78, 0x04, 0x5f, 0xc6, 0x70, 0xbe, 0xd6, 0xc7, 0x78, 0x9a, - 0x48, 0xd8, 0x57, 0xb2, 0x60, 0xec, 0x16, 0x28, 0x8e, 0xeb, 0x04, 0x22, 0xb8, 0xcb, 0x93, 0x83, - 0xd3, 0x4b, 0xae, 0x13, 0xec, 0xce, 0x18, 0xcc, 0x0c, 0x9d, 0x81, 0x59, 0xab, 0xd6, 0x72, 0x3f, - 0x61, 0xd1, 0x65, 0x76, 0x67, 0x0c, 0xde, 0x55, 0xbf, 0x97, 0x40, 0xa1, 0x40, 0x74, 0x15, 0x52, - 0xdc, 0x51, 0xc5, 0xb1, 0xc5, 0x8f, 0xe4, 0x06, 0xf7, 0xe4, 0x01, 0x03, 0x94, 0xb6, 0x8d, 0x79, - 0x0e, 0x2d, 0xd9, 0xe8, 0x06, 0xa4, 0x88, 0x73, 0xec, 0x9a, 0x41, 0xcb, 0xc7, 0x82, 0xb9, 0xa5, - 0x21, 0xf1, 0x96, 0x43, 0x8c, 0xd1, 0x83, 0xa3, 0x0d, 0x48, 0x46, 0x88, 0xca, 0xbd, 0x1a, 0x94, - 0xe0, 0x44, 0xe0, 0xb6, 0xb2, 0x90, 0x16, 0x8b, 0x6c, 0x9a, 0x7e, 0xa0, 0x7d, 0xad, 0x00, 0x1c, - 0xb4, 0xa6, 0x3f, 0x2d, 0x3d, 0x6c, 0x3c, 0x4e, 0xcb, 0x8f, 0xe1, 0xe6, 0xbf, 0x17, 0xd9, 0xfc, - 0x4b, 0x13, 0x23, 0x9b, 0x6e, 0xef, 0x9f, 0xc7, 0x69, 0xef, 0xd1, 0x05, 0xc8, 0x5a, 0x5e, 0xd3, - 0xc1, 0xa4, 0xe2, 0xb6, 0x1a, 0x47, 0xd8, 0xcf, 0x29, 0x2b, 0xd2, 0x5a, 0xd6, 0xc8, 0xf0, 0xc1, - 0x7d, 0x36, 0x36, 0x28, 0x90, 0x6f, 0x65, 0x48, 0x33, 0x6a, 0xa6, 0xcd, 0x10, 0x7d, 0xe0, 0xb8, - 0x64, 0x88, 0x5b, 0x42, 0x23, 0x27, 0xdb, 0x44, 0xed, 0x37, 0x19, 0xb2, 0xdb, 0xb8, 0x8e, 0x03, - 0x1c, 0x1e, 0xa3, 0x77, 0x23, 0x24, 0x5d, 0x7c, 0x95, 0xa4, 0x08, 0x3c, 0x1e, 0x27, 0xa9, 0x71, - 0xf2, 0xba, 0x53, 0x80, 0x79, 0xef, 0x89, 0x8b, 0x7d, 0x4a, 0xab, 0x3c, 0xdc, 0xe6, 0x01, 0x9d, - 0x2f, 0x6d, 0x1b, 0x73, 0x0c, 0x58, 0xb2, 0xb5, 0x97, 0x12, 0x2c, 0x84, 0x2c, 0x09, 0xe9, 0x5d, - 0x8f, 0xb0, 0xba, 0x3a, 0x9a, 0xd5, 0x78, 0xa9, 0x2f, 0xc9, 0x89, 0xd5, 0x7e, 0x91, 0x21, 0x4d, - 0x87, 0x42, 0x11, 0x4d, 0x3c, 0x69, 0x7d, 0xe0, 0x78, 0x48, 0xa8, 0x76, 0x72, 0x09, 0x9d, 0x85, - 0x54, 0xc3, 0x74, 0xdc, 0x8a, 0xe7, 0xd6, 0x3b, 0xe2, 0x02, 0x33, 0x4f, 0x07, 0x1e, 0xb8, 0xf5, - 0x4e, 0x78, 0xaf, 0x49, 0xf4, 0xee, 0x35, 0x5f, 0xcc, 0x42, 0x86, 0xd3, 0x23, 0xb4, 0x73, 0x2d, - 0x42, 0xe6, 0x85, 0x51, 0x64, 0xc6, 0x4b, 0x39, 0xdf, 0x24, 0x04, 0xa1, 0x85, 0x6e, 0x29, 0x90, - 0xc6, 0x97, 0x82, 0xdd, 0x99, 0x6e, 0x31, 0x38, 0x84, 0x0c, 0xa9, 0x79, 0x7e, 0x10, 0x8d, 0x2c, - 0x3f, 0x05, 0x33, 0x7a, 0x99, 0xda, 0x75, 0x1d, 0xa6, 0x49, 0xaf, 0xab, 0x7e, 0x2e, 0x43, 0xba, - 0x6f, 0x1a, 0xbd, 0x0d, 0x73, 0x6d, 0xec, 0x13, 0xc7, 0x73, 0xc5, 0xd2, 0xd4, 0x21, 0x01, 0x3f, - 0xe6, 0x08, 0x23, 0x84, 0xa2, 0x55, 0x58, 0xb0, 0x7c, 0xcc, 0x02, 0xaf, 0xe0, 0xa6, 0x67, 0xd5, - 0xd8, 0xea, 0x14, 0x23, 0x1b, 0x8e, 0x16, 0xe9, 0x60, 0x24, 0xaf, 0x24, 0xa6, 0xcb, 0x2b, 0xe8, - 0x56, 0xb7, 0xbc, 0xd1, 0xe7, 0x06, 0xab, 0x80, 0x0b, 0x91, 0x9a, 0x2b, 0xa2, 0xe6, 0x79, 0xfe, - 0xb0, 0xd3, 0xc4, 0x06, 0x78, 0xdd, 0x36, 0x5d, 0x59, 0xd3, 0xec, 0xd4, 0x3d, 0xd3, 0xae, 0xd4, - 0xb1, 0x7b, 0x1c, 0xd4, 0x72, 0xb3, 0x7c, 0x65, 0x62, 0xf4, 0x3e, 0x1b, 0xdc, 0x4a, 0x82, 0x42, - 0x69, 0xd5, 0x7e, 0x57, 0x20, 0x5b, 0xc6, 0xa6, 0x6f, 0xd5, 0xa6, 0x2e, 0x0d, 0x11, 0x78, 0x3c, - 0xce, 0xf5, 0x5f, 0xe1, 0x25, 0xeb, 0x36, 0x64, 0x2c, 0xcf, 0x0d, 0x4c, 0x47, 0x6c, 0x0a, 0x0f, - 0xf2, 0xec, 0xe0, 0xa6, 0xdc, 0x09, 0x31, 0xa5, 0x6d, 0x23, 0xdd, 0x35, 0x28, 0xd9, 0x28, 0xd7, - 0x53, 0x8b, 0xcc, 0xae, 0x26, 0x5d, 0x45, 0x14, 0x61, 0xae, 0xea, 0xd4, 0x03, 0xec, 0x93, 0x5c, - 0x62, 0x25, 0xb1, 0x96, 0x2e, 0x5c, 0x99, 0x86, 0x39, 0x7d, 0x87, 0xd9, 0x18, 0xa1, 0xad, 0xfa, - 0x93, 0x04, 0x49, 0x3e, 0x86, 0x0e, 0x01, 0x1a, 0x66, 0x60, 0xd5, 0xb8, 0x0e, 0x24, 0xa6, 0x83, - 0xab, 0xff, 0xc2, 0xa9, 0xbe, 0x47, 0xad, 0x99, 0x40, 0x52, 0x8d, 0xb0, 0x89, 0x10, 0x28, 0xae, - 0xd9, 0xe0, 0x77, 0xb9, 0x94, 0xc1, 0xda, 0xe8, 0x34, 0xcc, 0xb6, 0xcd, 0x7a, 0x0b, 0x33, 0xa6, - 0x53, 0x06, 0xef, 0x68, 0xd7, 0x21, 0xd5, 0xf5, 0x80, 0x54, 0x38, 0xb3, 0xb7, 0x79, 0x78, 0x67, - 0xb7, 0x72, 0xf8, 0xc1, 0x41, 0xb1, 0xf2, 0x68, 0xbf, 0x7c, 0x50, 0xbc, 0x53, 0xda, 0x29, 0x15, - 0xb7, 0x17, 0x67, 0xd0, 0x22, 0x64, 0xca, 0x87, 0x46, 0x69, 0xff, 0x6e, 0xa5, 0xf8, 0xf0, 0xd1, - 0xe6, 0xfd, 0x45, 0x49, 0xfb, 0x4e, 0x86, 0x85, 0x70, 0x5d, 0xd3, 0xd6, 0xc6, 0x28, 0x3e, 0x2e, - 0x19, 0xee, 0x7a, 0xaf, 0x62, 0x38, 0x76, 0xa5, 0xee, 0x10, 0x7a, 0x81, 0x4f, 0x8c, 0xbd, 0x97, - 0x25, 0x1d, 0xfb, 0xbe, 0x43, 0x02, 0xed, 0x1a, 0xcc, 0x1a, 0xa6, 0x7b, 0x8c, 0xd1, 0x19, 0x48, - 0x7a, 0xd5, 0x2a, 0xc1, 0xfc, 0xee, 0xaf, 0x18, 0xa2, 0x47, 0xc7, 0xc5, 0x11, 0xe6, 0xc9, 0x45, - 0xf4, 0xb4, 0x5f, 0x65, 0xf8, 0x1f, 0x7d, 0x09, 0x52, 0xe3, 0xf0, 0xd4, 0xde, 0x88, 0xd0, 0x7b, - 0x69, 0xf8, 0xd3, 0xb1, 0xcf, 0xe0, 0x3f, 0x5f, 0x8f, 0xd7, 0x61, 0xd6, 0xa7, 0xf1, 0x0e, 0xb9, - 0xcf, 0x09, 0x46, 0x38, 0x1d, 0x1c, 0xa5, 0x7d, 0x29, 0xc3, 0x62, 0x8f, 0x22, 0xa1, 0xd9, 0x9b, - 0x11, 0x52, 0x2f, 0x8f, 0x23, 0x35, 0x5e, 0xaa, 0x5d, 0x12, 0xbc, 0x9e, 0x0e, 0x5f, 0x8d, 0x34, - 0xc2, 0x8c, 0x78, 0x33, 0x6a, 0x2f, 0x65, 0x38, 0x15, 0x46, 0xb6, 0x6b, 0x92, 0x6e, 0x65, 0xb8, - 0x1d, 0xa1, 0xe3, 0xf5, 0xd1, 0x74, 0xf4, 0x19, 0xc5, 0x43, 0x67, 0x9f, 0x9d, 0x5c, 0x67, 0x79, - 0x48, 0x32, 0x05, 0x91, 0x9c, 0xcc, 0xce, 0xfd, 0x48, 0xa1, 0x09, 0x18, 0x4d, 0xc0, 0xc4, 0xac, - 0x07, 0x6c, 0xd5, 0x19, 0x83, 0xb5, 0xb5, 0xa7, 0x32, 0x9c, 0x8e, 0x92, 0x27, 0x14, 0xf8, 0x7e, - 0x84, 0xf2, 0x2b, 0x93, 0x28, 0x8f, 0x97, 0x0a, 0x2f, 0x08, 0xd6, 0xcf, 0x42, 0xaa, 0x66, 0x92, - 0x5a, 0x2f, 0x7b, 0x66, 0x8c, 0x79, 0x3a, 0x40, 0xb3, 0x64, 0xe1, 0x07, 0x05, 0xb2, 0x3c, 0x75, - 0x96, 0xb9, 0x7f, 0xb4, 0x0d, 0x89, 0xbb, 0x38, 0x40, 0x4b, 0xe3, 0xbe, 0x94, 0xaa, 0xe7, 0xc6, - 0x7e, 0x3c, 0xdb, 0x90, 0xa8, 0x97, 0x83, 0xd6, 0x50, 0x2f, 0xbd, 0xef, 0x2c, 0xc3, 0xbc, 0xf4, - 0x7d, 0x3d, 0x58, 0x93, 0xd0, 0x3d, 0x48, 0xf2, 0x37, 0x1d, 0x7a, 0x6d, 0xc2, 0x1b, 0x5a, 0x5d, - 0x99, 0xf4, 0x1c, 0x44, 0x45, 0x50, 0x28, 0x33, 0xe8, 0xdc, 0xd8, 0x97, 0x94, 0xba, 0x3c, 0xfe, - 0x06, 0x8c, 0xf6, 0x20, 0xc9, 0x6b, 0xe9, 0xb0, 0x35, 0x45, 0x6e, 0x0b, 0xc3, 0xd6, 0x14, 0x2d, - 0xc3, 0x1b, 0x12, 0x2a, 0xc3, 0x7c, 0x28, 0x32, 0x74, 0x7e, 0x62, 0x5d, 0x51, 0xb5, 0xc9, 0x59, - 0x72, 0x43, 0x42, 0x1f, 0x41, 0xa6, 0x5f, 0xb9, 0x68, 0x75, 0xaa, 0x64, 0xa2, 0x5e, 0x9a, 0xee, - 0x00, 0x6c, 0x55, 0x7e, 0x7e, 0xb1, 0x2c, 0x3d, 0x7f, 0xb1, 0x2c, 0xfd, 0xf1, 0x62, 0x59, 0x7a, - 0xfa, 0xe7, 0xf2, 0xcc, 0x87, 0xd7, 0x8e, 0x9d, 0xa0, 0xd6, 0x3a, 0xd2, 0x2d, 0xaf, 0x91, 0x77, - 0x49, 0xd3, 0xb2, 0xd6, 0x6d, 0xdc, 0xce, 0xbb, 0xd8, 0xab, 0x92, 0x75, 0xb3, 0xe9, 0xac, 0x1f, - 0x7b, 0xf9, 0xe8, 0xdf, 0x00, 0x37, 0x79, 0xfb, 0x99, 0x7c, 0x6a, 0x1f, 0x7b, 0x3b, 0x65, 0x7d, - 0xf3, 0xa0, 0x44, 0x7f, 0x95, 0x4b, 0xf1, 0x28, 0xc9, 0x3e, 0xe5, 0xbf, 0xf5, 0x4f, 0x00, 0x00, - 0x00, 0xff, 0xff, 0x39, 0x31, 0x0a, 0x71, 0x6c, 0x18, 0x00, 0x00, + // 1258 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x58, 0x4d, 0x6f, 0x1b, 0x45, + 0x18, 0xce, 0xae, 0x37, 0x8e, 0xfd, 0xda, 0x0e, 0xd1, 0x34, 0x2a, 0x96, 0xf3, 0x41, 0xba, 0x69, + 0xd2, 0x88, 0x92, 0x75, 0x30, 0x2a, 0xa1, 0x29, 0x2d, 0x6a, 0x48, 0xd2, 0x58, 0x25, 0x4d, 0x58, + 0x23, 0x0e, 0x48, 0xc8, 0xda, 0xec, 0x8e, 0xed, 0x05, 0x7b, 0xd7, 0xec, 0xac, 0x5d, 0xf9, 0xc2, + 0x11, 0x89, 0x5f, 0x40, 0xc5, 0x01, 0x21, 0x8e, 0xe5, 0xc6, 0x0f, 0xe0, 0x0c, 0xb7, 0xc2, 0x2f, + 0x40, 0xe1, 0x8a, 0xd4, 0x5f, 0x00, 0x42, 0xf3, 0xb1, 0xb6, 0xd7, 0xf1, 0x97, 0x72, 0xdb, 0xde, + 0xe6, 0xe3, 0x79, 0xdf, 0x9d, 0xf7, 0x99, 0x67, 0xde, 0x79, 0x67, 0x61, 0xb9, 0x5d, 0xc8, 0xbb, + 0xe7, 0x5f, 0x60, 0xd3, 0xcf, 0x57, 0xbd, 0xa6, 0x99, 0x27, 0xd8, 0x6b, 0xdb, 0x26, 0xd6, 0x9a, + 0x9e, 0xeb, 0xbb, 0x68, 0xc1, 0xc1, 0xae, 0x56, 0x21, 0x5a, 0xbb, 0xa0, 0x71, 0x50, 0x2e, 0x37, + 0x80, 0xf7, 0x3b, 0x4d, 0x4c, 0x38, 0x3a, 0x97, 0x6d, 0x17, 0xf2, 0x1e, 0xae, 0x90, 0xcb, 0x33, + 0xd4, 0x4a, 0x78, 0xe6, 0x93, 0x0d, 0xec, 0x1b, 0x62, 0x6e, 0x79, 0x70, 0xae, 0x8d, 0x3d, 0xbb, + 0xd2, 0xe1, 0xb3, 0xea, 0x73, 0x19, 0xe0, 0x11, 0xf6, 0x75, 0xfc, 0x55, 0x0b, 0x13, 0x1f, 0xdd, + 0x01, 0xe5, 0xdc, 0xb5, 0x3a, 0x59, 0x69, 0x4d, 0xda, 0x4a, 0x15, 0x6e, 0x68, 0x83, 0xeb, 0xd3, + 0x7a, 0x58, 0x6d, 0xdf, 0xb5, 0x3a, 0x3a, 0x83, 0xa3, 0x43, 0x48, 0xd1, 0x2f, 0x96, 0x6b, 0xd8, + 0xb0, 0xb0, 0x97, 0x95, 0x99, 0xf5, 0xcd, 0x3e, 0xeb, 0x20, 0x6c, 0x61, 0x7b, 0x82, 0x7d, 0xe3, + 0x98, 0x61, 0x75, 0x68, 0x74, 0xdb, 0xe8, 0x63, 0xc8, 0xf0, 0xc5, 0x05, 0x8e, 0x62, 0xcc, 0xd1, + 0x5b, 0xa3, 0x1d, 0x7d, 0x4a, 0xe1, 0xb6, 0x69, 0xf8, 0xb6, 0xeb, 0x08, 0x87, 0x69, 0xee, 0x82, + 0xf7, 0x72, 0x8f, 0x41, 0xa1, 0xeb, 0x44, 0x6f, 0xc3, 0x9c, 0x61, 0x59, 0x1e, 0x26, 0x44, 0xc4, + 0xf6, 0x7a, 0x9f, 0x53, 0x4a, 0xaa, 0xf6, 0x90, 0x4f, 0xeb, 0x01, 0x0e, 0x2d, 0x40, 0xcc, 0x33, + 0x9e, 0xb2, 0x60, 0x12, 0x3a, 0x6d, 0xaa, 0xff, 0xc5, 0x20, 0xc5, 0x08, 0x20, 0x4d, 0xd7, 0x21, + 0x18, 0xbd, 0x1b, 0x62, 0x4b, 0x1d, 0xc1, 0x16, 0x07, 0xf7, 0xd3, 0x75, 0x34, 0x8c, 0xae, 0x8d, + 0xa1, 0x51, 0x72, 0xe3, 0x11, 0x7c, 0xe9, 0xc3, 0xf9, 0xda, 0x1e, 0xe3, 0x69, 0x22, 0x61, 0xdf, + 0xcb, 0x82, 0xb1, 0xfb, 0xa0, 0xd8, 0x8e, 0xed, 0x8b, 0xe0, 0x6e, 0x4d, 0x0e, 0x4e, 0x2b, 0x3a, + 0xb6, 0x7f, 0x3c, 0xa3, 0x33, 0x33, 0x74, 0x1d, 0x66, 0xcd, 0x5a, 0xcb, 0xf9, 0x92, 0x45, 0x97, + 0x3e, 0x9e, 0xd1, 0x79, 0x37, 0xf7, 0xb3, 0x04, 0x0a, 0x05, 0xa2, 0x3b, 0x90, 0xe4, 0x8e, 0xca, + 0xb6, 0x25, 0x3e, 0x92, 0x1d, 0xdc, 0x93, 0x53, 0x06, 0x28, 0x1e, 0xe8, 0x09, 0x0e, 0x2d, 0x5a, + 0x68, 0x0f, 0x92, 0xc4, 0xae, 0x3a, 0x86, 0xdf, 0xf2, 0xb0, 0x60, 0x6e, 0x79, 0x48, 0xbc, 0xa5, + 0x00, 0xa3, 0xf7, 0xe0, 0x68, 0x07, 0xe2, 0x21, 0xa2, 0xb2, 0x97, 0x83, 0x12, 0x9c, 0x08, 0xdc, + 0x7e, 0x06, 0x52, 0x62, 0x91, 0x4d, 0xc3, 0xf3, 0xd5, 0x1f, 0x14, 0x80, 0xb3, 0xd6, 0xf4, 0xa7, + 0xa5, 0x87, 0x8d, 0xc6, 0x69, 0xf9, 0x35, 0xd8, 0xfc, 0xf7, 0x43, 0x9b, 0xbf, 0x39, 0x31, 0xb2, + 0xe9, 0xf6, 0xfe, 0x45, 0x94, 0xf6, 0x1e, 0xad, 0x43, 0xc6, 0x74, 0x9b, 0x36, 0x26, 0x65, 0xa7, + 0xd5, 0x38, 0xc7, 0x5e, 0x56, 0x59, 0x93, 0xb6, 0x32, 0x7a, 0x9a, 0x0f, 0x3e, 0x61, 0x63, 0x83, + 0x02, 0xf9, 0x51, 0x86, 0x14, 0xa3, 0x66, 0xda, 0x0c, 0xd1, 0x07, 0x8e, 0x4a, 0x86, 0xb8, 0x2f, + 0x34, 0x72, 0xb5, 0x4d, 0x54, 0xff, 0x94, 0x21, 0x73, 0x80, 0xeb, 0xd8, 0xc7, 0xc1, 0x31, 0x7a, + 0x2f, 0x44, 0xd2, 0xcd, 0xcb, 0x24, 0x85, 0xe0, 0xd1, 0x38, 0x49, 0x8d, 0xab, 0xdf, 0x3b, 0x05, + 0x48, 0xb8, 0x4f, 0x1d, 0xec, 0x51, 0x5a, 0xe5, 0xe1, 0x36, 0xa7, 0x74, 0xbe, 0x78, 0xa0, 0xcf, + 0x31, 0x60, 0xd1, 0x52, 0x5f, 0x4a, 0x30, 0x1f, 0xb0, 0x24, 0xa4, 0x77, 0x37, 0xc4, 0xea, 0xc6, + 0x68, 0x56, 0xa3, 0xa5, 0xbe, 0x38, 0x27, 0x56, 0xfd, 0x5d, 0x86, 0x14, 0x1d, 0x0a, 0x44, 0x34, + 0xf1, 0xa4, 0xf5, 0x81, 0xa3, 0x21, 0xa1, 0xda, 0xd5, 0x25, 0xb4, 0x04, 0xc9, 0x86, 0x61, 0x3b, + 0x65, 0xd7, 0xa9, 0x77, 0x44, 0x01, 0x93, 0xa0, 0x03, 0xa7, 0x4e, 0xbd, 0x13, 0xd4, 0x35, 0xb1, + 0x5e, 0x5d, 0xf3, 0x8f, 0x0c, 0x69, 0x4e, 0x8f, 0xd0, 0xce, 0x6e, 0x88, 0xcc, 0xf5, 0x51, 0x64, + 0x46, 0x4b, 0x39, 0xdf, 0x48, 0x82, 0xd0, 0x42, 0xf7, 0x2a, 0x90, 0xc6, 0x5f, 0x05, 0xc7, 0x33, + 0xdd, 0xcb, 0x60, 0x1f, 0xd2, 0xa4, 0xe6, 0x7a, 0x7e, 0x38, 0xb2, 0x95, 0xcb, 0x96, 0x25, 0x8a, + 0xea, 0x9a, 0xa7, 0x48, 0xaf, 0xbb, 0x1f, 0x07, 0x85, 0x5a, 0xab, 0xff, 0xc6, 0x20, 0x53, 0xc2, + 0x86, 0x67, 0xd6, 0xa6, 0xce, 0x80, 0x21, 0x78, 0x34, 0xe4, 0xfb, 0x5d, 0x50, 0x4b, 0x3c, 0x80, + 0xb4, 0xe9, 0x3a, 0xbe, 0x61, 0x8b, 0x9c, 0xc6, 0x83, 0x5c, 0x1a, 0x14, 0xf1, 0x87, 0x01, 0xa6, + 0x78, 0xa0, 0xa7, 0xba, 0x06, 0x45, 0x0b, 0x65, 0x61, 0xae, 0x8d, 0x3d, 0x62, 0xbb, 0x0e, 0x0b, + 0x2f, 0xa3, 0x07, 0x5d, 0x74, 0x08, 0x73, 0x15, 0xbb, 0xee, 0x63, 0x8f, 0x64, 0x63, 0x6b, 0xb1, + 0xad, 0x54, 0xe1, 0xf6, 0x34, 0xcc, 0x69, 0x47, 0xcc, 0x46, 0x0f, 0x6c, 0x73, 0x0e, 0xc4, 0xf9, + 0x10, 0xda, 0x03, 0x68, 0x18, 0xbe, 0x59, 0x2b, 0xd3, 0xc7, 0x15, 0x5b, 0xe8, 0x7c, 0x68, 0xa1, + 0xc2, 0xe7, 0x09, 0xc5, 0x7c, 0xd2, 0x69, 0x62, 0x3d, 0xd9, 0x08, 0x9a, 0x08, 0x81, 0xe2, 0x18, + 0x0d, 0x5e, 0x97, 0x24, 0x75, 0xd6, 0x46, 0x8b, 0x30, 0xdb, 0x36, 0xea, 0x2d, 0xcc, 0xe8, 0x4c, + 0xea, 0xbc, 0xa3, 0xfe, 0x24, 0xc3, 0x7c, 0xb0, 0xac, 0x69, 0x93, 0x75, 0x18, 0x1f, 0x95, 0x23, + 0x77, 0xb7, 0x97, 0xc2, 0x6c, 0xab, 0x5c, 0xb7, 0x09, 0xad, 0x28, 0x63, 0x63, 0x0b, 0x85, 0xb8, + 0x6d, 0x7d, 0x64, 0x13, 0x5f, 0xdd, 0x85, 0x59, 0xdd, 0x70, 0xaa, 0x18, 0x5d, 0x87, 0xb8, 0x5b, + 0xa9, 0x10, 0xcc, 0x8b, 0x51, 0x45, 0x17, 0x3d, 0x3a, 0x5e, 0xc7, 0x4e, 0xd5, 0xaf, 0xb1, 0x90, + 0x15, 0x5d, 0xf4, 0xd4, 0x3f, 0x64, 0x78, 0x8d, 0x3e, 0x4d, 0xa8, 0x71, 0x70, 0xbe, 0xf6, 0x42, + 0xf4, 0x6e, 0x0e, 0x7f, 0xcb, 0xf4, 0x19, 0xbc, 0xf2, 0x17, 0xc4, 0x36, 0xcc, 0x7a, 0x34, 0xde, + 0x21, 0x05, 0x86, 0x60, 0x84, 0xd3, 0xc1, 0x51, 0xea, 0xb7, 0x32, 0x2c, 0xf4, 0x28, 0x12, 0x9a, + 0xbd, 0x17, 0x22, 0xf5, 0xd6, 0x38, 0x52, 0xa3, 0xa5, 0xda, 0x65, 0xc1, 0xeb, 0x62, 0xf0, 0x8c, + 0xa1, 0x11, 0xa6, 0xc5, 0x23, 0x46, 0x7d, 0x29, 0xc3, 0xb5, 0x20, 0xb2, 0x63, 0x83, 0x74, 0x73, + 0xf8, 0x83, 0x10, 0x1d, 0x6f, 0x8e, 0xa6, 0xa3, 0xcf, 0x28, 0x1a, 0x3a, 0xfb, 0xfa, 0xea, 0x3a, + 0xcb, 0x43, 0x9c, 0x29, 0x88, 0x64, 0x65, 0x76, 0xee, 0x47, 0x0a, 0x4d, 0xc0, 0x68, 0x16, 0x25, + 0x46, 0xdd, 0x67, 0xab, 0x4e, 0xeb, 0xac, 0xad, 0x3e, 0x93, 0x61, 0x31, 0x4c, 0x9e, 0x50, 0xe0, + 0x07, 0x21, 0xca, 0x6f, 0x4f, 0xa2, 0x3c, 0x5a, 0x2a, 0x5c, 0x17, 0xac, 0x2f, 0x41, 0xb2, 0x66, + 0x90, 0x5a, 0x2f, 0x7b, 0xa6, 0xf5, 0x04, 0x1d, 0xa0, 0x59, 0xb2, 0xf0, 0x8b, 0x02, 0x19, 0x9e, + 0x3a, 0x4b, 0xdc, 0x3f, 0x3a, 0x80, 0xd8, 0x23, 0xec, 0xa3, 0xe5, 0x71, 0xbf, 0xee, 0x72, 0x2b, + 0x63, 0xff, 0xe6, 0xec, 0x48, 0xd4, 0xcb, 0x59, 0x6b, 0xa8, 0x97, 0xde, 0xc3, 0x7f, 0x98, 0x97, + 0xbe, 0xe7, 0xec, 0x96, 0x84, 0x1e, 0x43, 0x9c, 0x3f, 0x32, 0xd0, 0x1b, 0x13, 0x1e, 0x75, 0xb9, + 0xb5, 0x49, 0xef, 0x13, 0x74, 0x08, 0x0a, 0x65, 0x06, 0xad, 0x8c, 0x2d, 0xed, 0x73, 0xab, 0xe3, + 0x8b, 0x55, 0x74, 0x02, 0x71, 0x7e, 0x97, 0x0e, 0x5b, 0x53, 0xa8, 0x58, 0x18, 0xb6, 0xa6, 0xf0, + 0x35, 0xbc, 0x23, 0xa1, 0x12, 0x24, 0x02, 0x91, 0xa1, 0x1b, 0x13, 0xef, 0x95, 0x9c, 0x3a, 0x39, + 0x4b, 0xee, 0x48, 0xe8, 0x73, 0x48, 0xf7, 0x2b, 0x17, 0x6d, 0x4c, 0x95, 0x4c, 0x72, 0x9b, 0xd3, + 0x1d, 0x80, 0xfd, 0xf2, 0x6f, 0x17, 0xab, 0xd2, 0x8b, 0x8b, 0x55, 0xe9, 0xaf, 0x8b, 0x55, 0xe9, + 0xd9, 0xdf, 0xab, 0x33, 0x9f, 0xed, 0x56, 0x6d, 0xbf, 0xd6, 0x3a, 0xd7, 0x4c, 0xb7, 0x91, 0x77, + 0x48, 0xd3, 0x34, 0xb7, 0x2d, 0xdc, 0xce, 0x3b, 0xd8, 0xad, 0x90, 0x6d, 0xa3, 0x69, 0x6f, 0x57, + 0xdd, 0x7c, 0xf8, 0xbf, 0xf4, 0x3d, 0xde, 0x7e, 0x2e, 0x5f, 0x7b, 0x82, 0xdd, 0xa3, 0x92, 0xf6, + 0xf0, 0xac, 0x48, 0xbf, 0xca, 0xa5, 0x78, 0x1e, 0x67, 0xff, 0x96, 0xdf, 0xf9, 0x3f, 0x00, 0x00, + 0xff, 0xff, 0x89, 0x37, 0x38, 0x06, 0xfd, 0x16, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -3931,12 +3806,12 @@ func (m *HeadResponse_Body_Header) MarshalToSizedBuffer(dAtA []byte) (int, error } return len(dAtA) - i, nil } -func (m *HeadResponse_Body_ShortHeader_) MarshalTo(dAtA []byte) (int, error) { +func (m *HeadResponse_Body_ShortHeader) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *HeadResponse_Body_ShortHeader_) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *HeadResponse_Body_ShortHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) if m.ShortHeader != nil { { @@ -3952,72 +3827,6 @@ func (m *HeadResponse_Body_ShortHeader_) MarshalToSizedBuffer(dAtA []byte) (int, } return len(dAtA) - i, nil } -func (m *HeadResponse_Body_ShortHeader) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *HeadResponse_Body_ShortHeader) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *HeadResponse_Body_ShortHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.PayloadLength != 0 { - i = encodeVarintService(dAtA, i, uint64(m.PayloadLength)) - i-- - dAtA[i] = 0x28 - } - if m.ObjectType != 0 { - i = encodeVarintService(dAtA, i, uint64(m.ObjectType)) - i-- - dAtA[i] = 0x20 - } - if m.OwnerId != nil { - { - size, err := m.OwnerId.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if m.CreationEpoch != 0 { - i = encodeVarintService(dAtA, i, uint64(m.CreationEpoch)) - i-- - dAtA[i] = 0x10 - } - if m.Version != nil { - { - size, err := m.Version.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - func (m *SearchRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -5207,7 +5016,7 @@ func (m *HeadResponse_Body_Header) Size() (n int) { } return n } -func (m *HeadResponse_Body_ShortHeader_) Size() (n int) { +func (m *HeadResponse_Body_ShortHeader) Size() (n int) { if m == nil { return 0 } @@ -5219,35 +5028,6 @@ func (m *HeadResponse_Body_ShortHeader_) Size() (n int) { } return n } -func (m *HeadResponse_Body_ShortHeader) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Version != nil { - l = m.Version.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.CreationEpoch != 0 { - n += 1 + sovService(uint64(m.CreationEpoch)) - } - if m.OwnerId != nil { - l = m.OwnerId.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.ObjectType != 0 { - n += 1 + sovService(uint64(m.ObjectType)) - } - if m.PayloadLength != 0 { - n += 1 + sovService(uint64(m.PayloadLength)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - func (m *SearchRequest) Size() (n int) { if m == nil { return 0 @@ -8048,11 +7828,11 @@ func (m *HeadResponse_Body) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &HeadResponse_Body_ShortHeader{} + v := &ShortHeader{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } - m.Head = &HeadResponse_Body_ShortHeader_{v} + m.Head = &HeadResponse_Body_ShortHeader{v} iNdEx = postIndex default: iNdEx = preIndex @@ -8079,189 +7859,6 @@ func (m *HeadResponse_Body) Unmarshal(dAtA []byte) error { } return nil } -func (m *HeadResponse_Body_ShortHeader) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ShortHeader: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ShortHeader: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Version == nil { - m.Version = &grpc.Version{} - } - if err := m.Version.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field CreationEpoch", wireType) - } - m.CreationEpoch = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.CreationEpoch |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OwnerId", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.OwnerId == nil { - m.OwnerId = &grpc1.OwnerID{} - } - if err := m.OwnerId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ObjectType", wireType) - } - m.ObjectType = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ObjectType |= ObjectType(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field PayloadLength", wireType) - } - m.PayloadLength = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.PayloadLength |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func (m *SearchRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -8610,7 +8207,7 @@ func (m *SearchRequest_Body_Filter) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.MatchType |= SearchRequest_Body_Filter_MatchType(b&0x7F) << shift + m.MatchType |= MatchType(b&0x7F) << shift if b < 0x80 { break } diff --git a/v2/object/grpc/types.pb.go b/v2/object/grpc/types.pb.go index f4617b0..2ba1d5a 100644 --- a/v2/object/grpc/types.pb.go +++ b/v2/object/grpc/types.pb.go @@ -6,8 +6,8 @@ package object import ( fmt "fmt" proto "github.com/golang/protobuf/proto" - grpc "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" - grpc1 "github.com/nspcc-dev/neofs-api-go/v2/service/grpc" + grpc1 "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" + grpc "github.com/nspcc-dev/neofs-api-go/v2/service/grpc" io "io" math "math" math_bits "math/bits" @@ -56,17 +56,131 @@ func (ObjectType) EnumDescriptor() ([]byte, []int) { return fileDescriptor_545319325da7b9b1, []int{0} } +// Type of match expression +type MatchType int32 + +const ( + // Unknown. Not used + MatchType_MATCH_TYPE_UNSPECIFIED MatchType = 0 + // Full string match + MatchType_STRING_EQUAL MatchType = 1 +) + +var MatchType_name = map[int32]string{ + 0: "MATCH_TYPE_UNSPECIFIED", + 1: "STRING_EQUAL", +} + +var MatchType_value = map[string]int32{ + "MATCH_TYPE_UNSPECIFIED": 0, + "STRING_EQUAL": 1, +} + +func (x MatchType) String() string { + return proto.EnumName(MatchType_name, int32(x)) +} + +func (MatchType) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_545319325da7b9b1, []int{1} +} + +// Short header fields +type ShortHeader struct { + // Object format version. + Version *grpc.Version `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` + // Epoch when the object was created + CreationEpoch uint64 `protobuf:"varint,2,opt,name=creation_epoch,json=creationEpoch,proto3" json:"creation_epoch,omitempty"` + // Object's owner + OwnerId *grpc1.OwnerID `protobuf:"bytes,3,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"` + // Type of the object payload content + ObjectType ObjectType `protobuf:"varint,4,opt,name=object_type,json=objectType,proto3,enum=neo.fs.v2.object.ObjectType" json:"object_type,omitempty"` + // Size of payload in bytes. + // 0xFFFFFFFFFFFFFFFF means `payload_length` is unknown + PayloadLength uint64 `protobuf:"varint,5,opt,name=payload_length,json=payloadLength,proto3" json:"payload_length,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ShortHeader) Reset() { *m = ShortHeader{} } +func (m *ShortHeader) String() string { return proto.CompactTextString(m) } +func (*ShortHeader) ProtoMessage() {} +func (*ShortHeader) Descriptor() ([]byte, []int) { + return fileDescriptor_545319325da7b9b1, []int{0} +} +func (m *ShortHeader) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ShortHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ShortHeader.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ShortHeader) XXX_Merge(src proto.Message) { + xxx_messageInfo_ShortHeader.Merge(m, src) +} +func (m *ShortHeader) XXX_Size() int { + return m.Size() +} +func (m *ShortHeader) XXX_DiscardUnknown() { + xxx_messageInfo_ShortHeader.DiscardUnknown(m) +} + +var xxx_messageInfo_ShortHeader proto.InternalMessageInfo + +func (m *ShortHeader) GetVersion() *grpc.Version { + if m != nil { + return m.Version + } + return nil +} + +func (m *ShortHeader) GetCreationEpoch() uint64 { + if m != nil { + return m.CreationEpoch + } + return 0 +} + +func (m *ShortHeader) GetOwnerId() *grpc1.OwnerID { + if m != nil { + return m.OwnerId + } + return nil +} + +func (m *ShortHeader) GetObjectType() ObjectType { + if m != nil { + return m.ObjectType + } + return ObjectType_REGULAR +} + +func (m *ShortHeader) GetPayloadLength() uint64 { + if m != nil { + return m.PayloadLength + } + return 0 +} + // Object Headers type Header struct { - // Object's container - ContainerId *grpc.ContainerID `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` - // Object's owner - OwnerId *grpc.OwnerID `protobuf:"bytes,2,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"` - // Epoch when the object was created - CreationEpoch uint64 `protobuf:"varint,3,opt,name=creation_epoch,json=creationEpoch,proto3" json:"creation_epoch,omitempty"` // Object format version. // Effectively the version of API library used to create particular object - Version *grpc1.Version `protobuf:"bytes,4,opt,name=version,proto3" json:"version,omitempty"` + Version *grpc.Version `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` + // Object's container + ContainerId *grpc1.ContainerID `protobuf:"bytes,2,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` + // Object's owner + OwnerId *grpc1.OwnerID `protobuf:"bytes,3,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"` + // Object creation Epoch + CreationEpoch uint64 `protobuf:"varint,4,opt,name=creation_epoch,json=creationEpoch,proto3" json:"creation_epoch,omitempty"` // Size of payload in bytes. // 0xFFFFFFFFFFFFFFFF means `payload_length` is unknown PayloadLength uint64 `protobuf:"varint,5,opt,name=payload_length,json=payloadLength,proto3" json:"payload_length,omitempty"` @@ -78,7 +192,7 @@ type Header struct { HomomorphicHash []byte `protobuf:"bytes,8,opt,name=homomorphic_hash,json=homomorphicHash,proto3" json:"homomorphic_hash,omitempty"` // Session token, if it was used during Object creation. // Need it to verify integrity and authenticity out of Request scope. - SessionToken *grpc1.SessionToken `protobuf:"bytes,9,opt,name=session_token,json=sessionToken,proto3" json:"session_token,omitempty"` + SessionToken *grpc.SessionToken `protobuf:"bytes,9,opt,name=session_token,json=sessionToken,proto3" json:"session_token,omitempty"` // User-defined object attributes Attributes []*Header_Attribute `protobuf:"bytes,10,rep,name=attributes,proto3" json:"attributes,omitempty"` // Position of the object in the split hierarchy. @@ -92,7 +206,7 @@ func (m *Header) Reset() { *m = Header{} } func (m *Header) String() string { return proto.CompactTextString(m) } func (*Header) ProtoMessage() {} func (*Header) Descriptor() ([]byte, []int) { - return fileDescriptor_545319325da7b9b1, []int{0} + return fileDescriptor_545319325da7b9b1, []int{1} } func (m *Header) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -121,14 +235,21 @@ func (m *Header) XXX_DiscardUnknown() { var xxx_messageInfo_Header proto.InternalMessageInfo -func (m *Header) GetContainerId() *grpc.ContainerID { +func (m *Header) GetVersion() *grpc.Version { + if m != nil { + return m.Version + } + return nil +} + +func (m *Header) GetContainerId() *grpc1.ContainerID { if m != nil { return m.ContainerId } return nil } -func (m *Header) GetOwnerId() *grpc.OwnerID { +func (m *Header) GetOwnerId() *grpc1.OwnerID { if m != nil { return m.OwnerId } @@ -142,13 +263,6 @@ func (m *Header) GetCreationEpoch() uint64 { return 0 } -func (m *Header) GetVersion() *grpc1.Version { - if m != nil { - return m.Version - } - return nil -} - func (m *Header) GetPayloadLength() uint64 { if m != nil { return m.PayloadLength @@ -177,7 +291,7 @@ func (m *Header) GetHomomorphicHash() []byte { return nil } -func (m *Header) GetSessionToken() *grpc1.SessionToken { +func (m *Header) GetSessionToken() *grpc.SessionToken { if m != nil { return m.SessionToken } @@ -213,7 +327,7 @@ func (m *Header_Attribute) Reset() { *m = Header_Attribute{} } func (m *Header_Attribute) String() string { return proto.CompactTextString(m) } func (*Header_Attribute) ProtoMessage() {} func (*Header_Attribute) Descriptor() ([]byte, []int) { - return fileDescriptor_545319325da7b9b1, []int{0, 0} + return fileDescriptor_545319325da7b9b1, []int{1, 0} } func (m *Header_Attribute) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -261,25 +375,25 @@ type Header_Split struct { // Identifier of the origin object. // Parent and children objects must be within the same container. // Parent object_id is known only to the minor child. - Parent *grpc.ObjectID `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"` + Parent *grpc1.ObjectID `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"` // Previous carries identifier of the left split neighbor. - Previous *grpc.ObjectID `protobuf:"bytes,2,opt,name=previous,proto3" json:"previous,omitempty"` + Previous *grpc1.ObjectID `protobuf:"bytes,2,opt,name=previous,proto3" json:"previous,omitempty"` // `signature` field of the parent object. Used to reconstruct parent. - ParentSignature *grpc1.Signature `protobuf:"bytes,3,opt,name=parent_signature,json=parentSignature,proto3" json:"parent_signature,omitempty"` + ParentSignature *grpc.Signature `protobuf:"bytes,3,opt,name=parent_signature,json=parentSignature,proto3" json:"parent_signature,omitempty"` // `header` field of the parent object. Used to reconstruct parent. ParentHeader *Header `protobuf:"bytes,4,opt,name=parent_header,json=parentHeader,proto3" json:"parent_header,omitempty"` // Children carries list of identifiers of the objects generated by splitting the current. - Children []*grpc.ObjectID `protobuf:"bytes,5,rep,name=children,proto3" json:"children,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Children []*grpc1.ObjectID `protobuf:"bytes,5,rep,name=children,proto3" json:"children,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *Header_Split) Reset() { *m = Header_Split{} } func (m *Header_Split) String() string { return proto.CompactTextString(m) } func (*Header_Split) ProtoMessage() {} func (*Header_Split) Descriptor() ([]byte, []int) { - return fileDescriptor_545319325da7b9b1, []int{0, 1} + return fileDescriptor_545319325da7b9b1, []int{1, 1} } func (m *Header_Split) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -308,21 +422,21 @@ func (m *Header_Split) XXX_DiscardUnknown() { var xxx_messageInfo_Header_Split proto.InternalMessageInfo -func (m *Header_Split) GetParent() *grpc.ObjectID { +func (m *Header_Split) GetParent() *grpc1.ObjectID { if m != nil { return m.Parent } return nil } -func (m *Header_Split) GetPrevious() *grpc.ObjectID { +func (m *Header_Split) GetPrevious() *grpc1.ObjectID { if m != nil { return m.Previous } return nil } -func (m *Header_Split) GetParentSignature() *grpc1.Signature { +func (m *Header_Split) GetParentSignature() *grpc.Signature { if m != nil { return m.ParentSignature } @@ -336,7 +450,7 @@ func (m *Header_Split) GetParentHeader() *Header { return nil } -func (m *Header_Split) GetChildren() []*grpc.ObjectID { +func (m *Header_Split) GetChildren() []*grpc1.ObjectID { if m != nil { return m.Children } @@ -349,9 +463,9 @@ type Object struct { // Object is content-addressed. It means id will change if header or payload // changes. It's calculated as a hash of header field, which contains hash of // object's payload - ObjectId *grpc.ObjectID `protobuf:"bytes,1,opt,name=object_id,json=objectId,proto3" json:"object_id,omitempty"` + ObjectId *grpc1.ObjectID `protobuf:"bytes,1,opt,name=object_id,json=objectId,proto3" json:"object_id,omitempty"` // Signed object_id - Signature *grpc1.Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` + Signature *grpc.Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` // Object metadata headers Header *Header `protobuf:"bytes,3,opt,name=header,proto3" json:"header,omitempty"` // Payload bytes. @@ -365,7 +479,7 @@ func (m *Object) Reset() { *m = Object{} } func (m *Object) String() string { return proto.CompactTextString(m) } func (*Object) ProtoMessage() {} func (*Object) Descriptor() ([]byte, []int) { - return fileDescriptor_545319325da7b9b1, []int{1} + return fileDescriptor_545319325da7b9b1, []int{2} } func (m *Object) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -394,14 +508,14 @@ func (m *Object) XXX_DiscardUnknown() { var xxx_messageInfo_Object proto.InternalMessageInfo -func (m *Object) GetObjectId() *grpc.ObjectID { +func (m *Object) GetObjectId() *grpc1.ObjectID { if m != nil { return m.ObjectId } return nil } -func (m *Object) GetSignature() *grpc1.Signature { +func (m *Object) GetSignature() *grpc.Signature { if m != nil { return m.Signature } @@ -424,6 +538,8 @@ func (m *Object) GetPayload() []byte { func init() { proto.RegisterEnum("neo.fs.v2.object.ObjectType", ObjectType_name, ObjectType_value) + proto.RegisterEnum("neo.fs.v2.object.MatchType", MatchType_name, MatchType_value) + proto.RegisterType((*ShortHeader)(nil), "neo.fs.v2.object.ShortHeader") proto.RegisterType((*Header)(nil), "neo.fs.v2.object.Header") proto.RegisterType((*Header_Attribute)(nil), "neo.fs.v2.object.Header.Attribute") proto.RegisterType((*Header_Split)(nil), "neo.fs.v2.object.Header.Split") @@ -433,53 +549,124 @@ func init() { func init() { proto.RegisterFile("v2/object/grpc/types.proto", fileDescriptor_545319325da7b9b1) } var fileDescriptor_545319325da7b9b1 = []byte{ - // 726 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x94, 0xdd, 0x6e, 0xda, 0x48, - 0x14, 0xc7, 0x63, 0x08, 0x5f, 0xc7, 0x90, 0xb0, 0xb3, 0x2b, 0xad, 0xc5, 0x46, 0x2c, 0x1b, 0x69, - 0x25, 0x5a, 0x29, 0xa6, 0x22, 0x54, 0x95, 0x1a, 0xa5, 0x12, 0x69, 0x28, 0x41, 0x4a, 0x43, 0x34, - 0x90, 0x5e, 0xf4, 0xc6, 0x32, 0xf6, 0x80, 0xdd, 0x80, 0xc7, 0xf2, 0x18, 0x47, 0xbc, 0x49, 0x9f, - 0xa1, 0x52, 0x6f, 0xfa, 0x12, 0xed, 0x65, 0x1f, 0xa1, 0x4a, 0x5f, 0xa4, 0xf2, 0xcc, 0x18, 0x48, - 0xd2, 0xa4, 0xbd, 0xf2, 0xcc, 0x99, 0xdf, 0xff, 0xcc, 0xf9, 0x1a, 0x43, 0x25, 0x6a, 0x36, 0xe8, - 0xe8, 0x1d, 0xb1, 0xc2, 0xc6, 0x24, 0xf0, 0xad, 0x46, 0xb8, 0xf0, 0x09, 0xd3, 0xfd, 0x80, 0x86, - 0x14, 0x95, 0x3d, 0x42, 0xf5, 0x31, 0xd3, 0xa3, 0xa6, 0x2e, 0x90, 0x8a, 0x16, 0x35, 0x1b, 0x01, - 0x19, 0xb3, 0x3b, 0x6c, 0x25, 0xf6, 0xc3, 0x48, 0x10, 0xb9, 0x16, 0x11, 0x87, 0x33, 0x12, 0x9a, - 0xf2, 0x6c, 0xe7, 0xf6, 0x59, 0x44, 0x02, 0x77, 0xbc, 0x10, 0xa7, 0xbb, 0x9f, 0x72, 0x90, 0x3d, - 0x21, 0xa6, 0x4d, 0x02, 0xf4, 0x02, 0x8a, 0x16, 0xf5, 0x42, 0xd3, 0xf5, 0x48, 0x60, 0xb8, 0xb6, - 0xa6, 0xd4, 0x94, 0xba, 0xda, 0xfc, 0x47, 0x5f, 0xc5, 0x11, 0x5f, 0xae, 0xbf, 0x4c, 0x98, 0xde, - 0x31, 0x56, 0x97, 0x82, 0x9e, 0x8d, 0x9a, 0x90, 0xa7, 0x57, 0x52, 0x9b, 0xe2, 0xda, 0xbf, 0x6f, - 0x6b, 0xfb, 0x57, 0x42, 0x97, 0xe3, 0x60, 0xcf, 0x46, 0xff, 0xc3, 0x96, 0x15, 0x10, 0x33, 0x74, - 0xa9, 0x67, 0x10, 0x9f, 0x5a, 0x8e, 0x96, 0xae, 0x29, 0xf5, 0x4d, 0x5c, 0x4a, 0xac, 0x9d, 0xd8, - 0x88, 0x5a, 0x90, 0x8b, 0x48, 0xc0, 0x5c, 0xea, 0x69, 0x9b, 0xdc, 0x73, 0x65, 0xcd, 0xb3, 0x4c, - 0x4e, 0x7f, 0x23, 0x08, 0x9c, 0xa0, 0xb1, 0x73, 0xdf, 0x5c, 0x4c, 0xa9, 0x69, 0x1b, 0x53, 0xe2, - 0x4d, 0x42, 0x47, 0xcb, 0x08, 0xe7, 0xd2, 0x7a, 0xca, 0x8d, 0xe8, 0x3f, 0x28, 0x26, 0x98, 0x63, - 0x32, 0x47, 0xcb, 0xd6, 0x94, 0x7a, 0x11, 0xab, 0xd2, 0x76, 0x62, 0x32, 0x07, 0x1d, 0x82, 0x2a, - 0x7a, 0x60, 0xc4, 0x55, 0xd7, 0x72, 0x35, 0xa5, 0xbe, 0xd5, 0xdc, 0xd1, 0x6f, 0x77, 0x48, 0xef, - 0xf3, 0xcf, 0x70, 0xe1, 0x13, 0x0c, 0x74, 0xb9, 0x46, 0x8f, 0xa0, 0xec, 0xd0, 0x19, 0x9d, 0xd1, - 0xc0, 0x77, 0x5c, 0x4b, 0xdc, 0x92, 0xe7, 0xb7, 0x6c, 0xaf, 0xd9, 0xf9, 0x4d, 0xc7, 0x50, 0x62, - 0x84, 0xc5, 0xe1, 0x1b, 0x21, 0xbd, 0x24, 0x9e, 0x56, 0xe0, 0xf9, 0xfe, 0xfb, 0x93, 0x7c, 0x07, - 0x82, 0x1b, 0xc6, 0x18, 0x2e, 0xb2, 0xb5, 0x1d, 0x3a, 0x02, 0x30, 0xc3, 0x30, 0x70, 0x47, 0xf3, - 0x90, 0x30, 0x0d, 0x6a, 0xe9, 0xba, 0xda, 0xdc, 0xbd, 0x1b, 0xae, 0x68, 0xbc, 0xde, 0x4e, 0x50, - 0xbc, 0xa6, 0x42, 0x2d, 0xc8, 0x30, 0x7f, 0xea, 0x86, 0x9a, 0xca, 0x23, 0xa8, 0xde, 0x2b, 0x1f, - 0xc4, 0x14, 0x16, 0x70, 0x65, 0x1f, 0x0a, 0x4b, 0x77, 0xa8, 0x0c, 0xe9, 0x4b, 0xb2, 0xe0, 0x83, - 0x54, 0xc0, 0xf1, 0x12, 0xfd, 0x05, 0x99, 0xc8, 0x9c, 0xce, 0x09, 0x1f, 0x90, 0x02, 0x16, 0x9b, - 0xca, 0xc7, 0x14, 0x64, 0xb8, 0x17, 0xf4, 0x04, 0xb2, 0xbe, 0x19, 0x10, 0x2f, 0x94, 0xd3, 0xa7, - 0xdd, 0x99, 0x20, 0x7e, 0x75, 0xef, 0x18, 0x4b, 0x0e, 0xb5, 0x20, 0xef, 0x07, 0x24, 0x72, 0xe9, - 0x9c, 0xc9, 0xa9, 0xbb, 0x5f, 0xb3, 0x24, 0x51, 0x17, 0xca, 0x42, 0x6f, 0x30, 0x77, 0xe2, 0x99, - 0xe1, 0x3c, 0x20, 0x7c, 0xf2, 0xd4, 0x1b, 0x5d, 0x5d, 0x56, 0x3a, 0x61, 0xf0, 0xb6, 0x50, 0x2d, - 0x0d, 0xe8, 0x10, 0x4a, 0xd2, 0x91, 0xc3, 0xab, 0x21, 0xe7, 0x53, 0xbb, 0xaf, 0x5a, 0xb8, 0x28, - 0x70, 0xf9, 0xe6, 0x5a, 0x90, 0xb7, 0x1c, 0x77, 0x6a, 0x07, 0xc4, 0xd3, 0x32, 0xbc, 0x4d, 0x0f, - 0x44, 0x9f, 0x90, 0xbb, 0x9f, 0x15, 0xc8, 0x0a, 0x33, 0x7a, 0x0a, 0x05, 0x39, 0x99, 0xcb, 0x17, - 0xfb, 0x80, 0x07, 0x81, 0xf6, 0x6c, 0xf4, 0x1c, 0x0a, 0xab, 0xc4, 0x53, 0xbf, 0x91, 0xf8, 0x0a, - 0x8f, 0x7b, 0x24, 0x73, 0x4d, 0xff, 0x22, 0x57, 0xc9, 0x21, 0x0d, 0x72, 0xf2, 0x35, 0xf1, 0xf2, - 0x14, 0x71, 0xb2, 0x7d, 0x7c, 0x00, 0xb0, 0x7a, 0x33, 0x48, 0x85, 0x1c, 0xee, 0x74, 0x2f, 0x4e, - 0xdb, 0xb8, 0xbc, 0x81, 0x4a, 0x50, 0x18, 0xf6, 0x5f, 0x1f, 0x0d, 0x86, 0xfd, 0xb3, 0x4e, 0x59, - 0x41, 0x7f, 0x40, 0x69, 0x30, 0xec, 0xe3, 0x76, 0xb7, 0x63, 0x74, 0x71, 0xff, 0xe2, 0xbc, 0x9c, - 0x3a, 0x32, 0xbe, 0x5c, 0x57, 0x95, 0xaf, 0xd7, 0x55, 0xe5, 0xdb, 0x75, 0x55, 0x79, 0xff, 0xbd, - 0xba, 0xf1, 0xf6, 0xd9, 0xc4, 0x0d, 0x9d, 0xf9, 0x48, 0xb7, 0xe8, 0xac, 0xe1, 0x31, 0xdf, 0xb2, - 0xf6, 0x6c, 0x12, 0x35, 0x3c, 0x42, 0xc7, 0x6c, 0xcf, 0xf4, 0xdd, 0xbd, 0x09, 0x6d, 0xdc, 0xfc, - 0xe3, 0x1e, 0x88, 0xf5, 0x87, 0xd4, 0x9f, 0x67, 0x84, 0xbe, 0x1a, 0xe8, 0xed, 0xf3, 0x5e, 0x9c, - 0x86, 0x88, 0x69, 0x94, 0xe5, 0xff, 0xc8, 0xfd, 0x1f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x65, 0x74, - 0xce, 0xc4, 0xa7, 0x05, 0x00, 0x00, + // 808 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x95, 0xdd, 0x6e, 0xe3, 0x44, + 0x14, 0xc7, 0xeb, 0xb4, 0xf9, 0x3a, 0x49, 0x76, 0xcd, 0x80, 0xc0, 0x0a, 0x55, 0x08, 0x95, 0x90, + 0xc2, 0x4a, 0x75, 0x50, 0xb6, 0x08, 0xc1, 0x6a, 0x91, 0xd2, 0xc6, 0x9b, 0x5a, 0x6a, 0x9b, 0x32, + 0x76, 0x91, 0xe0, 0xc6, 0x72, 0xed, 0x69, 0x6c, 0x36, 0xf5, 0x58, 0x33, 0x13, 0xa3, 0xdc, 0xf3, + 0x10, 0x3c, 0x03, 0x12, 0x37, 0xbc, 0x04, 0x5c, 0xf2, 0x08, 0xa8, 0xbc, 0x08, 0xf2, 0x8c, 0x9d, + 0x7e, 0x2e, 0xbb, 0xb0, 0x57, 0x9e, 0x39, 0xf3, 0x3b, 0x67, 0xce, 0xf9, 0x9f, 0x33, 0x32, 0x74, + 0xb3, 0xd1, 0x90, 0x9e, 0xff, 0x40, 0x02, 0x31, 0x9c, 0xb3, 0x34, 0x18, 0x8a, 0x55, 0x4a, 0xb8, + 0x99, 0x32, 0x2a, 0x28, 0xd2, 0x13, 0x42, 0xcd, 0x0b, 0x6e, 0x66, 0x23, 0x53, 0x21, 0x5d, 0x23, + 0x1b, 0x0d, 0x19, 0xb9, 0xe0, 0xf7, 0xd8, 0x6e, 0x1e, 0x87, 0x13, 0x96, 0xc5, 0x01, 0x51, 0x87, + 0x97, 0x44, 0xf8, 0xc5, 0xd9, 0xf6, 0xdd, 0xb3, 0x8c, 0xb0, 0xf8, 0x62, 0xa5, 0x4e, 0x77, 0x7e, + 0xaa, 0x40, 0xcb, 0x89, 0x28, 0x13, 0x87, 0xc4, 0x0f, 0x09, 0x43, 0x7b, 0x50, 0xcf, 0x08, 0xe3, + 0x31, 0x4d, 0x0c, 0xad, 0xaf, 0x0d, 0x5a, 0xa3, 0xae, 0x79, 0x9d, 0x47, 0x11, 0xc6, 0xfc, 0x56, + 0x11, 0xb8, 0x44, 0xd1, 0x27, 0xf0, 0x28, 0x60, 0xc4, 0x17, 0x31, 0x4d, 0x3c, 0x92, 0xd2, 0x20, + 0x32, 0x2a, 0x7d, 0x6d, 0xb0, 0x85, 0x3b, 0xa5, 0xd5, 0xca, 0x8d, 0x68, 0x04, 0x0d, 0xfa, 0x63, + 0x42, 0x98, 0x17, 0x87, 0xc6, 0xa6, 0x8c, 0xfe, 0xc1, 0x8d, 0xe8, 0x79, 0x69, 0xe6, 0x2c, 0x3f, + 0xb7, 0x27, 0xb8, 0x2e, 0x41, 0x3b, 0x44, 0xcf, 0xa1, 0xa5, 0xca, 0xf7, 0xf2, 0x82, 0x8d, 0xad, + 0xbe, 0x36, 0x78, 0x34, 0xda, 0x36, 0xef, 0x8a, 0x63, 0xce, 0xe4, 0xc7, 0x5d, 0xa5, 0x04, 0x03, + 0x5d, 0xaf, 0xf3, 0xcc, 0x52, 0x7f, 0xb5, 0xa0, 0x7e, 0xe8, 0x2d, 0x48, 0x32, 0x17, 0x91, 0x51, + 0x55, 0x99, 0x15, 0xd6, 0x23, 0x69, 0xdc, 0xf9, 0xad, 0x0e, 0xb5, 0xb7, 0x52, 0xe0, 0x6b, 0x68, + 0x07, 0x34, 0x11, 0x7e, 0x5c, 0x94, 0x57, 0x91, 0xae, 0x1f, 0xde, 0x2d, 0xef, 0xa0, 0x64, 0xec, + 0x09, 0x6e, 0xad, 0x1d, 0xec, 0xf0, 0x7f, 0x49, 0x73, 0x5f, 0xf5, 0xad, 0x87, 0x54, 0x7f, 0x33, + 0x09, 0xd0, 0xc7, 0xd0, 0x2e, 0xb1, 0xc8, 0xe7, 0x91, 0x51, 0xeb, 0x6b, 0x83, 0x36, 0x6e, 0x15, + 0xb6, 0x43, 0x9f, 0x47, 0x77, 0x7b, 0x51, 0xff, 0x8f, 0xbd, 0xf8, 0x14, 0xf4, 0x88, 0x5e, 0xd2, + 0x4b, 0xca, 0xd2, 0x28, 0x0e, 0xd4, 0x2d, 0x0d, 0x79, 0xcb, 0xe3, 0x1b, 0x76, 0x79, 0xd3, 0x04, + 0x3a, 0x9c, 0xf0, 0x5c, 0x59, 0x4f, 0xd0, 0x97, 0x24, 0x31, 0x9a, 0x52, 0x93, 0x8f, 0x1e, 0x68, + 0x85, 0xa3, 0x38, 0x37, 0xc7, 0x70, 0x9b, 0xdf, 0xd8, 0xa1, 0x7d, 0x00, 0x5f, 0x08, 0x16, 0x9f, + 0x2f, 0x05, 0xe1, 0x06, 0xf4, 0x37, 0x07, 0xad, 0xd1, 0xce, 0xfd, 0x74, 0x55, 0xe3, 0xcd, 0x71, + 0x89, 0xe2, 0x1b, 0x5e, 0x68, 0x0f, 0xaa, 0x3c, 0x5d, 0xc4, 0xc2, 0x68, 0xc9, 0x0c, 0x7a, 0xaf, + 0x74, 0x77, 0x72, 0x0a, 0x2b, 0xb8, 0xfb, 0x14, 0x9a, 0xeb, 0x70, 0x48, 0x87, 0xcd, 0x97, 0x64, + 0x25, 0xa7, 0xa9, 0x89, 0xf3, 0x25, 0x7a, 0x0f, 0xaa, 0x99, 0xbf, 0x58, 0x12, 0x39, 0x26, 0x4d, + 0xac, 0x36, 0xdd, 0x5f, 0x2b, 0x50, 0x95, 0x51, 0xd0, 0x67, 0x50, 0x4b, 0x7d, 0x46, 0x12, 0x51, + 0x8c, 0xa0, 0x71, 0x6f, 0x16, 0xe4, 0xd5, 0xf6, 0x04, 0x17, 0x1c, 0xda, 0x83, 0x46, 0xca, 0x48, + 0x16, 0xd3, 0x25, 0x2f, 0x66, 0xef, 0xd5, 0x3e, 0x6b, 0x12, 0x4d, 0x41, 0x57, 0xfe, 0x1e, 0x8f, + 0xe7, 0x89, 0x2f, 0x96, 0x8c, 0x14, 0xd3, 0xb7, 0xfd, 0x90, 0xd2, 0x25, 0x83, 0x1f, 0x2b, 0xaf, + 0xb5, 0x01, 0x3d, 0x87, 0x4e, 0x11, 0x28, 0x92, 0x6a, 0xc8, 0x49, 0xbc, 0x9d, 0xc3, 0x2d, 0xb5, + 0x70, 0x5b, 0xe1, 0xeb, 0x37, 0xd7, 0x08, 0xa2, 0x78, 0x11, 0x32, 0x92, 0x18, 0x55, 0xd9, 0xa6, + 0x7f, 0xc9, 0xbe, 0x24, 0x77, 0x7e, 0xd7, 0xa0, 0xa6, 0xcc, 0xe8, 0x73, 0x68, 0x16, 0x93, 0x19, + 0x87, 0xaf, 0xd5, 0xac, 0xa1, 0x50, 0x3b, 0x44, 0x5f, 0x41, 0xf3, 0xba, 0xf0, 0xca, 0x1b, 0x14, + 0x7e, 0x8d, 0xe7, 0x3d, 0x2a, 0x6a, 0xdd, 0x7c, 0x4d, 0xad, 0x05, 0x87, 0x0c, 0xa8, 0x17, 0xaf, + 0x49, 0xca, 0xd3, 0xc6, 0xe5, 0xf6, 0xc9, 0x33, 0x80, 0xeb, 0x37, 0x83, 0x5a, 0x50, 0xc7, 0xd6, + 0xf4, 0xec, 0x68, 0x8c, 0xf5, 0x0d, 0xd4, 0x81, 0xa6, 0x3b, 0x3b, 0xde, 0x77, 0xdc, 0xd9, 0x89, + 0xa5, 0x6b, 0xe8, 0x1d, 0xe8, 0x38, 0xee, 0x0c, 0x8f, 0xa7, 0x96, 0x37, 0xc5, 0xb3, 0xb3, 0x53, + 0xbd, 0xf2, 0xe4, 0x4b, 0x68, 0x1e, 0xfb, 0x22, 0x88, 0xa4, 0x6f, 0x17, 0xde, 0x3f, 0x1e, 0xbb, + 0x07, 0x87, 0x9e, 0xfb, 0xdd, 0xa9, 0xe5, 0x9d, 0x9d, 0x38, 0xa7, 0xd6, 0x81, 0xfd, 0xc2, 0xb6, + 0x26, 0xfa, 0x06, 0xd2, 0xa1, 0xed, 0xb8, 0xd8, 0x3e, 0x99, 0x7a, 0xd6, 0x37, 0x67, 0xe3, 0x23, + 0x5d, 0xdb, 0xf7, 0xfe, 0xb8, 0xea, 0x69, 0x7f, 0x5e, 0xf5, 0xb4, 0xbf, 0xae, 0x7a, 0xda, 0xcf, + 0x7f, 0xf7, 0x36, 0xbe, 0xff, 0x62, 0x1e, 0x8b, 0x68, 0x79, 0x6e, 0x06, 0xf4, 0x72, 0x98, 0xf0, + 0x34, 0x08, 0x76, 0x43, 0x92, 0x0d, 0x13, 0x42, 0x2f, 0xf8, 0xae, 0x9f, 0xc6, 0xbb, 0x73, 0x3a, + 0xbc, 0xfd, 0xcf, 0x7a, 0xa6, 0xd6, 0xbf, 0x54, 0xde, 0x3d, 0x21, 0xf4, 0x85, 0x63, 0x8e, 0x4f, + 0xed, 0x5c, 0x01, 0x55, 0xce, 0x79, 0x4d, 0xfe, 0x65, 0x9e, 0xfe, 0x13, 0x00, 0x00, 0xff, 0xff, + 0x47, 0xd1, 0x60, 0xa2, 0xe9, 0x06, 0x00, 0x00, +} + +func (m *ShortHeader) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ShortHeader) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ShortHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.PayloadLength != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.PayloadLength)) + i-- + dAtA[i] = 0x28 + } + if m.ObjectType != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.ObjectType)) + i-- + dAtA[i] = 0x20 + } + if m.OwnerId != nil { + { + size, err := m.OwnerId.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + if m.CreationEpoch != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.CreationEpoch)) + i-- + dAtA[i] = 0x10 + } + if m.Version != nil { + { + size, err := m.Version.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil } func (m *Header) Marshal() (dAtA []byte, err error) { @@ -568,22 +755,10 @@ func (m *Header) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x28 } - if m.Version != nil { - { - size, err := m.Version.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } if m.CreationEpoch != 0 { i = encodeVarintTypes(dAtA, i, uint64(m.CreationEpoch)) i-- - dAtA[i] = 0x18 + dAtA[i] = 0x20 } if m.OwnerId != nil { { @@ -595,7 +770,7 @@ func (m *Header) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintTypes(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x12 + dAtA[i] = 0x1a } if m.ContainerId != nil { { @@ -607,6 +782,18 @@ func (m *Header) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintTypes(dAtA, i, uint64(size)) } i-- + dAtA[i] = 0x12 + } + if m.Version != nil { + { + size, err := m.Version.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- dAtA[i] = 0xa } return len(dAtA) - i, nil @@ -823,12 +1010,45 @@ func encodeVarintTypes(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } +func (m *ShortHeader) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Version != nil { + l = m.Version.Size() + n += 1 + l + sovTypes(uint64(l)) + } + if m.CreationEpoch != 0 { + n += 1 + sovTypes(uint64(m.CreationEpoch)) + } + if m.OwnerId != nil { + l = m.OwnerId.Size() + n += 1 + l + sovTypes(uint64(l)) + } + if m.ObjectType != 0 { + n += 1 + sovTypes(uint64(m.ObjectType)) + } + if m.PayloadLength != 0 { + n += 1 + sovTypes(uint64(m.PayloadLength)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + func (m *Header) Size() (n int) { if m == nil { return 0 } var l int _ = l + if m.Version != nil { + l = m.Version.Size() + n += 1 + l + sovTypes(uint64(l)) + } if m.ContainerId != nil { l = m.ContainerId.Size() n += 1 + l + sovTypes(uint64(l)) @@ -840,10 +1060,6 @@ func (m *Header) Size() (n int) { if m.CreationEpoch != 0 { n += 1 + sovTypes(uint64(m.CreationEpoch)) } - if m.Version != nil { - l = m.Version.Size() - n += 1 + l + sovTypes(uint64(l)) - } if m.PayloadLength != 0 { n += 1 + sovTypes(uint64(m.PayloadLength)) } @@ -966,6 +1182,189 @@ func sovTypes(x uint64) (n int) { func sozTypes(x uint64) (n int) { return sovTypes(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } +func (m *ShortHeader) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ShortHeader: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ShortHeader: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Version == nil { + m.Version = &grpc.Version{} + } + if err := m.Version.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CreationEpoch", wireType) + } + m.CreationEpoch = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.CreationEpoch |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OwnerId", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.OwnerId == nil { + m.OwnerId = &grpc1.OwnerID{} + } + if err := m.OwnerId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ObjectType", wireType) + } + m.ObjectType = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ObjectType |= ObjectType(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PayloadLength", wireType) + } + m.PayloadLength = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.PayloadLength |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *Header) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -996,6 +1395,42 @@ func (m *Header) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Version == nil { + m.Version = &grpc.Version{} + } + if err := m.Version.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ContainerId", wireType) } @@ -1025,13 +1460,13 @@ func (m *Header) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.ContainerId == nil { - m.ContainerId = &grpc.ContainerID{} + m.ContainerId = &grpc1.ContainerID{} } if err := m.ContainerId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex - case 2: + case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field OwnerId", wireType) } @@ -1061,13 +1496,13 @@ func (m *Header) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.OwnerId == nil { - m.OwnerId = &grpc.OwnerID{} + m.OwnerId = &grpc1.OwnerID{} } if err := m.OwnerId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex - case 3: + case 4: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field CreationEpoch", wireType) } @@ -1086,42 +1521,6 @@ func (m *Header) Unmarshal(dAtA []byte) error { break } } - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Version == nil { - m.Version = &grpc1.Version{} - } - if err := m.Version.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex case 5: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field PayloadLength", wireType) @@ -1258,7 +1657,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.SessionToken == nil { - m.SessionToken = &grpc1.SessionToken{} + m.SessionToken = &grpc.SessionToken{} } if err := m.SessionToken.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -1536,7 +1935,7 @@ func (m *Header_Split) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.Parent == nil { - m.Parent = &grpc.ObjectID{} + m.Parent = &grpc1.ObjectID{} } if err := m.Parent.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -1572,7 +1971,7 @@ func (m *Header_Split) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.Previous == nil { - m.Previous = &grpc.ObjectID{} + m.Previous = &grpc1.ObjectID{} } if err := m.Previous.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -1608,7 +2007,7 @@ func (m *Header_Split) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.ParentSignature == nil { - m.ParentSignature = &grpc1.Signature{} + m.ParentSignature = &grpc.Signature{} } if err := m.ParentSignature.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -1679,7 +2078,7 @@ func (m *Header_Split) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Children = append(m.Children, &grpc.ObjectID{}) + m.Children = append(m.Children, &grpc1.ObjectID{}) if err := m.Children[len(m.Children)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -1768,7 +2167,7 @@ func (m *Object) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.ObjectId == nil { - m.ObjectId = &grpc.ObjectID{} + m.ObjectId = &grpc1.ObjectID{} } if err := m.ObjectId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -1804,7 +2203,7 @@ func (m *Object) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.Signature == nil { - m.Signature = &grpc1.Signature{} + m.Signature = &grpc.Signature{} } if err := m.Signature.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err diff --git a/v2/service/grpc/meta.pb.go b/v2/service/grpc/meta.pb.go index 397dc3a..5c8c90f 100644 --- a/v2/service/grpc/meta.pb.go +++ b/v2/service/grpc/meta.pb.go @@ -24,56 +24,56 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package -// Verb is an enumeration of session request types -type SessionToken_Body_Verb int32 +// Object request verbs +type ObjectServiceContext_Verb int32 const ( // Unknown verb - SessionToken_Body_VERB_UNSPECIFIED SessionToken_Body_Verb = 0 + ObjectServiceContext_VERB_UNSPECIFIED ObjectServiceContext_Verb = 0 // Refers to object.Put RPC call - SessionToken_Body_OBJECT_PUT SessionToken_Body_Verb = 1 + ObjectServiceContext_PUT ObjectServiceContext_Verb = 1 // Refers to object.Get RPC call - SessionToken_Body_OBJECT_GET SessionToken_Body_Verb = 2 + ObjectServiceContext_GET ObjectServiceContext_Verb = 2 // Refers to object.Head RPC call - SessionToken_Body_OBJECT_HEAD SessionToken_Body_Verb = 3 + ObjectServiceContext_HEAD ObjectServiceContext_Verb = 3 // Refers to object.Search RPC call - SessionToken_Body_OBJECT_SEARCH SessionToken_Body_Verb = 4 + ObjectServiceContext_SEARCH ObjectServiceContext_Verb = 4 // Refers to object.Delete RPC call - SessionToken_Body_OBJECT_DELETE SessionToken_Body_Verb = 5 + ObjectServiceContext_DELETE ObjectServiceContext_Verb = 5 // Refers to object.GetRange RPC call - SessionToken_Body_OBJECT_RANGE SessionToken_Body_Verb = 6 + ObjectServiceContext_RANGE ObjectServiceContext_Verb = 6 // Refers to object.GetRangeHash RPC call - SessionToken_Body_OBJECT_RANGEHASH SessionToken_Body_Verb = 7 + ObjectServiceContext_RANGEHASH ObjectServiceContext_Verb = 7 ) -var SessionToken_Body_Verb_name = map[int32]string{ +var ObjectServiceContext_Verb_name = map[int32]string{ 0: "VERB_UNSPECIFIED", - 1: "OBJECT_PUT", - 2: "OBJECT_GET", - 3: "OBJECT_HEAD", - 4: "OBJECT_SEARCH", - 5: "OBJECT_DELETE", - 6: "OBJECT_RANGE", - 7: "OBJECT_RANGEHASH", + 1: "PUT", + 2: "GET", + 3: "HEAD", + 4: "SEARCH", + 5: "DELETE", + 6: "RANGE", + 7: "RANGEHASH", } -var SessionToken_Body_Verb_value = map[string]int32{ +var ObjectServiceContext_Verb_value = map[string]int32{ "VERB_UNSPECIFIED": 0, - "OBJECT_PUT": 1, - "OBJECT_GET": 2, - "OBJECT_HEAD": 3, - "OBJECT_SEARCH": 4, - "OBJECT_DELETE": 5, - "OBJECT_RANGE": 6, - "OBJECT_RANGEHASH": 7, + "PUT": 1, + "GET": 2, + "HEAD": 3, + "SEARCH": 4, + "DELETE": 5, + "RANGE": 6, + "RANGEHASH": 7, } -func (x SessionToken_Body_Verb) String() string { - return proto.EnumName(SessionToken_Body_Verb_name, int32(x)) +func (x ObjectServiceContext_Verb) String() string { + return proto.EnumName(ObjectServiceContext_Verb_name, int32(x)) } -func (SessionToken_Body_Verb) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_174eb6ef9ee2b356, []int{3, 0, 0} +func (ObjectServiceContext_Verb) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_174eb6ef9ee2b356, []int{3, 0} } // Extended headers for Request/Response @@ -259,6 +259,64 @@ func (m *TokenLifetime) GetIat() uint64 { return 0 } +// Context information for Session Tokens related to ObjectService requests +type ObjectServiceContext struct { + // Verb is a type of request for which the token is issued + Verb ObjectServiceContext_Verb `protobuf:"varint,1,opt,name=verb,proto3,enum=neo.fs.v2.service.ObjectServiceContext_Verb" json:"verb,omitempty"` + // Related Object address + Address *grpc.Address `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ObjectServiceContext) Reset() { *m = ObjectServiceContext{} } +func (m *ObjectServiceContext) String() string { return proto.CompactTextString(m) } +func (*ObjectServiceContext) ProtoMessage() {} +func (*ObjectServiceContext) Descriptor() ([]byte, []int) { + return fileDescriptor_174eb6ef9ee2b356, []int{3} +} +func (m *ObjectServiceContext) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ObjectServiceContext) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ObjectServiceContext.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ObjectServiceContext) XXX_Merge(src proto.Message) { + xxx_messageInfo_ObjectServiceContext.Merge(m, src) +} +func (m *ObjectServiceContext) XXX_Size() int { + return m.Size() +} +func (m *ObjectServiceContext) XXX_DiscardUnknown() { + xxx_messageInfo_ObjectServiceContext.DiscardUnknown(m) +} + +var xxx_messageInfo_ObjectServiceContext proto.InternalMessageInfo + +func (m *ObjectServiceContext) GetVerb() ObjectServiceContext_Verb { + if m != nil { + return m.Verb + } + return ObjectServiceContext_VERB_UNSPECIFIED +} + +func (m *ObjectServiceContext) GetAddress() *grpc.Address { + if m != nil { + return m.Address + } + return nil +} + // NeoFS session token. type SessionToken struct { // Session Token body @@ -274,7 +332,7 @@ func (m *SessionToken) Reset() { *m = SessionToken{} } func (m *SessionToken) String() string { return proto.CompactTextString(m) } func (*SessionToken) ProtoMessage() {} func (*SessionToken) Descriptor() ([]byte, []int) { - return fileDescriptor_174eb6ef9ee2b356, []int{3} + return fileDescriptor_174eb6ef9ee2b356, []int{4} } func (m *SessionToken) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -323,16 +381,14 @@ type SessionToken_Body struct { Id []byte `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` // OwnerID carries identifier of the session initiator. OwnerId *grpc.OwnerID `protobuf:"bytes,2,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"` - // Verb is a type of request for which the token is issued - Verb SessionToken_Body_Verb `protobuf:"varint,3,opt,name=verb,proto3,enum=neo.fs.v2.service.SessionToken_Body_Verb" json:"verb,omitempty"` // Lifetime is a lifetime of the session - Lifetime *TokenLifetime `protobuf:"bytes,4,opt,name=lifetime,proto3" json:"lifetime,omitempty"` + Lifetime *TokenLifetime `protobuf:"bytes,3,opt,name=lifetime,proto3" json:"lifetime,omitempty"` // SessionKey is a public key of session key - SessionKey []byte `protobuf:"bytes,5,opt,name=session_key,json=sessionKey,proto3" json:"session_key,omitempty"` + SessionKey []byte `protobuf:"bytes,4,opt,name=session_key,json=sessionKey,proto3" json:"session_key,omitempty"` // Carries context of the session. // // Types that are valid to be assigned to Context: - // *SessionToken_Body_ObjectAddress + // *SessionToken_Body_ObjectService Context isSessionToken_Body_Context `protobuf_oneof:"context"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -343,7 +399,7 @@ func (m *SessionToken_Body) Reset() { *m = SessionToken_Body{} } func (m *SessionToken_Body) String() string { return proto.CompactTextString(m) } func (*SessionToken_Body) ProtoMessage() {} func (*SessionToken_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_174eb6ef9ee2b356, []int{3, 0} + return fileDescriptor_174eb6ef9ee2b356, []int{4, 0} } func (m *SessionToken_Body) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -378,11 +434,11 @@ type isSessionToken_Body_Context interface { Size() int } -type SessionToken_Body_ObjectAddress struct { - ObjectAddress *grpc.Address `protobuf:"bytes,6,opt,name=object_address,json=objectAddress,proto3,oneof" json:"object_address,omitempty"` +type SessionToken_Body_ObjectService struct { + ObjectService *ObjectServiceContext `protobuf:"bytes,5,opt,name=object_service,json=objectService,proto3,oneof" json:"object_service,omitempty"` } -func (*SessionToken_Body_ObjectAddress) isSessionToken_Body_Context() {} +func (*SessionToken_Body_ObjectService) isSessionToken_Body_Context() {} func (m *SessionToken_Body) GetContext() isSessionToken_Body_Context { if m != nil { @@ -405,13 +461,6 @@ func (m *SessionToken_Body) GetOwnerId() *grpc.OwnerID { return nil } -func (m *SessionToken_Body) GetVerb() SessionToken_Body_Verb { - if m != nil { - return m.Verb - } - return SessionToken_Body_VERB_UNSPECIFIED -} - func (m *SessionToken_Body) GetLifetime() *TokenLifetime { if m != nil { return m.Lifetime @@ -426,9 +475,9 @@ func (m *SessionToken_Body) GetSessionKey() []byte { return nil } -func (m *SessionToken_Body) GetObjectAddress() *grpc.Address { - if x, ok := m.GetContext().(*SessionToken_Body_ObjectAddress); ok { - return x.ObjectAddress +func (m *SessionToken_Body) GetObjectService() *ObjectServiceContext { + if x, ok := m.GetContext().(*SessionToken_Body_ObjectService); ok { + return x.ObjectService } return nil } @@ -436,7 +485,7 @@ func (m *SessionToken_Body) GetObjectAddress() *grpc.Address { // XXX_OneofWrappers is for the internal use of the proto package. func (*SessionToken_Body) XXX_OneofWrappers() []interface{} { return []interface{}{ - (*SessionToken_Body_ObjectAddress)(nil), + (*SessionToken_Body_ObjectService)(nil), } } @@ -455,7 +504,7 @@ func (m *BearerToken) Reset() { *m = BearerToken{} } func (m *BearerToken) String() string { return proto.CompactTextString(m) } func (*BearerToken) ProtoMessage() {} func (*BearerToken) Descriptor() ([]byte, []int) { - return fileDescriptor_174eb6ef9ee2b356, []int{4} + return fileDescriptor_174eb6ef9ee2b356, []int{5} } func (m *BearerToken) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -515,7 +564,7 @@ func (m *BearerToken_Body) Reset() { *m = BearerToken_Body{} } func (m *BearerToken_Body) String() string { return proto.CompactTextString(m) } func (*BearerToken_Body) ProtoMessage() {} func (*BearerToken_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_174eb6ef9ee2b356, []int{4, 0} + return fileDescriptor_174eb6ef9ee2b356, []int{5, 0} } func (m *BearerToken_Body) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -590,7 +639,7 @@ func (m *RequestMetaHeader) Reset() { *m = RequestMetaHeader{} } func (m *RequestMetaHeader) String() string { return proto.CompactTextString(m) } func (*RequestMetaHeader) ProtoMessage() {} func (*RequestMetaHeader) Descriptor() ([]byte, []int) { - return fileDescriptor_174eb6ef9ee2b356, []int{5} + return fileDescriptor_174eb6ef9ee2b356, []int{6} } func (m *RequestMetaHeader) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -689,7 +738,7 @@ func (m *ResponseMetaHeader) Reset() { *m = ResponseMetaHeader{} } func (m *ResponseMetaHeader) String() string { return proto.CompactTextString(m) } func (*ResponseMetaHeader) ProtoMessage() {} func (*ResponseMetaHeader) Descriptor() ([]byte, []int) { - return fileDescriptor_174eb6ef9ee2b356, []int{6} + return fileDescriptor_174eb6ef9ee2b356, []int{7} } func (m *ResponseMetaHeader) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -754,10 +803,11 @@ func (m *ResponseMetaHeader) GetOrigin() *ResponseMetaHeader { } func init() { - proto.RegisterEnum("neo.fs.v2.service.SessionToken_Body_Verb", SessionToken_Body_Verb_name, SessionToken_Body_Verb_value) + proto.RegisterEnum("neo.fs.v2.service.ObjectServiceContext_Verb", ObjectServiceContext_Verb_name, ObjectServiceContext_Verb_value) proto.RegisterType((*XHeader)(nil), "neo.fs.v2.service.XHeader") proto.RegisterType((*Version)(nil), "neo.fs.v2.service.Version") proto.RegisterType((*TokenLifetime)(nil), "neo.fs.v2.service.TokenLifetime") + proto.RegisterType((*ObjectServiceContext)(nil), "neo.fs.v2.service.ObjectServiceContext") proto.RegisterType((*SessionToken)(nil), "neo.fs.v2.service.SessionToken") proto.RegisterType((*SessionToken_Body)(nil), "neo.fs.v2.service.SessionToken.Body") proto.RegisterType((*BearerToken)(nil), "neo.fs.v2.service.BearerToken") @@ -769,60 +819,60 @@ func init() { func init() { proto.RegisterFile("v2/service/grpc/meta.proto", fileDescriptor_174eb6ef9ee2b356) } var fileDescriptor_174eb6ef9ee2b356 = []byte{ - // 838 bytes of a gzipped FileDescriptorProto + // 846 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x55, 0xcd, 0x6e, 0x23, 0x45, - 0x10, 0xce, 0xd8, 0x93, 0x38, 0x2e, 0xdb, 0x61, 0xd2, 0x8a, 0xb4, 0x23, 0x6b, 0xe5, 0x8d, 0x0c, - 0x48, 0x70, 0xc8, 0x58, 0x0c, 0xa0, 0xf0, 0xb3, 0x2b, 0x61, 0xc7, 0xb3, 0x6b, 0x43, 0xc8, 0x46, - 0x6d, 0x6f, 0x84, 0xb8, 0x58, 0xf3, 0x53, 0x76, 0x66, 0xd7, 0x99, 0x36, 0xd3, 0x93, 0x21, 0x7e, - 0x13, 0x24, 0xde, 0x80, 0x1b, 0x17, 0x9e, 0x81, 0x23, 0x12, 0x37, 0x4e, 0x28, 0xdc, 0xb8, 0xf1, - 0x06, 0xa8, 0x7f, 0xbc, 0xcc, 0x26, 0x5e, 0xfe, 0xc4, 0x81, 0x5b, 0xd5, 0xd7, 0x5f, 0x55, 0x75, - 0x55, 0x7f, 0x53, 0x03, 0xcd, 0xdc, 0xed, 0x70, 0x4c, 0xf3, 0x38, 0xc4, 0xce, 0x2c, 0x5d, 0x84, - 0x9d, 0x0b, 0xcc, 0x7c, 0x67, 0x91, 0xb2, 0x8c, 0x91, 0xdd, 0x04, 0x99, 0x33, 0xe5, 0x4e, 0xee, - 0x3a, 0x9a, 0xd2, 0xbc, 0x93, 0xbb, 0x1d, 0x3f, 0x9c, 0x2b, 0x6a, 0xb6, 0x5c, 0x20, 0x57, 0xdc, - 0xa6, 0x9d, 0xbb, 0x9d, 0x14, 0xa7, 0xfc, 0xf6, 0xc9, 0xdd, 0x9b, 0x15, 0x72, 0x4c, 0xe3, 0xe9, - 0x52, 0x9d, 0xb6, 0xdf, 0x82, 0xca, 0x67, 0x03, 0xf4, 0x23, 0x4c, 0x89, 0x05, 0xe5, 0x67, 0xb8, - 0xb4, 0x8d, 0x7d, 0xe3, 0x8d, 0x2a, 0x15, 0x26, 0xd9, 0x83, 0xcd, 0xdc, 0x9f, 0x5f, 0xa2, 0x5d, - 0x92, 0x98, 0x72, 0xda, 0xef, 0x42, 0xe5, 0x0c, 0x53, 0x1e, 0xb3, 0x44, 0x10, 0x2e, 0xfc, 0xa7, - 0x2c, 0x95, 0x41, 0x0d, 0xaa, 0x1c, 0x89, 0xc6, 0x09, 0x4b, 0x65, 0x98, 0x40, 0x85, 0xd3, 0xf6, - 0xa0, 0x31, 0x66, 0xcf, 0x30, 0x39, 0x8e, 0xa7, 0x98, 0xc5, 0x17, 0x28, 0xea, 0xe1, 0xd5, 0x42, - 0x86, 0x9a, 0x54, 0x98, 0x02, 0x49, 0x82, 0xa9, 0x0c, 0x33, 0xa9, 0x30, 0x05, 0x12, 0xfb, 0x99, - 0x5d, 0x56, 0x48, 0xec, 0x67, 0xed, 0x9f, 0x4c, 0xa8, 0x8f, 0x90, 0x8b, 0xf2, 0x32, 0x1d, 0x79, - 0x0f, 0xcc, 0x80, 0x45, 0xea, 0xde, 0x35, 0xf7, 0x35, 0xe7, 0xd6, 0xd0, 0x9c, 0x22, 0xdd, 0xe9, - 0xb1, 0x68, 0x49, 0x65, 0x04, 0xf9, 0x00, 0xaa, 0x3c, 0x9e, 0x25, 0x7e, 0x76, 0x99, 0xaa, 0x16, - 0x6b, 0xee, 0xdd, 0x75, 0xe1, 0x2b, 0x0e, 0xfd, 0x83, 0xde, 0xfc, 0xb1, 0x0c, 0xa6, 0x48, 0x45, - 0x76, 0xa0, 0x14, 0x47, 0xb2, 0x78, 0x9d, 0x96, 0xe2, 0x88, 0xb8, 0xb0, 0xcd, 0xbe, 0x4c, 0x30, - 0x9d, 0xc4, 0x91, 0xce, 0x79, 0xa7, 0x90, 0x53, 0x3c, 0x91, 0xf3, 0x58, 0x9c, 0x0f, 0xfb, 0xb4, - 0x22, 0x89, 0xc3, 0x88, 0x3c, 0x00, 0x33, 0xc7, 0x34, 0x90, 0x6d, 0xee, 0xb8, 0x6f, 0xfe, 0x9d, - 0x16, 0x9c, 0x33, 0x4c, 0x03, 0x2a, 0xc3, 0xc8, 0x7d, 0xd8, 0x9e, 0xeb, 0xa1, 0xda, 0xa6, 0x2c, - 0xb9, 0xbf, 0x26, 0xc5, 0x0b, 0xc3, 0xa7, 0xcf, 0x23, 0xc8, 0x3d, 0xa8, 0x71, 0x95, 0x7d, 0x22, - 0x9e, 0x7f, 0x53, 0x76, 0x02, 0x1a, 0xfa, 0x04, 0x97, 0xe4, 0x23, 0xd8, 0x61, 0xc1, 0x53, 0x0c, - 0xb3, 0x89, 0x1f, 0x45, 0x29, 0x72, 0x6e, 0x6f, 0xad, 0xef, 0xab, 0xab, 0x8e, 0x07, 0x1b, 0xb4, - 0xa1, 0x02, 0x34, 0xd0, 0xfe, 0xda, 0x00, 0x53, 0xdc, 0x97, 0xec, 0x81, 0x75, 0xe6, 0xd1, 0xde, - 0xe4, 0xc9, 0xc9, 0xe8, 0xd4, 0x3b, 0x1a, 0x3e, 0x1c, 0x7a, 0x7d, 0x6b, 0x83, 0xec, 0x00, 0x3c, - 0xee, 0x7d, 0xec, 0x1d, 0x8d, 0x27, 0xa7, 0x4f, 0xc6, 0x96, 0x51, 0xf0, 0x1f, 0x79, 0x63, 0xab, - 0x44, 0x5e, 0x81, 0x9a, 0xf6, 0x07, 0x5e, 0xb7, 0x6f, 0x95, 0xc9, 0x2e, 0x34, 0x34, 0x30, 0xf2, - 0xba, 0xf4, 0x68, 0x60, 0x99, 0x05, 0xa8, 0xef, 0x1d, 0x7b, 0x63, 0xcf, 0xda, 0x24, 0x16, 0xd4, - 0x35, 0x44, 0xbb, 0x27, 0x8f, 0x3c, 0x6b, 0x4b, 0x94, 0x2f, 0x22, 0x83, 0xee, 0x68, 0x60, 0x55, - 0x7a, 0x55, 0xa8, 0x84, 0x2c, 0xc9, 0xf0, 0x2a, 0x6b, 0x7f, 0x57, 0x82, 0x5a, 0x0f, 0xfd, 0x14, - 0x53, 0xa5, 0xad, 0xc3, 0x17, 0xb4, 0xf5, 0xea, 0x9a, 0xa9, 0x16, 0xd8, 0xff, 0x95, 0xb4, 0xbe, - 0x35, 0xb4, 0xb4, 0x0e, 0x01, 0xd0, 0x0f, 0xe7, 0x93, 0xcc, 0x0f, 0xe6, 0xa8, 0xef, 0x60, 0x17, - 0xb2, 0xf8, 0xe1, 0xdc, 0xf1, 0xba, 0x47, 0xc7, 0x63, 0x71, 0x4e, 0xab, 0x82, 0x2b, 0xcd, 0x7f, - 0xa5, 0xc1, 0xa2, 0x88, 0xca, 0xff, 0x54, 0x44, 0xed, 0xdf, 0x4a, 0xb0, 0x4b, 0xf1, 0x8b, 0x4b, - 0xe4, 0xd9, 0xa7, 0x98, 0xf9, 0x7a, 0xa3, 0xbc, 0x03, 0x95, 0x5c, 0x6d, 0x0a, 0x7d, 0xfb, 0xe6, - 0x9a, 0x94, 0x7a, 0x97, 0xd0, 0x15, 0x55, 0xac, 0x0f, 0x5c, 0xb0, 0xf0, 0x5c, 0xef, 0x01, 0xe5, - 0x88, 0x4d, 0x90, 0x65, 0x73, 0x79, 0xb5, 0x06, 0x15, 0x26, 0x39, 0x84, 0xea, 0xd5, 0xe4, 0x5c, - 0x56, 0xe2, 0xb6, 0xb9, 0x5f, 0x7e, 0x49, 0x7e, 0xbd, 0xde, 0xe8, 0xf6, 0x95, 0x32, 0x38, 0xe9, - 0x43, 0x63, 0xa5, 0xf8, 0x4c, 0xf4, 0x23, 0x35, 0x5f, 0x73, 0xef, 0xfd, 0xc5, 0x77, 0x47, 0xeb, - 0xbc, 0xb8, 0x77, 0xba, 0x50, 0x0f, 0xe4, 0xe3, 0xeb, 0x24, 0xea, 0xa3, 0x68, 0xfd, 0xb9, 0x46, - 0x68, 0x2d, 0x28, 0xc8, 0xeb, 0x3e, 0x6c, 0xb1, 0x34, 0x9e, 0xc5, 0x89, 0x5d, 0x79, 0xe9, 0xf2, - 0xba, 0x35, 0x55, 0xaa, 0x63, 0xda, 0xbf, 0x1a, 0x40, 0x28, 0xf2, 0x05, 0x4b, 0x38, 0xfe, 0xff, - 0x87, 0xfe, 0xe0, 0x79, 0xaf, 0x6a, 0xda, 0xaf, 0xaf, 0xed, 0xf5, 0x66, 0x37, 0xab, 0x66, 0x7b, - 0xc1, 0xf7, 0xd7, 0x2d, 0xe3, 0x87, 0xeb, 0x96, 0xf1, 0xf3, 0x75, 0xcb, 0xf8, 0xea, 0x97, 0xd6, - 0xc6, 0xe7, 0xef, 0xcf, 0xe2, 0xec, 0xfc, 0x32, 0x70, 0x42, 0x76, 0xd1, 0x49, 0xf8, 0x22, 0x0c, - 0x0f, 0x22, 0xcc, 0x3b, 0x09, 0xb2, 0x29, 0x3f, 0xf0, 0x17, 0xf1, 0xc1, 0x8c, 0x75, 0x6e, 0xfc, - 0xf9, 0x3e, 0xd4, 0xce, 0x37, 0xa5, 0xbd, 0x13, 0x64, 0x0f, 0x47, 0x4e, 0xf7, 0x74, 0x28, 0xca, - 0x8f, 0x14, 0x1c, 0x6c, 0xc9, 0x5f, 0xe2, 0xdb, 0xbf, 0x07, 0x00, 0x00, 0xff, 0xff, 0xb8, 0xaf, - 0x1e, 0xa2, 0x94, 0x07, 0x00, 0x00, + 0x10, 0xce, 0xd8, 0x13, 0x4f, 0x5c, 0x8e, 0xa3, 0xd9, 0x56, 0xa4, 0xb5, 0xac, 0x95, 0x37, 0x1a, + 0x40, 0x70, 0x20, 0x63, 0xed, 0x00, 0x0a, 0x3f, 0x8b, 0x84, 0x1d, 0xcf, 0xae, 0x2d, 0x42, 0x36, + 0x6a, 0x7b, 0x23, 0xc4, 0xc5, 0x9a, 0x9f, 0xb2, 0x33, 0x59, 0x67, 0xda, 0x4c, 0x77, 0x86, 0xf8, + 0x05, 0xb8, 0x71, 0xe7, 0x19, 0xb8, 0x71, 0xe1, 0x19, 0x38, 0xf2, 0x08, 0x28, 0xdc, 0xb8, 0x71, + 0xe2, 0x8a, 0xba, 0xa7, 0xbd, 0x78, 0x13, 0x07, 0x38, 0x20, 0xc4, 0xad, 0xba, 0xea, 0xab, 0xaf, + 0x7e, 0xa7, 0x06, 0x9a, 0xb9, 0xd7, 0xe6, 0x98, 0xe5, 0x49, 0x84, 0xed, 0x69, 0x36, 0x8f, 0xda, + 0x17, 0x28, 0x02, 0x77, 0x9e, 0x31, 0xc1, 0xc8, 0xbd, 0x14, 0x99, 0x3b, 0xe1, 0x6e, 0xee, 0xb9, + 0x1a, 0xd2, 0xbc, 0x9f, 0x7b, 0xed, 0x20, 0x9a, 0x15, 0x50, 0xb1, 0x98, 0x23, 0x2f, 0xb0, 0xcd, + 0x46, 0xee, 0xb5, 0x33, 0x9c, 0xf0, 0xdb, 0x96, 0x07, 0x37, 0x23, 0xe4, 0x98, 0x25, 0x93, 0x45, + 0x61, 0x75, 0x1e, 0x81, 0xf5, 0x79, 0x1f, 0x83, 0x18, 0x33, 0x62, 0x43, 0xf9, 0x05, 0x2e, 0x1a, + 0xc6, 0x9e, 0xf1, 0x56, 0x95, 0x4a, 0x91, 0xec, 0xc2, 0x66, 0x1e, 0xcc, 0x2e, 0xb1, 0x51, 0x52, + 0xba, 0xe2, 0xe1, 0xbc, 0x07, 0xd6, 0x29, 0x66, 0x3c, 0x61, 0xa9, 0x04, 0x5c, 0x04, 0xe7, 0x2c, + 0x53, 0x4e, 0x75, 0x5a, 0x3c, 0x94, 0x36, 0x49, 0x59, 0xa6, 0xdc, 0xa4, 0x56, 0x3e, 0x1c, 0x1f, + 0xea, 0x23, 0xf6, 0x02, 0xd3, 0xa3, 0x64, 0x82, 0x22, 0xb9, 0x40, 0x19, 0x0f, 0xaf, 0xe6, 0xca, + 0xd5, 0xa4, 0x52, 0x94, 0x9a, 0x34, 0x9c, 0x28, 0x37, 0x93, 0x4a, 0x51, 0x6a, 0x92, 0x40, 0x34, + 0xca, 0x85, 0x26, 0x09, 0x84, 0xf3, 0xbb, 0x01, 0xbb, 0xcf, 0xc2, 0x73, 0x8c, 0xc4, 0xb0, 0x28, + 0xea, 0x90, 0xa5, 0x02, 0xaf, 0x04, 0xf9, 0x04, 0xcc, 0x1c, 0xb3, 0x50, 0xf1, 0xed, 0x78, 0x6f, + 0xbb, 0xb7, 0x9a, 0xe7, 0xae, 0x73, 0x73, 0x4f, 0x31, 0x0b, 0xa9, 0xf2, 0x24, 0x8f, 0xc0, 0x0a, + 0xe2, 0x38, 0x43, 0xce, 0x55, 0x0a, 0x35, 0xef, 0xfe, 0x0a, 0x89, 0x6c, 0xae, 0xdb, 0x29, 0xcc, + 0x74, 0x89, 0x73, 0xce, 0xc1, 0x94, 0x04, 0x64, 0x17, 0xec, 0x53, 0x9f, 0x76, 0xc7, 0xcf, 0x8f, + 0x87, 0x27, 0xfe, 0xe1, 0xe0, 0xc9, 0xc0, 0xef, 0xd9, 0x1b, 0xc4, 0x82, 0xf2, 0xc9, 0xf3, 0x91, + 0x6d, 0x48, 0xe1, 0xa9, 0x3f, 0xb2, 0x4b, 0x64, 0x0b, 0xcc, 0xbe, 0xdf, 0xe9, 0xd9, 0x65, 0x02, + 0x50, 0x19, 0xfa, 0x1d, 0x7a, 0xd8, 0xb7, 0x4d, 0x29, 0xf7, 0xfc, 0x23, 0x7f, 0xe4, 0xdb, 0x9b, + 0xa4, 0x0a, 0x9b, 0xb4, 0x73, 0xfc, 0xd4, 0xb7, 0x2b, 0xa4, 0x0e, 0x55, 0x25, 0xf6, 0x3b, 0xc3, + 0xbe, 0x6d, 0x39, 0xdf, 0x94, 0x61, 0x7b, 0x88, 0x5c, 0x36, 0x5e, 0x35, 0x92, 0xbc, 0x0f, 0x66, + 0xc8, 0xe2, 0x62, 0x62, 0x35, 0xef, 0xf5, 0x35, 0x15, 0xaf, 0xc2, 0xdd, 0x2e, 0x8b, 0x17, 0x54, + 0x79, 0x90, 0x0f, 0xa1, 0xca, 0x93, 0x69, 0x1a, 0x88, 0xcb, 0x0c, 0x75, 0xad, 0x0f, 0xd6, 0xb9, + 0x2f, 0x31, 0xf4, 0x4f, 0x78, 0xf3, 0xeb, 0x12, 0x98, 0x92, 0x8a, 0xec, 0x40, 0x29, 0x89, 0x55, + 0xf0, 0x6d, 0x5a, 0x4a, 0x62, 0xe2, 0xc1, 0x16, 0xfb, 0x2a, 0xc5, 0x6c, 0x9c, 0xc4, 0x77, 0xf5, + 0xef, 0x99, 0xb4, 0x0f, 0x7a, 0xd4, 0x52, 0xc0, 0x41, 0x4c, 0x1e, 0xc3, 0xd6, 0x4c, 0xef, 0x83, + 0x1a, 0x72, 0xcd, 0xdb, 0x5b, 0x93, 0xc7, 0x2b, 0x7b, 0x43, 0x5f, 0x7a, 0x90, 0x87, 0x50, 0xe3, + 0x45, 0x85, 0x63, 0xb9, 0xb9, 0xa6, 0x4a, 0x05, 0xb4, 0xea, 0x53, 0x5c, 0x90, 0x13, 0xd8, 0x61, + 0x6a, 0xe8, 0x63, 0x4d, 0xd5, 0xd8, 0x54, 0x41, 0xde, 0xfc, 0x87, 0xdb, 0xd1, 0xdf, 0xa0, 0x75, + 0xb6, 0xaa, 0xef, 0x56, 0xc1, 0x8a, 0x0a, 0x9b, 0xf3, 0x43, 0x09, 0x6a, 0x5d, 0x0c, 0x32, 0xcc, + 0x8a, 0x71, 0x1c, 0xbc, 0x32, 0x8e, 0xd7, 0xd6, 0x84, 0x58, 0x41, 0xff, 0x5b, 0xd3, 0xf8, 0xde, + 0xd0, 0xd3, 0x38, 0x00, 0xc0, 0x20, 0x9a, 0x8d, 0x45, 0x10, 0xce, 0x50, 0xe7, 0xd0, 0x58, 0x61, + 0x09, 0xa2, 0x99, 0xeb, 0x77, 0x0e, 0x8f, 0x46, 0xd2, 0x4e, 0xab, 0x12, 0xab, 0xc4, 0xff, 0x7e, + 0x6c, 0xce, 0x6f, 0x25, 0xb8, 0x47, 0xf1, 0xcb, 0x4b, 0xe4, 0xe2, 0x33, 0x14, 0x81, 0x3e, 0x3f, + 0xef, 0x82, 0x95, 0x17, 0x67, 0x45, 0x67, 0xdf, 0x5c, 0x43, 0xa9, 0x0f, 0x0f, 0x5d, 0x42, 0xe5, + 0xad, 0xc1, 0x39, 0x8b, 0xce, 0xf4, 0xd1, 0x28, 0x1e, 0xf2, 0x6c, 0x08, 0x31, 0x53, 0xa9, 0xd5, + 0xa9, 0x14, 0xc9, 0x01, 0x54, 0xaf, 0xc6, 0x67, 0x2a, 0x12, 0x6f, 0x98, 0x7b, 0xe5, 0x3b, 0xf8, + 0xf5, 0x2d, 0xa4, 0x5b, 0x57, 0x85, 0xc0, 0x49, 0x0f, 0xea, 0xcb, 0x1d, 0x13, 0xb2, 0x1e, 0xbd, + 0x41, 0x0f, 0xff, 0xe6, 0x6b, 0xa3, 0xdb, 0x7c, 0xf5, 0x53, 0xed, 0xc0, 0x76, 0xa8, 0x86, 0xaf, + 0x49, 0x2a, 0x8a, 0xa4, 0xf5, 0xd7, 0x3b, 0x42, 0x6b, 0xe1, 0xca, 0x7a, 0x3d, 0x86, 0x0a, 0xcb, + 0x92, 0x69, 0x92, 0x36, 0xac, 0x3b, 0xbf, 0xf7, 0x5b, 0x5d, 0xa5, 0xda, 0xc7, 0xf9, 0xd5, 0x00, + 0x42, 0x91, 0xcf, 0x59, 0xca, 0xf1, 0xff, 0xdf, 0xf4, 0x8f, 0x5f, 0xd6, 0x5a, 0x74, 0xfb, 0x8d, + 0xb5, 0xb5, 0xde, 0xac, 0x66, 0x59, 0x6c, 0x37, 0xfc, 0xf1, 0xba, 0x65, 0xfc, 0x74, 0xdd, 0x32, + 0x7e, 0xbe, 0x6e, 0x19, 0xdf, 0xfe, 0xd2, 0xda, 0xf8, 0xe2, 0x83, 0x69, 0x22, 0xce, 0x2e, 0x43, + 0x37, 0x62, 0x17, 0xed, 0x94, 0xcf, 0xa3, 0x68, 0x3f, 0xc6, 0xbc, 0x9d, 0x22, 0x9b, 0xf0, 0xfd, + 0x60, 0x9e, 0xec, 0x4f, 0x59, 0xfb, 0xc6, 0x6f, 0xf2, 0x23, 0xfd, 0xf8, 0xae, 0xb4, 0x7b, 0x8c, + 0xec, 0xc9, 0xd0, 0xed, 0x9c, 0x0c, 0x64, 0x78, 0x7d, 0x08, 0xc2, 0x8a, 0xfa, 0x7f, 0xbe, 0xf3, + 0x47, 0x00, 0x00, 0x00, 0xff, 0xff, 0x08, 0x43, 0x06, 0xc6, 0xc1, 0x07, 0x00, 0x00, } func (m *XHeader) Marshal() (dAtA []byte, err error) { @@ -945,6 +995,50 @@ func (m *TokenLifetime) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *ObjectServiceContext) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ObjectServiceContext) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ObjectServiceContext) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.Address != nil { + { + size, err := m.Address.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintMeta(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.Verb != 0 { + i = encodeVarintMeta(dAtA, i, uint64(m.Verb)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + func (m *SessionToken) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -1034,7 +1128,7 @@ func (m *SessionToken_Body) MarshalToSizedBuffer(dAtA []byte) (int, error) { copy(dAtA[i:], m.SessionKey) i = encodeVarintMeta(dAtA, i, uint64(len(m.SessionKey))) i-- - dAtA[i] = 0x2a + dAtA[i] = 0x22 } if m.Lifetime != nil { { @@ -1046,12 +1140,7 @@ func (m *SessionToken_Body) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintMeta(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x22 - } - if m.Verb != 0 { - i = encodeVarintMeta(dAtA, i, uint64(m.Verb)) - i-- - dAtA[i] = 0x18 + dAtA[i] = 0x1a } if m.OwnerId != nil { { @@ -1075,16 +1164,16 @@ func (m *SessionToken_Body) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *SessionToken_Body_ObjectAddress) MarshalTo(dAtA []byte) (int, error) { +func (m *SessionToken_Body_ObjectService) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *SessionToken_Body_ObjectAddress) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *SessionToken_Body_ObjectService) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) - if m.ObjectAddress != nil { + if m.ObjectService != nil { { - size, err := m.ObjectAddress.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.ObjectService.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -1092,7 +1181,7 @@ func (m *SessionToken_Body_ObjectAddress) MarshalToSizedBuffer(dAtA []byte) (int i = encodeVarintMeta(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x32 + dAtA[i] = 0x2a } return len(dAtA) - i, nil } @@ -1454,6 +1543,25 @@ func (m *TokenLifetime) Size() (n int) { return n } +func (m *ObjectServiceContext) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Verb != 0 { + n += 1 + sovMeta(uint64(m.Verb)) + } + if m.Address != nil { + l = m.Address.Size() + n += 1 + l + sovMeta(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + func (m *SessionToken) Size() (n int) { if m == nil { return 0 @@ -1488,9 +1596,6 @@ func (m *SessionToken_Body) Size() (n int) { l = m.OwnerId.Size() n += 1 + l + sovMeta(uint64(l)) } - if m.Verb != 0 { - n += 1 + sovMeta(uint64(m.Verb)) - } if m.Lifetime != nil { l = m.Lifetime.Size() n += 1 + l + sovMeta(uint64(l)) @@ -1508,14 +1613,14 @@ func (m *SessionToken_Body) Size() (n int) { return n } -func (m *SessionToken_Body_ObjectAddress) Size() (n int) { +func (m *SessionToken_Body_ObjectService) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.ObjectAddress != nil { - l = m.ObjectAddress.Size() + if m.ObjectService != nil { + l = m.ObjectService.Size() n += 1 + l + sovMeta(uint64(l)) } return n @@ -1963,6 +2068,115 @@ func (m *TokenLifetime) Unmarshal(dAtA []byte) error { } return nil } +func (m *ObjectServiceContext) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMeta + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ObjectServiceContext: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ObjectServiceContext: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Verb", wireType) + } + m.Verb = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMeta + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Verb |= ObjectServiceContext_Verb(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMeta + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthMeta + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthMeta + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Address == nil { + m.Address = &grpc.Address{} + } + if err := m.Address.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipMeta(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthMeta + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthMeta + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *SessionToken) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2189,25 +2403,6 @@ func (m *SessionToken_Body) Unmarshal(dAtA []byte) error { } iNdEx = postIndex case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Verb", wireType) - } - m.Verb = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMeta - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Verb |= SessionToken_Body_Verb(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Lifetime", wireType) } @@ -2243,7 +2438,7 @@ func (m *SessionToken_Body) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 5: + case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field SessionKey", wireType) } @@ -2277,9 +2472,9 @@ func (m *SessionToken_Body) Unmarshal(dAtA []byte) error { m.SessionKey = []byte{} } iNdEx = postIndex - case 6: + case 5: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ObjectAddress", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ObjectService", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -2306,11 +2501,11 @@ func (m *SessionToken_Body) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &grpc.Address{} + v := &ObjectServiceContext{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } - m.Context = &SessionToken_Body_ObjectAddress{v} + m.Context = &SessionToken_Body_ObjectService{v} iNdEx = postIndex default: iNdEx = preIndex diff --git a/v2/service/grpc/verify.pb.go b/v2/service/grpc/verify.pb.go index 3f270b6..4c20515 100644 --- a/v2/service/grpc/verify.pb.go +++ b/v2/service/grpc/verify.pb.go @@ -6,8 +6,6 @@ package service import ( fmt "fmt" proto "github.com/golang/protobuf/proto" - _ "github.com/nspcc-dev/neofs-api-go/v2/acl/grpc" - _ "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" io "io" math "math" math_bits "math/bits" @@ -243,30 +241,28 @@ func init() { func init() { proto.RegisterFile("v2/service/grpc/verify.proto", fileDescriptor_333853833d6163d3) } var fileDescriptor_333853833d6163d3 = []byte{ - // 361 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe4, 0x93, 0xcf, 0x4a, 0xeb, 0x40, - 0x14, 0xc6, 0x6f, 0xd2, 0x52, 0xb8, 0x73, 0xef, 0xed, 0xad, 0x41, 0x30, 0x96, 0x12, 0xa4, 0x2b, - 0x17, 0x66, 0x06, 0xe3, 0x4a, 0x5c, 0x69, 0xfd, 0xbb, 0x11, 0x49, 0xc1, 0x85, 0x1b, 0x49, 0xd2, - 0x93, 0x38, 0x68, 0x67, 0xe2, 0xcc, 0x74, 0x20, 0x6f, 0xe2, 0x33, 0xb8, 0x16, 0x9f, 0xc1, 0xa5, - 0x8f, 0x20, 0xf5, 0x45, 0x24, 0x49, 0x6b, 0x4b, 0xff, 0x40, 0xf7, 0xee, 0x4e, 0x4e, 0xbe, 0xef, - 0x37, 0x1f, 0x1f, 0x1c, 0xd4, 0xd2, 0x1e, 0x91, 0x20, 0x34, 0x8d, 0x80, 0x24, 0x22, 0x8d, 0x88, - 0x06, 0x41, 0xe3, 0x0c, 0xa7, 0x82, 0x2b, 0x6e, 0xad, 0x31, 0xe0, 0x38, 0x96, 0x58, 0x7b, 0x78, - 0x24, 0x6a, 0x6e, 0x68, 0x8f, 0x04, 0xd1, 0x43, 0x29, 0x56, 0x59, 0x0a, 0xb2, 0xd4, 0x36, 0x6d, - 0xed, 0x11, 0x01, 0xb1, 0x9c, 0xfb, 0xd3, 0xde, 0x45, 0xbf, 0xbb, 0x34, 0x61, 0x81, 0x1a, 0x08, - 0xb0, 0x1a, 0xa8, 0x72, 0x0f, 0x99, 0x6d, 0x6c, 0x19, 0xdb, 0x7f, 0xfd, 0x7c, 0xb4, 0x2c, 0x54, - 0x95, 0x34, 0x61, 0xb6, 0x59, 0xac, 0x8a, 0xb9, 0xfd, 0x62, 0xa2, 0x4d, 0x1f, 0x1e, 0x07, 0x20, - 0xd5, 0x75, 0x1e, 0x88, 0x46, 0x81, 0xa2, 0x9c, 0x9d, 0x43, 0xd0, 0x03, 0x61, 0x75, 0x50, 0x3d, - 0xe4, 0xbd, 0xec, 0x56, 0x8e, 0xa9, 0x05, 0xee, 0x8f, 0xd7, 0xc2, 0x73, 0x79, 0xf1, 0xf7, 0xcb, - 0xfe, 0xbf, 0xdc, 0x33, 0x09, 0xd2, 0x41, 0xf5, 0x3e, 0xa8, 0x60, 0x0a, 0x62, 0xae, 0x02, 0xc9, - 0x3d, 0x13, 0xc8, 0x19, 0x6a, 0x70, 0x41, 0x13, 0xca, 0xa6, 0x30, 0x95, 0x15, 0x30, 0xff, 0x4b, - 0xd7, 0x04, 0x74, 0x8c, 0x6a, 0xe5, 0xca, 0xae, 0x16, 0xf6, 0x9d, 0x05, 0xf6, 0xa5, 0x85, 0xf8, - 0x23, 0x6f, 0xfb, 0xd5, 0x44, 0x4d, 0x1f, 0x64, 0xca, 0x99, 0x84, 0x9f, 0xd1, 0xdb, 0xc9, 0x4c, - 0x6f, 0xee, 0xc2, 0xde, 0x96, 0x35, 0x32, 0x2e, 0xee, 0x28, 0x7c, 0x1b, 0x3a, 0xc6, 0xfb, 0xd0, - 0x31, 0x3e, 0x86, 0x8e, 0xf1, 0xf4, 0xe9, 0xfc, 0xba, 0xd9, 0x4f, 0xa8, 0xba, 0x1b, 0x84, 0x38, - 0xe2, 0x7d, 0xc2, 0x64, 0x1a, 0x45, 0x6e, 0x0f, 0x34, 0x61, 0xc0, 0x63, 0xe9, 0x06, 0x29, 0x75, - 0x13, 0x4e, 0x66, 0x4e, 0xe7, 0x60, 0xf4, 0xf1, 0x6c, 0xae, 0x5f, 0x02, 0x3f, 0xed, 0xe2, 0xc3, - 0xab, 0x8b, 0x3c, 0x46, 0xb7, 0x5c, 0x87, 0xb5, 0xe2, 0x1a, 0xf6, 0xbe, 0x02, 0x00, 0x00, 0xff, - 0xff, 0x66, 0xc2, 0xc4, 0xb8, 0x73, 0x03, 0x00, 0x00, + // 335 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x29, 0x33, 0xd2, 0x2f, + 0x4e, 0x2d, 0x2a, 0xcb, 0x4c, 0x4e, 0xd5, 0x4f, 0x2f, 0x2a, 0x48, 0xd6, 0x2f, 0x4b, 0x2d, 0xca, + 0x4c, 0xab, 0xd4, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0xcc, 0x4b, 0xcd, 0xd7, 0x4b, 0x2b, + 0xd6, 0x2b, 0x33, 0xd2, 0x83, 0x2a, 0x52, 0x32, 0xe4, 0xe2, 0x0c, 0xce, 0x4c, 0xcf, 0x4b, 0x2c, + 0x29, 0x2d, 0x4a, 0x15, 0x12, 0xe0, 0x62, 0xce, 0x4e, 0xad, 0x94, 0x60, 0x54, 0x60, 0xd4, 0xe0, + 0x09, 0x02, 0x31, 0x85, 0x84, 0xb8, 0x58, 0x8a, 0x33, 0xd3, 0xf3, 0x24, 0x98, 0xc0, 0x42, 0x60, + 0xb6, 0xd2, 0x16, 0x26, 0x2e, 0xc9, 0xa0, 0xd4, 0xc2, 0xd2, 0xd4, 0xe2, 0x92, 0x30, 0x90, 0xe9, + 0x99, 0xc9, 0x89, 0x25, 0x99, 0xf9, 0x79, 0x1e, 0xa9, 0x89, 0x29, 0xa9, 0x45, 0x42, 0xce, 0x5c, + 0x7c, 0x49, 0xf9, 0x29, 0x95, 0xf1, 0xc5, 0x30, 0x53, 0xc1, 0xc6, 0x71, 0x1b, 0xc9, 0xe8, 0x61, + 0x58, 0xae, 0x07, 0xb7, 0x39, 0x88, 0x17, 0xa4, 0x07, 0xe1, 0x10, 0x67, 0x2e, 0xbe, 0xdc, 0xd4, + 0x92, 0x44, 0x24, 0x43, 0x98, 0x88, 0x31, 0x04, 0xa4, 0x07, 0x61, 0x88, 0x3b, 0x97, 0x40, 0x7e, + 0x51, 0x66, 0x7a, 0x66, 0x1e, 0x92, 0x31, 0xcc, 0x44, 0x18, 0xc3, 0x0f, 0xd1, 0x85, 0x30, 0xc8, + 0x85, 0x8b, 0x0d, 0x22, 0x24, 0xc1, 0x02, 0xd6, 0xae, 0x83, 0x45, 0x3b, 0xce, 0x00, 0x09, 0x82, + 0xea, 0x55, 0xda, 0xc6, 0xc4, 0x25, 0x15, 0x94, 0x5a, 0x5c, 0x90, 0x9f, 0x57, 0x9c, 0x3a, 0x32, + 0xc2, 0xcd, 0x15, 0x2d, 0xdc, 0x74, 0xb1, 0x86, 0x1b, 0xae, 0x10, 0x81, 0x05, 0x9c, 0x53, 0xd2, + 0x89, 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, 0x31, 0x3e, 0x78, 0x24, 0xc7, 0x38, 0xe3, 0xb1, 0x1c, + 0x43, 0x94, 0x65, 0x7a, 0x66, 0x49, 0x46, 0x69, 0x92, 0x5e, 0x72, 0x7e, 0xae, 0x7e, 0x5e, 0x71, + 0x41, 0x72, 0xb2, 0x6e, 0x4a, 0x6a, 0x99, 0x7e, 0x5e, 0x6a, 0x7e, 0x5a, 0xb1, 0x6e, 0x62, 0x41, + 0xa6, 0x6e, 0x7a, 0xbe, 0x3e, 0x5a, 0x3e, 0xb0, 0x86, 0x72, 0x56, 0x31, 0x89, 0xf8, 0xa5, 0xe6, + 0xbb, 0x05, 0xeb, 0x39, 0x06, 0x78, 0x82, 0x9c, 0x11, 0x0c, 0x11, 0x4e, 0x62, 0x03, 0x67, 0x10, + 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0xdc, 0xd7, 0x4d, 0x30, 0x40, 0x03, 0x00, 0x00, } func (m *Signature) Marshal() (dAtA []byte, err error) { From b3cb48389420825b2cb879b97ea03edc0f76e9a1 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Mon, 17 Aug 2020 14:30:09 +0300 Subject: [PATCH 0302/1196] Adopt neofs-api structure changes Signed-off-by: Alex Vanin --- v2/acl/convert.go | 76 +++++----- v2/acl/grpc/types.go | 8 +- v2/container/grpc/marshal.go | 238 ------------------------------ v2/container/grpc/marshal_test.go | 77 ---------- v2/container/grpc/signature.go | 17 --- v2/object/grpc/service.go | 16 +- v2/service/grpc/meta.go | 27 ++-- 7 files changed, 66 insertions(+), 393 deletions(-) delete mode 100644 v2/container/grpc/marshal.go delete mode 100644 v2/container/grpc/marshal_test.go delete mode 100644 v2/container/grpc/signature.go diff --git a/v2/acl/convert.go b/v2/acl/convert.go index e05ee07..f41a28d 100644 --- a/v2/acl/convert.go +++ b/v2/acl/convert.go @@ -31,108 +31,108 @@ func TargetFromGRPCField(t acl.Target) Target { } } -func OperationToGRPCField(t Operation) acl.EACLRecord_Operation { +func OperationToGRPCField(t Operation) acl.Operation { switch t { case OperationPut: - return acl.EACLRecord_PUT + return acl.Operation_PUT case OperationDelete: - return acl.EACLRecord_DELETE + return acl.Operation_DELETE case OperationGet: - return acl.EACLRecord_GET + return acl.Operation_GET case OperationHead: - return acl.EACLRecord_HEAD + return acl.Operation_HEAD case OperationSearch: - return acl.EACLRecord_SEARCH + return acl.Operation_SEARCH case OperationRange: - return acl.EACLRecord_GETRANGE + return acl.Operation_GETRANGE case OperationRangeHash: - return acl.EACLRecord_GETRANGEHASH + return acl.Operation_GETRANGEHASH default: - return acl.EACLRecord_OPERATION_UNSPECIFIED + return acl.Operation_OPERATION_UNSPECIFIED } } -func OperationFromGRPCField(t acl.EACLRecord_Operation) Operation { +func OperationFromGRPCField(t acl.Operation) Operation { switch t { - case acl.EACLRecord_PUT: + case acl.Operation_PUT: return OperationPut - case acl.EACLRecord_DELETE: + case acl.Operation_DELETE: return OperationDelete - case acl.EACLRecord_GET: + case acl.Operation_GET: return OperationGet - case acl.EACLRecord_HEAD: + case acl.Operation_HEAD: return OperationHead - case acl.EACLRecord_SEARCH: + case acl.Operation_SEARCH: return OperationSearch - case acl.EACLRecord_GETRANGE: + case acl.Operation_GETRANGE: return OperationRange - case acl.EACLRecord_GETRANGEHASH: + case acl.Operation_GETRANGEHASH: return OperationRangeHash default: return OperationUnknown } } -func ActionToGRPCField(t Action) acl.EACLRecord_Action { +func ActionToGRPCField(t Action) acl.Action { switch t { case ActionDeny: - return acl.EACLRecord_DENY + return acl.Action_DENY case ActionAllow: - return acl.EACLRecord_ALLOW + return acl.Action_ALLOW default: - return acl.EACLRecord_ACTION_UNSPECIFIED + return acl.Action_ACTION_UNSPECIFIED } } -func ActionFromGRPCField(t acl.EACLRecord_Action) Action { +func ActionFromGRPCField(t acl.Action) Action { switch t { - case acl.EACLRecord_DENY: + case acl.Action_DENY: return ActionDeny - case acl.EACLRecord_ALLOW: + case acl.Action_ALLOW: return ActionAllow default: return ActionUnknown } } -func HeaderTypeToGRPCField(t HeaderType) acl.EACLRecord_FilterInfo_Header { +func HeaderTypeToGRPCField(t HeaderType) acl.HeaderType { switch t { case HeaderTypeRequest: - return acl.EACLRecord_FilterInfo_REQUEST + return acl.HeaderType_REQUEST case HeaderTypeObject: - return acl.EACLRecord_FilterInfo_OBJECT + return acl.HeaderType_OBJECT default: - return acl.EACLRecord_FilterInfo_HEADER_UNSPECIFIED + return acl.HeaderType_HEADER_UNSPECIFIED } } -func HeaderTypeFromGRPCField(t acl.EACLRecord_FilterInfo_Header) HeaderType { +func HeaderTypeFromGRPCField(t acl.HeaderType) HeaderType { switch t { - case acl.EACLRecord_FilterInfo_REQUEST: + case acl.HeaderType_REQUEST: return HeaderTypeRequest - case acl.EACLRecord_FilterInfo_OBJECT: + case acl.HeaderType_OBJECT: return HeaderTypeObject default: return HeaderTypeUnknown } } -func MatchTypeToGRPCField(t MatchType) acl.EACLRecord_FilterInfo_MatchType { +func MatchTypeToGRPCField(t MatchType) acl.MatchType { switch t { case MatchTypeStringEqual: - return acl.EACLRecord_FilterInfo_STRING_EQUAL + return acl.MatchType_STRING_EQUAL case MatchTypeStringNotEqual: - return acl.EACLRecord_FilterInfo_STRING_NOT_EQUAL + return acl.MatchType_STRING_NOT_EQUAL default: - return acl.EACLRecord_FilterInfo_MATCH_TYPE_UNSPECIFIED + return acl.MatchType_MATCH_TYPE_UNSPECIFIED } } -func MatchTypeFromGRPCField(t acl.EACLRecord_FilterInfo_MatchType) MatchType { +func MatchTypeFromGRPCField(t acl.MatchType) MatchType { switch t { - case acl.EACLRecord_FilterInfo_STRING_EQUAL: + case acl.MatchType_STRING_EQUAL: return MatchTypeStringEqual - case acl.EACLRecord_FilterInfo_STRING_NOT_EQUAL: + case acl.MatchType_STRING_NOT_EQUAL: return MatchTypeStringNotEqual default: return MatchTypeUnknown diff --git a/v2/acl/grpc/types.go b/v2/acl/grpc/types.go index 3091259..da83e24 100644 --- a/v2/acl/grpc/types.go +++ b/v2/acl/grpc/types.go @@ -19,14 +19,14 @@ func (m *EACLTable) SetRecords(v []*EACLRecord) { } // SetOperation sets operation of the eACL record. -func (m *EACLRecord) SetOperation(v EACLRecord_Operation) { +func (m *EACLRecord) SetOperation(v Operation) { if m != nil { m.Operation = v } } // SetAction sets action of the eACL record. -func (m *EACLRecord) SetAction(v EACLRecord_Action) { +func (m *EACLRecord) SetAction(v Action) { if m != nil { m.Action = v } @@ -47,14 +47,14 @@ func (m *EACLRecord) SetTargets(v []*EACLRecord_TargetInfo) { } // SetHeader sets header type of the eACL filter. -func (m *EACLRecord_FilterInfo) SetHeader(v EACLRecord_FilterInfo_Header) { +func (m *EACLRecord_FilterInfo) SetHeader(v HeaderType) { if m != nil { m.Header = v } } // SetMatchType sets match type of the eACL filter. -func (m *EACLRecord_FilterInfo) SetMatchType(v EACLRecord_FilterInfo_MatchType) { +func (m *EACLRecord_FilterInfo) SetMatchType(v MatchType) { if m != nil { m.MatchType = v } diff --git a/v2/container/grpc/marshal.go b/v2/container/grpc/marshal.go deleted file mode 100644 index aa04626..0000000 --- a/v2/container/grpc/marshal.go +++ /dev/null @@ -1,238 +0,0 @@ -package container - -import ( - "encoding/binary" - "math/bits" - - "github.com/pkg/errors" -) - -// StableMarshal marshals auto-generated container structure into -// protobuf-compatible stable byte sequence. -func (m *Container) StableMarshal(buf []byte) ([]byte, error) { - if m == nil { - return []byte{}, nil - } - - if buf == nil { - buf = make([]byte, m.StableSize()) - } - - var ( - i, n, offset int - ) - - // Write owner id field. - - if m.OwnerId != nil { - buf[i] = 0x0A // id:0x1 << 3 | wiretype:0x2 - n = m.OwnerId.StableSize() - offset = binary.PutUvarint(buf[i+1:], uint64(n)) - - _, err := m.OwnerId.StableMarshal(buf[i+1+offset:]) - if err != nil { - return nil, errors.Wrapf(err, "can't marshal owner id") - } - - i += 1 + offset + n - } - - // Write salt field. - - buf[i] = 0x12 // id:0x2 << 3 | wiretype:0x2 - offset = binary.PutUvarint(buf[i+1:], uint64(len(m.Nonce))) - n = copy(buf[i+1+offset:], m.Nonce) - i += 1 + offset + n - - // Write basic acl field. - - buf[i] = 0x18 // id:0x3 << 3 | wiretype:0x0 - offset = binary.PutUvarint(buf[i+1:], uint64(m.BasicAcl)) - i += 1 + offset - - // Write attributes field. - - for j := range m.Attributes { - buf[i] = 0x22 // id:0x4 << 3 | wiretype:0x2 - n = m.Attributes[j].StableSize() - offset = binary.PutUvarint(buf[i+1:], uint64(n)) - - _, err := m.Attributes[j].StableMarshal(buf[i+1+offset:]) - if err != nil { - return nil, errors.Wrapf(err, "can't marshal attribute %v", - m.Attributes[i].Key) - } - - i += 1 + offset + n - } - - // Write placement rule field. - - if m.PlacementPolicy != nil { - buf[i] = 0x2A // id:0x5 << 3 | wiretype:0x2 - n = m.PlacementPolicy.StableSize() - offset = binary.PutUvarint(buf[i+1:], uint64(n)) - - _, err := m.PlacementPolicy.StableMarshal(buf[i+1+offset:]) - if err != nil { - return nil, errors.Wrapf(err, "can't marshal attribute %v", - m.Attributes[i].Key) - } - } - - return buf, nil -} - -func (m *Container) StableSize() int { - if m == nil { - return 0 - } - - var ( - ln, size int - ) - - if m.OwnerId != nil { - ln = m.OwnerId.StableSize() - } - size += 1 + uvarIntSize(uint64(ln)) + ln // wiretype + bytes length + bytes - - ln = len(m.Nonce) // size of salt field - size += 1 + uvarIntSize(uint64(ln)) + ln // wiretype + bytes length + bytes - - // size of basic acl field - size += 1 + uvarIntSize(uint64(m.BasicAcl)) // wiretype + varint - - // size of attributes - for i := range m.Attributes { - ln = m.Attributes[i].StableSize() - size += 1 + uvarIntSize(uint64(ln)) + ln // wiretype + size of struct + struct - } - - // size of placement rule - if m.PlacementPolicy != nil { - ln = m.PlacementPolicy.StableSize() - size += 1 + uvarIntSize(uint64(ln)) + ln // wiretype + size of struct + struct - } - - return size -} - -func (m *Container_Attribute) StableMarshal(buf []byte) ([]byte, error) { - if m == nil { - return []byte{}, nil - } - - if buf == nil { - buf = make([]byte, m.StableSize()) - } - - var ( - i, n, offset int - ) - - // Write key field. - - buf[i] = 0x0A // id:0x1 << 3 | wiretype:0x2 - offset = binary.PutUvarint(buf[i+1:], uint64(len(m.Key))) - n = copy(buf[i+1+offset:], m.Key) - i += 1 + offset + n - - // Write value field. - - buf[i] = 0x12 // id:0x2 << 3 | wiretype:0x2 - offset = binary.PutUvarint(buf[i+1:], uint64(len(m.Value))) - copy(buf[i+1+offset:], m.Value) - - return buf, nil -} - -func (m *Container_Attribute) StableSize() int { - if m == nil { - return 0 - } - - var ( - ln, size int - ) - - ln = len(m.Key) // size of key field - size += 1 + uvarIntSize(uint64(ln)) + ln // wiretype + size of string + string - - ln = len(m.Value) // size of value field - size += 1 + uvarIntSize(uint64(ln)) + ln // wiretype + size of string + string - - return size -} - -func (m *PutRequest_Body) StableMarshal(buf []byte) ([]byte, error) { - if m == nil { - return []byte{}, nil - } - - if buf == nil { - buf = make([]byte, m.StableSize()) - } - - var ( - i, n, offset int - ) - - // Write container field. - - if m.Container != nil { - buf[i] = 0x0A // id:0x1 << 3 | wiretype:0x2 - n = m.Container.StableSize() - offset = binary.PutUvarint(buf[i+1:], uint64(n)) - - _, err := m.Container.StableMarshal(buf[i+1+offset:]) - if err != nil { - return nil, errors.Wrapf(err, "can't marshal container") - } - - i += 1 + offset + n - } - - // Write public key field. - - buf[i] = 0x12 // id:0x2 << 3 | wiretype:0x2 - offset = binary.PutUvarint(buf[i+1:], uint64(len(m.PublicKey))) - n = copy(buf[i+1+offset:], m.PublicKey) - i += 1 + offset + n - - // Write signature field. - - buf[i] = 0x1A // id:0x3 << 3 | wiretype:0x2 - offset = binary.PutUvarint(buf[i+1:], uint64(len(m.Signature))) - copy(buf[i+1+offset:], m.Signature) - - return buf, nil -} - -func (m *PutRequest_Body) StableSize() int { - if m == nil { - return 0 - } - - var ( - ln, size int - ) - - if m.Container != nil { - ln = m.Container.StableSize() - size += 1 + uvarIntSize(uint64(ln)) + ln // wiretype + size of string + string - } - - ln = len(m.PublicKey) - size += 1 + uvarIntSize(uint64(ln)) + ln // wiretype + size of string + string - - ln = len(m.Signature) - size += 1 + uvarIntSize(uint64(ln)) + ln // wiretype + size of string + string - - return size -} - -// uvarIntSize returns length of varint byte sequence for uint64 value 'x'. -func uvarIntSize(x uint64) int { - return (bits.Len64(x|1) + 6) / 7 -} diff --git a/v2/container/grpc/marshal_test.go b/v2/container/grpc/marshal_test.go deleted file mode 100644 index ef8bfdd..0000000 --- a/v2/container/grpc/marshal_test.go +++ /dev/null @@ -1,77 +0,0 @@ -package container - -import ( - "testing" - - netmap "github.com/nspcc-dev/neofs-api-go/v2/netmap/grpc" - refs "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" - "github.com/stretchr/testify/require" -) - -var ( - cnr = &Container{ - OwnerId: &refs.OwnerID{Value: []byte("Owner")}, - Nonce: []byte("Salt"), - BasicAcl: 505, - Attributes: []*Container_Attribute{ - { - Key: "Hello", - Value: "World", - }, - { - Key: "Privet", - Value: "Mir", - }, - }, - PlacementPolicy: &netmap.PlacementPolicy{ - ReplFactor: 4, - FilterGroups: []*netmap.PlacementPolicy_FilterGroup{ - { - Selectors: []*netmap.PlacementPolicy_FilterGroup_Selector{ - { - Count: 1, - Key: "Node", - }, - }, - Filters: []*netmap.PlacementPolicy_FilterGroup_Filter{ - { - Key: "City", - }, - { - Key: "Datacenter", - }, - }, - Exclude: []uint32{4, 5, 6}, - }, - }, - }, - } -) - -func TestContainer_StableMarshal(t *testing.T) { - newCnr := new(Container) - - wire, err := cnr.StableMarshal(nil) - require.NoError(t, err) - - err = newCnr.Unmarshal(wire) - require.NoError(t, err) - - require.Equal(t, cnr, newCnr) -} - -func TestPutRequest_Body_StableMarshal(t *testing.T) { - expectedBody := new(PutRequest_Body) - expectedBody.Container = cnr - expectedBody.PublicKey = []byte{1, 2, 3, 4} - expectedBody.Signature = []byte{5, 6, 7, 8} - - wire, err := expectedBody.StableMarshal(nil) - require.NoError(t, err) - - gotBody := new(PutRequest_Body) - err = gotBody.Unmarshal(wire) - require.NoError(t, err) - - require.Equal(t, expectedBody, gotBody) -} diff --git a/v2/container/grpc/signature.go b/v2/container/grpc/signature.go deleted file mode 100644 index 0bdb334..0000000 --- a/v2/container/grpc/signature.go +++ /dev/null @@ -1,17 +0,0 @@ -package container - -func (m *Container) ReadSignedData(buf []byte) ([]byte, error) { - return m.StableMarshal(buf) -} - -func (m *Container) SignedDataSize() int { - return m.StableSize() -} - -func (m *PutRequest_Body) ReadSignedData(buf []byte) ([]byte, error) { - return m.StableMarshal(buf) -} - -func (m *PutRequest_Body) SignedDataSize() int { - return m.StableSize() -} diff --git a/v2/object/grpc/service.go b/v2/object/grpc/service.go index 0372b3d..1b95500 100644 --- a/v2/object/grpc/service.go +++ b/v2/object/grpc/service.go @@ -296,35 +296,35 @@ func (m *HeadRequest) SetVerifyHeader(v *service.RequestVerificationHeader) { // SetVersion sets version of the object format. func (m *HeadResponse_Body_ShortHeader) SetVersion(v *service.Version) { if m != nil { - m.Version = v + m.ShortHeader.Version = v } } // SetCreationEpoch sets creation epoch number of the object. func (m *HeadResponse_Body_ShortHeader) SetCreationEpoch(v uint64) { if m != nil { - m.CreationEpoch = v + m.ShortHeader.CreationEpoch = v } } // SetOwnerId sets identifier of the object owner. func (m *HeadResponse_Body_ShortHeader) SetOwnerId(v *refs.OwnerID) { if m != nil { - m.OwnerId = v + m.ShortHeader.OwnerId = v } } // SetObjectType sets type of the object. func (m *HeadResponse_Body_ShortHeader) SetObjectType(v ObjectType) { if m != nil { - m.ObjectType = v + m.ShortHeader.ObjectType = v } } // SetPayloadLength sets length of the object payload. func (m *HeadResponse_Body_ShortHeader) SetPayloadLength(v uint64) { if m != nil { - m.PayloadLength = v + m.ShortHeader.PayloadLength = v } } @@ -340,9 +340,7 @@ func (m *HeadResponse_Body) SetHeader(v *Header) { // SetShortHeader sets short header of the object. func (m *HeadResponse_Body) SetShortHeader(v *HeadResponse_Body_ShortHeader) { if m != nil { - m.Head = &HeadResponse_Body_ShortHeader_{ - ShortHeader: v, - } + m.Head = v } } @@ -368,7 +366,7 @@ func (m *HeadResponse) SetVerifyHeader(v *service.ResponseVerificationHeader) { } // SetMatchType sets match type of the filter. -func (m *SearchRequest_Body_Filter) SetMatchType(v SearchRequest_Body_Filter_MatchType) { +func (m *SearchRequest_Body_Filter) SetMatchType(v MatchType) { if m != nil { m.MatchType = v } diff --git a/v2/service/grpc/meta.go b/v2/service/grpc/meta.go index c5e9c78..730b437 100644 --- a/v2/service/grpc/meta.go +++ b/v2/service/grpc/meta.go @@ -68,13 +68,6 @@ func (m *SessionToken_Body) SetOwnerId(v *refs.OwnerID) { } } -// SetVerb sets verb of the session token. -func (m *SessionToken_Body) SetVerb(v SessionToken_Body_Verb) { - if m != nil { - m.Verb = v - } -} - // SetLifetime sets lifetime of the session token. func (m *SessionToken_Body) SetLifetime(v *TokenLifetime) { if m != nil { @@ -90,14 +83,28 @@ func (m *SessionToken_Body) SetSessionKey(v []byte) { } // SetObjectAddressContext sets object context of the session token. -func (m *SessionToken_Body) SetObjectAddressContext(v *refs.Address) { +func (m *SessionToken_Body) SetObjectServiceContext(v *ObjectServiceContext) { if m != nil { - m.Context = &SessionToken_Body_ObjectAddress{ - ObjectAddress: v, + m.Context = &SessionToken_Body_ObjectService{ + ObjectService: v, } } } +// SetObjectAddressContext sets object context of the session token. +func (m *ObjectServiceContext) SetAddress(v *refs.Address) { + if m != nil { + m.Address = v + } +} + +// SetObjectAddressContext sets object context of the session token. +func (m *ObjectServiceContext) SetVerb(v ObjectServiceContext_Verb) { + if m != nil { + m.Verb = v + } +} + // SetBody sets session token body. func (m *SessionToken) SetBody(v *SessionToken_Body) { if m != nil { From 304103c6fae61d1a83f22ee80d198039beffcbad Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Mon, 17 Aug 2020 15:05:32 +0300 Subject: [PATCH 0303/1196] Add stable marshal for storage group package Signed-off-by: Alex Vanin --- v2/storagegroup/marshal.go | 83 +++++++++++++++++++++++++++++++++ v2/storagegroup/marshal_test.go | 36 ++++++++++++++ 2 files changed, 119 insertions(+) create mode 100644 v2/storagegroup/marshal.go create mode 100644 v2/storagegroup/marshal_test.go diff --git a/v2/storagegroup/marshal.go b/v2/storagegroup/marshal.go new file mode 100644 index 0000000..6a655a6 --- /dev/null +++ b/v2/storagegroup/marshal.go @@ -0,0 +1,83 @@ +package storagegroup + +import ( + "encoding/binary" + + "github.com/nspcc-dev/neofs-api-go/util/proto" +) + +const ( + SizeField = 1 + HashField = 2 + ExpirationField = 3 + ObjectIDsField = 4 +) + +func (s *StorageGroup) StableMarshal(buf []byte) ([]byte, error) { + if s == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, s.StableSize()) + } + + var ( + offset, n int + prefix uint64 + err error + ) + + n, err = proto.UInt64Marshal(SizeField, buf, s.size) + if err != nil { + return nil, err + } + offset += n + + n, err = proto.BytesMarshal(HashField, buf[offset:], s.hash) + if err != nil { + return nil, err + } + offset += n + + n, err = proto.UInt64Marshal(ExpirationField, buf[offset:], s.exp) + if err != nil { + return nil, err + } + offset += n + + prefix, _ = proto.NestedStructurePrefix(ObjectIDsField) + for i := range s.members { + offset += binary.PutUvarint(buf[offset:], prefix) + + n = s.members[i].StableSize() + offset += binary.PutUvarint(buf[offset:], uint64(n)) + + _, err = s.members[i].StableMarshal(buf[offset:]) + if err != nil { + return nil, err + } + + offset += n + } + + return buf, nil +} + +func (s *StorageGroup) StableSize() (size int) { + if s == nil { + return 0 + } + + size += proto.UInt64Size(SizeField, s.size) + size += proto.BytesSize(HashField, s.hash) + size += proto.UInt64Size(ExpirationField, s.exp) + + _, ln := proto.NestedStructurePrefix(ObjectIDsField) + for i := range s.members { + n := s.members[i].StableSize() + size += ln + proto.VarUIntSize(uint64(n)) + n + } + + return size +} diff --git a/v2/storagegroup/marshal_test.go b/v2/storagegroup/marshal_test.go new file mode 100644 index 0000000..e0db5c5 --- /dev/null +++ b/v2/storagegroup/marshal_test.go @@ -0,0 +1,36 @@ +package storagegroup_test + +import ( + "testing" + + "github.com/nspcc-dev/neofs-api-go/v2/refs" + "github.com/nspcc-dev/neofs-api-go/v2/storagegroup" + grpc "github.com/nspcc-dev/neofs-api-go/v2/storagegroup/grpc" + "github.com/stretchr/testify/require" +) + +func TestStorageGroup_StableMarshal(t *testing.T) { + ownerID1 := new(refs.ObjectID) + ownerID1.SetValue([]byte("Object ID 1")) + ownerID2 := new(refs.ObjectID) + ownerID2.SetValue([]byte("Object ID 2")) + + storageGroupFrom := new(storagegroup.StorageGroup) + transport := new(grpc.StorageGroup) + + t.Run("non empty", func(t *testing.T) { + storageGroupFrom.SetValidationDataSize(300) + storageGroupFrom.SetValidationHash([]byte("Homomorphic hash value")) + storageGroupFrom.SetExpirationEpoch(100) + storageGroupFrom.SetMembers([]*refs.ObjectID{ownerID1, ownerID2}) + + wire, err := storageGroupFrom.StableMarshal(nil) + require.NoError(t, err) + + err = transport.Unmarshal(wire) + require.NoError(t, err) + + storageGroupTo := storagegroup.StorageGroupFromGRPCMessage(transport) + require.Equal(t, storageGroupFrom, storageGroupTo) + }) +} From 1ae7f9b4915299aa6a79b4bd5ec628af0212455d Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Mon, 17 Aug 2020 15:19:36 +0300 Subject: [PATCH 0304/1196] Fix lint warnings in storage group package Signed-off-by: Alex Vanin --- v2/storagegroup/convert.go | 2 ++ v2/storagegroup/marshal.go | 18 +++++++++++++++--- v2/storagegroup/marshal_test.go | 1 + v2/storagegroup/types.go | 12 ++++++++++++ 4 files changed, 30 insertions(+), 3 deletions(-) diff --git a/v2/storagegroup/convert.go b/v2/storagegroup/convert.go index 4e45e34..df545f9 100644 --- a/v2/storagegroup/convert.go +++ b/v2/storagegroup/convert.go @@ -6,6 +6,7 @@ import ( sg "github.com/nspcc-dev/neofs-api-go/v2/storagegroup/grpc" ) +// StorageGroupToGRPCMessage converts unified proto structure into grpc structure. func StorageGroupToGRPCMessage(s *StorageGroup) *sg.StorageGroup { if s == nil { return nil @@ -29,6 +30,7 @@ func StorageGroupToGRPCMessage(s *StorageGroup) *sg.StorageGroup { return m } +// StorageGroupFromGRPCMessage converts grpc structure into unified proto structure. func StorageGroupFromGRPCMessage(m *sg.StorageGroup) *StorageGroup { if m == nil { return nil diff --git a/v2/storagegroup/marshal.go b/v2/storagegroup/marshal.go index 6a655a6..4f30d50 100644 --- a/v2/storagegroup/marshal.go +++ b/v2/storagegroup/marshal.go @@ -7,12 +7,18 @@ import ( ) const ( - SizeField = 1 - HashField = 2 + // SizeField order number from storage group proto definition. + SizeField = 1 + // HashField order number from storage group proto definition. + HashField = 2 + // ExpirationField order number from storage group proto definition. ExpirationField = 3 - ObjectIDsField = 4 + // ObjectIDsField order number from storage group proto definition. + ObjectIDsField = 4 ) +// StableMarshal marshals unified storage group structure in a protobuf +// compatible way without field order shuffle. func (s *StorageGroup) StableMarshal(buf []byte) ([]byte, error) { if s == nil { return []byte{}, nil @@ -32,21 +38,25 @@ func (s *StorageGroup) StableMarshal(buf []byte) ([]byte, error) { if err != nil { return nil, err } + offset += n n, err = proto.BytesMarshal(HashField, buf[offset:], s.hash) if err != nil { return nil, err } + offset += n n, err = proto.UInt64Marshal(ExpirationField, buf[offset:], s.exp) if err != nil { return nil, err } + offset += n prefix, _ = proto.NestedStructurePrefix(ObjectIDsField) + for i := range s.members { offset += binary.PutUvarint(buf[offset:], prefix) @@ -64,6 +74,7 @@ func (s *StorageGroup) StableMarshal(buf []byte) ([]byte, error) { return buf, nil } +// StableSize of storage group structure marshalled by StableMarshal function. func (s *StorageGroup) StableSize() (size int) { if s == nil { return 0 @@ -74,6 +85,7 @@ func (s *StorageGroup) StableSize() (size int) { size += proto.UInt64Size(ExpirationField, s.exp) _, ln := proto.NestedStructurePrefix(ObjectIDsField) + for i := range s.members { n := s.members[i].StableSize() size += ln + proto.VarUIntSize(uint64(n)) + n diff --git a/v2/storagegroup/marshal_test.go b/v2/storagegroup/marshal_test.go index e0db5c5..b79ed80 100644 --- a/v2/storagegroup/marshal_test.go +++ b/v2/storagegroup/marshal_test.go @@ -12,6 +12,7 @@ import ( func TestStorageGroup_StableMarshal(t *testing.T) { ownerID1 := new(refs.ObjectID) ownerID1.SetValue([]byte("Object ID 1")) + ownerID2 := new(refs.ObjectID) ownerID2.SetValue([]byte("Object ID 2")) diff --git a/v2/storagegroup/types.go b/v2/storagegroup/types.go index 38a09f2..720bbe1 100644 --- a/v2/storagegroup/types.go +++ b/v2/storagegroup/types.go @@ -4,6 +4,8 @@ import ( "github.com/nspcc-dev/neofs-api-go/v2/refs" ) +// StorageGroup is a unified structure of StorageGroup +// message from proto definition. type StorageGroup struct { size uint64 @@ -14,6 +16,7 @@ type StorageGroup struct { members []*refs.ObjectID } +// GetValidationDataSize of unified storage group structure. func (s *StorageGroup) GetValidationDataSize() uint64 { if s != nil { return s.size @@ -22,12 +25,14 @@ func (s *StorageGroup) GetValidationDataSize() uint64 { return 0 } +// SetValidationDataSize into unified storage group structure. func (s *StorageGroup) SetValidationDataSize(v uint64) { if s != nil { s.size = v } } +// GetValidationHash of unified storage group structure. func (s *StorageGroup) GetValidationHash() []byte { if s != nil { return s.hash @@ -36,12 +41,14 @@ func (s *StorageGroup) GetValidationHash() []byte { return nil } +// SetValidationHash into unified storage group structure. func (s *StorageGroup) SetValidationHash(v []byte) { if s != nil { s.hash = v } } +// GetExpirationEpoch of unified storage group structure. func (s *StorageGroup) GetExpirationEpoch() uint64 { if s != nil { return s.exp @@ -50,12 +57,15 @@ func (s *StorageGroup) GetExpirationEpoch() uint64 { return 0 } +// SetExpirationEpoch into unified storage group structure. func (s *StorageGroup) SetExpirationEpoch(v uint64) { if s != nil { s.exp = v } } +// GetMembers of unified storage group structure. Members are objects of +// storage group. func (s *StorageGroup) GetMembers() []*refs.ObjectID { if s != nil { return s.members @@ -64,6 +74,8 @@ func (s *StorageGroup) GetMembers() []*refs.ObjectID { return nil } +// SetMembers into unified storage group structure. Members are objects of +// storage group. func (s *StorageGroup) SetMembers(v []*refs.ObjectID) { if s != nil { s.members = v From ddd3ba1bf2ffd015d6b04245d776baea0e45db18 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 17 Aug 2020 14:48:08 +0300 Subject: [PATCH 0305/1196] v2/netmap: Define uni PlacementPolicy type Signed-off-by: Leonard Lyubich --- v2/netmap/convert.go | 23 +++++++++++++++++++++++ v2/netmap/types.go | 5 +++++ 2 files changed, 28 insertions(+) create mode 100644 v2/netmap/convert.go create mode 100644 v2/netmap/types.go diff --git a/v2/netmap/convert.go b/v2/netmap/convert.go new file mode 100644 index 0000000..5d126f8 --- /dev/null +++ b/v2/netmap/convert.go @@ -0,0 +1,23 @@ +package netmap + +import ( + netmap "github.com/nspcc-dev/neofs-api-go/v2/netmap/grpc" +) + +func PlacementPolicyToGRPCMessage(p *PlacementPolicy) *netmap.PlacementPolicy { + if p == nil { + return nil + } + + // TODO: fill me + return nil +} + +func PlacementPolicyFromGRPCMessage(m *netmap.PlacementPolicy) *PlacementPolicy { + if m == nil { + return nil + } + + // TODO: fill me + return nil +} diff --git a/v2/netmap/types.go b/v2/netmap/types.go new file mode 100644 index 0000000..0f295c6 --- /dev/null +++ b/v2/netmap/types.go @@ -0,0 +1,5 @@ +package netmap + +type PlacementPolicy struct { + // TODO: fill me +} From 9f4d24b5921be4bd3eba14b658df0bffe8773601 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 17 Aug 2020 15:02:09 +0300 Subject: [PATCH 0306/1196] v2/container/grpc: Implement needed setters Signed-off-by: Leonard Lyubich --- v2/container/grpc/types.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/v2/container/grpc/types.go b/v2/container/grpc/types.go index 3678b56..5e51e3c 100644 --- a/v2/container/grpc/types.go +++ b/v2/container/grpc/types.go @@ -3,6 +3,7 @@ package container import ( netmap "github.com/nspcc-dev/neofs-api-go/v2/netmap/grpc" refs "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" + service "github.com/nspcc-dev/neofs-api-go/v2/service/grpc" ) // SetKey sets key to the container attribute. @@ -47,9 +48,16 @@ func (m *Container) SetAttributes(v []*Container_Attribute) { } } -// SetRules sets placement rules of the container. -func (m *Container) SetRules(v *netmap.PlacementPolicy) { +// SetPlacementPolicy sets placement policy of the container. +func (m *Container) SetPlacementPolicy(v *netmap.PlacementPolicy) { if m != nil { m.PlacementPolicy = v } } + +// SetVersion sets version of the container. +func (m *Container) SetVersion(v *service.Version) { + if m != nil { + m.Version = v + } +} From ae2e951b77a7919538e58fa998ad875ab67e6bdd Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 17 Aug 2020 15:08:00 +0300 Subject: [PATCH 0307/1196] v2/container: Implement Container uni-structure Signed-off-by: Leonard Lyubich --- v2/container/convert.go | 104 ++++++++++++++++++++++++++++++ v2/container/types.go | 137 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 241 insertions(+) create mode 100644 v2/container/convert.go create mode 100644 v2/container/types.go diff --git a/v2/container/convert.go b/v2/container/convert.go new file mode 100644 index 0000000..0ca1118 --- /dev/null +++ b/v2/container/convert.go @@ -0,0 +1,104 @@ +package container + +import ( + container "github.com/nspcc-dev/neofs-api-go/v2/container/grpc" + "github.com/nspcc-dev/neofs-api-go/v2/netmap" + "github.com/nspcc-dev/neofs-api-go/v2/refs" + "github.com/nspcc-dev/neofs-api-go/v2/service" +) + +func AttributeToGRPCMessage(a *Attribute) *container.Container_Attribute { + if a == nil { + return nil + } + + m := new(container.Container_Attribute) + + m.SetKey(a.GetKey()) + m.SetValue(a.GetValue()) + + return m +} + +func AttributeFromGRPCMessage(m *container.Container_Attribute) *Attribute { + if m == nil { + return nil + } + + a := new(Attribute) + + a.SetKey(m.GetKey()) + a.SetValue(m.GetValue()) + + return a +} + +func ContainerToGRPCMessage(c *Container) *container.Container { + if c == nil { + return nil + } + + m := new(container.Container) + + m.SetVersion( + service.VersionToGRPCMessage(c.GetVersion()), + ) + + m.SetOwnerId( + refs.OwnerIDToGRPCMessage(c.GetOwnerID()), + ) + + m.SetNonce(c.GetNonce()) + + m.SetBasicAcl(c.GetBasicACL()) + + m.SetPlacementPolicy( + netmap.PlacementPolicyToGRPCMessage(c.GetPlacementPolicy()), + ) + + attr := c.GetAttributes() + attrMsg := make([]*container.Container_Attribute, 0, len(attr)) + + for i := range attr { + attrMsg = append(attrMsg, AttributeToGRPCMessage(attr[i])) + } + + m.SetAttributes(attrMsg) + + return m +} + +func ContainerFromGRPCMessage(m *container.Container) *Container { + if m == nil { + return nil + } + + c := new(Container) + + c.SetVersion( + service.VersionFromGRPCMessage(m.GetVersion()), + ) + + c.SetOwnerID( + refs.OwnerIDFromGRPCMessage(m.GetOwnerId()), + ) + + c.SetNonce(m.GetNonce()) + + c.SetBasicACL(m.GetBasicAcl()) + + c.SetPlacementPolicy( + netmap.PlacementPolicyFromGRPCMessage(m.GetPlacementPolicy()), + ) + + attrMsg := m.GetAttributes() + attr := make([]*Attribute, 0, len(attrMsg)) + + for i := range attrMsg { + attr = append(attr, AttributeFromGRPCMessage(attrMsg[i])) + } + + c.SetAttributes(attr) + + return c +} diff --git a/v2/container/types.go b/v2/container/types.go new file mode 100644 index 0000000..bfb7530 --- /dev/null +++ b/v2/container/types.go @@ -0,0 +1,137 @@ +package container + +import ( + "github.com/nspcc-dev/neofs-api-go/v2/netmap" + "github.com/nspcc-dev/neofs-api-go/v2/refs" + "github.com/nspcc-dev/neofs-api-go/v2/service" +) + +type Attribute struct { + key, val string +} + +type Container struct { + version *service.Version + + ownerID *refs.OwnerID + + nonce []byte + + basicACL uint32 + + attr []*Attribute + + policy *netmap.PlacementPolicy +} + +func (a *Attribute) GetKey() string { + if a != nil { + return a.key + } + + return "" +} + +func (a *Attribute) SetKey(v string) { + if a != nil { + a.key = v + } +} + +func (a *Attribute) GetValue() string { + if a != nil { + return a.val + } + + return "" +} + +func (a *Attribute) SetValue(v string) { + if a != nil { + a.val = v + } +} + +func (c *Container) GetVersion() *service.Version { + if c != nil { + return c.version + } + + return nil +} + +func (c *Container) SetVersion(v *service.Version) { + if c != nil { + c.version = v + } +} + +func (c *Container) GetOwnerID() *refs.OwnerID { + if c != nil { + return c.ownerID + } + + return nil +} + +func (c *Container) SetOwnerID(v *refs.OwnerID) { + if c != nil { + c.ownerID = v + } +} + +func (c *Container) GetNonce() []byte { + if c != nil { + return c.nonce + } + + return nil +} + +func (c *Container) SetNonce(v []byte) { + if c != nil { + c.nonce = v + } +} + +func (c *Container) GetBasicACL() uint32 { + if c != nil { + return c.basicACL + } + + return 0 +} + +func (c *Container) SetBasicACL(v uint32) { + if c != nil { + c.basicACL = v + } +} + +func (c *Container) GetAttributes() []*Attribute { + if c != nil { + return c.attr + } + + return nil +} + +func (c *Container) SetAttributes(v []*Attribute) { + if c != nil { + c.attr = v + } +} + +func (c *Container) GetPlacementPolicy() *netmap.PlacementPolicy { + if c != nil { + return c.policy + } + + return nil +} + +func (c *Container) SetPlacementPolicy(v *netmap.PlacementPolicy) { + if c != nil { + c.policy = v + } +} From 57dcf01f6b5ff1a7deaac616750ebc825ba52af8 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 17 Aug 2020 16:14:30 +0300 Subject: [PATCH 0308/1196] v2/service: Fill SessionToken uni-structure Signed-off-by: Leonard Lyubich --- v2/service/convert.go | 178 +++++++++++++++++++++++++++++++++++++++++- v2/service/service.go | 167 ++++++++++++++++++++++++++++++++++++++- 2 files changed, 340 insertions(+), 5 deletions(-) diff --git a/v2/service/convert.go b/v2/service/convert.go index e5786ed..91b173b 100644 --- a/v2/service/convert.go +++ b/v2/service/convert.go @@ -1,6 +1,8 @@ package service import ( + "fmt" + "github.com/nspcc-dev/neofs-api-go/v2/acl" "github.com/nspcc-dev/neofs-api-go/v2/refs" service "github.com/nspcc-dev/neofs-api-go/v2/service/grpc" @@ -59,13 +61,39 @@ func XHeaderFromGRPCMessage(m *service.XHeader) *XHeader { } func SessionTokenToGRPCMessage(t *SessionToken) *service.SessionToken { - // TODO: fill me - return nil + if t == nil { + return nil + } + + m := new(service.SessionToken) + + m.SetBody( + SessionTokenBodyToGRPCMessage(t.GetBody()), + ) + + m.SetSignature( + SignatureToGRPCMessage(t.GetSignature()), + ) + + return m } func SessionTokenFromGRPCMessage(m *service.SessionToken) *SessionToken { - // TODO: fill me - return nil + if m == nil { + return nil + } + + t := new(SessionToken) + + t.SetBody( + SessionTokenBodyFromGRPCMessage(m.GetBody()), + ) + + t.SetSignature( + SignatureFromGRPCMessage(m.GetSignature()), + ) + + return t } func BearerTokenToGRPCMessage(t *BearerToken) *service.BearerToken { @@ -509,3 +537,145 @@ func ResponseHeadersFromGRPC( ResponseVerificationHeaderFromGRPCMessage(src.GetVerifyHeader()), ) } + +func ObjectSessionVerbToGRPCField(v ObjectSessionVerb) service.ObjectServiceContext_Verb { + switch v { + case ObjectVerbPut: + return service.ObjectServiceContext_PUT + case ObjectVerbGet: + return service.ObjectServiceContext_GET + case ObjectVerbHead: + return service.ObjectServiceContext_HEAD + case ObjectVerbSearch: + return service.ObjectServiceContext_SEARCH + case ObjectVerbDelete: + return service.ObjectServiceContext_DELETE + case ObjectVerbRange: + return service.ObjectServiceContext_RANGE + case ObjectVerbRangeHash: + return service.ObjectServiceContext_RANGEHASH + default: + return service.ObjectServiceContext_VERB_UNSPECIFIED + } +} + +func ObjectSessionVerbFromGRPCField(v service.ObjectServiceContext_Verb) ObjectSessionVerb { + switch v { + case service.ObjectServiceContext_PUT: + return ObjectVerbPut + case service.ObjectServiceContext_GET: + return ObjectVerbGet + case service.ObjectServiceContext_HEAD: + return ObjectVerbHead + case service.ObjectServiceContext_SEARCH: + return ObjectVerbSearch + case service.ObjectServiceContext_DELETE: + return ObjectVerbDelete + case service.ObjectServiceContext_RANGE: + return ObjectVerbRange + case service.ObjectServiceContext_RANGEHASH: + return ObjectVerbRangeHash + default: + return ObjectVerbUnknown + } +} + +func ObjectSessionContextToGRPCMessage(c *ObjectSessionContext) *service.ObjectServiceContext { + if c == nil { + return nil + } + + m := new(service.ObjectServiceContext) + + m.SetVerb( + ObjectSessionVerbToGRPCField(c.GetVerb()), + ) + + m.SetAddress( + refs.AddressToGRPCMessage(c.GetAddress()), + ) + + return m +} + +func ObjectSessionContextFromGRPCMessage(m *service.ObjectServiceContext) *ObjectSessionContext { + if m == nil { + return nil + } + + c := new(ObjectSessionContext) + + c.SetVerb( + ObjectSessionVerbFromGRPCField(m.GetVerb()), + ) + + c.SetAddress( + refs.AddressFromGRPCMessage(m.GetAddress()), + ) + + return c +} + +func SessionTokenBodyToGRPCMessage(t *SessionTokenBody) *service.SessionToken_Body { + if t == nil { + return nil + } + + m := new(service.SessionToken_Body) + + switch v := t.GetContext(); t := v.(type) { + case nil: + case *ObjectSessionContext: + m.SetObjectServiceContext( + ObjectSessionContextToGRPCMessage(t), + ) + default: + panic(fmt.Sprintf("unknown session context %T", t)) + } + + m.SetId(t.GetID()) + + m.SetOwnerId( + refs.OwnerIDToGRPCMessage(t.GetOwnerID()), + ) + + m.SetLifetime( + TokenLifetimeToGRPCMessage(t.GetLifetime()), + ) + + m.SetSessionKey(t.GetSessionKey()) + + return m +} + +func SessionTokenBodyFromGRPCMessage(m *service.SessionToken_Body) *SessionTokenBody { + if m == nil { + return nil + } + + t := new(SessionTokenBody) + + switch v := m.GetContext().(type) { + case nil: + case *service.SessionToken_Body_ObjectService: + t.SetContext( + ObjectSessionContextFromGRPCMessage(v.ObjectService), + ) + default: + panic(fmt.Sprintf("unknown session context %T", v)) + } + + t.SetID(m.GetId()) + + t.SetOwnerID( + refs.OwnerIDFromGRPCMessage(m.GetOwnerId()), + ) + + t.SetLifetime( + TokenLifetimeFromGRPCMessage(m.GetLifetime()), + ) + + t.SetSessionKey(m.GetSessionKey()) + + return t +} diff --git a/v2/service/service.go b/v2/service/service.go index 89df919..61e33cb 100644 --- a/v2/service/service.go +++ b/v2/service/service.go @@ -21,8 +21,34 @@ type TokenLifetime struct { exp, nbf, iat uint64 } +type ObjectSessionVerb uint32 + +type ObjectSessionContext struct { + verb ObjectSessionVerb + + addr *refs.Address +} + +type SessionTokenContext interface { + sessionTokenContext() +} + +type SessionTokenBody struct { + id []byte + + ownerID *refs.OwnerID + + lifetime *TokenLifetime + + sessionKey []byte + + ctx SessionTokenContext +} + type SessionToken struct { - // TODO: fill me + body *SessionTokenBody + + sig *Signature } type BearerTokenBody struct { @@ -79,6 +105,17 @@ type ResponseMetaHeader struct { origin *ResponseMetaHeader } +const ( + ObjectVerbUnknown ObjectSessionVerb = iota + ObjectVerbPut + ObjectVerbGet + ObjectVerbHead + ObjectVerbSearch + ObjectVerbDelete + ObjectVerbRange + ObjectVerbRangeHash +) + func (s *Signature) GetKey() []byte { if s != nil { return s.key @@ -586,3 +623,131 @@ func (r *ResponseMetaHeader) SetOrigin(v *ResponseMetaHeader) { r.origin = v } } + +func (c *ObjectSessionContext) sessionTokenContext() {} + +func (c *ObjectSessionContext) GetVerb() ObjectSessionVerb { + if c != nil { + return c.verb + } + + return ObjectVerbUnknown +} + +func (c *ObjectSessionContext) SetVerb(v ObjectSessionVerb) { + if c != nil { + c.verb = v + } +} + +func (c *ObjectSessionContext) GetAddress() *refs.Address { + if c != nil { + return c.addr + } + + return nil +} + +func (c *ObjectSessionContext) SetAddress(v *refs.Address) { + if c != nil { + c.addr = v + } +} + +func (t *SessionTokenBody) GetID() []byte { + if t != nil { + return t.id + } + + return nil +} + +func (t *SessionTokenBody) SetID(v []byte) { + if t != nil { + t.id = v + } +} + +func (t *SessionTokenBody) GetOwnerID() *refs.OwnerID { + if t != nil { + return t.ownerID + } + + return nil +} + +func (t *SessionTokenBody) SetOwnerID(v *refs.OwnerID) { + if t != nil { + t.ownerID = v + } +} + +func (t *SessionTokenBody) GetLifetime() *TokenLifetime { + if t != nil { + return t.lifetime + } + + return nil +} + +func (t *SessionTokenBody) SetLifetime(v *TokenLifetime) { + if t != nil { + t.lifetime = v + } +} + +func (t *SessionTokenBody) GetSessionKey() []byte { + if t != nil { + return t.sessionKey + } + + return nil +} + +func (t *SessionTokenBody) SetSessionKey(v []byte) { + if t != nil { + t.sessionKey = v + } +} + +func (t *SessionTokenBody) GetContext() SessionTokenContext { + if t != nil { + return t.ctx + } + + return nil +} + +func (t *SessionTokenBody) SetContext(v SessionTokenContext) { + if t != nil { + t.ctx = v + } +} + +func (t *SessionToken) GetBody() *SessionTokenBody { + if t != nil { + return t.body + } + + return nil +} + +func (t *SessionToken) SetBody(v *SessionTokenBody) { + if t != nil { + t.body = v + } +} + +func (t *SessionToken) GetSignature() *Signature { + if t != nil { + return t.sig + } + + return nil +} + +func (t *SessionToken) SetSignature(v *Signature) { + if t != nil { + t.sig = v + } +} From e5faf622dff0aa1fb8d71cd0ed390d42ad9d5b4c Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 17 Aug 2020 17:01:53 +0300 Subject: [PATCH 0309/1196] v2/session: Implement session uni-structures Signed-off-by: Leonard Lyubich --- v2/session/convert.go | 133 ++++++++++++++++++++++++++++++++ v2/session/types.go | 174 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 307 insertions(+) create mode 100644 v2/session/convert.go create mode 100644 v2/session/types.go diff --git a/v2/session/convert.go b/v2/session/convert.go new file mode 100644 index 0000000..5d5a60e --- /dev/null +++ b/v2/session/convert.go @@ -0,0 +1,133 @@ +package session + +import ( + "github.com/nspcc-dev/neofs-api-go/v2/refs" + "github.com/nspcc-dev/neofs-api-go/v2/service" + session "github.com/nspcc-dev/neofs-api-go/v2/session/grpc" +) + +func CreateRequestBodyToGRPCMessage(c *CreateRequestBody) *session.CreateRequest_Body { + if c == nil { + return nil + } + + m := new(session.CreateRequest_Body) + + m.SetOwnerId( + refs.OwnerIDToGRPCMessage(c.GetOwnerID()), + ) + + m.SetLifetime( + service.TokenLifetimeToGRPCMessage(c.GetLifetime()), + ) + + return m +} + +func CreateRequestBodyFromGRPCMessage(m *session.CreateRequest_Body) *CreateRequestBody { + if m == nil { + return nil + } + + c := new(CreateRequestBody) + + c.SetOwnerID( + refs.OwnerIDFromGRPCMessage(m.GetOwnerId()), + ) + + c.SetLifetime( + service.TokenLifetimeFromGRPCMessage(m.GetLifetime()), + ) + + return c +} + +func CreateRequestToGRPCMessage(c *CreateRequest) *session.CreateRequest { + if c == nil { + return nil + } + + m := new(session.CreateRequest) + + m.SetBody( + CreateRequestBodyToGRPCMessage(c.GetBody()), + ) + + service.RequestHeadersToGRPC(c, m) + + return m +} + +func CreateRequestFromGRPCMessage(m *session.CreateRequest) *CreateRequest { + if m == nil { + return nil + } + + c := new(CreateRequest) + + c.SetBody( + CreateRequestBodyFromGRPCMessage(m.GetBody()), + ) + + service.RequestHeadersFromGRPC(m, c) + + return c +} + +func CreateResponseBodyToGRPCMessage(c *CreateResponseBody) *session.CreateResponse_Body { + if c == nil { + return nil + } + + m := new(session.CreateResponse_Body) + + m.SetId(c.GetID()) + m.SetSessionKey(c.GetSessionKey()) + + return m +} + +func CreateResponseBodyFromGRPCMessage(m *session.CreateResponse_Body) *CreateResponseBody { + if m == nil { + return nil + } + + c := new(CreateResponseBody) + + c.SetID(m.GetId()) + c.SetSessionKey(m.GetSessionKey()) + + return c +} + +func CreateResponseToGRPCMessage(c *CreateResponse) *session.CreateResponse { + if c == nil { + return nil + } + + m := new(session.CreateResponse) + + m.SetBody( + CreateResponseBodyToGRPCMessage(c.GetBody()), + ) + + service.ResponseHeadersToGRPC(c, m) + + return m +} + +func CreateResponseFromGRPCMessage(m *session.CreateResponse) *CreateResponse { + if m == nil { + return nil + } + + c := new(CreateResponse) + + c.SetBody( + CreateResponseBodyFromGRPCMessage(m.GetBody()), + ) + + service.ResponseHeadersFromGRPC(m, c) + + return c +} diff --git a/v2/session/types.go b/v2/session/types.go new file mode 100644 index 0000000..77729ce --- /dev/null +++ b/v2/session/types.go @@ -0,0 +1,174 @@ +package session + +import ( + "github.com/nspcc-dev/neofs-api-go/v2/refs" + "github.com/nspcc-dev/neofs-api-go/v2/service" +) + +type CreateRequestBody struct { + ownerID *refs.OwnerID + + lifetime *service.TokenLifetime +} + +type CreateRequest struct { + body *CreateRequestBody + + metaHeader *service.RequestMetaHeader + + verifyHeader *service.RequestVerificationHeader +} + +type CreateResponseBody struct { + id []byte + + sessionKey []byte +} + +type CreateResponse struct { + body *CreateResponseBody + + metaHeader *service.ResponseMetaHeader + + verifyHeader *service.ResponseVerificationHeader +} + +func (c *CreateRequestBody) GetOwnerID() *refs.OwnerID { + if c != nil { + return c.ownerID + } + + return nil +} + +func (c *CreateRequestBody) SetOwnerID(v *refs.OwnerID) { + if c != nil { + c.ownerID = v + } +} + +func (c *CreateRequestBody) GetLifetime() *service.TokenLifetime { + if c != nil { + return c.lifetime + } + + return nil +} + +func (c *CreateRequestBody) SetLifetime(v *service.TokenLifetime) { + if c != nil { + c.lifetime = v + } +} + +func (c *CreateRequest) GetBody() *CreateRequestBody { + if c != nil { + return c.body + } + + return nil +} + +func (c *CreateRequest) SetBody(v *CreateRequestBody) { + if c != nil { + c.body = v + } +} + +func (c *CreateRequest) GetMetaHeader() *service.RequestMetaHeader { + if c != nil { + return c.metaHeader + } + + return nil +} + +func (c *CreateRequest) SetMetaHeader(v *service.RequestMetaHeader) { + if c != nil { + c.metaHeader = v + } +} + +func (c *CreateRequest) GetVerificationHeader() *service.RequestVerificationHeader { + if c != nil { + return c.verifyHeader + } + + return nil +} + +func (c *CreateRequest) SetVerificationHeader(v *service.RequestVerificationHeader) { + if c != nil { + c.verifyHeader = v + } +} + +func (c *CreateResponseBody) GetID() []byte { + if c != nil { + return c.id + } + + return nil +} + +func (c *CreateResponseBody) SetID(v []byte) { + if c != nil { + c.id = v + } +} + +func (c *CreateResponseBody) GetSessionKey() []byte { + if c != nil { + return c.sessionKey + } + + return nil +} + +func (c *CreateResponseBody) SetSessionKey(v []byte) { + if c != nil { + c.sessionKey = v + } +} + +func (c *CreateResponse) GetBody() *CreateResponseBody { + if c != nil { + return c.body + } + + return nil +} + +func (c *CreateResponse) SetBody(v *CreateResponseBody) { + if c != nil { + c.body = v + } +} + +func (c *CreateResponse) GetMetaHeader() *service.ResponseMetaHeader { + if c != nil { + return c.metaHeader + } + + return nil +} + +func (c *CreateResponse) SetMetaHeader(v *service.ResponseMetaHeader) { + if c != nil { + c.metaHeader = v + } +} + +func (c *CreateResponse) GetVerificationHeader() *service.ResponseVerificationHeader { + if c != nil { + return c.verifyHeader + } + + return nil +} + +func (c *CreateResponse) SetVerificationHeader(v *service.ResponseVerificationHeader) { + if c != nil { + c.verifyHeader = v + } +} From 5623ce0124b53eacef5c1d978580973009c55925 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Mon, 17 Aug 2020 16:02:24 +0300 Subject: [PATCH 0310/1196] Add stable marshal of header filter in acl package Signed-off-by: Alex Vanin --- v2/acl/marshal.go | 92 ++++++++++++++++++++++++++++++++++++++++++ v2/acl/marshal_test.go | 30 ++++++++++++++ 2 files changed, 122 insertions(+) create mode 100644 v2/acl/marshal.go create mode 100644 v2/acl/marshal_test.go diff --git a/v2/acl/marshal.go b/v2/acl/marshal.go new file mode 100644 index 0000000..8397696 --- /dev/null +++ b/v2/acl/marshal.go @@ -0,0 +1,92 @@ +package acl + +import ( + "github.com/nspcc-dev/neofs-api-go/util/proto" +) + +const ( + FilterHeaderTypeField = 1 + FilterMatchTypeField = 2 + FilterNameField = 3 + FilterValueField = 4 +) + +func (t *Table) StableMarshal(buf []byte) ([]byte, error) { + panic("not implemented") +} + +func (t *Table) StableSize() int { + panic("not implemented") +} + +func (r *Record) StableMarshal(buf []byte) ([]byte, error) { + panic("not implemented") +} + +func (r *Record) StableSize() int { + panic("not implemented") +} + +func (f *HeaderFilter) StableMarshal(buf []byte) ([]byte, error) { + if f == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, f.StableSize()) + } + + var ( + offset, n int + err error + ) + + n, err = proto.EnumMarshal(FilterHeaderTypeField, buf, int32(f.hdrType)) + if err != nil { + return nil, err + } + + offset += n + + n, err = proto.EnumMarshal(FilterMatchTypeField, buf[offset:], int32(f.matchType)) + if err != nil { + return nil, err + } + + offset += n + + n, err = proto.StringMarshal(FilterNameField, buf[offset:], f.name) + if err != nil { + return nil, err + } + + offset += n + + n, err = proto.StringMarshal(FilterValueField, buf[offset:], f.value) + if err != nil { + return nil, err + } + + return buf, nil +} + +func (f *HeaderFilter) StableSize() (size int) { + if f == nil { + return 0 + } + + size += proto.EnumSize(FilterHeaderTypeField, int32(f.hdrType)) + size += proto.EnumSize(FilterMatchTypeField, int32(f.matchType)) + size += proto.StringSize(FilterNameField, f.name) + size += proto.StringSize(FilterValueField, f.value) + + return size +} + +func (t *HeaderType) StableMarshal(buf []byte) ([]byte, error) { + panic("not implemented") +} + +func (t *HeaderType) StableSize() int { + panic("not implemented") +} diff --git a/v2/acl/marshal_test.go b/v2/acl/marshal_test.go new file mode 100644 index 0000000..63f5bcf --- /dev/null +++ b/v2/acl/marshal_test.go @@ -0,0 +1,30 @@ +package acl_test + +import ( + "testing" + + "github.com/nspcc-dev/neofs-api-go/v2/acl" + grpc "github.com/nspcc-dev/neofs-api-go/v2/acl/grpc" + "github.com/stretchr/testify/require" +) + +func TestHeaderFilter_StableMarshal(t *testing.T) { + filterFrom := new(acl.HeaderFilter) + transport := new(grpc.EACLRecord_FilterInfo) + + t.Run("non empty", func(t *testing.T) { + filterFrom.SetHeaderType(acl.HeaderTypeObject) + filterFrom.SetMatchType(acl.MatchTypeStringEqual) + filterFrom.SetName("Hello") + filterFrom.SetValue("World") + + wire, err := filterFrom.StableMarshal(nil) + require.NoError(t, err) + + err = transport.Unmarshal(wire) + require.NoError(t, err) + + filterTo := acl.HeaderFilterFromGRPCMessage(transport) + require.Equal(t, filterFrom, filterTo) + }) +} From 5880875bd97f003e628412e8324cfd96d6df0bef Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Mon, 17 Aug 2020 16:09:09 +0300 Subject: [PATCH 0311/1196] Add stable marshal of target info in acl package Signed-off-by: Alex Vanin --- v2/acl/marshal.go | 43 ++++++++++++++++++++++++++++++++++++++---- v2/acl/marshal_test.go | 22 +++++++++++++++++++++ 2 files changed, 61 insertions(+), 4 deletions(-) diff --git a/v2/acl/marshal.go b/v2/acl/marshal.go index 8397696..d680b9c 100644 --- a/v2/acl/marshal.go +++ b/v2/acl/marshal.go @@ -9,6 +9,9 @@ const ( FilterMatchTypeField = 2 FilterNameField = 3 FilterValueField = 4 + + TargetTypeField = 1 + TargetKeysField = 2 ) func (t *Table) StableMarshal(buf []byte) ([]byte, error) { @@ -83,10 +86,42 @@ func (f *HeaderFilter) StableSize() (size int) { return size } -func (t *HeaderType) StableMarshal(buf []byte) ([]byte, error) { - panic("not implemented") +func (t *TargetInfo) StableMarshal(buf []byte) ([]byte, error) { + if t == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, t.StableSize()) + } + + var ( + offset, n int + err error + ) + + n, err = proto.EnumMarshal(TargetTypeField, buf, int32(t.target)) + if err != nil { + return nil, err + } + + offset += n + + n, err = proto.RepeatedBytesMarshal(TargetKeysField, buf[offset:], t.keys) + if err != nil { + return nil, err + } + + return buf, nil } -func (t *HeaderType) StableSize() int { - panic("not implemented") +func (t *TargetInfo) StableSize() (size int) { + if t == nil { + return 0 + } + + size += proto.EnumSize(TargetTypeField, int32(t.target)) + size += proto.RepeatedBytesSize(TargetKeysField, t.keys) + + return size } diff --git a/v2/acl/marshal_test.go b/v2/acl/marshal_test.go index 63f5bcf..c040d26 100644 --- a/v2/acl/marshal_test.go +++ b/v2/acl/marshal_test.go @@ -28,3 +28,25 @@ func TestHeaderFilter_StableMarshal(t *testing.T) { require.Equal(t, filterFrom, filterTo) }) } + +func TestTargetInfo_StableMarshal(t *testing.T) { + targetFrom := new(acl.TargetInfo) + transport := new(grpc.EACLRecord_TargetInfo) + + t.Run("non empty", func(t *testing.T) { + targetFrom.SetTarget(acl.TargetUser) + targetFrom.SetKeyList([][]byte{ + []byte("Public Key 1"), + []byte("Public Key 2"), + }) + + wire, err := targetFrom.StableMarshal(nil) + require.NoError(t, err) + + err = transport.Unmarshal(wire) + require.NoError(t, err) + + targetTo := acl.TargetInfoFromGRPCMessage(transport) + require.Equal(t, targetFrom, targetTo) + }) +} From 64b456996e489e0cab994c4624df1c397314a15f Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Mon, 17 Aug 2020 16:32:46 +0300 Subject: [PATCH 0312/1196] Sync acl enums with proto definition Signed-off-by: Alex Vanin --- v2/acl/types.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/v2/acl/types.go b/v2/acl/types.go index e39eecc..b73eea1 100644 --- a/v2/acl/types.go +++ b/v2/acl/types.go @@ -56,15 +56,15 @@ const ( const ( ActionUnknown Action = iota - ActionDeny ActionAllow + ActionDeny ) const ( OperationUnknown Operation = iota OperationGet - OperationPut OperationHead + OperationPut OperationDelete OperationSearch OperationRange From 6e42ba8d226e5b64b6594d1da9ce7dd352dfe38a Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Mon, 17 Aug 2020 16:49:19 +0300 Subject: [PATCH 0313/1196] Add stable marshal of acl record Signed-off-by: Alex Vanin --- v2/acl/marshal.go | 94 ++++++++++++++++++++++++++++++++++++++++-- v2/acl/marshal_test.go | 74 ++++++++++++++++++++++++++++++++- 2 files changed, 163 insertions(+), 5 deletions(-) diff --git a/v2/acl/marshal.go b/v2/acl/marshal.go index d680b9c..b1b6dcb 100644 --- a/v2/acl/marshal.go +++ b/v2/acl/marshal.go @@ -1,6 +1,8 @@ package acl import ( + "encoding/binary" + "github.com/nspcc-dev/neofs-api-go/util/proto" ) @@ -12,6 +14,11 @@ const ( TargetTypeField = 1 TargetKeysField = 2 + + RecordOperationField = 1 + RecordActionField = 2 + RecordFiltersField = 3 + RecordTargetsField = 4 ) func (t *Table) StableMarshal(buf []byte) ([]byte, error) { @@ -23,11 +30,92 @@ func (t *Table) StableSize() int { } func (r *Record) StableMarshal(buf []byte) ([]byte, error) { - panic("not implemented") + if r == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, r.StableSize()) + } + + var ( + offset, n int + prefix uint64 + err error + ) + + n, err = proto.EnumMarshal(RecordOperationField, buf, int32(r.op)) + if err != nil { + return nil, err + } + + offset += n + + n, err = proto.EnumMarshal(RecordActionField, buf[offset:], int32(r.action)) + if err != nil { + return nil, err + } + + offset += n + + prefix, _ = proto.NestedStructurePrefix(RecordFiltersField) + + for i := range r.filters { + offset += binary.PutUvarint(buf[offset:], prefix) + + n = r.filters[i].StableSize() + offset += binary.PutUvarint(buf[offset:], uint64(n)) + + _, err = r.filters[i].StableMarshal(buf[offset:]) + if err != nil { + return nil, err + } + + offset += n + } + + prefix, _ = proto.NestedStructurePrefix(RecordTargetsField) + + for i := range r.targets { + offset += binary.PutUvarint(buf[offset:], prefix) + + n = r.targets[i].StableSize() + offset += binary.PutUvarint(buf[offset:], uint64(n)) + + _, err = r.targets[i].StableMarshal(buf[offset:]) + if err != nil { + return nil, err + } + + offset += n + } + + return buf, nil } -func (r *Record) StableSize() int { - panic("not implemented") +func (r *Record) StableSize() (size int) { + if r == nil { + return 0 + } + + size += proto.EnumSize(RecordOperationField, int32(r.op)) + size += proto.EnumSize(RecordActionField, int32(r.op)) + + _, ln := proto.NestedStructurePrefix(RecordFiltersField) + + for i := range r.filters { + n := r.filters[i].StableSize() + size += ln + proto.VarUIntSize(uint64(n)) + n + } + + _, ln = proto.NestedStructurePrefix(RecordTargetsField) + + for i := range r.targets { + n := r.targets[i].StableSize() + size += ln + proto.VarUIntSize(uint64(n)) + n + } + + return size } func (f *HeaderFilter) StableMarshal(buf []byte) ([]byte, error) { diff --git a/v2/acl/marshal_test.go b/v2/acl/marshal_test.go index c040d26..eea5d04 100644 --- a/v2/acl/marshal_test.go +++ b/v2/acl/marshal_test.go @@ -1,6 +1,7 @@ package acl_test import ( + "fmt" "testing" "github.com/nspcc-dev/neofs-api-go/v2/acl" @@ -8,8 +9,61 @@ import ( "github.com/stretchr/testify/require" ) +func generateTarget(u acl.Target, k int) *acl.TargetInfo { + target := new(acl.TargetInfo) + target.SetTarget(u) + + keys := make([][]byte, k) + for i := 0; i < k; i++ { + s := fmt.Sprintf("Public Key %d", i+1) + keys[i] = []byte(s) + } + + return target +} + +func generateFilter(t acl.HeaderType, m acl.MatchType, k, v string) *acl.HeaderFilter { + filter := new(acl.HeaderFilter) + filter.SetHeaderType(t) + filter.SetMatchType(m) + filter.SetName(k) + filter.SetValue(v) + + return filter +} + +func generateRecord(another bool) *acl.Record { + var record = new(acl.Record) + switch another { + case true: + t1 := generateTarget(acl.TargetUser, 2) + f1 := generateFilter(acl.HeaderTypeObject, acl.MatchTypeStringEqual, + "OID", "ObjectID Value") + + record.SetOperation(acl.OperationHead) + record.SetAction(acl.ActionDeny) + record.SetTargets([]*acl.TargetInfo{t1}) + record.SetFilters([]*acl.HeaderFilter{f1}) + default: + t1 := generateTarget(acl.TargetUser, 2) + t2 := generateTarget(acl.TargetSystem, 0) + f1 := generateFilter(acl.HeaderTypeObject, acl.MatchTypeStringEqual, + "CID", "Container ID Value") + f2 := generateFilter(acl.HeaderTypeRequest, acl.MatchTypeStringEqual, + "X-Header-Key", "X-Header-Value") + + record.SetOperation(acl.OperationPut) + record.SetAction(acl.ActionAllow) + record.SetTargets([]*acl.TargetInfo{t1, t2}) + record.SetFilters([]*acl.HeaderFilter{f1, f2}) + } + + return record +} + func TestHeaderFilter_StableMarshal(t *testing.T) { - filterFrom := new(acl.HeaderFilter) + filterFrom := generateFilter(acl.HeaderTypeObject, acl.MatchTypeStringEqual, + "CID", "Container ID Value") transport := new(grpc.EACLRecord_FilterInfo) t.Run("non empty", func(t *testing.T) { @@ -30,7 +84,7 @@ func TestHeaderFilter_StableMarshal(t *testing.T) { } func TestTargetInfo_StableMarshal(t *testing.T) { - targetFrom := new(acl.TargetInfo) + targetFrom := generateTarget(acl.TargetUser, 2) transport := new(grpc.EACLRecord_TargetInfo) t.Run("non empty", func(t *testing.T) { @@ -50,3 +104,19 @@ func TestTargetInfo_StableMarshal(t *testing.T) { require.Equal(t, targetFrom, targetTo) }) } + +func TestRecord_StableMarshal(t *testing.T) { + recordFrom := generateRecord(false) + transport := new(grpc.EACLRecord) + + t.Run("non empty", func(t *testing.T) { + wire, err := recordFrom.StableMarshal(nil) + require.NoError(t, err) + + err = transport.Unmarshal(wire) + require.NoError(t, err) + + recordTo := acl.RecordFromGRPCMessage(transport) + require.Equal(t, recordFrom, recordTo) + }) +} From ddbeaa93b34524891bb709de2a32a37d5cf60564 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Mon, 17 Aug 2020 16:57:51 +0300 Subject: [PATCH 0314/1196] Add stable marshal of acl table Signed-off-by: Alex Vanin --- v2/acl/marshal.go | 131 ++++++++++++++++++++++++++++++----------- v2/acl/marshal_test.go | 26 ++++++++ 2 files changed, 124 insertions(+), 33 deletions(-) diff --git a/v2/acl/marshal.go b/v2/acl/marshal.go index b1b6dcb..e4cb2e9 100644 --- a/v2/acl/marshal.go +++ b/v2/acl/marshal.go @@ -7,26 +7,91 @@ import ( ) const ( - FilterHeaderTypeField = 1 - FilterMatchTypeField = 2 - FilterNameField = 3 - FilterValueField = 4 + filterHeaderTypeField = 1 + filterMatchTypeField = 2 + filterNameField = 3 + filterValueField = 4 - TargetTypeField = 1 - TargetKeysField = 2 + targetTypeField = 1 + targetKeysField = 2 - RecordOperationField = 1 - RecordActionField = 2 - RecordFiltersField = 3 - RecordTargetsField = 4 + recordOperationField = 1 + recordActionField = 2 + recordFiltersField = 3 + recordTargetsField = 4 + + tableContainerIDField = 1 + tableRecordsField = 2 ) func (t *Table) StableMarshal(buf []byte) ([]byte, error) { - panic("not implemented") + if t == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, t.StableSize()) + } + + var ( + offset, n int + prefix uint64 + err error + ) + + if t.cid != nil { + prefix, _ = proto.NestedStructurePrefix(tableContainerIDField) + offset += binary.PutUvarint(buf[offset:], prefix) + + n = t.cid.StableSize() + offset += binary.PutUvarint(buf[offset:], uint64(n)) + + _, err = t.cid.StableMarshal(buf[offset:]) + if err != nil { + return nil, err + } + + offset += n + } + + prefix, _ = proto.NestedStructurePrefix(tableRecordsField) + + for i := range t.records { + offset += binary.PutUvarint(buf[offset:], prefix) + + n = t.records[i].StableSize() + offset += binary.PutUvarint(buf[offset:], uint64(n)) + + _, err = t.records[i].StableMarshal(buf[offset:]) + if err != nil { + return nil, err + } + + offset += n + } + + return buf, nil } -func (t *Table) StableSize() int { - panic("not implemented") +func (t *Table) StableSize() (size int) { + if t == nil { + return 0 + } + + if t.cid != nil { + _, ln := proto.NestedStructurePrefix(tableContainerIDField) + n := t.cid.StableSize() + size += ln + proto.VarUIntSize(uint64(n)) + n + } + + _, ln := proto.NestedStructurePrefix(tableRecordsField) + + for i := range t.records { + n := t.records[i].StableSize() + size += ln + proto.VarUIntSize(uint64(n)) + n + } + + return size } func (r *Record) StableMarshal(buf []byte) ([]byte, error) { @@ -44,21 +109,21 @@ func (r *Record) StableMarshal(buf []byte) ([]byte, error) { err error ) - n, err = proto.EnumMarshal(RecordOperationField, buf, int32(r.op)) + n, err = proto.EnumMarshal(recordOperationField, buf, int32(r.op)) if err != nil { return nil, err } offset += n - n, err = proto.EnumMarshal(RecordActionField, buf[offset:], int32(r.action)) + n, err = proto.EnumMarshal(recordActionField, buf[offset:], int32(r.action)) if err != nil { return nil, err } offset += n - prefix, _ = proto.NestedStructurePrefix(RecordFiltersField) + prefix, _ = proto.NestedStructurePrefix(recordFiltersField) for i := range r.filters { offset += binary.PutUvarint(buf[offset:], prefix) @@ -74,7 +139,7 @@ func (r *Record) StableMarshal(buf []byte) ([]byte, error) { offset += n } - prefix, _ = proto.NestedStructurePrefix(RecordTargetsField) + prefix, _ = proto.NestedStructurePrefix(recordTargetsField) for i := range r.targets { offset += binary.PutUvarint(buf[offset:], prefix) @@ -98,17 +163,17 @@ func (r *Record) StableSize() (size int) { return 0 } - size += proto.EnumSize(RecordOperationField, int32(r.op)) - size += proto.EnumSize(RecordActionField, int32(r.op)) + size += proto.EnumSize(recordOperationField, int32(r.op)) + size += proto.EnumSize(recordActionField, int32(r.op)) - _, ln := proto.NestedStructurePrefix(RecordFiltersField) + _, ln := proto.NestedStructurePrefix(recordFiltersField) for i := range r.filters { n := r.filters[i].StableSize() size += ln + proto.VarUIntSize(uint64(n)) + n } - _, ln = proto.NestedStructurePrefix(RecordTargetsField) + _, ln = proto.NestedStructurePrefix(recordTargetsField) for i := range r.targets { n := r.targets[i].StableSize() @@ -132,28 +197,28 @@ func (f *HeaderFilter) StableMarshal(buf []byte) ([]byte, error) { err error ) - n, err = proto.EnumMarshal(FilterHeaderTypeField, buf, int32(f.hdrType)) + n, err = proto.EnumMarshal(filterHeaderTypeField, buf, int32(f.hdrType)) if err != nil { return nil, err } offset += n - n, err = proto.EnumMarshal(FilterMatchTypeField, buf[offset:], int32(f.matchType)) + n, err = proto.EnumMarshal(filterMatchTypeField, buf[offset:], int32(f.matchType)) if err != nil { return nil, err } offset += n - n, err = proto.StringMarshal(FilterNameField, buf[offset:], f.name) + n, err = proto.StringMarshal(filterNameField, buf[offset:], f.name) if err != nil { return nil, err } offset += n - n, err = proto.StringMarshal(FilterValueField, buf[offset:], f.value) + n, err = proto.StringMarshal(filterValueField, buf[offset:], f.value) if err != nil { return nil, err } @@ -166,10 +231,10 @@ func (f *HeaderFilter) StableSize() (size int) { return 0 } - size += proto.EnumSize(FilterHeaderTypeField, int32(f.hdrType)) - size += proto.EnumSize(FilterMatchTypeField, int32(f.matchType)) - size += proto.StringSize(FilterNameField, f.name) - size += proto.StringSize(FilterValueField, f.value) + size += proto.EnumSize(filterHeaderTypeField, int32(f.hdrType)) + size += proto.EnumSize(filterMatchTypeField, int32(f.matchType)) + size += proto.StringSize(filterNameField, f.name) + size += proto.StringSize(filterValueField, f.value) return size } @@ -188,14 +253,14 @@ func (t *TargetInfo) StableMarshal(buf []byte) ([]byte, error) { err error ) - n, err = proto.EnumMarshal(TargetTypeField, buf, int32(t.target)) + n, err = proto.EnumMarshal(targetTypeField, buf, int32(t.target)) if err != nil { return nil, err } offset += n - n, err = proto.RepeatedBytesMarshal(TargetKeysField, buf[offset:], t.keys) + n, err = proto.RepeatedBytesMarshal(targetKeysField, buf[offset:], t.keys) if err != nil { return nil, err } @@ -208,8 +273,8 @@ func (t *TargetInfo) StableSize() (size int) { return 0 } - size += proto.EnumSize(TargetTypeField, int32(t.target)) - size += proto.RepeatedBytesSize(TargetKeysField, t.keys) + size += proto.EnumSize(targetTypeField, int32(t.target)) + size += proto.RepeatedBytesSize(targetKeysField, t.keys) return size } diff --git a/v2/acl/marshal_test.go b/v2/acl/marshal_test.go index eea5d04..8874ccd 100644 --- a/v2/acl/marshal_test.go +++ b/v2/acl/marshal_test.go @@ -6,6 +6,7 @@ import ( "github.com/nspcc-dev/neofs-api-go/v2/acl" grpc "github.com/nspcc-dev/neofs-api-go/v2/acl/grpc" + "github.com/nspcc-dev/neofs-api-go/v2/refs" "github.com/stretchr/testify/require" ) @@ -120,3 +121,28 @@ func TestRecord_StableMarshal(t *testing.T) { require.Equal(t, recordFrom, recordTo) }) } + +func TestTable_StableMarshal(t *testing.T) { + tableFrom := new(acl.Table) + transport := new(grpc.EACLTable) + + t.Run("non empty", func(t *testing.T) { + cid := new(refs.ContainerID) + cid.SetValue([]byte("Container ID")) + + r1 := generateRecord(false) + r2 := generateRecord(true) + + tableFrom.SetContainerID(cid) + tableFrom.SetRecords([]*acl.Record{r1, r2}) + + wire, err := tableFrom.StableMarshal(nil) + require.NoError(t, err) + + err = transport.Unmarshal(wire) + require.NoError(t, err) + + tableTo := acl.TableFromGRPCMessage(transport) + require.Equal(t, tableFrom, tableTo) + }) +} From d7c4dc333ce1fbaf99de4584986566b9452a5979 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Mon, 17 Aug 2020 17:47:43 +0300 Subject: [PATCH 0315/1196] Fix some lint warnings Signed-off-by: Alex Vanin --- v2/acl/convert.go | 18 ++++++++++++++++++ v2/acl/marshal.go | 16 ++++++++++++++-- v2/acl/marshal_test.go | 20 +++++++++----------- v2/acl/types.go | 13 +++++++++++++ 4 files changed, 54 insertions(+), 13 deletions(-) diff --git a/v2/acl/convert.go b/v2/acl/convert.go index f41a28d..bf65685 100644 --- a/v2/acl/convert.go +++ b/v2/acl/convert.go @@ -5,6 +5,7 @@ import ( "github.com/nspcc-dev/neofs-api-go/v2/refs" ) +// TargetToGRPCField converts unified target enum into grpc enum. func TargetToGRPCField(t Target) acl.Target { switch t { case TargetUser: @@ -18,6 +19,7 @@ func TargetToGRPCField(t Target) acl.Target { } } +// TargetFromGRPCField converts grpc enum into unified target enum. func TargetFromGRPCField(t acl.Target) Target { switch t { case acl.Target_USER: @@ -31,6 +33,7 @@ func TargetFromGRPCField(t acl.Target) Target { } } +// OperationToGRPCField converts unified operation enum into grpc enum. func OperationToGRPCField(t Operation) acl.Operation { switch t { case OperationPut: @@ -52,6 +55,7 @@ func OperationToGRPCField(t Operation) acl.Operation { } } +// OperationFromGRPCField converts grpc enum into unified operation enum. func OperationFromGRPCField(t acl.Operation) Operation { switch t { case acl.Operation_PUT: @@ -73,6 +77,7 @@ func OperationFromGRPCField(t acl.Operation) Operation { } } +// ActionToGRPCField converts unified action enum into grpc enum. func ActionToGRPCField(t Action) acl.Action { switch t { case ActionDeny: @@ -84,6 +89,7 @@ func ActionToGRPCField(t Action) acl.Action { } } +// ActionFromGRPCField converts grpc enum into unified action enum. func ActionFromGRPCField(t acl.Action) Action { switch t { case acl.Action_DENY: @@ -95,6 +101,7 @@ func ActionFromGRPCField(t acl.Action) Action { } } +// HeaderTypeToGRPCField converts unified header type enum into grpc enum. func HeaderTypeToGRPCField(t HeaderType) acl.HeaderType { switch t { case HeaderTypeRequest: @@ -106,6 +113,7 @@ func HeaderTypeToGRPCField(t HeaderType) acl.HeaderType { } } +// HeaderTypeFromGRPCField converts grpc enum into unified header type enum. func HeaderTypeFromGRPCField(t acl.HeaderType) HeaderType { switch t { case acl.HeaderType_REQUEST: @@ -117,6 +125,7 @@ func HeaderTypeFromGRPCField(t acl.HeaderType) HeaderType { } } +// MatchTypeToGRPCField converts unified match type enum into grpc enum. func MatchTypeToGRPCField(t MatchType) acl.MatchType { switch t { case MatchTypeStringEqual: @@ -128,6 +137,7 @@ func MatchTypeToGRPCField(t MatchType) acl.MatchType { } } +// MatchTypeFromGRPCField converts grpc enum into unified match type enum. func MatchTypeFromGRPCField(t acl.MatchType) MatchType { switch t { case acl.MatchType_STRING_EQUAL: @@ -139,6 +149,7 @@ func MatchTypeFromGRPCField(t acl.MatchType) MatchType { } } +// HeaderFilterToGRPCMessage converts unified header filter struct into grpc struct. func HeaderFilterToGRPCMessage(f *HeaderFilter) *acl.EACLRecord_FilterInfo { if f == nil { return nil @@ -160,6 +171,7 @@ func HeaderFilterToGRPCMessage(f *HeaderFilter) *acl.EACLRecord_FilterInfo { return m } +// HeaderFilterFromGRPCMessage converts grpc struct into unified header filter struct. func HeaderFilterFromGRPCMessage(m *acl.EACLRecord_FilterInfo) *HeaderFilter { if m == nil { return nil @@ -181,6 +193,7 @@ func HeaderFilterFromGRPCMessage(m *acl.EACLRecord_FilterInfo) *HeaderFilter { return f } +// TargetInfoToGRPCMessage converts unified target info struct into grpc struct. func TargetInfoToGRPCMessage(t *TargetInfo) *acl.EACLRecord_TargetInfo { if t == nil { return nil @@ -197,6 +210,7 @@ func TargetInfoToGRPCMessage(t *TargetInfo) *acl.EACLRecord_TargetInfo { return m } +// TargetInfoFromGRPCMessage converts grpc struct into unified target info struct. func TargetInfoFromGRPCMessage(m *acl.EACLRecord_TargetInfo) *TargetInfo { if m == nil { return nil @@ -213,6 +227,7 @@ func TargetInfoFromGRPCMessage(m *acl.EACLRecord_TargetInfo) *TargetInfo { return t } +// RecordToGRPCMessage converts unified acl record struct into grpc struct. func RecordToGRPCMessage(r *Record) *acl.EACLRecord { if r == nil { return nil @@ -249,6 +264,7 @@ func RecordToGRPCMessage(r *Record) *acl.EACLRecord { return m } +// RecordFromGRPCMessage converts grpc struct into unified acl record struct. func RecordFromGRPCMessage(m *acl.EACLRecord) *Record { if m == nil { return nil @@ -285,6 +301,7 @@ func RecordFromGRPCMessage(m *acl.EACLRecord) *Record { return r } +// TableToGRPCMessage converts unified acl table struct into grpc struct. func TableToGRPCMessage(t *Table) *acl.EACLTable { if t == nil { return nil @@ -308,6 +325,7 @@ func TableToGRPCMessage(t *Table) *acl.EACLTable { return m } +// TableFromGRPCMessage converts grpc struct into unified acl table struct. func TableFromGRPCMessage(m *acl.EACLTable) *Table { if m == nil { return nil diff --git a/v2/acl/marshal.go b/v2/acl/marshal.go index e4cb2e9..7b9e7ea 100644 --- a/v2/acl/marshal.go +++ b/v2/acl/marshal.go @@ -24,6 +24,8 @@ const ( tableRecordsField = 2 ) +// StableMarshal marshals unified acl table structure in a protobuf +// compatible way without field order shuffle. func (t *Table) StableMarshal(buf []byte) ([]byte, error) { if t == nil { return []byte{}, nil @@ -73,6 +75,7 @@ func (t *Table) StableMarshal(buf []byte) ([]byte, error) { return buf, nil } +// StableSize of acl table structure marshalled by StableMarshal function. func (t *Table) StableSize() (size int) { if t == nil { return 0 @@ -94,6 +97,8 @@ func (t *Table) StableSize() (size int) { return size } +// StableMarshal marshals unified acl record structure in a protobuf +// compatible way without field order shuffle. func (r *Record) StableMarshal(buf []byte) ([]byte, error) { if r == nil { return []byte{}, nil @@ -158,6 +163,7 @@ func (r *Record) StableMarshal(buf []byte) ([]byte, error) { return buf, nil } +// StableSize of acl record structure marshalled by StableMarshal function. func (r *Record) StableSize() (size int) { if r == nil { return 0 @@ -183,6 +189,8 @@ func (r *Record) StableSize() (size int) { return size } +// StableMarshal marshals unified header filter structure in a protobuf +// compatible way without field order shuffle. func (f *HeaderFilter) StableMarshal(buf []byte) ([]byte, error) { if f == nil { return []byte{}, nil @@ -218,7 +226,7 @@ func (f *HeaderFilter) StableMarshal(buf []byte) ([]byte, error) { offset += n - n, err = proto.StringMarshal(filterValueField, buf[offset:], f.value) + _, err = proto.StringMarshal(filterValueField, buf[offset:], f.value) if err != nil { return nil, err } @@ -226,6 +234,7 @@ func (f *HeaderFilter) StableMarshal(buf []byte) ([]byte, error) { return buf, nil } +// StableSize of header filter structure marshalled by StableMarshal function. func (f *HeaderFilter) StableSize() (size int) { if f == nil { return 0 @@ -239,6 +248,8 @@ func (f *HeaderFilter) StableSize() (size int) { return size } +// StableMarshal marshals unified target info structure in a protobuf +// compatible way without field order shuffle. func (t *TargetInfo) StableMarshal(buf []byte) ([]byte, error) { if t == nil { return []byte{}, nil @@ -260,7 +271,7 @@ func (t *TargetInfo) StableMarshal(buf []byte) ([]byte, error) { offset += n - n, err = proto.RepeatedBytesMarshal(targetKeysField, buf[offset:], t.keys) + _, err = proto.RepeatedBytesMarshal(targetKeysField, buf[offset:], t.keys) if err != nil { return nil, err } @@ -268,6 +279,7 @@ func (t *TargetInfo) StableMarshal(buf []byte) ([]byte, error) { return buf, nil } +// StableSize of target info structure marshalled by StableMarshal function. func (t *TargetInfo) StableSize() (size int) { if t == nil { return 0 diff --git a/v2/acl/marshal_test.go b/v2/acl/marshal_test.go index 8874ccd..c5de1c8 100644 --- a/v2/acl/marshal_test.go +++ b/v2/acl/marshal_test.go @@ -15,6 +15,7 @@ func generateTarget(u acl.Target, k int) *acl.TargetInfo { target.SetTarget(u) keys := make([][]byte, k) + for i := 0; i < k; i++ { s := fmt.Sprintf("Public Key %d", i+1) keys[i] = []byte(s) @@ -23,10 +24,10 @@ func generateTarget(u acl.Target, k int) *acl.TargetInfo { return target } -func generateFilter(t acl.HeaderType, m acl.MatchType, k, v string) *acl.HeaderFilter { +func generateFilter(t acl.HeaderType, k, v string) *acl.HeaderFilter { filter := new(acl.HeaderFilter) filter.SetHeaderType(t) - filter.SetMatchType(m) + filter.SetMatchType(acl.MatchTypeStringEqual) filter.SetName(k) filter.SetValue(v) @@ -34,12 +35,12 @@ func generateFilter(t acl.HeaderType, m acl.MatchType, k, v string) *acl.HeaderF } func generateRecord(another bool) *acl.Record { - var record = new(acl.Record) + record := new(acl.Record) + switch another { case true: t1 := generateTarget(acl.TargetUser, 2) - f1 := generateFilter(acl.HeaderTypeObject, acl.MatchTypeStringEqual, - "OID", "ObjectID Value") + f1 := generateFilter(acl.HeaderTypeObject, "OID", "ObjectID Value") record.SetOperation(acl.OperationHead) record.SetAction(acl.ActionDeny) @@ -48,10 +49,8 @@ func generateRecord(another bool) *acl.Record { default: t1 := generateTarget(acl.TargetUser, 2) t2 := generateTarget(acl.TargetSystem, 0) - f1 := generateFilter(acl.HeaderTypeObject, acl.MatchTypeStringEqual, - "CID", "Container ID Value") - f2 := generateFilter(acl.HeaderTypeRequest, acl.MatchTypeStringEqual, - "X-Header-Key", "X-Header-Value") + f1 := generateFilter(acl.HeaderTypeObject, "CID", "Container ID Value") + f2 := generateFilter(acl.HeaderTypeRequest, "X-Header-Key", "X-Header-Value") record.SetOperation(acl.OperationPut) record.SetAction(acl.ActionAllow) @@ -63,8 +62,7 @@ func generateRecord(another bool) *acl.Record { } func TestHeaderFilter_StableMarshal(t *testing.T) { - filterFrom := generateFilter(acl.HeaderTypeObject, acl.MatchTypeStringEqual, - "CID", "Container ID Value") + filterFrom := generateFilter(acl.HeaderTypeObject, "CID", "Container ID Value") transport := new(grpc.EACLRecord_FilterInfo) t.Run("non empty", func(t *testing.T) { diff --git a/v2/acl/types.go b/v2/acl/types.go index b73eea1..5fb1b6b 100644 --- a/v2/acl/types.go +++ b/v2/acl/types.go @@ -2,6 +2,8 @@ package acl import "github.com/nspcc-dev/neofs-api-go/v2/refs" +// HeaderFilter is a unified structure of FilterInfo +// message from proto definition. type HeaderFilter struct { hdrType HeaderType @@ -10,12 +12,16 @@ type HeaderFilter struct { name, value string } +// TargetInfo is a unified structure of TargetInfo +// message from proto definition. type TargetInfo struct { target Target keys [][]byte } +// Record is a unified structure of EACLRecord +// message from proto definition. type Record struct { op Operation @@ -26,20 +32,27 @@ type Record struct { targets []*TargetInfo } +// Table is a unified structure of EACLTable +// message from proto definition. type Table struct { cid *refs.ContainerID records []*Record } +// TargetInfo is a unified enum of MatchType enum from proto definition. type MatchType uint32 +// HeaderType is a unified enum of HeaderType enum from proto definition. type HeaderType uint32 +// Action is a unified enum of Action enum from proto definition. type Action uint32 +// Operation is a unified enum of Operation enum from proto definition. type Operation uint32 +// Target is a unified enum of Target enum from proto definition. type Target uint32 const ( From 7b93298263a396e9e85ec7d3bd187947bd6854d9 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 17 Aug 2020 19:00:10 +0300 Subject: [PATCH 0316/1196] v2/container: Implement remaining uni-structures Signed-off-by: Leonard Lyubich --- v2/container/convert.go | 732 ++++++++++++++++++++++++++++++++++ v2/container/types.go | 865 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 1597 insertions(+) diff --git a/v2/container/convert.go b/v2/container/convert.go index 0ca1118..58d99da 100644 --- a/v2/container/convert.go +++ b/v2/container/convert.go @@ -1,9 +1,11 @@ package container import ( + "github.com/nspcc-dev/neofs-api-go/v2/acl" container "github.com/nspcc-dev/neofs-api-go/v2/container/grpc" "github.com/nspcc-dev/neofs-api-go/v2/netmap" "github.com/nspcc-dev/neofs-api-go/v2/refs" + refsGRPC "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" "github.com/nspcc-dev/neofs-api-go/v2/service" ) @@ -102,3 +104,733 @@ func ContainerFromGRPCMessage(m *container.Container) *Container { return c } + +func PutRequestBodyToGRPCMessage(r *PutRequestBody) *container.PutRequest_Body { + if r == nil { + return nil + } + + m := new(container.PutRequest_Body) + + m.SetContainer( + ContainerToGRPCMessage(r.GetContainer()), + ) + + m.SetPublicKey(r.GetPublicKey()) + m.SetSignature(r.GetSignature()) + + return m +} + +func PutRequestBodyFromGRPCMessage(m *container.PutRequest_Body) *PutRequestBody { + if m == nil { + return nil + } + + r := new(PutRequestBody) + + r.SetContainer( + ContainerFromGRPCMessage(m.GetContainer()), + ) + + r.SetPublicKey(m.GetPublicKey()) + r.SetSignature(m.GetSignature()) + + return r +} + +func PutRequestToGRPCMessage(r *PutRequest) *container.PutRequest { + if r == nil { + return nil + } + + m := new(container.PutRequest) + + m.SetBody( + PutRequestBodyToGRPCMessage(r.GetBody()), + ) + + service.RequestHeadersToGRPC(r, m) + + return m +} + +func PutRequestFromGRPCMessage(m *container.PutRequest) *PutRequest { + if m == nil { + return nil + } + + r := new(PutRequest) + + r.SetBody( + PutRequestBodyFromGRPCMessage(m.GetBody()), + ) + + service.RequestHeadersFromGRPC(m, r) + + return r +} + +func PutResponseBodyToGRPCMessage(r *PutResponseBody) *container.PutResponse_Body { + if r == nil { + return nil + } + + m := new(container.PutResponse_Body) + + m.SetContainerId( + refs.ContainerIDToGRPCMessage(r.GetContainerID()), + ) + + return m +} + +func PutResponseBodyFromGRPCMessage(m *container.PutResponse_Body) *PutResponseBody { + if m == nil { + return nil + } + + r := new(PutResponseBody) + + r.SetContainerID( + refs.ContainerIDFromGRPCMessage(m.GetContainerId()), + ) + + return r +} + +func PutResponseToGRPCMessage(r *PutResponse) *container.PutResponse { + if r == nil { + return nil + } + + m := new(container.PutResponse) + + m.SetBody( + PutResponseBodyToGRPCMessage(r.GetBody()), + ) + + service.ResponseHeadersToGRPC(r, m) + + return m +} + +func PutResponseFromGRPCMessage(m *container.PutResponse) *PutResponse { + if m == nil { + return nil + } + + r := new(PutResponse) + + r.SetBody( + PutResponseBodyFromGRPCMessage(m.GetBody()), + ) + + service.ResponseHeadersFromGRPC(m, r) + + return r +} + +func GetRequestBodyToGRPCMessage(r *GetRequestBody) *container.GetRequest_Body { + if r == nil { + return nil + } + + m := new(container.GetRequest_Body) + + m.SetContainerId( + refs.ContainerIDToGRPCMessage(r.GetContainerID()), + ) + + return m +} + +func GetRequestBodyFromGRPCMessage(m *container.GetRequest_Body) *GetRequestBody { + if m == nil { + return nil + } + + r := new(GetRequestBody) + + r.SetContainerID( + refs.ContainerIDFromGRPCMessage(m.GetContainerId()), + ) + + return r +} + +func GetRequestToGRPCMessage(r *GetRequest) *container.GetRequest { + if r == nil { + return nil + } + + m := new(container.GetRequest) + + m.SetBody( + GetRequestBodyToGRPCMessage(r.GetBody()), + ) + + service.RequestHeadersToGRPC(r, m) + + return m +} + +func GetRequestFromGRPCMessage(m *container.GetRequest) *GetRequest { + if m == nil { + return nil + } + + r := new(GetRequest) + + r.SetBody( + GetRequestBodyFromGRPCMessage(m.GetBody()), + ) + + service.RequestHeadersFromGRPC(m, r) + + return r +} + +func GetResponseBodyToGRPCMessage(r *GetResponseBody) *container.GetResponse_Body { + if r == nil { + return nil + } + + m := new(container.GetResponse_Body) + + m.SetContainer( + ContainerToGRPCMessage(r.GetContainer()), + ) + + return m +} + +func GetResponseBodyFromGRPCMessage(m *container.GetResponse_Body) *GetResponseBody { + if m == nil { + return nil + } + + r := new(GetResponseBody) + + r.SetContainer( + ContainerFromGRPCMessage(m.GetContainer()), + ) + + return r +} + +func GetResponseToGRPCMessage(r *GetResponse) *container.GetResponse { + if r == nil { + return nil + } + + m := new(container.GetResponse) + + m.SetBody( + GetResponseBodyToGRPCMessage(r.GetBody()), + ) + + service.ResponseHeadersToGRPC(r, m) + + return m +} + +func GetResponseFromGRPCMessage(m *container.GetResponse) *GetResponse { + if m == nil { + return nil + } + + r := new(GetResponse) + + r.SetBody( + GetResponseBodyFromGRPCMessage(m.GetBody()), + ) + + service.ResponseHeadersFromGRPC(m, r) + + return r +} + +func DeleteRequestBodyToGRPCMessage(r *DeleteRequestBody) *container.DeleteRequest_Body { + if r == nil { + return nil + } + + m := new(container.DeleteRequest_Body) + + m.SetContainerId( + refs.ContainerIDToGRPCMessage(r.GetContainerID()), + ) + + m.SetSignature(r.GetSignature()) + + return m +} + +func DeleteRequestBodyFromGRPCMessage(m *container.DeleteRequest_Body) *DeleteRequestBody { + if m == nil { + return nil + } + + r := new(DeleteRequestBody) + + r.SetContainerID( + refs.ContainerIDFromGRPCMessage(m.GetContainerId()), + ) + + r.SetSignature(m.GetSignature()) + + return r +} + +func DeleteRequestToGRPCMessage(r *DeleteRequest) *container.DeleteRequest { + if r == nil { + return nil + } + + m := new(container.DeleteRequest) + + m.SetBody( + DeleteRequestBodyToGRPCMessage(r.GetBody()), + ) + + service.RequestHeadersToGRPC(r, m) + + return m +} + +func DeleteRequestFromGRPCMessage(m *container.DeleteRequest) *DeleteRequest { + if m == nil { + return nil + } + + r := new(DeleteRequest) + + r.SetBody( + DeleteRequestBodyFromGRPCMessage(m.GetBody()), + ) + + service.RequestHeadersFromGRPC(m, r) + + return r +} + +func DeleteResponseBodyToGRPCMessage(r *DeleteResponseBody) *container.DeleteResponse_Body { + if r == nil { + return nil + } + + m := new(container.DeleteResponse_Body) + + return m +} + +func DeleteResponseBodyFromGRPCMessage(m *container.DeleteResponse_Body) *DeleteResponseBody { + if m == nil { + return nil + } + + r := new(DeleteResponseBody) + + return r +} + +func DeleteResponseToGRPCMessage(r *DeleteResponse) *container.DeleteResponse { + if r == nil { + return nil + } + + m := new(container.DeleteResponse) + + m.SetBody( + DeleteResponseBodyToGRPCMessage(r.GetBody()), + ) + + service.ResponseHeadersToGRPC(r, m) + + return m +} + +func DeleteResponseFromGRPCMessage(m *container.DeleteResponse) *DeleteResponse { + if m == nil { + return nil + } + + r := new(DeleteResponse) + + r.SetBody( + DeleteResponseBodyFromGRPCMessage(m.GetBody()), + ) + + service.ResponseHeadersFromGRPC(m, r) + + return r +} + +func ListRequestBodyToGRPCMessage(r *ListRequestBody) *container.ListRequest_Body { + if r == nil { + return nil + } + + m := new(container.ListRequest_Body) + + m.SetOwnerId( + refs.OwnerIDToGRPCMessage(r.GetOwnerID()), + ) + + return m +} + +func ListRequestBodyFromGRPCMessage(m *container.ListRequest_Body) *ListRequestBody { + if m == nil { + return nil + } + + r := new(ListRequestBody) + + r.SetOwnerID( + refs.OwnerIDFromGRPCMessage(m.GetOwnerId()), + ) + + return r +} + +func ListRequestToGRPCMessage(r *ListRequest) *container.ListRequest { + if r == nil { + return nil + } + + m := new(container.ListRequest) + + m.SetBody( + ListRequestBodyToGRPCMessage(r.GetBody()), + ) + + service.RequestHeadersToGRPC(r, m) + + return m +} + +func ListRequestFromGRPCMessage(m *container.ListRequest) *ListRequest { + if m == nil { + return nil + } + + r := new(ListRequest) + + r.SetBody( + ListRequestBodyFromGRPCMessage(m.GetBody()), + ) + + service.RequestHeadersFromGRPC(m, r) + + return r +} + +func ListResponseBodyToGRPCMessage(r *ListResponseBody) *container.ListResponse_Body { + if r == nil { + return nil + } + + m := new(container.ListResponse_Body) + + cids := r.GetContainerIDs() + cidMsg := make([]*refsGRPC.ContainerID, 0, len(cids)) + + for i := range cids { + cidMsg = append(cidMsg, refs.ContainerIDToGRPCMessage(cids[i])) + } + + m.SetContainerIds(cidMsg) + + return m +} + +func ListResponseBodyFromGRPCMessage(m *container.ListResponse_Body) *ListResponseBody { + if m == nil { + return nil + } + + r := new(ListResponseBody) + + cidMsg := m.GetContainerIds() + cids := make([]*refs.ContainerID, 0, len(cidMsg)) + + for i := range cidMsg { + cids = append(cids, refs.ContainerIDFromGRPCMessage(cidMsg[i])) + } + + r.SetContainerIDs(cids) + + return r +} + +func ListResponseToGRPCMessage(r *ListResponse) *container.ListResponse { + if r == nil { + return nil + } + + m := new(container.ListResponse) + + m.SetBody( + ListResponseBodyToGRPCMessage(r.GetBody()), + ) + + service.ResponseHeadersToGRPC(r, m) + + return m +} + +func ListResponseFromGRPCMessage(m *container.ListResponse) *ListResponse { + if m == nil { + return nil + } + + r := new(ListResponse) + + r.SetBody( + ListResponseBodyFromGRPCMessage(m.GetBody()), + ) + + service.ResponseHeadersFromGRPC(m, r) + + return r +} + +func SetExtendedACLRequestBodyToGRPCMessage(r *SetExtendedACLRequestBody) *container.SetExtendedACLRequest_Body { + if r == nil { + return nil + } + + m := new(container.SetExtendedACLRequest_Body) + + m.SetEacl( + acl.TableToGRPCMessage(r.GetEACL()), + ) + + m.SetSignature(r.GetSignature()) + + return m +} + +func SetExtendedACLRequestBodyFromGRPCMessage(m *container.SetExtendedACLRequest_Body) *SetExtendedACLRequestBody { + if m == nil { + return nil + } + + r := new(SetExtendedACLRequestBody) + + r.SetEACL( + acl.TableFromGRPCMessage(m.GetEacl()), + ) + + return r +} + +func SetExtendedACLRequestToGRPCMessage(r *SetExtendedACLRequest) *container.SetExtendedACLRequest { + if r == nil { + return nil + } + + m := new(container.SetExtendedACLRequest) + + m.SetBody( + SetExtendedACLRequestBodyToGRPCMessage(r.GetBody()), + ) + + service.RequestHeadersToGRPC(r, m) + + return m +} + +func SetExtendedACLRequestFromGRPCMessage(m *container.SetExtendedACLRequest) *SetExtendedACLRequest { + if m == nil { + return nil + } + + r := new(SetExtendedACLRequest) + + r.SetBody( + SetExtendedACLRequestBodyFromGRPCMessage(m.GetBody()), + ) + + service.RequestHeadersFromGRPC(m, r) + + return r +} + +func SetExtendedACLResponseBodyToGRPCMessage(r *SetExtendedACLResponseBody) *container.SetExtendedACLResponse_Body { + if r == nil { + return nil + } + + m := new(container.SetExtendedACLResponse_Body) + + return m +} + +func SetExtendedACLResponseBodyFromGRPCMessage(m *container.SetExtendedACLResponse_Body) *SetExtendedACLResponseBody { + if m == nil { + return nil + } + + r := new(SetExtendedACLResponseBody) + + return r +} + +func SetExtendedACLResponseToGRPCMessage(r *SetExtendedACLResponse) *container.SetExtendedACLResponse { + if r == nil { + return nil + } + + m := new(container.SetExtendedACLResponse) + + m.SetBody( + SetExtendedACLResponseBodyToGRPCMessage(r.GetBody()), + ) + + service.ResponseHeadersToGRPC(r, m) + + return m +} + +func SetExtendedACLResponseFromGRPCMessage(m *container.SetExtendedACLResponse) *SetExtendedACLResponse { + if m == nil { + return nil + } + + r := new(SetExtendedACLResponse) + + r.SetBody( + SetExtendedACLResponseBodyFromGRPCMessage(m.GetBody()), + ) + + service.ResponseHeadersFromGRPC(m, r) + + return r +} + +func GetExtendedACLRequestBodyToGRPCMessage(r *GetExtendedACLRequestBody) *container.GetExtendedACLRequest_Body { + if r == nil { + return nil + } + + m := new(container.GetExtendedACLRequest_Body) + + m.SetContainerId( + refs.ContainerIDToGRPCMessage(r.GetContainerID()), + ) + + return m +} + +func GetExtendedACLRequestBodyFromGRPCMessage(m *container.GetExtendedACLRequest_Body) *GetExtendedACLRequestBody { + if m == nil { + return nil + } + + r := new(GetExtendedACLRequestBody) + + r.SetContainerID( + refs.ContainerIDFromGRPCMessage(m.GetContainerId()), + ) + + return r +} + +func GetExtendedACLRequestToGRPCMessage(r *GetExtendedACLRequest) *container.GetExtendedACLRequest { + if r == nil { + return nil + } + + m := new(container.GetExtendedACLRequest) + + m.SetBody( + GetExtendedACLRequestBodyToGRPCMessage(r.GetBody()), + ) + + service.RequestHeadersToGRPC(r, m) + + return m +} + +func GetExtendedACLRequestFromGRPCMessage(m *container.GetExtendedACLRequest) *GetExtendedACLRequest { + if m == nil { + return nil + } + + r := new(GetExtendedACLRequest) + + r.SetBody( + GetExtendedACLRequestBodyFromGRPCMessage(m.GetBody()), + ) + + service.RequestHeadersFromGRPC(m, r) + + return r +} + +func GetExtendedACLResponseBodyToGRPCMessage(r *GetExtendedACLResponseBody) *container.GetExtendedACLResponse_Body { + if r == nil { + return nil + } + + m := new(container.GetExtendedACLResponse_Body) + + m.SetEacl( + acl.TableToGRPCMessage(r.GetEACL()), + ) + + m.SetSignature(r.GetSignature()) + + return m +} + +func GetExtendedACLResponseBodyFromGRPCMessage(m *container.GetExtendedACLResponse_Body) *GetExtendedACLResponseBody { + if m == nil { + return nil + } + + r := new(GetExtendedACLResponseBody) + + r.SetEACL( + acl.TableFromGRPCMessage(m.GetEacl()), + ) + + r.SetSignature(m.GetSignature()) + + return r +} + +func GetExtendedACLResponseToGRPCMessage(r *GetExtendedACLResponse) *container.GetExtendedACLResponse { + if r == nil { + return nil + } + + m := new(container.GetExtendedACLResponse) + + m.SetBody( + GetExtendedACLResponseBodyToGRPCMessage(r.GetBody()), + ) + + service.ResponseHeadersToGRPC(r, m) + + return m +} + +func GetExtendedACLResponseFromGRPCMessage(m *container.GetExtendedACLResponse) *GetExtendedACLResponse { + if m == nil { + return nil + } + + r := new(GetExtendedACLResponse) + + r.SetBody( + GetExtendedACLResponseBodyFromGRPCMessage(m.GetBody()), + ) + + service.ResponseHeadersFromGRPC(m, r) + + return r +} diff --git a/v2/container/types.go b/v2/container/types.go index bfb7530..80dbcbf 100644 --- a/v2/container/types.go +++ b/v2/container/types.go @@ -1,6 +1,7 @@ package container import ( + "github.com/nspcc-dev/neofs-api-go/v2/acl" "github.com/nspcc-dev/neofs-api-go/v2/netmap" "github.com/nspcc-dev/neofs-api-go/v2/refs" "github.com/nspcc-dev/neofs-api-go/v2/service" @@ -24,6 +25,156 @@ type Container struct { policy *netmap.PlacementPolicy } +type PutRequestBody struct { + cnr *Container + + pubKey []byte + + sig []byte +} + +type PutRequest struct { + body *PutRequestBody + + metaHeader *service.RequestMetaHeader + + verifyHeader *service.RequestVerificationHeader +} + +type PutResponseBody struct { + cid *refs.ContainerID +} + +type PutResponse struct { + body *PutResponseBody + + metaHeader *service.ResponseMetaHeader + + verifyHeader *service.ResponseVerificationHeader +} + +type GetRequestBody struct { + cid *refs.ContainerID +} + +type GetRequest struct { + body *GetRequestBody + + metaHeader *service.RequestMetaHeader + + verifyHeader *service.RequestVerificationHeader +} + +type GetResponseBody struct { + cnr *Container +} + +type GetResponse struct { + body *GetResponseBody + + metaHeader *service.ResponseMetaHeader + + verifyHeader *service.ResponseVerificationHeader +} + +type DeleteRequestBody struct { + cid *refs.ContainerID + + sig []byte +} + +type DeleteRequest struct { + body *DeleteRequestBody + + metaHeader *service.RequestMetaHeader + + verifyHeader *service.RequestVerificationHeader +} + +type DeleteResponseBody struct{} + +type DeleteResponse struct { + body *DeleteResponseBody + + metaHeader *service.ResponseMetaHeader + + verifyHeader *service.ResponseVerificationHeader +} + +type ListRequestBody struct { + ownerID *refs.OwnerID +} + +type ListRequest struct { + body *ListRequestBody + + metaHeader *service.RequestMetaHeader + + verifyHeader *service.RequestVerificationHeader +} + +type ListResponseBody struct { + cidList []*refs.ContainerID +} + +type ListResponse struct { + body *ListResponseBody + + metaHeader *service.ResponseMetaHeader + + verifyHeader *service.ResponseVerificationHeader +} + +type SetExtendedACLRequestBody struct { + eacl *acl.Table + + sig []byte +} + +type SetExtendedACLRequest struct { + body *SetExtendedACLRequestBody + + metaHeader *service.RequestMetaHeader + + verifyHeader *service.RequestVerificationHeader +} + +type SetExtendedACLResponseBody struct{} + +type SetExtendedACLResponse struct { + body *SetExtendedACLResponseBody + + metaHeader *service.ResponseMetaHeader + + verifyHeader *service.ResponseVerificationHeader +} + +type GetExtendedACLRequestBody struct { + cid *refs.ContainerID +} + +type GetExtendedACLRequest struct { + body *GetExtendedACLRequestBody + + metaHeader *service.RequestMetaHeader + + verifyHeader *service.RequestVerificationHeader +} + +type GetExtendedACLResponseBody struct { + eacl *acl.Table + + sig []byte +} + +type GetExtendedACLResponse struct { + body *GetExtendedACLResponseBody + + metaHeader *service.ResponseMetaHeader + + verifyHeader *service.ResponseVerificationHeader +} + func (a *Attribute) GetKey() string { if a != nil { return a.key @@ -135,3 +286,717 @@ func (c *Container) SetPlacementPolicy(v *netmap.PlacementPolicy) { c.policy = v } } + +func (r *PutRequestBody) GetContainer() *Container { + if r != nil { + return r.cnr + } + + return nil +} + +func (r *PutRequestBody) SetContainer(v *Container) { + if r != nil { + r.cnr = v + } +} + +func (r *PutRequestBody) GetPublicKey() []byte { + if r != nil { + return r.pubKey + } + + return nil +} + +func (r *PutRequestBody) SetPublicKey(v []byte) { + if r != nil { + r.pubKey = v + } +} + +func (r *PutRequestBody) GetSignature() []byte { + if r != nil { + return r.sig + } + + return nil +} + +func (r *PutRequestBody) SetSignature(v []byte) { + if r != nil { + r.sig = v + } +} + +func (r *PutRequest) GetBody() *PutRequestBody { + if r != nil { + return r.body + } + + return nil +} + +func (r *PutRequest) SetBody(v *PutRequestBody) { + if r != nil { + r.body = v + } +} + +func (r *PutRequest) GetMetaHeader() *service.RequestMetaHeader { + if r != nil { + return r.metaHeader + } + + return nil +} + +func (r *PutRequest) SetMetaHeader(v *service.RequestMetaHeader) { + if r != nil { + r.metaHeader = v + } +} + +func (r *PutRequest) GetVerificationHeader() *service.RequestVerificationHeader { + if r != nil { + return r.verifyHeader + } + + return nil +} + +func (r *PutRequest) SetVerificationHeader(v *service.RequestVerificationHeader) { + if r != nil { + r.verifyHeader = v + } +} + +func (r *PutResponseBody) GetContainerID() *refs.ContainerID { + if r != nil { + return r.cid + } + + return nil +} + +func (r *PutResponseBody) SetContainerID(v *refs.ContainerID) { + if r != nil { + r.cid = v + } +} + +func (r *PutResponse) GetBody() *PutResponseBody { + if r != nil { + return r.body + } + + return nil +} + +func (r *PutResponse) SetBody(v *PutResponseBody) { + if r != nil { + r.body = v + } +} + +func (r *PutResponse) GetMetaHeader() *service.ResponseMetaHeader { + if r != nil { + return r.metaHeader + } + + return nil +} + +func (r *PutResponse) SetMetaHeader(v *service.ResponseMetaHeader) { + if r != nil { + r.metaHeader = v + } +} + +func (r *PutResponse) GetVerificationHeader() *service.ResponseVerificationHeader { + if r != nil { + return r.verifyHeader + } + + return nil +} + +func (r *PutResponse) SetVerificationHeader(v *service.ResponseVerificationHeader) { + if r != nil { + r.verifyHeader = v + } +} + +func (r *GetRequestBody) GetContainerID() *refs.ContainerID { + if r != nil { + return r.cid + } + + return nil +} + +func (r *GetRequestBody) SetContainerID(v *refs.ContainerID) { + if r != nil { + r.cid = v + } +} + +func (r *GetRequest) GetBody() *GetRequestBody { + if r != nil { + return r.body + } + + return nil +} + +func (r *GetRequest) SetBody(v *GetRequestBody) { + if r != nil { + r.body = v + } +} + +func (r *GetRequest) GetMetaHeader() *service.RequestMetaHeader { + if r != nil { + return r.metaHeader + } + + return nil +} + +func (r *GetRequest) SetMetaHeader(v *service.RequestMetaHeader) { + if r != nil { + r.metaHeader = v + } +} + +func (r *GetRequest) GetVerificationHeader() *service.RequestVerificationHeader { + if r != nil { + return r.verifyHeader + } + + return nil +} + +func (r *GetRequest) SetVerificationHeader(v *service.RequestVerificationHeader) { + if r != nil { + r.verifyHeader = v + } +} + +func (r *GetResponseBody) GetContainer() *Container { + if r != nil { + return r.cnr + } + + return nil +} + +func (r *GetResponseBody) SetContainer(v *Container) { + if r != nil { + r.cnr = v + } +} + +func (r *GetResponse) GetBody() *GetResponseBody { + if r != nil { + return r.body + } + + return nil +} + +func (r *GetResponse) SetBody(v *GetResponseBody) { + if r != nil { + r.body = v + } +} + +func (r *GetResponse) GetMetaHeader() *service.ResponseMetaHeader { + if r != nil { + return r.metaHeader + } + + return nil +} + +func (r *GetResponse) SetMetaHeader(v *service.ResponseMetaHeader) { + if r != nil { + r.metaHeader = v + } +} + +func (r *GetResponse) GetVerificationHeader() *service.ResponseVerificationHeader { + if r != nil { + return r.verifyHeader + } + + return nil +} + +func (r *GetResponse) SetVerificationHeader(v *service.ResponseVerificationHeader) { + if r != nil { + r.verifyHeader = v + } +} + +func (r *DeleteRequestBody) GetContainerID() *refs.ContainerID { + if r != nil { + return r.cid + } + + return nil +} + +func (r *DeleteRequestBody) SetContainerID(v *refs.ContainerID) { + if r != nil { + r.cid = v + } +} + +func (r *DeleteRequestBody) GetSignature() []byte { + if r != nil { + return r.sig + } + + return nil +} + +func (r *DeleteRequestBody) SetSignature(v []byte) { + if r != nil { + r.sig = v + } +} + +func (r *DeleteRequest) GetBody() *DeleteRequestBody { + if r != nil { + return r.body + } + + return nil +} + +func (r *DeleteRequest) SetBody(v *DeleteRequestBody) { + if r != nil { + r.body = v + } +} + +func (r *DeleteRequest) GetMetaHeader() *service.RequestMetaHeader { + if r != nil { + return r.metaHeader + } + + return nil +} + +func (r *DeleteRequest) SetMetaHeader(v *service.RequestMetaHeader) { + if r != nil { + r.metaHeader = v + } +} + +func (r *DeleteRequest) GetVerificationHeader() *service.RequestVerificationHeader { + if r != nil { + return r.verifyHeader + } + + return nil +} + +func (r *DeleteRequest) SetVerificationHeader(v *service.RequestVerificationHeader) { + if r != nil { + r.verifyHeader = v + } +} + +func (r *DeleteResponse) GetBody() *DeleteResponseBody { + if r != nil { + return r.body + } + + return nil +} + +func (r *DeleteResponse) SetBody(v *DeleteResponseBody) { + if r != nil { + r.body = v + } +} + +func (r *DeleteResponse) GetMetaHeader() *service.ResponseMetaHeader { + if r != nil { + return r.metaHeader + } + + return nil +} + +func (r *DeleteResponse) SetMetaHeader(v *service.ResponseMetaHeader) { + if r != nil { + r.metaHeader = v + } +} + +func (r *DeleteResponse) GetVerificationHeader() *service.ResponseVerificationHeader { + if r != nil { + return r.verifyHeader + } + + return nil +} + +func (r *DeleteResponse) SetVerificationHeader(v *service.ResponseVerificationHeader) { + if r != nil { + r.verifyHeader = v + } +} + +func (r *ListRequestBody) GetOwnerID() *refs.OwnerID { + if r != nil { + return r.ownerID + } + + return nil +} + +func (r *ListRequestBody) SetOwnerID(v *refs.OwnerID) { + if r != nil { + r.ownerID = v + } +} + +func (r *ListRequest) GetBody() *ListRequestBody { + if r != nil { + return r.body + } + + return nil +} + +func (r *ListRequest) SetBody(v *ListRequestBody) { + if r != nil { + r.body = v + } +} + +func (r *ListRequest) GetMetaHeader() *service.RequestMetaHeader { + if r != nil { + return r.metaHeader + } + + return nil +} + +func (r *ListRequest) SetMetaHeader(v *service.RequestMetaHeader) { + if r != nil { + r.metaHeader = v + } +} + +func (r *ListRequest) GetVerificationHeader() *service.RequestVerificationHeader { + if r != nil { + return r.verifyHeader + } + + return nil +} + +func (r *ListRequest) SetVerificationHeader(v *service.RequestVerificationHeader) { + if r != nil { + r.verifyHeader = v + } +} + +func (r *ListResponseBody) GetContainerIDs() []*refs.ContainerID { + if r != nil { + return r.cidList + } + + return nil +} + +func (r *ListResponseBody) SetContainerIDs(v []*refs.ContainerID) { + if r != nil { + r.cidList = v + } +} + +func (r *ListResponse) GetBody() *ListResponseBody { + if r != nil { + return r.body + } + + return nil +} + +func (r *ListResponse) SetBody(v *ListResponseBody) { + if r != nil { + r.body = v + } +} + +func (r *ListResponse) GetMetaHeader() *service.ResponseMetaHeader { + if r != nil { + return r.metaHeader + } + + return nil +} + +func (r *ListResponse) SetMetaHeader(v *service.ResponseMetaHeader) { + if r != nil { + r.metaHeader = v + } +} + +func (r *ListResponse) GetVerificationHeader() *service.ResponseVerificationHeader { + if r != nil { + return r.verifyHeader + } + + return nil +} + +func (r *ListResponse) SetVerificationHeader(v *service.ResponseVerificationHeader) { + if r != nil { + r.verifyHeader = v + } +} + +func (r *SetExtendedACLRequestBody) GetEACL() *acl.Table { + if r != nil { + return r.eacl + } + + return nil +} + +func (r *SetExtendedACLRequestBody) SetEACL(v *acl.Table) { + if r != nil { + r.eacl = v + } +} + +func (r *SetExtendedACLRequestBody) GetSignature() []byte { + if r != nil { + return r.sig + } + + return nil +} + +func (r *SetExtendedACLRequestBody) SetSignature(v []byte) { + if r != nil { + r.sig = v + } +} + +func (r *SetExtendedACLRequest) GetBody() *SetExtendedACLRequestBody { + if r != nil { + return r.body + } + + return nil +} + +func (r *SetExtendedACLRequest) SetBody(v *SetExtendedACLRequestBody) { + if r != nil { + r.body = v + } +} + +func (r *SetExtendedACLRequest) GetMetaHeader() *service.RequestMetaHeader { + if r != nil { + return r.metaHeader + } + + return nil +} + +func (r *SetExtendedACLRequest) SetMetaHeader(v *service.RequestMetaHeader) { + if r != nil { + r.metaHeader = v + } +} + +func (r *SetExtendedACLRequest) GetVerificationHeader() *service.RequestVerificationHeader { + if r != nil { + return r.verifyHeader + } + + return nil +} + +func (r *SetExtendedACLRequest) SetVerificationHeader(v *service.RequestVerificationHeader) { + if r != nil { + r.verifyHeader = v + } +} + +func (r *SetExtendedACLResponse) GetBody() *SetExtendedACLResponseBody { + if r != nil { + return r.body + } + + return nil +} + +func (r *SetExtendedACLResponse) SetBody(v *SetExtendedACLResponseBody) { + if r != nil { + r.body = v + } +} + +func (r *SetExtendedACLResponse) GetMetaHeader() *service.ResponseMetaHeader { + if r != nil { + return r.metaHeader + } + + return nil +} + +func (r *SetExtendedACLResponse) SetMetaHeader(v *service.ResponseMetaHeader) { + if r != nil { + r.metaHeader = v + } +} + +func (r *SetExtendedACLResponse) GetVerificationHeader() *service.ResponseVerificationHeader { + if r != nil { + return r.verifyHeader + } + + return nil +} + +func (r *SetExtendedACLResponse) SetVerificationHeader(v *service.ResponseVerificationHeader) { + if r != nil { + r.verifyHeader = v + } +} + +func (r *GetExtendedACLRequestBody) GetContainerID() *refs.ContainerID { + if r != nil { + return r.cid + } + + return nil +} + +func (r *GetExtendedACLRequestBody) SetContainerID(v *refs.ContainerID) { + if r != nil { + r.cid = v + } +} + +func (r *GetExtendedACLRequest) GetBody() *GetExtendedACLRequestBody { + if r != nil { + return r.body + } + + return nil +} + +func (r *GetExtendedACLRequest) SetBody(v *GetExtendedACLRequestBody) { + if r != nil { + r.body = v + } +} + +func (r *GetExtendedACLRequest) GetMetaHeader() *service.RequestMetaHeader { + if r != nil { + return r.metaHeader + } + + return nil +} + +func (r *GetExtendedACLRequest) SetMetaHeader(v *service.RequestMetaHeader) { + if r != nil { + r.metaHeader = v + } +} + +func (r *GetExtendedACLRequest) GetVerificationHeader() *service.RequestVerificationHeader { + if r != nil { + return r.verifyHeader + } + + return nil +} + +func (r *GetExtendedACLRequest) SetVerificationHeader(v *service.RequestVerificationHeader) { + if r != nil { + r.verifyHeader = v + } +} + +func (r *GetExtendedACLResponseBody) GetEACL() *acl.Table { + if r != nil { + return r.eacl + } + + return nil +} + +func (r *GetExtendedACLResponseBody) SetEACL(v *acl.Table) { + if r != nil { + r.eacl = v + } +} + +func (r *GetExtendedACLResponseBody) GetSignature() []byte { + if r != nil { + return r.sig + } + + return nil +} + +func (r *GetExtendedACLResponseBody) SetSignature(v []byte) { + if r != nil { + r.sig = v + } +} + +func (r *GetExtendedACLResponse) GetBody() *GetExtendedACLResponseBody { + if r != nil { + return r.body + } + + return nil +} + +func (r *GetExtendedACLResponse) SetBody(v *GetExtendedACLResponseBody) { + if r != nil { + r.body = v + } +} + +func (r *GetExtendedACLResponse) GetMetaHeader() *service.ResponseMetaHeader { + if r != nil { + return r.metaHeader + } + + return nil +} + +func (r *GetExtendedACLResponse) SetMetaHeader(v *service.ResponseMetaHeader) { + if r != nil { + r.metaHeader = v + } +} + +func (r *GetExtendedACLResponse) GetVerificationHeader() *service.ResponseVerificationHeader { + if r != nil { + return r.verifyHeader + } + + return nil +} + +func (r *GetExtendedACLResponse) SetVerificationHeader(v *service.ResponseVerificationHeader) { + if r != nil { + r.verifyHeader = v + } +} From b197e382ca794d059c2c92c20dc27105fba44003 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 17 Aug 2020 20:26:25 +0300 Subject: [PATCH 0317/1196] v2/object: Implement uni-structures for Object Signed-off-by: Leonard Lyubich --- v2/object/convert.go | 322 ++++++++++++++++++++++++++++ v2/object/grpc/types.go | 35 +++ v2/object/types.go | 457 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 814 insertions(+) create mode 100644 v2/object/convert.go create mode 100644 v2/object/types.go diff --git a/v2/object/convert.go b/v2/object/convert.go new file mode 100644 index 0000000..b742e0d --- /dev/null +++ b/v2/object/convert.go @@ -0,0 +1,322 @@ +package object + +import ( + object "github.com/nspcc-dev/neofs-api-go/v2/object/grpc" + "github.com/nspcc-dev/neofs-api-go/v2/refs" + refsGRPC "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" + "github.com/nspcc-dev/neofs-api-go/v2/service" +) + +func TypeToGRPCField(t Type) object.ObjectType { + return object.ObjectType(t) +} + +func TypeFromGRPCField(t object.ObjectType) Type { + return Type(t) +} + +func MatchTypeToGRPCField(t MatchType) object.MatchType { + return object.MatchType(t) +} + +func MatchTypeFromGRPCField(t object.MatchType) MatchType { + return MatchType(t) +} + +func ShortHeaderToGRPCMessage(h *ShortHeader) *object.ShortHeader { + if h == nil { + return nil + } + + m := new(object.ShortHeader) + + m.SetVersion( + service.VersionToGRPCMessage(h.GetVersion()), + ) + + m.SetCreationEpoch(h.GetCreationEpoch()) + + m.SetOwnerId( + refs.OwnerIDToGRPCMessage(h.GetOwnerID()), + ) + + m.SetObjectType( + TypeToGRPCField(h.GetObjectType()), + ) + + m.SetPayloadLength(h.GeyPayloadLength()) + + return m +} + +func ShortHeaderFromGRPCMessage(m *object.ShortHeader) *ShortHeader { + if m == nil { + return nil + } + + h := new(ShortHeader) + + h.SetVersion( + service.VersionFromGRPCMessage(m.GetVersion()), + ) + + h.SetCreationEpoch(m.GetCreationEpoch()) + + h.SetOwnerID( + refs.OwnerIDFromGRPCMessage(m.GetOwnerId()), + ) + + h.SetObjectType( + TypeFromGRPCField(m.GetObjectType()), + ) + + h.SetPayloadLength(m.GetPayloadLength()) + + return h +} + +func AttributeToGRPCMessage(a *Attribute) *object.Header_Attribute { + if a == nil { + return nil + } + + m := new(object.Header_Attribute) + + m.SetKey(a.GetKey()) + m.SetValue(a.GetValue()) + + return m +} + +func AttributeFromGRPCMessage(m *object.Header_Attribute) *Attribute { + if m == nil { + return nil + } + + h := new(Attribute) + + h.SetKey(m.GetKey()) + h.SetValue(m.GetValue()) + + return h +} + +func SplitHeaderToGRPCMessage(h *SplitHeader) *object.Header_Split { + if h == nil { + return nil + } + + m := new(object.Header_Split) + + m.SetParent( + refs.ObjectIDToGRPCMessage(h.GetParent()), + ) + + m.SetPrevious( + refs.ObjectIDToGRPCMessage(h.GetPrevious()), + ) + + m.SetParentSignature( + service.SignatureToGRPCMessage(h.GetParentSignature()), + ) + + m.SetParentHeader( + HeaderToGRPCMessage(h.GetParentHeader()), + ) + + children := h.GetChildren() + childMsg := make([]*refsGRPC.ObjectID, 0, len(children)) + + for i := range children { + childMsg = append(childMsg, refs.ObjectIDToGRPCMessage(children[i])) + } + + m.SetChildren(childMsg) + + return m +} + +func SplitHeaderFromGRPCMessage(m *object.Header_Split) *SplitHeader { + if m == nil { + return nil + } + + h := new(SplitHeader) + + h.SetParent( + refs.ObjectIDFromGRPCMessage(m.GetParent()), + ) + + h.SetPrevious( + refs.ObjectIDFromGRPCMessage(m.GetPrevious()), + ) + + h.SetParentSignature( + service.SignatureFromGRPCMessage(m.GetParentSignature()), + ) + + h.SetParentHeader( + HeaderFromGRPCMessage(m.GetParentHeader()), + ) + + childMsg := m.GetChildren() + children := make([]*refs.ObjectID, 0, len(childMsg)) + + for i := range childMsg { + children = append(children, refs.ObjectIDFromGRPCMessage(childMsg[i])) + } + + h.SetChildren(children) + + return h +} + +func HeaderToGRPCMessage(h *Header) *object.Header { + if h == nil { + return nil + } + + m := new(object.Header) + + m.SetVersion( + service.VersionToGRPCMessage(h.GetVersion()), + ) + + m.SetContainerId( + refs.ContainerIDToGRPCMessage(h.GetContainerID()), + ) + + m.SetOwnerId( + refs.OwnerIDToGRPCMessage(h.GetOwnerID()), + ) + + m.SetCreationEpoch(h.GetCreationEpoch()) + + m.SetPayloadLength(h.GetPayloadLength()) + + m.SetPayloadHash(h.GetPayloadHash()) + + m.SetHomomorphicHash(h.GetHomomorphicHash()) + + m.SetObjectType( + TypeToGRPCField(h.GetObjectType()), + ) + + m.SetSessionToken( + service.SessionTokenToGRPCMessage(h.GetSessionToken()), + ) + + attr := h.GetAttributes() + attrMsg := make([]*object.Header_Attribute, 0, len(attr)) + + for i := range attr { + attrMsg = append(attrMsg, AttributeToGRPCMessage(attr[i])) + } + + m.SetAttributes(attrMsg) + + m.SetSplit( + SplitHeaderToGRPCMessage(h.GetSplit()), + ) + + return m +} + +func HeaderFromGRPCMessage(m *object.Header) *Header { + if m == nil { + return nil + } + + h := new(Header) + + h.SetVersion( + service.VersionFromGRPCMessage(m.GetVersion()), + ) + + h.SetContainerID( + refs.ContainerIDFromGRPCMessage(m.GetContainerId()), + ) + + h.SetOwnerID( + refs.OwnerIDFromGRPCMessage(m.GetOwnerId()), + ) + + h.SetCreationEpoch(m.GetCreationEpoch()) + + h.SetPayloadLength(m.GetPayloadLength()) + + h.SetPayloadHash(m.GetPayloadHash()) + + h.SetHomomorphicHash(m.GetHomomorphicHash()) + + h.SetObjectType( + TypeFromGRPCField(m.GetObjectType()), + ) + + h.SetSessionToken( + service.SessionTokenFromGRPCMessage(m.GetSessionToken()), + ) + + attrMsg := m.GetAttributes() + attr := make([]*Attribute, 0, len(attrMsg)) + + for i := range attrMsg { + attr = append(attr, AttributeFromGRPCMessage(attrMsg[i])) + } + + h.SetAttributes(attr) + + h.SetSplit( + SplitHeaderFromGRPCMessage(m.GetSplit()), + ) + + return h +} + +func ObjectToGRPCMessage(o *Object) *object.Object { + if o == nil { + return nil + } + + m := new(object.Object) + + m.SetObjectId( + refs.ObjectIDToGRPCMessage(o.GetObjectID()), + ) + + m.SetSignature( + service.SignatureToGRPCMessage(o.GetSignature()), + ) + + m.SetHeader( + HeaderToGRPCMessage(o.GetHeader()), + ) + + m.SetPayload(o.GetPayload()) + + return m +} + +func ObjectFromGRPCMessage(m *object.Object) *Object { + if m == nil { + return nil + } + + o := new(Object) + + o.SetObjectID( + refs.ObjectIDFromGRPCMessage(m.GetObjectId()), + ) + + o.SetSignature( + service.SignatureFromGRPCMessage(m.GetSignature()), + ) + + o.SetHeader( + HeaderFromGRPCMessage(m.GetHeader()), + ) + + o.SetPayload(m.GetPayload()) + + return o +} diff --git a/v2/object/grpc/types.go b/v2/object/grpc/types.go index c857b8a..b5197f6 100644 --- a/v2/object/grpc/types.go +++ b/v2/object/grpc/types.go @@ -158,3 +158,38 @@ func (m *Object) SetPayload(v []byte) { m.Payload = v } } + +// SetVersion sets version of the object. +func (m *ShortHeader) SetVersion(v *service.Version) { + if m != nil { + m.Version = v + } +} + +// SetCreationEpoch sets creation epoch number. +func (m *ShortHeader) SetCreationEpoch(v uint64) { + if m != nil { + m.CreationEpoch = v + } +} + +// SetOwnerId sets identifier of the object owner. +func (m *ShortHeader) SetOwnerId(v *refs.OwnerID) { + if m != nil { + m.OwnerId = v + } +} + +// SetObjectType sets type of the object. +func (m *ShortHeader) SetObjectType(v ObjectType) { + if m != nil { + m.ObjectType = v + } +} + +// SetPayloadLength sets length of the object payload. +func (m *ShortHeader) SetPayloadLength(v uint64) { + if m != nil { + m.PayloadLength = v + } +} diff --git a/v2/object/types.go b/v2/object/types.go new file mode 100644 index 0000000..191457b --- /dev/null +++ b/v2/object/types.go @@ -0,0 +1,457 @@ +package object + +import ( + "github.com/nspcc-dev/neofs-api-go/v2/refs" + "github.com/nspcc-dev/neofs-api-go/v2/service" +) + +type Type uint32 + +type MatchType uint32 + +type ShortHeader struct { + version *service.Version + + creatEpoch uint64 + + ownerID *refs.OwnerID + + typ Type + + payloadLen uint64 +} + +type Attribute struct { + key, val string +} + +type SplitHeader struct { + par, prev *refs.ObjectID + + parSig *service.Signature + + parHdr *Header + + children []*refs.ObjectID +} + +type Header struct { + version *service.Version + + cid *refs.ContainerID + + ownerID *refs.OwnerID + + creatEpoch uint64 + + payloadLen uint64 + + payloadHash, homoHash []byte + + typ Type + + sessionToken *service.SessionToken + + attr []*Attribute + + split *SplitHeader +} + +type Object struct { + objectID *refs.ObjectID + + idSig *service.Signature + + header *Header + + payload []byte +} + +const ( + TypeRegular Type = iota + TypeTombstone + TypeStorageGroup +) + +const ( + MatchUnknown MatchType = iota + MatchStringEqual +) + +func (h *ShortHeader) GetVersion() *service.Version { + if h != nil { + return h.version + } + + return nil +} + +func (h *ShortHeader) SetVersion(v *service.Version) { + if h != nil { + h.SetVersion(v) + } +} + +func (h *ShortHeader) GetCreationEpoch() uint64 { + if h != nil { + return h.creatEpoch + } + + return 0 +} + +func (h *ShortHeader) SetCreationEpoch(v uint64) { + if h != nil { + h.creatEpoch = v + } +} + +func (h *ShortHeader) GetOwnerID() *refs.OwnerID { + if h != nil { + return h.ownerID + } + + return nil +} + +func (h *ShortHeader) SetOwnerID(v *refs.OwnerID) { + if h != nil { + h.ownerID = v + } +} + +func (h *ShortHeader) GetObjectType() Type { + if h != nil { + return h.typ + } + + return TypeRegular +} + +func (h *ShortHeader) SetObjectType(v Type) { + if h != nil { + h.typ = v + } +} + +func (h *ShortHeader) GeyPayloadLength() uint64 { + if h != nil { + return h.payloadLen + } + + return 0 +} + +func (h *ShortHeader) SetPayloadLength(v uint64) { + if h != nil { + h.payloadLen = v + } +} + +func (a *Attribute) GetKey() string { + if a != nil { + return a.key + } + + return "" +} + +func (a *Attribute) SetKey(v string) { + if a != nil { + a.key = v + } +} + +func (a *Attribute) GetValue() string { + if a != nil { + return a.val + } + + return "" +} + +func (a *Attribute) SetValue(v string) { + if a != nil { + a.val = v + } +} + +func (h *SplitHeader) GetParent() *refs.ObjectID { + if h != nil { + return h.par + } + + return nil +} + +func (h *SplitHeader) SetParent(v *refs.ObjectID) { + if h != nil { + h.par = v + } +} + +func (h *SplitHeader) GetPrevious() *refs.ObjectID { + if h != nil { + return h.prev + } + + return nil +} + +func (h *SplitHeader) SetPrevious(v *refs.ObjectID) { + if h != nil { + h.prev = v + } +} + +func (h *SplitHeader) GetParentSignature() *service.Signature { + if h != nil { + return h.parSig + } + + return nil +} + +func (h *SplitHeader) SetParentSignature(v *service.Signature) { + if h != nil { + h.parSig = v + } +} + +func (h *SplitHeader) GetParentHeader() *Header { + if h != nil { + return h.parHdr + } + + return nil +} + +func (h *SplitHeader) SetParentHeader(v *Header) { + if h != nil { + h.parHdr = v + } +} + +func (h *SplitHeader) GetChildren() []*refs.ObjectID { + if h != nil { + return h.children + } + + return nil +} + +func (h *SplitHeader) SetChildren(v []*refs.ObjectID) { + if h != nil { + h.children = v + } +} + +func (h *Header) GetVersion() *service.Version { + if h != nil { + return h.version + } + + return nil +} + +func (h *Header) SetVersion(v *service.Version) { + if h != nil { + h.version = v + } +} + +func (h *Header) GetContainerID() *refs.ContainerID { + if h != nil { + return h.cid + } + + return nil +} + +func (h *Header) SetContainerID(v *refs.ContainerID) { + if h != nil { + h.cid = v + } +} + +func (h *Header) GetOwnerID() *refs.OwnerID { + if h != nil { + return h.ownerID + } + + return nil +} + +func (h *Header) SetOwnerID(v *refs.OwnerID) { + if h != nil { + h.ownerID = v + } +} + +func (h *Header) GetCreationEpoch() uint64 { + if h != nil { + return h.creatEpoch + } + + return 0 +} + +func (h *Header) SetCreationEpoch(v uint64) { + if h != nil { + h.creatEpoch = v + } +} + +func (h *Header) GetPayloadLength() uint64 { + if h != nil { + return h.payloadLen + } + + return 0 +} + +func (h *Header) SetPayloadLength(v uint64) { + if h != nil { + h.payloadLen = v + } +} + +func (h *Header) GetPayloadHash() []byte { + if h != nil { + return h.payloadHash + } + + return nil +} + +func (h *Header) SetPayloadHash(v []byte) { + if h != nil { + h.payloadHash = v + } +} + +func (h *Header) GetObjectType() Type { + if h != nil { + return h.typ + } + + return TypeRegular +} + +func (h *Header) SetObjectType(v Type) { + if h != nil { + h.typ = v + } +} + +func (h *Header) GetHomomorphicHash() []byte { + if h != nil { + return h.homoHash + } + + return nil +} + +func (h *Header) SetHomomorphicHash(v []byte) { + if h != nil { + h.homoHash = v + } +} + +func (h *Header) GetSessionToken() *service.SessionToken { + if h != nil { + return h.sessionToken + } + + return nil +} + +func (h *Header) SetSessionToken(v *service.SessionToken) { + if h != nil { + h.sessionToken = v + } +} + +func (h *Header) GetAttributes() []*Attribute { + if h != nil { + return h.attr + } + + return nil +} + +func (h *Header) SetAttributes(v []*Attribute) { + if h != nil { + h.attr = v + } +} + +func (h *Header) GetSplit() *SplitHeader { + if h != nil { + return h.split + } + + return nil +} + +func (h *Header) SetSplit(v *SplitHeader) { + if h != nil { + h.split = v + } +} + +func (o *Object) GetObjectID() *refs.ObjectID { + if o != nil { + return o.objectID + } + + return nil +} + +func (o *Object) SetObjectID(v *refs.ObjectID) { + if o != nil { + o.objectID = v + } +} + +func (o *Object) GetSignature() *service.Signature { + if o != nil { + return o.idSig + } + + return nil +} + +func (o *Object) SetSignature(v *service.Signature) { + if o != nil { + o.idSig = v + } +} + +func (o *Object) GetHeader() *Header { + if o != nil { + return o.header + } + + return nil +} + +func (o *Object) SetHeader(v *Header) { + if o != nil { + o.header = v + } +} + +func (o *Object) GetPayload() []byte { + if o != nil { + return o.payload + } + + return nil +} + +func (o *Object) SetPayload(v []byte) { + if o != nil { + o.payload = v + } +} From c96598713ed8bbbe1a3d90edb07a187da9976ad9 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Mon, 17 Aug 2020 20:23:42 +0300 Subject: [PATCH 0318/1196] Fix missed x-header set in converters Signed-off-by: Alex Vanin --- v2/service/convert.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/v2/service/convert.go b/v2/service/convert.go index 91b173b..93313ff 100644 --- a/v2/service/convert.go +++ b/v2/service/convert.go @@ -217,6 +217,8 @@ func RequestMetaHeaderToGRPCMessage(r *RequestMetaHeader) *service.RequestMetaHe xHdrMsg = append(xHdrMsg, XHeaderToGRPCMessage(xHeaders[i])) } + m.SetXHeaders(xHdrMsg) + return m } @@ -253,6 +255,8 @@ func RequestMetaHeaderFromGRPCMessage(m *service.RequestMetaHeader) *RequestMeta xHeaders = append(xHeaders, XHeaderFromGRPCMessage(xHdrMsg[i])) } + r.SetXHeaders(xHeaders) + return r } @@ -469,6 +473,8 @@ func ResponseMetaHeaderToGRPCMessage(r *ResponseMetaHeader) *service.ResponseMet xHdrMsg = append(xHdrMsg, XHeaderToGRPCMessage(xHeaders[i])) } + m.SetXHeaders(xHdrMsg) + return m } @@ -497,6 +503,8 @@ func ResponseMetaHeaderFromGRPCMessage(m *service.ResponseMetaHeader) *ResponseM xHeaders = append(xHeaders, XHeaderFromGRPCMessage(xHdrMsg[i])) } + r.SetXHeaders(xHeaders) + return r } From c214d4d7633911185191c1fd281c0663f92b0f5c Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Mon, 17 Aug 2020 20:23:58 +0300 Subject: [PATCH 0319/1196] Add stable marshal for service package Signed-off-by: Alex Vanin --- v2/service/marshal.go | 1118 ++++++++++++++++++++++++++++++++++++ v2/service/marshal_test.go | 401 +++++++++++++ v2/service/service.go | 68 +-- 3 files changed, 1537 insertions(+), 50 deletions(-) create mode 100644 v2/service/marshal.go create mode 100644 v2/service/marshal_test.go diff --git a/v2/service/marshal.go b/v2/service/marshal.go new file mode 100644 index 0000000..241b292 --- /dev/null +++ b/v2/service/marshal.go @@ -0,0 +1,1118 @@ +package service + +import ( + "encoding/binary" + + "github.com/nspcc-dev/neofs-api-go/util/proto" +) + +const ( + signatureKeyField = 1 + signatureValueField = 2 + + versionMajorField = 1 + versionMinorField = 2 + + xheaderKeyField = 1 + xheaderValueField = 2 + + lifetimeExpirationField = 1 + lifetimeNotValidBeforeField = 2 + lifetimeIssuedAtField = 3 + + objectCtxVerbField = 1 + objectCtxAddressField = 2 + + sessionTokenBodyIDField = 1 + sessionTokenBodyOwnerField = 2 + sessionTokenBodyLifetimeField = 3 + sessionTokenBodyKeyField = 4 + sessionTokenBodyObjectCtxField = 5 + + sessionTokenBodyField = 1 + sessionTokenSignatureField = 2 + + bearerTokenBodyACLField = 1 + bearerTokenBodyOwnerField = 2 + bearerTokenBodyLifetimeField = 3 + + bearerTokenBodyField = 1 + bearerTokenSignatureField = 2 + + reqMetaHeaderVersionField = 1 + reqMetaHeaderEpochField = 2 + reqMetaHeaderTTLField = 3 + reqMetaHeaderXHeadersField = 4 + reqMetaHeaderSessionTokenField = 5 + reqMetaHeaderBearerTokenField = 6 + reqMetaHeaderOriginField = 7 + + reqVerifHeaderBodySignatureField = 1 + reqVerifHeaderMetaSignatureField = 2 + reqVerifHeaderOriginSignatureField = 3 + reqVerifHeaderOriginField = 4 + + respMetaHeaderVersionField = 1 + respMetaHeaderEpochField = 2 + respMetaHeaderTTLField = 3 + respMetaHeaderXHeadersField = 4 + respMetaHeaderOriginField = 5 + + respVerifHeaderBodySignatureField = 1 + respVerifHeaderMetaSignatureField = 2 + respVerifHeaderOriginSignatureField = 3 + respVerifHeaderOriginField = 4 +) + +func (s *Signature) StableMarshal(buf []byte) ([]byte, error) { + if s == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, s.StableSize()) + } + + var ( + offset, n int + err error + ) + + n, err = proto.BytesMarshal(signatureKeyField, buf, s.key) + if err != nil { + return nil, err + } + + offset += n + + _, err = proto.BytesMarshal(signatureValueField, buf[offset:], s.sign) + if err != nil { + return nil, err + } + + return buf, nil +} + +func (s *Signature) StableSize() (size int) { + if s == nil { + return 0 + } + + size += proto.BytesSize(signatureKeyField, s.key) + size += proto.BytesSize(signatureValueField, s.sign) + + return size +} + +func (v *Version) StableMarshal(buf []byte) ([]byte, error) { + if v == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, v.StableSize()) + } + + var ( + offset, n int + err error + ) + + n, err = proto.UInt32Marshal(versionMajorField, buf, v.major) + if err != nil { + return nil, err + } + + offset += n + + _, err = proto.UInt32Marshal(versionMinorField, buf[offset:], v.minor) + if err != nil { + return nil, err + } + + return buf, nil +} + +func (v *Version) StableSize() (size int) { + if v == nil { + return 0 + } + + size += proto.UInt32Size(versionMajorField, v.major) + size += proto.UInt32Size(versionMinorField, v.minor) + + return size +} + +func (x *XHeader) StableMarshal(buf []byte) ([]byte, error) { + if x == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, x.StableSize()) + } + + var ( + offset, n int + err error + ) + + n, err = proto.StringMarshal(xheaderKeyField, buf, x.key) + if err != nil { + return nil, err + } + + offset += n + + _, err = proto.StringMarshal(xheaderValueField, buf[offset:], x.val) + if err != nil { + return nil, err + } + + return buf, nil +} + +func (x *XHeader) StableSize() (size int) { + if x == nil { + return 0 + } + + size += proto.StringSize(xheaderKeyField, x.key) + size += proto.StringSize(xheaderValueField, x.val) + + return size +} + +func (l *TokenLifetime) StableMarshal(buf []byte) ([]byte, error) { + if l == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, l.StableSize()) + } + + var ( + offset, n int + err error + ) + + n, err = proto.UInt64Marshal(lifetimeExpirationField, buf, l.exp) + if err != nil { + return nil, err + } + + offset += n + + n, err = proto.UInt64Marshal(lifetimeNotValidBeforeField, buf[offset:], l.nbf) + if err != nil { + return nil, err + } + + offset += n + + _, err = proto.UInt64Marshal(lifetimeIssuedAtField, buf[offset:], l.iat) + if err != nil { + return nil, err + } + + return buf, nil +} + +func (l *TokenLifetime) StableSize() (size int) { + if l == nil { + return 0 + } + + size += proto.UInt64Size(lifetimeExpirationField, l.exp) + size += proto.UInt64Size(lifetimeNotValidBeforeField, l.nbf) + size += proto.UInt64Size(lifetimeIssuedAtField, l.iat) + + return size +} + +func (c *ObjectSessionContext) StableMarshal(buf []byte) ([]byte, error) { + if c == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, c.StableSize()) + } + + var ( + offset, n int + prefix uint64 + err error + ) + + n, err = proto.EnumMarshal(objectCtxVerbField, buf, int32(c.verb)) + if err != nil { + return nil, err + } + + offset += n + + if c.addr != nil { + prefix, _ = proto.NestedStructurePrefix(objectCtxAddressField) + offset += binary.PutUvarint(buf[offset:], prefix) + + n = c.addr.StableSize() + offset += binary.PutUvarint(buf[offset:], uint64(n)) + + _, err = c.addr.StableMarshal(buf[offset:]) + if err != nil { + return nil, err + + } + } + + return buf, nil +} + +func (c *ObjectSessionContext) StableSize() (size int) { + if c == nil { + return 0 + } + + size += proto.EnumSize(objectCtxVerbField, int32(c.verb)) + + if c.addr != nil { + _, ln := proto.NestedStructurePrefix(objectCtxAddressField) + n := c.addr.StableSize() + size += ln + proto.VarUIntSize(uint64(n)) + n + } + + return size +} + +func (t *SessionTokenBody) StableMarshal(buf []byte) ([]byte, error) { + if t == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, t.StableSize()) + } + + var ( + offset, n int + prefix uint64 + err error + ) + + n, err = proto.BytesMarshal(sessionTokenBodyIDField, buf, t.id) + if err != nil { + return nil, err + } + + offset += n + + if t.ownerID != nil { + prefix, _ = proto.NestedStructurePrefix(sessionTokenBodyOwnerField) + offset += binary.PutUvarint(buf[offset:], prefix) + + n = t.ownerID.StableSize() + offset += binary.PutUvarint(buf[offset:], uint64(n)) + + _, err = t.ownerID.StableMarshal(buf[offset:]) + if err != nil { + return nil, err + + } + + offset += n + } + + if t.lifetime != nil { + prefix, _ = proto.NestedStructurePrefix(sessionTokenBodyLifetimeField) + offset += binary.PutUvarint(buf[offset:], prefix) + + n = t.lifetime.StableSize() + offset += binary.PutUvarint(buf[offset:], uint64(n)) + + _, err = t.lifetime.StableMarshal(buf[offset:]) + if err != nil { + return nil, err + + } + + offset += n + } + + n, err = proto.BytesMarshal(sessionTokenBodyKeyField, buf[offset:], t.sessionKey) + if err != nil { + return nil, err + } + + offset += n + + if t.ctx != nil { + switch v := t.ctx.(type) { + case *ObjectSessionContext: + prefix, _ = proto.NestedStructurePrefix(sessionTokenBodyObjectCtxField) + offset += binary.PutUvarint(buf[offset:], prefix) + + n = v.StableSize() + offset += binary.PutUvarint(buf[offset:], uint64(n)) + + _, err = v.StableMarshal(buf[offset:]) + if err != nil { + return nil, err + + } + default: + panic("cannot marshal unknown session token context") + } + } + + return buf, nil +} + +func (t *SessionTokenBody) StableSize() (size int) { + if t == nil { + return 0 + } + + size += proto.BytesSize(sessionTokenBodyIDField, t.id) + + if t.ownerID != nil { + _, ln := proto.NestedStructurePrefix(sessionTokenBodyOwnerField) + n := t.ownerID.StableSize() + size += ln + proto.VarUIntSize(uint64(n)) + n + } + + if t.lifetime != nil { + _, ln := proto.NestedStructurePrefix(sessionTokenBodyLifetimeField) + n := t.lifetime.StableSize() + size += ln + proto.VarUIntSize(uint64(n)) + n + } + + size += proto.BytesSize(sessionTokenBodyKeyField, t.sessionKey) + + if t.ctx != nil { + switch v := t.ctx.(type) { + case *ObjectSessionContext: + _, ln := proto.NestedStructurePrefix(sessionTokenBodyObjectCtxField) + n := v.StableSize() + size += ln + proto.VarUIntSize(uint64(n)) + n + default: + panic("cannot marshal unknown session token context") + } + } + + return size +} + +func (t *SessionToken) StableMarshal(buf []byte) ([]byte, error) { + if t == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, t.StableSize()) + } + + var ( + offset, n int + prefix uint64 + err error + ) + + if t.body != nil { + prefix, _ = proto.NestedStructurePrefix(sessionTokenBodyField) + offset += binary.PutUvarint(buf[offset:], prefix) + + n = t.body.StableSize() + offset += binary.PutUvarint(buf[offset:], uint64(n)) + + _, err = t.body.StableMarshal(buf[offset:]) + if err != nil { + return nil, err + + } + + offset += n + } + + if t.sig != nil { + prefix, _ = proto.NestedStructurePrefix(sessionTokenSignatureField) + offset += binary.PutUvarint(buf[offset:], prefix) + + n = t.sig.StableSize() + offset += binary.PutUvarint(buf[offset:], uint64(n)) + + _, err = t.sig.StableMarshal(buf[offset:]) + if err != nil { + return nil, err + + } + } + + return buf, nil +} + +func (t *SessionToken) StableSize() (size int) { + if t == nil { + return 0 + } + + if t.body != nil { + _, ln := proto.NestedStructurePrefix(sessionTokenBodyField) + n := t.body.StableSize() + size += ln + proto.VarUIntSize(uint64(n)) + n + } + + if t.sig != nil { + _, ln := proto.NestedStructurePrefix(sessionTokenSignatureField) + n := t.sig.StableSize() + size += ln + proto.VarUIntSize(uint64(n)) + n + } + + return size +} + +func (bt *BearerTokenBody) StableMarshal(buf []byte) ([]byte, error) { + if bt == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, bt.StableSize()) + } + + var ( + offset, n int + prefix uint64 + err error + ) + + if bt.eacl != nil { + prefix, _ = proto.NestedStructurePrefix(bearerTokenBodyACLField) + offset += binary.PutUvarint(buf[offset:], prefix) + + n = bt.eacl.StableSize() + offset += binary.PutUvarint(buf[offset:], uint64(n)) + + _, err = bt.eacl.StableMarshal(buf[offset:]) + if err != nil { + return nil, err + + } + + offset += n + } + + if bt.ownerID != nil { + prefix, _ = proto.NestedStructurePrefix(bearerTokenBodyOwnerField) + offset += binary.PutUvarint(buf[offset:], prefix) + + n = bt.ownerID.StableSize() + offset += binary.PutUvarint(buf[offset:], uint64(n)) + + _, err = bt.ownerID.StableMarshal(buf[offset:]) + if err != nil { + return nil, err + + } + + offset += n + } + + if bt.lifetime != nil { + prefix, _ = proto.NestedStructurePrefix(bearerTokenBodyLifetimeField) + offset += binary.PutUvarint(buf[offset:], prefix) + + n = bt.lifetime.StableSize() + offset += binary.PutUvarint(buf[offset:], uint64(n)) + + _, err = bt.lifetime.StableMarshal(buf[offset:]) + if err != nil { + return nil, err + + } + } + + return buf, nil +} + +func (bt *BearerTokenBody) StableSize() (size int) { + if bt == nil { + return 0 + } + + if bt.eacl != nil { + _, ln := proto.NestedStructurePrefix(bearerTokenBodyACLField) + n := bt.eacl.StableSize() + size += ln + proto.VarUIntSize(uint64(n)) + n + } + + if bt.ownerID != nil { + _, ln := proto.NestedStructurePrefix(bearerTokenBodyOwnerField) + n := bt.ownerID.StableSize() + size += ln + proto.VarUIntSize(uint64(n)) + n + } + + if bt.lifetime != nil { + _, ln := proto.NestedStructurePrefix(bearerTokenBodyLifetimeField) + n := bt.lifetime.StableSize() + size += ln + proto.VarUIntSize(uint64(n)) + n + } + + return size +} + +func (bt *BearerToken) StableMarshal(buf []byte) ([]byte, error) { + if bt == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, bt.StableSize()) + } + + var ( + offset, n int + prefix uint64 + err error + ) + + if bt.body != nil { + prefix, _ = proto.NestedStructurePrefix(bearerTokenBodyField) + offset += binary.PutUvarint(buf[offset:], prefix) + + n = bt.body.StableSize() + offset += binary.PutUvarint(buf[offset:], uint64(n)) + + _, err = bt.body.StableMarshal(buf[offset:]) + if err != nil { + return nil, err + + } + + offset += n + } + + if bt.sig != nil { + prefix, _ = proto.NestedStructurePrefix(bearerTokenSignatureField) + offset += binary.PutUvarint(buf[offset:], prefix) + + n = bt.sig.StableSize() + offset += binary.PutUvarint(buf[offset:], uint64(n)) + + _, err = bt.sig.StableMarshal(buf[offset:]) + if err != nil { + return nil, err + + } + } + + return buf, nil +} + +func (bt *BearerToken) StableSize() (size int) { + if bt == nil { + return 0 + } + + if bt.body != nil { + _, ln := proto.NestedStructurePrefix(bearerTokenBodyField) + n := bt.body.StableSize() + size += ln + proto.VarUIntSize(uint64(n)) + n + } + + if bt.sig != nil { + _, ln := proto.NestedStructurePrefix(bearerTokenSignatureField) + n := bt.sig.StableSize() + size += ln + proto.VarUIntSize(uint64(n)) + n + } + + return size +} + +func (r *RequestMetaHeader) StableMarshal(buf []byte) ([]byte, error) { + if r == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, r.StableSize()) + } + + var ( + offset, n int + prefix uint64 + err error + ) + + if r.version != nil { + prefix, _ = proto.NestedStructurePrefix(reqMetaHeaderVersionField) + offset += binary.PutUvarint(buf[offset:], prefix) + + n = r.version.StableSize() + offset += binary.PutUvarint(buf[offset:], uint64(n)) + + _, err = r.version.StableMarshal(buf[offset:]) + if err != nil { + return nil, err + + } + + offset += n + } + + n, err = proto.UInt64Marshal(reqMetaHeaderEpochField, buf[offset:], r.epoch) + if err != nil { + return nil, err + } + + offset += n + + n, err = proto.UInt32Marshal(reqMetaHeaderTTLField, buf[offset:], r.ttl) + if err != nil { + return nil, err + } + + offset += n + + prefix, _ = proto.NestedStructurePrefix(reqMetaHeaderXHeadersField) + + for i := range r.xHeaders { + offset += binary.PutUvarint(buf[offset:], prefix) + + n = r.xHeaders[i].StableSize() + offset += binary.PutUvarint(buf[offset:], uint64(n)) + + _, err = r.xHeaders[i].StableMarshal(buf[offset:]) + if err != nil { + return nil, err + + } + + offset += n + } + + if r.sessionToken != nil { + prefix, _ = proto.NestedStructurePrefix(reqMetaHeaderSessionTokenField) + offset += binary.PutUvarint(buf[offset:], prefix) + + n = r.sessionToken.StableSize() + offset += binary.PutUvarint(buf[offset:], uint64(n)) + + _, err = r.sessionToken.StableMarshal(buf[offset:]) + if err != nil { + return nil, err + + } + + offset += n + } + + if r.bearerToken != nil { + prefix, _ = proto.NestedStructurePrefix(reqMetaHeaderBearerTokenField) + offset += binary.PutUvarint(buf[offset:], prefix) + + n = r.bearerToken.StableSize() + offset += binary.PutUvarint(buf[offset:], uint64(n)) + + _, err = r.bearerToken.StableMarshal(buf[offset:]) + if err != nil { + return nil, err + + } + + offset += n + } + + if r.origin != nil { + prefix, _ = proto.NestedStructurePrefix(reqMetaHeaderOriginField) + offset += binary.PutUvarint(buf[offset:], prefix) + + n = r.origin.StableSize() + offset += binary.PutUvarint(buf[offset:], uint64(n)) + + _, err = r.origin.StableMarshal(buf[offset:]) + if err != nil { + return nil, err + + } + } + + return buf, nil +} + +func (r *RequestMetaHeader) StableSize() (size int) { + if r == nil { + return 0 + } + + if r.version != nil { + _, ln := proto.NestedStructurePrefix(reqMetaHeaderVersionField) + n := r.version.StableSize() + size += ln + proto.VarUIntSize(uint64(n)) + n + } + + size += proto.UInt64Size(reqMetaHeaderEpochField, r.epoch) + size += proto.UInt32Size(reqMetaHeaderTTLField, r.ttl) + + _, ln := proto.NestedStructurePrefix(reqMetaHeaderXHeadersField) + + for i := range r.xHeaders { + n := r.xHeaders[i].StableSize() + size += ln + proto.VarUIntSize(uint64(n)) + n + } + + if r.sessionToken != nil { + _, ln := proto.NestedStructurePrefix(reqMetaHeaderSessionTokenField) + n := r.sessionToken.StableSize() + size += ln + proto.VarUIntSize(uint64(n)) + n + } + + if r.bearerToken != nil { + _, ln := proto.NestedStructurePrefix(reqMetaHeaderBearerTokenField) + n := r.bearerToken.StableSize() + size += ln + proto.VarUIntSize(uint64(n)) + n + } + + if r.origin != nil { + _, ln := proto.NestedStructurePrefix(reqMetaHeaderOriginField) + n := r.origin.StableSize() + size += ln + proto.VarUIntSize(uint64(n)) + n + } + + return size +} + +func (r *RequestVerificationHeader) StableMarshal(buf []byte) ([]byte, error) { + if r == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, r.StableSize()) + } + + var ( + offset, n int + prefix uint64 + err error + ) + + if r.bodySig != nil { + prefix, _ = proto.NestedStructurePrefix(reqVerifHeaderBodySignatureField) + offset += binary.PutUvarint(buf[offset:], prefix) + + n = r.bodySig.StableSize() + offset += binary.PutUvarint(buf[offset:], uint64(n)) + + _, err = r.bodySig.StableMarshal(buf[offset:]) + if err != nil { + return nil, err + + } + + offset += n + } + + if r.metaSig != nil { + prefix, _ = proto.NestedStructurePrefix(reqVerifHeaderMetaSignatureField) + offset += binary.PutUvarint(buf[offset:], prefix) + + n = r.metaSig.StableSize() + offset += binary.PutUvarint(buf[offset:], uint64(n)) + + _, err = r.metaSig.StableMarshal(buf[offset:]) + if err != nil { + return nil, err + + } + + offset += n + } + + if r.originSig != nil { + prefix, _ = proto.NestedStructurePrefix(reqVerifHeaderOriginSignatureField) + offset += binary.PutUvarint(buf[offset:], prefix) + + n = r.originSig.StableSize() + offset += binary.PutUvarint(buf[offset:], uint64(n)) + + _, err = r.originSig.StableMarshal(buf[offset:]) + if err != nil { + return nil, err + + } + + offset += n + } + + if r.origin != nil { + prefix, _ = proto.NestedStructurePrefix(reqVerifHeaderOriginField) + offset += binary.PutUvarint(buf[offset:], prefix) + + n = r.origin.StableSize() + offset += binary.PutUvarint(buf[offset:], uint64(n)) + + _, err = r.origin.StableMarshal(buf[offset:]) + if err != nil { + return nil, err + + } + } + + return buf, nil +} + +func (r *RequestVerificationHeader) StableSize() (size int) { + if r == nil { + return 0 + } + + if r.bodySig != nil { + _, ln := proto.NestedStructurePrefix(reqVerifHeaderBodySignatureField) + n := r.bodySig.StableSize() + size += ln + proto.VarUIntSize(uint64(n)) + n + } + + if r.metaSig != nil { + _, ln := proto.NestedStructurePrefix(reqVerifHeaderMetaSignatureField) + n := r.metaSig.StableSize() + size += ln + proto.VarUIntSize(uint64(n)) + n + } + + if r.originSig != nil { + _, ln := proto.NestedStructurePrefix(reqVerifHeaderOriginSignatureField) + n := r.originSig.StableSize() + size += ln + proto.VarUIntSize(uint64(n)) + n + } + + if r.origin != nil { + _, ln := proto.NestedStructurePrefix(reqVerifHeaderOriginField) + n := r.origin.StableSize() + size += ln + proto.VarUIntSize(uint64(n)) + n + } + + return size +} + +func (r *ResponseMetaHeader) StableMarshal(buf []byte) ([]byte, error) { + if r == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, r.StableSize()) + } + + var ( + offset, n int + prefix uint64 + err error + ) + + if r.version != nil { + prefix, _ = proto.NestedStructurePrefix(respMetaHeaderVersionField) + offset += binary.PutUvarint(buf[offset:], prefix) + + n = r.version.StableSize() + offset += binary.PutUvarint(buf[offset:], uint64(n)) + + _, err = r.version.StableMarshal(buf[offset:]) + if err != nil { + return nil, err + + } + + offset += n + } + + n, err = proto.UInt64Marshal(respMetaHeaderEpochField, buf[offset:], r.epoch) + if err != nil { + return nil, err + } + + offset += n + + n, err = proto.UInt32Marshal(respMetaHeaderTTLField, buf[offset:], r.ttl) + if err != nil { + return nil, err + } + + offset += n + + prefix, _ = proto.NestedStructurePrefix(respMetaHeaderXHeadersField) + + for i := range r.xHeaders { + offset += binary.PutUvarint(buf[offset:], prefix) + + n = r.xHeaders[i].StableSize() + offset += binary.PutUvarint(buf[offset:], uint64(n)) + + _, err = r.xHeaders[i].StableMarshal(buf[offset:]) + if err != nil { + return nil, err + + } + + offset += n + } + + if r.origin != nil { + prefix, _ = proto.NestedStructurePrefix(respMetaHeaderOriginField) + offset += binary.PutUvarint(buf[offset:], prefix) + + n = r.origin.StableSize() + offset += binary.PutUvarint(buf[offset:], uint64(n)) + + _, err = r.origin.StableMarshal(buf[offset:]) + if err != nil { + return nil, err + + } + } + + return buf, nil +} + +func (r *ResponseMetaHeader) StableSize() (size int) { + if r == nil { + return 0 + } + + if r.version != nil { + _, ln := proto.NestedStructurePrefix(respMetaHeaderVersionField) + n := r.version.StableSize() + size += ln + proto.VarUIntSize(uint64(n)) + n + } + + size += proto.UInt64Size(respMetaHeaderEpochField, r.epoch) + size += proto.UInt32Size(respMetaHeaderTTLField, r.ttl) + + _, ln := proto.NestedStructurePrefix(respMetaHeaderXHeadersField) + + for i := range r.xHeaders { + n := r.xHeaders[i].StableSize() + size += ln + proto.VarUIntSize(uint64(n)) + n + } + + if r.origin != nil { + _, ln := proto.NestedStructurePrefix(respMetaHeaderOriginField) + n := r.origin.StableSize() + size += ln + proto.VarUIntSize(uint64(n)) + n + } + + return size +} + +func (r *ResponseVerificationHeader) StableMarshal(buf []byte) ([]byte, error) { + if r == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, r.StableSize()) + } + + var ( + offset, n int + prefix uint64 + err error + ) + + if r.bodySig != nil { + prefix, _ = proto.NestedStructurePrefix(respVerifHeaderBodySignatureField) + offset += binary.PutUvarint(buf[offset:], prefix) + + n = r.bodySig.StableSize() + offset += binary.PutUvarint(buf[offset:], uint64(n)) + + _, err = r.bodySig.StableMarshal(buf[offset:]) + if err != nil { + return nil, err + + } + + offset += n + } + + if r.metaSig != nil { + prefix, _ = proto.NestedStructurePrefix(respVerifHeaderMetaSignatureField) + offset += binary.PutUvarint(buf[offset:], prefix) + + n = r.metaSig.StableSize() + offset += binary.PutUvarint(buf[offset:], uint64(n)) + + _, err = r.metaSig.StableMarshal(buf[offset:]) + if err != nil { + return nil, err + + } + + offset += n + } + + if r.originSig != nil { + prefix, _ = proto.NestedStructurePrefix(respVerifHeaderOriginSignatureField) + offset += binary.PutUvarint(buf[offset:], prefix) + + n = r.originSig.StableSize() + offset += binary.PutUvarint(buf[offset:], uint64(n)) + + _, err = r.originSig.StableMarshal(buf[offset:]) + if err != nil { + return nil, err + + } + + offset += n + } + + if r.origin != nil { + prefix, _ = proto.NestedStructurePrefix(respVerifHeaderOriginField) + offset += binary.PutUvarint(buf[offset:], prefix) + + n = r.origin.StableSize() + offset += binary.PutUvarint(buf[offset:], uint64(n)) + + _, err = r.origin.StableMarshal(buf[offset:]) + if err != nil { + return nil, err + + } + } + + return buf, nil +} + +func (r *ResponseVerificationHeader) StableSize() (size int) { + if r == nil { + return 0 + } + + if r.bodySig != nil { + _, ln := proto.NestedStructurePrefix(respVerifHeaderBodySignatureField) + n := r.bodySig.StableSize() + size += ln + proto.VarUIntSize(uint64(n)) + n + } + + if r.metaSig != nil { + _, ln := proto.NestedStructurePrefix(respVerifHeaderMetaSignatureField) + n := r.metaSig.StableSize() + size += ln + proto.VarUIntSize(uint64(n)) + n + } + + if r.originSig != nil { + _, ln := proto.NestedStructurePrefix(respVerifHeaderOriginSignatureField) + n := r.originSig.StableSize() + size += ln + proto.VarUIntSize(uint64(n)) + n + } + + if r.origin != nil { + _, ln := proto.NestedStructurePrefix(respVerifHeaderOriginField) + n := r.origin.StableSize() + size += ln + proto.VarUIntSize(uint64(n)) + n + } + + return size +} diff --git a/v2/service/marshal_test.go b/v2/service/marshal_test.go new file mode 100644 index 0000000..35ad8fb --- /dev/null +++ b/v2/service/marshal_test.go @@ -0,0 +1,401 @@ +package service_test + +import ( + "fmt" + "testing" + + "github.com/nspcc-dev/neofs-api-go/v2/acl" + "github.com/nspcc-dev/neofs-api-go/v2/refs" + "github.com/nspcc-dev/neofs-api-go/v2/service" + grpc "github.com/nspcc-dev/neofs-api-go/v2/service/grpc" + "github.com/stretchr/testify/require" +) + +func TestSignature_StableMarshal(t *testing.T) { + signatureFrom := generateSignature("Public Key", "Signature") + transport := new(grpc.Signature) + + t.Run("non empty", func(t *testing.T) { + wire, err := signatureFrom.StableMarshal(nil) + require.NoError(t, err) + + err = transport.Unmarshal(wire) + require.NoError(t, err) + + signatureTo := service.SignatureFromGRPCMessage(transport) + require.Equal(t, signatureFrom, signatureTo) + }) +} + +func TestVersion_StableMarshal(t *testing.T) { + versionFrom := generateVersion(2, 0) + transport := new(grpc.Version) + + t.Run("non empty", func(t *testing.T) { + wire, err := versionFrom.StableMarshal(nil) + require.NoError(t, err) + + err = transport.Unmarshal(wire) + require.NoError(t, err) + + versionTo := service.VersionFromGRPCMessage(transport) + require.Equal(t, versionFrom, versionTo) + }) +} + +func TestXHeader_StableMarshal(t *testing.T) { + xheaderFrom := generateXHeader("X-Header-Key", "X-Header-Value") + transport := new(grpc.XHeader) + + t.Run("non empty", func(t *testing.T) { + wire, err := xheaderFrom.StableMarshal(nil) + require.NoError(t, err) + + err = transport.Unmarshal(wire) + require.NoError(t, err) + + xheaderTo := service.XHeaderFromGRPCMessage(transport) + require.Equal(t, xheaderFrom, xheaderTo) + }) +} + +func TestTokenLifetime_StableMarshal(t *testing.T) { + lifetimeFrom := generateLifetime(10, 20, 30) + transport := new(grpc.TokenLifetime) + + t.Run("non empty", func(t *testing.T) { + wire, err := lifetimeFrom.StableMarshal(nil) + require.NoError(t, err) + + err = transport.Unmarshal(wire) + require.NoError(t, err) + + lifetimeTo := service.TokenLifetimeFromGRPCMessage(transport) + require.Equal(t, lifetimeFrom, lifetimeTo) + }) +} + +func TestObjectSessionContext_StableMarshal(t *testing.T) { + objectCtxFrom := generateObjectCtx("Object ID") + transport := new(grpc.ObjectServiceContext) + + t.Run("non empty", func(t *testing.T) { + wire, err := objectCtxFrom.StableMarshal(nil) + require.NoError(t, err) + + err = transport.Unmarshal(wire) + require.NoError(t, err) + + objectCtxTo := service.ObjectSessionContextFromGRPCMessage(transport) + require.Equal(t, objectCtxFrom, objectCtxTo) + }) +} + +func TestSessionTokenBody_StableMarshal(t *testing.T) { + sessionTokenBodyFrom := generateSessionTokenBody("Session Token Body") + transport := new(grpc.SessionToken_Body) + + t.Run("non empty", func(t *testing.T) { + wire, err := sessionTokenBodyFrom.StableMarshal(nil) + require.NoError(t, err) + + err = transport.Unmarshal(wire) + require.NoError(t, err) + + sessionTokenBodyTo := service.SessionTokenBodyFromGRPCMessage(transport) + require.Equal(t, sessionTokenBodyFrom, sessionTokenBodyTo) + }) +} + +func TestSessionToken_StableMarshal(t *testing.T) { + sessionTokenFrom := generateSessionToken("Session Token") + transport := new(grpc.SessionToken) + + t.Run("non empty", func(t *testing.T) { + wire, err := sessionTokenFrom.StableMarshal(nil) + require.NoError(t, err) + + err = transport.Unmarshal(wire) + require.NoError(t, err) + + sessionTokenTo := service.SessionTokenFromGRPCMessage(transport) + require.Equal(t, sessionTokenFrom, sessionTokenTo) + }) +} + +func TestBearerTokenBody_StableMarshal(t *testing.T) { + bearerTokenBodyFrom := generateBearerTokenBody("Bearer Token Body") + transport := new(grpc.BearerToken_Body) + + t.Run("non empty", func(t *testing.T) { + wire, err := bearerTokenBodyFrom.StableMarshal(nil) + require.NoError(t, err) + + err = transport.Unmarshal(wire) + require.NoError(t, err) + + bearerTokenBodyTo := service.BearerTokenBodyFromGRPCMessage(transport) + require.Equal(t, bearerTokenBodyFrom, bearerTokenBodyTo) + }) +} + +func TestBearerToken_StableMarshal(t *testing.T) { + bearerTokenFrom := generateBearerToken("Bearer Token") + transport := new(grpc.BearerToken) + + t.Run("non empty", func(t *testing.T) { + wire, err := bearerTokenFrom.StableMarshal(nil) + require.NoError(t, err) + + err = transport.Unmarshal(wire) + require.NoError(t, err) + + bearerTokenTo := service.BearerTokenFromGRPCMessage(transport) + require.Equal(t, bearerTokenFrom, bearerTokenTo) + }) +} + +func TestRequestMetaHeader_StableMarshal(t *testing.T) { + metaHeaderOrigin := generateRequestMetaHeader(10, "Bearer One", "Session One") + metaHeaderFrom := generateRequestMetaHeader(20, "Bearer Two", "Session Two") + metaHeaderFrom.SetOrigin(metaHeaderOrigin) + transport := new(grpc.RequestMetaHeader) + + t.Run("non empty", func(t *testing.T) { + wire, err := metaHeaderFrom.StableMarshal(nil) + require.NoError(t, err) + + err = transport.Unmarshal(wire) + require.NoError(t, err) + + metaHeaderTo := service.RequestMetaHeaderFromGRPCMessage(transport) + require.Equal(t, metaHeaderFrom, metaHeaderTo) + }) +} + +func TestRequestVerificationHeader_StableMarshal(t *testing.T) { + verifHeaderOrigin := generateRequestVerificationHeader("Key", "Inside") + verifHeaderFrom := generateRequestVerificationHeader("Value", "Outside") + verifHeaderFrom.SetOrigin(verifHeaderOrigin) + transport := new(grpc.RequestVerificationHeader) + + t.Run("non empty", func(t *testing.T) { + wire, err := verifHeaderFrom.StableMarshal(nil) + require.NoError(t, err) + + err = transport.Unmarshal(wire) + require.NoError(t, err) + + verifHeaderTo := service.RequestVerificationHeaderFromGRPCMessage(transport) + require.Equal(t, verifHeaderFrom, verifHeaderTo) + }) +} + +func TestResponseMetaHeader_StableMarshal(t *testing.T) { + metaHeaderOrigin := generateResponseMetaHeader(10) + metaHeaderFrom := generateResponseMetaHeader(20) + metaHeaderFrom.SetOrigin(metaHeaderOrigin) + transport := new(grpc.ResponseMetaHeader) + + t.Run("non empty", func(t *testing.T) { + wire, err := metaHeaderFrom.StableMarshal(nil) + require.NoError(t, err) + + err = transport.Unmarshal(wire) + require.NoError(t, err) + + metaHeaderTo := service.ResponseMetaHeaderFromGRPCMessage(transport) + require.Equal(t, metaHeaderFrom, metaHeaderTo) + }) +} + +func TestResponseVerificationHeader_StableMarshal(t *testing.T) { + verifHeaderOrigin := generateResponseVerificationHeader("Key", "Inside") + verifHeaderFrom := generateResponseVerificationHeader("Value", "Outside") + verifHeaderFrom.SetOrigin(verifHeaderOrigin) + transport := new(grpc.ResponseVerificationHeader) + + t.Run("non empty", func(t *testing.T) { + wire, err := verifHeaderFrom.StableMarshal(nil) + require.NoError(t, err) + + err = transport.Unmarshal(wire) + require.NoError(t, err) + + verifHeaderTo := service.ResponseVerificationHeaderFromGRPCMessage(transport) + require.Equal(t, verifHeaderFrom, verifHeaderTo) + }) +} + +func generateSignature(k, v string) *service.Signature { + sig := new(service.Signature) + sig.SetKey([]byte(k)) + sig.SetSign([]byte(v)) + + return sig +} + +func generateVersion(maj, min uint32) *service.Version { + version := new(service.Version) + version.SetMajor(maj) + version.SetMinor(min) + + return version +} + +func generateXHeader(k, v string) *service.XHeader { + xheader := new(service.XHeader) + xheader.SetKey(k) + xheader.SetValue(v) + + return xheader +} + +func generateLifetime(exp, nbf, iat uint64) *service.TokenLifetime { + lifetime := new(service.TokenLifetime) + lifetime.SetExp(exp) + lifetime.SetNbf(nbf) + lifetime.SetIat(iat) + + return lifetime +} + +func generateObjectCtx(id string) *service.ObjectSessionContext { + objectCtx := new(service.ObjectSessionContext) + objectCtx.SetVerb(service.ObjectVerbPut) + + cid := new(refs.ContainerID) + cid.SetValue([]byte("ContainerID")) + + oid := new(refs.ObjectID) + oid.SetValue([]byte(id)) + + addr := new(refs.Address) + addr.SetContainerID(cid) + addr.SetObjectID(oid) + + objectCtx.SetAddress(addr) + + return objectCtx +} + +func generateEACL(n int, k, v string) *acl.Table { + target := new(acl.TargetInfo) + target.SetTarget(acl.TargetUser) + + keys := make([][]byte, n) + + for i := 0; i < n; i++ { + s := fmt.Sprintf("Public Key %d", i+1) + keys[i] = []byte(s) + } + + filter := new(acl.HeaderFilter) + filter.SetHeaderType(acl.HeaderTypeObject) + filter.SetMatchType(acl.MatchTypeStringEqual) + filter.SetName(k) + filter.SetValue(v) + + record := new(acl.Record) + record.SetOperation(acl.OperationHead) + record.SetAction(acl.ActionDeny) + record.SetTargets([]*acl.TargetInfo{target}) + record.SetFilters([]*acl.HeaderFilter{filter}) + + table := new(acl.Table) + cid := new(refs.ContainerID) + cid.SetValue([]byte("Container ID")) + + table.SetContainerID(cid) + table.SetRecords([]*acl.Record{record}) + + return table +} + +func generateSessionTokenBody(id string) *service.SessionTokenBody { + owner := new(refs.OwnerID) + owner.SetValue([]byte("Owner ID")) + + tokenBody := new(service.SessionTokenBody) + tokenBody.SetID([]byte(id)) + tokenBody.SetOwnerID(owner) + tokenBody.SetSessionKey([]byte(id)) + tokenBody.SetLifetime(generateLifetime(1, 2, 3)) + tokenBody.SetContext(generateObjectCtx(id)) + + return tokenBody +} + +func generateSessionToken(id string) *service.SessionToken { + sessionToken := new(service.SessionToken) + sessionToken.SetBody(generateSessionTokenBody(id)) + sessionToken.SetSignature(generateSignature("id", id)) + + return sessionToken +} + +func generateBearerTokenBody(id string) *service.BearerTokenBody { + owner := new(refs.OwnerID) + owner.SetValue([]byte(id)) + + tokenBody := new(service.BearerTokenBody) + tokenBody.SetOwnerID(owner) + tokenBody.SetLifetime(generateLifetime(1, 2, 3)) + tokenBody.SetEACL(generateEACL(10, "id", id)) + + return tokenBody +} + +func generateBearerToken(id string) *service.BearerToken { + bearerToken := new(service.BearerToken) + bearerToken.SetBody(generateBearerTokenBody(id)) + bearerToken.SetSignature(generateSignature("id", id)) + + return bearerToken +} + +func generateRequestMetaHeader(n int, b, s string) *service.RequestMetaHeader { + reqMetaHeader := new(service.RequestMetaHeader) + reqMetaHeader.SetVersion(generateVersion(2, 0)) + reqMetaHeader.SetEpoch(uint64(n)) + reqMetaHeader.SetTTL(uint32(n)) + reqMetaHeader.SetXHeaders([]*service.XHeader{ + generateXHeader("key-one", "val-one"), + generateXHeader("key-two", "val-two"), + }) + reqMetaHeader.SetBearerToken(generateBearerToken(b)) + reqMetaHeader.SetSessionToken(generateSessionToken(s)) + + return reqMetaHeader +} + +func generateRequestVerificationHeader(k, v string) *service.RequestVerificationHeader { + reqVerifHeader := new(service.RequestVerificationHeader) + reqVerifHeader.SetBodySignature(generateSignature(k+"body", v+"body")) + reqVerifHeader.SetMetaSignature(generateSignature(k+"meta", v+"meta")) + reqVerifHeader.SetOriginSignature(generateSignature(k+"orig", v+"orig")) + + return reqVerifHeader +} + +func generateResponseMetaHeader(n int) *service.ResponseMetaHeader { + respMetaHeader := new(service.ResponseMetaHeader) + respMetaHeader.SetVersion(generateVersion(2, 0)) + respMetaHeader.SetEpoch(uint64(n)) + respMetaHeader.SetTTL(uint32(n)) + respMetaHeader.SetXHeaders([]*service.XHeader{ + generateXHeader("key-one", "val-one"), + generateXHeader("key-two", "val-two"), + }) + + return respMetaHeader +} + +func generateResponseVerificationHeader(k, v string) *service.ResponseVerificationHeader { + respVerifHeader := new(service.ResponseVerificationHeader) + respVerifHeader.SetBodySignature(generateSignature(k+"body", v+"body")) + respVerifHeader.SetMetaSignature(generateSignature(k+"meta", v+"meta")) + respVerifHeader.SetOriginSignature(generateSignature(k+"orig", v+"orig")) + + return respVerifHeader +} diff --git a/v2/service/service.go b/v2/service/service.go index 61e33cb..b40106a 100644 --- a/v2/service/service.go +++ b/v2/service/service.go @@ -256,22 +256,6 @@ func (r *RequestVerificationHeader) SetOrigin(v *RequestVerificationHeader) { } } -func (r *RequestVerificationHeader) StableMarshal(buf []byte) ([]byte, error) { - if r == nil { - return nil, nil - } - - // TODO: do not use hack - _, err := RequestVerificationHeaderToGRPCMessage(r).MarshalTo(buf) - - return buf, err -} - -func (r *RequestVerificationHeader) StableSize() int { - // TODO: do not use hack - return RequestVerificationHeaderToGRPCMessage(r).Size() -} - func (r *RequestMetaHeader) GetVersion() *Version { if r != nil { return r.version @@ -370,61 +354,45 @@ func (r *RequestMetaHeader) SetOrigin(v *RequestMetaHeader) { } } -func (r *RequestMetaHeader) StableMarshal(buf []byte) ([]byte, error) { - if r == nil { - return nil, nil - } - - // TODO: do not use hack - _, err := RequestMetaHeaderToGRPCMessage(r).MarshalTo(buf) - - return buf, err -} - -func (r *RequestMetaHeader) StableSize() int { - // TODO: do not use hack - return RequestMetaHeaderToGRPCMessage(r).Size() -} - -func (tl *TokenLifetime) GetExp() uint64 { - if tl != nil { - return tl.exp +func (l *TokenLifetime) GetExp() uint64 { + if l != nil { + return l.exp } return 0 } -func (tl *TokenLifetime) SetExp(v uint64) { - if tl != nil { - tl.exp = v +func (l *TokenLifetime) SetExp(v uint64) { + if l != nil { + l.exp = v } } -func (tl *TokenLifetime) GetNbf() uint64 { - if tl != nil { - return tl.nbf +func (l *TokenLifetime) GetNbf() uint64 { + if l != nil { + return l.nbf } return 0 } -func (tl *TokenLifetime) SetNbf(v uint64) { - if tl != nil { - tl.nbf = v +func (l *TokenLifetime) SetNbf(v uint64) { + if l != nil { + l.nbf = v } } -func (tl *TokenLifetime) GetIat() uint64 { - if tl != nil { - return tl.iat +func (l *TokenLifetime) GetIat() uint64 { + if l != nil { + return l.iat } return 0 } -func (tl *TokenLifetime) SetIat(v uint64) { - if tl != nil { - tl.iat = v +func (l *TokenLifetime) SetIat(v uint64) { + if l != nil { + l.iat = v } } From 08d3debc3a468bf6ec2db19c58c874673cf31188 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Tue, 18 Aug 2020 09:48:25 +0300 Subject: [PATCH 0320/1196] Fix SetBalance setter Signed-off-by: Alex Vanin --- v2/accounting/accounting.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/v2/accounting/accounting.go b/v2/accounting/accounting.go index 22be9ba..1576a9a 100644 --- a/v2/accounting/accounting.go +++ b/v2/accounting/accounting.go @@ -145,7 +145,7 @@ func (br *BalanceResponseBody) GetBalance() *Decimal { func (br *BalanceResponseBody) SetBalance(v *Decimal) { if br != nil { - br.SetBalance(v) + br.bal = v } } From 0df4e4bf0d94cec7b4c8fc6847bf3c19e5a48b4c Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Tue, 18 Aug 2020 09:48:57 +0300 Subject: [PATCH 0321/1196] Add nested structure stable marshal helper Signed-off-by: Alex Vanin --- util/proto/marshal.go | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/util/proto/marshal.go b/util/proto/marshal.go index a975e32..470d974 100644 --- a/util/proto/marshal.go +++ b/util/proto/marshal.go @@ -11,6 +11,13 @@ import ( "math/bits" ) +type ( + stableMarshaller interface { + StableMarshal([]byte) ([]byte, error) + StableSize() int + } +) + func BytesMarshal(field int, buf, v []byte) (int, error) { if len(v) == 0 { return 0, nil @@ -296,3 +303,34 @@ func NestedStructurePrefix(field int64) (prefix uint64, ln int) { prefix = uint64(field<<3 | 0x02) return prefix, VarUIntSize(prefix) } + +func NestedStructureMarshal(field int64, buf []byte, v stableMarshaller) (int, error) { + if v == nil { + return 0, nil + } + + prefix, _ := NestedStructurePrefix(field) + offset := binary.PutUvarint(buf, prefix) + + n := v.StableSize() + offset += binary.PutUvarint(buf[offset:], uint64(n)) + + _, err := v.StableMarshal(buf[offset:]) + if err != nil { + return 0, err + } + + return offset + n, nil +} + +func NestedStructureSize(field int64, v stableMarshaller) (size int) { + if v == nil { + return 0 + } + + _, ln := NestedStructurePrefix(field) + n := v.StableSize() + size = ln + VarUIntSize(uint64(n)) + n + + return size +} From b47ec9e0566d850766b10b8074c36d91a8572387 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Tue, 18 Aug 2020 09:49:55 +0300 Subject: [PATCH 0322/1196] Add stable marshal for accounting package Signed-off-by: Alex Vanin --- v2/accounting/accounting.go | 16 ----- v2/accounting/marshal.go | 116 ++++++++++++++++++++++++++++++++++ v2/accounting/marshal_test.go | 83 ++++++++++++++++++++++++ 3 files changed, 199 insertions(+), 16 deletions(-) create mode 100644 v2/accounting/marshal.go create mode 100644 v2/accounting/marshal_test.go diff --git a/v2/accounting/accounting.go b/v2/accounting/accounting.go index 1576a9a..1ca3d26 100644 --- a/v2/accounting/accounting.go +++ b/v2/accounting/accounting.go @@ -49,22 +49,6 @@ func (b *BalanceRequestBody) SetOwnerID(v *refs.OwnerID) { } } -func (r *BalanceRequestBody) StableMarshal(buf []byte) ([]byte, error) { - if r == nil { - return nil, nil - } - - // TODO: do not use hack - _, err := BalanceRequestBodyToGRPCMessage(r).MarshalTo(buf) - - return buf, err -} - -func (r *BalanceRequestBody) StableSize() int { - // TODO: do not use hack - return BalanceRequestBodyToGRPCMessage(r).Size() -} - func (b *BalanceRequest) GetBody() *BalanceRequestBody { if b != nil { return b.body diff --git a/v2/accounting/marshal.go b/v2/accounting/marshal.go new file mode 100644 index 0000000..a0d73b1 --- /dev/null +++ b/v2/accounting/marshal.go @@ -0,0 +1,116 @@ +package accounting + +import ( + "github.com/nspcc-dev/neofs-api-go/util/proto" +) + +const ( + decimalValueField = 1 + decimalPrecisionField = 2 + + balanceReqBodyOwnerField = 1 + + balanceRespBodyDecimalField = 1 +) + +func (d *Decimal) StableMarshal(buf []byte) ([]byte, error) { + if d == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, d.StableSize()) + } + + var ( + offset, n int + err error + ) + + n, err = proto.Int64Marshal(decimalValueField, buf[offset:], d.val) + if err != nil { + return nil, err + } + + offset += n + + n, err = proto.UInt32Marshal(decimalPrecisionField, buf[offset:], d.prec) + if err != nil { + return nil, err + } + + return buf, nil +} + +func (d *Decimal) StableSize() (size int) { + if d == nil { + return 0 + } + + size += proto.Int64Size(decimalValueField, d.val) + size += proto.UInt32Size(decimalPrecisionField, d.prec) + + return size +} + +func (b *BalanceRequestBody) StableMarshal(buf []byte) ([]byte, error) { + if b == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, b.StableSize()) + } + + if b.ownerID != nil { + _, err := proto.NestedStructureMarshal(balanceReqBodyOwnerField, buf, b.ownerID) + if err != nil { + return nil, err + } + } + + return buf, nil +} + +func (b *BalanceRequestBody) StableSize() (size int) { + if b == nil { + return 0 + } + + if b.ownerID != nil { + size = proto.NestedStructureSize(balanceReqBodyOwnerField, b.ownerID) + } + + return size +} + +func (br *BalanceResponseBody) StableMarshal(buf []byte) ([]byte, error) { + if br == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, br.StableSize()) + } + + if br.bal != nil { + _, err := proto.NestedStructureMarshal(balanceRespBodyDecimalField, buf, br.bal) + if err != nil { + return nil, err + } + } + + return buf, nil +} + +func (br *BalanceResponseBody) StableSize() (size int) { + if br == nil { + return 0 + } + + if br.bal != nil { + size = proto.NestedStructureSize(balanceRespBodyDecimalField, br.bal) + } + + return size +} diff --git a/v2/accounting/marshal_test.go b/v2/accounting/marshal_test.go new file mode 100644 index 0000000..5d708c5 --- /dev/null +++ b/v2/accounting/marshal_test.go @@ -0,0 +1,83 @@ +package accounting_test + +import ( + "testing" + + "github.com/nspcc-dev/neofs-api-go/v2/accounting" + grpc "github.com/nspcc-dev/neofs-api-go/v2/accounting/grpc" + "github.com/nspcc-dev/neofs-api-go/v2/refs" + "github.com/stretchr/testify/require" +) + +func TestDecimal_StableMarshal(t *testing.T) { + decimalFrom := generateDecimal(888) + transport := new(grpc.Decimal) + + t.Run("non empty", func(t *testing.T) { + wire, err := decimalFrom.StableMarshal(nil) + require.NoError(t, err) + + err = transport.Unmarshal(wire) + require.NoError(t, err) + + decimalTo := accounting.DecimalFromGRPCMessage(transport) + require.Equal(t, decimalFrom, decimalTo) + }) +} + +func TestBalanceRequestBody_StableMarshal(t *testing.T) { + requestBodyFrom := generateBalanceRequestBody("Owner ID") + transport := new(grpc.BalanceRequest_Body) + + t.Run("non empty", func(t *testing.T) { + wire, err := requestBodyFrom.StableMarshal(nil) + require.NoError(t, err) + + err = transport.Unmarshal(wire) + require.NoError(t, err) + + requestBodyTo := accounting.BalanceRequestBodyFromGRPCMessage(transport) + require.Equal(t, requestBodyFrom, requestBodyTo) + }) +} + +func TestBalanceResponseBody_StableMarshal(t *testing.T) { + responseBodyFrom := generateBalanceResponseBody(444) + transport := new(grpc.BalanceResponse_Body) + + t.Run("non empty", func(t *testing.T) { + wire, err := responseBodyFrom.StableMarshal(nil) + require.NoError(t, err) + + err = transport.Unmarshal(wire) + require.NoError(t, err) + + responseBodyTo := accounting.BalanceResponseBodyFromGRPCMessage(transport) + require.Equal(t, responseBodyFrom, responseBodyTo) + }) +} + +func generateDecimal(val int64) *accounting.Decimal { + decimal := new(accounting.Decimal) + decimal.SetValue(val) + decimal.SetPrecision(1000) + + return decimal +} + +func generateBalanceRequestBody(id string) *accounting.BalanceRequestBody { + owner := new(refs.OwnerID) + owner.SetValue([]byte(id)) + + request := new(accounting.BalanceRequestBody) + request.SetOwnerID(owner) + + return request +} + +func generateBalanceResponseBody(val int64) *accounting.BalanceResponseBody { + response := new(accounting.BalanceResponseBody) + response.SetBalance(generateDecimal(val)) + + return response +} From d4336d8d5ba7078aef0aa8a6533f6180d77f1859 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Tue, 18 Aug 2020 10:42:47 +0300 Subject: [PATCH 0323/1196] Simplify marshal with nested structure helper Signed-off-by: Alex Vanin --- v2/accounting/marshal.go | 24 +- v2/acl/marshal.go | 74 +---- v2/refs/marshal.go | 69 ++--- v2/service/marshal.go | 620 ++++++++----------------------------- v2/storagegroup/marshal.go | 41 +-- 5 files changed, 183 insertions(+), 645 deletions(-) diff --git a/v2/accounting/marshal.go b/v2/accounting/marshal.go index a0d73b1..83fd0e7 100644 --- a/v2/accounting/marshal.go +++ b/v2/accounting/marshal.go @@ -62,11 +62,9 @@ func (b *BalanceRequestBody) StableMarshal(buf []byte) ([]byte, error) { buf = make([]byte, b.StableSize()) } - if b.ownerID != nil { - _, err := proto.NestedStructureMarshal(balanceReqBodyOwnerField, buf, b.ownerID) - if err != nil { - return nil, err - } + _, err := proto.NestedStructureMarshal(balanceReqBodyOwnerField, buf, b.ownerID) + if err != nil { + return nil, err } return buf, nil @@ -77,9 +75,7 @@ func (b *BalanceRequestBody) StableSize() (size int) { return 0 } - if b.ownerID != nil { - size = proto.NestedStructureSize(balanceReqBodyOwnerField, b.ownerID) - } + size = proto.NestedStructureSize(balanceReqBodyOwnerField, b.ownerID) return size } @@ -93,11 +89,9 @@ func (br *BalanceResponseBody) StableMarshal(buf []byte) ([]byte, error) { buf = make([]byte, br.StableSize()) } - if br.bal != nil { - _, err := proto.NestedStructureMarshal(balanceRespBodyDecimalField, buf, br.bal) - if err != nil { - return nil, err - } + _, err := proto.NestedStructureMarshal(balanceRespBodyDecimalField, buf, br.bal) + if err != nil { + return nil, err } return buf, nil @@ -108,9 +102,7 @@ func (br *BalanceResponseBody) StableSize() (size int) { return 0 } - if br.bal != nil { - size = proto.NestedStructureSize(balanceRespBodyDecimalField, br.bal) - } + size = proto.NestedStructureSize(balanceRespBodyDecimalField, br.bal) return size } diff --git a/v2/acl/marshal.go b/v2/acl/marshal.go index 7b9e7ea..e596c0e 100644 --- a/v2/acl/marshal.go +++ b/v2/acl/marshal.go @@ -1,8 +1,6 @@ package acl import ( - "encoding/binary" - "github.com/nspcc-dev/neofs-api-go/util/proto" ) @@ -37,34 +35,18 @@ func (t *Table) StableMarshal(buf []byte) ([]byte, error) { var ( offset, n int - prefix uint64 err error ) - if t.cid != nil { - prefix, _ = proto.NestedStructurePrefix(tableContainerIDField) - offset += binary.PutUvarint(buf[offset:], prefix) - - n = t.cid.StableSize() - offset += binary.PutUvarint(buf[offset:], uint64(n)) - - _, err = t.cid.StableMarshal(buf[offset:]) - if err != nil { - return nil, err - } - - offset += n + n, err = proto.NestedStructureMarshal(tableContainerIDField, buf[offset:], t.cid) + if err != nil { + return nil, err } - prefix, _ = proto.NestedStructurePrefix(tableRecordsField) + offset += n for i := range t.records { - offset += binary.PutUvarint(buf[offset:], prefix) - - n = t.records[i].StableSize() - offset += binary.PutUvarint(buf[offset:], uint64(n)) - - _, err = t.records[i].StableMarshal(buf[offset:]) + n, err = proto.NestedStructureMarshal(tableRecordsField, buf[offset:], t.records[i]) if err != nil { return nil, err } @@ -81,17 +63,10 @@ func (t *Table) StableSize() (size int) { return 0 } - if t.cid != nil { - _, ln := proto.NestedStructurePrefix(tableContainerIDField) - n := t.cid.StableSize() - size += ln + proto.VarUIntSize(uint64(n)) + n - } - - _, ln := proto.NestedStructurePrefix(tableRecordsField) + size += proto.NestedStructureSize(tableContainerIDField, t.cid) for i := range t.records { - n := t.records[i].StableSize() - size += ln + proto.VarUIntSize(uint64(n)) + n + size += proto.NestedStructureSize(tableRecordsField, t.records[i]) } return size @@ -110,11 +85,10 @@ func (r *Record) StableMarshal(buf []byte) ([]byte, error) { var ( offset, n int - prefix uint64 err error ) - n, err = proto.EnumMarshal(recordOperationField, buf, int32(r.op)) + n, err = proto.EnumMarshal(recordOperationField, buf[offset:], int32(r.op)) if err != nil { return nil, err } @@ -128,15 +102,8 @@ func (r *Record) StableMarshal(buf []byte) ([]byte, error) { offset += n - prefix, _ = proto.NestedStructurePrefix(recordFiltersField) - for i := range r.filters { - offset += binary.PutUvarint(buf[offset:], prefix) - - n = r.filters[i].StableSize() - offset += binary.PutUvarint(buf[offset:], uint64(n)) - - _, err = r.filters[i].StableMarshal(buf[offset:]) + n, err = proto.NestedStructureMarshal(recordFiltersField, buf[offset:], r.filters[i]) if err != nil { return nil, err } @@ -144,15 +111,8 @@ func (r *Record) StableMarshal(buf []byte) ([]byte, error) { offset += n } - prefix, _ = proto.NestedStructurePrefix(recordTargetsField) - for i := range r.targets { - offset += binary.PutUvarint(buf[offset:], prefix) - - n = r.targets[i].StableSize() - offset += binary.PutUvarint(buf[offset:], uint64(n)) - - _, err = r.targets[i].StableMarshal(buf[offset:]) + n, err = proto.NestedStructureMarshal(recordTargetsField, buf[offset:], r.targets[i]) if err != nil { return nil, err } @@ -172,18 +132,12 @@ func (r *Record) StableSize() (size int) { size += proto.EnumSize(recordOperationField, int32(r.op)) size += proto.EnumSize(recordActionField, int32(r.op)) - _, ln := proto.NestedStructurePrefix(recordFiltersField) - for i := range r.filters { - n := r.filters[i].StableSize() - size += ln + proto.VarUIntSize(uint64(n)) + n + size += proto.NestedStructureSize(recordFiltersField, r.filters[i]) } - _, ln = proto.NestedStructurePrefix(recordTargetsField) - for i := range r.targets { - n := r.targets[i].StableSize() - size += ln + proto.VarUIntSize(uint64(n)) + n + size += proto.NestedStructureSize(recordTargetsField, r.targets[i]) } return size @@ -205,7 +159,7 @@ func (f *HeaderFilter) StableMarshal(buf []byte) ([]byte, error) { err error ) - n, err = proto.EnumMarshal(filterHeaderTypeField, buf, int32(f.hdrType)) + n, err = proto.EnumMarshal(filterHeaderTypeField, buf[offset:], int32(f.hdrType)) if err != nil { return nil, err } @@ -264,7 +218,7 @@ func (t *TargetInfo) StableMarshal(buf []byte) ([]byte, error) { err error ) - n, err = proto.EnumMarshal(targetTypeField, buf, int32(t.target)) + n, err = proto.EnumMarshal(targetTypeField, buf[offset:], int32(t.target)) if err != nil { return nil, err } diff --git a/v2/refs/marshal.go b/v2/refs/marshal.go index 2a835fd..4018500 100644 --- a/v2/refs/marshal.go +++ b/v2/refs/marshal.go @@ -1,20 +1,18 @@ package refs import ( - "encoding/binary" - "github.com/nspcc-dev/neofs-api-go/util/proto" ) const ( - OwnerIDValField = 1 + ownerIDValField = 1 - ContainerIDValField = 1 + containerIDValField = 1 - ObjectIDValField = 1 + objectIDValField = 1 - AddressContainerField = 1 - AddressObjectField = 2 + addressContainerField = 1 + addressObjectField = 2 ) func (o *OwnerID) StableMarshal(buf []byte) ([]byte, error) { @@ -26,7 +24,7 @@ func (o *OwnerID) StableMarshal(buf []byte) ([]byte, error) { buf = make([]byte, o.StableSize()) } - _, err := proto.BytesMarshal(OwnerIDValField, buf, o.val) + _, err := proto.BytesMarshal(ownerIDValField, buf, o.val) if err != nil { return nil, err } @@ -38,7 +36,8 @@ func (o *OwnerID) StableSize() int { if o == nil { return 0 } - return proto.BytesSize(OwnerIDValField, o.val) + + return proto.BytesSize(ownerIDValField, o.val) } func (c *ContainerID) StableMarshal(buf []byte) ([]byte, error) { @@ -50,7 +49,7 @@ func (c *ContainerID) StableMarshal(buf []byte) ([]byte, error) { buf = make([]byte, c.StableSize()) } - _, err := proto.BytesMarshal(ContainerIDValField, buf, c.val) + _, err := proto.BytesMarshal(containerIDValField, buf, c.val) if err != nil { return nil, err } @@ -62,7 +61,8 @@ func (c *ContainerID) StableSize() int { if c == nil { return 0 } - return proto.BytesSize(ContainerIDValField, c.val) + + return proto.BytesSize(containerIDValField, c.val) } func (o *ObjectID) StableMarshal(buf []byte) ([]byte, error) { @@ -74,7 +74,7 @@ func (o *ObjectID) StableMarshal(buf []byte) ([]byte, error) { buf = make([]byte, o.StableSize()) } - _, err := proto.BytesMarshal(ObjectIDValField, buf, o.val) + _, err := proto.BytesMarshal(objectIDValField, buf, o.val) if err != nil { return nil, err } @@ -87,7 +87,7 @@ func (o *ObjectID) StableSize() int { return 0 } - return proto.BytesSize(ObjectIDValField, o.val) + return proto.BytesSize(objectIDValField, o.val) } func (a *Address) StableMarshal(buf []byte) ([]byte, error) { @@ -101,36 +101,19 @@ func (a *Address) StableMarshal(buf []byte) ([]byte, error) { var ( offset, n int - prefix uint64 err error ) - if a.cid != nil { - prefix, _ = proto.NestedStructurePrefix(AddressContainerField) - offset = binary.PutUvarint(buf, prefix) - - n = a.cid.StableSize() - offset += binary.PutUvarint(buf[offset:], uint64(n)) - - _, err = a.cid.StableMarshal(buf[offset:]) - if err != nil { - return nil, err - } - - offset += n + n, err = proto.NestedStructureMarshal(addressContainerField, buf[offset:], a.cid) + if err != nil { + return nil, err } - if a.oid != nil { - prefix, _ = proto.NestedStructurePrefix(AddressObjectField) - offset += binary.PutUvarint(buf[offset:], prefix) + offset += n - n = a.oid.StableSize() - offset += binary.PutUvarint(buf[offset:], uint64(n)) - - _, err = a.oid.StableMarshal(buf[offset:]) - if err != nil { - return nil, err - } + _, err = proto.NestedStructureMarshal(addressObjectField, buf[offset:], a.oid) + if err != nil { + return nil, err } return buf, nil @@ -141,17 +124,9 @@ func (a *Address) StableSize() (size int) { return 0 } - if a.cid != nil { - _, ln := proto.NestedStructurePrefix(AddressContainerField) - n := a.cid.StableSize() - size += ln + proto.VarUIntSize(uint64(n)) + n - } + size += proto.NestedStructureSize(addressContainerField, a.cid) - if a.oid != nil { - _, ln := proto.NestedStructurePrefix(AddressObjectField) - n := a.oid.StableSize() - size += ln + proto.VarUIntSize(uint64(n)) + n - } + size += proto.NestedStructureSize(addressObjectField, a.oid) return size } diff --git a/v2/service/marshal.go b/v2/service/marshal.go index 241b292..f30c9df 100644 --- a/v2/service/marshal.go +++ b/v2/service/marshal.go @@ -1,8 +1,6 @@ package service import ( - "encoding/binary" - "github.com/nspcc-dev/neofs-api-go/util/proto" ) @@ -78,7 +76,7 @@ func (s *Signature) StableMarshal(buf []byte) ([]byte, error) { err error ) - n, err = proto.BytesMarshal(signatureKeyField, buf, s.key) + n, err = proto.BytesMarshal(signatureKeyField, buf[offset:], s.key) if err != nil { return nil, err } @@ -118,7 +116,7 @@ func (v *Version) StableMarshal(buf []byte) ([]byte, error) { err error ) - n, err = proto.UInt32Marshal(versionMajorField, buf, v.major) + n, err = proto.UInt32Marshal(versionMajorField, buf[offset:], v.major) if err != nil { return nil, err } @@ -158,7 +156,7 @@ func (x *XHeader) StableMarshal(buf []byte) ([]byte, error) { err error ) - n, err = proto.StringMarshal(xheaderKeyField, buf, x.key) + n, err = proto.StringMarshal(xheaderKeyField, buf[offset:], x.key) if err != nil { return nil, err } @@ -198,7 +196,7 @@ func (l *TokenLifetime) StableMarshal(buf []byte) ([]byte, error) { err error ) - n, err = proto.UInt64Marshal(lifetimeExpirationField, buf, l.exp) + n, err = proto.UInt64Marshal(lifetimeExpirationField, buf[offset:], l.exp) if err != nil { return nil, err } @@ -243,29 +241,19 @@ func (c *ObjectSessionContext) StableMarshal(buf []byte) ([]byte, error) { var ( offset, n int - prefix uint64 err error ) - n, err = proto.EnumMarshal(objectCtxVerbField, buf, int32(c.verb)) + n, err = proto.EnumMarshal(objectCtxVerbField, buf[offset:], int32(c.verb)) if err != nil { return nil, err } offset += n - if c.addr != nil { - prefix, _ = proto.NestedStructurePrefix(objectCtxAddressField) - offset += binary.PutUvarint(buf[offset:], prefix) - - n = c.addr.StableSize() - offset += binary.PutUvarint(buf[offset:], uint64(n)) - - _, err = c.addr.StableMarshal(buf[offset:]) - if err != nil { - return nil, err - - } + _, err = proto.NestedStructureMarshal(objectCtxAddressField, buf[offset:], c.addr) + if err != nil { + return nil, err } return buf, nil @@ -277,12 +265,7 @@ func (c *ObjectSessionContext) StableSize() (size int) { } size += proto.EnumSize(objectCtxVerbField, int32(c.verb)) - - if c.addr != nil { - _, ln := proto.NestedStructurePrefix(objectCtxAddressField) - n := c.addr.StableSize() - size += ln + proto.VarUIntSize(uint64(n)) + n - } + size += proto.NestedStructureSize(objectCtxAddressField, c.addr) return size } @@ -298,49 +281,30 @@ func (t *SessionTokenBody) StableMarshal(buf []byte) ([]byte, error) { var ( offset, n int - prefix uint64 err error ) - n, err = proto.BytesMarshal(sessionTokenBodyIDField, buf, t.id) + n, err = proto.BytesMarshal(sessionTokenBodyIDField, buf[offset:], t.id) if err != nil { return nil, err } offset += n - if t.ownerID != nil { - prefix, _ = proto.NestedStructurePrefix(sessionTokenBodyOwnerField) - offset += binary.PutUvarint(buf[offset:], prefix) - - n = t.ownerID.StableSize() - offset += binary.PutUvarint(buf[offset:], uint64(n)) - - _, err = t.ownerID.StableMarshal(buf[offset:]) - if err != nil { - return nil, err - - } - - offset += n + n, err = proto.NestedStructureMarshal(sessionTokenBodyOwnerField, buf[offset:], t.ownerID) + if err != nil { + return nil, err } - if t.lifetime != nil { - prefix, _ = proto.NestedStructurePrefix(sessionTokenBodyLifetimeField) - offset += binary.PutUvarint(buf[offset:], prefix) + offset += n - n = t.lifetime.StableSize() - offset += binary.PutUvarint(buf[offset:], uint64(n)) - - _, err = t.lifetime.StableMarshal(buf[offset:]) - if err != nil { - return nil, err - - } - - offset += n + n, err = proto.NestedStructureMarshal(sessionTokenBodyLifetimeField, buf[offset:], t.lifetime) + if err != nil { + return nil, err } + offset += n + n, err = proto.BytesMarshal(sessionTokenBodyKeyField, buf[offset:], t.sessionKey) if err != nil { return nil, err @@ -351,16 +315,9 @@ func (t *SessionTokenBody) StableMarshal(buf []byte) ([]byte, error) { if t.ctx != nil { switch v := t.ctx.(type) { case *ObjectSessionContext: - prefix, _ = proto.NestedStructurePrefix(sessionTokenBodyObjectCtxField) - offset += binary.PutUvarint(buf[offset:], prefix) - - n = v.StableSize() - offset += binary.PutUvarint(buf[offset:], uint64(n)) - - _, err = v.StableMarshal(buf[offset:]) + _, err = proto.NestedStructureMarshal(sessionTokenBodyObjectCtxField, buf[offset:], v) if err != nil { return nil, err - } default: panic("cannot marshal unknown session token context") @@ -376,27 +333,14 @@ func (t *SessionTokenBody) StableSize() (size int) { } size += proto.BytesSize(sessionTokenBodyIDField, t.id) - - if t.ownerID != nil { - _, ln := proto.NestedStructurePrefix(sessionTokenBodyOwnerField) - n := t.ownerID.StableSize() - size += ln + proto.VarUIntSize(uint64(n)) + n - } - - if t.lifetime != nil { - _, ln := proto.NestedStructurePrefix(sessionTokenBodyLifetimeField) - n := t.lifetime.StableSize() - size += ln + proto.VarUIntSize(uint64(n)) + n - } - + size += proto.NestedStructureSize(sessionTokenBodyOwnerField, t.ownerID) + size += proto.NestedStructureSize(sessionTokenBodyLifetimeField, t.lifetime) size += proto.BytesSize(sessionTokenBodyKeyField, t.sessionKey) if t.ctx != nil { switch v := t.ctx.(type) { case *ObjectSessionContext: - _, ln := proto.NestedStructurePrefix(sessionTokenBodyObjectCtxField) - n := v.StableSize() - size += ln + proto.VarUIntSize(uint64(n)) + n + size += proto.NestedStructureSize(sessionTokenBodyObjectCtxField, v) default: panic("cannot marshal unknown session token context") } @@ -416,38 +360,19 @@ func (t *SessionToken) StableMarshal(buf []byte) ([]byte, error) { var ( offset, n int - prefix uint64 err error ) - if t.body != nil { - prefix, _ = proto.NestedStructurePrefix(sessionTokenBodyField) - offset += binary.PutUvarint(buf[offset:], prefix) - - n = t.body.StableSize() - offset += binary.PutUvarint(buf[offset:], uint64(n)) - - _, err = t.body.StableMarshal(buf[offset:]) - if err != nil { - return nil, err - - } - - offset += n + n, err = proto.NestedStructureMarshal(sessionTokenBodyField, buf[offset:], t.body) + if err != nil { + return nil, err } - if t.sig != nil { - prefix, _ = proto.NestedStructurePrefix(sessionTokenSignatureField) - offset += binary.PutUvarint(buf[offset:], prefix) + offset += n - n = t.sig.StableSize() - offset += binary.PutUvarint(buf[offset:], uint64(n)) - - _, err = t.sig.StableMarshal(buf[offset:]) - if err != nil { - return nil, err - - } + _, err = proto.NestedStructureMarshal(sessionTokenSignatureField, buf[offset:], t.sig) + if err != nil { + return nil, err } return buf, nil @@ -458,17 +383,8 @@ func (t *SessionToken) StableSize() (size int) { return 0 } - if t.body != nil { - _, ln := proto.NestedStructurePrefix(sessionTokenBodyField) - n := t.body.StableSize() - size += ln + proto.VarUIntSize(uint64(n)) + n - } - - if t.sig != nil { - _, ln := proto.NestedStructurePrefix(sessionTokenSignatureField) - n := t.sig.StableSize() - size += ln + proto.VarUIntSize(uint64(n)) + n - } + size += proto.NestedStructureSize(sessionTokenBodyField, t.body) + size += proto.NestedStructureSize(sessionTokenSignatureField, t.sig) return size } @@ -484,54 +400,26 @@ func (bt *BearerTokenBody) StableMarshal(buf []byte) ([]byte, error) { var ( offset, n int - prefix uint64 err error ) - if bt.eacl != nil { - prefix, _ = proto.NestedStructurePrefix(bearerTokenBodyACLField) - offset += binary.PutUvarint(buf[offset:], prefix) - - n = bt.eacl.StableSize() - offset += binary.PutUvarint(buf[offset:], uint64(n)) - - _, err = bt.eacl.StableMarshal(buf[offset:]) - if err != nil { - return nil, err - - } - - offset += n + n, err = proto.NestedStructureMarshal(bearerTokenBodyACLField, buf[offset:], bt.eacl) + if err != nil { + return nil, err } - if bt.ownerID != nil { - prefix, _ = proto.NestedStructurePrefix(bearerTokenBodyOwnerField) - offset += binary.PutUvarint(buf[offset:], prefix) + offset += n - n = bt.ownerID.StableSize() - offset += binary.PutUvarint(buf[offset:], uint64(n)) - - _, err = bt.ownerID.StableMarshal(buf[offset:]) - if err != nil { - return nil, err - - } - - offset += n + n, err = proto.NestedStructureMarshal(bearerTokenBodyOwnerField, buf[offset:], bt.ownerID) + if err != nil { + return nil, err } - if bt.lifetime != nil { - prefix, _ = proto.NestedStructurePrefix(bearerTokenBodyLifetimeField) - offset += binary.PutUvarint(buf[offset:], prefix) + offset += n - n = bt.lifetime.StableSize() - offset += binary.PutUvarint(buf[offset:], uint64(n)) - - _, err = bt.lifetime.StableMarshal(buf[offset:]) - if err != nil { - return nil, err - - } + _, err = proto.NestedStructureMarshal(bearerTokenBodyLifetimeField, buf[offset:], bt.lifetime) + if err != nil { + return nil, err } return buf, nil @@ -542,23 +430,9 @@ func (bt *BearerTokenBody) StableSize() (size int) { return 0 } - if bt.eacl != nil { - _, ln := proto.NestedStructurePrefix(bearerTokenBodyACLField) - n := bt.eacl.StableSize() - size += ln + proto.VarUIntSize(uint64(n)) + n - } - - if bt.ownerID != nil { - _, ln := proto.NestedStructurePrefix(bearerTokenBodyOwnerField) - n := bt.ownerID.StableSize() - size += ln + proto.VarUIntSize(uint64(n)) + n - } - - if bt.lifetime != nil { - _, ln := proto.NestedStructurePrefix(bearerTokenBodyLifetimeField) - n := bt.lifetime.StableSize() - size += ln + proto.VarUIntSize(uint64(n)) + n - } + size += proto.NestedStructureSize(bearerTokenBodyACLField, bt.eacl) + size += proto.NestedStructureSize(bearerTokenBodyOwnerField, bt.ownerID) + size += proto.NestedStructureSize(bearerTokenBodyLifetimeField, bt.lifetime) return size } @@ -574,38 +448,19 @@ func (bt *BearerToken) StableMarshal(buf []byte) ([]byte, error) { var ( offset, n int - prefix uint64 err error ) - if bt.body != nil { - prefix, _ = proto.NestedStructurePrefix(bearerTokenBodyField) - offset += binary.PutUvarint(buf[offset:], prefix) - - n = bt.body.StableSize() - offset += binary.PutUvarint(buf[offset:], uint64(n)) - - _, err = bt.body.StableMarshal(buf[offset:]) - if err != nil { - return nil, err - - } - - offset += n + n, err = proto.NestedStructureMarshal(bearerTokenBodyField, buf[offset:], bt.body) + if err != nil { + return nil, err } - if bt.sig != nil { - prefix, _ = proto.NestedStructurePrefix(bearerTokenSignatureField) - offset += binary.PutUvarint(buf[offset:], prefix) + offset += n - n = bt.sig.StableSize() - offset += binary.PutUvarint(buf[offset:], uint64(n)) - - _, err = bt.sig.StableMarshal(buf[offset:]) - if err != nil { - return nil, err - - } + _, err = proto.NestedStructureMarshal(bearerTokenSignatureField, buf[offset:], bt.sig) + if err != nil { + return nil, err } return buf, nil @@ -616,17 +471,8 @@ func (bt *BearerToken) StableSize() (size int) { return 0 } - if bt.body != nil { - _, ln := proto.NestedStructurePrefix(bearerTokenBodyField) - n := bt.body.StableSize() - size += ln + proto.VarUIntSize(uint64(n)) + n - } - - if bt.sig != nil { - _, ln := proto.NestedStructurePrefix(bearerTokenSignatureField) - n := bt.sig.StableSize() - size += ln + proto.VarUIntSize(uint64(n)) + n - } + size += proto.NestedStructureSize(bearerTokenBodyField, bt.body) + size += proto.NestedStructureSize(bearerTokenSignatureField, bt.sig) return size } @@ -642,26 +488,16 @@ func (r *RequestMetaHeader) StableMarshal(buf []byte) ([]byte, error) { var ( offset, n int - prefix uint64 err error ) - if r.version != nil { - prefix, _ = proto.NestedStructurePrefix(reqMetaHeaderVersionField) - offset += binary.PutUvarint(buf[offset:], prefix) - - n = r.version.StableSize() - offset += binary.PutUvarint(buf[offset:], uint64(n)) - - _, err = r.version.StableMarshal(buf[offset:]) - if err != nil { - return nil, err - - } - - offset += n + n, err = proto.NestedStructureMarshal(reqMetaHeaderVersionField, buf[offset:], r.version) + if err != nil { + return nil, err } + offset += n + n, err = proto.UInt64Marshal(reqMetaHeaderEpochField, buf[offset:], r.epoch) if err != nil { return nil, err @@ -676,67 +512,32 @@ func (r *RequestMetaHeader) StableMarshal(buf []byte) ([]byte, error) { offset += n - prefix, _ = proto.NestedStructurePrefix(reqMetaHeaderXHeadersField) - for i := range r.xHeaders { - offset += binary.PutUvarint(buf[offset:], prefix) - - n = r.xHeaders[i].StableSize() - offset += binary.PutUvarint(buf[offset:], uint64(n)) - - _, err = r.xHeaders[i].StableMarshal(buf[offset:]) + n, err = proto.NestedStructureMarshal(reqMetaHeaderXHeadersField, buf[offset:], r.xHeaders[i]) if err != nil { return nil, err - } offset += n } - if r.sessionToken != nil { - prefix, _ = proto.NestedStructurePrefix(reqMetaHeaderSessionTokenField) - offset += binary.PutUvarint(buf[offset:], prefix) - - n = r.sessionToken.StableSize() - offset += binary.PutUvarint(buf[offset:], uint64(n)) - - _, err = r.sessionToken.StableMarshal(buf[offset:]) - if err != nil { - return nil, err - - } - - offset += n + n, err = proto.NestedStructureMarshal(reqMetaHeaderSessionTokenField, buf[offset:], r.sessionToken) + if err != nil { + return nil, err } - if r.bearerToken != nil { - prefix, _ = proto.NestedStructurePrefix(reqMetaHeaderBearerTokenField) - offset += binary.PutUvarint(buf[offset:], prefix) + offset += n - n = r.bearerToken.StableSize() - offset += binary.PutUvarint(buf[offset:], uint64(n)) - - _, err = r.bearerToken.StableMarshal(buf[offset:]) - if err != nil { - return nil, err - - } - - offset += n + n, err = proto.NestedStructureMarshal(reqMetaHeaderBearerTokenField, buf[offset:], r.bearerToken) + if err != nil { + return nil, err } - if r.origin != nil { - prefix, _ = proto.NestedStructurePrefix(reqMetaHeaderOriginField) - offset += binary.PutUvarint(buf[offset:], prefix) + offset += n - n = r.origin.StableSize() - offset += binary.PutUvarint(buf[offset:], uint64(n)) - - _, err = r.origin.StableMarshal(buf[offset:]) - if err != nil { - return nil, err - - } + _, err = proto.NestedStructureMarshal(reqMetaHeaderOriginField, buf[offset:], r.origin) + if err != nil { + return nil, err } return buf, nil @@ -748,38 +549,19 @@ func (r *RequestMetaHeader) StableSize() (size int) { } if r.version != nil { - _, ln := proto.NestedStructurePrefix(reqMetaHeaderVersionField) - n := r.version.StableSize() - size += ln + proto.VarUIntSize(uint64(n)) + n + size += proto.NestedStructureSize(reqMetaHeaderVersionField, r.version) } size += proto.UInt64Size(reqMetaHeaderEpochField, r.epoch) size += proto.UInt32Size(reqMetaHeaderTTLField, r.ttl) - _, ln := proto.NestedStructurePrefix(reqMetaHeaderXHeadersField) - for i := range r.xHeaders { - n := r.xHeaders[i].StableSize() - size += ln + proto.VarUIntSize(uint64(n)) + n + size += proto.NestedStructureSize(reqMetaHeaderXHeadersField, r.xHeaders[i]) } - if r.sessionToken != nil { - _, ln := proto.NestedStructurePrefix(reqMetaHeaderSessionTokenField) - n := r.sessionToken.StableSize() - size += ln + proto.VarUIntSize(uint64(n)) + n - } - - if r.bearerToken != nil { - _, ln := proto.NestedStructurePrefix(reqMetaHeaderBearerTokenField) - n := r.bearerToken.StableSize() - size += ln + proto.VarUIntSize(uint64(n)) + n - } - - if r.origin != nil { - _, ln := proto.NestedStructurePrefix(reqMetaHeaderOriginField) - n := r.origin.StableSize() - size += ln + proto.VarUIntSize(uint64(n)) + n - } + size += proto.NestedStructureSize(reqMetaHeaderSessionTokenField, r.sessionToken) + size += proto.NestedStructureSize(reqMetaHeaderBearerTokenField, r.bearerToken) + size += proto.NestedStructureSize(reqMetaHeaderOriginField, r.origin) return size } @@ -795,70 +577,33 @@ func (r *RequestVerificationHeader) StableMarshal(buf []byte) ([]byte, error) { var ( offset, n int - prefix uint64 err error ) - if r.bodySig != nil { - prefix, _ = proto.NestedStructurePrefix(reqVerifHeaderBodySignatureField) - offset += binary.PutUvarint(buf[offset:], prefix) - - n = r.bodySig.StableSize() - offset += binary.PutUvarint(buf[offset:], uint64(n)) - - _, err = r.bodySig.StableMarshal(buf[offset:]) - if err != nil { - return nil, err - - } - - offset += n + n, err = proto.NestedStructureMarshal(reqVerifHeaderBodySignatureField, buf[offset:], r.bodySig) + if err != nil { + return nil, err } - if r.metaSig != nil { - prefix, _ = proto.NestedStructurePrefix(reqVerifHeaderMetaSignatureField) - offset += binary.PutUvarint(buf[offset:], prefix) + offset += n - n = r.metaSig.StableSize() - offset += binary.PutUvarint(buf[offset:], uint64(n)) - - _, err = r.metaSig.StableMarshal(buf[offset:]) - if err != nil { - return nil, err - - } - - offset += n + n, err = proto.NestedStructureMarshal(reqVerifHeaderMetaSignatureField, buf[offset:], r.metaSig) + if err != nil { + return nil, err } - if r.originSig != nil { - prefix, _ = proto.NestedStructurePrefix(reqVerifHeaderOriginSignatureField) - offset += binary.PutUvarint(buf[offset:], prefix) + offset += n - n = r.originSig.StableSize() - offset += binary.PutUvarint(buf[offset:], uint64(n)) - - _, err = r.originSig.StableMarshal(buf[offset:]) - if err != nil { - return nil, err - - } - - offset += n + n, err = proto.NestedStructureMarshal(reqVerifHeaderOriginSignatureField, buf[offset:], r.originSig) + if err != nil { + return nil, err } - if r.origin != nil { - prefix, _ = proto.NestedStructurePrefix(reqVerifHeaderOriginField) - offset += binary.PutUvarint(buf[offset:], prefix) + offset += n - n = r.origin.StableSize() - offset += binary.PutUvarint(buf[offset:], uint64(n)) - - _, err = r.origin.StableMarshal(buf[offset:]) - if err != nil { - return nil, err - - } + _, err = proto.NestedStructureMarshal(reqVerifHeaderOriginField, buf[offset:], r.origin) + if err != nil { + return nil, err } return buf, nil @@ -869,29 +614,10 @@ func (r *RequestVerificationHeader) StableSize() (size int) { return 0 } - if r.bodySig != nil { - _, ln := proto.NestedStructurePrefix(reqVerifHeaderBodySignatureField) - n := r.bodySig.StableSize() - size += ln + proto.VarUIntSize(uint64(n)) + n - } - - if r.metaSig != nil { - _, ln := proto.NestedStructurePrefix(reqVerifHeaderMetaSignatureField) - n := r.metaSig.StableSize() - size += ln + proto.VarUIntSize(uint64(n)) + n - } - - if r.originSig != nil { - _, ln := proto.NestedStructurePrefix(reqVerifHeaderOriginSignatureField) - n := r.originSig.StableSize() - size += ln + proto.VarUIntSize(uint64(n)) + n - } - - if r.origin != nil { - _, ln := proto.NestedStructurePrefix(reqVerifHeaderOriginField) - n := r.origin.StableSize() - size += ln + proto.VarUIntSize(uint64(n)) + n - } + size += proto.NestedStructureSize(reqVerifHeaderBodySignatureField, r.bodySig) + size += proto.NestedStructureSize(reqVerifHeaderMetaSignatureField, r.metaSig) + size += proto.NestedStructureSize(reqVerifHeaderOriginSignatureField, r.originSig) + size += proto.NestedStructureSize(reqVerifHeaderOriginField, r.origin) return size } @@ -907,26 +633,16 @@ func (r *ResponseMetaHeader) StableMarshal(buf []byte) ([]byte, error) { var ( offset, n int - prefix uint64 err error ) - if r.version != nil { - prefix, _ = proto.NestedStructurePrefix(respMetaHeaderVersionField) - offset += binary.PutUvarint(buf[offset:], prefix) - - n = r.version.StableSize() - offset += binary.PutUvarint(buf[offset:], uint64(n)) - - _, err = r.version.StableMarshal(buf[offset:]) - if err != nil { - return nil, err - - } - - offset += n + n, err = proto.NestedStructureMarshal(respMetaHeaderVersionField, buf[offset:], r.version) + if err != nil { + return nil, err } + offset += n + n, err = proto.UInt64Marshal(respMetaHeaderEpochField, buf[offset:], r.epoch) if err != nil { return nil, err @@ -941,35 +657,18 @@ func (r *ResponseMetaHeader) StableMarshal(buf []byte) ([]byte, error) { offset += n - prefix, _ = proto.NestedStructurePrefix(respMetaHeaderXHeadersField) - for i := range r.xHeaders { - offset += binary.PutUvarint(buf[offset:], prefix) - - n = r.xHeaders[i].StableSize() - offset += binary.PutUvarint(buf[offset:], uint64(n)) - - _, err = r.xHeaders[i].StableMarshal(buf[offset:]) + n, err = proto.NestedStructureMarshal(respMetaHeaderXHeadersField, buf[offset:], r.xHeaders[i]) if err != nil { return nil, err - } offset += n } - if r.origin != nil { - prefix, _ = proto.NestedStructurePrefix(respMetaHeaderOriginField) - offset += binary.PutUvarint(buf[offset:], prefix) - - n = r.origin.StableSize() - offset += binary.PutUvarint(buf[offset:], uint64(n)) - - _, err = r.origin.StableMarshal(buf[offset:]) - if err != nil { - return nil, err - - } + _, err = proto.NestedStructureMarshal(respMetaHeaderOriginField, buf[offset:], r.origin) + if err != nil { + return nil, err } return buf, nil @@ -981,26 +680,17 @@ func (r *ResponseMetaHeader) StableSize() (size int) { } if r.version != nil { - _, ln := proto.NestedStructurePrefix(respMetaHeaderVersionField) - n := r.version.StableSize() - size += ln + proto.VarUIntSize(uint64(n)) + n + size += proto.NestedStructureSize(respMetaHeaderVersionField, r.version) } size += proto.UInt64Size(respMetaHeaderEpochField, r.epoch) size += proto.UInt32Size(respMetaHeaderTTLField, r.ttl) - _, ln := proto.NestedStructurePrefix(respMetaHeaderXHeadersField) - for i := range r.xHeaders { - n := r.xHeaders[i].StableSize() - size += ln + proto.VarUIntSize(uint64(n)) + n + size += proto.NestedStructureSize(respMetaHeaderXHeadersField, r.xHeaders[i]) } - if r.origin != nil { - _, ln := proto.NestedStructurePrefix(respMetaHeaderOriginField) - n := r.origin.StableSize() - size += ln + proto.VarUIntSize(uint64(n)) + n - } + size += proto.NestedStructureSize(respMetaHeaderOriginField, r.origin) return size } @@ -1016,70 +706,33 @@ func (r *ResponseVerificationHeader) StableMarshal(buf []byte) ([]byte, error) { var ( offset, n int - prefix uint64 err error ) - if r.bodySig != nil { - prefix, _ = proto.NestedStructurePrefix(respVerifHeaderBodySignatureField) - offset += binary.PutUvarint(buf[offset:], prefix) - - n = r.bodySig.StableSize() - offset += binary.PutUvarint(buf[offset:], uint64(n)) - - _, err = r.bodySig.StableMarshal(buf[offset:]) - if err != nil { - return nil, err - - } - - offset += n + n, err = proto.NestedStructureMarshal(respVerifHeaderBodySignatureField, buf[offset:], r.bodySig) + if err != nil { + return nil, err } - if r.metaSig != nil { - prefix, _ = proto.NestedStructurePrefix(respVerifHeaderMetaSignatureField) - offset += binary.PutUvarint(buf[offset:], prefix) + offset += n - n = r.metaSig.StableSize() - offset += binary.PutUvarint(buf[offset:], uint64(n)) - - _, err = r.metaSig.StableMarshal(buf[offset:]) - if err != nil { - return nil, err - - } - - offset += n + n, err = proto.NestedStructureMarshal(respVerifHeaderMetaSignatureField, buf[offset:], r.metaSig) + if err != nil { + return nil, err } - if r.originSig != nil { - prefix, _ = proto.NestedStructurePrefix(respVerifHeaderOriginSignatureField) - offset += binary.PutUvarint(buf[offset:], prefix) + offset += n - n = r.originSig.StableSize() - offset += binary.PutUvarint(buf[offset:], uint64(n)) - - _, err = r.originSig.StableMarshal(buf[offset:]) - if err != nil { - return nil, err - - } - - offset += n + n, err = proto.NestedStructureMarshal(respVerifHeaderOriginSignatureField, buf[offset:], r.originSig) + if err != nil { + return nil, err } - if r.origin != nil { - prefix, _ = proto.NestedStructurePrefix(respVerifHeaderOriginField) - offset += binary.PutUvarint(buf[offset:], prefix) + offset += n - n = r.origin.StableSize() - offset += binary.PutUvarint(buf[offset:], uint64(n)) - - _, err = r.origin.StableMarshal(buf[offset:]) - if err != nil { - return nil, err - - } + _, err = proto.NestedStructureMarshal(respVerifHeaderOriginField, buf[offset:], r.origin) + if err != nil { + return nil, err } return buf, nil @@ -1090,29 +743,10 @@ func (r *ResponseVerificationHeader) StableSize() (size int) { return 0 } - if r.bodySig != nil { - _, ln := proto.NestedStructurePrefix(respVerifHeaderBodySignatureField) - n := r.bodySig.StableSize() - size += ln + proto.VarUIntSize(uint64(n)) + n - } - - if r.metaSig != nil { - _, ln := proto.NestedStructurePrefix(respVerifHeaderMetaSignatureField) - n := r.metaSig.StableSize() - size += ln + proto.VarUIntSize(uint64(n)) + n - } - - if r.originSig != nil { - _, ln := proto.NestedStructurePrefix(respVerifHeaderOriginSignatureField) - n := r.originSig.StableSize() - size += ln + proto.VarUIntSize(uint64(n)) + n - } - - if r.origin != nil { - _, ln := proto.NestedStructurePrefix(respVerifHeaderOriginField) - n := r.origin.StableSize() - size += ln + proto.VarUIntSize(uint64(n)) + n - } + size += proto.NestedStructureSize(respVerifHeaderBodySignatureField, r.bodySig) + size += proto.NestedStructureSize(respVerifHeaderMetaSignatureField, r.metaSig) + size += proto.NestedStructureSize(respVerifHeaderOriginSignatureField, r.originSig) + size += proto.NestedStructureSize(respVerifHeaderOriginField, r.origin) return size } diff --git a/v2/storagegroup/marshal.go b/v2/storagegroup/marshal.go index 4f30d50..cc1160f 100644 --- a/v2/storagegroup/marshal.go +++ b/v2/storagegroup/marshal.go @@ -1,20 +1,14 @@ package storagegroup import ( - "encoding/binary" - "github.com/nspcc-dev/neofs-api-go/util/proto" ) const ( - // SizeField order number from storage group proto definition. - SizeField = 1 - // HashField order number from storage group proto definition. - HashField = 2 - // ExpirationField order number from storage group proto definition. - ExpirationField = 3 - // ObjectIDsField order number from storage group proto definition. - ObjectIDsField = 4 + sizeField = 1 + hashField = 2 + expirationField = 3 + objectIDsField = 4 ) // StableMarshal marshals unified storage group structure in a protobuf @@ -30,40 +24,32 @@ func (s *StorageGroup) StableMarshal(buf []byte) ([]byte, error) { var ( offset, n int - prefix uint64 err error ) - n, err = proto.UInt64Marshal(SizeField, buf, s.size) + n, err = proto.UInt64Marshal(sizeField, buf[offset:], s.size) if err != nil { return nil, err } offset += n - n, err = proto.BytesMarshal(HashField, buf[offset:], s.hash) + n, err = proto.BytesMarshal(hashField, buf[offset:], s.hash) if err != nil { return nil, err } offset += n - n, err = proto.UInt64Marshal(ExpirationField, buf[offset:], s.exp) + n, err = proto.UInt64Marshal(expirationField, buf[offset:], s.exp) if err != nil { return nil, err } offset += n - prefix, _ = proto.NestedStructurePrefix(ObjectIDsField) - for i := range s.members { - offset += binary.PutUvarint(buf[offset:], prefix) - - n = s.members[i].StableSize() - offset += binary.PutUvarint(buf[offset:], uint64(n)) - - _, err = s.members[i].StableMarshal(buf[offset:]) + n, err = proto.NestedStructureMarshal(objectIDsField, buf[offset:], s.members[i]) if err != nil { return nil, err } @@ -80,15 +66,12 @@ func (s *StorageGroup) StableSize() (size int) { return 0 } - size += proto.UInt64Size(SizeField, s.size) - size += proto.BytesSize(HashField, s.hash) - size += proto.UInt64Size(ExpirationField, s.exp) - - _, ln := proto.NestedStructurePrefix(ObjectIDsField) + size += proto.UInt64Size(sizeField, s.size) + size += proto.BytesSize(hashField, s.hash) + size += proto.UInt64Size(expirationField, s.exp) for i := range s.members { - n := s.members[i].StableSize() - size += ln + proto.VarUIntSize(uint64(n)) + n + size += proto.NestedStructureSize(objectIDsField, s.members[i]) } return size From 7a55865f74f56dc56ba78894941ee70683de7016 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 18 Aug 2020 13:23:26 +0300 Subject: [PATCH 0324/1196] v2/object: Implement uni-structures for ObjectService Signed-off-by: Leonard Lyubich --- v2/object/convert.go | 1228 ++++++++++++++++++++++++++++++++- v2/object/grpc/service.go | 129 ++-- v2/object/types.go | 1372 ++++++++++++++++++++++++++++++++++++- 3 files changed, 2688 insertions(+), 41 deletions(-) diff --git a/v2/object/convert.go b/v2/object/convert.go index b742e0d..0517efa 100644 --- a/v2/object/convert.go +++ b/v2/object/convert.go @@ -1,6 +1,8 @@ package object import ( + "fmt" + object "github.com/nspcc-dev/neofs-api-go/v2/object/grpc" "github.com/nspcc-dev/neofs-api-go/v2/refs" refsGRPC "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" @@ -44,7 +46,7 @@ func ShortHeaderToGRPCMessage(h *ShortHeader) *object.ShortHeader { TypeToGRPCField(h.GetObjectType()), ) - m.SetPayloadLength(h.GeyPayloadLength()) + m.SetPayloadLength(h.GetPayloadLength()) return m } @@ -320,3 +322,1227 @@ func ObjectFromGRPCMessage(m *object.Object) *Object { return o } + +func GetRequestBodyToGRPCMessage(r *GetRequestBody) *object.GetRequest_Body { + if r == nil { + return nil + } + + m := new(object.GetRequest_Body) + + m.SetAddress( + refs.AddressToGRPCMessage(r.GetAddress()), + ) + + m.SetRaw(r.GetRaw()) + + return m +} + +func GetRequestBodyFromGRPCMessage(m *object.GetRequest_Body) *GetRequestBody { + if m == nil { + return nil + } + + r := new(GetRequestBody) + + r.SetAddress( + refs.AddressFromGRPCMessage(m.GetAddress()), + ) + + r.SetRaw(m.GetRaw()) + + return r +} + +func GetRequestToGRPCMessage(r *GetRequest) *object.GetRequest { + if r == nil { + return nil + } + + m := new(object.GetRequest) + + m.SetBody( + GetRequestBodyToGRPCMessage(r.GetBody()), + ) + + service.RequestHeadersToGRPC(r, m) + + return m +} + +func GetRequestFromGRPCMessage(m *object.GetRequest) *GetRequest { + if m == nil { + return nil + } + + r := new(GetRequest) + + r.SetBody( + GetRequestBodyFromGRPCMessage(m.GetBody()), + ) + + service.RequestHeadersFromGRPC(m, r) + + return r +} + +func GetObjectPartInitToGRPCMessage(r *GetObjectPartInit) *object.GetResponse_Body_Init { + if r == nil { + return nil + } + + m := new(object.GetResponse_Body_Init) + + m.SetObjectId( + refs.ObjectIDToGRPCMessage(r.GetObjectID()), + ) + + m.SetSignature( + service.SignatureToGRPCMessage(r.GetSignature()), + ) + + m.SetHeader( + HeaderToGRPCMessage(r.GetHeader()), + ) + + return m +} + +func GetObjectPartInitFromGRPCMessage(m *object.GetResponse_Body_Init) *GetObjectPartInit { + if m == nil { + return nil + } + + r := new(GetObjectPartInit) + + r.SetObjectID( + refs.ObjectIDFromGRPCMessage(m.GetObjectId()), + ) + + r.SetSignature( + service.SignatureFromGRPCMessage(m.GetSignature()), + ) + + r.SetHeader( + HeaderFromGRPCMessage(m.GetHeader()), + ) + + return r +} + +func GetObjectPartChunkToGRPCMessage(r *GetObjectPartChunk) *object.GetResponse_Body_Chunk { + if r == nil { + return nil + } + + m := new(object.GetResponse_Body_Chunk) + + m.SetChunk(r.GetChunk()) + + return m +} + +func GetObjectPartChunkFromGRPCMessage(m *object.GetResponse_Body_Chunk) *GetObjectPartChunk { + if m == nil { + return nil + } + + r := new(GetObjectPartChunk) + + r.SetChunk(m.GetChunk()) + + return r +} + +func GetResponseBodyToGRPCMessage(r *GetResponseBody) *object.GetResponse_Body { + if r == nil { + return nil + } + + m := new(object.GetResponse_Body) + + switch v := r.GetObjectPart(); t := v.(type) { + case nil: + case *GetObjectPartInit: + m.SetInit( + GetObjectPartInitToGRPCMessage(t), + ) + case *GetObjectPartChunk: + m.SetChunk( + GetObjectPartChunkToGRPCMessage(t), + ) + default: + panic(fmt.Sprintf("unknown object part %T", t)) + } + + return m +} + +func GetResponseBodyFromGRPCMessage(m *object.GetResponse_Body) *GetResponseBody { + if m == nil { + return nil + } + + r := new(GetResponseBody) + + switch v := m.GetObjectPart().(type) { + case nil: + case *object.GetResponse_Body_Init_: + r.SetObjectPart( + GetObjectPartInitFromGRPCMessage(v.Init), + ) + case *object.GetResponse_Body_Chunk: + r.SetObjectPart( + GetObjectPartChunkFromGRPCMessage(v), + ) + default: + panic(fmt.Sprintf("unknown object part %T", v)) + } + + return r +} + +func GetResponseToGRPCMessage(r *GetResponse) *object.GetResponse { + if r == nil { + return nil + } + + m := new(object.GetResponse) + + m.SetBody( + GetResponseBodyToGRPCMessage(r.GetBody()), + ) + + service.ResponseHeadersToGRPC(r, m) + + return m +} + +func GetResponseFromGRPCMessage(m *object.GetResponse) *GetResponse { + if m == nil { + return nil + } + + r := new(GetResponse) + + r.SetBody( + GetResponseBodyFromGRPCMessage(m.GetBody()), + ) + + service.ResponseHeadersFromGRPC(m, r) + + return r +} + +func PutObjectPartInitToGRPCMessage(r *PutObjectPartInit) *object.PutRequest_Body_Init { + if r == nil { + return nil + } + + m := new(object.PutRequest_Body_Init) + + m.SetObjectId( + refs.ObjectIDToGRPCMessage(r.GetObjectID()), + ) + + m.SetSignature( + service.SignatureToGRPCMessage(r.GetSignature()), + ) + + m.SetHeader( + HeaderToGRPCMessage(r.GetHeader()), + ) + + m.SetCopiesNumber(r.GetCopiesNumber()) + + return m +} + +func PutObjectPartInitFromGRPCMessage(m *object.PutRequest_Body_Init) *PutObjectPartInit { + if m == nil { + return nil + } + + r := new(PutObjectPartInit) + + r.SetObjectID( + refs.ObjectIDFromGRPCMessage(m.GetObjectId()), + ) + + r.SetSignature( + service.SignatureFromGRPCMessage(m.GetSignature()), + ) + + r.SetHeader( + HeaderFromGRPCMessage(m.GetHeader()), + ) + + r.SetCopiesNumber(m.GetCopiesNumber()) + + return r +} + +func PutObjectPartChunkToGRPCMessage(r *PutObjectPartChunk) *object.PutRequest_Body_Chunk { + if r == nil { + return nil + } + + m := new(object.PutRequest_Body_Chunk) + + m.SetChunk(r.GetChunk()) + + return m +} + +func PutObjectPartChunkFromGRPCMessage(m *object.PutRequest_Body_Chunk) *PutObjectPartChunk { + if m == nil { + return nil + } + + r := new(PutObjectPartChunk) + + r.SetChunk(m.GetChunk()) + + return r +} + +func PutRequestBodyToGRPCMessage(r *PutRequestBody) *object.PutRequest_Body { + if r == nil { + return nil + } + + m := new(object.PutRequest_Body) + + switch v := r.GetObjectPart(); t := v.(type) { + case nil: + case *PutObjectPartInit: + m.SetInit( + PutObjectPartInitToGRPCMessage(t), + ) + case *PutObjectPartChunk: + m.SetChunk( + PutObjectPartChunkToGRPCMessage(t), + ) + default: + panic(fmt.Sprintf("unknown object part %T", t)) + } + + return m +} + +func PutRequestBodyFromGRPCMessage(m *object.PutRequest_Body) *PutRequestBody { + if m == nil { + return nil + } + + r := new(PutRequestBody) + + switch v := m.GetObjectPart().(type) { + case nil: + case *object.PutRequest_Body_Init_: + r.SetObjectPart( + PutObjectPartInitFromGRPCMessage(v.Init), + ) + case *object.PutRequest_Body_Chunk: + r.SetObjectPart( + PutObjectPartChunkFromGRPCMessage(v), + ) + default: + panic(fmt.Sprintf("unknown object part %T", v)) + } + + return r +} + +func PutRequestToGRPCMessage(r *PutRequest) *object.PutRequest { + if r == nil { + return nil + } + + m := new(object.PutRequest) + + m.SetBody( + PutRequestBodyToGRPCMessage(r.GetBody()), + ) + + service.RequestHeadersToGRPC(r, m) + + return m +} + +func PutRequestFromGRPCMessage(m *object.PutRequest) *PutRequest { + if m == nil { + return nil + } + + r := new(PutRequest) + + r.SetBody( + PutRequestBodyFromGRPCMessage(m.GetBody()), + ) + + service.RequestHeadersFromGRPC(m, r) + + return r +} + +func PutResponseBodyToGRPCMessage(r *PutResponseBody) *object.PutResponse_Body { + if r == nil { + return nil + } + + m := new(object.PutResponse_Body) + + m.SetObjectId( + refs.ObjectIDToGRPCMessage(r.GetObjectID()), + ) + + return m +} + +func PutResponseBodyFromGRPCMessage(m *object.PutResponse_Body) *PutResponseBody { + if m == nil { + return nil + } + + r := new(PutResponseBody) + + r.SetObjectID( + refs.ObjectIDFromGRPCMessage(m.GetObjectId()), + ) + + return r +} + +func PutResponseToGRPCMessage(r *PutResponse) *object.PutResponse { + if r == nil { + return nil + } + + m := new(object.PutResponse) + + m.SetBody( + PutResponseBodyToGRPCMessage(r.GetBody()), + ) + + service.ResponseHeadersToGRPC(r, m) + + return m +} + +func PutResponseFromGRPCMessage(m *object.PutResponse) *PutResponse { + if m == nil { + return nil + } + + r := new(PutResponse) + + r.SetBody( + PutResponseBodyFromGRPCMessage(m.GetBody()), + ) + + service.ResponseHeadersFromGRPC(m, r) + + return r +} + +func DeleteRequestBodyToGRPCMessage(r *DeleteRequestBody) *object.DeleteRequest_Body { + if r == nil { + return nil + } + + m := new(object.DeleteRequest_Body) + + m.SetAddress( + refs.AddressToGRPCMessage(r.GetAddress()), + ) + + m.SetOwnerId( + refs.OwnerIDToGRPCMessage(r.GetOwnerID()), + ) + + return m +} + +func DeleteRequestBodyFromGRPCMessage(m *object.DeleteRequest_Body) *DeleteRequestBody { + if m == nil { + return nil + } + + r := new(DeleteRequestBody) + + r.SetAddress( + refs.AddressFromGRPCMessage(m.GetAddress()), + ) + + r.SetOwnerID( + refs.OwnerIDFromGRPCMessage(m.GetOwnerId()), + ) + + return r +} + +func DeleteRequestToGRPCMessage(r *DeleteRequest) *object.DeleteRequest { + if r == nil { + return nil + } + + m := new(object.DeleteRequest) + + m.SetBody( + DeleteRequestBodyToGRPCMessage(r.GetBody()), + ) + + service.RequestHeadersToGRPC(r, m) + + return m +} + +func DeleteRequestFromGRPCMessage(m *object.DeleteRequest) *DeleteRequest { + if m == nil { + return nil + } + + r := new(DeleteRequest) + + r.SetBody( + DeleteRequestBodyFromGRPCMessage(m.GetBody()), + ) + + service.RequestHeadersFromGRPC(m, r) + + return r +} + +func DeleteResponseBodyToGRPCMessage(r *DeleteResponseBody) *object.DeleteResponse_Body { + if r == nil { + return nil + } + + m := new(object.DeleteResponse_Body) + + return m +} + +func DeleteResponseBodyFromGRPCMessage(m *object.DeleteResponse_Body) *DeleteResponseBody { + if m == nil { + return nil + } + + r := new(DeleteResponseBody) + + return r +} + +func DeleteResponseToGRPCMessage(r *DeleteResponse) *object.DeleteResponse { + if r == nil { + return nil + } + + m := new(object.DeleteResponse) + + m.SetBody( + DeleteResponseBodyToGRPCMessage(r.GetBody()), + ) + + service.ResponseHeadersToGRPC(r, m) + + return m +} + +func DeleteResponseFromGRPCMessage(m *object.DeleteResponse) *DeleteResponse { + if m == nil { + return nil + } + + r := new(DeleteResponse) + + r.SetBody( + DeleteResponseBodyFromGRPCMessage(m.GetBody()), + ) + + service.ResponseHeadersFromGRPC(m, r) + + return r +} + +func HeadRequestBodyToGRPCMessage(r *HeadRequestBody) *object.HeadRequest_Body { + if r == nil { + return nil + } + + m := new(object.HeadRequest_Body) + + m.SetAddress( + refs.AddressToGRPCMessage(r.GetAddress()), + ) + + m.SetMainOnly(r.GetMainOnly()) + + m.SetRaw(r.GetRaw()) + + return m +} + +func HeadRequestBodyFromGRPCMessage(m *object.HeadRequest_Body) *HeadRequestBody { + if m == nil { + return nil + } + + r := new(HeadRequestBody) + + r.SetAddress( + refs.AddressFromGRPCMessage(m.GetAddress()), + ) + + r.SetMainOnly(m.GetMainOnly()) + + r.SetRaw(m.GetRaw()) + + return r +} + +func HeadRequestToGRPCMessage(r *HeadRequest) *object.HeadRequest { + if r == nil { + return nil + } + + m := new(object.HeadRequest) + + m.SetBody( + HeadRequestBodyToGRPCMessage(r.GetBody()), + ) + + service.RequestHeadersToGRPC(r, m) + + return m +} + +func HeadRequestFromGRPCMessage(m *object.HeadRequest) *HeadRequest { + if m == nil { + return nil + } + + r := new(HeadRequest) + + r.SetBody( + HeadRequestBodyFromGRPCMessage(m.GetBody()), + ) + + service.RequestHeadersFromGRPC(m, r) + + return r +} + +func GetHeaderPartFullToGRPCMessage(r *GetHeaderPartFull) *object.HeadResponse_Body_Header { + if r == nil { + return nil + } + + m := new(object.HeadResponse_Body_Header) + + m.SetHeader( + HeaderToGRPCMessage(r.GetHeader()), + ) + + return m +} + +func GetHeaderPartFullFromGRPCMessage(m *object.HeadResponse_Body_Header) *GetHeaderPartFull { + if m == nil { + return nil + } + + r := new(GetHeaderPartFull) + + r.SetHeader( + HeaderFromGRPCMessage(m.GetHeader()), + ) + + return r +} + +func GetHeaderPartShortToGRPCMessage(r *GetHeaderPartShort) *object.HeadResponse_Body_ShortHeader { + if r == nil { + return nil + } + + m := new(object.HeadResponse_Body_ShortHeader) + + m.SetShortHeader( + ShortHeaderToGRPCMessage(r.GetShortHeader()), + ) + + return m +} + +func GetHeaderPartShortFromGRPCMessage(m *object.HeadResponse_Body_ShortHeader) *GetHeaderPartShort { + if m == nil { + return nil + } + + r := new(GetHeaderPartShort) + + r.SetShortHeader( + ShortHeaderFromGRPCMessage(m.GetShortHeader()), + ) + + return r +} + +func HeadResponseBodyToGRPCMessage(r *HeadResponseBody) *object.HeadResponse_Body { + if r == nil { + return nil + } + + m := new(object.HeadResponse_Body) + + switch v := r.GetHeaderPart(); t := v.(type) { + case nil: + case *GetHeaderPartFull: + m.SetHeader( + GetHeaderPartFullToGRPCMessage(t), + ) + case *GetHeaderPartShort: + m.SetShortHeader( + GetHeaderPartShortToGRPCMessage(t), + ) + default: + panic(fmt.Sprintf("unknown header part %T", t)) + } + + return m +} + +func HeadResponseBodyFromGRPCMessage(m *object.HeadResponse_Body) *HeadResponseBody { + if m == nil { + return nil + } + + r := new(HeadResponseBody) + + switch v := m.GetHead().(type) { + case nil: + case *object.HeadResponse_Body_Header: + r.SetHeaderPart( + GetHeaderPartFullFromGRPCMessage(v), + ) + case *object.HeadResponse_Body_ShortHeader: + r.SetHeaderPart( + GetHeaderPartShortFromGRPCMessage(v), + ) + default: + panic(fmt.Sprintf("unknown header part %T", v)) + } + + return r +} + +func HeadResponseToGRPCMessage(r *HeadResponse) *object.HeadResponse { + if r == nil { + return nil + } + + m := new(object.HeadResponse) + + m.SetBody( + HeadResponseBodyToGRPCMessage(r.GetBody()), + ) + + service.ResponseHeadersToGRPC(r, m) + + return m +} + +func HeadResponseFromGRPCMessage(m *object.HeadResponse) *HeadResponse { + if m == nil { + return nil + } + + r := new(HeadResponse) + + r.SetBody( + HeadResponseBodyFromGRPCMessage(m.GetBody()), + ) + + service.ResponseHeadersFromGRPC(m, r) + + return r +} + +func SearchFilterToGRPCMessage(f *SearchFilter) *object.SearchRequest_Body_Filter { + if f == nil { + return nil + } + + m := new(object.SearchRequest_Body_Filter) + + m.SetMatchType( + MatchTypeToGRPCField(f.GetMatchType()), + ) + + m.SetName(f.GetName()) + + m.SetValue(f.GetValue()) + + return m +} + +func SearchFilterFromGRPCMessage(m *object.SearchRequest_Body_Filter) *SearchFilter { + if m == nil { + return nil + } + + f := new(SearchFilter) + + f.SetMatchType( + MatchTypeFromGRPCField(m.GetMatchType()), + ) + + f.SetName(m.GetName()) + + f.SetValue(m.GetValue()) + + return f +} + +func SearchRequestBodyToGRPCMessage(r *SearchRequestBody) *object.SearchRequest_Body { + if r == nil { + return nil + } + + m := new(object.SearchRequest_Body) + + m.SetContainerId( + refs.ContainerIDToGRPCMessage(r.GetContainerID()), + ) + + m.SetVersion(r.GetVersion()) + + filters := r.GetFilters() + filterMsg := make([]*object.SearchRequest_Body_Filter, 0, len(filters)) + + for i := range filters { + filterMsg = append(filterMsg, SearchFilterToGRPCMessage(filters[i])) + } + + m.SetFilters(filterMsg) + + return m +} + +func SearchRequestBodyFromGRPCMessage(m *object.SearchRequest_Body) *SearchRequestBody { + if m == nil { + return nil + } + + r := new(SearchRequestBody) + + r.SetContainerID( + refs.ContainerIDFromGRPCMessage(m.GetContainerId()), + ) + + r.SetVersion(m.GetVersion()) + + filterMsg := m.GetFilters() + filters := make([]*SearchFilter, 0, len(filterMsg)) + + for i := range filterMsg { + filters = append(filters, SearchFilterFromGRPCMessage(filterMsg[i])) + } + + r.SetFilters(filters) + + return r +} + +func SearchRequestToGRPCMessage(r *SearchRequest) *object.SearchRequest { + if r == nil { + return nil + } + + m := new(object.SearchRequest) + + m.SetBody( + SearchRequestBodyToGRPCMessage(r.GetBody()), + ) + + service.RequestHeadersToGRPC(r, m) + + return m +} + +func SearchRequestFromGRPCMessage(m *object.SearchRequest) *SearchRequest { + if m == nil { + return nil + } + + r := new(SearchRequest) + + r.SetBody( + SearchRequestBodyFromGRPCMessage(m.GetBody()), + ) + + service.RequestHeadersFromGRPC(m, r) + + return r +} + +func SearchResponseBodyToGRPCMessage(r *SearchResponseBody) *object.SearchResponse_Body { + if r == nil { + return nil + } + + m := new(object.SearchResponse_Body) + + ids := r.GetIDList() + idMsg := make([]*refsGRPC.ObjectID, 0, len(ids)) + + for i := range ids { + idMsg = append(idMsg, refs.ObjectIDToGRPCMessage(ids[i])) + } + + m.SetIdList(idMsg) + + return m +} + +func SearchResponseBodyFromGRPCMessage(m *object.SearchResponse_Body) *SearchResponseBody { + if m == nil { + return nil + } + + r := new(SearchResponseBody) + + idMsg := m.GetIdList() + ids := make([]*refs.ObjectID, 0, len(idMsg)) + + for i := range idMsg { + ids = append(ids, refs.ObjectIDFromGRPCMessage(idMsg[i])) + } + + r.SetIDList(ids) + + return r +} + +func SearchResponseToGRPCMessage(r *SearchResponse) *object.SearchResponse { + if r == nil { + return nil + } + + m := new(object.SearchResponse) + + m.SetBody( + SearchResponseBodyToGRPCMessage(r.GetBody()), + ) + + service.ResponseHeadersToGRPC(r, m) + + return m +} + +func SearchResponseFromGRPCMessage(m *object.SearchResponse) *SearchResponse { + if m == nil { + return nil + } + + r := new(SearchResponse) + + r.SetBody( + SearchResponseBodyFromGRPCMessage(m.GetBody()), + ) + + service.ResponseHeadersFromGRPC(m, r) + + return r +} + +func RangeToGRPCMessage(r *Range) *object.Range { + if r == nil { + return nil + } + + m := new(object.Range) + + m.SetOffset(r.GetOffset()) + m.SetLength(r.GetLength()) + + return m +} + +func RangeFromGRPCMessage(m *object.Range) *Range { + if m == nil { + return nil + } + + r := new(Range) + + r.SetOffset(m.GetOffset()) + r.SetLength(m.GetLength()) + + return r +} + +func GetRangeRequestBodyToGRPCMessage(r *GetRangeRequestBody) *object.GetRangeRequest_Body { + if r == nil { + return nil + } + + m := new(object.GetRangeRequest_Body) + + m.SetAddress( + refs.AddressToGRPCMessage(r.GetAddress()), + ) + + m.SetRange( + RangeToGRPCMessage(r.GetRange()), + ) + + return m +} + +func GetRangeRequestBodyFromGRPCMessage(m *object.GetRangeRequest_Body) *GetRangeRequestBody { + if m == nil { + return nil + } + + r := new(GetRangeRequestBody) + + r.SetAddress( + refs.AddressFromGRPCMessage(m.GetAddress()), + ) + + r.SetRange( + RangeFromGRPCMessage(m.GetRange()), + ) + + return r +} + +func GetRangeRequestToGRPCMessage(r *GetRangeRequest) *object.GetRangeRequest { + if r == nil { + return nil + } + + m := new(object.GetRangeRequest) + + m.SetBody( + GetRangeRequestBodyToGRPCMessage(r.GetBody()), + ) + + service.RequestHeadersToGRPC(r, m) + + return m +} + +func GetRangeRequestFromGRPCMessage(m *object.GetRangeRequest) *GetRangeRequest { + if m == nil { + return nil + } + + r := new(GetRangeRequest) + + r.SetBody( + GetRangeRequestBodyFromGRPCMessage(m.GetBody()), + ) + + service.RequestHeadersFromGRPC(m, r) + + return r +} + +func GetRangeResponseBodyToGRPCMessage(r *GetRangeResponseBody) *object.GetRangeResponse_Body { + if r == nil { + return nil + } + + m := new(object.GetRangeResponse_Body) + + m.SetChunk(r.GetChunk()) + + return m +} + +func GetRangeResponseBodyFromGRPCMessage(m *object.GetRangeResponse_Body) *GetRangeResponseBody { + if m == nil { + return nil + } + + r := new(GetRangeResponseBody) + + r.SetChunk(m.GetChunk()) + + return r +} + +func GetRangeResponseToGRPCMessage(r *GetRangeResponse) *object.GetRangeResponse { + if r == nil { + return nil + } + + m := new(object.GetRangeResponse) + + m.SetBody( + GetRangeResponseBodyToGRPCMessage(r.GetBody()), + ) + + service.ResponseHeadersToGRPC(r, m) + + return m +} + +func GetRangeResponseFromGRPCMessage(m *object.GetRangeResponse) *GetRangeResponse { + if m == nil { + return nil + } + + r := new(GetRangeResponse) + + r.SetBody( + GetRangeResponseBodyFromGRPCMessage(m.GetBody()), + ) + + service.ResponseHeadersFromGRPC(m, r) + + return r +} + +func GetRangeHashRequestBodyToGRPCMessage(r *GetRangeHashRequestBody) *object.GetRangeHashRequest_Body { + if r == nil { + return nil + } + + m := new(object.GetRangeHashRequest_Body) + + m.SetAddress( + refs.AddressToGRPCMessage(r.GetAddress()), + ) + + m.SetSalt(r.GetSalt()) + + rngs := r.GetRanges() + rngMsg := make([]*object.Range, 0, len(rngs)) + + for i := range rngs { + rngMsg = append(rngMsg, RangeToGRPCMessage(rngs[i])) + } + + m.SetRanges(rngMsg) + + return m +} + +func GetRangeHashRequestBodyFromGRPCMessage(m *object.GetRangeHashRequest_Body) *GetRangeHashRequestBody { + if m == nil { + return nil + } + + r := new(GetRangeHashRequestBody) + + r.SetAddress( + refs.AddressFromGRPCMessage(m.GetAddress()), + ) + + r.SetSalt(m.GetSalt()) + + rngMsg := m.GetRanges() + rngs := make([]*Range, 0, len(rngMsg)) + + for i := range rngMsg { + rngs = append(rngs, RangeFromGRPCMessage(rngMsg[i])) + } + + r.SetRanges(rngs) + + return r +} + +func GetRangeHashRequestToGRPCMessage(r *GetRangeHashRequest) *object.GetRangeHashRequest { + if r == nil { + return nil + } + + m := new(object.GetRangeHashRequest) + + m.SetBody( + GetRangeHashRequestBodyToGRPCMessage(r.GetBody()), + ) + + service.RequestHeadersToGRPC(r, m) + + return m +} + +func GetRangeHashRequestFromGRPCMessage(m *object.GetRangeHashRequest) *GetRangeHashRequest { + if m == nil { + return nil + } + + r := new(GetRangeHashRequest) + + r.SetBody( + GetRangeHashRequestBodyFromGRPCMessage(m.GetBody()), + ) + + service.RequestHeadersFromGRPC(m, r) + + return r +} + +func GetRangeHashResponseBodyToGRPCMessage(r *GetRangeHashResponseBody) *object.GetRangeHashResponse_Body { + if r == nil { + return nil + } + + m := new(object.GetRangeHashResponse_Body) + + m.SetHashList(r.GetHashList()) + + return m +} + +func GetRangeHashResponseBodyFromGRPCMessage(m *object.GetRangeHashResponse_Body) *GetRangeHashResponseBody { + if m == nil { + return nil + } + + r := new(GetRangeHashResponseBody) + + r.SetHashList(m.GetHashList()) + + return r +} + +func GetRangeHashResponseToGRPCMessage(r *GetRangeHashResponse) *object.GetRangeHashResponse { + if r == nil { + return nil + } + + m := new(object.GetRangeHashResponse) + + m.SetBody( + GetRangeHashResponseBodyToGRPCMessage(r.GetBody()), + ) + + service.ResponseHeadersToGRPC(r, m) + + return m +} + +func GetRangeHashResponseFromGRPCMessage(m *object.GetRangeHashResponse) *GetRangeHashResponse { + if m == nil { + return nil + } + + r := new(GetRangeHashResponse) + + r.SetBody( + GetRangeHashResponseBodyFromGRPCMessage(m.GetBody()), + ) + + service.ResponseHeadersFromGRPC(m, r) + + return r +} diff --git a/v2/object/grpc/service.go b/v2/object/grpc/service.go index 1b95500..09e058a 100644 --- a/v2/object/grpc/service.go +++ b/v2/object/grpc/service.go @@ -61,6 +61,22 @@ func (m *GetResponse_Body_Init) SetHeader(v *Header) { } } +// GetChunk returns chunk of the object payload bytes. +func (m *GetResponse_Body_Chunk) GetChunk() []byte { + if m != nil { + return m.Chunk + } + + return nil +} + +// SetChunk sets chunk of the object payload bytes. +func (m *GetResponse_Body_Chunk) SetChunk(v []byte) { + if m != nil { + m.Chunk = v + } +} + // SetInit sets initial part of the object. func (m *GetResponse_Body) SetInit(v *GetResponse_Body_Init) { if m != nil { @@ -70,12 +86,10 @@ func (m *GetResponse_Body) SetInit(v *GetResponse_Body_Init) { } } -// SetChunk sets chunk of the object payload bytes. -func (m *GetResponse_Body) SetChunk(v []byte) { +// SetChunk sets part of the object payload. +func (m *GetResponse_Body) SetChunk(v *GetResponse_Body_Chunk) { if m != nil { - m.ObjectPart = &GetResponse_Body_Chunk{ - Chunk: v, - } + m.ObjectPart = v } } @@ -128,6 +142,22 @@ func (m *PutRequest_Body_Init) SetCopiesNumber(v uint32) { } } +// GetChunk returns chunk of the object payload bytes. +func (m *PutRequest_Body_Chunk) GetChunk() []byte { + if m != nil { + return m.Chunk + } + + return nil +} + +// SetChunk sets chunk of the object payload bytes. +func (m *PutRequest_Body_Chunk) SetChunk(v []byte) { + if m != nil { + m.Chunk = v + } +} + // SetInit sets initial part of the object. func (m *PutRequest_Body) SetInit(v *PutRequest_Body_Init) { if m != nil { @@ -137,12 +167,10 @@ func (m *PutRequest_Body) SetInit(v *PutRequest_Body_Init) { } } -// SetChunk sets chunk of the object paloyad bytes. -func (m *PutRequest_Body) SetChunk(v []byte) { +// SetChunk sets part of the object payload. +func (m *PutRequest_Body) SetChunk(v *PutRequest_Body_Chunk) { if m != nil { - m.ObjectPart = &PutRequest_Body_Chunk{ - Chunk: v, - } + m.ObjectPart = v } } @@ -251,8 +279,8 @@ func (m *DeleteResponse) SetVerifyHeader(v *service.ResponseVerificationHeader) } } -// SetOwnerId sets identifier of the object with the requested header. -func (m *HeadRequest_Body) SetOwnerId(v *refs.Address) { +// SetAddress sets address of the object with the requested header. +func (m *HeadRequest_Body) SetAddress(v *refs.Address) { if m != nil { m.Address = v } @@ -293,47 +321,42 @@ func (m *HeadRequest) SetVerifyHeader(v *service.RequestVerificationHeader) { } } -// SetVersion sets version of the object format. -func (m *HeadResponse_Body_ShortHeader) SetVersion(v *service.Version) { +// GetShortHeader returns short header of the object. +func (m *HeadResponse_Body_ShortHeader) GetShortHeader() *ShortHeader { if m != nil { - m.ShortHeader.Version = v + return m.ShortHeader + } + + return nil +} + +// SetShortHeader sets short header of the object. +func (m *HeadResponse_Body_ShortHeader) SetShortHeader(v *ShortHeader) { + if m != nil { + m.ShortHeader = v } } -// SetCreationEpoch sets creation epoch number of the object. -func (m *HeadResponse_Body_ShortHeader) SetCreationEpoch(v uint64) { +// GetHeader returns object header. +func (m *HeadResponse_Body_Header) GetHeader() *Header { if m != nil { - m.ShortHeader.CreationEpoch = v + return m.Header } + + return nil } -// SetOwnerId sets identifier of the object owner. -func (m *HeadResponse_Body_ShortHeader) SetOwnerId(v *refs.OwnerID) { +// SetHeader sets object header. +func (m *HeadResponse_Body_Header) SetHeader(v *Header) { if m != nil { - m.ShortHeader.OwnerId = v - } -} - -// SetObjectType sets type of the object. -func (m *HeadResponse_Body_ShortHeader) SetObjectType(v ObjectType) { - if m != nil { - m.ShortHeader.ObjectType = v - } -} - -// SetPayloadLength sets length of the object payload. -func (m *HeadResponse_Body_ShortHeader) SetPayloadLength(v uint64) { - if m != nil { - m.ShortHeader.PayloadLength = v + m.Header = v } } // SetHeader sets full header of the object. -func (m *HeadResponse_Body) SetHeader(v *Header) { +func (m *HeadResponse_Body) SetHeader(v *HeadResponse_Body_Header) { if m != nil { - m.Head = &HeadResponse_Body_Header{ - Header: v, - } + m.Head = v } } @@ -574,3 +597,31 @@ func (m *GetRangeHashRequest) SetVerifyHeader(v *service.RequestVerificationHead m.VerifyHeader = v } } + +// SetHashList returns list of the range hashes. +func (m *GetRangeHashResponse_Body) SetHashList(v [][]byte) { + if m != nil { + m.HashList = v + } +} + +// SetBody sets body of the response. +func (m *GetRangeHashResponse) SetBody(v *GetRangeHashResponse_Body) { + if m != nil { + m.Body = v + } +} + +// SetMetaHeader sets meta header of the response. +func (m *GetRangeHashResponse) SetMetaHeader(v *service.ResponseMetaHeader) { + if m != nil { + m.MetaHeader = v + } +} + +// SetVerifyHeader sets verification header of the response. +func (m *GetRangeHashResponse) SetVerifyHeader(v *service.ResponseVerificationHeader) { + if m != nil { + m.VerifyHeader = v + } +} diff --git a/v2/object/types.go b/v2/object/types.go index 191457b..3ed9f39 100644 --- a/v2/object/types.go +++ b/v2/object/types.go @@ -67,6 +67,244 @@ type Object struct { payload []byte } +type GetRequestBody struct { + addr *refs.Address + + raw bool +} + +type GetRequest struct { + body *GetRequestBody + + metaHeader *service.RequestMetaHeader + + verifyHeader *service.RequestVerificationHeader +} + +type GetObjectPart interface { + getObjectPart() +} + +type GetObjectPartInit struct { + id *refs.ObjectID + + sig *service.Signature + + hdr *Header +} + +type GetObjectPartChunk struct { + chunk []byte +} + +type GetResponseBody struct { + objPart GetObjectPart +} + +type GetResponse struct { + body *GetResponseBody + + metaHeader *service.ResponseMetaHeader + + verifyHeader *service.ResponseVerificationHeader +} + +type PutObjectPart interface { + putObjectPart() +} + +type PutObjectPartInit struct { + id *refs.ObjectID + + sig *service.Signature + + hdr *Header + + copyNum uint32 +} + +type PutObjectPartChunk struct { + chunk []byte +} + +type PutRequestBody struct { + objPart PutObjectPart +} + +type PutRequest struct { + body *PutRequestBody + + metaHeader *service.RequestMetaHeader + + verifyHeader *service.RequestVerificationHeader +} + +type PutResponseBody struct { + id *refs.ObjectID +} + +type PutResponse struct { + body *PutResponseBody + + metaHeader *service.ResponseMetaHeader + + verifyHeader *service.ResponseVerificationHeader +} + +type DeleteRequestBody struct { + addr *refs.Address + + ownerID *refs.OwnerID +} + +type DeleteRequest struct { + body *DeleteRequestBody + + metaHeader *service.RequestMetaHeader + + verifyHeader *service.RequestVerificationHeader +} + +type DeleteResponseBody struct{} + +type DeleteResponse struct { + body *DeleteResponseBody + + metaHeader *service.ResponseMetaHeader + + verifyHeader *service.ResponseVerificationHeader +} + +type HeadRequestBody struct { + addr *refs.Address + + mainOnly, raw bool +} + +type HeadRequest struct { + body *HeadRequestBody + + metaHeader *service.RequestMetaHeader + + verifyHeader *service.RequestVerificationHeader +} + +type GetHeaderPart interface { + getHeaderPart() +} + +type GetHeaderPartFull struct { + hdr *Header +} + +type GetHeaderPartShort struct { + hdr *ShortHeader +} + +type HeadResponseBody struct { + hdrPart GetHeaderPart +} + +type HeadResponse struct { + body *HeadResponseBody + + metaHeader *service.ResponseMetaHeader + + verifyHeader *service.ResponseVerificationHeader +} + +type SearchFilter struct { + matchType MatchType + + name, val string +} + +type SearchRequestBody struct { + cid *refs.ContainerID + + version uint32 + + filters []*SearchFilter +} + +type SearchRequest struct { + body *SearchRequestBody + + metaHeader *service.RequestMetaHeader + + verifyHeader *service.RequestVerificationHeader +} + +type SearchResponseBody struct { + idList []*refs.ObjectID +} + +type SearchResponse struct { + body *SearchResponseBody + + metaHeader *service.ResponseMetaHeader + + verifyHeader *service.ResponseVerificationHeader +} + +type Range struct { + off, len uint64 +} + +type GetRangeRequestBody struct { + addr *refs.Address + + rng *Range +} + +type GetRangeRequest struct { + body *GetRangeRequestBody + + metaHeader *service.RequestMetaHeader + + verifyHeader *service.RequestVerificationHeader +} + +type GetRangeResponseBody struct { + chunk []byte +} + +type GetRangeResponse struct { + body *GetRangeResponseBody + + metaHeader *service.ResponseMetaHeader + + verifyHeader *service.ResponseVerificationHeader +} + +type GetRangeHashRequestBody struct { + addr *refs.Address + + rngs []*Range + + salt []byte +} + +type GetRangeHashRequest struct { + body *GetRangeHashRequestBody + + metaHeader *service.RequestMetaHeader + + verifyHeader *service.RequestVerificationHeader +} + +type GetRangeHashResponseBody struct { + hashList [][]byte +} + +type GetRangeHashResponse struct { + body *GetRangeHashResponseBody + + metaHeader *service.ResponseMetaHeader + + verifyHeader *service.ResponseVerificationHeader +} + const ( TypeRegular Type = iota TypeTombstone @@ -134,7 +372,7 @@ func (h *ShortHeader) SetObjectType(v Type) { } } -func (h *ShortHeader) GeyPayloadLength() uint64 { +func (h *ShortHeader) GetPayloadLength() uint64 { if h != nil { return h.payloadLen } @@ -455,3 +693,1135 @@ func (o *Object) SetPayload(v []byte) { o.payload = v } } + +func (r *GetRequestBody) GetAddress() *refs.Address { + if r != nil { + return r.addr + } + + return nil +} + +func (r *GetRequestBody) SetAddress(v *refs.Address) { + if r != nil { + r.addr = v + } +} + +func (r *GetRequestBody) GetRaw() bool { + if r != nil { + return r.raw + } + + return false +} + +func (r *GetRequestBody) SetRaw(v bool) { + if r != nil { + r.raw = v + } +} + +func (r *GetRequest) GetBody() *GetRequestBody { + if r != nil { + return r.body + } + + return nil +} + +func (r *GetRequest) SetBody(v *GetRequestBody) { + if r != nil { + r.body = v + } +} + +func (r *GetRequest) GetMetaHeader() *service.RequestMetaHeader { + if r != nil { + return r.metaHeader + } + + return nil +} + +func (r *GetRequest) SetMetaHeader(v *service.RequestMetaHeader) { + if r != nil { + r.metaHeader = v + } +} + +func (r *GetRequest) GetVerificationHeader() *service.RequestVerificationHeader { + if r != nil { + return r.verifyHeader + } + + return nil +} + +func (r *GetRequest) SetVerificationHeader(v *service.RequestVerificationHeader) { + if r != nil { + r.verifyHeader = v + } +} + +func (r *GetObjectPartInit) GetObjectID() *refs.ObjectID { + if r != nil { + return r.id + } + + return nil +} + +func (r *GetObjectPartInit) SetObjectID(v *refs.ObjectID) { + if r != nil { + r.id = v + } +} + +func (r *GetObjectPartInit) GetSignature() *service.Signature { + if r != nil { + return r.sig + } + + return nil +} + +func (r *GetObjectPartInit) SetSignature(v *service.Signature) { + if r != nil { + r.sig = v + } +} + +func (r *GetObjectPartInit) GetHeader() *Header { + if r != nil { + return r.hdr + } + + return nil +} + +func (r *GetObjectPartInit) SetHeader(v *Header) { + if r != nil { + r.hdr = v + } +} + +func (r *GetObjectPartInit) getObjectPart() {} + +func (r *GetObjectPartChunk) GetChunk() []byte { + if r != nil { + return r.chunk + } + + return nil +} + +func (r *GetObjectPartChunk) SetChunk(v []byte) { + if r != nil { + r.chunk = v + } +} + +func (r *GetObjectPartChunk) getObjectPart() {} + +func (r *GetResponseBody) GetObjectPart() GetObjectPart { + if r != nil { + return r.objPart + } + + return nil +} + +func (r *GetResponseBody) SetObjectPart(v GetObjectPart) { + if r != nil { + r.objPart = v + } +} + +func (r *GetResponse) GetBody() *GetResponseBody { + if r != nil { + return r.body + } + + return nil +} + +func (r *GetResponse) SetBody(v *GetResponseBody) { + if r != nil { + r.body = v + } +} + +func (r *GetResponse) GetMetaHeader() *service.ResponseMetaHeader { + if r != nil { + return r.metaHeader + } + + return nil +} + +func (r *GetResponse) SetMetaHeader(v *service.ResponseMetaHeader) { + if r != nil { + r.metaHeader = v + } +} + +func (r *GetResponse) GetVerificationHeader() *service.ResponseVerificationHeader { + if r != nil { + return r.verifyHeader + } + + return nil +} + +func (r *GetResponse) SetVerificationHeader(v *service.ResponseVerificationHeader) { + if r != nil { + r.verifyHeader = v + } +} + +func (r *PutObjectPartInit) GetObjectID() *refs.ObjectID { + if r != nil { + return r.id + } + + return nil +} + +func (r *PutObjectPartInit) SetObjectID(v *refs.ObjectID) { + if r != nil { + r.id = v + } +} + +func (r *PutObjectPartInit) GetSignature() *service.Signature { + if r != nil { + return r.sig + } + + return nil +} + +func (r *PutObjectPartInit) SetSignature(v *service.Signature) { + if r != nil { + r.sig = v + } +} + +func (r *PutObjectPartInit) GetHeader() *Header { + if r != nil { + return r.hdr + } + + return nil +} + +func (r *PutObjectPartInit) SetHeader(v *Header) { + if r != nil { + r.hdr = v + } +} + +func (r *PutObjectPartInit) GetCopiesNumber() uint32 { + if r != nil { + return r.copyNum + } + + return 0 +} + +func (r *PutObjectPartInit) SetCopiesNumber(v uint32) { + if r != nil { + r.copyNum = v + } +} + +func (r *PutObjectPartInit) putObjectPart() {} + +func (r *PutObjectPartChunk) GetChunk() []byte { + if r != nil { + return r.chunk + } + + return nil +} + +func (r *PutObjectPartChunk) SetChunk(v []byte) { + if r != nil { + r.chunk = v + } +} + +func (r *PutObjectPartChunk) putObjectPart() {} + +func (r *PutRequestBody) GetObjectPart() PutObjectPart { + if r != nil { + return r.objPart + } + + return nil +} + +func (r *PutRequestBody) SetObjectPart(v PutObjectPart) { + if r != nil { + r.objPart = v + } +} + +func (r *PutRequest) GetBody() *PutRequestBody { + if r != nil { + return r.body + } + + return nil +} + +func (r *PutRequest) SetBody(v *PutRequestBody) { + if r != nil { + r.body = v + } +} + +func (r *PutRequest) GetMetaHeader() *service.RequestMetaHeader { + if r != nil { + return r.metaHeader + } + + return nil +} + +func (r *PutRequest) SetMetaHeader(v *service.RequestMetaHeader) { + if r != nil { + r.metaHeader = v + } +} + +func (r *PutRequest) GetVerificationHeader() *service.RequestVerificationHeader { + if r != nil { + return r.verifyHeader + } + + return nil +} + +func (r *PutRequest) SetVerificationHeader(v *service.RequestVerificationHeader) { + if r != nil { + r.verifyHeader = v + } +} + +func (r *PutResponseBody) GetObjectID() *refs.ObjectID { + if r != nil { + return r.id + } + + return nil +} + +func (r *PutResponseBody) SetObjectID(v *refs.ObjectID) { + if r != nil { + r.id = v + } +} + +func (r *PutResponse) GetBody() *PutResponseBody { + if r != nil { + return r.body + } + + return nil +} + +func (r *PutResponse) SetBody(v *PutResponseBody) { + if r != nil { + r.body = v + } +} + +func (r *PutResponse) GetMetaHeader() *service.ResponseMetaHeader { + if r != nil { + return r.metaHeader + } + + return nil +} + +func (r *PutResponse) SetMetaHeader(v *service.ResponseMetaHeader) { + if r != nil { + r.metaHeader = v + } +} + +func (r *PutResponse) GetVerificationHeader() *service.ResponseVerificationHeader { + if r != nil { + return r.verifyHeader + } + + return nil +} + +func (r *PutResponse) SetVerificationHeader(v *service.ResponseVerificationHeader) { + if r != nil { + r.verifyHeader = v + } +} + +func (r *DeleteRequestBody) GetAddress() *refs.Address { + if r != nil { + return r.addr + } + + return nil +} + +func (r *DeleteRequestBody) SetAddress(v *refs.Address) { + if r != nil { + r.addr = v + } +} + +func (r *DeleteRequestBody) GetOwnerID() *refs.OwnerID { + if r != nil { + return r.ownerID + } + + return nil +} + +func (r *DeleteRequestBody) SetOwnerID(v *refs.OwnerID) { + if r != nil { + r.ownerID = v + } +} + +func (r *DeleteRequest) GetBody() *DeleteRequestBody { + if r != nil { + return r.body + } + + return nil +} + +func (r *DeleteRequest) SetBody(v *DeleteRequestBody) { + if r != nil { + r.body = v + } +} + +func (r *DeleteRequest) GetMetaHeader() *service.RequestMetaHeader { + if r != nil { + return r.metaHeader + } + + return nil +} + +func (r *DeleteRequest) SetMetaHeader(v *service.RequestMetaHeader) { + if r != nil { + r.metaHeader = v + } +} + +func (r *DeleteRequest) GetVerificationHeader() *service.RequestVerificationHeader { + if r != nil { + return r.verifyHeader + } + + return nil +} + +func (r *DeleteRequest) SetVerificationHeader(v *service.RequestVerificationHeader) { + if r != nil { + r.verifyHeader = v + } +} + +func (r *DeleteResponse) GetBody() *DeleteResponseBody { + if r != nil { + return r.body + } + + return nil +} + +func (r *DeleteResponse) SetBody(v *DeleteResponseBody) { + if r != nil { + r.body = v + } +} + +func (r *DeleteResponse) GetMetaHeader() *service.ResponseMetaHeader { + if r != nil { + return r.metaHeader + } + + return nil +} + +func (r *DeleteResponse) SetMetaHeader(v *service.ResponseMetaHeader) { + if r != nil { + r.metaHeader = v + } +} + +func (r *DeleteResponse) GetVerificationHeader() *service.ResponseVerificationHeader { + if r != nil { + return r.verifyHeader + } + + return nil +} + +func (r *DeleteResponse) SetVerificationHeader(v *service.ResponseVerificationHeader) { + if r != nil { + r.verifyHeader = v + } +} + +func (r *HeadRequestBody) GetAddress() *refs.Address { + if r != nil { + return r.addr + } + + return nil +} + +func (r *HeadRequestBody) SetAddress(v *refs.Address) { + if r != nil { + r.addr = v + } +} + +func (r *HeadRequestBody) GetMainOnly() bool { + if r != nil { + return r.mainOnly + } + + return false +} + +func (r *HeadRequestBody) SetMainOnly(v bool) { + if r != nil { + r.mainOnly = v + } +} + +func (r *HeadRequestBody) GetRaw() bool { + if r != nil { + return r.raw + } + + return false +} + +func (r *HeadRequestBody) SetRaw(v bool) { + if r != nil { + r.raw = v + } +} + +func (r *HeadRequest) GetBody() *HeadRequestBody { + if r != nil { + return r.body + } + + return nil +} + +func (r *HeadRequest) SetBody(v *HeadRequestBody) { + if r != nil { + r.body = v + } +} + +func (r *HeadRequest) GetMetaHeader() *service.RequestMetaHeader { + if r != nil { + return r.metaHeader + } + + return nil +} + +func (r *HeadRequest) SetMetaHeader(v *service.RequestMetaHeader) { + if r != nil { + r.metaHeader = v + } +} + +func (r *HeadRequest) GetVerificationHeader() *service.RequestVerificationHeader { + if r != nil { + return r.verifyHeader + } + + return nil +} + +func (r *HeadRequest) SetVerificationHeader(v *service.RequestVerificationHeader) { + if r != nil { + r.verifyHeader = v + } +} + +func (h *GetHeaderPartFull) GetHeader() *Header { + if h != nil { + return h.hdr + } + + return nil +} + +func (h *GetHeaderPartFull) SetHeader(v *Header) { + if h != nil { + h.hdr = v + } +} + +func (*GetHeaderPartFull) getHeaderPart() {} + +func (h *GetHeaderPartShort) GetShortHeader() *ShortHeader { + if h != nil { + return h.hdr + } + + return nil +} + +func (h *GetHeaderPartShort) SetShortHeader(v *ShortHeader) { + if h != nil { + h.hdr = v + } +} + +func (*GetHeaderPartShort) getHeaderPart() {} + +func (r *HeadResponseBody) GetHeaderPart() GetHeaderPart { + if r != nil { + return r.hdrPart + } + + return nil +} + +func (r *HeadResponseBody) SetHeaderPart(v GetHeaderPart) { + if r != nil { + r.hdrPart = v + } +} + +func (r *HeadResponse) GetBody() *HeadResponseBody { + if r != nil { + return r.body + } + + return nil +} + +func (r *HeadResponse) SetBody(v *HeadResponseBody) { + if r != nil { + r.body = v + } +} + +func (r *HeadResponse) GetMetaHeader() *service.ResponseMetaHeader { + if r != nil { + return r.metaHeader + } + + return nil +} + +func (r *HeadResponse) SetMetaHeader(v *service.ResponseMetaHeader) { + if r != nil { + r.metaHeader = v + } +} + +func (r *HeadResponse) GetVerificationHeader() *service.ResponseVerificationHeader { + if r != nil { + return r.verifyHeader + } + + return nil +} + +func (r *HeadResponse) SetVerificationHeader(v *service.ResponseVerificationHeader) { + if r != nil { + r.verifyHeader = v + } +} + +func (f *SearchFilter) GetMatchType() MatchType { + if f != nil { + return f.matchType + } + + return MatchUnknown +} + +func (f *SearchFilter) SetMatchType(v MatchType) { + if f != nil { + f.matchType = v + } +} + +func (f *SearchFilter) GetName() string { + if f != nil { + return f.name + } + + return "" +} + +func (f *SearchFilter) SetName(v string) { + if f != nil { + f.name = v + } +} + +func (f *SearchFilter) GetValue() string { + if f != nil { + return f.val + } + + return "" +} + +func (f *SearchFilter) SetValue(v string) { + if f != nil { + f.val = v + } +} + +func (r *SearchRequestBody) GetContainerID() *refs.ContainerID { + if r != nil { + return r.cid + } + + return nil +} + +func (r *SearchRequestBody) SetContainerID(v *refs.ContainerID) { + if r != nil { + r.cid = v + } +} + +func (r *SearchRequestBody) GetVersion() uint32 { + if r != nil { + return r.version + } + + return 0 +} + +func (r *SearchRequestBody) SetVersion(v uint32) { + if r != nil { + r.version = v + } +} + +func (r *SearchRequestBody) GetFilters() []*SearchFilter { + if r != nil { + return r.filters + } + + return nil +} + +func (r *SearchRequestBody) SetFilters(v []*SearchFilter) { + if r != nil { + r.filters = v + } +} + +func (r *SearchRequest) GetBody() *SearchRequestBody { + if r != nil { + return r.body + } + + return nil +} + +func (r *SearchRequest) SetBody(v *SearchRequestBody) { + if r != nil { + r.body = v + } +} + +func (r *SearchRequest) GetMetaHeader() *service.RequestMetaHeader { + if r != nil { + return r.metaHeader + } + + return nil +} + +func (r *SearchRequest) SetMetaHeader(v *service.RequestMetaHeader) { + if r != nil { + r.metaHeader = v + } +} + +func (r *SearchRequest) GetVerificationHeader() *service.RequestVerificationHeader { + if r != nil { + return r.verifyHeader + } + + return nil +} + +func (r *SearchRequest) SetVerificationHeader(v *service.RequestVerificationHeader) { + if r != nil { + r.verifyHeader = v + } +} + +func (r *SearchResponseBody) GetIDList() []*refs.ObjectID { + if r != nil { + return r.idList + } + + return nil +} + +func (r *SearchResponseBody) SetIDList(v []*refs.ObjectID) { + if r != nil { + r.idList = v + } +} + +func (r *SearchResponse) GetBody() *SearchResponseBody { + if r != nil { + return r.body + } + + return nil +} + +func (r *SearchResponse) SetBody(v *SearchResponseBody) { + if r != nil { + r.body = v + } +} + +func (r *SearchResponse) GetMetaHeader() *service.ResponseMetaHeader { + if r != nil { + return r.metaHeader + } + + return nil +} + +func (r *SearchResponse) SetMetaHeader(v *service.ResponseMetaHeader) { + if r != nil { + r.metaHeader = v + } +} + +func (r *SearchResponse) GetVerificationHeader() *service.ResponseVerificationHeader { + if r != nil { + return r.verifyHeader + } + + return nil +} + +func (r *SearchResponse) SetVerificationHeader(v *service.ResponseVerificationHeader) { + if r != nil { + r.verifyHeader = v + } +} + +func (r *Range) GetOffset() uint64 { + if r != nil { + return r.off + } + + return 0 +} + +func (r *Range) SetOffset(v uint64) { + if r != nil { + r.off = v + } +} + +func (r *Range) GetLength() uint64 { + if r != nil { + return r.len + } + + return 0 +} + +func (r *Range) SetLength(v uint64) { + if r != nil { + r.len = v + } +} + +func (r *GetRangeRequestBody) GetAddress() *refs.Address { + if r != nil { + return r.addr + } + + return nil +} + +func (r *GetRangeRequestBody) SetAddress(v *refs.Address) { + if r != nil { + r.addr = v + } +} + +func (r *GetRangeRequestBody) GetRange() *Range { + if r != nil { + return r.rng + } + + return nil +} + +func (r *GetRangeRequestBody) SetRange(v *Range) { + if r != nil { + r.rng = v + } +} + +func (r *GetRangeRequest) GetBody() *GetRangeRequestBody { + if r != nil { + return r.body + } + + return nil +} + +func (r *GetRangeRequest) SetBody(v *GetRangeRequestBody) { + if r != nil { + r.body = v + } +} + +func (r *GetRangeRequest) GetMetaHeader() *service.RequestMetaHeader { + if r != nil { + return r.metaHeader + } + + return nil +} + +func (r *GetRangeRequest) SetMetaHeader(v *service.RequestMetaHeader) { + if r != nil { + r.metaHeader = v + } +} + +func (r *GetRangeRequest) GetVerificationHeader() *service.RequestVerificationHeader { + if r != nil { + return r.verifyHeader + } + + return nil +} + +func (r *GetRangeRequest) SetVerificationHeader(v *service.RequestVerificationHeader) { + if r != nil { + r.verifyHeader = v + } +} + +func (r *GetRangeResponseBody) GetChunk() []byte { + if r != nil { + return r.chunk + } + + return nil +} + +func (r *GetRangeResponseBody) SetChunk(v []byte) { + if r != nil { + r.chunk = v + } +} + +func (r *GetRangeResponse) GetBody() *GetRangeResponseBody { + if r != nil { + return r.body + } + + return nil +} + +func (r *GetRangeResponse) SetBody(v *GetRangeResponseBody) { + if r != nil { + r.body = v + } +} + +func (r *GetRangeResponse) GetMetaHeader() *service.ResponseMetaHeader { + if r != nil { + return r.metaHeader + } + + return nil +} + +func (r *GetRangeResponse) SetMetaHeader(v *service.ResponseMetaHeader) { + if r != nil { + r.metaHeader = v + } +} + +func (r *GetRangeResponse) GetVerificationHeader() *service.ResponseVerificationHeader { + if r != nil { + return r.verifyHeader + } + + return nil +} + +func (r *GetRangeResponse) SetVerificationHeader(v *service.ResponseVerificationHeader) { + if r != nil { + r.verifyHeader = v + } +} + +func (r *GetRangeHashRequestBody) GetAddress() *refs.Address { + if r != nil { + return r.addr + } + + return nil +} + +func (r *GetRangeHashRequestBody) SetAddress(v *refs.Address) { + if r != nil { + r.addr = v + } +} + +func (r *GetRangeHashRequestBody) GetRanges() []*Range { + if r != nil { + return r.rngs + } + + return nil +} + +func (r *GetRangeHashRequestBody) SetRanges(v []*Range) { + if r != nil { + r.rngs = v + } +} + +func (r *GetRangeHashRequestBody) GetSalt() []byte { + if r != nil { + return r.salt + } + + return nil +} + +func (r *GetRangeHashRequestBody) SetSalt(v []byte) { + if r != nil { + r.salt = v + } +} + +func (r *GetRangeHashRequest) GetBody() *GetRangeHashRequestBody { + if r != nil { + return r.body + } + + return nil +} + +func (r *GetRangeHashRequest) SetBody(v *GetRangeHashRequestBody) { + if r != nil { + r.body = v + } +} + +func (r *GetRangeHashRequest) GetMetaHeader() *service.RequestMetaHeader { + if r != nil { + return r.metaHeader + } + + return nil +} + +func (r *GetRangeHashRequest) SetMetaHeader(v *service.RequestMetaHeader) { + if r != nil { + r.metaHeader = v + } +} + +func (r *GetRangeHashRequest) GetVerificationHeader() *service.RequestVerificationHeader { + if r != nil { + return r.verifyHeader + } + + return nil +} + +func (r *GetRangeHashRequest) SetVerificationHeader(v *service.RequestVerificationHeader) { + if r != nil { + r.verifyHeader = v + } +} + +func (r *GetRangeHashResponseBody) GetHashList() [][]byte { + if r != nil { + return r.hashList + } + + return nil +} + +func (r *GetRangeHashResponseBody) SetHashList(v [][]byte) { + if r != nil { + r.hashList = v + } +} + +func (r *GetRangeHashResponse) GetBody() *GetRangeHashResponseBody { + if r != nil { + return r.body + } + + return nil +} + +func (r *GetRangeHashResponse) SetBody(v *GetRangeHashResponseBody) { + if r != nil { + r.body = v + } +} + +func (r *GetRangeHashResponse) GetMetaHeader() *service.ResponseMetaHeader { + if r != nil { + return r.metaHeader + } + + return nil +} + +func (r *GetRangeHashResponse) SetMetaHeader(v *service.ResponseMetaHeader) { + if r != nil { + r.metaHeader = v + } +} + +func (r *GetRangeHashResponse) GetVerificationHeader() *service.ResponseVerificationHeader { + if r != nil { + return r.verifyHeader + } + + return nil +} + +func (r *GetRangeHashResponse) SetVerificationHeader(v *service.ResponseVerificationHeader) { + if r != nil { + r.verifyHeader = v + } +} From 1592151621722488848971cf4b86983cec665409 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Tue, 18 Aug 2020 12:01:08 +0300 Subject: [PATCH 0325/1196] Add stable marshal for session package Signed-off-by: Alex Vanin --- v2/session/marshal.go | 93 ++++++++++++++++++++++++++++++++++++++ v2/session/marshal_test.go | 67 +++++++++++++++++++++++++++ 2 files changed, 160 insertions(+) create mode 100644 v2/session/marshal.go create mode 100644 v2/session/marshal_test.go diff --git a/v2/session/marshal.go b/v2/session/marshal.go new file mode 100644 index 0000000..2256b90 --- /dev/null +++ b/v2/session/marshal.go @@ -0,0 +1,93 @@ +package session + +import ( + "github.com/nspcc-dev/neofs-api-go/util/proto" +) + +const ( + createReqBodyOwnerField = 1 + createReqBodyLifetimeField = 2 + + createRespBodyIDField = 1 + createRespBodyKeyField = 2 +) + +func (c *CreateRequestBody) StableMarshal(buf []byte) ([]byte, error) { + if c == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, c.StableSize()) + } + + var ( + offset, n int + err error + ) + + n, err = proto.NestedStructureMarshal(createReqBodyOwnerField, buf[offset:], c.ownerID) + if err != nil { + return nil, err + } + + offset += n + + _, err = proto.NestedStructureMarshal(createReqBodyLifetimeField, buf[offset:], c.lifetime) + if err != nil { + return nil, err + } + + return buf, nil +} + +func (c *CreateRequestBody) StableSize() (size int) { + if c == nil { + return 0 + } + + size += proto.NestedStructureSize(createReqBodyOwnerField, c.ownerID) + size += proto.NestedStructureSize(createReqBodyLifetimeField, c.lifetime) + + return size +} + +func (c *CreateResponseBody) StableMarshal(buf []byte) ([]byte, error) { + if c == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, c.StableSize()) + } + + var ( + offset, n int + err error + ) + + n, err = proto.BytesMarshal(createRespBodyIDField, buf[offset:], c.id) + if err != nil { + return nil, err + } + + offset += n + + _, err = proto.BytesMarshal(createRespBodyKeyField, buf[offset:], c.sessionKey) + if err != nil { + return nil, err + } + + return buf, nil +} + +func (c *CreateResponseBody) StableSize() (size int) { + if c == nil { + return 0 + } + + size += proto.BytesSize(createRespBodyIDField, c.id) + size += proto.BytesSize(createRespBodyKeyField, c.sessionKey) + + return size +} diff --git a/v2/session/marshal_test.go b/v2/session/marshal_test.go new file mode 100644 index 0000000..685a477 --- /dev/null +++ b/v2/session/marshal_test.go @@ -0,0 +1,67 @@ +package session_test + +import ( + "testing" + + "github.com/nspcc-dev/neofs-api-go/v2/refs" + "github.com/nspcc-dev/neofs-api-go/v2/service" + "github.com/nspcc-dev/neofs-api-go/v2/session" + grpc "github.com/nspcc-dev/neofs-api-go/v2/session/grpc" + "github.com/stretchr/testify/require" +) + +func TestCreateRequestBody_StableMarshal(t *testing.T) { + requestFrom := generateCreateSessionRequestBody("Owner ID") + transport := new(grpc.CreateRequest_Body) + + t.Run("non empty", func(t *testing.T) { + wire, err := requestFrom.StableMarshal(nil) + require.NoError(t, err) + + err = transport.Unmarshal(wire) + require.NoError(t, err) + + requestTo := session.CreateRequestBodyFromGRPCMessage(transport) + require.Equal(t, requestFrom, requestTo) + }) +} + +func TestCreateResponseBody_StableMarshal(t *testing.T) { + responseFrom := generateCreateSessionResponseBody("ID", "Session Public Key") + transport := new(grpc.CreateResponse_Body) + + t.Run("non empty", func(t *testing.T) { + wire, err := responseFrom.StableMarshal(nil) + require.NoError(t, err) + + err = transport.Unmarshal(wire) + require.NoError(t, err) + + responseTo := session.CreateResponseBodyFromGRPCMessage(transport) + require.Equal(t, responseFrom, responseTo) + }) +} + +func generateCreateSessionRequestBody(id string) *session.CreateRequestBody { + lifetime := new(service.TokenLifetime) + lifetime.SetIat(1) + lifetime.SetNbf(2) + lifetime.SetExp(3) + + owner := new(refs.OwnerID) + owner.SetValue([]byte(id)) + + s := new(session.CreateRequestBody) + s.SetOwnerID(owner) + s.SetLifetime(lifetime) + + return s +} + +func generateCreateSessionResponseBody(id, key string) *session.CreateResponseBody { + s := new(session.CreateResponseBody) + s.SetID([]byte(id)) + s.SetSessionKey([]byte(key)) + + return s +} From c3604d00f0d451297ff58b517fbbfba06b46e2f5 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Tue, 18 Aug 2020 12:14:47 +0300 Subject: [PATCH 0326/1196] Fix tests with nil check via reflection Signed-off-by: Alex Vanin --- util/proto/marshal.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/util/proto/marshal.go b/util/proto/marshal.go index 470d974..250db0f 100644 --- a/util/proto/marshal.go +++ b/util/proto/marshal.go @@ -9,6 +9,7 @@ package proto import ( "encoding/binary" "math/bits" + "reflect" ) type ( @@ -305,7 +306,7 @@ func NestedStructurePrefix(field int64) (prefix uint64, ln int) { } func NestedStructureMarshal(field int64, buf []byte, v stableMarshaller) (int, error) { - if v == nil { + if v == nil || reflect.ValueOf(v).IsNil() { return 0, nil } @@ -324,7 +325,7 @@ func NestedStructureMarshal(field int64, buf []byte, v stableMarshaller) (int, e } func NestedStructureSize(field int64, v stableMarshaller) (size int) { - if v == nil { + if v == nil || reflect.ValueOf(v).IsNil() { return 0 } From c94cb44b58e537abb7106a753916709a9e3c13a4 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Tue, 18 Aug 2020 15:48:39 +0300 Subject: [PATCH 0327/1196] Update neofs-api to latest jindo version Signed-off-by: Alex Vanin --- v2/accounting/grpc/service.pb.go | 270 +-- v2/accounting/grpc/types.pb.go | 353 ++++ v2/container/convert.go | 33 +- v2/container/grpc/service.go | 15 +- v2/container/grpc/service.pb.go | 327 ++-- v2/container/grpc/types.pb.go | 50 +- v2/container/types.go | 40 +- v2/object/convert.go | 8 - v2/object/grpc/service.go | 7 - v2/object/grpc/service.pb.go | 221 +-- v2/object/grpc/types.pb.go | 101 +- v2/service/convert.go | 44 +- v2/service/grpc/meta.go | 10 +- v2/service/grpc/{meta.pb.go => types.pb.go} | 1660 +++++++++++++++---- v2/service/grpc/verify.pb.go | 1153 ------------- v2/service/marshal_test.go | 2 +- v2/session/grpc/service.pb.go | 57 +- 17 files changed, 2115 insertions(+), 2236 deletions(-) create mode 100644 v2/accounting/grpc/types.pb.go rename v2/service/grpc/{meta.pb.go => types.pb.go} (60%) delete mode 100644 v2/service/grpc/verify.pb.go diff --git a/v2/accounting/grpc/service.pb.go b/v2/accounting/grpc/service.pb.go index aa9fdbe..af398bb 100644 --- a/v2/accounting/grpc/service.pb.go +++ b/v2/accounting/grpc/service.pb.go @@ -154,64 +154,6 @@ func (m *BalanceRequest_Body) GetOwnerId() *grpc1.OwnerID { return nil } -// Decimal represents the decimal numbers. -type Decimal struct { - // value carries number value. - Value int64 `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"` - // precision carries value precision. - Precision uint32 `protobuf:"varint,2,opt,name=precision,proto3" json:"precision,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Decimal) Reset() { *m = Decimal{} } -func (m *Decimal) String() string { return proto.CompactTextString(m) } -func (*Decimal) ProtoMessage() {} -func (*Decimal) Descriptor() ([]byte, []int) { - return fileDescriptor_d9dd5af2ff2bbb25, []int{1} -} -func (m *Decimal) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Decimal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Decimal.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *Decimal) XXX_Merge(src proto.Message) { - xxx_messageInfo_Decimal.Merge(m, src) -} -func (m *Decimal) XXX_Size() int { - return m.Size() -} -func (m *Decimal) XXX_DiscardUnknown() { - xxx_messageInfo_Decimal.DiscardUnknown(m) -} - -var xxx_messageInfo_Decimal proto.InternalMessageInfo - -func (m *Decimal) GetValue() int64 { - if m != nil { - return m.Value - } - return 0 -} - -func (m *Decimal) GetPrecision() uint32 { - if m != nil { - return m.Precision - } - return 0 -} - // Message defines the response body of Balance method. // // The amount of funds is calculated in decimal numbers. @@ -234,7 +176,7 @@ func (m *BalanceResponse) Reset() { *m = BalanceResponse{} } func (m *BalanceResponse) String() string { return proto.CompactTextString(m) } func (*BalanceResponse) ProtoMessage() {} func (*BalanceResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_d9dd5af2ff2bbb25, []int{2} + return fileDescriptor_d9dd5af2ff2bbb25, []int{1} } func (m *BalanceResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -297,7 +239,7 @@ func (m *BalanceResponse_Body) Reset() { *m = BalanceResponse_Body{} } func (m *BalanceResponse_Body) String() string { return proto.CompactTextString(m) } func (*BalanceResponse_Body) ProtoMessage() {} func (*BalanceResponse_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_d9dd5af2ff2bbb25, []int{2, 0} + return fileDescriptor_d9dd5af2ff2bbb25, []int{1, 0} } func (m *BalanceResponse_Body) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -336,7 +278,6 @@ func (m *BalanceResponse_Body) GetBalance() *Decimal { func init() { proto.RegisterType((*BalanceRequest)(nil), "neo.fs.v2.accounting.BalanceRequest") proto.RegisterType((*BalanceRequest_Body)(nil), "neo.fs.v2.accounting.BalanceRequest.Body") - proto.RegisterType((*Decimal)(nil), "neo.fs.v2.accounting.Decimal") proto.RegisterType((*BalanceResponse)(nil), "neo.fs.v2.accounting.BalanceResponse") proto.RegisterType((*BalanceResponse_Body)(nil), "neo.fs.v2.accounting.BalanceResponse.Body") } @@ -344,37 +285,35 @@ func init() { func init() { proto.RegisterFile("v2/accounting/grpc/service.proto", fileDescriptor_d9dd5af2ff2bbb25) } var fileDescriptor_d9dd5af2ff2bbb25 = []byte{ - // 478 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x93, 0x4f, 0x6e, 0x13, 0x31, - 0x18, 0xc5, 0x99, 0xb4, 0x10, 0x70, 0x29, 0x08, 0xab, 0x52, 0xa3, 0x51, 0x89, 0xaa, 0xa8, 0x95, - 0x00, 0x11, 0x8f, 0x34, 0x2c, 0x90, 0x40, 0xa5, 0x6a, 0x54, 0x2a, 0xb2, 0xe0, 0xdf, 0x54, 0xea, - 0x82, 0x4d, 0xe5, 0x78, 0xbe, 0xa4, 0x56, 0x13, 0x7b, 0x18, 0x3b, 0x46, 0xb9, 0x09, 0x17, 0x60, - 0xc3, 0x82, 0x73, 0xb0, 0xe4, 0x08, 0x28, 0x5c, 0x04, 0x8d, 0xed, 0x64, 0x52, 0x98, 0xb6, 0xd9, - 0xc5, 0xf9, 0xde, 0x7b, 0xfe, 0xde, 0x4f, 0x63, 0xb4, 0x6d, 0xe2, 0x88, 0x32, 0x26, 0xc7, 0x42, - 0x73, 0x31, 0x88, 0x06, 0x79, 0xc6, 0x22, 0x05, 0xb9, 0xe1, 0x0c, 0x48, 0x96, 0x4b, 0x2d, 0xf1, - 0x86, 0x00, 0x49, 0xfa, 0x8a, 0x98, 0x98, 0x94, 0xc2, 0xb0, 0x61, 0xe2, 0x28, 0x87, 0xbe, 0x72, - 0x0e, 0x3d, 0xc9, 0x40, 0x39, 0x7d, 0x18, 0x9a, 0x78, 0x96, 0xe0, 0x86, 0x23, 0xd0, 0xd4, 0xcf, - 0xb6, 0xfe, 0x9d, 0x19, 0xc8, 0x79, 0x7f, 0xe2, 0xa6, 0xad, 0x6f, 0x35, 0x74, 0xaf, 0x43, 0x87, - 0x54, 0x30, 0x48, 0xe0, 0xf3, 0x18, 0x94, 0xc6, 0x7b, 0x68, 0xb5, 0x27, 0xd3, 0x49, 0x23, 0xd8, - 0x0e, 0x1e, 0xad, 0xc5, 0x8f, 0x49, 0xd5, 0x2e, 0xe4, 0xa2, 0x87, 0x74, 0x64, 0x3a, 0x49, 0xac, - 0x0d, 0xbf, 0x46, 0x6b, 0xc5, 0xed, 0xa7, 0x67, 0x40, 0x53, 0xc8, 0x1b, 0x35, 0x9b, 0xb2, 0xb3, - 0x90, 0x32, 0xab, 0xea, 0xbd, 0x6f, 0x41, 0xd3, 0x37, 0x56, 0x9b, 0xa0, 0xd1, 0xfc, 0x37, 0xfe, - 0x88, 0xd6, 0xdd, 0xa2, 0xb3, 0xa0, 0x15, 0x1b, 0xf4, 0xf4, 0xf2, 0xa0, 0x93, 0x42, 0xce, 0x19, - 0xd5, 0x5c, 0x0a, 0x1f, 0x78, 0xd7, 0x45, 0xb8, 0x53, 0xf8, 0x02, 0xad, 0x16, 0x7b, 0xe2, 0x18, - 0xdd, 0x96, 0x5f, 0x04, 0xe4, 0xa7, 0x3c, 0xf5, 0x25, 0x37, 0x17, 0x52, 0x0b, 0xc2, 0xe4, 0x7d, - 0x31, 0xef, 0x1e, 0x26, 0x75, 0x2b, 0xec, 0xa6, 0xad, 0x3d, 0x54, 0x3f, 0x04, 0xc6, 0x47, 0x74, - 0x88, 0x37, 0xd0, 0x4d, 0x43, 0x87, 0x63, 0xb0, 0xde, 0x95, 0xc4, 0x1d, 0xf0, 0x16, 0xba, 0x93, - 0xe5, 0xc0, 0xb8, 0xe2, 0x52, 0xd8, 0xd2, 0xeb, 0x49, 0xf9, 0x47, 0xeb, 0x47, 0x0d, 0xdd, 0x9f, - 0x23, 0x53, 0x99, 0x14, 0x0a, 0xf0, 0xab, 0x0b, 0x9c, 0x9f, 0x5c, 0xc3, 0xd9, 0x99, 0x16, 0x41, - 0x1f, 0x55, 0x81, 0xde, 0xad, 0xe4, 0xe3, 0xcc, 0x97, 0x90, 0x4e, 0xaa, 0x49, 0xb7, 0xaf, 0x48, - 0xba, 0x16, 0xf5, 0xbe, 0x47, 0xfd, 0x1c, 0xd5, 0x7b, 0xae, 0x81, 0xaf, 0xf9, 0xb0, 0xba, 0xa6, - 0x67, 0x9b, 0xcc, 0xd4, 0xf1, 0x39, 0x7a, 0x70, 0x30, 0x1f, 0x1f, 0xbb, 0xeb, 0xf1, 0x09, 0xaa, - 0x7b, 0x1e, 0x78, 0x67, 0x99, 0xcf, 0x32, 0xdc, 0x5d, 0x0a, 0x6a, 0xe7, 0xfc, 0xe7, 0xb4, 0x19, - 0xfc, 0x9a, 0x36, 0x83, 0xdf, 0xd3, 0x66, 0xf0, 0xf5, 0x4f, 0xf3, 0xc6, 0xa7, 0xfd, 0x01, 0xd7, - 0x67, 0xe3, 0x1e, 0x61, 0x72, 0x14, 0x09, 0x95, 0x31, 0xd6, 0x4e, 0xc1, 0x44, 0x02, 0x64, 0x5f, - 0xb5, 0x69, 0xc6, 0xdb, 0x03, 0x19, 0xfd, 0xff, 0x88, 0x5f, 0x96, 0xe7, 0xef, 0xb5, 0xcd, 0x77, - 0x20, 0x8f, 0x8e, 0xc9, 0xc1, 0x87, 0x6e, 0x71, 0x79, 0xd9, 0xa5, 0x77, 0xcb, 0x3e, 0xbc, 0x67, - 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, 0x34, 0x56, 0xa2, 0x45, 0x06, 0x04, 0x00, 0x00, + // 438 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x93, 0xcb, 0x8a, 0xd4, 0x40, + 0x18, 0x85, 0x4d, 0x1c, 0x6c, 0xa9, 0xf1, 0x82, 0x85, 0x30, 0x4d, 0xc4, 0x30, 0x0c, 0x33, 0xa0, + 0x62, 0x2a, 0x10, 0x17, 0x82, 0xa2, 0xc3, 0x34, 0xe3, 0x60, 0x2f, 0xbc, 0x65, 0x60, 0x16, 0x6e, + 0x86, 0x4a, 0xe5, 0x4f, 0xa6, 0xe8, 0x4e, 0x55, 0x4c, 0x55, 0x47, 0xf2, 0x26, 0xbe, 0x80, 0x1b, + 0x17, 0x3e, 0x87, 0x4b, 0x1f, 0x41, 0xda, 0x17, 0x91, 0xdc, 0xfa, 0x42, 0xa7, 0xed, 0xde, 0xa5, + 0xf8, 0xcf, 0x39, 0x7f, 0x9d, 0x8f, 0x14, 0xda, 0xcf, 0x3d, 0x97, 0x32, 0x26, 0x27, 0x42, 0x73, + 0x11, 0xbb, 0x71, 0x96, 0x32, 0x57, 0x41, 0x96, 0x73, 0x06, 0x24, 0xcd, 0xa4, 0x96, 0xf8, 0xbe, + 0x00, 0x49, 0x22, 0x45, 0x72, 0x8f, 0xcc, 0x85, 0x96, 0xdd, 0xe1, 0xd3, 0x45, 0x0a, 0xaa, 0x76, + 0x59, 0xfd, 0xdc, 0x73, 0x33, 0x88, 0xd4, 0xea, 0xe4, 0x41, 0xee, 0xb5, 0x1b, 0x56, 0x86, 0x07, + 0xdf, 0x4d, 0x74, 0x67, 0x40, 0xc7, 0x54, 0x30, 0xf0, 0xe1, 0xcb, 0x04, 0x94, 0xc6, 0xaf, 0xd0, + 0x4e, 0x20, 0xc3, 0xa2, 0x6f, 0xec, 0x1b, 0x8f, 0x76, 0xbd, 0xc7, 0xa4, 0xeb, 0x3a, 0x64, 0xd9, + 0x43, 0x06, 0x32, 0x2c, 0xfc, 0xca, 0x86, 0xdf, 0xa0, 0xdd, 0x04, 0x34, 0xbd, 0xbc, 0x02, 0x1a, + 0x42, 0xd6, 0x37, 0xab, 0x94, 0xc3, 0x85, 0x94, 0xb6, 0x6d, 0xe3, 0x7d, 0x07, 0x9a, 0xbe, 0xad, + 0xb4, 0x3e, 0x4a, 0x66, 0xdf, 0xf8, 0x13, 0xba, 0x9d, 0x43, 0xc6, 0xa3, 0xa2, 0x0d, 0xba, 0x5e, + 0x05, 0x3d, 0x5d, 0x1f, 0x74, 0x51, 0xca, 0x39, 0xa3, 0x9a, 0x4b, 0xd1, 0x04, 0xde, 0xaa, 0x23, + 0xea, 0x93, 0xf5, 0x02, 0xed, 0x94, 0xf7, 0xc4, 0x1e, 0xba, 0x29, 0xbf, 0x0a, 0xc8, 0x2e, 0x79, + 0xd8, 0x94, 0xdc, 0x5b, 0x48, 0x2d, 0x21, 0x92, 0x0f, 0xe5, 0x7c, 0x78, 0xea, 0xf7, 0x2a, 0xe1, + 0x30, 0x3c, 0xf8, 0x69, 0xa2, 0xbb, 0xb3, 0xce, 0x2a, 0x95, 0x42, 0x01, 0x7e, 0xbd, 0x04, 0xea, + 0xc9, 0x06, 0x50, 0xb5, 0x69, 0x91, 0xd4, 0x59, 0x17, 0xa9, 0xa3, 0xce, 0x82, 0xb5, 0x79, 0x0d, + 0x2a, 0xbf, 0x1b, 0x95, 0xf3, 0x9f, 0xa4, 0x8d, 0xac, 0x8e, 0x1b, 0x56, 0xcf, 0x51, 0x2f, 0xa8, + 0x1b, 0x34, 0x35, 0x1f, 0x76, 0xd7, 0x3c, 0x05, 0xc6, 0x13, 0x3a, 0xf6, 0x5b, 0xb5, 0x37, 0x42, + 0xf7, 0x4e, 0x66, 0xe3, 0xf3, 0x7a, 0x3d, 0xbe, 0x40, 0xbd, 0x86, 0x07, 0x3e, 0xdc, 0xe6, 0xbf, + 0xb2, 0x8e, 0xb6, 0x82, 0x3a, 0x18, 0xfd, 0x9a, 0xda, 0xc6, 0xef, 0xa9, 0x6d, 0xfc, 0x99, 0xda, + 0xc6, 0xb7, 0xbf, 0xf6, 0xb5, 0xcf, 0xc7, 0x31, 0xd7, 0x57, 0x93, 0x80, 0x30, 0x99, 0xb8, 0x42, + 0xa5, 0x8c, 0x39, 0x21, 0xe4, 0xae, 0x00, 0x19, 0x29, 0x87, 0xa6, 0xdc, 0x89, 0xa5, 0xbb, 0xfa, + 0xa0, 0x5e, 0xce, 0xcf, 0x3f, 0xcc, 0xbd, 0xf7, 0x20, 0xcf, 0xce, 0xc9, 0xc9, 0xc7, 0x61, 0xb9, + 0x7c, 0xde, 0x25, 0xb8, 0x51, 0xbd, 0x9c, 0x67, 0xff, 0x02, 0x00, 0x00, 0xff, 0xff, 0x15, 0x3d, + 0x57, 0xcb, 0xca, 0x03, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -561,43 +500,6 @@ func (m *BalanceRequest_Body) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *Decimal) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Decimal) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Decimal) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.Precision != 0 { - i = encodeVarintService(dAtA, i, uint64(m.Precision)) - i-- - dAtA[i] = 0x10 - } - if m.Value != 0 { - i = encodeVarintService(dAtA, i, uint64(m.Value)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - func (m *BalanceResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -751,24 +653,6 @@ func (m *BalanceRequest_Body) Size() (n int) { return n } -func (m *Decimal) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Value != 0 { - n += 1 + sovService(uint64(m.Value)) - } - if m.Precision != 0 { - n += 1 + sovService(uint64(m.Precision)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - func (m *BalanceResponse) Size() (n int) { if m == nil { return 0 @@ -1067,98 +951,6 @@ func (m *BalanceRequest_Body) Unmarshal(dAtA []byte) error { } return nil } -func (m *Decimal) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Decimal: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Decimal: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) - } - m.Value = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Value |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Precision", wireType) - } - m.Precision = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Precision |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func (m *BalanceResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/v2/accounting/grpc/types.pb.go b/v2/accounting/grpc/types.pb.go new file mode 100644 index 0000000..cc84e87 --- /dev/null +++ b/v2/accounting/grpc/types.pb.go @@ -0,0 +1,353 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: v2/accounting/grpc/types.proto + +package accounting + +import ( + fmt "fmt" + proto "github.com/golang/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package + +// Decimal represents the decimal numbers. +type Decimal struct { + // value carries number value. + Value int64 `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"` + // precision carries value precision. + Precision uint32 `protobuf:"varint,2,opt,name=precision,proto3" json:"precision,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Decimal) Reset() { *m = Decimal{} } +func (m *Decimal) String() string { return proto.CompactTextString(m) } +func (*Decimal) ProtoMessage() {} +func (*Decimal) Descriptor() ([]byte, []int) { + return fileDescriptor_86d8857937dfd0e8, []int{0} +} +func (m *Decimal) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Decimal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Decimal.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Decimal) XXX_Merge(src proto.Message) { + xxx_messageInfo_Decimal.Merge(m, src) +} +func (m *Decimal) XXX_Size() int { + return m.Size() +} +func (m *Decimal) XXX_DiscardUnknown() { + xxx_messageInfo_Decimal.DiscardUnknown(m) +} + +var xxx_messageInfo_Decimal proto.InternalMessageInfo + +func (m *Decimal) GetValue() int64 { + if m != nil { + return m.Value + } + return 0 +} + +func (m *Decimal) GetPrecision() uint32 { + if m != nil { + return m.Precision + } + return 0 +} + +func init() { + proto.RegisterType((*Decimal)(nil), "neo.fs.v2.accounting.Decimal") +} + +func init() { proto.RegisterFile("v2/accounting/grpc/types.proto", fileDescriptor_86d8857937dfd0e8) } + +var fileDescriptor_86d8857937dfd0e8 = []byte{ + // 203 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x2b, 0x33, 0xd2, 0x4f, + 0x4c, 0x4e, 0xce, 0x2f, 0xcd, 0x2b, 0xc9, 0xcc, 0x4b, 0xd7, 0x4f, 0x2f, 0x2a, 0x48, 0xd6, 0x2f, + 0xa9, 0x2c, 0x48, 0x2d, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0xc9, 0x4b, 0xcd, 0xd7, + 0x4b, 0x2b, 0xd6, 0x2b, 0x33, 0xd2, 0x43, 0x28, 0x53, 0xb2, 0xe5, 0x62, 0x77, 0x49, 0x4d, 0xce, + 0xcc, 0x4d, 0xcc, 0x11, 0x12, 0xe1, 0x62, 0x2d, 0x4b, 0xcc, 0x29, 0x4d, 0x95, 0x60, 0x54, 0x60, + 0xd4, 0x60, 0x0e, 0x82, 0x70, 0x84, 0x64, 0xb8, 0x38, 0x0b, 0x8a, 0x52, 0x93, 0x33, 0x8b, 0x33, + 0xf3, 0xf3, 0x24, 0x98, 0x14, 0x18, 0x35, 0x78, 0x83, 0x10, 0x02, 0x4e, 0xd9, 0x27, 0x1e, 0xc9, + 0x31, 0x5e, 0x78, 0x24, 0xc7, 0xf8, 0xe0, 0x91, 0x1c, 0xe3, 0x8c, 0xc7, 0x72, 0x0c, 0x51, 0xf6, + 0xe9, 0x99, 0x25, 0x19, 0xa5, 0x49, 0x7a, 0xc9, 0xf9, 0xb9, 0xfa, 0x79, 0xc5, 0x05, 0xc9, 0xc9, + 0xba, 0x29, 0xa9, 0x65, 0xfa, 0x79, 0xa9, 0xf9, 0x69, 0xc5, 0xba, 0x89, 0x05, 0x99, 0xba, 0xe9, + 0xf9, 0xfa, 0x98, 0x0e, 0xb5, 0x46, 0xf0, 0x57, 0x31, 0x89, 0xfb, 0xa5, 0xe6, 0xbb, 0x05, 0xeb, + 0x39, 0x06, 0x78, 0x82, 0xdc, 0xea, 0x08, 0x97, 0x49, 0x62, 0x03, 0x7b, 0xc4, 0x18, 0x10, 0x00, + 0x00, 0xff, 0xff, 0xcd, 0x8e, 0x26, 0xec, 0xea, 0x00, 0x00, 0x00, +} + +func (m *Decimal) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Decimal) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Decimal) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.Precision != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Precision)) + i-- + dAtA[i] = 0x10 + } + if m.Value != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Value)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func encodeVarintTypes(dAtA []byte, offset int, v uint64) int { + offset -= sovTypes(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Decimal) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Value != 0 { + n += 1 + sovTypes(uint64(m.Value)) + } + if m.Precision != 0 { + n += 1 + sovTypes(uint64(m.Precision)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovTypes(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozTypes(x uint64) (n int) { + return sovTypes(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Decimal) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Decimal: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Decimal: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + m.Value = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Value |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Precision", wireType) + } + m.Precision = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Precision |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipTypes(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthTypes + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTypes + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthTypes + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthTypes = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTypes = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTypes = fmt.Errorf("proto: unexpected end of group") +) diff --git a/v2/container/convert.go b/v2/container/convert.go index 58d99da..b5d829a 100644 --- a/v2/container/convert.go +++ b/v2/container/convert.go @@ -116,8 +116,9 @@ func PutRequestBodyToGRPCMessage(r *PutRequestBody) *container.PutRequest_Body { ContainerToGRPCMessage(r.GetContainer()), ) - m.SetPublicKey(r.GetPublicKey()) - m.SetSignature(r.GetSignature()) + m.SetSignature( + service.SignatureToGRPCMessage(r.GetSignature()), + ) return m } @@ -133,8 +134,9 @@ func PutRequestBodyFromGRPCMessage(m *container.PutRequest_Body) *PutRequestBody ContainerFromGRPCMessage(m.GetContainer()), ) - r.SetPublicKey(m.GetPublicKey()) - r.SetSignature(m.GetSignature()) + r.SetSignature( + service.SignatureFromGRPCMessage(m.GetSignature()), + ) return r } @@ -362,7 +364,9 @@ func DeleteRequestBodyToGRPCMessage(r *DeleteRequestBody) *container.DeleteReque refs.ContainerIDToGRPCMessage(r.GetContainerID()), ) - m.SetSignature(r.GetSignature()) + m.SetSignature( + service.SignatureToGRPCMessage(r.GetSignature()), + ) return m } @@ -378,7 +382,9 @@ func DeleteRequestBodyFromGRPCMessage(m *container.DeleteRequest_Body) *DeleteRe refs.ContainerIDFromGRPCMessage(m.GetContainerId()), ) - r.SetSignature(m.GetSignature()) + r.SetSignature( + service.SignatureFromGRPCMessage(m.GetSignature()), + ) return r } @@ -608,7 +614,8 @@ func SetExtendedACLRequestBodyToGRPCMessage(r *SetExtendedACLRequestBody) *conta acl.TableToGRPCMessage(r.GetEACL()), ) - m.SetSignature(r.GetSignature()) + m.SetSignature( + service.SignatureToGRPCMessage(r.GetSignature())) return m } @@ -624,6 +631,10 @@ func SetExtendedACLRequestBodyFromGRPCMessage(m *container.SetExtendedACLRequest acl.TableFromGRPCMessage(m.GetEacl()), ) + r.SetSignature( + service.SignatureFromGRPCMessage(m.GetSignature()), + ) + return r } @@ -782,7 +793,9 @@ func GetExtendedACLResponseBodyToGRPCMessage(r *GetExtendedACLResponseBody) *con acl.TableToGRPCMessage(r.GetEACL()), ) - m.SetSignature(r.GetSignature()) + m.SetSignature( + service.SignatureToGRPCMessage(r.GetSignature()), + ) return m } @@ -798,7 +811,9 @@ func GetExtendedACLResponseBodyFromGRPCMessage(m *container.GetExtendedACLRespon acl.TableFromGRPCMessage(m.GetEacl()), ) - r.SetSignature(m.GetSignature()) + r.SetSignature( + service.SignatureFromGRPCMessage(m.GetSignature()), + ) return r } diff --git a/v2/container/grpc/service.go b/v2/container/grpc/service.go index 3cbbe58..f92501f 100644 --- a/v2/container/grpc/service.go +++ b/v2/container/grpc/service.go @@ -13,15 +13,8 @@ func (m *PutRequest_Body) SetContainer(v *Container) { } } -// SetPublicKey sets public key of the container owner. -func (m *PutRequest_Body) SetPublicKey(v []byte) { - if m != nil { - m.PublicKey = v - } -} - // SetSignature sets signature of the container structure. -func (m *PutRequest_Body) SetSignature(v []byte) { +func (m *PutRequest_Body) SetSignature(v *service.Signature) { if m != nil { m.Signature = v } @@ -84,7 +77,7 @@ func (m *DeleteRequest_Body) SetContainerId(v *refs.ContainerID) { } // SetSignature sets signature of the container identifier. -func (m *DeleteRequest_Body) SetSignature(v []byte) { +func (m *DeleteRequest_Body) SetSignature(v *service.Signature) { if m != nil { m.Signature = v } @@ -250,7 +243,7 @@ func (m *SetExtendedACLRequest_Body) SetEacl(v *acl.EACLTable) { } // SetSignature sets signature of the eACL table. -func (m *SetExtendedACLRequest_Body) SetSignature(v []byte) { +func (m *SetExtendedACLRequest_Body) SetSignature(v *service.Signature) { if m != nil { m.Signature = v } @@ -334,7 +327,7 @@ func (m *GetExtendedACLResponse_Body) SetEacl(v *acl.EACLTable) { } // SetSignature sets signature of the eACL table. -func (m *GetExtendedACLResponse_Body) SetSignature(v []byte) { +func (m *GetExtendedACLResponse_Body) SetSignature(v *service.Signature) { if m != nil { m.Signature = v } diff --git a/v2/container/grpc/service.pb.go b/v2/container/grpc/service.pb.go index c5ae473..04a48a8 100644 --- a/v2/container/grpc/service.pb.go +++ b/v2/container/grpc/service.pb.go @@ -103,14 +103,11 @@ func (m *PutRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { type PutRequest_Body struct { // Container to create in NeoFS. Container *Container `protobuf:"bytes,1,opt,name=container,proto3" json:"container,omitempty"` - // Public Key of container owner. It can be public key of the owner - // or it can be public key that bound in neofs.id smart-contract. - PublicKey []byte `protobuf:"bytes,2,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"` - // Signature of stable-marshalled container according to RFC-6979. - Signature []byte `protobuf:"bytes,3,opt,name=signature,proto3" json:"signature,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + //Signature of stable-marshalled container according to RFC-6979. + Signature *grpc.Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *PutRequest_Body) Reset() { *m = PutRequest_Body{} } @@ -153,14 +150,7 @@ func (m *PutRequest_Body) GetContainer() *Container { return nil } -func (m *PutRequest_Body) GetPublicKey() []byte { - if m != nil { - return m.PublicKey - } - return nil -} - -func (m *PutRequest_Body) GetSignature() []byte { +func (m *PutRequest_Body) GetSignature() *grpc.Signature { if m != nil { return m.Signature } @@ -362,10 +352,10 @@ type DeleteRequest_Body struct { // from NeoFS. ContainerId *grpc1.ContainerID `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` // Signature of container id according to RFC-6979. - Signature []byte `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Signature *grpc.Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *DeleteRequest_Body) Reset() { *m = DeleteRequest_Body{} } @@ -408,7 +398,7 @@ func (m *DeleteRequest_Body) GetContainerId() *grpc1.ContainerID { return nil } -func (m *DeleteRequest_Body) GetSignature() []byte { +func (m *DeleteRequest_Body) GetSignature() *grpc.Signature { if m != nil { return m.Signature } @@ -1077,10 +1067,10 @@ type SetExtendedACLRequest_Body struct { // Extended ACL to set for the container. Eacl *grpc2.EACLTable `protobuf:"bytes,1,opt,name=eacl,proto3" json:"eacl,omitempty"` // Signature of stable-marshalled Extended ACL according to RFC-6979. - Signature []byte `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Signature *grpc.Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *SetExtendedACLRequest_Body) Reset() { *m = SetExtendedACLRequest_Body{} } @@ -1123,7 +1113,7 @@ func (m *SetExtendedACLRequest_Body) GetEacl() *grpc2.EACLTable { return nil } -func (m *SetExtendedACLRequest_Body) GetSignature() []byte { +func (m *SetExtendedACLRequest_Body) GetSignature() *grpc.Signature { if m != nil { return m.Signature } @@ -1434,10 +1424,10 @@ type GetExtendedACLResponse_Body struct { // Extended ACL that has been requested if it was set up. Eacl *grpc2.EACLTable `protobuf:"bytes,1,opt,name=eacl,proto3" json:"eacl,omitempty"` // Signature of stable-marshalled Extended ACL according to RFC-6979. - Signature []byte `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Signature *grpc.Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetExtendedACLResponse_Body) Reset() { *m = GetExtendedACLResponse_Body{} } @@ -1480,7 +1470,7 @@ func (m *GetExtendedACLResponse_Body) GetEacl() *grpc2.EACLTable { return nil } -func (m *GetExtendedACLResponse_Body) GetSignature() []byte { +func (m *GetExtendedACLResponse_Body) GetSignature() *grpc.Signature { if m != nil { return m.Signature } @@ -1517,60 +1507,58 @@ func init() { func init() { proto.RegisterFile("v2/container/grpc/service.proto", fileDescriptor_364186d99410ec35) } var fileDescriptor_364186d99410ec35 = []byte{ - // 840 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x98, 0x41, 0x6f, 0xd3, 0x4a, - 0x10, 0xc7, 0x9f, 0xdd, 0xa8, 0xef, 0x75, 0x92, 0x56, 0x4f, 0x7e, 0x6a, 0x1b, 0xf9, 0xb5, 0x69, - 0x30, 0x14, 0x2a, 0x68, 0x6c, 0x64, 0x2e, 0xd0, 0x16, 0x44, 0x9b, 0xb4, 0x6e, 0xd4, 0x02, 0xad, - 0x8b, 0x38, 0x70, 0xa9, 0x1c, 0x7b, 0x93, 0x5a, 0xa4, 0x76, 0xb0, 0x1d, 0x97, 0x1c, 0xe1, 0x53, - 0x70, 0x40, 0x9c, 0x51, 0xc5, 0x81, 0x4f, 0xc0, 0x19, 0x21, 0x84, 0xf8, 0x08, 0xa8, 0xf0, 0x09, - 0xf8, 0x04, 0xc8, 0x5e, 0xc7, 0xb1, 0x13, 0xa7, 0x4e, 0xaa, 0x70, 0xf0, 0xcd, 0xf6, 0xce, 0xcc, - 0xce, 0xfc, 0xf4, 0xdf, 0x9d, 0x5d, 0xc3, 0x82, 0xcd, 0x73, 0xb2, 0xae, 0x59, 0x92, 0xaa, 0x21, - 0x83, 0xab, 0x19, 0x0d, 0x99, 0x33, 0x91, 0x61, 0xab, 0x32, 0x62, 0x1b, 0x86, 0x6e, 0xe9, 0xd4, - 0x7f, 0x1a, 0xd2, 0xd9, 0xaa, 0xc9, 0xda, 0x3c, 0xeb, 0xdb, 0xd1, 0xb3, 0x36, 0xcf, 0x49, 0x72, - 0x1d, 0xdb, 0x5b, 0xad, 0x06, 0x32, 0xb1, 0x35, 0x3d, 0xdf, 0x1b, 0x2e, 0x38, 0x9c, 0xb5, 0x79, - 0xce, 0x40, 0x55, 0xb3, 0x77, 0x84, 0xb6, 0xf9, 0xf6, 0xc4, 0x78, 0xf0, 0x18, 0x59, 0x92, 0x37, - 0x36, 0xd7, 0x3d, 0x66, 0x23, 0x43, 0xad, 0xb6, 0xf0, 0x28, 0xf3, 0x93, 0x04, 0xd8, 0x6b, 0x5a, - 0x22, 0x7a, 0xde, 0x44, 0xa6, 0x45, 0xdd, 0x86, 0x54, 0x45, 0x57, 0x5a, 0x59, 0x22, 0x4f, 0x2c, - 0xa5, 0xf9, 0x2b, 0x6c, 0x44, 0xfa, 0x6c, 0xc7, 0x9c, 0xdd, 0xd0, 0x95, 0x96, 0xe8, 0x7a, 0x50, - 0x9b, 0x90, 0x76, 0x26, 0x3d, 0x3c, 0x42, 0x92, 0x82, 0x8c, 0x2c, 0xd9, 0x13, 0xa0, 0x0d, 0xc6, - 0xf3, 0x7d, 0x80, 0x2c, 0x69, 0xdb, 0xb5, 0x15, 0xe1, 0xd8, 0x7f, 0xa6, 0xf6, 0x61, 0x12, 0xe7, - 0xd7, 0x0e, 0x34, 0xe6, 0x06, 0x5a, 0xee, 0x1f, 0xe8, 0x89, 0x63, 0xae, 0xca, 0x92, 0xa5, 0xea, - 0x9a, 0x17, 0x30, 0x83, 0x43, 0xe0, 0x37, 0xfa, 0x25, 0x01, 0x29, 0x27, 0x51, 0x6a, 0x0d, 0x26, - 0xfc, 0x2a, 0xbc, 0x0a, 0x73, 0x91, 0x15, 0x16, 0xdb, 0x4f, 0x62, 0xc7, 0x81, 0x9a, 0x07, 0x68, - 0x34, 0x2b, 0x75, 0x55, 0x3e, 0x7c, 0x86, 0x5a, 0x6e, 0x7d, 0x19, 0x71, 0x02, 0x7f, 0xd9, 0x41, - 0x2d, 0x6a, 0x0e, 0x26, 0x4c, 0xb5, 0xa6, 0x49, 0x56, 0xd3, 0x40, 0x6e, 0xd2, 0x19, 0xb1, 0xf3, - 0x81, 0x79, 0x4f, 0x42, 0xda, 0xe5, 0x66, 0x36, 0x74, 0xcd, 0x44, 0xd4, 0x9d, 0x10, 0xe7, 0xc5, - 0xfe, 0x9c, 0xb1, 0x7d, 0x10, 0xf4, 0x56, 0x14, 0xe8, 0xc5, 0x48, 0x3e, 0xd8, 0xb9, 0x0f, 0x69, - 0x31, 0x9a, 0x74, 0xe1, 0x9c, 0x48, 0xb1, 0xa8, 0xb7, 0x3c, 0xd2, 0xf7, 0x20, 0xe3, 0xd7, 0x71, - 0xa8, 0x2a, 0x5e, 0x99, 0xff, 0x07, 0x42, 0x3b, 0x3a, 0xee, 0x70, 0x2e, 0x97, 0xc4, 0xb4, 0xef, - 0x50, 0x56, 0x98, 0x2f, 0x24, 0x4c, 0x96, 0x50, 0x1d, 0x59, 0xa8, 0x2d, 0xcc, 0xd5, 0x10, 0xb0, - 0x6b, 0x91, 0xc0, 0x42, 0x1e, 0xc9, 0xd0, 0xa6, 0x32, 0x1a, 0x60, 0x61, 0xf5, 0x91, 0xdd, 0xea, - 0xfb, 0x45, 0xc0, 0x54, 0x1b, 0x8e, 0x27, 0xc0, 0xb5, 0x10, 0xcf, 0xa5, 0x73, 0x79, 0x26, 0x4b, - 0x83, 0xe3, 0x18, 0x29, 0xf3, 0x8e, 0x04, 0x10, 0xd0, 0x50, 0x3b, 0x5b, 0xc7, 0x3c, 0x19, 0xea, - 0x19, 0xd5, 0x72, 0x3b, 0x25, 0x21, 0xed, 0xd6, 0x3e, 0xc4, 0xee, 0x14, 0xb0, 0x4f, 0x8a, 0x32, - 0x4a, 0xa3, 0xe8, 0x03, 0xcc, 0x5b, 0x12, 0xd2, 0xbb, 0xaa, 0xe9, 0x0b, 0x6b, 0x10, 0x58, 0x01, - 0xfb, 0x64, 0x28, 0x6b, 0xc5, 0x43, 0xc5, 0xc3, 0x3f, 0xfa, 0x49, 0x48, 0x55, 0xb3, 0xdd, 0xaa, - 0x7a, 0x74, 0x82, 0x15, 0xf5, 0xb7, 0x6b, 0x58, 0x56, 0x98, 0x0f, 0x24, 0x64, 0x70, 0xc1, 0x9e, - 0x9c, 0x56, 0x42, 0x84, 0xae, 0x9e, 0x43, 0x28, 0x59, 0x7a, 0xda, 0xf6, 0x20, 0xdd, 0x87, 0xc9, - 0xe0, 0xf2, 0x33, 0xb3, 0x44, 0x7e, 0x2c, 0x6e, 0xfd, 0x65, 0x02, 0xeb, 0xcf, 0x64, 0x3e, 0x93, - 0x30, 0x7d, 0x80, 0xac, 0xcd, 0x17, 0x16, 0xd2, 0x14, 0xa4, 0xac, 0x17, 0x77, 0xdb, 0xea, 0x2a, - 0x86, 0xd8, 0x71, 0x91, 0xec, 0x22, 0x3d, 0x93, 0xa1, 0x33, 0xd1, 0x43, 0xb8, 0x0c, 0x29, 0x24, - 0xc9, 0x75, 0xaf, 0xcc, 0x6c, 0x20, 0xa2, 0x24, 0xd7, 0xd9, 0xcd, 0xf5, 0xe2, 0xee, 0x63, 0xa9, - 0x52, 0x47, 0xa2, 0x6b, 0x15, 0xd3, 0xed, 0x5e, 0x91, 0x30, 0xd3, 0x8d, 0xc4, 0x53, 0x62, 0x29, - 0x44, 0xf3, 0xe6, 0x40, 0x34, 0x93, 0xd9, 0xfd, 0x3e, 0x92, 0x30, 0x2d, 0x5c, 0x58, 0x51, 0x42, - 0x72, 0x15, 0x35, 0xaa, 0x9e, 0xf8, 0x95, 0x84, 0x19, 0xe1, 0xe2, 0x2a, 0x12, 0x12, 0xad, 0xa2, - 0x3f, 0xb0, 0x2c, 0xf9, 0x37, 0x29, 0xf8, 0xd7, 0xa7, 0x7d, 0x80, 0x33, 0xa2, 0xb6, 0x61, 0x6c, - 0xaf, 0x69, 0x51, 0x0b, 0x31, 0x17, 0x4d, 0x3a, 0x1f, 0x77, 0x43, 0xa2, 0xf6, 0x61, 0x1c, 0x9f, - 0x57, 0x29, 0x26, 0xfe, 0x72, 0x40, 0x5f, 0x1e, 0xe0, 0xc0, 0xeb, 0x24, 0x27, 0xa0, 0x7e, 0xc9, - 0x75, 0xce, 0x8a, 0x7d, 0x92, 0x0b, 0x1e, 0xa8, 0x76, 0x20, 0xe5, 0x34, 0x38, 0x2a, 0x1f, 0x77, - 0x3a, 0xa0, 0x2f, 0xc5, 0x76, 0x47, 0x4a, 0x85, 0xa9, 0xf0, 0x1e, 0x45, 0x5d, 0x1f, 0xbc, 0x2d, - 0xd0, 0x37, 0x86, 0xd8, 0xf4, 0x9c, 0xa9, 0x84, 0x41, 0xa6, 0x12, 0x86, 0x98, 0x2a, 0x7a, 0x65, - 0x6c, 0x1c, 0x7d, 0x3a, 0xcb, 0x11, 0xdf, 0xce, 0x72, 0xc4, 0xf7, 0xb3, 0x1c, 0xf1, 0xfa, 0x47, - 0xee, 0xaf, 0xa7, 0x77, 0x6b, 0xaa, 0x75, 0xd4, 0xac, 0xb0, 0xb2, 0x7e, 0xcc, 0x69, 0x66, 0x43, - 0x96, 0x0b, 0x0a, 0xb2, 0x39, 0x0d, 0xe9, 0x55, 0xb3, 0x20, 0x35, 0xd4, 0x42, 0x4d, 0xe7, 0x7a, - 0xfe, 0x97, 0xac, 0xfa, 0xaf, 0xa7, 0xe4, 0xcc, 0x43, 0xa4, 0x6f, 0x1d, 0xb0, 0xeb, 0x7b, 0x65, - 0x27, 0x01, 0x5f, 0x7a, 0x95, 0x71, 0xf7, 0xcf, 0xc7, 0xad, 0xdf, 0x01, 0x00, 0x00, 0xff, 0xff, - 0x27, 0x5d, 0xa8, 0x45, 0xbd, 0x11, 0x00, 0x00, + // 813 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x98, 0xcf, 0x6e, 0xd3, 0x5a, + 0x10, 0xc6, 0xaf, 0xdd, 0xa8, 0xf7, 0x76, 0x92, 0x56, 0x57, 0xbe, 0x6a, 0x1b, 0xa5, 0x97, 0x34, + 0x18, 0x0a, 0x15, 0x34, 0x36, 0x32, 0x1b, 0x68, 0x0b, 0xa2, 0x4d, 0x5a, 0x37, 0xa2, 0x40, 0xeb, + 0x20, 0x16, 0x6c, 0x2a, 0xc7, 0x9e, 0xa4, 0x96, 0x52, 0x3b, 0xd8, 0x8e, 0x4b, 0x76, 0xa8, 0x4f, + 0xc1, 0x02, 0xb1, 0x46, 0x15, 0x0b, 0x9e, 0x80, 0x35, 0x4b, 0x1e, 0x01, 0xb5, 0x1b, 0x24, 0x58, + 0xf1, 0x04, 0x28, 0xfe, 0x17, 0xbb, 0x71, 0x9a, 0xa4, 0x8d, 0x90, 0xbc, 0x4b, 0xe4, 0x6f, 0xe6, + 0xcc, 0xfc, 0xf2, 0x9d, 0x33, 0xc7, 0x81, 0x79, 0x8b, 0x63, 0x25, 0x4d, 0x35, 0x45, 0x45, 0x45, + 0x9d, 0xad, 0xe9, 0x0d, 0x89, 0x35, 0x50, 0xb7, 0x14, 0x09, 0x99, 0x86, 0xae, 0x99, 0x1a, 0xf5, + 0x9f, 0x8a, 0x1a, 0x53, 0x35, 0x18, 0x8b, 0x63, 0x7c, 0x5d, 0x66, 0xd6, 0xe2, 0x58, 0x51, 0xaa, + 0x3b, 0x7a, 0xb3, 0xd5, 0x40, 0xc3, 0x51, 0x67, 0xae, 0x74, 0xa7, 0x0b, 0x3e, 0x4e, 0x5b, 0x1c, + 0xab, 0x63, 0xd5, 0xe8, 0x7e, 0x32, 0x67, 0x71, 0xde, 0xc2, 0x5d, 0x0f, 0xe9, 0x53, 0x12, 0x60, + 0xa7, 0x69, 0x0a, 0xf8, 0xaa, 0x89, 0x86, 0x49, 0xdd, 0x83, 0x44, 0x45, 0x93, 0x5b, 0x69, 0x22, + 0x47, 0x2c, 0x26, 0xb9, 0xeb, 0x4c, 0x44, 0x85, 0x4c, 0x47, 0xce, 0xac, 0x6b, 0x72, 0x4b, 0xb0, + 0x23, 0xa8, 0x0d, 0x48, 0x1e, 0xa0, 0x29, 0xee, 0xed, 0xa3, 0x28, 0xa3, 0x9e, 0x26, 0xbb, 0x12, + 0x78, 0xbd, 0xbb, 0xb1, 0x4f, 0xd0, 0x14, 0xb7, 0x6c, 0xad, 0x00, 0x07, 0xfe, 0x67, 0x6a, 0x17, + 0x26, 0x2d, 0xd4, 0x95, 0x6a, 0xcb, 0x4b, 0x34, 0x66, 0x27, 0x5a, 0xea, 0x9d, 0xe8, 0x45, 0x5b, + 0xae, 0x48, 0xa2, 0xa9, 0x68, 0xaa, 0x9b, 0x30, 0xe5, 0xa4, 0x70, 0xbe, 0x65, 0xde, 0x10, 0x90, + 0x68, 0x17, 0x4a, 0xad, 0xc2, 0x84, 0xdf, 0x85, 0xdb, 0x61, 0x36, 0xb2, 0xc3, 0x82, 0xf7, 0x49, + 0xe8, 0x04, 0x50, 0xcb, 0x30, 0x61, 0x28, 0x35, 0x55, 0x34, 0x9b, 0x3a, 0xba, 0xed, 0xfd, 0x1f, + 0x51, 0x55, 0xd9, 0xd3, 0x08, 0x1d, 0x39, 0xfd, 0x91, 0x84, 0xa4, 0x8d, 0xcd, 0x68, 0x68, 0xaa, + 0x81, 0xd4, 0xfd, 0x10, 0xe6, 0x85, 0xde, 0x98, 0x1d, 0x7d, 0x90, 0xf3, 0x66, 0x14, 0xe7, 0x85, + 0x48, 0x3c, 0x4e, 0x70, 0x0f, 0xd0, 0x42, 0x34, 0xe8, 0xfc, 0x39, 0x99, 0xfa, 0x92, 0xde, 0x74, + 0x41, 0x3f, 0x84, 0x94, 0xdf, 0xc7, 0x9e, 0x22, 0xbb, 0x6d, 0xce, 0x05, 0x52, 0xb7, 0x9d, 0xda, + 0xc1, 0x5c, 0x2a, 0x0a, 0x49, 0x3f, 0xa0, 0x24, 0xd3, 0x3f, 0x48, 0x98, 0x2c, 0x62, 0x1d, 0x4d, + 0xf4, 0x7c, 0xb9, 0x12, 0x02, 0x76, 0x33, 0x12, 0x58, 0x28, 0x22, 0x1e, 0xd6, 0x3c, 0x22, 0x46, + 0x43, 0xec, 0x52, 0xe6, 0xfc, 0x45, 0xc0, 0x94, 0xc7, 0xce, 0xf5, 0xe7, 0x6a, 0x08, 0xf7, 0xe2, + 0xb9, 0xb8, 0xe3, 0x65, 0xd1, 0x71, 0x07, 0x38, 0xfd, 0x81, 0x04, 0xe0, 0x71, 0xa8, 0x73, 0xaf, + 0x23, 0x8f, 0x87, 0xb9, 0x46, 0xb5, 0x1b, 0x8f, 0x49, 0x48, 0xda, 0xbd, 0x0f, 0x71, 0x78, 0x05, + 0xf4, 0x71, 0x71, 0x46, 0x71, 0x14, 0x53, 0x82, 0x7e, 0x4f, 0x42, 0x72, 0x5b, 0x31, 0x7c, 0x63, + 0x0d, 0x02, 0x2b, 0xa0, 0x8f, 0x87, 0xb3, 0x96, 0x5d, 0x54, 0x1c, 0xfc, 0xa3, 0x1d, 0x86, 0x5c, + 0x35, 0x7b, 0xd6, 0x55, 0xcf, 0x0e, 0x1d, 0x47, 0xfd, 0x6d, 0x0b, 0x4b, 0x32, 0xfd, 0x89, 0x84, + 0x94, 0xd3, 0xb0, 0x6b, 0xa7, 0xe5, 0x10, 0xa1, 0x1b, 0xe7, 0x10, 0x8a, 0x97, 0x9f, 0xb6, 0x5c, + 0x48, 0x8f, 0x60, 0x32, 0xb8, 0xfd, 0x8c, 0x34, 0x91, 0x1b, 0xeb, 0xb7, 0xff, 0x52, 0x81, 0xfd, + 0x67, 0xd0, 0xdf, 0x49, 0x98, 0x2e, 0xa3, 0xb9, 0xf1, 0xda, 0x44, 0x55, 0x46, 0x79, 0xad, 0xb0, + 0xed, 0xb9, 0xab, 0x10, 0x62, 0xc7, 0x46, 0xb2, 0x8b, 0x8c, 0x8c, 0x87, 0xcf, 0x1a, 0x2e, 0xc2, + 0x25, 0x48, 0xa0, 0x28, 0xd5, 0xdd, 0x36, 0xd3, 0x81, 0x8c, 0xa2, 0x54, 0x67, 0x36, 0xd6, 0x0a, + 0xdb, 0xcf, 0xc5, 0x4a, 0x1d, 0x05, 0x5b, 0x75, 0xa9, 0x59, 0x78, 0x44, 0xc2, 0xcc, 0x59, 0x60, + 0xae, 0x4f, 0x8b, 0x21, 0xd6, 0x77, 0x06, 0x62, 0x1d, 0xcf, 0xd9, 0xf8, 0x99, 0x84, 0x69, 0xfe, + 0xc2, 0x7e, 0xe3, 0xe3, 0xeb, 0xb7, 0x51, 0x4d, 0xcc, 0x9f, 0x24, 0xcc, 0xf0, 0x17, 0x77, 0x11, + 0x1f, 0x6b, 0x17, 0xfd, 0xf1, 0x4d, 0xcb, 0xbd, 0x4b, 0xc0, 0xbf, 0xfe, 0x6f, 0x51, 0x76, 0x94, + 0xd4, 0x16, 0x8c, 0xed, 0x34, 0x4d, 0x6a, 0xbe, 0xcf, 0x2b, 0x6c, 0x26, 0xd7, 0xef, 0xe5, 0x8b, + 0xda, 0x85, 0x71, 0xe7, 0xae, 0x4b, 0xd1, 0xfd, 0xdf, 0x3b, 0x32, 0xd7, 0x06, 0xb8, 0x2c, 0xb7, + 0x8b, 0xe3, 0xb1, 0x57, 0x71, 0x9d, 0x7b, 0x66, 0x8f, 0xe2, 0x82, 0x97, 0xb1, 0xc7, 0x90, 0x68, + 0x0f, 0x47, 0x2a, 0xd7, 0xef, 0x66, 0x91, 0xb9, 0xda, 0x77, 0xb2, 0x52, 0x0a, 0x4c, 0x85, 0x4f, + 0x30, 0xea, 0xd6, 0xe0, 0x23, 0x25, 0x73, 0x7b, 0x88, 0x23, 0xb1, 0xbd, 0x14, 0x3f, 0xc8, 0x52, + 0xfc, 0x10, 0x4b, 0x45, 0xef, 0x9b, 0xf5, 0xfd, 0x2f, 0x27, 0x59, 0xe2, 0xeb, 0x49, 0x96, 0xf8, + 0x76, 0x92, 0x25, 0xde, 0x9e, 0x66, 0xff, 0x7a, 0xf9, 0xa0, 0xa6, 0x98, 0xfb, 0xcd, 0x0a, 0x23, + 0x69, 0x07, 0xac, 0x6a, 0x34, 0x24, 0x29, 0x2f, 0xa3, 0xc5, 0xaa, 0xa8, 0x55, 0x8d, 0xbc, 0xd8, + 0x50, 0xf2, 0x35, 0x8d, 0xed, 0xfa, 0xb3, 0x65, 0xc5, 0xff, 0x7a, 0x4c, 0xce, 0x3c, 0x45, 0x6d, + 0xb3, 0xcc, 0xac, 0xed, 0x94, 0xda, 0x05, 0xf8, 0xd6, 0xab, 0x8c, 0xdb, 0xff, 0xa9, 0xdc, 0xfd, + 0x1d, 0x00, 0x00, 0xff, 0xff, 0x27, 0xf9, 0x1d, 0xbb, 0xfa, 0x11, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1952,17 +1940,15 @@ func (m *PutRequest_Body) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } - if len(m.Signature) > 0 { - i -= len(m.Signature) - copy(dAtA[i:], m.Signature) - i = encodeVarintService(dAtA, i, uint64(len(m.Signature))) - i-- - dAtA[i] = 0x1a - } - if len(m.PublicKey) > 0 { - i -= len(m.PublicKey) - copy(dAtA[i:], m.PublicKey) - i = encodeVarintService(dAtA, i, uint64(len(m.PublicKey))) + if m.Signature != nil { + { + size, err := m.Signature.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } i-- dAtA[i] = 0x12 } @@ -2170,10 +2156,15 @@ func (m *DeleteRequest_Body) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } - if len(m.Signature) > 0 { - i -= len(m.Signature) - copy(dAtA[i:], m.Signature) - i = encodeVarintService(dAtA, i, uint64(len(m.Signature))) + if m.Signature != nil { + { + size, err := m.Signature.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } i-- dAtA[i] = 0x12 } @@ -2779,10 +2770,15 @@ func (m *SetExtendedACLRequest_Body) MarshalToSizedBuffer(dAtA []byte) (int, err i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } - if len(m.Signature) > 0 { - i -= len(m.Signature) - copy(dAtA[i:], m.Signature) - i = encodeVarintService(dAtA, i, uint64(len(m.Signature))) + if m.Signature != nil { + { + size, err := m.Signature.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } i-- dAtA[i] = 0x12 } @@ -3080,10 +3076,15 @@ func (m *GetExtendedACLResponse_Body) MarshalToSizedBuffer(dAtA []byte) (int, er i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } - if len(m.Signature) > 0 { - i -= len(m.Signature) - copy(dAtA[i:], m.Signature) - i = encodeVarintService(dAtA, i, uint64(len(m.Signature))) + if m.Signature != nil { + { + size, err := m.Signature.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } i-- dAtA[i] = 0x12 } @@ -3147,12 +3148,8 @@ func (m *PutRequest_Body) Size() (n int) { l = m.Container.Size() n += 1 + l + sovService(uint64(l)) } - l = len(m.PublicKey) - if l > 0 { - n += 1 + l + sovService(uint64(l)) - } - l = len(m.Signature) - if l > 0 { + if m.Signature != nil { + l = m.Signature.Size() n += 1 + l + sovService(uint64(l)) } if m.XXX_unrecognized != nil { @@ -3235,8 +3232,8 @@ func (m *DeleteRequest_Body) Size() (n int) { l = m.ContainerId.Size() n += 1 + l + sovService(uint64(l)) } - l = len(m.Signature) - if l > 0 { + if m.Signature != nil { + l = m.Signature.Size() n += 1 + l + sovService(uint64(l)) } if m.XXX_unrecognized != nil { @@ -3477,8 +3474,8 @@ func (m *SetExtendedACLRequest_Body) Size() (n int) { l = m.Eacl.Size() n += 1 + l + sovService(uint64(l)) } - l = len(m.Signature) - if l > 0 { + if m.Signature != nil { + l = m.Signature.Size() n += 1 + l + sovService(uint64(l)) } if m.XXX_unrecognized != nil { @@ -3597,8 +3594,8 @@ func (m *GetExtendedACLResponse_Body) Size() (n int) { l = m.Eacl.Size() n += 1 + l + sovService(uint64(l)) } - l = len(m.Signature) - if l > 0 { + if m.Signature != nil { + l = m.Signature.Size() n += 1 + l + sovService(uint64(l)) } if m.XXX_unrecognized != nil { @@ -3841,44 +3838,10 @@ func (m *PutRequest_Body) Unmarshal(dAtA []byte) error { } iNdEx = postIndex case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PublicKey", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.PublicKey = append(m.PublicKey[:0], dAtA[iNdEx:postIndex]...) - if m.PublicKey == nil { - m.PublicKey = []byte{} - } - iNdEx = postIndex - case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Signature", wireType) } - var byteLen int + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowService @@ -3888,24 +3851,26 @@ func (m *PutRequest_Body) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { + if msglen < 0 { return ErrInvalidLengthService } - postIndex := iNdEx + byteLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthService } if postIndex > l { return io.ErrUnexpectedEOF } - m.Signature = append(m.Signature[:0], dAtA[iNdEx:postIndex]...) if m.Signature == nil { - m.Signature = []byte{} + m.Signature = &grpc.Signature{} + } + if err := m.Signature.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } iNdEx = postIndex default: @@ -4416,7 +4381,7 @@ func (m *DeleteRequest_Body) Unmarshal(dAtA []byte) error { if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Signature", wireType) } - var byteLen int + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowService @@ -4426,24 +4391,26 @@ func (m *DeleteRequest_Body) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { + if msglen < 0 { return ErrInvalidLengthService } - postIndex := iNdEx + byteLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthService } if postIndex > l { return io.ErrUnexpectedEOF } - m.Signature = append(m.Signature[:0], dAtA[iNdEx:postIndex]...) if m.Signature == nil { - m.Signature = []byte{} + m.Signature = &grpc.Signature{} + } + if err := m.Signature.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } iNdEx = postIndex default: @@ -5924,7 +5891,7 @@ func (m *SetExtendedACLRequest_Body) Unmarshal(dAtA []byte) error { if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Signature", wireType) } - var byteLen int + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowService @@ -5934,24 +5901,26 @@ func (m *SetExtendedACLRequest_Body) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { + if msglen < 0 { return ErrInvalidLengthService } - postIndex := iNdEx + byteLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthService } if postIndex > l { return io.ErrUnexpectedEOF } - m.Signature = append(m.Signature[:0], dAtA[iNdEx:postIndex]...) if m.Signature == nil { - m.Signature = []byte{} + m.Signature = &grpc.Signature{} + } + if err := m.Signature.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } iNdEx = postIndex default: @@ -6678,7 +6647,7 @@ func (m *GetExtendedACLResponse_Body) Unmarshal(dAtA []byte) error { if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Signature", wireType) } - var byteLen int + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowService @@ -6688,24 +6657,26 @@ func (m *GetExtendedACLResponse_Body) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { + if msglen < 0 { return ErrInvalidLengthService } - postIndex := iNdEx + byteLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthService } if postIndex > l { return io.ErrUnexpectedEOF } - m.Signature = append(m.Signature[:0], dAtA[iNdEx:postIndex]...) if m.Signature == nil { - m.Signature = []byte{} + m.Signature = &grpc.Signature{} + } + if err := m.Signature.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } iNdEx = postIndex default: diff --git a/v2/container/grpc/types.pb.go b/v2/container/grpc/types.pb.go index f2b1733..97979f1 100644 --- a/v2/container/grpc/types.pb.go +++ b/v2/container/grpc/types.pb.go @@ -190,32 +190,32 @@ func init() { func init() { proto.RegisterFile("v2/container/grpc/types.proto", fileDescriptor_3bfd95a81c72c35c) } var fileDescriptor_3bfd95a81c72c35c = []byte{ - // 400 bytes of a gzipped FileDescriptorProto + // 398 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x52, 0xcd, 0xaa, 0x13, 0x31, - 0x14, 0x76, 0x5a, 0xef, 0xcf, 0xe4, 0x2a, 0x5e, 0xa2, 0xe8, 0x30, 0x62, 0xa9, 0xae, 0x66, 0xd3, - 0x04, 0xe6, 0xba, 0x13, 0x17, 0x55, 0x11, 0x0b, 0xa2, 0x25, 0x82, 0x0b, 0x37, 0x25, 0x4d, 0x4f, - 0xdb, 0xe0, 0x34, 0x09, 0x49, 0x1a, 0xe9, 0x9b, 0xf8, 0x0c, 0x3e, 0x89, 0x4b, 0x1f, 0x41, 0xea, - 0x33, 0xb8, 0x97, 0xc9, 0x38, 0x63, 0xa5, 0x77, 0x97, 0x73, 0xbe, 0xef, 0x3b, 0xf9, 0xce, 0x97, - 0xa0, 0x47, 0xa1, 0xa4, 0x42, 0x2b, 0xcf, 0xa5, 0x02, 0x4b, 0x57, 0xd6, 0x08, 0xea, 0x77, 0x06, - 0x1c, 0x31, 0x56, 0x7b, 0x8d, 0xef, 0x2a, 0xd0, 0x64, 0xe9, 0x48, 0x28, 0x49, 0xc7, 0xca, 0xf3, - 0x50, 0x52, 0x05, 0x7e, 0xc3, 0xcd, 0x91, 0x20, 0xcf, 0x42, 0x49, 0x2d, 0x2c, 0xdd, 0x31, 0x52, - 0xab, 0x1c, 0xd8, 0x20, 0x05, 0x34, 0xe0, 0x06, 0x3c, 0x6f, 0xb0, 0x27, 0xbf, 0x7b, 0x28, 0x7d, - 0xd9, 0xce, 0xc7, 0x4f, 0xd1, 0x59, 0x00, 0xeb, 0xa4, 0x56, 0x59, 0x32, 0x4c, 0x8a, 0x8b, 0x32, - 0x27, 0xff, 0x6c, 0xfc, 0x1d, 0x41, 0x3e, 0x36, 0x0c, 0xd6, 0x52, 0x71, 0x89, 0xce, 0xf5, 0x17, - 0x05, 0x76, 0x26, 0x17, 0x59, 0x2f, 0xca, 0x1e, 0x1c, 0xc8, 0x6a, 0x4f, 0xe4, 0x7d, 0x8d, 0x4f, - 0x5e, 0xb1, 0xb3, 0x48, 0x9c, 0x2c, 0xf0, 0x3d, 0x74, 0xa2, 0xb4, 0x12, 0x90, 0xf5, 0x87, 0x49, - 0x71, 0x8b, 0x35, 0x05, 0x7e, 0x88, 0xd2, 0x39, 0x77, 0x52, 0xcc, 0xb8, 0xa8, 0xb2, 0x9b, 0xc3, - 0xa4, 0xb8, 0xcd, 0xce, 0x63, 0x63, 0x2c, 0x2a, 0xfc, 0x06, 0x21, 0xee, 0xbd, 0x95, 0xf3, 0xad, - 0x07, 0x97, 0x9d, 0x0c, 0xfb, 0xc5, 0x45, 0x59, 0x90, 0x6b, 0x62, 0x22, 0xdd, 0x42, 0x64, 0xdc, - 0x0a, 0xd8, 0x81, 0x16, 0xbf, 0x45, 0x97, 0xa6, 0xe2, 0x02, 0x36, 0xa0, 0xfc, 0xcc, 0xe8, 0x4a, - 0x8a, 0x5d, 0x76, 0x1a, 0x8d, 0x3f, 0x3e, 0x98, 0xd7, 0x04, 0x4d, 0xa6, 0x2d, 0x73, 0x1a, 0x89, - 0xec, 0x8e, 0xf9, 0xbf, 0x91, 0x5f, 0xa1, 0xb4, 0xbb, 0x06, 0x5f, 0xa2, 0xfe, 0x67, 0xd8, 0xc5, - 0xf4, 0x52, 0x56, 0x1f, 0xeb, 0x4d, 0x03, 0xaf, 0xb6, 0x10, 0xa3, 0x49, 0x59, 0x53, 0xbc, 0x58, - 0x7f, 0xdf, 0x0f, 0x92, 0x1f, 0xfb, 0x41, 0xf2, 0x73, 0x3f, 0x48, 0xbe, 0xfe, 0x1a, 0xdc, 0xf8, - 0xf4, 0x7c, 0x25, 0xfd, 0x7a, 0x3b, 0x27, 0x42, 0x6f, 0xa8, 0x72, 0x46, 0x88, 0xd1, 0x02, 0x02, - 0x55, 0xa0, 0x97, 0x6e, 0xc4, 0x8d, 0x1c, 0xad, 0x34, 0x3d, 0xfa, 0x31, 0xcf, 0xba, 0xf2, 0x5b, - 0xef, 0xfe, 0x3b, 0xd0, 0xaf, 0x3f, 0x90, 0xf1, 0x74, 0x52, 0x9b, 0xef, 0x22, 0x98, 0x9f, 0xc6, - 0x87, 0xbe, 0xfa, 0x13, 0x00, 0x00, 0xff, 0xff, 0xbd, 0xc4, 0xfa, 0xf8, 0x70, 0x02, 0x00, 0x00, + 0x14, 0x76, 0x5a, 0xef, 0xcf, 0xe4, 0x2a, 0x5e, 0xa2, 0xe8, 0x30, 0x17, 0x4b, 0x75, 0x35, 0x9b, + 0x26, 0x90, 0xeb, 0x4e, 0x5c, 0x54, 0x45, 0x2c, 0x88, 0x96, 0x08, 0x2e, 0xdc, 0x94, 0x34, 0x3d, + 0x6d, 0x83, 0xd3, 0x24, 0x24, 0x69, 0xa4, 0x6f, 0xe2, 0x33, 0xf8, 0x24, 0x2e, 0x7d, 0x04, 0xa9, + 0xcf, 0xe0, 0x5e, 0x26, 0xb5, 0x63, 0xa5, 0xee, 0xe6, 0x9c, 0xef, 0xfb, 0xce, 0xf9, 0xce, 0x37, + 0x41, 0x0f, 0x23, 0xa3, 0xd2, 0xe8, 0x20, 0x94, 0x06, 0x47, 0x17, 0xce, 0x4a, 0x1a, 0x36, 0x16, + 0x3c, 0xb1, 0xce, 0x04, 0x83, 0xef, 0x6a, 0x30, 0x64, 0xee, 0x49, 0x64, 0xa4, 0x65, 0x95, 0x65, + 0x64, 0x54, 0x43, 0x58, 0x09, 0x7b, 0x24, 0x28, 0x8b, 0xc8, 0xa8, 0x83, 0xb9, 0x3f, 0x46, 0xae, + 0x22, 0xa3, 0x1e, 0x5c, 0x54, 0x12, 0x8e, 0xc0, 0xc7, 0xbf, 0x3a, 0x28, 0x7f, 0xb1, 0x5f, 0x80, + 0x9f, 0xa0, 0xb3, 0x08, 0xce, 0x2b, 0xa3, 0x8b, 0xac, 0x9f, 0x55, 0x17, 0xac, 0x24, 0x7f, 0x7d, + 0xfc, 0x99, 0x41, 0x3e, 0xec, 0x18, 0x7c, 0x4f, 0xc5, 0x0c, 0x9d, 0x9b, 0xcf, 0x1a, 0xdc, 0x44, + 0xcd, 0x8a, 0x4e, 0x92, 0x3d, 0x38, 0x90, 0x35, 0xa6, 0xc8, 0xbb, 0x06, 0x1f, 0xbd, 0xe4, 0x67, + 0x89, 0x38, 0x9a, 0xe1, 0x7b, 0xe8, 0x44, 0x1b, 0x2d, 0xa1, 0xe8, 0xf6, 0xb3, 0xea, 0x16, 0xdf, + 0x15, 0xf8, 0x0a, 0xe5, 0x53, 0xe1, 0x95, 0x9c, 0x08, 0x59, 0x17, 0x37, 0xfb, 0x59, 0x75, 0x9b, + 0x9f, 0xa7, 0xc6, 0x50, 0xd6, 0xf8, 0x35, 0x42, 0x22, 0x04, 0xa7, 0xa6, 0xeb, 0x00, 0xbe, 0x38, + 0xe9, 0x77, 0xab, 0x0b, 0x56, 0x91, 0xff, 0xe4, 0x44, 0xda, 0x83, 0xc8, 0x70, 0x2f, 0xe0, 0x07, + 0x5a, 0xfc, 0x06, 0x5d, 0xda, 0x5a, 0x48, 0x58, 0x81, 0x0e, 0x13, 0x6b, 0x6a, 0x25, 0x37, 0xc5, + 0x69, 0x32, 0xfe, 0xe8, 0x60, 0xde, 0x2e, 0x69, 0x32, 0xde, 0x33, 0xc7, 0x89, 0xc8, 0xef, 0xd8, + 0x7f, 0x1b, 0xe5, 0x35, 0xca, 0xdb, 0x35, 0xf8, 0x12, 0x75, 0x3f, 0xc1, 0x26, 0xa5, 0x97, 0xf3, + 0xe6, 0xb3, 0xb9, 0x34, 0x8a, 0x7a, 0x0d, 0x29, 0x9a, 0x9c, 0xef, 0x8a, 0xe7, 0xcb, 0x6f, 0xdb, + 0x5e, 0xf6, 0x7d, 0xdb, 0xcb, 0x7e, 0x6c, 0x7b, 0xd9, 0x97, 0x9f, 0xbd, 0x1b, 0x1f, 0x9f, 0x2d, + 0x54, 0x58, 0xae, 0xa7, 0x44, 0x9a, 0x15, 0xd5, 0xde, 0x4a, 0x39, 0x98, 0x41, 0xa4, 0x1a, 0xcc, + 0xdc, 0x0f, 0x84, 0x55, 0x83, 0x85, 0xa1, 0x47, 0x4f, 0xe6, 0x69, 0x5b, 0x7e, 0xed, 0xdc, 0x7f, + 0x0b, 0xe6, 0xd5, 0x7b, 0x32, 0x1c, 0x8f, 0x1a, 0xf3, 0x6d, 0x04, 0xd3, 0xd3, 0xf4, 0xa3, 0xaf, + 0x7f, 0x07, 0x00, 0x00, 0xff, 0xff, 0x17, 0x73, 0x67, 0xd0, 0x71, 0x02, 0x00, 0x00, } func (m *Container) Marshal() (dAtA []byte, err error) { diff --git a/v2/container/types.go b/v2/container/types.go index 80dbcbf..033273f 100644 --- a/v2/container/types.go +++ b/v2/container/types.go @@ -28,9 +28,7 @@ type Container struct { type PutRequestBody struct { cnr *Container - pubKey []byte - - sig []byte + sig *service.Signature } type PutRequest struct { @@ -80,7 +78,7 @@ type GetResponse struct { type DeleteRequestBody struct { cid *refs.ContainerID - sig []byte + sig *service.Signature } type DeleteRequest struct { @@ -128,7 +126,7 @@ type ListResponse struct { type SetExtendedACLRequestBody struct { eacl *acl.Table - sig []byte + sig *service.Signature } type SetExtendedACLRequest struct { @@ -164,7 +162,7 @@ type GetExtendedACLRequest struct { type GetExtendedACLResponseBody struct { eacl *acl.Table - sig []byte + sig *service.Signature } type GetExtendedACLResponse struct { @@ -301,21 +299,7 @@ func (r *PutRequestBody) SetContainer(v *Container) { } } -func (r *PutRequestBody) GetPublicKey() []byte { - if r != nil { - return r.pubKey - } - - return nil -} - -func (r *PutRequestBody) SetPublicKey(v []byte) { - if r != nil { - r.pubKey = v - } -} - -func (r *PutRequestBody) GetSignature() []byte { +func (r *PutRequestBody) GetSignature() *service.Signature { if r != nil { return r.sig } @@ -323,7 +307,7 @@ func (r *PutRequestBody) GetSignature() []byte { return nil } -func (r *PutRequestBody) SetSignature(v []byte) { +func (r *PutRequestBody) SetSignature(v *service.Signature) { if r != nil { r.sig = v } @@ -553,7 +537,7 @@ func (r *DeleteRequestBody) SetContainerID(v *refs.ContainerID) { } } -func (r *DeleteRequestBody) GetSignature() []byte { +func (r *DeleteRequestBody) GetSignature() *service.Signature { if r != nil { return r.sig } @@ -561,7 +545,7 @@ func (r *DeleteRequestBody) GetSignature() []byte { return nil } -func (r *DeleteRequestBody) SetSignature(v []byte) { +func (r *DeleteRequestBody) SetSignature(v *service.Signature) { if r != nil { r.sig = v } @@ -777,7 +761,7 @@ func (r *SetExtendedACLRequestBody) SetEACL(v *acl.Table) { } } -func (r *SetExtendedACLRequestBody) GetSignature() []byte { +func (r *SetExtendedACLRequestBody) GetSignature() *service.Signature { if r != nil { return r.sig } @@ -785,7 +769,7 @@ func (r *SetExtendedACLRequestBody) GetSignature() []byte { return nil } -func (r *SetExtendedACLRequestBody) SetSignature(v []byte) { +func (r *SetExtendedACLRequestBody) SetSignature(v *service.Signature) { if r != nil { r.sig = v } @@ -945,7 +929,7 @@ func (r *GetExtendedACLResponseBody) SetEACL(v *acl.Table) { } } -func (r *GetExtendedACLResponseBody) GetSignature() []byte { +func (r *GetExtendedACLResponseBody) GetSignature() *service.Signature { if r != nil { return r.sig } @@ -953,7 +937,7 @@ func (r *GetExtendedACLResponseBody) GetSignature() []byte { return nil } -func (r *GetExtendedACLResponseBody) SetSignature(v []byte) { +func (r *GetExtendedACLResponseBody) SetSignature(v *service.Signature) { if r != nil { r.sig = v } diff --git a/v2/object/convert.go b/v2/object/convert.go index 0517efa..69df798 100644 --- a/v2/object/convert.go +++ b/v2/object/convert.go @@ -758,10 +758,6 @@ func DeleteRequestBodyToGRPCMessage(r *DeleteRequestBody) *object.DeleteRequest_ refs.AddressToGRPCMessage(r.GetAddress()), ) - m.SetOwnerId( - refs.OwnerIDToGRPCMessage(r.GetOwnerID()), - ) - return m } @@ -776,10 +772,6 @@ func DeleteRequestBodyFromGRPCMessage(m *object.DeleteRequest_Body) *DeleteReque refs.AddressFromGRPCMessage(m.GetAddress()), ) - r.SetOwnerID( - refs.OwnerIDFromGRPCMessage(m.GetOwnerId()), - ) - return r } diff --git a/v2/object/grpc/service.go b/v2/object/grpc/service.go index 09e058a..3ec97fc 100644 --- a/v2/object/grpc/service.go +++ b/v2/object/grpc/service.go @@ -230,13 +230,6 @@ func (m *DeleteRequest_Body) SetAddress(v *refs.Address) { } } -// SetOwnerId sets identifier of the removing object owner. -func (m *DeleteRequest_Body) SetOwnerId(v *refs.OwnerID) { - if m != nil { - m.OwnerId = v - } -} - // SetBody sets body of the request. func (m *DeleteRequest) SetBody(v *DeleteRequest_Body) { if m != nil { diff --git a/v2/object/grpc/service.pb.go b/v2/object/grpc/service.pb.go index 5a398c6..4b3964d 100644 --- a/v2/object/grpc/service.pb.go +++ b/v2/object/grpc/service.pb.go @@ -815,9 +815,7 @@ func (m *DeleteRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { // Request body type DeleteRequest_Body struct { // Carries the address of the object to be deleted. - Address *grpc1.Address `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` - // Carries identifier the object owner. - OwnerId *grpc1.OwnerID `protobuf:"bytes,2,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"` + Address *grpc1.Address `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -863,13 +861,6 @@ func (m *DeleteRequest_Body) GetAddress() *grpc1.Address { return nil } -func (m *DeleteRequest_Body) GetOwnerId() *grpc1.OwnerID { - if m != nil { - return m.OwnerId - } - return nil -} - // DeleteResponse is empty because we cannot guarantee permanent object removal // in distributed system. type DeleteResponse struct { @@ -2199,86 +2190,84 @@ func init() { func init() { proto.RegisterFile("v2/object/grpc/service.proto", fileDescriptor_1d7d92b1e85e5b48) } var fileDescriptor_1d7d92b1e85e5b48 = []byte{ - // 1258 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x58, 0x4d, 0x6f, 0x1b, 0x45, - 0x18, 0xce, 0xae, 0x37, 0x8e, 0xfd, 0xda, 0x0e, 0xd1, 0x34, 0x2a, 0x96, 0xf3, 0x41, 0xba, 0x69, - 0xd2, 0x88, 0x92, 0x75, 0x30, 0x2a, 0xa1, 0x29, 0x2d, 0x6a, 0x48, 0xd2, 0x58, 0x25, 0x4d, 0x58, - 0x23, 0x0e, 0x48, 0xc8, 0xda, 0xec, 0x8e, 0xed, 0x05, 0x7b, 0xd7, 0xec, 0xac, 0x5d, 0xf9, 0xc2, - 0x11, 0x89, 0x5f, 0x40, 0xc5, 0x01, 0x21, 0x8e, 0xe5, 0xc6, 0x0f, 0xe0, 0x0c, 0xb7, 0xc2, 0x2f, - 0x40, 0xe1, 0x8a, 0xd4, 0x5f, 0x00, 0x42, 0xf3, 0xb1, 0xb6, 0xd7, 0xf1, 0x97, 0x72, 0xdb, 0xde, - 0xe6, 0xe3, 0x79, 0xdf, 0x9d, 0xf7, 0x99, 0x67, 0xde, 0x79, 0x67, 0x61, 0xb9, 0x5d, 0xc8, 0xbb, - 0xe7, 0x5f, 0x60, 0xd3, 0xcf, 0x57, 0xbd, 0xa6, 0x99, 0x27, 0xd8, 0x6b, 0xdb, 0x26, 0xd6, 0x9a, - 0x9e, 0xeb, 0xbb, 0x68, 0xc1, 0xc1, 0xae, 0x56, 0x21, 0x5a, 0xbb, 0xa0, 0x71, 0x50, 0x2e, 0x37, - 0x80, 0xf7, 0x3b, 0x4d, 0x4c, 0x38, 0x3a, 0x97, 0x6d, 0x17, 0xf2, 0x1e, 0xae, 0x90, 0xcb, 0x33, - 0xd4, 0x4a, 0x78, 0xe6, 0x93, 0x0d, 0xec, 0x1b, 0x62, 0x6e, 0x79, 0x70, 0xae, 0x8d, 0x3d, 0xbb, - 0xd2, 0xe1, 0xb3, 0xea, 0x73, 0x19, 0xe0, 0x11, 0xf6, 0x75, 0xfc, 0x55, 0x0b, 0x13, 0x1f, 0xdd, - 0x01, 0xe5, 0xdc, 0xb5, 0x3a, 0x59, 0x69, 0x4d, 0xda, 0x4a, 0x15, 0x6e, 0x68, 0x83, 0xeb, 0xd3, - 0x7a, 0x58, 0x6d, 0xdf, 0xb5, 0x3a, 0x3a, 0x83, 0xa3, 0x43, 0x48, 0xd1, 0x2f, 0x96, 0x6b, 0xd8, - 0xb0, 0xb0, 0x97, 0x95, 0x99, 0xf5, 0xcd, 0x3e, 0xeb, 0x20, 0x6c, 0x61, 0x7b, 0x82, 0x7d, 0xe3, - 0x98, 0x61, 0x75, 0x68, 0x74, 0xdb, 0xe8, 0x63, 0xc8, 0xf0, 0xc5, 0x05, 0x8e, 0x62, 0xcc, 0xd1, - 0x5b, 0xa3, 0x1d, 0x7d, 0x4a, 0xe1, 0xb6, 0x69, 0xf8, 0xb6, 0xeb, 0x08, 0x87, 0x69, 0xee, 0x82, - 0xf7, 0x72, 0x8f, 0x41, 0xa1, 0xeb, 0x44, 0x6f, 0xc3, 0x9c, 0x61, 0x59, 0x1e, 0x26, 0x44, 0xc4, - 0xf6, 0x7a, 0x9f, 0x53, 0x4a, 0xaa, 0xf6, 0x90, 0x4f, 0xeb, 0x01, 0x0e, 0x2d, 0x40, 0xcc, 0x33, - 0x9e, 0xb2, 0x60, 0x12, 0x3a, 0x6d, 0xaa, 0xff, 0xc5, 0x20, 0xc5, 0x08, 0x20, 0x4d, 0xd7, 0x21, - 0x18, 0xbd, 0x1b, 0x62, 0x4b, 0x1d, 0xc1, 0x16, 0x07, 0xf7, 0xd3, 0x75, 0x34, 0x8c, 0xae, 0x8d, - 0xa1, 0x51, 0x72, 0xe3, 0x11, 0x7c, 0xe9, 0xc3, 0xf9, 0xda, 0x1e, 0xe3, 0x69, 0x22, 0x61, 0xdf, - 0xcb, 0x82, 0xb1, 0xfb, 0xa0, 0xd8, 0x8e, 0xed, 0x8b, 0xe0, 0x6e, 0x4d, 0x0e, 0x4e, 0x2b, 0x3a, - 0xb6, 0x7f, 0x3c, 0xa3, 0x33, 0x33, 0x74, 0x1d, 0x66, 0xcd, 0x5a, 0xcb, 0xf9, 0x92, 0x45, 0x97, - 0x3e, 0x9e, 0xd1, 0x79, 0x37, 0xf7, 0xb3, 0x04, 0x0a, 0x05, 0xa2, 0x3b, 0x90, 0xe4, 0x8e, 0xca, - 0xb6, 0x25, 0x3e, 0x92, 0x1d, 0xdc, 0x93, 0x53, 0x06, 0x28, 0x1e, 0xe8, 0x09, 0x0e, 0x2d, 0x5a, - 0x68, 0x0f, 0x92, 0xc4, 0xae, 0x3a, 0x86, 0xdf, 0xf2, 0xb0, 0x60, 0x6e, 0x79, 0x48, 0xbc, 0xa5, - 0x00, 0xa3, 0xf7, 0xe0, 0x68, 0x07, 0xe2, 0x21, 0xa2, 0xb2, 0x97, 0x83, 0x12, 0x9c, 0x08, 0xdc, - 0x7e, 0x06, 0x52, 0x62, 0x91, 0x4d, 0xc3, 0xf3, 0xd5, 0x1f, 0x14, 0x80, 0xb3, 0xd6, 0xf4, 0xa7, - 0xa5, 0x87, 0x8d, 0xc6, 0x69, 0xf9, 0x35, 0xd8, 0xfc, 0xf7, 0x43, 0x9b, 0xbf, 0x39, 0x31, 0xb2, - 0xe9, 0xf6, 0xfe, 0x45, 0x94, 0xf6, 0x1e, 0xad, 0x43, 0xc6, 0x74, 0x9b, 0x36, 0x26, 0x65, 0xa7, - 0xd5, 0x38, 0xc7, 0x5e, 0x56, 0x59, 0x93, 0xb6, 0x32, 0x7a, 0x9a, 0x0f, 0x3e, 0x61, 0x63, 0x83, - 0x02, 0xf9, 0x51, 0x86, 0x14, 0xa3, 0x66, 0xda, 0x0c, 0xd1, 0x07, 0x8e, 0x4a, 0x86, 0xb8, 0x2f, - 0x34, 0x72, 0xb5, 0x4d, 0x54, 0xff, 0x94, 0x21, 0x73, 0x80, 0xeb, 0xd8, 0xc7, 0xc1, 0x31, 0x7a, - 0x2f, 0x44, 0xd2, 0xcd, 0xcb, 0x24, 0x85, 0xe0, 0xd1, 0x38, 0x49, 0x8d, 0xab, 0xdf, 0x3b, 0x05, - 0x48, 0xb8, 0x4f, 0x1d, 0xec, 0x51, 0x5a, 0xe5, 0xe1, 0x36, 0xa7, 0x74, 0xbe, 0x78, 0xa0, 0xcf, - 0x31, 0x60, 0xd1, 0x52, 0x5f, 0x4a, 0x30, 0x1f, 0xb0, 0x24, 0xa4, 0x77, 0x37, 0xc4, 0xea, 0xc6, - 0x68, 0x56, 0xa3, 0xa5, 0xbe, 0x38, 0x27, 0x56, 0xfd, 0x5d, 0x86, 0x14, 0x1d, 0x0a, 0x44, 0x34, - 0xf1, 0xa4, 0xf5, 0x81, 0xa3, 0x21, 0xa1, 0xda, 0xd5, 0x25, 0xb4, 0x04, 0xc9, 0x86, 0x61, 0x3b, - 0x65, 0xd7, 0xa9, 0x77, 0x44, 0x01, 0x93, 0xa0, 0x03, 0xa7, 0x4e, 0xbd, 0x13, 0xd4, 0x35, 0xb1, - 0x5e, 0x5d, 0xf3, 0x8f, 0x0c, 0x69, 0x4e, 0x8f, 0xd0, 0xce, 0x6e, 0x88, 0xcc, 0xf5, 0x51, 0x64, - 0x46, 0x4b, 0x39, 0xdf, 0x48, 0x82, 0xd0, 0x42, 0xf7, 0x2a, 0x90, 0xc6, 0x5f, 0x05, 0xc7, 0x33, - 0xdd, 0xcb, 0x60, 0x1f, 0xd2, 0xa4, 0xe6, 0x7a, 0x7e, 0x38, 0xb2, 0x95, 0xcb, 0x96, 0x25, 0x8a, - 0xea, 0x9a, 0xa7, 0x48, 0xaf, 0xbb, 0x1f, 0x07, 0x85, 0x5a, 0xab, 0xff, 0xc6, 0x20, 0x53, 0xc2, - 0x86, 0x67, 0xd6, 0xa6, 0xce, 0x80, 0x21, 0x78, 0x34, 0xe4, 0xfb, 0x5d, 0x50, 0x4b, 0x3c, 0x80, - 0xb4, 0xe9, 0x3a, 0xbe, 0x61, 0x8b, 0x9c, 0xc6, 0x83, 0x5c, 0x1a, 0x14, 0xf1, 0x87, 0x01, 0xa6, - 0x78, 0xa0, 0xa7, 0xba, 0x06, 0x45, 0x0b, 0x65, 0x61, 0xae, 0x8d, 0x3d, 0x62, 0xbb, 0x0e, 0x0b, - 0x2f, 0xa3, 0x07, 0x5d, 0x74, 0x08, 0x73, 0x15, 0xbb, 0xee, 0x63, 0x8f, 0x64, 0x63, 0x6b, 0xb1, - 0xad, 0x54, 0xe1, 0xf6, 0x34, 0xcc, 0x69, 0x47, 0xcc, 0x46, 0x0f, 0x6c, 0x73, 0x0e, 0xc4, 0xf9, - 0x10, 0xda, 0x03, 0x68, 0x18, 0xbe, 0x59, 0x2b, 0xd3, 0xc7, 0x15, 0x5b, 0xe8, 0x7c, 0x68, 0xa1, - 0xc2, 0xe7, 0x09, 0xc5, 0x7c, 0xd2, 0x69, 0x62, 0x3d, 0xd9, 0x08, 0x9a, 0x08, 0x81, 0xe2, 0x18, - 0x0d, 0x5e, 0x97, 0x24, 0x75, 0xd6, 0x46, 0x8b, 0x30, 0xdb, 0x36, 0xea, 0x2d, 0xcc, 0xe8, 0x4c, - 0xea, 0xbc, 0xa3, 0xfe, 0x24, 0xc3, 0x7c, 0xb0, 0xac, 0x69, 0x93, 0x75, 0x18, 0x1f, 0x95, 0x23, - 0x77, 0xb7, 0x97, 0xc2, 0x6c, 0xab, 0x5c, 0xb7, 0x09, 0xad, 0x28, 0x63, 0x63, 0x0b, 0x85, 0xb8, - 0x6d, 0x7d, 0x64, 0x13, 0x5f, 0xdd, 0x85, 0x59, 0xdd, 0x70, 0xaa, 0x18, 0x5d, 0x87, 0xb8, 0x5b, - 0xa9, 0x10, 0xcc, 0x8b, 0x51, 0x45, 0x17, 0x3d, 0x3a, 0x5e, 0xc7, 0x4e, 0xd5, 0xaf, 0xb1, 0x90, - 0x15, 0x5d, 0xf4, 0xd4, 0x3f, 0x64, 0x78, 0x8d, 0x3e, 0x4d, 0xa8, 0x71, 0x70, 0xbe, 0xf6, 0x42, - 0xf4, 0x6e, 0x0e, 0x7f, 0xcb, 0xf4, 0x19, 0xbc, 0xf2, 0x17, 0xc4, 0x36, 0xcc, 0x7a, 0x34, 0xde, - 0x21, 0x05, 0x86, 0x60, 0x84, 0xd3, 0xc1, 0x51, 0xea, 0xb7, 0x32, 0x2c, 0xf4, 0x28, 0x12, 0x9a, - 0xbd, 0x17, 0x22, 0xf5, 0xd6, 0x38, 0x52, 0xa3, 0xa5, 0xda, 0x65, 0xc1, 0xeb, 0x62, 0xf0, 0x8c, - 0xa1, 0x11, 0xa6, 0xc5, 0x23, 0x46, 0x7d, 0x29, 0xc3, 0xb5, 0x20, 0xb2, 0x63, 0x83, 0x74, 0x73, - 0xf8, 0x83, 0x10, 0x1d, 0x6f, 0x8e, 0xa6, 0xa3, 0xcf, 0x28, 0x1a, 0x3a, 0xfb, 0xfa, 0xea, 0x3a, - 0xcb, 0x43, 0x9c, 0x29, 0x88, 0x64, 0x65, 0x76, 0xee, 0x47, 0x0a, 0x4d, 0xc0, 0x68, 0x16, 0x25, - 0x46, 0xdd, 0x67, 0xab, 0x4e, 0xeb, 0xac, 0xad, 0x3e, 0x93, 0x61, 0x31, 0x4c, 0x9e, 0x50, 0xe0, - 0x07, 0x21, 0xca, 0x6f, 0x4f, 0xa2, 0x3c, 0x5a, 0x2a, 0x5c, 0x17, 0xac, 0x2f, 0x41, 0xb2, 0x66, - 0x90, 0x5a, 0x2f, 0x7b, 0xa6, 0xf5, 0x04, 0x1d, 0xa0, 0x59, 0xb2, 0xf0, 0x8b, 0x02, 0x19, 0x9e, - 0x3a, 0x4b, 0xdc, 0x3f, 0x3a, 0x80, 0xd8, 0x23, 0xec, 0xa3, 0xe5, 0x71, 0xbf, 0xee, 0x72, 0x2b, - 0x63, 0xff, 0xe6, 0xec, 0x48, 0xd4, 0xcb, 0x59, 0x6b, 0xa8, 0x97, 0xde, 0xc3, 0x7f, 0x98, 0x97, - 0xbe, 0xe7, 0xec, 0x96, 0x84, 0x1e, 0x43, 0x9c, 0x3f, 0x32, 0xd0, 0x1b, 0x13, 0x1e, 0x75, 0xb9, - 0xb5, 0x49, 0xef, 0x13, 0x74, 0x08, 0x0a, 0x65, 0x06, 0xad, 0x8c, 0x2d, 0xed, 0x73, 0xab, 0xe3, - 0x8b, 0x55, 0x74, 0x02, 0x71, 0x7e, 0x97, 0x0e, 0x5b, 0x53, 0xa8, 0x58, 0x18, 0xb6, 0xa6, 0xf0, - 0x35, 0xbc, 0x23, 0xa1, 0x12, 0x24, 0x02, 0x91, 0xa1, 0x1b, 0x13, 0xef, 0x95, 0x9c, 0x3a, 0x39, - 0x4b, 0xee, 0x48, 0xe8, 0x73, 0x48, 0xf7, 0x2b, 0x17, 0x6d, 0x4c, 0x95, 0x4c, 0x72, 0x9b, 0xd3, - 0x1d, 0x80, 0xfd, 0xf2, 0x6f, 0x17, 0xab, 0xd2, 0x8b, 0x8b, 0x55, 0xe9, 0xaf, 0x8b, 0x55, 0xe9, - 0xd9, 0xdf, 0xab, 0x33, 0x9f, 0xed, 0x56, 0x6d, 0xbf, 0xd6, 0x3a, 0xd7, 0x4c, 0xb7, 0x91, 0x77, - 0x48, 0xd3, 0x34, 0xb7, 0x2d, 0xdc, 0xce, 0x3b, 0xd8, 0xad, 0x90, 0x6d, 0xa3, 0x69, 0x6f, 0x57, - 0xdd, 0x7c, 0xf8, 0xbf, 0xf4, 0x3d, 0xde, 0x7e, 0x2e, 0x5f, 0x7b, 0x82, 0xdd, 0xa3, 0x92, 0xf6, - 0xf0, 0xac, 0x48, 0xbf, 0xca, 0xa5, 0x78, 0x1e, 0x67, 0xff, 0x96, 0xdf, 0xf9, 0x3f, 0x00, 0x00, - 0xff, 0xff, 0x89, 0x37, 0x38, 0x06, 0xfd, 0x16, 0x00, 0x00, + // 1231 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x58, 0x5d, 0x6f, 0x1b, 0x45, + 0x17, 0xce, 0xae, 0x37, 0x4e, 0x7c, 0x6c, 0xe7, 0x8d, 0xa6, 0x51, 0x6b, 0x39, 0x1f, 0x6f, 0xba, + 0x69, 0xd2, 0x88, 0x92, 0x75, 0x30, 0x2a, 0xa1, 0x29, 0x2d, 0x6a, 0x48, 0xd2, 0x58, 0x25, 0x6d, + 0x58, 0x23, 0x2e, 0x90, 0x90, 0xb5, 0x59, 0x8f, 0xed, 0x05, 0x7b, 0xd7, 0xec, 0x8c, 0x8d, 0x7c, + 0xc3, 0x25, 0x12, 0xbf, 0x80, 0x8a, 0x8b, 0x0a, 0x71, 0x59, 0xee, 0xf8, 0x01, 0x5c, 0xc3, 0x5d, + 0xf9, 0x07, 0x28, 0xdc, 0x22, 0xf5, 0x17, 0x80, 0xd0, 0x7c, 0xac, 0xed, 0x8d, 0x3f, 0x95, 0xbb, + 0xe5, 0x6e, 0x66, 0xfc, 0x9c, 0xe3, 0x39, 0xcf, 0x3c, 0x73, 0xe6, 0x9c, 0x85, 0x95, 0x76, 0x3e, + 0xe7, 0x9d, 0x7f, 0x8e, 0x6d, 0x9a, 0xab, 0xfa, 0x4d, 0x3b, 0x47, 0xb0, 0xdf, 0x76, 0x6c, 0x6c, + 0x34, 0x7d, 0x8f, 0x7a, 0x68, 0xd1, 0xc5, 0x9e, 0x51, 0x21, 0x46, 0x3b, 0x6f, 0x08, 0x50, 0x36, + 0x7b, 0x09, 0x4f, 0x3b, 0x4d, 0x4c, 0x04, 0x3a, 0x9b, 0x69, 0xe7, 0x73, 0x3e, 0xae, 0x90, 0xc1, + 0x5f, 0x96, 0xdb, 0xf9, 0xc0, 0xf3, 0xc0, 0x8f, 0xfa, 0x4b, 0x15, 0xe0, 0x31, 0xa6, 0x26, 0xfe, + 0xb2, 0x85, 0x09, 0x45, 0x77, 0x41, 0x3b, 0xf7, 0xca, 0x9d, 0x8c, 0xb2, 0xae, 0x6c, 0x27, 0xf3, + 0x37, 0x8d, 0xcb, 0x5b, 0x30, 0x7a, 0x58, 0xe3, 0xc0, 0x2b, 0x77, 0x4c, 0x0e, 0x47, 0x47, 0x90, + 0x6c, 0x60, 0x6a, 0x95, 0x6a, 0xd8, 0x2a, 0x63, 0x3f, 0xa3, 0x72, 0xeb, 0x5b, 0x7d, 0xd6, 0x41, + 0x64, 0xd2, 0xf6, 0x14, 0x53, 0xeb, 0x84, 0x63, 0x4d, 0x68, 0x74, 0xc7, 0xe8, 0x23, 0x48, 0xb7, + 0xb1, 0xef, 0x54, 0x3a, 0x81, 0xa3, 0x18, 0x77, 0xf4, 0xe6, 0x68, 0x47, 0x9f, 0x30, 0xb8, 0x63, + 0x5b, 0xd4, 0xf1, 0x5c, 0xe9, 0x30, 0x25, 0x5c, 0x88, 0x59, 0xf6, 0x09, 0x68, 0x6c, 0x9f, 0xe8, + 0x2d, 0x98, 0xb3, 0xca, 0x65, 0x1f, 0x13, 0x22, 0x63, 0xbb, 0xd1, 0xe7, 0x94, 0xf1, 0x66, 0x3c, + 0x12, 0x3f, 0x9b, 0x01, 0x0e, 0x2d, 0x42, 0xcc, 0xb7, 0xbe, 0xe2, 0xc1, 0xcc, 0x9b, 0x6c, 0xa8, + 0xff, 0x13, 0x83, 0x24, 0x27, 0x80, 0x34, 0x3d, 0x97, 0x60, 0xf4, 0x4e, 0x88, 0x2d, 0x7d, 0x04, + 0x5b, 0x02, 0xdc, 0x4f, 0xd7, 0xf1, 0x30, 0xba, 0x36, 0x87, 0x46, 0x29, 0x8c, 0x47, 0xf0, 0x65, + 0x0e, 0xe7, 0x6b, 0x67, 0x8c, 0xa7, 0x89, 0x84, 0x7d, 0xaf, 0x4a, 0xc6, 0x1e, 0x80, 0xe6, 0xb8, + 0x0e, 0x95, 0xc1, 0xdd, 0x9e, 0x1c, 0x9c, 0x51, 0x70, 0x1d, 0x7a, 0x32, 0x63, 0x72, 0x33, 0x74, + 0x1d, 0x66, 0xed, 0x5a, 0xcb, 0xfd, 0x82, 0x47, 0x97, 0x3a, 0x99, 0x31, 0xc5, 0x34, 0xfb, 0x93, + 0x02, 0x1a, 0x03, 0xa2, 0xbb, 0x90, 0x10, 0x8e, 0x4a, 0x4e, 0x59, 0xfe, 0x49, 0xe6, 0xf2, 0x99, + 0x3c, 0xe3, 0x80, 0xc2, 0xa1, 0x39, 0x2f, 0xa0, 0x85, 0x32, 0xda, 0x87, 0x04, 0x71, 0xaa, 0xae, + 0x45, 0x5b, 0x3e, 0x96, 0xcc, 0xad, 0x0c, 0x89, 0xb7, 0x18, 0x60, 0xcc, 0x1e, 0x1c, 0xed, 0x42, + 0x3c, 0x44, 0x54, 0x66, 0x30, 0x28, 0xc9, 0x89, 0xc4, 0x1d, 0xa4, 0x21, 0x29, 0x37, 0xd9, 0xb4, + 0x7c, 0xaa, 0xbf, 0xd0, 0x00, 0xce, 0x5a, 0xd3, 0xdf, 0x96, 0x1e, 0x36, 0x1a, 0xb7, 0xe5, 0x97, + 0xe0, 0xf0, 0xdf, 0x0b, 0x1d, 0xfe, 0xd6, 0xc4, 0xc8, 0xa6, 0x3b, 0xfb, 0x57, 0x51, 0x3a, 0x7b, + 0xb4, 0x01, 0x69, 0xdb, 0x6b, 0x3a, 0x98, 0x94, 0xdc, 0x56, 0xe3, 0x1c, 0xfb, 0x19, 0x6d, 0x5d, + 0xd9, 0x4e, 0x9b, 0x29, 0xb1, 0xf8, 0x94, 0xaf, 0x5d, 0x16, 0xc8, 0x0f, 0x2a, 0x24, 0x39, 0x35, + 0xd3, 0x66, 0x88, 0x3e, 0x70, 0x54, 0x32, 0xc4, 0x03, 0xa9, 0x91, 0xab, 0x1d, 0xa2, 0xfe, 0x42, + 0x85, 0xf4, 0x21, 0xae, 0x63, 0x8a, 0x83, 0x6b, 0xf4, 0x6e, 0x88, 0xa4, 0x5b, 0x83, 0x24, 0x85, + 0xe0, 0xd1, 0xb8, 0x49, 0xf7, 0xae, 0xfc, 0xee, 0xe8, 0xaf, 0x15, 0x58, 0x08, 0x22, 0x96, 0x32, + 0xba, 0x17, 0x62, 0x68, 0x73, 0x34, 0x43, 0xd1, 0x52, 0x52, 0x5c, 0x90, 0xa4, 0xff, 0xa6, 0x42, + 0x92, 0x2d, 0x05, 0x82, 0x98, 0x78, 0x6b, 0xfa, 0xc0, 0xd1, 0x90, 0x43, 0xed, 0xea, 0x65, 0xc8, + 0x32, 0x24, 0x1a, 0x96, 0xe3, 0x96, 0x3c, 0xb7, 0xde, 0x91, 0xc5, 0xc8, 0x3c, 0x5b, 0x78, 0xe6, + 0xd6, 0x3b, 0x41, 0x8d, 0x12, 0xeb, 0xd5, 0x28, 0x7f, 0xa9, 0x90, 0x12, 0xf4, 0x48, 0xed, 0xec, + 0x85, 0xc8, 0xdc, 0x18, 0x45, 0x66, 0xb4, 0x94, 0xf3, 0x8d, 0x22, 0x09, 0xcd, 0x77, 0xd3, 0xba, + 0x32, 0x3e, 0xad, 0x9f, 0xcc, 0x74, 0x13, 0xfb, 0x01, 0xa4, 0x48, 0xcd, 0xf3, 0x69, 0x38, 0xb2, + 0xd5, 0x41, 0xcb, 0x22, 0x43, 0x75, 0xcd, 0x93, 0xa4, 0x37, 0x3d, 0x88, 0x83, 0xc6, 0xac, 0xf5, + 0xbf, 0x63, 0x90, 0x2e, 0x62, 0xcb, 0xb7, 0x6b, 0x53, 0x67, 0xb3, 0x10, 0x3c, 0x1a, 0xf2, 0xfd, + 0x2e, 0xa8, 0x0b, 0x1e, 0x42, 0xca, 0xf6, 0x5c, 0x6a, 0x39, 0x2e, 0xf6, 0x7b, 0x69, 0x7f, 0xf9, + 0xb2, 0x88, 0x3f, 0x08, 0x30, 0x85, 0x43, 0x33, 0xd9, 0x35, 0x28, 0x94, 0x51, 0x06, 0xe6, 0xda, + 0xd8, 0x27, 0x8e, 0xe7, 0xf2, 0xf0, 0xd2, 0x66, 0x30, 0x45, 0x47, 0x30, 0x57, 0x71, 0xea, 0x14, + 0xfb, 0x24, 0x13, 0x5b, 0x8f, 0x6d, 0x27, 0xf3, 0x77, 0xa6, 0x61, 0xce, 0x38, 0xe6, 0x36, 0x66, + 0x60, 0x9b, 0x75, 0x21, 0x2e, 0x96, 0xd0, 0x3e, 0x40, 0xc3, 0xa2, 0x76, 0xad, 0xc4, 0xda, 0x1d, + 0xbe, 0xd1, 0x85, 0xd0, 0x46, 0xa5, 0xcf, 0x53, 0x86, 0xf9, 0xb8, 0xd3, 0xc4, 0x66, 0xa2, 0x11, + 0x0c, 0x11, 0x02, 0xcd, 0xb5, 0x1a, 0xa2, 0xc6, 0x48, 0x98, 0x7c, 0x8c, 0x96, 0x60, 0xb6, 0x6d, + 0xd5, 0x5b, 0x98, 0xd3, 0x99, 0x30, 0xc5, 0x44, 0xff, 0x51, 0x85, 0x85, 0x60, 0x5b, 0xd3, 0x26, + 0xeb, 0x30, 0x3e, 0x2a, 0x57, 0xae, 0xef, 0x45, 0x73, 0xca, 0xa5, 0xba, 0x43, 0x58, 0x75, 0x18, + 0x1b, 0xfb, 0xe8, 0xc7, 0x9d, 0xf2, 0x87, 0x0e, 0xa1, 0xfa, 0x1e, 0xcc, 0x9a, 0x96, 0x5b, 0xc5, + 0xe8, 0x3a, 0xc4, 0xbd, 0x4a, 0x85, 0x60, 0x51, 0x58, 0x6a, 0xa6, 0x9c, 0xb1, 0xf5, 0x3a, 0x76, + 0xab, 0xb4, 0xc6, 0x43, 0xd6, 0x4c, 0x39, 0xd3, 0x7f, 0x57, 0xe1, 0x7f, 0xac, 0xcd, 0x60, 0xc6, + 0xc1, 0xfd, 0xda, 0x0f, 0xd1, 0xbb, 0x35, 0xbc, 0x2f, 0xe9, 0x33, 0xf8, 0xcf, 0x3f, 0x10, 0x3b, + 0x30, 0xeb, 0xb3, 0x78, 0x65, 0x38, 0x37, 0x06, 0x19, 0x11, 0x74, 0x08, 0x94, 0xfe, 0xad, 0x0a, + 0x8b, 0x3d, 0x8a, 0xa4, 0x66, 0xef, 0x87, 0x48, 0xbd, 0x3d, 0x8e, 0xd4, 0x68, 0xa9, 0x76, 0x45, + 0xf2, 0xba, 0x14, 0xb4, 0x24, 0x2c, 0xc2, 0x94, 0x6c, 0x48, 0xf4, 0xd7, 0x2a, 0x5c, 0x0b, 0x22, + 0x3b, 0xb1, 0x48, 0x37, 0x87, 0x3f, 0x0c, 0xd1, 0xf1, 0xc6, 0x68, 0x3a, 0xfa, 0x8c, 0xa2, 0xa1, + 0xb3, 0xaf, 0xaf, 0xae, 0xb3, 0x1c, 0xc4, 0xb9, 0x82, 0x48, 0x46, 0xe5, 0xf7, 0x7e, 0xa4, 0xd0, + 0x24, 0x8c, 0x65, 0x51, 0x62, 0xd5, 0x29, 0xdf, 0x75, 0xca, 0xe4, 0x63, 0xfd, 0xb9, 0x0a, 0x4b, + 0x61, 0xf2, 0xa4, 0x02, 0xdf, 0x0f, 0x51, 0x7e, 0x67, 0x12, 0xe5, 0xd1, 0x52, 0xe1, 0x86, 0x64, + 0x7d, 0x19, 0x12, 0x35, 0x8b, 0xd4, 0x7a, 0xd9, 0x33, 0x65, 0xce, 0xb3, 0x05, 0x96, 0x25, 0xf3, + 0x3f, 0x6b, 0x90, 0x16, 0xa9, 0xb3, 0x28, 0xfc, 0xa3, 0x43, 0x88, 0x3d, 0xc6, 0x14, 0xad, 0x8c, + 0xfb, 0x0c, 0x97, 0x5d, 0x1d, 0xfb, 0x65, 0x66, 0x57, 0x61, 0x5e, 0xce, 0x5a, 0x43, 0xbd, 0xf4, + 0x9a, 0xf8, 0x61, 0x5e, 0xfa, 0x5a, 0xd3, 0x6d, 0x05, 0x3d, 0x81, 0xb8, 0x68, 0x32, 0xd0, 0xff, + 0x27, 0x34, 0x68, 0xd9, 0xf5, 0x49, 0xfd, 0x09, 0x3a, 0x02, 0x8d, 0x31, 0x83, 0x56, 0xc7, 0x96, + 0xf6, 0xd9, 0xb5, 0xf1, 0xc5, 0x2a, 0x3a, 0x85, 0xb8, 0x78, 0x4b, 0x87, 0xed, 0x29, 0x54, 0x2c, + 0x0c, 0xdb, 0x53, 0xf8, 0x19, 0xde, 0x55, 0x50, 0x11, 0xe6, 0x03, 0x91, 0xa1, 0x9b, 0x13, 0xdf, + 0x95, 0xac, 0x3e, 0x39, 0x4b, 0xee, 0x2a, 0xe8, 0x33, 0x48, 0xf5, 0x2b, 0x17, 0x6d, 0x4e, 0x95, + 0x4c, 0xb2, 0x5b, 0xd3, 0x5d, 0x80, 0x83, 0xd2, 0xaf, 0x17, 0x6b, 0xca, 0xab, 0x8b, 0x35, 0xe5, + 0x8f, 0x8b, 0x35, 0xe5, 0xf9, 0x9f, 0x6b, 0x33, 0x9f, 0xee, 0x55, 0x1d, 0x5a, 0x6b, 0x9d, 0x1b, + 0xb6, 0xd7, 0xc8, 0xb9, 0xa4, 0x69, 0xdb, 0x3b, 0x65, 0xdc, 0xce, 0xb9, 0xd8, 0xab, 0x90, 0x1d, + 0xab, 0xe9, 0xec, 0x54, 0xbd, 0x5c, 0xf8, 0x33, 0xf2, 0x7d, 0x31, 0x7e, 0xa9, 0x5e, 0x7b, 0x8a, + 0xbd, 0xe3, 0xa2, 0xf1, 0xe8, 0xac, 0xc0, 0xfe, 0x55, 0x48, 0xf1, 0x3c, 0xce, 0xbf, 0x13, 0xbf, + 0xfd, 0x6f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x11, 0xd3, 0xc8, 0xed, 0xac, 0x16, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -3447,18 +3436,6 @@ func (m *DeleteRequest_Body) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } - if m.OwnerId != nil { - { - size, err := m.OwnerId.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } if m.Address != nil { { size, err := m.Address.MarshalToSizedBuffer(dAtA[:i]) @@ -4873,10 +4850,6 @@ func (m *DeleteRequest_Body) Size() (n int) { l = m.Address.Size() n += 1 + l + sovService(uint64(l)) } - if m.OwnerId != nil { - l = m.OwnerId.Size() - n += 1 + l + sovService(uint64(l)) - } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -7004,42 +6977,6 @@ func (m *DeleteRequest_Body) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OwnerId", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.OwnerId == nil { - m.OwnerId = &grpc1.OwnerID{} - } - if err := m.OwnerId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipService(dAtA[iNdEx:]) diff --git a/v2/object/grpc/types.pb.go b/v2/object/grpc/types.pb.go index 2ba1d5a..e616358 100644 --- a/v2/object/grpc/types.pb.go +++ b/v2/object/grpc/types.pb.go @@ -549,58 +549,57 @@ func init() { func init() { proto.RegisterFile("v2/object/grpc/types.proto", fileDescriptor_545319325da7b9b1) } var fileDescriptor_545319325da7b9b1 = []byte{ - // 808 bytes of a gzipped FileDescriptorProto + // 795 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x95, 0xdd, 0x6e, 0xe3, 0x44, - 0x14, 0xc7, 0xeb, 0xb4, 0xf9, 0x3a, 0x49, 0x76, 0xcd, 0x80, 0xc0, 0x0a, 0x55, 0x08, 0x95, 0x90, - 0xc2, 0x4a, 0x75, 0x50, 0xb6, 0x08, 0xc1, 0x6a, 0x91, 0xd2, 0xc6, 0x9b, 0x5a, 0x6a, 0x9b, 0x32, - 0x76, 0x91, 0xe0, 0xc6, 0x72, 0xed, 0x69, 0x6c, 0x36, 0xf5, 0x58, 0x33, 0x13, 0xa3, 0xdc, 0xf3, - 0x10, 0x3c, 0x03, 0x12, 0x37, 0xbc, 0x04, 0x5c, 0xf2, 0x08, 0xa8, 0xbc, 0x08, 0xf2, 0x8c, 0x9d, - 0x7e, 0x2e, 0xbb, 0xb0, 0x57, 0x9e, 0x39, 0xf3, 0x3b, 0x67, 0xce, 0xf9, 0x9f, 0x33, 0x32, 0x74, - 0xb3, 0xd1, 0x90, 0x9e, 0xff, 0x40, 0x02, 0x31, 0x9c, 0xb3, 0x34, 0x18, 0x8a, 0x55, 0x4a, 0xb8, - 0x99, 0x32, 0x2a, 0x28, 0xd2, 0x13, 0x42, 0xcd, 0x0b, 0x6e, 0x66, 0x23, 0x53, 0x21, 0x5d, 0x23, - 0x1b, 0x0d, 0x19, 0xb9, 0xe0, 0xf7, 0xd8, 0x6e, 0x1e, 0x87, 0x13, 0x96, 0xc5, 0x01, 0x51, 0x87, - 0x97, 0x44, 0xf8, 0xc5, 0xd9, 0xf6, 0xdd, 0xb3, 0x8c, 0xb0, 0xf8, 0x62, 0xa5, 0x4e, 0x77, 0x7e, - 0xaa, 0x40, 0xcb, 0x89, 0x28, 0x13, 0x87, 0xc4, 0x0f, 0x09, 0x43, 0x7b, 0x50, 0xcf, 0x08, 0xe3, - 0x31, 0x4d, 0x0c, 0xad, 0xaf, 0x0d, 0x5a, 0xa3, 0xae, 0x79, 0x9d, 0x47, 0x11, 0xc6, 0xfc, 0x56, - 0x11, 0xb8, 0x44, 0xd1, 0x27, 0xf0, 0x28, 0x60, 0xc4, 0x17, 0x31, 0x4d, 0x3c, 0x92, 0xd2, 0x20, - 0x32, 0x2a, 0x7d, 0x6d, 0xb0, 0x85, 0x3b, 0xa5, 0xd5, 0xca, 0x8d, 0x68, 0x04, 0x0d, 0xfa, 0x63, - 0x42, 0x98, 0x17, 0x87, 0xc6, 0xa6, 0x8c, 0xfe, 0xc1, 0x8d, 0xe8, 0x79, 0x69, 0xe6, 0x2c, 0x3f, - 0xb7, 0x27, 0xb8, 0x2e, 0x41, 0x3b, 0x44, 0xcf, 0xa1, 0xa5, 0xca, 0xf7, 0xf2, 0x82, 0x8d, 0xad, - 0xbe, 0x36, 0x78, 0x34, 0xda, 0x36, 0xef, 0x8a, 0x63, 0xce, 0xe4, 0xc7, 0x5d, 0xa5, 0x04, 0x03, - 0x5d, 0xaf, 0xf3, 0xcc, 0x52, 0x7f, 0xb5, 0xa0, 0x7e, 0xe8, 0x2d, 0x48, 0x32, 0x17, 0x91, 0x51, - 0x55, 0x99, 0x15, 0xd6, 0x23, 0x69, 0xdc, 0xf9, 0xad, 0x0e, 0xb5, 0xb7, 0x52, 0xe0, 0x6b, 0x68, - 0x07, 0x34, 0x11, 0x7e, 0x5c, 0x94, 0x57, 0x91, 0xae, 0x1f, 0xde, 0x2d, 0xef, 0xa0, 0x64, 0xec, - 0x09, 0x6e, 0xad, 0x1d, 0xec, 0xf0, 0x7f, 0x49, 0x73, 0x5f, 0xf5, 0xad, 0x87, 0x54, 0x7f, 0x33, - 0x09, 0xd0, 0xc7, 0xd0, 0x2e, 0xb1, 0xc8, 0xe7, 0x91, 0x51, 0xeb, 0x6b, 0x83, 0x36, 0x6e, 0x15, - 0xb6, 0x43, 0x9f, 0x47, 0x77, 0x7b, 0x51, 0xff, 0x8f, 0xbd, 0xf8, 0x14, 0xf4, 0x88, 0x5e, 0xd2, - 0x4b, 0xca, 0xd2, 0x28, 0x0e, 0xd4, 0x2d, 0x0d, 0x79, 0xcb, 0xe3, 0x1b, 0x76, 0x79, 0xd3, 0x04, - 0x3a, 0x9c, 0xf0, 0x5c, 0x59, 0x4f, 0xd0, 0x97, 0x24, 0x31, 0x9a, 0x52, 0x93, 0x8f, 0x1e, 0x68, - 0x85, 0xa3, 0x38, 0x37, 0xc7, 0x70, 0x9b, 0xdf, 0xd8, 0xa1, 0x7d, 0x00, 0x5f, 0x08, 0x16, 0x9f, - 0x2f, 0x05, 0xe1, 0x06, 0xf4, 0x37, 0x07, 0xad, 0xd1, 0xce, 0xfd, 0x74, 0x55, 0xe3, 0xcd, 0x71, - 0x89, 0xe2, 0x1b, 0x5e, 0x68, 0x0f, 0xaa, 0x3c, 0x5d, 0xc4, 0xc2, 0x68, 0xc9, 0x0c, 0x7a, 0xaf, - 0x74, 0x77, 0x72, 0x0a, 0x2b, 0xb8, 0xfb, 0x14, 0x9a, 0xeb, 0x70, 0x48, 0x87, 0xcd, 0x97, 0x64, - 0x25, 0xa7, 0xa9, 0x89, 0xf3, 0x25, 0x7a, 0x0f, 0xaa, 0x99, 0xbf, 0x58, 0x12, 0x39, 0x26, 0x4d, - 0xac, 0x36, 0xdd, 0x5f, 0x2b, 0x50, 0x95, 0x51, 0xd0, 0x67, 0x50, 0x4b, 0x7d, 0x46, 0x12, 0x51, - 0x8c, 0xa0, 0x71, 0x6f, 0x16, 0xe4, 0xd5, 0xf6, 0x04, 0x17, 0x1c, 0xda, 0x83, 0x46, 0xca, 0x48, - 0x16, 0xd3, 0x25, 0x2f, 0x66, 0xef, 0xd5, 0x3e, 0x6b, 0x12, 0x4d, 0x41, 0x57, 0xfe, 0x1e, 0x8f, - 0xe7, 0x89, 0x2f, 0x96, 0x8c, 0x14, 0xd3, 0xb7, 0xfd, 0x90, 0xd2, 0x25, 0x83, 0x1f, 0x2b, 0xaf, - 0xb5, 0x01, 0x3d, 0x87, 0x4e, 0x11, 0x28, 0x92, 0x6a, 0xc8, 0x49, 0xbc, 0x9d, 0xc3, 0x2d, 0xb5, - 0x70, 0x5b, 0xe1, 0xeb, 0x37, 0xd7, 0x08, 0xa2, 0x78, 0x11, 0x32, 0x92, 0x18, 0x55, 0xd9, 0xa6, - 0x7f, 0xc9, 0xbe, 0x24, 0x77, 0x7e, 0xd7, 0xa0, 0xa6, 0xcc, 0xe8, 0x73, 0x68, 0x16, 0x93, 0x19, - 0x87, 0xaf, 0xd5, 0xac, 0xa1, 0x50, 0x3b, 0x44, 0x5f, 0x41, 0xf3, 0xba, 0xf0, 0xca, 0x1b, 0x14, - 0x7e, 0x8d, 0xe7, 0x3d, 0x2a, 0x6a, 0xdd, 0x7c, 0x4d, 0xad, 0x05, 0x87, 0x0c, 0xa8, 0x17, 0xaf, - 0x49, 0xca, 0xd3, 0xc6, 0xe5, 0xf6, 0xc9, 0x33, 0x80, 0xeb, 0x37, 0x83, 0x5a, 0x50, 0xc7, 0xd6, - 0xf4, 0xec, 0x68, 0x8c, 0xf5, 0x0d, 0xd4, 0x81, 0xa6, 0x3b, 0x3b, 0xde, 0x77, 0xdc, 0xd9, 0x89, - 0xa5, 0x6b, 0xe8, 0x1d, 0xe8, 0x38, 0xee, 0x0c, 0x8f, 0xa7, 0x96, 0x37, 0xc5, 0xb3, 0xb3, 0x53, - 0xbd, 0xf2, 0xe4, 0x4b, 0x68, 0x1e, 0xfb, 0x22, 0x88, 0xa4, 0x6f, 0x17, 0xde, 0x3f, 0x1e, 0xbb, - 0x07, 0x87, 0x9e, 0xfb, 0xdd, 0xa9, 0xe5, 0x9d, 0x9d, 0x38, 0xa7, 0xd6, 0x81, 0xfd, 0xc2, 0xb6, - 0x26, 0xfa, 0x06, 0xd2, 0xa1, 0xed, 0xb8, 0xd8, 0x3e, 0x99, 0x7a, 0xd6, 0x37, 0x67, 0xe3, 0x23, - 0x5d, 0xdb, 0xf7, 0xfe, 0xb8, 0xea, 0x69, 0x7f, 0x5e, 0xf5, 0xb4, 0xbf, 0xae, 0x7a, 0xda, 0xcf, - 0x7f, 0xf7, 0x36, 0xbe, 0xff, 0x62, 0x1e, 0x8b, 0x68, 0x79, 0x6e, 0x06, 0xf4, 0x72, 0x98, 0xf0, - 0x34, 0x08, 0x76, 0x43, 0x92, 0x0d, 0x13, 0x42, 0x2f, 0xf8, 0xae, 0x9f, 0xc6, 0xbb, 0x73, 0x3a, - 0xbc, 0xfd, 0xcf, 0x7a, 0xa6, 0xd6, 0xbf, 0x54, 0xde, 0x3d, 0x21, 0xf4, 0x85, 0x63, 0x8e, 0x4f, - 0xed, 0x5c, 0x01, 0x55, 0xce, 0x79, 0x4d, 0xfe, 0x65, 0x9e, 0xfe, 0x13, 0x00, 0x00, 0xff, 0xff, - 0x47, 0xd1, 0x60, 0xa2, 0xe9, 0x06, 0x00, 0x00, + 0x14, 0xc7, 0xeb, 0xb4, 0xf9, 0x3a, 0x49, 0x76, 0xcd, 0x80, 0xc0, 0xca, 0xae, 0x42, 0xa8, 0x84, + 0x14, 0x56, 0xaa, 0x8d, 0xbc, 0x45, 0x08, 0x56, 0x8b, 0x94, 0x36, 0xde, 0xd4, 0x52, 0xdb, 0x94, + 0xb1, 0x8b, 0x04, 0x37, 0x96, 0x6b, 0x4f, 0x63, 0xb3, 0xa9, 0xc7, 0xf2, 0x4c, 0x8c, 0x7a, 0xcf, + 0x43, 0xf0, 0x0c, 0x48, 0xdc, 0xf0, 0x12, 0x70, 0xc9, 0x23, 0xa0, 0xf2, 0x22, 0xc8, 0x33, 0x76, + 0xfa, 0x91, 0x2e, 0x5b, 0xe0, 0x2a, 0x33, 0x27, 0xbf, 0xf3, 0xf5, 0x3f, 0x67, 0x64, 0xe8, 0xe7, + 0xa6, 0x41, 0xcf, 0xbe, 0x27, 0x01, 0x37, 0xe6, 0x59, 0x1a, 0x18, 0xfc, 0x32, 0x25, 0x4c, 0x4f, + 0x33, 0xca, 0x29, 0x52, 0x13, 0x42, 0xf5, 0x73, 0xa6, 0xe7, 0xa6, 0x2e, 0x91, 0xbe, 0x96, 0x9b, + 0x46, 0x46, 0xce, 0xd9, 0x1a, 0xdb, 0x7f, 0x92, 0x9b, 0x06, 0x23, 0x59, 0x1e, 0x07, 0x64, 0xed, + 0xcf, 0xed, 0x1f, 0x6b, 0xd0, 0x71, 0x22, 0x9a, 0xf1, 0x03, 0xe2, 0x87, 0x24, 0x43, 0xbb, 0xd0, + 0xcc, 0x49, 0xc6, 0x62, 0x9a, 0x68, 0xca, 0x50, 0x19, 0x75, 0xcc, 0xbe, 0x7e, 0x9d, 0xaa, 0x8c, + 0xa2, 0x7f, 0x23, 0x09, 0x5c, 0xa1, 0xe8, 0x63, 0x78, 0x14, 0x64, 0xc4, 0xe7, 0x31, 0x4d, 0x3c, + 0x92, 0xd2, 0x20, 0xd2, 0x6a, 0x43, 0x65, 0xb4, 0x85, 0x7b, 0x95, 0xd5, 0x2a, 0x8c, 0xc8, 0x84, + 0x16, 0xfd, 0x21, 0x21, 0x99, 0x17, 0x87, 0xda, 0xa6, 0x88, 0xfe, 0xc1, 0x8d, 0xe8, 0x45, 0xf5, + 0xfa, 0xac, 0xf8, 0xdf, 0x9e, 0xe0, 0xa6, 0x00, 0xed, 0x10, 0xbd, 0x84, 0x8e, 0xec, 0xd0, 0x2b, + 0xca, 0xd6, 0xb6, 0x86, 0xca, 0xe8, 0x91, 0xf9, 0x54, 0xbf, 0xdb, 0xbf, 0x3e, 0x13, 0x3f, 0xee, + 0x65, 0x4a, 0x30, 0xd0, 0xd5, 0xb9, 0xa8, 0x2c, 0xf5, 0x2f, 0x17, 0xd4, 0x0f, 0xbd, 0x05, 0x49, + 0xe6, 0x3c, 0xd2, 0xea, 0xb2, 0xb2, 0xd2, 0x7a, 0x28, 0x8c, 0xdb, 0xbf, 0x36, 0xa1, 0xf1, 0xbf, + 0x14, 0xf8, 0x0a, 0xba, 0x01, 0x4d, 0xb8, 0x1f, 0x97, 0xed, 0xd5, 0x84, 0xeb, 0x93, 0xbb, 0xed, + 0xed, 0x57, 0x8c, 0x3d, 0xc1, 0x9d, 0x95, 0x83, 0x1d, 0xfe, 0x27, 0x69, 0xd6, 0x55, 0xdf, 0xba, + 0x4f, 0xf5, 0x87, 0x49, 0x80, 0x3e, 0x82, 0x6e, 0x85, 0x45, 0x3e, 0x8b, 0xb4, 0xc6, 0x50, 0x19, + 0x75, 0x71, 0xa7, 0xb4, 0x1d, 0xf8, 0x2c, 0xba, 0x3b, 0x8b, 0xe6, 0xbf, 0x9c, 0xc5, 0x27, 0xa0, + 0x46, 0xf4, 0x82, 0x5e, 0xd0, 0x2c, 0x8d, 0xe2, 0x40, 0x66, 0x69, 0x89, 0x2c, 0x8f, 0x6f, 0xd8, + 0x45, 0xa6, 0x09, 0xf4, 0x18, 0x61, 0x85, 0xb2, 0x1e, 0xa7, 0xaf, 0x49, 0xa2, 0xb5, 0x85, 0x26, + 0x1f, 0xde, 0x33, 0x0a, 0x47, 0x72, 0x6e, 0x81, 0xe1, 0x2e, 0xbb, 0x71, 0x43, 0x7b, 0x00, 0x3e, + 0xe7, 0x59, 0x7c, 0xb6, 0xe4, 0x84, 0x69, 0x30, 0xdc, 0x1c, 0x75, 0xcc, 0xed, 0xf5, 0x72, 0xe5, + 0xe0, 0xf5, 0x71, 0x85, 0xe2, 0x1b, 0x5e, 0x68, 0x17, 0xea, 0x2c, 0x5d, 0xc4, 0x5c, 0xeb, 0x88, + 0x0a, 0x06, 0x6f, 0x74, 0x77, 0x0a, 0x0a, 0x4b, 0xb8, 0xff, 0x1c, 0xda, 0xab, 0x70, 0x48, 0x85, + 0xcd, 0xd7, 0xe4, 0x52, 0x6c, 0x53, 0x1b, 0x17, 0x47, 0xf4, 0x1e, 0xd4, 0x73, 0x7f, 0xb1, 0x24, + 0x62, 0x4d, 0xda, 0x58, 0x5e, 0xfa, 0xbf, 0xd4, 0xa0, 0x2e, 0xa2, 0xa0, 0x4f, 0xa1, 0x91, 0xfa, + 0x19, 0x49, 0x78, 0xb9, 0x82, 0xda, 0xda, 0x2e, 0x88, 0xd4, 0xf6, 0x04, 0x97, 0x1c, 0xda, 0x85, + 0x56, 0x9a, 0x91, 0x3c, 0xa6, 0x4b, 0x56, 0xee, 0xde, 0x9b, 0x7d, 0x56, 0x24, 0x9a, 0x82, 0x2a, + 0xfd, 0x3d, 0x16, 0xcf, 0x13, 0x9f, 0x2f, 0x33, 0x52, 0x6e, 0xdf, 0xd3, 0xfb, 0x94, 0xae, 0x18, + 0xfc, 0x58, 0x7a, 0xad, 0x0c, 0xe8, 0x25, 0xf4, 0xca, 0x40, 0x91, 0x50, 0x43, 0x6c, 0xe2, 0xed, + 0x1a, 0x6e, 0xa9, 0x85, 0xbb, 0x12, 0x5f, 0xbd, 0xb9, 0x56, 0x10, 0xc5, 0x8b, 0x30, 0x23, 0x89, + 0x56, 0x17, 0x63, 0xfa, 0x87, 0xea, 0x2b, 0x72, 0xfb, 0x37, 0x05, 0x1a, 0xd2, 0x8c, 0x3e, 0x83, + 0x76, 0xb9, 0x99, 0x71, 0xf8, 0x56, 0xcd, 0x5a, 0x12, 0xb5, 0x43, 0xf4, 0x25, 0xb4, 0xaf, 0x1b, + 0xaf, 0x3d, 0xa0, 0xf1, 0x6b, 0xbc, 0x98, 0x51, 0xd9, 0xeb, 0xe6, 0x5b, 0x7a, 0x2d, 0x39, 0xa4, + 0x41, 0xb3, 0x7c, 0x4d, 0x42, 0x9e, 0x2e, 0xae, 0xae, 0xcf, 0x5e, 0x00, 0x5c, 0xbf, 0x19, 0xd4, + 0x81, 0x26, 0xb6, 0xa6, 0xa7, 0x87, 0x63, 0xac, 0x6e, 0xa0, 0x1e, 0xb4, 0xdd, 0xd9, 0xd1, 0x9e, + 0xe3, 0xce, 0x8e, 0x2d, 0x55, 0x41, 0xef, 0x40, 0xcf, 0x71, 0x67, 0x78, 0x3c, 0xb5, 0xbc, 0x29, + 0x9e, 0x9d, 0x9e, 0xa8, 0xb5, 0x67, 0x5f, 0x40, 0xfb, 0xc8, 0xe7, 0x41, 0x24, 0x7c, 0xfb, 0xf0, + 0xfe, 0xd1, 0xd8, 0xdd, 0x3f, 0xf0, 0xdc, 0x6f, 0x4f, 0x2c, 0xef, 0xf4, 0xd8, 0x39, 0xb1, 0xf6, + 0xed, 0x57, 0xb6, 0x35, 0x51, 0x37, 0x90, 0x0a, 0x5d, 0xc7, 0xc5, 0xf6, 0xf1, 0xd4, 0xb3, 0xbe, + 0x3e, 0x1d, 0x1f, 0xaa, 0xca, 0x9e, 0xf7, 0xfb, 0xd5, 0x40, 0xf9, 0xe3, 0x6a, 0xa0, 0xfc, 0x79, + 0x35, 0x50, 0x7e, 0xfa, 0x6b, 0xb0, 0xf1, 0xdd, 0xe7, 0xf3, 0x98, 0x47, 0xcb, 0x33, 0x3d, 0xa0, + 0x17, 0x46, 0xc2, 0xd2, 0x20, 0xd8, 0x09, 0x49, 0x6e, 0x24, 0x84, 0x9e, 0xb3, 0x1d, 0x3f, 0x8d, + 0x77, 0xe6, 0xd4, 0xb8, 0xfd, 0x59, 0x7a, 0x21, 0xcf, 0x3f, 0xd7, 0xde, 0x3d, 0x26, 0xf4, 0x95, + 0xa3, 0x8f, 0x4f, 0xec, 0x42, 0x01, 0xd9, 0xce, 0x59, 0x43, 0x7c, 0x65, 0x9e, 0xff, 0x1d, 0x00, + 0x00, 0xff, 0xff, 0x30, 0x4b, 0x22, 0xa9, 0xcc, 0x06, 0x00, 0x00, } func (m *ShortHeader) Marshal() (dAtA []byte, err error) { diff --git a/v2/service/convert.go b/v2/service/convert.go index 93313ff..6bffe27 100644 --- a/v2/service/convert.go +++ b/v2/service/convert.go @@ -546,54 +546,54 @@ func ResponseHeadersFromGRPC( ) } -func ObjectSessionVerbToGRPCField(v ObjectSessionVerb) service.ObjectServiceContext_Verb { +func ObjectSessionVerbToGRPCField(v ObjectSessionVerb) service.ObjectSessionContext_Verb { switch v { case ObjectVerbPut: - return service.ObjectServiceContext_PUT + return service.ObjectSessionContext_PUT case ObjectVerbGet: - return service.ObjectServiceContext_GET + return service.ObjectSessionContext_GET case ObjectVerbHead: - return service.ObjectServiceContext_HEAD + return service.ObjectSessionContext_HEAD case ObjectVerbSearch: - return service.ObjectServiceContext_SEARCH + return service.ObjectSessionContext_SEARCH case ObjectVerbDelete: - return service.ObjectServiceContext_DELETE + return service.ObjectSessionContext_DELETE case ObjectVerbRange: - return service.ObjectServiceContext_RANGE + return service.ObjectSessionContext_RANGE case ObjectVerbRangeHash: - return service.ObjectServiceContext_RANGEHASH + return service.ObjectSessionContext_RANGEHASH default: - return service.ObjectServiceContext_VERB_UNSPECIFIED + return service.ObjectSessionContext_VERB_UNSPECIFIED } } -func ObjectSessionVerbFromGRPCField(v service.ObjectServiceContext_Verb) ObjectSessionVerb { +func ObjectSessionVerbFromGRPCField(v service.ObjectSessionContext_Verb) ObjectSessionVerb { switch v { - case service.ObjectServiceContext_PUT: + case service.ObjectSessionContext_PUT: return ObjectVerbPut - case service.ObjectServiceContext_GET: + case service.ObjectSessionContext_GET: return ObjectVerbGet - case service.ObjectServiceContext_HEAD: + case service.ObjectSessionContext_HEAD: return ObjectVerbHead - case service.ObjectServiceContext_SEARCH: + case service.ObjectSessionContext_SEARCH: return ObjectVerbSearch - case service.ObjectServiceContext_DELETE: + case service.ObjectSessionContext_DELETE: return ObjectVerbDelete - case service.ObjectServiceContext_RANGE: + case service.ObjectSessionContext_RANGE: return ObjectVerbRange - case service.ObjectServiceContext_RANGEHASH: + case service.ObjectSessionContext_RANGEHASH: return ObjectVerbRangeHash default: return ObjectVerbUnknown } } -func ObjectSessionContextToGRPCMessage(c *ObjectSessionContext) *service.ObjectServiceContext { +func ObjectSessionContextToGRPCMessage(c *ObjectSessionContext) *service.ObjectSessionContext { if c == nil { return nil } - m := new(service.ObjectServiceContext) + m := new(service.ObjectSessionContext) m.SetVerb( ObjectSessionVerbToGRPCField(c.GetVerb()), @@ -606,7 +606,7 @@ func ObjectSessionContextToGRPCMessage(c *ObjectSessionContext) *service.ObjectS return m } -func ObjectSessionContextFromGRPCMessage(m *service.ObjectServiceContext) *ObjectSessionContext { +func ObjectSessionContextFromGRPCMessage(m *service.ObjectSessionContext) *ObjectSessionContext { if m == nil { return nil } @@ -665,9 +665,9 @@ func SessionTokenBodyFromGRPCMessage(m *service.SessionToken_Body) *SessionToken switch v := m.GetContext().(type) { case nil: - case *service.SessionToken_Body_ObjectService: + case *service.SessionToken_Body_Object: t.SetContext( - ObjectSessionContextFromGRPCMessage(v.ObjectService), + ObjectSessionContextFromGRPCMessage(v.Object), ) default: panic(fmt.Sprintf("unknown session context %T", v)) diff --git a/v2/service/grpc/meta.go b/v2/service/grpc/meta.go index 730b437..9f5c192 100644 --- a/v2/service/grpc/meta.go +++ b/v2/service/grpc/meta.go @@ -83,23 +83,23 @@ func (m *SessionToken_Body) SetSessionKey(v []byte) { } // SetObjectAddressContext sets object context of the session token. -func (m *SessionToken_Body) SetObjectServiceContext(v *ObjectServiceContext) { +func (m *SessionToken_Body) SetObjectServiceContext(v *ObjectSessionContext) { if m != nil { - m.Context = &SessionToken_Body_ObjectService{ - ObjectService: v, + m.Context = &SessionToken_Body_Object{ + Object: v, } } } // SetObjectAddressContext sets object context of the session token. -func (m *ObjectServiceContext) SetAddress(v *refs.Address) { +func (m *ObjectSessionContext) SetAddress(v *refs.Address) { if m != nil { m.Address = v } } // SetObjectAddressContext sets object context of the session token. -func (m *ObjectServiceContext) SetVerb(v ObjectServiceContext_Verb) { +func (m *ObjectSessionContext) SetVerb(v ObjectSessionContext_Verb) { if m != nil { m.Verb = v } diff --git a/v2/service/grpc/meta.pb.go b/v2/service/grpc/types.pb.go similarity index 60% rename from v2/service/grpc/meta.pb.go rename to v2/service/grpc/types.pb.go index 5c8c90f..4190b29 100644 --- a/v2/service/grpc/meta.pb.go +++ b/v2/service/grpc/types.pb.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: v2/service/grpc/meta.proto +// source: v2/service/grpc/types.proto package service @@ -25,28 +25,28 @@ var _ = math.Inf const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package // Object request verbs -type ObjectServiceContext_Verb int32 +type ObjectSessionContext_Verb int32 const ( // Unknown verb - ObjectServiceContext_VERB_UNSPECIFIED ObjectServiceContext_Verb = 0 + ObjectSessionContext_VERB_UNSPECIFIED ObjectSessionContext_Verb = 0 // Refers to object.Put RPC call - ObjectServiceContext_PUT ObjectServiceContext_Verb = 1 + ObjectSessionContext_PUT ObjectSessionContext_Verb = 1 // Refers to object.Get RPC call - ObjectServiceContext_GET ObjectServiceContext_Verb = 2 + ObjectSessionContext_GET ObjectSessionContext_Verb = 2 // Refers to object.Head RPC call - ObjectServiceContext_HEAD ObjectServiceContext_Verb = 3 + ObjectSessionContext_HEAD ObjectSessionContext_Verb = 3 // Refers to object.Search RPC call - ObjectServiceContext_SEARCH ObjectServiceContext_Verb = 4 + ObjectSessionContext_SEARCH ObjectSessionContext_Verb = 4 // Refers to object.Delete RPC call - ObjectServiceContext_DELETE ObjectServiceContext_Verb = 5 + ObjectSessionContext_DELETE ObjectSessionContext_Verb = 5 // Refers to object.GetRange RPC call - ObjectServiceContext_RANGE ObjectServiceContext_Verb = 6 + ObjectSessionContext_RANGE ObjectSessionContext_Verb = 6 // Refers to object.GetRangeHash RPC call - ObjectServiceContext_RANGEHASH ObjectServiceContext_Verb = 7 + ObjectSessionContext_RANGEHASH ObjectSessionContext_Verb = 7 ) -var ObjectServiceContext_Verb_name = map[int32]string{ +var ObjectSessionContext_Verb_name = map[int32]string{ 0: "VERB_UNSPECIFIED", 1: "PUT", 2: "GET", @@ -57,7 +57,7 @@ var ObjectServiceContext_Verb_name = map[int32]string{ 7: "RANGEHASH", } -var ObjectServiceContext_Verb_value = map[string]int32{ +var ObjectSessionContext_Verb_value = map[string]int32{ "VERB_UNSPECIFIED": 0, "PUT": 1, "GET": 2, @@ -68,12 +68,12 @@ var ObjectServiceContext_Verb_value = map[string]int32{ "RANGEHASH": 7, } -func (x ObjectServiceContext_Verb) String() string { - return proto.EnumName(ObjectServiceContext_Verb_name, int32(x)) +func (x ObjectSessionContext_Verb) String() string { + return proto.EnumName(ObjectSessionContext_Verb_name, int32(x)) } -func (ObjectServiceContext_Verb) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_174eb6ef9ee2b356, []int{3, 0} +func (ObjectSessionContext_Verb) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_006ebe254dc218a3, []int{3, 0} } // Extended headers for Request/Response @@ -91,7 +91,7 @@ func (m *XHeader) Reset() { *m = XHeader{} } func (m *XHeader) String() string { return proto.CompactTextString(m) } func (*XHeader) ProtoMessage() {} func (*XHeader) Descriptor() ([]byte, []int) { - return fileDescriptor_174eb6ef9ee2b356, []int{0} + return fileDescriptor_006ebe254dc218a3, []int{0} } func (m *XHeader) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -149,7 +149,7 @@ func (m *Version) Reset() { *m = Version{} } func (m *Version) String() string { return proto.CompactTextString(m) } func (*Version) ProtoMessage() {} func (*Version) Descriptor() ([]byte, []int) { - return fileDescriptor_174eb6ef9ee2b356, []int{1} + return fileDescriptor_006ebe254dc218a3, []int{1} } func (m *Version) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -209,7 +209,7 @@ func (m *TokenLifetime) Reset() { *m = TokenLifetime{} } func (m *TokenLifetime) String() string { return proto.CompactTextString(m) } func (*TokenLifetime) ProtoMessage() {} func (*TokenLifetime) Descriptor() ([]byte, []int) { - return fileDescriptor_174eb6ef9ee2b356, []int{2} + return fileDescriptor_006ebe254dc218a3, []int{2} } func (m *TokenLifetime) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -260,9 +260,9 @@ func (m *TokenLifetime) GetIat() uint64 { } // Context information for Session Tokens related to ObjectService requests -type ObjectServiceContext struct { +type ObjectSessionContext struct { // Verb is a type of request for which the token is issued - Verb ObjectServiceContext_Verb `protobuf:"varint,1,opt,name=verb,proto3,enum=neo.fs.v2.service.ObjectServiceContext_Verb" json:"verb,omitempty"` + Verb ObjectSessionContext_Verb `protobuf:"varint,1,opt,name=verb,proto3,enum=neo.fs.v2.service.ObjectSessionContext_Verb" json:"verb,omitempty"` // Related Object address Address *grpc.Address `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` @@ -270,18 +270,18 @@ type ObjectServiceContext struct { XXX_sizecache int32 `json:"-"` } -func (m *ObjectServiceContext) Reset() { *m = ObjectServiceContext{} } -func (m *ObjectServiceContext) String() string { return proto.CompactTextString(m) } -func (*ObjectServiceContext) ProtoMessage() {} -func (*ObjectServiceContext) Descriptor() ([]byte, []int) { - return fileDescriptor_174eb6ef9ee2b356, []int{3} +func (m *ObjectSessionContext) Reset() { *m = ObjectSessionContext{} } +func (m *ObjectSessionContext) String() string { return proto.CompactTextString(m) } +func (*ObjectSessionContext) ProtoMessage() {} +func (*ObjectSessionContext) Descriptor() ([]byte, []int) { + return fileDescriptor_006ebe254dc218a3, []int{3} } -func (m *ObjectServiceContext) XXX_Unmarshal(b []byte) error { +func (m *ObjectSessionContext) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *ObjectServiceContext) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *ObjectSessionContext) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_ObjectServiceContext.Marshal(b, m, deterministic) + return xxx_messageInfo_ObjectSessionContext.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -291,26 +291,26 @@ func (m *ObjectServiceContext) XXX_Marshal(b []byte, deterministic bool) ([]byte return b[:n], nil } } -func (m *ObjectServiceContext) XXX_Merge(src proto.Message) { - xxx_messageInfo_ObjectServiceContext.Merge(m, src) +func (m *ObjectSessionContext) XXX_Merge(src proto.Message) { + xxx_messageInfo_ObjectSessionContext.Merge(m, src) } -func (m *ObjectServiceContext) XXX_Size() int { +func (m *ObjectSessionContext) XXX_Size() int { return m.Size() } -func (m *ObjectServiceContext) XXX_DiscardUnknown() { - xxx_messageInfo_ObjectServiceContext.DiscardUnknown(m) +func (m *ObjectSessionContext) XXX_DiscardUnknown() { + xxx_messageInfo_ObjectSessionContext.DiscardUnknown(m) } -var xxx_messageInfo_ObjectServiceContext proto.InternalMessageInfo +var xxx_messageInfo_ObjectSessionContext proto.InternalMessageInfo -func (m *ObjectServiceContext) GetVerb() ObjectServiceContext_Verb { +func (m *ObjectSessionContext) GetVerb() ObjectSessionContext_Verb { if m != nil { return m.Verb } - return ObjectServiceContext_VERB_UNSPECIFIED + return ObjectSessionContext_VERB_UNSPECIFIED } -func (m *ObjectServiceContext) GetAddress() *grpc.Address { +func (m *ObjectSessionContext) GetAddress() *grpc.Address { if m != nil { return m.Address } @@ -332,7 +332,7 @@ func (m *SessionToken) Reset() { *m = SessionToken{} } func (m *SessionToken) String() string { return proto.CompactTextString(m) } func (*SessionToken) ProtoMessage() {} func (*SessionToken) Descriptor() ([]byte, []int) { - return fileDescriptor_174eb6ef9ee2b356, []int{4} + return fileDescriptor_006ebe254dc218a3, []int{4} } func (m *SessionToken) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -388,7 +388,7 @@ type SessionToken_Body struct { // Carries context of the session. // // Types that are valid to be assigned to Context: - // *SessionToken_Body_ObjectService + // *SessionToken_Body_Object Context isSessionToken_Body_Context `protobuf_oneof:"context"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -399,7 +399,7 @@ func (m *SessionToken_Body) Reset() { *m = SessionToken_Body{} } func (m *SessionToken_Body) String() string { return proto.CompactTextString(m) } func (*SessionToken_Body) ProtoMessage() {} func (*SessionToken_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_174eb6ef9ee2b356, []int{4, 0} + return fileDescriptor_006ebe254dc218a3, []int{4, 0} } func (m *SessionToken_Body) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -434,11 +434,11 @@ type isSessionToken_Body_Context interface { Size() int } -type SessionToken_Body_ObjectService struct { - ObjectService *ObjectServiceContext `protobuf:"bytes,5,opt,name=object_service,json=objectService,proto3,oneof" json:"object_service,omitempty"` +type SessionToken_Body_Object struct { + Object *ObjectSessionContext `protobuf:"bytes,5,opt,name=object,proto3,oneof" json:"object,omitempty"` } -func (*SessionToken_Body_ObjectService) isSessionToken_Body_Context() {} +func (*SessionToken_Body_Object) isSessionToken_Body_Context() {} func (m *SessionToken_Body) GetContext() isSessionToken_Body_Context { if m != nil { @@ -475,9 +475,9 @@ func (m *SessionToken_Body) GetSessionKey() []byte { return nil } -func (m *SessionToken_Body) GetObjectService() *ObjectServiceContext { - if x, ok := m.GetContext().(*SessionToken_Body_ObjectService); ok { - return x.ObjectService +func (m *SessionToken_Body) GetObject() *ObjectSessionContext { + if x, ok := m.GetContext().(*SessionToken_Body_Object); ok { + return x.Object } return nil } @@ -485,7 +485,7 @@ func (m *SessionToken_Body) GetObjectService() *ObjectServiceContext { // XXX_OneofWrappers is for the internal use of the proto package. func (*SessionToken_Body) XXX_OneofWrappers() []interface{} { return []interface{}{ - (*SessionToken_Body_ObjectService)(nil), + (*SessionToken_Body_Object)(nil), } } @@ -504,7 +504,7 @@ func (m *BearerToken) Reset() { *m = BearerToken{} } func (m *BearerToken) String() string { return proto.CompactTextString(m) } func (*BearerToken) ProtoMessage() {} func (*BearerToken) Descriptor() ([]byte, []int) { - return fileDescriptor_174eb6ef9ee2b356, []int{5} + return fileDescriptor_006ebe254dc218a3, []int{5} } func (m *BearerToken) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -564,7 +564,7 @@ func (m *BearerToken_Body) Reset() { *m = BearerToken_Body{} } func (m *BearerToken_Body) String() string { return proto.CompactTextString(m) } func (*BearerToken_Body) ProtoMessage() {} func (*BearerToken_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_174eb6ef9ee2b356, []int{5, 0} + return fileDescriptor_006ebe254dc218a3, []int{5, 0} } func (m *BearerToken_Body) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -639,7 +639,7 @@ func (m *RequestMetaHeader) Reset() { *m = RequestMetaHeader{} } func (m *RequestMetaHeader) String() string { return proto.CompactTextString(m) } func (*RequestMetaHeader) ProtoMessage() {} func (*RequestMetaHeader) Descriptor() ([]byte, []int) { - return fileDescriptor_174eb6ef9ee2b356, []int{6} + return fileDescriptor_006ebe254dc218a3, []int{6} } func (m *RequestMetaHeader) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -738,7 +738,7 @@ func (m *ResponseMetaHeader) Reset() { *m = ResponseMetaHeader{} } func (m *ResponseMetaHeader) String() string { return proto.CompactTextString(m) } func (*ResponseMetaHeader) ProtoMessage() {} func (*ResponseMetaHeader) Descriptor() ([]byte, []int) { - return fileDescriptor_174eb6ef9ee2b356, []int{7} + return fileDescriptor_006ebe254dc218a3, []int{7} } func (m *ResponseMetaHeader) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -802,77 +802,296 @@ func (m *ResponseMetaHeader) GetOrigin() *ResponseMetaHeader { return nil } +// Signature of something in NeoFS +type Signature struct { + // Public key used for signing. + Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + // Signature + Sign []byte `protobuf:"bytes,2,opt,name=sign,proto3" json:"sign,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Signature) Reset() { *m = Signature{} } +func (m *Signature) String() string { return proto.CompactTextString(m) } +func (*Signature) ProtoMessage() {} +func (*Signature) Descriptor() ([]byte, []int) { + return fileDescriptor_006ebe254dc218a3, []int{8} +} +func (m *Signature) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Signature) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Signature.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Signature) XXX_Merge(src proto.Message) { + xxx_messageInfo_Signature.Merge(m, src) +} +func (m *Signature) XXX_Size() int { + return m.Size() +} +func (m *Signature) XXX_DiscardUnknown() { + xxx_messageInfo_Signature.DiscardUnknown(m) +} + +var xxx_messageInfo_Signature proto.InternalMessageInfo + +func (m *Signature) GetKey() []byte { + if m != nil { + return m.Key + } + return nil +} + +func (m *Signature) GetSign() []byte { + if m != nil { + return m.Sign + } + return nil +} + +// Verification info for request signed by all intermediate nodes +type RequestVerificationHeader struct { + // Request Body signature. Should be generated once by request initiator. + BodySignature *Signature `protobuf:"bytes,1,opt,name=body_signature,json=bodySignature,proto3" json:"body_signature,omitempty"` + // Request Meta signature is added and signed by any intermediate node + MetaSignature *Signature `protobuf:"bytes,2,opt,name=meta_signature,json=metaSignature,proto3" json:"meta_signature,omitempty"` + // Sign previous hops + OriginSignature *Signature `protobuf:"bytes,3,opt,name=origin_signature,json=originSignature,proto3" json:"origin_signature,omitempty"` + // Chain of previous hops signatures + Origin *RequestVerificationHeader `protobuf:"bytes,4,opt,name=origin,proto3" json:"origin,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *RequestVerificationHeader) Reset() { *m = RequestVerificationHeader{} } +func (m *RequestVerificationHeader) String() string { return proto.CompactTextString(m) } +func (*RequestVerificationHeader) ProtoMessage() {} +func (*RequestVerificationHeader) Descriptor() ([]byte, []int) { + return fileDescriptor_006ebe254dc218a3, []int{9} +} +func (m *RequestVerificationHeader) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RequestVerificationHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_RequestVerificationHeader.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *RequestVerificationHeader) XXX_Merge(src proto.Message) { + xxx_messageInfo_RequestVerificationHeader.Merge(m, src) +} +func (m *RequestVerificationHeader) XXX_Size() int { + return m.Size() +} +func (m *RequestVerificationHeader) XXX_DiscardUnknown() { + xxx_messageInfo_RequestVerificationHeader.DiscardUnknown(m) +} + +var xxx_messageInfo_RequestVerificationHeader proto.InternalMessageInfo + +func (m *RequestVerificationHeader) GetBodySignature() *Signature { + if m != nil { + return m.BodySignature + } + return nil +} + +func (m *RequestVerificationHeader) GetMetaSignature() *Signature { + if m != nil { + return m.MetaSignature + } + return nil +} + +func (m *RequestVerificationHeader) GetOriginSignature() *Signature { + if m != nil { + return m.OriginSignature + } + return nil +} + +func (m *RequestVerificationHeader) GetOrigin() *RequestVerificationHeader { + if m != nil { + return m.Origin + } + return nil +} + +// Verification info for response signed by all intermediate nodes +type ResponseVerificationHeader struct { + // Response Body signature. Should be generated once by answering node. + BodySignature *Signature `protobuf:"bytes,1,opt,name=body_signature,json=bodySignature,proto3" json:"body_signature,omitempty"` + // Response Meta signature is added and signed by any intermediate node + MetaSignature *Signature `protobuf:"bytes,2,opt,name=meta_signature,json=metaSignature,proto3" json:"meta_signature,omitempty"` + // Sign previous hops + OriginSignature *Signature `protobuf:"bytes,3,opt,name=origin_signature,json=originSignature,proto3" json:"origin_signature,omitempty"` + // Chain of previous hops signatures + Origin *ResponseVerificationHeader `protobuf:"bytes,4,opt,name=origin,proto3" json:"origin,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ResponseVerificationHeader) Reset() { *m = ResponseVerificationHeader{} } +func (m *ResponseVerificationHeader) String() string { return proto.CompactTextString(m) } +func (*ResponseVerificationHeader) ProtoMessage() {} +func (*ResponseVerificationHeader) Descriptor() ([]byte, []int) { + return fileDescriptor_006ebe254dc218a3, []int{10} +} +func (m *ResponseVerificationHeader) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ResponseVerificationHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ResponseVerificationHeader.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ResponseVerificationHeader) XXX_Merge(src proto.Message) { + xxx_messageInfo_ResponseVerificationHeader.Merge(m, src) +} +func (m *ResponseVerificationHeader) XXX_Size() int { + return m.Size() +} +func (m *ResponseVerificationHeader) XXX_DiscardUnknown() { + xxx_messageInfo_ResponseVerificationHeader.DiscardUnknown(m) +} + +var xxx_messageInfo_ResponseVerificationHeader proto.InternalMessageInfo + +func (m *ResponseVerificationHeader) GetBodySignature() *Signature { + if m != nil { + return m.BodySignature + } + return nil +} + +func (m *ResponseVerificationHeader) GetMetaSignature() *Signature { + if m != nil { + return m.MetaSignature + } + return nil +} + +func (m *ResponseVerificationHeader) GetOriginSignature() *Signature { + if m != nil { + return m.OriginSignature + } + return nil +} + +func (m *ResponseVerificationHeader) GetOrigin() *ResponseVerificationHeader { + if m != nil { + return m.Origin + } + return nil +} + func init() { - proto.RegisterEnum("neo.fs.v2.service.ObjectServiceContext_Verb", ObjectServiceContext_Verb_name, ObjectServiceContext_Verb_value) + proto.RegisterEnum("neo.fs.v2.service.ObjectSessionContext_Verb", ObjectSessionContext_Verb_name, ObjectSessionContext_Verb_value) proto.RegisterType((*XHeader)(nil), "neo.fs.v2.service.XHeader") proto.RegisterType((*Version)(nil), "neo.fs.v2.service.Version") proto.RegisterType((*TokenLifetime)(nil), "neo.fs.v2.service.TokenLifetime") - proto.RegisterType((*ObjectServiceContext)(nil), "neo.fs.v2.service.ObjectServiceContext") + proto.RegisterType((*ObjectSessionContext)(nil), "neo.fs.v2.service.ObjectSessionContext") proto.RegisterType((*SessionToken)(nil), "neo.fs.v2.service.SessionToken") proto.RegisterType((*SessionToken_Body)(nil), "neo.fs.v2.service.SessionToken.Body") proto.RegisterType((*BearerToken)(nil), "neo.fs.v2.service.BearerToken") proto.RegisterType((*BearerToken_Body)(nil), "neo.fs.v2.service.BearerToken.Body") proto.RegisterType((*RequestMetaHeader)(nil), "neo.fs.v2.service.RequestMetaHeader") proto.RegisterType((*ResponseMetaHeader)(nil), "neo.fs.v2.service.ResponseMetaHeader") + proto.RegisterType((*Signature)(nil), "neo.fs.v2.service.Signature") + proto.RegisterType((*RequestVerificationHeader)(nil), "neo.fs.v2.service.RequestVerificationHeader") + proto.RegisterType((*ResponseVerificationHeader)(nil), "neo.fs.v2.service.ResponseVerificationHeader") } -func init() { proto.RegisterFile("v2/service/grpc/meta.proto", fileDescriptor_174eb6ef9ee2b356) } +func init() { proto.RegisterFile("v2/service/grpc/types.proto", fileDescriptor_006ebe254dc218a3) } -var fileDescriptor_174eb6ef9ee2b356 = []byte{ - // 846 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x55, 0xcd, 0x6e, 0x23, 0x45, - 0x10, 0xce, 0xd8, 0x13, 0x4f, 0x5c, 0x8e, 0xa3, 0xd9, 0x56, 0xa4, 0xb5, 0xac, 0x95, 0x37, 0x1a, - 0x40, 0x70, 0x20, 0x63, 0xed, 0x00, 0x0a, 0x3f, 0x8b, 0x84, 0x1d, 0xcf, 0xae, 0x2d, 0x42, 0x36, - 0x6a, 0x7b, 0x23, 0xc4, 0xc5, 0x9a, 0x9f, 0xb2, 0x33, 0x59, 0x67, 0xda, 0x4c, 0x77, 0x86, 0xf8, - 0x05, 0xb8, 0x71, 0xe7, 0x19, 0xb8, 0x71, 0xe1, 0x19, 0x38, 0xf2, 0x08, 0x28, 0xdc, 0xb8, 0x71, - 0xe2, 0x8a, 0xba, 0xa7, 0xbd, 0x78, 0x13, 0x07, 0x38, 0x20, 0xc4, 0xad, 0xba, 0xea, 0xab, 0xaf, - 0x7e, 0xa7, 0x06, 0x9a, 0xb9, 0xd7, 0xe6, 0x98, 0xe5, 0x49, 0x84, 0xed, 0x69, 0x36, 0x8f, 0xda, - 0x17, 0x28, 0x02, 0x77, 0x9e, 0x31, 0xc1, 0xc8, 0xbd, 0x14, 0x99, 0x3b, 0xe1, 0x6e, 0xee, 0xb9, - 0x1a, 0xd2, 0xbc, 0x9f, 0x7b, 0xed, 0x20, 0x9a, 0x15, 0x50, 0xb1, 0x98, 0x23, 0x2f, 0xb0, 0xcd, - 0x46, 0xee, 0xb5, 0x33, 0x9c, 0xf0, 0xdb, 0x96, 0x07, 0x37, 0x23, 0xe4, 0x98, 0x25, 0x93, 0x45, - 0x61, 0x75, 0x1e, 0x81, 0xf5, 0x79, 0x1f, 0x83, 0x18, 0x33, 0x62, 0x43, 0xf9, 0x05, 0x2e, 0x1a, - 0xc6, 0x9e, 0xf1, 0x56, 0x95, 0x4a, 0x91, 0xec, 0xc2, 0x66, 0x1e, 0xcc, 0x2e, 0xb1, 0x51, 0x52, - 0xba, 0xe2, 0xe1, 0xbc, 0x07, 0xd6, 0x29, 0x66, 0x3c, 0x61, 0xa9, 0x04, 0x5c, 0x04, 0xe7, 0x2c, - 0x53, 0x4e, 0x75, 0x5a, 0x3c, 0x94, 0x36, 0x49, 0x59, 0xa6, 0xdc, 0xa4, 0x56, 0x3e, 0x1c, 0x1f, - 0xea, 0x23, 0xf6, 0x02, 0xd3, 0xa3, 0x64, 0x82, 0x22, 0xb9, 0x40, 0x19, 0x0f, 0xaf, 0xe6, 0xca, - 0xd5, 0xa4, 0x52, 0x94, 0x9a, 0x34, 0x9c, 0x28, 0x37, 0x93, 0x4a, 0x51, 0x6a, 0x92, 0x40, 0x34, - 0xca, 0x85, 0x26, 0x09, 0x84, 0xf3, 0xbb, 0x01, 0xbb, 0xcf, 0xc2, 0x73, 0x8c, 0xc4, 0xb0, 0x28, - 0xea, 0x90, 0xa5, 0x02, 0xaf, 0x04, 0xf9, 0x04, 0xcc, 0x1c, 0xb3, 0x50, 0xf1, 0xed, 0x78, 0x6f, - 0xbb, 0xb7, 0x9a, 0xe7, 0xae, 0x73, 0x73, 0x4f, 0x31, 0x0b, 0xa9, 0xf2, 0x24, 0x8f, 0xc0, 0x0a, - 0xe2, 0x38, 0x43, 0xce, 0x55, 0x0a, 0x35, 0xef, 0xfe, 0x0a, 0x89, 0x6c, 0xae, 0xdb, 0x29, 0xcc, - 0x74, 0x89, 0x73, 0xce, 0xc1, 0x94, 0x04, 0x64, 0x17, 0xec, 0x53, 0x9f, 0x76, 0xc7, 0xcf, 0x8f, - 0x87, 0x27, 0xfe, 0xe1, 0xe0, 0xc9, 0xc0, 0xef, 0xd9, 0x1b, 0xc4, 0x82, 0xf2, 0xc9, 0xf3, 0x91, - 0x6d, 0x48, 0xe1, 0xa9, 0x3f, 0xb2, 0x4b, 0x64, 0x0b, 0xcc, 0xbe, 0xdf, 0xe9, 0xd9, 0x65, 0x02, - 0x50, 0x19, 0xfa, 0x1d, 0x7a, 0xd8, 0xb7, 0x4d, 0x29, 0xf7, 0xfc, 0x23, 0x7f, 0xe4, 0xdb, 0x9b, - 0xa4, 0x0a, 0x9b, 0xb4, 0x73, 0xfc, 0xd4, 0xb7, 0x2b, 0xa4, 0x0e, 0x55, 0x25, 0xf6, 0x3b, 0xc3, - 0xbe, 0x6d, 0x39, 0xdf, 0x94, 0x61, 0x7b, 0x88, 0x5c, 0x36, 0x5e, 0x35, 0x92, 0xbc, 0x0f, 0x66, - 0xc8, 0xe2, 0x62, 0x62, 0x35, 0xef, 0xf5, 0x35, 0x15, 0xaf, 0xc2, 0xdd, 0x2e, 0x8b, 0x17, 0x54, - 0x79, 0x90, 0x0f, 0xa1, 0xca, 0x93, 0x69, 0x1a, 0x88, 0xcb, 0x0c, 0x75, 0xad, 0x0f, 0xd6, 0xb9, - 0x2f, 0x31, 0xf4, 0x4f, 0x78, 0xf3, 0xeb, 0x12, 0x98, 0x92, 0x8a, 0xec, 0x40, 0x29, 0x89, 0x55, - 0xf0, 0x6d, 0x5a, 0x4a, 0x62, 0xe2, 0xc1, 0x16, 0xfb, 0x2a, 0xc5, 0x6c, 0x9c, 0xc4, 0x77, 0xf5, - 0xef, 0x99, 0xb4, 0x0f, 0x7a, 0xd4, 0x52, 0xc0, 0x41, 0x4c, 0x1e, 0xc3, 0xd6, 0x4c, 0xef, 0x83, - 0x1a, 0x72, 0xcd, 0xdb, 0x5b, 0x93, 0xc7, 0x2b, 0x7b, 0x43, 0x5f, 0x7a, 0x90, 0x87, 0x50, 0xe3, - 0x45, 0x85, 0x63, 0xb9, 0xb9, 0xa6, 0x4a, 0x05, 0xb4, 0xea, 0x53, 0x5c, 0x90, 0x13, 0xd8, 0x61, - 0x6a, 0xe8, 0x63, 0x4d, 0xd5, 0xd8, 0x54, 0x41, 0xde, 0xfc, 0x87, 0xdb, 0xd1, 0xdf, 0xa0, 0x75, - 0xb6, 0xaa, 0xef, 0x56, 0xc1, 0x8a, 0x0a, 0x9b, 0xf3, 0x43, 0x09, 0x6a, 0x5d, 0x0c, 0x32, 0xcc, - 0x8a, 0x71, 0x1c, 0xbc, 0x32, 0x8e, 0xd7, 0xd6, 0x84, 0x58, 0x41, 0xff, 0x5b, 0xd3, 0xf8, 0xde, - 0xd0, 0xd3, 0x38, 0x00, 0xc0, 0x20, 0x9a, 0x8d, 0x45, 0x10, 0xce, 0x50, 0xe7, 0xd0, 0x58, 0x61, - 0x09, 0xa2, 0x99, 0xeb, 0x77, 0x0e, 0x8f, 0x46, 0xd2, 0x4e, 0xab, 0x12, 0xab, 0xc4, 0xff, 0x7e, - 0x6c, 0xce, 0x6f, 0x25, 0xb8, 0x47, 0xf1, 0xcb, 0x4b, 0xe4, 0xe2, 0x33, 0x14, 0x81, 0x3e, 0x3f, - 0xef, 0x82, 0x95, 0x17, 0x67, 0x45, 0x67, 0xdf, 0x5c, 0x43, 0xa9, 0x0f, 0x0f, 0x5d, 0x42, 0xe5, - 0xad, 0xc1, 0x39, 0x8b, 0xce, 0xf4, 0xd1, 0x28, 0x1e, 0xf2, 0x6c, 0x08, 0x31, 0x53, 0xa9, 0xd5, - 0xa9, 0x14, 0xc9, 0x01, 0x54, 0xaf, 0xc6, 0x67, 0x2a, 0x12, 0x6f, 0x98, 0x7b, 0xe5, 0x3b, 0xf8, - 0xf5, 0x2d, 0xa4, 0x5b, 0x57, 0x85, 0xc0, 0x49, 0x0f, 0xea, 0xcb, 0x1d, 0x13, 0xb2, 0x1e, 0xbd, - 0x41, 0x0f, 0xff, 0xe6, 0x6b, 0xa3, 0xdb, 0x7c, 0xf5, 0x53, 0xed, 0xc0, 0x76, 0xa8, 0x86, 0xaf, - 0x49, 0x2a, 0x8a, 0xa4, 0xf5, 0xd7, 0x3b, 0x42, 0x6b, 0xe1, 0xca, 0x7a, 0x3d, 0x86, 0x0a, 0xcb, - 0x92, 0x69, 0x92, 0x36, 0xac, 0x3b, 0xbf, 0xf7, 0x5b, 0x5d, 0xa5, 0xda, 0xc7, 0xf9, 0xd5, 0x00, - 0x42, 0x91, 0xcf, 0x59, 0xca, 0xf1, 0xff, 0xdf, 0xf4, 0x8f, 0x5f, 0xd6, 0x5a, 0x74, 0xfb, 0x8d, - 0xb5, 0xb5, 0xde, 0xac, 0x66, 0x59, 0x6c, 0x37, 0xfc, 0xf1, 0xba, 0x65, 0xfc, 0x74, 0xdd, 0x32, - 0x7e, 0xbe, 0x6e, 0x19, 0xdf, 0xfe, 0xd2, 0xda, 0xf8, 0xe2, 0x83, 0x69, 0x22, 0xce, 0x2e, 0x43, - 0x37, 0x62, 0x17, 0xed, 0x94, 0xcf, 0xa3, 0x68, 0x3f, 0xc6, 0xbc, 0x9d, 0x22, 0x9b, 0xf0, 0xfd, - 0x60, 0x9e, 0xec, 0x4f, 0x59, 0xfb, 0xc6, 0x6f, 0xf2, 0x23, 0xfd, 0xf8, 0xae, 0xb4, 0x7b, 0x8c, - 0xec, 0xc9, 0xd0, 0xed, 0x9c, 0x0c, 0x64, 0x78, 0x7d, 0x08, 0xc2, 0x8a, 0xfa, 0x7f, 0xbe, 0xf3, - 0x47, 0x00, 0x00, 0x00, 0xff, 0xff, 0x08, 0x43, 0x06, 0xc6, 0xc1, 0x07, 0x00, 0x00, +var fileDescriptor_006ebe254dc218a3 = []byte{ + // 943 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe4, 0x56, 0xcd, 0x6e, 0x23, 0x45, + 0x10, 0xce, 0x8c, 0x27, 0x76, 0x5c, 0xb6, 0xc3, 0x6c, 0x2b, 0xd2, 0x1a, 0x83, 0xbc, 0xd1, 0x00, + 0x82, 0xc3, 0x66, 0xac, 0x18, 0x50, 0xf8, 0x59, 0x24, 0xfc, 0x33, 0x1b, 0x5b, 0x84, 0x6c, 0xd4, + 0xf6, 0x46, 0x88, 0x8b, 0x35, 0x3f, 0x65, 0x67, 0xb2, 0xce, 0xb4, 0x99, 0x99, 0x0c, 0xc9, 0x9b, + 0xf0, 0x0c, 0xdc, 0x90, 0xd0, 0x3e, 0x03, 0x47, 0x1e, 0x01, 0x85, 0x1b, 0x37, 0x4e, 0x7b, 0x43, + 0xa8, 0x7b, 0xda, 0x3f, 0x1b, 0xdb, 0x4b, 0x90, 0x10, 0x42, 0xe2, 0x56, 0x5d, 0x5d, 0xdf, 0x37, + 0x55, 0x5f, 0x57, 0x95, 0x0d, 0x6f, 0x24, 0xf5, 0x5a, 0x84, 0x61, 0xe2, 0xbb, 0x58, 0x1b, 0x85, + 0x13, 0xb7, 0x16, 0x5f, 0x4f, 0x30, 0x32, 0x27, 0x21, 0x8b, 0x19, 0xb9, 0x17, 0x20, 0x33, 0x87, + 0x91, 0x99, 0xd4, 0x4d, 0x19, 0x53, 0xb9, 0x9f, 0xd4, 0x6b, 0xb6, 0x3b, 0x5e, 0x8a, 0xad, 0x94, + 0x93, 0x7a, 0x2d, 0xc4, 0x61, 0xb4, 0x74, 0x63, 0xec, 0x43, 0xee, 0xab, 0x0e, 0xda, 0x1e, 0x86, + 0x44, 0x87, 0xcc, 0x33, 0xbc, 0x2e, 0x2b, 0xbb, 0xca, 0x7b, 0x79, 0xca, 0x4d, 0xb2, 0x03, 0x9b, + 0x89, 0x3d, 0xbe, 0xc4, 0xb2, 0x2a, 0x7c, 0xe9, 0xc1, 0xf8, 0x10, 0x72, 0xa7, 0x18, 0x46, 0x3e, + 0x0b, 0x78, 0xc0, 0x85, 0x7d, 0xce, 0x42, 0x01, 0x2a, 0xd1, 0xf4, 0x20, 0xbc, 0x7e, 0xc0, 0x42, + 0x01, 0xe3, 0x5e, 0x7e, 0x30, 0x2c, 0x28, 0xf5, 0xd9, 0x33, 0x0c, 0x8e, 0xfc, 0x21, 0xc6, 0xfe, + 0x05, 0xf2, 0xef, 0xe1, 0xd5, 0x44, 0x40, 0x35, 0xca, 0x4d, 0xee, 0x09, 0x9c, 0xa1, 0x80, 0x69, + 0x94, 0x9b, 0xdc, 0xe3, 0xdb, 0x71, 0x39, 0x93, 0x7a, 0x7c, 0x3b, 0x36, 0x5e, 0x28, 0xb0, 0xf3, + 0xc4, 0x39, 0x47, 0x37, 0xee, 0x61, 0xc4, 0x93, 0x68, 0xb1, 0x20, 0xc6, 0xab, 0x98, 0x7c, 0x0e, + 0x5a, 0x82, 0xa1, 0x23, 0xf8, 0xb6, 0xeb, 0x0f, 0xcd, 0x25, 0x79, 0xcc, 0x55, 0x30, 0xf3, 0x14, + 0x43, 0x87, 0x0a, 0x24, 0xd9, 0x87, 0x9c, 0xed, 0x79, 0x21, 0x46, 0x91, 0x48, 0xa1, 0x50, 0xbf, + 0xbf, 0x40, 0xc2, 0xe5, 0x33, 0x1b, 0xe9, 0x35, 0x9d, 0xc6, 0x19, 0xe7, 0xa0, 0x71, 0x02, 0xb2, + 0x03, 0xfa, 0xa9, 0x45, 0x9b, 0x83, 0xa7, 0xc7, 0xbd, 0x13, 0xab, 0xd5, 0x7d, 0xdc, 0xb5, 0xda, + 0xfa, 0x06, 0xc9, 0x41, 0xe6, 0xe4, 0x69, 0x5f, 0x57, 0xb8, 0x71, 0x68, 0xf5, 0x75, 0x95, 0x6c, + 0x81, 0xd6, 0xb1, 0x1a, 0x6d, 0x3d, 0x43, 0x00, 0xb2, 0x3d, 0xab, 0x41, 0x5b, 0x1d, 0x5d, 0xe3, + 0x76, 0xdb, 0x3a, 0xb2, 0xfa, 0x96, 0xbe, 0x49, 0xf2, 0xb0, 0x49, 0x1b, 0xc7, 0x87, 0x96, 0x9e, + 0x25, 0x25, 0xc8, 0x0b, 0xb3, 0xd3, 0xe8, 0x75, 0xf4, 0x9c, 0xf1, 0x87, 0x0a, 0x45, 0x99, 0xbc, + 0x10, 0x92, 0x7c, 0x04, 0x9a, 0xc3, 0xbc, 0xf4, 0xc5, 0x0a, 0xf5, 0xb7, 0x57, 0x54, 0xbc, 0x18, + 0x6e, 0x36, 0x99, 0x77, 0x4d, 0x05, 0x82, 0x7c, 0x02, 0xf9, 0xc8, 0x1f, 0x05, 0x76, 0x7c, 0x19, + 0xa2, 0xac, 0xf5, 0xcd, 0x55, 0xf0, 0x69, 0x0c, 0x9d, 0x87, 0x57, 0x5e, 0x28, 0xa0, 0x71, 0x2a, + 0xb2, 0x0d, 0xaa, 0xef, 0x89, 0x8f, 0x17, 0xa9, 0xea, 0x7b, 0xa4, 0x0e, 0x5b, 0xec, 0xdb, 0x00, + 0xc3, 0x81, 0xef, 0xad, 0xd3, 0xef, 0x09, 0xbf, 0xef, 0xb6, 0x69, 0x4e, 0x04, 0x76, 0x3d, 0xf2, + 0x08, 0xb6, 0xc6, 0xb2, 0x1f, 0xc4, 0x23, 0x17, 0xea, 0xbb, 0x2b, 0xf2, 0x78, 0xa9, 0x6f, 0xe8, + 0x0c, 0x41, 0x1e, 0x40, 0x21, 0x4a, 0x2b, 0x1c, 0xf0, 0xce, 0xd5, 0x44, 0x2a, 0x20, 0x5d, 0x5f, + 0xe0, 0x35, 0x69, 0x40, 0x96, 0x89, 0x47, 0x2f, 0x6f, 0x0a, 0xf2, 0x77, 0xef, 0xd8, 0x15, 0x9d, + 0x0d, 0x2a, 0x81, 0xcd, 0x3c, 0xe4, 0xdc, 0xd4, 0x69, 0x3c, 0x57, 0xa1, 0xd0, 0x44, 0x3b, 0xc4, + 0x30, 0xd5, 0xff, 0xe0, 0x25, 0xfd, 0xdf, 0x5a, 0xc1, 0xbd, 0x10, 0xfd, 0x4f, 0xc9, 0xff, 0xc3, + 0x54, 0xfe, 0x03, 0x00, 0xb4, 0xdd, 0xf1, 0x20, 0xb6, 0x9d, 0x31, 0xca, 0x1c, 0xca, 0x0b, 0x2c, + 0xb6, 0x3b, 0x36, 0xad, 0x46, 0xeb, 0xa8, 0xcf, 0xef, 0x69, 0x9e, 0xc7, 0x0a, 0xf3, 0xdf, 0x7f, + 0x27, 0xe3, 0x77, 0x15, 0xee, 0x51, 0xfc, 0xe6, 0x12, 0xa3, 0xf8, 0x4b, 0x8c, 0x6d, 0xb9, 0x6f, + 0x3e, 0x80, 0x5c, 0x92, 0xee, 0x11, 0x99, 0x7d, 0x65, 0x05, 0xa5, 0xdc, 0x34, 0x74, 0x1a, 0xca, + 0x97, 0x0b, 0x4e, 0x98, 0x7b, 0x26, 0xb7, 0x44, 0x7a, 0xe0, 0x7b, 0x22, 0x8e, 0xc7, 0x22, 0xb5, + 0x12, 0xe5, 0x26, 0x39, 0x80, 0xfc, 0xd5, 0xe0, 0x4c, 0x7c, 0x29, 0x2a, 0x6b, 0xbb, 0x99, 0x35, + 0xfc, 0x72, 0xf9, 0xd1, 0xad, 0xab, 0xd4, 0x88, 0x48, 0x1b, 0x4a, 0xd3, 0xa6, 0x8a, 0x79, 0x3d, + 0xb2, 0x75, 0x1e, 0xfc, 0xc5, 0x78, 0xd1, 0x62, 0xb4, 0x38, 0x9b, 0x0d, 0x28, 0x3a, 0xe2, 0xf1, + 0x25, 0x49, 0x56, 0x90, 0x54, 0x5f, 0xdd, 0x23, 0xb4, 0xe0, 0x2c, 0xb4, 0xd7, 0x23, 0xc8, 0xb2, + 0xd0, 0x1f, 0xf9, 0x41, 0x39, 0xb7, 0x76, 0xc0, 0x97, 0x54, 0xa5, 0x12, 0x63, 0xfc, 0xa6, 0x00, + 0xa1, 0x18, 0x4d, 0x58, 0x10, 0xe1, 0x7f, 0x5f, 0xf4, 0xcf, 0x66, 0xb5, 0xa6, 0x6a, 0xbf, 0xb3, + 0xb2, 0xd6, 0xdb, 0xd5, 0xcc, 0x8a, 0xdd, 0x87, 0xfc, 0x6c, 0x58, 0x16, 0x7f, 0xc7, 0x8a, 0xe9, + 0xef, 0x18, 0x01, 0x8d, 0x0f, 0x90, 0xc8, 0xbe, 0x48, 0x85, 0x6d, 0xfc, 0xa8, 0xc2, 0xeb, 0x52, + 0xbd, 0x53, 0x0c, 0xfd, 0xa1, 0xef, 0xda, 0xb1, 0xcf, 0x02, 0x29, 0x53, 0x0b, 0xb6, 0xf9, 0xa4, + 0x0e, 0xe6, 0x63, 0xaa, 0xdc, 0x61, 0x4c, 0x4b, 0x1c, 0x33, 0x4f, 0xa4, 0x05, 0xdb, 0x17, 0x18, + 0xdb, 0x83, 0xbf, 0x37, 0xeb, 0x25, 0x8e, 0x99, 0x93, 0x1c, 0x82, 0x9e, 0x16, 0xb9, 0x40, 0x93, + 0xb9, 0x03, 0xcd, 0x6b, 0x29, 0x6a, 0x4e, 0xd4, 0x9e, 0x49, 0xac, 0x09, 0xf8, 0xc3, 0xf5, 0xed, + 0xb4, 0x2c, 0xc8, 0x4c, 0xe9, 0xe7, 0x2a, 0x54, 0xa6, 0x0f, 0xf1, 0xff, 0xd0, 0xcd, 0xba, 0xa5, + 0xdb, 0xde, 0x2b, 0x5a, 0x73, 0xbd, 0x70, 0x4d, 0xe7, 0xa7, 0x9b, 0xaa, 0xf2, 0xf3, 0x4d, 0x55, + 0xf9, 0xe5, 0xa6, 0xaa, 0x7c, 0xf7, 0x6b, 0x75, 0xe3, 0xeb, 0x8f, 0x47, 0x7e, 0x7c, 0x76, 0xe9, + 0x98, 0x2e, 0xbb, 0xa8, 0x05, 0xd1, 0xc4, 0x75, 0xf7, 0x3c, 0x4c, 0x6a, 0x01, 0xb2, 0x61, 0xb4, + 0x67, 0x4f, 0xfc, 0xbd, 0x11, 0xab, 0xdd, 0xfa, 0xff, 0xf7, 0xa9, 0x3c, 0x7c, 0xaf, 0xee, 0x1c, + 0x23, 0x7b, 0xdc, 0x33, 0x1b, 0x27, 0x5d, 0x9e, 0x46, 0x2f, 0x75, 0x3b, 0x59, 0xf1, 0x9f, 0xee, + 0xfd, 0x3f, 0x03, 0x00, 0x00, 0xff, 0xff, 0x0c, 0x60, 0x03, 0xc2, 0x38, 0x0a, 0x00, 0x00, } func (m *XHeader) Marshal() (dAtA []byte, err error) { @@ -902,14 +1121,14 @@ func (m *XHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) { if len(m.Value) > 0 { i -= len(m.Value) copy(dAtA[i:], m.Value) - i = encodeVarintMeta(dAtA, i, uint64(len(m.Value))) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Value))) i-- dAtA[i] = 0x12 } if len(m.Key) > 0 { i -= len(m.Key) copy(dAtA[i:], m.Key) - i = encodeVarintMeta(dAtA, i, uint64(len(m.Key))) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Key))) i-- dAtA[i] = 0xa } @@ -941,12 +1160,12 @@ func (m *Version) MarshalToSizedBuffer(dAtA []byte) (int, error) { copy(dAtA[i:], m.XXX_unrecognized) } if m.Minor != 0 { - i = encodeVarintMeta(dAtA, i, uint64(m.Minor)) + i = encodeVarintTypes(dAtA, i, uint64(m.Minor)) i-- dAtA[i] = 0x10 } if m.Major != 0 { - i = encodeVarintMeta(dAtA, i, uint64(m.Major)) + i = encodeVarintTypes(dAtA, i, uint64(m.Major)) i-- dAtA[i] = 0x8 } @@ -978,24 +1197,24 @@ func (m *TokenLifetime) MarshalToSizedBuffer(dAtA []byte) (int, error) { copy(dAtA[i:], m.XXX_unrecognized) } if m.Iat != 0 { - i = encodeVarintMeta(dAtA, i, uint64(m.Iat)) + i = encodeVarintTypes(dAtA, i, uint64(m.Iat)) i-- dAtA[i] = 0x18 } if m.Nbf != 0 { - i = encodeVarintMeta(dAtA, i, uint64(m.Nbf)) + i = encodeVarintTypes(dAtA, i, uint64(m.Nbf)) i-- dAtA[i] = 0x10 } if m.Exp != 0 { - i = encodeVarintMeta(dAtA, i, uint64(m.Exp)) + i = encodeVarintTypes(dAtA, i, uint64(m.Exp)) i-- dAtA[i] = 0x8 } return len(dAtA) - i, nil } -func (m *ObjectServiceContext) Marshal() (dAtA []byte, err error) { +func (m *ObjectSessionContext) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1005,12 +1224,12 @@ func (m *ObjectServiceContext) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *ObjectServiceContext) MarshalTo(dAtA []byte) (int, error) { +func (m *ObjectSessionContext) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *ObjectServiceContext) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *ObjectSessionContext) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1026,13 +1245,13 @@ func (m *ObjectServiceContext) MarshalToSizedBuffer(dAtA []byte) (int, error) { return 0, err } i -= size - i = encodeVarintMeta(dAtA, i, uint64(size)) + i = encodeVarintTypes(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x12 } if m.Verb != 0 { - i = encodeVarintMeta(dAtA, i, uint64(m.Verb)) + i = encodeVarintTypes(dAtA, i, uint64(m.Verb)) i-- dAtA[i] = 0x8 } @@ -1070,7 +1289,7 @@ func (m *SessionToken) MarshalToSizedBuffer(dAtA []byte) (int, error) { return 0, err } i -= size - i = encodeVarintMeta(dAtA, i, uint64(size)) + i = encodeVarintTypes(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x12 @@ -1082,7 +1301,7 @@ func (m *SessionToken) MarshalToSizedBuffer(dAtA []byte) (int, error) { return 0, err } i -= size - i = encodeVarintMeta(dAtA, i, uint64(size)) + i = encodeVarintTypes(dAtA, i, uint64(size)) } i-- dAtA[i] = 0xa @@ -1126,7 +1345,7 @@ func (m *SessionToken_Body) MarshalToSizedBuffer(dAtA []byte) (int, error) { if len(m.SessionKey) > 0 { i -= len(m.SessionKey) copy(dAtA[i:], m.SessionKey) - i = encodeVarintMeta(dAtA, i, uint64(len(m.SessionKey))) + i = encodeVarintTypes(dAtA, i, uint64(len(m.SessionKey))) i-- dAtA[i] = 0x22 } @@ -1137,7 +1356,7 @@ func (m *SessionToken_Body) MarshalToSizedBuffer(dAtA []byte) (int, error) { return 0, err } i -= size - i = encodeVarintMeta(dAtA, i, uint64(size)) + i = encodeVarintTypes(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x1a @@ -1149,7 +1368,7 @@ func (m *SessionToken_Body) MarshalToSizedBuffer(dAtA []byte) (int, error) { return 0, err } i -= size - i = encodeVarintMeta(dAtA, i, uint64(size)) + i = encodeVarintTypes(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x12 @@ -1157,28 +1376,28 @@ func (m *SessionToken_Body) MarshalToSizedBuffer(dAtA []byte) (int, error) { if len(m.Id) > 0 { i -= len(m.Id) copy(dAtA[i:], m.Id) - i = encodeVarintMeta(dAtA, i, uint64(len(m.Id))) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Id))) i-- dAtA[i] = 0xa } return len(dAtA) - i, nil } -func (m *SessionToken_Body_ObjectService) MarshalTo(dAtA []byte) (int, error) { +func (m *SessionToken_Body_Object) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *SessionToken_Body_ObjectService) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *SessionToken_Body_Object) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) - if m.ObjectService != nil { + if m.Object != nil { { - size, err := m.ObjectService.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.Object.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } i -= size - i = encodeVarintMeta(dAtA, i, uint64(size)) + i = encodeVarintTypes(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x2a @@ -1216,7 +1435,7 @@ func (m *BearerToken) MarshalToSizedBuffer(dAtA []byte) (int, error) { return 0, err } i -= size - i = encodeVarintMeta(dAtA, i, uint64(size)) + i = encodeVarintTypes(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x12 @@ -1228,7 +1447,7 @@ func (m *BearerToken) MarshalToSizedBuffer(dAtA []byte) (int, error) { return 0, err } i -= size - i = encodeVarintMeta(dAtA, i, uint64(size)) + i = encodeVarintTypes(dAtA, i, uint64(size)) } i-- dAtA[i] = 0xa @@ -1267,7 +1486,7 @@ func (m *BearerToken_Body) MarshalToSizedBuffer(dAtA []byte) (int, error) { return 0, err } i -= size - i = encodeVarintMeta(dAtA, i, uint64(size)) + i = encodeVarintTypes(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x1a @@ -1279,7 +1498,7 @@ func (m *BearerToken_Body) MarshalToSizedBuffer(dAtA []byte) (int, error) { return 0, err } i -= size - i = encodeVarintMeta(dAtA, i, uint64(size)) + i = encodeVarintTypes(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x12 @@ -1291,7 +1510,7 @@ func (m *BearerToken_Body) MarshalToSizedBuffer(dAtA []byte) (int, error) { return 0, err } i -= size - i = encodeVarintMeta(dAtA, i, uint64(size)) + i = encodeVarintTypes(dAtA, i, uint64(size)) } i-- dAtA[i] = 0xa @@ -1330,7 +1549,7 @@ func (m *RequestMetaHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) { return 0, err } i -= size - i = encodeVarintMeta(dAtA, i, uint64(size)) + i = encodeVarintTypes(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x3a @@ -1342,7 +1561,7 @@ func (m *RequestMetaHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) { return 0, err } i -= size - i = encodeVarintMeta(dAtA, i, uint64(size)) + i = encodeVarintTypes(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x32 @@ -1354,7 +1573,7 @@ func (m *RequestMetaHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) { return 0, err } i -= size - i = encodeVarintMeta(dAtA, i, uint64(size)) + i = encodeVarintTypes(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x2a @@ -1367,19 +1586,19 @@ func (m *RequestMetaHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) { return 0, err } i -= size - i = encodeVarintMeta(dAtA, i, uint64(size)) + i = encodeVarintTypes(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x22 } } if m.Ttl != 0 { - i = encodeVarintMeta(dAtA, i, uint64(m.Ttl)) + i = encodeVarintTypes(dAtA, i, uint64(m.Ttl)) i-- dAtA[i] = 0x18 } if m.Epoch != 0 { - i = encodeVarintMeta(dAtA, i, uint64(m.Epoch)) + i = encodeVarintTypes(dAtA, i, uint64(m.Epoch)) i-- dAtA[i] = 0x10 } @@ -1390,7 +1609,7 @@ func (m *RequestMetaHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) { return 0, err } i -= size - i = encodeVarintMeta(dAtA, i, uint64(size)) + i = encodeVarintTypes(dAtA, i, uint64(size)) } i-- dAtA[i] = 0xa @@ -1429,7 +1648,7 @@ func (m *ResponseMetaHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) { return 0, err } i -= size - i = encodeVarintMeta(dAtA, i, uint64(size)) + i = encodeVarintTypes(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x2a @@ -1442,19 +1661,19 @@ func (m *ResponseMetaHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) { return 0, err } i -= size - i = encodeVarintMeta(dAtA, i, uint64(size)) + i = encodeVarintTypes(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x22 } } if m.Ttl != 0 { - i = encodeVarintMeta(dAtA, i, uint64(m.Ttl)) + i = encodeVarintTypes(dAtA, i, uint64(m.Ttl)) i-- dAtA[i] = 0x18 } if m.Epoch != 0 { - i = encodeVarintMeta(dAtA, i, uint64(m.Epoch)) + i = encodeVarintTypes(dAtA, i, uint64(m.Epoch)) i-- dAtA[i] = 0x10 } @@ -1465,7 +1684,7 @@ func (m *ResponseMetaHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) { return 0, err } i -= size - i = encodeVarintMeta(dAtA, i, uint64(size)) + i = encodeVarintTypes(dAtA, i, uint64(size)) } i-- dAtA[i] = 0xa @@ -1473,8 +1692,199 @@ func (m *ResponseMetaHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func encodeVarintMeta(dAtA []byte, offset int, v uint64) int { - offset -= sovMeta(v) +func (m *Signature) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Signature) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Signature) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Sign) > 0 { + i -= len(m.Sign) + copy(dAtA[i:], m.Sign) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Sign))) + i-- + dAtA[i] = 0x12 + } + if len(m.Key) > 0 { + i -= len(m.Key) + copy(dAtA[i:], m.Key) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Key))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *RequestVerificationHeader) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *RequestVerificationHeader) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RequestVerificationHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.Origin != nil { + { + size, err := m.Origin.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + if m.OriginSignature != nil { + { + size, err := m.OriginSignature.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + if m.MetaSignature != nil { + { + size, err := m.MetaSignature.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.BodySignature != nil { + { + size, err := m.BodySignature.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *ResponseVerificationHeader) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ResponseVerificationHeader) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ResponseVerificationHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.Origin != nil { + { + size, err := m.Origin.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + if m.OriginSignature != nil { + { + size, err := m.OriginSignature.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + if m.MetaSignature != nil { + { + size, err := m.MetaSignature.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.BodySignature != nil { + { + size, err := m.BodySignature.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintTypes(dAtA []byte, offset int, v uint64) int { + offset -= sovTypes(v) base := offset for v >= 1<<7 { dAtA[offset] = uint8(v&0x7f | 0x80) @@ -1492,11 +1902,11 @@ func (m *XHeader) Size() (n int) { _ = l l = len(m.Key) if l > 0 { - n += 1 + l + sovMeta(uint64(l)) + n += 1 + l + sovTypes(uint64(l)) } l = len(m.Value) if l > 0 { - n += 1 + l + sovMeta(uint64(l)) + n += 1 + l + sovTypes(uint64(l)) } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) @@ -1511,10 +1921,10 @@ func (m *Version) Size() (n int) { var l int _ = l if m.Major != 0 { - n += 1 + sovMeta(uint64(m.Major)) + n += 1 + sovTypes(uint64(m.Major)) } if m.Minor != 0 { - n += 1 + sovMeta(uint64(m.Minor)) + n += 1 + sovTypes(uint64(m.Minor)) } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) @@ -1529,13 +1939,13 @@ func (m *TokenLifetime) Size() (n int) { var l int _ = l if m.Exp != 0 { - n += 1 + sovMeta(uint64(m.Exp)) + n += 1 + sovTypes(uint64(m.Exp)) } if m.Nbf != 0 { - n += 1 + sovMeta(uint64(m.Nbf)) + n += 1 + sovTypes(uint64(m.Nbf)) } if m.Iat != 0 { - n += 1 + sovMeta(uint64(m.Iat)) + n += 1 + sovTypes(uint64(m.Iat)) } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) @@ -1543,18 +1953,18 @@ func (m *TokenLifetime) Size() (n int) { return n } -func (m *ObjectServiceContext) Size() (n int) { +func (m *ObjectSessionContext) Size() (n int) { if m == nil { return 0 } var l int _ = l if m.Verb != 0 { - n += 1 + sovMeta(uint64(m.Verb)) + n += 1 + sovTypes(uint64(m.Verb)) } if m.Address != nil { l = m.Address.Size() - n += 1 + l + sovMeta(uint64(l)) + n += 1 + l + sovTypes(uint64(l)) } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) @@ -1570,11 +1980,11 @@ func (m *SessionToken) Size() (n int) { _ = l if m.Body != nil { l = m.Body.Size() - n += 1 + l + sovMeta(uint64(l)) + n += 1 + l + sovTypes(uint64(l)) } if m.Signature != nil { l = m.Signature.Size() - n += 1 + l + sovMeta(uint64(l)) + n += 1 + l + sovTypes(uint64(l)) } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) @@ -1590,19 +2000,19 @@ func (m *SessionToken_Body) Size() (n int) { _ = l l = len(m.Id) if l > 0 { - n += 1 + l + sovMeta(uint64(l)) + n += 1 + l + sovTypes(uint64(l)) } if m.OwnerId != nil { l = m.OwnerId.Size() - n += 1 + l + sovMeta(uint64(l)) + n += 1 + l + sovTypes(uint64(l)) } if m.Lifetime != nil { l = m.Lifetime.Size() - n += 1 + l + sovMeta(uint64(l)) + n += 1 + l + sovTypes(uint64(l)) } l = len(m.SessionKey) if l > 0 { - n += 1 + l + sovMeta(uint64(l)) + n += 1 + l + sovTypes(uint64(l)) } if m.Context != nil { n += m.Context.Size() @@ -1613,15 +2023,15 @@ func (m *SessionToken_Body) Size() (n int) { return n } -func (m *SessionToken_Body_ObjectService) Size() (n int) { +func (m *SessionToken_Body_Object) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.ObjectService != nil { - l = m.ObjectService.Size() - n += 1 + l + sovMeta(uint64(l)) + if m.Object != nil { + l = m.Object.Size() + n += 1 + l + sovTypes(uint64(l)) } return n } @@ -1633,11 +2043,11 @@ func (m *BearerToken) Size() (n int) { _ = l if m.Body != nil { l = m.Body.Size() - n += 1 + l + sovMeta(uint64(l)) + n += 1 + l + sovTypes(uint64(l)) } if m.Signature != nil { l = m.Signature.Size() - n += 1 + l + sovMeta(uint64(l)) + n += 1 + l + sovTypes(uint64(l)) } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) @@ -1653,15 +2063,15 @@ func (m *BearerToken_Body) Size() (n int) { _ = l if m.EaclTable != nil { l = m.EaclTable.Size() - n += 1 + l + sovMeta(uint64(l)) + n += 1 + l + sovTypes(uint64(l)) } if m.OwnerId != nil { l = m.OwnerId.Size() - n += 1 + l + sovMeta(uint64(l)) + n += 1 + l + sovTypes(uint64(l)) } if m.Lifetime != nil { l = m.Lifetime.Size() - n += 1 + l + sovMeta(uint64(l)) + n += 1 + l + sovTypes(uint64(l)) } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) @@ -1677,31 +2087,31 @@ func (m *RequestMetaHeader) Size() (n int) { _ = l if m.Version != nil { l = m.Version.Size() - n += 1 + l + sovMeta(uint64(l)) + n += 1 + l + sovTypes(uint64(l)) } if m.Epoch != 0 { - n += 1 + sovMeta(uint64(m.Epoch)) + n += 1 + sovTypes(uint64(m.Epoch)) } if m.Ttl != 0 { - n += 1 + sovMeta(uint64(m.Ttl)) + n += 1 + sovTypes(uint64(m.Ttl)) } if len(m.XHeaders) > 0 { for _, e := range m.XHeaders { l = e.Size() - n += 1 + l + sovMeta(uint64(l)) + n += 1 + l + sovTypes(uint64(l)) } } if m.SessionToken != nil { l = m.SessionToken.Size() - n += 1 + l + sovMeta(uint64(l)) + n += 1 + l + sovTypes(uint64(l)) } if m.BearerToken != nil { l = m.BearerToken.Size() - n += 1 + l + sovMeta(uint64(l)) + n += 1 + l + sovTypes(uint64(l)) } if m.Origin != nil { l = m.Origin.Size() - n += 1 + l + sovMeta(uint64(l)) + n += 1 + l + sovTypes(uint64(l)) } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) @@ -1717,23 +2127,23 @@ func (m *ResponseMetaHeader) Size() (n int) { _ = l if m.Version != nil { l = m.Version.Size() - n += 1 + l + sovMeta(uint64(l)) + n += 1 + l + sovTypes(uint64(l)) } if m.Epoch != 0 { - n += 1 + sovMeta(uint64(m.Epoch)) + n += 1 + sovTypes(uint64(m.Epoch)) } if m.Ttl != 0 { - n += 1 + sovMeta(uint64(m.Ttl)) + n += 1 + sovTypes(uint64(m.Ttl)) } if len(m.XHeaders) > 0 { for _, e := range m.XHeaders { l = e.Size() - n += 1 + l + sovMeta(uint64(l)) + n += 1 + l + sovTypes(uint64(l)) } } if m.Origin != nil { l = m.Origin.Size() - n += 1 + l + sovMeta(uint64(l)) + n += 1 + l + sovTypes(uint64(l)) } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) @@ -1741,11 +2151,87 @@ func (m *ResponseMetaHeader) Size() (n int) { return n } -func sovMeta(x uint64) (n int) { +func (m *Signature) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Key) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.Sign) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *RequestVerificationHeader) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.BodySignature != nil { + l = m.BodySignature.Size() + n += 1 + l + sovTypes(uint64(l)) + } + if m.MetaSignature != nil { + l = m.MetaSignature.Size() + n += 1 + l + sovTypes(uint64(l)) + } + if m.OriginSignature != nil { + l = m.OriginSignature.Size() + n += 1 + l + sovTypes(uint64(l)) + } + if m.Origin != nil { + l = m.Origin.Size() + n += 1 + l + sovTypes(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *ResponseVerificationHeader) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.BodySignature != nil { + l = m.BodySignature.Size() + n += 1 + l + sovTypes(uint64(l)) + } + if m.MetaSignature != nil { + l = m.MetaSignature.Size() + n += 1 + l + sovTypes(uint64(l)) + } + if m.OriginSignature != nil { + l = m.OriginSignature.Size() + n += 1 + l + sovTypes(uint64(l)) + } + if m.Origin != nil { + l = m.Origin.Size() + n += 1 + l + sovTypes(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovTypes(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } -func sozMeta(x uint64) (n int) { - return sovMeta(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +func sozTypes(x uint64) (n int) { + return sovTypes(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } func (m *XHeader) Unmarshal(dAtA []byte) error { l := len(dAtA) @@ -1755,7 +2241,7 @@ func (m *XHeader) Unmarshal(dAtA []byte) error { var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowMeta + return ErrIntOverflowTypes } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -1783,7 +2269,7 @@ func (m *XHeader) Unmarshal(dAtA []byte) error { var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowMeta + return ErrIntOverflowTypes } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -1797,11 +2283,11 @@ func (m *XHeader) Unmarshal(dAtA []byte) error { } intStringLen := int(stringLen) if intStringLen < 0 { - return ErrInvalidLengthMeta + return ErrInvalidLengthTypes } postIndex := iNdEx + intStringLen if postIndex < 0 { - return ErrInvalidLengthMeta + return ErrInvalidLengthTypes } if postIndex > l { return io.ErrUnexpectedEOF @@ -1815,7 +2301,7 @@ func (m *XHeader) Unmarshal(dAtA []byte) error { var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowMeta + return ErrIntOverflowTypes } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -1829,11 +2315,11 @@ func (m *XHeader) Unmarshal(dAtA []byte) error { } intStringLen := int(stringLen) if intStringLen < 0 { - return ErrInvalidLengthMeta + return ErrInvalidLengthTypes } postIndex := iNdEx + intStringLen if postIndex < 0 { - return ErrInvalidLengthMeta + return ErrInvalidLengthTypes } if postIndex > l { return io.ErrUnexpectedEOF @@ -1842,15 +2328,15 @@ func (m *XHeader) Unmarshal(dAtA []byte) error { iNdEx = postIndex default: iNdEx = preIndex - skippy, err := skipMeta(dAtA[iNdEx:]) + skippy, err := skipTypes(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { - return ErrInvalidLengthMeta + return ErrInvalidLengthTypes } if (iNdEx + skippy) < 0 { - return ErrInvalidLengthMeta + return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF @@ -1873,7 +2359,7 @@ func (m *Version) Unmarshal(dAtA []byte) error { var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowMeta + return ErrIntOverflowTypes } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -1901,7 +2387,7 @@ func (m *Version) Unmarshal(dAtA []byte) error { m.Major = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowMeta + return ErrIntOverflowTypes } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -1920,7 +2406,7 @@ func (m *Version) Unmarshal(dAtA []byte) error { m.Minor = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowMeta + return ErrIntOverflowTypes } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -1934,15 +2420,15 @@ func (m *Version) Unmarshal(dAtA []byte) error { } default: iNdEx = preIndex - skippy, err := skipMeta(dAtA[iNdEx:]) + skippy, err := skipTypes(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { - return ErrInvalidLengthMeta + return ErrInvalidLengthTypes } if (iNdEx + skippy) < 0 { - return ErrInvalidLengthMeta + return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF @@ -1965,7 +2451,7 @@ func (m *TokenLifetime) Unmarshal(dAtA []byte) error { var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowMeta + return ErrIntOverflowTypes } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -1993,7 +2479,7 @@ func (m *TokenLifetime) Unmarshal(dAtA []byte) error { m.Exp = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowMeta + return ErrIntOverflowTypes } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -2012,7 +2498,7 @@ func (m *TokenLifetime) Unmarshal(dAtA []byte) error { m.Nbf = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowMeta + return ErrIntOverflowTypes } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -2031,7 +2517,7 @@ func (m *TokenLifetime) Unmarshal(dAtA []byte) error { m.Iat = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowMeta + return ErrIntOverflowTypes } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -2045,15 +2531,15 @@ func (m *TokenLifetime) Unmarshal(dAtA []byte) error { } default: iNdEx = preIndex - skippy, err := skipMeta(dAtA[iNdEx:]) + skippy, err := skipTypes(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { - return ErrInvalidLengthMeta + return ErrInvalidLengthTypes } if (iNdEx + skippy) < 0 { - return ErrInvalidLengthMeta + return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF @@ -2068,7 +2554,7 @@ func (m *TokenLifetime) Unmarshal(dAtA []byte) error { } return nil } -func (m *ObjectServiceContext) Unmarshal(dAtA []byte) error { +func (m *ObjectSessionContext) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2076,7 +2562,7 @@ func (m *ObjectServiceContext) Unmarshal(dAtA []byte) error { var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowMeta + return ErrIntOverflowTypes } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -2091,10 +2577,10 @@ func (m *ObjectServiceContext) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: ObjectServiceContext: wiretype end group for non-group") + return fmt.Errorf("proto: ObjectSessionContext: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: ObjectServiceContext: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: ObjectSessionContext: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -2104,14 +2590,14 @@ func (m *ObjectServiceContext) Unmarshal(dAtA []byte) error { m.Verb = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowMeta + return ErrIntOverflowTypes } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ - m.Verb |= ObjectServiceContext_Verb(b&0x7F) << shift + m.Verb |= ObjectSessionContext_Verb(b&0x7F) << shift if b < 0x80 { break } @@ -2123,7 +2609,7 @@ func (m *ObjectServiceContext) Unmarshal(dAtA []byte) error { var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowMeta + return ErrIntOverflowTypes } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -2136,11 +2622,11 @@ func (m *ObjectServiceContext) Unmarshal(dAtA []byte) error { } } if msglen < 0 { - return ErrInvalidLengthMeta + return ErrInvalidLengthTypes } postIndex := iNdEx + msglen if postIndex < 0 { - return ErrInvalidLengthMeta + return ErrInvalidLengthTypes } if postIndex > l { return io.ErrUnexpectedEOF @@ -2154,15 +2640,15 @@ func (m *ObjectServiceContext) Unmarshal(dAtA []byte) error { iNdEx = postIndex default: iNdEx = preIndex - skippy, err := skipMeta(dAtA[iNdEx:]) + skippy, err := skipTypes(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { - return ErrInvalidLengthMeta + return ErrInvalidLengthTypes } if (iNdEx + skippy) < 0 { - return ErrInvalidLengthMeta + return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF @@ -2185,7 +2671,7 @@ func (m *SessionToken) Unmarshal(dAtA []byte) error { var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowMeta + return ErrIntOverflowTypes } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -2213,7 +2699,7 @@ func (m *SessionToken) Unmarshal(dAtA []byte) error { var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowMeta + return ErrIntOverflowTypes } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -2226,11 +2712,11 @@ func (m *SessionToken) Unmarshal(dAtA []byte) error { } } if msglen < 0 { - return ErrInvalidLengthMeta + return ErrInvalidLengthTypes } postIndex := iNdEx + msglen if postIndex < 0 { - return ErrInvalidLengthMeta + return ErrInvalidLengthTypes } if postIndex > l { return io.ErrUnexpectedEOF @@ -2249,7 +2735,7 @@ func (m *SessionToken) Unmarshal(dAtA []byte) error { var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowMeta + return ErrIntOverflowTypes } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -2262,11 +2748,11 @@ func (m *SessionToken) Unmarshal(dAtA []byte) error { } } if msglen < 0 { - return ErrInvalidLengthMeta + return ErrInvalidLengthTypes } postIndex := iNdEx + msglen if postIndex < 0 { - return ErrInvalidLengthMeta + return ErrInvalidLengthTypes } if postIndex > l { return io.ErrUnexpectedEOF @@ -2280,15 +2766,15 @@ func (m *SessionToken) Unmarshal(dAtA []byte) error { iNdEx = postIndex default: iNdEx = preIndex - skippy, err := skipMeta(dAtA[iNdEx:]) + skippy, err := skipTypes(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { - return ErrInvalidLengthMeta + return ErrInvalidLengthTypes } if (iNdEx + skippy) < 0 { - return ErrInvalidLengthMeta + return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF @@ -2311,7 +2797,7 @@ func (m *SessionToken_Body) Unmarshal(dAtA []byte) error { var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowMeta + return ErrIntOverflowTypes } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -2339,7 +2825,7 @@ func (m *SessionToken_Body) Unmarshal(dAtA []byte) error { var byteLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowMeta + return ErrIntOverflowTypes } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -2352,11 +2838,11 @@ func (m *SessionToken_Body) Unmarshal(dAtA []byte) error { } } if byteLen < 0 { - return ErrInvalidLengthMeta + return ErrInvalidLengthTypes } postIndex := iNdEx + byteLen if postIndex < 0 { - return ErrInvalidLengthMeta + return ErrInvalidLengthTypes } if postIndex > l { return io.ErrUnexpectedEOF @@ -2373,7 +2859,7 @@ func (m *SessionToken_Body) Unmarshal(dAtA []byte) error { var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowMeta + return ErrIntOverflowTypes } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -2386,11 +2872,11 @@ func (m *SessionToken_Body) Unmarshal(dAtA []byte) error { } } if msglen < 0 { - return ErrInvalidLengthMeta + return ErrInvalidLengthTypes } postIndex := iNdEx + msglen if postIndex < 0 { - return ErrInvalidLengthMeta + return ErrInvalidLengthTypes } if postIndex > l { return io.ErrUnexpectedEOF @@ -2409,7 +2895,7 @@ func (m *SessionToken_Body) Unmarshal(dAtA []byte) error { var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowMeta + return ErrIntOverflowTypes } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -2422,11 +2908,11 @@ func (m *SessionToken_Body) Unmarshal(dAtA []byte) error { } } if msglen < 0 { - return ErrInvalidLengthMeta + return ErrInvalidLengthTypes } postIndex := iNdEx + msglen if postIndex < 0 { - return ErrInvalidLengthMeta + return ErrInvalidLengthTypes } if postIndex > l { return io.ErrUnexpectedEOF @@ -2445,7 +2931,7 @@ func (m *SessionToken_Body) Unmarshal(dAtA []byte) error { var byteLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowMeta + return ErrIntOverflowTypes } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -2458,11 +2944,11 @@ func (m *SessionToken_Body) Unmarshal(dAtA []byte) error { } } if byteLen < 0 { - return ErrInvalidLengthMeta + return ErrInvalidLengthTypes } postIndex := iNdEx + byteLen if postIndex < 0 { - return ErrInvalidLengthMeta + return ErrInvalidLengthTypes } if postIndex > l { return io.ErrUnexpectedEOF @@ -2474,12 +2960,12 @@ func (m *SessionToken_Body) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 5: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ObjectService", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Object", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowMeta + return ErrIntOverflowTypes } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -2492,32 +2978,32 @@ func (m *SessionToken_Body) Unmarshal(dAtA []byte) error { } } if msglen < 0 { - return ErrInvalidLengthMeta + return ErrInvalidLengthTypes } postIndex := iNdEx + msglen if postIndex < 0 { - return ErrInvalidLengthMeta + return ErrInvalidLengthTypes } if postIndex > l { return io.ErrUnexpectedEOF } - v := &ObjectServiceContext{} + v := &ObjectSessionContext{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } - m.Context = &SessionToken_Body_ObjectService{v} + m.Context = &SessionToken_Body_Object{v} iNdEx = postIndex default: iNdEx = preIndex - skippy, err := skipMeta(dAtA[iNdEx:]) + skippy, err := skipTypes(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { - return ErrInvalidLengthMeta + return ErrInvalidLengthTypes } if (iNdEx + skippy) < 0 { - return ErrInvalidLengthMeta + return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF @@ -2540,7 +3026,7 @@ func (m *BearerToken) Unmarshal(dAtA []byte) error { var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowMeta + return ErrIntOverflowTypes } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -2568,7 +3054,7 @@ func (m *BearerToken) Unmarshal(dAtA []byte) error { var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowMeta + return ErrIntOverflowTypes } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -2581,11 +3067,11 @@ func (m *BearerToken) Unmarshal(dAtA []byte) error { } } if msglen < 0 { - return ErrInvalidLengthMeta + return ErrInvalidLengthTypes } postIndex := iNdEx + msglen if postIndex < 0 { - return ErrInvalidLengthMeta + return ErrInvalidLengthTypes } if postIndex > l { return io.ErrUnexpectedEOF @@ -2604,7 +3090,7 @@ func (m *BearerToken) Unmarshal(dAtA []byte) error { var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowMeta + return ErrIntOverflowTypes } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -2617,11 +3103,11 @@ func (m *BearerToken) Unmarshal(dAtA []byte) error { } } if msglen < 0 { - return ErrInvalidLengthMeta + return ErrInvalidLengthTypes } postIndex := iNdEx + msglen if postIndex < 0 { - return ErrInvalidLengthMeta + return ErrInvalidLengthTypes } if postIndex > l { return io.ErrUnexpectedEOF @@ -2635,15 +3121,15 @@ func (m *BearerToken) Unmarshal(dAtA []byte) error { iNdEx = postIndex default: iNdEx = preIndex - skippy, err := skipMeta(dAtA[iNdEx:]) + skippy, err := skipTypes(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { - return ErrInvalidLengthMeta + return ErrInvalidLengthTypes } if (iNdEx + skippy) < 0 { - return ErrInvalidLengthMeta + return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF @@ -2666,7 +3152,7 @@ func (m *BearerToken_Body) Unmarshal(dAtA []byte) error { var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowMeta + return ErrIntOverflowTypes } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -2694,7 +3180,7 @@ func (m *BearerToken_Body) Unmarshal(dAtA []byte) error { var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowMeta + return ErrIntOverflowTypes } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -2707,11 +3193,11 @@ func (m *BearerToken_Body) Unmarshal(dAtA []byte) error { } } if msglen < 0 { - return ErrInvalidLengthMeta + return ErrInvalidLengthTypes } postIndex := iNdEx + msglen if postIndex < 0 { - return ErrInvalidLengthMeta + return ErrInvalidLengthTypes } if postIndex > l { return io.ErrUnexpectedEOF @@ -2730,7 +3216,7 @@ func (m *BearerToken_Body) Unmarshal(dAtA []byte) error { var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowMeta + return ErrIntOverflowTypes } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -2743,11 +3229,11 @@ func (m *BearerToken_Body) Unmarshal(dAtA []byte) error { } } if msglen < 0 { - return ErrInvalidLengthMeta + return ErrInvalidLengthTypes } postIndex := iNdEx + msglen if postIndex < 0 { - return ErrInvalidLengthMeta + return ErrInvalidLengthTypes } if postIndex > l { return io.ErrUnexpectedEOF @@ -2766,7 +3252,7 @@ func (m *BearerToken_Body) Unmarshal(dAtA []byte) error { var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowMeta + return ErrIntOverflowTypes } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -2779,11 +3265,11 @@ func (m *BearerToken_Body) Unmarshal(dAtA []byte) error { } } if msglen < 0 { - return ErrInvalidLengthMeta + return ErrInvalidLengthTypes } postIndex := iNdEx + msglen if postIndex < 0 { - return ErrInvalidLengthMeta + return ErrInvalidLengthTypes } if postIndex > l { return io.ErrUnexpectedEOF @@ -2797,15 +3283,15 @@ func (m *BearerToken_Body) Unmarshal(dAtA []byte) error { iNdEx = postIndex default: iNdEx = preIndex - skippy, err := skipMeta(dAtA[iNdEx:]) + skippy, err := skipTypes(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { - return ErrInvalidLengthMeta + return ErrInvalidLengthTypes } if (iNdEx + skippy) < 0 { - return ErrInvalidLengthMeta + return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF @@ -2828,7 +3314,7 @@ func (m *RequestMetaHeader) Unmarshal(dAtA []byte) error { var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowMeta + return ErrIntOverflowTypes } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -2856,7 +3342,7 @@ func (m *RequestMetaHeader) Unmarshal(dAtA []byte) error { var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowMeta + return ErrIntOverflowTypes } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -2869,11 +3355,11 @@ func (m *RequestMetaHeader) Unmarshal(dAtA []byte) error { } } if msglen < 0 { - return ErrInvalidLengthMeta + return ErrInvalidLengthTypes } postIndex := iNdEx + msglen if postIndex < 0 { - return ErrInvalidLengthMeta + return ErrInvalidLengthTypes } if postIndex > l { return io.ErrUnexpectedEOF @@ -2892,7 +3378,7 @@ func (m *RequestMetaHeader) Unmarshal(dAtA []byte) error { m.Epoch = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowMeta + return ErrIntOverflowTypes } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -2911,7 +3397,7 @@ func (m *RequestMetaHeader) Unmarshal(dAtA []byte) error { m.Ttl = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowMeta + return ErrIntOverflowTypes } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -2930,7 +3416,7 @@ func (m *RequestMetaHeader) Unmarshal(dAtA []byte) error { var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowMeta + return ErrIntOverflowTypes } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -2943,11 +3429,11 @@ func (m *RequestMetaHeader) Unmarshal(dAtA []byte) error { } } if msglen < 0 { - return ErrInvalidLengthMeta + return ErrInvalidLengthTypes } postIndex := iNdEx + msglen if postIndex < 0 { - return ErrInvalidLengthMeta + return ErrInvalidLengthTypes } if postIndex > l { return io.ErrUnexpectedEOF @@ -2964,7 +3450,7 @@ func (m *RequestMetaHeader) Unmarshal(dAtA []byte) error { var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowMeta + return ErrIntOverflowTypes } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -2977,11 +3463,11 @@ func (m *RequestMetaHeader) Unmarshal(dAtA []byte) error { } } if msglen < 0 { - return ErrInvalidLengthMeta + return ErrInvalidLengthTypes } postIndex := iNdEx + msglen if postIndex < 0 { - return ErrInvalidLengthMeta + return ErrInvalidLengthTypes } if postIndex > l { return io.ErrUnexpectedEOF @@ -3000,7 +3486,7 @@ func (m *RequestMetaHeader) Unmarshal(dAtA []byte) error { var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowMeta + return ErrIntOverflowTypes } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -3013,11 +3499,11 @@ func (m *RequestMetaHeader) Unmarshal(dAtA []byte) error { } } if msglen < 0 { - return ErrInvalidLengthMeta + return ErrInvalidLengthTypes } postIndex := iNdEx + msglen if postIndex < 0 { - return ErrInvalidLengthMeta + return ErrInvalidLengthTypes } if postIndex > l { return io.ErrUnexpectedEOF @@ -3036,7 +3522,7 @@ func (m *RequestMetaHeader) Unmarshal(dAtA []byte) error { var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowMeta + return ErrIntOverflowTypes } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -3049,11 +3535,11 @@ func (m *RequestMetaHeader) Unmarshal(dAtA []byte) error { } } if msglen < 0 { - return ErrInvalidLengthMeta + return ErrInvalidLengthTypes } postIndex := iNdEx + msglen if postIndex < 0 { - return ErrInvalidLengthMeta + return ErrInvalidLengthTypes } if postIndex > l { return io.ErrUnexpectedEOF @@ -3067,15 +3553,15 @@ func (m *RequestMetaHeader) Unmarshal(dAtA []byte) error { iNdEx = postIndex default: iNdEx = preIndex - skippy, err := skipMeta(dAtA[iNdEx:]) + skippy, err := skipTypes(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { - return ErrInvalidLengthMeta + return ErrInvalidLengthTypes } if (iNdEx + skippy) < 0 { - return ErrInvalidLengthMeta + return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF @@ -3098,7 +3584,7 @@ func (m *ResponseMetaHeader) Unmarshal(dAtA []byte) error { var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowMeta + return ErrIntOverflowTypes } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -3126,7 +3612,7 @@ func (m *ResponseMetaHeader) Unmarshal(dAtA []byte) error { var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowMeta + return ErrIntOverflowTypes } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -3139,11 +3625,11 @@ func (m *ResponseMetaHeader) Unmarshal(dAtA []byte) error { } } if msglen < 0 { - return ErrInvalidLengthMeta + return ErrInvalidLengthTypes } postIndex := iNdEx + msglen if postIndex < 0 { - return ErrInvalidLengthMeta + return ErrInvalidLengthTypes } if postIndex > l { return io.ErrUnexpectedEOF @@ -3162,7 +3648,7 @@ func (m *ResponseMetaHeader) Unmarshal(dAtA []byte) error { m.Epoch = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowMeta + return ErrIntOverflowTypes } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -3181,7 +3667,7 @@ func (m *ResponseMetaHeader) Unmarshal(dAtA []byte) error { m.Ttl = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowMeta + return ErrIntOverflowTypes } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -3200,7 +3686,7 @@ func (m *ResponseMetaHeader) Unmarshal(dAtA []byte) error { var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowMeta + return ErrIntOverflowTypes } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -3213,11 +3699,11 @@ func (m *ResponseMetaHeader) Unmarshal(dAtA []byte) error { } } if msglen < 0 { - return ErrInvalidLengthMeta + return ErrInvalidLengthTypes } postIndex := iNdEx + msglen if postIndex < 0 { - return ErrInvalidLengthMeta + return ErrInvalidLengthTypes } if postIndex > l { return io.ErrUnexpectedEOF @@ -3234,7 +3720,7 @@ func (m *ResponseMetaHeader) Unmarshal(dAtA []byte) error { var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowMeta + return ErrIntOverflowTypes } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -3247,11 +3733,11 @@ func (m *ResponseMetaHeader) Unmarshal(dAtA []byte) error { } } if msglen < 0 { - return ErrInvalidLengthMeta + return ErrInvalidLengthTypes } postIndex := iNdEx + msglen if postIndex < 0 { - return ErrInvalidLengthMeta + return ErrInvalidLengthTypes } if postIndex > l { return io.ErrUnexpectedEOF @@ -3265,15 +3751,15 @@ func (m *ResponseMetaHeader) Unmarshal(dAtA []byte) error { iNdEx = postIndex default: iNdEx = preIndex - skippy, err := skipMeta(dAtA[iNdEx:]) + skippy, err := skipTypes(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { - return ErrInvalidLengthMeta + return ErrInvalidLengthTypes } if (iNdEx + skippy) < 0 { - return ErrInvalidLengthMeta + return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF @@ -3288,7 +3774,525 @@ func (m *ResponseMetaHeader) Unmarshal(dAtA []byte) error { } return nil } -func skipMeta(dAtA []byte) (n int, err error) { +func (m *Signature) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Signature: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Signature: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Key = append(m.Key[:0], dAtA[iNdEx:postIndex]...) + if m.Key == nil { + m.Key = []byte{} + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sign", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Sign = append(m.Sign[:0], dAtA[iNdEx:postIndex]...) + if m.Sign == nil { + m.Sign = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RequestVerificationHeader) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: RequestVerificationHeader: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RequestVerificationHeader: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BodySignature", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.BodySignature == nil { + m.BodySignature = &Signature{} + } + if err := m.BodySignature.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MetaSignature", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.MetaSignature == nil { + m.MetaSignature = &Signature{} + } + if err := m.MetaSignature.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OriginSignature", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.OriginSignature == nil { + m.OriginSignature = &Signature{} + } + if err := m.OriginSignature.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Origin", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Origin == nil { + m.Origin = &RequestVerificationHeader{} + } + if err := m.Origin.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ResponseVerificationHeader) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ResponseVerificationHeader: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ResponseVerificationHeader: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BodySignature", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.BodySignature == nil { + m.BodySignature = &Signature{} + } + if err := m.BodySignature.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MetaSignature", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.MetaSignature == nil { + m.MetaSignature = &Signature{} + } + if err := m.MetaSignature.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OriginSignature", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.OriginSignature == nil { + m.OriginSignature = &Signature{} + } + if err := m.OriginSignature.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Origin", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Origin == nil { + m.Origin = &ResponseVerificationHeader{} + } + if err := m.Origin.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipTypes(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 depth := 0 @@ -3296,7 +4300,7 @@ func skipMeta(dAtA []byte) (n int, err error) { var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return 0, ErrIntOverflowMeta + return 0, ErrIntOverflowTypes } if iNdEx >= l { return 0, io.ErrUnexpectedEOF @@ -3313,7 +4317,7 @@ func skipMeta(dAtA []byte) (n int, err error) { case 0: for shift := uint(0); ; shift += 7 { if shift >= 64 { - return 0, ErrIntOverflowMeta + return 0, ErrIntOverflowTypes } if iNdEx >= l { return 0, io.ErrUnexpectedEOF @@ -3329,7 +4333,7 @@ func skipMeta(dAtA []byte) (n int, err error) { var length int for shift := uint(0); ; shift += 7 { if shift >= 64 { - return 0, ErrIntOverflowMeta + return 0, ErrIntOverflowTypes } if iNdEx >= l { return 0, io.ErrUnexpectedEOF @@ -3342,14 +4346,14 @@ func skipMeta(dAtA []byte) (n int, err error) { } } if length < 0 { - return 0, ErrInvalidLengthMeta + return 0, ErrInvalidLengthTypes } iNdEx += length case 3: depth++ case 4: if depth == 0 { - return 0, ErrUnexpectedEndOfGroupMeta + return 0, ErrUnexpectedEndOfGroupTypes } depth-- case 5: @@ -3358,7 +4362,7 @@ func skipMeta(dAtA []byte) (n int, err error) { return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } if iNdEx < 0 { - return 0, ErrInvalidLengthMeta + return 0, ErrInvalidLengthTypes } if depth == 0 { return iNdEx, nil @@ -3368,7 +4372,7 @@ func skipMeta(dAtA []byte) (n int, err error) { } var ( - ErrInvalidLengthMeta = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowMeta = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupMeta = fmt.Errorf("proto: unexpected end of group") + ErrInvalidLengthTypes = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTypes = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTypes = fmt.Errorf("proto: unexpected end of group") ) diff --git a/v2/service/grpc/verify.pb.go b/v2/service/grpc/verify.pb.go deleted file mode 100644 index 4c20515..0000000 --- a/v2/service/grpc/verify.pb.go +++ /dev/null @@ -1,1153 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: v2/service/grpc/verify.proto - -package service - -import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package - -// Signature of something in NeoFS -type Signature struct { - // Public key used for signing. - Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - // Signature - Sign []byte `protobuf:"bytes,2,opt,name=sign,proto3" json:"sign,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Signature) Reset() { *m = Signature{} } -func (m *Signature) String() string { return proto.CompactTextString(m) } -func (*Signature) ProtoMessage() {} -func (*Signature) Descriptor() ([]byte, []int) { - return fileDescriptor_333853833d6163d3, []int{0} -} -func (m *Signature) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Signature) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Signature.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *Signature) XXX_Merge(src proto.Message) { - xxx_messageInfo_Signature.Merge(m, src) -} -func (m *Signature) XXX_Size() int { - return m.Size() -} -func (m *Signature) XXX_DiscardUnknown() { - xxx_messageInfo_Signature.DiscardUnknown(m) -} - -var xxx_messageInfo_Signature proto.InternalMessageInfo - -func (m *Signature) GetKey() []byte { - if m != nil { - return m.Key - } - return nil -} - -func (m *Signature) GetSign() []byte { - if m != nil { - return m.Sign - } - return nil -} - -// Verification info for request signed by all intermediate nodes -type RequestVerificationHeader struct { - // Request Body signature. Should be generated once by request initiator. - BodySignature *Signature `protobuf:"bytes,1,opt,name=body_signature,json=bodySignature,proto3" json:"body_signature,omitempty"` - // Request Meta signature is added and signed by any intermediate node - MetaSignature *Signature `protobuf:"bytes,2,opt,name=meta_signature,json=metaSignature,proto3" json:"meta_signature,omitempty"` - // Sign previous hops - OriginSignature *Signature `protobuf:"bytes,3,opt,name=origin_signature,json=originSignature,proto3" json:"origin_signature,omitempty"` - // Chain of previous hops signatures - Origin *RequestVerificationHeader `protobuf:"bytes,4,opt,name=origin,proto3" json:"origin,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *RequestVerificationHeader) Reset() { *m = RequestVerificationHeader{} } -func (m *RequestVerificationHeader) String() string { return proto.CompactTextString(m) } -func (*RequestVerificationHeader) ProtoMessage() {} -func (*RequestVerificationHeader) Descriptor() ([]byte, []int) { - return fileDescriptor_333853833d6163d3, []int{1} -} -func (m *RequestVerificationHeader) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *RequestVerificationHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_RequestVerificationHeader.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *RequestVerificationHeader) XXX_Merge(src proto.Message) { - xxx_messageInfo_RequestVerificationHeader.Merge(m, src) -} -func (m *RequestVerificationHeader) XXX_Size() int { - return m.Size() -} -func (m *RequestVerificationHeader) XXX_DiscardUnknown() { - xxx_messageInfo_RequestVerificationHeader.DiscardUnknown(m) -} - -var xxx_messageInfo_RequestVerificationHeader proto.InternalMessageInfo - -func (m *RequestVerificationHeader) GetBodySignature() *Signature { - if m != nil { - return m.BodySignature - } - return nil -} - -func (m *RequestVerificationHeader) GetMetaSignature() *Signature { - if m != nil { - return m.MetaSignature - } - return nil -} - -func (m *RequestVerificationHeader) GetOriginSignature() *Signature { - if m != nil { - return m.OriginSignature - } - return nil -} - -func (m *RequestVerificationHeader) GetOrigin() *RequestVerificationHeader { - if m != nil { - return m.Origin - } - return nil -} - -// Verification info for response signed by all intermediate nodes -type ResponseVerificationHeader struct { - // Response Body signature. Should be generated once by answering node. - BodySignature *Signature `protobuf:"bytes,1,opt,name=body_signature,json=bodySignature,proto3" json:"body_signature,omitempty"` - // Response Meta signature is added and signed by any intermediate node - MetaSignature *Signature `protobuf:"bytes,2,opt,name=meta_signature,json=metaSignature,proto3" json:"meta_signature,omitempty"` - // Sign previous hops - OriginSignature *Signature `protobuf:"bytes,3,opt,name=origin_signature,json=originSignature,proto3" json:"origin_signature,omitempty"` - // Chain of previous hops signatures - Origin *ResponseVerificationHeader `protobuf:"bytes,4,opt,name=origin,proto3" json:"origin,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ResponseVerificationHeader) Reset() { *m = ResponseVerificationHeader{} } -func (m *ResponseVerificationHeader) String() string { return proto.CompactTextString(m) } -func (*ResponseVerificationHeader) ProtoMessage() {} -func (*ResponseVerificationHeader) Descriptor() ([]byte, []int) { - return fileDescriptor_333853833d6163d3, []int{2} -} -func (m *ResponseVerificationHeader) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ResponseVerificationHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ResponseVerificationHeader.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *ResponseVerificationHeader) XXX_Merge(src proto.Message) { - xxx_messageInfo_ResponseVerificationHeader.Merge(m, src) -} -func (m *ResponseVerificationHeader) XXX_Size() int { - return m.Size() -} -func (m *ResponseVerificationHeader) XXX_DiscardUnknown() { - xxx_messageInfo_ResponseVerificationHeader.DiscardUnknown(m) -} - -var xxx_messageInfo_ResponseVerificationHeader proto.InternalMessageInfo - -func (m *ResponseVerificationHeader) GetBodySignature() *Signature { - if m != nil { - return m.BodySignature - } - return nil -} - -func (m *ResponseVerificationHeader) GetMetaSignature() *Signature { - if m != nil { - return m.MetaSignature - } - return nil -} - -func (m *ResponseVerificationHeader) GetOriginSignature() *Signature { - if m != nil { - return m.OriginSignature - } - return nil -} - -func (m *ResponseVerificationHeader) GetOrigin() *ResponseVerificationHeader { - if m != nil { - return m.Origin - } - return nil -} - -func init() { - proto.RegisterType((*Signature)(nil), "neo.fs.v2.service.Signature") - proto.RegisterType((*RequestVerificationHeader)(nil), "neo.fs.v2.service.RequestVerificationHeader") - proto.RegisterType((*ResponseVerificationHeader)(nil), "neo.fs.v2.service.ResponseVerificationHeader") -} - -func init() { proto.RegisterFile("v2/service/grpc/verify.proto", fileDescriptor_333853833d6163d3) } - -var fileDescriptor_333853833d6163d3 = []byte{ - // 335 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x29, 0x33, 0xd2, 0x2f, - 0x4e, 0x2d, 0x2a, 0xcb, 0x4c, 0x4e, 0xd5, 0x4f, 0x2f, 0x2a, 0x48, 0xd6, 0x2f, 0x4b, 0x2d, 0xca, - 0x4c, 0xab, 0xd4, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0xcc, 0x4b, 0xcd, 0xd7, 0x4b, 0x2b, - 0xd6, 0x2b, 0x33, 0xd2, 0x83, 0x2a, 0x52, 0x32, 0xe4, 0xe2, 0x0c, 0xce, 0x4c, 0xcf, 0x4b, 0x2c, - 0x29, 0x2d, 0x4a, 0x15, 0x12, 0xe0, 0x62, 0xce, 0x4e, 0xad, 0x94, 0x60, 0x54, 0x60, 0xd4, 0xe0, - 0x09, 0x02, 0x31, 0x85, 0x84, 0xb8, 0x58, 0x8a, 0x33, 0xd3, 0xf3, 0x24, 0x98, 0xc0, 0x42, 0x60, - 0xb6, 0xd2, 0x16, 0x26, 0x2e, 0xc9, 0xa0, 0xd4, 0xc2, 0xd2, 0xd4, 0xe2, 0x92, 0x30, 0x90, 0xe9, - 0x99, 0xc9, 0x89, 0x25, 0x99, 0xf9, 0x79, 0x1e, 0xa9, 0x89, 0x29, 0xa9, 0x45, 0x42, 0xce, 0x5c, - 0x7c, 0x49, 0xf9, 0x29, 0x95, 0xf1, 0xc5, 0x30, 0x53, 0xc1, 0xc6, 0x71, 0x1b, 0xc9, 0xe8, 0x61, - 0x58, 0xae, 0x07, 0xb7, 0x39, 0x88, 0x17, 0xa4, 0x07, 0xe1, 0x10, 0x67, 0x2e, 0xbe, 0xdc, 0xd4, - 0x92, 0x44, 0x24, 0x43, 0x98, 0x88, 0x31, 0x04, 0xa4, 0x07, 0x61, 0x88, 0x3b, 0x97, 0x40, 0x7e, - 0x51, 0x66, 0x7a, 0x66, 0x1e, 0x92, 0x31, 0xcc, 0x44, 0x18, 0xc3, 0x0f, 0xd1, 0x85, 0x30, 0xc8, - 0x85, 0x8b, 0x0d, 0x22, 0x24, 0xc1, 0x02, 0xd6, 0xae, 0x83, 0x45, 0x3b, 0xce, 0x00, 0x09, 0x82, - 0xea, 0x55, 0xda, 0xc6, 0xc4, 0x25, 0x15, 0x94, 0x5a, 0x5c, 0x90, 0x9f, 0x57, 0x9c, 0x3a, 0x32, - 0xc2, 0xcd, 0x15, 0x2d, 0xdc, 0x74, 0xb1, 0x86, 0x1b, 0xae, 0x10, 0x81, 0x05, 0x9c, 0x53, 0xd2, - 0x89, 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, 0x31, 0x3e, 0x78, 0x24, 0xc7, 0x38, 0xe3, 0xb1, 0x1c, - 0x43, 0x94, 0x65, 0x7a, 0x66, 0x49, 0x46, 0x69, 0x92, 0x5e, 0x72, 0x7e, 0xae, 0x7e, 0x5e, 0x71, - 0x41, 0x72, 0xb2, 0x6e, 0x4a, 0x6a, 0x99, 0x7e, 0x5e, 0x6a, 0x7e, 0x5a, 0xb1, 0x6e, 0x62, 0x41, - 0xa6, 0x6e, 0x7a, 0xbe, 0x3e, 0x5a, 0x3e, 0xb0, 0x86, 0x72, 0x56, 0x31, 0x89, 0xf8, 0xa5, 0xe6, - 0xbb, 0x05, 0xeb, 0x39, 0x06, 0x78, 0x82, 0x9c, 0x11, 0x0c, 0x11, 0x4e, 0x62, 0x03, 0x67, 0x10, - 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0xdc, 0xd7, 0x4d, 0x30, 0x40, 0x03, 0x00, 0x00, -} - -func (m *Signature) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Signature) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Signature) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.Sign) > 0 { - i -= len(m.Sign) - copy(dAtA[i:], m.Sign) - i = encodeVarintVerify(dAtA, i, uint64(len(m.Sign))) - i-- - dAtA[i] = 0x12 - } - if len(m.Key) > 0 { - i -= len(m.Key) - copy(dAtA[i:], m.Key) - i = encodeVarintVerify(dAtA, i, uint64(len(m.Key))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *RequestVerificationHeader) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *RequestVerificationHeader) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *RequestVerificationHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.Origin != nil { - { - size, err := m.Origin.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintVerify(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } - if m.OriginSignature != nil { - { - size, err := m.OriginSignature.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintVerify(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if m.MetaSignature != nil { - { - size, err := m.MetaSignature.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintVerify(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.BodySignature != nil { - { - size, err := m.BodySignature.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintVerify(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *ResponseVerificationHeader) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ResponseVerificationHeader) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ResponseVerificationHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.Origin != nil { - { - size, err := m.Origin.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintVerify(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } - if m.OriginSignature != nil { - { - size, err := m.OriginSignature.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintVerify(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if m.MetaSignature != nil { - { - size, err := m.MetaSignature.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintVerify(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.BodySignature != nil { - { - size, err := m.BodySignature.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintVerify(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func encodeVarintVerify(dAtA []byte, offset int, v uint64) int { - offset -= sovVerify(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *Signature) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Key) - if l > 0 { - n += 1 + l + sovVerify(uint64(l)) - } - l = len(m.Sign) - if l > 0 { - n += 1 + l + sovVerify(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *RequestVerificationHeader) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.BodySignature != nil { - l = m.BodySignature.Size() - n += 1 + l + sovVerify(uint64(l)) - } - if m.MetaSignature != nil { - l = m.MetaSignature.Size() - n += 1 + l + sovVerify(uint64(l)) - } - if m.OriginSignature != nil { - l = m.OriginSignature.Size() - n += 1 + l + sovVerify(uint64(l)) - } - if m.Origin != nil { - l = m.Origin.Size() - n += 1 + l + sovVerify(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *ResponseVerificationHeader) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.BodySignature != nil { - l = m.BodySignature.Size() - n += 1 + l + sovVerify(uint64(l)) - } - if m.MetaSignature != nil { - l = m.MetaSignature.Size() - n += 1 + l + sovVerify(uint64(l)) - } - if m.OriginSignature != nil { - l = m.OriginSignature.Size() - n += 1 + l + sovVerify(uint64(l)) - } - if m.Origin != nil { - l = m.Origin.Size() - n += 1 + l + sovVerify(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func sovVerify(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozVerify(x uint64) (n int) { - return sovVerify(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *Signature) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowVerify - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Signature: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Signature: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowVerify - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthVerify - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthVerify - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Key = append(m.Key[:0], dAtA[iNdEx:postIndex]...) - if m.Key == nil { - m.Key = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Sign", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowVerify - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthVerify - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthVerify - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Sign = append(m.Sign[:0], dAtA[iNdEx:postIndex]...) - if m.Sign == nil { - m.Sign = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipVerify(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthVerify - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthVerify - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *RequestVerificationHeader) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowVerify - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: RequestVerificationHeader: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: RequestVerificationHeader: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BodySignature", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowVerify - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthVerify - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthVerify - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.BodySignature == nil { - m.BodySignature = &Signature{} - } - if err := m.BodySignature.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MetaSignature", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowVerify - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthVerify - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthVerify - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.MetaSignature == nil { - m.MetaSignature = &Signature{} - } - if err := m.MetaSignature.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OriginSignature", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowVerify - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthVerify - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthVerify - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.OriginSignature == nil { - m.OriginSignature = &Signature{} - } - if err := m.OriginSignature.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Origin", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowVerify - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthVerify - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthVerify - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Origin == nil { - m.Origin = &RequestVerificationHeader{} - } - if err := m.Origin.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipVerify(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthVerify - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthVerify - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ResponseVerificationHeader) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowVerify - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ResponseVerificationHeader: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ResponseVerificationHeader: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BodySignature", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowVerify - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthVerify - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthVerify - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.BodySignature == nil { - m.BodySignature = &Signature{} - } - if err := m.BodySignature.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MetaSignature", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowVerify - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthVerify - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthVerify - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.MetaSignature == nil { - m.MetaSignature = &Signature{} - } - if err := m.MetaSignature.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OriginSignature", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowVerify - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthVerify - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthVerify - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.OriginSignature == nil { - m.OriginSignature = &Signature{} - } - if err := m.OriginSignature.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Origin", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowVerify - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthVerify - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthVerify - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Origin == nil { - m.Origin = &ResponseVerificationHeader{} - } - if err := m.Origin.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipVerify(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthVerify - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthVerify - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipVerify(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowVerify - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowVerify - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowVerify - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthVerify - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupVerify - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthVerify - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthVerify = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowVerify = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupVerify = fmt.Errorf("proto: unexpected end of group") -) diff --git a/v2/service/marshal_test.go b/v2/service/marshal_test.go index 35ad8fb..63030ae 100644 --- a/v2/service/marshal_test.go +++ b/v2/service/marshal_test.go @@ -77,7 +77,7 @@ func TestTokenLifetime_StableMarshal(t *testing.T) { func TestObjectSessionContext_StableMarshal(t *testing.T) { objectCtxFrom := generateObjectCtx("Object ID") - transport := new(grpc.ObjectServiceContext) + transport := new(grpc.ObjectSessionContext) t.Run("non empty", func(t *testing.T) { wire, err := objectCtxFrom.StableMarshal(nil) diff --git a/v2/session/grpc/service.pb.go b/v2/session/grpc/service.pb.go index 7dd61a3..da92abe 100644 --- a/v2/session/grpc/service.pb.go +++ b/v2/session/grpc/service.pb.go @@ -293,37 +293,36 @@ func init() { func init() { proto.RegisterFile("v2/session/grpc/service.proto", fileDescriptor_4ed1365cc8e16cd4) } var fileDescriptor_4ed1365cc8e16cd4 = []byte{ - // 466 bytes of a gzipped FileDescriptorProto + // 458 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x93, 0x4f, 0x6f, 0xd3, 0x30, - 0x18, 0xc6, 0x49, 0x98, 0xc6, 0xe4, 0x76, 0x95, 0xb0, 0x90, 0xa8, 0x22, 0x28, 0x65, 0x62, 0x88, + 0x18, 0xc6, 0x49, 0x98, 0xc6, 0xe4, 0x76, 0x95, 0xb0, 0x90, 0xa8, 0x8a, 0x28, 0x65, 0x62, 0x88, 0x03, 0x75, 0xa4, 0x70, 0x40, 0x03, 0x2e, 0x0c, 0x98, 0xa8, 0x60, 0xfc, 0x71, 0x11, 0x07, 0x2e, - 0x55, 0xfe, 0xbc, 0xe9, 0xac, 0x11, 0x3b, 0xd8, 0x5e, 0x20, 0xdf, 0x84, 0x2b, 0x57, 0x3e, 0x09, - 0x47, 0x3e, 0x01, 0x42, 0xe5, 0x8b, 0xa0, 0xd8, 0xde, 0xb4, 0x6e, 0x59, 0x7b, 0xab, 0xfb, 0x3e, - 0xcf, 0xe3, 0xe7, 0xfd, 0x29, 0x46, 0x37, 0xab, 0x28, 0x54, 0xa0, 0x14, 0x13, 0x3c, 0x9c, 0xc9, - 0x32, 0x0d, 0x15, 0xc8, 0x8a, 0xa5, 0x40, 0x4a, 0x29, 0xb4, 0xc0, 0x57, 0x39, 0x08, 0x92, 0x2b, - 0x52, 0x45, 0xc4, 0xa9, 0x82, 0x7e, 0x15, 0x85, 0x12, 0x72, 0x65, 0xe5, 0xba, 0x2e, 0x41, 0x59, - 0x71, 0x10, 0x98, 0x2c, 0x63, 0xb7, 0xc3, 0x02, 0x74, 0xec, 0x66, 0x37, 0xce, 0xce, 0x2a, 0x90, - 0x2c, 0xaf, 0xed, 0x74, 0xeb, 0x8f, 0x8f, 0x36, 0x9f, 0x49, 0x88, 0x35, 0x50, 0xf8, 0x72, 0x04, - 0x4a, 0xe3, 0x1d, 0xb4, 0x96, 0x88, 0xac, 0xee, 0x7b, 0x43, 0xef, 0x5e, 0x27, 0xda, 0x26, 0xe7, - 0x7a, 0x90, 0x05, 0x3d, 0xd9, 0x15, 0x59, 0x4d, 0x8d, 0x05, 0xbf, 0x40, 0x9d, 0xe6, 0xe2, 0xe9, - 0x01, 0xc4, 0x19, 0xc8, 0xbe, 0x6f, 0x12, 0xee, 0x2c, 0x24, 0xd8, 0x15, 0x9d, 0x77, 0x1f, 0x74, - 0xfc, 0xd2, 0x68, 0x29, 0x2a, 0x4e, 0x7e, 0xe3, 0xf7, 0x68, 0xd3, 0x76, 0x3c, 0x0e, 0xba, 0x6c, - 0x82, 0xee, 0x5f, 0x1c, 0xf4, 0xb1, 0x91, 0xb3, 0x34, 0xd6, 0x4c, 0x70, 0x17, 0xd8, 0xb5, 0x11, - 0xf6, 0x14, 0x7c, 0x43, 0x6b, 0x4d, 0x4f, 0x1c, 0xa1, 0x0d, 0xf1, 0x95, 0x83, 0x9c, 0xb2, 0xcc, - 0x2d, 0x78, 0xfd, 0x54, 0x6a, 0x03, 0x97, 0xbc, 0x6d, 0xe6, 0xe3, 0xe7, 0xf4, 0x8a, 0x11, 0x8e, - 0x33, 0xfc, 0x04, 0x6d, 0x7c, 0x66, 0x39, 0x68, 0x56, 0x80, 0x5b, 0x69, 0xd8, 0xd2, 0xe4, 0x83, - 0x38, 0x04, 0xfe, 0xda, 0xe9, 0xe8, 0x89, 0x63, 0xeb, 0x87, 0x8f, 0x7a, 0xc7, 0xc0, 0x54, 0x29, - 0xb8, 0x02, 0xfc, 0x68, 0x81, 0xf0, 0xdd, 0x25, 0x84, 0xad, 0xe1, 0x34, 0xe2, 0xbd, 0x36, 0xc4, - 0xdb, 0xad, 0x64, 0xac, 0xf9, 0x02, 0xc6, 0xb4, 0x9d, 0xf1, 0x68, 0x49, 0xd2, 0x4a, 0xc8, 0x0f, - 0x1d, 0xe4, 0x1e, 0xf2, 0x1d, 0xde, 0x2e, 0xf5, 0x59, 0x86, 0x6f, 0xa1, 0x8e, 0x5b, 0x6c, 0x7a, - 0x08, 0xb5, 0xe9, 0xdc, 0xa5, 0xc8, 0xfd, 0xf5, 0x0a, 0xea, 0x68, 0x8a, 0x7a, 0x13, 0x7b, 0x9a, - 0xd8, 0x3b, 0xf1, 0x3e, 0x5a, 0xb7, 0x0c, 0xf0, 0x70, 0xd5, 0x07, 0x18, 0xdc, 0x5e, 0x09, 0x70, - 0x37, 0xf9, 0x35, 0x1f, 0x78, 0xbf, 0xe7, 0x03, 0xef, 0xef, 0x7c, 0xe0, 0x7d, 0xff, 0x37, 0xb8, - 0xf4, 0x69, 0x67, 0xc6, 0xf4, 0xc1, 0x51, 0x42, 0x52, 0x51, 0x84, 0x5c, 0x95, 0x69, 0x3a, 0xca, - 0xa0, 0x0a, 0x39, 0x88, 0x5c, 0x8d, 0xe2, 0x92, 0x8d, 0x66, 0x22, 0x3c, 0xf3, 0x3e, 0x1f, 0xbb, - 0xc3, 0x4f, 0xff, 0xda, 0x1b, 0x10, 0x7b, 0x13, 0xf2, 0xf4, 0xdd, 0xb8, 0xb9, 0xd2, 0x35, 0x4f, - 0xd6, 0xcd, 0x83, 0x7a, 0xf0, 0x3f, 0x00, 0x00, 0xff, 0xff, 0xc2, 0x58, 0x7b, 0xc5, 0xd8, 0x03, - 0x00, 0x00, + 0x51, 0xfe, 0xbc, 0xe9, 0xac, 0x11, 0x3b, 0xd8, 0x5e, 0x20, 0xdf, 0x84, 0x2b, 0x57, 0x3e, 0x09, + 0x47, 0x3e, 0x01, 0x42, 0xe5, 0x8b, 0xa0, 0xd8, 0xde, 0xb4, 0x6e, 0x59, 0x7b, 0xcb, 0x1b, 0x3f, + 0xcf, 0xf3, 0xbe, 0xef, 0x4f, 0x36, 0xba, 0x59, 0x85, 0x81, 0x02, 0xa5, 0x98, 0xe0, 0xc1, 0x4c, + 0x96, 0x69, 0xa0, 0x40, 0x56, 0x2c, 0x05, 0x52, 0x4a, 0xa1, 0x05, 0xbe, 0xca, 0x41, 0x90, 0x5c, + 0x91, 0x2a, 0x24, 0x4e, 0x35, 0xe8, 0x57, 0x61, 0x20, 0x21, 0x57, 0x56, 0xae, 0xeb, 0x12, 0x94, + 0x15, 0x0f, 0x6e, 0x98, 0x2c, 0x63, 0x3f, 0x77, 0xb8, 0xf5, 0xc7, 0x47, 0x9b, 0xcf, 0x24, 0xc4, + 0x1a, 0x28, 0x7c, 0x39, 0x02, 0xa5, 0xf1, 0x0e, 0x5a, 0x4b, 0x44, 0x56, 0xf7, 0xbd, 0x91, 0x77, + 0xaf, 0x13, 0x6e, 0x93, 0x73, 0xad, 0xc8, 0x82, 0x9e, 0xec, 0x8a, 0xac, 0xa6, 0xc6, 0x82, 0x5f, + 0xa0, 0x4e, 0x01, 0x3a, 0x8e, 0x0e, 0x20, 0xce, 0x40, 0xf6, 0x7d, 0x93, 0x70, 0x67, 0x21, 0xc1, + 0x6e, 0xe1, 0xbc, 0xfb, 0xa0, 0xe3, 0x97, 0x46, 0x4b, 0x51, 0x71, 0xf2, 0x8d, 0xdf, 0xa3, 0xcd, + 0x0a, 0x24, 0xcb, 0xeb, 0xe3, 0xa0, 0xcb, 0x26, 0xe8, 0xfe, 0xc5, 0x41, 0x1f, 0x1b, 0x39, 0x4b, + 0x63, 0xcd, 0x04, 0x77, 0x81, 0x5d, 0x1b, 0x61, 0xab, 0xc1, 0x37, 0xb4, 0xd6, 0xcc, 0x89, 0x43, + 0xb4, 0x21, 0xbe, 0x72, 0x90, 0x11, 0xcb, 0xdc, 0x82, 0xd7, 0x4f, 0xa5, 0x36, 0xfc, 0xc8, 0xdb, + 0xe6, 0x7c, 0xf2, 0x9c, 0x5e, 0x31, 0xc2, 0x49, 0x86, 0x9f, 0xa0, 0x8d, 0xcf, 0x2c, 0x07, 0xcd, + 0x0a, 0x70, 0x2b, 0x8d, 0x5a, 0x26, 0xf9, 0x20, 0x0e, 0x81, 0xbf, 0x76, 0x3a, 0x7a, 0xe2, 0xd8, + 0xfa, 0xe1, 0xa3, 0xde, 0x31, 0x30, 0x55, 0x0a, 0xae, 0x00, 0x3f, 0x5a, 0x20, 0x7c, 0x77, 0x09, + 0x61, 0x6b, 0x38, 0x8d, 0x78, 0xaf, 0x0d, 0xf1, 0x76, 0x2b, 0x19, 0x6b, 0xbe, 0x80, 0x31, 0x6d, + 0x67, 0x3c, 0x5e, 0x92, 0xb4, 0x12, 0xf2, 0x43, 0x07, 0xb9, 0x87, 0x7c, 0x87, 0xb7, 0x4b, 0x7d, + 0x96, 0xe1, 0x5b, 0xa8, 0xe3, 0x16, 0x8b, 0x0e, 0xa1, 0x36, 0x33, 0x77, 0x29, 0x72, 0xbf, 0x5e, + 0x41, 0x1d, 0x46, 0xa8, 0x37, 0xb5, 0xd5, 0xd4, 0xf6, 0xc4, 0xfb, 0x68, 0xdd, 0x32, 0xc0, 0xa3, + 0x55, 0x17, 0x70, 0x70, 0x7b, 0x25, 0xc0, 0xdd, 0xe4, 0xd7, 0x7c, 0xe8, 0xfd, 0x9e, 0x0f, 0xbd, + 0xbf, 0xf3, 0xa1, 0xf7, 0xfd, 0xdf, 0xf0, 0xd2, 0xa7, 0x9d, 0x19, 0xd3, 0x07, 0x47, 0x09, 0x49, + 0x45, 0x11, 0x70, 0x55, 0xa6, 0xe9, 0x38, 0x83, 0x2a, 0xe0, 0x20, 0x72, 0x35, 0x8e, 0x4b, 0x36, + 0x9e, 0x89, 0xe0, 0xcc, 0x13, 0x7c, 0xec, 0x8a, 0x9f, 0xfe, 0xb5, 0x37, 0x20, 0xf6, 0xa6, 0xe4, + 0xe9, 0xbb, 0x49, 0xd3, 0xd2, 0x4d, 0x9e, 0xac, 0x9b, 0x07, 0xf5, 0xe0, 0x7f, 0x00, 0x00, 0x00, + 0xff, 0xff, 0x9a, 0x12, 0x33, 0x00, 0xbb, 0x03, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. From 82110751e75799740e89355d11e75ac4eea39c62 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Tue, 18 Aug 2020 16:48:58 +0300 Subject: [PATCH 0328/1196] Add stable marshal for container package Signed-off-by: Alex Vanin --- v2/container/marshal.go | 512 +++++++++++++++++++++++++++++++++++ v2/container/marshal_test.go | 414 ++++++++++++++++++++++++++++ v2/netmap/marshal.go | 11 + 3 files changed, 937 insertions(+) create mode 100644 v2/container/marshal.go create mode 100644 v2/container/marshal_test.go create mode 100644 v2/netmap/marshal.go diff --git a/v2/container/marshal.go b/v2/container/marshal.go new file mode 100644 index 0000000..a9fdd02 --- /dev/null +++ b/v2/container/marshal.go @@ -0,0 +1,512 @@ +package container + +import ( + "github.com/nspcc-dev/neofs-api-go/util/proto" +) + +const ( + attributeKeyField = 1 + attributeValueField = 2 + + containerVersionField = 1 + containerOwnerField = 2 + containerNonceField = 3 + containerBasicACLField = 4 + containerAttributesField = 5 + containerPlacementField = 6 + + putReqBodyContainerField = 1 + putReqBodySignatureField = 2 + + putRespBodyIDField = 1 + + deleteReqBodyIDField = 1 + deleteReqBodySignatureField = 2 + + getReqBodyIDField = 1 + + getRespBodyContainerField = 1 + + listReqBodyOwnerField = 1 + + listRespBodyIDsField = 1 + + setEACLReqBodyTableField = 1 + setEACLReqBodySignatureField = 2 + + getEACLReqBodyIDField = 1 + + getEACLRespBodyTableField = 1 + getEACLRespBodySignatureField = 2 +) + +func (a *Attribute) StableMarshal(buf []byte) ([]byte, error) { + if a == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, a.StableSize()) + } + + var ( + offset, n int + err error + ) + + n, err = proto.StringMarshal(attributeKeyField, buf[offset:], a.key) + if err != nil { + return nil, err + } + + offset += n + + _, err = proto.StringMarshal(attributeValueField, buf[offset:], a.val) + if err != nil { + return nil, err + } + + return buf, nil +} + +func (a *Attribute) StableSize() (size int) { + if a == nil { + return 0 + } + + size += proto.StringSize(attributeKeyField, a.key) + size += proto.StringSize(attributeValueField, a.val) + + return size +} + +func (c *Container) StableMarshal(buf []byte) ([]byte, error) { + if c == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, c.StableSize()) + } + + var ( + offset, n int + err error + ) + + n, err = proto.NestedStructureMarshal(containerVersionField, buf[offset:], c.version) + if err != nil { + return nil, err + } + + offset += n + + n, err = proto.NestedStructureMarshal(containerOwnerField, buf[offset:], c.ownerID) + if err != nil { + return nil, err + } + + offset += n + + n, err = proto.BytesMarshal(containerNonceField, buf[offset:], c.nonce) + if err != nil { + return nil, err + } + + offset += n + + n, err = proto.UInt32Marshal(containerBasicACLField, buf[offset:], c.basicACL) + if err != nil { + return nil, err + } + + offset += n + + for i := range c.attr { + n, err = proto.NestedStructureMarshal(containerAttributesField, buf[offset:], c.attr[i]) + if err != nil { + return nil, err + } + + offset += n + } + + _, err = proto.NestedStructureMarshal(containerPlacementField, buf[offset:], c.policy) + if err != nil { + return nil, err + } + + return buf, nil +} + +func (c *Container) StableSize() (size int) { + if c == nil { + return 0 + } + + size += proto.NestedStructureSize(containerVersionField, c.version) + size += proto.NestedStructureSize(containerOwnerField, c.ownerID) + size += proto.BytesSize(containerNonceField, c.nonce) + size += proto.UInt32Size(containerBasicACLField, c.basicACL) + + for i := range c.attr { + size += proto.NestedStructureSize(containerAttributesField, c.attr[i]) + } + + size += proto.NestedStructureSize(containerPlacementField, c.policy) + + return size +} + +func (r *PutRequestBody) StableMarshal(buf []byte) ([]byte, error) { + if r == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, r.StableSize()) + } + + var ( + offset, n int + err error + ) + + n, err = proto.NestedStructureMarshal(putReqBodyContainerField, buf[offset:], r.cnr) + if err != nil { + return nil, err + } + + offset += n + + _, err = proto.NestedStructureMarshal(putReqBodySignatureField, buf[offset:], r.sig) + if err != nil { + return nil, err + } + + return buf, nil +} + +func (r *PutRequestBody) StableSize() (size int) { + if r == nil { + return 0 + } + + size += proto.NestedStructureSize(putReqBodyContainerField, r.cnr) + size += proto.NestedStructureSize(putReqBodySignatureField, r.sig) + + return size +} + +func (r *PutResponseBody) StableMarshal(buf []byte) ([]byte, error) { + if r == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, r.StableSize()) + } + + var ( + err error + ) + + _, err = proto.NestedStructureMarshal(putRespBodyIDField, buf, r.cid) + if err != nil { + return nil, err + } + + return buf, nil +} + +func (r *PutResponseBody) StableSize() (size int) { + if r == nil { + return 0 + } + + size += proto.NestedStructureSize(putRespBodyIDField, r.cid) + + return size +} + +func (r *DeleteRequestBody) StableMarshal(buf []byte) ([]byte, error) { + if r == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, r.StableSize()) + } + + var ( + offset, n int + err error + ) + + n, err = proto.NestedStructureMarshal(deleteReqBodyIDField, buf[offset:], r.cid) + if err != nil { + return nil, err + } + + offset += n + + _, err = proto.NestedStructureMarshal(deleteReqBodySignatureField, buf[offset:], r.sig) + if err != nil { + return nil, err + } + + return buf, nil +} + +func (r *DeleteRequestBody) StableSize() (size int) { + if r == nil { + return 0 + } + + size += proto.NestedStructureSize(deleteReqBodyIDField, r.cid) + size += proto.NestedStructureSize(deleteReqBodySignatureField, r.sig) + + return size +} + +func (r *DeleteResponseBody) StableMarshal(buf []byte) ([]byte, error) { + return nil, nil +} + +func (r *DeleteResponseBody) StableSize() (size int) { + return 0 +} + +func (r *GetRequestBody) StableMarshal(buf []byte) ([]byte, error) { + if r == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, r.StableSize()) + } + + _, err := proto.NestedStructureMarshal(getReqBodyIDField, buf, r.cid) + if err != nil { + return nil, err + } + + return buf, nil +} + +func (r *GetRequestBody) StableSize() (size int) { + if r == nil { + return 0 + } + + size += proto.NestedStructureSize(getReqBodyIDField, r.cid) + + return size +} + +func (r *GetResponseBody) StableMarshal(buf []byte) ([]byte, error) { + if r == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, r.StableSize()) + } + + _, err := proto.NestedStructureMarshal(getRespBodyContainerField, buf, r.cnr) + if err != nil { + return nil, err + } + + return buf, nil +} + +func (r *GetResponseBody) StableSize() (size int) { + if r == nil { + return 0 + } + + size += proto.NestedStructureSize(getRespBodyContainerField, r.cnr) + + return size +} + +func (r *ListRequestBody) StableMarshal(buf []byte) ([]byte, error) { + if r == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, r.StableSize()) + } + + _, err := proto.NestedStructureMarshal(listReqBodyOwnerField, buf, r.ownerID) + if err != nil { + return nil, err + } + + return buf, nil +} + +func (r *ListRequestBody) StableSize() (size int) { + if r == nil { + return 0 + } + + size += proto.NestedStructureSize(listReqBodyOwnerField, r.ownerID) + + return size +} + +func (r *ListResponseBody) StableMarshal(buf []byte) ([]byte, error) { + if r == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, r.StableSize()) + } + + var ( + n, offset int + err error + ) + + for i := range r.cidList { + n, err = proto.NestedStructureMarshal(listRespBodyIDsField, buf[offset:], r.cidList[i]) + if err != nil { + return nil, err + } + + offset += n + } + + return buf, nil +} + +func (r *ListResponseBody) StableSize() (size int) { + if r == nil { + return 0 + } + + for i := range r.cidList { + size += proto.NestedStructureSize(listRespBodyIDsField, r.cidList[i]) + } + + return size +} + +func (r *SetExtendedACLRequestBody) StableMarshal(buf []byte) ([]byte, error) { + if r == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, r.StableSize()) + } + + var ( + offset, n int + err error + ) + + n, err = proto.NestedStructureMarshal(setEACLReqBodyTableField, buf[offset:], r.eacl) + if err != nil { + return nil, err + } + + offset += n + + _, err = proto.NestedStructureMarshal(setEACLReqBodySignatureField, buf[offset:], r.sig) + if err != nil { + return nil, err + } + + return buf, nil +} + +func (r *SetExtendedACLRequestBody) StableSize() (size int) { + if r == nil { + return 0 + } + + size += proto.NestedStructureSize(setEACLReqBodyTableField, r.eacl) + size += proto.NestedStructureSize(setEACLReqBodySignatureField, r.sig) + + return size +} + +func (r *SetExtendedACLResponseBody) StableMarshal(buf []byte) ([]byte, error) { + return nil, nil +} + +func (r *SetExtendedACLResponseBody) StableSize() (size int) { + return 0 +} + +func (r *GetExtendedACLRequestBody) StableMarshal(buf []byte) ([]byte, error) { + if r == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, r.StableSize()) + } + + _, err := proto.NestedStructureMarshal(getEACLReqBodyIDField, buf, r.cid) + if err != nil { + return nil, err + } + + return buf, nil +} + +func (r *GetExtendedACLRequestBody) StableSize() (size int) { + if r == nil { + return 0 + } + + size += proto.NestedStructureSize(getEACLReqBodyIDField, r.cid) + + return size +} + +func (r *GetExtendedACLResponseBody) StableMarshal(buf []byte) ([]byte, error) { + if r == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, r.StableSize()) + } + + var ( + offset, n int + err error + ) + + n, err = proto.NestedStructureMarshal(getEACLRespBodyTableField, buf[offset:], r.eacl) + if err != nil { + return nil, err + } + + offset += n + + _, err = proto.NestedStructureMarshal(getEACLRespBodySignatureField, buf[offset:], r.sig) + if err != nil { + return nil, err + } + + return buf, nil +} + +func (r *GetExtendedACLResponseBody) StableSize() (size int) { + if r == nil { + return 0 + } + + size += proto.NestedStructureSize(getEACLRespBodyTableField, r.eacl) + size += proto.NestedStructureSize(getEACLRespBodySignatureField, r.sig) + + return size +} diff --git a/v2/container/marshal_test.go b/v2/container/marshal_test.go new file mode 100644 index 0000000..f46bb31 --- /dev/null +++ b/v2/container/marshal_test.go @@ -0,0 +1,414 @@ +package container_test + +import ( + "fmt" + "testing" + + "github.com/nspcc-dev/neofs-api-go/v2/acl" + "github.com/nspcc-dev/neofs-api-go/v2/container" + grpc "github.com/nspcc-dev/neofs-api-go/v2/container/grpc" + "github.com/nspcc-dev/neofs-api-go/v2/refs" + "github.com/nspcc-dev/neofs-api-go/v2/service" + "github.com/stretchr/testify/require" +) + +func TestAttribute_StableMarshal(t *testing.T) { + attributeFrom := generateAttribute("key", "value") + transport := new(grpc.Container_Attribute) + + t.Run("non empty", func(t *testing.T) { + wire, err := attributeFrom.StableMarshal(nil) + require.NoError(t, err) + + err = transport.Unmarshal(wire) + require.NoError(t, err) + + attributeTo := container.AttributeFromGRPCMessage(transport) + require.Equal(t, attributeFrom, attributeTo) + }) +} + +func TestContainer_StableMarshal(t *testing.T) { + cnrFrom := generateContainer("nonce") + transport := new(grpc.Container) + + t.Run("non empty", func(t *testing.T) { + wire, err := cnrFrom.StableMarshal(nil) + require.NoError(t, err) + + err = transport.Unmarshal(wire) + require.NoError(t, err) + + cnrTo := container.ContainerFromGRPCMessage(transport) + require.Equal(t, cnrFrom, cnrTo) + }) +} + +func TestPutRequestBody_StableMarshal(t *testing.T) { + requestFrom := generatePutRequestBody("nonce") + transport := new(grpc.PutRequest_Body) + + t.Run("non empty", func(t *testing.T) { + wire, err := requestFrom.StableMarshal(nil) + require.NoError(t, err) + + err = transport.Unmarshal(wire) + require.NoError(t, err) + + requestTo := container.PutRequestBodyFromGRPCMessage(transport) + require.Equal(t, requestFrom, requestTo) + }) +} + +func TestPutResponseBody_StableMarshal(t *testing.T) { + responseFrom := generatePutResponseBody("Container ID") + transport := new(grpc.PutResponse_Body) + + t.Run("non empty", func(t *testing.T) { + wire, err := responseFrom.StableMarshal(nil) + require.NoError(t, err) + + err = transport.Unmarshal(wire) + require.NoError(t, err) + + responseTo := container.PutResponseBodyFromGRPCMessage(transport) + require.Equal(t, responseFrom, responseTo) + }) +} + +func TestDeleteRequestBody_StableMarshal(t *testing.T) { + requestFrom := generateDeleteRequestBody("Container ID") + transport := new(grpc.DeleteRequest_Body) + + t.Run("non empty", func(t *testing.T) { + wire, err := requestFrom.StableMarshal(nil) + require.NoError(t, err) + + err = transport.Unmarshal(wire) + require.NoError(t, err) + + requestTo := container.DeleteRequestBodyFromGRPCMessage(transport) + require.Equal(t, requestFrom, requestTo) + }) +} + +func TestDeleteResponseBody_StableMarshal(t *testing.T) { + responseFrom := generateDeleteResponseBody() + transport := new(grpc.DeleteResponse_Body) + + t.Run("non empty", func(t *testing.T) { + wire, err := responseFrom.StableMarshal(nil) + require.NoError(t, err) + + err = transport.Unmarshal(wire) + require.NoError(t, err) + + responseTo := container.DeleteResponseBodyFromGRPCMessage(transport) + require.Equal(t, responseFrom, responseTo) + }) +} + +func TestGetRequestBody_StableMarshal(t *testing.T) { + requestFrom := generateGetRequestBody("Container ID") + transport := new(grpc.GetRequest_Body) + + t.Run("non empty", func(t *testing.T) { + wire, err := requestFrom.StableMarshal(nil) + require.NoError(t, err) + + err = transport.Unmarshal(wire) + require.NoError(t, err) + + requestTo := container.GetRequestBodyFromGRPCMessage(transport) + require.Equal(t, requestFrom, requestTo) + }) +} + +func TestGetResponseBody_StableMarshal(t *testing.T) { + responseFrom := generateGetResponseBody("nonce") + transport := new(grpc.GetResponse_Body) + + t.Run("non empty", func(t *testing.T) { + wire, err := responseFrom.StableMarshal(nil) + require.NoError(t, err) + + err = transport.Unmarshal(wire) + require.NoError(t, err) + + responseTo := container.GetResponseBodyFromGRPCMessage(transport) + require.Equal(t, responseFrom, responseTo) + }) +} + +func TestListRequestBody_StableMarshal(t *testing.T) { + requestFrom := generateListRequestBody("Owner ID") + transport := new(grpc.ListRequest_Body) + + t.Run("non empty", func(t *testing.T) { + wire, err := requestFrom.StableMarshal(nil) + require.NoError(t, err) + + err = transport.Unmarshal(wire) + require.NoError(t, err) + + requestTo := container.ListRequestBodyFromGRPCMessage(transport) + require.Equal(t, requestFrom, requestTo) + }) +} + +func TestListResponseBody_StableMarshal(t *testing.T) { + responseFrom := generateListResponseBody(3) + transport := new(grpc.ListResponse_Body) + + t.Run("non empty", func(t *testing.T) { + wire, err := responseFrom.StableMarshal(nil) + require.NoError(t, err) + + err = transport.Unmarshal(wire) + require.NoError(t, err) + + responseTo := container.ListResponseBodyFromGRPCMessage(transport) + require.Equal(t, responseFrom, responseTo) + }) +} + +func TestSetEACLRequestBody_StableMarshal(t *testing.T) { + requestFrom := generateSetEACLRequestBody(4, "Filter Key", "Filter Value") + transport := new(grpc.SetExtendedACLRequest_Body) + + t.Run("non empty", func(t *testing.T) { + wire, err := requestFrom.StableMarshal(nil) + require.NoError(t, err) + + err = transport.Unmarshal(wire) + require.NoError(t, err) + + requestTo := container.SetExtendedACLRequestBodyFromGRPCMessage(transport) + require.Equal(t, requestFrom, requestTo) + }) +} + +func TestSetEACLResponseBody_StableMarshal(t *testing.T) { + responseFrom := generateSetEACLResponseBody() + transport := new(grpc.SetExtendedACLResponse_Body) + + t.Run("non empty", func(t *testing.T) { + wire, err := responseFrom.StableMarshal(nil) + require.NoError(t, err) + + err = transport.Unmarshal(wire) + require.NoError(t, err) + + responseTo := container.SetExtendedACLResponseBodyFromGRPCMessage(transport) + require.Equal(t, responseFrom, responseTo) + }) +} + +func TestGetEACLRequestBody_StableMarshal(t *testing.T) { + requestFrom := generateGetEACLRequestBody("Container ID") + transport := new(grpc.GetExtendedACLRequest_Body) + + t.Run("non empty", func(t *testing.T) { + wire, err := requestFrom.StableMarshal(nil) + require.NoError(t, err) + + err = transport.Unmarshal(wire) + require.NoError(t, err) + + requestTo := container.GetExtendedACLRequestBodyFromGRPCMessage(transport) + require.Equal(t, requestFrom, requestTo) + }) +} + +func TestGetEACLResponseBody_StableMarshal(t *testing.T) { + responseFrom := generateGetEACLResponseBody(3, "Filter Key", "Filter Value") + transport := new(grpc.GetExtendedACLResponse_Body) + + t.Run("non empty", func(t *testing.T) { + wire, err := responseFrom.StableMarshal(nil) + require.NoError(t, err) + + err = transport.Unmarshal(wire) + require.NoError(t, err) + + responseTo := container.GetExtendedACLResponseBodyFromGRPCMessage(transport) + require.Equal(t, responseFrom, responseTo) + }) +} + +func generateAttribute(k, v string) *container.Attribute { + attr := new(container.Attribute) + attr.SetKey(k) + attr.SetValue(v) + + return attr +} + +func generateContainer(n string) *container.Container { + owner := new(refs.OwnerID) + owner.SetValue([]byte("Owner ID")) + + version := new(service.Version) + version.SetMajor(2) + version.SetMinor(0) + + // todo: add placement rule + + cnr := new(container.Container) + cnr.SetOwnerID(owner) + cnr.SetVersion(version) + cnr.SetAttributes([]*container.Attribute{ + generateAttribute("one", "two"), + generateAttribute("three", "four"), + }) + cnr.SetBasicACL(100) + cnr.SetNonce([]byte(n)) + + return cnr +} + +func generateSignature(k, v string) *service.Signature { + sig := new(service.Signature) + sig.SetKey([]byte(k)) + sig.SetSign([]byte(v)) + + return sig +} + +func generatePutRequestBody(n string) *container.PutRequestBody { + req := new(container.PutRequestBody) + req.SetContainer(generateContainer(n)) + req.SetSignature(generateSignature("public key", "signature")) + + return req +} + +func generatePutResponseBody(id string) *container.PutResponseBody { + cid := new(refs.ContainerID) + cid.SetValue([]byte(id)) + + resp := new(container.PutResponseBody) + resp.SetContainerID(cid) + + return resp +} + +func generateDeleteRequestBody(id string) *container.DeleteRequestBody { + cid := new(refs.ContainerID) + cid.SetValue([]byte(id)) + + req := new(container.DeleteRequestBody) + req.SetContainerID(cid) + req.SetSignature(generateSignature("public key", "signature")) + + return req +} + +func generateDeleteResponseBody() *container.DeleteResponseBody { + return new(container.DeleteResponseBody) +} + +func generateGetRequestBody(id string) *container.GetRequestBody { + cid := new(refs.ContainerID) + cid.SetValue([]byte(id)) + + req := new(container.GetRequestBody) + req.SetContainerID(cid) + + return req +} + +func generateGetResponseBody(n string) *container.GetResponseBody { + resp := new(container.GetResponseBody) + resp.SetContainer(generateContainer(n)) + + return resp +} + +func generateListRequestBody(id string) *container.ListRequestBody { + owner := new(refs.OwnerID) + owner.SetValue([]byte(id)) + + req := new(container.ListRequestBody) + req.SetOwnerID(owner) + + return req +} + +func generateListResponseBody(n int) *container.ListResponseBody { + resp := new(container.ListResponseBody) + + ids := make([]*refs.ContainerID, n) + for i := 0; i < n; i++ { + cid := new(refs.ContainerID) + cid.SetValue([]byte(fmt.Sprintf("Container ID %d", n+1))) + ids[i] = cid + } + + resp.SetContainerIDs(ids) + + return resp +} + +func generateEACL(n int, k, v string) *acl.Table { + target := new(acl.TargetInfo) + target.SetTarget(acl.TargetUser) + + keys := make([][]byte, n) + + for i := 0; i < n; i++ { + s := fmt.Sprintf("Public Key %d", i+1) + keys[i] = []byte(s) + } + + filter := new(acl.HeaderFilter) + filter.SetHeaderType(acl.HeaderTypeObject) + filter.SetMatchType(acl.MatchTypeStringEqual) + filter.SetName(k) + filter.SetValue(v) + + record := new(acl.Record) + record.SetOperation(acl.OperationHead) + record.SetAction(acl.ActionDeny) + record.SetTargets([]*acl.TargetInfo{target}) + record.SetFilters([]*acl.HeaderFilter{filter}) + + table := new(acl.Table) + cid := new(refs.ContainerID) + cid.SetValue([]byte("Container ID")) + + table.SetContainerID(cid) + table.SetRecords([]*acl.Record{record}) + + return table +} + +func generateSetEACLRequestBody(n int, k, v string) *container.SetExtendedACLRequestBody { + req := new(container.SetExtendedACLRequestBody) + req.SetEACL(generateEACL(n, k, v)) + req.SetSignature(generateSignature("public key", "signature")) + + return req +} + +func generateSetEACLResponseBody() *container.SetExtendedACLResponseBody { + return new(container.SetExtendedACLResponseBody) +} + +func generateGetEACLRequestBody(id string) *container.GetExtendedACLRequestBody { + cid := new(refs.ContainerID) + cid.SetValue([]byte(id)) + + req := new(container.GetExtendedACLRequestBody) + req.SetContainerID(cid) + + return req +} + +func generateGetEACLResponseBody(n int, k, v string) *container.GetExtendedACLResponseBody { + resp := new(container.GetExtendedACLResponseBody) + resp.SetEACL(generateEACL(n, k, v)) + resp.SetSignature(generateSignature("public key", "signature")) + + return resp +} diff --git a/v2/netmap/marshal.go b/v2/netmap/marshal.go new file mode 100644 index 0000000..99a24b4 --- /dev/null +++ b/v2/netmap/marshal.go @@ -0,0 +1,11 @@ +package netmap + +func (p *PlacementPolicy) StableMarshal(buf []byte) ([]byte, error) { + // todo: implement me + return nil, nil +} + +func (p *PlacementPolicy) StableSize() (size int) { + // todo: implement me + return 0 +} From db97b782c00834e69f87d3060e5c04ea08d101ce Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 18 Aug 2020 16:01:40 +0300 Subject: [PATCH 0329/1196] v2/signature: Unify request and response signing Signed-off-by: Leonard Lyubich --- v2/signature/sign.go | 262 ++++++++++++++++++++++++++++++++++--------- 1 file changed, 210 insertions(+), 52 deletions(-) diff --git a/v2/signature/sign.go b/v2/signature/sign.go index d0fddc5..e17e90e 100644 --- a/v2/signature/sign.go +++ b/v2/signature/sign.go @@ -10,12 +10,18 @@ import ( "github.com/pkg/errors" ) -type SignedRequest interface { +type serviceRequest interface { GetMetaHeader() *service.RequestMetaHeader GetVerificationHeader() *service.RequestVerificationHeader SetVerificationHeader(*service.RequestVerificationHeader) } +type serviceResponse interface { + GetMetaHeader() *service.ResponseMetaHeader + GetVerificationHeader() *service.ResponseVerificationHeader + SetVerificationHeader(*service.ResponseVerificationHeader) +} + type stableMarshaler interface { StableMarshal([]byte) ([]byte, error) StableSize() int @@ -25,12 +31,99 @@ type stableMarshalerWrapper struct { sm stableMarshaler } +type metaHeader interface { + stableMarshaler + getOrigin() metaHeader +} + +type verificationHeader interface { + stableMarshaler + + GetBodySignature() *service.Signature + SetBodySignature(*service.Signature) + GetMetaSignature() *service.Signature + SetMetaSignature(*service.Signature) + GetOriginSignature() *service.Signature + SetOriginSignature(*service.Signature) + + setOrigin(stableMarshaler) + getOrigin() verificationHeader +} + +type requestMetaHeader struct { + *service.RequestMetaHeader +} + +type responseMetaHeader struct { + *service.ResponseMetaHeader +} + +type requestVerificationHeader struct { + *service.RequestVerificationHeader +} + +type responseVerificationHeader struct { + *service.ResponseVerificationHeader +} + +func (h *requestMetaHeader) getOrigin() metaHeader { + return &requestMetaHeader{ + RequestMetaHeader: h.GetOrigin(), + } +} + +func (h *responseMetaHeader) getOrigin() metaHeader { + return &responseMetaHeader{ + ResponseMetaHeader: h.GetOrigin(), + } +} + +func (h *requestVerificationHeader) getOrigin() verificationHeader { + if origin := h.GetOrigin(); origin != nil { + return &requestVerificationHeader{ + RequestVerificationHeader: origin, + } + } + + return nil +} + +func (h *requestVerificationHeader) setOrigin(m stableMarshaler) { + if m != nil { + h.SetOrigin(m.(*service.RequestVerificationHeader)) + } +} + +func (r *responseVerificationHeader) getOrigin() verificationHeader { + if origin := r.GetOrigin(); origin != nil { + return &responseVerificationHeader{ + ResponseVerificationHeader: origin, + } + } + + return nil +} + +func (r *responseVerificationHeader) setOrigin(m stableMarshaler) { + if m != nil { + r.SetOrigin(m.(*service.ResponseVerificationHeader)) + } +} + func (s stableMarshalerWrapper) ReadSignedData(buf []byte) ([]byte, error) { - return s.sm.StableMarshal(buf) + if s.sm != nil { + return s.sm.StableMarshal(buf) + } + + return nil, nil } func (s stableMarshalerWrapper) SignedDataSize() int { - return s.sm.StableSize() + if s.sm != nil { + return s.sm.StableSize() + } + + return 0 } func keySignatureHandler(s *service.Signature) signature.KeySignatureHandler { @@ -46,48 +139,69 @@ func keySignatureSource(s *service.Signature) signature.KeySignatureSource { } } -func requestBody(req SignedRequest) stableMarshaler { - switch v := req.(type) { - case *accounting.BalanceRequest: - return v.GetBody() - default: - panic(fmt.Sprintf("unknown request %T", req)) - } -} +func SignServiceMessage(key *ecdsa.PrivateKey, msg interface{}) error { + var ( + body, meta, verifyOrigin stableMarshaler + verifyHdr verificationHeader + verifyHdrSetter func(verificationHeader) + ) -func SignRequest(key *ecdsa.PrivateKey, req SignedRequest) error { - if req == nil { + switch v := msg.(type) { + case nil: return nil + case serviceRequest: + body = serviceMessageBody(v) + meta = v.GetMetaHeader() + verifyHdr = &requestVerificationHeader{new(service.RequestVerificationHeader)} + verifyHdrSetter = func(h verificationHeader) { + v.SetVerificationHeader(h.(*requestVerificationHeader).RequestVerificationHeader) + } + + if h := v.GetVerificationHeader(); h != nil { + verifyOrigin = h + } + case serviceResponse: + body = serviceMessageBody(v) + meta = v.GetMetaHeader() + verifyHdr = &responseVerificationHeader{new(service.ResponseVerificationHeader)} + verifyHdrSetter = func(h verificationHeader) { + v.SetVerificationHeader(h.(*responseVerificationHeader).ResponseVerificationHeader) + } + + if h := v.GetVerificationHeader(); h != nil { + verifyOrigin = h + } + default: + panic(fmt.Sprintf("unsupported service message %T", v)) } - // create new level of matryoshka - verifyHdr := new(service.RequestVerificationHeader) - - // attach the previous matryoshka - verifyHdr.SetOrigin(req.GetVerificationHeader()) - - // sign request body - if err := signRequestPart(key, requestBody(req), verifyHdr.SetBodySignature); err != nil { - return errors.Wrap(err, "could not sign request body") + if verifyOrigin == nil { + // sign service message body + if err := signServiceMessagePart(key, body, verifyHdr.SetBodySignature); err != nil { + return errors.Wrap(err, "could not sign body") + } } // sign meta header - if err := signRequestPart(key, req.GetMetaHeader(), verifyHdr.SetMetaSignature); err != nil { - return errors.Wrap(err, "could not sign request meta header") + if err := signServiceMessagePart(key, meta, verifyHdr.SetMetaSignature); err != nil { + return errors.Wrap(err, "could not sign meta header") } // sign verification header origin - if err := signRequestPart(key, verifyHdr.GetOrigin(), verifyHdr.SetOriginSignature); err != nil { - return errors.Wrap(err, "could not sign origin of request verification header") + if err := signServiceMessagePart(key, verifyOrigin, verifyHdr.SetOriginSignature); err != nil { + return errors.Wrap(err, "could not sign origin of verification header") } - // make a new top of the matryoshka - req.SetVerificationHeader(verifyHdr) + // wrap origin verification header + verifyHdr.setOrigin(verifyOrigin) + + // update matryoshka verification header + verifyHdrSetter(verifyHdr) return nil } -func signRequestPart(key *ecdsa.PrivateKey, part stableMarshaler, sigWrite func(*service.Signature)) error { +func signServiceMessagePart(key *ecdsa.PrivateKey, part stableMarshaler, sigWrite func(*service.Signature)) error { sig := new(service.Signature) // sign part @@ -105,34 +219,78 @@ func signRequestPart(key *ecdsa.PrivateKey, part stableMarshaler, sigWrite func( return nil } -func VerifyRequest(req SignedRequest) error { - verifyHdr := req.GetVerificationHeader() +func VerifyServiceMessage(msg interface{}) error { + var ( + meta metaHeader + verify verificationHeader + ) - // verify body signature - if err := verifyRequestPart(requestBody(req), verifyHdr.GetBodySignature); err != nil { - return errors.Wrap(err, "could not verify request body") + switch v := msg.(type) { + case nil: + return nil + case serviceRequest: + meta = &requestMetaHeader{ + RequestMetaHeader: v.GetMetaHeader(), + } + + verify = &requestVerificationHeader{ + RequestVerificationHeader: v.GetVerificationHeader(), + } + case serviceResponse: + meta = &responseMetaHeader{ + ResponseMetaHeader: v.GetMetaHeader(), + } + + verify = &responseVerificationHeader{ + ResponseVerificationHeader: v.GetVerificationHeader(), + } + default: + panic(fmt.Sprintf("unsupported service message %T", v)) } - // verify meta header - if err := verifyRequestPart(req.GetMetaHeader(), verifyHdr.GetMetaSignature); err != nil { - return errors.Wrap(err, "could not verify request meta header") - } - - // verify verification header origin - if err := verifyRequestPart(verifyHdr.GetOrigin(), verifyHdr.GetOriginSignature); err != nil { - return errors.Wrap(err, "could not verify origin of request verification header") - } - - return nil + return verifyMatryoshkaLevel(serviceMessageBody(msg), meta, verify) } -func verifyRequestPart(part stableMarshaler, sigRdr func() *service.Signature) error { - if err := signature.VerifyDataWithSource( +func verifyMatryoshkaLevel(body stableMarshaler, meta metaHeader, verify verificationHeader) error { + if err := verifyServiceMessagePart(meta, verify.GetMetaSignature); err != nil { + return errors.Wrap(err, "could not verify meta header") + } + + origin := verify.getOrigin() + + if err := verifyServiceMessagePart(origin, verify.GetOriginSignature); err != nil { + return errors.Wrap(err, "could not verify origin of verification header") + } + + if origin == nil { + if err := verifyServiceMessagePart(body, verify.GetBodySignature); err != nil { + return errors.Wrap(err, "could not verify body") + } + + return nil + } + + if verify.GetBodySignature() != nil { + return errors.New("body signature at the matryoshka upper level") + } + + return verifyMatryoshkaLevel(body, meta.getOrigin(), origin) +} + +func verifyServiceMessagePart(part stableMarshaler, sigRdr func() *service.Signature) error { + return signature.VerifyDataWithSource( &stableMarshalerWrapper{part}, keySignatureSource(sigRdr()), - ); err != nil { - return err - } - - return nil + ) +} + +func serviceMessageBody(req interface{}) stableMarshaler { + switch v := req.(type) { + case *accounting.BalanceRequest: + return v.GetBody() + case *accounting.BalanceResponse: + return v.GetBody() + default: + panic(fmt.Sprintf("unsupported service message %T", req)) + } } From e0eb67bac805c924f72ce7f9fd03f985a7da1e07 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 18 Aug 2020 19:06:35 +0300 Subject: [PATCH 0330/1196] v2/signature: Add test for BalanceResponse Signed-off-by: Leonard Lyubich --- v2/signature/sign_test.go | 72 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 v2/signature/sign_test.go diff --git a/v2/signature/sign_test.go b/v2/signature/sign_test.go new file mode 100644 index 0000000..a1bfcab --- /dev/null +++ b/v2/signature/sign_test.go @@ -0,0 +1,72 @@ +package signature + +import ( + "testing" + + "github.com/nspcc-dev/neofs-api-go/v2/accounting" + "github.com/nspcc-dev/neofs-api-go/v2/service" + crypto "github.com/nspcc-dev/neofs-crypto" + "github.com/stretchr/testify/require" +) + +func TestBalanceResponse(t *testing.T) { + dec := new(accounting.Decimal) + dec.SetValue(100) + + body := new(accounting.BalanceResponseBody) + body.SetBalance(dec) + + meta := new(service.ResponseMetaHeader) + meta.SetTTL(1) + + req := new(accounting.BalanceResponse) + req.SetBody(body) + req.SetMetaHeader(meta) + + // verify unsigned request + require.Error(t, VerifyServiceMessage(req)) + + key, err := crypto.LoadPrivateKey("Kwk6k2eC3L3QuPvD8aiaNyoSXgQ2YL1bwS5CP1oKoA9waeAze97s") + require.NoError(t, err) + + // sign request + require.NoError(t, SignServiceMessage(key, req)) + + // verification must pass + require.NoError(t, VerifyServiceMessage(req)) + + // add level to meta header matryoshka + meta = new(service.ResponseMetaHeader) + meta.SetOrigin(req.GetMetaHeader()) + req.SetMetaHeader(meta) + + // sign request + require.NoError(t, SignServiceMessage(key, req)) + + // verification must pass + require.NoError(t, VerifyServiceMessage(req)) + + // corrupt body + dec.SetValue(dec.GetValue() + 1) + + // verification must fail + require.Error(t, VerifyServiceMessage(req)) + + // restore body + dec.SetValue(dec.GetValue() - 1) + + // corrupt meta header + meta.SetTTL(meta.GetTTL() + 1) + + // verification must fail + require.Error(t, VerifyServiceMessage(req)) + + // restore meta header + meta.SetTTL(meta.GetTTL() - 1) + + // corrupt origin verification header + req.GetVerificationHeader().SetOrigin(nil) + + // verification must fail + require.Error(t, VerifyServiceMessage(req)) +} From 61c536148db83617d712d2b479e1275e880f0ef3 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Tue, 18 Aug 2020 18:21:29 +0300 Subject: [PATCH 0331/1196] Fix short header version setter stack overflow Signed-off-by: Alex Vanin --- v2/object/types.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/v2/object/types.go b/v2/object/types.go index 3ed9f39..c6a0d43 100644 --- a/v2/object/types.go +++ b/v2/object/types.go @@ -326,7 +326,7 @@ func (h *ShortHeader) GetVersion() *service.Version { func (h *ShortHeader) SetVersion(v *service.Version) { if h != nil { - h.SetVersion(v) + h.version = v } } From e55384355223a884123a929afef916340ecd5b1c Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Wed, 19 Aug 2020 11:14:49 +0300 Subject: [PATCH 0332/1196] Update unified DeleteRequestBody structure after api update Signed-off-by: Alex Vanin --- v2/object/types.go | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/v2/object/types.go b/v2/object/types.go index c6a0d43..a8c6123 100644 --- a/v2/object/types.go +++ b/v2/object/types.go @@ -153,8 +153,6 @@ type PutResponse struct { type DeleteRequestBody struct { addr *refs.Address - - ownerID *refs.OwnerID } type DeleteRequest struct { @@ -1080,20 +1078,6 @@ func (r *DeleteRequestBody) SetAddress(v *refs.Address) { } } -func (r *DeleteRequestBody) GetOwnerID() *refs.OwnerID { - if r != nil { - return r.ownerID - } - - return nil -} - -func (r *DeleteRequestBody) SetOwnerID(v *refs.OwnerID) { - if r != nil { - r.ownerID = v - } -} - func (r *DeleteRequest) GetBody() *DeleteRequestBody { if r != nil { return r.body From 93d2d129846ab732b5318b63f1cd1f1a755c8889 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Tue, 18 Aug 2020 18:28:02 +0300 Subject: [PATCH 0333/1196] Add stable marshal for object structure Signed-off-by: Alex Vanin --- v2/object/marshal.go | 450 ++++++++++++++++++++++++++++++++++++++ v2/object/marshal_test.go | 233 ++++++++++++++++++++ 2 files changed, 683 insertions(+) create mode 100644 v2/object/marshal.go create mode 100644 v2/object/marshal_test.go diff --git a/v2/object/marshal.go b/v2/object/marshal.go new file mode 100644 index 0000000..7693846 --- /dev/null +++ b/v2/object/marshal.go @@ -0,0 +1,450 @@ +package object + +import ( + "github.com/nspcc-dev/neofs-api-go/util/proto" +) + +const ( + shortHdrVersionField = 1 + shortHdrEpochField = 2 + shortHdrOwnerField = 3 + shortHdrObjectTypeField = 4 + shortHdrPayloadLength = 5 + + attributeKeyField = 1 + attributeValueField = 2 + + splitHdrParentField = 1 + splitHdrPreviousField = 2 + splitHdrParentSignatureField = 3 + splitHdrParentHeaderField = 4 + splitHdrChildrenField = 5 + + hdrVersionField = 1 + hdrContainerIDField = 2 + hdrOwnerIDField = 3 + hdrEpochField = 4 + hdrPayloadLengthField = 5 + hdrPayloadHashField = 6 + hdrObjectTypeField = 7 + hdrHomomorphicHashField = 8 + hdrSessionTokenField = 9 + hdrAttributesField = 10 + hdrSplitField = 11 + + objIDField = 1 + objSignatureField = 2 + objHeaderField = 3 + objPayloadField = 4 +) + +func (h *ShortHeader) StableMarshal(buf []byte) ([]byte, error) { + if h == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, h.StableSize()) + } + + var ( + offset, n int + err error + ) + + n, err = proto.NestedStructureMarshal(shortHdrVersionField, buf[offset:], h.version) + if err != nil { + return nil, err + } + + offset += n + + n, err = proto.UInt64Marshal(shortHdrEpochField, buf[offset:], h.creatEpoch) + if err != nil { + return nil, err + } + + offset += n + + n, err = proto.NestedStructureMarshal(shortHdrOwnerField, buf[offset:], h.ownerID) + if err != nil { + return nil, err + } + + offset += n + + n, err = proto.EnumMarshal(shortHdrObjectTypeField, buf[offset:], int32(h.typ)) + if err != nil { + return nil, err + } + + offset += n + + _, err = proto.UInt64Marshal(shortHdrPayloadLength, buf[offset:], h.payloadLen) + if err != nil { + return nil, err + } + + return buf, nil +} + +func (h *ShortHeader) StableSize() (size int) { + if h == nil { + return 0 + } + + size += proto.NestedStructureSize(shortHdrVersionField, h.version) + size += proto.UInt64Size(shortHdrEpochField, h.creatEpoch) + size += proto.NestedStructureSize(shortHdrOwnerField, h.ownerID) + size += proto.EnumSize(shortHdrObjectTypeField, int32(h.typ)) + size += proto.UInt64Size(shortHdrPayloadLength, h.payloadLen) + + return size +} + +func (a *Attribute) StableMarshal(buf []byte) ([]byte, error) { + if a == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, a.StableSize()) + } + + var ( + offset, n int + err error + ) + + n, err = proto.StringMarshal(attributeKeyField, buf[offset:], a.key) + if err != nil { + return nil, err + } + + offset += n + + _, err = proto.StringMarshal(attributeValueField, buf[offset:], a.val) + if err != nil { + return nil, err + } + + return buf, nil +} + +func (a *Attribute) StableSize() (size int) { + if a == nil { + return 0 + } + + size += proto.StringSize(shortHdrVersionField, a.key) + size += proto.StringSize(shortHdrEpochField, a.val) + + return size +} + +func (h *SplitHeader) StableMarshal(buf []byte) ([]byte, error) { + if h == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, h.StableSize()) + } + + var ( + offset, n int + err error + ) + + n, err = proto.NestedStructureMarshal(splitHdrParentField, buf[offset:], h.par) + if err != nil { + return nil, err + } + + offset += n + + n, err = proto.NestedStructureMarshal(splitHdrPreviousField, buf[offset:], h.prev) + if err != nil { + return nil, err + } + + offset += n + + n, err = proto.NestedStructureMarshal(splitHdrParentSignatureField, buf[offset:], h.parSig) + if err != nil { + return nil, err + } + + offset += n + + n, err = proto.NestedStructureMarshal(splitHdrParentHeaderField, buf[offset:], h.parHdr) + if err != nil { + return nil, err + } + + offset += n + + for i := range h.children { + n, err = proto.NestedStructureMarshal(splitHdrChildrenField, buf[offset:], h.children[i]) + if err != nil { + return nil, err + } + + offset += n + } + + return buf, nil +} + +func (h *SplitHeader) StableSize() (size int) { + if h == nil { + return 0 + } + + size += proto.NestedStructureSize(splitHdrParentField, h.par) + size += proto.NestedStructureSize(splitHdrPreviousField, h.prev) + size += proto.NestedStructureSize(splitHdrParentSignatureField, h.parSig) + size += proto.NestedStructureSize(splitHdrParentHeaderField, h.parHdr) + + for i := range h.children { + size += proto.NestedStructureSize(splitHdrChildrenField, h.children[i]) + } + + return size +} + +func (h *Header) StableMarshal(buf []byte) ([]byte, error) { + if h == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, h.StableSize()) + } + + var ( + offset, n int + err error + ) + + n, err = proto.NestedStructureMarshal(hdrVersionField, buf[offset:], h.version) + if err != nil { + return nil, err + } + + offset += n + + n, err = proto.NestedStructureMarshal(hdrContainerIDField, buf[offset:], h.cid) + if err != nil { + return nil, err + } + + offset += n + + n, err = proto.NestedStructureMarshal(hdrOwnerIDField, buf[offset:], h.ownerID) + if err != nil { + return nil, err + } + + offset += n + + n, err = proto.UInt64Marshal(hdrEpochField, buf[offset:], h.creatEpoch) + if err != nil { + return nil, err + } + + offset += n + + n, err = proto.UInt64Marshal(hdrPayloadLengthField, buf[offset:], h.payloadLen) + if err != nil { + return nil, err + } + + offset += n + + n, err = proto.BytesMarshal(hdrPayloadHashField, buf[offset:], h.payloadHash) + if err != nil { + return nil, err + } + + offset += n + + n, err = proto.EnumMarshal(hdrObjectTypeField, buf[offset:], int32(h.typ)) + if err != nil { + return nil, err + } + + offset += n + + n, err = proto.BytesMarshal(hdrHomomorphicHashField, buf[offset:], h.homoHash) + if err != nil { + return nil, err + } + + offset += n + + n, err = proto.NestedStructureMarshal(hdrSessionTokenField, buf[offset:], h.sessionToken) + if err != nil { + return nil, err + } + + offset += n + + for i := range h.attr { + n, err = proto.NestedStructureMarshal(hdrAttributesField, buf[offset:], h.attr[i]) + if err != nil { + return nil, err + } + + offset += n + } + + _, err = proto.NestedStructureMarshal(hdrSplitField, buf[offset:], h.split) + if err != nil { + return nil, err + } + + return buf, nil +} + +func (h *Header) StableSize() (size int) { + if h == nil { + return 0 + } + + size += proto.NestedStructureSize(hdrVersionField, h.version) + size += proto.NestedStructureSize(hdrContainerIDField, h.cid) + size += proto.NestedStructureSize(hdrOwnerIDField, h.ownerID) + size += proto.UInt64Size(hdrEpochField, h.creatEpoch) + size += proto.UInt64Size(hdrPayloadLengthField, h.payloadLen) + size += proto.BytesSize(hdrPayloadHashField, h.payloadHash) + size += proto.EnumSize(hdrObjectTypeField, int32(h.typ)) + size += proto.BytesSize(hdrHomomorphicHashField, h.homoHash) + size += proto.NestedStructureSize(hdrSessionTokenField, h.sessionToken) + for i := range h.attr { + size += proto.NestedStructureSize(hdrAttributesField, h.attr[i]) + } + size += proto.NestedStructureSize(hdrSplitField, h.split) + + return size +} + +func (o *Object) StableMarshal(buf []byte) ([]byte, error) { + if o == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, o.StableSize()) + } + + var ( + offset, n int + err error + ) + + n, err = proto.NestedStructureMarshal(objIDField, buf[offset:], o.objectID) + if err != nil { + return nil, err + } + + offset += n + + n, err = proto.NestedStructureMarshal(objSignatureField, buf[offset:], o.idSig) + if err != nil { + return nil, err + } + + offset += n + + n, err = proto.NestedStructureMarshal(objHeaderField, buf[offset:], o.header) + if err != nil { + return nil, err + } + + offset += n + + _, err = proto.BytesMarshal(objPayloadField, buf[offset:], o.payload) + if err != nil { + return nil, err + } + + return buf, nil +} + +func (o *Object) StableSize() (size int) { + if o == nil { + return 0 + } + + size += proto.NestedStructureSize(objIDField, o.objectID) + size += proto.NestedStructureSize(objSignatureField, o.idSig) + size += proto.NestedStructureSize(objHeaderField, o.header) + size += proto.BytesSize(objPayloadField, o.payload) + + return size +} + +func (r *PutRequestBody) StableMarshal(buf []byte) ([]byte, error) { + panic("not implemented") +} + +func (r *PutRequestBody) StableSize() (size int) { + panic("not implemented") +} + +func (r *GetResponseBody) StableMarshal(buf []byte) ([]byte, error) { + panic("not implemented") +} + +func (r *GetResponseBody) StableSize() (size int) { + panic("not implemented") +} + +func (r *PutResponseBody) StableMarshal(buf []byte) ([]byte, error) { + panic("not implemented") +} + +func (r *PutResponseBody) StableSize() (size int) { + panic("not implemented") +} + +func (r *DeleteResponseBody) StableMarshal(buf []byte) ([]byte, error) { + panic("not implemented") +} + +func (r *DeleteResponseBody) StableSize() (size int) { + panic("not implemented") +} + +func (r *HeadResponseBody) StableMarshal(buf []byte) ([]byte, error) { + panic("not implemented") +} + +func (r *HeadResponseBody) StableSize() (size int) { + panic("not implemented") +} + +func (r *SearchResponseBody) StableMarshal(buf []byte) ([]byte, error) { + panic("not implemented") +} + +func (r *SearchResponseBody) StableSize() (size int) { + panic("not implemented") +} + +func (r *GetRangeResponseBody) StableMarshal(buf []byte) ([]byte, error) { + panic("not implemented") +} + +func (r *GetRangeResponseBody) StableSize() (size int) { + panic("not implemented") +} + +func (r *GetRangeHashResponseBody) StableMarshal(buf []byte) ([]byte, error) { + panic("not implemented") +} + +func (r *GetRangeHashResponseBody) StableSize() (size int) { + panic("not implemented") +} diff --git a/v2/object/marshal_test.go b/v2/object/marshal_test.go new file mode 100644 index 0000000..a2a37ac --- /dev/null +++ b/v2/object/marshal_test.go @@ -0,0 +1,233 @@ +package object_test + +import ( + "testing" + + "github.com/nspcc-dev/neofs-api-go/v2/object" + grpc "github.com/nspcc-dev/neofs-api-go/v2/object/grpc" + "github.com/nspcc-dev/neofs-api-go/v2/refs" + "github.com/nspcc-dev/neofs-api-go/v2/service" + "github.com/stretchr/testify/require" +) + +func TestShortHeader_StableMarshal(t *testing.T) { + hdrFrom := generateShortHeader("Owner ID") + transport := new(grpc.ShortHeader) + + t.Run("non empty", func(t *testing.T) { + wire, err := hdrFrom.StableMarshal(nil) + require.NoError(t, err) + + err = transport.Unmarshal(wire) + require.NoError(t, err) + + hdrTo := object.ShortHeaderFromGRPCMessage(transport) + require.Equal(t, hdrFrom, hdrTo) + }) +} + +func TestAttribute_StableMarshal(t *testing.T) { + from := generateAttribute("Key", "Value") + transport := new(grpc.Header_Attribute) + + t.Run("non empty", func(t *testing.T) { + wire, err := from.StableMarshal(nil) + require.NoError(t, err) + + err = transport.Unmarshal(wire) + require.NoError(t, err) + + to := object.AttributeFromGRPCMessage(transport) + require.Equal(t, from, to) + }) +} + +func TestSplitHeader_StableMarshal(t *testing.T) { + from := generateSplit("Split Outside") + hdr := generateHeader(123) + from.SetParentHeader(hdr) + + transport := new(grpc.Header_Split) + + t.Run("non empty", func(t *testing.T) { + wire, err := from.StableMarshal(nil) + require.NoError(t, err) + + err = transport.Unmarshal(wire) + require.NoError(t, err) + + to := object.SplitHeaderFromGRPCMessage(transport) + require.Equal(t, from, to) + }) +} + +func TestHeader_StableMarshal(t *testing.T) { + insideHeader := generateHeader(100) + split := generateSplit("Split") + split.SetParentHeader(insideHeader) + + from := generateHeader(500) + from.SetSplit(split) + + transport := new(grpc.Header) + + t.Run("non empty", func(t *testing.T) { + wire, err := from.StableMarshal(nil) + require.NoError(t, err) + + err = transport.Unmarshal(wire) + require.NoError(t, err) + + to := object.HeaderFromGRPCMessage(transport) + require.Equal(t, from, to) + }) +} + +func TestObject_StableMarshal(t *testing.T) { + from := generateObject("Payload") + transport := new(grpc.Object) + + t.Run("non empty", func(t *testing.T) { + wire, err := from.StableMarshal(nil) + require.NoError(t, err) + + err = transport.Unmarshal(wire) + require.NoError(t, err) + + to := object.ObjectFromGRPCMessage(transport) + require.Equal(t, from, to) + }) +} + +func generateOwner(id string) *refs.OwnerID { + owner := new(refs.OwnerID) + owner.SetValue([]byte(id)) + + return owner +} + +func generateObjectID(id string) *refs.ObjectID { + oid := new(refs.ObjectID) + oid.SetValue([]byte(id)) + + return oid +} + +func generateContainerID(id string) *refs.ContainerID { + cid := new(refs.ContainerID) + cid.SetValue([]byte(id)) + + return cid +} + +func generateSignature(k, v string) *service.Signature { + sig := new(service.Signature) + sig.SetKey([]byte(k)) + sig.SetSign([]byte(v)) + + return sig +} + +func generateVersion(maj, min uint32) *service.Version { + version := new(service.Version) + version.SetMajor(maj) + version.SetMinor(min) + + return version +} + +func generateSessionToken(id string) *service.SessionToken { + lifetime := new(service.TokenLifetime) + lifetime.SetExp(1) + lifetime.SetNbf(2) + lifetime.SetIat(3) + + addr := new(refs.Address) + addr.SetContainerID(generateContainerID("Container ID")) + addr.SetObjectID(generateObjectID("Object ID")) + + objectCtx := new(service.ObjectSessionContext) + objectCtx.SetVerb(service.ObjectVerbPut) + objectCtx.SetAddress(addr) + + tokenBody := new(service.SessionTokenBody) + tokenBody.SetID([]byte(id)) + tokenBody.SetOwnerID(generateOwner("Owner ID")) + tokenBody.SetSessionKey([]byte(id)) + tokenBody.SetLifetime(lifetime) + tokenBody.SetContext(objectCtx) + + sessionToken := new(service.SessionToken) + sessionToken.SetBody(tokenBody) + sessionToken.SetSignature(generateSignature("public key", id)) + + return sessionToken +} + +func generateShortHeader(id string) *object.ShortHeader { + hdr := new(object.ShortHeader) + hdr.SetOwnerID(generateOwner(id)) + hdr.SetVersion(generateVersion(2, 0)) + hdr.SetCreationEpoch(200) + hdr.SetObjectType(object.TypeRegular) + hdr.SetPayloadLength(10) + + return hdr +} + +func generateAttribute(k, v string) *object.Attribute { + attr := new(object.Attribute) + attr.SetValue(v) + attr.SetKey(k) + + return attr +} + +func generateSplit(sig string) *object.SplitHeader { + split := new(object.SplitHeader) + split.SetChildren([]*refs.ObjectID{ + generateObjectID("Child 1"), + generateObjectID("Child 2"), + }) + split.SetParent(generateObjectID("Parent")) + split.SetParentSignature(generateSignature("Key", sig)) + split.SetPrevious(generateObjectID("Previous")) + + return split +} + +func generateHeader(ln uint64) *object.Header { + hdr := new(object.Header) + hdr.SetPayloadLength(ln) + hdr.SetCreationEpoch(ln / 2) + hdr.SetVersion(generateVersion(2, 0)) + hdr.SetOwnerID(generateOwner("Owner ID")) + hdr.SetContainerID(generateContainerID("Contanier ID")) + hdr.SetAttributes([]*object.Attribute{ + generateAttribute("One", "Two"), + generateAttribute("Three", "Four"), + }) + hdr.SetHomomorphicHash([]byte("Homomorphic Hash")) + hdr.SetObjectType(object.TypeRegular) + hdr.SetPayloadHash([]byte("Payload Hash")) + hdr.SetSessionToken(generateSessionToken(string(ln))) + + return hdr +} + +func generateObject(data string) *object.Object { + insideHeader := generateHeader(100) + split := generateSplit("Split") + split.SetParentHeader(insideHeader) + + outsideHeader := generateHeader(500) + outsideHeader.SetSplit(split) + + obj := new(object.Object) + obj.SetSignature(generateSignature("Public Key", "Signature")) + obj.SetObjectID(generateObjectID("Object ID")) + obj.SetPayload([]byte(data)) + obj.SetHeader(outsideHeader) + + return obj +} From dc91753206ce83995cf688c45393603eb1da9b8f Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Tue, 18 Aug 2020 19:46:55 +0300 Subject: [PATCH 0334/1196] Add stable marshal for object service Signed-off-by: Alex Vanin --- v2/object/marshal.go | 768 +++++++++++++++++++++++++++++++++++++- v2/object/marshal_test.go | 457 ++++++++++++++++++++++- 2 files changed, 1202 insertions(+), 23 deletions(-) diff --git a/v2/object/marshal.go b/v2/object/marshal.go index 7693846..3949066 100644 --- a/v2/object/marshal.go +++ b/v2/object/marshal.go @@ -36,6 +36,59 @@ const ( objSignatureField = 2 objHeaderField = 3 objPayloadField = 4 + + getReqBodyAddressField = 1 + getReqBodyRawFlagField = 2 + + getRespInitObjectIDField = 1 + getRespInitSignatureField = 2 + getRespInitHeaderField = 3 + + getRespBodyInitField = 1 + getRespBodyChunkField = 2 + + putReqInitObjectIDField = 1 + putReqInitSignatureField = 2 + putReqInitHeaderField = 3 + putReqInitCopiesNumField = 4 + + putReqBodyInitField = 1 + putReqBodyChunkField = 2 + + putRespBodyObjectIDField = 1 + + deleteReqBodyAddressField = 1 + + headReqBodyAddressField = 1 + headReqBodyMainFlagField = 2 + headReqBodyRawFlagField = 3 + + headRespBodyHeaderField = 1 + headRespBodyShortHeaderField = 2 + + searchFilterMatchField = 1 + searchFilterNameField = 2 + searchFilterValueField = 3 + + searchReqBodyContainerIDField = 1 + searchReqBodyVersionField = 2 + searchReqBodyFiltersField = 3 + + searchRespBodyObjectIDsField = 1 + + rangeOffsetField = 1 + rangeLengthField = 2 + + getRangeReqBodyAddressField = 1 + getRangeReqBodyRangeField = 2 + + getRangeRespChunkField = 1 + + getRangeHashReqBodyAddressField = 1 + getRangeHashReqBodyRangesField = 2 + getRangeHashReqBodySaltField = 3 + + getRangeHashRespBodyHashList = 1 ) func (h *ShortHeader) StableMarshal(buf []byte) ([]byte, error) { @@ -385,66 +438,745 @@ func (o *Object) StableSize() (size int) { return size } -func (r *PutRequestBody) StableMarshal(buf []byte) ([]byte, error) { - panic("not implemented") +func (r *GetRequestBody) StableMarshal(buf []byte) ([]byte, error) { + if r == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, r.StableSize()) + } + + var ( + offset, n int + err error + ) + + n, err = proto.NestedStructureMarshal(getReqBodyAddressField, buf[offset:], r.addr) + if err != nil { + return nil, err + } + + offset += n + + _, err = proto.BoolMarshal(getReqBodyRawFlagField, buf[offset:], r.raw) + if err != nil { + return nil, err + } + + return buf, nil } -func (r *PutRequestBody) StableSize() (size int) { - panic("not implemented") +func (r *GetRequestBody) StableSize() (size int) { + if r == nil { + return 0 + } + + size += proto.NestedStructureSize(getReqBodyAddressField, r.addr) + size += proto.BoolSize(getReqBodyRawFlagField, r.raw) + + return size +} + +func (r *GetObjectPartInit) StableMarshal(buf []byte) ([]byte, error) { + if r == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, r.StableSize()) + } + + var ( + offset, n int + err error + ) + + n, err = proto.NestedStructureMarshal(getRespInitObjectIDField, buf[offset:], r.id) + if err != nil { + return nil, err + } + + offset += n + + n, err = proto.NestedStructureMarshal(getRespInitSignatureField, buf[offset:], r.sig) + if err != nil { + return nil, err + } + + offset += n + + _, err = proto.NestedStructureMarshal(getRespInitHeaderField, buf[offset:], r.hdr) + if err != nil { + return nil, err + } + + return buf, nil +} + +func (r *GetObjectPartInit) StableSize() (size int) { + if r == nil { + return 0 + } + + size += proto.NestedStructureSize(getRespInitObjectIDField, r.id) + size += proto.NestedStructureSize(getRespInitSignatureField, r.sig) + size += proto.NestedStructureSize(getRespInitHeaderField, r.hdr) + + return size } func (r *GetResponseBody) StableMarshal(buf []byte) ([]byte, error) { - panic("not implemented") + if r == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, r.StableSize()) + } + + if r.objPart != nil { + switch v := r.objPart.(type) { + case *GetObjectPartInit: + _, err := proto.NestedStructureMarshal(getRespBodyInitField, buf, v) + if err != nil { + return nil, err + } + case *GetObjectPartChunk: + if v != nil { + _, err := proto.BytesMarshal(getRespBodyChunkField, buf, v.chunk) + if err != nil { + return nil, err + } + } + default: + panic("unknown one of object get response body type") + } + } + + return buf, nil } func (r *GetResponseBody) StableSize() (size int) { - panic("not implemented") + if r == nil { + return 0 + } + + if r.objPart != nil { + switch v := r.objPart.(type) { + case *GetObjectPartInit: + size += proto.NestedStructureSize(getRespBodyInitField, v) + case *GetObjectPartChunk: + if v != nil { + size += proto.BytesSize(getRespBodyChunkField, v.chunk) + } + default: + panic("unknown one of object get response body type") + } + } + + return size +} + +func (r *PutObjectPartInit) StableMarshal(buf []byte) ([]byte, error) { + if r == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, r.StableSize()) + } + + var ( + offset, n int + err error + ) + + n, err = proto.NestedStructureMarshal(putReqInitObjectIDField, buf[offset:], r.id) + if err != nil { + return nil, err + } + + offset += n + + n, err = proto.NestedStructureMarshal(putReqInitSignatureField, buf[offset:], r.sig) + if err != nil { + return nil, err + } + + offset += n + + n, err = proto.NestedStructureMarshal(putReqInitHeaderField, buf[offset:], r.hdr) + if err != nil { + return nil, err + } + + offset += n + + n, err = proto.UInt32Marshal(putReqInitCopiesNumField, buf[offset:], r.copyNum) + if err != nil { + return nil, err + } + + return buf, nil +} + +func (r *PutObjectPartInit) StableSize() (size int) { + if r == nil { + return 0 + } + + size += proto.NestedStructureSize(putReqInitObjectIDField, r.id) + size += proto.NestedStructureSize(putReqInitSignatureField, r.sig) + size += proto.NestedStructureSize(putReqInitHeaderField, r.hdr) + size += proto.UInt32Size(putReqInitCopiesNumField, r.copyNum) + + return size +} + +func (r *PutRequestBody) StableMarshal(buf []byte) ([]byte, error) { + if r == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, r.StableSize()) + } + + if r.objPart != nil { + switch v := r.objPart.(type) { + case *PutObjectPartInit: + _, err := proto.NestedStructureMarshal(putReqBodyInitField, buf, v) + if err != nil { + return nil, err + } + case *PutObjectPartChunk: + if v != nil { + _, err := proto.BytesMarshal(putReqBodyChunkField, buf, v.chunk) + if err != nil { + return nil, err + } + } + default: + panic("unknown one of object put request body type") + } + } + + return buf, nil +} + +func (r *PutRequestBody) StableSize() (size int) { + if r == nil { + return 0 + } + + if r.objPart != nil { + switch v := r.objPart.(type) { + case *PutObjectPartInit: + size += proto.NestedStructureSize(putReqBodyInitField, v) + case *PutObjectPartChunk: + if v != nil { + size += proto.BytesSize(putReqBodyChunkField, v.chunk) + } + default: + panic("unknown one of object get response body type") + } + } + + return size } func (r *PutResponseBody) StableMarshal(buf []byte) ([]byte, error) { - panic("not implemented") + if r == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, r.StableSize()) + } + + _, err := proto.NestedStructureMarshal(putRespBodyObjectIDField, buf, r.id) + if err != nil { + return nil, err + } + + return buf, nil } func (r *PutResponseBody) StableSize() (size int) { - panic("not implemented") + if r == nil { + return 0 + } + + size += proto.NestedStructureSize(putRespBodyObjectIDField, r.id) + + return size +} + +func (r *DeleteRequestBody) StableMarshal(buf []byte) ([]byte, error) { + if r == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, r.StableSize()) + } + + _, err := proto.NestedStructureMarshal(deleteReqBodyAddressField, buf, r.addr) + if err != nil { + return nil, err + } + + return buf, nil +} + +func (r *DeleteRequestBody) StableSize() (size int) { + if r == nil { + return 0 + } + + size += proto.NestedStructureSize(deleteReqBodyAddressField, r.addr) + + return size } func (r *DeleteResponseBody) StableMarshal(buf []byte) ([]byte, error) { - panic("not implemented") + return nil, nil } func (r *DeleteResponseBody) StableSize() (size int) { - panic("not implemented") + return 0 +} + +func (r *HeadRequestBody) StableMarshal(buf []byte) ([]byte, error) { + if r == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, r.StableSize()) + } + + var ( + offset, n int + err error + ) + + n, err = proto.NestedStructureMarshal(headReqBodyAddressField, buf[offset:], r.addr) + if err != nil { + return nil, err + } + + offset += n + + n, err = proto.BoolMarshal(headReqBodyMainFlagField, buf[offset:], r.mainOnly) + if err != nil { + return nil, err + } + + offset += n + + _, err = proto.BoolMarshal(headReqBodyRawFlagField, buf[offset:], r.raw) + if err != nil { + return nil, err + } + + return buf, nil +} + +func (r *HeadRequestBody) StableSize() (size int) { + if r == nil { + return 0 + } + + size += proto.NestedStructureSize(headReqBodyAddressField, r.addr) + size += proto.BoolSize(headReqBodyMainFlagField, r.mainOnly) + size += proto.BoolSize(headReqBodyRawFlagField, r.raw) + + return size } func (r *HeadResponseBody) StableMarshal(buf []byte) ([]byte, error) { - panic("not implemented") + if r == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, r.StableSize()) + } + + if r.hdrPart != nil { + switch v := r.hdrPart.(type) { + case *GetHeaderPartFull: + if v != nil { + _, err := proto.NestedStructureMarshal(headRespBodyHeaderField, buf, v.hdr) + if err != nil { + return nil, err + } + } + case *GetHeaderPartShort: + if v != nil { + _, err := proto.NestedStructureMarshal(headRespBodyShortHeaderField, buf, v.hdr) + if err != nil { + return nil, err + } + } + default: + panic("unknown one of object put request body type") + } + } + + return buf, nil } func (r *HeadResponseBody) StableSize() (size int) { - panic("not implemented") + if r == nil { + return 0 + } + + if r.hdrPart != nil { + switch v := r.hdrPart.(type) { + case *GetHeaderPartFull: + if v != nil { + size += proto.NestedStructureSize(headRespBodyHeaderField, v.hdr) + } + case *GetHeaderPartShort: + if v != nil { + size += proto.NestedStructureSize(headRespBodyShortHeaderField, v.hdr) + } + default: + panic("unknown one of object put request body type") + } + } + + return size +} + +func (f *SearchFilter) StableMarshal(buf []byte) ([]byte, error) { + if f == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, f.StableSize()) + } + + var ( + offset, n int + err error + ) + + n, err = proto.EnumMarshal(searchFilterMatchField, buf[offset:], int32(f.matchType)) + if err != nil { + return nil, err + } + + offset += n + + n, err = proto.StringMarshal(searchFilterNameField, buf[offset:], f.name) + if err != nil { + return nil, err + } + + offset += n + + _, err = proto.StringMarshal(searchFilterValueField, buf[offset:], f.val) + if err != nil { + return nil, err + } + + return buf, nil +} + +func (f *SearchFilter) StableSize() (size int) { + if f == nil { + return 0 + } + + size += proto.EnumSize(searchFilterMatchField, int32(f.matchType)) + size += proto.StringSize(searchFilterNameField, f.name) + size += proto.StringSize(searchFilterValueField, f.val) + + return size +} + +func (r *SearchRequestBody) StableMarshal(buf []byte) ([]byte, error) { + if r == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, r.StableSize()) + } + + var ( + offset, n int + err error + ) + + n, err = proto.NestedStructureMarshal(searchReqBodyContainerIDField, buf[offset:], r.cid) + if err != nil { + return nil, err + } + + offset += n + + n, err = proto.UInt32Marshal(searchReqBodyVersionField, buf[offset:], r.version) + if err != nil { + return nil, err + } + + offset += n + + for i := range r.filters { + n, err = proto.NestedStructureMarshal(searchReqBodyFiltersField, buf[offset:], r.filters[i]) + if err != nil { + return nil, err + } + + offset += n + } + + return buf, nil +} + +func (r *SearchRequestBody) StableSize() (size int) { + if r == nil { + return 0 + } + + size += proto.NestedStructureSize(searchReqBodyContainerIDField, r.cid) + size += proto.UInt32Size(searchReqBodyVersionField, r.version) + + for i := range r.filters { + size += proto.NestedStructureSize(searchReqBodyFiltersField, r.filters[i]) + } + + return size } func (r *SearchResponseBody) StableMarshal(buf []byte) ([]byte, error) { - panic("not implemented") + if r == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, r.StableSize()) + } + + var ( + offset, n int + err error + ) + + for i := range r.idList { + n, err = proto.NestedStructureMarshal(searchRespBodyObjectIDsField, buf[offset:], r.idList[i]) + if err != nil { + return nil, err + } + + offset += n + } + + return buf, nil } func (r *SearchResponseBody) StableSize() (size int) { - panic("not implemented") + if r == nil { + return 0 + } + + for i := range r.idList { + size += proto.NestedStructureSize(searchRespBodyObjectIDsField, r.idList[i]) + } + + return size +} + +func (r *Range) StableMarshal(buf []byte) ([]byte, error) { + if r == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, r.StableSize()) + } + + var ( + offset, n int + err error + ) + + n, err = proto.UInt64Marshal(rangeOffsetField, buf[offset:], r.off) + if err != nil { + return nil, err + } + + offset += n + + _, err = proto.UInt64Marshal(rangeLengthField, buf[offset:], r.len) + if err != nil { + return nil, err + } + + return buf, nil +} + +func (r *Range) StableSize() (size int) { + if r == nil { + return 0 + } + + size += proto.UInt64Size(rangeOffsetField, r.off) + size += proto.UInt64Size(rangeLengthField, r.len) + + return size +} + +func (r *GetRangeRequestBody) StableMarshal(buf []byte) ([]byte, error) { + if r == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, r.StableSize()) + } + + var ( + offset, n int + err error + ) + + n, err = proto.NestedStructureMarshal(getRangeReqBodyAddressField, buf[offset:], r.addr) + if err != nil { + return nil, err + } + + offset += n + + _, err = proto.NestedStructureMarshal(getRangeReqBodyRangeField, buf[offset:], r.rng) + if err != nil { + return nil, err + } + + return buf, nil +} + +func (r *GetRangeRequestBody) StableSize() (size int) { + if r == nil { + return 0 + } + + size += proto.NestedStructureSize(getRangeReqBodyAddressField, r.addr) + size += proto.NestedStructureSize(getRangeReqBodyRangeField, r.rng) + + return size } func (r *GetRangeResponseBody) StableMarshal(buf []byte) ([]byte, error) { - panic("not implemented") + if r == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, r.StableSize()) + } + + _, err := proto.BytesMarshal(getRangeRespChunkField, buf, r.chunk) + if err != nil { + return nil, err + } + + return buf, nil } func (r *GetRangeResponseBody) StableSize() (size int) { - panic("not implemented") + if r == nil { + return 0 + } + + size += proto.BytesSize(getRangeRespChunkField, r.chunk) + + return size +} + +func (r *GetRangeHashRequestBody) StableMarshal(buf []byte) ([]byte, error) { + if r == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, r.StableSize()) + } + + var ( + offset, n int + err error + ) + + n, err = proto.NestedStructureMarshal(getRangeHashReqBodyAddressField, buf[offset:], r.addr) + if err != nil { + return nil, err + } + + offset += n + + for i := range r.rngs { + n, err = proto.NestedStructureMarshal(getRangeHashReqBodyRangesField, buf[offset:], r.rngs[i]) + if err != nil { + return nil, err + } + + offset += n + } + + _, err = proto.BytesMarshal(getRangeHashReqBodySaltField, buf[offset:], r.salt) + if err != nil { + return nil, err + } + + return buf, nil +} + +func (r *GetRangeHashRequestBody) StableSize() (size int) { + if r == nil { + return 0 + } + + size += proto.NestedStructureSize(getRangeHashReqBodyAddressField, r.addr) + + for i := range r.rngs { + size += proto.NestedStructureSize(getRangeHashReqBodyRangesField, r.rngs[i]) + } + + size += proto.BytesSize(getRangeHashReqBodySaltField, r.salt) + + return size } func (r *GetRangeHashResponseBody) StableMarshal(buf []byte) ([]byte, error) { - panic("not implemented") + if r == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, r.StableSize()) + } + + _, err := proto.RepeatedBytesMarshal(getRangeHashRespBodyHashList, buf, r.hashList) + if err != nil { + return nil, err + } + + return buf, nil } func (r *GetRangeHashResponseBody) StableSize() (size int) { - panic("not implemented") + if r == nil { + return 0 + } + + size += proto.RepeatedBytesSize(getRangeHashRespBodyHashList, r.hashList) + + return size } diff --git a/v2/object/marshal_test.go b/v2/object/marshal_test.go index a2a37ac..87dc0c7 100644 --- a/v2/object/marshal_test.go +++ b/v2/object/marshal_test.go @@ -1,6 +1,7 @@ package object_test import ( + "fmt" "testing" "github.com/nspcc-dev/neofs-api-go/v2/object" @@ -99,6 +100,266 @@ func TestObject_StableMarshal(t *testing.T) { }) } +func TestGetRequestBody_StableMarshal(t *testing.T) { + from := generateGetRequestBody("Container ID", "Object ID") + transport := new(grpc.GetRequest_Body) + + t.Run("non empty", func(t *testing.T) { + wire, err := from.StableMarshal(nil) + require.NoError(t, err) + + err = transport.Unmarshal(wire) + require.NoError(t, err) + + to := object.GetRequestBodyFromGRPCMessage(transport) + require.Equal(t, from, to) + }) +} + +func TestGetResponseBody_StableMarshal(t *testing.T) { + initFrom := generateGetResponseBody(true) + chunkFrom := generateGetResponseBody(false) + transport := new(grpc.GetResponse_Body) + + t.Run("init non empty", func(t *testing.T) { + wire, err := initFrom.StableMarshal(nil) + require.NoError(t, err) + + err = transport.Unmarshal(wire) + require.NoError(t, err) + + to := object.GetResponseBodyFromGRPCMessage(transport) + require.Equal(t, initFrom, to) + }) + + t.Run("chunk non empty", func(t *testing.T) { + wire, err := chunkFrom.StableMarshal(nil) + require.NoError(t, err) + + err = transport.Unmarshal(wire) + require.NoError(t, err) + + to := object.GetResponseBodyFromGRPCMessage(transport) + require.Equal(t, chunkFrom, to) + }) +} + +func TestPutRequestBody_StableMarshal(t *testing.T) { + initFrom := generatePutRequestBody(true) + chunkFrom := generatePutRequestBody(false) + transport := new(grpc.PutRequest_Body) + + t.Run("init non empty", func(t *testing.T) { + wire, err := initFrom.StableMarshal(nil) + require.NoError(t, err) + + err = transport.Unmarshal(wire) + require.NoError(t, err) + + to := object.PutRequestBodyFromGRPCMessage(transport) + require.Equal(t, initFrom, to) + }) + + t.Run("chunk non empty", func(t *testing.T) { + wire, err := chunkFrom.StableMarshal(nil) + require.NoError(t, err) + + err = transport.Unmarshal(wire) + require.NoError(t, err) + + to := object.PutRequestBodyFromGRPCMessage(transport) + require.Equal(t, chunkFrom, to) + }) +} + +func TestPutRequestBody_StableSize(t *testing.T) { + from := generatePutResponseBody("Object ID") + transport := new(grpc.PutResponse_Body) + + t.Run("non empty", func(t *testing.T) { + wire, err := from.StableMarshal(nil) + require.NoError(t, err) + + err = transport.Unmarshal(wire) + require.NoError(t, err) + + to := object.PutResponseBodyFromGRPCMessage(transport) + require.Equal(t, from, to) + }) +} + +func TestDeleteRequestBody_StableMarshal(t *testing.T) { + from := generateDeleteRequestBody("Container ID", "Object ID") + transport := new(grpc.DeleteRequest_Body) + + t.Run("non empty", func(t *testing.T) { + wire, err := from.StableMarshal(nil) + require.NoError(t, err) + + err = transport.Unmarshal(wire) + require.NoError(t, err) + + to := object.DeleteRequestBodyFromGRPCMessage(transport) + require.Equal(t, from, to) + }) +} + +func TestDeleteResponseBody_StableMarshal(t *testing.T) { + from := generateDeleteResponseBody() + transport := new(grpc.DeleteResponse_Body) + + t.Run("non empty", func(t *testing.T) { + wire, err := from.StableMarshal(nil) + require.NoError(t, err) + + err = transport.Unmarshal(wire) + require.NoError(t, err) + + to := object.DeleteResponseBodyFromGRPCMessage(transport) + require.Equal(t, from, to) + }) +} + +func TestSplitHeaderFromGRPCMessage(t *testing.T) { + from := generateHeadRequestBody("Container ID", "Object ID") + transport := new(grpc.HeadRequest_Body) + + t.Run("non empty", func(t *testing.T) { + wire, err := from.StableMarshal(nil) + require.NoError(t, err) + + err = transport.Unmarshal(wire) + require.NoError(t, err) + + to := object.HeadRequestBodyFromGRPCMessage(transport) + require.Equal(t, from, to) + }) +} + +func TestHeadResponseBody_StableMarshal(t *testing.T) { + shortFrom := generateHeadResponseBody(true) + fullFrom := generateHeadResponseBody(false) + transport := new(grpc.HeadResponse_Body) + + t.Run("short header non empty", func(t *testing.T) { + wire, err := shortFrom.StableMarshal(nil) + require.NoError(t, err) + + err = transport.Unmarshal(wire) + require.NoError(t, err) + + to := object.HeadResponseBodyFromGRPCMessage(transport) + require.Equal(t, shortFrom, to) + }) + + t.Run("full header non empty", func(t *testing.T) { + wire, err := fullFrom.StableMarshal(nil) + require.NoError(t, err) + + err = transport.Unmarshal(wire) + require.NoError(t, err) + + to := object.HeadResponseBodyFromGRPCMessage(transport) + require.Equal(t, fullFrom, to) + }) +} + +func TestSearchRequestBody_StableMarshal(t *testing.T) { + from := generateSearchRequestBody(10, "Container ID") + transport := new(grpc.SearchRequest_Body) + + t.Run("non empty", func(t *testing.T) { + wire, err := from.StableMarshal(nil) + require.NoError(t, err) + + err = transport.Unmarshal(wire) + require.NoError(t, err) + + to := object.SearchRequestBodyFromGRPCMessage(transport) + require.Equal(t, from, to) + }) +} + +func TestSearchResponseBody_StableMarshal(t *testing.T) { + from := generateSearchResponseBody(10) + transport := new(grpc.SearchResponse_Body) + + t.Run("non empty", func(t *testing.T) { + wire, err := from.StableMarshal(nil) + require.NoError(t, err) + + err = transport.Unmarshal(wire) + require.NoError(t, err) + + to := object.SearchResponseBodyFromGRPCMessage(transport) + require.Equal(t, from, to) + }) +} + +func TestGetRangeRequestBody_StableMarshal(t *testing.T) { + from := generateRangeRequestBody("Container ID", "Object ID") + transport := new(grpc.GetRangeRequest_Body) + + t.Run("non empty", func(t *testing.T) { + wire, err := from.StableMarshal(nil) + require.NoError(t, err) + + err = transport.Unmarshal(wire) + require.NoError(t, err) + + to := object.GetRangeRequestBodyFromGRPCMessage(transport) + require.Equal(t, from, to) + }) +} + +func TestGetRangeResponseBody_StableMarshal(t *testing.T) { + from := generateRangeResponseBody("some data") + transport := new(grpc.GetRangeResponse_Body) + + t.Run("non empty", func(t *testing.T) { + wire, err := from.StableMarshal(nil) + require.NoError(t, err) + + err = transport.Unmarshal(wire) + require.NoError(t, err) + + to := object.GetRangeResponseBodyFromGRPCMessage(transport) + require.Equal(t, from, to) + }) +} + +func TestGetRangeHashRequestBody_StableMarshal(t *testing.T) { + from := generateRangeHashRequestBody("Container ID", "Object ID", 5) + transport := new(grpc.GetRangeHashRequest_Body) + + t.Run("non empty", func(t *testing.T) { + wire, err := from.StableMarshal(nil) + require.NoError(t, err) + + err = transport.Unmarshal(wire) + require.NoError(t, err) + + to := object.GetRangeHashRequestBodyFromGRPCMessage(transport) + require.Equal(t, from, to) + }) +} + +func TestGetRangeHashResponseBody_StableMarshal(t *testing.T) { + from := generateRangeHashResponseBody(5) + transport := new(grpc.GetRangeHashResponse_Body) + + t.Run("non empty", func(t *testing.T) { + wire, err := from.StableMarshal(nil) + require.NoError(t, err) + + err = transport.Unmarshal(wire) + require.NoError(t, err) + + to := object.GetRangeHashResponseBodyFromGRPCMessage(transport) + require.Equal(t, from, to) + }) +} + func generateOwner(id string) *refs.OwnerID { owner := new(refs.OwnerID) owner.SetValue([]byte(id)) @@ -136,19 +397,23 @@ func generateVersion(maj, min uint32) *service.Version { return version } +func generateAddress(cid, oid string) *refs.Address { + addr := new(refs.Address) + addr.SetObjectID(generateObjectID(oid)) + addr.SetContainerID(generateContainerID(cid)) + + return addr +} + func generateSessionToken(id string) *service.SessionToken { lifetime := new(service.TokenLifetime) lifetime.SetExp(1) lifetime.SetNbf(2) lifetime.SetIat(3) - addr := new(refs.Address) - addr.SetContainerID(generateContainerID("Container ID")) - addr.SetObjectID(generateObjectID("Object ID")) - objectCtx := new(service.ObjectSessionContext) objectCtx.SetVerb(service.ObjectVerbPut) - objectCtx.SetAddress(addr) + objectCtx.SetAddress(generateAddress("Container ID", "Object ID")) tokenBody := new(service.SessionTokenBody) tokenBody.SetID([]byte(id)) @@ -231,3 +496,185 @@ func generateObject(data string) *object.Object { return obj } + +func generateGetRequestBody(cid, oid string) *object.GetRequestBody { + req := new(object.GetRequestBody) + req.SetAddress(generateAddress(cid, oid)) + req.SetRaw(true) + + return req +} + +func generateGetResponseBody(flag bool) *object.GetResponseBody { + resp := new(object.GetResponseBody) + var part object.GetObjectPart + + if flag { + init := new(object.GetObjectPartInit) + init.SetObjectID(generateObjectID("Object ID")) + init.SetSignature(generateSignature("Key", "Signature")) + init.SetHeader(generateHeader(10)) + part = init + } else { + chunk := new(object.GetObjectPartChunk) + chunk.SetChunk([]byte("Some data chunk")) + part = chunk + } + resp.SetObjectPart(part) + + return resp +} + +func generatePutRequestBody(flag bool) *object.PutRequestBody { + req := new(object.PutRequestBody) + var part object.PutObjectPart + + if flag { + init := new(object.PutObjectPartInit) + init.SetObjectID(generateObjectID("Object ID")) + init.SetSignature(generateSignature("Key", "Signature")) + init.SetHeader(generateHeader(10)) + init.SetCopiesNumber(1) + part = init + } else { + chunk := new(object.PutObjectPartChunk) + chunk.SetChunk([]byte("Some data chunk")) + part = chunk + } + req.SetObjectPart(part) + + return req +} + +func generatePutResponseBody(oid string) *object.PutResponseBody { + resp := new(object.PutResponseBody) + resp.SetObjectID(generateObjectID(oid)) + + return resp +} + +func generateDeleteRequestBody(cid, oid string) *object.DeleteRequestBody { + req := new(object.DeleteRequestBody) + req.SetAddress(generateAddress(cid, oid)) + + return req +} + +func generateDeleteResponseBody() *object.DeleteResponseBody { + return new(object.DeleteResponseBody) +} + +func generateHeadRequestBody(cid, oid string) *object.HeadRequestBody { + req := new(object.HeadRequestBody) + req.SetAddress(generateAddress(cid, oid)) + req.SetRaw(true) + req.SetMainOnly(true) + + return req +} + +func generateHeadResponseBody(flag bool) *object.HeadResponseBody { + req := new(object.HeadResponseBody) + var part object.GetHeaderPart + + if flag { + short := new(object.GetHeaderPartShort) + short.SetShortHeader(generateShortHeader("short id")) + part = short + } else { + full := new(object.GetHeaderPartFull) + full.SetHeader(generateHeader(30)) + part = full + } + + req.SetHeaderPart(part) + + return req +} + +func generateFilter(k, v string) *object.SearchFilter { + f := new(object.SearchFilter) + f.SetName(k) + f.SetValue(v) + f.SetMatchType(object.MatchStringEqual) + + return f +} + +func generateSearchRequestBody(n int, id string) *object.SearchRequestBody { + req := new(object.SearchRequestBody) + req.SetContainerID(generateContainerID(id)) + req.SetVersion(1) + + ff := make([]*object.SearchFilter, n) + + for i := 0; i < n; i++ { + ff[i] = generateFilter("Some Key", fmt.Sprintf("Value %d", i+1)) + } + req.SetFilters(ff) + + return req +} + +func generateSearchResponseBody(n int) *object.SearchResponseBody { + resp := new(object.SearchResponseBody) + list := make([]*refs.ObjectID, n) + for i := 0; i < n; i++ { + list[i] = generateObjectID(fmt.Sprintf("Object ID %d", i+1)) + } + + resp.SetIDList(list) + + return resp +} + +func generateRange(off, ln uint64) *object.Range { + r := new(object.Range) + r.SetOffset(off) + r.SetLength(ln) + + return r +} + +func generateRangeRequestBody(cid, oid string) *object.GetRangeRequestBody { + req := new(object.GetRangeRequestBody) + req.SetAddress(generateAddress(cid, oid)) + req.SetRange(generateRange(10, 20)) + + return req +} + +func generateRangeResponseBody(data string) *object.GetRangeResponseBody { + resp := new(object.GetRangeResponseBody) + resp.SetChunk([]byte(data)) + + return resp +} + +func generateRangeHashRequestBody(cid, oid string, n int) *object.GetRangeHashRequestBody { + req := new(object.GetRangeHashRequestBody) + req.SetAddress(generateAddress(cid, oid)) + + rngs := make([]*object.Range, n) + for i := 0; i < n; i++ { + rngs[i] = generateRange(100, 200+uint64(n)) + } + + req.SetRanges(rngs) + req.SetSalt([]byte("xor salt")) + + return req +} + +func generateRangeHashResponseBody(n int) *object.GetRangeHashResponseBody { + resp := new(object.GetRangeHashResponseBody) + + list := make([][]byte, n) + for i := 0; i < n; i++ { + list[i] = []byte("Some homomorphic hash data" + string(n)) + } + + resp.SetHashList(list) + + return resp +} From 53ce0967c6f898b618ea6ce8b957e2fd6fae804f Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 19 Aug 2020 16:06:03 +0300 Subject: [PATCH 0335/1196] v2/signature: Support all service requests/responses Signed-off-by: Leonard Lyubich --- v2/signature/sign.go | 71 ++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 69 insertions(+), 2 deletions(-) diff --git a/v2/signature/sign.go b/v2/signature/sign.go index e17e90e..086ce0d 100644 --- a/v2/signature/sign.go +++ b/v2/signature/sign.go @@ -6,7 +6,10 @@ import ( "github.com/nspcc-dev/neofs-api-go/util/signature" "github.com/nspcc-dev/neofs-api-go/v2/accounting" + "github.com/nspcc-dev/neofs-api-go/v2/container" + "github.com/nspcc-dev/neofs-api-go/v2/object" "github.com/nspcc-dev/neofs-api-go/v2/service" + "github.com/nspcc-dev/neofs-api-go/v2/session" "github.com/pkg/errors" ) @@ -286,11 +289,75 @@ func verifyServiceMessagePart(part stableMarshaler, sigRdr func() *service.Signa func serviceMessageBody(req interface{}) stableMarshaler { switch v := req.(type) { + default: + panic(fmt.Sprintf("unsupported service message %T", req)) + + /* Accounting */ case *accounting.BalanceRequest: return v.GetBody() case *accounting.BalanceResponse: return v.GetBody() - default: - panic(fmt.Sprintf("unsupported service message %T", req)) + + /* Session */ + case *session.CreateRequest: + return v.GetBody() + case *session.CreateResponse: + return v.GetBody() + + /* Container */ + case *container.PutRequest: + return v.GetBody() + case *container.PutResponse: + return v.GetBody() + case *container.DeleteRequest: + return v.GetBody() + case *container.DeleteResponse: + return v.GetBody() + case *container.GetRequest: + return v.GetBody() + case *container.GetResponse: + return v.GetBody() + case *container.ListRequest: + return v.GetBody() + case *container.ListResponse: + return v.GetBody() + case *container.SetExtendedACLRequest: + return v.GetBody() + case *container.SetExtendedACLResponse: + return v.GetBody() + case *container.GetExtendedACLRequest: + return v.GetBody() + case *container.GetExtendedACLResponse: + return v.GetBody() + + /* Object */ + case *object.PutRequest: + return v.GetBody() + case *object.PutResponse: + return v.GetBody() + case *object.GetRequest: + return v.GetBody() + case *object.GetResponse: + return v.GetBody() + case *object.HeadRequest: + return v.GetBody() + case *object.HeadResponse: + return v.GetBody() + case *object.SearchRequest: + return v.GetBody() + case *object.SearchResponse: + return v.GetBody() + case *object.DeleteRequest: + return v.GetBody() + case *object.DeleteResponse: + return v.GetBody() + case *object.GetRangeRequest: + return v.GetBody() + case *object.GetRangeResponse: + return v.GetBody() + case *object.GetRangeHashRequest: + return v.GetBody() + case *object.GetRangeHashResponse: + return v.GetBody() } } From 28d8acc58a171202825179c3978f7eea6d25e718 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 19 Aug 2020 16:21:30 +0300 Subject: [PATCH 0336/1196] v2/accounting: Implement thin NeoFS gRPC client Defines thin wrapper over the generated gRPC Accounting service client to fix some of its options. Signed-off-by: Leonard Lyubich --- v2/accounting/grpc/client.go | 62 ++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 v2/accounting/grpc/client.go diff --git a/v2/accounting/grpc/client.go b/v2/accounting/grpc/client.go new file mode 100644 index 0000000..6a626b1 --- /dev/null +++ b/v2/accounting/grpc/client.go @@ -0,0 +1,62 @@ +package accounting + +import ( + "context" + + "github.com/pkg/errors" + "google.golang.org/grpc" +) + +// Client wraps AccountingServiceClient +// with pre-defined configurations. +type Client struct { + *cfg + + client AccountingServiceClient +} + +// Option represents Client option. +type Option func(*cfg) + +type cfg struct { + callOpts []grpc.CallOption +} + +// ErrNilAccountingServiceClient is returned by functions that expect +// a non-nil AccountingServiceClient, but received nil. +var ErrNilAccountingServiceClient = errors.New("accounting gRPC client is nil") + +func defaultCfg() *cfg { + return new(cfg) +} + +// NewClient creates, initializes and returns a new Client instance. +// +// Options are applied one by one in order. +func NewClient(c AccountingServiceClient, opts ...Option) (*Client, error) { + if c == nil { + return nil, ErrNilAccountingServiceClient + } + + cfg := defaultCfg() + for i := range opts { + opts[i](cfg) + } + + return &Client{ + cfg: cfg, + client: c, + }, nil +} + +func (c *Client) Balance(ctx context.Context, req *BalanceRequest) (*BalanceResponse, error) { + return c.client.Balance(ctx, req, c.callOpts...) +} + +// WithCallOptions returns Option that configures +// Client to attach call options to each rpc call. +func WithCallOptions(opts []grpc.CallOption) Option { + return func(c *cfg) { + c.callOpts = opts + } +} From 9253dac7533bd19be35e94e68c53b5192565737b Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 20 Aug 2020 12:28:00 +0300 Subject: [PATCH 0337/1196] v2: Add cross-service client package Add package with cross-service client utilities for working with transport protocols and basic network types. Signed-off-by: Leonard Lyubich --- v2/client/options.go | 108 +++++++++++++++++++++++++++++++++++++++++++ v2/client/proto.go | 23 +++++++++ 2 files changed, 131 insertions(+) create mode 100644 v2/client/options.go create mode 100644 v2/client/proto.go diff --git a/v2/client/options.go b/v2/client/options.go new file mode 100644 index 0000000..3dcdff1 --- /dev/null +++ b/v2/client/options.go @@ -0,0 +1,108 @@ +package client + +import ( + "context" + "net" + + "google.golang.org/grpc" +) + +type Option func(*cfg) + +type cfg struct { + addr string + + conn net.Conn + + gRPC cfgGRPC +} + +type cfgGRPC struct { + dialCtx context.Context + + dialOpts []grpc.DialOption + + conn *grpc.ClientConn +} + +func defaultCfg() *cfg { + return &cfg{ + gRPC: cfgGRPC{ + dialCtx: context.Background(), + dialOpts: []grpc.DialOption{ + grpc.WithInsecure(), + }, + }, + } +} + +func NewGRPCClientConn(opts ...Option) (*grpc.ClientConn, error) { + cfg := defaultCfg() + + for i := range opts { + opts[i](cfg) + } + + var err error + + if cfg.gRPC.conn == nil { + if cfg.conn != nil { + if cfg.addr == "" { + cfg.addr = cfg.conn.RemoteAddr().String() + } + + cfg.gRPC.dialOpts = append(cfg.gRPC.dialOpts, + grpc.WithContextDialer(func(context.Context, string) (net.Conn, error) { + return cfg.conn, nil + }), + ) + } + + cfg.gRPC.conn, err = grpc.DialContext(cfg.gRPC.dialCtx, cfg.addr, cfg.gRPC.dialOpts...) + if err != nil { + return nil, err + } + } + + return cfg.gRPC.conn, err +} + +func WithNetworkAddress(v string) Option { + return func(c *cfg) { + if v != "" { + c.addr = v + } + } +} + +func WithNetConn(v net.Conn) Option { + return func(c *cfg) { + if v != nil { + c.conn = v + } + } +} + +func WithGRPCDialContext(v context.Context) Option { + return func(c *cfg) { + if v != nil { + c.gRPC.dialCtx = v + } + } +} + +func WithGRPCDialOpts(v []grpc.DialOption) Option { + return func(c *cfg) { + if len(v) > 0 { + c.gRPC.dialOpts = v + } + } +} + +func WithGRPCConn(v *grpc.ClientConn) Option { + return func(c *cfg) { + if v != nil { + c.gRPC.conn = v + } + } +} diff --git a/v2/client/proto.go b/v2/client/proto.go new file mode 100644 index 0000000..f6a6aa6 --- /dev/null +++ b/v2/client/proto.go @@ -0,0 +1,23 @@ +package client + +import ( + "github.com/pkg/errors" +) + +type Protocol uint32 + +const ( + _ Protocol = iota + ProtoGRPC +) + +var ErrProtoUnsupported = errors.New("unsupported protocol") + +func (p Protocol) String() string { + switch p { + case ProtoGRPC: + return "GRPC" + default: + return "UNKNOWN" + } +} From 5206d14c16db02f1d3851cf2176e7f77b9b1cfef Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 20 Aug 2020 12:28:32 +0300 Subject: [PATCH 0338/1196] v2/accounting: Add universal client Signed-off-by: Leonard Lyubich --- v2/accounting/client.go | 156 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 156 insertions(+) create mode 100644 v2/accounting/client.go diff --git a/v2/accounting/client.go b/v2/accounting/client.go new file mode 100644 index 0000000..b62a3b0 --- /dev/null +++ b/v2/accounting/client.go @@ -0,0 +1,156 @@ +package accounting + +import ( + "context" + + accounting "github.com/nspcc-dev/neofs-api-go/v2/accounting/grpc" + "github.com/nspcc-dev/neofs-api-go/v2/client" + "github.com/pkg/errors" + "google.golang.org/grpc" +) + +// Client represents universal accounting +// transport client. +type Client struct { + client *getBalanceClient +} + +// Option represents Client option. +type Option func(*cfg) + +type cfg struct { + proto client.Protocol + + globalOpts []client.Option + + gRPC cfgGRPC +} + +type cfgGRPC struct { + serviceClient accounting.AccountingServiceClient + + grpcCallOpts []grpc.CallOption + + callOpts []accounting.Option + + client *accounting.Client +} + +type getBalanceClient struct { + requestConverter func(*BalanceRequest) interface{} + + caller func(context.Context, interface{}) (interface{}, error) + + responseConverter func(interface{}) *BalanceResponse +} + +// Balance sends BalanceRequest over the network and returns BalanceResponse. +// +// It returns any error encountered during the call. +func (c *Client) Balance(ctx context.Context, req *BalanceRequest) (*BalanceResponse, error) { + resp, err := c.client.caller(ctx, c.client.requestConverter(req)) + if err != nil { + return nil, errors.Wrap(err, "could not send balance request") + } + + return c.client.responseConverter(resp), nil +} + +func defaultCfg() *cfg { + return &cfg{ + proto: client.ProtoGRPC, + } +} + +func New(opts ...Option) (*Client, error) { + cfg := defaultCfg() + + for i := range opts { + opts[i](cfg) + } + + var err error + + switch cfg.proto { + case client.ProtoGRPC: + var c *accounting.Client + if c, err = newGRPCClient(cfg); err != nil { + break + } + + return &Client{ + client: &getBalanceClient{ + requestConverter: func(req *BalanceRequest) interface{} { + return BalanceRequestToGRPCMessage(req) + }, + caller: func(ctx context.Context, req interface{}) (interface{}, error) { + return c.Balance(ctx, req.(*accounting.BalanceRequest)) + }, + responseConverter: func(resp interface{}) *BalanceResponse { + return BalanceResponseFromGRPCMessage(resp.(*accounting.BalanceResponse)) + }, + }, + }, nil + default: + err = client.ErrProtoUnsupported + } + + return nil, errors.Wrapf(err, "could not create %s Accounting client", cfg.proto) +} + +func newGRPCClient(cfg *cfg) (*accounting.Client, error) { + var err error + + if cfg.gRPC.client == nil { + if cfg.gRPC.serviceClient == nil { + conn, err := client.NewGRPCClientConn(cfg.globalOpts...) + if err != nil { + return nil, errors.Wrap(err, "could not open gRPC client connection") + } + + cfg.gRPC.serviceClient = accounting.NewAccountingServiceClient(conn) + } + + cfg.gRPC.client, err = accounting.NewClient( + cfg.gRPC.serviceClient, + append( + cfg.gRPC.callOpts, + accounting.WithCallOptions(cfg.gRPC.grpcCallOpts), + )..., + ) + } + + return cfg.gRPC.client, err +} + +func WithGlobalOpts(v ...client.Option) Option { + return func(c *cfg) { + if len(v) > 0 { + c.globalOpts = v + } + } +} + +func WithGRPCServiceClient(v accounting.AccountingServiceClient) Option { + return func(c *cfg) { + c.gRPC.serviceClient = v + } +} + +func WithGRPCCallOpts(v []grpc.CallOption) Option { + return func(c *cfg) { + c.gRPC.grpcCallOpts = v + } +} + +func WithGRPCClientOpts(v []accounting.Option) Option { + return func(c *cfg) { + c.gRPC.callOpts = v + } +} + +func WithGRPCClient(v *accounting.Client) Option { + return func(c *cfg) { + c.gRPC.client = v + } +} From 288b89630b29a5d2fd1c3aa512bd5de671b49a4c Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 20 Aug 2020 12:28:54 +0300 Subject: [PATCH 0339/1196] v2/accounting: Cover universal client with unit test Signed-off-by: Leonard Lyubich --- v2/accounting/test/client_test.go | 163 ++++++++++++++++++++++++++++++ 1 file changed, 163 insertions(+) create mode 100644 v2/accounting/test/client_test.go diff --git a/v2/accounting/test/client_test.go b/v2/accounting/test/client_test.go new file mode 100644 index 0000000..686137f --- /dev/null +++ b/v2/accounting/test/client_test.go @@ -0,0 +1,163 @@ +package main + +import ( + "context" + "crypto/ecdsa" + "errors" + "testing" + + "github.com/nspcc-dev/neofs-api-go/v2/accounting" + accountingGRPC "github.com/nspcc-dev/neofs-api-go/v2/accounting/grpc" + "github.com/nspcc-dev/neofs-api-go/v2/refs" + "github.com/nspcc-dev/neofs-api-go/v2/service" + "github.com/nspcc-dev/neofs-api-go/v2/signature" + "github.com/nspcc-dev/neofs-crypto/test" + "github.com/stretchr/testify/require" + "google.golang.org/grpc" +) + +type testGRPCClient struct { + server *testGRPCServer +} + +type testGRPCServer struct { + key *ecdsa.PrivateKey + resp *accounting.BalanceResponse + err error +} + +func (s *testGRPCClient) Balance(ctx context.Context, in *accountingGRPC.BalanceRequest, opts ...grpc.CallOption) (*accountingGRPC.BalanceResponse, error) { + return s.server.Balance(ctx, in) +} + +func (s *testGRPCServer) Balance(_ context.Context, req *accountingGRPC.BalanceRequest) (*accountingGRPC.BalanceResponse, error) { + if s.err != nil { + return nil, s.err + } + + // verify request structure + if err := signature.VerifyServiceMessage( + accounting.BalanceRequestFromGRPCMessage(req), + ); err != nil { + return nil, err + } + + // sign response structure + if err := signature.SignServiceMessage(s.key, s.resp); err != nil { + return nil, err + } + + return accounting.BalanceResponseToGRPCMessage(s.resp), nil +} + +func testRequest() *accounting.BalanceRequest { + ownerID := new(refs.OwnerID) + ownerID.SetValue([]byte{1, 2, 3}) + + body := new(accounting.BalanceRequestBody) + body.SetOwnerID(ownerID) + + meta := new(service.RequestMetaHeader) + meta.SetTTL(1) + + req := new(accounting.BalanceRequest) + req.SetBody(body) + req.SetMetaHeader(meta) + + return req +} + +func testResponse() *accounting.BalanceResponse { + dec := new(accounting.Decimal) + dec.SetValue(10) + + body := new(accounting.BalanceResponseBody) + body.SetBalance(dec) + + meta := new(service.ResponseMetaHeader) + meta.SetTTL(1) + + resp := new(accounting.BalanceResponse) + resp.SetBody(body) + resp.SetMetaHeader(meta) + + return resp +} + +func TestGRPCClient(t *testing.T) { + ctx := context.TODO() + + cliKey := test.DecodeKey(0) + srvKey := test.DecodeKey(1) + + t.Run("gRPC server error", func(t *testing.T) { + srvErr := errors.New("test server error") + + srv := &testGRPCServer{ + err: srvErr, + } + + cli := &testGRPCClient{ + server: srv, + } + + c, err := accounting.New(accounting.WithGRPCServiceClient(cli)) + require.NoError(t, err) + + resp, err := c.Balance(ctx, new(accounting.BalanceRequest)) + require.True(t, errors.Is(err, srvErr)) + require.Nil(t, resp) + }) + + t.Run("invalid request structure", func(t *testing.T) { + req := testRequest() + + require.Error(t, signature.VerifyServiceMessage(req)) + + c, err := accounting.New( + accounting.WithGRPCServiceClient( + &testGRPCClient{ + server: new(testGRPCServer), + }, + ), + ) + require.NoError(t, err) + + resp, err := c.Balance(ctx, req) + require.Error(t, err) + require.Nil(t, resp) + }) + + t.Run("correct response", func(t *testing.T) { + req := testRequest() + + require.NoError(t, signature.SignServiceMessage(cliKey, req)) + + resp := testResponse() + + { // w/o this require.Equal fails due to nil and []T{} difference + meta := new(service.ResponseMetaHeader) + meta.SetXHeaders([]*service.XHeader{}) + resp.SetMetaHeader(meta) + } + + c, err := accounting.New( + accounting.WithGRPCServiceClient( + &testGRPCClient{ + server: &testGRPCServer{ + key: srvKey, + resp: resp, + }, + }, + ), + ) + require.NoError(t, err) + + r, err := c.Balance(ctx, req) + require.NoError(t, err) + + require.NoError(t, signature.VerifyServiceMessage(r)) + require.Equal(t, resp.GetBody(), r.GetBody()) + require.Equal(t, resp.GetMetaHeader(), r.GetMetaHeader()) + }) +} From 8f48c9c2f775a6dcd9613330ee5c6e65128d017a Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 20 Aug 2020 12:47:32 +0300 Subject: [PATCH 0340/1196] v2/session: Implement thin NeoFS gRPC client Define thin wrapper over the generated gRPC Accounting service client to fix some of its options. Signed-off-by: Leonard Lyubich --- v2/session/grpc/client.go | 62 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 v2/session/grpc/client.go diff --git a/v2/session/grpc/client.go b/v2/session/grpc/client.go new file mode 100644 index 0000000..acf6133 --- /dev/null +++ b/v2/session/grpc/client.go @@ -0,0 +1,62 @@ +package session + +import ( + "context" + + "github.com/pkg/errors" + "google.golang.org/grpc" +) + +// Client wraps SessionServiceClient +// with pre-defined configurations. +type Client struct { + *cfg + + client SessionServiceClient +} + +// Option represents Client option. +type Option func(*cfg) + +type cfg struct { + callOpts []grpc.CallOption +} + +// ErrNilSessionServiceClient is returned by functions that expect +// a non-nil SessionServiceClient, but received nil. +var ErrNilSessionServiceClient = errors.New("session gRPC client is nil") + +func defaultCfg() *cfg { + return new(cfg) +} + +// NewClient creates, initializes and returns a new Client instance. +// +// Options are applied one by one in order. +func NewClient(c SessionServiceClient, opts ...Option) (*Client, error) { + if c == nil { + return nil, ErrNilSessionServiceClient + } + + cfg := defaultCfg() + for i := range opts { + opts[i](cfg) + } + + return &Client{ + cfg: cfg, + client: c, + }, nil +} + +func (c *Client) Create(ctx context.Context, req *CreateRequest) (*CreateResponse, error) { + return c.client.Create(ctx, req, c.callOpts...) +} + +// WithCallOptions returns Option that configures +// Client to attach call options to each rpc call. +func WithCallOptions(opts []grpc.CallOption) Option { + return func(c *cfg) { + c.callOpts = opts + } +} From c62cd5c5a9519f03b7ad4084bc6737a091eb2710 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 20 Aug 2020 13:01:55 +0300 Subject: [PATCH 0341/1196] v2/session: Add universal client Signed-off-by: Leonard Lyubich --- v2/session/client.go | 156 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 156 insertions(+) create mode 100644 v2/session/client.go diff --git a/v2/session/client.go b/v2/session/client.go new file mode 100644 index 0000000..7232f9f --- /dev/null +++ b/v2/session/client.go @@ -0,0 +1,156 @@ +package session + +import ( + "context" + + "github.com/nspcc-dev/neofs-api-go/v2/client" + session "github.com/nspcc-dev/neofs-api-go/v2/session/grpc" + "github.com/pkg/errors" + "google.golang.org/grpc" +) + +// Client represents universal session +// transport client. +type Client struct { + client *createClient +} + +// Option represents Client option. +type Option func(*cfg) + +type cfg struct { + proto client.Protocol + + globalOpts []client.Option + + gRPC cfgGRPC +} + +type cfgGRPC struct { + serviceClient session.SessionServiceClient + + grpcCallOpts []grpc.CallOption + + callOpts []session.Option + + client *session.Client +} + +type createClient struct { + requestConverter func(*CreateRequest) interface{} + + caller func(context.Context, interface{}) (interface{}, error) + + responseConverter func(interface{}) *CreateResponse +} + +// Create sends CreateRequest over the network and returns CreateResponse. +// +// It returns any error encountered during the call. +func (c *Client) Create(ctx context.Context, req *CreateRequest) (*CreateResponse, error) { + resp, err := c.client.caller(ctx, c.client.requestConverter(req)) + if err != nil { + return nil, errors.Wrap(err, "could not send session init request") + } + + return c.client.responseConverter(resp), nil +} + +func defaultCfg() *cfg { + return &cfg{ + proto: client.ProtoGRPC, + } +} + +func New(opts ...Option) (*Client, error) { + cfg := defaultCfg() + + for i := range opts { + opts[i](cfg) + } + + var err error + + switch cfg.proto { + case client.ProtoGRPC: + var c *session.Client + if c, err = newGRPCClient(cfg); err != nil { + break + } + + return &Client{ + client: &createClient{ + requestConverter: func(req *CreateRequest) interface{} { + return CreateRequestToGRPCMessage(req) + }, + caller: func(ctx context.Context, req interface{}) (interface{}, error) { + return c.Create(ctx, req.(*session.CreateRequest)) + }, + responseConverter: func(resp interface{}) *CreateResponse { + return CreateResponseFromGRPCMessage(resp.(*session.CreateResponse)) + }, + }, + }, nil + default: + err = client.ErrProtoUnsupported + } + + return nil, errors.Wrapf(err, "could not create %s Session client", cfg.proto) +} + +func newGRPCClient(cfg *cfg) (*session.Client, error) { + var err error + + if cfg.gRPC.client == nil { + if cfg.gRPC.serviceClient == nil { + conn, err := client.NewGRPCClientConn(cfg.globalOpts...) + if err != nil { + return nil, errors.Wrap(err, "could not open gRPC client connection") + } + + cfg.gRPC.serviceClient = session.NewSessionServiceClient(conn) + } + + cfg.gRPC.client, err = session.NewClient( + cfg.gRPC.serviceClient, + append( + cfg.gRPC.callOpts, + session.WithCallOptions(cfg.gRPC.grpcCallOpts), + )..., + ) + } + + return cfg.gRPC.client, err +} + +func WithGlobalOpts(v ...client.Option) Option { + return func(c *cfg) { + if len(v) > 0 { + c.globalOpts = v + } + } +} + +func WithGRPCServiceClient(v session.SessionServiceClient) Option { + return func(c *cfg) { + c.gRPC.serviceClient = v + } +} + +func WithGRPCCallOpts(v []grpc.CallOption) Option { + return func(c *cfg) { + c.gRPC.grpcCallOpts = v + } +} + +func WithGRPCClientOpts(v []session.Option) Option { + return func(c *cfg) { + c.gRPC.callOpts = v + } +} + +func WithGRPCClient(v *session.Client) Option { + return func(c *cfg) { + c.gRPC.client = v + } +} From e046e3fd040c08c86f026925471b145f62e0fef3 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 20 Aug 2020 13:07:34 +0300 Subject: [PATCH 0342/1196] v2/session: Cover universal client with unit test Signed-off-by: Leonard Lyubich --- v2/session/test/client_test.go | 160 +++++++++++++++++++++++++++++++++ 1 file changed, 160 insertions(+) create mode 100644 v2/session/test/client_test.go diff --git a/v2/session/test/client_test.go b/v2/session/test/client_test.go new file mode 100644 index 0000000..156bc8e --- /dev/null +++ b/v2/session/test/client_test.go @@ -0,0 +1,160 @@ +package main + +import ( + "context" + "crypto/ecdsa" + "errors" + "testing" + + "github.com/nspcc-dev/neofs-api-go/v2/refs" + "github.com/nspcc-dev/neofs-api-go/v2/service" + "github.com/nspcc-dev/neofs-api-go/v2/session" + sessionGRPC "github.com/nspcc-dev/neofs-api-go/v2/session/grpc" + "github.com/nspcc-dev/neofs-api-go/v2/signature" + "github.com/nspcc-dev/neofs-crypto/test" + "github.com/stretchr/testify/require" + "google.golang.org/grpc" +) + +type testGRPCClient struct { + server *testGRPCServer +} + +type testGRPCServer struct { + key *ecdsa.PrivateKey + resp *session.CreateResponse + err error +} + +func (s *testGRPCClient) Create(ctx context.Context, in *sessionGRPC.CreateRequest, opts ...grpc.CallOption) (*sessionGRPC.CreateResponse, error) { + return s.server.Create(ctx, in) +} + +func (s *testGRPCServer) Create(_ context.Context, req *sessionGRPC.CreateRequest) (*sessionGRPC.CreateResponse, error) { + if s.err != nil { + return nil, s.err + } + + // verify request structure + if err := signature.VerifyServiceMessage( + session.CreateRequestFromGRPCMessage(req), + ); err != nil { + return nil, err + } + + // sign response structure + if err := signature.SignServiceMessage(s.key, s.resp); err != nil { + return nil, err + } + + return session.CreateResponseToGRPCMessage(s.resp), nil +} + +func testRequest() *session.CreateRequest { + ownerID := new(refs.OwnerID) + ownerID.SetValue([]byte{1, 2, 3}) + + body := new(session.CreateRequestBody) + body.SetOwnerID(ownerID) + + meta := new(service.RequestMetaHeader) + meta.SetTTL(1) + + req := new(session.CreateRequest) + req.SetBody(body) + req.SetMetaHeader(meta) + + return req +} + +func testResponse() *session.CreateResponse { + body := new(session.CreateResponseBody) + body.SetID([]byte{1, 2, 3}) + + meta := new(service.ResponseMetaHeader) + meta.SetTTL(1) + + resp := new(session.CreateResponse) + resp.SetBody(body) + resp.SetMetaHeader(meta) + + return resp +} + +func TestGRPCClient(t *testing.T) { + ctx := context.TODO() + + cliKey := test.DecodeKey(0) + srvKey := test.DecodeKey(1) + + t.Run("gRPC server error", func(t *testing.T) { + srvErr := errors.New("test server error") + + srv := &testGRPCServer{ + err: srvErr, + } + + cli := &testGRPCClient{ + server: srv, + } + + c, err := session.New(session.WithGRPCServiceClient(cli)) + require.NoError(t, err) + + resp, err := c.Create(ctx, new(session.CreateRequest)) + require.True(t, errors.Is(err, srvErr)) + require.Nil(t, resp) + }) + + t.Run("invalid request structure", func(t *testing.T) { + req := testRequest() + + require.Error(t, signature.VerifyServiceMessage(req)) + + c, err := session.New( + session.WithGRPCServiceClient( + &testGRPCClient{ + server: new(testGRPCServer), + }, + ), + ) + require.NoError(t, err) + + resp, err := c.Create(ctx, req) + require.Error(t, err) + require.Nil(t, resp) + }) + + t.Run("correct response", func(t *testing.T) { + req := testRequest() + + require.NoError(t, signature.SignServiceMessage(cliKey, req)) + + resp := testResponse() + + { // w/o this require.Equal fails due to nil and []T{} difference + meta := new(service.ResponseMetaHeader) + meta.SetXHeaders([]*service.XHeader{}) + resp.SetMetaHeader(meta) + } + + c, err := session.New( + session.WithGRPCServiceClient( + &testGRPCClient{ + server: &testGRPCServer{ + key: srvKey, + resp: resp, + }, + }, + ), + ) + require.NoError(t, err) + + r, err := c.Create(ctx, req) + require.NoError(t, err) + + require.NoError(t, signature.VerifyServiceMessage(r)) + require.Equal(t, resp.GetBody(), r.GetBody()) + require.Equal(t, resp.GetMetaHeader(), r.GetMetaHeader()) + }) +} From cb7831b00cfb58280d491643764273749491dfa9 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 20 Aug 2020 13:21:55 +0300 Subject: [PATCH 0343/1196] v2/container: Implement thin NeoFS gRPC client Signed-off-by: Leonard Lyubich --- v2/container/grpc/client.go | 82 +++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 v2/container/grpc/client.go diff --git a/v2/container/grpc/client.go b/v2/container/grpc/client.go new file mode 100644 index 0000000..8e3cdf9 --- /dev/null +++ b/v2/container/grpc/client.go @@ -0,0 +1,82 @@ +package container + +import ( + "context" + + "github.com/pkg/errors" + "google.golang.org/grpc" +) + +// Client wraps ContainerServiceClient +// with pre-defined configurations. +type Client struct { + *cfg + + client ContainerServiceClient +} + +// Option represents Client option. +type Option func(*cfg) + +type cfg struct { + callOpts []grpc.CallOption +} + +// ErrNilContainerServiceClient is returned by functions that expect +// a non-nil ContainerServiceClient, but received nil. +var ErrNilContainerServiceClient = errors.New("container gRPC client is nil") + +func defaultCfg() *cfg { + return new(cfg) +} + +// NewClient creates, initializes and returns a new Client instance. +// +// Options are applied one by one in order. +func NewClient(c ContainerServiceClient, opts ...Option) (*Client, error) { + if c == nil { + return nil, ErrNilContainerServiceClient + } + + cfg := defaultCfg() + for i := range opts { + opts[i](cfg) + } + + return &Client{ + cfg: cfg, + client: c, + }, nil +} + +func (c *Client) Put(ctx context.Context, req *PutRequest) (*PutResponse, error) { + return c.client.Put(ctx, req, c.callOpts...) +} + +func (c *Client) Get(ctx context.Context, req *GetRequest) (*GetResponse, error) { + return c.client.Get(ctx, req, c.callOpts...) +} + +func (c *Client) Delete(ctx context.Context, req *DeleteRequest) (*DeleteResponse, error) { + return c.client.Delete(ctx, req, c.callOpts...) +} + +func (c *Client) List(ctx context.Context, req *ListRequest) (*ListResponse, error) { + return c.client.List(ctx, req, c.callOpts...) +} + +func (c *Client) SetExtendedACL(ctx context.Context, req *SetExtendedACLRequest) (*SetExtendedACLResponse, error) { + return c.client.SetExtendedACL(ctx, req, c.callOpts...) +} + +func (c *Client) GetExtendedACL(ctx context.Context, req *GetExtendedACLRequest) (*GetExtendedACLResponse, error) { + return c.client.GetExtendedACL(ctx, req, c.callOpts...) +} + +// WithCallOptions returns Option that configures +// Client to attach call options to each rpc call. +func WithCallOptions(opts []grpc.CallOption) Option { + return func(c *cfg) { + c.callOpts = opts + } +} From 7b491829b9b873d224164d6fadb5febcafe84f49 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 20 Aug 2020 13:46:22 +0300 Subject: [PATCH 0344/1196] v2/container: Add universal client Signed-off-by: Leonard Lyubich --- v2/container/client.go | 321 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 321 insertions(+) create mode 100644 v2/container/client.go diff --git a/v2/container/client.go b/v2/container/client.go new file mode 100644 index 0000000..9c8e1a3 --- /dev/null +++ b/v2/container/client.go @@ -0,0 +1,321 @@ +package container + +import ( + "context" + + "github.com/nspcc-dev/neofs-api-go/v2/client" + container "github.com/nspcc-dev/neofs-api-go/v2/container/grpc" + "github.com/pkg/errors" + "google.golang.org/grpc" +) + +// Client represents universal container +// transport client. +type Client struct { + cPut *putClient + + cGet *getClient + + cDel *delClient + + cList *listClient + + cSetEACL *setEACLClient + + cGetEACL *getEACLClient +} + +// Option represents Client option. +type Option func(*cfg) + +type cfg struct { + proto client.Protocol + + globalOpts []client.Option + + gRPC cfgGRPC +} + +type cfgGRPC struct { + serviceClient container.ContainerServiceClient + + grpcCallOpts []grpc.CallOption + + callOpts []container.Option + + client *container.Client +} + +type putClient struct { + requestConverter func(*PutRequest) interface{} + + caller func(context.Context, interface{}) (interface{}, error) + + responseConverter func(interface{}) *PutResponse +} + +type getClient struct { + requestConverter func(*GetRequest) interface{} + + caller func(context.Context, interface{}) (interface{}, error) + + responseConverter func(interface{}) *GetResponse +} + +type delClient struct { + requestConverter func(*DeleteRequest) interface{} + + caller func(context.Context, interface{}) (interface{}, error) + + responseConverter func(interface{}) *DeleteResponse +} + +type listClient struct { + requestConverter func(*ListRequest) interface{} + + caller func(context.Context, interface{}) (interface{}, error) + + responseConverter func(interface{}) *ListResponse +} + +type setEACLClient struct { + requestConverter func(*SetExtendedACLRequest) interface{} + + caller func(context.Context, interface{}) (interface{}, error) + + responseConverter func(interface{}) *SetExtendedACLResponse +} + +type getEACLClient struct { + requestConverter func(*GetExtendedACLRequest) interface{} + + caller func(context.Context, interface{}) (interface{}, error) + + responseConverter func(interface{}) *GetExtendedACLResponse +} + +// Put sends PutRequest over the network and returns PutResponse. +// +// It returns any error encountered during the call. +func (c *Client) Put(ctx context.Context, req *PutRequest) (*PutResponse, error) { + resp, err := c.cPut.caller(ctx, c.cPut.requestConverter(req)) + if err != nil { + return nil, errors.Wrap(err, "could not send container put request") + } + + return c.cPut.responseConverter(resp), nil +} + +// Get sends GetRequest over the network and returns GetResponse. +// +// It returns any error encountered during the call. +func (c *Client) Get(ctx context.Context, req *GetRequest) (*GetResponse, error) { + resp, err := c.cGet.caller(ctx, c.cGet.requestConverter(req)) + if err != nil { + return nil, errors.Wrap(err, "could not send container get request") + } + + return c.cGet.responseConverter(resp), nil +} + +// Delete sends GetRequest over the network and returns GetResponse. +// +// It returns any error encountered during the call. +func (c *Client) Delete(ctx context.Context, req *DeleteRequest) (*DeleteResponse, error) { + resp, err := c.cDel.caller(ctx, c.cDel.requestConverter(req)) + if err != nil { + return nil, errors.Wrap(err, "could not send container delete request") + } + + return c.cDel.responseConverter(resp), nil +} + +// List sends ListRequest over the network and returns ListResponse. +// +// It returns any error encountered during the call. +func (c *Client) List(ctx context.Context, req *ListRequest) (*ListResponse, error) { + resp, err := c.cList.caller(ctx, c.cList.requestConverter(req)) + if err != nil { + return nil, errors.Wrap(err, "could not send container list request") + } + + return c.cList.responseConverter(resp), nil +} + +// SetExtendedACL sends SetExtendedACLRequest over the network and returns SetExtendedACLResponse. +// +// It returns any error encountered during the call. +func (c *Client) SetExtendedACL(ctx context.Context, req *SetExtendedACLRequest) (*SetExtendedACLResponse, error) { + resp, err := c.cSetEACL.caller(ctx, c.cSetEACL.requestConverter(req)) + if err != nil { + return nil, errors.Wrap(err, "could not send container set EACL request") + } + + return c.cSetEACL.responseConverter(resp), nil +} + +// GetExtendedACL sends GetExtendedACLRequest over the network and returns GetExtendedACLResponse. +// +// It returns any error encountered during the call. +func (c *Client) GetExtendedACL(ctx context.Context, req *GetExtendedACLRequest) (*GetExtendedACLResponse, error) { + resp, err := c.cGetEACL.caller(ctx, c.cGetEACL.requestConverter(req)) + if err != nil { + return nil, errors.Wrap(err, "could not send container get EACL request") + } + + return c.cGetEACL.responseConverter(resp), nil +} + +func defaultCfg() *cfg { + return &cfg{ + proto: client.ProtoGRPC, + } +} + +func New(opts ...Option) (*Client, error) { + cfg := defaultCfg() + + for i := range opts { + opts[i](cfg) + } + + var err error + + switch cfg.proto { + case client.ProtoGRPC: + var c *container.Client + if c, err = newGRPCClient(cfg); err != nil { + break + } + + return &Client{ + cPut: &putClient{ + requestConverter: func(req *PutRequest) interface{} { + return PutRequestToGRPCMessage(req) + }, + caller: func(ctx context.Context, req interface{}) (interface{}, error) { + return c.Put(ctx, req.(*container.PutRequest)) + }, + responseConverter: func(resp interface{}) *PutResponse { + return PutResponseFromGRPCMessage(resp.(*container.PutResponse)) + }, + }, + cGet: &getClient{ + requestConverter: func(req *GetRequest) interface{} { + return GetRequestToGRPCMessage(req) + }, + caller: func(ctx context.Context, req interface{}) (interface{}, error) { + return c.Get(ctx, req.(*container.GetRequest)) + }, + responseConverter: func(resp interface{}) *GetResponse { + return GetResponseFromGRPCMessage(resp.(*container.GetResponse)) + }, + }, + cDel: &delClient{ + requestConverter: func(req *DeleteRequest) interface{} { + return DeleteRequestToGRPCMessage(req) + }, + caller: func(ctx context.Context, req interface{}) (interface{}, error) { + return c.Delete(ctx, req.(*container.DeleteRequest)) + }, + responseConverter: func(resp interface{}) *DeleteResponse { + return DeleteResponseFromGRPCMessage(resp.(*container.DeleteResponse)) + }, + }, + cList: &listClient{ + requestConverter: func(req *ListRequest) interface{} { + return ListRequestToGRPCMessage(req) + }, + caller: func(ctx context.Context, req interface{}) (interface{}, error) { + return c.List(ctx, req.(*container.ListRequest)) + }, + responseConverter: func(resp interface{}) *ListResponse { + return ListResponseFromGRPCMessage(resp.(*container.ListResponse)) + }, + }, + cSetEACL: &setEACLClient{ + requestConverter: func(req *SetExtendedACLRequest) interface{} { + return SetExtendedACLRequestToGRPCMessage(req) + }, + caller: func(ctx context.Context, req interface{}) (interface{}, error) { + return c.SetExtendedACL(ctx, req.(*container.SetExtendedACLRequest)) + }, + responseConverter: func(resp interface{}) *SetExtendedACLResponse { + return SetExtendedACLResponseFromGRPCMessage(resp.(*container.SetExtendedACLResponse)) + }, + }, + cGetEACL: &getEACLClient{ + requestConverter: func(req *GetExtendedACLRequest) interface{} { + return GetExtendedACLRequestToGRPCMessage(req) + }, + caller: func(ctx context.Context, req interface{}) (interface{}, error) { + return c.GetExtendedACL(ctx, req.(*container.GetExtendedACLRequest)) + }, + responseConverter: func(resp interface{}) *GetExtendedACLResponse { + return GetExtendedACLResponseFromGRPCMessage(resp.(*container.GetExtendedACLResponse)) + }, + }, + }, nil + default: + err = client.ErrProtoUnsupported + } + + return nil, errors.Wrapf(err, "could not create %s Session client", cfg.proto) +} + +func newGRPCClient(cfg *cfg) (*container.Client, error) { + var err error + + if cfg.gRPC.client == nil { + if cfg.gRPC.serviceClient == nil { + conn, err := client.NewGRPCClientConn(cfg.globalOpts...) + if err != nil { + return nil, errors.Wrap(err, "could not open gRPC client connection") + } + + cfg.gRPC.serviceClient = container.NewContainerServiceClient(conn) + } + + cfg.gRPC.client, err = container.NewClient( + cfg.gRPC.serviceClient, + append( + cfg.gRPC.callOpts, + container.WithCallOptions(cfg.gRPC.grpcCallOpts), + )..., + ) + } + + return cfg.gRPC.client, err +} + +func WithGlobalOpts(v ...client.Option) Option { + return func(c *cfg) { + if len(v) > 0 { + c.globalOpts = v + } + } +} + +func WithGRPCServiceClient(v container.ContainerServiceClient) Option { + return func(c *cfg) { + c.gRPC.serviceClient = v + } +} + +func WithGRPCCallOpts(v []grpc.CallOption) Option { + return func(c *cfg) { + c.gRPC.grpcCallOpts = v + } +} + +func WithGRPCClientOpts(v []container.Option) Option { + return func(c *cfg) { + c.gRPC.callOpts = v + } +} + +func WithGRPCClient(v *container.Client) Option { + return func(c *cfg) { + c.gRPC.client = v + } +} From f4b734b58e8e4957a4baf457a284ab33a6d0847c Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 20 Aug 2020 14:17:44 +0300 Subject: [PATCH 0345/1196] v2/container: Cover universal client with unit test Signed-off-by: Leonard Lyubich --- v2/container/test/client_test.go | 816 +++++++++++++++++++++++++++++++ 1 file changed, 816 insertions(+) create mode 100644 v2/container/test/client_test.go diff --git a/v2/container/test/client_test.go b/v2/container/test/client_test.go new file mode 100644 index 0000000..b22ed3e --- /dev/null +++ b/v2/container/test/client_test.go @@ -0,0 +1,816 @@ +package main + +import ( + "context" + "crypto/ecdsa" + "errors" + "testing" + + "github.com/nspcc-dev/neofs-api-go/v2/acl" + "github.com/nspcc-dev/neofs-api-go/v2/container" + containerGRPC "github.com/nspcc-dev/neofs-api-go/v2/container/grpc" + "github.com/nspcc-dev/neofs-api-go/v2/refs" + "github.com/nspcc-dev/neofs-api-go/v2/service" + "github.com/nspcc-dev/neofs-api-go/v2/signature" + "github.com/nspcc-dev/neofs-crypto/test" + "github.com/stretchr/testify/require" + "google.golang.org/grpc" +) + +type testGRPCClient struct { + server containerGRPC.ContainerServiceServer +} + +type testGRPCServer struct { + key *ecdsa.PrivateKey + putResp *container.PutResponse + getResp *container.GetResponse + delResp *container.DeleteResponse + listResp *container.ListResponse + sEaclResp *container.SetExtendedACLResponse + gEaclResp *container.GetExtendedACLResponse + err error +} + +func (s *testGRPCClient) Put(ctx context.Context, in *containerGRPC.PutRequest, opts ...grpc.CallOption) (*containerGRPC.PutResponse, error) { + return s.server.Put(ctx, in) +} + +func (s *testGRPCClient) Delete(ctx context.Context, in *containerGRPC.DeleteRequest, opts ...grpc.CallOption) (*containerGRPC.DeleteResponse, error) { + return s.server.Delete(ctx, in) +} + +func (s *testGRPCClient) Get(ctx context.Context, in *containerGRPC.GetRequest, opts ...grpc.CallOption) (*containerGRPC.GetResponse, error) { + return s.server.Get(ctx, in) +} + +func (s *testGRPCClient) List(ctx context.Context, in *containerGRPC.ListRequest, opts ...grpc.CallOption) (*containerGRPC.ListResponse, error) { + return s.server.List(ctx, in) +} + +func (s *testGRPCClient) SetExtendedACL(ctx context.Context, in *containerGRPC.SetExtendedACLRequest, opts ...grpc.CallOption) (*containerGRPC.SetExtendedACLResponse, error) { + return s.server.SetExtendedACL(ctx, in) +} + +func (s *testGRPCClient) GetExtendedACL(ctx context.Context, in *containerGRPC.GetExtendedACLRequest, opts ...grpc.CallOption) (*containerGRPC.GetExtendedACLResponse, error) { + return s.server.GetExtendedACL(ctx, in) +} + +func (s *testGRPCServer) Put(_ context.Context, req *containerGRPC.PutRequest) (*containerGRPC.PutResponse, error) { + if s.err != nil { + return nil, s.err + } + + // verify request structure + if err := signature.VerifyServiceMessage( + container.PutRequestFromGRPCMessage(req), + ); err != nil { + return nil, err + } + + // sign response structure + if err := signature.SignServiceMessage(s.key, s.putResp); err != nil { + return nil, err + } + + return container.PutResponseToGRPCMessage(s.putResp), nil +} + +func (s *testGRPCServer) Delete(_ context.Context, req *containerGRPC.DeleteRequest) (*containerGRPC.DeleteResponse, error) { + if s.err != nil { + return nil, s.err + } + + // verify request structure + if err := signature.VerifyServiceMessage( + container.DeleteRequestFromGRPCMessage(req), + ); err != nil { + return nil, err + } + + // sign response structure + if err := signature.SignServiceMessage(s.key, s.delResp); err != nil { + return nil, err + } + + return container.DeleteResponseToGRPCMessage(s.delResp), nil +} + +func (s *testGRPCServer) Get(_ context.Context, req *containerGRPC.GetRequest) (*containerGRPC.GetResponse, error) { + if s.err != nil { + return nil, s.err + } + + // verify request structure + if err := signature.VerifyServiceMessage( + container.GetRequestFromGRPCMessage(req), + ); err != nil { + return nil, err + } + + // sign response structure + if err := signature.SignServiceMessage(s.key, s.getResp); err != nil { + return nil, err + } + + return container.GetResponseToGRPCMessage(s.getResp), nil +} + +func (s *testGRPCServer) List(_ context.Context, req *containerGRPC.ListRequest) (*containerGRPC.ListResponse, error) { + if s.err != nil { + return nil, s.err + } + + // verify request structure + if err := signature.VerifyServiceMessage( + container.ListRequestFromGRPCMessage(req), + ); err != nil { + return nil, err + } + + // sign response structure + if err := signature.SignServiceMessage(s.key, s.listResp); err != nil { + return nil, err + } + + return container.ListResponseToGRPCMessage(s.listResp), nil +} + +func (s *testGRPCServer) SetExtendedACL(_ context.Context, req *containerGRPC.SetExtendedACLRequest) (*containerGRPC.SetExtendedACLResponse, error) { + if s.err != nil { + return nil, s.err + } + + // verify request structure + if err := signature.VerifyServiceMessage( + container.SetExtendedACLRequestFromGRPCMessage(req), + ); err != nil { + return nil, err + } + + // sign response structure + if err := signature.SignServiceMessage(s.key, s.sEaclResp); err != nil { + return nil, err + } + + return container.SetExtendedACLResponseToGRPCMessage(s.sEaclResp), nil +} + +func (s *testGRPCServer) GetExtendedACL(_ context.Context, req *containerGRPC.GetExtendedACLRequest) (*containerGRPC.GetExtendedACLResponse, error) { + if s.err != nil { + return nil, s.err + } + + // verify request structure + if err := signature.VerifyServiceMessage( + container.GetExtendedACLRequestFromGRPCMessage(req), + ); err != nil { + return nil, err + } + + // sign response structure + if err := signature.SignServiceMessage(s.key, s.gEaclResp); err != nil { + return nil, err + } + + return container.GetExtendedACLResponseToGRPCMessage(s.gEaclResp), nil +} + +func testPutRequest() *container.PutRequest { + cnr := new(container.Container) + cnr.SetBasicACL(1) + + body := new(container.PutRequestBody) + body.SetContainer(cnr) + + meta := new(service.RequestMetaHeader) + meta.SetTTL(1) + + req := new(container.PutRequest) + req.SetBody(body) + req.SetMetaHeader(meta) + + return req +} + +func testPutResponse() *container.PutResponse { + cid := new(refs.ContainerID) + cid.SetValue([]byte{1, 2, 3}) + + body := new(container.PutResponseBody) + body.SetContainerID(cid) + + meta := new(service.ResponseMetaHeader) + meta.SetTTL(1) + meta.SetXHeaders([]*service.XHeader{}) // w/o this require.Equal fails due to nil and []T{} difference + + resp := new(container.PutResponse) + resp.SetBody(body) + resp.SetMetaHeader(meta) + + return resp +} + +func testGetRequest() *container.GetRequest { + cid := new(refs.ContainerID) + cid.SetValue([]byte{1, 2, 3}) + + body := new(container.GetRequestBody) + body.SetContainerID(cid) + + meta := new(service.RequestMetaHeader) + meta.SetTTL(1) + + req := new(container.GetRequest) + req.SetBody(body) + req.SetMetaHeader(meta) + + return req +} + +func testGetResponse() *container.GetResponse { + cnr := new(container.Container) + cnr.SetAttributes([]*container.Attribute{}) // w/o this require.Equal fails due to nil and []T{} difference + + body := new(container.GetResponseBody) + body.SetContainer(cnr) + + meta := new(service.ResponseMetaHeader) + meta.SetTTL(1) + meta.SetXHeaders([]*service.XHeader{}) // w/o this require.Equal fails due to nil and []T{} difference + + resp := new(container.GetResponse) + resp.SetBody(body) + resp.SetMetaHeader(meta) + + return resp +} + +func testDelRequest() *container.DeleteRequest { + cid := new(refs.ContainerID) + cid.SetValue([]byte{1, 2, 3}) + + body := new(container.DeleteRequestBody) + body.SetContainerID(cid) + + meta := new(service.RequestMetaHeader) + meta.SetTTL(1) + + req := new(container.DeleteRequest) + req.SetBody(body) + req.SetMetaHeader(meta) + + return req +} + +func testDelResponse() *container.DeleteResponse { + body := new(container.DeleteResponseBody) + + meta := new(service.ResponseMetaHeader) + meta.SetTTL(1) + meta.SetXHeaders([]*service.XHeader{}) // w/o this require.Equal fails due to nil and []T{} difference + + resp := new(container.DeleteResponse) + resp.SetBody(body) + resp.SetMetaHeader(meta) + + return resp +} + +func testListRequest() *container.ListRequest { + ownerID := new(refs.OwnerID) + ownerID.SetValue([]byte{1, 2, 3}) + + body := new(container.ListRequestBody) + body.SetOwnerID(ownerID) + + meta := new(service.RequestMetaHeader) + meta.SetTTL(1) + + req := new(container.ListRequest) + req.SetBody(body) + req.SetMetaHeader(meta) + + return req +} + +func testListResponse() *container.ListResponse { + cid := new(refs.ContainerID) + cid.SetValue([]byte{1, 2, 3}) + + body := new(container.ListResponseBody) + body.SetContainerIDs([]*refs.ContainerID{cid}) + + meta := new(service.ResponseMetaHeader) + meta.SetTTL(1) + meta.SetXHeaders([]*service.XHeader{}) // w/o this require.Equal fails due to nil and []T{} difference + + resp := new(container.ListResponse) + resp.SetBody(body) + resp.SetMetaHeader(meta) + + return resp +} + +func testSetEACLRequest() *container.SetExtendedACLRequest { + cid := new(refs.ContainerID) + cid.SetValue([]byte{1, 2, 3}) + + eacl := new(acl.Table) + eacl.SetContainerID(cid) + + body := new(container.SetExtendedACLRequestBody) + body.SetEACL(eacl) + + meta := new(service.RequestMetaHeader) + meta.SetTTL(1) + + req := new(container.SetExtendedACLRequest) + req.SetBody(body) + req.SetMetaHeader(meta) + + return req +} + +func testSetEACLResponse() *container.SetExtendedACLResponse { + body := new(container.SetExtendedACLResponseBody) + + meta := new(service.ResponseMetaHeader) + meta.SetTTL(1) + meta.SetXHeaders([]*service.XHeader{}) // w/o this require.Equal fails due to nil and []T{} difference + + resp := new(container.SetExtendedACLResponse) + resp.SetBody(body) + resp.SetMetaHeader(meta) + + return resp +} + +func testGetEACLRequest() *container.GetExtendedACLRequest { + cid := new(refs.ContainerID) + cid.SetValue([]byte{1, 2, 3}) + + body := new(container.GetExtendedACLRequestBody) + body.SetContainerID(cid) + + meta := new(service.RequestMetaHeader) + meta.SetTTL(1) + + req := new(container.GetExtendedACLRequest) + req.SetBody(body) + req.SetMetaHeader(meta) + + return req +} + +func testGetEACLResponse() *container.GetExtendedACLResponse { + cid := new(refs.ContainerID) + cid.SetValue([]byte{1, 2, 3}) + + eacl := new(acl.Table) + eacl.SetContainerID(cid) + eacl.SetRecords([]*acl.Record{}) // w/o this require.Equal fails due to nil and []T{} difference + + body := new(container.GetExtendedACLResponseBody) + body.SetEACL(eacl) + + meta := new(service.ResponseMetaHeader) + meta.SetTTL(1) + meta.SetXHeaders([]*service.XHeader{}) // w/o this require.Equal fails due to nil and []T{} difference + + resp := new(container.GetExtendedACLResponse) + resp.SetBody(body) + resp.SetMetaHeader(meta) + + return resp +} + +func TestGRPCClient_Put(t *testing.T) { + ctx := context.TODO() + + cliKey := test.DecodeKey(0) + srvKey := test.DecodeKey(1) + + t.Run("gRPC server error", func(t *testing.T) { + srvErr := errors.New("test server error") + + srv := &testGRPCServer{ + err: srvErr, + } + + cli := &testGRPCClient{ + server: srv, + } + + c, err := container.New(container.WithGRPCServiceClient(cli)) + require.NoError(t, err) + + resp, err := c.Put(ctx, new(container.PutRequest)) + require.True(t, errors.Is(err, srvErr)) + require.Nil(t, resp) + }) + + t.Run("invalid request structure", func(t *testing.T) { + req := testPutRequest() + + require.Error(t, signature.VerifyServiceMessage(req)) + + c, err := container.New( + container.WithGRPCServiceClient( + &testGRPCClient{ + server: new(testGRPCServer), + }, + ), + ) + require.NoError(t, err) + + resp, err := c.Put(ctx, req) + require.Error(t, err) + require.Nil(t, resp) + }) + + t.Run("correct response", func(t *testing.T) { + req := testPutRequest() + + require.NoError(t, signature.SignServiceMessage(cliKey, req)) + + resp := testPutResponse() + + c, err := container.New( + container.WithGRPCServiceClient( + &testGRPCClient{ + server: &testGRPCServer{ + key: srvKey, + putResp: resp, + }, + }, + ), + ) + require.NoError(t, err) + + r, err := c.Put(ctx, req) + require.NoError(t, err) + + require.NoError(t, signature.VerifyServiceMessage(r)) + require.Equal(t, resp.GetBody(), r.GetBody()) + require.Equal(t, resp.GetMetaHeader(), r.GetMetaHeader()) + }) +} + +func TestGRPCClient_Get(t *testing.T) { + ctx := context.TODO() + + cliKey := test.DecodeKey(0) + srvKey := test.DecodeKey(1) + + t.Run("gRPC server error", func(t *testing.T) { + srvErr := errors.New("test server error") + + srv := &testGRPCServer{ + err: srvErr, + } + + cli := &testGRPCClient{ + server: srv, + } + + c, err := container.New(container.WithGRPCServiceClient(cli)) + require.NoError(t, err) + + resp, err := c.Get(ctx, new(container.GetRequest)) + require.True(t, errors.Is(err, srvErr)) + require.Nil(t, resp) + }) + + t.Run("invalid request structure", func(t *testing.T) { + req := testGetRequest() + + require.Error(t, signature.VerifyServiceMessage(req)) + + c, err := container.New( + container.WithGRPCServiceClient( + &testGRPCClient{ + server: new(testGRPCServer), + }, + ), + ) + require.NoError(t, err) + + resp, err := c.Get(ctx, req) + require.Error(t, err) + require.Nil(t, resp) + }) + + t.Run("correct response", func(t *testing.T) { + req := testGetRequest() + + require.NoError(t, signature.SignServiceMessage(cliKey, req)) + + resp := testGetResponse() + + c, err := container.New( + container.WithGRPCServiceClient( + &testGRPCClient{ + server: &testGRPCServer{ + key: srvKey, + getResp: resp, + }, + }, + ), + ) + require.NoError(t, err) + + r, err := c.Get(ctx, req) + require.NoError(t, err) + + require.NoError(t, signature.VerifyServiceMessage(r)) + require.Equal(t, resp.GetBody(), r.GetBody()) + require.Equal(t, resp.GetMetaHeader(), r.GetMetaHeader()) + }) +} + +func TestGRPCClient_Delete(t *testing.T) { + ctx := context.TODO() + + cliKey := test.DecodeKey(0) + srvKey := test.DecodeKey(1) + + t.Run("gRPC server error", func(t *testing.T) { + srvErr := errors.New("test server error") + + srv := &testGRPCServer{ + err: srvErr, + } + + cli := &testGRPCClient{ + server: srv, + } + + c, err := container.New(container.WithGRPCServiceClient(cli)) + require.NoError(t, err) + + resp, err := c.Delete(ctx, new(container.DeleteRequest)) + require.True(t, errors.Is(err, srvErr)) + require.Nil(t, resp) + }) + + t.Run("invalid request structure", func(t *testing.T) { + req := testDelRequest() + + require.Error(t, signature.VerifyServiceMessage(req)) + + c, err := container.New( + container.WithGRPCServiceClient( + &testGRPCClient{ + server: new(testGRPCServer), + }, + ), + ) + require.NoError(t, err) + + resp, err := c.Delete(ctx, req) + require.Error(t, err) + require.Nil(t, resp) + }) + + t.Run("correct response", func(t *testing.T) { + req := testDelRequest() + + require.NoError(t, signature.SignServiceMessage(cliKey, req)) + + resp := testDelResponse() + + c, err := container.New( + container.WithGRPCServiceClient( + &testGRPCClient{ + server: &testGRPCServer{ + key: srvKey, + delResp: resp, + }, + }, + ), + ) + require.NoError(t, err) + + r, err := c.Delete(ctx, req) + require.NoError(t, err) + + require.NoError(t, signature.VerifyServiceMessage(r)) + require.Equal(t, resp.GetBody(), r.GetBody()) + require.Equal(t, resp.GetMetaHeader(), r.GetMetaHeader()) + }) +} + +func TestGRPCClient_List(t *testing.T) { + ctx := context.TODO() + + cliKey := test.DecodeKey(0) + srvKey := test.DecodeKey(1) + + t.Run("gRPC server error", func(t *testing.T) { + srvErr := errors.New("test server error") + + srv := &testGRPCServer{ + err: srvErr, + } + + cli := &testGRPCClient{ + server: srv, + } + + c, err := container.New(container.WithGRPCServiceClient(cli)) + require.NoError(t, err) + + resp, err := c.List(ctx, new(container.ListRequest)) + require.True(t, errors.Is(err, srvErr)) + require.Nil(t, resp) + }) + + t.Run("invalid request structure", func(t *testing.T) { + req := testListRequest() + + require.Error(t, signature.VerifyServiceMessage(req)) + + c, err := container.New( + container.WithGRPCServiceClient( + &testGRPCClient{ + server: new(testGRPCServer), + }, + ), + ) + require.NoError(t, err) + + resp, err := c.List(ctx, req) + require.Error(t, err) + require.Nil(t, resp) + }) + + t.Run("correct response", func(t *testing.T) { + req := testListRequest() + + require.NoError(t, signature.SignServiceMessage(cliKey, req)) + + resp := testListResponse() + + c, err := container.New( + container.WithGRPCServiceClient( + &testGRPCClient{ + server: &testGRPCServer{ + key: srvKey, + listResp: resp, + }, + }, + ), + ) + require.NoError(t, err) + + r, err := c.List(ctx, req) + require.NoError(t, err) + + require.NoError(t, signature.VerifyServiceMessage(r)) + require.Equal(t, resp.GetBody(), r.GetBody()) + require.Equal(t, resp.GetMetaHeader(), r.GetMetaHeader()) + }) +} + +func TestGRPCClient_SetEACL(t *testing.T) { + ctx := context.TODO() + + cliKey := test.DecodeKey(0) + srvKey := test.DecodeKey(1) + + t.Run("gRPC server error", func(t *testing.T) { + srvErr := errors.New("test server error") + + srv := &testGRPCServer{ + err: srvErr, + } + + cli := &testGRPCClient{ + server: srv, + } + + c, err := container.New(container.WithGRPCServiceClient(cli)) + require.NoError(t, err) + + resp, err := c.SetExtendedACL(ctx, new(container.SetExtendedACLRequest)) + require.True(t, errors.Is(err, srvErr)) + require.Nil(t, resp) + }) + t.Run("invalid request structure", func(t *testing.T) { + req := testSetEACLRequest() + + require.Error(t, signature.VerifyServiceMessage(req)) + + c, err := container.New( + container.WithGRPCServiceClient( + &testGRPCClient{ + server: new(testGRPCServer), + }, + ), + ) + require.NoError(t, err) + + resp, err := c.SetExtendedACL(ctx, req) + require.Error(t, err) + require.Nil(t, resp) + }) + + t.Run("correct response", func(t *testing.T) { + req := testSetEACLRequest() + + require.NoError(t, signature.SignServiceMessage(cliKey, req)) + + resp := testSetEACLResponse() + + c, err := container.New( + container.WithGRPCServiceClient( + &testGRPCClient{ + server: &testGRPCServer{ + key: srvKey, + sEaclResp: resp, + }, + }, + ), + ) + require.NoError(t, err) + + r, err := c.SetExtendedACL(ctx, req) + require.NoError(t, err) + + require.NoError(t, signature.VerifyServiceMessage(r)) + require.Equal(t, resp.GetBody(), r.GetBody()) + require.Equal(t, resp.GetMetaHeader(), r.GetMetaHeader()) + }) +} + +func TestGRPCClient_GetEACL(t *testing.T) { + ctx := context.TODO() + + cliKey := test.DecodeKey(0) + srvKey := test.DecodeKey(1) + + t.Run("gRPC server error", func(t *testing.T) { + srvErr := errors.New("test server error") + + srv := &testGRPCServer{ + err: srvErr, + } + + cli := &testGRPCClient{ + server: srv, + } + + c, err := container.New(container.WithGRPCServiceClient(cli)) + require.NoError(t, err) + + resp, err := c.GetExtendedACL(ctx, new(container.GetExtendedACLRequest)) + require.True(t, errors.Is(err, srvErr)) + require.Nil(t, resp) + }) + t.Run("invalid request structure", func(t *testing.T) { + req := testGetEACLRequest() + + require.Error(t, signature.VerifyServiceMessage(req)) + + c, err := container.New( + container.WithGRPCServiceClient( + &testGRPCClient{ + server: new(testGRPCServer), + }, + ), + ) + require.NoError(t, err) + + resp, err := c.GetExtendedACL(ctx, req) + require.Error(t, err) + require.Nil(t, resp) + }) + + t.Run("correct response", func(t *testing.T) { + req := testGetEACLRequest() + + require.NoError(t, signature.SignServiceMessage(cliKey, req)) + + resp := testGetEACLResponse() + + c, err := container.New( + container.WithGRPCServiceClient( + &testGRPCClient{ + server: &testGRPCServer{ + key: srvKey, + gEaclResp: resp, + }, + }, + ), + ) + require.NoError(t, err) + + r, err := c.GetExtendedACL(ctx, req) + require.NoError(t, err) + + require.NoError(t, signature.VerifyServiceMessage(r)) + require.Equal(t, resp.GetBody(), r.GetBody()) + require.Equal(t, resp.GetMetaHeader(), r.GetMetaHeader()) + }) +} From 5e25c76f4050a0a01d39451794aa730c5ec8a7ac Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Fri, 21 Aug 2020 14:36:13 +0300 Subject: [PATCH 0346/1196] Add client for object service Signed-off-by: Alex Vanin --- v2/object/client.go | 408 +++++++++++++++++++++++++++++ v2/object/client_stream.go | 60 +++++ v2/object/grpc/client.go | 86 ++++++ v2/object/test/client_test.go | 474 ++++++++++++++++++++++++++++++++++ 4 files changed, 1028 insertions(+) create mode 100644 v2/object/client.go create mode 100644 v2/object/client_stream.go create mode 100644 v2/object/grpc/client.go create mode 100644 v2/object/test/client_test.go diff --git a/v2/object/client.go b/v2/object/client.go new file mode 100644 index 0000000..8af2473 --- /dev/null +++ b/v2/object/client.go @@ -0,0 +1,408 @@ +package object + +import ( + "context" + + "github.com/nspcc-dev/neofs-api-go/v2/client" + object "github.com/nspcc-dev/neofs-api-go/v2/object/grpc" + "github.com/pkg/errors" + "google.golang.org/grpc" +) + +// Client represents universal object +// transport client. +type Client struct { + getClient *getObjectClient + + putClient *putObjectClient + + headClient *headObjectClient + + searchClient *searchObjectClient + + deleteClient *deleteObjectClient + + getRangeClient *getRangeObjectClient + + getRangeHashClient *getRangeHashObjectClient +} + +// Option represents Client option. +type Option func(*cfg) + +type cfg struct { + proto client.Protocol + + globalOpts []client.Option + + gRPC cfgGRPC +} + +type cfgGRPC struct { + serviceClient object.ObjectServiceClient + + grpcCallOpts []grpc.CallOption + + callOpts []object.Option + + client *object.Client +} + +// types of upper level sub-clients, accessed directly from object.Client +type ( + getObjectClient struct { + streamClientGetter func(context.Context, *GetRequest) (interface{}, error) + + streamerConstructor func(interface{}) (GetObjectStreamer, error) + } + + putObjectClient struct { + streamClientGetter func(context.Context) (interface{}, error) + + streamerConstructor func(interface{}) (PutObjectStreamer, error) + } + + headObjectClient struct { + requestConverter func(request *HeadRequest) interface{} + + caller func(context.Context, interface{}) (interface{}, error) + + responseConverter func(interface{}) *HeadResponse + } + + deleteObjectClient struct { + requestConverter func(request *DeleteRequest) interface{} + + caller func(context.Context, interface{}) (interface{}, error) + + responseConverter func(interface{}) *DeleteResponse + } + + searchObjectClient struct { + streamClientGetter func(context.Context, *SearchRequest) (interface{}, error) + + streamerConstructor func(interface{}) (SearchObjectStreamer, error) + } + + getRangeObjectClient struct { + streamClientGetter func(context.Context, *GetRangeRequest) (interface{}, error) + + streamerConstructor func(interface{}) (GetRangeObjectStreamer, error) + } + + getRangeHashObjectClient struct { + requestConverter func(request *GetRangeHashRequest) interface{} + + caller func(context.Context, interface{}) (interface{}, error) + + responseConverter func(interface{}) *GetRangeHashResponse + } +) + +func (c *Client) Get(ctx context.Context, req *GetRequest) (GetObjectStreamer, error) { + cli, err := c.getClient.streamClientGetter(ctx, req) + if err != nil { + return nil, errors.Wrap(err, "could not send get object request") + } + + return c.getClient.streamerConstructor(cli) +} + +func (c *Client) Put(ctx context.Context) (PutObjectStreamer, error) { + cli, err := c.putClient.streamClientGetter(ctx) + if err != nil { + return nil, errors.Wrap(err, "could not prepare put object streamer") + } + + return c.putClient.streamerConstructor(cli) +} + +func (c *Client) Head(ctx context.Context, req *HeadRequest) (*HeadResponse, error) { + resp, err := c.headClient.caller(ctx, c.headClient.requestConverter(req)) + if err != nil { + return nil, errors.Wrap(err, "could not send head object request") + } + + return c.headClient.responseConverter(resp), nil +} + +func (c *Client) Search(ctx context.Context, req *SearchRequest) (SearchObjectStreamer, error) { + cli, err := c.searchClient.streamClientGetter(ctx, req) + if err != nil { + return nil, err + } + + return c.searchClient.streamerConstructor(cli) +} + +func (c *Client) Delete(ctx context.Context, req *DeleteRequest) (*DeleteResponse, error) { + resp, err := c.deleteClient.caller(ctx, c.deleteClient.requestConverter(req)) + if err != nil { + return nil, errors.Wrap(err, "could not send delete object request") + } + + return c.deleteClient.responseConverter(resp), nil +} + +func (c *Client) GetRange(ctx context.Context, req *GetRangeRequest) (GetRangeObjectStreamer, error) { + cli, err := c.getRangeClient.streamClientGetter(ctx, req) + if err != nil { + return nil, errors.Wrap(err, "could not send get object range request") + } + + return c.getRangeClient.streamerConstructor(cli) +} + +func (c *Client) GetRangeHash(ctx context.Context, req *GetRangeHashRequest) (*GetRangeHashResponse, error) { + resp, err := c.getRangeHashClient.caller(ctx, c.getRangeHashClient.requestConverter(req)) + if err != nil { + return nil, errors.Wrap(err, "could not send get object range hash request") + } + + return c.getRangeHashClient.responseConverter(resp), nil +} + +func defaultCfg() *cfg { + return &cfg{ + proto: client.ProtoGRPC, + } +} + +func New(opts ...Option) (*Client, error) { + cfg := defaultCfg() + + for i := range opts { + opts[i](cfg) + } + + var err error + + switch cfg.proto { + case client.ProtoGRPC: + var c *object.Client + if c, err = newGRPCClient(cfg); err != nil { + break + } + + return &Client{ + getClient: newGRPCGetClient(c), + putClient: newGRPCPutClient(c), + headClient: newGRPCHeadClient(c), + searchClient: newGRPCSearchClient(c), + deleteClient: newGRPCDeleteClient(c), + getRangeClient: newGRPCGetRangeClient(c), + getRangeHashClient: newGRPCGetRangeHashClient(c), + }, nil + default: + err = client.ErrProtoUnsupported + } + + return nil, errors.Wrapf(err, "could not create %s object client", cfg.proto) +} + +func newGRPCClient(cfg *cfg) (*object.Client, error) { + var err error + + if cfg.gRPC.client == nil { + if cfg.gRPC.serviceClient == nil { + conn, err := client.NewGRPCClientConn(cfg.globalOpts...) + if err != nil { + return nil, errors.Wrap(err, "could not open gRPC getClient connection") + } + + cfg.gRPC.serviceClient = object.NewObjectServiceClient(conn) + } + + cfg.gRPC.client, err = object.NewClient( + cfg.gRPC.serviceClient, + append( + cfg.gRPC.callOpts, + object.WithCallOptions(cfg.gRPC.grpcCallOpts), + )..., + ) + } + + return cfg.gRPC.client, err +} + +func newGRPCGetClient(c *object.Client) *getObjectClient { + cli := &getObjectClient{ + streamClientGetter: func(ctx context.Context, request *GetRequest) (interface{}, error) { + return c.Get(ctx, GetRequestToGRPCMessage(request)) + }, + streamerConstructor: func(i interface{}) (GetObjectStreamer, error) { + cli, ok := i.(object.ObjectService_GetClient) + if !ok { + return nil, errors.New("can't convert interface to grpc get getClient") + } + return &getObjectStream{ + recv: func() (*GetResponse, error) { + resp, err := cli.Recv() + if err != nil { + return nil, err + } + + return GetResponseFromGRPCMessage(resp), nil + }, + }, nil + }, + } + + return cli +} + +func newGRPCPutClient(c *object.Client) *putObjectClient { + cli := &putObjectClient{ + streamClientGetter: func(ctx context.Context) (interface{}, error) { + return c.Put(ctx) + }, + streamerConstructor: func(i interface{}) (PutObjectStreamer, error) { + cli, ok := i.(object.ObjectService_PutClient) + if !ok { + return nil, errors.New("can't convert interface to grpc get getClient") + } + + return &putObjectStream{ + send: func(request *PutRequest) error { + return cli.Send(PutRequestToGRPCMessage(request)) + }, + closeAndRecv: func() (*PutResponse, error) { + resp, err := cli.CloseAndRecv() + if err != nil { + return nil, err + } + + return PutResponseFromGRPCMessage(resp), nil + }, + }, nil + }, + } + + return cli +} + +func newGRPCHeadClient(c *object.Client) *headObjectClient { + return &headObjectClient{ + requestConverter: func(req *HeadRequest) interface{} { + return HeadRequestToGRPCMessage(req) + }, + caller: func(ctx context.Context, req interface{}) (interface{}, error) { + return c.Head(ctx, req.(*object.HeadRequest)) + }, + responseConverter: func(resp interface{}) *HeadResponse { + return HeadResponseFromGRPCMessage(resp.(*object.HeadResponse)) + }, + } +} + +func newGRPCSearchClient(c *object.Client) *searchObjectClient { + cli := &searchObjectClient{ + streamClientGetter: func(ctx context.Context, request *SearchRequest) (interface{}, error) { + return c.Search(ctx, SearchRequestToGRPCMessage(request)) + }, + streamerConstructor: func(i interface{}) (SearchObjectStreamer, error) { + cli, ok := i.(object.ObjectService_SearchClient) + if !ok { + return nil, errors.New("can't convert interface to grpc get getClient") + } + return &searchObjectStream{ + recv: func() (*SearchResponse, error) { + resp, err := cli.Recv() + if err != nil { + return nil, err + } + + return SearchResponseFromGRPCMessage(resp), nil + }, + }, nil + }, + } + + return cli +} + +func newGRPCDeleteClient(c *object.Client) *deleteObjectClient { + return &deleteObjectClient{ + requestConverter: func(req *DeleteRequest) interface{} { + return DeleteRequestToGRPCMessage(req) + }, + caller: func(ctx context.Context, req interface{}) (interface{}, error) { + return c.Delete(ctx, req.(*object.DeleteRequest)) + }, + responseConverter: func(resp interface{}) *DeleteResponse { + return DeleteResponseFromGRPCMessage(resp.(*object.DeleteResponse)) + }, + } +} + +func newGRPCGetRangeClient(c *object.Client) *getRangeObjectClient { + cli := &getRangeObjectClient{ + streamClientGetter: func(ctx context.Context, request *GetRangeRequest) (interface{}, error) { + return c.GetRange(ctx, GetRangeRequestToGRPCMessage(request)) + }, + streamerConstructor: func(i interface{}) (GetRangeObjectStreamer, error) { + cli, ok := i.(object.ObjectService_GetRangeClient) + if !ok { + return nil, errors.New("can't convert interface to grpc get getClient") + } + return &getRangeObjectStream{ + recv: func() (*GetRangeResponse, error) { + resp, err := cli.Recv() + if err != nil { + return nil, err + } + + return GetRangeResponseFromGRPCMessage(resp), nil + }, + }, nil + }, + } + + return cli +} + +func newGRPCGetRangeHashClient(c *object.Client) *getRangeHashObjectClient { + return &getRangeHashObjectClient{ + requestConverter: func(req *GetRangeHashRequest) interface{} { + return GetRangeHashRequestToGRPCMessage(req) + }, + caller: func(ctx context.Context, req interface{}) (interface{}, error) { + return c.GetRangeHash(ctx, req.(*object.GetRangeHashRequest)) + }, + responseConverter: func(resp interface{}) *GetRangeHashResponse { + return GetRangeHashResponseFromGRPCMessage(resp.(*object.GetRangeHashResponse)) + }, + } +} + +func WithGlobalOpts(v ...client.Option) Option { + return func(c *cfg) { + if len(v) > 0 { + c.globalOpts = v + } + } +} + +func WithGRPCServiceClient(v object.ObjectServiceClient) Option { + return func(c *cfg) { + c.gRPC.serviceClient = v + } +} + +func WithGRPCCallOpts(v []grpc.CallOption) Option { + return func(c *cfg) { + c.gRPC.grpcCallOpts = v + } +} + +func WithGRPCClientOpts(v []object.Option) Option { + return func(c *cfg) { + c.gRPC.callOpts = v + } +} + +func WithGRPCClient(v *object.Client) Option { + return func(c *cfg) { + c.gRPC.client = v + } +} diff --git a/v2/object/client_stream.go b/v2/object/client_stream.go new file mode 100644 index 0000000..0e64860 --- /dev/null +++ b/v2/object/client_stream.go @@ -0,0 +1,60 @@ +package object + +type ( + GetObjectStreamer interface { + Recv() (*GetResponse, error) + } + + PutObjectStreamer interface { + Send(*PutRequest) error + CloseAndRecv() (*PutResponse, error) + } + + SearchObjectStreamer interface { + Recv() (*SearchResponse, error) + } + + GetRangeObjectStreamer interface { + Recv() (*GetRangeResponse, error) + } +) + +type ( + getObjectStream struct { + recv func() (*GetResponse, error) + } + + putObjectStream struct { + send func(*PutRequest) error + + closeAndRecv func() (*PutResponse, error) + } + + searchObjectStream struct { + recv func() (*SearchResponse, error) + } + + getRangeObjectStream struct { + recv func() (*GetRangeResponse, error) + } +) + +func (s *getObjectStream) Recv() (*GetResponse, error) { + return s.recv() +} + +func (p *putObjectStream) Send(request *PutRequest) error { + return p.send(request) +} + +func (p *putObjectStream) CloseAndRecv() (*PutResponse, error) { + return p.closeAndRecv() +} + +func (s *searchObjectStream) Recv() (*SearchResponse, error) { + return s.recv() +} + +func (r *getRangeObjectStream) Recv() (*GetRangeResponse, error) { + return r.recv() +} diff --git a/v2/object/grpc/client.go b/v2/object/grpc/client.go new file mode 100644 index 0000000..30ff3e0 --- /dev/null +++ b/v2/object/grpc/client.go @@ -0,0 +1,86 @@ +package object + +import ( + "context" + + "github.com/pkg/errors" + "google.golang.org/grpc" +) + +// Client wraps ObjectServiceClient +// with pre-defined configurations. +type Client struct { + *cfg + + client ObjectServiceClient +} + +// Option represents Client option. +type Option func(*cfg) + +type cfg struct { + callOpts []grpc.CallOption +} + +// ErrNilObjectServiceClient is returned by functions that expect +// a non-nil ObjectServiceClient, but received nil. +var ErrNilObjectServiceClient = errors.New("object gRPC client is nil") + +func defaultCfg() *cfg { + return new(cfg) +} + +// NewClient creates, initializes and returns a new Client instance. +// +// Options are applied one by one in order. +func NewClient(c ObjectServiceClient, opts ...Option) (*Client, error) { + if c == nil { + return nil, ErrNilObjectServiceClient + } + + cfg := defaultCfg() + for i := range opts { + opts[i](cfg) + } + + return &Client{ + cfg: cfg, + client: c, + }, nil +} + +func (c *Client) Get(ctx context.Context, req *GetRequest) (ObjectService_GetClient, error) { + return c.client.Get(ctx, req, c.callOpts...) +} + +func (c *Client) Put(ctx context.Context) (ObjectService_PutClient, error) { + return c.client.Put(ctx, c.callOpts...) +} + +func (c *Client) Head(ctx context.Context, req *HeadRequest) (*HeadResponse, error) { + return c.client.Head(ctx, req, c.callOpts...) +} + +func (c *Client) Search(ctx context.Context, req *SearchRequest) (ObjectService_SearchClient, error) { + return c.client.Search(ctx, req, c.callOpts...) +} + +func (c *Client) Delete(ctx context.Context, req *DeleteRequest) (*DeleteResponse, error) { + return c.client.Delete(ctx, req, c.callOpts...) +} + +func (c *Client) GetRange(ctx context.Context, req *GetRangeRequest) (ObjectService_GetRangeClient, error) { + return c.client.GetRange(ctx, req, c.callOpts...) +} + +func (c *Client) GetRangeHash(ctx context.Context, req *GetRangeHashRequest) (*GetRangeHashResponse, error) { + return c.client.GetRangeHash(ctx, req, c.callOpts...) +} + +// WithCallOptions returns Option that configures +// Client to attach call options to each rpc call. +func WithCallOptions(opts []grpc.CallOption) Option { + return func(c *cfg) { + c.callOpts = opts + } +} diff --git a/v2/object/test/client_test.go b/v2/object/test/client_test.go new file mode 100644 index 0000000..87eb920 --- /dev/null +++ b/v2/object/test/client_test.go @@ -0,0 +1,474 @@ +package main + +import ( + "context" + "crypto/ecdsa" + "errors" + "testing" + + "github.com/nspcc-dev/neofs-api-go/v2/object" + objectGRPC "github.com/nspcc-dev/neofs-api-go/v2/object/grpc" + "github.com/nspcc-dev/neofs-api-go/v2/refs" + "github.com/nspcc-dev/neofs-api-go/v2/service" + "github.com/nspcc-dev/neofs-api-go/v2/signature" + "github.com/nspcc-dev/neofs-crypto/test" + "github.com/stretchr/testify/require" + "google.golang.org/grpc" +) + +type testGRPCClient struct { + server objectGRPC.ObjectServiceServer +} + +func (s *testGRPCClient) Get(ctx context.Context, in *objectGRPC.GetRequest, opts ...grpc.CallOption) (objectGRPC.ObjectService_GetClient, error) { + panic("implement me") +} + +func (s *testGRPCClient) Put(ctx context.Context, opts ...grpc.CallOption) (objectGRPC.ObjectService_PutClient, error) { + panic("implement me") +} + +func (s *testGRPCClient) Delete(ctx context.Context, in *objectGRPC.DeleteRequest, opts ...grpc.CallOption) (*objectGRPC.DeleteResponse, error) { + return s.server.Delete(ctx, in) +} + +func (s *testGRPCClient) Head(ctx context.Context, in *objectGRPC.HeadRequest, opts ...grpc.CallOption) (*objectGRPC.HeadResponse, error) { + return s.server.Head(ctx, in) +} + +func (s *testGRPCClient) Search(ctx context.Context, in *objectGRPC.SearchRequest, opts ...grpc.CallOption) (objectGRPC.ObjectService_SearchClient, error) { + panic("implement me") +} + +func (s *testGRPCClient) GetRange(ctx context.Context, in *objectGRPC.GetRangeRequest, opts ...grpc.CallOption) (objectGRPC.ObjectService_GetRangeClient, error) { + panic("implement me") +} + +func (s *testGRPCClient) GetRangeHash(ctx context.Context, in *objectGRPC.GetRangeHashRequest, opts ...grpc.CallOption) (*objectGRPC.GetRangeHashResponse, error) { + return s.server.GetRangeHash(ctx, in) +} + +type testGRPCServer struct { + key *ecdsa.PrivateKey + headResp *object.HeadResponse + delResp *object.DeleteResponse + getRangeHashResp *object.GetRangeHashResponse + err error +} + +func (s *testGRPCServer) Get(request *objectGRPC.GetRequest, server objectGRPC.ObjectService_GetServer) error { + panic("implement me") +} + +func (s *testGRPCServer) Put(server objectGRPC.ObjectService_PutServer) error { + panic("implement me") +} + +func (s *testGRPCServer) Delete(ctx context.Context, request *objectGRPC.DeleteRequest) (*objectGRPC.DeleteResponse, error) { + if s.err != nil { + return nil, s.err + } + + // verify request structure + if err := signature.VerifyServiceMessage( + object.DeleteRequestFromGRPCMessage(request), + ); err != nil { + return nil, err + } + + // sign response structure + if err := signature.SignServiceMessage(s.key, s.delResp); err != nil { + return nil, err + } + + return object.DeleteResponseToGRPCMessage(s.delResp), nil +} + +func (s *testGRPCServer) Head(ctx context.Context, request *objectGRPC.HeadRequest) (*objectGRPC.HeadResponse, error) { + if s.err != nil { + return nil, s.err + } + + // verify request structure + if err := signature.VerifyServiceMessage( + object.HeadRequestFromGRPCMessage(request), + ); err != nil { + return nil, err + } + + // sign response structure + if err := signature.SignServiceMessage(s.key, s.headResp); err != nil { + return nil, err + } + + return object.HeadResponseToGRPCMessage(s.headResp), nil +} + +func (s *testGRPCServer) Search(request *objectGRPC.SearchRequest, server objectGRPC.ObjectService_SearchServer) error { + panic("implement me") +} + +func (s *testGRPCServer) GetRange(request *objectGRPC.GetRangeRequest, server objectGRPC.ObjectService_GetRangeServer) error { + panic("implement me") +} + +func (s *testGRPCServer) GetRangeHash(ctx context.Context, request *objectGRPC.GetRangeHashRequest) (*objectGRPC.GetRangeHashResponse, error) { + if s.err != nil { + return nil, s.err + } + + // verify request structure + if err := signature.VerifyServiceMessage( + object.GetRangeHashRequestFromGRPCMessage(request), + ); err != nil { + return nil, err + } + + // sign response structure + if err := signature.SignServiceMessage(s.key, s.getRangeHashResp); err != nil { + return nil, err + } + + return object.GetRangeHashResponseToGRPCMessage(s.getRangeHashResp), nil +} + +func testHeadRequest() *object.HeadRequest { + cid := new(refs.ContainerID) + cid.SetValue([]byte{1, 2, 3}) + + oid := new(refs.ObjectID) + oid.SetValue([]byte{4, 5, 6}) + + addr := new(refs.Address) + addr.SetContainerID(cid) + addr.SetObjectID(oid) + + body := new(object.HeadRequestBody) + body.SetAddress(addr) + + meta := new(service.RequestMetaHeader) + meta.SetTTL(1) + meta.SetXHeaders([]*service.XHeader{}) + + req := new(object.HeadRequest) + req.SetBody(body) + req.SetMetaHeader(meta) + + return req +} + +func testHeadResponse() *object.HeadResponse { + shortHdr := new(object.ShortHeader) + shortHdr.SetCreationEpoch(100) + + hdrPart := new(object.GetHeaderPartShort) + hdrPart.SetShortHeader(shortHdr) + + body := new(object.HeadResponseBody) + body.SetHeaderPart(hdrPart) + + meta := new(service.ResponseMetaHeader) + meta.SetTTL(1) + meta.SetXHeaders([]*service.XHeader{}) + + resp := new(object.HeadResponse) + resp.SetBody(body) + resp.SetMetaHeader(meta) + + return resp +} + +func testDeleteRequest() *object.DeleteRequest { + cid := new(refs.ContainerID) + cid.SetValue([]byte{1, 2, 3}) + + oid := new(refs.ObjectID) + oid.SetValue([]byte{4, 5, 6}) + + addr := new(refs.Address) + addr.SetContainerID(cid) + addr.SetObjectID(oid) + + body := new(object.DeleteRequestBody) + body.SetAddress(addr) + + meta := new(service.RequestMetaHeader) + meta.SetTTL(1) + meta.SetXHeaders([]*service.XHeader{}) + + req := new(object.DeleteRequest) + req.SetBody(body) + req.SetMetaHeader(meta) + + return req +} + +func testDeleteResponse() *object.DeleteResponse { + body := new(object.DeleteResponseBody) + + meta := new(service.ResponseMetaHeader) + meta.SetTTL(1) + meta.SetXHeaders([]*service.XHeader{}) + + resp := new(object.DeleteResponse) + resp.SetBody(body) + resp.SetMetaHeader(meta) + + return resp +} + +func testGetRangeHashRequest() *object.GetRangeHashRequest { + cid := new(refs.ContainerID) + cid.SetValue([]byte{1, 2, 3}) + + oid := new(refs.ObjectID) + oid.SetValue([]byte{4, 5, 6}) + + addr := new(refs.Address) + addr.SetContainerID(cid) + addr.SetObjectID(oid) + + body := new(object.GetRangeHashRequestBody) + body.SetAddress(addr) + + meta := new(service.RequestMetaHeader) + meta.SetTTL(1) + meta.SetXHeaders([]*service.XHeader{}) + + req := new(object.GetRangeHashRequest) + req.SetBody(body) + req.SetMetaHeader(meta) + + return req +} + +func testGetRangeHashResponse() *object.GetRangeHashResponse { + body := new(object.GetRangeHashResponseBody) + body.SetHashList([][]byte{{7, 8, 9}}) + + meta := new(service.ResponseMetaHeader) + meta.SetTTL(1) + meta.SetXHeaders([]*service.XHeader{}) + + resp := new(object.GetRangeHashResponse) + resp.SetBody(body) + resp.SetMetaHeader(meta) + + return resp +} + +func TestGRPCClient_Head(t *testing.T) { + ctx := context.TODO() + + cliKey := test.DecodeKey(0) + srvKey := test.DecodeKey(1) + + t.Run("gRPC server error", func(t *testing.T) { + srvErr := errors.New("test server error") + + srv := &testGRPCServer{ + err: srvErr, + } + + cli := &testGRPCClient{ + server: srv, + } + + c, err := object.New(object.WithGRPCServiceClient(cli)) + require.NoError(t, err) + + resp, err := c.Head(ctx, new(object.HeadRequest)) + require.True(t, errors.Is(err, srvErr)) + require.Nil(t, resp) + }) + + t.Run("invalid request structure", func(t *testing.T) { + req := testHeadRequest() + + require.Error(t, signature.VerifyServiceMessage(req)) + + c, err := object.New( + object.WithGRPCServiceClient( + &testGRPCClient{ + server: new(testGRPCServer), + }, + ), + ) + require.NoError(t, err) + + resp, err := c.Head(ctx, req) + require.Error(t, err) + require.Nil(t, resp) + }) + + t.Run("correct response", func(t *testing.T) { + req := testHeadRequest() + + require.NoError(t, signature.SignServiceMessage(cliKey, req)) + + resp := testHeadResponse() + + c, err := object.New( + object.WithGRPCServiceClient( + &testGRPCClient{ + server: &testGRPCServer{ + key: srvKey, + headResp: resp, + }, + }, + ), + ) + require.NoError(t, err) + + r, err := c.Head(ctx, req) + require.NoError(t, err) + + require.NoError(t, signature.VerifyServiceMessage(r)) + require.Equal(t, resp.GetBody(), r.GetBody()) + require.Equal(t, resp.GetMetaHeader(), r.GetMetaHeader()) + }) +} + +func TestGRPCClient_Delete(t *testing.T) { + ctx := context.TODO() + + cliKey := test.DecodeKey(0) + srvKey := test.DecodeKey(1) + + t.Run("gRPC server error", func(t *testing.T) { + srvErr := errors.New("test server error") + + srv := &testGRPCServer{ + err: srvErr, + } + + cli := &testGRPCClient{ + server: srv, + } + + c, err := object.New(object.WithGRPCServiceClient(cli)) + require.NoError(t, err) + + resp, err := c.Delete(ctx, new(object.DeleteRequest)) + require.True(t, errors.Is(err, srvErr)) + require.Nil(t, resp) + }) + + t.Run("invalid request structure", func(t *testing.T) { + req := testDeleteRequest() + + require.Error(t, signature.VerifyServiceMessage(req)) + + c, err := object.New( + object.WithGRPCServiceClient( + &testGRPCClient{ + server: new(testGRPCServer), + }, + ), + ) + require.NoError(t, err) + + resp, err := c.Delete(ctx, req) + require.Error(t, err) + require.Nil(t, resp) + }) + + t.Run("correct response", func(t *testing.T) { + req := testDeleteRequest() + + require.NoError(t, signature.SignServiceMessage(cliKey, req)) + + resp := testDeleteResponse() + + c, err := object.New( + object.WithGRPCServiceClient( + &testGRPCClient{ + server: &testGRPCServer{ + key: srvKey, + delResp: resp, + }, + }, + ), + ) + require.NoError(t, err) + + r, err := c.Delete(ctx, req) + require.NoError(t, err) + + require.NoError(t, signature.VerifyServiceMessage(r)) + require.Equal(t, resp.GetBody(), r.GetBody()) + require.Equal(t, resp.GetMetaHeader(), r.GetMetaHeader()) + }) +} + +func TestGRPCClient_GetRangeHash(t *testing.T) { + ctx := context.TODO() + + cliKey := test.DecodeKey(0) + srvKey := test.DecodeKey(1) + + t.Run("gRPC server error", func(t *testing.T) { + srvErr := errors.New("test server error") + + srv := &testGRPCServer{ + err: srvErr, + } + + cli := &testGRPCClient{ + server: srv, + } + + c, err := object.New(object.WithGRPCServiceClient(cli)) + require.NoError(t, err) + + resp, err := c.GetRangeHash(ctx, new(object.GetRangeHashRequest)) + require.True(t, errors.Is(err, srvErr)) + require.Nil(t, resp) + }) + + t.Run("invalid request structure", func(t *testing.T) { + req := testGetRangeHashRequest() + + require.Error(t, signature.VerifyServiceMessage(req)) + + c, err := object.New( + object.WithGRPCServiceClient( + &testGRPCClient{ + server: new(testGRPCServer), + }, + ), + ) + require.NoError(t, err) + + resp, err := c.GetRangeHash(ctx, req) + require.Error(t, err) + require.Nil(t, resp) + }) + + t.Run("correct response", func(t *testing.T) { + req := testGetRangeHashRequest() + + require.NoError(t, signature.SignServiceMessage(cliKey, req)) + + resp := testGetRangeHashResponse() + + c, err := object.New( + object.WithGRPCServiceClient( + &testGRPCClient{ + server: &testGRPCServer{ + key: srvKey, + getRangeHashResp: resp, + }, + }, + ), + ) + require.NoError(t, err) + + r, err := c.GetRangeHash(ctx, req) + require.NoError(t, err) + + require.NoError(t, signature.VerifyServiceMessage(r)) + require.Equal(t, resp.GetBody(), r.GetBody()) + require.Equal(t, resp.GetMetaHeader(), r.GetMetaHeader()) + }) +} From e55b59bde7d45d84984166704a166d1cb6c4a3bb Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Fri, 21 Aug 2020 15:14:50 +0300 Subject: [PATCH 0347/1196] Use protocol-specific names for stream structures Signed-off-by: Alex Vanin --- v2/object/client.go | 8 ++++---- v2/object/client_stream.go | 18 +++++++++--------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/v2/object/client.go b/v2/object/client.go index 8af2473..955cdda 100644 --- a/v2/object/client.go +++ b/v2/object/client.go @@ -235,7 +235,7 @@ func newGRPCGetClient(c *object.Client) *getObjectClient { if !ok { return nil, errors.New("can't convert interface to grpc get getClient") } - return &getObjectStream{ + return &getObjectGRPCStream{ recv: func() (*GetResponse, error) { resp, err := cli.Recv() if err != nil { @@ -262,7 +262,7 @@ func newGRPCPutClient(c *object.Client) *putObjectClient { return nil, errors.New("can't convert interface to grpc get getClient") } - return &putObjectStream{ + return &putObjectGRPCStream{ send: func(request *PutRequest) error { return cli.Send(PutRequestToGRPCMessage(request)) }, @@ -305,7 +305,7 @@ func newGRPCSearchClient(c *object.Client) *searchObjectClient { if !ok { return nil, errors.New("can't convert interface to grpc get getClient") } - return &searchObjectStream{ + return &searchObjectGRPCStream{ recv: func() (*SearchResponse, error) { resp, err := cli.Recv() if err != nil { @@ -345,7 +345,7 @@ func newGRPCGetRangeClient(c *object.Client) *getRangeObjectClient { if !ok { return nil, errors.New("can't convert interface to grpc get getClient") } - return &getRangeObjectStream{ + return &getRangeObjectGRPCStream{ recv: func() (*GetRangeResponse, error) { resp, err := cli.Recv() if err != nil { diff --git a/v2/object/client_stream.go b/v2/object/client_stream.go index 0e64860..ea9dc98 100644 --- a/v2/object/client_stream.go +++ b/v2/object/client_stream.go @@ -20,41 +20,41 @@ type ( ) type ( - getObjectStream struct { + getObjectGRPCStream struct { recv func() (*GetResponse, error) } - putObjectStream struct { + putObjectGRPCStream struct { send func(*PutRequest) error closeAndRecv func() (*PutResponse, error) } - searchObjectStream struct { + searchObjectGRPCStream struct { recv func() (*SearchResponse, error) } - getRangeObjectStream struct { + getRangeObjectGRPCStream struct { recv func() (*GetRangeResponse, error) } ) -func (s *getObjectStream) Recv() (*GetResponse, error) { +func (s *getObjectGRPCStream) Recv() (*GetResponse, error) { return s.recv() } -func (p *putObjectStream) Send(request *PutRequest) error { +func (p *putObjectGRPCStream) Send(request *PutRequest) error { return p.send(request) } -func (p *putObjectStream) CloseAndRecv() (*PutResponse, error) { +func (p *putObjectGRPCStream) CloseAndRecv() (*PutResponse, error) { return p.closeAndRecv() } -func (s *searchObjectStream) Recv() (*SearchResponse, error) { +func (s *searchObjectGRPCStream) Recv() (*SearchResponse, error) { return s.recv() } -func (r *getRangeObjectStream) Recv() (*GetRangeResponse, error) { +func (r *getRangeObjectGRPCStream) Recv() (*GetRangeResponse, error) { return r.recv() } From bcacfb9cf689bb04eedd675df8bfd5b8eba791fe Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Fri, 21 Aug 2020 15:15:25 +0300 Subject: [PATCH 0348/1196] Add object service interface for external clients Signed-off-by: Alex Vanin --- v2/object/service.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 v2/object/service.go diff --git a/v2/object/service.go b/v2/object/service.go new file mode 100644 index 0000000..1551aee --- /dev/null +++ b/v2/object/service.go @@ -0,0 +1,15 @@ +package object + +import ( + "context" +) + +type Service interface { + Get(context.Context, *GetRequest) (GetObjectStreamer, error) + Put(context.Context) (PutObjectStreamer, error) + Head(context.Context, *HeadRequest) (*HeadResponse, error) + Search(context.Context, *SearchRequest) (SearchObjectStreamer, error) + Delete(context.Context, *DeleteRequest) (*DeleteResponse, error) + GetRange(context.Context, *GetRangeRequest) (GetRangeObjectStreamer, error) + GetRangeHash(context.Context, *GetRangeHashRequest) (*GetRangeHashResponse, error) +} From 556be908181023895a21fac2837bbe81b86527b9 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Thu, 20 Aug 2020 10:49:12 +0300 Subject: [PATCH 0349/1196] Recompile proto files with neofs-api jindo-rc-1 Signed-off-by: Alex Vanin --- v2/accounting/grpc/service.pb.go | 60 +- v2/acl/grpc/types.pb.go | 915 ++++++++++++- v2/container/grpc/service.pb.go | 155 +-- v2/container/grpc/types.pb.go | 68 +- v2/object/grpc/service.pb.go | 259 ++-- v2/object/grpc/types.pb.go | 230 ++-- v2/refs/grpc/types.pb.go | 751 ++++++++++- v2/session/grpc/service.pb.go | 189 ++- v2/{service => session}/grpc/types.pb.go | 1553 ++++------------------ v2/storagegroup/grpc/types.pb.go | 76 +- 10 files changed, 2419 insertions(+), 1837 deletions(-) rename v2/{service => session}/grpc/types.pb.go (68%) diff --git a/v2/accounting/grpc/service.pb.go b/v2/accounting/grpc/service.pb.go index af398bb..34d15ac 100644 --- a/v2/accounting/grpc/service.pb.go +++ b/v2/accounting/grpc/service.pb.go @@ -8,7 +8,7 @@ import ( fmt "fmt" proto "github.com/golang/protobuf/proto" grpc1 "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" - grpc "github.com/nspcc-dev/neofs-api-go/v2/service/grpc" + grpc "github.com/nspcc-dev/neofs-api-go/v2/session/grpc" grpc2 "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" @@ -285,35 +285,35 @@ func init() { func init() { proto.RegisterFile("v2/accounting/grpc/service.proto", fileDescriptor_d9dd5af2ff2bbb25) } var fileDescriptor_d9dd5af2ff2bbb25 = []byte{ - // 438 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x93, 0xcb, 0x8a, 0xd4, 0x40, - 0x18, 0x85, 0x4d, 0x1c, 0x6c, 0xa9, 0xf1, 0x82, 0x85, 0x30, 0x4d, 0xc4, 0x30, 0x0c, 0x33, 0xa0, - 0x62, 0x2a, 0x10, 0x17, 0x82, 0xa2, 0xc3, 0x34, 0xe3, 0x60, 0x2f, 0xbc, 0x65, 0x60, 0x16, 0x6e, - 0x86, 0x4a, 0xe5, 0x4f, 0xa6, 0xe8, 0x4e, 0x55, 0x4c, 0x55, 0x47, 0xf2, 0x26, 0xbe, 0x80, 0x1b, - 0x17, 0x3e, 0x87, 0x4b, 0x1f, 0x41, 0xda, 0x17, 0x91, 0xdc, 0xfa, 0x42, 0xa7, 0xed, 0xde, 0xa5, - 0xf8, 0xcf, 0x39, 0x7f, 0x9d, 0x8f, 0x14, 0xda, 0xcf, 0x3d, 0x97, 0x32, 0x26, 0x27, 0x42, 0x73, - 0x11, 0xbb, 0x71, 0x96, 0x32, 0x57, 0x41, 0x96, 0x73, 0x06, 0x24, 0xcd, 0xa4, 0x96, 0xf8, 0xbe, - 0x00, 0x49, 0x22, 0x45, 0x72, 0x8f, 0xcc, 0x85, 0x96, 0xdd, 0xe1, 0xd3, 0x45, 0x0a, 0xaa, 0x76, - 0x59, 0xfd, 0xdc, 0x73, 0x33, 0x88, 0xd4, 0xea, 0xe4, 0x41, 0xee, 0xb5, 0x1b, 0x56, 0x86, 0x07, - 0xdf, 0x4d, 0x74, 0x67, 0x40, 0xc7, 0x54, 0x30, 0xf0, 0xe1, 0xcb, 0x04, 0x94, 0xc6, 0xaf, 0xd0, - 0x4e, 0x20, 0xc3, 0xa2, 0x6f, 0xec, 0x1b, 0x8f, 0x76, 0xbd, 0xc7, 0xa4, 0xeb, 0x3a, 0x64, 0xd9, - 0x43, 0x06, 0x32, 0x2c, 0xfc, 0xca, 0x86, 0xdf, 0xa0, 0xdd, 0x04, 0x34, 0xbd, 0xbc, 0x02, 0x1a, - 0x42, 0xd6, 0x37, 0xab, 0x94, 0xc3, 0x85, 0x94, 0xb6, 0x6d, 0xe3, 0x7d, 0x07, 0x9a, 0xbe, 0xad, - 0xb4, 0x3e, 0x4a, 0x66, 0xdf, 0xf8, 0x13, 0xba, 0x9d, 0x43, 0xc6, 0xa3, 0xa2, 0x0d, 0xba, 0x5e, - 0x05, 0x3d, 0x5d, 0x1f, 0x74, 0x51, 0xca, 0x39, 0xa3, 0x9a, 0x4b, 0xd1, 0x04, 0xde, 0xaa, 0x23, - 0xea, 0x93, 0xf5, 0x02, 0xed, 0x94, 0xf7, 0xc4, 0x1e, 0xba, 0x29, 0xbf, 0x0a, 0xc8, 0x2e, 0x79, - 0xd8, 0x94, 0xdc, 0x5b, 0x48, 0x2d, 0x21, 0x92, 0x0f, 0xe5, 0x7c, 0x78, 0xea, 0xf7, 0x2a, 0xe1, - 0x30, 0x3c, 0xf8, 0x69, 0xa2, 0xbb, 0xb3, 0xce, 0x2a, 0x95, 0x42, 0x01, 0x7e, 0xbd, 0x04, 0xea, - 0xc9, 0x06, 0x50, 0xb5, 0x69, 0x91, 0xd4, 0x59, 0x17, 0xa9, 0xa3, 0xce, 0x82, 0xb5, 0x79, 0x0d, - 0x2a, 0xbf, 0x1b, 0x95, 0xf3, 0x9f, 0xa4, 0x8d, 0xac, 0x8e, 0x1b, 0x56, 0xcf, 0x51, 0x2f, 0xa8, - 0x1b, 0x34, 0x35, 0x1f, 0x76, 0xd7, 0x3c, 0x05, 0xc6, 0x13, 0x3a, 0xf6, 0x5b, 0xb5, 0x37, 0x42, - 0xf7, 0x4e, 0x66, 0xe3, 0xf3, 0x7a, 0x3d, 0xbe, 0x40, 0xbd, 0x86, 0x07, 0x3e, 0xdc, 0xe6, 0xbf, - 0xb2, 0x8e, 0xb6, 0x82, 0x3a, 0x18, 0xfd, 0x9a, 0xda, 0xc6, 0xef, 0xa9, 0x6d, 0xfc, 0x99, 0xda, - 0xc6, 0xb7, 0xbf, 0xf6, 0xb5, 0xcf, 0xc7, 0x31, 0xd7, 0x57, 0x93, 0x80, 0x30, 0x99, 0xb8, 0x42, - 0xa5, 0x8c, 0x39, 0x21, 0xe4, 0xae, 0x00, 0x19, 0x29, 0x87, 0xa6, 0xdc, 0x89, 0xa5, 0xbb, 0xfa, - 0xa0, 0x5e, 0xce, 0xcf, 0x3f, 0xcc, 0xbd, 0xf7, 0x20, 0xcf, 0xce, 0xc9, 0xc9, 0xc7, 0x61, 0xb9, - 0x7c, 0xde, 0x25, 0xb8, 0x51, 0xbd, 0x9c, 0x67, 0xff, 0x02, 0x00, 0x00, 0xff, 0xff, 0x15, 0x3d, - 0x57, 0xcb, 0xca, 0x03, 0x00, 0x00, + // 442 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x93, 0xdb, 0x6a, 0xd4, 0x40, + 0x1c, 0xc6, 0x4d, 0x2c, 0xae, 0x4c, 0x3d, 0xe0, 0x20, 0x74, 0x89, 0x18, 0x4a, 0x69, 0x41, 0xc5, + 0xcc, 0x40, 0xbc, 0x10, 0x14, 0x2d, 0x5d, 0x6a, 0x71, 0x2f, 0x3c, 0xa5, 0xd0, 0x0b, 0x6f, 0xca, + 0x64, 0xf2, 0x4f, 0x3a, 0xb4, 0x99, 0x89, 0x99, 0xd9, 0x48, 0xde, 0xc4, 0x17, 0xf0, 0xc6, 0x0b, + 0x9f, 0xc3, 0x4b, 0x1f, 0x41, 0xd6, 0x17, 0x91, 0x1c, 0xf6, 0xc4, 0x66, 0xdd, 0xbd, 0xcb, 0xf0, + 0xff, 0xbe, 0x2f, 0xff, 0xef, 0xc7, 0x0c, 0xda, 0x2d, 0x7c, 0xca, 0x38, 0x57, 0x23, 0x69, 0x84, + 0x4c, 0x68, 0x92, 0x67, 0x9c, 0x6a, 0xc8, 0x0b, 0xc1, 0x81, 0x64, 0xb9, 0x32, 0x0a, 0xdf, 0x97, + 0xa0, 0x48, 0xac, 0x49, 0xe1, 0x93, 0x99, 0xd0, 0x71, 0x3b, 0x7c, 0xa6, 0xcc, 0x40, 0x37, 0x2e, + 0xa7, 0x5f, 0xf8, 0x34, 0x87, 0x58, 0x2f, 0x4f, 0x1e, 0x14, 0x3e, 0xd5, 0xa0, 0xb5, 0x50, 0x72, + 0x69, 0xb8, 0xf7, 0xdd, 0x46, 0x77, 0x06, 0xec, 0x8a, 0x49, 0x0e, 0x01, 0x7c, 0x19, 0x81, 0x36, + 0xf8, 0x15, 0xda, 0x0a, 0x55, 0x54, 0xf6, 0xad, 0x5d, 0xeb, 0xd1, 0xb6, 0xff, 0x98, 0x74, 0xad, + 0x43, 0x16, 0x3d, 0x64, 0xa0, 0xa2, 0x32, 0xa8, 0x6d, 0xf8, 0x0d, 0xda, 0x4e, 0xc1, 0xb0, 0xf3, + 0x0b, 0x60, 0x11, 0xe4, 0x7d, 0xbb, 0x4e, 0xd9, 0x9f, 0x4b, 0x69, 0x77, 0x21, 0xad, 0xf7, 0x1d, + 0x18, 0xf6, 0xb6, 0xd6, 0x06, 0x28, 0x9d, 0x7e, 0xe3, 0x4f, 0xe8, 0x76, 0x01, 0xb9, 0x88, 0xcb, + 0x49, 0xd0, 0xf5, 0x3a, 0xe8, 0xe9, 0xea, 0xa0, 0xb3, 0x4a, 0x2e, 0x38, 0x33, 0x42, 0xc9, 0x36, + 0xf0, 0x56, 0x13, 0xd1, 0x9c, 0x9c, 0x17, 0x68, 0xab, 0xda, 0x13, 0xfb, 0xe8, 0xa6, 0xfa, 0x2a, + 0x21, 0x3f, 0x17, 0x51, 0x5b, 0x72, 0x67, 0x2e, 0xb5, 0x82, 0x48, 0x3e, 0x54, 0xf3, 0xe1, 0x71, + 0xd0, 0xab, 0x85, 0xc3, 0x68, 0xef, 0xa7, 0x8d, 0xee, 0x4e, 0x3b, 0xeb, 0x4c, 0x49, 0x0d, 0xf8, + 0xf5, 0x02, 0xa8, 0x27, 0x6b, 0x40, 0x35, 0xa6, 0x79, 0x52, 0x27, 0x5d, 0xa4, 0x0e, 0x3a, 0x0b, + 0x36, 0xe6, 0x15, 0xa8, 0x82, 0x6e, 0x54, 0xde, 0x7f, 0x92, 0xd6, 0xb2, 0x3a, 0x6c, 0x59, 0x3d, + 0x47, 0xbd, 0xb0, 0x69, 0xd0, 0xd6, 0x7c, 0xd8, 0x5d, 0xf3, 0x18, 0xb8, 0x48, 0xd9, 0x55, 0x30, + 0x51, 0xfb, 0x97, 0xe8, 0xde, 0xd1, 0x74, 0x7c, 0xda, 0x5c, 0x70, 0x7c, 0x86, 0x7a, 0x2d, 0x0f, + 0xbc, 0xbf, 0xc9, 0xbd, 0x72, 0x0e, 0x36, 0x82, 0x3a, 0xb8, 0xfc, 0x35, 0x76, 0xad, 0xdf, 0x63, + 0xd7, 0xfa, 0x33, 0x76, 0xad, 0x6f, 0x7f, 0xdd, 0x6b, 0x9f, 0x0f, 0x13, 0x61, 0x2e, 0x46, 0x21, + 0xe1, 0x2a, 0xa5, 0x52, 0x67, 0x9c, 0x7b, 0x11, 0x14, 0x54, 0x82, 0x8a, 0xb5, 0xc7, 0x32, 0xe1, + 0x25, 0x8a, 0x2e, 0x3f, 0xa8, 0x97, 0xb3, 0xf3, 0x0f, 0x7b, 0xe7, 0x3d, 0xa8, 0x93, 0x53, 0x72, + 0xf4, 0x71, 0x58, 0xfd, 0x7c, 0xd6, 0x25, 0xbc, 0x51, 0xbf, 0x9c, 0x67, 0xff, 0x02, 0x00, 0x00, + 0xff, 0xff, 0x54, 0x53, 0x6d, 0x41, 0xca, 0x03, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/v2/acl/grpc/types.pb.go b/v2/acl/grpc/types.pb.go index e9932c8..7c240bd 100644 --- a/v2/acl/grpc/types.pb.go +++ b/v2/acl/grpc/types.pb.go @@ -477,6 +477,198 @@ func (m *EACLTable) GetRecords() []*EACLRecord { return nil } +// BearerToken has information about request ACL rules with limited lifetime +type BearerToken struct { + // Bearer Token body + Body *BearerToken_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` + // Signature of BearerToken body + Signature *grpc.Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *BearerToken) Reset() { *m = BearerToken{} } +func (m *BearerToken) String() string { return proto.CompactTextString(m) } +func (*BearerToken) ProtoMessage() {} +func (*BearerToken) Descriptor() ([]byte, []int) { + return fileDescriptor_8233b6696fb3e24f, []int{2} +} +func (m *BearerToken) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *BearerToken) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_BearerToken.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *BearerToken) XXX_Merge(src proto.Message) { + xxx_messageInfo_BearerToken.Merge(m, src) +} +func (m *BearerToken) XXX_Size() int { + return m.Size() +} +func (m *BearerToken) XXX_DiscardUnknown() { + xxx_messageInfo_BearerToken.DiscardUnknown(m) +} + +var xxx_messageInfo_BearerToken proto.InternalMessageInfo + +func (m *BearerToken) GetBody() *BearerToken_Body { + if m != nil { + return m.Body + } + return nil +} + +func (m *BearerToken) GetSignature() *grpc.Signature { + if m != nil { + return m.Signature + } + return nil +} + +// Bearer Token body +type BearerToken_Body struct { + // EACLTable carries table of extended ACL rules + EaclTable *EACLTable `protobuf:"bytes,1,opt,name=eacl_table,json=eaclTable,proto3" json:"eacl_table,omitempty"` + // OwnerID carries identifier of the token owner + OwnerId *grpc.OwnerID `protobuf:"bytes,2,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"` + // Token expiration and valid time period parameters + Lifetime *BearerToken_Body_TokenLifetime `protobuf:"bytes,3,opt,name=lifetime,proto3" json:"lifetime,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *BearerToken_Body) Reset() { *m = BearerToken_Body{} } +func (m *BearerToken_Body) String() string { return proto.CompactTextString(m) } +func (*BearerToken_Body) ProtoMessage() {} +func (*BearerToken_Body) Descriptor() ([]byte, []int) { + return fileDescriptor_8233b6696fb3e24f, []int{2, 0} +} +func (m *BearerToken_Body) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *BearerToken_Body) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_BearerToken_Body.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *BearerToken_Body) XXX_Merge(src proto.Message) { + xxx_messageInfo_BearerToken_Body.Merge(m, src) +} +func (m *BearerToken_Body) XXX_Size() int { + return m.Size() +} +func (m *BearerToken_Body) XXX_DiscardUnknown() { + xxx_messageInfo_BearerToken_Body.DiscardUnknown(m) +} + +var xxx_messageInfo_BearerToken_Body proto.InternalMessageInfo + +func (m *BearerToken_Body) GetEaclTable() *EACLTable { + if m != nil { + return m.EaclTable + } + return nil +} + +func (m *BearerToken_Body) GetOwnerId() *grpc.OwnerID { + if m != nil { + return m.OwnerId + } + return nil +} + +func (m *BearerToken_Body) GetLifetime() *BearerToken_Body_TokenLifetime { + if m != nil { + return m.Lifetime + } + return nil +} + +// Lifetime parameters of the token. Filed names taken from rfc7519. +type BearerToken_Body_TokenLifetime struct { + // Expiration Epoch + Exp uint64 `protobuf:"varint,1,opt,name=exp,proto3" json:"exp,omitempty"` + // Not valid before Epoch + Nbf uint64 `protobuf:"varint,2,opt,name=nbf,proto3" json:"nbf,omitempty"` + // Issued at Epoch + Iat uint64 `protobuf:"varint,3,opt,name=iat,proto3" json:"iat,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *BearerToken_Body_TokenLifetime) Reset() { *m = BearerToken_Body_TokenLifetime{} } +func (m *BearerToken_Body_TokenLifetime) String() string { return proto.CompactTextString(m) } +func (*BearerToken_Body_TokenLifetime) ProtoMessage() {} +func (*BearerToken_Body_TokenLifetime) Descriptor() ([]byte, []int) { + return fileDescriptor_8233b6696fb3e24f, []int{2, 0, 0} +} +func (m *BearerToken_Body_TokenLifetime) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *BearerToken_Body_TokenLifetime) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_BearerToken_Body_TokenLifetime.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *BearerToken_Body_TokenLifetime) XXX_Merge(src proto.Message) { + xxx_messageInfo_BearerToken_Body_TokenLifetime.Merge(m, src) +} +func (m *BearerToken_Body_TokenLifetime) XXX_Size() int { + return m.Size() +} +func (m *BearerToken_Body_TokenLifetime) XXX_DiscardUnknown() { + xxx_messageInfo_BearerToken_Body_TokenLifetime.DiscardUnknown(m) +} + +var xxx_messageInfo_BearerToken_Body_TokenLifetime proto.InternalMessageInfo + +func (m *BearerToken_Body_TokenLifetime) GetExp() uint64 { + if m != nil { + return m.Exp + } + return 0 +} + +func (m *BearerToken_Body_TokenLifetime) GetNbf() uint64 { + if m != nil { + return m.Nbf + } + return 0 +} + +func (m *BearerToken_Body_TokenLifetime) GetIat() uint64 { + if m != nil { + return m.Iat + } + return 0 +} + func init() { proto.RegisterEnum("neo.fs.v2.acl.Target", Target_name, Target_value) proto.RegisterEnum("neo.fs.v2.acl.MatchType", MatchType_name, MatchType_value) @@ -487,56 +679,69 @@ func init() { proto.RegisterType((*EACLRecord_FilterInfo)(nil), "neo.fs.v2.acl.EACLRecord.FilterInfo") proto.RegisterType((*EACLRecord_TargetInfo)(nil), "neo.fs.v2.acl.EACLRecord.TargetInfo") proto.RegisterType((*EACLTable)(nil), "neo.fs.v2.acl.EACLTable") + proto.RegisterType((*BearerToken)(nil), "neo.fs.v2.acl.BearerToken") + proto.RegisterType((*BearerToken_Body)(nil), "neo.fs.v2.acl.BearerToken.Body") + proto.RegisterType((*BearerToken_Body_TokenLifetime)(nil), "neo.fs.v2.acl.BearerToken.Body.TokenLifetime") } func init() { proto.RegisterFile("v2/acl/grpc/types.proto", fileDescriptor_8233b6696fb3e24f) } var fileDescriptor_8233b6696fb3e24f = []byte{ - // 703 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x54, 0xd1, 0x6e, 0xda, 0x48, - 0x14, 0x8d, 0x6d, 0x62, 0xc2, 0x85, 0x5d, 0x8d, 0x46, 0x1b, 0xd6, 0x61, 0x25, 0x84, 0xa2, 0x7d, - 0x40, 0xac, 0x30, 0x5a, 0xa2, 0xec, 0x3e, 0x54, 0x8d, 0xe4, 0xc0, 0x04, 0x68, 0x89, 0x4d, 0xc6, - 0x43, 0xaa, 0xf4, 0x05, 0x39, 0x66, 0x20, 0xa8, 0xc6, 0x46, 0xb6, 0x83, 0x44, 0x9f, 0xfa, 0x19, - 0xfd, 0x86, 0x3e, 0xf6, 0x2b, 0xfa, 0xd8, 0x4f, 0xa8, 0xd2, 0xcf, 0xe8, 0x4b, 0x65, 0x1b, 0x02, - 0x75, 0x2a, 0xf5, 0xc9, 0xd7, 0x73, 0xcf, 0x39, 0xf7, 0xcc, 0xf1, 0x78, 0xe0, 0xcf, 0x65, 0xb3, - 0x61, 0xd9, 0x4e, 0x63, 0xea, 0x2f, 0xec, 0x46, 0xb8, 0x5a, 0xf0, 0x40, 0x5d, 0xf8, 0x5e, 0xe8, - 0xe1, 0xdf, 0x5c, 0xee, 0xa9, 0x93, 0x40, 0x5d, 0x36, 0x55, 0xcb, 0x76, 0x4a, 0xca, 0xb2, 0xd9, - 0xf0, 0xf9, 0x24, 0x78, 0x02, 0x3c, 0xfe, 0x26, 0x01, 0x10, 0xad, 0xd5, 0xa7, 0xdc, 0xf6, 0xfc, - 0x31, 0xfe, 0x0f, 0x72, 0xde, 0x82, 0xfb, 0x56, 0x38, 0xf3, 0x5c, 0x45, 0xa8, 0x08, 0xd5, 0xdf, - 0x9b, 0x8a, 0xfa, 0x83, 0x96, 0x6a, 0x6c, 0xfa, 0x34, 0xf7, 0x58, 0xe2, 0x3a, 0xc8, 0x96, 0x1d, - 0x93, 0xc4, 0x98, 0x74, 0x98, 0x22, 0x69, 0x71, 0x93, 0xca, 0xc9, 0x13, 0x9f, 0x41, 0x76, 0x32, - 0x73, 0x42, 0xee, 0x07, 0x8a, 0x54, 0x91, 0xaa, 0xf9, 0xe6, 0xdf, 0x29, 0xfc, 0xd6, 0x92, 0x7a, - 0x11, 0x03, 0x7b, 0xee, 0xc4, 0xa3, 0xd9, 0xa4, 0x0e, 0x22, 0x7e, 0x68, 0xf9, 0x53, 0x1e, 0x06, - 0x4a, 0xe6, 0x57, 0x7c, 0x16, 0x03, 0x13, 0x7e, 0x52, 0x07, 0xa5, 0x8f, 0x02, 0xc0, 0x56, 0x17, - 0x9f, 0x82, 0x7c, 0xc7, 0xad, 0x31, 0xf7, 0xd7, 0x5b, 0x3e, 0x4a, 0xa9, 0x75, 0xe3, 0x26, 0x5b, - 0x2d, 0x38, 0x85, 0x6d, 0x8d, 0xff, 0x07, 0x98, 0x5b, 0xa1, 0x7d, 0x37, 0x8a, 0x02, 0x5d, 0x6f, - 0x3c, 0x9d, 0xd6, 0x65, 0x04, 0x88, 0x99, 0xb9, 0xc7, 0x12, 0x1f, 0x41, 0x3e, 0x99, 0x37, 0x72, - 0xad, 0x39, 0x57, 0xa4, 0x8a, 0x50, 0xcd, 0xd1, 0x8c, 0x6e, 0xcd, 0xa3, 0x16, 0xac, 0x5b, 0x4b, - 0xcb, 0x51, 0x32, 0x71, 0x67, 0xff, 0xda, 0x72, 0xee, 0x79, 0xe9, 0x0a, 0x60, 0xbb, 0x17, 0xfc, - 0x0f, 0xc8, 0x49, 0x04, 0x6b, 0xcf, 0xe9, 0xc4, 0x13, 0x28, 0xcd, 0x50, 0xcf, 0xe1, 0xb8, 0x08, - 0x07, 0x6f, 0xf8, 0x6a, 0xe4, 0xcc, 0x82, 0x50, 0x11, 0x2b, 0x52, 0xb5, 0x40, 0x33, 0x2f, 0xf9, - 0x2a, 0x38, 0x7e, 0x27, 0x40, 0x2e, 0x8a, 0x8a, 0x59, 0xb7, 0x0e, 0xc7, 0x67, 0x50, 0xb0, 0x3d, - 0x37, 0xb4, 0x66, 0x2e, 0xf7, 0x47, 0xb3, 0x71, 0x2c, 0x9c, 0x6f, 0xfe, 0xb5, 0x23, 0x1c, 0x9d, - 0x21, 0xb5, 0xb5, 0xc1, 0xf4, 0xda, 0x34, 0xbf, 0xf3, 0x82, 0x4f, 0x20, 0xeb, 0xc7, 0x99, 0x07, - 0xf1, 0x90, 0xfc, 0x93, 0x1c, 0xb7, 0x5f, 0x85, 0x66, 0x93, 0x67, 0x50, 0x3b, 0x07, 0x39, 0xb1, - 0x8a, 0x8b, 0x80, 0x99, 0x46, 0x3b, 0x84, 0x8d, 0x86, 0xba, 0x39, 0x20, 0xad, 0xde, 0x45, 0x8f, - 0xb4, 0xd1, 0x1e, 0x3e, 0x80, 0xcc, 0xd0, 0x24, 0x14, 0x09, 0x18, 0x40, 0x36, 0x6f, 0x4c, 0x46, - 0x2e, 0x91, 0x18, 0xd5, 0x06, 0xeb, 0x12, 0x6a, 0x22, 0xa9, 0x66, 0xc0, 0x4e, 0xb8, 0x25, 0x28, - 0x5e, 0x6a, 0xac, 0xd5, 0x1d, 0xb1, 0x9b, 0x01, 0x49, 0x49, 0x21, 0x28, 0x98, 0x8c, 0xf6, 0xf4, - 0xce, 0x88, 0x5c, 0x0d, 0xb5, 0x3e, 0x12, 0xf0, 0x1f, 0x80, 0xd6, 0x2b, 0xba, 0xc1, 0xd6, 0xab, - 0x62, 0xed, 0x2d, 0xec, 0x9c, 0xed, 0x23, 0x38, 0x34, 0x06, 0x84, 0x6a, 0xac, 0x67, 0xe8, 0x29, - 0xbd, 0x2c, 0x48, 0x1d, 0xc2, 0x90, 0x10, 0x79, 0xec, 0x12, 0xad, 0x8d, 0xc4, 0x68, 0x69, 0x30, - 0x64, 0x48, 0x8a, 0x0c, 0xb6, 0x49, 0x9f, 0x30, 0x82, 0x32, 0xb1, 0x71, 0xa2, 0xd1, 0x56, 0x17, - 0xed, 0xe3, 0x02, 0x1c, 0x74, 0x08, 0xa3, 0x9a, 0xde, 0x21, 0x48, 0x8e, 0x1c, 0x6d, 0xde, 0xba, - 0x9a, 0xd9, 0x45, 0xd9, 0xda, 0x29, 0x6c, 0xfe, 0x92, 0x22, 0x60, 0xad, 0xf5, 0x93, 0xa9, 0x39, - 0xd8, 0xd7, 0xfa, 0x7d, 0xe3, 0x55, 0x32, 0xb7, 0x4d, 0xf4, 0x1b, 0x24, 0xd6, 0x9e, 0xc3, 0xee, - 0xd1, 0x2c, 0x02, 0x8e, 0xfc, 0x10, 0x9a, 0xa2, 0xe6, 0x21, 0x4b, 0xc9, 0xd5, 0x90, 0x98, 0x2c, - 0x89, 0xd3, 0x38, 0x7f, 0x41, 0x5a, 0x0c, 0x89, 0xe7, 0xd7, 0x9f, 0x1e, 0xca, 0xc2, 0xe7, 0x87, - 0xb2, 0xf0, 0xe5, 0xa1, 0x2c, 0xbc, 0xff, 0x5a, 0xde, 0x7b, 0xfd, 0xef, 0x74, 0x16, 0xde, 0xdd, - 0xdf, 0xaa, 0xb6, 0x37, 0x6f, 0xb8, 0xc1, 0xc2, 0xb6, 0xeb, 0x63, 0xbe, 0x6c, 0xb8, 0xdc, 0x9b, - 0x04, 0x75, 0x6b, 0x31, 0xab, 0x4f, 0xbd, 0xc6, 0xce, 0xed, 0xf3, 0xcc, 0xb2, 0x9d, 0x0f, 0x22, - 0xd2, 0xb9, 0x77, 0x61, 0xaa, 0xda, 0xa0, 0x17, 0x7d, 0x72, 0xcd, 0x76, 0x6e, 0xe5, 0xf8, 0x9a, - 0x39, 0xf9, 0x1e, 0x00, 0x00, 0xff, 0xff, 0xef, 0xd5, 0x9b, 0x33, 0xaa, 0x04, 0x00, 0x00, + // 862 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x55, 0xdd, 0x6e, 0xe2, 0x46, + 0x18, 0x5d, 0x63, 0x87, 0x9f, 0x8f, 0x6c, 0x65, 0x8d, 0xba, 0x2c, 0xa1, 0x52, 0x1a, 0x45, 0xbd, + 0x88, 0xa8, 0x30, 0x2a, 0xd1, 0x76, 0x2f, 0xaa, 0xae, 0x64, 0x60, 0x02, 0xb4, 0x04, 0x93, 0xf1, + 0xb0, 0x55, 0x7a, 0x83, 0x06, 0x33, 0x10, 0x6b, 0x1d, 0x1b, 0xd9, 0x0e, 0x5b, 0x7a, 0x55, 0xa9, + 0xea, 0x3b, 0xf4, 0x19, 0x7a, 0xd9, 0xa7, 0xe8, 0x65, 0x1f, 0xa1, 0x4a, 0x1f, 0xa3, 0x37, 0xd5, + 0x8c, 0x4d, 0x20, 0xde, 0x95, 0x72, 0xc5, 0xe7, 0xf9, 0xce, 0xf9, 0xce, 0x99, 0x33, 0xa3, 0x01, + 0x5e, 0xae, 0x5b, 0x4d, 0xe6, 0x78, 0xcd, 0x65, 0xb8, 0x72, 0x9a, 0xf1, 0x66, 0xc5, 0x23, 0x63, + 0x15, 0x06, 0x71, 0x80, 0x9e, 0xfb, 0x3c, 0x30, 0x16, 0x91, 0xb1, 0x6e, 0x19, 0xcc, 0xf1, 0x6a, + 0xd5, 0x75, 0xab, 0x19, 0xf2, 0x45, 0xf4, 0x01, 0xf0, 0xf4, 0x3f, 0x15, 0x00, 0x9b, 0x9d, 0x21, + 0xe1, 0x4e, 0x10, 0xce, 0xd1, 0xd7, 0x50, 0x0a, 0x56, 0x3c, 0x64, 0xb1, 0x1b, 0xf8, 0x55, 0xe5, + 0x44, 0x39, 0xfb, 0xa4, 0x55, 0x35, 0x1e, 0xcd, 0x32, 0xac, 0x6d, 0x9f, 0x94, 0x1e, 0x4a, 0xd4, + 0x80, 0x3c, 0x73, 0x24, 0x29, 0x27, 0x49, 0x2f, 0x32, 0x24, 0x53, 0x36, 0x49, 0x3e, 0xf9, 0x45, + 0x6f, 0xa0, 0xb0, 0x70, 0xbd, 0x98, 0x87, 0x51, 0x55, 0x3d, 0x51, 0xcf, 0xca, 0xad, 0x2f, 0x32, + 0xf8, 0x9d, 0x25, 0xe3, 0x42, 0x02, 0x07, 0xfe, 0x22, 0x20, 0x85, 0xa4, 0x8e, 0x04, 0x3f, 0x66, + 0xe1, 0x92, 0xc7, 0x51, 0x55, 0x7b, 0x8a, 0x4f, 0x25, 0x30, 0xe1, 0x27, 0x75, 0x54, 0xfb, 0x53, + 0x01, 0xd8, 0xcd, 0x45, 0xaf, 0x20, 0x7f, 0xc3, 0xd9, 0x9c, 0x87, 0xe9, 0x96, 0x8f, 0x32, 0xd3, + 0xfa, 0xb2, 0x49, 0x37, 0x2b, 0x4e, 0x60, 0x57, 0xa3, 0xd7, 0x00, 0xb7, 0x2c, 0x76, 0x6e, 0xa6, + 0x22, 0xd0, 0x74, 0xe3, 0xd9, 0xb4, 0x2e, 0x05, 0x40, 0x32, 0x4b, 0x0f, 0x25, 0x3a, 0x82, 0x72, + 0xa2, 0x37, 0xf5, 0xd9, 0x2d, 0xaf, 0xaa, 0x27, 0xca, 0x59, 0x89, 0x68, 0x23, 0x76, 0x2b, 0x5a, + 0x90, 0xb6, 0xd6, 0xcc, 0xab, 0x6a, 0xb2, 0x73, 0xf0, 0x96, 0x79, 0x77, 0xbc, 0x76, 0x05, 0xb0, + 0xdb, 0x0b, 0xfa, 0x12, 0xf2, 0x49, 0x04, 0xa9, 0xe7, 0x6c, 0xe2, 0x09, 0x94, 0x68, 0x24, 0xf0, + 0x38, 0xaa, 0x40, 0xf1, 0x1d, 0xdf, 0x4c, 0x3d, 0x37, 0x8a, 0xab, 0xb9, 0x13, 0xf5, 0xec, 0x90, + 0x68, 0xdf, 0xf3, 0x4d, 0x74, 0xfa, 0x8b, 0x02, 0x25, 0x11, 0x15, 0x65, 0x33, 0x8f, 0xa3, 0x37, + 0x70, 0xe8, 0x04, 0x7e, 0xcc, 0x5c, 0x9f, 0x87, 0x53, 0x77, 0x2e, 0x07, 0x97, 0x5b, 0x9f, 0xed, + 0x0d, 0x16, 0x77, 0xc8, 0xe8, 0x6c, 0x31, 0x83, 0x2e, 0x29, 0xef, 0x7d, 0xa0, 0x73, 0x28, 0x84, + 0x32, 0xf3, 0x48, 0x8a, 0x94, 0x3f, 0xc8, 0x71, 0x77, 0x2a, 0xa4, 0x90, 0xfc, 0x46, 0xa7, 0xbf, + 0xaa, 0x50, 0x6e, 0x73, 0x16, 0xf2, 0x90, 0x06, 0xef, 0xb8, 0x8f, 0xce, 0x41, 0x9b, 0x05, 0xf3, + 0x4d, 0x2a, 0xfe, 0x79, 0x66, 0xc2, 0x1e, 0xd2, 0x68, 0x07, 0xf3, 0x0d, 0x91, 0x60, 0xf4, 0x1a, + 0x4a, 0x91, 0xbb, 0xf4, 0x59, 0x7c, 0x17, 0x26, 0x07, 0xf1, 0x58, 0x5b, 0xda, 0xb6, 0xb7, 0x00, + 0xb2, 0xc3, 0xd6, 0x7e, 0xcb, 0x81, 0xd6, 0x4e, 0x26, 0x00, 0x67, 0x8e, 0x37, 0x8d, 0x45, 0x12, + 0xa9, 0x78, 0xf5, 0x23, 0xf6, 0x65, 0x52, 0xa4, 0x24, 0xb0, 0x49, 0x68, 0x2d, 0x28, 0x06, 0xef, + 0xd3, 0xc0, 0x12, 0xe5, 0x97, 0x59, 0x65, 0xeb, 0x7d, 0x12, 0x56, 0x41, 0x02, 0x07, 0x73, 0x34, + 0x80, 0xa2, 0xe7, 0x2e, 0x78, 0xec, 0xa6, 0x87, 0x5f, 0x6e, 0x35, 0x9e, 0xd8, 0xa7, 0x21, 0xcb, + 0x61, 0x4a, 0x22, 0x0f, 0xf4, 0x1a, 0x86, 0xe7, 0x8f, 0x5a, 0x48, 0x07, 0x95, 0xff, 0xb4, 0x92, + 0x3b, 0xd0, 0x88, 0x28, 0xc5, 0x8a, 0x3f, 0x5b, 0x48, 0x73, 0x1a, 0x11, 0xa5, 0x58, 0x71, 0x59, + 0x2c, 0xa5, 0x35, 0x22, 0xca, 0x7a, 0x1b, 0xf2, 0xc9, 0x85, 0x41, 0x15, 0x40, 0xd4, 0x24, 0x3d, + 0x4c, 0xa7, 0x93, 0x91, 0x3d, 0xc6, 0x9d, 0xc1, 0xc5, 0x00, 0x77, 0xf5, 0x67, 0xa8, 0x08, 0xda, + 0xc4, 0xc6, 0x44, 0x57, 0x10, 0x40, 0xde, 0xbe, 0xb6, 0x29, 0xbe, 0xd4, 0x73, 0xa2, 0xb6, 0x68, + 0x1f, 0x13, 0x5b, 0x57, 0xeb, 0x16, 0xec, 0x5d, 0xf1, 0x1a, 0x54, 0x2e, 0x4d, 0xda, 0xe9, 0x4f, + 0xe9, 0xf5, 0x18, 0x67, 0x46, 0xe9, 0x70, 0x68, 0x53, 0x32, 0x18, 0xf5, 0xa6, 0xf8, 0x6a, 0x62, + 0x0e, 0x75, 0x05, 0x7d, 0x0a, 0x7a, 0xba, 0x32, 0xb2, 0x68, 0xba, 0x9a, 0xab, 0xff, 0x0c, 0x7b, + 0x2f, 0xcc, 0x11, 0xbc, 0xb0, 0xc6, 0x98, 0x98, 0x74, 0x60, 0x8d, 0x32, 0xf3, 0x0a, 0xa0, 0xf6, + 0x30, 0xd5, 0x15, 0xe1, 0xb1, 0x8f, 0xcd, 0xae, 0x9e, 0x13, 0x4b, 0xe3, 0x09, 0xd5, 0x55, 0x61, + 0xb0, 0x8b, 0x87, 0x98, 0x62, 0x5d, 0x93, 0xc6, 0xb1, 0x49, 0x3a, 0x7d, 0xfd, 0x00, 0x1d, 0x42, + 0xb1, 0x87, 0x29, 0x31, 0x47, 0x3d, 0xac, 0xe7, 0x85, 0xa3, 0xed, 0x57, 0xdf, 0xb4, 0xfb, 0x7a, + 0xa1, 0xfe, 0x0a, 0xb6, 0x6f, 0x55, 0x05, 0x90, 0xd9, 0xf9, 0x88, 0x6a, 0x09, 0x0e, 0xcc, 0xe1, + 0xd0, 0xfa, 0x21, 0xd1, 0xed, 0xe2, 0xd1, 0xb5, 0x9e, 0xab, 0x7f, 0x0b, 0xfb, 0x0f, 0x44, 0x05, + 0x90, 0xf0, 0x83, 0x49, 0x86, 0x5a, 0x86, 0x02, 0xc1, 0x57, 0x13, 0x6c, 0xd3, 0x24, 0x4e, 0xab, + 0xfd, 0x1d, 0xee, 0x50, 0x3d, 0xd7, 0x7e, 0xfb, 0xd7, 0xfd, 0xb1, 0xf2, 0xf7, 0xfd, 0xb1, 0xf2, + 0xcf, 0xfd, 0xb1, 0xf2, 0xfb, 0xbf, 0xc7, 0xcf, 0x7e, 0xfc, 0x6a, 0xe9, 0xc6, 0x37, 0x77, 0x33, + 0xc3, 0x09, 0x6e, 0x9b, 0x7e, 0xb4, 0x72, 0x9c, 0xc6, 0x9c, 0xaf, 0x9b, 0x3e, 0x0f, 0x16, 0x51, + 0x83, 0xad, 0xdc, 0xc6, 0x32, 0x68, 0xee, 0xfd, 0x07, 0x7c, 0xc3, 0x1c, 0xef, 0x8f, 0x9c, 0x3e, + 0xe2, 0xc1, 0x85, 0x6d, 0x98, 0xe3, 0x81, 0xb8, 0x4e, 0xa6, 0xe3, 0xcd, 0xf2, 0xf2, 0xb1, 0x3f, + 0xff, 0x3f, 0x00, 0x00, 0xff, 0xff, 0x0d, 0x9c, 0x67, 0x62, 0x30, 0x06, 0x00, 0x00, } func (m *EACLRecord) Marshal() (dAtA []byte, err error) { @@ -749,6 +954,162 @@ func (m *EACLTable) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *BearerToken) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *BearerToken) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BearerToken) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.Signature != nil { + { + size, err := m.Signature.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.Body != nil { + { + size, err := m.Body.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *BearerToken_Body) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *BearerToken_Body) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BearerToken_Body) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.Lifetime != nil { + { + size, err := m.Lifetime.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + if m.OwnerId != nil { + { + size, err := m.OwnerId.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.EaclTable != nil { + { + size, err := m.EaclTable.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *BearerToken_Body_TokenLifetime) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *BearerToken_Body_TokenLifetime) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BearerToken_Body_TokenLifetime) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.Iat != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Iat)) + i-- + dAtA[i] = 0x18 + } + if m.Nbf != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Nbf)) + i-- + dAtA[i] = 0x10 + } + if m.Exp != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Exp)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + func encodeVarintTypes(dAtA []byte, offset int, v uint64) int { offset -= sovTypes(v) base := offset @@ -859,6 +1220,71 @@ func (m *EACLTable) Size() (n int) { return n } +func (m *BearerToken) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Body != nil { + l = m.Body.Size() + n += 1 + l + sovTypes(uint64(l)) + } + if m.Signature != nil { + l = m.Signature.Size() + n += 1 + l + sovTypes(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *BearerToken_Body) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.EaclTable != nil { + l = m.EaclTable.Size() + n += 1 + l + sovTypes(uint64(l)) + } + if m.OwnerId != nil { + l = m.OwnerId.Size() + n += 1 + l + sovTypes(uint64(l)) + } + if m.Lifetime != nil { + l = m.Lifetime.Size() + n += 1 + l + sovTypes(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *BearerToken_Body_TokenLifetime) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Exp != 0 { + n += 1 + sovTypes(uint64(m.Exp)) + } + if m.Nbf != 0 { + n += 1 + sovTypes(uint64(m.Nbf)) + } + if m.Iat != 0 { + n += 1 + sovTypes(uint64(m.Iat)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + func sovTypes(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -1410,6 +1836,405 @@ func (m *EACLTable) Unmarshal(dAtA []byte) error { } return nil } +func (m *BearerToken) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: BearerToken: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BearerToken: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Body", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Body == nil { + m.Body = &BearerToken_Body{} + } + if err := m.Body.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signature", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Signature == nil { + m.Signature = &grpc.Signature{} + } + if err := m.Signature.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *BearerToken_Body) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Body: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Body: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field EaclTable", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.EaclTable == nil { + m.EaclTable = &EACLTable{} + } + if err := m.EaclTable.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OwnerId", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.OwnerId == nil { + m.OwnerId = &grpc.OwnerID{} + } + if err := m.OwnerId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Lifetime", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Lifetime == nil { + m.Lifetime = &BearerToken_Body_TokenLifetime{} + } + if err := m.Lifetime.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *BearerToken_Body_TokenLifetime) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: TokenLifetime: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TokenLifetime: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Exp", wireType) + } + m.Exp = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Exp |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Nbf", wireType) + } + m.Nbf = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Nbf |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Iat", wireType) + } + m.Iat = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Iat |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipTypes(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/v2/container/grpc/service.pb.go b/v2/container/grpc/service.pb.go index 04a48a8..dd3791f 100644 --- a/v2/container/grpc/service.pb.go +++ b/v2/container/grpc/service.pb.go @@ -9,7 +9,7 @@ import ( proto "github.com/golang/protobuf/proto" grpc2 "github.com/nspcc-dev/neofs-api-go/v2/acl/grpc" grpc1 "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" - grpc "github.com/nspcc-dev/neofs-api-go/v2/service/grpc" + grpc "github.com/nspcc-dev/neofs-api-go/v2/session/grpc" grpc3 "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" @@ -104,10 +104,10 @@ type PutRequest_Body struct { // Container to create in NeoFS. Container *Container `protobuf:"bytes,1,opt,name=container,proto3" json:"container,omitempty"` //Signature of stable-marshalled container according to RFC-6979. - Signature *grpc.Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Signature *grpc1.Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *PutRequest_Body) Reset() { *m = PutRequest_Body{} } @@ -150,7 +150,7 @@ func (m *PutRequest_Body) GetContainer() *Container { return nil } -func (m *PutRequest_Body) GetSignature() *grpc.Signature { +func (m *PutRequest_Body) GetSignature() *grpc1.Signature { if m != nil { return m.Signature } @@ -352,10 +352,10 @@ type DeleteRequest_Body struct { // from NeoFS. ContainerId *grpc1.ContainerID `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` // Signature of container id according to RFC-6979. - Signature *grpc.Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Signature *grpc1.Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *DeleteRequest_Body) Reset() { *m = DeleteRequest_Body{} } @@ -398,7 +398,7 @@ func (m *DeleteRequest_Body) GetContainerId() *grpc1.ContainerID { return nil } -func (m *DeleteRequest_Body) GetSignature() *grpc.Signature { +func (m *DeleteRequest_Body) GetSignature() *grpc1.Signature { if m != nil { return m.Signature } @@ -1067,10 +1067,10 @@ type SetExtendedACLRequest_Body struct { // Extended ACL to set for the container. Eacl *grpc2.EACLTable `protobuf:"bytes,1,opt,name=eacl,proto3" json:"eacl,omitempty"` // Signature of stable-marshalled Extended ACL according to RFC-6979. - Signature *grpc.Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Signature *grpc1.Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *SetExtendedACLRequest_Body) Reset() { *m = SetExtendedACLRequest_Body{} } @@ -1113,7 +1113,7 @@ func (m *SetExtendedACLRequest_Body) GetEacl() *grpc2.EACLTable { return nil } -func (m *SetExtendedACLRequest_Body) GetSignature() *grpc.Signature { +func (m *SetExtendedACLRequest_Body) GetSignature() *grpc1.Signature { if m != nil { return m.Signature } @@ -1424,10 +1424,10 @@ type GetExtendedACLResponse_Body struct { // Extended ACL that has been requested if it was set up. Eacl *grpc2.EACLTable `protobuf:"bytes,1,opt,name=eacl,proto3" json:"eacl,omitempty"` // Signature of stable-marshalled Extended ACL according to RFC-6979. - Signature *grpc.Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Signature *grpc1.Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetExtendedACLResponse_Body) Reset() { *m = GetExtendedACLResponse_Body{} } @@ -1470,7 +1470,7 @@ func (m *GetExtendedACLResponse_Body) GetEacl() *grpc2.EACLTable { return nil } -func (m *GetExtendedACLResponse_Body) GetSignature() *grpc.Signature { +func (m *GetExtendedACLResponse_Body) GetSignature() *grpc1.Signature { if m != nil { return m.Signature } @@ -1507,58 +1507,59 @@ func init() { func init() { proto.RegisterFile("v2/container/grpc/service.proto", fileDescriptor_364186d99410ec35) } var fileDescriptor_364186d99410ec35 = []byte{ - // 813 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x98, 0xcf, 0x6e, 0xd3, 0x5a, - 0x10, 0xc6, 0xaf, 0xdd, 0xa8, 0xf7, 0x76, 0x92, 0x56, 0x57, 0xbe, 0x6a, 0x1b, 0xa5, 0x97, 0x34, - 0x18, 0x0a, 0x15, 0x34, 0x36, 0x32, 0x1b, 0x68, 0x0b, 0xa2, 0x4d, 0x5a, 0x37, 0xa2, 0x40, 0xeb, - 0x20, 0x16, 0x6c, 0x2a, 0xc7, 0x9e, 0xa4, 0x96, 0x52, 0x3b, 0xd8, 0x8e, 0x4b, 0x76, 0xa8, 0x4f, - 0xc1, 0x02, 0xb1, 0x46, 0x15, 0x0b, 0x9e, 0x80, 0x35, 0x4b, 0x1e, 0x01, 0xb5, 0x1b, 0x24, 0x58, - 0xf1, 0x04, 0x28, 0xfe, 0x17, 0xbb, 0x71, 0x9a, 0xa4, 0x8d, 0x90, 0xbc, 0x4b, 0xe4, 0x6f, 0xe6, - 0xcc, 0xfc, 0xf2, 0x9d, 0x33, 0xc7, 0x81, 0x79, 0x8b, 0x63, 0x25, 0x4d, 0x35, 0x45, 0x45, 0x45, - 0x9d, 0xad, 0xe9, 0x0d, 0x89, 0x35, 0x50, 0xb7, 0x14, 0x09, 0x99, 0x86, 0xae, 0x99, 0x1a, 0xf5, - 0x9f, 0x8a, 0x1a, 0x53, 0x35, 0x18, 0x8b, 0x63, 0x7c, 0x5d, 0x66, 0xd6, 0xe2, 0x58, 0x51, 0xaa, - 0x3b, 0x7a, 0xb3, 0xd5, 0x40, 0xc3, 0x51, 0x67, 0xae, 0x74, 0xa7, 0x0b, 0x3e, 0x4e, 0x5b, 0x1c, - 0xab, 0x63, 0xd5, 0xe8, 0x7e, 0x32, 0x67, 0x71, 0xde, 0xc2, 0x5d, 0x0f, 0xe9, 0x53, 0x12, 0x60, - 0xa7, 0x69, 0x0a, 0xf8, 0xaa, 0x89, 0x86, 0x49, 0xdd, 0x83, 0x44, 0x45, 0x93, 0x5b, 0x69, 0x22, - 0x47, 0x2c, 0x26, 0xb9, 0xeb, 0x4c, 0x44, 0x85, 0x4c, 0x47, 0xce, 0xac, 0x6b, 0x72, 0x4b, 0xb0, - 0x23, 0xa8, 0x0d, 0x48, 0x1e, 0xa0, 0x29, 0xee, 0xed, 0xa3, 0x28, 0xa3, 0x9e, 0x26, 0xbb, 0x12, - 0x78, 0xbd, 0xbb, 0xb1, 0x4f, 0xd0, 0x14, 0xb7, 0x6c, 0xad, 0x00, 0x07, 0xfe, 0x67, 0x6a, 0x17, - 0x26, 0x2d, 0xd4, 0x95, 0x6a, 0xcb, 0x4b, 0x34, 0x66, 0x27, 0x5a, 0xea, 0x9d, 0xe8, 0x45, 0x5b, - 0xae, 0x48, 0xa2, 0xa9, 0x68, 0xaa, 0x9b, 0x30, 0xe5, 0xa4, 0x70, 0xbe, 0x65, 0xde, 0x10, 0x90, - 0x68, 0x17, 0x4a, 0xad, 0xc2, 0x84, 0xdf, 0x85, 0xdb, 0x61, 0x36, 0xb2, 0xc3, 0x82, 0xf7, 0x49, - 0xe8, 0x04, 0x50, 0xcb, 0x30, 0x61, 0x28, 0x35, 0x55, 0x34, 0x9b, 0x3a, 0xba, 0xed, 0xfd, 0x1f, - 0x51, 0x55, 0xd9, 0xd3, 0x08, 0x1d, 0x39, 0xfd, 0x91, 0x84, 0xa4, 0x8d, 0xcd, 0x68, 0x68, 0xaa, - 0x81, 0xd4, 0xfd, 0x10, 0xe6, 0x85, 0xde, 0x98, 0x1d, 0x7d, 0x90, 0xf3, 0x66, 0x14, 0xe7, 0x85, - 0x48, 0x3c, 0x4e, 0x70, 0x0f, 0xd0, 0x42, 0x34, 0xe8, 0xfc, 0x39, 0x99, 0xfa, 0x92, 0xde, 0x74, - 0x41, 0x3f, 0x84, 0x94, 0xdf, 0xc7, 0x9e, 0x22, 0xbb, 0x6d, 0xce, 0x05, 0x52, 0xb7, 0x9d, 0xda, - 0xc1, 0x5c, 0x2a, 0x0a, 0x49, 0x3f, 0xa0, 0x24, 0xd3, 0x3f, 0x48, 0x98, 0x2c, 0x62, 0x1d, 0x4d, - 0xf4, 0x7c, 0xb9, 0x12, 0x02, 0x76, 0x33, 0x12, 0x58, 0x28, 0x22, 0x1e, 0xd6, 0x3c, 0x22, 0x46, - 0x43, 0xec, 0x52, 0xe6, 0xfc, 0x45, 0xc0, 0x94, 0xc7, 0xce, 0xf5, 0xe7, 0x6a, 0x08, 0xf7, 0xe2, - 0xb9, 0xb8, 0xe3, 0x65, 0xd1, 0x71, 0x07, 0x38, 0xfd, 0x81, 0x04, 0xe0, 0x71, 0xa8, 0x73, 0xaf, - 0x23, 0x8f, 0x87, 0xb9, 0x46, 0xb5, 0x1b, 0x8f, 0x49, 0x48, 0xda, 0xbd, 0x0f, 0x71, 0x78, 0x05, - 0xf4, 0x71, 0x71, 0x46, 0x71, 0x14, 0x53, 0x82, 0x7e, 0x4f, 0x42, 0x72, 0x5b, 0x31, 0x7c, 0x63, - 0x0d, 0x02, 0x2b, 0xa0, 0x8f, 0x87, 0xb3, 0x96, 0x5d, 0x54, 0x1c, 0xfc, 0xa3, 0x1d, 0x86, 0x5c, - 0x35, 0x7b, 0xd6, 0x55, 0xcf, 0x0e, 0x1d, 0x47, 0xfd, 0x6d, 0x0b, 0x4b, 0x32, 0xfd, 0x89, 0x84, - 0x94, 0xd3, 0xb0, 0x6b, 0xa7, 0xe5, 0x10, 0xa1, 0x1b, 0xe7, 0x10, 0x8a, 0x97, 0x9f, 0xb6, 0x5c, - 0x48, 0x8f, 0x60, 0x32, 0xb8, 0xfd, 0x8c, 0x34, 0x91, 0x1b, 0xeb, 0xb7, 0xff, 0x52, 0x81, 0xfd, - 0x67, 0xd0, 0xdf, 0x49, 0x98, 0x2e, 0xa3, 0xb9, 0xf1, 0xda, 0x44, 0x55, 0x46, 0x79, 0xad, 0xb0, - 0xed, 0xb9, 0xab, 0x10, 0x62, 0xc7, 0x46, 0xb2, 0x8b, 0x8c, 0x8c, 0x87, 0xcf, 0x1a, 0x2e, 0xc2, - 0x25, 0x48, 0xa0, 0x28, 0xd5, 0xdd, 0x36, 0xd3, 0x81, 0x8c, 0xa2, 0x54, 0x67, 0x36, 0xd6, 0x0a, - 0xdb, 0xcf, 0xc5, 0x4a, 0x1d, 0x05, 0x5b, 0x75, 0xa9, 0x59, 0x78, 0x44, 0xc2, 0xcc, 0x59, 0x60, - 0xae, 0x4f, 0x8b, 0x21, 0xd6, 0x77, 0x06, 0x62, 0x1d, 0xcf, 0xd9, 0xf8, 0x99, 0x84, 0x69, 0xfe, - 0xc2, 0x7e, 0xe3, 0xe3, 0xeb, 0xb7, 0x51, 0x4d, 0xcc, 0x9f, 0x24, 0xcc, 0xf0, 0x17, 0x77, 0x11, - 0x1f, 0x6b, 0x17, 0xfd, 0xf1, 0x4d, 0xcb, 0xbd, 0x4b, 0xc0, 0xbf, 0xfe, 0x6f, 0x51, 0x76, 0x94, - 0xd4, 0x16, 0x8c, 0xed, 0x34, 0x4d, 0x6a, 0xbe, 0xcf, 0x2b, 0x6c, 0x26, 0xd7, 0xef, 0xe5, 0x8b, - 0xda, 0x85, 0x71, 0xe7, 0xae, 0x4b, 0xd1, 0xfd, 0xdf, 0x3b, 0x32, 0xd7, 0x06, 0xb8, 0x2c, 0xb7, - 0x8b, 0xe3, 0xb1, 0x57, 0x71, 0x9d, 0x7b, 0x66, 0x8f, 0xe2, 0x82, 0x97, 0xb1, 0xc7, 0x90, 0x68, - 0x0f, 0x47, 0x2a, 0xd7, 0xef, 0x66, 0x91, 0xb9, 0xda, 0x77, 0xb2, 0x52, 0x0a, 0x4c, 0x85, 0x4f, - 0x30, 0xea, 0xd6, 0xe0, 0x23, 0x25, 0x73, 0x7b, 0x88, 0x23, 0xb1, 0xbd, 0x14, 0x3f, 0xc8, 0x52, - 0xfc, 0x10, 0x4b, 0x45, 0xef, 0x9b, 0xf5, 0xfd, 0x2f, 0x27, 0x59, 0xe2, 0xeb, 0x49, 0x96, 0xf8, - 0x76, 0x92, 0x25, 0xde, 0x9e, 0x66, 0xff, 0x7a, 0xf9, 0xa0, 0xa6, 0x98, 0xfb, 0xcd, 0x0a, 0x23, - 0x69, 0x07, 0xac, 0x6a, 0x34, 0x24, 0x29, 0x2f, 0xa3, 0xc5, 0xaa, 0xa8, 0x55, 0x8d, 0xbc, 0xd8, - 0x50, 0xf2, 0x35, 0x8d, 0xed, 0xfa, 0xb3, 0x65, 0xc5, 0xff, 0x7a, 0x4c, 0xce, 0x3c, 0x45, 0x6d, - 0xb3, 0xcc, 0xac, 0xed, 0x94, 0xda, 0x05, 0xf8, 0xd6, 0xab, 0x8c, 0xdb, 0xff, 0xa9, 0xdc, 0xfd, - 0x1d, 0x00, 0x00, 0xff, 0xff, 0x27, 0xf9, 0x1d, 0xbb, 0xfa, 0x11, 0x00, 0x00, + // 821 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x98, 0xcf, 0x6e, 0xd3, 0x58, + 0x14, 0xc6, 0x27, 0x6e, 0xd4, 0x99, 0x9e, 0xa4, 0xd5, 0xc8, 0xa3, 0xb6, 0x99, 0x54, 0x93, 0x66, + 0x3c, 0xd3, 0x99, 0x0a, 0x1a, 0x1b, 0x99, 0x05, 0xd0, 0x16, 0x44, 0x9b, 0xb4, 0x6e, 0x44, 0x81, + 0xd6, 0x41, 0x2c, 0xd8, 0x54, 0x8e, 0x7d, 0x92, 0x5a, 0x4a, 0xec, 0xe0, 0xeb, 0xb8, 0x64, 0x81, + 0x90, 0x78, 0x0a, 0x16, 0x88, 0x35, 0xaa, 0x58, 0xf0, 0x04, 0xac, 0x59, 0xf2, 0x06, 0xa0, 0x22, + 0x84, 0xd8, 0xf2, 0x04, 0x28, 0xb6, 0xe3, 0xd8, 0x8d, 0xd3, 0xfc, 0x51, 0x84, 0xe4, 0x5d, 0x22, + 0x7f, 0xe7, 0xf8, 0x9c, 0x5f, 0xbe, 0x7b, 0xcf, 0xbd, 0x81, 0x65, 0x8b, 0xe7, 0x64, 0x5d, 0x33, + 0x25, 0x55, 0x43, 0x83, 0xab, 0x1a, 0x0d, 0x99, 0x23, 0x68, 0x58, 0xaa, 0x8c, 0x6c, 0xc3, 0xd0, + 0x4d, 0x9d, 0xfe, 0x43, 0x43, 0x9d, 0xad, 0x10, 0xd6, 0xe2, 0x59, 0x4f, 0x97, 0x5e, 0xb4, 0x78, + 0x4e, 0x92, 0x6b, 0x8e, 0xde, 0x6c, 0x35, 0x90, 0x38, 0xea, 0xf4, 0x5f, 0xbd, 0xe9, 0xfc, 0x8f, + 0x53, 0x16, 0xcf, 0x19, 0x58, 0x21, 0xbd, 0x4f, 0x96, 0x2c, 0x9e, 0x23, 0x48, 0x88, 0xaa, 0x6b, + 0x3d, 0x0f, 0x99, 0x8f, 0x14, 0xc0, 0x41, 0xd3, 0x14, 0xf1, 0x71, 0x13, 0x89, 0x49, 0x5f, 0x87, + 0x78, 0x59, 0x57, 0x5a, 0xa9, 0x58, 0x36, 0xb6, 0x9a, 0xe0, 0xff, 0x65, 0x43, 0x2a, 0x64, 0xbb, + 0x72, 0x76, 0x5b, 0x57, 0x5a, 0xa2, 0x1d, 0x41, 0xef, 0x40, 0xa2, 0x8e, 0xa6, 0x74, 0x74, 0x8c, + 0x92, 0x82, 0x46, 0x8a, 0xea, 0x49, 0xe0, 0x96, 0xc0, 0xba, 0xb1, 0x77, 0xd1, 0x94, 0xf6, 0x6c, + 0xad, 0x08, 0x75, 0xef, 0x33, 0x7d, 0x08, 0xb3, 0x16, 0x1a, 0x6a, 0xa5, 0xd5, 0x49, 0x34, 0x65, + 0x27, 0x5a, 0xeb, 0x9f, 0xe8, 0x61, 0x5b, 0xae, 0xca, 0x92, 0xa9, 0xea, 0x9a, 0x9b, 0x30, 0xe9, + 0xa4, 0x70, 0xbe, 0xa5, 0x9f, 0x42, 0xbc, 0x5d, 0x27, 0xbd, 0x09, 0x33, 0x5e, 0x13, 0x6e, 0x83, + 0x99, 0xd0, 0x06, 0xf3, 0x9d, 0x4f, 0x62, 0x37, 0x80, 0xbe, 0x06, 0x33, 0x44, 0xad, 0x6a, 0x92, + 0xd9, 0x34, 0xd0, 0xed, 0xee, 0x4f, 0x5f, 0x74, 0x1b, 0x3d, 0x5b, 0xea, 0x08, 0xc4, 0xae, 0x96, + 0x79, 0x43, 0x41, 0xc2, 0x46, 0x46, 0x1a, 0xba, 0x46, 0x90, 0xbe, 0x11, 0x40, 0xbc, 0xd2, 0x1f, + 0xb1, 0xa3, 0xf7, 0x33, 0xde, 0x0d, 0x63, 0xbc, 0x12, 0x8a, 0xc6, 0x09, 0xee, 0x03, 0x59, 0x0c, + 0x87, 0x9c, 0xbb, 0x20, 0xd3, 0x40, 0xca, 0xbb, 0x2e, 0xe5, 0x5b, 0x90, 0xf4, 0xfa, 0x38, 0x52, + 0x15, 0xb7, 0xcd, 0xa5, 0xf3, 0xa8, 0x3c, 0xc6, 0xc5, 0x82, 0x98, 0xf0, 0x02, 0x8a, 0x0a, 0xf3, + 0x95, 0x82, 0xd9, 0x02, 0xd6, 0xd0, 0xc4, 0x8e, 0x27, 0x37, 0x02, 0xc0, 0xfe, 0x0f, 0x05, 0x16, + 0x88, 0x88, 0x86, 0x2d, 0x9f, 0x4d, 0x06, 0xd8, 0xf8, 0xc6, 0xfc, 0x1e, 0x83, 0xb9, 0x0e, 0x37, + 0xd7, 0x9b, 0x9b, 0x01, 0xd4, 0xab, 0x17, 0xa2, 0x8e, 0x96, 0x3d, 0xa7, 0x1d, 0xda, 0xcc, 0x6b, + 0x0a, 0x40, 0xc0, 0x91, 0xf6, 0xbb, 0xae, 0x3c, 0x1a, 0xc6, 0x9a, 0xd4, 0x4a, 0x3c, 0xa5, 0x20, + 0x61, 0xf7, 0x3e, 0xc2, 0xc6, 0xe5, 0xd3, 0x47, 0xc5, 0x19, 0x85, 0x49, 0x8c, 0x07, 0xe6, 0x15, + 0x05, 0x89, 0x7d, 0x95, 0x78, 0xc6, 0x1a, 0x06, 0x96, 0x4f, 0x1f, 0x0d, 0x67, 0xad, 0xbb, 0xa8, + 0x78, 0xf8, 0x4d, 0x3f, 0x09, 0xb8, 0x6a, 0xf1, 0xbc, 0xab, 0xee, 0x9f, 0x38, 0x8e, 0xfa, 0xd5, + 0x16, 0x16, 0x15, 0xe6, 0x2d, 0x05, 0x49, 0xa7, 0x61, 0xd7, 0x4e, 0xeb, 0x01, 0x42, 0xff, 0x5d, + 0x40, 0x28, 0x5a, 0x7e, 0xda, 0x73, 0x21, 0xdd, 0x86, 0x59, 0xff, 0xf2, 0x23, 0xa9, 0x58, 0x76, + 0x6a, 0xd0, 0xfa, 0x4b, 0xfa, 0xd6, 0x1f, 0x61, 0xbe, 0x50, 0x30, 0x5f, 0x42, 0x73, 0xe7, 0x89, + 0x89, 0x9a, 0x82, 0xca, 0x56, 0x7e, 0xbf, 0xe3, 0xae, 0x7c, 0x80, 0x1d, 0x17, 0xca, 0x2e, 0x34, + 0x32, 0x1a, 0x3e, 0xab, 0xbb, 0x08, 0xd7, 0x20, 0x8e, 0x92, 0x5c, 0x73, 0xdb, 0x4c, 0xf9, 0x32, + 0x4a, 0x72, 0x8d, 0xdd, 0xd9, 0xca, 0xef, 0x3f, 0x90, 0xca, 0x35, 0x14, 0x6d, 0xd5, 0xf8, 0x83, + 0xf0, 0x39, 0x05, 0x0b, 0xe7, 0x69, 0xb9, 0x26, 0x2d, 0x04, 0x40, 0x5f, 0x19, 0x0a, 0x74, 0x34, + 0x07, 0xe3, 0x3b, 0x0a, 0xe6, 0x85, 0xb1, 0xcd, 0x26, 0x44, 0xd7, 0x6c, 0x93, 0x1a, 0x97, 0xdf, + 0x28, 0x58, 0x10, 0xc6, 0x77, 0x91, 0x10, 0x69, 0x17, 0xfd, 0xdc, 0x15, 0xcb, 0xbf, 0x8c, 0xc3, + 0xef, 0xde, 0x0f, 0x51, 0x72, 0x2e, 0xd5, 0xf4, 0x1e, 0x4c, 0x1d, 0x34, 0x4d, 0x7a, 0x79, 0xc0, + 0xa5, 0x35, 0x9d, 0x1d, 0x74, 0xe5, 0xa2, 0x0f, 0x61, 0xda, 0x39, 0xe5, 0xd2, 0xcc, 0xe0, 0xdb, + 0x46, 0xfa, 0x9f, 0x21, 0x8e, 0xc9, 0xed, 0xe2, 0x04, 0xec, 0x57, 0x5c, 0xf7, 0x84, 0xd9, 0xa7, + 0x38, 0xff, 0x31, 0xec, 0x0e, 0xc4, 0xdb, 0x63, 0x91, 0xce, 0x0e, 0x3a, 0x53, 0xa4, 0xff, 0x1e, + 0x38, 0x53, 0x69, 0x15, 0xe6, 0x82, 0xdb, 0x17, 0x7d, 0x69, 0xf8, 0x61, 0x92, 0xbe, 0x3c, 0xc2, + 0x7e, 0xd8, 0x7e, 0x95, 0x30, 0xcc, 0xab, 0x84, 0x11, 0x5e, 0x15, 0xbe, 0x68, 0xb6, 0x8f, 0xdf, + 0x9f, 0x65, 0x62, 0x1f, 0xce, 0x32, 0xb1, 0x4f, 0x67, 0x99, 0xd8, 0x8b, 0xcf, 0x99, 0x5f, 0x1e, + 0xdd, 0xac, 0xaa, 0xe6, 0x71, 0xb3, 0xcc, 0xca, 0x7a, 0x9d, 0xd3, 0x48, 0x43, 0x96, 0x73, 0x0a, + 0x5a, 0x9c, 0x86, 0x7a, 0x85, 0xe4, 0xa4, 0x86, 0x9a, 0xab, 0xea, 0x5c, 0xcf, 0xdf, 0x2b, 0x1b, + 0xde, 0xd7, 0x53, 0x6a, 0xe1, 0x1e, 0xea, 0xbb, 0x25, 0x76, 0xeb, 0xa0, 0xd8, 0x2e, 0xc0, 0xb3, + 0x5e, 0x79, 0xda, 0xfe, 0x17, 0xe5, 0xea, 0x8f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xa1, 0x09, 0xe6, + 0xa5, 0xec, 0x11, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -3867,7 +3868,7 @@ func (m *PutRequest_Body) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.Signature == nil { - m.Signature = &grpc.Signature{} + m.Signature = &grpc1.Signature{} } if err := m.Signature.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -4407,7 +4408,7 @@ func (m *DeleteRequest_Body) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.Signature == nil { - m.Signature = &grpc.Signature{} + m.Signature = &grpc1.Signature{} } if err := m.Signature.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -5917,7 +5918,7 @@ func (m *SetExtendedACLRequest_Body) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.Signature == nil { - m.Signature = &grpc.Signature{} + m.Signature = &grpc1.Signature{} } if err := m.Signature.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -6673,7 +6674,7 @@ func (m *GetExtendedACLResponse_Body) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.Signature == nil { - m.Signature = &grpc.Signature{} + m.Signature = &grpc1.Signature{} } if err := m.Signature.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err diff --git a/v2/container/grpc/types.pb.go b/v2/container/grpc/types.pb.go index 97979f1..4d48b1b 100644 --- a/v2/container/grpc/types.pb.go +++ b/v2/container/grpc/types.pb.go @@ -6,9 +6,8 @@ package container import ( fmt "fmt" proto "github.com/golang/protobuf/proto" - grpc2 "github.com/nspcc-dev/neofs-api-go/v2/netmap/grpc" - grpc1 "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" - grpc "github.com/nspcc-dev/neofs-api-go/v2/service/grpc" + grpc1 "github.com/nspcc-dev/neofs-api-go/v2/netmap/grpc" + grpc "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" io "io" math "math" math_bits "math/bits" @@ -34,7 +33,7 @@ type Container struct { // Effectively the version of API library used to create container Version *grpc.Version `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` // OwnerID carries identifier of the container owner. - OwnerId *grpc1.OwnerID `protobuf:"bytes,2,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"` + OwnerId *grpc.OwnerID `protobuf:"bytes,2,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"` // Nonce is a 16 byte UUID, used to avoid collisions of container id. Nonce []byte `protobuf:"bytes,3,opt,name=nonce,proto3" json:"nonce,omitempty"` // BasicACL contains access control rules for owner, system, others groups and @@ -43,7 +42,7 @@ type Container struct { // Attributes define any immutable characteristics of container. Attributes []*Container_Attribute `protobuf:"bytes,5,rep,name=attributes,proto3" json:"attributes,omitempty"` // Placement policy for the object inside the container. - PlacementPolicy *grpc2.PlacementPolicy `protobuf:"bytes,6,opt,name=placement_policy,json=placementPolicy,proto3" json:"placement_policy,omitempty"` + PlacementPolicy *grpc1.PlacementPolicy `protobuf:"bytes,6,opt,name=placement_policy,json=placementPolicy,proto3" json:"placement_policy,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -89,7 +88,7 @@ func (m *Container) GetVersion() *grpc.Version { return nil } -func (m *Container) GetOwnerId() *grpc1.OwnerID { +func (m *Container) GetOwnerId() *grpc.OwnerID { if m != nil { return m.OwnerId } @@ -117,7 +116,7 @@ func (m *Container) GetAttributes() []*Container_Attribute { return nil } -func (m *Container) GetPlacementPolicy() *grpc2.PlacementPolicy { +func (m *Container) GetPlacementPolicy() *grpc1.PlacementPolicy { if m != nil { return m.PlacementPolicy } @@ -190,32 +189,31 @@ func init() { func init() { proto.RegisterFile("v2/container/grpc/types.proto", fileDescriptor_3bfd95a81c72c35c) } var fileDescriptor_3bfd95a81c72c35c = []byte{ - // 398 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x52, 0xcd, 0xaa, 0x13, 0x31, - 0x14, 0x76, 0x5a, 0xef, 0xcf, 0xe4, 0x2a, 0x5e, 0xa2, 0xe8, 0x30, 0x17, 0x4b, 0x75, 0x35, 0x9b, - 0x26, 0x90, 0xeb, 0x4e, 0x5c, 0x54, 0x45, 0x2c, 0x88, 0x96, 0x08, 0x2e, 0xdc, 0x94, 0x34, 0x3d, - 0x6d, 0x83, 0xd3, 0x24, 0x24, 0x69, 0xa4, 0x6f, 0xe2, 0x33, 0xf8, 0x24, 0x2e, 0x7d, 0x04, 0xa9, - 0xcf, 0xe0, 0x5e, 0x26, 0xb5, 0x63, 0xa5, 0xee, 0xe6, 0x9c, 0xef, 0xfb, 0xce, 0xf9, 0xce, 0x37, - 0x41, 0x0f, 0x23, 0xa3, 0xd2, 0xe8, 0x20, 0x94, 0x06, 0x47, 0x17, 0xce, 0x4a, 0x1a, 0x36, 0x16, - 0x3c, 0xb1, 0xce, 0x04, 0x83, 0xef, 0x6a, 0x30, 0x64, 0xee, 0x49, 0x64, 0xa4, 0x65, 0x95, 0x65, - 0x64, 0x54, 0x43, 0x58, 0x09, 0x7b, 0x24, 0x28, 0x8b, 0xc8, 0xa8, 0x83, 0xb9, 0x3f, 0x46, 0xae, - 0x22, 0xa3, 0x1e, 0x5c, 0x54, 0x12, 0x8e, 0xc0, 0xc7, 0xbf, 0x3a, 0x28, 0x7f, 0xb1, 0x5f, 0x80, - 0x9f, 0xa0, 0xb3, 0x08, 0xce, 0x2b, 0xa3, 0x8b, 0xac, 0x9f, 0x55, 0x17, 0xac, 0x24, 0x7f, 0x7d, - 0xfc, 0x99, 0x41, 0x3e, 0xec, 0x18, 0x7c, 0x4f, 0xc5, 0x0c, 0x9d, 0x9b, 0xcf, 0x1a, 0xdc, 0x44, - 0xcd, 0x8a, 0x4e, 0x92, 0x3d, 0x38, 0x90, 0x35, 0xa6, 0xc8, 0xbb, 0x06, 0x1f, 0xbd, 0xe4, 0x67, - 0x89, 0x38, 0x9a, 0xe1, 0x7b, 0xe8, 0x44, 0x1b, 0x2d, 0xa1, 0xe8, 0xf6, 0xb3, 0xea, 0x16, 0xdf, - 0x15, 0xf8, 0x0a, 0xe5, 0x53, 0xe1, 0x95, 0x9c, 0x08, 0x59, 0x17, 0x37, 0xfb, 0x59, 0x75, 0x9b, - 0x9f, 0xa7, 0xc6, 0x50, 0xd6, 0xf8, 0x35, 0x42, 0x22, 0x04, 0xa7, 0xa6, 0xeb, 0x00, 0xbe, 0x38, - 0xe9, 0x77, 0xab, 0x0b, 0x56, 0x91, 0xff, 0xe4, 0x44, 0xda, 0x83, 0xc8, 0x70, 0x2f, 0xe0, 0x07, - 0x5a, 0xfc, 0x06, 0x5d, 0xda, 0x5a, 0x48, 0x58, 0x81, 0x0e, 0x13, 0x6b, 0x6a, 0x25, 0x37, 0xc5, - 0x69, 0x32, 0xfe, 0xe8, 0x60, 0xde, 0x2e, 0x69, 0x32, 0xde, 0x33, 0xc7, 0x89, 0xc8, 0xef, 0xd8, - 0x7f, 0x1b, 0xe5, 0x35, 0xca, 0xdb, 0x35, 0xf8, 0x12, 0x75, 0x3f, 0xc1, 0x26, 0xa5, 0x97, 0xf3, - 0xe6, 0xb3, 0xb9, 0x34, 0x8a, 0x7a, 0x0d, 0x29, 0x9a, 0x9c, 0xef, 0x8a, 0xe7, 0xcb, 0x6f, 0xdb, - 0x5e, 0xf6, 0x7d, 0xdb, 0xcb, 0x7e, 0x6c, 0x7b, 0xd9, 0x97, 0x9f, 0xbd, 0x1b, 0x1f, 0x9f, 0x2d, - 0x54, 0x58, 0xae, 0xa7, 0x44, 0x9a, 0x15, 0xd5, 0xde, 0x4a, 0x39, 0x98, 0x41, 0xa4, 0x1a, 0xcc, - 0xdc, 0x0f, 0x84, 0x55, 0x83, 0x85, 0xa1, 0x47, 0x4f, 0xe6, 0x69, 0x5b, 0x7e, 0xed, 0xdc, 0x7f, - 0x0b, 0xe6, 0xd5, 0x7b, 0x32, 0x1c, 0x8f, 0x1a, 0xf3, 0x6d, 0x04, 0xd3, 0xd3, 0xf4, 0xa3, 0xaf, - 0x7f, 0x07, 0x00, 0x00, 0xff, 0xff, 0x17, 0x73, 0x67, 0xd0, 0x71, 0x02, 0x00, 0x00, + // 383 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x52, 0x4d, 0xae, 0xd3, 0x30, + 0x10, 0x26, 0x2d, 0xef, 0xb5, 0x71, 0x41, 0x54, 0x06, 0x41, 0x14, 0x44, 0x14, 0x58, 0x65, 0x53, + 0x5b, 0xa4, 0x4b, 0xc4, 0xa2, 0x80, 0x10, 0x95, 0x10, 0x54, 0x46, 0x62, 0xc1, 0xa6, 0x72, 0xdc, + 0x69, 0x6b, 0x91, 0xda, 0x56, 0xec, 0x06, 0xf5, 0x26, 0x9c, 0x81, 0x93, 0xb0, 0xe4, 0x08, 0xa8, + 0xdc, 0x80, 0x13, 0xa0, 0x24, 0x4a, 0xe8, 0x53, 0xbb, 0xcb, 0xcc, 0xf7, 0x33, 0x33, 0x5f, 0x8c, + 0x9e, 0x94, 0x29, 0x15, 0x5a, 0x39, 0x2e, 0x15, 0x14, 0x74, 0x53, 0x18, 0x41, 0xdd, 0xc1, 0x80, + 0x25, 0xa6, 0xd0, 0x4e, 0xe3, 0xfb, 0x0a, 0x34, 0x59, 0x5b, 0x52, 0xa6, 0xa4, 0x63, 0x85, 0x61, + 0x99, 0x52, 0x05, 0x6e, 0xc7, 0xcd, 0x99, 0x20, 0x0c, 0xca, 0x94, 0x16, 0xb0, 0xb6, 0x67, 0xc8, + 0xb3, 0xbf, 0x3d, 0xe4, 0xbf, 0x6e, 0x3d, 0xf0, 0x73, 0x34, 0x28, 0xa1, 0xb0, 0x52, 0xab, 0xc0, + 0x8b, 0xbd, 0x64, 0x94, 0x3e, 0x22, 0xff, 0x47, 0x55, 0x06, 0xe4, 0x73, 0x03, 0xb3, 0x96, 0x87, + 0x53, 0x34, 0xd4, 0xdf, 0x14, 0x14, 0x4b, 0xb9, 0x0a, 0x7a, 0x97, 0x35, 0x1f, 0x2b, 0x7c, 0xfe, + 0x86, 0x0d, 0x6a, 0xe2, 0x7c, 0x85, 0x1f, 0xa0, 0x2b, 0xa5, 0x95, 0x80, 0xa0, 0x1f, 0x7b, 0xc9, + 0x1d, 0xd6, 0x14, 0xf8, 0x31, 0xf2, 0x33, 0x6e, 0xa5, 0x58, 0x72, 0x91, 0x07, 0xb7, 0x63, 0x2f, + 0xb9, 0xcb, 0x86, 0x75, 0x63, 0x26, 0x72, 0xfc, 0x0e, 0x21, 0xee, 0x5c, 0x21, 0xb3, 0xbd, 0x03, + 0x1b, 0x5c, 0xc5, 0xfd, 0x64, 0x94, 0x26, 0xe4, 0x42, 0x0e, 0xa4, 0xbb, 0x86, 0xcc, 0x5a, 0x01, + 0x3b, 0xd1, 0xe2, 0xf7, 0x68, 0x6c, 0x72, 0x2e, 0x60, 0x07, 0xca, 0x2d, 0x8d, 0xce, 0xa5, 0x38, + 0x04, 0xd7, 0xf5, 0xe2, 0x4f, 0x4f, 0xfc, 0x9a, 0x24, 0xc9, 0xa2, 0x65, 0x2e, 0x6a, 0x22, 0xbb, + 0x67, 0x6e, 0x36, 0xc2, 0x29, 0xf2, 0xbb, 0x31, 0x78, 0x8c, 0xfa, 0x5f, 0xe1, 0x50, 0x47, 0xe7, + 0xb3, 0xea, 0xb3, 0xba, 0xb4, 0xe4, 0xf9, 0x1e, 0xea, 0x68, 0x7c, 0xd6, 0x14, 0xaf, 0xb6, 0x3f, + 0x8f, 0x91, 0xf7, 0xeb, 0x18, 0x79, 0xbf, 0x8f, 0x91, 0xf7, 0xfd, 0x4f, 0x74, 0xeb, 0xcb, 0xcb, + 0x8d, 0x74, 0xdb, 0x7d, 0x46, 0x84, 0xde, 0x51, 0x65, 0x8d, 0x10, 0x93, 0x15, 0x94, 0x54, 0x81, + 0x5e, 0xdb, 0x09, 0x37, 0x72, 0xb2, 0xd1, 0xf4, 0xec, 0x49, 0xbc, 0xe8, 0xca, 0x1f, 0xbd, 0x87, + 0x1f, 0x40, 0xbf, 0xfd, 0x44, 0x66, 0x8b, 0x79, 0xb5, 0x7c, 0x17, 0x41, 0x76, 0x5d, 0xff, 0xe5, + 0xe9, 0xbf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x57, 0x93, 0x14, 0xb3, 0x51, 0x02, 0x00, 0x00, } func (m *Container) Marshal() (dAtA []byte, err error) { @@ -517,7 +515,7 @@ func (m *Container) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.OwnerId == nil { - m.OwnerId = &grpc1.OwnerID{} + m.OwnerId = &grpc.OwnerID{} } if err := m.OwnerId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -640,7 +638,7 @@ func (m *Container) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.PlacementPolicy == nil { - m.PlacementPolicy = &grpc2.PlacementPolicy{} + m.PlacementPolicy = &grpc1.PlacementPolicy{} } if err := m.PlacementPolicy.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err diff --git a/v2/object/grpc/service.pb.go b/v2/object/grpc/service.pb.go index 4b3964d..2c8fc74 100644 --- a/v2/object/grpc/service.pb.go +++ b/v2/object/grpc/service.pb.go @@ -8,7 +8,7 @@ import ( fmt "fmt" proto "github.com/golang/protobuf/proto" grpc1 "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" - grpc "github.com/nspcc-dev/neofs-api-go/v2/service/grpc" + grpc "github.com/nspcc-dev/neofs-api-go/v2/session/grpc" grpc2 "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" @@ -323,7 +323,7 @@ type GetResponse_Body_Init struct { // Object ID ObjectId *grpc1.ObjectID `protobuf:"bytes,1,opt,name=object_id,json=objectId,proto3" json:"object_id,omitempty"` // Object signature - Signature *grpc.Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` + Signature *grpc1.Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` // Object header. Header *Header `protobuf:"bytes,3,opt,name=header,proto3" json:"header,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` @@ -371,7 +371,7 @@ func (m *GetResponse_Body_Init) GetObjectId() *grpc1.ObjectID { return nil } -func (m *GetResponse_Body_Init) GetSignature() *grpc.Signature { +func (m *GetResponse_Body_Init) GetSignature() *grpc1.Signature { if m != nil { return m.Signature } @@ -550,7 +550,7 @@ type PutRequest_Body_Init struct { // Object ID, where available ObjectId *grpc1.ObjectID `protobuf:"bytes,1,opt,name=object_id,json=objectId,proto3" json:"object_id,omitempty"` // Object signature, were available - Signature *grpc.Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` + Signature *grpc1.Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` // Header of the object to save in the system. Header *Header `protobuf:"bytes,3,opt,name=header,proto3" json:"header,omitempty"` // Number of the object copies to store within the RPC call. @@ -602,7 +602,7 @@ func (m *PutRequest_Body_Init) GetObjectId() *grpc1.ObjectID { return nil } -func (m *PutRequest_Body_Init) GetSignature() *grpc.Signature { +func (m *PutRequest_Body_Init) GetSignature() *grpc1.Signature { if m != nil { return m.Signature } @@ -1973,10 +1973,12 @@ type GetRangeHashRequest_Body struct { // Carries the list of object payload range to calculate homomorphic hash. Ranges []*Range `protobuf:"bytes,2,rep,name=ranges,proto3" json:"ranges,omitempty"` // Carries binary salt to XOR object payload ranges before hash calculation. - Salt []byte `protobuf:"bytes,3,opt,name=salt,proto3" json:"salt,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Salt []byte `protobuf:"bytes,3,opt,name=salt,proto3" json:"salt,omitempty"` + // Checksum algorithm type + Type grpc1.ChecksumType `protobuf:"varint,4,opt,name=type,proto3,enum=neo.fs.v2.refs.ChecksumType" json:"type,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetRangeHashRequest_Body) Reset() { *m = GetRangeHashRequest_Body{} } @@ -2033,6 +2035,13 @@ func (m *GetRangeHashRequest_Body) GetSalt() []byte { return nil } +func (m *GetRangeHashRequest_Body) GetType() grpc1.ChecksumType { + if m != nil { + return m.Type + } + return grpc1.ChecksumType_CHECKSUM_TYPE_UNSPECIFIED +} + // Get hash of object's payload part type GetRangeHashResponse struct { // Body of get range hash object response message. @@ -2105,8 +2114,10 @@ func (m *GetRangeHashResponse) GetVerifyHeader() *grpc.ResponseVerificationHeade // Response body type GetRangeHashResponse_Body struct { - // Carries list of homomorphic hashes in a binary format. - HashList [][]byte `protobuf:"bytes,1,rep,name=hash_list,json=hashList,proto3" json:"hash_list,omitempty"` + // Checksum algorithm type + Type grpc1.ChecksumType `protobuf:"varint,1,opt,name=type,proto3,enum=neo.fs.v2.refs.ChecksumType" json:"type,omitempty"` + // List of range hashes in a binary format. + HashList [][]byte `protobuf:"bytes,2,rep,name=hash_list,json=hashList,proto3" json:"hash_list,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -2145,6 +2156,13 @@ func (m *GetRangeHashResponse_Body) XXX_DiscardUnknown() { var xxx_messageInfo_GetRangeHashResponse_Body proto.InternalMessageInfo +func (m *GetRangeHashResponse_Body) GetType() grpc1.ChecksumType { + if m != nil { + return m.Type + } + return grpc1.ChecksumType_CHECKSUM_TYPE_UNSPECIFIED +} + func (m *GetRangeHashResponse_Body) GetHashList() [][]byte { if m != nil { return m.HashList @@ -2190,84 +2208,87 @@ func init() { func init() { proto.RegisterFile("v2/object/grpc/service.proto", fileDescriptor_1d7d92b1e85e5b48) } var fileDescriptor_1d7d92b1e85e5b48 = []byte{ - // 1231 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x58, 0x5d, 0x6f, 0x1b, 0x45, - 0x17, 0xce, 0xae, 0x37, 0x4e, 0x7c, 0x6c, 0xe7, 0x8d, 0xa6, 0x51, 0x6b, 0x39, 0x1f, 0x6f, 0xba, - 0x69, 0xd2, 0x88, 0x92, 0x75, 0x30, 0x2a, 0xa1, 0x29, 0x2d, 0x6a, 0x48, 0xd2, 0x58, 0x25, 0x6d, - 0x58, 0x23, 0x2e, 0x90, 0x90, 0xb5, 0x59, 0x8f, 0xed, 0x05, 0x7b, 0xd7, 0xec, 0x8c, 0x8d, 0x7c, - 0xc3, 0x25, 0x12, 0xbf, 0x80, 0x8a, 0x8b, 0x0a, 0x71, 0x59, 0xee, 0xf8, 0x01, 0x5c, 0xc3, 0x5d, - 0xf9, 0x07, 0x28, 0xdc, 0x22, 0xf5, 0x17, 0x80, 0xd0, 0x7c, 0xac, 0xed, 0x8d, 0x3f, 0x95, 0xbb, - 0xe5, 0x6e, 0x66, 0xfc, 0x9c, 0xe3, 0x39, 0xcf, 0x3c, 0x73, 0xe6, 0x9c, 0x85, 0x95, 0x76, 0x3e, - 0xe7, 0x9d, 0x7f, 0x8e, 0x6d, 0x9a, 0xab, 0xfa, 0x4d, 0x3b, 0x47, 0xb0, 0xdf, 0x76, 0x6c, 0x6c, - 0x34, 0x7d, 0x8f, 0x7a, 0x68, 0xd1, 0xc5, 0x9e, 0x51, 0x21, 0x46, 0x3b, 0x6f, 0x08, 0x50, 0x36, - 0x7b, 0x09, 0x4f, 0x3b, 0x4d, 0x4c, 0x04, 0x3a, 0x9b, 0x69, 0xe7, 0x73, 0x3e, 0xae, 0x90, 0xc1, - 0x5f, 0x96, 0xdb, 0xf9, 0xc0, 0xf3, 0xc0, 0x8f, 0xfa, 0x4b, 0x15, 0xe0, 0x31, 0xa6, 0x26, 0xfe, - 0xb2, 0x85, 0x09, 0x45, 0x77, 0x41, 0x3b, 0xf7, 0xca, 0x9d, 0x8c, 0xb2, 0xae, 0x6c, 0x27, 0xf3, - 0x37, 0x8d, 0xcb, 0x5b, 0x30, 0x7a, 0x58, 0xe3, 0xc0, 0x2b, 0x77, 0x4c, 0x0e, 0x47, 0x47, 0x90, - 0x6c, 0x60, 0x6a, 0x95, 0x6a, 0xd8, 0x2a, 0x63, 0x3f, 0xa3, 0x72, 0xeb, 0x5b, 0x7d, 0xd6, 0x41, - 0x64, 0xd2, 0xf6, 0x14, 0x53, 0xeb, 0x84, 0x63, 0x4d, 0x68, 0x74, 0xc7, 0xe8, 0x23, 0x48, 0xb7, - 0xb1, 0xef, 0x54, 0x3a, 0x81, 0xa3, 0x18, 0x77, 0xf4, 0xe6, 0x68, 0x47, 0x9f, 0x30, 0xb8, 0x63, - 0x5b, 0xd4, 0xf1, 0x5c, 0xe9, 0x30, 0x25, 0x5c, 0x88, 0x59, 0xf6, 0x09, 0x68, 0x6c, 0x9f, 0xe8, - 0x2d, 0x98, 0xb3, 0xca, 0x65, 0x1f, 0x13, 0x22, 0x63, 0xbb, 0xd1, 0xe7, 0x94, 0xf1, 0x66, 0x3c, - 0x12, 0x3f, 0x9b, 0x01, 0x0e, 0x2d, 0x42, 0xcc, 0xb7, 0xbe, 0xe2, 0xc1, 0xcc, 0x9b, 0x6c, 0xa8, - 0xff, 0x13, 0x83, 0x24, 0x27, 0x80, 0x34, 0x3d, 0x97, 0x60, 0xf4, 0x4e, 0x88, 0x2d, 0x7d, 0x04, - 0x5b, 0x02, 0xdc, 0x4f, 0xd7, 0xf1, 0x30, 0xba, 0x36, 0x87, 0x46, 0x29, 0x8c, 0x47, 0xf0, 0x65, - 0x0e, 0xe7, 0x6b, 0x67, 0x8c, 0xa7, 0x89, 0x84, 0x7d, 0xaf, 0x4a, 0xc6, 0x1e, 0x80, 0xe6, 0xb8, - 0x0e, 0x95, 0xc1, 0xdd, 0x9e, 0x1c, 0x9c, 0x51, 0x70, 0x1d, 0x7a, 0x32, 0x63, 0x72, 0x33, 0x74, - 0x1d, 0x66, 0xed, 0x5a, 0xcb, 0xfd, 0x82, 0x47, 0x97, 0x3a, 0x99, 0x31, 0xc5, 0x34, 0xfb, 0x93, - 0x02, 0x1a, 0x03, 0xa2, 0xbb, 0x90, 0x10, 0x8e, 0x4a, 0x4e, 0x59, 0xfe, 0x49, 0xe6, 0xf2, 0x99, - 0x3c, 0xe3, 0x80, 0xc2, 0xa1, 0x39, 0x2f, 0xa0, 0x85, 0x32, 0xda, 0x87, 0x04, 0x71, 0xaa, 0xae, - 0x45, 0x5b, 0x3e, 0x96, 0xcc, 0xad, 0x0c, 0x89, 0xb7, 0x18, 0x60, 0xcc, 0x1e, 0x1c, 0xed, 0x42, - 0x3c, 0x44, 0x54, 0x66, 0x30, 0x28, 0xc9, 0x89, 0xc4, 0x1d, 0xa4, 0x21, 0x29, 0x37, 0xd9, 0xb4, - 0x7c, 0xaa, 0xbf, 0xd0, 0x00, 0xce, 0x5a, 0xd3, 0xdf, 0x96, 0x1e, 0x36, 0x1a, 0xb7, 0xe5, 0x97, - 0xe0, 0xf0, 0xdf, 0x0b, 0x1d, 0xfe, 0xd6, 0xc4, 0xc8, 0xa6, 0x3b, 0xfb, 0x57, 0x51, 0x3a, 0x7b, - 0xb4, 0x01, 0x69, 0xdb, 0x6b, 0x3a, 0x98, 0x94, 0xdc, 0x56, 0xe3, 0x1c, 0xfb, 0x19, 0x6d, 0x5d, - 0xd9, 0x4e, 0x9b, 0x29, 0xb1, 0xf8, 0x94, 0xaf, 0x5d, 0x16, 0xc8, 0x0f, 0x2a, 0x24, 0x39, 0x35, - 0xd3, 0x66, 0x88, 0x3e, 0x70, 0x54, 0x32, 0xc4, 0x03, 0xa9, 0x91, 0xab, 0x1d, 0xa2, 0xfe, 0x42, - 0x85, 0xf4, 0x21, 0xae, 0x63, 0x8a, 0x83, 0x6b, 0xf4, 0x6e, 0x88, 0xa4, 0x5b, 0x83, 0x24, 0x85, - 0xe0, 0xd1, 0xb8, 0x49, 0xf7, 0xae, 0xfc, 0xee, 0xe8, 0xaf, 0x15, 0x58, 0x08, 0x22, 0x96, 0x32, - 0xba, 0x17, 0x62, 0x68, 0x73, 0x34, 0x43, 0xd1, 0x52, 0x52, 0x5c, 0x90, 0xa4, 0xff, 0xa6, 0x42, - 0x92, 0x2d, 0x05, 0x82, 0x98, 0x78, 0x6b, 0xfa, 0xc0, 0xd1, 0x90, 0x43, 0xed, 0xea, 0x65, 0xc8, - 0x32, 0x24, 0x1a, 0x96, 0xe3, 0x96, 0x3c, 0xb7, 0xde, 0x91, 0xc5, 0xc8, 0x3c, 0x5b, 0x78, 0xe6, - 0xd6, 0x3b, 0x41, 0x8d, 0x12, 0xeb, 0xd5, 0x28, 0x7f, 0xa9, 0x90, 0x12, 0xf4, 0x48, 0xed, 0xec, - 0x85, 0xc8, 0xdc, 0x18, 0x45, 0x66, 0xb4, 0x94, 0xf3, 0x8d, 0x22, 0x09, 0xcd, 0x77, 0xd3, 0xba, - 0x32, 0x3e, 0xad, 0x9f, 0xcc, 0x74, 0x13, 0xfb, 0x01, 0xa4, 0x48, 0xcd, 0xf3, 0x69, 0x38, 0xb2, - 0xd5, 0x41, 0xcb, 0x22, 0x43, 0x75, 0xcd, 0x93, 0xa4, 0x37, 0x3d, 0x88, 0x83, 0xc6, 0xac, 0xf5, - 0xbf, 0x63, 0x90, 0x2e, 0x62, 0xcb, 0xb7, 0x6b, 0x53, 0x67, 0xb3, 0x10, 0x3c, 0x1a, 0xf2, 0xfd, - 0x2e, 0xa8, 0x0b, 0x1e, 0x42, 0xca, 0xf6, 0x5c, 0x6a, 0x39, 0x2e, 0xf6, 0x7b, 0x69, 0x7f, 0xf9, - 0xb2, 0x88, 0x3f, 0x08, 0x30, 0x85, 0x43, 0x33, 0xd9, 0x35, 0x28, 0x94, 0x51, 0x06, 0xe6, 0xda, - 0xd8, 0x27, 0x8e, 0xe7, 0xf2, 0xf0, 0xd2, 0x66, 0x30, 0x45, 0x47, 0x30, 0x57, 0x71, 0xea, 0x14, - 0xfb, 0x24, 0x13, 0x5b, 0x8f, 0x6d, 0x27, 0xf3, 0x77, 0xa6, 0x61, 0xce, 0x38, 0xe6, 0x36, 0x66, - 0x60, 0x9b, 0x75, 0x21, 0x2e, 0x96, 0xd0, 0x3e, 0x40, 0xc3, 0xa2, 0x76, 0xad, 0xc4, 0xda, 0x1d, - 0xbe, 0xd1, 0x85, 0xd0, 0x46, 0xa5, 0xcf, 0x53, 0x86, 0xf9, 0xb8, 0xd3, 0xc4, 0x66, 0xa2, 0x11, - 0x0c, 0x11, 0x02, 0xcd, 0xb5, 0x1a, 0xa2, 0xc6, 0x48, 0x98, 0x7c, 0x8c, 0x96, 0x60, 0xb6, 0x6d, - 0xd5, 0x5b, 0x98, 0xd3, 0x99, 0x30, 0xc5, 0x44, 0xff, 0x51, 0x85, 0x85, 0x60, 0x5b, 0xd3, 0x26, - 0xeb, 0x30, 0x3e, 0x2a, 0x57, 0xae, 0xef, 0x45, 0x73, 0xca, 0xa5, 0xba, 0x43, 0x58, 0x75, 0x18, - 0x1b, 0xfb, 0xe8, 0xc7, 0x9d, 0xf2, 0x87, 0x0e, 0xa1, 0xfa, 0x1e, 0xcc, 0x9a, 0x96, 0x5b, 0xc5, - 0xe8, 0x3a, 0xc4, 0xbd, 0x4a, 0x85, 0x60, 0x51, 0x58, 0x6a, 0xa6, 0x9c, 0xb1, 0xf5, 0x3a, 0x76, - 0xab, 0xb4, 0xc6, 0x43, 0xd6, 0x4c, 0x39, 0xd3, 0x7f, 0x57, 0xe1, 0x7f, 0xac, 0xcd, 0x60, 0xc6, - 0xc1, 0xfd, 0xda, 0x0f, 0xd1, 0xbb, 0x35, 0xbc, 0x2f, 0xe9, 0x33, 0xf8, 0xcf, 0x3f, 0x10, 0x3b, - 0x30, 0xeb, 0xb3, 0x78, 0x65, 0x38, 0x37, 0x06, 0x19, 0x11, 0x74, 0x08, 0x94, 0xfe, 0xad, 0x0a, - 0x8b, 0x3d, 0x8a, 0xa4, 0x66, 0xef, 0x87, 0x48, 0xbd, 0x3d, 0x8e, 0xd4, 0x68, 0xa9, 0x76, 0x45, - 0xf2, 0xba, 0x14, 0xb4, 0x24, 0x2c, 0xc2, 0x94, 0x6c, 0x48, 0xf4, 0xd7, 0x2a, 0x5c, 0x0b, 0x22, - 0x3b, 0xb1, 0x48, 0x37, 0x87, 0x3f, 0x0c, 0xd1, 0xf1, 0xc6, 0x68, 0x3a, 0xfa, 0x8c, 0xa2, 0xa1, - 0xb3, 0xaf, 0xaf, 0xae, 0xb3, 0x1c, 0xc4, 0xb9, 0x82, 0x48, 0x46, 0xe5, 0xf7, 0x7e, 0xa4, 0xd0, - 0x24, 0x8c, 0x65, 0x51, 0x62, 0xd5, 0x29, 0xdf, 0x75, 0xca, 0xe4, 0x63, 0xfd, 0xb9, 0x0a, 0x4b, - 0x61, 0xf2, 0xa4, 0x02, 0xdf, 0x0f, 0x51, 0x7e, 0x67, 0x12, 0xe5, 0xd1, 0x52, 0xe1, 0x86, 0x64, - 0x7d, 0x19, 0x12, 0x35, 0x8b, 0xd4, 0x7a, 0xd9, 0x33, 0x65, 0xce, 0xb3, 0x05, 0x96, 0x25, 0xf3, - 0x3f, 0x6b, 0x90, 0x16, 0xa9, 0xb3, 0x28, 0xfc, 0xa3, 0x43, 0x88, 0x3d, 0xc6, 0x14, 0xad, 0x8c, - 0xfb, 0x0c, 0x97, 0x5d, 0x1d, 0xfb, 0x65, 0x66, 0x57, 0x61, 0x5e, 0xce, 0x5a, 0x43, 0xbd, 0xf4, - 0x9a, 0xf8, 0x61, 0x5e, 0xfa, 0x5a, 0xd3, 0x6d, 0x05, 0x3d, 0x81, 0xb8, 0x68, 0x32, 0xd0, 0xff, - 0x27, 0x34, 0x68, 0xd9, 0xf5, 0x49, 0xfd, 0x09, 0x3a, 0x02, 0x8d, 0x31, 0x83, 0x56, 0xc7, 0x96, - 0xf6, 0xd9, 0xb5, 0xf1, 0xc5, 0x2a, 0x3a, 0x85, 0xb8, 0x78, 0x4b, 0x87, 0xed, 0x29, 0x54, 0x2c, - 0x0c, 0xdb, 0x53, 0xf8, 0x19, 0xde, 0x55, 0x50, 0x11, 0xe6, 0x03, 0x91, 0xa1, 0x9b, 0x13, 0xdf, - 0x95, 0xac, 0x3e, 0x39, 0x4b, 0xee, 0x2a, 0xe8, 0x33, 0x48, 0xf5, 0x2b, 0x17, 0x6d, 0x4e, 0x95, - 0x4c, 0xb2, 0x5b, 0xd3, 0x5d, 0x80, 0x83, 0xd2, 0xaf, 0x17, 0x6b, 0xca, 0xab, 0x8b, 0x35, 0xe5, - 0x8f, 0x8b, 0x35, 0xe5, 0xf9, 0x9f, 0x6b, 0x33, 0x9f, 0xee, 0x55, 0x1d, 0x5a, 0x6b, 0x9d, 0x1b, - 0xb6, 0xd7, 0xc8, 0xb9, 0xa4, 0x69, 0xdb, 0x3b, 0x65, 0xdc, 0xce, 0xb9, 0xd8, 0xab, 0x90, 0x1d, - 0xab, 0xe9, 0xec, 0x54, 0xbd, 0x5c, 0xf8, 0x33, 0xf2, 0x7d, 0x31, 0x7e, 0xa9, 0x5e, 0x7b, 0x8a, - 0xbd, 0xe3, 0xa2, 0xf1, 0xe8, 0xac, 0xc0, 0xfe, 0x55, 0x48, 0xf1, 0x3c, 0xce, 0xbf, 0x13, 0xbf, - 0xfd, 0x6f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x11, 0xd3, 0xc8, 0xed, 0xac, 0x16, 0x00, 0x00, + // 1267 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x58, 0xdd, 0x6e, 0x1b, 0xc5, + 0x17, 0xcf, 0xae, 0x37, 0x6e, 0x7c, 0x6c, 0xe7, 0x1f, 0x4d, 0xa3, 0xd6, 0x7f, 0xe7, 0x83, 0x74, + 0xdb, 0xa4, 0x11, 0x25, 0xeb, 0x60, 0x54, 0x42, 0x5b, 0x5a, 0xd4, 0x90, 0xa4, 0xb1, 0x4a, 0xda, + 0xb0, 0x06, 0x2e, 0x90, 0x90, 0xb5, 0x59, 0x8f, 0xed, 0xa5, 0xf6, 0xae, 0xd9, 0x19, 0x1b, 0xf9, + 0x05, 0x90, 0x78, 0x02, 0x90, 0x90, 0x10, 0xea, 0x15, 0xea, 0x15, 0xe2, 0x96, 0x17, 0x00, 0x24, + 0x24, 0x78, 0x03, 0x14, 0x6e, 0x91, 0x78, 0x00, 0x84, 0x84, 0xe6, 0x63, 0x6d, 0xaf, 0xbf, 0x95, + 0xbb, 0xe5, 0x6e, 0x66, 0xf6, 0x77, 0xce, 0xce, 0xf9, 0xcd, 0x6f, 0xce, 0x9c, 0x19, 0x58, 0x6d, + 0xe7, 0x73, 0xde, 0xd9, 0xc7, 0xd8, 0xa6, 0xb9, 0xaa, 0xdf, 0xb4, 0x73, 0x04, 0xfb, 0x6d, 0xc7, + 0xc6, 0x46, 0xd3, 0xf7, 0xa8, 0x87, 0x96, 0x5c, 0xec, 0x19, 0x15, 0x62, 0xb4, 0xf3, 0x86, 0x00, + 0x65, 0xb3, 0x03, 0x78, 0xda, 0x69, 0x62, 0x22, 0xd0, 0xd9, 0x4c, 0x3b, 0x9f, 0xf3, 0x71, 0x85, + 0x0c, 0x7f, 0x59, 0x69, 0xe7, 0x73, 0x04, 0x13, 0xe2, 0x78, 0xee, 0xd0, 0x47, 0xfd, 0x85, 0x0a, + 0xf0, 0x08, 0x53, 0x13, 0x7f, 0xd2, 0xc2, 0x84, 0xa2, 0xdb, 0xa0, 0x9d, 0x79, 0xe5, 0x4e, 0x46, + 0xd9, 0x50, 0xb6, 0x93, 0xf9, 0x6b, 0xc6, 0xe0, 0x14, 0x8c, 0x1e, 0xd6, 0xd8, 0xf7, 0xca, 0x1d, + 0x93, 0xc3, 0xd1, 0x21, 0x24, 0x1b, 0x98, 0x5a, 0xa5, 0x1a, 0xb6, 0xca, 0xd8, 0xcf, 0xa8, 0xdc, + 0xfa, 0x46, 0x9f, 0xb5, 0xfc, 0xbf, 0x21, 0x6d, 0x4f, 0x30, 0xb5, 0x8e, 0x39, 0xd6, 0x84, 0x46, + 0xb7, 0x8d, 0xde, 0x85, 0x74, 0x1b, 0xfb, 0x4e, 0xa5, 0x13, 0x38, 0x8a, 0x71, 0x47, 0xaf, 0x8c, + 0x77, 0xf4, 0x01, 0x83, 0x3b, 0xb6, 0x45, 0x1d, 0xcf, 0x95, 0x0e, 0x53, 0xc2, 0x85, 0xe8, 0x65, + 0x1f, 0x83, 0xc6, 0xe6, 0x89, 0x5e, 0x85, 0x4b, 0x56, 0xb9, 0xec, 0x63, 0x42, 0x64, 0x6c, 0x57, + 0xfb, 0x9c, 0x32, 0xde, 0x8c, 0x87, 0xe2, 0xb3, 0x19, 0xe0, 0xd0, 0x12, 0xc4, 0x7c, 0xeb, 0x53, + 0x1e, 0xcc, 0x82, 0xc9, 0x9a, 0xfa, 0xdf, 0x31, 0x48, 0x72, 0x02, 0x48, 0xd3, 0x73, 0x09, 0x46, + 0xaf, 0x87, 0xd8, 0xd2, 0xc7, 0xb0, 0x25, 0xc0, 0xfd, 0x74, 0x1d, 0x8d, 0xa2, 0x6b, 0x73, 0x64, + 0x94, 0xc2, 0x78, 0x0c, 0x5f, 0xe6, 0x68, 0xbe, 0x76, 0x26, 0x78, 0x9a, 0x4a, 0xd8, 0x17, 0xaa, + 0x64, 0xec, 0x3e, 0x68, 0x8e, 0xeb, 0x50, 0x19, 0xdc, 0xcd, 0xe9, 0xc1, 0x19, 0x05, 0xd7, 0xa1, + 0xc7, 0x73, 0x26, 0x37, 0x43, 0x57, 0x60, 0xde, 0xae, 0xb5, 0xdc, 0x67, 0x3c, 0xba, 0xd4, 0xf1, + 0x9c, 0x29, 0xba, 0xd9, 0x6f, 0x15, 0xd0, 0x18, 0x10, 0xdd, 0x86, 0x84, 0x70, 0x54, 0x72, 0xca, + 0xf2, 0x27, 0x99, 0xc1, 0x35, 0x79, 0xca, 0x01, 0x85, 0x03, 0x73, 0x41, 0x40, 0x0b, 0x65, 0xb4, + 0x07, 0x09, 0xe2, 0x54, 0x5d, 0x8b, 0xb6, 0x7c, 0x2c, 0x99, 0xfb, 0xff, 0xa0, 0x59, 0x31, 0x00, + 0x98, 0x3d, 0x2c, 0xda, 0x85, 0x78, 0x88, 0xa5, 0xcc, 0x70, 0x44, 0x92, 0x10, 0x89, 0xdb, 0x4f, + 0x43, 0x52, 0xce, 0xb0, 0x69, 0xf9, 0x54, 0xff, 0x4a, 0x03, 0x38, 0x6d, 0xcd, 0xbe, 0x55, 0x7a, + 0xd8, 0x68, 0x6c, 0x95, 0x1f, 0x82, 0x95, 0x7f, 0x33, 0xb4, 0xf2, 0x5b, 0x53, 0x23, 0x9b, 0x6d, + 0xe1, 0x7f, 0x89, 0xcc, 0xc2, 0xa3, 0xeb, 0x90, 0xb6, 0xbd, 0xa6, 0x83, 0x49, 0xc9, 0x6d, 0x35, + 0xce, 0xb0, 0x9f, 0xd1, 0x36, 0x94, 0xed, 0xb4, 0x99, 0x12, 0x83, 0x4f, 0xf8, 0xd8, 0xa0, 0x3a, + 0xbe, 0x51, 0x21, 0xc9, 0x79, 0x99, 0x35, 0x37, 0xf4, 0x81, 0xa3, 0x92, 0x1b, 0xee, 0x4b, 0x81, + 0x5c, 0x6c, 0x05, 0xf5, 0xaf, 0x55, 0x48, 0x1f, 0xe0, 0x3a, 0xa6, 0x38, 0xd8, 0x43, 0x6f, 0x84, + 0x48, 0xba, 0x31, 0x4c, 0x52, 0x08, 0x1e, 0x8d, 0x6d, 0x74, 0xe7, 0xc2, 0x27, 0x8e, 0xfe, 0x97, + 0x02, 0x8b, 0x41, 0xc4, 0x52, 0x46, 0x77, 0x42, 0x0c, 0x6d, 0x8e, 0x67, 0x28, 0x5a, 0x4a, 0x8a, + 0x0b, 0x92, 0xf4, 0x9f, 0x54, 0x48, 0xb2, 0xa1, 0x40, 0x10, 0x53, 0x77, 0x4d, 0x1f, 0x38, 0x1a, + 0x72, 0xa8, 0x5d, 0xbc, 0x00, 0x59, 0x81, 0x44, 0xc3, 0x72, 0xdc, 0x92, 0xe7, 0xd6, 0x3b, 0xb2, + 0x0c, 0x59, 0x60, 0x03, 0x4f, 0xdd, 0x7a, 0x27, 0xa8, 0x4e, 0x62, 0xbd, 0xea, 0xe4, 0x4f, 0x15, + 0x52, 0x82, 0x1e, 0xa9, 0x9d, 0xbd, 0x10, 0x99, 0xd7, 0xc7, 0x91, 0x19, 0x2d, 0xe5, 0x7c, 0xa6, + 0x48, 0x42, 0xf3, 0xdd, 0xb4, 0xae, 0x4c, 0x4e, 0xeb, 0xc7, 0x73, 0xdd, 0xc4, 0xbe, 0x0f, 0x29, + 0x52, 0xf3, 0x7c, 0x1a, 0x8e, 0x6c, 0x6d, 0xd8, 0xb2, 0xc8, 0x50, 0x5d, 0xf3, 0x24, 0xe9, 0x75, + 0xf7, 0xe3, 0xa0, 0x31, 0x6b, 0xfd, 0x9f, 0x18, 0xa4, 0x8b, 0xd8, 0xf2, 0xed, 0xda, 0xcc, 0xd9, + 0x2c, 0x04, 0x8f, 0x86, 0x7c, 0xbb, 0xe5, 0xe0, 0x03, 0x48, 0xd9, 0x9e, 0x4b, 0x2d, 0xc7, 0xc5, + 0x7e, 0x2f, 0xed, 0xaf, 0x0c, 0x8a, 0xf8, 0xed, 0x00, 0x53, 0x38, 0x30, 0x93, 0x5d, 0x83, 0x42, + 0x19, 0x65, 0xe0, 0x52, 0x1b, 0xfb, 0xec, 0xdf, 0x3c, 0xbc, 0xb4, 0x19, 0x74, 0xd1, 0x21, 0x5c, + 0xaa, 0x38, 0x75, 0x8a, 0x7d, 0x92, 0x89, 0x6d, 0xc4, 0xb6, 0x93, 0xf9, 0x5b, 0xb3, 0x30, 0x67, + 0x1c, 0x71, 0x1b, 0x33, 0xb0, 0xcd, 0xba, 0x10, 0x17, 0x43, 0xe8, 0x2e, 0x40, 0xc3, 0xa2, 0x76, + 0xad, 0xc4, 0x2e, 0x3a, 0x7c, 0xa2, 0x8b, 0xa1, 0x89, 0x4a, 0x9f, 0x27, 0x0c, 0xf3, 0x5e, 0xa7, + 0x89, 0xcd, 0x44, 0x23, 0x68, 0x22, 0x04, 0x9a, 0x6b, 0x35, 0x44, 0x81, 0x91, 0x30, 0x79, 0x1b, + 0x2d, 0xc3, 0x7c, 0xdb, 0xaa, 0xb7, 0x30, 0xa7, 0x33, 0x61, 0x8a, 0x8e, 0xfe, 0x5c, 0x85, 0xc5, + 0x60, 0x5a, 0xb3, 0x26, 0xeb, 0x30, 0x3e, 0x2a, 0x5b, 0xae, 0xef, 0x44, 0x73, 0xca, 0xa5, 0xba, + 0x43, 0x58, 0x69, 0x18, 0x9b, 0x78, 0xe8, 0xc7, 0x9d, 0xf2, 0x3b, 0x0e, 0xa1, 0xfa, 0x1e, 0xcc, + 0x9b, 0x96, 0x5b, 0xc5, 0xe8, 0x0a, 0xc4, 0xbd, 0x4a, 0x85, 0x60, 0x51, 0x55, 0x6a, 0xa6, 0xec, + 0xb1, 0xf1, 0x3a, 0x76, 0xab, 0xb4, 0xc6, 0x43, 0xd6, 0x4c, 0xd9, 0xd3, 0x7f, 0x53, 0xe1, 0x7f, + 0xec, 0x82, 0xc1, 0x8c, 0x83, 0xfd, 0x75, 0x37, 0x44, 0xef, 0xd6, 0xe8, 0x1b, 0x49, 0x9f, 0xc1, + 0x7f, 0xfe, 0x80, 0xd8, 0x81, 0x79, 0x9f, 0xc5, 0x2b, 0xc3, 0xb9, 0x3a, 0xcc, 0x88, 0xa0, 0x43, + 0xa0, 0xf4, 0xcf, 0x55, 0x58, 0xea, 0x51, 0x24, 0x35, 0x7b, 0x2f, 0x44, 0xea, 0xcd, 0x49, 0xa4, + 0x46, 0x4b, 0xb5, 0xab, 0x92, 0xd7, 0xe5, 0xe0, 0x3e, 0xc2, 0x22, 0x4c, 0xc9, 0xdb, 0x88, 0xfe, + 0x3c, 0x06, 0x97, 0x83, 0xc8, 0x8e, 0x2d, 0xd2, 0xcd, 0xe1, 0x0f, 0x42, 0x74, 0xbc, 0x3c, 0x9e, + 0x8e, 0x3e, 0xa3, 0x68, 0xe8, 0xec, 0x3b, 0xe5, 0xe2, 0x42, 0xcb, 0x41, 0x9c, 0x4b, 0x88, 0x64, + 0x54, 0xbe, 0xf1, 0xc7, 0x2a, 0x4d, 0xc2, 0x58, 0x1a, 0x25, 0x56, 0x9d, 0xf2, 0x69, 0xa7, 0x4c, + 0xde, 0x46, 0xbb, 0xa0, 0xf1, 0x84, 0xac, 0xf1, 0x84, 0xbc, 0x3a, 0x74, 0x72, 0xd4, 0xb0, 0xfd, + 0x8c, 0xb4, 0x1a, 0x3c, 0x23, 0x73, 0xa4, 0xfe, 0xb3, 0x0a, 0xcb, 0x61, 0xbe, 0xa5, 0x68, 0xdf, + 0x0a, 0xad, 0xd2, 0xad, 0x69, 0xab, 0x14, 0x2d, 0xe1, 0xbe, 0x2f, 0xd7, 0x29, 0xe0, 0x4b, 0x99, + 0x95, 0x2f, 0x56, 0x30, 0xd6, 0x2c, 0x52, 0x13, 0x29, 0x9a, 0xad, 0x54, 0xca, 0x5c, 0x60, 0x03, + 0x2c, 0x15, 0xe7, 0xbf, 0xd7, 0x20, 0x2d, 0xf2, 0x73, 0x51, 0x3c, 0x33, 0xa2, 0x03, 0x88, 0x3d, + 0xc2, 0x14, 0xad, 0x4e, 0x7a, 0xe5, 0xcb, 0xae, 0x4d, 0x7c, 0xf8, 0xd9, 0x55, 0x98, 0x97, 0xd3, + 0xd6, 0x48, 0x2f, 0xbd, 0x67, 0x82, 0x51, 0x5e, 0xfa, 0xee, 0xbf, 0xdb, 0x0a, 0x7a, 0x0c, 0x71, + 0x71, 0x93, 0x41, 0x2f, 0x4d, 0xb9, 0x05, 0x66, 0x37, 0xa6, 0x5d, 0x82, 0xd0, 0x21, 0x68, 0x8c, + 0x4b, 0xb4, 0x36, 0xf1, 0xfe, 0x90, 0x5d, 0x9f, 0x5c, 0x11, 0xa3, 0x13, 0x88, 0x8b, 0x03, 0x7b, + 0xd4, 0x9c, 0x42, 0x15, 0xc9, 0xa8, 0x39, 0x85, 0xcf, 0xfa, 0x5d, 0x05, 0x15, 0x61, 0x21, 0x90, + 0x25, 0xba, 0x36, 0xf5, 0xf0, 0xca, 0xea, 0xd3, 0x53, 0xf1, 0xae, 0x82, 0x3e, 0x82, 0x54, 0xbf, + 0xd6, 0xd1, 0xe6, 0x4c, 0x19, 0x2b, 0xbb, 0x35, 0xdb, 0x96, 0xd9, 0x2f, 0xfd, 0x78, 0xbe, 0xae, + 0xfc, 0x7a, 0xbe, 0xae, 0xfc, 0x7e, 0xbe, 0xae, 0x7c, 0xf9, 0xc7, 0xfa, 0xdc, 0x87, 0x7b, 0x55, + 0x87, 0xd6, 0x5a, 0x67, 0x86, 0xed, 0x35, 0x72, 0x2e, 0x69, 0xda, 0xf6, 0x4e, 0x19, 0xb7, 0x73, + 0x2e, 0xf6, 0x2a, 0x64, 0xc7, 0x6a, 0x3a, 0x3b, 0x55, 0x2f, 0x17, 0x7e, 0xa5, 0xbe, 0x27, 0xda, + 0x2f, 0xd4, 0xcb, 0x4f, 0xb0, 0x77, 0x54, 0x34, 0x1e, 0x9e, 0x16, 0xd8, 0x5f, 0x85, 0x14, 0xcf, + 0xe2, 0xfc, 0x19, 0xfa, 0xb5, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, 0xc2, 0x71, 0xb6, 0x54, 0x0b, + 0x17, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -4410,6 +4431,11 @@ func (m *GetRangeHashRequest_Body) MarshalToSizedBuffer(dAtA []byte) (int, error i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } + if m.Type != 0 { + i = encodeVarintService(dAtA, i, uint64(m.Type)) + i-- + dAtA[i] = 0x20 + } if len(m.Salt) > 0 { i -= len(m.Salt) copy(dAtA[i:], m.Salt) @@ -4539,9 +4565,14 @@ func (m *GetRangeHashResponse_Body) MarshalToSizedBuffer(dAtA []byte) (int, erro copy(dAtA[i:], m.HashList[iNdEx]) i = encodeVarintService(dAtA, i, uint64(len(m.HashList[iNdEx]))) i-- - dAtA[i] = 0xa + dAtA[i] = 0x12 } } + if m.Type != 0 { + i = encodeVarintService(dAtA, i, uint64(m.Type)) + i-- + dAtA[i] = 0x8 + } return len(dAtA) - i, nil } @@ -5261,6 +5292,9 @@ func (m *GetRangeHashRequest_Body) Size() (n int) { if l > 0 { n += 1 + l + sovService(uint64(l)) } + if m.Type != 0 { + n += 1 + sovService(uint64(m.Type)) + } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -5297,6 +5331,9 @@ func (m *GetRangeHashResponse_Body) Size() (n int) { } var l int _ = l + if m.Type != 0 { + n += 1 + sovService(uint64(m.Type)) + } if len(m.HashList) > 0 { for _, b := range m.HashList { l = len(b) @@ -5966,7 +6003,7 @@ func (m *GetResponse_Body_Init) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.Signature == nil { - m.Signature = &grpc.Signature{} + m.Signature = &grpc1.Signature{} } if err := m.Signature.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -6412,7 +6449,7 @@ func (m *PutRequest_Body_Init) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.Signature == nil { - m.Signature = &grpc.Signature{} + m.Signature = &grpc1.Signature{} } if err := m.Signature.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -9413,6 +9450,25 @@ func (m *GetRangeHashRequest_Body) Unmarshal(dAtA []byte) error { m.Salt = []byte{} } iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) + } + m.Type = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Type |= grpc1.ChecksumType(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipService(dAtA[iNdEx:]) @@ -9630,6 +9686,25 @@ func (m *GetRangeHashResponse_Body) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) + } + m.Type = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Type |= grpc1.ChecksumType(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field HashList", wireType) } diff --git a/v2/object/grpc/types.pb.go b/v2/object/grpc/types.pb.go index e616358..646ee2d 100644 --- a/v2/object/grpc/types.pb.go +++ b/v2/object/grpc/types.pb.go @@ -6,8 +6,8 @@ package object import ( fmt "fmt" proto "github.com/golang/protobuf/proto" - grpc1 "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" - grpc "github.com/nspcc-dev/neofs-api-go/v2/service/grpc" + grpc "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" + grpc1 "github.com/nspcc-dev/neofs-api-go/v2/session/grpc" io "io" math "math" math_bits "math/bits" @@ -91,7 +91,7 @@ type ShortHeader struct { // Epoch when the object was created CreationEpoch uint64 `protobuf:"varint,2,opt,name=creation_epoch,json=creationEpoch,proto3" json:"creation_epoch,omitempty"` // Object's owner - OwnerId *grpc1.OwnerID `protobuf:"bytes,3,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"` + OwnerId *grpc.OwnerID `protobuf:"bytes,3,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"` // Type of the object payload content ObjectType ObjectType `protobuf:"varint,4,opt,name=object_type,json=objectType,proto3,enum=neo.fs.v2.object.ObjectType" json:"object_type,omitempty"` // Size of payload in bytes. @@ -149,7 +149,7 @@ func (m *ShortHeader) GetCreationEpoch() uint64 { return 0 } -func (m *ShortHeader) GetOwnerId() *grpc1.OwnerID { +func (m *ShortHeader) GetOwnerId() *grpc.OwnerID { if m != nil { return m.OwnerId } @@ -176,23 +176,23 @@ type Header struct { // Effectively the version of API library used to create particular object Version *grpc.Version `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` // Object's container - ContainerId *grpc1.ContainerID `protobuf:"bytes,2,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` + ContainerId *grpc.ContainerID `protobuf:"bytes,2,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` // Object's owner - OwnerId *grpc1.OwnerID `protobuf:"bytes,3,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"` + OwnerId *grpc.OwnerID `protobuf:"bytes,3,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"` // Object creation Epoch CreationEpoch uint64 `protobuf:"varint,4,opt,name=creation_epoch,json=creationEpoch,proto3" json:"creation_epoch,omitempty"` // Size of payload in bytes. // 0xFFFFFFFFFFFFFFFF means `payload_length` is unknown PayloadLength uint64 `protobuf:"varint,5,opt,name=payload_length,json=payloadLength,proto3" json:"payload_length,omitempty"` // Hash of payload bytes - PayloadHash []byte `protobuf:"bytes,6,opt,name=payload_hash,json=payloadHash,proto3" json:"payload_hash,omitempty"` + PayloadHash *grpc.Checksum `protobuf:"bytes,6,opt,name=payload_hash,json=payloadHash,proto3" json:"payload_hash,omitempty"` // Special object type ObjectType ObjectType `protobuf:"varint,7,opt,name=object_type,json=objectType,proto3,enum=neo.fs.v2.object.ObjectType" json:"object_type,omitempty"` // Homomorphic hash of the object payload. - HomomorphicHash []byte `protobuf:"bytes,8,opt,name=homomorphic_hash,json=homomorphicHash,proto3" json:"homomorphic_hash,omitempty"` + HomomorphicHash *grpc.Checksum `protobuf:"bytes,8,opt,name=homomorphic_hash,json=homomorphicHash,proto3" json:"homomorphic_hash,omitempty"` // Session token, if it was used during Object creation. // Need it to verify integrity and authenticity out of Request scope. - SessionToken *grpc.SessionToken `protobuf:"bytes,9,opt,name=session_token,json=sessionToken,proto3" json:"session_token,omitempty"` + SessionToken *grpc1.SessionToken `protobuf:"bytes,9,opt,name=session_token,json=sessionToken,proto3" json:"session_token,omitempty"` // User-defined object attributes Attributes []*Header_Attribute `protobuf:"bytes,10,rep,name=attributes,proto3" json:"attributes,omitempty"` // Position of the object in the split hierarchy. @@ -242,14 +242,14 @@ func (m *Header) GetVersion() *grpc.Version { return nil } -func (m *Header) GetContainerId() *grpc1.ContainerID { +func (m *Header) GetContainerId() *grpc.ContainerID { if m != nil { return m.ContainerId } return nil } -func (m *Header) GetOwnerId() *grpc1.OwnerID { +func (m *Header) GetOwnerId() *grpc.OwnerID { if m != nil { return m.OwnerId } @@ -270,7 +270,7 @@ func (m *Header) GetPayloadLength() uint64 { return 0 } -func (m *Header) GetPayloadHash() []byte { +func (m *Header) GetPayloadHash() *grpc.Checksum { if m != nil { return m.PayloadHash } @@ -284,14 +284,14 @@ func (m *Header) GetObjectType() ObjectType { return ObjectType_REGULAR } -func (m *Header) GetHomomorphicHash() []byte { +func (m *Header) GetHomomorphicHash() *grpc.Checksum { if m != nil { return m.HomomorphicHash } return nil } -func (m *Header) GetSessionToken() *grpc.SessionToken { +func (m *Header) GetSessionToken() *grpc1.SessionToken { if m != nil { return m.SessionToken } @@ -375,18 +375,18 @@ type Header_Split struct { // Identifier of the origin object. // Parent and children objects must be within the same container. // Parent object_id is known only to the minor child. - Parent *grpc1.ObjectID `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"` + Parent *grpc.ObjectID `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"` // Previous carries identifier of the left split neighbor. - Previous *grpc1.ObjectID `protobuf:"bytes,2,opt,name=previous,proto3" json:"previous,omitempty"` + Previous *grpc.ObjectID `protobuf:"bytes,2,opt,name=previous,proto3" json:"previous,omitempty"` // `signature` field of the parent object. Used to reconstruct parent. ParentSignature *grpc.Signature `protobuf:"bytes,3,opt,name=parent_signature,json=parentSignature,proto3" json:"parent_signature,omitempty"` // `header` field of the parent object. Used to reconstruct parent. ParentHeader *Header `protobuf:"bytes,4,opt,name=parent_header,json=parentHeader,proto3" json:"parent_header,omitempty"` // Children carries list of identifiers of the objects generated by splitting the current. - Children []*grpc1.ObjectID `protobuf:"bytes,5,rep,name=children,proto3" json:"children,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Children []*grpc.ObjectID `protobuf:"bytes,5,rep,name=children,proto3" json:"children,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *Header_Split) Reset() { *m = Header_Split{} } @@ -422,14 +422,14 @@ func (m *Header_Split) XXX_DiscardUnknown() { var xxx_messageInfo_Header_Split proto.InternalMessageInfo -func (m *Header_Split) GetParent() *grpc1.ObjectID { +func (m *Header_Split) GetParent() *grpc.ObjectID { if m != nil { return m.Parent } return nil } -func (m *Header_Split) GetPrevious() *grpc1.ObjectID { +func (m *Header_Split) GetPrevious() *grpc.ObjectID { if m != nil { return m.Previous } @@ -450,7 +450,7 @@ func (m *Header_Split) GetParentHeader() *Header { return nil } -func (m *Header_Split) GetChildren() []*grpc1.ObjectID { +func (m *Header_Split) GetChildren() []*grpc.ObjectID { if m != nil { return m.Children } @@ -463,7 +463,7 @@ type Object struct { // Object is content-addressed. It means id will change if header or payload // changes. It's calculated as a hash of header field, which contains hash of // object's payload - ObjectId *grpc1.ObjectID `protobuf:"bytes,1,opt,name=object_id,json=objectId,proto3" json:"object_id,omitempty"` + ObjectId *grpc.ObjectID `protobuf:"bytes,1,opt,name=object_id,json=objectId,proto3" json:"object_id,omitempty"` // Signed object_id Signature *grpc.Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` // Object metadata headers @@ -508,7 +508,7 @@ func (m *Object) XXX_DiscardUnknown() { var xxx_messageInfo_Object proto.InternalMessageInfo -func (m *Object) GetObjectId() *grpc1.ObjectID { +func (m *Object) GetObjectId() *grpc.ObjectID { if m != nil { return m.ObjectId } @@ -549,57 +549,57 @@ func init() { func init() { proto.RegisterFile("v2/object/grpc/types.proto", fileDescriptor_545319325da7b9b1) } var fileDescriptor_545319325da7b9b1 = []byte{ - // 795 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x95, 0xdd, 0x6e, 0xe3, 0x44, - 0x14, 0xc7, 0xeb, 0xb4, 0xf9, 0x3a, 0x49, 0x76, 0xcd, 0x80, 0xc0, 0xca, 0xae, 0x42, 0xa8, 0x84, - 0x14, 0x56, 0xaa, 0x8d, 0xbc, 0x45, 0x08, 0x56, 0x8b, 0x94, 0x36, 0xde, 0xd4, 0x52, 0xdb, 0x94, - 0xb1, 0x8b, 0x04, 0x37, 0x96, 0x6b, 0x4f, 0x63, 0xb3, 0xa9, 0xc7, 0xf2, 0x4c, 0x8c, 0x7a, 0xcf, - 0x43, 0xf0, 0x0c, 0x48, 0xdc, 0xf0, 0x12, 0x70, 0xc9, 0x23, 0xa0, 0xf2, 0x22, 0xc8, 0x33, 0x76, - 0xfa, 0x91, 0x2e, 0x5b, 0xe0, 0x2a, 0x33, 0x27, 0xbf, 0xf3, 0xf5, 0x3f, 0x67, 0x64, 0xe8, 0xe7, - 0xa6, 0x41, 0xcf, 0xbe, 0x27, 0x01, 0x37, 0xe6, 0x59, 0x1a, 0x18, 0xfc, 0x32, 0x25, 0x4c, 0x4f, - 0x33, 0xca, 0x29, 0x52, 0x13, 0x42, 0xf5, 0x73, 0xa6, 0xe7, 0xa6, 0x2e, 0x91, 0xbe, 0x96, 0x9b, - 0x46, 0x46, 0xce, 0xd9, 0x1a, 0xdb, 0x7f, 0x92, 0x9b, 0x06, 0x23, 0x59, 0x1e, 0x07, 0x64, 0xed, - 0xcf, 0xed, 0x1f, 0x6b, 0xd0, 0x71, 0x22, 0x9a, 0xf1, 0x03, 0xe2, 0x87, 0x24, 0x43, 0xbb, 0xd0, - 0xcc, 0x49, 0xc6, 0x62, 0x9a, 0x68, 0xca, 0x50, 0x19, 0x75, 0xcc, 0xbe, 0x7e, 0x9d, 0xaa, 0x8c, - 0xa2, 0x7f, 0x23, 0x09, 0x5c, 0xa1, 0xe8, 0x63, 0x78, 0x14, 0x64, 0xc4, 0xe7, 0x31, 0x4d, 0x3c, - 0x92, 0xd2, 0x20, 0xd2, 0x6a, 0x43, 0x65, 0xb4, 0x85, 0x7b, 0x95, 0xd5, 0x2a, 0x8c, 0xc8, 0x84, - 0x16, 0xfd, 0x21, 0x21, 0x99, 0x17, 0x87, 0xda, 0xa6, 0x88, 0xfe, 0xc1, 0x8d, 0xe8, 0x45, 0xf5, - 0xfa, 0xac, 0xf8, 0xdf, 0x9e, 0xe0, 0xa6, 0x00, 0xed, 0x10, 0xbd, 0x84, 0x8e, 0xec, 0xd0, 0x2b, - 0xca, 0xd6, 0xb6, 0x86, 0xca, 0xe8, 0x91, 0xf9, 0x54, 0xbf, 0xdb, 0xbf, 0x3e, 0x13, 0x3f, 0xee, - 0x65, 0x4a, 0x30, 0xd0, 0xd5, 0xb9, 0xa8, 0x2c, 0xf5, 0x2f, 0x17, 0xd4, 0x0f, 0xbd, 0x05, 0x49, - 0xe6, 0x3c, 0xd2, 0xea, 0xb2, 0xb2, 0xd2, 0x7a, 0x28, 0x8c, 0xdb, 0xbf, 0x36, 0xa1, 0xf1, 0xbf, - 0x14, 0xf8, 0x0a, 0xba, 0x01, 0x4d, 0xb8, 0x1f, 0x97, 0xed, 0xd5, 0x84, 0xeb, 0x93, 0xbb, 0xed, - 0xed, 0x57, 0x8c, 0x3d, 0xc1, 0x9d, 0x95, 0x83, 0x1d, 0xfe, 0x27, 0x69, 0xd6, 0x55, 0xdf, 0xba, - 0x4f, 0xf5, 0x87, 0x49, 0x80, 0x3e, 0x82, 0x6e, 0x85, 0x45, 0x3e, 0x8b, 0xb4, 0xc6, 0x50, 0x19, - 0x75, 0x71, 0xa7, 0xb4, 0x1d, 0xf8, 0x2c, 0xba, 0x3b, 0x8b, 0xe6, 0xbf, 0x9c, 0xc5, 0x27, 0xa0, - 0x46, 0xf4, 0x82, 0x5e, 0xd0, 0x2c, 0x8d, 0xe2, 0x40, 0x66, 0x69, 0x89, 0x2c, 0x8f, 0x6f, 0xd8, - 0x45, 0xa6, 0x09, 0xf4, 0x18, 0x61, 0x85, 0xb2, 0x1e, 0xa7, 0xaf, 0x49, 0xa2, 0xb5, 0x85, 0x26, - 0x1f, 0xde, 0x33, 0x0a, 0x47, 0x72, 0x6e, 0x81, 0xe1, 0x2e, 0xbb, 0x71, 0x43, 0x7b, 0x00, 0x3e, - 0xe7, 0x59, 0x7c, 0xb6, 0xe4, 0x84, 0x69, 0x30, 0xdc, 0x1c, 0x75, 0xcc, 0xed, 0xf5, 0x72, 0xe5, - 0xe0, 0xf5, 0x71, 0x85, 0xe2, 0x1b, 0x5e, 0x68, 0x17, 0xea, 0x2c, 0x5d, 0xc4, 0x5c, 0xeb, 0x88, - 0x0a, 0x06, 0x6f, 0x74, 0x77, 0x0a, 0x0a, 0x4b, 0xb8, 0xff, 0x1c, 0xda, 0xab, 0x70, 0x48, 0x85, - 0xcd, 0xd7, 0xe4, 0x52, 0x6c, 0x53, 0x1b, 0x17, 0x47, 0xf4, 0x1e, 0xd4, 0x73, 0x7f, 0xb1, 0x24, - 0x62, 0x4d, 0xda, 0x58, 0x5e, 0xfa, 0xbf, 0xd4, 0xa0, 0x2e, 0xa2, 0xa0, 0x4f, 0xa1, 0x91, 0xfa, - 0x19, 0x49, 0x78, 0xb9, 0x82, 0xda, 0xda, 0x2e, 0x88, 0xd4, 0xf6, 0x04, 0x97, 0x1c, 0xda, 0x85, - 0x56, 0x9a, 0x91, 0x3c, 0xa6, 0x4b, 0x56, 0xee, 0xde, 0x9b, 0x7d, 0x56, 0x24, 0x9a, 0x82, 0x2a, - 0xfd, 0x3d, 0x16, 0xcf, 0x13, 0x9f, 0x2f, 0x33, 0x52, 0x6e, 0xdf, 0xd3, 0xfb, 0x94, 0xae, 0x18, - 0xfc, 0x58, 0x7a, 0xad, 0x0c, 0xe8, 0x25, 0xf4, 0xca, 0x40, 0x91, 0x50, 0x43, 0x6c, 0xe2, 0xed, - 0x1a, 0x6e, 0xa9, 0x85, 0xbb, 0x12, 0x5f, 0xbd, 0xb9, 0x56, 0x10, 0xc5, 0x8b, 0x30, 0x23, 0x89, - 0x56, 0x17, 0x63, 0xfa, 0x87, 0xea, 0x2b, 0x72, 0xfb, 0x37, 0x05, 0x1a, 0xd2, 0x8c, 0x3e, 0x83, - 0x76, 0xb9, 0x99, 0x71, 0xf8, 0x56, 0xcd, 0x5a, 0x12, 0xb5, 0x43, 0xf4, 0x25, 0xb4, 0xaf, 0x1b, - 0xaf, 0x3d, 0xa0, 0xf1, 0x6b, 0xbc, 0x98, 0x51, 0xd9, 0xeb, 0xe6, 0x5b, 0x7a, 0x2d, 0x39, 0xa4, - 0x41, 0xb3, 0x7c, 0x4d, 0x42, 0x9e, 0x2e, 0xae, 0xae, 0xcf, 0x5e, 0x00, 0x5c, 0xbf, 0x19, 0xd4, - 0x81, 0x26, 0xb6, 0xa6, 0xa7, 0x87, 0x63, 0xac, 0x6e, 0xa0, 0x1e, 0xb4, 0xdd, 0xd9, 0xd1, 0x9e, - 0xe3, 0xce, 0x8e, 0x2d, 0x55, 0x41, 0xef, 0x40, 0xcf, 0x71, 0x67, 0x78, 0x3c, 0xb5, 0xbc, 0x29, - 0x9e, 0x9d, 0x9e, 0xa8, 0xb5, 0x67, 0x5f, 0x40, 0xfb, 0xc8, 0xe7, 0x41, 0x24, 0x7c, 0xfb, 0xf0, - 0xfe, 0xd1, 0xd8, 0xdd, 0x3f, 0xf0, 0xdc, 0x6f, 0x4f, 0x2c, 0xef, 0xf4, 0xd8, 0x39, 0xb1, 0xf6, - 0xed, 0x57, 0xb6, 0x35, 0x51, 0x37, 0x90, 0x0a, 0x5d, 0xc7, 0xc5, 0xf6, 0xf1, 0xd4, 0xb3, 0xbe, - 0x3e, 0x1d, 0x1f, 0xaa, 0xca, 0x9e, 0xf7, 0xfb, 0xd5, 0x40, 0xf9, 0xe3, 0x6a, 0xa0, 0xfc, 0x79, - 0x35, 0x50, 0x7e, 0xfa, 0x6b, 0xb0, 0xf1, 0xdd, 0xe7, 0xf3, 0x98, 0x47, 0xcb, 0x33, 0x3d, 0xa0, - 0x17, 0x46, 0xc2, 0xd2, 0x20, 0xd8, 0x09, 0x49, 0x6e, 0x24, 0x84, 0x9e, 0xb3, 0x1d, 0x3f, 0x8d, - 0x77, 0xe6, 0xd4, 0xb8, 0xfd, 0x59, 0x7a, 0x21, 0xcf, 0x3f, 0xd7, 0xde, 0x3d, 0x26, 0xf4, 0x95, - 0xa3, 0x8f, 0x4f, 0xec, 0x42, 0x01, 0xd9, 0xce, 0x59, 0x43, 0x7c, 0x65, 0x9e, 0xff, 0x1d, 0x00, - 0x00, 0xff, 0xff, 0x30, 0x4b, 0x22, 0xa9, 0xcc, 0x06, 0x00, 0x00, + // 796 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x95, 0xdd, 0x6e, 0xe3, 0x44, + 0x14, 0xc7, 0xeb, 0xb4, 0xf9, 0x3a, 0x4e, 0x76, 0xcd, 0x80, 0xc0, 0x64, 0x51, 0xa8, 0x2a, 0x21, + 0x55, 0x2b, 0xd5, 0x06, 0x6f, 0xd1, 0x0a, 0x55, 0x8b, 0x94, 0x36, 0xde, 0xd6, 0x52, 0xdb, 0x94, + 0xb1, 0x8b, 0x04, 0x37, 0x96, 0x6b, 0x4f, 0x63, 0xd3, 0xd4, 0x63, 0x79, 0x26, 0x46, 0xbd, 0xe4, + 0x2d, 0x78, 0x86, 0x7d, 0x0e, 0x2e, 0xb8, 0xe4, 0x11, 0x56, 0xe5, 0x45, 0x90, 0x67, 0xec, 0xf4, + 0x23, 0xbb, 0x04, 0xf6, 0xca, 0xf6, 0x99, 0xdf, 0xff, 0xcc, 0xf9, 0x9f, 0x39, 0x23, 0xc3, 0xa0, + 0xb0, 0x4c, 0x7a, 0xf1, 0x0b, 0x09, 0xb9, 0x39, 0xcd, 0xb3, 0xd0, 0xe4, 0x37, 0x19, 0x61, 0x46, + 0x96, 0x53, 0x4e, 0x91, 0x96, 0x12, 0x6a, 0x5c, 0x32, 0xa3, 0xb0, 0x0c, 0x89, 0x0c, 0xf4, 0xc2, + 0x32, 0x73, 0x72, 0xc9, 0x96, 0xd8, 0xc1, 0xb3, 0xc2, 0x32, 0x19, 0x61, 0x2c, 0xa1, 0xe9, 0xd2, + 0xe2, 0xd6, 0x6f, 0x0d, 0x50, 0xdd, 0x98, 0xe6, 0xfc, 0x88, 0x04, 0x11, 0xc9, 0xd1, 0x37, 0xd0, + 0x2e, 0x48, 0x5e, 0xb2, 0xba, 0xb2, 0xa9, 0x6c, 0xab, 0xd6, 0x67, 0xc6, 0xdd, 0x56, 0x65, 0x7e, + 0xe3, 0x47, 0xb9, 0x8c, 0x6b, 0x0e, 0x7d, 0x05, 0x4f, 0xc2, 0x9c, 0x04, 0x3c, 0xa1, 0xa9, 0x4f, + 0x32, 0x1a, 0xc6, 0x7a, 0x63, 0x53, 0xd9, 0xde, 0xc0, 0xfd, 0x3a, 0x6a, 0x97, 0x41, 0x64, 0x41, + 0x87, 0xfe, 0x9a, 0x92, 0xdc, 0x4f, 0x22, 0x7d, 0xfd, 0xdd, 0xa9, 0x27, 0xe5, 0xba, 0x33, 0xc6, + 0x6d, 0x01, 0x3a, 0x11, 0x7a, 0x05, 0xaa, 0xb4, 0xe7, 0x97, 0x35, 0xeb, 0x1b, 0x9b, 0xca, 0xf6, + 0x13, 0xeb, 0x0b, 0xe3, 0xb1, 0x79, 0x63, 0x22, 0x1e, 0xde, 0x4d, 0x46, 0x30, 0xd0, 0xc5, 0x7b, + 0x59, 0x59, 0x16, 0xdc, 0xcc, 0x68, 0x10, 0xf9, 0x33, 0x92, 0x4e, 0x79, 0xac, 0x37, 0x65, 0x65, + 0x55, 0xf4, 0x58, 0x04, 0xb7, 0xde, 0xb6, 0xa1, 0xf5, 0xe1, 0xf6, 0xbf, 0x87, 0x5e, 0x48, 0x53, + 0x1e, 0x24, 0x95, 0xb7, 0x86, 0xd0, 0x3d, 0x7b, 0xac, 0x3b, 0xa8, 0x19, 0x67, 0x8c, 0xd5, 0x85, + 0xc0, 0x89, 0x3e, 0xa8, 0x2f, 0xcb, 0x2d, 0xdf, 0x78, 0x57, 0xcb, 0xff, 0x9b, 0x7f, 0xb4, 0x07, + 0xbd, 0x1a, 0x8b, 0x03, 0x16, 0xeb, 0x2d, 0x51, 0x85, 0xbe, 0xe4, 0x20, 0x26, 0xe1, 0x15, 0x9b, + 0x5f, 0x63, 0xb5, 0xa2, 0x8f, 0x02, 0x16, 0x3f, 0x3e, 0xa2, 0xf6, 0xff, 0x3c, 0xa2, 0x03, 0xd0, + 0x62, 0x7a, 0x4d, 0xaf, 0x69, 0x9e, 0xc5, 0x49, 0x28, 0xf7, 0xef, 0xac, 0xd8, 0xff, 0xe9, 0x3d, + 0x85, 0xa8, 0x61, 0x0c, 0xfd, 0x6a, 0xc0, 0x7d, 0x4e, 0xaf, 0x48, 0xaa, 0x77, 0x45, 0x86, 0x2f, + 0xef, 0x65, 0xa8, 0xd6, 0x0d, 0x57, 0x3e, 0xbd, 0x12, 0xc3, 0x3d, 0x76, 0xef, 0x0b, 0xed, 0x03, + 0x04, 0x9c, 0xe7, 0xc9, 0xc5, 0x9c, 0x13, 0xa6, 0xc3, 0xe6, 0xfa, 0xb6, 0x6a, 0x6d, 0x2d, 0x1b, + 0x91, 0x93, 0x62, 0x8c, 0x6a, 0x14, 0xdf, 0x53, 0xa1, 0x5d, 0x68, 0xb2, 0x6c, 0x96, 0x70, 0x5d, + 0x15, 0x15, 0x0c, 0xdf, 0x2b, 0x77, 0x4b, 0x0a, 0x4b, 0x78, 0xf0, 0x02, 0xba, 0x8b, 0x74, 0x48, + 0x83, 0xf5, 0x2b, 0x72, 0x23, 0xc6, 0xaf, 0x8b, 0xcb, 0x57, 0xf4, 0x09, 0x34, 0x8b, 0x60, 0x36, + 0x27, 0x62, 0xb4, 0xba, 0x58, 0x7e, 0x0c, 0xde, 0x34, 0xa0, 0x29, 0xb2, 0xa0, 0xaf, 0xa1, 0x95, + 0x05, 0x39, 0x49, 0x79, 0x35, 0xb3, 0x4b, 0x9d, 0x93, 0xbd, 0x77, 0xc6, 0xb8, 0xe2, 0xd0, 0x2e, + 0x74, 0xb2, 0x9c, 0x14, 0x09, 0x9d, 0xb3, 0x6a, 0x5e, 0xdf, 0xaf, 0x59, 0x90, 0x68, 0x0c, 0x9a, + 0xd4, 0xfb, 0x2c, 0x99, 0xa6, 0x01, 0x9f, 0xe7, 0xa4, 0x9a, 0xd8, 0xcf, 0x1f, 0xab, 0xdd, 0x1a, + 0xc0, 0x4f, 0xa5, 0x64, 0x11, 0x40, 0xaf, 0xa0, 0x5f, 0x65, 0x89, 0x45, 0x2b, 0xc4, 0xe8, 0x3e, + 0x2c, 0xe0, 0x41, 0xab, 0x70, 0x4f, 0xe2, 0xd5, 0x0d, 0xdd, 0x85, 0x4e, 0x18, 0x27, 0xb3, 0x28, + 0x27, 0xa9, 0xde, 0x14, 0x67, 0xf4, 0x2f, 0xa5, 0xd7, 0xe4, 0xd6, 0x1f, 0x0a, 0xb4, 0x64, 0x18, + 0x7d, 0x0b, 0xdd, 0x6a, 0x60, 0x93, 0x68, 0x65, 0xc3, 0x3a, 0x12, 0x75, 0x22, 0xf4, 0x12, 0xba, + 0x77, 0xae, 0x1b, 0xab, 0x5c, 0xdf, 0xb1, 0xe5, 0xe9, 0x54, 0x46, 0xd7, 0x57, 0x18, 0xad, 0x38, + 0xa4, 0x43, 0xbb, 0xba, 0x61, 0xa2, 0x37, 0x3d, 0x5c, 0x7f, 0x3e, 0xdf, 0x03, 0xb8, 0xbb, 0x47, + 0x48, 0x85, 0x36, 0xb6, 0x0f, 0xcf, 0x8f, 0x47, 0x58, 0x5b, 0x43, 0x7d, 0xe8, 0x7a, 0x93, 0x93, + 0x7d, 0xd7, 0x9b, 0x9c, 0xda, 0x9a, 0x82, 0x3e, 0x82, 0xbe, 0xeb, 0x4d, 0xf0, 0xe8, 0xd0, 0xf6, + 0x0f, 0xf1, 0xe4, 0xfc, 0x4c, 0x6b, 0x3c, 0xff, 0x0e, 0xba, 0x27, 0x01, 0x0f, 0x63, 0xa1, 0x1d, + 0xc0, 0xa7, 0x27, 0x23, 0xef, 0xe0, 0xc8, 0xf7, 0x7e, 0x3a, 0xb3, 0xfd, 0xf3, 0x53, 0xf7, 0xcc, + 0x3e, 0x70, 0x5e, 0x3b, 0xf6, 0x58, 0x5b, 0x43, 0x1a, 0xf4, 0x5c, 0x0f, 0x3b, 0xa7, 0x87, 0xbe, + 0xfd, 0xc3, 0xf9, 0xe8, 0x58, 0x53, 0xf6, 0xfd, 0x3f, 0x6f, 0x87, 0xca, 0x5f, 0xb7, 0x43, 0xe5, + 0xed, 0xed, 0x50, 0xf9, 0xfd, 0xef, 0xe1, 0xda, 0xcf, 0x2f, 0xa7, 0x09, 0x8f, 0xe7, 0x17, 0x46, + 0x48, 0xaf, 0xcd, 0x94, 0x65, 0x61, 0xb8, 0x13, 0x91, 0xc2, 0x4c, 0x09, 0xbd, 0x64, 0x3b, 0x41, + 0x96, 0xec, 0x4c, 0xa9, 0xf9, 0xf0, 0xf7, 0xb5, 0x27, 0xdf, 0xdf, 0x34, 0x3e, 0x3e, 0x25, 0xf4, + 0xb5, 0x6b, 0x8c, 0xce, 0x9c, 0xb2, 0x03, 0xd2, 0xce, 0x45, 0x4b, 0xfc, 0x8d, 0x5e, 0xfc, 0x13, + 0x00, 0x00, 0xff, 0xff, 0x2c, 0x8c, 0x1d, 0x72, 0xf4, 0x06, 0x00, 0x00, } func (m *ShortHeader) Marshal() (dAtA []byte, err error) { @@ -730,10 +730,15 @@ func (m *Header) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x4a } - if len(m.HomomorphicHash) > 0 { - i -= len(m.HomomorphicHash) - copy(dAtA[i:], m.HomomorphicHash) - i = encodeVarintTypes(dAtA, i, uint64(len(m.HomomorphicHash))) + if m.HomomorphicHash != nil { + { + size, err := m.HomomorphicHash.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } i-- dAtA[i] = 0x42 } @@ -742,10 +747,15 @@ func (m *Header) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x38 } - if len(m.PayloadHash) > 0 { - i -= len(m.PayloadHash) - copy(dAtA[i:], m.PayloadHash) - i = encodeVarintTypes(dAtA, i, uint64(len(m.PayloadHash))) + if m.PayloadHash != nil { + { + size, err := m.PayloadHash.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } i-- dAtA[i] = 0x32 } @@ -1062,15 +1072,15 @@ func (m *Header) Size() (n int) { if m.PayloadLength != 0 { n += 1 + sovTypes(uint64(m.PayloadLength)) } - l = len(m.PayloadHash) - if l > 0 { + if m.PayloadHash != nil { + l = m.PayloadHash.Size() n += 1 + l + sovTypes(uint64(l)) } if m.ObjectType != 0 { n += 1 + sovTypes(uint64(m.ObjectType)) } - l = len(m.HomomorphicHash) - if l > 0 { + if m.HomomorphicHash != nil { + l = m.HomomorphicHash.Size() n += 1 + l + sovTypes(uint64(l)) } if m.SessionToken != nil { @@ -1295,7 +1305,7 @@ func (m *ShortHeader) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.OwnerId == nil { - m.OwnerId = &grpc1.OwnerID{} + m.OwnerId = &grpc.OwnerID{} } if err := m.OwnerId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -1459,7 +1469,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.ContainerId == nil { - m.ContainerId = &grpc1.ContainerID{} + m.ContainerId = &grpc.ContainerID{} } if err := m.ContainerId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -1495,7 +1505,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.OwnerId == nil { - m.OwnerId = &grpc1.OwnerID{} + m.OwnerId = &grpc.OwnerID{} } if err := m.OwnerId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -1543,7 +1553,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field PayloadHash", wireType) } - var byteLen int + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTypes @@ -1553,24 +1563,26 @@ func (m *Header) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { + if msglen < 0 { return ErrInvalidLengthTypes } - postIndex := iNdEx + byteLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthTypes } if postIndex > l { return io.ErrUnexpectedEOF } - m.PayloadHash = append(m.PayloadHash[:0], dAtA[iNdEx:postIndex]...) if m.PayloadHash == nil { - m.PayloadHash = []byte{} + m.PayloadHash = &grpc.Checksum{} + } + if err := m.PayloadHash.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } iNdEx = postIndex case 7: @@ -1596,7 +1608,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field HomomorphicHash", wireType) } - var byteLen int + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTypes @@ -1606,24 +1618,26 @@ func (m *Header) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { + if msglen < 0 { return ErrInvalidLengthTypes } - postIndex := iNdEx + byteLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthTypes } if postIndex > l { return io.ErrUnexpectedEOF } - m.HomomorphicHash = append(m.HomomorphicHash[:0], dAtA[iNdEx:postIndex]...) if m.HomomorphicHash == nil { - m.HomomorphicHash = []byte{} + m.HomomorphicHash = &grpc.Checksum{} + } + if err := m.HomomorphicHash.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } iNdEx = postIndex case 9: @@ -1656,7 +1670,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.SessionToken == nil { - m.SessionToken = &grpc.SessionToken{} + m.SessionToken = &grpc1.SessionToken{} } if err := m.SessionToken.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -1934,7 +1948,7 @@ func (m *Header_Split) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.Parent == nil { - m.Parent = &grpc1.ObjectID{} + m.Parent = &grpc.ObjectID{} } if err := m.Parent.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -1970,7 +1984,7 @@ func (m *Header_Split) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.Previous == nil { - m.Previous = &grpc1.ObjectID{} + m.Previous = &grpc.ObjectID{} } if err := m.Previous.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -2077,7 +2091,7 @@ func (m *Header_Split) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Children = append(m.Children, &grpc1.ObjectID{}) + m.Children = append(m.Children, &grpc.ObjectID{}) if err := m.Children[len(m.Children)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -2166,7 +2180,7 @@ func (m *Object) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.ObjectId == nil { - m.ObjectId = &grpc1.ObjectID{} + m.ObjectId = &grpc.ObjectID{} } if err := m.ObjectId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err diff --git a/v2/refs/grpc/types.pb.go b/v2/refs/grpc/types.pb.go index 7634600..91878d0 100644 --- a/v2/refs/grpc/types.pb.go +++ b/v2/refs/grpc/types.pb.go @@ -22,6 +22,38 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +// Checksum algorithm type +type ChecksumType int32 + +const ( + // Unknown. Not used + ChecksumType_CHECKSUM_TYPE_UNSPECIFIED ChecksumType = 0 + // Tillich-Zemor homomorphic hash funciton + ChecksumType_TZ ChecksumType = 1 + // SHA-256 + ChecksumType_SHA256 ChecksumType = 2 +) + +var ChecksumType_name = map[int32]string{ + 0: "CHECKSUM_TYPE_UNSPECIFIED", + 1: "TZ", + 2: "SHA256", +} + +var ChecksumType_value = map[string]int32{ + "CHECKSUM_TYPE_UNSPECIFIED": 0, + "TZ": 1, + "SHA256": 2, +} + +func (x ChecksumType) String() string { + return proto.EnumName(ChecksumType_name, int32(x)) +} + +func (ChecksumType) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_08f084e5f91ec87c, []int{0} +} + // Address of object (container id + object id) type Address struct { // container_id carries container identifier. @@ -227,34 +259,222 @@ func (m *OwnerID) GetValue() []byte { return nil } +// Represents API version used by node. +type Version struct { + // Major API version. + Major uint32 `protobuf:"varint,1,opt,name=major,proto3" json:"major,omitempty"` + // Minor API version. + Minor uint32 `protobuf:"varint,2,opt,name=minor,proto3" json:"minor,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Version) Reset() { *m = Version{} } +func (m *Version) String() string { return proto.CompactTextString(m) } +func (*Version) ProtoMessage() {} +func (*Version) Descriptor() ([]byte, []int) { + return fileDescriptor_08f084e5f91ec87c, []int{4} +} +func (m *Version) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Version) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Version.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Version) XXX_Merge(src proto.Message) { + xxx_messageInfo_Version.Merge(m, src) +} +func (m *Version) XXX_Size() int { + return m.Size() +} +func (m *Version) XXX_DiscardUnknown() { + xxx_messageInfo_Version.DiscardUnknown(m) +} + +var xxx_messageInfo_Version proto.InternalMessageInfo + +func (m *Version) GetMajor() uint32 { + if m != nil { + return m.Major + } + return 0 +} + +func (m *Version) GetMinor() uint32 { + if m != nil { + return m.Minor + } + return 0 +} + +// Signature of something in NeoFS +type Signature struct { + // Public key used for signing. + Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + // Signature + Sign []byte `protobuf:"bytes,2,opt,name=sign,proto3" json:"sign,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Signature) Reset() { *m = Signature{} } +func (m *Signature) String() string { return proto.CompactTextString(m) } +func (*Signature) ProtoMessage() {} +func (*Signature) Descriptor() ([]byte, []int) { + return fileDescriptor_08f084e5f91ec87c, []int{5} +} +func (m *Signature) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Signature) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Signature.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Signature) XXX_Merge(src proto.Message) { + xxx_messageInfo_Signature.Merge(m, src) +} +func (m *Signature) XXX_Size() int { + return m.Size() +} +func (m *Signature) XXX_DiscardUnknown() { + xxx_messageInfo_Signature.DiscardUnknown(m) +} + +var xxx_messageInfo_Signature proto.InternalMessageInfo + +func (m *Signature) GetKey() []byte { + if m != nil { + return m.Key + } + return nil +} + +func (m *Signature) GetSign() []byte { + if m != nil { + return m.Sign + } + return nil +} + +// Checksum message +type Checksum struct { + // Checksum algorithm type + Type ChecksumType `protobuf:"varint,1,opt,name=type,proto3,enum=neo.fs.v2.refs.ChecksumType" json:"type,omitempty"` + // Checksum itself + Sum []byte `protobuf:"bytes,2,opt,name=sum,proto3" json:"sum,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Checksum) Reset() { *m = Checksum{} } +func (m *Checksum) String() string { return proto.CompactTextString(m) } +func (*Checksum) ProtoMessage() {} +func (*Checksum) Descriptor() ([]byte, []int) { + return fileDescriptor_08f084e5f91ec87c, []int{6} +} +func (m *Checksum) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Checksum) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Checksum.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Checksum) XXX_Merge(src proto.Message) { + xxx_messageInfo_Checksum.Merge(m, src) +} +func (m *Checksum) XXX_Size() int { + return m.Size() +} +func (m *Checksum) XXX_DiscardUnknown() { + xxx_messageInfo_Checksum.DiscardUnknown(m) +} + +var xxx_messageInfo_Checksum proto.InternalMessageInfo + +func (m *Checksum) GetType() ChecksumType { + if m != nil { + return m.Type + } + return ChecksumType_CHECKSUM_TYPE_UNSPECIFIED +} + +func (m *Checksum) GetSum() []byte { + if m != nil { + return m.Sum + } + return nil +} + func init() { + proto.RegisterEnum("neo.fs.v2.refs.ChecksumType", ChecksumType_name, ChecksumType_value) proto.RegisterType((*Address)(nil), "neo.fs.v2.refs.Address") proto.RegisterType((*ObjectID)(nil), "neo.fs.v2.refs.ObjectID") proto.RegisterType((*ContainerID)(nil), "neo.fs.v2.refs.ContainerID") proto.RegisterType((*OwnerID)(nil), "neo.fs.v2.refs.OwnerID") + proto.RegisterType((*Version)(nil), "neo.fs.v2.refs.Version") + proto.RegisterType((*Signature)(nil), "neo.fs.v2.refs.Signature") + proto.RegisterType((*Checksum)(nil), "neo.fs.v2.refs.Checksum") } func init() { proto.RegisterFile("v2/refs/grpc/types.proto", fileDescriptor_08f084e5f91ec87c) } var fileDescriptor_08f084e5f91ec87c = []byte{ - // 265 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x28, 0x33, 0xd2, 0x2f, - 0x4a, 0x4d, 0x2b, 0xd6, 0x4f, 0x2f, 0x2a, 0x48, 0xd6, 0x2f, 0xa9, 0x2c, 0x48, 0x2d, 0xd6, 0x2b, - 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0xcb, 0x4b, 0xcd, 0xd7, 0x4b, 0x2b, 0xd6, 0x2b, 0x33, 0xd2, - 0x03, 0x29, 0x50, 0x6a, 0x60, 0xe4, 0x62, 0x77, 0x4c, 0x49, 0x29, 0x4a, 0x2d, 0x2e, 0x16, 0xb2, - 0xe3, 0xe2, 0x49, 0xce, 0xcf, 0x2b, 0x49, 0xcc, 0xcc, 0x4b, 0x2d, 0x8a, 0xcf, 0x4c, 0x91, 0x60, - 0x54, 0x60, 0xd4, 0xe0, 0x36, 0x92, 0xd6, 0x43, 0xd5, 0xa2, 0xe7, 0x0c, 0x53, 0xe3, 0xe9, 0x12, - 0xc4, 0x0d, 0xd7, 0xe0, 0x99, 0x22, 0x64, 0xca, 0xc5, 0x99, 0x9f, 0x94, 0x95, 0x9a, 0x5c, 0x02, - 0xd2, 0xcc, 0x04, 0xd6, 0x2c, 0x81, 0xae, 0xd9, 0x1f, 0xac, 0xc0, 0xd3, 0x25, 0x88, 0x03, 0xa2, - 0xd4, 0x33, 0x45, 0x49, 0x81, 0x8b, 0x03, 0x26, 0x2a, 0x24, 0xc2, 0xc5, 0x5a, 0x96, 0x98, 0x53, - 0x9a, 0x0a, 0xb6, 0x9b, 0x27, 0x08, 0xc2, 0x51, 0x52, 0xe6, 0xe2, 0x46, 0xb2, 0x14, 0x87, 0x22, - 0x79, 0x2e, 0x76, 0xff, 0x72, 0x3c, 0x0a, 0x9c, 0x22, 0x4f, 0x3c, 0x92, 0x63, 0xbc, 0xf0, 0x48, - 0x8e, 0xf1, 0xc1, 0x23, 0x39, 0xc6, 0x19, 0x8f, 0xe5, 0x18, 0xa2, 0x8c, 0xd3, 0x33, 0x4b, 0x32, - 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, 0xf3, 0x8a, 0x0b, 0x92, 0x93, 0x75, 0x53, 0x52, 0xcb, - 0xf4, 0xf3, 0x52, 0xf3, 0xd3, 0x8a, 0x75, 0x13, 0x0b, 0x32, 0x75, 0xd3, 0xf3, 0xf5, 0x91, 0x03, - 0xd2, 0x1a, 0xc4, 0x5a, 0xc5, 0x24, 0xe8, 0x97, 0x9a, 0xef, 0x16, 0xac, 0xe7, 0x18, 0xe0, 0x09, - 0xf2, 0x55, 0x50, 0x6a, 0x5a, 0x71, 0x12, 0x1b, 0x38, 0x70, 0x8d, 0x01, 0x01, 0x00, 0x00, 0xff, - 0xff, 0x64, 0x50, 0x7b, 0x92, 0x78, 0x01, 0x00, 0x00, + // 427 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x92, 0xc1, 0x6e, 0xd3, 0x40, + 0x10, 0x86, 0xeb, 0x50, 0x92, 0x74, 0x12, 0xaa, 0xb0, 0xe2, 0x10, 0x04, 0x84, 0xca, 0x5c, 0x10, + 0x52, 0xd6, 0xe0, 0x2a, 0x5c, 0x90, 0x90, 0x82, 0x93, 0xaa, 0x16, 0x22, 0x8d, 0xec, 0x14, 0xa9, + 0xbd, 0x44, 0x8e, 0x3d, 0x71, 0xb7, 0x25, 0xbb, 0xd6, 0xae, 0x6d, 0x94, 0x1b, 0x8f, 0xc1, 0x33, + 0xf0, 0x24, 0x1c, 0x79, 0x04, 0x14, 0x5e, 0x04, 0xed, 0x26, 0x41, 0x01, 0x04, 0xb7, 0x7f, 0x46, + 0xdf, 0xb7, 0x63, 0x8f, 0x06, 0xda, 0xa5, 0xeb, 0x48, 0x9c, 0x2b, 0x27, 0x95, 0x59, 0xec, 0xe4, + 0xcb, 0x0c, 0x15, 0xcd, 0xa4, 0xc8, 0x05, 0x39, 0xe4, 0x28, 0xe8, 0x5c, 0xd1, 0xd2, 0xa5, 0x1a, + 0xb0, 0x3f, 0x59, 0x50, 0xeb, 0x27, 0x89, 0x44, 0xa5, 0xc8, 0x6b, 0x68, 0xc6, 0x82, 0xe7, 0x11, + 0xe3, 0x28, 0xa7, 0x2c, 0x69, 0x5b, 0x47, 0xd6, 0xd3, 0x86, 0xfb, 0x80, 0xfe, 0xae, 0x50, 0x6f, + 0xcb, 0xf8, 0x83, 0xa0, 0xf1, 0x4b, 0xf0, 0x13, 0xd2, 0x83, 0x03, 0x31, 0xbb, 0xc6, 0x38, 0xd7, + 0x72, 0xc5, 0xc8, 0xed, 0x3f, 0xe5, 0x33, 0x03, 0xf8, 0x83, 0xa0, 0xbe, 0x46, 0xfd, 0xc4, 0x3e, + 0x82, 0xfa, 0xb6, 0x4b, 0xee, 0xc1, 0xed, 0x32, 0xfa, 0x50, 0xa0, 0x99, 0xdd, 0x0c, 0xd6, 0x85, + 0xfd, 0x04, 0x1a, 0x3b, 0x43, 0xff, 0x01, 0x3d, 0x86, 0xda, 0xd9, 0xc7, 0xff, 0x01, 0x3d, 0xa8, + 0xbd, 0x47, 0xa9, 0x98, 0xe0, 0x1a, 0x58, 0x44, 0xd7, 0x42, 0x1a, 0xe0, 0x4e, 0xb0, 0x2e, 0x4c, + 0x97, 0x71, 0x21, 0xcd, 0xb7, 0xeb, 0xae, 0x2e, 0xec, 0x17, 0x70, 0x10, 0xb2, 0x94, 0x47, 0x79, + 0x21, 0x91, 0xb4, 0xe0, 0xd6, 0x0d, 0x2e, 0x37, 0xef, 0xea, 0x48, 0x08, 0xec, 0x2b, 0x96, 0x72, + 0xe3, 0x34, 0x03, 0x93, 0xed, 0x11, 0xd4, 0xbd, 0x2b, 0x8c, 0x6f, 0x54, 0xb1, 0x20, 0xcf, 0x61, + 0x5f, 0xef, 0xdf, 0x28, 0x87, 0xee, 0xc3, 0xbf, 0x96, 0xb9, 0xe1, 0x26, 0xcb, 0x0c, 0x03, 0x43, + 0xea, 0x19, 0xaa, 0x58, 0x6c, 0x1e, 0xd4, 0xf1, 0x59, 0x1f, 0x9a, 0xbb, 0x1c, 0x79, 0x04, 0xf7, + 0xbd, 0xd3, 0xa1, 0xf7, 0x36, 0x3c, 0x7f, 0x37, 0x9d, 0x5c, 0x8c, 0x87, 0xd3, 0xf3, 0x51, 0x38, + 0x1e, 0x7a, 0xfe, 0x89, 0x3f, 0x1c, 0xb4, 0xf6, 0x48, 0x15, 0x2a, 0x93, 0xcb, 0x96, 0x45, 0x00, + 0xaa, 0xe1, 0x69, 0xdf, 0xed, 0xbd, 0x6c, 0x55, 0xde, 0x5c, 0x7c, 0x5d, 0x75, 0xac, 0x6f, 0xab, + 0x8e, 0xf5, 0x7d, 0xd5, 0xb1, 0x3e, 0xff, 0xe8, 0xec, 0x5d, 0x1e, 0xa7, 0x2c, 0xbf, 0x2a, 0x66, + 0x34, 0x16, 0x0b, 0x87, 0xab, 0x2c, 0x8e, 0xbb, 0x09, 0x96, 0x0e, 0x47, 0x31, 0x57, 0xdd, 0x28, + 0x63, 0xdd, 0x54, 0x38, 0xbb, 0x57, 0xf4, 0x4a, 0xa7, 0x2f, 0x95, 0xbb, 0x23, 0x14, 0x27, 0x21, + 0xed, 0x8f, 0x7d, 0xfd, 0x0b, 0x01, 0xce, 0xd5, 0xac, 0x6a, 0x2e, 0xeb, 0xf8, 0x67, 0x00, 0x00, + 0x00, 0xff, 0xff, 0xbb, 0x23, 0xc5, 0xde, 0x75, 0x02, 0x00, 0x00, } func (m *Address) Marshal() (dAtA []byte, err error) { @@ -410,6 +630,123 @@ func (m *OwnerID) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *Version) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Version) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Version) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.Minor != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Minor)) + i-- + dAtA[i] = 0x10 + } + if m.Major != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Major)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *Signature) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Signature) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Signature) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Sign) > 0 { + i -= len(m.Sign) + copy(dAtA[i:], m.Sign) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Sign))) + i-- + dAtA[i] = 0x12 + } + if len(m.Key) > 0 { + i -= len(m.Key) + copy(dAtA[i:], m.Key) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Key))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Checksum) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Checksum) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Checksum) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Sum) > 0 { + i -= len(m.Sum) + copy(dAtA[i:], m.Sum) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Sum))) + i-- + dAtA[i] = 0x12 + } + if m.Type != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Type)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + func encodeVarintTypes(dAtA []byte, offset int, v uint64) int { offset -= sovTypes(v) base := offset @@ -489,6 +826,63 @@ func (m *OwnerID) Size() (n int) { return n } +func (m *Version) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Major != 0 { + n += 1 + sovTypes(uint64(m.Major)) + } + if m.Minor != 0 { + n += 1 + sovTypes(uint64(m.Minor)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *Signature) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Key) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.Sign) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *Checksum) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Type != 0 { + n += 1 + sovTypes(uint64(m.Type)) + } + l = len(m.Sum) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + func sovTypes(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -885,6 +1279,327 @@ func (m *OwnerID) Unmarshal(dAtA []byte) error { } return nil } +func (m *Version) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Version: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Version: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Major", wireType) + } + m.Major = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Major |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Minor", wireType) + } + m.Minor = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Minor |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Signature) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Signature: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Signature: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Key = append(m.Key[:0], dAtA[iNdEx:postIndex]...) + if m.Key == nil { + m.Key = []byte{} + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sign", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Sign = append(m.Sign[:0], dAtA[iNdEx:postIndex]...) + if m.Sign == nil { + m.Sign = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Checksum) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Checksum: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Checksum: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) + } + m.Type = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Type |= ChecksumType(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sum", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Sum = append(m.Sum[:0], dAtA[iNdEx:postIndex]...) + if m.Sum == nil { + m.Sum = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipTypes(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/v2/session/grpc/service.pb.go b/v2/session/grpc/service.pb.go index da92abe..e96f4c8 100644 --- a/v2/session/grpc/service.pb.go +++ b/v2/session/grpc/service.pb.go @@ -7,9 +7,8 @@ import ( context "context" fmt "fmt" proto "github.com/golang/protobuf/proto" - grpc1 "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" - grpc "github.com/nspcc-dev/neofs-api-go/v2/service/grpc" - grpc2 "google.golang.org/grpc" + grpc "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" + grpc1 "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" io "io" @@ -34,13 +33,13 @@ type CreateRequest struct { Body *CreateRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" json:"meta_header,omitempty"` + MetaHeader *RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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,proto3" json:"verify_header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + VerifyHeader *RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *CreateRequest) Reset() { *m = CreateRequest{} } @@ -83,14 +82,14 @@ func (m *CreateRequest) GetBody() *CreateRequest_Body { return nil } -func (m *CreateRequest) GetMetaHeader() *grpc.RequestMetaHeader { +func (m *CreateRequest) GetMetaHeader() *RequestMetaHeader { if m != nil { return m.MetaHeader } return nil } -func (m *CreateRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { +func (m *CreateRequest) GetVerifyHeader() *RequestVerificationHeader { if m != nil { return m.VerifyHeader } @@ -100,12 +99,12 @@ func (m *CreateRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { // Request body type CreateRequest_Body struct { // Carries an identifier of a session initiator. - OwnerId *grpc1.OwnerID `protobuf:"bytes,1,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"` - // Carries a lifetime of the session. - Lifetime *grpc.TokenLifetime `protobuf:"bytes,2,opt,name=lifetime,proto3" json:"lifetime,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + OwnerId *grpc.OwnerID `protobuf:"bytes,1,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"` + // Expiration Epoch + Expiration uint64 `protobuf:"varint,2,opt,name=expiration,proto3" json:"expiration,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *CreateRequest_Body) Reset() { *m = CreateRequest_Body{} } @@ -141,18 +140,18 @@ func (m *CreateRequest_Body) XXX_DiscardUnknown() { var xxx_messageInfo_CreateRequest_Body proto.InternalMessageInfo -func (m *CreateRequest_Body) GetOwnerId() *grpc1.OwnerID { +func (m *CreateRequest_Body) GetOwnerId() *grpc.OwnerID { if m != nil { return m.OwnerId } return nil } -func (m *CreateRequest_Body) GetLifetime() *grpc.TokenLifetime { +func (m *CreateRequest_Body) GetExpiration() uint64 { if m != nil { - return m.Lifetime + return m.Expiration } - return nil + return 0 } // CreateResponse carries an information about the opened session. @@ -161,14 +160,14 @@ type CreateResponse struct { Body *CreateResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" json:"meta_header,omitempty"` + MetaHeader *ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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,proto3" json:"verify_header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + VerifyHeader *ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *CreateResponse) Reset() { *m = CreateResponse{} } @@ -211,14 +210,14 @@ func (m *CreateResponse) GetBody() *CreateResponse_Body { return nil } -func (m *CreateResponse) GetMetaHeader() *grpc.ResponseMetaHeader { +func (m *CreateResponse) GetMetaHeader() *ResponseMetaHeader { if m != nil { return m.MetaHeader } return nil } -func (m *CreateResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { +func (m *CreateResponse) GetVerifyHeader() *ResponseVerificationHeader { if m != nil { return m.VerifyHeader } @@ -293,63 +292,62 @@ func init() { func init() { proto.RegisterFile("v2/session/grpc/service.proto", fileDescriptor_4ed1365cc8e16cd4) } var fileDescriptor_4ed1365cc8e16cd4 = []byte{ - // 458 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x93, 0x4f, 0x6f, 0xd3, 0x30, - 0x18, 0xc6, 0x49, 0x98, 0xc6, 0xe4, 0x76, 0x95, 0xb0, 0x90, 0xa8, 0x8a, 0x28, 0x65, 0x62, 0x88, - 0x03, 0x75, 0xa4, 0x70, 0x40, 0x03, 0x2e, 0x0c, 0x98, 0xa8, 0x60, 0xfc, 0x71, 0x11, 0x07, 0x2e, - 0x51, 0xfe, 0xbc, 0xe9, 0xac, 0x11, 0x3b, 0xd8, 0x5e, 0x20, 0xdf, 0x84, 0x2b, 0x57, 0x3e, 0x09, - 0x47, 0x3e, 0x01, 0x42, 0xe5, 0x8b, 0xa0, 0xd8, 0xde, 0xb4, 0x6e, 0x59, 0x7b, 0xcb, 0x1b, 0x3f, - 0xcf, 0xf3, 0xbe, 0xef, 0x4f, 0x36, 0xba, 0x59, 0x85, 0x81, 0x02, 0xa5, 0x98, 0xe0, 0xc1, 0x4c, - 0x96, 0x69, 0xa0, 0x40, 0x56, 0x2c, 0x05, 0x52, 0x4a, 0xa1, 0x05, 0xbe, 0xca, 0x41, 0x90, 0x5c, - 0x91, 0x2a, 0x24, 0x4e, 0x35, 0xe8, 0x57, 0x61, 0x20, 0x21, 0x57, 0x56, 0xae, 0xeb, 0x12, 0x94, - 0x15, 0x0f, 0x6e, 0x98, 0x2c, 0x63, 0x3f, 0x77, 0xb8, 0xf5, 0xc7, 0x47, 0x9b, 0xcf, 0x24, 0xc4, - 0x1a, 0x28, 0x7c, 0x39, 0x02, 0xa5, 0xf1, 0x0e, 0x5a, 0x4b, 0x44, 0x56, 0xf7, 0xbd, 0x91, 0x77, - 0xaf, 0x13, 0x6e, 0x93, 0x73, 0xad, 0xc8, 0x82, 0x9e, 0xec, 0x8a, 0xac, 0xa6, 0xc6, 0x82, 0x5f, - 0xa0, 0x4e, 0x01, 0x3a, 0x8e, 0x0e, 0x20, 0xce, 0x40, 0xf6, 0x7d, 0x93, 0x70, 0x67, 0x21, 0xc1, - 0x6e, 0xe1, 0xbc, 0xfb, 0xa0, 0xe3, 0x97, 0x46, 0x4b, 0x51, 0x71, 0xf2, 0x8d, 0xdf, 0xa3, 0xcd, - 0x0a, 0x24, 0xcb, 0xeb, 0xe3, 0xa0, 0xcb, 0x26, 0xe8, 0xfe, 0xc5, 0x41, 0x1f, 0x1b, 0x39, 0x4b, - 0x63, 0xcd, 0x04, 0x77, 0x81, 0x5d, 0x1b, 0x61, 0xab, 0xc1, 0x37, 0xb4, 0xd6, 0xcc, 0x89, 0x43, - 0xb4, 0x21, 0xbe, 0x72, 0x90, 0x11, 0xcb, 0xdc, 0x82, 0xd7, 0x4f, 0xa5, 0x36, 0xfc, 0xc8, 0xdb, - 0xe6, 0x7c, 0xf2, 0x9c, 0x5e, 0x31, 0xc2, 0x49, 0x86, 0x9f, 0xa0, 0x8d, 0xcf, 0x2c, 0x07, 0xcd, - 0x0a, 0x70, 0x2b, 0x8d, 0x5a, 0x26, 0xf9, 0x20, 0x0e, 0x81, 0xbf, 0x76, 0x3a, 0x7a, 0xe2, 0xd8, - 0xfa, 0xe1, 0xa3, 0xde, 0x31, 0x30, 0x55, 0x0a, 0xae, 0x00, 0x3f, 0x5a, 0x20, 0x7c, 0x77, 0x09, - 0x61, 0x6b, 0x38, 0x8d, 0x78, 0xaf, 0x0d, 0xf1, 0x76, 0x2b, 0x19, 0x6b, 0xbe, 0x80, 0x31, 0x6d, - 0x67, 0x3c, 0x5e, 0x92, 0xb4, 0x12, 0xf2, 0x43, 0x07, 0xb9, 0x87, 0x7c, 0x87, 0xb7, 0x4b, 0x7d, - 0x96, 0xe1, 0x5b, 0xa8, 0xe3, 0x16, 0x8b, 0x0e, 0xa1, 0x36, 0x33, 0x77, 0x29, 0x72, 0xbf, 0x5e, - 0x41, 0x1d, 0x46, 0xa8, 0x37, 0xb5, 0xd5, 0xd4, 0xf6, 0xc4, 0xfb, 0x68, 0xdd, 0x32, 0xc0, 0xa3, - 0x55, 0x17, 0x70, 0x70, 0x7b, 0x25, 0xc0, 0xdd, 0xe4, 0xd7, 0x7c, 0xe8, 0xfd, 0x9e, 0x0f, 0xbd, - 0xbf, 0xf3, 0xa1, 0xf7, 0xfd, 0xdf, 0xf0, 0xd2, 0xa7, 0x9d, 0x19, 0xd3, 0x07, 0x47, 0x09, 0x49, - 0x45, 0x11, 0x70, 0x55, 0xa6, 0xe9, 0x38, 0x83, 0x2a, 0xe0, 0x20, 0x72, 0x35, 0x8e, 0x4b, 0x36, - 0x9e, 0x89, 0xe0, 0xcc, 0x13, 0x7c, 0xec, 0x8a, 0x9f, 0xfe, 0xb5, 0x37, 0x20, 0xf6, 0xa6, 0xe4, - 0xe9, 0xbb, 0x49, 0xd3, 0xd2, 0x4d, 0x9e, 0xac, 0x9b, 0x07, 0xf5, 0xe0, 0x7f, 0x00, 0x00, 0x00, - 0xff, 0xff, 0x9a, 0x12, 0x33, 0x00, 0xbb, 0x03, 0x00, 0x00, + // 444 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x93, 0x4d, 0x6f, 0xd3, 0x30, + 0x18, 0xc7, 0x49, 0xa8, 0x06, 0x7a, 0xda, 0x55, 0xc2, 0x42, 0xa2, 0x2a, 0x22, 0x8c, 0x89, 0x21, + 0x0e, 0xd4, 0x91, 0xc2, 0x01, 0x0d, 0x4e, 0x0c, 0x98, 0xa8, 0xd0, 0x78, 0x71, 0x25, 0x0e, 0xbb, + 0x54, 0x79, 0x79, 0xd2, 0x59, 0xa8, 0x71, 0xb0, 0xbd, 0x40, 0xbe, 0x09, 0x57, 0xae, 0x7c, 0x0a, + 0x8e, 0x1c, 0xf9, 0x08, 0xa8, 0x7c, 0x11, 0x14, 0xdb, 0x43, 0xd9, 0x96, 0xad, 0xb7, 0x38, 0xfe, + 0x3f, 0x3f, 0x3f, 0xcf, 0x4f, 0x36, 0xdc, 0xa9, 0xa2, 0x50, 0xa1, 0x52, 0x5c, 0x14, 0xe1, 0x42, + 0x96, 0x69, 0xa8, 0x50, 0x56, 0x3c, 0x45, 0x5a, 0x4a, 0xa1, 0x05, 0xb9, 0x51, 0xa0, 0xa0, 0xb9, + 0xa2, 0x55, 0x44, 0x5d, 0x6a, 0x3c, 0xaa, 0xa2, 0x50, 0x62, 0xae, 0x6c, 0x5c, 0xd7, 0x25, 0x2a, + 0x1b, 0x1e, 0xdf, 0x3e, 0xcb, 0x6a, 0x6d, 0x6e, 0xff, 0xf4, 0x61, 0xf3, 0x85, 0xc4, 0x58, 0x23, + 0xc3, 0xcf, 0xc7, 0xa8, 0x34, 0xd9, 0x85, 0x5e, 0x22, 0xb2, 0x7a, 0xe4, 0x6d, 0x79, 0x0f, 0xfb, + 0xd1, 0x0e, 0x3d, 0x77, 0x14, 0x3d, 0x95, 0xa7, 0x7b, 0x22, 0xab, 0x99, 0x29, 0x21, 0xaf, 0xa0, + 0xbf, 0x44, 0x1d, 0xcf, 0x8f, 0x30, 0xce, 0x50, 0x8e, 0x7c, 0x43, 0xb8, 0xdf, 0x41, 0x70, 0xb5, + 0x07, 0xa8, 0xe3, 0xd7, 0x26, 0xcb, 0x60, 0xf9, 0xff, 0x9b, 0x7c, 0x80, 0xcd, 0x0a, 0x25, 0xcf, + 0xeb, 0x13, 0xd0, 0x55, 0x03, 0x7a, 0x74, 0x31, 0xe8, 0x63, 0x13, 0xe7, 0x69, 0xac, 0xb9, 0x28, + 0x1c, 0x70, 0x60, 0x11, 0x76, 0x35, 0x3e, 0x84, 0x5e, 0xd3, 0x27, 0x89, 0xe0, 0xba, 0xf8, 0x52, + 0xa0, 0x9c, 0xf3, 0xcc, 0x0d, 0x78, 0xab, 0x45, 0x6d, 0xfc, 0xd1, 0x77, 0xcd, 0xfe, 0xf4, 0x25, + 0xbb, 0x66, 0x82, 0xd3, 0x8c, 0x04, 0x00, 0xf8, 0xb5, 0xe4, 0xd2, 0xd0, 0xcd, 0x50, 0x3d, 0xd6, + 0xfa, 0xb3, 0xfd, 0xdd, 0x87, 0xe1, 0x89, 0x12, 0x55, 0x8a, 0x42, 0x21, 0x79, 0x7a, 0xca, 0xe1, + 0x83, 0x4b, 0x1c, 0xda, 0x82, 0xb6, 0xc4, 0xfd, 0x2e, 0x89, 0x3b, 0x9d, 0xb3, 0xdb, 0xe2, 0x0b, + 0x2c, 0xb2, 0x6e, 0x8b, 0x93, 0x4b, 0x48, 0x6b, 0x35, 0x3e, 0x71, 0x1a, 0x87, 0xe0, 0x3b, 0x81, + 0x03, 0xe6, 0xf3, 0x8c, 0xdc, 0x85, 0xbe, 0x63, 0xcd, 0x3f, 0x61, 0x6d, 0x7a, 0x1e, 0x30, 0x70, + 0xbf, 0xde, 0x60, 0x1d, 0xcd, 0x61, 0x38, 0xb3, 0xab, 0x99, 0xbd, 0xc8, 0xe4, 0x00, 0x36, 0xac, + 0x03, 0xb2, 0xb5, 0xee, 0x8a, 0x8d, 0xef, 0xad, 0x15, 0xb8, 0x97, 0xfc, 0x5a, 0x05, 0xde, 0xef, + 0x55, 0xe0, 0xfd, 0x59, 0x05, 0xde, 0xb7, 0xbf, 0xc1, 0x95, 0xc3, 0xdd, 0x05, 0xd7, 0x47, 0xc7, + 0x09, 0x4d, 0xc5, 0x32, 0x2c, 0x54, 0x99, 0xa6, 0x93, 0x0c, 0xab, 0xb0, 0x40, 0x91, 0xab, 0x49, + 0x5c, 0xf2, 0xc9, 0x42, 0x84, 0x67, 0x1e, 0xc6, 0x33, 0xb7, 0xf8, 0xe1, 0xdf, 0x7c, 0x8b, 0x62, + 0x7f, 0x46, 0x9f, 0xbf, 0x9f, 0x36, 0x47, 0xba, 0xce, 0x93, 0x0d, 0xf3, 0x64, 0x1e, 0xff, 0x0b, + 0x00, 0x00, 0xff, 0xff, 0xd3, 0xaa, 0x38, 0x65, 0x9d, 0x03, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. var _ context.Context -var _ grpc2.ClientConn +var _ grpc1.ClientConn // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -const _ = grpc2.SupportPackageIsVersion4 +const _ = grpc1.SupportPackageIsVersion4 // SessionServiceClient is the client API for SessionService service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type SessionServiceClient interface { // Create opens new session between the client and the server. - Create(ctx context.Context, in *CreateRequest, opts ...grpc2.CallOption) (*CreateResponse, error) + Create(ctx context.Context, in *CreateRequest, opts ...grpc1.CallOption) (*CreateResponse, error) } type sessionServiceClient struct { - cc *grpc2.ClientConn + cc *grpc1.ClientConn } -func NewSessionServiceClient(cc *grpc2.ClientConn) SessionServiceClient { +func NewSessionServiceClient(cc *grpc1.ClientConn) SessionServiceClient { return &sessionServiceClient{cc} } -func (c *sessionServiceClient) Create(ctx context.Context, in *CreateRequest, opts ...grpc2.CallOption) (*CreateResponse, error) { +func (c *sessionServiceClient) Create(ctx context.Context, in *CreateRequest, opts ...grpc1.CallOption) (*CreateResponse, error) { out := new(CreateResponse) err := c.cc.Invoke(ctx, "/neo.fs.v2.session.SessionService/Create", in, out, opts...) if err != nil { @@ -372,11 +370,11 @@ func (*UnimplementedSessionServiceServer) Create(ctx context.Context, req *Creat return nil, status.Errorf(codes.Unimplemented, "method Create not implemented") } -func RegisterSessionServiceServer(s *grpc2.Server, srv SessionServiceServer) { +func RegisterSessionServiceServer(s *grpc1.Server, srv SessionServiceServer) { s.RegisterService(&_SessionService_serviceDesc, srv) } -func _SessionService_Create_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc2.UnaryServerInterceptor) (interface{}, error) { +func _SessionService_Create_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc1.UnaryServerInterceptor) (interface{}, error) { in := new(CreateRequest) if err := dec(in); err != nil { return nil, err @@ -384,7 +382,7 @@ func _SessionService_Create_Handler(srv interface{}, ctx context.Context, dec fu if interceptor == nil { return srv.(SessionServiceServer).Create(ctx, in) } - info := &grpc2.UnaryServerInfo{ + info := &grpc1.UnaryServerInfo{ Server: srv, FullMethod: "/neo.fs.v2.session.SessionService/Create", } @@ -394,16 +392,16 @@ func _SessionService_Create_Handler(srv interface{}, ctx context.Context, dec fu return interceptor(ctx, in, info, handler) } -var _SessionService_serviceDesc = grpc2.ServiceDesc{ +var _SessionService_serviceDesc = grpc1.ServiceDesc{ ServiceName: "neo.fs.v2.session.SessionService", HandlerType: (*SessionServiceServer)(nil), - Methods: []grpc2.MethodDesc{ + Methods: []grpc1.MethodDesc{ { MethodName: "Create", Handler: _SessionService_Create_Handler, }, }, - Streams: []grpc2.StreamDesc{}, + Streams: []grpc1.StreamDesc{}, Metadata: "v2/session/grpc/service.proto", } @@ -494,17 +492,10 @@ func (m *CreateRequest_Body) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } - if m.Lifetime != nil { - { - size, err := m.Lifetime.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } + if m.Expiration != 0 { + i = encodeVarintService(dAtA, i, uint64(m.Expiration)) i-- - dAtA[i] = 0x12 + dAtA[i] = 0x10 } if m.OwnerId != nil { { @@ -670,9 +661,8 @@ func (m *CreateRequest_Body) Size() (n int) { l = m.OwnerId.Size() n += 1 + l + sovService(uint64(l)) } - if m.Lifetime != nil { - l = m.Lifetime.Size() - n += 1 + l + sovService(uint64(l)) + if m.Expiration != 0 { + n += 1 + sovService(uint64(m.Expiration)) } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) @@ -825,7 +815,7 @@ func (m *CreateRequest) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.MetaHeader == nil { - m.MetaHeader = &grpc.RequestMetaHeader{} + m.MetaHeader = &RequestMetaHeader{} } if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -861,7 +851,7 @@ func (m *CreateRequest) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.VerifyHeader == nil { - m.VerifyHeader = &grpc.RequestVerificationHeader{} + m.VerifyHeader = &RequestVerificationHeader{} } if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -951,17 +941,17 @@ func (m *CreateRequest_Body) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.OwnerId == nil { - m.OwnerId = &grpc1.OwnerID{} + m.OwnerId = &grpc.OwnerID{} } if err := m.OwnerId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Lifetime", wireType) + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Expiration", wireType) } - var msglen int + m.Expiration = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowService @@ -971,28 +961,11 @@ func (m *CreateRequest_Body) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + m.Expiration |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Lifetime == nil { - m.Lifetime = &grpc.TokenLifetime{} - } - if err := m.Lifetime.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipService(dAtA[iNdEx:]) @@ -1113,7 +1086,7 @@ func (m *CreateResponse) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.MetaHeader == nil { - m.MetaHeader = &grpc.ResponseMetaHeader{} + m.MetaHeader = &ResponseMetaHeader{} } if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -1149,7 +1122,7 @@ func (m *CreateResponse) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.VerifyHeader == nil { - m.VerifyHeader = &grpc.ResponseVerificationHeader{} + m.VerifyHeader = &ResponseVerificationHeader{} } if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err diff --git a/v2/service/grpc/types.pb.go b/v2/session/grpc/types.pb.go similarity index 68% rename from v2/service/grpc/types.pb.go rename to v2/session/grpc/types.pb.go index 4190b29..39733a3 100644 --- a/v2/service/grpc/types.pb.go +++ b/v2/session/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: v2/service/grpc/types.proto +// source: v2/session/grpc/types.proto -package service +package session import ( fmt "fmt" @@ -73,196 +73,13 @@ func (x ObjectSessionContext_Verb) String() string { } func (ObjectSessionContext_Verb) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_006ebe254dc218a3, []int{3, 0} -} - -// Extended headers for Request/Response -type XHeader struct { - // Key of the X-Header. - Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - // Value of the X-Header. - Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *XHeader) Reset() { *m = XHeader{} } -func (m *XHeader) String() string { return proto.CompactTextString(m) } -func (*XHeader) ProtoMessage() {} -func (*XHeader) Descriptor() ([]byte, []int) { - return fileDescriptor_006ebe254dc218a3, []int{0} -} -func (m *XHeader) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *XHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_XHeader.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *XHeader) XXX_Merge(src proto.Message) { - xxx_messageInfo_XHeader.Merge(m, src) -} -func (m *XHeader) XXX_Size() int { - return m.Size() -} -func (m *XHeader) XXX_DiscardUnknown() { - xxx_messageInfo_XHeader.DiscardUnknown(m) -} - -var xxx_messageInfo_XHeader proto.InternalMessageInfo - -func (m *XHeader) GetKey() string { - if m != nil { - return m.Key - } - return "" -} - -func (m *XHeader) GetValue() string { - if m != nil { - return m.Value - } - return "" -} - -// Represents API version used by node. -type Version struct { - // Major API version. - Major uint32 `protobuf:"varint,1,opt,name=major,proto3" json:"major,omitempty"` - // Minor API version. - Minor uint32 `protobuf:"varint,2,opt,name=minor,proto3" json:"minor,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Version) Reset() { *m = Version{} } -func (m *Version) String() string { return proto.CompactTextString(m) } -func (*Version) ProtoMessage() {} -func (*Version) Descriptor() ([]byte, []int) { - return fileDescriptor_006ebe254dc218a3, []int{1} -} -func (m *Version) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Version) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Version.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *Version) XXX_Merge(src proto.Message) { - xxx_messageInfo_Version.Merge(m, src) -} -func (m *Version) XXX_Size() int { - return m.Size() -} -func (m *Version) XXX_DiscardUnknown() { - xxx_messageInfo_Version.DiscardUnknown(m) -} - -var xxx_messageInfo_Version proto.InternalMessageInfo - -func (m *Version) GetMajor() uint32 { - if m != nil { - return m.Major - } - return 0 -} - -func (m *Version) GetMinor() uint32 { - if m != nil { - return m.Minor - } - return 0 -} - -// Lifetime parameters of the token. Filed names taken from rfc7519. -type TokenLifetime struct { - // Expiration Epoch - Exp uint64 `protobuf:"varint,1,opt,name=exp,proto3" json:"exp,omitempty"` - // Not valid before Epoch - Nbf uint64 `protobuf:"varint,2,opt,name=nbf,proto3" json:"nbf,omitempty"` - // Issued at Epoch - Iat uint64 `protobuf:"varint,3,opt,name=iat,proto3" json:"iat,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *TokenLifetime) Reset() { *m = TokenLifetime{} } -func (m *TokenLifetime) String() string { return proto.CompactTextString(m) } -func (*TokenLifetime) ProtoMessage() {} -func (*TokenLifetime) Descriptor() ([]byte, []int) { - return fileDescriptor_006ebe254dc218a3, []int{2} -} -func (m *TokenLifetime) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *TokenLifetime) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_TokenLifetime.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *TokenLifetime) XXX_Merge(src proto.Message) { - xxx_messageInfo_TokenLifetime.Merge(m, src) -} -func (m *TokenLifetime) XXX_Size() int { - return m.Size() -} -func (m *TokenLifetime) XXX_DiscardUnknown() { - xxx_messageInfo_TokenLifetime.DiscardUnknown(m) -} - -var xxx_messageInfo_TokenLifetime proto.InternalMessageInfo - -func (m *TokenLifetime) GetExp() uint64 { - if m != nil { - return m.Exp - } - return 0 -} - -func (m *TokenLifetime) GetNbf() uint64 { - if m != nil { - return m.Nbf - } - return 0 -} - -func (m *TokenLifetime) GetIat() uint64 { - if m != nil { - return m.Iat - } - return 0 + return fileDescriptor_6bbc551f310b2b05, []int{0, 0} } // Context information for Session Tokens related to ObjectService requests type ObjectSessionContext struct { // Verb is a type of request for which the token is issued - Verb ObjectSessionContext_Verb `protobuf:"varint,1,opt,name=verb,proto3,enum=neo.fs.v2.service.ObjectSessionContext_Verb" json:"verb,omitempty"` + Verb ObjectSessionContext_Verb `protobuf:"varint,1,opt,name=verb,proto3,enum=neo.fs.v2.session.ObjectSessionContext_Verb" json:"verb,omitempty"` // Related Object address Address *grpc.Address `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` @@ -274,7 +91,7 @@ func (m *ObjectSessionContext) Reset() { *m = ObjectSessionContext{} } func (m *ObjectSessionContext) String() string { return proto.CompactTextString(m) } func (*ObjectSessionContext) ProtoMessage() {} func (*ObjectSessionContext) Descriptor() ([]byte, []int) { - return fileDescriptor_006ebe254dc218a3, []int{3} + return fileDescriptor_6bbc551f310b2b05, []int{0} } func (m *ObjectSessionContext) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -322,17 +139,17 @@ type SessionToken struct { // Session Token body Body *SessionToken_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` // Signature is a signature of session token information - Signature *Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Signature *grpc.Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *SessionToken) Reset() { *m = SessionToken{} } func (m *SessionToken) String() string { return proto.CompactTextString(m) } func (*SessionToken) ProtoMessage() {} func (*SessionToken) Descriptor() ([]byte, []int) { - return fileDescriptor_006ebe254dc218a3, []int{4} + return fileDescriptor_6bbc551f310b2b05, []int{1} } func (m *SessionToken) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -368,7 +185,7 @@ func (m *SessionToken) GetBody() *SessionToken_Body { return nil } -func (m *SessionToken) GetSignature() *Signature { +func (m *SessionToken) GetSignature() *grpc.Signature { if m != nil { return m.Signature } @@ -382,7 +199,7 @@ type SessionToken_Body struct { // OwnerID carries identifier of the session initiator. OwnerId *grpc.OwnerID `protobuf:"bytes,2,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"` // Lifetime is a lifetime of the session - Lifetime *TokenLifetime `protobuf:"bytes,3,opt,name=lifetime,proto3" json:"lifetime,omitempty"` + Lifetime *SessionToken_Body_TokenLifetime `protobuf:"bytes,3,opt,name=lifetime,proto3" json:"lifetime,omitempty"` // SessionKey is a public key of session key SessionKey []byte `protobuf:"bytes,4,opt,name=session_key,json=sessionKey,proto3" json:"session_key,omitempty"` // Carries context of the session. @@ -399,7 +216,7 @@ func (m *SessionToken_Body) Reset() { *m = SessionToken_Body{} } func (m *SessionToken_Body) String() string { return proto.CompactTextString(m) } func (*SessionToken_Body) ProtoMessage() {} func (*SessionToken_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_006ebe254dc218a3, []int{4, 0} + return fileDescriptor_6bbc551f310b2b05, []int{1, 0} } func (m *SessionToken_Body) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -461,7 +278,7 @@ func (m *SessionToken_Body) GetOwnerId() *grpc.OwnerID { return nil } -func (m *SessionToken_Body) GetLifetime() *TokenLifetime { +func (m *SessionToken_Body) GetLifetime() *SessionToken_Body_TokenLifetime { if m != nil { return m.Lifetime } @@ -489,29 +306,31 @@ func (*SessionToken_Body) XXX_OneofWrappers() []interface{} { } } -// BearerToken has information about request ACL rules with limited lifetime -type BearerToken struct { - // Bearer Token body - Body *BearerToken_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` - // Signature of BearerToken body - Signature *Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` +// Lifetime parameters of the token. Filed names taken from rfc7519. +type SessionToken_Body_TokenLifetime struct { + // Expiration Epoch + Exp uint64 `protobuf:"varint,1,opt,name=exp,proto3" json:"exp,omitempty"` + // Not valid before Epoch + Nbf uint64 `protobuf:"varint,2,opt,name=nbf,proto3" json:"nbf,omitempty"` + // Issued at Epoch + Iat uint64 `protobuf:"varint,3,opt,name=iat,proto3" json:"iat,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *BearerToken) Reset() { *m = BearerToken{} } -func (m *BearerToken) String() string { return proto.CompactTextString(m) } -func (*BearerToken) ProtoMessage() {} -func (*BearerToken) Descriptor() ([]byte, []int) { - return fileDescriptor_006ebe254dc218a3, []int{5} +func (m *SessionToken_Body_TokenLifetime) Reset() { *m = SessionToken_Body_TokenLifetime{} } +func (m *SessionToken_Body_TokenLifetime) String() string { return proto.CompactTextString(m) } +func (*SessionToken_Body_TokenLifetime) ProtoMessage() {} +func (*SessionToken_Body_TokenLifetime) Descriptor() ([]byte, []int) { + return fileDescriptor_6bbc551f310b2b05, []int{1, 0, 0} } -func (m *BearerToken) XXX_Unmarshal(b []byte) error { +func (m *SessionToken_Body_TokenLifetime) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *BearerToken) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *SessionToken_Body_TokenLifetime) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_BearerToken.Marshal(b, m, deterministic) + return xxx_messageInfo_SessionToken_Body_TokenLifetime.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -521,57 +340,62 @@ func (m *BearerToken) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) return b[:n], nil } } -func (m *BearerToken) XXX_Merge(src proto.Message) { - xxx_messageInfo_BearerToken.Merge(m, src) +func (m *SessionToken_Body_TokenLifetime) XXX_Merge(src proto.Message) { + xxx_messageInfo_SessionToken_Body_TokenLifetime.Merge(m, src) } -func (m *BearerToken) XXX_Size() int { +func (m *SessionToken_Body_TokenLifetime) XXX_Size() int { return m.Size() } -func (m *BearerToken) XXX_DiscardUnknown() { - xxx_messageInfo_BearerToken.DiscardUnknown(m) +func (m *SessionToken_Body_TokenLifetime) XXX_DiscardUnknown() { + xxx_messageInfo_SessionToken_Body_TokenLifetime.DiscardUnknown(m) } -var xxx_messageInfo_BearerToken proto.InternalMessageInfo +var xxx_messageInfo_SessionToken_Body_TokenLifetime proto.InternalMessageInfo -func (m *BearerToken) GetBody() *BearerToken_Body { +func (m *SessionToken_Body_TokenLifetime) GetExp() uint64 { if m != nil { - return m.Body + return m.Exp } - return nil + return 0 } -func (m *BearerToken) GetSignature() *Signature { +func (m *SessionToken_Body_TokenLifetime) GetNbf() uint64 { if m != nil { - return m.Signature + return m.Nbf } - return nil + return 0 } -// Bearer Token body -type BearerToken_Body struct { - // EACLTable carries table of extended ACL rules - EaclTable *grpc1.EACLTable `protobuf:"bytes,1,opt,name=eacl_table,json=eaclTable,proto3" json:"eacl_table,omitempty"` - // OwnerID carries identifier of the token owner - OwnerId *grpc.OwnerID `protobuf:"bytes,2,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"` - // Token expiration and valid time period parameters - Lifetime *TokenLifetime `protobuf:"bytes,3,opt,name=lifetime,proto3" json:"lifetime,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` +func (m *SessionToken_Body_TokenLifetime) GetIat() uint64 { + if m != nil { + return m.Iat + } + return 0 } -func (m *BearerToken_Body) Reset() { *m = BearerToken_Body{} } -func (m *BearerToken_Body) String() string { return proto.CompactTextString(m) } -func (*BearerToken_Body) ProtoMessage() {} -func (*BearerToken_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_006ebe254dc218a3, []int{5, 0} +// Extended headers for Request/Response +type XHeader struct { + // Key of the X-Header. + Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + // Value of the X-Header. + Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *BearerToken_Body) XXX_Unmarshal(b []byte) error { + +func (m *XHeader) Reset() { *m = XHeader{} } +func (m *XHeader) String() string { return proto.CompactTextString(m) } +func (*XHeader) ProtoMessage() {} +func (*XHeader) Descriptor() ([]byte, []int) { + return fileDescriptor_6bbc551f310b2b05, []int{2} +} +func (m *XHeader) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *BearerToken_Body) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *XHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_BearerToken_Body.Marshal(b, m, deterministic) + return xxx_messageInfo_XHeader.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -581,43 +405,36 @@ func (m *BearerToken_Body) XXX_Marshal(b []byte, deterministic bool) ([]byte, er return b[:n], nil } } -func (m *BearerToken_Body) XXX_Merge(src proto.Message) { - xxx_messageInfo_BearerToken_Body.Merge(m, src) +func (m *XHeader) XXX_Merge(src proto.Message) { + xxx_messageInfo_XHeader.Merge(m, src) } -func (m *BearerToken_Body) XXX_Size() int { +func (m *XHeader) XXX_Size() int { return m.Size() } -func (m *BearerToken_Body) XXX_DiscardUnknown() { - xxx_messageInfo_BearerToken_Body.DiscardUnknown(m) +func (m *XHeader) XXX_DiscardUnknown() { + xxx_messageInfo_XHeader.DiscardUnknown(m) } -var xxx_messageInfo_BearerToken_Body proto.InternalMessageInfo +var xxx_messageInfo_XHeader proto.InternalMessageInfo -func (m *BearerToken_Body) GetEaclTable() *grpc1.EACLTable { +func (m *XHeader) GetKey() string { if m != nil { - return m.EaclTable + return m.Key } - return nil + return "" } -func (m *BearerToken_Body) GetOwnerId() *grpc.OwnerID { +func (m *XHeader) GetValue() string { if m != nil { - return m.OwnerId + return m.Value } - return nil -} - -func (m *BearerToken_Body) GetLifetime() *TokenLifetime { - if m != nil { - return m.Lifetime - } - return nil + return "" } // Information about the request type RequestMetaHeader struct { // Client API version. - Version *Version `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` + Version *grpc.Version `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` // Client local epoch number. Set to 0 if unknown. Epoch uint64 `protobuf:"varint,2,opt,name=epoch,proto3" json:"epoch,omitempty"` // Maximum number of nodes in the request route. @@ -627,7 +444,7 @@ type RequestMetaHeader struct { // Token is a token of the session within which the request is sent SessionToken *SessionToken `protobuf:"bytes,5,opt,name=session_token,json=sessionToken,proto3" json:"session_token,omitempty"` // Bearer is a Bearer token of the request - BearerToken *BearerToken `protobuf:"bytes,6,opt,name=bearer_token,json=bearerToken,proto3" json:"bearer_token,omitempty"` + BearerToken *grpc1.BearerToken `protobuf:"bytes,6,opt,name=bearer_token,json=bearerToken,proto3" json:"bearer_token,omitempty"` // RequestMetaHeader of the origin request. Origin *RequestMetaHeader `protobuf:"bytes,7,opt,name=origin,proto3" json:"origin,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` @@ -639,7 +456,7 @@ func (m *RequestMetaHeader) Reset() { *m = RequestMetaHeader{} } func (m *RequestMetaHeader) String() string { return proto.CompactTextString(m) } func (*RequestMetaHeader) ProtoMessage() {} func (*RequestMetaHeader) Descriptor() ([]byte, []int) { - return fileDescriptor_006ebe254dc218a3, []int{6} + return fileDescriptor_6bbc551f310b2b05, []int{3} } func (m *RequestMetaHeader) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -668,7 +485,7 @@ func (m *RequestMetaHeader) XXX_DiscardUnknown() { var xxx_messageInfo_RequestMetaHeader proto.InternalMessageInfo -func (m *RequestMetaHeader) GetVersion() *Version { +func (m *RequestMetaHeader) GetVersion() *grpc.Version { if m != nil { return m.Version } @@ -703,7 +520,7 @@ func (m *RequestMetaHeader) GetSessionToken() *SessionToken { return nil } -func (m *RequestMetaHeader) GetBearerToken() *BearerToken { +func (m *RequestMetaHeader) GetBearerToken() *grpc1.BearerToken { if m != nil { return m.BearerToken } @@ -720,7 +537,7 @@ func (m *RequestMetaHeader) GetOrigin() *RequestMetaHeader { // Information about the response type ResponseMetaHeader struct { // Server API version. - Version *Version `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` + Version *grpc.Version `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` // Server local epoch number. Epoch uint64 `protobuf:"varint,2,opt,name=epoch,proto3" json:"epoch,omitempty"` // Maximum number of nodes in the response route. @@ -738,7 +555,7 @@ func (m *ResponseMetaHeader) Reset() { *m = ResponseMetaHeader{} } func (m *ResponseMetaHeader) String() string { return proto.CompactTextString(m) } func (*ResponseMetaHeader) ProtoMessage() {} func (*ResponseMetaHeader) Descriptor() ([]byte, []int) { - return fileDescriptor_006ebe254dc218a3, []int{7} + return fileDescriptor_6bbc551f310b2b05, []int{4} } func (m *ResponseMetaHeader) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -767,7 +584,7 @@ func (m *ResponseMetaHeader) XXX_DiscardUnknown() { var xxx_messageInfo_ResponseMetaHeader proto.InternalMessageInfo -func (m *ResponseMetaHeader) GetVersion() *Version { +func (m *ResponseMetaHeader) GetVersion() *grpc.Version { if m != nil { return m.Version } @@ -802,72 +619,14 @@ func (m *ResponseMetaHeader) GetOrigin() *ResponseMetaHeader { return nil } -// Signature of something in NeoFS -type Signature struct { - // Public key used for signing. - Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - // Signature - Sign []byte `protobuf:"bytes,2,opt,name=sign,proto3" json:"sign,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Signature) Reset() { *m = Signature{} } -func (m *Signature) String() string { return proto.CompactTextString(m) } -func (*Signature) ProtoMessage() {} -func (*Signature) Descriptor() ([]byte, []int) { - return fileDescriptor_006ebe254dc218a3, []int{8} -} -func (m *Signature) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Signature) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Signature.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *Signature) XXX_Merge(src proto.Message) { - xxx_messageInfo_Signature.Merge(m, src) -} -func (m *Signature) XXX_Size() int { - return m.Size() -} -func (m *Signature) XXX_DiscardUnknown() { - xxx_messageInfo_Signature.DiscardUnknown(m) -} - -var xxx_messageInfo_Signature proto.InternalMessageInfo - -func (m *Signature) GetKey() []byte { - if m != nil { - return m.Key - } - return nil -} - -func (m *Signature) GetSign() []byte { - if m != nil { - return m.Sign - } - return nil -} - // Verification info for request signed by all intermediate nodes type RequestVerificationHeader struct { // Request Body signature. Should be generated once by request initiator. - BodySignature *Signature `protobuf:"bytes,1,opt,name=body_signature,json=bodySignature,proto3" json:"body_signature,omitempty"` + BodySignature *grpc.Signature `protobuf:"bytes,1,opt,name=body_signature,json=bodySignature,proto3" json:"body_signature,omitempty"` // Request Meta signature is added and signed by any intermediate node - MetaSignature *Signature `protobuf:"bytes,2,opt,name=meta_signature,json=metaSignature,proto3" json:"meta_signature,omitempty"` + MetaSignature *grpc.Signature `protobuf:"bytes,2,opt,name=meta_signature,json=metaSignature,proto3" json:"meta_signature,omitempty"` // Sign previous hops - OriginSignature *Signature `protobuf:"bytes,3,opt,name=origin_signature,json=originSignature,proto3" json:"origin_signature,omitempty"` + OriginSignature *grpc.Signature `protobuf:"bytes,3,opt,name=origin_signature,json=originSignature,proto3" json:"origin_signature,omitempty"` // Chain of previous hops signatures Origin *RequestVerificationHeader `protobuf:"bytes,4,opt,name=origin,proto3" json:"origin,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` @@ -879,7 +638,7 @@ func (m *RequestVerificationHeader) Reset() { *m = RequestVerificationHe func (m *RequestVerificationHeader) String() string { return proto.CompactTextString(m) } func (*RequestVerificationHeader) ProtoMessage() {} func (*RequestVerificationHeader) Descriptor() ([]byte, []int) { - return fileDescriptor_006ebe254dc218a3, []int{9} + return fileDescriptor_6bbc551f310b2b05, []int{5} } func (m *RequestVerificationHeader) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -908,21 +667,21 @@ func (m *RequestVerificationHeader) XXX_DiscardUnknown() { var xxx_messageInfo_RequestVerificationHeader proto.InternalMessageInfo -func (m *RequestVerificationHeader) GetBodySignature() *Signature { +func (m *RequestVerificationHeader) GetBodySignature() *grpc.Signature { if m != nil { return m.BodySignature } return nil } -func (m *RequestVerificationHeader) GetMetaSignature() *Signature { +func (m *RequestVerificationHeader) GetMetaSignature() *grpc.Signature { if m != nil { return m.MetaSignature } return nil } -func (m *RequestVerificationHeader) GetOriginSignature() *Signature { +func (m *RequestVerificationHeader) GetOriginSignature() *grpc.Signature { if m != nil { return m.OriginSignature } @@ -939,11 +698,11 @@ func (m *RequestVerificationHeader) GetOrigin() *RequestVerificationHeader { // Verification info for response signed by all intermediate nodes type ResponseVerificationHeader struct { // Response Body signature. Should be generated once by answering node. - BodySignature *Signature `protobuf:"bytes,1,opt,name=body_signature,json=bodySignature,proto3" json:"body_signature,omitempty"` + BodySignature *grpc.Signature `protobuf:"bytes,1,opt,name=body_signature,json=bodySignature,proto3" json:"body_signature,omitempty"` // Response Meta signature is added and signed by any intermediate node - MetaSignature *Signature `protobuf:"bytes,2,opt,name=meta_signature,json=metaSignature,proto3" json:"meta_signature,omitempty"` + MetaSignature *grpc.Signature `protobuf:"bytes,2,opt,name=meta_signature,json=metaSignature,proto3" json:"meta_signature,omitempty"` // Sign previous hops - OriginSignature *Signature `protobuf:"bytes,3,opt,name=origin_signature,json=originSignature,proto3" json:"origin_signature,omitempty"` + OriginSignature *grpc.Signature `protobuf:"bytes,3,opt,name=origin_signature,json=originSignature,proto3" json:"origin_signature,omitempty"` // Chain of previous hops signatures Origin *ResponseVerificationHeader `protobuf:"bytes,4,opt,name=origin,proto3" json:"origin,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` @@ -955,7 +714,7 @@ func (m *ResponseVerificationHeader) Reset() { *m = ResponseVerification func (m *ResponseVerificationHeader) String() string { return proto.CompactTextString(m) } func (*ResponseVerificationHeader) ProtoMessage() {} func (*ResponseVerificationHeader) Descriptor() ([]byte, []int) { - return fileDescriptor_006ebe254dc218a3, []int{10} + return fileDescriptor_6bbc551f310b2b05, []int{6} } func (m *ResponseVerificationHeader) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -984,21 +743,21 @@ func (m *ResponseVerificationHeader) XXX_DiscardUnknown() { var xxx_messageInfo_ResponseVerificationHeader proto.InternalMessageInfo -func (m *ResponseVerificationHeader) GetBodySignature() *Signature { +func (m *ResponseVerificationHeader) GetBodySignature() *grpc.Signature { if m != nil { return m.BodySignature } return nil } -func (m *ResponseVerificationHeader) GetMetaSignature() *Signature { +func (m *ResponseVerificationHeader) GetMetaSignature() *grpc.Signature { if m != nil { return m.MetaSignature } return nil } -func (m *ResponseVerificationHeader) GetOriginSignature() *Signature { +func (m *ResponseVerificationHeader) GetOriginSignature() *grpc.Signature { if m != nil { return m.OriginSignature } @@ -1013,205 +772,75 @@ func (m *ResponseVerificationHeader) GetOrigin() *ResponseVerificationHeader { } func init() { - proto.RegisterEnum("neo.fs.v2.service.ObjectSessionContext_Verb", ObjectSessionContext_Verb_name, ObjectSessionContext_Verb_value) - proto.RegisterType((*XHeader)(nil), "neo.fs.v2.service.XHeader") - proto.RegisterType((*Version)(nil), "neo.fs.v2.service.Version") - proto.RegisterType((*TokenLifetime)(nil), "neo.fs.v2.service.TokenLifetime") - proto.RegisterType((*ObjectSessionContext)(nil), "neo.fs.v2.service.ObjectSessionContext") - proto.RegisterType((*SessionToken)(nil), "neo.fs.v2.service.SessionToken") - proto.RegisterType((*SessionToken_Body)(nil), "neo.fs.v2.service.SessionToken.Body") - proto.RegisterType((*BearerToken)(nil), "neo.fs.v2.service.BearerToken") - proto.RegisterType((*BearerToken_Body)(nil), "neo.fs.v2.service.BearerToken.Body") - proto.RegisterType((*RequestMetaHeader)(nil), "neo.fs.v2.service.RequestMetaHeader") - proto.RegisterType((*ResponseMetaHeader)(nil), "neo.fs.v2.service.ResponseMetaHeader") - proto.RegisterType((*Signature)(nil), "neo.fs.v2.service.Signature") - proto.RegisterType((*RequestVerificationHeader)(nil), "neo.fs.v2.service.RequestVerificationHeader") - proto.RegisterType((*ResponseVerificationHeader)(nil), "neo.fs.v2.service.ResponseVerificationHeader") + proto.RegisterEnum("neo.fs.v2.session.ObjectSessionContext_Verb", ObjectSessionContext_Verb_name, ObjectSessionContext_Verb_value) + proto.RegisterType((*ObjectSessionContext)(nil), "neo.fs.v2.session.ObjectSessionContext") + proto.RegisterType((*SessionToken)(nil), "neo.fs.v2.session.SessionToken") + proto.RegisterType((*SessionToken_Body)(nil), "neo.fs.v2.session.SessionToken.Body") + proto.RegisterType((*SessionToken_Body_TokenLifetime)(nil), "neo.fs.v2.session.SessionToken.Body.TokenLifetime") + proto.RegisterType((*XHeader)(nil), "neo.fs.v2.session.XHeader") + proto.RegisterType((*RequestMetaHeader)(nil), "neo.fs.v2.session.RequestMetaHeader") + proto.RegisterType((*ResponseMetaHeader)(nil), "neo.fs.v2.session.ResponseMetaHeader") + proto.RegisterType((*RequestVerificationHeader)(nil), "neo.fs.v2.session.RequestVerificationHeader") + proto.RegisterType((*ResponseVerificationHeader)(nil), "neo.fs.v2.session.ResponseVerificationHeader") } -func init() { proto.RegisterFile("v2/service/grpc/types.proto", fileDescriptor_006ebe254dc218a3) } +func init() { proto.RegisterFile("v2/session/grpc/types.proto", fileDescriptor_6bbc551f310b2b05) } -var fileDescriptor_006ebe254dc218a3 = []byte{ - // 943 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe4, 0x56, 0xcd, 0x6e, 0x23, 0x45, - 0x10, 0xce, 0x8c, 0x27, 0x76, 0x5c, 0xb6, 0xc3, 0x6c, 0x2b, 0xd2, 0x1a, 0x83, 0xbc, 0xd1, 0x00, - 0x82, 0xc3, 0x66, 0xac, 0x18, 0x50, 0xf8, 0x59, 0x24, 0xfc, 0x33, 0x1b, 0x5b, 0x84, 0x6c, 0xd4, - 0xf6, 0x46, 0x88, 0x8b, 0x35, 0x3f, 0x65, 0x67, 0xb2, 0xce, 0xb4, 0x99, 0x99, 0x0c, 0xc9, 0x9b, - 0xf0, 0x0c, 0xdc, 0x90, 0xd0, 0x3e, 0x03, 0x47, 0x1e, 0x01, 0x85, 0x1b, 0x37, 0x4e, 0x7b, 0x43, - 0xa8, 0x7b, 0xda, 0x3f, 0x1b, 0xdb, 0x4b, 0x90, 0x10, 0x42, 0xe2, 0x56, 0x5d, 0x5d, 0xdf, 0x37, - 0x55, 0x5f, 0x57, 0x95, 0x0d, 0x6f, 0x24, 0xf5, 0x5a, 0x84, 0x61, 0xe2, 0xbb, 0x58, 0x1b, 0x85, - 0x13, 0xb7, 0x16, 0x5f, 0x4f, 0x30, 0x32, 0x27, 0x21, 0x8b, 0x19, 0xb9, 0x17, 0x20, 0x33, 0x87, - 0x91, 0x99, 0xd4, 0x4d, 0x19, 0x53, 0xb9, 0x9f, 0xd4, 0x6b, 0xb6, 0x3b, 0x5e, 0x8a, 0xad, 0x94, - 0x93, 0x7a, 0x2d, 0xc4, 0x61, 0xb4, 0x74, 0x63, 0xec, 0x43, 0xee, 0xab, 0x0e, 0xda, 0x1e, 0x86, - 0x44, 0x87, 0xcc, 0x33, 0xbc, 0x2e, 0x2b, 0xbb, 0xca, 0x7b, 0x79, 0xca, 0x4d, 0xb2, 0x03, 0x9b, - 0x89, 0x3d, 0xbe, 0xc4, 0xb2, 0x2a, 0x7c, 0xe9, 0xc1, 0xf8, 0x10, 0x72, 0xa7, 0x18, 0x46, 0x3e, - 0x0b, 0x78, 0xc0, 0x85, 0x7d, 0xce, 0x42, 0x01, 0x2a, 0xd1, 0xf4, 0x20, 0xbc, 0x7e, 0xc0, 0x42, - 0x01, 0xe3, 0x5e, 0x7e, 0x30, 0x2c, 0x28, 0xf5, 0xd9, 0x33, 0x0c, 0x8e, 0xfc, 0x21, 0xc6, 0xfe, - 0x05, 0xf2, 0xef, 0xe1, 0xd5, 0x44, 0x40, 0x35, 0xca, 0x4d, 0xee, 0x09, 0x9c, 0xa1, 0x80, 0x69, - 0x94, 0x9b, 0xdc, 0xe3, 0xdb, 0x71, 0x39, 0x93, 0x7a, 0x7c, 0x3b, 0x36, 0x5e, 0x28, 0xb0, 0xf3, - 0xc4, 0x39, 0x47, 0x37, 0xee, 0x61, 0xc4, 0x93, 0x68, 0xb1, 0x20, 0xc6, 0xab, 0x98, 0x7c, 0x0e, - 0x5a, 0x82, 0xa1, 0x23, 0xf8, 0xb6, 0xeb, 0x0f, 0xcd, 0x25, 0x79, 0xcc, 0x55, 0x30, 0xf3, 0x14, - 0x43, 0x87, 0x0a, 0x24, 0xd9, 0x87, 0x9c, 0xed, 0x79, 0x21, 0x46, 0x91, 0x48, 0xa1, 0x50, 0xbf, - 0xbf, 0x40, 0xc2, 0xe5, 0x33, 0x1b, 0xe9, 0x35, 0x9d, 0xc6, 0x19, 0xe7, 0xa0, 0x71, 0x02, 0xb2, - 0x03, 0xfa, 0xa9, 0x45, 0x9b, 0x83, 0xa7, 0xc7, 0xbd, 0x13, 0xab, 0xd5, 0x7d, 0xdc, 0xb5, 0xda, - 0xfa, 0x06, 0xc9, 0x41, 0xe6, 0xe4, 0x69, 0x5f, 0x57, 0xb8, 0x71, 0x68, 0xf5, 0x75, 0x95, 0x6c, - 0x81, 0xd6, 0xb1, 0x1a, 0x6d, 0x3d, 0x43, 0x00, 0xb2, 0x3d, 0xab, 0x41, 0x5b, 0x1d, 0x5d, 0xe3, - 0x76, 0xdb, 0x3a, 0xb2, 0xfa, 0x96, 0xbe, 0x49, 0xf2, 0xb0, 0x49, 0x1b, 0xc7, 0x87, 0x96, 0x9e, - 0x25, 0x25, 0xc8, 0x0b, 0xb3, 0xd3, 0xe8, 0x75, 0xf4, 0x9c, 0xf1, 0x87, 0x0a, 0x45, 0x99, 0xbc, - 0x10, 0x92, 0x7c, 0x04, 0x9a, 0xc3, 0xbc, 0xf4, 0xc5, 0x0a, 0xf5, 0xb7, 0x57, 0x54, 0xbc, 0x18, - 0x6e, 0x36, 0x99, 0x77, 0x4d, 0x05, 0x82, 0x7c, 0x02, 0xf9, 0xc8, 0x1f, 0x05, 0x76, 0x7c, 0x19, - 0xa2, 0xac, 0xf5, 0xcd, 0x55, 0xf0, 0x69, 0x0c, 0x9d, 0x87, 0x57, 0x5e, 0x28, 0xa0, 0x71, 0x2a, - 0xb2, 0x0d, 0xaa, 0xef, 0x89, 0x8f, 0x17, 0xa9, 0xea, 0x7b, 0xa4, 0x0e, 0x5b, 0xec, 0xdb, 0x00, - 0xc3, 0x81, 0xef, 0xad, 0xd3, 0xef, 0x09, 0xbf, 0xef, 0xb6, 0x69, 0x4e, 0x04, 0x76, 0x3d, 0xf2, - 0x08, 0xb6, 0xc6, 0xb2, 0x1f, 0xc4, 0x23, 0x17, 0xea, 0xbb, 0x2b, 0xf2, 0x78, 0xa9, 0x6f, 0xe8, - 0x0c, 0x41, 0x1e, 0x40, 0x21, 0x4a, 0x2b, 0x1c, 0xf0, 0xce, 0xd5, 0x44, 0x2a, 0x20, 0x5d, 0x5f, - 0xe0, 0x35, 0x69, 0x40, 0x96, 0x89, 0x47, 0x2f, 0x6f, 0x0a, 0xf2, 0x77, 0xef, 0xd8, 0x15, 0x9d, - 0x0d, 0x2a, 0x81, 0xcd, 0x3c, 0xe4, 0xdc, 0xd4, 0x69, 0x3c, 0x57, 0xa1, 0xd0, 0x44, 0x3b, 0xc4, - 0x30, 0xd5, 0xff, 0xe0, 0x25, 0xfd, 0xdf, 0x5a, 0xc1, 0xbd, 0x10, 0xfd, 0x4f, 0xc9, 0xff, 0xc3, - 0x54, 0xfe, 0x03, 0x00, 0xb4, 0xdd, 0xf1, 0x20, 0xb6, 0x9d, 0x31, 0xca, 0x1c, 0xca, 0x0b, 0x2c, - 0xb6, 0x3b, 0x36, 0xad, 0x46, 0xeb, 0xa8, 0xcf, 0xef, 0x69, 0x9e, 0xc7, 0x0a, 0xf3, 0xdf, 0x7f, - 0x27, 0xe3, 0x77, 0x15, 0xee, 0x51, 0xfc, 0xe6, 0x12, 0xa3, 0xf8, 0x4b, 0x8c, 0x6d, 0xb9, 0x6f, - 0x3e, 0x80, 0x5c, 0x92, 0xee, 0x11, 0x99, 0x7d, 0x65, 0x05, 0xa5, 0xdc, 0x34, 0x74, 0x1a, 0xca, - 0x97, 0x0b, 0x4e, 0x98, 0x7b, 0x26, 0xb7, 0x44, 0x7a, 0xe0, 0x7b, 0x22, 0x8e, 0xc7, 0x22, 0xb5, - 0x12, 0xe5, 0x26, 0x39, 0x80, 0xfc, 0xd5, 0xe0, 0x4c, 0x7c, 0x29, 0x2a, 0x6b, 0xbb, 0x99, 0x35, - 0xfc, 0x72, 0xf9, 0xd1, 0xad, 0xab, 0xd4, 0x88, 0x48, 0x1b, 0x4a, 0xd3, 0xa6, 0x8a, 0x79, 0x3d, - 0xb2, 0x75, 0x1e, 0xfc, 0xc5, 0x78, 0xd1, 0x62, 0xb4, 0x38, 0x9b, 0x0d, 0x28, 0x3a, 0xe2, 0xf1, - 0x25, 0x49, 0x56, 0x90, 0x54, 0x5f, 0xdd, 0x23, 0xb4, 0xe0, 0x2c, 0xb4, 0xd7, 0x23, 0xc8, 0xb2, - 0xd0, 0x1f, 0xf9, 0x41, 0x39, 0xb7, 0x76, 0xc0, 0x97, 0x54, 0xa5, 0x12, 0x63, 0xfc, 0xa6, 0x00, - 0xa1, 0x18, 0x4d, 0x58, 0x10, 0xe1, 0x7f, 0x5f, 0xf4, 0xcf, 0x66, 0xb5, 0xa6, 0x6a, 0xbf, 0xb3, - 0xb2, 0xd6, 0xdb, 0xd5, 0xcc, 0x8a, 0xdd, 0x87, 0xfc, 0x6c, 0x58, 0x16, 0x7f, 0xc7, 0x8a, 0xe9, - 0xef, 0x18, 0x01, 0x8d, 0x0f, 0x90, 0xc8, 0xbe, 0x48, 0x85, 0x6d, 0xfc, 0xa8, 0xc2, 0xeb, 0x52, - 0xbd, 0x53, 0x0c, 0xfd, 0xa1, 0xef, 0xda, 0xb1, 0xcf, 0x02, 0x29, 0x53, 0x0b, 0xb6, 0xf9, 0xa4, - 0x0e, 0xe6, 0x63, 0xaa, 0xdc, 0x61, 0x4c, 0x4b, 0x1c, 0x33, 0x4f, 0xa4, 0x05, 0xdb, 0x17, 0x18, - 0xdb, 0x83, 0xbf, 0x37, 0xeb, 0x25, 0x8e, 0x99, 0x93, 0x1c, 0x82, 0x9e, 0x16, 0xb9, 0x40, 0x93, - 0xb9, 0x03, 0xcd, 0x6b, 0x29, 0x6a, 0x4e, 0xd4, 0x9e, 0x49, 0xac, 0x09, 0xf8, 0xc3, 0xf5, 0xed, - 0xb4, 0x2c, 0xc8, 0x4c, 0xe9, 0xe7, 0x2a, 0x54, 0xa6, 0x0f, 0xf1, 0xff, 0xd0, 0xcd, 0xba, 0xa5, - 0xdb, 0xde, 0x2b, 0x5a, 0x73, 0xbd, 0x70, 0x4d, 0xe7, 0xa7, 0x9b, 0xaa, 0xf2, 0xf3, 0x4d, 0x55, - 0xf9, 0xe5, 0xa6, 0xaa, 0x7c, 0xf7, 0x6b, 0x75, 0xe3, 0xeb, 0x8f, 0x47, 0x7e, 0x7c, 0x76, 0xe9, - 0x98, 0x2e, 0xbb, 0xa8, 0x05, 0xd1, 0xc4, 0x75, 0xf7, 0x3c, 0x4c, 0x6a, 0x01, 0xb2, 0x61, 0xb4, - 0x67, 0x4f, 0xfc, 0xbd, 0x11, 0xab, 0xdd, 0xfa, 0xff, 0xf7, 0xa9, 0x3c, 0x7c, 0xaf, 0xee, 0x1c, - 0x23, 0x7b, 0xdc, 0x33, 0x1b, 0x27, 0x5d, 0x9e, 0x46, 0x2f, 0x75, 0x3b, 0x59, 0xf1, 0x9f, 0xee, - 0xfd, 0x3f, 0x03, 0x00, 0x00, 0xff, 0xff, 0x0c, 0x60, 0x03, 0xc2, 0x38, 0x0a, 0x00, 0x00, -} - -func (m *XHeader) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *XHeader) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *XHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.Value) > 0 { - i -= len(m.Value) - copy(dAtA[i:], m.Value) - i = encodeVarintTypes(dAtA, i, uint64(len(m.Value))) - i-- - dAtA[i] = 0x12 - } - if len(m.Key) > 0 { - i -= len(m.Key) - copy(dAtA[i:], m.Key) - i = encodeVarintTypes(dAtA, i, uint64(len(m.Key))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Version) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Version) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Version) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.Minor != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.Minor)) - i-- - dAtA[i] = 0x10 - } - if m.Major != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.Major)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *TokenLifetime) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *TokenLifetime) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *TokenLifetime) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.Iat != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.Iat)) - i-- - dAtA[i] = 0x18 - } - if m.Nbf != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.Nbf)) - i-- - dAtA[i] = 0x10 - } - if m.Exp != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.Exp)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil +var fileDescriptor_6bbc551f310b2b05 = []byte{ + // 840 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x56, 0xdd, 0x6e, 0x1b, 0x45, + 0x14, 0xce, 0xae, 0x37, 0x76, 0x7c, 0x1c, 0x87, 0xed, 0x28, 0x52, 0x5d, 0x23, 0xa5, 0x91, 0x05, + 0x22, 0x17, 0xcd, 0x5a, 0x59, 0x2e, 0x00, 0x41, 0xa5, 0xda, 0xf1, 0xb6, 0xb6, 0x28, 0x69, 0x34, + 0x4e, 0x23, 0xc4, 0x8d, 0xb5, 0x3f, 0xc7, 0xce, 0xb6, 0xce, 0x8e, 0xd9, 0x99, 0x2c, 0xf1, 0x9b, + 0xf0, 0x0c, 0x20, 0xde, 0x83, 0xcb, 0x5e, 0xf0, 0x00, 0x28, 0x5c, 0x20, 0xf1, 0x02, 0xdc, 0xa2, + 0x99, 0x1d, 0x3b, 0x26, 0x8e, 0x49, 0xb8, 0x43, 0xdc, 0x9d, 0xd9, 0x39, 0xdf, 0x37, 0xdf, 0xf7, + 0xcd, 0xf1, 0xc8, 0xf0, 0x7e, 0xe6, 0x36, 0x39, 0x72, 0x1e, 0xb3, 0xa4, 0x39, 0x4a, 0x27, 0x61, + 0x53, 0x4c, 0x27, 0xc8, 0x9d, 0x49, 0xca, 0x04, 0x23, 0x0f, 0x12, 0x64, 0xce, 0x90, 0x3b, 0x99, + 0xeb, 0xe8, 0x9e, 0x7a, 0x2d, 0x73, 0x9b, 0x29, 0x0e, 0xf9, 0x52, 0x73, 0xfd, 0x61, 0xe6, 0x36, + 0xfd, 0x70, 0xbc, 0xb4, 0xd1, 0xf8, 0xd3, 0x80, 0xed, 0x57, 0xc1, 0x1b, 0x0c, 0x45, 0x3f, 0x27, + 0x39, 0x64, 0x89, 0xc0, 0x4b, 0x41, 0x9e, 0x81, 0x95, 0x61, 0x1a, 0xd4, 0x8c, 0x5d, 0x63, 0x6f, + 0xcb, 0x7d, 0xe2, 0x2c, 0x9d, 0xe6, 0xdc, 0x06, 0x73, 0x4e, 0x31, 0x0d, 0xa8, 0x42, 0x92, 0x03, + 0x28, 0xf9, 0x51, 0x94, 0x22, 0xe7, 0x35, 0x73, 0xd7, 0xd8, 0xab, 0xb8, 0x0f, 0x17, 0x48, 0xa4, + 0x4c, 0xa7, 0x95, 0x6f, 0xd3, 0x59, 0x5f, 0xe3, 0x0d, 0x58, 0x92, 0x80, 0x6c, 0x83, 0x7d, 0xea, + 0xd1, 0xf6, 0xe0, 0xf5, 0x51, 0xff, 0xd8, 0x3b, 0xec, 0x3d, 0xef, 0x79, 0x1d, 0x7b, 0x8d, 0x94, + 0xa0, 0x70, 0xfc, 0xfa, 0xc4, 0x36, 0x64, 0xf1, 0xc2, 0x3b, 0xb1, 0x4d, 0xb2, 0x01, 0x56, 0xd7, + 0x6b, 0x75, 0xec, 0x02, 0x01, 0x28, 0xf6, 0xbd, 0x16, 0x3d, 0xec, 0xda, 0x96, 0xac, 0x3b, 0xde, + 0x4b, 0xef, 0xc4, 0xb3, 0xd7, 0x49, 0x19, 0xd6, 0x69, 0xeb, 0xe8, 0x85, 0x67, 0x17, 0x49, 0x15, + 0xca, 0xaa, 0xec, 0xb6, 0xfa, 0x5d, 0xbb, 0xd4, 0xf8, 0xa5, 0x00, 0x9b, 0x5a, 0xfc, 0x09, 0x7b, + 0x8b, 0x09, 0xf9, 0x14, 0xac, 0x80, 0x45, 0x53, 0xe5, 0xb8, 0xe2, 0x7e, 0x70, 0x8b, 0xe3, 0xc5, + 0x76, 0xa7, 0xcd, 0xa2, 0x29, 0x55, 0x08, 0xf2, 0x09, 0x94, 0x79, 0x3c, 0x4a, 0x7c, 0x71, 0x91, + 0xa2, 0xf6, 0xfa, 0xe8, 0xa6, 0xd7, 0xfe, 0xac, 0x81, 0x5e, 0xf7, 0xd6, 0xdf, 0x99, 0x60, 0x49, + 0x1e, 0xb2, 0x05, 0x66, 0x1c, 0xa9, 0x93, 0x37, 0xa9, 0x19, 0x47, 0xc4, 0x85, 0x0d, 0xf6, 0x5d, + 0x82, 0xe9, 0x20, 0x8e, 0x56, 0x85, 0xf7, 0x4a, 0xee, 0xf7, 0x3a, 0xb4, 0xa4, 0x1a, 0x7b, 0x11, + 0x39, 0x82, 0x8d, 0x71, 0x3c, 0x44, 0x11, 0x9f, 0x63, 0xad, 0xa0, 0x30, 0xee, 0x7d, 0x3c, 0x38, + 0xaa, 0x7c, 0xa9, 0x91, 0x74, 0xce, 0x41, 0x1e, 0x43, 0x45, 0x83, 0x06, 0x6f, 0x71, 0x5a, 0xb3, + 0x94, 0x38, 0xd0, 0x9f, 0xbe, 0xc4, 0x29, 0x69, 0x41, 0x91, 0xa9, 0x19, 0xa8, 0xad, 0xab, 0xe3, + 0x3e, 0xba, 0xe7, 0x90, 0x74, 0xd7, 0xa8, 0x06, 0xd6, 0x3d, 0xa8, 0xfe, 0xed, 0x78, 0x62, 0x43, + 0x01, 0x2f, 0x27, 0x2a, 0x09, 0x8b, 0xca, 0x52, 0x7e, 0x49, 0x82, 0xa1, 0x4a, 0xc1, 0xa2, 0xb2, + 0x94, 0x5f, 0x62, 0x5f, 0x28, 0x8f, 0x16, 0x95, 0x65, 0xbb, 0x0c, 0xa5, 0x30, 0xe7, 0x6e, 0x1c, + 0x40, 0xe9, 0xeb, 0x2e, 0xfa, 0x11, 0xa6, 0xb2, 0x4f, 0x0a, 0x97, 0x5c, 0x65, 0x2a, 0x4b, 0xb2, + 0x0d, 0xeb, 0x99, 0x3f, 0xbe, 0xc8, 0x2f, 0xa9, 0x4c, 0xf3, 0x45, 0xe3, 0x0f, 0x13, 0x1e, 0x50, + 0xfc, 0xf6, 0x02, 0xb9, 0xf8, 0x0a, 0x85, 0xaf, 0xd1, 0x07, 0x50, 0xca, 0x30, 0x95, 0xb2, 0xf5, + 0x44, 0x2c, 0xdd, 0xc0, 0x69, 0xbe, 0x4d, 0x67, 0x7d, 0x92, 0x1e, 0x27, 0x2c, 0x3c, 0xd3, 0x62, + 0xf3, 0x85, 0x94, 0x21, 0xc4, 0x58, 0xc9, 0xad, 0x52, 0x59, 0xca, 0x79, 0xb9, 0x1c, 0x9c, 0xa9, + 0x63, 0x78, 0xcd, 0xda, 0x2d, 0xec, 0x55, 0xdc, 0xfa, 0x2d, 0xd9, 0x69, 0x1f, 0x74, 0xe3, 0x32, + 0x2f, 0x38, 0xe9, 0x40, 0x75, 0x76, 0x25, 0x42, 0xc6, 0xa6, 0x83, 0x7f, 0x7c, 0xc7, 0x3d, 0xd3, + 0x4d, 0xbe, 0x38, 0xe8, 0x4f, 0x61, 0x33, 0x40, 0x3f, 0xc5, 0x54, 0x93, 0x14, 0x15, 0xc9, 0xa2, + 0x02, 0x3f, 0x1c, 0x3b, 0x6d, 0xd5, 0x92, 0xe3, 0x2b, 0xc1, 0xf5, 0x82, 0x7c, 0x01, 0x45, 0x96, + 0xc6, 0xa3, 0x38, 0xa9, 0x95, 0x56, 0xfe, 0x52, 0x96, 0xe2, 0xa4, 0x1a, 0xd3, 0xf8, 0xdd, 0x00, + 0x42, 0x91, 0x4f, 0x58, 0xc2, 0xf1, 0x3f, 0x9e, 0xf6, 0xd3, 0xb9, 0xd1, 0x3c, 0xe6, 0x0f, 0x6f, + 0x35, 0x7a, 0xd3, 0xca, 0xdc, 0xe9, 0x8f, 0x26, 0x3c, 0xd2, 0x39, 0x9c, 0x62, 0x1a, 0x0f, 0xe3, + 0xd0, 0x17, 0x31, 0x4b, 0xb4, 0xe1, 0x67, 0xb0, 0x25, 0xdf, 0x8e, 0xc1, 0xf5, 0xc3, 0x61, 0xdc, + 0xf5, 0x70, 0x54, 0x25, 0x60, 0xbe, 0x94, 0x0c, 0xe7, 0x28, 0xfc, 0xc1, 0xbf, 0x78, 0x7a, 0xaa, + 0x12, 0x70, 0xcd, 0xd0, 0x01, 0x3b, 0xd7, 0xba, 0xc0, 0x51, 0xb8, 0x8b, 0xe3, 0xbd, 0x1c, 0xb2, + 0xc8, 0x32, 0x8b, 0xc9, 0x52, 0xd8, 0x27, 0xab, 0xe7, 0x61, 0x39, 0x87, 0x79, 0x5a, 0x3f, 0x99, + 0x50, 0x9f, 0x85, 0xf9, 0xbf, 0x8e, 0xcb, 0xbb, 0x11, 0xd7, 0xfe, 0x3f, 0x4c, 0xd5, 0xea, 0xbc, + 0xda, 0xc1, 0xcf, 0x57, 0x3b, 0xc6, 0xbb, 0xab, 0x1d, 0xe3, 0xd7, 0xab, 0x1d, 0xe3, 0xfb, 0xdf, + 0x76, 0xd6, 0xbe, 0xf9, 0x6c, 0x14, 0x8b, 0xb3, 0x8b, 0xc0, 0x09, 0xd9, 0x79, 0x33, 0xe1, 0x93, + 0x30, 0xdc, 0x8f, 0x30, 0x6b, 0x26, 0xc8, 0x86, 0x7c, 0xdf, 0x9f, 0xc4, 0xfb, 0x23, 0xd6, 0xbc, + 0xf1, 0x7f, 0xe2, 0x73, 0xbd, 0xf8, 0xc1, 0xdc, 0x3e, 0x42, 0xf6, 0xbc, 0xef, 0xb4, 0x8e, 0x7b, + 0x52, 0x86, 0x7e, 0x3b, 0x82, 0xa2, 0xfa, 0x8f, 0xf0, 0xf1, 0x5f, 0x01, 0x00, 0x00, 0xff, 0xff, + 0x00, 0x73, 0x57, 0xf8, 0x88, 0x08, 0x00, 0x00, } func (m *ObjectSessionContext) Marshal() (dAtA []byte, err error) { @@ -1404,7 +1033,7 @@ func (m *SessionToken_Body_Object) MarshalToSizedBuffer(dAtA []byte) (int, error } return len(dAtA) - i, nil } -func (m *BearerToken) Marshal() (dAtA []byte, err error) { +func (m *SessionToken_Body_TokenLifetime) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1414,12 +1043,12 @@ func (m *BearerToken) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *BearerToken) MarshalTo(dAtA []byte) (int, error) { +func (m *SessionToken_Body_TokenLifetime) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *BearerToken) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *SessionToken_Body_TokenLifetime) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1428,34 +1057,25 @@ func (m *BearerToken) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } - if m.Signature != nil { - { - size, err := m.Signature.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } + if m.Iat != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Iat)) i-- - dAtA[i] = 0x12 + dAtA[i] = 0x18 } - if m.Body != nil { - { - size, err := m.Body.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } + if m.Nbf != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Nbf)) i-- - dAtA[i] = 0xa + dAtA[i] = 0x10 + } + if m.Exp != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Exp)) + i-- + dAtA[i] = 0x8 } return len(dAtA) - i, nil } -func (m *BearerToken_Body) Marshal() (dAtA []byte, err error) { +func (m *XHeader) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1465,12 +1085,12 @@ func (m *BearerToken_Body) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *BearerToken_Body) MarshalTo(dAtA []byte) (int, error) { +func (m *XHeader) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *BearerToken_Body) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *XHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1479,39 +1099,17 @@ func (m *BearerToken_Body) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } - if m.Lifetime != nil { - { - size, err := m.Lifetime.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if m.OwnerId != nil { - { - size, err := m.OwnerId.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } + if len(m.Value) > 0 { + i -= len(m.Value) + copy(dAtA[i:], m.Value) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Value))) i-- dAtA[i] = 0x12 } - if m.EaclTable != nil { - { - size, err := m.EaclTable.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } + if len(m.Key) > 0 { + i -= len(m.Key) + copy(dAtA[i:], m.Key) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Key))) i-- dAtA[i] = 0xa } @@ -1692,47 +1290,6 @@ func (m *ResponseMetaHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *Signature) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Signature) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Signature) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.Sign) > 0 { - i -= len(m.Sign) - copy(dAtA[i:], m.Sign) - i = encodeVarintTypes(dAtA, i, uint64(len(m.Sign))) - i-- - dAtA[i] = 0x12 - } - if len(m.Key) > 0 { - i -= len(m.Key) - copy(dAtA[i:], m.Key) - i = encodeVarintTypes(dAtA, i, uint64(len(m.Key))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - func (m *RequestVerificationHeader) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -1894,65 +1451,6 @@ func encodeVarintTypes(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } -func (m *XHeader) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Key) - if l > 0 { - n += 1 + l + sovTypes(uint64(l)) - } - l = len(m.Value) - if l > 0 { - n += 1 + l + sovTypes(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *Version) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Major != 0 { - n += 1 + sovTypes(uint64(m.Major)) - } - if m.Minor != 0 { - n += 1 + sovTypes(uint64(m.Minor)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *TokenLifetime) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Exp != 0 { - n += 1 + sovTypes(uint64(m.Exp)) - } - if m.Nbf != 0 { - n += 1 + sovTypes(uint64(m.Nbf)) - } - if m.Iat != 0 { - n += 1 + sovTypes(uint64(m.Iat)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - func (m *ObjectSessionContext) Size() (n int) { if m == nil { return 0 @@ -2035,19 +1533,20 @@ func (m *SessionToken_Body_Object) Size() (n int) { } return n } -func (m *BearerToken) Size() (n int) { +func (m *SessionToken_Body_TokenLifetime) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.Body != nil { - l = m.Body.Size() - n += 1 + l + sovTypes(uint64(l)) + if m.Exp != 0 { + n += 1 + sovTypes(uint64(m.Exp)) } - if m.Signature != nil { - l = m.Signature.Size() - n += 1 + l + sovTypes(uint64(l)) + if m.Nbf != 0 { + n += 1 + sovTypes(uint64(m.Nbf)) + } + if m.Iat != 0 { + n += 1 + sovTypes(uint64(m.Iat)) } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) @@ -2055,22 +1554,18 @@ func (m *BearerToken) Size() (n int) { return n } -func (m *BearerToken_Body) Size() (n int) { +func (m *XHeader) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.EaclTable != nil { - l = m.EaclTable.Size() + l = len(m.Key) + if l > 0 { n += 1 + l + sovTypes(uint64(l)) } - if m.OwnerId != nil { - l = m.OwnerId.Size() - n += 1 + l + sovTypes(uint64(l)) - } - if m.Lifetime != nil { - l = m.Lifetime.Size() + l = len(m.Value) + if l > 0 { n += 1 + l + sovTypes(uint64(l)) } if m.XXX_unrecognized != nil { @@ -2151,26 +1646,6 @@ func (m *ResponseMetaHeader) Size() (n int) { return n } -func (m *Signature) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Key) - if l > 0 { - n += 1 + l + sovTypes(uint64(l)) - } - l = len(m.Sign) - if l > 0 { - n += 1 + l + sovTypes(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - func (m *RequestVerificationHeader) Size() (n int) { if m == nil { return 0 @@ -2233,327 +1708,6 @@ func sovTypes(x uint64) (n int) { func sozTypes(x uint64) (n int) { return sovTypes(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } -func (m *XHeader) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: XHeader: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: XHeader: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Key = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Value = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Version) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Version: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Version: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Major", wireType) - } - m.Major = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Major |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Minor", wireType) - } - m.Minor = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Minor |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *TokenLifetime) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: TokenLifetime: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: TokenLifetime: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Exp", wireType) - } - m.Exp = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Exp |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Nbf", wireType) - } - m.Nbf = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Nbf |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Iat", wireType) - } - m.Iat = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Iat |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func (m *ObjectSessionContext) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2758,7 +1912,7 @@ func (m *SessionToken) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.Signature == nil { - m.Signature = &Signature{} + m.Signature = &grpc.Signature{} } if err := m.Signature.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -2918,7 +2072,7 @@ func (m *SessionToken_Body) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.Lifetime == nil { - m.Lifetime = &TokenLifetime{} + m.Lifetime = &SessionToken_Body_TokenLifetime{} } if err := m.Lifetime.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -3018,7 +2172,7 @@ func (m *SessionToken_Body) Unmarshal(dAtA []byte) error { } return nil } -func (m *BearerToken) Unmarshal(dAtA []byte) error { +func (m *SessionToken_Body_TokenLifetime) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3041,17 +2195,17 @@ func (m *BearerToken) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: BearerToken: wiretype end group for non-group") + return fmt.Errorf("proto: TokenLifetime: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: BearerToken: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: TokenLifetime: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Body", wireType) + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Exp", wireType) } - var msglen int + m.Exp = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTypes @@ -3061,33 +2215,16 @@ func (m *BearerToken) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + m.Exp |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Body == nil { - m.Body = &BearerToken_Body{} - } - if err := m.Body.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Signature", wireType) + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Nbf", wireType) } - var msglen int + m.Nbf = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTypes @@ -3097,28 +2234,30 @@ func (m *BearerToken) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + m.Nbf |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { - return ErrInvalidLengthTypes + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Iat", wireType) } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes + m.Iat = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Iat |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Signature == nil { - m.Signature = &Signature{} - } - if err := m.Signature.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTypes(dAtA[iNdEx:]) @@ -3144,7 +2283,7 @@ func (m *BearerToken) Unmarshal(dAtA []byte) error { } return nil } -func (m *BearerToken_Body) Unmarshal(dAtA []byte) error { +func (m *XHeader) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3167,17 +2306,17 @@ func (m *BearerToken_Body) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: Body: wiretype end group for non-group") + return fmt.Errorf("proto: XHeader: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: Body: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: XHeader: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field EaclTable", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTypes @@ -3187,33 +2326,29 @@ func (m *BearerToken_Body) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthTypes } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthTypes } if postIndex > l { return io.ErrUnexpectedEOF } - if m.EaclTable == nil { - m.EaclTable = &grpc1.EACLTable{} - } - if err := m.EaclTable.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.Key = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OwnerId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTypes @@ -3223,63 +2358,23 @@ func (m *BearerToken_Body) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthTypes } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthTypes } if postIndex > l { return io.ErrUnexpectedEOF } - if m.OwnerId == nil { - m.OwnerId = &grpc.OwnerID{} - } - if err := m.OwnerId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Lifetime", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Lifetime == nil { - m.Lifetime = &TokenLifetime{} - } - if err := m.Lifetime.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.Value = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -3365,7 +2460,7 @@ func (m *RequestMetaHeader) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.Version == nil { - m.Version = &Version{} + m.Version = &grpc.Version{} } if err := m.Version.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -3509,7 +2604,7 @@ func (m *RequestMetaHeader) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.BearerToken == nil { - m.BearerToken = &BearerToken{} + m.BearerToken = &grpc1.BearerToken{} } if err := m.BearerToken.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -3635,7 +2730,7 @@ func (m *ResponseMetaHeader) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.Version == nil { - m.Version = &Version{} + m.Version = &grpc.Version{} } if err := m.Version.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -3774,128 +2869,6 @@ func (m *ResponseMetaHeader) Unmarshal(dAtA []byte) error { } return nil } -func (m *Signature) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Signature: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Signature: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Key = append(m.Key[:0], dAtA[iNdEx:postIndex]...) - if m.Key == nil { - m.Key = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Sign", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Sign = append(m.Sign[:0], dAtA[iNdEx:postIndex]...) - if m.Sign == nil { - m.Sign = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func (m *RequestVerificationHeader) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -3955,7 +2928,7 @@ func (m *RequestVerificationHeader) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.BodySignature == nil { - m.BodySignature = &Signature{} + m.BodySignature = &grpc.Signature{} } if err := m.BodySignature.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -3991,7 +2964,7 @@ func (m *RequestVerificationHeader) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.MetaSignature == nil { - m.MetaSignature = &Signature{} + m.MetaSignature = &grpc.Signature{} } if err := m.MetaSignature.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -4027,7 +3000,7 @@ func (m *RequestVerificationHeader) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.OriginSignature == nil { - m.OriginSignature = &Signature{} + m.OriginSignature = &grpc.Signature{} } if err := m.OriginSignature.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -4153,7 +3126,7 @@ func (m *ResponseVerificationHeader) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.BodySignature == nil { - m.BodySignature = &Signature{} + m.BodySignature = &grpc.Signature{} } if err := m.BodySignature.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -4189,7 +3162,7 @@ func (m *ResponseVerificationHeader) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.MetaSignature == nil { - m.MetaSignature = &Signature{} + m.MetaSignature = &grpc.Signature{} } if err := m.MetaSignature.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -4225,7 +3198,7 @@ func (m *ResponseVerificationHeader) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.OriginSignature == nil { - m.OriginSignature = &Signature{} + m.OriginSignature = &grpc.Signature{} } if err := m.OriginSignature.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err diff --git a/v2/storagegroup/grpc/types.pb.go b/v2/storagegroup/grpc/types.pb.go index 91dae60..212d7ce 100644 --- a/v2/storagegroup/grpc/types.pb.go +++ b/v2/storagegroup/grpc/types.pb.go @@ -33,7 +33,7 @@ type StorageGroup struct { // payloads of the storage group members // The order of concatenation is the same as the order of the members in the // Members field. - ValidationHash []byte `protobuf:"bytes,2,opt,name=validation_hash,json=validationHash,proto3" json:"validation_hash,omitempty"` + ValidationHash *grpc.Checksum `protobuf:"bytes,2,opt,name=validation_hash,json=validationHash,proto3" json:"validation_hash,omitempty"` // expiration_epoch carries last NeoFS epoch number of the storage group // lifetime. ExpirationEpoch uint64 `protobuf:"varint,3,opt,name=expiration_epoch,json=expirationEpoch,proto3" json:"expiration_epoch,omitempty"` @@ -85,7 +85,7 @@ func (m *StorageGroup) GetValidationDataSize() uint64 { return 0 } -func (m *StorageGroup) GetValidationHash() []byte { +func (m *StorageGroup) GetValidationHash() *grpc.Checksum { if m != nil { return m.ValidationHash } @@ -113,26 +113,27 @@ func init() { func init() { proto.RegisterFile("v2/storagegroup/grpc/types.proto", fileDescriptor_f1685cc94b670845) } var fileDescriptor_f1685cc94b670845 = []byte{ - // 301 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x90, 0xcd, 0x4a, 0x33, 0x31, - 0x18, 0x85, 0xbf, 0xb4, 0xe5, 0x13, 0x62, 0xb1, 0x12, 0x44, 0xa2, 0x8b, 0x61, 0x70, 0x63, 0x5d, - 0x34, 0x91, 0x71, 0xe9, 0x4a, 0xad, 0x3f, 0xdd, 0xa8, 0xb4, 0x3b, 0x37, 0x25, 0x93, 0xbe, 0x9d, - 0x89, 0xd8, 0x49, 0x4c, 0xd2, 0x41, 0x7b, 0x25, 0x5e, 0x83, 0x57, 0xd2, 0xa5, 0x97, 0x20, 0xe3, - 0x8d, 0xc8, 0xb4, 0xc8, 0x0c, 0xe8, 0xf6, 0xc9, 0x73, 0xf2, 0x72, 0x0e, 0x0e, 0xf3, 0x88, 0x3b, - 0xaf, 0xad, 0x48, 0x20, 0xb1, 0x7a, 0x6e, 0x78, 0x62, 0x8d, 0xe4, 0xfe, 0xd5, 0x80, 0x63, 0xc6, - 0x6a, 0xaf, 0xc9, 0x6e, 0x06, 0x9a, 0x4d, 0x1d, 0xcb, 0x23, 0x56, 0x17, 0xf7, 0x69, 0x1e, 0x71, - 0x0b, 0x53, 0xf7, 0x2b, 0x71, 0xb0, 0x44, 0xb8, 0x3d, 0x5a, 0xab, 0xd7, 0xa5, 0x4a, 0x8e, 0xf1, - 0x4e, 0x2e, 0x9e, 0xd4, 0x44, 0x78, 0xa5, 0xb3, 0xf1, 0x44, 0x78, 0x31, 0x76, 0x6a, 0x01, 0x14, - 0x85, 0xa8, 0xdb, 0x1a, 0x92, 0xea, 0xad, 0x2f, 0xbc, 0x18, 0xa9, 0x05, 0x90, 0x43, 0xdc, 0xa9, - 0x25, 0x52, 0xe1, 0x52, 0xda, 0x08, 0x51, 0xb7, 0x3d, 0xdc, 0xaa, 0xf0, 0x8d, 0x70, 0x29, 0x39, - 0xc2, 0xdb, 0xf0, 0x62, 0x94, 0x5d, 0x8b, 0x60, 0xb4, 0x4c, 0x69, 0x73, 0xf5, 0x6d, 0xa7, 0xe2, - 0x97, 0x25, 0x26, 0x11, 0xde, 0x98, 0xc1, 0x2c, 0x06, 0xeb, 0x68, 0x2b, 0x6c, 0x76, 0x37, 0x23, - 0xca, 0xaa, 0x6a, 0x65, 0x13, 0x76, 0x17, 0x3f, 0x82, 0xf4, 0x83, 0xfe, 0xf0, 0x47, 0x3c, 0x7f, - 0x5e, 0x16, 0x01, 0xfa, 0x28, 0x02, 0xf4, 0x59, 0x04, 0xe8, 0xed, 0x2b, 0xf8, 0xf7, 0x70, 0x91, - 0x28, 0x9f, 0xce, 0x63, 0x26, 0xf5, 0x8c, 0x67, 0xce, 0x48, 0xd9, 0x9b, 0x40, 0xce, 0x33, 0xd0, - 0x53, 0xd7, 0x13, 0x46, 0xf5, 0x12, 0xcd, 0xff, 0x9a, 0xf4, 0xb4, 0x4e, 0xde, 0x1b, 0x7b, 0xb7, - 0xa0, 0xaf, 0x46, 0xec, 0xec, 0x7e, 0x50, 0x1e, 0xaf, 0x8f, 0x15, 0xff, 0x5f, 0x8d, 0x78, 0xf2, - 0x1d, 0x00, 0x00, 0xff, 0xff, 0xcd, 0x95, 0x67, 0x64, 0x9a, 0x01, 0x00, 0x00, + // 306 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x90, 0x3f, 0x4e, 0xc3, 0x30, + 0x18, 0xc5, 0x71, 0x5b, 0x81, 0x14, 0x10, 0x45, 0x11, 0x42, 0x86, 0x21, 0x8a, 0x98, 0xca, 0x50, + 0x1b, 0x85, 0x91, 0xa9, 0xb4, 0xfc, 0xe9, 0x02, 0xa8, 0xdd, 0x58, 0x2a, 0xc7, 0xfd, 0x1a, 0x1b, + 0x48, 0x6c, 0x6c, 0x37, 0x82, 0x9e, 0x84, 0x33, 0x70, 0x12, 0x46, 0x8e, 0x80, 0xc2, 0x45, 0x50, + 0x5a, 0xa1, 0x44, 0xa2, 0xeb, 0xf3, 0xef, 0xf9, 0xf7, 0xe9, 0x79, 0x61, 0x1e, 0x51, 0xeb, 0x94, + 0x61, 0x09, 0x24, 0x46, 0xcd, 0x35, 0x4d, 0x8c, 0xe6, 0xd4, 0xbd, 0x69, 0xb0, 0x44, 0x1b, 0xe5, + 0x94, 0x7f, 0x90, 0x81, 0x22, 0x33, 0x4b, 0xf2, 0x88, 0xd4, 0xc1, 0x23, 0x9c, 0x47, 0xd4, 0xc0, + 0xcc, 0xfe, 0x6b, 0x1c, 0x17, 0xc8, 0xdb, 0x19, 0xaf, 0xd0, 0xeb, 0x12, 0xf5, 0x4f, 0xbd, 0xfd, + 0x9c, 0x3d, 0xcb, 0x29, 0x73, 0x52, 0x65, 0x93, 0x29, 0x73, 0x6c, 0x62, 0xe5, 0x02, 0x30, 0x0a, + 0x51, 0xa7, 0x35, 0xf2, 0xab, 0xb7, 0x01, 0x73, 0x6c, 0x2c, 0x17, 0xe0, 0xf7, 0xbc, 0x76, 0xad, + 0x21, 0x98, 0x15, 0xb8, 0x11, 0xa2, 0xce, 0x76, 0x84, 0x49, 0x75, 0x4e, 0x69, 0x27, 0x7d, 0x01, + 0xfc, 0xc9, 0xce, 0xd3, 0xd1, 0x6e, 0x55, 0xb8, 0x61, 0x56, 0xf8, 0x27, 0xde, 0x1e, 0xbc, 0x6a, + 0x69, 0x56, 0x5f, 0x80, 0x56, 0x5c, 0xe0, 0xe6, 0x52, 0xd8, 0xae, 0xf2, 0xcb, 0x32, 0xf6, 0x23, + 0x6f, 0x2b, 0x85, 0x34, 0x06, 0x63, 0x71, 0x2b, 0x6c, 0xae, 0xb3, 0xdc, 0xc5, 0x8f, 0xc0, 0xdd, + 0x70, 0x30, 0xfa, 0x03, 0x2f, 0x5e, 0x3e, 0x8b, 0x00, 0x7d, 0x15, 0x01, 0xfa, 0x2e, 0x02, 0xf4, + 0xfe, 0x13, 0x6c, 0x3c, 0xf4, 0x13, 0xe9, 0xc4, 0x3c, 0x26, 0x5c, 0xa5, 0x34, 0xb3, 0x9a, 0xf3, + 0xee, 0x14, 0x72, 0x9a, 0x81, 0x9a, 0xd9, 0x2e, 0xd3, 0xb2, 0x9b, 0x28, 0xba, 0x6e, 0xec, 0xf3, + 0x7a, 0xf2, 0xd1, 0x38, 0xbc, 0x05, 0x75, 0x35, 0x26, 0xbd, 0xfb, 0x61, 0x29, 0xaf, 0xcf, 0x18, + 0x6f, 0x2e, 0xe7, 0x3d, 0xfb, 0x0d, 0x00, 0x00, 0xff, 0xff, 0x31, 0x2e, 0xd2, 0x63, 0xb4, 0x01, + 0x00, 0x00, } func (m *StorageGroup) Marshal() (dAtA []byte, err error) { @@ -178,10 +179,15 @@ func (m *StorageGroup) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x18 } - if len(m.ValidationHash) > 0 { - i -= len(m.ValidationHash) - copy(dAtA[i:], m.ValidationHash) - i = encodeVarintTypes(dAtA, i, uint64(len(m.ValidationHash))) + if m.ValidationHash != nil { + { + size, err := m.ValidationHash.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } i-- dAtA[i] = 0x12 } @@ -213,8 +219,8 @@ func (m *StorageGroup) Size() (n int) { if m.ValidationDataSize != 0 { n += 1 + sovTypes(uint64(m.ValidationDataSize)) } - l = len(m.ValidationHash) - if l > 0 { + if m.ValidationHash != nil { + l = m.ValidationHash.Size() n += 1 + l + sovTypes(uint64(l)) } if m.ExpirationEpoch != 0 { @@ -290,7 +296,7 @@ func (m *StorageGroup) Unmarshal(dAtA []byte) error { if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ValidationHash", wireType) } - var byteLen int + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTypes @@ -300,24 +306,26 @@ func (m *StorageGroup) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { + if msglen < 0 { return ErrInvalidLengthTypes } - postIndex := iNdEx + byteLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthTypes } if postIndex > l { return io.ErrUnexpectedEOF } - m.ValidationHash = append(m.ValidationHash[:0], dAtA[iNdEx:postIndex]...) if m.ValidationHash == nil { - m.ValidationHash = []byte{} + m.ValidationHash = &grpc.Checksum{} + } + if err := m.ValidationHash.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } iNdEx = postIndex case 3: From 678764802717dc774942d980c6ff088ad9ad1ac4 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Thu, 20 Aug 2020 10:59:45 +0300 Subject: [PATCH 0350/1196] Add unified checksum type in refs package Signed-off-by: Alex Vanin --- v2/refs/convert.go | 28 +++++++++++++++++++++++++++ v2/refs/grpc/types.go | 14 ++++++++++++++ v2/refs/marshal.go | 43 +++++++++++++++++++++++++++++++++++++++++ v2/refs/marshal_test.go | 19 ++++++++++++++++++ v2/refs/types.go | 42 ++++++++++++++++++++++++++++++++++++++++ 5 files changed, 146 insertions(+) diff --git a/v2/refs/convert.go b/v2/refs/convert.go index 936a920..4a84077 100644 --- a/v2/refs/convert.go +++ b/v2/refs/convert.go @@ -111,3 +111,31 @@ func AddressFromGRPCMessage(m *refs.Address) *Address { return a } + +func ChecksumToGRPCMessage(c *Checksum) *refs.Checksum { + if c == nil { + return nil + } + + m := new(refs.Checksum) + + m.SetChecksumType(refs.ChecksumType(c.GetType())) + + m.SetSum(c.GetSum()) + + return m +} + +func ChecksumFromGRPCMessage(m *refs.Checksum) *Checksum { + if m == nil { + return nil + } + + c := new(Checksum) + + c.SetType(ChecksumType(m.GetType())) + + c.SetSum(m.GetSum()) + + return c +} diff --git a/v2/refs/grpc/types.go b/v2/refs/grpc/types.go index 357b4da..e55504d 100644 --- a/v2/refs/grpc/types.go +++ b/v2/refs/grpc/types.go @@ -34,3 +34,17 @@ func (m *Address) SetObjectId(v *ObjectID) { m.ObjectId = v } } + +// SetChecksumType in generic checksum structure. +func (m *Checksum) SetChecksumType(v ChecksumType) { + if m != nil { + m.Type = v + } +} + +// SetChecksumSum in generic checksum structure. +func (m *Checksum) SetSum(v []byte) { + if m != nil { + m.Sum = v + } +} diff --git a/v2/refs/marshal.go b/v2/refs/marshal.go index 4018500..7c1f524 100644 --- a/v2/refs/marshal.go +++ b/v2/refs/marshal.go @@ -13,6 +13,9 @@ const ( addressContainerField = 1 addressObjectField = 2 + + checksumTypeField = 1 + checksumValueField = 2 ) func (o *OwnerID) StableMarshal(buf []byte) ([]byte, error) { @@ -130,3 +133,43 @@ func (a *Address) StableSize() (size int) { return size } + +func (c *Checksum) StableMarshal(buf []byte) ([]byte, error) { + if c == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, c.StableSize()) + } + + var ( + offset, n int + err error + ) + + n, err = proto.EnumMarshal(checksumTypeField, buf[offset:], int32(c.typ)) + if err != nil { + return nil, err + } + + offset += n + + _, err = proto.BytesMarshal(checksumValueField, buf[offset:], c.sum) + if err != nil { + return nil, err + } + + return buf, nil +} + +func (c *Checksum) StableSize() (size int) { + if c == nil { + return 0 + } + + size += proto.EnumSize(checksumTypeField, int32(c.typ)) + size += proto.BytesSize(checksumValueField, c.sum) + + return size +} diff --git a/v2/refs/marshal_test.go b/v2/refs/marshal_test.go index 0e9f7ac..441174e 100644 --- a/v2/refs/marshal_test.go +++ b/v2/refs/marshal_test.go @@ -87,3 +87,22 @@ func TestAddress_StableMarshal(t *testing.T) { require.Equal(t, addressFrom, addressTo) }) } + +func TestChecksum_StableMarshal(t *testing.T) { + checksumFrom := new(refs.Checksum) + transport := new(grpc.Checksum) + + t.Run("non empty", func(t *testing.T) { + checksumFrom.SetType(refs.TillichZemor) + checksumFrom.SetSum([]byte("Homomorphic Hash")) + + wire, err := checksumFrom.StableMarshal(nil) + require.NoError(t, err) + + err = transport.Unmarshal(wire) + require.NoError(t, err) + + checksumTo := refs.ChecksumFromGRPCMessage(transport) + require.Equal(t, checksumFrom, checksumTo) + }) +} diff --git a/v2/refs/types.go b/v2/refs/types.go index 269edf4..e368b62 100644 --- a/v2/refs/types.go +++ b/v2/refs/types.go @@ -18,6 +18,20 @@ type Address struct { oid *ObjectID } +type Checksum struct { + typ ChecksumType + + sum []byte +} + +type ChecksumType uint32 + +const ( + UnknownChecksum ChecksumType = iota + TillichZemor + SHA256 +) + func (o *OwnerID) GetValue() []byte { if o != nil { return o.val @@ -87,3 +101,31 @@ func (a *Address) SetObjectID(v *ObjectID) { a.oid = v } } + +func (c *Checksum) GetType() ChecksumType { + if c != nil { + return c.typ + } + + return UnknownChecksum +} + +func (c *Checksum) SetType(v ChecksumType) { + if c != nil { + c.typ = v + } +} + +func (c *Checksum) GetSum() []byte { + if c != nil { + return c.sum + } + + return nil +} + +func (c *Checksum) SetSum(v []byte) { + if c != nil { + c.sum = v + } +} From 4405492640dcd1be61293fdf0e015f6dd7e0f552 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Thu, 20 Aug 2020 11:04:16 +0300 Subject: [PATCH 0351/1196] Use checksum structure in storagegroup package Signed-off-by: Alex Vanin --- v2/storagegroup/convert.go | 8 ++++++-- v2/storagegroup/grpc/types.go | 2 +- v2/storagegroup/marshal.go | 4 ++-- v2/storagegroup/marshal_test.go | 10 +++++++++- v2/storagegroup/types.go | 6 +++--- 5 files changed, 21 insertions(+), 9 deletions(-) diff --git a/v2/storagegroup/convert.go b/v2/storagegroup/convert.go index df545f9..6712619 100644 --- a/v2/storagegroup/convert.go +++ b/v2/storagegroup/convert.go @@ -15,7 +15,9 @@ func StorageGroupToGRPCMessage(s *StorageGroup) *sg.StorageGroup { m := new(sg.StorageGroup) m.SetValidationDataSize(s.GetValidationDataSize()) - m.SetValidationHash(s.GetValidationHash()) + m.SetValidationHash( + refs.ChecksumToGRPCMessage(s.GetValidationHash()), + ) m.SetExpirationEpoch(s.GetExpirationEpoch()) members := s.GetMembers() @@ -39,7 +41,9 @@ func StorageGroupFromGRPCMessage(m *sg.StorageGroup) *StorageGroup { s := new(StorageGroup) s.SetValidationDataSize(m.GetValidationDataSize()) - s.SetValidationHash(m.GetValidationHash()) + s.SetValidationHash( + refs.ChecksumFromGRPCMessage(m.GetValidationHash()), + ) s.SetExpirationEpoch(m.GetExpirationEpoch()) memberMsg := m.GetMembers() diff --git a/v2/storagegroup/grpc/types.go b/v2/storagegroup/grpc/types.go index b1159c4..5bba1b1 100644 --- a/v2/storagegroup/grpc/types.go +++ b/v2/storagegroup/grpc/types.go @@ -12,7 +12,7 @@ func (m *StorageGroup) SetValidationDataSize(v uint64) { } // SetValidationHash sets total homomorphic hash of the storage group payloads. -func (m *StorageGroup) SetValidationHash(v []byte) { +func (m *StorageGroup) SetValidationHash(v *refs.Checksum) { if m != nil { m.ValidationHash = v } diff --git a/v2/storagegroup/marshal.go b/v2/storagegroup/marshal.go index cc1160f..33b0c15 100644 --- a/v2/storagegroup/marshal.go +++ b/v2/storagegroup/marshal.go @@ -34,7 +34,7 @@ func (s *StorageGroup) StableMarshal(buf []byte) ([]byte, error) { offset += n - n, err = proto.BytesMarshal(hashField, buf[offset:], s.hash) + n, err = proto.NestedStructureMarshal(hashField, buf[offset:], s.hash) if err != nil { return nil, err } @@ -67,7 +67,7 @@ func (s *StorageGroup) StableSize() (size int) { } size += proto.UInt64Size(sizeField, s.size) - size += proto.BytesSize(hashField, s.hash) + size += proto.NestedStructureSize(hashField, s.hash) size += proto.UInt64Size(expirationField, s.exp) for i := range s.members { diff --git a/v2/storagegroup/marshal_test.go b/v2/storagegroup/marshal_test.go index b79ed80..0b6a191 100644 --- a/v2/storagegroup/marshal_test.go +++ b/v2/storagegroup/marshal_test.go @@ -21,7 +21,7 @@ func TestStorageGroup_StableMarshal(t *testing.T) { t.Run("non empty", func(t *testing.T) { storageGroupFrom.SetValidationDataSize(300) - storageGroupFrom.SetValidationHash([]byte("Homomorphic hash value")) + storageGroupFrom.SetValidationHash(generateChecksum("Homomorphic hash")) storageGroupFrom.SetExpirationEpoch(100) storageGroupFrom.SetMembers([]*refs.ObjectID{ownerID1, ownerID2}) @@ -35,3 +35,11 @@ func TestStorageGroup_StableMarshal(t *testing.T) { require.Equal(t, storageGroupFrom, storageGroupTo) }) } + +func generateChecksum(data string) *refs.Checksum { + checksum := new(refs.Checksum) + checksum.SetType(refs.TillichZemor) + checksum.SetSum([]byte(data)) + + return checksum +} diff --git a/v2/storagegroup/types.go b/v2/storagegroup/types.go index 720bbe1..6c493ed 100644 --- a/v2/storagegroup/types.go +++ b/v2/storagegroup/types.go @@ -9,7 +9,7 @@ import ( type StorageGroup struct { size uint64 - hash []byte + hash *refs.Checksum exp uint64 @@ -33,7 +33,7 @@ func (s *StorageGroup) SetValidationDataSize(v uint64) { } // GetValidationHash of unified storage group structure. -func (s *StorageGroup) GetValidationHash() []byte { +func (s *StorageGroup) GetValidationHash() *refs.Checksum { if s != nil { return s.hash } @@ -42,7 +42,7 @@ func (s *StorageGroup) GetValidationHash() []byte { } // SetValidationHash into unified storage group structure. -func (s *StorageGroup) SetValidationHash(v []byte) { +func (s *StorageGroup) SetValidationHash(v *refs.Checksum) { if s != nil { s.hash = v } From f1addc4cc52a8d172cac7f888cebaee551e4240e Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Thu, 20 Aug 2020 11:48:35 +0300 Subject: [PATCH 0352/1196] Use checksum structure in object package Signed-off-by: Alex Vanin --- v2/object/convert.go | 24 ++++++++++++++++++---- v2/object/grpc/service.go | 14 +++++++++++++ v2/object/grpc/types.go | 4 ++-- v2/object/marshal.go | 39 ++++++++++++++++++++++++++++-------- v2/object/marshal_test.go | 14 +++++++++++-- v2/object/types.go | 42 ++++++++++++++++++++++++++++++++++----- 6 files changed, 116 insertions(+), 21 deletions(-) diff --git a/v2/object/convert.go b/v2/object/convert.go index 69df798..3f7b85a 100644 --- a/v2/object/convert.go +++ b/v2/object/convert.go @@ -196,9 +196,13 @@ func HeaderToGRPCMessage(h *Header) *object.Header { m.SetPayloadLength(h.GetPayloadLength()) - m.SetPayloadHash(h.GetPayloadHash()) + m.SetPayloadHash( + refs.ChecksumToGRPCMessage(h.GetPayloadHash()), + ) - m.SetHomomorphicHash(h.GetHomomorphicHash()) + m.SetHomomorphicHash( + refs.ChecksumToGRPCMessage(h.GetHomomorphicHash()), + ) m.SetObjectType( TypeToGRPCField(h.GetObjectType()), @@ -247,9 +251,13 @@ func HeaderFromGRPCMessage(m *object.Header) *Header { h.SetPayloadLength(m.GetPayloadLength()) - h.SetPayloadHash(m.GetPayloadHash()) + h.SetPayloadHash( + refs.ChecksumFromGRPCMessage(m.GetPayloadHash()), + ) - h.SetHomomorphicHash(m.GetHomomorphicHash()) + h.SetHomomorphicHash( + refs.ChecksumFromGRPCMessage(m.GetHomomorphicHash()), + ) h.SetObjectType( TypeFromGRPCField(m.GetObjectType()), @@ -1423,6 +1431,8 @@ func GetRangeHashRequestBodyToGRPCMessage(r *GetRangeHashRequestBody) *object.Ge m.SetRanges(rngMsg) + m.SetType(refsGRPC.ChecksumType(r.GetType())) + return m } @@ -1448,6 +1458,8 @@ func GetRangeHashRequestBodyFromGRPCMessage(m *object.GetRangeHashRequest_Body) r.SetRanges(rngs) + r.SetType(refs.ChecksumType(m.GetType())) + return r } @@ -1490,6 +1502,8 @@ func GetRangeHashResponseBodyToGRPCMessage(r *GetRangeHashResponseBody) *object. m := new(object.GetRangeHashResponse_Body) + m.SetType(refsGRPC.ChecksumType(r.GetType())) + m.SetHashList(r.GetHashList()) return m @@ -1502,6 +1516,8 @@ func GetRangeHashResponseBodyFromGRPCMessage(m *object.GetRangeHashResponse_Body r := new(GetRangeHashResponseBody) + r.SetType(refs.ChecksumType(m.GetType())) + r.SetHashList(m.GetHashList()) return r diff --git a/v2/object/grpc/service.go b/v2/object/grpc/service.go index 3ec97fc..9dda1cb 100644 --- a/v2/object/grpc/service.go +++ b/v2/object/grpc/service.go @@ -570,6 +570,13 @@ func (m *GetRangeHashRequest_Body) SetSalt(v []byte) { } } +// Set sets salt for the object payload ranges. +func (m *GetRangeHashRequest_Body) SetType(v refs.ChecksumType) { + if m != nil { + m.Type = v + } +} + // SetBody sets body of the request. func (m *GetRangeHashRequest) SetBody(v *GetRangeHashRequest_Body) { if m != nil { @@ -598,6 +605,13 @@ func (m *GetRangeHashResponse_Body) SetHashList(v [][]byte) { } } +// SetHashList returns list of the range hashes. +func (m *GetRangeHashResponse_Body) SetType(v refs.ChecksumType) { + if m != nil { + m.Type = v + } +} + // SetBody sets body of the response. func (m *GetRangeHashResponse) SetBody(v *GetRangeHashResponse_Body) { if m != nil { diff --git a/v2/object/grpc/types.go b/v2/object/grpc/types.go index b5197f6..3600765 100644 --- a/v2/object/grpc/types.go +++ b/v2/object/grpc/types.go @@ -90,7 +90,7 @@ func (m *Header) SetPayloadLength(v uint64) { } // SetPayloadHash sets hash of the object payload. -func (m *Header) SetPayloadHash(v []byte) { +func (m *Header) SetPayloadHash(v *refs.Checksum) { if m != nil { m.PayloadHash = v } @@ -104,7 +104,7 @@ func (m *Header) SetObjectType(v ObjectType) { } // SetHomomorphicHash sets homomorphic hash of the object payload. -func (m *Header) SetHomomorphicHash(v []byte) { +func (m *Header) SetHomomorphicHash(v *refs.Checksum) { if m != nil { m.HomomorphicHash = v } diff --git a/v2/object/marshal.go b/v2/object/marshal.go index 3949066..79bd131 100644 --- a/v2/object/marshal.go +++ b/v2/object/marshal.go @@ -87,8 +87,10 @@ const ( getRangeHashReqBodyAddressField = 1 getRangeHashReqBodyRangesField = 2 getRangeHashReqBodySaltField = 3 + getRangeHashReqBodyTypeField = 4 - getRangeHashRespBodyHashList = 1 + getRangeHashRespBodyTypeField = 1 + getRangeHashRespBodyHashListField = 2 ) func (h *ShortHeader) StableMarshal(buf []byte) ([]byte, error) { @@ -315,7 +317,7 @@ func (h *Header) StableMarshal(buf []byte) ([]byte, error) { offset += n - n, err = proto.BytesMarshal(hdrPayloadHashField, buf[offset:], h.payloadHash) + n, err = proto.NestedStructureMarshal(hdrPayloadHashField, buf[offset:], h.payloadHash) if err != nil { return nil, err } @@ -329,7 +331,7 @@ func (h *Header) StableMarshal(buf []byte) ([]byte, error) { offset += n - n, err = proto.BytesMarshal(hdrHomomorphicHashField, buf[offset:], h.homoHash) + n, err = proto.NestedStructureMarshal(hdrHomomorphicHashField, buf[offset:], h.homoHash) if err != nil { return nil, err } @@ -370,9 +372,9 @@ func (h *Header) StableSize() (size int) { size += proto.NestedStructureSize(hdrOwnerIDField, h.ownerID) size += proto.UInt64Size(hdrEpochField, h.creatEpoch) size += proto.UInt64Size(hdrPayloadLengthField, h.payloadLen) - size += proto.BytesSize(hdrPayloadHashField, h.payloadHash) + size += proto.NestedStructureSize(hdrPayloadHashField, h.payloadHash) size += proto.EnumSize(hdrObjectTypeField, int32(h.typ)) - size += proto.BytesSize(hdrHomomorphicHashField, h.homoHash) + size += proto.NestedStructureSize(hdrHomomorphicHashField, h.homoHash) size += proto.NestedStructureSize(hdrSessionTokenField, h.sessionToken) for i := range h.attr { size += proto.NestedStructureSize(hdrAttributesField, h.attr[i]) @@ -1130,7 +1132,14 @@ func (r *GetRangeHashRequestBody) StableMarshal(buf []byte) ([]byte, error) { offset += n } - _, err = proto.BytesMarshal(getRangeHashReqBodySaltField, buf[offset:], r.salt) + n, err = proto.BytesMarshal(getRangeHashReqBodySaltField, buf[offset:], r.salt) + if err != nil { + return nil, err + } + + offset += n + + _, err = proto.EnumMarshal(getRangeHashReqBodyTypeField, buf[offset:], int32(r.typ)) if err != nil { return nil, err } @@ -1150,6 +1159,7 @@ func (r *GetRangeHashRequestBody) StableSize() (size int) { } size += proto.BytesSize(getRangeHashReqBodySaltField, r.salt) + size += proto.EnumSize(getRangeHashReqBodyTypeField, int32(r.typ)) return size } @@ -1163,7 +1173,19 @@ func (r *GetRangeHashResponseBody) StableMarshal(buf []byte) ([]byte, error) { buf = make([]byte, r.StableSize()) } - _, err := proto.RepeatedBytesMarshal(getRangeHashRespBodyHashList, buf, r.hashList) + var ( + offset, n int + err error + ) + + n, err = proto.EnumMarshal(getRangeHashRespBodyTypeField, buf, int32(r.typ)) + if err != nil { + return nil, err + } + + offset += n + + _, err = proto.RepeatedBytesMarshal(getRangeHashRespBodyHashListField, buf[offset:], r.hashList) if err != nil { return nil, err } @@ -1176,7 +1198,8 @@ func (r *GetRangeHashResponseBody) StableSize() (size int) { return 0 } - size += proto.RepeatedBytesSize(getRangeHashRespBodyHashList, r.hashList) + size += proto.EnumSize(getRangeHashRespBodyTypeField, int32(r.typ)) + size += proto.RepeatedBytesSize(getRangeHashRespBodyHashListField, r.hashList) return size } diff --git a/v2/object/marshal_test.go b/v2/object/marshal_test.go index 87dc0c7..fd0eefe 100644 --- a/v2/object/marshal_test.go +++ b/v2/object/marshal_test.go @@ -461,6 +461,14 @@ func generateSplit(sig string) *object.SplitHeader { return split } +func generateChecksum(data string) *refs.Checksum { + checksum := new(refs.Checksum) + checksum.SetType(refs.TillichZemor) + checksum.SetSum([]byte(data)) + + return checksum +} + func generateHeader(ln uint64) *object.Header { hdr := new(object.Header) hdr.SetPayloadLength(ln) @@ -472,9 +480,9 @@ func generateHeader(ln uint64) *object.Header { generateAttribute("One", "Two"), generateAttribute("Three", "Four"), }) - hdr.SetHomomorphicHash([]byte("Homomorphic Hash")) + hdr.SetHomomorphicHash(generateChecksum("Homomorphic Hash")) hdr.SetObjectType(object.TypeRegular) - hdr.SetPayloadHash([]byte("Payload Hash")) + hdr.SetPayloadHash(generateChecksum("Payload Hash")) hdr.SetSessionToken(generateSessionToken(string(ln))) return hdr @@ -662,6 +670,7 @@ func generateRangeHashRequestBody(cid, oid string, n int) *object.GetRangeHashRe req.SetRanges(rngs) req.SetSalt([]byte("xor salt")) + req.SetType(refs.TillichZemor) return req } @@ -674,6 +683,7 @@ func generateRangeHashResponseBody(n int) *object.GetRangeHashResponseBody { list[i] = []byte("Some homomorphic hash data" + string(n)) } + resp.SetType(refs.TillichZemor) resp.SetHashList(list) return resp diff --git a/v2/object/types.go b/v2/object/types.go index a8c6123..7999cee 100644 --- a/v2/object/types.go +++ b/v2/object/types.go @@ -46,7 +46,7 @@ type Header struct { payloadLen uint64 - payloadHash, homoHash []byte + payloadHash, homoHash *refs.Checksum typ Type @@ -281,6 +281,8 @@ type GetRangeHashRequestBody struct { rngs []*Range salt []byte + + typ refs.ChecksumType } type GetRangeHashRequest struct { @@ -292,6 +294,8 @@ type GetRangeHashRequest struct { } type GetRangeHashResponseBody struct { + typ refs.ChecksumType + hashList [][]byte } @@ -552,7 +556,7 @@ func (h *Header) SetPayloadLength(v uint64) { } } -func (h *Header) GetPayloadHash() []byte { +func (h *Header) GetPayloadHash() *refs.Checksum { if h != nil { return h.payloadHash } @@ -560,7 +564,7 @@ func (h *Header) GetPayloadHash() []byte { return nil } -func (h *Header) SetPayloadHash(v []byte) { +func (h *Header) SetPayloadHash(v *refs.Checksum) { if h != nil { h.payloadHash = v } @@ -580,7 +584,7 @@ func (h *Header) SetObjectType(v Type) { } } -func (h *Header) GetHomomorphicHash() []byte { +func (h *Header) GetHomomorphicHash() *refs.Checksum { if h != nil { return h.homoHash } @@ -588,7 +592,7 @@ func (h *Header) GetHomomorphicHash() []byte { return nil } -func (h *Header) SetHomomorphicHash(v []byte) { +func (h *Header) SetHomomorphicHash(v *refs.Checksum) { if h != nil { h.homoHash = v } @@ -1712,6 +1716,20 @@ func (r *GetRangeHashRequestBody) SetSalt(v []byte) { } } +func (r *GetRangeHashRequestBody) GetType() refs.ChecksumType { + if r != nil { + return r.typ + } + + return refs.UnknownChecksum +} + +func (r *GetRangeHashRequestBody) SetType(v refs.ChecksumType) { + if r != nil { + r.typ = v + } +} + func (r *GetRangeHashRequest) GetBody() *GetRangeHashRequestBody { if r != nil { return r.body @@ -1754,6 +1772,20 @@ func (r *GetRangeHashRequest) SetVerificationHeader(v *service.RequestVerificati } } +func (r *GetRangeHashResponseBody) GetType() refs.ChecksumType { + if r != nil { + return r.typ + } + + return refs.UnknownChecksum +} + +func (r *GetRangeHashResponseBody) SetType(v refs.ChecksumType) { + if r != nil { + r.typ = v + } +} + func (r *GetRangeHashResponseBody) GetHashList() [][]byte { if r != nil { return r.hashList From db12420c99eaf2f3c03743e2d927d37aa16009d6 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Thu, 20 Aug 2020 12:43:47 +0300 Subject: [PATCH 0353/1196] Move version and signature structures to refs package Signed-off-by: Alex Vanin --- v2/container/convert.go | 20 ++++----- v2/container/grpc/service.go | 8 ++-- v2/container/grpc/types.go | 3 +- v2/container/marshal_test.go | 7 ++- v2/container/types.go | 30 ++++++------- v2/object/convert.go | 24 +++++----- v2/object/grpc/service.go | 4 +- v2/object/grpc/types.go | 8 ++-- v2/object/marshal_test.go | 8 ++-- v2/object/types.go | 36 +++++++-------- v2/refs/convert.go | 52 ++++++++++++++++++++++ v2/refs/grpc/types.go | 28 ++++++++++++ v2/refs/marshal.go | 86 ++++++++++++++++++++++++++++++++++++ v2/refs/marshal_test.go | 48 ++++++++++++++++++++ v2/refs/types.go | 64 +++++++++++++++++++++++++++ v2/signature/sign.go | 23 +++++----- 16 files changed, 363 insertions(+), 86 deletions(-) diff --git a/v2/container/convert.go b/v2/container/convert.go index b5d829a..34d5b97 100644 --- a/v2/container/convert.go +++ b/v2/container/convert.go @@ -43,7 +43,7 @@ func ContainerToGRPCMessage(c *Container) *container.Container { m := new(container.Container) m.SetVersion( - service.VersionToGRPCMessage(c.GetVersion()), + refs.VersionToGRPCMessage(c.GetVersion()), ) m.SetOwnerId( @@ -78,7 +78,7 @@ func ContainerFromGRPCMessage(m *container.Container) *Container { c := new(Container) c.SetVersion( - service.VersionFromGRPCMessage(m.GetVersion()), + refs.VersionFromGRPCMessage(m.GetVersion()), ) c.SetOwnerID( @@ -117,7 +117,7 @@ func PutRequestBodyToGRPCMessage(r *PutRequestBody) *container.PutRequest_Body { ) m.SetSignature( - service.SignatureToGRPCMessage(r.GetSignature()), + refs.SignatureToGRPCMessage(r.GetSignature()), ) return m @@ -135,7 +135,7 @@ func PutRequestBodyFromGRPCMessage(m *container.PutRequest_Body) *PutRequestBody ) r.SetSignature( - service.SignatureFromGRPCMessage(m.GetSignature()), + refs.SignatureFromGRPCMessage(m.GetSignature()), ) return r @@ -365,7 +365,7 @@ func DeleteRequestBodyToGRPCMessage(r *DeleteRequestBody) *container.DeleteReque ) m.SetSignature( - service.SignatureToGRPCMessage(r.GetSignature()), + refs.SignatureToGRPCMessage(r.GetSignature()), ) return m @@ -383,7 +383,7 @@ func DeleteRequestBodyFromGRPCMessage(m *container.DeleteRequest_Body) *DeleteRe ) r.SetSignature( - service.SignatureFromGRPCMessage(m.GetSignature()), + refs.SignatureFromGRPCMessage(m.GetSignature()), ) return r @@ -615,7 +615,7 @@ func SetExtendedACLRequestBodyToGRPCMessage(r *SetExtendedACLRequestBody) *conta ) m.SetSignature( - service.SignatureToGRPCMessage(r.GetSignature())) + refs.SignatureToGRPCMessage(r.GetSignature())) return m } @@ -632,7 +632,7 @@ func SetExtendedACLRequestBodyFromGRPCMessage(m *container.SetExtendedACLRequest ) r.SetSignature( - service.SignatureFromGRPCMessage(m.GetSignature()), + refs.SignatureFromGRPCMessage(m.GetSignature()), ) return r @@ -794,7 +794,7 @@ func GetExtendedACLResponseBodyToGRPCMessage(r *GetExtendedACLResponseBody) *con ) m.SetSignature( - service.SignatureToGRPCMessage(r.GetSignature()), + refs.SignatureToGRPCMessage(r.GetSignature()), ) return m @@ -812,7 +812,7 @@ func GetExtendedACLResponseBodyFromGRPCMessage(m *container.GetExtendedACLRespon ) r.SetSignature( - service.SignatureFromGRPCMessage(m.GetSignature()), + refs.SignatureFromGRPCMessage(m.GetSignature()), ) return r diff --git a/v2/container/grpc/service.go b/v2/container/grpc/service.go index f92501f..4da5e0f 100644 --- a/v2/container/grpc/service.go +++ b/v2/container/grpc/service.go @@ -14,7 +14,7 @@ func (m *PutRequest_Body) SetContainer(v *Container) { } // SetSignature sets signature of the container structure. -func (m *PutRequest_Body) SetSignature(v *service.Signature) { +func (m *PutRequest_Body) SetSignature(v *refs.Signature) { if m != nil { m.Signature = v } @@ -77,7 +77,7 @@ func (m *DeleteRequest_Body) SetContainerId(v *refs.ContainerID) { } // SetSignature sets signature of the container identifier. -func (m *DeleteRequest_Body) SetSignature(v *service.Signature) { +func (m *DeleteRequest_Body) SetSignature(v *refs.Signature) { if m != nil { m.Signature = v } @@ -243,7 +243,7 @@ func (m *SetExtendedACLRequest_Body) SetEacl(v *acl.EACLTable) { } // SetSignature sets signature of the eACL table. -func (m *SetExtendedACLRequest_Body) SetSignature(v *service.Signature) { +func (m *SetExtendedACLRequest_Body) SetSignature(v *refs.Signature) { if m != nil { m.Signature = v } @@ -327,7 +327,7 @@ func (m *GetExtendedACLResponse_Body) SetEacl(v *acl.EACLTable) { } // SetSignature sets signature of the eACL table. -func (m *GetExtendedACLResponse_Body) SetSignature(v *service.Signature) { +func (m *GetExtendedACLResponse_Body) SetSignature(v *refs.Signature) { if m != nil { m.Signature = v } diff --git a/v2/container/grpc/types.go b/v2/container/grpc/types.go index 5e51e3c..9fed6b2 100644 --- a/v2/container/grpc/types.go +++ b/v2/container/grpc/types.go @@ -3,7 +3,6 @@ package container import ( netmap "github.com/nspcc-dev/neofs-api-go/v2/netmap/grpc" refs "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" - service "github.com/nspcc-dev/neofs-api-go/v2/service/grpc" ) // SetKey sets key to the container attribute. @@ -56,7 +55,7 @@ func (m *Container) SetPlacementPolicy(v *netmap.PlacementPolicy) { } // SetVersion sets version of the container. -func (m *Container) SetVersion(v *service.Version) { +func (m *Container) SetVersion(v *refs.Version) { if m != nil { m.Version = v } diff --git a/v2/container/marshal_test.go b/v2/container/marshal_test.go index f46bb31..19e5d6e 100644 --- a/v2/container/marshal_test.go +++ b/v2/container/marshal_test.go @@ -8,7 +8,6 @@ import ( "github.com/nspcc-dev/neofs-api-go/v2/container" grpc "github.com/nspcc-dev/neofs-api-go/v2/container/grpc" "github.com/nspcc-dev/neofs-api-go/v2/refs" - "github.com/nspcc-dev/neofs-api-go/v2/service" "github.com/stretchr/testify/require" ) @@ -248,7 +247,7 @@ func generateContainer(n string) *container.Container { owner := new(refs.OwnerID) owner.SetValue([]byte("Owner ID")) - version := new(service.Version) + version := new(refs.Version) version.SetMajor(2) version.SetMinor(0) @@ -267,8 +266,8 @@ func generateContainer(n string) *container.Container { return cnr } -func generateSignature(k, v string) *service.Signature { - sig := new(service.Signature) +func generateSignature(k, v string) *refs.Signature { + sig := new(refs.Signature) sig.SetKey([]byte(k)) sig.SetSign([]byte(v)) diff --git a/v2/container/types.go b/v2/container/types.go index 033273f..79d97c4 100644 --- a/v2/container/types.go +++ b/v2/container/types.go @@ -12,7 +12,7 @@ type Attribute struct { } type Container struct { - version *service.Version + version *refs.Version ownerID *refs.OwnerID @@ -28,7 +28,7 @@ type Container struct { type PutRequestBody struct { cnr *Container - sig *service.Signature + sig *refs.Signature } type PutRequest struct { @@ -78,7 +78,7 @@ type GetResponse struct { type DeleteRequestBody struct { cid *refs.ContainerID - sig *service.Signature + sig *refs.Signature } type DeleteRequest struct { @@ -126,7 +126,7 @@ type ListResponse struct { type SetExtendedACLRequestBody struct { eacl *acl.Table - sig *service.Signature + sig *refs.Signature } type SetExtendedACLRequest struct { @@ -162,7 +162,7 @@ type GetExtendedACLRequest struct { type GetExtendedACLResponseBody struct { eacl *acl.Table - sig *service.Signature + sig *refs.Signature } type GetExtendedACLResponse struct { @@ -201,7 +201,7 @@ func (a *Attribute) SetValue(v string) { } } -func (c *Container) GetVersion() *service.Version { +func (c *Container) GetVersion() *refs.Version { if c != nil { return c.version } @@ -209,7 +209,7 @@ func (c *Container) GetVersion() *service.Version { return nil } -func (c *Container) SetVersion(v *service.Version) { +func (c *Container) SetVersion(v *refs.Version) { if c != nil { c.version = v } @@ -299,7 +299,7 @@ func (r *PutRequestBody) SetContainer(v *Container) { } } -func (r *PutRequestBody) GetSignature() *service.Signature { +func (r *PutRequestBody) GetSignature() *refs.Signature { if r != nil { return r.sig } @@ -307,7 +307,7 @@ func (r *PutRequestBody) GetSignature() *service.Signature { return nil } -func (r *PutRequestBody) SetSignature(v *service.Signature) { +func (r *PutRequestBody) SetSignature(v *refs.Signature) { if r != nil { r.sig = v } @@ -537,7 +537,7 @@ func (r *DeleteRequestBody) SetContainerID(v *refs.ContainerID) { } } -func (r *DeleteRequestBody) GetSignature() *service.Signature { +func (r *DeleteRequestBody) GetSignature() *refs.Signature { if r != nil { return r.sig } @@ -545,7 +545,7 @@ func (r *DeleteRequestBody) GetSignature() *service.Signature { return nil } -func (r *DeleteRequestBody) SetSignature(v *service.Signature) { +func (r *DeleteRequestBody) SetSignature(v *refs.Signature) { if r != nil { r.sig = v } @@ -761,7 +761,7 @@ func (r *SetExtendedACLRequestBody) SetEACL(v *acl.Table) { } } -func (r *SetExtendedACLRequestBody) GetSignature() *service.Signature { +func (r *SetExtendedACLRequestBody) GetSignature() *refs.Signature { if r != nil { return r.sig } @@ -769,7 +769,7 @@ func (r *SetExtendedACLRequestBody) GetSignature() *service.Signature { return nil } -func (r *SetExtendedACLRequestBody) SetSignature(v *service.Signature) { +func (r *SetExtendedACLRequestBody) SetSignature(v *refs.Signature) { if r != nil { r.sig = v } @@ -929,7 +929,7 @@ func (r *GetExtendedACLResponseBody) SetEACL(v *acl.Table) { } } -func (r *GetExtendedACLResponseBody) GetSignature() *service.Signature { +func (r *GetExtendedACLResponseBody) GetSignature() *refs.Signature { if r != nil { return r.sig } @@ -937,7 +937,7 @@ func (r *GetExtendedACLResponseBody) GetSignature() *service.Signature { return nil } -func (r *GetExtendedACLResponseBody) SetSignature(v *service.Signature) { +func (r *GetExtendedACLResponseBody) SetSignature(v *refs.Signature) { if r != nil { r.sig = v } diff --git a/v2/object/convert.go b/v2/object/convert.go index 3f7b85a..949bb13 100644 --- a/v2/object/convert.go +++ b/v2/object/convert.go @@ -33,7 +33,7 @@ func ShortHeaderToGRPCMessage(h *ShortHeader) *object.ShortHeader { m := new(object.ShortHeader) m.SetVersion( - service.VersionToGRPCMessage(h.GetVersion()), + refs.VersionToGRPCMessage(h.GetVersion()), ) m.SetCreationEpoch(h.GetCreationEpoch()) @@ -59,7 +59,7 @@ func ShortHeaderFromGRPCMessage(m *object.ShortHeader) *ShortHeader { h := new(ShortHeader) h.SetVersion( - service.VersionFromGRPCMessage(m.GetVersion()), + refs.VersionFromGRPCMessage(m.GetVersion()), ) h.SetCreationEpoch(m.GetCreationEpoch()) @@ -119,7 +119,7 @@ func SplitHeaderToGRPCMessage(h *SplitHeader) *object.Header_Split { ) m.SetParentSignature( - service.SignatureToGRPCMessage(h.GetParentSignature()), + refs.SignatureToGRPCMessage(h.GetParentSignature()), ) m.SetParentHeader( @@ -154,7 +154,7 @@ func SplitHeaderFromGRPCMessage(m *object.Header_Split) *SplitHeader { ) h.SetParentSignature( - service.SignatureFromGRPCMessage(m.GetParentSignature()), + refs.SignatureFromGRPCMessage(m.GetParentSignature()), ) h.SetParentHeader( @@ -181,7 +181,7 @@ func HeaderToGRPCMessage(h *Header) *object.Header { m := new(object.Header) m.SetVersion( - service.VersionToGRPCMessage(h.GetVersion()), + refs.VersionToGRPCMessage(h.GetVersion()), ) m.SetContainerId( @@ -236,7 +236,7 @@ func HeaderFromGRPCMessage(m *object.Header) *Header { h := new(Header) h.SetVersion( - service.VersionFromGRPCMessage(m.GetVersion()), + refs.VersionFromGRPCMessage(m.GetVersion()), ) h.SetContainerID( @@ -295,7 +295,7 @@ func ObjectToGRPCMessage(o *Object) *object.Object { ) m.SetSignature( - service.SignatureToGRPCMessage(o.GetSignature()), + refs.SignatureToGRPCMessage(o.GetSignature()), ) m.SetHeader( @@ -319,7 +319,7 @@ func ObjectFromGRPCMessage(m *object.Object) *Object { ) o.SetSignature( - service.SignatureFromGRPCMessage(m.GetSignature()), + refs.SignatureFromGRPCMessage(m.GetSignature()), ) o.SetHeader( @@ -407,7 +407,7 @@ func GetObjectPartInitToGRPCMessage(r *GetObjectPartInit) *object.GetResponse_Bo ) m.SetSignature( - service.SignatureToGRPCMessage(r.GetSignature()), + refs.SignatureToGRPCMessage(r.GetSignature()), ) m.SetHeader( @@ -429,7 +429,7 @@ func GetObjectPartInitFromGRPCMessage(m *object.GetResponse_Body_Init) *GetObjec ) r.SetSignature( - service.SignatureFromGRPCMessage(m.GetSignature()), + refs.SignatureFromGRPCMessage(m.GetSignature()), ) r.SetHeader( @@ -555,7 +555,7 @@ func PutObjectPartInitToGRPCMessage(r *PutObjectPartInit) *object.PutRequest_Bod ) m.SetSignature( - service.SignatureToGRPCMessage(r.GetSignature()), + refs.SignatureToGRPCMessage(r.GetSignature()), ) m.SetHeader( @@ -579,7 +579,7 @@ func PutObjectPartInitFromGRPCMessage(m *object.PutRequest_Body_Init) *PutObject ) r.SetSignature( - service.SignatureFromGRPCMessage(m.GetSignature()), + refs.SignatureFromGRPCMessage(m.GetSignature()), ) r.SetHeader( diff --git a/v2/object/grpc/service.go b/v2/object/grpc/service.go index 9dda1cb..04cebfa 100644 --- a/v2/object/grpc/service.go +++ b/v2/object/grpc/service.go @@ -48,7 +48,7 @@ func (m *GetResponse_Body_Init) SetObjectId(v *refs.ObjectID) { } // SetSignature sets signature of the object identifier. -func (m *GetResponse_Body_Init) SetSignature(v *service.Signature) { +func (m *GetResponse_Body_Init) SetSignature(v *refs.Signature) { if m != nil { m.Signature = v } @@ -122,7 +122,7 @@ func (m *PutRequest_Body_Init) SetObjectId(v *refs.ObjectID) { } // SetSignature sets signature of the object identifier. -func (m *PutRequest_Body_Init) SetSignature(v *service.Signature) { +func (m *PutRequest_Body_Init) SetSignature(v *refs.Signature) { if m != nil { m.Signature = v } diff --git a/v2/object/grpc/types.go b/v2/object/grpc/types.go index 3600765..24216ab 100644 --- a/v2/object/grpc/types.go +++ b/v2/object/grpc/types.go @@ -34,7 +34,7 @@ func (m *Header_Split) SetPrevious(v *refs.ObjectID) { } // SetParentSignature sets signature of the parent object header. -func (m *Header_Split) SetParentSignature(v *service.Signature) { +func (m *Header_Split) SetParentSignature(v *refs.Signature) { if m != nil { m.ParentSignature = v } @@ -76,7 +76,7 @@ func (m *Header) SetCreationEpoch(v uint64) { } // SetVersion sets version of the object format. -func (m *Header) SetVersion(v *service.Version) { +func (m *Header) SetVersion(v *refs.Version) { if m != nil { m.Version = v } @@ -139,7 +139,7 @@ func (m *Object) SetObjectId(v *refs.ObjectID) { } // SetSignature sets signature of the object identifier. -func (m *Object) SetSignature(v *service.Signature) { +func (m *Object) SetSignature(v *refs.Signature) { if m != nil { m.Signature = v } @@ -160,7 +160,7 @@ func (m *Object) SetPayload(v []byte) { } // SetVersion sets version of the object. -func (m *ShortHeader) SetVersion(v *service.Version) { +func (m *ShortHeader) SetVersion(v *refs.Version) { if m != nil { m.Version = v } diff --git a/v2/object/marshal_test.go b/v2/object/marshal_test.go index fd0eefe..02480bd 100644 --- a/v2/object/marshal_test.go +++ b/v2/object/marshal_test.go @@ -381,16 +381,16 @@ func generateContainerID(id string) *refs.ContainerID { return cid } -func generateSignature(k, v string) *service.Signature { - sig := new(service.Signature) +func generateSignature(k, v string) *refs.Signature { + sig := new(refs.Signature) sig.SetKey([]byte(k)) sig.SetSign([]byte(v)) return sig } -func generateVersion(maj, min uint32) *service.Version { - version := new(service.Version) +func generateVersion(maj, min uint32) *refs.Version { + version := new(refs.Version) version.SetMajor(maj) version.SetMinor(min) diff --git a/v2/object/types.go b/v2/object/types.go index 7999cee..5f421fc 100644 --- a/v2/object/types.go +++ b/v2/object/types.go @@ -10,7 +10,7 @@ type Type uint32 type MatchType uint32 type ShortHeader struct { - version *service.Version + version *refs.Version creatEpoch uint64 @@ -28,7 +28,7 @@ type Attribute struct { type SplitHeader struct { par, prev *refs.ObjectID - parSig *service.Signature + parSig *refs.Signature parHdr *Header @@ -36,7 +36,7 @@ type SplitHeader struct { } type Header struct { - version *service.Version + version *refs.Version cid *refs.ContainerID @@ -60,7 +60,7 @@ type Header struct { type Object struct { objectID *refs.ObjectID - idSig *service.Signature + idSig *refs.Signature header *Header @@ -88,7 +88,7 @@ type GetObjectPart interface { type GetObjectPartInit struct { id *refs.ObjectID - sig *service.Signature + sig *refs.Signature hdr *Header } @@ -116,7 +116,7 @@ type PutObjectPart interface { type PutObjectPartInit struct { id *refs.ObjectID - sig *service.Signature + sig *refs.Signature hdr *Header @@ -318,7 +318,7 @@ const ( MatchStringEqual ) -func (h *ShortHeader) GetVersion() *service.Version { +func (h *ShortHeader) GetVersion() *refs.Version { if h != nil { return h.version } @@ -326,7 +326,7 @@ func (h *ShortHeader) GetVersion() *service.Version { return nil } -func (h *ShortHeader) SetVersion(v *service.Version) { +func (h *ShortHeader) SetVersion(v *refs.Version) { if h != nil { h.version = v } @@ -444,7 +444,7 @@ func (h *SplitHeader) SetPrevious(v *refs.ObjectID) { } } -func (h *SplitHeader) GetParentSignature() *service.Signature { +func (h *SplitHeader) GetParentSignature() *refs.Signature { if h != nil { return h.parSig } @@ -452,7 +452,7 @@ func (h *SplitHeader) GetParentSignature() *service.Signature { return nil } -func (h *SplitHeader) SetParentSignature(v *service.Signature) { +func (h *SplitHeader) SetParentSignature(v *refs.Signature) { if h != nil { h.parSig = v } @@ -486,7 +486,7 @@ func (h *SplitHeader) SetChildren(v []*refs.ObjectID) { } } -func (h *Header) GetVersion() *service.Version { +func (h *Header) GetVersion() *refs.Version { if h != nil { return h.version } @@ -494,7 +494,7 @@ func (h *Header) GetVersion() *service.Version { return nil } -func (h *Header) SetVersion(v *service.Version) { +func (h *Header) SetVersion(v *refs.Version) { if h != nil { h.version = v } @@ -654,7 +654,7 @@ func (o *Object) SetObjectID(v *refs.ObjectID) { } } -func (o *Object) GetSignature() *service.Signature { +func (o *Object) GetSignature() *refs.Signature { if o != nil { return o.idSig } @@ -662,7 +662,7 @@ func (o *Object) GetSignature() *service.Signature { return nil } -func (o *Object) SetSignature(v *service.Signature) { +func (o *Object) SetSignature(v *refs.Signature) { if o != nil { o.idSig = v } @@ -780,7 +780,7 @@ func (r *GetObjectPartInit) SetObjectID(v *refs.ObjectID) { } } -func (r *GetObjectPartInit) GetSignature() *service.Signature { +func (r *GetObjectPartInit) GetSignature() *refs.Signature { if r != nil { return r.sig } @@ -788,7 +788,7 @@ func (r *GetObjectPartInit) GetSignature() *service.Signature { return nil } -func (r *GetObjectPartInit) SetSignature(v *service.Signature) { +func (r *GetObjectPartInit) SetSignature(v *refs.Signature) { if r != nil { r.sig = v } @@ -896,7 +896,7 @@ func (r *PutObjectPartInit) SetObjectID(v *refs.ObjectID) { } } -func (r *PutObjectPartInit) GetSignature() *service.Signature { +func (r *PutObjectPartInit) GetSignature() *refs.Signature { if r != nil { return r.sig } @@ -904,7 +904,7 @@ func (r *PutObjectPartInit) GetSignature() *service.Signature { return nil } -func (r *PutObjectPartInit) SetSignature(v *service.Signature) { +func (r *PutObjectPartInit) SetSignature(v *refs.Signature) { if r != nil { r.sig = v } diff --git a/v2/refs/convert.go b/v2/refs/convert.go index 4a84077..00971be 100644 --- a/v2/refs/convert.go +++ b/v2/refs/convert.go @@ -139,3 +139,55 @@ func ChecksumFromGRPCMessage(m *refs.Checksum) *Checksum { return c } + +func VersionToGRPCMessage(v *Version) *refs.Version { + if v == nil { + return nil + } + + msg := new(refs.Version) + + msg.SetMajor(v.GetMajor()) + msg.SetMinor(v.GetMinor()) + + return msg +} + +func VersionFromGRPCMessage(m *refs.Version) *Version { + if m == nil { + return nil + } + + v := new(Version) + + v.SetMajor(m.GetMajor()) + v.SetMinor(m.GetMinor()) + + return v +} + +func SignatureToGRPCMessage(s *Signature) *refs.Signature { + if s == nil { + return nil + } + + m := new(refs.Signature) + + m.SetKey(s.GetKey()) + m.SetSign(s.GetSign()) + + return m +} + +func SignatureFromGRPCMessage(m *refs.Signature) *Signature { + if m == nil { + return nil + } + + s := new(Signature) + + s.SetKey(m.GetKey()) + s.SetSign(m.GetSign()) + + return s +} diff --git a/v2/refs/grpc/types.go b/v2/refs/grpc/types.go index e55504d..b071dc8 100644 --- a/v2/refs/grpc/types.go +++ b/v2/refs/grpc/types.go @@ -48,3 +48,31 @@ func (m *Checksum) SetSum(v []byte) { m.Sum = v } } + +// SetMajor sets major version number. +func (m *Version) SetMajor(v uint32) { + if m != nil { + m.Major = v + } +} + +// SetMinor sets minor version number. +func (m *Version) SetMinor(v uint32) { + if m != nil { + m.Minor = v + } +} + +// SetKey sets public key in a binary format. +func (m *Signature) SetKey(v []byte) { + if m != nil { + m.Key = v + } +} + +// SetSign sets signature. +func (m *Signature) SetSign(v []byte) { + if m != nil { + m.Sign = v + } +} diff --git a/v2/refs/marshal.go b/v2/refs/marshal.go index 7c1f524..7d52c60 100644 --- a/v2/refs/marshal.go +++ b/v2/refs/marshal.go @@ -16,6 +16,12 @@ const ( checksumTypeField = 1 checksumValueField = 2 + + signatureKeyField = 1 + signatureValueField = 2 + + versionMajorField = 1 + versionMinorField = 2 ) func (o *OwnerID) StableMarshal(buf []byte) ([]byte, error) { @@ -173,3 +179,83 @@ func (c *Checksum) StableSize() (size int) { return size } + +func (s *Signature) StableMarshal(buf []byte) ([]byte, error) { + if s == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, s.StableSize()) + } + + var ( + offset, n int + err error + ) + + n, err = proto.BytesMarshal(signatureKeyField, buf[offset:], s.key) + if err != nil { + return nil, err + } + + offset += n + + _, err = proto.BytesMarshal(signatureValueField, buf[offset:], s.sign) + if err != nil { + return nil, err + } + + return buf, nil +} + +func (s *Signature) StableSize() (size int) { + if s == nil { + return 0 + } + + size += proto.BytesSize(signatureKeyField, s.key) + size += proto.BytesSize(signatureValueField, s.sign) + + return size +} + +func (v *Version) StableMarshal(buf []byte) ([]byte, error) { + if v == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, v.StableSize()) + } + + var ( + offset, n int + err error + ) + + n, err = proto.UInt32Marshal(versionMajorField, buf[offset:], v.major) + if err != nil { + return nil, err + } + + offset += n + + _, err = proto.UInt32Marshal(versionMinorField, buf[offset:], v.minor) + if err != nil { + return nil, err + } + + return buf, nil +} + +func (v *Version) StableSize() (size int) { + if v == nil { + return 0 + } + + size += proto.UInt32Size(versionMajorField, v.major) + size += proto.UInt32Size(versionMinorField, v.minor) + + return size +} diff --git a/v2/refs/marshal_test.go b/v2/refs/marshal_test.go index 441174e..f4e1350 100644 --- a/v2/refs/marshal_test.go +++ b/v2/refs/marshal_test.go @@ -106,3 +106,51 @@ func TestChecksum_StableMarshal(t *testing.T) { require.Equal(t, checksumFrom, checksumTo) }) } + +func TestSignature_StableMarshal(t *testing.T) { + signatureFrom := generateSignature("Public Key", "Signature") + transport := new(grpc.Signature) + + t.Run("non empty", func(t *testing.T) { + wire, err := signatureFrom.StableMarshal(nil) + require.NoError(t, err) + + err = transport.Unmarshal(wire) + require.NoError(t, err) + + signatureTo := refs.SignatureFromGRPCMessage(transport) + require.Equal(t, signatureFrom, signatureTo) + }) +} + +func TestVersion_StableMarshal(t *testing.T) { + versionFrom := generateVersion(2, 0) + transport := new(grpc.Version) + + t.Run("non empty", func(t *testing.T) { + wire, err := versionFrom.StableMarshal(nil) + require.NoError(t, err) + + err = transport.Unmarshal(wire) + require.NoError(t, err) + + versionTo := refs.VersionFromGRPCMessage(transport) + require.Equal(t, versionFrom, versionTo) + }) +} + +func generateSignature(k, v string) *refs.Signature { + sig := new(refs.Signature) + sig.SetKey([]byte(k)) + sig.SetSign([]byte(v)) + + return sig +} + +func generateVersion(maj, min uint32) *refs.Version { + version := new(refs.Version) + version.SetMajor(maj) + version.SetMinor(min) + + return version +} diff --git a/v2/refs/types.go b/v2/refs/types.go index e368b62..0b90268 100644 --- a/v2/refs/types.go +++ b/v2/refs/types.go @@ -26,6 +26,14 @@ type Checksum struct { type ChecksumType uint32 +type Signature struct { + key, sign []byte +} + +type Version struct { + major, minor uint32 +} + const ( UnknownChecksum ChecksumType = iota TillichZemor @@ -129,3 +137,59 @@ func (c *Checksum) SetSum(v []byte) { c.sum = v } } + +func (s *Signature) GetKey() []byte { + if s != nil { + return s.key + } + + return nil +} + +func (s *Signature) SetKey(v []byte) { + if s != nil { + s.key = v + } +} + +func (s *Signature) GetSign() []byte { + if s != nil { + return s.sign + } + + return nil +} + +func (s *Signature) SetSign(v []byte) { + if s != nil { + s.sign = v + } +} + +func (v *Version) GetMajor() uint32 { + if v != nil { + return v.major + } + + return 0 +} + +func (v *Version) SetMajor(val uint32) { + if v != nil { + v.major = val + } +} + +func (v *Version) GetMinor() uint32 { + if v != nil { + return v.minor + } + + return 0 +} + +func (v *Version) SetMinor(val uint32) { + if v != nil { + v.minor = val + } +} diff --git a/v2/signature/sign.go b/v2/signature/sign.go index 086ce0d..2cb768a 100644 --- a/v2/signature/sign.go +++ b/v2/signature/sign.go @@ -8,6 +8,7 @@ import ( "github.com/nspcc-dev/neofs-api-go/v2/accounting" "github.com/nspcc-dev/neofs-api-go/v2/container" "github.com/nspcc-dev/neofs-api-go/v2/object" + "github.com/nspcc-dev/neofs-api-go/v2/refs" "github.com/nspcc-dev/neofs-api-go/v2/service" "github.com/nspcc-dev/neofs-api-go/v2/session" "github.com/pkg/errors" @@ -42,12 +43,12 @@ type metaHeader interface { type verificationHeader interface { stableMarshaler - GetBodySignature() *service.Signature - SetBodySignature(*service.Signature) - GetMetaSignature() *service.Signature - SetMetaSignature(*service.Signature) - GetOriginSignature() *service.Signature - SetOriginSignature(*service.Signature) + GetBodySignature() *refs.Signature + SetBodySignature(*refs.Signature) + GetMetaSignature() *refs.Signature + SetMetaSignature(*refs.Signature) + GetOriginSignature() *refs.Signature + SetOriginSignature(*refs.Signature) setOrigin(stableMarshaler) getOrigin() verificationHeader @@ -129,14 +130,14 @@ func (s stableMarshalerWrapper) SignedDataSize() int { return 0 } -func keySignatureHandler(s *service.Signature) signature.KeySignatureHandler { +func keySignatureHandler(s *refs.Signature) signature.KeySignatureHandler { return func(key []byte, sig []byte) { s.SetKey(key) s.SetSign(sig) } } -func keySignatureSource(s *service.Signature) signature.KeySignatureSource { +func keySignatureSource(s *refs.Signature) signature.KeySignatureSource { return func() ([]byte, []byte) { return s.GetKey(), s.GetSign() } @@ -204,8 +205,8 @@ func SignServiceMessage(key *ecdsa.PrivateKey, msg interface{}) error { return nil } -func signServiceMessagePart(key *ecdsa.PrivateKey, part stableMarshaler, sigWrite func(*service.Signature)) error { - sig := new(service.Signature) +func signServiceMessagePart(key *ecdsa.PrivateKey, part stableMarshaler, sigWrite func(*refs.Signature)) error { + sig := new(refs.Signature) // sign part if err := signature.SignDataWithHandler( @@ -280,7 +281,7 @@ func verifyMatryoshkaLevel(body stableMarshaler, meta metaHeader, verify verific return verifyMatryoshkaLevel(body, meta.getOrigin(), origin) } -func verifyServiceMessagePart(part stableMarshaler, sigRdr func() *service.Signature) error { +func verifyServiceMessagePart(part stableMarshaler, sigRdr func() *refs.Signature) error { return signature.VerifyDataWithSource( &stableMarshalerWrapper{part}, keySignatureSource(sigRdr()), From 5f2770d522fd28a4b793b1913bc2c8a2a9ad8473 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Thu, 20 Aug 2020 12:46:58 +0300 Subject: [PATCH 0354/1196] Separate type definition in accounting/grpc Signed-off-by: Alex Vanin --- v2/accounting/grpc/service.go | 14 -------------- v2/accounting/grpc/types.go | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 14 deletions(-) create mode 100644 v2/accounting/grpc/types.go diff --git a/v2/accounting/grpc/service.go b/v2/accounting/grpc/service.go index 0da7936..058067b 100644 --- a/v2/accounting/grpc/service.go +++ b/v2/accounting/grpc/service.go @@ -5,20 +5,6 @@ import ( service "github.com/nspcc-dev/neofs-api-go/v2/service/grpc" ) -// SetValue sets value of the decimal number. -func (m *Decimal) SetValue(v int64) { - if m != nil { - m.Value = v - } -} - -// SetPrecision sets precision of the decimal number. -func (m *Decimal) SetPrecision(v uint32) { - if m != nil { - m.Precision = v - } -} - // SetOwnerId sets identifier of the account owner. func (m *BalanceRequest_Body) SetOwnerId(v *refs.OwnerID) { if m != nil { diff --git a/v2/accounting/grpc/types.go b/v2/accounting/grpc/types.go new file mode 100644 index 0000000..3099f69 --- /dev/null +++ b/v2/accounting/grpc/types.go @@ -0,0 +1,15 @@ +package accounting + +// SetValue sets value of the decimal number. +func (m *Decimal) SetValue(v int64) { + if m != nil { + m.Value = v + } +} + +// SetPrecision sets precision of the decimal number. +func (m *Decimal) SetPrecision(v uint32) { + if m != nil { + m.Precision = v + } +} From 933bcf300f0a4109ac3b60397764bd59cb4a5c24 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Thu, 20 Aug 2020 13:07:35 +0300 Subject: [PATCH 0355/1196] Move bearer token to acl package Signed-off-by: Alex Vanin --- v2/acl/convert.go | 108 ++++++++++++++++++++++++++++++ v2/acl/grpc/types.go | 56 ++++++++++++++++ v2/acl/marshal.go | 147 +++++++++++++++++++++++++++++++++++++++++ v2/acl/marshal_test.go | 96 +++++++++++++++++++++++++++ v2/acl/types.go | 130 ++++++++++++++++++++++++++++++++++++ 5 files changed, 537 insertions(+) diff --git a/v2/acl/convert.go b/v2/acl/convert.go index bf65685..7bf1684 100644 --- a/v2/acl/convert.go +++ b/v2/acl/convert.go @@ -348,3 +348,111 @@ func TableFromGRPCMessage(m *acl.EACLTable) *Table { return t } + +func TokenLifetimeToGRPCMessage(tl *TokenLifetime) *acl.BearerToken_Body_TokenLifetime { + if tl == nil { + return nil + } + + m := new(acl.BearerToken_Body_TokenLifetime) + + m.SetExp(tl.GetExp()) + m.SetNbf(tl.GetNbf()) + m.SetIat(tl.GetIat()) + + return m +} + +func TokenLifetimeFromGRPCMessage(m *acl.BearerToken_Body_TokenLifetime) *TokenLifetime { + if m == nil { + return nil + } + + tl := new(TokenLifetime) + + tl.SetExp(m.GetExp()) + tl.SetNbf(m.GetNbf()) + tl.SetIat(m.GetIat()) + + return tl +} + +func BearerTokenBodyToGRPCMessage(v *BearerTokenBody) *acl.BearerToken_Body { + if v == nil { + return nil + } + + m := new(acl.BearerToken_Body) + + m.SetEaclTable( + TableToGRPCMessage(v.GetEACL()), + ) + + m.SetOwnerId( + refs.OwnerIDToGRPCMessage(v.GetOwnerID()), + ) + + m.SetLifetime( + TokenLifetimeToGRPCMessage(v.GetLifetime()), + ) + + return m +} + +func BearerTokenBodyFromGRPCMessage(m *acl.BearerToken_Body) *BearerTokenBody { + if m == nil { + return nil + } + + bt := new(BearerTokenBody) + + bt.SetEACL( + TableFromGRPCMessage(m.GetEaclTable()), + ) + + bt.SetOwnerID( + refs.OwnerIDFromGRPCMessage(m.GetOwnerId()), + ) + + bt.SetLifetime( + TokenLifetimeFromGRPCMessage(m.GetLifetime()), + ) + + return bt +} + +func BearerTokenToGRPCMessage(t *BearerToken) *acl.BearerToken { + if t == nil { + return nil + } + + m := new(acl.BearerToken) + + m.SetBody( + BearerTokenBodyToGRPCMessage(t.GetBody()), + ) + + m.SetSignature( + refs.SignatureToGRPCMessage(t.GetSignature()), + ) + + return m +} + +func BearerTokenFromGRPCMessage(m *acl.BearerToken) *BearerToken { + if m == nil { + return nil + } + + bt := new(BearerToken) + + bt.SetBody( + BearerTokenBodyFromGRPCMessage(m.GetBody()), + ) + + bt.SetSignature( + refs.SignatureFromGRPCMessage(m.GetSignature()), + ) + + return bt +} diff --git a/v2/acl/grpc/types.go b/v2/acl/grpc/types.go index da83e24..875efa3 100644 --- a/v2/acl/grpc/types.go +++ b/v2/acl/grpc/types.go @@ -87,3 +87,59 @@ func (m *EACLRecord_TargetInfo) SetKeyList(v [][]byte) { m.KeyList = v } } + +// SetEaclTable sets eACL table of the bearer token. +func (m *BearerToken_Body) SetEaclTable(v *EACLTable) { + if m != nil { + m.EaclTable = v + } +} + +// SetOwnerId sets identifier of the bearer token owner. +func (m *BearerToken_Body) SetOwnerId(v *refs.OwnerID) { + if m != nil { + m.OwnerId = v + } +} + +// SetLifetime sets lifetime of the bearer token. +func (m *BearerToken_Body) SetLifetime(v *BearerToken_Body_TokenLifetime) { + if m != nil { + m.Lifetime = v + } +} + +// SetBody sets bearer token body. +func (m *BearerToken) SetBody(v *BearerToken_Body) { + if m != nil { + m.Body = v + } +} + +// SetSignature sets bearer token signature. +func (m *BearerToken) SetSignature(v *refs.Signature) { + if m != nil { + m.Signature = v + } +} + +// SetExp sets epoch number of the token expiration. +func (m *BearerToken_Body_TokenLifetime) SetExp(v uint64) { + if m != nil { + m.Exp = v + } +} + +// SetNbf sets starting epoch number of the token. +func (m *BearerToken_Body_TokenLifetime) SetNbf(v uint64) { + if m != nil { + m.Nbf = v + } +} + +// SetIat sets the number of the epoch in which the token was issued. +func (m *BearerToken_Body_TokenLifetime) SetIat(v uint64) { + if m != nil { + m.Iat = v + } +} diff --git a/v2/acl/marshal.go b/v2/acl/marshal.go index e596c0e..ccf5760 100644 --- a/v2/acl/marshal.go +++ b/v2/acl/marshal.go @@ -20,6 +20,17 @@ const ( tableContainerIDField = 1 tableRecordsField = 2 + + lifetimeExpirationField = 1 + lifetimeNotValidBeforeField = 2 + lifetimeIssuedAtField = 3 + + bearerTokenBodyACLField = 1 + bearerTokenBodyOwnerField = 2 + bearerTokenBodyLifetimeField = 3 + + bearerTokenBodyField = 1 + bearerTokenSignatureField = 2 ) // StableMarshal marshals unified acl table structure in a protobuf @@ -244,3 +255,139 @@ func (t *TargetInfo) StableSize() (size int) { return size } + +func (l *TokenLifetime) StableMarshal(buf []byte) ([]byte, error) { + if l == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, l.StableSize()) + } + + var ( + offset, n int + err error + ) + + n, err = proto.UInt64Marshal(lifetimeExpirationField, buf[offset:], l.exp) + if err != nil { + return nil, err + } + + offset += n + + n, err = proto.UInt64Marshal(lifetimeNotValidBeforeField, buf[offset:], l.nbf) + if err != nil { + return nil, err + } + + offset += n + + _, err = proto.UInt64Marshal(lifetimeIssuedAtField, buf[offset:], l.iat) + if err != nil { + return nil, err + } + + return buf, nil +} + +func (l *TokenLifetime) StableSize() (size int) { + if l == nil { + return 0 + } + + size += proto.UInt64Size(lifetimeExpirationField, l.exp) + size += proto.UInt64Size(lifetimeNotValidBeforeField, l.nbf) + size += proto.UInt64Size(lifetimeIssuedAtField, l.iat) + + return size +} + +func (bt *BearerTokenBody) StableMarshal(buf []byte) ([]byte, error) { + if bt == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, bt.StableSize()) + } + + var ( + offset, n int + err error + ) + + n, err = proto.NestedStructureMarshal(bearerTokenBodyACLField, buf[offset:], bt.eacl) + if err != nil { + return nil, err + } + + offset += n + + n, err = proto.NestedStructureMarshal(bearerTokenBodyOwnerField, buf[offset:], bt.ownerID) + if err != nil { + return nil, err + } + + offset += n + + _, err = proto.NestedStructureMarshal(bearerTokenBodyLifetimeField, buf[offset:], bt.lifetime) + if err != nil { + return nil, err + } + + return buf, nil +} + +func (bt *BearerTokenBody) StableSize() (size int) { + if bt == nil { + return 0 + } + + size += proto.NestedStructureSize(bearerTokenBodyACLField, bt.eacl) + size += proto.NestedStructureSize(bearerTokenBodyOwnerField, bt.ownerID) + size += proto.NestedStructureSize(bearerTokenBodyLifetimeField, bt.lifetime) + + return size +} + +func (bt *BearerToken) StableMarshal(buf []byte) ([]byte, error) { + if bt == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, bt.StableSize()) + } + + var ( + offset, n int + err error + ) + + n, err = proto.NestedStructureMarshal(bearerTokenBodyField, buf[offset:], bt.body) + if err != nil { + return nil, err + } + + offset += n + + _, err = proto.NestedStructureMarshal(bearerTokenSignatureField, buf[offset:], bt.sig) + if err != nil { + return nil, err + } + + return buf, nil +} + +func (bt *BearerToken) StableSize() (size int) { + if bt == nil { + return 0 + } + + size += proto.NestedStructureSize(bearerTokenBodyField, bt.body) + size += proto.NestedStructureSize(bearerTokenSignatureField, bt.sig) + + return size +} diff --git a/v2/acl/marshal_test.go b/v2/acl/marshal_test.go index c5de1c8..cd471d7 100644 --- a/v2/acl/marshal_test.go +++ b/v2/acl/marshal_test.go @@ -61,6 +61,54 @@ func generateRecord(another bool) *acl.Record { return record } +func generateEACL() *acl.Table { + cid := new(refs.ContainerID) + cid.SetValue([]byte("Container ID")) + + table := new(acl.Table) + table.SetContainerID(cid) + table.SetRecords([]*acl.Record{generateRecord(true)}) + + return table +} + +func generateSignature(k, v string) *refs.Signature { + sig := new(refs.Signature) + sig.SetKey([]byte(k)) + sig.SetSign([]byte(v)) + + return sig +} + +func generateLifetime(exp, nbf, iat uint64) *acl.TokenLifetime { + lifetime := new(acl.TokenLifetime) + lifetime.SetExp(exp) + lifetime.SetNbf(nbf) + lifetime.SetIat(iat) + + return lifetime +} + +func generateBearerTokenBody(id string) *acl.BearerTokenBody { + owner := new(refs.OwnerID) + owner.SetValue([]byte(id)) + + tokenBody := new(acl.BearerTokenBody) + tokenBody.SetOwnerID(owner) + tokenBody.SetLifetime(generateLifetime(1, 2, 3)) + tokenBody.SetEACL(generateEACL()) + + return tokenBody +} + +func generateBearerToken(id string) *acl.BearerToken { + bearerToken := new(acl.BearerToken) + bearerToken.SetBody(generateBearerTokenBody(id)) + bearerToken.SetSignature(generateSignature("id", id)) + + return bearerToken +} + func TestHeaderFilter_StableMarshal(t *testing.T) { filterFrom := generateFilter(acl.HeaderTypeObject, "CID", "Container ID Value") transport := new(grpc.EACLRecord_FilterInfo) @@ -144,3 +192,51 @@ func TestTable_StableMarshal(t *testing.T) { require.Equal(t, tableFrom, tableTo) }) } + +func TestTokenLifetime_StableMarshal(t *testing.T) { + lifetimeFrom := generateLifetime(10, 20, 30) + transport := new(grpc.BearerToken_Body_TokenLifetime) + + t.Run("non empty", func(t *testing.T) { + wire, err := lifetimeFrom.StableMarshal(nil) + require.NoError(t, err) + + err = transport.Unmarshal(wire) + require.NoError(t, err) + + lifetimeTo := acl.TokenLifetimeFromGRPCMessage(transport) + require.Equal(t, lifetimeFrom, lifetimeTo) + }) +} + +func TestBearerTokenBody_StableMarshal(t *testing.T) { + bearerTokenBodyFrom := generateBearerTokenBody("Bearer Token Body") + transport := new(grpc.BearerToken_Body) + + t.Run("non empty", func(t *testing.T) { + wire, err := bearerTokenBodyFrom.StableMarshal(nil) + require.NoError(t, err) + + err = transport.Unmarshal(wire) + require.NoError(t, err) + + bearerTokenBodyTo := acl.BearerTokenBodyFromGRPCMessage(transport) + require.Equal(t, bearerTokenBodyFrom, bearerTokenBodyTo) + }) +} + +func TestBearerToken_StableMarshal(t *testing.T) { + bearerTokenFrom := generateBearerToken("Bearer Token") + transport := new(grpc.BearerToken) + + t.Run("non empty", func(t *testing.T) { + wire, err := bearerTokenFrom.StableMarshal(nil) + require.NoError(t, err) + + err = transport.Unmarshal(wire) + require.NoError(t, err) + + bearerTokenTo := acl.BearerTokenFromGRPCMessage(transport) + require.Equal(t, bearerTokenFrom, bearerTokenTo) + }) +} diff --git a/v2/acl/types.go b/v2/acl/types.go index 5fb1b6b..5a50b88 100644 --- a/v2/acl/types.go +++ b/v2/acl/types.go @@ -40,6 +40,24 @@ type Table struct { records []*Record } +type TokenLifetime struct { + exp, nbf, iat uint64 +} + +type BearerTokenBody struct { + eacl *Table + + ownerID *refs.OwnerID + + lifetime *TokenLifetime +} + +type BearerToken struct { + body *BearerTokenBody + + sig *refs.Signature +} + // TargetInfo is a unified enum of MatchType enum from proto definition. type MatchType uint32 @@ -258,3 +276,115 @@ func (t *Table) SetRecords(v []*Record) { t.records = v } } + +func (l *TokenLifetime) GetExp() uint64 { + if l != nil { + return l.exp + } + + return 0 +} + +func (l *TokenLifetime) SetExp(v uint64) { + if l != nil { + l.exp = v + } +} + +func (l *TokenLifetime) GetNbf() uint64 { + if l != nil { + return l.nbf + } + + return 0 +} + +func (l *TokenLifetime) SetNbf(v uint64) { + if l != nil { + l.nbf = v + } +} + +func (l *TokenLifetime) GetIat() uint64 { + if l != nil { + return l.iat + } + + return 0 +} + +func (l *TokenLifetime) SetIat(v uint64) { + if l != nil { + l.iat = v + } +} + +func (bt *BearerTokenBody) GetEACL() *Table { + if bt != nil { + return bt.eacl + } + + return nil +} + +func (bt *BearerTokenBody) SetEACL(v *Table) { + if bt != nil { + bt.eacl = v + } +} + +func (bt *BearerTokenBody) GetOwnerID() *refs.OwnerID { + if bt != nil { + return bt.ownerID + } + + return nil +} + +func (bt *BearerTokenBody) SetOwnerID(v *refs.OwnerID) { + if bt != nil { + bt.ownerID = v + } +} + +func (bt *BearerTokenBody) GetLifetime() *TokenLifetime { + if bt != nil { + return bt.lifetime + } + + return nil +} + +func (bt *BearerTokenBody) SetLifetime(v *TokenLifetime) { + if bt != nil { + bt.lifetime = v + } +} + +func (bt *BearerToken) GetBody() *BearerTokenBody { + if bt != nil { + return bt.body + } + + return nil +} + +func (bt *BearerToken) SetBody(v *BearerTokenBody) { + if bt != nil { + bt.body = v + } +} + +func (bt *BearerToken) GetSignature() *refs.Signature { + if bt != nil { + return bt.sig + } + + return nil +} + +func (bt *BearerToken) SetSignature(v *refs.Signature) { + if bt != nil { + bt.sig = v + } +} From 07f25bd0120f73b87fcc2a0c790c0a07631f849a Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Thu, 20 Aug 2020 13:32:02 +0300 Subject: [PATCH 0356/1196] Merge session and service packages into session package Signed-off-by: Alex Vanin --- v2/service/convert.go | 689 ---------------- v2/service/grpc/verify.go | 71 -- v2/service/grpc/version.go | 3 - v2/service/marshal.go | 752 ------------------ v2/service/marshal_test.go | 401 ---------- v2/service/service.go | 721 ----------------- v2/session/convert.go | 568 ++++++++++++- v2/session/grpc/service.go | 15 +- .../grpc/meta.go => session/grpc/types.go} | 125 +-- v2/session/marshal.go | 572 ++++++++++++- v2/session/marshal_test.go | 341 +++++++- v2/session/types.go | 605 +++++++++++++- 12 files changed, 2122 insertions(+), 2741 deletions(-) delete mode 100644 v2/service/convert.go delete mode 100644 v2/service/grpc/verify.go delete mode 100644 v2/service/grpc/version.go delete mode 100644 v2/service/marshal.go delete mode 100644 v2/service/marshal_test.go delete mode 100644 v2/service/service.go rename v2/{service/grpc/meta.go => session/grpc/types.go} (64%) diff --git a/v2/service/convert.go b/v2/service/convert.go deleted file mode 100644 index 6bffe27..0000000 --- a/v2/service/convert.go +++ /dev/null @@ -1,689 +0,0 @@ -package service - -import ( - "fmt" - - "github.com/nspcc-dev/neofs-api-go/v2/acl" - "github.com/nspcc-dev/neofs-api-go/v2/refs" - service "github.com/nspcc-dev/neofs-api-go/v2/service/grpc" -) - -func VersionToGRPCMessage(v *Version) *service.Version { - if v == nil { - return nil - } - - msg := new(service.Version) - - msg.SetMajor(v.GetMajor()) - msg.SetMinor(v.GetMinor()) - - return msg -} - -func VersionFromGRPCMessage(m *service.Version) *Version { - if m == nil { - return nil - } - - v := new(Version) - - v.SetMajor(m.GetMajor()) - v.SetMinor(m.GetMinor()) - - return v -} - -func XHeaderToGRPCMessage(x *XHeader) *service.XHeader { - if x == nil { - return nil - } - - m := new(service.XHeader) - - m.SetKey(x.GetKey()) - m.SetValue(x.GetValue()) - - return m -} - -func XHeaderFromGRPCMessage(m *service.XHeader) *XHeader { - if m == nil { - return nil - } - - x := new(XHeader) - - x.SetKey(m.GetKey()) - x.SetValue(m.GetValue()) - - return x -} - -func SessionTokenToGRPCMessage(t *SessionToken) *service.SessionToken { - if t == nil { - return nil - } - - m := new(service.SessionToken) - - m.SetBody( - SessionTokenBodyToGRPCMessage(t.GetBody()), - ) - - m.SetSignature( - SignatureToGRPCMessage(t.GetSignature()), - ) - - return m -} - -func SessionTokenFromGRPCMessage(m *service.SessionToken) *SessionToken { - if m == nil { - return nil - } - - t := new(SessionToken) - - t.SetBody( - SessionTokenBodyFromGRPCMessage(m.GetBody()), - ) - - t.SetSignature( - SignatureFromGRPCMessage(m.GetSignature()), - ) - - return t -} - -func BearerTokenToGRPCMessage(t *BearerToken) *service.BearerToken { - if t == nil { - return nil - } - - m := new(service.BearerToken) - - m.SetBody( - BearerTokenBodyToGRPCMessage(t.GetBody()), - ) - - m.SetSignature( - SignatureToGRPCMessage(t.GetSignature()), - ) - - return m -} - -func BearerTokenFromGRPCMessage(m *service.BearerToken) *BearerToken { - if m == nil { - return nil - } - - bt := new(BearerToken) - - bt.SetBody( - BearerTokenBodyFromGRPCMessage(m.GetBody()), - ) - - bt.SetSignature( - SignatureFromGRPCMessage(m.GetSignature()), - ) - - return bt -} - -func RequestVerificationHeaderToGRPCMessage(r *RequestVerificationHeader) *service.RequestVerificationHeader { - if r == nil { - return nil - } - - m := new(service.RequestVerificationHeader) - - m.SetBodySignature( - SignatureToGRPCMessage(r.GetBodySignature()), - ) - - m.SetMetaSignature( - SignatureToGRPCMessage(r.GetMetaSignature()), - ) - - m.SetOriginSignature( - SignatureToGRPCMessage(r.GetOriginSignature()), - ) - - m.SetOrigin( - RequestVerificationHeaderToGRPCMessage(r.GetOrigin()), - ) - - return m -} - -func RequestVerificationHeaderFromGRPCMessage(m *service.RequestVerificationHeader) *RequestVerificationHeader { - if m == nil { - return nil - } - - r := new(RequestVerificationHeader) - - r.SetBodySignature( - SignatureFromGRPCMessage(m.GetBodySignature()), - ) - - r.SetMetaSignature( - SignatureFromGRPCMessage(m.GetMetaSignature()), - ) - - r.SetOriginSignature( - SignatureFromGRPCMessage(m.GetOriginSignature()), - ) - - r.SetOrigin( - RequestVerificationHeaderFromGRPCMessage(m.GetOrigin()), - ) - - return r -} - -func RequestMetaHeaderToGRPCMessage(r *RequestMetaHeader) *service.RequestMetaHeader { - if r == nil { - return nil - } - - m := new(service.RequestMetaHeader) - - m.SetTtl(r.GetTTL()) - m.SetEpoch(r.GetEpoch()) - - m.SetVersion( - VersionToGRPCMessage(r.GetVersion()), - ) - - m.SetSessionToken( - SessionTokenToGRPCMessage(r.GetSessionToken()), - ) - - m.SetBearerToken( - BearerTokenToGRPCMessage(r.GetBearerToken()), - ) - - m.SetOrigin( - RequestMetaHeaderToGRPCMessage(r.GetOrigin()), - ) - - xHeaders := r.GetXHeaders() - xHdrMsg := make([]*service.XHeader, 0, len(xHeaders)) - - for i := range xHeaders { - xHdrMsg = append(xHdrMsg, XHeaderToGRPCMessage(xHeaders[i])) - } - - m.SetXHeaders(xHdrMsg) - - return m -} - -func RequestMetaHeaderFromGRPCMessage(m *service.RequestMetaHeader) *RequestMetaHeader { - if m == nil { - return nil - } - - r := new(RequestMetaHeader) - - r.SetTTL(m.GetTtl()) - r.SetEpoch(m.GetEpoch()) - - r.SetVersion( - VersionFromGRPCMessage(m.GetVersion()), - ) - - r.SetSessionToken( - SessionTokenFromGRPCMessage(m.GetSessionToken()), - ) - - r.SetBearerToken( - BearerTokenFromGRPCMessage(m.GetBearerToken()), - ) - - r.SetOrigin( - RequestMetaHeaderFromGRPCMessage(m.GetOrigin()), - ) - - xHdrMsg := m.GetXHeaders() - xHeaders := make([]*XHeader, 0, len(xHdrMsg)) - - for i := range xHdrMsg { - xHeaders = append(xHeaders, XHeaderFromGRPCMessage(xHdrMsg[i])) - } - - r.SetXHeaders(xHeaders) - - return r -} - -func SignatureToGRPCMessage(s *Signature) *service.Signature { - if s == nil { - return nil - } - - m := new(service.Signature) - - m.SetKey(s.GetKey()) - m.SetSign(s.GetSign()) - - return m -} - -func SignatureFromGRPCMessage(m *service.Signature) *Signature { - if m == nil { - return nil - } - - s := new(Signature) - - s.SetKey(m.GetKey()) - s.SetSign(m.GetSign()) - - return s -} - -func TokenLifetimeToGRPCMessage(tl *TokenLifetime) *service.TokenLifetime { - if tl == nil { - return nil - } - - m := new(service.TokenLifetime) - - m.SetExp(tl.GetExp()) - m.SetNbf(tl.GetNbf()) - m.SetIat(tl.GetIat()) - - return m -} - -func TokenLifetimeFromGRPCMessage(m *service.TokenLifetime) *TokenLifetime { - if m == nil { - return nil - } - - tl := new(TokenLifetime) - - tl.SetExp(m.GetExp()) - tl.SetNbf(m.GetNbf()) - tl.SetIat(m.GetIat()) - - return tl -} - -func BearerTokenBodyToGRPCMessage(v *BearerTokenBody) *service.BearerToken_Body { - if v == nil { - return nil - } - - m := new(service.BearerToken_Body) - - m.SetEaclTable( - acl.TableToGRPCMessage(v.GetEACL()), - ) - - m.SetOwnerId( - refs.OwnerIDToGRPCMessage(v.GetOwnerID()), - ) - - m.SetLifetime( - TokenLifetimeToGRPCMessage(v.GetLifetime()), - ) - - return m -} - -func BearerTokenBodyFromGRPCMessage(m *service.BearerToken_Body) *BearerTokenBody { - if m == nil { - return nil - } - - bt := new(BearerTokenBody) - - bt.SetEACL( - acl.TableFromGRPCMessage(m.GetEaclTable()), - ) - - bt.SetOwnerID( - refs.OwnerIDFromGRPCMessage(m.GetOwnerId()), - ) - - bt.SetLifetime( - TokenLifetimeFromGRPCMessage(m.GetLifetime()), - ) - - return bt -} - -func RequestHeadersToGRPC( - src interface { - GetMetaHeader() *RequestMetaHeader - GetVerificationHeader() *RequestVerificationHeader - }, - dst interface { - SetMetaHeader(*service.RequestMetaHeader) - SetVerifyHeader(*service.RequestVerificationHeader) - }, -) { - dst.SetMetaHeader( - RequestMetaHeaderToGRPCMessage(src.GetMetaHeader()), - ) - - dst.SetVerifyHeader( - RequestVerificationHeaderToGRPCMessage(src.GetVerificationHeader()), - ) -} - -func RequestHeadersFromGRPC( - src interface { - GetMetaHeader() *service.RequestMetaHeader - GetVerifyHeader() *service.RequestVerificationHeader - }, - dst interface { - SetMetaHeader(*RequestMetaHeader) - SetVerificationHeader(*RequestVerificationHeader) - }, -) { - dst.SetMetaHeader( - RequestMetaHeaderFromGRPCMessage(src.GetMetaHeader()), - ) - - dst.SetVerificationHeader( - RequestVerificationHeaderFromGRPCMessage(src.GetVerifyHeader()), - ) -} - -func ResponseVerificationHeaderToGRPCMessage(r *ResponseVerificationHeader) *service.ResponseVerificationHeader { - if r == nil { - return nil - } - - m := new(service.ResponseVerificationHeader) - - m.SetBodySignature( - SignatureToGRPCMessage(r.GetBodySignature()), - ) - - m.SetMetaSignature( - SignatureToGRPCMessage(r.GetMetaSignature()), - ) - - m.SetOriginSignature( - SignatureToGRPCMessage(r.GetOriginSignature()), - ) - - m.SetOrigin( - ResponseVerificationHeaderToGRPCMessage(r.GetOrigin()), - ) - - return m -} - -func ResponseVerificationHeaderFromGRPCMessage(m *service.ResponseVerificationHeader) *ResponseVerificationHeader { - if m == nil { - return nil - } - - r := new(ResponseVerificationHeader) - - r.SetBodySignature( - SignatureFromGRPCMessage(m.GetBodySignature()), - ) - - r.SetMetaSignature( - SignatureFromGRPCMessage(m.GetMetaSignature()), - ) - - r.SetOriginSignature( - SignatureFromGRPCMessage(m.GetOriginSignature()), - ) - - r.SetOrigin( - ResponseVerificationHeaderFromGRPCMessage(m.GetOrigin()), - ) - - return r -} - -func ResponseMetaHeaderToGRPCMessage(r *ResponseMetaHeader) *service.ResponseMetaHeader { - if r == nil { - return nil - } - - m := new(service.ResponseMetaHeader) - - m.SetTtl(r.GetTTL()) - m.SetEpoch(r.GetEpoch()) - - m.SetVersion( - VersionToGRPCMessage(r.GetVersion()), - ) - - m.SetOrigin( - ResponseMetaHeaderToGRPCMessage(r.GetOrigin()), - ) - - xHeaders := r.GetXHeaders() - xHdrMsg := make([]*service.XHeader, 0, len(xHeaders)) - - for i := range xHeaders { - xHdrMsg = append(xHdrMsg, XHeaderToGRPCMessage(xHeaders[i])) - } - - m.SetXHeaders(xHdrMsg) - - return m -} - -func ResponseMetaHeaderFromGRPCMessage(m *service.ResponseMetaHeader) *ResponseMetaHeader { - if m == nil { - return nil - } - - r := new(ResponseMetaHeader) - - r.SetTTL(m.GetTtl()) - r.SetEpoch(m.GetEpoch()) - - r.SetVersion( - VersionFromGRPCMessage(m.GetVersion()), - ) - - r.SetOrigin( - ResponseMetaHeaderFromGRPCMessage(m.GetOrigin()), - ) - - xHdrMsg := m.GetXHeaders() - xHeaders := make([]*XHeader, 0, len(xHdrMsg)) - - for i := range xHdrMsg { - xHeaders = append(xHeaders, XHeaderFromGRPCMessage(xHdrMsg[i])) - } - - r.SetXHeaders(xHeaders) - - return r -} - -func ResponseHeadersToGRPC( - src interface { - GetMetaHeader() *ResponseMetaHeader - GetVerificationHeader() *ResponseVerificationHeader - }, - dst interface { - SetMetaHeader(*service.ResponseMetaHeader) - SetVerifyHeader(*service.ResponseVerificationHeader) - }, -) { - dst.SetMetaHeader( - ResponseMetaHeaderToGRPCMessage(src.GetMetaHeader()), - ) - - dst.SetVerifyHeader( - ResponseVerificationHeaderToGRPCMessage(src.GetVerificationHeader()), - ) -} - -func ResponseHeadersFromGRPC( - src interface { - GetMetaHeader() *service.ResponseMetaHeader - GetVerifyHeader() *service.ResponseVerificationHeader - }, - dst interface { - SetMetaHeader(*ResponseMetaHeader) - SetVerificationHeader(*ResponseVerificationHeader) - }, -) { - dst.SetMetaHeader( - ResponseMetaHeaderFromGRPCMessage(src.GetMetaHeader()), - ) - - dst.SetVerificationHeader( - ResponseVerificationHeaderFromGRPCMessage(src.GetVerifyHeader()), - ) -} - -func ObjectSessionVerbToGRPCField(v ObjectSessionVerb) service.ObjectSessionContext_Verb { - switch v { - case ObjectVerbPut: - return service.ObjectSessionContext_PUT - case ObjectVerbGet: - return service.ObjectSessionContext_GET - case ObjectVerbHead: - return service.ObjectSessionContext_HEAD - case ObjectVerbSearch: - return service.ObjectSessionContext_SEARCH - case ObjectVerbDelete: - return service.ObjectSessionContext_DELETE - case ObjectVerbRange: - return service.ObjectSessionContext_RANGE - case ObjectVerbRangeHash: - return service.ObjectSessionContext_RANGEHASH - default: - return service.ObjectSessionContext_VERB_UNSPECIFIED - } -} - -func ObjectSessionVerbFromGRPCField(v service.ObjectSessionContext_Verb) ObjectSessionVerb { - switch v { - case service.ObjectSessionContext_PUT: - return ObjectVerbPut - case service.ObjectSessionContext_GET: - return ObjectVerbGet - case service.ObjectSessionContext_HEAD: - return ObjectVerbHead - case service.ObjectSessionContext_SEARCH: - return ObjectVerbSearch - case service.ObjectSessionContext_DELETE: - return ObjectVerbDelete - case service.ObjectSessionContext_RANGE: - return ObjectVerbRange - case service.ObjectSessionContext_RANGEHASH: - return ObjectVerbRangeHash - default: - return ObjectVerbUnknown - } -} - -func ObjectSessionContextToGRPCMessage(c *ObjectSessionContext) *service.ObjectSessionContext { - if c == nil { - return nil - } - - m := new(service.ObjectSessionContext) - - m.SetVerb( - ObjectSessionVerbToGRPCField(c.GetVerb()), - ) - - m.SetAddress( - refs.AddressToGRPCMessage(c.GetAddress()), - ) - - return m -} - -func ObjectSessionContextFromGRPCMessage(m *service.ObjectSessionContext) *ObjectSessionContext { - if m == nil { - return nil - } - - c := new(ObjectSessionContext) - - c.SetVerb( - ObjectSessionVerbFromGRPCField(m.GetVerb()), - ) - - c.SetAddress( - refs.AddressFromGRPCMessage(m.GetAddress()), - ) - - return c -} - -func SessionTokenBodyToGRPCMessage(t *SessionTokenBody) *service.SessionToken_Body { - if t == nil { - return nil - } - - m := new(service.SessionToken_Body) - - switch v := t.GetContext(); t := v.(type) { - case nil: - case *ObjectSessionContext: - m.SetObjectServiceContext( - ObjectSessionContextToGRPCMessage(t), - ) - default: - panic(fmt.Sprintf("unknown session context %T", t)) - } - - m.SetId(t.GetID()) - - m.SetOwnerId( - refs.OwnerIDToGRPCMessage(t.GetOwnerID()), - ) - - m.SetLifetime( - TokenLifetimeToGRPCMessage(t.GetLifetime()), - ) - - m.SetSessionKey(t.GetSessionKey()) - - return m -} - -func SessionTokenBodyFromGRPCMessage(m *service.SessionToken_Body) *SessionTokenBody { - if m == nil { - return nil - } - - t := new(SessionTokenBody) - - switch v := m.GetContext().(type) { - case nil: - case *service.SessionToken_Body_Object: - t.SetContext( - ObjectSessionContextFromGRPCMessage(v.Object), - ) - default: - panic(fmt.Sprintf("unknown session context %T", v)) - } - - t.SetID(m.GetId()) - - t.SetOwnerID( - refs.OwnerIDFromGRPCMessage(m.GetOwnerId()), - ) - - t.SetLifetime( - TokenLifetimeFromGRPCMessage(m.GetLifetime()), - ) - - t.SetSessionKey(m.GetSessionKey()) - - return t -} diff --git a/v2/service/grpc/verify.go b/v2/service/grpc/verify.go deleted file mode 100644 index c9081fd..0000000 --- a/v2/service/grpc/verify.go +++ /dev/null @@ -1,71 +0,0 @@ -package service - -// SetKey sets public key in a binary format. -func (m *Signature) SetKey(v []byte) { - if m != nil { - m.Key = v - } -} - -// SetSign sets signature. -func (m *Signature) SetSign(v []byte) { - if m != nil { - m.Sign = v - } -} - -// SetBodySignature sets signature of the request body. -func (m *RequestVerificationHeader) SetBodySignature(v *Signature) { - if m != nil { - m.BodySignature = v - } -} - -// SetMetaSignature sets signature of the request meta. -func (m *RequestVerificationHeader) SetMetaSignature(v *Signature) { - if m != nil { - m.MetaSignature = v - } -} - -// SetOriginSignature sets signature of the origin verification header of the request. -func (m *RequestVerificationHeader) SetOriginSignature(v *Signature) { - if m != nil { - m.OriginSignature = v - } -} - -// SetOrigin sets origin verification header of the request. -func (m *RequestVerificationHeader) SetOrigin(v *RequestVerificationHeader) { - if m != nil { - m.Origin = v - } -} - -// SetBodySignature sets signature of the response body. -func (m *ResponseVerificationHeader) SetBodySignature(v *Signature) { - if m != nil { - m.BodySignature = v - } -} - -// SetMetaSignature sets signature of the response meta. -func (m *ResponseVerificationHeader) SetMetaSignature(v *Signature) { - if m != nil { - m.MetaSignature = v - } -} - -// SetOriginSignature sets signature of the origin verification header of the response. -func (m *ResponseVerificationHeader) SetOriginSignature(v *Signature) { - if m != nil { - m.OriginSignature = v - } -} - -// SetOrigin sets origin verification header of the response. -func (m *ResponseVerificationHeader) SetOrigin(v *ResponseVerificationHeader) { - if m != nil { - m.Origin = v - } -} diff --git a/v2/service/grpc/version.go b/v2/service/grpc/version.go deleted file mode 100644 index cca5fe4..0000000 --- a/v2/service/grpc/version.go +++ /dev/null @@ -1,3 +0,0 @@ -package service - -var APIVersion = Version{Major: 2, Minor: 0} diff --git a/v2/service/marshal.go b/v2/service/marshal.go deleted file mode 100644 index f30c9df..0000000 --- a/v2/service/marshal.go +++ /dev/null @@ -1,752 +0,0 @@ -package service - -import ( - "github.com/nspcc-dev/neofs-api-go/util/proto" -) - -const ( - signatureKeyField = 1 - signatureValueField = 2 - - versionMajorField = 1 - versionMinorField = 2 - - xheaderKeyField = 1 - xheaderValueField = 2 - - lifetimeExpirationField = 1 - lifetimeNotValidBeforeField = 2 - lifetimeIssuedAtField = 3 - - objectCtxVerbField = 1 - objectCtxAddressField = 2 - - sessionTokenBodyIDField = 1 - sessionTokenBodyOwnerField = 2 - sessionTokenBodyLifetimeField = 3 - sessionTokenBodyKeyField = 4 - sessionTokenBodyObjectCtxField = 5 - - sessionTokenBodyField = 1 - sessionTokenSignatureField = 2 - - bearerTokenBodyACLField = 1 - bearerTokenBodyOwnerField = 2 - bearerTokenBodyLifetimeField = 3 - - bearerTokenBodyField = 1 - bearerTokenSignatureField = 2 - - reqMetaHeaderVersionField = 1 - reqMetaHeaderEpochField = 2 - reqMetaHeaderTTLField = 3 - reqMetaHeaderXHeadersField = 4 - reqMetaHeaderSessionTokenField = 5 - reqMetaHeaderBearerTokenField = 6 - reqMetaHeaderOriginField = 7 - - reqVerifHeaderBodySignatureField = 1 - reqVerifHeaderMetaSignatureField = 2 - reqVerifHeaderOriginSignatureField = 3 - reqVerifHeaderOriginField = 4 - - respMetaHeaderVersionField = 1 - respMetaHeaderEpochField = 2 - respMetaHeaderTTLField = 3 - respMetaHeaderXHeadersField = 4 - respMetaHeaderOriginField = 5 - - respVerifHeaderBodySignatureField = 1 - respVerifHeaderMetaSignatureField = 2 - respVerifHeaderOriginSignatureField = 3 - respVerifHeaderOriginField = 4 -) - -func (s *Signature) StableMarshal(buf []byte) ([]byte, error) { - if s == nil { - return []byte{}, nil - } - - if buf == nil { - buf = make([]byte, s.StableSize()) - } - - var ( - offset, n int - err error - ) - - n, err = proto.BytesMarshal(signatureKeyField, buf[offset:], s.key) - if err != nil { - return nil, err - } - - offset += n - - _, err = proto.BytesMarshal(signatureValueField, buf[offset:], s.sign) - if err != nil { - return nil, err - } - - return buf, nil -} - -func (s *Signature) StableSize() (size int) { - if s == nil { - return 0 - } - - size += proto.BytesSize(signatureKeyField, s.key) - size += proto.BytesSize(signatureValueField, s.sign) - - return size -} - -func (v *Version) StableMarshal(buf []byte) ([]byte, error) { - if v == nil { - return []byte{}, nil - } - - if buf == nil { - buf = make([]byte, v.StableSize()) - } - - var ( - offset, n int - err error - ) - - n, err = proto.UInt32Marshal(versionMajorField, buf[offset:], v.major) - if err != nil { - return nil, err - } - - offset += n - - _, err = proto.UInt32Marshal(versionMinorField, buf[offset:], v.minor) - if err != nil { - return nil, err - } - - return buf, nil -} - -func (v *Version) StableSize() (size int) { - if v == nil { - return 0 - } - - size += proto.UInt32Size(versionMajorField, v.major) - size += proto.UInt32Size(versionMinorField, v.minor) - - return size -} - -func (x *XHeader) StableMarshal(buf []byte) ([]byte, error) { - if x == nil { - return []byte{}, nil - } - - if buf == nil { - buf = make([]byte, x.StableSize()) - } - - var ( - offset, n int - err error - ) - - n, err = proto.StringMarshal(xheaderKeyField, buf[offset:], x.key) - if err != nil { - return nil, err - } - - offset += n - - _, err = proto.StringMarshal(xheaderValueField, buf[offset:], x.val) - if err != nil { - return nil, err - } - - return buf, nil -} - -func (x *XHeader) StableSize() (size int) { - if x == nil { - return 0 - } - - size += proto.StringSize(xheaderKeyField, x.key) - size += proto.StringSize(xheaderValueField, x.val) - - return size -} - -func (l *TokenLifetime) StableMarshal(buf []byte) ([]byte, error) { - if l == nil { - return []byte{}, nil - } - - if buf == nil { - buf = make([]byte, l.StableSize()) - } - - var ( - offset, n int - err error - ) - - n, err = proto.UInt64Marshal(lifetimeExpirationField, buf[offset:], l.exp) - if err != nil { - return nil, err - } - - offset += n - - n, err = proto.UInt64Marshal(lifetimeNotValidBeforeField, buf[offset:], l.nbf) - if err != nil { - return nil, err - } - - offset += n - - _, err = proto.UInt64Marshal(lifetimeIssuedAtField, buf[offset:], l.iat) - if err != nil { - return nil, err - } - - return buf, nil -} - -func (l *TokenLifetime) StableSize() (size int) { - if l == nil { - return 0 - } - - size += proto.UInt64Size(lifetimeExpirationField, l.exp) - size += proto.UInt64Size(lifetimeNotValidBeforeField, l.nbf) - size += proto.UInt64Size(lifetimeIssuedAtField, l.iat) - - return size -} - -func (c *ObjectSessionContext) StableMarshal(buf []byte) ([]byte, error) { - if c == nil { - return []byte{}, nil - } - - if buf == nil { - buf = make([]byte, c.StableSize()) - } - - var ( - offset, n int - err error - ) - - n, err = proto.EnumMarshal(objectCtxVerbField, buf[offset:], int32(c.verb)) - if err != nil { - return nil, err - } - - offset += n - - _, err = proto.NestedStructureMarshal(objectCtxAddressField, buf[offset:], c.addr) - if err != nil { - return nil, err - } - - return buf, nil -} - -func (c *ObjectSessionContext) StableSize() (size int) { - if c == nil { - return 0 - } - - size += proto.EnumSize(objectCtxVerbField, int32(c.verb)) - size += proto.NestedStructureSize(objectCtxAddressField, c.addr) - - return size -} - -func (t *SessionTokenBody) StableMarshal(buf []byte) ([]byte, error) { - if t == nil { - return []byte{}, nil - } - - if buf == nil { - buf = make([]byte, t.StableSize()) - } - - var ( - offset, n int - err error - ) - - n, err = proto.BytesMarshal(sessionTokenBodyIDField, buf[offset:], t.id) - if err != nil { - return nil, err - } - - offset += n - - n, err = proto.NestedStructureMarshal(sessionTokenBodyOwnerField, buf[offset:], t.ownerID) - if err != nil { - return nil, err - } - - offset += n - - n, err = proto.NestedStructureMarshal(sessionTokenBodyLifetimeField, buf[offset:], t.lifetime) - if err != nil { - return nil, err - } - - offset += n - - n, err = proto.BytesMarshal(sessionTokenBodyKeyField, buf[offset:], t.sessionKey) - if err != nil { - return nil, err - } - - offset += n - - if t.ctx != nil { - switch v := t.ctx.(type) { - case *ObjectSessionContext: - _, err = proto.NestedStructureMarshal(sessionTokenBodyObjectCtxField, buf[offset:], v) - if err != nil { - return nil, err - } - default: - panic("cannot marshal unknown session token context") - } - } - - return buf, nil -} - -func (t *SessionTokenBody) StableSize() (size int) { - if t == nil { - return 0 - } - - size += proto.BytesSize(sessionTokenBodyIDField, t.id) - size += proto.NestedStructureSize(sessionTokenBodyOwnerField, t.ownerID) - size += proto.NestedStructureSize(sessionTokenBodyLifetimeField, t.lifetime) - size += proto.BytesSize(sessionTokenBodyKeyField, t.sessionKey) - - if t.ctx != nil { - switch v := t.ctx.(type) { - case *ObjectSessionContext: - size += proto.NestedStructureSize(sessionTokenBodyObjectCtxField, v) - default: - panic("cannot marshal unknown session token context") - } - } - - return size -} - -func (t *SessionToken) StableMarshal(buf []byte) ([]byte, error) { - if t == nil { - return []byte{}, nil - } - - if buf == nil { - buf = make([]byte, t.StableSize()) - } - - var ( - offset, n int - err error - ) - - n, err = proto.NestedStructureMarshal(sessionTokenBodyField, buf[offset:], t.body) - if err != nil { - return nil, err - } - - offset += n - - _, err = proto.NestedStructureMarshal(sessionTokenSignatureField, buf[offset:], t.sig) - if err != nil { - return nil, err - } - - return buf, nil -} - -func (t *SessionToken) StableSize() (size int) { - if t == nil { - return 0 - } - - size += proto.NestedStructureSize(sessionTokenBodyField, t.body) - size += proto.NestedStructureSize(sessionTokenSignatureField, t.sig) - - return size -} - -func (bt *BearerTokenBody) StableMarshal(buf []byte) ([]byte, error) { - if bt == nil { - return []byte{}, nil - } - - if buf == nil { - buf = make([]byte, bt.StableSize()) - } - - var ( - offset, n int - err error - ) - - n, err = proto.NestedStructureMarshal(bearerTokenBodyACLField, buf[offset:], bt.eacl) - if err != nil { - return nil, err - } - - offset += n - - n, err = proto.NestedStructureMarshal(bearerTokenBodyOwnerField, buf[offset:], bt.ownerID) - if err != nil { - return nil, err - } - - offset += n - - _, err = proto.NestedStructureMarshal(bearerTokenBodyLifetimeField, buf[offset:], bt.lifetime) - if err != nil { - return nil, err - } - - return buf, nil -} - -func (bt *BearerTokenBody) StableSize() (size int) { - if bt == nil { - return 0 - } - - size += proto.NestedStructureSize(bearerTokenBodyACLField, bt.eacl) - size += proto.NestedStructureSize(bearerTokenBodyOwnerField, bt.ownerID) - size += proto.NestedStructureSize(bearerTokenBodyLifetimeField, bt.lifetime) - - return size -} - -func (bt *BearerToken) StableMarshal(buf []byte) ([]byte, error) { - if bt == nil { - return []byte{}, nil - } - - if buf == nil { - buf = make([]byte, bt.StableSize()) - } - - var ( - offset, n int - err error - ) - - n, err = proto.NestedStructureMarshal(bearerTokenBodyField, buf[offset:], bt.body) - if err != nil { - return nil, err - } - - offset += n - - _, err = proto.NestedStructureMarshal(bearerTokenSignatureField, buf[offset:], bt.sig) - if err != nil { - return nil, err - } - - return buf, nil -} - -func (bt *BearerToken) StableSize() (size int) { - if bt == nil { - return 0 - } - - size += proto.NestedStructureSize(bearerTokenBodyField, bt.body) - size += proto.NestedStructureSize(bearerTokenSignatureField, bt.sig) - - return size -} - -func (r *RequestMetaHeader) StableMarshal(buf []byte) ([]byte, error) { - if r == nil { - return []byte{}, nil - } - - if buf == nil { - buf = make([]byte, r.StableSize()) - } - - var ( - offset, n int - err error - ) - - n, err = proto.NestedStructureMarshal(reqMetaHeaderVersionField, buf[offset:], r.version) - if err != nil { - return nil, err - } - - offset += n - - n, err = proto.UInt64Marshal(reqMetaHeaderEpochField, buf[offset:], r.epoch) - if err != nil { - return nil, err - } - - offset += n - - n, err = proto.UInt32Marshal(reqMetaHeaderTTLField, buf[offset:], r.ttl) - if err != nil { - return nil, err - } - - offset += n - - for i := range r.xHeaders { - n, err = proto.NestedStructureMarshal(reqMetaHeaderXHeadersField, buf[offset:], r.xHeaders[i]) - if err != nil { - return nil, err - } - - offset += n - } - - n, err = proto.NestedStructureMarshal(reqMetaHeaderSessionTokenField, buf[offset:], r.sessionToken) - if err != nil { - return nil, err - } - - offset += n - - n, err = proto.NestedStructureMarshal(reqMetaHeaderBearerTokenField, buf[offset:], r.bearerToken) - if err != nil { - return nil, err - } - - offset += n - - _, err = proto.NestedStructureMarshal(reqMetaHeaderOriginField, buf[offset:], r.origin) - if err != nil { - return nil, err - } - - return buf, nil -} - -func (r *RequestMetaHeader) StableSize() (size int) { - if r == nil { - return 0 - } - - if r.version != nil { - size += proto.NestedStructureSize(reqMetaHeaderVersionField, r.version) - } - - size += proto.UInt64Size(reqMetaHeaderEpochField, r.epoch) - size += proto.UInt32Size(reqMetaHeaderTTLField, r.ttl) - - for i := range r.xHeaders { - size += proto.NestedStructureSize(reqMetaHeaderXHeadersField, r.xHeaders[i]) - } - - size += proto.NestedStructureSize(reqMetaHeaderSessionTokenField, r.sessionToken) - size += proto.NestedStructureSize(reqMetaHeaderBearerTokenField, r.bearerToken) - size += proto.NestedStructureSize(reqMetaHeaderOriginField, r.origin) - - return size -} - -func (r *RequestVerificationHeader) StableMarshal(buf []byte) ([]byte, error) { - if r == nil { - return []byte{}, nil - } - - if buf == nil { - buf = make([]byte, r.StableSize()) - } - - var ( - offset, n int - err error - ) - - n, err = proto.NestedStructureMarshal(reqVerifHeaderBodySignatureField, buf[offset:], r.bodySig) - if err != nil { - return nil, err - } - - offset += n - - n, err = proto.NestedStructureMarshal(reqVerifHeaderMetaSignatureField, buf[offset:], r.metaSig) - if err != nil { - return nil, err - } - - offset += n - - n, err = proto.NestedStructureMarshal(reqVerifHeaderOriginSignatureField, buf[offset:], r.originSig) - if err != nil { - return nil, err - } - - offset += n - - _, err = proto.NestedStructureMarshal(reqVerifHeaderOriginField, buf[offset:], r.origin) - if err != nil { - return nil, err - } - - return buf, nil -} - -func (r *RequestVerificationHeader) StableSize() (size int) { - if r == nil { - return 0 - } - - size += proto.NestedStructureSize(reqVerifHeaderBodySignatureField, r.bodySig) - size += proto.NestedStructureSize(reqVerifHeaderMetaSignatureField, r.metaSig) - size += proto.NestedStructureSize(reqVerifHeaderOriginSignatureField, r.originSig) - size += proto.NestedStructureSize(reqVerifHeaderOriginField, r.origin) - - return size -} - -func (r *ResponseMetaHeader) StableMarshal(buf []byte) ([]byte, error) { - if r == nil { - return []byte{}, nil - } - - if buf == nil { - buf = make([]byte, r.StableSize()) - } - - var ( - offset, n int - err error - ) - - n, err = proto.NestedStructureMarshal(respMetaHeaderVersionField, buf[offset:], r.version) - if err != nil { - return nil, err - } - - offset += n - - n, err = proto.UInt64Marshal(respMetaHeaderEpochField, buf[offset:], r.epoch) - if err != nil { - return nil, err - } - - offset += n - - n, err = proto.UInt32Marshal(respMetaHeaderTTLField, buf[offset:], r.ttl) - if err != nil { - return nil, err - } - - offset += n - - for i := range r.xHeaders { - n, err = proto.NestedStructureMarshal(respMetaHeaderXHeadersField, buf[offset:], r.xHeaders[i]) - if err != nil { - return nil, err - } - - offset += n - } - - _, err = proto.NestedStructureMarshal(respMetaHeaderOriginField, buf[offset:], r.origin) - if err != nil { - return nil, err - } - - return buf, nil -} - -func (r *ResponseMetaHeader) StableSize() (size int) { - if r == nil { - return 0 - } - - if r.version != nil { - size += proto.NestedStructureSize(respMetaHeaderVersionField, r.version) - } - - size += proto.UInt64Size(respMetaHeaderEpochField, r.epoch) - size += proto.UInt32Size(respMetaHeaderTTLField, r.ttl) - - for i := range r.xHeaders { - size += proto.NestedStructureSize(respMetaHeaderXHeadersField, r.xHeaders[i]) - } - - size += proto.NestedStructureSize(respMetaHeaderOriginField, r.origin) - - return size -} - -func (r *ResponseVerificationHeader) StableMarshal(buf []byte) ([]byte, error) { - if r == nil { - return []byte{}, nil - } - - if buf == nil { - buf = make([]byte, r.StableSize()) - } - - var ( - offset, n int - err error - ) - - n, err = proto.NestedStructureMarshal(respVerifHeaderBodySignatureField, buf[offset:], r.bodySig) - if err != nil { - return nil, err - } - - offset += n - - n, err = proto.NestedStructureMarshal(respVerifHeaderMetaSignatureField, buf[offset:], r.metaSig) - if err != nil { - return nil, err - } - - offset += n - - n, err = proto.NestedStructureMarshal(respVerifHeaderOriginSignatureField, buf[offset:], r.originSig) - if err != nil { - return nil, err - } - - offset += n - - _, err = proto.NestedStructureMarshal(respVerifHeaderOriginField, buf[offset:], r.origin) - if err != nil { - return nil, err - } - - return buf, nil -} - -func (r *ResponseVerificationHeader) StableSize() (size int) { - if r == nil { - return 0 - } - - size += proto.NestedStructureSize(respVerifHeaderBodySignatureField, r.bodySig) - size += proto.NestedStructureSize(respVerifHeaderMetaSignatureField, r.metaSig) - size += proto.NestedStructureSize(respVerifHeaderOriginSignatureField, r.originSig) - size += proto.NestedStructureSize(respVerifHeaderOriginField, r.origin) - - return size -} diff --git a/v2/service/marshal_test.go b/v2/service/marshal_test.go deleted file mode 100644 index 63030ae..0000000 --- a/v2/service/marshal_test.go +++ /dev/null @@ -1,401 +0,0 @@ -package service_test - -import ( - "fmt" - "testing" - - "github.com/nspcc-dev/neofs-api-go/v2/acl" - "github.com/nspcc-dev/neofs-api-go/v2/refs" - "github.com/nspcc-dev/neofs-api-go/v2/service" - grpc "github.com/nspcc-dev/neofs-api-go/v2/service/grpc" - "github.com/stretchr/testify/require" -) - -func TestSignature_StableMarshal(t *testing.T) { - signatureFrom := generateSignature("Public Key", "Signature") - transport := new(grpc.Signature) - - t.Run("non empty", func(t *testing.T) { - wire, err := signatureFrom.StableMarshal(nil) - require.NoError(t, err) - - err = transport.Unmarshal(wire) - require.NoError(t, err) - - signatureTo := service.SignatureFromGRPCMessage(transport) - require.Equal(t, signatureFrom, signatureTo) - }) -} - -func TestVersion_StableMarshal(t *testing.T) { - versionFrom := generateVersion(2, 0) - transport := new(grpc.Version) - - t.Run("non empty", func(t *testing.T) { - wire, err := versionFrom.StableMarshal(nil) - require.NoError(t, err) - - err = transport.Unmarshal(wire) - require.NoError(t, err) - - versionTo := service.VersionFromGRPCMessage(transport) - require.Equal(t, versionFrom, versionTo) - }) -} - -func TestXHeader_StableMarshal(t *testing.T) { - xheaderFrom := generateXHeader("X-Header-Key", "X-Header-Value") - transport := new(grpc.XHeader) - - t.Run("non empty", func(t *testing.T) { - wire, err := xheaderFrom.StableMarshal(nil) - require.NoError(t, err) - - err = transport.Unmarshal(wire) - require.NoError(t, err) - - xheaderTo := service.XHeaderFromGRPCMessage(transport) - require.Equal(t, xheaderFrom, xheaderTo) - }) -} - -func TestTokenLifetime_StableMarshal(t *testing.T) { - lifetimeFrom := generateLifetime(10, 20, 30) - transport := new(grpc.TokenLifetime) - - t.Run("non empty", func(t *testing.T) { - wire, err := lifetimeFrom.StableMarshal(nil) - require.NoError(t, err) - - err = transport.Unmarshal(wire) - require.NoError(t, err) - - lifetimeTo := service.TokenLifetimeFromGRPCMessage(transport) - require.Equal(t, lifetimeFrom, lifetimeTo) - }) -} - -func TestObjectSessionContext_StableMarshal(t *testing.T) { - objectCtxFrom := generateObjectCtx("Object ID") - transport := new(grpc.ObjectSessionContext) - - t.Run("non empty", func(t *testing.T) { - wire, err := objectCtxFrom.StableMarshal(nil) - require.NoError(t, err) - - err = transport.Unmarshal(wire) - require.NoError(t, err) - - objectCtxTo := service.ObjectSessionContextFromGRPCMessage(transport) - require.Equal(t, objectCtxFrom, objectCtxTo) - }) -} - -func TestSessionTokenBody_StableMarshal(t *testing.T) { - sessionTokenBodyFrom := generateSessionTokenBody("Session Token Body") - transport := new(grpc.SessionToken_Body) - - t.Run("non empty", func(t *testing.T) { - wire, err := sessionTokenBodyFrom.StableMarshal(nil) - require.NoError(t, err) - - err = transport.Unmarshal(wire) - require.NoError(t, err) - - sessionTokenBodyTo := service.SessionTokenBodyFromGRPCMessage(transport) - require.Equal(t, sessionTokenBodyFrom, sessionTokenBodyTo) - }) -} - -func TestSessionToken_StableMarshal(t *testing.T) { - sessionTokenFrom := generateSessionToken("Session Token") - transport := new(grpc.SessionToken) - - t.Run("non empty", func(t *testing.T) { - wire, err := sessionTokenFrom.StableMarshal(nil) - require.NoError(t, err) - - err = transport.Unmarshal(wire) - require.NoError(t, err) - - sessionTokenTo := service.SessionTokenFromGRPCMessage(transport) - require.Equal(t, sessionTokenFrom, sessionTokenTo) - }) -} - -func TestBearerTokenBody_StableMarshal(t *testing.T) { - bearerTokenBodyFrom := generateBearerTokenBody("Bearer Token Body") - transport := new(grpc.BearerToken_Body) - - t.Run("non empty", func(t *testing.T) { - wire, err := bearerTokenBodyFrom.StableMarshal(nil) - require.NoError(t, err) - - err = transport.Unmarshal(wire) - require.NoError(t, err) - - bearerTokenBodyTo := service.BearerTokenBodyFromGRPCMessage(transport) - require.Equal(t, bearerTokenBodyFrom, bearerTokenBodyTo) - }) -} - -func TestBearerToken_StableMarshal(t *testing.T) { - bearerTokenFrom := generateBearerToken("Bearer Token") - transport := new(grpc.BearerToken) - - t.Run("non empty", func(t *testing.T) { - wire, err := bearerTokenFrom.StableMarshal(nil) - require.NoError(t, err) - - err = transport.Unmarshal(wire) - require.NoError(t, err) - - bearerTokenTo := service.BearerTokenFromGRPCMessage(transport) - require.Equal(t, bearerTokenFrom, bearerTokenTo) - }) -} - -func TestRequestMetaHeader_StableMarshal(t *testing.T) { - metaHeaderOrigin := generateRequestMetaHeader(10, "Bearer One", "Session One") - metaHeaderFrom := generateRequestMetaHeader(20, "Bearer Two", "Session Two") - metaHeaderFrom.SetOrigin(metaHeaderOrigin) - transport := new(grpc.RequestMetaHeader) - - t.Run("non empty", func(t *testing.T) { - wire, err := metaHeaderFrom.StableMarshal(nil) - require.NoError(t, err) - - err = transport.Unmarshal(wire) - require.NoError(t, err) - - metaHeaderTo := service.RequestMetaHeaderFromGRPCMessage(transport) - require.Equal(t, metaHeaderFrom, metaHeaderTo) - }) -} - -func TestRequestVerificationHeader_StableMarshal(t *testing.T) { - verifHeaderOrigin := generateRequestVerificationHeader("Key", "Inside") - verifHeaderFrom := generateRequestVerificationHeader("Value", "Outside") - verifHeaderFrom.SetOrigin(verifHeaderOrigin) - transport := new(grpc.RequestVerificationHeader) - - t.Run("non empty", func(t *testing.T) { - wire, err := verifHeaderFrom.StableMarshal(nil) - require.NoError(t, err) - - err = transport.Unmarshal(wire) - require.NoError(t, err) - - verifHeaderTo := service.RequestVerificationHeaderFromGRPCMessage(transport) - require.Equal(t, verifHeaderFrom, verifHeaderTo) - }) -} - -func TestResponseMetaHeader_StableMarshal(t *testing.T) { - metaHeaderOrigin := generateResponseMetaHeader(10) - metaHeaderFrom := generateResponseMetaHeader(20) - metaHeaderFrom.SetOrigin(metaHeaderOrigin) - transport := new(grpc.ResponseMetaHeader) - - t.Run("non empty", func(t *testing.T) { - wire, err := metaHeaderFrom.StableMarshal(nil) - require.NoError(t, err) - - err = transport.Unmarshal(wire) - require.NoError(t, err) - - metaHeaderTo := service.ResponseMetaHeaderFromGRPCMessage(transport) - require.Equal(t, metaHeaderFrom, metaHeaderTo) - }) -} - -func TestResponseVerificationHeader_StableMarshal(t *testing.T) { - verifHeaderOrigin := generateResponseVerificationHeader("Key", "Inside") - verifHeaderFrom := generateResponseVerificationHeader("Value", "Outside") - verifHeaderFrom.SetOrigin(verifHeaderOrigin) - transport := new(grpc.ResponseVerificationHeader) - - t.Run("non empty", func(t *testing.T) { - wire, err := verifHeaderFrom.StableMarshal(nil) - require.NoError(t, err) - - err = transport.Unmarshal(wire) - require.NoError(t, err) - - verifHeaderTo := service.ResponseVerificationHeaderFromGRPCMessage(transport) - require.Equal(t, verifHeaderFrom, verifHeaderTo) - }) -} - -func generateSignature(k, v string) *service.Signature { - sig := new(service.Signature) - sig.SetKey([]byte(k)) - sig.SetSign([]byte(v)) - - return sig -} - -func generateVersion(maj, min uint32) *service.Version { - version := new(service.Version) - version.SetMajor(maj) - version.SetMinor(min) - - return version -} - -func generateXHeader(k, v string) *service.XHeader { - xheader := new(service.XHeader) - xheader.SetKey(k) - xheader.SetValue(v) - - return xheader -} - -func generateLifetime(exp, nbf, iat uint64) *service.TokenLifetime { - lifetime := new(service.TokenLifetime) - lifetime.SetExp(exp) - lifetime.SetNbf(nbf) - lifetime.SetIat(iat) - - return lifetime -} - -func generateObjectCtx(id string) *service.ObjectSessionContext { - objectCtx := new(service.ObjectSessionContext) - objectCtx.SetVerb(service.ObjectVerbPut) - - cid := new(refs.ContainerID) - cid.SetValue([]byte("ContainerID")) - - oid := new(refs.ObjectID) - oid.SetValue([]byte(id)) - - addr := new(refs.Address) - addr.SetContainerID(cid) - addr.SetObjectID(oid) - - objectCtx.SetAddress(addr) - - return objectCtx -} - -func generateEACL(n int, k, v string) *acl.Table { - target := new(acl.TargetInfo) - target.SetTarget(acl.TargetUser) - - keys := make([][]byte, n) - - for i := 0; i < n; i++ { - s := fmt.Sprintf("Public Key %d", i+1) - keys[i] = []byte(s) - } - - filter := new(acl.HeaderFilter) - filter.SetHeaderType(acl.HeaderTypeObject) - filter.SetMatchType(acl.MatchTypeStringEqual) - filter.SetName(k) - filter.SetValue(v) - - record := new(acl.Record) - record.SetOperation(acl.OperationHead) - record.SetAction(acl.ActionDeny) - record.SetTargets([]*acl.TargetInfo{target}) - record.SetFilters([]*acl.HeaderFilter{filter}) - - table := new(acl.Table) - cid := new(refs.ContainerID) - cid.SetValue([]byte("Container ID")) - - table.SetContainerID(cid) - table.SetRecords([]*acl.Record{record}) - - return table -} - -func generateSessionTokenBody(id string) *service.SessionTokenBody { - owner := new(refs.OwnerID) - owner.SetValue([]byte("Owner ID")) - - tokenBody := new(service.SessionTokenBody) - tokenBody.SetID([]byte(id)) - tokenBody.SetOwnerID(owner) - tokenBody.SetSessionKey([]byte(id)) - tokenBody.SetLifetime(generateLifetime(1, 2, 3)) - tokenBody.SetContext(generateObjectCtx(id)) - - return tokenBody -} - -func generateSessionToken(id string) *service.SessionToken { - sessionToken := new(service.SessionToken) - sessionToken.SetBody(generateSessionTokenBody(id)) - sessionToken.SetSignature(generateSignature("id", id)) - - return sessionToken -} - -func generateBearerTokenBody(id string) *service.BearerTokenBody { - owner := new(refs.OwnerID) - owner.SetValue([]byte(id)) - - tokenBody := new(service.BearerTokenBody) - tokenBody.SetOwnerID(owner) - tokenBody.SetLifetime(generateLifetime(1, 2, 3)) - tokenBody.SetEACL(generateEACL(10, "id", id)) - - return tokenBody -} - -func generateBearerToken(id string) *service.BearerToken { - bearerToken := new(service.BearerToken) - bearerToken.SetBody(generateBearerTokenBody(id)) - bearerToken.SetSignature(generateSignature("id", id)) - - return bearerToken -} - -func generateRequestMetaHeader(n int, b, s string) *service.RequestMetaHeader { - reqMetaHeader := new(service.RequestMetaHeader) - reqMetaHeader.SetVersion(generateVersion(2, 0)) - reqMetaHeader.SetEpoch(uint64(n)) - reqMetaHeader.SetTTL(uint32(n)) - reqMetaHeader.SetXHeaders([]*service.XHeader{ - generateXHeader("key-one", "val-one"), - generateXHeader("key-two", "val-two"), - }) - reqMetaHeader.SetBearerToken(generateBearerToken(b)) - reqMetaHeader.SetSessionToken(generateSessionToken(s)) - - return reqMetaHeader -} - -func generateRequestVerificationHeader(k, v string) *service.RequestVerificationHeader { - reqVerifHeader := new(service.RequestVerificationHeader) - reqVerifHeader.SetBodySignature(generateSignature(k+"body", v+"body")) - reqVerifHeader.SetMetaSignature(generateSignature(k+"meta", v+"meta")) - reqVerifHeader.SetOriginSignature(generateSignature(k+"orig", v+"orig")) - - return reqVerifHeader -} - -func generateResponseMetaHeader(n int) *service.ResponseMetaHeader { - respMetaHeader := new(service.ResponseMetaHeader) - respMetaHeader.SetVersion(generateVersion(2, 0)) - respMetaHeader.SetEpoch(uint64(n)) - respMetaHeader.SetTTL(uint32(n)) - respMetaHeader.SetXHeaders([]*service.XHeader{ - generateXHeader("key-one", "val-one"), - generateXHeader("key-two", "val-two"), - }) - - return respMetaHeader -} - -func generateResponseVerificationHeader(k, v string) *service.ResponseVerificationHeader { - respVerifHeader := new(service.ResponseVerificationHeader) - respVerifHeader.SetBodySignature(generateSignature(k+"body", v+"body")) - respVerifHeader.SetMetaSignature(generateSignature(k+"meta", v+"meta")) - respVerifHeader.SetOriginSignature(generateSignature(k+"orig", v+"orig")) - - return respVerifHeader -} diff --git a/v2/service/service.go b/v2/service/service.go deleted file mode 100644 index b40106a..0000000 --- a/v2/service/service.go +++ /dev/null @@ -1,721 +0,0 @@ -package service - -import ( - "github.com/nspcc-dev/neofs-api-go/v2/acl" - "github.com/nspcc-dev/neofs-api-go/v2/refs" -) - -type Signature struct { - key, sign []byte -} - -type Version struct { - major, minor uint32 -} - -type XHeader struct { - key, val string -} - -type TokenLifetime struct { - exp, nbf, iat uint64 -} - -type ObjectSessionVerb uint32 - -type ObjectSessionContext struct { - verb ObjectSessionVerb - - addr *refs.Address -} - -type SessionTokenContext interface { - sessionTokenContext() -} - -type SessionTokenBody struct { - id []byte - - ownerID *refs.OwnerID - - lifetime *TokenLifetime - - sessionKey []byte - - ctx SessionTokenContext -} - -type SessionToken struct { - body *SessionTokenBody - - sig *Signature -} - -type BearerTokenBody struct { - eacl *acl.Table - - ownerID *refs.OwnerID - - lifetime *TokenLifetime -} - -type BearerToken struct { - body *BearerTokenBody - - sig *Signature -} - -type RequestVerificationHeader struct { - bodySig, metaSig, originSig *Signature - - origin *RequestVerificationHeader -} - -type RequestMetaHeader struct { - version *Version - - ttl uint32 - - epoch uint64 - - xHeaders []*XHeader - - sessionToken *SessionToken - - bearerToken *BearerToken - - origin *RequestMetaHeader -} - -type ResponseVerificationHeader struct { - bodySig, metaSig, originSig *Signature - - origin *ResponseVerificationHeader -} - -type ResponseMetaHeader struct { - version *Version - - ttl uint32 - - epoch uint64 - - xHeaders []*XHeader - - origin *ResponseMetaHeader -} - -const ( - ObjectVerbUnknown ObjectSessionVerb = iota - ObjectVerbPut - ObjectVerbGet - ObjectVerbHead - ObjectVerbSearch - ObjectVerbDelete - ObjectVerbRange - ObjectVerbRangeHash -) - -func (s *Signature) GetKey() []byte { - if s != nil { - return s.key - } - - return nil -} - -func (s *Signature) SetKey(v []byte) { - if s != nil { - s.key = v - } -} - -func (s *Signature) GetSign() []byte { - if s != nil { - return s.sign - } - - return nil -} - -func (s *Signature) SetSign(v []byte) { - if s != nil { - s.sign = v - } -} - -func (v *Version) GetMajor() uint32 { - if v != nil { - return v.major - } - - return 0 -} - -func (v *Version) SetMajor(val uint32) { - if v != nil { - v.major = val - } -} - -func (v *Version) GetMinor() uint32 { - if v != nil { - return v.minor - } - - return 0 -} - -func (v *Version) SetMinor(val uint32) { - if v != nil { - v.minor = val - } -} - -func (x *XHeader) GetKey() string { - if x != nil { - return x.key - } - - return "" -} - -func (x *XHeader) SetKey(v string) { - if x != nil { - x.key = v - } -} - -func (x *XHeader) GetValue() string { - if x != nil { - return x.val - } - - return "" -} - -func (x *XHeader) SetValue(v string) { - if x != nil { - x.val = v - } -} - -func (r *RequestVerificationHeader) GetBodySignature() *Signature { - if r != nil { - return r.bodySig - } - - return nil -} - -func (r *RequestVerificationHeader) SetBodySignature(v *Signature) { - if r != nil { - r.bodySig = v - } -} - -func (r *RequestVerificationHeader) GetMetaSignature() *Signature { - if r != nil { - return r.metaSig - } - - return nil -} - -func (r *RequestVerificationHeader) SetMetaSignature(v *Signature) { - if r != nil { - r.metaSig = v - } -} - -func (r *RequestVerificationHeader) GetOriginSignature() *Signature { - if r != nil { - return r.originSig - } - - return nil -} - -func (r *RequestVerificationHeader) SetOriginSignature(v *Signature) { - if r != nil { - r.originSig = v - } -} - -func (r *RequestVerificationHeader) GetOrigin() *RequestVerificationHeader { - if r != nil { - return r.origin - } - - return nil -} - -func (r *RequestVerificationHeader) SetOrigin(v *RequestVerificationHeader) { - if r != nil { - r.origin = v - } -} - -func (r *RequestMetaHeader) GetVersion() *Version { - if r != nil { - return r.version - } - - return nil -} - -func (r *RequestMetaHeader) SetVersion(v *Version) { - if r != nil { - r.version = v - } -} - -func (r *RequestMetaHeader) GetTTL() uint32 { - if r != nil { - return r.ttl - } - - return 0 -} - -func (r *RequestMetaHeader) SetTTL(v uint32) { - if r != nil { - r.ttl = v - } -} - -func (r *RequestMetaHeader) GetEpoch() uint64 { - if r != nil { - return r.epoch - } - - return 0 -} - -func (r *RequestMetaHeader) SetEpoch(v uint64) { - if r != nil { - r.epoch = v - } -} - -func (r *RequestMetaHeader) GetXHeaders() []*XHeader { - if r != nil { - return r.xHeaders - } - - return nil -} - -func (r *RequestMetaHeader) SetXHeaders(v []*XHeader) { - if r != nil { - r.xHeaders = v - } -} - -func (r *RequestMetaHeader) GetSessionToken() *SessionToken { - if r != nil { - return r.sessionToken - } - - return nil -} - -func (r *RequestMetaHeader) SetSessionToken(v *SessionToken) { - if r != nil { - r.sessionToken = v - } -} - -func (r *RequestMetaHeader) GetBearerToken() *BearerToken { - if r != nil { - return r.bearerToken - } - - return nil -} - -func (r *RequestMetaHeader) SetBearerToken(v *BearerToken) { - if r != nil { - r.bearerToken = v - } -} - -func (r *RequestMetaHeader) GetOrigin() *RequestMetaHeader { - if r != nil { - return r.origin - } - - return nil -} - -func (r *RequestMetaHeader) SetOrigin(v *RequestMetaHeader) { - if r != nil { - r.origin = v - } -} - -func (l *TokenLifetime) GetExp() uint64 { - if l != nil { - return l.exp - } - - return 0 -} - -func (l *TokenLifetime) SetExp(v uint64) { - if l != nil { - l.exp = v - } -} - -func (l *TokenLifetime) GetNbf() uint64 { - if l != nil { - return l.nbf - } - - return 0 -} - -func (l *TokenLifetime) SetNbf(v uint64) { - if l != nil { - l.nbf = v - } -} - -func (l *TokenLifetime) GetIat() uint64 { - if l != nil { - return l.iat - } - - return 0 -} - -func (l *TokenLifetime) SetIat(v uint64) { - if l != nil { - l.iat = v - } -} - -func (bt *BearerTokenBody) GetEACL() *acl.Table { - if bt != nil { - return bt.eacl - } - - return nil -} - -func (bt *BearerTokenBody) SetEACL(v *acl.Table) { - if bt != nil { - bt.eacl = v - } -} - -func (bt *BearerTokenBody) GetOwnerID() *refs.OwnerID { - if bt != nil { - return bt.ownerID - } - - return nil -} - -func (bt *BearerTokenBody) SetOwnerID(v *refs.OwnerID) { - if bt != nil { - bt.ownerID = v - } -} - -func (bt *BearerTokenBody) GetLifetime() *TokenLifetime { - if bt != nil { - return bt.lifetime - } - - return nil -} - -func (bt *BearerTokenBody) SetLifetime(v *TokenLifetime) { - if bt != nil { - bt.lifetime = v - } -} - -func (bt *BearerToken) GetBody() *BearerTokenBody { - if bt != nil { - return bt.body - } - - return nil -} - -func (bt *BearerToken) SetBody(v *BearerTokenBody) { - if bt != nil { - bt.body = v - } -} - -func (bt *BearerToken) GetSignature() *Signature { - if bt != nil { - return bt.sig - } - - return nil -} - -func (bt *BearerToken) SetSignature(v *Signature) { - if bt != nil { - bt.sig = v - } -} - -func (r *ResponseVerificationHeader) GetBodySignature() *Signature { - if r != nil { - return r.bodySig - } - - return nil -} - -func (r *ResponseVerificationHeader) SetBodySignature(v *Signature) { - if r != nil { - r.bodySig = v - } -} - -func (r *ResponseVerificationHeader) GetMetaSignature() *Signature { - if r != nil { - return r.metaSig - } - - return nil -} - -func (r *ResponseVerificationHeader) SetMetaSignature(v *Signature) { - if r != nil { - r.metaSig = v - } -} - -func (r *ResponseVerificationHeader) GetOriginSignature() *Signature { - if r != nil { - return r.originSig - } - - return nil -} - -func (r *ResponseVerificationHeader) SetOriginSignature(v *Signature) { - if r != nil { - r.originSig = v - } -} - -func (r *ResponseVerificationHeader) GetOrigin() *ResponseVerificationHeader { - if r != nil { - return r.origin - } - - return nil -} - -func (r *ResponseVerificationHeader) SetOrigin(v *ResponseVerificationHeader) { - if r != nil { - r.origin = v - } -} - -func (r *ResponseMetaHeader) GetVersion() *Version { - if r != nil { - return r.version - } - - return nil -} - -func (r *ResponseMetaHeader) SetVersion(v *Version) { - if r != nil { - r.version = v - } -} - -func (r *ResponseMetaHeader) GetTTL() uint32 { - if r != nil { - return r.ttl - } - - return 0 -} - -func (r *ResponseMetaHeader) SetTTL(v uint32) { - if r != nil { - r.ttl = v - } -} - -func (r *ResponseMetaHeader) GetEpoch() uint64 { - if r != nil { - return r.epoch - } - - return 0 -} - -func (r *ResponseMetaHeader) SetEpoch(v uint64) { - if r != nil { - r.epoch = v - } -} - -func (r *ResponseMetaHeader) GetXHeaders() []*XHeader { - if r != nil { - return r.xHeaders - } - - return nil -} - -func (r *ResponseMetaHeader) SetXHeaders(v []*XHeader) { - if r != nil { - r.xHeaders = v - } -} - -func (r *ResponseMetaHeader) GetOrigin() *ResponseMetaHeader { - if r != nil { - return r.origin - } - - return nil -} - -func (r *ResponseMetaHeader) SetOrigin(v *ResponseMetaHeader) { - if r != nil { - r.origin = v - } -} - -func (c *ObjectSessionContext) sessionTokenContext() {} - -func (c *ObjectSessionContext) GetVerb() ObjectSessionVerb { - if c != nil { - return c.verb - } - - return ObjectVerbUnknown -} - -func (c *ObjectSessionContext) SetVerb(v ObjectSessionVerb) { - if c != nil { - c.verb = v - } -} - -func (c *ObjectSessionContext) GetAddress() *refs.Address { - if c != nil { - return c.addr - } - - return nil -} - -func (c *ObjectSessionContext) SetAddress(v *refs.Address) { - if c != nil { - c.addr = v - } -} - -func (t *SessionTokenBody) GetID() []byte { - if t != nil { - return t.id - } - - return nil -} - -func (t *SessionTokenBody) SetID(v []byte) { - if t != nil { - t.id = v - } -} - -func (t *SessionTokenBody) GetOwnerID() *refs.OwnerID { - if t != nil { - return t.ownerID - } - - return nil -} - -func (t *SessionTokenBody) SetOwnerID(v *refs.OwnerID) { - if t != nil { - t.ownerID = v - } -} - -func (t *SessionTokenBody) GetLifetime() *TokenLifetime { - if t != nil { - return t.lifetime - } - - return nil -} - -func (t *SessionTokenBody) SetLifetime(v *TokenLifetime) { - if t != nil { - t.lifetime = v - } -} - -func (t *SessionTokenBody) GetSessionKey() []byte { - if t != nil { - return t.sessionKey - } - - return nil -} - -func (t *SessionTokenBody) SetSessionKey(v []byte) { - if t != nil { - t.sessionKey = v - } -} - -func (t *SessionTokenBody) GetContext() SessionTokenContext { - if t != nil { - return t.ctx - } - - return nil -} - -func (t *SessionTokenBody) SetContext(v SessionTokenContext) { - if t != nil { - t.ctx = v - } -} - -func (t *SessionToken) GetBody() *SessionTokenBody { - if t != nil { - return t.body - } - - return nil -} - -func (t *SessionToken) SetBody(v *SessionTokenBody) { - if t != nil { - t.body = v - } -} - -func (t *SessionToken) GetSignature() *Signature { - if t != nil { - return t.sig - } - - return nil -} - -func (t *SessionToken) SetSignature(v *Signature) { - if t != nil { - t.sig = v - } -} diff --git a/v2/session/convert.go b/v2/session/convert.go index 5d5a60e..5d73dc4 100644 --- a/v2/session/convert.go +++ b/v2/session/convert.go @@ -1,8 +1,10 @@ package session import ( + "fmt" + + "github.com/nspcc-dev/neofs-api-go/v2/acl" "github.com/nspcc-dev/neofs-api-go/v2/refs" - "github.com/nspcc-dev/neofs-api-go/v2/service" session "github.com/nspcc-dev/neofs-api-go/v2/session/grpc" ) @@ -17,9 +19,7 @@ func CreateRequestBodyToGRPCMessage(c *CreateRequestBody) *session.CreateRequest refs.OwnerIDToGRPCMessage(c.GetOwnerID()), ) - m.SetLifetime( - service.TokenLifetimeToGRPCMessage(c.GetLifetime()), - ) + m.SetExpiration(c.GetExpiration()) return m } @@ -35,9 +35,7 @@ func CreateRequestBodyFromGRPCMessage(m *session.CreateRequest_Body) *CreateRequ refs.OwnerIDFromGRPCMessage(m.GetOwnerId()), ) - c.SetLifetime( - service.TokenLifetimeFromGRPCMessage(m.GetLifetime()), - ) + c.SetExpiration(m.GetExpiration()) return c } @@ -53,7 +51,7 @@ func CreateRequestToGRPCMessage(c *CreateRequest) *session.CreateRequest { CreateRequestBodyToGRPCMessage(c.GetBody()), ) - service.RequestHeadersToGRPC(c, m) + RequestHeadersToGRPC(c, m) return m } @@ -69,7 +67,7 @@ func CreateRequestFromGRPCMessage(m *session.CreateRequest) *CreateRequest { CreateRequestBodyFromGRPCMessage(m.GetBody()), ) - service.RequestHeadersFromGRPC(m, c) + RequestHeadersFromGRPC(m, c) return c } @@ -111,7 +109,7 @@ func CreateResponseToGRPCMessage(c *CreateResponse) *session.CreateResponse { CreateResponseBodyToGRPCMessage(c.GetBody()), ) - service.ResponseHeadersToGRPC(c, m) + ResponseHeadersToGRPC(c, m) return m } @@ -127,7 +125,555 @@ func CreateResponseFromGRPCMessage(m *session.CreateResponse) *CreateResponse { CreateResponseBodyFromGRPCMessage(m.GetBody()), ) - service.ResponseHeadersFromGRPC(m, c) + ResponseHeadersFromGRPC(m, c) return c } + +func TokenLifetimeToGRPCMessage(tl *TokenLifetime) *session.SessionToken_Body_TokenLifetime { + if tl == nil { + return nil + } + + m := new(session.SessionToken_Body_TokenLifetime) + + m.SetExp(tl.GetExp()) + m.SetNbf(tl.GetNbf()) + m.SetIat(tl.GetIat()) + + return m +} + +func TokenLifetimeFromGRPCMessage(m *session.SessionToken_Body_TokenLifetime) *TokenLifetime { + if m == nil { + return nil + } + + tl := new(TokenLifetime) + + tl.SetExp(m.GetExp()) + tl.SetNbf(m.GetNbf()) + tl.SetIat(m.GetIat()) + + return tl +} + +func XHeaderToGRPCMessage(x *XHeader) *session.XHeader { + if x == nil { + return nil + } + + m := new(session.XHeader) + + m.SetKey(x.GetKey()) + m.SetValue(x.GetValue()) + + return m +} + +func XHeaderFromGRPCMessage(m *session.XHeader) *XHeader { + if m == nil { + return nil + } + + x := new(XHeader) + + x.SetKey(m.GetKey()) + x.SetValue(m.GetValue()) + + return x +} + +func SessionTokenToGRPCMessage(t *SessionToken) *session.SessionToken { + if t == nil { + return nil + } + + m := new(session.SessionToken) + + m.SetBody( + SessionTokenBodyToGRPCMessage(t.GetBody()), + ) + + m.SetSignature( + refs.SignatureToGRPCMessage(t.GetSignature()), + ) + + return m +} + +func SessionTokenFromGRPCMessage(m *session.SessionToken) *SessionToken { + if m == nil { + return nil + } + + t := new(SessionToken) + + t.SetBody( + SessionTokenBodyFromGRPCMessage(m.GetBody()), + ) + + t.SetSignature( + refs.SignatureFromGRPCMessage(m.GetSignature()), + ) + + return t +} + +func RequestVerificationHeaderToGRPCMessage(r *RequestVerificationHeader) *session.RequestVerificationHeader { + if r == nil { + return nil + } + + m := new(session.RequestVerificationHeader) + + m.SetBodySignature( + refs.SignatureToGRPCMessage(r.GetBodySignature()), + ) + + m.SetMetaSignature( + refs.SignatureToGRPCMessage(r.GetMetaSignature()), + ) + + m.SetOriginSignature( + refs.SignatureToGRPCMessage(r.GetOriginSignature()), + ) + + m.SetOrigin( + RequestVerificationHeaderToGRPCMessage(r.GetOrigin()), + ) + + return m +} + +func RequestVerificationHeaderFromGRPCMessage(m *session.RequestVerificationHeader) *RequestVerificationHeader { + if m == nil { + return nil + } + + r := new(RequestVerificationHeader) + + r.SetBodySignature( + refs.SignatureFromGRPCMessage(m.GetBodySignature()), + ) + + r.SetMetaSignature( + refs.SignatureFromGRPCMessage(m.GetMetaSignature()), + ) + + r.SetOriginSignature( + refs.SignatureFromGRPCMessage(m.GetOriginSignature()), + ) + + r.SetOrigin( + RequestVerificationHeaderFromGRPCMessage(m.GetOrigin()), + ) + + return r +} + +func RequestMetaHeaderToGRPCMessage(r *RequestMetaHeader) *session.RequestMetaHeader { + if r == nil { + return nil + } + + m := new(session.RequestMetaHeader) + + m.SetTtl(r.GetTTL()) + m.SetEpoch(r.GetEpoch()) + + m.SetVersion( + refs.VersionToGRPCMessage(r.GetVersion()), + ) + + m.SetSessionToken( + SessionTokenToGRPCMessage(r.GetSessionToken()), + ) + + m.SetBearerToken( + acl.BearerTokenToGRPCMessage(r.GetBearerToken()), + ) + + m.SetOrigin( + RequestMetaHeaderToGRPCMessage(r.GetOrigin()), + ) + + xHeaders := r.GetXHeaders() + xHdrMsg := make([]*session.XHeader, 0, len(xHeaders)) + + for i := range xHeaders { + xHdrMsg = append(xHdrMsg, XHeaderToGRPCMessage(xHeaders[i])) + } + + m.SetXHeaders(xHdrMsg) + + return m +} + +func RequestMetaHeaderFromGRPCMessage(m *session.RequestMetaHeader) *RequestMetaHeader { + if m == nil { + return nil + } + + r := new(RequestMetaHeader) + + r.SetTTL(m.GetTtl()) + r.SetEpoch(m.GetEpoch()) + + r.SetVersion( + refs.VersionFromGRPCMessage(m.GetVersion()), + ) + + r.SetSessionToken( + SessionTokenFromGRPCMessage(m.GetSessionToken()), + ) + + r.SetBearerToken( + acl.BearerTokenFromGRPCMessage(m.GetBearerToken()), + ) + + r.SetOrigin( + RequestMetaHeaderFromGRPCMessage(m.GetOrigin()), + ) + + xHdrMsg := m.GetXHeaders() + xHeaders := make([]*XHeader, 0, len(xHdrMsg)) + + for i := range xHdrMsg { + xHeaders = append(xHeaders, XHeaderFromGRPCMessage(xHdrMsg[i])) + } + + r.SetXHeaders(xHeaders) + + return r +} + +func RequestHeadersToGRPC( + src interface { + GetMetaHeader() *RequestMetaHeader + GetVerificationHeader() *RequestVerificationHeader + }, + dst interface { + SetMetaHeader(*session.RequestMetaHeader) + SetVerifyHeader(*session.RequestVerificationHeader) + }, +) { + dst.SetMetaHeader( + RequestMetaHeaderToGRPCMessage(src.GetMetaHeader()), + ) + + dst.SetVerifyHeader( + RequestVerificationHeaderToGRPCMessage(src.GetVerificationHeader()), + ) +} + +func RequestHeadersFromGRPC( + src interface { + GetMetaHeader() *session.RequestMetaHeader + GetVerifyHeader() *session.RequestVerificationHeader + }, + dst interface { + SetMetaHeader(*RequestMetaHeader) + SetVerificationHeader(*RequestVerificationHeader) + }, +) { + dst.SetMetaHeader( + RequestMetaHeaderFromGRPCMessage(src.GetMetaHeader()), + ) + + dst.SetVerificationHeader( + RequestVerificationHeaderFromGRPCMessage(src.GetVerifyHeader()), + ) +} + +func ResponseVerificationHeaderToGRPCMessage(r *ResponseVerificationHeader) *session.ResponseVerificationHeader { + if r == nil { + return nil + } + + m := new(session.ResponseVerificationHeader) + + m.SetBodySignature( + refs.SignatureToGRPCMessage(r.GetBodySignature()), + ) + + m.SetMetaSignature( + refs.SignatureToGRPCMessage(r.GetMetaSignature()), + ) + + m.SetOriginSignature( + refs.SignatureToGRPCMessage(r.GetOriginSignature()), + ) + + m.SetOrigin( + ResponseVerificationHeaderToGRPCMessage(r.GetOrigin()), + ) + + return m +} + +func ResponseVerificationHeaderFromGRPCMessage(m *session.ResponseVerificationHeader) *ResponseVerificationHeader { + if m == nil { + return nil + } + + r := new(ResponseVerificationHeader) + + r.SetBodySignature( + refs.SignatureFromGRPCMessage(m.GetBodySignature()), + ) + + r.SetMetaSignature( + refs.SignatureFromGRPCMessage(m.GetMetaSignature()), + ) + + r.SetOriginSignature( + refs.SignatureFromGRPCMessage(m.GetOriginSignature()), + ) + + r.SetOrigin( + ResponseVerificationHeaderFromGRPCMessage(m.GetOrigin()), + ) + + return r +} + +func ResponseMetaHeaderToGRPCMessage(r *ResponseMetaHeader) *session.ResponseMetaHeader { + if r == nil { + return nil + } + + m := new(session.ResponseMetaHeader) + + m.SetTtl(r.GetTTL()) + m.SetEpoch(r.GetEpoch()) + + m.SetVersion( + refs.VersionToGRPCMessage(r.GetVersion()), + ) + + m.SetOrigin( + ResponseMetaHeaderToGRPCMessage(r.GetOrigin()), + ) + + xHeaders := r.GetXHeaders() + xHdrMsg := make([]*session.XHeader, 0, len(xHeaders)) + + for i := range xHeaders { + xHdrMsg = append(xHdrMsg, XHeaderToGRPCMessage(xHeaders[i])) + } + + m.SetXHeaders(xHdrMsg) + + return m +} + +func ResponseMetaHeaderFromGRPCMessage(m *session.ResponseMetaHeader) *ResponseMetaHeader { + if m == nil { + return nil + } + + r := new(ResponseMetaHeader) + + r.SetTTL(m.GetTtl()) + r.SetEpoch(m.GetEpoch()) + + r.SetVersion( + refs.VersionFromGRPCMessage(m.GetVersion()), + ) + + r.SetOrigin( + ResponseMetaHeaderFromGRPCMessage(m.GetOrigin()), + ) + + xHdrMsg := m.GetXHeaders() + xHeaders := make([]*XHeader, 0, len(xHdrMsg)) + + for i := range xHdrMsg { + xHeaders = append(xHeaders, XHeaderFromGRPCMessage(xHdrMsg[i])) + } + + r.SetXHeaders(xHeaders) + + return r +} + +func ResponseHeadersToGRPC( + src interface { + GetMetaHeader() *ResponseMetaHeader + GetVerificationHeader() *ResponseVerificationHeader + }, + dst interface { + SetMetaHeader(*session.ResponseMetaHeader) + SetVerifyHeader(*session.ResponseVerificationHeader) + }, +) { + dst.SetMetaHeader( + ResponseMetaHeaderToGRPCMessage(src.GetMetaHeader()), + ) + + dst.SetVerifyHeader( + ResponseVerificationHeaderToGRPCMessage(src.GetVerificationHeader()), + ) +} + +func ResponseHeadersFromGRPC( + src interface { + GetMetaHeader() *session.ResponseMetaHeader + GetVerifyHeader() *session.ResponseVerificationHeader + }, + dst interface { + SetMetaHeader(*ResponseMetaHeader) + SetVerificationHeader(*ResponseVerificationHeader) + }, +) { + dst.SetMetaHeader( + ResponseMetaHeaderFromGRPCMessage(src.GetMetaHeader()), + ) + + dst.SetVerificationHeader( + ResponseVerificationHeaderFromGRPCMessage(src.GetVerifyHeader()), + ) +} + +func ObjectSessionVerbToGRPCField(v ObjectSessionVerb) session.ObjectSessionContext_Verb { + switch v { + case ObjectVerbPut: + return session.ObjectSessionContext_PUT + case ObjectVerbGet: + return session.ObjectSessionContext_GET + case ObjectVerbHead: + return session.ObjectSessionContext_HEAD + case ObjectVerbSearch: + return session.ObjectSessionContext_SEARCH + case ObjectVerbDelete: + return session.ObjectSessionContext_DELETE + case ObjectVerbRange: + return session.ObjectSessionContext_RANGE + case ObjectVerbRangeHash: + return session.ObjectSessionContext_RANGEHASH + default: + return session.ObjectSessionContext_VERB_UNSPECIFIED + } +} + +func ObjectSessionVerbFromGRPCField(v session.ObjectSessionContext_Verb) ObjectSessionVerb { + switch v { + case session.ObjectSessionContext_PUT: + return ObjectVerbPut + case session.ObjectSessionContext_GET: + return ObjectVerbGet + case session.ObjectSessionContext_HEAD: + return ObjectVerbHead + case session.ObjectSessionContext_SEARCH: + return ObjectVerbSearch + case session.ObjectSessionContext_DELETE: + return ObjectVerbDelete + case session.ObjectSessionContext_RANGE: + return ObjectVerbRange + case session.ObjectSessionContext_RANGEHASH: + return ObjectVerbRangeHash + default: + return ObjectVerbUnknown + } +} + +func ObjectSessionContextToGRPCMessage(c *ObjectSessionContext) *session.ObjectSessionContext { + if c == nil { + return nil + } + + m := new(session.ObjectSessionContext) + + m.SetVerb( + ObjectSessionVerbToGRPCField(c.GetVerb()), + ) + + m.SetAddress( + refs.AddressToGRPCMessage(c.GetAddress()), + ) + + return m +} + +func ObjectSessionContextFromGRPCMessage(m *session.ObjectSessionContext) *ObjectSessionContext { + if m == nil { + return nil + } + + c := new(ObjectSessionContext) + + c.SetVerb( + ObjectSessionVerbFromGRPCField(m.GetVerb()), + ) + + c.SetAddress( + refs.AddressFromGRPCMessage(m.GetAddress()), + ) + + return c +} + +func SessionTokenBodyToGRPCMessage(t *SessionTokenBody) *session.SessionToken_Body { + if t == nil { + return nil + } + + m := new(session.SessionToken_Body) + + switch v := t.GetContext(); t := v.(type) { + case nil: + case *ObjectSessionContext: + m.SetObjectSessionContext( + ObjectSessionContextToGRPCMessage(t), + ) + default: + panic(fmt.Sprintf("unknown session context %T", t)) + } + + m.SetId(t.GetID()) + + m.SetOwnerId( + refs.OwnerIDToGRPCMessage(t.GetOwnerID()), + ) + + m.SetLifetime( + TokenLifetimeToGRPCMessage(t.GetLifetime()), + ) + + m.SetSessionKey(t.GetSessionKey()) + + return m +} + +func SessionTokenBodyFromGRPCMessage(m *session.SessionToken_Body) *SessionTokenBody { + if m == nil { + return nil + } + + t := new(SessionTokenBody) + + switch v := m.GetContext().(type) { + case nil: + case *session.SessionToken_Body_Object: + t.SetContext( + ObjectSessionContextFromGRPCMessage(v.Object), + ) + default: + panic(fmt.Sprintf("unknown session context %T", v)) + } + + t.SetID(m.GetId()) + + t.SetOwnerID( + refs.OwnerIDFromGRPCMessage(m.GetOwnerId()), + ) + + t.SetLifetime( + TokenLifetimeFromGRPCMessage(m.GetLifetime()), + ) + + t.SetSessionKey(m.GetSessionKey()) + + return t +} diff --git a/v2/session/grpc/service.go b/v2/session/grpc/service.go index 8c78648..caaf7d9 100644 --- a/v2/session/grpc/service.go +++ b/v2/session/grpc/service.go @@ -2,7 +2,6 @@ package session import ( refs "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" - service "github.com/nspcc-dev/neofs-api-go/v2/service/grpc" ) // SetOwnerId sets identifier of the session initiator. @@ -12,10 +11,10 @@ func (m *CreateRequest_Body) SetOwnerId(v *refs.OwnerID) { } } -// SetLifetime sets lifetime of the session. -func (m *CreateRequest_Body) SetLifetime(v *service.TokenLifetime) { +// SetExpiration sets lifetime of the session. +func (m *CreateRequest_Body) SetExpiration(v uint64) { if m != nil { - m.Lifetime = v + m.Expiration = v } } @@ -27,14 +26,14 @@ func (m *CreateRequest) SetBody(v *CreateRequest_Body) { } // SetMetaHeader sets meta header of the request. -func (m *CreateRequest) SetMetaHeader(v *service.RequestMetaHeader) { +func (m *CreateRequest) SetMetaHeader(v *RequestMetaHeader) { if m != nil { m.MetaHeader = v } } // SetVerifyHeader sets verification header of the request. -func (m *CreateRequest) SetVerifyHeader(v *service.RequestVerificationHeader) { +func (m *CreateRequest) SetVerifyHeader(v *RequestVerificationHeader) { if m != nil { m.VerifyHeader = v } @@ -62,14 +61,14 @@ func (m *CreateResponse) SetBody(v *CreateResponse_Body) { } // SetMetaHeader sets meta header of the response. -func (m *CreateResponse) SetMetaHeader(v *service.ResponseMetaHeader) { +func (m *CreateResponse) SetMetaHeader(v *ResponseMetaHeader) { if m != nil { m.MetaHeader = v } } // SetVerifyHeader sets verification header of the response. -func (m *CreateResponse) SetVerifyHeader(v *service.ResponseVerificationHeader) { +func (m *CreateResponse) SetVerifyHeader(v *ResponseVerificationHeader) { if m != nil { m.VerifyHeader = v } diff --git a/v2/service/grpc/meta.go b/v2/session/grpc/types.go similarity index 64% rename from v2/service/grpc/meta.go rename to v2/session/grpc/types.go index 9f5c192..27dcd4b 100644 --- a/v2/service/grpc/meta.go +++ b/v2/session/grpc/types.go @@ -1,4 +1,4 @@ -package service +package session import ( acl "github.com/nspcc-dev/neofs-api-go/v2/acl/grpc" @@ -19,36 +19,22 @@ func (m *XHeader) SetValue(v string) { } } -// SetMajor sets major version number. -func (m *Version) SetMajor(v uint32) { - if m != nil { - m.Major = v - } -} - -// SetMinor sets minor version number. -func (m *Version) SetMinor(v uint32) { - if m != nil { - m.Minor = v - } -} - // SetExp sets epoch number of the token expiration. -func (m *TokenLifetime) SetExp(v uint64) { +func (m *SessionToken_Body_TokenLifetime) SetExp(v uint64) { if m != nil { m.Exp = v } } // SetNbf sets starting epoch number of the token. -func (m *TokenLifetime) SetNbf(v uint64) { +func (m *SessionToken_Body_TokenLifetime) SetNbf(v uint64) { if m != nil { m.Nbf = v } } // SetIat sets the number of the epoch in which the token was issued. -func (m *TokenLifetime) SetIat(v uint64) { +func (m *SessionToken_Body_TokenLifetime) SetIat(v uint64) { if m != nil { m.Iat = v } @@ -69,7 +55,7 @@ func (m *SessionToken_Body) SetOwnerId(v *refs.OwnerID) { } // SetLifetime sets lifetime of the session token. -func (m *SessionToken_Body) SetLifetime(v *TokenLifetime) { +func (m *SessionToken_Body) SetLifetime(v *SessionToken_Body_TokenLifetime) { if m != nil { m.Lifetime = v } @@ -83,7 +69,7 @@ func (m *SessionToken_Body) SetSessionKey(v []byte) { } // SetObjectAddressContext sets object context of the session token. -func (m *SessionToken_Body) SetObjectServiceContext(v *ObjectSessionContext) { +func (m *SessionToken_Body) SetObjectSessionContext(v *ObjectSessionContext) { if m != nil { m.Context = &SessionToken_Body_Object{ Object: v, @@ -113,49 +99,14 @@ func (m *SessionToken) SetBody(v *SessionToken_Body) { } // SetSignature sets session token signature. -func (m *SessionToken) SetSignature(v *Signature) { - if m != nil { - m.Signature = v - } -} - -// SetEaclTable sets eACL table of the bearer token. -func (m *BearerToken_Body) SetEaclTable(v *acl.EACLTable) { - if m != nil { - m.EaclTable = v - } -} - -// SetOwnerId sets identifier of the bearer token owner. -func (m *BearerToken_Body) SetOwnerId(v *refs.OwnerID) { - if m != nil { - m.OwnerId = v - } -} - -// SetLifetime sets lifetime of the bearer token. -func (m *BearerToken_Body) SetLifetime(v *TokenLifetime) { - if m != nil { - m.Lifetime = v - } -} - -// SetBody sets bearer token body. -func (m *BearerToken) SetBody(v *BearerToken_Body) { - if m != nil { - m.Body = v - } -} - -// SetSignature sets bearer token signature. -func (m *BearerToken) SetSignature(v *Signature) { +func (m *SessionToken) SetSignature(v *refs.Signature) { if m != nil { m.Signature = v } } // SetVersion sets client protocol version. -func (m *RequestMetaHeader) SetVersion(v *Version) { +func (m *RequestMetaHeader) SetVersion(v *refs.Version) { if m != nil { m.Version = v } @@ -190,7 +141,7 @@ func (m *RequestMetaHeader) SetSessionToken(v *SessionToken) { } // SetBearerToken sets bearer token of the request. -func (m *RequestMetaHeader) SetBearerToken(v *BearerToken) { +func (m *RequestMetaHeader) SetBearerToken(v *acl.BearerToken) { if m != nil { m.BearerToken = v } @@ -204,7 +155,7 @@ func (m *RequestMetaHeader) SetOrigin(v *RequestMetaHeader) { } // SetVersion sets server protocol version. -func (m *ResponseMetaHeader) SetVersion(v *Version) { +func (m *ResponseMetaHeader) SetVersion(v *refs.Version) { if m != nil { m.Version = v } @@ -237,3 +188,59 @@ func (m *ResponseMetaHeader) SetOrigin(v *ResponseMetaHeader) { m.Origin = v } } + +// SetBodySignature sets signature of the request body. +func (m *RequestVerificationHeader) SetBodySignature(v *refs.Signature) { + if m != nil { + m.BodySignature = v + } +} + +// SetMetaSignature sets signature of the request meta. +func (m *RequestVerificationHeader) SetMetaSignature(v *refs.Signature) { + if m != nil { + m.MetaSignature = v + } +} + +// SetOriginSignature sets signature of the origin verification header of the request. +func (m *RequestVerificationHeader) SetOriginSignature(v *refs.Signature) { + if m != nil { + m.OriginSignature = v + } +} + +// SetOrigin sets origin verification header of the request. +func (m *RequestVerificationHeader) SetOrigin(v *RequestVerificationHeader) { + if m != nil { + m.Origin = v + } +} + +// SetBodySignature sets signature of the response body. +func (m *ResponseVerificationHeader) SetBodySignature(v *refs.Signature) { + if m != nil { + m.BodySignature = v + } +} + +// SetMetaSignature sets signature of the response meta. +func (m *ResponseVerificationHeader) SetMetaSignature(v *refs.Signature) { + if m != nil { + m.MetaSignature = v + } +} + +// SetOriginSignature sets signature of the origin verification header of the response. +func (m *ResponseVerificationHeader) SetOriginSignature(v *refs.Signature) { + if m != nil { + m.OriginSignature = v + } +} + +// SetOrigin sets origin verification header of the response. +func (m *ResponseVerificationHeader) SetOrigin(v *ResponseVerificationHeader) { + if m != nil { + m.Origin = v + } +} diff --git a/v2/session/marshal.go b/v2/session/marshal.go index 2256b90..9bd4eb1 100644 --- a/v2/session/marshal.go +++ b/v2/session/marshal.go @@ -5,11 +5,54 @@ import ( ) const ( - createReqBodyOwnerField = 1 - createReqBodyLifetimeField = 2 + createReqBodyOwnerField = 1 + createReqBodyExpirationField = 2 createRespBodyIDField = 1 createRespBodyKeyField = 2 + + xheaderKeyField = 1 + xheaderValueField = 2 + + lifetimeExpirationField = 1 + lifetimeNotValidBeforeField = 2 + lifetimeIssuedAtField = 3 + + objectCtxVerbField = 1 + objectCtxAddressField = 2 + + sessionTokenBodyIDField = 1 + sessionTokenBodyOwnerField = 2 + sessionTokenBodyLifetimeField = 3 + sessionTokenBodyKeyField = 4 + sessionTokenBodyObjectCtxField = 5 + + sessionTokenBodyField = 1 + sessionTokenSignatureField = 2 + + reqMetaHeaderVersionField = 1 + reqMetaHeaderEpochField = 2 + reqMetaHeaderTTLField = 3 + reqMetaHeaderXHeadersField = 4 + reqMetaHeaderSessionTokenField = 5 + reqMetaHeaderBearerTokenField = 6 + reqMetaHeaderOriginField = 7 + + reqVerifHeaderBodySignatureField = 1 + reqVerifHeaderMetaSignatureField = 2 + reqVerifHeaderOriginSignatureField = 3 + reqVerifHeaderOriginField = 4 + + respMetaHeaderVersionField = 1 + respMetaHeaderEpochField = 2 + respMetaHeaderTTLField = 3 + respMetaHeaderXHeadersField = 4 + respMetaHeaderOriginField = 5 + + respVerifHeaderBodySignatureField = 1 + respVerifHeaderMetaSignatureField = 2 + respVerifHeaderOriginSignatureField = 3 + respVerifHeaderOriginField = 4 ) func (c *CreateRequestBody) StableMarshal(buf []byte) ([]byte, error) { @@ -33,7 +76,7 @@ func (c *CreateRequestBody) StableMarshal(buf []byte) ([]byte, error) { offset += n - _, err = proto.NestedStructureMarshal(createReqBodyLifetimeField, buf[offset:], c.lifetime) + _, err = proto.UInt64Marshal(createReqBodyExpirationField, buf[offset:], c.expiration) if err != nil { return nil, err } @@ -47,7 +90,7 @@ func (c *CreateRequestBody) StableSize() (size int) { } size += proto.NestedStructureSize(createReqBodyOwnerField, c.ownerID) - size += proto.NestedStructureSize(createReqBodyLifetimeField, c.lifetime) + size += proto.UInt64Size(createReqBodyExpirationField, c.expiration) return size } @@ -91,3 +134,524 @@ func (c *CreateResponseBody) StableSize() (size int) { return size } + +func (x *XHeader) StableMarshal(buf []byte) ([]byte, error) { + if x == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, x.StableSize()) + } + + var ( + offset, n int + err error + ) + + n, err = proto.StringMarshal(xheaderKeyField, buf[offset:], x.key) + if err != nil { + return nil, err + } + + offset += n + + _, err = proto.StringMarshal(xheaderValueField, buf[offset:], x.val) + if err != nil { + return nil, err + } + + return buf, nil +} + +func (x *XHeader) StableSize() (size int) { + if x == nil { + return 0 + } + + size += proto.StringSize(xheaderKeyField, x.key) + size += proto.StringSize(xheaderValueField, x.val) + + return size +} + +func (l *TokenLifetime) StableMarshal(buf []byte) ([]byte, error) { + if l == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, l.StableSize()) + } + + var ( + offset, n int + err error + ) + + n, err = proto.UInt64Marshal(lifetimeExpirationField, buf[offset:], l.exp) + if err != nil { + return nil, err + } + + offset += n + + n, err = proto.UInt64Marshal(lifetimeNotValidBeforeField, buf[offset:], l.nbf) + if err != nil { + return nil, err + } + + offset += n + + _, err = proto.UInt64Marshal(lifetimeIssuedAtField, buf[offset:], l.iat) + if err != nil { + return nil, err + } + + return buf, nil +} + +func (l *TokenLifetime) StableSize() (size int) { + if l == nil { + return 0 + } + + size += proto.UInt64Size(lifetimeExpirationField, l.exp) + size += proto.UInt64Size(lifetimeNotValidBeforeField, l.nbf) + size += proto.UInt64Size(lifetimeIssuedAtField, l.iat) + + return size +} + +func (c *ObjectSessionContext) StableMarshal(buf []byte) ([]byte, error) { + if c == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, c.StableSize()) + } + + var ( + offset, n int + err error + ) + + n, err = proto.EnumMarshal(objectCtxVerbField, buf[offset:], int32(c.verb)) + if err != nil { + return nil, err + } + + offset += n + + _, err = proto.NestedStructureMarshal(objectCtxAddressField, buf[offset:], c.addr) + if err != nil { + return nil, err + } + + return buf, nil +} + +func (c *ObjectSessionContext) StableSize() (size int) { + if c == nil { + return 0 + } + + size += proto.EnumSize(objectCtxVerbField, int32(c.verb)) + size += proto.NestedStructureSize(objectCtxAddressField, c.addr) + + return size +} + +func (t *SessionTokenBody) StableMarshal(buf []byte) ([]byte, error) { + if t == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, t.StableSize()) + } + + var ( + offset, n int + err error + ) + + n, err = proto.BytesMarshal(sessionTokenBodyIDField, buf[offset:], t.id) + if err != nil { + return nil, err + } + + offset += n + + n, err = proto.NestedStructureMarshal(sessionTokenBodyOwnerField, buf[offset:], t.ownerID) + if err != nil { + return nil, err + } + + offset += n + + n, err = proto.NestedStructureMarshal(sessionTokenBodyLifetimeField, buf[offset:], t.lifetime) + if err != nil { + return nil, err + } + + offset += n + + n, err = proto.BytesMarshal(sessionTokenBodyKeyField, buf[offset:], t.sessionKey) + if err != nil { + return nil, err + } + + offset += n + + if t.ctx != nil { + switch v := t.ctx.(type) { + case *ObjectSessionContext: + _, err = proto.NestedStructureMarshal(sessionTokenBodyObjectCtxField, buf[offset:], v) + if err != nil { + return nil, err + } + default: + panic("cannot marshal unknown session token context") + } + } + + return buf, nil +} + +func (t *SessionTokenBody) StableSize() (size int) { + if t == nil { + return 0 + } + + size += proto.BytesSize(sessionTokenBodyIDField, t.id) + size += proto.NestedStructureSize(sessionTokenBodyOwnerField, t.ownerID) + size += proto.NestedStructureSize(sessionTokenBodyLifetimeField, t.lifetime) + size += proto.BytesSize(sessionTokenBodyKeyField, t.sessionKey) + + if t.ctx != nil { + switch v := t.ctx.(type) { + case *ObjectSessionContext: + size += proto.NestedStructureSize(sessionTokenBodyObjectCtxField, v) + default: + panic("cannot marshal unknown session token context") + } + } + + return size +} + +func (t *SessionToken) StableMarshal(buf []byte) ([]byte, error) { + if t == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, t.StableSize()) + } + + var ( + offset, n int + err error + ) + + n, err = proto.NestedStructureMarshal(sessionTokenBodyField, buf[offset:], t.body) + if err != nil { + return nil, err + } + + offset += n + + _, err = proto.NestedStructureMarshal(sessionTokenSignatureField, buf[offset:], t.sig) + if err != nil { + return nil, err + } + + return buf, nil +} + +func (t *SessionToken) StableSize() (size int) { + if t == nil { + return 0 + } + + size += proto.NestedStructureSize(sessionTokenBodyField, t.body) + size += proto.NestedStructureSize(sessionTokenSignatureField, t.sig) + + return size +} + +func (r *RequestMetaHeader) StableMarshal(buf []byte) ([]byte, error) { + if r == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, r.StableSize()) + } + + var ( + offset, n int + err error + ) + + n, err = proto.NestedStructureMarshal(reqMetaHeaderVersionField, buf[offset:], r.version) + if err != nil { + return nil, err + } + + offset += n + + n, err = proto.UInt64Marshal(reqMetaHeaderEpochField, buf[offset:], r.epoch) + if err != nil { + return nil, err + } + + offset += n + + n, err = proto.UInt32Marshal(reqMetaHeaderTTLField, buf[offset:], r.ttl) + if err != nil { + return nil, err + } + + offset += n + + for i := range r.xHeaders { + n, err = proto.NestedStructureMarshal(reqMetaHeaderXHeadersField, buf[offset:], r.xHeaders[i]) + if err != nil { + return nil, err + } + + offset += n + } + + n, err = proto.NestedStructureMarshal(reqMetaHeaderSessionTokenField, buf[offset:], r.sessionToken) + if err != nil { + return nil, err + } + + offset += n + + n, err = proto.NestedStructureMarshal(reqMetaHeaderBearerTokenField, buf[offset:], r.bearerToken) + if err != nil { + return nil, err + } + + offset += n + + _, err = proto.NestedStructureMarshal(reqMetaHeaderOriginField, buf[offset:], r.origin) + if err != nil { + return nil, err + } + + return buf, nil +} + +func (r *RequestMetaHeader) StableSize() (size int) { + if r == nil { + return 0 + } + + if r.version != nil { + size += proto.NestedStructureSize(reqMetaHeaderVersionField, r.version) + } + + size += proto.UInt64Size(reqMetaHeaderEpochField, r.epoch) + size += proto.UInt32Size(reqMetaHeaderTTLField, r.ttl) + + for i := range r.xHeaders { + size += proto.NestedStructureSize(reqMetaHeaderXHeadersField, r.xHeaders[i]) + } + + size += proto.NestedStructureSize(reqMetaHeaderSessionTokenField, r.sessionToken) + size += proto.NestedStructureSize(reqMetaHeaderBearerTokenField, r.bearerToken) + size += proto.NestedStructureSize(reqMetaHeaderOriginField, r.origin) + + return size +} + +func (r *RequestVerificationHeader) StableMarshal(buf []byte) ([]byte, error) { + if r == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, r.StableSize()) + } + + var ( + offset, n int + err error + ) + + n, err = proto.NestedStructureMarshal(reqVerifHeaderBodySignatureField, buf[offset:], r.bodySig) + if err != nil { + return nil, err + } + + offset += n + + n, err = proto.NestedStructureMarshal(reqVerifHeaderMetaSignatureField, buf[offset:], r.metaSig) + if err != nil { + return nil, err + } + + offset += n + + n, err = proto.NestedStructureMarshal(reqVerifHeaderOriginSignatureField, buf[offset:], r.originSig) + if err != nil { + return nil, err + } + + offset += n + + _, err = proto.NestedStructureMarshal(reqVerifHeaderOriginField, buf[offset:], r.origin) + if err != nil { + return nil, err + } + + return buf, nil +} + +func (r *RequestVerificationHeader) StableSize() (size int) { + if r == nil { + return 0 + } + + size += proto.NestedStructureSize(reqVerifHeaderBodySignatureField, r.bodySig) + size += proto.NestedStructureSize(reqVerifHeaderMetaSignatureField, r.metaSig) + size += proto.NestedStructureSize(reqVerifHeaderOriginSignatureField, r.originSig) + size += proto.NestedStructureSize(reqVerifHeaderOriginField, r.origin) + + return size +} + +func (r *ResponseMetaHeader) StableMarshal(buf []byte) ([]byte, error) { + if r == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, r.StableSize()) + } + + var ( + offset, n int + err error + ) + + n, err = proto.NestedStructureMarshal(respMetaHeaderVersionField, buf[offset:], r.version) + if err != nil { + return nil, err + } + + offset += n + + n, err = proto.UInt64Marshal(respMetaHeaderEpochField, buf[offset:], r.epoch) + if err != nil { + return nil, err + } + + offset += n + + n, err = proto.UInt32Marshal(respMetaHeaderTTLField, buf[offset:], r.ttl) + if err != nil { + return nil, err + } + + offset += n + + for i := range r.xHeaders { + n, err = proto.NestedStructureMarshal(respMetaHeaderXHeadersField, buf[offset:], r.xHeaders[i]) + if err != nil { + return nil, err + } + + offset += n + } + + _, err = proto.NestedStructureMarshal(respMetaHeaderOriginField, buf[offset:], r.origin) + if err != nil { + return nil, err + } + + return buf, nil +} + +func (r *ResponseMetaHeader) StableSize() (size int) { + if r == nil { + return 0 + } + + if r.version != nil { + size += proto.NestedStructureSize(respMetaHeaderVersionField, r.version) + } + + size += proto.UInt64Size(respMetaHeaderEpochField, r.epoch) + size += proto.UInt32Size(respMetaHeaderTTLField, r.ttl) + + for i := range r.xHeaders { + size += proto.NestedStructureSize(respMetaHeaderXHeadersField, r.xHeaders[i]) + } + + size += proto.NestedStructureSize(respMetaHeaderOriginField, r.origin) + + return size +} + +func (r *ResponseVerificationHeader) StableMarshal(buf []byte) ([]byte, error) { + if r == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, r.StableSize()) + } + + var ( + offset, n int + err error + ) + + n, err = proto.NestedStructureMarshal(respVerifHeaderBodySignatureField, buf[offset:], r.bodySig) + if err != nil { + return nil, err + } + + offset += n + + n, err = proto.NestedStructureMarshal(respVerifHeaderMetaSignatureField, buf[offset:], r.metaSig) + if err != nil { + return nil, err + } + + offset += n + + n, err = proto.NestedStructureMarshal(respVerifHeaderOriginSignatureField, buf[offset:], r.originSig) + if err != nil { + return nil, err + } + + offset += n + + _, err = proto.NestedStructureMarshal(respVerifHeaderOriginField, buf[offset:], r.origin) + if err != nil { + return nil, err + } + + return buf, nil +} + +func (r *ResponseVerificationHeader) StableSize() (size int) { + if r == nil { + return 0 + } + + size += proto.NestedStructureSize(respVerifHeaderBodySignatureField, r.bodySig) + size += proto.NestedStructureSize(respVerifHeaderMetaSignatureField, r.metaSig) + size += proto.NestedStructureSize(respVerifHeaderOriginSignatureField, r.originSig) + size += proto.NestedStructureSize(respVerifHeaderOriginField, r.origin) + + return size +} diff --git a/v2/session/marshal_test.go b/v2/session/marshal_test.go index 685a477..0f038c0 100644 --- a/v2/session/marshal_test.go +++ b/v2/session/marshal_test.go @@ -1,10 +1,11 @@ package session_test import ( + "fmt" "testing" + "github.com/nspcc-dev/neofs-api-go/v2/acl" "github.com/nspcc-dev/neofs-api-go/v2/refs" - "github.com/nspcc-dev/neofs-api-go/v2/service" "github.com/nspcc-dev/neofs-api-go/v2/session" grpc "github.com/nspcc-dev/neofs-api-go/v2/session/grpc" "github.com/stretchr/testify/require" @@ -42,8 +43,160 @@ func TestCreateResponseBody_StableMarshal(t *testing.T) { }) } +func TestXHeader_StableMarshal(t *testing.T) { + xheaderFrom := generateXHeader("X-Header-Key", "X-Header-Value") + transport := new(grpc.XHeader) + + t.Run("non empty", func(t *testing.T) { + wire, err := xheaderFrom.StableMarshal(nil) + require.NoError(t, err) + + err = transport.Unmarshal(wire) + require.NoError(t, err) + + xheaderTo := session.XHeaderFromGRPCMessage(transport) + require.Equal(t, xheaderFrom, xheaderTo) + }) +} + +func TestTokenLifetime_StableMarshal(t *testing.T) { + lifetimeFrom := generateLifetime(10, 20, 30) + transport := new(grpc.SessionToken_Body_TokenLifetime) + + t.Run("non empty", func(t *testing.T) { + wire, err := lifetimeFrom.StableMarshal(nil) + require.NoError(t, err) + + err = transport.Unmarshal(wire) + require.NoError(t, err) + + lifetimeTo := session.TokenLifetimeFromGRPCMessage(transport) + require.Equal(t, lifetimeFrom, lifetimeTo) + }) +} + +func TestObjectSessionContext_StableMarshal(t *testing.T) { + objectCtxFrom := generateObjectCtx("Object ID") + transport := new(grpc.ObjectSessionContext) + + t.Run("non empty", func(t *testing.T) { + wire, err := objectCtxFrom.StableMarshal(nil) + require.NoError(t, err) + + err = transport.Unmarshal(wire) + require.NoError(t, err) + + objectCtxTo := session.ObjectSessionContextFromGRPCMessage(transport) + require.Equal(t, objectCtxFrom, objectCtxTo) + }) +} + +func TestSessionTokenBody_StableMarshal(t *testing.T) { + sessionTokenBodyFrom := generateSessionTokenBody("Session Token Body") + transport := new(grpc.SessionToken_Body) + + t.Run("non empty", func(t *testing.T) { + wire, err := sessionTokenBodyFrom.StableMarshal(nil) + require.NoError(t, err) + + err = transport.Unmarshal(wire) + require.NoError(t, err) + + sessionTokenBodyTo := session.SessionTokenBodyFromGRPCMessage(transport) + require.Equal(t, sessionTokenBodyFrom, sessionTokenBodyTo) + }) +} + +func TestSessionToken_StableMarshal(t *testing.T) { + sessionTokenFrom := generateSessionToken("Session Token") + transport := new(grpc.SessionToken) + + t.Run("non empty", func(t *testing.T) { + wire, err := sessionTokenFrom.StableMarshal(nil) + require.NoError(t, err) + + err = transport.Unmarshal(wire) + require.NoError(t, err) + + sessionTokenTo := session.SessionTokenFromGRPCMessage(transport) + require.Equal(t, sessionTokenFrom, sessionTokenTo) + }) +} + +func TestRequestMetaHeader_StableMarshal(t *testing.T) { + metaHeaderOrigin := generateRequestMetaHeader(10, "Bearer One", "Session One") + metaHeaderFrom := generateRequestMetaHeader(20, "Bearer Two", "Session Two") + metaHeaderFrom.SetOrigin(metaHeaderOrigin) + transport := new(grpc.RequestMetaHeader) + + t.Run("non empty", func(t *testing.T) { + wire, err := metaHeaderFrom.StableMarshal(nil) + require.NoError(t, err) + + err = transport.Unmarshal(wire) + require.NoError(t, err) + + metaHeaderTo := session.RequestMetaHeaderFromGRPCMessage(transport) + require.Equal(t, metaHeaderFrom, metaHeaderTo) + }) +} + +func TestRequestVerificationHeader_StableMarshal(t *testing.T) { + verifHeaderOrigin := generateRequestVerificationHeader("Key", "Inside") + verifHeaderFrom := generateRequestVerificationHeader("Value", "Outside") + verifHeaderFrom.SetOrigin(verifHeaderOrigin) + transport := new(grpc.RequestVerificationHeader) + + t.Run("non empty", func(t *testing.T) { + wire, err := verifHeaderFrom.StableMarshal(nil) + require.NoError(t, err) + + err = transport.Unmarshal(wire) + require.NoError(t, err) + + verifHeaderTo := session.RequestVerificationHeaderFromGRPCMessage(transport) + require.Equal(t, verifHeaderFrom, verifHeaderTo) + }) +} + +func TestResponseMetaHeader_StableMarshal(t *testing.T) { + metaHeaderOrigin := generateResponseMetaHeader(10) + metaHeaderFrom := generateResponseMetaHeader(20) + metaHeaderFrom.SetOrigin(metaHeaderOrigin) + transport := new(grpc.ResponseMetaHeader) + + t.Run("non empty", func(t *testing.T) { + wire, err := metaHeaderFrom.StableMarshal(nil) + require.NoError(t, err) + + err = transport.Unmarshal(wire) + require.NoError(t, err) + + metaHeaderTo := session.ResponseMetaHeaderFromGRPCMessage(transport) + require.Equal(t, metaHeaderFrom, metaHeaderTo) + }) +} + +func TestResponseVerificationHeader_StableMarshal(t *testing.T) { + verifHeaderOrigin := generateResponseVerificationHeader("Key", "Inside") + verifHeaderFrom := generateResponseVerificationHeader("Value", "Outside") + verifHeaderFrom.SetOrigin(verifHeaderOrigin) + transport := new(grpc.ResponseVerificationHeader) + + t.Run("non empty", func(t *testing.T) { + wire, err := verifHeaderFrom.StableMarshal(nil) + require.NoError(t, err) + + err = transport.Unmarshal(wire) + require.NoError(t, err) + + verifHeaderTo := session.ResponseVerificationHeaderFromGRPCMessage(transport) + require.Equal(t, verifHeaderFrom, verifHeaderTo) + }) +} + func generateCreateSessionRequestBody(id string) *session.CreateRequestBody { - lifetime := new(service.TokenLifetime) + lifetime := new(session.TokenLifetime) lifetime.SetIat(1) lifetime.SetNbf(2) lifetime.SetExp(3) @@ -53,7 +206,7 @@ func generateCreateSessionRequestBody(id string) *session.CreateRequestBody { s := new(session.CreateRequestBody) s.SetOwnerID(owner) - s.SetLifetime(lifetime) + s.SetExpiration(10) return s } @@ -65,3 +218,185 @@ func generateCreateSessionResponseBody(id, key string) *session.CreateResponseBo return s } + +func generateSignature(k, v string) *refs.Signature { + sig := new(refs.Signature) + sig.SetKey([]byte(k)) + sig.SetSign([]byte(v)) + + return sig +} + +func generateVersion(maj, min uint32) *refs.Version { + version := new(refs.Version) + version.SetMajor(maj) + version.SetMinor(min) + + return version +} + +func generateXHeader(k, v string) *session.XHeader { + xheader := new(session.XHeader) + xheader.SetKey(k) + xheader.SetValue(v) + + return xheader +} + +func generateLifetime(exp, nbf, iat uint64) *session.TokenLifetime { + lifetime := new(session.TokenLifetime) + lifetime.SetExp(exp) + lifetime.SetNbf(nbf) + lifetime.SetIat(iat) + + return lifetime +} + +func generateBearerLifetime(exp, nbf, iat uint64) *acl.TokenLifetime { + lifetime := new(acl.TokenLifetime) + lifetime.SetExp(exp) + lifetime.SetNbf(nbf) + lifetime.SetIat(iat) + + return lifetime +} + +func generateObjectCtx(id string) *session.ObjectSessionContext { + objectCtx := new(session.ObjectSessionContext) + objectCtx.SetVerb(session.ObjectVerbPut) + + cid := new(refs.ContainerID) + cid.SetValue([]byte("ContainerID")) + + oid := new(refs.ObjectID) + oid.SetValue([]byte(id)) + + addr := new(refs.Address) + addr.SetContainerID(cid) + addr.SetObjectID(oid) + + objectCtx.SetAddress(addr) + + return objectCtx +} + +func generateEACL(n int, k, v string) *acl.Table { + target := new(acl.TargetInfo) + target.SetTarget(acl.TargetUser) + + keys := make([][]byte, n) + + for i := 0; i < n; i++ { + s := fmt.Sprintf("Public Key %d", i+1) + keys[i] = []byte(s) + } + + filter := new(acl.HeaderFilter) + filter.SetHeaderType(acl.HeaderTypeObject) + filter.SetMatchType(acl.MatchTypeStringEqual) + filter.SetName(k) + filter.SetValue(v) + + record := new(acl.Record) + record.SetOperation(acl.OperationHead) + record.SetAction(acl.ActionDeny) + record.SetTargets([]*acl.TargetInfo{target}) + record.SetFilters([]*acl.HeaderFilter{filter}) + + table := new(acl.Table) + cid := new(refs.ContainerID) + cid.SetValue([]byte("Container ID")) + + table.SetContainerID(cid) + table.SetRecords([]*acl.Record{record}) + + return table +} + +func generateSessionTokenBody(id string) *session.SessionTokenBody { + owner := new(refs.OwnerID) + owner.SetValue([]byte("Owner ID")) + + tokenBody := new(session.SessionTokenBody) + tokenBody.SetID([]byte(id)) + tokenBody.SetOwnerID(owner) + tokenBody.SetSessionKey([]byte(id)) + tokenBody.SetLifetime(generateLifetime(1, 2, 3)) + tokenBody.SetContext(generateObjectCtx(id)) + + return tokenBody +} + +func generateSessionToken(id string) *session.SessionToken { + sessionToken := new(session.SessionToken) + sessionToken.SetBody(generateSessionTokenBody(id)) + sessionToken.SetSignature(generateSignature("id", id)) + + return sessionToken +} + +func generateBearerTokenBody(id string) *acl.BearerTokenBody { + owner := new(refs.OwnerID) + owner.SetValue([]byte(id)) + + tokenBody := new(acl.BearerTokenBody) + tokenBody.SetOwnerID(owner) + tokenBody.SetLifetime(generateBearerLifetime(1, 2, 3)) + tokenBody.SetEACL(generateEACL(10, "id", id)) + + return tokenBody +} + +func generateBearerToken(id string) *acl.BearerToken { + bearerToken := new(acl.BearerToken) + bearerToken.SetBody(generateBearerTokenBody(id)) + bearerToken.SetSignature(generateSignature("id", id)) + + return bearerToken +} + +func generateRequestMetaHeader(n int, b, s string) *session.RequestMetaHeader { + reqMetaHeader := new(session.RequestMetaHeader) + reqMetaHeader.SetVersion(generateVersion(2, 0)) + reqMetaHeader.SetEpoch(uint64(n)) + reqMetaHeader.SetTTL(uint32(n)) + reqMetaHeader.SetXHeaders([]*session.XHeader{ + generateXHeader("key-one", "val-one"), + generateXHeader("key-two", "val-two"), + }) + reqMetaHeader.SetBearerToken(generateBearerToken(b)) + reqMetaHeader.SetSessionToken(generateSessionToken(s)) + + return reqMetaHeader +} + +func generateRequestVerificationHeader(k, v string) *session.RequestVerificationHeader { + reqVerifHeader := new(session.RequestVerificationHeader) + reqVerifHeader.SetBodySignature(generateSignature(k+"body", v+"body")) + reqVerifHeader.SetMetaSignature(generateSignature(k+"meta", v+"meta")) + reqVerifHeader.SetOriginSignature(generateSignature(k+"orig", v+"orig")) + + return reqVerifHeader +} + +func generateResponseMetaHeader(n int) *session.ResponseMetaHeader { + respMetaHeader := new(session.ResponseMetaHeader) + respMetaHeader.SetVersion(generateVersion(2, 0)) + respMetaHeader.SetEpoch(uint64(n)) + respMetaHeader.SetTTL(uint32(n)) + respMetaHeader.SetXHeaders([]*session.XHeader{ + generateXHeader("key-one", "val-one"), + generateXHeader("key-two", "val-two"), + }) + + return respMetaHeader +} + +func generateResponseVerificationHeader(k, v string) *session.ResponseVerificationHeader { + respVerifHeader := new(session.ResponseVerificationHeader) + respVerifHeader.SetBodySignature(generateSignature(k+"body", v+"body")) + respVerifHeader.SetMetaSignature(generateSignature(k+"meta", v+"meta")) + respVerifHeader.SetOriginSignature(generateSignature(k+"orig", v+"orig")) + + return respVerifHeader +} diff --git a/v2/session/types.go b/v2/session/types.go index 77729ce..9e87603 100644 --- a/v2/session/types.go +++ b/v2/session/types.go @@ -1,22 +1,22 @@ package session import ( + "github.com/nspcc-dev/neofs-api-go/v2/acl" "github.com/nspcc-dev/neofs-api-go/v2/refs" - "github.com/nspcc-dev/neofs-api-go/v2/service" ) type CreateRequestBody struct { ownerID *refs.OwnerID - lifetime *service.TokenLifetime + expiration uint64 } type CreateRequest struct { body *CreateRequestBody - metaHeader *service.RequestMetaHeader + metaHeader *RequestMetaHeader - verifyHeader *service.RequestVerificationHeader + verifyHeader *RequestVerificationHeader } type CreateResponseBody struct { @@ -28,11 +28,100 @@ type CreateResponseBody struct { type CreateResponse struct { body *CreateResponseBody - metaHeader *service.ResponseMetaHeader + metaHeader *ResponseMetaHeader - verifyHeader *service.ResponseVerificationHeader + verifyHeader *ResponseVerificationHeader } +type XHeader struct { + key, val string +} + +type TokenLifetime struct { + exp, nbf, iat uint64 +} + +type ObjectSessionVerb uint32 + +type ObjectSessionContext struct { + verb ObjectSessionVerb + + addr *refs.Address +} + +type SessionTokenContext interface { + sessionTokenContext() +} + +type SessionTokenBody struct { + id []byte + + ownerID *refs.OwnerID + + lifetime *TokenLifetime + + sessionKey []byte + + ctx SessionTokenContext +} + +type SessionToken struct { + body *SessionTokenBody + + sig *refs.Signature +} + +type RequestVerificationHeader struct { + bodySig, metaSig, originSig *refs.Signature + + origin *RequestVerificationHeader +} + +type RequestMetaHeader struct { + version *refs.Version + + ttl uint32 + + epoch uint64 + + xHeaders []*XHeader + + sessionToken *SessionToken + + bearerToken *acl.BearerToken + + origin *RequestMetaHeader +} + +type ResponseVerificationHeader struct { + bodySig, metaSig, originSig *refs.Signature + + origin *ResponseVerificationHeader +} + +type ResponseMetaHeader struct { + version *refs.Version + + ttl uint32 + + epoch uint64 + + xHeaders []*XHeader + + origin *ResponseMetaHeader +} + +const ( + ObjectVerbUnknown ObjectSessionVerb = iota + ObjectVerbPut + ObjectVerbGet + ObjectVerbHead + ObjectVerbSearch + ObjectVerbDelete + ObjectVerbRange + ObjectVerbRangeHash +) + func (c *CreateRequestBody) GetOwnerID() *refs.OwnerID { if c != nil { return c.ownerID @@ -47,17 +136,17 @@ func (c *CreateRequestBody) SetOwnerID(v *refs.OwnerID) { } } -func (c *CreateRequestBody) GetLifetime() *service.TokenLifetime { +func (c *CreateRequestBody) GetExpiration() uint64 { if c != nil { - return c.lifetime + return c.expiration } - return nil + return 0 } -func (c *CreateRequestBody) SetLifetime(v *service.TokenLifetime) { +func (c *CreateRequestBody) SetExpiration(v uint64) { if c != nil { - c.lifetime = v + c.expiration = v } } @@ -75,7 +164,7 @@ func (c *CreateRequest) SetBody(v *CreateRequestBody) { } } -func (c *CreateRequest) GetMetaHeader() *service.RequestMetaHeader { +func (c *CreateRequest) GetMetaHeader() *RequestMetaHeader { if c != nil { return c.metaHeader } @@ -83,13 +172,13 @@ func (c *CreateRequest) GetMetaHeader() *service.RequestMetaHeader { return nil } -func (c *CreateRequest) SetMetaHeader(v *service.RequestMetaHeader) { +func (c *CreateRequest) SetMetaHeader(v *RequestMetaHeader) { if c != nil { c.metaHeader = v } } -func (c *CreateRequest) GetVerificationHeader() *service.RequestVerificationHeader { +func (c *CreateRequest) GetVerificationHeader() *RequestVerificationHeader { if c != nil { return c.verifyHeader } @@ -97,7 +186,7 @@ func (c *CreateRequest) GetVerificationHeader() *service.RequestVerificationHead return nil } -func (c *CreateRequest) SetVerificationHeader(v *service.RequestVerificationHeader) { +func (c *CreateRequest) SetVerificationHeader(v *RequestVerificationHeader) { if c != nil { c.verifyHeader = v } @@ -145,7 +234,7 @@ func (c *CreateResponse) SetBody(v *CreateResponseBody) { } } -func (c *CreateResponse) GetMetaHeader() *service.ResponseMetaHeader { +func (c *CreateResponse) GetMetaHeader() *ResponseMetaHeader { if c != nil { return c.metaHeader } @@ -153,13 +242,13 @@ func (c *CreateResponse) GetMetaHeader() *service.ResponseMetaHeader { return nil } -func (c *CreateResponse) SetMetaHeader(v *service.ResponseMetaHeader) { +func (c *CreateResponse) SetMetaHeader(v *ResponseMetaHeader) { if c != nil { c.metaHeader = v } } -func (c *CreateResponse) GetVerificationHeader() *service.ResponseVerificationHeader { +func (c *CreateResponse) GetVerificationHeader() *ResponseVerificationHeader { if c != nil { return c.verifyHeader } @@ -167,8 +256,486 @@ func (c *CreateResponse) GetVerificationHeader() *service.ResponseVerificationHe return nil } -func (c *CreateResponse) SetVerificationHeader(v *service.ResponseVerificationHeader) { +func (c *CreateResponse) SetVerificationHeader(v *ResponseVerificationHeader) { if c != nil { c.verifyHeader = v } } + +func (x *XHeader) GetKey() string { + if x != nil { + return x.key + } + + return "" +} + +func (x *XHeader) SetKey(v string) { + if x != nil { + x.key = v + } +} + +func (x *XHeader) GetValue() string { + if x != nil { + return x.val + } + + return "" +} + +func (x *XHeader) SetValue(v string) { + if x != nil { + x.val = v + } +} + +func (r *RequestVerificationHeader) GetBodySignature() *refs.Signature { + if r != nil { + return r.bodySig + } + + return nil +} + +func (r *RequestVerificationHeader) SetBodySignature(v *refs.Signature) { + if r != nil { + r.bodySig = v + } +} + +func (r *RequestVerificationHeader) GetMetaSignature() *refs.Signature { + if r != nil { + return r.metaSig + } + + return nil +} + +func (r *RequestVerificationHeader) SetMetaSignature(v *refs.Signature) { + if r != nil { + r.metaSig = v + } +} + +func (r *RequestVerificationHeader) GetOriginSignature() *refs.Signature { + if r != nil { + return r.originSig + } + + return nil +} + +func (r *RequestVerificationHeader) SetOriginSignature(v *refs.Signature) { + if r != nil { + r.originSig = v + } +} + +func (r *RequestVerificationHeader) GetOrigin() *RequestVerificationHeader { + if r != nil { + return r.origin + } + + return nil +} + +func (r *RequestVerificationHeader) SetOrigin(v *RequestVerificationHeader) { + if r != nil { + r.origin = v + } +} + +func (r *RequestMetaHeader) GetVersion() *refs.Version { + if r != nil { + return r.version + } + + return nil +} + +func (r *RequestMetaHeader) SetVersion(v *refs.Version) { + if r != nil { + r.version = v + } +} + +func (r *RequestMetaHeader) GetTTL() uint32 { + if r != nil { + return r.ttl + } + + return 0 +} + +func (r *RequestMetaHeader) SetTTL(v uint32) { + if r != nil { + r.ttl = v + } +} + +func (r *RequestMetaHeader) GetEpoch() uint64 { + if r != nil { + return r.epoch + } + + return 0 +} + +func (r *RequestMetaHeader) SetEpoch(v uint64) { + if r != nil { + r.epoch = v + } +} + +func (r *RequestMetaHeader) GetXHeaders() []*XHeader { + if r != nil { + return r.xHeaders + } + + return nil +} + +func (r *RequestMetaHeader) SetXHeaders(v []*XHeader) { + if r != nil { + r.xHeaders = v + } +} + +func (r *RequestMetaHeader) GetSessionToken() *SessionToken { + if r != nil { + return r.sessionToken + } + + return nil +} + +func (r *RequestMetaHeader) SetSessionToken(v *SessionToken) { + if r != nil { + r.sessionToken = v + } +} + +func (r *RequestMetaHeader) GetBearerToken() *acl.BearerToken { + if r != nil { + return r.bearerToken + } + + return nil +} + +func (r *RequestMetaHeader) SetBearerToken(v *acl.BearerToken) { + if r != nil { + r.bearerToken = v + } +} + +func (r *RequestMetaHeader) GetOrigin() *RequestMetaHeader { + if r != nil { + return r.origin + } + + return nil +} + +func (r *RequestMetaHeader) SetOrigin(v *RequestMetaHeader) { + if r != nil { + r.origin = v + } +} + +func (l *TokenLifetime) GetExp() uint64 { + if l != nil { + return l.exp + } + + return 0 +} + +func (l *TokenLifetime) SetExp(v uint64) { + if l != nil { + l.exp = v + } +} + +func (l *TokenLifetime) GetNbf() uint64 { + if l != nil { + return l.nbf + } + + return 0 +} + +func (l *TokenLifetime) SetNbf(v uint64) { + if l != nil { + l.nbf = v + } +} + +func (l *TokenLifetime) GetIat() uint64 { + if l != nil { + return l.iat + } + + return 0 +} + +func (l *TokenLifetime) SetIat(v uint64) { + if l != nil { + l.iat = v + } +} + +func (r *ResponseVerificationHeader) GetBodySignature() *refs.Signature { + if r != nil { + return r.bodySig + } + + return nil +} + +func (r *ResponseVerificationHeader) SetBodySignature(v *refs.Signature) { + if r != nil { + r.bodySig = v + } +} + +func (r *ResponseVerificationHeader) GetMetaSignature() *refs.Signature { + if r != nil { + return r.metaSig + } + + return nil +} + +func (r *ResponseVerificationHeader) SetMetaSignature(v *refs.Signature) { + if r != nil { + r.metaSig = v + } +} + +func (r *ResponseVerificationHeader) GetOriginSignature() *refs.Signature { + if r != nil { + return r.originSig + } + + return nil +} + +func (r *ResponseVerificationHeader) SetOriginSignature(v *refs.Signature) { + if r != nil { + r.originSig = v + } +} + +func (r *ResponseVerificationHeader) GetOrigin() *ResponseVerificationHeader { + if r != nil { + return r.origin + } + + return nil +} + +func (r *ResponseVerificationHeader) SetOrigin(v *ResponseVerificationHeader) { + if r != nil { + r.origin = v + } +} + +func (r *ResponseMetaHeader) GetVersion() *refs.Version { + if r != nil { + return r.version + } + + return nil +} + +func (r *ResponseMetaHeader) SetVersion(v *refs.Version) { + if r != nil { + r.version = v + } +} + +func (r *ResponseMetaHeader) GetTTL() uint32 { + if r != nil { + return r.ttl + } + + return 0 +} + +func (r *ResponseMetaHeader) SetTTL(v uint32) { + if r != nil { + r.ttl = v + } +} + +func (r *ResponseMetaHeader) GetEpoch() uint64 { + if r != nil { + return r.epoch + } + + return 0 +} + +func (r *ResponseMetaHeader) SetEpoch(v uint64) { + if r != nil { + r.epoch = v + } +} + +func (r *ResponseMetaHeader) GetXHeaders() []*XHeader { + if r != nil { + return r.xHeaders + } + + return nil +} + +func (r *ResponseMetaHeader) SetXHeaders(v []*XHeader) { + if r != nil { + r.xHeaders = v + } +} + +func (r *ResponseMetaHeader) GetOrigin() *ResponseMetaHeader { + if r != nil { + return r.origin + } + + return nil +} + +func (r *ResponseMetaHeader) SetOrigin(v *ResponseMetaHeader) { + if r != nil { + r.origin = v + } +} + +func (c *ObjectSessionContext) sessionTokenContext() {} + +func (c *ObjectSessionContext) GetVerb() ObjectSessionVerb { + if c != nil { + return c.verb + } + + return ObjectVerbUnknown +} + +func (c *ObjectSessionContext) SetVerb(v ObjectSessionVerb) { + if c != nil { + c.verb = v + } +} + +func (c *ObjectSessionContext) GetAddress() *refs.Address { + if c != nil { + return c.addr + } + + return nil +} + +func (c *ObjectSessionContext) SetAddress(v *refs.Address) { + if c != nil { + c.addr = v + } +} + +func (t *SessionTokenBody) GetID() []byte { + if t != nil { + return t.id + } + + return nil +} + +func (t *SessionTokenBody) SetID(v []byte) { + if t != nil { + t.id = v + } +} + +func (t *SessionTokenBody) GetOwnerID() *refs.OwnerID { + if t != nil { + return t.ownerID + } + + return nil +} + +func (t *SessionTokenBody) SetOwnerID(v *refs.OwnerID) { + if t != nil { + t.ownerID = v + } +} + +func (t *SessionTokenBody) GetLifetime() *TokenLifetime { + if t != nil { + return t.lifetime + } + + return nil +} + +func (t *SessionTokenBody) SetLifetime(v *TokenLifetime) { + if t != nil { + t.lifetime = v + } +} + +func (t *SessionTokenBody) GetSessionKey() []byte { + if t != nil { + return t.sessionKey + } + + return nil +} + +func (t *SessionTokenBody) SetSessionKey(v []byte) { + if t != nil { + t.sessionKey = v + } +} + +func (t *SessionTokenBody) GetContext() SessionTokenContext { + if t != nil { + return t.ctx + } + + return nil +} + +func (t *SessionTokenBody) SetContext(v SessionTokenContext) { + if t != nil { + t.ctx = v + } +} + +func (t *SessionToken) GetBody() *SessionTokenBody { + if t != nil { + return t.body + } + + return nil +} + +func (t *SessionToken) SetBody(v *SessionTokenBody) { + if t != nil { + t.body = v + } +} + +func (t *SessionToken) GetSignature() *refs.Signature { + if t != nil { + return t.sig + } + + return nil +} + +func (t *SessionToken) SetSignature(v *refs.Signature) { + if t != nil { + t.sig = v + } +} From 252b7036c70fdda5c80075f0743ecd78596840e1 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Thu, 20 Aug 2020 13:41:55 +0300 Subject: [PATCH 0357/1196] Adopt service session removal in packages Signed-off-by: Alex Vanin --- v2/accounting/accounting.go | 26 ++--- v2/accounting/convert.go | 10 +- v2/accounting/grpc/service.go | 10 +- v2/container/convert.go | 50 +++++----- v2/container/grpc/service.go | 50 +++++----- v2/container/types.go | 146 ++++++++++++++-------------- v2/object/convert.go | 62 ++++++------ v2/object/grpc/service.go | 58 +++++------ v2/object/grpc/types.go | 4 +- v2/object/marshal_test.go | 14 +-- v2/object/types.go | 176 +++++++++++++++++----------------- v2/signature/sign.go | 37 ++++--- v2/signature/sign_test.go | 6 +- 13 files changed, 324 insertions(+), 325 deletions(-) diff --git a/v2/accounting/accounting.go b/v2/accounting/accounting.go index 1ca3d26..f2c0d98 100644 --- a/v2/accounting/accounting.go +++ b/v2/accounting/accounting.go @@ -2,7 +2,7 @@ package accounting import ( "github.com/nspcc-dev/neofs-api-go/v2/refs" - "github.com/nspcc-dev/neofs-api-go/v2/service" + "github.com/nspcc-dev/neofs-api-go/v2/session" ) type BalanceRequestBody struct { @@ -12,9 +12,9 @@ type BalanceRequestBody struct { type BalanceRequest struct { body *BalanceRequestBody - metaHeader *service.RequestMetaHeader + metaHeader *session.RequestMetaHeader - verifyHeader *service.RequestVerificationHeader + verifyHeader *session.RequestVerificationHeader } type BalanceResponseBody struct { @@ -24,9 +24,9 @@ type BalanceResponseBody struct { type BalanceResponse struct { body *BalanceResponseBody - metaHeader *service.ResponseMetaHeader + metaHeader *session.ResponseMetaHeader - verifyHeader *service.ResponseVerificationHeader + verifyHeader *session.ResponseVerificationHeader } type Decimal struct { @@ -63,7 +63,7 @@ func (b *BalanceRequest) SetBody(v *BalanceRequestBody) { } } -func (b *BalanceRequest) GetMetaHeader() *service.RequestMetaHeader { +func (b *BalanceRequest) GetMetaHeader() *session.RequestMetaHeader { if b != nil { return b.metaHeader } @@ -71,13 +71,13 @@ func (b *BalanceRequest) GetMetaHeader() *service.RequestMetaHeader { return nil } -func (b *BalanceRequest) SetMetaHeader(v *service.RequestMetaHeader) { +func (b *BalanceRequest) SetMetaHeader(v *session.RequestMetaHeader) { if b != nil { b.metaHeader = v } } -func (b *BalanceRequest) GetVerificationHeader() *service.RequestVerificationHeader { +func (b *BalanceRequest) GetVerificationHeader() *session.RequestVerificationHeader { if b != nil { return b.verifyHeader } @@ -85,7 +85,7 @@ func (b *BalanceRequest) GetVerificationHeader() *service.RequestVerificationHea return nil } -func (b *BalanceRequest) SetVerificationHeader(v *service.RequestVerificationHeader) { +func (b *BalanceRequest) SetVerificationHeader(v *session.RequestVerificationHeader) { if b != nil { b.verifyHeader = v } @@ -147,7 +147,7 @@ func (br *BalanceResponse) SetBody(v *BalanceResponseBody) { } } -func (br *BalanceResponse) GetMetaHeader() *service.ResponseMetaHeader { +func (br *BalanceResponse) GetMetaHeader() *session.ResponseMetaHeader { if br != nil { return br.metaHeader } @@ -155,13 +155,13 @@ func (br *BalanceResponse) GetMetaHeader() *service.ResponseMetaHeader { return nil } -func (br *BalanceResponse) SetMetaHeader(v *service.ResponseMetaHeader) { +func (br *BalanceResponse) SetMetaHeader(v *session.ResponseMetaHeader) { if br != nil { br.metaHeader = v } } -func (br *BalanceResponse) GetVerificationHeader() *service.ResponseVerificationHeader { +func (br *BalanceResponse) GetVerificationHeader() *session.ResponseVerificationHeader { if br != nil { return br.verifyHeader } @@ -169,7 +169,7 @@ func (br *BalanceResponse) GetVerificationHeader() *service.ResponseVerification return nil } -func (br *BalanceResponse) SetVerificationHeader(v *service.ResponseVerificationHeader) { +func (br *BalanceResponse) SetVerificationHeader(v *session.ResponseVerificationHeader) { if br != nil { br.verifyHeader = v } diff --git a/v2/accounting/convert.go b/v2/accounting/convert.go index 5a0b6ed..d7fe95c 100644 --- a/v2/accounting/convert.go +++ b/v2/accounting/convert.go @@ -3,7 +3,7 @@ package accounting import ( accounting "github.com/nspcc-dev/neofs-api-go/v2/accounting/grpc" "github.com/nspcc-dev/neofs-api-go/v2/refs" - "github.com/nspcc-dev/neofs-api-go/v2/service" + "github.com/nspcc-dev/neofs-api-go/v2/session" ) func BalanceRequestBodyToGRPCMessage(b *BalanceRequestBody) *accounting.BalanceRequest_Body { @@ -45,7 +45,7 @@ func BalanceRequestToGRPCMessage(b *BalanceRequest) *accounting.BalanceRequest { BalanceRequestBodyToGRPCMessage(b.GetBody()), ) - service.RequestHeadersToGRPC(b, m) + session.RequestHeadersToGRPC(b, m) return m } @@ -61,7 +61,7 @@ func BalanceRequestFromGRPCMessage(m *accounting.BalanceRequest) *BalanceRequest BalanceRequestBodyFromGRPCMessage(m.GetBody()), ) - service.RequestHeadersFromGRPC(m, b) + session.RequestHeadersFromGRPC(m, b) return b } @@ -131,7 +131,7 @@ func BalanceResponseToGRPCMessage(br *BalanceResponse) *accounting.BalanceRespon BalanceResponseBodyToGRPCMessage(br.GetBody()), ) - service.ResponseHeadersToGRPC(br, m) + session.ResponseHeadersToGRPC(br, m) return m } @@ -147,7 +147,7 @@ func BalanceResponseFromGRPCMessage(m *accounting.BalanceResponse) *BalanceRespo BalanceResponseBodyFromGRPCMessage(m.GetBody()), ) - service.ResponseHeadersFromGRPC(m, br) + session.ResponseHeadersFromGRPC(m, br) return br } diff --git a/v2/accounting/grpc/service.go b/v2/accounting/grpc/service.go index 058067b..78adedb 100644 --- a/v2/accounting/grpc/service.go +++ b/v2/accounting/grpc/service.go @@ -2,7 +2,7 @@ package accounting import ( refs "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" - service "github.com/nspcc-dev/neofs-api-go/v2/service/grpc" + session "github.com/nspcc-dev/neofs-api-go/v2/session/grpc" ) // SetOwnerId sets identifier of the account owner. @@ -20,14 +20,14 @@ func (m *BalanceRequest) SetBody(v *BalanceRequest_Body) { } // SetMetaHeader sets meta header of the request. -func (m *BalanceRequest) SetMetaHeader(v *service.RequestMetaHeader) { +func (m *BalanceRequest) SetMetaHeader(v *session.RequestMetaHeader) { if m != nil { m.MetaHeader = v } } // SetVerifyHeader sets verification header of the request. -func (m *BalanceRequest) SetVerifyHeader(v *service.RequestVerificationHeader) { +func (m *BalanceRequest) SetVerifyHeader(v *session.RequestVerificationHeader) { if m != nil { m.VerifyHeader = v } @@ -48,14 +48,14 @@ func (m *BalanceResponse) SetBody(v *BalanceResponse_Body) { } // SetMetaHeader sets meta header of the response. -func (m *BalanceResponse) SetMetaHeader(v *service.ResponseMetaHeader) { +func (m *BalanceResponse) SetMetaHeader(v *session.ResponseMetaHeader) { if m != nil { m.MetaHeader = v } } // SetVerifyHeader sets verification header of the response. -func (m *BalanceResponse) SetVerifyHeader(v *service.ResponseVerificationHeader) { +func (m *BalanceResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) { if m != nil { m.VerifyHeader = v } diff --git a/v2/container/convert.go b/v2/container/convert.go index 34d5b97..b60d9a3 100644 --- a/v2/container/convert.go +++ b/v2/container/convert.go @@ -6,7 +6,7 @@ import ( "github.com/nspcc-dev/neofs-api-go/v2/netmap" "github.com/nspcc-dev/neofs-api-go/v2/refs" refsGRPC "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" - "github.com/nspcc-dev/neofs-api-go/v2/service" + "github.com/nspcc-dev/neofs-api-go/v2/session" ) func AttributeToGRPCMessage(a *Attribute) *container.Container_Attribute { @@ -152,7 +152,7 @@ func PutRequestToGRPCMessage(r *PutRequest) *container.PutRequest { PutRequestBodyToGRPCMessage(r.GetBody()), ) - service.RequestHeadersToGRPC(r, m) + session.RequestHeadersToGRPC(r, m) return m } @@ -168,7 +168,7 @@ func PutRequestFromGRPCMessage(m *container.PutRequest) *PutRequest { PutRequestBodyFromGRPCMessage(m.GetBody()), ) - service.RequestHeadersFromGRPC(m, r) + session.RequestHeadersFromGRPC(m, r) return r } @@ -212,7 +212,7 @@ func PutResponseToGRPCMessage(r *PutResponse) *container.PutResponse { PutResponseBodyToGRPCMessage(r.GetBody()), ) - service.ResponseHeadersToGRPC(r, m) + session.ResponseHeadersToGRPC(r, m) return m } @@ -228,7 +228,7 @@ func PutResponseFromGRPCMessage(m *container.PutResponse) *PutResponse { PutResponseBodyFromGRPCMessage(m.GetBody()), ) - service.ResponseHeadersFromGRPC(m, r) + session.ResponseHeadersFromGRPC(m, r) return r } @@ -272,7 +272,7 @@ func GetRequestToGRPCMessage(r *GetRequest) *container.GetRequest { GetRequestBodyToGRPCMessage(r.GetBody()), ) - service.RequestHeadersToGRPC(r, m) + session.RequestHeadersToGRPC(r, m) return m } @@ -288,7 +288,7 @@ func GetRequestFromGRPCMessage(m *container.GetRequest) *GetRequest { GetRequestBodyFromGRPCMessage(m.GetBody()), ) - service.RequestHeadersFromGRPC(m, r) + session.RequestHeadersFromGRPC(m, r) return r } @@ -332,7 +332,7 @@ func GetResponseToGRPCMessage(r *GetResponse) *container.GetResponse { GetResponseBodyToGRPCMessage(r.GetBody()), ) - service.ResponseHeadersToGRPC(r, m) + session.ResponseHeadersToGRPC(r, m) return m } @@ -348,7 +348,7 @@ func GetResponseFromGRPCMessage(m *container.GetResponse) *GetResponse { GetResponseBodyFromGRPCMessage(m.GetBody()), ) - service.ResponseHeadersFromGRPC(m, r) + session.ResponseHeadersFromGRPC(m, r) return r } @@ -400,7 +400,7 @@ func DeleteRequestToGRPCMessage(r *DeleteRequest) *container.DeleteRequest { DeleteRequestBodyToGRPCMessage(r.GetBody()), ) - service.RequestHeadersToGRPC(r, m) + session.RequestHeadersToGRPC(r, m) return m } @@ -416,7 +416,7 @@ func DeleteRequestFromGRPCMessage(m *container.DeleteRequest) *DeleteRequest { DeleteRequestBodyFromGRPCMessage(m.GetBody()), ) - service.RequestHeadersFromGRPC(m, r) + session.RequestHeadersFromGRPC(m, r) return r } @@ -452,7 +452,7 @@ func DeleteResponseToGRPCMessage(r *DeleteResponse) *container.DeleteResponse { DeleteResponseBodyToGRPCMessage(r.GetBody()), ) - service.ResponseHeadersToGRPC(r, m) + session.ResponseHeadersToGRPC(r, m) return m } @@ -468,7 +468,7 @@ func DeleteResponseFromGRPCMessage(m *container.DeleteResponse) *DeleteResponse DeleteResponseBodyFromGRPCMessage(m.GetBody()), ) - service.ResponseHeadersFromGRPC(m, r) + session.ResponseHeadersFromGRPC(m, r) return r } @@ -512,7 +512,7 @@ func ListRequestToGRPCMessage(r *ListRequest) *container.ListRequest { ListRequestBodyToGRPCMessage(r.GetBody()), ) - service.RequestHeadersToGRPC(r, m) + session.RequestHeadersToGRPC(r, m) return m } @@ -528,7 +528,7 @@ func ListRequestFromGRPCMessage(m *container.ListRequest) *ListRequest { ListRequestBodyFromGRPCMessage(m.GetBody()), ) - service.RequestHeadersFromGRPC(m, r) + session.RequestHeadersFromGRPC(m, r) return r } @@ -582,7 +582,7 @@ func ListResponseToGRPCMessage(r *ListResponse) *container.ListResponse { ListResponseBodyToGRPCMessage(r.GetBody()), ) - service.ResponseHeadersToGRPC(r, m) + session.ResponseHeadersToGRPC(r, m) return m } @@ -598,7 +598,7 @@ func ListResponseFromGRPCMessage(m *container.ListResponse) *ListResponse { ListResponseBodyFromGRPCMessage(m.GetBody()), ) - service.ResponseHeadersFromGRPC(m, r) + session.ResponseHeadersFromGRPC(m, r) return r } @@ -649,7 +649,7 @@ func SetExtendedACLRequestToGRPCMessage(r *SetExtendedACLRequest) *container.Set SetExtendedACLRequestBodyToGRPCMessage(r.GetBody()), ) - service.RequestHeadersToGRPC(r, m) + session.RequestHeadersToGRPC(r, m) return m } @@ -665,7 +665,7 @@ func SetExtendedACLRequestFromGRPCMessage(m *container.SetExtendedACLRequest) *S SetExtendedACLRequestBodyFromGRPCMessage(m.GetBody()), ) - service.RequestHeadersFromGRPC(m, r) + session.RequestHeadersFromGRPC(m, r) return r } @@ -701,7 +701,7 @@ func SetExtendedACLResponseToGRPCMessage(r *SetExtendedACLResponse) *container.S SetExtendedACLResponseBodyToGRPCMessage(r.GetBody()), ) - service.ResponseHeadersToGRPC(r, m) + session.ResponseHeadersToGRPC(r, m) return m } @@ -717,7 +717,7 @@ func SetExtendedACLResponseFromGRPCMessage(m *container.SetExtendedACLResponse) SetExtendedACLResponseBodyFromGRPCMessage(m.GetBody()), ) - service.ResponseHeadersFromGRPC(m, r) + session.ResponseHeadersFromGRPC(m, r) return r } @@ -761,7 +761,7 @@ func GetExtendedACLRequestToGRPCMessage(r *GetExtendedACLRequest) *container.Get GetExtendedACLRequestBodyToGRPCMessage(r.GetBody()), ) - service.RequestHeadersToGRPC(r, m) + session.RequestHeadersToGRPC(r, m) return m } @@ -777,7 +777,7 @@ func GetExtendedACLRequestFromGRPCMessage(m *container.GetExtendedACLRequest) *G GetExtendedACLRequestBodyFromGRPCMessage(m.GetBody()), ) - service.RequestHeadersFromGRPC(m, r) + session.RequestHeadersFromGRPC(m, r) return r } @@ -829,7 +829,7 @@ func GetExtendedACLResponseToGRPCMessage(r *GetExtendedACLResponse) *container.G GetExtendedACLResponseBodyToGRPCMessage(r.GetBody()), ) - service.ResponseHeadersToGRPC(r, m) + session.ResponseHeadersToGRPC(r, m) return m } @@ -845,7 +845,7 @@ func GetExtendedACLResponseFromGRPCMessage(m *container.GetExtendedACLResponse) GetExtendedACLResponseBodyFromGRPCMessage(m.GetBody()), ) - service.ResponseHeadersFromGRPC(m, r) + session.ResponseHeadersFromGRPC(m, r) return r } diff --git a/v2/container/grpc/service.go b/v2/container/grpc/service.go index 4da5e0f..61648b5 100644 --- a/v2/container/grpc/service.go +++ b/v2/container/grpc/service.go @@ -3,7 +3,7 @@ package container import ( acl "github.com/nspcc-dev/neofs-api-go/v2/acl/grpc" refs "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" - service "github.com/nspcc-dev/neofs-api-go/v2/service/grpc" + session "github.com/nspcc-dev/neofs-api-go/v2/session/grpc" ) // SetContainer sets container of the request. @@ -28,14 +28,14 @@ func (m *PutRequest) SetBody(v *PutRequest_Body) { } // SetMetaHeader sets meta header of the request. -func (m *PutRequest) SetMetaHeader(v *service.RequestMetaHeader) { +func (m *PutRequest) SetMetaHeader(v *session.RequestMetaHeader) { if m != nil { m.MetaHeader = v } } // SetVerifyHeader sets verification header of the request. -func (m *PutRequest) SetVerifyHeader(v *service.RequestVerificationHeader) { +func (m *PutRequest) SetVerifyHeader(v *session.RequestVerificationHeader) { if m != nil { m.VerifyHeader = v } @@ -56,14 +56,14 @@ func (m *PutResponse) SetBody(v *PutResponse_Body) { } // SetMetaHeader sets meta header of the response. -func (m *PutResponse) SetMetaHeader(v *service.ResponseMetaHeader) { +func (m *PutResponse) SetMetaHeader(v *session.ResponseMetaHeader) { if m != nil { m.MetaHeader = v } } // SetVerifyHeader sets verification header of the response. -func (m *PutResponse) SetVerifyHeader(v *service.ResponseVerificationHeader) { +func (m *PutResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) { if m != nil { m.VerifyHeader = v } @@ -91,14 +91,14 @@ func (m *DeleteRequest) SetBody(v *DeleteRequest_Body) { } // SetMetaHeader sets meta header of the request. -func (m *DeleteRequest) SetMetaHeader(v *service.RequestMetaHeader) { +func (m *DeleteRequest) SetMetaHeader(v *session.RequestMetaHeader) { if m != nil { m.MetaHeader = v } } // SetVerifyHeader sets verification header of the request. -func (m *DeleteRequest) SetVerifyHeader(v *service.RequestVerificationHeader) { +func (m *DeleteRequest) SetVerifyHeader(v *session.RequestVerificationHeader) { if m != nil { m.VerifyHeader = v } @@ -112,14 +112,14 @@ func (m *DeleteResponse) SetBody(v *DeleteResponse_Body) { } // SetMetaHeader sets meta header of the response. -func (m *DeleteResponse) SetMetaHeader(v *service.ResponseMetaHeader) { +func (m *DeleteResponse) SetMetaHeader(v *session.ResponseMetaHeader) { if m != nil { m.MetaHeader = v } } // SetVerifyHeader sets verification header of the response. -func (m *DeleteResponse) SetVerifyHeader(v *service.ResponseVerificationHeader) { +func (m *DeleteResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) { if m != nil { m.VerifyHeader = v } @@ -138,14 +138,14 @@ func (m *GetRequest) SetBody(v *GetRequest_Body) { } // SetMetaHeader sets meta header of the request. -func (m *GetRequest) SetMetaHeader(v *service.RequestMetaHeader) { +func (m *GetRequest) SetMetaHeader(v *session.RequestMetaHeader) { if m != nil { m.MetaHeader = v } } // SetVerifyHeader sets verification header of the request. -func (m *GetRequest) SetVerifyHeader(v *service.RequestVerificationHeader) { +func (m *GetRequest) SetVerifyHeader(v *session.RequestVerificationHeader) { if m != nil { m.VerifyHeader = v } @@ -166,14 +166,14 @@ func (m *GetResponse) SetBody(v *GetResponse_Body) { } // SetMetaHeader sets meta header of the response. -func (m *GetResponse) SetMetaHeader(v *service.ResponseMetaHeader) { +func (m *GetResponse) SetMetaHeader(v *session.ResponseMetaHeader) { if m != nil { m.MetaHeader = v } } // SetVerifyHeader sets verification header of the response. -func (m *GetResponse) SetVerifyHeader(v *service.ResponseVerificationHeader) { +func (m *GetResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) { if m != nil { m.VerifyHeader = v } @@ -194,14 +194,14 @@ func (m *ListRequest) SetBody(v *ListRequest_Body) { } // SetMetaHeader sets meta header of the request. -func (m *ListRequest) SetMetaHeader(v *service.RequestMetaHeader) { +func (m *ListRequest) SetMetaHeader(v *session.RequestMetaHeader) { if m != nil { m.MetaHeader = v } } // SetVerifyHeader sets verification header of the request. -func (m *ListRequest) SetVerifyHeader(v *service.RequestVerificationHeader) { +func (m *ListRequest) SetVerifyHeader(v *session.RequestVerificationHeader) { if m != nil { m.VerifyHeader = v } @@ -222,14 +222,14 @@ func (m *ListResponse) SetBody(v *ListResponse_Body) { } // SetMetaHeader sets meta header of the response. -func (m *ListResponse) SetMetaHeader(v *service.ResponseMetaHeader) { +func (m *ListResponse) SetMetaHeader(v *session.ResponseMetaHeader) { if m != nil { m.MetaHeader = v } } // SetVerifyHeader sets verification header of the response. -func (m *ListResponse) SetVerifyHeader(v *service.ResponseVerificationHeader) { +func (m *ListResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) { if m != nil { m.VerifyHeader = v } @@ -257,14 +257,14 @@ func (m *SetExtendedACLRequest) SetBody(v *SetExtendedACLRequest_Body) { } // SetMetaHeader sets meta header of the request. -func (m *SetExtendedACLRequest) SetMetaHeader(v *service.RequestMetaHeader) { +func (m *SetExtendedACLRequest) SetMetaHeader(v *session.RequestMetaHeader) { if m != nil { m.MetaHeader = v } } // SetVerifyHeader sets verification header of the request. -func (m *SetExtendedACLRequest) SetVerifyHeader(v *service.RequestVerificationHeader) { +func (m *SetExtendedACLRequest) SetVerifyHeader(v *session.RequestVerificationHeader) { if m != nil { m.VerifyHeader = v } @@ -278,14 +278,14 @@ func (m *SetExtendedACLResponse) SetBody(v *SetExtendedACLResponse_Body) { } // SetMetaHeader sets meta header of the response. -func (m *SetExtendedACLResponse) SetMetaHeader(v *service.ResponseMetaHeader) { +func (m *SetExtendedACLResponse) SetMetaHeader(v *session.ResponseMetaHeader) { if m != nil { m.MetaHeader = v } } // SetVerifyHeader sets verification header of the response. -func (m *SetExtendedACLResponse) SetVerifyHeader(v *service.ResponseVerificationHeader) { +func (m *SetExtendedACLResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) { if m != nil { m.VerifyHeader = v } @@ -306,14 +306,14 @@ func (m *GetExtendedACLRequest) SetBody(v *GetExtendedACLRequest_Body) { } // SetMetaHeader sets meta header of the request. -func (m *GetExtendedACLRequest) SetMetaHeader(v *service.RequestMetaHeader) { +func (m *GetExtendedACLRequest) SetMetaHeader(v *session.RequestMetaHeader) { if m != nil { m.MetaHeader = v } } // SetVerifyHeader sets verification header of the request. -func (m *GetExtendedACLRequest) SetVerifyHeader(v *service.RequestVerificationHeader) { +func (m *GetExtendedACLRequest) SetVerifyHeader(v *session.RequestVerificationHeader) { if m != nil { m.VerifyHeader = v } @@ -341,14 +341,14 @@ func (m *GetExtendedACLResponse) SetBody(v *GetExtendedACLResponse_Body) { } // SetMetaHeader sets meta header of the response. -func (m *GetExtendedACLResponse) SetMetaHeader(v *service.ResponseMetaHeader) { +func (m *GetExtendedACLResponse) SetMetaHeader(v *session.ResponseMetaHeader) { if m != nil { m.MetaHeader = v } } // SetVerifyHeader sets verification header of the response. -func (m *GetExtendedACLResponse) SetVerifyHeader(v *service.ResponseVerificationHeader) { +func (m *GetExtendedACLResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) { if m != nil { m.VerifyHeader = v } diff --git a/v2/container/types.go b/v2/container/types.go index 79d97c4..ae4a3c1 100644 --- a/v2/container/types.go +++ b/v2/container/types.go @@ -4,7 +4,7 @@ import ( "github.com/nspcc-dev/neofs-api-go/v2/acl" "github.com/nspcc-dev/neofs-api-go/v2/netmap" "github.com/nspcc-dev/neofs-api-go/v2/refs" - "github.com/nspcc-dev/neofs-api-go/v2/service" + "github.com/nspcc-dev/neofs-api-go/v2/session" ) type Attribute struct { @@ -34,9 +34,9 @@ type PutRequestBody struct { type PutRequest struct { body *PutRequestBody - metaHeader *service.RequestMetaHeader + metaHeader *session.RequestMetaHeader - verifyHeader *service.RequestVerificationHeader + verifyHeader *session.RequestVerificationHeader } type PutResponseBody struct { @@ -46,9 +46,9 @@ type PutResponseBody struct { type PutResponse struct { body *PutResponseBody - metaHeader *service.ResponseMetaHeader + metaHeader *session.ResponseMetaHeader - verifyHeader *service.ResponseVerificationHeader + verifyHeader *session.ResponseVerificationHeader } type GetRequestBody struct { @@ -58,9 +58,9 @@ type GetRequestBody struct { type GetRequest struct { body *GetRequestBody - metaHeader *service.RequestMetaHeader + metaHeader *session.RequestMetaHeader - verifyHeader *service.RequestVerificationHeader + verifyHeader *session.RequestVerificationHeader } type GetResponseBody struct { @@ -70,9 +70,9 @@ type GetResponseBody struct { type GetResponse struct { body *GetResponseBody - metaHeader *service.ResponseMetaHeader + metaHeader *session.ResponseMetaHeader - verifyHeader *service.ResponseVerificationHeader + verifyHeader *session.ResponseVerificationHeader } type DeleteRequestBody struct { @@ -84,9 +84,9 @@ type DeleteRequestBody struct { type DeleteRequest struct { body *DeleteRequestBody - metaHeader *service.RequestMetaHeader + metaHeader *session.RequestMetaHeader - verifyHeader *service.RequestVerificationHeader + verifyHeader *session.RequestVerificationHeader } type DeleteResponseBody struct{} @@ -94,9 +94,9 @@ type DeleteResponseBody struct{} type DeleteResponse struct { body *DeleteResponseBody - metaHeader *service.ResponseMetaHeader + metaHeader *session.ResponseMetaHeader - verifyHeader *service.ResponseVerificationHeader + verifyHeader *session.ResponseVerificationHeader } type ListRequestBody struct { @@ -106,9 +106,9 @@ type ListRequestBody struct { type ListRequest struct { body *ListRequestBody - metaHeader *service.RequestMetaHeader + metaHeader *session.RequestMetaHeader - verifyHeader *service.RequestVerificationHeader + verifyHeader *session.RequestVerificationHeader } type ListResponseBody struct { @@ -118,9 +118,9 @@ type ListResponseBody struct { type ListResponse struct { body *ListResponseBody - metaHeader *service.ResponseMetaHeader + metaHeader *session.ResponseMetaHeader - verifyHeader *service.ResponseVerificationHeader + verifyHeader *session.ResponseVerificationHeader } type SetExtendedACLRequestBody struct { @@ -132,9 +132,9 @@ type SetExtendedACLRequestBody struct { type SetExtendedACLRequest struct { body *SetExtendedACLRequestBody - metaHeader *service.RequestMetaHeader + metaHeader *session.RequestMetaHeader - verifyHeader *service.RequestVerificationHeader + verifyHeader *session.RequestVerificationHeader } type SetExtendedACLResponseBody struct{} @@ -142,9 +142,9 @@ type SetExtendedACLResponseBody struct{} type SetExtendedACLResponse struct { body *SetExtendedACLResponseBody - metaHeader *service.ResponseMetaHeader + metaHeader *session.ResponseMetaHeader - verifyHeader *service.ResponseVerificationHeader + verifyHeader *session.ResponseVerificationHeader } type GetExtendedACLRequestBody struct { @@ -154,9 +154,9 @@ type GetExtendedACLRequestBody struct { type GetExtendedACLRequest struct { body *GetExtendedACLRequestBody - metaHeader *service.RequestMetaHeader + metaHeader *session.RequestMetaHeader - verifyHeader *service.RequestVerificationHeader + verifyHeader *session.RequestVerificationHeader } type GetExtendedACLResponseBody struct { @@ -168,9 +168,9 @@ type GetExtendedACLResponseBody struct { type GetExtendedACLResponse struct { body *GetExtendedACLResponseBody - metaHeader *service.ResponseMetaHeader + metaHeader *session.ResponseMetaHeader - verifyHeader *service.ResponseVerificationHeader + verifyHeader *session.ResponseVerificationHeader } func (a *Attribute) GetKey() string { @@ -327,7 +327,7 @@ func (r *PutRequest) SetBody(v *PutRequestBody) { } } -func (r *PutRequest) GetMetaHeader() *service.RequestMetaHeader { +func (r *PutRequest) GetMetaHeader() *session.RequestMetaHeader { if r != nil { return r.metaHeader } @@ -335,13 +335,13 @@ func (r *PutRequest) GetMetaHeader() *service.RequestMetaHeader { return nil } -func (r *PutRequest) SetMetaHeader(v *service.RequestMetaHeader) { +func (r *PutRequest) SetMetaHeader(v *session.RequestMetaHeader) { if r != nil { r.metaHeader = v } } -func (r *PutRequest) GetVerificationHeader() *service.RequestVerificationHeader { +func (r *PutRequest) GetVerificationHeader() *session.RequestVerificationHeader { if r != nil { return r.verifyHeader } @@ -349,7 +349,7 @@ func (r *PutRequest) GetVerificationHeader() *service.RequestVerificationHeader return nil } -func (r *PutRequest) SetVerificationHeader(v *service.RequestVerificationHeader) { +func (r *PutRequest) SetVerificationHeader(v *session.RequestVerificationHeader) { if r != nil { r.verifyHeader = v } @@ -383,7 +383,7 @@ func (r *PutResponse) SetBody(v *PutResponseBody) { } } -func (r *PutResponse) GetMetaHeader() *service.ResponseMetaHeader { +func (r *PutResponse) GetMetaHeader() *session.ResponseMetaHeader { if r != nil { return r.metaHeader } @@ -391,13 +391,13 @@ func (r *PutResponse) GetMetaHeader() *service.ResponseMetaHeader { return nil } -func (r *PutResponse) SetMetaHeader(v *service.ResponseMetaHeader) { +func (r *PutResponse) SetMetaHeader(v *session.ResponseMetaHeader) { if r != nil { r.metaHeader = v } } -func (r *PutResponse) GetVerificationHeader() *service.ResponseVerificationHeader { +func (r *PutResponse) GetVerificationHeader() *session.ResponseVerificationHeader { if r != nil { return r.verifyHeader } @@ -405,7 +405,7 @@ func (r *PutResponse) GetVerificationHeader() *service.ResponseVerificationHeade return nil } -func (r *PutResponse) SetVerificationHeader(v *service.ResponseVerificationHeader) { +func (r *PutResponse) SetVerificationHeader(v *session.ResponseVerificationHeader) { if r != nil { r.verifyHeader = v } @@ -439,7 +439,7 @@ func (r *GetRequest) SetBody(v *GetRequestBody) { } } -func (r *GetRequest) GetMetaHeader() *service.RequestMetaHeader { +func (r *GetRequest) GetMetaHeader() *session.RequestMetaHeader { if r != nil { return r.metaHeader } @@ -447,13 +447,13 @@ func (r *GetRequest) GetMetaHeader() *service.RequestMetaHeader { return nil } -func (r *GetRequest) SetMetaHeader(v *service.RequestMetaHeader) { +func (r *GetRequest) SetMetaHeader(v *session.RequestMetaHeader) { if r != nil { r.metaHeader = v } } -func (r *GetRequest) GetVerificationHeader() *service.RequestVerificationHeader { +func (r *GetRequest) GetVerificationHeader() *session.RequestVerificationHeader { if r != nil { return r.verifyHeader } @@ -461,7 +461,7 @@ func (r *GetRequest) GetVerificationHeader() *service.RequestVerificationHeader return nil } -func (r *GetRequest) SetVerificationHeader(v *service.RequestVerificationHeader) { +func (r *GetRequest) SetVerificationHeader(v *session.RequestVerificationHeader) { if r != nil { r.verifyHeader = v } @@ -495,7 +495,7 @@ func (r *GetResponse) SetBody(v *GetResponseBody) { } } -func (r *GetResponse) GetMetaHeader() *service.ResponseMetaHeader { +func (r *GetResponse) GetMetaHeader() *session.ResponseMetaHeader { if r != nil { return r.metaHeader } @@ -503,13 +503,13 @@ func (r *GetResponse) GetMetaHeader() *service.ResponseMetaHeader { return nil } -func (r *GetResponse) SetMetaHeader(v *service.ResponseMetaHeader) { +func (r *GetResponse) SetMetaHeader(v *session.ResponseMetaHeader) { if r != nil { r.metaHeader = v } } -func (r *GetResponse) GetVerificationHeader() *service.ResponseVerificationHeader { +func (r *GetResponse) GetVerificationHeader() *session.ResponseVerificationHeader { if r != nil { return r.verifyHeader } @@ -517,7 +517,7 @@ func (r *GetResponse) GetVerificationHeader() *service.ResponseVerificationHeade return nil } -func (r *GetResponse) SetVerificationHeader(v *service.ResponseVerificationHeader) { +func (r *GetResponse) SetVerificationHeader(v *session.ResponseVerificationHeader) { if r != nil { r.verifyHeader = v } @@ -565,7 +565,7 @@ func (r *DeleteRequest) SetBody(v *DeleteRequestBody) { } } -func (r *DeleteRequest) GetMetaHeader() *service.RequestMetaHeader { +func (r *DeleteRequest) GetMetaHeader() *session.RequestMetaHeader { if r != nil { return r.metaHeader } @@ -573,13 +573,13 @@ func (r *DeleteRequest) GetMetaHeader() *service.RequestMetaHeader { return nil } -func (r *DeleteRequest) SetMetaHeader(v *service.RequestMetaHeader) { +func (r *DeleteRequest) SetMetaHeader(v *session.RequestMetaHeader) { if r != nil { r.metaHeader = v } } -func (r *DeleteRequest) GetVerificationHeader() *service.RequestVerificationHeader { +func (r *DeleteRequest) GetVerificationHeader() *session.RequestVerificationHeader { if r != nil { return r.verifyHeader } @@ -587,7 +587,7 @@ func (r *DeleteRequest) GetVerificationHeader() *service.RequestVerificationHead return nil } -func (r *DeleteRequest) SetVerificationHeader(v *service.RequestVerificationHeader) { +func (r *DeleteRequest) SetVerificationHeader(v *session.RequestVerificationHeader) { if r != nil { r.verifyHeader = v } @@ -607,7 +607,7 @@ func (r *DeleteResponse) SetBody(v *DeleteResponseBody) { } } -func (r *DeleteResponse) GetMetaHeader() *service.ResponseMetaHeader { +func (r *DeleteResponse) GetMetaHeader() *session.ResponseMetaHeader { if r != nil { return r.metaHeader } @@ -615,13 +615,13 @@ func (r *DeleteResponse) GetMetaHeader() *service.ResponseMetaHeader { return nil } -func (r *DeleteResponse) SetMetaHeader(v *service.ResponseMetaHeader) { +func (r *DeleteResponse) SetMetaHeader(v *session.ResponseMetaHeader) { if r != nil { r.metaHeader = v } } -func (r *DeleteResponse) GetVerificationHeader() *service.ResponseVerificationHeader { +func (r *DeleteResponse) GetVerificationHeader() *session.ResponseVerificationHeader { if r != nil { return r.verifyHeader } @@ -629,7 +629,7 @@ func (r *DeleteResponse) GetVerificationHeader() *service.ResponseVerificationHe return nil } -func (r *DeleteResponse) SetVerificationHeader(v *service.ResponseVerificationHeader) { +func (r *DeleteResponse) SetVerificationHeader(v *session.ResponseVerificationHeader) { if r != nil { r.verifyHeader = v } @@ -663,7 +663,7 @@ func (r *ListRequest) SetBody(v *ListRequestBody) { } } -func (r *ListRequest) GetMetaHeader() *service.RequestMetaHeader { +func (r *ListRequest) GetMetaHeader() *session.RequestMetaHeader { if r != nil { return r.metaHeader } @@ -671,13 +671,13 @@ func (r *ListRequest) GetMetaHeader() *service.RequestMetaHeader { return nil } -func (r *ListRequest) SetMetaHeader(v *service.RequestMetaHeader) { +func (r *ListRequest) SetMetaHeader(v *session.RequestMetaHeader) { if r != nil { r.metaHeader = v } } -func (r *ListRequest) GetVerificationHeader() *service.RequestVerificationHeader { +func (r *ListRequest) GetVerificationHeader() *session.RequestVerificationHeader { if r != nil { return r.verifyHeader } @@ -685,7 +685,7 @@ func (r *ListRequest) GetVerificationHeader() *service.RequestVerificationHeader return nil } -func (r *ListRequest) SetVerificationHeader(v *service.RequestVerificationHeader) { +func (r *ListRequest) SetVerificationHeader(v *session.RequestVerificationHeader) { if r != nil { r.verifyHeader = v } @@ -719,7 +719,7 @@ func (r *ListResponse) SetBody(v *ListResponseBody) { } } -func (r *ListResponse) GetMetaHeader() *service.ResponseMetaHeader { +func (r *ListResponse) GetMetaHeader() *session.ResponseMetaHeader { if r != nil { return r.metaHeader } @@ -727,13 +727,13 @@ func (r *ListResponse) GetMetaHeader() *service.ResponseMetaHeader { return nil } -func (r *ListResponse) SetMetaHeader(v *service.ResponseMetaHeader) { +func (r *ListResponse) SetMetaHeader(v *session.ResponseMetaHeader) { if r != nil { r.metaHeader = v } } -func (r *ListResponse) GetVerificationHeader() *service.ResponseVerificationHeader { +func (r *ListResponse) GetVerificationHeader() *session.ResponseVerificationHeader { if r != nil { return r.verifyHeader } @@ -741,7 +741,7 @@ func (r *ListResponse) GetVerificationHeader() *service.ResponseVerificationHead return nil } -func (r *ListResponse) SetVerificationHeader(v *service.ResponseVerificationHeader) { +func (r *ListResponse) SetVerificationHeader(v *session.ResponseVerificationHeader) { if r != nil { r.verifyHeader = v } @@ -789,7 +789,7 @@ func (r *SetExtendedACLRequest) SetBody(v *SetExtendedACLRequestBody) { } } -func (r *SetExtendedACLRequest) GetMetaHeader() *service.RequestMetaHeader { +func (r *SetExtendedACLRequest) GetMetaHeader() *session.RequestMetaHeader { if r != nil { return r.metaHeader } @@ -797,13 +797,13 @@ func (r *SetExtendedACLRequest) GetMetaHeader() *service.RequestMetaHeader { return nil } -func (r *SetExtendedACLRequest) SetMetaHeader(v *service.RequestMetaHeader) { +func (r *SetExtendedACLRequest) SetMetaHeader(v *session.RequestMetaHeader) { if r != nil { r.metaHeader = v } } -func (r *SetExtendedACLRequest) GetVerificationHeader() *service.RequestVerificationHeader { +func (r *SetExtendedACLRequest) GetVerificationHeader() *session.RequestVerificationHeader { if r != nil { return r.verifyHeader } @@ -811,7 +811,7 @@ func (r *SetExtendedACLRequest) GetVerificationHeader() *service.RequestVerifica return nil } -func (r *SetExtendedACLRequest) SetVerificationHeader(v *service.RequestVerificationHeader) { +func (r *SetExtendedACLRequest) SetVerificationHeader(v *session.RequestVerificationHeader) { if r != nil { r.verifyHeader = v } @@ -831,7 +831,7 @@ func (r *SetExtendedACLResponse) SetBody(v *SetExtendedACLResponseBody) { } } -func (r *SetExtendedACLResponse) GetMetaHeader() *service.ResponseMetaHeader { +func (r *SetExtendedACLResponse) GetMetaHeader() *session.ResponseMetaHeader { if r != nil { return r.metaHeader } @@ -839,13 +839,13 @@ func (r *SetExtendedACLResponse) GetMetaHeader() *service.ResponseMetaHeader { return nil } -func (r *SetExtendedACLResponse) SetMetaHeader(v *service.ResponseMetaHeader) { +func (r *SetExtendedACLResponse) SetMetaHeader(v *session.ResponseMetaHeader) { if r != nil { r.metaHeader = v } } -func (r *SetExtendedACLResponse) GetVerificationHeader() *service.ResponseVerificationHeader { +func (r *SetExtendedACLResponse) GetVerificationHeader() *session.ResponseVerificationHeader { if r != nil { return r.verifyHeader } @@ -853,7 +853,7 @@ func (r *SetExtendedACLResponse) GetVerificationHeader() *service.ResponseVerifi return nil } -func (r *SetExtendedACLResponse) SetVerificationHeader(v *service.ResponseVerificationHeader) { +func (r *SetExtendedACLResponse) SetVerificationHeader(v *session.ResponseVerificationHeader) { if r != nil { r.verifyHeader = v } @@ -887,7 +887,7 @@ func (r *GetExtendedACLRequest) SetBody(v *GetExtendedACLRequestBody) { } } -func (r *GetExtendedACLRequest) GetMetaHeader() *service.RequestMetaHeader { +func (r *GetExtendedACLRequest) GetMetaHeader() *session.RequestMetaHeader { if r != nil { return r.metaHeader } @@ -895,13 +895,13 @@ func (r *GetExtendedACLRequest) GetMetaHeader() *service.RequestMetaHeader { return nil } -func (r *GetExtendedACLRequest) SetMetaHeader(v *service.RequestMetaHeader) { +func (r *GetExtendedACLRequest) SetMetaHeader(v *session.RequestMetaHeader) { if r != nil { r.metaHeader = v } } -func (r *GetExtendedACLRequest) GetVerificationHeader() *service.RequestVerificationHeader { +func (r *GetExtendedACLRequest) GetVerificationHeader() *session.RequestVerificationHeader { if r != nil { return r.verifyHeader } @@ -909,7 +909,7 @@ func (r *GetExtendedACLRequest) GetVerificationHeader() *service.RequestVerifica return nil } -func (r *GetExtendedACLRequest) SetVerificationHeader(v *service.RequestVerificationHeader) { +func (r *GetExtendedACLRequest) SetVerificationHeader(v *session.RequestVerificationHeader) { if r != nil { r.verifyHeader = v } @@ -957,7 +957,7 @@ func (r *GetExtendedACLResponse) SetBody(v *GetExtendedACLResponseBody) { } } -func (r *GetExtendedACLResponse) GetMetaHeader() *service.ResponseMetaHeader { +func (r *GetExtendedACLResponse) GetMetaHeader() *session.ResponseMetaHeader { if r != nil { return r.metaHeader } @@ -965,13 +965,13 @@ func (r *GetExtendedACLResponse) GetMetaHeader() *service.ResponseMetaHeader { return nil } -func (r *GetExtendedACLResponse) SetMetaHeader(v *service.ResponseMetaHeader) { +func (r *GetExtendedACLResponse) SetMetaHeader(v *session.ResponseMetaHeader) { if r != nil { r.metaHeader = v } } -func (r *GetExtendedACLResponse) GetVerificationHeader() *service.ResponseVerificationHeader { +func (r *GetExtendedACLResponse) GetVerificationHeader() *session.ResponseVerificationHeader { if r != nil { return r.verifyHeader } @@ -979,7 +979,7 @@ func (r *GetExtendedACLResponse) GetVerificationHeader() *service.ResponseVerifi return nil } -func (r *GetExtendedACLResponse) SetVerificationHeader(v *service.ResponseVerificationHeader) { +func (r *GetExtendedACLResponse) SetVerificationHeader(v *session.ResponseVerificationHeader) { if r != nil { r.verifyHeader = v } diff --git a/v2/object/convert.go b/v2/object/convert.go index 949bb13..7beb640 100644 --- a/v2/object/convert.go +++ b/v2/object/convert.go @@ -6,7 +6,7 @@ import ( object "github.com/nspcc-dev/neofs-api-go/v2/object/grpc" "github.com/nspcc-dev/neofs-api-go/v2/refs" refsGRPC "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" - "github.com/nspcc-dev/neofs-api-go/v2/service" + "github.com/nspcc-dev/neofs-api-go/v2/session" ) func TypeToGRPCField(t Type) object.ObjectType { @@ -209,7 +209,7 @@ func HeaderToGRPCMessage(h *Header) *object.Header { ) m.SetSessionToken( - service.SessionTokenToGRPCMessage(h.GetSessionToken()), + session.SessionTokenToGRPCMessage(h.GetSessionToken()), ) attr := h.GetAttributes() @@ -264,7 +264,7 @@ func HeaderFromGRPCMessage(m *object.Header) *Header { ) h.SetSessionToken( - service.SessionTokenFromGRPCMessage(m.GetSessionToken()), + session.SessionTokenFromGRPCMessage(m.GetSessionToken()), ) attrMsg := m.GetAttributes() @@ -374,7 +374,7 @@ func GetRequestToGRPCMessage(r *GetRequest) *object.GetRequest { GetRequestBodyToGRPCMessage(r.GetBody()), ) - service.RequestHeadersToGRPC(r, m) + session.RequestHeadersToGRPC(r, m) return m } @@ -390,7 +390,7 @@ func GetRequestFromGRPCMessage(m *object.GetRequest) *GetRequest { GetRequestBodyFromGRPCMessage(m.GetBody()), ) - service.RequestHeadersFromGRPC(m, r) + session.RequestHeadersFromGRPC(m, r) return r } @@ -522,7 +522,7 @@ func GetResponseToGRPCMessage(r *GetResponse) *object.GetResponse { GetResponseBodyToGRPCMessage(r.GetBody()), ) - service.ResponseHeadersToGRPC(r, m) + session.ResponseHeadersToGRPC(r, m) return m } @@ -538,7 +538,7 @@ func GetResponseFromGRPCMessage(m *object.GetResponse) *GetResponse { GetResponseBodyFromGRPCMessage(m.GetBody()), ) - service.ResponseHeadersFromGRPC(m, r) + session.ResponseHeadersFromGRPC(m, r) return r } @@ -674,7 +674,7 @@ func PutRequestToGRPCMessage(r *PutRequest) *object.PutRequest { PutRequestBodyToGRPCMessage(r.GetBody()), ) - service.RequestHeadersToGRPC(r, m) + session.RequestHeadersToGRPC(r, m) return m } @@ -690,7 +690,7 @@ func PutRequestFromGRPCMessage(m *object.PutRequest) *PutRequest { PutRequestBodyFromGRPCMessage(m.GetBody()), ) - service.RequestHeadersFromGRPC(m, r) + session.RequestHeadersFromGRPC(m, r) return r } @@ -734,7 +734,7 @@ func PutResponseToGRPCMessage(r *PutResponse) *object.PutResponse { PutResponseBodyToGRPCMessage(r.GetBody()), ) - service.ResponseHeadersToGRPC(r, m) + session.ResponseHeadersToGRPC(r, m) return m } @@ -750,7 +750,7 @@ func PutResponseFromGRPCMessage(m *object.PutResponse) *PutResponse { PutResponseBodyFromGRPCMessage(m.GetBody()), ) - service.ResponseHeadersFromGRPC(m, r) + session.ResponseHeadersFromGRPC(m, r) return r } @@ -794,7 +794,7 @@ func DeleteRequestToGRPCMessage(r *DeleteRequest) *object.DeleteRequest { DeleteRequestBodyToGRPCMessage(r.GetBody()), ) - service.RequestHeadersToGRPC(r, m) + session.RequestHeadersToGRPC(r, m) return m } @@ -810,7 +810,7 @@ func DeleteRequestFromGRPCMessage(m *object.DeleteRequest) *DeleteRequest { DeleteRequestBodyFromGRPCMessage(m.GetBody()), ) - service.RequestHeadersFromGRPC(m, r) + session.RequestHeadersFromGRPC(m, r) return r } @@ -846,7 +846,7 @@ func DeleteResponseToGRPCMessage(r *DeleteResponse) *object.DeleteResponse { DeleteResponseBodyToGRPCMessage(r.GetBody()), ) - service.ResponseHeadersToGRPC(r, m) + session.ResponseHeadersToGRPC(r, m) return m } @@ -862,7 +862,7 @@ func DeleteResponseFromGRPCMessage(m *object.DeleteResponse) *DeleteResponse { DeleteResponseBodyFromGRPCMessage(m.GetBody()), ) - service.ResponseHeadersFromGRPC(m, r) + session.ResponseHeadersFromGRPC(m, r) return r } @@ -914,7 +914,7 @@ func HeadRequestToGRPCMessage(r *HeadRequest) *object.HeadRequest { HeadRequestBodyToGRPCMessage(r.GetBody()), ) - service.RequestHeadersToGRPC(r, m) + session.RequestHeadersToGRPC(r, m) return m } @@ -930,7 +930,7 @@ func HeadRequestFromGRPCMessage(m *object.HeadRequest) *HeadRequest { HeadRequestBodyFromGRPCMessage(m.GetBody()), ) - service.RequestHeadersFromGRPC(m, r) + session.RequestHeadersFromGRPC(m, r) return r } @@ -1050,7 +1050,7 @@ func HeadResponseToGRPCMessage(r *HeadResponse) *object.HeadResponse { HeadResponseBodyToGRPCMessage(r.GetBody()), ) - service.ResponseHeadersToGRPC(r, m) + session.ResponseHeadersToGRPC(r, m) return m } @@ -1066,7 +1066,7 @@ func HeadResponseFromGRPCMessage(m *object.HeadResponse) *HeadResponse { HeadResponseBodyFromGRPCMessage(m.GetBody()), ) - service.ResponseHeadersFromGRPC(m, r) + session.ResponseHeadersFromGRPC(m, r) return r } @@ -1168,7 +1168,7 @@ func SearchRequestToGRPCMessage(r *SearchRequest) *object.SearchRequest { SearchRequestBodyToGRPCMessage(r.GetBody()), ) - service.RequestHeadersToGRPC(r, m) + session.RequestHeadersToGRPC(r, m) return m } @@ -1184,7 +1184,7 @@ func SearchRequestFromGRPCMessage(m *object.SearchRequest) *SearchRequest { SearchRequestBodyFromGRPCMessage(m.GetBody()), ) - service.RequestHeadersFromGRPC(m, r) + session.RequestHeadersFromGRPC(m, r) return r } @@ -1238,7 +1238,7 @@ func SearchResponseToGRPCMessage(r *SearchResponse) *object.SearchResponse { SearchResponseBodyToGRPCMessage(r.GetBody()), ) - service.ResponseHeadersToGRPC(r, m) + session.ResponseHeadersToGRPC(r, m) return m } @@ -1254,7 +1254,7 @@ func SearchResponseFromGRPCMessage(m *object.SearchResponse) *SearchResponse { SearchResponseBodyFromGRPCMessage(m.GetBody()), ) - service.ResponseHeadersFromGRPC(m, r) + session.ResponseHeadersFromGRPC(m, r) return r } @@ -1332,7 +1332,7 @@ func GetRangeRequestToGRPCMessage(r *GetRangeRequest) *object.GetRangeRequest { GetRangeRequestBodyToGRPCMessage(r.GetBody()), ) - service.RequestHeadersToGRPC(r, m) + session.RequestHeadersToGRPC(r, m) return m } @@ -1348,7 +1348,7 @@ func GetRangeRequestFromGRPCMessage(m *object.GetRangeRequest) *GetRangeRequest GetRangeRequestBodyFromGRPCMessage(m.GetBody()), ) - service.RequestHeadersFromGRPC(m, r) + session.RequestHeadersFromGRPC(m, r) return r } @@ -1388,7 +1388,7 @@ func GetRangeResponseToGRPCMessage(r *GetRangeResponse) *object.GetRangeResponse GetRangeResponseBodyToGRPCMessage(r.GetBody()), ) - service.ResponseHeadersToGRPC(r, m) + session.ResponseHeadersToGRPC(r, m) return m } @@ -1404,7 +1404,7 @@ func GetRangeResponseFromGRPCMessage(m *object.GetRangeResponse) *GetRangeRespon GetRangeResponseBodyFromGRPCMessage(m.GetBody()), ) - service.ResponseHeadersFromGRPC(m, r) + session.ResponseHeadersFromGRPC(m, r) return r } @@ -1474,7 +1474,7 @@ func GetRangeHashRequestToGRPCMessage(r *GetRangeHashRequest) *object.GetRangeHa GetRangeHashRequestBodyToGRPCMessage(r.GetBody()), ) - service.RequestHeadersToGRPC(r, m) + session.RequestHeadersToGRPC(r, m) return m } @@ -1490,7 +1490,7 @@ func GetRangeHashRequestFromGRPCMessage(m *object.GetRangeHashRequest) *GetRange GetRangeHashRequestBodyFromGRPCMessage(m.GetBody()), ) - service.RequestHeadersFromGRPC(m, r) + session.RequestHeadersFromGRPC(m, r) return r } @@ -1534,7 +1534,7 @@ func GetRangeHashResponseToGRPCMessage(r *GetRangeHashResponse) *object.GetRange GetRangeHashResponseBodyToGRPCMessage(r.GetBody()), ) - service.ResponseHeadersToGRPC(r, m) + session.ResponseHeadersToGRPC(r, m) return m } @@ -1550,7 +1550,7 @@ func GetRangeHashResponseFromGRPCMessage(m *object.GetRangeHashResponse) *GetRan GetRangeHashResponseBodyFromGRPCMessage(m.GetBody()), ) - service.ResponseHeadersFromGRPC(m, r) + session.ResponseHeadersFromGRPC(m, r) return r } diff --git a/v2/object/grpc/service.go b/v2/object/grpc/service.go index 04cebfa..515d3e8 100644 --- a/v2/object/grpc/service.go +++ b/v2/object/grpc/service.go @@ -2,7 +2,7 @@ package object import ( refs "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" - service "github.com/nspcc-dev/neofs-api-go/v2/service/grpc" + session "github.com/nspcc-dev/neofs-api-go/v2/session/grpc" ) // SetAddress sets address of the requested object. @@ -27,14 +27,14 @@ func (m *GetRequest) SetBody(v *GetRequest_Body) { } // SetMetaHeader sets meta header of the request. -func (m *GetRequest) SetMetaHeader(v *service.RequestMetaHeader) { +func (m *GetRequest) SetMetaHeader(v *session.RequestMetaHeader) { if m != nil { m.MetaHeader = v } } // SetVerifyHeader sets verification header of the request. -func (m *GetRequest) SetVerifyHeader(v *service.RequestVerificationHeader) { +func (m *GetRequest) SetVerifyHeader(v *session.RequestVerificationHeader) { if m != nil { m.VerifyHeader = v } @@ -101,14 +101,14 @@ func (m *GetResponse) SetBody(v *GetResponse_Body) { } // SetMetaHeader sets meta header of the response. -func (m *GetResponse) SetMetaHeader(v *service.ResponseMetaHeader) { +func (m *GetResponse) SetMetaHeader(v *session.ResponseMetaHeader) { if m != nil { m.MetaHeader = v } } // SetVerifyHeader sets verification header of the response. -func (m *GetResponse) SetVerifyHeader(v *service.ResponseVerificationHeader) { +func (m *GetResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) { if m != nil { m.VerifyHeader = v } @@ -182,14 +182,14 @@ func (m *PutRequest) SetBody(v *PutRequest_Body) { } // SetMetaHeader sets meta header of the request. -func (m *PutRequest) SetMetaHeader(v *service.RequestMetaHeader) { +func (m *PutRequest) SetMetaHeader(v *session.RequestMetaHeader) { if m != nil { m.MetaHeader = v } } // SetVerifyHeader sets verification header of the request. -func (m *PutRequest) SetVerifyHeader(v *service.RequestVerificationHeader) { +func (m *PutRequest) SetVerifyHeader(v *session.RequestVerificationHeader) { if m != nil { m.VerifyHeader = v } @@ -210,14 +210,14 @@ func (m *PutResponse) SetBody(v *PutResponse_Body) { } // SetMetaHeader sets meta header of the response. -func (m *PutResponse) SetMetaHeader(v *service.ResponseMetaHeader) { +func (m *PutResponse) SetMetaHeader(v *session.ResponseMetaHeader) { if m != nil { m.MetaHeader = v } } // SetVerifyHeader sets verification header of the response. -func (m *PutResponse) SetVerifyHeader(v *service.ResponseVerificationHeader) { +func (m *PutResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) { if m != nil { m.VerifyHeader = v } @@ -238,14 +238,14 @@ func (m *DeleteRequest) SetBody(v *DeleteRequest_Body) { } // SetMetaHeader sets meta header of the request. -func (m *DeleteRequest) SetMetaHeader(v *service.RequestMetaHeader) { +func (m *DeleteRequest) SetMetaHeader(v *session.RequestMetaHeader) { if m != nil { m.MetaHeader = v } } // SetVerifyHeader sets verification header of the request. -func (m *DeleteRequest) SetVerifyHeader(v *service.RequestVerificationHeader) { +func (m *DeleteRequest) SetVerifyHeader(v *session.RequestVerificationHeader) { if m != nil { m.VerifyHeader = v } @@ -259,14 +259,14 @@ func (m *DeleteResponse) SetBody(v *DeleteResponse_Body) { } // SetMetaHeader sets meta header of the response. -func (m *DeleteResponse) SetMetaHeader(v *service.ResponseMetaHeader) { +func (m *DeleteResponse) SetMetaHeader(v *session.ResponseMetaHeader) { if m != nil { m.MetaHeader = v } } // SetVerifyHeader sets verification header of the response. -func (m *DeleteResponse) SetVerifyHeader(v *service.ResponseVerificationHeader) { +func (m *DeleteResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) { if m != nil { m.VerifyHeader = v } @@ -301,14 +301,14 @@ func (m *HeadRequest) SetBody(v *HeadRequest_Body) { } // SetMetaHeader sets meta header of the request. -func (m *HeadRequest) SetMetaHeader(v *service.RequestMetaHeader) { +func (m *HeadRequest) SetMetaHeader(v *session.RequestMetaHeader) { if m != nil { m.MetaHeader = v } } // SetVerifyHeader sets verification header of the request. -func (m *HeadRequest) SetVerifyHeader(v *service.RequestVerificationHeader) { +func (m *HeadRequest) SetVerifyHeader(v *session.RequestVerificationHeader) { if m != nil { m.VerifyHeader = v } @@ -368,14 +368,14 @@ func (m *HeadResponse) SetBody(v *HeadResponse_Body) { } // SetMetaHeader sets meta header of the response. -func (m *HeadResponse) SetMetaHeader(v *service.ResponseMetaHeader) { +func (m *HeadResponse) SetMetaHeader(v *session.ResponseMetaHeader) { if m != nil { m.MetaHeader = v } } // SetVerifyHeader sets verification header of the response. -func (m *HeadResponse) SetVerifyHeader(v *service.ResponseVerificationHeader) { +func (m *HeadResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) { if m != nil { m.VerifyHeader = v } @@ -431,14 +431,14 @@ func (m *SearchRequest) SetBody(v *SearchRequest_Body) { } // SetMetaHeader sets meta header of the request. -func (m *SearchRequest) SetMetaHeader(v *service.RequestMetaHeader) { +func (m *SearchRequest) SetMetaHeader(v *session.RequestMetaHeader) { if m != nil { m.MetaHeader = v } } // SetVerifyHeader sets verification header of the request. -func (m *SearchRequest) SetVerifyHeader(v *service.RequestVerificationHeader) { +func (m *SearchRequest) SetVerifyHeader(v *session.RequestVerificationHeader) { if m != nil { m.VerifyHeader = v } @@ -459,14 +459,14 @@ func (m *SearchResponse) SetBody(v *SearchResponse_Body) { } // SetMetaHeader sets meta header of the response. -func (m *SearchResponse) SetMetaHeader(v *service.ResponseMetaHeader) { +func (m *SearchResponse) SetMetaHeader(v *session.ResponseMetaHeader) { if m != nil { m.MetaHeader = v } } // SetVerifyHeader sets verification header of the response. -func (m *SearchResponse) SetVerifyHeader(v *service.ResponseVerificationHeader) { +func (m *SearchResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) { if m != nil { m.VerifyHeader = v } @@ -508,14 +508,14 @@ func (m *GetRangeRequest) SetBody(v *GetRangeRequest_Body) { } // SetMetaHeader sets meta header of the request. -func (m *GetRangeRequest) SetMetaHeader(v *service.RequestMetaHeader) { +func (m *GetRangeRequest) SetMetaHeader(v *session.RequestMetaHeader) { if m != nil { m.MetaHeader = v } } // SetVerifyHeader sets verification header of the request. -func (m *GetRangeRequest) SetVerifyHeader(v *service.RequestVerificationHeader) { +func (m *GetRangeRequest) SetVerifyHeader(v *session.RequestVerificationHeader) { if m != nil { m.VerifyHeader = v } @@ -536,14 +536,14 @@ func (m *GetRangeResponse) SetBody(v *GetRangeResponse_Body) { } // SetMetaHeader sets meta header of the response. -func (m *GetRangeResponse) SetMetaHeader(v *service.ResponseMetaHeader) { +func (m *GetRangeResponse) SetMetaHeader(v *session.ResponseMetaHeader) { if m != nil { m.MetaHeader = v } } // SetVerifyHeader sets verification header of the response. -func (m *GetRangeResponse) SetVerifyHeader(v *service.ResponseVerificationHeader) { +func (m *GetRangeResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) { if m != nil { m.VerifyHeader = v } @@ -585,14 +585,14 @@ func (m *GetRangeHashRequest) SetBody(v *GetRangeHashRequest_Body) { } // SetMetaHeader sets meta header of the request. -func (m *GetRangeHashRequest) SetMetaHeader(v *service.RequestMetaHeader) { +func (m *GetRangeHashRequest) SetMetaHeader(v *session.RequestMetaHeader) { if m != nil { m.MetaHeader = v } } // SetVerifyHeader sets verification header of the request. -func (m *GetRangeHashRequest) SetVerifyHeader(v *service.RequestVerificationHeader) { +func (m *GetRangeHashRequest) SetVerifyHeader(v *session.RequestVerificationHeader) { if m != nil { m.VerifyHeader = v } @@ -620,14 +620,14 @@ func (m *GetRangeHashResponse) SetBody(v *GetRangeHashResponse_Body) { } // SetMetaHeader sets meta header of the response. -func (m *GetRangeHashResponse) SetMetaHeader(v *service.ResponseMetaHeader) { +func (m *GetRangeHashResponse) SetMetaHeader(v *session.ResponseMetaHeader) { if m != nil { m.MetaHeader = v } } // SetVerifyHeader sets verification header of the response. -func (m *GetRangeHashResponse) SetVerifyHeader(v *service.ResponseVerificationHeader) { +func (m *GetRangeHashResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) { if m != nil { m.VerifyHeader = v } diff --git a/v2/object/grpc/types.go b/v2/object/grpc/types.go index 24216ab..fa3ae76 100644 --- a/v2/object/grpc/types.go +++ b/v2/object/grpc/types.go @@ -2,7 +2,7 @@ package object import ( refs "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" - service "github.com/nspcc-dev/neofs-api-go/v2/service/grpc" + session "github.com/nspcc-dev/neofs-api-go/v2/session/grpc" ) // SetKey sets key to the object attribute. @@ -111,7 +111,7 @@ func (m *Header) SetHomomorphicHash(v *refs.Checksum) { } // SetSessionToken sets session token. -func (m *Header) SetSessionToken(v *service.SessionToken) { +func (m *Header) SetSessionToken(v *session.SessionToken) { if m != nil { m.SessionToken = v } diff --git a/v2/object/marshal_test.go b/v2/object/marshal_test.go index 02480bd..19ab6d5 100644 --- a/v2/object/marshal_test.go +++ b/v2/object/marshal_test.go @@ -7,7 +7,7 @@ import ( "github.com/nspcc-dev/neofs-api-go/v2/object" grpc "github.com/nspcc-dev/neofs-api-go/v2/object/grpc" "github.com/nspcc-dev/neofs-api-go/v2/refs" - "github.com/nspcc-dev/neofs-api-go/v2/service" + "github.com/nspcc-dev/neofs-api-go/v2/session" "github.com/stretchr/testify/require" ) @@ -405,24 +405,24 @@ func generateAddress(cid, oid string) *refs.Address { return addr } -func generateSessionToken(id string) *service.SessionToken { - lifetime := new(service.TokenLifetime) +func generateSessionToken(id string) *session.SessionToken { + lifetime := new(session.TokenLifetime) lifetime.SetExp(1) lifetime.SetNbf(2) lifetime.SetIat(3) - objectCtx := new(service.ObjectSessionContext) - objectCtx.SetVerb(service.ObjectVerbPut) + objectCtx := new(session.ObjectSessionContext) + objectCtx.SetVerb(session.ObjectVerbPut) objectCtx.SetAddress(generateAddress("Container ID", "Object ID")) - tokenBody := new(service.SessionTokenBody) + tokenBody := new(session.SessionTokenBody) tokenBody.SetID([]byte(id)) tokenBody.SetOwnerID(generateOwner("Owner ID")) tokenBody.SetSessionKey([]byte(id)) tokenBody.SetLifetime(lifetime) tokenBody.SetContext(objectCtx) - sessionToken := new(service.SessionToken) + sessionToken := new(session.SessionToken) sessionToken.SetBody(tokenBody) sessionToken.SetSignature(generateSignature("public key", id)) diff --git a/v2/object/types.go b/v2/object/types.go index 5f421fc..d1328f8 100644 --- a/v2/object/types.go +++ b/v2/object/types.go @@ -2,7 +2,7 @@ package object import ( "github.com/nspcc-dev/neofs-api-go/v2/refs" - "github.com/nspcc-dev/neofs-api-go/v2/service" + "github.com/nspcc-dev/neofs-api-go/v2/session" ) type Type uint32 @@ -50,7 +50,7 @@ type Header struct { typ Type - sessionToken *service.SessionToken + sessionToken *session.SessionToken attr []*Attribute @@ -76,9 +76,9 @@ type GetRequestBody struct { type GetRequest struct { body *GetRequestBody - metaHeader *service.RequestMetaHeader + metaHeader *session.RequestMetaHeader - verifyHeader *service.RequestVerificationHeader + verifyHeader *session.RequestVerificationHeader } type GetObjectPart interface { @@ -104,9 +104,9 @@ type GetResponseBody struct { type GetResponse struct { body *GetResponseBody - metaHeader *service.ResponseMetaHeader + metaHeader *session.ResponseMetaHeader - verifyHeader *service.ResponseVerificationHeader + verifyHeader *session.ResponseVerificationHeader } type PutObjectPart interface { @@ -134,9 +134,9 @@ type PutRequestBody struct { type PutRequest struct { body *PutRequestBody - metaHeader *service.RequestMetaHeader + metaHeader *session.RequestMetaHeader - verifyHeader *service.RequestVerificationHeader + verifyHeader *session.RequestVerificationHeader } type PutResponseBody struct { @@ -146,9 +146,9 @@ type PutResponseBody struct { type PutResponse struct { body *PutResponseBody - metaHeader *service.ResponseMetaHeader + metaHeader *session.ResponseMetaHeader - verifyHeader *service.ResponseVerificationHeader + verifyHeader *session.ResponseVerificationHeader } type DeleteRequestBody struct { @@ -158,9 +158,9 @@ type DeleteRequestBody struct { type DeleteRequest struct { body *DeleteRequestBody - metaHeader *service.RequestMetaHeader + metaHeader *session.RequestMetaHeader - verifyHeader *service.RequestVerificationHeader + verifyHeader *session.RequestVerificationHeader } type DeleteResponseBody struct{} @@ -168,9 +168,9 @@ type DeleteResponseBody struct{} type DeleteResponse struct { body *DeleteResponseBody - metaHeader *service.ResponseMetaHeader + metaHeader *session.ResponseMetaHeader - verifyHeader *service.ResponseVerificationHeader + verifyHeader *session.ResponseVerificationHeader } type HeadRequestBody struct { @@ -182,9 +182,9 @@ type HeadRequestBody struct { type HeadRequest struct { body *HeadRequestBody - metaHeader *service.RequestMetaHeader + metaHeader *session.RequestMetaHeader - verifyHeader *service.RequestVerificationHeader + verifyHeader *session.RequestVerificationHeader } type GetHeaderPart interface { @@ -206,9 +206,9 @@ type HeadResponseBody struct { type HeadResponse struct { body *HeadResponseBody - metaHeader *service.ResponseMetaHeader + metaHeader *session.ResponseMetaHeader - verifyHeader *service.ResponseVerificationHeader + verifyHeader *session.ResponseVerificationHeader } type SearchFilter struct { @@ -228,9 +228,9 @@ type SearchRequestBody struct { type SearchRequest struct { body *SearchRequestBody - metaHeader *service.RequestMetaHeader + metaHeader *session.RequestMetaHeader - verifyHeader *service.RequestVerificationHeader + verifyHeader *session.RequestVerificationHeader } type SearchResponseBody struct { @@ -240,9 +240,9 @@ type SearchResponseBody struct { type SearchResponse struct { body *SearchResponseBody - metaHeader *service.ResponseMetaHeader + metaHeader *session.ResponseMetaHeader - verifyHeader *service.ResponseVerificationHeader + verifyHeader *session.ResponseVerificationHeader } type Range struct { @@ -258,9 +258,9 @@ type GetRangeRequestBody struct { type GetRangeRequest struct { body *GetRangeRequestBody - metaHeader *service.RequestMetaHeader + metaHeader *session.RequestMetaHeader - verifyHeader *service.RequestVerificationHeader + verifyHeader *session.RequestVerificationHeader } type GetRangeResponseBody struct { @@ -270,9 +270,9 @@ type GetRangeResponseBody struct { type GetRangeResponse struct { body *GetRangeResponseBody - metaHeader *service.ResponseMetaHeader + metaHeader *session.ResponseMetaHeader - verifyHeader *service.ResponseVerificationHeader + verifyHeader *session.ResponseVerificationHeader } type GetRangeHashRequestBody struct { @@ -288,9 +288,9 @@ type GetRangeHashRequestBody struct { type GetRangeHashRequest struct { body *GetRangeHashRequestBody - metaHeader *service.RequestMetaHeader + metaHeader *session.RequestMetaHeader - verifyHeader *service.RequestVerificationHeader + verifyHeader *session.RequestVerificationHeader } type GetRangeHashResponseBody struct { @@ -302,9 +302,9 @@ type GetRangeHashResponseBody struct { type GetRangeHashResponse struct { body *GetRangeHashResponseBody - metaHeader *service.ResponseMetaHeader + metaHeader *session.ResponseMetaHeader - verifyHeader *service.ResponseVerificationHeader + verifyHeader *session.ResponseVerificationHeader } const ( @@ -598,7 +598,7 @@ func (h *Header) SetHomomorphicHash(v *refs.Checksum) { } } -func (h *Header) GetSessionToken() *service.SessionToken { +func (h *Header) GetSessionToken() *session.SessionToken { if h != nil { return h.sessionToken } @@ -606,7 +606,7 @@ func (h *Header) GetSessionToken() *service.SessionToken { return nil } -func (h *Header) SetSessionToken(v *service.SessionToken) { +func (h *Header) SetSessionToken(v *session.SessionToken) { if h != nil { h.sessionToken = v } @@ -738,7 +738,7 @@ func (r *GetRequest) SetBody(v *GetRequestBody) { } } -func (r *GetRequest) GetMetaHeader() *service.RequestMetaHeader { +func (r *GetRequest) GetMetaHeader() *session.RequestMetaHeader { if r != nil { return r.metaHeader } @@ -746,13 +746,13 @@ func (r *GetRequest) GetMetaHeader() *service.RequestMetaHeader { return nil } -func (r *GetRequest) SetMetaHeader(v *service.RequestMetaHeader) { +func (r *GetRequest) SetMetaHeader(v *session.RequestMetaHeader) { if r != nil { r.metaHeader = v } } -func (r *GetRequest) GetVerificationHeader() *service.RequestVerificationHeader { +func (r *GetRequest) GetVerificationHeader() *session.RequestVerificationHeader { if r != nil { return r.verifyHeader } @@ -760,7 +760,7 @@ func (r *GetRequest) GetVerificationHeader() *service.RequestVerificationHeader return nil } -func (r *GetRequest) SetVerificationHeader(v *service.RequestVerificationHeader) { +func (r *GetRequest) SetVerificationHeader(v *session.RequestVerificationHeader) { if r != nil { r.verifyHeader = v } @@ -854,7 +854,7 @@ func (r *GetResponse) SetBody(v *GetResponseBody) { } } -func (r *GetResponse) GetMetaHeader() *service.ResponseMetaHeader { +func (r *GetResponse) GetMetaHeader() *session.ResponseMetaHeader { if r != nil { return r.metaHeader } @@ -862,13 +862,13 @@ func (r *GetResponse) GetMetaHeader() *service.ResponseMetaHeader { return nil } -func (r *GetResponse) SetMetaHeader(v *service.ResponseMetaHeader) { +func (r *GetResponse) SetMetaHeader(v *session.ResponseMetaHeader) { if r != nil { r.metaHeader = v } } -func (r *GetResponse) GetVerificationHeader() *service.ResponseVerificationHeader { +func (r *GetResponse) GetVerificationHeader() *session.ResponseVerificationHeader { if r != nil { return r.verifyHeader } @@ -876,7 +876,7 @@ func (r *GetResponse) GetVerificationHeader() *service.ResponseVerificationHeade return nil } -func (r *GetResponse) SetVerificationHeader(v *service.ResponseVerificationHeader) { +func (r *GetResponse) SetVerificationHeader(v *session.ResponseVerificationHeader) { if r != nil { r.verifyHeader = v } @@ -984,7 +984,7 @@ func (r *PutRequest) SetBody(v *PutRequestBody) { } } -func (r *PutRequest) GetMetaHeader() *service.RequestMetaHeader { +func (r *PutRequest) GetMetaHeader() *session.RequestMetaHeader { if r != nil { return r.metaHeader } @@ -992,13 +992,13 @@ func (r *PutRequest) GetMetaHeader() *service.RequestMetaHeader { return nil } -func (r *PutRequest) SetMetaHeader(v *service.RequestMetaHeader) { +func (r *PutRequest) SetMetaHeader(v *session.RequestMetaHeader) { if r != nil { r.metaHeader = v } } -func (r *PutRequest) GetVerificationHeader() *service.RequestVerificationHeader { +func (r *PutRequest) GetVerificationHeader() *session.RequestVerificationHeader { if r != nil { return r.verifyHeader } @@ -1006,7 +1006,7 @@ func (r *PutRequest) GetVerificationHeader() *service.RequestVerificationHeader return nil } -func (r *PutRequest) SetVerificationHeader(v *service.RequestVerificationHeader) { +func (r *PutRequest) SetVerificationHeader(v *session.RequestVerificationHeader) { if r != nil { r.verifyHeader = v } @@ -1040,7 +1040,7 @@ func (r *PutResponse) SetBody(v *PutResponseBody) { } } -func (r *PutResponse) GetMetaHeader() *service.ResponseMetaHeader { +func (r *PutResponse) GetMetaHeader() *session.ResponseMetaHeader { if r != nil { return r.metaHeader } @@ -1048,13 +1048,13 @@ func (r *PutResponse) GetMetaHeader() *service.ResponseMetaHeader { return nil } -func (r *PutResponse) SetMetaHeader(v *service.ResponseMetaHeader) { +func (r *PutResponse) SetMetaHeader(v *session.ResponseMetaHeader) { if r != nil { r.metaHeader = v } } -func (r *PutResponse) GetVerificationHeader() *service.ResponseVerificationHeader { +func (r *PutResponse) GetVerificationHeader() *session.ResponseVerificationHeader { if r != nil { return r.verifyHeader } @@ -1062,7 +1062,7 @@ func (r *PutResponse) GetVerificationHeader() *service.ResponseVerificationHeade return nil } -func (r *PutResponse) SetVerificationHeader(v *service.ResponseVerificationHeader) { +func (r *PutResponse) SetVerificationHeader(v *session.ResponseVerificationHeader) { if r != nil { r.verifyHeader = v } @@ -1096,7 +1096,7 @@ func (r *DeleteRequest) SetBody(v *DeleteRequestBody) { } } -func (r *DeleteRequest) GetMetaHeader() *service.RequestMetaHeader { +func (r *DeleteRequest) GetMetaHeader() *session.RequestMetaHeader { if r != nil { return r.metaHeader } @@ -1104,13 +1104,13 @@ func (r *DeleteRequest) GetMetaHeader() *service.RequestMetaHeader { return nil } -func (r *DeleteRequest) SetMetaHeader(v *service.RequestMetaHeader) { +func (r *DeleteRequest) SetMetaHeader(v *session.RequestMetaHeader) { if r != nil { r.metaHeader = v } } -func (r *DeleteRequest) GetVerificationHeader() *service.RequestVerificationHeader { +func (r *DeleteRequest) GetVerificationHeader() *session.RequestVerificationHeader { if r != nil { return r.verifyHeader } @@ -1118,7 +1118,7 @@ func (r *DeleteRequest) GetVerificationHeader() *service.RequestVerificationHead return nil } -func (r *DeleteRequest) SetVerificationHeader(v *service.RequestVerificationHeader) { +func (r *DeleteRequest) SetVerificationHeader(v *session.RequestVerificationHeader) { if r != nil { r.verifyHeader = v } @@ -1138,7 +1138,7 @@ func (r *DeleteResponse) SetBody(v *DeleteResponseBody) { } } -func (r *DeleteResponse) GetMetaHeader() *service.ResponseMetaHeader { +func (r *DeleteResponse) GetMetaHeader() *session.ResponseMetaHeader { if r != nil { return r.metaHeader } @@ -1146,13 +1146,13 @@ func (r *DeleteResponse) GetMetaHeader() *service.ResponseMetaHeader { return nil } -func (r *DeleteResponse) SetMetaHeader(v *service.ResponseMetaHeader) { +func (r *DeleteResponse) SetMetaHeader(v *session.ResponseMetaHeader) { if r != nil { r.metaHeader = v } } -func (r *DeleteResponse) GetVerificationHeader() *service.ResponseVerificationHeader { +func (r *DeleteResponse) GetVerificationHeader() *session.ResponseVerificationHeader { if r != nil { return r.verifyHeader } @@ -1160,7 +1160,7 @@ func (r *DeleteResponse) GetVerificationHeader() *service.ResponseVerificationHe return nil } -func (r *DeleteResponse) SetVerificationHeader(v *service.ResponseVerificationHeader) { +func (r *DeleteResponse) SetVerificationHeader(v *session.ResponseVerificationHeader) { if r != nil { r.verifyHeader = v } @@ -1222,7 +1222,7 @@ func (r *HeadRequest) SetBody(v *HeadRequestBody) { } } -func (r *HeadRequest) GetMetaHeader() *service.RequestMetaHeader { +func (r *HeadRequest) GetMetaHeader() *session.RequestMetaHeader { if r != nil { return r.metaHeader } @@ -1230,13 +1230,13 @@ func (r *HeadRequest) GetMetaHeader() *service.RequestMetaHeader { return nil } -func (r *HeadRequest) SetMetaHeader(v *service.RequestMetaHeader) { +func (r *HeadRequest) SetMetaHeader(v *session.RequestMetaHeader) { if r != nil { r.metaHeader = v } } -func (r *HeadRequest) GetVerificationHeader() *service.RequestVerificationHeader { +func (r *HeadRequest) GetVerificationHeader() *session.RequestVerificationHeader { if r != nil { return r.verifyHeader } @@ -1244,7 +1244,7 @@ func (r *HeadRequest) GetVerificationHeader() *service.RequestVerificationHeader return nil } -func (r *HeadRequest) SetVerificationHeader(v *service.RequestVerificationHeader) { +func (r *HeadRequest) SetVerificationHeader(v *session.RequestVerificationHeader) { if r != nil { r.verifyHeader = v } @@ -1310,7 +1310,7 @@ func (r *HeadResponse) SetBody(v *HeadResponseBody) { } } -func (r *HeadResponse) GetMetaHeader() *service.ResponseMetaHeader { +func (r *HeadResponse) GetMetaHeader() *session.ResponseMetaHeader { if r != nil { return r.metaHeader } @@ -1318,13 +1318,13 @@ func (r *HeadResponse) GetMetaHeader() *service.ResponseMetaHeader { return nil } -func (r *HeadResponse) SetMetaHeader(v *service.ResponseMetaHeader) { +func (r *HeadResponse) SetMetaHeader(v *session.ResponseMetaHeader) { if r != nil { r.metaHeader = v } } -func (r *HeadResponse) GetVerificationHeader() *service.ResponseVerificationHeader { +func (r *HeadResponse) GetVerificationHeader() *session.ResponseVerificationHeader { if r != nil { return r.verifyHeader } @@ -1332,7 +1332,7 @@ func (r *HeadResponse) GetVerificationHeader() *service.ResponseVerificationHead return nil } -func (r *HeadResponse) SetVerificationHeader(v *service.ResponseVerificationHeader) { +func (r *HeadResponse) SetVerificationHeader(v *session.ResponseVerificationHeader) { if r != nil { r.verifyHeader = v } @@ -1436,7 +1436,7 @@ func (r *SearchRequest) SetBody(v *SearchRequestBody) { } } -func (r *SearchRequest) GetMetaHeader() *service.RequestMetaHeader { +func (r *SearchRequest) GetMetaHeader() *session.RequestMetaHeader { if r != nil { return r.metaHeader } @@ -1444,13 +1444,13 @@ func (r *SearchRequest) GetMetaHeader() *service.RequestMetaHeader { return nil } -func (r *SearchRequest) SetMetaHeader(v *service.RequestMetaHeader) { +func (r *SearchRequest) SetMetaHeader(v *session.RequestMetaHeader) { if r != nil { r.metaHeader = v } } -func (r *SearchRequest) GetVerificationHeader() *service.RequestVerificationHeader { +func (r *SearchRequest) GetVerificationHeader() *session.RequestVerificationHeader { if r != nil { return r.verifyHeader } @@ -1458,7 +1458,7 @@ func (r *SearchRequest) GetVerificationHeader() *service.RequestVerificationHead return nil } -func (r *SearchRequest) SetVerificationHeader(v *service.RequestVerificationHeader) { +func (r *SearchRequest) SetVerificationHeader(v *session.RequestVerificationHeader) { if r != nil { r.verifyHeader = v } @@ -1492,7 +1492,7 @@ func (r *SearchResponse) SetBody(v *SearchResponseBody) { } } -func (r *SearchResponse) GetMetaHeader() *service.ResponseMetaHeader { +func (r *SearchResponse) GetMetaHeader() *session.ResponseMetaHeader { if r != nil { return r.metaHeader } @@ -1500,13 +1500,13 @@ func (r *SearchResponse) GetMetaHeader() *service.ResponseMetaHeader { return nil } -func (r *SearchResponse) SetMetaHeader(v *service.ResponseMetaHeader) { +func (r *SearchResponse) SetMetaHeader(v *session.ResponseMetaHeader) { if r != nil { r.metaHeader = v } } -func (r *SearchResponse) GetVerificationHeader() *service.ResponseVerificationHeader { +func (r *SearchResponse) GetVerificationHeader() *session.ResponseVerificationHeader { if r != nil { return r.verifyHeader } @@ -1514,7 +1514,7 @@ func (r *SearchResponse) GetVerificationHeader() *service.ResponseVerificationHe return nil } -func (r *SearchResponse) SetVerificationHeader(v *service.ResponseVerificationHeader) { +func (r *SearchResponse) SetVerificationHeader(v *session.ResponseVerificationHeader) { if r != nil { r.verifyHeader = v } @@ -1590,7 +1590,7 @@ func (r *GetRangeRequest) SetBody(v *GetRangeRequestBody) { } } -func (r *GetRangeRequest) GetMetaHeader() *service.RequestMetaHeader { +func (r *GetRangeRequest) GetMetaHeader() *session.RequestMetaHeader { if r != nil { return r.metaHeader } @@ -1598,13 +1598,13 @@ func (r *GetRangeRequest) GetMetaHeader() *service.RequestMetaHeader { return nil } -func (r *GetRangeRequest) SetMetaHeader(v *service.RequestMetaHeader) { +func (r *GetRangeRequest) SetMetaHeader(v *session.RequestMetaHeader) { if r != nil { r.metaHeader = v } } -func (r *GetRangeRequest) GetVerificationHeader() *service.RequestVerificationHeader { +func (r *GetRangeRequest) GetVerificationHeader() *session.RequestVerificationHeader { if r != nil { return r.verifyHeader } @@ -1612,7 +1612,7 @@ func (r *GetRangeRequest) GetVerificationHeader() *service.RequestVerificationHe return nil } -func (r *GetRangeRequest) SetVerificationHeader(v *service.RequestVerificationHeader) { +func (r *GetRangeRequest) SetVerificationHeader(v *session.RequestVerificationHeader) { if r != nil { r.verifyHeader = v } @@ -1646,7 +1646,7 @@ func (r *GetRangeResponse) SetBody(v *GetRangeResponseBody) { } } -func (r *GetRangeResponse) GetMetaHeader() *service.ResponseMetaHeader { +func (r *GetRangeResponse) GetMetaHeader() *session.ResponseMetaHeader { if r != nil { return r.metaHeader } @@ -1654,13 +1654,13 @@ func (r *GetRangeResponse) GetMetaHeader() *service.ResponseMetaHeader { return nil } -func (r *GetRangeResponse) SetMetaHeader(v *service.ResponseMetaHeader) { +func (r *GetRangeResponse) SetMetaHeader(v *session.ResponseMetaHeader) { if r != nil { r.metaHeader = v } } -func (r *GetRangeResponse) GetVerificationHeader() *service.ResponseVerificationHeader { +func (r *GetRangeResponse) GetVerificationHeader() *session.ResponseVerificationHeader { if r != nil { return r.verifyHeader } @@ -1668,7 +1668,7 @@ func (r *GetRangeResponse) GetVerificationHeader() *service.ResponseVerification return nil } -func (r *GetRangeResponse) SetVerificationHeader(v *service.ResponseVerificationHeader) { +func (r *GetRangeResponse) SetVerificationHeader(v *session.ResponseVerificationHeader) { if r != nil { r.verifyHeader = v } @@ -1744,7 +1744,7 @@ func (r *GetRangeHashRequest) SetBody(v *GetRangeHashRequestBody) { } } -func (r *GetRangeHashRequest) GetMetaHeader() *service.RequestMetaHeader { +func (r *GetRangeHashRequest) GetMetaHeader() *session.RequestMetaHeader { if r != nil { return r.metaHeader } @@ -1752,13 +1752,13 @@ func (r *GetRangeHashRequest) GetMetaHeader() *service.RequestMetaHeader { return nil } -func (r *GetRangeHashRequest) SetMetaHeader(v *service.RequestMetaHeader) { +func (r *GetRangeHashRequest) SetMetaHeader(v *session.RequestMetaHeader) { if r != nil { r.metaHeader = v } } -func (r *GetRangeHashRequest) GetVerificationHeader() *service.RequestVerificationHeader { +func (r *GetRangeHashRequest) GetVerificationHeader() *session.RequestVerificationHeader { if r != nil { return r.verifyHeader } @@ -1766,7 +1766,7 @@ func (r *GetRangeHashRequest) GetVerificationHeader() *service.RequestVerificati return nil } -func (r *GetRangeHashRequest) SetVerificationHeader(v *service.RequestVerificationHeader) { +func (r *GetRangeHashRequest) SetVerificationHeader(v *session.RequestVerificationHeader) { if r != nil { r.verifyHeader = v } @@ -1814,7 +1814,7 @@ func (r *GetRangeHashResponse) SetBody(v *GetRangeHashResponseBody) { } } -func (r *GetRangeHashResponse) GetMetaHeader() *service.ResponseMetaHeader { +func (r *GetRangeHashResponse) GetMetaHeader() *session.ResponseMetaHeader { if r != nil { return r.metaHeader } @@ -1822,13 +1822,13 @@ func (r *GetRangeHashResponse) GetMetaHeader() *service.ResponseMetaHeader { return nil } -func (r *GetRangeHashResponse) SetMetaHeader(v *service.ResponseMetaHeader) { +func (r *GetRangeHashResponse) SetMetaHeader(v *session.ResponseMetaHeader) { if r != nil { r.metaHeader = v } } -func (r *GetRangeHashResponse) GetVerificationHeader() *service.ResponseVerificationHeader { +func (r *GetRangeHashResponse) GetVerificationHeader() *session.ResponseVerificationHeader { if r != nil { return r.verifyHeader } @@ -1836,7 +1836,7 @@ func (r *GetRangeHashResponse) GetVerificationHeader() *service.ResponseVerifica return nil } -func (r *GetRangeHashResponse) SetVerificationHeader(v *service.ResponseVerificationHeader) { +func (r *GetRangeHashResponse) SetVerificationHeader(v *session.ResponseVerificationHeader) { if r != nil { r.verifyHeader = v } diff --git a/v2/signature/sign.go b/v2/signature/sign.go index 2cb768a..8adaf3e 100644 --- a/v2/signature/sign.go +++ b/v2/signature/sign.go @@ -9,21 +9,20 @@ import ( "github.com/nspcc-dev/neofs-api-go/v2/container" "github.com/nspcc-dev/neofs-api-go/v2/object" "github.com/nspcc-dev/neofs-api-go/v2/refs" - "github.com/nspcc-dev/neofs-api-go/v2/service" "github.com/nspcc-dev/neofs-api-go/v2/session" "github.com/pkg/errors" ) type serviceRequest interface { - GetMetaHeader() *service.RequestMetaHeader - GetVerificationHeader() *service.RequestVerificationHeader - SetVerificationHeader(*service.RequestVerificationHeader) + GetMetaHeader() *session.RequestMetaHeader + GetVerificationHeader() *session.RequestVerificationHeader + SetVerificationHeader(*session.RequestVerificationHeader) } type serviceResponse interface { - GetMetaHeader() *service.ResponseMetaHeader - GetVerificationHeader() *service.ResponseVerificationHeader - SetVerificationHeader(*service.ResponseVerificationHeader) + GetMetaHeader() *session.ResponseMetaHeader + GetVerificationHeader() *session.ResponseVerificationHeader + SetVerificationHeader(*session.ResponseVerificationHeader) } type stableMarshaler interface { @@ -55,19 +54,19 @@ type verificationHeader interface { } type requestMetaHeader struct { - *service.RequestMetaHeader + *session.RequestMetaHeader } type responseMetaHeader struct { - *service.ResponseMetaHeader + *session.ResponseMetaHeader } type requestVerificationHeader struct { - *service.RequestVerificationHeader + *session.RequestVerificationHeader } type responseVerificationHeader struct { - *service.ResponseVerificationHeader + *session.ResponseVerificationHeader } func (h *requestMetaHeader) getOrigin() metaHeader { @@ -94,7 +93,7 @@ func (h *requestVerificationHeader) getOrigin() verificationHeader { func (h *requestVerificationHeader) setOrigin(m stableMarshaler) { if m != nil { - h.SetOrigin(m.(*service.RequestVerificationHeader)) + h.SetOrigin(m.(*session.RequestVerificationHeader)) } } @@ -110,7 +109,7 @@ func (r *responseVerificationHeader) getOrigin() verificationHeader { func (r *responseVerificationHeader) setOrigin(m stableMarshaler) { if m != nil { - r.SetOrigin(m.(*service.ResponseVerificationHeader)) + r.SetOrigin(m.(*session.ResponseVerificationHeader)) } } @@ -156,7 +155,7 @@ func SignServiceMessage(key *ecdsa.PrivateKey, msg interface{}) error { case serviceRequest: body = serviceMessageBody(v) meta = v.GetMetaHeader() - verifyHdr = &requestVerificationHeader{new(service.RequestVerificationHeader)} + verifyHdr = &requestVerificationHeader{new(session.RequestVerificationHeader)} verifyHdrSetter = func(h verificationHeader) { v.SetVerificationHeader(h.(*requestVerificationHeader).RequestVerificationHeader) } @@ -167,7 +166,7 @@ func SignServiceMessage(key *ecdsa.PrivateKey, msg interface{}) error { case serviceResponse: body = serviceMessageBody(v) meta = v.GetMetaHeader() - verifyHdr = &responseVerificationHeader{new(service.ResponseVerificationHeader)} + verifyHdr = &responseVerificationHeader{new(session.ResponseVerificationHeader)} verifyHdrSetter = func(h verificationHeader) { v.SetVerificationHeader(h.(*responseVerificationHeader).ResponseVerificationHeader) } @@ -176,11 +175,11 @@ func SignServiceMessage(key *ecdsa.PrivateKey, msg interface{}) error { verifyOrigin = h } default: - panic(fmt.Sprintf("unsupported service message %T", v)) + panic(fmt.Sprintf("unsupported session message %T", v)) } if verifyOrigin == nil { - // sign service message body + // sign session message body if err := signServiceMessagePart(key, body, verifyHdr.SetBodySignature); err != nil { return errors.Wrap(err, "could not sign body") } @@ -249,7 +248,7 @@ func VerifyServiceMessage(msg interface{}) error { ResponseVerificationHeader: v.GetVerificationHeader(), } default: - panic(fmt.Sprintf("unsupported service message %T", v)) + panic(fmt.Sprintf("unsupported session message %T", v)) } return verifyMatryoshkaLevel(serviceMessageBody(msg), meta, verify) @@ -291,7 +290,7 @@ func verifyServiceMessagePart(part stableMarshaler, sigRdr func() *refs.Signatur func serviceMessageBody(req interface{}) stableMarshaler { switch v := req.(type) { default: - panic(fmt.Sprintf("unsupported service message %T", req)) + panic(fmt.Sprintf("unsupported session message %T", req)) /* Accounting */ case *accounting.BalanceRequest: diff --git a/v2/signature/sign_test.go b/v2/signature/sign_test.go index a1bfcab..cd3aee8 100644 --- a/v2/signature/sign_test.go +++ b/v2/signature/sign_test.go @@ -4,7 +4,7 @@ import ( "testing" "github.com/nspcc-dev/neofs-api-go/v2/accounting" - "github.com/nspcc-dev/neofs-api-go/v2/service" + "github.com/nspcc-dev/neofs-api-go/v2/session" crypto "github.com/nspcc-dev/neofs-crypto" "github.com/stretchr/testify/require" ) @@ -16,7 +16,7 @@ func TestBalanceResponse(t *testing.T) { body := new(accounting.BalanceResponseBody) body.SetBalance(dec) - meta := new(service.ResponseMetaHeader) + meta := new(session.ResponseMetaHeader) meta.SetTTL(1) req := new(accounting.BalanceResponse) @@ -36,7 +36,7 @@ func TestBalanceResponse(t *testing.T) { require.NoError(t, VerifyServiceMessage(req)) // add level to meta header matryoshka - meta = new(service.ResponseMetaHeader) + meta = new(session.ResponseMetaHeader) meta.SetOrigin(req.GetMetaHeader()) req.SetMetaHeader(meta) From ae1c1a351cb63f9daed8540568255e925e54454e Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Fri, 21 Aug 2020 15:49:49 +0300 Subject: [PATCH 0358/1196] Fix unified client tests Signed-off-by: Alex Vanin --- v2/accounting/test/client_test.go | 10 ++++---- v2/container/test/client_test.go | 38 +++++++++++++++---------------- v2/object/test/client_test.go | 26 ++++++++++----------- v2/session/test/client_test.go | 9 ++++---- 4 files changed, 41 insertions(+), 42 deletions(-) diff --git a/v2/accounting/test/client_test.go b/v2/accounting/test/client_test.go index 686137f..5817572 100644 --- a/v2/accounting/test/client_test.go +++ b/v2/accounting/test/client_test.go @@ -9,7 +9,7 @@ import ( "github.com/nspcc-dev/neofs-api-go/v2/accounting" accountingGRPC "github.com/nspcc-dev/neofs-api-go/v2/accounting/grpc" "github.com/nspcc-dev/neofs-api-go/v2/refs" - "github.com/nspcc-dev/neofs-api-go/v2/service" + "github.com/nspcc-dev/neofs-api-go/v2/session" "github.com/nspcc-dev/neofs-api-go/v2/signature" "github.com/nspcc-dev/neofs-crypto/test" "github.com/stretchr/testify/require" @@ -57,7 +57,7 @@ func testRequest() *accounting.BalanceRequest { body := new(accounting.BalanceRequestBody) body.SetOwnerID(ownerID) - meta := new(service.RequestMetaHeader) + meta := new(session.RequestMetaHeader) meta.SetTTL(1) req := new(accounting.BalanceRequest) @@ -74,7 +74,7 @@ func testResponse() *accounting.BalanceResponse { body := new(accounting.BalanceResponseBody) body.SetBalance(dec) - meta := new(service.ResponseMetaHeader) + meta := new(session.ResponseMetaHeader) meta.SetTTL(1) resp := new(accounting.BalanceResponse) @@ -136,8 +136,8 @@ func TestGRPCClient(t *testing.T) { resp := testResponse() { // w/o this require.Equal fails due to nil and []T{} difference - meta := new(service.ResponseMetaHeader) - meta.SetXHeaders([]*service.XHeader{}) + meta := new(session.ResponseMetaHeader) + meta.SetXHeaders([]*session.XHeader{}) resp.SetMetaHeader(meta) } diff --git a/v2/container/test/client_test.go b/v2/container/test/client_test.go index b22ed3e..efa2361 100644 --- a/v2/container/test/client_test.go +++ b/v2/container/test/client_test.go @@ -10,7 +10,7 @@ import ( "github.com/nspcc-dev/neofs-api-go/v2/container" containerGRPC "github.com/nspcc-dev/neofs-api-go/v2/container/grpc" "github.com/nspcc-dev/neofs-api-go/v2/refs" - "github.com/nspcc-dev/neofs-api-go/v2/service" + "github.com/nspcc-dev/neofs-api-go/v2/session" "github.com/nspcc-dev/neofs-api-go/v2/signature" "github.com/nspcc-dev/neofs-crypto/test" "github.com/stretchr/testify/require" @@ -183,7 +183,7 @@ func testPutRequest() *container.PutRequest { body := new(container.PutRequestBody) body.SetContainer(cnr) - meta := new(service.RequestMetaHeader) + meta := new(session.RequestMetaHeader) meta.SetTTL(1) req := new(container.PutRequest) @@ -200,9 +200,9 @@ func testPutResponse() *container.PutResponse { body := new(container.PutResponseBody) body.SetContainerID(cid) - meta := new(service.ResponseMetaHeader) + meta := new(session.ResponseMetaHeader) meta.SetTTL(1) - meta.SetXHeaders([]*service.XHeader{}) // w/o this require.Equal fails due to nil and []T{} difference + meta.SetXHeaders([]*session.XHeader{}) // w/o this require.Equal fails due to nil and []T{} difference resp := new(container.PutResponse) resp.SetBody(body) @@ -218,7 +218,7 @@ func testGetRequest() *container.GetRequest { body := new(container.GetRequestBody) body.SetContainerID(cid) - meta := new(service.RequestMetaHeader) + meta := new(session.RequestMetaHeader) meta.SetTTL(1) req := new(container.GetRequest) @@ -235,9 +235,9 @@ func testGetResponse() *container.GetResponse { body := new(container.GetResponseBody) body.SetContainer(cnr) - meta := new(service.ResponseMetaHeader) + meta := new(session.ResponseMetaHeader) meta.SetTTL(1) - meta.SetXHeaders([]*service.XHeader{}) // w/o this require.Equal fails due to nil and []T{} difference + meta.SetXHeaders([]*session.XHeader{}) // w/o this require.Equal fails due to nil and []T{} difference resp := new(container.GetResponse) resp.SetBody(body) @@ -253,7 +253,7 @@ func testDelRequest() *container.DeleteRequest { body := new(container.DeleteRequestBody) body.SetContainerID(cid) - meta := new(service.RequestMetaHeader) + meta := new(session.RequestMetaHeader) meta.SetTTL(1) req := new(container.DeleteRequest) @@ -266,9 +266,9 @@ func testDelRequest() *container.DeleteRequest { func testDelResponse() *container.DeleteResponse { body := new(container.DeleteResponseBody) - meta := new(service.ResponseMetaHeader) + meta := new(session.ResponseMetaHeader) meta.SetTTL(1) - meta.SetXHeaders([]*service.XHeader{}) // w/o this require.Equal fails due to nil and []T{} difference + meta.SetXHeaders([]*session.XHeader{}) // w/o this require.Equal fails due to nil and []T{} difference resp := new(container.DeleteResponse) resp.SetBody(body) @@ -284,7 +284,7 @@ func testListRequest() *container.ListRequest { body := new(container.ListRequestBody) body.SetOwnerID(ownerID) - meta := new(service.RequestMetaHeader) + meta := new(session.RequestMetaHeader) meta.SetTTL(1) req := new(container.ListRequest) @@ -301,9 +301,9 @@ func testListResponse() *container.ListResponse { body := new(container.ListResponseBody) body.SetContainerIDs([]*refs.ContainerID{cid}) - meta := new(service.ResponseMetaHeader) + meta := new(session.ResponseMetaHeader) meta.SetTTL(1) - meta.SetXHeaders([]*service.XHeader{}) // w/o this require.Equal fails due to nil and []T{} difference + meta.SetXHeaders([]*session.XHeader{}) // w/o this require.Equal fails due to nil and []T{} difference resp := new(container.ListResponse) resp.SetBody(body) @@ -322,7 +322,7 @@ func testSetEACLRequest() *container.SetExtendedACLRequest { body := new(container.SetExtendedACLRequestBody) body.SetEACL(eacl) - meta := new(service.RequestMetaHeader) + meta := new(session.RequestMetaHeader) meta.SetTTL(1) req := new(container.SetExtendedACLRequest) @@ -335,9 +335,9 @@ func testSetEACLRequest() *container.SetExtendedACLRequest { func testSetEACLResponse() *container.SetExtendedACLResponse { body := new(container.SetExtendedACLResponseBody) - meta := new(service.ResponseMetaHeader) + meta := new(session.ResponseMetaHeader) meta.SetTTL(1) - meta.SetXHeaders([]*service.XHeader{}) // w/o this require.Equal fails due to nil and []T{} difference + meta.SetXHeaders([]*session.XHeader{}) // w/o this require.Equal fails due to nil and []T{} difference resp := new(container.SetExtendedACLResponse) resp.SetBody(body) @@ -353,7 +353,7 @@ func testGetEACLRequest() *container.GetExtendedACLRequest { body := new(container.GetExtendedACLRequestBody) body.SetContainerID(cid) - meta := new(service.RequestMetaHeader) + meta := new(session.RequestMetaHeader) meta.SetTTL(1) req := new(container.GetExtendedACLRequest) @@ -374,9 +374,9 @@ func testGetEACLResponse() *container.GetExtendedACLResponse { body := new(container.GetExtendedACLResponseBody) body.SetEACL(eacl) - meta := new(service.ResponseMetaHeader) + meta := new(session.ResponseMetaHeader) meta.SetTTL(1) - meta.SetXHeaders([]*service.XHeader{}) // w/o this require.Equal fails due to nil and []T{} difference + meta.SetXHeaders([]*session.XHeader{}) // w/o this require.Equal fails due to nil and []T{} difference resp := new(container.GetExtendedACLResponse) resp.SetBody(body) diff --git a/v2/object/test/client_test.go b/v2/object/test/client_test.go index 87eb920..0acb15f 100644 --- a/v2/object/test/client_test.go +++ b/v2/object/test/client_test.go @@ -9,7 +9,7 @@ import ( "github.com/nspcc-dev/neofs-api-go/v2/object" objectGRPC "github.com/nspcc-dev/neofs-api-go/v2/object/grpc" "github.com/nspcc-dev/neofs-api-go/v2/refs" - "github.com/nspcc-dev/neofs-api-go/v2/service" + "github.com/nspcc-dev/neofs-api-go/v2/session" "github.com/nspcc-dev/neofs-api-go/v2/signature" "github.com/nspcc-dev/neofs-crypto/test" "github.com/stretchr/testify/require" @@ -146,9 +146,9 @@ func testHeadRequest() *object.HeadRequest { body := new(object.HeadRequestBody) body.SetAddress(addr) - meta := new(service.RequestMetaHeader) + meta := new(session.RequestMetaHeader) meta.SetTTL(1) - meta.SetXHeaders([]*service.XHeader{}) + meta.SetXHeaders([]*session.XHeader{}) req := new(object.HeadRequest) req.SetBody(body) @@ -167,9 +167,9 @@ func testHeadResponse() *object.HeadResponse { body := new(object.HeadResponseBody) body.SetHeaderPart(hdrPart) - meta := new(service.ResponseMetaHeader) + meta := new(session.ResponseMetaHeader) meta.SetTTL(1) - meta.SetXHeaders([]*service.XHeader{}) + meta.SetXHeaders([]*session.XHeader{}) resp := new(object.HeadResponse) resp.SetBody(body) @@ -192,9 +192,9 @@ func testDeleteRequest() *object.DeleteRequest { body := new(object.DeleteRequestBody) body.SetAddress(addr) - meta := new(service.RequestMetaHeader) + meta := new(session.RequestMetaHeader) meta.SetTTL(1) - meta.SetXHeaders([]*service.XHeader{}) + meta.SetXHeaders([]*session.XHeader{}) req := new(object.DeleteRequest) req.SetBody(body) @@ -206,9 +206,9 @@ func testDeleteRequest() *object.DeleteRequest { func testDeleteResponse() *object.DeleteResponse { body := new(object.DeleteResponseBody) - meta := new(service.ResponseMetaHeader) + meta := new(session.ResponseMetaHeader) meta.SetTTL(1) - meta.SetXHeaders([]*service.XHeader{}) + meta.SetXHeaders([]*session.XHeader{}) resp := new(object.DeleteResponse) resp.SetBody(body) @@ -231,9 +231,9 @@ func testGetRangeHashRequest() *object.GetRangeHashRequest { body := new(object.GetRangeHashRequestBody) body.SetAddress(addr) - meta := new(service.RequestMetaHeader) + meta := new(session.RequestMetaHeader) meta.SetTTL(1) - meta.SetXHeaders([]*service.XHeader{}) + meta.SetXHeaders([]*session.XHeader{}) req := new(object.GetRangeHashRequest) req.SetBody(body) @@ -246,9 +246,9 @@ func testGetRangeHashResponse() *object.GetRangeHashResponse { body := new(object.GetRangeHashResponseBody) body.SetHashList([][]byte{{7, 8, 9}}) - meta := new(service.ResponseMetaHeader) + meta := new(session.ResponseMetaHeader) meta.SetTTL(1) - meta.SetXHeaders([]*service.XHeader{}) + meta.SetXHeaders([]*session.XHeader{}) resp := new(object.GetRangeHashResponse) resp.SetBody(body) diff --git a/v2/session/test/client_test.go b/v2/session/test/client_test.go index 156bc8e..cc01799 100644 --- a/v2/session/test/client_test.go +++ b/v2/session/test/client_test.go @@ -7,7 +7,6 @@ import ( "testing" "github.com/nspcc-dev/neofs-api-go/v2/refs" - "github.com/nspcc-dev/neofs-api-go/v2/service" "github.com/nspcc-dev/neofs-api-go/v2/session" sessionGRPC "github.com/nspcc-dev/neofs-api-go/v2/session/grpc" "github.com/nspcc-dev/neofs-api-go/v2/signature" @@ -57,7 +56,7 @@ func testRequest() *session.CreateRequest { body := new(session.CreateRequestBody) body.SetOwnerID(ownerID) - meta := new(service.RequestMetaHeader) + meta := new(session.RequestMetaHeader) meta.SetTTL(1) req := new(session.CreateRequest) @@ -71,7 +70,7 @@ func testResponse() *session.CreateResponse { body := new(session.CreateResponseBody) body.SetID([]byte{1, 2, 3}) - meta := new(service.ResponseMetaHeader) + meta := new(session.ResponseMetaHeader) meta.SetTTL(1) resp := new(session.CreateResponse) @@ -133,8 +132,8 @@ func TestGRPCClient(t *testing.T) { resp := testResponse() { // w/o this require.Equal fails due to nil and []T{} difference - meta := new(service.ResponseMetaHeader) - meta.SetXHeaders([]*service.XHeader{}) + meta := new(session.ResponseMetaHeader) + meta.SetXHeaders([]*session.XHeader{}) resp.SetMetaHeader(meta) } From ecb0a4be6719359bbe9410894df496feeddcd710 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Fri, 21 Aug 2020 15:59:30 +0300 Subject: [PATCH 0359/1196] Split object service structs from types Signed-off-by: Alex Vanin --- v2/object/service.go | 114 +++++++++++++++++++++++++++++++++++++++++++ v2/object/types.go | 112 ------------------------------------------ 2 files changed, 114 insertions(+), 112 deletions(-) diff --git a/v2/object/service.go b/v2/object/service.go index 1551aee..2bf69c8 100644 --- a/v2/object/service.go +++ b/v2/object/service.go @@ -2,6 +2,8 @@ package object import ( "context" + + "github.com/nspcc-dev/neofs-api-go/v2/session" ) type Service interface { @@ -13,3 +15,115 @@ type Service interface { GetRange(context.Context, *GetRangeRequest) (GetRangeObjectStreamer, error) GetRangeHash(context.Context, *GetRangeHashRequest) (*GetRangeHashResponse, error) } + +type GetRequest struct { + body *GetRequestBody + + metaHeader *session.RequestMetaHeader + + verifyHeader *session.RequestVerificationHeader +} + +type GetResponse struct { + body *GetResponseBody + + metaHeader *session.ResponseMetaHeader + + verifyHeader *session.ResponseVerificationHeader +} + +type PutRequest struct { + body *PutRequestBody + + metaHeader *session.RequestMetaHeader + + verifyHeader *session.RequestVerificationHeader +} + +type PutResponse struct { + body *PutResponseBody + + metaHeader *session.ResponseMetaHeader + + verifyHeader *session.ResponseVerificationHeader +} + +type DeleteRequest struct { + body *DeleteRequestBody + + metaHeader *session.RequestMetaHeader + + verifyHeader *session.RequestVerificationHeader +} + +type DeleteResponse struct { + body *DeleteResponseBody + + metaHeader *session.ResponseMetaHeader + + verifyHeader *session.ResponseVerificationHeader +} + +type HeadRequest struct { + body *HeadRequestBody + + metaHeader *session.RequestMetaHeader + + verifyHeader *session.RequestVerificationHeader +} + +type HeadResponse struct { + body *HeadResponseBody + + metaHeader *session.ResponseMetaHeader + + verifyHeader *session.ResponseVerificationHeader +} + +type SearchRequest struct { + body *SearchRequestBody + + metaHeader *session.RequestMetaHeader + + verifyHeader *session.RequestVerificationHeader +} + +type SearchResponse struct { + body *SearchResponseBody + + metaHeader *session.ResponseMetaHeader + + verifyHeader *session.ResponseVerificationHeader +} + +type GetRangeRequest struct { + body *GetRangeRequestBody + + metaHeader *session.RequestMetaHeader + + verifyHeader *session.RequestVerificationHeader +} + +type GetRangeResponse struct { + body *GetRangeResponseBody + + metaHeader *session.ResponseMetaHeader + + verifyHeader *session.ResponseVerificationHeader +} + +type GetRangeHashRequest struct { + body *GetRangeHashRequestBody + + metaHeader *session.RequestMetaHeader + + verifyHeader *session.RequestVerificationHeader +} + +type GetRangeHashResponse struct { + body *GetRangeHashResponseBody + + metaHeader *session.ResponseMetaHeader + + verifyHeader *session.ResponseVerificationHeader +} diff --git a/v2/object/types.go b/v2/object/types.go index d1328f8..cdce248 100644 --- a/v2/object/types.go +++ b/v2/object/types.go @@ -73,14 +73,6 @@ type GetRequestBody struct { raw bool } -type GetRequest struct { - body *GetRequestBody - - metaHeader *session.RequestMetaHeader - - verifyHeader *session.RequestVerificationHeader -} - type GetObjectPart interface { getObjectPart() } @@ -101,14 +93,6 @@ type GetResponseBody struct { objPart GetObjectPart } -type GetResponse struct { - body *GetResponseBody - - metaHeader *session.ResponseMetaHeader - - verifyHeader *session.ResponseVerificationHeader -} - type PutObjectPart interface { putObjectPart() } @@ -131,62 +115,22 @@ type PutRequestBody struct { objPart PutObjectPart } -type PutRequest struct { - body *PutRequestBody - - metaHeader *session.RequestMetaHeader - - verifyHeader *session.RequestVerificationHeader -} - type PutResponseBody struct { id *refs.ObjectID } -type PutResponse struct { - body *PutResponseBody - - metaHeader *session.ResponseMetaHeader - - verifyHeader *session.ResponseVerificationHeader -} - type DeleteRequestBody struct { addr *refs.Address } -type DeleteRequest struct { - body *DeleteRequestBody - - metaHeader *session.RequestMetaHeader - - verifyHeader *session.RequestVerificationHeader -} - type DeleteResponseBody struct{} -type DeleteResponse struct { - body *DeleteResponseBody - - metaHeader *session.ResponseMetaHeader - - verifyHeader *session.ResponseVerificationHeader -} - type HeadRequestBody struct { addr *refs.Address mainOnly, raw bool } -type HeadRequest struct { - body *HeadRequestBody - - metaHeader *session.RequestMetaHeader - - verifyHeader *session.RequestVerificationHeader -} - type GetHeaderPart interface { getHeaderPart() } @@ -203,14 +147,6 @@ type HeadResponseBody struct { hdrPart GetHeaderPart } -type HeadResponse struct { - body *HeadResponseBody - - metaHeader *session.ResponseMetaHeader - - verifyHeader *session.ResponseVerificationHeader -} - type SearchFilter struct { matchType MatchType @@ -225,26 +161,10 @@ type SearchRequestBody struct { filters []*SearchFilter } -type SearchRequest struct { - body *SearchRequestBody - - metaHeader *session.RequestMetaHeader - - verifyHeader *session.RequestVerificationHeader -} - type SearchResponseBody struct { idList []*refs.ObjectID } -type SearchResponse struct { - body *SearchResponseBody - - metaHeader *session.ResponseMetaHeader - - verifyHeader *session.ResponseVerificationHeader -} - type Range struct { off, len uint64 } @@ -255,26 +175,10 @@ type GetRangeRequestBody struct { rng *Range } -type GetRangeRequest struct { - body *GetRangeRequestBody - - metaHeader *session.RequestMetaHeader - - verifyHeader *session.RequestVerificationHeader -} - type GetRangeResponseBody struct { chunk []byte } -type GetRangeResponse struct { - body *GetRangeResponseBody - - metaHeader *session.ResponseMetaHeader - - verifyHeader *session.ResponseVerificationHeader -} - type GetRangeHashRequestBody struct { addr *refs.Address @@ -285,28 +189,12 @@ type GetRangeHashRequestBody struct { typ refs.ChecksumType } -type GetRangeHashRequest struct { - body *GetRangeHashRequestBody - - metaHeader *session.RequestMetaHeader - - verifyHeader *session.RequestVerificationHeader -} - type GetRangeHashResponseBody struct { typ refs.ChecksumType hashList [][]byte } -type GetRangeHashResponse struct { - body *GetRangeHashResponseBody - - metaHeader *session.ResponseMetaHeader - - verifyHeader *session.ResponseVerificationHeader -} - const ( TypeRegular Type = iota TypeTombstone From 55a6509e8ff67e96598d63d875ceba689d666a63 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Sat, 22 Aug 2020 12:28:33 +0300 Subject: [PATCH 0360/1196] v2: Define API service interfaces Define interfaces that reflect service (Accounting, Container, Session) declarations in the API. Signed-off-by: Leonard Lyubich --- v2/accounting/accounting.go | 16 ------- v2/accounting/service.go | 27 +++++++++++ v2/container/service.go | 96 +++++++++++++++++++++++++++++++++++++ v2/container/types.go | 80 ------------------------------- v2/session/service.go | 25 ++++++++++ v2/session/types.go | 16 ------- 6 files changed, 148 insertions(+), 112 deletions(-) create mode 100644 v2/accounting/service.go create mode 100644 v2/container/service.go create mode 100644 v2/session/service.go diff --git a/v2/accounting/accounting.go b/v2/accounting/accounting.go index f2c0d98..619f220 100644 --- a/v2/accounting/accounting.go +++ b/v2/accounting/accounting.go @@ -9,26 +9,10 @@ type BalanceRequestBody struct { ownerID *refs.OwnerID } -type BalanceRequest struct { - body *BalanceRequestBody - - metaHeader *session.RequestMetaHeader - - verifyHeader *session.RequestVerificationHeader -} - type BalanceResponseBody struct { bal *Decimal } -type BalanceResponse struct { - body *BalanceResponseBody - - metaHeader *session.ResponseMetaHeader - - verifyHeader *session.ResponseVerificationHeader -} - type Decimal struct { val int64 diff --git a/v2/accounting/service.go b/v2/accounting/service.go new file mode 100644 index 0000000..8443c66 --- /dev/null +++ b/v2/accounting/service.go @@ -0,0 +1,27 @@ +package accounting + +import ( + "context" + + "github.com/nspcc-dev/neofs-api-go/v2/session" +) + +type Service interface { + Balance(context.Context, *BalanceRequest) (*BalanceResponse, error) +} + +type BalanceRequest struct { + body *BalanceRequestBody + + metaHeader *session.RequestMetaHeader + + verifyHeader *session.RequestVerificationHeader +} + +type BalanceResponse struct { + body *BalanceResponseBody + + metaHeader *session.ResponseMetaHeader + + verifyHeader *session.ResponseVerificationHeader +} diff --git a/v2/container/service.go b/v2/container/service.go new file mode 100644 index 0000000..f664084 --- /dev/null +++ b/v2/container/service.go @@ -0,0 +1,96 @@ +package container + +import ( + "context" + + "github.com/nspcc-dev/neofs-api-go/v2/session" +) + +type Service interface { + Put(context.Context, *PutRequest) (*PutResponse, error) + Delete(context.Context, *DeleteRequest) (*DeleteResponse, error) + Get(context.Context, *GetRequest) (*GetResponse, error) + List(context.Context, *ListRequest) (*ListResponse, error) + SetExtendedACL(context.Context, *SetExtendedACLRequest) (*SetExtendedACLResponse, error) + GetExtendedACL(context.Context, *GetExtendedACLRequest) (*GetExtendedACLResponse, error) +} + +type PutRequest struct { + body *PutRequestBody + + metaHeader *session.RequestMetaHeader + + verifyHeader *session.RequestVerificationHeader +} + +type PutResponse struct { + body *PutResponseBody + + metaHeader *session.ResponseMetaHeader + + verifyHeader *session.ResponseVerificationHeader +} + +type DeleteRequest struct { + body *DeleteRequestBody + + metaHeader *session.RequestMetaHeader + + verifyHeader *session.RequestVerificationHeader +} + +type DeleteResponse struct { + body *DeleteResponseBody + + metaHeader *session.ResponseMetaHeader + + verifyHeader *session.ResponseVerificationHeader +} + +type ListRequest struct { + body *ListRequestBody + + metaHeader *session.RequestMetaHeader + + verifyHeader *session.RequestVerificationHeader +} + +type ListResponse struct { + body *ListResponseBody + + metaHeader *session.ResponseMetaHeader + + verifyHeader *session.ResponseVerificationHeader +} + +type SetExtendedACLRequest struct { + body *SetExtendedACLRequestBody + + metaHeader *session.RequestMetaHeader + + verifyHeader *session.RequestVerificationHeader +} + +type SetExtendedACLResponse struct { + body *SetExtendedACLResponseBody + + metaHeader *session.ResponseMetaHeader + + verifyHeader *session.ResponseVerificationHeader +} + +type GetExtendedACLRequest struct { + body *GetExtendedACLRequestBody + + metaHeader *session.RequestMetaHeader + + verifyHeader *session.RequestVerificationHeader +} + +type GetExtendedACLResponse struct { + body *GetExtendedACLResponseBody + + metaHeader *session.ResponseMetaHeader + + verifyHeader *session.ResponseVerificationHeader +} diff --git a/v2/container/types.go b/v2/container/types.go index ae4a3c1..0e53639 100644 --- a/v2/container/types.go +++ b/v2/container/types.go @@ -31,26 +31,10 @@ type PutRequestBody struct { sig *refs.Signature } -type PutRequest struct { - body *PutRequestBody - - metaHeader *session.RequestMetaHeader - - verifyHeader *session.RequestVerificationHeader -} - type PutResponseBody struct { cid *refs.ContainerID } -type PutResponse struct { - body *PutResponseBody - - metaHeader *session.ResponseMetaHeader - - verifyHeader *session.ResponseVerificationHeader -} - type GetRequestBody struct { cid *refs.ContainerID } @@ -81,98 +65,34 @@ type DeleteRequestBody struct { sig *refs.Signature } -type DeleteRequest struct { - body *DeleteRequestBody - - metaHeader *session.RequestMetaHeader - - verifyHeader *session.RequestVerificationHeader -} - type DeleteResponseBody struct{} -type DeleteResponse struct { - body *DeleteResponseBody - - metaHeader *session.ResponseMetaHeader - - verifyHeader *session.ResponseVerificationHeader -} - type ListRequestBody struct { ownerID *refs.OwnerID } -type ListRequest struct { - body *ListRequestBody - - metaHeader *session.RequestMetaHeader - - verifyHeader *session.RequestVerificationHeader -} - type ListResponseBody struct { cidList []*refs.ContainerID } -type ListResponse struct { - body *ListResponseBody - - metaHeader *session.ResponseMetaHeader - - verifyHeader *session.ResponseVerificationHeader -} - type SetExtendedACLRequestBody struct { eacl *acl.Table sig *refs.Signature } -type SetExtendedACLRequest struct { - body *SetExtendedACLRequestBody - - metaHeader *session.RequestMetaHeader - - verifyHeader *session.RequestVerificationHeader -} - type SetExtendedACLResponseBody struct{} -type SetExtendedACLResponse struct { - body *SetExtendedACLResponseBody - - metaHeader *session.ResponseMetaHeader - - verifyHeader *session.ResponseVerificationHeader -} - type GetExtendedACLRequestBody struct { cid *refs.ContainerID } -type GetExtendedACLRequest struct { - body *GetExtendedACLRequestBody - - metaHeader *session.RequestMetaHeader - - verifyHeader *session.RequestVerificationHeader -} - type GetExtendedACLResponseBody struct { eacl *acl.Table sig *refs.Signature } -type GetExtendedACLResponse struct { - body *GetExtendedACLResponseBody - - metaHeader *session.ResponseMetaHeader - - verifyHeader *session.ResponseVerificationHeader -} - func (a *Attribute) GetKey() string { if a != nil { return a.key diff --git a/v2/session/service.go b/v2/session/service.go new file mode 100644 index 0000000..5a07e2d --- /dev/null +++ b/v2/session/service.go @@ -0,0 +1,25 @@ +package session + +import ( + "context" +) + +type Service interface { + Create(context.Context, *CreateRequest) (*CreateResponse, error) +} + +type CreateRequest struct { + body *CreateRequestBody + + metaHeader *RequestMetaHeader + + verifyHeader *RequestVerificationHeader +} + +type CreateResponse struct { + body *CreateResponseBody + + metaHeader *ResponseMetaHeader + + verifyHeader *ResponseVerificationHeader +} diff --git a/v2/session/types.go b/v2/session/types.go index 9e87603..0322b25 100644 --- a/v2/session/types.go +++ b/v2/session/types.go @@ -11,28 +11,12 @@ type CreateRequestBody struct { expiration uint64 } -type CreateRequest struct { - body *CreateRequestBody - - metaHeader *RequestMetaHeader - - verifyHeader *RequestVerificationHeader -} - type CreateResponseBody struct { id []byte sessionKey []byte } -type CreateResponse struct { - body *CreateResponseBody - - metaHeader *ResponseMetaHeader - - verifyHeader *ResponseVerificationHeader -} - type XHeader struct { key, val string } From 86d56086e3eca1bbcac6f5fa0fa8cae7fc36f71b Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Mon, 24 Aug 2020 10:17:03 +0300 Subject: [PATCH 0361/1196] Rename unified client constructors Client constructor `New` will be used as `package.New()` in external packages. This definition is not very clear since it can create new structure or new client or whatever. `package.NewClient()` is quite unambiguous. Signed-off-by: Alex Vanin --- v2/accounting/client.go | 2 +- v2/accounting/test/client_test.go | 6 +++--- v2/container/client.go | 2 +- v2/container/test/client_test.go | 36 +++++++++++++++---------------- v2/object/client.go | 2 +- v2/object/test/client_test.go | 18 ++++++++-------- v2/session/client.go | 2 +- v2/session/test/client_test.go | 6 +++--- 8 files changed, 37 insertions(+), 37 deletions(-) diff --git a/v2/accounting/client.go b/v2/accounting/client.go index b62a3b0..3d9e51d 100644 --- a/v2/accounting/client.go +++ b/v2/accounting/client.go @@ -62,7 +62,7 @@ func defaultCfg() *cfg { } } -func New(opts ...Option) (*Client, error) { +func NewClient(opts ...Option) (*Client, error) { cfg := defaultCfg() for i := range opts { diff --git a/v2/accounting/test/client_test.go b/v2/accounting/test/client_test.go index 5817572..7c63dcf 100644 --- a/v2/accounting/test/client_test.go +++ b/v2/accounting/test/client_test.go @@ -101,7 +101,7 @@ func TestGRPCClient(t *testing.T) { server: srv, } - c, err := accounting.New(accounting.WithGRPCServiceClient(cli)) + c, err := accounting.NewClient(accounting.WithGRPCServiceClient(cli)) require.NoError(t, err) resp, err := c.Balance(ctx, new(accounting.BalanceRequest)) @@ -114,7 +114,7 @@ func TestGRPCClient(t *testing.T) { require.Error(t, signature.VerifyServiceMessage(req)) - c, err := accounting.New( + c, err := accounting.NewClient( accounting.WithGRPCServiceClient( &testGRPCClient{ server: new(testGRPCServer), @@ -141,7 +141,7 @@ func TestGRPCClient(t *testing.T) { resp.SetMetaHeader(meta) } - c, err := accounting.New( + c, err := accounting.NewClient( accounting.WithGRPCServiceClient( &testGRPCClient{ server: &testGRPCServer{ diff --git a/v2/container/client.go b/v2/container/client.go index 9c8e1a3..bffe3b8 100644 --- a/v2/container/client.go +++ b/v2/container/client.go @@ -172,7 +172,7 @@ func defaultCfg() *cfg { } } -func New(opts ...Option) (*Client, error) { +func NewClient(opts ...Option) (*Client, error) { cfg := defaultCfg() for i := range opts { diff --git a/v2/container/test/client_test.go b/v2/container/test/client_test.go index efa2361..2eed490 100644 --- a/v2/container/test/client_test.go +++ b/v2/container/test/client_test.go @@ -402,7 +402,7 @@ func TestGRPCClient_Put(t *testing.T) { server: srv, } - c, err := container.New(container.WithGRPCServiceClient(cli)) + c, err := container.NewClient(container.WithGRPCServiceClient(cli)) require.NoError(t, err) resp, err := c.Put(ctx, new(container.PutRequest)) @@ -415,7 +415,7 @@ func TestGRPCClient_Put(t *testing.T) { require.Error(t, signature.VerifyServiceMessage(req)) - c, err := container.New( + c, err := container.NewClient( container.WithGRPCServiceClient( &testGRPCClient{ server: new(testGRPCServer), @@ -436,7 +436,7 @@ func TestGRPCClient_Put(t *testing.T) { resp := testPutResponse() - c, err := container.New( + c, err := container.NewClient( container.WithGRPCServiceClient( &testGRPCClient{ server: &testGRPCServer{ @@ -474,7 +474,7 @@ func TestGRPCClient_Get(t *testing.T) { server: srv, } - c, err := container.New(container.WithGRPCServiceClient(cli)) + c, err := container.NewClient(container.WithGRPCServiceClient(cli)) require.NoError(t, err) resp, err := c.Get(ctx, new(container.GetRequest)) @@ -487,7 +487,7 @@ func TestGRPCClient_Get(t *testing.T) { require.Error(t, signature.VerifyServiceMessage(req)) - c, err := container.New( + c, err := container.NewClient( container.WithGRPCServiceClient( &testGRPCClient{ server: new(testGRPCServer), @@ -508,7 +508,7 @@ func TestGRPCClient_Get(t *testing.T) { resp := testGetResponse() - c, err := container.New( + c, err := container.NewClient( container.WithGRPCServiceClient( &testGRPCClient{ server: &testGRPCServer{ @@ -546,7 +546,7 @@ func TestGRPCClient_Delete(t *testing.T) { server: srv, } - c, err := container.New(container.WithGRPCServiceClient(cli)) + c, err := container.NewClient(container.WithGRPCServiceClient(cli)) require.NoError(t, err) resp, err := c.Delete(ctx, new(container.DeleteRequest)) @@ -559,7 +559,7 @@ func TestGRPCClient_Delete(t *testing.T) { require.Error(t, signature.VerifyServiceMessage(req)) - c, err := container.New( + c, err := container.NewClient( container.WithGRPCServiceClient( &testGRPCClient{ server: new(testGRPCServer), @@ -580,7 +580,7 @@ func TestGRPCClient_Delete(t *testing.T) { resp := testDelResponse() - c, err := container.New( + c, err := container.NewClient( container.WithGRPCServiceClient( &testGRPCClient{ server: &testGRPCServer{ @@ -618,7 +618,7 @@ func TestGRPCClient_List(t *testing.T) { server: srv, } - c, err := container.New(container.WithGRPCServiceClient(cli)) + c, err := container.NewClient(container.WithGRPCServiceClient(cli)) require.NoError(t, err) resp, err := c.List(ctx, new(container.ListRequest)) @@ -631,7 +631,7 @@ func TestGRPCClient_List(t *testing.T) { require.Error(t, signature.VerifyServiceMessage(req)) - c, err := container.New( + c, err := container.NewClient( container.WithGRPCServiceClient( &testGRPCClient{ server: new(testGRPCServer), @@ -652,7 +652,7 @@ func TestGRPCClient_List(t *testing.T) { resp := testListResponse() - c, err := container.New( + c, err := container.NewClient( container.WithGRPCServiceClient( &testGRPCClient{ server: &testGRPCServer{ @@ -690,7 +690,7 @@ func TestGRPCClient_SetEACL(t *testing.T) { server: srv, } - c, err := container.New(container.WithGRPCServiceClient(cli)) + c, err := container.NewClient(container.WithGRPCServiceClient(cli)) require.NoError(t, err) resp, err := c.SetExtendedACL(ctx, new(container.SetExtendedACLRequest)) @@ -702,7 +702,7 @@ func TestGRPCClient_SetEACL(t *testing.T) { require.Error(t, signature.VerifyServiceMessage(req)) - c, err := container.New( + c, err := container.NewClient( container.WithGRPCServiceClient( &testGRPCClient{ server: new(testGRPCServer), @@ -723,7 +723,7 @@ func TestGRPCClient_SetEACL(t *testing.T) { resp := testSetEACLResponse() - c, err := container.New( + c, err := container.NewClient( container.WithGRPCServiceClient( &testGRPCClient{ server: &testGRPCServer{ @@ -761,7 +761,7 @@ func TestGRPCClient_GetEACL(t *testing.T) { server: srv, } - c, err := container.New(container.WithGRPCServiceClient(cli)) + c, err := container.NewClient(container.WithGRPCServiceClient(cli)) require.NoError(t, err) resp, err := c.GetExtendedACL(ctx, new(container.GetExtendedACLRequest)) @@ -773,7 +773,7 @@ func TestGRPCClient_GetEACL(t *testing.T) { require.Error(t, signature.VerifyServiceMessage(req)) - c, err := container.New( + c, err := container.NewClient( container.WithGRPCServiceClient( &testGRPCClient{ server: new(testGRPCServer), @@ -794,7 +794,7 @@ func TestGRPCClient_GetEACL(t *testing.T) { resp := testGetEACLResponse() - c, err := container.New( + c, err := container.NewClient( container.WithGRPCServiceClient( &testGRPCClient{ server: &testGRPCServer{ diff --git a/v2/object/client.go b/v2/object/client.go index 955cdda..0287090 100644 --- a/v2/object/client.go +++ b/v2/object/client.go @@ -168,7 +168,7 @@ func defaultCfg() *cfg { } } -func New(opts ...Option) (*Client, error) { +func NewClient(opts ...Option) (*Client, error) { cfg := defaultCfg() for i := range opts { diff --git a/v2/object/test/client_test.go b/v2/object/test/client_test.go index 0acb15f..323320e 100644 --- a/v2/object/test/client_test.go +++ b/v2/object/test/client_test.go @@ -274,7 +274,7 @@ func TestGRPCClient_Head(t *testing.T) { server: srv, } - c, err := object.New(object.WithGRPCServiceClient(cli)) + c, err := object.NewClient(object.WithGRPCServiceClient(cli)) require.NoError(t, err) resp, err := c.Head(ctx, new(object.HeadRequest)) @@ -287,7 +287,7 @@ func TestGRPCClient_Head(t *testing.T) { require.Error(t, signature.VerifyServiceMessage(req)) - c, err := object.New( + c, err := object.NewClient( object.WithGRPCServiceClient( &testGRPCClient{ server: new(testGRPCServer), @@ -308,7 +308,7 @@ func TestGRPCClient_Head(t *testing.T) { resp := testHeadResponse() - c, err := object.New( + c, err := object.NewClient( object.WithGRPCServiceClient( &testGRPCClient{ server: &testGRPCServer{ @@ -346,7 +346,7 @@ func TestGRPCClient_Delete(t *testing.T) { server: srv, } - c, err := object.New(object.WithGRPCServiceClient(cli)) + c, err := object.NewClient(object.WithGRPCServiceClient(cli)) require.NoError(t, err) resp, err := c.Delete(ctx, new(object.DeleteRequest)) @@ -359,7 +359,7 @@ func TestGRPCClient_Delete(t *testing.T) { require.Error(t, signature.VerifyServiceMessage(req)) - c, err := object.New( + c, err := object.NewClient( object.WithGRPCServiceClient( &testGRPCClient{ server: new(testGRPCServer), @@ -380,7 +380,7 @@ func TestGRPCClient_Delete(t *testing.T) { resp := testDeleteResponse() - c, err := object.New( + c, err := object.NewClient( object.WithGRPCServiceClient( &testGRPCClient{ server: &testGRPCServer{ @@ -418,7 +418,7 @@ func TestGRPCClient_GetRangeHash(t *testing.T) { server: srv, } - c, err := object.New(object.WithGRPCServiceClient(cli)) + c, err := object.NewClient(object.WithGRPCServiceClient(cli)) require.NoError(t, err) resp, err := c.GetRangeHash(ctx, new(object.GetRangeHashRequest)) @@ -431,7 +431,7 @@ func TestGRPCClient_GetRangeHash(t *testing.T) { require.Error(t, signature.VerifyServiceMessage(req)) - c, err := object.New( + c, err := object.NewClient( object.WithGRPCServiceClient( &testGRPCClient{ server: new(testGRPCServer), @@ -452,7 +452,7 @@ func TestGRPCClient_GetRangeHash(t *testing.T) { resp := testGetRangeHashResponse() - c, err := object.New( + c, err := object.NewClient( object.WithGRPCServiceClient( &testGRPCClient{ server: &testGRPCServer{ diff --git a/v2/session/client.go b/v2/session/client.go index 7232f9f..f1709c7 100644 --- a/v2/session/client.go +++ b/v2/session/client.go @@ -62,7 +62,7 @@ func defaultCfg() *cfg { } } -func New(opts ...Option) (*Client, error) { +func NewClient(opts ...Option) (*Client, error) { cfg := defaultCfg() for i := range opts { diff --git a/v2/session/test/client_test.go b/v2/session/test/client_test.go index cc01799..9ba4029 100644 --- a/v2/session/test/client_test.go +++ b/v2/session/test/client_test.go @@ -97,7 +97,7 @@ func TestGRPCClient(t *testing.T) { server: srv, } - c, err := session.New(session.WithGRPCServiceClient(cli)) + c, err := session.NewClient(session.WithGRPCServiceClient(cli)) require.NoError(t, err) resp, err := c.Create(ctx, new(session.CreateRequest)) @@ -110,7 +110,7 @@ func TestGRPCClient(t *testing.T) { require.Error(t, signature.VerifyServiceMessage(req)) - c, err := session.New( + c, err := session.NewClient( session.WithGRPCServiceClient( &testGRPCClient{ server: new(testGRPCServer), @@ -137,7 +137,7 @@ func TestGRPCClient(t *testing.T) { resp.SetMetaHeader(meta) } - c, err := session.New( + c, err := session.NewClient( session.WithGRPCServiceClient( &testGRPCClient{ server: &testGRPCServer{ From 8c920d75a66b3a7b3ba02438da0a02eb4a4f38f4 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Tue, 25 Aug 2020 14:44:21 +0300 Subject: [PATCH 0362/1196] [#126] sdk: add reference types This commits adds container id and neo 3 wallet id, that is used as owner id for object and container. Version is set out outside of refs packages since it store global version of SDK. Signed-off-by: Alex Vanin --- go.mod | 4 +- go.sum | 170 +++++++++++++++++++++++++++++++++++++++ pkg/refs/container_id.go | 15 ++++ pkg/refs/neo_wallet.go | 37 +++++++++ pkg/version.go | 28 +++++++ 5 files changed, 253 insertions(+), 1 deletion(-) create mode 100644 pkg/refs/container_id.go create mode 100644 pkg/refs/neo_wallet.go create mode 100644 pkg/version.go diff --git a/go.mod b/go.mod index 79453da..273b81a 100644 --- a/go.mod +++ b/go.mod @@ -4,10 +4,12 @@ go 1.14 require ( github.com/golang/protobuf v1.4.2 + github.com/google/uuid v1.1.1 + github.com/mr-tron/base58 v1.1.2 + github.com/nspcc-dev/neo-go v0.90.0 github.com/nspcc-dev/neofs-crypto v0.3.0 github.com/pkg/errors v0.9.1 github.com/stretchr/testify v1.6.1 - golang.org/x/net v0.0.0-20190620200207-3b0461eec859 // indirect golang.org/x/sys v0.0.0-20200420163511-1957bb5e6d1f // indirect golang.org/x/text v0.3.2 // indirect google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a // indirect diff --git a/go.sum b/go.sum index 469e942..f5ee18a 100644 --- a/go.sum +++ b/go.sum @@ -1,18 +1,67 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/CityOfZion/neo-go v0.62.1-pre.0.20191114145240-e740fbe708f8/go.mod h1:MJCkWUBhi9pn/CrYO1Q3P687y2KeahrOPS9BD9LDGb0= +github.com/CityOfZion/neo-go v0.70.1-pre.0.20191209120015-fccb0085941e/go.mod h1:0enZl0az8xA6PVkwzEOwPWVJGqlt/GO4hA4kmQ5Xzig= +github.com/CityOfZion/neo-go v0.70.1-pre.0.20191212173117-32ac01130d4c/go.mod h1:JtlHfeqLywZLswKIKFnAp+yzezY4Dji9qlfQKB2OD/I= +github.com/CityOfZion/neo-go v0.71.1-pre.0.20200129171427-f773ec69fb84/go.mod h1:FLI526IrRWHmcsO+mHsCbj64pJZhwQFTLJZu+A4PGOA= +github.com/DataDog/zstd v1.4.1/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo= +github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= +github.com/Workiva/go-datastructures v1.0.50/go.mod h1:Z+F2Rca0qCsVYDS8z7bAGm8f3UkzuWYS/oBZz5a7VVA= +github.com/abiosoft/ishell v2.0.0+incompatible/go.mod h1:HQR9AqF2R3P4XXpMpI0NAzgHf/aS6+zVXRj14cVk9qg= +github.com/abiosoft/readline v0.0.0-20180607040430-155bce2042db/go.mod h1:rB3B4rKii8V21ydCbIzH5hZiCQE7f5E9SzUb/ZZx530= +github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/alicebob/gopher-json v0.0.0-20180125190556-5a6b3ba71ee6/go.mod h1:SGnFV6hVsYE877CKEZ6tDNTjaSXYUk6QqoIK6PrAtcc= +github.com/alicebob/miniredis v2.5.0+incompatible/go.mod h1:8HZjEj4yU0dwhYHky+DxYx+6BMjkBbe5ONFIF1MXffk= +github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= +github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= +github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= +github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= +github.com/cespare/xxhash/v2 v2.1.0/go.mod h1:dgIUBU3pDso/gPgZ1osOZ0iQf77oPR28Tjxl5dIMyVM= +github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= +github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= +github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= +github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= +github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= +github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= +github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/dgraph-io/badger/v2 v2.0.3/go.mod h1:3KY8+bsP8wI0OEnQJAKpd4wIJW/Mm32yw2j/9FUVnIM= +github.com/dgraph-io/ristretto v0.0.2-0.20200115201040-8f368f2f2ab3/go.mod h1:KPxhHT9ZxKefz+PCeOGsrHpl1qZ7i70dGTu2u+Ahh6E= +github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= +github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/etcd-io/bbolt v1.3.3/go.mod h1:ZF2nL25h33cCyBtcyWeZ2/I3HQOfTP+0PIEvHjkjCrw= +github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= +github.com/flynn-archive/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:rZfgFAXFS/z/lEd6LJmf9HVZ1LkgYiHx5pHhV5DR16M= +github.com/frankban/quicktest v1.10.0/go.mod h1:ui7WezCLWMWxVWr1GETZY3smRy0G4KWq9vcPtJmFl7Y= +github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= +github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= +github.com/go-redis/redis v6.10.2+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA= +github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/go-yaml/yaml v2.1.0+incompatible h1:RYi2hDdss1u4YE7GwixGzWwVo47T8UQwnTLB6vQiq+o= +github.com/go-yaml/yaml v2.1.0+incompatible/go.mod h1:w2MrLa16VYP0jy6N7M5kHaCkaLENm+P+Tv+MfurjSw0= +github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.3 h1:gyjaxf+svBWX08ZjK86iN9geUJF0H6gp2IRKX6Nf6/I= @@ -25,51 +74,163 @@ github.com/golang/protobuf v1.4.0 h1:oOuy+ugB+P/kBdUnG5QaMXSIyJ1q38wWSojYCb3z5VQ github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= github.com/golang/protobuf v1.4.2 h1:+Z5KGCizgyZCbGh1KZqA0fcLLkwbsjIzS4aV2v7wJX0= github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/snappy v0.0.0-20170215233205-553a64147049/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/gomodule/redigo v2.0.0+incompatible/go.mod h1:B4C85qUVwatsJoIUNIfCRsp7qO0iAmpGFZ4EELWSbC4= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= +github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= +github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= +github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= +github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= +github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pretty v0.2.0 h1:s5hAObm+yFO5uHYt5dYjxi2rXrsnmRpJx4OYvIWUaQs= +github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= +github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= +github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= +github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= +github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ= +github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84= +github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= +github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/mr-tron/base58 v1.1.2 h1:ZEw4I2EgPKDJ2iEw0cNmLB3ROrEmkOtXIkaG7wZg+78= github.com/mr-tron/base58 v1.1.2/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= +github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/nspcc-dev/dbft v0.0.0-20191205084618-dacb1a30c254/go.mod h1:w1Ln2aT+dBlPhLnuZhBV+DfPEdS2CHWWLp5JTScY3bw= +github.com/nspcc-dev/dbft v0.0.0-20191209120240-0d6b7568d9ae/go.mod h1:3FjXOoHmA51EGfb5GS/HOv7VdmngNRTssSeQ729dvGY= +github.com/nspcc-dev/dbft v0.0.0-20200117124306-478e5cfbf03a/go.mod h1:/YFK+XOxxg0Bfm6P92lY5eDSLYfp06XOdL8KAVgXjVk= +github.com/nspcc-dev/dbft v0.0.0-20200219114139-199d286ed6c1/go.mod h1:O0qtn62prQSqizzoagHmuuKoz8QMkU3SzBoKdEvm3aQ= +github.com/nspcc-dev/dbft v0.0.0-20200711144034-c526ccc6f570/go.mod h1:1FYQXSbb6/9HQIkoF8XO7W/S8N7AZRkBsgwbcXRvk0E= +github.com/nspcc-dev/neo-go v0.73.1-pre.0.20200303142215-f5a1b928ce09/go.mod h1:pPYwPZ2ks+uMnlRLUyXOpLieaDQSEaf4NM3zHVbRjmg= +github.com/nspcc-dev/neo-go v0.90.0 h1:ABNDrJuF9C1XuLQu0q9DKSVMlg9eQn/g6rX8Jbr31bo= +github.com/nspcc-dev/neo-go v0.90.0/go.mod h1:pPFdnApJwUSRAnpdiPBZl7I7jv0doDg5naecpSPK4+Q= +github.com/nspcc-dev/neofs-crypto v0.2.0/go.mod h1:F/96fUzPM3wR+UGsPi3faVNmFlA9KAEAUQR7dMxZmNA= +github.com/nspcc-dev/neofs-crypto v0.2.3/go.mod h1:8w16GEJbH6791ktVqHN9YRNH3s9BEEKYxGhlFnp0cDw= github.com/nspcc-dev/neofs-crypto v0.3.0 h1:zlr3pgoxuzrmGCxc5W8dGVfA9Rro8diFvVnBg0L4ifM= github.com/nspcc-dev/neofs-crypto v0.3.0/go.mod h1:8w16GEJbH6791ktVqHN9YRNH3s9BEEKYxGhlFnp0cDw= +github.com/nspcc-dev/rfc6979 v0.1.0/go.mod h1:exhIh1PdpDC5vQmyEsGvc4YDM/lyQp/452QxGq/UEso= github.com/nspcc-dev/rfc6979 v0.2.0 h1:3e1WNxrN60/6N0DW7+UYisLeZJyfqZTNOjeV/toYvOE= github.com/nspcc-dev/rfc6979 v0.2.0/go.mod h1:exhIh1PdpDC5vQmyEsGvc4YDM/lyQp/452QxGq/UEso= +github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.10.3/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/gomega v1.4.2/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= +github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= +github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= +github.com/pierrec/lz4 v2.5.2+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= +github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= +github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= +github.com/prometheus/client_golang v1.2.1/go.mod h1:XMU6Z2MjaRKVu/dC1qupJI9SiNkDYzz3xecMgSW/F+U= +github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= +github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4 h1:gQz4mCbXsO+nc9n1hCxHcGA3Zx3Eo+UHZoInFGUIXNM= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt26CguLLsqA= +github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= +github.com/prometheus/procfs v0.0.5/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDaekg4FpcdQ= +github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= +github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= +github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= +github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= +github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= +github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= +github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= +github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= +github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= +github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/syndtr/goleveldb v0.0.0-20180307113352-169b1b37be73/go.mod h1:Z4AUp2Km+PwemOoO/VB5AOx9XSsIItzFjoJlOSiYmn0= +github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= +github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= +github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= +github.com/yuin/gopher-lua v0.0.0-20190514113301-1cd887cd7036/go.mod h1:gqRgreBUhTSL0GeU64rtZ3Uq3wtjOa/TB2YfrtkCbVQ= +github.com/yuin/gopher-lua v0.0.0-20191128022950-c6266f4fe8d7/go.mod h1:gqRgreBUhTSL0GeU64rtZ3Uq3wtjOa/TB2YfrtkCbVQ= +go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= +go.etcd.io/bbolt v1.3.4/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ= +go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= +go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= +go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= +golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4 h1:HuIa8hRrWRSrqYzx1qI49NNxhdi2PrY7gxVSq1JjLDc= +golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859 h1:R/3boaszxrf1GEUWTVDzSKVwLmSJpwZ1yqXm8j0v2QI= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190204203706-41f3e6584952/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191008105621-543471e840be/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191010194322-b09406accb47/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200420163511-1957bb5e6d1f h1:gWF768j/LaZugp8dyS4UwsslYCYz9XgFxvlgsn0n9H8= golang.org/x/sys v0.0.0-20200420163511-1957bb5e6d1f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/tools v0.0.0-20180318012157-96caea41033d/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= @@ -98,9 +259,18 @@ google.golang.org/protobuf v1.21.0 h1:qdOKuR/EIArgaWNjetjgTzgVTAZ+S/WXVrq9HW9zim google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= google.golang.org/protobuf v1.23.0 h1:4MY060fB1DLGMB/7MBTLnwQUY6+F09GEiz6SsrNqyzM= google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +gopkg.in/abiosoft/ishell.v2 v2.0.0/go.mod h1:sFp+cGtH6o4s1FtpVPTMcHq2yue+c4DGOVohJCPUzwY= +gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I= +gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/pkg/refs/container_id.go b/pkg/refs/container_id.go new file mode 100644 index 0000000..640ebed --- /dev/null +++ b/pkg/refs/container_id.go @@ -0,0 +1,15 @@ +package refs + +import ( + "crypto/sha256" + + "github.com/mr-tron/base58" +) + +type ( + ContainerID [sha256.Size]byte +) + +func (c ContainerID) String() string { + return base58.Encode(c[:]) +} diff --git a/pkg/refs/neo_wallet.go b/pkg/refs/neo_wallet.go new file mode 100644 index 0000000..4ff7b9b --- /dev/null +++ b/pkg/refs/neo_wallet.go @@ -0,0 +1,37 @@ +package refs + +import ( + "crypto/ecdsa" + + "github.com/mr-tron/base58" + "github.com/nspcc-dev/neo-go/pkg/crypto/keys" + "github.com/pkg/errors" +) + +type ( + NEO3Wallet [25]byte +) + +func NEO3WalletFromPublicKey(key *ecdsa.PublicKey) (owner NEO3Wallet, err error) { + if key == nil { + return owner, errors.New("nil public key") + } + + neoPublicKey := keys.PublicKey{ + X: key.X, + Y: key.Y, + } + + d, err := base58.Decode(neoPublicKey.Address()) + if err != nil { + return owner, errors.Wrap(err, "can't decode neo3 address from key") + } + + copy(owner[:], d) + + return owner, nil +} + +func (w NEO3Wallet) String() string { + return base58.Encode(w[:]) +} diff --git a/pkg/version.go b/pkg/version.go new file mode 100644 index 0000000..333e597 --- /dev/null +++ b/pkg/version.go @@ -0,0 +1,28 @@ +package pkg + +import ( + "fmt" + + "github.com/nspcc-dev/neofs-api-go/v2/refs" +) + +type ( + Version struct { + Major uint32 + Minor uint32 + } +) + +var SDKVersion = Version{2, 0} + +func (v Version) String() string { + return fmt.Sprintf("v%d.%d", v.Major, v.Minor) +} + +func (v Version) ToV2Version() *refs.Version { + result := new(refs.Version) + result.SetMajor(v.Major) + result.SetMinor(v.Minor) + + return result +} From 10137b44dd86c6d677da8fd886f70fbcefe6fdf9 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Tue, 25 Aug 2020 14:47:55 +0300 Subject: [PATCH 0363/1196] [#126] v2: make stable marshal wrapper public This wrapper can be used outside of v2 packages to use SignDataWithHandler function. This function uses DataSource interface and this wrapper implements this interface based on stable marshal structures. Signed-off-by: Alex Vanin --- v2/signature/sign.go | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/v2/signature/sign.go b/v2/signature/sign.go index 8adaf3e..4e7bd23 100644 --- a/v2/signature/sign.go +++ b/v2/signature/sign.go @@ -30,8 +30,8 @@ type stableMarshaler interface { StableSize() int } -type stableMarshalerWrapper struct { - sm stableMarshaler +type StableMarshalerWrapper struct { + SM stableMarshaler } type metaHeader interface { @@ -113,17 +113,17 @@ func (r *responseVerificationHeader) setOrigin(m stableMarshaler) { } } -func (s stableMarshalerWrapper) ReadSignedData(buf []byte) ([]byte, error) { - if s.sm != nil { - return s.sm.StableMarshal(buf) +func (s StableMarshalerWrapper) ReadSignedData(buf []byte) ([]byte, error) { + if s.SM != nil { + return s.SM.StableMarshal(buf) } return nil, nil } -func (s stableMarshalerWrapper) SignedDataSize() int { - if s.sm != nil { - return s.sm.StableSize() +func (s StableMarshalerWrapper) SignedDataSize() int { + if s.SM != nil { + return s.SM.StableSize() } return 0 @@ -210,7 +210,7 @@ func signServiceMessagePart(key *ecdsa.PrivateKey, part stableMarshaler, sigWrit // sign part if err := signature.SignDataWithHandler( key, - &stableMarshalerWrapper{part}, + &StableMarshalerWrapper{part}, keySignatureHandler(sig), ); err != nil { return err @@ -282,7 +282,7 @@ func verifyMatryoshkaLevel(body stableMarshaler, meta metaHeader, verify verific func verifyServiceMessagePart(part stableMarshaler, sigRdr func() *refs.Signature) error { return signature.VerifyDataWithSource( - &stableMarshalerWrapper{part}, + &StableMarshalerWrapper{part}, keySignatureSource(sigRdr()), ) } From 86e6221b7632c567b46a189947c83253d18a918e Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Tue, 25 Aug 2020 14:51:00 +0300 Subject: [PATCH 0364/1196] [#126] sdk: add sdk client for all available api requests Signed-off-by: Alex Vanin --- pkg/accounting/decimal.go | 9 +++ pkg/client/client.go | 50 ++++++++++++++ pkg/client/opts.go | 137 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 196 insertions(+) create mode 100644 pkg/accounting/decimal.go create mode 100644 pkg/client/client.go create mode 100644 pkg/client/opts.go diff --git a/pkg/accounting/decimal.go b/pkg/accounting/decimal.go new file mode 100644 index 0000000..9e73e54 --- /dev/null +++ b/pkg/accounting/decimal.go @@ -0,0 +1,9 @@ +package accounting + +import ( + "github.com/nspcc-dev/neofs-api-go/v2/accounting" +) + +type Decimal struct { + accounting.Decimal +} diff --git a/pkg/client/client.go b/pkg/client/client.go new file mode 100644 index 0000000..8187afd --- /dev/null +++ b/pkg/client/client.go @@ -0,0 +1,50 @@ +package client + +import ( + "crypto/ecdsa" + "errors" + + "github.com/nspcc-dev/neofs-api-go/pkg" +) + +type ( + Client struct { + key *ecdsa.PrivateKey + remoteNode TransportInfo + + opts *clientOptions + } + + TransportProtocol uint32 + + TransportInfo struct { + Version pkg.Version + Protocol TransportProtocol + } +) + +const ( + Unknown TransportProtocol = iota + GRPC +) + +var ( + unsupportedProtocolErr = errors.New("unsupported transport protocol") +) + +func New(key *ecdsa.PrivateKey, opts ...ClientOption) (*Client, error) { + clientOptions := defaultClientOptions() + for i := range opts { + opts[i].apply(clientOptions) + } + + // todo: make handshake to check latest version + return &Client{ + key: key, + remoteNode: TransportInfo{ + Version: pkg.SDKVersion, + Protocol: GRPC, + }, + opts: clientOptions, + }, nil +} diff --git a/pkg/client/opts.go b/pkg/client/opts.go new file mode 100644 index 0000000..93f72d0 --- /dev/null +++ b/pkg/client/opts.go @@ -0,0 +1,137 @@ +package client + +import ( + "github.com/nspcc-dev/neofs-api-go/pkg" + v2accounting "github.com/nspcc-dev/neofs-api-go/v2/accounting" + v2container "github.com/nspcc-dev/neofs-api-go/v2/container" + v2session "github.com/nspcc-dev/neofs-api-go/v2/session" + "google.golang.org/grpc" +) + +type ( + CallOption interface { + apply(*callOptions) + } + + ClientOption interface { + apply(*clientOptions) + } + + xHeader struct { + v2session.XHeader + } + + callOptions struct { + version pkg.Version + xHeaders []xHeader + ttl uint32 + epoch uint64 + // add session token + // add bearer token + } + + clientOptions struct { + addr string + + grpcOpts *grpcOptions + } + + grpcOptions struct { + conn *grpc.ClientConn + v2ContainerClient *v2container.Client + v2AccountingClient *v2accounting.Client + } +) + +func defaultCallOptions() callOptions { + return callOptions{ + ttl: 2, + version: pkg.SDKVersion, + } +} + +type funcCallOption struct { + f func(*callOptions) +} + +func (fco *funcCallOption) apply(co *callOptions) { + fco.f(co) +} + +func newFuncCallOption(f func(option *callOptions)) *funcCallOption { + return &funcCallOption{ + f: f, + } +} + +func WithXHeader(key, value string) CallOption { + return newFuncCallOption(func(option *callOptions) { + xhdr := new(v2session.XHeader) + xhdr.SetKey(key) + xhdr.SetValue(value) + + option.xHeaders = append(option.xHeaders, xHeader{ + XHeader: *xhdr, + }) + }) +} + +func WithTTL(ttl uint32) CallOption { + return newFuncCallOption(func(option *callOptions) { + option.ttl = ttl + }) +} + +func WithEpoch(epoch uint64) CallOption { + return newFuncCallOption(func(option *callOptions) { + option.epoch = epoch + }) +} + +func v2MetaHeaderFromOpts(options callOptions) *v2session.RequestMetaHeader { + meta := new(v2session.RequestMetaHeader) + meta.SetVersion(options.version.ToV2Version()) + meta.SetTTL(options.ttl) + meta.SetEpoch(options.epoch) + + xhdrs := make([]*v2session.XHeader, len(options.xHeaders)) + for i := range options.xHeaders { + xhdrs[i] = &options.xHeaders[i].XHeader + } + + meta.SetXHeaders(xhdrs) + + return meta +} + +func defaultClientOptions() *clientOptions { + return &clientOptions{ + grpcOpts: new(grpcOptions), + } +} + +type funcClientOption struct { + f func(*clientOptions) +} + +func (fco *funcClientOption) apply(co *clientOptions) { + fco.f(co) +} + +func newFuncClientOption(f func(option *clientOptions)) *funcClientOption { + return &funcClientOption{ + f: f, + } +} + +func WithAddress(addr string) ClientOption { + return newFuncClientOption(func(option *clientOptions) { + option.addr = addr + }) +} + +func WithGRPCConnection(grpcConn *grpc.ClientConn) ClientOption { + return newFuncClientOption(func(option *clientOptions) { + option.grpcOpts.conn = grpcConn + }) +} From 25e6b45b5780d2b6ad1ba5c78c2fa46464da824b Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Tue, 25 Aug 2020 14:51:53 +0300 Subject: [PATCH 0365/1196] [#126] sdk: implement accounting rpc in client Signed-off-by: Alex Vanin --- pkg/client/accounting.go | 110 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100644 pkg/client/accounting.go diff --git a/pkg/client/accounting.go b/pkg/client/accounting.go new file mode 100644 index 0000000..6f34154 --- /dev/null +++ b/pkg/client/accounting.go @@ -0,0 +1,110 @@ +package client + +import ( + "context" + + "github.com/nspcc-dev/neofs-api-go/pkg/accounting" + "github.com/nspcc-dev/neofs-api-go/pkg/refs" + v2accounting "github.com/nspcc-dev/neofs-api-go/v2/accounting" + "github.com/nspcc-dev/neofs-api-go/v2/client" + v2refs "github.com/nspcc-dev/neofs-api-go/v2/refs" + v2signature "github.com/nspcc-dev/neofs-api-go/v2/signature" + "github.com/pkg/errors" +) + +func (c Client) GetSelfBalance(ctx context.Context, opts ...CallOption) (*accounting.Decimal, error) { + owner, err := refs.NEO3WalletFromPublicKey(&c.key.PublicKey) + if err != nil { + return nil, err + } + + return c.GetBalance(ctx, owner, opts...) +} + +func (c Client) GetBalance(ctx context.Context, owner refs.NEO3Wallet, opts ...CallOption) (*accounting.Decimal, error) { + // check remote node version + switch c.remoteNode.Version.Major { + case 2: + return c.getBalanceV2(ctx, owner, opts...) + default: + return nil, unsupportedProtocolErr + } +} + +func (c Client) getBalanceV2(ctx context.Context, owner refs.NEO3Wallet, opts ...CallOption) (*accounting.Decimal, error) { + // apply all available options + callOptions := defaultCallOptions() + for i := range opts { + opts[i].apply(&callOptions) + } + + // create V2 unified structures + v2Owner := new(v2refs.OwnerID) + v2Owner.SetValue(owner[:]) + + reqBody := new(v2accounting.BalanceRequestBody) + reqBody.SetOwnerID(v2Owner) + + req := new(v2accounting.BalanceRequest) + req.SetBody(reqBody) + req.SetMetaHeader(v2MetaHeaderFromOpts(callOptions)) + + err := v2signature.SignServiceMessage(c.key, req) + if err != nil { + return nil, err + } + + switch c.remoteNode.Protocol { + case GRPC: + cli, err := v2AccountingClientFromOptions(c.opts) + if err != nil { + return nil, errors.Wrap(err, "can't create grpc client") + } + + resp, err := cli.Balance(ctx, req) + if err != nil { + return nil, errors.Wrap(err, "transport error") + } + + err = v2signature.VerifyServiceMessage(resp) + if err != nil { + return nil, errors.Wrap(err, "can't verify response message") + } + + return &accounting.Decimal{ + Decimal: *resp.GetBody().GetBalance(), + }, nil + default: + return nil, unsupportedProtocolErr + } +} + +func v2AccountingClientFromOptions(opts *clientOptions) (cli *v2accounting.Client, err error) { + switch { + case opts.grpcOpts.v2AccountingClient != nil: + // return value from client cache + return opts.grpcOpts.v2AccountingClient, nil + + case opts.grpcOpts.conn != nil: + cli, err = v2accounting.NewClient(v2accounting.WithGlobalOpts( + client.WithGRPCConn(opts.grpcOpts.conn)), + ) + + case opts.addr != "": + cli, err = v2accounting.NewClient(v2accounting.WithGlobalOpts( + client.WithNetworkAddress(opts.addr)), + ) + + default: + return nil, errors.New("lack of sdk client options to create accounting client") + } + + // check if client correct and save in cache + if err != nil { + return nil, err + } + + opts.grpcOpts.v2AccountingClient = cli + + return cli, nil +} From aa539cd0c4845cbd036c516534b38ebc84ee20b9 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Tue, 25 Aug 2020 14:52:18 +0300 Subject: [PATCH 0366/1196] [#126] sdk: implement container rpc for in client Signed-off-by: Alex Vanin --- pkg/acl/types.go | 7 + pkg/client/container.go | 319 +++++++++++++++++++++++++++++++++++++ pkg/container/container.go | 45 ++++++ pkg/container/opts.go | 99 ++++++++++++ 4 files changed, 470 insertions(+) create mode 100644 pkg/acl/types.go create mode 100644 pkg/client/container.go create mode 100644 pkg/container/container.go create mode 100644 pkg/container/opts.go diff --git a/pkg/acl/types.go b/pkg/acl/types.go new file mode 100644 index 0000000..8bae41c --- /dev/null +++ b/pkg/acl/types.go @@ -0,0 +1,7 @@ +package acl + +const ( + PublicBasicRule = 0x1FFFFFFF + PrivateBasicRule = 0x18888888 + ReadOnlyBasicRule = 0x1FFF88FF +) diff --git a/pkg/client/container.go b/pkg/client/container.go new file mode 100644 index 0000000..f121b7f --- /dev/null +++ b/pkg/client/container.go @@ -0,0 +1,319 @@ +package client + +import ( + "context" + + "github.com/nspcc-dev/neofs-api-go/pkg/container" + "github.com/nspcc-dev/neofs-api-go/pkg/refs" + "github.com/nspcc-dev/neofs-api-go/util/signature" + "github.com/nspcc-dev/neofs-api-go/v2/client" + v2container "github.com/nspcc-dev/neofs-api-go/v2/container" + v2refs "github.com/nspcc-dev/neofs-api-go/v2/refs" + v2signature "github.com/nspcc-dev/neofs-api-go/v2/signature" + "github.com/pkg/errors" +) + +func (c Client) PutContainer(ctx context.Context, cnr *container.Container, opts ...CallOption) (refs.ContainerID, error) { + switch c.remoteNode.Version.Major { + case 2: + return c.putContainerV2(ctx, cnr, opts...) + default: + return refs.ContainerID{}, unsupportedProtocolErr + } +} + +func (c Client) GetContainer(ctx context.Context, id refs.ContainerID, opts ...CallOption) (*container.Container, error) { + switch c.remoteNode.Version.Major { + case 2: + return c.getContainerV2(ctx, id, opts...) + default: + return nil, unsupportedProtocolErr + } +} + +func (c Client) ListContainers(ctx context.Context, owner refs.NEO3Wallet, opts ...CallOption) ([]refs.ContainerID, error) { + switch c.remoteNode.Version.Major { + case 2: + return c.listContainerV2(ctx, owner, opts...) + default: + return nil, unsupportedProtocolErr + } +} + +func (c Client) ListSelfContainers(ctx context.Context, opts ...CallOption) ([]refs.ContainerID, error) { + owner, err := refs.NEO3WalletFromPublicKey(&c.key.PublicKey) + if err != nil { + return nil, err + } + + return c.ListContainers(ctx, owner, opts...) +} + +func (c Client) DeleteContainer(ctx context.Context, id refs.ContainerID, opts ...CallOption) error { + switch c.remoteNode.Version.Major { + case 2: + panic("not implemented") + default: + return unsupportedProtocolErr + } +} + +// todo: func (c Client) GetExtendedACL +// todo: func (c Client) SetExtendedACL + +func (c Client) putContainerV2(ctx context.Context, cnr *container.Container, opts ...CallOption) (refs.ContainerID, error) { + // apply all available options + callOptions := defaultCallOptions() + for i := range opts { + opts[i].apply(&callOptions) + } + + cid := refs.ContainerID{} + + // set transport version + cnr.SetVersion(c.remoteNode.Version.ToV2Version()) + + // if container owner is not set, then use client key as owner + if cnr.GetOwnerID() == nil { + owner, err := refs.NEO3WalletFromPublicKey(&c.key.PublicKey) + if err != nil { + return cid, err + } + + v2Owner := new(v2refs.OwnerID) + v2Owner.SetValue(owner[:]) + cnr.SetOwnerID(v2Owner) + } + + reqBody := new(v2container.PutRequestBody) + reqBody.SetContainer(&cnr.Container) + + // sign container + signWrapper := v2signature.StableMarshalerWrapper{SM: reqBody.GetContainer()} + err := signature.SignDataWithHandler(c.key, signWrapper, func(key []byte, sig []byte) { + containerSignature := new(v2refs.Signature) + containerSignature.SetKey(key) + containerSignature.SetSign(sig) + reqBody.SetSignature(containerSignature) + }, signature.SignWithRFC6979()) + if err != nil { + return cid, err + } + + req := new(v2container.PutRequest) + req.SetBody(reqBody) + req.SetMetaHeader(v2MetaHeaderFromOpts(callOptions)) + + err = v2signature.SignServiceMessage(c.key, req) + if err != nil { + return cid, err + } + + switch c.remoteNode.Protocol { + case GRPC: + cli, err := v2ContainerClientFromOptions(c.opts) + if err != nil { + return cid, errors.Wrap(err, "can't create grpc client") + } + + resp, err := cli.Put(ctx, req) + if err != nil { + return cid, errors.Wrap(err, "transport error") + } + + err = v2signature.VerifyServiceMessage(resp) + if err != nil { + return cid, errors.Wrap(err, "can't verify response message") + } + + copy(cid[:], resp.GetBody().GetContainerID().GetValue()) + + return cid, nil + default: + return cid, unsupportedProtocolErr + } +} + +func (c Client) getContainerV2(ctx context.Context, id refs.ContainerID, opts ...CallOption) (*container.Container, error) { + // apply all available options + callOptions := defaultCallOptions() + for i := range opts { + opts[i].apply(&callOptions) + } + + cid := new(v2refs.ContainerID) + cid.SetValue(id[:]) + + reqBody := new(v2container.GetRequestBody) + reqBody.SetContainerID(cid) + + req := new(v2container.GetRequest) + req.SetBody(reqBody) + req.SetMetaHeader(v2MetaHeaderFromOpts(callOptions)) + + err := v2signature.SignServiceMessage(c.key, req) + if err != nil { + return nil, err + } + + switch c.remoteNode.Protocol { + case GRPC: + cli, err := v2ContainerClientFromOptions(c.opts) + if err != nil { + return nil, errors.Wrap(err, "can't create grpc client") + } + + resp, err := cli.Get(ctx, req) + if err != nil { + return nil, errors.Wrap(err, "transport error") + } + + err = v2signature.VerifyServiceMessage(resp) + if err != nil { + return nil, errors.Wrap(err, "can't verify response message") + } + + return &container.Container{ + Container: *resp.GetBody().GetContainer(), + }, nil + default: + return nil, unsupportedProtocolErr + } +} + +func (c Client) listContainerV2(ctx context.Context, owner refs.NEO3Wallet, opts ...CallOption) ([]refs.ContainerID, error) { + // apply all available options + callOptions := defaultCallOptions() + for i := range opts { + opts[i].apply(&callOptions) + } + + v2owner := new(v2refs.OwnerID) + v2owner.SetValue(owner[:]) + + reqBody := new(v2container.ListRequestBody) + reqBody.SetOwnerID(v2owner) + + req := new(v2container.ListRequest) + req.SetBody(reqBody) + req.SetMetaHeader(v2MetaHeaderFromOpts(callOptions)) + + err := v2signature.SignServiceMessage(c.key, req) + if err != nil { + return nil, err + } + + switch c.remoteNode.Protocol { + case GRPC: + cli, err := v2ContainerClientFromOptions(c.opts) + if err != nil { + return nil, errors.Wrap(err, "can't create grpc client") + } + + resp, err := cli.List(ctx, req) + if err != nil { + return nil, errors.Wrap(err, "transport error") + } + + err = v2signature.VerifyServiceMessage(resp) + if err != nil { + return nil, errors.Wrap(err, "can't verify response message") + } + + result := make([]refs.ContainerID, len(resp.GetBody().GetContainerIDs())) + for i, cid := range resp.GetBody().GetContainerIDs() { + copy(result[i][:], cid.GetValue()) + } + + return result, nil + default: + return nil, unsupportedProtocolErr + } +} + +func (c Client) delContainerV2(ctx context.Context, id refs.ContainerID, opts ...CallOption) error { + // apply all available options + callOptions := defaultCallOptions() + for i := range opts { + opts[i].apply(&callOptions) + } + + cid := new(v2refs.ContainerID) + cid.SetValue(id[:]) + + reqBody := new(v2container.DeleteRequestBody) + reqBody.SetContainerID(cid) + + // sign container + signWrapper := v2signature.StableMarshalerWrapper{SM: reqBody.GetContainerID()} + err := signature.SignDataWithHandler(c.key, signWrapper, func(key []byte, sig []byte) { + containerSignature := new(v2refs.Signature) + containerSignature.SetKey(key) + containerSignature.SetSign(sig) + reqBody.SetSignature(containerSignature) + }, signature.SignWithRFC6979()) + if err != nil { + return err + } + + req := new(v2container.DeleteRequest) + req.SetBody(reqBody) + req.SetMetaHeader(v2MetaHeaderFromOpts(callOptions)) + + err = v2signature.SignServiceMessage(c.key, req) + if err != nil { + return err + } + + switch c.remoteNode.Protocol { + case GRPC: + cli, err := v2ContainerClientFromOptions(c.opts) + if err != nil { + return errors.Wrap(err, "can't create grpc client") + } + + resp, err := cli.Delete(ctx, req) + if err != nil { + return errors.Wrap(err, "transport error") + } + + err = v2signature.VerifyServiceMessage(resp) + if err != nil { + return errors.Wrap(err, "can't verify response message") + } + + return nil + default: + return unsupportedProtocolErr + } +} + +func v2ContainerClientFromOptions(opts *clientOptions) (cli *v2container.Client, err error) { + switch { + case opts.grpcOpts.v2ContainerClient != nil: + // return value from client cache + return opts.grpcOpts.v2ContainerClient, nil + + case opts.grpcOpts.conn != nil: + cli, err = v2container.NewClient(v2container.WithGlobalOpts( + client.WithGRPCConn(opts.grpcOpts.conn)), + ) + + case opts.addr != "": + cli, err = v2container.NewClient(v2container.WithGlobalOpts( + client.WithNetworkAddress(opts.addr)), + ) + + default: + return nil, errors.New("lack of sdk client options to create accounting client") + } + + // check if client correct and save in cache + if err != nil { + return nil, err + } + + opts.grpcOpts.v2ContainerClient = cli + + return cli, nil +} diff --git a/pkg/container/container.go b/pkg/container/container.go new file mode 100644 index 0000000..d142d3e --- /dev/null +++ b/pkg/container/container.go @@ -0,0 +1,45 @@ +package container + +import ( + "github.com/nspcc-dev/neofs-api-go/v2/container" + "github.com/nspcc-dev/neofs-api-go/v2/refs" +) + +type Container struct { + container.Container +} + +func New(opts ...NewOption) (*Container, error) { + cnrOptions := defaultContainerOptions() + for i := range opts { + opts[i].apply(&cnrOptions) + } + + cnr := new(Container) + cnr.SetNonce(cnrOptions.nonce[:]) + cnr.SetBasicACL(cnrOptions.acl) + + if cnrOptions.policy != "" { + // todo: set placement policy + } + + if cnrOptions.owner != nil { + owner := new(refs.OwnerID) + owner.SetValue(cnrOptions.owner[:]) + + cnr.SetOwnerID(owner) + } + + attributes := make([]*container.Attribute, len(cnrOptions.attributes)) + for i := range cnrOptions.attributes { + attribute := new(container.Attribute) + attribute.SetKey(cnrOptions.attributes[i].key) + attribute.SetValue(cnrOptions.attributes[i].value) + attributes[i] = attribute + } + if len(attributes) > 0 { + cnr.SetAttributes(attributes) + } + + return cnr, nil +} diff --git a/pkg/container/opts.go b/pkg/container/opts.go new file mode 100644 index 0000000..507c988 --- /dev/null +++ b/pkg/container/opts.go @@ -0,0 +1,99 @@ +package container + +import ( + "github.com/google/uuid" + "github.com/nspcc-dev/neofs-api-go/pkg/acl" + "github.com/nspcc-dev/neofs-api-go/pkg/refs" +) + +type ( + NewOption interface { + apply(*containerOptions) + } + + attribute struct { + key string + value string + } + + containerOptions struct { + acl uint32 + policy string + attributes []attribute + owner *refs.NEO3Wallet + nonce uuid.UUID + } +) + +func defaultContainerOptions() containerOptions { + rand, err := uuid.NewRandom() + if err != nil { + panic("can't create new random " + err.Error()) + } + + return containerOptions{ + acl: acl.PrivateBasicRule, + nonce: rand, + } +} + +type funcContainerOption struct { + f func(*containerOptions) +} + +func (fco *funcContainerOption) apply(co *containerOptions) { + fco.f(co) +} + +func newFuncContainerOption(f func(option *containerOptions)) *funcContainerOption { + return &funcContainerOption{ + f: f, + } +} + +func WithPublicBasicACL() NewOption { + return newFuncContainerOption(func(option *containerOptions) { + option.acl = acl.PublicBasicRule + }) +} + +func WithReadOnlyBasicACL() NewOption { + return newFuncContainerOption(func(option *containerOptions) { + option.acl = acl.ReadOnlyBasicRule + }) +} + +func WithCustomBasicACL(acl uint32) NewOption { + return newFuncContainerOption(func(option *containerOptions) { + option.acl = acl + }) +} + +func WithNonce(nonce uuid.UUID) NewOption { + return newFuncContainerOption(func(option *containerOptions) { + option.nonce = nonce + }) +} + +func WithOwner(owner refs.NEO3Wallet) NewOption { + return newFuncContainerOption(func(option *containerOptions) { + option.owner = &owner + }) +} + +func WithPolicy(policy string) NewOption { + return newFuncContainerOption(func(option *containerOptions) { + // todo: make sanity check and store binary structure + option.policy = policy + }) +} + +func WithAttribute(key, value string) NewOption { + return newFuncContainerOption(func(option *containerOptions) { + attr := attribute{ + key: key, + value: value, + } + option.attributes = append(option.attributes, attr) + }) +} From 7f4544ede0ef92baee46657cdbf7cb1550c0a620 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Tue, 25 Aug 2020 15:11:06 +0300 Subject: [PATCH 0367/1196] [#126] sdk: add usage example Signed-off-by: Alex Vanin --- pkg/client/client_test.go | 58 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 pkg/client/client_test.go diff --git a/pkg/client/client_test.go b/pkg/client/client_test.go new file mode 100644 index 0000000..c3d7b0d --- /dev/null +++ b/pkg/client/client_test.go @@ -0,0 +1,58 @@ +package client_test + +import ( + "context" + "fmt" + "testing" + "time" + + "github.com/nspcc-dev/neofs-api-go/pkg/client" + "github.com/nspcc-dev/neofs-api-go/pkg/container" + "github.com/nspcc-dev/neofs-crypto/test" + "github.com/stretchr/testify/require" + "google.golang.org/grpc" +) + +func TestExample(t *testing.T) { + t.Skip() + target := "s01.localtest.nspcc.ru:50501" + key := test.DecodeKey(-1) + + // create client from address + cli, err := client.New(key, client.WithAddress(target)) + require.NoError(t, err) + + // ask for balance + resp, err := cli.GetSelfBalance(context.Background()) + require.NoError(t, err) + + fmt.Println(resp.GetValue(), resp.GetPrecision()) + + // create client from grpc connection + conn, err := grpc.DialContext(context.Background(), target, grpc.WithBlock(), grpc.WithInsecure()) + require.NoError(t, err) + + cli, err = client.New(key, client.WithGRPCConnection(conn)) + require.NoError(t, err) + + // this container has random nonce and it does not set owner id + cnr, err := container.New( + container.WithAttribute("CreatedAt", time.Now().String()), + container.WithPolicy("PUT 3 In *"), + container.WithReadOnlyBasicACL(), + ) + require.NoError(t, err) + + // here container will have owner id from client key, and it will be signed + containerID, err := cli.PutContainer(context.Background(), cnr, client.WithTTL(10)) + require.NoError(t, err) + + fmt.Println(containerID) + + list, err := cli.ListSelfContainers(context.Background()) + require.NoError(t, err) + + for i := range list { + fmt.Println("found container:", list[i]) + } +} From 8df69c40420208abde45c4782f8cab2875b489f3 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 28 Aug 2020 10:27:41 +0300 Subject: [PATCH 0368/1196] sdk: Define container identifier type Signed-off-by: Leonard Lyubich --- pkg/container/id.go | 51 ++++++++++++++++++++++++++++++++++++++++ pkg/container/id_test.go | 27 +++++++++++++++++++++ 2 files changed, 78 insertions(+) create mode 100644 pkg/container/id.go create mode 100644 pkg/container/id_test.go diff --git a/pkg/container/id.go b/pkg/container/id.go new file mode 100644 index 0000000..5bccc07 --- /dev/null +++ b/pkg/container/id.go @@ -0,0 +1,51 @@ +package container + +import ( + "crypto/sha256" + + "github.com/nspcc-dev/neofs-api-go/v2/refs" + "github.com/pkg/errors" +) + +// ID represents container identifier +// that supports different type of values. +type ID struct { + val []byte +} + +// SetSHA256 sets container identifier value to SHA256 checksum. +func (id *ID) SetSHA256(v [sha256.Size]byte) { + if id != nil { + id.val = v[:] + } +} + +// ToV2 returns the v2 container ID message. +func (id *ID) ToV2() *refs.ContainerID { + if id != nil { + idV2 := new(refs.ContainerID) + idV2.SetValue(id.val) + + return idV2 + } + + return nil +} + +func IDFromV2(idV2 *refs.ContainerID) (*ID, error) { + if idV2 == nil { + return nil, nil + } + + val := idV2.GetValue() + if ln := len(val); ln != sha256.Size { + return nil, errors.Errorf( + "could not convert %T to %T: expected length %d, received %d", + idV2, (*ID)(nil), sha256.Size, ln, + ) + } + + return &ID{ + val: val, + }, nil +} diff --git a/pkg/container/id_test.go b/pkg/container/id_test.go new file mode 100644 index 0000000..245f433 --- /dev/null +++ b/pkg/container/id_test.go @@ -0,0 +1,27 @@ +package container + +import ( + "crypto/rand" + "crypto/sha256" + "testing" + + "github.com/stretchr/testify/require" +) + +func TestIDV2_0(t *testing.T) { + cid := new(ID) + + checksum := [sha256.Size]byte{} + + _, err := rand.Read(checksum[:]) + require.NoError(t, err) + + cid.SetSHA256(checksum) + + cidV2 := cid.ToV2() + + cid2, err := IDFromV2(cidV2) + require.NoError(t, err) + + require.Equal(t, cid, cid2) +} From 2b20230d7f54989ea963657f5645fb117c0bd836 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 28 Aug 2020 16:14:04 +0300 Subject: [PATCH 0369/1196] [#128] sdk: Remove old container ID with the new one Signed-off-by: Leonard Lyubich --- pkg/client/container.go | 64 +++++++++++++++++++++------------------- pkg/refs/container_id.go | 15 ---------- 2 files changed, 33 insertions(+), 46 deletions(-) delete mode 100644 pkg/refs/container_id.go diff --git a/pkg/client/container.go b/pkg/client/container.go index f121b7f..5e98f08 100644 --- a/pkg/client/container.go +++ b/pkg/client/container.go @@ -13,16 +13,16 @@ import ( "github.com/pkg/errors" ) -func (c Client) PutContainer(ctx context.Context, cnr *container.Container, opts ...CallOption) (refs.ContainerID, error) { +func (c Client) PutContainer(ctx context.Context, cnr *container.Container, opts ...CallOption) (*container.ID, error) { switch c.remoteNode.Version.Major { case 2: return c.putContainerV2(ctx, cnr, opts...) default: - return refs.ContainerID{}, unsupportedProtocolErr + return nil, unsupportedProtocolErr } } -func (c Client) GetContainer(ctx context.Context, id refs.ContainerID, opts ...CallOption) (*container.Container, error) { +func (c Client) GetContainer(ctx context.Context, id *container.ID, opts ...CallOption) (*container.Container, error) { switch c.remoteNode.Version.Major { case 2: return c.getContainerV2(ctx, id, opts...) @@ -31,7 +31,7 @@ func (c Client) GetContainer(ctx context.Context, id refs.ContainerID, opts ...C } } -func (c Client) ListContainers(ctx context.Context, owner refs.NEO3Wallet, opts ...CallOption) ([]refs.ContainerID, error) { +func (c Client) ListContainers(ctx context.Context, owner refs.NEO3Wallet, opts ...CallOption) ([]*container.ID, error) { switch c.remoteNode.Version.Major { case 2: return c.listContainerV2(ctx, owner, opts...) @@ -40,7 +40,7 @@ func (c Client) ListContainers(ctx context.Context, owner refs.NEO3Wallet, opts } } -func (c Client) ListSelfContainers(ctx context.Context, opts ...CallOption) ([]refs.ContainerID, error) { +func (c Client) ListSelfContainers(ctx context.Context, opts ...CallOption) ([]*container.ID, error) { owner, err := refs.NEO3WalletFromPublicKey(&c.key.PublicKey) if err != nil { return nil, err @@ -49,7 +49,7 @@ func (c Client) ListSelfContainers(ctx context.Context, opts ...CallOption) ([]r return c.ListContainers(ctx, owner, opts...) } -func (c Client) DeleteContainer(ctx context.Context, id refs.ContainerID, opts ...CallOption) error { +func (c Client) DeleteContainer(ctx context.Context, id *container.ID, opts ...CallOption) error { switch c.remoteNode.Version.Major { case 2: panic("not implemented") @@ -61,15 +61,13 @@ func (c Client) DeleteContainer(ctx context.Context, id refs.ContainerID, opts . // todo: func (c Client) GetExtendedACL // todo: func (c Client) SetExtendedACL -func (c Client) putContainerV2(ctx context.Context, cnr *container.Container, opts ...CallOption) (refs.ContainerID, error) { +func (c Client) putContainerV2(ctx context.Context, cnr *container.Container, opts ...CallOption) (*container.ID, error) { // apply all available options callOptions := defaultCallOptions() for i := range opts { opts[i].apply(&callOptions) } - cid := refs.ContainerID{} - // set transport version cnr.SetVersion(c.remoteNode.Version.ToV2Version()) @@ -77,7 +75,7 @@ func (c Client) putContainerV2(ctx context.Context, cnr *container.Container, op if cnr.GetOwnerID() == nil { owner, err := refs.NEO3WalletFromPublicKey(&c.key.PublicKey) if err != nil { - return cid, err + return nil, err } v2Owner := new(v2refs.OwnerID) @@ -97,7 +95,7 @@ func (c Client) putContainerV2(ctx context.Context, cnr *container.Container, op reqBody.SetSignature(containerSignature) }, signature.SignWithRFC6979()) if err != nil { - return cid, err + return nil, err } req := new(v2container.PutRequest) @@ -106,46 +104,48 @@ func (c Client) putContainerV2(ctx context.Context, cnr *container.Container, op err = v2signature.SignServiceMessage(c.key, req) if err != nil { - return cid, err + return nil, err } switch c.remoteNode.Protocol { case GRPC: cli, err := v2ContainerClientFromOptions(c.opts) if err != nil { - return cid, errors.Wrap(err, "can't create grpc client") + return nil, errors.Wrap(err, "can't create grpc client") } resp, err := cli.Put(ctx, req) if err != nil { - return cid, errors.Wrap(err, "transport error") + return nil, errors.Wrap(err, "transport error") } err = v2signature.VerifyServiceMessage(resp) if err != nil { - return cid, errors.Wrap(err, "can't verify response message") + return nil, errors.Wrap(err, "can't verify response message") } - copy(cid[:], resp.GetBody().GetContainerID().GetValue()) + cidV2 := resp.GetBody().GetContainerID() + + cid, err := container.IDFromV2(cidV2) + if err != nil { + return nil, errors.Wrapf(err, "could not convert %T to %T", cidV2, cid) + } return cid, nil default: - return cid, unsupportedProtocolErr + return nil, unsupportedProtocolErr } } -func (c Client) getContainerV2(ctx context.Context, id refs.ContainerID, opts ...CallOption) (*container.Container, error) { +func (c Client) getContainerV2(ctx context.Context, id *container.ID, opts ...CallOption) (*container.Container, error) { // apply all available options callOptions := defaultCallOptions() for i := range opts { opts[i].apply(&callOptions) } - cid := new(v2refs.ContainerID) - cid.SetValue(id[:]) - reqBody := new(v2container.GetRequestBody) - reqBody.SetContainerID(cid) + reqBody.SetContainerID(id.ToV2()) req := new(v2container.GetRequest) req.SetBody(reqBody) @@ -181,7 +181,7 @@ func (c Client) getContainerV2(ctx context.Context, id refs.ContainerID, opts .. } } -func (c Client) listContainerV2(ctx context.Context, owner refs.NEO3Wallet, opts ...CallOption) ([]refs.ContainerID, error) { +func (c Client) listContainerV2(ctx context.Context, owner refs.NEO3Wallet, opts ...CallOption) ([]*container.ID, error) { // apply all available options callOptions := defaultCallOptions() for i := range opts { @@ -220,9 +220,14 @@ func (c Client) listContainerV2(ctx context.Context, owner refs.NEO3Wallet, opts return nil, errors.Wrap(err, "can't verify response message") } - result := make([]refs.ContainerID, len(resp.GetBody().GetContainerIDs())) - for i, cid := range resp.GetBody().GetContainerIDs() { - copy(result[i][:], cid.GetValue()) + result := make([]*container.ID, 0, len(resp.GetBody().GetContainerIDs())) + for _, cidV2 := range resp.GetBody().GetContainerIDs() { + cid, err := container.IDFromV2(cidV2) + if err != nil { + return nil, errors.Wrapf(err, "could not convert %T to %T", cidV2, cid) + } + + result = append(result, cid) } return result, nil @@ -231,18 +236,15 @@ func (c Client) listContainerV2(ctx context.Context, owner refs.NEO3Wallet, opts } } -func (c Client) delContainerV2(ctx context.Context, id refs.ContainerID, opts ...CallOption) error { +func (c Client) delContainerV2(ctx context.Context, id *container.ID, opts ...CallOption) error { // apply all available options callOptions := defaultCallOptions() for i := range opts { opts[i].apply(&callOptions) } - cid := new(v2refs.ContainerID) - cid.SetValue(id[:]) - reqBody := new(v2container.DeleteRequestBody) - reqBody.SetContainerID(cid) + reqBody.SetContainerID(id.ToV2()) // sign container signWrapper := v2signature.StableMarshalerWrapper{SM: reqBody.GetContainerID()} diff --git a/pkg/refs/container_id.go b/pkg/refs/container_id.go deleted file mode 100644 index 640ebed..0000000 --- a/pkg/refs/container_id.go +++ /dev/null @@ -1,15 +0,0 @@ -package refs - -import ( - "crypto/sha256" - - "github.com/mr-tron/base58" -) - -type ( - ContainerID [sha256.Size]byte -) - -func (c ContainerID) String() string { - return base58.Encode(c[:]) -} From 1c3e69721be4b26f4f9ce291bce4505ecf0c58ad Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 31 Aug 2020 10:45:46 +0300 Subject: [PATCH 0370/1196] [#128] sdk: Implement Bytes method on NEO3Wallet type Signed-off-by: Leonard Lyubich --- pkg/refs/neo_wallet.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pkg/refs/neo_wallet.go b/pkg/refs/neo_wallet.go index 4ff7b9b..58f64a8 100644 --- a/pkg/refs/neo_wallet.go +++ b/pkg/refs/neo_wallet.go @@ -35,3 +35,11 @@ func NEO3WalletFromPublicKey(key *ecdsa.PublicKey) (owner NEO3Wallet, err error) func (w NEO3Wallet) String() string { return base58.Encode(w[:]) } + +func (w *NEO3Wallet) Bytes() []byte { + if w != nil { + return w[:] + } + + return nil +} From c9d38aa2e1d659e4c0b9d934c7b9e5fd64059e50 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 31 Aug 2020 10:46:10 +0300 Subject: [PATCH 0371/1196] [#128] sdk: Implement owner ID type Signed-off-by: Leonard Lyubich --- pkg/owner/id.go | 52 ++++++++++++++++++++++++++++++++++++++++++++ pkg/owner/id_test.go | 27 +++++++++++++++++++++++ 2 files changed, 79 insertions(+) create mode 100644 pkg/owner/id.go create mode 100644 pkg/owner/id_test.go diff --git a/pkg/owner/id.go b/pkg/owner/id.go new file mode 100644 index 0000000..d00cd9e --- /dev/null +++ b/pkg/owner/id.go @@ -0,0 +1,52 @@ +package owner + +import ( + "crypto/sha256" + + "github.com/nspcc-dev/neofs-api-go/pkg/refs" + refsV2 "github.com/nspcc-dev/neofs-api-go/v2/refs" + "github.com/pkg/errors" +) + +// ID represents owner identifier that +// supports different type of values. +type ID struct { + val []byte +} + +// SetNeo3Wallet sets owner identifier value to NEO3 wallet address. +func (id *ID) SetNeo3Wallet(v *refs.NEO3Wallet) { + if id != nil { + id.val = v.Bytes() + } +} + +// ToV2 returns the v2 owner ID message. +func (id *ID) ToV2() *refsV2.OwnerID { + if id != nil { + idV2 := new(refsV2.OwnerID) + idV2.SetValue(id.val) + + return idV2 + } + + return nil +} + +func IDFromV2(idV2 *refsV2.OwnerID) (*ID, error) { + if idV2 == nil { + return nil, nil + } + + val := idV2.GetValue() + if ln := len(val); ln != 25 { + return nil, errors.Errorf( + "could not convert %T to %T: expected length %d, received %d", + idV2, (*ID)(nil), sha256.Size, ln, + ) + } + + return &ID{ + val: val, + }, nil +} diff --git a/pkg/owner/id_test.go b/pkg/owner/id_test.go new file mode 100644 index 0000000..56c39a6 --- /dev/null +++ b/pkg/owner/id_test.go @@ -0,0 +1,27 @@ +package owner + +import ( + "crypto/rand" + "testing" + + "github.com/nspcc-dev/neofs-api-go/pkg/refs" + "github.com/stretchr/testify/require" +) + +func TestIDV2(t *testing.T) { + id := new(ID) + + wallet := new(refs.NEO3Wallet) + + _, err := rand.Read(wallet.Bytes()) + require.NoError(t, err) + + id.SetNeo3Wallet(wallet) + + idV2 := id.ToV2() + + id2, err := IDFromV2(idV2) + require.NoError(t, err) + + require.Equal(t, id, id2) +} From 63c8d6e9ea914d46bd3ccfec3cafd1a029a8dac9 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 31 Aug 2020 11:15:46 +0300 Subject: [PATCH 0372/1196] [#128] sdk: Use owner ID instead of NEO3Wallet Replace owner.NEO3Wallet usage with owner.ID usage. Functions that process the wallet address convert it to the owner identifier through the public method. Signed-off-by: Leonard Lyubich --- pkg/client/accounting.go | 20 +++++++------- pkg/client/container.go | 33 ++++++++++++------------ pkg/container/container.go | 6 +---- pkg/container/opts.go | 18 ++++++++++--- pkg/owner/id.go | 12 ++++----- pkg/owner/id_test.go | 3 +-- pkg/owner/wallet.go | 53 ++++++++++++++++++++++++++++++++++++++ pkg/refs/neo_wallet.go | 45 -------------------------------- 8 files changed, 101 insertions(+), 89 deletions(-) create mode 100644 pkg/owner/wallet.go delete mode 100644 pkg/refs/neo_wallet.go diff --git a/pkg/client/accounting.go b/pkg/client/accounting.go index 6f34154..4642c9d 100644 --- a/pkg/client/accounting.go +++ b/pkg/client/accounting.go @@ -4,24 +4,26 @@ import ( "context" "github.com/nspcc-dev/neofs-api-go/pkg/accounting" - "github.com/nspcc-dev/neofs-api-go/pkg/refs" + "github.com/nspcc-dev/neofs-api-go/pkg/owner" v2accounting "github.com/nspcc-dev/neofs-api-go/v2/accounting" "github.com/nspcc-dev/neofs-api-go/v2/client" - v2refs "github.com/nspcc-dev/neofs-api-go/v2/refs" v2signature "github.com/nspcc-dev/neofs-api-go/v2/signature" "github.com/pkg/errors" ) func (c Client) GetSelfBalance(ctx context.Context, opts ...CallOption) (*accounting.Decimal, error) { - owner, err := refs.NEO3WalletFromPublicKey(&c.key.PublicKey) + w, err := owner.NEO3WalletFromPublicKey(&c.key.PublicKey) if err != nil { return nil, err } - return c.GetBalance(ctx, owner, opts...) + ownerID := new(owner.ID) + ownerID.SetNeo3Wallet(w) + + return c.GetBalance(ctx, ownerID, opts...) } -func (c Client) GetBalance(ctx context.Context, owner refs.NEO3Wallet, opts ...CallOption) (*accounting.Decimal, error) { +func (c Client) GetBalance(ctx context.Context, owner *owner.ID, opts ...CallOption) (*accounting.Decimal, error) { // check remote node version switch c.remoteNode.Version.Major { case 2: @@ -31,19 +33,15 @@ func (c Client) GetBalance(ctx context.Context, owner refs.NEO3Wallet, opts ...C } } -func (c Client) getBalanceV2(ctx context.Context, owner refs.NEO3Wallet, opts ...CallOption) (*accounting.Decimal, error) { +func (c Client) getBalanceV2(ctx context.Context, owner *owner.ID, opts ...CallOption) (*accounting.Decimal, error) { // apply all available options callOptions := defaultCallOptions() for i := range opts { opts[i].apply(&callOptions) } - // create V2 unified structures - v2Owner := new(v2refs.OwnerID) - v2Owner.SetValue(owner[:]) - reqBody := new(v2accounting.BalanceRequestBody) - reqBody.SetOwnerID(v2Owner) + reqBody.SetOwnerID(owner.ToV2()) req := new(v2accounting.BalanceRequest) req.SetBody(reqBody) diff --git a/pkg/client/container.go b/pkg/client/container.go index 5e98f08..ef72a83 100644 --- a/pkg/client/container.go +++ b/pkg/client/container.go @@ -4,11 +4,11 @@ import ( "context" "github.com/nspcc-dev/neofs-api-go/pkg/container" - "github.com/nspcc-dev/neofs-api-go/pkg/refs" + "github.com/nspcc-dev/neofs-api-go/pkg/owner" "github.com/nspcc-dev/neofs-api-go/util/signature" "github.com/nspcc-dev/neofs-api-go/v2/client" v2container "github.com/nspcc-dev/neofs-api-go/v2/container" - v2refs "github.com/nspcc-dev/neofs-api-go/v2/refs" + "github.com/nspcc-dev/neofs-api-go/v2/refs" v2signature "github.com/nspcc-dev/neofs-api-go/v2/signature" "github.com/pkg/errors" ) @@ -31,7 +31,7 @@ func (c Client) GetContainer(ctx context.Context, id *container.ID, opts ...Call } } -func (c Client) ListContainers(ctx context.Context, owner refs.NEO3Wallet, opts ...CallOption) ([]*container.ID, error) { +func (c Client) ListContainers(ctx context.Context, owner *owner.ID, opts ...CallOption) ([]*container.ID, error) { switch c.remoteNode.Version.Major { case 2: return c.listContainerV2(ctx, owner, opts...) @@ -41,12 +41,15 @@ func (c Client) ListContainers(ctx context.Context, owner refs.NEO3Wallet, opts } func (c Client) ListSelfContainers(ctx context.Context, opts ...CallOption) ([]*container.ID, error) { - owner, err := refs.NEO3WalletFromPublicKey(&c.key.PublicKey) + w, err := owner.NEO3WalletFromPublicKey(&c.key.PublicKey) if err != nil { return nil, err } - return c.ListContainers(ctx, owner, opts...) + ownerID := new(owner.ID) + ownerID.SetNeo3Wallet(w) + + return c.ListContainers(ctx, ownerID, opts...) } func (c Client) DeleteContainer(ctx context.Context, id *container.ID, opts ...CallOption) error { @@ -73,14 +76,15 @@ func (c Client) putContainerV2(ctx context.Context, cnr *container.Container, op // if container owner is not set, then use client key as owner if cnr.GetOwnerID() == nil { - owner, err := refs.NEO3WalletFromPublicKey(&c.key.PublicKey) + w, err := owner.NEO3WalletFromPublicKey(&c.key.PublicKey) if err != nil { return nil, err } - v2Owner := new(v2refs.OwnerID) - v2Owner.SetValue(owner[:]) - cnr.SetOwnerID(v2Owner) + ownerID := new(owner.ID) + ownerID.SetNeo3Wallet(w) + + cnr.SetOwnerID(ownerID.ToV2()) } reqBody := new(v2container.PutRequestBody) @@ -89,7 +93,7 @@ func (c Client) putContainerV2(ctx context.Context, cnr *container.Container, op // sign container signWrapper := v2signature.StableMarshalerWrapper{SM: reqBody.GetContainer()} err := signature.SignDataWithHandler(c.key, signWrapper, func(key []byte, sig []byte) { - containerSignature := new(v2refs.Signature) + containerSignature := new(refs.Signature) containerSignature.SetKey(key) containerSignature.SetSign(sig) reqBody.SetSignature(containerSignature) @@ -181,18 +185,15 @@ func (c Client) getContainerV2(ctx context.Context, id *container.ID, opts ...Ca } } -func (c Client) listContainerV2(ctx context.Context, owner refs.NEO3Wallet, opts ...CallOption) ([]*container.ID, error) { +func (c Client) listContainerV2(ctx context.Context, owner *owner.ID, opts ...CallOption) ([]*container.ID, error) { // apply all available options callOptions := defaultCallOptions() for i := range opts { opts[i].apply(&callOptions) } - v2owner := new(v2refs.OwnerID) - v2owner.SetValue(owner[:]) - reqBody := new(v2container.ListRequestBody) - reqBody.SetOwnerID(v2owner) + reqBody.SetOwnerID(owner.ToV2()) req := new(v2container.ListRequest) req.SetBody(reqBody) @@ -249,7 +250,7 @@ func (c Client) delContainerV2(ctx context.Context, id *container.ID, opts ...Ca // sign container signWrapper := v2signature.StableMarshalerWrapper{SM: reqBody.GetContainerID()} err := signature.SignDataWithHandler(c.key, signWrapper, func(key []byte, sig []byte) { - containerSignature := new(v2refs.Signature) + containerSignature := new(refs.Signature) containerSignature.SetKey(key) containerSignature.SetSign(sig) reqBody.SetSignature(containerSignature) diff --git a/pkg/container/container.go b/pkg/container/container.go index d142d3e..5626af6 100644 --- a/pkg/container/container.go +++ b/pkg/container/container.go @@ -2,7 +2,6 @@ package container import ( "github.com/nspcc-dev/neofs-api-go/v2/container" - "github.com/nspcc-dev/neofs-api-go/v2/refs" ) type Container struct { @@ -24,10 +23,7 @@ func New(opts ...NewOption) (*Container, error) { } if cnrOptions.owner != nil { - owner := new(refs.OwnerID) - owner.SetValue(cnrOptions.owner[:]) - - cnr.SetOwnerID(owner) + cnr.SetOwnerID(cnrOptions.owner.ToV2()) } attributes := make([]*container.Attribute, len(cnrOptions.attributes)) diff --git a/pkg/container/opts.go b/pkg/container/opts.go index 507c988..52f663d 100644 --- a/pkg/container/opts.go +++ b/pkg/container/opts.go @@ -3,7 +3,7 @@ package container import ( "github.com/google/uuid" "github.com/nspcc-dev/neofs-api-go/pkg/acl" - "github.com/nspcc-dev/neofs-api-go/pkg/refs" + "github.com/nspcc-dev/neofs-api-go/pkg/owner" ) type ( @@ -20,7 +20,7 @@ type ( acl uint32 policy string attributes []attribute - owner *refs.NEO3Wallet + owner *owner.ID nonce uuid.UUID } ) @@ -75,9 +75,19 @@ func WithNonce(nonce uuid.UUID) NewOption { }) } -func WithOwner(owner refs.NEO3Wallet) NewOption { +func WithOwnerID(id *owner.ID) NewOption { return newFuncContainerOption(func(option *containerOptions) { - option.owner = &owner + option.owner = id + }) +} + +func WithNEO3Wallet(w *owner.NEO3Wallet) NewOption { + return newFuncContainerOption(func(option *containerOptions) { + if option.owner == nil { + option.owner = new(owner.ID) + } + + option.owner.SetNeo3Wallet(w) }) } diff --git a/pkg/owner/id.go b/pkg/owner/id.go index d00cd9e..abed3a7 100644 --- a/pkg/owner/id.go +++ b/pkg/owner/id.go @@ -3,8 +3,7 @@ package owner import ( "crypto/sha256" - "github.com/nspcc-dev/neofs-api-go/pkg/refs" - refsV2 "github.com/nspcc-dev/neofs-api-go/v2/refs" + "github.com/nspcc-dev/neofs-api-go/v2/refs" "github.com/pkg/errors" ) @@ -15,16 +14,16 @@ type ID struct { } // SetNeo3Wallet sets owner identifier value to NEO3 wallet address. -func (id *ID) SetNeo3Wallet(v *refs.NEO3Wallet) { +func (id *ID) SetNeo3Wallet(v *NEO3Wallet) { if id != nil { id.val = v.Bytes() } } // ToV2 returns the v2 owner ID message. -func (id *ID) ToV2() *refsV2.OwnerID { +func (id *ID) ToV2() *refs.OwnerID { if id != nil { - idV2 := new(refsV2.OwnerID) + idV2 := new(refs.OwnerID) idV2.SetValue(id.val) return idV2 @@ -33,7 +32,8 @@ func (id *ID) ToV2() *refsV2.OwnerID { return nil } -func IDFromV2(idV2 *refsV2.OwnerID) (*ID, error) { +// IDFromV2 converts owner ID v2 structure to ID. +func IDFromV2(idV2 *refs.OwnerID) (*ID, error) { if idV2 == nil { return nil, nil } diff --git a/pkg/owner/id_test.go b/pkg/owner/id_test.go index 56c39a6..e7f9ef9 100644 --- a/pkg/owner/id_test.go +++ b/pkg/owner/id_test.go @@ -4,14 +4,13 @@ import ( "crypto/rand" "testing" - "github.com/nspcc-dev/neofs-api-go/pkg/refs" "github.com/stretchr/testify/require" ) func TestIDV2(t *testing.T) { id := new(ID) - wallet := new(refs.NEO3Wallet) + wallet := new(NEO3Wallet) _, err := rand.Read(wallet.Bytes()) require.NoError(t, err) diff --git a/pkg/owner/wallet.go b/pkg/owner/wallet.go new file mode 100644 index 0000000..80fb889 --- /dev/null +++ b/pkg/owner/wallet.go @@ -0,0 +1,53 @@ +package owner + +import ( + "crypto/ecdsa" + + "github.com/mr-tron/base58" + "github.com/nspcc-dev/neo-go/pkg/crypto/keys" + crypto "github.com/nspcc-dev/neofs-crypto" + "github.com/pkg/errors" +) + +// NEO3Wallet represents NEO3 wallet address. +type NEO3Wallet [25]byte + +// NEO3WalletFromPublicKey converts public key to NEO3 wallet address. +func NEO3WalletFromPublicKey(key *ecdsa.PublicKey) (*NEO3Wallet, error) { + if key == nil { + return nil, crypto.ErrEmptyPublicKey + } + + neoPublicKey := keys.PublicKey{ + X: key.X, + Y: key.Y, + } + + d, err := base58.Decode(neoPublicKey.Address()) + if err != nil { + return nil, errors.Wrap(err, "can't decode neo3 address from key") + } + + w := new(NEO3Wallet) + + copy(w.Bytes(), d) + + return w, nil +} + +func (w *NEO3Wallet) String() string { + if w != nil { + return base58.Encode(w[:]) + } + + return "" +} + +// Bytes returns slice of NEO3 wallet address bytes. +func (w *NEO3Wallet) Bytes() []byte { + if w != nil { + return w[:] + } + + return nil +} diff --git a/pkg/refs/neo_wallet.go b/pkg/refs/neo_wallet.go deleted file mode 100644 index 58f64a8..0000000 --- a/pkg/refs/neo_wallet.go +++ /dev/null @@ -1,45 +0,0 @@ -package refs - -import ( - "crypto/ecdsa" - - "github.com/mr-tron/base58" - "github.com/nspcc-dev/neo-go/pkg/crypto/keys" - "github.com/pkg/errors" -) - -type ( - NEO3Wallet [25]byte -) - -func NEO3WalletFromPublicKey(key *ecdsa.PublicKey) (owner NEO3Wallet, err error) { - if key == nil { - return owner, errors.New("nil public key") - } - - neoPublicKey := keys.PublicKey{ - X: key.X, - Y: key.Y, - } - - d, err := base58.Decode(neoPublicKey.Address()) - if err != nil { - return owner, errors.Wrap(err, "can't decode neo3 address from key") - } - - copy(owner[:], d) - - return owner, nil -} - -func (w NEO3Wallet) String() string { - return base58.Encode(w[:]) -} - -func (w *NEO3Wallet) Bytes() []byte { - if w != nil { - return w[:] - } - - return nil -} From ac0d57cc9b8801f09a64fdf12b2b3976456f1140 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Tue, 1 Sep 2020 10:45:51 +0300 Subject: [PATCH 0373/1196] [#129] v2: Regenerate NodeInfo struct from API Signed-off-by: Alex Vanin --- v2/netmap/grpc/types.pb.go | 110 ++++++++++++++++++------------------- 1 file changed, 55 insertions(+), 55 deletions(-) diff --git a/v2/netmap/grpc/types.pb.go b/v2/netmap/grpc/types.pb.go index 2893490..a21ea50 100644 --- a/v2/netmap/grpc/types.pb.go +++ b/v2/netmap/grpc/types.pb.go @@ -512,10 +512,10 @@ func (m *PlacementPolicy_FilterGroup_Selector) GetKey() string { // NeoFS node description type NodeInfo struct { - // Ways to connect to a node - Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` // Public key of the NeoFS node in a binary format. - PublicKey []byte `protobuf:"bytes,2,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"` + PublicKey []byte `protobuf:"bytes,1,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"` + // Ways to connect to a node + Address string `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"` // Carries list of the NeoFS node attributes in a string key-value format. Attributes []*NodeInfo_Attribute `protobuf:"bytes,3,rep,name=attributes,proto3" json:"attributes,omitempty"` // Carries state of the NeoFS node. @@ -558,13 +558,6 @@ func (m *NodeInfo) XXX_DiscardUnknown() { var xxx_messageInfo_NodeInfo proto.InternalMessageInfo -func (m *NodeInfo) GetAddress() string { - if m != nil { - return m.Address - } - return "" -} - func (m *NodeInfo) GetPublicKey() []byte { if m != nil { return m.PublicKey @@ -572,6 +565,13 @@ func (m *NodeInfo) GetPublicKey() []byte { return nil } +func (m *NodeInfo) GetAddress() string { + if m != nil { + return m.Address + } + return "" +} + func (m *NodeInfo) GetAttributes() []*NodeInfo_Attribute { if m != nil { return m.Attributes @@ -690,8 +690,8 @@ var fileDescriptor_91a1332b2376641a = []byte{ 0x85, 0x35, 0x35, 0x35, 0xb1, 0x36, 0xd6, 0x0a, 0xa8, 0x00, 0x4a, 0xc7, 0x3a, 0xd2, 0xb6, 0x0f, 0x55, 0xc8, 0x25, 0xeb, 0xab, 0xb4, 0x61, 0x3b, 0x53, 0x1b, 0xda, 0x83, 0xbc, 0x4b, 0xe7, 0x21, 0x5f, 0xdd, 0xc3, 0x14, 0x64, 0x9a, 0x92, 0x2f, 0x35, 0x55, 0xff, 0x20, 0xc3, 0xb6, 0x45, 0x27, - 0xa4, 0x17, 0x7a, 0x34, 0xd1, 0xa5, 0x33, 0x99, 0xc4, 0x84, 0xb1, 0x95, 0xec, 0x32, 0x88, 0x1e, - 0x02, 0x44, 0xf3, 0x71, 0xe0, 0xbb, 0xa3, 0xac, 0x7e, 0x07, 0x17, 0x53, 0xcf, 0x09, 0x59, 0xa2, + 0xa4, 0x17, 0x7a, 0x14, 0x3d, 0x04, 0x88, 0xe6, 0xe3, 0xc0, 0x77, 0x47, 0x99, 0xf2, 0x76, 0x70, + 0x31, 0xf5, 0x9c, 0x90, 0x65, 0x22, 0x5b, 0x67, 0x32, 0x89, 0x09, 0x63, 0x2b, 0x86, 0x0c, 0xa2, 0x23, 0x00, 0x87, 0xf3, 0xd8, 0x1f, 0xcf, 0x39, 0x61, 0x42, 0xd3, 0xa5, 0xf6, 0xe3, 0xdf, 0x57, 0x99, 0x35, 0x32, 0x3a, 0x59, 0x32, 0x5e, 0xab, 0x43, 0x07, 0x90, 0x67, 0xdc, 0xe1, 0x44, 0xcf, 0x09, 0x01, 0xd6, 0xfe, 0x42, 0x30, 0x48, 0xf2, 0x70, 0x9a, 0x5e, 0xd9, 0x87, 0xe2, 0x25, 0xe1, @@ -701,8 +701,8 @@ var fileDescriptor_91a1332b2376641a = []byte{ 0xfd, 0xcf, 0xea, 0xd6, 0x9b, 0x67, 0x53, 0x9f, 0x9f, 0xcf, 0xc7, 0x86, 0x4b, 0x67, 0xad, 0x90, 0x45, 0xae, 0xdb, 0x9c, 0x90, 0x45, 0x2b, 0x24, 0xd4, 0x63, 0x4d, 0x27, 0xf2, 0x9b, 0x53, 0xda, 0xda, 0x7c, 0x57, 0x9f, 0xa7, 0xe7, 0x8f, 0xf2, 0x5d, 0x8b, 0xd0, 0xee, 0xc0, 0xe8, 0xf4, 0x7b, - 0xc9, 0x78, 0x96, 0xf0, 0x8e, 0x55, 0xf1, 0xde, 0xee, 0xff, 0x0a, 0x00, 0x00, 0xff, 0xff, 0x87, - 0xfe, 0x8e, 0x55, 0x8d, 0x05, 0x00, 0x00, + 0xc9, 0x78, 0x96, 0xf0, 0x8e, 0x55, 0xf1, 0xde, 0xee, 0xff, 0x0a, 0x00, 0x00, 0xff, 0xff, 0x1a, + 0xeb, 0x5f, 0x7e, 0x8d, 0x05, 0x00, 0x00, } func (m *PlacementPolicy) Marshal() (dAtA []byte, err error) { @@ -1069,18 +1069,18 @@ func (m *NodeInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x1a } } - if len(m.PublicKey) > 0 { - i -= len(m.PublicKey) - copy(dAtA[i:], m.PublicKey) - i = encodeVarintTypes(dAtA, i, uint64(len(m.PublicKey))) - i-- - dAtA[i] = 0x12 - } if len(m.Address) > 0 { i -= len(m.Address) copy(dAtA[i:], m.Address) i = encodeVarintTypes(dAtA, i, uint64(len(m.Address))) i-- + dAtA[i] = 0x12 + } + if len(m.PublicKey) > 0 { + i -= len(m.PublicKey) + copy(dAtA[i:], m.PublicKey) + i = encodeVarintTypes(dAtA, i, uint64(len(m.PublicKey))) + i-- dAtA[i] = 0xa } return len(dAtA) - i, nil @@ -1293,11 +1293,11 @@ func (m *NodeInfo) Size() (n int) { } var l int _ = l - l = len(m.Address) + l = len(m.PublicKey) if l > 0 { n += 1 + l + sovTypes(uint64(l)) } - l = len(m.PublicKey) + l = len(m.Address) if l > 0 { n += 1 + l + sovTypes(uint64(l)) } @@ -2132,38 +2132,6 @@ func (m *NodeInfo) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Address = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field PublicKey", wireType) } @@ -2197,6 +2165,38 @@ func (m *NodeInfo) Unmarshal(dAtA []byte) error { m.PublicKey = []byte{} } iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Attributes", wireType) From edd0004b936cfcf9153f4a318bf7f914d854ba25 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Tue, 1 Sep 2020 10:46:20 +0300 Subject: [PATCH 0374/1196] [#129] v2: Add unified structure for NodeInfo Signed-off-by: Alex Vanin --- v2/netmap/convert.go | 70 +++++++++++++++++++++++++ v2/netmap/marshal.go | 107 ++++++++++++++++++++++++++++++++++++++ v2/netmap/marshal_test.go | 66 +++++++++++++++++++++++ v2/netmap/types.go | 92 ++++++++++++++++++++++++++++++++ 4 files changed, 335 insertions(+) create mode 100644 v2/netmap/marshal_test.go diff --git a/v2/netmap/convert.go b/v2/netmap/convert.go index 5d126f8..b8713fe 100644 --- a/v2/netmap/convert.go +++ b/v2/netmap/convert.go @@ -21,3 +21,73 @@ func PlacementPolicyFromGRPCMessage(m *netmap.PlacementPolicy) *PlacementPolicy // TODO: fill me return nil } + +func AttributeToGRPCMessage(a *Attribute) *netmap.NodeInfo_Attribute { + if a == nil { + return nil + } + + m := new(netmap.NodeInfo_Attribute) + + m.SetKey(a.GetKey()) + m.SetValue(a.GetValue()) + + return m +} + +func AttributeFromGRPCMessage(m *netmap.NodeInfo_Attribute) *Attribute { + if m == nil { + return nil + } + + a := new(Attribute) + + a.SetKey(m.GetKey()) + a.SetValue(m.GetValue()) + + return a +} + +func NodeInfoToGRPCMessage(n *NodeInfo) *netmap.NodeInfo { + if n == nil { + return nil + } + + m := new(netmap.NodeInfo) + + m.SetPublicKey(n.GetPublicKey()) + m.SetAddress(n.GetAddress()) + + attr := n.GetAttributes() + attrMsg := make([]*netmap.NodeInfo_Attribute, 0, len(attr)) + + for i := range attr { + attrMsg = append(attrMsg, AttributeToGRPCMessage(attr[i])) + } + + m.SetAttributes(attrMsg) + + return m +} + +func NodeInfoFromGRPCMessage(m *netmap.NodeInfo) *NodeInfo { + if m == nil { + return nil + } + + a := new(NodeInfo) + + a.SetPublicKey(m.GetPublicKey()) + a.SetAddress(m.GetAddress()) + + attrMsg := m.GetAttributes() + attr := make([]*Attribute, 0, len(attrMsg)) + + for i := range attrMsg { + attr = append(attr, AttributeFromGRPCMessage(attrMsg[i])) + } + + a.SetAttributes(attr) + + return a +} diff --git a/v2/netmap/marshal.go b/v2/netmap/marshal.go index 99a24b4..b5025f5 100644 --- a/v2/netmap/marshal.go +++ b/v2/netmap/marshal.go @@ -1,5 +1,18 @@ package netmap +import ( + "github.com/nspcc-dev/neofs-api-go/util/proto" +) + +const ( + keyAttributeField = 1 + valueAttributeField = 2 + + keyNodeInfoField = 1 + addressNodeInfoField = 2 + attributesNodeInfoField = 3 +) + func (p *PlacementPolicy) StableMarshal(buf []byte) ([]byte, error) { // todo: implement me return nil, nil @@ -9,3 +22,97 @@ func (p *PlacementPolicy) StableSize() (size int) { // todo: implement me return 0 } + +func (a *Attribute) StableMarshal(buf []byte) ([]byte, error) { + if a == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, a.StableSize()) + } + + var ( + offset, n int + err error + ) + + n, err = proto.StringMarshal(keyAttributeField, buf[offset:], a.key) + if err != nil { + return nil, err + } + + offset += n + + n, err = proto.StringMarshal(valueAttributeField, buf[offset:], a.value) + if err != nil { + return nil, err + } + + return buf, nil +} + +func (a *Attribute) StableSize() (size int) { + if a == nil { + return 0 + } + + size += proto.StringSize(keyAttributeField, a.key) + size += proto.StringSize(valueAttributeField, a.value) + + return size +} + +func (ni *NodeInfo) StableMarshal(buf []byte) ([]byte, error) { + if ni == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, ni.StableSize()) + } + + var ( + offset, n int + err error + ) + + n, err = proto.BytesMarshal(keyNodeInfoField, buf[offset:], ni.publicKey) + if err != nil { + return nil, err + } + + offset += n + + n, err = proto.StringMarshal(addressNodeInfoField, buf[offset:], ni.address) + if err != nil { + return nil, err + } + + offset += n + + for i := range ni.attributes { + n, err = proto.NestedStructureMarshal(attributesNodeInfoField, buf[offset:], ni.attributes[i]) + if err != nil { + return nil, err + } + + offset += n + } + + return buf, nil +} + +func (ni *NodeInfo) StableSize() (size int) { + if ni == nil { + return 0 + } + + size += proto.BytesSize(keyNodeInfoField, ni.publicKey) + size += proto.StringSize(addressNodeInfoField, ni.address) + for i := range ni.attributes { + size += proto.NestedStructureSize(attributesNodeInfoField, ni.attributes[i]) + } + + return size +} diff --git a/v2/netmap/marshal_test.go b/v2/netmap/marshal_test.go new file mode 100644 index 0000000..1292c40 --- /dev/null +++ b/v2/netmap/marshal_test.go @@ -0,0 +1,66 @@ +package netmap_test + +import ( + "strconv" + "testing" + + "github.com/nspcc-dev/neofs-api-go/v2/netmap" + grpc "github.com/nspcc-dev/neofs-api-go/v2/netmap/grpc" + "github.com/stretchr/testify/require" +) + +func TestAttribute_StableMarshal(t *testing.T) { + from := generateAttribute("key", "value") + transport := new(grpc.NodeInfo_Attribute) + + t.Run("non empty", func(t *testing.T) { + wire, err := from.StableMarshal(nil) + require.NoError(t, err) + + err = transport.Unmarshal(wire) + require.NoError(t, err) + + to := netmap.AttributeFromGRPCMessage(transport) + require.Equal(t, from, to) + }) +} + +func TestNodeInfo(t *testing.T) { + from := generateNodeInfo("publicKey", "/multi/addr", 10) + transport := new(grpc.NodeInfo) + + t.Run("non empty", func(t *testing.T) { + wire, err := from.StableMarshal(nil) + require.NoError(t, err) + + err = transport.Unmarshal(wire) + require.NoError(t, err) + + to := netmap.NodeInfoFromGRPCMessage(transport) + require.Equal(t, from, to) + }) +} + +func generateAttribute(k, v string) *netmap.Attribute { + attr := new(netmap.Attribute) + attr.SetKey(k) + attr.SetValue(v) + + return attr +} + +func generateNodeInfo(key, addr string, n int) *netmap.NodeInfo { + nodeInfo := new(netmap.NodeInfo) + nodeInfo.SetPublicKey([]byte(key)) + nodeInfo.SetAddress(addr) + + attrs := make([]*netmap.Attribute, n) + for i := 0; i < n; i++ { + j := strconv.Itoa(n) + attrs[i] = generateAttribute("key"+j, "value"+j) + } + + nodeInfo.SetAttributes(attrs) + + return nodeInfo +} diff --git a/v2/netmap/types.go b/v2/netmap/types.go index 0f295c6..7df923c 100644 --- a/v2/netmap/types.go +++ b/v2/netmap/types.go @@ -3,3 +3,95 @@ package netmap type PlacementPolicy struct { // TODO: fill me } + +// Attribute of storage node. +type Attribute struct { + key string + value string +} + +// NodeInfo of storage node. +type NodeInfo struct { + publicKey []byte + address string + attributes []*Attribute +} + +// NodeState of storage node. +type NodeState uint32 + +const ( + Unspecified NodeState = iota + Online + Offline +) + +func (a *Attribute) GetKey() string { + if a != nil { + return a.key + } + + return "" +} + +func (a *Attribute) SetKey(v string) { + if a != nil { + a.key = v + } +} + +func (a *Attribute) GetValue() string { + if a != nil { + return a.value + } + + return "" +} + +func (a *Attribute) SetValue(v string) { + if a != nil { + a.value = v + } +} + +func (ni *NodeInfo) GetPublicKey() []byte { + if ni != nil { + return ni.publicKey + } + + return nil +} + +func (ni *NodeInfo) SetPublicKey(v []byte) { + if ni != nil { + ni.publicKey = v + } +} + +func (ni *NodeInfo) GetAddress() string { + if ni != nil { + return ni.address + } + + return "" +} + +func (ni *NodeInfo) SetAddress(v string) { + if ni != nil { + ni.address = v + } +} + +func (ni *NodeInfo) GetAttributes() []*Attribute { + if ni != nil { + return ni.attributes + } + + return nil +} + +func (ni *NodeInfo) SetAttributes(v []*Attribute) { + if ni != nil { + ni.attributes = v + } +} From a65db086085949eed2f6d6d5337220e221f733a9 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 1 Sep 2020 16:11:38 +0300 Subject: [PATCH 0375/1196] [#130] sdk: Define object identifier type Signed-off-by: Leonard Lyubich --- pkg/object/id.go | 54 +++++++++++++++++++++++++++++++++++++++++++ pkg/object/id_test.go | 27 ++++++++++++++++++++++ 2 files changed, 81 insertions(+) create mode 100644 pkg/object/id.go create mode 100644 pkg/object/id_test.go diff --git a/pkg/object/id.go b/pkg/object/id.go new file mode 100644 index 0000000..437f2d4 --- /dev/null +++ b/pkg/object/id.go @@ -0,0 +1,54 @@ +package object + +import ( + "crypto/sha256" + + "github.com/nspcc-dev/neofs-api-go/v2/refs" + "github.com/pkg/errors" +) + +// ID represents object identifier that +// supports different type of values. +type ID struct { + val []byte +} + +// SetSHA256 sets object identifier value to SHA256 checksum. +func (id *ID) SetSHA256(v [sha256.Size]byte) { + if id != nil { + id.val = v[:] + } +} + +// ToV2 converts ID to v2 ObjectID message. +func (id *ID) ToV2() *refs.ObjectID { + if id != nil { + idV2 := new(refs.ObjectID) + idV2.SetValue(id.val) + + return idV2 + } + + return nil +} + +// IDFromV2 converts v2 ObjectID message to ID. +// +// Returns an error if the format of the identifier +// in the message is broken. +func IDFromV2(idV2 *refs.ObjectID) (*ID, error) { + if idV2 == nil { + return nil, nil + } + + val := idV2.GetValue() + if ln := len(val); ln != sha256.Size { + return nil, errors.Errorf("could not convert %T to %T: invalid length %d", + idV2, (*ID)(nil), ln, + ) + } + + return &ID{ + val: val, + }, nil +} diff --git a/pkg/object/id_test.go b/pkg/object/id_test.go new file mode 100644 index 0000000..bbf29cf --- /dev/null +++ b/pkg/object/id_test.go @@ -0,0 +1,27 @@ +package object + +import ( + "crypto/rand" + "crypto/sha256" + "testing" + + "github.com/stretchr/testify/require" +) + +func TestIDV2(t *testing.T) { + id := new(ID) + + checksum := [sha256.Size]byte{} + + _, err := rand.Read(checksum[:]) + require.NoError(t, err) + + id.SetSHA256(checksum) + + idV2 := id.ToV2() + + id2, err := IDFromV2(idV2) + require.NoError(t, err) + + require.Equal(t, id, id2) +} From 8c3f8268b921e1f6fcf87627997112de73e09ffd Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 1 Sep 2020 16:31:57 +0300 Subject: [PATCH 0376/1196] [#130] sdk: Define object types Define Object type that represents the immutable NeoFS object. Define RawObject type that provides interface for convenient construction of NeoFS object. Signed-off-by: Leonard Lyubich --- pkg/object/object.go | 200 +++++++++++++++++++++++++++++++++++++++++++ pkg/object/raw.go | 53 ++++++++++++ 2 files changed, 253 insertions(+) create mode 100644 pkg/object/object.go create mode 100644 pkg/object/raw.go diff --git a/pkg/object/object.go b/pkg/object/object.go new file mode 100644 index 0000000..d86c965 --- /dev/null +++ b/pkg/object/object.go @@ -0,0 +1,200 @@ +package object + +import ( + "bytes" + "crypto/ecdsa" + "crypto/sha256" + + "github.com/nspcc-dev/neofs-api-go/pkg/container" + "github.com/nspcc-dev/neofs-api-go/pkg/owner" + "github.com/nspcc-dev/neofs-api-go/util/signature" + "github.com/nspcc-dev/neofs-api-go/v2/object" + "github.com/nspcc-dev/neofs-api-go/v2/refs" + signatureV2 "github.com/nspcc-dev/neofs-api-go/v2/signature" + crypto "github.com/nspcc-dev/neofs-crypto" + "github.com/pkg/errors" +) + +// Object represents NeoFS object that provides +// a convenient interface for working in isolation +// from the internal structure of an object. +// +// Object allows to work with the object in read-only +// mode as a reflection of the immutability of objects +// in the system. +type Object struct { + rwObject +} + +type rwObject struct { + fin bool + + id *ID + + key, sig []byte + + cid *container.ID + + ownerID *owner.ID + + payloadChecksum *refs.Checksum + + // TODO: add other fields +} + +// Verify checks if object structure is correct. +func (o *Object) Verify() error { + if o == nil { + return nil + } + + hdr := o.v2Header() + + data, err := hdr.StableMarshal(nil) + if err != nil { + return errors.Wrap(err, "could not marshal header") + } + + hdrChecksum := sha256.Sum256(data) + + if !bytes.Equal(hdrChecksum[:], o.id.val) { + return errors.New("invalid object identifier") + } + + if err := signature.VerifyDataWithSource( + signatureV2.StableMarshalerWrapper{ + SM: o.id.ToV2(), + }, + func() (key, sig []byte) { + return o.key, o.sig + }, + ); err != nil { + return errors.Wrap(err, "invalid object ID signature") + } + + return nil +} + +// ToV2 converts object to v2 Object message. +func (o *Object) ToV2() *object.Object { + obj, _ := o.rwObject.ToV2(nil) + + return obj +} + +func (o *rwObject) v2Header() *object.Header { + hV2 := new(object.Header) + hV2.SetContainerID(o.cid.ToV2()) + hV2.SetOwnerID(o.ownerID.ToV2()) + hV2.SetPayloadHash(o.payloadChecksum) + // TODO: set other fields + + return hV2 +} + +func (o *rwObject) complete(key *ecdsa.PrivateKey) (*object.Header, error) { + hdr := o.v2Header() + + hdrData, err := hdr.StableMarshal(nil) + if err != nil { + return nil, errors.Wrap(err, "could not marshal header") + } + + o.id = new(ID) + o.id.SetSHA256(sha256.Sum256(hdrData)) + + if err := signature.SignDataWithHandler( + key, + signatureV2.StableMarshalerWrapper{ + SM: o.id.ToV2(), + }, + func(key []byte, sig []byte) { + o.key, o.sig = key, sig + }, + ); err != nil { + return nil, errors.Wrap(err, "could sign object identifier") + } + + o.fin = true + + return hdr, nil +} + +// ToV2 calculates object identifier, signs structure and converts +// it to v2 Object message. +func (o *rwObject) ToV2(key *ecdsa.PrivateKey) (*object.Object, error) { + if o == nil { + return nil, nil + } + + var ( + hdr *object.Header + err error + ) + + if !o.fin { + if key == nil { + return nil, errors.Wrap(crypto.ErrEmptyPrivateKey, "could complete the object") + } + + if hdr, err = o.complete(key); err != nil { + return nil, errors.Wrapf(err, "could not complete the object") + } + } else { + hdr = o.v2Header() + } + + obj := new(object.Object) + obj.SetObjectID(o.id.ToV2()) + obj.SetHeader(hdr) + + sig := new(refs.Signature) + sig.SetKey(o.key) + sig.SetSign(o.sig) + obj.SetSignature(sig) + + return obj, nil +} + +// FromV2 converts v2 Object message to Object instance. +// +// Returns any error encountered which prevented the +// recovery of object data from the message. +func FromV2(oV2 *object.Object) (*Object, error) { + if oV2 == nil { + return nil, nil + } + + id, err := IDFromV2(oV2.GetObjectID()) + if err != nil { + return nil, errors.Wrap(err, "could not convert object ID") + } + + hdr := oV2.GetHeader() + + ownerID, err := owner.IDFromV2(hdr.GetOwnerID()) + if err != nil { + return nil, errors.Wrap(err, "could not convert owner ID") + } + + cid, err := container.IDFromV2(hdr.GetContainerID()) + if err != nil { + return nil, errors.Wrap(err, "could not convert container ID") + } + + // TODO: convert other fields + + sig := oV2.GetSignature() + + return &Object{ + rwObject: rwObject{ + fin: true, + id: id, + key: sig.GetKey(), + sig: sig.GetSign(), + cid: cid, + ownerID: ownerID, + payloadChecksum: hdr.GetPayloadHash(), + }, + }, nil +} diff --git a/pkg/object/raw.go b/pkg/object/raw.go new file mode 100644 index 0000000..c82ba5c --- /dev/null +++ b/pkg/object/raw.go @@ -0,0 +1,53 @@ +package object + +import ( + "crypto/sha256" + + "github.com/nspcc-dev/neofs-api-go/pkg/container" + "github.com/nspcc-dev/neofs-api-go/pkg/owner" + "github.com/nspcc-dev/neofs-api-go/v2/refs" +) + +// RawObject represents NeoFS object that provides +// a convenient interface to fill in the fields of +// an object in isolation from its internal structure. +type RawObject struct { + rwObject +} + +func (o *RawObject) set(setter func()) { + o.fin = false + setter() +} + +// SetContainerID sets object's container identifier. +func (o *RawObject) SetContainerID(v *container.ID) { + if o != nil { + o.set(func() { + o.cid = v + }) + } +} + +// SetOwnerID sets identifier of the object's owner. +func (o *RawObject) SetOwnerID(v *owner.ID) { + if o != nil { + o.set(func() { + o.ownerID = v + }) + } +} + +// SetPayloadChecksumSHA256 sets payload checksum as a SHA256 checksum. +func (o *RawObject) SetPayloadChecksumSHA256(v [sha256.Size]byte) { + if o != nil { + o.set(func() { + if o.payloadChecksum == nil { + o.payloadChecksum = new(refs.Checksum) + } + + o.payloadChecksum.SetType(refs.SHA256) + o.payloadChecksum.SetSum(v[:]) + }) + } +} From 9cba1e233dd23c148481c5f4d2f4f1635bbe0609 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Tue, 1 Sep 2020 17:28:40 +0300 Subject: [PATCH 0377/1196] [#131] sdk: Add owner stringer and script hash converter Signed-off-by: Alex Vanin --- go.mod | 2 +- go.sum | 21 +++++++++++++++++++-- pkg/owner/id.go | 19 +++++++++++++++++++ 3 files changed, 39 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 273b81a..372a59c 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/golang/protobuf v1.4.2 github.com/google/uuid v1.1.1 github.com/mr-tron/base58 v1.1.2 - github.com/nspcc-dev/neo-go v0.90.0 + github.com/nspcc-dev/neo-go v0.91.0 github.com/nspcc-dev/neofs-crypto v0.3.0 github.com/pkg/errors v0.9.1 github.com/stretchr/testify v1.6.1 diff --git a/go.sum b/go.sum index f5ee18a..8f9905b 100644 --- a/go.sum +++ b/go.sum @@ -10,6 +10,7 @@ github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAE github.com/Workiva/go-datastructures v1.0.50/go.mod h1:Z+F2Rca0qCsVYDS8z7bAGm8f3UkzuWYS/oBZz5a7VVA= github.com/abiosoft/ishell v2.0.0+incompatible/go.mod h1:HQR9AqF2R3P4XXpMpI0NAzgHf/aS6+zVXRj14cVk9qg= github.com/abiosoft/readline v0.0.0-20180607040430-155bce2042db/go.mod h1:rB3B4rKii8V21ydCbIzH5hZiCQE7f5E9SzUb/ZZx530= +github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= @@ -20,6 +21,15 @@ github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5 github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= +github.com/btcsuite/btcd v0.20.1-beta h1:Ik4hyJqN8Jfyv3S4AGBOmyouMsYE3EdYODkMbQjwPGw= +github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= +github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= +github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= +github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg= +github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY= +github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= +github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= +github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.0/go.mod h1:dgIUBU3pDso/gPgZ1osOZ0iQf77oPR28Tjxl5dIMyVM= @@ -32,6 +42,7 @@ github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= +github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= @@ -89,9 +100,12 @@ github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/ad github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= +github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= +github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= +github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= @@ -122,8 +136,8 @@ github.com/nspcc-dev/dbft v0.0.0-20200117124306-478e5cfbf03a/go.mod h1:/YFK+XOxx github.com/nspcc-dev/dbft v0.0.0-20200219114139-199d286ed6c1/go.mod h1:O0qtn62prQSqizzoagHmuuKoz8QMkU3SzBoKdEvm3aQ= github.com/nspcc-dev/dbft v0.0.0-20200711144034-c526ccc6f570/go.mod h1:1FYQXSbb6/9HQIkoF8XO7W/S8N7AZRkBsgwbcXRvk0E= github.com/nspcc-dev/neo-go v0.73.1-pre.0.20200303142215-f5a1b928ce09/go.mod h1:pPYwPZ2ks+uMnlRLUyXOpLieaDQSEaf4NM3zHVbRjmg= -github.com/nspcc-dev/neo-go v0.90.0 h1:ABNDrJuF9C1XuLQu0q9DKSVMlg9eQn/g6rX8Jbr31bo= -github.com/nspcc-dev/neo-go v0.90.0/go.mod h1:pPFdnApJwUSRAnpdiPBZl7I7jv0doDg5naecpSPK4+Q= +github.com/nspcc-dev/neo-go v0.91.0 h1:KKOPMKs0fm8JIau1SuwxiLdrZ+1kDPBiVRlWwzfebWE= +github.com/nspcc-dev/neo-go v0.91.0/go.mod h1:G6HdOWvzQ6tlvFdvFSN/PgCzLPN/X/X4d5hTjFRUDcc= github.com/nspcc-dev/neofs-crypto v0.2.0/go.mod h1:F/96fUzPM3wR+UGsPi3faVNmFlA9KAEAUQR7dMxZmNA= github.com/nspcc-dev/neofs-crypto v0.2.3/go.mod h1:8w16GEJbH6791ktVqHN9YRNH3s9BEEKYxGhlFnp0cDw= github.com/nspcc-dev/neofs-crypto v0.3.0 h1:zlr3pgoxuzrmGCxc5W8dGVfA9Rro8diFvVnBg0L4ifM= @@ -132,8 +146,10 @@ github.com/nspcc-dev/rfc6979 v0.1.0/go.mod h1:exhIh1PdpDC5vQmyEsGvc4YDM/lyQp/452 github.com/nspcc-dev/rfc6979 v0.2.0 h1:3e1WNxrN60/6N0DW7+UYisLeZJyfqZTNOjeV/toYvOE= github.com/nspcc-dev/rfc6979 v0.2.0/go.mod h1:exhIh1PdpDC5vQmyEsGvc4YDM/lyQp/452QxGq/UEso= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.10.3/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/gomega v1.4.2/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= +github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pierrec/lz4 v2.5.2+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= @@ -184,6 +200,7 @@ go.etcd.io/bbolt v1.3.4/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= +golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= diff --git a/pkg/owner/id.go b/pkg/owner/id.go index abed3a7..235559b 100644 --- a/pkg/owner/id.go +++ b/pkg/owner/id.go @@ -3,6 +3,8 @@ package owner import ( "crypto/sha256" + "github.com/mr-tron/base58" + "github.com/nspcc-dev/neo-go/pkg/encoding/address" "github.com/nspcc-dev/neofs-api-go/v2/refs" "github.com/pkg/errors" ) @@ -50,3 +52,20 @@ func IDFromV2(idV2 *refs.OwnerID) (*ID, error) { val: val, }, nil } + +func (id *ID) String() string { + if id != nil { + return base58.Encode(id.val) + } + + return "" +} + +func ScriptHashBE(id *ID) ([]byte, error) { + addr, err := address.StringToUint160(id.String()) + if err != nil { + return nil, err + } + + return addr.BytesBE(), nil +} From 104604acae6424cf1d19e7dad553e298f7ed80cf Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 2 Sep 2020 14:40:20 +0300 Subject: [PATCH 0378/1196] [#132] v2/refs: Implement stable unmarshaler on Address Signed-off-by: Leonard Lyubich --- v2/refs/marshal.go | 16 ++++++++++++++++ v2/refs/marshal_test.go | 36 +++++++++++++++++++++++++++--------- 2 files changed, 43 insertions(+), 9 deletions(-) diff --git a/v2/refs/marshal.go b/v2/refs/marshal.go index 7d52c60..2f3f265 100644 --- a/v2/refs/marshal.go +++ b/v2/refs/marshal.go @@ -2,6 +2,7 @@ package refs import ( "github.com/nspcc-dev/neofs-api-go/util/proto" + refs "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" ) const ( @@ -140,6 +141,21 @@ func (a *Address) StableSize() (size int) { return size } +func (a *Address) StableUnmarshal(data []byte) error { + if a == nil { + return nil + } + + addrGRPC := new(refs.Address) + if err := addrGRPC.Unmarshal(data); err != nil { + return err + } + + *a = *AddressFromGRPCMessage(addrGRPC) + + return nil +} + func (c *Checksum) StableMarshal(buf []byte) ([]byte, error) { if c == nil { return []byte{}, nil diff --git a/v2/refs/marshal_test.go b/v2/refs/marshal_test.go index f4e1350..5ba3994 100644 --- a/v2/refs/marshal_test.go +++ b/v2/refs/marshal_test.go @@ -63,20 +63,14 @@ func TestObjectID_StableMarshal(t *testing.T) { } func TestAddress_StableMarshal(t *testing.T) { - addressFrom := new(refs.Address) + cid := []byte("Container ID") + oid := []byte("Object ID") - cnr := new(refs.ContainerID) - cnr.SetValue([]byte("Container ID")) - - objectID := new(refs.ObjectID) - objectID.SetValue([]byte("Object ID")) + addressFrom := generateAddress(cid, oid) addressTransport := new(grpc.Address) t.Run("non empty", func(t *testing.T) { - addressFrom.SetContainerID(cnr) - addressFrom.SetObjectID(objectID) - wire, err := addressFrom.StableMarshal(nil) require.NoError(t, err) @@ -154,3 +148,27 @@ func generateVersion(maj, min uint32) *refs.Version { return version } + +func generateAddress(bCid, bOid []byte) *refs.Address { + addr := new(refs.Address) + + cid := new(refs.ContainerID) + cid.SetValue(bCid) + + oid := new(refs.ObjectID) + oid.SetValue(bOid) + + return addr +} + +func TestAddress_StableUnmarshal(t *testing.T) { + addr := generateAddress([]byte("container id"), []byte("object id")) + + data, err := addr.StableMarshal(nil) + require.NoError(t, err) + + addr2 := new(refs.Address) + require.NoError(t, addr2.StableUnmarshal(data)) + + require.Equal(t, addr, addr2) +} From c125749c6eab059603b701a1b72e33a794c1f8ef Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 2 Sep 2020 14:43:37 +0300 Subject: [PATCH 0379/1196] [#132] sdk/object: Implement Address type Signed-off-by: Leonard Lyubich --- pkg/object/address.go | 68 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 pkg/object/address.go diff --git a/pkg/object/address.go b/pkg/object/address.go new file mode 100644 index 0000000..37bd0ae --- /dev/null +++ b/pkg/object/address.go @@ -0,0 +1,68 @@ +package object + +import ( + "github.com/nspcc-dev/neofs-api-go/pkg/container" + "github.com/nspcc-dev/neofs-api-go/v2/refs" + "github.com/pkg/errors" +) + +// Address represents address of NeoFS object. +type Address struct { + cid *container.ID + + oid *ID +} + +// ToV2 converts Address to v2 Address message. +func (a *Address) ToV2() *refs.Address { + if a != nil { + aV2 := new(refs.Address) + aV2.SetContainerID(a.cid.ToV2()) + aV2.SetObjectID(a.oid.ToV2()) + + return aV2 + } + + return nil +} + +// GetObjectIDV2 converts object identifier to v2 ObjectID message. +func (a *Address) GetObjectIDV2() *refs.ObjectID { + if a != nil { + return a.oid.ToV2() + } + + return nil +} + +// AddressFromV2 converts v2 Address message to Address. +func AddressFromV2(aV2 *refs.Address) (*Address, error) { + if aV2 == nil { + return nil, nil + } + + oid, err := IDFromV2(aV2.GetObjectID()) + if err != nil { + return nil, errors.Wrap(err, "could not convert object identifier") + } + + cid, err := container.IDFromV2(aV2.GetContainerID()) + if err != nil { + return nil, errors.Wrap(err, "could not convert container identifier") + } + + return &Address{ + cid: cid, + oid: oid, + }, nil +} + +// AddressFromBytes restores Address from a binary representation. +func AddressFromBytes(data []byte) (*Address, error) { + addrV2 := new(refs.Address) + if err := addrV2.StableUnmarshal(data); err != nil { + return nil, errors.Wrap(err, "could not unmarshal object address") + } + + return AddressFromV2(addrV2) +} From e222c441e55b6bba9a6afa824aabb424bac7cb80 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 2 Sep 2020 14:46:43 +0300 Subject: [PATCH 0380/1196] [#132] v2/object: Implement stable unmarshaler on Object Signed-off-by: Leonard Lyubich --- v2/object/marshal.go | 16 ++++++++++++++++ v2/object/marshal_test.go | 12 ++++++++++++ 2 files changed, 28 insertions(+) diff --git a/v2/object/marshal.go b/v2/object/marshal.go index 79bd131..f19c54f 100644 --- a/v2/object/marshal.go +++ b/v2/object/marshal.go @@ -2,6 +2,7 @@ package object import ( "github.com/nspcc-dev/neofs-api-go/util/proto" + object "github.com/nspcc-dev/neofs-api-go/v2/object/grpc" ) const ( @@ -440,6 +441,21 @@ func (o *Object) StableSize() (size int) { return size } +func (o *Object) StableUnmarshal(data []byte) error { + if o == nil { + return nil + } + + objGRPC := new(object.Object) + if err := objGRPC.Unmarshal(data); err != nil { + return err + } + + *o = *ObjectFromGRPCMessage(objGRPC) + + return nil +} + func (r *GetRequestBody) StableMarshal(buf []byte) ([]byte, error) { if r == nil { return []byte{}, nil diff --git a/v2/object/marshal_test.go b/v2/object/marshal_test.go index 19ab6d5..04f3a39 100644 --- a/v2/object/marshal_test.go +++ b/v2/object/marshal_test.go @@ -688,3 +688,15 @@ func generateRangeHashResponseBody(n int) *object.GetRangeHashResponseBody { return resp } + +func TestObject_StableUnmarshal(t *testing.T) { + obj := generateObject("some data") + + data, err := obj.StableMarshal(nil) + require.NoError(t, err) + + obj2 := new(object.Object) + require.NoError(t, obj2.StableUnmarshal(data)) + + require.Equal(t, obj, obj2) +} From f18e8535c54d4b80d5b2b5a17c930001d15b2ba3 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 2 Sep 2020 14:48:25 +0300 Subject: [PATCH 0381/1196] [#132] sdk/object: Add payload field to Object Signed-off-by: Leonard Lyubich --- pkg/object/object.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pkg/object/object.go b/pkg/object/object.go index d86c965..22688dd 100644 --- a/pkg/object/object.go +++ b/pkg/object/object.go @@ -39,6 +39,8 @@ type rwObject struct { payloadChecksum *refs.Checksum + payload []byte + // TODO: add other fields } @@ -75,6 +77,14 @@ func (o *Object) Verify() error { return nil } +func (o *Object) GetPayload() []byte { + if o != nil { + return o.payload + } + + return nil +} + // ToV2 converts object to v2 Object message. func (o *Object) ToV2() *object.Object { obj, _ := o.rwObject.ToV2(nil) @@ -147,6 +157,7 @@ func (o *rwObject) ToV2(key *ecdsa.PrivateKey) (*object.Object, error) { obj := new(object.Object) obj.SetObjectID(o.id.ToV2()) obj.SetHeader(hdr) + obj.SetPayload(o.payload) sig := new(refs.Signature) sig.SetKey(o.key) @@ -195,6 +206,7 @@ func FromV2(oV2 *object.Object) (*Object, error) { cid: cid, ownerID: ownerID, payloadChecksum: hdr.GetPayloadHash(), + payload: oV2.GetPayload(), }, }, nil } From acbdbd410e0be911b801c55849447861ca1b1969 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 2 Sep 2020 14:51:29 +0300 Subject: [PATCH 0382/1196] [#132] sdk/object: Implement useful methods and function Implement method to get address of the object. Implement method to copy the object w/o payload. Implement function of object deserialization. Signed-off-by: Leonard Lyubich --- pkg/object/object.go | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/pkg/object/object.go b/pkg/object/object.go index 22688dd..be1f5b8 100644 --- a/pkg/object/object.go +++ b/pkg/object/object.go @@ -77,6 +77,19 @@ func (o *Object) Verify() error { return nil } +// Address returns address of the object. +func (o *Object) Address() *Address { + if o != nil { + return &Address{ + cid: o.cid, + oid: o.id, + } + } + + return nil +} + +// GetPayload returns object payload bytes. func (o *Object) GetPayload() []byte { if o != nil { return o.payload @@ -85,6 +98,25 @@ func (o *Object) GetPayload() []byte { return nil } +// CutPayload copies object fields w/o payload. +func (o *Object) CutPayload() *Object { + if o != nil { + return &Object{ + rwObject: rwObject{ + fin: o.fin, + id: o.id, + key: o.key, + sig: o.sig, + cid: o.cid, + ownerID: o.ownerID, + payloadChecksum: o.payloadChecksum, + }, + } + } + + return nil +} + // ToV2 converts object to v2 Object message. func (o *Object) ToV2() *object.Object { obj, _ := o.rwObject.ToV2(nil) @@ -210,3 +242,13 @@ func FromV2(oV2 *object.Object) (*Object, error) { }, }, nil } + +// FromBytes restores Object from a binary representation. +func FromBytes(data []byte) (*Object, error) { + oV2 := new(object.Object) + if err := oV2.StableUnmarshal(data); err != nil { + return nil, errors.Wrap(err, "could not unmarshal object") + } + + return FromV2(oV2) +} From de505ddee93a64ef624914e0fba2d231d89ddf72 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Wed, 2 Sep 2020 14:58:28 +0300 Subject: [PATCH 0383/1196] [#133] sdk: Use cid wrapper to sign container delete request StableMarshalerWrapper is not suitable for container delete request, because it signs marshaled structure of container id. As for delete request, container id itself should be signed. Signed-off-by: Alex Vanin --- pkg/client/container.go | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/pkg/client/container.go b/pkg/client/container.go index ef72a83..67301c7 100644 --- a/pkg/client/container.go +++ b/pkg/client/container.go @@ -13,6 +13,18 @@ import ( "github.com/pkg/errors" ) +type delContainerSignWrapper struct { + body *v2container.DeleteRequestBody +} + +func (c delContainerSignWrapper) ReadSignedData(bytes []byte) ([]byte, error) { + return c.body.GetContainerID().GetValue(), nil +} + +func (c delContainerSignWrapper) SignedDataSize() int { + return len(c.body.GetContainerID().GetValue()) +} + func (c Client) PutContainer(ctx context.Context, cnr *container.Container, opts ...CallOption) (*container.ID, error) { switch c.remoteNode.Version.Major { case 2: @@ -55,7 +67,7 @@ func (c Client) ListSelfContainers(ctx context.Context, opts ...CallOption) ([]* func (c Client) DeleteContainer(ctx context.Context, id *container.ID, opts ...CallOption) error { switch c.remoteNode.Version.Major { case 2: - panic("not implemented") + return c.delContainerV2(ctx, id, opts...) default: return unsupportedProtocolErr } @@ -248,13 +260,17 @@ func (c Client) delContainerV2(ctx context.Context, id *container.ID, opts ...Ca reqBody.SetContainerID(id.ToV2()) // sign container - signWrapper := v2signature.StableMarshalerWrapper{SM: reqBody.GetContainerID()} - err := signature.SignDataWithHandler(c.key, signWrapper, func(key []byte, sig []byte) { - containerSignature := new(refs.Signature) - containerSignature.SetKey(key) - containerSignature.SetSign(sig) - reqBody.SetSignature(containerSignature) - }, signature.SignWithRFC6979()) + err := signature.SignDataWithHandler(c.key, + delContainerSignWrapper{ + body: reqBody, + }, + func(key []byte, sig []byte) { + containerSignature := new(refs.Signature) + containerSignature.SetKey(key) + containerSignature.SetSign(sig) + reqBody.SetSignature(containerSignature) + }, + signature.SignWithRFC6979()) if err != nil { return err } From 09cc2a5037109fe97eb44f48a60dc6a9c00e12f9 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Fri, 4 Sep 2020 10:50:09 +0300 Subject: [PATCH 0384/1196] [#134] v2/acl: Regenerate proto files Signed-off-by: Alex Vanin --- v2/acl/grpc/types.go | 29 ++-- v2/acl/grpc/types.pb.go | 375 +++++++++++++++++++++++----------------- 2 files changed, 237 insertions(+), 167 deletions(-) diff --git a/v2/acl/grpc/types.go b/v2/acl/grpc/types.go index 875efa3..adc4339 100644 --- a/v2/acl/grpc/types.go +++ b/v2/acl/grpc/types.go @@ -4,6 +4,13 @@ import ( refs "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" ) +// SetVersion sets version of EACL rules in table. +func (m *EACLTable) SetVersion(v *refs.Version) { + if m != nil { + m.Version = v + } +} + // SetContainerId sets container identifier of the eACL table. func (m *EACLTable) SetContainerId(v *refs.ContainerID) { if m != nil { @@ -33,56 +40,56 @@ func (m *EACLRecord) SetAction(v Action) { } // SetFilters sets filter list of the eACL record. -func (m *EACLRecord) SetFilters(v []*EACLRecord_FilterInfo) { +func (m *EACLRecord) SetFilters(v []*EACLRecord_Filter) { if m != nil { m.Filters = v } } // SetTargets sets target list of the eACL record. -func (m *EACLRecord) SetTargets(v []*EACLRecord_TargetInfo) { +func (m *EACLRecord) SetTargets(v []*EACLRecord_Target) { if m != nil { m.Targets = v } } // SetHeader sets header type of the eACL filter. -func (m *EACLRecord_FilterInfo) SetHeader(v HeaderType) { +func (m *EACLRecord_Filter) SetHeader(v HeaderType) { if m != nil { - m.Header = v + m.HeaderType = v } } // SetMatchType sets match type of the eACL filter. -func (m *EACLRecord_FilterInfo) SetMatchType(v MatchType) { +func (m *EACLRecord_Filter) SetMatchType(v MatchType) { if m != nil { m.MatchType = v } } // SetHeaderName sets header name of the eACL filter. -func (m *EACLRecord_FilterInfo) SetHeaderName(v string) { +func (m *EACLRecord_Filter) SetHeaderName(v string) { if m != nil { m.HeaderName = v } } // SetHeaderVal sets header value of the eACL filter. -func (m *EACLRecord_FilterInfo) SetHeaderVal(v string) { +func (m *EACLRecord_Filter) SetHeaderVal(v string) { if m != nil { m.HeaderVal = v } } -// SetTarget sets target group of the eACL target. -func (m *EACLRecord_TargetInfo) SetTarget(v Target) { +// SetRole sets target group of the eACL target. +func (m *EACLRecord_Target) SetRole(v Role) { if m != nil { - m.Target = v + m.Role = v } } // SetKeyList sets key list of the eACL target. -func (m *EACLRecord_TargetInfo) SetKeyList(v [][]byte) { +func (m *EACLRecord_Target) SetKeyList(v [][]byte) { if m != nil { m.KeyList = v } diff --git a/v2/acl/grpc/types.pb.go b/v2/acl/grpc/types.pb.go index 7c240bd..5b4422e 100644 --- a/v2/acl/grpc/types.pb.go +++ b/v2/acl/grpc/types.pb.go @@ -23,40 +23,40 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package -// Target of the access control rule in access control list. -type Target int32 +// Target role of the access control rule in access control list. +type Role int32 const ( - // Unspecified target, default value. - Target_TARGET_UNSPECIFIED Target = 0 + // Unspecified role, default value. + Role_ROLE_UNSPECIFIED Role = 0 // User target rule is applied if sender is the owner of the container. - Target_USER Target = 1 + Role_USER Role = 1 // System target rule is applied if sender is the storage node within the // container or inner ring node. - Target_SYSTEM Target = 2 + Role_SYSTEM Role = 2 // Others target rule is applied if sender is not user or system target. - Target_OTHERS Target = 3 + Role_OTHERS Role = 3 ) -var Target_name = map[int32]string{ - 0: "TARGET_UNSPECIFIED", +var Role_name = map[int32]string{ + 0: "ROLE_UNSPECIFIED", 1: "USER", 2: "SYSTEM", 3: "OTHERS", } -var Target_value = map[string]int32{ - "TARGET_UNSPECIFIED": 0, - "USER": 1, - "SYSTEM": 2, - "OTHERS": 3, +var Role_value = map[string]int32{ + "ROLE_UNSPECIFIED": 0, + "USER": 1, + "SYSTEM": 2, + "OTHERS": 3, } -func (x Target) String() string { - return proto.EnumName(Target_name, int32(x)) +func (x Role) String() string { + return proto.EnumName(Role_name, int32(x)) } -func (Target) EnumDescriptor() ([]byte, []int) { +func (Role) EnumDescriptor() ([]byte, []int) { return fileDescriptor_8233b6696fb3e24f, []int{0} } @@ -215,12 +215,12 @@ type EACLRecord struct { // Action carries ACL target action. Action Action `protobuf:"varint,2,opt,name=action,json=Action,proto3,enum=neo.fs.v2.acl.Action" json:"action,omitempty"` // filters carries set of filters. - Filters []*EACLRecord_FilterInfo `protobuf:"bytes,3,rep,name=filters,json=Filters,proto3" json:"filters,omitempty"` + Filters []*EACLRecord_Filter `protobuf:"bytes,3,rep,name=filters,json=Filters,proto3" json:"filters,omitempty"` // targets carries information about extended ACL target list. - Targets []*EACLRecord_TargetInfo `protobuf:"bytes,4,rep,name=targets,json=Targets,proto3" json:"targets,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Targets []*EACLRecord_Target `protobuf:"bytes,4,rep,name=targets,json=Targets,proto3" json:"targets,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *EACLRecord) Reset() { *m = EACLRecord{} } @@ -270,24 +270,24 @@ func (m *EACLRecord) GetAction() Action { return Action_ACTION_UNSPECIFIED } -func (m *EACLRecord) GetFilters() []*EACLRecord_FilterInfo { +func (m *EACLRecord) GetFilters() []*EACLRecord_Filter { if m != nil { return m.Filters } return nil } -func (m *EACLRecord) GetTargets() []*EACLRecord_TargetInfo { +func (m *EACLRecord) GetTargets() []*EACLRecord_Target { if m != nil { return m.Targets } return nil } -// FilterInfo groups information about filter. -type EACLRecord_FilterInfo struct { +// Filter definition +type EACLRecord_Filter struct { // Header carries type of header. - Header HeaderType `protobuf:"varint,1,opt,name=header,json=HeaderType,proto3,enum=neo.fs.v2.acl.HeaderType" json:"header,omitempty"` + HeaderType HeaderType `protobuf:"varint,1,opt,name=header_type,json=HeaderType,proto3,enum=neo.fs.v2.acl.HeaderType" json:"header_type,omitempty"` // MatchType carries type of match. MatchType MatchType `protobuf:"varint,2,opt,name=match_type,json=MatchType,proto3,enum=neo.fs.v2.acl.MatchType" json:"match_type,omitempty"` // header_name carries name of filtering header. @@ -299,18 +299,18 @@ type EACLRecord_FilterInfo struct { XXX_sizecache int32 `json:"-"` } -func (m *EACLRecord_FilterInfo) Reset() { *m = EACLRecord_FilterInfo{} } -func (m *EACLRecord_FilterInfo) String() string { return proto.CompactTextString(m) } -func (*EACLRecord_FilterInfo) ProtoMessage() {} -func (*EACLRecord_FilterInfo) Descriptor() ([]byte, []int) { +func (m *EACLRecord_Filter) Reset() { *m = EACLRecord_Filter{} } +func (m *EACLRecord_Filter) String() string { return proto.CompactTextString(m) } +func (*EACLRecord_Filter) ProtoMessage() {} +func (*EACLRecord_Filter) Descriptor() ([]byte, []int) { return fileDescriptor_8233b6696fb3e24f, []int{0, 0} } -func (m *EACLRecord_FilterInfo) XXX_Unmarshal(b []byte) error { +func (m *EACLRecord_Filter) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *EACLRecord_FilterInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *EACLRecord_Filter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_EACLRecord_FilterInfo.Marshal(b, m, deterministic) + return xxx_messageInfo_EACLRecord_Filter.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -320,50 +320,50 @@ func (m *EACLRecord_FilterInfo) XXX_Marshal(b []byte, deterministic bool) ([]byt return b[:n], nil } } -func (m *EACLRecord_FilterInfo) XXX_Merge(src proto.Message) { - xxx_messageInfo_EACLRecord_FilterInfo.Merge(m, src) +func (m *EACLRecord_Filter) XXX_Merge(src proto.Message) { + xxx_messageInfo_EACLRecord_Filter.Merge(m, src) } -func (m *EACLRecord_FilterInfo) XXX_Size() int { +func (m *EACLRecord_Filter) XXX_Size() int { return m.Size() } -func (m *EACLRecord_FilterInfo) XXX_DiscardUnknown() { - xxx_messageInfo_EACLRecord_FilterInfo.DiscardUnknown(m) +func (m *EACLRecord_Filter) XXX_DiscardUnknown() { + xxx_messageInfo_EACLRecord_Filter.DiscardUnknown(m) } -var xxx_messageInfo_EACLRecord_FilterInfo proto.InternalMessageInfo +var xxx_messageInfo_EACLRecord_Filter proto.InternalMessageInfo -func (m *EACLRecord_FilterInfo) GetHeader() HeaderType { +func (m *EACLRecord_Filter) GetHeaderType() HeaderType { if m != nil { - return m.Header + return m.HeaderType } return HeaderType_HEADER_UNSPECIFIED } -func (m *EACLRecord_FilterInfo) GetMatchType() MatchType { +func (m *EACLRecord_Filter) GetMatchType() MatchType { if m != nil { return m.MatchType } return MatchType_MATCH_TYPE_UNSPECIFIED } -func (m *EACLRecord_FilterInfo) GetHeaderName() string { +func (m *EACLRecord_Filter) GetHeaderName() string { if m != nil { return m.HeaderName } return "" } -func (m *EACLRecord_FilterInfo) GetHeaderVal() string { +func (m *EACLRecord_Filter) GetHeaderVal() string { if m != nil { return m.HeaderVal } return "" } -// TargetInfo groups information about extended ACL target. -type EACLRecord_TargetInfo struct { +// Information about extended ACL target. +type EACLRecord_Target struct { // target carries target of ACL rule. - Target Target `protobuf:"varint,1,opt,name=target,json=Role,proto3,enum=neo.fs.v2.acl.Target" json:"target,omitempty"` + Role Role `protobuf:"varint,1,opt,name=role,json=Role,proto3,enum=neo.fs.v2.acl.Role" json:"role,omitempty"` // key_list carries public keys of ACL target. KeyList [][]byte `protobuf:"bytes,2,rep,name=key_list,json=Keys,proto3" json:"key_list,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` @@ -371,18 +371,18 @@ type EACLRecord_TargetInfo struct { XXX_sizecache int32 `json:"-"` } -func (m *EACLRecord_TargetInfo) Reset() { *m = EACLRecord_TargetInfo{} } -func (m *EACLRecord_TargetInfo) String() string { return proto.CompactTextString(m) } -func (*EACLRecord_TargetInfo) ProtoMessage() {} -func (*EACLRecord_TargetInfo) Descriptor() ([]byte, []int) { +func (m *EACLRecord_Target) Reset() { *m = EACLRecord_Target{} } +func (m *EACLRecord_Target) String() string { return proto.CompactTextString(m) } +func (*EACLRecord_Target) ProtoMessage() {} +func (*EACLRecord_Target) Descriptor() ([]byte, []int) { return fileDescriptor_8233b6696fb3e24f, []int{0, 1} } -func (m *EACLRecord_TargetInfo) XXX_Unmarshal(b []byte) error { +func (m *EACLRecord_Target) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *EACLRecord_TargetInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *EACLRecord_Target) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_EACLRecord_TargetInfo.Marshal(b, m, deterministic) + return xxx_messageInfo_EACLRecord_Target.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -392,26 +392,26 @@ func (m *EACLRecord_TargetInfo) XXX_Marshal(b []byte, deterministic bool) ([]byt return b[:n], nil } } -func (m *EACLRecord_TargetInfo) XXX_Merge(src proto.Message) { - xxx_messageInfo_EACLRecord_TargetInfo.Merge(m, src) +func (m *EACLRecord_Target) XXX_Merge(src proto.Message) { + xxx_messageInfo_EACLRecord_Target.Merge(m, src) } -func (m *EACLRecord_TargetInfo) XXX_Size() int { +func (m *EACLRecord_Target) XXX_Size() int { return m.Size() } -func (m *EACLRecord_TargetInfo) XXX_DiscardUnknown() { - xxx_messageInfo_EACLRecord_TargetInfo.DiscardUnknown(m) +func (m *EACLRecord_Target) XXX_DiscardUnknown() { + xxx_messageInfo_EACLRecord_Target.DiscardUnknown(m) } -var xxx_messageInfo_EACLRecord_TargetInfo proto.InternalMessageInfo +var xxx_messageInfo_EACLRecord_Target proto.InternalMessageInfo -func (m *EACLRecord_TargetInfo) GetTarget() Target { +func (m *EACLRecord_Target) GetRole() Role { if m != nil { - return m.Target + return m.Role } - return Target_TARGET_UNSPECIFIED + return Role_ROLE_UNSPECIFIED } -func (m *EACLRecord_TargetInfo) GetKeyList() [][]byte { +func (m *EACLRecord_Target) GetKeyList() [][]byte { if m != nil { return m.KeyList } @@ -420,11 +420,14 @@ func (m *EACLRecord_TargetInfo) GetKeyList() [][]byte { // EACLRecord carries the information about extended ACL rules. type EACLTable struct { + // eACL format version. + // Effectively the version of API library used to create eACL Table + Version *grpc.Version `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` // Carries identifier of the container that should use given // access control rules. - ContainerId *grpc.ContainerID `protobuf:"bytes,1,opt,name=container_id,json=ContainerID,proto3" json:"container_id,omitempty"` + ContainerId *grpc.ContainerID `protobuf:"bytes,2,opt,name=container_id,json=ContainerID,proto3" json:"container_id,omitempty"` // Records carries list of extended ACL rule records. - Records []*EACLRecord `protobuf:"bytes,2,rep,name=records,json=Records,proto3" json:"records,omitempty"` + Records []*EACLRecord `protobuf:"bytes,3,rep,name=records,json=Records,proto3" json:"records,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -463,6 +466,13 @@ func (m *EACLTable) XXX_DiscardUnknown() { var xxx_messageInfo_EACLTable proto.InternalMessageInfo +func (m *EACLTable) GetVersion() *grpc.Version { + if m != nil { + return m.Version + } + return nil +} + func (m *EACLTable) GetContainerId() *grpc.ContainerID { if m != nil { return m.ContainerId @@ -670,14 +680,14 @@ func (m *BearerToken_Body_TokenLifetime) GetIat() uint64 { } func init() { - proto.RegisterEnum("neo.fs.v2.acl.Target", Target_name, Target_value) + proto.RegisterEnum("neo.fs.v2.acl.Role", Role_name, Role_value) proto.RegisterEnum("neo.fs.v2.acl.MatchType", MatchType_name, MatchType_value) proto.RegisterEnum("neo.fs.v2.acl.Operation", Operation_name, Operation_value) proto.RegisterEnum("neo.fs.v2.acl.Action", Action_name, Action_value) proto.RegisterEnum("neo.fs.v2.acl.HeaderType", HeaderType_name, HeaderType_value) proto.RegisterType((*EACLRecord)(nil), "neo.fs.v2.acl.EACLRecord") - proto.RegisterType((*EACLRecord_FilterInfo)(nil), "neo.fs.v2.acl.EACLRecord.FilterInfo") - proto.RegisterType((*EACLRecord_TargetInfo)(nil), "neo.fs.v2.acl.EACLRecord.TargetInfo") + proto.RegisterType((*EACLRecord_Filter)(nil), "neo.fs.v2.acl.EACLRecord.Filter") + proto.RegisterType((*EACLRecord_Target)(nil), "neo.fs.v2.acl.EACLRecord.Target") proto.RegisterType((*EACLTable)(nil), "neo.fs.v2.acl.EACLTable") proto.RegisterType((*BearerToken)(nil), "neo.fs.v2.acl.BearerToken") proto.RegisterType((*BearerToken_Body)(nil), "neo.fs.v2.acl.BearerToken.Body") @@ -687,61 +697,62 @@ func init() { func init() { proto.RegisterFile("v2/acl/grpc/types.proto", fileDescriptor_8233b6696fb3e24f) } var fileDescriptor_8233b6696fb3e24f = []byte{ - // 862 bytes of a gzipped FileDescriptorProto + // 869 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x55, 0xdd, 0x6e, 0xe2, 0x46, - 0x18, 0x5d, 0x63, 0x87, 0x9f, 0x8f, 0x6c, 0x65, 0x8d, 0xba, 0x2c, 0xa1, 0x52, 0x1a, 0x45, 0xbd, - 0x88, 0xa8, 0x30, 0x2a, 0xd1, 0x76, 0x2f, 0xaa, 0xae, 0x64, 0x60, 0x02, 0xb4, 0x04, 0x93, 0xf1, - 0xb0, 0x55, 0x7a, 0x83, 0x06, 0x33, 0x10, 0x6b, 0x1d, 0x1b, 0xd9, 0x0e, 0x5b, 0x7a, 0x55, 0xa9, - 0xea, 0x3b, 0xf4, 0x19, 0x7a, 0xd9, 0xa7, 0xe8, 0x65, 0x1f, 0xa1, 0x4a, 0x1f, 0xa3, 0x37, 0xd5, - 0x8c, 0x4d, 0x20, 0xde, 0x95, 0x72, 0xc5, 0xe7, 0xf9, 0xce, 0xf9, 0xce, 0x99, 0x33, 0xa3, 0x01, - 0x5e, 0xae, 0x5b, 0x4d, 0xe6, 0x78, 0xcd, 0x65, 0xb8, 0x72, 0x9a, 0xf1, 0x66, 0xc5, 0x23, 0x63, - 0x15, 0x06, 0x71, 0x80, 0x9e, 0xfb, 0x3c, 0x30, 0x16, 0x91, 0xb1, 0x6e, 0x19, 0xcc, 0xf1, 0x6a, - 0xd5, 0x75, 0xab, 0x19, 0xf2, 0x45, 0xf4, 0x01, 0xf0, 0xf4, 0x3f, 0x15, 0x00, 0x9b, 0x9d, 0x21, - 0xe1, 0x4e, 0x10, 0xce, 0xd1, 0xd7, 0x50, 0x0a, 0x56, 0x3c, 0x64, 0xb1, 0x1b, 0xf8, 0x55, 0xe5, - 0x44, 0x39, 0xfb, 0xa4, 0x55, 0x35, 0x1e, 0xcd, 0x32, 0xac, 0x6d, 0x9f, 0x94, 0x1e, 0x4a, 0xd4, - 0x80, 0x3c, 0x73, 0x24, 0x29, 0x27, 0x49, 0x2f, 0x32, 0x24, 0x53, 0x36, 0x49, 0x3e, 0xf9, 0x45, - 0x6f, 0xa0, 0xb0, 0x70, 0xbd, 0x98, 0x87, 0x51, 0x55, 0x3d, 0x51, 0xcf, 0xca, 0xad, 0x2f, 0x32, - 0xf8, 0x9d, 0x25, 0xe3, 0x42, 0x02, 0x07, 0xfe, 0x22, 0x20, 0x85, 0xa4, 0x8e, 0x04, 0x3f, 0x66, - 0xe1, 0x92, 0xc7, 0x51, 0x55, 0x7b, 0x8a, 0x4f, 0x25, 0x30, 0xe1, 0x27, 0x75, 0x54, 0xfb, 0x53, - 0x01, 0xd8, 0xcd, 0x45, 0xaf, 0x20, 0x7f, 0xc3, 0xd9, 0x9c, 0x87, 0xe9, 0x96, 0x8f, 0x32, 0xd3, - 0xfa, 0xb2, 0x49, 0x37, 0x2b, 0x4e, 0x60, 0x57, 0xa3, 0xd7, 0x00, 0xb7, 0x2c, 0x76, 0x6e, 0xa6, - 0x22, 0xd0, 0x74, 0xe3, 0xd9, 0xb4, 0x2e, 0x05, 0x40, 0x32, 0x4b, 0x0f, 0x25, 0x3a, 0x82, 0x72, - 0xa2, 0x37, 0xf5, 0xd9, 0x2d, 0xaf, 0xaa, 0x27, 0xca, 0x59, 0x89, 0x68, 0x23, 0x76, 0x2b, 0x5a, - 0x90, 0xb6, 0xd6, 0xcc, 0xab, 0x6a, 0xb2, 0x73, 0xf0, 0x96, 0x79, 0x77, 0xbc, 0x76, 0x05, 0xb0, - 0xdb, 0x0b, 0xfa, 0x12, 0xf2, 0x49, 0x04, 0xa9, 0xe7, 0x6c, 0xe2, 0x09, 0x94, 0x68, 0x24, 0xf0, - 0x38, 0xaa, 0x40, 0xf1, 0x1d, 0xdf, 0x4c, 0x3d, 0x37, 0x8a, 0xab, 0xb9, 0x13, 0xf5, 0xec, 0x90, - 0x68, 0xdf, 0xf3, 0x4d, 0x74, 0xfa, 0x8b, 0x02, 0x25, 0x11, 0x15, 0x65, 0x33, 0x8f, 0xa3, 0x37, - 0x70, 0xe8, 0x04, 0x7e, 0xcc, 0x5c, 0x9f, 0x87, 0x53, 0x77, 0x2e, 0x07, 0x97, 0x5b, 0x9f, 0xed, - 0x0d, 0x16, 0x77, 0xc8, 0xe8, 0x6c, 0x31, 0x83, 0x2e, 0x29, 0xef, 0x7d, 0xa0, 0x73, 0x28, 0x84, - 0x32, 0xf3, 0x48, 0x8a, 0x94, 0x3f, 0xc8, 0x71, 0x77, 0x2a, 0xa4, 0x90, 0xfc, 0x46, 0xa7, 0xbf, - 0xaa, 0x50, 0x6e, 0x73, 0x16, 0xf2, 0x90, 0x06, 0xef, 0xb8, 0x8f, 0xce, 0x41, 0x9b, 0x05, 0xf3, - 0x4d, 0x2a, 0xfe, 0x79, 0x66, 0xc2, 0x1e, 0xd2, 0x68, 0x07, 0xf3, 0x0d, 0x91, 0x60, 0xf4, 0x1a, - 0x4a, 0x91, 0xbb, 0xf4, 0x59, 0x7c, 0x17, 0x26, 0x07, 0xf1, 0x58, 0x5b, 0xda, 0xb6, 0xb7, 0x00, - 0xb2, 0xc3, 0xd6, 0x7e, 0xcb, 0x81, 0xd6, 0x4e, 0x26, 0x00, 0x67, 0x8e, 0x37, 0x8d, 0x45, 0x12, - 0xa9, 0x78, 0xf5, 0x23, 0xf6, 0x65, 0x52, 0xa4, 0x24, 0xb0, 0x49, 0x68, 0x2d, 0x28, 0x06, 0xef, - 0xd3, 0xc0, 0x12, 0xe5, 0x97, 0x59, 0x65, 0xeb, 0x7d, 0x12, 0x56, 0x41, 0x02, 0x07, 0x73, 0x34, - 0x80, 0xa2, 0xe7, 0x2e, 0x78, 0xec, 0xa6, 0x87, 0x5f, 0x6e, 0x35, 0x9e, 0xd8, 0xa7, 0x21, 0xcb, - 0x61, 0x4a, 0x22, 0x0f, 0xf4, 0x1a, 0x86, 0xe7, 0x8f, 0x5a, 0x48, 0x07, 0x95, 0xff, 0xb4, 0x92, - 0x3b, 0xd0, 0x88, 0x28, 0xc5, 0x8a, 0x3f, 0x5b, 0x48, 0x73, 0x1a, 0x11, 0xa5, 0x58, 0x71, 0x59, - 0x2c, 0xa5, 0x35, 0x22, 0xca, 0x7a, 0x1b, 0xf2, 0xc9, 0x85, 0x41, 0x15, 0x40, 0xd4, 0x24, 0x3d, - 0x4c, 0xa7, 0x93, 0x91, 0x3d, 0xc6, 0x9d, 0xc1, 0xc5, 0x00, 0x77, 0xf5, 0x67, 0xa8, 0x08, 0xda, - 0xc4, 0xc6, 0x44, 0x57, 0x10, 0x40, 0xde, 0xbe, 0xb6, 0x29, 0xbe, 0xd4, 0x73, 0xa2, 0xb6, 0x68, - 0x1f, 0x13, 0x5b, 0x57, 0xeb, 0x16, 0xec, 0x5d, 0xf1, 0x1a, 0x54, 0x2e, 0x4d, 0xda, 0xe9, 0x4f, - 0xe9, 0xf5, 0x18, 0x67, 0x46, 0xe9, 0x70, 0x68, 0x53, 0x32, 0x18, 0xf5, 0xa6, 0xf8, 0x6a, 0x62, - 0x0e, 0x75, 0x05, 0x7d, 0x0a, 0x7a, 0xba, 0x32, 0xb2, 0x68, 0xba, 0x9a, 0xab, 0xff, 0x0c, 0x7b, - 0x2f, 0xcc, 0x11, 0xbc, 0xb0, 0xc6, 0x98, 0x98, 0x74, 0x60, 0x8d, 0x32, 0xf3, 0x0a, 0xa0, 0xf6, - 0x30, 0xd5, 0x15, 0xe1, 0xb1, 0x8f, 0xcd, 0xae, 0x9e, 0x13, 0x4b, 0xe3, 0x09, 0xd5, 0x55, 0x61, - 0xb0, 0x8b, 0x87, 0x98, 0x62, 0x5d, 0x93, 0xc6, 0xb1, 0x49, 0x3a, 0x7d, 0xfd, 0x00, 0x1d, 0x42, - 0xb1, 0x87, 0x29, 0x31, 0x47, 0x3d, 0xac, 0xe7, 0x85, 0xa3, 0xed, 0x57, 0xdf, 0xb4, 0xfb, 0x7a, - 0xa1, 0xfe, 0x0a, 0xb6, 0x6f, 0x55, 0x05, 0x90, 0xd9, 0xf9, 0x88, 0x6a, 0x09, 0x0e, 0xcc, 0xe1, - 0xd0, 0xfa, 0x21, 0xd1, 0xed, 0xe2, 0xd1, 0xb5, 0x9e, 0xab, 0x7f, 0x0b, 0xfb, 0x0f, 0x44, 0x05, - 0x90, 0xf0, 0x83, 0x49, 0x86, 0x5a, 0x86, 0x02, 0xc1, 0x57, 0x13, 0x6c, 0xd3, 0x24, 0x4e, 0xab, - 0xfd, 0x1d, 0xee, 0x50, 0x3d, 0xd7, 0x7e, 0xfb, 0xd7, 0xfd, 0xb1, 0xf2, 0xf7, 0xfd, 0xb1, 0xf2, - 0xcf, 0xfd, 0xb1, 0xf2, 0xfb, 0xbf, 0xc7, 0xcf, 0x7e, 0xfc, 0x6a, 0xe9, 0xc6, 0x37, 0x77, 0x33, - 0xc3, 0x09, 0x6e, 0x9b, 0x7e, 0xb4, 0x72, 0x9c, 0xc6, 0x9c, 0xaf, 0x9b, 0x3e, 0x0f, 0x16, 0x51, - 0x83, 0xad, 0xdc, 0xc6, 0x32, 0x68, 0xee, 0xfd, 0x07, 0x7c, 0xc3, 0x1c, 0xef, 0x8f, 0x9c, 0x3e, - 0xe2, 0xc1, 0x85, 0x6d, 0x98, 0xe3, 0x81, 0xb8, 0x4e, 0xa6, 0xe3, 0xcd, 0xf2, 0xf2, 0xb1, 0x3f, - 0xff, 0x3f, 0x00, 0x00, 0xff, 0xff, 0x0d, 0x9c, 0x67, 0x62, 0x30, 0x06, 0x00, 0x00, + 0x14, 0x5e, 0xff, 0x04, 0xc3, 0x21, 0x5b, 0x59, 0xd3, 0x6e, 0x16, 0xa8, 0x94, 0xa2, 0xdc, 0x34, + 0x42, 0xc2, 0x68, 0x89, 0xda, 0x95, 0xb6, 0xea, 0x4a, 0x06, 0x26, 0x81, 0x96, 0x60, 0x76, 0x6c, + 0x52, 0xa5, 0x37, 0x68, 0x30, 0x03, 0xb1, 0xd6, 0xb1, 0x91, 0xed, 0xb0, 0xa5, 0xb7, 0x55, 0xdf, + 0xa1, 0xcf, 0xd0, 0xdb, 0x7d, 0x89, 0x5e, 0xf6, 0x11, 0xaa, 0xf4, 0xb6, 0x0f, 0x51, 0xcd, 0x18, + 0x27, 0xc4, 0x9b, 0xd5, 0xde, 0x30, 0xc7, 0x73, 0xbe, 0xef, 0x9c, 0xef, 0x7c, 0x33, 0xd8, 0xf0, + 0x7c, 0xdd, 0x6e, 0x51, 0xd7, 0x6f, 0x2d, 0xa3, 0x95, 0xdb, 0x4a, 0x36, 0x2b, 0x16, 0x1b, 0xab, + 0x28, 0x4c, 0x42, 0xf4, 0x34, 0x60, 0xa1, 0xb1, 0x88, 0x8d, 0x75, 0xdb, 0xa0, 0xae, 0x5f, 0xab, + 0xac, 0xdb, 0xad, 0x88, 0x2d, 0xe2, 0x0f, 0x80, 0x47, 0xff, 0x29, 0x00, 0xd8, 0xec, 0x0e, 0x09, + 0x73, 0xc3, 0x68, 0x8e, 0xbe, 0x85, 0x52, 0xb8, 0x62, 0x11, 0x4d, 0xbc, 0x30, 0xa8, 0x48, 0x75, + 0xe9, 0xf8, 0xb3, 0x76, 0xc5, 0x78, 0x50, 0xcb, 0xb0, 0xb2, 0x3c, 0x29, 0xdd, 0x85, 0xa8, 0x09, + 0x05, 0xea, 0x0a, 0x92, 0x2c, 0x48, 0xcf, 0x72, 0x24, 0x53, 0x24, 0x49, 0x21, 0x5d, 0xd1, 0x2b, + 0xd0, 0x16, 0x9e, 0x9f, 0xb0, 0x28, 0xae, 0x28, 0x75, 0xe5, 0xb8, 0xdc, 0xae, 0xe7, 0xf0, 0xf7, + 0x92, 0x8c, 0x53, 0x01, 0x24, 0x5a, 0xba, 0xc6, 0x9c, 0x9b, 0xd0, 0x68, 0xc9, 0x92, 0xb8, 0xa2, + 0x7e, 0x8a, 0xeb, 0x08, 0x20, 0xd1, 0xd2, 0x35, 0xae, 0xbd, 0x97, 0xa0, 0x90, 0xd6, 0x41, 0xaf, + 0xa0, 0x7c, 0xc5, 0xe8, 0x9c, 0x45, 0x53, 0x6e, 0xc7, 0x76, 0xd6, 0x6a, 0xae, 0x54, 0x5f, 0x20, + 0x9c, 0xcd, 0x8a, 0x11, 0xb8, 0x8f, 0xd1, 0x4b, 0x80, 0x6b, 0x9a, 0xb8, 0x57, 0x29, 0x55, 0x7e, + 0xd4, 0xa6, 0x73, 0x0e, 0x10, 0xcc, 0xd2, 0x5d, 0x88, 0xaa, 0x77, 0x4d, 0x03, 0x7a, 0xcd, 0x2a, + 0x4a, 0x5d, 0x3a, 0x2e, 0x11, 0x75, 0x44, 0xaf, 0x79, 0x0a, 0xb6, 0xa9, 0x35, 0xf5, 0x2b, 0xaa, + 0xc8, 0xec, 0x5d, 0x50, 0xff, 0x86, 0xd5, 0x06, 0x50, 0x48, 0x07, 0x40, 0x5f, 0x83, 0x1a, 0x85, + 0x7e, 0xa6, 0xf6, 0xf3, 0x5c, 0x4b, 0x12, 0xfa, 0x8c, 0xa8, 0xfc, 0x17, 0x1d, 0x40, 0xf1, 0x2d, + 0xdb, 0x4c, 0x7d, 0x2f, 0x4e, 0x2a, 0x72, 0x5d, 0x39, 0xde, 0x27, 0xea, 0x8f, 0x6c, 0x13, 0x1f, + 0xbd, 0x97, 0xa0, 0xc4, 0xfd, 0x71, 0xe8, 0xcc, 0x67, 0xe8, 0x05, 0x68, 0x6b, 0x16, 0xc5, 0xd9, + 0x59, 0x97, 0xdb, 0xcf, 0x77, 0x2a, 0xf2, 0xfb, 0x62, 0x5c, 0xa4, 0x69, 0x92, 0xe1, 0xd0, 0x6b, + 0xd8, 0x77, 0xc3, 0x20, 0xa1, 0x5e, 0xc0, 0xa2, 0xa9, 0x37, 0x17, 0xc3, 0x97, 0xdb, 0x5f, 0xe6, + 0x79, 0xdd, 0x0c, 0x33, 0xe8, 0x91, 0xf2, 0xce, 0x03, 0x3a, 0x01, 0x2d, 0x12, 0x67, 0x93, 0x9d, + 0x7c, 0xf5, 0xa3, 0xa7, 0x47, 0xb4, 0x74, 0x8d, 0x8f, 0x7e, 0x53, 0xa0, 0xdc, 0x61, 0x34, 0x62, + 0x91, 0x13, 0xbe, 0x65, 0x01, 0x3a, 0x01, 0x75, 0x16, 0xce, 0x37, 0x5b, 0xd1, 0x5f, 0xe5, 0x2a, + 0xec, 0x20, 0x8d, 0x4e, 0x38, 0xdf, 0x10, 0x01, 0x46, 0x2f, 0xa1, 0x14, 0x7b, 0xcb, 0x80, 0x26, + 0x37, 0x11, 0xdb, 0xca, 0xae, 0xe6, 0x65, 0xdb, 0x19, 0x80, 0xdc, 0x63, 0x6b, 0xbf, 0xcb, 0xa0, + 0x76, 0xd2, 0x0a, 0xc0, 0xa8, 0xeb, 0x4f, 0x13, 0x6e, 0xde, 0xb6, 0x79, 0xe5, 0x11, 0xf9, 0xc2, + 0x5c, 0x52, 0xe2, 0xd8, 0xd4, 0xe7, 0x36, 0x14, 0xc3, 0x77, 0x0f, 0x0c, 0xfb, 0xc0, 0x68, 0xeb, + 0x5d, 0x6a, 0x96, 0x26, 0x80, 0x83, 0x39, 0x1a, 0x40, 0xd1, 0xf7, 0x16, 0x2c, 0xf1, 0xb6, 0xf7, + 0xa4, 0xdc, 0x6e, 0x7e, 0x62, 0x4e, 0x43, 0x84, 0xc3, 0x2d, 0x89, 0xdc, 0xd1, 0x6b, 0x18, 0x9e, + 0x3e, 0x48, 0x21, 0x1d, 0x14, 0xf6, 0xcb, 0x4a, 0x4c, 0xa0, 0x12, 0x1e, 0xf2, 0x9d, 0x60, 0xb6, + 0x10, 0xe2, 0x54, 0xc2, 0x43, 0xbe, 0xe3, 0xd1, 0x44, 0xb4, 0x56, 0x09, 0x0f, 0x1b, 0xaf, 0x21, + 0xbd, 0x5b, 0x5f, 0x80, 0x4e, 0xac, 0x21, 0x9e, 0x4e, 0x46, 0xf6, 0x18, 0x77, 0x07, 0xa7, 0x03, + 0xdc, 0xd3, 0x9f, 0xa0, 0x22, 0xa8, 0x13, 0x1b, 0x13, 0x5d, 0x42, 0x00, 0x05, 0xfb, 0xd2, 0x76, + 0xf0, 0xb9, 0x2e, 0xf3, 0xd8, 0x72, 0xfa, 0x98, 0xd8, 0xba, 0xd2, 0xb0, 0x60, 0xe7, 0x9f, 0x50, + 0x83, 0x83, 0x73, 0xd3, 0xe9, 0xf6, 0xa7, 0xce, 0xe5, 0x38, 0x5f, 0x4a, 0x87, 0x7d, 0xdb, 0x21, + 0x83, 0xd1, 0xd9, 0x14, 0xbf, 0x99, 0x98, 0x43, 0x5d, 0xe2, 0x2d, 0xb7, 0x3b, 0x23, 0xcb, 0xd9, + 0xee, 0xca, 0x8d, 0x5f, 0x61, 0xe7, 0x0d, 0x54, 0x85, 0x67, 0xd6, 0x18, 0x13, 0xd3, 0x19, 0x58, + 0xa3, 0x5c, 0x3d, 0x0d, 0x94, 0x33, 0xec, 0xe8, 0x12, 0xd7, 0xd8, 0xc7, 0x66, 0x4f, 0x97, 0xf9, + 0xd6, 0x78, 0xe2, 0xe8, 0x0a, 0x17, 0xd8, 0xc3, 0x43, 0xec, 0x60, 0x5d, 0x15, 0xc2, 0xb1, 0x49, + 0xba, 0x7d, 0x7d, 0x0f, 0xed, 0x43, 0xf1, 0x0c, 0x3b, 0xc4, 0x1c, 0x9d, 0x61, 0xbd, 0xc0, 0x15, + 0x65, 0x4f, 0x7d, 0xd3, 0xee, 0xeb, 0x5a, 0xe3, 0x1b, 0xc8, 0xde, 0x65, 0x07, 0x80, 0xcc, 0xee, + 0x23, 0x5d, 0x4b, 0xb0, 0x67, 0x0e, 0x87, 0xd6, 0x4f, 0x69, 0xdf, 0x1e, 0x1e, 0x5d, 0xea, 0x72, + 0xe3, 0x7b, 0xd8, 0x7d, 0x8f, 0x1c, 0x00, 0xe2, 0x7a, 0x30, 0xc9, 0x51, 0xcb, 0xa0, 0x11, 0xfc, + 0x66, 0x82, 0x6d, 0x27, 0xb5, 0xd3, 0xea, 0xfc, 0x80, 0xbb, 0x8e, 0x2e, 0x77, 0x2e, 0xfe, 0xba, + 0x3d, 0x94, 0xfe, 0xbe, 0x3d, 0x94, 0xfe, 0xb9, 0x3d, 0x94, 0xfe, 0xf8, 0xf7, 0xf0, 0xc9, 0xcf, + 0x2f, 0x96, 0x5e, 0x72, 0x75, 0x33, 0x33, 0xdc, 0xf0, 0xba, 0x15, 0xc4, 0x2b, 0xd7, 0x6d, 0xce, + 0xd9, 0xba, 0x15, 0xb0, 0x70, 0x11, 0x37, 0xe9, 0xca, 0x6b, 0x2e, 0xc3, 0xd6, 0xce, 0x37, 0xe2, + 0x3b, 0xea, 0xfa, 0x7f, 0xca, 0xfa, 0x88, 0x85, 0xa7, 0xb6, 0x61, 0x8e, 0x07, 0xfc, 0x2a, 0x99, + 0xae, 0x3f, 0x2b, 0x88, 0x8f, 0xc1, 0xc9, 0xff, 0x01, 0x00, 0x00, 0xff, 0xff, 0x66, 0x66, 0x9c, + 0x8f, 0x50, 0x06, 0x00, 0x00, } func (m *EACLRecord) Marshal() (dAtA []byte, err error) { @@ -809,7 +820,7 @@ func (m *EACLRecord) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *EACLRecord_FilterInfo) Marshal() (dAtA []byte, err error) { +func (m *EACLRecord_Filter) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -819,12 +830,12 @@ func (m *EACLRecord_FilterInfo) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *EACLRecord_FilterInfo) MarshalTo(dAtA []byte) (int, error) { +func (m *EACLRecord_Filter) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *EACLRecord_FilterInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *EACLRecord_Filter) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -852,15 +863,15 @@ func (m *EACLRecord_FilterInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x10 } - if m.Header != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.Header)) + if m.HeaderType != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.HeaderType)) i-- dAtA[i] = 0x8 } return len(dAtA) - i, nil } -func (m *EACLRecord_TargetInfo) Marshal() (dAtA []byte, err error) { +func (m *EACLRecord_Target) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -870,12 +881,12 @@ func (m *EACLRecord_TargetInfo) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *EACLRecord_TargetInfo) MarshalTo(dAtA []byte) (int, error) { +func (m *EACLRecord_Target) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *EACLRecord_TargetInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *EACLRecord_Target) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -893,8 +904,8 @@ func (m *EACLRecord_TargetInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x12 } } - if m.Target != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.Target)) + if m.Role != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Role)) i-- dAtA[i] = 0x8 } @@ -936,7 +947,7 @@ func (m *EACLTable) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintTypes(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x12 + dAtA[i] = 0x1a } } if m.ContainerId != nil { @@ -949,6 +960,18 @@ func (m *EACLTable) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintTypes(dAtA, i, uint64(size)) } i-- + dAtA[i] = 0x12 + } + if m.Version != nil { + { + size, err := m.Version.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- dAtA[i] = 0xa } return len(dAtA) - i, nil @@ -1151,14 +1174,14 @@ func (m *EACLRecord) Size() (n int) { return n } -func (m *EACLRecord_FilterInfo) Size() (n int) { +func (m *EACLRecord_Filter) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.Header != 0 { - n += 1 + sovTypes(uint64(m.Header)) + if m.HeaderType != 0 { + n += 1 + sovTypes(uint64(m.HeaderType)) } if m.MatchType != 0 { n += 1 + sovTypes(uint64(m.MatchType)) @@ -1177,14 +1200,14 @@ func (m *EACLRecord_FilterInfo) Size() (n int) { return n } -func (m *EACLRecord_TargetInfo) Size() (n int) { +func (m *EACLRecord_Target) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.Target != 0 { - n += 1 + sovTypes(uint64(m.Target)) + if m.Role != 0 { + n += 1 + sovTypes(uint64(m.Role)) } if len(m.KeyList) > 0 { for _, b := range m.KeyList { @@ -1204,6 +1227,10 @@ func (m *EACLTable) Size() (n int) { } var l int _ = l + if m.Version != nil { + l = m.Version.Size() + n += 1 + l + sovTypes(uint64(l)) + } if m.ContainerId != nil { l = m.ContainerId.Size() n += 1 + l + sovTypes(uint64(l)) @@ -1387,7 +1414,7 @@ func (m *EACLRecord) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Filters = append(m.Filters, &EACLRecord_FilterInfo{}) + m.Filters = append(m.Filters, &EACLRecord_Filter{}) if err := m.Filters[len(m.Filters)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -1421,7 +1448,7 @@ func (m *EACLRecord) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Targets = append(m.Targets, &EACLRecord_TargetInfo{}) + m.Targets = append(m.Targets, &EACLRecord_Target{}) if err := m.Targets[len(m.Targets)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -1451,7 +1478,7 @@ func (m *EACLRecord) Unmarshal(dAtA []byte) error { } return nil } -func (m *EACLRecord_FilterInfo) Unmarshal(dAtA []byte) error { +func (m *EACLRecord_Filter) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1474,17 +1501,17 @@ func (m *EACLRecord_FilterInfo) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: FilterInfo: wiretype end group for non-group") + return fmt.Errorf("proto: Filter: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: FilterInfo: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: Filter: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field HeaderType", wireType) } - m.Header = 0 + m.HeaderType = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTypes @@ -1494,7 +1521,7 @@ func (m *EACLRecord_FilterInfo) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Header |= HeaderType(b&0x7F) << shift + m.HeaderType |= HeaderType(b&0x7F) << shift if b < 0x80 { break } @@ -1607,7 +1634,7 @@ func (m *EACLRecord_FilterInfo) Unmarshal(dAtA []byte) error { } return nil } -func (m *EACLRecord_TargetInfo) Unmarshal(dAtA []byte) error { +func (m *EACLRecord_Target) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1630,17 +1657,17 @@ func (m *EACLRecord_TargetInfo) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: TargetInfo: wiretype end group for non-group") + return fmt.Errorf("proto: Target: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: TargetInfo: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: Target: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Target", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Role", wireType) } - m.Target = 0 + m.Role = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTypes @@ -1650,7 +1677,7 @@ func (m *EACLRecord_TargetInfo) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Target |= Target(b&0x7F) << shift + m.Role |= Role(b&0x7F) << shift if b < 0x80 { break } @@ -1742,6 +1769,42 @@ func (m *EACLTable) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Version == nil { + m.Version = &grpc.Version{} + } + if err := m.Version.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ContainerId", wireType) } @@ -1777,7 +1840,7 @@ func (m *EACLTable) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 2: + case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Records", wireType) } From 7a6c5eac1ee4242561bc637948af9ef9664f71b1 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Fri, 4 Sep 2020 10:50:36 +0300 Subject: [PATCH 0385/1196] [#134] v2/acl: Update unified structures Signed-off-by: Alex Vanin --- v2/acl/convert.go | 74 +++++++++++++++++++----------------- v2/acl/marshal.go | 21 +++++++--- v2/acl/marshal_test.go | 28 +++++++++----- v2/acl/types.go | 40 +++++++++++++------ v2/container/marshal_test.go | 2 +- v2/session/marshal_test.go | 2 +- 6 files changed, 104 insertions(+), 63 deletions(-) diff --git a/v2/acl/convert.go b/v2/acl/convert.go index 7bf1684..79ebe5f 100644 --- a/v2/acl/convert.go +++ b/v2/acl/convert.go @@ -5,31 +5,31 @@ import ( "github.com/nspcc-dev/neofs-api-go/v2/refs" ) -// TargetToGRPCField converts unified target enum into grpc enum. -func TargetToGRPCField(t Target) acl.Target { +// RoleToGRPCField converts unified role enum into grpc enum. +func RoleToGRPCField(t Role) acl.Role { switch t { - case TargetUser: - return acl.Target_USER - case TargetSystem: - return acl.Target_SYSTEM - case TargetOthers: - return acl.Target_OTHERS + case RoleUser: + return acl.Role_USER + case RoleSystem: + return acl.Role_SYSTEM + case RoleOthers: + return acl.Role_OTHERS default: - return acl.Target_TARGET_UNSPECIFIED + return acl.Role_ROLE_UNSPECIFIED } } -// TargetFromGRPCField converts grpc enum into unified target enum. -func TargetFromGRPCField(t acl.Target) Target { +// RoleFromGRPCField converts grpc enum into unified role enum. +func RoleFromGRPCField(t acl.Role) Role { switch t { - case acl.Target_USER: - return TargetUser - case acl.Target_SYSTEM: - return TargetSystem - case acl.Target_OTHERS: - return TargetOthers + case acl.Role_USER: + return RoleUser + case acl.Role_SYSTEM: + return RoleSystem + case acl.Role_OTHERS: + return RoleOthers default: - return TargetUnknown + return RoleUnknown } } @@ -150,12 +150,12 @@ func MatchTypeFromGRPCField(t acl.MatchType) MatchType { } // HeaderFilterToGRPCMessage converts unified header filter struct into grpc struct. -func HeaderFilterToGRPCMessage(f *HeaderFilter) *acl.EACLRecord_FilterInfo { +func HeaderFilterToGRPCMessage(f *HeaderFilter) *acl.EACLRecord_Filter { if f == nil { return nil } - m := new(acl.EACLRecord_FilterInfo) + m := new(acl.EACLRecord_Filter) m.SetHeader( HeaderTypeToGRPCField(f.GetHeaderType()), @@ -172,7 +172,7 @@ func HeaderFilterToGRPCMessage(f *HeaderFilter) *acl.EACLRecord_FilterInfo { } // HeaderFilterFromGRPCMessage converts grpc struct into unified header filter struct. -func HeaderFilterFromGRPCMessage(m *acl.EACLRecord_FilterInfo) *HeaderFilter { +func HeaderFilterFromGRPCMessage(m *acl.EACLRecord_Filter) *HeaderFilter { if m == nil { return nil } @@ -180,7 +180,7 @@ func HeaderFilterFromGRPCMessage(m *acl.EACLRecord_FilterInfo) *HeaderFilter { f := new(HeaderFilter) f.SetHeaderType( - HeaderTypeFromGRPCField(m.GetHeader()), + HeaderTypeFromGRPCField(m.GetHeaderType()), ) f.SetMatchType( @@ -193,16 +193,16 @@ func HeaderFilterFromGRPCMessage(m *acl.EACLRecord_FilterInfo) *HeaderFilter { return f } -// TargetInfoToGRPCMessage converts unified target info struct into grpc struct. -func TargetInfoToGRPCMessage(t *TargetInfo) *acl.EACLRecord_TargetInfo { +// TargetToGRPCMessage converts unified role info struct into grpc struct. +func TargetToGRPCMessage(t *TargetInfo) *acl.EACLRecord_Target { if t == nil { return nil } - m := new(acl.EACLRecord_TargetInfo) + m := new(acl.EACLRecord_Target) - m.SetTarget( - TargetToGRPCField(t.GetTarget()), + m.SetRole( + RoleToGRPCField(t.GetRole()), ) m.SetKeyList(t.GetKeyList()) @@ -210,16 +210,16 @@ func TargetInfoToGRPCMessage(t *TargetInfo) *acl.EACLRecord_TargetInfo { return m } -// TargetInfoFromGRPCMessage converts grpc struct into unified target info struct. -func TargetInfoFromGRPCMessage(m *acl.EACLRecord_TargetInfo) *TargetInfo { +// TargetInfoFromGRPCMessage converts grpc struct into unified role info struct. +func TargetInfoFromGRPCMessage(m *acl.EACLRecord_Target) *TargetInfo { if m == nil { return nil } t := new(TargetInfo) - t.SetTarget( - TargetFromGRPCField(m.GetTarget()), + t.SetRole( + RoleFromGRPCField(m.GetRole()), ) t.SetKeyList(m.GetKeyList()) @@ -244,7 +244,7 @@ func RecordToGRPCMessage(r *Record) *acl.EACLRecord { ) filters := r.GetFilters() - filterMsg := make([]*acl.EACLRecord_FilterInfo, 0, len(filters)) + filterMsg := make([]*acl.EACLRecord_Filter, 0, len(filters)) for i := range filters { filterMsg = append(filterMsg, HeaderFilterToGRPCMessage(filters[i])) @@ -253,10 +253,10 @@ func RecordToGRPCMessage(r *Record) *acl.EACLRecord { m.SetFilters(filterMsg) targets := r.GetTargets() - targetMsg := make([]*acl.EACLRecord_TargetInfo, 0, len(targets)) + targetMsg := make([]*acl.EACLRecord_Target, 0, len(targets)) for i := range targets { - targetMsg = append(targetMsg, TargetInfoToGRPCMessage(targets[i])) + targetMsg = append(targetMsg, TargetToGRPCMessage(targets[i])) } m.SetTargets(targetMsg) @@ -309,6 +309,9 @@ func TableToGRPCMessage(t *Table) *acl.EACLTable { m := new(acl.EACLTable) + m.SetVersion( + refs.VersionToGRPCMessage(t.GetVersion()), + ) m.SetContainerId( refs.ContainerIDToGRPCMessage(t.GetContainerID()), ) @@ -333,6 +336,9 @@ func TableFromGRPCMessage(m *acl.EACLTable) *Table { t := new(Table) + t.SetVersion( + refs.VersionFromGRPCMessage(m.GetVersion()), + ) t.SetContainerID( refs.ContainerIDFromGRPCMessage(m.GetContainerId()), ) diff --git a/v2/acl/marshal.go b/v2/acl/marshal.go index ccf5760..dbbf630 100644 --- a/v2/acl/marshal.go +++ b/v2/acl/marshal.go @@ -18,8 +18,9 @@ const ( recordFiltersField = 3 recordTargetsField = 4 - tableContainerIDField = 1 - tableRecordsField = 2 + tableVersionField = 1 + tableContainerIDField = 2 + tableRecordsField = 3 lifetimeExpirationField = 1 lifetimeNotValidBeforeField = 2 @@ -49,6 +50,13 @@ func (t *Table) StableMarshal(buf []byte) ([]byte, error) { err error ) + n, err = proto.NestedStructureMarshal(tableVersionField, buf[offset:], t.version) + if err != nil { + return nil, err + } + + offset += n + n, err = proto.NestedStructureMarshal(tableContainerIDField, buf[offset:], t.cid) if err != nil { return nil, err @@ -74,6 +82,7 @@ func (t *Table) StableSize() (size int) { return 0 } + size += proto.NestedStructureSize(tableVersionField, t.version) size += proto.NestedStructureSize(tableContainerIDField, t.cid) for i := range t.records { @@ -213,7 +222,7 @@ func (f *HeaderFilter) StableSize() (size int) { return size } -// StableMarshal marshals unified target info structure in a protobuf +// StableMarshal marshals unified role info structure in a protobuf // compatible way without field order shuffle. func (t *TargetInfo) StableMarshal(buf []byte) ([]byte, error) { if t == nil { @@ -229,7 +238,7 @@ func (t *TargetInfo) StableMarshal(buf []byte) ([]byte, error) { err error ) - n, err = proto.EnumMarshal(targetTypeField, buf[offset:], int32(t.target)) + n, err = proto.EnumMarshal(targetTypeField, buf[offset:], int32(t.role)) if err != nil { return nil, err } @@ -244,13 +253,13 @@ func (t *TargetInfo) StableMarshal(buf []byte) ([]byte, error) { return buf, nil } -// StableSize of target info structure marshalled by StableMarshal function. +// StableSize of role info structure marshalled by StableMarshal function. func (t *TargetInfo) StableSize() (size int) { if t == nil { return 0 } - size += proto.EnumSize(targetTypeField, int32(t.target)) + size += proto.EnumSize(targetTypeField, int32(t.role)) size += proto.RepeatedBytesSize(targetKeysField, t.keys) return size diff --git a/v2/acl/marshal_test.go b/v2/acl/marshal_test.go index cd471d7..79b187b 100644 --- a/v2/acl/marshal_test.go +++ b/v2/acl/marshal_test.go @@ -10,9 +10,9 @@ import ( "github.com/stretchr/testify/require" ) -func generateTarget(u acl.Target, k int) *acl.TargetInfo { +func generateTarget(u acl.Role, k int) *acl.TargetInfo { target := new(acl.TargetInfo) - target.SetTarget(u) + target.SetRole(u) keys := make([][]byte, k) @@ -39,7 +39,7 @@ func generateRecord(another bool) *acl.Record { switch another { case true: - t1 := generateTarget(acl.TargetUser, 2) + t1 := generateTarget(acl.RoleUser, 2) f1 := generateFilter(acl.HeaderTypeObject, "OID", "ObjectID Value") record.SetOperation(acl.OperationHead) @@ -47,8 +47,8 @@ func generateRecord(another bool) *acl.Record { record.SetTargets([]*acl.TargetInfo{t1}) record.SetFilters([]*acl.HeaderFilter{f1}) default: - t1 := generateTarget(acl.TargetUser, 2) - t2 := generateTarget(acl.TargetSystem, 0) + t1 := generateTarget(acl.RoleUser, 2) + t2 := generateTarget(acl.RoleSystem, 0) f1 := generateFilter(acl.HeaderTypeObject, "CID", "Container ID Value") f2 := generateFilter(acl.HeaderTypeRequest, "X-Header-Key", "X-Header-Value") @@ -65,7 +65,12 @@ func generateEACL() *acl.Table { cid := new(refs.ContainerID) cid.SetValue([]byte("Container ID")) + ver := new(refs.Version) + ver.SetMajor(2) + ver.SetMinor(3) + table := new(acl.Table) + table.SetVersion(ver) table.SetContainerID(cid) table.SetRecords([]*acl.Record{generateRecord(true)}) @@ -111,7 +116,7 @@ func generateBearerToken(id string) *acl.BearerToken { func TestHeaderFilter_StableMarshal(t *testing.T) { filterFrom := generateFilter(acl.HeaderTypeObject, "CID", "Container ID Value") - transport := new(grpc.EACLRecord_FilterInfo) + transport := new(grpc.EACLRecord_Filter) t.Run("non empty", func(t *testing.T) { filterFrom.SetHeaderType(acl.HeaderTypeObject) @@ -131,11 +136,11 @@ func TestHeaderFilter_StableMarshal(t *testing.T) { } func TestTargetInfo_StableMarshal(t *testing.T) { - targetFrom := generateTarget(acl.TargetUser, 2) - transport := new(grpc.EACLRecord_TargetInfo) + targetFrom := generateTarget(acl.RoleUser, 2) + transport := new(grpc.EACLRecord_Target) t.Run("non empty", func(t *testing.T) { - targetFrom.SetTarget(acl.TargetUser) + targetFrom.SetRole(acl.RoleUser) targetFrom.SetKeyList([][]byte{ []byte("Public Key 1"), []byte("Public Key 2"), @@ -176,9 +181,14 @@ func TestTable_StableMarshal(t *testing.T) { cid := new(refs.ContainerID) cid.SetValue([]byte("Container ID")) + ver := new(refs.Version) + ver.SetMajor(2) + ver.SetMinor(3) + r1 := generateRecord(false) r2 := generateRecord(true) + tableFrom.SetVersion(ver) tableFrom.SetContainerID(cid) tableFrom.SetRecords([]*acl.Record{r1, r2}) diff --git a/v2/acl/types.go b/v2/acl/types.go index 5a50b88..38a7044 100644 --- a/v2/acl/types.go +++ b/v2/acl/types.go @@ -15,7 +15,7 @@ type HeaderFilter struct { // TargetInfo is a unified structure of TargetInfo // message from proto definition. type TargetInfo struct { - target Target + role Role keys [][]byte } @@ -35,6 +35,8 @@ type Record struct { // Table is a unified structure of EACLTable // message from proto definition. type Table struct { + version *refs.Version + cid *refs.ContainerID records []*Record @@ -70,8 +72,8 @@ type Action uint32 // Operation is a unified enum of Operation enum from proto definition. type Operation uint32 -// Target is a unified enum of Target enum from proto definition. -type Target uint32 +// Role is a unified enum of Role enum from proto definition. +type Role uint32 const ( MatchTypeUnknown MatchType = iota @@ -103,10 +105,10 @@ const ( ) const ( - TargetUnknown Target = iota - TargetUser - TargetSystem - TargetOthers + RoleUnknown Role = iota + RoleUser + RoleSystem + RoleOthers ) func (f *HeaderFilter) GetHeaderType() HeaderType { @@ -165,17 +167,17 @@ func (f *HeaderFilter) SetValue(v string) { } } -func (t *TargetInfo) GetTarget() Target { +func (t *TargetInfo) GetRole() Role { if t != nil { - return t.target + return t.role } - return TargetUnknown + return RoleUnknown } -func (t *TargetInfo) SetTarget(v Target) { +func (t *TargetInfo) SetRole(v Role) { if t != nil { - t.target = v + t.role = v } } @@ -249,6 +251,20 @@ func (r *Record) SetTargets(v []*TargetInfo) { } } +func (t *Table) GetVersion() *refs.Version { + if t != nil { + return t.version + } + + return nil +} + +func (t *Table) SetVersion(v *refs.Version) { + if t != nil { + t.version = v + } +} + func (t *Table) GetContainerID() *refs.ContainerID { if t != nil { return t.cid diff --git a/v2/container/marshal_test.go b/v2/container/marshal_test.go index 19e5d6e..fba58f5 100644 --- a/v2/container/marshal_test.go +++ b/v2/container/marshal_test.go @@ -351,7 +351,7 @@ func generateListResponseBody(n int) *container.ListResponseBody { func generateEACL(n int, k, v string) *acl.Table { target := new(acl.TargetInfo) - target.SetTarget(acl.TargetUser) + target.SetRole(acl.RoleUser) keys := make([][]byte, n) diff --git a/v2/session/marshal_test.go b/v2/session/marshal_test.go index 0f038c0..c2f4415 100644 --- a/v2/session/marshal_test.go +++ b/v2/session/marshal_test.go @@ -282,7 +282,7 @@ func generateObjectCtx(id string) *session.ObjectSessionContext { func generateEACL(n int, k, v string) *acl.Table { target := new(acl.TargetInfo) - target.SetTarget(acl.TargetUser) + target.SetRole(acl.RoleUser) keys := make([][]byte, n) From 94c4e05aa2514f0bd9fb7002f0ade86cc5e19dda Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Fri, 4 Sep 2020 11:20:08 +0300 Subject: [PATCH 0386/1196] [#134] v2/netmap: Remove prototype of stable marshaller Signed-off-by: Alex Vanin --- v2/netmap/grpc/marshal.go | 362 -------------------------------------- 1 file changed, 362 deletions(-) delete mode 100644 v2/netmap/grpc/marshal.go diff --git a/v2/netmap/grpc/marshal.go b/v2/netmap/grpc/marshal.go deleted file mode 100644 index 58b0685..0000000 --- a/v2/netmap/grpc/marshal.go +++ /dev/null @@ -1,362 +0,0 @@ -package netmap - -import ( - "encoding/binary" - "math/bits" - - "github.com/pkg/errors" -) - -func (m *PlacementPolicy) StableMarshal(buf []byte) ([]byte, error) { - if m == nil { - return []byte{}, nil - } - - if buf == nil { - buf = make([]byte, m.StableSize()) - } - - var ( - i, n, offset int - ) - - // Write replication factor field. - - buf[i] = 0x08 // id:0x1 << 3 | wiretype:0x0 - offset = binary.PutUvarint(buf[i+1:], uint64(m.ReplFactor)) - i += 1 + offset - - // write select/filter groups field - for j := range m.FilterGroups { - buf[i] = 0x12 // id:0x2 << 3 | wiretype:0x2 - - n, _ = m.FilterGroups[j].stableSizeWithExclude() - offset = binary.PutUvarint(buf[i+1:], uint64(n)) - - _, err := m.FilterGroups[j].StableMarshal(buf[i+1+offset:]) - if err != nil { - return nil, errors.Wrapf(err, "can't marshal SFGroup id:%d", j) - } - - i += 1 + offset + n - } - - return buf, nil -} - -func (m *PlacementPolicy) StableSize() int { - if m == nil { - return 0 - } - - var ( - ln, size int - ) - _ = ln - - // size of replication factor field - size += 1 + uvarIntSize(uint64(m.ReplFactor)) // wiretype + varint - - for i := range m.FilterGroups { - ln, _ = m.FilterGroups[i].stableSizeWithExclude() - size += 1 + uvarIntSize(uint64(ln)) + ln // wiretype + size of struct + struct - } - - return size -} - -func (m *PlacementPolicy_FilterGroup) StableMarshal(buf []byte) ([]byte, error) { - if m == nil { - return []byte{}, nil - } - - size, excludeSize := m.stableSizeWithExclude() - if buf == nil { - buf = make([]byte, size) - } - - var ( - i, n, offset int - ) - - // write filters field - for j := range m.Filters { - buf[i] = 0x0A // id:0x1 << 3 | wiretype:0x2 - n = m.Filters[j].stableSize() - offset = binary.PutUvarint(buf[i+1:], uint64(n)) - _, err := m.Filters[j].StableMarshal(buf[i+1+offset:]) - if err != nil { - return nil, errors.Wrapf(err, "can't marshal Filter id:%d", j) - } - i += 1 + offset + n - } - - // write selectors field - for j := range m.Selectors { - buf[i] = 0x12 // id:0x2 << 3 | wiretype:0x2 - n = m.Selectors[j].stableSize() - offset = binary.PutUvarint(buf[i+1:], uint64(n)) - _, err := m.Selectors[j].StableMarshal(buf[i+1+offset:]) - if err != nil { - return nil, errors.Wrapf(err, "can't marshal Selector id:%d", j) - } - i += 1 + offset + n - } - - // write excluded field in packed format - buf[i] = 0x1A // id:0x3 << 3 | wiretype:0x2 - offset = binary.PutUvarint(buf[i+1:], uint64(excludeSize)) - i += 1 + offset - for j := range m.Exclude { - offset = binary.PutUvarint(buf[i:], uint64(m.Exclude[j])) - i += offset - } - - return buf, nil -} - -func (m *PlacementPolicy_FilterGroup) stableSizeWithExclude() (int, int) { - if m == nil { - return 0, 0 - } - - var ( - ln, size int - ) - - // size of filters field - for i := range m.Filters { - ln = m.Filters[i].stableSize() - size += 1 + uvarIntSize(uint64(ln)) + ln // wiretype + size of struct + struct - } - - // size of selectors field - for i := range m.Selectors { - ln = m.Selectors[i].stableSize() - size += 1 + uvarIntSize(uint64(ln)) + ln // wiretype + size of struct + struct - } - - // size of exclude field - ln = 0 - for i := range m.Exclude { - ln += uvarIntSize(uint64(m.Exclude[i])) - } - size += 1 + uvarIntSize(uint64(ln)) + ln // wiretype + packed varints size + packed varints - - return size, ln -} - -func (m *PlacementPolicy_FilterGroup_Selector) StableMarshal(buf []byte) ([]byte, error) { - if m == nil { - return []byte{}, nil - } - - if buf == nil { - buf = make([]byte, m.stableSize()) - } - - var ( - i, offset int - ) - - // write count field - buf[i] = 0x8 // id:0x1 << 3 | wiretype:0x0 - offset = binary.PutUvarint(buf[i+1:], uint64(m.Count)) - i += 1 + offset - - // write key field - buf[i] = 0x12 // id:0x2 << 3 | wiretype:0x2 - offset = binary.PutUvarint(buf[i+1:], uint64(len(m.Key))) - copy(buf[i+1+offset:], m.Key) - - return buf, nil -} - -func (m *PlacementPolicy_FilterGroup_Selector) stableSize() int { - if m == nil { - return 0 - } - - var ( - ln, size int - ) - - // size of count field - size += 1 + uvarIntSize(uint64(m.Count)) - - // size of key field - ln = len(m.Key) - size += 1 + uvarIntSize(uint64(ln)) + ln - - return size -} - -func (m *PlacementPolicy_FilterGroup_Filter) StableMarshal(buf []byte) ([]byte, error) { - if m == nil { - return []byte{}, nil - } - - if buf == nil { - buf = make([]byte, m.stableSize()) - } - - var ( - i, n, offset int - ) - - // write key field - buf[i] = 0x0A // id:0x1 << 3 | wiretype:0x2 - offset = binary.PutUvarint(buf[i+1:], uint64(len(m.Key))) - n = copy(buf[i+1+offset:], m.Key) - i += 1 + offset + n - - // write simple filter field - if m.F != nil { - buf[i] = 0x12 // id:0x2 << 3 | wiretype:0x2 - n = m.F.stableSize() - offset = binary.PutUvarint(buf[i+1:], uint64(n)) - _, err := m.F.StableMarshal(buf[i+1+offset:]) - if err != nil { - return nil, errors.Wrap(err, "can't marshal netmap filter") - } - } - - return buf, nil -} - -func (m *PlacementPolicy_FilterGroup_Filter) stableSize() int { - if m == nil { - return 0 - } - - var ( - ln, size int - ) - - // size of key field - ln = len(m.Key) - size += 1 + uvarIntSize(uint64(ln)) + ln - - // size of simple filter - if m.F != nil { - ln = m.F.stableSize() - size += 1 + uvarIntSize(uint64(ln)) + ln - } - - return size -} - -func (m *PlacementPolicy_FilterGroup_Filter_SimpleFilter) StableMarshal(buf []byte) ([]byte, error) { - if m == nil { - return []byte{}, nil - } - - if buf == nil { - buf = make([]byte, m.stableSize()) - } - - var ( - i, n, offset int - ) - - // write key field - buf[i] = 0x08 // id:0x1 << 3 | wiretype:0x0 - offset = binary.PutUvarint(buf[i+1:], uint64(m.Op)) - i += 1 + offset - - // write value if present - if val, ok := m.Args.(*PlacementPolicy_FilterGroup_Filter_SimpleFilter_Value); ok { - buf[i] = 0x12 // id:0x2 << 3 | wiretype:0x2 - offset = binary.PutUvarint(buf[i+1:], uint64(len(val.Value))) - copy(buf[i+1+offset:], val.Value) - } else if filters, ok := m.Args.(*PlacementPolicy_FilterGroup_Filter_SimpleFilter_FArgs); ok { - if filters.FArgs != nil { - buf[i] = 0x1A // id:0x3 << 3 | wiretype:0x2 - n = filters.FArgs.stableSize() - offset = binary.PutUvarint(buf[i+1:], uint64(n)) - _, err := filters.FArgs.StableMarshal(buf[i+1+offset:]) - if err != nil { - return nil, errors.Wrap(err, "can't marshal simple filters") - } - } - } - - return buf, nil -} - -func (m *PlacementPolicy_FilterGroup_Filter_SimpleFilter) stableSize() int { - if m == nil { - return 0 - } - - var ( - ln, size int - ) - - // size of key field - size += 1 + uvarIntSize(uint64(m.Op)) - - if val, ok := m.Args.(*PlacementPolicy_FilterGroup_Filter_SimpleFilter_Value); ok { - // size of value if present - ln = len(val.Value) - size += 1 + uvarIntSize(uint64(ln)) + ln - } else if filters, ok := m.Args.(*PlacementPolicy_FilterGroup_Filter_SimpleFilter_FArgs); ok { - // size of simple filters if present - if filters.FArgs != nil { - ln = filters.FArgs.stableSize() - size += 1 + uvarIntSize(uint64(ln)) + ln - } - } - - return size -} - -func (m *PlacementPolicy_FilterGroup_Filter_SimpleFilter_SimpleFilters) StableMarshal(buf []byte) ([]byte, error) { - if m == nil { - return []byte{}, nil - } - - if buf == nil { - buf = make([]byte, m.stableSize()) - } - - var ( - i, n, offset int - ) - - // write filters field - for j := range m.Filters { - buf[i] = 0x0A // id:0x1 << 3 | wiretype:0x2 - n = m.Filters[j].stableSize() - offset = binary.PutUvarint(buf[i+1:], uint64(n)) - _, err := m.Filters[j].StableMarshal(buf[i+1+offset:]) - if err != nil { - return nil, errors.Wrapf(err, "can't marshal simple filter id:%d", j) - } - i += 1 + offset + n - } - - return buf, nil -} - -func (m *PlacementPolicy_FilterGroup_Filter_SimpleFilter_SimpleFilters) stableSize() int { - if m == nil { - return 0 - } - var ( - ln, size int - ) - - // size of key field - for i := range m.Filters { - ln = m.Filters[i].stableSize() - size += 1 + uvarIntSize(uint64(ln)) + ln - } - - return size -} - -// uvarIntSize returns length of varint byte sequence for uint64 value 'x'. -func uvarIntSize(x uint64) int { - return (bits.Len64(x|1) + 6) / 7 -} From 505ef59dd647a595350743d1e13dc815b7a38cb5 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Fri, 4 Sep 2020 11:47:15 +0300 Subject: [PATCH 0387/1196] [#134] v2/netmap: Regenerate proto files Signed-off-by: Alex Vanin --- v2/netmap/grpc/service.go | 62 + v2/netmap/grpc/service.pb.go | 1280 +++++++++++++++++ v2/netmap/grpc/types.go | 158 ++- v2/netmap/grpc/types.pb.go | 2533 +++++++++++++++------------------- 4 files changed, 2556 insertions(+), 1477 deletions(-) create mode 100644 v2/netmap/grpc/service.go create mode 100644 v2/netmap/grpc/service.pb.go diff --git a/v2/netmap/grpc/service.go b/v2/netmap/grpc/service.go new file mode 100644 index 0000000..8f27bfd --- /dev/null +++ b/v2/netmap/grpc/service.go @@ -0,0 +1,62 @@ +package netmap + +import ( + "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" + "github.com/nspcc-dev/neofs-api-go/v2/session/grpc" +) + +// SetBody sets body of the request. +func (m *LocalNodeInfoRequest) SetBody(v *LocalNodeInfoRequest_Body) { + if m != nil { + m.Body = v + } +} + +// SetMetaHeader sets meta header of the request. +func (m *LocalNodeInfoRequest) SetMetaHeader(v *session.RequestMetaHeader) { + if m != nil { + m.MetaHeader = v + } +} + +// SetVerifyHeader sets verification header of the request. +func (m *LocalNodeInfoRequest) SetVerifyHeader(v *session.RequestVerificationHeader) { + if m != nil { + m.VerifyHeader = v + } +} + +// SetVersion sets version of response body. +func (m *LocalNodeInfoResponse_Body) SetVersion(v *refs.Version) { + if m != nil { + m.Version = v + } +} + +// SetNodeInfo sets node info of response body. +func (m *LocalNodeInfoResponse_Body) SetNodeInfo(v *NodeInfo) { + if m != nil { + m.NodeInfo = v + } +} + +// SetBody sets body of the response. +func (m *LocalNodeInfoResponse) SetBody(v *LocalNodeInfoResponse_Body) { + if m != nil { + m.Body = v + } +} + +// SetMetaHeader sets meta header of the response. +func (m *LocalNodeInfoResponse) SetMetaHeader(v *session.ResponseMetaHeader) { + if m != nil { + m.MetaHeader = v + } +} + +// SetVerifyHeader sets verification header of the response. +func (m *LocalNodeInfoResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) { + if m != nil { + m.VerifyHeader = v + } +} diff --git a/v2/netmap/grpc/service.pb.go b/v2/netmap/grpc/service.pb.go new file mode 100644 index 0000000..54b7d8c --- /dev/null +++ b/v2/netmap/grpc/service.pb.go @@ -0,0 +1,1280 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: v2/netmap/grpc/service.proto + +package netmap + +import ( + context "context" + fmt "fmt" + proto "github.com/golang/protobuf/proto" + grpc1 "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" + grpc "github.com/nspcc-dev/neofs-api-go/v2/session/grpc" + grpc2 "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package + +// Get NodeInfo from the particular node directly +type LocalNodeInfoRequest struct { + // Body of the balance request message. + Body *LocalNodeInfoRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" 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,proto3" json:"verify_header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *LocalNodeInfoRequest) Reset() { *m = LocalNodeInfoRequest{} } +func (m *LocalNodeInfoRequest) String() string { return proto.CompactTextString(m) } +func (*LocalNodeInfoRequest) ProtoMessage() {} +func (*LocalNodeInfoRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_d8a816fa1f32c636, []int{0} +} +func (m *LocalNodeInfoRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *LocalNodeInfoRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_LocalNodeInfoRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *LocalNodeInfoRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_LocalNodeInfoRequest.Merge(m, src) +} +func (m *LocalNodeInfoRequest) XXX_Size() int { + return m.Size() +} +func (m *LocalNodeInfoRequest) XXX_DiscardUnknown() { + xxx_messageInfo_LocalNodeInfoRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_LocalNodeInfoRequest proto.InternalMessageInfo + +func (m *LocalNodeInfoRequest) GetBody() *LocalNodeInfoRequest_Body { + if m != nil { + return m.Body + } + return nil +} + +func (m *LocalNodeInfoRequest) GetMetaHeader() *grpc.RequestMetaHeader { + if m != nil { + return m.MetaHeader + } + return nil +} + +func (m *LocalNodeInfoRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { + if m != nil { + return m.VerifyHeader + } + return nil +} + +//Request body +type LocalNodeInfoRequest_Body struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *LocalNodeInfoRequest_Body) Reset() { *m = LocalNodeInfoRequest_Body{} } +func (m *LocalNodeInfoRequest_Body) String() string { return proto.CompactTextString(m) } +func (*LocalNodeInfoRequest_Body) ProtoMessage() {} +func (*LocalNodeInfoRequest_Body) Descriptor() ([]byte, []int) { + return fileDescriptor_d8a816fa1f32c636, []int{0, 0} +} +func (m *LocalNodeInfoRequest_Body) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *LocalNodeInfoRequest_Body) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_LocalNodeInfoRequest_Body.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *LocalNodeInfoRequest_Body) XXX_Merge(src proto.Message) { + xxx_messageInfo_LocalNodeInfoRequest_Body.Merge(m, src) +} +func (m *LocalNodeInfoRequest_Body) XXX_Size() int { + return m.Size() +} +func (m *LocalNodeInfoRequest_Body) XXX_DiscardUnknown() { + xxx_messageInfo_LocalNodeInfoRequest_Body.DiscardUnknown(m) +} + +var xxx_messageInfo_LocalNodeInfoRequest_Body proto.InternalMessageInfo + +// Local nod Info, including API Version in use +type LocalNodeInfoResponse struct { + // Body of the balance response message. + Body *LocalNodeInfoResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` + // Carries response meta information. Header data is used only to regulate + // message transport and does not affect response execution. + MetaHeader *grpc.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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,proto3" json:"verify_header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *LocalNodeInfoResponse) Reset() { *m = LocalNodeInfoResponse{} } +func (m *LocalNodeInfoResponse) String() string { return proto.CompactTextString(m) } +func (*LocalNodeInfoResponse) ProtoMessage() {} +func (*LocalNodeInfoResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_d8a816fa1f32c636, []int{1} +} +func (m *LocalNodeInfoResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *LocalNodeInfoResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_LocalNodeInfoResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *LocalNodeInfoResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_LocalNodeInfoResponse.Merge(m, src) +} +func (m *LocalNodeInfoResponse) XXX_Size() int { + return m.Size() +} +func (m *LocalNodeInfoResponse) XXX_DiscardUnknown() { + xxx_messageInfo_LocalNodeInfoResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_LocalNodeInfoResponse proto.InternalMessageInfo + +func (m *LocalNodeInfoResponse) GetBody() *LocalNodeInfoResponse_Body { + if m != nil { + return m.Body + } + return nil +} + +func (m *LocalNodeInfoResponse) GetMetaHeader() *grpc.ResponseMetaHeader { + if m != nil { + return m.MetaHeader + } + return nil +} + +func (m *LocalNodeInfoResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { + if m != nil { + return m.VerifyHeader + } + return nil +} + +//Response body +type LocalNodeInfoResponse_Body struct { + // API version in use + Version *grpc1.Version `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` + // NodeInfo from node itself + NodeInfo *NodeInfo `protobuf:"bytes,2,opt,name=node_info,json=nodeInfo,proto3" json:"node_info,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *LocalNodeInfoResponse_Body) Reset() { *m = LocalNodeInfoResponse_Body{} } +func (m *LocalNodeInfoResponse_Body) String() string { return proto.CompactTextString(m) } +func (*LocalNodeInfoResponse_Body) ProtoMessage() {} +func (*LocalNodeInfoResponse_Body) Descriptor() ([]byte, []int) { + return fileDescriptor_d8a816fa1f32c636, []int{1, 0} +} +func (m *LocalNodeInfoResponse_Body) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *LocalNodeInfoResponse_Body) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_LocalNodeInfoResponse_Body.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *LocalNodeInfoResponse_Body) XXX_Merge(src proto.Message) { + xxx_messageInfo_LocalNodeInfoResponse_Body.Merge(m, src) +} +func (m *LocalNodeInfoResponse_Body) XXX_Size() int { + return m.Size() +} +func (m *LocalNodeInfoResponse_Body) XXX_DiscardUnknown() { + xxx_messageInfo_LocalNodeInfoResponse_Body.DiscardUnknown(m) +} + +var xxx_messageInfo_LocalNodeInfoResponse_Body proto.InternalMessageInfo + +func (m *LocalNodeInfoResponse_Body) GetVersion() *grpc1.Version { + if m != nil { + return m.Version + } + return nil +} + +func (m *LocalNodeInfoResponse_Body) GetNodeInfo() *NodeInfo { + if m != nil { + return m.NodeInfo + } + return nil +} + +func init() { + proto.RegisterType((*LocalNodeInfoRequest)(nil), "neo.fs.v2.netmap.LocalNodeInfoRequest") + proto.RegisterType((*LocalNodeInfoRequest_Body)(nil), "neo.fs.v2.netmap.LocalNodeInfoRequest.Body") + proto.RegisterType((*LocalNodeInfoResponse)(nil), "neo.fs.v2.netmap.LocalNodeInfoResponse") + proto.RegisterType((*LocalNodeInfoResponse_Body)(nil), "neo.fs.v2.netmap.LocalNodeInfoResponse.Body") +} + +func init() { proto.RegisterFile("v2/netmap/grpc/service.proto", fileDescriptor_d8a816fa1f32c636) } + +var fileDescriptor_d8a816fa1f32c636 = []byte{ + // 438 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x93, 0xdf, 0x6a, 0xd4, 0x40, + 0x14, 0xc6, 0xcd, 0x5a, 0xaa, 0x4e, 0x5d, 0x90, 0x51, 0x71, 0x89, 0x12, 0xa4, 0xf8, 0x0f, 0x6c, + 0x66, 0x30, 0x5e, 0xf4, 0xc2, 0x0b, 0xb5, 0x60, 0xb1, 0xa0, 0x8b, 0xa6, 0xd0, 0x0b, 0x6f, 0xd6, + 0x6c, 0x72, 0xb2, 0x1d, 0x30, 0x73, 0xd2, 0x99, 0xe9, 0x40, 0xde, 0xc4, 0x67, 0xf0, 0x49, 0xbc, + 0xf4, 0x11, 0x64, 0xbd, 0xf2, 0x11, 0xbc, 0x93, 0x64, 0xd2, 0xb2, 0x7f, 0xd2, 0xee, 0xde, 0x9d, + 0xe5, 0x7c, 0xdf, 0xb7, 0xe7, 0x77, 0x72, 0x86, 0x3c, 0xb0, 0x11, 0x97, 0x60, 0x8a, 0xa4, 0xe4, + 0x13, 0x55, 0xa6, 0x5c, 0x83, 0xb2, 0x22, 0x05, 0x56, 0x2a, 0x34, 0x48, 0x6f, 0x49, 0x40, 0x96, + 0x6b, 0x66, 0x23, 0xe6, 0x44, 0xbe, 0xbf, 0xa0, 0x37, 0x55, 0x09, 0xda, 0xa9, 0xfd, 0x81, 0x8d, + 0xb8, 0x82, 0x5c, 0x2f, 0x77, 0xee, 0xdb, 0x88, 0x6b, 0xd0, 0x5a, 0xa0, 0x5c, 0x6a, 0x6e, 0xff, + 0xf3, 0xc8, 0x9d, 0x0f, 0x98, 0x26, 0xdf, 0x86, 0x98, 0xc1, 0x81, 0xcc, 0x31, 0x86, 0x93, 0x53, + 0xd0, 0x86, 0xbe, 0x26, 0x1b, 0x63, 0xcc, 0xaa, 0x81, 0xf7, 0xd0, 0x7b, 0xb6, 0x15, 0x3d, 0x67, + 0x8b, 0xc3, 0xb0, 0x2e, 0x17, 0xdb, 0xc3, 0xac, 0x8a, 0x1b, 0x23, 0x7d, 0x47, 0xb6, 0x0a, 0x30, + 0xc9, 0xe8, 0x18, 0x92, 0x0c, 0xd4, 0xa0, 0xd7, 0xe4, 0x3c, 0x9a, 0xc9, 0x69, 0x67, 0x62, 0xad, + 0xf7, 0x23, 0x98, 0xe4, 0x7d, 0xa3, 0x8d, 0x49, 0x71, 0x5e, 0xd3, 0xcf, 0xa4, 0x6f, 0x41, 0x89, + 0xbc, 0x3a, 0x0b, 0xba, 0xda, 0x04, 0xed, 0x5c, 0x1c, 0x74, 0x54, 0xcb, 0x45, 0x9a, 0x18, 0x81, + 0xb2, 0x0d, 0xbc, 0xe9, 0x22, 0xdc, 0x2f, 0x7f, 0x93, 0x6c, 0xd4, 0x73, 0x6e, 0xff, 0xed, 0x91, + 0xbb, 0x0b, 0x14, 0xba, 0x44, 0xa9, 0x81, 0xbe, 0x99, 0x83, 0xdf, 0x59, 0x09, 0xef, 0x6c, 0xb3, + 0xf4, 0xfb, 0x5d, 0xf4, 0x8f, 0x3b, 0x87, 0x76, 0xe6, 0x0b, 0xf0, 0xe3, 0x6e, 0xfc, 0xf0, 0x92, + 0xa4, 0x95, 0xfc, 0xca, 0xf1, 0xd3, 0x17, 0xe4, 0x9a, 0x05, 0x55, 0x7b, 0x5b, 0xd0, 0x7b, 0x33, + 0xa9, 0xf5, 0x2d, 0xb1, 0x23, 0xd7, 0x8e, 0xcf, 0x74, 0x74, 0x97, 0xdc, 0x90, 0x98, 0xc1, 0x48, + 0xc8, 0x1c, 0x5b, 0x28, 0x7f, 0x79, 0x3b, 0xe7, 0x8b, 0xb9, 0x2e, 0xdb, 0x2a, 0x3a, 0x21, 0xfd, + 0x61, 0xd3, 0x3c, 0x74, 0x37, 0x4e, 0xbf, 0x92, 0xfe, 0xdc, 0x12, 0xe9, 0x93, 0xf5, 0x4e, 0xcc, + 0x7f, 0xba, 0xe6, 0xd7, 0xd8, 0x1b, 0xfd, 0x9c, 0x06, 0xde, 0xaf, 0x69, 0xe0, 0xfd, 0x9e, 0x06, + 0xde, 0xf7, 0x3f, 0xc1, 0x95, 0x2f, 0xbb, 0x13, 0x61, 0x8e, 0x4f, 0xc7, 0x2c, 0xc5, 0x82, 0x4b, + 0x5d, 0xa6, 0x69, 0x98, 0x81, 0xe5, 0x12, 0x30, 0xd7, 0x61, 0x52, 0x8a, 0x70, 0x82, 0x7c, 0xfe, + 0x85, 0xbd, 0x72, 0xf5, 0x8f, 0xde, 0xed, 0x21, 0xe0, 0xfe, 0x21, 0x7b, 0xfb, 0xe9, 0xa0, 0xfe, + 0x5b, 0x47, 0x32, 0xde, 0x6c, 0x9e, 0xd0, 0xcb, 0xff, 0x01, 0x00, 0x00, 0xff, 0xff, 0xad, 0xd6, + 0xfb, 0x46, 0xc7, 0x03, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc2.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc2.SupportPackageIsVersion4 + +// NetmapServiceClient is the client API for NetmapService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type NetmapServiceClient interface { + // Return information about Node + LocalNodeInfo(ctx context.Context, in *LocalNodeInfoRequest, opts ...grpc2.CallOption) (*LocalNodeInfoResponse, error) +} + +type netmapServiceClient struct { + cc *grpc2.ClientConn +} + +func NewNetmapServiceClient(cc *grpc2.ClientConn) NetmapServiceClient { + return &netmapServiceClient{cc} +} + +func (c *netmapServiceClient) LocalNodeInfo(ctx context.Context, in *LocalNodeInfoRequest, opts ...grpc2.CallOption) (*LocalNodeInfoResponse, error) { + out := new(LocalNodeInfoResponse) + err := c.cc.Invoke(ctx, "/neo.fs.v2.netmap.NetmapService/LocalNodeInfo", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// NetmapServiceServer is the server API for NetmapService service. +type NetmapServiceServer interface { + // Return information about Node + LocalNodeInfo(context.Context, *LocalNodeInfoRequest) (*LocalNodeInfoResponse, error) +} + +// UnimplementedNetmapServiceServer can be embedded to have forward compatible implementations. +type UnimplementedNetmapServiceServer struct { +} + +func (*UnimplementedNetmapServiceServer) LocalNodeInfo(ctx context.Context, req *LocalNodeInfoRequest) (*LocalNodeInfoResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method LocalNodeInfo not implemented") +} + +func RegisterNetmapServiceServer(s *grpc2.Server, srv NetmapServiceServer) { + s.RegisterService(&_NetmapService_serviceDesc, srv) +} + +func _NetmapService_LocalNodeInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc2.UnaryServerInterceptor) (interface{}, error) { + in := new(LocalNodeInfoRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(NetmapServiceServer).LocalNodeInfo(ctx, in) + } + info := &grpc2.UnaryServerInfo{ + Server: srv, + FullMethod: "/neo.fs.v2.netmap.NetmapService/LocalNodeInfo", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(NetmapServiceServer).LocalNodeInfo(ctx, req.(*LocalNodeInfoRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _NetmapService_serviceDesc = grpc2.ServiceDesc{ + ServiceName: "neo.fs.v2.netmap.NetmapService", + HandlerType: (*NetmapServiceServer)(nil), + Methods: []grpc2.MethodDesc{ + { + MethodName: "LocalNodeInfo", + Handler: _NetmapService_LocalNodeInfo_Handler, + }, + }, + Streams: []grpc2.StreamDesc{}, + Metadata: "v2/netmap/grpc/service.proto", +} + +func (m *LocalNodeInfoRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *LocalNodeInfoRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *LocalNodeInfoRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.VerifyHeader != nil { + { + size, err := m.VerifyHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + if m.MetaHeader != nil { + { + size, err := m.MetaHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.Body != nil { + { + size, err := m.Body.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *LocalNodeInfoRequest_Body) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *LocalNodeInfoRequest_Body) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *LocalNodeInfoRequest_Body) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + return len(dAtA) - i, nil +} + +func (m *LocalNodeInfoResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *LocalNodeInfoResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *LocalNodeInfoResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.VerifyHeader != nil { + { + size, err := m.VerifyHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + if m.MetaHeader != nil { + { + size, err := m.MetaHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.Body != nil { + { + size, err := m.Body.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *LocalNodeInfoResponse_Body) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *LocalNodeInfoResponse_Body) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *LocalNodeInfoResponse_Body) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.NodeInfo != nil { + { + size, err := m.NodeInfo.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.Version != nil { + { + size, err := m.Version.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintService(dAtA []byte, offset int, v uint64) int { + offset -= sovService(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *LocalNodeInfoRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Body != nil { + l = m.Body.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.MetaHeader != nil { + l = m.MetaHeader.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.VerifyHeader != nil { + l = m.VerifyHeader.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *LocalNodeInfoRequest_Body) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *LocalNodeInfoResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Body != nil { + l = m.Body.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.MetaHeader != nil { + l = m.MetaHeader.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.VerifyHeader != nil { + l = m.VerifyHeader.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *LocalNodeInfoResponse_Body) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Version != nil { + l = m.Version.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.NodeInfo != nil { + l = m.NodeInfo.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovService(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozService(x uint64) (n int) { + return sovService(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *LocalNodeInfoRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: LocalNodeInfoRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: LocalNodeInfoRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Body", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Body == nil { + m.Body = &LocalNodeInfoRequest_Body{} + } + if err := m.Body.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MetaHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.MetaHeader == nil { + m.MetaHeader = &grpc.RequestMetaHeader{} + } + if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field VerifyHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.VerifyHeader == nil { + m.VerifyHeader = &grpc.RequestVerificationHeader{} + } + if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *LocalNodeInfoRequest_Body) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Body: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Body: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *LocalNodeInfoResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: LocalNodeInfoResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: LocalNodeInfoResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Body", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Body == nil { + m.Body = &LocalNodeInfoResponse_Body{} + } + if err := m.Body.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MetaHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.MetaHeader == nil { + m.MetaHeader = &grpc.ResponseMetaHeader{} + } + if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field VerifyHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.VerifyHeader == nil { + m.VerifyHeader = &grpc.ResponseVerificationHeader{} + } + if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *LocalNodeInfoResponse_Body) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Body: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Body: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Version == nil { + m.Version = &grpc1.Version{} + } + if err := m.Version.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NodeInfo", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.NodeInfo == nil { + m.NodeInfo = &NodeInfo{} + } + if err := m.NodeInfo.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipService(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowService + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowService + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowService + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthService + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupService + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthService + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthService = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowService = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupService = fmt.Errorf("proto: unexpected end of group") +) diff --git a/v2/netmap/grpc/types.go b/v2/netmap/grpc/types.go index a5e2cb3..a912cb2 100644 --- a/v2/netmap/grpc/types.go +++ b/v2/netmap/grpc/types.go @@ -1,97 +1,108 @@ package netmap -// SetOp sets operation of the simple filter. -func (m *PlacementPolicy_FilterGroup_Filter_SimpleFilter) SetOp(v PlacementPolicy_FilterGroup_Filter_SimpleFilter_Operation) { +// SetReplicas of placement policy. +func (m *PlacementPolicy) SetReplicas(v []*Replica) { if m != nil { - m.Op = v + m.Replicas = v } } -// SetValue sets value of the simple filter. -func (m *PlacementPolicy_FilterGroup_Filter_SimpleFilter) SetValue(v string) { +// SetContainerBackupFactor of placement policy. +func (m *PlacementPolicy) SetContainerBackupFactor(v uint32) { if m != nil { - m.Args = &PlacementPolicy_FilterGroup_Filter_SimpleFilter_Value{ - Value: v, - } + m.ContainerBackupFactor = v } } -// SetFArgs sets filter args of the simple filter. -func (m *PlacementPolicy_FilterGroup_Filter_SimpleFilter) SetFArgs(v *PlacementPolicy_FilterGroup_Filter_SimpleFilter_SimpleFilters) { - if m != nil { - m.Args = &PlacementPolicy_FilterGroup_Filter_SimpleFilter_FArgs{ - FArgs: v, - } - } -} - -// SetFilters sets list of the simple filters. -func (m *PlacementPolicy_FilterGroup_Filter_SimpleFilter_SimpleFilters) SetFilters(v []*PlacementPolicy_FilterGroup_Filter_SimpleFilter) { - if m != nil { - m.Filters = v - } -} - -// SeyKey sets key of the filter. -func (m *PlacementPolicy_FilterGroup_Filter) SeyKey(v string) { - if m != nil { - m.Key = v - } -} - -// SetF sets simple filter of the filter. -func (m *PlacementPolicy_FilterGroup_Filter) SetF(v *PlacementPolicy_FilterGroup_Filter_SimpleFilter) { - if m != nil { - m.F = v - } -} - -// SetCount sets count value of the selector. -func (m *PlacementPolicy_FilterGroup_Selector) SetCount(v uint32) { - if m != nil { - m.Count = v - } -} - -// SetKey sets key of the selector. -func (m *PlacementPolicy_FilterGroup_Selector) SetKey(v string) { - if m != nil { - m.Key = v - } -} - -// SetFilters sets list of the filters. -func (m *PlacementPolicy_FilterGroup) SetFilters(v []*PlacementPolicy_FilterGroup_Filter) { - if m != nil { - m.Filters = v - } -} - -// SetSelectors sets list of the selectors. -func (m *PlacementPolicy_FilterGroup) SetSelectors(v []*PlacementPolicy_FilterGroup_Selector) { +// SetSelectors of placement policy. +func (m *PlacementPolicy) SetSelectors(v []*Selector) { if m != nil { m.Selectors = v } } -// SetExclude sets exclude list. -func (m *PlacementPolicy_FilterGroup) SetExclude(v []uint32) { +// SetFilters of placement policy. +func (m *PlacementPolicy) SetFilters(v []*Filter) { if m != nil { - m.Exclude = v + m.Filters = v } } -// SetReplFactor sets replication factor of the placement rule. -func (m *PlacementPolicy) SetReplFactor(v uint32) { +// SetName of placement filter. +func (m *Filter) SetName(v string) { if m != nil { - m.ReplFactor = v + m.Name = v } } -// SetSfGroups sets list of the selector-filter groups. -func (m *PlacementPolicy) SetSfGroups(v []*PlacementPolicy_FilterGroup) { +// SetKey of placement filter. +func (m *Filter) SetKey(v string) { if m != nil { - m.FilterGroups = v + m.Key = v + } +} + +// SetOperation of placement filter. +func (m *Filter) SetOp(v Operation) { + if m != nil { + m.Op = v + + } +} + +// SetValue of placement filter. +func (m *Filter) SetValue(v string) { + if m != nil { + m.Value = v + } +} + +// SetFilters sets sub-filters of placement filter. +func (m *Filter) SetFilters(v []*Filter) { + if m != nil { + m.Filters = v + } +} + +// SetName of placement selector. +func (m *Selector) SetName(v string) { + if m != nil { + m.Name = v + } +} + +// SetCount of nodes of placement selector. +func (m *Selector) SetCount(v uint32) { + if m != nil { + m.Count = v + } +} + +// SetAttribute of nodes of placement selector. +func (m *Selector) SetAttribute(v string) { + if m != nil { + m.Attribute = v + } +} + +// SetFilter of placement selector. +func (m *Selector) SetFilter(v string) { + if m != nil { + m.Filter = v + } +} + +// SetCount of object replica. +func (m *Replica) SetCount(v uint32) { + if m != nil { + m.Count = v + } +} + +// SetSelector of object replica. +func (m *Replica) SetSelector(v string) { + if m != nil { + m.Selector = v } } @@ -109,6 +120,13 @@ func (m *NodeInfo_Attribute) SetValue(v string) { } } +// SetParent sets value of the node parents. +func (m *NodeInfo_Attribute) SetParents(v []string) { + if m != nil { + m.Parents = v + } +} + // SetAddress sets node network address. func (m *NodeInfo) SetAddress(v string) { if m != nil { diff --git a/v2/netmap/grpc/types.pb.go b/v2/netmap/grpc/types.pb.go index a21ea50..5b0376f 100644 --- a/v2/netmap/grpc/types.pb.go +++ b/v2/netmap/grpc/types.pb.go @@ -22,31 +22,31 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package -// Filtering operation -type PlacementPolicy_FilterGroup_Filter_SimpleFilter_Operation int32 +// Operations on filters +type Operation int32 const ( // No Operation defined - PlacementPolicy_FilterGroup_Filter_SimpleFilter_OPERATION_UNSPECIFIED PlacementPolicy_FilterGroup_Filter_SimpleFilter_Operation = 0 + Operation_OPERATION_UNSPECIFIED Operation = 0 // Equal - PlacementPolicy_FilterGroup_Filter_SimpleFilter_EQ PlacementPolicy_FilterGroup_Filter_SimpleFilter_Operation = 1 + Operation_EQ Operation = 1 // Not Equal - PlacementPolicy_FilterGroup_Filter_SimpleFilter_NE PlacementPolicy_FilterGroup_Filter_SimpleFilter_Operation = 2 + Operation_NE Operation = 2 // Greater then - PlacementPolicy_FilterGroup_Filter_SimpleFilter_GT PlacementPolicy_FilterGroup_Filter_SimpleFilter_Operation = 3 + Operation_GT Operation = 3 // Greater or equal - PlacementPolicy_FilterGroup_Filter_SimpleFilter_GE PlacementPolicy_FilterGroup_Filter_SimpleFilter_Operation = 4 + Operation_GE Operation = 4 // Less then - PlacementPolicy_FilterGroup_Filter_SimpleFilter_LT PlacementPolicy_FilterGroup_Filter_SimpleFilter_Operation = 5 + Operation_LT Operation = 5 // Less or equal - PlacementPolicy_FilterGroup_Filter_SimpleFilter_LE PlacementPolicy_FilterGroup_Filter_SimpleFilter_Operation = 6 + Operation_LE Operation = 6 // Logical OR - PlacementPolicy_FilterGroup_Filter_SimpleFilter_OR PlacementPolicy_FilterGroup_Filter_SimpleFilter_Operation = 7 + Operation_OR Operation = 7 // Logical AND - PlacementPolicy_FilterGroup_Filter_SimpleFilter_AND PlacementPolicy_FilterGroup_Filter_SimpleFilter_Operation = 8 + Operation_AND Operation = 8 ) -var PlacementPolicy_FilterGroup_Filter_SimpleFilter_Operation_name = map[int32]string{ +var Operation_name = map[int32]string{ 0: "OPERATION_UNSPECIFIED", 1: "EQ", 2: "NE", @@ -58,7 +58,7 @@ var PlacementPolicy_FilterGroup_Filter_SimpleFilter_Operation_name = map[int32]s 8: "AND", } -var PlacementPolicy_FilterGroup_Filter_SimpleFilter_Operation_value = map[string]int32{ +var Operation_value = map[string]int32{ "OPERATION_UNSPECIFIED": 0, "EQ": 1, "NE": 2, @@ -70,12 +70,12 @@ var PlacementPolicy_FilterGroup_Filter_SimpleFilter_Operation_value = map[string "AND": 8, } -func (x PlacementPolicy_FilterGroup_Filter_SimpleFilter_Operation) String() string { - return proto.EnumName(PlacementPolicy_FilterGroup_Filter_SimpleFilter_Operation_name, int32(x)) +func (x Operation) String() string { + return proto.EnumName(Operation_name, int32(x)) } -func (PlacementPolicy_FilterGroup_Filter_SimpleFilter_Operation) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_91a1332b2376641a, []int{0, 0, 0, 0, 0} +func (Operation) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_91a1332b2376641a, []int{0} } // Represents the enumeration of various states of the NeoFS node. @@ -107,25 +107,252 @@ func (x NodeInfo_State) String() string { } func (NodeInfo_State) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_91a1332b2376641a, []int{1, 0} + return fileDescriptor_91a1332b2376641a, []int{4, 0} +} + +// Filter +type Filter struct { + // Name of the filter or a reference to the named filter. + // '*' means application to the whole unfiltered NetworkMap + // At top level it's used as a filter name. At lower levels it's considered to + // be a reference to another named filter + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // Key to filter + Key string `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` + // Filtering operation + Op Operation `protobuf:"varint,3,opt,name=op,proto3,enum=neo.fs.v2.netmap.Operation" json:"op,omitempty"` + // Value to match + Value string `protobuf:"bytes,4,opt,name=value,proto3" json:"value,omitempty"` + // List of inner filters. Top level operation will be applied to the whole list. + Filters []*Filter `protobuf:"bytes,5,rep,name=filters,proto3" json:"filters,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Filter) Reset() { *m = Filter{} } +func (m *Filter) String() string { return proto.CompactTextString(m) } +func (*Filter) ProtoMessage() {} +func (*Filter) Descriptor() ([]byte, []int) { + return fileDescriptor_91a1332b2376641a, []int{0} +} +func (m *Filter) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Filter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Filter.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Filter) XXX_Merge(src proto.Message) { + xxx_messageInfo_Filter.Merge(m, src) +} +func (m *Filter) XXX_Size() int { + return m.Size() +} +func (m *Filter) XXX_DiscardUnknown() { + xxx_messageInfo_Filter.DiscardUnknown(m) +} + +var xxx_messageInfo_Filter proto.InternalMessageInfo + +func (m *Filter) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *Filter) GetKey() string { + if m != nil { + return m.Key + } + return "" +} + +func (m *Filter) GetOp() Operation { + if m != nil { + return m.Op + } + return Operation_OPERATION_UNSPECIFIED +} + +func (m *Filter) GetValue() string { + if m != nil { + return m.Value + } + return "" +} + +func (m *Filter) GetFilters() []*Filter { + if m != nil { + return m.Filters + } + return nil +} + +// Selector +type Selector struct { + // Selector name to reference in object placement section + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // How many nodes to select from bucket + Count uint32 `protobuf:"varint,2,opt,name=count,proto3" json:"count,omitempty"` + // Attribute bucket to select from + Attribute string `protobuf:"bytes,3,opt,name=attribute,proto3" json:"attribute,omitempty"` + // Filter reference to select from + Filter string `protobuf:"bytes,4,opt,name=filter,proto3" json:"filter,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Selector) Reset() { *m = Selector{} } +func (m *Selector) String() string { return proto.CompactTextString(m) } +func (*Selector) ProtoMessage() {} +func (*Selector) Descriptor() ([]byte, []int) { + return fileDescriptor_91a1332b2376641a, []int{1} +} +func (m *Selector) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Selector) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Selector.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Selector) XXX_Merge(src proto.Message) { + xxx_messageInfo_Selector.Merge(m, src) +} +func (m *Selector) XXX_Size() int { + return m.Size() +} +func (m *Selector) XXX_DiscardUnknown() { + xxx_messageInfo_Selector.DiscardUnknown(m) +} + +var xxx_messageInfo_Selector proto.InternalMessageInfo + +func (m *Selector) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *Selector) GetCount() uint32 { + if m != nil { + return m.Count + } + return 0 +} + +func (m *Selector) GetAttribute() string { + if m != nil { + return m.Attribute + } + return "" +} + +func (m *Selector) GetFilter() string { + if m != nil { + return m.Filter + } + return "" +} + +// Exact bucket for each replica +type Replica struct { + // How many object replicas to put + Count uint32 `protobuf:"varint,1,opt,name=count,proto3" json:"count,omitempty"` + // Named selector bucket to put in + Selector string `protobuf:"bytes,2,opt,name=selector,proto3" json:"selector,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Replica) Reset() { *m = Replica{} } +func (m *Replica) String() string { return proto.CompactTextString(m) } +func (*Replica) ProtoMessage() {} +func (*Replica) Descriptor() ([]byte, []int) { + return fileDescriptor_91a1332b2376641a, []int{2} +} +func (m *Replica) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Replica) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Replica.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Replica) XXX_Merge(src proto.Message) { + xxx_messageInfo_Replica.Merge(m, src) +} +func (m *Replica) XXX_Size() int { + return m.Size() +} +func (m *Replica) XXX_DiscardUnknown() { + xxx_messageInfo_Replica.DiscardUnknown(m) +} + +var xxx_messageInfo_Replica proto.InternalMessageInfo + +func (m *Replica) GetCount() uint32 { + if m != nil { + return m.Count + } + return 0 +} + +func (m *Replica) GetSelector() string { + if m != nil { + return m.Selector + } + return "" } // Set of rules to select a subset of nodes able to store container's objects type PlacementPolicy struct { - // Replication factor - ReplFactor uint32 `protobuf:"varint,1,opt,name=repl_factor,json=replFactor,proto3" json:"repl_factor,omitempty"` - // List of filter groups - FilterGroups []*PlacementPolicy_FilterGroup `protobuf:"bytes,2,rep,name=filter_groups,json=filterGroups,proto3" json:"filter_groups,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + // Rules to set number of object replicas and place each one into a particular bucket + Replicas []*Replica `protobuf:"bytes,1,rep,name=replicas,proto3" json:"replicas,omitempty"` + // Container backup factor controls how deep NeoFS will search for nodes + // alternatives to include into container. + ContainerBackupFactor uint32 `protobuf:"varint,2,opt,name=container_backup_factor,json=containerBackupFactor,proto3" json:"container_backup_factor,omitempty"` + // Set of Selectors to form the container's nodes subset + Selectors []*Selector `protobuf:"bytes,3,rep,name=selectors,proto3" json:"selectors,omitempty"` + // List of named filters to reference in selectors + Filters []*Filter `protobuf:"bytes,4,rep,name=filters,proto3" json:"filters,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *PlacementPolicy) Reset() { *m = PlacementPolicy{} } func (m *PlacementPolicy) String() string { return proto.CompactTextString(m) } func (*PlacementPolicy) ProtoMessage() {} func (*PlacementPolicy) Descriptor() ([]byte, []int) { - return fileDescriptor_91a1332b2376641a, []int{0} + return fileDescriptor_91a1332b2376641a, []int{3} } func (m *PlacementPolicy) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -154,362 +381,34 @@ func (m *PlacementPolicy) XXX_DiscardUnknown() { var xxx_messageInfo_PlacementPolicy proto.InternalMessageInfo -func (m *PlacementPolicy) GetReplFactor() uint32 { +func (m *PlacementPolicy) GetReplicas() []*Replica { if m != nil { - return m.ReplFactor + return m.Replicas + } + return nil +} + +func (m *PlacementPolicy) GetContainerBackupFactor() uint32 { + if m != nil { + return m.ContainerBackupFactor } return 0 } -func (m *PlacementPolicy) GetFilterGroups() []*PlacementPolicy_FilterGroup { - if m != nil { - return m.FilterGroups - } - return nil -} - -// Filters to apply to Network Map -type PlacementPolicy_FilterGroup struct { - // Resulting filter list - Filters []*PlacementPolicy_FilterGroup_Filter `protobuf:"bytes,1,rep,name=filters,proto3" json:"filters,omitempty"` - // List of selectors - Selectors []*PlacementPolicy_FilterGroup_Selector `protobuf:"bytes,2,rep,name=selectors,proto3" json:"selectors,omitempty"` - // Parts of graph to exclude. Internal use. - Exclude []uint32 `protobuf:"varint,3,rep,packed,name=exclude,proto3" json:"exclude,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *PlacementPolicy_FilterGroup) Reset() { *m = PlacementPolicy_FilterGroup{} } -func (m *PlacementPolicy_FilterGroup) String() string { return proto.CompactTextString(m) } -func (*PlacementPolicy_FilterGroup) ProtoMessage() {} -func (*PlacementPolicy_FilterGroup) Descriptor() ([]byte, []int) { - return fileDescriptor_91a1332b2376641a, []int{0, 0} -} -func (m *PlacementPolicy_FilterGroup) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *PlacementPolicy_FilterGroup) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_PlacementPolicy_FilterGroup.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *PlacementPolicy_FilterGroup) XXX_Merge(src proto.Message) { - xxx_messageInfo_PlacementPolicy_FilterGroup.Merge(m, src) -} -func (m *PlacementPolicy_FilterGroup) XXX_Size() int { - return m.Size() -} -func (m *PlacementPolicy_FilterGroup) XXX_DiscardUnknown() { - xxx_messageInfo_PlacementPolicy_FilterGroup.DiscardUnknown(m) -} - -var xxx_messageInfo_PlacementPolicy_FilterGroup proto.InternalMessageInfo - -func (m *PlacementPolicy_FilterGroup) GetFilters() []*PlacementPolicy_FilterGroup_Filter { - if m != nil { - return m.Filters - } - return nil -} - -func (m *PlacementPolicy_FilterGroup) GetSelectors() []*PlacementPolicy_FilterGroup_Selector { +func (m *PlacementPolicy) GetSelectors() []*Selector { if m != nil { return m.Selectors } return nil } -func (m *PlacementPolicy_FilterGroup) GetExclude() []uint32 { - if m != nil { - return m.Exclude - } - return nil -} - -// Filter definition -type PlacementPolicy_FilterGroup_Filter struct { - // Filter identifier - Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - // The rest of filter - F *PlacementPolicy_FilterGroup_Filter_SimpleFilter `protobuf:"bytes,2,opt,name=f,proto3" json:"f,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *PlacementPolicy_FilterGroup_Filter) Reset() { *m = PlacementPolicy_FilterGroup_Filter{} } -func (m *PlacementPolicy_FilterGroup_Filter) String() string { return proto.CompactTextString(m) } -func (*PlacementPolicy_FilterGroup_Filter) ProtoMessage() {} -func (*PlacementPolicy_FilterGroup_Filter) Descriptor() ([]byte, []int) { - return fileDescriptor_91a1332b2376641a, []int{0, 0, 0} -} -func (m *PlacementPolicy_FilterGroup_Filter) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *PlacementPolicy_FilterGroup_Filter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_PlacementPolicy_FilterGroup_Filter.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *PlacementPolicy_FilterGroup_Filter) XXX_Merge(src proto.Message) { - xxx_messageInfo_PlacementPolicy_FilterGroup_Filter.Merge(m, src) -} -func (m *PlacementPolicy_FilterGroup_Filter) XXX_Size() int { - return m.Size() -} -func (m *PlacementPolicy_FilterGroup_Filter) XXX_DiscardUnknown() { - xxx_messageInfo_PlacementPolicy_FilterGroup_Filter.DiscardUnknown(m) -} - -var xxx_messageInfo_PlacementPolicy_FilterGroup_Filter proto.InternalMessageInfo - -func (m *PlacementPolicy_FilterGroup_Filter) GetKey() string { - if m != nil { - return m.Key - } - return "" -} - -func (m *PlacementPolicy_FilterGroup_Filter) GetF() *PlacementPolicy_FilterGroup_Filter_SimpleFilter { - if m != nil { - return m.F - } - return nil -} - -// Minimal simple filter -type PlacementPolicy_FilterGroup_Filter_SimpleFilter struct { - // Filtering operation - Op PlacementPolicy_FilterGroup_Filter_SimpleFilter_Operation `protobuf:"varint,1,opt,name=op,proto3,enum=neo.fs.v2.netmap.PlacementPolicy_FilterGroup_Filter_SimpleFilter_Operation" json:"op,omitempty"` - // Filtering operation argument - // - // Types that are valid to be assigned to Args: - // *PlacementPolicy_FilterGroup_Filter_SimpleFilter_Value - // *PlacementPolicy_FilterGroup_Filter_SimpleFilter_FArgs - Args isPlacementPolicy_FilterGroup_Filter_SimpleFilter_Args `protobuf_oneof:"args"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *PlacementPolicy_FilterGroup_Filter_SimpleFilter) Reset() { - *m = PlacementPolicy_FilterGroup_Filter_SimpleFilter{} -} -func (m *PlacementPolicy_FilterGroup_Filter_SimpleFilter) String() string { - return proto.CompactTextString(m) -} -func (*PlacementPolicy_FilterGroup_Filter_SimpleFilter) ProtoMessage() {} -func (*PlacementPolicy_FilterGroup_Filter_SimpleFilter) Descriptor() ([]byte, []int) { - return fileDescriptor_91a1332b2376641a, []int{0, 0, 0, 0} -} -func (m *PlacementPolicy_FilterGroup_Filter_SimpleFilter) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *PlacementPolicy_FilterGroup_Filter_SimpleFilter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_PlacementPolicy_FilterGroup_Filter_SimpleFilter.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *PlacementPolicy_FilterGroup_Filter_SimpleFilter) XXX_Merge(src proto.Message) { - xxx_messageInfo_PlacementPolicy_FilterGroup_Filter_SimpleFilter.Merge(m, src) -} -func (m *PlacementPolicy_FilterGroup_Filter_SimpleFilter) XXX_Size() int { - return m.Size() -} -func (m *PlacementPolicy_FilterGroup_Filter_SimpleFilter) XXX_DiscardUnknown() { - xxx_messageInfo_PlacementPolicy_FilterGroup_Filter_SimpleFilter.DiscardUnknown(m) -} - -var xxx_messageInfo_PlacementPolicy_FilterGroup_Filter_SimpleFilter proto.InternalMessageInfo - -type isPlacementPolicy_FilterGroup_Filter_SimpleFilter_Args interface { - isPlacementPolicy_FilterGroup_Filter_SimpleFilter_Args() - MarshalTo([]byte) (int, error) - Size() int -} - -type PlacementPolicy_FilterGroup_Filter_SimpleFilter_Value struct { - Value string `protobuf:"bytes,2,opt,name=value,proto3,oneof" json:"value,omitempty"` -} -type PlacementPolicy_FilterGroup_Filter_SimpleFilter_FArgs struct { - FArgs *PlacementPolicy_FilterGroup_Filter_SimpleFilter_SimpleFilters `protobuf:"bytes,3,opt,name=f_args,json=fArgs,proto3,oneof" json:"f_args,omitempty"` -} - -func (*PlacementPolicy_FilterGroup_Filter_SimpleFilter_Value) isPlacementPolicy_FilterGroup_Filter_SimpleFilter_Args() { -} -func (*PlacementPolicy_FilterGroup_Filter_SimpleFilter_FArgs) isPlacementPolicy_FilterGroup_Filter_SimpleFilter_Args() { -} - -func (m *PlacementPolicy_FilterGroup_Filter_SimpleFilter) GetArgs() isPlacementPolicy_FilterGroup_Filter_SimpleFilter_Args { - if m != nil { - return m.Args - } - return nil -} - -func (m *PlacementPolicy_FilterGroup_Filter_SimpleFilter) GetOp() PlacementPolicy_FilterGroup_Filter_SimpleFilter_Operation { - if m != nil { - return m.Op - } - return PlacementPolicy_FilterGroup_Filter_SimpleFilter_OPERATION_UNSPECIFIED -} - -func (m *PlacementPolicy_FilterGroup_Filter_SimpleFilter) GetValue() string { - if x, ok := m.GetArgs().(*PlacementPolicy_FilterGroup_Filter_SimpleFilter_Value); ok { - return x.Value - } - return "" -} - -func (m *PlacementPolicy_FilterGroup_Filter_SimpleFilter) GetFArgs() *PlacementPolicy_FilterGroup_Filter_SimpleFilter_SimpleFilters { - if x, ok := m.GetArgs().(*PlacementPolicy_FilterGroup_Filter_SimpleFilter_FArgs); ok { - return x.FArgs - } - return nil -} - -// XXX_OneofWrappers is for the internal use of the proto package. -func (*PlacementPolicy_FilterGroup_Filter_SimpleFilter) XXX_OneofWrappers() []interface{} { - return []interface{}{ - (*PlacementPolicy_FilterGroup_Filter_SimpleFilter_Value)(nil), - (*PlacementPolicy_FilterGroup_Filter_SimpleFilter_FArgs)(nil), - } -} - -// List of filters -type PlacementPolicy_FilterGroup_Filter_SimpleFilter_SimpleFilters struct { - // List of filters - Filters []*PlacementPolicy_FilterGroup_Filter_SimpleFilter `protobuf:"bytes,1,rep,name=filters,proto3" json:"filters,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *PlacementPolicy_FilterGroup_Filter_SimpleFilter_SimpleFilters) Reset() { - *m = PlacementPolicy_FilterGroup_Filter_SimpleFilter_SimpleFilters{} -} -func (m *PlacementPolicy_FilterGroup_Filter_SimpleFilter_SimpleFilters) String() string { - return proto.CompactTextString(m) -} -func (*PlacementPolicy_FilterGroup_Filter_SimpleFilter_SimpleFilters) ProtoMessage() {} -func (*PlacementPolicy_FilterGroup_Filter_SimpleFilter_SimpleFilters) Descriptor() ([]byte, []int) { - return fileDescriptor_91a1332b2376641a, []int{0, 0, 0, 0, 0} -} -func (m *PlacementPolicy_FilterGroup_Filter_SimpleFilter_SimpleFilters) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *PlacementPolicy_FilterGroup_Filter_SimpleFilter_SimpleFilters) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_PlacementPolicy_FilterGroup_Filter_SimpleFilter_SimpleFilters.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *PlacementPolicy_FilterGroup_Filter_SimpleFilter_SimpleFilters) XXX_Merge(src proto.Message) { - xxx_messageInfo_PlacementPolicy_FilterGroup_Filter_SimpleFilter_SimpleFilters.Merge(m, src) -} -func (m *PlacementPolicy_FilterGroup_Filter_SimpleFilter_SimpleFilters) XXX_Size() int { - return m.Size() -} -func (m *PlacementPolicy_FilterGroup_Filter_SimpleFilter_SimpleFilters) XXX_DiscardUnknown() { - xxx_messageInfo_PlacementPolicy_FilterGroup_Filter_SimpleFilter_SimpleFilters.DiscardUnknown(m) -} - -var xxx_messageInfo_PlacementPolicy_FilterGroup_Filter_SimpleFilter_SimpleFilters proto.InternalMessageInfo - -func (m *PlacementPolicy_FilterGroup_Filter_SimpleFilter_SimpleFilters) GetFilters() []*PlacementPolicy_FilterGroup_Filter_SimpleFilter { +func (m *PlacementPolicy) GetFilters() []*Filter { if m != nil { return m.Filters } return nil } -// Selector -type PlacementPolicy_FilterGroup_Selector struct { - // How many to select - Count uint32 `protobuf:"varint,1,opt,name=count,proto3" json:"count,omitempty"` - // Key to select - Key string `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *PlacementPolicy_FilterGroup_Selector) Reset() { *m = PlacementPolicy_FilterGroup_Selector{} } -func (m *PlacementPolicy_FilterGroup_Selector) String() string { return proto.CompactTextString(m) } -func (*PlacementPolicy_FilterGroup_Selector) ProtoMessage() {} -func (*PlacementPolicy_FilterGroup_Selector) Descriptor() ([]byte, []int) { - return fileDescriptor_91a1332b2376641a, []int{0, 0, 1} -} -func (m *PlacementPolicy_FilterGroup_Selector) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *PlacementPolicy_FilterGroup_Selector) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_PlacementPolicy_FilterGroup_Selector.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *PlacementPolicy_FilterGroup_Selector) XXX_Merge(src proto.Message) { - xxx_messageInfo_PlacementPolicy_FilterGroup_Selector.Merge(m, src) -} -func (m *PlacementPolicy_FilterGroup_Selector) XXX_Size() int { - return m.Size() -} -func (m *PlacementPolicy_FilterGroup_Selector) XXX_DiscardUnknown() { - xxx_messageInfo_PlacementPolicy_FilterGroup_Selector.DiscardUnknown(m) -} - -var xxx_messageInfo_PlacementPolicy_FilterGroup_Selector proto.InternalMessageInfo - -func (m *PlacementPolicy_FilterGroup_Selector) GetCount() uint32 { - if m != nil { - return m.Count - } - return 0 -} - -func (m *PlacementPolicy_FilterGroup_Selector) GetKey() string { - if m != nil { - return m.Key - } - return "" -} - // NeoFS node description type NodeInfo struct { // Public key of the NeoFS node in a binary format. @@ -529,7 +428,7 @@ func (m *NodeInfo) Reset() { *m = NodeInfo{} } func (m *NodeInfo) String() string { return proto.CompactTextString(m) } func (*NodeInfo) ProtoMessage() {} func (*NodeInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_91a1332b2376641a, []int{1} + return fileDescriptor_91a1332b2376641a, []int{4} } func (m *NodeInfo) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -591,7 +490,10 @@ type NodeInfo_Attribute struct { // Key of the node attribute. Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` // Value of the node attribute. - Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` + Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` + // Parent keys, if any + // Example: For City it can be Region or Country + Parents []string `protobuf:"bytes,3,rep,name=parents,proto3" json:"parents,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -601,7 +503,7 @@ func (m *NodeInfo_Attribute) Reset() { *m = NodeInfo_Attribute{} } func (m *NodeInfo_Attribute) String() string { return proto.CompactTextString(m) } func (*NodeInfo_Attribute) ProtoMessage() {} func (*NodeInfo_Attribute) Descriptor() ([]byte, []int) { - return fileDescriptor_91a1332b2376641a, []int{1, 0} + return fileDescriptor_91a1332b2376641a, []int{4, 0} } func (m *NodeInfo_Attribute) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -644,15 +546,20 @@ func (m *NodeInfo_Attribute) GetValue() string { return "" } +func (m *NodeInfo_Attribute) GetParents() []string { + if m != nil { + return m.Parents + } + return nil +} + func init() { - proto.RegisterEnum("neo.fs.v2.netmap.PlacementPolicy_FilterGroup_Filter_SimpleFilter_Operation", PlacementPolicy_FilterGroup_Filter_SimpleFilter_Operation_name, PlacementPolicy_FilterGroup_Filter_SimpleFilter_Operation_value) + proto.RegisterEnum("neo.fs.v2.netmap.Operation", Operation_name, Operation_value) proto.RegisterEnum("neo.fs.v2.netmap.NodeInfo_State", NodeInfo_State_name, NodeInfo_State_value) + proto.RegisterType((*Filter)(nil), "neo.fs.v2.netmap.Filter") + proto.RegisterType((*Selector)(nil), "neo.fs.v2.netmap.Selector") + proto.RegisterType((*Replica)(nil), "neo.fs.v2.netmap.Replica") proto.RegisterType((*PlacementPolicy)(nil), "neo.fs.v2.netmap.PlacementPolicy") - proto.RegisterType((*PlacementPolicy_FilterGroup)(nil), "neo.fs.v2.netmap.PlacementPolicy.FilterGroup") - proto.RegisterType((*PlacementPolicy_FilterGroup_Filter)(nil), "neo.fs.v2.netmap.PlacementPolicy.FilterGroup.Filter") - proto.RegisterType((*PlacementPolicy_FilterGroup_Filter_SimpleFilter)(nil), "neo.fs.v2.netmap.PlacementPolicy.FilterGroup.Filter.SimpleFilter") - proto.RegisterType((*PlacementPolicy_FilterGroup_Filter_SimpleFilter_SimpleFilters)(nil), "neo.fs.v2.netmap.PlacementPolicy.FilterGroup.Filter.SimpleFilter.SimpleFilters") - proto.RegisterType((*PlacementPolicy_FilterGroup_Selector)(nil), "neo.fs.v2.netmap.PlacementPolicy.FilterGroup.Selector") proto.RegisterType((*NodeInfo)(nil), "neo.fs.v2.netmap.NodeInfo") proto.RegisterType((*NodeInfo_Attribute)(nil), "neo.fs.v2.netmap.NodeInfo.Attribute") } @@ -660,49 +567,206 @@ func init() { func init() { proto.RegisterFile("v2/netmap/grpc/types.proto", fileDescriptor_91a1332b2376641a) } var fileDescriptor_91a1332b2376641a = []byte{ - // 663 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x54, 0xcd, 0x6e, 0xd3, 0x40, - 0x10, 0xae, 0xed, 0xc4, 0x69, 0x26, 0x0d, 0xb5, 0x96, 0x82, 0x4c, 0x24, 0x42, 0x14, 0x71, 0xc8, - 0x25, 0x8e, 0x48, 0x51, 0x39, 0x70, 0x4a, 0xa9, 0x53, 0xa2, 0x56, 0x76, 0xd8, 0x84, 0x0b, 0x3d, - 0x44, 0x8e, 0xb3, 0x4e, 0x2d, 0x1c, 0xaf, 0xe5, 0xdd, 0x44, 0xe4, 0x4d, 0x78, 0x05, 0x78, 0x04, - 0x0e, 0x5c, 0xe1, 0xc0, 0x81, 0x47, 0x40, 0xe5, 0x45, 0x90, 0xd7, 0x71, 0x9b, 0x14, 0x84, 0x54, - 0xca, 0x69, 0xf6, 0x9b, 0x9f, 0x6f, 0x3c, 0xe3, 0x6f, 0x17, 0x2a, 0x8b, 0x76, 0x2b, 0x24, 0x7c, - 0xe6, 0x44, 0xad, 0x69, 0x1c, 0xb9, 0x2d, 0xbe, 0x8c, 0x08, 0x33, 0xa2, 0x98, 0x72, 0x8a, 0xb4, - 0x90, 0x50, 0xc3, 0x63, 0xc6, 0xa2, 0x6d, 0xa4, 0x29, 0xf5, 0x2f, 0x05, 0xd8, 0xed, 0x07, 0x8e, - 0x4b, 0x66, 0x24, 0xe4, 0x7d, 0x1a, 0xf8, 0xee, 0x12, 0x3d, 0x82, 0x52, 0x4c, 0xa2, 0x60, 0xe4, - 0x39, 0x2e, 0xa7, 0xb1, 0x2e, 0xd5, 0xa4, 0x46, 0x19, 0x43, 0xe2, 0xea, 0x0a, 0x0f, 0xc2, 0x50, - 0xf6, 0xfc, 0x80, 0x93, 0x78, 0x34, 0x8d, 0xe9, 0x3c, 0x62, 0xba, 0x5c, 0x53, 0x1a, 0xa5, 0x76, - 0xd3, 0xb8, 0x4e, 0x6f, 0x5c, 0xa3, 0x36, 0xba, 0xa2, 0xec, 0x38, 0xa9, 0xc2, 0x3b, 0xde, 0x15, - 0x60, 0x95, 0xcf, 0x2a, 0x94, 0xd6, 0xa2, 0xc8, 0x82, 0x42, 0x1a, 0x67, 0xba, 0x24, 0xd8, 0x9f, - 0xde, 0x88, 0x7d, 0x75, 0xc6, 0x19, 0x09, 0x1a, 0x42, 0x91, 0x91, 0x80, 0x24, 0xdf, 0x9f, 0x7d, - 0xef, 0xc1, 0xcd, 0x18, 0x07, 0xab, 0x72, 0x7c, 0x45, 0x84, 0x74, 0x28, 0x90, 0x77, 0x6e, 0x30, - 0x9f, 0x10, 0x5d, 0xa9, 0x29, 0x8d, 0x32, 0xce, 0x60, 0xe5, 0x53, 0x0e, 0xd4, 0xb4, 0x1a, 0x69, - 0xa0, 0xbc, 0x25, 0x4b, 0xb1, 0xc7, 0x22, 0x4e, 0x8e, 0xc8, 0x06, 0xc9, 0xd3, 0xe5, 0x9a, 0xd4, - 0x28, 0xb5, 0x3b, 0xff, 0x32, 0x96, 0x31, 0xf0, 0x67, 0x51, 0x40, 0x56, 0x33, 0x4a, 0x5e, 0xe5, - 0x9b, 0x02, 0x3b, 0xeb, 0x3e, 0x74, 0x06, 0x32, 0x8d, 0x44, 0xcb, 0x3b, 0xed, 0x93, 0x5b, 0xb7, - 0x30, 0xec, 0x88, 0xc4, 0x0e, 0xf7, 0x69, 0x88, 0x65, 0x1a, 0xa1, 0xfb, 0x90, 0x5f, 0x38, 0xc1, - 0x9c, 0x88, 0x11, 0x8a, 0x2f, 0xb7, 0x70, 0x0a, 0xd1, 0x39, 0xa8, 0xde, 0xc8, 0x89, 0xa7, 0x4c, - 0x57, 0xc4, 0x6c, 0xf6, 0xed, 0x1b, 0xaf, 0x03, 0x96, 0x74, 0xf2, 0x3a, 0xf1, 0x94, 0x55, 0x02, - 0x28, 0x6f, 0x44, 0xd0, 0xd9, 0x75, 0xb9, 0xfc, 0x87, 0xbd, 0x66, 0x8c, 0xf5, 0x29, 0x14, 0x2f, - 0x17, 0x80, 0x1e, 0xc0, 0x3d, 0xbb, 0x6f, 0xe2, 0xce, 0xb0, 0x67, 0x5b, 0xa3, 0xd7, 0xd6, 0xa0, - 0x6f, 0xbe, 0xe8, 0x75, 0x7b, 0xe6, 0x91, 0xb6, 0x85, 0x54, 0x90, 0xcd, 0x57, 0x9a, 0x94, 0x58, - 0xcb, 0xd4, 0xe4, 0xc4, 0x1e, 0x0f, 0x35, 0x45, 0x58, 0x53, 0xcb, 0x25, 0xf6, 0x74, 0xa8, 0xe5, - 0x85, 0x35, 0x35, 0x35, 0xb1, 0x36, 0xd6, 0x0a, 0xa8, 0x00, 0x4a, 0xc7, 0x3a, 0xd2, 0xb6, 0x0f, - 0x55, 0xc8, 0x25, 0xeb, 0xab, 0xb4, 0x61, 0x3b, 0x53, 0x1b, 0xda, 0x83, 0xbc, 0x4b, 0xe7, 0x21, - 0x5f, 0xdd, 0xc3, 0x14, 0x64, 0x9a, 0x92, 0x2f, 0x35, 0x55, 0xff, 0x20, 0xc3, 0xb6, 0x45, 0x27, - 0xa4, 0x17, 0x7a, 0x14, 0x3d, 0x04, 0x88, 0xe6, 0xe3, 0xc0, 0x77, 0x47, 0x99, 0xf2, 0x76, 0x70, - 0x31, 0xf5, 0x9c, 0x90, 0x65, 0x22, 0x5b, 0x67, 0x32, 0x89, 0x09, 0x63, 0x2b, 0x86, 0x0c, 0xa2, - 0x23, 0x00, 0x87, 0xf3, 0xd8, 0x1f, 0xcf, 0x39, 0x61, 0x42, 0xd3, 0xa5, 0xf6, 0xe3, 0xdf, 0x57, - 0x99, 0x35, 0x32, 0x3a, 0x59, 0x32, 0x5e, 0xab, 0x43, 0x07, 0x90, 0x67, 0xdc, 0xe1, 0x44, 0xcf, - 0x09, 0x01, 0xd6, 0xfe, 0x42, 0x30, 0x48, 0xf2, 0x70, 0x9a, 0x5e, 0xd9, 0x87, 0xe2, 0x25, 0xe1, - 0x1f, 0xae, 0xcd, 0xde, 0x86, 0xee, 0x56, 0xaa, 0xab, 0x3f, 0x81, 0xbc, 0x20, 0x41, 0xbb, 0x50, - 0xda, 0xfc, 0x1f, 0x00, 0xaa, 0x6d, 0x9d, 0xf6, 0x2c, 0x53, 0x93, 0x50, 0x09, 0x0a, 0x76, 0xb7, - 0x2b, 0x80, 0x7c, 0x38, 0xfa, 0x7a, 0x51, 0x95, 0xbe, 0x5f, 0x54, 0xa5, 0x1f, 0x17, 0x55, 0xe9, - 0xfd, 0xcf, 0xea, 0xd6, 0x9b, 0x67, 0x53, 0x9f, 0x9f, 0xcf, 0xc7, 0x86, 0x4b, 0x67, 0xad, 0x90, - 0x45, 0xae, 0xdb, 0x9c, 0x90, 0x45, 0x2b, 0x24, 0xd4, 0x63, 0x4d, 0x27, 0xf2, 0x9b, 0x53, 0xda, - 0xda, 0x7c, 0x57, 0x9f, 0xa7, 0xe7, 0x8f, 0xf2, 0x5d, 0x8b, 0xd0, 0xee, 0xc0, 0xe8, 0xf4, 0x7b, - 0xc9, 0x78, 0x96, 0xf0, 0x8e, 0x55, 0xf1, 0xde, 0xee, 0xff, 0x0a, 0x00, 0x00, 0xff, 0xff, 0x1a, - 0xeb, 0x5f, 0x7e, 0x8d, 0x05, 0x00, 0x00, + // 635 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x54, 0xcd, 0x6e, 0xd3, 0x40, + 0x10, 0xee, 0x3a, 0xbf, 0x9e, 0xd2, 0xd6, 0x5a, 0x5a, 0x70, 0x03, 0x44, 0x51, 0xc4, 0xa1, 0x02, + 0xd5, 0x11, 0x41, 0x14, 0xa4, 0x9e, 0x52, 0xea, 0xa0, 0x88, 0xe2, 0x84, 0x4d, 0xb9, 0x70, 0x89, + 0x36, 0xce, 0x26, 0x98, 0x3a, 0xde, 0x95, 0xbd, 0x89, 0x94, 0x37, 0xe1, 0x05, 0xb8, 0xf0, 0x1a, + 0x5c, 0x38, 0xf2, 0x08, 0xa8, 0xdc, 0x79, 0x06, 0xe4, 0x75, 0xec, 0xa4, 0x04, 0x21, 0x4e, 0xb3, + 0x33, 0xfb, 0xf9, 0xfb, 0xbe, 0x9d, 0x1d, 0x2f, 0x54, 0xe6, 0xcd, 0x46, 0xc0, 0xe4, 0x94, 0x8a, + 0xc6, 0x24, 0x14, 0x6e, 0x43, 0x2e, 0x04, 0x8b, 0x2c, 0x11, 0x72, 0xc9, 0xb1, 0x11, 0x30, 0x6e, + 0x8d, 0x23, 0x6b, 0xde, 0xb4, 0x12, 0x48, 0xfd, 0x33, 0x82, 0x62, 0xdb, 0xf3, 0x25, 0x0b, 0x31, + 0x86, 0x7c, 0x40, 0xa7, 0xcc, 0x44, 0x35, 0x74, 0xa4, 0x13, 0xb5, 0xc6, 0x06, 0xe4, 0xae, 0xd8, + 0xc2, 0xd4, 0x54, 0x29, 0x5e, 0xe2, 0xc7, 0xa0, 0x71, 0x61, 0xe6, 0x6a, 0xe8, 0x68, 0xb7, 0x79, + 0xcf, 0xfa, 0x93, 0xcf, 0xea, 0x0a, 0x16, 0x52, 0xe9, 0xf1, 0x80, 0x68, 0x5c, 0xe0, 0x7d, 0x28, + 0xcc, 0xa9, 0x3f, 0x63, 0x66, 0x5e, 0x11, 0x24, 0x09, 0x6e, 0x42, 0x69, 0xac, 0x24, 0x23, 0xb3, + 0x50, 0xcb, 0x1d, 0x6d, 0x37, 0xcd, 0x4d, 0x9e, 0xc4, 0x13, 0x49, 0x81, 0xf5, 0x8f, 0x50, 0xee, + 0x33, 0x9f, 0xb9, 0x92, 0xff, 0xdd, 0xe8, 0x3e, 0x14, 0x5c, 0x3e, 0x0b, 0xa4, 0xb2, 0xba, 0x43, + 0x92, 0x04, 0xdf, 0x07, 0x9d, 0x4a, 0x19, 0x7a, 0xc3, 0x99, 0x64, 0xca, 0xb3, 0x4e, 0x56, 0x05, + 0x7c, 0x07, 0x8a, 0x09, 0xfd, 0xd2, 0xde, 0x32, 0xab, 0x9f, 0x42, 0x89, 0x30, 0xe1, 0x7b, 0x2e, + 0x5d, 0xd1, 0xa2, 0x75, 0xda, 0x0a, 0x94, 0xa3, 0xa5, 0x99, 0x65, 0x6b, 0xb2, 0xbc, 0xfe, 0x0b, + 0xc1, 0x5e, 0xcf, 0xa7, 0x2e, 0x9b, 0xb2, 0x40, 0xf6, 0xb8, 0xef, 0xb9, 0x0b, 0xfc, 0x0c, 0xca, + 0x61, 0x42, 0x18, 0x99, 0x48, 0x9d, 0xf8, 0x70, 0xf3, 0xc4, 0x4b, 0x49, 0x92, 0x41, 0xf1, 0x09, + 0xdc, 0x75, 0x79, 0x20, 0xa9, 0x17, 0xb0, 0x70, 0x30, 0xa4, 0xee, 0xd5, 0x4c, 0x0c, 0xc6, 0x34, + 0x53, 0xdd, 0x21, 0x07, 0xd9, 0xf6, 0x99, 0xda, 0x6d, 0xab, 0x4d, 0xfc, 0x02, 0xf4, 0xd4, 0x4e, + 0x64, 0xe6, 0x94, 0x5e, 0x65, 0x53, 0x2f, 0x6d, 0x27, 0x59, 0x81, 0xd7, 0x6f, 0x26, 0xff, 0xbf, + 0x37, 0xf3, 0x55, 0x83, 0xb2, 0xc3, 0x47, 0xac, 0x13, 0x8c, 0x39, 0x7e, 0x00, 0x20, 0x66, 0x43, + 0xdf, 0x73, 0x07, 0xf1, 0xd8, 0xc4, 0x4d, 0xbb, 0x45, 0xf4, 0xa4, 0xf2, 0x9a, 0x2d, 0xb0, 0x09, + 0x25, 0x3a, 0x1a, 0x85, 0x2c, 0x8a, 0x96, 0x7d, 0x4b, 0x53, 0x7c, 0x0e, 0x90, 0x5d, 0x4c, 0x6a, + 0xfa, 0xe1, 0xa6, 0x78, 0x2a, 0x64, 0xb5, 0x52, 0x30, 0x59, 0xfb, 0x0e, 0x9f, 0x40, 0x21, 0x92, + 0x54, 0x26, 0xf3, 0xb6, 0xdb, 0xac, 0xfd, 0x83, 0xa0, 0x1f, 0xe3, 0x48, 0x02, 0xaf, 0xbc, 0x01, + 0x3d, 0x23, 0x4c, 0x67, 0x1e, 0xad, 0x66, 0x3e, 0x1b, 0x63, 0x6d, 0x7d, 0x8c, 0x4d, 0x28, 0x09, + 0x1a, 0xb2, 0x40, 0x26, 0x7e, 0x75, 0x92, 0xa6, 0xf5, 0x27, 0x50, 0x50, 0xf4, 0x78, 0x0f, 0xb6, + 0xdf, 0x39, 0xfd, 0x9e, 0xfd, 0xb2, 0xd3, 0xee, 0xd8, 0xe7, 0xc6, 0x16, 0x06, 0x28, 0x76, 0x9d, + 0x8b, 0x8e, 0x63, 0x1b, 0x08, 0x6f, 0x43, 0xa9, 0xdb, 0x6e, 0xab, 0x44, 0x7b, 0x34, 0x01, 0x3d, + 0xfb, 0x75, 0xf0, 0x21, 0x1c, 0x74, 0x7b, 0x36, 0x69, 0x5d, 0x76, 0xba, 0xce, 0xe0, 0x26, 0x41, + 0x11, 0x34, 0xfb, 0xad, 0x81, 0xe2, 0x18, 0x7f, 0x17, 0xc7, 0x57, 0x97, 0x46, 0x4e, 0x45, 0xdb, + 0xc8, 0xc7, 0xf1, 0xe2, 0xd2, 0x28, 0xa8, 0x68, 0x1b, 0xc5, 0x38, 0x76, 0x89, 0x51, 0xc2, 0x25, + 0xc8, 0xb5, 0x9c, 0x73, 0xa3, 0x7c, 0x36, 0xf8, 0x76, 0x5d, 0x45, 0xdf, 0xaf, 0xab, 0xe8, 0xc7, + 0x75, 0x15, 0x7d, 0xfa, 0x59, 0xdd, 0x7a, 0xff, 0x7c, 0xe2, 0xc9, 0x0f, 0xb3, 0xa1, 0xe5, 0xf2, + 0x69, 0x23, 0x88, 0x84, 0xeb, 0x1e, 0x8f, 0xd8, 0xbc, 0x11, 0x30, 0x3e, 0x8e, 0x8e, 0xa9, 0xf0, + 0x8e, 0x27, 0xbc, 0x71, 0xf3, 0x49, 0x39, 0x4d, 0xd6, 0x5f, 0xb4, 0xdb, 0x0e, 0xe3, 0xed, 0xbe, + 0xd5, 0xea, 0x75, 0xe2, 0x0e, 0x3b, 0xaa, 0x3a, 0x2c, 0xaa, 0xa7, 0xe6, 0xe9, 0xef, 0x00, 0x00, + 0x00, 0xff, 0xff, 0x04, 0x93, 0x38, 0x2a, 0x88, 0x04, 0x00, 0x00, +} + +func (m *Filter) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Filter) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Filter) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Filters) > 0 { + for iNdEx := len(m.Filters) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Filters[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + } + } + if len(m.Value) > 0 { + i -= len(m.Value) + copy(dAtA[i:], m.Value) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Value))) + i-- + dAtA[i] = 0x22 + } + if m.Op != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Op)) + i-- + dAtA[i] = 0x18 + } + if len(m.Key) > 0 { + i -= len(m.Key) + copy(dAtA[i:], m.Key) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Key))) + i-- + dAtA[i] = 0x12 + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Selector) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Selector) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Selector) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Filter) > 0 { + i -= len(m.Filter) + copy(dAtA[i:], m.Filter) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Filter))) + i-- + dAtA[i] = 0x22 + } + if len(m.Attribute) > 0 { + i -= len(m.Attribute) + copy(dAtA[i:], m.Attribute) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Attribute))) + i-- + dAtA[i] = 0x1a + } + if m.Count != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Count)) + i-- + dAtA[i] = 0x10 + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Replica) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Replica) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Replica) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Selector) > 0 { + i -= len(m.Selector) + copy(dAtA[i:], m.Selector) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Selector))) + i-- + dAtA[i] = 0x12 + } + if m.Count != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Count)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil } func (m *PlacementPolicy) Marshal() (dAtA []byte, err error) { @@ -729,10 +793,10 @@ func (m *PlacementPolicy) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } - if len(m.FilterGroups) > 0 { - for iNdEx := len(m.FilterGroups) - 1; iNdEx >= 0; iNdEx-- { + if len(m.Filters) > 0 { + for iNdEx := len(m.Filters) - 1; iNdEx >= 0; iNdEx-- { { - size, err := m.FilterGroups[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + size, err := m.Filters[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -740,59 +804,9 @@ func (m *PlacementPolicy) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintTypes(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x12 + dAtA[i] = 0x22 } } - if m.ReplFactor != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.ReplFactor)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *PlacementPolicy_FilterGroup) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *PlacementPolicy_FilterGroup) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *PlacementPolicy_FilterGroup) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.Exclude) > 0 { - dAtA2 := make([]byte, len(m.Exclude)*10) - var j1 int - for _, num := range m.Exclude { - for num >= 1<<7 { - dAtA2[j1] = uint8(uint64(num)&0x7f | 0x80) - num >>= 7 - j1++ - } - dAtA2[j1] = uint8(num) - j1++ - } - i -= j1 - copy(dAtA[i:], dAtA2[:j1]) - i = encodeVarintTypes(dAtA, i, uint64(j1)) - i-- - dAtA[i] = 0x1a - } if len(m.Selectors) > 0 { for iNdEx := len(m.Selectors) - 1; iNdEx >= 0; iNdEx-- { { @@ -804,13 +818,18 @@ func (m *PlacementPolicy_FilterGroup) MarshalToSizedBuffer(dAtA []byte) (int, er i = encodeVarintTypes(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x12 + dAtA[i] = 0x1a } } - if len(m.Filters) > 0 { - for iNdEx := len(m.Filters) - 1; iNdEx >= 0; iNdEx-- { + if m.ContainerBackupFactor != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.ContainerBackupFactor)) + i-- + dAtA[i] = 0x10 + } + if len(m.Replicas) > 0 { + for iNdEx := len(m.Replicas) - 1; iNdEx >= 0; iNdEx-- { { - size, err := m.Filters[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + size, err := m.Replicas[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -824,208 +843,6 @@ func (m *PlacementPolicy_FilterGroup) MarshalToSizedBuffer(dAtA []byte) (int, er return len(dAtA) - i, nil } -func (m *PlacementPolicy_FilterGroup_Filter) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *PlacementPolicy_FilterGroup_Filter) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *PlacementPolicy_FilterGroup_Filter) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.F != nil { - { - size, err := m.F.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if len(m.Key) > 0 { - i -= len(m.Key) - copy(dAtA[i:], m.Key) - i = encodeVarintTypes(dAtA, i, uint64(len(m.Key))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *PlacementPolicy_FilterGroup_Filter_SimpleFilter) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *PlacementPolicy_FilterGroup_Filter_SimpleFilter) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *PlacementPolicy_FilterGroup_Filter_SimpleFilter) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.Args != nil { - { - size := m.Args.Size() - i -= size - if _, err := m.Args.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - } - } - if m.Op != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.Op)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *PlacementPolicy_FilterGroup_Filter_SimpleFilter_Value) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *PlacementPolicy_FilterGroup_Filter_SimpleFilter_Value) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - i -= len(m.Value) - copy(dAtA[i:], m.Value) - i = encodeVarintTypes(dAtA, i, uint64(len(m.Value))) - i-- - dAtA[i] = 0x12 - return len(dAtA) - i, nil -} -func (m *PlacementPolicy_FilterGroup_Filter_SimpleFilter_FArgs) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *PlacementPolicy_FilterGroup_Filter_SimpleFilter_FArgs) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.FArgs != nil { - { - size, err := m.FArgs.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - return len(dAtA) - i, nil -} -func (m *PlacementPolicy_FilterGroup_Filter_SimpleFilter_SimpleFilters) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *PlacementPolicy_FilterGroup_Filter_SimpleFilter_SimpleFilters) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *PlacementPolicy_FilterGroup_Filter_SimpleFilter_SimpleFilters) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.Filters) > 0 { - for iNdEx := len(m.Filters) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Filters[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *PlacementPolicy_FilterGroup_Selector) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *PlacementPolicy_FilterGroup_Selector) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *PlacementPolicy_FilterGroup_Selector) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.Key) > 0 { - i -= len(m.Key) - copy(dAtA[i:], m.Key) - i = encodeVarintTypes(dAtA, i, uint64(len(m.Key))) - i-- - dAtA[i] = 0x12 - } - if m.Count != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.Count)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - func (m *NodeInfo) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -1110,6 +927,15 @@ func (m *NodeInfo_Attribute) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } + if len(m.Parents) > 0 { + for iNdEx := len(m.Parents) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Parents[iNdEx]) + copy(dAtA[i:], m.Parents[iNdEx]) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Parents[iNdEx]))) + i-- + dAtA[i] = 0x1a + } + } if len(m.Value) > 0 { i -= len(m.Value) copy(dAtA[i:], m.Value) @@ -1138,124 +964,27 @@ func encodeVarintTypes(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } -func (m *PlacementPolicy) Size() (n int) { +func (m *Filter) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.ReplFactor != 0 { - n += 1 + sovTypes(uint64(m.ReplFactor)) + l = len(m.Name) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) } - if len(m.FilterGroups) > 0 { - for _, e := range m.FilterGroups { - l = e.Size() - n += 1 + l + sovTypes(uint64(l)) - } - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *PlacementPolicy_FilterGroup) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Filters) > 0 { - for _, e := range m.Filters { - l = e.Size() - n += 1 + l + sovTypes(uint64(l)) - } - } - if len(m.Selectors) > 0 { - for _, e := range m.Selectors { - l = e.Size() - n += 1 + l + sovTypes(uint64(l)) - } - } - if len(m.Exclude) > 0 { - l = 0 - for _, e := range m.Exclude { - l += sovTypes(uint64(e)) - } - n += 1 + sovTypes(uint64(l)) + l - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *PlacementPolicy_FilterGroup_Filter) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l l = len(m.Key) if l > 0 { n += 1 + l + sovTypes(uint64(l)) } - if m.F != nil { - l = m.F.Size() - n += 1 + l + sovTypes(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *PlacementPolicy_FilterGroup_Filter_SimpleFilter) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l if m.Op != 0 { n += 1 + sovTypes(uint64(m.Op)) } - if m.Args != nil { - n += m.Args.Size() - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *PlacementPolicy_FilterGroup_Filter_SimpleFilter_Value) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l l = len(m.Value) - n += 1 + l + sovTypes(uint64(l)) - return n -} -func (m *PlacementPolicy_FilterGroup_Filter_SimpleFilter_FArgs) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.FArgs != nil { - l = m.FArgs.Size() + if l > 0 { n += 1 + l + sovTypes(uint64(l)) } - return n -} -func (m *PlacementPolicy_FilterGroup_Filter_SimpleFilter_SimpleFilters) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l if len(m.Filters) > 0 { for _, e := range m.Filters { l = e.Size() @@ -1268,7 +997,34 @@ func (m *PlacementPolicy_FilterGroup_Filter_SimpleFilter_SimpleFilters) Size() ( return n } -func (m *PlacementPolicy_FilterGroup_Selector) Size() (n int) { +func (m *Selector) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Name) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + if m.Count != 0 { + n += 1 + sovTypes(uint64(m.Count)) + } + l = len(m.Attribute) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.Filter) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *Replica) Size() (n int) { if m == nil { return 0 } @@ -1277,7 +1033,7 @@ func (m *PlacementPolicy_FilterGroup_Selector) Size() (n int) { if m.Count != 0 { n += 1 + sovTypes(uint64(m.Count)) } - l = len(m.Key) + l = len(m.Selector) if l > 0 { n += 1 + l + sovTypes(uint64(l)) } @@ -1287,6 +1043,39 @@ func (m *PlacementPolicy_FilterGroup_Selector) Size() (n int) { return n } +func (m *PlacementPolicy) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Replicas) > 0 { + for _, e := range m.Replicas { + l = e.Size() + n += 1 + l + sovTypes(uint64(l)) + } + } + if m.ContainerBackupFactor != 0 { + n += 1 + sovTypes(uint64(m.ContainerBackupFactor)) + } + if len(m.Selectors) > 0 { + for _, e := range m.Selectors { + l = e.Size() + n += 1 + l + sovTypes(uint64(l)) + } + } + if len(m.Filters) > 0 { + for _, e := range m.Filters { + l = e.Size() + n += 1 + l + sovTypes(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + func (m *NodeInfo) Size() (n int) { if m == nil { return 0 @@ -1330,6 +1119,12 @@ func (m *NodeInfo_Attribute) Size() (n int) { if l > 0 { n += 1 + l + sovTypes(uint64(l)) } + if len(m.Parents) > 0 { + for _, s := range m.Parents { + l = len(s) + n += 1 + l + sovTypes(uint64(l)) + } + } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -1342,6 +1137,483 @@ func sovTypes(x uint64) (n int) { func sozTypes(x uint64) (n int) { return sovTypes(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } +func (m *Filter) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Filter: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Filter: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Key = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Op", wireType) + } + m.Op = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Op |= Operation(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Value = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Filters", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Filters = append(m.Filters, &Filter{}) + if err := m.Filters[len(m.Filters)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Selector) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Selector: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Selector: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Count", wireType) + } + m.Count = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Count |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Attribute", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Attribute = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Filter", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Filter = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Replica) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Replica: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Replica: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Count", wireType) + } + m.Count = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Count |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Selector", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Selector = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *PlacementPolicy) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1372,10 +1644,44 @@ func (m *PlacementPolicy) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Replicas", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Replicas = append(m.Replicas, &Replica{}) + if err := m.Replicas[len(m.Replicas)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ReplFactor", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ContainerBackupFactor", wireType) } - m.ReplFactor = 0 + m.ContainerBackupFactor = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTypes @@ -1385,134 +1691,12 @@ func (m *PlacementPolicy) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.ReplFactor |= uint32(b&0x7F) << shift + m.ContainerBackupFactor |= uint32(b&0x7F) << shift if b < 0x80 { break } } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field FilterGroups", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.FilterGroups = append(m.FilterGroups, &PlacementPolicy_FilterGroup{}) - if err := m.FilterGroups[len(m.FilterGroups)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *PlacementPolicy_FilterGroup) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: FilterGroup: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: FilterGroup: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Filters", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Filters = append(m.Filters, &PlacementPolicy_FilterGroup_Filter{}) - if err := m.Filters[len(m.Filters)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: + case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Selectors", wireType) } @@ -1541,404 +1725,12 @@ func (m *PlacementPolicy_FilterGroup) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Selectors = append(m.Selectors, &PlacementPolicy_FilterGroup_Selector{}) + m.Selectors = append(m.Selectors, &Selector{}) if err := m.Selectors[len(m.Selectors)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex - case 3: - if wireType == 0 { - var v uint32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Exclude = append(m.Exclude, v) - } else if wireType == 2 { - var packedLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - packedLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if packedLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + packedLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - var elementCount int - var count int - for _, integer := range dAtA[iNdEx:postIndex] { - if integer < 128 { - count++ - } - } - elementCount = count - if elementCount != 0 && len(m.Exclude) == 0 { - m.Exclude = make([]uint32, 0, elementCount) - } - for iNdEx < postIndex { - var v uint32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Exclude = append(m.Exclude, v) - } - } else { - return fmt.Errorf("proto: wrong wireType = %d for field Exclude", wireType) - } - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *PlacementPolicy_FilterGroup_Filter) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Filter: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Filter: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Key = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field F", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.F == nil { - m.F = &PlacementPolicy_FilterGroup_Filter_SimpleFilter{} - } - if err := m.F.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *PlacementPolicy_FilterGroup_Filter_SimpleFilter) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: SimpleFilter: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: SimpleFilter: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Op", wireType) - } - m.Op = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Op |= PlacementPolicy_FilterGroup_Filter_SimpleFilter_Operation(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Args = &PlacementPolicy_FilterGroup_Filter_SimpleFilter_Value{string(dAtA[iNdEx:postIndex])} - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field FArgs", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := &PlacementPolicy_FilterGroup_Filter_SimpleFilter_SimpleFilters{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Args = &PlacementPolicy_FilterGroup_Filter_SimpleFilter_FArgs{v} - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *PlacementPolicy_FilterGroup_Filter_SimpleFilter_SimpleFilters) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: SimpleFilters: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: SimpleFilters: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: + case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Filters", wireType) } @@ -1967,7 +1759,7 @@ func (m *PlacementPolicy_FilterGroup_Filter_SimpleFilter_SimpleFilters) Unmarsha if postIndex > l { return io.ErrUnexpectedEOF } - m.Filters = append(m.Filters, &PlacementPolicy_FilterGroup_Filter_SimpleFilter{}) + m.Filters = append(m.Filters, &Filter{}) if err := m.Filters[len(m.Filters)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -1997,111 +1789,6 @@ func (m *PlacementPolicy_FilterGroup_Filter_SimpleFilter_SimpleFilters) Unmarsha } return nil } -func (m *PlacementPolicy_FilterGroup_Selector) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Selector: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Selector: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Count", wireType) - } - m.Count = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Count |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Key = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func (m *NodeInfo) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2368,6 +2055,38 @@ func (m *NodeInfo_Attribute) Unmarshal(dAtA []byte) error { } m.Value = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Parents", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Parents = append(m.Parents, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTypes(dAtA[iNdEx:]) From 148618b5b3ca8f92729251e0879712a59b377f3d Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Fri, 4 Sep 2020 13:05:56 +0300 Subject: [PATCH 0388/1196] [#134] v2/netmap: Update unified structures Signed-off-by: Alex Vanin --- v2/netmap/convert.go | 166 ++++++++++++++++++++++- v2/netmap/marshal.go | 268 +++++++++++++++++++++++++++++++++++- v2/netmap/marshal_test.go | 126 ++++++++++++++++- v2/netmap/types.go | 279 +++++++++++++++++++++++++++++++++++++- 4 files changed, 824 insertions(+), 15 deletions(-) diff --git a/v2/netmap/convert.go b/v2/netmap/convert.go index b8713fe..caf7e33 100644 --- a/v2/netmap/convert.go +++ b/v2/netmap/convert.go @@ -4,13 +4,130 @@ import ( netmap "github.com/nspcc-dev/neofs-api-go/v2/netmap/grpc" ) +func FilterToGRPCMessage(f *Filter) *netmap.Filter { + if f == nil { + return nil + } + + m := new(netmap.Filter) + + m.SetName(f.GetName()) + m.SetKey(f.GetKey()) + m.SetValue(f.GetValue()) + m.SetOp(OperationToGRPCMessage(f.GetOp())) + + filters := make([]*netmap.Filter, 0, len(f.GetFilters())) + for _, filter := range f.GetFilters() { + filters = append(filters, FilterToGRPCMessage(filter)) + } + m.SetFilters(filters) + + return m +} + +func FilterFromGRPCMessage(m *netmap.Filter) *Filter { + if m == nil { + return nil + } + + f := new(Filter) + f.SetName(m.GetName()) + f.SetKey(m.GetKey()) + f.SetValue(m.GetValue()) + f.SetOp(OperationFromGRPCMessage(m.GetOp())) + + filters := make([]*Filter, 0, len(f.GetFilters())) + for _, filter := range m.GetFilters() { + filters = append(filters, FilterFromGRPCMessage(filter)) + } + f.SetFilters(filters) + + return f +} + +func SelectorToGRPCMessage(s *Selector) *netmap.Selector { + if s == nil { + return nil + } + + m := new(netmap.Selector) + + m.SetName(s.GetName()) + m.SetCount(s.GetCount()) + m.SetFilter(s.GetFilter()) + m.SetAttribute(s.GetAttribute()) + + return m +} + +func SelectorFromGRPCMessage(m *netmap.Selector) *Selector { + if m == nil { + return nil + } + + s := new(Selector) + + s.SetName(m.GetName()) + s.SetCount(m.GetCount()) + s.SetFilter(m.GetFilter()) + s.SetAttribute(m.GetAttribute()) + + return s +} + +func ReplicaToGRPCMessage(r *Replica) *netmap.Replica { + if r == nil { + return nil + } + + m := new(netmap.Replica) + + m.SetCount(r.GetCount()) + m.SetSelector(r.GetSelector()) + + return m +} + +func ReplicaFromGRPCMessage(m *netmap.Replica) *Replica { + if m == nil { + return nil + } + + r := new(Replica) + r.SetSelector(m.GetSelector()) + r.SetCount(m.GetCount()) + + return r +} + func PlacementPolicyToGRPCMessage(p *PlacementPolicy) *netmap.PlacementPolicy { if p == nil { return nil } - // TODO: fill me - return nil + filters := make([]*netmap.Filter, 0, len(p.GetFilters())) + for _, filter := range p.GetFilters() { + filters = append(filters, FilterToGRPCMessage(filter)) + } + + selectors := make([]*netmap.Selector, 0, len(p.GetSelectors())) + for _, selector := range p.GetSelectors() { + selectors = append(selectors, SelectorToGRPCMessage(selector)) + } + + replicas := make([]*netmap.Replica, 0, len(p.GetReplicas())) + for _, replica := range p.GetReplicas() { + replicas = append(replicas, ReplicaToGRPCMessage(replica)) + } + + m := new(netmap.PlacementPolicy) + + m.SetContainerBackupFactor(p.GetContainerBackupFactor()) + m.SetFilters(filters) + m.SetSelectors(selectors) + m.SetReplicas(replicas) + + return m } func PlacementPolicyFromGRPCMessage(m *netmap.PlacementPolicy) *PlacementPolicy { @@ -18,8 +135,45 @@ func PlacementPolicyFromGRPCMessage(m *netmap.PlacementPolicy) *PlacementPolicy return nil } - // TODO: fill me - return nil + filters := make([]*Filter, 0, len(m.GetFilters())) + for _, filter := range m.GetFilters() { + filters = append(filters, FilterFromGRPCMessage(filter)) + } + + selectors := make([]*Selector, 0, len(m.GetSelectors())) + for _, selector := range m.GetSelectors() { + selectors = append(selectors, SelectorFromGRPCMessage(selector)) + } + + replicas := make([]*Replica, 0, len(m.GetReplicas())) + for _, replica := range m.GetReplicas() { + replicas = append(replicas, ReplicaFromGRPCMessage(replica)) + } + + p := new(PlacementPolicy) + + p.SetContainerBackupFactor(m.GetContainerBackupFactor()) + p.SetFilters(filters) + p.SetSelectors(selectors) + p.SetReplicas(replicas) + + return p +} + +func OperationToGRPCMessage(n Operation) netmap.Operation { + return netmap.Operation(n) +} + +func OperationFromGRPCMessage(n netmap.Operation) Operation { + return Operation(n) +} + +func NodeStateToGRPCMessage(n NodeState) netmap.NodeInfo_State { + return netmap.NodeInfo_State(n) +} + +func NodeStateFromRPCMessage(n netmap.NodeInfo_State) NodeState { + return NodeState(n) } func AttributeToGRPCMessage(a *Attribute) *netmap.NodeInfo_Attribute { @@ -31,6 +185,7 @@ func AttributeToGRPCMessage(a *Attribute) *netmap.NodeInfo_Attribute { m.SetKey(a.GetKey()) m.SetValue(a.GetValue()) + m.SetParents(a.GetParents()) return m } @@ -44,6 +199,7 @@ func AttributeFromGRPCMessage(m *netmap.NodeInfo_Attribute) *Attribute { a.SetKey(m.GetKey()) a.SetValue(m.GetValue()) + a.SetParents(m.GetParents()) return a } @@ -57,6 +213,7 @@ func NodeInfoToGRPCMessage(n *NodeInfo) *netmap.NodeInfo { m.SetPublicKey(n.GetPublicKey()) m.SetAddress(n.GetAddress()) + m.SetState(NodeStateToGRPCMessage(n.GetState())) attr := n.GetAttributes() attrMsg := make([]*netmap.NodeInfo_Attribute, 0, len(attr)) @@ -79,6 +236,7 @@ func NodeInfoFromGRPCMessage(m *netmap.NodeInfo) *NodeInfo { a.SetPublicKey(m.GetPublicKey()) a.SetAddress(m.GetAddress()) + a.SetState(NodeStateFromRPCMessage(m.GetState())) attrMsg := m.GetAttributes() attr := make([]*Attribute, 0, len(attrMsg)) diff --git a/v2/netmap/marshal.go b/v2/netmap/marshal.go index b5025f5..a38d8a2 100644 --- a/v2/netmap/marshal.go +++ b/v2/netmap/marshal.go @@ -5,22 +5,256 @@ import ( ) const ( - keyAttributeField = 1 - valueAttributeField = 2 + nameFilterField = 1 + keyFilterField = 2 + opFilterField = 3 + valueFilterField = 4 + filtersFilterField = 5 + + nameSelectorField = 1 + countSelectorField = 2 + attributeSelectorField = 3 + filterSelectorField = 4 + + countReplicaField = 1 + selectorReplicaField = 2 + + replicasPolicyField = 1 + backupPolicyField = 2 + selectorsPolicyField = 3 + filtersPolicyField = 4 + + keyAttributeField = 1 + valueAttributeField = 2 + parentsAttributeField = 3 keyNodeInfoField = 1 addressNodeInfoField = 2 attributesNodeInfoField = 3 + stateNodeInfoField = 4 ) +func (f *Filter) StableMarshal(buf []byte) ([]byte, error) { + if f == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, f.StableSize()) + } + + var ( + offset, n int + err error + ) + + n, err = proto.StringMarshal(nameFilterField, buf[offset:], f.name) + if err != nil { + return nil, err + } + + offset += n + + n, err = proto.StringMarshal(keyFilterField, buf[offset:], f.key) + if err != nil { + return nil, err + } + + offset += n + + n, err = proto.EnumMarshal(opFilterField, buf[offset:], int32(f.op)) + if err != nil { + return nil, err + } + + offset += n + + n, err = proto.StringMarshal(valueFilterField, buf[offset:], f.value) + if err != nil { + return nil, err + } + + offset += n + + for i := range f.filters { + n, err = proto.NestedStructureMarshal(filtersFilterField, buf[offset:], f.filters[i]) + if err != nil { + return nil, err + } + + offset += n + } + + return buf, nil +} + +func (f *Filter) StableSize() (size int) { + size += proto.StringSize(nameFilterField, f.name) + size += proto.StringSize(keyFilterField, f.key) + size += proto.EnumSize(opFilterField, int32(f.op)) + size += proto.StringSize(valueFilterField, f.value) + for i := range f.filters { + size += proto.NestedStructureSize(filtersFilterField, f.filters[i]) + } + + return size +} + +func (s *Selector) StableMarshal(buf []byte) ([]byte, error) { + if s == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, s.StableSize()) + } + + var ( + offset, n int + err error + ) + + n, err = proto.StringMarshal(nameSelectorField, buf[offset:], s.name) + if err != nil { + return nil, err + } + + offset += n + + n, err = proto.UInt32Marshal(countSelectorField, buf[offset:], s.count) + if err != nil { + return nil, err + } + + offset += n + + n, err = proto.StringMarshal(attributeSelectorField, buf[offset:], s.attribute) + if err != nil { + return nil, err + } + + offset += n + + n, err = proto.StringMarshal(filterSelectorField, buf[offset:], s.filter) + if err != nil { + return nil, err + } + + return buf, nil +} + +func (s *Selector) StableSize() (size int) { + size += proto.StringSize(nameSelectorField, s.name) + size += proto.UInt32Size(countSelectorField, s.count) + size += proto.StringSize(attributeSelectorField, s.attribute) + size += proto.StringSize(filterSelectorField, s.filter) + + return size +} + +func (r *Replica) StableMarshal(buf []byte) ([]byte, error) { + if r == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, r.StableSize()) + } + + var ( + offset, n int + err error + ) + + n, err = proto.UInt32Marshal(countReplicaField, buf[offset:], r.count) + if err != nil { + return nil, err + } + + offset += n + + n, err = proto.StringMarshal(selectorReplicaField, buf[offset:], r.selector) + if err != nil { + return nil, err + } + + return buf, nil +} + +func (r *Replica) StableSize() (size int) { + size += proto.UInt32Size(countReplicaField, r.count) + size += proto.StringSize(selectorReplicaField, r.selector) + + return size +} + func (p *PlacementPolicy) StableMarshal(buf []byte) ([]byte, error) { - // todo: implement me - return nil, nil + if p == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, p.StableSize()) + } + + var ( + offset, n int + err error + ) + + for i := range p.replicas { + n, err = proto.NestedStructureMarshal(replicasPolicyField, buf[offset:], p.replicas[i]) + if err != nil { + return nil, err + } + + offset += n + } + + n, err = proto.UInt32Marshal(backupPolicyField, buf[offset:], p.backupFactor) + if err != nil { + return nil, err + } + + offset += n + + for i := range p.selectors { + n, err = proto.NestedStructureMarshal(selectorsPolicyField, buf[offset:], p.selectors[i]) + if err != nil { + return nil, err + } + + offset += n + } + + for i := range p.filters { + n, err = proto.NestedStructureMarshal(filtersPolicyField, buf[offset:], p.filters[i]) + if err != nil { + return nil, err + } + + offset += n + } + + return buf, nil } func (p *PlacementPolicy) StableSize() (size int) { - // todo: implement me - return 0 + for i := range p.replicas { + size += proto.NestedStructureSize(replicasPolicyField, p.replicas[i]) + } + + size += proto.UInt32Size(backupPolicyField, p.backupFactor) + + for i := range p.selectors { + size += proto.NestedStructureSize(selectorsPolicyField, p.selectors[i]) + } + + for i := range p.filters { + size += proto.NestedStructureSize(filtersPolicyField, p.filters[i]) + } + + return size } func (a *Attribute) StableMarshal(buf []byte) ([]byte, error) { @@ -49,6 +283,17 @@ func (a *Attribute) StableMarshal(buf []byte) ([]byte, error) { return nil, err } + offset += n + + for i := range a.parents { + n, err = proto.StringMarshal(parentsAttributeField, buf[offset:], a.parents[i]) + if err != nil { + return nil, err + } + + offset += n + } + return buf, nil } @@ -60,6 +305,10 @@ func (a *Attribute) StableSize() (size int) { size += proto.StringSize(keyAttributeField, a.key) size += proto.StringSize(valueAttributeField, a.value) + for i := range a.parents { + size += proto.StringSize(parentsAttributeField, a.parents[i]) + } + return size } @@ -100,6 +349,11 @@ func (ni *NodeInfo) StableMarshal(buf []byte) ([]byte, error) { offset += n } + n, err = proto.EnumMarshal(stateNodeInfoField, buf[offset:], int32(ni.state)) + if err != nil { + return nil, err + } + return buf, nil } @@ -114,5 +368,7 @@ func (ni *NodeInfo) StableSize() (size int) { size += proto.NestedStructureSize(attributesNodeInfoField, ni.attributes[i]) } + size += proto.EnumSize(stateNodeInfoField, int32(ni.state)) + return size } diff --git a/v2/netmap/marshal_test.go b/v2/netmap/marshal_test.go index 1292c40..7178a20 100644 --- a/v2/netmap/marshal_test.go +++ b/v2/netmap/marshal_test.go @@ -25,7 +25,7 @@ func TestAttribute_StableMarshal(t *testing.T) { }) } -func TestNodeInfo(t *testing.T) { +func TestNodeInfo_StableMarshal(t *testing.T) { from := generateNodeInfo("publicKey", "/multi/addr", 10) transport := new(grpc.NodeInfo) @@ -41,10 +41,75 @@ func TestNodeInfo(t *testing.T) { }) } +func TestFilter_StableMarshal(t *testing.T) { + from := generateFilter("key", "value", false) + transport := new(grpc.Filter) + + t.Run("non empty", func(t *testing.T) { + wire, err := from.StableMarshal(nil) + require.NoError(t, err) + + err = transport.Unmarshal(wire) + require.NoError(t, err) + + to := netmap.FilterFromGRPCMessage(transport) + require.Equal(t, from, to) + }) +} + +func TestSelector_StableMarshal(t *testing.T) { + from := generateSelector("name") + transport := new(grpc.Selector) + + t.Run("non empty", func(t *testing.T) { + wire, err := from.StableMarshal(nil) + require.NoError(t, err) + + err = transport.Unmarshal(wire) + require.NoError(t, err) + + to := netmap.SelectorFromGRPCMessage(transport) + require.Equal(t, from, to) + }) +} + +func TestReplica_StableMarshal(t *testing.T) { + from := generateReplica("selector") + transport := new(grpc.Replica) + + t.Run("non empty", func(t *testing.T) { + wire, err := from.StableMarshal(nil) + require.NoError(t, err) + + err = transport.Unmarshal(wire) + require.NoError(t, err) + + to := netmap.ReplicaFromGRPCMessage(transport) + require.Equal(t, from, to) + }) +} + +func TestPlacementPolicy_StableSize(t *testing.T) { + from := generatePolicy(3) + transport := new(grpc.PlacementPolicy) + + t.Run("non empty", func(t *testing.T) { + wire, err := from.StableMarshal(nil) + require.NoError(t, err) + + err = transport.Unmarshal(wire) + require.NoError(t, err) + + to := netmap.PlacementPolicyFromGRPCMessage(transport) + require.Equal(t, from, to) + }) +} + func generateAttribute(k, v string) *netmap.Attribute { attr := new(netmap.Attribute) attr.SetKey(k) attr.SetValue(v) + attr.SetParents([]string{k, v}) return attr } @@ -53,6 +118,7 @@ func generateNodeInfo(key, addr string, n int) *netmap.NodeInfo { nodeInfo := new(netmap.NodeInfo) nodeInfo.SetPublicKey([]byte(key)) nodeInfo.SetAddress(addr) + nodeInfo.SetState(netmap.Online) attrs := make([]*netmap.Attribute, n) for i := 0; i < n; i++ { @@ -64,3 +130,61 @@ func generateNodeInfo(key, addr string, n int) *netmap.NodeInfo { return nodeInfo } + +func generateFilter(key, value string, fin bool) *netmap.Filter { + f := new(netmap.Filter) + f.SetKey(key) + f.SetValue(value) + f.SetName("name") + f.SetOp(netmap.AND) + if !fin { + ff := generateFilter(key+"fin", value+"fin", true) + f.SetFilters([]*netmap.Filter{ff}) + } else { + f.SetFilters([]*netmap.Filter{}) + } + + return f +} + +func generateSelector(name string) *netmap.Selector { + s := new(netmap.Selector) + s.SetName(name) + s.SetAttribute("attribute") + s.SetCount(10) + s.SetFilter("filter") + + return s +} + +func generateReplica(selector string) *netmap.Replica { + r := new(netmap.Replica) + r.SetCount(10) + r.SetSelector(selector) + + return r +} + +func generatePolicy(n int) *netmap.PlacementPolicy { + var ( + p = new(netmap.PlacementPolicy) + f = make([]*netmap.Filter, 0, n) + s = make([]*netmap.Selector, 0, n) + r = make([]*netmap.Replica, 0, n) + ) + + for i := 0; i < n; i++ { + ind := strconv.Itoa(i) + + f = append(f, generateFilter("key"+ind, "val"+ind, false)) + s = append(s, generateSelector("name"+ind)) + r = append(r, generateReplica("selector"+ind)) + } + + p.SetFilters(f) + p.SetSelectors(s) + p.SetReplicas(r) + p.SetContainerBackupFactor(10) + + return p +} diff --git a/v2/netmap/types.go b/v2/netmap/types.go index 7df923c..c16fa50 100644 --- a/v2/netmap/types.go +++ b/v2/netmap/types.go @@ -1,13 +1,39 @@ package netmap +type Filter struct { + name string + key string + op Operation + value string + filters []*Filter +} + +type Selector struct { + name string + count uint32 + attribute string + filter string +} + +type Replica struct { + count uint32 + selector string +} + +type Operation uint32 + type PlacementPolicy struct { - // TODO: fill me + replicas []*Replica + backupFactor uint32 + selectors []*Selector + filters []*Filter } // Attribute of storage node. type Attribute struct { - key string - value string + key string + value string + parents []string } // NodeInfo of storage node. @@ -15,17 +41,234 @@ type NodeInfo struct { publicKey []byte address string attributes []*Attribute + state NodeState } // NodeState of storage node. type NodeState uint32 const ( - Unspecified NodeState = iota + UnspecifiedState NodeState = iota Online Offline ) +const ( + UnspecifiedOperation Operation = iota + EQ + NE + GT + GE + LT + LE + OR + AND +) + +func (f *Filter) GetFilters() []*Filter { + if f != nil { + return f.filters + } + + return nil +} + +func (f *Filter) SetFilters(filters []*Filter) { + if f != nil { + f.filters = filters + } +} + +func (f *Filter) GetValue() string { + if f != nil { + return f.value + } + + return "" +} + +func (f *Filter) SetValue(value string) { + if f != nil { + f.value = value + } +} + +func (f *Filter) GetOp() Operation { + if f != nil { + return f.op + } + return UnspecifiedOperation +} + +func (f *Filter) SetOp(op Operation) { + if f != nil { + f.op = op + } +} + +func (f *Filter) GetKey() string { + if f != nil { + return f.key + } + + return "" +} + +func (f *Filter) SetKey(key string) { + if f != nil { + f.key = key + } +} + +func (f *Filter) GetName() string { + if f != nil { + return f.name + } + + return "" +} + +func (f *Filter) SetName(name string) { + if f != nil { + f.name = name + } +} + +func (s *Selector) GetFilter() string { + if s != nil { + return s.filter + } + + return "" +} + +func (s *Selector) SetFilter(filter string) { + if s != nil { + s.filter = filter + } +} + +func (s *Selector) GetAttribute() string { + if s != nil { + return s.attribute + } + + return "" +} + +func (s *Selector) SetAttribute(attribute string) { + if s != nil { + s.attribute = attribute + } +} + +func (s *Selector) GetCount() uint32 { + if s != nil { + return s.count + } + + return 0 +} + +func (s *Selector) SetCount(count uint32) { + if s != nil { + s.count = count + } +} + +func (s *Selector) GetName() string { + if s != nil { + return s.name + } + + return "" +} + +func (s *Selector) SetName(name string) { + if s != nil { + s.name = name + } +} + +func (r *Replica) GetSelector() string { + if r != nil { + return r.selector + } + + return "" +} + +func (r *Replica) SetSelector(selector string) { + if r != nil { + r.selector = selector + } +} + +func (r *Replica) GetCount() uint32 { + if r != nil { + return r.count + } + + return 0 +} + +func (r *Replica) SetCount(count uint32) { + if r != nil { + r.count = count + } +} + +func (p *PlacementPolicy) GetFilters() []*Filter { + if p != nil { + return p.filters + } + + return nil +} + +func (p *PlacementPolicy) SetFilters(filters []*Filter) { + if p != nil { + + } + p.filters = filters +} + +func (p *PlacementPolicy) GetSelectors() []*Selector { + if p != nil { + return p.selectors + } + + return nil +} + +func (p *PlacementPolicy) SetSelectors(selectors []*Selector) { + if p != nil { + p.selectors = selectors + } +} + +func (p *PlacementPolicy) GetContainerBackupFactor() uint32 { + if p != nil { + return p.backupFactor + } + + return 0 +} + +func (p *PlacementPolicy) SetContainerBackupFactor(backupFactor uint32) { + if p != nil { + p.backupFactor = backupFactor + } +} + +func (p *PlacementPolicy) GetReplicas() []*Replica { + return p.replicas +} + +func (p *PlacementPolicy) SetReplicas(replicas []*Replica) { + p.replicas = replicas +} + func (a *Attribute) GetKey() string { if a != nil { return a.key @@ -54,6 +297,20 @@ func (a *Attribute) SetValue(v string) { } } +func (a *Attribute) GetParents() []string { + if a != nil { + return a.parents + } + + return nil +} + +func (a *Attribute) SetParents(parent []string) { + if a != nil { + a.parents = parent + } +} + func (ni *NodeInfo) GetPublicKey() []byte { if ni != nil { return ni.publicKey @@ -95,3 +352,17 @@ func (ni *NodeInfo) SetAttributes(v []*Attribute) { ni.attributes = v } } + +func (ni *NodeInfo) GetState() NodeState { + if ni != nil { + return ni.state + } + + return UnspecifiedState +} + +func (ni *NodeInfo) SetState(state NodeState) { + if ni != nil { + ni.state = state + } +} From 59f804faa2bf0c5b7d8f26dd65ff4256ebe4e0ff Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Fri, 4 Sep 2020 14:25:35 +0300 Subject: [PATCH 0389/1196] [#136] v2/acl: Fix record stable size --- v2/acl/marshal.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/v2/acl/marshal.go b/v2/acl/marshal.go index dbbf630..3478b42 100644 --- a/v2/acl/marshal.go +++ b/v2/acl/marshal.go @@ -150,7 +150,7 @@ func (r *Record) StableSize() (size int) { } size += proto.EnumSize(recordOperationField, int32(r.op)) - size += proto.EnumSize(recordActionField, int32(r.op)) + size += proto.EnumSize(recordActionField, int32(r.action)) for i := range r.filters { size += proto.NestedStructureSize(recordFiltersField, r.filters[i]) From 047bae63d0f7337c9fa279154cc17ad8ea83d14f Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 4 Sep 2020 12:16:08 +0300 Subject: [PATCH 0390/1196] [#135] sdk/object: Fix IDFromV2 nil-behavior Remove nil if-statement from IDFromV2 function to which avoids checking the correctness of the identifier format. From now IDFromV2 returns format error on nil argument. Signed-off-by: Leonard Lyubich --- pkg/object/id.go | 4 ---- 1 file changed, 4 deletions(-) diff --git a/pkg/object/id.go b/pkg/object/id.go index 437f2d4..f7a3a1f 100644 --- a/pkg/object/id.go +++ b/pkg/object/id.go @@ -37,10 +37,6 @@ func (id *ID) ToV2() *refs.ObjectID { // Returns an error if the format of the identifier // in the message is broken. func IDFromV2(idV2 *refs.ObjectID) (*ID, error) { - if idV2 == nil { - return nil, nil - } - val := idV2.GetValue() if ln := len(val); ln != sha256.Size { return nil, errors.Errorf("could not convert %T to %T: invalid length %d", From 8e9d4560383bbebfd526430e5b8978e26c1ad71c Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 4 Sep 2020 12:17:19 +0300 Subject: [PATCH 0391/1196] [#135] sdk/container: Fix IDFromV2 nil-behavior Remove nil if-statement from IDFromV2 function to which avoids checking the correctness of the identifier format. From now IDFromV2 returns format error on nil argument. Signed-off-by: Leonard Lyubich --- pkg/container/id.go | 4 ---- 1 file changed, 4 deletions(-) diff --git a/pkg/container/id.go b/pkg/container/id.go index 5bccc07..5046798 100644 --- a/pkg/container/id.go +++ b/pkg/container/id.go @@ -33,10 +33,6 @@ func (id *ID) ToV2() *refs.ContainerID { } func IDFromV2(idV2 *refs.ContainerID) (*ID, error) { - if idV2 == nil { - return nil, nil - } - val := idV2.GetValue() if ln := len(val); ln != sha256.Size { return nil, errors.Errorf( From 9b0eef0d436222a1241555a340f2d622e61152aa Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 4 Sep 2020 13:04:24 +0300 Subject: [PATCH 0392/1196] [#135] sdk/object: Add Release method to RawObject Implement Release method that converts RawObject to read-only finalized Object instance. Remove ToV2 method overriding from Object. Signed-off-by: Leonard Lyubich --- pkg/object/object.go | 7 ------- pkg/object/raw.go | 11 +++++++++++ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/pkg/object/object.go b/pkg/object/object.go index be1f5b8..2d96002 100644 --- a/pkg/object/object.go +++ b/pkg/object/object.go @@ -117,13 +117,6 @@ func (o *Object) CutPayload() *Object { return nil } -// ToV2 converts object to v2 Object message. -func (o *Object) ToV2() *object.Object { - obj, _ := o.rwObject.ToV2(nil) - - return obj -} - func (o *rwObject) v2Header() *object.Header { hV2 := new(object.Header) hV2.SetContainerID(o.cid.ToV2()) diff --git a/pkg/object/raw.go b/pkg/object/raw.go index c82ba5c..ffd9f21 100644 --- a/pkg/object/raw.go +++ b/pkg/object/raw.go @@ -38,6 +38,17 @@ func (o *RawObject) SetOwnerID(v *owner.ID) { } } +// Release returns read-only Object instance. +func (o *RawObject) Release() *Object { + if o != nil { + return &Object{ + rwObject: o.rwObject, + } + } + + return nil +} + // SetPayloadChecksumSHA256 sets payload checksum as a SHA256 checksum. func (o *RawObject) SetPayloadChecksumSHA256(v [sha256.Size]byte) { if o != nil { From b19e3a48db1033053dde93205939d6a65337aec1 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 4 Sep 2020 13:05:57 +0300 Subject: [PATCH 0393/1196] [#135] sdk/client: Implement object operations Signed-off-by: Leonard Lyubich --- pkg/client/object.go | 881 +++++++++++++++++++++++++++++++++++++++++++ pkg/client/opts.go | 3 + 2 files changed, 884 insertions(+) create mode 100644 pkg/client/object.go diff --git a/pkg/client/object.go b/pkg/client/object.go new file mode 100644 index 0000000..3bedecf --- /dev/null +++ b/pkg/client/object.go @@ -0,0 +1,881 @@ +package client + +import ( + "bytes" + "context" + "crypto/ecdsa" + "crypto/sha256" + "fmt" + "io" + + "github.com/nspcc-dev/neofs-api-go/pkg/object" + "github.com/nspcc-dev/neofs-api-go/v2/client" + v2object "github.com/nspcc-dev/neofs-api-go/v2/object" + v2refs "github.com/nspcc-dev/neofs-api-go/v2/refs" + "github.com/nspcc-dev/neofs-api-go/v2/signature" + "github.com/pkg/errors" +) + +type Range struct { + ln, off uint64 +} + +type PutObjectParams struct { + obj *object.Object + + r io.Reader +} + +type DeleteObjectParams struct { + addr *object.Address +} + +type GetObjectParams struct { + addr *object.Address + + w io.Writer +} + +type ObjectHeaderParams struct { + addr *object.Address + + short bool +} + +type RangeDataParams struct { + addr *object.Address + + r *Range + + w io.Writer +} + +type RangeChecksumParams struct { + typ checksumType + + addr *object.Address + + rs []*Range + + salt []byte +} + +type putObjectV2Writer struct { + key *ecdsa.PrivateKey + + chunkPart *v2object.PutObjectPartChunk + + req *v2object.PutRequest + + stream v2object.PutObjectStreamer +} + +type checksumType int + +const ( + _ checksumType = iota + checksumSHA256 + checksumTZ +) + +const chunkSize = 3 * (1 << 20) + +const TZSize = 64 + +func rangesToV2(rs []*Range) []*v2object.Range { + r2 := make([]*v2object.Range, 0, len(rs)) + + for i := range rs { + r2 = append(r2, rs[i].toV2()) + } + + return r2 +} + +func (t checksumType) toV2() v2refs.ChecksumType { + switch t { + case checksumSHA256: + return v2refs.SHA256 + case checksumTZ: + return v2refs.TillichZemor + default: + panic(fmt.Sprintf("invalid checksum type %d", t)) + } +} + +func (r *Range) WithLength(v uint64) *Range { + if r != nil { + r.ln = v + } + + return r +} + +func (r *Range) WithOffset(v uint64) *Range { + if r != nil { + r.off = v + } + + return r +} + +func (r *Range) toV2() *v2object.Range { + if r != nil { + r2 := new(v2object.Range) + r2.SetOffset(r.off) + r2.SetLength(r.ln) + + return r2 + } + + return nil +} + +func (w *putObjectV2Writer) Write(p []byte) (int, error) { + w.chunkPart.SetChunk(p) + + w.req.SetVerificationHeader(nil) + + if err := signature.SignServiceMessage(w.key, w.req); err != nil { + return 0, errors.Wrap(err, "could not sign chunk request message") + } + + if err := w.stream.Send(w.req); err != nil { + return 0, errors.Wrap(err, "could not send chunk request message") + } + + return len(p), nil +} + +func (p *PutObjectParams) WithObject(v *object.Object) *PutObjectParams { + if p != nil { + p.obj = v + } + + return p +} + +func (p *PutObjectParams) WithPayloadReader(v io.Reader) *PutObjectParams { + if p != nil { + p.r = v + } + + return p +} + +func (c *Client) PutObject(ctx context.Context, p *PutObjectParams, opts ...CallOption) (*object.ID, error) { + // check remote node version + switch c.remoteNode.Version.Major { + case 2: + return c.putObjectV2(ctx, p, opts...) + default: + return nil, unsupportedProtocolErr + } +} + +func (c *Client) putObjectV2(ctx context.Context, p *PutObjectParams, opts ...CallOption) (*object.ID, error) { + // convert object to V2 + obj, err := p.obj.ToV2(c.key) + if err != nil { + return nil, errors.Wrap(err, "could not convert object to V2") + } + + // create V2 Object client + cli, err := v2ObjectClient(c.remoteNode.Protocol, c.opts) + if err != nil { + return nil, errors.Wrap(err, "could not create Object V2 client") + } + + stream, err := cli.Put(ctx) + if err != nil { + return nil, errors.Wrap(err, "could not open Put object stream") + } + + callOpts := defaultCallOptions() + + for i := range opts { + if opts[i] != nil { + opts[i].apply(&callOpts) + } + } + + // create request + req := new(v2object.PutRequest) + + // initialize request body + body := new(v2object.PutRequestBody) + req.SetBody(body) + + // set meta header + req.SetMetaHeader(v2MetaHeaderFromOpts(callOpts)) + + // initialize init part + initPart := new(v2object.PutObjectPartInit) + body.SetObjectPart(initPart) + + // set init part fields + initPart.SetObjectID(obj.GetObjectID()) + initPart.SetSignature(obj.GetSignature()) + initPart.SetHeader(obj.GetHeader()) + + // sign the request + if err := signature.SignServiceMessage(c.key, req); err != nil { + return nil, errors.Wrapf(err, "could not sign %T", req) + } + + // send init part + if err := stream.Send(req); err != nil { + return nil, errors.Wrapf(err, "could not send %T", req) + } + + // create payload bytes reader + var rPayload io.Reader = bytes.NewReader(obj.GetPayload()) + if p.r != nil { + rPayload = io.MultiReader(rPayload, p.r) + } + + // create v2 payload stream writer + chunkPart := new(v2object.PutObjectPartChunk) + body.SetObjectPart(chunkPart) + + w := &putObjectV2Writer{ + key: c.key, + chunkPart: chunkPart, + req: req, + stream: stream, + } + + // copy payload from reader to stream writer + if _, err := io.CopyBuffer(w, rPayload, make([]byte, chunkSize)); err != nil { + return nil, errors.Wrap(err, "could not send payload bytes to Put object stream") + } + + // close object stream and receive response from remote node + resp, err := stream.CloseAndRecv() + if err != nil { + return nil, errors.Wrapf(err, "could not close %T", stream) + } + + // verify response structure + if err := signature.VerifyServiceMessage(resp); err != nil { + return nil, errors.Wrapf(err, "could not verify %T", resp) + } + + // convert object identifier + id, err := object.IDFromV2(resp.GetBody().GetObjectID()) + if err != nil { + return nil, errors.Wrap(err, "could not convert object identifier") + } + + return id, nil +} + +func (p *DeleteObjectParams) WithAddress(v *object.Address) *DeleteObjectParams { + if p != nil { + p.addr = v + } + + return p +} + +func (c *Client) DeleteObject(ctx context.Context, p *DeleteObjectParams, opts ...CallOption) error { + // check remote node version + switch c.remoteNode.Version.Major { + case 2: + return c.deleteObjectV2(ctx, p, opts...) + default: + return unsupportedProtocolErr + } +} + +func (c *Client) deleteObjectV2(ctx context.Context, p *DeleteObjectParams, opts ...CallOption) error { + // create V2 Object client + cli, err := v2ObjectClient(c.remoteNode.Protocol, c.opts) + if err != nil { + return errors.Wrap(err, "could not create Object V2 client") + } + + callOpts := defaultCallOptions() + + for i := range opts { + if opts[i] != nil { + opts[i].apply(&callOpts) + } + } + + // create request + req := new(v2object.DeleteRequest) + + // initialize request body + body := new(v2object.DeleteRequestBody) + req.SetBody(body) + + // set meta header + req.SetMetaHeader(v2MetaHeaderFromOpts(callOpts)) + + // fill body fields + body.SetAddress(p.addr.ToV2()) + + // sign the request + if err := signature.SignServiceMessage(c.key, req); err != nil { + return errors.Wrapf(err, "could not sign %T", req) + } + + // send request + resp, err := cli.Delete(ctx, req) + if err != nil { + return errors.Wrapf(err, "could not send %T", req) + } + + // verify response structure + if err := signature.VerifyServiceMessage(resp); err != nil { + return errors.Wrapf(err, "could not verify %T", resp) + } + + return nil +} + +func (p *GetObjectParams) WithAddress(v *object.Address) *GetObjectParams { + if p != nil { + p.addr = v + } + + return p +} + +func (p *GetObjectParams) WithPayloadWriter(w io.Writer) *GetObjectParams { + if p != nil { + p.w = w + } + + return p +} + +func (c *Client) GetObject(ctx context.Context, p *GetObjectParams, opts ...CallOption) (*object.Object, error) { + // check remote node version + switch c.remoteNode.Version.Major { + case 2: + return c.getObjectV2(ctx, p, opts...) + default: + return nil, unsupportedProtocolErr + } +} + +func (c *Client) getObjectV2(ctx context.Context, p *GetObjectParams, opts ...CallOption) (*object.Object, error) { + // create V2 Object client + cli, err := v2ObjectClient(c.remoteNode.Protocol, c.opts) + if err != nil { + return nil, errors.Wrap(err, "could not create Object V2 client") + } + + callOpts := defaultCallOptions() + + for i := range opts { + if opts[i] != nil { + opts[i].apply(&callOpts) + } + } + + // create request + req := new(v2object.GetRequest) + + // initialize request body + body := new(v2object.GetRequestBody) + req.SetBody(body) + + // set meta header + req.SetMetaHeader(v2MetaHeaderFromOpts(callOpts)) + + // fill body fields + body.SetAddress(p.addr.ToV2()) + + // sign the request + if err := signature.SignServiceMessage(c.key, req); err != nil { + return nil, errors.Wrapf(err, "could not sign %T", req) + } + + // create Get object stream + stream, err := cli.Get(ctx, req) + if err != nil { + return nil, errors.Wrap(err, "could not create Get object stream") + } + + var ( + payload []byte + obj = new(v2object.Object) + ) + + for { + // receive message from server stream + resp, err := stream.Recv() + if err != nil { + if errors.Is(errors.Cause(err), io.EOF) { + break + } + + return nil, errors.Wrap(err, "could not receive Get response") + } + + // verify response structure + if err := signature.VerifyServiceMessage(resp); err != nil { + return nil, errors.Wrapf(err, "could not verify %T", resp) + } + + switch v := resp.GetBody().GetObjectPart().(type) { + case nil: + return nil, errors.New("received nil object part") + case *v2object.GetObjectPartInit: + obj.SetObjectID(v.GetObjectID()) + obj.SetSignature(v.GetSignature()) + + hdr := v.GetHeader() + obj.SetHeader(hdr) + + if p.w == nil { + payload = make([]byte, 0, hdr.GetPayloadLength()) + } + case *v2object.GetObjectPartChunk: + if p.w != nil { + if _, err := p.w.Write(v.GetChunk()); err != nil { + return nil, errors.Wrap(err, "could not write payload chunk") + } + } else { + payload = append(payload, v.GetChunk()...) + } + default: + panic(fmt.Sprintf("unexpected Get object part type %T", v)) + } + } + + obj.SetPayload(payload) + + // convert the object + res, err := object.FromV2(obj) + if err != nil { + return nil, errors.Wrap(err, "could not convert V2 object") + } + + return res, nil +} + +func (p *ObjectHeaderParams) WithAddress(v *object.Address) *ObjectHeaderParams { + if p != nil { + p.addr = v + } + + return p +} + +func (p *ObjectHeaderParams) WithAllFields() *ObjectHeaderParams { + if p != nil { + p.short = false + } + + return p +} + +func (p *ObjectHeaderParams) WithMainFields() *ObjectHeaderParams { + if p != nil { + p.short = true + } + + return p +} + +func (c *Client) GetObjectHeader(ctx context.Context, p *ObjectHeaderParams, opts ...CallOption) (*object.Object, error) { + // check remote node version + switch c.remoteNode.Version.Major { + case 2: + return c.getObjectHeaderV2(ctx, p, opts...) + default: + return nil, unsupportedProtocolErr + } +} + +func (c *Client) getObjectHeaderV2(ctx context.Context, p *ObjectHeaderParams, opts ...CallOption) (*object.Object, error) { + // create V2 Object client + cli, err := v2ObjectClient(c.remoteNode.Protocol, c.opts) + if err != nil { + return nil, errors.Wrap(err, "could not create Object V2 client") + } + + callOpts := defaultCallOptions() + + for i := range opts { + if opts[i] != nil { + opts[i].apply(&callOpts) + } + } + + // create request + req := new(v2object.HeadRequest) + + // initialize request body + body := new(v2object.HeadRequestBody) + req.SetBody(body) + + // set meta header + req.SetMetaHeader(v2MetaHeaderFromOpts(callOpts)) + + // fill body fields + body.SetAddress(p.addr.ToV2()) + body.SetMainOnly(p.short) + + // sign the request + if err := signature.SignServiceMessage(c.key, req); err != nil { + return nil, errors.Wrapf(err, "could not sign %T", req) + } + + // send Head request + resp, err := cli.Head(ctx, req) + if err != nil { + return nil, errors.Wrapf(err, "could not send %T", req) + } + + // verify response structure + if err := signature.VerifyServiceMessage(resp); err != nil { + return nil, errors.Wrapf(err, "could not verify %T", resp) + } + + var hdr *v2object.Header + + switch v := resp.GetBody().GetHeaderPart().(type) { + case nil: + return nil, errors.New("received nil object header part") + case *v2object.GetHeaderPartShort: + if !p.short { + return nil, errors.Errorf("wrong header part type: expected %T, received %T", + (*v2object.GetHeaderPartFull)(nil), (*v2object.GetHeaderPartShort)(nil), + ) + } + + h := v.GetShortHeader() + + hdr = new(v2object.Header) + hdr.SetPayloadLength(h.GetPayloadLength()) + hdr.SetVersion(h.GetVersion()) + hdr.SetOwnerID(h.GetOwnerID()) + hdr.SetObjectType(h.GetObjectType()) + hdr.SetCreationEpoch(h.GetCreationEpoch()) + case *v2object.GetHeaderPartFull: + if p.short { + return nil, errors.Errorf("wrong header part type: expected %T, received %T", + (*v2object.GetHeaderPartShort)(nil), (*v2object.GetHeaderPartFull)(nil), + ) + } + + hdr = v.GetHeader() + default: + panic(fmt.Sprintf("unexpected Head object type %T", v)) + } + + obj := new(v2object.Object) + obj.SetHeader(hdr) + + // convert the object + res, err := object.FromV2(obj) + if err != nil { + return nil, errors.Wrap(err, "could not convert object") + } + + return res, nil +} + +func (p *RangeDataParams) WithAddress(v *object.Address) *RangeDataParams { + if p != nil { + p.addr = v + } + + return p +} + +func (p *RangeDataParams) WithRange(v *Range) *RangeDataParams { + if p != nil { + p.r = v + } + + return p +} + +func (p *RangeDataParams) WithDataWriter(v io.Writer) *RangeDataParams { + if p != nil { + p.w = v + } + + return p +} + +func (c *Client) ObjectPayloadRangeData(ctx context.Context, p *RangeDataParams, opts ...CallOption) ([]byte, error) { + // check remote node version + switch c.remoteNode.Version.Major { + case 2: + return c.objectPayloadRangeV2(ctx, p, opts...) + default: + return nil, unsupportedProtocolErr + } +} + +func (c *Client) objectPayloadRangeV2(ctx context.Context, p *RangeDataParams, opts ...CallOption) ([]byte, error) { + // create V2 Object client + cli, err := v2ObjectClient(c.remoteNode.Protocol, c.opts) + if err != nil { + return nil, errors.Wrap(err, "could not create Object V2 client") + } + + callOpts := defaultCallOptions() + + for i := range opts { + if opts[i] != nil { + opts[i].apply(&callOpts) + } + } + + // create request + req := new(v2object.GetRangeRequest) + + // initialize request body + body := new(v2object.GetRangeRequestBody) + req.SetBody(body) + + // set meta header + req.SetMetaHeader(v2MetaHeaderFromOpts(callOpts)) + + // fill body fields + body.SetAddress(p.addr.ToV2()) + body.SetRange(p.r.toV2()) + + // sign the request + if err := signature.SignServiceMessage(c.key, req); err != nil { + return nil, errors.Wrapf(err, "could not sign %T", req) + } + + // create Get payload range stream + stream, err := cli.GetRange(ctx, req) + if err != nil { + return nil, errors.Wrap(err, "could not create Get payload range stream") + } + + var payload []byte + if p.w != nil { + payload = make([]byte, p.r.ln) + } + + for { + // receive message from server stream + resp, err := stream.Recv() + if err != nil { + if errors.Is(errors.Cause(err), io.EOF) { + break + } + + return nil, errors.Wrap(err, "could not receive Get payload range response") + } + + // verify response structure + if err := signature.VerifyServiceMessage(resp); err != nil { + return nil, errors.Wrapf(err, "could not verify %T", resp) + } + + chunk := resp.GetBody().GetChunk() + + if p.w != nil { + if _, err := p.w.Write(chunk); err != nil { + return nil, errors.Wrap(err, "could not write payload chunk") + } + } else { + payload = append(payload, chunk...) + } + } + + return payload, nil +} + +func (p *RangeChecksumParams) WithAddress(v *object.Address) *RangeChecksumParams { + if p != nil { + p.addr = v + } + + return p +} + +func (p *RangeChecksumParams) WithRangeList(rs ...*Range) *RangeChecksumParams { + if p != nil { + p.rs = rs + } + + return p +} + +func (p *RangeChecksumParams) WithSalt(v []byte) *RangeChecksumParams { + if p != nil { + p.salt = v + } + + return p +} + +func (p *RangeChecksumParams) withChecksumType(t checksumType) *RangeChecksumParams { + if p != nil { + p.typ = t + } + + return p +} + +func (c *Client) ObjectPayloadRangeSHA256(ctx context.Context, p *RangeChecksumParams, opts ...CallOption) ([][sha256.Size]byte, error) { + res, err := c.objectPayloadRangeHash(ctx, p.withChecksumType(checksumSHA256), opts...) + if err != nil { + return nil, err + } + + return res.([][sha256.Size]byte), nil +} + +func (c *Client) ObjectPayloadRangeTZ(ctx context.Context, p *RangeChecksumParams, opts ...CallOption) ([][TZSize]byte, error) { + res, err := c.objectPayloadRangeHash(ctx, p.withChecksumType(checksumTZ), opts...) + if err != nil { + return nil, err + } + + return res.([][TZSize]byte), nil +} + +func (c *Client) objectPayloadRangeHash(ctx context.Context, p *RangeChecksumParams, opts ...CallOption) (interface{}, error) { + // check remote node version + switch c.remoteNode.Version.Major { + case 2: + return c.objectPayloadRangeHashV2(ctx, p, opts...) + default: + return nil, unsupportedProtocolErr + } +} + +func (c *Client) objectPayloadRangeHashV2(ctx context.Context, p *RangeChecksumParams, opts ...CallOption) (interface{}, error) { + // create V2 Object client + cli, err := v2ObjectClient(c.remoteNode.Protocol, c.opts) + if err != nil { + return nil, errors.Wrap(err, "could not create Object V2 client") + } + + callOpts := defaultCallOptions() + + for i := range opts { + if opts[i] != nil { + opts[i].apply(&callOpts) + } + } + + // create request + req := new(v2object.GetRangeHashRequest) + + // initialize request body + body := new(v2object.GetRangeHashRequestBody) + req.SetBody(body) + + // set meta header + req.SetMetaHeader(v2MetaHeaderFromOpts(callOpts)) + + // fill body fields + body.SetAddress(p.addr.ToV2()) + body.SetSalt(p.salt) + + typV2 := p.typ.toV2() + body.SetType(typV2) + + rsV2 := rangesToV2(p.rs) + body.SetRanges(rsV2) + + // sign the request + if err := signature.SignServiceMessage(c.key, req); err != nil { + return nil, errors.Wrapf(err, "could not sign %T", req) + } + + // send request + resp, err := cli.GetRangeHash(ctx, req) + if err != nil { + return nil, errors.Wrapf(err, "could not send %T", req) + } + + // verify response structure + if err := signature.VerifyServiceMessage(resp); err != nil { + return nil, errors.Wrapf(err, "could not verify %T", resp) + } + + respBody := resp.GetBody() + respType := respBody.GetType() + respHashes := respBody.GetHashList() + + if t := p.typ.toV2(); respType != t { + return nil, errors.Errorf("invalid checksum type: expected %v, received %v", t, respType) + } else if reqLn, respLn := len(rsV2), len(respHashes); reqLn != respLn { + return nil, errors.Errorf("wrong checksum number: expected %d, received %d", reqLn, respLn) + } + + var res interface{} + + switch p.typ { + case checksumSHA256: + r := make([][sha256.Size]byte, 0, len(respHashes)) + + for i := range respHashes { + if ln := len(respHashes[i]); ln != sha256.Size { + return nil, errors.Errorf("invalid checksum length: expected %d, received %d", sha256.Size, ln) + } + + cs := [sha256.Size]byte{} + copy(cs[:], respHashes[i]) + + r = append(r, cs) + } + + res = r + case checksumTZ: + r := make([][TZSize]byte, 0, len(respHashes)) + + for i := range respHashes { + if ln := len(respHashes[i]); ln != TZSize { + return nil, errors.Errorf("invalid checksum length: expected %d, received %d", TZSize, ln) + } + + cs := [TZSize]byte{} + copy(cs[:], respHashes[i]) + + r = append(r, cs) + } + + res = r + } + + return res, nil +} + +func v2ObjectClient(proto TransportProtocol, opts *clientOptions) (*v2object.Client, error) { + switch proto { + case GRPC: + var err error + + if opts.grpcOpts.objectClientV2 == nil { + var optsV2 []v2object.Option + + if opts.grpcOpts.conn != nil { + optsV2 = []v2object.Option{ + v2object.WithGlobalOpts( + client.WithGRPCConn(opts.grpcOpts.conn), + ), + } + } else { + optsV2 = []v2object.Option{ + v2object.WithGlobalOpts( + client.WithNetworkAddress(opts.addr), + ), + } + } + + opts.grpcOpts.objectClientV2, err = v2object.NewClient(optsV2...) + } + + return opts.grpcOpts.objectClientV2, err + default: + return nil, unsupportedProtocolErr + } +} diff --git a/pkg/client/opts.go b/pkg/client/opts.go index 93f72d0..ba7202c 100644 --- a/pkg/client/opts.go +++ b/pkg/client/opts.go @@ -4,6 +4,7 @@ import ( "github.com/nspcc-dev/neofs-api-go/pkg" v2accounting "github.com/nspcc-dev/neofs-api-go/v2/accounting" v2container "github.com/nspcc-dev/neofs-api-go/v2/container" + v2object "github.com/nspcc-dev/neofs-api-go/v2/object" v2session "github.com/nspcc-dev/neofs-api-go/v2/session" "google.golang.org/grpc" ) @@ -40,6 +41,8 @@ type ( conn *grpc.ClientConn v2ContainerClient *v2container.Client v2AccountingClient *v2accounting.Client + + objectClientV2 *v2object.Client } ) From c0cc4a4374a6747303a65395760adbd60cd14df9 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Tue, 8 Sep 2020 13:19:22 +0300 Subject: [PATCH 0394/1196] [#138] v2/netmap: Update to neofs-api jindo release Signed-off-by: Alex Vanin --- v2/netmap/convert.go | 10 +++ v2/netmap/grpc/types.go | 7 ++ v2/netmap/grpc/types.pb.go | 166 +++++++++++++++++++++++++++---------- v2/netmap/marshal.go | 13 ++- v2/netmap/marshal_test.go | 1 + v2/netmap/types.go | 24 ++++++ 6 files changed, 173 insertions(+), 48 deletions(-) diff --git a/v2/netmap/convert.go b/v2/netmap/convert.go index caf7e33..e08d17c 100644 --- a/v2/netmap/convert.go +++ b/v2/netmap/convert.go @@ -54,6 +54,7 @@ func SelectorToGRPCMessage(s *Selector) *netmap.Selector { m.SetName(s.GetName()) m.SetCount(s.GetCount()) + m.SetClause(ClauseToGRPCMessage(s.GetClause())) m.SetFilter(s.GetFilter()) m.SetAttribute(s.GetAttribute()) @@ -69,6 +70,7 @@ func SelectorFromGRPCMessage(m *netmap.Selector) *Selector { s.SetName(m.GetName()) s.SetCount(m.GetCount()) + s.SetClause(ClauseFromGRPCMessage(m.GetClause())) s.SetFilter(m.GetFilter()) s.SetAttribute(m.GetAttribute()) @@ -160,6 +162,14 @@ func PlacementPolicyFromGRPCMessage(m *netmap.PlacementPolicy) *PlacementPolicy return p } +func ClauseToGRPCMessage(n Clause) netmap.Clause { + return netmap.Clause(n) +} + +func ClauseFromGRPCMessage(n netmap.Clause) Clause { + return Clause(n) +} + func OperationToGRPCMessage(n Operation) netmap.Operation { return netmap.Operation(n) } diff --git a/v2/netmap/grpc/types.go b/v2/netmap/grpc/types.go index a912cb2..e478d98 100644 --- a/v2/netmap/grpc/types.go +++ b/v2/netmap/grpc/types.go @@ -92,6 +92,13 @@ func (m *Selector) SetFilter(v string) { } } +// SetClause of placement selector. +func (m *Selector) SetClause(v Clause) { + if m != nil { + m.Clause = v + } +} + // SetCount of object replica. func (m *Replica) SetCount(v uint32) { if m != nil { diff --git a/v2/netmap/grpc/types.pb.go b/v2/netmap/grpc/types.pb.go index 5b0376f..a16be67 100644 --- a/v2/netmap/grpc/types.pb.go +++ b/v2/netmap/grpc/types.pb.go @@ -78,6 +78,40 @@ func (Operation) EnumDescriptor() ([]byte, []int) { return fileDescriptor_91a1332b2376641a, []int{0} } +// Selector modifier showing how the node set will be formed +// By default selector just groups by attribute into a bucket selecting nodes +// only by their hash distance. +type Clause int32 + +const ( + // No modifier defined. Will select nodes from bucket randomly. + Clause_CLAUSE_UNSPECIFIED Clause = 0 + // SAME will select only nodes having the same value of bucket attribute + Clause_SAME Clause = 1 + // DISTINCT will select nodes having different values of bucket attribute + Clause_DISTINCT Clause = 2 +) + +var Clause_name = map[int32]string{ + 0: "CLAUSE_UNSPECIFIED", + 1: "SAME", + 2: "DISTINCT", +} + +var Clause_value = map[string]int32{ + "CLAUSE_UNSPECIFIED": 0, + "SAME": 1, + "DISTINCT": 2, +} + +func (x Clause) String() string { + return proto.EnumName(Clause_name, int32(x)) +} + +func (Clause) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_91a1332b2376641a, []int{1} +} + // Represents the enumeration of various states of the NeoFS node. type NodeInfo_State int32 @@ -204,10 +238,12 @@ type Selector struct { Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` // How many nodes to select from bucket Count uint32 `protobuf:"varint,2,opt,name=count,proto3" json:"count,omitempty"` + // Selector modifier showing how to form a bucket + Clause Clause `protobuf:"varint,3,opt,name=clause,proto3,enum=neo.fs.v2.netmap.Clause" json:"clause,omitempty"` // Attribute bucket to select from - Attribute string `protobuf:"bytes,3,opt,name=attribute,proto3" json:"attribute,omitempty"` + Attribute string `protobuf:"bytes,4,opt,name=attribute,proto3" json:"attribute,omitempty"` // Filter reference to select from - Filter string `protobuf:"bytes,4,opt,name=filter,proto3" json:"filter,omitempty"` + Filter string `protobuf:"bytes,5,opt,name=filter,proto3" json:"filter,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -260,6 +296,13 @@ func (m *Selector) GetCount() uint32 { return 0 } +func (m *Selector) GetClause() Clause { + if m != nil { + return m.Clause + } + return Clause_CLAUSE_UNSPECIFIED +} + func (m *Selector) GetAttribute() string { if m != nil { return m.Attribute @@ -555,6 +598,7 @@ func (m *NodeInfo_Attribute) GetParents() []string { func init() { proto.RegisterEnum("neo.fs.v2.netmap.Operation", Operation_name, Operation_value) + proto.RegisterEnum("neo.fs.v2.netmap.Clause", Clause_name, Clause_value) proto.RegisterEnum("neo.fs.v2.netmap.NodeInfo_State", NodeInfo_State_name, NodeInfo_State_value) proto.RegisterType((*Filter)(nil), "neo.fs.v2.netmap.Filter") proto.RegisterType((*Selector)(nil), "neo.fs.v2.netmap.Selector") @@ -567,47 +611,50 @@ func init() { func init() { proto.RegisterFile("v2/netmap/grpc/types.proto", fileDescriptor_91a1332b2376641a) } var fileDescriptor_91a1332b2376641a = []byte{ - // 635 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x54, 0xcd, 0x6e, 0xd3, 0x40, - 0x10, 0xee, 0x3a, 0xbf, 0x9e, 0xd2, 0xd6, 0x5a, 0x5a, 0x70, 0x03, 0x44, 0x51, 0xc4, 0xa1, 0x02, - 0xd5, 0x11, 0x41, 0x14, 0xa4, 0x9e, 0x52, 0xea, 0xa0, 0x88, 0xe2, 0x84, 0x4d, 0xb9, 0x70, 0x89, - 0x36, 0xce, 0x26, 0x98, 0x3a, 0xde, 0x95, 0xbd, 0x89, 0x94, 0x37, 0xe1, 0x05, 0xb8, 0xf0, 0x1a, - 0x5c, 0x38, 0xf2, 0x08, 0xa8, 0xdc, 0x79, 0x06, 0xe4, 0x75, 0xec, 0xa4, 0x04, 0x21, 0x4e, 0xb3, - 0x33, 0xfb, 0xf9, 0xfb, 0xbe, 0x9d, 0x1d, 0x2f, 0x54, 0xe6, 0xcd, 0x46, 0xc0, 0xe4, 0x94, 0x8a, - 0xc6, 0x24, 0x14, 0x6e, 0x43, 0x2e, 0x04, 0x8b, 0x2c, 0x11, 0x72, 0xc9, 0xb1, 0x11, 0x30, 0x6e, - 0x8d, 0x23, 0x6b, 0xde, 0xb4, 0x12, 0x48, 0xfd, 0x33, 0x82, 0x62, 0xdb, 0xf3, 0x25, 0x0b, 0x31, - 0x86, 0x7c, 0x40, 0xa7, 0xcc, 0x44, 0x35, 0x74, 0xa4, 0x13, 0xb5, 0xc6, 0x06, 0xe4, 0xae, 0xd8, - 0xc2, 0xd4, 0x54, 0x29, 0x5e, 0xe2, 0xc7, 0xa0, 0x71, 0x61, 0xe6, 0x6a, 0xe8, 0x68, 0xb7, 0x79, - 0xcf, 0xfa, 0x93, 0xcf, 0xea, 0x0a, 0x16, 0x52, 0xe9, 0xf1, 0x80, 0x68, 0x5c, 0xe0, 0x7d, 0x28, - 0xcc, 0xa9, 0x3f, 0x63, 0x66, 0x5e, 0x11, 0x24, 0x09, 0x6e, 0x42, 0x69, 0xac, 0x24, 0x23, 0xb3, - 0x50, 0xcb, 0x1d, 0x6d, 0x37, 0xcd, 0x4d, 0x9e, 0xc4, 0x13, 0x49, 0x81, 0xf5, 0x8f, 0x50, 0xee, - 0x33, 0x9f, 0xb9, 0x92, 0xff, 0xdd, 0xe8, 0x3e, 0x14, 0x5c, 0x3e, 0x0b, 0xa4, 0xb2, 0xba, 0x43, - 0x92, 0x04, 0xdf, 0x07, 0x9d, 0x4a, 0x19, 0x7a, 0xc3, 0x99, 0x64, 0xca, 0xb3, 0x4e, 0x56, 0x05, - 0x7c, 0x07, 0x8a, 0x09, 0xfd, 0xd2, 0xde, 0x32, 0xab, 0x9f, 0x42, 0x89, 0x30, 0xe1, 0x7b, 0x2e, - 0x5d, 0xd1, 0xa2, 0x75, 0xda, 0x0a, 0x94, 0xa3, 0xa5, 0x99, 0x65, 0x6b, 0xb2, 0xbc, 0xfe, 0x0b, - 0xc1, 0x5e, 0xcf, 0xa7, 0x2e, 0x9b, 0xb2, 0x40, 0xf6, 0xb8, 0xef, 0xb9, 0x0b, 0xfc, 0x0c, 0xca, - 0x61, 0x42, 0x18, 0x99, 0x48, 0x9d, 0xf8, 0x70, 0xf3, 0xc4, 0x4b, 0x49, 0x92, 0x41, 0xf1, 0x09, - 0xdc, 0x75, 0x79, 0x20, 0xa9, 0x17, 0xb0, 0x70, 0x30, 0xa4, 0xee, 0xd5, 0x4c, 0x0c, 0xc6, 0x34, - 0x53, 0xdd, 0x21, 0x07, 0xd9, 0xf6, 0x99, 0xda, 0x6d, 0xab, 0x4d, 0xfc, 0x02, 0xf4, 0xd4, 0x4e, - 0x64, 0xe6, 0x94, 0x5e, 0x65, 0x53, 0x2f, 0x6d, 0x27, 0x59, 0x81, 0xd7, 0x6f, 0x26, 0xff, 0xbf, - 0x37, 0xf3, 0x55, 0x83, 0xb2, 0xc3, 0x47, 0xac, 0x13, 0x8c, 0x39, 0x7e, 0x00, 0x20, 0x66, 0x43, - 0xdf, 0x73, 0x07, 0xf1, 0xd8, 0xc4, 0x4d, 0xbb, 0x45, 0xf4, 0xa4, 0xf2, 0x9a, 0x2d, 0xb0, 0x09, - 0x25, 0x3a, 0x1a, 0x85, 0x2c, 0x8a, 0x96, 0x7d, 0x4b, 0x53, 0x7c, 0x0e, 0x90, 0x5d, 0x4c, 0x6a, - 0xfa, 0xe1, 0xa6, 0x78, 0x2a, 0x64, 0xb5, 0x52, 0x30, 0x59, 0xfb, 0x0e, 0x9f, 0x40, 0x21, 0x92, - 0x54, 0x26, 0xf3, 0xb6, 0xdb, 0xac, 0xfd, 0x83, 0xa0, 0x1f, 0xe3, 0x48, 0x02, 0xaf, 0xbc, 0x01, - 0x3d, 0x23, 0x4c, 0x67, 0x1e, 0xad, 0x66, 0x3e, 0x1b, 0x63, 0x6d, 0x7d, 0x8c, 0x4d, 0x28, 0x09, - 0x1a, 0xb2, 0x40, 0x26, 0x7e, 0x75, 0x92, 0xa6, 0xf5, 0x27, 0x50, 0x50, 0xf4, 0x78, 0x0f, 0xb6, - 0xdf, 0x39, 0xfd, 0x9e, 0xfd, 0xb2, 0xd3, 0xee, 0xd8, 0xe7, 0xc6, 0x16, 0x06, 0x28, 0x76, 0x9d, - 0x8b, 0x8e, 0x63, 0x1b, 0x08, 0x6f, 0x43, 0xa9, 0xdb, 0x6e, 0xab, 0x44, 0x7b, 0x34, 0x01, 0x3d, - 0xfb, 0x75, 0xf0, 0x21, 0x1c, 0x74, 0x7b, 0x36, 0x69, 0x5d, 0x76, 0xba, 0xce, 0xe0, 0x26, 0x41, - 0x11, 0x34, 0xfb, 0xad, 0x81, 0xe2, 0x18, 0x7f, 0x17, 0xc7, 0x57, 0x97, 0x46, 0x4e, 0x45, 0xdb, - 0xc8, 0xc7, 0xf1, 0xe2, 0xd2, 0x28, 0xa8, 0x68, 0x1b, 0xc5, 0x38, 0x76, 0x89, 0x51, 0xc2, 0x25, - 0xc8, 0xb5, 0x9c, 0x73, 0xa3, 0x7c, 0x36, 0xf8, 0x76, 0x5d, 0x45, 0xdf, 0xaf, 0xab, 0xe8, 0xc7, - 0x75, 0x15, 0x7d, 0xfa, 0x59, 0xdd, 0x7a, 0xff, 0x7c, 0xe2, 0xc9, 0x0f, 0xb3, 0xa1, 0xe5, 0xf2, - 0x69, 0x23, 0x88, 0x84, 0xeb, 0x1e, 0x8f, 0xd8, 0xbc, 0x11, 0x30, 0x3e, 0x8e, 0x8e, 0xa9, 0xf0, - 0x8e, 0x27, 0xbc, 0x71, 0xf3, 0x49, 0x39, 0x4d, 0xd6, 0x5f, 0xb4, 0xdb, 0x0e, 0xe3, 0xed, 0xbe, - 0xd5, 0xea, 0x75, 0xe2, 0x0e, 0x3b, 0xaa, 0x3a, 0x2c, 0xaa, 0xa7, 0xe6, 0xe9, 0xef, 0x00, 0x00, - 0x00, 0xff, 0xff, 0x04, 0x93, 0x38, 0x2a, 0x88, 0x04, 0x00, 0x00, + // 686 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x54, 0xcd, 0x6e, 0xda, 0x40, + 0x10, 0x8e, 0x0d, 0x18, 0x98, 0xfc, 0x59, 0xdb, 0x24, 0x75, 0x68, 0x8b, 0x10, 0xea, 0x21, 0x4a, + 0x15, 0xd3, 0x52, 0x35, 0x8d, 0x94, 0x13, 0x01, 0x53, 0x59, 0x4d, 0x0c, 0x35, 0xe4, 0xd2, 0x0b, + 0x5a, 0xcc, 0x42, 0xad, 0x18, 0xaf, 0x65, 0x2f, 0x48, 0xbc, 0x49, 0x0f, 0xbd, 0xf6, 0xd2, 0xd7, + 0xe8, 0xa5, 0xc7, 0x3e, 0x42, 0x95, 0xde, 0xfb, 0x0c, 0x95, 0xd7, 0x3f, 0x90, 0x10, 0x55, 0x3d, + 0xcd, 0xce, 0xce, 0xe7, 0xef, 0xfb, 0x34, 0xb3, 0x63, 0x28, 0xcd, 0xeb, 0x35, 0x97, 0xb0, 0x29, + 0xf6, 0x6a, 0x13, 0xdf, 0xb3, 0x6a, 0x6c, 0xe1, 0x91, 0x40, 0xf5, 0x7c, 0xca, 0x28, 0x92, 0x5d, + 0x42, 0xd5, 0x71, 0xa0, 0xce, 0xeb, 0x6a, 0x04, 0xa9, 0x7e, 0x15, 0x40, 0x6a, 0xdb, 0x0e, 0x23, + 0x3e, 0x42, 0x90, 0x75, 0xf1, 0x94, 0x28, 0x42, 0x45, 0x38, 0x2a, 0x9a, 0xfc, 0x8c, 0x64, 0xc8, + 0xdc, 0x90, 0x85, 0x22, 0xf2, 0xab, 0xf0, 0x88, 0x5e, 0x80, 0x48, 0x3d, 0x25, 0x53, 0x11, 0x8e, + 0x76, 0xea, 0x4f, 0xd4, 0xfb, 0x7c, 0x6a, 0xc7, 0x23, 0x3e, 0x66, 0x36, 0x75, 0x4d, 0x91, 0x7a, + 0x68, 0x0f, 0x72, 0x73, 0xec, 0xcc, 0x88, 0x92, 0xe5, 0x04, 0x51, 0x82, 0xea, 0x90, 0x1f, 0x73, + 0xc9, 0x40, 0xc9, 0x55, 0x32, 0x47, 0x9b, 0x75, 0x65, 0x9d, 0x27, 0xf2, 0x64, 0x26, 0xc0, 0xea, + 0x17, 0x01, 0x0a, 0x3d, 0xe2, 0x10, 0x8b, 0xd1, 0x87, 0x9d, 0xee, 0x41, 0xce, 0xa2, 0x33, 0x97, + 0x71, 0xaf, 0xdb, 0x66, 0x94, 0xa0, 0x97, 0x20, 0x59, 0x0e, 0x9e, 0x05, 0x24, 0x76, 0xfc, 0x80, + 0x52, 0x93, 0xd7, 0xcd, 0x18, 0x87, 0x9e, 0x42, 0x11, 0x33, 0xe6, 0xdb, 0xc3, 0x19, 0x4b, 0x6c, + 0x2f, 0x2f, 0xd0, 0x01, 0x48, 0x91, 0x23, 0x25, 0xc7, 0x4b, 0x71, 0x56, 0x3d, 0x87, 0xbc, 0x49, + 0x3c, 0xc7, 0xb6, 0xf0, 0xd2, 0x88, 0xb0, 0x6a, 0xa4, 0x04, 0x85, 0x20, 0xb6, 0x1f, 0x77, 0x33, + 0xcd, 0xab, 0x7f, 0x04, 0xd8, 0xed, 0x3a, 0xd8, 0x22, 0x53, 0xe2, 0xb2, 0x2e, 0x75, 0x6c, 0x6b, + 0x81, 0xde, 0x40, 0xc1, 0x8f, 0x08, 0x03, 0x45, 0xe0, 0x4d, 0x3a, 0x5c, 0xb7, 0x1e, 0x4b, 0x9a, + 0x29, 0x14, 0x9d, 0xc2, 0x63, 0x8b, 0xba, 0x0c, 0xdb, 0x2e, 0xf1, 0x07, 0x43, 0x6c, 0xdd, 0xcc, + 0xbc, 0xc1, 0x18, 0xa7, 0xaa, 0xdb, 0xe6, 0x7e, 0x5a, 0xbe, 0xe0, 0xd5, 0x36, 0x2f, 0xa2, 0x33, + 0x28, 0x26, 0x76, 0x02, 0x25, 0xc3, 0xf5, 0x4a, 0xeb, 0x7a, 0xc9, 0x00, 0xcc, 0x25, 0x78, 0x75, + 0x98, 0xd9, 0xff, 0x1d, 0xe6, 0x77, 0x11, 0x0a, 0x06, 0x1d, 0x11, 0xdd, 0x1d, 0x53, 0xf4, 0x0c, + 0xc0, 0x9b, 0x0d, 0x1d, 0xdb, 0x1a, 0x84, 0x2f, 0x2d, 0x6c, 0xda, 0x96, 0x59, 0x8c, 0x6e, 0xde, + 0x93, 0x05, 0x52, 0x20, 0x8f, 0x47, 0x23, 0x9f, 0x04, 0x41, 0xdc, 0xb7, 0x24, 0x45, 0x2d, 0x80, + 0x74, 0x30, 0x89, 0xe9, 0xe7, 0xeb, 0xe2, 0x89, 0x90, 0xda, 0x48, 0xc0, 0xe6, 0xca, 0x77, 0xe8, + 0x14, 0x72, 0x01, 0xc3, 0xf1, 0xac, 0x77, 0xea, 0x95, 0x7f, 0x10, 0xf4, 0x42, 0x9c, 0x19, 0xc1, + 0x4b, 0x57, 0x50, 0x4c, 0x09, 0x93, 0x35, 0x11, 0x96, 0x6b, 0x92, 0xbe, 0x7c, 0x71, 0xf5, 0xe5, + 0x2b, 0x90, 0xf7, 0xb0, 0x4f, 0x5c, 0x16, 0xf9, 0x2d, 0x9a, 0x49, 0x5a, 0x7d, 0x05, 0x39, 0x4e, + 0x8f, 0x76, 0x61, 0xf3, 0xda, 0xe8, 0x75, 0xb5, 0xa6, 0xde, 0xd6, 0xb5, 0x96, 0xbc, 0x81, 0x00, + 0xa4, 0x8e, 0x71, 0xa9, 0x1b, 0x9a, 0x2c, 0xa0, 0x4d, 0xc8, 0x77, 0xda, 0x6d, 0x9e, 0x88, 0xc7, + 0x13, 0x28, 0xa6, 0xdb, 0x86, 0x0e, 0x61, 0xbf, 0xd3, 0xd5, 0xcc, 0x46, 0x5f, 0xef, 0x18, 0x83, + 0xbb, 0x04, 0x12, 0x88, 0xda, 0x07, 0x59, 0x08, 0x63, 0xf8, 0x5d, 0x18, 0xdf, 0xf5, 0xe5, 0x0c, + 0x8f, 0x9a, 0x9c, 0x0d, 0xe3, 0x65, 0x5f, 0xce, 0xf1, 0xa8, 0xc9, 0x52, 0x18, 0x3b, 0xa6, 0x9c, + 0x47, 0x79, 0xc8, 0x34, 0x8c, 0x96, 0x5c, 0x38, 0x3e, 0x03, 0x29, 0x5a, 0x12, 0x74, 0x00, 0xa8, + 0x79, 0xd9, 0xb8, 0xee, 0x69, 0xf7, 0x24, 0x0a, 0x90, 0xed, 0x35, 0xae, 0x42, 0x87, 0x5b, 0x50, + 0x68, 0xe9, 0xbd, 0xbe, 0x6e, 0x34, 0xfb, 0xb2, 0x78, 0x31, 0xf8, 0x71, 0x5b, 0x16, 0x7e, 0xde, + 0x96, 0x85, 0x5f, 0xb7, 0x65, 0xe1, 0xf3, 0xef, 0xf2, 0xc6, 0xc7, 0xb7, 0x13, 0x9b, 0x7d, 0x9a, + 0x0d, 0x55, 0x8b, 0x4e, 0x6b, 0x6e, 0xe0, 0x59, 0xd6, 0xc9, 0x88, 0xcc, 0x6b, 0x2e, 0xa1, 0xe3, + 0xe0, 0x04, 0x7b, 0xf6, 0xc9, 0x84, 0xd6, 0xee, 0xfe, 0xbf, 0xce, 0xa3, 0xf3, 0x37, 0xf1, 0x91, + 0x41, 0x68, 0xbb, 0xa7, 0x36, 0xba, 0x7a, 0x38, 0x1b, 0x83, 0xdf, 0x0e, 0x25, 0xfe, 0x5f, 0x7b, + 0xfd, 0x37, 0x00, 0x00, 0xff, 0xff, 0xcc, 0x69, 0xba, 0x7f, 0xf5, 0x04, 0x00, 0x00, } func (m *Filter) Marshal() (dAtA []byte, err error) { @@ -706,14 +753,19 @@ func (m *Selector) MarshalToSizedBuffer(dAtA []byte) (int, error) { copy(dAtA[i:], m.Filter) i = encodeVarintTypes(dAtA, i, uint64(len(m.Filter))) i-- - dAtA[i] = 0x22 + dAtA[i] = 0x2a } if len(m.Attribute) > 0 { i -= len(m.Attribute) copy(dAtA[i:], m.Attribute) i = encodeVarintTypes(dAtA, i, uint64(len(m.Attribute))) i-- - dAtA[i] = 0x1a + dAtA[i] = 0x22 + } + if m.Clause != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Clause)) + i-- + dAtA[i] = 0x18 } if m.Count != 0 { i = encodeVarintTypes(dAtA, i, uint64(m.Count)) @@ -1010,6 +1062,9 @@ func (m *Selector) Size() (n int) { if m.Count != 0 { n += 1 + sovTypes(uint64(m.Count)) } + if m.Clause != 0 { + n += 1 + sovTypes(uint64(m.Clause)) + } l = len(m.Attribute) if l > 0 { n += 1 + l + sovTypes(uint64(l)) @@ -1421,6 +1476,25 @@ func (m *Selector) Unmarshal(dAtA []byte) error { } } case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Clause", wireType) + } + m.Clause = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Clause |= Clause(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Attribute", wireType) } @@ -1452,7 +1526,7 @@ func (m *Selector) Unmarshal(dAtA []byte) error { } m.Attribute = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 4: + case 5: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Filter", wireType) } diff --git a/v2/netmap/marshal.go b/v2/netmap/marshal.go index a38d8a2..2fada3e 100644 --- a/v2/netmap/marshal.go +++ b/v2/netmap/marshal.go @@ -13,8 +13,9 @@ const ( nameSelectorField = 1 countSelectorField = 2 - attributeSelectorField = 3 - filterSelectorField = 4 + clauseSelectorField = 3 + attributeSelectorField = 4 + filterSelectorField = 5 countReplicaField = 1 selectorReplicaField = 2 @@ -128,6 +129,13 @@ func (s *Selector) StableMarshal(buf []byte) ([]byte, error) { offset += n + n, err = proto.EnumMarshal(clauseSelectorField, buf[offset:], int32(s.clause)) + if err != nil { + return nil, err + } + + offset += n + n, err = proto.StringMarshal(attributeSelectorField, buf[offset:], s.attribute) if err != nil { return nil, err @@ -146,6 +154,7 @@ func (s *Selector) StableMarshal(buf []byte) ([]byte, error) { func (s *Selector) StableSize() (size int) { size += proto.StringSize(nameSelectorField, s.name) size += proto.UInt32Size(countSelectorField, s.count) + size += proto.EnumSize(countSelectorField, int32(s.clause)) size += proto.StringSize(attributeSelectorField, s.attribute) size += proto.StringSize(filterSelectorField, s.filter) diff --git a/v2/netmap/marshal_test.go b/v2/netmap/marshal_test.go index 7178a20..5a4ce6c 100644 --- a/v2/netmap/marshal_test.go +++ b/v2/netmap/marshal_test.go @@ -151,6 +151,7 @@ func generateSelector(name string) *netmap.Selector { s := new(netmap.Selector) s.SetName(name) s.SetAttribute("attribute") + s.SetClause(netmap.Distinct) s.SetCount(10) s.SetFilter("filter") diff --git a/v2/netmap/types.go b/v2/netmap/types.go index c16fa50..b91d6e5 100644 --- a/v2/netmap/types.go +++ b/v2/netmap/types.go @@ -11,6 +11,7 @@ type Filter struct { type Selector struct { name string count uint32 + clause Clause attribute string filter string } @@ -47,6 +48,9 @@ type NodeInfo struct { // NodeState of storage node. type NodeState uint32 +// Clause of placement selector. +type Clause uint32 + const ( UnspecifiedState NodeState = iota Online @@ -65,6 +69,12 @@ const ( AND ) +const ( + UnspecifiedClause Clause = iota + Same + Distinct +) + func (f *Filter) GetFilters() []*Filter { if f != nil { return f.filters @@ -162,6 +172,20 @@ func (s *Selector) SetAttribute(attribute string) { } } +func (s *Selector) GetClause() Clause { + if s != nil { + return s.clause + } + + return UnspecifiedClause +} + +func (s *Selector) SetClause(clause Clause) { + if s != nil { + s.clause = clause + } +} + func (s *Selector) GetCount() uint32 { if s != nil { return s.count From 581cb2d2bac3356bc39ca840497c141169dc490f Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Tue, 8 Sep 2020 13:39:13 +0300 Subject: [PATCH 0395/1196] [#138] v2/object: Update to neofs-api jindo release Signed-off-by: Alex Vanin --- v2/object/convert.go | 44 +++- v2/object/grpc/service.go | 22 +- v2/object/grpc/service.pb.go | 460 +++++++++++++++++++++++++++-------- v2/object/marshal.go | 45 ++++ v2/object/marshal_test.go | 6 +- v2/object/types.go | 40 ++- 6 files changed, 505 insertions(+), 112 deletions(-) diff --git a/v2/object/convert.go b/v2/object/convert.go index 7beb640..a18d43f 100644 --- a/v2/object/convert.go +++ b/v2/object/convert.go @@ -283,6 +283,42 @@ func HeaderFromGRPCMessage(m *object.Header) *Header { return h } +func HeaderWithSignatureToGRPCMessage(h *HeaderWithSignature) *object.HeaderWithSignature { + if h == nil { + return nil + } + + m := new(object.HeaderWithSignature) + + m.SetHeader( + HeaderToGRPCMessage(h.GetHeader()), + ) + + m.SetSignature( + refs.SignatureToGRPCMessage(h.GetSignature()), + ) + + return m +} + +func HeaderWithSignatureFromGRPCMessage(m *object.HeaderWithSignature) *HeaderWithSignature { + if m == nil { + return nil + } + + h := new(HeaderWithSignature) + + h.SetHeader( + HeaderFromGRPCMessage(m.GetHeader()), + ) + + h.SetSignature( + refs.SignatureFromGRPCMessage(m.GetSignature()), + ) + + return h +} + func ObjectToGRPCMessage(o *Object) *object.Object { if o == nil { return nil @@ -942,8 +978,8 @@ func GetHeaderPartFullToGRPCMessage(r *GetHeaderPartFull) *object.HeadResponse_B m := new(object.HeadResponse_Body_Header) - m.SetHeader( - HeaderToGRPCMessage(r.GetHeader()), + m.SetHeaderWithSignature( + HeaderWithSignatureToGRPCMessage(r.GetHeaderWithSignature()), ) return m @@ -956,8 +992,8 @@ func GetHeaderPartFullFromGRPCMessage(m *object.HeadResponse_Body_Header) *GetHe r := new(GetHeaderPartFull) - r.SetHeader( - HeaderFromGRPCMessage(m.GetHeader()), + r.SetHeaderWithSignature( + HeaderWithSignatureFromGRPCMessage(m.GetHeaderWithSignature()), ) return r diff --git a/v2/object/grpc/service.go b/v2/object/grpc/service.go index 515d3e8..025af1c 100644 --- a/v2/object/grpc/service.go +++ b/v2/object/grpc/service.go @@ -330,8 +330,8 @@ func (m *HeadResponse_Body_ShortHeader) SetShortHeader(v *ShortHeader) { } } -// GetHeader returns object header. -func (m *HeadResponse_Body_Header) GetHeader() *Header { +// GetHeaderWithSignature returns object header. +func (m *HeadResponse_Body_Header) GetHeaderWithSignature() *HeaderWithSignature { if m != nil { return m.Header } @@ -339,13 +339,27 @@ func (m *HeadResponse_Body_Header) GetHeader() *Header { return nil } -// SetHeader sets object header. -func (m *HeadResponse_Body_Header) SetHeader(v *Header) { +// SetHeaderWithSignature sets object header. +func (m *HeadResponse_Body_Header) SetHeaderWithSignature(v *HeaderWithSignature) { if m != nil { m.Header = v } } +// SetHeader sets object header. +func (m *HeaderWithSignature) SetHeader(v *Header) { + if m != nil { + m.Header = v + } +} + +// SetSignature of the header. +func (m *HeaderWithSignature) SetSignature(v *refs.Signature) { + if m != nil { + m.Signature = v + } +} + // SetHeader sets full header of the object. func (m *HeadResponse_Body) SetHeader(v *HeadResponse_Body_Header) { if m != nil { diff --git a/v2/object/grpc/service.pb.go b/v2/object/grpc/service.pb.go index 2c8fc74..46462c6 100644 --- a/v2/object/grpc/service.pb.go +++ b/v2/object/grpc/service.pb.go @@ -1110,6 +1110,67 @@ func (m *HeadRequest_Body) GetRaw() bool { return false } +// Tuple of full object header and signature of object ID. +type HeaderWithSignature struct { + // Full object header + Header *Header `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + // Signed object_id to verify full header's authenticity through following steps: + // 1. Calculate SHA-256 of marshalled Headers structure. + // 2. Check if the resulting hash matched ObjectID + // 3. Check if ObjectID's signature in signature field is correct. + Signature *grpc1.Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *HeaderWithSignature) Reset() { *m = HeaderWithSignature{} } +func (m *HeaderWithSignature) String() string { return proto.CompactTextString(m) } +func (*HeaderWithSignature) ProtoMessage() {} +func (*HeaderWithSignature) Descriptor() ([]byte, []int) { + return fileDescriptor_1d7d92b1e85e5b48, []int{7} +} +func (m *HeaderWithSignature) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *HeaderWithSignature) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_HeaderWithSignature.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *HeaderWithSignature) XXX_Merge(src proto.Message) { + xxx_messageInfo_HeaderWithSignature.Merge(m, src) +} +func (m *HeaderWithSignature) XXX_Size() int { + return m.Size() +} +func (m *HeaderWithSignature) XXX_DiscardUnknown() { + xxx_messageInfo_HeaderWithSignature.DiscardUnknown(m) +} + +var xxx_messageInfo_HeaderWithSignature proto.InternalMessageInfo + +func (m *HeaderWithSignature) GetHeader() *Header { + if m != nil { + return m.Header + } + return nil +} + +func (m *HeaderWithSignature) GetSignature() *grpc1.Signature { + if m != nil { + return m.Signature + } + return nil +} + // Head response type HeadResponse struct { // Body of head object response message. @@ -1130,7 +1191,7 @@ func (m *HeadResponse) Reset() { *m = HeadResponse{} } func (m *HeadResponse) String() string { return proto.CompactTextString(m) } func (*HeadResponse) ProtoMessage() {} func (*HeadResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_1d7d92b1e85e5b48, []int{7} + return fileDescriptor_1d7d92b1e85e5b48, []int{8} } func (m *HeadResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1197,7 +1258,7 @@ func (m *HeadResponse_Body) Reset() { *m = HeadResponse_Body{} } func (m *HeadResponse_Body) String() string { return proto.CompactTextString(m) } func (*HeadResponse_Body) ProtoMessage() {} func (*HeadResponse_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_1d7d92b1e85e5b48, []int{7, 0} + return fileDescriptor_1d7d92b1e85e5b48, []int{8, 0} } func (m *HeadResponse_Body) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1233,7 +1294,7 @@ type isHeadResponse_Body_Head interface { } type HeadResponse_Body_Header struct { - Header *Header `protobuf:"bytes,1,opt,name=header,proto3,oneof" json:"header,omitempty"` + Header *HeaderWithSignature `protobuf:"bytes,1,opt,name=header,proto3,oneof" json:"header,omitempty"` } type HeadResponse_Body_ShortHeader struct { ShortHeader *ShortHeader `protobuf:"bytes,2,opt,name=short_header,json=shortHeader,proto3,oneof" json:"short_header,omitempty"` @@ -1249,7 +1310,7 @@ func (m *HeadResponse_Body) GetHead() isHeadResponse_Body_Head { return nil } -func (m *HeadResponse_Body) GetHeader() *Header { +func (m *HeadResponse_Body) GetHeader() *HeaderWithSignature { if x, ok := m.GetHead().(*HeadResponse_Body_Header); ok { return x.Header } @@ -1290,7 +1351,7 @@ func (m *SearchRequest) Reset() { *m = SearchRequest{} } func (m *SearchRequest) String() string { return proto.CompactTextString(m) } func (*SearchRequest) ProtoMessage() {} func (*SearchRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_1d7d92b1e85e5b48, []int{8} + return fileDescriptor_1d7d92b1e85e5b48, []int{9} } func (m *SearchRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1357,7 +1418,7 @@ func (m *SearchRequest_Body) Reset() { *m = SearchRequest_Body{} } func (m *SearchRequest_Body) String() string { return proto.CompactTextString(m) } func (*SearchRequest_Body) ProtoMessage() {} func (*SearchRequest_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_1d7d92b1e85e5b48, []int{8, 0} + return fileDescriptor_1d7d92b1e85e5b48, []int{9, 0} } func (m *SearchRequest_Body) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1424,7 +1485,7 @@ func (m *SearchRequest_Body_Filter) Reset() { *m = SearchRequest_Body_Fi func (m *SearchRequest_Body_Filter) String() string { return proto.CompactTextString(m) } func (*SearchRequest_Body_Filter) ProtoMessage() {} func (*SearchRequest_Body_Filter) Descriptor() ([]byte, []int) { - return fileDescriptor_1d7d92b1e85e5b48, []int{8, 0, 0} + return fileDescriptor_1d7d92b1e85e5b48, []int{9, 0, 0} } func (m *SearchRequest_Body_Filter) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1494,7 +1555,7 @@ func (m *SearchResponse) Reset() { *m = SearchResponse{} } func (m *SearchResponse) String() string { return proto.CompactTextString(m) } func (*SearchResponse) ProtoMessage() {} func (*SearchResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_1d7d92b1e85e5b48, []int{9} + return fileDescriptor_1d7d92b1e85e5b48, []int{10} } func (m *SearchResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1557,7 +1618,7 @@ func (m *SearchResponse_Body) Reset() { *m = SearchResponse_Body{} } func (m *SearchResponse_Body) String() string { return proto.CompactTextString(m) } func (*SearchResponse_Body) ProtoMessage() {} func (*SearchResponse_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_1d7d92b1e85e5b48, []int{9, 0} + return fileDescriptor_1d7d92b1e85e5b48, []int{10, 0} } func (m *SearchResponse_Body) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1608,7 +1669,7 @@ func (m *Range) Reset() { *m = Range{} } func (m *Range) String() string { return proto.CompactTextString(m) } func (*Range) ProtoMessage() {} func (*Range) Descriptor() ([]byte, []int) { - return fileDescriptor_1d7d92b1e85e5b48, []int{10} + return fileDescriptor_1d7d92b1e85e5b48, []int{11} } func (m *Range) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1670,7 +1731,7 @@ func (m *GetRangeRequest) Reset() { *m = GetRangeRequest{} } func (m *GetRangeRequest) String() string { return proto.CompactTextString(m) } func (*GetRangeRequest) ProtoMessage() {} func (*GetRangeRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_1d7d92b1e85e5b48, []int{11} + return fileDescriptor_1d7d92b1e85e5b48, []int{12} } func (m *GetRangeRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1735,7 +1796,7 @@ func (m *GetRangeRequest_Body) Reset() { *m = GetRangeRequest_Body{} } func (m *GetRangeRequest_Body) String() string { return proto.CompactTextString(m) } func (*GetRangeRequest_Body) ProtoMessage() {} func (*GetRangeRequest_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_1d7d92b1e85e5b48, []int{11, 0} + return fileDescriptor_1d7d92b1e85e5b48, []int{12, 0} } func (m *GetRangeRequest_Body) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1798,7 +1859,7 @@ func (m *GetRangeResponse) Reset() { *m = GetRangeResponse{} } func (m *GetRangeResponse) String() string { return proto.CompactTextString(m) } func (*GetRangeResponse) ProtoMessage() {} func (*GetRangeResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_1d7d92b1e85e5b48, []int{12} + return fileDescriptor_1d7d92b1e85e5b48, []int{13} } func (m *GetRangeResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1861,7 +1922,7 @@ func (m *GetRangeResponse_Body) Reset() { *m = GetRangeResponse_Body{} } func (m *GetRangeResponse_Body) String() string { return proto.CompactTextString(m) } func (*GetRangeResponse_Body) ProtoMessage() {} func (*GetRangeResponse_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_1d7d92b1e85e5b48, []int{12, 0} + return fileDescriptor_1d7d92b1e85e5b48, []int{13, 0} } func (m *GetRangeResponse_Body) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1916,7 +1977,7 @@ func (m *GetRangeHashRequest) Reset() { *m = GetRangeHashRequest{} } func (m *GetRangeHashRequest) String() string { return proto.CompactTextString(m) } func (*GetRangeHashRequest) ProtoMessage() {} func (*GetRangeHashRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_1d7d92b1e85e5b48, []int{13} + return fileDescriptor_1d7d92b1e85e5b48, []int{14} } func (m *GetRangeHashRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1985,7 +2046,7 @@ func (m *GetRangeHashRequest_Body) Reset() { *m = GetRangeHashRequest_Bo func (m *GetRangeHashRequest_Body) String() string { return proto.CompactTextString(m) } func (*GetRangeHashRequest_Body) ProtoMessage() {} func (*GetRangeHashRequest_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_1d7d92b1e85e5b48, []int{13, 0} + return fileDescriptor_1d7d92b1e85e5b48, []int{14, 0} } func (m *GetRangeHashRequest_Body) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -2062,7 +2123,7 @@ func (m *GetRangeHashResponse) Reset() { *m = GetRangeHashResponse{} } func (m *GetRangeHashResponse) String() string { return proto.CompactTextString(m) } func (*GetRangeHashResponse) ProtoMessage() {} func (*GetRangeHashResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_1d7d92b1e85e5b48, []int{14} + return fileDescriptor_1d7d92b1e85e5b48, []int{15} } func (m *GetRangeHashResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -2127,7 +2188,7 @@ func (m *GetRangeHashResponse_Body) Reset() { *m = GetRangeHashResponse_ func (m *GetRangeHashResponse_Body) String() string { return proto.CompactTextString(m) } func (*GetRangeHashResponse_Body) ProtoMessage() {} func (*GetRangeHashResponse_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_1d7d92b1e85e5b48, []int{14, 0} + return fileDescriptor_1d7d92b1e85e5b48, []int{15, 0} } func (m *GetRangeHashResponse_Body) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -2187,6 +2248,7 @@ func init() { proto.RegisterType((*DeleteResponse_Body)(nil), "neo.fs.v2.object.DeleteResponse.Body") proto.RegisterType((*HeadRequest)(nil), "neo.fs.v2.object.HeadRequest") proto.RegisterType((*HeadRequest_Body)(nil), "neo.fs.v2.object.HeadRequest.Body") + proto.RegisterType((*HeaderWithSignature)(nil), "neo.fs.v2.object.HeaderWithSignature") proto.RegisterType((*HeadResponse)(nil), "neo.fs.v2.object.HeadResponse") proto.RegisterType((*HeadResponse_Body)(nil), "neo.fs.v2.object.HeadResponse.Body") proto.RegisterType((*SearchRequest)(nil), "neo.fs.v2.object.SearchRequest") @@ -2208,87 +2270,88 @@ func init() { func init() { proto.RegisterFile("v2/object/grpc/service.proto", fileDescriptor_1d7d92b1e85e5b48) } var fileDescriptor_1d7d92b1e85e5b48 = []byte{ - // 1267 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x58, 0xdd, 0x6e, 0x1b, 0xc5, - 0x17, 0xcf, 0xae, 0x37, 0x6e, 0x7c, 0x6c, 0xe7, 0x1f, 0x4d, 0xa3, 0xd6, 0x7f, 0xe7, 0x83, 0x74, - 0xdb, 0xa4, 0x11, 0x25, 0xeb, 0x60, 0x54, 0x42, 0x5b, 0x5a, 0xd4, 0x90, 0xa4, 0xb1, 0x4a, 0xda, - 0xb0, 0x06, 0x2e, 0x90, 0x90, 0xb5, 0x59, 0x8f, 0xed, 0xa5, 0xf6, 0xae, 0xd9, 0x19, 0x1b, 0xf9, - 0x05, 0x90, 0x78, 0x02, 0x90, 0x90, 0x10, 0xea, 0x15, 0xea, 0x15, 0xe2, 0x96, 0x17, 0x00, 0x24, - 0x24, 0x78, 0x03, 0x14, 0x6e, 0x91, 0x78, 0x00, 0x84, 0x84, 0xe6, 0x63, 0x6d, 0xaf, 0xbf, 0x95, - 0xbb, 0xe5, 0x6e, 0x66, 0xf6, 0x77, 0xce, 0xce, 0xf9, 0xcd, 0x6f, 0xce, 0x9c, 0x19, 0x58, 0x6d, - 0xe7, 0x73, 0xde, 0xd9, 0xc7, 0xd8, 0xa6, 0xb9, 0xaa, 0xdf, 0xb4, 0x73, 0x04, 0xfb, 0x6d, 0xc7, - 0xc6, 0x46, 0xd3, 0xf7, 0xa8, 0x87, 0x96, 0x5c, 0xec, 0x19, 0x15, 0x62, 0xb4, 0xf3, 0x86, 0x00, - 0x65, 0xb3, 0x03, 0x78, 0xda, 0x69, 0x62, 0x22, 0xd0, 0xd9, 0x4c, 0x3b, 0x9f, 0xf3, 0x71, 0x85, - 0x0c, 0x7f, 0x59, 0x69, 0xe7, 0x73, 0x04, 0x13, 0xe2, 0x78, 0xee, 0xd0, 0x47, 0xfd, 0x85, 0x0a, - 0xf0, 0x08, 0x53, 0x13, 0x7f, 0xd2, 0xc2, 0x84, 0xa2, 0xdb, 0xa0, 0x9d, 0x79, 0xe5, 0x4e, 0x46, - 0xd9, 0x50, 0xb6, 0x93, 0xf9, 0x6b, 0xc6, 0xe0, 0x14, 0x8c, 0x1e, 0xd6, 0xd8, 0xf7, 0xca, 0x1d, - 0x93, 0xc3, 0xd1, 0x21, 0x24, 0x1b, 0x98, 0x5a, 0xa5, 0x1a, 0xb6, 0xca, 0xd8, 0xcf, 0xa8, 0xdc, - 0xfa, 0x46, 0x9f, 0xb5, 0xfc, 0xbf, 0x21, 0x6d, 0x4f, 0x30, 0xb5, 0x8e, 0x39, 0xd6, 0x84, 0x46, - 0xb7, 0x8d, 0xde, 0x85, 0x74, 0x1b, 0xfb, 0x4e, 0xa5, 0x13, 0x38, 0x8a, 0x71, 0x47, 0xaf, 0x8c, - 0x77, 0xf4, 0x01, 0x83, 0x3b, 0xb6, 0x45, 0x1d, 0xcf, 0x95, 0x0e, 0x53, 0xc2, 0x85, 0xe8, 0x65, - 0x1f, 0x83, 0xc6, 0xe6, 0x89, 0x5e, 0x85, 0x4b, 0x56, 0xb9, 0xec, 0x63, 0x42, 0x64, 0x6c, 0x57, - 0xfb, 0x9c, 0x32, 0xde, 0x8c, 0x87, 0xe2, 0xb3, 0x19, 0xe0, 0xd0, 0x12, 0xc4, 0x7c, 0xeb, 0x53, - 0x1e, 0xcc, 0x82, 0xc9, 0x9a, 0xfa, 0xdf, 0x31, 0x48, 0x72, 0x02, 0x48, 0xd3, 0x73, 0x09, 0x46, - 0xaf, 0x87, 0xd8, 0xd2, 0xc7, 0xb0, 0x25, 0xc0, 0xfd, 0x74, 0x1d, 0x8d, 0xa2, 0x6b, 0x73, 0x64, - 0x94, 0xc2, 0x78, 0x0c, 0x5f, 0xe6, 0x68, 0xbe, 0x76, 0x26, 0x78, 0x9a, 0x4a, 0xd8, 0x17, 0xaa, - 0x64, 0xec, 0x3e, 0x68, 0x8e, 0xeb, 0x50, 0x19, 0xdc, 0xcd, 0xe9, 0xc1, 0x19, 0x05, 0xd7, 0xa1, - 0xc7, 0x73, 0x26, 0x37, 0x43, 0x57, 0x60, 0xde, 0xae, 0xb5, 0xdc, 0x67, 0x3c, 0xba, 0xd4, 0xf1, - 0x9c, 0x29, 0xba, 0xd9, 0x6f, 0x15, 0xd0, 0x18, 0x10, 0xdd, 0x86, 0x84, 0x70, 0x54, 0x72, 0xca, - 0xf2, 0x27, 0x99, 0xc1, 0x35, 0x79, 0xca, 0x01, 0x85, 0x03, 0x73, 0x41, 0x40, 0x0b, 0x65, 0xb4, - 0x07, 0x09, 0xe2, 0x54, 0x5d, 0x8b, 0xb6, 0x7c, 0x2c, 0x99, 0xfb, 0xff, 0xa0, 0x59, 0x31, 0x00, - 0x98, 0x3d, 0x2c, 0xda, 0x85, 0x78, 0x88, 0xa5, 0xcc, 0x70, 0x44, 0x92, 0x10, 0x89, 0xdb, 0x4f, - 0x43, 0x52, 0xce, 0xb0, 0x69, 0xf9, 0x54, 0xff, 0x4a, 0x03, 0x38, 0x6d, 0xcd, 0xbe, 0x55, 0x7a, - 0xd8, 0x68, 0x6c, 0x95, 0x1f, 0x82, 0x95, 0x7f, 0x33, 0xb4, 0xf2, 0x5b, 0x53, 0x23, 0x9b, 0x6d, - 0xe1, 0x7f, 0x89, 0xcc, 0xc2, 0xa3, 0xeb, 0x90, 0xb6, 0xbd, 0xa6, 0x83, 0x49, 0xc9, 0x6d, 0x35, - 0xce, 0xb0, 0x9f, 0xd1, 0x36, 0x94, 0xed, 0xb4, 0x99, 0x12, 0x83, 0x4f, 0xf8, 0xd8, 0xa0, 0x3a, - 0xbe, 0x51, 0x21, 0xc9, 0x79, 0x99, 0x35, 0x37, 0xf4, 0x81, 0xa3, 0x92, 0x1b, 0xee, 0x4b, 0x81, - 0x5c, 0x6c, 0x05, 0xf5, 0xaf, 0x55, 0x48, 0x1f, 0xe0, 0x3a, 0xa6, 0x38, 0xd8, 0x43, 0x6f, 0x84, - 0x48, 0xba, 0x31, 0x4c, 0x52, 0x08, 0x1e, 0x8d, 0x6d, 0x74, 0xe7, 0xc2, 0x27, 0x8e, 0xfe, 0x97, - 0x02, 0x8b, 0x41, 0xc4, 0x52, 0x46, 0x77, 0x42, 0x0c, 0x6d, 0x8e, 0x67, 0x28, 0x5a, 0x4a, 0x8a, - 0x0b, 0x92, 0xf4, 0x9f, 0x54, 0x48, 0xb2, 0xa1, 0x40, 0x10, 0x53, 0x77, 0x4d, 0x1f, 0x38, 0x1a, - 0x72, 0xa8, 0x5d, 0xbc, 0x00, 0x59, 0x81, 0x44, 0xc3, 0x72, 0xdc, 0x92, 0xe7, 0xd6, 0x3b, 0xb2, - 0x0c, 0x59, 0x60, 0x03, 0x4f, 0xdd, 0x7a, 0x27, 0xa8, 0x4e, 0x62, 0xbd, 0xea, 0xe4, 0x4f, 0x15, - 0x52, 0x82, 0x1e, 0xa9, 0x9d, 0xbd, 0x10, 0x99, 0xd7, 0xc7, 0x91, 0x19, 0x2d, 0xe5, 0x7c, 0xa6, - 0x48, 0x42, 0xf3, 0xdd, 0xb4, 0xae, 0x4c, 0x4e, 0xeb, 0xc7, 0x73, 0xdd, 0xc4, 0xbe, 0x0f, 0x29, - 0x52, 0xf3, 0x7c, 0x1a, 0x8e, 0x6c, 0x6d, 0xd8, 0xb2, 0xc8, 0x50, 0x5d, 0xf3, 0x24, 0xe9, 0x75, - 0xf7, 0xe3, 0xa0, 0x31, 0x6b, 0xfd, 0x9f, 0x18, 0xa4, 0x8b, 0xd8, 0xf2, 0xed, 0xda, 0xcc, 0xd9, - 0x2c, 0x04, 0x8f, 0x86, 0x7c, 0xbb, 0xe5, 0xe0, 0x03, 0x48, 0xd9, 0x9e, 0x4b, 0x2d, 0xc7, 0xc5, - 0x7e, 0x2f, 0xed, 0xaf, 0x0c, 0x8a, 0xf8, 0xed, 0x00, 0x53, 0x38, 0x30, 0x93, 0x5d, 0x83, 0x42, - 0x19, 0x65, 0xe0, 0x52, 0x1b, 0xfb, 0xec, 0xdf, 0x3c, 0xbc, 0xb4, 0x19, 0x74, 0xd1, 0x21, 0x5c, - 0xaa, 0x38, 0x75, 0x8a, 0x7d, 0x92, 0x89, 0x6d, 0xc4, 0xb6, 0x93, 0xf9, 0x5b, 0xb3, 0x30, 0x67, - 0x1c, 0x71, 0x1b, 0x33, 0xb0, 0xcd, 0xba, 0x10, 0x17, 0x43, 0xe8, 0x2e, 0x40, 0xc3, 0xa2, 0x76, - 0xad, 0xc4, 0x2e, 0x3a, 0x7c, 0xa2, 0x8b, 0xa1, 0x89, 0x4a, 0x9f, 0x27, 0x0c, 0xf3, 0x5e, 0xa7, - 0x89, 0xcd, 0x44, 0x23, 0x68, 0x22, 0x04, 0x9a, 0x6b, 0x35, 0x44, 0x81, 0x91, 0x30, 0x79, 0x1b, - 0x2d, 0xc3, 0x7c, 0xdb, 0xaa, 0xb7, 0x30, 0xa7, 0x33, 0x61, 0x8a, 0x8e, 0xfe, 0x5c, 0x85, 0xc5, - 0x60, 0x5a, 0xb3, 0x26, 0xeb, 0x30, 0x3e, 0x2a, 0x5b, 0xae, 0xef, 0x44, 0x73, 0xca, 0xa5, 0xba, - 0x43, 0x58, 0x69, 0x18, 0x9b, 0x78, 0xe8, 0xc7, 0x9d, 0xf2, 0x3b, 0x0e, 0xa1, 0xfa, 0x1e, 0xcc, - 0x9b, 0x96, 0x5b, 0xc5, 0xe8, 0x0a, 0xc4, 0xbd, 0x4a, 0x85, 0x60, 0x51, 0x55, 0x6a, 0xa6, 0xec, - 0xb1, 0xf1, 0x3a, 0x76, 0xab, 0xb4, 0xc6, 0x43, 0xd6, 0x4c, 0xd9, 0xd3, 0x7f, 0x53, 0xe1, 0x7f, - 0xec, 0x82, 0xc1, 0x8c, 0x83, 0xfd, 0x75, 0x37, 0x44, 0xef, 0xd6, 0xe8, 0x1b, 0x49, 0x9f, 0xc1, - 0x7f, 0xfe, 0x80, 0xd8, 0x81, 0x79, 0x9f, 0xc5, 0x2b, 0xc3, 0xb9, 0x3a, 0xcc, 0x88, 0xa0, 0x43, - 0xa0, 0xf4, 0xcf, 0x55, 0x58, 0xea, 0x51, 0x24, 0x35, 0x7b, 0x2f, 0x44, 0xea, 0xcd, 0x49, 0xa4, - 0x46, 0x4b, 0xb5, 0xab, 0x92, 0xd7, 0xe5, 0xe0, 0x3e, 0xc2, 0x22, 0x4c, 0xc9, 0xdb, 0x88, 0xfe, - 0x3c, 0x06, 0x97, 0x83, 0xc8, 0x8e, 0x2d, 0xd2, 0xcd, 0xe1, 0x0f, 0x42, 0x74, 0xbc, 0x3c, 0x9e, - 0x8e, 0x3e, 0xa3, 0x68, 0xe8, 0xec, 0x3b, 0xe5, 0xe2, 0x42, 0xcb, 0x41, 0x9c, 0x4b, 0x88, 0x64, - 0x54, 0xbe, 0xf1, 0xc7, 0x2a, 0x4d, 0xc2, 0x58, 0x1a, 0x25, 0x56, 0x9d, 0xf2, 0x69, 0xa7, 0x4c, - 0xde, 0x46, 0xbb, 0xa0, 0xf1, 0x84, 0xac, 0xf1, 0x84, 0xbc, 0x3a, 0x74, 0x72, 0xd4, 0xb0, 0xfd, - 0x8c, 0xb4, 0x1a, 0x3c, 0x23, 0x73, 0xa4, 0xfe, 0xb3, 0x0a, 0xcb, 0x61, 0xbe, 0xa5, 0x68, 0xdf, - 0x0a, 0xad, 0xd2, 0xad, 0x69, 0xab, 0x14, 0x2d, 0xe1, 0xbe, 0x2f, 0xd7, 0x29, 0xe0, 0x4b, 0x99, - 0x95, 0x2f, 0x56, 0x30, 0xd6, 0x2c, 0x52, 0x13, 0x29, 0x9a, 0xad, 0x54, 0xca, 0x5c, 0x60, 0x03, - 0x2c, 0x15, 0xe7, 0xbf, 0xd7, 0x20, 0x2d, 0xf2, 0x73, 0x51, 0x3c, 0x33, 0xa2, 0x03, 0x88, 0x3d, - 0xc2, 0x14, 0xad, 0x4e, 0x7a, 0xe5, 0xcb, 0xae, 0x4d, 0x7c, 0xf8, 0xd9, 0x55, 0x98, 0x97, 0xd3, - 0xd6, 0x48, 0x2f, 0xbd, 0x67, 0x82, 0x51, 0x5e, 0xfa, 0xee, 0xbf, 0xdb, 0x0a, 0x7a, 0x0c, 0x71, - 0x71, 0x93, 0x41, 0x2f, 0x4d, 0xb9, 0x05, 0x66, 0x37, 0xa6, 0x5d, 0x82, 0xd0, 0x21, 0x68, 0x8c, - 0x4b, 0xb4, 0x36, 0xf1, 0xfe, 0x90, 0x5d, 0x9f, 0x5c, 0x11, 0xa3, 0x13, 0x88, 0x8b, 0x03, 0x7b, - 0xd4, 0x9c, 0x42, 0x15, 0xc9, 0xa8, 0x39, 0x85, 0xcf, 0xfa, 0x5d, 0x05, 0x15, 0x61, 0x21, 0x90, - 0x25, 0xba, 0x36, 0xf5, 0xf0, 0xca, 0xea, 0xd3, 0x53, 0xf1, 0xae, 0x82, 0x3e, 0x82, 0x54, 0xbf, - 0xd6, 0xd1, 0xe6, 0x4c, 0x19, 0x2b, 0xbb, 0x35, 0xdb, 0x96, 0xd9, 0x2f, 0xfd, 0x78, 0xbe, 0xae, - 0xfc, 0x7a, 0xbe, 0xae, 0xfc, 0x7e, 0xbe, 0xae, 0x7c, 0xf9, 0xc7, 0xfa, 0xdc, 0x87, 0x7b, 0x55, - 0x87, 0xd6, 0x5a, 0x67, 0x86, 0xed, 0x35, 0x72, 0x2e, 0x69, 0xda, 0xf6, 0x4e, 0x19, 0xb7, 0x73, - 0x2e, 0xf6, 0x2a, 0x64, 0xc7, 0x6a, 0x3a, 0x3b, 0x55, 0x2f, 0x17, 0x7e, 0xa5, 0xbe, 0x27, 0xda, - 0x2f, 0xd4, 0xcb, 0x4f, 0xb0, 0x77, 0x54, 0x34, 0x1e, 0x9e, 0x16, 0xd8, 0x5f, 0x85, 0x14, 0xcf, - 0xe2, 0xfc, 0x19, 0xfa, 0xb5, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, 0xc2, 0x71, 0xb6, 0x54, 0x0b, - 0x17, 0x00, 0x00, + // 1290 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x58, 0xcd, 0x6f, 0x1b, 0x45, + 0x14, 0xcf, 0xae, 0x37, 0x4e, 0xfc, 0x6c, 0x87, 0x68, 0x12, 0xb5, 0xc6, 0xf9, 0x20, 0xdd, 0x36, + 0x69, 0x44, 0xc9, 0x3a, 0x18, 0x95, 0xd0, 0x96, 0xb6, 0x6a, 0x48, 0x52, 0x5b, 0x25, 0x6d, 0x58, + 0xf3, 0x21, 0x21, 0x21, 0x6b, 0xb3, 0x1e, 0x7b, 0x97, 0xda, 0xbb, 0x66, 0x67, 0x6d, 0xe4, 0x1b, + 0x57, 0xce, 0x1c, 0x40, 0x42, 0x42, 0xa8, 0x27, 0xd4, 0x13, 0xe2, 0xca, 0x3f, 0x00, 0x48, 0x48, + 0xf0, 0x1f, 0xa0, 0xf0, 0x07, 0x70, 0x46, 0x08, 0x09, 0xcd, 0xc7, 0xc6, 0x5e, 0x7f, 0x2b, 0xb7, + 0xe5, 0x36, 0x33, 0xfb, 0x7b, 0x6f, 0xe7, 0xfd, 0xde, 0xc7, 0xbc, 0x19, 0x58, 0x6d, 0xe7, 0x73, + 0xee, 0xe9, 0xc7, 0xd8, 0xf4, 0x73, 0x35, 0xaf, 0x69, 0xe6, 0x08, 0xf6, 0xda, 0xb6, 0x89, 0xb5, + 0xa6, 0xe7, 0xfa, 0x2e, 0x5a, 0x74, 0xb0, 0xab, 0x55, 0x89, 0xd6, 0xce, 0x6b, 0x1c, 0x94, 0xcd, + 0xf6, 0xe1, 0xfd, 0x4e, 0x13, 0x13, 0x8e, 0xce, 0x66, 0xda, 0xf9, 0x9c, 0x87, 0xab, 0x64, 0xf0, + 0xcb, 0x4a, 0x3b, 0x9f, 0x23, 0x98, 0x10, 0xdb, 0x75, 0x06, 0x3e, 0xaa, 0xcf, 0x65, 0x80, 0x87, + 0xd8, 0xd7, 0xf1, 0x27, 0x2d, 0x4c, 0x7c, 0x74, 0x13, 0x94, 0x53, 0xb7, 0xd2, 0xc9, 0x48, 0x1b, + 0xd2, 0x76, 0x32, 0x7f, 0x45, 0xeb, 0xdf, 0x82, 0xd6, 0xc5, 0x6a, 0xfb, 0x6e, 0xa5, 0xa3, 0x33, + 0x38, 0x3a, 0x84, 0x64, 0x03, 0xfb, 0x46, 0xd9, 0xc2, 0x46, 0x05, 0x7b, 0x19, 0x99, 0x49, 0x5f, + 0xeb, 0x91, 0x16, 0xff, 0xd7, 0x84, 0xec, 0x31, 0xf6, 0x8d, 0x02, 0xc3, 0xea, 0xd0, 0x38, 0x1f, + 0xa3, 0x77, 0x20, 0xdd, 0xc6, 0x9e, 0x5d, 0xed, 0x04, 0x8a, 0x62, 0x4c, 0xd1, 0x2b, 0xa3, 0x15, + 0xbd, 0x4f, 0xe1, 0xb6, 0x69, 0xf8, 0xb6, 0xeb, 0x08, 0x85, 0x29, 0xae, 0x82, 0xcf, 0xb2, 0x8f, + 0x40, 0xa1, 0xfb, 0x44, 0xaf, 0xc2, 0x9c, 0x51, 0xa9, 0x78, 0x98, 0x10, 0x61, 0xdb, 0xe5, 0x1e, + 0xa5, 0x94, 0x37, 0xed, 0x01, 0xff, 0xac, 0x07, 0x38, 0xb4, 0x08, 0x31, 0xcf, 0xf8, 0x94, 0x19, + 0x33, 0xaf, 0xd3, 0xa1, 0xfa, 0x4f, 0x0c, 0x92, 0x8c, 0x00, 0xd2, 0x74, 0x1d, 0x82, 0xd1, 0xeb, + 0x21, 0xb6, 0xd4, 0x11, 0x6c, 0x71, 0x70, 0x2f, 0x5d, 0x47, 0xc3, 0xe8, 0xda, 0x1c, 0x6a, 0x25, + 0x17, 0x1e, 0xc1, 0x97, 0x3e, 0x9c, 0xaf, 0x9d, 0x31, 0x9a, 0x26, 0x12, 0xf6, 0xa5, 0x2c, 0x18, + 0xbb, 0x0b, 0x8a, 0xed, 0xd8, 0xbe, 0x30, 0xee, 0xfa, 0x64, 0xe3, 0xb4, 0xa2, 0x63, 0xfb, 0x85, + 0x19, 0x9d, 0x89, 0xa1, 0x4b, 0x30, 0x6b, 0x5a, 0x2d, 0xe7, 0x29, 0xb3, 0x2e, 0x55, 0x98, 0xd1, + 0xf9, 0x34, 0xfb, 0x9d, 0x04, 0x0a, 0x05, 0xa2, 0x9b, 0x90, 0xe0, 0x8a, 0xca, 0x76, 0x45, 0xfc, + 0x24, 0xd3, 0xef, 0x93, 0x27, 0x0c, 0x50, 0x3c, 0xd0, 0xe7, 0x39, 0xb4, 0x58, 0x41, 0x7b, 0x90, + 0x20, 0x76, 0xcd, 0x31, 0xfc, 0x96, 0x87, 0x05, 0x73, 0x2f, 0xf6, 0x8b, 0x95, 0x02, 0x80, 0xde, + 0xc5, 0xa2, 0x5d, 0x88, 0x87, 0x58, 0xca, 0x0c, 0x5a, 0x24, 0x08, 0x11, 0xb8, 0xfd, 0x34, 0x24, + 0xc5, 0x0e, 0x9b, 0x86, 0xe7, 0xab, 0x5f, 0x2b, 0x00, 0x27, 0xad, 0xe9, 0x53, 0xa5, 0x8b, 0x8d, + 0x46, 0xaa, 0xfc, 0x18, 0x78, 0xfe, 0xcd, 0x90, 0xe7, 0xb7, 0x26, 0x5a, 0x36, 0x9d, 0xe3, 0x7f, + 0x8d, 0x8c, 0xe3, 0xd1, 0x55, 0x48, 0x9b, 0x6e, 0xd3, 0xc6, 0xa4, 0xec, 0xb4, 0x1a, 0xa7, 0xd8, + 0xcb, 0x28, 0x1b, 0xd2, 0x76, 0x5a, 0x4f, 0xf1, 0xc5, 0xc7, 0x6c, 0xad, 0x3f, 0x3a, 0xbe, 0x95, + 0x21, 0xc9, 0x78, 0x99, 0xb6, 0x36, 0xf4, 0x80, 0xa3, 0x52, 0x1b, 0xee, 0x8a, 0x00, 0xb9, 0x98, + 0x07, 0xd5, 0x6f, 0x64, 0x48, 0x1f, 0xe0, 0x3a, 0xf6, 0x71, 0x90, 0x43, 0x6f, 0x84, 0x48, 0xba, + 0x36, 0x48, 0x52, 0x08, 0x1e, 0x8d, 0x34, 0xba, 0x75, 0xe1, 0x13, 0x47, 0xfd, 0x4b, 0x82, 0x85, + 0xc0, 0x62, 0x11, 0x46, 0xb7, 0x42, 0x0c, 0x6d, 0x8e, 0x66, 0x28, 0x5a, 0x91, 0x14, 0xe7, 0x24, + 0xa9, 0x3f, 0xcb, 0x90, 0xa4, 0x4b, 0x41, 0x40, 0x4c, 0xcc, 0x9a, 0x1e, 0x70, 0x34, 0xc2, 0xc1, + 0xba, 0x78, 0x03, 0xb2, 0x02, 0x89, 0x86, 0x61, 0x3b, 0x65, 0xd7, 0xa9, 0x77, 0x44, 0x1b, 0x32, + 0x4f, 0x17, 0x9e, 0x38, 0xf5, 0x4e, 0xd0, 0x9d, 0xc4, 0xba, 0xdd, 0xc9, 0x67, 0x12, 0x2c, 0xf1, + 0x9f, 0x7e, 0x60, 0xfb, 0x56, 0x69, 0x48, 0xfd, 0x93, 0xa6, 0xac, 0x7f, 0x17, 0x2d, 0xb5, 0xea, + 0xdf, 0x32, 0xa4, 0xb8, 0x87, 0x44, 0xf8, 0xee, 0x85, 0xfc, 0x79, 0x75, 0x94, 0x3f, 0xa3, 0x15, + 0xbc, 0x5f, 0x48, 0xc2, 0xa7, 0xf7, 0xfb, 0x98, 0xdd, 0x1c, 0xc5, 0x6c, 0xc8, 0x21, 0x85, 0x99, + 0x73, 0xa2, 0xf7, 0x21, 0x45, 0x2c, 0xd7, 0xf3, 0xc3, 0x66, 0xae, 0x0d, 0xaa, 0x29, 0x51, 0x14, + 0xd7, 0x55, 0x98, 0xd1, 0x93, 0xa4, 0x3b, 0xdd, 0x8f, 0x83, 0x42, 0xa5, 0xd5, 0x7f, 0x63, 0x90, + 0x2e, 0x61, 0xc3, 0x33, 0xad, 0xa9, 0xab, 0x6b, 0x08, 0x1e, 0x8d, 0x74, 0x3a, 0x6f, 0x4f, 0xef, + 0x41, 0xca, 0x74, 0x1d, 0xdf, 0xb0, 0x1d, 0xec, 0x75, 0x8f, 0xa1, 0x95, 0xfe, 0x30, 0x7d, 0x2b, + 0xc0, 0x14, 0x0f, 0xf4, 0xe4, 0xb9, 0x40, 0xb1, 0x82, 0x32, 0x30, 0xd7, 0xc6, 0x1e, 0xfd, 0x37, + 0x33, 0x2f, 0xad, 0x07, 0x53, 0x74, 0x08, 0x73, 0x55, 0xbb, 0xee, 0x63, 0x8f, 0x64, 0x62, 0x1b, + 0xb1, 0xed, 0x64, 0xfe, 0xc6, 0x34, 0xcc, 0x69, 0x47, 0x4c, 0x46, 0x0f, 0x64, 0xb3, 0x0e, 0xc4, + 0xf9, 0x12, 0xba, 0x0d, 0xd0, 0x30, 0x7c, 0xd3, 0x2a, 0xd3, 0x8b, 0x17, 0xdb, 0xe8, 0x42, 0x68, + 0xa3, 0x42, 0xe7, 0x31, 0xc5, 0xbc, 0xdb, 0x69, 0x62, 0x3d, 0xd1, 0x08, 0x86, 0x08, 0x81, 0xe2, + 0x18, 0x0d, 0x9e, 0x85, 0x09, 0x9d, 0x8d, 0xd1, 0x32, 0xcc, 0xb6, 0x8d, 0x7a, 0x0b, 0x33, 0x3a, + 0x13, 0x3a, 0x9f, 0xa8, 0xcf, 0x64, 0x58, 0x08, 0xb6, 0x35, 0xed, 0xe1, 0x11, 0xc6, 0x47, 0x25, + 0xff, 0x7a, 0x4e, 0x58, 0xbb, 0x52, 0xae, 0xdb, 0x84, 0xb6, 0xaa, 0xb1, 0xb1, 0x4d, 0x48, 0xdc, + 0xae, 0xbc, 0x6d, 0x13, 0x5f, 0xdd, 0x83, 0x59, 0xdd, 0x70, 0x6a, 0x18, 0x5d, 0x82, 0xb8, 0x5b, + 0xad, 0x12, 0xcc, 0xbb, 0x5c, 0x45, 0x17, 0x33, 0xba, 0x5e, 0xc7, 0x4e, 0xcd, 0xb7, 0x98, 0xc9, + 0x8a, 0x2e, 0x66, 0xea, 0xef, 0x32, 0xbc, 0x40, 0x2f, 0x3c, 0x54, 0x38, 0xc8, 0xaf, 0xdb, 0x21, + 0x7a, 0xb7, 0x86, 0xdf, 0x90, 0x7a, 0x04, 0xfe, 0xf7, 0x07, 0xd6, 0x0e, 0xcc, 0x7a, 0xd4, 0x5e, + 0x61, 0xce, 0xe5, 0x41, 0x46, 0x38, 0x1d, 0x1c, 0xa5, 0x7e, 0x2e, 0xc3, 0x62, 0x97, 0x22, 0x11, + 0xb3, 0x77, 0x42, 0xa4, 0x5e, 0x1f, 0x47, 0x6a, 0xb4, 0xa2, 0x76, 0x55, 0xf0, 0xba, 0x1c, 0xdc, + 0x8f, 0xa8, 0x85, 0x29, 0x71, 0x3b, 0x52, 0x9f, 0xc5, 0x60, 0x29, 0xb0, 0xac, 0x60, 0x90, 0xf3, + 0x1a, 0x7e, 0x2f, 0x44, 0xc7, 0xcb, 0xa3, 0xe9, 0xe8, 0x11, 0x8a, 0x46, 0x9c, 0x7d, 0x2f, 0x5d, + 0x3c, 0xd0, 0x72, 0x10, 0x67, 0x21, 0x44, 0x32, 0x32, 0x4b, 0xfc, 0x91, 0x91, 0x26, 0x60, 0xb4, + 0x8c, 0x12, 0xa3, 0xee, 0xb3, 0x6d, 0xa7, 0x74, 0x36, 0x46, 0xbb, 0xa0, 0xb0, 0x82, 0xac, 0xb0, + 0x82, 0xbc, 0x3a, 0x70, 0x72, 0x58, 0xd8, 0x7c, 0x4a, 0x5a, 0x0d, 0x56, 0x91, 0x19, 0x52, 0xfd, + 0x45, 0x86, 0xe5, 0x30, 0xdf, 0x22, 0x68, 0xef, 0x87, 0xbc, 0x74, 0x63, 0x92, 0x97, 0xa2, 0x15, + 0xb8, 0xef, 0x09, 0x3f, 0x05, 0x7c, 0x49, 0xd3, 0xf2, 0x45, 0x1b, 0x58, 0xcb, 0x20, 0x16, 0x2f, + 0xd1, 0xd4, 0x53, 0x29, 0x7d, 0x9e, 0x2e, 0xd0, 0x52, 0x9c, 0xff, 0x41, 0x81, 0x34, 0xaf, 0xcf, + 0x25, 0xfe, 0xec, 0x89, 0x0e, 0x20, 0xf6, 0x10, 0xfb, 0x68, 0x75, 0xdc, 0xab, 0x63, 0x76, 0x6d, + 0xec, 0x43, 0xd4, 0xae, 0x44, 0xb5, 0x9c, 0xb4, 0x86, 0x6a, 0xe9, 0x3e, 0x5b, 0x0c, 0xd3, 0xd2, + 0x73, 0x1f, 0xdf, 0x96, 0xd0, 0x23, 0x88, 0xf3, 0x9b, 0x15, 0x7a, 0x69, 0xc2, 0xad, 0x34, 0xbb, + 0x31, 0xe9, 0x52, 0x86, 0x0e, 0x41, 0xa1, 0x5c, 0xa2, 0xb5, 0xb1, 0xf7, 0x99, 0xec, 0xfa, 0xf8, + 0xf6, 0x18, 0x1d, 0x43, 0x9c, 0x1f, 0xd8, 0xc3, 0xf6, 0x14, 0xea, 0x48, 0x86, 0xed, 0x29, 0x7c, + 0xd6, 0xef, 0x4a, 0xa8, 0x04, 0xf3, 0x41, 0x58, 0xa2, 0x2b, 0x13, 0x0f, 0xaf, 0xac, 0x3a, 0xb9, + 0x14, 0xef, 0x4a, 0xe8, 0x23, 0x48, 0xf5, 0xc6, 0x3a, 0xda, 0x9c, 0xaa, 0x62, 0x65, 0xb7, 0xa6, + 0x4b, 0x99, 0xfd, 0xf2, 0x4f, 0x67, 0xeb, 0xd2, 0x6f, 0x67, 0xeb, 0xd2, 0x1f, 0x67, 0xeb, 0xd2, + 0x57, 0x7f, 0xae, 0xcf, 0x7c, 0xb8, 0x57, 0xb3, 0x7d, 0xab, 0x75, 0xaa, 0x99, 0x6e, 0x23, 0xe7, + 0x90, 0xa6, 0x69, 0xee, 0x54, 0x70, 0x3b, 0xe7, 0x60, 0xb7, 0x4a, 0x76, 0x8c, 0xa6, 0xbd, 0x53, + 0x73, 0x73, 0xe1, 0x57, 0xf3, 0x3b, 0x7c, 0xfc, 0x5c, 0x5e, 0x7a, 0x8c, 0xdd, 0xa3, 0x92, 0xf6, + 0xe0, 0xa4, 0x48, 0xff, 0xca, 0x43, 0xf1, 0x34, 0xce, 0x9e, 0xc5, 0x5f, 0xfb, 0x2f, 0x00, 0x00, + 0xff, 0xff, 0x31, 0xd1, 0xce, 0x46, 0x9b, 0x17, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -3684,6 +3747,57 @@ func (m *HeadRequest_Body) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *HeaderWithSignature) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *HeaderWithSignature) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *HeaderWithSignature) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.Signature != nil { + { + size, err := m.Signature.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.Header != nil { + { + size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func (m *HeadResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -4969,6 +5083,26 @@ func (m *HeadRequest_Body) Size() (n int) { return n } +func (m *HeaderWithSignature) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Header != nil { + l = m.Header.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.Signature != nil { + l = m.Signature.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + func (m *HeadResponse) Size() (n int) { if m == nil { return 0 @@ -7547,6 +7681,132 @@ func (m *HeadRequest_Body) Unmarshal(dAtA []byte) error { } return nil } +func (m *HeaderWithSignature) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: HeaderWithSignature: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: HeaderWithSignature: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Header == nil { + m.Header = &Header{} + } + if err := m.Header.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signature", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Signature == nil { + m.Signature = &grpc1.Signature{} + } + if err := m.Signature.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *HeadResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -7767,7 +8027,7 @@ func (m *HeadResponse_Body) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &Header{} + v := &HeaderWithSignature{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } diff --git a/v2/object/marshal.go b/v2/object/marshal.go index f19c54f..c1ceea1 100644 --- a/v2/object/marshal.go +++ b/v2/object/marshal.go @@ -33,6 +33,9 @@ const ( hdrAttributesField = 10 hdrSplitField = 11 + hdrWithSigHeaderField = 1 + hdrWithSigSignatureField = 2 + objIDField = 1 objSignatureField = 2 objHeaderField = 3 @@ -385,6 +388,48 @@ func (h *Header) StableSize() (size int) { return size } +func (h *HeaderWithSignature) StableMarshal(buf []byte) ([]byte, error) { + if h == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, h.StableSize()) + } + + var ( + offset, n int + err error + ) + + n, err = proto.NestedStructureMarshal(hdrWithSigHeaderField, buf[offset:], h.header) + if err != nil { + return nil, err + } + + offset += n + + n, err = proto.NestedStructureMarshal(hdrWithSigSignatureField, buf[offset:], h.signature) + if err != nil { + return nil, err + } + + offset += n + + return buf, nil +} + +func (h *HeaderWithSignature) StableSize() (size int) { + if h == nil { + return 0 + } + + size += proto.NestedStructureSize(hdrVersionField, h.header) + size += proto.NestedStructureSize(hdrContainerIDField, h.signature) + + return size +} + func (o *Object) StableMarshal(buf []byte) ([]byte, error) { if o == nil { return []byte{}, nil diff --git a/v2/object/marshal_test.go b/v2/object/marshal_test.go index 04f3a39..e63683b 100644 --- a/v2/object/marshal_test.go +++ b/v2/object/marshal_test.go @@ -590,8 +590,12 @@ func generateHeadResponseBody(flag bool) *object.HeadResponseBody { short.SetShortHeader(generateShortHeader("short id")) part = short } else { + hdrWithSig := new(object.HeaderWithSignature) + hdrWithSig.SetHeader(generateHeader(30)) + hdrWithSig.SetSignature(generateSignature("sig", "key")) + full := new(object.GetHeaderPartFull) - full.SetHeader(generateHeader(30)) + full.SetHeaderWithSignature(hdrWithSig) part = full } diff --git a/v2/object/types.go b/v2/object/types.go index cdce248..5c6c9ac 100644 --- a/v2/object/types.go +++ b/v2/object/types.go @@ -57,6 +57,12 @@ type Header struct { split *SplitHeader } +type HeaderWithSignature struct { + header *Header + + signature *refs.Signature +} + type Object struct { objectID *refs.ObjectID @@ -136,7 +142,7 @@ type GetHeaderPart interface { } type GetHeaderPartFull struct { - hdr *Header + hdr *HeaderWithSignature } type GetHeaderPartShort struct { @@ -528,6 +534,34 @@ func (h *Header) SetSplit(v *SplitHeader) { } } +func (h *HeaderWithSignature) GetHeader() *Header { + if h != nil { + return h.header + } + + return nil +} + +func (h *HeaderWithSignature) SetHeader(v *Header) { + if h != nil { + h.header = v + } +} + +func (h *HeaderWithSignature) GetSignature() *refs.Signature { + if h != nil { + return h.signature + } + + return nil +} + +func (h *HeaderWithSignature) SetSignature(v *refs.Signature) { + if h != nil { + h.signature = v + } +} + func (o *Object) GetObjectID() *refs.ObjectID { if o != nil { return o.objectID @@ -1138,7 +1172,7 @@ func (r *HeadRequest) SetVerificationHeader(v *session.RequestVerificationHeader } } -func (h *GetHeaderPartFull) GetHeader() *Header { +func (h *GetHeaderPartFull) GetHeaderWithSignature() *HeaderWithSignature { if h != nil { return h.hdr } @@ -1146,7 +1180,7 @@ func (h *GetHeaderPartFull) GetHeader() *Header { return nil } -func (h *GetHeaderPartFull) SetHeader(v *Header) { +func (h *GetHeaderPartFull) SetHeaderWithSignature(v *HeaderWithSignature) { if h != nil { h.hdr = v } From efbf73b775623c15a15b9f1e54c5fef0e5e22b2c Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Tue, 8 Sep 2020 13:42:25 +0300 Subject: [PATCH 0396/1196] [#138] sdk/object: Fix head request Now head request returns full header with signature. Signed-off-by: Alex Vanin --- pkg/client/object.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pkg/client/object.go b/pkg/client/object.go index 3bedecf..a5323cf 100644 --- a/pkg/client/object.go +++ b/pkg/client/object.go @@ -564,7 +564,12 @@ func (c *Client) getObjectHeaderV2(ctx context.Context, p *ObjectHeaderParams, o ) } - hdr = v.GetHeader() + hdrWithSig := v.GetHeaderWithSignature() + if hdrWithSig == nil { + return nil, errors.New("got nil instead of header with signature") + } + hdr = hdrWithSig.GetHeader() + // todo: check signature there default: panic(fmt.Sprintf("unexpected Head object type %T", v)) } From 20264737336cc25c5177215fa8cb61d1e7602d08 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Sat, 5 Sep 2020 13:37:47 +0300 Subject: [PATCH 0397/1196] [#137] sdk: Implement netmap filtering and selection Signed-off-by: Evgenii Stratonikov --- go.mod | 1 + go.sum | 3 + pkg/netmap/aggregator.go | 243 ++++++++++++++++++++++++++++++++++++ pkg/netmap/container.go | 19 +++ pkg/netmap/context.go | 81 ++++++++++++ pkg/netmap/doc.go | 11 ++ pkg/netmap/filter.go | 129 +++++++++++++++++++ pkg/netmap/filter_test.go | 203 ++++++++++++++++++++++++++++++ pkg/netmap/helper_test.go | 61 +++++++++ pkg/netmap/netmap.go | 73 +++++++++++ pkg/netmap/node_info.go | 89 +++++++++++++ pkg/netmap/selector.go | 98 +++++++++++++++ pkg/netmap/selector_test.go | 218 ++++++++++++++++++++++++++++++++ 13 files changed, 1229 insertions(+) create mode 100644 pkg/netmap/aggregator.go create mode 100644 pkg/netmap/container.go create mode 100644 pkg/netmap/context.go create mode 100644 pkg/netmap/doc.go create mode 100644 pkg/netmap/filter.go create mode 100644 pkg/netmap/filter_test.go create mode 100644 pkg/netmap/helper_test.go create mode 100644 pkg/netmap/netmap.go create mode 100644 pkg/netmap/node_info.go create mode 100644 pkg/netmap/selector.go create mode 100644 pkg/netmap/selector_test.go diff --git a/go.mod b/go.mod index 372a59c..d9b42dd 100644 --- a/go.mod +++ b/go.mod @@ -6,6 +6,7 @@ require ( github.com/golang/protobuf v1.4.2 github.com/google/uuid v1.1.1 github.com/mr-tron/base58 v1.1.2 + github.com/nspcc-dev/hrw v1.0.9 github.com/nspcc-dev/neo-go v0.91.0 github.com/nspcc-dev/neofs-crypto v0.3.0 github.com/pkg/errors v0.9.1 diff --git a/go.sum b/go.sum index 8f9905b..565fd48 100644 --- a/go.sum +++ b/go.sum @@ -135,6 +135,8 @@ github.com/nspcc-dev/dbft v0.0.0-20191209120240-0d6b7568d9ae/go.mod h1:3FjXOoHmA github.com/nspcc-dev/dbft v0.0.0-20200117124306-478e5cfbf03a/go.mod h1:/YFK+XOxxg0Bfm6P92lY5eDSLYfp06XOdL8KAVgXjVk= github.com/nspcc-dev/dbft v0.0.0-20200219114139-199d286ed6c1/go.mod h1:O0qtn62prQSqizzoagHmuuKoz8QMkU3SzBoKdEvm3aQ= github.com/nspcc-dev/dbft v0.0.0-20200711144034-c526ccc6f570/go.mod h1:1FYQXSbb6/9HQIkoF8XO7W/S8N7AZRkBsgwbcXRvk0E= +github.com/nspcc-dev/hrw v1.0.9 h1:17VcAuTtrstmFppBjfRiia4K2wA/ukXZhLFS8Y8rz5Y= +github.com/nspcc-dev/hrw v1.0.9/go.mod h1:l/W2vx83vMQo6aStyx2AuZrJ+07lGv2JQGlVkPG06MU= github.com/nspcc-dev/neo-go v0.73.1-pre.0.20200303142215-f5a1b928ce09/go.mod h1:pPYwPZ2ks+uMnlRLUyXOpLieaDQSEaf4NM3zHVbRjmg= github.com/nspcc-dev/neo-go v0.91.0 h1:KKOPMKs0fm8JIau1SuwxiLdrZ+1kDPBiVRlWwzfebWE= github.com/nspcc-dev/neo-go v0.91.0/go.mod h1:G6HdOWvzQ6tlvFdvFSN/PgCzLPN/X/X4d5hTjFRUDcc= @@ -175,6 +177,7 @@ github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= +github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= diff --git a/pkg/netmap/aggregator.go b/pkg/netmap/aggregator.go new file mode 100644 index 0000000..ab66f7f --- /dev/null +++ b/pkg/netmap/aggregator.go @@ -0,0 +1,243 @@ +package netmap + +import ( + "sort" +) + +type ( + // aggregator can calculate some value across all netmap + // such as median, minimum or maximum. + aggregator interface { + Add(float64) + Compute() float64 + } + + // normalizer normalizes weight. + normalizer interface { + Normalize(w float64) float64 + } + + meanSumAgg struct { + sum float64 + count int + } + + meanAgg struct { + mean float64 + count int + } + + minAgg struct { + min float64 + } + + maxAgg struct { + max float64 + } + + meanIQRAgg struct { + k float64 + arr []float64 + } + + reverseMinNorm struct { + min float64 + } + + maxNorm struct { + max float64 + } + + sigmoidNorm struct { + scale float64 + } + + constNorm struct { + value float64 + } + + // weightFunc calculates n's weight. + weightFunc = func(n *Node) float64 +) + +var ( + _ aggregator = (*meanSumAgg)(nil) + _ aggregator = (*meanAgg)(nil) + _ aggregator = (*minAgg)(nil) + _ aggregator = (*maxAgg)(nil) + _ aggregator = (*meanIQRAgg)(nil) + + _ normalizer = (*reverseMinNorm)(nil) + _ normalizer = (*maxNorm)(nil) + _ normalizer = (*sigmoidNorm)(nil) + _ normalizer = (*constNorm)(nil) +) + +// capWeightFunc calculates weight which is equal to capacity. +func capWeightFunc(n *Node) float64 { return float64(n.Capacity) } + +// priceWeightFunc calculates weight which is equal to price. +func priceWeightFunc(n *Node) float64 { return float64(n.Price) } + +// newWeightFunc returns weightFunc which multiplies normalized +// capacity and price. +func newWeightFunc(capNorm, priceNorm normalizer) weightFunc { + return func(n *Node) float64 { + return capNorm.Normalize(float64(n.Capacity)) * priceNorm.Normalize(float64(n.Price)) + } +} + +// newMeanSumAgg returns an aggregator which +// computes mean value by keeping total sum. +func newMeanSumAgg() aggregator { + return new(meanSumAgg) +} + +// newMeanAgg returns an aggregator which +// computes mean value by recalculating it on +// every addition. +func newMeanAgg() aggregator { + return new(meanAgg) +} + +// newMinAgg returns an aggregator which +// computes min value. +func newMinAgg() aggregator { + return new(minAgg) +} + +// newMaxAgg returns an aggregator which +// computes max value. +func newMaxAgg() aggregator { + return new(maxAgg) +} + +// newMeanIQRAgg returns an aggregator which +// computes mean value of values from IQR interval. +func newMeanIQRAgg() aggregator { + return new(meanIQRAgg) +} + +// newReverseMinNorm returns a normalizer which +// normalize values in range of 0.0 to 1.0 to a minimum value. +func newReverseMinNorm(min float64) normalizer { + return &reverseMinNorm{min: min} +} + +// newMaxNorm returns a normalizer which +// normalize values in range of 0.0 to 1.0 to a maximum value. +func newMaxNorm(max float64) normalizer { + return &maxNorm{max: max} +} + +// newSigmoidNorm returns a normalizer which +// normalize values in range of 0.0 to 1.0 to a scaled sigmoid. +func newSigmoidNorm(scale float64) normalizer { + return &sigmoidNorm{scale: scale} +} + +// newConstNorm returns a normalizer which +// returns a constant values +func newConstNorm(value float64) normalizer { + return &constNorm{value: value} +} + +func (a *meanSumAgg) Add(n float64) { + a.sum += n + a.count++ +} + +func (a *meanSumAgg) Compute() float64 { + if a.count == 0 { + return 0 + } + return a.sum / float64(a.count) +} + +func (a *meanAgg) Add(n float64) { + c := a.count + 1 + a.mean = a.mean*(float64(a.count)/float64(c)) + n/float64(c) + a.count++ +} + +func (a *meanAgg) Compute() float64 { + return a.mean +} + +func (a *minAgg) Add(n float64) { + if a.min == 0 || n < a.min { + a.min = n + } +} + +func (a *minAgg) Compute() float64 { + return a.min +} + +func (a *maxAgg) Add(n float64) { + if n > a.max { + a.max = n + } +} + +func (a *maxAgg) Compute() float64 { + return a.max +} + +func (a *meanIQRAgg) Add(n float64) { + a.arr = append(a.arr, n) +} + +func (a *meanIQRAgg) Compute() float64 { + l := len(a.arr) + if l == 0 { + return 0 + } + + sort.Slice(a.arr, func(i, j int) bool { return a.arr[i] < a.arr[j] }) + + var min, max float64 + if l < 4 { + min, max = a.arr[0], a.arr[l-1] + } else { + start, end := l/4, l*3/4-1 + iqr := a.k * (a.arr[end] - a.arr[start]) + min, max = a.arr[start]-iqr, a.arr[end]+iqr + } + + count := 0 + sum := float64(0) + for _, e := range a.arr { + if e >= min && e <= max { + sum += e + count++ + } + } + return sum / float64(count) +} + +func (r *reverseMinNorm) Normalize(w float64) float64 { + if w == 0 { + return 0 + } + return r.min / w +} + +func (r *maxNorm) Normalize(w float64) float64 { + if r.max == 0 { + return 0 + } + return w / r.max +} + +func (r *sigmoidNorm) Normalize(w float64) float64 { + if r.scale == 0 { + return 0 + } + x := w / r.scale + return x / (1 + x) +} + +func (r *constNorm) Normalize(_ float64) float64 { + return r.value +} diff --git a/pkg/netmap/container.go b/pkg/netmap/container.go new file mode 100644 index 0000000..00875a9 --- /dev/null +++ b/pkg/netmap/container.go @@ -0,0 +1,19 @@ +package netmap + +// ContainerNodes represents nodes in the container. +type ContainerNodes interface { + Replicas() []Nodes + Flatten() Nodes +} + +type containerNodes []Nodes + +// Flatten returns list of all nodes from the container. +func (c containerNodes) Flatten() Nodes { + return flattenNodes(c) +} + +// Replicas return list of container replicas. +func (c containerNodes) Replicas() []Nodes { + return c +} diff --git a/pkg/netmap/context.go b/pkg/netmap/context.go new file mode 100644 index 0000000..9de49a9 --- /dev/null +++ b/pkg/netmap/context.go @@ -0,0 +1,81 @@ +package netmap + +import ( + "errors" + + "github.com/nspcc-dev/hrw" + "github.com/nspcc-dev/neofs-api-go/v2/netmap" +) + +// Context contains references to named filters and cached numeric values. +type Context struct { + // Netmap is a netmap structure to operate on. + Netmap *Netmap + // Filters stores processed filters. + Filters map[string]*netmap.Filter + // Selectors stores processed selectors. + Selectors map[string]*netmap.Selector + // Selections stores result of selector processing. + Selections map[string][]Nodes + + // numCache stores parsed numeric values. + numCache map[*netmap.Filter]uint64 + // pivot is a seed for HRW. + pivot []byte + // pivotHash is a saved HRW hash of pivot + pivotHash uint64 + // aggregator is returns aggregator determining bucket weight. + // By default it returns mean value from IQR interval. + aggregator func() aggregator + // weightFunc is a weighting function for determining node priority. + // By default in combines favours low price and high capacity. + weightFunc weightFunc +} + +// Various validation errors. +var ( + ErrMissingField = errors.New("netmap: nil field") + ErrInvalidFilterName = errors.New("netmap: filter name is invalid") + ErrInvalidNumber = errors.New("netmap: number value expected") + ErrInvalidFilterOp = errors.New("netmap: invalid filter operation") + ErrFilterNotFound = errors.New("netmap: filter not found") + ErrNonEmptyFilters = errors.New("netmap: simple filter must no contain sub-filters") + ErrNotEnoughNodes = errors.New("netmap: not enough nodes to SELECT from") + ErrSelectorNotFound = errors.New("netmap: selector not found") + ErrUnnamedTopFilter = errors.New("netmap: all filters on top level must be named") +) + +// NewContext creates new context. It contains various caches. +// In future it may create hierarchical netmap structure to work with. +func NewContext(nm *Netmap) *Context { + return &Context{ + Netmap: nm, + Filters: make(map[string]*netmap.Filter), + Selectors: make(map[string]*netmap.Selector), + Selections: make(map[string][]Nodes), + + numCache: make(map[*netmap.Filter]uint64), + aggregator: newMeanIQRAgg, + weightFunc: GetDefaultWeightFunc(nm.Nodes), + } +} + +func (c *Context) setPivot(pivot []byte) { + if len(pivot) != 0 { + c.pivot = pivot + c.pivotHash = hrw.Hash(pivot) + } +} + +// GetDefaultWeightFunc returns default weighting function. +func GetDefaultWeightFunc(ns Nodes) weightFunc { + mean := newMeanAgg() + min := newMinAgg() + for i := range ns { + mean.Add(float64(ns[i].Capacity)) + min.Add(float64(ns[i].Price)) + } + return newWeightFunc( + newSigmoidNorm(mean.Compute()), + newReverseMinNorm(min.Compute())) +} diff --git a/pkg/netmap/doc.go b/pkg/netmap/doc.go new file mode 100644 index 0000000..a38e985 --- /dev/null +++ b/pkg/netmap/doc.go @@ -0,0 +1,11 @@ +/* +Package netmap provides routines for working with netmap and placement policy. +Work is done in 4 steps: +1. Create context containing results shared between steps. +2. Processing filters. +3. Processing selectors. +4. Processing replicas. + +Each step depends only on previous ones. +*/ +package netmap diff --git a/pkg/netmap/filter.go b/pkg/netmap/filter.go new file mode 100644 index 0000000..e4df979 --- /dev/null +++ b/pkg/netmap/filter.go @@ -0,0 +1,129 @@ +package netmap + +import ( + "fmt" + "strconv" + + "github.com/nspcc-dev/neofs-api-go/v2/netmap" +) + +// MainFilterName is a name of the filter +// which points to the whole netmap. +const MainFilterName = "*" + +// applyFilter applies named filter to b. +func (c *Context) applyFilter(name string, b *Node) bool { + return name == MainFilterName || c.match(c.Filters[name], b) +} + +// processFilters processes filters and returns error is any of them is invalid. +func (c *Context) processFilters(p *netmap.PlacementPolicy) error { + for _, f := range p.GetFilters() { + if err := c.processFilter(f, true); err != nil { + return err + } + } + return nil +} + +func (c *Context) processFilter(f *netmap.Filter, top bool) error { + if f == nil { + return fmt.Errorf("%w: FILTER", ErrMissingField) + } + if f.GetName() == MainFilterName { + return fmt.Errorf("%w: '*' is reserved", ErrInvalidFilterName) + } + if top && f.GetName() == "" { + return ErrUnnamedTopFilter + } + if !top && f.GetName() != "" && c.Filters[f.GetName()] == nil { + return fmt.Errorf("%w: '%s'", ErrFilterNotFound, f.GetName()) + } + switch f.GetOp() { + case netmap.AND, netmap.OR: + for _, flt := range f.GetFilters() { + if err := c.processFilter(flt, false); err != nil { + return err + } + } + default: + if len(f.GetFilters()) != 0 { + return ErrNonEmptyFilters + } else if !top && f.GetName() != "" { // named reference + return nil + } + switch f.GetOp() { + case netmap.EQ, netmap.NE: + case netmap.GT, netmap.GE, netmap.LT, netmap.LE: + n, err := strconv.ParseUint(f.GetValue(), 10, 64) + if err != nil { + return fmt.Errorf("%w: '%s'", ErrInvalidNumber, f.GetValue()) + } + c.numCache[f] = n + default: + return fmt.Errorf("%w: %d", ErrInvalidFilterOp, f.GetOp()) + } + } + if top { + c.Filters[f.GetName()] = f + } + return nil +} + +// match matches f against b. It returns no errors because +// filter should have been parsed during context creation +// and missing node properties are considered as a regular fail. +func (c *Context) match(f *netmap.Filter, b *Node) bool { + switch f.GetOp() { + case netmap.AND, netmap.OR: + for _, lf := range f.GetFilters() { + if lf.GetName() != "" { + lf = c.Filters[lf.GetName()] + } + ok := c.match(lf, b) + if ok == (f.GetOp() == netmap.OR) { + return ok + } + } + return f.GetOp() == netmap.AND + default: + return c.matchKeyValue(f, b) + } +} + +func (c *Context) matchKeyValue(f *netmap.Filter, b *Node) bool { + switch f.GetOp() { + case netmap.EQ: + return b.Attribute(f.GetKey()) == f.GetValue() + case netmap.NE: + return b.Attribute(f.GetKey()) != f.GetValue() + default: + var attr uint64 + switch f.GetKey() { + case PriceAttr: + attr = b.Price + case CapacityAttr: + attr = b.Capacity + default: + var err error + attr, err = strconv.ParseUint(b.Attribute(f.GetKey()), 10, 64) + if err != nil { + // Note: because filters are somewhat independent from nodes attributes, + // We don't report an error here, and fail filter instead. + return false + } + } + switch f.GetOp() { + case netmap.GT: + return attr > c.numCache[f] + case netmap.GE: + return attr >= c.numCache[f] + case netmap.LT: + return attr < c.numCache[f] + case netmap.LE: + return attr <= c.numCache[f] + } + } + // will not happen if context was created from f (maybe panic?) + return false +} diff --git a/pkg/netmap/filter_test.go b/pkg/netmap/filter_test.go new file mode 100644 index 0000000..82a5445 --- /dev/null +++ b/pkg/netmap/filter_test.go @@ -0,0 +1,203 @@ +package netmap + +import ( + "errors" + "testing" + + "github.com/nspcc-dev/neofs-api-go/v2/netmap" + "github.com/stretchr/testify/require" +) + +func TestContext_ProcessFilters(t *testing.T) { + fs := []*netmap.Filter{ + newFilter("StorageSSD", "Storage", "SSD", netmap.EQ), + newFilter("GoodRating", "Rating", "4", netmap.GE), + newFilter("Main", "", "", netmap.AND, + newFilter("StorageSSD", "", "", 0), + newFilter("", "IntField", "123", netmap.LT), + newFilter("GoodRating", "", "", 0)), + } + nm, err := NewNetmap(nil) + require.NoError(t, err) + c := NewContext(nm) + p := newPlacementPolicy(1, nil, nil, fs) + require.NoError(t, c.processFilters(p)) + require.Equal(t, 3, len(c.Filters)) + for _, f := range fs { + require.Equal(t, f, c.Filters[f.GetName()]) + } + + require.Equal(t, uint64(4), c.numCache[fs[1]]) + require.Equal(t, uint64(123), c.numCache[fs[2].GetFilters()[1]]) +} + +func TestContext_ProcessFiltersInvalid(t *testing.T) { + errTestCases := []struct { + name string + filter *netmap.Filter + err error + }{ + { + "UnnamedTop", + newFilter("", "Storage", "SSD", netmap.EQ), + ErrUnnamedTopFilter, + }, + { + "InvalidReference", + newFilter("Main", "", "", netmap.AND, + newFilter("StorageSSD", "", "", 0)), + ErrFilterNotFound, + }, + { + "NonEmptyKeyed", + newFilter("Main", "Storage", "SSD", netmap.EQ, + newFilter("StorageSSD", "", "", 0)), + ErrNonEmptyFilters, + }, + { + "InvalidNumber", + newFilter("Main", "Rating", "three", netmap.GE), + ErrInvalidNumber, + }, + { + "InvalidOp", + newFilter("Main", "Rating", "3", netmap.UnspecifiedOperation), + ErrInvalidFilterOp, + }, + { + "InvalidName", + newFilter("*", "Rating", "3", netmap.GE), + ErrInvalidFilterName, + }, + { + "MissingFilter", + nil, + ErrMissingField, + }, + } + for _, tc := range errTestCases { + t.Run(tc.name, func(t *testing.T) { + c := NewContext(new(Netmap)) + p := newPlacementPolicy(1, nil, nil, []*netmap.Filter{tc.filter}) + err := c.processFilters(p) + require.True(t, errors.Is(err, tc.err), "got: %v", err) + }) + } +} + +func TestFilter_MatchSimple(t *testing.T) { + b := &Node{AttrMap: map[string]string{ + "Rating": "4", + "Country": "Germany", + }} + testCases := []struct { + name string + ok bool + f *netmap.Filter + }{ + { + "GE_true", true, + newFilter("Main", "Rating", "4", netmap.GE), + }, + { + "GE_false", false, + newFilter("Main", "Rating", "5", netmap.GE), + }, + { + "GT_true", true, + newFilter("Main", "Rating", "3", netmap.GT), + }, + { + "GT_false", false, + newFilter("Main", "Rating", "4", netmap.GT), + }, + { + "LE_true", true, + newFilter("Main", "Rating", "4", netmap.LE), + }, + { + "LE_false", false, + newFilter("Main", "Rating", "3", netmap.LE), + }, + { + "LT_true", true, + newFilter("Main", "Rating", "5", netmap.LT), + }, + { + "LT_false", false, + newFilter("Main", "Rating", "4", netmap.LT), + }, + { + "EQ_true", true, + newFilter("Main", "Country", "Germany", netmap.EQ), + }, + { + "EQ_false", false, + newFilter("Main", "Country", "China", netmap.EQ), + }, + { + "NE_true", true, + newFilter("Main", "Country", "France", netmap.NE), + }, + { + "NE_false", false, + newFilter("Main", "Country", "Germany", netmap.NE), + }, + } + for _, tc := range testCases { + c := NewContext(new(Netmap)) + p := newPlacementPolicy(1, nil, nil, []*netmap.Filter{tc.f}) + require.NoError(t, c.processFilters(p)) + require.Equal(t, tc.ok, c.match(tc.f, b)) + } + + t.Run("InvalidOp", func(t *testing.T) { + f := newFilter("Main", "Rating", "5", netmap.EQ) + c := NewContext(new(Netmap)) + p := newPlacementPolicy(1, nil, nil, []*netmap.Filter{f}) + require.NoError(t, c.processFilters(p)) + + // just for the coverage + f.SetOp(netmap.UnspecifiedOperation) + require.False(t, c.match(f, b)) + }) +} + +func TestFilter_Match(t *testing.T) { + fs := []*netmap.Filter{ + newFilter("StorageSSD", "Storage", "SSD", netmap.EQ), + newFilter("GoodRating", "Rating", "4", netmap.GE), + newFilter("Main", "", "", netmap.AND, + newFilter("StorageSSD", "", "", 0), + newFilter("", "IntField", "123", netmap.LT), + newFilter("GoodRating", "", "", 0), + newFilter("", "", "", netmap.OR, + newFilter("", "Param", "Value1", netmap.EQ), + newFilter("", "Param", "Value2", netmap.EQ), + )), + } + c := NewContext(new(Netmap)) + p := newPlacementPolicy(1, nil, nil, fs) + require.NoError(t, c.processFilters(p)) + + t.Run("Good", func(t *testing.T) { + n := getTestNode("Storage", "SSD", "Rating", "10", "IntField", "100", "Param", "Value1") + require.True(t, c.applyFilter("Main", n)) + }) + t.Run("InvalidStorage", func(t *testing.T) { + n := getTestNode("Storage", "HDD", "Rating", "10", "IntField", "100", "Param", "Value1") + require.False(t, c.applyFilter("Main", n)) + }) + t.Run("InvalidRating", func(t *testing.T) { + n := getTestNode("Storage", "SSD", "Rating", "3", "IntField", "100", "Param", "Value1") + require.False(t, c.applyFilter("Main", n)) + }) + t.Run("InvalidIntField", func(t *testing.T) { + n := getTestNode("Storage", "SSD", "Rating", "3", "IntField", "str", "Param", "Value1") + require.False(t, c.applyFilter("Main", n)) + }) + t.Run("InvalidParam", func(t *testing.T) { + n := getTestNode("Storage", "SSD", "Rating", "3", "IntField", "100", "Param", "NotValue") + require.False(t, c.applyFilter("Main", n)) + }) +} diff --git a/pkg/netmap/helper_test.go b/pkg/netmap/helper_test.go new file mode 100644 index 0000000..bcf9da5 --- /dev/null +++ b/pkg/netmap/helper_test.go @@ -0,0 +1,61 @@ +package netmap + +import ( + "github.com/nspcc-dev/neofs-api-go/v2/netmap" +) + +func newFilter(name string, k, v string, op netmap.Operation, fs ...*netmap.Filter) *netmap.Filter { + f := new(netmap.Filter) + f.SetName(name) + f.SetKey(k) + f.SetOp(op) + f.SetValue(v) + f.SetFilters(fs) + return f +} + +func newSelector(name string, attr string, c netmap.Clause, count uint32, filter string) *netmap.Selector { + s := new(netmap.Selector) + s.SetName(name) + s.SetAttribute(attr) + s.SetCount(count) + s.SetClause(c) + s.SetFilter(filter) + return s +} + +func newPlacementPolicy(bf uint32, rs []*netmap.Replica, ss []*netmap.Selector, fs []*netmap.Filter) *netmap.PlacementPolicy { + p := new(netmap.PlacementPolicy) + p.SetContainerBackupFactor(bf) + p.SetReplicas(rs) + p.SetSelectors(ss) + p.SetFilters(fs) + return p +} + +func newReplica(c uint32, s string) *netmap.Replica { + r := new(netmap.Replica) + r.SetCount(c) + r.SetSelector(s) + return r +} + +func nodeInfoFromAttributes(props ...string) netmap.NodeInfo { + attrs := make([]*netmap.Attribute, len(props)/2) + for i := range attrs { + attrs[i] = new(netmap.Attribute) + attrs[i].SetKey(props[i*2]) + attrs[i].SetValue(props[i*2+1]) + } + var n netmap.NodeInfo + n.SetAttributes(attrs) + return n +} + +func getTestNode(props ...string) *Node { + m := make(map[string]string, len(props)/2) + for i := 0; i < len(props); i += 2 { + m[props[i]] = props[i+1] + } + return &Node{AttrMap: m} +} diff --git a/pkg/netmap/netmap.go b/pkg/netmap/netmap.go new file mode 100644 index 0000000..b886999 --- /dev/null +++ b/pkg/netmap/netmap.go @@ -0,0 +1,73 @@ +package netmap + +import ( + "fmt" + + "github.com/nspcc-dev/hrw" + "github.com/nspcc-dev/neofs-api-go/v2/netmap" +) + +// Netmap represents netmap which contains preprocessed nodes. +type Netmap struct { + Nodes Nodes +} + +// NewNetmap constructs netmap from the list of raw nodes. +func NewNetmap(nodes Nodes) (*Netmap, error) { + return &Netmap{ + Nodes: nodes, + }, nil +} + +func flattenNodes(ns []Nodes) Nodes { + result := make(Nodes, 0, len(ns)) + for i := range ns { + result = append(result, ns[i]...) + } + return result +} + +// GetPlacementVectors returns placement vectors for an object given containerNodes cnt. +func (m *Netmap) GetPlacementVectors(cnt ContainerNodes, pivot []byte) ([]Nodes, error) { + h := hrw.Hash(pivot) + wf := GetDefaultWeightFunc(m.Nodes) + result := make([]Nodes, len(cnt.Replicas())) + for i, rep := range cnt.Replicas() { + result[i] = make(Nodes, len(rep)) + copy(result[i], rep) + hrw.SortSliceByWeightValue(result[i], result[i].Weights(wf), h) + } + return result, nil +} + +// GetContainerNodes returns nodes corresponding to each replica. +// Order of returned nodes corresponds to order of replicas in p. +// pivot is a seed for HRW sorting. +func (m *Netmap) GetContainerNodes(p *netmap.PlacementPolicy, pivot []byte) (ContainerNodes, error) { + c := NewContext(m) + c.setPivot(pivot) + if err := c.processFilters(p); err != nil { + return nil, err + } + if err := c.processSelectors(p); err != nil { + return nil, err + } + result := make([]Nodes, len(p.GetReplicas())) + for i, r := range p.GetReplicas() { + if r == nil { + return nil, fmt.Errorf("%w: REPLICA", ErrMissingField) + } + if r.GetSelector() == "" { + for _, s := range p.GetSelectors() { + result[i] = append(result[i], flattenNodes(c.Selections[s.GetName()])...) + } + } + nodes, ok := c.Selections[r.GetSelector()] + if !ok { + return nil, fmt.Errorf("%w: REPLICA '%s'", ErrSelectorNotFound, r.GetSelector()) + } + result[i] = append(result[i], flattenNodes(nodes)...) + + } + return containerNodes(result), nil +} diff --git a/pkg/netmap/node_info.go b/pkg/netmap/node_info.go new file mode 100644 index 0000000..4634c8e --- /dev/null +++ b/pkg/netmap/node_info.go @@ -0,0 +1,89 @@ +package netmap + +import ( + "strconv" + + "github.com/nspcc-dev/hrw" + "github.com/nspcc-dev/neofs-api-go/v2/netmap" +) + +type ( + // Node is a wrapper over NodeInfo. + Node struct { + ID uint64 + Index int + Capacity uint64 + Price uint64 + AttrMap map[string]string + + InfoV2 *netmap.NodeInfo + } + + // Nodes represents slice of graph leafs. + Nodes []*Node +) + +// Enumeration of well-known attributes. +const ( + CapacityAttr = "Capacity" + PriceAttr = "Price" +) + +var _ hrw.Hasher = (*Node)(nil) + +// Hash is a function from hrw.Hasher interface. It is implemented +// to support weighted hrw therefore sort function sorts nodes +// based on their `N` value. +func (n Node) Hash() uint64 { + return n.ID +} + +// NodesFromV2 converts slice of v2 netmap.NodeInfo to a generic node slice. +func NodesFromV2(infos []netmap.NodeInfo) Nodes { + nodes := make(Nodes, len(infos)) + for i := range infos { + nodes[i] = newNodeV2(i, &infos[i]) + } + return nodes +} + +func newNodeV2(index int, ni *netmap.NodeInfo) *Node { + n := &Node{ + ID: hrw.Hash(ni.GetPublicKey()), + Index: index, + AttrMap: make(map[string]string, len(ni.GetAttributes())), + InfoV2: ni, + } + for _, attr := range ni.GetAttributes() { + switch attr.GetKey() { + case CapacityAttr: + n.Capacity, _ = strconv.ParseUint(attr.GetValue(), 10, 64) + case PriceAttr: + n.Price, _ = strconv.ParseUint(attr.GetValue(), 10, 64) + } + n.AttrMap[attr.GetKey()] = attr.GetValue() + } + return n +} + +// Weights returns slice of nodes weights W. +func (n Nodes) Weights(wf weightFunc) []float64 { + w := make([]float64, 0, len(n)) + for i := range n { + w = append(w, wf(n[i])) + } + return w +} + +// Attribute returns value of attribute k. +func (n *Node) Attribute(k string) string { + return n.AttrMap[k] +} + +// GetBucketWeight computes weight for a Bucket. +func GetBucketWeight(ns Nodes, a aggregator, wf weightFunc) float64 { + for i := range ns { + a.Add(wf(ns[i])) + } + return a.Compute() +} diff --git a/pkg/netmap/selector.go b/pkg/netmap/selector.go new file mode 100644 index 0000000..73a0669 --- /dev/null +++ b/pkg/netmap/selector.go @@ -0,0 +1,98 @@ +package netmap + +import ( + "fmt" + "sort" + + "github.com/nspcc-dev/hrw" + "github.com/nspcc-dev/neofs-api-go/v2/netmap" +) + +// processSelectors processes selectors and returns error is any of them is invalid. +func (c *Context) processSelectors(p *netmap.PlacementPolicy) error { + for _, s := range p.GetSelectors() { + if s == nil { + return fmt.Errorf("%w: SELECT", ErrMissingField) + } else if s.GetFilter() != MainFilterName { + _, ok := c.Filters[s.GetFilter()] + if !ok { + return fmt.Errorf("%w: SELECT FROM '%s'", ErrFilterNotFound, s.GetFilter()) + } + } + c.Selectors[s.GetName()] = s + result, err := c.getSelection(p, s) + if err != nil { + return err + } + c.Selections[s.GetName()] = result + } + return nil +} + +// GetNodesCount returns amount of buckets and nodes in every bucket +// for a given placement policy. +func GetNodesCount(p *netmap.PlacementPolicy, s *netmap.Selector) (int, int) { + switch s.GetClause() { + case netmap.Same: + return 1, int(p.GetContainerBackupFactor() * s.GetCount()) + default: + return int(s.GetCount()), int(p.GetContainerBackupFactor()) + } +} + +// getSelection returns nodes grouped by s.attribute. +func (c *Context) getSelection(p *netmap.PlacementPolicy, s *netmap.Selector) ([]Nodes, error) { + bucketCount, nodesInBucket := GetNodesCount(p, s) + m := c.getSelectionBase(s) + if len(m) < bucketCount { + return nil, fmt.Errorf("%w: '%s'", ErrNotEnoughNodes, s.GetName()) + } + + keys := make(sort.StringSlice, 0, len(m)) + for k := range m { + keys = append(keys, k) + } + if len(c.pivot) == 0 { + // deterministic order in case of zero seed + keys.Sort() + } + + nodes := make([]Nodes, 0, len(m)) + for i := range keys { + ns := m[keys[i]] + if len(ns) >= nodesInBucket { + nodes = append(nodes, ns[:nodesInBucket]) + } + } + if len(nodes) < bucketCount { + return nil, fmt.Errorf("%w: '%s'", ErrNotEnoughNodes, s.GetName()) + } + if len(c.pivot) != 0 { + weights := make([]float64, len(nodes)) + for i := range nodes { + weights[i] = GetBucketWeight(nodes[i], c.aggregator(), c.weightFunc) + } + hrw.SortSliceByWeightIndex(nodes, weights, c.pivotHash) + } + return nodes[:bucketCount], nil +} + +// getSelectionBase returns nodes grouped by selector attribute. +func (c *Context) getSelectionBase(s *netmap.Selector) map[string]Nodes { + f := c.Filters[s.GetFilter()] + isMain := s.GetFilter() == MainFilterName + result := map[string]Nodes{} + for i := range c.Netmap.Nodes { + if isMain || c.match(f, c.Netmap.Nodes[i]) { + v := c.Netmap.Nodes[i].Attribute(s.GetAttribute()) + result[v] = append(result[v], c.Netmap.Nodes[i]) + } + } + + if len(c.pivot) != 0 { + for _, ns := range result { + hrw.SortSliceByWeightValue(ns, ns.Weights(c.weightFunc), c.pivotHash) + } + } + return result +} diff --git a/pkg/netmap/selector_test.go b/pkg/netmap/selector_test.go new file mode 100644 index 0000000..79f363e --- /dev/null +++ b/pkg/netmap/selector_test.go @@ -0,0 +1,218 @@ +package netmap + +import ( + "errors" + "fmt" + "testing" + + "github.com/nspcc-dev/neofs-api-go/v2/netmap" + "github.com/stretchr/testify/require" +) + +func TestPlacementPolicy_GetPlacementVectors(t *testing.T) { + p := newPlacementPolicy(2, + []*netmap.Replica{ + newReplica(1, "SPB"), + newReplica(2, "Americas"), + }, + []*netmap.Selector{ + newSelector("SPB", "City", netmap.Same, 1, "SPBSSD"), + newSelector("Americas", "City", netmap.Distinct, 2, "Americas"), + }, + []*netmap.Filter{ + newFilter("SPBSSD", "", "", netmap.AND, + newFilter("", "Country", "RU", netmap.EQ), + newFilter("", "City", "St.Petersburg", netmap.EQ), + newFilter("", "SSD", "1", netmap.EQ)), + newFilter("Americas", "", "", netmap.OR, + newFilter("", "Continent", "NA", netmap.EQ), + newFilter("", "Continent", "SA", netmap.EQ)), + }) + nodes := []netmap.NodeInfo{ + nodeInfoFromAttributes("ID", "1", "Country", "RU", "City", "St.Petersburg", "SSD", "0"), + nodeInfoFromAttributes("ID", "2", "Country", "RU", "City", "St.Petersburg", "SSD", "1"), + nodeInfoFromAttributes("ID", "3", "Country", "RU", "City", "Moscow", "SSD", "1"), + nodeInfoFromAttributes("ID", "4", "Country", "RU", "City", "Moscow", "SSD", "1"), + nodeInfoFromAttributes("ID", "5", "Country", "RU", "City", "St.Petersburg", "SSD", "1"), + nodeInfoFromAttributes("ID", "6", "Continent", "NA", "City", "NewYork"), + nodeInfoFromAttributes("ID", "7", "Continent", "AF", "City", "Cairo"), + nodeInfoFromAttributes("ID", "8", "Continent", "AF", "City", "Cairo"), + nodeInfoFromAttributes("ID", "9", "Continent", "SA", "City", "Lima"), + nodeInfoFromAttributes("ID", "10", "Continent", "AF", "City", "Cairo"), + nodeInfoFromAttributes("ID", "11", "Continent", "NA", "City", "NewYork"), + nodeInfoFromAttributes("ID", "12", "Continent", "NA", "City", "LosAngeles"), + nodeInfoFromAttributes("ID", "13", "Continent", "SA", "City", "Lima"), + } + + nm, err := NewNetmap(NodesFromV2(nodes)) + require.NoError(t, err) + v, err := nm.GetContainerNodes(p, nil) + require.NoError(t, err) + require.Equal(t, 2, len(v.Replicas())) + require.Equal(t, 6, len(v.Flatten())) + + require.Equal(t, 2, len(v.Replicas()[0])) + ids := map[string]struct{}{} + for _, ni := range v.Replicas()[0] { + require.Equal(t, "RU", ni.Attribute("Country")) + require.Equal(t, "St.Petersburg", ni.Attribute("City")) + require.Equal(t, "1", ni.Attribute("SSD")) + ids[ni.Attribute("ID")] = struct{}{} + } + require.Equal(t, len(v.Replicas()[0]), len(ids), "not all nodes we distinct") + + require.Equal(t, 4, len(v.Replicas()[1])) // 2 cities * 2 HRWB + ids = map[string]struct{}{} + for _, ni := range v.Replicas()[1] { + require.Contains(t, []string{"NA", "SA"}, ni.Attribute("Continent")) + ids[ni.Attribute("ID")] = struct{}{} + } + require.Equal(t, len(v.Replicas()[1]), len(ids), "not all nodes we distinct") +} + +func TestPlacementPolicy_ProcessSelectors(t *testing.T) { + p := newPlacementPolicy(2, nil, + []*netmap.Selector{ + newSelector("SameRU", "City", netmap.Same, 2, "FromRU"), + newSelector("DistinctRU", "City", netmap.Distinct, 2, "FromRU"), + newSelector("Good", "Country", netmap.Distinct, 2, "Good"), + newSelector("Main", "Country", netmap.Distinct, 3, "*"), + }, + []*netmap.Filter{ + newFilter("FromRU", "Country", "Russia", netmap.EQ), + newFilter("Good", "Rating", "4", netmap.GE), + }) + nodes := []netmap.NodeInfo{ + nodeInfoFromAttributes("Country", "Russia", "Rating", "1", "City", "SPB"), + nodeInfoFromAttributes("Country", "Germany", "Rating", "5", "City", "Berlin"), + nodeInfoFromAttributes("Country", "Russia", "Rating", "6", "City", "Moscow"), + nodeInfoFromAttributes("Country", "France", "Rating", "4", "City", "Paris"), + nodeInfoFromAttributes("Country", "France", "Rating", "1", "City", "Lyon"), + nodeInfoFromAttributes("Country", "Russia", "Rating", "5", "City", "SPB"), + nodeInfoFromAttributes("Country", "Russia", "Rating", "7", "City", "Moscow"), + nodeInfoFromAttributes("Country", "Germany", "Rating", "3", "City", "Darmstadt"), + nodeInfoFromAttributes("Country", "Germany", "Rating", "7", "City", "Frankfurt"), + nodeInfoFromAttributes("Country", "Russia", "Rating", "9", "City", "SPB"), + nodeInfoFromAttributes("Country", "Russia", "Rating", "9", "City", "SPB"), + } + + nm, err := NewNetmap(NodesFromV2(nodes)) + require.NoError(t, err) + c := NewContext(nm) + require.NoError(t, c.processFilters(p)) + require.NoError(t, c.processSelectors(p)) + + for _, s := range p.GetSelectors() { + sel := c.Selections[s.GetName()] + s := c.Selectors[s.GetName()] + bucketCount, nodesInBucket := GetNodesCount(p, s) + targ := fmt.Sprintf("selector '%s'", s.GetName()) + require.Equal(t, bucketCount, len(sel), targ) + for _, res := range sel { + require.Equal(t, nodesInBucket, len(res), targ) + for j := range res { + require.True(t, c.applyFilter(s.GetFilter(), res[j]), targ) + } + } + } + +} + +func TestPlacementPolicy_ProcessSelectorsHRW(t *testing.T) { + p := newPlacementPolicy(1, nil, + []*netmap.Selector{ + newSelector("Main", "Country", netmap.Distinct, 3, "*"), + }, nil) + + // bucket weight order: RU > DE > FR + nodes := []netmap.NodeInfo{ + nodeInfoFromAttributes("Country", "Germany", PriceAttr, "2", CapacityAttr, "10000"), + nodeInfoFromAttributes("Country", "Germany", PriceAttr, "4", CapacityAttr, "1"), + nodeInfoFromAttributes("Country", "France", PriceAttr, "3", CapacityAttr, "10"), + nodeInfoFromAttributes("Country", "Russia", PriceAttr, "2", CapacityAttr, "10000"), + nodeInfoFromAttributes("Country", "Russia", PriceAttr, "1", CapacityAttr, "10000"), + nodeInfoFromAttributes("Country", "Russia", CapacityAttr, "10000"), + nodeInfoFromAttributes("Country", "France", PriceAttr, "100", CapacityAttr, "1"), + nodeInfoFromAttributes("Country", "France", PriceAttr, "7", CapacityAttr, "10000"), + nodeInfoFromAttributes("Country", "Russia", PriceAttr, "2", CapacityAttr, "1"), + } + nm, err := NewNetmap(NodesFromV2(nodes)) + require.NoError(t, err) + c := NewContext(nm) + c.setPivot([]byte("containerID")) + c.weightFunc = newWeightFunc(newMaxNorm(10000), newReverseMinNorm(1)) + c.aggregator = newMaxAgg + require.NoError(t, c.processFilters(p)) + require.NoError(t, c.processSelectors(p)) + + cnt := c.Selections["Main"] + expected := []Nodes{ + {{Index: 4, Capacity: 10000, Price: 1}}, // best RU + {{Index: 0, Capacity: 10000, Price: 2}}, // best DE + {{Index: 7, Capacity: 10000, Price: 7}}, // best FR + } + require.Equal(t, len(expected), len(cnt)) + for i := range expected { + require.Equal(t, len(expected[i]), len(cnt[i])) + require.Equal(t, expected[i][0].Index, cnt[i][0].Index) + require.Equal(t, expected[i][0].Capacity, cnt[i][0].Capacity) + require.Equal(t, expected[i][0].Price, cnt[i][0].Price) + } + + res, err := nm.GetPlacementVectors(containerNodes(cnt), []byte("objectID")) + require.NoError(t, err) + require.Equal(t, res, cnt) +} + +func TestPlacementPolicy_ProcessSelectorsInvalid(t *testing.T) { + testCases := []struct { + name string + p *netmap.PlacementPolicy + err error + }{ + { + "MissingSelector", + newPlacementPolicy(2, nil, + []*netmap.Selector{nil}, + []*netmap.Filter{}), + ErrMissingField, + }, + { + "InvalidFilterReference", + newPlacementPolicy(1, nil, + []*netmap.Selector{newSelector("MyStore", "Country", netmap.Distinct, 1, "FromNL")}, + []*netmap.Filter{newFilter("FromRU", "Country", "Russia", netmap.EQ)}), + ErrFilterNotFound, + }, + { + "NotEnoughNodes (backup factor)", + newPlacementPolicy(2, nil, + []*netmap.Selector{newSelector("MyStore", "Country", netmap.Distinct, 1, "FromRU")}, + []*netmap.Filter{newFilter("FromRU", "Country", "Russia", netmap.EQ)}), + ErrNotEnoughNodes, + }, + { + "NotEnoughNodes (buckets)", + newPlacementPolicy(1, nil, + []*netmap.Selector{newSelector("MyStore", "Country", netmap.Distinct, 2, "FromRU")}, + []*netmap.Filter{newFilter("FromRU", "Country", "Russia", netmap.EQ)}), + ErrNotEnoughNodes, + }, + } + nodes := []netmap.NodeInfo{ + nodeInfoFromAttributes("Country", "Russia"), + nodeInfoFromAttributes("Country", "Germany"), + nodeInfoFromAttributes(), + } + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + nm, err := NewNetmap(NodesFromV2(nodes)) + require.NoError(t, err) + c := NewContext(nm) + require.NoError(t, c.processFilters(tc.p)) + + err = c.processSelectors(tc.p) + require.True(t, errors.Is(err, tc.err), "got: %v", err) + }) + } +} From 524280a5e8c2d9fb96a0e5e9cd077908711d0ad8 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 10 Sep 2020 12:57:29 +0300 Subject: [PATCH 0398/1196] [#140] sdk: Refactor reference types Refactor v2-compatible reference types to be wrappers over corresponding types from v2. Signed-off-by: Leonard Lyubich --- pkg/client/container.go | 16 ++--------- pkg/client/object.go | 5 +--- pkg/container/id.go | 45 ++++++++++-------------------- pkg/container/id_test.go | 7 ++--- pkg/object/address.go | 60 ++++++++++------------------------------ pkg/object/id.go | 48 ++++++++++---------------------- pkg/object/id_test.go | 7 ++--- pkg/object/object.go | 35 +++-------------------- pkg/owner/id.go | 58 +++++++++++--------------------------- pkg/owner/id_test.go | 7 ++--- 10 files changed, 73 insertions(+), 215 deletions(-) diff --git a/pkg/client/container.go b/pkg/client/container.go index 67301c7..a874af8 100644 --- a/pkg/client/container.go +++ b/pkg/client/container.go @@ -140,14 +140,7 @@ func (c Client) putContainerV2(ctx context.Context, cnr *container.Container, op return nil, errors.Wrap(err, "can't verify response message") } - cidV2 := resp.GetBody().GetContainerID() - - cid, err := container.IDFromV2(cidV2) - if err != nil { - return nil, errors.Wrapf(err, "could not convert %T to %T", cidV2, cid) - } - - return cid, nil + return container.NewIDFromV2(resp.GetBody().GetContainerID()), nil default: return nil, unsupportedProtocolErr } @@ -235,12 +228,7 @@ func (c Client) listContainerV2(ctx context.Context, owner *owner.ID, opts ...Ca result := make([]*container.ID, 0, len(resp.GetBody().GetContainerIDs())) for _, cidV2 := range resp.GetBody().GetContainerIDs() { - cid, err := container.IDFromV2(cidV2) - if err != nil { - return nil, errors.Wrapf(err, "could not convert %T to %T", cidV2, cid) - } - - result = append(result, cid) + result = append(result, container.NewIDFromV2(cidV2)) } return result, nil diff --git a/pkg/client/object.go b/pkg/client/object.go index a5323cf..5ef8e59 100644 --- a/pkg/client/object.go +++ b/pkg/client/object.go @@ -262,10 +262,7 @@ func (c *Client) putObjectV2(ctx context.Context, p *PutObjectParams, opts ...Ca } // convert object identifier - id, err := object.IDFromV2(resp.GetBody().GetObjectID()) - if err != nil { - return nil, errors.Wrap(err, "could not convert object identifier") - } + id := object.NewIDFromV2(resp.GetBody().GetObjectID()) return id, nil } diff --git a/pkg/container/id.go b/pkg/container/id.go index 5046798..dae7bf4 100644 --- a/pkg/container/id.go +++ b/pkg/container/id.go @@ -4,44 +4,29 @@ import ( "crypto/sha256" "github.com/nspcc-dev/neofs-api-go/v2/refs" - "github.com/pkg/errors" ) -// ID represents container identifier -// that supports different type of values. -type ID struct { - val []byte +// ID represents v2-compatible container identifier. +type ID refs.ContainerID + +// NewIDFromV2 wraps v2 ContainerID message to ID. +func NewIDFromV2(idV2 *refs.ContainerID) *ID { + return (*ID)(idV2) +} + +// NewID creates and initializes blank ID. +// +// Works similar to NewIDFromV2(new(ContainerID)). +func NewID() *ID { + return NewIDFromV2(new(refs.ContainerID)) } // SetSHA256 sets container identifier value to SHA256 checksum. func (id *ID) SetSHA256(v [sha256.Size]byte) { - if id != nil { - id.val = v[:] - } + (*refs.ContainerID)(id).SetValue(v[:]) } // ToV2 returns the v2 container ID message. func (id *ID) ToV2() *refs.ContainerID { - if id != nil { - idV2 := new(refs.ContainerID) - idV2.SetValue(id.val) - - return idV2 - } - - return nil -} - -func IDFromV2(idV2 *refs.ContainerID) (*ID, error) { - val := idV2.GetValue() - if ln := len(val); ln != sha256.Size { - return nil, errors.Errorf( - "could not convert %T to %T: expected length %d, received %d", - idV2, (*ID)(nil), sha256.Size, ln, - ) - } - - return &ID{ - val: val, - }, nil + return (*refs.ContainerID)(id) } diff --git a/pkg/container/id_test.go b/pkg/container/id_test.go index 245f433..a5ae05e 100644 --- a/pkg/container/id_test.go +++ b/pkg/container/id_test.go @@ -9,7 +9,7 @@ import ( ) func TestIDV2_0(t *testing.T) { - cid := new(ID) + cid := NewID() checksum := [sha256.Size]byte{} @@ -20,8 +20,5 @@ func TestIDV2_0(t *testing.T) { cidV2 := cid.ToV2() - cid2, err := IDFromV2(cidV2) - require.NoError(t, err) - - require.Equal(t, cid, cid2) + require.Equal(t, checksum[:], cidV2.GetValue()) } diff --git a/pkg/object/address.go b/pkg/object/address.go index 37bd0ae..af8271a 100644 --- a/pkg/object/address.go +++ b/pkg/object/address.go @@ -1,60 +1,28 @@ package object import ( - "github.com/nspcc-dev/neofs-api-go/pkg/container" "github.com/nspcc-dev/neofs-api-go/v2/refs" "github.com/pkg/errors" ) -// Address represents address of NeoFS object. -type Address struct { - cid *container.ID +// Address represents v2-compatible object address. +type Address refs.Address - oid *ID +// NewAddressFromV2 converts v2 Address message to Address. +func NewAddressFromV2(aV2 *refs.Address) *Address { + return (*Address)(aV2) +} + +// NewAddress creates and initializes blank Address. +// +// Works similar as NewAddressFromV2(new(Address)). +func NewAddress() *Address { + return NewAddressFromV2(new(refs.Address)) } // ToV2 converts Address to v2 Address message. func (a *Address) ToV2() *refs.Address { - if a != nil { - aV2 := new(refs.Address) - aV2.SetContainerID(a.cid.ToV2()) - aV2.SetObjectID(a.oid.ToV2()) - - return aV2 - } - - return nil -} - -// GetObjectIDV2 converts object identifier to v2 ObjectID message. -func (a *Address) GetObjectIDV2() *refs.ObjectID { - if a != nil { - return a.oid.ToV2() - } - - return nil -} - -// AddressFromV2 converts v2 Address message to Address. -func AddressFromV2(aV2 *refs.Address) (*Address, error) { - if aV2 == nil { - return nil, nil - } - - oid, err := IDFromV2(aV2.GetObjectID()) - if err != nil { - return nil, errors.Wrap(err, "could not convert object identifier") - } - - cid, err := container.IDFromV2(aV2.GetContainerID()) - if err != nil { - return nil, errors.Wrap(err, "could not convert container identifier") - } - - return &Address{ - cid: cid, - oid: oid, - }, nil + return (*refs.Address)(a) } // AddressFromBytes restores Address from a binary representation. @@ -64,5 +32,5 @@ func AddressFromBytes(data []byte) (*Address, error) { return nil, errors.Wrap(err, "could not unmarshal object address") } - return AddressFromV2(addrV2) + return NewAddressFromV2(addrV2), nil } diff --git a/pkg/object/id.go b/pkg/object/id.go index f7a3a1f..7006d6f 100644 --- a/pkg/object/id.go +++ b/pkg/object/id.go @@ -4,47 +4,29 @@ import ( "crypto/sha256" "github.com/nspcc-dev/neofs-api-go/v2/refs" - "github.com/pkg/errors" ) -// ID represents object identifier that -// supports different type of values. -type ID struct { - val []byte +// ID represents v2-compatible object identifier. +type ID refs.ObjectID + +// NewIDFromV2 wraps v2 ObjectID message to ID. +func NewIDFromV2(idV2 *refs.ObjectID) *ID { + return (*ID)(idV2) +} + +// NewID creates and initializes blank ID. +// +// Works similar as NewIDFromV2(new(ObjectID)). +func NewID() *ID { + return NewIDFromV2(new(refs.ObjectID)) } // SetSHA256 sets object identifier value to SHA256 checksum. func (id *ID) SetSHA256(v [sha256.Size]byte) { - if id != nil { - id.val = v[:] - } + (*refs.ObjectID)(id).SetValue(v[:]) } // ToV2 converts ID to v2 ObjectID message. func (id *ID) ToV2() *refs.ObjectID { - if id != nil { - idV2 := new(refs.ObjectID) - idV2.SetValue(id.val) - - return idV2 - } - - return nil -} - -// IDFromV2 converts v2 ObjectID message to ID. -// -// Returns an error if the format of the identifier -// in the message is broken. -func IDFromV2(idV2 *refs.ObjectID) (*ID, error) { - val := idV2.GetValue() - if ln := len(val); ln != sha256.Size { - return nil, errors.Errorf("could not convert %T to %T: invalid length %d", - idV2, (*ID)(nil), ln, - ) - } - - return &ID{ - val: val, - }, nil + return (*refs.ObjectID)(id) } diff --git a/pkg/object/id_test.go b/pkg/object/id_test.go index bbf29cf..e1ab763 100644 --- a/pkg/object/id_test.go +++ b/pkg/object/id_test.go @@ -9,7 +9,7 @@ import ( ) func TestIDV2(t *testing.T) { - id := new(ID) + id := NewID() checksum := [sha256.Size]byte{} @@ -20,8 +20,5 @@ func TestIDV2(t *testing.T) { idV2 := id.ToV2() - id2, err := IDFromV2(idV2) - require.NoError(t, err) - - require.Equal(t, id, id2) + require.Equal(t, checksum[:], idV2.GetValue()) } diff --git a/pkg/object/object.go b/pkg/object/object.go index 2d96002..b0353c5 100644 --- a/pkg/object/object.go +++ b/pkg/object/object.go @@ -59,7 +59,7 @@ func (o *Object) Verify() error { hdrChecksum := sha256.Sum256(data) - if !bytes.Equal(hdrChecksum[:], o.id.val) { + if !bytes.Equal(hdrChecksum[:], o.id.ToV2().GetValue()) { return errors.New("invalid object identifier") } @@ -77,18 +77,6 @@ func (o *Object) Verify() error { return nil } -// Address returns address of the object. -func (o *Object) Address() *Address { - if o != nil { - return &Address{ - cid: o.cid, - oid: o.id, - } - } - - return nil -} - // GetPayload returns object payload bytes. func (o *Object) GetPayload() []byte { if o != nil { @@ -201,23 +189,8 @@ func FromV2(oV2 *object.Object) (*Object, error) { return nil, nil } - id, err := IDFromV2(oV2.GetObjectID()) - if err != nil { - return nil, errors.Wrap(err, "could not convert object ID") - } - hdr := oV2.GetHeader() - ownerID, err := owner.IDFromV2(hdr.GetOwnerID()) - if err != nil { - return nil, errors.Wrap(err, "could not convert owner ID") - } - - cid, err := container.IDFromV2(hdr.GetContainerID()) - if err != nil { - return nil, errors.Wrap(err, "could not convert container ID") - } - // TODO: convert other fields sig := oV2.GetSignature() @@ -225,11 +198,11 @@ func FromV2(oV2 *object.Object) (*Object, error) { return &Object{ rwObject: rwObject{ fin: true, - id: id, + id: NewIDFromV2(oV2.GetObjectID()), key: sig.GetKey(), sig: sig.GetSign(), - cid: cid, - ownerID: ownerID, + cid: container.NewIDFromV2(hdr.GetContainerID()), + ownerID: owner.NewIDFromV2(hdr.GetOwnerID()), payloadChecksum: hdr.GetPayloadHash(), payload: oV2.GetPayload(), }, diff --git a/pkg/owner/id.go b/pkg/owner/id.go index 235559b..d333963 100644 --- a/pkg/owner/id.go +++ b/pkg/owner/id.go @@ -1,64 +1,38 @@ package owner import ( - "crypto/sha256" - "github.com/mr-tron/base58" "github.com/nspcc-dev/neo-go/pkg/encoding/address" "github.com/nspcc-dev/neofs-api-go/v2/refs" - "github.com/pkg/errors" ) -// ID represents owner identifier that -// supports different type of values. -type ID struct { - val []byte +// ID represents v2-compatible owner identifier. +type ID refs.OwnerID + +// NewIDFromV2 wraps v2 OwnerID message to ID. +func NewIDFromV2(idV2 *refs.OwnerID) *ID { + return (*ID)(idV2) +} + +// NewID creates and initializes blank ID. +// +// Works similar as NewIDFromV2(new(OwnerID)). +func NewID() *ID { + return NewIDFromV2(new(refs.OwnerID)) } // SetNeo3Wallet sets owner identifier value to NEO3 wallet address. func (id *ID) SetNeo3Wallet(v *NEO3Wallet) { - if id != nil { - id.val = v.Bytes() - } + (*refs.OwnerID)(id).SetValue(v.Bytes()) } // ToV2 returns the v2 owner ID message. func (id *ID) ToV2() *refs.OwnerID { - if id != nil { - idV2 := new(refs.OwnerID) - idV2.SetValue(id.val) - - return idV2 - } - - return nil -} - -// IDFromV2 converts owner ID v2 structure to ID. -func IDFromV2(idV2 *refs.OwnerID) (*ID, error) { - if idV2 == nil { - return nil, nil - } - - val := idV2.GetValue() - if ln := len(val); ln != 25 { - return nil, errors.Errorf( - "could not convert %T to %T: expected length %d, received %d", - idV2, (*ID)(nil), sha256.Size, ln, - ) - } - - return &ID{ - val: val, - }, nil + return (*refs.OwnerID)(id) } func (id *ID) String() string { - if id != nil { - return base58.Encode(id.val) - } - - return "" + return base58.Encode((*refs.OwnerID)(id).GetValue()) } func ScriptHashBE(id *ID) ([]byte, error) { diff --git a/pkg/owner/id_test.go b/pkg/owner/id_test.go index e7f9ef9..e0b0f8a 100644 --- a/pkg/owner/id_test.go +++ b/pkg/owner/id_test.go @@ -8,7 +8,7 @@ import ( ) func TestIDV2(t *testing.T) { - id := new(ID) + id := NewID() wallet := new(NEO3Wallet) @@ -19,8 +19,5 @@ func TestIDV2(t *testing.T) { idV2 := id.ToV2() - id2, err := IDFromV2(idV2) - require.NoError(t, err) - - require.Equal(t, id, id2) + require.Equal(t, wallet.Bytes(), idV2.GetValue()) } From e0c34a51f2ea030aab6d4a9bf971dc6cfcdf30b1 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 10 Sep 2020 14:29:11 +0300 Subject: [PATCH 0399/1196] [#140] sdk: Refactor version type Signed-off-by: Leonard Lyubich --- pkg/client/accounting.go | 2 +- pkg/client/client.go | 4 +-- pkg/client/container.go | 10 +++--- pkg/client/object.go | 12 +++---- pkg/client/opts.go | 6 ++-- pkg/version.go | 69 +++++++++++++++++++++++++++++++--------- pkg/version_test.go | 31 ++++++++++++++++++ 7 files changed, 102 insertions(+), 32 deletions(-) create mode 100644 pkg/version_test.go diff --git a/pkg/client/accounting.go b/pkg/client/accounting.go index 4642c9d..92c5e12 100644 --- a/pkg/client/accounting.go +++ b/pkg/client/accounting.go @@ -25,7 +25,7 @@ func (c Client) GetSelfBalance(ctx context.Context, opts ...CallOption) (*accoun func (c Client) GetBalance(ctx context.Context, owner *owner.ID, opts ...CallOption) (*accounting.Decimal, error) { // check remote node version - switch c.remoteNode.Version.Major { + switch c.remoteNode.Version.GetMajor() { case 2: return c.getBalanceV2(ctx, owner, opts...) default: diff --git a/pkg/client/client.go b/pkg/client/client.go index 8187afd..e5e8e3b 100644 --- a/pkg/client/client.go +++ b/pkg/client/client.go @@ -18,7 +18,7 @@ type ( TransportProtocol uint32 TransportInfo struct { - Version pkg.Version + Version *pkg.Version Protocol TransportProtocol } ) @@ -42,7 +42,7 @@ func New(key *ecdsa.PrivateKey, opts ...ClientOption) (*Client, error) { return &Client{ key: key, remoteNode: TransportInfo{ - Version: pkg.SDKVersion, + Version: pkg.SDKVersion(), Protocol: GRPC, }, opts: clientOptions, diff --git a/pkg/client/container.go b/pkg/client/container.go index a874af8..2888ebc 100644 --- a/pkg/client/container.go +++ b/pkg/client/container.go @@ -26,7 +26,7 @@ func (c delContainerSignWrapper) SignedDataSize() int { } func (c Client) PutContainer(ctx context.Context, cnr *container.Container, opts ...CallOption) (*container.ID, error) { - switch c.remoteNode.Version.Major { + switch c.remoteNode.Version.GetMajor() { case 2: return c.putContainerV2(ctx, cnr, opts...) default: @@ -35,7 +35,7 @@ func (c Client) PutContainer(ctx context.Context, cnr *container.Container, opts } func (c Client) GetContainer(ctx context.Context, id *container.ID, opts ...CallOption) (*container.Container, error) { - switch c.remoteNode.Version.Major { + switch c.remoteNode.Version.GetMajor() { case 2: return c.getContainerV2(ctx, id, opts...) default: @@ -44,7 +44,7 @@ func (c Client) GetContainer(ctx context.Context, id *container.ID, opts ...Call } func (c Client) ListContainers(ctx context.Context, owner *owner.ID, opts ...CallOption) ([]*container.ID, error) { - switch c.remoteNode.Version.Major { + switch c.remoteNode.Version.GetMajor() { case 2: return c.listContainerV2(ctx, owner, opts...) default: @@ -65,7 +65,7 @@ func (c Client) ListSelfContainers(ctx context.Context, opts ...CallOption) ([]* } func (c Client) DeleteContainer(ctx context.Context, id *container.ID, opts ...CallOption) error { - switch c.remoteNode.Version.Major { + switch c.remoteNode.Version.GetMajor() { case 2: return c.delContainerV2(ctx, id, opts...) default: @@ -84,7 +84,7 @@ func (c Client) putContainerV2(ctx context.Context, cnr *container.Container, op } // set transport version - cnr.SetVersion(c.remoteNode.Version.ToV2Version()) + cnr.SetVersion(c.remoteNode.Version.ToV2()) // if container owner is not set, then use client key as owner if cnr.GetOwnerID() == nil { diff --git a/pkg/client/object.go b/pkg/client/object.go index 5ef8e59..e7edcd0 100644 --- a/pkg/client/object.go +++ b/pkg/client/object.go @@ -165,7 +165,7 @@ func (p *PutObjectParams) WithPayloadReader(v io.Reader) *PutObjectParams { func (c *Client) PutObject(ctx context.Context, p *PutObjectParams, opts ...CallOption) (*object.ID, error) { // check remote node version - switch c.remoteNode.Version.Major { + switch c.remoteNode.Version.GetMajor() { case 2: return c.putObjectV2(ctx, p, opts...) default: @@ -277,7 +277,7 @@ func (p *DeleteObjectParams) WithAddress(v *object.Address) *DeleteObjectParams func (c *Client) DeleteObject(ctx context.Context, p *DeleteObjectParams, opts ...CallOption) error { // check remote node version - switch c.remoteNode.Version.Major { + switch c.remoteNode.Version.GetMajor() { case 2: return c.deleteObjectV2(ctx, p, opts...) default: @@ -350,7 +350,7 @@ func (p *GetObjectParams) WithPayloadWriter(w io.Writer) *GetObjectParams { func (c *Client) GetObject(ctx context.Context, p *GetObjectParams, opts ...CallOption) (*object.Object, error) { // check remote node version - switch c.remoteNode.Version.Major { + switch c.remoteNode.Version.GetMajor() { case 2: return c.getObjectV2(ctx, p, opts...) default: @@ -481,7 +481,7 @@ func (p *ObjectHeaderParams) WithMainFields() *ObjectHeaderParams { func (c *Client) GetObjectHeader(ctx context.Context, p *ObjectHeaderParams, opts ...CallOption) (*object.Object, error) { // check remote node version - switch c.remoteNode.Version.Major { + switch c.remoteNode.Version.GetMajor() { case 2: return c.getObjectHeaderV2(ctx, p, opts...) default: @@ -609,7 +609,7 @@ func (p *RangeDataParams) WithDataWriter(v io.Writer) *RangeDataParams { func (c *Client) ObjectPayloadRangeData(ctx context.Context, p *RangeDataParams, opts ...CallOption) ([]byte, error) { // check remote node version - switch c.remoteNode.Version.Major { + switch c.remoteNode.Version.GetMajor() { case 2: return c.objectPayloadRangeV2(ctx, p, opts...) default: @@ -744,7 +744,7 @@ func (c *Client) ObjectPayloadRangeTZ(ctx context.Context, p *RangeChecksumParam func (c *Client) objectPayloadRangeHash(ctx context.Context, p *RangeChecksumParams, opts ...CallOption) (interface{}, error) { // check remote node version - switch c.remoteNode.Version.Major { + switch c.remoteNode.Version.GetMajor() { case 2: return c.objectPayloadRangeHashV2(ctx, p, opts...) default: diff --git a/pkg/client/opts.go b/pkg/client/opts.go index ba7202c..de37e2c 100644 --- a/pkg/client/opts.go +++ b/pkg/client/opts.go @@ -23,7 +23,7 @@ type ( } callOptions struct { - version pkg.Version + version *pkg.Version xHeaders []xHeader ttl uint32 epoch uint64 @@ -49,7 +49,7 @@ type ( func defaultCallOptions() callOptions { return callOptions{ ttl: 2, - version: pkg.SDKVersion, + version: pkg.SDKVersion(), } } @@ -93,7 +93,7 @@ func WithEpoch(epoch uint64) CallOption { func v2MetaHeaderFromOpts(options callOptions) *v2session.RequestMetaHeader { meta := new(v2session.RequestMetaHeader) - meta.SetVersion(options.version.ToV2Version()) + meta.SetVersion(options.version.ToV2()) meta.SetTTL(options.ttl) meta.SetEpoch(options.epoch) diff --git a/pkg/version.go b/pkg/version.go index 333e597..6ffc54c 100644 --- a/pkg/version.go +++ b/pkg/version.go @@ -6,23 +6,62 @@ import ( "github.com/nspcc-dev/neofs-api-go/v2/refs" ) -type ( - Version struct { - Major uint32 - Minor uint32 - } -) +// Version represents v2-compatible version. +type Version refs.Version -var SDKVersion = Version{2, 0} +const sdkMjr, sdkMnr = 2, 0 -func (v Version) String() string { - return fmt.Sprintf("v%d.%d", v.Major, v.Minor) +// NewVersionFromV2 wraps v2 Version message to Version. +func NewVersionFromV2(v *refs.Version) *Version { + return (*Version)(v) } -func (v Version) ToV2Version() *refs.Version { - result := new(refs.Version) - result.SetMajor(v.Major) - result.SetMinor(v.Minor) - - return result +// NewVersion creates and initializes blank Version. +// +// Works similar as NewVersionFromV2(new(Version)). +func NewVersion() *Version { + return NewVersionFromV2(new(refs.Version)) +} + +// SDKVersion returns Version instance that +// initialized to current SDK revision number. +func SDKVersion() *Version { + v := NewVersion() + v.SetMajor(sdkMjr) + v.SetMinor(sdkMnr) + + return v +} + +// GetMajor returns major number of the revision. +func (v *Version) GetMajor() uint32 { + return (*refs.Version)(v). + GetMajor() +} + +// SetMajor sets major number of the revision. +func (v *Version) SetMajor(val uint32) { + (*refs.Version)(v). + SetMajor(val) +} + +// GetMinor returns minor number of the revision. +func (v *Version) GetMinor() uint32 { + return (*refs.Version)(v). + GetMinor() +} + +// SetMinor sets minor number of the revision. +func (v *Version) SetMinor(val uint32) { + (*refs.Version)(v). + SetMinor(val) +} + +// ToV2 converts Version to v2 Version message. +func (v *Version) ToV2() *refs.Version { + return (*refs.Version)(v) +} + +func (v *Version) String() string { + return fmt.Sprintf("v%d.%d", v.GetMajor(), v.GetMinor()) } diff --git a/pkg/version_test.go b/pkg/version_test.go new file mode 100644 index 0000000..18e842a --- /dev/null +++ b/pkg/version_test.go @@ -0,0 +1,31 @@ +package pkg + +import ( + "testing" + + "github.com/stretchr/testify/require" +) + +func TestNewVersionFromV2(t *testing.T) { + v := NewVersion() + + var mjr, mnr uint32 = 1, 2 + + v.SetMajor(mjr) + v.SetMinor(mnr) + + require.Equal(t, mjr, v.GetMajor()) + require.Equal(t, mnr, v.GetMinor()) + + ver := v.ToV2() + + require.Equal(t, mjr, ver.GetMajor()) + require.Equal(t, mnr, ver.GetMinor()) +} + +func TestSDKVersion(t *testing.T) { + v := SDKVersion() + + require.Equal(t, uint32(sdkMjr), v.GetMajor()) + require.Equal(t, uint32(sdkMnr), v.GetMinor()) +} From 5902f96f3e7d81e2deffa354ddfafe0539141d05 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 10 Sep 2020 14:30:29 +0300 Subject: [PATCH 0400/1196] [#140] sdk: Define checksum type Signed-off-by: Leonard Lyubich --- pkg/checksum.go | 74 ++++++++++++++++++++++++++++++++++++++++++++ pkg/checksum_test.go | 40 ++++++++++++++++++++++++ 2 files changed, 114 insertions(+) create mode 100644 pkg/checksum.go create mode 100644 pkg/checksum_test.go diff --git a/pkg/checksum.go b/pkg/checksum.go new file mode 100644 index 0000000..4fa84cd --- /dev/null +++ b/pkg/checksum.go @@ -0,0 +1,74 @@ +package pkg + +import ( + "crypto/sha256" + + "github.com/nspcc-dev/neofs-api-go/v2/refs" +) + +// Checksum represents v2-compatible checksum. +type Checksum refs.Checksum + +// ChecksumType represents the enumeration +// of checksum types. +type ChecksumType uint8 + +const ( + // ChecksumUnknown is an undefined checksum type. + ChecksumUnknown ChecksumType = iota + + // ChecksumSHA256 is a SHA256 checksum type. + ChecksumSHA256 + + // ChecksumTZ is a Tillich-Zemor checksum type. + ChecksumTZ +) + +// NewChecksumFromV2 wraps v2 Checksum message to Checksum. +func NewChecksumFromV2(cV2 *refs.Checksum) *Checksum { + return (*Checksum)(cV2) +} + +// NewVersion creates and initializes blank Version. +// +// Works similar as NewVersionFromV2(new(Version)). +func NewChecksum() *Checksum { + return NewChecksumFromV2(new(refs.Checksum)) +} + +// GetType returns checksum type. +func (c *Checksum) GetType() ChecksumType { + switch (*refs.Checksum)(c).GetType() { + case refs.SHA256: + return ChecksumSHA256 + case refs.TillichZemor: + return ChecksumTZ + default: + return ChecksumUnknown + } +} + +// GetSum returns checksum bytes. +func (c *Checksum) GetSum() []byte { + return (*refs.Checksum)(c).GetSum() +} + +// SetSHA256 sets checksum to SHA256 hash. +func (c *Checksum) SetSHA256(v [sha256.Size]byte) { + checksum := (*refs.Checksum)(c) + + checksum.SetType(refs.SHA256) + checksum.SetSum(v[:]) +} + +// SetTillichZemor sets checksum to Tillich-Zemor hash. +func (c *Checksum) SetTillichZemor(v [64]byte) { + checksum := (*refs.Checksum)(c) + + checksum.SetType(refs.TillichZemor) + checksum.SetSum(v[:]) +} + +func (c *Checksum) ToV2() *refs.Checksum { + return (*refs.Checksum)(c) +} diff --git a/pkg/checksum_test.go b/pkg/checksum_test.go new file mode 100644 index 0000000..e0da6ef --- /dev/null +++ b/pkg/checksum_test.go @@ -0,0 +1,40 @@ +package pkg + +import ( + "crypto/rand" + "crypto/sha256" + "testing" + + "github.com/nspcc-dev/neofs-api-go/v2/refs" + "github.com/stretchr/testify/require" +) + +func TestChecksum(t *testing.T) { + c := NewChecksum() + + cSHA256 := [sha256.Size]byte{} + _, _ = rand.Read(cSHA256[:]) + + c.SetSHA256(cSHA256) + + require.Equal(t, ChecksumSHA256, c.GetType()) + require.Equal(t, cSHA256[:], c.GetSum()) + + cV2 := c.ToV2() + + require.Equal(t, refs.SHA256, cV2.GetType()) + require.Equal(t, cSHA256[:], cV2.GetSum()) + + cTZ := [64]byte{} + _, _ = rand.Read(cSHA256[:]) + + c.SetTillichZemor(cTZ) + + require.Equal(t, ChecksumTZ, c.GetType()) + require.Equal(t, cTZ[:], c.GetSum()) + + cV2 = c.ToV2() + + require.Equal(t, refs.TillichZemor, cV2.GetType()) + require.Equal(t, cTZ[:], cV2.GetSum()) +} From 20d644758be63ae4cc18c31daf686a34706313ac Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 10 Sep 2020 14:49:17 +0300 Subject: [PATCH 0401/1196] [#140] sdk/object: Define Attribute type Signed-off-by: Leonard Lyubich --- pkg/object/attribute.go | 45 ++++++++++++++++++++++++++++++++++++ pkg/object/attribute_test.go | 23 ++++++++++++++++++ 2 files changed, 68 insertions(+) create mode 100644 pkg/object/attribute.go create mode 100644 pkg/object/attribute_test.go diff --git a/pkg/object/attribute.go b/pkg/object/attribute.go new file mode 100644 index 0000000..0b43bcc --- /dev/null +++ b/pkg/object/attribute.go @@ -0,0 +1,45 @@ +package object + +import ( + "github.com/nspcc-dev/neofs-api-go/v2/object" +) + +// Attribute represents v2-compatible object attribute. +type Attribute object.Attribute + +// NewAttributeFromV2 wraps v2 Attribute message to Attribute. +func NewAttributeFromV2(aV2 *object.Attribute) *Attribute { + return (*Attribute)(aV2) +} + +// NewAttribute creates and initializes blank Attribute. +// +// Works similar as NewAttributeFromV2(new(Attribute)). +func NewAttribute() *Attribute { + return NewAttributeFromV2(new(object.Attribute)) +} + +// GetKey returns key to the object attribute. +func (a *Attribute) GetKey() string { + return (*object.Attribute)(a).GetKey() +} + +// SetKey sets key to the object attribute. +func (a *Attribute) SetKey(v string) { + (*object.Attribute)(a).SetKey(v) +} + +// GetValue return value of the object attribute. +func (a *Attribute) GetValue() string { + return (*object.Attribute)(a).GetValue() +} + +// SetValue sets value of the object attribute. +func (a *Attribute) SetValue(v string) { + (*object.Attribute)(a).SetValue(v) +} + +// ToV2 converts Attribute to v2 Attribute message. +func (a *Attribute) ToV2() *object.Attribute { + return (*object.Attribute)(a) +} diff --git a/pkg/object/attribute_test.go b/pkg/object/attribute_test.go new file mode 100644 index 0000000..cc503e4 --- /dev/null +++ b/pkg/object/attribute_test.go @@ -0,0 +1,23 @@ +package object + +import ( + "testing" + + "github.com/stretchr/testify/require" +) + +func TestAttribute(t *testing.T) { + key, val := "some key", "some value" + + a := NewAttribute() + a.SetKey(key) + a.SetValue(val) + + require.Equal(t, key, a.GetKey()) + require.Equal(t, val, a.GetValue()) + + aV2 := a.ToV2() + + require.Equal(t, key, aV2.GetKey()) + require.Equal(t, val, aV2.GetValue()) +} From e40995b5d4d92ffab7f57bc7234acb1738f4e9a1 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 10 Sep 2020 16:10:33 +0300 Subject: [PATCH 0402/1196] [#140] sdk: Define Signature type Signed-off-by: Leonard Lyubich --- pkg/signature.go | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 pkg/signature.go diff --git a/pkg/signature.go b/pkg/signature.go new file mode 100644 index 0000000..7322c50 --- /dev/null +++ b/pkg/signature.go @@ -0,0 +1,44 @@ +package pkg + +import ( + "github.com/nspcc-dev/neofs-api-go/v2/refs" +) + +// Signature represents v2-compatible signature. +type Signature refs.Signature + +// NewSignatureFromV2 wraps v2 Signature message to Signature. +func NewSignatureFromV2(sV2 *refs.Signature) *Signature { + return (*Signature)(sV2) +} + +// NewSignature creates and initializes blank Signature. +// +// Works similar as NewSignatureFromV2(new(Signature)). +func NewSignature() *Signature { + return NewSignatureFromV2(new(refs.Signature)) +} + +// GetKey sets binary public key. +func (s *Signature) GetKey() []byte { + return (*refs.Signature)(s).GetKey() +} + +// SetKey returns binary public key. +func (s *Signature) SetKey(v []byte) { + (*refs.Signature)(s).SetKey(v) +} + +// GetSign return signature value. +func (s *Signature) GetSign() []byte { + return (*refs.Signature)(s).GetSign() +} + +// SetSign sets signature value. +func (s *Signature) SetSign(v []byte) { + (*refs.Signature)(s).SetSign(v) +} + +func (s *Signature) ToV2() *refs.Signature { + return (*refs.Signature)(s) +} From 6ce70d4a18e920f6fd0e67a90e09ce57ffc321ef Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 10 Sep 2020 16:11:12 +0300 Subject: [PATCH 0403/1196] [#140] sdk/object: Refactor object types Signed-off-by: Leonard Lyubich --- pkg/object/object.go | 217 +++------------------------------ pkg/object/raw.go | 120 ++++++++++++------ pkg/object/raw_test.go | 204 +++++++++++++++++++++++++++++++ pkg/object/rw.go | 269 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 574 insertions(+), 236 deletions(-) create mode 100644 pkg/object/raw_test.go create mode 100644 pkg/object/rw.go diff --git a/pkg/object/object.go b/pkg/object/object.go index b0353c5..c743414 100644 --- a/pkg/object/object.go +++ b/pkg/object/object.go @@ -1,21 +1,10 @@ package object import ( - "bytes" - "crypto/ecdsa" - "crypto/sha256" - - "github.com/nspcc-dev/neofs-api-go/pkg/container" - "github.com/nspcc-dev/neofs-api-go/pkg/owner" - "github.com/nspcc-dev/neofs-api-go/util/signature" "github.com/nspcc-dev/neofs-api-go/v2/object" - "github.com/nspcc-dev/neofs-api-go/v2/refs" - signatureV2 "github.com/nspcc-dev/neofs-api-go/v2/signature" - crypto "github.com/nspcc-dev/neofs-crypto" - "github.com/pkg/errors" ) -// Object represents NeoFS object that provides +// Object represents v2-compatible NeoFS object that provides // a convenient interface for working in isolation // from the internal structure of an object. // @@ -23,198 +12,28 @@ import ( // mode as a reflection of the immutability of objects // in the system. type Object struct { - rwObject + *rwObject } -type rwObject struct { - fin bool - - id *ID - - key, sig []byte - - cid *container.ID - - ownerID *owner.ID - - payloadChecksum *refs.Checksum - - payload []byte - - // TODO: add other fields -} - -// Verify checks if object structure is correct. -func (o *Object) Verify() error { - if o == nil { - return nil - } - - hdr := o.v2Header() - - data, err := hdr.StableMarshal(nil) - if err != nil { - return errors.Wrap(err, "could not marshal header") - } - - hdrChecksum := sha256.Sum256(data) - - if !bytes.Equal(hdrChecksum[:], o.id.ToV2().GetValue()) { - return errors.New("invalid object identifier") - } - - if err := signature.VerifyDataWithSource( - signatureV2.StableMarshalerWrapper{ - SM: o.id.ToV2(), - }, - func() (key, sig []byte) { - return o.key, o.sig - }, - ); err != nil { - return errors.Wrap(err, "invalid object ID signature") - } - - return nil -} - -// GetPayload returns object payload bytes. -func (o *Object) GetPayload() []byte { - if o != nil { - return o.payload - } - - return nil -} - -// CutPayload copies object fields w/o payload. -func (o *Object) CutPayload() *Object { - if o != nil { - return &Object{ - rwObject: rwObject{ - fin: o.fin, - id: o.id, - key: o.key, - sig: o.sig, - cid: o.cid, - ownerID: o.ownerID, - payloadChecksum: o.payloadChecksum, - }, - } - } - - return nil -} - -func (o *rwObject) v2Header() *object.Header { - hV2 := new(object.Header) - hV2.SetContainerID(o.cid.ToV2()) - hV2.SetOwnerID(o.ownerID.ToV2()) - hV2.SetPayloadHash(o.payloadChecksum) - // TODO: set other fields - - return hV2 -} - -func (o *rwObject) complete(key *ecdsa.PrivateKey) (*object.Header, error) { - hdr := o.v2Header() - - hdrData, err := hdr.StableMarshal(nil) - if err != nil { - return nil, errors.Wrap(err, "could not marshal header") - } - - o.id = new(ID) - o.id.SetSHA256(sha256.Sum256(hdrData)) - - if err := signature.SignDataWithHandler( - key, - signatureV2.StableMarshalerWrapper{ - SM: o.id.ToV2(), - }, - func(key []byte, sig []byte) { - o.key, o.sig = key, sig - }, - ); err != nil { - return nil, errors.Wrap(err, "could sign object identifier") - } - - o.fin = true - - return hdr, nil -} - -// ToV2 calculates object identifier, signs structure and converts -// it to v2 Object message. -func (o *rwObject) ToV2(key *ecdsa.PrivateKey) (*object.Object, error) { - if o == nil { - return nil, nil - } - - var ( - hdr *object.Header - err error - ) - - if !o.fin { - if key == nil { - return nil, errors.Wrap(crypto.ErrEmptyPrivateKey, "could complete the object") - } - - if hdr, err = o.complete(key); err != nil { - return nil, errors.Wrapf(err, "could not complete the object") - } - } else { - hdr = o.v2Header() - } - - obj := new(object.Object) - obj.SetObjectID(o.id.ToV2()) - obj.SetHeader(hdr) - obj.SetPayload(o.payload) - - sig := new(refs.Signature) - sig.SetKey(o.key) - sig.SetSign(o.sig) - obj.SetSignature(sig) - - return obj, nil -} - -// FromV2 converts v2 Object message to Object instance. -// -// Returns any error encountered which prevented the -// recovery of object data from the message. -func FromV2(oV2 *object.Object) (*Object, error) { - if oV2 == nil { - return nil, nil - } - - hdr := oV2.GetHeader() - - // TODO: convert other fields - - sig := oV2.GetSignature() - +// NewFromV2 wraps v2 Object message to Object. +func NewFromV2(oV2 *object.Object) *Object { return &Object{ - rwObject: rwObject{ - fin: true, - id: NewIDFromV2(oV2.GetObjectID()), - key: sig.GetKey(), - sig: sig.GetSign(), - cid: container.NewIDFromV2(hdr.GetContainerID()), - ownerID: owner.NewIDFromV2(hdr.GetOwnerID()), - payloadChecksum: hdr.GetPayloadHash(), - payload: oV2.GetPayload(), - }, - }, nil + rwObject: (*rwObject)(oV2), + } } -// FromBytes restores Object from a binary representation. -func FromBytes(data []byte) (*Object, error) { - oV2 := new(object.Object) - if err := oV2.StableUnmarshal(data); err != nil { - return nil, errors.Wrap(err, "could not unmarshal object") +// New creates and initializes blank Object. +// +// Works similar as NewFromV2(new(Object)). +func New() *Object { + return NewFromV2(initObjectRecursive()) +} + +// ToV2 converts Object to v2 Object message. +func (o *Object) ToV2() *object.Object { + if o != nil { + return (*object.Object)(o.rwObject) } - return FromV2(oV2) + return nil } diff --git a/pkg/object/raw.go b/pkg/object/raw.go index ffd9f21..18edac3 100644 --- a/pkg/object/raw.go +++ b/pkg/object/raw.go @@ -1,45 +1,35 @@ package object import ( - "crypto/sha256" - + "github.com/nspcc-dev/neofs-api-go/pkg" "github.com/nspcc-dev/neofs-api-go/pkg/container" "github.com/nspcc-dev/neofs-api-go/pkg/owner" - "github.com/nspcc-dev/neofs-api-go/v2/refs" + "github.com/nspcc-dev/neofs-api-go/v2/object" ) -// RawObject represents NeoFS object that provides +// RawObject represents v2-compatible NeoFS object that provides // a convenient interface to fill in the fields of // an object in isolation from its internal structure. type RawObject struct { - rwObject + *rwObject } -func (o *RawObject) set(setter func()) { - o.fin = false - setter() -} - -// SetContainerID sets object's container identifier. -func (o *RawObject) SetContainerID(v *container.ID) { - if o != nil { - o.set(func() { - o.cid = v - }) +// NewRawFromV2 wraps v2 Object message to RawObject. +func NewRawFromV2(oV2 *object.Object) *RawObject { + return &RawObject{ + rwObject: (*rwObject)(oV2), } } -// SetOwnerID sets identifier of the object's owner. -func (o *RawObject) SetOwnerID(v *owner.ID) { - if o != nil { - o.set(func() { - o.ownerID = v - }) - } +// NewRaw creates and initializes blank RawObject. +// +// Works similar as NewRawFromV2(new(Object)). +func NewRaw() *RawObject { + return NewRawFromV2(initObjectRecursive()) } -// Release returns read-only Object instance. -func (o *RawObject) Release() *Object { +// Object returns read-only object instance. +func (o *RawObject) Object() *Object { if o != nil { return &Object{ rwObject: o.rwObject, @@ -49,16 +39,72 @@ func (o *RawObject) Release() *Object { return nil } -// SetPayloadChecksumSHA256 sets payload checksum as a SHA256 checksum. -func (o *RawObject) SetPayloadChecksumSHA256(v [sha256.Size]byte) { - if o != nil { - o.set(func() { - if o.payloadChecksum == nil { - o.payloadChecksum = new(refs.Checksum) - } - - o.payloadChecksum.SetType(refs.SHA256) - o.payloadChecksum.SetSum(v[:]) - }) - } +// SetID sets object identifier. +func (o *RawObject) SetID(v *ID) { + o.setID(v) +} + +// SetSignature sets signature of the object identifier. +func (o *RawObject) SetSignature(v *pkg.Signature) { + o.setSignature(v) +} + +// SetPayload sets payload bytes. +func (o *RawObject) SetPayload(v []byte) { + o.setPayload(v) +} + +// SetVersion sets version of the object. +func (o *RawObject) SetVersion(v *pkg.Version) { + o.setVersion(v) +} + +// SetPayloadSize sets payload length of the object. +func (o *RawObject) SetPayloadSize(v uint64) { + o.setPayloadSize(v) +} + +// SetContainerID sets identifier of the related container. +func (o *RawObject) SetContainerID(v *container.ID) { + o.setContainerID(v) +} + +// SetOwnerID sets identifier of the object owner. +func (o *RawObject) SetOwnerID(v *owner.ID) { + o.setOwnerID(v) +} + +// SetCreationEpoch sets epoch number in which object was created. +func (o *RawObject) SetCreationEpoch(v uint64) { + o.setCreationEpoch(v) +} + +// SetPayloadChecksum sets checksum of the object payload. +func (o *RawObject) SetPayloadChecksum(v *pkg.Checksum) { + o.setPayloadChecksum(v) +} + +// SetPayloadHomomorphicHash sets homomorphic hash of the object payload. +func (o *RawObject) SetPayloadHomomorphicHash(v *pkg.Checksum) { + o.setPayloadHomomorphicHash(v) +} + +// SetAttributes sets object attributes. +func (o *RawObject) SetAttributes(v ...*Attribute) { + o.setAttributes(v...) +} + +// SetPreviousID sets identifier of the previous sibling object. +func (o *RawObject) SetPreviousID(v *ID) { + o.setPreviousID(v) +} + +// SetChildren sets list of the identifiers of the child objects. +func (o *RawObject) SetChildren(v ...*ID) { + o.setChildren(v...) +} + +// SetParent sets parent object w/o payload. +func (o *RawObject) SetParent(v *Object) { + o.setParent(v) } diff --git a/pkg/object/raw_test.go b/pkg/object/raw_test.go new file mode 100644 index 0000000..e585d13 --- /dev/null +++ b/pkg/object/raw_test.go @@ -0,0 +1,204 @@ +package object + +import ( + "crypto/rand" + "crypto/sha256" + "testing" + + "github.com/nspcc-dev/neofs-api-go/pkg" + "github.com/nspcc-dev/neofs-api-go/pkg/container" + "github.com/nspcc-dev/neofs-api-go/pkg/owner" + "github.com/nspcc-dev/neofs-api-go/v2/object" + "github.com/stretchr/testify/require" +) + +func randID(t *testing.T) *ID { + id := NewID() + id.SetSHA256(randSHA256Checksum(t)) + + return id +} + +func randSHA256Checksum(t *testing.T) (cs [sha256.Size]byte) { + _, err := rand.Read(cs[:]) + require.NoError(t, err) + + return +} + +func randTZChecksum(t *testing.T) (cs [64]byte) { + _, err := rand.Read(cs[:]) + require.NoError(t, err) + + return +} + +func TestRawObject_SetID(t *testing.T) { + obj := NewRaw() + + id := randID(t) + + obj.SetID(id) + + require.Equal(t, id, obj.GetID()) +} + +func TestRawObject_SetSignature(t *testing.T) { + obj := NewRaw() + + sig := pkg.NewSignature() + sig.SetKey([]byte{1, 2, 3}) + sig.SetSign([]byte{4, 5, 6}) + + obj.SetSignature(sig) + + require.Equal(t, sig, obj.GetSignature()) +} + +func TestRawObject_SetPayload(t *testing.T) { + obj := NewRaw() + + payload := make([]byte, 10) + _, _ = rand.Read(payload) + + obj.SetPayload(payload) + + require.Equal(t, payload, obj.GetPayload()) +} + +func TestRawObject_SetVersion(t *testing.T) { + obj := NewRaw() + + ver := pkg.NewVersion() + ver.SetMajor(1) + ver.SetMinor(2) + + obj.SetVersion(ver) + + require.Equal(t, ver, obj.GetVersion()) +} + +func TestRawObject_SetPayloadSize(t *testing.T) { + obj := NewRaw() + + sz := uint64(133) + obj.SetPayloadSize(sz) + + require.Equal(t, sz, obj.GetPayloadSize()) +} + +func TestRawObject_SetContainerID(t *testing.T) { + obj := NewRaw() + + checksum := randSHA256Checksum(t) + + cid := container.NewID() + cid.SetSHA256(checksum) + + obj.SetContainerID(cid) + + require.Equal(t, cid, obj.GetContainerID()) +} + +func TestRawObject_SetOwnerID(t *testing.T) { + obj := NewRaw() + + w := new(owner.NEO3Wallet) + _, _ = rand.Read(w.Bytes()) + + ownerID := owner.NewID() + ownerID.SetNeo3Wallet(w) + + obj.SetOwnerID(ownerID) + + require.Equal(t, ownerID, obj.GetOwnerID()) +} + +func TestRawObject_SetCreationEpoch(t *testing.T) { + obj := NewRaw() + + creat := uint64(228) + obj.setCreationEpoch(creat) + + require.Equal(t, creat, obj.GetCreationEpoch()) +} + +func TestRawObject_SetPayloadChecksum(t *testing.T) { + obj := NewRaw() + + cs := pkg.NewChecksum() + cs.SetSHA256(randSHA256Checksum(t)) + + obj.SetPayloadChecksum(cs) + + require.Equal(t, cs, obj.GetPayloadChecksum()) +} + +func TestRawObject_SetPayloadHomomorphicHash(t *testing.T) { + obj := NewRaw() + + cs := pkg.NewChecksum() + cs.SetTillichZemor(randTZChecksum(t)) + + obj.SetPayloadHomomorphicHash(cs) + + require.Equal(t, cs, obj.GetPayloadHomomorphicHash()) +} + +func TestRawObject_SetAttributes(t *testing.T) { + obj := NewRaw() + + a1 := NewAttribute() + a1.SetKey("key1") + a1.SetValue("val1") + + a2 := NewAttribute() + a2.SetKey("key2") + a2.SetValue("val2") + + obj.SetAttributes(a1, a2) + + require.Equal(t, []*Attribute{a1, a2}, obj.GetAttributes()) +} + +func TestRawObject_SetPreviousID(t *testing.T) { + obj := NewRaw() + + prev := randID(t) + + obj.SetPreviousID(prev) + + require.Equal(t, prev, obj.GetPreviousID()) +} + +func TestRawObject_SetChildren(t *testing.T) { + obj := NewRaw() + + id1 := randID(t) + id2 := randID(t) + + obj.SetChildren(id1, id2) + + require.Equal(t, []*ID{id1, id2}, obj.GetChildren()) +} + +func TestRawObject_SetParent(t *testing.T) { + obj := NewRaw() + + par := NewRaw() + par.SetID(randID(t)) + parObj := par.Object() + + obj.SetParent(parObj) + + require.Equal(t, parObj, obj.GetParent()) +} + +func TestRawObject_ToV2(t *testing.T) { + objV2 := new(object.Object) + objV2.SetPayload([]byte{1, 2, 3}) + + obj := NewRawFromV2(objV2) + + require.Equal(t, objV2, obj.ToV2()) +} diff --git a/pkg/object/rw.go b/pkg/object/rw.go new file mode 100644 index 0000000..a9c7647 --- /dev/null +++ b/pkg/object/rw.go @@ -0,0 +1,269 @@ +package object + +import ( + "github.com/nspcc-dev/neofs-api-go/pkg" + "github.com/nspcc-dev/neofs-api-go/pkg/container" + "github.com/nspcc-dev/neofs-api-go/pkg/owner" + "github.com/nspcc-dev/neofs-api-go/v2/object" + "github.com/nspcc-dev/neofs-api-go/v2/refs" +) + +// wrapper over v2 Object that provides +// public getter and private setters. +type rwObject object.Object + +func initObjectRecursive() *object.Object { + obj := new(object.Object) + + hdr := new(object.Header) + + hdr.SetSplit(new(object.SplitHeader)) + + obj.SetHeader(hdr) + + return obj +} + +// TODO: add session token methods + +// ToV2 converts Object to v2 Object message. +func (o *rwObject) ToV2() *object.Object { + return (*object.Object)(o) +} + +// GetID returns object identifier. +func (o *rwObject) GetID() *ID { + return NewIDFromV2( + (*object.Object)(o). + GetObjectID(), + ) +} + +func (o *rwObject) setID(v *ID) { + (*object.Object)(o). + SetObjectID(v.ToV2()) +} + +// GetSignature returns signature of the object identifier. +func (o *rwObject) GetSignature() *pkg.Signature { + return pkg.NewSignatureFromV2( + (*object.Object)(o). + GetSignature(), + ) +} + +func (o *rwObject) setSignature(v *pkg.Signature) { + (*object.Object)(o). + SetSignature(v.ToV2()) +} + +// GetPayload returns payload bytes. +func (o *rwObject) GetPayload() []byte { + return (*object.Object)(o). + GetPayload() +} + +func (o *rwObject) setPayload(v []byte) { + (*object.Object)(o). + SetPayload(v) +} + +// GetVersion returns version of the object. +func (o *rwObject) GetVersion() *pkg.Version { + return pkg.NewVersionFromV2( + (*object.Object)(o). + GetHeader(). + GetVersion(), + ) +} + +func (o *rwObject) setVersion(v *pkg.Version) { + (*object.Object)(o). + GetHeader(). + SetVersion(v.ToV2()) +} + +// GetPayloadSize returns payload length of the object. +func (o *rwObject) GetPayloadSize() uint64 { + return (*object.Object)(o). + GetHeader(). + GetPayloadLength() +} + +func (o *rwObject) setPayloadSize(v uint64) { + (*object.Object)(o). + GetHeader(). + SetPayloadLength(v) +} + +// GetContainerID returns identifier of the related container. +func (o *rwObject) GetContainerID() *container.ID { + return container.NewIDFromV2( + (*object.Object)(o). + GetHeader(). + GetContainerID(), + ) +} + +func (o *rwObject) setContainerID(v *container.ID) { + (*object.Object)(o). + GetHeader(). + SetContainerID(v.ToV2()) +} + +// GetOwnerID returns identifier of the object owner. +func (o *rwObject) GetOwnerID() *owner.ID { + return owner.NewIDFromV2( + (*object.Object)(o). + GetHeader(). + GetOwnerID(), + ) +} + +func (o *rwObject) setOwnerID(v *owner.ID) { + (*object.Object)(o). + GetHeader(). + SetOwnerID(v.ToV2()) +} + +// GetCreationEpoch returns epoch number in which object was created. +func (o *rwObject) GetCreationEpoch() uint64 { + return (*object.Object)(o). + GetHeader(). + GetCreationEpoch() +} + +func (o *rwObject) setCreationEpoch(v uint64) { + (*object.Object)(o). + GetHeader(). + SetCreationEpoch(v) +} + +// GetPayloadChecksum returns checksum of the object payload. +func (o *rwObject) GetPayloadChecksum() *pkg.Checksum { + return pkg.NewChecksumFromV2( + (*object.Object)(o). + GetHeader(). + GetPayloadHash(), + ) +} + +func (o *rwObject) setPayloadChecksum(v *pkg.Checksum) { + (*object.Object)(o). + GetHeader(). + SetPayloadHash(v.ToV2()) +} + +// GetPayloadHomomorphicHash returns homomorphic hash of the object payload. +func (o *rwObject) GetPayloadHomomorphicHash() *pkg.Checksum { + return pkg.NewChecksumFromV2( + (*object.Object)(o). + GetHeader(). + GetHomomorphicHash(), + ) +} + +func (o *rwObject) setPayloadHomomorphicHash(v *pkg.Checksum) { + (*object.Object)(o). + GetHeader(). + SetHomomorphicHash(v.ToV2()) +} + +// GetAttributes returns object attributes. +func (o *rwObject) GetAttributes() []*Attribute { + attrs := (*object.Object)(o). + GetHeader(). + GetAttributes() + + res := make([]*Attribute, 0, len(attrs)) + + for i := range attrs { + res = append(res, NewAttributeFromV2(attrs[i])) + } + + return res +} + +func (o *rwObject) setAttributes(v ...*Attribute) { + h := (*object.Object)(o). + GetHeader() + + attrs := make([]*object.Attribute, 0, len(v)) + + for i := range v { + attrs = append(attrs, v[i].ToV2()) + } + + h.SetAttributes(attrs) +} + +// GetPreviousID returns identifier of the previous sibling object. +func (o *rwObject) GetPreviousID() *ID { + return NewIDFromV2( + (*object.Object)(o). + GetHeader(). + GetSplit(). + GetPrevious(), + ) +} + +func (o *rwObject) setPreviousID(v *ID) { + (*object.Object)(o). + GetHeader(). + GetSplit(). + SetPrevious(v.ToV2()) +} + +// GetChildren return list of the identifiers of the child objects. +func (o *rwObject) GetChildren() []*ID { + ids := (*object.Object)(o). + GetHeader(). + GetSplit(). + GetChildren() + + res := make([]*ID, 0, len(ids)) + + for i := range ids { + res = append(res, NewIDFromV2(ids[i])) + } + + return res +} + +func (o *rwObject) setChildren(v ...*ID) { + h := (*object.Object)(o). + GetHeader(). + GetSplit() + + ids := make([]*refs.ObjectID, 0, len(v)) + + for i := range v { + ids = append(ids, v[i].ToV2()) + } + + h.SetChildren(ids) +} + +// GetParent returns parent object w/o payload. +func (o *rwObject) GetParent() *Object { + h := (*object.Object)(o). + GetHeader(). + GetSplit() + + oV2 := new(object.Object) + oV2.SetObjectID(h.GetParent()) + oV2.SetSignature(h.GetParentSignature()) + oV2.SetHeader(h.GetParentHeader()) + + return NewFromV2(oV2) +} + +func (o *rwObject) setParent(v *Object) { + h := (*object.Object)(o). + GetHeader(). + GetSplit() + + h.SetParent((*object.Object)(v.rwObject).GetObjectID()) + h.SetParentSignature((*object.Object)(v.rwObject).GetSignature()) + h.SetParentHeader((*object.Object)(v.rwObject).GetHeader()) +} From 5473b4ef956c7df25827649afaa8d643dfd8bf88 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 11 Sep 2020 18:18:02 +0300 Subject: [PATCH 0404/1196] [#140] sdk: Implement checksum comparison function Signed-off-by: Leonard Lyubich --- pkg/checksum.go | 5 +++++ pkg/checksum_test.go | 20 ++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/pkg/checksum.go b/pkg/checksum.go index 4fa84cd..2a93b39 100644 --- a/pkg/checksum.go +++ b/pkg/checksum.go @@ -1,6 +1,7 @@ package pkg import ( + "bytes" "crypto/sha256" "github.com/nspcc-dev/neofs-api-go/v2/refs" @@ -72,3 +73,7 @@ func (c *Checksum) SetTillichZemor(v [64]byte) { func (c *Checksum) ToV2() *refs.Checksum { return (*refs.Checksum)(c) } + +func EqualChecksums(cs1, cs2 *Checksum) bool { + return cs1.GetType() == cs2.GetType() && bytes.Equal(cs1.GetSum(), cs2.GetSum()) +} diff --git a/pkg/checksum_test.go b/pkg/checksum_test.go index e0da6ef..906f68b 100644 --- a/pkg/checksum_test.go +++ b/pkg/checksum_test.go @@ -38,3 +38,23 @@ func TestChecksum(t *testing.T) { require.Equal(t, refs.TillichZemor, cV2.GetType()) require.Equal(t, cTZ[:], cV2.GetSum()) } + +func TestEqualChecksums(t *testing.T) { + require.True(t, EqualChecksums(nil, nil)) + + csSHA := [sha256.Size]byte{} + _, _ = rand.Read(csSHA[:]) + + cs1 := NewChecksum() + cs1.SetSHA256(csSHA) + + cs2 := NewChecksum() + cs2.SetSHA256(csSHA) + + require.True(t, EqualChecksums(cs1, cs2)) + + csSHA[0]++ + cs2.SetSHA256(csSHA) + + require.False(t, EqualChecksums(cs1, cs2)) +} From bfdf8a452fdc63833c206fa24021bb3c0be0f6a9 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 11 Sep 2020 18:18:29 +0300 Subject: [PATCH 0405/1196] [#140] sdk/object: Implement ID comparison method Signed-off-by: Leonard Lyubich --- pkg/object/id.go | 9 +++++++++ pkg/object/id_test.go | 16 ++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/pkg/object/id.go b/pkg/object/id.go index 7006d6f..c7eb573 100644 --- a/pkg/object/id.go +++ b/pkg/object/id.go @@ -1,6 +1,7 @@ package object import ( + "bytes" "crypto/sha256" "github.com/nspcc-dev/neofs-api-go/v2/refs" @@ -26,6 +27,14 @@ func (id *ID) SetSHA256(v [sha256.Size]byte) { (*refs.ObjectID)(id).SetValue(v[:]) } +// Equal returns true if identifiers are identical. +func (id *ID) Equal(id2 *ID) bool { + return bytes.Equal( + (*ID)(id).ToV2().GetValue(), + (*ID)(id2).ToV2().GetValue(), + ) +} + // ToV2 converts ID to v2 ObjectID message. func (id *ID) ToV2() *refs.ObjectID { return (*refs.ObjectID)(id) diff --git a/pkg/object/id_test.go b/pkg/object/id_test.go index e1ab763..373fa01 100644 --- a/pkg/object/id_test.go +++ b/pkg/object/id_test.go @@ -22,3 +22,19 @@ func TestIDV2(t *testing.T) { require.Equal(t, checksum[:], idV2.GetValue()) } + +func TestID_Equal(t *testing.T) { + cs := randSHA256Checksum(t) + + id1 := NewID() + id1.SetSHA256(cs) + + id2 := NewID() + id2.SetSHA256(cs) + + id3 := NewID() + id3.SetSHA256(randSHA256Checksum(t)) + + require.True(t, id1.Equal(id2)) + require.False(t, id1.Equal(id3)) +} From 4fd6839473a025f59b309c3671363da238129a4f Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 11 Sep 2020 18:19:36 +0300 Subject: [PATCH 0406/1196] [#140] sdk/object: Implement object format control functions Implement function for calculating, setting and checking object verification fields. Signed-off-by: Leonard Lyubich --- pkg/object/fmt.go | 157 +++++++++++++++++++++++++++++++++++++++++ pkg/object/fmt_test.go | 79 +++++++++++++++++++++ 2 files changed, 236 insertions(+) create mode 100644 pkg/object/fmt.go create mode 100644 pkg/object/fmt_test.go diff --git a/pkg/object/fmt.go b/pkg/object/fmt.go new file mode 100644 index 0000000..61a08b6 --- /dev/null +++ b/pkg/object/fmt.go @@ -0,0 +1,157 @@ +package object + +import ( + "crypto/ecdsa" + "crypto/sha256" + + "github.com/nspcc-dev/neofs-api-go/pkg" + "github.com/nspcc-dev/neofs-api-go/util/signature" + signatureV2 "github.com/nspcc-dev/neofs-api-go/v2/signature" + "github.com/pkg/errors" +) + +// CalculatePayloadChecksum calculates and returns checksum of +// object payload bytes. +func CalculatePayloadChecksum(payload []byte) *pkg.Checksum { + res := pkg.NewChecksum() + res.SetSHA256(sha256.Sum256(payload)) + + return res +} + +// CalculateAndSetPayloadChecksum calculates checksum of current +// object payload and writes it to the object. +func CalculateAndSetPayloadChecksum(obj *RawObject) { + obj.SetPayloadChecksum( + CalculatePayloadChecksum(obj.GetPayload()), + ) +} + +// VerifyPayloadChecksum checks if payload checksum in the object +// corresponds to its payload. +func VerifyPayloadChecksum(obj *Object) error { + if !pkg.EqualChecksums( + obj.GetPayloadChecksum(), + CalculatePayloadChecksum(obj.GetPayload()), + ) { + return errors.New("payload checksum mismatch") + } + + return nil +} + +// CalculateID calculates identifier for the object. +func CalculateID(obj *Object) (*ID, error) { + data, err := obj.ToV2().GetHeader().StableMarshal(nil) + if err != nil { + return nil, err + } + + id := NewID() + id.SetSHA256(sha256.Sum256(data)) + + return id, nil +} + +// CalculateAndSetID calculates identifier for the object +// and writes the result to it. +func CalculateAndSetID(obj *RawObject) error { + id, err := CalculateID(obj.Object()) + if err != nil { + return err + } + + obj.SetID(id) + + return nil +} + +// VerifyID checks if identifier in the object corresponds to +// its structure. +func VerifyID(obj *Object) error { + id, err := CalculateID(obj) + if err != nil { + return err + } + + if !id.Equal(obj.GetID()) { + return errors.New("incorrect object identifier") + } + + return nil +} + +func CalculateIDSignature(key *ecdsa.PrivateKey, id *ID) (*pkg.Signature, error) { + sig := pkg.NewSignature() + + if err := signature.SignDataWithHandler( + key, + signatureV2.StableMarshalerWrapper{ + SM: id.ToV2(), + }, + func(key, sign []byte) { + sig.SetKey(key) + sig.SetSign(sign) + }, + ); err != nil { + return nil, err + } + + return sig, nil +} + +func CalculateAndSetSignature(key *ecdsa.PrivateKey, obj *RawObject) error { + sig, err := CalculateIDSignature(key, obj.GetID()) + if err != nil { + return err + } + + obj.SetSignature(sig) + + return nil +} + +func VerifyIDSignature(obj *Object) error { + return signature.VerifyDataWithSource( + signatureV2.StableMarshalerWrapper{ + SM: obj.GetID().ToV2(), + }, + func() ([]byte, []byte) { + sig := obj.GetSignature() + + return sig.GetKey(), sig.GetSign() + }, + ) +} + +// SetVerificationFields calculates and sets all verification fields of the object. +func SetVerificationFields(key *ecdsa.PrivateKey, obj *RawObject) error { + CalculateAndSetPayloadChecksum(obj) + + if err := CalculateAndSetID(obj); err != nil { + return errors.Wrap(err, "could not set identifier") + } + + if err := CalculateAndSetSignature(key, obj); err != nil { + return errors.Wrap(err, "could not set signature") + } + + return nil +} + +// CheckVerificationFields checks all verification fields of the object. +func CheckVerificationFields(obj *Object) error { + if err := VerifyIDSignature(obj); err != nil { + return errors.Wrap(err, "invalid signature") + } + + if err := VerifyID(obj); err != nil { + return errors.Wrap(err, "invalid identifier") + } + + if err := VerifyPayloadChecksum(obj); err != nil { + return errors.Wrap(err, "invalid payload checksum") + } + + return nil +} diff --git a/pkg/object/fmt_test.go b/pkg/object/fmt_test.go new file mode 100644 index 0000000..5a65e49 --- /dev/null +++ b/pkg/object/fmt_test.go @@ -0,0 +1,79 @@ +package object + +import ( + "crypto/rand" + "testing" + + "github.com/nspcc-dev/neofs-crypto/test" + "github.com/stretchr/testify/require" +) + +func TestVerificationFields(t *testing.T) { + obj := NewRaw() + + payload := make([]byte, 10) + _, _ = rand.Read(payload) + + obj.SetPayload(payload) + obj.SetPayloadSize(uint64(len(payload))) + + require.NoError(t, SetVerificationFields(test.DecodeKey(-1), obj)) + + require.NoError(t, CheckVerificationFields(obj.Object())) + + items := []struct { + corrupt func() + restore func() + }{ + { + corrupt: func() { + payload[0]++ + }, + restore: func() { + payload[0]-- + }, + }, + { + corrupt: func() { + obj.SetPayloadSize(obj.GetPayloadSize() + 1) + }, + restore: func() { + obj.SetPayloadSize(obj.GetPayloadSize() - 1) + }, + }, + { + corrupt: func() { + obj.GetID().ToV2().GetValue()[0]++ + }, + restore: func() { + obj.GetID().ToV2().GetValue()[0]-- + }, + }, + { + corrupt: func() { + obj.GetSignature().GetKey()[0]++ + }, + restore: func() { + obj.GetSignature().GetKey()[0]-- + }, + }, + { + corrupt: func() { + obj.GetSignature().GetSign()[0]++ + }, + restore: func() { + obj.GetSignature().GetSign()[0]-- + }, + }, + } + + for _, item := range items { + item.corrupt() + + require.Error(t, CheckVerificationFields(obj.Object())) + + item.restore() + + require.NoError(t, CheckVerificationFields(obj.Object())) + } +} From 644a21edcadb2d9f1026f17454d046b0d83c490c Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 11 Sep 2020 18:32:09 +0300 Subject: [PATCH 0407/1196] [#141] sdk/client: Fix object operations Signed-off-by: Leonard Lyubich --- pkg/client/object.go | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/pkg/client/object.go b/pkg/client/object.go index e7edcd0..5c11189 100644 --- a/pkg/client/object.go +++ b/pkg/client/object.go @@ -174,12 +174,6 @@ func (c *Client) PutObject(ctx context.Context, p *PutObjectParams, opts ...Call } func (c *Client) putObjectV2(ctx context.Context, p *PutObjectParams, opts ...CallOption) (*object.ID, error) { - // convert object to V2 - obj, err := p.obj.ToV2(c.key) - if err != nil { - return nil, errors.Wrap(err, "could not convert object to V2") - } - // create V2 Object client cli, err := v2ObjectClient(c.remoteNode.Protocol, c.opts) if err != nil { @@ -213,6 +207,8 @@ func (c *Client) putObjectV2(ctx context.Context, p *PutObjectParams, opts ...Ca initPart := new(v2object.PutObjectPartInit) body.SetObjectPart(initPart) + obj := p.obj.ToV2() + // set init part fields initPart.SetObjectID(obj.GetObjectID()) initPart.SetSignature(obj.GetSignature()) @@ -447,12 +443,7 @@ func (c *Client) getObjectV2(ctx context.Context, p *GetObjectParams, opts ...Ca obj.SetPayload(payload) // convert the object - res, err := object.FromV2(obj) - if err != nil { - return nil, errors.Wrap(err, "could not convert V2 object") - } - - return res, nil + return object.NewFromV2(obj), nil } func (p *ObjectHeaderParams) WithAddress(v *object.Address) *ObjectHeaderParams { @@ -575,12 +566,7 @@ func (c *Client) getObjectHeaderV2(ctx context.Context, p *ObjectHeaderParams, o obj.SetHeader(hdr) // convert the object - res, err := object.FromV2(obj) - if err != nil { - return nil, errors.Wrap(err, "could not convert object") - } - - return res, nil + return object.NewFromV2(obj), nil } func (p *RangeDataParams) WithAddress(v *object.Address) *RangeDataParams { From 1cbfb337a700d7022a8d01b69d7db56c3cfb3f2a Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Tue, 15 Sep 2020 11:01:48 +0300 Subject: [PATCH 0408/1196] [#142] sdk/netmap: Add type aliases for netmap policy Later on there should be version independent structures. Signed-off-by: Alex Vanin --- pkg/netmap/policy.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 pkg/netmap/policy.go diff --git a/pkg/netmap/policy.go b/pkg/netmap/policy.go new file mode 100644 index 0000000..3a3e45a --- /dev/null +++ b/pkg/netmap/policy.go @@ -0,0 +1,13 @@ +package netmap + +import ( + "github.com/nspcc-dev/neofs-api-go/v2/netmap" +) + +// fixme: make types instead of aliases to v2 structures +type PlacementPolicy = netmap.PlacementPolicy +type Selector = netmap.Selector +type Filter = netmap.Filter +type Replica = netmap.Replica +type Clause = netmap.Clause +type Operation = netmap.Operation From 012cea1add724cd5a515f8b2e050eafc96ad32ef Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Tue, 15 Sep 2020 11:03:15 +0300 Subject: [PATCH 0409/1196] [#142] sdk/container: Use placement policy from neofs-api v2.0 Signed-off-by: Alex Vanin --- pkg/client/client_test.go | 13 +++++++++++-- pkg/container/opts.go | 6 +++--- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/pkg/client/client_test.go b/pkg/client/client_test.go index c3d7b0d..3aebaab 100644 --- a/pkg/client/client_test.go +++ b/pkg/client/client_test.go @@ -8,6 +8,7 @@ import ( "github.com/nspcc-dev/neofs-api-go/pkg/client" "github.com/nspcc-dev/neofs-api-go/pkg/container" + "github.com/nspcc-dev/neofs-api-go/pkg/netmap" "github.com/nspcc-dev/neofs-crypto/test" "github.com/stretchr/testify/require" "google.golang.org/grpc" @@ -35,10 +36,18 @@ func TestExample(t *testing.T) { cli, err = client.New(key, client.WithGRPCConnection(conn)) require.NoError(t, err) + replica := new(netmap.Replica) + replica.SetCount(2) + replica.SetSelector("*") + + policy := new(netmap.PlacementPolicy) + policy.SetContainerBackupFactor(2) + policy.SetReplicas([]*netmap.Replica{replica}) + // this container has random nonce and it does not set owner id - cnr, err := container.New( + cnr := container.New( container.WithAttribute("CreatedAt", time.Now().String()), - container.WithPolicy("PUT 3 In *"), + container.WithPolicy(policy), container.WithReadOnlyBasicACL(), ) require.NoError(t, err) diff --git a/pkg/container/opts.go b/pkg/container/opts.go index 52f663d..106f52b 100644 --- a/pkg/container/opts.go +++ b/pkg/container/opts.go @@ -3,6 +3,7 @@ package container import ( "github.com/google/uuid" "github.com/nspcc-dev/neofs-api-go/pkg/acl" + "github.com/nspcc-dev/neofs-api-go/pkg/netmap" "github.com/nspcc-dev/neofs-api-go/pkg/owner" ) @@ -18,7 +19,7 @@ type ( containerOptions struct { acl uint32 - policy string + policy *netmap.PlacementPolicy attributes []attribute owner *owner.ID nonce uuid.UUID @@ -91,9 +92,8 @@ func WithNEO3Wallet(w *owner.NEO3Wallet) NewOption { }) } -func WithPolicy(policy string) NewOption { +func WithPolicy(policy *netmap.PlacementPolicy) NewOption { return newFuncContainerOption(func(option *containerOptions) { - // todo: make sanity check and store binary structure option.policy = policy }) } From 3c7c3630024803b8fe34b53697c82aa1f8536afc Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Tue, 15 Sep 2020 11:04:36 +0300 Subject: [PATCH 0410/1196] [#142] sdk/container: Add converters to and from v2 Signed-off-by: Alex Vanin --- pkg/client/container.go | 6 ++---- pkg/container/container.go | 26 ++++++++++++++++++++------ 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/pkg/client/container.go b/pkg/client/container.go index 2888ebc..98a6f9c 100644 --- a/pkg/client/container.go +++ b/pkg/client/container.go @@ -100,7 +100,7 @@ func (c Client) putContainerV2(ctx context.Context, cnr *container.Container, op } reqBody := new(v2container.PutRequestBody) - reqBody.SetContainer(&cnr.Container) + reqBody.SetContainer(cnr.ToV2()) // sign container signWrapper := v2signature.StableMarshalerWrapper{SM: reqBody.GetContainer()} @@ -182,9 +182,7 @@ func (c Client) getContainerV2(ctx context.Context, id *container.ID, opts ...Ca return nil, errors.Wrap(err, "can't verify response message") } - return &container.Container{ - Container: *resp.GetBody().GetContainer(), - }, nil + return container.NewContainerFromV2(resp.GetBody().GetContainer()), nil default: return nil, unsupportedProtocolErr } diff --git a/pkg/container/container.go b/pkg/container/container.go index 5626af6..07765ca 100644 --- a/pkg/container/container.go +++ b/pkg/container/container.go @@ -8,7 +8,7 @@ type Container struct { container.Container } -func New(opts ...NewOption) (*Container, error) { +func New(opts ...NewOption) *Container { cnrOptions := defaultContainerOptions() for i := range opts { opts[i].apply(&cnrOptions) @@ -18,14 +18,14 @@ func New(opts ...NewOption) (*Container, error) { cnr.SetNonce(cnrOptions.nonce[:]) cnr.SetBasicACL(cnrOptions.acl) - if cnrOptions.policy != "" { - // todo: set placement policy - } - if cnrOptions.owner != nil { cnr.SetOwnerID(cnrOptions.owner.ToV2()) } + if cnrOptions.policy != nil { + cnr.SetPlacementPolicy(cnrOptions.policy) + } + attributes := make([]*container.Attribute, len(cnrOptions.attributes)) for i := range cnrOptions.attributes { attribute := new(container.Attribute) @@ -37,5 +37,19 @@ func New(opts ...NewOption) (*Container, error) { cnr.SetAttributes(attributes) } - return cnr, nil + return cnr +} + +func (c Container) ToV2() *container.Container { + return &c.Container +} + +func NewContainerFromV2(c *container.Container) *Container { + cnr := new(Container) + + if c != nil { + cnr.Container = *c + } + + return cnr } From 182a3af9b8e665f4f33d6ef67f4525c7becf3f88 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Thu, 10 Sep 2020 13:01:31 +0300 Subject: [PATCH 0411/1196] [#139] v2/acl: Rename TargetInfo to Target Corresponds with proto definition. Signed-off-by: Alex Vanin --- v2/acl/convert.go | 8 ++++---- v2/acl/marshal.go | 4 ++-- v2/acl/marshal_test.go | 8 ++++---- v2/acl/types.go | 20 ++++++++++---------- v2/container/marshal_test.go | 4 ++-- v2/session/marshal_test.go | 4 ++-- 6 files changed, 24 insertions(+), 24 deletions(-) diff --git a/v2/acl/convert.go b/v2/acl/convert.go index 79ebe5f..b28eba2 100644 --- a/v2/acl/convert.go +++ b/v2/acl/convert.go @@ -194,7 +194,7 @@ func HeaderFilterFromGRPCMessage(m *acl.EACLRecord_Filter) *HeaderFilter { } // TargetToGRPCMessage converts unified role info struct into grpc struct. -func TargetToGRPCMessage(t *TargetInfo) *acl.EACLRecord_Target { +func TargetToGRPCMessage(t *Target) *acl.EACLRecord_Target { if t == nil { return nil } @@ -211,12 +211,12 @@ func TargetToGRPCMessage(t *TargetInfo) *acl.EACLRecord_Target { } // TargetInfoFromGRPCMessage converts grpc struct into unified role info struct. -func TargetInfoFromGRPCMessage(m *acl.EACLRecord_Target) *TargetInfo { +func TargetInfoFromGRPCMessage(m *acl.EACLRecord_Target) *Target { if m == nil { return nil } - t := new(TargetInfo) + t := new(Target) t.SetRole( RoleFromGRPCField(m.GetRole()), @@ -290,7 +290,7 @@ func RecordFromGRPCMessage(m *acl.EACLRecord) *Record { r.SetFilters(filters) targetMsg := m.GetTargets() - targets := make([]*TargetInfo, 0, len(targetMsg)) + targets := make([]*Target, 0, len(targetMsg)) for i := range targetMsg { targets = append(targets, TargetInfoFromGRPCMessage(targetMsg[i])) diff --git a/v2/acl/marshal.go b/v2/acl/marshal.go index 3478b42..95b2e7d 100644 --- a/v2/acl/marshal.go +++ b/v2/acl/marshal.go @@ -224,7 +224,7 @@ func (f *HeaderFilter) StableSize() (size int) { // StableMarshal marshals unified role info structure in a protobuf // compatible way without field order shuffle. -func (t *TargetInfo) StableMarshal(buf []byte) ([]byte, error) { +func (t *Target) StableMarshal(buf []byte) ([]byte, error) { if t == nil { return []byte{}, nil } @@ -254,7 +254,7 @@ func (t *TargetInfo) StableMarshal(buf []byte) ([]byte, error) { } // StableSize of role info structure marshalled by StableMarshal function. -func (t *TargetInfo) StableSize() (size int) { +func (t *Target) StableSize() (size int) { if t == nil { return 0 } diff --git a/v2/acl/marshal_test.go b/v2/acl/marshal_test.go index 79b187b..ecaecc8 100644 --- a/v2/acl/marshal_test.go +++ b/v2/acl/marshal_test.go @@ -10,8 +10,8 @@ import ( "github.com/stretchr/testify/require" ) -func generateTarget(u acl.Role, k int) *acl.TargetInfo { - target := new(acl.TargetInfo) +func generateTarget(u acl.Role, k int) *acl.Target { + target := new(acl.Target) target.SetRole(u) keys := make([][]byte, k) @@ -44,7 +44,7 @@ func generateRecord(another bool) *acl.Record { record.SetOperation(acl.OperationHead) record.SetAction(acl.ActionDeny) - record.SetTargets([]*acl.TargetInfo{t1}) + record.SetTargets([]*acl.Target{t1}) record.SetFilters([]*acl.HeaderFilter{f1}) default: t1 := generateTarget(acl.RoleUser, 2) @@ -54,7 +54,7 @@ func generateRecord(another bool) *acl.Record { record.SetOperation(acl.OperationPut) record.SetAction(acl.ActionAllow) - record.SetTargets([]*acl.TargetInfo{t1, t2}) + record.SetTargets([]*acl.Target{t1, t2}) record.SetFilters([]*acl.HeaderFilter{f1, f2}) } diff --git a/v2/acl/types.go b/v2/acl/types.go index 38a7044..83b7fd2 100644 --- a/v2/acl/types.go +++ b/v2/acl/types.go @@ -12,9 +12,9 @@ type HeaderFilter struct { name, value string } -// TargetInfo is a unified structure of TargetInfo +// Target is a unified structure of Target // message from proto definition. -type TargetInfo struct { +type Target struct { role Role keys [][]byte @@ -29,7 +29,7 @@ type Record struct { filters []*HeaderFilter - targets []*TargetInfo + targets []*Target } // Table is a unified structure of EACLTable @@ -60,7 +60,7 @@ type BearerToken struct { sig *refs.Signature } -// TargetInfo is a unified enum of MatchType enum from proto definition. +// Target is a unified enum of MatchType enum from proto definition. type MatchType uint32 // HeaderType is a unified enum of HeaderType enum from proto definition. @@ -167,7 +167,7 @@ func (f *HeaderFilter) SetValue(v string) { } } -func (t *TargetInfo) GetRole() Role { +func (t *Target) GetRole() Role { if t != nil { return t.role } @@ -175,13 +175,13 @@ func (t *TargetInfo) GetRole() Role { return RoleUnknown } -func (t *TargetInfo) SetRole(v Role) { +func (t *Target) SetRole(v Role) { if t != nil { t.role = v } } -func (t *TargetInfo) GetKeyList() [][]byte { +func (t *Target) GetKeyList() [][]byte { if t != nil { return t.keys } @@ -189,7 +189,7 @@ func (t *TargetInfo) GetKeyList() [][]byte { return nil } -func (t *TargetInfo) SetKeyList(v [][]byte) { +func (t *Target) SetKeyList(v [][]byte) { if t != nil { t.keys = v } @@ -237,7 +237,7 @@ func (r *Record) SetFilters(v []*HeaderFilter) { } } -func (r *Record) GetTargets() []*TargetInfo { +func (r *Record) GetTargets() []*Target { if r != nil { return r.targets } @@ -245,7 +245,7 @@ func (r *Record) GetTargets() []*TargetInfo { return nil } -func (r *Record) SetTargets(v []*TargetInfo) { +func (r *Record) SetTargets(v []*Target) { if r != nil { r.targets = v } diff --git a/v2/container/marshal_test.go b/v2/container/marshal_test.go index fba58f5..51eb5e7 100644 --- a/v2/container/marshal_test.go +++ b/v2/container/marshal_test.go @@ -350,7 +350,7 @@ func generateListResponseBody(n int) *container.ListResponseBody { } func generateEACL(n int, k, v string) *acl.Table { - target := new(acl.TargetInfo) + target := new(acl.Target) target.SetRole(acl.RoleUser) keys := make([][]byte, n) @@ -369,7 +369,7 @@ func generateEACL(n int, k, v string) *acl.Table { record := new(acl.Record) record.SetOperation(acl.OperationHead) record.SetAction(acl.ActionDeny) - record.SetTargets([]*acl.TargetInfo{target}) + record.SetTargets([]*acl.Target{target}) record.SetFilters([]*acl.HeaderFilter{filter}) table := new(acl.Table) diff --git a/v2/session/marshal_test.go b/v2/session/marshal_test.go index c2f4415..0f48735 100644 --- a/v2/session/marshal_test.go +++ b/v2/session/marshal_test.go @@ -281,7 +281,7 @@ func generateObjectCtx(id string) *session.ObjectSessionContext { } func generateEACL(n int, k, v string) *acl.Table { - target := new(acl.TargetInfo) + target := new(acl.Target) target.SetRole(acl.RoleUser) keys := make([][]byte, n) @@ -300,7 +300,7 @@ func generateEACL(n int, k, v string) *acl.Table { record := new(acl.Record) record.SetOperation(acl.OperationHead) record.SetAction(acl.ActionDeny) - record.SetTargets([]*acl.TargetInfo{target}) + record.SetTargets([]*acl.Target{target}) record.SetFilters([]*acl.HeaderFilter{filter}) table := new(acl.Table) From edf2e2d62f511af7d11920779dd73e0a5c4ec29e Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Thu, 10 Sep 2020 17:51:58 +0300 Subject: [PATCH 0412/1196] [#139] sdk/acl: Add eACL structures Signed-off-by: Alex Vanin --- pkg/acl/eacl/enums.go | 224 +++++++++++++++++++++++++++++++++++++ pkg/acl/eacl/filter.go | 55 +++++++++ pkg/acl/eacl/record.go | 127 +++++++++++++++++++++ pkg/acl/eacl/table.go | 113 +++++++++++++++++++ pkg/acl/eacl/table_test.go | 17 +++ pkg/acl/eacl/target.go | 56 ++++++++++ 6 files changed, 592 insertions(+) create mode 100644 pkg/acl/eacl/enums.go create mode 100644 pkg/acl/eacl/filter.go create mode 100644 pkg/acl/eacl/record.go create mode 100644 pkg/acl/eacl/table.go create mode 100644 pkg/acl/eacl/table_test.go create mode 100644 pkg/acl/eacl/target.go diff --git a/pkg/acl/eacl/enums.go b/pkg/acl/eacl/enums.go new file mode 100644 index 0000000..38ab97d --- /dev/null +++ b/pkg/acl/eacl/enums.go @@ -0,0 +1,224 @@ +package eacl + +import ( + v2acl "github.com/nspcc-dev/neofs-api-go/v2/acl" +) + +// Action taken if EACL record matched request. +type Action uint32 + +const ( + ActionUnknown Action = iota + ActionAllow + ActionDeny +) + +// Operation is a object service method to match request. +type Operation uint32 + +const ( + OperationUnknown Operation = iota + OperationGet + OperationHead + OperationPut + OperationDelete + OperationSearch + OperationRange + OperationRangeHash +) + +// Role is a group of request senders to match request. +type Role uint32 + +const ( + RoleUnknown Role = iota + // RoleUser is a group of senders that contains only key of container owner. + RoleUser + // RoleSystem is a group of senders that contains keys of container nodes and + // inner ring nodes. + RoleSystem + // RoleOthers is a group of senders that contains none of above keys. + RoleOthers +) + +// Match is binary operation on filer name and value to check if request is matched. +type Match uint32 + +const ( + MatchUnknown Match = iota + MatchStringEqual + MatchStringNotEqual +) + +// FilterHeaderType indicates source of headers to make matches. +type FilterHeaderType uint32 + +const ( + HeaderTypeUnknown FilterHeaderType = iota + HeaderFromRequest + HeaderFromObject +) + +const ( + // HdrObjSysNameID is a name of ID field in system header of object. + HdrObjSysNameID = "_ID" + + // HdrObjSysNameCID is a name of cid field in system header of object. + HdrObjSysNameCID = "_CID" + + // HdrObjSysNameOwnerID is a name of OwnerID field in system header of object. + HdrObjSysNameOwnerID = "_OWNER_ID" + + // HdrObjSysNameVersion is a name of version field in system header of object. + HdrObjSysNameVersion = "_VERSION" + + // HdrObjSysNamePayloadLength is a name of PayloadLength field in system header of object. + HdrObjSysNamePayloadLength = "_PAYLOAD_LENGTH" + + // HdrObjSysNameCreatedEpoch is a name of CreatedAt.Epoch field in system header of object. + HdrObjSysNameCreatedEpoch = "_CREATED_EPOCH" +) + +func (a Action) ToV2() v2acl.Action { + switch a { + case ActionAllow: + return v2acl.ActionAllow + case ActionDeny: + return v2acl.ActionDeny + default: + return v2acl.ActionUnknown + } +} + +func ActionFromV2(action v2acl.Action) (a Action) { + switch action { + case v2acl.ActionAllow: + a = ActionAllow + case v2acl.ActionDeny: + a = ActionDeny + default: + a = ActionUnknown + } + + return a +} + +func (o Operation) ToV2() v2acl.Operation { + switch o { + case OperationGet: + return v2acl.OperationGet + case OperationHead: + return v2acl.OperationHead + case OperationPut: + return v2acl.OperationPut + case OperationDelete: + return v2acl.OperationDelete + case OperationSearch: + return v2acl.OperationSearch + case OperationRange: + return v2acl.OperationRange + case OperationRangeHash: + return v2acl.OperationRangeHash + default: + return v2acl.OperationUnknown + } +} + +func OperationFromV2(operation v2acl.Operation) (o Operation) { + switch operation { + case v2acl.OperationGet: + o = OperationGet + case v2acl.OperationHead: + o = OperationHead + case v2acl.OperationPut: + o = OperationPut + case v2acl.OperationDelete: + o = OperationDelete + case v2acl.OperationSearch: + o = OperationSearch + case v2acl.OperationRange: + o = OperationRange + case v2acl.OperationRangeHash: + o = OperationRangeHash + default: + o = OperationUnknown + } + + return o +} + +func (r Role) ToV2() v2acl.Role { + switch r { + case RoleUser: + return v2acl.RoleUser + case RoleSystem: + return v2acl.RoleSystem + case RoleOthers: + return v2acl.RoleOthers + default: + return v2acl.RoleUnknown + } +} + +func RoleFromV2(role v2acl.Role) (r Role) { + switch role { + case v2acl.RoleUser: + r = RoleUser + case v2acl.RoleSystem: + r = RoleSystem + case v2acl.RoleOthers: + r = RoleOthers + default: + r = RoleUnknown + } + + return r +} + +func (m Match) ToV2() v2acl.MatchType { + switch m { + case MatchStringEqual: + return v2acl.MatchTypeStringEqual + case MatchStringNotEqual: + return v2acl.MatchTypeStringNotEqual + default: + return v2acl.MatchTypeUnknown + } +} + +func MatchFromV2(match v2acl.MatchType) (m Match) { + switch match { + case v2acl.MatchTypeStringEqual: + m = MatchStringEqual + case v2acl.MatchTypeStringNotEqual: + m = MatchStringNotEqual + default: + m = MatchUnknown + } + + return m +} + +func (h FilterHeaderType) ToV2() v2acl.HeaderType { + switch h { + case HeaderFromRequest: + return v2acl.HeaderTypeRequest + case HeaderFromObject: + return v2acl.HeaderTypeObject + default: + return v2acl.HeaderTypeUnknown + } +} + +func FilterHeaderTypeFromV2(header v2acl.HeaderType) (h FilterHeaderType) { + switch header { + case v2acl.HeaderTypeRequest: + h = HeaderFromRequest + case v2acl.HeaderTypeObject: + h = HeaderFromObject + default: + h = HeaderTypeUnknown + } + + return h +} diff --git a/pkg/acl/eacl/filter.go b/pkg/acl/eacl/filter.go new file mode 100644 index 0000000..8ea8537 --- /dev/null +++ b/pkg/acl/eacl/filter.go @@ -0,0 +1,55 @@ +package eacl + +import ( + v2acl "github.com/nspcc-dev/neofs-api-go/v2/acl" +) + +// Filter defines check conditions if request header is matched or not. Matched +// header means that request should be processed according to EACL action. +type Filter struct { + from FilterHeaderType + name string + matcher Match + value string +} + +func (a Filter) Value() string { + return a.value +} + +func (a Filter) Matcher() Match { + return a.matcher +} + +func (a Filter) Name() string { + return a.name +} + +func (a Filter) From() FilterHeaderType { + return a.from +} + +func (a *Filter) ToV2() *v2acl.HeaderFilter { + filter := new(v2acl.HeaderFilter) + filter.SetValue(a.value) + filter.SetName(a.name) + filter.SetMatchType(a.matcher.ToV2()) + filter.SetHeaderType(a.from.ToV2()) + + return filter +} + +func NewFilterFromV2(filter *v2acl.HeaderFilter) *Filter { + f := new(Filter) + + if filter == nil { + return f + } + + f.from = FilterHeaderTypeFromV2(filter.GetHeaderType()) + f.matcher = MatchFromV2(filter.GetMatchType()) + f.name = filter.GetName() + f.value = filter.GetValue() + + return f +} diff --git a/pkg/acl/eacl/record.go b/pkg/acl/eacl/record.go new file mode 100644 index 0000000..9c46d2f --- /dev/null +++ b/pkg/acl/eacl/record.go @@ -0,0 +1,127 @@ +package eacl + +import ( + "crypto/ecdsa" + + v2acl "github.com/nspcc-dev/neofs-api-go/v2/acl" +) + +type ( + // Record of the EACL rule, that defines EACL action, targets for this action, + // object service operation and filters for request headers. + Record struct { + action Action + operation Operation + filters []Filter + targets []Target + } +) + +func (r Record) Targets() []Target { + return r.targets +} + +func (r Record) Filters() []Filter { + return r.filters +} + +func (r Record) Operation() Operation { + return r.operation +} + +func (r *Record) SetOperation(operation Operation) { + r.operation = operation +} + +func (r Record) Action() Action { + return r.action +} + +func (r *Record) SetAction(action Action) { + r.action = action +} + +func (r *Record) AddTarget(role Role, keys ...ecdsa.PublicKey) { + t := Target{ + role: role, + keys: make([]ecdsa.PublicKey, 0, len(keys)), + } + + for i := range keys { + t.keys = append(t.keys, keys[i]) + } + + r.targets = append(r.targets, t) +} + +func (r *Record) AddFilter(from FilterHeaderType, matcher Match, name, value string) { + filter := Filter{ + from: from, + name: name, + matcher: matcher, + value: value, + } + + r.filters = append(r.filters, filter) +} + +func (r *Record) ToV2() *v2acl.Record { + targets := make([]*v2acl.Target, 0, len(r.targets)) + for _, target := range r.targets { + targets = append(targets, target.ToV2()) + } + + filters := make([]*v2acl.HeaderFilter, 0, len(r.filters)) + for _, filter := range r.filters { + filters = append(filters, filter.ToV2()) + } + + v2 := new(v2acl.Record) + + v2.SetAction(r.action.ToV2()) + v2.SetOperation(r.operation.ToV2()) + v2.SetTargets(targets) + v2.SetFilters(filters) + + return v2 +} + +func NewRecord() *Record { + return new(Record) +} + +func CreateRecord(action Action, operation Operation) *Record { + r := NewRecord() + r.action = action + r.operation = operation + r.targets = []Target{} + r.filters = []Filter{} + + return r +} + +func NewRecordFromV2(record *v2acl.Record) *Record { + r := NewRecord() + + if record == nil { + return r + } + + r.action = ActionFromV2(record.GetAction()) + r.operation = OperationFromV2(record.GetOperation()) + + v2targets := record.GetTargets() + v2filters := record.GetFilters() + + r.targets = make([]Target, 0, len(v2targets)) + for i := range v2targets { + r.targets = append(r.targets, *NewTargetFromV2(v2targets[i])) + } + + r.filters = make([]Filter, 0, len(v2filters)) + for i := range v2filters { + r.filters = append(r.filters, *NewFilterFromV2(v2filters[i])) + } + + return r +} diff --git a/pkg/acl/eacl/table.go b/pkg/acl/eacl/table.go new file mode 100644 index 0000000..a0fe857 --- /dev/null +++ b/pkg/acl/eacl/table.go @@ -0,0 +1,113 @@ +package eacl + +import ( + "crypto/sha256" + + "github.com/nspcc-dev/neofs-api-go/pkg" + "github.com/nspcc-dev/neofs-api-go/pkg/container" + v2acl "github.com/nspcc-dev/neofs-api-go/v2/acl" +) + +type ( + // Table is a group of EACL records for single container. + Table struct { + version pkg.Version + cid *container.ID + records []Record + } +) + +func (t Table) CID() *container.ID { + return t.cid +} + +func (t *Table) SetCID(cid *container.ID) { + t.cid = cid +} + +func (t Table) Version() pkg.Version { + return t.version +} + +func (t *Table) SetVersion(version pkg.Version) { + t.version = version +} + +func (t Table) Records() []Record { + return t.records +} + +func (t *Table) AddRecord(r *Record) { + if r != nil { + t.records = append(t.records, *r) + } +} + +func (t *Table) ToV2() *v2acl.Table { + v2 := new(v2acl.Table) + + if t.cid != nil { + v2.SetContainerID(t.cid.ToV2()) + } + + records := make([]*v2acl.Record, 0, len(t.records)) + for _, record := range t.records { + records = append(records, record.ToV2()) + } + + v2.SetVersion(t.version.ToV2()) + v2.SetRecords(records) + + return v2 +} + +func NewTable() *Table { + t := new(Table) + t.SetVersion(*pkg.SDKVersion()) + + return t +} + +func CreateTable(cid container.ID) *Table { + t := NewTable() + t.SetCID(&cid) + + return t +} + +func NewTableFromV2(table *v2acl.Table) *Table { + t := new(Table) + + if table == nil { + return t + } + + // set version + if v := table.GetVersion(); v != nil { + version := pkg.Version{} + version.SetMajor(v.GetMajor()) + version.SetMinor(v.GetMinor()) + + t.SetVersion(version) + } + + // set container id + if cid := table.GetContainerID(); cid != nil { + if t.cid == nil { + t.cid = new(container.ID) + } + + var h [sha256.Size]byte + copy(h[:], table.GetContainerID().GetValue()) + t.cid.SetSHA256(h) + } + + // set eacl records + v2records := table.GetRecords() + t.records = make([]Record, 0, len(v2records)) + for i := range v2records { + t.records = append(t.records, *NewRecordFromV2(v2records[i])) + } + + return t +} diff --git a/pkg/acl/eacl/table_test.go b/pkg/acl/eacl/table_test.go new file mode 100644 index 0000000..b4d52b5 --- /dev/null +++ b/pkg/acl/eacl/table_test.go @@ -0,0 +1,17 @@ +package eacl_test + +import ( + "testing" + + "github.com/nspcc-dev/neofs-api-go/pkg/acl/eacl" + "github.com/nspcc-dev/neofs-crypto/test" +) + +func TextExample(t *testing.T) { + record := eacl.CreateRecord(eacl.ActionDeny, eacl.OperationPut) + record.AddFilter(eacl.HeaderFromObject, eacl.MatchStringEqual, "filename", "cat.jpg") + record.AddTarget(eacl.RoleOthers, test.DecodeKey(1).PublicKey, test.DecodeKey(2).PublicKey) + + table := eacl.NewTable() + table.AddRecord(record) +} diff --git a/pkg/acl/eacl/target.go b/pkg/acl/eacl/target.go new file mode 100644 index 0000000..09fdfa7 --- /dev/null +++ b/pkg/acl/eacl/target.go @@ -0,0 +1,56 @@ +package eacl + +import ( + "crypto/ecdsa" + + v2acl "github.com/nspcc-dev/neofs-api-go/v2/acl" + crypto "github.com/nspcc-dev/neofs-crypto" +) + +// Target is a group of request senders to match EACL. Defined by role enum +// and set of public keys. +type Target struct { + role Role + keys []ecdsa.PublicKey +} + +func (t Target) Keys() []ecdsa.PublicKey { + return t.keys +} + +func (t Target) Role() Role { + return t.role +} + +func (t *Target) ToV2() *v2acl.Target { + keys := make([][]byte, 0, len(t.keys)) + for i := range t.keys { + key := crypto.MarshalPublicKey(&t.keys[i]) + keys = append(keys, key) + } + + target := new(v2acl.Target) + + target.SetRole(t.role.ToV2()) + target.SetKeyList(keys) + + return target +} + +func NewTargetFromV2(target *v2acl.Target) *Target { + t := new(Target) + + if target == nil { + return t + } + + t.role = RoleFromV2(target.GetRole()) + v2keys := target.GetKeyList() + t.keys = make([]ecdsa.PublicKey, 0, len(v2keys)) + for i := range v2keys { + key := crypto.UnmarshalPublicKey(v2keys[i]) + t.keys = append(t.keys, *key) + } + + return t +} From 15f803119b34a9f204e5b5b89f35c8f1a3639cf3 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Thu, 10 Sep 2020 18:08:08 +0300 Subject: [PATCH 0413/1196] [#139] sdk/client: Support EACL in RPC client Signed-off-by: Alex Vanin --- pkg/client/container.go | 124 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 122 insertions(+), 2 deletions(-) diff --git a/pkg/client/container.go b/pkg/client/container.go index 98a6f9c..5c87a2b 100644 --- a/pkg/client/container.go +++ b/pkg/client/container.go @@ -3,6 +3,7 @@ package client import ( "context" + "github.com/nspcc-dev/neofs-api-go/pkg/acl/eacl" "github.com/nspcc-dev/neofs-api-go/pkg/container" "github.com/nspcc-dev/neofs-api-go/pkg/owner" "github.com/nspcc-dev/neofs-api-go/util/signature" @@ -73,8 +74,23 @@ func (c Client) DeleteContainer(ctx context.Context, id *container.ID, opts ...C } } -// todo: func (c Client) GetExtendedACL -// todo: func (c Client) SetExtendedACL +func (c Client) GetEACL(ctx context.Context, id *container.ID, opts ...CallOption) (*eacl.Table, error) { + switch c.remoteNode.Version.GetMajor() { + case 2: + return c.getEACLV2(ctx, id, opts...) + default: + return nil, unsupportedProtocolErr + } +} + +func (c Client) SetEACL(ctx context.Context, eacl *eacl.Table, opts ...CallOption) error { + switch c.remoteNode.Version.GetMajor() { + case 2: + return c.setEACLV2(ctx, eacl, opts...) + default: + return unsupportedProtocolErr + } +} func (c Client) putContainerV2(ctx context.Context, cnr *container.Container, opts ...CallOption) (*container.ID, error) { // apply all available options @@ -293,6 +309,110 @@ func (c Client) delContainerV2(ctx context.Context, id *container.ID, opts ...Ca } } +func (c Client) getEACLV2(ctx context.Context, id *container.ID, opts ...CallOption) (*eacl.Table, error) { + // apply all available options + callOptions := defaultCallOptions() + for i := range opts { + opts[i].apply(&callOptions) + } + + reqBody := new(v2container.GetExtendedACLRequestBody) + reqBody.SetContainerID(id.ToV2()) + + req := new(v2container.GetExtendedACLRequest) + req.SetBody(reqBody) + req.SetMetaHeader(v2MetaHeaderFromOpts(callOptions)) + + err := v2signature.SignServiceMessage(c.key, req) + if err != nil { + return nil, err + } + + switch c.remoteNode.Protocol { + case GRPC: + cli, err := v2ContainerClientFromOptions(c.opts) + if err != nil { + return nil, errors.Wrap(err, "can't create grpc client") + } + + resp, err := cli.GetExtendedACL(ctx, req) + if err != nil { + return nil, errors.Wrap(err, "transport error") + } + + err = v2signature.VerifyServiceMessage(resp) + if err != nil { + return nil, errors.Wrap(err, "can't verify response message") + } + + body := resp.GetBody() + if body == nil { + return nil, errors.New("response body is nil") + } + + result := eacl.NewTableFromV2(body.GetEACL()) + + // todo: check signature + + return result, nil + default: + return nil, unsupportedProtocolErr + } +} + +func (c Client) setEACLV2(ctx context.Context, eacl *eacl.Table, opts ...CallOption) error { + // apply all available options + callOptions := defaultCallOptions() + for i := range opts { + opts[i].apply(&callOptions) + } + + reqBody := new(v2container.SetExtendedACLRequestBody) + reqBody.SetEACL(eacl.ToV2()) + + signWrapper := v2signature.StableMarshalerWrapper{SM: reqBody.GetEACL()} + err := signature.SignDataWithHandler(c.key, signWrapper, func(key []byte, sig []byte) { + eaclSignature := new(refs.Signature) + eaclSignature.SetKey(key) + eaclSignature.SetSign(sig) + reqBody.SetSignature(eaclSignature) + }, signature.SignWithRFC6979()) + if err != nil { + return err + } + + req := new(v2container.SetExtendedACLRequest) + req.SetBody(reqBody) + req.SetMetaHeader(v2MetaHeaderFromOpts(callOptions)) + + err = v2signature.SignServiceMessage(c.key, req) + if err != nil { + return err + } + + switch c.remoteNode.Protocol { + case GRPC: + cli, err := v2ContainerClientFromOptions(c.opts) + if err != nil { + return errors.Wrap(err, "can't create grpc client") + } + + resp, err := cli.SetExtendedACL(ctx, req) + if err != nil { + return errors.Wrap(err, "transport error") + } + + err = v2signature.VerifyServiceMessage(resp) + if err != nil { + return errors.Wrap(err, "can't verify response message") + } + + return nil + default: + return unsupportedProtocolErr + } +} + func v2ContainerClientFromOptions(opts *clientOptions) (cli *v2container.Client, err error) { switch { case opts.grpcOpts.v2ContainerClient != nil: From 790add6538cd282e2aca943842e02e5709f988d7 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Fri, 11 Sep 2020 17:35:07 +0300 Subject: [PATCH 0414/1196] [#139] v2/object: Fix string conversion errors for go1.15 Signed-off-by: Alex Vanin --- v2/object/marshal_test.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/v2/object/marshal_test.go b/v2/object/marshal_test.go index e63683b..8c7777f 100644 --- a/v2/object/marshal_test.go +++ b/v2/object/marshal_test.go @@ -2,6 +2,7 @@ package object_test import ( "fmt" + "strconv" "testing" "github.com/nspcc-dev/neofs-api-go/v2/object" @@ -483,7 +484,7 @@ func generateHeader(ln uint64) *object.Header { hdr.SetHomomorphicHash(generateChecksum("Homomorphic Hash")) hdr.SetObjectType(object.TypeRegular) hdr.SetPayloadHash(generateChecksum("Payload Hash")) - hdr.SetSessionToken(generateSessionToken(string(ln))) + hdr.SetSessionToken(generateSessionToken(strconv.Itoa(int(ln)))) return hdr } @@ -684,7 +685,7 @@ func generateRangeHashResponseBody(n int) *object.GetRangeHashResponseBody { list := make([][]byte, n) for i := 0; i < n; i++ { - list[i] = []byte("Some homomorphic hash data" + string(n)) + list[i] = []byte("Some homomorphic hash data" + strconv.Itoa(n)) } resp.SetType(refs.TillichZemor) From d1499e65b913ae45d30e21d8184679af000ec9d9 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Mon, 14 Sep 2020 18:21:11 +0300 Subject: [PATCH 0415/1196] [#139] sdk/acl: Add test coverage for EACL structures Signed-off-by: Alex Vanin --- pkg/acl/eacl/enums_test.go | 117 ++++++++++++++++++++++++++++++++++++ pkg/acl/eacl/filter_test.go | 31 ++++++++++ pkg/acl/eacl/record_test.go | 83 +++++++++++++++++++++++++ pkg/acl/eacl/table_test.go | 67 ++++++++++++++++++++- pkg/acl/eacl/target_test.go | 38 ++++++++++++ 5 files changed, 334 insertions(+), 2 deletions(-) create mode 100644 pkg/acl/eacl/enums_test.go create mode 100644 pkg/acl/eacl/filter_test.go create mode 100644 pkg/acl/eacl/record_test.go create mode 100644 pkg/acl/eacl/target_test.go diff --git a/pkg/acl/eacl/enums_test.go b/pkg/acl/eacl/enums_test.go new file mode 100644 index 0000000..11f2224 --- /dev/null +++ b/pkg/acl/eacl/enums_test.go @@ -0,0 +1,117 @@ +package eacl_test + +import ( + "testing" + + "github.com/nspcc-dev/neofs-api-go/pkg/acl/eacl" + v2acl "github.com/nspcc-dev/neofs-api-go/v2/acl" + "github.com/stretchr/testify/require" +) + +var ( + eqV2Actions = map[eacl.Action]v2acl.Action{ + eacl.ActionUnknown: v2acl.ActionUnknown, + eacl.ActionAllow: v2acl.ActionAllow, + eacl.ActionDeny: v2acl.ActionDeny, + } + + eqV2Operations = map[eacl.Operation]v2acl.Operation{ + eacl.OperationUnknown: v2acl.OperationUnknown, + eacl.OperationGet: v2acl.OperationGet, + eacl.OperationHead: v2acl.OperationHead, + eacl.OperationPut: v2acl.OperationPut, + eacl.OperationDelete: v2acl.OperationDelete, + eacl.OperationSearch: v2acl.OperationSearch, + eacl.OperationRange: v2acl.OperationRange, + eacl.OperationRangeHash: v2acl.OperationRangeHash, + } + + eqV2Roles = map[eacl.Role]v2acl.Role{ + eacl.RoleUnknown: v2acl.RoleUnknown, + eacl.RoleUser: v2acl.RoleUser, + eacl.RoleSystem: v2acl.RoleSystem, + eacl.RoleOthers: v2acl.RoleOthers, + } + + eqV2Matches = map[eacl.Match]v2acl.MatchType{ + eacl.MatchUnknown: v2acl.MatchTypeUnknown, + eacl.MatchStringEqual: v2acl.MatchTypeStringEqual, + eacl.MatchStringNotEqual: v2acl.MatchTypeStringNotEqual, + } + + eqV2HeaderTypes = map[eacl.FilterHeaderType]v2acl.HeaderType{ + eacl.HeaderTypeUnknown: v2acl.HeaderTypeUnknown, + eacl.HeaderFromRequest: v2acl.HeaderTypeRequest, + eacl.HeaderFromObject: v2acl.HeaderTypeObject, + } +) + +func TestAction(t *testing.T) { + t.Run("known actions", func(t *testing.T) { + for i := eacl.ActionUnknown; i <= eacl.ActionDeny; i++ { + require.Equal(t, eqV2Actions[i], i.ToV2()) + require.Equal(t, eacl.ActionFromV2(i.ToV2()), i) + } + }) + + t.Run("unknown actions", func(t *testing.T) { + require.Equal(t, (eacl.ActionDeny + 1).ToV2(), v2acl.ActionUnknown) + require.Equal(t, eacl.ActionFromV2(v2acl.ActionDeny+1), eacl.ActionUnknown) + }) +} + +func TestOperation(t *testing.T) { + t.Run("known operations", func(t *testing.T) { + for i := eacl.OperationUnknown; i <= eacl.OperationRangeHash; i++ { + require.Equal(t, eqV2Operations[i], i.ToV2()) + require.Equal(t, eacl.OperationFromV2(i.ToV2()), i) + } + }) + + t.Run("unknown operations", func(t *testing.T) { + require.Equal(t, (eacl.OperationRangeHash + 1).ToV2(), v2acl.OperationUnknown) + require.Equal(t, eacl.OperationFromV2(v2acl.OperationRangeHash+1), eacl.OperationUnknown) + }) +} + +func TestRole(t *testing.T) { + t.Run("known roles", func(t *testing.T) { + for i := eacl.RoleUnknown; i <= eacl.RoleOthers; i++ { + require.Equal(t, eqV2Roles[i], i.ToV2()) + require.Equal(t, eacl.RoleFromV2(i.ToV2()), i) + } + }) + + t.Run("unknown roles", func(t *testing.T) { + require.Equal(t, (eacl.RoleOthers + 1).ToV2(), v2acl.RoleUnknown) + require.Equal(t, eacl.RoleFromV2(v2acl.RoleOthers+1), eacl.RoleUnknown) + }) +} + +func TestMatch(t *testing.T) { + t.Run("known matches", func(t *testing.T) { + for i := eacl.MatchUnknown; i <= eacl.MatchStringNotEqual; i++ { + require.Equal(t, eqV2Matches[i], i.ToV2()) + require.Equal(t, eacl.MatchFromV2(i.ToV2()), i) + } + }) + + t.Run("unknown matches", func(t *testing.T) { + require.Equal(t, (eacl.MatchStringNotEqual + 1).ToV2(), v2acl.MatchTypeUnknown) + require.Equal(t, eacl.MatchFromV2(v2acl.MatchTypeStringNotEqual+1), eacl.MatchUnknown) + }) +} + +func TestFilterHeaderType(t *testing.T) { + t.Run("known header types", func(t *testing.T) { + for i := eacl.HeaderTypeUnknown; i <= eacl.HeaderFromObject; i++ { + require.Equal(t, eqV2HeaderTypes[i], i.ToV2()) + require.Equal(t, eacl.FilterHeaderTypeFromV2(i.ToV2()), i) + } + }) + + t.Run("unknown header types", func(t *testing.T) { + require.Equal(t, (eacl.HeaderFromObject + 1).ToV2(), v2acl.HeaderTypeUnknown) + require.Equal(t, eacl.FilterHeaderTypeFromV2(v2acl.HeaderTypeObject+1), eacl.HeaderTypeUnknown) + }) +} diff --git a/pkg/acl/eacl/filter_test.go b/pkg/acl/eacl/filter_test.go new file mode 100644 index 0000000..57dcb1d --- /dev/null +++ b/pkg/acl/eacl/filter_test.go @@ -0,0 +1,31 @@ +package eacl + +import ( + "testing" + + v2acl "github.com/nspcc-dev/neofs-api-go/v2/acl" + "github.com/stretchr/testify/require" +) + +func TestFilter(t *testing.T) { + filter := &Filter{ + from: HeaderFromObject, + name: HdrObjSysNamePayloadLength, + matcher: MatchStringEqual, + value: "200", + } + + v2 := filter.ToV2() + require.NotNil(t, v2) + require.Equal(t, v2acl.HeaderTypeObject, v2.GetHeaderType()) + require.EqualValues(t, v2acl.MatchTypeStringEqual, v2.GetMatchType()) + require.Equal(t, filter.Name(), v2.GetName()) + require.Equal(t, filter.Value(), v2.GetValue()) + + newFilter := NewFilterFromV2(v2) + require.Equal(t, filter, newFilter) + + t.Run("from nil v2 filter", func(t *testing.T) { + require.Equal(t, new(Filter), NewFilterFromV2(nil)) + }) +} diff --git a/pkg/acl/eacl/record_test.go b/pkg/acl/eacl/record_test.go new file mode 100644 index 0000000..f9b8ffb --- /dev/null +++ b/pkg/acl/eacl/record_test.go @@ -0,0 +1,83 @@ +package eacl + +import ( + "crypto/ecdsa" + "testing" + + v2acl "github.com/nspcc-dev/neofs-api-go/v2/acl" + "github.com/nspcc-dev/neofs-crypto/test" + "github.com/stretchr/testify/require" +) + +func TestRecord(t *testing.T) { + record := NewRecord() + record.SetOperation(OperationRange) + record.SetAction(ActionAllow) + record.AddFilter(HeaderFromRequest, MatchStringEqual, "A", "B") + record.AddFilter(HeaderFromRequest, MatchStringNotEqual, "C", "D") + record.AddTarget(RoleSystem) + + v2 := record.ToV2() + require.NotNil(t, v2) + require.Equal(t, v2acl.OperationRange, v2.GetOperation()) + require.Equal(t, v2acl.ActionAllow, v2.GetAction()) + require.Len(t, v2.GetFilters(), len(record.Filters())) + require.Len(t, v2.GetTargets(), len(record.Targets())) + + newRecord := NewRecordFromV2(v2) + require.Equal(t, record, newRecord) + + t.Run("create record", func(t *testing.T) { + record := CreateRecord(ActionAllow, OperationGet) + require.Equal(t, ActionAllow, record.Action()) + require.Equal(t, OperationGet, record.Operation()) + }) + + t.Run("new from nil v2 record", func(t *testing.T) { + require.Equal(t, new(Record), NewRecordFromV2(nil)) + }) +} + +func TestRecord_AddTarget(t *testing.T) { + targets := []Target{ + { + role: RoleUnknown, + keys: []ecdsa.PublicKey{test.DecodeKey(1).PublicKey}, + }, + { + role: RoleSystem, + keys: []ecdsa.PublicKey{}, + }, + } + + r := NewRecord() + for _, target := range targets { + r.AddTarget(target.Role(), target.Keys()...) + } + + require.Equal(t, targets, r.Targets()) +} + +func TestRecord_AddFilter(t *testing.T) { + filters := []Filter{ + { + from: HeaderFromObject, + name: HdrObjSysNameCID, + matcher: MatchStringEqual, + value: "ContainerID", + }, + { + from: HeaderFromRequest, + name: "X-Header-Name", + matcher: MatchStringNotEqual, + value: "X-Header-Value", + }, + } + + r := NewRecord() + for _, filter := range filters { + r.AddFilter(filter.From(), filter.Matcher(), filter.Name(), filter.Value()) + } + + require.Equal(t, filters, r.Filters()) +} diff --git a/pkg/acl/eacl/table_test.go b/pkg/acl/eacl/table_test.go index b4d52b5..e7121fb 100644 --- a/pkg/acl/eacl/table_test.go +++ b/pkg/acl/eacl/table_test.go @@ -1,17 +1,80 @@ package eacl_test import ( + "crypto/sha256" "testing" + "github.com/nspcc-dev/neofs-api-go/pkg" "github.com/nspcc-dev/neofs-api-go/pkg/acl/eacl" + "github.com/nspcc-dev/neofs-api-go/pkg/container" "github.com/nspcc-dev/neofs-crypto/test" + "github.com/stretchr/testify/require" ) -func TextExample(t *testing.T) { +// example how to create eACL tables in applications +func example() { record := eacl.CreateRecord(eacl.ActionDeny, eacl.OperationPut) record.AddFilter(eacl.HeaderFromObject, eacl.MatchStringEqual, "filename", "cat.jpg") record.AddTarget(eacl.RoleOthers, test.DecodeKey(1).PublicKey, test.DecodeKey(2).PublicKey) - table := eacl.NewTable() + var cid container.ID + cid.SetSHA256(sha256.Sum256([]byte("container id"))) + + table := eacl.CreateTable(cid) table.AddRecord(record) } + +func TestTable(t *testing.T) { + var ( + v pkg.Version + cid container.ID + ) + + sha := sha256.Sum256([]byte("container id")) + cid.SetSHA256(sha) + + v.SetMajor(3) + v.SetMinor(2) + + table := eacl.NewTable() + table.SetVersion(v) + table.SetCID(&cid) + table.AddRecord(eacl.CreateRecord(eacl.ActionAllow, eacl.OperationPut)) + + v2 := table.ToV2() + require.NotNil(t, v2) + require.Equal(t, uint32(3), v2.GetVersion().GetMajor()) + require.Equal(t, uint32(2), v2.GetVersion().GetMinor()) + require.Equal(t, sha[:], v2.GetContainerID().GetValue()) + require.Len(t, v2.GetRecords(), 1) + + newTable := eacl.NewTableFromV2(v2) + require.Equal(t, table, newTable) + + t.Run("new from nil v2 table", func(t *testing.T) { + require.Equal(t, new(eacl.Table), eacl.NewTableFromV2(nil)) + }) + + t.Run("create table", func(t *testing.T) { + var cid = new(container.ID) + cid.SetSHA256(sha256.Sum256([]byte("container id"))) + + table := eacl.CreateTable(*cid) + require.Equal(t, cid, table.CID()) + require.Equal(t, *pkg.SDKVersion(), table.Version()) + }) +} + +func TestTable_AddRecord(t *testing.T) { + records := []eacl.Record{ + *eacl.CreateRecord(eacl.ActionDeny, eacl.OperationDelete), + *eacl.CreateRecord(eacl.ActionAllow, eacl.OperationPut), + } + + table := eacl.NewTable() + for _, record := range records { + table.AddRecord(&record) + } + + require.Equal(t, records, table.Records()) +} diff --git a/pkg/acl/eacl/target_test.go b/pkg/acl/eacl/target_test.go new file mode 100644 index 0000000..dd26f4b --- /dev/null +++ b/pkg/acl/eacl/target_test.go @@ -0,0 +1,38 @@ +package eacl + +import ( + "crypto/ecdsa" + "testing" + + v2acl "github.com/nspcc-dev/neofs-api-go/v2/acl" + crypto "github.com/nspcc-dev/neofs-crypto" + "github.com/nspcc-dev/neofs-crypto/test" + "github.com/stretchr/testify/require" +) + +func TestTarget(t *testing.T) { + keys := []ecdsa.PublicKey{ + test.DecodeKey(1).PublicKey, + test.DecodeKey(2).PublicKey, + } + + target := &Target{ + role: RoleSystem, + keys: keys, + } + + v2 := target.ToV2() + require.NotNil(t, v2) + require.Equal(t, v2acl.RoleSystem, v2.GetRole()) + require.Len(t, v2.GetKeyList(), len(keys)) + for i, key := range v2.GetKeyList() { + require.Equal(t, key, crypto.MarshalPublicKey(&keys[i])) + } + + newTarget := NewTargetFromV2(v2) + require.Equal(t, target, newTarget) + + t.Run("from nil v2 target", func(t *testing.T) { + require.Equal(t, new(Target), NewTargetFromV2(nil)) + }) +} From 052a4a97dcc33bb29907576958315d2929bc725e Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Wed, 16 Sep 2020 12:15:20 +0300 Subject: [PATCH 0416/1196] [#139] sdk/acl: Highlight prefix of well known header names Signed-off-by: Alex Vanin --- pkg/acl/eacl/enums.go | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/pkg/acl/eacl/enums.go b/pkg/acl/eacl/enums.go index 38ab97d..f626202 100644 --- a/pkg/acl/eacl/enums.go +++ b/pkg/acl/eacl/enums.go @@ -60,23 +60,29 @@ const ( ) const ( + // ReservedHeaderNamePrefix used in filter names to specify well known + // headers such as container id, object id, owner id, etc. + // All names without this prefix used to lookup through user defined headers + // in object or x-headers in request. + ReservedHeaderNamePrefix = "_" + // HdrObjSysNameID is a name of ID field in system header of object. - HdrObjSysNameID = "_ID" + HdrObjSysNameID = ReservedHeaderNamePrefix + "ID" // HdrObjSysNameCID is a name of cid field in system header of object. - HdrObjSysNameCID = "_CID" + HdrObjSysNameCID = ReservedHeaderNamePrefix + "CID" // HdrObjSysNameOwnerID is a name of OwnerID field in system header of object. - HdrObjSysNameOwnerID = "_OWNER_ID" + HdrObjSysNameOwnerID = ReservedHeaderNamePrefix + "OWNER_ID" // HdrObjSysNameVersion is a name of version field in system header of object. - HdrObjSysNameVersion = "_VERSION" + HdrObjSysNameVersion = ReservedHeaderNamePrefix + "VERSION" // HdrObjSysNamePayloadLength is a name of PayloadLength field in system header of object. - HdrObjSysNamePayloadLength = "_PAYLOAD_LENGTH" + HdrObjSysNamePayloadLength = ReservedHeaderNamePrefix + "PAYLOAD_LENGTH" // HdrObjSysNameCreatedEpoch is a name of CreatedAt.Epoch field in system header of object. - HdrObjSysNameCreatedEpoch = "_CREATED_EPOCH" + HdrObjSysNameCreatedEpoch = ReservedHeaderNamePrefix + "CREATED_EPOCH" ) func (a Action) ToV2() v2acl.Action { From 1ac6f2eeebcdcc7e9d0159a3e65be20571731e1f Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 16 Sep 2020 14:16:58 +0300 Subject: [PATCH 0417/1196] [#145] sdk/object: Refactor logic of field setters In previous implementation RawObject constructor initialized internal v2 Object structure recursively so that further you can directly set the values of nested fields. This caused the object created by constructor New to be different from the object created from the empty object v2. Remove recursive initialization of v2 Object from New and NewRaw constructors. Make setters to initialize nested structures on demand. Signed-off-by: Leonard Lyubich --- pkg/object/object.go | 2 +- pkg/object/raw.go | 2 +- pkg/object/rw.go | 112 +++++++++++++++++++++++-------------------- 3 files changed, 61 insertions(+), 55 deletions(-) diff --git a/pkg/object/object.go b/pkg/object/object.go index c743414..e447be5 100644 --- a/pkg/object/object.go +++ b/pkg/object/object.go @@ -26,7 +26,7 @@ func NewFromV2(oV2 *object.Object) *Object { // // Works similar as NewFromV2(new(Object)). func New() *Object { - return NewFromV2(initObjectRecursive()) + return NewFromV2(new(object.Object)) } // ToV2 converts Object to v2 Object message. diff --git a/pkg/object/raw.go b/pkg/object/raw.go index 18edac3..0878f48 100644 --- a/pkg/object/raw.go +++ b/pkg/object/raw.go @@ -25,7 +25,7 @@ func NewRawFromV2(oV2 *object.Object) *RawObject { // // Works similar as NewRawFromV2(new(Object)). func NewRaw() *RawObject { - return NewRawFromV2(initObjectRecursive()) + return NewRawFromV2(new(object.Object)) } // Object returns read-only object instance. diff --git a/pkg/object/rw.go b/pkg/object/rw.go index a9c7647..5ed9f5e 100644 --- a/pkg/object/rw.go +++ b/pkg/object/rw.go @@ -12,18 +12,6 @@ import ( // public getter and private setters. type rwObject object.Object -func initObjectRecursive() *object.Object { - obj := new(object.Object) - - hdr := new(object.Header) - - hdr.SetSplit(new(object.SplitHeader)) - - obj.SetHeader(hdr) - - return obj -} - // TODO: add session token methods // ToV2 converts Object to v2 Object message. @@ -31,6 +19,30 @@ func (o *rwObject) ToV2() *object.Object { return (*object.Object)(o) } +func (o *rwObject) setHeaderField(setter func(*object.Header)) { + obj := (*object.Object)(o) + h := obj.GetHeader() + + if h == nil { + h = new(object.Header) + obj.SetHeader(h) + } + + setter(h) +} + +func (o *rwObject) setSplitFields(setter func(*object.SplitHeader)) { + o.setHeaderField(func(h *object.Header) { + split := h.GetSplit() + if split == nil { + split = new(object.SplitHeader) + h.SetSplit(split) + } + + setter(split) + }) +} + // GetID returns object identifier. func (o *rwObject) GetID() *ID { return NewIDFromV2( @@ -78,9 +90,9 @@ func (o *rwObject) GetVersion() *pkg.Version { } func (o *rwObject) setVersion(v *pkg.Version) { - (*object.Object)(o). - GetHeader(). - SetVersion(v.ToV2()) + o.setHeaderField(func(h *object.Header) { + h.SetVersion(v.ToV2()) + }) } // GetPayloadSize returns payload length of the object. @@ -91,9 +103,9 @@ func (o *rwObject) GetPayloadSize() uint64 { } func (o *rwObject) setPayloadSize(v uint64) { - (*object.Object)(o). - GetHeader(). - SetPayloadLength(v) + o.setHeaderField(func(h *object.Header) { + h.SetPayloadLength(v) + }) } // GetContainerID returns identifier of the related container. @@ -106,9 +118,9 @@ func (o *rwObject) GetContainerID() *container.ID { } func (o *rwObject) setContainerID(v *container.ID) { - (*object.Object)(o). - GetHeader(). - SetContainerID(v.ToV2()) + o.setHeaderField(func(h *object.Header) { + h.SetContainerID(v.ToV2()) + }) } // GetOwnerID returns identifier of the object owner. @@ -121,9 +133,9 @@ func (o *rwObject) GetOwnerID() *owner.ID { } func (o *rwObject) setOwnerID(v *owner.ID) { - (*object.Object)(o). - GetHeader(). - SetOwnerID(v.ToV2()) + o.setHeaderField(func(h *object.Header) { + h.SetOwnerID(v.ToV2()) + }) } // GetCreationEpoch returns epoch number in which object was created. @@ -134,9 +146,9 @@ func (o *rwObject) GetCreationEpoch() uint64 { } func (o *rwObject) setCreationEpoch(v uint64) { - (*object.Object)(o). - GetHeader(). - SetCreationEpoch(v) + o.setHeaderField(func(h *object.Header) { + h.SetCreationEpoch(v) + }) } // GetPayloadChecksum returns checksum of the object payload. @@ -149,9 +161,9 @@ func (o *rwObject) GetPayloadChecksum() *pkg.Checksum { } func (o *rwObject) setPayloadChecksum(v *pkg.Checksum) { - (*object.Object)(o). - GetHeader(). - SetPayloadHash(v.ToV2()) + o.setHeaderField(func(h *object.Header) { + h.SetPayloadHash(v.ToV2()) + }) } // GetPayloadHomomorphicHash returns homomorphic hash of the object payload. @@ -164,9 +176,9 @@ func (o *rwObject) GetPayloadHomomorphicHash() *pkg.Checksum { } func (o *rwObject) setPayloadHomomorphicHash(v *pkg.Checksum) { - (*object.Object)(o). - GetHeader(). - SetHomomorphicHash(v.ToV2()) + o.setHeaderField(func(h *object.Header) { + h.SetHomomorphicHash(v.ToV2()) + }) } // GetAttributes returns object attributes. @@ -185,16 +197,15 @@ func (o *rwObject) GetAttributes() []*Attribute { } func (o *rwObject) setAttributes(v ...*Attribute) { - h := (*object.Object)(o). - GetHeader() - attrs := make([]*object.Attribute, 0, len(v)) for i := range v { attrs = append(attrs, v[i].ToV2()) } - h.SetAttributes(attrs) + o.setHeaderField(func(h *object.Header) { + h.SetAttributes(attrs) + }) } // GetPreviousID returns identifier of the previous sibling object. @@ -208,10 +219,9 @@ func (o *rwObject) GetPreviousID() *ID { } func (o *rwObject) setPreviousID(v *ID) { - (*object.Object)(o). - GetHeader(). - GetSplit(). - SetPrevious(v.ToV2()) + o.setSplitFields(func(split *object.SplitHeader) { + split.SetPrevious(v.ToV2()) + }) } // GetChildren return list of the identifiers of the child objects. @@ -231,17 +241,15 @@ func (o *rwObject) GetChildren() []*ID { } func (o *rwObject) setChildren(v ...*ID) { - h := (*object.Object)(o). - GetHeader(). - GetSplit() - ids := make([]*refs.ObjectID, 0, len(v)) for i := range v { ids = append(ids, v[i].ToV2()) } - h.SetChildren(ids) + o.setSplitFields(func(split *object.SplitHeader) { + split.SetChildren(ids) + }) } // GetParent returns parent object w/o payload. @@ -259,11 +267,9 @@ func (o *rwObject) GetParent() *Object { } func (o *rwObject) setParent(v *Object) { - h := (*object.Object)(o). - GetHeader(). - GetSplit() - - h.SetParent((*object.Object)(v.rwObject).GetObjectID()) - h.SetParentSignature((*object.Object)(v.rwObject).GetSignature()) - h.SetParentHeader((*object.Object)(v.rwObject).GetHeader()) + o.setSplitFields(func(split *object.SplitHeader) { + split.SetParent((*object.Object)(v.rwObject).GetObjectID()) + split.SetParentSignature((*object.Object)(v.rwObject).GetSignature()) + split.SetParentHeader((*object.Object)(v.rwObject).GetHeader()) + }) } From 0b9ddd10f8375e56d6555eda2c953e641e6269b5 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 16 Sep 2020 14:23:09 +0300 Subject: [PATCH 0418/1196] [#145] sdk/object: Implement Object deserialization function Signed-off-by: Leonard Lyubich --- pkg/object/object.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pkg/object/object.go b/pkg/object/object.go index e447be5..9de49a7 100644 --- a/pkg/object/object.go +++ b/pkg/object/object.go @@ -37,3 +37,14 @@ func (o *Object) ToV2() *object.Object { return nil } + +// FromBytes restores Object instance from a binary representation. +func FromBytes(data []byte) (*Object, error) { + oV2 := new(object.Object) + + if err := oV2.StableUnmarshal(data); err != nil { + return nil, err + } + + return NewFromV2(oV2), nil +} From dfcc21242b0ccfe817e259a9f6faa2ad91b879b9 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Tue, 15 Sep 2020 13:47:43 +0300 Subject: [PATCH 0419/1196] [#144] sdk/token: Define session token structure Signed-off-by: Alex Vanin --- pkg/token/session.go | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 pkg/token/session.go diff --git a/pkg/token/session.go b/pkg/token/session.go new file mode 100644 index 0000000..eec6fd3 --- /dev/null +++ b/pkg/token/session.go @@ -0,0 +1,35 @@ +package token + +import ( + "github.com/google/uuid" +) + +type SessionToken struct { + id uuid.UUID + pubKey []byte +} + +func CreateSessionToken(id, pub []byte) (*SessionToken, error) { + var tokenID uuid.UUID + + err := tokenID.UnmarshalBinary(id) + if err != nil { + return nil, err + } + + key := make([]byte, len(pub)) + copy(key[:], pub) + + return &SessionToken{ + id: tokenID, + pubKey: key, + }, nil +} + +func (s SessionToken) SessionKey() []byte { + return s.pubKey +} + +func (s SessionToken) ID() []byte { + return s.id[:] +} From 378313317329648792ef4ac4c5f7ae21dac8f90f Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Tue, 15 Sep 2020 13:49:20 +0300 Subject: [PATCH 0420/1196] [#144] sdk/client: Add RPC to create session token Signed-off-by: Alex Vanin --- pkg/client/opts.go | 1 + pkg/client/session.go | 112 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 113 insertions(+) create mode 100644 pkg/client/session.go diff --git a/pkg/client/opts.go b/pkg/client/opts.go index de37e2c..4de5823 100644 --- a/pkg/client/opts.go +++ b/pkg/client/opts.go @@ -41,6 +41,7 @@ type ( conn *grpc.ClientConn v2ContainerClient *v2container.Client v2AccountingClient *v2accounting.Client + v2SessionClient *v2session.Client objectClientV2 *v2object.Client } diff --git a/pkg/client/session.go b/pkg/client/session.go new file mode 100644 index 0000000..fee9e7f --- /dev/null +++ b/pkg/client/session.go @@ -0,0 +1,112 @@ +package client + +import ( + "context" + + "github.com/nspcc-dev/neofs-api-go/pkg/owner" + "github.com/nspcc-dev/neofs-api-go/pkg/token" + "github.com/nspcc-dev/neofs-api-go/v2/client" + v2session "github.com/nspcc-dev/neofs-api-go/v2/session" + v2signature "github.com/nspcc-dev/neofs-api-go/v2/signature" + "github.com/pkg/errors" +) + +func (c Client) CreateSession(ctx context.Context, expiration uint64, opts ...CallOption) (*token.SessionToken, error) { + switch c.remoteNode.Version.GetMajor() { + case 2: + return c.createSessionV2(ctx, expiration, opts...) + default: + return nil, unsupportedProtocolErr + } +} + +func (c Client) createSessionV2(ctx context.Context, expiration uint64, opts ...CallOption) (*token.SessionToken, error) { + // apply all available options + callOptions := defaultCallOptions() + for i := range opts { + opts[i].apply(&callOptions) + } + + w, err := owner.NEO3WalletFromPublicKey(&c.key.PublicKey) + if err != nil { + return nil, err + } + + ownerID := new(owner.ID) + ownerID.SetNeo3Wallet(w) + + reqBody := new(v2session.CreateRequestBody) + reqBody.SetOwnerID(ownerID.ToV2()) + reqBody.SetExpiration(expiration) + + req := new(v2session.CreateRequest) + req.SetBody(reqBody) + req.SetMetaHeader(v2MetaHeaderFromOpts(callOptions)) + + err = v2signature.SignServiceMessage(c.key, req) + if err != nil { + return nil, err + } + + switch c.remoteNode.Protocol { + case GRPC: + cli, err := v2SessionClientFromOptions(c.opts) + if err != nil { + return nil, errors.Wrap(err, "can't create grpc client") + } + + resp, err := cli.Create(ctx, req) + if err != nil { + return nil, errors.Wrap(err, "transport error") + } + + err = v2signature.VerifyServiceMessage(resp) + if err != nil { + return nil, errors.Wrap(err, "can't verify response message") + } + + body := resp.GetBody() + if body == nil { + return nil, errors.New("malformed response body") + } + + sessionToken, err := token.CreateSessionToken(body.GetID(), body.GetSessionKey()) + if err != nil { + return nil, errors.Wrap(err, "malformed response body") + } + + return sessionToken, nil + default: + return nil, unsupportedProtocolErr + } +} + +func v2SessionClientFromOptions(opts *clientOptions) (cli *v2session.Client, err error) { + switch { + case opts.grpcOpts.v2SessionClient != nil: + // return value from client cache + return opts.grpcOpts.v2SessionClient, nil + + case opts.grpcOpts.conn != nil: + cli, err = v2session.NewClient(v2session.WithGlobalOpts( + client.WithGRPCConn(opts.grpcOpts.conn)), + ) + + case opts.addr != "": + cli, err = v2session.NewClient(v2session.WithGlobalOpts( + client.WithNetworkAddress(opts.addr)), + ) + + default: + return nil, errors.New("lack of sdk client options to create accounting client") + } + + // check if client correct and save in cache + if err != nil { + return nil, err + } + + opts.grpcOpts.v2SessionClient = cli + + return cli, nil +} From 5fa271e141697bc13f94c54263c592323f4aafd1 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Tue, 15 Sep 2020 13:51:36 +0300 Subject: [PATCH 0421/1196] [#144] sdk/client: Add call option to set session token Signed-off-by: Alex Vanin --- pkg/client/object.go | 99 +++++++++++++++++++++++++++++++++++++++++--- pkg/client/opts.go | 17 +++++++- 2 files changed, 109 insertions(+), 7 deletions(-) diff --git a/pkg/client/object.go b/pkg/client/object.go index 5c11189..27507c2 100644 --- a/pkg/client/object.go +++ b/pkg/client/object.go @@ -9,9 +9,11 @@ import ( "io" "github.com/nspcc-dev/neofs-api-go/pkg/object" + signer "github.com/nspcc-dev/neofs-api-go/util/signature" "github.com/nspcc-dev/neofs-api-go/v2/client" v2object "github.com/nspcc-dev/neofs-api-go/v2/object" v2refs "github.com/nspcc-dev/neofs-api-go/v2/refs" + v2session "github.com/nspcc-dev/neofs-api-go/v2/session" "github.com/nspcc-dev/neofs-api-go/v2/signature" "github.com/pkg/errors" ) @@ -200,8 +202,19 @@ func (c *Client) putObjectV2(ctx context.Context, p *PutObjectParams, opts ...Ca body := new(v2object.PutRequestBody) req.SetBody(body) + v2Addr := new(v2refs.Address) + v2Addr.SetObjectID(p.obj.GetID().ToV2()) + v2Addr.SetContainerID(p.obj.GetContainerID().ToV2()) + // set meta header - req.SetMetaHeader(v2MetaHeaderFromOpts(callOpts)) + meta := v2MetaHeaderFromOpts(callOpts) + if err = c.attachV2SessionToken(callOpts, meta, v2SessionReqInfo{ + addr: v2Addr, + verb: v2session.ObjectVerbPut, + }); err != nil { + return nil, errors.Wrap(err, "could not sign session token") + } + req.SetMetaHeader(meta) // initialize init part initPart := new(v2object.PutObjectPartInit) @@ -304,7 +317,14 @@ func (c *Client) deleteObjectV2(ctx context.Context, p *DeleteObjectParams, opts req.SetBody(body) // set meta header - req.SetMetaHeader(v2MetaHeaderFromOpts(callOpts)) + meta := v2MetaHeaderFromOpts(callOpts) + if err = c.attachV2SessionToken(callOpts, meta, v2SessionReqInfo{ + addr: p.addr.ToV2(), + verb: v2session.ObjectVerbDelete, + }); err != nil { + return errors.Wrap(err, "could not sign session token") + } + req.SetMetaHeader(meta) // fill body fields body.SetAddress(p.addr.ToV2()) @@ -377,7 +397,14 @@ func (c *Client) getObjectV2(ctx context.Context, p *GetObjectParams, opts ...Ca req.SetBody(body) // set meta header - req.SetMetaHeader(v2MetaHeaderFromOpts(callOpts)) + meta := v2MetaHeaderFromOpts(callOpts) + if err = c.attachV2SessionToken(callOpts, meta, v2SessionReqInfo{ + addr: p.addr.ToV2(), + verb: v2session.ObjectVerbGet, + }); err != nil { + return nil, errors.Wrap(err, "could not sign session token") + } + req.SetMetaHeader(meta) // fill body fields body.SetAddress(p.addr.ToV2()) @@ -503,7 +530,14 @@ func (c *Client) getObjectHeaderV2(ctx context.Context, p *ObjectHeaderParams, o req.SetBody(body) // set meta header - req.SetMetaHeader(v2MetaHeaderFromOpts(callOpts)) + meta := v2MetaHeaderFromOpts(callOpts) + if err = c.attachV2SessionToken(callOpts, meta, v2SessionReqInfo{ + addr: p.addr.ToV2(), + verb: v2session.ObjectVerbHead, + }); err != nil { + return nil, errors.Wrap(err, "could not sign session token") + } + req.SetMetaHeader(meta) // fill body fields body.SetAddress(p.addr.ToV2()) @@ -626,7 +660,14 @@ func (c *Client) objectPayloadRangeV2(ctx context.Context, p *RangeDataParams, o req.SetBody(body) // set meta header - req.SetMetaHeader(v2MetaHeaderFromOpts(callOpts)) + meta := v2MetaHeaderFromOpts(callOpts) + if err = c.attachV2SessionToken(callOpts, meta, v2SessionReqInfo{ + addr: p.addr.ToV2(), + verb: v2session.ObjectVerbRange, + }); err != nil { + return nil, errors.Wrap(err, "could not sign session token") + } + req.SetMetaHeader(meta) // fill body fields body.SetAddress(p.addr.ToV2()) @@ -761,7 +802,14 @@ func (c *Client) objectPayloadRangeHashV2(ctx context.Context, p *RangeChecksumP req.SetBody(body) // set meta header - req.SetMetaHeader(v2MetaHeaderFromOpts(callOpts)) + meta := v2MetaHeaderFromOpts(callOpts) + if err = c.attachV2SessionToken(callOpts, meta, v2SessionReqInfo{ + addr: p.addr.ToV2(), + verb: v2session.ObjectVerbRangeHash, + }); err != nil { + return nil, errors.Wrap(err, "could not sign session token") + } + req.SetMetaHeader(meta) // fill body fields body.SetAddress(p.addr.ToV2()) @@ -867,3 +915,42 @@ func v2ObjectClient(proto TransportProtocol, opts *clientOptions) (*v2object.Cli return nil, unsupportedProtocolErr } } + +func (c Client) attachV2SessionToken(opts callOptions, hdr *v2session.RequestMetaHeader, info v2SessionReqInfo) error { + if opts.session == nil { + return nil + } + + opCtx := new(v2session.ObjectSessionContext) + opCtx.SetAddress(info.addr) + opCtx.SetVerb(info.verb) + + lt := new(v2session.TokenLifetime) + lt.SetIat(info.iat) + lt.SetNbf(info.nbf) + lt.SetExp(info.exp) + + body := new(v2session.SessionTokenBody) + body.SetID(opts.session.ID()) + body.SetSessionKey(opts.session.SessionKey()) + body.SetContext(opCtx) + body.SetLifetime(lt) + + token := new(v2session.SessionToken) + token.SetBody(body) + + signWrapper := signature.StableMarshalerWrapper{SM: token.GetBody()} + err := signer.SignDataWithHandler(c.key, signWrapper, func(key []byte, sig []byte) { + sessionTokenSignature := new(v2refs.Signature) + sessionTokenSignature.SetKey(key) + sessionTokenSignature.SetSign(sig) + token.SetSignature(sessionTokenSignature) + }) + if err != nil { + return err + } + + hdr.SetSessionToken(token) + + return nil +} diff --git a/pkg/client/opts.go b/pkg/client/opts.go index 4de5823..2407162 100644 --- a/pkg/client/opts.go +++ b/pkg/client/opts.go @@ -2,9 +2,11 @@ package client import ( "github.com/nspcc-dev/neofs-api-go/pkg" + "github.com/nspcc-dev/neofs-api-go/pkg/token" v2accounting "github.com/nspcc-dev/neofs-api-go/v2/accounting" v2container "github.com/nspcc-dev/neofs-api-go/v2/container" v2object "github.com/nspcc-dev/neofs-api-go/v2/object" + "github.com/nspcc-dev/neofs-api-go/v2/refs" v2session "github.com/nspcc-dev/neofs-api-go/v2/session" "google.golang.org/grpc" ) @@ -27,7 +29,7 @@ type ( xHeaders []xHeader ttl uint32 epoch uint64 - // add session token + session *token.SessionToken // add bearer token } @@ -45,6 +47,13 @@ type ( objectClientV2 *v2object.Client } + + v2SessionReqInfo struct { + addr *refs.Address + verb v2session.ObjectSessionVerb + + exp, nbf, iat uint64 + } ) func defaultCallOptions() callOptions { @@ -92,6 +101,12 @@ func WithEpoch(epoch uint64) CallOption { }) } +func WithSession(token *token.SessionToken) CallOption { + return newFuncCallOption(func(option *callOptions) { + option.session = token + }) +} + func v2MetaHeaderFromOpts(options callOptions) *v2session.RequestMetaHeader { meta := new(v2session.RequestMetaHeader) meta.SetVersion(options.version.ToV2()) From 2a7e91fa136fe526aedca9ef5d753dcc86f2b7fe Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Wed, 16 Sep 2020 15:19:43 +0300 Subject: [PATCH 0422/1196] [#144] sdk/token: Use MarshalBinary to uuid of session token Signed-off-by: Alex Vanin --- pkg/token/session.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pkg/token/session.go b/pkg/token/session.go index eec6fd3..450a9a7 100644 --- a/pkg/token/session.go +++ b/pkg/token/session.go @@ -31,5 +31,10 @@ func (s SessionToken) SessionKey() []byte { } func (s SessionToken) ID() []byte { - return s.id[:] + data, err := s.id.MarshalBinary() + if err != nil { + panic(err) // must never panic + } + + return data } From f60069ec9f488d8ab5e30137cc5c6ffaef89d828 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Thu, 17 Sep 2020 12:20:11 +0300 Subject: [PATCH 0423/1196] [#146] sdk/object: Move well-known header const to object type Extended ACL filters and object search filters use strings to specify well-known object headers, such as owner id, object id, etc. To unify these constant they've been moved into object package, because they specifying object related headers. This should be noted in nspcc-dev/neofs-spec#12 Signed-off-by: Alex Vanin --- pkg/acl/eacl/enums.go | 26 -------------------------- pkg/acl/eacl/filter_test.go | 3 ++- pkg/acl/eacl/record_test.go | 3 ++- pkg/object/wellknown_headers.go | 31 +++++++++++++++++++++++++++++++ 4 files changed, 35 insertions(+), 28 deletions(-) create mode 100644 pkg/object/wellknown_headers.go diff --git a/pkg/acl/eacl/enums.go b/pkg/acl/eacl/enums.go index f626202..f861d66 100644 --- a/pkg/acl/eacl/enums.go +++ b/pkg/acl/eacl/enums.go @@ -59,32 +59,6 @@ const ( HeaderFromObject ) -const ( - // ReservedHeaderNamePrefix used in filter names to specify well known - // headers such as container id, object id, owner id, etc. - // All names without this prefix used to lookup through user defined headers - // in object or x-headers in request. - ReservedHeaderNamePrefix = "_" - - // HdrObjSysNameID is a name of ID field in system header of object. - HdrObjSysNameID = ReservedHeaderNamePrefix + "ID" - - // HdrObjSysNameCID is a name of cid field in system header of object. - HdrObjSysNameCID = ReservedHeaderNamePrefix + "CID" - - // HdrObjSysNameOwnerID is a name of OwnerID field in system header of object. - HdrObjSysNameOwnerID = ReservedHeaderNamePrefix + "OWNER_ID" - - // HdrObjSysNameVersion is a name of version field in system header of object. - HdrObjSysNameVersion = ReservedHeaderNamePrefix + "VERSION" - - // HdrObjSysNamePayloadLength is a name of PayloadLength field in system header of object. - HdrObjSysNamePayloadLength = ReservedHeaderNamePrefix + "PAYLOAD_LENGTH" - - // HdrObjSysNameCreatedEpoch is a name of CreatedAt.Epoch field in system header of object. - HdrObjSysNameCreatedEpoch = ReservedHeaderNamePrefix + "CREATED_EPOCH" -) - func (a Action) ToV2() v2acl.Action { switch a { case ActionAllow: diff --git a/pkg/acl/eacl/filter_test.go b/pkg/acl/eacl/filter_test.go index 57dcb1d..17806c2 100644 --- a/pkg/acl/eacl/filter_test.go +++ b/pkg/acl/eacl/filter_test.go @@ -3,6 +3,7 @@ package eacl import ( "testing" + "github.com/nspcc-dev/neofs-api-go/pkg/object" v2acl "github.com/nspcc-dev/neofs-api-go/v2/acl" "github.com/stretchr/testify/require" ) @@ -10,7 +11,7 @@ import ( func TestFilter(t *testing.T) { filter := &Filter{ from: HeaderFromObject, - name: HdrObjSysNamePayloadLength, + name: object.HdrSysNamePayloadLength, matcher: MatchStringEqual, value: "200", } diff --git a/pkg/acl/eacl/record_test.go b/pkg/acl/eacl/record_test.go index f9b8ffb..1ed7263 100644 --- a/pkg/acl/eacl/record_test.go +++ b/pkg/acl/eacl/record_test.go @@ -4,6 +4,7 @@ import ( "crypto/ecdsa" "testing" + "github.com/nspcc-dev/neofs-api-go/pkg/object" v2acl "github.com/nspcc-dev/neofs-api-go/v2/acl" "github.com/nspcc-dev/neofs-crypto/test" "github.com/stretchr/testify/require" @@ -62,7 +63,7 @@ func TestRecord_AddFilter(t *testing.T) { filters := []Filter{ { from: HeaderFromObject, - name: HdrObjSysNameCID, + name: object.HdrSysNameCID, matcher: MatchStringEqual, value: "ContainerID", }, diff --git a/pkg/object/wellknown_headers.go b/pkg/object/wellknown_headers.go new file mode 100644 index 0000000..02e2e78 --- /dev/null +++ b/pkg/object/wellknown_headers.go @@ -0,0 +1,31 @@ +package object + +// This file contains well-known header names for eACL filters and search +// request filters. Both of them encode header type as string. There are +// constant strings for well-known object headers. + +const ( + // ReservedHeaderNamePrefix used in filter names to specify well known + // headers such as container id, object id, owner id, etc. + // All names without this prefix used to lookup through user defined headers + // in object or x-headers in request. + ReservedHeaderNamePrefix = "_" + + // HdrSysNameID is a name of ID field in system header of object. + HdrSysNameID = ReservedHeaderNamePrefix + "ID" + + // HdrSysNameCID is a name of cid field in system header of object. + HdrSysNameCID = ReservedHeaderNamePrefix + "CID" + + // HdrSysNameOwnerID is a name of OwnerID field in system header of object. + HdrSysNameOwnerID = ReservedHeaderNamePrefix + "OWNER_ID" + + // HdrSysNameVersion is a name of version field in system header of object. + HdrSysNameVersion = ReservedHeaderNamePrefix + "VERSION" + + // HdrSysNamePayloadLength is a name of PayloadLength field in system header of object. + HdrSysNamePayloadLength = ReservedHeaderNamePrefix + "PAYLOAD_LENGTH" + + // HdrSysNameCreatedEpoch is a name of CreatedAt.Epoch field in system header of object. + HdrSysNameCreatedEpoch = ReservedHeaderNamePrefix + "CREATED_EPOCH" +) From fea8cd48f2e0af81475de1c0928fab27ce49275d Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Thu, 17 Sep 2020 12:20:35 +0300 Subject: [PATCH 0424/1196] [#146] sdk/object: Add structures for object search rpc call Signed-off-by: Alex Vanin --- pkg/object/search.go | 96 +++++++++++++++++++++++++++++++++++++++ pkg/object/search_test.go | 53 +++++++++++++++++++++ 2 files changed, 149 insertions(+) create mode 100644 pkg/object/search.go create mode 100644 pkg/object/search_test.go diff --git a/pkg/object/search.go b/pkg/object/search.go new file mode 100644 index 0000000..4f7a539 --- /dev/null +++ b/pkg/object/search.go @@ -0,0 +1,96 @@ +package object + +import ( + v2object "github.com/nspcc-dev/neofs-api-go/v2/object" +) + +// SearchMatchType indicates match operation on specified header. +type SearchMatchType uint32 + +const ( + MatchUnknown SearchMatchType = iota + MatchStringEqual +) + +func (m SearchMatchType) ToV2() v2object.MatchType { + switch m { + case MatchStringEqual: + return v2object.MatchStringEqual + default: + return v2object.MatchUnknown + } +} + +func SearchMatchFromV2(t v2object.MatchType) (m SearchMatchType) { + switch t { + case v2object.MatchStringEqual: + m = MatchStringEqual + default: + m = MatchUnknown + } + + return m +} + +type SearchFilter struct { + header string + value string + op SearchMatchType +} + +type SearchFilters []SearchFilter + +func (f *SearchFilter) Header() string { + return f.header +} + +func (f *SearchFilter) Value() string { + return f.value +} + +func (f *SearchFilter) Operation() SearchMatchType { + return f.op +} + +func NewSearchFilters() SearchFilters { + return SearchFilters{} +} + +func NewSearchFiltersFromV2(v2 []v2object.SearchFilter) SearchFilters { + filters := make(SearchFilters, 0, len(v2)) + for i := range v2 { + filters = append(filters, SearchFilter{ + header: v2[i].GetName(), + value: v2[i].GetValue(), + op: SearchMatchFromV2(v2[i].GetMatchType()), + }) + } + + return filters +} + +func (f *SearchFilters) AddFilter(header, value string, op SearchMatchType) { + if *f == nil { + *f = make(SearchFilters, 0, 1) + } + + *f = append(*f, SearchFilter{ + header: header, + value: value, + op: op, + }) +} + +func (f SearchFilters) ToV2() []v2object.SearchFilter { + result := make([]v2object.SearchFilter, 0, len(f)) + for i := range f { + v2 := v2object.SearchFilter{} + v2.SetName(f[i].header) + v2.SetValue(f[i].value) + v2.SetMatchType(f[i].op.ToV2()) + + result = append(result, v2) + } + + return result +} diff --git a/pkg/object/search_test.go b/pkg/object/search_test.go new file mode 100644 index 0000000..99fb139 --- /dev/null +++ b/pkg/object/search_test.go @@ -0,0 +1,53 @@ +package object_test + +import ( + "testing" + + "github.com/nspcc-dev/neofs-api-go/pkg/object" + v2object "github.com/nspcc-dev/neofs-api-go/v2/object" + "github.com/stretchr/testify/require" +) + +var ( + eqV2Matches = map[object.SearchMatchType]v2object.MatchType{ + object.MatchUnknown: v2object.MatchUnknown, + object.MatchStringEqual: v2object.MatchStringEqual, + } +) + +func TestMatch(t *testing.T) { + t.Run("known matches", func(t *testing.T) { + for i := object.MatchUnknown; i <= object.MatchStringEqual; i++ { + require.Equal(t, eqV2Matches[i], i.ToV2()) + require.Equal(t, object.SearchMatchFromV2(i.ToV2()), i) + } + }) + + t.Run("unknown matches", func(t *testing.T) { + require.Equal(t, (object.MatchStringEqual + 1).ToV2(), v2object.MatchUnknown) + require.Equal(t, object.SearchMatchFromV2(v2object.MatchStringEqual+1), object.MatchUnknown) + }) +} + +func TestFilter(t *testing.T) { + inputs := [][]string{ + {"user-header", "user-value"}, + {object.HdrSysNameID, "objectID"}, + } + + filters := object.NewSearchFilters() + for i := range inputs { + filters.AddFilter(inputs[i][0], inputs[i][1], object.MatchStringEqual) + } + + require.Len(t, filters, len(inputs)) + for i := range inputs { + require.Equal(t, inputs[i][0], filters[i].Header()) + require.Equal(t, inputs[i][1], filters[i].Value()) + require.Equal(t, object.MatchStringEqual, filters[i].Operation()) + } + + v2 := filters.ToV2() + newFilters := object.NewSearchFiltersFromV2(v2) + require.Equal(t, filters, newFilters) +} From f8e7a577de7f358de1be1f9ec98260494bc04259 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 17 Sep 2020 13:08:04 +0300 Subject: [PATCH 0425/1196] [#149] sdk/container: Add function to calculate identifier Signed-off-by: Leonard Lyubich --- pkg/container/container.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/pkg/container/container.go b/pkg/container/container.go index 07765ca..a14f257 100644 --- a/pkg/container/container.go +++ b/pkg/container/container.go @@ -1,6 +1,8 @@ package container import ( + "crypto/sha256" + "github.com/nspcc-dev/neofs-api-go/v2/container" ) @@ -53,3 +55,17 @@ func NewContainerFromV2(c *container.Container) *Container { return cnr } + +// CalculateID calculates container identifier +// based on its structure. +func CalculateID(c *Container) *ID { + data, err := c.ToV2().StableMarshal(nil) + if err != nil { + panic(err) + } + + id := NewID() + id.SetSHA256(sha256.Sum256(data)) + + return id +} From 7ef249f8dbbdf44400e3e53cbf671d8769a98e0d Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 17 Sep 2020 13:11:40 +0300 Subject: [PATCH 0426/1196] [#149] sdk/netmap: Add net address getter to Node Signed-off-by: Leonard Lyubich --- pkg/netmap/node_info.go | 6 ++++++ pkg/netmap/node_info_test.go | 21 +++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 pkg/netmap/node_info_test.go diff --git a/pkg/netmap/node_info.go b/pkg/netmap/node_info.go index 4634c8e..03a04b3 100644 --- a/pkg/netmap/node_info.go +++ b/pkg/netmap/node_info.go @@ -38,6 +38,12 @@ func (n Node) Hash() uint64 { return n.ID } +// NetworkAddress returns network address +// of the node in a string format. +func (n Node) NetworkAddress() string { + return n.InfoV2.GetAddress() +} + // NodesFromV2 converts slice of v2 netmap.NodeInfo to a generic node slice. func NodesFromV2(infos []netmap.NodeInfo) Nodes { nodes := make(Nodes, len(infos)) diff --git a/pkg/netmap/node_info_test.go b/pkg/netmap/node_info_test.go new file mode 100644 index 0000000..0da6ad2 --- /dev/null +++ b/pkg/netmap/node_info_test.go @@ -0,0 +1,21 @@ +package netmap + +import ( + "testing" + + "github.com/nspcc-dev/neofs-api-go/v2/netmap" + "github.com/stretchr/testify/require" +) + +func TestNode_NetworkAddress(t *testing.T) { + addr := "127.0.0.1:8080" + + nV2 := new(netmap.NodeInfo) + nV2.SetAddress(addr) + + n := Node{ + InfoV2: nV2, + } + + require.Equal(t, addr, n.NetworkAddress()) +} From 353448c0c365325d51a7c46df4a116ac097005a5 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 17 Sep 2020 13:16:43 +0300 Subject: [PATCH 0427/1196] [#149] sdk/object: Add address field getters and setters Signed-off-by: Leonard Lyubich --- pkg/object/address.go | 25 +++++++++++++++++++++++++ pkg/object/address_test.go | 29 +++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 pkg/object/address_test.go diff --git a/pkg/object/address.go b/pkg/object/address.go index af8271a..0c50e4f 100644 --- a/pkg/object/address.go +++ b/pkg/object/address.go @@ -1,6 +1,7 @@ package object import ( + "github.com/nspcc-dev/neofs-api-go/pkg/container" "github.com/nspcc-dev/neofs-api-go/v2/refs" "github.com/pkg/errors" ) @@ -34,3 +35,27 @@ func AddressFromBytes(data []byte) (*Address, error) { return NewAddressFromV2(addrV2), nil } + +// GetContainerID returns container identifier. +func (a *Address) GetContainerID() *container.ID { + return container.NewIDFromV2( + (*refs.Address)(a).GetContainerID(), + ) +} + +// SetContainerID sets container identifier. +func (a *Address) SetContainerID(id *container.ID) { + (*refs.Address)(a).SetContainerID(id.ToV2()) +} + +// GetObjectID returns object identifier. +func (a *Address) GetObjectID() *ID { + return NewIDFromV2( + (*refs.Address)(a).GetObjectID(), + ) +} + +// SetObjectID sets object identifier. +func (a *Address) SetObjectID(id *ID) { + (*refs.Address)(a).SetObjectID(id.ToV2()) +} diff --git a/pkg/object/address_test.go b/pkg/object/address_test.go new file mode 100644 index 0000000..d286ed4 --- /dev/null +++ b/pkg/object/address_test.go @@ -0,0 +1,29 @@ +package object + +import ( + "testing" + + "github.com/nspcc-dev/neofs-api-go/pkg/container" + "github.com/stretchr/testify/require" +) + +func TestAddress_SetContainerID(t *testing.T) { + a := NewAddress() + + cid := container.NewID() + cid.SetSHA256(randSHA256Checksum(t)) + + a.SetContainerID(cid) + + require.Equal(t, cid, a.GetContainerID()) +} + +func TestAddress_SetObjectID(t *testing.T) { + a := NewAddress() + + oid := randID(t) + + a.SetObjectID(oid) + + require.Equal(t, oid, a.GetObjectID()) +} From 549fcad76e0d4e4accb1b265fa54756387249699 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Thu, 17 Sep 2020 13:00:27 +0300 Subject: [PATCH 0428/1196] [#148] sdk/object: Change search filters v2 converter return type Unified structures from v2 package work with the slice of pointers. Signed-off-by: Alex Vanin --- pkg/object/search.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/pkg/object/search.go b/pkg/object/search.go index 4f7a539..3cf97be 100644 --- a/pkg/object/search.go +++ b/pkg/object/search.go @@ -56,9 +56,13 @@ func NewSearchFilters() SearchFilters { return SearchFilters{} } -func NewSearchFiltersFromV2(v2 []v2object.SearchFilter) SearchFilters { +func NewSearchFiltersFromV2(v2 []*v2object.SearchFilter) SearchFilters { filters := make(SearchFilters, 0, len(v2)) for i := range v2 { + if v2[i] == nil { + continue + } + filters = append(filters, SearchFilter{ header: v2[i].GetName(), value: v2[i].GetValue(), @@ -81,10 +85,10 @@ func (f *SearchFilters) AddFilter(header, value string, op SearchMatchType) { }) } -func (f SearchFilters) ToV2() []v2object.SearchFilter { - result := make([]v2object.SearchFilter, 0, len(f)) +func (f SearchFilters) ToV2() []*v2object.SearchFilter { + result := make([]*v2object.SearchFilter, 0, len(f)) for i := range f { - v2 := v2object.SearchFilter{} + v2 := new(v2object.SearchFilter) v2.SetName(f[i].header) v2.SetValue(f[i].value) v2.SetMatchType(f[i].op.ToV2()) From 73220620c5f7b49d9624170efa529fd6d89f55db Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Thu, 17 Sep 2020 13:12:48 +0300 Subject: [PATCH 0429/1196] [#148] sdk/client: Support object search rpc Signed-off-by: Alex Vanin --- pkg/client/object.go | 113 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 113 insertions(+) diff --git a/pkg/client/object.go b/pkg/client/object.go index 27507c2..f7f95a0 100644 --- a/pkg/client/object.go +++ b/pkg/client/object.go @@ -8,6 +8,7 @@ import ( "fmt" "io" + "github.com/nspcc-dev/neofs-api-go/pkg/container" "github.com/nspcc-dev/neofs-api-go/pkg/object" signer "github.com/nspcc-dev/neofs-api-go/util/signature" "github.com/nspcc-dev/neofs-api-go/v2/client" @@ -62,6 +63,12 @@ type RangeChecksumParams struct { salt []byte } +type SearchObjectParams struct { + cid *container.ID + + filters object.SearchFilters +} + type putObjectV2Writer struct { key *ecdsa.PrivateKey @@ -84,6 +91,8 @@ const chunkSize = 3 * (1 << 20) const TZSize = 64 +const searchQueryVersion uint32 = 1 + func rangesToV2(rs []*Range) []*v2object.Range { r2 := make([]*v2object.Range, 0, len(rs)) @@ -885,6 +894,110 @@ func (c *Client) objectPayloadRangeHashV2(ctx context.Context, p *RangeChecksumP return res, nil } +func (p *SearchObjectParams) WithContainerID(v *container.ID) *SearchObjectParams { + if p != nil { + p.cid = v + } + + return p +} + +func (p *SearchObjectParams) WithSearchFilters(v object.SearchFilters) *SearchObjectParams { + if p != nil { + p.filters = v + } + + return p +} + +func (c *Client) SearchObject(ctx context.Context, p *SearchObjectParams, opts ...CallOption) ([]*object.ID, error) { + // check remote node version + switch c.remoteNode.Version.GetMajor() { + case 2: + return c.searchObjectV2(ctx, p, opts...) + default: + return nil, unsupportedProtocolErr + } +} + +func (c *Client) searchObjectV2(ctx context.Context, p *SearchObjectParams, opts ...CallOption) ([]*object.ID, error) { + // create V2 Object client + cli, err := v2ObjectClient(c.remoteNode.Protocol, c.opts) + if err != nil { + return nil, errors.Wrap(err, "could not create Object V2 client") + } + + callOpts := defaultCallOptions() + + for i := range opts { + if opts[i] != nil { + opts[i].apply(&callOpts) + } + } + + // create request + req := new(v2object.SearchRequest) + + // initialize request body + body := new(v2object.SearchRequestBody) + req.SetBody(body) + + v2Addr := new(v2refs.Address) + v2Addr.SetContainerID(p.cid.ToV2()) + + // set meta header + meta := v2MetaHeaderFromOpts(callOpts) + if err = c.attachV2SessionToken(callOpts, meta, v2SessionReqInfo{ + addr: v2Addr, + verb: v2session.ObjectVerbSearch, + }); err != nil { + return nil, errors.Wrap(err, "could not sign session token") + } + req.SetMetaHeader(meta) + + // fill body fields + body.SetContainerID(v2Addr.GetContainerID()) + body.SetVersion(searchQueryVersion) + body.SetFilters(p.filters.ToV2()) + + // sign the request + if err := signature.SignServiceMessage(c.key, req); err != nil { + return nil, errors.Wrapf(err, "could not sign %T", req) + } + + // create search stream + stream, err := cli.Search(ctx, req) + if err != nil { + return nil, errors.Wrap(err, "could not create search stream") + } + + var searchResult []*object.ID + + for { + // receive message from server stream + resp, err := stream.Recv() + if err != nil { + if errors.Is(errors.Cause(err), io.EOF) { + break + } + + return nil, errors.Wrap(err, "could not receive search response") + } + + // verify response structure + if err := signature.VerifyServiceMessage(resp); err != nil { + return nil, errors.Wrapf(err, "could not verify %T", resp) + } + + chunk := resp.GetBody().GetIDList() + for i := range chunk { + searchResult = append(searchResult, object.NewIDFromV2(chunk[i])) + } + } + + return searchResult, nil +} + func v2ObjectClient(proto TransportProtocol, opts *clientOptions) (*v2object.Client, error) { switch proto { case GRPC: From 0259a06783bb11b0192f5ebbdb55a343aa8c937c Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 17 Sep 2020 18:04:04 +0300 Subject: [PATCH 0430/1196] [#150] sdk/token: Add owner ID Signed-off-by: Leonard Lyubich --- pkg/client/object.go | 8 ++-- pkg/client/session.go | 8 ++-- pkg/token/session.go | 80 +++++++++++++++++++++++++++------------ pkg/token/session_test.go | 42 ++++++++++++++++++++ 4 files changed, 104 insertions(+), 34 deletions(-) create mode 100644 pkg/token/session_test.go diff --git a/pkg/client/object.go b/pkg/client/object.go index f7f95a0..8bcedb2 100644 --- a/pkg/client/object.go +++ b/pkg/client/object.go @@ -1034,6 +1034,8 @@ func (c Client) attachV2SessionToken(opts callOptions, hdr *v2session.RequestMet return nil } + token := opts.session.ToV2() + opCtx := new(v2session.ObjectSessionContext) opCtx.SetAddress(info.addr) opCtx.SetVerb(info.verb) @@ -1043,15 +1045,11 @@ func (c Client) attachV2SessionToken(opts callOptions, hdr *v2session.RequestMet lt.SetNbf(info.nbf) lt.SetExp(info.exp) - body := new(v2session.SessionTokenBody) - body.SetID(opts.session.ID()) + body := token.GetBody() body.SetSessionKey(opts.session.SessionKey()) body.SetContext(opCtx) body.SetLifetime(lt) - token := new(v2session.SessionToken) - token.SetBody(body) - signWrapper := signature.StableMarshalerWrapper{SM: token.GetBody()} err := signer.SignDataWithHandler(c.key, signWrapper, func(key []byte, sig []byte) { sessionTokenSignature := new(v2refs.Signature) diff --git a/pkg/client/session.go b/pkg/client/session.go index fee9e7f..6c912a0 100644 --- a/pkg/client/session.go +++ b/pkg/client/session.go @@ -70,10 +70,10 @@ func (c Client) createSessionV2(ctx context.Context, expiration uint64, opts ... return nil, errors.New("malformed response body") } - sessionToken, err := token.CreateSessionToken(body.GetID(), body.GetSessionKey()) - if err != nil { - return nil, errors.Wrap(err, "malformed response body") - } + sessionToken := token.NewSessionToken() + sessionToken.SetID(body.GetID()) + sessionToken.SetSessionKey(body.GetSessionKey()) + sessionToken.SetOwnerID(ownerID) return sessionToken, nil default: diff --git a/pkg/token/session.go b/pkg/token/session.go index 450a9a7..6ff3753 100644 --- a/pkg/token/session.go +++ b/pkg/token/session.go @@ -1,40 +1,70 @@ package token import ( - "github.com/google/uuid" + "github.com/nspcc-dev/neofs-api-go/pkg/owner" + "github.com/nspcc-dev/neofs-api-go/v2/session" ) -type SessionToken struct { - id uuid.UUID - pubKey []byte +type SessionToken session.SessionToken + +func NewSessionTokenFromV2(tV2 *session.SessionToken) *SessionToken { + return (*SessionToken)(tV2) } -func CreateSessionToken(id, pub []byte) (*SessionToken, error) { - var tokenID uuid.UUID +func NewSessionToken() *SessionToken { + return NewSessionTokenFromV2(new(session.SessionToken)) +} - err := tokenID.UnmarshalBinary(id) - if err != nil { - return nil, err +func (t *SessionToken) ToV2() *session.SessionToken { + return (*session.SessionToken)(t) +} + +func (t *SessionToken) setBodyField(setter func(*session.SessionTokenBody)) { + token := (*session.SessionToken)(t) + body := token.GetBody() + + if body == nil { + body = new(session.SessionTokenBody) + token.SetBody(body) } - key := make([]byte, len(pub)) - copy(key[:], pub) - - return &SessionToken{ - id: tokenID, - pubKey: key, - }, nil + setter(body) } -func (s SessionToken) SessionKey() []byte { - return s.pubKey +func (t *SessionToken) ID() []byte { + return (*session.SessionToken)(t). + GetBody(). + GetID() } -func (s SessionToken) ID() []byte { - data, err := s.id.MarshalBinary() - if err != nil { - panic(err) // must never panic - } - - return data +func (t *SessionToken) SetID(v []byte) { + t.setBodyField(func(body *session.SessionTokenBody) { + body.SetID(v) + }) +} + +func (t *SessionToken) OwnerID() *owner.ID { + return owner.NewIDFromV2( + (*session.SessionToken)(t). + GetBody(). + GetOwnerID(), + ) +} + +func (t *SessionToken) SetOwnerID(v *owner.ID) { + t.setBodyField(func(body *session.SessionTokenBody) { + body.SetOwnerID(v.ToV2()) + }) +} + +func (t *SessionToken) SessionKey() []byte { + return (*session.SessionToken)(t). + GetBody(). + GetSessionKey() +} + +func (t *SessionToken) SetSessionKey(v []byte) { + t.setBodyField(func(body *session.SessionTokenBody) { + body.SetSessionKey(v) + }) } diff --git a/pkg/token/session_test.go b/pkg/token/session_test.go new file mode 100644 index 0000000..f155bc9 --- /dev/null +++ b/pkg/token/session_test.go @@ -0,0 +1,42 @@ +package token + +import ( + "crypto/rand" + "testing" + + "github.com/nspcc-dev/neofs-api-go/pkg/owner" + "github.com/stretchr/testify/require" +) + +func TestSessionToken_SetID(t *testing.T) { + token := NewSessionToken() + + id := []byte{1, 2, 3} + token.SetID(id) + + require.Equal(t, id, token.ID()) +} + +func TestSessionToken_SetOwnerID(t *testing.T) { + token := NewSessionToken() + + w := new(owner.NEO3Wallet) + _, err := rand.Read(w.Bytes()) + require.NoError(t, err) + + ownerID := owner.NewID() + ownerID.SetNeo3Wallet(w) + + token.SetOwnerID(ownerID) + + require.Equal(t, ownerID, token.OwnerID()) +} + +func TestSessionToken_SetSessionKey(t *testing.T) { + token := NewSessionToken() + + key := []byte{1, 2, 3} + token.SetSessionKey(key) + + require.Equal(t, key, token.SessionKey()) +} From 96de0bd25a5cf5e27dcec6bb5e1fb69a0090d7ec Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Tue, 15 Sep 2020 13:45:20 +0300 Subject: [PATCH 0431/1196] [#143] sdk/token: Define bearer token structure Signed-off-by: Alex Vanin --- pkg/token/bearer.go | 109 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 109 insertions(+) create mode 100644 pkg/token/bearer.go diff --git a/pkg/token/bearer.go b/pkg/token/bearer.go new file mode 100644 index 0000000..13e26cb --- /dev/null +++ b/pkg/token/bearer.go @@ -0,0 +1,109 @@ +package token + +import ( + "crypto/ecdsa" + "errors" + + "github.com/nspcc-dev/neofs-api-go/pkg/acl/eacl" + "github.com/nspcc-dev/neofs-api-go/pkg/owner" + "github.com/nspcc-dev/neofs-api-go/util/signature" + "github.com/nspcc-dev/neofs-api-go/v2/acl" + "github.com/nspcc-dev/neofs-api-go/v2/refs" + v2signature "github.com/nspcc-dev/neofs-api-go/v2/signature" +) + +type BearerToken struct { + token acl.BearerToken +} + +func (b BearerToken) ToV2() *acl.BearerToken { + return &b.token +} + +func (b *BearerToken) SetLifetime(exp, nbf, iat uint64) { + body := b.token.GetBody() + if body == nil { + body = new(acl.BearerTokenBody) + } + + lt := new(acl.TokenLifetime) + lt.SetExp(exp) + lt.SetNbf(nbf) + lt.SetIat(iat) + + body.SetLifetime(lt) + b.token.SetBody(body) +} + +func (b *BearerToken) SetEACLTable(table *eacl.Table) { + body := b.token.GetBody() + if body == nil { + body = new(acl.BearerTokenBody) + } + + body.SetEACL(table.ToV2()) + b.token.SetBody(body) +} + +func (b *BearerToken) SetOwner(id *owner.ID) { + body := b.token.GetBody() + if body == nil { + body = new(acl.BearerTokenBody) + } + + body.SetOwnerID(id.ToV2()) + b.token.SetBody(body) +} + +func (b *BearerToken) SignToken(key *ecdsa.PrivateKey) error { + err := sanityCheck(b) + if err != nil { + return err + } + + signWrapper := v2signature.StableMarshalerWrapper{SM: b.token.GetBody()} + return signature.SignDataWithHandler(key, signWrapper, func(key []byte, sig []byte) { + bearerSignature := new(refs.Signature) + bearerSignature.SetKey(key) + bearerSignature.SetSign(sig) + b.token.SetSignature(bearerSignature) + }) +} + +func NewBearerToken() *BearerToken { + b := new(BearerToken) + b.token = acl.BearerToken{} + b.token.SetBody(new(acl.BearerTokenBody)) + + return b +} + +func NewBearerTokenFromV2(v2 *acl.BearerToken) *BearerToken { + if v2 == nil { + v2 = new(acl.BearerToken) + } + + return &BearerToken{ + token: *v2, + } +} + +// sanityCheck if bearer token is ready to be issued +func sanityCheck(b *BearerToken) error { + switch { + case b == nil: + return errors.New("bearer token is not set") + case b.token.GetBody() == nil: + return errors.New("bearer token body is not set") + case b.token.GetBody().GetLifetime() == nil: + return errors.New("bearer token lifetime is not set") + case b.token.GetBody().GetEACL() == nil: + return errors.New("bearer token EACL table is not set") + case b.token.GetBody().GetOwnerID() == nil: + return errors.New("bearer token owner is not set") + } + + // consider checking EACL sanity there, lifetime correctness, etc. + + return nil +} From 59033d330df47c457fed89b44e65cc71a6cd67c5 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Tue, 15 Sep 2020 13:46:56 +0300 Subject: [PATCH 0432/1196] [#143] sdk/client: Add call option to set bearer token Signed-off-by: Alex Vanin --- pkg/client/opts.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/pkg/client/opts.go b/pkg/client/opts.go index 2407162..ec329f1 100644 --- a/pkg/client/opts.go +++ b/pkg/client/opts.go @@ -30,7 +30,7 @@ type ( ttl uint32 epoch uint64 session *token.SessionToken - // add bearer token + bearer *token.BearerToken } clientOptions struct { @@ -107,6 +107,12 @@ func WithSession(token *token.SessionToken) CallOption { }) } +func WithBearer(token *token.BearerToken) CallOption { + return newFuncCallOption(func(option *callOptions) { + option.bearer = token + }) +} + func v2MetaHeaderFromOpts(options callOptions) *v2session.RequestMetaHeader { meta := new(v2session.RequestMetaHeader) meta.SetVersion(options.version.ToV2()) @@ -120,6 +126,10 @@ func v2MetaHeaderFromOpts(options callOptions) *v2session.RequestMetaHeader { meta.SetXHeaders(xhdrs) + if options.bearer != nil { + meta.SetBearerToken(options.bearer.ToV2()) + } + return meta } From 1a9b163561d89a45845bc2ca9b1cd4f1a5e8700c Mon Sep 17 00:00:00 2001 From: Stanislav Bogatyrev Date: Fri, 18 Sep 2020 11:25:11 +0300 Subject: [PATCH 0433/1196] Simplify Makefile Signed-off-by: Stanislav Bogatyrev --- .gitattributes | 3 +- .gitignore | 1 + Makefile | 79 ++++++++++++++++++++++---------------------------- 3 files changed, 37 insertions(+), 46 deletions(-) diff --git a/.gitattributes b/.gitattributes index b002a5d..c7a3f7a 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1 +1,2 @@ -/**/*.pb.go -diff binary +/**/*.pb.go -diff -merge +/**/*.pb.go linguist-generated=true diff --git a/.gitignore b/.gitignore index 22e0c65..354a562 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +.idea bin temp /vendor/ diff --git a/Makefile b/Makefile index f4a54c4..cd9e535 100644 --- a/Makefile +++ b/Makefile @@ -1,61 +1,50 @@ -PROTO_VERSION=v1.2.0 -PROTO_URL=https://github.com/nspcc-dev/neofs-api/archive/$(PROTO_VERSION).tar.gz +#!/usr/bin/make -f +SHELL = bash -B=\033[0;1m -G=\033[0;92m -R=\033[0m +.PHONY: dep fmts fmt imports protoc -.PHONY: deps format docgen protoc +# Pull go dependencies +dep: + @printf "⇒ Tidy requirements : " + CGO_ENABLED=0 \ + GO111MODULE=on \ + go mod tidy -v && echo OK + @printf "⇒ Download requirements: " + CGO_ENABLED=0 \ + GO111MODULE=on \ + go mod download && echo OK + @printf "⇒ Install test requirements: " + CGO_ENABLED=0 \ + GO111MODULE=on \ + go test -i ./... && echo OK -# Dependencies -deps: - @echo "${B}${G}⇒ Golang modules ${R}" - @go mod tidy -v - @go mod vendor - - @echo "${B}${G}⇒ Cleanup old files ${R}" - @find . -type f -name '*.proto' -not -path './vendor/*' -not -name '*_test.proto' -exec rm {} \; - - @echo "${B}${G}⇒ NeoFS Proto files ${R}" - @mkdir -p ./vendor/proto - @curl -sL -o ./vendor/proto.tar.gz $(PROTO_URL) - @tar -xzf ./vendor/proto.tar.gz --strip-components 1 -C ./vendor/proto - @for f in `find ./vendor/proto -type f -name '*.proto' -exec dirname {} \; | sort -u `; do \ - cp $$f/*.proto ./$$(basename $$f); \ - done - - @echo "${B}${G}⇒ Cleanup ${R}" - @rm -rf ./vendor/proto - @rm -rf ./vendor/proto.tar.gz +# Run all code formaters +fmts: fmt imports # Reformat code -format: - @[ ! -z `which goimports` ] || (echo "install goimports" && exit 2) +fmt: + @echo "⇒ Processing gofmt check" @for f in `find . -type f -name '*.go' -not -path './vendor/*' -not -name '*.pb.go' -prune`; do \ - echo "${B}${G}⇒ Processing $$f ${R}"; \ - goimports -w $$f; \ + GO111MODULE=on gofmt -s -w $$f; \ done -# Regenerate documentation for protot files: -docgen: deps - @for f in `find . -type f -name '*.proto' -not -path './vendor/*' -exec dirname {} \; | sort -u `; do \ - echo "${B}${G}⇒ Documentation for $$(basename $$f) ${R}"; \ - protoc \ - --doc_opt=.github/markdown.tmpl,$${f}.md \ - --proto_path=.:./vendor:/usr/local/include \ - --doc_out=docs/ $${f}/*.proto; \ +# Reformat imports +imports: + @echo "⇒ Processing goimports check" + @for f in `find . -type f -name '*.go' -not -path './vendor/*' -not -name '*.pb.go' -prune`; do \ + GO111MODULE=on goimports -w $$f; \ done # Regenerate proto files: protoc: - @echo "${B}${G}⇒ Cleanup old files ${R}" - @find . -type f -name '*.pb.go' -not -path './vendor/*' -exec rm {} \; - @echo "${B}${G}⇒ Protoc generate ${R}" + @GOPRIVATE=github.com/nspcc-dev go mod vendor + # Install specific version for protobuf lib + @go list -f '{{.Path}}/...@{{.Version}}' -m github.com/golang/protobuf | xargs go get -v + # Protoc generate @for f in `find . -type f -name '*.proto' -not -path './vendor/*'`; do \ - echo "${B}${G}⇒ Processing $$f ${R}"; \ + echo "⇒ Processing $$f "; \ protoc \ - --proto_path=.:./vendor:/usr/local/include \ + --proto_path=.:./vendor:./vendor/github.com/nspcc-dev/neofs-api:/usr/local/include \ --gofast_out=plugins=grpc,paths=source_relative:. $$f; \ done - -update: docgen protoc + rm -rf vendor From e97f7096c6c443d761fdbf9ae833ecbe53edf82c Mon Sep 17 00:00:00 2001 From: Stanislav Bogatyrev Date: Fri, 18 Sep 2020 11:25:43 +0300 Subject: [PATCH 0434/1196] Add credits and contribution guide Signed-off-by: Stanislav Bogatyrev --- CONTRIBUTING.md | 152 ++++++++++++++++++++++++++++++++++++++++++++++++ CREDITS.md | 27 +++++++++ 2 files changed, 179 insertions(+) create mode 100644 CONTRIBUTING.md create mode 100644 CREDITS.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..9e40175 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,152 @@ +# Contribution guide + +First, thank you for contributing! We love and encourage pull requests from +everyone. Please follow the guidelines: + +- Check the open [issues](https://github.com/nspcc-dev/neofs-api-go/issues) and + [pull requests](https://github.com/nspcc-dev/neofs-api-go/pulls) for existing + discussions. + +- Open an issue first, to discuss a new feature or enhancement. + +- Open a pull request, and reference the relevant issue(s). + +- Make sure your commits are logically separated and have good comments + explaining the details of your change. + +- After receiving feedback, amend your commits or add new ones as + appropriate. + +- **Have fun!** + +## Development Workflow + +Start by forking the `neofs-api-go` repository, make changes in a branch and then +send a pull request. We encourage pull requests to discuss code changes. Here +are the steps in details: + +### Setup your GitHub Repository +Fork [NeoFS node upstream](https://github.com/nspcc-dev/neofs-api-go/fork) source +repository to your own personal repository. Copy the URL of your fork (you will +need it for the `git clone` command below). + +```sh +$ git clone https://github.com/nspcc-dev/neofs-api-go +``` + +### Set up git remote as ``upstream`` +```sh +$ cd neofs-api-go +$ git remote add upstream https://github.com/nspcc-dev/neofs-api-go +$ git fetch upstream +$ git merge upstream/master +... +``` + +### Create your feature branch +Before making code changes, make sure you create a separate branch for these +changes. Maybe you will find it convenient to name branch in +`/-` format. + +``` +$ git checkout -b feature/123-something_awesome +``` + +### Test your changes +After your code changes, make sure + +- To add test cases for the new code. +- To run `make lint` +- To squash your commits into a single commit or a series of logically separated + commits run `git rebase -i`. It's okay to force update your pull request. + +### Commit changes +After verification, commit your changes. This is a [great +post](https://chris.beams.io/posts/git-commit/) on how to write useful commit +messages. Try following this template: + +``` +[#Issue] Summary + +Description + + + + +``` + +``` +$ git commit -am '[#123] Add some feature' +``` + +### Push to the branch +Push your locally committed changes to the remote origin (your fork) +``` +$ git push origin feature/123-something_awesome +``` + +### Create a Pull Request +Pull requests can be created via GitHub. Refer to [this +document](https://help.github.com/articles/creating-a-pull-request/) for +detailed steps on how to create a pull request. After a Pull Request gets peer +reviewed and approved, it will be merged. + +## DCO Sign off + +All authors to the project retain copyright to their work. However, to ensure +that they are only submitting work that they have rights to, we are requiring +everyone to acknowledge this by signing their work. + +Any copyright notices in this repository should specify the authors as "the +contributors". + +To sign your work, just add a line like this at the end of your commit message: + +``` +Signed-off-by: Samii Sakisaka +``` + +This can easily be done with the `--signoff` option to `git commit`. + +By doing this you state that you can certify the following (from [The Developer +Certificate of Origin](https://developercertificate.org/): + +``` +Developer Certificate of Origin +Version 1.1 + +Copyright (C) 2004, 2006 The Linux Foundation and its contributors. +1 Letterman Drive +Suite D4700 +San Francisco, CA, 94129 + +Everyone is permitted to copy and distribute verbatim copies of this +license document, but changing it is not allowed. + + +Developer's Certificate of Origin 1.1 + +By making a contribution to this project, I certify that: + +(a) The contribution was created in whole or in part by me and I + have the right to submit it under the open source license + indicated in the file; or + +(b) The contribution is based upon previous work that, to the best + of my knowledge, is covered under an appropriate open source + license and I have the right under that license to submit that + work with modifications, whether created in whole or in part + by me, under the same open source license (unless I am + permitted to submit under a different license), as indicated + in the file; or + +(c) The contribution was provided directly to me by some other + person who certified (a), (b) or (c) and I have not modified + it. + +(d) I understand and agree that this project and the contribution + are public and that a record of the contribution (including all + personal information I submit with it, including my sign-off) is + maintained indefinitely and may be redistributed consistent with + this project or the open source license(s) involved. +``` diff --git a/CREDITS.md b/CREDITS.md new file mode 100644 index 0000000..6d45ff2 --- /dev/null +++ b/CREDITS.md @@ -0,0 +1,27 @@ +# Credits + +Initial NeoFS research and development (2018-2020) was done by +[NeoSPCC](https://nspcc.ru) team. + +In alphabetical order: + +- Alexey Vanin +- Anastasia Prasolova +- Anatoly Bogatyrev +- Evgeny Kulikov +- Evgeny Stratonikov +- Leonard Liubich +- Sergei Liubich +- Stanislav Bogatyrev + +# Contributors + +In chronological order: +- Pavel Korotkov + +# Special Thanks + +For product development support: + +- Fabian Wahle +- Neo Global Development From 6b319b410b86470b39e4a8ebab6805970801b3d7 Mon Sep 17 00:00:00 2001 From: Stanislav Bogatyrev Date: Sun, 20 Sep 2020 22:29:00 +0300 Subject: [PATCH 0435/1196] docs: Update README Signed-off-by: Stanislav Bogatyrev --- .github/logo.svg | 129 ++++++++++++++++++++++++++++++++++++ .github/markdown.tmpl | 83 ----------------------- README.md | 151 +++++------------------------------------- 3 files changed, 145 insertions(+), 218 deletions(-) create mode 100644 .github/logo.svg delete mode 100644 .github/markdown.tmpl diff --git a/.github/logo.svg b/.github/logo.svg new file mode 100644 index 0000000..b4da076 --- /dev/null +++ b/.github/logo.svg @@ -0,0 +1,129 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.github/markdown.tmpl b/.github/markdown.tmpl deleted file mode 100644 index f945c13..0000000 --- a/.github/markdown.tmpl +++ /dev/null @@ -1,83 +0,0 @@ -# Protocol Documentation - - -## Table of Contents -{{range .Files}} -{{$file_name := .Name}}- [{{.Name}}](#{{.Name}}) -{{if .Services}} - Services - {{range .Services}}- [{{.Name}}](#{{.FullName}}) - {{end}}{{end}} -{{if .Messages}} - Messages - {{range .Messages}}- [{{.LongName}}](#{{.FullName}}) - {{end}}{{end}} -{{end}} -- [Scalar Value Types](#scalar-value-types) - -{{range .Files}} -{{$file_name := .Name}} - -

Top

- -## {{.Name}} -{{.Description}} - -{{range .Services}} - - - -### Service "{{.FullName}}" -{{.Description}} - -``` -{{range .Methods -}} - rpc {{.Name}}({{if .RequestStreaming}}stream {{end}}{{.RequestLongType}}) returns ({{if .ResponseStreaming}}stream {{end}}{{.ResponseLongType}}); -{{end}} -``` - -{{range .Methods -}} -#### Method {{.Name}} - -{{.Description}} - -| Name | Input | Output | -| ---- | ----- | ------ | -| {{.Name}} | [{{.RequestLongType}}](#{{.RequestFullType}}) | [{{.ResponseLongType}}](#{{.ResponseFullType}}) | -{{end}}{{end}} - -{{range .Messages}} - - -### Message {{.LongName}} -{{.Description}} - -{{if .HasFields}} -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -{{range .Fields -}} - | {{.Name}} | [{{.LongType}}](#{{.FullType}}) | {{.Label}} | {{nobr .Description}}{{if .DefaultValue}} Default: {{.DefaultValue}}{{end}} | -{{end}}{{end}} -{{end}} - -{{range .Enums}} - - -### {{.LongName}} -{{.Description}} - -| Name | Number | Description | -| ---- | ------ | ----------- | -{{range .Values -}} - | {{.Name}} | {{.Number}} | {{nobr .Description}} | -{{end}} - -{{end}} - -{{end}} - -## Scalar Value Types - -| .proto Type | Notes | C++ Type | Java Type | Python Type | -| ----------- | ----- | -------- | --------- | ----------- | -{{range .Scalars -}} - | {{.ProtoType}} | {{.Notes}} | {{.CppType}} | {{.JavaType}} | {{.PythonType}} | -{{end}} diff --git a/README.md b/README.md index 31c87f6..ca3684b 100644 --- a/README.md +++ b/README.md @@ -1,150 +1,31 @@ -# NeoFS API +

+NeoFS +

+

+ Golang SDK for NeoFS +

+--- ![Go](https://github.com/nspcc-dev/neofs-api-go/workflows/Go/badge.svg) [![codecov](https://codecov.io/gh/nspcc-dev/neofs-api-go/branch/master/graph/badge.svg)](https://codecov.io/gh/nspcc-dev/neofs-api-go) [![Report](https://goreportcard.com/badge/github.com/nspcc-dev/neofs-api-go)](https://goreportcard.com/report/github.com/nspcc-dev/neofs-api-go) [![GitHub release](https://img.shields.io/github/release/nspcc-dev/neofs-api.svg)](https://github.com/nspcc-dev/neofs-api-go) ![GitHub license](https://img.shields.io/github/license/nspcc-dev/neofs-api.svg?style=popout) ---- +# Overview -NeoFS API repository contains implementation of core NeoFS structures that -can be used for integration with NeoFS. - -## Сompatibility - -[neofs-api v1.1.0]: https://github.com/nspcc-dev/neofs-api/releases/tag/v1.1.0 -[neofs-api-go v1.1.0]: https://github.com/nspcc-dev/neofs-api-go/releases/tag/v1.1.0 -* [neofs-api-go v1.1.0] supports [neofs-api v1.1.0] - -[neofs-api v1.2.0]: https://github.com/nspcc-dev/neofs-api/releases/tag/v1.2.0 -[neofs-api-go v1.2.0]: https://github.com/nspcc-dev/neofs-api-go/releases/tag/v1.2.0 -* [neofs-api-go v1.2.0] supports [neofs-api v1.2.0] - -[neofs-api-go v1.3.0]: https://github.com/nspcc-dev/neofs-api-go/releases/tag/v1.3.0 -* [neofs-api-go v1.3.0] supports [neofs-api v1.2.0] - -## Description - -Repository contains 13 packages that implement NeoFS core structures. These -packages mostly contain protobuf files with service and structure definitions -or NeoFS core types with complemented functions. - -There is a auto-generated documentation for protobuf files in [docs](docs). - -### Accounting - -Accounting package defines services and structures for accounting operations: -balance request and `cheque` operations for withdraw. `Cheque` is a structure -with inner ring signatures, which approve that user can withdraw requested -amount of assets. NeoFS smart contract takes binary formatted `cheque` as a -parameter in withdraw call. - -#### API -Accounting package defines: -- [Accounting service](docs/accounting.md#accounting.Accounting) -- [Withdraw service](docs/accounting.md#accounting.Withdraw) - - -### Bootstrap - -Bootstrap package defines bootstrap service which is used by storage nodes to -connect to the storage network. - -#### API -Bootstrap package defines: -- [Bootstrap service](docs/bootstrap.md#bootstrap.Bootstrap) - - -### Chain - -Chain package contains util functions for operations with NEO Blockchain types: -wallet addresses, script-hashes. - -### Container - -Container package defines service and structures for operations with containers. -Objects in NeoFS are stored in containers. Container defines storage -policy for the objects. - -#### API -Bootstrap package defines: -- [Container service](docs/container.md#container.Service) - -### Decimal - -Decimal defines custom decimal implementation which is used in accounting -operations. - -### Hash - -Hash package defines homomorphic hash type. - -### Internal - -Internal package defines constant error type and proto interface for custom -protobuf structures. - -### Object - -Object package defines service and structures for object operations. Object is -a core storage structure in NeoFS. Package contains detailed information -about object internal structure. - -#### API -Object package defines: -- [Object service](docs/object.md#object.Service) - -### Query - -Query package defines structure for object search requests. - -### Refs - -Refs package defines core identity types: Object ID, Container ID, etc. - -### Service - -Service package defines util structure and functions for all NeoFS services -operations: TTL and request signature management, node roles, epoch retriever. - -### Session - -Session package defines service and structures for session obtain. Object -operations require an established session with pair of session keys signed by -owner of the object. - -#### API -Session package defines: -- [Session service](docs/session.md#session.Session) - -### State - -State package defines service and structures for metrics gathering. - -#### API -State package defines: -- [Status service](docs/state.md#state.Status) - -## How to use - -NeoFS API packages contain godoc documentation. Examples of using most of -these packages can be found in NeoFS-CLI repository. CLI implements and -demonstrates all basic interactions with NeoFS: container, object, storage -group, and accounting operations. - -Protobuf files are recompiled with the command: - -``` -$ make protoc -``` +Go implementation of recent [NeoFS API](https://github.com/nspcc-dev/neofs-api) +versions and SDK layer working with all of them in a handy way. ## Contributing -At this moment, we do not accept contributions. +Feel free to contribute to this project after reading the [contributing +guidelines](CONTRIBUTING.md). + +Before starting to work on a certain topic, create an new issue first, +describing the feature/topic you are going to implement. ## License -This project is licensed under the Apache 2.0 License - +This project is licensed under the Apache 2.0 License - see the [LICENSE](LICENSE) file for details - From 78079bea045ae8853c27800b03081024a957c6c2 Mon Sep 17 00:00:00 2001 From: Stanislav Bogatyrev Date: Mon, 21 Sep 2020 16:12:03 +0300 Subject: [PATCH 0436/1196] docs: Added 2.0.0 Changelog Signed-off-by: Stanislav Bogatyrev --- CHANGELOG.md | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2cafb35..934ded0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog -This is the changelog for NeoFS-API-Go + +## [2.0.0] - 2020-XX-XX - Jindo (진도, 珍島) + +Major API refactoring and simplification. + +### Removed +- v0 and v1 NeoFS API is not supported anymore ## [1.3.0] - 2020-07-23 @@ -174,7 +180,7 @@ This is the changelog for NeoFS-API-Go ## [0.4.0] - 2020-02-18 -### Added +### Added - Meta header for all gRPC responses. It contains epoch stamp and version number. ### Changed - Endianness in accounting cheque. Now it uses little endian for cheaper @@ -182,7 +188,7 @@ decoding in neofs smart-contract. ## [0.3.2] - 2020-02-10 -### Added +### Added - gRPC method DumpVars to State service - add method `EncodeVariables` to encode debug variables to JSON (slice of bytes) - increase test coverage for state package @@ -265,7 +271,7 @@ decoding in neofs smart-contract. ### Changed - Routine to verify correct object checks if integrity header is last and may use public key header if verification header is not present -- Routine to verify correct session token checks if keys in the token +- Routine to verify correct session token checks if keys in the token associated with owner id - Updated neofs-crypto to v0.2.3 @@ -308,9 +314,9 @@ associated with owner id ## [0.2.3] - 2019-11-28 ### Removed -- service: SignRequest / VerifyRequest and accompanying code +- service: SignRequest / VerifyRequest and accompanying code - proto: Signature field from requests -- object: bytefmt package not used anymore +- object: bytefmt package not used anymore ### Changed - service: rename EpochRequest to EpochHeader and merge with MetaHeader @@ -324,19 +330,19 @@ associated with owner id ## [0.2.2] - 2019-11-22 ### Changed -- ProcessRequestTTL don't changes status errors from TTLCondition +- ProcessRequestTTL don't changes status errors from TTLCondition ## [0.2.1] - 2019-11-22 ### Changed - Removed SendPutRequest -- MakePutRequestHeader sets only object and token +- MakePutRequestHeader sets only object and token ## [0.2.0] - 2019-11-21 ### Added -- Container not found error -- GitHub Actions as CI and Codecov +- Container not found error +- GitHub Actions as CI and Codecov - Auto-generated proto documentation - RequestMetaHeader to all RPC requests - RequestVerificationHeader to all RPC requests @@ -344,7 +350,7 @@ associated with owner id ### Changed - Moved TTL and Epoch fields to RequestMetaHeader - Renamed Version in object.SearchRequest to QueryVersion -- Removed SetTTL, GetTTL, SetEpoch, GetEpoch from all RPC requests +- Removed SetTTL, GetTTL, SetEpoch, GetEpoch from all RPC requests ## 0.1.0 - 2019-11-18 From 8e0ddc5579ee7ba5ac54532d3a50118dad299e3f Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Mon, 21 Sep 2020 17:15:17 +0300 Subject: [PATCH 0437/1196] Update CI pipeline Do not use strict golint while neofs-api-go is under development after v2.0.0 api release. Use golang-ci for new issues as alternative. With v2.0.0 support we support go v1.14+, therefore it closes #35 --- .github/workflows/go.yml | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index e74d31a..fc6aa8c 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -3,13 +3,11 @@ on: push: branches: - master - - develop paths-ignore: - '*.md' pull_request: branches: - master - - develop paths-ignore: - '*.md' jobs: @@ -19,7 +17,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - go: [ '1.12.x', '1.13.x', '1.14.x'] + go: [ '1.14.x', '1.15.x' ] steps: - name: Setup go @@ -47,13 +45,9 @@ jobs: ${{ runner.os }}-go- - name: Get dependencies - run: | - go get -u -v golang.org/x/lint/golint + run: | go mod tidy -v - - name: Linter - run: golint -set_exit_status ./... - - name: Tests run: go test -coverprofile=coverage.txt -covermode=atomic ./... @@ -61,3 +55,16 @@ jobs: env: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} run: bash <(curl -s https://codecov.io/bash) + + golangci: + name: lint + runs-on: ubuntu-latest + steps: + + - uses: actions/checkout@v2 + + - name: golangci-lint + uses: golangci/golangci-lint-action@v2 + with: + version: v1.29 + only-new-issues: true From f21cecfc4359acb7499862410ea450420d64fcfb Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Mon, 21 Sep 2020 17:21:48 +0300 Subject: [PATCH 0438/1196] sdk/v2: Fix typo found by golangci-lint Signed-off-by: Alex Vanin --- v2/netmap/types.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/v2/netmap/types.go b/v2/netmap/types.go index b91d6e5..c810aa3 100644 --- a/v2/netmap/types.go +++ b/v2/netmap/types.go @@ -252,9 +252,8 @@ func (p *PlacementPolicy) GetFilters() []*Filter { func (p *PlacementPolicy) SetFilters(filters []*Filter) { if p != nil { - + p.filters = filters } - p.filters = filters } func (p *PlacementPolicy) GetSelectors() []*Selector { From 81975017b2eeba981d66dad58cb02ff0cfe9d1ac Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Mon, 21 Sep 2020 17:22:35 +0300 Subject: [PATCH 0439/1196] sdk/v2: Remove unused marshallers All default marshallers defined on unified structure in `v2` package Signed-off-by: Alex Vanin --- v2/refs/grpc/marshal.go | 49 ------------------------------------ v2/refs/grpc/marshal_test.go | 45 --------------------------------- 2 files changed, 94 deletions(-) delete mode 100644 v2/refs/grpc/marshal.go delete mode 100644 v2/refs/grpc/marshal_test.go diff --git a/v2/refs/grpc/marshal.go b/v2/refs/grpc/marshal.go deleted file mode 100644 index 3503a44..0000000 --- a/v2/refs/grpc/marshal.go +++ /dev/null @@ -1,49 +0,0 @@ -package refs - -import ( - "encoding/binary" - "math/bits" -) - -func (m *OwnerID) StableMarshal(buf []byte) ([]byte, error) { - if m == nil { - return []byte{}, nil - } - - if buf == nil { - buf = make([]byte, m.StableSize()) - } - - var ( - i, n, offset int - ) - - // Write key field. - - buf[i] = 0x0A // id:0x1 << 3 | wiretype:0x2 - offset = binary.PutUvarint(buf[i+1:], uint64(len(m.Value))) - n = copy(buf[i+1+offset:], m.Value) - i += 1 + offset + n - - return buf, nil -} - -func (m *OwnerID) StableSize() int { - if m == nil { - return 0 - } - - var ( - ln, size int - ) - - ln = len(m.Value) // size of key field - size += 1 + uvarIntSize(uint64(ln)) + ln // wiretype + size of string + string - - return size -} - -// uvarIntSize returns length of varint byte sequence for uint64 value 'x'. -func uvarIntSize(x uint64) int { - return (bits.Len64(x|1) + 6) / 7 -} diff --git a/v2/refs/grpc/marshal_test.go b/v2/refs/grpc/marshal_test.go deleted file mode 100644 index 8f822fb..0000000 --- a/v2/refs/grpc/marshal_test.go +++ /dev/null @@ -1,45 +0,0 @@ -package refs - -import ( - "crypto/rand" - "testing" - - "github.com/stretchr/testify/require" -) - -func TestOwnerID_StableMarshal(t *testing.T) { - owner := make([]byte, 25) - _, err := rand.Read(owner) - require.NoError(t, err) - - expectedOwner := new(OwnerID) - expectedOwner.Value = owner - - gotOwner := new(OwnerID) - - t.Run("small buffer", func(t *testing.T) { - require.Panics(t, func() { - expectedOwner.StableMarshal(make([]byte, 1)) - }) - }) - - t.Run("empty owner", func(t *testing.T) { - data, err := new(OwnerID).StableMarshal(nil) - require.NoError(t, err) - - err = gotOwner.Unmarshal(data) - require.NoError(t, err) - - require.Len(t, gotOwner.Value, 0) - }) - - t.Run("non empty owner", func(t *testing.T) { - data, err := expectedOwner.StableMarshal(nil) - require.NoError(t, err) - - err = gotOwner.Unmarshal(data) - require.NoError(t, err) - - require.Equal(t, expectedOwner, gotOwner) - }) -} From c43f7d816d009a42b6061891ad93bfcfd63c254a Mon Sep 17 00:00:00 2001 From: Stanislav Bogatyrev Date: Mon, 21 Sep 2020 21:17:49 +0300 Subject: [PATCH 0440/1196] cicd: Update GH Actions setup - Update GH Actions workflow for go test - Add golangci linter config from neofs-node - Add DCO check for PR commits Signed-off-by: Stanislav Bogatyrev --- .github/workflows/dco.yml | 21 ++++++ .github/workflows/go.yml | 69 ++++++++----------- .golangci.yml | 136 ++++++++++++++++++++++++++++++++++++++ Makefile | 29 +++++++- 4 files changed, 213 insertions(+), 42 deletions(-) create mode 100644 .github/workflows/dco.yml create mode 100644 .golangci.yml diff --git a/.github/workflows/dco.yml b/.github/workflows/dco.yml new file mode 100644 index 0000000..40ed8fc --- /dev/null +++ b/.github/workflows/dco.yml @@ -0,0 +1,21 @@ +name: DCO check + +on: + pull_request: + branches: + - master + +jobs: + commits_check_job: + runs-on: ubuntu-latest + name: Commits Check + steps: + - name: Get PR Commits + id: 'get-pr-commits' + uses: tim-actions/get-pr-commits@master + with: + token: ${{ secrets.GITHUB_TOKEN }} + - name: DCO Check + uses: tim-actions/dco@master + with: + commits: ${{ steps.get-pr-commits.outputs.commits }} diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index fc6aa8c..ab7b4a0 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -1,4 +1,5 @@ -name: Go +name: neofs-api-go tests + on: push: branches: @@ -10,58 +11,46 @@ on: - master paths-ignore: - '*.md' -jobs: +jobs: test: - name: test - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 strategy: matrix: go: [ '1.14.x', '1.15.x' ] steps: + - name: Setup go + uses: actions/setup-go@v2 + with: + go-version: ${{ matrix.go }} - - name: Setup go - uses: actions/setup-go@v1 - with: - go-version: ${{ matrix.go }} - id: go + - name: Check out code + uses: actions/checkout@v2 - - name: Check out code into the Go module directory - uses: actions/checkout@v2 + - name: Cache go mod + uses: actions/cache@v2 + with: + path: ~/go/pkg/mod + key: ${{ runner.os }}-go-${{ matrix.go }}-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go-${{ matrix.go }}- - - name: Set GOPATH - # temporary fix - # see https://github.com/actions/setup-go/issues/14 - run: | - echo "##[set-env name=GOPATH;]$(dirname $GITHUB_WORKSPACE)" - echo "##[add-path]$(dirname $GITHUB_WORKSPACE)/bin" - shell: bash + - name: Get dependencies + run: make dep - - uses: actions/cache@v1 - with: - path: ~/go/pkg/mod - key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-go- + - name: Run go test + run: go test -coverprofile=coverage.txt -covermode=atomic ./... - - name: Get dependencies - run: | - go mod tidy -v + - name: Codecov + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + run: bash <(curl -s https://codecov.io/bash) - - name: Tests - run: go test -coverprofile=coverage.txt -covermode=atomic ./... - - - name: Codecov - env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - run: bash <(curl -s https://codecov.io/bash) - - golangci: - name: lint - runs-on: ubuntu-latest + lint: + runs-on: ubuntu-20.04 steps: - - - uses: actions/checkout@v2 + - name: Check out code + uses: actions/checkout@v2 - name: golangci-lint uses: golangci/golangci-lint-action@v2 diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 0000000..7fc9abf --- /dev/null +++ b/.golangci.yml @@ -0,0 +1,136 @@ +# https://habr.com/company/roistat/blog/413175/ +# https://github.com/golangci/golangci-lint +linters-settings: + govet: + check-shadowing: false + golint: + # minimal confidence for issues, default is 0.8 + min-confidence: 0.8 + gofmt: + # simplify code: gofmt with `-s` option, true by default + simplify: true + gocyclo: + min-complexity: 30 + maligned: + suggest-new: true + dupl: + threshold: 100 + goconst: + min-len: 2 + min-occurrences: 2 + gosimple: + gocritic: + # Which checks should be enabled; can't be combined with 'disabled-checks'; + # See https://go-critic.github.io/overview#checks-overview + # To check which checks are enabled run `GL_DEBUG=gocritic golangci-lint run` + # By default list of stable checks is used. +# enabled-checks: +# - rangeValCopy + # Which checks should be disabled; can't be combined with 'enabled-checks'; default is empty + disabled-checks: + - regexpMust + # Enable multiple checks by tags, run `GL_DEBUG=gocritic golangci-lint` run to see all tags and checks. + # Empty list by default. See https://github.com/go-critic/go-critic#usage -> section "Tags". + enabled-tags: + - performance + + settings: # settings passed to gocritic + captLocal: # must be valid enabled check name + paramsOnly: true + rangeValCopy: + sizeThreshold: 32 +# depguard: +# list-type: blacklist +# include-go-root: false +# packages: +# - github.com/davecgh/go-spew/spew + lll: + # max line length, lines longer will be reported. Default is 120. + # '\t' is counted as 1 character by default, and can be changed with the tab-width option + line-length: 120 + # tab width in spaces. Default to 1. + tab-width: 1 + unused: + # treat code as a program (not a library) and report unused exported identifiers; default is false. + # XXX: if you enable this setting, unused will report a lot of false-positives in text editors: + # if it's called for subdir of a project it can't find funcs usages. All text editor integrations + # with golangci-lint call it on a directory with the changed file. + check-exported: false + unparam: + # Inspect exported functions, default is false. Set to true if no external program/library imports your code. + # XXX: if you enable this setting, unparam will report a lot of false-positives in text editors: + # if it's called for subdir of a project it can't find external interfaces. All text editor integrations + # with golangci-lint call it on a directory with the changed file. + check-exported: false + nakedret: + # make an issue if func has more lines of code than this setting and it has naked returns; default is 30 + max-func-lines: 30 + + +linters: + enable-all: true + fast: false + disable: + - gochecknoglobals +# - maligned +# - prealloc +# disable-all: false +# presets: +# - bugs +# - unused + +# options for analysis running +run: + # default concurrency is a available CPU number +# concurrency: 8 + + # timeout for analysis, e.g. 30s, 5m, default is 1m +# deadline: 1m + + # exit code when at least one issue was found, default is 1 +# issues-exit-code: 1 + + # include test files or not, default is true +# tests: true + + # list of build tags, all linters use it. Default is empty list. +# build-tags: +# - mytag + + # which dirs to skip: they won't be analyzed; + # can use regexp here: generated.*, regexp is applied on full path; + # default value is empty list, but next dirs are always skipped independently + # from this option's value: + # vendor$, third_party$, testdata$, examples$, Godeps$, builtin$ +# skip-dirs: +# - src/external_libs +# - autogenerated_by_my_lib + + # which files to skip: they will be analyzed, but issues from them + # won't be reported. Default value is empty list, but there is + # no need to include all autogenerated files, we confidently recognize + # autogenerated files. If it's not please let us know. +# skip-files: +# - ".*\\.my\\.go$" +# - lib/bad.go + + # by default isn't set. If set we pass it to "go list -mod={option}". From "go help modules": + # If invoked with -mod=readonly, the go command is disallowed from the implicit + # automatic updating of go.mod described above. Instead, it fails when any changes + # to go.mod are needed. This setting is most useful to check that go.mod does + # not need updates, such as in a continuous integration and testing system. + # If invoked with -mod=vendor, the go command assumes that the vendor + # directory holds the correct copies of dependencies and ignores + # the dependency descriptions in go.mod. +# modules-download-mode: readonly|release|vendor + +# output configuration options +output: + # colored-line-number|line-number|json|tab|checkstyle|code-climate, default is "colored-line-number" + format: tab + + # print lines of code with issue, default is true + print-issued-lines: true + + # print linter name in the end of issue text, default is true + print-linter-name: true \ No newline at end of file diff --git a/Makefile b/Makefile index cd9e535..3f3f1dd 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,9 @@ #!/usr/bin/make -f SHELL = bash -.PHONY: dep fmts fmt imports protoc +VERSION ?= $(shell git describe --tags --dirty --always) + +.PHONY: dep fmts fmt imports protoc test lint version help # Pull go dependencies dep: @@ -35,7 +37,7 @@ imports: GO111MODULE=on goimports -w $$f; \ done -# Regenerate proto files: +# Regenerate code for proto files protoc: @GOPRIVATE=github.com/nspcc-dev go mod vendor # Install specific version for protobuf lib @@ -48,3 +50,26 @@ protoc: --gofast_out=plugins=grpc,paths=source_relative:. $$f; \ done rm -rf vendor + +# Run Unit Test with go test +test: + @echo "⇒ Runnning go test" + @GO111MODULE=on go test ./... + +# Run linters +lint: + @golangci-lint run + +# Print version +version: + @echo $(VERSION) + +# Show this help prompt +help: + @echo ' Usage:' + @echo '' + @echo ' make ' + @echo '' + @echo ' Targets:' + @echo '' + @awk '/^#/{ comment = substr($$0,3) } comment && /^[a-zA-Z][a-zA-Z0-9_-]+ ?:/{ print " ", $$1, comment }' $(MAKEFILE_LIST) | column -t -s ':' | grep -v 'IGNORE' | sort -u From 3347e53cdeebc5a05af3ec6264ac9639e3af87bf Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Mon, 21 Sep 2020 15:56:21 +0300 Subject: [PATCH 0441/1196] [#151] sdk/netmap: Add public key getter for node Signed-off-by: Alex Vanin --- pkg/netmap/node_info.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/netmap/node_info.go b/pkg/netmap/node_info.go index 03a04b3..981a930 100644 --- a/pkg/netmap/node_info.go +++ b/pkg/netmap/node_info.go @@ -44,6 +44,11 @@ func (n Node) NetworkAddress() string { return n.InfoV2.GetAddress() } +// PublicKey returns public key of the node in bytes. +func (n Node) PublicKey() []byte { + return n.InfoV2.GetPublicKey() +} + // NodesFromV2 converts slice of v2 netmap.NodeInfo to a generic node slice. func NodesFromV2(infos []netmap.NodeInfo) Nodes { nodes := make(Nodes, len(infos)) From c66b23995c0c4d9285254b08c44d113fc1a0862b Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 22 Sep 2020 13:53:10 +0300 Subject: [PATCH 0442/1196] [#155] sdk/object: Add session token getter/setter Signed-off-by: Leonard Lyubich --- pkg/object/raw.go | 7 +++++++ pkg/object/raw_test.go | 12 ++++++++++++ pkg/object/rw.go | 19 +++++++++++++++++-- 3 files changed, 36 insertions(+), 2 deletions(-) diff --git a/pkg/object/raw.go b/pkg/object/raw.go index 0878f48..b4d4063 100644 --- a/pkg/object/raw.go +++ b/pkg/object/raw.go @@ -4,6 +4,7 @@ import ( "github.com/nspcc-dev/neofs-api-go/pkg" "github.com/nspcc-dev/neofs-api-go/pkg/container" "github.com/nspcc-dev/neofs-api-go/pkg/owner" + "github.com/nspcc-dev/neofs-api-go/pkg/token" "github.com/nspcc-dev/neofs-api-go/v2/object" ) @@ -108,3 +109,9 @@ func (o *RawObject) SetChildren(v ...*ID) { func (o *RawObject) SetParent(v *Object) { o.setParent(v) } + +// SetSessionToken sets token of the session +// within which object was created. +func (o *RawObject) SetSessionToken(v *token.SessionToken) { + o.setSessionToken(v) +} diff --git a/pkg/object/raw_test.go b/pkg/object/raw_test.go index e585d13..fe0f236 100644 --- a/pkg/object/raw_test.go +++ b/pkg/object/raw_test.go @@ -8,6 +8,7 @@ import ( "github.com/nspcc-dev/neofs-api-go/pkg" "github.com/nspcc-dev/neofs-api-go/pkg/container" "github.com/nspcc-dev/neofs-api-go/pkg/owner" + "github.com/nspcc-dev/neofs-api-go/pkg/token" "github.com/nspcc-dev/neofs-api-go/v2/object" "github.com/stretchr/testify/require" ) @@ -202,3 +203,14 @@ func TestRawObject_ToV2(t *testing.T) { require.Equal(t, objV2, obj.ToV2()) } + +func TestRawObject_SetSessionToken(t *testing.T) { + obj := NewRaw() + + tok := token.NewSessionToken() + tok.SetID([]byte{1, 2, 3}) + + obj.SetSessionToken(tok) + + require.Equal(t, tok, obj.GetSessionToken()) +} diff --git a/pkg/object/rw.go b/pkg/object/rw.go index 5ed9f5e..5332d14 100644 --- a/pkg/object/rw.go +++ b/pkg/object/rw.go @@ -4,6 +4,7 @@ import ( "github.com/nspcc-dev/neofs-api-go/pkg" "github.com/nspcc-dev/neofs-api-go/pkg/container" "github.com/nspcc-dev/neofs-api-go/pkg/owner" + "github.com/nspcc-dev/neofs-api-go/pkg/token" "github.com/nspcc-dev/neofs-api-go/v2/object" "github.com/nspcc-dev/neofs-api-go/v2/refs" ) @@ -12,8 +13,6 @@ import ( // public getter and private setters. type rwObject object.Object -// TODO: add session token methods - // ToV2 converts Object to v2 Object message. func (o *rwObject) ToV2() *object.Object { return (*object.Object)(o) @@ -273,3 +272,19 @@ func (o *rwObject) setParent(v *Object) { split.SetParentHeader((*object.Object)(v.rwObject).GetHeader()) }) } + +// GetSessionToken returns token of the session +// within which object was created. +func (o *rwObject) GetSessionToken() *token.SessionToken { + return token.NewSessionTokenFromV2( + (*object.Object)(o). + GetHeader(). + GetSessionToken(), + ) +} + +func (o *rwObject) setSessionToken(v *token.SessionToken) { + o.setHeaderField(func(h *object.Header) { + h.SetSessionToken(v.ToV2()) + }) +} From b991e014a951fcd94a5aaa2cf9d850a978a2cb93 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 22 Sep 2020 13:55:17 +0300 Subject: [PATCH 0443/1196] [#155] sdk/eacl: Fix package cross dependency Remove the usage of object package constants from eacl unit tests. Signed-off-by: Leonard Lyubich --- pkg/acl/eacl/filter_test.go | 3 +-- pkg/acl/eacl/record_test.go | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/pkg/acl/eacl/filter_test.go b/pkg/acl/eacl/filter_test.go index 17806c2..a38d392 100644 --- a/pkg/acl/eacl/filter_test.go +++ b/pkg/acl/eacl/filter_test.go @@ -3,7 +3,6 @@ package eacl import ( "testing" - "github.com/nspcc-dev/neofs-api-go/pkg/object" v2acl "github.com/nspcc-dev/neofs-api-go/v2/acl" "github.com/stretchr/testify/require" ) @@ -11,7 +10,7 @@ import ( func TestFilter(t *testing.T) { filter := &Filter{ from: HeaderFromObject, - name: object.HdrSysNamePayloadLength, + name: "some name", matcher: MatchStringEqual, value: "200", } diff --git a/pkg/acl/eacl/record_test.go b/pkg/acl/eacl/record_test.go index 1ed7263..c91042c 100644 --- a/pkg/acl/eacl/record_test.go +++ b/pkg/acl/eacl/record_test.go @@ -4,7 +4,6 @@ import ( "crypto/ecdsa" "testing" - "github.com/nspcc-dev/neofs-api-go/pkg/object" v2acl "github.com/nspcc-dev/neofs-api-go/v2/acl" "github.com/nspcc-dev/neofs-crypto/test" "github.com/stretchr/testify/require" @@ -63,7 +62,7 @@ func TestRecord_AddFilter(t *testing.T) { filters := []Filter{ { from: HeaderFromObject, - name: object.HdrSysNameCID, + name: "some name", matcher: MatchStringEqual, value: "ContainerID", }, From 2fb1547cd87a9de03f84c72fd222b0c0e501a797 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 22 Sep 2020 14:01:10 +0300 Subject: [PATCH 0444/1196] [#155] sdk/object: Define object types Signed-off-by: Leonard Lyubich --- pkg/object/type.go | 35 +++++++++++++++++++++++++++++++++++ pkg/object/type_test.go | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+) create mode 100644 pkg/object/type.go create mode 100644 pkg/object/type_test.go diff --git a/pkg/object/type.go b/pkg/object/type.go new file mode 100644 index 0000000..afcbdf2 --- /dev/null +++ b/pkg/object/type.go @@ -0,0 +1,35 @@ +package object + +import ( + "github.com/nspcc-dev/neofs-api-go/v2/object" +) + +type Type uint8 + +const ( + TypeRegular Type = iota + TypeTombstone + TypeStorageGroup +) + +func (t Type) ToV2() object.Type { + switch t { + case TypeTombstone: + return object.TypeTombstone + case TypeStorageGroup: + return object.TypeStorageGroup + default: + return object.TypeRegular + } +} + +func TypeFromV2(t object.Type) Type { + switch t { + case object.TypeTombstone: + return TypeTombstone + case object.TypeStorageGroup: + return TypeStorageGroup + default: + return TypeRegular + } +} diff --git a/pkg/object/type_test.go b/pkg/object/type_test.go new file mode 100644 index 0000000..82f8bf2 --- /dev/null +++ b/pkg/object/type_test.go @@ -0,0 +1,36 @@ +package object + +import ( + "testing" + + "github.com/nspcc-dev/neofs-api-go/v2/object" + "github.com/stretchr/testify/require" +) + +func TestType_ToV2(t *testing.T) { + typs := []struct { + t Type + t2 object.Type + }{ + { + t: TypeRegular, + t2: object.TypeRegular, + }, + { + t: TypeTombstone, + t2: object.TypeTombstone, + }, + { + t: TypeStorageGroup, + t2: object.TypeStorageGroup, + }, + } + + for _, item := range typs { + t2 := item.t.ToV2() + + require.Equal(t, item.t2, t2) + + require.Equal(t, item.t, TypeFromV2(item.t2)) + } +} From dbb5102c02992b5b99fa9c72f3df3ae52ead771b Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 22 Sep 2020 14:02:36 +0300 Subject: [PATCH 0445/1196] [#155] sdk/object: Add object type getter/setter Signed-off-by: Leonard Lyubich --- pkg/object/raw.go | 5 +++++ pkg/object/raw_test.go | 10 ++++++++++ pkg/object/rw.go | 15 +++++++++++++++ 3 files changed, 30 insertions(+) diff --git a/pkg/object/raw.go b/pkg/object/raw.go index b4d4063..6930b6a 100644 --- a/pkg/object/raw.go +++ b/pkg/object/raw.go @@ -115,3 +115,8 @@ func (o *RawObject) SetParent(v *Object) { func (o *RawObject) SetSessionToken(v *token.SessionToken) { o.setSessionToken(v) } + +// SetType sets type of the object. +func (o *RawObject) SetType(v Type) { + o.setType(v) +} diff --git a/pkg/object/raw_test.go b/pkg/object/raw_test.go index fe0f236..531789a 100644 --- a/pkg/object/raw_test.go +++ b/pkg/object/raw_test.go @@ -214,3 +214,13 @@ func TestRawObject_SetSessionToken(t *testing.T) { require.Equal(t, tok, obj.GetSessionToken()) } + +func TestRawObject_SetType(t *testing.T) { + obj := NewRaw() + + typ := TypeStorageGroup + + obj.SetType(typ) + + require.Equal(t, typ, obj.GetType()) +} diff --git a/pkg/object/rw.go b/pkg/object/rw.go index 5332d14..e2575d7 100644 --- a/pkg/object/rw.go +++ b/pkg/object/rw.go @@ -288,3 +288,18 @@ func (o *rwObject) setSessionToken(v *token.SessionToken) { h.SetSessionToken(v.ToV2()) }) } + +// GetType returns type of the object. +func (o *rwObject) GetType() Type { + return TypeFromV2( + (*object.Object)(o). + GetHeader(). + GetObjectType(), + ) +} + +func (o *rwObject) setType(t Type) { + o.setHeaderField(func(h *object.Header) { + h.SetObjectType(t.ToV2()) + }) +} From cecdeeac73187f16a239accc35545bbdc2244a69 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 22 Sep 2020 14:42:17 +0300 Subject: [PATCH 0446/1196] [#155] sdk/object: Add CutPayload method to RawObject Add CutPayload method that returns RawObject's copy with untethered empty payload. Changing the result payload doesn't affect source object. Changing the other fields affects source object. Signed-off-by: Leonard Lyubich --- pkg/object/raw.go | 13 +++++++++++++ pkg/object/raw_test.go | 27 +++++++++++++++++++++++++++ pkg/object/rw.go | 8 ++++++++ 3 files changed, 48 insertions(+) diff --git a/pkg/object/raw.go b/pkg/object/raw.go index 6930b6a..0ff3ca0 100644 --- a/pkg/object/raw.go +++ b/pkg/object/raw.go @@ -120,3 +120,16 @@ func (o *RawObject) SetSessionToken(v *token.SessionToken) { func (o *RawObject) SetType(v Type) { o.setType(v) } + +// CutPayload returns RawObject w/ empty payload. +// +// Changes of non-payload fields affect source object. +func (o *RawObject) CutPayload() *RawObject { + if o != nil { + return &RawObject{ + rwObject: o.rwObject.cutPayload(), + } + } + + return nil +} diff --git a/pkg/object/raw_test.go b/pkg/object/raw_test.go index 531789a..ec5563e 100644 --- a/pkg/object/raw_test.go +++ b/pkg/object/raw_test.go @@ -224,3 +224,30 @@ func TestRawObject_SetType(t *testing.T) { require.Equal(t, typ, obj.GetType()) } + +func TestRawObject_CutPayload(t *testing.T) { + o1 := NewRaw() + + p1 := []byte{12, 3} + o1.SetPayload(p1) + + sz := uint64(13) + o1.SetPayloadSize(sz) + + o2 := o1.CutPayload() + + require.Equal(t, sz, o2.GetPayloadSize()) + require.Empty(t, o2.GetPayload()) + + sz++ + o1.SetPayloadSize(sz) + + require.Equal(t, sz, o1.GetPayloadSize()) + require.Equal(t, sz, o2.GetPayloadSize()) + + p2 := []byte{4, 5, 6} + o2.SetPayload(p2) + + require.Equal(t, p2, o2.GetPayload()) + require.Equal(t, p1, o1.GetPayload()) +} diff --git a/pkg/object/rw.go b/pkg/object/rw.go index e2575d7..bb3f2c0 100644 --- a/pkg/object/rw.go +++ b/pkg/object/rw.go @@ -303,3 +303,11 @@ func (o *rwObject) setType(t Type) { h.SetObjectType(t.ToV2()) }) } + +func (o *rwObject) cutPayload() *rwObject { + ov2 := new(object.Object) + *ov2 = *(*object.Object)(o) + ov2.SetPayload(nil) + + return (*rwObject)(ov2) +} From 14fa89b81919a978a4e86b79395718c79f4ca350 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 22 Sep 2020 15:10:01 +0300 Subject: [PATCH 0447/1196] [#155] sdk/object: Add Object to RawObject converter Signed-off-by: Leonard Lyubich --- pkg/object/raw.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/object/raw.go b/pkg/object/raw.go index 0ff3ca0..a6f3e9d 100644 --- a/pkg/object/raw.go +++ b/pkg/object/raw.go @@ -22,6 +22,11 @@ func NewRawFromV2(oV2 *object.Object) *RawObject { } } +// NewRawFrom wraps Object instance to RawObject. +func NewRawFrom(obj *Object) *RawObject { + return NewRawFromV2(obj.ToV2()) +} + // NewRaw creates and initializes blank RawObject. // // Works similar as NewRawFromV2(new(Object)). From d19e5418da42dafa2b8cdf5ac6d0966ecaab348e Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 25 Sep 2020 15:51:34 +0300 Subject: [PATCH 0448/1196] [#159] sdk: Define object range in object pkg Define Range type in object package. Replace Range in client package with the new one. Signed-off-by: Leonard Lyubich --- pkg/client/object.go | 48 +++++++--------------------------------- pkg/object/range.go | 47 +++++++++++++++++++++++++++++++++++++++ pkg/object/range_test.go | 25 +++++++++++++++++++++ 3 files changed, 80 insertions(+), 40 deletions(-) create mode 100644 pkg/object/range.go create mode 100644 pkg/object/range_test.go diff --git a/pkg/client/object.go b/pkg/client/object.go index 8bcedb2..04724d1 100644 --- a/pkg/client/object.go +++ b/pkg/client/object.go @@ -19,10 +19,6 @@ import ( "github.com/pkg/errors" ) -type Range struct { - ln, off uint64 -} - type PutObjectParams struct { obj *object.Object @@ -48,7 +44,7 @@ type ObjectHeaderParams struct { type RangeDataParams struct { addr *object.Address - r *Range + r *object.Range w io.Writer } @@ -58,7 +54,7 @@ type RangeChecksumParams struct { addr *object.Address - rs []*Range + rs []*object.Range salt []byte } @@ -93,11 +89,11 @@ const TZSize = 64 const searchQueryVersion uint32 = 1 -func rangesToV2(rs []*Range) []*v2object.Range { +func rangesToV2(rs []*object.Range) []*v2object.Range { r2 := make([]*v2object.Range, 0, len(rs)) for i := range rs { - r2 = append(r2, rs[i].toV2()) + r2 = append(r2, rs[i].ToV2()) } return r2 @@ -114,34 +110,6 @@ func (t checksumType) toV2() v2refs.ChecksumType { } } -func (r *Range) WithLength(v uint64) *Range { - if r != nil { - r.ln = v - } - - return r -} - -func (r *Range) WithOffset(v uint64) *Range { - if r != nil { - r.off = v - } - - return r -} - -func (r *Range) toV2() *v2object.Range { - if r != nil { - r2 := new(v2object.Range) - r2.SetOffset(r.off) - r2.SetLength(r.ln) - - return r2 - } - - return nil -} - func (w *putObjectV2Writer) Write(p []byte) (int, error) { w.chunkPart.SetChunk(p) @@ -620,7 +588,7 @@ func (p *RangeDataParams) WithAddress(v *object.Address) *RangeDataParams { return p } -func (p *RangeDataParams) WithRange(v *Range) *RangeDataParams { +func (p *RangeDataParams) WithRange(v *object.Range) *RangeDataParams { if p != nil { p.r = v } @@ -680,7 +648,7 @@ func (c *Client) objectPayloadRangeV2(ctx context.Context, p *RangeDataParams, o // fill body fields body.SetAddress(p.addr.ToV2()) - body.SetRange(p.r.toV2()) + body.SetRange(p.r.ToV2()) // sign the request if err := signature.SignServiceMessage(c.key, req); err != nil { @@ -695,7 +663,7 @@ func (c *Client) objectPayloadRangeV2(ctx context.Context, p *RangeDataParams, o var payload []byte if p.w != nil { - payload = make([]byte, p.r.ln) + payload = make([]byte, p.r.GetLength()) } for { @@ -736,7 +704,7 @@ func (p *RangeChecksumParams) WithAddress(v *object.Address) *RangeChecksumParam return p } -func (p *RangeChecksumParams) WithRangeList(rs ...*Range) *RangeChecksumParams { +func (p *RangeChecksumParams) WithRangeList(rs ...*object.Range) *RangeChecksumParams { if p != nil { p.rs = rs } diff --git a/pkg/object/range.go b/pkg/object/range.go new file mode 100644 index 0000000..901bd3f --- /dev/null +++ b/pkg/object/range.go @@ -0,0 +1,47 @@ +package object + +import ( + "github.com/nspcc-dev/neofs-api-go/v2/object" +) + +// Range represents v2-compatible object payload range. +type Range object.Range + +// NewRangeFromV2 wraps v2 Range message to Range. +func NewRangeFromV2(rV2 *object.Range) *Range { + return (*Range)(rV2) +} + +// NewRange creates and initializes blank Range. +func NewRange() *Range { + return NewRangeFromV2(new(object.Range)) +} + +// ToV2 converts Range to v2 Range message. +func (r *Range) ToV2() *object.Range { + return (*object.Range)(r) +} + +// GetLength returns payload range size. +func (r *Range) GetLength() uint64 { + return (*object.Range)(r). + GetLength() +} + +// SetLength sets payload range size. +func (r *Range) SetLength(v uint64) { + (*object.Range)(r). + SetLength(v) +} + +// GetOffset sets payload range offset from start. +func (r *Range) GetOffset() uint64 { + return (*object.Range)(r). + GetOffset() +} + +// SetOffset gets payload range offset from start. +func (r *Range) SetOffset(v uint64) { + (*object.Range)(r). + SetOffset(v) +} diff --git a/pkg/object/range_test.go b/pkg/object/range_test.go new file mode 100644 index 0000000..4cce11d --- /dev/null +++ b/pkg/object/range_test.go @@ -0,0 +1,25 @@ +package object + +import ( + "testing" + + "github.com/stretchr/testify/require" +) + +func TestRange_SetOffset(t *testing.T) { + r := NewRange() + + off := uint64(13) + r.SetOffset(off) + + require.Equal(t, off, r.GetOffset()) +} + +func TestRange_SetLength(t *testing.T) { + r := NewRange() + + ln := uint64(7) + r.SetLength(ln) + + require.Equal(t, ln, r.GetLength()) +} From c814cc62faf46c0d05f001c167328324439dfa1a Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Fri, 25 Sep 2020 14:59:07 +0300 Subject: [PATCH 0449/1196] [#158] pkg/client: Ignore EOF on buffer copy in object.Put There is a issue when user sends payload chunk to the neofs node, but node closes connection earlier, e.g. node can return error as soon as it checked ACL permission and denied request. In this case client will receive EOF error and it produces `could not send payload bytes to Put object stream` error, but in fact there is different error. If we ignore EOF there then `stream.CloseAndRecv()` return correct error message later. Signed-off-by: Alex Vanin --- pkg/client/object.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/client/object.go b/pkg/client/object.go index 04724d1..b8fe520 100644 --- a/pkg/client/object.go +++ b/pkg/client/object.go @@ -232,7 +232,8 @@ func (c *Client) putObjectV2(ctx context.Context, p *PutObjectParams, opts ...Ca } // copy payload from reader to stream writer - if _, err := io.CopyBuffer(w, rPayload, make([]byte, chunkSize)); err != nil { + _, err = io.CopyBuffer(w, rPayload, make([]byte, chunkSize)) + if err != nil && !errors.Is(errors.Cause(err), io.EOF) { return nil, errors.Wrap(err, "could not send payload bytes to Put object stream") } From 2cc58e36f8d76f1f101e36fc7b092abebf6263f9 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 25 Sep 2020 17:35:36 +0300 Subject: [PATCH 0450/1196] [#160] sdk/client: Set object identifier in Head result Signed-off-by: Leonard Lyubich --- pkg/client/object.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/client/object.go b/pkg/client/object.go index b8fe520..62fa701 100644 --- a/pkg/client/object.go +++ b/pkg/client/object.go @@ -577,8 +577,11 @@ func (c *Client) getObjectHeaderV2(ctx context.Context, p *ObjectHeaderParams, o obj := new(v2object.Object) obj.SetHeader(hdr) + raw := object.NewRawFromV2(obj) + raw.SetID(p.addr.GetObjectID()) + // convert the object - return object.NewFromV2(obj), nil + return raw.Object(), nil } func (p *RangeDataParams) WithAddress(v *object.Address) *RangeDataParams { From 420d9560625be602670c8323d2a6e44a3ce2d4d9 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 29 Sep 2020 15:18:52 +0300 Subject: [PATCH 0451/1196] [#162] sdk/object: Detach header verification functions Signed-off-by: Leonard Lyubich --- pkg/object/fmt.go | 34 ++++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/pkg/object/fmt.go b/pkg/object/fmt.go index 61a08b6..04cb5f4 100644 --- a/pkg/object/fmt.go +++ b/pkg/object/fmt.go @@ -124,10 +124,8 @@ func VerifyIDSignature(obj *Object) error { ) } -// SetVerificationFields calculates and sets all verification fields of the object. -func SetVerificationFields(key *ecdsa.PrivateKey, obj *RawObject) error { - CalculateAndSetPayloadChecksum(obj) - +// SetIDWithSignature sets object identifier and signature. +func SetIDWithSignature(key *ecdsa.PrivateKey, obj *RawObject) error { if err := CalculateAndSetID(obj); err != nil { return errors.Wrap(err, "could not set identifier") } @@ -139,14 +137,17 @@ func SetVerificationFields(key *ecdsa.PrivateKey, obj *RawObject) error { return nil } +// SetVerificationFields calculates and sets all verification fields of the object. +func SetVerificationFields(key *ecdsa.PrivateKey, obj *RawObject) error { + CalculateAndSetPayloadChecksum(obj) + + return SetIDWithSignature(key, obj) +} + // CheckVerificationFields checks all verification fields of the object. func CheckVerificationFields(obj *Object) error { - if err := VerifyIDSignature(obj); err != nil { - return errors.Wrap(err, "invalid signature") - } - - if err := VerifyID(obj); err != nil { - return errors.Wrap(err, "invalid identifier") + if err := CheckHeaderVerificationFields(obj); err != nil { + return errors.Wrap(err, "invalid header structure") } if err := VerifyPayloadChecksum(obj); err != nil { @@ -155,3 +156,16 @@ func CheckVerificationFields(obj *Object) error { return nil } + +// CheckHeaderVerificationFields checks all verification fields except payload. +func CheckHeaderVerificationFields(obj *Object) error { + if err := VerifyIDSignature(obj); err != nil { + return errors.Wrap(err, "invalid signature") + } + + if err := VerifyID(obj); err != nil { + return errors.Wrap(err, "invalid identifier") + } + + return nil +} From ae81f4584e9ad0faf659dfdcbd183aee14cc018d Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 30 Sep 2020 18:39:27 +0300 Subject: [PATCH 0452/1196] [#164] sdk/object: Add parent ID getter and setter Signed-off-by: Leonard Lyubich --- pkg/object/raw.go | 5 +++++ pkg/object/raw_test.go | 9 +++++++++ pkg/object/rw.go | 16 ++++++++++++++++ 3 files changed, 30 insertions(+) diff --git a/pkg/object/raw.go b/pkg/object/raw.go index a6f3e9d..bb7401b 100644 --- a/pkg/object/raw.go +++ b/pkg/object/raw.go @@ -110,6 +110,11 @@ func (o *RawObject) SetChildren(v ...*ID) { o.setChildren(v...) } +// SetParentID sets identifier of the parent object. +func (o *RawObject) SetParentID(v *ID) { + o.setParentID(v) +} + // SetParent sets parent object w/o payload. func (o *RawObject) SetParent(v *Object) { o.setParent(v) diff --git a/pkg/object/raw_test.go b/pkg/object/raw_test.go index ec5563e..2cc3246 100644 --- a/pkg/object/raw_test.go +++ b/pkg/object/raw_test.go @@ -251,3 +251,12 @@ func TestRawObject_CutPayload(t *testing.T) { require.Equal(t, p2, o2.GetPayload()) require.Equal(t, p1, o1.GetPayload()) } + +func TestRawObject_SetParentID(t *testing.T) { + obj := NewRaw() + + id := randID(t) + obj.setParentID(id) + + require.Equal(t, id, obj.GetParentID()) +} diff --git a/pkg/object/rw.go b/pkg/object/rw.go index bb3f2c0..b223307 100644 --- a/pkg/object/rw.go +++ b/pkg/object/rw.go @@ -251,6 +251,22 @@ func (o *rwObject) setChildren(v ...*ID) { }) } +// GetParentID returns identifier of the parent object. +func (o *rwObject) GetParentID() *ID { + return NewIDFromV2( + (*object.Object)(o). + GetHeader(). + GetSplit(). + GetParent(), + ) +} + +func (o *rwObject) setParentID(v *ID) { + o.setSplitFields(func(split *object.SplitHeader) { + split.SetParent(v.ToV2()) + }) +} + // GetParent returns parent object w/o payload. func (o *rwObject) GetParent() *Object { h := (*object.Object)(o). From 9799e5d48c7bc0527d0d3c8d527c8df0647f247b Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 30 Sep 2020 18:40:57 +0300 Subject: [PATCH 0453/1196] [#164] sdk/object: Return nil parent if parent fields are empty Signed-off-by: Leonard Lyubich --- pkg/object/raw_test.go | 5 +++++ pkg/object/rw.go | 11 +++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/pkg/object/raw_test.go b/pkg/object/raw_test.go index 2cc3246..a3119be 100644 --- a/pkg/object/raw_test.go +++ b/pkg/object/raw_test.go @@ -186,8 +186,13 @@ func TestRawObject_SetChildren(t *testing.T) { func TestRawObject_SetParent(t *testing.T) { obj := NewRaw() + require.Nil(t, obj.GetParent()) + par := NewRaw() par.SetID(randID(t)) + par.SetContainerID(container.NewID()) + par.SetSignature(pkg.NewSignature()) + parObj := par.Object() obj.SetParent(parObj) diff --git a/pkg/object/rw.go b/pkg/object/rw.go index b223307..b1b13c7 100644 --- a/pkg/object/rw.go +++ b/pkg/object/rw.go @@ -273,10 +273,17 @@ func (o *rwObject) GetParent() *Object { GetHeader(). GetSplit() + parSig := h.GetParentSignature() + parHdr := h.GetParentHeader() + + if parSig == nil && parHdr == nil { + return nil + } + oV2 := new(object.Object) oV2.SetObjectID(h.GetParent()) - oV2.SetSignature(h.GetParentSignature()) - oV2.SetHeader(h.GetParentHeader()) + oV2.SetSignature(parSig) + oV2.SetHeader(parHdr) return NewFromV2(oV2) } From 09e6093e64fd5d83a2cb406bc85a9dacb0ff3287 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 30 Sep 2020 18:54:07 +0300 Subject: [PATCH 0454/1196] [#164] sdk/object: Define filters to search root objects Signed-off-by: Leonard Lyubich --- pkg/object/search.go | 12 ++++++++++++ pkg/object/search_test.go | 28 ++++++++++++++++++++++++++++ pkg/object/wellknown_filters.go | 20 ++++++++++++++++++++ 3 files changed, 60 insertions(+) create mode 100644 pkg/object/wellknown_filters.go diff --git a/pkg/object/search.go b/pkg/object/search.go index 3cf97be..8fea6af 100644 --- a/pkg/object/search.go +++ b/pkg/object/search.go @@ -98,3 +98,15 @@ func (f SearchFilters) ToV2() []*v2object.SearchFilter { return result } + +func (f *SearchFilters) addRootFilter(val string) { + f.AddFilter(KeyRoot, val, MatchStringEqual) +} + +func (f *SearchFilters) AddRootFilter() { + f.addRootFilter(ValRoot) +} + +func (f *SearchFilters) AddNonRootFilter() { + f.addRootFilter(ValNonRoot) +} diff --git a/pkg/object/search_test.go b/pkg/object/search_test.go index 99fb139..1058c5e 100644 --- a/pkg/object/search_test.go +++ b/pkg/object/search_test.go @@ -51,3 +51,31 @@ func TestFilter(t *testing.T) { newFilters := object.NewSearchFiltersFromV2(v2) require.Equal(t, filters, newFilters) } + +func TestSearchFilters_AddRootFilter(t *testing.T) { + fs := new(object.SearchFilters) + + fs.AddRootFilter() + + require.Len(t, *fs, 1) + + f := (*fs)[0] + + require.Equal(t, object.MatchStringEqual, f.Operation()) + require.Equal(t, object.KeyRoot, f.Header()) + require.Equal(t, object.ValRoot, f.Value()) +} + +func TestSearchFilters_AddNonRootFilter(t *testing.T) { + fs := new(object.SearchFilters) + + fs.AddNonRootFilter() + + require.Len(t, *fs, 1) + + f := (*fs)[0] + + require.Equal(t, object.MatchStringEqual, f.Operation()) + require.Equal(t, object.KeyRoot, f.Header()) + require.Equal(t, object.ValNonRoot, f.Value()) +} diff --git a/pkg/object/wellknown_filters.go b/pkg/object/wellknown_filters.go new file mode 100644 index 0000000..16ccd23 --- /dev/null +++ b/pkg/object/wellknown_filters.go @@ -0,0 +1,20 @@ +package object + +const ( + valFalse = "false" + valTrue = "true" +) + +// ReservedFilterPrefix is a reserved prefix for system search filter keys. +const ReservedFilterPrefix = "$Object:" + +const ( + // KeyRoot is a reserved search filter key to source objects. + KeyRoot = ReservedFilterPrefix + "ROOT" + + // ValRoot is a value of root object filter. + ValRoot = valTrue + + // ValNonRoot is a value of non-root object filter. + ValNonRoot = valFalse +) From f3bddc2ba5df158f4b003bdb64f7505e13db5d69 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 30 Sep 2020 18:57:39 +0300 Subject: [PATCH 0455/1196] [#164] sdk/object: Define filters to search virtual objects Signed-off-by: Leonard Lyubich --- pkg/object/search.go | 12 ++++++++++++ pkg/object/search_test.go | 28 ++++++++++++++++++++++++++++ pkg/object/wellknown_filters.go | 11 +++++++++++ 3 files changed, 51 insertions(+) diff --git a/pkg/object/search.go b/pkg/object/search.go index 8fea6af..e17d35b 100644 --- a/pkg/object/search.go +++ b/pkg/object/search.go @@ -110,3 +110,15 @@ func (f *SearchFilters) AddRootFilter() { func (f *SearchFilters) AddNonRootFilter() { f.addRootFilter(ValNonRoot) } + +func (f *SearchFilters) addLeafFilter(val string) { + f.AddFilter(KeyLeaf, val, MatchStringEqual) +} + +func (f *SearchFilters) AddLeafFilter() { + f.addLeafFilter(ValLeaf) +} + +func (f *SearchFilters) AddNonLeafFilter() { + f.addLeafFilter(ValNonLeaf) +} diff --git a/pkg/object/search_test.go b/pkg/object/search_test.go index 1058c5e..d3916ad 100644 --- a/pkg/object/search_test.go +++ b/pkg/object/search_test.go @@ -79,3 +79,31 @@ func TestSearchFilters_AddNonRootFilter(t *testing.T) { require.Equal(t, object.KeyRoot, f.Header()) require.Equal(t, object.ValNonRoot, f.Value()) } + +func TestSearchFilters_AddLeafFilter(t *testing.T) { + fs := new(object.SearchFilters) + + fs.AddLeafFilter() + + require.Len(t, *fs, 1) + + f := (*fs)[0] + + require.Equal(t, object.MatchStringEqual, f.Operation()) + require.Equal(t, object.KeyLeaf, f.Header()) + require.Equal(t, object.ValLeaf, f.Value()) +} + +func TestSearchFilters_AddNonLeafFilter(t *testing.T) { + fs := new(object.SearchFilters) + + fs.AddNonLeafFilter() + + require.Len(t, *fs, 1) + + f := (*fs)[0] + + require.Equal(t, object.MatchStringEqual, f.Operation()) + require.Equal(t, object.KeyLeaf, f.Header()) + require.Equal(t, object.ValNonLeaf, f.Value()) +} diff --git a/pkg/object/wellknown_filters.go b/pkg/object/wellknown_filters.go index 16ccd23..734a196 100644 --- a/pkg/object/wellknown_filters.go +++ b/pkg/object/wellknown_filters.go @@ -18,3 +18,14 @@ const ( // ValNonRoot is a value of non-root object filter. ValNonRoot = valFalse ) + +const ( + // KeyLeaf is a reserved search filter key to physically stored objects. + KeyLeaf = ReservedFilterPrefix + "LEAF" + + // ValLeaf is a value of physically stored object filter. + ValLeaf = valTrue + + // ValNonLeaf is a value of virtual object filter. + ValNonLeaf = valFalse +) From 2a2e4d8577a7b8fb2ba044060083095e01c52ceb Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 30 Sep 2020 18:59:31 +0300 Subject: [PATCH 0456/1196] [#164] sdk/object: Implement method to reset relation fields Signed-off-by: Leonard Lyubich --- pkg/object/raw.go | 5 +++++ pkg/object/raw_test.go | 10 ++++++++++ pkg/object/rw.go | 6 ++++++ 3 files changed, 21 insertions(+) diff --git a/pkg/object/raw.go b/pkg/object/raw.go index bb7401b..f29e001 100644 --- a/pkg/object/raw.go +++ b/pkg/object/raw.go @@ -143,3 +143,8 @@ func (o *RawObject) CutPayload() *RawObject { return nil } + +// ResetRelations removes all fields of links with other objects. +func (o *RawObject) ResetRelations() { + o.resetRelations() +} diff --git a/pkg/object/raw_test.go b/pkg/object/raw_test.go index a3119be..3931adb 100644 --- a/pkg/object/raw_test.go +++ b/pkg/object/raw_test.go @@ -265,3 +265,13 @@ func TestRawObject_SetParentID(t *testing.T) { require.Equal(t, id, obj.GetParentID()) } + +func TestRawObject_ResetRelations(t *testing.T) { + obj := NewRaw() + + obj.SetPreviousID(randID(t)) + + obj.ResetRelations() + + require.Nil(t, obj.GetPreviousID()) +} diff --git a/pkg/object/rw.go b/pkg/object/rw.go index b1b13c7..0e8e621 100644 --- a/pkg/object/rw.go +++ b/pkg/object/rw.go @@ -296,6 +296,12 @@ func (o *rwObject) setParent(v *Object) { }) } +func (o *rwObject) resetRelations() { + o.setHeaderField(func(h *object.Header) { + h.SetSplit(nil) + }) +} + // GetSessionToken returns token of the session // within which object was created. func (o *rwObject) GetSessionToken() *token.SessionToken { From 1305bc750e7f3590e8fb2dd0b04d4ca4fc528cc1 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 30 Sep 2020 20:21:32 +0300 Subject: [PATCH 0457/1196] [#164] sdk/object: Add HasParent method Signed-off-by: Leonard Lyubich --- pkg/object/raw.go | 5 +++++ pkg/object/raw_test.go | 12 ++++++++++++ pkg/object/rw.go | 12 ++++++++++++ 3 files changed, 29 insertions(+) diff --git a/pkg/object/raw.go b/pkg/object/raw.go index f29e001..2615530 100644 --- a/pkg/object/raw.go +++ b/pkg/object/raw.go @@ -148,3 +148,8 @@ func (o *RawObject) CutPayload() *RawObject { func (o *RawObject) ResetRelations() { o.resetRelations() } + +// InitRelations initializes relation field. +func (o *RawObject) InitRelations() { + o.initRelations() +} diff --git a/pkg/object/raw_test.go b/pkg/object/raw_test.go index 3931adb..2e39322 100644 --- a/pkg/object/raw_test.go +++ b/pkg/object/raw_test.go @@ -275,3 +275,15 @@ func TestRawObject_ResetRelations(t *testing.T) { require.Nil(t, obj.GetPreviousID()) } + +func TestRwObject_HasParent(t *testing.T) { + obj := NewRaw() + + obj.InitRelations() + + require.True(t, obj.HasParent()) + + obj.ResetRelations() + + require.False(t, obj.HasParent()) +} diff --git a/pkg/object/rw.go b/pkg/object/rw.go index 0e8e621..0aab2c7 100644 --- a/pkg/object/rw.go +++ b/pkg/object/rw.go @@ -296,6 +296,12 @@ func (o *rwObject) setParent(v *Object) { }) } +func (o *rwObject) initRelations() { + o.setHeaderField(func(h *object.Header) { + h.SetSplit(new(object.SplitHeader)) + }) +} + func (o *rwObject) resetRelations() { o.setHeaderField(func(h *object.Header) { h.SetSplit(nil) @@ -340,3 +346,9 @@ func (o *rwObject) cutPayload() *rwObject { return (*rwObject)(ov2) } + +func (o *rwObject) HasParent() bool { + return (*object.Object)(o). + GetHeader(). + GetSplit() != nil +} From cf70026c7e422f55cd08d7765916abc46e22cd9f Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 30 Sep 2020 20:24:05 +0300 Subject: [PATCH 0458/1196] [#164] sdk/container: Implement Equal method on ID Signed-off-by: Leonard Lyubich --- pkg/container/id.go | 9 +++++++++ pkg/container/id_test.go | 23 +++++++++++++++++++++++ pkg/object/id.go | 4 ++-- 3 files changed, 34 insertions(+), 2 deletions(-) diff --git a/pkg/container/id.go b/pkg/container/id.go index dae7bf4..795f644 100644 --- a/pkg/container/id.go +++ b/pkg/container/id.go @@ -1,6 +1,7 @@ package container import ( + "bytes" "crypto/sha256" "github.com/nspcc-dev/neofs-api-go/v2/refs" @@ -30,3 +31,11 @@ func (id *ID) SetSHA256(v [sha256.Size]byte) { func (id *ID) ToV2() *refs.ContainerID { return (*refs.ContainerID)(id) } + +// Equal returns true if identifiers are identical. +func (id *ID) Equal(id2 *ID) bool { + return bytes.Equal( + (*refs.ContainerID)(id).GetValue(), + (*refs.ContainerID)(id2).GetValue(), + ) +} diff --git a/pkg/container/id_test.go b/pkg/container/id_test.go index a5ae05e..3603771 100644 --- a/pkg/container/id_test.go +++ b/pkg/container/id_test.go @@ -22,3 +22,26 @@ func TestIDV2_0(t *testing.T) { require.Equal(t, checksum[:], cidV2.GetValue()) } + +func randSHA256Checksum(t *testing.T) (cs [sha256.Size]byte) { + _, err := rand.Read(cs[:]) + require.NoError(t, err) + + return +} + +func TestID_Equal(t *testing.T) { + cs := randSHA256Checksum(t) + + id1 := NewID() + id1.SetSHA256(cs) + + id2 := NewID() + id2.SetSHA256(cs) + + id3 := NewID() + id3.SetSHA256(randSHA256Checksum(t)) + + require.True(t, id1.Equal(id2)) + require.False(t, id1.Equal(id3)) +} diff --git a/pkg/object/id.go b/pkg/object/id.go index c7eb573..4eefbf5 100644 --- a/pkg/object/id.go +++ b/pkg/object/id.go @@ -30,8 +30,8 @@ func (id *ID) SetSHA256(v [sha256.Size]byte) { // Equal returns true if identifiers are identical. func (id *ID) Equal(id2 *ID) bool { return bytes.Equal( - (*ID)(id).ToV2().GetValue(), - (*ID)(id2).ToV2().GetValue(), + (*refs.ObjectID)(id).GetValue(), + (*refs.ObjectID)(id2).GetValue(), ) } From fa18f5ede71932191b87063a5cd56405b05d6039 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Tue, 6 Oct 2020 09:56:28 +0300 Subject: [PATCH 0459/1196] [#165] pkg/owner: Add ID constructor from wallet Signed-off-by: Alex Vanin --- pkg/owner/id.go | 8 ++++++++ pkg/owner/id_test.go | 9 +++++++++ 2 files changed, 17 insertions(+) diff --git a/pkg/owner/id.go b/pkg/owner/id.go index d333963..4862b67 100644 --- a/pkg/owner/id.go +++ b/pkg/owner/id.go @@ -43,3 +43,11 @@ func ScriptHashBE(id *ID) ([]byte, error) { return addr.BytesBE(), nil } + +// NewIDFromNeo3Wallet creates new owner identity from 25-byte neo wallet. +func NewIDFromNeo3Wallet(v *NEO3Wallet) *ID { + id := NewID() + id.SetNeo3Wallet(v) + + return id +} diff --git a/pkg/owner/id_test.go b/pkg/owner/id_test.go index e0b0f8a..581d9f2 100644 --- a/pkg/owner/id_test.go +++ b/pkg/owner/id_test.go @@ -4,6 +4,7 @@ import ( "crypto/rand" "testing" + "github.com/nspcc-dev/neofs-crypto/test" "github.com/stretchr/testify/require" ) @@ -21,3 +22,11 @@ func TestIDV2(t *testing.T) { require.Equal(t, wallet.Bytes(), idV2.GetValue()) } + +func TestNewIDFromNeo3Wallet(t *testing.T) { + wallet, err := NEO3WalletFromPublicKey(&test.DecodeKey(1).PublicKey) + require.NoError(t, err) + + id := NewIDFromNeo3Wallet(wallet) + require.Equal(t, id.ToV2().GetValue(), wallet.Bytes()) +} From a29b6155220a1604ccf7bcde1cfc919f4c67cd14 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Thu, 8 Oct 2020 14:22:28 +0300 Subject: [PATCH 0460/1196] [#166] v2/netmap: add v2 structures for netmap service Signed-off-by: Alex Vanin --- v2/netmap/client.go | 159 ++++++++++++++++++++++++++++++++++++++ v2/netmap/convert.go | 95 +++++++++++++++++++++++ v2/netmap/grpc/client.go | 62 +++++++++++++++ v2/netmap/marshal.go | 51 ++++++++++++ v2/netmap/marshal_test.go | 37 ++++++++- v2/netmap/service.go | 27 +++++++ v2/netmap/types.go | 118 ++++++++++++++++++++++++++++ v2/signature/sign.go | 7 ++ 8 files changed, 555 insertions(+), 1 deletion(-) create mode 100644 v2/netmap/client.go create mode 100644 v2/netmap/grpc/client.go create mode 100644 v2/netmap/service.go diff --git a/v2/netmap/client.go b/v2/netmap/client.go new file mode 100644 index 0000000..6d375d7 --- /dev/null +++ b/v2/netmap/client.go @@ -0,0 +1,159 @@ +package netmap + +import ( + "context" + + "github.com/nspcc-dev/neofs-api-go/v2/client" + netmap "github.com/nspcc-dev/neofs-api-go/v2/netmap/grpc" + "github.com/pkg/errors" + "google.golang.org/grpc" +) + +// Client represents universal netmap transport client. +type Client struct { + cLocalNodeInfo *localNodeInfoClient +} + +// Option represents Client option. +type Option func(*cfg) + +type cfg struct { + proto client.Protocol + + globalOpts []client.Option + + gRPC cfgGRPC +} + +type cfgGRPC struct { + serviceClient netmap.NetmapServiceClient + + grpcCallOpts []grpc.CallOption + + callOpts []netmap.Option + + client *netmap.Client +} + +type localNodeInfoClient struct { + requestConverter func(*LocalNodeInfoRequest) interface{} + + caller func(context.Context, interface{}) (interface{}, error) + + responseConverter func(interface{}) *LocalNodeInfoResponse +} + +// LocalNodeInfo sends LocalNodeInfoRequest over the network. +func (c *Client) LocalNodeInfo(ctx context.Context, req *LocalNodeInfoRequest) (*LocalNodeInfoResponse, error) { + resp, err := c.cLocalNodeInfo.caller(ctx, c.cLocalNodeInfo.requestConverter(req)) + if err != nil { + return nil, errors.Wrap(err, "could not send container put request") + } + + return c.cLocalNodeInfo.responseConverter(resp), nil +} + +func defaultCfg() *cfg { + return &cfg{ + proto: client.ProtoGRPC, + } +} + +// NewClient is a constructor for netmap transport client. +func NewClient(opts ...Option) (*Client, error) { + cfg := defaultCfg() + + for i := range opts { + opts[i](cfg) + } + + var err error + + switch cfg.proto { + case client.ProtoGRPC: + var c *netmap.Client + if c, err = newGRPCClient(cfg); err != nil { + break + } + + return &Client{ + cLocalNodeInfo: &localNodeInfoClient{ + requestConverter: func(req *LocalNodeInfoRequest) interface{} { + return LocalNodeInfoRequestToGRPCMessage(req) + }, + caller: func(ctx context.Context, req interface{}) (interface{}, error) { + return c.LocalNodeInfo(ctx, req.(*netmap.LocalNodeInfoRequest)) + }, + responseConverter: func(resp interface{}) *LocalNodeInfoResponse { + return LocalNodeInfoResponseFromGRPCMessage(resp.(*netmap.LocalNodeInfoResponse)) + }, + }, + }, nil + default: + err = client.ErrProtoUnsupported + } + + return nil, errors.Wrapf(err, "could not create %s Session client", cfg.proto) +} + +func newGRPCClient(cfg *cfg) (*netmap.Client, error) { + var err error + + if cfg.gRPC.client == nil { + if cfg.gRPC.serviceClient == nil { + conn, err := client.NewGRPCClientConn(cfg.globalOpts...) + if err != nil { + return nil, errors.Wrap(err, "could not open gRPC client connection") + } + + cfg.gRPC.serviceClient = netmap.NewNetmapServiceClient(conn) + } + + cfg.gRPC.client, err = netmap.NewClient( + cfg.gRPC.serviceClient, + append( + cfg.gRPC.callOpts, + netmap.WithCallOptions(cfg.gRPC.grpcCallOpts), + )..., + ) + } + + return cfg.gRPC.client, err +} + +// WithGlobalOpts sets global client options to client. +func WithGlobalOpts(v ...client.Option) Option { + return func(c *cfg) { + if len(v) > 0 { + c.globalOpts = v + } + } +} + +// WithGRPCServiceClient sets existing service client. +func WithGRPCServiceClient(v netmap.NetmapServiceClient) Option { + return func(c *cfg) { + c.gRPC.serviceClient = v + } +} + +// WithGRPCServiceClient sets GRPC specific call options. +func WithGRPCCallOpts(v []grpc.CallOption) Option { + return func(c *cfg) { + c.gRPC.grpcCallOpts = v + } +} + +// WithGRPCServiceClient sets GRPC specific client options. +func WithGRPCClientOpts(v []netmap.Option) Option { + return func(c *cfg) { + c.gRPC.callOpts = v + } +} + +// WithGRPCServiceClient sets existing GRPC client. +func WithGRPCClient(v *netmap.Client) Option { + return func(c *cfg) { + c.gRPC.client = v + } +} diff --git a/v2/netmap/convert.go b/v2/netmap/convert.go index e08d17c..ca069c9 100644 --- a/v2/netmap/convert.go +++ b/v2/netmap/convert.go @@ -2,6 +2,8 @@ package netmap import ( netmap "github.com/nspcc-dev/neofs-api-go/v2/netmap/grpc" + "github.com/nspcc-dev/neofs-api-go/v2/refs" + "github.com/nspcc-dev/neofs-api-go/v2/session" ) func FilterToGRPCMessage(f *Filter) *netmap.Filter { @@ -259,3 +261,96 @@ func NodeInfoFromGRPCMessage(m *netmap.NodeInfo) *NodeInfo { return a } + +func LocalNodeInfoRequestBodyToGRPCMessage(r *LocalNodeInfoRequestBody) *netmap.LocalNodeInfoRequest_Body { + if r == nil { + return nil + } + + return new(netmap.LocalNodeInfoRequest_Body) +} + +func LocalNodeInfoRequestBodyFromGRPCMessage(m *netmap.LocalNodeInfoRequest_Body) *LocalNodeInfoRequestBody { + if m == nil { + return nil + } + + return new(LocalNodeInfoRequestBody) +} + +func LocalNodeInfoResponseBodyToGRPCMessage(r *LocalNodeInfoResponseBody) *netmap.LocalNodeInfoResponse_Body { + if r == nil { + return nil + } + + m := new(netmap.LocalNodeInfoResponse_Body) + + m.SetVersion(refs.VersionToGRPCMessage(r.GetVersion())) + m.SetNodeInfo(NodeInfoToGRPCMessage(r.GetNodeInfo())) + + return m +} + +func LocalNodeInfoResponseBodyFromGRPCMessage(m *netmap.LocalNodeInfoResponse_Body) *LocalNodeInfoResponseBody { + if m == nil { + return nil + } + + r := new(LocalNodeInfoResponseBody) + r.SetVersion(refs.VersionFromGRPCMessage(m.GetVersion())) + r.SetNodeInfo(NodeInfoFromGRPCMessage(m.GetNodeInfo())) + + return r +} + +func LocalNodeInfoRequestToGRPCMessage(r *LocalNodeInfoRequest) *netmap.LocalNodeInfoRequest { + if r == nil { + return nil + } + + m := new(netmap.LocalNodeInfoRequest) + m.SetBody(LocalNodeInfoRequestBodyToGRPCMessage(r.GetBody())) + + session.RequestHeadersToGRPC(r, m) + + return m +} + +func LocalNodeInfoRequestFromGRPCMessage(m *netmap.LocalNodeInfoRequest) *LocalNodeInfoRequest { + if m == nil { + return nil + } + + r := new(LocalNodeInfoRequest) + r.SetBody(LocalNodeInfoRequestBodyFromGRPCMessage(m.GetBody())) + + session.RequestHeadersFromGRPC(m, r) + + return r +} + +func LocalNodeInfoResponseToGRPCMessage(r *LocalNodeInfoResponse) *netmap.LocalNodeInfoResponse { + if r == nil { + return nil + } + + m := new(netmap.LocalNodeInfoResponse) + m.SetBody(LocalNodeInfoResponseBodyToGRPCMessage(r.GetBody())) + + session.ResponseHeadersToGRPC(r, m) + + return m +} + +func LocalNodeInfoResponseFromGRPCMessage(m *netmap.LocalNodeInfoResponse) *LocalNodeInfoResponse { + if m == nil { + return nil + } + + r := new(LocalNodeInfoResponse) + r.SetBody(LocalNodeInfoResponseBodyFromGRPCMessage(m.GetBody())) + + session.ResponseHeadersFromGRPC(m, r) + + return r +} diff --git a/v2/netmap/grpc/client.go b/v2/netmap/grpc/client.go new file mode 100644 index 0000000..d22a79a --- /dev/null +++ b/v2/netmap/grpc/client.go @@ -0,0 +1,62 @@ +package netmap + +import ( + "context" + + "github.com/pkg/errors" + "google.golang.org/grpc" +) + +// Client wraps NetmapServiceClient +// with pre-defined configurations. +type Client struct { + *cfg + + client NetmapServiceClient +} + +// Option represents Client option. +type Option func(*cfg) + +type cfg struct { + callOpts []grpc.CallOption +} + +// ErrNilNetmapServiceClient is returned by functions that expect +// a non-nil ContainerServiceClient, but received nil. +var ErrNilNetmapServiceClient = errors.New("netmap gRPC client is nil") + +func defaultCfg() *cfg { + return new(cfg) +} + +// NewClient creates, initializes and returns a new Client instance. +// +// Options are applied one by one in order. +func NewClient(c NetmapServiceClient, opts ...Option) (*Client, error) { + if c == nil { + return nil, ErrNilNetmapServiceClient + } + + cfg := defaultCfg() + for i := range opts { + opts[i](cfg) + } + + return &Client{ + cfg: cfg, + client: c, + }, nil +} + +func (c *Client) LocalNodeInfo(ctx context.Context, req *LocalNodeInfoRequest) (*LocalNodeInfoResponse, error) { + return c.client.LocalNodeInfo(ctx, req, c.callOpts...) +} + +// WithCallOptions returns Option that configures +// Client to attach call options to each rpc call. +func WithCallOptions(opts []grpc.CallOption) Option { + return func(c *cfg) { + c.callOpts = opts + } +} diff --git a/v2/netmap/marshal.go b/v2/netmap/marshal.go index 2fada3e..d8b9a26 100644 --- a/v2/netmap/marshal.go +++ b/v2/netmap/marshal.go @@ -33,6 +33,9 @@ const ( addressNodeInfoField = 2 attributesNodeInfoField = 3 stateNodeInfoField = 4 + + versionInfoResponseBodyField = 1 + nodeInfoResponseBodyField = 2 ) func (f *Filter) StableMarshal(buf []byte) ([]byte, error) { @@ -381,3 +384,51 @@ func (ni *NodeInfo) StableSize() (size int) { return size } + +func (l *LocalNodeInfoRequestBody) StableMarshal(buf []byte) ([]byte, error) { + return nil, nil +} + +func (l *LocalNodeInfoRequestBody) StableSize() (size int) { + return 0 +} + +func (l *LocalNodeInfoResponseBody) StableMarshal(buf []byte) ([]byte, error) { + if l == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, l.StableSize()) + } + + var ( + offset, n int + err error + ) + + n, err = proto.NestedStructureMarshal(versionInfoResponseBodyField, buf[offset:], l.version) + if err != nil { + return nil, err + } + + offset += n + + _, err = proto.NestedStructureMarshal(nodeInfoResponseBodyField, buf[offset:], l.nodeInfo) + if err != nil { + return nil, err + } + + return buf, nil +} + +func (l *LocalNodeInfoResponseBody) StableSize() (size int) { + if l == nil { + return 0 + } + + size += proto.NestedStructureSize(versionInfoResponseBodyField, l.version) + size += proto.NestedStructureSize(nodeInfoResponseBodyField, l.nodeInfo) + + return size +} diff --git a/v2/netmap/marshal_test.go b/v2/netmap/marshal_test.go index 5a4ce6c..82132a0 100644 --- a/v2/netmap/marshal_test.go +++ b/v2/netmap/marshal_test.go @@ -6,6 +6,7 @@ import ( "github.com/nspcc-dev/neofs-api-go/v2/netmap" grpc "github.com/nspcc-dev/neofs-api-go/v2/netmap/grpc" + "github.com/nspcc-dev/neofs-api-go/v2/refs" "github.com/stretchr/testify/require" ) @@ -89,7 +90,7 @@ func TestReplica_StableMarshal(t *testing.T) { }) } -func TestPlacementPolicy_StableSize(t *testing.T) { +func TestPlacementPolicy_StableMarshal(t *testing.T) { from := generatePolicy(3) transport := new(grpc.PlacementPolicy) @@ -105,6 +106,22 @@ func TestPlacementPolicy_StableSize(t *testing.T) { }) } +func TestLocalNodeInfoResponseBody_StableMarshal(t *testing.T) { + from := generateNodeInfoResponseBody() + transport := new(grpc.LocalNodeInfoResponse_Body) + + t.Run("non empty", func(t *testing.T) { + wire, err := from.StableMarshal(nil) + require.NoError(t, err) + + err = transport.Unmarshal(wire) + require.NoError(t, err) + + to := netmap.LocalNodeInfoResponseBodyFromGRPCMessage(transport) + require.Equal(t, from, to) + }) +} + func generateAttribute(k, v string) *netmap.Attribute { attr := new(netmap.Attribute) attr.SetKey(k) @@ -189,3 +206,21 @@ func generatePolicy(n int) *netmap.PlacementPolicy { return p } + +func generateNodeInfoResponseBody() *netmap.LocalNodeInfoResponseBody { + ni := generateNodeInfo("key", "/multi/addr", 2) + + r := new(netmap.LocalNodeInfoResponseBody) + r.SetVersion(generateVersion(2, 1)) + r.SetNodeInfo(ni) + + return r +} + +func generateVersion(maj, min uint32) *refs.Version { + version := new(refs.Version) + version.SetMajor(maj) + version.SetMinor(min) + + return version +} diff --git a/v2/netmap/service.go b/v2/netmap/service.go new file mode 100644 index 0000000..98e5101 --- /dev/null +++ b/v2/netmap/service.go @@ -0,0 +1,27 @@ +package netmap + +import ( + "context" + + "github.com/nspcc-dev/neofs-api-go/v2/session" +) + +type Service interface { + LocalNodeInfo(ctx context.Context, request *LocalNodeInfoRequest) (*LocalNodeInfoResponse, error) +} + +type LocalNodeInfoRequest struct { + body *LocalNodeInfoRequestBody + + metaHeader *session.RequestMetaHeader + + verifyHeader *session.RequestVerificationHeader +} + +type LocalNodeInfoResponse struct { + body *LocalNodeInfoResponseBody + + metaHeader *session.ResponseMetaHeader + + verifyHeader *session.ResponseVerificationHeader +} diff --git a/v2/netmap/types.go b/v2/netmap/types.go index c810aa3..a65bd31 100644 --- a/v2/netmap/types.go +++ b/v2/netmap/types.go @@ -1,5 +1,10 @@ package netmap +import ( + "github.com/nspcc-dev/neofs-api-go/v2/refs" + "github.com/nspcc-dev/neofs-api-go/v2/session" +) + type Filter struct { name string key string @@ -51,6 +56,13 @@ type NodeState uint32 // Clause of placement selector. type Clause uint32 +type LocalNodeInfoRequestBody struct{} + +type LocalNodeInfoResponseBody struct { + version *refs.Version + nodeInfo *NodeInfo +} + const ( UnspecifiedState NodeState = iota Online @@ -389,3 +401,109 @@ func (ni *NodeInfo) SetState(state NodeState) { ni.state = state } } + +func (l *LocalNodeInfoResponseBody) GetVersion() *refs.Version { + if l != nil { + return l.version + } + + return nil +} + +func (l *LocalNodeInfoResponseBody) SetVersion(version *refs.Version) { + if l != nil { + l.version = version + } +} + +func (l *LocalNodeInfoResponseBody) GetNodeInfo() *NodeInfo { + if l != nil { + return l.nodeInfo + } + + return nil +} + +func (l *LocalNodeInfoResponseBody) SetNodeInfo(nodeInfo *NodeInfo) { + if l != nil { + l.nodeInfo = nodeInfo + } +} + +func (l *LocalNodeInfoRequest) GetBody() *LocalNodeInfoRequestBody { + if l != nil { + return l.body + } + return nil +} + +func (l *LocalNodeInfoRequest) SetBody(body *LocalNodeInfoRequestBody) { + if l != nil { + l.body = body + } +} + +func (l *LocalNodeInfoRequest) GetMetaHeader() *session.RequestMetaHeader { + if l != nil { + return l.metaHeader + } + return nil +} + +func (l *LocalNodeInfoRequest) SetMetaHeader(metaHeader *session.RequestMetaHeader) { + if l != nil { + l.metaHeader = metaHeader + } +} + +func (l *LocalNodeInfoRequest) GetVerificationHeader() *session.RequestVerificationHeader { + if l != nil { + return l.verifyHeader + } + return nil +} + +func (l *LocalNodeInfoRequest) SetVerificationHeader(verifyHeader *session.RequestVerificationHeader) { + if l != nil { + l.verifyHeader = verifyHeader + } +} + +func (l *LocalNodeInfoResponse) GetBody() *LocalNodeInfoResponseBody { + if l != nil { + return l.body + } + return nil +} + +func (l *LocalNodeInfoResponse) SetBody(body *LocalNodeInfoResponseBody) { + if l != nil { + l.body = body + } +} + +func (l *LocalNodeInfoResponse) GetMetaHeader() *session.ResponseMetaHeader { + if l != nil { + return l.metaHeader + } + return nil +} + +func (l *LocalNodeInfoResponse) SetMetaHeader(metaHeader *session.ResponseMetaHeader) { + if l != nil { + l.metaHeader = metaHeader + } +} + +func (l *LocalNodeInfoResponse) GetVerificationHeader() *session.ResponseVerificationHeader { + if l != nil { + return l.verifyHeader + } + return nil +} + +func (l *LocalNodeInfoResponse) SetVerificationHeader(verifyHeader *session.ResponseVerificationHeader) { + if l != nil { + l.verifyHeader = verifyHeader + } +} diff --git a/v2/signature/sign.go b/v2/signature/sign.go index 4e7bd23..405f70f 100644 --- a/v2/signature/sign.go +++ b/v2/signature/sign.go @@ -7,6 +7,7 @@ import ( "github.com/nspcc-dev/neofs-api-go/util/signature" "github.com/nspcc-dev/neofs-api-go/v2/accounting" "github.com/nspcc-dev/neofs-api-go/v2/container" + "github.com/nspcc-dev/neofs-api-go/v2/netmap" "github.com/nspcc-dev/neofs-api-go/v2/object" "github.com/nspcc-dev/neofs-api-go/v2/refs" "github.com/nspcc-dev/neofs-api-go/v2/session" @@ -359,5 +360,11 @@ func serviceMessageBody(req interface{}) stableMarshaler { return v.GetBody() case *object.GetRangeHashResponse: return v.GetBody() + + /* Netmap */ + case *netmap.LocalNodeInfoRequest: + return v.GetBody() + case *netmap.LocalNodeInfoResponse: + return v.GetBody() } } From d3e3889425002704c1d41e7d1846278b29f668a6 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Thu, 8 Oct 2020 15:06:36 +0300 Subject: [PATCH 0461/1196] [#167] sdk/client: Add endpoint info getter Adds support of new netmap service to the SDK client. Signed-off-by: Alex Vanin --- pkg/client/netmap.go | 93 ++++++++++++++++++++++++++++++++++++++++++++ pkg/client/opts.go | 2 + 2 files changed, 95 insertions(+) create mode 100644 pkg/client/netmap.go diff --git a/pkg/client/netmap.go b/pkg/client/netmap.go new file mode 100644 index 0000000..c400332 --- /dev/null +++ b/pkg/client/netmap.go @@ -0,0 +1,93 @@ +package client + +import ( + "context" + + "github.com/nspcc-dev/neofs-api-go/v2/client" + "github.com/nspcc-dev/neofs-api-go/v2/netmap" + v2signature "github.com/nspcc-dev/neofs-api-go/v2/signature" + "github.com/pkg/errors" +) + +// EndpointInfo returns attributes, address and public key of the node, specified +// in client constructor via address or open connection. This can be used as a +// health check to see if node is alive and responses to requests. +func (c Client) EndpointInfo(ctx context.Context, opts ...CallOption) (*netmap.NodeInfo, error) { + switch c.remoteNode.Version.GetMajor() { + case 2: + return c.endpointInfoV2(ctx, opts...) + default: + return nil, unsupportedProtocolErr + } +} + +func (c Client) endpointInfoV2(ctx context.Context, opts ...CallOption) (*netmap.NodeInfo, error) { + // apply all available options + callOptions := defaultCallOptions() + for i := range opts { + opts[i].apply(&callOptions) + } + + reqBody := new(netmap.LocalNodeInfoRequestBody) + + req := new(netmap.LocalNodeInfoRequest) + req.SetBody(reqBody) + req.SetMetaHeader(v2MetaHeaderFromOpts(callOptions)) + + err := v2signature.SignServiceMessage(c.key, req) + if err != nil { + return nil, err + } + + switch c.remoteNode.Protocol { + case GRPC: + cli, err := v2NetmapClientFromOptions(c.opts) + if err != nil { + return nil, errors.Wrap(err, "can't create grpc client") + } + + resp, err := cli.LocalNodeInfo(ctx, req) + if err != nil { + return nil, errors.Wrap(err, "transport error") + } + + err = v2signature.VerifyServiceMessage(resp) + if err != nil { + return nil, errors.Wrap(err, "can't verify response message") + } + + return resp.GetBody().GetNodeInfo(), nil + default: + return nil, unsupportedProtocolErr + } +} + +func v2NetmapClientFromOptions(opts *clientOptions) (cli *netmap.Client, err error) { + switch { + case opts.grpcOpts.v2NetmapClient != nil: + // return value from client cache + return opts.grpcOpts.v2NetmapClient, nil + + case opts.grpcOpts.conn != nil: + cli, err = netmap.NewClient(netmap.WithGlobalOpts( + client.WithGRPCConn(opts.grpcOpts.conn)), + ) + + case opts.addr != "": + cli, err = netmap.NewClient(netmap.WithGlobalOpts( + client.WithNetworkAddress(opts.addr)), + ) + + default: + return nil, errors.New("lack of sdk client options to create accounting client") + } + + // check if client correct and save in cache + if err != nil { + return nil, err + } + + opts.grpcOpts.v2NetmapClient = cli + + return cli, nil +} diff --git a/pkg/client/opts.go b/pkg/client/opts.go index ec329f1..ff3546d 100644 --- a/pkg/client/opts.go +++ b/pkg/client/opts.go @@ -5,6 +5,7 @@ import ( "github.com/nspcc-dev/neofs-api-go/pkg/token" v2accounting "github.com/nspcc-dev/neofs-api-go/v2/accounting" v2container "github.com/nspcc-dev/neofs-api-go/v2/container" + v2netmap "github.com/nspcc-dev/neofs-api-go/v2/netmap" v2object "github.com/nspcc-dev/neofs-api-go/v2/object" "github.com/nspcc-dev/neofs-api-go/v2/refs" v2session "github.com/nspcc-dev/neofs-api-go/v2/session" @@ -44,6 +45,7 @@ type ( v2ContainerClient *v2container.Client v2AccountingClient *v2accounting.Client v2SessionClient *v2session.Client + v2NetmapClient *v2netmap.Client objectClientV2 *v2object.Client } From 7b3736567c0b1eddc2c2122e58854a12b239b33f Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Wed, 14 Oct 2020 20:06:05 +0300 Subject: [PATCH 0462/1196] [#169] sdk/client: Do not resign session token In some cases SDK Client provided with signed and prepared session token. In this case we don't need to change verb or sign it. Signed-off-by: Alex Vanin --- pkg/client/object.go | 9 ++++++++- pkg/token/session.go | 8 ++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/pkg/client/object.go b/pkg/client/object.go index 62fa701..1784af3 100644 --- a/pkg/client/object.go +++ b/pkg/client/object.go @@ -1006,7 +1006,14 @@ func (c Client) attachV2SessionToken(opts callOptions, hdr *v2session.RequestMet return nil } - token := opts.session.ToV2() + // Do not resign already prepared session token + if opts.session.Signature() != nil { + hdr.SetSessionToken(opts.session.ToV2()) + return nil + } + + token := new(v2session.SessionToken) + token.SetBody(opts.session.ToV2().GetBody()) opCtx := new(v2session.ObjectSessionContext) opCtx.SetAddress(info.addr) diff --git a/pkg/token/session.go b/pkg/token/session.go index 6ff3753..d9e1c47 100644 --- a/pkg/token/session.go +++ b/pkg/token/session.go @@ -1,6 +1,7 @@ package token import ( + "github.com/nspcc-dev/neofs-api-go/pkg" "github.com/nspcc-dev/neofs-api-go/pkg/owner" "github.com/nspcc-dev/neofs-api-go/v2/session" ) @@ -68,3 +69,10 @@ func (t *SessionToken) SetSessionKey(v []byte) { body.SetSessionKey(v) }) } + +func (t *SessionToken) Signature() *pkg.Signature { + return pkg.NewSignatureFromV2( + (*session.SessionToken)(t). + GetSignature(), + ) +} From 28260eb2ff0e3ba3b3bb19de1a6d51a9b0a12dcb Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Wed, 14 Oct 2020 22:00:39 +0300 Subject: [PATCH 0463/1196] [#147] Add constant error type closes #147 Signed-off-by: Evgeniy Kulikov --- internal/error.go | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 internal/error.go diff --git a/internal/error.go b/internal/error.go new file mode 100644 index 0000000..537c02c --- /dev/null +++ b/internal/error.go @@ -0,0 +1,9 @@ +package internal + +// Error is constant type error. +type Error string + +// Error implementation of error interface. +func (e Error) Error() string { + return string(e) +} From f5388b553ecc8f2493ea2bbc0cb7208aa3fd3a3d Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Wed, 14 Oct 2020 22:02:01 +0300 Subject: [PATCH 0464/1196] [#147] Work around container package - implement Stringer interface and Parse method for container.ID - increase test coverage closes #147 Signed-off-by: Evgeniy Kulikov --- pkg/container/id.go | 26 +++++++++++++++++++++++ pkg/container/id_test.go | 45 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+) diff --git a/pkg/container/id.go b/pkg/container/id.go index 795f644..2649def 100644 --- a/pkg/container/id.go +++ b/pkg/container/id.go @@ -4,12 +4,19 @@ import ( "bytes" "crypto/sha256" + "github.com/mr-tron/base58" + "github.com/nspcc-dev/neofs-api-go/internal" "github.com/nspcc-dev/neofs-api-go/v2/refs" + "github.com/pkg/errors" ) // ID represents v2-compatible container identifier. type ID refs.ContainerID +// ErrBadID should be returned when bytes slice isn't Container.ID size (sha256.Size). +// Notice: if byte slice changed, please, replace error message. +const ErrBadID = internal.Error("object.ID should be 32 bytes length") + // NewIDFromV2 wraps v2 ContainerID message to ID. func NewIDFromV2(idV2 *refs.ContainerID) *ID { return (*ID)(idV2) @@ -39,3 +46,22 @@ func (id *ID) Equal(id2 *ID) bool { (*refs.ContainerID)(id2).GetValue(), ) } + +// Parse converts base58 string representation into ID. +func (id *ID) Parse(s string) error { + data, err := base58.Decode(s) + if err != nil { + return errors.Wrap(err, "could not parse container.ID from string") + } else if len(data) != sha256.Size { + return ErrBadID + } + + (*refs.ContainerID)(id).SetValue(data) + + return nil +} + +// String returns base58 string representation of ID. +func (id *ID) String() string { + return base58.Encode((*refs.ContainerID)(id).GetValue()) +} diff --git a/pkg/container/id_test.go b/pkg/container/id_test.go index 3603771..3942a70 100644 --- a/pkg/container/id_test.go +++ b/pkg/container/id_test.go @@ -3,8 +3,10 @@ package container import ( "crypto/rand" "crypto/sha256" + "strconv" "testing" + "github.com/mr-tron/base58" "github.com/stretchr/testify/require" ) @@ -45,3 +47,46 @@ func TestID_Equal(t *testing.T) { require.True(t, id1.Equal(id2)) require.False(t, id1.Equal(id3)) } + +func TestID_Parse(t *testing.T) { + t.Run("should parse successful", func(t *testing.T) { + for i := 0; i < 10; i++ { + t.Run(strconv.Itoa(i), func(t *testing.T) { + cs := randSHA256Checksum(t) + str := base58.Encode(cs[:]) + cid := NewID() + + require.NoError(t, cid.Parse(str)) + require.Equal(t, cs[:], cid.ToV2().GetValue()) + }) + } + }) + + t.Run("should failure on parse", func(t *testing.T) { + for i := 0; i < 10; i++ { + j := i + t.Run(strconv.Itoa(j), func(t *testing.T) { + cs := []byte{1, 2, 3, 4, 5, byte(j)} + str := base58.Encode(cs) + cid := NewID() + + require.EqualError(t, cid.Parse(str), ErrBadID.Error()) + }) + } + }) +} + +func TestID_String(t *testing.T) { + t.Run("should be equal", func(t *testing.T) { + for i := 0; i < 10; i++ { + t.Run(strconv.Itoa(i), func(t *testing.T) { + cs := randSHA256Checksum(t) + str := base58.Encode(cs[:]) + cid := NewID() + + require.NoError(t, cid.Parse(str)) + require.Equal(t, str, cid.String()) + }) + } + }) +} From f5b442fe3bf0b649e2b7409f679ceacc0bd34d9c Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Wed, 14 Oct 2020 22:03:49 +0300 Subject: [PATCH 0465/1196] [#147] Work around object package - implement Stringer interface and Parse method for object.ID - increase test coverage closes #147 Signed-off-by: Evgeniy Kulikov --- pkg/object/id.go | 26 +++++++++++++++++++++++++ pkg/object/id_test.go | 45 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+) diff --git a/pkg/object/id.go b/pkg/object/id.go index 4eefbf5..1fcb595 100644 --- a/pkg/object/id.go +++ b/pkg/object/id.go @@ -4,12 +4,19 @@ import ( "bytes" "crypto/sha256" + "github.com/mr-tron/base58" + "github.com/nspcc-dev/neofs-api-go/internal" "github.com/nspcc-dev/neofs-api-go/v2/refs" + "github.com/pkg/errors" ) // ID represents v2-compatible object identifier. type ID refs.ObjectID +// ErrBadID should be returned when bytes slice hasn't sha256.Size +// Notice: if byte slice changed, please, replace error message. +const ErrBadID = internal.Error("object.ID should be 32 bytes length") + // NewIDFromV2 wraps v2 ObjectID message to ID. func NewIDFromV2(idV2 *refs.ObjectID) *ID { return (*ID)(idV2) @@ -39,3 +46,22 @@ func (id *ID) Equal(id2 *ID) bool { func (id *ID) ToV2() *refs.ObjectID { return (*refs.ObjectID)(id) } + +// Parse converts base58 string representation into ID. +func (id *ID) Parse(s string) error { + data, err := base58.Decode(s) + if err != nil { + return errors.Wrap(err, "could not parse object.ID from string") + } else if len(data) != sha256.Size { + return ErrBadID + } + + (*refs.ObjectID)(id).SetValue(data) + + return nil +} + +// String returns base58 string representation of ID. +func (id *ID) String() string { + return base58.Encode((*refs.ObjectID)(id).GetValue()) +} diff --git a/pkg/object/id_test.go b/pkg/object/id_test.go index 373fa01..e56ff96 100644 --- a/pkg/object/id_test.go +++ b/pkg/object/id_test.go @@ -3,8 +3,10 @@ package object import ( "crypto/rand" "crypto/sha256" + "strconv" "testing" + "github.com/mr-tron/base58" "github.com/stretchr/testify/require" ) @@ -38,3 +40,46 @@ func TestID_Equal(t *testing.T) { require.True(t, id1.Equal(id2)) require.False(t, id1.Equal(id3)) } + +func TestID_Parse(t *testing.T) { + t.Run("should parse successful", func(t *testing.T) { + for i := 0; i < 10; i++ { + t.Run(strconv.Itoa(i), func(t *testing.T) { + cs := randSHA256Checksum(t) + str := base58.Encode(cs[:]) + oid := NewID() + + require.NoError(t, oid.Parse(str)) + require.Equal(t, cs[:], oid.ToV2().GetValue()) + }) + } + }) + + t.Run("should failure on parse", func(t *testing.T) { + for i := 0; i < 10; i++ { + j := i + t.Run(strconv.Itoa(j), func(t *testing.T) { + cs := []byte{1, 2, 3, 4, 5, byte(j)} + str := base58.Encode(cs) + oid := NewID() + + require.EqualError(t, oid.Parse(str), ErrBadID.Error()) + }) + } + }) +} + +func TestID_String(t *testing.T) { + t.Run("should be equal", func(t *testing.T) { + for i := 0; i < 10; i++ { + t.Run(strconv.Itoa(i), func(t *testing.T) { + cs := randSHA256Checksum(t) + str := base58.Encode(cs[:]) + oid := NewID() + + require.NoError(t, oid.Parse(str)) + require.Equal(t, str, oid.String()) + }) + } + }) +} From 20273357f68162d661574460a7fef29eabcaa141 Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Wed, 14 Oct 2020 22:08:27 +0300 Subject: [PATCH 0466/1196] [#147] Work around object package - implement Stringer interface and Parse method for object.Address - increase test coverage closes #147 Signed-off-by: Evgeniy Kulikov --- pkg/object/address.go | 43 ++++++++++++++++++++++++++++++++++++++ pkg/object/address_test.go | 33 +++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+) diff --git a/pkg/object/address.go b/pkg/object/address.go index 0c50e4f..a1c2475 100644 --- a/pkg/object/address.go +++ b/pkg/object/address.go @@ -1,6 +1,9 @@ package object import ( + "strings" + + "github.com/nspcc-dev/neofs-api-go/internal" "github.com/nspcc-dev/neofs-api-go/pkg/container" "github.com/nspcc-dev/neofs-api-go/v2/refs" "github.com/pkg/errors" @@ -9,6 +12,15 @@ import ( // Address represents v2-compatible object address. type Address refs.Address +// ErrBadAddress returns when string representation doesn't +// contains Container.ID and Object.ID separated by `/`. +const ErrBadAddress = internal.Error("address should contains container.ID and object.ID separated with `/`") + +const ( + addressParts = 2 + addressSeparator = "/" +) + // NewAddressFromV2 converts v2 Address message to Address. func NewAddressFromV2(aV2 *refs.Address) *Address { return (*Address)(aV2) @@ -59,3 +71,34 @@ func (a *Address) GetObjectID() *ID { func (a *Address) SetObjectID(id *ID) { (*refs.Address)(a).SetObjectID(id.ToV2()) } + +// Parse converts base58 string representation into Address. +func (a *Address) Parse(s string) error { + var ( + err error + oid = NewID() + cid = container.NewID() + parts = strings.Split(s, addressSeparator) + ) + + if len(parts) != addressParts { + return ErrBadAddress + } else if err = cid.Parse(parts[0]); err != nil { + return err + } else if err = oid.Parse(parts[1]); err != nil { + return err + } + + a.SetObjectID(oid) + a.SetContainerID(cid) + + return nil +} + +// String returns string representation of Object.Address. +func (a *Address) String() string { + return strings.Join([]string{ + a.GetContainerID().String(), + a.GetObjectID().String(), + }, addressSeparator) +} diff --git a/pkg/object/address_test.go b/pkg/object/address_test.go index d286ed4..5b4ae1b 100644 --- a/pkg/object/address_test.go +++ b/pkg/object/address_test.go @@ -1,6 +1,7 @@ package object import ( + "strings" "testing" "github.com/nspcc-dev/neofs-api-go/pkg/container" @@ -27,3 +28,35 @@ func TestAddress_SetObjectID(t *testing.T) { require.Equal(t, oid, a.GetObjectID()) } + +func TestAddress_Parse(t *testing.T) { + cid := container.NewID() + cid.SetSHA256(randSHA256Checksum(t)) + + oid := NewID() + oid.SetSHA256(randSHA256Checksum(t)) + + t.Run("should parse successful", func(t *testing.T) { + s := strings.Join([]string{cid.String(), oid.String()}, addressSeparator) + a := NewAddress() + + require.NoError(t, a.Parse(s)) + require.Equal(t, oid, a.GetObjectID()) + require.Equal(t, cid, a.GetContainerID()) + }) + + t.Run("should fail for bad address", func(t *testing.T) { + s := strings.Join([]string{cid.String()}, addressSeparator) + require.EqualError(t, NewAddress().Parse(s), ErrBadAddress.Error()) + }) + + t.Run("should fail on container.ID", func(t *testing.T) { + s := strings.Join([]string{"1", "2"}, addressSeparator) + require.EqualError(t, NewAddress().Parse(s), container.ErrBadID.Error()) + }) + + t.Run("should fail on object.ID", func(t *testing.T) { + s := strings.Join([]string{cid.String(), "2"}, addressSeparator) + require.EqualError(t, NewAddress().Parse(s), ErrBadID.Error()) + }) +} From e2d8f408d8c6e9bbd2e5b315ff0b29bc420e75db Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Wed, 14 Oct 2020 22:09:13 +0300 Subject: [PATCH 0467/1196] [#147] Work around owner package Add NEO3WalletSize as constant value. closes #147 Signed-off-by: Evgeniy Kulikov --- pkg/owner/wallet.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/owner/wallet.go b/pkg/owner/wallet.go index 80fb889..8777cde 100644 --- a/pkg/owner/wallet.go +++ b/pkg/owner/wallet.go @@ -10,7 +10,10 @@ import ( ) // NEO3Wallet represents NEO3 wallet address. -type NEO3Wallet [25]byte +type NEO3Wallet [NEO3WalletSize]byte + +// NEO3WalletSize contains size of neo3 wallet. +const NEO3WalletSize = 25 // NEO3WalletFromPublicKey converts public key to NEO3 wallet address. func NEO3WalletFromPublicKey(key *ecdsa.PublicKey) (*NEO3Wallet, error) { From 4e6350f6d4387c0ae2e503f71c94d2ca39977b8e Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Wed, 14 Oct 2020 22:10:34 +0300 Subject: [PATCH 0468/1196] [#147] Work around owner package - implement Stringer interface and Parse method for owner.ID - increase test coverage closes #147 Signed-off-by: Evgeniy Kulikov --- pkg/owner/id.go | 20 ++++++++++++++++++++ pkg/owner/id_test.go | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+) diff --git a/pkg/owner/id.go b/pkg/owner/id.go index 4862b67..08971e8 100644 --- a/pkg/owner/id.go +++ b/pkg/owner/id.go @@ -3,12 +3,18 @@ package owner import ( "github.com/mr-tron/base58" "github.com/nspcc-dev/neo-go/pkg/encoding/address" + "github.com/nspcc-dev/neofs-api-go/internal" "github.com/nspcc-dev/neofs-api-go/v2/refs" + "github.com/pkg/errors" ) // ID represents v2-compatible owner identifier. type ID refs.OwnerID +// ErrBadID should be returned when bytes slice isn't Owner.ID size (NEO3WalletSize). +// Notice: if byte slice changed, please, replace error message. +const ErrBadID = internal.Error("owner.ID should be 25 bytes length") + // NewIDFromV2 wraps v2 OwnerID message to ID. func NewIDFromV2(idV2 *refs.OwnerID) *ID { return (*ID)(idV2) @@ -51,3 +57,17 @@ func NewIDFromNeo3Wallet(v *NEO3Wallet) *ID { return id } + +// Parse converts base58 string representation into ID. +func (id *ID) Parse(s string) error { + data, err := base58.Decode(s) + if err != nil { + return errors.Wrap(err, "could not parse owner.ID from string") + } else if len(data) != NEO3WalletSize { + return ErrBadID + } + + (*refs.OwnerID)(id).SetValue(data) + + return nil +} diff --git a/pkg/owner/id_test.go b/pkg/owner/id_test.go index 581d9f2..a36324f 100644 --- a/pkg/owner/id_test.go +++ b/pkg/owner/id_test.go @@ -2,8 +2,10 @@ package owner import ( "crypto/rand" + "strconv" "testing" + "github.com/mr-tron/base58" "github.com/nspcc-dev/neofs-crypto/test" "github.com/stretchr/testify/require" ) @@ -30,3 +32,34 @@ func TestNewIDFromNeo3Wallet(t *testing.T) { id := NewIDFromNeo3Wallet(wallet) require.Equal(t, id.ToV2().GetValue(), wallet.Bytes()) } + +func TestID_Parse(t *testing.T) { + t.Run("should parse successful", func(t *testing.T) { + for i := 0; i < 10; i++ { + j := i + t.Run(strconv.Itoa(j), func(t *testing.T) { + wallet, err := NEO3WalletFromPublicKey(&test.DecodeKey(j).PublicKey) + require.NoError(t, err) + + eid := NewIDFromNeo3Wallet(wallet) + aid := NewID() + + require.NoError(t, aid.Parse(eid.String())) + require.Equal(t, eid, aid) + }) + } + }) + + t.Run("should failure on parse", func(t *testing.T) { + for i := 0; i < 10; i++ { + j := i + t.Run(strconv.Itoa(j), func(t *testing.T) { + cs := []byte{1, 2, 3, 4, 5, byte(j)} + str := base58.Encode(cs) + cid := NewID() + + require.EqualError(t, cid.Parse(str), ErrBadID.Error()) + }) + } + }) +} From 6a69a896e5970bd92786a00c60b897664dcbffb1 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Tue, 20 Oct 2020 11:31:45 +0300 Subject: [PATCH 0469/1196] [#174] netmap: process unspecified attribute as ID When selector attribute is provided it should be silently replaced by transparent ID, so each node resides in a separate bucket. Signed-off-by: Evgenii Stratonikov --- pkg/netmap/selector.go | 56 ++++++++++++++++++++++++++----------- pkg/netmap/selector_test.go | 22 +++++++++++++++ 2 files changed, 61 insertions(+), 17 deletions(-) diff --git a/pkg/netmap/selector.go b/pkg/netmap/selector.go index 73a0669..30985ac 100644 --- a/pkg/netmap/selector.go +++ b/pkg/netmap/selector.go @@ -43,23 +43,27 @@ func GetNodesCount(p *netmap.PlacementPolicy, s *netmap.Selector) (int, int) { // getSelection returns nodes grouped by s.attribute. func (c *Context) getSelection(p *netmap.PlacementPolicy, s *netmap.Selector) ([]Nodes, error) { bucketCount, nodesInBucket := GetNodesCount(p, s) - m := c.getSelectionBase(s) - if len(m) < bucketCount { + buckets := c.getSelectionBase(s) + if len(buckets) < bucketCount { return nil, fmt.Errorf("%w: '%s'", ErrNotEnoughNodes, s.GetName()) } - keys := make(sort.StringSlice, 0, len(m)) - for k := range m { - keys = append(keys, k) - } if len(c.pivot) == 0 { - // deterministic order in case of zero seed - keys.Sort() + // Deterministic order in case of zero seed. + if s.GetAttribute() == "" { + sort.Slice(buckets, func(i, j int) bool { + return buckets[i].nodes[0].ID < buckets[j].nodes[0].ID + }) + } else { + sort.Slice(buckets, func(i, j int) bool { + return buckets[i].attr < buckets[j].attr + }) + } } - nodes := make([]Nodes, 0, len(m)) - for i := range keys { - ns := m[keys[i]] + nodes := make([]Nodes, 0, len(buckets)) + for i := range buckets { + ns := buckets[i].nodes if len(ns) >= nodesInBucket { nodes = append(nodes, ns[:nodesInBucket]) } @@ -77,21 +81,39 @@ func (c *Context) getSelection(p *netmap.PlacementPolicy, s *netmap.Selector) ([ return nodes[:bucketCount], nil } +type nodeAttrPair struct { + attr string + nodes Nodes +} + // getSelectionBase returns nodes grouped by selector attribute. -func (c *Context) getSelectionBase(s *netmap.Selector) map[string]Nodes { +// It it guaranteed that each pair will contain at least one node. +func (c *Context) getSelectionBase(s *netmap.Selector) []nodeAttrPair { f := c.Filters[s.GetFilter()] isMain := s.GetFilter() == MainFilterName - result := map[string]Nodes{} + result := []nodeAttrPair{} + nodeMap := map[string]Nodes{} + attr := s.GetAttribute() for i := range c.Netmap.Nodes { if isMain || c.match(f, c.Netmap.Nodes[i]) { - v := c.Netmap.Nodes[i].Attribute(s.GetAttribute()) - result[v] = append(result[v], c.Netmap.Nodes[i]) + if attr == "" { + // Default attribute is transparent identifier which is different for every node. + result = append(result, nodeAttrPair{attr: "", nodes: Nodes{c.Netmap.Nodes[i]}}) + } else { + v := c.Netmap.Nodes[i].Attribute(attr) + nodeMap[v] = append(nodeMap[v], c.Netmap.Nodes[i]) + } + } + } + if attr != "" { + for k, ns := range nodeMap { + result = append(result, nodeAttrPair{attr: k, nodes: ns}) } } if len(c.pivot) != 0 { - for _, ns := range result { - hrw.SortSliceByWeightValue(ns, ns.Weights(c.weightFunc), c.pivotHash) + for i := range result { + hrw.SortSliceByWeightValue(result[i].nodes, result[i].nodes.Weights(c.weightFunc), c.pivotHash) } } return result diff --git a/pkg/netmap/selector_test.go b/pkg/netmap/selector_test.go index 79f363e..cf581d0 100644 --- a/pkg/netmap/selector_test.go +++ b/pkg/netmap/selector_test.go @@ -9,6 +9,28 @@ import ( "github.com/stretchr/testify/require" ) +func TestPlacementPolicy_UnspecifiedClause(t *testing.T) { + p := newPlacementPolicy(1, + []*netmap.Replica{newReplica(1, "X")}, + []*netmap.Selector{ + newSelector("X", "", netmap.Distinct, 4, "*"), + }, + nil, + ) + nodes := []netmap.NodeInfo{ + nodeInfoFromAttributes("ID", "1", "Country", "RU", "City", "St.Petersburg", "SSD", "0"), + nodeInfoFromAttributes("ID", "2", "Country", "RU", "City", "St.Petersburg", "SSD", "1"), + nodeInfoFromAttributes("ID", "3", "Country", "RU", "City", "Moscow", "SSD", "1"), + nodeInfoFromAttributes("ID", "4", "Country", "RU", "City", "Moscow", "SSD", "1"), + } + + nm, err := NewNetmap(NodesFromV2(nodes)) + require.NoError(t, err) + v, err := nm.GetContainerNodes(p, nil) + require.NoError(t, err) + require.Equal(t, 4, len(v.Flatten())) +} + func TestPlacementPolicy_GetPlacementVectors(t *testing.T) { p := newPlacementPolicy(2, []*netmap.Replica{ From 80b70336067a67ba7972cdc9b57d7b78c4b152a9 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Mon, 19 Oct 2020 15:34:51 +0300 Subject: [PATCH 0470/1196] [#172] Update neofs-api with rich docs and JSON attributes Signed-off-by: Alex Vanin --- v2/accounting/grpc/service.pb.go | 38 ++-- v2/accounting/grpc/types.pb.go | 13 +- v2/acl/grpc/types.pb.go | 242 +++++++++++----------- v2/container/grpc/service.pb.go | 185 +++++++++-------- v2/container/grpc/types.pb.go | 90 +++++---- v2/netmap/grpc/service.pb.go | 34 ++-- v2/netmap/grpc/types.pb.go | 81 ++++++-- v2/object/grpc/service.pb.go | 331 ++++++++++++++++--------------- v2/object/grpc/types.pb.go | 167 ++++++++-------- v2/refs/grpc/types.pb.go | 104 +++++----- v2/session/grpc/service.pb.go | 33 +-- v2/session/grpc/types.pb.go | 171 ++++++++-------- v2/storagegroup/grpc/types.pb.go | 22 +- 13 files changed, 819 insertions(+), 692 deletions(-) diff --git a/v2/accounting/grpc/service.pb.go b/v2/accounting/grpc/service.pb.go index 34d15ac..d13be13 100644 --- a/v2/accounting/grpc/service.pb.go +++ b/v2/accounting/grpc/service.pb.go @@ -28,13 +28,7 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package -// Message defines the request body of Balance method. -// -// To indicate the account for which the balance is requested, it's identifier -// is used. -// -// To gain access to the requested information, the request body must be formed -// according to the requirements from the system specification. +// BalanceRequest message type BalanceRequest struct { // Body of the balance request message. Body *BalanceRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` @@ -42,8 +36,8 @@ type BalanceRequest struct { // message transport and does not affect request execution. MetaHeader *grpc.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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. + // 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,proto3" json:"verify_header,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -104,10 +98,13 @@ func (m *BalanceRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { return nil } -//Request body +// To indicate the account for which the balance is requested, it's identifier +// is used. It can be any existing account in NeoFS sidechain `Balance` smart +// contract. If omitted, client implementation MUST set it to the request's +// signer `OwnerID`. type BalanceRequest_Body struct { - // Carries user identifier in NeoFS system for which the balance - // is requested. + // 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,proto3" json:"owner_id,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -154,9 +151,7 @@ func (m *BalanceRequest_Body) GetOwnerId() *grpc1.OwnerID { return nil } -// Message defines the response body of Balance method. -// -// The amount of funds is calculated in decimal numbers. +// BalanceResponse message type BalanceResponse struct { // Body of the balance response message. Body *BalanceResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` @@ -164,8 +159,8 @@ type BalanceResponse struct { // message transport and does not affect request execution. MetaHeader *grpc.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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. + // 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,proto3" json:"verify_header,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -226,9 +221,10 @@ func (m *BalanceResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { return nil } -//Request body +// The amount of funds in GAS token for the `OwnerID`'s account requested. +// Balance is `Decimal` format to avoid precision issues with rounding. type BalanceResponse_Body struct { - // Carries the amount of funds on the account. + // Amount of funds in GAS token for the requested account. Balance *Decimal `protobuf:"bytes,1,opt,name=balance,proto3" json:"balance,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -328,7 +324,7 @@ const _ = grpc2.SupportPackageIsVersion4 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type AccountingServiceClient interface { - // Returns the amount of funds for the requested NeoFS account. + // Returns the amount of funds in GAS token for the requested NeoFS account. Balance(ctx context.Context, in *BalanceRequest, opts ...grpc2.CallOption) (*BalanceResponse, error) } @@ -351,7 +347,7 @@ func (c *accountingServiceClient) Balance(ctx context.Context, in *BalanceReques // AccountingServiceServer is the server API for AccountingService service. type AccountingServiceServer interface { - // Returns the amount of funds for the requested NeoFS account. + // Returns the amount of funds in GAS token for the requested NeoFS account. Balance(context.Context, *BalanceRequest) (*BalanceResponse, error) } diff --git a/v2/accounting/grpc/types.pb.go b/v2/accounting/grpc/types.pb.go index cc84e87..7de8bd8 100644 --- a/v2/accounting/grpc/types.pb.go +++ b/v2/accounting/grpc/types.pb.go @@ -22,11 +22,18 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package -// Decimal represents the decimal numbers. +// Standard floating point data type can't be used in NeoFS 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 { - // value carries number value. + // Number in smallest Token fractions. Value int64 `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"` - // precision carries value precision. + // Precision value indicating how many smallest fractions can be in one + // integer. Precision uint32 `protobuf:"varint,2,opt,name=precision,proto3" json:"precision,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` diff --git a/v2/acl/grpc/types.pb.go b/v2/acl/grpc/types.pb.go index 5b4422e..81467b2 100644 --- a/v2/acl/grpc/types.pb.go +++ b/v2/acl/grpc/types.pb.go @@ -27,14 +27,14 @@ const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package type Role int32 const ( - // Unspecified role, default value. + // Unspecified role, default value Role_ROLE_UNSPECIFIED Role = 0 - // User target rule is applied if sender is the owner of the container. + // User target rule is applied if sender is the owner of the container Role_USER Role = 1 // System target rule is applied if sender is the storage node within the - // container or inner ring node. + // container or inner ring node Role_SYSTEM Role = 2 - // Others target rule is applied if sender is not user or system target. + // Others target rule is applied if sender is not user nor system target Role_OTHERS Role = 3 ) @@ -92,11 +92,12 @@ func (MatchType) EnumDescriptor() ([]byte, []int) { return fileDescriptor_8233b6696fb3e24f, []int{1} } -// Operation is an enumeration of operation types. +// Request's operation type to match if the rule is applicable to a particular +// request. type Operation int32 const ( - // Unspecified operation, default value. + // Unspecified operation, default value Operation_OPERATION_UNSPECIFIED Operation = 0 // Get Operation_GET Operation = 1 @@ -144,11 +145,12 @@ func (Operation) EnumDescriptor() ([]byte, []int) { return fileDescriptor_8233b6696fb3e24f, []int{2} } -// Action is an enumeration of EACL actions. +// Rule execution result action. Either allows or denies access if the rule's +// filters match. type Action int32 const ( - // Unspecified action, default value. + // Unspecified action, default value Action_ACTION_UNSPECIFIED Action = 0 // Allow action Action_ALLOW Action = 1 @@ -176,7 +178,7 @@ func (Action) EnumDescriptor() ([]byte, []int) { return fileDescriptor_8233b6696fb3e24f, []int{3} } -// Header is an enumeration of filtering header types. +// Enumeration of possible sources of Headers to apply filters. type HeaderType int32 const ( @@ -208,16 +210,16 @@ func (HeaderType) EnumDescriptor() ([]byte, []int) { return fileDescriptor_8233b6696fb3e24f, []int{4} } -// EACLRecord groups information about extended ACL rule. +// Describes a single eACL rule. type EACLRecord struct { - // Operation carries type of operation. - Operation Operation `protobuf:"varint,1,opt,name=operation,json=Operation,proto3,enum=neo.fs.v2.acl.Operation" json:"operation,omitempty"` - // Action carries ACL target action. - Action Action `protobuf:"varint,2,opt,name=action,json=Action,proto3,enum=neo.fs.v2.acl.Action" json:"action,omitempty"` - // filters carries set of filters. - Filters []*EACLRecord_Filter `protobuf:"bytes,3,rep,name=filters,json=Filters,proto3" json:"filters,omitempty"` - // targets carries information about extended ACL target list. - Targets []*EACLRecord_Target `protobuf:"bytes,4,rep,name=targets,json=Targets,proto3" json:"targets,omitempty"` + // NeoFS request Verb to match + Operation Operation `protobuf:"varint,1,opt,name=operation,proto3,enum=neo.fs.v2.acl.Operation" json:"operation,omitempty"` + // Rule execution result. Either allows or denies access if filters match. + Action Action `protobuf:"varint,2,opt,name=action,proto3,enum=neo.fs.v2.acl.Action" json:"action,omitempty"` + // List of filters to match and see if rule is applicable + Filters []*EACLRecord_Filter `protobuf:"bytes,3,rep,name=filters,proto3" json:"filters,omitempty"` + // List of target subjects to apply ACL rule to + Targets []*EACLRecord_Target `protobuf:"bytes,4,rep,name=targets,proto3" json:"targets,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -284,16 +286,16 @@ func (m *EACLRecord) GetTargets() []*EACLRecord_Target { return nil } -// Filter definition +// Filter to check particular properties of the request or object. type EACLRecord_Filter struct { - // Header carries type of header. - HeaderType HeaderType `protobuf:"varint,1,opt,name=header_type,json=HeaderType,proto3,enum=neo.fs.v2.acl.HeaderType" json:"header_type,omitempty"` - // MatchType carries type of match. - MatchType MatchType `protobuf:"varint,2,opt,name=match_type,json=MatchType,proto3,enum=neo.fs.v2.acl.MatchType" json:"match_type,omitempty"` - // header_name carries name of filtering header. - HeaderName string `protobuf:"bytes,3,opt,name=header_name,json=Name,proto3" json:"header_name,omitempty"` - // header_val carries value of filtering header. - HeaderVal string `protobuf:"bytes,4,opt,name=header_val,json=Value,proto3" json:"header_val,omitempty"` + // Define if Object or Request header will be used + HeaderType HeaderType `protobuf:"varint,1,opt,name=header_type,json=headerType,proto3,enum=neo.fs.v2.acl.HeaderType" json:"header_type,omitempty"` + // Match operation type + MatchType MatchType `protobuf:"varint,2,opt,name=match_type,json=matchType,proto3,enum=neo.fs.v2.acl.MatchType" json:"match_type,omitempty"` + // Name of the Header to use + HeaderName string `protobuf:"bytes,3,opt,name=header_name,json=headerName,proto3" json:"header_name,omitempty"` + // Expected Header Value or pattern to match + HeaderVal string `protobuf:"bytes,4,opt,name=header_val,json=value,proto3" json:"header_val,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -360,12 +362,13 @@ func (m *EACLRecord_Filter) GetHeaderVal() string { return "" } -// Information about extended ACL target. +// Target to apply ACL rule. Can be a subject's role class or a list of public +// keys to match. type EACLRecord_Target struct { - // target carries target of ACL rule. - Role Role `protobuf:"varint,1,opt,name=role,json=Role,proto3,enum=neo.fs.v2.acl.Role" json:"role,omitempty"` - // key_list carries public keys of ACL target. - KeyList [][]byte `protobuf:"bytes,2,rep,name=key_list,json=Keys,proto3" json:"key_list,omitempty"` + // Target subject's role class + Role Role `protobuf:"varint,1,opt,name=role,proto3,enum=neo.fs.v2.acl.Role" json:"role,omitempty"` + // List of public keys to identify target subject + Keys [][]byte `protobuf:"bytes,2,rep,name=keys,proto3" json:"keys,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -411,23 +414,25 @@ func (m *EACLRecord_Target) GetRole() Role { return Role_ROLE_UNSPECIFIED } -func (m *EACLRecord_Target) GetKeyList() [][]byte { +func (m *EACLRecord_Target) GetKeys() [][]byte { if m != nil { - return m.KeyList + return m.Keys } return nil } -// EACLRecord carries the information about extended ACL rules. +// Extended ACL rules table. Defined a list of ACL rules additionally to Basic +// ACL. Extended ACL rules can be attached to the container and can be updated +// or may be defined in `BearerToken` structure. Please see the corresponding +// NeoFS Technical Specification's section for detailed description. type EACLTable struct { - // eACL format version. - // Effectively the version of API library used to create eACL Table + // eACL format version. Effectively the version of API library used to create + // eACL Table. Version *grpc.Version `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` - // Carries identifier of the container that should use given - // access control rules. - ContainerId *grpc.ContainerID `protobuf:"bytes,2,opt,name=container_id,json=ContainerID,proto3" json:"container_id,omitempty"` - // Records carries list of extended ACL rule records. - Records []*EACLRecord `protobuf:"bytes,3,rep,name=records,json=Records,proto3" json:"records,omitempty"` + // Identifier of the container that should use given access control rules + ContainerId *grpc.ContainerID `protobuf:"bytes,2,opt,name=container_id,json=containerID,proto3" json:"container_id,omitempty"` + // List of Extended ACL rules + Records []*EACLRecord `protobuf:"bytes,3,rep,name=records,proto3" json:"records,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -487,7 +492,12 @@ func (m *EACLTable) GetRecords() []*EACLRecord { return nil } -// BearerToken has information about request ACL rules with limited lifetime +// BearerToken allows to attach signed Extended ACL rules to the request in +// `RequestMetaHeader`. If container's Basic ACL rules allow, the attached rule +// set will be checked instead of one attached to the container itself. Just +// like [JWT](https://jwt.io), it has a limited lifetime and scope, hence can be +// used in the similar use cases, like providing authorisation to externally +// authenticated party. type BearerToken struct { // Bearer Token body Body *BearerToken_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` @@ -545,12 +555,15 @@ func (m *BearerToken) GetSignature() *grpc.Signature { return nil } -// Bearer Token body +// Bearer Token body structure contains Extended ACL table issued by container +// owner with additional information preventing token's abuse. type BearerToken_Body struct { - // EACLTable carries table of extended ACL rules + // Table of Extended ACL rules to use instead of the ones attached to the + // container EaclTable *EACLTable `protobuf:"bytes,1,opt,name=eacl_table,json=eaclTable,proto3" json:"eacl_table,omitempty"` - // OwnerID carries identifier of the token owner - OwnerId *grpc.OwnerID `protobuf:"bytes,2,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"` + // `OwnerID` to whom the token was issued. MUST match with the request + // originator's `OwnerID` + OwnerId *grpc.OwnerID `protobuf:"bytes,2,opt,name=owner_id,json=ownerID,proto3" json:"owner_id,omitempty"` // Token expiration and valid time period parameters Lifetime *BearerToken_Body_TokenLifetime `protobuf:"bytes,3,opt,name=lifetime,proto3" json:"lifetime,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` @@ -612,7 +625,8 @@ func (m *BearerToken_Body) GetLifetime() *BearerToken_Body_TokenLifetime { return nil } -// Lifetime parameters of the token. Filed names taken from rfc7519. +// Lifetime parameters of the token. Filed names taken from +// [rfc7519](https://tools.ietf.org/html/rfc7519). type BearerToken_Body_TokenLifetime struct { // Expiration Epoch Exp uint64 `protobuf:"varint,1,opt,name=exp,proto3" json:"exp,omitempty"` @@ -697,62 +711,62 @@ func init() { func init() { proto.RegisterFile("v2/acl/grpc/types.proto", fileDescriptor_8233b6696fb3e24f) } var fileDescriptor_8233b6696fb3e24f = []byte{ - // 869 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x55, 0xdd, 0x6e, 0xe2, 0x46, - 0x14, 0x5e, 0xff, 0x04, 0xc3, 0x21, 0x5b, 0x59, 0xd3, 0x6e, 0x16, 0xa8, 0x94, 0xa2, 0xdc, 0x34, - 0x42, 0xc2, 0x68, 0x89, 0xda, 0x95, 0xb6, 0xea, 0x4a, 0x06, 0x26, 0x81, 0x96, 0x60, 0x76, 0x6c, - 0x52, 0xa5, 0x37, 0x68, 0x30, 0x03, 0xb1, 0xd6, 0xb1, 0x91, 0xed, 0xb0, 0xa5, 0xb7, 0x55, 0xdf, - 0xa1, 0xcf, 0xd0, 0xdb, 0x7d, 0x89, 0x5e, 0xf6, 0x11, 0xaa, 0xf4, 0xb6, 0x0f, 0x51, 0xcd, 0x18, - 0x27, 0xc4, 0x9b, 0xd5, 0xde, 0x30, 0xc7, 0x73, 0xbe, 0xef, 0x9c, 0xef, 0x7c, 0x33, 0xd8, 0xf0, - 0x7c, 0xdd, 0x6e, 0x51, 0xd7, 0x6f, 0x2d, 0xa3, 0x95, 0xdb, 0x4a, 0x36, 0x2b, 0x16, 0x1b, 0xab, - 0x28, 0x4c, 0x42, 0xf4, 0x34, 0x60, 0xa1, 0xb1, 0x88, 0x8d, 0x75, 0xdb, 0xa0, 0xae, 0x5f, 0xab, - 0xac, 0xdb, 0xad, 0x88, 0x2d, 0xe2, 0x0f, 0x80, 0x47, 0xff, 0x29, 0x00, 0xd8, 0xec, 0x0e, 0x09, - 0x73, 0xc3, 0x68, 0x8e, 0xbe, 0x85, 0x52, 0xb8, 0x62, 0x11, 0x4d, 0xbc, 0x30, 0xa8, 0x48, 0x75, - 0xe9, 0xf8, 0xb3, 0x76, 0xc5, 0x78, 0x50, 0xcb, 0xb0, 0xb2, 0x3c, 0x29, 0xdd, 0x85, 0xa8, 0x09, - 0x05, 0xea, 0x0a, 0x92, 0x2c, 0x48, 0xcf, 0x72, 0x24, 0x53, 0x24, 0x49, 0x21, 0x5d, 0xd1, 0x2b, - 0xd0, 0x16, 0x9e, 0x9f, 0xb0, 0x28, 0xae, 0x28, 0x75, 0xe5, 0xb8, 0xdc, 0xae, 0xe7, 0xf0, 0xf7, - 0x92, 0x8c, 0x53, 0x01, 0x24, 0x5a, 0xba, 0xc6, 0x9c, 0x9b, 0xd0, 0x68, 0xc9, 0x92, 0xb8, 0xa2, - 0x7e, 0x8a, 0xeb, 0x08, 0x20, 0xd1, 0xd2, 0x35, 0xae, 0xbd, 0x97, 0xa0, 0x90, 0xd6, 0x41, 0xaf, - 0xa0, 0x7c, 0xc5, 0xe8, 0x9c, 0x45, 0x53, 0x6e, 0xc7, 0x76, 0xd6, 0x6a, 0xae, 0x54, 0x5f, 0x20, - 0x9c, 0xcd, 0x8a, 0x11, 0xb8, 0x8f, 0xd1, 0x4b, 0x80, 0x6b, 0x9a, 0xb8, 0x57, 0x29, 0x55, 0x7e, - 0xd4, 0xa6, 0x73, 0x0e, 0x10, 0xcc, 0xd2, 0x5d, 0x88, 0xaa, 0x77, 0x4d, 0x03, 0x7a, 0xcd, 0x2a, - 0x4a, 0x5d, 0x3a, 0x2e, 0x11, 0x75, 0x44, 0xaf, 0x79, 0x0a, 0xb6, 0xa9, 0x35, 0xf5, 0x2b, 0xaa, - 0xc8, 0xec, 0x5d, 0x50, 0xff, 0x86, 0xd5, 0x06, 0x50, 0x48, 0x07, 0x40, 0x5f, 0x83, 0x1a, 0x85, - 0x7e, 0xa6, 0xf6, 0xf3, 0x5c, 0x4b, 0x12, 0xfa, 0x8c, 0xa8, 0xfc, 0x17, 0x1d, 0x40, 0xf1, 0x2d, - 0xdb, 0x4c, 0x7d, 0x2f, 0x4e, 0x2a, 0x72, 0x5d, 0x39, 0xde, 0x27, 0xea, 0x8f, 0x6c, 0x13, 0x1f, - 0xbd, 0x97, 0xa0, 0xc4, 0xfd, 0x71, 0xe8, 0xcc, 0x67, 0xe8, 0x05, 0x68, 0x6b, 0x16, 0xc5, 0xd9, - 0x59, 0x97, 0xdb, 0xcf, 0x77, 0x2a, 0xf2, 0xfb, 0x62, 0x5c, 0xa4, 0x69, 0x92, 0xe1, 0xd0, 0x6b, - 0xd8, 0x77, 0xc3, 0x20, 0xa1, 0x5e, 0xc0, 0xa2, 0xa9, 0x37, 0x17, 0xc3, 0x97, 0xdb, 0x5f, 0xe6, - 0x79, 0xdd, 0x0c, 0x33, 0xe8, 0x91, 0xf2, 0xce, 0x03, 0x3a, 0x01, 0x2d, 0x12, 0x67, 0x93, 0x9d, - 0x7c, 0xf5, 0xa3, 0xa7, 0x47, 0xb4, 0x74, 0x8d, 0x8f, 0x7e, 0x53, 0xa0, 0xdc, 0x61, 0x34, 0x62, - 0x91, 0x13, 0xbe, 0x65, 0x01, 0x3a, 0x01, 0x75, 0x16, 0xce, 0x37, 0x5b, 0xd1, 0x5f, 0xe5, 0x2a, - 0xec, 0x20, 0x8d, 0x4e, 0x38, 0xdf, 0x10, 0x01, 0x46, 0x2f, 0xa1, 0x14, 0x7b, 0xcb, 0x80, 0x26, - 0x37, 0x11, 0xdb, 0xca, 0xae, 0xe6, 0x65, 0xdb, 0x19, 0x80, 0xdc, 0x63, 0x6b, 0xbf, 0xcb, 0xa0, - 0x76, 0xd2, 0x0a, 0xc0, 0xa8, 0xeb, 0x4f, 0x13, 0x6e, 0xde, 0xb6, 0x79, 0xe5, 0x11, 0xf9, 0xc2, - 0x5c, 0x52, 0xe2, 0xd8, 0xd4, 0xe7, 0x36, 0x14, 0xc3, 0x77, 0x0f, 0x0c, 0xfb, 0xc0, 0x68, 0xeb, - 0x5d, 0x6a, 0x96, 0x26, 0x80, 0x83, 0x39, 0x1a, 0x40, 0xd1, 0xf7, 0x16, 0x2c, 0xf1, 0xb6, 0xf7, - 0xa4, 0xdc, 0x6e, 0x7e, 0x62, 0x4e, 0x43, 0x84, 0xc3, 0x2d, 0x89, 0xdc, 0xd1, 0x6b, 0x18, 0x9e, - 0x3e, 0x48, 0x21, 0x1d, 0x14, 0xf6, 0xcb, 0x4a, 0x4c, 0xa0, 0x12, 0x1e, 0xf2, 0x9d, 0x60, 0xb6, - 0x10, 0xe2, 0x54, 0xc2, 0x43, 0xbe, 0xe3, 0xd1, 0x44, 0xb4, 0x56, 0x09, 0x0f, 0x1b, 0xaf, 0x21, - 0xbd, 0x5b, 0x5f, 0x80, 0x4e, 0xac, 0x21, 0x9e, 0x4e, 0x46, 0xf6, 0x18, 0x77, 0x07, 0xa7, 0x03, - 0xdc, 0xd3, 0x9f, 0xa0, 0x22, 0xa8, 0x13, 0x1b, 0x13, 0x5d, 0x42, 0x00, 0x05, 0xfb, 0xd2, 0x76, - 0xf0, 0xb9, 0x2e, 0xf3, 0xd8, 0x72, 0xfa, 0x98, 0xd8, 0xba, 0xd2, 0xb0, 0x60, 0xe7, 0x9f, 0x50, - 0x83, 0x83, 0x73, 0xd3, 0xe9, 0xf6, 0xa7, 0xce, 0xe5, 0x38, 0x5f, 0x4a, 0x87, 0x7d, 0xdb, 0x21, - 0x83, 0xd1, 0xd9, 0x14, 0xbf, 0x99, 0x98, 0x43, 0x5d, 0xe2, 0x2d, 0xb7, 0x3b, 0x23, 0xcb, 0xd9, - 0xee, 0xca, 0x8d, 0x5f, 0x61, 0xe7, 0x0d, 0x54, 0x85, 0x67, 0xd6, 0x18, 0x13, 0xd3, 0x19, 0x58, - 0xa3, 0x5c, 0x3d, 0x0d, 0x94, 0x33, 0xec, 0xe8, 0x12, 0xd7, 0xd8, 0xc7, 0x66, 0x4f, 0x97, 0xf9, - 0xd6, 0x78, 0xe2, 0xe8, 0x0a, 0x17, 0xd8, 0xc3, 0x43, 0xec, 0x60, 0x5d, 0x15, 0xc2, 0xb1, 0x49, - 0xba, 0x7d, 0x7d, 0x0f, 0xed, 0x43, 0xf1, 0x0c, 0x3b, 0xc4, 0x1c, 0x9d, 0x61, 0xbd, 0xc0, 0x15, - 0x65, 0x4f, 0x7d, 0xd3, 0xee, 0xeb, 0x5a, 0xe3, 0x1b, 0xc8, 0xde, 0x65, 0x07, 0x80, 0xcc, 0xee, - 0x23, 0x5d, 0x4b, 0xb0, 0x67, 0x0e, 0x87, 0xd6, 0x4f, 0x69, 0xdf, 0x1e, 0x1e, 0x5d, 0xea, 0x72, - 0xe3, 0x7b, 0xd8, 0x7d, 0x8f, 0x1c, 0x00, 0xe2, 0x7a, 0x30, 0xc9, 0x51, 0xcb, 0xa0, 0x11, 0xfc, - 0x66, 0x82, 0x6d, 0x27, 0xb5, 0xd3, 0xea, 0xfc, 0x80, 0xbb, 0x8e, 0x2e, 0x77, 0x2e, 0xfe, 0xba, - 0x3d, 0x94, 0xfe, 0xbe, 0x3d, 0x94, 0xfe, 0xb9, 0x3d, 0x94, 0xfe, 0xf8, 0xf7, 0xf0, 0xc9, 0xcf, - 0x2f, 0x96, 0x5e, 0x72, 0x75, 0x33, 0x33, 0xdc, 0xf0, 0xba, 0x15, 0xc4, 0x2b, 0xd7, 0x6d, 0xce, - 0xd9, 0xba, 0x15, 0xb0, 0x70, 0x11, 0x37, 0xe9, 0xca, 0x6b, 0x2e, 0xc3, 0xd6, 0xce, 0x37, 0xe2, - 0x3b, 0xea, 0xfa, 0x7f, 0xca, 0xfa, 0x88, 0x85, 0xa7, 0xb6, 0x61, 0x8e, 0x07, 0xfc, 0x2a, 0x99, - 0xae, 0x3f, 0x2b, 0x88, 0x8f, 0xc1, 0xc9, 0xff, 0x01, 0x00, 0x00, 0xff, 0xff, 0x66, 0x66, 0x9c, - 0x8f, 0x50, 0x06, 0x00, 0x00, + // 865 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x55, 0xdd, 0x8e, 0xda, 0x46, + 0x14, 0x8e, 0x7f, 0x16, 0x96, 0xc3, 0xa6, 0xb2, 0xa6, 0x4d, 0x02, 0x54, 0xda, 0xa0, 0xbd, 0xe9, + 0x0a, 0x09, 0xa3, 0xb0, 0x6a, 0x23, 0xa5, 0x6a, 0x24, 0x03, 0xb3, 0x0b, 0x15, 0x8b, 0xc9, 0xd8, + 0xa4, 0xda, 0xde, 0xa0, 0xc1, 0x0c, 0xac, 0x15, 0x63, 0x23, 0xdb, 0x4b, 0x4a, 0x6f, 0xab, 0xbe, + 0x43, 0x9f, 0xa1, 0xb7, 0xbd, 0xea, 0x1b, 0xf4, 0xb2, 0x8f, 0x50, 0x6d, 0xef, 0xfb, 0x0c, 0xd5, + 0x8c, 0x6d, 0xd8, 0x75, 0x36, 0xca, 0xdd, 0x99, 0x39, 0xdf, 0x77, 0xce, 0x77, 0xbe, 0x19, 0x8f, + 0xe1, 0xd9, 0xa6, 0xdd, 0xa2, 0x8e, 0xd7, 0x5a, 0x86, 0x6b, 0xa7, 0x15, 0x6f, 0xd7, 0x2c, 0xd2, + 0xd7, 0x61, 0x10, 0x07, 0xe8, 0xb1, 0xcf, 0x02, 0x7d, 0x11, 0xe9, 0x9b, 0xb6, 0x4e, 0x1d, 0xaf, + 0x56, 0xd9, 0xb4, 0x5b, 0x21, 0x5b, 0x44, 0x1f, 0x00, 0x4f, 0xfe, 0x53, 0x00, 0xb0, 0xd1, 0x1d, + 0x12, 0xe6, 0x04, 0xe1, 0x1c, 0x7d, 0x03, 0xa5, 0x60, 0xcd, 0x42, 0x1a, 0xbb, 0x81, 0x5f, 0x91, + 0xea, 0xd2, 0xe9, 0x67, 0xed, 0x8a, 0x7e, 0xaf, 0x96, 0x6e, 0x66, 0x79, 0xb2, 0x87, 0xa2, 0x26, + 0x14, 0xa8, 0x23, 0x48, 0xb2, 0x20, 0x3d, 0xc9, 0x91, 0x0c, 0x91, 0x24, 0x29, 0x08, 0xbd, 0x82, + 0xe2, 0xc2, 0xf5, 0x62, 0x16, 0x46, 0x15, 0xa5, 0xae, 0x9c, 0x96, 0xdb, 0xf5, 0x1c, 0x7e, 0x2f, + 0x49, 0x3f, 0x17, 0x40, 0x92, 0x11, 0x38, 0x37, 0xa6, 0xe1, 0x92, 0xc5, 0x51, 0x45, 0xfd, 0x14, + 0xd7, 0x16, 0x40, 0x92, 0x11, 0x6a, 0x7f, 0x4a, 0x50, 0x48, 0xea, 0xa1, 0x57, 0x50, 0xbe, 0x66, + 0x74, 0xce, 0xc2, 0x29, 0xb7, 0x23, 0x9d, 0xb5, 0x9a, 0x2b, 0xd5, 0x17, 0x08, 0x7b, 0xbb, 0x66, + 0x04, 0xae, 0x77, 0x31, 0x7a, 0x09, 0xb0, 0xa2, 0xb1, 0x73, 0x9d, 0x50, 0xe5, 0x07, 0x6d, 0xba, + 0xe4, 0x00, 0xc1, 0x2c, 0xad, 0xb2, 0x10, 0x3d, 0xdf, 0x35, 0xf5, 0xe9, 0x8a, 0x55, 0x94, 0xba, + 0x74, 0x5a, 0xca, 0x2a, 0x8f, 0xe8, 0x8a, 0xa1, 0x2a, 0xa4, 0xab, 0xe9, 0x86, 0x7a, 0x15, 0x55, + 0xe4, 0x0f, 0x36, 0xd4, 0xbb, 0x61, 0x35, 0x0c, 0x85, 0x64, 0x1c, 0xf4, 0x15, 0xa8, 0x61, 0xe0, + 0x65, 0x9a, 0x3f, 0xcf, 0x35, 0x26, 0x81, 0xc7, 0x88, 0x00, 0x20, 0x04, 0xea, 0x3b, 0xb6, 0x8d, + 0x2a, 0x72, 0x5d, 0x39, 0x3d, 0x22, 0x22, 0x3e, 0xf9, 0x43, 0x82, 0x12, 0x77, 0xc8, 0xa6, 0x33, + 0x8f, 0xa1, 0x17, 0x50, 0xdc, 0xb0, 0x30, 0xca, 0x4e, 0xbb, 0xdc, 0x7e, 0x76, 0xa7, 0x1a, 0xbf, + 0x31, 0xfa, 0xdb, 0x24, 0x4d, 0x32, 0x1c, 0x7a, 0x0d, 0x47, 0x4e, 0xe0, 0xc7, 0xd4, 0xf5, 0x59, + 0x38, 0x75, 0xe7, 0x62, 0xfc, 0x72, 0xfb, 0xcb, 0x3c, 0xaf, 0x9b, 0x61, 0x06, 0x3d, 0x52, 0x76, + 0xf6, 0x0b, 0x74, 0x06, 0xc5, 0x50, 0x9c, 0x4e, 0x76, 0xf6, 0xd5, 0x8f, 0x9e, 0x1f, 0xc9, 0x90, + 0x27, 0xbf, 0x28, 0x50, 0xee, 0x30, 0x1a, 0xb2, 0xd0, 0x0e, 0xde, 0x31, 0x1f, 0x9d, 0x81, 0x3a, + 0x0b, 0xe6, 0xdb, 0x54, 0xf4, 0xf3, 0x5c, 0x85, 0x3b, 0x48, 0xbd, 0x13, 0xcc, 0xb7, 0x44, 0x80, + 0xd1, 0x4b, 0x28, 0x45, 0xee, 0xd2, 0xa7, 0xf1, 0x4d, 0xc8, 0x52, 0xd9, 0xd5, 0xbc, 0x6c, 0x2b, + 0x03, 0x90, 0x3d, 0xb6, 0xf6, 0xab, 0x0c, 0x6a, 0x27, 0xa9, 0x00, 0x8c, 0x3a, 0xde, 0x34, 0xe6, + 0xe6, 0xa5, 0xcd, 0x2b, 0x0f, 0xc8, 0x17, 0xe6, 0x92, 0x12, 0xc7, 0x26, 0x3e, 0xb7, 0xe1, 0x30, + 0x78, 0x7f, 0xcf, 0xb0, 0x0f, 0x8c, 0x36, 0xdf, 0x27, 0x66, 0x15, 0x83, 0x24, 0x40, 0x03, 0x38, + 0xf4, 0xdc, 0x05, 0x8b, 0xdd, 0xf4, 0xa6, 0x94, 0xdb, 0xcd, 0x4f, 0xcc, 0xa9, 0x8b, 0x70, 0x98, + 0x92, 0xc8, 0x8e, 0x5e, 0xc3, 0xf0, 0xf8, 0x5e, 0x0a, 0x69, 0xa0, 0xb0, 0x9f, 0xd6, 0x62, 0x02, + 0x95, 0xf0, 0x90, 0xef, 0xf8, 0xb3, 0x85, 0x10, 0xa7, 0x12, 0x1e, 0xf2, 0x1d, 0x97, 0xc6, 0xa2, + 0xb5, 0x4a, 0x78, 0xd8, 0x78, 0x0d, 0x2a, 0xbf, 0x5d, 0xe8, 0x0b, 0xd0, 0x88, 0x39, 0xc4, 0xd3, + 0xc9, 0xc8, 0x1a, 0xe3, 0xee, 0xe0, 0x7c, 0x80, 0x7b, 0xda, 0x23, 0x74, 0x08, 0xea, 0xc4, 0xc2, + 0x44, 0x93, 0x10, 0x40, 0xc1, 0xba, 0xb2, 0x6c, 0x7c, 0xa9, 0xc9, 0x3c, 0x36, 0xed, 0x3e, 0x26, + 0x96, 0xa6, 0x34, 0x4c, 0x28, 0xed, 0x3e, 0x0b, 0x54, 0x83, 0xa7, 0x97, 0x86, 0xdd, 0xed, 0x4f, + 0xed, 0xab, 0x71, 0xbe, 0x94, 0x06, 0x47, 0x96, 0x4d, 0x06, 0xa3, 0x8b, 0x29, 0x7e, 0x33, 0x31, + 0x86, 0x9a, 0xc4, 0x5b, 0xa6, 0x3b, 0x23, 0xd3, 0x4e, 0x77, 0xe5, 0xc6, 0xcf, 0x50, 0xda, 0x3d, + 0x47, 0xa8, 0x0a, 0x4f, 0xcc, 0x31, 0x26, 0x86, 0x3d, 0x30, 0x47, 0xb9, 0x7a, 0x45, 0x50, 0x2e, + 0xb0, 0xad, 0x49, 0x5c, 0x63, 0x1f, 0x1b, 0x3d, 0x4d, 0xe6, 0x5b, 0xe3, 0x89, 0xad, 0x29, 0x5c, + 0x60, 0x0f, 0x0f, 0xb1, 0x8d, 0x35, 0x55, 0x08, 0xc7, 0x06, 0xe9, 0xf6, 0xb5, 0x03, 0x74, 0x04, + 0x87, 0x17, 0xd8, 0x26, 0xc6, 0xe8, 0x02, 0x6b, 0x05, 0xae, 0x28, 0x5b, 0xf5, 0x0d, 0xab, 0xaf, + 0x15, 0x1b, 0x5f, 0x43, 0x21, 0x79, 0xd5, 0xd0, 0x53, 0x40, 0x46, 0xf7, 0x81, 0xae, 0x25, 0x38, + 0x30, 0x86, 0x43, 0xf3, 0x87, 0xa4, 0x6f, 0x0f, 0x8f, 0xae, 0x34, 0xb9, 0xf1, 0x1d, 0xc0, 0xfe, + 0x55, 0xe1, 0x54, 0xae, 0x07, 0x93, 0x1c, 0xb5, 0x0c, 0x45, 0x82, 0xdf, 0x4c, 0xb0, 0x65, 0x27, + 0x76, 0x9a, 0x9d, 0xef, 0x71, 0xd7, 0xd6, 0xe4, 0xce, 0xdb, 0xbf, 0x6e, 0x8f, 0xa5, 0xbf, 0x6f, + 0x8f, 0xa5, 0x7f, 0x6e, 0x8f, 0xa5, 0xdf, 0xfe, 0x3d, 0x7e, 0xf4, 0xe3, 0x8b, 0xa5, 0x1b, 0x5f, + 0xdf, 0xcc, 0x74, 0x27, 0x58, 0xb5, 0xfc, 0x68, 0xed, 0x38, 0xcd, 0x39, 0xdb, 0xb4, 0x7c, 0x16, + 0x2c, 0xa2, 0x26, 0x5d, 0xbb, 0xcd, 0x65, 0xd0, 0xba, 0xf3, 0x97, 0xf8, 0x96, 0x3a, 0xde, 0xef, + 0xb2, 0x36, 0x62, 0xc1, 0xb9, 0xa5, 0x1b, 0xe3, 0x01, 0xbf, 0x4a, 0x86, 0xe3, 0xcd, 0x0a, 0xe2, + 0x77, 0x70, 0xf6, 0x7f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x54, 0x26, 0xa8, 0x52, 0x06, 0x00, + 0x00, } func (m *EACLRecord) Marshal() (dAtA []byte, err error) { @@ -895,11 +909,11 @@ func (m *EACLRecord_Target) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } - if len(m.KeyList) > 0 { - for iNdEx := len(m.KeyList) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.KeyList[iNdEx]) - copy(dAtA[i:], m.KeyList[iNdEx]) - i = encodeVarintTypes(dAtA, i, uint64(len(m.KeyList[iNdEx]))) + if len(m.Keys) > 0 { + for iNdEx := len(m.Keys) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Keys[iNdEx]) + copy(dAtA[i:], m.Keys[iNdEx]) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Keys[iNdEx]))) i-- dAtA[i] = 0x12 } @@ -1209,8 +1223,8 @@ func (m *EACLRecord_Target) Size() (n int) { if m.Role != 0 { n += 1 + sovTypes(uint64(m.Role)) } - if len(m.KeyList) > 0 { - for _, b := range m.KeyList { + if len(m.Keys) > 0 { + for _, b := range m.Keys { l = len(b) n += 1 + l + sovTypes(uint64(l)) } @@ -1684,7 +1698,7 @@ func (m *EACLRecord_Target) Unmarshal(dAtA []byte) error { } case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field KeyList", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Keys", wireType) } var byteLen int for shift := uint(0); ; shift += 7 { @@ -1711,8 +1725,8 @@ func (m *EACLRecord_Target) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.KeyList = append(m.KeyList, make([]byte, postIndex-iNdEx)) - copy(m.KeyList[len(m.KeyList)-1], dAtA[iNdEx:postIndex]) + m.Keys = append(m.Keys, make([]byte, postIndex-iNdEx)) + copy(m.Keys[len(m.Keys)-1], dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex diff --git a/v2/container/grpc/service.pb.go b/v2/container/grpc/service.pb.go index dd3791f..87b6f09 100644 --- a/v2/container/grpc/service.pb.go +++ b/v2/container/grpc/service.pb.go @@ -37,8 +37,8 @@ type PutRequest struct { // message transport and does not affect request execution. MetaHeader *grpc.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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. + // 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,proto3" json:"verify_header,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -99,11 +99,15 @@ func (m *PutRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { return nil } -// Request body +// Container creation request has container structure's signature as a +// separate field. It's not stored in sidechain, just verified on container +// creation by `Container` smart contract. `ContainerID` is a SHA256 hash of +// the stable-marshalled container strucutre, hence there is no need for +// additional signature checks. type PutRequest_Body struct { - // Container to create in NeoFS. + // Container structure to register in NeoFS Container *Container `protobuf:"bytes,1,opt,name=container,proto3" json:"container,omitempty"` - //Signature of stable-marshalled container according to RFC-6979. + // Signature of a stable-marshalled container according to RFC-6979 Signature *grpc1.Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -165,8 +169,8 @@ type PutResponse struct { // message transport and does not affect request execution. MetaHeader *grpc.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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. + // 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,proto3" json:"verify_header,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -227,9 +231,12 @@ func (m *PutResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { return nil } -// Response body +// Container put response body contains information about the newly registered +// container as seen by `Container` smart contract. `ContainerID` can be +// calculated beforehand from the container structure and compared to the one +// returned here to make sure everything was done as expected. type PutResponse_Body struct { - // container_id carries identifier of the new container. + // Unique identifier of the newly created container ContainerId *grpc1.ContainerID `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -284,8 +291,8 @@ type DeleteRequest struct { // message transport and does not affect request execution. MetaHeader *grpc.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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. + // 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,proto3" json:"verify_header,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -346,12 +353,13 @@ func (m *DeleteRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { return nil } -// Request body +// Container removal request body has a signed `ContainerID` as a proof of +// container owner's intent. The signature will be verified by `Container` +// smart contract, so signing algorithm must be supported by NeoVM. type DeleteRequest_Body struct { - // container_id carries identifier of the container to delete - // from NeoFS. + // Identifier of the container to delete from NeoFS ContainerId *grpc1.ContainerID `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` - // Signature of container id according to RFC-6979. + // `ContainerID` signed with the container owner's key according to RFC-6979 Signature *grpc1.Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -405,8 +413,8 @@ func (m *DeleteRequest_Body) GetSignature() *grpc1.Signature { return nil } -// DeleteResponse is empty because delete operation is asynchronous and done -// via consensus in inner ring nodes +// `DeleteResponse` has an empty body because delete operation is asynchronous +// and done via consensus in Inner Ring nodes. type DeleteResponse struct { // Body of container delete response message. Body *DeleteResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` @@ -414,8 +422,8 @@ type DeleteResponse struct { // message transport and does not affect request execution. MetaHeader *grpc.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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. + // 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,proto3" json:"verify_header,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -476,7 +484,8 @@ func (m *DeleteResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { return nil } -// Response body +// `DeleteResponse` has an empty body because delete operation is asynchronous +// and done via consensus in Inner Ring nodes. type DeleteResponse_Body struct { XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -524,8 +533,8 @@ type GetRequest struct { // message transport and does not affect request execution. MetaHeader *grpc.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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. + // 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,proto3" json:"verify_header,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -586,9 +595,9 @@ func (m *GetRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { return nil } -// Request body +// Get container structure request body. type GetRequest_Body struct { - // container_id carries identifier of the container to get. + // Identifier of the container to get ContainerId *grpc1.ContainerID `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -643,8 +652,8 @@ type GetResponse struct { // message transport and does not affect request execution. MetaHeader *grpc.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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. + // 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,proto3" json:"verify_header,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -705,9 +714,10 @@ func (m *GetResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { return nil } -// Response body +// Get container response body does not have container structure signature. It +// was already verified on container creation. type GetResponse_Body struct { - // Container that has been requested. + // Requested container structure Container *Container `protobuf:"bytes,1,opt,name=container,proto3" json:"container,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -756,14 +766,14 @@ func (m *GetResponse_Body) GetContainer() *Container { // List containers type ListRequest struct { - // Body of list containers request message. + // Body of list containers request message Body *ListRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" 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. + // 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,proto3" json:"verify_header,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -824,9 +834,9 @@ func (m *ListRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { return nil } -// Request body +// List containers request body. type ListRequest_Body struct { - // owner_id carries identifier of the container owner. + // Identifier of the container owner OwnerId *grpc1.OwnerID `protobuf:"bytes,1,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -881,8 +891,8 @@ type ListResponse struct { // message transport and does not affect request execution. MetaHeader *grpc.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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. + // 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,proto3" json:"verify_header,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -943,9 +953,9 @@ func (m *ListResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { return nil } -// Response body +// List containers response body. type ListResponse_Body struct { - // ContainerIDs carries list of identifiers of the containers that belong to the owner. + // List of `ContainerID`s belonging to the requested `OwnerID` ContainerIds []*grpc1.ContainerID `protobuf:"bytes,1,rep,name=container_ids,json=containerIds,proto3" json:"container_ids,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -1000,8 +1010,8 @@ type SetExtendedACLRequest struct { // message transport and does not affect request execution. MetaHeader *grpc.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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. + // 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,proto3" json:"verify_header,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -1062,11 +1072,12 @@ func (m *SetExtendedACLRequest) GetVerifyHeader() *grpc.RequestVerificationHeade return nil } -// Request body +// Set Extended ACL request body does not have separate `ContainerID` +// reference. It will be taken from `EACLTable.container_id` field. type SetExtendedACLRequest_Body struct { - // Extended ACL to set for the container. + // Extended ACL table to set for container Eacl *grpc2.EACLTable `protobuf:"bytes,1,opt,name=eacl,proto3" json:"eacl,omitempty"` - // Signature of stable-marshalled Extended ACL according to RFC-6979. + // Signature of stable-marshalled Extended ACL table according to RFC-6979 Signature *grpc1.Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -1128,8 +1139,8 @@ type SetExtendedACLResponse struct { // message transport and does not affect request execution. MetaHeader *grpc.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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. + // 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,proto3" json:"verify_header,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -1190,7 +1201,9 @@ func (m *SetExtendedACLResponse) GetVerifyHeader() *grpc.ResponseVerificationHea return nil } -// Response body +// `SetExtendedACLResponse` has an empty body because the operation is +// asynchronous and update should be reflected in `Container` smart contract's +// storage after next block is issued in sidechain. type SetExtendedACLResponse_Body struct { XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -1238,8 +1251,8 @@ type GetExtendedACLRequest struct { // message transport and does not affect request execution. MetaHeader *grpc.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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. + // 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,proto3" json:"verify_header,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -1300,9 +1313,9 @@ func (m *GetExtendedACLRequest) GetVerifyHeader() *grpc.RequestVerificationHeade return nil } -// Request body +// Get Extended ACL request body type GetExtendedACLRequest_Body struct { - // container_id carries identifier of the container that has Extended ACL. + // Identifier of the container having Extended ACL ContainerId *grpc1.ContainerID `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -1357,8 +1370,8 @@ type GetExtendedACLResponse struct { // message transport and does not affect request execution. MetaHeader *grpc.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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. + // 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,proto3" json:"verify_header,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -1419,11 +1432,13 @@ func (m *GetExtendedACLResponse) GetVerifyHeader() *grpc.ResponseVerificationHea return nil } -// Response body +// Get Extended ACL Response body can be empty if the requested container did +// not have Extended ACL Table attached or Extended ACL was not allowed at +// container creation. type GetExtendedACLResponse_Body struct { - // Extended ACL that has been requested if it was set up. + // Extended ACL requested, if available Eacl *grpc2.EACLTable `protobuf:"bytes,1,opt,name=eacl,proto3" json:"eacl,omitempty"` - // Signature of stable-marshalled Extended ACL according to RFC-6979. + // Signature of stable-marshalled Extended ACL according to RFC-6979 Signature *grpc1.Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -1574,27 +1589,26 @@ const _ = grpc3.SupportPackageIsVersion4 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type ContainerServiceClient interface { - // Put invokes 'Put' method in container smart-contract and returns - // response immediately. After new block in morph chain, request is verified - // by inner ring nodes. After one more block in morph chain, container - // added into smart-contract storage. + // `Put` invokes `Container` smart contract's `Put` method and returns + // response immediately. After a new block is issued in sidechain, request is + // verified by Inner Ring nodes. After one more block in sidechain, container + // is added into smart contract storage. Put(ctx context.Context, in *PutRequest, opts ...grpc3.CallOption) (*PutResponse, error) - // Delete invokes 'Delete' method in container smart-contract and returns - // response immediately. After new block in morph chain, request is verified - // by inner ring nodes. After one more block in morph chain, container - // removed from smart-contract storage. + // `Delete` invokes `Container` smart contract's `Delete` method and returns + // response immediately. After a new block is issued in sidechain, request is + // verified by Inner Ring nodes. After one more block in sidechain, container + // is added into smart contract storage. Delete(ctx context.Context, in *DeleteRequest, opts ...grpc3.CallOption) (*DeleteResponse, error) - // Get returns container from container smart-contract storage. + // Returns container structure from `Container` smart contract storage. Get(ctx context.Context, in *GetRequest, opts ...grpc3.CallOption) (*GetResponse, error) - // List returns all owner's containers from container smart-contract - // storage. + // Returns all owner's containers from 'Container` smart contract' storage. List(ctx context.Context, in *ListRequest, opts ...grpc3.CallOption) (*ListResponse, error) - // SetExtendedACL invokes 'SetEACL' method in container smart-contract and - // returns response immediately. After new block in morph chain, - // Extended ACL added into smart-contract storage. + // Invokes 'SetEACL' method of 'Container` smart contract and returns response + // immediately. After one more block in sidechain, Extended ACL changes are + // added into smart contract storage. SetExtendedACL(ctx context.Context, in *SetExtendedACLRequest, opts ...grpc3.CallOption) (*SetExtendedACLResponse, error) - // GetExtendedACL returns Extended ACL table and signature from container - // smart-contract storage. + // Returns Extended ACL table and signature from `Container` smart contract + // storage. GetExtendedACL(ctx context.Context, in *GetExtendedACLRequest, opts ...grpc3.CallOption) (*GetExtendedACLResponse, error) } @@ -1662,27 +1676,26 @@ func (c *containerServiceClient) GetExtendedACL(ctx context.Context, in *GetExte // ContainerServiceServer is the server API for ContainerService service. type ContainerServiceServer interface { - // Put invokes 'Put' method in container smart-contract and returns - // response immediately. After new block in morph chain, request is verified - // by inner ring nodes. After one more block in morph chain, container - // added into smart-contract storage. + // `Put` invokes `Container` smart contract's `Put` method and returns + // response immediately. After a new block is issued in sidechain, request is + // verified by Inner Ring nodes. After one more block in sidechain, container + // is added into smart contract storage. Put(context.Context, *PutRequest) (*PutResponse, error) - // Delete invokes 'Delete' method in container smart-contract and returns - // response immediately. After new block in morph chain, request is verified - // by inner ring nodes. After one more block in morph chain, container - // removed from smart-contract storage. + // `Delete` invokes `Container` smart contract's `Delete` method and returns + // response immediately. After a new block is issued in sidechain, request is + // verified by Inner Ring nodes. After one more block in sidechain, container + // is added into smart contract storage. Delete(context.Context, *DeleteRequest) (*DeleteResponse, error) - // Get returns container from container smart-contract storage. + // Returns container structure from `Container` smart contract storage. Get(context.Context, *GetRequest) (*GetResponse, error) - // List returns all owner's containers from container smart-contract - // storage. + // Returns all owner's containers from 'Container` smart contract' storage. List(context.Context, *ListRequest) (*ListResponse, error) - // SetExtendedACL invokes 'SetEACL' method in container smart-contract and - // returns response immediately. After new block in morph chain, - // Extended ACL added into smart-contract storage. + // Invokes 'SetEACL' method of 'Container` smart contract and returns response + // immediately. After one more block in sidechain, Extended ACL changes are + // added into smart contract storage. SetExtendedACL(context.Context, *SetExtendedACLRequest) (*SetExtendedACLResponse, error) - // GetExtendedACL returns Extended ACL table and signature from container - // smart-contract storage. + // Returns Extended ACL table and signature from `Container` smart contract + // storage. GetExtendedACL(context.Context, *GetExtendedACLRequest) (*GetExtendedACLResponse, error) } diff --git a/v2/container/grpc/types.pb.go b/v2/container/grpc/types.pb.go index 4d48b1b..1ad1b75 100644 --- a/v2/container/grpc/types.pb.go +++ b/v2/container/grpc/types.pb.go @@ -24,24 +24,24 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package -// 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. ID of the container is a 32 byte long -// SHA256 hash of stable-marshalled container message. +// 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. ID of the container is a 32 byte long SHA256 hash +// of stable-marshalled container message. type Container struct { - // Container format version. - // Effectively the version of API library used to create container + // Container format version. Effectively the version of API library used to + // create container. Version *grpc.Version `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` - // OwnerID carries identifier of the container owner. - OwnerId *grpc.OwnerID `protobuf:"bytes,2,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"` - // Nonce is a 16 byte UUID, used to avoid collisions of container id. + // Identifier of the container owner + OwnerId *grpc.OwnerID `protobuf:"bytes,2,opt,name=owner_id,json=ownerID,proto3" json:"owner_id,omitempty"` + // Nonce is a 16 byte UUID, used to avoid collisions of container id Nonce []byte `protobuf:"bytes,3,opt,name=nonce,proto3" json:"nonce,omitempty"` - // BasicACL contains access control rules for owner, system, others groups and - // permission bits for bearer token and Extended ACL. - BasicAcl uint32 `protobuf:"varint,4,opt,name=basic_acl,json=basicAcl,proto3" json:"basic_acl,omitempty"` - // Attributes define any immutable characteristics of container. + // `BasicACL` contains access control rules for owner, system, others groups + // and permission bits for `BearerToken` and `Extended ACL` + BasicAcl uint32 `protobuf:"varint,4,opt,name=basic_acl,json=basicACL,proto3" json:"basic_acl,omitempty"` + // Attributes represent immutable container's meta data Attributes []*Container_Attribute `protobuf:"bytes,5,rep,name=attributes,proto3" json:"attributes,omitempty"` - // Placement policy for the object inside the container. + // Placement policy for the object inside the container PlacementPolicy *grpc1.PlacementPolicy `protobuf:"bytes,6,opt,name=placement_policy,json=placementPolicy,proto3" json:"placement_policy,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -123,11 +123,19 @@ func (m *Container) GetPlacementPolicy() *grpc1.PlacementPolicy { return nil } -// Attribute is a key-value pair of strings. +// `Attribute` is a user-defined Key-Value metadata pair attached to the +// container. Container attribute are immutable. They are set at container +// creation and cna never be added or updated. +// +// There are some "well-known" attributes affecting system behaviour: +// +// * Subnet \ +// String ID of container's storage subnet. Container can be attached to +// only one subnet. type Container_Attribute struct { - // Key of immutable container attribute. + // Attribute name key Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - // Value of immutable container attribute. + // Attribute value Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -190,30 +198,30 @@ func init() { proto.RegisterFile("v2/container/grpc/types.proto", fileDescriptor var fileDescriptor_3bfd95a81c72c35c = []byte{ // 383 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x52, 0x4d, 0xae, 0xd3, 0x30, - 0x10, 0x26, 0x2d, 0xef, 0xb5, 0x71, 0x41, 0x54, 0x06, 0x41, 0x14, 0x44, 0x14, 0x58, 0x65, 0x53, - 0x5b, 0xa4, 0x4b, 0xc4, 0xa2, 0x80, 0x10, 0x95, 0x10, 0x54, 0x46, 0x62, 0xc1, 0xa6, 0x72, 0xdc, - 0x69, 0x6b, 0x91, 0xda, 0x56, 0xec, 0x06, 0xf5, 0x26, 0x9c, 0x81, 0x93, 0xb0, 0xe4, 0x08, 0xa8, - 0xdc, 0x80, 0x13, 0xa0, 0x24, 0x4a, 0xe8, 0x53, 0xbb, 0xcb, 0xcc, 0xf7, 0x33, 0x33, 0x5f, 0x8c, - 0x9e, 0x94, 0x29, 0x15, 0x5a, 0x39, 0x2e, 0x15, 0x14, 0x74, 0x53, 0x18, 0x41, 0xdd, 0xc1, 0x80, - 0x25, 0xa6, 0xd0, 0x4e, 0xe3, 0xfb, 0x0a, 0x34, 0x59, 0x5b, 0x52, 0xa6, 0xa4, 0x63, 0x85, 0x61, - 0x99, 0x52, 0x05, 0x6e, 0xc7, 0xcd, 0x99, 0x20, 0x0c, 0xca, 0x94, 0x16, 0xb0, 0xb6, 0x67, 0xc8, - 0xb3, 0xbf, 0x3d, 0xe4, 0xbf, 0x6e, 0x3d, 0xf0, 0x73, 0x34, 0x28, 0xa1, 0xb0, 0x52, 0xab, 0xc0, - 0x8b, 0xbd, 0x64, 0x94, 0x3e, 0x22, 0xff, 0x47, 0x55, 0x06, 0xe4, 0x73, 0x03, 0xb3, 0x96, 0x87, - 0x53, 0x34, 0xd4, 0xdf, 0x14, 0x14, 0x4b, 0xb9, 0x0a, 0x7a, 0x97, 0x35, 0x1f, 0x2b, 0x7c, 0xfe, - 0x86, 0x0d, 0x6a, 0xe2, 0x7c, 0x85, 0x1f, 0xa0, 0x2b, 0xa5, 0x95, 0x80, 0xa0, 0x1f, 0x7b, 0xc9, - 0x1d, 0xd6, 0x14, 0xf8, 0x31, 0xf2, 0x33, 0x6e, 0xa5, 0x58, 0x72, 0x91, 0x07, 0xb7, 0x63, 0x2f, - 0xb9, 0xcb, 0x86, 0x75, 0x63, 0x26, 0x72, 0xfc, 0x0e, 0x21, 0xee, 0x5c, 0x21, 0xb3, 0xbd, 0x03, - 0x1b, 0x5c, 0xc5, 0xfd, 0x64, 0x94, 0x26, 0xe4, 0x42, 0x0e, 0xa4, 0xbb, 0x86, 0xcc, 0x5a, 0x01, - 0x3b, 0xd1, 0xe2, 0xf7, 0x68, 0x6c, 0x72, 0x2e, 0x60, 0x07, 0xca, 0x2d, 0x8d, 0xce, 0xa5, 0x38, - 0x04, 0xd7, 0xf5, 0xe2, 0x4f, 0x4f, 0xfc, 0x9a, 0x24, 0xc9, 0xa2, 0x65, 0x2e, 0x6a, 0x22, 0xbb, - 0x67, 0x6e, 0x36, 0xc2, 0x29, 0xf2, 0xbb, 0x31, 0x78, 0x8c, 0xfa, 0x5f, 0xe1, 0x50, 0x47, 0xe7, - 0xb3, 0xea, 0xb3, 0xba, 0xb4, 0xe4, 0xf9, 0x1e, 0xea, 0x68, 0x7c, 0xd6, 0x14, 0xaf, 0xb6, 0x3f, - 0x8f, 0x91, 0xf7, 0xeb, 0x18, 0x79, 0xbf, 0x8f, 0x91, 0xf7, 0xfd, 0x4f, 0x74, 0xeb, 0xcb, 0xcb, - 0x8d, 0x74, 0xdb, 0x7d, 0x46, 0x84, 0xde, 0x51, 0x65, 0x8d, 0x10, 0x93, 0x15, 0x94, 0x54, 0x81, - 0x5e, 0xdb, 0x09, 0x37, 0x72, 0xb2, 0xd1, 0xf4, 0xec, 0x49, 0xbc, 0xe8, 0xca, 0x1f, 0xbd, 0x87, - 0x1f, 0x40, 0xbf, 0xfd, 0x44, 0x66, 0x8b, 0x79, 0xb5, 0x7c, 0x17, 0x41, 0x76, 0x5d, 0xff, 0xe5, - 0xe9, 0xbf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x57, 0x93, 0x14, 0xb3, 0x51, 0x02, 0x00, 0x00, + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x52, 0x4d, 0xce, 0xd3, 0x30, + 0x10, 0x25, 0x2d, 0xdf, 0x4f, 0xfc, 0x81, 0xa8, 0x0c, 0x82, 0x28, 0x88, 0x28, 0xb0, 0xca, 0xa6, + 0xb6, 0x48, 0x97, 0x88, 0x45, 0x29, 0x42, 0x54, 0xaa, 0xa0, 0x32, 0x12, 0x0b, 0x36, 0x95, 0xe3, + 0x4e, 0x5b, 0x8b, 0xd4, 0xb6, 0x62, 0x37, 0xa8, 0x37, 0xe1, 0x0c, 0x9c, 0x84, 0x25, 0x47, 0x40, + 0xe5, 0x06, 0x9c, 0x00, 0x25, 0x51, 0x42, 0x3f, 0xb5, 0xbb, 0xf9, 0x79, 0xef, 0xcd, 0xcc, 0xb3, + 0xd1, 0xb3, 0x32, 0xa5, 0x42, 0x2b, 0xc7, 0xa5, 0x82, 0x82, 0xae, 0x0b, 0x23, 0xa8, 0xdb, 0x1b, + 0xb0, 0xc4, 0x14, 0xda, 0x69, 0xfc, 0x50, 0x81, 0x26, 0x2b, 0x4b, 0xca, 0x94, 0x74, 0xa8, 0x30, + 0x2c, 0x53, 0xaa, 0xc0, 0x6d, 0xb9, 0x39, 0x21, 0x84, 0x41, 0x99, 0xd2, 0x02, 0x56, 0xf6, 0xa4, + 0xf3, 0xe2, 0x6f, 0x0f, 0xf9, 0x93, 0x56, 0x03, 0xbf, 0x44, 0x57, 0x25, 0x14, 0x56, 0x6a, 0x15, + 0x78, 0xb1, 0x97, 0xdc, 0xa4, 0x4f, 0xc8, 0xff, 0x51, 0x95, 0x00, 0xf9, 0xdc, 0xb4, 0x59, 0x8b, + 0xc3, 0x29, 0xba, 0xd6, 0xdf, 0x14, 0x14, 0x0b, 0xb9, 0x0c, 0x7a, 0xe7, 0x39, 0x1f, 0xab, 0xfe, + 0xf4, 0x2d, 0xbb, 0xd2, 0x4d, 0x80, 0x1f, 0xa1, 0x0b, 0xa5, 0x95, 0x80, 0xa0, 0x1f, 0x7b, 0xc9, + 0x3d, 0xd6, 0x24, 0xf8, 0x29, 0xf2, 0x33, 0x6e, 0xa5, 0x58, 0x70, 0x91, 0x07, 0x77, 0x63, 0x2f, + 0xb9, 0xcf, 0xae, 0xeb, 0xc2, 0x78, 0x32, 0xc3, 0xef, 0x11, 0xe2, 0xce, 0x15, 0x32, 0xdb, 0x39, + 0xb0, 0xc1, 0x45, 0xdc, 0x4f, 0x6e, 0xd2, 0x84, 0x9c, 0xf1, 0x81, 0x74, 0xd7, 0x90, 0x71, 0x4b, + 0x60, 0x47, 0x5c, 0x3c, 0x43, 0x03, 0x93, 0x73, 0x01, 0x5b, 0x50, 0x6e, 0x61, 0x74, 0x2e, 0xc5, + 0x3e, 0xb8, 0xac, 0x17, 0x7f, 0x7e, 0xa4, 0xd7, 0x38, 0x49, 0xe6, 0x2d, 0x72, 0x5e, 0x03, 0xd9, + 0x03, 0x73, 0xbb, 0x10, 0x8e, 0x90, 0xdf, 0x8d, 0xc1, 0x03, 0xd4, 0xff, 0x0a, 0xfb, 0xda, 0x3a, + 0x9f, 0x55, 0x61, 0x75, 0x69, 0xc9, 0xf3, 0x1d, 0xd4, 0xd6, 0xf8, 0xac, 0x49, 0xde, 0x6c, 0x7e, + 0x1e, 0x22, 0xef, 0xd7, 0x21, 0xf2, 0x7e, 0x1f, 0x22, 0xef, 0xfb, 0x9f, 0xe8, 0xce, 0x97, 0xd7, + 0x6b, 0xe9, 0x36, 0xbb, 0x8c, 0x08, 0xbd, 0xa5, 0xca, 0x1a, 0x21, 0x86, 0x4b, 0x28, 0xa9, 0x02, + 0xbd, 0xb2, 0x43, 0x6e, 0xe4, 0x70, 0xad, 0xe9, 0xc9, 0x97, 0x78, 0xd5, 0xa5, 0x3f, 0x7a, 0x8f, + 0x3f, 0x80, 0x7e, 0xf7, 0x89, 0x8c, 0xe7, 0xd3, 0x6a, 0xf9, 0xce, 0x82, 0xec, 0xb2, 0x7e, 0xe5, + 0xd1, 0xbf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x76, 0x8d, 0x00, 0xb0, 0x51, 0x02, 0x00, 0x00, } func (m *Container) Marshal() (dAtA []byte, err error) { diff --git a/v2/netmap/grpc/service.pb.go b/v2/netmap/grpc/service.pb.go index 54b7d8c..ac94753 100644 --- a/v2/netmap/grpc/service.pb.go +++ b/v2/netmap/grpc/service.pb.go @@ -28,16 +28,16 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package -// Get NodeInfo from the particular node directly +// Get NodeInfo structure from the particular node directly type LocalNodeInfoRequest struct { - // Body of the balance request message. + // Body of the LocalNodeInfo request message Body *LocalNodeInfoRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" 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. + // 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,proto3" json:"verify_header,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -98,7 +98,7 @@ func (m *LocalNodeInfoRequest) GetVerifyHeader() *grpc.RequestVerificationHeader return nil } -//Request body +// LocalNodeInfo request body is empty. type LocalNodeInfoRequest_Body struct { XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -138,7 +138,7 @@ func (m *LocalNodeInfoRequest_Body) XXX_DiscardUnknown() { var xxx_messageInfo_LocalNodeInfoRequest_Body proto.InternalMessageInfo -// Local nod Info, including API Version in use +// Local Node Info, including API Version in use type LocalNodeInfoResponse struct { // Body of the balance response message. Body *LocalNodeInfoResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` @@ -146,8 +146,8 @@ type LocalNodeInfoResponse struct { // message transport and does not affect response execution. MetaHeader *grpc.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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. + // 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,proto3" json:"verify_header,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -208,11 +208,11 @@ func (m *LocalNodeInfoResponse) GetVerifyHeader() *grpc.ResponseVerificationHead return nil } -//Response body +// Local Node Info, including API Version in use. type LocalNodeInfoResponse_Body struct { - // API version in use + // Latest NeoFS API version in use Version *grpc1.Version `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` - // NodeInfo from node itself + // NodeInfo structure with recent information from node itself NodeInfo *NodeInfo `protobuf:"bytes,2,opt,name=node_info,json=nodeInfo,proto3" json:"node_info,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -319,7 +319,11 @@ const _ = grpc2.SupportPackageIsVersion4 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type NetmapServiceClient interface { - // Return information about Node + // Get NodeInfo structure from the particular node directly. Node information + // can be taken from `Netmap` smart contract, but in some cases the one may + // want to get recent information directly, or to talk to the node not yet + // present in `Network Map` to find out what API version can be used for + // further communication. Can also be used to check if node is up and running. LocalNodeInfo(ctx context.Context, in *LocalNodeInfoRequest, opts ...grpc2.CallOption) (*LocalNodeInfoResponse, error) } @@ -342,7 +346,11 @@ func (c *netmapServiceClient) LocalNodeInfo(ctx context.Context, in *LocalNodeIn // NetmapServiceServer is the server API for NetmapService service. type NetmapServiceServer interface { - // Return information about Node + // Get NodeInfo structure from the particular node directly. Node information + // can be taken from `Netmap` smart contract, but in some cases the one may + // want to get recent information directly, or to talk to the node not yet + // present in `Network Map` to find out what API version can be used for + // further communication. Can also be used to check if node is up and running. LocalNodeInfo(context.Context, *LocalNodeInfoRequest) (*LocalNodeInfoResponse, error) } diff --git a/v2/netmap/grpc/types.pb.go b/v2/netmap/grpc/types.pb.go index a16be67..45b60fb 100644 --- a/v2/netmap/grpc/types.pb.go +++ b/v2/netmap/grpc/types.pb.go @@ -78,9 +78,9 @@ func (Operation) EnumDescriptor() ([]byte, []int) { return fileDescriptor_91a1332b2376641a, []int{0} } -// Selector modifier showing how the node set will be formed -// By default selector just groups by attribute into a bucket selecting nodes -// only by their hash distance. +// Selector modifier shows how the node set will be formed. By default selector +// just groups nodes into a bucket by attribute, selecting nodes only by their +// hash distance. type Clause int32 const ( @@ -144,12 +144,13 @@ func (NodeInfo_State) EnumDescriptor() ([]byte, []int) { return fileDescriptor_91a1332b2376641a, []int{4, 0} } -// Filter +// Filter will return the subset of nodes from `NetworkMap` or another filter's +// results, that will satisfy filter's conditions. type Filter struct { - // Name of the filter or a reference to the named filter. - // '*' means application to the whole unfiltered NetworkMap - // At top level it's used as a filter name. At lower levels it's considered to - // be a reference to another named filter + // Name of the filter or a reference to the named filter. '*' means + // application to the whole unfiltered NetworkMap. At top level it's used as a + // filter name. At lower levels it's considered to be a reference to another + // named filter Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` // Key to filter Key string `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` @@ -157,7 +158,8 @@ type Filter struct { Op Operation `protobuf:"varint,3,opt,name=op,proto3,enum=neo.fs.v2.netmap.Operation" json:"op,omitempty"` // Value to match Value string `protobuf:"bytes,4,opt,name=value,proto3" json:"value,omitempty"` - // List of inner filters. Top level operation will be applied to the whole list. + // List of inner filters. Top level operation will be applied to the whole + // list. Filters []*Filter `protobuf:"bytes,5,rep,name=filters,proto3" json:"filters,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -232,11 +234,12 @@ func (m *Filter) GetFilters() []*Filter { return nil } -// Selector +// Selector chooses a number of nodes from the bucket taking the nearest nodes +// to the provided `ContainerID` by hash distance. type Selector struct { // Selector name to reference in object placement section Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // How many nodes to select from bucket + // How many nodes to select from the bucket Count uint32 `protobuf:"varint,2,opt,name=count,proto3" json:"count,omitempty"` // Selector modifier showing how to form a bucket Clause Clause `protobuf:"varint,3,opt,name=clause,proto3,enum=neo.fs.v2.netmap.Clause" json:"clause,omitempty"` @@ -317,11 +320,13 @@ func (m *Selector) GetFilter() string { return "" } -// Exact bucket for each replica +// Number of object replicas in a set of nodes from the defined selector. If no +// selector set the root bucket containing all possible nodes will be used by +// default. type Replica struct { // How many object replicas to put Count uint32 `protobuf:"varint,1,opt,name=count,proto3" json:"count,omitempty"` - // Named selector bucket to put in + // Named selector bucket to put replicas Selector string `protobuf:"bytes,2,opt,name=selector,proto3" json:"selector,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -375,12 +380,15 @@ func (m *Replica) GetSelector() string { return "" } -// Set of rules to select a subset of nodes able to store container's objects +// Set of rules to select a subset of nodes from `NetworkMap` able to store +// container's objects. The format is simple enough to transpile from different +// storage policy definition languages. type PlacementPolicy struct { - // Rules to set number of object replicas and place each one into a particular bucket + // Rules to set number of object replicas and place each one into a named + // bucket Replicas []*Replica `protobuf:"bytes,1,rep,name=replicas,proto3" json:"replicas,omitempty"` // Container backup factor controls how deep NeoFS will search for nodes - // alternatives to include into container. + // alternatives to include into container's nodes subset ContainerBackupFactor uint32 `protobuf:"varint,2,opt,name=container_backup_factor,json=containerBackupFactor,proto3" json:"container_backup_factor,omitempty"` // Set of Selectors to form the container's nodes subset Selectors []*Selector `protobuf:"bytes,3,rep,name=selectors,proto3" json:"selectors,omitempty"` @@ -528,14 +536,49 @@ func (m *NodeInfo) GetState() NodeInfo_State { return NodeInfo_UNSPECIFIED } -// Attributes of the NeoFS node. +// Administrator-defined Attributes of the NeoFS Storage Node. +// +// Node's attributes are mostly used during Storage Policy evaluation to +// calculate object's placement and find a set of nodes satisfying policy +// requirements. There are some "well-known" node attributes common to all the +// Storage Nodes in the network and used implicitly with default values if not +// explicitly set: +// +// * Capacity \ +// Total available disk space in Gigabytes. +// * Price \ +// Price in GAS tokens for storing one GB of data during one Epoch. In node +// attributes it's a string presenting floating point number with comma or +// point delimiter for decimal part. In the Network Map it will be saved as +// 64-bit unsigned integer representing number of minimal token fractions. +// * Subnet \ +// String ID of Node's storage subnet. There can be only one subnet served +// by the Storage Node. +// * Locode \ +// Node's geographic location in +// [UN/LOCODE](https://www.unece.org/cefact/codesfortrade/codes_index.html) +// format approximated to the nearest point defined in standard. +// * Country \ +// Country code in +// [ISO 3166-1_alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) +// format. Calculated automatically from `Locode` attribute +// * Region \ +// Country's administative subdivision where node is located. Calculated +// automatically from `Locode` attribute based on `SubDiv` field. Presented +// in [ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2) format. +// * City \ +// City, town, village or rural area name where node is located written +// without diacritics . Calculated automatically from `Locode` attribute. +// +// For detailed description of each well-known attribute please see the +// corresponding section in NeoFS Technical specification. type NodeInfo_Attribute struct { // Key of the node attribute. Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` // Value of the node attribute. Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` - // Parent keys, if any - // Example: For City it can be Region or Country + // Parent keys, if any. For example for `City` it could be `Region` and + // `Country`. Parents []string `protobuf:"bytes,3,rep,name=parents,proto3" json:"parents,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` diff --git a/v2/object/grpc/service.pb.go b/v2/object/grpc/service.pb.go index 46462c6..1f5276a 100644 --- a/v2/object/grpc/service.pb.go +++ b/v2/object/grpc/service.pb.go @@ -28,15 +28,16 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package -// Get object request +// GET object request type GetRequest struct { // Body of get object request message. Body *GetRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` - // Carries request meta information. Header data is used only to regulate message - // transport and does not affect request execution. + // 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,proto3" 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. + // 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,proto3" json:"verify_header,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -97,13 +98,12 @@ func (m *GetRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { return nil } -// Request body +// GET Object request body type GetRequest_Body struct { - // Address of the requested object. + // Address of the requested object Address *grpc1.Address `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` - // Carries the raw option flag of the request. - // Raw request is sent to receive only the objects - // that are physically stored on the server. + // If `raw` flag is set, request will work only with objects that are + // physically stored on the peer node Raw bool `protobuf:"varint,2,opt,name=raw,proto3" json:"raw,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -157,7 +157,7 @@ func (m *GetRequest_Body) GetRaw() bool { return false } -// get object response +// GET object response type GetResponse struct { // Body of get object response message. Body *GetResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` @@ -165,8 +165,8 @@ type GetResponse struct { // message transport and does not affect request execution. MetaHeader *grpc.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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. + // 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,proto3" json:"verify_header,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -227,9 +227,9 @@ func (m *GetResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { return nil } -// Response body +// GET Object Response body type GetResponse_Body struct { - // Carries the single message of the response stream. + // Single message in the response stream. // // Types that are valid to be assigned to ObjectPart: // *GetResponse_Body_Init_ @@ -318,13 +318,14 @@ func (*GetResponse_Body) XXX_OneofWrappers() []interface{} { } } -// Initialization parameters of the object got from NeoFS. +// Initial part of the `Object` structure stream. Technically it's a +// set of all `Object` structure's fields except `payload`. type GetResponse_Body_Init struct { - // Object ID + // Object's unique identifier. ObjectId *grpc1.ObjectID `protobuf:"bytes,1,opt,name=object_id,json=objectId,proto3" json:"object_id,omitempty"` - // Object signature + // Signed `ObjectID` Signature *grpc1.Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` - // Object header. + // Object metadata headers Header *Header `protobuf:"bytes,3,opt,name=header,proto3" json:"header,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -385,15 +386,16 @@ func (m *GetResponse_Body_Init) GetHeader() *Header { return nil } -// Put object request +// PUT object request type PutRequest struct { // Body of put object request message. Body *PutRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` - // Carries request meta information. Header data is used only to regulate message - // transport and does not affect request execution. + // 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,proto3" 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. + // 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,proto3" json:"verify_header,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -454,9 +456,9 @@ func (m *PutRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { return nil } -// Request body +// PUT request body type PutRequest_Body struct { - // Carries the single part of the query stream. + // Single message in the request stream. // // Types that are valid to be assigned to ObjectPart: // *PutRequest_Body_Init_ @@ -545,17 +547,17 @@ func (*PutRequest_Body) XXX_OneofWrappers() []interface{} { } } -// Groups initialization parameters of object placement in NeoFS. +// Newly created object structure parameters. If some optional parameters +// are not set, they will be calculated by a peer node. type PutRequest_Body_Init struct { - // Object ID, where available + // ObjectID if available. ObjectId *grpc1.ObjectID `protobuf:"bytes,1,opt,name=object_id,json=objectId,proto3" json:"object_id,omitempty"` - // Object signature, were available + // Object signature if available Signature *grpc1.Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` - // Header of the object to save in the system. + // Object's Header Header *Header `protobuf:"bytes,3,opt,name=header,proto3" json:"header,omitempty"` - // Number of the object copies to store within the RPC call. - // Default zero value is processed according to the - // container placement rules. + // Number of the object copies to store within the RPC call. By default + // object is processed according to the container's placement policy. CopiesNumber uint32 `protobuf:"varint,4,opt,name=copies_number,json=copiesNumber,proto3" json:"copies_number,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -623,7 +625,7 @@ func (m *PutRequest_Body_Init) GetCopiesNumber() uint32 { return 0 } -// Put object response +// PUT Object response type PutResponse struct { // Body of put object response message. Body *PutResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` @@ -631,8 +633,8 @@ type PutResponse struct { // message transport and does not affect request execution. MetaHeader *grpc.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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. + // 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,proto3" json:"verify_header,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -693,10 +695,9 @@ func (m *PutResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { return nil } -// Response body +// PUT Object response body type PutResponse_Body struct { - // Carries identifier of the saved object. - // It is used to access an object in the container. + // Identifier of the saved object ObjectId *grpc1.ObjectID `protobuf:"bytes,1,opt,name=object_id,json=objectId,proto3" json:"object_id,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -743,15 +744,16 @@ func (m *PutResponse_Body) GetObjectId() *grpc1.ObjectID { return nil } -// Object Delete request +// Object DELETE request type DeleteRequest struct { // Body of delete object request message. Body *DeleteRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` - // Carries request meta information. Header data is used only to regulate message - // transport and does not affect request execution. + // 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,proto3" 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. + // 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,proto3" json:"verify_header,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -812,9 +814,9 @@ func (m *DeleteRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { return nil } -// Request body +// Object DELETE request body type DeleteRequest_Body struct { - // Carries the address of the object to be deleted. + // Address of the object to be deleted Address *grpc1.Address `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -861,8 +863,8 @@ func (m *DeleteRequest_Body) GetAddress() *grpc1.Address { return nil } -// DeleteResponse is empty because we cannot guarantee permanent object removal -// in distributed system. +// DeleteResponse body is empty because we cannot guarantee permanent object +// removal in distributed system. type DeleteResponse struct { // Body of delete object response message. Body *DeleteResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` @@ -870,8 +872,8 @@ type DeleteResponse struct { // message transport and does not affect request execution. MetaHeader *grpc.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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. + // 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,proto3" json:"verify_header,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -932,7 +934,7 @@ func (m *DeleteResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { return nil } -// Response body +// Object DELETE Response has an empty body. type DeleteResponse_Body struct { XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -972,15 +974,16 @@ func (m *DeleteResponse_Body) XXX_DiscardUnknown() { var xxx_messageInfo_DeleteResponse_Body proto.InternalMessageInfo -// Object head request +// Object HEAD request type HeadRequest struct { // Body of head object request message. Body *HeadRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` - // Carries request meta information. Header data is used only to regulate message - // transport and does not affect request execution. + // 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,proto3" 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. + // 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,proto3" json:"verify_header,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -1041,15 +1044,14 @@ func (m *HeadRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { return nil } -// Request body +// Object HEAD request body type HeadRequest_Body struct { - // Address of the object with the requested header. + // Address of the object with the requested Header Address *grpc1.Address `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` // Return only minimal header subset MainOnly bool `protobuf:"varint,2,opt,name=main_only,json=mainOnly,proto3" json:"main_only,omitempty"` - // Carries the raw option flag of the request. - // Raw request is sent to receive only the headers of the objects - // that are physically stored on the server. + // If `raw` flag is set, request will work only with objects that are + // physically stored on the peer node Raw bool `protobuf:"varint,3,opt,name=raw,proto3" json:"raw,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -1110,14 +1112,17 @@ func (m *HeadRequest_Body) GetRaw() bool { return false } -// Tuple of full object header and signature of object ID. +// Tuple of full object header and signature of `ObjectID`. \ +// Signed `ObjectID` is present to verify full header's authenticity through the +// following steps: +// +// 1. Calculate `SHA-256` of marshalled `Header` structure +// 2. Check if the resulting hash matched `ObjectID` +// 3. Check if `ObjectID` signature in `signature` field is correct type HeaderWithSignature struct { // Full object header Header *Header `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` - // Signed object_id to verify full header's authenticity through following steps: - // 1. Calculate SHA-256 of marshalled Headers structure. - // 2. Check if the resulting hash matched ObjectID - // 3. Check if ObjectID's signature in signature field is correct. + // Signed `ObjectID` to verify full header's authenticity Signature *grpc1.Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -1171,7 +1176,7 @@ func (m *HeaderWithSignature) GetSignature() *grpc1.Signature { return nil } -// Head response +// Object HEAD response type HeadResponse struct { // Body of head object response message. Body *HeadResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` @@ -1179,8 +1184,8 @@ type HeadResponse struct { // message transport and does not affect request execution. MetaHeader *grpc.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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. + // 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,proto3" json:"verify_header,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -1241,9 +1246,9 @@ func (m *HeadResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { return nil } -// Response body +// Object HEAD response body type HeadResponse_Body struct { - // Carries the requested object header or it's part + // Requested object header or it's part. // // Types that are valid to be assigned to Head: // *HeadResponse_Body_Header @@ -1332,15 +1337,16 @@ func (*HeadResponse_Body) XXX_OneofWrappers() []interface{} { } } -// Search objects request +// Object Search request type SearchRequest struct { // Body of search object request message. Body *SearchRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` - // Carries request meta information. Header data is used only to regulate message - // transport and does not affect request execution. + // 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,proto3" 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. + // 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,proto3" json:"verify_header,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -1401,9 +1407,9 @@ func (m *SearchRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { return nil } -// Request body +// Object Search request body type SearchRequest_Body struct { - // Carries search container identifier. + // Container identifier were to search ContainerId *grpc1.ContainerID `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` // Version of the Query Language used Version uint32 `protobuf:"varint,2,opt,name=version,proto3" json:"version,omitempty"` @@ -1543,8 +1549,8 @@ type SearchResponse struct { // message transport and does not affect request execution. MetaHeader *grpc.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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. + // 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,proto3" json:"verify_header,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -1605,9 +1611,9 @@ func (m *SearchResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { return nil } -// Response body +// Object Search response body type SearchResponse_Body struct { - // Carries list of object identifiers that match the search query + // List of `ObjectID`s that match the search query IdList []*grpc1.ObjectID `protobuf:"bytes,1,rep,name=id_list,json=idList,proto3" json:"id_list,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -1654,11 +1660,11 @@ func (m *SearchResponse_Body) GetIdList() []*grpc1.ObjectID { return nil } -// Range groups the parameters of object payload range. +// Object payload range.Ranges of zero length SHOULD be considered as invalid. type Range struct { - // Carries the offset of the range from the object payload start. + // Offset of the range from the object payload start Offset uint64 `protobuf:"varint,1,opt,name=offset,proto3" json:"offset,omitempty"` - // Carries the length of the object payload range. + // Length in bytes of the object payload range Length uint64 `protobuf:"varint,2,opt,name=length,proto3" json:"length,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -1712,15 +1718,16 @@ func (m *Range) GetLength() uint64 { return 0 } -// Request to get part of object's payload +// Request part of object's payload type GetRangeRequest struct { // Body of get range object request message. Body *GetRangeRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` - // Carries request meta information. Header data is used only to regulate message - // transport and does not affect request execution. + // 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,proto3" 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. + // 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,proto3" json:"verify_header,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -1781,11 +1788,11 @@ func (m *GetRangeRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { return nil } -// Request Body +// Byte range of object's payload request body type GetRangeRequest_Body struct { - // Address carries address of the object that contains the requested payload range. + // Address of the object containing the requested payload range Address *grpc1.Address `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` - // Range carries the parameters of the requested payload range. + // Requested payload range Range *Range `protobuf:"bytes,2,opt,name=range,proto3" json:"range,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -1847,8 +1854,8 @@ type GetRangeResponse struct { // message transport and does not affect request execution. MetaHeader *grpc.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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. + // 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,proto3" json:"verify_header,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -1909,9 +1916,12 @@ func (m *GetRangeResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { return nil } -// Response body +// Get Range response body uses streams to transfer the response. Because +// object payload considered a byte sequence, there is no need to have some +// initial preamble message. The requested byte range is sent as a series +// chunks. type GetRangeResponse_Body struct { - // Carries part of the object payload. + // Chunked object payload's range Chunk []byte `protobuf:"bytes,1,opt,name=chunk,proto3" json:"chunk,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -1962,11 +1972,12 @@ func (m *GetRangeResponse_Body) GetChunk() []byte { type GetRangeHashRequest struct { // Body of get range hash object request message. Body *GetRangeHashRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` - // Carries request meta information. Header data is used only to regulate message - // transport and does not affect request execution. + // 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,proto3" 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. + // 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,proto3" json:"verify_header,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -2027,13 +2038,13 @@ func (m *GetRangeHashRequest) GetVerifyHeader() *grpc.RequestVerificationHeader return nil } -// Request body +// Get hash of object's payload part request body. type GetRangeHashRequest_Body struct { - // Carries address of the object that contains the requested payload range. + // Address of the object that containing the requested payload range Address *grpc1.Address `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` - // Carries the list of object payload range to calculate homomorphic hash. + // List of object's payload ranges to calculate homomorphic hash Ranges []*Range `protobuf:"bytes,2,rep,name=ranges,proto3" json:"ranges,omitempty"` - // Carries binary salt to XOR object payload ranges before hash calculation. + // Binary salt to XOR object's payload ranges before hash calculation Salt []byte `protobuf:"bytes,3,opt,name=salt,proto3" json:"salt,omitempty"` // Checksum algorithm type Type grpc1.ChecksumType `protobuf:"varint,4,opt,name=type,proto3,enum=neo.fs.v2.refs.ChecksumType" json:"type,omitempty"` @@ -2111,8 +2122,8 @@ type GetRangeHashResponse struct { // message transport and does not affect request execution. MetaHeader *grpc.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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. + // 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,proto3" json:"verify_header,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -2173,11 +2184,11 @@ func (m *GetRangeHashResponse) GetVerifyHeader() *grpc.ResponseVerificationHeade return nil } -// Response body +// Get hash of object's payload part response body. type GetRangeHashResponse_Body struct { // Checksum algorithm type Type grpc1.ChecksumType `protobuf:"varint,1,opt,name=type,proto3,enum=neo.fs.v2.refs.ChecksumType" json:"type,omitempty"` - // List of range hashes in a binary format. + // List of range hashes in a binary format HashList [][]byte `protobuf:"bytes,2,rep,name=hash_list,json=hashList,proto3" json:"hash_list,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -2366,37 +2377,40 @@ const _ = grpc2.SupportPackageIsVersion4 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type ObjectServiceClient interface { - // Get the object from container. Response uses gRPC stream. First response - // message carry object of requested address. Chunk messages are parts of - // the object's payload if it is needed. All messages except first carry - // chunks. Requested object can be restored by concatenation of object - // message payload and all chunks keeping receiving order. + // Receive full object structure, including Headers and payload. Response uses + // gRPC stream. First response message carries object with requested address. + // Chunk messages are parts of the object's payload if it is needed. All + // messages, except the first one, carry payload chunks. Requested object can + // be restored by concatenation of object message payload and all chunks + // keeping receiving order. Get(ctx context.Context, in *GetRequest, opts ...grpc2.CallOption) (ObjectService_GetClient, error) // Put the object into container. Request uses gRPC stream. First message - // SHOULD BE type of PutHeader. Container id and Owner id of object SHOULD - // BE set. Session token SHOULD BE obtained before put operation (see - // session package). Chunk messages considered by server as part of object - // payload. All messages except first SHOULD BE chunks. Chunk messages - // SHOULD BE sent in direct order of fragmentation. + // SHOULD be of PutHeader type. `ContainerID` and `OwnerID` of an object + // SHOULD be set. Session token SHOULD be obtained before `PUT` operation (see + // session package). Chunk messages are considered by server as a part of an + // object payload. All messages, except first one, SHOULD be payload chunks. + // Chunk messages SHOULD be sent in direct order of fragmentation. Put(ctx context.Context, opts ...grpc2.CallOption) (ObjectService_PutClient, error) - // Delete the object from a container + // Delete the object from a container. There is no immediate removal + // guarantee. Object will be marked for removal and deleted eventually. Delete(ctx context.Context, in *DeleteRequest, opts ...grpc2.CallOption) (*DeleteResponse, error) - // Head returns the object without data payload. Object in the - // response has system header only. If full headers flag is set, extended - // headers are also present. + // Returns the object Headers without data payload. By default full header is + // returned. If `main_only` request field is set, the short header with only + // the very minimal information would be returned instead. Head(ctx context.Context, in *HeadRequest, opts ...grpc2.CallOption) (*HeadResponse, error) - // Search objects in container. Version of query language format SHOULD BE - // set to 1. Search query represented in serialized format (see query - // package). + // Search objects in container. Search query allows to match by Object + // Header's filed values. Please see the corresponding NeoFS Technical + // Specification section for more details. Search(ctx context.Context, in *SearchRequest, opts ...grpc2.CallOption) (ObjectService_SearchClient, error) - // GetRange of data payload. Range is a pair (offset, length). - // Requested range can be restored by concatenation of all chunks - // keeping receiving order. + // Get byte range of data payload. Range is set as an (offset, length) tuple. + // Like in `Get` method, the response uses gRPC stream. Requested range can be + // restored by concatenation of all received payload chunks keeping receiving + // order. GetRange(ctx context.Context, in *GetRangeRequest, opts ...grpc2.CallOption) (ObjectService_GetRangeClient, error) - // GetRangeHash returns homomorphic hash of object payload range after XOR - // operation. Ranges are set of pairs (offset, length). Hashes order in - // response corresponds to ranges order in request. Homomorphic hash is - // calculated for XORed data. + // Returns homomorphic or regular hash of object's payload range after + // applying XOR operation with the provided `salt`. Ranges are set of (offset, + // length) tuples. Hashes order in response corresponds to ranges order in + // request. Note that hash is calculated for XORed data. GetRangeHash(ctx context.Context, in *GetRangeHashRequest, opts ...grpc2.CallOption) (*GetRangeHashResponse, error) } @@ -2567,37 +2581,40 @@ func (c *objectServiceClient) GetRangeHash(ctx context.Context, in *GetRangeHash // ObjectServiceServer is the server API for ObjectService service. type ObjectServiceServer interface { - // Get the object from container. Response uses gRPC stream. First response - // message carry object of requested address. Chunk messages are parts of - // the object's payload if it is needed. All messages except first carry - // chunks. Requested object can be restored by concatenation of object - // message payload and all chunks keeping receiving order. + // Receive full object structure, including Headers and payload. Response uses + // gRPC stream. First response message carries object with requested address. + // Chunk messages are parts of the object's payload if it is needed. All + // messages, except the first one, carry payload chunks. Requested object can + // be restored by concatenation of object message payload and all chunks + // keeping receiving order. Get(*GetRequest, ObjectService_GetServer) error // Put the object into container. Request uses gRPC stream. First message - // SHOULD BE type of PutHeader. Container id and Owner id of object SHOULD - // BE set. Session token SHOULD BE obtained before put operation (see - // session package). Chunk messages considered by server as part of object - // payload. All messages except first SHOULD BE chunks. Chunk messages - // SHOULD BE sent in direct order of fragmentation. + // SHOULD be of PutHeader type. `ContainerID` and `OwnerID` of an object + // SHOULD be set. Session token SHOULD be obtained before `PUT` operation (see + // session package). Chunk messages are considered by server as a part of an + // object payload. All messages, except first one, SHOULD be payload chunks. + // Chunk messages SHOULD be sent in direct order of fragmentation. Put(ObjectService_PutServer) error - // Delete the object from a container + // Delete the object from a container. There is no immediate removal + // guarantee. Object will be marked for removal and deleted eventually. Delete(context.Context, *DeleteRequest) (*DeleteResponse, error) - // Head returns the object without data payload. Object in the - // response has system header only. If full headers flag is set, extended - // headers are also present. + // Returns the object Headers without data payload. By default full header is + // returned. If `main_only` request field is set, the short header with only + // the very minimal information would be returned instead. Head(context.Context, *HeadRequest) (*HeadResponse, error) - // Search objects in container. Version of query language format SHOULD BE - // set to 1. Search query represented in serialized format (see query - // package). + // Search objects in container. Search query allows to match by Object + // Header's filed values. Please see the corresponding NeoFS Technical + // Specification section for more details. Search(*SearchRequest, ObjectService_SearchServer) error - // GetRange of data payload. Range is a pair (offset, length). - // Requested range can be restored by concatenation of all chunks - // keeping receiving order. + // Get byte range of data payload. Range is set as an (offset, length) tuple. + // Like in `Get` method, the response uses gRPC stream. Requested range can be + // restored by concatenation of all received payload chunks keeping receiving + // order. GetRange(*GetRangeRequest, ObjectService_GetRangeServer) error - // GetRangeHash returns homomorphic hash of object payload range after XOR - // operation. Ranges are set of pairs (offset, length). Hashes order in - // response corresponds to ranges order in request. Homomorphic hash is - // calculated for XORed data. + // Returns homomorphic or regular hash of object's payload range after + // applying XOR operation with the provided `salt`. Ranges are set of (offset, + // length) tuples. Hashes order in response corresponds to ranges order in + // request. Note that hash is calculated for XORed data. GetRangeHash(context.Context, *GetRangeHashRequest) (*GetRangeHashResponse, error) } diff --git a/v2/object/grpc/types.pb.go b/v2/object/grpc/types.pb.go index 646ee2d..bd1dfd4 100644 --- a/v2/object/grpc/types.pb.go +++ b/v2/object/grpc/types.pb.go @@ -24,7 +24,7 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package -// Type of the object payload content +// Type of the object payload content. type ObjectType int32 const ( @@ -32,7 +32,7 @@ const ( ObjectType_REGULAR ObjectType = 0 // Used internally to identify deleted objects ObjectType_TOMBSTONE ObjectType = 1 - // Identifies that the object holds StorageGroup information + // StorageGroup information ObjectType_STORAGE_GROUP ObjectType = 2 ) @@ -86,16 +86,17 @@ func (MatchType) EnumDescriptor() ([]byte, []int) { // Short header fields type ShortHeader struct { - // Object format version. + // Object format version. Effectively the version of API library used to + // create particular object Version *grpc.Version `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` // Epoch when the object was created CreationEpoch uint64 `protobuf:"varint,2,opt,name=creation_epoch,json=creationEpoch,proto3" json:"creation_epoch,omitempty"` // Object's owner - OwnerId *grpc.OwnerID `protobuf:"bytes,3,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"` + OwnerId *grpc.OwnerID `protobuf:"bytes,3,opt,name=owner_id,json=ownerID,proto3" json:"owner_id,omitempty"` // Type of the object payload content ObjectType ObjectType `protobuf:"varint,4,opt,name=object_type,json=objectType,proto3,enum=neo.fs.v2.object.ObjectType" json:"object_type,omitempty"` // Size of payload in bytes. - // 0xFFFFFFFFFFFFFFFF means `payload_length` is unknown + // `0xFFFFFFFFFFFFFFFF` means `payload_length` is unknown PayloadLength uint64 `protobuf:"varint,5,opt,name=payload_length,json=payloadLength,proto3" json:"payload_length,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -170,32 +171,32 @@ func (m *ShortHeader) GetPayloadLength() uint64 { return 0 } -// Object Headers +// Object Header type Header struct { - // Object format version. - // Effectively the version of API library used to create particular object + // Object format version. Effectively the version of API library used to + // create particular object Version *grpc.Version `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` // Object's container - ContainerId *grpc.ContainerID `protobuf:"bytes,2,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` + ContainerId *grpc.ContainerID `protobuf:"bytes,2,opt,name=container_id,json=containerID,proto3" json:"container_id,omitempty"` // Object's owner - OwnerId *grpc.OwnerID `protobuf:"bytes,3,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"` + OwnerId *grpc.OwnerID `protobuf:"bytes,3,opt,name=owner_id,json=ownerID,proto3" json:"owner_id,omitempty"` // Object creation Epoch CreationEpoch uint64 `protobuf:"varint,4,opt,name=creation_epoch,json=creationEpoch,proto3" json:"creation_epoch,omitempty"` // Size of payload in bytes. - // 0xFFFFFFFFFFFFFFFF means `payload_length` is unknown + // `0xFFFFFFFFFFFFFFFF` means `payload_length` is unknown PayloadLength uint64 `protobuf:"varint,5,opt,name=payload_length,json=payloadLength,proto3" json:"payload_length,omitempty"` // Hash of payload bytes PayloadHash *grpc.Checksum `protobuf:"bytes,6,opt,name=payload_hash,json=payloadHash,proto3" json:"payload_hash,omitempty"` - // Special object type + // Type of the object payload content ObjectType ObjectType `protobuf:"varint,7,opt,name=object_type,json=objectType,proto3,enum=neo.fs.v2.object.ObjectType" json:"object_type,omitempty"` // Homomorphic hash of the object payload. HomomorphicHash *grpc.Checksum `protobuf:"bytes,8,opt,name=homomorphic_hash,json=homomorphicHash,proto3" json:"homomorphic_hash,omitempty"` - // Session token, if it was used during Object creation. - // Need it to verify integrity and authenticity out of Request scope. + // Session token, if it was used during Object creation. Need it to verify + // integrity and authenticity out of Request scope. SessionToken *grpc1.SessionToken `protobuf:"bytes,9,opt,name=session_token,json=sessionToken,proto3" json:"session_token,omitempty"` // User-defined object attributes Attributes []*Header_Attribute `protobuf:"bytes,10,rep,name=attributes,proto3" json:"attributes,omitempty"` - // Position of the object in the split hierarchy. + // Position of the object in the split hierarchy Split *Header_Split `protobuf:"bytes,11,opt,name=split,proto3" json:"split,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -312,7 +313,17 @@ func (m *Header) GetSplit() *Header_Split { return nil } -// Attribute groups the user-defined Key-Value pairs attached to the object +// `Attribute` is a user-defined Key-Value metadata pair attached to the +// object. +// +// There are some "well-known" attributes starting with `__NEOFS__` prefix +// that affect system behaviour: +// +// * __NEOFS__UPLOAD_ID +// * __NEOFS__EXPIRATION_EPOCH +// +// For detailed description of each well-known attribute please see the +// corresponding section in NeoFS Technical specification. type Header_Attribute struct { // string key to the object attribute Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` @@ -370,19 +381,20 @@ func (m *Header_Attribute) GetValue() string { return "" } -// Information about spawning the objects through a payload splitting. +// Bigger objects can be split into a chain of smaller objects. Information +// about inter-dependencies between spawned objects and how to re-construct +// the original one is in the `Split` headers. Parent and children objects +// must be within the same container. type Header_Split struct { - // Identifier of the origin object. - // Parent and children objects must be within the same container. - // Parent object_id is known only to the minor child. + // Identifier of the origin object. Known only to the minor child. Parent *grpc.ObjectID `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"` - // Previous carries identifier of the left split neighbor. + // Identifier of the left split neighbor Previous *grpc.ObjectID `protobuf:"bytes,2,opt,name=previous,proto3" json:"previous,omitempty"` // `signature` field of the parent object. Used to reconstruct parent. ParentSignature *grpc.Signature `protobuf:"bytes,3,opt,name=parent_signature,json=parentSignature,proto3" json:"parent_signature,omitempty"` // `header` field of the parent object. Used to reconstruct parent. ParentHeader *Header `protobuf:"bytes,4,opt,name=parent_header,json=parentHeader,proto3" json:"parent_header,omitempty"` - // Children carries list of identifiers of the objects generated by splitting the current. + // List of identifiers of the objects generated by splitting current one. Children []*grpc.ObjectID `protobuf:"bytes,5,rep,name=children,proto3" json:"children,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -457,13 +469,12 @@ func (m *Header_Split) GetChildren() []*grpc.ObjectID { return nil } -// Object structure. +// Object structure. Object is immutable and content-addressed. It means +// `ObjectID` will change if header or payload changes. It's calculated as a +// hash of header field, which contains hash of object's payload. type Object struct { // Object's unique identifier. - // Object is content-addressed. It means id will change if header or payload - // changes. It's calculated as a hash of header field, which contains hash of - // object's payload - ObjectId *grpc.ObjectID `protobuf:"bytes,1,opt,name=object_id,json=objectId,proto3" json:"object_id,omitempty"` + ObjectId *grpc.ObjectID `protobuf:"bytes,1,opt,name=object_id,json=objectID,proto3" json:"object_id,omitempty"` // Signed object_id Signature *grpc.Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` // Object metadata headers @@ -549,57 +560,57 @@ func init() { func init() { proto.RegisterFile("v2/object/grpc/types.proto", fileDescriptor_545319325da7b9b1) } var fileDescriptor_545319325da7b9b1 = []byte{ - // 796 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x95, 0xdd, 0x6e, 0xe3, 0x44, - 0x14, 0xc7, 0xeb, 0xb4, 0xf9, 0x3a, 0x4e, 0x76, 0xcd, 0x80, 0xc0, 0x64, 0x51, 0xa8, 0x2a, 0x21, - 0x55, 0x2b, 0xd5, 0x06, 0x6f, 0xd1, 0x0a, 0x55, 0x8b, 0x94, 0x36, 0xde, 0xd6, 0x52, 0xdb, 0x94, - 0xb1, 0x8b, 0x04, 0x37, 0x96, 0x6b, 0x4f, 0x63, 0xd3, 0xd4, 0x63, 0x79, 0x26, 0x46, 0xbd, 0xe4, - 0x2d, 0x78, 0x86, 0x7d, 0x0e, 0x2e, 0xb8, 0xe4, 0x11, 0x56, 0xe5, 0x45, 0x90, 0x67, 0xec, 0xf4, - 0x23, 0xbb, 0x04, 0xf6, 0xca, 0xf6, 0x99, 0xdf, 0xff, 0xcc, 0xf9, 0x9f, 0x39, 0x23, 0xc3, 0xa0, - 0xb0, 0x4c, 0x7a, 0xf1, 0x0b, 0x09, 0xb9, 0x39, 0xcd, 0xb3, 0xd0, 0xe4, 0x37, 0x19, 0x61, 0x46, - 0x96, 0x53, 0x4e, 0x91, 0x96, 0x12, 0x6a, 0x5c, 0x32, 0xa3, 0xb0, 0x0c, 0x89, 0x0c, 0xf4, 0xc2, - 0x32, 0x73, 0x72, 0xc9, 0x96, 0xd8, 0xc1, 0xb3, 0xc2, 0x32, 0x19, 0x61, 0x2c, 0xa1, 0xe9, 0xd2, - 0xe2, 0xd6, 0x6f, 0x0d, 0x50, 0xdd, 0x98, 0xe6, 0xfc, 0x88, 0x04, 0x11, 0xc9, 0xd1, 0x37, 0xd0, - 0x2e, 0x48, 0x5e, 0xb2, 0xba, 0xb2, 0xa9, 0x6c, 0xab, 0xd6, 0x67, 0xc6, 0xdd, 0x56, 0x65, 0x7e, - 0xe3, 0x47, 0xb9, 0x8c, 0x6b, 0x0e, 0x7d, 0x05, 0x4f, 0xc2, 0x9c, 0x04, 0x3c, 0xa1, 0xa9, 0x4f, - 0x32, 0x1a, 0xc6, 0x7a, 0x63, 0x53, 0xd9, 0xde, 0xc0, 0xfd, 0x3a, 0x6a, 0x97, 0x41, 0x64, 0x41, - 0x87, 0xfe, 0x9a, 0x92, 0xdc, 0x4f, 0x22, 0x7d, 0xfd, 0xdd, 0xa9, 0x27, 0xe5, 0xba, 0x33, 0xc6, - 0x6d, 0x01, 0x3a, 0x11, 0x7a, 0x05, 0xaa, 0xb4, 0xe7, 0x97, 0x35, 0xeb, 0x1b, 0x9b, 0xca, 0xf6, - 0x13, 0xeb, 0x0b, 0xe3, 0xb1, 0x79, 0x63, 0x22, 0x1e, 0xde, 0x4d, 0x46, 0x30, 0xd0, 0xc5, 0x7b, - 0x59, 0x59, 0x16, 0xdc, 0xcc, 0x68, 0x10, 0xf9, 0x33, 0x92, 0x4e, 0x79, 0xac, 0x37, 0x65, 0x65, - 0x55, 0xf4, 0x58, 0x04, 0xb7, 0xde, 0xb6, 0xa1, 0xf5, 0xe1, 0xf6, 0xbf, 0x87, 0x5e, 0x48, 0x53, - 0x1e, 0x24, 0x95, 0xb7, 0x86, 0xd0, 0x3d, 0x7b, 0xac, 0x3b, 0xa8, 0x19, 0x67, 0x8c, 0xd5, 0x85, - 0xc0, 0x89, 0x3e, 0xa8, 0x2f, 0xcb, 0x2d, 0xdf, 0x78, 0x57, 0xcb, 0xff, 0x9b, 0x7f, 0xb4, 0x07, - 0xbd, 0x1a, 0x8b, 0x03, 0x16, 0xeb, 0x2d, 0x51, 0x85, 0xbe, 0xe4, 0x20, 0x26, 0xe1, 0x15, 0x9b, - 0x5f, 0x63, 0xb5, 0xa2, 0x8f, 0x02, 0x16, 0x3f, 0x3e, 0xa2, 0xf6, 0xff, 0x3c, 0xa2, 0x03, 0xd0, - 0x62, 0x7a, 0x4d, 0xaf, 0x69, 0x9e, 0xc5, 0x49, 0x28, 0xf7, 0xef, 0xac, 0xd8, 0xff, 0xe9, 0x3d, - 0x85, 0xa8, 0x61, 0x0c, 0xfd, 0x6a, 0xc0, 0x7d, 0x4e, 0xaf, 0x48, 0xaa, 0x77, 0x45, 0x86, 0x2f, - 0xef, 0x65, 0xa8, 0xd6, 0x0d, 0x57, 0x3e, 0xbd, 0x12, 0xc3, 0x3d, 0x76, 0xef, 0x0b, 0xed, 0x03, - 0x04, 0x9c, 0xe7, 0xc9, 0xc5, 0x9c, 0x13, 0xa6, 0xc3, 0xe6, 0xfa, 0xb6, 0x6a, 0x6d, 0x2d, 0x1b, - 0x91, 0x93, 0x62, 0x8c, 0x6a, 0x14, 0xdf, 0x53, 0xa1, 0x5d, 0x68, 0xb2, 0x6c, 0x96, 0x70, 0x5d, - 0x15, 0x15, 0x0c, 0xdf, 0x2b, 0x77, 0x4b, 0x0a, 0x4b, 0x78, 0xf0, 0x02, 0xba, 0x8b, 0x74, 0x48, - 0x83, 0xf5, 0x2b, 0x72, 0x23, 0xc6, 0xaf, 0x8b, 0xcb, 0x57, 0xf4, 0x09, 0x34, 0x8b, 0x60, 0x36, - 0x27, 0x62, 0xb4, 0xba, 0x58, 0x7e, 0x0c, 0xde, 0x34, 0xa0, 0x29, 0xb2, 0xa0, 0xaf, 0xa1, 0x95, - 0x05, 0x39, 0x49, 0x79, 0x35, 0xb3, 0x4b, 0x9d, 0x93, 0xbd, 0x77, 0xc6, 0xb8, 0xe2, 0xd0, 0x2e, - 0x74, 0xb2, 0x9c, 0x14, 0x09, 0x9d, 0xb3, 0x6a, 0x5e, 0xdf, 0xaf, 0x59, 0x90, 0x68, 0x0c, 0x9a, - 0xd4, 0xfb, 0x2c, 0x99, 0xa6, 0x01, 0x9f, 0xe7, 0xa4, 0x9a, 0xd8, 0xcf, 0x1f, 0xab, 0xdd, 0x1a, - 0xc0, 0x4f, 0xa5, 0x64, 0x11, 0x40, 0xaf, 0xa0, 0x5f, 0x65, 0x89, 0x45, 0x2b, 0xc4, 0xe8, 0x3e, - 0x2c, 0xe0, 0x41, 0xab, 0x70, 0x4f, 0xe2, 0xd5, 0x0d, 0xdd, 0x85, 0x4e, 0x18, 0x27, 0xb3, 0x28, - 0x27, 0xa9, 0xde, 0x14, 0x67, 0xf4, 0x2f, 0xa5, 0xd7, 0xe4, 0xd6, 0x1f, 0x0a, 0xb4, 0x64, 0x18, - 0x7d, 0x0b, 0xdd, 0x6a, 0x60, 0x93, 0x68, 0x65, 0xc3, 0x3a, 0x12, 0x75, 0x22, 0xf4, 0x12, 0xba, - 0x77, 0xae, 0x1b, 0xab, 0x5c, 0xdf, 0xb1, 0xe5, 0xe9, 0x54, 0x46, 0xd7, 0x57, 0x18, 0xad, 0x38, - 0xa4, 0x43, 0xbb, 0xba, 0x61, 0xa2, 0x37, 0x3d, 0x5c, 0x7f, 0x3e, 0xdf, 0x03, 0xb8, 0xbb, 0x47, - 0x48, 0x85, 0x36, 0xb6, 0x0f, 0xcf, 0x8f, 0x47, 0x58, 0x5b, 0x43, 0x7d, 0xe8, 0x7a, 0x93, 0x93, - 0x7d, 0xd7, 0x9b, 0x9c, 0xda, 0x9a, 0x82, 0x3e, 0x82, 0xbe, 0xeb, 0x4d, 0xf0, 0xe8, 0xd0, 0xf6, - 0x0f, 0xf1, 0xe4, 0xfc, 0x4c, 0x6b, 0x3c, 0xff, 0x0e, 0xba, 0x27, 0x01, 0x0f, 0x63, 0xa1, 0x1d, - 0xc0, 0xa7, 0x27, 0x23, 0xef, 0xe0, 0xc8, 0xf7, 0x7e, 0x3a, 0xb3, 0xfd, 0xf3, 0x53, 0xf7, 0xcc, - 0x3e, 0x70, 0x5e, 0x3b, 0xf6, 0x58, 0x5b, 0x43, 0x1a, 0xf4, 0x5c, 0x0f, 0x3b, 0xa7, 0x87, 0xbe, - 0xfd, 0xc3, 0xf9, 0xe8, 0x58, 0x53, 0xf6, 0xfd, 0x3f, 0x6f, 0x87, 0xca, 0x5f, 0xb7, 0x43, 0xe5, - 0xed, 0xed, 0x50, 0xf9, 0xfd, 0xef, 0xe1, 0xda, 0xcf, 0x2f, 0xa7, 0x09, 0x8f, 0xe7, 0x17, 0x46, - 0x48, 0xaf, 0xcd, 0x94, 0x65, 0x61, 0xb8, 0x13, 0x91, 0xc2, 0x4c, 0x09, 0xbd, 0x64, 0x3b, 0x41, - 0x96, 0xec, 0x4c, 0xa9, 0xf9, 0xf0, 0xf7, 0xb5, 0x27, 0xdf, 0xdf, 0x34, 0x3e, 0x3e, 0x25, 0xf4, - 0xb5, 0x6b, 0x8c, 0xce, 0x9c, 0xb2, 0x03, 0xd2, 0xce, 0x45, 0x4b, 0xfc, 0x8d, 0x5e, 0xfc, 0x13, - 0x00, 0x00, 0xff, 0xff, 0x2c, 0x8c, 0x1d, 0x72, 0xf4, 0x06, 0x00, 0x00, + // 793 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x55, 0xdd, 0x6e, 0xe3, 0x44, + 0x14, 0xae, 0xd3, 0xe6, 0xef, 0x38, 0xd9, 0x35, 0x03, 0x02, 0x93, 0x45, 0xa1, 0xaa, 0x84, 0x54, + 0xad, 0x54, 0x1b, 0xbc, 0x45, 0x2b, 0x54, 0x2d, 0x52, 0xda, 0x78, 0xdb, 0x48, 0x6d, 0x53, 0xc6, + 0x2e, 0x12, 0xdc, 0x58, 0xae, 0x33, 0x8d, 0x4d, 0x53, 0x8f, 0xe5, 0x99, 0x18, 0xf5, 0x92, 0xb7, + 0xe0, 0x19, 0xf6, 0x39, 0xb8, 0xe0, 0x92, 0x47, 0x58, 0x95, 0x17, 0x41, 0x9e, 0x19, 0x37, 0x6d, + 0xb3, 0x4b, 0x60, 0xaf, 0x7c, 0xe6, 0xcc, 0xf7, 0x9d, 0x39, 0xdf, 0x37, 0x67, 0x64, 0xe8, 0x15, + 0x8e, 0x4d, 0x2f, 0x7e, 0x21, 0x11, 0xb7, 0xa7, 0x79, 0x16, 0xd9, 0xfc, 0x26, 0x23, 0xcc, 0xca, + 0x72, 0xca, 0x29, 0x32, 0x52, 0x42, 0xad, 0x4b, 0x66, 0x15, 0x8e, 0x25, 0x21, 0x3d, 0xb3, 0x70, + 0xec, 0x9c, 0x5c, 0xb2, 0x25, 0x6c, 0xef, 0x59, 0xe1, 0xd8, 0x8c, 0x30, 0x96, 0xd0, 0x74, 0x69, + 0x73, 0xeb, 0xb7, 0x1a, 0xe8, 0x5e, 0x4c, 0x73, 0x7e, 0x44, 0xc2, 0x09, 0xc9, 0xd1, 0x37, 0xd0, + 0x2c, 0x48, 0x5e, 0x62, 0x4d, 0x6d, 0x53, 0xdb, 0xd6, 0x9d, 0xcf, 0xac, 0xc5, 0x51, 0x65, 0x7d, + 0xeb, 0x47, 0xb9, 0x8d, 0x2b, 0x1c, 0xfa, 0x0a, 0x9e, 0x44, 0x39, 0x09, 0x79, 0x42, 0xd3, 0x80, + 0x64, 0x34, 0x8a, 0xcd, 0xda, 0xa6, 0xb6, 0xbd, 0x81, 0xbb, 0x55, 0xd6, 0x2d, 0x93, 0xc8, 0x81, + 0x16, 0xfd, 0x35, 0x25, 0x79, 0x90, 0x4c, 0xcc, 0xf5, 0x77, 0x97, 0x1e, 0x97, 0xfb, 0xa3, 0x21, + 0x6e, 0x52, 0x19, 0xa0, 0x57, 0xa0, 0x4b, 0x79, 0x41, 0xd9, 0xb3, 0xb9, 0xb1, 0xa9, 0x6d, 0x3f, + 0x71, 0xbe, 0xb0, 0x1e, 0x8b, 0xb7, 0xc6, 0xe2, 0xe3, 0xdf, 0x64, 0x04, 0x03, 0xbd, 0x8b, 0xcb, + 0xce, 0xb2, 0xf0, 0x66, 0x46, 0xc3, 0x49, 0x30, 0x23, 0xe9, 0x94, 0xc7, 0x66, 0x5d, 0x76, 0xa6, + 0xb2, 0xc7, 0x22, 0xb9, 0xf5, 0xb6, 0x09, 0x8d, 0x0f, 0x97, 0xff, 0x3d, 0x74, 0x22, 0x9a, 0xf2, + 0x30, 0x51, 0xda, 0x6a, 0x82, 0xf7, 0xec, 0x31, 0xef, 0xa0, 0xc2, 0x8c, 0x86, 0x58, 0x8f, 0x16, + 0x8b, 0x0f, 0xf2, 0x65, 0xd9, 0xf2, 0x8d, 0x77, 0x59, 0xfe, 0xdf, 0xf4, 0xa3, 0x3d, 0xe8, 0x54, + 0xb0, 0x38, 0x64, 0xb1, 0xd9, 0x10, 0x5d, 0x98, 0x4b, 0x0a, 0x62, 0x12, 0x5d, 0xb1, 0xf9, 0x35, + 0xd6, 0x15, 0xfa, 0x28, 0x64, 0xf1, 0xe3, 0x2b, 0x6a, 0xfe, 0xcf, 0x2b, 0x3a, 0x00, 0x23, 0xa6, + 0xd7, 0xf4, 0x9a, 0xe6, 0x59, 0x9c, 0x44, 0xf2, 0xfc, 0xd6, 0x8a, 0xf3, 0x9f, 0xde, 0x63, 0x88, + 0x1e, 0x86, 0xd0, 0x55, 0x03, 0x1e, 0x70, 0x7a, 0x45, 0x52, 0xb3, 0x2d, 0x2a, 0x7c, 0x79, 0xaf, + 0x82, 0xda, 0xb7, 0x3c, 0xf9, 0xf5, 0x4b, 0x18, 0xee, 0xb0, 0x7b, 0x2b, 0xb4, 0x0f, 0x10, 0x72, + 0x9e, 0x27, 0x17, 0x73, 0x4e, 0x98, 0x09, 0x9b, 0xeb, 0xdb, 0xba, 0xb3, 0xb5, 0x2c, 0x44, 0x4e, + 0x8a, 0x35, 0xa8, 0xa0, 0xf8, 0x1e, 0x0b, 0xed, 0x42, 0x9d, 0x65, 0xb3, 0x84, 0x9b, 0xba, 0xe8, + 0xa0, 0xff, 0x5e, 0xba, 0x57, 0xa2, 0xb0, 0x04, 0xf7, 0x5e, 0x40, 0xfb, 0xae, 0x1c, 0x32, 0x60, + 0xfd, 0x8a, 0xdc, 0x88, 0xf1, 0x6b, 0xe3, 0x32, 0x44, 0x9f, 0x40, 0xbd, 0x08, 0x67, 0x73, 0x22, + 0x46, 0xab, 0x8d, 0xe5, 0xa2, 0xf7, 0xa6, 0x06, 0x75, 0x51, 0x05, 0x7d, 0x0d, 0x8d, 0x2c, 0xcc, + 0x49, 0xca, 0xd5, 0xcc, 0x2e, 0x39, 0x27, 0xbd, 0x1f, 0x0d, 0xb1, 0xc2, 0xa1, 0x5d, 0x68, 0x65, + 0x39, 0x29, 0x12, 0x3a, 0x67, 0x6a, 0x5e, 0xdf, 0xcf, 0xb9, 0x43, 0xa2, 0x21, 0x18, 0x92, 0x1f, + 0xb0, 0x64, 0x9a, 0x86, 0x7c, 0x9e, 0x13, 0x35, 0xb1, 0x9f, 0x3f, 0x66, 0x7b, 0x15, 0x00, 0x3f, + 0x95, 0x94, 0xbb, 0x04, 0x7a, 0x05, 0x5d, 0x55, 0x25, 0x16, 0x56, 0x88, 0xd1, 0x7d, 0xd8, 0xc0, + 0x03, 0xab, 0x70, 0x47, 0xc2, 0xd5, 0x0b, 0xdd, 0x85, 0x56, 0x14, 0x27, 0xb3, 0x49, 0x4e, 0x52, + 0xb3, 0x2e, 0xee, 0xe8, 0x5f, 0x5a, 0xaf, 0x90, 0x5b, 0x7f, 0x68, 0xd0, 0x90, 0x69, 0xf4, 0x2d, + 0xb4, 0xd5, 0xc0, 0x26, 0x93, 0x95, 0x86, 0xb5, 0xa8, 0x8a, 0xd0, 0x4b, 0x68, 0x2f, 0x54, 0xd7, + 0x56, 0xa9, 0x5e, 0x60, 0xcb, 0xdb, 0x51, 0x42, 0xd7, 0x57, 0x08, 0x55, 0x38, 0x64, 0x42, 0x53, + 0xbd, 0x30, 0xe1, 0x4d, 0x07, 0x57, 0xcb, 0xe7, 0x7b, 0x00, 0x8b, 0x77, 0x84, 0x74, 0x68, 0x62, + 0xf7, 0xf0, 0xfc, 0x78, 0x80, 0x8d, 0x35, 0xd4, 0x85, 0xb6, 0x3f, 0x3e, 0xd9, 0xf7, 0xfc, 0xf1, + 0xa9, 0x6b, 0x68, 0xe8, 0x23, 0xe8, 0x7a, 0xfe, 0x18, 0x0f, 0x0e, 0xdd, 0xe0, 0x10, 0x8f, 0xcf, + 0xcf, 0x8c, 0xda, 0xf3, 0xef, 0xa0, 0x7d, 0x12, 0xf2, 0x28, 0x16, 0xdc, 0x1e, 0x7c, 0x7a, 0x32, + 0xf0, 0x0f, 0x8e, 0x02, 0xff, 0xa7, 0x33, 0x37, 0x38, 0x3f, 0xf5, 0xce, 0xdc, 0x83, 0xd1, 0xeb, + 0x91, 0x3b, 0x34, 0xd6, 0x90, 0x01, 0x1d, 0xcf, 0xc7, 0xa3, 0xd3, 0xc3, 0xc0, 0xfd, 0xe1, 0x7c, + 0x70, 0x6c, 0x68, 0xfb, 0xc1, 0x9f, 0xb7, 0x7d, 0xed, 0xaf, 0xdb, 0xbe, 0xf6, 0xf6, 0xb6, 0xaf, + 0xfd, 0xfe, 0x77, 0x7f, 0xed, 0xe7, 0x97, 0xd3, 0x84, 0xc7, 0xf3, 0x0b, 0x2b, 0xa2, 0xd7, 0x76, + 0xca, 0xb2, 0x28, 0xda, 0x99, 0x90, 0xc2, 0x4e, 0x09, 0xbd, 0x64, 0x3b, 0x61, 0x96, 0xec, 0x4c, + 0xa9, 0xfd, 0xf0, 0xf7, 0xb5, 0x27, 0xe3, 0x37, 0xb5, 0x8f, 0x4f, 0x09, 0x7d, 0xed, 0x59, 0x83, + 0xb3, 0x51, 0xe9, 0x80, 0x94, 0x73, 0xd1, 0x10, 0x7f, 0xa3, 0x17, 0xff, 0x04, 0x00, 0x00, 0xff, + 0xff, 0x21, 0xf4, 0xc9, 0x66, 0xf4, 0x06, 0x00, 0x00, } func (m *ShortHeader) Marshal() (dAtA []byte, err error) { diff --git a/v2/refs/grpc/types.pb.go b/v2/refs/grpc/types.pb.go index 91878d0..fef3672 100644 --- a/v2/refs/grpc/types.pb.go +++ b/v2/refs/grpc/types.pb.go @@ -22,13 +22,13 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package -// Checksum algorithm type +// Checksum algorithm type. type ChecksumType int32 const ( // Unknown. Not used ChecksumType_CHECKSUM_TYPE_UNSPECIFIED ChecksumType = 0 - // Tillich-Zemor homomorphic hash funciton + // Tillich-Zemor homomorphic hash function ChecksumType_TZ ChecksumType = 1 // SHA-256 ChecksumType_SHA256 ChecksumType = 2 @@ -54,12 +54,13 @@ func (ChecksumType) EnumDescriptor() ([]byte, []int) { return fileDescriptor_08f084e5f91ec87c, []int{0} } -// Address of object (container id + object id) +// Object in NeoFS can be addressed by it's ContainerID and ObjectID. In string +// format there MUST be a '/' delimeter between them. type Address struct { - // container_id carries container identifier. - ContainerId *ContainerID `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` - // object_id carries object identifier. - ObjectId *ObjectID `protobuf:"bytes,2,opt,name=object_id,json=objectId,proto3" json:"object_id,omitempty"` + // Container identifier + ContainerId *ContainerID `protobuf:"bytes,1,opt,name=container_id,json=containerID,proto3" json:"container_id,omitempty"` + // Object identifier + ObjectId *ObjectID `protobuf:"bytes,2,opt,name=object_id,json=objectID,proto3" json:"object_id,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -112,9 +113,12 @@ func (m *Address) GetObjectId() *ObjectID { return nil } -// NeoFS object identifier. +// NeoFS Object unique identifier. Objects are immutable and content-addressed. +// It means `ObjectID` will change if `header` or `payload` changes. `ObjectID` +// is calculated as a hash of `header` field, which contains hash of object's +// payload. type ObjectID struct { - // value carries the object identifier in a binary format. + // Object identifier in a binary format Value []byte `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -161,9 +165,11 @@ func (m *ObjectID) GetValue() []byte { return nil } -// NeoFS container identifier. +// NeoFS container identifier. Container structures are immutable and +// content-addressed. `ContainerID` is a 32 byte long SHA256 hash of +// stable-marshalled container message. type ContainerID struct { - // value carries the container identifier in a binary format. + // Container identifier in a binary format. Value []byte `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -210,9 +216,11 @@ func (m *ContainerID) GetValue() []byte { return nil } -// OwnerID group information about the owner of the NeoFS container. +// OwnerID is a derivative of a user's main public key. The transformation +// algorithm is the same as for Neo3 wallet addresses. Neo3 wallet address can +// be directly used as `OwnerID`. type OwnerID struct { - // value carries the identifier of the container owner in a binary format. + // Identifier of the container owner in a binary format Value []byte `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -259,11 +267,11 @@ func (m *OwnerID) GetValue() []byte { return nil } -// Represents API version used by node. +// API version used by a node. type Version struct { - // Major API version. + // Major API version Major uint32 `protobuf:"varint,1,opt,name=major,proto3" json:"major,omitempty"` - // Minor API version. + // Minor API version Minor uint32 `protobuf:"varint,2,opt,name=minor,proto3" json:"minor,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -317,12 +325,12 @@ func (m *Version) GetMinor() uint32 { return 0 } -// Signature of something in NeoFS +// Signature of something in NeoFS. type Signature struct { - // Public key used for signing. + // Public key used for signing Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` // Signature - Sign []byte `protobuf:"bytes,2,opt,name=sign,proto3" json:"sign,omitempty"` + Sign []byte `protobuf:"bytes,2,opt,name=sign,json=signature,proto3" json:"sign,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -375,7 +383,7 @@ func (m *Signature) GetSign() []byte { return nil } -// Checksum message +// Checksum message. type Checksum struct { // Checksum algorithm type Type ChecksumType `protobuf:"varint,1,opt,name=type,proto3,enum=neo.fs.v2.refs.ChecksumType" json:"type,omitempty"` @@ -447,34 +455,34 @@ func init() { func init() { proto.RegisterFile("v2/refs/grpc/types.proto", fileDescriptor_08f084e5f91ec87c) } var fileDescriptor_08f084e5f91ec87c = []byte{ - // 427 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x92, 0xc1, 0x6e, 0xd3, 0x40, - 0x10, 0x86, 0xeb, 0x50, 0x92, 0x74, 0x12, 0xaa, 0xb0, 0xe2, 0x10, 0x04, 0x84, 0xca, 0x5c, 0x10, - 0x52, 0xd6, 0xe0, 0x2a, 0x5c, 0x90, 0x90, 0x82, 0x93, 0xaa, 0x16, 0x22, 0x8d, 0xec, 0x14, 0xa9, - 0xbd, 0x44, 0x8e, 0x3d, 0x71, 0xb7, 0x25, 0xbb, 0xd6, 0xae, 0x6d, 0x94, 0x1b, 0x8f, 0xc1, 0x33, - 0xf0, 0x24, 0x1c, 0x79, 0x04, 0x14, 0x5e, 0x04, 0xed, 0x26, 0x41, 0x01, 0x04, 0xb7, 0x7f, 0x46, - 0xdf, 0xb7, 0x63, 0x8f, 0x06, 0xda, 0xa5, 0xeb, 0x48, 0x9c, 0x2b, 0x27, 0x95, 0x59, 0xec, 0xe4, - 0xcb, 0x0c, 0x15, 0xcd, 0xa4, 0xc8, 0x05, 0x39, 0xe4, 0x28, 0xe8, 0x5c, 0xd1, 0xd2, 0xa5, 0x1a, - 0xb0, 0x3f, 0x59, 0x50, 0xeb, 0x27, 0x89, 0x44, 0xa5, 0xc8, 0x6b, 0x68, 0xc6, 0x82, 0xe7, 0x11, - 0xe3, 0x28, 0xa7, 0x2c, 0x69, 0x5b, 0x47, 0xd6, 0xd3, 0x86, 0xfb, 0x80, 0xfe, 0xae, 0x50, 0x6f, - 0xcb, 0xf8, 0x83, 0xa0, 0xf1, 0x4b, 0xf0, 0x13, 0xd2, 0x83, 0x03, 0x31, 0xbb, 0xc6, 0x38, 0xd7, - 0x72, 0xc5, 0xc8, 0xed, 0x3f, 0xe5, 0x33, 0x03, 0xf8, 0x83, 0xa0, 0xbe, 0x46, 0xfd, 0xc4, 0x3e, - 0x82, 0xfa, 0xb6, 0x4b, 0xee, 0xc1, 0xed, 0x32, 0xfa, 0x50, 0xa0, 0x99, 0xdd, 0x0c, 0xd6, 0x85, - 0xfd, 0x04, 0x1a, 0x3b, 0x43, 0xff, 0x01, 0x3d, 0x86, 0xda, 0xd9, 0xc7, 0xff, 0x01, 0x3d, 0xa8, - 0xbd, 0x47, 0xa9, 0x98, 0xe0, 0x1a, 0x58, 0x44, 0xd7, 0x42, 0x1a, 0xe0, 0x4e, 0xb0, 0x2e, 0x4c, - 0x97, 0x71, 0x21, 0xcd, 0xb7, 0xeb, 0xae, 0x2e, 0xec, 0x17, 0x70, 0x10, 0xb2, 0x94, 0x47, 0x79, - 0x21, 0x91, 0xb4, 0xe0, 0xd6, 0x0d, 0x2e, 0x37, 0xef, 0xea, 0x48, 0x08, 0xec, 0x2b, 0x96, 0x72, - 0xe3, 0x34, 0x03, 0x93, 0xed, 0x11, 0xd4, 0xbd, 0x2b, 0x8c, 0x6f, 0x54, 0xb1, 0x20, 0xcf, 0x61, - 0x5f, 0xef, 0xdf, 0x28, 0x87, 0xee, 0xc3, 0xbf, 0x96, 0xb9, 0xe1, 0x26, 0xcb, 0x0c, 0x03, 0x43, - 0xea, 0x19, 0xaa, 0x58, 0x6c, 0x1e, 0xd4, 0xf1, 0x59, 0x1f, 0x9a, 0xbb, 0x1c, 0x79, 0x04, 0xf7, - 0xbd, 0xd3, 0xa1, 0xf7, 0x36, 0x3c, 0x7f, 0x37, 0x9d, 0x5c, 0x8c, 0x87, 0xd3, 0xf3, 0x51, 0x38, - 0x1e, 0x7a, 0xfe, 0x89, 0x3f, 0x1c, 0xb4, 0xf6, 0x48, 0x15, 0x2a, 0x93, 0xcb, 0x96, 0x45, 0x00, - 0xaa, 0xe1, 0x69, 0xdf, 0xed, 0xbd, 0x6c, 0x55, 0xde, 0x5c, 0x7c, 0x5d, 0x75, 0xac, 0x6f, 0xab, - 0x8e, 0xf5, 0x7d, 0xd5, 0xb1, 0x3e, 0xff, 0xe8, 0xec, 0x5d, 0x1e, 0xa7, 0x2c, 0xbf, 0x2a, 0x66, - 0x34, 0x16, 0x0b, 0x87, 0xab, 0x2c, 0x8e, 0xbb, 0x09, 0x96, 0x0e, 0x47, 0x31, 0x57, 0xdd, 0x28, - 0x63, 0xdd, 0x54, 0x38, 0xbb, 0x57, 0xf4, 0x4a, 0xa7, 0x2f, 0x95, 0xbb, 0x23, 0x14, 0x27, 0x21, - 0xed, 0x8f, 0x7d, 0xfd, 0x0b, 0x01, 0xce, 0xd5, 0xac, 0x6a, 0x2e, 0xeb, 0xf8, 0x67, 0x00, 0x00, - 0x00, 0xff, 0xff, 0xbb, 0x23, 0xc5, 0xde, 0x75, 0x02, 0x00, 0x00, + // 428 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x92, 0xdf, 0x6a, 0x13, 0x41, + 0x14, 0xc6, 0xbb, 0xb1, 0xe6, 0xcf, 0x49, 0x2c, 0x71, 0x10, 0x8c, 0xa8, 0xb1, 0xac, 0x37, 0x22, + 0x64, 0x57, 0xb6, 0xa4, 0x37, 0x82, 0x10, 0x37, 0x29, 0x5d, 0xc4, 0x34, 0xec, 0xa6, 0x42, 0x7b, + 0x13, 0x36, 0x93, 0x93, 0xed, 0xb4, 0x66, 0x66, 0x99, 0xd9, 0x8d, 0xe4, 0xce, 0xc7, 0xf0, 0x19, + 0x7c, 0x12, 0x2f, 0x7d, 0x04, 0x89, 0x2f, 0x22, 0x33, 0xd9, 0x60, 0x54, 0xec, 0xdd, 0xf7, 0x1d, + 0x7e, 0xdf, 0x39, 0xf3, 0xe7, 0x40, 0x6b, 0xe9, 0xb9, 0x12, 0xe7, 0xca, 0x4d, 0x64, 0x4a, 0xdd, + 0x6c, 0x95, 0xa2, 0x72, 0x52, 0x29, 0x32, 0x41, 0x0e, 0x38, 0x0a, 0x67, 0xae, 0x9c, 0xa5, 0xe7, + 0x68, 0xc0, 0xfe, 0x6c, 0x41, 0xa5, 0x37, 0x9b, 0x49, 0x54, 0x8a, 0xbc, 0x81, 0x06, 0x15, 0x3c, + 0x8b, 0x19, 0x47, 0x39, 0x61, 0xb3, 0x96, 0x75, 0x68, 0xbd, 0xa8, 0x7b, 0x8f, 0x9d, 0x3f, 0x23, + 0x8e, 0xbf, 0x65, 0x82, 0x7e, 0x58, 0xa7, 0xbf, 0x0d, 0xe9, 0x42, 0x4d, 0x4c, 0xaf, 0x91, 0x66, + 0x3a, 0x5c, 0x32, 0xe1, 0xd6, 0xdf, 0xe1, 0x33, 0x03, 0x04, 0xfd, 0xb0, 0x2a, 0x0a, 0x65, 0x1f, + 0x42, 0x75, 0x5b, 0x25, 0x0f, 0xe0, 0xee, 0x32, 0xfe, 0x98, 0xa3, 0x99, 0xdd, 0x08, 0x37, 0xc6, + 0x7e, 0x0e, 0xf5, 0x9d, 0xa1, 0xff, 0x81, 0x9e, 0x41, 0xe5, 0xec, 0xd3, 0x6d, 0x40, 0x17, 0x2a, + 0x1f, 0x50, 0x2a, 0x26, 0xb8, 0x06, 0x16, 0xf1, 0xb5, 0x90, 0x06, 0xb8, 0x17, 0x6e, 0x8c, 0xa9, + 0x32, 0x2e, 0xa4, 0x39, 0xbb, 0xae, 0x6a, 0x63, 0x1f, 0x43, 0x2d, 0x62, 0x09, 0x8f, 0xb3, 0x5c, + 0x22, 0x69, 0xc2, 0x9d, 0x1b, 0x5c, 0x15, 0x7d, 0xb5, 0x24, 0x0f, 0x61, 0x5f, 0xb1, 0x84, 0x9b, + 0x4c, 0x23, 0xac, 0xa9, 0x2d, 0x6a, 0x0f, 0xa1, 0xea, 0x5f, 0x21, 0xbd, 0x51, 0xf9, 0x82, 0xbc, + 0x82, 0x7d, 0xfd, 0x09, 0x26, 0x77, 0xe0, 0x3d, 0xf9, 0xe7, 0x45, 0x0b, 0x6e, 0xbc, 0x4a, 0x31, + 0x34, 0xa4, 0x1e, 0xa4, 0xf2, 0x45, 0xd1, 0x55, 0xcb, 0x97, 0x3d, 0x68, 0xec, 0x72, 0xe4, 0x29, + 0x3c, 0xf2, 0x4f, 0x07, 0xfe, 0xbb, 0xe8, 0xfc, 0xfd, 0x64, 0x7c, 0x31, 0x1a, 0x4c, 0xce, 0x87, + 0xd1, 0x68, 0xe0, 0x07, 0x27, 0xc1, 0xa0, 0xdf, 0xdc, 0x23, 0x65, 0x28, 0x8d, 0x2f, 0x9b, 0x16, + 0x01, 0x28, 0x47, 0xa7, 0x3d, 0xaf, 0x7b, 0xdc, 0x2c, 0xbd, 0xbd, 0xf8, 0xb6, 0x6e, 0x5b, 0xdf, + 0xd7, 0x6d, 0xeb, 0xc7, 0xba, 0x6d, 0x7d, 0xf9, 0xd9, 0xde, 0xbb, 0x3c, 0x4a, 0x58, 0x76, 0x95, + 0x4f, 0x1d, 0x2a, 0x16, 0x2e, 0x57, 0x29, 0xa5, 0x9d, 0x19, 0x2e, 0x5d, 0x8e, 0x62, 0xae, 0x3a, + 0x71, 0xca, 0x3a, 0x89, 0x70, 0x77, 0x57, 0xe9, 0xb5, 0x56, 0x5f, 0x4b, 0xf7, 0x87, 0x28, 0x4e, + 0x22, 0xa7, 0x37, 0x0a, 0xf4, 0x15, 0x42, 0x9c, 0xab, 0x69, 0xd9, 0xac, 0xd7, 0xd1, 0xaf, 0x00, + 0x00, 0x00, 0xff, 0xff, 0xa0, 0xaf, 0x9d, 0x5e, 0x7a, 0x02, 0x00, 0x00, } func (m *Address) Marshal() (dAtA []byte, err error) { diff --git a/v2/session/grpc/service.pb.go b/v2/session/grpc/service.pb.go index e96f4c8..1229a1e 100644 --- a/v2/session/grpc/service.pb.go +++ b/v2/session/grpc/service.pb.go @@ -27,15 +27,16 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package -// CreateRequest carries an information necessary for opening a session. +// Information necessary for opening a session. type CreateRequest struct { // Body of create session token request message. Body *CreateRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` - // Carries request meta information. Header data is used only to regulate message - // transport and does not affect request execution. + // 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,proto3" 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. + // 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,proto3" json:"verify_header,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -96,11 +97,11 @@ func (m *CreateRequest) GetVerifyHeader() *RequestVerificationHeader { return nil } -// Request body +// Session creation request body type CreateRequest_Body struct { - // Carries an identifier of a session initiator. + // Dession initiating user's or node's key derived `OwnerID`. OwnerId *grpc.OwnerID `protobuf:"bytes,1,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"` - // Expiration Epoch + // Session expiration `Epoch` Expiration uint64 `protobuf:"varint,2,opt,name=expiration,proto3" json:"expiration,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -154,7 +155,7 @@ func (m *CreateRequest_Body) GetExpiration() uint64 { return 0 } -// CreateResponse carries an information about the opened session. +// Information about the opened session. type CreateResponse struct { // Body of create session token response message. Body *CreateResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` @@ -162,8 +163,8 @@ type CreateResponse struct { // message transport and does not affect request execution. MetaHeader *ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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. + // authenticate the nodes of the message route and check the correctness of + // transmission. VerifyHeader *ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -224,11 +225,11 @@ func (m *CreateResponse) GetVerifyHeader() *ResponseVerificationHeader { return nil } -// Response body +// Session creation response body type CreateResponse_Body struct { - // id carries an identifier of session token. + // Identifier of a newly created session Id []byte `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - // session_key carries a session public key. + // Public key used for session SessionKey []byte `protobuf:"bytes,2,opt,name=session_key,json=sessionKey,proto3" json:"session_key,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -335,7 +336,7 @@ const _ = grpc1.SupportPackageIsVersion4 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type SessionServiceClient interface { - // Create opens new session between the client and the server. + // Opens a new session between two peers. Create(ctx context.Context, in *CreateRequest, opts ...grpc1.CallOption) (*CreateResponse, error) } @@ -358,7 +359,7 @@ func (c *sessionServiceClient) Create(ctx context.Context, in *CreateRequest, op // SessionServiceServer is the server API for SessionService service. type SessionServiceServer interface { - // Create opens new session between the client and the server. + // Opens a new session between two peers. Create(context.Context, *CreateRequest) (*CreateResponse, error) } diff --git a/v2/session/grpc/types.pb.go b/v2/session/grpc/types.pb.go index 39733a3..77f5291 100644 --- a/v2/session/grpc/types.pb.go +++ b/v2/session/grpc/types.pb.go @@ -78,7 +78,7 @@ func (ObjectSessionContext_Verb) EnumDescriptor() ([]byte, []int) { // Context information for Session Tokens related to ObjectService requests type ObjectSessionContext struct { - // Verb is a type of request for which the token is issued + // Type of request for which the token is issued Verb ObjectSessionContext_Verb `protobuf:"varint,1,opt,name=verb,proto3,enum=neo.fs.v2.session.ObjectSessionContext_Verb" json:"verb,omitempty"` // Related Object address Address *grpc.Address `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"` @@ -134,11 +134,13 @@ func (m *ObjectSessionContext) GetAddress() *grpc.Address { return nil } -// NeoFS session token. +// NeoFS Session Token. type SessionToken struct { - // Session Token body + // Session Token contains the proof of trust between peers to be attached in + // requests for further verification. Please see corresponding section of + // NeoFS Technical Specification for details. Body *SessionToken_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` - // Signature is a signature of session token information + // Signature of `SessionToken` information Signature *grpc.Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -192,17 +194,17 @@ func (m *SessionToken) GetSignature() *grpc.Signature { return nil } -// Session token body +// Session Token body type SessionToken_Body struct { - // ID is a token identifier. valid UUIDv4 represented in bytes + // Token identifier is a valid UUIDv4 in binary form Id []byte `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - // OwnerID carries identifier of the session initiator. - OwnerId *grpc.OwnerID `protobuf:"bytes,2,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"` - // Lifetime is a lifetime of the session + // Identifier of the session initiator + OwnerId *grpc.OwnerID `protobuf:"bytes,2,opt,name=owner_id,json=ownerID,proto3" json:"owner_id,omitempty"` + // Lifetime of the session Lifetime *SessionToken_Body_TokenLifetime `protobuf:"bytes,3,opt,name=lifetime,proto3" json:"lifetime,omitempty"` - // SessionKey is a public key of session key + // Public key used in session SessionKey []byte `protobuf:"bytes,4,opt,name=session_key,json=sessionKey,proto3" json:"session_key,omitempty"` - // Carries context of the session. + // Session Context information // // Types that are valid to be assigned to Context: // *SessionToken_Body_Object @@ -373,11 +375,11 @@ func (m *SessionToken_Body_TokenLifetime) GetIat() uint64 { return 0 } -// Extended headers for Request/Response +// Extended headers for Request/Response. type XHeader struct { - // Key of the X-Header. + // Key of the X-Header Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - // Value of the X-Header. + // Value of the X-Header Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -431,21 +433,22 @@ func (m *XHeader) GetValue() string { return "" } -// Information about the request +// Meta information attached to the request. When forwarded between peers, +// request meta headers are folded in matryoshka style. type RequestMetaHeader struct { - // Client API version. + // Peer's API version used Version *grpc.Version `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` - // Client local epoch number. Set to 0 if unknown. + // Peer's local epoch number. Set to 0 if unknown. Epoch uint64 `protobuf:"varint,2,opt,name=epoch,proto3" json:"epoch,omitempty"` - // Maximum number of nodes in the request route. + // Maximum number of intermediate nodes in the request route Ttl uint32 `protobuf:"varint,3,opt,name=ttl,proto3" json:"ttl,omitempty"` - // Request X-Headers. + // Request X-Headers XHeaders []*XHeader `protobuf:"bytes,4,rep,name=x_headers,json=xHeaders,proto3" json:"x_headers,omitempty"` - // Token is a token of the session within which the request is sent + // Session token within which the request is sent SessionToken *SessionToken `protobuf:"bytes,5,opt,name=session_token,json=sessionToken,proto3" json:"session_token,omitempty"` - // Bearer is a Bearer token of the request + // `BearerToken` with eACL overrides for the request BearerToken *grpc1.BearerToken `protobuf:"bytes,6,opt,name=bearer_token,json=bearerToken,proto3" json:"bearer_token,omitempty"` - // RequestMetaHeader of the origin request. + // `RequestMetaHeader` of the origin request Origin *RequestMetaHeader `protobuf:"bytes,7,opt,name=origin,proto3" json:"origin,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -536,15 +539,15 @@ func (m *RequestMetaHeader) GetOrigin() *RequestMetaHeader { // Information about the response type ResponseMetaHeader struct { - // Server API version. + // Peer's API version used Version *grpc.Version `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` - // Server local epoch number. + // Peer's local epoch number Epoch uint64 `protobuf:"varint,2,opt,name=epoch,proto3" json:"epoch,omitempty"` - // Maximum number of nodes in the response route. + // Maximum number of intermediate nodes in the request route Ttl uint32 `protobuf:"varint,3,opt,name=ttl,proto3" json:"ttl,omitempty"` - // Response X-Headers. + // Response X-Headers XHeaders []*XHeader `protobuf:"bytes,4,rep,name=x_headers,json=xHeaders,proto3" json:"x_headers,omitempty"` - // Carries response meta header of the origin response. + // `ResponseMetaHeader` of the origin request Origin *ResponseMetaHeader `protobuf:"bytes,5,opt,name=origin,proto3" json:"origin,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -619,13 +622,13 @@ func (m *ResponseMetaHeader) GetOrigin() *ResponseMetaHeader { return nil } -// Verification info for request signed by all intermediate nodes +// Verification info for request signed by all intermediate nodes. type RequestVerificationHeader struct { // Request Body signature. Should be generated once by request initiator. BodySignature *grpc.Signature `protobuf:"bytes,1,opt,name=body_signature,json=bodySignature,proto3" json:"body_signature,omitempty"` - // Request Meta signature is added and signed by any intermediate node + // Request Meta signature is added and signed by each intermediate node MetaSignature *grpc.Signature `protobuf:"bytes,2,opt,name=meta_signature,json=metaSignature,proto3" json:"meta_signature,omitempty"` - // Sign previous hops + // Signature of previous hops OriginSignature *grpc.Signature `protobuf:"bytes,3,opt,name=origin_signature,json=originSignature,proto3" json:"origin_signature,omitempty"` // Chain of previous hops signatures Origin *RequestVerificationHeader `protobuf:"bytes,4,opt,name=origin,proto3" json:"origin,omitempty"` @@ -699,9 +702,9 @@ func (m *RequestVerificationHeader) GetOrigin() *RequestVerificationHeader { type ResponseVerificationHeader struct { // Response Body signature. Should be generated once by answering node. BodySignature *grpc.Signature `protobuf:"bytes,1,opt,name=body_signature,json=bodySignature,proto3" json:"body_signature,omitempty"` - // Response Meta signature is added and signed by any intermediate node + // Response Meta signature is added and signed by each intermediate node MetaSignature *grpc.Signature `protobuf:"bytes,2,opt,name=meta_signature,json=metaSignature,proto3" json:"meta_signature,omitempty"` - // Sign previous hops + // Signature of previous hops OriginSignature *grpc.Signature `protobuf:"bytes,3,opt,name=origin_signature,json=originSignature,proto3" json:"origin_signature,omitempty"` // Chain of previous hops signatures Origin *ResponseVerificationHeader `protobuf:"bytes,4,opt,name=origin,proto3" json:"origin,omitempty"` @@ -787,60 +790,60 @@ func init() { func init() { proto.RegisterFile("v2/session/grpc/types.proto", fileDescriptor_6bbc551f310b2b05) } var fileDescriptor_6bbc551f310b2b05 = []byte{ - // 840 bytes of a gzipped FileDescriptorProto + // 839 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x56, 0xdd, 0x6e, 0x1b, 0x45, 0x14, 0xce, 0xae, 0x37, 0x76, 0x7c, 0x1c, 0x87, 0xed, 0x28, 0x52, 0x5d, 0x23, 0xa5, 0x91, 0x05, - 0x22, 0x17, 0xcd, 0x5a, 0x59, 0x2e, 0x00, 0x41, 0xa5, 0xda, 0xf1, 0xb6, 0xb6, 0x28, 0x69, 0x34, - 0x4e, 0x23, 0xc4, 0x8d, 0xb5, 0x3f, 0xc7, 0xce, 0xb6, 0xce, 0x8e, 0xd9, 0x99, 0x2c, 0xf1, 0x9b, - 0xf0, 0x0c, 0x20, 0xde, 0x83, 0xcb, 0x5e, 0xf0, 0x00, 0x28, 0x5c, 0x20, 0xf1, 0x02, 0xdc, 0xa2, - 0x99, 0x1d, 0x3b, 0x26, 0x8e, 0x49, 0xb8, 0x43, 0xdc, 0x9d, 0xd9, 0x39, 0xdf, 0x37, 0xdf, 0xf7, - 0xcd, 0xf1, 0xc8, 0xf0, 0x7e, 0xe6, 0x36, 0x39, 0x72, 0x1e, 0xb3, 0xa4, 0x39, 0x4a, 0x27, 0x61, - 0x53, 0x4c, 0x27, 0xc8, 0x9d, 0x49, 0xca, 0x04, 0x23, 0x0f, 0x12, 0x64, 0xce, 0x90, 0x3b, 0x99, - 0xeb, 0xe8, 0x9e, 0x7a, 0x2d, 0x73, 0x9b, 0x29, 0x0e, 0xf9, 0x52, 0x73, 0xfd, 0x61, 0xe6, 0x36, - 0xfd, 0x70, 0xbc, 0xb4, 0xd1, 0xf8, 0xd3, 0x80, 0xed, 0x57, 0xc1, 0x1b, 0x0c, 0x45, 0x3f, 0x27, - 0x39, 0x64, 0x89, 0xc0, 0x4b, 0x41, 0x9e, 0x81, 0x95, 0x61, 0x1a, 0xd4, 0x8c, 0x5d, 0x63, 0x6f, - 0xcb, 0x7d, 0xe2, 0x2c, 0x9d, 0xe6, 0xdc, 0x06, 0x73, 0x4e, 0x31, 0x0d, 0xa8, 0x42, 0x92, 0x03, - 0x28, 0xf9, 0x51, 0x94, 0x22, 0xe7, 0x35, 0x73, 0xd7, 0xd8, 0xab, 0xb8, 0x0f, 0x17, 0x48, 0xa4, - 0x4c, 0xa7, 0x95, 0x6f, 0xd3, 0x59, 0x5f, 0xe3, 0x0d, 0x58, 0x92, 0x80, 0x6c, 0x83, 0x7d, 0xea, - 0xd1, 0xf6, 0xe0, 0xf5, 0x51, 0xff, 0xd8, 0x3b, 0xec, 0x3d, 0xef, 0x79, 0x1d, 0x7b, 0x8d, 0x94, - 0xa0, 0x70, 0xfc, 0xfa, 0xc4, 0x36, 0x64, 0xf1, 0xc2, 0x3b, 0xb1, 0x4d, 0xb2, 0x01, 0x56, 0xd7, - 0x6b, 0x75, 0xec, 0x02, 0x01, 0x28, 0xf6, 0xbd, 0x16, 0x3d, 0xec, 0xda, 0x96, 0xac, 0x3b, 0xde, - 0x4b, 0xef, 0xc4, 0xb3, 0xd7, 0x49, 0x19, 0xd6, 0x69, 0xeb, 0xe8, 0x85, 0x67, 0x17, 0x49, 0x15, - 0xca, 0xaa, 0xec, 0xb6, 0xfa, 0x5d, 0xbb, 0xd4, 0xf8, 0xa5, 0x00, 0x9b, 0x5a, 0xfc, 0x09, 0x7b, - 0x8b, 0x09, 0xf9, 0x14, 0xac, 0x80, 0x45, 0x53, 0xe5, 0xb8, 0xe2, 0x7e, 0x70, 0x8b, 0xe3, 0xc5, - 0x76, 0xa7, 0xcd, 0xa2, 0x29, 0x55, 0x08, 0xf2, 0x09, 0x94, 0x79, 0x3c, 0x4a, 0x7c, 0x71, 0x91, - 0xa2, 0xf6, 0xfa, 0xe8, 0xa6, 0xd7, 0xfe, 0xac, 0x81, 0x5e, 0xf7, 0xd6, 0xdf, 0x99, 0x60, 0x49, - 0x1e, 0xb2, 0x05, 0x66, 0x1c, 0xa9, 0x93, 0x37, 0xa9, 0x19, 0x47, 0xc4, 0x85, 0x0d, 0xf6, 0x5d, - 0x82, 0xe9, 0x20, 0x8e, 0x56, 0x85, 0xf7, 0x4a, 0xee, 0xf7, 0x3a, 0xb4, 0xa4, 0x1a, 0x7b, 0x11, - 0x39, 0x82, 0x8d, 0x71, 0x3c, 0x44, 0x11, 0x9f, 0x63, 0xad, 0xa0, 0x30, 0xee, 0x7d, 0x3c, 0x38, - 0xaa, 0x7c, 0xa9, 0x91, 0x74, 0xce, 0x41, 0x1e, 0x43, 0x45, 0x83, 0x06, 0x6f, 0x71, 0x5a, 0xb3, - 0x94, 0x38, 0xd0, 0x9f, 0xbe, 0xc4, 0x29, 0x69, 0x41, 0x91, 0xa9, 0x19, 0xa8, 0xad, 0xab, 0xe3, - 0x3e, 0xba, 0xe7, 0x90, 0x74, 0xd7, 0xa8, 0x06, 0xd6, 0x3d, 0xa8, 0xfe, 0xed, 0x78, 0x62, 0x43, - 0x01, 0x2f, 0x27, 0x2a, 0x09, 0x8b, 0xca, 0x52, 0x7e, 0x49, 0x82, 0xa1, 0x4a, 0xc1, 0xa2, 0xb2, - 0x94, 0x5f, 0x62, 0x5f, 0x28, 0x8f, 0x16, 0x95, 0x65, 0xbb, 0x0c, 0xa5, 0x30, 0xe7, 0x6e, 0x1c, - 0x40, 0xe9, 0xeb, 0x2e, 0xfa, 0x11, 0xa6, 0xb2, 0x4f, 0x0a, 0x97, 0x5c, 0x65, 0x2a, 0x4b, 0xb2, - 0x0d, 0xeb, 0x99, 0x3f, 0xbe, 0xc8, 0x2f, 0xa9, 0x4c, 0xf3, 0x45, 0xe3, 0x0f, 0x13, 0x1e, 0x50, - 0xfc, 0xf6, 0x02, 0xb9, 0xf8, 0x0a, 0x85, 0xaf, 0xd1, 0x07, 0x50, 0xca, 0x30, 0x95, 0xb2, 0xf5, - 0x44, 0x2c, 0xdd, 0xc0, 0x69, 0xbe, 0x4d, 0x67, 0x7d, 0x92, 0x1e, 0x27, 0x2c, 0x3c, 0xd3, 0x62, - 0xf3, 0x85, 0x94, 0x21, 0xc4, 0x58, 0xc9, 0xad, 0x52, 0x59, 0xca, 0x79, 0xb9, 0x1c, 0x9c, 0xa9, - 0x63, 0x78, 0xcd, 0xda, 0x2d, 0xec, 0x55, 0xdc, 0xfa, 0x2d, 0xd9, 0x69, 0x1f, 0x74, 0xe3, 0x32, - 0x2f, 0x38, 0xe9, 0x40, 0x75, 0x76, 0x25, 0x42, 0xc6, 0xa6, 0x83, 0x7f, 0x7c, 0xc7, 0x3d, 0xd3, - 0x4d, 0xbe, 0x38, 0xe8, 0x4f, 0x61, 0x33, 0x40, 0x3f, 0xc5, 0x54, 0x93, 0x14, 0x15, 0xc9, 0xa2, - 0x02, 0x3f, 0x1c, 0x3b, 0x6d, 0xd5, 0x92, 0xe3, 0x2b, 0xc1, 0xf5, 0x82, 0x7c, 0x01, 0x45, 0x96, - 0xc6, 0xa3, 0x38, 0xa9, 0x95, 0x56, 0xfe, 0x52, 0x96, 0xe2, 0xa4, 0x1a, 0xd3, 0xf8, 0xdd, 0x00, - 0x42, 0x91, 0x4f, 0x58, 0xc2, 0xf1, 0x3f, 0x9e, 0xf6, 0xd3, 0xb9, 0xd1, 0x3c, 0xe6, 0x0f, 0x6f, - 0x35, 0x7a, 0xd3, 0xca, 0xdc, 0xe9, 0x8f, 0x26, 0x3c, 0xd2, 0x39, 0x9c, 0x62, 0x1a, 0x0f, 0xe3, - 0xd0, 0x17, 0x31, 0x4b, 0xb4, 0xe1, 0x67, 0xb0, 0x25, 0xdf, 0x8e, 0xc1, 0xf5, 0xc3, 0x61, 0xdc, - 0xf5, 0x70, 0x54, 0x25, 0x60, 0xbe, 0x94, 0x0c, 0xe7, 0x28, 0xfc, 0xc1, 0xbf, 0x78, 0x7a, 0xaa, - 0x12, 0x70, 0xcd, 0xd0, 0x01, 0x3b, 0xd7, 0xba, 0xc0, 0x51, 0xb8, 0x8b, 0xe3, 0xbd, 0x1c, 0xb2, - 0xc8, 0x32, 0x8b, 0xc9, 0x52, 0xd8, 0x27, 0xab, 0xe7, 0x61, 0x39, 0x87, 0x79, 0x5a, 0x3f, 0x99, - 0x50, 0x9f, 0x85, 0xf9, 0xbf, 0x8e, 0xcb, 0xbb, 0x11, 0xd7, 0xfe, 0x3f, 0x4c, 0xd5, 0xea, 0xbc, - 0xda, 0xc1, 0xcf, 0x57, 0x3b, 0xc6, 0xbb, 0xab, 0x1d, 0xe3, 0xd7, 0xab, 0x1d, 0xe3, 0xfb, 0xdf, - 0x76, 0xd6, 0xbe, 0xf9, 0x6c, 0x14, 0x8b, 0xb3, 0x8b, 0xc0, 0x09, 0xd9, 0x79, 0x33, 0xe1, 0x93, - 0x30, 0xdc, 0x8f, 0x30, 0x6b, 0x26, 0xc8, 0x86, 0x7c, 0xdf, 0x9f, 0xc4, 0xfb, 0x23, 0xd6, 0xbc, - 0xf1, 0x7f, 0xe2, 0x73, 0xbd, 0xf8, 0xc1, 0xdc, 0x3e, 0x42, 0xf6, 0xbc, 0xef, 0xb4, 0x8e, 0x7b, - 0x52, 0x86, 0x7e, 0x3b, 0x82, 0xa2, 0xfa, 0x8f, 0xf0, 0xf1, 0x5f, 0x01, 0x00, 0x00, 0xff, 0xff, - 0x00, 0x73, 0x57, 0xf8, 0x88, 0x08, 0x00, 0x00, + 0x22, 0x17, 0xcd, 0x5a, 0x59, 0x2e, 0x00, 0x41, 0xa5, 0xda, 0xf1, 0xb6, 0x8e, 0x28, 0x69, 0x34, + 0x4e, 0x23, 0xc4, 0x8d, 0xb5, 0x3f, 0xc7, 0xce, 0xb6, 0xce, 0xce, 0xb2, 0x33, 0x59, 0xe2, 0x37, + 0xe1, 0x19, 0x40, 0xbc, 0x07, 0x97, 0xbd, 0xe0, 0x01, 0x50, 0xb8, 0x40, 0xe2, 0x05, 0xb8, 0x45, + 0x33, 0x3b, 0x76, 0x4c, 0x9c, 0x90, 0x70, 0x87, 0xb8, 0x3b, 0xb3, 0x73, 0xbe, 0x6f, 0xbe, 0xef, + 0x9b, 0xe3, 0x91, 0xe1, 0xfd, 0xdc, 0x6d, 0x73, 0xe4, 0x3c, 0x66, 0x49, 0x7b, 0x9c, 0xa5, 0x61, + 0x5b, 0x4c, 0x53, 0xe4, 0x4e, 0x9a, 0x31, 0xc1, 0xc8, 0x83, 0x04, 0x99, 0x33, 0xe2, 0x4e, 0xee, + 0x3a, 0xba, 0xa7, 0xd9, 0xc8, 0xdd, 0x76, 0x86, 0x23, 0xbe, 0xd4, 0xdc, 0x7c, 0x98, 0xbb, 0x6d, + 0x3f, 0x9c, 0x2c, 0x6d, 0xb4, 0xfe, 0x34, 0x60, 0xf3, 0x55, 0xf0, 0x06, 0x43, 0x31, 0x28, 0x48, + 0xf6, 0x59, 0x22, 0xf0, 0x42, 0x90, 0x67, 0x60, 0xe5, 0x98, 0x05, 0x0d, 0x63, 0xdb, 0xd8, 0xd9, + 0x70, 0x9f, 0x38, 0x4b, 0xa7, 0x39, 0x37, 0xc1, 0x9c, 0x13, 0xcc, 0x02, 0xaa, 0x90, 0x64, 0x0f, + 0x2a, 0x7e, 0x14, 0x65, 0xc8, 0x79, 0xc3, 0xdc, 0x36, 0x76, 0x6a, 0xee, 0xc3, 0x05, 0x12, 0x29, + 0xd3, 0xe9, 0x14, 0xdb, 0x74, 0xd6, 0xd7, 0x7a, 0x03, 0x96, 0x24, 0x20, 0x9b, 0x60, 0x9f, 0x78, + 0xb4, 0x3b, 0x7c, 0x7d, 0x38, 0x38, 0xf2, 0xf6, 0x0f, 0x9e, 0x1f, 0x78, 0x3d, 0x7b, 0x85, 0x54, + 0xa0, 0x74, 0xf4, 0xfa, 0xd8, 0x36, 0x64, 0xf1, 0xc2, 0x3b, 0xb6, 0x4d, 0xb2, 0x06, 0x56, 0xdf, + 0xeb, 0xf4, 0xec, 0x12, 0x01, 0x28, 0x0f, 0xbc, 0x0e, 0xdd, 0xef, 0xdb, 0x96, 0xac, 0x7b, 0xde, + 0x4b, 0xef, 0xd8, 0xb3, 0x57, 0x49, 0x15, 0x56, 0x69, 0xe7, 0xf0, 0x85, 0x67, 0x97, 0x49, 0x1d, + 0xaa, 0xaa, 0xec, 0x77, 0x06, 0x7d, 0xbb, 0xd2, 0xfa, 0xa5, 0x04, 0xeb, 0x5a, 0xfc, 0x31, 0x7b, + 0x8b, 0x09, 0xf9, 0x14, 0xac, 0x80, 0x45, 0x53, 0xe5, 0xb8, 0xe6, 0x7e, 0x70, 0x83, 0xe3, 0xc5, + 0x76, 0xa7, 0xcb, 0xa2, 0x29, 0x55, 0x08, 0xf2, 0x09, 0x54, 0x79, 0x3c, 0x4e, 0x7c, 0x71, 0x9e, + 0xa1, 0xf6, 0xfa, 0xe8, 0xba, 0xd7, 0xc1, 0xac, 0x81, 0x5e, 0xf5, 0x36, 0xdf, 0x99, 0x60, 0x49, + 0x1e, 0xb2, 0x01, 0x66, 0x1c, 0xa9, 0x93, 0xd7, 0xa9, 0x19, 0x47, 0xc4, 0x85, 0x35, 0xf6, 0x5d, + 0x82, 0xd9, 0x30, 0x8e, 0x6e, 0x0b, 0xef, 0x95, 0xdc, 0x3f, 0xe8, 0xd1, 0x0a, 0x2b, 0x0a, 0x72, + 0x08, 0x6b, 0x93, 0x78, 0x84, 0x22, 0x3e, 0xc3, 0x46, 0x49, 0x61, 0xdc, 0xfb, 0x78, 0x70, 0x54, + 0xf9, 0x52, 0x23, 0xe9, 0x9c, 0x83, 0x3c, 0x86, 0x9a, 0x06, 0x0d, 0xdf, 0xe2, 0xb4, 0x61, 0x29, + 0x71, 0xa0, 0x3f, 0x7d, 0x89, 0x53, 0xd2, 0x81, 0x32, 0x53, 0x33, 0xd0, 0x58, 0x55, 0xc7, 0x7d, + 0x74, 0xcf, 0x21, 0xe9, 0xaf, 0x50, 0x0d, 0x6c, 0x7a, 0x50, 0xff, 0xdb, 0xf1, 0xc4, 0x86, 0x12, + 0x5e, 0xa4, 0x2a, 0x09, 0x8b, 0xca, 0x52, 0x7e, 0x49, 0x82, 0x91, 0x4a, 0xc1, 0xa2, 0xb2, 0x94, + 0x5f, 0x62, 0x5f, 0x28, 0x8f, 0x16, 0x95, 0x65, 0xb7, 0x0a, 0x95, 0xb0, 0xe0, 0x6e, 0xed, 0x41, + 0xe5, 0xeb, 0x3e, 0xfa, 0x11, 0x66, 0xb2, 0x4f, 0x0a, 0x97, 0x5c, 0x55, 0x2a, 0x4b, 0xb2, 0x09, + 0xab, 0xb9, 0x3f, 0x39, 0x2f, 0x2e, 0xa9, 0x4a, 0x8b, 0x45, 0xeb, 0x0f, 0x13, 0x1e, 0x50, 0xfc, + 0xf6, 0x1c, 0xb9, 0xf8, 0x0a, 0x85, 0xaf, 0xd1, 0x7b, 0x50, 0xc9, 0x31, 0x93, 0xb2, 0xf5, 0x44, + 0x2c, 0xdd, 0xc0, 0x49, 0xb1, 0x4d, 0x67, 0x7d, 0x92, 0x1e, 0x53, 0x16, 0x9e, 0x6a, 0xb1, 0xc5, + 0x42, 0xca, 0x10, 0x62, 0xa2, 0xe4, 0xd6, 0xa9, 0x2c, 0xe5, 0xbc, 0x5c, 0x0c, 0x4f, 0xd5, 0x31, + 0xbc, 0x61, 0x6d, 0x97, 0x76, 0x6a, 0x6e, 0xf3, 0x86, 0xec, 0xb4, 0x0f, 0xba, 0x76, 0x51, 0x14, + 0x9c, 0xf4, 0xa0, 0x3e, 0xbb, 0x12, 0x21, 0x63, 0xd3, 0xc1, 0x3f, 0xbe, 0xe3, 0x9e, 0xe9, 0x3a, + 0x5f, 0x1c, 0xf4, 0xa7, 0xb0, 0x1e, 0xa0, 0x9f, 0x61, 0xa6, 0x49, 0xca, 0x8a, 0x64, 0x51, 0x81, + 0x1f, 0x4e, 0x9c, 0xae, 0x6a, 0x29, 0xf0, 0xb5, 0xe0, 0x6a, 0x41, 0xbe, 0x80, 0x32, 0xcb, 0xe2, + 0x71, 0x9c, 0x34, 0x2a, 0xb7, 0xfe, 0x52, 0x96, 0xe2, 0xa4, 0x1a, 0xd3, 0xfa, 0xdd, 0x00, 0x42, + 0x91, 0xa7, 0x2c, 0xe1, 0xf8, 0x1f, 0x4f, 0xfb, 0xe9, 0xdc, 0x68, 0x11, 0xf3, 0x87, 0x37, 0x1a, + 0xbd, 0x6e, 0x65, 0xee, 0xf4, 0x47, 0x13, 0x1e, 0xe9, 0x1c, 0x4e, 0x30, 0x8b, 0x47, 0x71, 0xe8, + 0x8b, 0x98, 0x25, 0xda, 0xf0, 0x33, 0xd8, 0x90, 0x6f, 0xc7, 0xf0, 0xea, 0xe1, 0x30, 0xee, 0x7a, + 0x38, 0xea, 0x12, 0x30, 0x5f, 0x4a, 0x86, 0x33, 0x14, 0xfe, 0xf0, 0x5f, 0x3c, 0x3d, 0x75, 0x09, + 0xb8, 0x62, 0xe8, 0x81, 0x5d, 0x68, 0x5d, 0xe0, 0x28, 0xdd, 0xc5, 0xf1, 0x5e, 0x01, 0x59, 0x64, + 0x99, 0xc5, 0x64, 0x29, 0xec, 0x93, 0xdb, 0xe7, 0x61, 0x39, 0x87, 0x79, 0x5a, 0x3f, 0x99, 0xd0, + 0x9c, 0x85, 0xf9, 0xbf, 0x8e, 0xcb, 0xbb, 0x16, 0xd7, 0xee, 0x3f, 0x4c, 0xd5, 0xed, 0x79, 0x75, + 0x83, 0x9f, 0x2f, 0xb7, 0x8c, 0x77, 0x97, 0x5b, 0xc6, 0xaf, 0x97, 0x5b, 0xc6, 0xf7, 0xbf, 0x6d, + 0xad, 0x7c, 0xf3, 0xd9, 0x38, 0x16, 0xa7, 0xe7, 0x81, 0x13, 0xb2, 0xb3, 0x76, 0xc2, 0xd3, 0x30, + 0xdc, 0x8d, 0x30, 0x6f, 0x27, 0xc8, 0x46, 0x7c, 0xd7, 0x4f, 0xe3, 0xdd, 0x31, 0x6b, 0x5f, 0xfb, + 0x3f, 0xf1, 0xb9, 0x5e, 0xfc, 0x60, 0x6e, 0x1e, 0x22, 0x7b, 0x3e, 0x70, 0x3a, 0x47, 0x07, 0x52, + 0x86, 0x7e, 0x3b, 0x82, 0xb2, 0xfa, 0x8f, 0xf0, 0xf1, 0x5f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x18, + 0x2f, 0x25, 0xb1, 0x88, 0x08, 0x00, 0x00, } func (m *ObjectSessionContext) Marshal() (dAtA []byte, err error) { diff --git a/v2/storagegroup/grpc/types.pb.go b/v2/storagegroup/grpc/types.pb.go index 212d7ce..59e73e7 100644 --- a/v2/storagegroup/grpc/types.pb.go +++ b/v2/storagegroup/grpc/types.pb.go @@ -23,22 +23,20 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package -// StorageGroup groups the information about the NeoFS storage group. -// The storage group consists of objects from single container. +// StorageGroup keeps verification information for Data Audit sessions. Objects +// that require payed storage guaranties are gathered in `StorageGroups` with +// additional information used for proof of storage. `StorageGroup` only +// contains objects from the same container. type StorageGroup struct { - // validation_data_size carries the total size of the payloads of the storage - // group members. + // Total size of the payloads of objects in the storage group ValidationDataSize uint64 `protobuf:"varint,1,opt,name=validation_data_size,json=validationDataSize,proto3" json:"validation_data_size,omitempty"` - // validation_hash carries homomorphic hash from the concatenation of the - // payloads of the storage group members - // The order of concatenation is the same as the order of the members in the - // Members field. + // Homomorphic hash from the concatenation of the payloads of the storage + // group members. The order of concatenation is the same as the order of the + // members in the `members` field. ValidationHash *grpc.Checksum `protobuf:"bytes,2,opt,name=validation_hash,json=validationHash,proto3" json:"validation_hash,omitempty"` - // expiration_epoch carries last NeoFS epoch number of the storage group - // lifetime. + // Last NeoFS epoch number of the storage group lifetime ExpirationEpoch uint64 `protobuf:"varint,3,opt,name=expiration_epoch,json=expirationEpoch,proto3" json:"expiration_epoch,omitempty"` - // Members carries the list of identifiers of the object storage group members. - // The list is strictly ordered. + // Strictly ordered list of storage group member objects Members []*grpc.ObjectID `protobuf:"bytes,4,rep,name=members,proto3" json:"members,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` From 5f6720f456a225210efea8e2e3746611cbf5ce6f Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Mon, 19 Oct 2020 15:39:13 +0300 Subject: [PATCH 0471/1196] [#172] v2/acl: Rename target `keyList` field to `keys` According to new neofs-api target filed `key_list` rename to `keys`. Signed-off-by: Alex Vanin --- pkg/acl/eacl/target.go | 4 ++-- pkg/acl/eacl/target_test.go | 4 ++-- v2/acl/convert.go | 4 ++-- v2/acl/grpc/types.go | 6 +++--- v2/acl/marshal_test.go | 2 +- v2/acl/types.go | 4 ++-- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/pkg/acl/eacl/target.go b/pkg/acl/eacl/target.go index 09fdfa7..73a7bf2 100644 --- a/pkg/acl/eacl/target.go +++ b/pkg/acl/eacl/target.go @@ -32,7 +32,7 @@ func (t *Target) ToV2() *v2acl.Target { target := new(v2acl.Target) target.SetRole(t.role.ToV2()) - target.SetKeyList(keys) + target.SetKeys(keys) return target } @@ -45,7 +45,7 @@ func NewTargetFromV2(target *v2acl.Target) *Target { } t.role = RoleFromV2(target.GetRole()) - v2keys := target.GetKeyList() + v2keys := target.GetKeys() t.keys = make([]ecdsa.PublicKey, 0, len(v2keys)) for i := range v2keys { key := crypto.UnmarshalPublicKey(v2keys[i]) diff --git a/pkg/acl/eacl/target_test.go b/pkg/acl/eacl/target_test.go index dd26f4b..077dbf4 100644 --- a/pkg/acl/eacl/target_test.go +++ b/pkg/acl/eacl/target_test.go @@ -24,8 +24,8 @@ func TestTarget(t *testing.T) { v2 := target.ToV2() require.NotNil(t, v2) require.Equal(t, v2acl.RoleSystem, v2.GetRole()) - require.Len(t, v2.GetKeyList(), len(keys)) - for i, key := range v2.GetKeyList() { + require.Len(t, v2.GetKeys(), len(keys)) + for i, key := range v2.GetKeys() { require.Equal(t, key, crypto.MarshalPublicKey(&keys[i])) } diff --git a/v2/acl/convert.go b/v2/acl/convert.go index b28eba2..0a005fe 100644 --- a/v2/acl/convert.go +++ b/v2/acl/convert.go @@ -205,7 +205,7 @@ func TargetToGRPCMessage(t *Target) *acl.EACLRecord_Target { RoleToGRPCField(t.GetRole()), ) - m.SetKeyList(t.GetKeyList()) + m.SetKeys(t.GetKeys()) return m } @@ -222,7 +222,7 @@ func TargetInfoFromGRPCMessage(m *acl.EACLRecord_Target) *Target { RoleFromGRPCField(m.GetRole()), ) - t.SetKeyList(m.GetKeyList()) + t.SetKeys(m.GetKeys()) return t } diff --git a/v2/acl/grpc/types.go b/v2/acl/grpc/types.go index adc4339..341b760 100644 --- a/v2/acl/grpc/types.go +++ b/v2/acl/grpc/types.go @@ -88,10 +88,10 @@ func (m *EACLRecord_Target) SetRole(v Role) { } } -// SetKeyList sets key list of the eACL target. -func (m *EACLRecord_Target) SetKeyList(v [][]byte) { +// SetKeys of the eACL target. +func (m *EACLRecord_Target) SetKeys(v [][]byte) { if m != nil { - m.KeyList = v + m.Keys = v } } diff --git a/v2/acl/marshal_test.go b/v2/acl/marshal_test.go index ecaecc8..16663d8 100644 --- a/v2/acl/marshal_test.go +++ b/v2/acl/marshal_test.go @@ -141,7 +141,7 @@ func TestTargetInfo_StableMarshal(t *testing.T) { t.Run("non empty", func(t *testing.T) { targetFrom.SetRole(acl.RoleUser) - targetFrom.SetKeyList([][]byte{ + targetFrom.SetKeys([][]byte{ []byte("Public Key 1"), []byte("Public Key 2"), }) diff --git a/v2/acl/types.go b/v2/acl/types.go index 83b7fd2..e5ed3a2 100644 --- a/v2/acl/types.go +++ b/v2/acl/types.go @@ -181,7 +181,7 @@ func (t *Target) SetRole(v Role) { } } -func (t *Target) GetKeyList() [][]byte { +func (t *Target) GetKeys() [][]byte { if t != nil { return t.keys } @@ -189,7 +189,7 @@ func (t *Target) GetKeyList() [][]byte { return nil } -func (t *Target) SetKeyList(v [][]byte) { +func (t *Target) SetKeys(v [][]byte) { if t != nil { t.keys = v } From cb188e63b767322d8fcdbf0210f13dda160bb7c9 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Mon, 19 Oct 2020 16:25:42 +0300 Subject: [PATCH 0472/1196] [#172] v2/acl: Add JSON converters for EACL and bearer token Signed-off-by: Alex Vanin --- go.mod | 1 + go.sum | 1 + v2/acl/json.go | 96 +++++++++++++++++++++++++++++++++++++++++++++ v2/acl/json_test.go | 50 +++++++++++++++++++++++ 4 files changed, 148 insertions(+) create mode 100644 v2/acl/json.go create mode 100644 v2/acl/json_test.go diff --git a/go.mod b/go.mod index d9b42dd..b090764 100644 --- a/go.mod +++ b/go.mod @@ -3,6 +3,7 @@ module github.com/nspcc-dev/neofs-api-go go 1.14 require ( + github.com/gogo/protobuf v1.1.1 github.com/golang/protobuf v1.4.2 github.com/google/uuid v1.1.1 github.com/mr-tron/base58 v1.1.2 diff --git a/go.sum b/go.sum index 565fd48..38c5900 100644 --- a/go.sum +++ b/go.sum @@ -67,6 +67,7 @@ github.com/go-redis/redis v6.10.2+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8w github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/go-yaml/yaml v2.1.0+incompatible h1:RYi2hDdss1u4YE7GwixGzWwVo47T8UQwnTLB6vQiq+o= github.com/go-yaml/yaml v2.1.0+incompatible/go.mod h1:w2MrLa16VYP0jy6N7M5kHaCkaLENm+P+Tv+MfurjSw0= +github.com/gogo/protobuf v1.1.1 h1:72R+M5VuhED/KujmZVcIquuo8mBgX4oVda//DQb3PXo= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= diff --git a/v2/acl/json.go b/v2/acl/json.go new file mode 100644 index 0000000..2707793 --- /dev/null +++ b/v2/acl/json.go @@ -0,0 +1,96 @@ +package acl + +import ( + "github.com/golang/protobuf/jsonpb" + acl "github.com/nspcc-dev/neofs-api-go/v2/acl/grpc" +) + +func RecordToJSON(r *Record) []byte { + if r == nil { + return nil + } + + msg := RecordToGRPCMessage(r) + m := jsonpb.Marshaler{} + + s, err := m.MarshalToString(msg) + if err != nil { + return nil + } + + return []byte(s) +} + +func RecordFromJSON(data []byte) *Record { + if len(data) == 0 { + return nil + } + + msg := new(acl.EACLRecord) + + if err := jsonpb.UnmarshalString(string(data), msg); err != nil { + return nil + } + + return RecordFromGRPCMessage(msg) +} + +func TableToJSON(t *Table) (data []byte) { + if t == nil { + return nil + } + + msg := TableToGRPCMessage(t) + m := jsonpb.Marshaler{} + + s, err := m.MarshalToString(msg) + if err != nil { + return nil + } + + return []byte(s) +} + +func TableFromJSON(data []byte) *Table { + if len(data) == 0 { + return nil + } + + msg := new(acl.EACLTable) + + if jsonpb.UnmarshalString(string(data), msg) != nil { + return nil + } + + return TableFromGRPCMessage(msg) +} + +func BearerTokenToJSON(t *BearerToken) (data []byte) { + if t == nil { + return nil + } + + msg := BearerTokenToGRPCMessage(t) + m := jsonpb.Marshaler{} + + s, err := m.MarshalToString(msg) + if err != nil { + return nil + } + + return []byte(s) +} + +func BearerTokenFromJSON(data []byte) *BearerToken { + if len(data) == 0 { + return nil + } + + msg := new(acl.BearerToken) + + if jsonpb.UnmarshalString(string(data), msg) != nil { + return nil + } + + return BearerTokenFromGRPCMessage(msg) +} diff --git a/v2/acl/json_test.go b/v2/acl/json_test.go new file mode 100644 index 0000000..046141c --- /dev/null +++ b/v2/acl/json_test.go @@ -0,0 +1,50 @@ +package acl_test + +import ( + "testing" + + "github.com/nspcc-dev/neofs-api-go/v2/acl" + "github.com/stretchr/testify/require" +) + +func TestRecordJSON(t *testing.T) { + exp := generateRecord(false) + + t.Run("non empty", func(t *testing.T) { + data := acl.RecordToJSON(exp) + require.NotNil(t, data) + + got := acl.RecordFromJSON(data) + require.NotNil(t, got) + + require.Equal(t, exp, got) + }) +} + +func TestEACLTableJSON(t *testing.T) { + exp := generateEACL() + + t.Run("non empty", func(t *testing.T) { + data := acl.TableToJSON(exp) + require.NotNil(t, data) + + got := acl.TableFromJSON(data) + require.NotNil(t, got) + + require.Equal(t, exp, got) + }) +} + +func TestBearerTokenJSON(t *testing.T) { + exp := generateBearerToken("token") + + t.Run("non empty", func(t *testing.T) { + data := acl.BearerTokenToJSON(exp) + require.NotNil(t, data) + + got := acl.BearerTokenFromJSON(data) + require.NotNil(t, got) + + require.Equal(t, exp, got) + }) +} From 2e1096200ed8a42a8e33fa966209fd49d3eb8785 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Mon, 19 Oct 2020 21:23:11 +0300 Subject: [PATCH 0473/1196] [#172] v2/container: Add JSON converter for container Signed-off-by: Alex Vanin --- v2/container/json.go | 36 ++++++++++++++++++++++++++++++++++++ v2/container/json_test.go | 22 ++++++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 v2/container/json.go create mode 100644 v2/container/json_test.go diff --git a/v2/container/json.go b/v2/container/json.go new file mode 100644 index 0000000..edd7d48 --- /dev/null +++ b/v2/container/json.go @@ -0,0 +1,36 @@ +package container + +import ( + "github.com/golang/protobuf/jsonpb" + container "github.com/nspcc-dev/neofs-api-go/v2/container/grpc" +) + +func ContainerToJSON(c *Container) []byte { + if c == nil { + return nil + } + + msg := ContainerToGRPCMessage(c) + m := jsonpb.Marshaler{} + + s, err := m.MarshalToString(msg) + if err != nil { + return nil + } + + return []byte(s) +} + +func ContainerFromJSON(data []byte) *Container { + if len(data) == 0 { + return nil + } + + msg := new(container.Container) + + if err := jsonpb.UnmarshalString(string(data), msg); err != nil { + return nil + } + + return ContainerFromGRPCMessage(msg) +} diff --git a/v2/container/json_test.go b/v2/container/json_test.go new file mode 100644 index 0000000..5a3f551 --- /dev/null +++ b/v2/container/json_test.go @@ -0,0 +1,22 @@ +package container_test + +import ( + "testing" + + "github.com/nspcc-dev/neofs-api-go/v2/container" + "github.com/stretchr/testify/require" +) + +func TestContainerJSON(t *testing.T) { + exp := generateContainer("container") + + t.Run("non empty", func(t *testing.T) { + data := container.ContainerToJSON(exp) + require.NotNil(t, data) + + got := container.ContainerFromJSON(data) + require.NotNil(t, got) + + require.Equal(t, exp, got) + }) +} From b681b28e337c9acde82e33f5b341567c333ecb92 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Mon, 19 Oct 2020 21:27:38 +0300 Subject: [PATCH 0474/1196] [#172] v2/netmap: Add JSON converter for node info Signed-off-by: Alex Vanin --- v2/netmap/json.go | 36 ++++++++++++++++++++++++++++++++++++ v2/netmap/json_test.go | 22 ++++++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 v2/netmap/json.go create mode 100644 v2/netmap/json_test.go diff --git a/v2/netmap/json.go b/v2/netmap/json.go new file mode 100644 index 0000000..6b840ca --- /dev/null +++ b/v2/netmap/json.go @@ -0,0 +1,36 @@ +package netmap + +import ( + "github.com/golang/protobuf/jsonpb" + netmap "github.com/nspcc-dev/neofs-api-go/v2/netmap/grpc" +) + +func NodeInfoToJSON(n *NodeInfo) []byte { + if n == nil { + return nil + } + + msg := NodeInfoToGRPCMessage(n) + m := jsonpb.Marshaler{} + + s, err := m.MarshalToString(msg) + if err != nil { + return nil + } + + return []byte(s) +} + +func NodeInfoFromJSON(data []byte) *NodeInfo { + if len(data) == 0 { + return nil + } + + msg := new(netmap.NodeInfo) + + if err := jsonpb.UnmarshalString(string(data), msg); err != nil { + return nil + } + + return NodeInfoFromGRPCMessage(msg) +} diff --git a/v2/netmap/json_test.go b/v2/netmap/json_test.go new file mode 100644 index 0000000..2dae126 --- /dev/null +++ b/v2/netmap/json_test.go @@ -0,0 +1,22 @@ +package netmap_test + +import ( + "testing" + + "github.com/nspcc-dev/neofs-api-go/v2/netmap" + "github.com/stretchr/testify/require" +) + +func TestNodeInfoJSON(t *testing.T) { + exp := generateNodeInfo("public key", "/multi/addr", 2) + + t.Run("non empty", func(t *testing.T) { + data := netmap.NodeInfoToJSON(exp) + require.NotNil(t, data) + + got := netmap.NodeInfoFromJSON(data) + require.NotNil(t, got) + + require.Equal(t, exp, got) + }) +} From 8351c78f58500c740c3d80e95d1a367d606dce43 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Mon, 19 Oct 2020 21:51:59 +0300 Subject: [PATCH 0475/1196] [#172] Use protobuf v2 API for go Signed-off-by: Alex Vanin --- Makefile | 2 +- go.mod | 7 +- go.sum | 12 +- util/proto/marshal_test.go | 9 +- util/proto/test/test.pb.go | 1508 +--- v2/accounting/grpc/service.pb.go | 1508 +--- v2/accounting/grpc/types.pb.go | 453 +- v2/accounting/marshal_test.go | 7 +- v2/acl/grpc/types.pb.go | 2911 ++----- v2/acl/marshal_test.go | 15 +- v2/container/grpc/service.pb.go | 8293 +++++--------------- v2/container/grpc/types.pb.go | 1011 +-- v2/container/marshal_test.go | 29 +- v2/netmap/grpc/service.pb.go | 1461 +--- v2/netmap/grpc/types.pb.go | 2594 ++----- v2/netmap/marshal_test.go | 15 +- v2/object/grpc/service.pb.go | 11943 +++++++---------------------- v2/object/grpc/types.pb.go | 2779 ++----- v2/object/marshal.go | 3 +- v2/object/marshal_test.go | 45 +- v2/refs/grpc/types.pb.go | 2019 ++--- v2/refs/marshal.go | 3 +- v2/refs/marshal_test.go | 15 +- v2/session/grpc/service.pb.go | 1558 +--- v2/session/grpc/types.pb.go | 3917 ++-------- v2/session/marshal_test.go | 23 +- v2/storagegroup/grpc/types.pb.go | 595 +- v2/storagegroup/marshal_test.go | 3 +- 28 files changed, 10089 insertions(+), 32649 deletions(-) diff --git a/Makefile b/Makefile index 3f3f1dd..72a8f89 100644 --- a/Makefile +++ b/Makefile @@ -47,7 +47,7 @@ protoc: echo "⇒ Processing $$f "; \ protoc \ --proto_path=.:./vendor:./vendor/github.com/nspcc-dev/neofs-api:/usr/local/include \ - --gofast_out=plugins=grpc,paths=source_relative:. $$f; \ + --go_out=plugins=grpc,paths=source_relative:. $$f; \ done rm -rf vendor diff --git a/go.mod b/go.mod index b090764..6ea4d69 100644 --- a/go.mod +++ b/go.mod @@ -3,8 +3,7 @@ module github.com/nspcc-dev/neofs-api-go go 1.14 require ( - github.com/gogo/protobuf v1.1.1 - github.com/golang/protobuf v1.4.2 + github.com/golang/protobuf v1.4.3 github.com/google/uuid v1.1.1 github.com/mr-tron/base58 v1.1.2 github.com/nspcc-dev/hrw v1.0.9 @@ -12,10 +11,8 @@ require ( github.com/nspcc-dev/neofs-crypto v0.3.0 github.com/pkg/errors v0.9.1 github.com/stretchr/testify v1.6.1 - golang.org/x/sys v0.0.0-20200420163511-1957bb5e6d1f // indirect - golang.org/x/text v0.3.2 // indirect - google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a // indirect google.golang.org/grpc v1.29.1 + google.golang.org/protobuf v1.23.0 ) // Used for debug reasons diff --git a/go.sum b/go.sum index 38c5900..163f26c 100644 --- a/go.sum +++ b/go.sum @@ -84,8 +84,8 @@ github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrU github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= github.com/golang/protobuf v1.4.0 h1:oOuy+ugB+P/kBdUnG5QaMXSIyJ1q38wWSojYCb3z5VQ= github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.2 h1:+Z5KGCizgyZCbGh1KZqA0fcLLkwbsjIzS4aV2v7wJX0= -github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.4.3 h1:JjCZWpVbqXDqFVmTfYWEVTMIYrL/NPdPSCHPJ0T/raM= +github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/snappy v0.0.0-20170215233205-553a64147049/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/gomodule/redigo v2.0.0+incompatible/go.mod h1:B4C85qUVwatsJoIUNIfCRsp7qO0iAmpGFZ4EELWSbC4= @@ -244,15 +244,11 @@ golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20191008105621-543471e840be/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191010194322-b09406accb47/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd h1:xhmwyvizuTgC2qz7ZlMluP20uW+C3Rm0FD/WLDX8884= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200420163511-1957bb5e6d1f h1:gWF768j/LaZugp8dyS4UwsslYCYz9XgFxvlgsn0n9H8= -golang.org/x/sys v0.0.0-20200420163511-1957bb5e6d1f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= -golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/tools v0.0.0-20180318012157-96caea41033d/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= @@ -265,8 +261,6 @@ google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8 h1:Nw54tB0rB7hY/N0 google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55 h1:gSJIx1SDwno+2ElGhA4+qG2zF97qiUzTM+rQ0klBOcE= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a h1:Ob5/580gVHBJZgXnff1cZDbG+xLtMVE5mDRTe+nIsX4= -google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= diff --git a/util/proto/marshal_test.go b/util/proto/marshal_test.go index de7b1ca..56e0a23 100644 --- a/util/proto/marshal_test.go +++ b/util/proto/marshal_test.go @@ -8,6 +8,7 @@ import ( "github.com/nspcc-dev/neofs-api-go/util/proto/test" "github.com/pkg/errors" "github.com/stretchr/testify/require" + goproto "google.golang.org/protobuf/proto" ) type SomeEnum int32 @@ -437,7 +438,7 @@ func testMarshal(t *testing.T, c stablePrimitives, tr test.Primitives, wrongFiel wire, err = c.stableMarshal(nil, wrongField) require.NoError(t, err) - wireGen, err := tr.Marshal() + wireGen, err := goproto.Marshal(&tr) require.NoError(t, err) if !wrongField { @@ -448,7 +449,7 @@ func testMarshal(t *testing.T, c stablePrimitives, tr test.Primitives, wrongFiel } result := new(test.Primitives) - err = result.Unmarshal(wire) + err = goproto.Unmarshal(wire, result) require.NoError(t, err) return result @@ -588,7 +589,7 @@ func testRepMarshal(t *testing.T, c stableRepPrimitives, tr test.RepPrimitives, wire, err = c.stableMarshal(nil, wrongField) require.NoError(t, err) - wireGen, err := tr.Marshal() + wireGen, err := goproto.Marshal(&tr) require.NoError(t, err) if !wrongField { @@ -599,7 +600,7 @@ func testRepMarshal(t *testing.T, c stableRepPrimitives, tr test.RepPrimitives, } result := new(test.RepPrimitives) - err = result.Unmarshal(wire) + err = goproto.Unmarshal(wire, result) require.NoError(t, err) return result diff --git a/util/proto/test/test.pb.go b/util/proto/test/test.pb.go index 686ef72..63134e7 100644 --- a/util/proto/test/test.pb.go +++ b/util/proto/test/test.pb.go @@ -1,26 +1,29 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.23.0 +// protoc v3.13.0 // source: util/proto/test/test.proto package test import ( - fmt "fmt" proto "github.com/golang/protobuf/proto" - io "io" - math "math" - math_bits "math/bits" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +// This is a compile-time assertion that a sufficiently up-to-date version +// of the legacy proto package is being used. +const _ = proto.ProtoPackageIsVersion4 type Primitives_SomeEnum int32 @@ -30,1300 +33,351 @@ const ( Primitives_NEGATIVE Primitives_SomeEnum = -1 ) -var Primitives_SomeEnum_name = map[int32]string{ - 0: "UNKNOWN", - 1: "POSITIVE", - -1: "NEGATIVE", -} +// Enum value maps for Primitives_SomeEnum. +var ( + Primitives_SomeEnum_name = map[int32]string{ + 0: "UNKNOWN", + 1: "POSITIVE", + -1: "NEGATIVE", + } + Primitives_SomeEnum_value = map[string]int32{ + "UNKNOWN": 0, + "POSITIVE": 1, + "NEGATIVE": -1, + } +) -var Primitives_SomeEnum_value = map[string]int32{ - "UNKNOWN": 0, - "POSITIVE": 1, - "NEGATIVE": -1, +func (x Primitives_SomeEnum) Enum() *Primitives_SomeEnum { + p := new(Primitives_SomeEnum) + *p = x + return p } func (x Primitives_SomeEnum) String() string { - return proto.EnumName(Primitives_SomeEnum_name, int32(x)) + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) } +func (Primitives_SomeEnum) Descriptor() protoreflect.EnumDescriptor { + return file_util_proto_test_test_proto_enumTypes[0].Descriptor() +} + +func (Primitives_SomeEnum) Type() protoreflect.EnumType { + return &file_util_proto_test_test_proto_enumTypes[0] +} + +func (x Primitives_SomeEnum) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use Primitives_SomeEnum.Descriptor instead. func (Primitives_SomeEnum) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_998ad0e1a3de8558, []int{0, 0} + return file_util_proto_test_test_proto_rawDescGZIP(), []int{0, 0} } type Primitives struct { - FieldA []byte `protobuf:"bytes,1,opt,name=field_a,json=fieldA,proto3" json:"field_a,omitempty"` - FieldB string `protobuf:"bytes,2,opt,name=field_b,json=fieldB,proto3" json:"field_b,omitempty"` - FieldC bool `protobuf:"varint,200,opt,name=field_c,json=fieldC,proto3" json:"field_c,omitempty"` - FieldD int32 `protobuf:"varint,201,opt,name=field_d,json=fieldD,proto3" json:"field_d,omitempty"` - FieldE uint32 `protobuf:"varint,202,opt,name=field_e,json=fieldE,proto3" json:"field_e,omitempty"` - FieldF int64 `protobuf:"varint,203,opt,name=field_f,json=fieldF,proto3" json:"field_f,omitempty"` - FieldG uint64 `protobuf:"varint,204,opt,name=field_g,json=fieldG,proto3" json:"field_g,omitempty"` - FieldH Primitives_SomeEnum `protobuf:"varint,300,opt,name=field_h,json=fieldH,proto3,enum=test.Primitives_SomeEnum" json:"field_h,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + FieldA []byte `protobuf:"bytes,1,opt,name=field_a,json=fieldA,proto3" json:"field_a,omitempty"` + FieldB string `protobuf:"bytes,2,opt,name=field_b,json=fieldB,proto3" json:"field_b,omitempty"` + FieldC bool `protobuf:"varint,200,opt,name=field_c,json=fieldC,proto3" json:"field_c,omitempty"` + FieldD int32 `protobuf:"varint,201,opt,name=field_d,json=fieldD,proto3" json:"field_d,omitempty"` + FieldE uint32 `protobuf:"varint,202,opt,name=field_e,json=fieldE,proto3" json:"field_e,omitempty"` + FieldF int64 `protobuf:"varint,203,opt,name=field_f,json=fieldF,proto3" json:"field_f,omitempty"` + FieldG uint64 `protobuf:"varint,204,opt,name=field_g,json=fieldG,proto3" json:"field_g,omitempty"` + FieldH Primitives_SomeEnum `protobuf:"varint,300,opt,name=field_h,json=fieldH,proto3,enum=test.Primitives_SomeEnum" json:"field_h,omitempty"` } -func (m *Primitives) Reset() { *m = Primitives{} } -func (m *Primitives) String() string { return proto.CompactTextString(m) } -func (*Primitives) ProtoMessage() {} -func (*Primitives) Descriptor() ([]byte, []int) { - return fileDescriptor_998ad0e1a3de8558, []int{0} -} -func (m *Primitives) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Primitives) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Primitives.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil +func (x *Primitives) Reset() { + *x = Primitives{} + if protoimpl.UnsafeEnabled { + mi := &file_util_proto_test_test_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } } -func (m *Primitives) XXX_Merge(src proto.Message) { - xxx_messageInfo_Primitives.Merge(m, src) -} -func (m *Primitives) XXX_Size() int { - return m.Size() -} -func (m *Primitives) XXX_DiscardUnknown() { - xxx_messageInfo_Primitives.DiscardUnknown(m) + +func (x *Primitives) String() string { + return protoimpl.X.MessageStringOf(x) } -var xxx_messageInfo_Primitives proto.InternalMessageInfo +func (*Primitives) ProtoMessage() {} -func (m *Primitives) GetFieldA() []byte { - if m != nil { - return m.FieldA +func (x *Primitives) ProtoReflect() protoreflect.Message { + mi := &file_util_proto_test_test_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Primitives.ProtoReflect.Descriptor instead. +func (*Primitives) Descriptor() ([]byte, []int) { + return file_util_proto_test_test_proto_rawDescGZIP(), []int{0} +} + +func (x *Primitives) GetFieldA() []byte { + if x != nil { + return x.FieldA } return nil } -func (m *Primitives) GetFieldB() string { - if m != nil { - return m.FieldB +func (x *Primitives) GetFieldB() string { + if x != nil { + return x.FieldB } return "" } -func (m *Primitives) GetFieldC() bool { - if m != nil { - return m.FieldC +func (x *Primitives) GetFieldC() bool { + if x != nil { + return x.FieldC } return false } -func (m *Primitives) GetFieldD() int32 { - if m != nil { - return m.FieldD +func (x *Primitives) GetFieldD() int32 { + if x != nil { + return x.FieldD } return 0 } -func (m *Primitives) GetFieldE() uint32 { - if m != nil { - return m.FieldE +func (x *Primitives) GetFieldE() uint32 { + if x != nil { + return x.FieldE } return 0 } -func (m *Primitives) GetFieldF() int64 { - if m != nil { - return m.FieldF +func (x *Primitives) GetFieldF() int64 { + if x != nil { + return x.FieldF } return 0 } -func (m *Primitives) GetFieldG() uint64 { - if m != nil { - return m.FieldG +func (x *Primitives) GetFieldG() uint64 { + if x != nil { + return x.FieldG } return 0 } -func (m *Primitives) GetFieldH() Primitives_SomeEnum { - if m != nil { - return m.FieldH +func (x *Primitives) GetFieldH() Primitives_SomeEnum { + if x != nil { + return x.FieldH } return Primitives_UNKNOWN } type RepPrimitives struct { - FieldA [][]byte `protobuf:"bytes,1,rep,name=field_a,json=fieldA,proto3" json:"field_a,omitempty"` - FieldB []string `protobuf:"bytes,2,rep,name=field_b,json=fieldB,proto3" json:"field_b,omitempty"` - FieldC []int32 `protobuf:"varint,3,rep,packed,name=field_c,json=fieldC,proto3" json:"field_c,omitempty"` - FieldD []uint32 `protobuf:"varint,4,rep,packed,name=field_d,json=fieldD,proto3" json:"field_d,omitempty"` - FieldE []int64 `protobuf:"varint,5,rep,packed,name=field_e,json=fieldE,proto3" json:"field_e,omitempty"` - FieldF []uint64 `protobuf:"varint,6,rep,packed,name=field_f,json=fieldF,proto3" json:"field_f,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + FieldA [][]byte `protobuf:"bytes,1,rep,name=field_a,json=fieldA,proto3" json:"field_a,omitempty"` + FieldB []string `protobuf:"bytes,2,rep,name=field_b,json=fieldB,proto3" json:"field_b,omitempty"` + FieldC []int32 `protobuf:"varint,3,rep,packed,name=field_c,json=fieldC,proto3" json:"field_c,omitempty"` + FieldD []uint32 `protobuf:"varint,4,rep,packed,name=field_d,json=fieldD,proto3" json:"field_d,omitempty"` + FieldE []int64 `protobuf:"varint,5,rep,packed,name=field_e,json=fieldE,proto3" json:"field_e,omitempty"` + FieldF []uint64 `protobuf:"varint,6,rep,packed,name=field_f,json=fieldF,proto3" json:"field_f,omitempty"` } -func (m *RepPrimitives) Reset() { *m = RepPrimitives{} } -func (m *RepPrimitives) String() string { return proto.CompactTextString(m) } -func (*RepPrimitives) ProtoMessage() {} +func (x *RepPrimitives) Reset() { + *x = RepPrimitives{} + if protoimpl.UnsafeEnabled { + mi := &file_util_proto_test_test_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RepPrimitives) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RepPrimitives) ProtoMessage() {} + +func (x *RepPrimitives) ProtoReflect() protoreflect.Message { + mi := &file_util_proto_test_test_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RepPrimitives.ProtoReflect.Descriptor instead. func (*RepPrimitives) Descriptor() ([]byte, []int) { - return fileDescriptor_998ad0e1a3de8558, []int{1} -} -func (m *RepPrimitives) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *RepPrimitives) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_RepPrimitives.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *RepPrimitives) XXX_Merge(src proto.Message) { - xxx_messageInfo_RepPrimitives.Merge(m, src) -} -func (m *RepPrimitives) XXX_Size() int { - return m.Size() -} -func (m *RepPrimitives) XXX_DiscardUnknown() { - xxx_messageInfo_RepPrimitives.DiscardUnknown(m) + return file_util_proto_test_test_proto_rawDescGZIP(), []int{1} } -var xxx_messageInfo_RepPrimitives proto.InternalMessageInfo - -func (m *RepPrimitives) GetFieldA() [][]byte { - if m != nil { - return m.FieldA +func (x *RepPrimitives) GetFieldA() [][]byte { + if x != nil { + return x.FieldA } return nil } -func (m *RepPrimitives) GetFieldB() []string { - if m != nil { - return m.FieldB +func (x *RepPrimitives) GetFieldB() []string { + if x != nil { + return x.FieldB } return nil } -func (m *RepPrimitives) GetFieldC() []int32 { - if m != nil { - return m.FieldC +func (x *RepPrimitives) GetFieldC() []int32 { + if x != nil { + return x.FieldC } return nil } -func (m *RepPrimitives) GetFieldD() []uint32 { - if m != nil { - return m.FieldD +func (x *RepPrimitives) GetFieldD() []uint32 { + if x != nil { + return x.FieldD } return nil } -func (m *RepPrimitives) GetFieldE() []int64 { - if m != nil { - return m.FieldE +func (x *RepPrimitives) GetFieldE() []int64 { + if x != nil { + return x.FieldE } return nil } -func (m *RepPrimitives) GetFieldF() []uint64 { - if m != nil { - return m.FieldF +func (x *RepPrimitives) GetFieldF() []uint64 { + if x != nil { + return x.FieldF } return nil } -func init() { - proto.RegisterEnum("test.Primitives_SomeEnum", Primitives_SomeEnum_name, Primitives_SomeEnum_value) - proto.RegisterType((*Primitives)(nil), "test.Primitives") - proto.RegisterType((*RepPrimitives)(nil), "test.RepPrimitives") -} +var File_util_proto_test_test_proto protoreflect.FileDescriptor -func init() { proto.RegisterFile("util/proto/test/test.proto", fileDescriptor_998ad0e1a3de8558) } - -var fileDescriptor_998ad0e1a3de8558 = []byte{ - // 312 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x2a, 0x2d, 0xc9, 0xcc, - 0xd1, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0xd7, 0x2f, 0x49, 0x2d, 0x2e, 0x01, 0x13, 0x7a, 0x60, 0xbe, - 0x10, 0x0b, 0x88, 0xad, 0xb4, 0x99, 0x89, 0x8b, 0x2b, 0xa0, 0x28, 0x33, 0x37, 0xb3, 0x24, 0xb3, - 0x2c, 0xb5, 0x58, 0x48, 0x9c, 0x8b, 0x3d, 0x2d, 0x33, 0x35, 0x27, 0x25, 0x3e, 0x51, 0x82, 0x51, - 0x81, 0x51, 0x83, 0x27, 0x88, 0x0d, 0xcc, 0x75, 0x44, 0x48, 0x24, 0x49, 0x30, 0x29, 0x30, 0x6a, - 0x70, 0x42, 0x25, 0x9c, 0x84, 0x24, 0x60, 0x12, 0xc9, 0x12, 0x27, 0x40, 0x5a, 0x38, 0xa0, 0x32, - 0xce, 0x08, 0x99, 0x14, 0x89, 0x93, 0x20, 0x19, 0x56, 0xa8, 0x8c, 0x0b, 0x42, 0x26, 0x55, 0xe2, - 0x14, 0x48, 0x86, 0x17, 0x2a, 0xe3, 0x8a, 0x90, 0x49, 0x93, 0x38, 0x0d, 0x92, 0x61, 0x86, 0xca, - 0xb8, 0x21, 0x64, 0xd2, 0x25, 0xce, 0x80, 0x64, 0x58, 0xa0, 0x32, 0xee, 0x42, 0xc6, 0x30, 0x99, - 0x0c, 0x89, 0x35, 0x20, 0xb7, 0xf1, 0x19, 0x49, 0xea, 0x81, 0xfd, 0x89, 0xf0, 0x97, 0x5e, 0x70, - 0x7e, 0x6e, 0xaa, 0x6b, 0x5e, 0x69, 0x2e, 0x54, 0x93, 0x87, 0x92, 0x0d, 0x17, 0x07, 0x4c, 0x4c, - 0x88, 0x9b, 0x8b, 0x3d, 0xd4, 0xcf, 0xdb, 0xcf, 0x3f, 0xdc, 0x4f, 0x80, 0x41, 0x88, 0x87, 0x8b, - 0x23, 0xc0, 0x3f, 0xd8, 0x33, 0xc4, 0x33, 0xcc, 0x55, 0x80, 0x51, 0x48, 0x94, 0x8b, 0xc3, 0xcf, - 0xd5, 0xdd, 0x11, 0xcc, 0xfb, 0x0f, 0x03, 0x8c, 0x4a, 0x4b, 0x19, 0xb9, 0x78, 0x83, 0x52, 0x0b, - 0x70, 0x05, 0x1c, 0x33, 0xae, 0x80, 0x63, 0x46, 0x0a, 0x38, 0x71, 0x44, 0xc0, 0x31, 0x2b, 0x30, - 0xc3, 0x43, 0xc7, 0x19, 0x21, 0x91, 0x22, 0xc1, 0xa2, 0xc0, 0x0c, 0x0f, 0x1c, 0x17, 0x84, 0x44, - 0xaa, 0x04, 0xab, 0x02, 0x33, 0x3c, 0x6c, 0x5c, 0x11, 0x12, 0x69, 0x12, 0x6c, 0x0a, 0xcc, 0xf0, - 0xa0, 0x71, 0x73, 0x12, 0x38, 0xf1, 0x48, 0x8e, 0xf1, 0xc2, 0x23, 0x39, 0xc6, 0x07, 0x8f, 0xe4, - 0x18, 0x67, 0x3c, 0x96, 0x63, 0x48, 0x62, 0x03, 0x47, 0xbe, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, - 0x56, 0x51, 0xcb, 0xb3, 0x1a, 0x02, 0x00, 0x00, -} - -func (m *Primitives) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Primitives) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Primitives) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.FieldH != 0 { - i = encodeVarintTest(dAtA, i, uint64(m.FieldH)) - i-- - dAtA[i] = 0x12 - i-- - dAtA[i] = 0xe0 - } - if m.FieldG != 0 { - i = encodeVarintTest(dAtA, i, uint64(m.FieldG)) - i-- - dAtA[i] = 0xc - i-- - dAtA[i] = 0xe0 - } - if m.FieldF != 0 { - i = encodeVarintTest(dAtA, i, uint64(m.FieldF)) - i-- - dAtA[i] = 0xc - i-- - dAtA[i] = 0xd8 - } - if m.FieldE != 0 { - i = encodeVarintTest(dAtA, i, uint64(m.FieldE)) - i-- - dAtA[i] = 0xc - i-- - dAtA[i] = 0xd0 - } - if m.FieldD != 0 { - i = encodeVarintTest(dAtA, i, uint64(m.FieldD)) - i-- - dAtA[i] = 0xc - i-- - dAtA[i] = 0xc8 - } - if m.FieldC { - i-- - if m.FieldC { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0xc - i-- - dAtA[i] = 0xc0 - } - if len(m.FieldB) > 0 { - i -= len(m.FieldB) - copy(dAtA[i:], m.FieldB) - i = encodeVarintTest(dAtA, i, uint64(len(m.FieldB))) - i-- - dAtA[i] = 0x12 - } - if len(m.FieldA) > 0 { - i -= len(m.FieldA) - copy(dAtA[i:], m.FieldA) - i = encodeVarintTest(dAtA, i, uint64(len(m.FieldA))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *RepPrimitives) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *RepPrimitives) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *RepPrimitives) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.FieldF) > 0 { - dAtA2 := make([]byte, len(m.FieldF)*10) - var j1 int - for _, num := range m.FieldF { - for num >= 1<<7 { - dAtA2[j1] = uint8(uint64(num)&0x7f | 0x80) - num >>= 7 - j1++ - } - dAtA2[j1] = uint8(num) - j1++ - } - i -= j1 - copy(dAtA[i:], dAtA2[:j1]) - i = encodeVarintTest(dAtA, i, uint64(j1)) - i-- - dAtA[i] = 0x32 - } - if len(m.FieldE) > 0 { - dAtA4 := make([]byte, len(m.FieldE)*10) - var j3 int - for _, num1 := range m.FieldE { - num := uint64(num1) - for num >= 1<<7 { - dAtA4[j3] = uint8(uint64(num)&0x7f | 0x80) - num >>= 7 - j3++ - } - dAtA4[j3] = uint8(num) - j3++ - } - i -= j3 - copy(dAtA[i:], dAtA4[:j3]) - i = encodeVarintTest(dAtA, i, uint64(j3)) - i-- - dAtA[i] = 0x2a - } - if len(m.FieldD) > 0 { - dAtA6 := make([]byte, len(m.FieldD)*10) - var j5 int - for _, num := range m.FieldD { - for num >= 1<<7 { - dAtA6[j5] = uint8(uint64(num)&0x7f | 0x80) - num >>= 7 - j5++ - } - dAtA6[j5] = uint8(num) - j5++ - } - i -= j5 - copy(dAtA[i:], dAtA6[:j5]) - i = encodeVarintTest(dAtA, i, uint64(j5)) - i-- - dAtA[i] = 0x22 - } - if len(m.FieldC) > 0 { - dAtA8 := make([]byte, len(m.FieldC)*10) - var j7 int - for _, num1 := range m.FieldC { - num := uint64(num1) - for num >= 1<<7 { - dAtA8[j7] = uint8(uint64(num)&0x7f | 0x80) - num >>= 7 - j7++ - } - dAtA8[j7] = uint8(num) - j7++ - } - i -= j7 - copy(dAtA[i:], dAtA8[:j7]) - i = encodeVarintTest(dAtA, i, uint64(j7)) - i-- - dAtA[i] = 0x1a - } - if len(m.FieldB) > 0 { - for iNdEx := len(m.FieldB) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.FieldB[iNdEx]) - copy(dAtA[i:], m.FieldB[iNdEx]) - i = encodeVarintTest(dAtA, i, uint64(len(m.FieldB[iNdEx]))) - i-- - dAtA[i] = 0x12 - } - } - if len(m.FieldA) > 0 { - for iNdEx := len(m.FieldA) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.FieldA[iNdEx]) - copy(dAtA[i:], m.FieldA[iNdEx]) - i = encodeVarintTest(dAtA, i, uint64(len(m.FieldA[iNdEx]))) - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func encodeVarintTest(dAtA []byte, offset int, v uint64) int { - offset -= sovTest(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *Primitives) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.FieldA) - if l > 0 { - n += 1 + l + sovTest(uint64(l)) - } - l = len(m.FieldB) - if l > 0 { - n += 1 + l + sovTest(uint64(l)) - } - if m.FieldC { - n += 3 - } - if m.FieldD != 0 { - n += 2 + sovTest(uint64(m.FieldD)) - } - if m.FieldE != 0 { - n += 2 + sovTest(uint64(m.FieldE)) - } - if m.FieldF != 0 { - n += 2 + sovTest(uint64(m.FieldF)) - } - if m.FieldG != 0 { - n += 2 + sovTest(uint64(m.FieldG)) - } - if m.FieldH != 0 { - n += 2 + sovTest(uint64(m.FieldH)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *RepPrimitives) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.FieldA) > 0 { - for _, b := range m.FieldA { - l = len(b) - n += 1 + l + sovTest(uint64(l)) - } - } - if len(m.FieldB) > 0 { - for _, s := range m.FieldB { - l = len(s) - n += 1 + l + sovTest(uint64(l)) - } - } - if len(m.FieldC) > 0 { - l = 0 - for _, e := range m.FieldC { - l += sovTest(uint64(e)) - } - n += 1 + sovTest(uint64(l)) + l - } - if len(m.FieldD) > 0 { - l = 0 - for _, e := range m.FieldD { - l += sovTest(uint64(e)) - } - n += 1 + sovTest(uint64(l)) + l - } - if len(m.FieldE) > 0 { - l = 0 - for _, e := range m.FieldE { - l += sovTest(uint64(e)) - } - n += 1 + sovTest(uint64(l)) + l - } - if len(m.FieldF) > 0 { - l = 0 - for _, e := range m.FieldF { - l += sovTest(uint64(e)) - } - n += 1 + sovTest(uint64(l)) + l - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func sovTest(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozTest(x uint64) (n int) { - return sovTest(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *Primitives) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTest - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Primitives: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Primitives: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field FieldA", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTest - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthTest - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthTest - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.FieldA = append(m.FieldA[:0], dAtA[iNdEx:postIndex]...) - if m.FieldA == nil { - m.FieldA = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field FieldB", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTest - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTest - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTest - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.FieldB = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 200: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field FieldC", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTest - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.FieldC = bool(v != 0) - case 201: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field FieldD", wireType) - } - m.FieldD = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTest - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.FieldD |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 202: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field FieldE", wireType) - } - m.FieldE = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTest - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.FieldE |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 203: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field FieldF", wireType) - } - m.FieldF = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTest - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.FieldF |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 204: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field FieldG", wireType) - } - m.FieldG = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTest - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.FieldG |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 300: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field FieldH", wireType) - } - m.FieldH = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTest - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.FieldH |= Primitives_SomeEnum(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipTest(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTest - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTest - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *RepPrimitives) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTest - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: RepPrimitives: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: RepPrimitives: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field FieldA", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTest - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthTest - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthTest - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.FieldA = append(m.FieldA, make([]byte, postIndex-iNdEx)) - copy(m.FieldA[len(m.FieldA)-1], dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field FieldB", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTest - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTest - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTest - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.FieldB = append(m.FieldB, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 3: - if wireType == 0 { - var v int32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTest - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.FieldC = append(m.FieldC, v) - } else if wireType == 2 { - var packedLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTest - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - packedLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if packedLen < 0 { - return ErrInvalidLengthTest - } - postIndex := iNdEx + packedLen - if postIndex < 0 { - return ErrInvalidLengthTest - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - var elementCount int - var count int - for _, integer := range dAtA[iNdEx:postIndex] { - if integer < 128 { - count++ - } - } - elementCount = count - if elementCount != 0 && len(m.FieldC) == 0 { - m.FieldC = make([]int32, 0, elementCount) - } - for iNdEx < postIndex { - var v int32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTest - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.FieldC = append(m.FieldC, v) - } - } else { - return fmt.Errorf("proto: wrong wireType = %d for field FieldC", wireType) - } - case 4: - if wireType == 0 { - var v uint32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTest - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.FieldD = append(m.FieldD, v) - } else if wireType == 2 { - var packedLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTest - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - packedLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if packedLen < 0 { - return ErrInvalidLengthTest - } - postIndex := iNdEx + packedLen - if postIndex < 0 { - return ErrInvalidLengthTest - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - var elementCount int - var count int - for _, integer := range dAtA[iNdEx:postIndex] { - if integer < 128 { - count++ - } - } - elementCount = count - if elementCount != 0 && len(m.FieldD) == 0 { - m.FieldD = make([]uint32, 0, elementCount) - } - for iNdEx < postIndex { - var v uint32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTest - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.FieldD = append(m.FieldD, v) - } - } else { - return fmt.Errorf("proto: wrong wireType = %d for field FieldD", wireType) - } - case 5: - if wireType == 0 { - var v int64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTest - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.FieldE = append(m.FieldE, v) - } else if wireType == 2 { - var packedLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTest - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - packedLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if packedLen < 0 { - return ErrInvalidLengthTest - } - postIndex := iNdEx + packedLen - if postIndex < 0 { - return ErrInvalidLengthTest - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - var elementCount int - var count int - for _, integer := range dAtA[iNdEx:postIndex] { - if integer < 128 { - count++ - } - } - elementCount = count - if elementCount != 0 && len(m.FieldE) == 0 { - m.FieldE = make([]int64, 0, elementCount) - } - for iNdEx < postIndex { - var v int64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTest - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.FieldE = append(m.FieldE, v) - } - } else { - return fmt.Errorf("proto: wrong wireType = %d for field FieldE", wireType) - } - case 6: - if wireType == 0 { - var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTest - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.FieldF = append(m.FieldF, v) - } else if wireType == 2 { - var packedLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTest - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - packedLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if packedLen < 0 { - return ErrInvalidLengthTest - } - postIndex := iNdEx + packedLen - if postIndex < 0 { - return ErrInvalidLengthTest - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - var elementCount int - var count int - for _, integer := range dAtA[iNdEx:postIndex] { - if integer < 128 { - count++ - } - } - elementCount = count - if elementCount != 0 && len(m.FieldF) == 0 { - m.FieldF = make([]uint64, 0, elementCount) - } - for iNdEx < postIndex { - var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTest - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.FieldF = append(m.FieldF, v) - } - } else { - return fmt.Errorf("proto: wrong wireType = %d for field FieldF", wireType) - } - default: - iNdEx = preIndex - skippy, err := skipTest(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTest - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTest - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipTest(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTest - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTest - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTest - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthTest - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupTest - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthTest - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF +var file_util_proto_test_test_proto_rawDesc = []byte{ + 0x0a, 0x1a, 0x75, 0x74, 0x69, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x74, 0x65, 0x73, + 0x74, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x04, 0x74, 0x65, + 0x73, 0x74, 0x22, 0xb3, 0x02, 0x0a, 0x0a, 0x50, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, + 0x73, 0x12, 0x17, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x61, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0c, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x41, 0x12, 0x17, 0x0a, 0x07, 0x66, 0x69, + 0x65, 0x6c, 0x64, 0x5f, 0x62, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x66, 0x69, 0x65, + 0x6c, 0x64, 0x42, 0x12, 0x18, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x63, 0x18, 0xc8, + 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x43, 0x12, 0x18, 0x0a, + 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x64, 0x18, 0xc9, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, + 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x44, 0x12, 0x18, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, + 0x5f, 0x65, 0x18, 0xca, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, + 0x45, 0x12, 0x18, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x66, 0x18, 0xcb, 0x01, 0x20, + 0x01, 0x28, 0x03, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x46, 0x12, 0x18, 0x0a, 0x07, 0x66, + 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x67, 0x18, 0xcc, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x66, + 0x69, 0x65, 0x6c, 0x64, 0x47, 0x12, 0x33, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x68, + 0x18, 0xac, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x19, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x50, + 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, 0x2e, 0x53, 0x6f, 0x6d, 0x65, 0x45, 0x6e, + 0x75, 0x6d, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x48, 0x22, 0x3c, 0x0a, 0x08, 0x53, 0x6f, + 0x6d, 0x65, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, + 0x4e, 0x10, 0x00, 0x12, 0x0c, 0x0a, 0x08, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x49, 0x56, 0x45, 0x10, + 0x01, 0x12, 0x15, 0x0a, 0x08, 0x4e, 0x45, 0x47, 0x41, 0x54, 0x49, 0x56, 0x45, 0x10, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0x22, 0xa5, 0x01, 0x0a, 0x0d, 0x52, 0x65, 0x70, + 0x50, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, 0x12, 0x17, 0x0a, 0x07, 0x66, 0x69, + 0x65, 0x6c, 0x64, 0x5f, 0x61, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x06, 0x66, 0x69, 0x65, + 0x6c, 0x64, 0x41, 0x12, 0x17, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x62, 0x18, 0x02, + 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x42, 0x12, 0x17, 0x0a, 0x07, + 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x63, 0x18, 0x03, 0x20, 0x03, 0x28, 0x05, 0x52, 0x06, 0x66, + 0x69, 0x65, 0x6c, 0x64, 0x43, 0x12, 0x17, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x64, + 0x18, 0x04, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x44, 0x12, 0x17, + 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x65, 0x18, 0x05, 0x20, 0x03, 0x28, 0x03, 0x52, + 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x45, 0x12, 0x17, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, + 0x5f, 0x66, 0x18, 0x06, 0x20, 0x03, 0x28, 0x04, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x46, + 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( - ErrInvalidLengthTest = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowTest = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupTest = fmt.Errorf("proto: unexpected end of group") + file_util_proto_test_test_proto_rawDescOnce sync.Once + file_util_proto_test_test_proto_rawDescData = file_util_proto_test_test_proto_rawDesc ) + +func file_util_proto_test_test_proto_rawDescGZIP() []byte { + file_util_proto_test_test_proto_rawDescOnce.Do(func() { + file_util_proto_test_test_proto_rawDescData = protoimpl.X.CompressGZIP(file_util_proto_test_test_proto_rawDescData) + }) + return file_util_proto_test_test_proto_rawDescData +} + +var file_util_proto_test_test_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_util_proto_test_test_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_util_proto_test_test_proto_goTypes = []interface{}{ + (Primitives_SomeEnum)(0), // 0: test.Primitives.SomeEnum + (*Primitives)(nil), // 1: test.Primitives + (*RepPrimitives)(nil), // 2: test.RepPrimitives +} +var file_util_proto_test_test_proto_depIdxs = []int32{ + 0, // 0: test.Primitives.field_h:type_name -> test.Primitives.SomeEnum + 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_util_proto_test_test_proto_init() } +func file_util_proto_test_test_proto_init() { + if File_util_proto_test_test_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_util_proto_test_test_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Primitives); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_util_proto_test_test_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RepPrimitives); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_util_proto_test_test_proto_rawDesc, + NumEnums: 1, + NumMessages: 2, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_util_proto_test_test_proto_goTypes, + DependencyIndexes: file_util_proto_test_test_proto_depIdxs, + EnumInfos: file_util_proto_test_test_proto_enumTypes, + MessageInfos: file_util_proto_test_test_proto_msgTypes, + }.Build() + File_util_proto_test_test_proto = out.File + file_util_proto_test_test_proto_rawDesc = nil + file_util_proto_test_test_proto_goTypes = nil + file_util_proto_test_test_proto_depIdxs = nil +} diff --git a/v2/accounting/grpc/service.pb.go b/v2/accounting/grpc/service.pb.go index d13be13..2f29d12 100644 --- a/v2/accounting/grpc/service.pb.go +++ b/v2/accounting/grpc/service.pb.go @@ -1,35 +1,42 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.23.0 +// protoc v3.13.0 // source: v2/accounting/grpc/service.proto package accounting import ( context "context" - fmt "fmt" proto "github.com/golang/protobuf/proto" grpc1 "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" grpc "github.com/nspcc-dev/neofs-api-go/v2/session/grpc" grpc2 "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" - io "io" - math "math" - math_bits "math/bits" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +// This is a compile-time assertion that a sufficiently up-to-date version +// of the legacy proto package is being used. +const _ = proto.ProtoPackageIsVersion4 // BalanceRequest message type BalanceRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // Body of the balance request message. Body *BalanceRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` // Carries request meta information. Header data is used only to regulate @@ -38,62 +45,128 @@ type BalanceRequest struct { // 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,proto3" json:"verify_header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + VerifyHeader *grpc.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` } -func (m *BalanceRequest) Reset() { *m = BalanceRequest{} } -func (m *BalanceRequest) String() string { return proto.CompactTextString(m) } -func (*BalanceRequest) ProtoMessage() {} -func (*BalanceRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_d9dd5af2ff2bbb25, []int{0} +func (x *BalanceRequest) Reset() { + *x = BalanceRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_accounting_grpc_service_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *BalanceRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) + +func (x *BalanceRequest) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *BalanceRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_BalanceRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err + +func (*BalanceRequest) ProtoMessage() {} + +func (x *BalanceRequest) ProtoReflect() protoreflect.Message { + mi := &file_v2_accounting_grpc_service_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) } - return b[:n], nil + return ms } -} -func (m *BalanceRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_BalanceRequest.Merge(m, src) -} -func (m *BalanceRequest) XXX_Size() int { - return m.Size() -} -func (m *BalanceRequest) XXX_DiscardUnknown() { - xxx_messageInfo_BalanceRequest.DiscardUnknown(m) + return mi.MessageOf(x) } -var xxx_messageInfo_BalanceRequest proto.InternalMessageInfo +// Deprecated: Use BalanceRequest.ProtoReflect.Descriptor instead. +func (*BalanceRequest) Descriptor() ([]byte, []int) { + return file_v2_accounting_grpc_service_proto_rawDescGZIP(), []int{0} +} -func (m *BalanceRequest) GetBody() *BalanceRequest_Body { - if m != nil { - return m.Body +func (x *BalanceRequest) GetBody() *BalanceRequest_Body { + if x != nil { + return x.Body } return nil } -func (m *BalanceRequest) GetMetaHeader() *grpc.RequestMetaHeader { - if m != nil { - return m.MetaHeader +func (x *BalanceRequest) GetMetaHeader() *grpc.RequestMetaHeader { + if x != nil { + return x.MetaHeader } return nil } -func (m *BalanceRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { - if m != nil { - return m.VerifyHeader +func (x *BalanceRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} + +// BalanceResponse message +type BalanceResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Body of the balance response message. + Body *BalanceResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" 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,proto3" json:"verify_header,omitempty"` +} + +func (x *BalanceResponse) Reset() { + *x = BalanceResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_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_v2_accounting_grpc_service_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use BalanceResponse.ProtoReflect.Descriptor instead. +func (*BalanceResponse) Descriptor() ([]byte, []int) { + return file_v2_accounting_grpc_service_proto_rawDescGZIP(), []int{1} +} + +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 } @@ -103,120 +176,50 @@ func (m *BalanceRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { // contract. If omitted, client implementation MUST set it to the request's // signer `OwnerID`. type BalanceRequest_Body struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // 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,proto3" json:"owner_id,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + OwnerId *grpc1.OwnerID `protobuf:"bytes,1,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"` } -func (m *BalanceRequest_Body) Reset() { *m = BalanceRequest_Body{} } -func (m *BalanceRequest_Body) String() string { return proto.CompactTextString(m) } -func (*BalanceRequest_Body) ProtoMessage() {} +func (x *BalanceRequest_Body) Reset() { + *x = BalanceRequest_Body{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_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_v2_accounting_grpc_service_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use BalanceRequest_Body.ProtoReflect.Descriptor instead. func (*BalanceRequest_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_d9dd5af2ff2bbb25, []int{0, 0} -} -func (m *BalanceRequest_Body) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *BalanceRequest_Body) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_BalanceRequest_Body.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *BalanceRequest_Body) XXX_Merge(src proto.Message) { - xxx_messageInfo_BalanceRequest_Body.Merge(m, src) -} -func (m *BalanceRequest_Body) XXX_Size() int { - return m.Size() -} -func (m *BalanceRequest_Body) XXX_DiscardUnknown() { - xxx_messageInfo_BalanceRequest_Body.DiscardUnknown(m) + return file_v2_accounting_grpc_service_proto_rawDescGZIP(), []int{0, 0} } -var xxx_messageInfo_BalanceRequest_Body proto.InternalMessageInfo - -func (m *BalanceRequest_Body) GetOwnerId() *grpc1.OwnerID { - if m != nil { - return m.OwnerId - } - return nil -} - -// BalanceResponse message -type BalanceResponse struct { - // Body of the balance response message. - Body *BalanceResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" 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,proto3" json:"verify_header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *BalanceResponse) Reset() { *m = BalanceResponse{} } -func (m *BalanceResponse) String() string { return proto.CompactTextString(m) } -func (*BalanceResponse) ProtoMessage() {} -func (*BalanceResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_d9dd5af2ff2bbb25, []int{1} -} -func (m *BalanceResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *BalanceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_BalanceResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *BalanceResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_BalanceResponse.Merge(m, src) -} -func (m *BalanceResponse) XXX_Size() int { - return m.Size() -} -func (m *BalanceResponse) XXX_DiscardUnknown() { - xxx_messageInfo_BalanceResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_BalanceResponse proto.InternalMessageInfo - -func (m *BalanceResponse) GetBody() *BalanceResponse_Body { - if m != nil { - return m.Body - } - return nil -} - -func (m *BalanceResponse) GetMetaHeader() *grpc.ResponseMetaHeader { - if m != nil { - return m.MetaHeader - } - return nil -} - -func (m *BalanceResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { - if m != nil { - return m.VerifyHeader +func (x *BalanceRequest_Body) GetOwnerId() *grpc1.OwnerID { + if x != nil { + return x.OwnerId } return nil } @@ -224,101 +227,244 @@ func (m *BalanceResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { // The amount of funds in GAS token for the `OwnerID`'s account requested. // Balance is `Decimal` format to avoid precision issues with rounding. type BalanceResponse_Body struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // Amount of funds in GAS token for the requested account. - Balance *Decimal `protobuf:"bytes,1,opt,name=balance,proto3" json:"balance,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Balance *Decimal `protobuf:"bytes,1,opt,name=balance,proto3" json:"balance,omitempty"` } -func (m *BalanceResponse_Body) Reset() { *m = BalanceResponse_Body{} } -func (m *BalanceResponse_Body) String() string { return proto.CompactTextString(m) } -func (*BalanceResponse_Body) ProtoMessage() {} -func (*BalanceResponse_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_d9dd5af2ff2bbb25, []int{1, 0} -} -func (m *BalanceResponse_Body) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *BalanceResponse_Body) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_BalanceResponse_Body.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil +func (x *BalanceResponse_Body) Reset() { + *x = BalanceResponse_Body{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_accounting_grpc_service_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } } -func (m *BalanceResponse_Body) XXX_Merge(src proto.Message) { - xxx_messageInfo_BalanceResponse_Body.Merge(m, src) -} -func (m *BalanceResponse_Body) XXX_Size() int { - return m.Size() -} -func (m *BalanceResponse_Body) XXX_DiscardUnknown() { - xxx_messageInfo_BalanceResponse_Body.DiscardUnknown(m) + +func (x *BalanceResponse_Body) String() string { + return protoimpl.X.MessageStringOf(x) } -var xxx_messageInfo_BalanceResponse_Body proto.InternalMessageInfo +func (*BalanceResponse_Body) ProtoMessage() {} -func (m *BalanceResponse_Body) GetBalance() *Decimal { - if m != nil { - return m.Balance +func (x *BalanceResponse_Body) ProtoReflect() protoreflect.Message { + mi := &file_v2_accounting_grpc_service_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use BalanceResponse_Body.ProtoReflect.Descriptor instead. +func (*BalanceResponse_Body) Descriptor() ([]byte, []int) { + return file_v2_accounting_grpc_service_proto_rawDescGZIP(), []int{1, 0} +} + +func (x *BalanceResponse_Body) GetBalance() *Decimal { + if x != nil { + return x.Balance } return nil } -func init() { - proto.RegisterType((*BalanceRequest)(nil), "neo.fs.v2.accounting.BalanceRequest") - proto.RegisterType((*BalanceRequest_Body)(nil), "neo.fs.v2.accounting.BalanceRequest.Body") - proto.RegisterType((*BalanceResponse)(nil), "neo.fs.v2.accounting.BalanceResponse") - proto.RegisterType((*BalanceResponse_Body)(nil), "neo.fs.v2.accounting.BalanceResponse.Body") +var File_v2_accounting_grpc_service_proto protoreflect.FileDescriptor + +var file_v2_accounting_grpc_service_proto_rawDesc = []byte{ + 0x0a, 0x20, 0x76, 0x32, 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, 0x1e, 0x76, 0x32, 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, 0x18, 0x76, 0x32, 0x2f, 0x72, 0x65, 0x66, + 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x1a, 0x1b, 0x76, 0x32, 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, 0x5b, 0x5a, 0x3f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, + 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, + 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 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, 0x17, 0x4e, 0x65, 0x6f, 0x46, 0x53, + 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x76, 0x32, 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x69, + 0x6e, 0x67, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } -func init() { proto.RegisterFile("v2/accounting/grpc/service.proto", fileDescriptor_d9dd5af2ff2bbb25) } +var ( + file_v2_accounting_grpc_service_proto_rawDescOnce sync.Once + file_v2_accounting_grpc_service_proto_rawDescData = file_v2_accounting_grpc_service_proto_rawDesc +) -var fileDescriptor_d9dd5af2ff2bbb25 = []byte{ - // 442 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x93, 0xdb, 0x6a, 0xd4, 0x40, - 0x1c, 0xc6, 0x4d, 0x2c, 0xae, 0x4c, 0x3d, 0xe0, 0x20, 0x74, 0x89, 0x18, 0x4a, 0x69, 0x41, 0xc5, - 0xcc, 0x40, 0xbc, 0x10, 0x14, 0x2d, 0x5d, 0x6a, 0x71, 0x2f, 0x3c, 0xa5, 0xd0, 0x0b, 0x6f, 0xca, - 0x64, 0xf2, 0x4f, 0x3a, 0xb4, 0x99, 0x89, 0x99, 0xd9, 0x48, 0xde, 0xc4, 0x17, 0xf0, 0xc6, 0x0b, - 0x9f, 0xc3, 0x4b, 0x1f, 0x41, 0xd6, 0x17, 0x91, 0x1c, 0xf6, 0xc4, 0x66, 0xdd, 0xbd, 0xcb, 0xf0, - 0xff, 0xbe, 0x2f, 0xff, 0xef, 0xc7, 0x0c, 0xda, 0x2d, 0x7c, 0xca, 0x38, 0x57, 0x23, 0x69, 0x84, - 0x4c, 0x68, 0x92, 0x67, 0x9c, 0x6a, 0xc8, 0x0b, 0xc1, 0x81, 0x64, 0xb9, 0x32, 0x0a, 0xdf, 0x97, - 0xa0, 0x48, 0xac, 0x49, 0xe1, 0x93, 0x99, 0xd0, 0x71, 0x3b, 0x7c, 0xa6, 0xcc, 0x40, 0x37, 0x2e, - 0xa7, 0x5f, 0xf8, 0x34, 0x87, 0x58, 0x2f, 0x4f, 0x1e, 0x14, 0x3e, 0xd5, 0xa0, 0xb5, 0x50, 0x72, - 0x69, 0xb8, 0xf7, 0xdd, 0x46, 0x77, 0x06, 0xec, 0x8a, 0x49, 0x0e, 0x01, 0x7c, 0x19, 0x81, 0x36, - 0xf8, 0x15, 0xda, 0x0a, 0x55, 0x54, 0xf6, 0xad, 0x5d, 0xeb, 0xd1, 0xb6, 0xff, 0x98, 0x74, 0xad, - 0x43, 0x16, 0x3d, 0x64, 0xa0, 0xa2, 0x32, 0xa8, 0x6d, 0xf8, 0x0d, 0xda, 0x4e, 0xc1, 0xb0, 0xf3, - 0x0b, 0x60, 0x11, 0xe4, 0x7d, 0xbb, 0x4e, 0xd9, 0x9f, 0x4b, 0x69, 0x77, 0x21, 0xad, 0xf7, 0x1d, - 0x18, 0xf6, 0xb6, 0xd6, 0x06, 0x28, 0x9d, 0x7e, 0xe3, 0x4f, 0xe8, 0x76, 0x01, 0xb9, 0x88, 0xcb, - 0x49, 0xd0, 0xf5, 0x3a, 0xe8, 0xe9, 0xea, 0xa0, 0xb3, 0x4a, 0x2e, 0x38, 0x33, 0x42, 0xc9, 0x36, - 0xf0, 0x56, 0x13, 0xd1, 0x9c, 0x9c, 0x17, 0x68, 0xab, 0xda, 0x13, 0xfb, 0xe8, 0xa6, 0xfa, 0x2a, - 0x21, 0x3f, 0x17, 0x51, 0x5b, 0x72, 0x67, 0x2e, 0xb5, 0x82, 0x48, 0x3e, 0x54, 0xf3, 0xe1, 0x71, - 0xd0, 0xab, 0x85, 0xc3, 0x68, 0xef, 0xa7, 0x8d, 0xee, 0x4e, 0x3b, 0xeb, 0x4c, 0x49, 0x0d, 0xf8, - 0xf5, 0x02, 0xa8, 0x27, 0x6b, 0x40, 0x35, 0xa6, 0x79, 0x52, 0x27, 0x5d, 0xa4, 0x0e, 0x3a, 0x0b, - 0x36, 0xe6, 0x15, 0xa8, 0x82, 0x6e, 0x54, 0xde, 0x7f, 0x92, 0xd6, 0xb2, 0x3a, 0x6c, 0x59, 0x3d, - 0x47, 0xbd, 0xb0, 0x69, 0xd0, 0xd6, 0x7c, 0xd8, 0x5d, 0xf3, 0x18, 0xb8, 0x48, 0xd9, 0x55, 0x30, - 0x51, 0xfb, 0x97, 0xe8, 0xde, 0xd1, 0x74, 0x7c, 0xda, 0x5c, 0x70, 0x7c, 0x86, 0x7a, 0x2d, 0x0f, - 0xbc, 0xbf, 0xc9, 0xbd, 0x72, 0x0e, 0x36, 0x82, 0x3a, 0xb8, 0xfc, 0x35, 0x76, 0xad, 0xdf, 0x63, - 0xd7, 0xfa, 0x33, 0x76, 0xad, 0x6f, 0x7f, 0xdd, 0x6b, 0x9f, 0x0f, 0x13, 0x61, 0x2e, 0x46, 0x21, - 0xe1, 0x2a, 0xa5, 0x52, 0x67, 0x9c, 0x7b, 0x11, 0x14, 0x54, 0x82, 0x8a, 0xb5, 0xc7, 0x32, 0xe1, - 0x25, 0x8a, 0x2e, 0x3f, 0xa8, 0x97, 0xb3, 0xf3, 0x0f, 0x7b, 0xe7, 0x3d, 0xa8, 0x93, 0x53, 0x72, - 0xf4, 0x71, 0x58, 0xfd, 0x7c, 0xd6, 0x25, 0xbc, 0x51, 0xbf, 0x9c, 0x67, 0xff, 0x02, 0x00, 0x00, - 0xff, 0xff, 0x54, 0x53, 0x6d, 0x41, 0xca, 0x03, 0x00, 0x00, +func file_v2_accounting_grpc_service_proto_rawDescGZIP() []byte { + file_v2_accounting_grpc_service_proto_rawDescOnce.Do(func() { + file_v2_accounting_grpc_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_v2_accounting_grpc_service_proto_rawDescData) + }) + return file_v2_accounting_grpc_service_proto_rawDescData +} + +var file_v2_accounting_grpc_service_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_v2_accounting_grpc_service_proto_goTypes = []interface{}{ + (*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_v2_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_v2_accounting_grpc_service_proto_init() } +func file_v2_accounting_grpc_service_proto_init() { + if File_v2_accounting_grpc_service_proto != nil { + return + } + file_v2_accounting_grpc_types_proto_init() + if !protoimpl.UnsafeEnabled { + file_v2_accounting_grpc_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*BalanceRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_accounting_grpc_service_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*BalanceResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_accounting_grpc_service_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*BalanceRequest_Body); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_accounting_grpc_service_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*BalanceResponse_Body); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_v2_accounting_grpc_service_proto_rawDesc, + NumEnums: 0, + NumMessages: 4, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_v2_accounting_grpc_service_proto_goTypes, + DependencyIndexes: file_v2_accounting_grpc_service_proto_depIdxs, + MessageInfos: file_v2_accounting_grpc_service_proto_msgTypes, + }.Build() + File_v2_accounting_grpc_service_proto = out.File + file_v2_accounting_grpc_service_proto_rawDesc = nil + file_v2_accounting_grpc_service_proto_goTypes = nil + file_v2_accounting_grpc_service_proto_depIdxs = nil } // Reference imports to suppress errors if they are not otherwise used. var _ context.Context -var _ grpc2.ClientConn +var _ grpc2.ClientConnInterface // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -const _ = grpc2.SupportPackageIsVersion4 +const _ = grpc2.SupportPackageIsVersion6 // AccountingServiceClient is the client API for AccountingService service. // @@ -329,10 +475,10 @@ type AccountingServiceClient interface { } type accountingServiceClient struct { - cc *grpc2.ClientConn + cc grpc2.ClientConnInterface } -func NewAccountingServiceClient(cc *grpc2.ClientConn) AccountingServiceClient { +func NewAccountingServiceClient(cc grpc2.ClientConnInterface) AccountingServiceClient { return &accountingServiceClient{cc} } @@ -355,7 +501,7 @@ type AccountingServiceServer interface { type UnimplementedAccountingServiceServer struct { } -func (*UnimplementedAccountingServiceServer) Balance(ctx context.Context, req *BalanceRequest) (*BalanceResponse, error) { +func (*UnimplementedAccountingServiceServer) Balance(context.Context, *BalanceRequest) (*BalanceResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Balance not implemented") } @@ -393,893 +539,3 @@ var _AccountingService_serviceDesc = grpc2.ServiceDesc{ Streams: []grpc2.StreamDesc{}, Metadata: "v2/accounting/grpc/service.proto", } - -func (m *BalanceRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *BalanceRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *BalanceRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.VerifyHeader != nil { - { - size, err := m.VerifyHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if m.MetaHeader != nil { - { - size, err := m.MetaHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.Body != nil { - { - size, err := m.Body.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *BalanceRequest_Body) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *BalanceRequest_Body) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *BalanceRequest_Body) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.OwnerId != nil { - { - size, err := m.OwnerId.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *BalanceResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *BalanceResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *BalanceResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.VerifyHeader != nil { - { - size, err := m.VerifyHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if m.MetaHeader != nil { - { - size, err := m.MetaHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.Body != nil { - { - size, err := m.Body.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *BalanceResponse_Body) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *BalanceResponse_Body) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *BalanceResponse_Body) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.Balance != nil { - { - size, err := m.Balance.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func encodeVarintService(dAtA []byte, offset int, v uint64) int { - offset -= sovService(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *BalanceRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Body != nil { - l = m.Body.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.MetaHeader != nil { - l = m.MetaHeader.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.VerifyHeader != nil { - l = m.VerifyHeader.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *BalanceRequest_Body) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.OwnerId != nil { - l = m.OwnerId.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *BalanceResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Body != nil { - l = m.Body.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.MetaHeader != nil { - l = m.MetaHeader.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.VerifyHeader != nil { - l = m.VerifyHeader.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *BalanceResponse_Body) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Balance != nil { - l = m.Balance.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func sovService(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozService(x uint64) (n int) { - return sovService(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *BalanceRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: BalanceRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: BalanceRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Body", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Body == nil { - m.Body = &BalanceRequest_Body{} - } - if err := m.Body.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MetaHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.MetaHeader == nil { - m.MetaHeader = &grpc.RequestMetaHeader{} - } - if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field VerifyHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.VerifyHeader == nil { - m.VerifyHeader = &grpc.RequestVerificationHeader{} - } - if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *BalanceRequest_Body) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Body: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Body: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OwnerId", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.OwnerId == nil { - m.OwnerId = &grpc1.OwnerID{} - } - if err := m.OwnerId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *BalanceResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: BalanceResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: BalanceResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Body", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Body == nil { - m.Body = &BalanceResponse_Body{} - } - if err := m.Body.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MetaHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.MetaHeader == nil { - m.MetaHeader = &grpc.ResponseMetaHeader{} - } - if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field VerifyHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.VerifyHeader == nil { - m.VerifyHeader = &grpc.ResponseVerificationHeader{} - } - if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *BalanceResponse_Body) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Body: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Body: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Balance", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Balance == nil { - m.Balance = &Decimal{} - } - if err := m.Balance.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipService(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowService - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowService - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowService - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthService - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupService - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthService - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthService = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowService = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupService = fmt.Errorf("proto: unexpected end of group") -) diff --git a/v2/accounting/grpc/types.pb.go b/v2/accounting/grpc/types.pb.go index 7de8bd8..dd62f96 100644 --- a/v2/accounting/grpc/types.pb.go +++ b/v2/accounting/grpc/types.pb.go @@ -1,26 +1,29 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.23.0 +// protoc v3.13.0 // source: v2/accounting/grpc/types.proto package accounting import ( - fmt "fmt" proto "github.com/golang/protobuf/proto" - io "io" - math "math" - math_bits "math/bits" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +// This is a compile-time assertion that a sufficiently up-to-date version +// of the legacy proto package is being used. +const _ = proto.ProtoPackageIsVersion4 // Standard floating point data type can't be used in NeoFS due to inexactness // of the result when doing lots of small number operations. To solve the lost @@ -30,331 +33,141 @@ const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package // Specification](http://speleotrove.com/decimal/) for detailed problem // description. type Decimal struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // Number in smallest Token fractions. Value int64 `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"` // Precision value indicating how many smallest fractions can be in one // integer. - Precision uint32 `protobuf:"varint,2,opt,name=precision,proto3" json:"precision,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Precision uint32 `protobuf:"varint,2,opt,name=precision,proto3" json:"precision,omitempty"` } -func (m *Decimal) Reset() { *m = Decimal{} } -func (m *Decimal) String() string { return proto.CompactTextString(m) } -func (*Decimal) ProtoMessage() {} +func (x *Decimal) Reset() { + *x = Decimal{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_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_v2_accounting_grpc_types_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Decimal.ProtoReflect.Descriptor instead. func (*Decimal) Descriptor() ([]byte, []int) { - return fileDescriptor_86d8857937dfd0e8, []int{0} -} -func (m *Decimal) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Decimal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Decimal.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *Decimal) XXX_Merge(src proto.Message) { - xxx_messageInfo_Decimal.Merge(m, src) -} -func (m *Decimal) XXX_Size() int { - return m.Size() -} -func (m *Decimal) XXX_DiscardUnknown() { - xxx_messageInfo_Decimal.DiscardUnknown(m) + return file_v2_accounting_grpc_types_proto_rawDescGZIP(), []int{0} } -var xxx_messageInfo_Decimal proto.InternalMessageInfo - -func (m *Decimal) GetValue() int64 { - if m != nil { - return m.Value +func (x *Decimal) GetValue() int64 { + if x != nil { + return x.Value } return 0 } -func (m *Decimal) GetPrecision() uint32 { - if m != nil { - return m.Precision +func (x *Decimal) GetPrecision() uint32 { + if x != nil { + return x.Precision } return 0 } -func init() { - proto.RegisterType((*Decimal)(nil), "neo.fs.v2.accounting.Decimal") -} +var File_v2_accounting_grpc_types_proto protoreflect.FileDescriptor -func init() { proto.RegisterFile("v2/accounting/grpc/types.proto", fileDescriptor_86d8857937dfd0e8) } - -var fileDescriptor_86d8857937dfd0e8 = []byte{ - // 203 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x2b, 0x33, 0xd2, 0x4f, - 0x4c, 0x4e, 0xce, 0x2f, 0xcd, 0x2b, 0xc9, 0xcc, 0x4b, 0xd7, 0x4f, 0x2f, 0x2a, 0x48, 0xd6, 0x2f, - 0xa9, 0x2c, 0x48, 0x2d, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0xc9, 0x4b, 0xcd, 0xd7, - 0x4b, 0x2b, 0xd6, 0x2b, 0x33, 0xd2, 0x43, 0x28, 0x53, 0xb2, 0xe5, 0x62, 0x77, 0x49, 0x4d, 0xce, - 0xcc, 0x4d, 0xcc, 0x11, 0x12, 0xe1, 0x62, 0x2d, 0x4b, 0xcc, 0x29, 0x4d, 0x95, 0x60, 0x54, 0x60, - 0xd4, 0x60, 0x0e, 0x82, 0x70, 0x84, 0x64, 0xb8, 0x38, 0x0b, 0x8a, 0x52, 0x93, 0x33, 0x8b, 0x33, - 0xf3, 0xf3, 0x24, 0x98, 0x14, 0x18, 0x35, 0x78, 0x83, 0x10, 0x02, 0x4e, 0xd9, 0x27, 0x1e, 0xc9, - 0x31, 0x5e, 0x78, 0x24, 0xc7, 0xf8, 0xe0, 0x91, 0x1c, 0xe3, 0x8c, 0xc7, 0x72, 0x0c, 0x51, 0xf6, - 0xe9, 0x99, 0x25, 0x19, 0xa5, 0x49, 0x7a, 0xc9, 0xf9, 0xb9, 0xfa, 0x79, 0xc5, 0x05, 0xc9, 0xc9, - 0xba, 0x29, 0xa9, 0x65, 0xfa, 0x79, 0xa9, 0xf9, 0x69, 0xc5, 0xba, 0x89, 0x05, 0x99, 0xba, 0xe9, - 0xf9, 0xfa, 0x98, 0x0e, 0xb5, 0x46, 0xf0, 0x57, 0x31, 0x89, 0xfb, 0xa5, 0xe6, 0xbb, 0x05, 0xeb, - 0x39, 0x06, 0x78, 0x82, 0xdc, 0xea, 0x08, 0x97, 0x49, 0x62, 0x03, 0x7b, 0xc4, 0x18, 0x10, 0x00, - 0x00, 0xff, 0xff, 0xcd, 0x8e, 0x26, 0xec, 0xea, 0x00, 0x00, 0x00, -} - -func (m *Decimal) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Decimal) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Decimal) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.Precision != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.Precision)) - i-- - dAtA[i] = 0x10 - } - if m.Value != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.Value)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func encodeVarintTypes(dAtA []byte, offset int, v uint64) int { - offset -= sovTypes(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *Decimal) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Value != 0 { - n += 1 + sovTypes(uint64(m.Value)) - } - if m.Precision != 0 { - n += 1 + sovTypes(uint64(m.Precision)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func sovTypes(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozTypes(x uint64) (n int) { - return sovTypes(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *Decimal) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Decimal: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Decimal: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) - } - m.Value = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Value |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Precision", wireType) - } - m.Precision = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Precision |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipTypes(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTypes - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTypes - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTypes - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthTypes - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupTypes - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthTypes - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF +var file_v2_accounting_grpc_types_proto_rawDesc = []byte{ + 0x0a, 0x1e, 0x76, 0x32, 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, 0x5b, 0x5a, 0x3f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, + 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, + 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 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, 0x17, 0x4e, 0x65, 0x6f, 0x46, 0x53, + 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x76, 0x32, 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x69, + 0x6e, 0x67, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( - ErrInvalidLengthTypes = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowTypes = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupTypes = fmt.Errorf("proto: unexpected end of group") + file_v2_accounting_grpc_types_proto_rawDescOnce sync.Once + file_v2_accounting_grpc_types_proto_rawDescData = file_v2_accounting_grpc_types_proto_rawDesc ) + +func file_v2_accounting_grpc_types_proto_rawDescGZIP() []byte { + file_v2_accounting_grpc_types_proto_rawDescOnce.Do(func() { + file_v2_accounting_grpc_types_proto_rawDescData = protoimpl.X.CompressGZIP(file_v2_accounting_grpc_types_proto_rawDescData) + }) + return file_v2_accounting_grpc_types_proto_rawDescData +} + +var file_v2_accounting_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_v2_accounting_grpc_types_proto_goTypes = []interface{}{ + (*Decimal)(nil), // 0: neo.fs.v2.accounting.Decimal +} +var file_v2_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_v2_accounting_grpc_types_proto_init() } +func file_v2_accounting_grpc_types_proto_init() { + if File_v2_accounting_grpc_types_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_v2_accounting_grpc_types_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Decimal); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_v2_accounting_grpc_types_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_v2_accounting_grpc_types_proto_goTypes, + DependencyIndexes: file_v2_accounting_grpc_types_proto_depIdxs, + MessageInfos: file_v2_accounting_grpc_types_proto_msgTypes, + }.Build() + File_v2_accounting_grpc_types_proto = out.File + file_v2_accounting_grpc_types_proto_rawDesc = nil + file_v2_accounting_grpc_types_proto_goTypes = nil + file_v2_accounting_grpc_types_proto_depIdxs = nil +} diff --git a/v2/accounting/marshal_test.go b/v2/accounting/marshal_test.go index 5d708c5..4b42304 100644 --- a/v2/accounting/marshal_test.go +++ b/v2/accounting/marshal_test.go @@ -7,6 +7,7 @@ import ( grpc "github.com/nspcc-dev/neofs-api-go/v2/accounting/grpc" "github.com/nspcc-dev/neofs-api-go/v2/refs" "github.com/stretchr/testify/require" + goproto "google.golang.org/protobuf/proto" ) func TestDecimal_StableMarshal(t *testing.T) { @@ -17,7 +18,7 @@ func TestDecimal_StableMarshal(t *testing.T) { wire, err := decimalFrom.StableMarshal(nil) require.NoError(t, err) - err = transport.Unmarshal(wire) + err = goproto.Unmarshal(wire, transport) require.NoError(t, err) decimalTo := accounting.DecimalFromGRPCMessage(transport) @@ -33,7 +34,7 @@ func TestBalanceRequestBody_StableMarshal(t *testing.T) { wire, err := requestBodyFrom.StableMarshal(nil) require.NoError(t, err) - err = transport.Unmarshal(wire) + err = goproto.Unmarshal(wire, transport) require.NoError(t, err) requestBodyTo := accounting.BalanceRequestBodyFromGRPCMessage(transport) @@ -49,7 +50,7 @@ func TestBalanceResponseBody_StableMarshal(t *testing.T) { wire, err := responseBodyFrom.StableMarshal(nil) require.NoError(t, err) - err = transport.Unmarshal(wire) + err = goproto.Unmarshal(wire, transport) require.NoError(t, err) responseBodyTo := accounting.BalanceResponseBodyFromGRPCMessage(transport) diff --git a/v2/acl/grpc/types.pb.go b/v2/acl/grpc/types.pb.go index 81467b2..a421a7c 100644 --- a/v2/acl/grpc/types.pb.go +++ b/v2/acl/grpc/types.pb.go @@ -1,27 +1,30 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.23.0 +// protoc v3.13.0 // source: v2/acl/grpc/types.proto package acl import ( - fmt "fmt" proto "github.com/golang/protobuf/proto" grpc "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" - io "io" - math "math" - math_bits "math/bits" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +// This is a compile-time assertion that a sufficiently up-to-date version +// of the legacy proto package is being used. +const _ = proto.ProtoPackageIsVersion4 // Target role of the access control rule in access control list. type Role int32 @@ -38,26 +41,47 @@ const ( Role_OTHERS Role = 3 ) -var Role_name = map[int32]string{ - 0: "ROLE_UNSPECIFIED", - 1: "USER", - 2: "SYSTEM", - 3: "OTHERS", -} +// Enum value maps for Role. +var ( + Role_name = map[int32]string{ + 0: "ROLE_UNSPECIFIED", + 1: "USER", + 2: "SYSTEM", + 3: "OTHERS", + } + Role_value = map[string]int32{ + "ROLE_UNSPECIFIED": 0, + "USER": 1, + "SYSTEM": 2, + "OTHERS": 3, + } +) -var Role_value = map[string]int32{ - "ROLE_UNSPECIFIED": 0, - "USER": 1, - "SYSTEM": 2, - "OTHERS": 3, +func (x Role) Enum() *Role { + p := new(Role) + *p = x + return p } func (x Role) String() string { - return proto.EnumName(Role_name, int32(x)) + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) } +func (Role) Descriptor() protoreflect.EnumDescriptor { + return file_v2_acl_grpc_types_proto_enumTypes[0].Descriptor() +} + +func (Role) Type() protoreflect.EnumType { + return &file_v2_acl_grpc_types_proto_enumTypes[0] +} + +func (x Role) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use Role.Descriptor instead. func (Role) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_8233b6696fb3e24f, []int{0} + return file_v2_acl_grpc_types_proto_rawDescGZIP(), []int{0} } // MatchType is an enumeration of match types. @@ -72,24 +96,45 @@ const ( MatchType_STRING_NOT_EQUAL MatchType = 2 ) -var MatchType_name = map[int32]string{ - 0: "MATCH_TYPE_UNSPECIFIED", - 1: "STRING_EQUAL", - 2: "STRING_NOT_EQUAL", -} +// Enum value maps for MatchType. +var ( + MatchType_name = map[int32]string{ + 0: "MATCH_TYPE_UNSPECIFIED", + 1: "STRING_EQUAL", + 2: "STRING_NOT_EQUAL", + } + MatchType_value = map[string]int32{ + "MATCH_TYPE_UNSPECIFIED": 0, + "STRING_EQUAL": 1, + "STRING_NOT_EQUAL": 2, + } +) -var MatchType_value = map[string]int32{ - "MATCH_TYPE_UNSPECIFIED": 0, - "STRING_EQUAL": 1, - "STRING_NOT_EQUAL": 2, +func (x MatchType) Enum() *MatchType { + p := new(MatchType) + *p = x + return p } func (x MatchType) String() string { - return proto.EnumName(MatchType_name, int32(x)) + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) } +func (MatchType) Descriptor() protoreflect.EnumDescriptor { + return file_v2_acl_grpc_types_proto_enumTypes[1].Descriptor() +} + +func (MatchType) Type() protoreflect.EnumType { + return &file_v2_acl_grpc_types_proto_enumTypes[1] +} + +func (x MatchType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use MatchType.Descriptor instead. func (MatchType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_8233b6696fb3e24f, []int{1} + return file_v2_acl_grpc_types_proto_rawDescGZIP(), []int{1} } // Request's operation type to match if the rule is applicable to a particular @@ -115,34 +160,55 @@ const ( Operation_GETRANGEHASH Operation = 7 ) -var Operation_name = map[int32]string{ - 0: "OPERATION_UNSPECIFIED", - 1: "GET", - 2: "HEAD", - 3: "PUT", - 4: "DELETE", - 5: "SEARCH", - 6: "GETRANGE", - 7: "GETRANGEHASH", -} +// Enum value maps for Operation. +var ( + Operation_name = map[int32]string{ + 0: "OPERATION_UNSPECIFIED", + 1: "GET", + 2: "HEAD", + 3: "PUT", + 4: "DELETE", + 5: "SEARCH", + 6: "GETRANGE", + 7: "GETRANGEHASH", + } + Operation_value = map[string]int32{ + "OPERATION_UNSPECIFIED": 0, + "GET": 1, + "HEAD": 2, + "PUT": 3, + "DELETE": 4, + "SEARCH": 5, + "GETRANGE": 6, + "GETRANGEHASH": 7, + } +) -var Operation_value = map[string]int32{ - "OPERATION_UNSPECIFIED": 0, - "GET": 1, - "HEAD": 2, - "PUT": 3, - "DELETE": 4, - "SEARCH": 5, - "GETRANGE": 6, - "GETRANGEHASH": 7, +func (x Operation) Enum() *Operation { + p := new(Operation) + *p = x + return p } func (x Operation) String() string { - return proto.EnumName(Operation_name, int32(x)) + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) } +func (Operation) Descriptor() protoreflect.EnumDescriptor { + return file_v2_acl_grpc_types_proto_enumTypes[2].Descriptor() +} + +func (Operation) Type() protoreflect.EnumType { + return &file_v2_acl_grpc_types_proto_enumTypes[2] +} + +func (x Operation) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use Operation.Descriptor instead. func (Operation) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_8233b6696fb3e24f, []int{2} + return file_v2_acl_grpc_types_proto_rawDescGZIP(), []int{2} } // Rule execution result action. Either allows or denies access if the rule's @@ -158,24 +224,45 @@ const ( Action_DENY Action = 2 ) -var Action_name = map[int32]string{ - 0: "ACTION_UNSPECIFIED", - 1: "ALLOW", - 2: "DENY", -} +// Enum value maps for Action. +var ( + Action_name = map[int32]string{ + 0: "ACTION_UNSPECIFIED", + 1: "ALLOW", + 2: "DENY", + } + Action_value = map[string]int32{ + "ACTION_UNSPECIFIED": 0, + "ALLOW": 1, + "DENY": 2, + } +) -var Action_value = map[string]int32{ - "ACTION_UNSPECIFIED": 0, - "ALLOW": 1, - "DENY": 2, +func (x Action) Enum() *Action { + p := new(Action) + *p = x + return p } func (x Action) String() string { - return proto.EnumName(Action_name, int32(x)) + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) } +func (Action) Descriptor() protoreflect.EnumDescriptor { + return file_v2_acl_grpc_types_proto_enumTypes[3].Descriptor() +} + +func (Action) Type() protoreflect.EnumType { + return &file_v2_acl_grpc_types_proto_enumTypes[3] +} + +func (x Action) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use Action.Descriptor instead. func (Action) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_8233b6696fb3e24f, []int{3} + return file_v2_acl_grpc_types_proto_rawDescGZIP(), []int{3} } // Enumeration of possible sources of Headers to apply filters. @@ -190,28 +277,53 @@ const ( HeaderType_OBJECT HeaderType = 2 ) -var HeaderType_name = map[int32]string{ - 0: "HEADER_UNSPECIFIED", - 1: "REQUEST", - 2: "OBJECT", -} +// Enum value maps for HeaderType. +var ( + HeaderType_name = map[int32]string{ + 0: "HEADER_UNSPECIFIED", + 1: "REQUEST", + 2: "OBJECT", + } + HeaderType_value = map[string]int32{ + "HEADER_UNSPECIFIED": 0, + "REQUEST": 1, + "OBJECT": 2, + } +) -var HeaderType_value = map[string]int32{ - "HEADER_UNSPECIFIED": 0, - "REQUEST": 1, - "OBJECT": 2, +func (x HeaderType) Enum() *HeaderType { + p := new(HeaderType) + *p = x + return p } func (x HeaderType) String() string { - return proto.EnumName(HeaderType_name, int32(x)) + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) } +func (HeaderType) Descriptor() protoreflect.EnumDescriptor { + return file_v2_acl_grpc_types_proto_enumTypes[4].Descriptor() +} + +func (HeaderType) Type() protoreflect.EnumType { + return &file_v2_acl_grpc_types_proto_enumTypes[4] +} + +func (x HeaderType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use HeaderType.Descriptor instead. func (HeaderType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_8233b6696fb3e24f, []int{4} + return file_v2_acl_grpc_types_proto_rawDescGZIP(), []int{4} } // Describes a single eACL rule. type EACLRecord struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // NeoFS request Verb to match Operation Operation `protobuf:"varint,1,opt,name=operation,proto3,enum=neo.fs.v2.acl.Operation" json:"operation,omitempty"` // Rule execution result. Either allows or denies access if filters match. @@ -219,204 +331,65 @@ type EACLRecord struct { // List of filters to match and see if rule is applicable Filters []*EACLRecord_Filter `protobuf:"bytes,3,rep,name=filters,proto3" json:"filters,omitempty"` // List of target subjects to apply ACL rule to - Targets []*EACLRecord_Target `protobuf:"bytes,4,rep,name=targets,proto3" json:"targets,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Targets []*EACLRecord_Target `protobuf:"bytes,4,rep,name=targets,proto3" json:"targets,omitempty"` } -func (m *EACLRecord) Reset() { *m = EACLRecord{} } -func (m *EACLRecord) String() string { return proto.CompactTextString(m) } -func (*EACLRecord) ProtoMessage() {} -func (*EACLRecord) Descriptor() ([]byte, []int) { - return fileDescriptor_8233b6696fb3e24f, []int{0} -} -func (m *EACLRecord) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *EACLRecord) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_EACLRecord.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil +func (x *EACLRecord) Reset() { + *x = EACLRecord{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_acl_grpc_types_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } } -func (m *EACLRecord) XXX_Merge(src proto.Message) { - xxx_messageInfo_EACLRecord.Merge(m, src) -} -func (m *EACLRecord) XXX_Size() int { - return m.Size() -} -func (m *EACLRecord) XXX_DiscardUnknown() { - xxx_messageInfo_EACLRecord.DiscardUnknown(m) + +func (x *EACLRecord) String() string { + return protoimpl.X.MessageStringOf(x) } -var xxx_messageInfo_EACLRecord proto.InternalMessageInfo +func (*EACLRecord) ProtoMessage() {} -func (m *EACLRecord) GetOperation() Operation { - if m != nil { - return m.Operation +func (x *EACLRecord) ProtoReflect() protoreflect.Message { + mi := &file_v2_acl_grpc_types_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use EACLRecord.ProtoReflect.Descriptor instead. +func (*EACLRecord) Descriptor() ([]byte, []int) { + return file_v2_acl_grpc_types_proto_rawDescGZIP(), []int{0} +} + +func (x *EACLRecord) GetOperation() Operation { + if x != nil { + return x.Operation } return Operation_OPERATION_UNSPECIFIED } -func (m *EACLRecord) GetAction() Action { - if m != nil { - return m.Action +func (x *EACLRecord) GetAction() Action { + if x != nil { + return x.Action } return Action_ACTION_UNSPECIFIED } -func (m *EACLRecord) GetFilters() []*EACLRecord_Filter { - if m != nil { - return m.Filters +func (x *EACLRecord) GetFilters() []*EACLRecord_Filter { + if x != nil { + return x.Filters } return nil } -func (m *EACLRecord) GetTargets() []*EACLRecord_Target { - if m != nil { - return m.Targets - } - return nil -} - -// Filter to check particular properties of the request or object. -type EACLRecord_Filter struct { - // Define if Object or Request header will be used - HeaderType HeaderType `protobuf:"varint,1,opt,name=header_type,json=headerType,proto3,enum=neo.fs.v2.acl.HeaderType" json:"header_type,omitempty"` - // Match operation type - MatchType MatchType `protobuf:"varint,2,opt,name=match_type,json=matchType,proto3,enum=neo.fs.v2.acl.MatchType" json:"match_type,omitempty"` - // Name of the Header to use - HeaderName string `protobuf:"bytes,3,opt,name=header_name,json=headerName,proto3" json:"header_name,omitempty"` - // Expected Header Value or pattern to match - HeaderVal string `protobuf:"bytes,4,opt,name=header_val,json=value,proto3" json:"header_val,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *EACLRecord_Filter) Reset() { *m = EACLRecord_Filter{} } -func (m *EACLRecord_Filter) String() string { return proto.CompactTextString(m) } -func (*EACLRecord_Filter) ProtoMessage() {} -func (*EACLRecord_Filter) Descriptor() ([]byte, []int) { - return fileDescriptor_8233b6696fb3e24f, []int{0, 0} -} -func (m *EACLRecord_Filter) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *EACLRecord_Filter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_EACLRecord_Filter.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *EACLRecord_Filter) XXX_Merge(src proto.Message) { - xxx_messageInfo_EACLRecord_Filter.Merge(m, src) -} -func (m *EACLRecord_Filter) XXX_Size() int { - return m.Size() -} -func (m *EACLRecord_Filter) XXX_DiscardUnknown() { - xxx_messageInfo_EACLRecord_Filter.DiscardUnknown(m) -} - -var xxx_messageInfo_EACLRecord_Filter proto.InternalMessageInfo - -func (m *EACLRecord_Filter) GetHeaderType() HeaderType { - if m != nil { - return m.HeaderType - } - return HeaderType_HEADER_UNSPECIFIED -} - -func (m *EACLRecord_Filter) GetMatchType() MatchType { - if m != nil { - return m.MatchType - } - return MatchType_MATCH_TYPE_UNSPECIFIED -} - -func (m *EACLRecord_Filter) GetHeaderName() string { - if m != nil { - return m.HeaderName - } - return "" -} - -func (m *EACLRecord_Filter) GetHeaderVal() string { - if m != nil { - return m.HeaderVal - } - return "" -} - -// Target to apply ACL rule. Can be a subject's role class or a list of public -// keys to match. -type EACLRecord_Target struct { - // Target subject's role class - Role Role `protobuf:"varint,1,opt,name=role,proto3,enum=neo.fs.v2.acl.Role" json:"role,omitempty"` - // List of public keys to identify target subject - Keys [][]byte `protobuf:"bytes,2,rep,name=keys,proto3" json:"keys,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *EACLRecord_Target) Reset() { *m = EACLRecord_Target{} } -func (m *EACLRecord_Target) String() string { return proto.CompactTextString(m) } -func (*EACLRecord_Target) ProtoMessage() {} -func (*EACLRecord_Target) Descriptor() ([]byte, []int) { - return fileDescriptor_8233b6696fb3e24f, []int{0, 1} -} -func (m *EACLRecord_Target) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *EACLRecord_Target) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_EACLRecord_Target.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *EACLRecord_Target) XXX_Merge(src proto.Message) { - xxx_messageInfo_EACLRecord_Target.Merge(m, src) -} -func (m *EACLRecord_Target) XXX_Size() int { - return m.Size() -} -func (m *EACLRecord_Target) XXX_DiscardUnknown() { - xxx_messageInfo_EACLRecord_Target.DiscardUnknown(m) -} - -var xxx_messageInfo_EACLRecord_Target proto.InternalMessageInfo - -func (m *EACLRecord_Target) GetRole() Role { - if m != nil { - return m.Role - } - return Role_ROLE_UNSPECIFIED -} - -func (m *EACLRecord_Target) GetKeys() [][]byte { - if m != nil { - return m.Keys +func (x *EACLRecord) GetTargets() []*EACLRecord_Target { + if x != nil { + return x.Targets } return nil } @@ -426,68 +399,68 @@ func (m *EACLRecord_Target) GetKeys() [][]byte { // or may be defined in `BearerToken` structure. Please see the corresponding // NeoFS Technical Specification's section for detailed description. type EACLTable struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // eACL format version. Effectively the version of API library used to create // eACL Table. Version *grpc.Version `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` // Identifier of the container that should use given access control rules ContainerId *grpc.ContainerID `protobuf:"bytes,2,opt,name=container_id,json=containerID,proto3" json:"container_id,omitempty"` // List of Extended ACL rules - Records []*EACLRecord `protobuf:"bytes,3,rep,name=records,proto3" json:"records,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Records []*EACLRecord `protobuf:"bytes,3,rep,name=records,proto3" json:"records,omitempty"` } -func (m *EACLTable) Reset() { *m = EACLTable{} } -func (m *EACLTable) String() string { return proto.CompactTextString(m) } -func (*EACLTable) ProtoMessage() {} -func (*EACLTable) Descriptor() ([]byte, []int) { - return fileDescriptor_8233b6696fb3e24f, []int{1} +func (x *EACLTable) Reset() { + *x = EACLTable{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_acl_grpc_types_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *EACLTable) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) + +func (x *EACLTable) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *EACLTable) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_EACLTable.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err + +func (*EACLTable) ProtoMessage() {} + +func (x *EACLTable) ProtoReflect() protoreflect.Message { + mi := &file_v2_acl_grpc_types_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) } - return b[:n], nil + return ms } -} -func (m *EACLTable) XXX_Merge(src proto.Message) { - xxx_messageInfo_EACLTable.Merge(m, src) -} -func (m *EACLTable) XXX_Size() int { - return m.Size() -} -func (m *EACLTable) XXX_DiscardUnknown() { - xxx_messageInfo_EACLTable.DiscardUnknown(m) + return mi.MessageOf(x) } -var xxx_messageInfo_EACLTable proto.InternalMessageInfo +// Deprecated: Use EACLTable.ProtoReflect.Descriptor instead. +func (*EACLTable) Descriptor() ([]byte, []int) { + return file_v2_acl_grpc_types_proto_rawDescGZIP(), []int{1} +} -func (m *EACLTable) GetVersion() *grpc.Version { - if m != nil { - return m.Version +func (x *EACLTable) GetVersion() *grpc.Version { + if x != nil { + return x.Version } return nil } -func (m *EACLTable) GetContainerId() *grpc.ContainerID { - if m != nil { - return m.ContainerId +func (x *EACLTable) GetContainerId() *grpc.ContainerID { + if x != nil { + return x.ContainerId } return nil } -func (m *EACLTable) GetRecords() []*EACLRecord { - if m != nil { - return m.Records +func (x *EACLTable) GetRecords() []*EACLRecord { + if x != nil { + return x.Records } return nil } @@ -499,58 +472,193 @@ func (m *EACLTable) GetRecords() []*EACLRecord { // used in the similar use cases, like providing authorisation to externally // authenticated party. type BearerToken struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // Bearer Token body Body *BearerToken_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` // Signature of BearerToken body - Signature *grpc.Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Signature *grpc.Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` } -func (m *BearerToken) Reset() { *m = BearerToken{} } -func (m *BearerToken) String() string { return proto.CompactTextString(m) } -func (*BearerToken) ProtoMessage() {} -func (*BearerToken) Descriptor() ([]byte, []int) { - return fileDescriptor_8233b6696fb3e24f, []int{2} -} -func (m *BearerToken) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *BearerToken) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_BearerToken.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil +func (x *BearerToken) Reset() { + *x = BearerToken{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_acl_grpc_types_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } } -func (m *BearerToken) XXX_Merge(src proto.Message) { - xxx_messageInfo_BearerToken.Merge(m, src) -} -func (m *BearerToken) XXX_Size() int { - return m.Size() -} -func (m *BearerToken) XXX_DiscardUnknown() { - xxx_messageInfo_BearerToken.DiscardUnknown(m) + +func (x *BearerToken) String() string { + return protoimpl.X.MessageStringOf(x) } -var xxx_messageInfo_BearerToken proto.InternalMessageInfo +func (*BearerToken) ProtoMessage() {} -func (m *BearerToken) GetBody() *BearerToken_Body { - if m != nil { - return m.Body +func (x *BearerToken) ProtoReflect() protoreflect.Message { + mi := &file_v2_acl_grpc_types_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use BearerToken.ProtoReflect.Descriptor instead. +func (*BearerToken) Descriptor() ([]byte, []int) { + return file_v2_acl_grpc_types_proto_rawDescGZIP(), []int{2} +} + +func (x *BearerToken) GetBody() *BearerToken_Body { + if x != nil { + return x.Body } return nil } -func (m *BearerToken) GetSignature() *grpc.Signature { - if m != nil { - return m.Signature +func (x *BearerToken) GetSignature() *grpc.Signature { + if x != nil { + return x.Signature + } + return nil +} + +// Filter to check particular properties of the request or object. +type EACLRecord_Filter struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Define if Object or Request header will be used + HeaderType HeaderType `protobuf:"varint,1,opt,name=header_type,json=headerType,proto3,enum=neo.fs.v2.acl.HeaderType" json:"header_type,omitempty"` + // Match operation type + MatchType MatchType `protobuf:"varint,2,opt,name=match_type,json=matchType,proto3,enum=neo.fs.v2.acl.MatchType" json:"match_type,omitempty"` + // Name of the Header to use + HeaderName string `protobuf:"bytes,3,opt,name=header_name,json=headerName,proto3" json:"header_name,omitempty"` + // Expected Header Value or pattern to match + HeaderVal string `protobuf:"bytes,4,opt,name=header_val,json=value,proto3" json:"header_val,omitempty"` +} + +func (x *EACLRecord_Filter) Reset() { + *x = EACLRecord_Filter{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_acl_grpc_types_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *EACLRecord_Filter) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*EACLRecord_Filter) ProtoMessage() {} + +func (x *EACLRecord_Filter) ProtoReflect() protoreflect.Message { + mi := &file_v2_acl_grpc_types_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use EACLRecord_Filter.ProtoReflect.Descriptor instead. +func (*EACLRecord_Filter) Descriptor() ([]byte, []int) { + return file_v2_acl_grpc_types_proto_rawDescGZIP(), []int{0, 0} +} + +func (x *EACLRecord_Filter) GetHeaderType() HeaderType { + if x != nil { + return x.HeaderType + } + return HeaderType_HEADER_UNSPECIFIED +} + +func (x *EACLRecord_Filter) GetMatchType() MatchType { + if x != nil { + return x.MatchType + } + return MatchType_MATCH_TYPE_UNSPECIFIED +} + +func (x *EACLRecord_Filter) GetHeaderName() string { + if x != nil { + return x.HeaderName + } + return "" +} + +func (x *EACLRecord_Filter) GetHeaderVal() string { + if x != nil { + return x.HeaderVal + } + return "" +} + +// Target to apply ACL rule. Can be a subject's role class or a list of public +// keys to match. +type EACLRecord_Target struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Target subject's role class + Role Role `protobuf:"varint,1,opt,name=role,proto3,enum=neo.fs.v2.acl.Role" json:"role,omitempty"` + // List of public keys to identify target subject + Keys [][]byte `protobuf:"bytes,2,rep,name=keys,proto3" json:"keys,omitempty"` +} + +func (x *EACLRecord_Target) Reset() { + *x = EACLRecord_Target{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_acl_grpc_types_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *EACLRecord_Target) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*EACLRecord_Target) ProtoMessage() {} + +func (x *EACLRecord_Target) ProtoReflect() protoreflect.Message { + mi := &file_v2_acl_grpc_types_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use EACLRecord_Target.ProtoReflect.Descriptor instead. +func (*EACLRecord_Target) Descriptor() ([]byte, []int) { + return file_v2_acl_grpc_types_proto_rawDescGZIP(), []int{0, 1} +} + +func (x *EACLRecord_Target) GetRole() Role { + if x != nil { + return x.Role + } + return Role_ROLE_UNSPECIFIED +} + +func (x *EACLRecord_Target) GetKeys() [][]byte { + if x != nil { + return x.Keys } return nil } @@ -558,6 +666,10 @@ func (m *BearerToken) GetSignature() *grpc.Signature { // Bearer Token body structure contains Extended ACL table issued by container // owner with additional information preventing token's abuse. type BearerToken_Body struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // Table of Extended ACL rules to use instead of the ones attached to the // container EaclTable *EACLTable `protobuf:"bytes,1,opt,name=eacl_table,json=eaclTable,proto3" json:"eacl_table,omitempty"` @@ -565,62 +677,58 @@ type BearerToken_Body struct { // originator's `OwnerID` OwnerId *grpc.OwnerID `protobuf:"bytes,2,opt,name=owner_id,json=ownerID,proto3" json:"owner_id,omitempty"` // Token expiration and valid time period parameters - Lifetime *BearerToken_Body_TokenLifetime `protobuf:"bytes,3,opt,name=lifetime,proto3" json:"lifetime,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Lifetime *BearerToken_Body_TokenLifetime `protobuf:"bytes,3,opt,name=lifetime,proto3" json:"lifetime,omitempty"` } -func (m *BearerToken_Body) Reset() { *m = BearerToken_Body{} } -func (m *BearerToken_Body) String() string { return proto.CompactTextString(m) } -func (*BearerToken_Body) ProtoMessage() {} -func (*BearerToken_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_8233b6696fb3e24f, []int{2, 0} +func (x *BearerToken_Body) Reset() { + *x = BearerToken_Body{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_acl_grpc_types_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *BearerToken_Body) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) + +func (x *BearerToken_Body) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *BearerToken_Body) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_BearerToken_Body.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err + +func (*BearerToken_Body) ProtoMessage() {} + +func (x *BearerToken_Body) ProtoReflect() protoreflect.Message { + mi := &file_v2_acl_grpc_types_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) } - return b[:n], nil + return ms } -} -func (m *BearerToken_Body) XXX_Merge(src proto.Message) { - xxx_messageInfo_BearerToken_Body.Merge(m, src) -} -func (m *BearerToken_Body) XXX_Size() int { - return m.Size() -} -func (m *BearerToken_Body) XXX_DiscardUnknown() { - xxx_messageInfo_BearerToken_Body.DiscardUnknown(m) + return mi.MessageOf(x) } -var xxx_messageInfo_BearerToken_Body proto.InternalMessageInfo +// Deprecated: Use BearerToken_Body.ProtoReflect.Descriptor instead. +func (*BearerToken_Body) Descriptor() ([]byte, []int) { + return file_v2_acl_grpc_types_proto_rawDescGZIP(), []int{2, 0} +} -func (m *BearerToken_Body) GetEaclTable() *EACLTable { - if m != nil { - return m.EaclTable +func (x *BearerToken_Body) GetEaclTable() *EACLTable { + if x != nil { + return x.EaclTable } return nil } -func (m *BearerToken_Body) GetOwnerId() *grpc.OwnerID { - if m != nil { - return m.OwnerId +func (x *BearerToken_Body) GetOwnerId() *grpc.OwnerID { + if x != nil { + return x.OwnerId } return nil } -func (m *BearerToken_Body) GetLifetime() *BearerToken_Body_TokenLifetime { - if m != nil { - return m.Lifetime +func (x *BearerToken_Body) GetLifetime() *BearerToken_Body_TokenLifetime { + if x != nil { + return x.Lifetime } return nil } @@ -628,1771 +736,340 @@ func (m *BearerToken_Body) GetLifetime() *BearerToken_Body_TokenLifetime { // Lifetime parameters of the token. Filed names taken from // [rfc7519](https://tools.ietf.org/html/rfc7519). type BearerToken_Body_TokenLifetime struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // Expiration Epoch Exp uint64 `protobuf:"varint,1,opt,name=exp,proto3" json:"exp,omitempty"` // Not valid before Epoch Nbf uint64 `protobuf:"varint,2,opt,name=nbf,proto3" json:"nbf,omitempty"` // Issued at Epoch - Iat uint64 `protobuf:"varint,3,opt,name=iat,proto3" json:"iat,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Iat uint64 `protobuf:"varint,3,opt,name=iat,proto3" json:"iat,omitempty"` } -func (m *BearerToken_Body_TokenLifetime) Reset() { *m = BearerToken_Body_TokenLifetime{} } -func (m *BearerToken_Body_TokenLifetime) String() string { return proto.CompactTextString(m) } -func (*BearerToken_Body_TokenLifetime) ProtoMessage() {} +func (x *BearerToken_Body_TokenLifetime) Reset() { + *x = BearerToken_Body_TokenLifetime{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_acl_grpc_types_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *BearerToken_Body_TokenLifetime) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BearerToken_Body_TokenLifetime) ProtoMessage() {} + +func (x *BearerToken_Body_TokenLifetime) ProtoReflect() protoreflect.Message { + mi := &file_v2_acl_grpc_types_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use BearerToken_Body_TokenLifetime.ProtoReflect.Descriptor instead. func (*BearerToken_Body_TokenLifetime) Descriptor() ([]byte, []int) { - return fileDescriptor_8233b6696fb3e24f, []int{2, 0, 0} -} -func (m *BearerToken_Body_TokenLifetime) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *BearerToken_Body_TokenLifetime) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_BearerToken_Body_TokenLifetime.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *BearerToken_Body_TokenLifetime) XXX_Merge(src proto.Message) { - xxx_messageInfo_BearerToken_Body_TokenLifetime.Merge(m, src) -} -func (m *BearerToken_Body_TokenLifetime) XXX_Size() int { - return m.Size() -} -func (m *BearerToken_Body_TokenLifetime) XXX_DiscardUnknown() { - xxx_messageInfo_BearerToken_Body_TokenLifetime.DiscardUnknown(m) + return file_v2_acl_grpc_types_proto_rawDescGZIP(), []int{2, 0, 0} } -var xxx_messageInfo_BearerToken_Body_TokenLifetime proto.InternalMessageInfo - -func (m *BearerToken_Body_TokenLifetime) GetExp() uint64 { - if m != nil { - return m.Exp +func (x *BearerToken_Body_TokenLifetime) GetExp() uint64 { + if x != nil { + return x.Exp } return 0 } -func (m *BearerToken_Body_TokenLifetime) GetNbf() uint64 { - if m != nil { - return m.Nbf +func (x *BearerToken_Body_TokenLifetime) GetNbf() uint64 { + if x != nil { + return x.Nbf } return 0 } -func (m *BearerToken_Body_TokenLifetime) GetIat() uint64 { - if m != nil { - return m.Iat +func (x *BearerToken_Body_TokenLifetime) GetIat() uint64 { + if x != nil { + return x.Iat } return 0 } -func init() { - proto.RegisterEnum("neo.fs.v2.acl.Role", Role_name, Role_value) - proto.RegisterEnum("neo.fs.v2.acl.MatchType", MatchType_name, MatchType_value) - proto.RegisterEnum("neo.fs.v2.acl.Operation", Operation_name, Operation_value) - proto.RegisterEnum("neo.fs.v2.acl.Action", Action_name, Action_value) - proto.RegisterEnum("neo.fs.v2.acl.HeaderType", HeaderType_name, HeaderType_value) - proto.RegisterType((*EACLRecord)(nil), "neo.fs.v2.acl.EACLRecord") - proto.RegisterType((*EACLRecord_Filter)(nil), "neo.fs.v2.acl.EACLRecord.Filter") - proto.RegisterType((*EACLRecord_Target)(nil), "neo.fs.v2.acl.EACLRecord.Target") - proto.RegisterType((*EACLTable)(nil), "neo.fs.v2.acl.EACLTable") - proto.RegisterType((*BearerToken)(nil), "neo.fs.v2.acl.BearerToken") - proto.RegisterType((*BearerToken_Body)(nil), "neo.fs.v2.acl.BearerToken.Body") - proto.RegisterType((*BearerToken_Body_TokenLifetime)(nil), "neo.fs.v2.acl.BearerToken.Body.TokenLifetime") -} +var File_v2_acl_grpc_types_proto protoreflect.FileDescriptor -func init() { proto.RegisterFile("v2/acl/grpc/types.proto", fileDescriptor_8233b6696fb3e24f) } - -var fileDescriptor_8233b6696fb3e24f = []byte{ - // 865 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x55, 0xdd, 0x8e, 0xda, 0x46, - 0x14, 0x8e, 0x7f, 0x16, 0x96, 0xc3, 0xa6, 0xb2, 0xa6, 0x4d, 0x02, 0x54, 0xda, 0xa0, 0xbd, 0xe9, - 0x0a, 0x09, 0xa3, 0xb0, 0x6a, 0x23, 0xa5, 0x6a, 0x24, 0x03, 0xb3, 0x0b, 0x15, 0x8b, 0xc9, 0xd8, - 0xa4, 0xda, 0xde, 0xa0, 0xc1, 0x0c, 0xac, 0x15, 0x63, 0x23, 0xdb, 0x4b, 0x4a, 0x6f, 0xab, 0xbe, - 0x43, 0x9f, 0xa1, 0xb7, 0xbd, 0xea, 0x1b, 0xf4, 0xb2, 0x8f, 0x50, 0x6d, 0xef, 0xfb, 0x0c, 0xd5, - 0x8c, 0x6d, 0xd8, 0x75, 0x36, 0xca, 0xdd, 0x99, 0x39, 0xdf, 0x77, 0xce, 0x77, 0xbe, 0x19, 0x8f, - 0xe1, 0xd9, 0xa6, 0xdd, 0xa2, 0x8e, 0xd7, 0x5a, 0x86, 0x6b, 0xa7, 0x15, 0x6f, 0xd7, 0x2c, 0xd2, - 0xd7, 0x61, 0x10, 0x07, 0xe8, 0xb1, 0xcf, 0x02, 0x7d, 0x11, 0xe9, 0x9b, 0xb6, 0x4e, 0x1d, 0xaf, - 0x56, 0xd9, 0xb4, 0x5b, 0x21, 0x5b, 0x44, 0x1f, 0x00, 0x4f, 0xfe, 0x53, 0x00, 0xb0, 0xd1, 0x1d, - 0x12, 0xe6, 0x04, 0xe1, 0x1c, 0x7d, 0x03, 0xa5, 0x60, 0xcd, 0x42, 0x1a, 0xbb, 0x81, 0x5f, 0x91, - 0xea, 0xd2, 0xe9, 0x67, 0xed, 0x8a, 0x7e, 0xaf, 0x96, 0x6e, 0x66, 0x79, 0xb2, 0x87, 0xa2, 0x26, - 0x14, 0xa8, 0x23, 0x48, 0xb2, 0x20, 0x3d, 0xc9, 0x91, 0x0c, 0x91, 0x24, 0x29, 0x08, 0xbd, 0x82, - 0xe2, 0xc2, 0xf5, 0x62, 0x16, 0x46, 0x15, 0xa5, 0xae, 0x9c, 0x96, 0xdb, 0xf5, 0x1c, 0x7e, 0x2f, - 0x49, 0x3f, 0x17, 0x40, 0x92, 0x11, 0x38, 0x37, 0xa6, 0xe1, 0x92, 0xc5, 0x51, 0x45, 0xfd, 0x14, - 0xd7, 0x16, 0x40, 0x92, 0x11, 0x6a, 0x7f, 0x4a, 0x50, 0x48, 0xea, 0xa1, 0x57, 0x50, 0xbe, 0x66, - 0x74, 0xce, 0xc2, 0x29, 0xb7, 0x23, 0x9d, 0xb5, 0x9a, 0x2b, 0xd5, 0x17, 0x08, 0x7b, 0xbb, 0x66, - 0x04, 0xae, 0x77, 0x31, 0x7a, 0x09, 0xb0, 0xa2, 0xb1, 0x73, 0x9d, 0x50, 0xe5, 0x07, 0x6d, 0xba, - 0xe4, 0x00, 0xc1, 0x2c, 0xad, 0xb2, 0x10, 0x3d, 0xdf, 0x35, 0xf5, 0xe9, 0x8a, 0x55, 0x94, 0xba, - 0x74, 0x5a, 0xca, 0x2a, 0x8f, 0xe8, 0x8a, 0xa1, 0x2a, 0xa4, 0xab, 0xe9, 0x86, 0x7a, 0x15, 0x55, - 0xe4, 0x0f, 0x36, 0xd4, 0xbb, 0x61, 0x35, 0x0c, 0x85, 0x64, 0x1c, 0xf4, 0x15, 0xa8, 0x61, 0xe0, - 0x65, 0x9a, 0x3f, 0xcf, 0x35, 0x26, 0x81, 0xc7, 0x88, 0x00, 0x20, 0x04, 0xea, 0x3b, 0xb6, 0x8d, - 0x2a, 0x72, 0x5d, 0x39, 0x3d, 0x22, 0x22, 0x3e, 0xf9, 0x43, 0x82, 0x12, 0x77, 0xc8, 0xa6, 0x33, - 0x8f, 0xa1, 0x17, 0x50, 0xdc, 0xb0, 0x30, 0xca, 0x4e, 0xbb, 0xdc, 0x7e, 0x76, 0xa7, 0x1a, 0xbf, - 0x31, 0xfa, 0xdb, 0x24, 0x4d, 0x32, 0x1c, 0x7a, 0x0d, 0x47, 0x4e, 0xe0, 0xc7, 0xd4, 0xf5, 0x59, - 0x38, 0x75, 0xe7, 0x62, 0xfc, 0x72, 0xfb, 0xcb, 0x3c, 0xaf, 0x9b, 0x61, 0x06, 0x3d, 0x52, 0x76, - 0xf6, 0x0b, 0x74, 0x06, 0xc5, 0x50, 0x9c, 0x4e, 0x76, 0xf6, 0xd5, 0x8f, 0x9e, 0x1f, 0xc9, 0x90, - 0x27, 0xbf, 0x28, 0x50, 0xee, 0x30, 0x1a, 0xb2, 0xd0, 0x0e, 0xde, 0x31, 0x1f, 0x9d, 0x81, 0x3a, - 0x0b, 0xe6, 0xdb, 0x54, 0xf4, 0xf3, 0x5c, 0x85, 0x3b, 0x48, 0xbd, 0x13, 0xcc, 0xb7, 0x44, 0x80, - 0xd1, 0x4b, 0x28, 0x45, 0xee, 0xd2, 0xa7, 0xf1, 0x4d, 0xc8, 0x52, 0xd9, 0xd5, 0xbc, 0x6c, 0x2b, - 0x03, 0x90, 0x3d, 0xb6, 0xf6, 0xab, 0x0c, 0x6a, 0x27, 0xa9, 0x00, 0x8c, 0x3a, 0xde, 0x34, 0xe6, - 0xe6, 0xa5, 0xcd, 0x2b, 0x0f, 0xc8, 0x17, 0xe6, 0x92, 0x12, 0xc7, 0x26, 0x3e, 0xb7, 0xe1, 0x30, - 0x78, 0x7f, 0xcf, 0xb0, 0x0f, 0x8c, 0x36, 0xdf, 0x27, 0x66, 0x15, 0x83, 0x24, 0x40, 0x03, 0x38, - 0xf4, 0xdc, 0x05, 0x8b, 0xdd, 0xf4, 0xa6, 0x94, 0xdb, 0xcd, 0x4f, 0xcc, 0xa9, 0x8b, 0x70, 0x98, - 0x92, 0xc8, 0x8e, 0x5e, 0xc3, 0xf0, 0xf8, 0x5e, 0x0a, 0x69, 0xa0, 0xb0, 0x9f, 0xd6, 0x62, 0x02, - 0x95, 0xf0, 0x90, 0xef, 0xf8, 0xb3, 0x85, 0x10, 0xa7, 0x12, 0x1e, 0xf2, 0x1d, 0x97, 0xc6, 0xa2, - 0xb5, 0x4a, 0x78, 0xd8, 0x78, 0x0d, 0x2a, 0xbf, 0x5d, 0xe8, 0x0b, 0xd0, 0x88, 0x39, 0xc4, 0xd3, - 0xc9, 0xc8, 0x1a, 0xe3, 0xee, 0xe0, 0x7c, 0x80, 0x7b, 0xda, 0x23, 0x74, 0x08, 0xea, 0xc4, 0xc2, - 0x44, 0x93, 0x10, 0x40, 0xc1, 0xba, 0xb2, 0x6c, 0x7c, 0xa9, 0xc9, 0x3c, 0x36, 0xed, 0x3e, 0x26, - 0x96, 0xa6, 0x34, 0x4c, 0x28, 0xed, 0x3e, 0x0b, 0x54, 0x83, 0xa7, 0x97, 0x86, 0xdd, 0xed, 0x4f, - 0xed, 0xab, 0x71, 0xbe, 0x94, 0x06, 0x47, 0x96, 0x4d, 0x06, 0xa3, 0x8b, 0x29, 0x7e, 0x33, 0x31, - 0x86, 0x9a, 0xc4, 0x5b, 0xa6, 0x3b, 0x23, 0xd3, 0x4e, 0x77, 0xe5, 0xc6, 0xcf, 0x50, 0xda, 0x3d, - 0x47, 0xa8, 0x0a, 0x4f, 0xcc, 0x31, 0x26, 0x86, 0x3d, 0x30, 0x47, 0xb9, 0x7a, 0x45, 0x50, 0x2e, - 0xb0, 0xad, 0x49, 0x5c, 0x63, 0x1f, 0x1b, 0x3d, 0x4d, 0xe6, 0x5b, 0xe3, 0x89, 0xad, 0x29, 0x5c, - 0x60, 0x0f, 0x0f, 0xb1, 0x8d, 0x35, 0x55, 0x08, 0xc7, 0x06, 0xe9, 0xf6, 0xb5, 0x03, 0x74, 0x04, - 0x87, 0x17, 0xd8, 0x26, 0xc6, 0xe8, 0x02, 0x6b, 0x05, 0xae, 0x28, 0x5b, 0xf5, 0x0d, 0xab, 0xaf, - 0x15, 0x1b, 0x5f, 0x43, 0x21, 0x79, 0xd5, 0xd0, 0x53, 0x40, 0x46, 0xf7, 0x81, 0xae, 0x25, 0x38, - 0x30, 0x86, 0x43, 0xf3, 0x87, 0xa4, 0x6f, 0x0f, 0x8f, 0xae, 0x34, 0xb9, 0xf1, 0x1d, 0xc0, 0xfe, - 0x55, 0xe1, 0x54, 0xae, 0x07, 0x93, 0x1c, 0xb5, 0x0c, 0x45, 0x82, 0xdf, 0x4c, 0xb0, 0x65, 0x27, - 0x76, 0x9a, 0x9d, 0xef, 0x71, 0xd7, 0xd6, 0xe4, 0xce, 0xdb, 0xbf, 0x6e, 0x8f, 0xa5, 0xbf, 0x6f, - 0x8f, 0xa5, 0x7f, 0x6e, 0x8f, 0xa5, 0xdf, 0xfe, 0x3d, 0x7e, 0xf4, 0xe3, 0x8b, 0xa5, 0x1b, 0x5f, - 0xdf, 0xcc, 0x74, 0x27, 0x58, 0xb5, 0xfc, 0x68, 0xed, 0x38, 0xcd, 0x39, 0xdb, 0xb4, 0x7c, 0x16, - 0x2c, 0xa2, 0x26, 0x5d, 0xbb, 0xcd, 0x65, 0xd0, 0xba, 0xf3, 0x97, 0xf8, 0x96, 0x3a, 0xde, 0xef, - 0xb2, 0x36, 0x62, 0xc1, 0xb9, 0xa5, 0x1b, 0xe3, 0x01, 0xbf, 0x4a, 0x86, 0xe3, 0xcd, 0x0a, 0xe2, - 0x77, 0x70, 0xf6, 0x7f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x54, 0x26, 0xa8, 0x52, 0x06, 0x00, - 0x00, -} - -func (m *EACLRecord) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *EACLRecord) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *EACLRecord) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.Targets) > 0 { - for iNdEx := len(m.Targets) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Targets[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } - } - if len(m.Filters) > 0 { - for iNdEx := len(m.Filters) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Filters[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - } - if m.Action != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.Action)) - i-- - dAtA[i] = 0x10 - } - if m.Operation != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.Operation)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *EACLRecord_Filter) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *EACLRecord_Filter) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *EACLRecord_Filter) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.HeaderVal) > 0 { - i -= len(m.HeaderVal) - copy(dAtA[i:], m.HeaderVal) - i = encodeVarintTypes(dAtA, i, uint64(len(m.HeaderVal))) - i-- - dAtA[i] = 0x22 - } - if len(m.HeaderName) > 0 { - i -= len(m.HeaderName) - copy(dAtA[i:], m.HeaderName) - i = encodeVarintTypes(dAtA, i, uint64(len(m.HeaderName))) - i-- - dAtA[i] = 0x1a - } - if m.MatchType != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.MatchType)) - i-- - dAtA[i] = 0x10 - } - if m.HeaderType != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.HeaderType)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *EACLRecord_Target) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *EACLRecord_Target) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *EACLRecord_Target) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.Keys) > 0 { - for iNdEx := len(m.Keys) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Keys[iNdEx]) - copy(dAtA[i:], m.Keys[iNdEx]) - i = encodeVarintTypes(dAtA, i, uint64(len(m.Keys[iNdEx]))) - i-- - dAtA[i] = 0x12 - } - } - if m.Role != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.Role)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *EACLTable) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *EACLTable) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *EACLTable) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.Records) > 0 { - for iNdEx := len(m.Records) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Records[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - } - if m.ContainerId != nil { - { - size, err := m.ContainerId.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.Version != nil { - { - size, err := m.Version.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *BearerToken) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *BearerToken) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *BearerToken) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.Signature != nil { - { - size, err := m.Signature.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.Body != nil { - { - size, err := m.Body.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *BearerToken_Body) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *BearerToken_Body) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *BearerToken_Body) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.Lifetime != nil { - { - size, err := m.Lifetime.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if m.OwnerId != nil { - { - size, err := m.OwnerId.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.EaclTable != nil { - { - size, err := m.EaclTable.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *BearerToken_Body_TokenLifetime) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *BearerToken_Body_TokenLifetime) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *BearerToken_Body_TokenLifetime) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.Iat != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.Iat)) - i-- - dAtA[i] = 0x18 - } - if m.Nbf != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.Nbf)) - i-- - dAtA[i] = 0x10 - } - if m.Exp != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.Exp)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func encodeVarintTypes(dAtA []byte, offset int, v uint64) int { - offset -= sovTypes(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *EACLRecord) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Operation != 0 { - n += 1 + sovTypes(uint64(m.Operation)) - } - if m.Action != 0 { - n += 1 + sovTypes(uint64(m.Action)) - } - if len(m.Filters) > 0 { - for _, e := range m.Filters { - l = e.Size() - n += 1 + l + sovTypes(uint64(l)) - } - } - if len(m.Targets) > 0 { - for _, e := range m.Targets { - l = e.Size() - n += 1 + l + sovTypes(uint64(l)) - } - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *EACLRecord_Filter) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.HeaderType != 0 { - n += 1 + sovTypes(uint64(m.HeaderType)) - } - if m.MatchType != 0 { - n += 1 + sovTypes(uint64(m.MatchType)) - } - l = len(m.HeaderName) - if l > 0 { - n += 1 + l + sovTypes(uint64(l)) - } - l = len(m.HeaderVal) - if l > 0 { - n += 1 + l + sovTypes(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *EACLRecord_Target) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Role != 0 { - n += 1 + sovTypes(uint64(m.Role)) - } - if len(m.Keys) > 0 { - for _, b := range m.Keys { - l = len(b) - n += 1 + l + sovTypes(uint64(l)) - } - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *EACLTable) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Version != nil { - l = m.Version.Size() - n += 1 + l + sovTypes(uint64(l)) - } - if m.ContainerId != nil { - l = m.ContainerId.Size() - n += 1 + l + sovTypes(uint64(l)) - } - if len(m.Records) > 0 { - for _, e := range m.Records { - l = e.Size() - n += 1 + l + sovTypes(uint64(l)) - } - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *BearerToken) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Body != nil { - l = m.Body.Size() - n += 1 + l + sovTypes(uint64(l)) - } - if m.Signature != nil { - l = m.Signature.Size() - n += 1 + l + sovTypes(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *BearerToken_Body) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.EaclTable != nil { - l = m.EaclTable.Size() - n += 1 + l + sovTypes(uint64(l)) - } - if m.OwnerId != nil { - l = m.OwnerId.Size() - n += 1 + l + sovTypes(uint64(l)) - } - if m.Lifetime != nil { - l = m.Lifetime.Size() - n += 1 + l + sovTypes(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *BearerToken_Body_TokenLifetime) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Exp != 0 { - n += 1 + sovTypes(uint64(m.Exp)) - } - if m.Nbf != 0 { - n += 1 + sovTypes(uint64(m.Nbf)) - } - if m.Iat != 0 { - n += 1 + sovTypes(uint64(m.Iat)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func sovTypes(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozTypes(x uint64) (n int) { - return sovTypes(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *EACLRecord) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: EACLRecord: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: EACLRecord: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Operation", wireType) - } - m.Operation = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Operation |= Operation(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Action", wireType) - } - m.Action = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Action |= Action(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Filters", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Filters = append(m.Filters, &EACLRecord_Filter{}) - if err := m.Filters[len(m.Filters)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Targets", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Targets = append(m.Targets, &EACLRecord_Target{}) - if err := m.Targets[len(m.Targets)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *EACLRecord_Filter) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Filter: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Filter: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field HeaderType", wireType) - } - m.HeaderType = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.HeaderType |= HeaderType(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MatchType", wireType) - } - m.MatchType = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MatchType |= MatchType(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field HeaderName", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.HeaderName = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field HeaderVal", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.HeaderVal = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *EACLRecord_Target) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Target: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Target: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Role", wireType) - } - m.Role = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Role |= Role(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Keys", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Keys = append(m.Keys, make([]byte, postIndex-iNdEx)) - copy(m.Keys[len(m.Keys)-1], dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *EACLTable) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: EACLTable: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: EACLTable: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Version == nil { - m.Version = &grpc.Version{} - } - if err := m.Version.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ContainerId", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.ContainerId == nil { - m.ContainerId = &grpc.ContainerID{} - } - if err := m.ContainerId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Records", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Records = append(m.Records, &EACLRecord{}) - if err := m.Records[len(m.Records)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *BearerToken) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: BearerToken: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: BearerToken: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Body", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Body == nil { - m.Body = &BearerToken_Body{} - } - if err := m.Body.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Signature", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Signature == nil { - m.Signature = &grpc.Signature{} - } - if err := m.Signature.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *BearerToken_Body) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Body: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Body: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field EaclTable", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.EaclTable == nil { - m.EaclTable = &EACLTable{} - } - if err := m.EaclTable.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OwnerId", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.OwnerId == nil { - m.OwnerId = &grpc.OwnerID{} - } - if err := m.OwnerId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Lifetime", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Lifetime == nil { - m.Lifetime = &BearerToken_Body_TokenLifetime{} - } - if err := m.Lifetime.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *BearerToken_Body_TokenLifetime) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: TokenLifetime: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: TokenLifetime: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Exp", wireType) - } - m.Exp = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Exp |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Nbf", wireType) - } - m.Nbf = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Nbf |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Iat", wireType) - } - m.Iat = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Iat |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipTypes(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTypes - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTypes - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTypes - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthTypes - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupTypes - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthTypes - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF +var file_v2_acl_grpc_types_proto_rawDesc = []byte{ + 0x0a, 0x17, 0x76, 0x32, 0x2f, 0x61, 0x63, 0x6c, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, + 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0d, 0x6e, 0x65, 0x6f, 0x2e, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x1a, 0x18, 0x76, 0x32, 0x2f, 0x72, 0x65, 0x66, + 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x22, 0xee, 0x03, 0x0a, 0x0a, 0x45, 0x41, 0x43, 0x4c, 0x52, 0x65, 0x63, 0x6f, 0x72, + 0x64, 0x12, 0x36, 0x0a, 0x09, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x09, + 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2d, 0x0a, 0x06, 0x61, 0x63, 0x74, + 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x15, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, + 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, + 0x52, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3a, 0x0a, 0x07, 0x66, 0x69, 0x6c, 0x74, + 0x65, 0x72, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, + 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x45, 0x41, 0x43, 0x4c, 0x52, 0x65, + 0x63, 0x6f, 0x72, 0x64, 0x2e, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x07, 0x66, 0x69, 0x6c, + 0x74, 0x65, 0x72, 0x73, 0x12, 0x3a, 0x0a, 0x07, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x18, + 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x45, 0x41, 0x43, 0x4c, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, + 0x2e, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x52, 0x07, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, + 0x1a, 0xb9, 0x01, 0x0a, 0x06, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x3a, 0x0a, 0x0b, 0x68, + 0x65, 0x61, 0x64, 0x65, 0x72, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, + 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, + 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x52, 0x0a, 0x68, 0x65, 0x61, + 0x64, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x12, 0x37, 0x0a, 0x0a, 0x6d, 0x61, 0x74, 0x63, 0x68, + 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x6e, 0x65, + 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x4d, 0x61, 0x74, 0x63, + 0x68, 0x54, 0x79, 0x70, 0x65, 0x52, 0x09, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x54, 0x79, 0x70, 0x65, + 0x12, 0x1f, 0x0a, 0x0b, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x4e, 0x61, 0x6d, + 0x65, 0x12, 0x19, 0x0a, 0x0a, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x5f, 0x76, 0x61, 0x6c, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x1a, 0x45, 0x0a, 0x06, + 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x12, 0x27, 0x0a, 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0e, 0x32, 0x13, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x52, 0x6f, 0x6c, 0x65, 0x52, 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x12, + 0x12, 0x0a, 0x04, 0x6b, 0x65, 0x79, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x04, 0x6b, + 0x65, 0x79, 0x73, 0x22, 0xb3, 0x01, 0x0a, 0x09, 0x45, 0x41, 0x43, 0x4c, 0x54, 0x61, 0x62, 0x6c, + 0x65, 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, 0x3e, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, + 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, + 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x74, + 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, + 0x65, 0x72, 0x49, 0x44, 0x12, 0x33, 0x0a, 0x07, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x18, + 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x45, 0x41, 0x43, 0x4c, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, + 0x52, 0x07, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x22, 0x83, 0x03, 0x0a, 0x0b, 0x42, 0x65, + 0x61, 0x72, 0x65, 0x72, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x33, 0x0a, 0x04, 0x62, 0x6f, 0x64, + 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, + 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x42, 0x65, 0x61, 0x72, 0x65, 0x72, 0x54, 0x6f, + 0x6b, 0x65, 0x6e, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x37, + 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, + 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, + 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x1a, 0x85, 0x02, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, + 0x12, 0x37, 0x0a, 0x0a, 0x65, 0x61, 0x63, 0x6c, 0x5f, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x45, 0x41, 0x43, 0x4c, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x52, 0x09, + 0x65, 0x61, 0x63, 0x6c, 0x54, 0x61, 0x62, 0x6c, 0x65, 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, 0x49, 0x0a, + 0x08, 0x6c, 0x69, 0x66, 0x65, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x2d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, + 0x42, 0x65, 0x61, 0x72, 0x65, 0x72, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x42, 0x6f, 0x64, 0x79, + 0x2e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x4c, 0x69, 0x66, 0x65, 0x74, 0x69, 0x6d, 0x65, 0x52, 0x08, + 0x6c, 0x69, 0x66, 0x65, 0x74, 0x69, 0x6d, 0x65, 0x1a, 0x45, 0x0a, 0x0d, 0x54, 0x6f, 0x6b, 0x65, + 0x6e, 0x4c, 0x69, 0x66, 0x65, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x78, 0x70, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x65, 0x78, 0x70, 0x12, 0x10, 0x0a, 0x03, 0x6e, + 0x62, 0x66, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x6e, 0x62, 0x66, 0x12, 0x10, 0x0a, + 0x03, 0x69, 0x61, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x69, 0x61, 0x74, 0x2a, + 0x3e, 0x0a, 0x04, 0x52, 0x6f, 0x6c, 0x65, 0x12, 0x14, 0x0a, 0x10, 0x52, 0x4f, 0x4c, 0x45, 0x5f, + 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x08, 0x0a, + 0x04, 0x55, 0x53, 0x45, 0x52, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x53, 0x59, 0x53, 0x54, 0x45, + 0x4d, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x4f, 0x54, 0x48, 0x45, 0x52, 0x53, 0x10, 0x03, 0x2a, + 0x4f, 0x0a, 0x09, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1a, 0x0a, 0x16, + 0x4d, 0x41, 0x54, 0x43, 0x48, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, + 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x10, 0x0a, 0x0c, 0x53, 0x54, 0x52, 0x49, + 0x4e, 0x47, 0x5f, 0x45, 0x51, 0x55, 0x41, 0x4c, 0x10, 0x01, 0x12, 0x14, 0x0a, 0x10, 0x53, 0x54, + 0x52, 0x49, 0x4e, 0x47, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x45, 0x51, 0x55, 0x41, 0x4c, 0x10, 0x02, + 0x2a, 0x7a, 0x0a, 0x09, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x19, 0x0a, + 0x15, 0x4f, 0x50, 0x45, 0x52, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, + 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x47, 0x45, 0x54, 0x10, + 0x01, 0x12, 0x08, 0x0a, 0x04, 0x48, 0x45, 0x41, 0x44, 0x10, 0x02, 0x12, 0x07, 0x0a, 0x03, 0x50, + 0x55, 0x54, 0x10, 0x03, 0x12, 0x0a, 0x0a, 0x06, 0x44, 0x45, 0x4c, 0x45, 0x54, 0x45, 0x10, 0x04, + 0x12, 0x0a, 0x0a, 0x06, 0x53, 0x45, 0x41, 0x52, 0x43, 0x48, 0x10, 0x05, 0x12, 0x0c, 0x0a, 0x08, + 0x47, 0x45, 0x54, 0x52, 0x41, 0x4e, 0x47, 0x45, 0x10, 0x06, 0x12, 0x10, 0x0a, 0x0c, 0x47, 0x45, + 0x54, 0x52, 0x41, 0x4e, 0x47, 0x45, 0x48, 0x41, 0x53, 0x48, 0x10, 0x07, 0x2a, 0x35, 0x0a, 0x06, + 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x12, 0x41, 0x43, 0x54, 0x49, 0x4f, 0x4e, + 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x09, + 0x0a, 0x05, 0x41, 0x4c, 0x4c, 0x4f, 0x57, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x44, 0x45, 0x4e, + 0x59, 0x10, 0x02, 0x2a, 0x3d, 0x0a, 0x0a, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x54, 0x79, 0x70, + 0x65, 0x12, 0x16, 0x0a, 0x12, 0x48, 0x45, 0x41, 0x44, 0x45, 0x52, 0x5f, 0x55, 0x4e, 0x53, 0x50, + 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x52, 0x45, 0x51, + 0x55, 0x45, 0x53, 0x54, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x4f, 0x42, 0x4a, 0x45, 0x43, 0x54, + 0x10, 0x02, 0x42, 0x46, 0x5a, 0x31, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, + 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, + 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x61, 0x63, 0x6c, 0x2f, 0x67, + 0x72, 0x70, 0x63, 0x3b, 0x61, 0x63, 0x6c, 0xaa, 0x02, 0x10, 0x4e, 0x65, 0x6f, 0x46, 0x53, 0x2e, + 0x41, 0x50, 0x49, 0x2e, 0x76, 0x32, 0x2e, 0x41, 0x63, 0x6c, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, } var ( - ErrInvalidLengthTypes = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowTypes = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupTypes = fmt.Errorf("proto: unexpected end of group") + file_v2_acl_grpc_types_proto_rawDescOnce sync.Once + file_v2_acl_grpc_types_proto_rawDescData = file_v2_acl_grpc_types_proto_rawDesc ) + +func file_v2_acl_grpc_types_proto_rawDescGZIP() []byte { + file_v2_acl_grpc_types_proto_rawDescOnce.Do(func() { + file_v2_acl_grpc_types_proto_rawDescData = protoimpl.X.CompressGZIP(file_v2_acl_grpc_types_proto_rawDescData) + }) + return file_v2_acl_grpc_types_proto_rawDescData +} + +var file_v2_acl_grpc_types_proto_enumTypes = make([]protoimpl.EnumInfo, 5) +var file_v2_acl_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 7) +var file_v2_acl_grpc_types_proto_goTypes = []interface{}{ + (Role)(0), // 0: neo.fs.v2.acl.Role + (MatchType)(0), // 1: neo.fs.v2.acl.MatchType + (Operation)(0), // 2: neo.fs.v2.acl.Operation + (Action)(0), // 3: neo.fs.v2.acl.Action + (HeaderType)(0), // 4: neo.fs.v2.acl.HeaderType + (*EACLRecord)(nil), // 5: neo.fs.v2.acl.EACLRecord + (*EACLTable)(nil), // 6: neo.fs.v2.acl.EACLTable + (*BearerToken)(nil), // 7: neo.fs.v2.acl.BearerToken + (*EACLRecord_Filter)(nil), // 8: neo.fs.v2.acl.EACLRecord.Filter + (*EACLRecord_Target)(nil), // 9: neo.fs.v2.acl.EACLRecord.Target + (*BearerToken_Body)(nil), // 10: neo.fs.v2.acl.BearerToken.Body + (*BearerToken_Body_TokenLifetime)(nil), // 11: neo.fs.v2.acl.BearerToken.Body.TokenLifetime + (*grpc.Version)(nil), // 12: neo.fs.v2.refs.Version + (*grpc.ContainerID)(nil), // 13: neo.fs.v2.refs.ContainerID + (*grpc.Signature)(nil), // 14: neo.fs.v2.refs.Signature + (*grpc.OwnerID)(nil), // 15: neo.fs.v2.refs.OwnerID +} +var file_v2_acl_grpc_types_proto_depIdxs = []int32{ + 2, // 0: neo.fs.v2.acl.EACLRecord.operation:type_name -> neo.fs.v2.acl.Operation + 3, // 1: neo.fs.v2.acl.EACLRecord.action:type_name -> neo.fs.v2.acl.Action + 8, // 2: neo.fs.v2.acl.EACLRecord.filters:type_name -> neo.fs.v2.acl.EACLRecord.Filter + 9, // 3: neo.fs.v2.acl.EACLRecord.targets:type_name -> neo.fs.v2.acl.EACLRecord.Target + 12, // 4: neo.fs.v2.acl.EACLTable.version:type_name -> neo.fs.v2.refs.Version + 13, // 5: neo.fs.v2.acl.EACLTable.container_id:type_name -> neo.fs.v2.refs.ContainerID + 5, // 6: neo.fs.v2.acl.EACLTable.records:type_name -> neo.fs.v2.acl.EACLRecord + 10, // 7: neo.fs.v2.acl.BearerToken.body:type_name -> neo.fs.v2.acl.BearerToken.Body + 14, // 8: neo.fs.v2.acl.BearerToken.signature:type_name -> neo.fs.v2.refs.Signature + 4, // 9: neo.fs.v2.acl.EACLRecord.Filter.header_type:type_name -> neo.fs.v2.acl.HeaderType + 1, // 10: neo.fs.v2.acl.EACLRecord.Filter.match_type:type_name -> neo.fs.v2.acl.MatchType + 0, // 11: neo.fs.v2.acl.EACLRecord.Target.role:type_name -> neo.fs.v2.acl.Role + 6, // 12: neo.fs.v2.acl.BearerToken.Body.eacl_table:type_name -> neo.fs.v2.acl.EACLTable + 15, // 13: neo.fs.v2.acl.BearerToken.Body.owner_id:type_name -> neo.fs.v2.refs.OwnerID + 11, // 14: neo.fs.v2.acl.BearerToken.Body.lifetime:type_name -> neo.fs.v2.acl.BearerToken.Body.TokenLifetime + 15, // [15:15] is the sub-list for method output_type + 15, // [15:15] is the sub-list for method input_type + 15, // [15:15] is the sub-list for extension type_name + 15, // [15:15] is the sub-list for extension extendee + 0, // [0:15] is the sub-list for field type_name +} + +func init() { file_v2_acl_grpc_types_proto_init() } +func file_v2_acl_grpc_types_proto_init() { + if File_v2_acl_grpc_types_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_v2_acl_grpc_types_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*EACLRecord); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_acl_grpc_types_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*EACLTable); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_acl_grpc_types_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*BearerToken); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_acl_grpc_types_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*EACLRecord_Filter); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_acl_grpc_types_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*EACLRecord_Target); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_acl_grpc_types_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*BearerToken_Body); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_acl_grpc_types_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*BearerToken_Body_TokenLifetime); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_v2_acl_grpc_types_proto_rawDesc, + NumEnums: 5, + NumMessages: 7, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_v2_acl_grpc_types_proto_goTypes, + DependencyIndexes: file_v2_acl_grpc_types_proto_depIdxs, + EnumInfos: file_v2_acl_grpc_types_proto_enumTypes, + MessageInfos: file_v2_acl_grpc_types_proto_msgTypes, + }.Build() + File_v2_acl_grpc_types_proto = out.File + file_v2_acl_grpc_types_proto_rawDesc = nil + file_v2_acl_grpc_types_proto_goTypes = nil + file_v2_acl_grpc_types_proto_depIdxs = nil +} diff --git a/v2/acl/marshal_test.go b/v2/acl/marshal_test.go index 16663d8..70f3a81 100644 --- a/v2/acl/marshal_test.go +++ b/v2/acl/marshal_test.go @@ -8,6 +8,7 @@ import ( grpc "github.com/nspcc-dev/neofs-api-go/v2/acl/grpc" "github.com/nspcc-dev/neofs-api-go/v2/refs" "github.com/stretchr/testify/require" + goproto "google.golang.org/protobuf/proto" ) func generateTarget(u acl.Role, k int) *acl.Target { @@ -127,7 +128,7 @@ func TestHeaderFilter_StableMarshal(t *testing.T) { wire, err := filterFrom.StableMarshal(nil) require.NoError(t, err) - err = transport.Unmarshal(wire) + err = goproto.Unmarshal(wire, transport) require.NoError(t, err) filterTo := acl.HeaderFilterFromGRPCMessage(transport) @@ -149,7 +150,7 @@ func TestTargetInfo_StableMarshal(t *testing.T) { wire, err := targetFrom.StableMarshal(nil) require.NoError(t, err) - err = transport.Unmarshal(wire) + err = goproto.Unmarshal(wire, transport) require.NoError(t, err) targetTo := acl.TargetInfoFromGRPCMessage(transport) @@ -165,7 +166,7 @@ func TestRecord_StableMarshal(t *testing.T) { wire, err := recordFrom.StableMarshal(nil) require.NoError(t, err) - err = transport.Unmarshal(wire) + err = goproto.Unmarshal(wire, transport) require.NoError(t, err) recordTo := acl.RecordFromGRPCMessage(transport) @@ -195,7 +196,7 @@ func TestTable_StableMarshal(t *testing.T) { wire, err := tableFrom.StableMarshal(nil) require.NoError(t, err) - err = transport.Unmarshal(wire) + err = goproto.Unmarshal(wire, transport) require.NoError(t, err) tableTo := acl.TableFromGRPCMessage(transport) @@ -211,7 +212,7 @@ func TestTokenLifetime_StableMarshal(t *testing.T) { wire, err := lifetimeFrom.StableMarshal(nil) require.NoError(t, err) - err = transport.Unmarshal(wire) + err = goproto.Unmarshal(wire, transport) require.NoError(t, err) lifetimeTo := acl.TokenLifetimeFromGRPCMessage(transport) @@ -227,7 +228,7 @@ func TestBearerTokenBody_StableMarshal(t *testing.T) { wire, err := bearerTokenBodyFrom.StableMarshal(nil) require.NoError(t, err) - err = transport.Unmarshal(wire) + err = goproto.Unmarshal(wire, transport) require.NoError(t, err) bearerTokenBodyTo := acl.BearerTokenBodyFromGRPCMessage(transport) @@ -243,7 +244,7 @@ func TestBearerToken_StableMarshal(t *testing.T) { wire, err := bearerTokenFrom.StableMarshal(nil) require.NoError(t, err) - err = transport.Unmarshal(wire) + err = goproto.Unmarshal(wire, transport) require.NoError(t, err) bearerTokenTo := acl.BearerTokenFromGRPCMessage(transport) diff --git a/v2/container/grpc/service.pb.go b/v2/container/grpc/service.pb.go index 87b6f09..68d8392 100644 --- a/v2/container/grpc/service.pb.go +++ b/v2/container/grpc/service.pb.go @@ -1,11 +1,13 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.23.0 +// protoc v3.13.0 // source: v2/container/grpc/service.proto package container import ( context "context" - fmt "fmt" proto "github.com/golang/protobuf/proto" grpc2 "github.com/nspcc-dev/neofs-api-go/v2/acl/grpc" grpc1 "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" @@ -13,24 +15,29 @@ import ( grpc3 "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" - io "io" - math "math" - math_bits "math/bits" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +// This is a compile-time assertion that a sufficiently up-to-date version +// of the legacy proto package is being used. +const _ = proto.ProtoPackageIsVersion4 // New NeoFS Container creation request type PutRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // Body of container put request message. Body *PutRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` // Carries request meta information. Header data is used only to regulate @@ -39,62 +46,829 @@ type PutRequest struct { // 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,proto3" json:"verify_header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + VerifyHeader *grpc.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` } -func (m *PutRequest) Reset() { *m = PutRequest{} } -func (m *PutRequest) String() string { return proto.CompactTextString(m) } -func (*PutRequest) ProtoMessage() {} -func (*PutRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_364186d99410ec35, []int{0} +func (x *PutRequest) Reset() { + *x = PutRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_container_grpc_service_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *PutRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) + +func (x *PutRequest) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *PutRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_PutRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err + +func (*PutRequest) ProtoMessage() {} + +func (x *PutRequest) ProtoReflect() protoreflect.Message { + mi := &file_v2_container_grpc_service_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) } - return b[:n], nil + return ms } -} -func (m *PutRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_PutRequest.Merge(m, src) -} -func (m *PutRequest) XXX_Size() int { - return m.Size() -} -func (m *PutRequest) XXX_DiscardUnknown() { - xxx_messageInfo_PutRequest.DiscardUnknown(m) + return mi.MessageOf(x) } -var xxx_messageInfo_PutRequest proto.InternalMessageInfo +// Deprecated: Use PutRequest.ProtoReflect.Descriptor instead. +func (*PutRequest) Descriptor() ([]byte, []int) { + return file_v2_container_grpc_service_proto_rawDescGZIP(), []int{0} +} -func (m *PutRequest) GetBody() *PutRequest_Body { - if m != nil { - return m.Body +func (x *PutRequest) GetBody() *PutRequest_Body { + if x != nil { + return x.Body } return nil } -func (m *PutRequest) GetMetaHeader() *grpc.RequestMetaHeader { - if m != nil { - return m.MetaHeader +func (x *PutRequest) GetMetaHeader() *grpc.RequestMetaHeader { + if x != nil { + return x.MetaHeader } return nil } -func (m *PutRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { - if m != nil { - return m.VerifyHeader +func (x *PutRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} + +// New NeoFS Container creation response +type PutResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Body of container put response message. + Body *PutResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" 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,proto3" json:"verify_header,omitempty"` +} + +func (x *PutResponse) Reset() { + *x = PutResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_container_grpc_service_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PutResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PutResponse) ProtoMessage() {} + +func (x *PutResponse) ProtoReflect() protoreflect.Message { + mi := &file_v2_container_grpc_service_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PutResponse.ProtoReflect.Descriptor instead. +func (*PutResponse) Descriptor() ([]byte, []int) { + return file_v2_container_grpc_service_proto_rawDescGZIP(), []int{1} +} + +func (x *PutResponse) GetBody() *PutResponse_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *PutResponse) GetMetaHeader() *grpc.ResponseMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} + +func (x *PutResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} + +// Container removal request +type DeleteRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Body of container delete request message. + Body *DeleteRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" 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,proto3" json:"verify_header,omitempty"` +} + +func (x *DeleteRequest) Reset() { + *x = DeleteRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_container_grpc_service_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeleteRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteRequest) ProtoMessage() {} + +func (x *DeleteRequest) ProtoReflect() protoreflect.Message { + mi := &file_v2_container_grpc_service_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteRequest.ProtoReflect.Descriptor instead. +func (*DeleteRequest) Descriptor() ([]byte, []int) { + return file_v2_container_grpc_service_proto_rawDescGZIP(), []int{2} +} + +func (x *DeleteRequest) GetBody() *DeleteRequest_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *DeleteRequest) GetMetaHeader() *grpc.RequestMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} + +func (x *DeleteRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} + +// `DeleteResponse` has an empty body because delete operation is asynchronous +// and done via consensus in Inner Ring nodes. +type DeleteResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Body of container delete response message. + Body *DeleteResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" 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,proto3" json:"verify_header,omitempty"` +} + +func (x *DeleteResponse) Reset() { + *x = DeleteResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_container_grpc_service_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeleteResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteResponse) ProtoMessage() {} + +func (x *DeleteResponse) ProtoReflect() protoreflect.Message { + mi := &file_v2_container_grpc_service_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteResponse.ProtoReflect.Descriptor instead. +func (*DeleteResponse) Descriptor() ([]byte, []int) { + return file_v2_container_grpc_service_proto_rawDescGZIP(), []int{3} +} + +func (x *DeleteResponse) GetBody() *DeleteResponse_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *DeleteResponse) GetMetaHeader() *grpc.ResponseMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} + +func (x *DeleteResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} + +// Get container structure +type GetRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Body of container get request message. + Body *GetRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" 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,proto3" json:"verify_header,omitempty"` +} + +func (x *GetRequest) Reset() { + *x = GetRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_container_grpc_service_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetRequest) ProtoMessage() {} + +func (x *GetRequest) ProtoReflect() protoreflect.Message { + mi := &file_v2_container_grpc_service_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetRequest.ProtoReflect.Descriptor instead. +func (*GetRequest) Descriptor() ([]byte, []int) { + return file_v2_container_grpc_service_proto_rawDescGZIP(), []int{4} +} + +func (x *GetRequest) GetBody() *GetRequest_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *GetRequest) GetMetaHeader() *grpc.RequestMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} + +func (x *GetRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} + +// Get container structure +type GetResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Body of container get response message. + Body *GetResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" 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,proto3" json:"verify_header,omitempty"` +} + +func (x *GetResponse) Reset() { + *x = GetResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_container_grpc_service_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetResponse) ProtoMessage() {} + +func (x *GetResponse) ProtoReflect() protoreflect.Message { + mi := &file_v2_container_grpc_service_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetResponse.ProtoReflect.Descriptor instead. +func (*GetResponse) Descriptor() ([]byte, []int) { + return file_v2_container_grpc_service_proto_rawDescGZIP(), []int{5} +} + +func (x *GetResponse) GetBody() *GetResponse_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *GetResponse) GetMetaHeader() *grpc.ResponseMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} + +func (x *GetResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} + +// List containers +type ListRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Body of list containers request message + Body *ListRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" 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,proto3" json:"verify_header,omitempty"` +} + +func (x *ListRequest) Reset() { + *x = ListRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_container_grpc_service_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListRequest) ProtoMessage() {} + +func (x *ListRequest) ProtoReflect() protoreflect.Message { + mi := &file_v2_container_grpc_service_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListRequest.ProtoReflect.Descriptor instead. +func (*ListRequest) Descriptor() ([]byte, []int) { + return file_v2_container_grpc_service_proto_rawDescGZIP(), []int{6} +} + +func (x *ListRequest) GetBody() *ListRequest_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *ListRequest) GetMetaHeader() *grpc.RequestMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} + +func (x *ListRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} + +// List containers +type ListResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Body of list containers response message. + Body *ListResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" 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,proto3" json:"verify_header,omitempty"` +} + +func (x *ListResponse) Reset() { + *x = ListResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_container_grpc_service_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListResponse) ProtoMessage() {} + +func (x *ListResponse) ProtoReflect() protoreflect.Message { + mi := &file_v2_container_grpc_service_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListResponse.ProtoReflect.Descriptor instead. +func (*ListResponse) Descriptor() ([]byte, []int) { + return file_v2_container_grpc_service_proto_rawDescGZIP(), []int{7} +} + +func (x *ListResponse) GetBody() *ListResponse_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *ListResponse) GetMetaHeader() *grpc.ResponseMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} + +func (x *ListResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} + +// Set Extended ACL +type SetExtendedACLRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Body of set extended acl request message. + Body *SetExtendedACLRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" 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,proto3" json:"verify_header,omitempty"` +} + +func (x *SetExtendedACLRequest) Reset() { + *x = SetExtendedACLRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_container_grpc_service_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SetExtendedACLRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SetExtendedACLRequest) ProtoMessage() {} + +func (x *SetExtendedACLRequest) ProtoReflect() protoreflect.Message { + mi := &file_v2_container_grpc_service_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SetExtendedACLRequest.ProtoReflect.Descriptor instead. +func (*SetExtendedACLRequest) Descriptor() ([]byte, []int) { + return file_v2_container_grpc_service_proto_rawDescGZIP(), []int{8} +} + +func (x *SetExtendedACLRequest) GetBody() *SetExtendedACLRequest_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *SetExtendedACLRequest) GetMetaHeader() *grpc.RequestMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} + +func (x *SetExtendedACLRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} + +// Set Extended ACL +type SetExtendedACLResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Body of set extended acl response message. + Body *SetExtendedACLResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" 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,proto3" json:"verify_header,omitempty"` +} + +func (x *SetExtendedACLResponse) Reset() { + *x = SetExtendedACLResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_container_grpc_service_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SetExtendedACLResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SetExtendedACLResponse) ProtoMessage() {} + +func (x *SetExtendedACLResponse) ProtoReflect() protoreflect.Message { + mi := &file_v2_container_grpc_service_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SetExtendedACLResponse.ProtoReflect.Descriptor instead. +func (*SetExtendedACLResponse) Descriptor() ([]byte, []int) { + return file_v2_container_grpc_service_proto_rawDescGZIP(), []int{9} +} + +func (x *SetExtendedACLResponse) GetBody() *SetExtendedACLResponse_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *SetExtendedACLResponse) GetMetaHeader() *grpc.ResponseMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} + +func (x *SetExtendedACLResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} + +// Get Extended ACL +type GetExtendedACLRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Body of get extended acl request message. + Body *GetExtendedACLRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" 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,proto3" json:"verify_header,omitempty"` +} + +func (x *GetExtendedACLRequest) Reset() { + *x = GetExtendedACLRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_container_grpc_service_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetExtendedACLRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetExtendedACLRequest) ProtoMessage() {} + +func (x *GetExtendedACLRequest) ProtoReflect() protoreflect.Message { + mi := &file_v2_container_grpc_service_proto_msgTypes[10] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetExtendedACLRequest.ProtoReflect.Descriptor instead. +func (*GetExtendedACLRequest) Descriptor() ([]byte, []int) { + return file_v2_container_grpc_service_proto_rawDescGZIP(), []int{10} +} + +func (x *GetExtendedACLRequest) GetBody() *GetExtendedACLRequest_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *GetExtendedACLRequest) GetMetaHeader() *grpc.RequestMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} + +func (x *GetExtendedACLRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} + +// Get Extended ACL +type GetExtendedACLResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Body of get extended acl response message. + Body *GetExtendedACLResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" 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,proto3" json:"verify_header,omitempty"` +} + +func (x *GetExtendedACLResponse) Reset() { + *x = GetExtendedACLResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_container_grpc_service_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetExtendedACLResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetExtendedACLResponse) ProtoMessage() {} + +func (x *GetExtendedACLResponse) ProtoReflect() protoreflect.Message { + mi := &file_v2_container_grpc_service_proto_msgTypes[11] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetExtendedACLResponse.ProtoReflect.Descriptor instead. +func (*GetExtendedACLResponse) Descriptor() ([]byte, []int) { + return file_v2_container_grpc_service_proto_rawDescGZIP(), []int{11} +} + +func (x *GetExtendedACLResponse) GetBody() *GetExtendedACLResponse_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *GetExtendedACLResponse) GetMetaHeader() *grpc.ResponseMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} + +func (x *GetExtendedACLResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { + if x != nil { + return x.VerifyHeader } return nil } @@ -105,128 +879,58 @@ func (m *PutRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { // the stable-marshalled container strucutre, hence there is no need for // additional signature checks. type PutRequest_Body struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // Container structure to register in NeoFS Container *Container `protobuf:"bytes,1,opt,name=container,proto3" json:"container,omitempty"` // Signature of a stable-marshalled container according to RFC-6979 - Signature *grpc1.Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Signature *grpc1.Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` } -func (m *PutRequest_Body) Reset() { *m = PutRequest_Body{} } -func (m *PutRequest_Body) String() string { return proto.CompactTextString(m) } -func (*PutRequest_Body) ProtoMessage() {} +func (x *PutRequest_Body) Reset() { + *x = PutRequest_Body{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_container_grpc_service_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PutRequest_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PutRequest_Body) ProtoMessage() {} + +func (x *PutRequest_Body) ProtoReflect() protoreflect.Message { + mi := &file_v2_container_grpc_service_proto_msgTypes[12] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PutRequest_Body.ProtoReflect.Descriptor instead. func (*PutRequest_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_364186d99410ec35, []int{0, 0} -} -func (m *PutRequest_Body) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *PutRequest_Body) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_PutRequest_Body.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *PutRequest_Body) XXX_Merge(src proto.Message) { - xxx_messageInfo_PutRequest_Body.Merge(m, src) -} -func (m *PutRequest_Body) XXX_Size() int { - return m.Size() -} -func (m *PutRequest_Body) XXX_DiscardUnknown() { - xxx_messageInfo_PutRequest_Body.DiscardUnknown(m) + return file_v2_container_grpc_service_proto_rawDescGZIP(), []int{0, 0} } -var xxx_messageInfo_PutRequest_Body proto.InternalMessageInfo - -func (m *PutRequest_Body) GetContainer() *Container { - if m != nil { - return m.Container +func (x *PutRequest_Body) GetContainer() *Container { + if x != nil { + return x.Container } return nil } -func (m *PutRequest_Body) GetSignature() *grpc1.Signature { - if m != nil { - return m.Signature - } - return nil -} - -// New NeoFS Container creation response -type PutResponse struct { - // Body of container put response message. - Body *PutResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" 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,proto3" json:"verify_header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *PutResponse) Reset() { *m = PutResponse{} } -func (m *PutResponse) String() string { return proto.CompactTextString(m) } -func (*PutResponse) ProtoMessage() {} -func (*PutResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_364186d99410ec35, []int{1} -} -func (m *PutResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *PutResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_PutResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *PutResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_PutResponse.Merge(m, src) -} -func (m *PutResponse) XXX_Size() int { - return m.Size() -} -func (m *PutResponse) XXX_DiscardUnknown() { - xxx_messageInfo_PutResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_PutResponse proto.InternalMessageInfo - -func (m *PutResponse) GetBody() *PutResponse_Body { - if m != nil { - return m.Body - } - return nil -} - -func (m *PutResponse) GetMetaHeader() *grpc.ResponseMetaHeader { - if m != nil { - return m.MetaHeader - } - return nil -} - -func (m *PutResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { - if m != nil { - return m.VerifyHeader +func (x *PutRequest_Body) GetSignature() *grpc1.Signature { + if x != nil { + return x.Signature } return nil } @@ -236,119 +940,49 @@ func (m *PutResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { // calculated beforehand from the container structure and compared to the one // returned here to make sure everything was done as expected. type PutResponse_Body struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // Unique identifier of the newly created container - ContainerId *grpc1.ContainerID `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + ContainerId *grpc1.ContainerID `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` } -func (m *PutResponse_Body) Reset() { *m = PutResponse_Body{} } -func (m *PutResponse_Body) String() string { return proto.CompactTextString(m) } -func (*PutResponse_Body) ProtoMessage() {} +func (x *PutResponse_Body) Reset() { + *x = PutResponse_Body{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_container_grpc_service_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PutResponse_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PutResponse_Body) ProtoMessage() {} + +func (x *PutResponse_Body) ProtoReflect() protoreflect.Message { + mi := &file_v2_container_grpc_service_proto_msgTypes[13] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PutResponse_Body.ProtoReflect.Descriptor instead. func (*PutResponse_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_364186d99410ec35, []int{1, 0} -} -func (m *PutResponse_Body) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *PutResponse_Body) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_PutResponse_Body.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *PutResponse_Body) XXX_Merge(src proto.Message) { - xxx_messageInfo_PutResponse_Body.Merge(m, src) -} -func (m *PutResponse_Body) XXX_Size() int { - return m.Size() -} -func (m *PutResponse_Body) XXX_DiscardUnknown() { - xxx_messageInfo_PutResponse_Body.DiscardUnknown(m) + return file_v2_container_grpc_service_proto_rawDescGZIP(), []int{1, 0} } -var xxx_messageInfo_PutResponse_Body proto.InternalMessageInfo - -func (m *PutResponse_Body) GetContainerId() *grpc1.ContainerID { - if m != nil { - return m.ContainerId - } - return nil -} - -// Container removal request -type DeleteRequest struct { - // Body of container delete request message. - Body *DeleteRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" 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,proto3" json:"verify_header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *DeleteRequest) Reset() { *m = DeleteRequest{} } -func (m *DeleteRequest) String() string { return proto.CompactTextString(m) } -func (*DeleteRequest) ProtoMessage() {} -func (*DeleteRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_364186d99410ec35, []int{2} -} -func (m *DeleteRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *DeleteRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_DeleteRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *DeleteRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_DeleteRequest.Merge(m, src) -} -func (m *DeleteRequest) XXX_Size() int { - return m.Size() -} -func (m *DeleteRequest) XXX_DiscardUnknown() { - xxx_messageInfo_DeleteRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_DeleteRequest proto.InternalMessageInfo - -func (m *DeleteRequest) GetBody() *DeleteRequest_Body { - if m != nil { - return m.Body - } - return nil -} - -func (m *DeleteRequest) GetMetaHeader() *grpc.RequestMetaHeader { - if m != nil { - return m.MetaHeader - } - return nil -} - -func (m *DeleteRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { - if m != nil { - return m.VerifyHeader +func (x *PutResponse_Body) GetContainerId() *grpc1.ContainerID { + if x != nil { + return x.ContainerId } return nil } @@ -357,129 +991,58 @@ func (m *DeleteRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { // container owner's intent. The signature will be verified by `Container` // smart contract, so signing algorithm must be supported by NeoVM. type DeleteRequest_Body struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // Identifier of the container to delete from NeoFS ContainerId *grpc1.ContainerID `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` // `ContainerID` signed with the container owner's key according to RFC-6979 - Signature *grpc1.Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Signature *grpc1.Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` } -func (m *DeleteRequest_Body) Reset() { *m = DeleteRequest_Body{} } -func (m *DeleteRequest_Body) String() string { return proto.CompactTextString(m) } -func (*DeleteRequest_Body) ProtoMessage() {} +func (x *DeleteRequest_Body) Reset() { + *x = DeleteRequest_Body{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_container_grpc_service_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeleteRequest_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteRequest_Body) ProtoMessage() {} + +func (x *DeleteRequest_Body) ProtoReflect() protoreflect.Message { + mi := &file_v2_container_grpc_service_proto_msgTypes[14] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteRequest_Body.ProtoReflect.Descriptor instead. func (*DeleteRequest_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_364186d99410ec35, []int{2, 0} -} -func (m *DeleteRequest_Body) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *DeleteRequest_Body) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_DeleteRequest_Body.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *DeleteRequest_Body) XXX_Merge(src proto.Message) { - xxx_messageInfo_DeleteRequest_Body.Merge(m, src) -} -func (m *DeleteRequest_Body) XXX_Size() int { - return m.Size() -} -func (m *DeleteRequest_Body) XXX_DiscardUnknown() { - xxx_messageInfo_DeleteRequest_Body.DiscardUnknown(m) + return file_v2_container_grpc_service_proto_rawDescGZIP(), []int{2, 0} } -var xxx_messageInfo_DeleteRequest_Body proto.InternalMessageInfo - -func (m *DeleteRequest_Body) GetContainerId() *grpc1.ContainerID { - if m != nil { - return m.ContainerId +func (x *DeleteRequest_Body) GetContainerId() *grpc1.ContainerID { + if x != nil { + return x.ContainerId } return nil } -func (m *DeleteRequest_Body) GetSignature() *grpc1.Signature { - if m != nil { - return m.Signature - } - return nil -} - -// `DeleteResponse` has an empty body because delete operation is asynchronous -// and done via consensus in Inner Ring nodes. -type DeleteResponse struct { - // Body of container delete response message. - Body *DeleteResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" 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,proto3" json:"verify_header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *DeleteResponse) Reset() { *m = DeleteResponse{} } -func (m *DeleteResponse) String() string { return proto.CompactTextString(m) } -func (*DeleteResponse) ProtoMessage() {} -func (*DeleteResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_364186d99410ec35, []int{3} -} -func (m *DeleteResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *DeleteResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_DeleteResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *DeleteResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_DeleteResponse.Merge(m, src) -} -func (m *DeleteResponse) XXX_Size() int { - return m.Size() -} -func (m *DeleteResponse) XXX_DiscardUnknown() { - xxx_messageInfo_DeleteResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_DeleteResponse proto.InternalMessageInfo - -func (m *DeleteResponse) GetBody() *DeleteResponse_Body { - if m != nil { - return m.Body - } - return nil -} - -func (m *DeleteResponse) GetMetaHeader() *grpc.ResponseMetaHeader { - if m != nil { - return m.MetaHeader - } - return nil -} - -func (m *DeleteResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { - if m != nil { - return m.VerifyHeader +func (x *DeleteRequest_Body) GetSignature() *grpc1.Signature { + if x != nil { + return x.Signature } return nil } @@ -487,229 +1050,88 @@ func (m *DeleteResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { // `DeleteResponse` has an empty body because delete operation is asynchronous // and done via consensus in Inner Ring nodes. type DeleteResponse_Body struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields } -func (m *DeleteResponse_Body) Reset() { *m = DeleteResponse_Body{} } -func (m *DeleteResponse_Body) String() string { return proto.CompactTextString(m) } -func (*DeleteResponse_Body) ProtoMessage() {} +func (x *DeleteResponse_Body) Reset() { + *x = DeleteResponse_Body{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_container_grpc_service_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeleteResponse_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteResponse_Body) ProtoMessage() {} + +func (x *DeleteResponse_Body) ProtoReflect() protoreflect.Message { + mi := &file_v2_container_grpc_service_proto_msgTypes[15] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteResponse_Body.ProtoReflect.Descriptor instead. func (*DeleteResponse_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_364186d99410ec35, []int{3, 0} -} -func (m *DeleteResponse_Body) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *DeleteResponse_Body) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_DeleteResponse_Body.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *DeleteResponse_Body) XXX_Merge(src proto.Message) { - xxx_messageInfo_DeleteResponse_Body.Merge(m, src) -} -func (m *DeleteResponse_Body) XXX_Size() int { - return m.Size() -} -func (m *DeleteResponse_Body) XXX_DiscardUnknown() { - xxx_messageInfo_DeleteResponse_Body.DiscardUnknown(m) -} - -var xxx_messageInfo_DeleteResponse_Body proto.InternalMessageInfo - -// Get container structure -type GetRequest struct { - // Body of container get request message. - Body *GetRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" 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,proto3" json:"verify_header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GetRequest) Reset() { *m = GetRequest{} } -func (m *GetRequest) String() string { return proto.CompactTextString(m) } -func (*GetRequest) ProtoMessage() {} -func (*GetRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_364186d99410ec35, []int{4} -} -func (m *GetRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *GetRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_GetRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *GetRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetRequest.Merge(m, src) -} -func (m *GetRequest) XXX_Size() int { - return m.Size() -} -func (m *GetRequest) XXX_DiscardUnknown() { - xxx_messageInfo_GetRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_GetRequest proto.InternalMessageInfo - -func (m *GetRequest) GetBody() *GetRequest_Body { - if m != nil { - return m.Body - } - return nil -} - -func (m *GetRequest) GetMetaHeader() *grpc.RequestMetaHeader { - if m != nil { - return m.MetaHeader - } - return nil -} - -func (m *GetRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { - if m != nil { - return m.VerifyHeader - } - return nil + return file_v2_container_grpc_service_proto_rawDescGZIP(), []int{3, 0} } // Get container structure request body. type GetRequest_Body struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // Identifier of the container to get - ContainerId *grpc1.ContainerID `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + ContainerId *grpc1.ContainerID `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` } -func (m *GetRequest_Body) Reset() { *m = GetRequest_Body{} } -func (m *GetRequest_Body) String() string { return proto.CompactTextString(m) } -func (*GetRequest_Body) ProtoMessage() {} +func (x *GetRequest_Body) Reset() { + *x = GetRequest_Body{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_container_grpc_service_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetRequest_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetRequest_Body) ProtoMessage() {} + +func (x *GetRequest_Body) ProtoReflect() protoreflect.Message { + mi := &file_v2_container_grpc_service_proto_msgTypes[16] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetRequest_Body.ProtoReflect.Descriptor instead. func (*GetRequest_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_364186d99410ec35, []int{4, 0} -} -func (m *GetRequest_Body) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *GetRequest_Body) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_GetRequest_Body.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *GetRequest_Body) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetRequest_Body.Merge(m, src) -} -func (m *GetRequest_Body) XXX_Size() int { - return m.Size() -} -func (m *GetRequest_Body) XXX_DiscardUnknown() { - xxx_messageInfo_GetRequest_Body.DiscardUnknown(m) + return file_v2_container_grpc_service_proto_rawDescGZIP(), []int{4, 0} } -var xxx_messageInfo_GetRequest_Body proto.InternalMessageInfo - -func (m *GetRequest_Body) GetContainerId() *grpc1.ContainerID { - if m != nil { - return m.ContainerId - } - return nil -} - -// Get container structure -type GetResponse struct { - // Body of container get response message. - Body *GetResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" 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,proto3" json:"verify_header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GetResponse) Reset() { *m = GetResponse{} } -func (m *GetResponse) String() string { return proto.CompactTextString(m) } -func (*GetResponse) ProtoMessage() {} -func (*GetResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_364186d99410ec35, []int{5} -} -func (m *GetResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *GetResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_GetResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *GetResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetResponse.Merge(m, src) -} -func (m *GetResponse) XXX_Size() int { - return m.Size() -} -func (m *GetResponse) XXX_DiscardUnknown() { - xxx_messageInfo_GetResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_GetResponse proto.InternalMessageInfo - -func (m *GetResponse) GetBody() *GetResponse_Body { - if m != nil { - return m.Body - } - return nil -} - -func (m *GetResponse) GetMetaHeader() *grpc.ResponseMetaHeader { - if m != nil { - return m.MetaHeader - } - return nil -} - -func (m *GetResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { - if m != nil { - return m.VerifyHeader +func (x *GetRequest_Body) GetContainerId() *grpc1.ContainerID { + if x != nil { + return x.ContainerId } return nil } @@ -717,357 +1139,147 @@ func (m *GetResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { // Get container response body does not have container structure signature. It // was already verified on container creation. type GetResponse_Body struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // Requested container structure - Container *Container `protobuf:"bytes,1,opt,name=container,proto3" json:"container,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Container *Container `protobuf:"bytes,1,opt,name=container,proto3" json:"container,omitempty"` } -func (m *GetResponse_Body) Reset() { *m = GetResponse_Body{} } -func (m *GetResponse_Body) String() string { return proto.CompactTextString(m) } -func (*GetResponse_Body) ProtoMessage() {} +func (x *GetResponse_Body) Reset() { + *x = GetResponse_Body{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_container_grpc_service_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetResponse_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetResponse_Body) ProtoMessage() {} + +func (x *GetResponse_Body) ProtoReflect() protoreflect.Message { + mi := &file_v2_container_grpc_service_proto_msgTypes[17] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetResponse_Body.ProtoReflect.Descriptor instead. func (*GetResponse_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_364186d99410ec35, []int{5, 0} -} -func (m *GetResponse_Body) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *GetResponse_Body) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_GetResponse_Body.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *GetResponse_Body) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetResponse_Body.Merge(m, src) -} -func (m *GetResponse_Body) XXX_Size() int { - return m.Size() -} -func (m *GetResponse_Body) XXX_DiscardUnknown() { - xxx_messageInfo_GetResponse_Body.DiscardUnknown(m) + return file_v2_container_grpc_service_proto_rawDescGZIP(), []int{5, 0} } -var xxx_messageInfo_GetResponse_Body proto.InternalMessageInfo - -func (m *GetResponse_Body) GetContainer() *Container { - if m != nil { - return m.Container - } - return nil -} - -// List containers -type ListRequest struct { - // Body of list containers request message - Body *ListRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" 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,proto3" json:"verify_header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ListRequest) Reset() { *m = ListRequest{} } -func (m *ListRequest) String() string { return proto.CompactTextString(m) } -func (*ListRequest) ProtoMessage() {} -func (*ListRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_364186d99410ec35, []int{6} -} -func (m *ListRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ListRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ListRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *ListRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_ListRequest.Merge(m, src) -} -func (m *ListRequest) XXX_Size() int { - return m.Size() -} -func (m *ListRequest) XXX_DiscardUnknown() { - xxx_messageInfo_ListRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_ListRequest proto.InternalMessageInfo - -func (m *ListRequest) GetBody() *ListRequest_Body { - if m != nil { - return m.Body - } - return nil -} - -func (m *ListRequest) GetMetaHeader() *grpc.RequestMetaHeader { - if m != nil { - return m.MetaHeader - } - return nil -} - -func (m *ListRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { - if m != nil { - return m.VerifyHeader +func (x *GetResponse_Body) GetContainer() *Container { + if x != nil { + return x.Container } return nil } // List containers request body. type ListRequest_Body struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // Identifier of the container owner - OwnerId *grpc1.OwnerID `protobuf:"bytes,1,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + OwnerId *grpc1.OwnerID `protobuf:"bytes,1,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"` } -func (m *ListRequest_Body) Reset() { *m = ListRequest_Body{} } -func (m *ListRequest_Body) String() string { return proto.CompactTextString(m) } -func (*ListRequest_Body) ProtoMessage() {} +func (x *ListRequest_Body) Reset() { + *x = ListRequest_Body{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_container_grpc_service_proto_msgTypes[18] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListRequest_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListRequest_Body) ProtoMessage() {} + +func (x *ListRequest_Body) ProtoReflect() protoreflect.Message { + mi := &file_v2_container_grpc_service_proto_msgTypes[18] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListRequest_Body.ProtoReflect.Descriptor instead. func (*ListRequest_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_364186d99410ec35, []int{6, 0} -} -func (m *ListRequest_Body) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ListRequest_Body) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ListRequest_Body.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *ListRequest_Body) XXX_Merge(src proto.Message) { - xxx_messageInfo_ListRequest_Body.Merge(m, src) -} -func (m *ListRequest_Body) XXX_Size() int { - return m.Size() -} -func (m *ListRequest_Body) XXX_DiscardUnknown() { - xxx_messageInfo_ListRequest_Body.DiscardUnknown(m) + return file_v2_container_grpc_service_proto_rawDescGZIP(), []int{6, 0} } -var xxx_messageInfo_ListRequest_Body proto.InternalMessageInfo - -func (m *ListRequest_Body) GetOwnerId() *grpc1.OwnerID { - if m != nil { - return m.OwnerId - } - return nil -} - -// List containers -type ListResponse struct { - // Body of list containers response message. - Body *ListResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" 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,proto3" json:"verify_header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ListResponse) Reset() { *m = ListResponse{} } -func (m *ListResponse) String() string { return proto.CompactTextString(m) } -func (*ListResponse) ProtoMessage() {} -func (*ListResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_364186d99410ec35, []int{7} -} -func (m *ListResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ListResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ListResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *ListResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_ListResponse.Merge(m, src) -} -func (m *ListResponse) XXX_Size() int { - return m.Size() -} -func (m *ListResponse) XXX_DiscardUnknown() { - xxx_messageInfo_ListResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_ListResponse proto.InternalMessageInfo - -func (m *ListResponse) GetBody() *ListResponse_Body { - if m != nil { - return m.Body - } - return nil -} - -func (m *ListResponse) GetMetaHeader() *grpc.ResponseMetaHeader { - if m != nil { - return m.MetaHeader - } - return nil -} - -func (m *ListResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { - if m != nil { - return m.VerifyHeader +func (x *ListRequest_Body) GetOwnerId() *grpc1.OwnerID { + if x != nil { + return x.OwnerId } return nil } // List containers response body. type ListResponse_Body struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // List of `ContainerID`s belonging to the requested `OwnerID` - ContainerIds []*grpc1.ContainerID `protobuf:"bytes,1,rep,name=container_ids,json=containerIds,proto3" json:"container_ids,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + ContainerIds []*grpc1.ContainerID `protobuf:"bytes,1,rep,name=container_ids,json=containerIds,proto3" json:"container_ids,omitempty"` } -func (m *ListResponse_Body) Reset() { *m = ListResponse_Body{} } -func (m *ListResponse_Body) String() string { return proto.CompactTextString(m) } -func (*ListResponse_Body) ProtoMessage() {} +func (x *ListResponse_Body) Reset() { + *x = ListResponse_Body{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_container_grpc_service_proto_msgTypes[19] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListResponse_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListResponse_Body) ProtoMessage() {} + +func (x *ListResponse_Body) ProtoReflect() protoreflect.Message { + mi := &file_v2_container_grpc_service_proto_msgTypes[19] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListResponse_Body.ProtoReflect.Descriptor instead. func (*ListResponse_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_364186d99410ec35, []int{7, 0} -} -func (m *ListResponse_Body) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ListResponse_Body) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ListResponse_Body.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *ListResponse_Body) XXX_Merge(src proto.Message) { - xxx_messageInfo_ListResponse_Body.Merge(m, src) -} -func (m *ListResponse_Body) XXX_Size() int { - return m.Size() -} -func (m *ListResponse_Body) XXX_DiscardUnknown() { - xxx_messageInfo_ListResponse_Body.DiscardUnknown(m) + return file_v2_container_grpc_service_proto_rawDescGZIP(), []int{7, 0} } -var xxx_messageInfo_ListResponse_Body proto.InternalMessageInfo - -func (m *ListResponse_Body) GetContainerIds() []*grpc1.ContainerID { - if m != nil { - return m.ContainerIds - } - return nil -} - -// Set Extended ACL -type SetExtendedACLRequest struct { - // Body of set extended acl request message. - Body *SetExtendedACLRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" 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,proto3" json:"verify_header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *SetExtendedACLRequest) Reset() { *m = SetExtendedACLRequest{} } -func (m *SetExtendedACLRequest) String() string { return proto.CompactTextString(m) } -func (*SetExtendedACLRequest) ProtoMessage() {} -func (*SetExtendedACLRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_364186d99410ec35, []int{8} -} -func (m *SetExtendedACLRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *SetExtendedACLRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_SetExtendedACLRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *SetExtendedACLRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_SetExtendedACLRequest.Merge(m, src) -} -func (m *SetExtendedACLRequest) XXX_Size() int { - return m.Size() -} -func (m *SetExtendedACLRequest) XXX_DiscardUnknown() { - xxx_messageInfo_SetExtendedACLRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_SetExtendedACLRequest proto.InternalMessageInfo - -func (m *SetExtendedACLRequest) GetBody() *SetExtendedACLRequest_Body { - if m != nil { - return m.Body - } - return nil -} - -func (m *SetExtendedACLRequest) GetMetaHeader() *grpc.RequestMetaHeader { - if m != nil { - return m.MetaHeader - } - return nil -} - -func (m *SetExtendedACLRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { - if m != nil { - return m.VerifyHeader +func (x *ListResponse_Body) GetContainerIds() []*grpc1.ContainerID { + if x != nil { + return x.ContainerIds } return nil } @@ -1075,128 +1287,58 @@ func (m *SetExtendedACLRequest) GetVerifyHeader() *grpc.RequestVerificationHeade // Set Extended ACL request body does not have separate `ContainerID` // reference. It will be taken from `EACLTable.container_id` field. type SetExtendedACLRequest_Body struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // Extended ACL table to set for container Eacl *grpc2.EACLTable `protobuf:"bytes,1,opt,name=eacl,proto3" json:"eacl,omitempty"` // Signature of stable-marshalled Extended ACL table according to RFC-6979 - Signature *grpc1.Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Signature *grpc1.Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` } -func (m *SetExtendedACLRequest_Body) Reset() { *m = SetExtendedACLRequest_Body{} } -func (m *SetExtendedACLRequest_Body) String() string { return proto.CompactTextString(m) } -func (*SetExtendedACLRequest_Body) ProtoMessage() {} +func (x *SetExtendedACLRequest_Body) Reset() { + *x = SetExtendedACLRequest_Body{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_container_grpc_service_proto_msgTypes[20] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SetExtendedACLRequest_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SetExtendedACLRequest_Body) ProtoMessage() {} + +func (x *SetExtendedACLRequest_Body) ProtoReflect() protoreflect.Message { + mi := &file_v2_container_grpc_service_proto_msgTypes[20] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SetExtendedACLRequest_Body.ProtoReflect.Descriptor instead. func (*SetExtendedACLRequest_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_364186d99410ec35, []int{8, 0} -} -func (m *SetExtendedACLRequest_Body) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *SetExtendedACLRequest_Body) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_SetExtendedACLRequest_Body.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *SetExtendedACLRequest_Body) XXX_Merge(src proto.Message) { - xxx_messageInfo_SetExtendedACLRequest_Body.Merge(m, src) -} -func (m *SetExtendedACLRequest_Body) XXX_Size() int { - return m.Size() -} -func (m *SetExtendedACLRequest_Body) XXX_DiscardUnknown() { - xxx_messageInfo_SetExtendedACLRequest_Body.DiscardUnknown(m) + return file_v2_container_grpc_service_proto_rawDescGZIP(), []int{8, 0} } -var xxx_messageInfo_SetExtendedACLRequest_Body proto.InternalMessageInfo - -func (m *SetExtendedACLRequest_Body) GetEacl() *grpc2.EACLTable { - if m != nil { - return m.Eacl +func (x *SetExtendedACLRequest_Body) GetEacl() *grpc2.EACLTable { + if x != nil { + return x.Eacl } return nil } -func (m *SetExtendedACLRequest_Body) GetSignature() *grpc1.Signature { - if m != nil { - return m.Signature - } - return nil -} - -// Set Extended ACL -type SetExtendedACLResponse struct { - // Body of set extended acl response message. - Body *SetExtendedACLResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" 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,proto3" json:"verify_header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *SetExtendedACLResponse) Reset() { *m = SetExtendedACLResponse{} } -func (m *SetExtendedACLResponse) String() string { return proto.CompactTextString(m) } -func (*SetExtendedACLResponse) ProtoMessage() {} -func (*SetExtendedACLResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_364186d99410ec35, []int{9} -} -func (m *SetExtendedACLResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *SetExtendedACLResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_SetExtendedACLResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *SetExtendedACLResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_SetExtendedACLResponse.Merge(m, src) -} -func (m *SetExtendedACLResponse) XXX_Size() int { - return m.Size() -} -func (m *SetExtendedACLResponse) XXX_DiscardUnknown() { - xxx_messageInfo_SetExtendedACLResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_SetExtendedACLResponse proto.InternalMessageInfo - -func (m *SetExtendedACLResponse) GetBody() *SetExtendedACLResponse_Body { - if m != nil { - return m.Body - } - return nil -} - -func (m *SetExtendedACLResponse) GetMetaHeader() *grpc.ResponseMetaHeader { - if m != nil { - return m.MetaHeader - } - return nil -} - -func (m *SetExtendedACLResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { - if m != nil { - return m.VerifyHeader +func (x *SetExtendedACLRequest_Body) GetSignature() *grpc1.Signature { + if x != nil { + return x.Signature } return nil } @@ -1205,229 +1347,88 @@ func (m *SetExtendedACLResponse) GetVerifyHeader() *grpc.ResponseVerificationHea // asynchronous and update should be reflected in `Container` smart contract's // storage after next block is issued in sidechain. type SetExtendedACLResponse_Body struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields } -func (m *SetExtendedACLResponse_Body) Reset() { *m = SetExtendedACLResponse_Body{} } -func (m *SetExtendedACLResponse_Body) String() string { return proto.CompactTextString(m) } -func (*SetExtendedACLResponse_Body) ProtoMessage() {} +func (x *SetExtendedACLResponse_Body) Reset() { + *x = SetExtendedACLResponse_Body{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_container_grpc_service_proto_msgTypes[21] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SetExtendedACLResponse_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SetExtendedACLResponse_Body) ProtoMessage() {} + +func (x *SetExtendedACLResponse_Body) ProtoReflect() protoreflect.Message { + mi := &file_v2_container_grpc_service_proto_msgTypes[21] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SetExtendedACLResponse_Body.ProtoReflect.Descriptor instead. func (*SetExtendedACLResponse_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_364186d99410ec35, []int{9, 0} -} -func (m *SetExtendedACLResponse_Body) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *SetExtendedACLResponse_Body) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_SetExtendedACLResponse_Body.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *SetExtendedACLResponse_Body) XXX_Merge(src proto.Message) { - xxx_messageInfo_SetExtendedACLResponse_Body.Merge(m, src) -} -func (m *SetExtendedACLResponse_Body) XXX_Size() int { - return m.Size() -} -func (m *SetExtendedACLResponse_Body) XXX_DiscardUnknown() { - xxx_messageInfo_SetExtendedACLResponse_Body.DiscardUnknown(m) -} - -var xxx_messageInfo_SetExtendedACLResponse_Body proto.InternalMessageInfo - -// Get Extended ACL -type GetExtendedACLRequest struct { - // Body of get extended acl request message. - Body *GetExtendedACLRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" 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,proto3" json:"verify_header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GetExtendedACLRequest) Reset() { *m = GetExtendedACLRequest{} } -func (m *GetExtendedACLRequest) String() string { return proto.CompactTextString(m) } -func (*GetExtendedACLRequest) ProtoMessage() {} -func (*GetExtendedACLRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_364186d99410ec35, []int{10} -} -func (m *GetExtendedACLRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *GetExtendedACLRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_GetExtendedACLRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *GetExtendedACLRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetExtendedACLRequest.Merge(m, src) -} -func (m *GetExtendedACLRequest) XXX_Size() int { - return m.Size() -} -func (m *GetExtendedACLRequest) XXX_DiscardUnknown() { - xxx_messageInfo_GetExtendedACLRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_GetExtendedACLRequest proto.InternalMessageInfo - -func (m *GetExtendedACLRequest) GetBody() *GetExtendedACLRequest_Body { - if m != nil { - return m.Body - } - return nil -} - -func (m *GetExtendedACLRequest) GetMetaHeader() *grpc.RequestMetaHeader { - if m != nil { - return m.MetaHeader - } - return nil -} - -func (m *GetExtendedACLRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { - if m != nil { - return m.VerifyHeader - } - return nil + return file_v2_container_grpc_service_proto_rawDescGZIP(), []int{9, 0} } // Get Extended ACL request body type GetExtendedACLRequest_Body struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // Identifier of the container having Extended ACL - ContainerId *grpc1.ContainerID `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + ContainerId *grpc1.ContainerID `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` } -func (m *GetExtendedACLRequest_Body) Reset() { *m = GetExtendedACLRequest_Body{} } -func (m *GetExtendedACLRequest_Body) String() string { return proto.CompactTextString(m) } -func (*GetExtendedACLRequest_Body) ProtoMessage() {} +func (x *GetExtendedACLRequest_Body) Reset() { + *x = GetExtendedACLRequest_Body{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_container_grpc_service_proto_msgTypes[22] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetExtendedACLRequest_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetExtendedACLRequest_Body) ProtoMessage() {} + +func (x *GetExtendedACLRequest_Body) ProtoReflect() protoreflect.Message { + mi := &file_v2_container_grpc_service_proto_msgTypes[22] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetExtendedACLRequest_Body.ProtoReflect.Descriptor instead. func (*GetExtendedACLRequest_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_364186d99410ec35, []int{10, 0} -} -func (m *GetExtendedACLRequest_Body) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *GetExtendedACLRequest_Body) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_GetExtendedACLRequest_Body.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *GetExtendedACLRequest_Body) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetExtendedACLRequest_Body.Merge(m, src) -} -func (m *GetExtendedACLRequest_Body) XXX_Size() int { - return m.Size() -} -func (m *GetExtendedACLRequest_Body) XXX_DiscardUnknown() { - xxx_messageInfo_GetExtendedACLRequest_Body.DiscardUnknown(m) + return file_v2_container_grpc_service_proto_rawDescGZIP(), []int{10, 0} } -var xxx_messageInfo_GetExtendedACLRequest_Body proto.InternalMessageInfo - -func (m *GetExtendedACLRequest_Body) GetContainerId() *grpc1.ContainerID { - if m != nil { - return m.ContainerId - } - return nil -} - -// Get Extended ACL -type GetExtendedACLResponse struct { - // Body of get extended acl response message. - Body *GetExtendedACLResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" 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,proto3" json:"verify_header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GetExtendedACLResponse) Reset() { *m = GetExtendedACLResponse{} } -func (m *GetExtendedACLResponse) String() string { return proto.CompactTextString(m) } -func (*GetExtendedACLResponse) ProtoMessage() {} -func (*GetExtendedACLResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_364186d99410ec35, []int{11} -} -func (m *GetExtendedACLResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *GetExtendedACLResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_GetExtendedACLResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *GetExtendedACLResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetExtendedACLResponse.Merge(m, src) -} -func (m *GetExtendedACLResponse) XXX_Size() int { - return m.Size() -} -func (m *GetExtendedACLResponse) XXX_DiscardUnknown() { - xxx_messageInfo_GetExtendedACLResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_GetExtendedACLResponse proto.InternalMessageInfo - -func (m *GetExtendedACLResponse) GetBody() *GetExtendedACLResponse_Body { - if m != nil { - return m.Body - } - return nil -} - -func (m *GetExtendedACLResponse) GetMetaHeader() *grpc.ResponseMetaHeader { - if m != nil { - return m.MetaHeader - } - return nil -} - -func (m *GetExtendedACLResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { - if m != nil { - return m.VerifyHeader +func (x *GetExtendedACLRequest_Body) GetContainerId() *grpc1.ContainerID { + if x != nil { + return x.ContainerId } return nil } @@ -1436,154 +1437,794 @@ func (m *GetExtendedACLResponse) GetVerifyHeader() *grpc.ResponseVerificationHea // not have Extended ACL Table attached or Extended ACL was not allowed at // container creation. type GetExtendedACLResponse_Body struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // Extended ACL requested, if available Eacl *grpc2.EACLTable `protobuf:"bytes,1,opt,name=eacl,proto3" json:"eacl,omitempty"` // Signature of stable-marshalled Extended ACL according to RFC-6979 - Signature *grpc1.Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Signature *grpc1.Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` } -func (m *GetExtendedACLResponse_Body) Reset() { *m = GetExtendedACLResponse_Body{} } -func (m *GetExtendedACLResponse_Body) String() string { return proto.CompactTextString(m) } -func (*GetExtendedACLResponse_Body) ProtoMessage() {} -func (*GetExtendedACLResponse_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_364186d99410ec35, []int{11, 0} +func (x *GetExtendedACLResponse_Body) Reset() { + *x = GetExtendedACLResponse_Body{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_container_grpc_service_proto_msgTypes[23] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *GetExtendedACLResponse_Body) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) + +func (x *GetExtendedACLResponse_Body) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *GetExtendedACLResponse_Body) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_GetExtendedACLResponse_Body.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err + +func (*GetExtendedACLResponse_Body) ProtoMessage() {} + +func (x *GetExtendedACLResponse_Body) ProtoReflect() protoreflect.Message { + mi := &file_v2_container_grpc_service_proto_msgTypes[23] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) } - return b[:n], nil + return ms } -} -func (m *GetExtendedACLResponse_Body) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetExtendedACLResponse_Body.Merge(m, src) -} -func (m *GetExtendedACLResponse_Body) XXX_Size() int { - return m.Size() -} -func (m *GetExtendedACLResponse_Body) XXX_DiscardUnknown() { - xxx_messageInfo_GetExtendedACLResponse_Body.DiscardUnknown(m) + return mi.MessageOf(x) } -var xxx_messageInfo_GetExtendedACLResponse_Body proto.InternalMessageInfo +// Deprecated: Use GetExtendedACLResponse_Body.ProtoReflect.Descriptor instead. +func (*GetExtendedACLResponse_Body) Descriptor() ([]byte, []int) { + return file_v2_container_grpc_service_proto_rawDescGZIP(), []int{11, 0} +} -func (m *GetExtendedACLResponse_Body) GetEacl() *grpc2.EACLTable { - if m != nil { - return m.Eacl +func (x *GetExtendedACLResponse_Body) GetEacl() *grpc2.EACLTable { + if x != nil { + return x.Eacl } return nil } -func (m *GetExtendedACLResponse_Body) GetSignature() *grpc1.Signature { - if m != nil { - return m.Signature +func (x *GetExtendedACLResponse_Body) GetSignature() *grpc1.Signature { + if x != nil { + return x.Signature } return nil } -func init() { - proto.RegisterType((*PutRequest)(nil), "neo.fs.v2.container.PutRequest") - proto.RegisterType((*PutRequest_Body)(nil), "neo.fs.v2.container.PutRequest.Body") - proto.RegisterType((*PutResponse)(nil), "neo.fs.v2.container.PutResponse") - proto.RegisterType((*PutResponse_Body)(nil), "neo.fs.v2.container.PutResponse.Body") - proto.RegisterType((*DeleteRequest)(nil), "neo.fs.v2.container.DeleteRequest") - proto.RegisterType((*DeleteRequest_Body)(nil), "neo.fs.v2.container.DeleteRequest.Body") - proto.RegisterType((*DeleteResponse)(nil), "neo.fs.v2.container.DeleteResponse") - proto.RegisterType((*DeleteResponse_Body)(nil), "neo.fs.v2.container.DeleteResponse.Body") - proto.RegisterType((*GetRequest)(nil), "neo.fs.v2.container.GetRequest") - proto.RegisterType((*GetRequest_Body)(nil), "neo.fs.v2.container.GetRequest.Body") - proto.RegisterType((*GetResponse)(nil), "neo.fs.v2.container.GetResponse") - proto.RegisterType((*GetResponse_Body)(nil), "neo.fs.v2.container.GetResponse.Body") - proto.RegisterType((*ListRequest)(nil), "neo.fs.v2.container.ListRequest") - proto.RegisterType((*ListRequest_Body)(nil), "neo.fs.v2.container.ListRequest.Body") - proto.RegisterType((*ListResponse)(nil), "neo.fs.v2.container.ListResponse") - proto.RegisterType((*ListResponse_Body)(nil), "neo.fs.v2.container.ListResponse.Body") - proto.RegisterType((*SetExtendedACLRequest)(nil), "neo.fs.v2.container.SetExtendedACLRequest") - proto.RegisterType((*SetExtendedACLRequest_Body)(nil), "neo.fs.v2.container.SetExtendedACLRequest.Body") - proto.RegisterType((*SetExtendedACLResponse)(nil), "neo.fs.v2.container.SetExtendedACLResponse") - proto.RegisterType((*SetExtendedACLResponse_Body)(nil), "neo.fs.v2.container.SetExtendedACLResponse.Body") - proto.RegisterType((*GetExtendedACLRequest)(nil), "neo.fs.v2.container.GetExtendedACLRequest") - proto.RegisterType((*GetExtendedACLRequest_Body)(nil), "neo.fs.v2.container.GetExtendedACLRequest.Body") - proto.RegisterType((*GetExtendedACLResponse)(nil), "neo.fs.v2.container.GetExtendedACLResponse") - proto.RegisterType((*GetExtendedACLResponse_Body)(nil), "neo.fs.v2.container.GetExtendedACLResponse.Body") +var File_v2_container_grpc_service_proto protoreflect.FileDescriptor + +var file_v2_container_grpc_service_proto_rawDesc = []byte{ + 0x0a, 0x1f, 0x76, 0x32, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2f, 0x67, + 0x72, 0x70, 0x63, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 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, 0x17, 0x76, 0x32, 0x2f, 0x61, 0x63, 0x6c, 0x2f, 0x67, + 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, + 0x1d, 0x76, 0x32, 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, 0x1a, 0x18, + 0x76, 0x32, 0x2f, 0x72, 0x65, 0x66, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, + 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x76, 0x32, 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, 0xdf, 0x02, 0x0a, 0x0a, 0x50, 0x75, 0x74, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x38, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, + 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x75, 0x74, 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, 0x7d, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, + 0x12, 0x3c, 0x0a, 0x09, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x1e, 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, 0x52, 0x09, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x12, 0x37, + 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, + 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, + 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x22, 0xac, 0x02, 0x0a, 0x0b, 0x50, 0x75, 0x74, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 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, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x75, 0x74, 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, 0x46, + 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x3e, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, + 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x6f, + 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x61, + 0x69, 0x6e, 0x65, 0x72, 0x49, 0x64, 0x22, 0xe7, 0x02, 0x0a, 0x0d, 0x44, 0x65, 0x6c, 0x65, 0x74, + 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x3b, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, + 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x44, 0x65, 0x6c, + 0x65, 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, + 0x7f, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x3e, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x61, + 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, + 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, + 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, + 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x64, 0x12, 0x37, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, + 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, + 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, + 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, + 0x22, 0xf2, 0x01, 0x0a, 0x0e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x3c, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 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, 0x44, 0x65, 0x6c, 0x65, 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, 0x06, 0x0a, + 0x04, 0x42, 0x6f, 0x64, 0x79, 0x22, 0xa8, 0x02, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x38, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, + 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x74, 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, 0x46, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, + 0x12, 0x3e, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, + 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, + 0x72, 0x49, 0x44, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x64, + 0x22, 0xaa, 0x02, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 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, 0x63, 0x6f, 0x6e, 0x74, 0x61, + 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x74, 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, 0x44, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, + 0x3c, 0x0a, 0x09, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x1e, 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, 0x52, 0x09, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x22, 0x9e, 0x02, + 0x0a, 0x0b, 0x4c, 0x69, 0x73, 0x74, 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, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, + 0x72, 0x2e, 0x4c, 0x69, 0x73, 0x74, 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, 0xb0, + 0x02, 0x0a, 0x0c, 0x4c, 0x69, 0x73, 0x74, 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, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, + 0x6e, 0x65, 0x72, 0x2e, 0x4c, 0x69, 0x73, 0x74, 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, 0x48, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, + 0x40, 0x0a, 0x0d, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x73, + 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, + 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, + 0x72, 0x49, 0x44, 0x52, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x64, + 0x73, 0x22, 0xe5, 0x02, 0x0a, 0x15, 0x53, 0x65, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, + 0x64, 0x41, 0x43, 0x4c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x43, 0x0a, 0x04, 0x62, + 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, + 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, + 0x53, 0x65, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x41, 0x43, 0x4c, 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, 0x6d, 0x0a, 0x04, 0x42, 0x6f, + 0x64, 0x79, 0x12, 0x2c, 0x0a, 0x04, 0x65, 0x61, 0x63, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, + 0x2e, 0x45, 0x41, 0x43, 0x4c, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x52, 0x04, 0x65, 0x61, 0x63, 0x6c, + 0x12, 0x37, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, + 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, + 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x22, 0x82, 0x02, 0x0a, 0x16, 0x53, 0x65, + 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x41, 0x43, 0x4c, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x44, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x30, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, + 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x53, 0x65, 0x74, 0x45, 0x78, 0x74, 0x65, + 0x6e, 0x64, 0x65, 0x64, 0x41, 0x43, 0x4c, 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, 0x06, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x22, 0xbe, + 0x02, 0x0a, 0x15, 0x47, 0x65, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x41, 0x43, + 0x4c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x43, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, + 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x74, + 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x41, 0x43, 0x4c, 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, 0x46, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, + 0x3e, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, + 0x49, 0x44, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x64, 0x22, + 0xe9, 0x02, 0x0a, 0x16, 0x47, 0x65, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x41, + 0x43, 0x4c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x44, 0x0a, 0x04, 0x62, 0x6f, + 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x30, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x47, + 0x65, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x41, 0x43, 0x4c, 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, 0x6d, 0x0a, 0x04, + 0x42, 0x6f, 0x64, 0x79, 0x12, 0x2c, 0x0a, 0x04, 0x65, 0x61, 0x63, 0x6c, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, + 0x63, 0x6c, 0x2e, 0x45, 0x41, 0x43, 0x4c, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x52, 0x04, 0x65, 0x61, + 0x63, 0x6c, 0x12, 0x37, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, + 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x32, 0x9c, 0x04, 0x0a, 0x10, + 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x12, 0x48, 0x0a, 0x03, 0x50, 0x75, 0x74, 0x12, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, + 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x75, + 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x50, + 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x51, 0x0a, 0x06, 0x44, 0x65, + 0x6c, 0x65, 0x74, 0x65, 0x12, 0x22, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, + 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x44, + 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x48, 0x0a, + 0x03, 0x47, 0x65, 0x74, 0x12, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x74, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4b, 0x0a, 0x04, 0x4c, 0x69, 0x73, 0x74, 0x12, + 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, + 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x21, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, + 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x69, 0x0a, 0x0e, 0x53, 0x65, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, + 0x64, 0x65, 0x64, 0x41, 0x43, 0x4c, 0x12, 0x2a, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, + 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x53, 0x65, 0x74, + 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x41, 0x43, 0x4c, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x2b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, + 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x53, 0x65, 0x74, 0x45, 0x78, 0x74, 0x65, + 0x6e, 0x64, 0x65, 0x64, 0x41, 0x43, 0x4c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x69, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x41, 0x43, + 0x4c, 0x12, 0x2a, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, + 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, + 0x64, 0x65, 0x64, 0x41, 0x43, 0x4c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2b, 0x2e, + 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, + 0x6e, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x41, + 0x43, 0x4c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x58, 0x5a, 0x3d, 0x67, 0x69, + 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, + 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, + 0x76, 0x32, 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, 0x16, 0x4e, 0x65, + 0x6f, 0x46, 0x53, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x76, 0x32, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, + 0x69, 0x6e, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } -func init() { proto.RegisterFile("v2/container/grpc/service.proto", fileDescriptor_364186d99410ec35) } +var ( + file_v2_container_grpc_service_proto_rawDescOnce sync.Once + file_v2_container_grpc_service_proto_rawDescData = file_v2_container_grpc_service_proto_rawDesc +) -var fileDescriptor_364186d99410ec35 = []byte{ - // 821 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x98, 0xcf, 0x6e, 0xd3, 0x58, - 0x14, 0xc6, 0x27, 0x6e, 0xd4, 0x99, 0x9e, 0xa4, 0xd5, 0xc8, 0xa3, 0xb6, 0x99, 0x54, 0x93, 0x66, - 0x3c, 0xd3, 0x99, 0x0a, 0x1a, 0x1b, 0x99, 0x05, 0xd0, 0x16, 0x44, 0x9b, 0xb4, 0x6e, 0x44, 0x81, - 0xd6, 0x41, 0x2c, 0xd8, 0x54, 0x8e, 0x7d, 0x92, 0x5a, 0x4a, 0xec, 0xe0, 0xeb, 0xb8, 0x64, 0x81, - 0x90, 0x78, 0x0a, 0x16, 0x88, 0x35, 0xaa, 0x58, 0xf0, 0x04, 0xac, 0x59, 0xf2, 0x06, 0xa0, 0x22, - 0x84, 0xd8, 0xf2, 0x04, 0x28, 0xb6, 0xe3, 0xd8, 0x8d, 0xd3, 0xfc, 0x51, 0x84, 0xe4, 0x5d, 0x22, - 0x7f, 0xe7, 0xf8, 0x9c, 0x5f, 0xbe, 0x7b, 0xcf, 0xbd, 0x81, 0x65, 0x8b, 0xe7, 0x64, 0x5d, 0x33, - 0x25, 0x55, 0x43, 0x83, 0xab, 0x1a, 0x0d, 0x99, 0x23, 0x68, 0x58, 0xaa, 0x8c, 0x6c, 0xc3, 0xd0, - 0x4d, 0x9d, 0xfe, 0x43, 0x43, 0x9d, 0xad, 0x10, 0xd6, 0xe2, 0x59, 0x4f, 0x97, 0x5e, 0xb4, 0x78, - 0x4e, 0x92, 0x6b, 0x8e, 0xde, 0x6c, 0x35, 0x90, 0x38, 0xea, 0xf4, 0x5f, 0xbd, 0xe9, 0xfc, 0x8f, - 0x53, 0x16, 0xcf, 0x19, 0x58, 0x21, 0xbd, 0x4f, 0x96, 0x2c, 0x9e, 0x23, 0x48, 0x88, 0xaa, 0x6b, - 0x3d, 0x0f, 0x99, 0x8f, 0x14, 0xc0, 0x41, 0xd3, 0x14, 0xf1, 0x71, 0x13, 0x89, 0x49, 0x5f, 0x87, - 0x78, 0x59, 0x57, 0x5a, 0xa9, 0x58, 0x36, 0xb6, 0x9a, 0xe0, 0xff, 0x65, 0x43, 0x2a, 0x64, 0xbb, - 0x72, 0x76, 0x5b, 0x57, 0x5a, 0xa2, 0x1d, 0x41, 0xef, 0x40, 0xa2, 0x8e, 0xa6, 0x74, 0x74, 0x8c, - 0x92, 0x82, 0x46, 0x8a, 0xea, 0x49, 0xe0, 0x96, 0xc0, 0xba, 0xb1, 0x77, 0xd1, 0x94, 0xf6, 0x6c, - 0xad, 0x08, 0x75, 0xef, 0x33, 0x7d, 0x08, 0xb3, 0x16, 0x1a, 0x6a, 0xa5, 0xd5, 0x49, 0x34, 0x65, - 0x27, 0x5a, 0xeb, 0x9f, 0xe8, 0x61, 0x5b, 0xae, 0xca, 0x92, 0xa9, 0xea, 0x9a, 0x9b, 0x30, 0xe9, - 0xa4, 0x70, 0xbe, 0xa5, 0x9f, 0x42, 0xbc, 0x5d, 0x27, 0xbd, 0x09, 0x33, 0x5e, 0x13, 0x6e, 0x83, - 0x99, 0xd0, 0x06, 0xf3, 0x9d, 0x4f, 0x62, 0x37, 0x80, 0xbe, 0x06, 0x33, 0x44, 0xad, 0x6a, 0x92, - 0xd9, 0x34, 0xd0, 0xed, 0xee, 0x4f, 0x5f, 0x74, 0x1b, 0x3d, 0x5b, 0xea, 0x08, 0xc4, 0xae, 0x96, - 0x79, 0x43, 0x41, 0xc2, 0x46, 0x46, 0x1a, 0xba, 0x46, 0x90, 0xbe, 0x11, 0x40, 0xbc, 0xd2, 0x1f, - 0xb1, 0xa3, 0xf7, 0x33, 0xde, 0x0d, 0x63, 0xbc, 0x12, 0x8a, 0xc6, 0x09, 0xee, 0x03, 0x59, 0x0c, - 0x87, 0x9c, 0xbb, 0x20, 0xd3, 0x40, 0xca, 0xbb, 0x2e, 0xe5, 0x5b, 0x90, 0xf4, 0xfa, 0x38, 0x52, - 0x15, 0xb7, 0xcd, 0xa5, 0xf3, 0xa8, 0x3c, 0xc6, 0xc5, 0x82, 0x98, 0xf0, 0x02, 0x8a, 0x0a, 0xf3, - 0x95, 0x82, 0xd9, 0x02, 0xd6, 0xd0, 0xc4, 0x8e, 0x27, 0x37, 0x02, 0xc0, 0xfe, 0x0f, 0x05, 0x16, - 0x88, 0x88, 0x86, 0x2d, 0x9f, 0x4d, 0x06, 0xd8, 0xf8, 0xc6, 0xfc, 0x1e, 0x83, 0xb9, 0x0e, 0x37, - 0xd7, 0x9b, 0x9b, 0x01, 0xd4, 0xab, 0x17, 0xa2, 0x8e, 0x96, 0x3d, 0xa7, 0x1d, 0xda, 0xcc, 0x6b, - 0x0a, 0x40, 0xc0, 0x91, 0xf6, 0xbb, 0xae, 0x3c, 0x1a, 0xc6, 0x9a, 0xd4, 0x4a, 0x3c, 0xa5, 0x20, - 0x61, 0xf7, 0x3e, 0xc2, 0xc6, 0xe5, 0xd3, 0x47, 0xc5, 0x19, 0x85, 0x49, 0x8c, 0x07, 0xe6, 0x15, - 0x05, 0x89, 0x7d, 0x95, 0x78, 0xc6, 0x1a, 0x06, 0x96, 0x4f, 0x1f, 0x0d, 0x67, 0xad, 0xbb, 0xa8, - 0x78, 0xf8, 0x4d, 0x3f, 0x09, 0xb8, 0x6a, 0xf1, 0xbc, 0xab, 0xee, 0x9f, 0x38, 0x8e, 0xfa, 0xd5, - 0x16, 0x16, 0x15, 0xe6, 0x2d, 0x05, 0x49, 0xa7, 0x61, 0xd7, 0x4e, 0xeb, 0x01, 0x42, 0xff, 0x5d, - 0x40, 0x28, 0x5a, 0x7e, 0xda, 0x73, 0x21, 0xdd, 0x86, 0x59, 0xff, 0xf2, 0x23, 0xa9, 0x58, 0x76, - 0x6a, 0xd0, 0xfa, 0x4b, 0xfa, 0xd6, 0x1f, 0x61, 0xbe, 0x50, 0x30, 0x5f, 0x42, 0x73, 0xe7, 0x89, - 0x89, 0x9a, 0x82, 0xca, 0x56, 0x7e, 0xbf, 0xe3, 0xae, 0x7c, 0x80, 0x1d, 0x17, 0xca, 0x2e, 0x34, - 0x32, 0x1a, 0x3e, 0xab, 0xbb, 0x08, 0xd7, 0x20, 0x8e, 0x92, 0x5c, 0x73, 0xdb, 0x4c, 0xf9, 0x32, - 0x4a, 0x72, 0x8d, 0xdd, 0xd9, 0xca, 0xef, 0x3f, 0x90, 0xca, 0x35, 0x14, 0x6d, 0xd5, 0xf8, 0x83, - 0xf0, 0x39, 0x05, 0x0b, 0xe7, 0x69, 0xb9, 0x26, 0x2d, 0x04, 0x40, 0x5f, 0x19, 0x0a, 0x74, 0x34, - 0x07, 0xe3, 0x3b, 0x0a, 0xe6, 0x85, 0xb1, 0xcd, 0x26, 0x44, 0xd7, 0x6c, 0x93, 0x1a, 0x97, 0xdf, - 0x28, 0x58, 0x10, 0xc6, 0x77, 0x91, 0x10, 0x69, 0x17, 0xfd, 0xdc, 0x15, 0xcb, 0xbf, 0x8c, 0xc3, - 0xef, 0xde, 0x0f, 0x51, 0x72, 0x2e, 0xd5, 0xf4, 0x1e, 0x4c, 0x1d, 0x34, 0x4d, 0x7a, 0x79, 0xc0, - 0xa5, 0x35, 0x9d, 0x1d, 0x74, 0xe5, 0xa2, 0x0f, 0x61, 0xda, 0x39, 0xe5, 0xd2, 0xcc, 0xe0, 0xdb, - 0x46, 0xfa, 0x9f, 0x21, 0x8e, 0xc9, 0xed, 0xe2, 0x04, 0xec, 0x57, 0x5c, 0xf7, 0x84, 0xd9, 0xa7, - 0x38, 0xff, 0x31, 0xec, 0x0e, 0xc4, 0xdb, 0x63, 0x91, 0xce, 0x0e, 0x3a, 0x53, 0xa4, 0xff, 0x1e, - 0x38, 0x53, 0x69, 0x15, 0xe6, 0x82, 0xdb, 0x17, 0x7d, 0x69, 0xf8, 0x61, 0x92, 0xbe, 0x3c, 0xc2, - 0x7e, 0xd8, 0x7e, 0x95, 0x30, 0xcc, 0xab, 0x84, 0x11, 0x5e, 0x15, 0xbe, 0x68, 0xb6, 0x8f, 0xdf, - 0x9f, 0x65, 0x62, 0x1f, 0xce, 0x32, 0xb1, 0x4f, 0x67, 0x99, 0xd8, 0x8b, 0xcf, 0x99, 0x5f, 0x1e, - 0xdd, 0xac, 0xaa, 0xe6, 0x71, 0xb3, 0xcc, 0xca, 0x7a, 0x9d, 0xd3, 0x48, 0x43, 0x96, 0x73, 0x0a, - 0x5a, 0x9c, 0x86, 0x7a, 0x85, 0xe4, 0xa4, 0x86, 0x9a, 0xab, 0xea, 0x5c, 0xcf, 0xdf, 0x2b, 0x1b, - 0xde, 0xd7, 0x53, 0x6a, 0xe1, 0x1e, 0xea, 0xbb, 0x25, 0x76, 0xeb, 0xa0, 0xd8, 0x2e, 0xc0, 0xb3, - 0x5e, 0x79, 0xda, 0xfe, 0x17, 0xe5, 0xea, 0x8f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xa1, 0x09, 0xe6, - 0xa5, 0xec, 0x11, 0x00, 0x00, +func file_v2_container_grpc_service_proto_rawDescGZIP() []byte { + file_v2_container_grpc_service_proto_rawDescOnce.Do(func() { + file_v2_container_grpc_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_v2_container_grpc_service_proto_rawDescData) + }) + return file_v2_container_grpc_service_proto_rawDescData +} + +var file_v2_container_grpc_service_proto_msgTypes = make([]protoimpl.MessageInfo, 24) +var file_v2_container_grpc_service_proto_goTypes = []interface{}{ + (*PutRequest)(nil), // 0: neo.fs.v2.container.PutRequest + (*PutResponse)(nil), // 1: neo.fs.v2.container.PutResponse + (*DeleteRequest)(nil), // 2: neo.fs.v2.container.DeleteRequest + (*DeleteResponse)(nil), // 3: neo.fs.v2.container.DeleteResponse + (*GetRequest)(nil), // 4: neo.fs.v2.container.GetRequest + (*GetResponse)(nil), // 5: neo.fs.v2.container.GetResponse + (*ListRequest)(nil), // 6: neo.fs.v2.container.ListRequest + (*ListResponse)(nil), // 7: neo.fs.v2.container.ListResponse + (*SetExtendedACLRequest)(nil), // 8: neo.fs.v2.container.SetExtendedACLRequest + (*SetExtendedACLResponse)(nil), // 9: neo.fs.v2.container.SetExtendedACLResponse + (*GetExtendedACLRequest)(nil), // 10: neo.fs.v2.container.GetExtendedACLRequest + (*GetExtendedACLResponse)(nil), // 11: neo.fs.v2.container.GetExtendedACLResponse + (*PutRequest_Body)(nil), // 12: neo.fs.v2.container.PutRequest.Body + (*PutResponse_Body)(nil), // 13: neo.fs.v2.container.PutResponse.Body + (*DeleteRequest_Body)(nil), // 14: neo.fs.v2.container.DeleteRequest.Body + (*DeleteResponse_Body)(nil), // 15: neo.fs.v2.container.DeleteResponse.Body + (*GetRequest_Body)(nil), // 16: neo.fs.v2.container.GetRequest.Body + (*GetResponse_Body)(nil), // 17: neo.fs.v2.container.GetResponse.Body + (*ListRequest_Body)(nil), // 18: neo.fs.v2.container.ListRequest.Body + (*ListResponse_Body)(nil), // 19: neo.fs.v2.container.ListResponse.Body + (*SetExtendedACLRequest_Body)(nil), // 20: neo.fs.v2.container.SetExtendedACLRequest.Body + (*SetExtendedACLResponse_Body)(nil), // 21: neo.fs.v2.container.SetExtendedACLResponse.Body + (*GetExtendedACLRequest_Body)(nil), // 22: neo.fs.v2.container.GetExtendedACLRequest.Body + (*GetExtendedACLResponse_Body)(nil), // 23: neo.fs.v2.container.GetExtendedACLResponse.Body + (*grpc.RequestMetaHeader)(nil), // 24: neo.fs.v2.session.RequestMetaHeader + (*grpc.RequestVerificationHeader)(nil), // 25: neo.fs.v2.session.RequestVerificationHeader + (*grpc.ResponseMetaHeader)(nil), // 26: neo.fs.v2.session.ResponseMetaHeader + (*grpc.ResponseVerificationHeader)(nil), // 27: neo.fs.v2.session.ResponseVerificationHeader + (*Container)(nil), // 28: neo.fs.v2.container.Container + (*grpc1.Signature)(nil), // 29: neo.fs.v2.refs.Signature + (*grpc1.ContainerID)(nil), // 30: neo.fs.v2.refs.ContainerID + (*grpc1.OwnerID)(nil), // 31: neo.fs.v2.refs.OwnerID + (*grpc2.EACLTable)(nil), // 32: neo.fs.v2.acl.EACLTable +} +var file_v2_container_grpc_service_proto_depIdxs = []int32{ + 12, // 0: neo.fs.v2.container.PutRequest.body:type_name -> neo.fs.v2.container.PutRequest.Body + 24, // 1: neo.fs.v2.container.PutRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader + 25, // 2: neo.fs.v2.container.PutRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader + 13, // 3: neo.fs.v2.container.PutResponse.body:type_name -> neo.fs.v2.container.PutResponse.Body + 26, // 4: neo.fs.v2.container.PutResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader + 27, // 5: neo.fs.v2.container.PutResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 14, // 6: neo.fs.v2.container.DeleteRequest.body:type_name -> neo.fs.v2.container.DeleteRequest.Body + 24, // 7: neo.fs.v2.container.DeleteRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader + 25, // 8: neo.fs.v2.container.DeleteRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader + 15, // 9: neo.fs.v2.container.DeleteResponse.body:type_name -> neo.fs.v2.container.DeleteResponse.Body + 26, // 10: neo.fs.v2.container.DeleteResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader + 27, // 11: neo.fs.v2.container.DeleteResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 16, // 12: neo.fs.v2.container.GetRequest.body:type_name -> neo.fs.v2.container.GetRequest.Body + 24, // 13: neo.fs.v2.container.GetRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader + 25, // 14: neo.fs.v2.container.GetRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader + 17, // 15: neo.fs.v2.container.GetResponse.body:type_name -> neo.fs.v2.container.GetResponse.Body + 26, // 16: neo.fs.v2.container.GetResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader + 27, // 17: neo.fs.v2.container.GetResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 18, // 18: neo.fs.v2.container.ListRequest.body:type_name -> neo.fs.v2.container.ListRequest.Body + 24, // 19: neo.fs.v2.container.ListRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader + 25, // 20: neo.fs.v2.container.ListRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader + 19, // 21: neo.fs.v2.container.ListResponse.body:type_name -> neo.fs.v2.container.ListResponse.Body + 26, // 22: neo.fs.v2.container.ListResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader + 27, // 23: neo.fs.v2.container.ListResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 20, // 24: neo.fs.v2.container.SetExtendedACLRequest.body:type_name -> neo.fs.v2.container.SetExtendedACLRequest.Body + 24, // 25: neo.fs.v2.container.SetExtendedACLRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader + 25, // 26: neo.fs.v2.container.SetExtendedACLRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader + 21, // 27: neo.fs.v2.container.SetExtendedACLResponse.body:type_name -> neo.fs.v2.container.SetExtendedACLResponse.Body + 26, // 28: neo.fs.v2.container.SetExtendedACLResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader + 27, // 29: neo.fs.v2.container.SetExtendedACLResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 22, // 30: neo.fs.v2.container.GetExtendedACLRequest.body:type_name -> neo.fs.v2.container.GetExtendedACLRequest.Body + 24, // 31: neo.fs.v2.container.GetExtendedACLRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader + 25, // 32: neo.fs.v2.container.GetExtendedACLRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader + 23, // 33: neo.fs.v2.container.GetExtendedACLResponse.body:type_name -> neo.fs.v2.container.GetExtendedACLResponse.Body + 26, // 34: neo.fs.v2.container.GetExtendedACLResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader + 27, // 35: neo.fs.v2.container.GetExtendedACLResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 28, // 36: neo.fs.v2.container.PutRequest.Body.container:type_name -> neo.fs.v2.container.Container + 29, // 37: neo.fs.v2.container.PutRequest.Body.signature:type_name -> neo.fs.v2.refs.Signature + 30, // 38: neo.fs.v2.container.PutResponse.Body.container_id:type_name -> neo.fs.v2.refs.ContainerID + 30, // 39: neo.fs.v2.container.DeleteRequest.Body.container_id:type_name -> neo.fs.v2.refs.ContainerID + 29, // 40: neo.fs.v2.container.DeleteRequest.Body.signature:type_name -> neo.fs.v2.refs.Signature + 30, // 41: neo.fs.v2.container.GetRequest.Body.container_id:type_name -> neo.fs.v2.refs.ContainerID + 28, // 42: neo.fs.v2.container.GetResponse.Body.container:type_name -> neo.fs.v2.container.Container + 31, // 43: neo.fs.v2.container.ListRequest.Body.owner_id:type_name -> neo.fs.v2.refs.OwnerID + 30, // 44: neo.fs.v2.container.ListResponse.Body.container_ids:type_name -> neo.fs.v2.refs.ContainerID + 32, // 45: neo.fs.v2.container.SetExtendedACLRequest.Body.eacl:type_name -> neo.fs.v2.acl.EACLTable + 29, // 46: neo.fs.v2.container.SetExtendedACLRequest.Body.signature:type_name -> neo.fs.v2.refs.Signature + 30, // 47: neo.fs.v2.container.GetExtendedACLRequest.Body.container_id:type_name -> neo.fs.v2.refs.ContainerID + 32, // 48: neo.fs.v2.container.GetExtendedACLResponse.Body.eacl:type_name -> neo.fs.v2.acl.EACLTable + 29, // 49: neo.fs.v2.container.GetExtendedACLResponse.Body.signature:type_name -> neo.fs.v2.refs.Signature + 0, // 50: neo.fs.v2.container.ContainerService.Put:input_type -> neo.fs.v2.container.PutRequest + 2, // 51: neo.fs.v2.container.ContainerService.Delete:input_type -> neo.fs.v2.container.DeleteRequest + 4, // 52: neo.fs.v2.container.ContainerService.Get:input_type -> neo.fs.v2.container.GetRequest + 6, // 53: neo.fs.v2.container.ContainerService.List:input_type -> neo.fs.v2.container.ListRequest + 8, // 54: neo.fs.v2.container.ContainerService.SetExtendedACL:input_type -> neo.fs.v2.container.SetExtendedACLRequest + 10, // 55: neo.fs.v2.container.ContainerService.GetExtendedACL:input_type -> neo.fs.v2.container.GetExtendedACLRequest + 1, // 56: neo.fs.v2.container.ContainerService.Put:output_type -> neo.fs.v2.container.PutResponse + 3, // 57: neo.fs.v2.container.ContainerService.Delete:output_type -> neo.fs.v2.container.DeleteResponse + 5, // 58: neo.fs.v2.container.ContainerService.Get:output_type -> neo.fs.v2.container.GetResponse + 7, // 59: neo.fs.v2.container.ContainerService.List:output_type -> neo.fs.v2.container.ListResponse + 9, // 60: neo.fs.v2.container.ContainerService.SetExtendedACL:output_type -> neo.fs.v2.container.SetExtendedACLResponse + 11, // 61: neo.fs.v2.container.ContainerService.GetExtendedACL:output_type -> neo.fs.v2.container.GetExtendedACLResponse + 56, // [56:62] is the sub-list for method output_type + 50, // [50:56] is the sub-list for method input_type + 50, // [50:50] is the sub-list for extension type_name + 50, // [50:50] is the sub-list for extension extendee + 0, // [0:50] is the sub-list for field type_name +} + +func init() { file_v2_container_grpc_service_proto_init() } +func file_v2_container_grpc_service_proto_init() { + if File_v2_container_grpc_service_proto != nil { + return + } + file_v2_container_grpc_types_proto_init() + if !protoimpl.UnsafeEnabled { + file_v2_container_grpc_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PutRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_container_grpc_service_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PutResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_container_grpc_service_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_container_grpc_service_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_container_grpc_service_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_container_grpc_service_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_container_grpc_service_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_container_grpc_service_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_container_grpc_service_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SetExtendedACLRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_container_grpc_service_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SetExtendedACLResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_container_grpc_service_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetExtendedACLRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_container_grpc_service_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetExtendedACLResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_container_grpc_service_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PutRequest_Body); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_container_grpc_service_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PutResponse_Body); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_container_grpc_service_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteRequest_Body); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_container_grpc_service_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteResponse_Body); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_container_grpc_service_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetRequest_Body); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_container_grpc_service_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetResponse_Body); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_container_grpc_service_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListRequest_Body); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_container_grpc_service_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListResponse_Body); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_container_grpc_service_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SetExtendedACLRequest_Body); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_container_grpc_service_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SetExtendedACLResponse_Body); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_container_grpc_service_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetExtendedACLRequest_Body); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_container_grpc_service_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetExtendedACLResponse_Body); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_v2_container_grpc_service_proto_rawDesc, + NumEnums: 0, + NumMessages: 24, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_v2_container_grpc_service_proto_goTypes, + DependencyIndexes: file_v2_container_grpc_service_proto_depIdxs, + MessageInfos: file_v2_container_grpc_service_proto_msgTypes, + }.Build() + File_v2_container_grpc_service_proto = out.File + file_v2_container_grpc_service_proto_rawDesc = nil + file_v2_container_grpc_service_proto_goTypes = nil + file_v2_container_grpc_service_proto_depIdxs = nil } // Reference imports to suppress errors if they are not otherwise used. var _ context.Context -var _ grpc3.ClientConn +var _ grpc3.ClientConnInterface // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -const _ = grpc3.SupportPackageIsVersion4 +const _ = grpc3.SupportPackageIsVersion6 // ContainerServiceClient is the client API for ContainerService service. // @@ -1613,10 +2254,10 @@ type ContainerServiceClient interface { } type containerServiceClient struct { - cc *grpc3.ClientConn + cc grpc3.ClientConnInterface } -func NewContainerServiceClient(cc *grpc3.ClientConn) ContainerServiceClient { +func NewContainerServiceClient(cc grpc3.ClientConnInterface) ContainerServiceClient { return &containerServiceClient{cc} } @@ -1703,22 +2344,22 @@ type ContainerServiceServer interface { type UnimplementedContainerServiceServer struct { } -func (*UnimplementedContainerServiceServer) Put(ctx context.Context, req *PutRequest) (*PutResponse, error) { +func (*UnimplementedContainerServiceServer) Put(context.Context, *PutRequest) (*PutResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Put not implemented") } -func (*UnimplementedContainerServiceServer) Delete(ctx context.Context, req *DeleteRequest) (*DeleteResponse, error) { +func (*UnimplementedContainerServiceServer) Delete(context.Context, *DeleteRequest) (*DeleteResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Delete not implemented") } -func (*UnimplementedContainerServiceServer) Get(ctx context.Context, req *GetRequest) (*GetResponse, error) { +func (*UnimplementedContainerServiceServer) Get(context.Context, *GetRequest) (*GetResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Get not implemented") } -func (*UnimplementedContainerServiceServer) List(ctx context.Context, req *ListRequest) (*ListResponse, error) { +func (*UnimplementedContainerServiceServer) List(context.Context, *ListRequest) (*ListResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method List not implemented") } -func (*UnimplementedContainerServiceServer) SetExtendedACL(ctx context.Context, req *SetExtendedACLRequest) (*SetExtendedACLResponse, error) { +func (*UnimplementedContainerServiceServer) SetExtendedACL(context.Context, *SetExtendedACLRequest) (*SetExtendedACLResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method SetExtendedACL not implemented") } -func (*UnimplementedContainerServiceServer) GetExtendedACL(ctx context.Context, req *GetExtendedACLRequest) (*GetExtendedACLResponse, error) { +func (*UnimplementedContainerServiceServer) GetExtendedACL(context.Context, *GetExtendedACLRequest) (*GetExtendedACLResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method GetExtendedACL not implemented") } @@ -1866,4939 +2507,3 @@ var _ContainerService_serviceDesc = grpc3.ServiceDesc{ Streams: []grpc3.StreamDesc{}, Metadata: "v2/container/grpc/service.proto", } - -func (m *PutRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *PutRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *PutRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.VerifyHeader != nil { - { - size, err := m.VerifyHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if m.MetaHeader != nil { - { - size, err := m.MetaHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.Body != nil { - { - size, err := m.Body.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *PutRequest_Body) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *PutRequest_Body) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *PutRequest_Body) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.Signature != nil { - { - size, err := m.Signature.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.Container != nil { - { - size, err := m.Container.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *PutResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *PutResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *PutResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.VerifyHeader != nil { - { - size, err := m.VerifyHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if m.MetaHeader != nil { - { - size, err := m.MetaHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.Body != nil { - { - size, err := m.Body.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *PutResponse_Body) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *PutResponse_Body) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *PutResponse_Body) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.ContainerId != nil { - { - size, err := m.ContainerId.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *DeleteRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *DeleteRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *DeleteRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.VerifyHeader != nil { - { - size, err := m.VerifyHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if m.MetaHeader != nil { - { - size, err := m.MetaHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.Body != nil { - { - size, err := m.Body.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *DeleteRequest_Body) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *DeleteRequest_Body) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *DeleteRequest_Body) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.Signature != nil { - { - size, err := m.Signature.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.ContainerId != nil { - { - size, err := m.ContainerId.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *DeleteResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *DeleteResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *DeleteResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.VerifyHeader != nil { - { - size, err := m.VerifyHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if m.MetaHeader != nil { - { - size, err := m.MetaHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.Body != nil { - { - size, err := m.Body.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *DeleteResponse_Body) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *DeleteResponse_Body) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *DeleteResponse_Body) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - return len(dAtA) - i, nil -} - -func (m *GetRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *GetRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *GetRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.VerifyHeader != nil { - { - size, err := m.VerifyHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if m.MetaHeader != nil { - { - size, err := m.MetaHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.Body != nil { - { - size, err := m.Body.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *GetRequest_Body) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *GetRequest_Body) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *GetRequest_Body) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.ContainerId != nil { - { - size, err := m.ContainerId.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *GetResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *GetResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *GetResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.VerifyHeader != nil { - { - size, err := m.VerifyHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if m.MetaHeader != nil { - { - size, err := m.MetaHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.Body != nil { - { - size, err := m.Body.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *GetResponse_Body) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *GetResponse_Body) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *GetResponse_Body) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.Container != nil { - { - size, err := m.Container.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *ListRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ListRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ListRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.VerifyHeader != nil { - { - size, err := m.VerifyHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if m.MetaHeader != nil { - { - size, err := m.MetaHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.Body != nil { - { - size, err := m.Body.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *ListRequest_Body) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ListRequest_Body) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ListRequest_Body) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.OwnerId != nil { - { - size, err := m.OwnerId.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *ListResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ListResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ListResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.VerifyHeader != nil { - { - size, err := m.VerifyHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if m.MetaHeader != nil { - { - size, err := m.MetaHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.Body != nil { - { - size, err := m.Body.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *ListResponse_Body) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ListResponse_Body) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ListResponse_Body) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.ContainerIds) > 0 { - for iNdEx := len(m.ContainerIds) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.ContainerIds[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *SetExtendedACLRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *SetExtendedACLRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *SetExtendedACLRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.VerifyHeader != nil { - { - size, err := m.VerifyHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if m.MetaHeader != nil { - { - size, err := m.MetaHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.Body != nil { - { - size, err := m.Body.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *SetExtendedACLRequest_Body) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *SetExtendedACLRequest_Body) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *SetExtendedACLRequest_Body) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.Signature != nil { - { - size, err := m.Signature.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.Eacl != nil { - { - size, err := m.Eacl.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *SetExtendedACLResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *SetExtendedACLResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *SetExtendedACLResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.VerifyHeader != nil { - { - size, err := m.VerifyHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if m.MetaHeader != nil { - { - size, err := m.MetaHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.Body != nil { - { - size, err := m.Body.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *SetExtendedACLResponse_Body) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *SetExtendedACLResponse_Body) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *SetExtendedACLResponse_Body) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - return len(dAtA) - i, nil -} - -func (m *GetExtendedACLRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *GetExtendedACLRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *GetExtendedACLRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.VerifyHeader != nil { - { - size, err := m.VerifyHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if m.MetaHeader != nil { - { - size, err := m.MetaHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.Body != nil { - { - size, err := m.Body.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *GetExtendedACLRequest_Body) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *GetExtendedACLRequest_Body) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *GetExtendedACLRequest_Body) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.ContainerId != nil { - { - size, err := m.ContainerId.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *GetExtendedACLResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *GetExtendedACLResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *GetExtendedACLResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.VerifyHeader != nil { - { - size, err := m.VerifyHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if m.MetaHeader != nil { - { - size, err := m.MetaHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.Body != nil { - { - size, err := m.Body.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *GetExtendedACLResponse_Body) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *GetExtendedACLResponse_Body) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *GetExtendedACLResponse_Body) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.Signature != nil { - { - size, err := m.Signature.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.Eacl != nil { - { - size, err := m.Eacl.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func encodeVarintService(dAtA []byte, offset int, v uint64) int { - offset -= sovService(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *PutRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Body != nil { - l = m.Body.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.MetaHeader != nil { - l = m.MetaHeader.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.VerifyHeader != nil { - l = m.VerifyHeader.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *PutRequest_Body) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Container != nil { - l = m.Container.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.Signature != nil { - l = m.Signature.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *PutResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Body != nil { - l = m.Body.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.MetaHeader != nil { - l = m.MetaHeader.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.VerifyHeader != nil { - l = m.VerifyHeader.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *PutResponse_Body) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ContainerId != nil { - l = m.ContainerId.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *DeleteRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Body != nil { - l = m.Body.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.MetaHeader != nil { - l = m.MetaHeader.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.VerifyHeader != nil { - l = m.VerifyHeader.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *DeleteRequest_Body) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ContainerId != nil { - l = m.ContainerId.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.Signature != nil { - l = m.Signature.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *DeleteResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Body != nil { - l = m.Body.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.MetaHeader != nil { - l = m.MetaHeader.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.VerifyHeader != nil { - l = m.VerifyHeader.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *DeleteResponse_Body) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *GetRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Body != nil { - l = m.Body.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.MetaHeader != nil { - l = m.MetaHeader.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.VerifyHeader != nil { - l = m.VerifyHeader.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *GetRequest_Body) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ContainerId != nil { - l = m.ContainerId.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *GetResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Body != nil { - l = m.Body.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.MetaHeader != nil { - l = m.MetaHeader.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.VerifyHeader != nil { - l = m.VerifyHeader.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *GetResponse_Body) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Container != nil { - l = m.Container.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *ListRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Body != nil { - l = m.Body.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.MetaHeader != nil { - l = m.MetaHeader.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.VerifyHeader != nil { - l = m.VerifyHeader.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *ListRequest_Body) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.OwnerId != nil { - l = m.OwnerId.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *ListResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Body != nil { - l = m.Body.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.MetaHeader != nil { - l = m.MetaHeader.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.VerifyHeader != nil { - l = m.VerifyHeader.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *ListResponse_Body) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.ContainerIds) > 0 { - for _, e := range m.ContainerIds { - l = e.Size() - n += 1 + l + sovService(uint64(l)) - } - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *SetExtendedACLRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Body != nil { - l = m.Body.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.MetaHeader != nil { - l = m.MetaHeader.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.VerifyHeader != nil { - l = m.VerifyHeader.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *SetExtendedACLRequest_Body) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Eacl != nil { - l = m.Eacl.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.Signature != nil { - l = m.Signature.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *SetExtendedACLResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Body != nil { - l = m.Body.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.MetaHeader != nil { - l = m.MetaHeader.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.VerifyHeader != nil { - l = m.VerifyHeader.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *SetExtendedACLResponse_Body) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *GetExtendedACLRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Body != nil { - l = m.Body.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.MetaHeader != nil { - l = m.MetaHeader.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.VerifyHeader != nil { - l = m.VerifyHeader.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *GetExtendedACLRequest_Body) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ContainerId != nil { - l = m.ContainerId.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *GetExtendedACLResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Body != nil { - l = m.Body.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.MetaHeader != nil { - l = m.MetaHeader.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.VerifyHeader != nil { - l = m.VerifyHeader.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *GetExtendedACLResponse_Body) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Eacl != nil { - l = m.Eacl.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.Signature != nil { - l = m.Signature.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func sovService(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozService(x uint64) (n int) { - return sovService(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *PutRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: PutRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: PutRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Body", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Body == nil { - m.Body = &PutRequest_Body{} - } - if err := m.Body.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MetaHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.MetaHeader == nil { - m.MetaHeader = &grpc.RequestMetaHeader{} - } - if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field VerifyHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.VerifyHeader == nil { - m.VerifyHeader = &grpc.RequestVerificationHeader{} - } - if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *PutRequest_Body) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Body: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Body: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Container", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Container == nil { - m.Container = &Container{} - } - if err := m.Container.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Signature", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Signature == nil { - m.Signature = &grpc1.Signature{} - } - if err := m.Signature.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *PutResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: PutResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: PutResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Body", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Body == nil { - m.Body = &PutResponse_Body{} - } - if err := m.Body.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MetaHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.MetaHeader == nil { - m.MetaHeader = &grpc.ResponseMetaHeader{} - } - if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field VerifyHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.VerifyHeader == nil { - m.VerifyHeader = &grpc.ResponseVerificationHeader{} - } - if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *PutResponse_Body) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Body: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Body: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ContainerId", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.ContainerId == nil { - m.ContainerId = &grpc1.ContainerID{} - } - if err := m.ContainerId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *DeleteRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: DeleteRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: DeleteRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Body", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Body == nil { - m.Body = &DeleteRequest_Body{} - } - if err := m.Body.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MetaHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.MetaHeader == nil { - m.MetaHeader = &grpc.RequestMetaHeader{} - } - if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field VerifyHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.VerifyHeader == nil { - m.VerifyHeader = &grpc.RequestVerificationHeader{} - } - if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *DeleteRequest_Body) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Body: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Body: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ContainerId", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.ContainerId == nil { - m.ContainerId = &grpc1.ContainerID{} - } - if err := m.ContainerId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Signature", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Signature == nil { - m.Signature = &grpc1.Signature{} - } - if err := m.Signature.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *DeleteResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: DeleteResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: DeleteResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Body", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Body == nil { - m.Body = &DeleteResponse_Body{} - } - if err := m.Body.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MetaHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.MetaHeader == nil { - m.MetaHeader = &grpc.ResponseMetaHeader{} - } - if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field VerifyHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.VerifyHeader == nil { - m.VerifyHeader = &grpc.ResponseVerificationHeader{} - } - if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *DeleteResponse_Body) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Body: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Body: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *GetRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: GetRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GetRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Body", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Body == nil { - m.Body = &GetRequest_Body{} - } - if err := m.Body.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MetaHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.MetaHeader == nil { - m.MetaHeader = &grpc.RequestMetaHeader{} - } - if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field VerifyHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.VerifyHeader == nil { - m.VerifyHeader = &grpc.RequestVerificationHeader{} - } - if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *GetRequest_Body) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Body: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Body: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ContainerId", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.ContainerId == nil { - m.ContainerId = &grpc1.ContainerID{} - } - if err := m.ContainerId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *GetResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: GetResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GetResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Body", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Body == nil { - m.Body = &GetResponse_Body{} - } - if err := m.Body.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MetaHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.MetaHeader == nil { - m.MetaHeader = &grpc.ResponseMetaHeader{} - } - if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field VerifyHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.VerifyHeader == nil { - m.VerifyHeader = &grpc.ResponseVerificationHeader{} - } - if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *GetResponse_Body) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Body: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Body: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Container", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Container == nil { - m.Container = &Container{} - } - if err := m.Container.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ListRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ListRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ListRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Body", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Body == nil { - m.Body = &ListRequest_Body{} - } - if err := m.Body.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MetaHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.MetaHeader == nil { - m.MetaHeader = &grpc.RequestMetaHeader{} - } - if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field VerifyHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.VerifyHeader == nil { - m.VerifyHeader = &grpc.RequestVerificationHeader{} - } - if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ListRequest_Body) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Body: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Body: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OwnerId", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.OwnerId == nil { - m.OwnerId = &grpc1.OwnerID{} - } - if err := m.OwnerId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ListResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ListResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ListResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Body", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Body == nil { - m.Body = &ListResponse_Body{} - } - if err := m.Body.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MetaHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.MetaHeader == nil { - m.MetaHeader = &grpc.ResponseMetaHeader{} - } - if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field VerifyHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.VerifyHeader == nil { - m.VerifyHeader = &grpc.ResponseVerificationHeader{} - } - if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ListResponse_Body) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Body: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Body: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ContainerIds", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ContainerIds = append(m.ContainerIds, &grpc1.ContainerID{}) - if err := m.ContainerIds[len(m.ContainerIds)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *SetExtendedACLRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: SetExtendedACLRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: SetExtendedACLRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Body", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Body == nil { - m.Body = &SetExtendedACLRequest_Body{} - } - if err := m.Body.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MetaHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.MetaHeader == nil { - m.MetaHeader = &grpc.RequestMetaHeader{} - } - if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field VerifyHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.VerifyHeader == nil { - m.VerifyHeader = &grpc.RequestVerificationHeader{} - } - if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *SetExtendedACLRequest_Body) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Body: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Body: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Eacl", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Eacl == nil { - m.Eacl = &grpc2.EACLTable{} - } - if err := m.Eacl.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Signature", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Signature == nil { - m.Signature = &grpc1.Signature{} - } - if err := m.Signature.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *SetExtendedACLResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: SetExtendedACLResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: SetExtendedACLResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Body", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Body == nil { - m.Body = &SetExtendedACLResponse_Body{} - } - if err := m.Body.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MetaHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.MetaHeader == nil { - m.MetaHeader = &grpc.ResponseMetaHeader{} - } - if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field VerifyHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.VerifyHeader == nil { - m.VerifyHeader = &grpc.ResponseVerificationHeader{} - } - if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *SetExtendedACLResponse_Body) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Body: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Body: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *GetExtendedACLRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: GetExtendedACLRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GetExtendedACLRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Body", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Body == nil { - m.Body = &GetExtendedACLRequest_Body{} - } - if err := m.Body.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MetaHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.MetaHeader == nil { - m.MetaHeader = &grpc.RequestMetaHeader{} - } - if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field VerifyHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.VerifyHeader == nil { - m.VerifyHeader = &grpc.RequestVerificationHeader{} - } - if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *GetExtendedACLRequest_Body) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Body: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Body: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ContainerId", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.ContainerId == nil { - m.ContainerId = &grpc1.ContainerID{} - } - if err := m.ContainerId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *GetExtendedACLResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: GetExtendedACLResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GetExtendedACLResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Body", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Body == nil { - m.Body = &GetExtendedACLResponse_Body{} - } - if err := m.Body.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MetaHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.MetaHeader == nil { - m.MetaHeader = &grpc.ResponseMetaHeader{} - } - if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field VerifyHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.VerifyHeader == nil { - m.VerifyHeader = &grpc.ResponseVerificationHeader{} - } - if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *GetExtendedACLResponse_Body) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Body: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Body: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Eacl", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Eacl == nil { - m.Eacl = &grpc2.EACLTable{} - } - if err := m.Eacl.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Signature", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Signature == nil { - m.Signature = &grpc1.Signature{} - } - if err := m.Signature.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipService(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowService - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowService - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowService - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthService - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupService - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthService - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthService = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowService = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupService = fmt.Errorf("proto: unexpected end of group") -) diff --git a/v2/container/grpc/types.pb.go b/v2/container/grpc/types.pb.go index 1ad1b75..28c23cf 100644 --- a/v2/container/grpc/types.pb.go +++ b/v2/container/grpc/types.pb.go @@ -1,34 +1,41 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.23.0 +// protoc v3.13.0 // source: v2/container/grpc/types.proto package container import ( - fmt "fmt" proto "github.com/golang/protobuf/proto" grpc1 "github.com/nspcc-dev/neofs-api-go/v2/netmap/grpc" grpc "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" - io "io" - math "math" - math_bits "math/bits" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +// This is a compile-time assertion that a sufficiently up-to-date version +// of the legacy proto package is being used. +const _ = proto.ProtoPackageIsVersion4 // 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. ID of the container is a 32 byte long SHA256 hash // of stable-marshalled container message. type Container struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // Container format version. Effectively the version of API library used to // create container. Version *grpc.Version `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` @@ -42,83 +49,79 @@ type Container struct { // Attributes represent immutable container's meta data Attributes []*Container_Attribute `protobuf:"bytes,5,rep,name=attributes,proto3" json:"attributes,omitempty"` // Placement policy for the object inside the container - PlacementPolicy *grpc1.PlacementPolicy `protobuf:"bytes,6,opt,name=placement_policy,json=placementPolicy,proto3" json:"placement_policy,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + PlacementPolicy *grpc1.PlacementPolicy `protobuf:"bytes,6,opt,name=placement_policy,json=placementPolicy,proto3" json:"placement_policy,omitempty"` } -func (m *Container) Reset() { *m = Container{} } -func (m *Container) String() string { return proto.CompactTextString(m) } -func (*Container) ProtoMessage() {} -func (*Container) Descriptor() ([]byte, []int) { - return fileDescriptor_3bfd95a81c72c35c, []int{0} +func (x *Container) Reset() { + *x = Container{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_container_grpc_types_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *Container) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) + +func (x *Container) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *Container) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Container.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err + +func (*Container) ProtoMessage() {} + +func (x *Container) ProtoReflect() protoreflect.Message { + mi := &file_v2_container_grpc_types_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) } - return b[:n], nil + return ms } -} -func (m *Container) XXX_Merge(src proto.Message) { - xxx_messageInfo_Container.Merge(m, src) -} -func (m *Container) XXX_Size() int { - return m.Size() -} -func (m *Container) XXX_DiscardUnknown() { - xxx_messageInfo_Container.DiscardUnknown(m) + return mi.MessageOf(x) } -var xxx_messageInfo_Container proto.InternalMessageInfo +// Deprecated: Use Container.ProtoReflect.Descriptor instead. +func (*Container) Descriptor() ([]byte, []int) { + return file_v2_container_grpc_types_proto_rawDescGZIP(), []int{0} +} -func (m *Container) GetVersion() *grpc.Version { - if m != nil { - return m.Version +func (x *Container) GetVersion() *grpc.Version { + if x != nil { + return x.Version } return nil } -func (m *Container) GetOwnerId() *grpc.OwnerID { - if m != nil { - return m.OwnerId +func (x *Container) GetOwnerId() *grpc.OwnerID { + if x != nil { + return x.OwnerId } return nil } -func (m *Container) GetNonce() []byte { - if m != nil { - return m.Nonce +func (x *Container) GetNonce() []byte { + if x != nil { + return x.Nonce } return nil } -func (m *Container) GetBasicAcl() uint32 { - if m != nil { - return m.BasicAcl +func (x *Container) GetBasicAcl() uint32 { + if x != nil { + return x.BasicAcl } return 0 } -func (m *Container) GetAttributes() []*Container_Attribute { - if m != nil { - return m.Attributes +func (x *Container) GetAttributes() []*Container_Attribute { + if x != nil { + return x.Attributes } return nil } -func (m *Container) GetPlacementPolicy() *grpc1.PlacementPolicy { - if m != nil { - return m.PlacementPolicy +func (x *Container) GetPlacementPolicy() *grpc1.PlacementPolicy { + if x != nil { + return x.PlacementPolicy } return nil } @@ -133,749 +136,183 @@ func (m *Container) GetPlacementPolicy() *grpc1.PlacementPolicy { // String ID of container's storage subnet. Container can be attached to // only one subnet. type Container_Attribute struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // Attribute name key Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` // Attribute value - Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` } -func (m *Container_Attribute) Reset() { *m = Container_Attribute{} } -func (m *Container_Attribute) String() string { return proto.CompactTextString(m) } -func (*Container_Attribute) ProtoMessage() {} +func (x *Container_Attribute) Reset() { + *x = Container_Attribute{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_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_v2_container_grpc_types_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Container_Attribute.ProtoReflect.Descriptor instead. func (*Container_Attribute) Descriptor() ([]byte, []int) { - return fileDescriptor_3bfd95a81c72c35c, []int{0, 0} -} -func (m *Container_Attribute) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Container_Attribute) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Container_Attribute.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *Container_Attribute) XXX_Merge(src proto.Message) { - xxx_messageInfo_Container_Attribute.Merge(m, src) -} -func (m *Container_Attribute) XXX_Size() int { - return m.Size() -} -func (m *Container_Attribute) XXX_DiscardUnknown() { - xxx_messageInfo_Container_Attribute.DiscardUnknown(m) + return file_v2_container_grpc_types_proto_rawDescGZIP(), []int{0, 0} } -var xxx_messageInfo_Container_Attribute proto.InternalMessageInfo - -func (m *Container_Attribute) GetKey() string { - if m != nil { - return m.Key +func (x *Container_Attribute) GetKey() string { + if x != nil { + return x.Key } return "" } -func (m *Container_Attribute) GetValue() string { - if m != nil { - return m.Value +func (x *Container_Attribute) GetValue() string { + if x != nil { + return x.Value } return "" } -func init() { - proto.RegisterType((*Container)(nil), "neo.fs.v2.container.Container") - proto.RegisterType((*Container_Attribute)(nil), "neo.fs.v2.container.Container.Attribute") -} +var File_v2_container_grpc_types_proto protoreflect.FileDescriptor -func init() { proto.RegisterFile("v2/container/grpc/types.proto", fileDescriptor_3bfd95a81c72c35c) } - -var fileDescriptor_3bfd95a81c72c35c = []byte{ - // 383 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x52, 0x4d, 0xce, 0xd3, 0x30, - 0x10, 0x25, 0x2d, 0xdf, 0x4f, 0xfc, 0x81, 0xa8, 0x0c, 0x82, 0x28, 0x88, 0x28, 0xb0, 0xca, 0xa6, - 0xb6, 0x48, 0x97, 0x88, 0x45, 0x29, 0x42, 0x54, 0xaa, 0xa0, 0x32, 0x12, 0x0b, 0x36, 0x95, 0xe3, - 0x4e, 0x5b, 0x8b, 0xd4, 0xb6, 0x62, 0x37, 0xa8, 0x37, 0xe1, 0x0c, 0x9c, 0x84, 0x25, 0x47, 0x40, - 0xe5, 0x06, 0x9c, 0x00, 0x25, 0x51, 0x42, 0x3f, 0xb5, 0xbb, 0xf9, 0x79, 0xef, 0xcd, 0xcc, 0xb3, - 0xd1, 0xb3, 0x32, 0xa5, 0x42, 0x2b, 0xc7, 0xa5, 0x82, 0x82, 0xae, 0x0b, 0x23, 0xa8, 0xdb, 0x1b, - 0xb0, 0xc4, 0x14, 0xda, 0x69, 0xfc, 0x50, 0x81, 0x26, 0x2b, 0x4b, 0xca, 0x94, 0x74, 0xa8, 0x30, - 0x2c, 0x53, 0xaa, 0xc0, 0x6d, 0xb9, 0x39, 0x21, 0x84, 0x41, 0x99, 0xd2, 0x02, 0x56, 0xf6, 0xa4, - 0xf3, 0xe2, 0x6f, 0x0f, 0xf9, 0x93, 0x56, 0x03, 0xbf, 0x44, 0x57, 0x25, 0x14, 0x56, 0x6a, 0x15, - 0x78, 0xb1, 0x97, 0xdc, 0xa4, 0x4f, 0xc8, 0xff, 0x51, 0x95, 0x00, 0xf9, 0xdc, 0xb4, 0x59, 0x8b, - 0xc3, 0x29, 0xba, 0xd6, 0xdf, 0x14, 0x14, 0x0b, 0xb9, 0x0c, 0x7a, 0xe7, 0x39, 0x1f, 0xab, 0xfe, - 0xf4, 0x2d, 0xbb, 0xd2, 0x4d, 0x80, 0x1f, 0xa1, 0x0b, 0xa5, 0x95, 0x80, 0xa0, 0x1f, 0x7b, 0xc9, - 0x3d, 0xd6, 0x24, 0xf8, 0x29, 0xf2, 0x33, 0x6e, 0xa5, 0x58, 0x70, 0x91, 0x07, 0x77, 0x63, 0x2f, - 0xb9, 0xcf, 0xae, 0xeb, 0xc2, 0x78, 0x32, 0xc3, 0xef, 0x11, 0xe2, 0xce, 0x15, 0x32, 0xdb, 0x39, - 0xb0, 0xc1, 0x45, 0xdc, 0x4f, 0x6e, 0xd2, 0x84, 0x9c, 0xf1, 0x81, 0x74, 0xd7, 0x90, 0x71, 0x4b, - 0x60, 0x47, 0x5c, 0x3c, 0x43, 0x03, 0x93, 0x73, 0x01, 0x5b, 0x50, 0x6e, 0x61, 0x74, 0x2e, 0xc5, - 0x3e, 0xb8, 0xac, 0x17, 0x7f, 0x7e, 0xa4, 0xd7, 0x38, 0x49, 0xe6, 0x2d, 0x72, 0x5e, 0x03, 0xd9, - 0x03, 0x73, 0xbb, 0x10, 0x8e, 0x90, 0xdf, 0x8d, 0xc1, 0x03, 0xd4, 0xff, 0x0a, 0xfb, 0xda, 0x3a, - 0x9f, 0x55, 0x61, 0x75, 0x69, 0xc9, 0xf3, 0x1d, 0xd4, 0xd6, 0xf8, 0xac, 0x49, 0xde, 0x6c, 0x7e, - 0x1e, 0x22, 0xef, 0xd7, 0x21, 0xf2, 0x7e, 0x1f, 0x22, 0xef, 0xfb, 0x9f, 0xe8, 0xce, 0x97, 0xd7, - 0x6b, 0xe9, 0x36, 0xbb, 0x8c, 0x08, 0xbd, 0xa5, 0xca, 0x1a, 0x21, 0x86, 0x4b, 0x28, 0xa9, 0x02, - 0xbd, 0xb2, 0x43, 0x6e, 0xe4, 0x70, 0xad, 0xe9, 0xc9, 0x97, 0x78, 0xd5, 0xa5, 0x3f, 0x7a, 0x8f, - 0x3f, 0x80, 0x7e, 0xf7, 0x89, 0x8c, 0xe7, 0xd3, 0x6a, 0xf9, 0xce, 0x82, 0xec, 0xb2, 0x7e, 0xe5, - 0xd1, 0xbf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x76, 0x8d, 0x00, 0xb0, 0x51, 0x02, 0x00, 0x00, -} - -func (m *Container) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Container) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Container) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.PlacementPolicy != nil { - { - size, err := m.PlacementPolicy.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x32 - } - if len(m.Attributes) > 0 { - for iNdEx := len(m.Attributes) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Attributes[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2a - } - } - if m.BasicAcl != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.BasicAcl)) - i-- - dAtA[i] = 0x20 - } - if len(m.Nonce) > 0 { - i -= len(m.Nonce) - copy(dAtA[i:], m.Nonce) - i = encodeVarintTypes(dAtA, i, uint64(len(m.Nonce))) - i-- - dAtA[i] = 0x1a - } - if m.OwnerId != nil { - { - size, err := m.OwnerId.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.Version != nil { - { - size, err := m.Version.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Container_Attribute) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Container_Attribute) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Container_Attribute) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.Value) > 0 { - i -= len(m.Value) - copy(dAtA[i:], m.Value) - i = encodeVarintTypes(dAtA, i, uint64(len(m.Value))) - i-- - dAtA[i] = 0x12 - } - if len(m.Key) > 0 { - i -= len(m.Key) - copy(dAtA[i:], m.Key) - i = encodeVarintTypes(dAtA, i, uint64(len(m.Key))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func encodeVarintTypes(dAtA []byte, offset int, v uint64) int { - offset -= sovTypes(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *Container) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Version != nil { - l = m.Version.Size() - n += 1 + l + sovTypes(uint64(l)) - } - if m.OwnerId != nil { - l = m.OwnerId.Size() - n += 1 + l + sovTypes(uint64(l)) - } - l = len(m.Nonce) - if l > 0 { - n += 1 + l + sovTypes(uint64(l)) - } - if m.BasicAcl != 0 { - n += 1 + sovTypes(uint64(m.BasicAcl)) - } - if len(m.Attributes) > 0 { - for _, e := range m.Attributes { - l = e.Size() - n += 1 + l + sovTypes(uint64(l)) - } - } - if m.PlacementPolicy != nil { - l = m.PlacementPolicy.Size() - n += 1 + l + sovTypes(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *Container_Attribute) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Key) - if l > 0 { - n += 1 + l + sovTypes(uint64(l)) - } - l = len(m.Value) - if l > 0 { - n += 1 + l + sovTypes(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func sovTypes(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozTypes(x uint64) (n int) { - return sovTypes(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *Container) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Container: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Container: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Version == nil { - m.Version = &grpc.Version{} - } - if err := m.Version.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OwnerId", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.OwnerId == nil { - m.OwnerId = &grpc.OwnerID{} - } - if err := m.OwnerId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Nonce", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Nonce = append(m.Nonce[:0], dAtA[iNdEx:postIndex]...) - if m.Nonce == nil { - m.Nonce = []byte{} - } - iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field BasicAcl", wireType) - } - m.BasicAcl = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.BasicAcl |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Attributes", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Attributes = append(m.Attributes, &Container_Attribute{}) - if err := m.Attributes[len(m.Attributes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PlacementPolicy", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.PlacementPolicy == nil { - m.PlacementPolicy = &grpc1.PlacementPolicy{} - } - if err := m.PlacementPolicy.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Container_Attribute) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Attribute: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Attribute: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Key = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Value = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipTypes(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTypes - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTypes - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTypes - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthTypes - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupTypes - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthTypes - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF +var file_v2_container_grpc_types_proto_rawDesc = []byte{ + 0x0a, 0x1d, 0x76, 0x32, 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, 0x1a, 0x76, 0x32, 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, 0x18, 0x76, 0x32, 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, + 0x58, 0x5a, 0x3d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, + 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, + 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 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, 0x16, 0x4e, 0x65, 0x6f, 0x46, 0x53, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x76, 0x32, 0x2e, + 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, } var ( - ErrInvalidLengthTypes = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowTypes = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupTypes = fmt.Errorf("proto: unexpected end of group") + file_v2_container_grpc_types_proto_rawDescOnce sync.Once + file_v2_container_grpc_types_proto_rawDescData = file_v2_container_grpc_types_proto_rawDesc ) + +func file_v2_container_grpc_types_proto_rawDescGZIP() []byte { + file_v2_container_grpc_types_proto_rawDescOnce.Do(func() { + file_v2_container_grpc_types_proto_rawDescData = protoimpl.X.CompressGZIP(file_v2_container_grpc_types_proto_rawDescData) + }) + return file_v2_container_grpc_types_proto_rawDescData +} + +var file_v2_container_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_v2_container_grpc_types_proto_goTypes = []interface{}{ + (*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_v2_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_v2_container_grpc_types_proto_init() } +func file_v2_container_grpc_types_proto_init() { + if File_v2_container_grpc_types_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_v2_container_grpc_types_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Container); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_container_grpc_types_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Container_Attribute); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_v2_container_grpc_types_proto_rawDesc, + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_v2_container_grpc_types_proto_goTypes, + DependencyIndexes: file_v2_container_grpc_types_proto_depIdxs, + MessageInfos: file_v2_container_grpc_types_proto_msgTypes, + }.Build() + File_v2_container_grpc_types_proto = out.File + file_v2_container_grpc_types_proto_rawDesc = nil + file_v2_container_grpc_types_proto_goTypes = nil + file_v2_container_grpc_types_proto_depIdxs = nil +} diff --git a/v2/container/marshal_test.go b/v2/container/marshal_test.go index 51eb5e7..5a2668c 100644 --- a/v2/container/marshal_test.go +++ b/v2/container/marshal_test.go @@ -9,6 +9,7 @@ import ( grpc "github.com/nspcc-dev/neofs-api-go/v2/container/grpc" "github.com/nspcc-dev/neofs-api-go/v2/refs" "github.com/stretchr/testify/require" + goproto "google.golang.org/protobuf/proto" ) func TestAttribute_StableMarshal(t *testing.T) { @@ -19,7 +20,7 @@ func TestAttribute_StableMarshal(t *testing.T) { wire, err := attributeFrom.StableMarshal(nil) require.NoError(t, err) - err = transport.Unmarshal(wire) + err = goproto.Unmarshal(wire, transport) require.NoError(t, err) attributeTo := container.AttributeFromGRPCMessage(transport) @@ -35,7 +36,7 @@ func TestContainer_StableMarshal(t *testing.T) { wire, err := cnrFrom.StableMarshal(nil) require.NoError(t, err) - err = transport.Unmarshal(wire) + err = goproto.Unmarshal(wire, transport) require.NoError(t, err) cnrTo := container.ContainerFromGRPCMessage(transport) @@ -51,7 +52,7 @@ func TestPutRequestBody_StableMarshal(t *testing.T) { wire, err := requestFrom.StableMarshal(nil) require.NoError(t, err) - err = transport.Unmarshal(wire) + err = goproto.Unmarshal(wire, transport) require.NoError(t, err) requestTo := container.PutRequestBodyFromGRPCMessage(transport) @@ -67,7 +68,7 @@ func TestPutResponseBody_StableMarshal(t *testing.T) { wire, err := responseFrom.StableMarshal(nil) require.NoError(t, err) - err = transport.Unmarshal(wire) + err = goproto.Unmarshal(wire, transport) require.NoError(t, err) responseTo := container.PutResponseBodyFromGRPCMessage(transport) @@ -83,7 +84,7 @@ func TestDeleteRequestBody_StableMarshal(t *testing.T) { wire, err := requestFrom.StableMarshal(nil) require.NoError(t, err) - err = transport.Unmarshal(wire) + err = goproto.Unmarshal(wire, transport) require.NoError(t, err) requestTo := container.DeleteRequestBodyFromGRPCMessage(transport) @@ -99,7 +100,7 @@ func TestDeleteResponseBody_StableMarshal(t *testing.T) { wire, err := responseFrom.StableMarshal(nil) require.NoError(t, err) - err = transport.Unmarshal(wire) + err = goproto.Unmarshal(wire, transport) require.NoError(t, err) responseTo := container.DeleteResponseBodyFromGRPCMessage(transport) @@ -115,7 +116,7 @@ func TestGetRequestBody_StableMarshal(t *testing.T) { wire, err := requestFrom.StableMarshal(nil) require.NoError(t, err) - err = transport.Unmarshal(wire) + err = goproto.Unmarshal(wire, transport) require.NoError(t, err) requestTo := container.GetRequestBodyFromGRPCMessage(transport) @@ -131,7 +132,7 @@ func TestGetResponseBody_StableMarshal(t *testing.T) { wire, err := responseFrom.StableMarshal(nil) require.NoError(t, err) - err = transport.Unmarshal(wire) + err = goproto.Unmarshal(wire, transport) require.NoError(t, err) responseTo := container.GetResponseBodyFromGRPCMessage(transport) @@ -147,7 +148,7 @@ func TestListRequestBody_StableMarshal(t *testing.T) { wire, err := requestFrom.StableMarshal(nil) require.NoError(t, err) - err = transport.Unmarshal(wire) + err = goproto.Unmarshal(wire, transport) require.NoError(t, err) requestTo := container.ListRequestBodyFromGRPCMessage(transport) @@ -163,7 +164,7 @@ func TestListResponseBody_StableMarshal(t *testing.T) { wire, err := responseFrom.StableMarshal(nil) require.NoError(t, err) - err = transport.Unmarshal(wire) + err = goproto.Unmarshal(wire, transport) require.NoError(t, err) responseTo := container.ListResponseBodyFromGRPCMessage(transport) @@ -179,7 +180,7 @@ func TestSetEACLRequestBody_StableMarshal(t *testing.T) { wire, err := requestFrom.StableMarshal(nil) require.NoError(t, err) - err = transport.Unmarshal(wire) + err = goproto.Unmarshal(wire, transport) require.NoError(t, err) requestTo := container.SetExtendedACLRequestBodyFromGRPCMessage(transport) @@ -195,7 +196,7 @@ func TestSetEACLResponseBody_StableMarshal(t *testing.T) { wire, err := responseFrom.StableMarshal(nil) require.NoError(t, err) - err = transport.Unmarshal(wire) + err = goproto.Unmarshal(wire, transport) require.NoError(t, err) responseTo := container.SetExtendedACLResponseBodyFromGRPCMessage(transport) @@ -211,7 +212,7 @@ func TestGetEACLRequestBody_StableMarshal(t *testing.T) { wire, err := requestFrom.StableMarshal(nil) require.NoError(t, err) - err = transport.Unmarshal(wire) + err = goproto.Unmarshal(wire, transport) require.NoError(t, err) requestTo := container.GetExtendedACLRequestBodyFromGRPCMessage(transport) @@ -227,7 +228,7 @@ func TestGetEACLResponseBody_StableMarshal(t *testing.T) { wire, err := responseFrom.StableMarshal(nil) require.NoError(t, err) - err = transport.Unmarshal(wire) + err = goproto.Unmarshal(wire, transport) require.NoError(t, err) responseTo := container.GetExtendedACLResponseBodyFromGRPCMessage(transport) diff --git a/v2/netmap/grpc/service.pb.go b/v2/netmap/grpc/service.pb.go index ac94753..721f282 100644 --- a/v2/netmap/grpc/service.pb.go +++ b/v2/netmap/grpc/service.pb.go @@ -1,35 +1,42 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.23.0 +// protoc v3.13.0 // source: v2/netmap/grpc/service.proto package netmap import ( context "context" - fmt "fmt" proto "github.com/golang/protobuf/proto" grpc1 "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" grpc "github.com/nspcc-dev/neofs-api-go/v2/session/grpc" grpc2 "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" - io "io" - math "math" - math_bits "math/bits" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +// This is a compile-time assertion that a sufficiently up-to-date version +// of the legacy proto package is being used. +const _ = proto.ProtoPackageIsVersion4 // Get NodeInfo structure from the particular node directly type LocalNodeInfoRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // Body of the LocalNodeInfo request message Body *LocalNodeInfoRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` // Carries request meta information. Header data is used only to regulate @@ -38,108 +45,68 @@ type LocalNodeInfoRequest struct { // 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,proto3" json:"verify_header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + VerifyHeader *grpc.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` } -func (m *LocalNodeInfoRequest) Reset() { *m = LocalNodeInfoRequest{} } -func (m *LocalNodeInfoRequest) String() string { return proto.CompactTextString(m) } -func (*LocalNodeInfoRequest) ProtoMessage() {} +func (x *LocalNodeInfoRequest) Reset() { + *x = LocalNodeInfoRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_netmap_grpc_service_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *LocalNodeInfoRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LocalNodeInfoRequest) ProtoMessage() {} + +func (x *LocalNodeInfoRequest) ProtoReflect() protoreflect.Message { + mi := &file_v2_netmap_grpc_service_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use LocalNodeInfoRequest.ProtoReflect.Descriptor instead. func (*LocalNodeInfoRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_d8a816fa1f32c636, []int{0} -} -func (m *LocalNodeInfoRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *LocalNodeInfoRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_LocalNodeInfoRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *LocalNodeInfoRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_LocalNodeInfoRequest.Merge(m, src) -} -func (m *LocalNodeInfoRequest) XXX_Size() int { - return m.Size() -} -func (m *LocalNodeInfoRequest) XXX_DiscardUnknown() { - xxx_messageInfo_LocalNodeInfoRequest.DiscardUnknown(m) + return file_v2_netmap_grpc_service_proto_rawDescGZIP(), []int{0} } -var xxx_messageInfo_LocalNodeInfoRequest proto.InternalMessageInfo - -func (m *LocalNodeInfoRequest) GetBody() *LocalNodeInfoRequest_Body { - if m != nil { - return m.Body +func (x *LocalNodeInfoRequest) GetBody() *LocalNodeInfoRequest_Body { + if x != nil { + return x.Body } return nil } -func (m *LocalNodeInfoRequest) GetMetaHeader() *grpc.RequestMetaHeader { - if m != nil { - return m.MetaHeader +func (x *LocalNodeInfoRequest) GetMetaHeader() *grpc.RequestMetaHeader { + if x != nil { + return x.MetaHeader } return nil } -func (m *LocalNodeInfoRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { - if m != nil { - return m.VerifyHeader +func (x *LocalNodeInfoRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { + if x != nil { + return x.VerifyHeader } return nil } -// LocalNodeInfo request body is empty. -type LocalNodeInfoRequest_Body struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *LocalNodeInfoRequest_Body) Reset() { *m = LocalNodeInfoRequest_Body{} } -func (m *LocalNodeInfoRequest_Body) String() string { return proto.CompactTextString(m) } -func (*LocalNodeInfoRequest_Body) ProtoMessage() {} -func (*LocalNodeInfoRequest_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_d8a816fa1f32c636, []int{0, 0} -} -func (m *LocalNodeInfoRequest_Body) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *LocalNodeInfoRequest_Body) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_LocalNodeInfoRequest_Body.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *LocalNodeInfoRequest_Body) XXX_Merge(src proto.Message) { - xxx_messageInfo_LocalNodeInfoRequest_Body.Merge(m, src) -} -func (m *LocalNodeInfoRequest_Body) XXX_Size() int { - return m.Size() -} -func (m *LocalNodeInfoRequest_Body) XXX_DiscardUnknown() { - xxx_messageInfo_LocalNodeInfoRequest_Body.DiscardUnknown(m) -} - -var xxx_messageInfo_LocalNodeInfoRequest_Body proto.InternalMessageInfo - // Local Node Info, including API Version in use type LocalNodeInfoResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // Body of the balance response message. Body *LocalNodeInfoResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` // Carries response meta information. Header data is used only to regulate @@ -148,172 +115,350 @@ type LocalNodeInfoResponse struct { // 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,proto3" json:"verify_header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + VerifyHeader *grpc.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` } -func (m *LocalNodeInfoResponse) Reset() { *m = LocalNodeInfoResponse{} } -func (m *LocalNodeInfoResponse) String() string { return proto.CompactTextString(m) } -func (*LocalNodeInfoResponse) ProtoMessage() {} -func (*LocalNodeInfoResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_d8a816fa1f32c636, []int{1} +func (x *LocalNodeInfoResponse) Reset() { + *x = LocalNodeInfoResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_netmap_grpc_service_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *LocalNodeInfoResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) + +func (x *LocalNodeInfoResponse) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *LocalNodeInfoResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_LocalNodeInfoResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err + +func (*LocalNodeInfoResponse) ProtoMessage() {} + +func (x *LocalNodeInfoResponse) ProtoReflect() protoreflect.Message { + mi := &file_v2_netmap_grpc_service_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) } - return b[:n], nil + return ms } -} -func (m *LocalNodeInfoResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_LocalNodeInfoResponse.Merge(m, src) -} -func (m *LocalNodeInfoResponse) XXX_Size() int { - return m.Size() -} -func (m *LocalNodeInfoResponse) XXX_DiscardUnknown() { - xxx_messageInfo_LocalNodeInfoResponse.DiscardUnknown(m) + return mi.MessageOf(x) } -var xxx_messageInfo_LocalNodeInfoResponse proto.InternalMessageInfo +// Deprecated: Use LocalNodeInfoResponse.ProtoReflect.Descriptor instead. +func (*LocalNodeInfoResponse) Descriptor() ([]byte, []int) { + return file_v2_netmap_grpc_service_proto_rawDescGZIP(), []int{1} +} -func (m *LocalNodeInfoResponse) GetBody() *LocalNodeInfoResponse_Body { - if m != nil { - return m.Body +func (x *LocalNodeInfoResponse) GetBody() *LocalNodeInfoResponse_Body { + if x != nil { + return x.Body } return nil } -func (m *LocalNodeInfoResponse) GetMetaHeader() *grpc.ResponseMetaHeader { - if m != nil { - return m.MetaHeader +func (x *LocalNodeInfoResponse) GetMetaHeader() *grpc.ResponseMetaHeader { + if x != nil { + return x.MetaHeader } return nil } -func (m *LocalNodeInfoResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { - if m != nil { - return m.VerifyHeader +func (x *LocalNodeInfoResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { + if x != nil { + return x.VerifyHeader } return nil } +// LocalNodeInfo request body is empty. +type LocalNodeInfoRequest_Body struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *LocalNodeInfoRequest_Body) Reset() { + *x = LocalNodeInfoRequest_Body{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_netmap_grpc_service_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *LocalNodeInfoRequest_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LocalNodeInfoRequest_Body) ProtoMessage() {} + +func (x *LocalNodeInfoRequest_Body) ProtoReflect() protoreflect.Message { + mi := &file_v2_netmap_grpc_service_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use LocalNodeInfoRequest_Body.ProtoReflect.Descriptor instead. +func (*LocalNodeInfoRequest_Body) Descriptor() ([]byte, []int) { + return file_v2_netmap_grpc_service_proto_rawDescGZIP(), []int{0, 0} +} + // Local Node Info, including API Version in use. type LocalNodeInfoResponse_Body struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // Latest NeoFS API version in use Version *grpc1.Version `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` // NodeInfo structure with recent information from node itself - NodeInfo *NodeInfo `protobuf:"bytes,2,opt,name=node_info,json=nodeInfo,proto3" json:"node_info,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + NodeInfo *NodeInfo `protobuf:"bytes,2,opt,name=node_info,json=nodeInfo,proto3" json:"node_info,omitempty"` } -func (m *LocalNodeInfoResponse_Body) Reset() { *m = LocalNodeInfoResponse_Body{} } -func (m *LocalNodeInfoResponse_Body) String() string { return proto.CompactTextString(m) } -func (*LocalNodeInfoResponse_Body) ProtoMessage() {} -func (*LocalNodeInfoResponse_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_d8a816fa1f32c636, []int{1, 0} +func (x *LocalNodeInfoResponse_Body) Reset() { + *x = LocalNodeInfoResponse_Body{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_netmap_grpc_service_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *LocalNodeInfoResponse_Body) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) + +func (x *LocalNodeInfoResponse_Body) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *LocalNodeInfoResponse_Body) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_LocalNodeInfoResponse_Body.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err + +func (*LocalNodeInfoResponse_Body) ProtoMessage() {} + +func (x *LocalNodeInfoResponse_Body) ProtoReflect() protoreflect.Message { + mi := &file_v2_netmap_grpc_service_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) } - return b[:n], nil + return ms } -} -func (m *LocalNodeInfoResponse_Body) XXX_Merge(src proto.Message) { - xxx_messageInfo_LocalNodeInfoResponse_Body.Merge(m, src) -} -func (m *LocalNodeInfoResponse_Body) XXX_Size() int { - return m.Size() -} -func (m *LocalNodeInfoResponse_Body) XXX_DiscardUnknown() { - xxx_messageInfo_LocalNodeInfoResponse_Body.DiscardUnknown(m) + return mi.MessageOf(x) } -var xxx_messageInfo_LocalNodeInfoResponse_Body proto.InternalMessageInfo +// Deprecated: Use LocalNodeInfoResponse_Body.ProtoReflect.Descriptor instead. +func (*LocalNodeInfoResponse_Body) Descriptor() ([]byte, []int) { + return file_v2_netmap_grpc_service_proto_rawDescGZIP(), []int{1, 0} +} -func (m *LocalNodeInfoResponse_Body) GetVersion() *grpc1.Version { - if m != nil { - return m.Version +func (x *LocalNodeInfoResponse_Body) GetVersion() *grpc1.Version { + if x != nil { + return x.Version } return nil } -func (m *LocalNodeInfoResponse_Body) GetNodeInfo() *NodeInfo { - if m != nil { - return m.NodeInfo +func (x *LocalNodeInfoResponse_Body) GetNodeInfo() *NodeInfo { + if x != nil { + return x.NodeInfo } return nil } -func init() { - proto.RegisterType((*LocalNodeInfoRequest)(nil), "neo.fs.v2.netmap.LocalNodeInfoRequest") - proto.RegisterType((*LocalNodeInfoRequest_Body)(nil), "neo.fs.v2.netmap.LocalNodeInfoRequest.Body") - proto.RegisterType((*LocalNodeInfoResponse)(nil), "neo.fs.v2.netmap.LocalNodeInfoResponse") - proto.RegisterType((*LocalNodeInfoResponse_Body)(nil), "neo.fs.v2.netmap.LocalNodeInfoResponse.Body") +var File_v2_netmap_grpc_service_proto protoreflect.FileDescriptor + +var file_v2_netmap_grpc_service_proto_rawDesc = []byte{ + 0x0a, 0x1c, 0x76, 0x32, 0x2f, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2f, 0x67, 0x72, 0x70, 0x63, + 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x10, + 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, + 0x1a, 0x1a, 0x76, 0x32, 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, 0x18, 0x76, 0x32, + 0x2f, 0x72, 0x65, 0x66, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x76, 0x32, 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, 0xf9, 0x01, 0x0a, 0x14, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x4e, 0x6f, 0x64, + 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x3f, 0x0a, 0x04, + 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x6e, 0x65, 0x6f, + 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4c, 0x6f, + 0x63, 0x61, 0x6c, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 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, 0x06, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x22, + 0xe9, 0x02, 0x0a, 0x15, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, + 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x40, 0x0a, 0x04, 0x62, 0x6f, 0x64, + 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, + 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4c, 0x6f, 0x63, 0x61, 0x6c, + 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 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, 0x72, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 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, 0x37, 0x0a, 0x09, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, + 0x6f, 0x52, 0x08, 0x6e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x32, 0x71, 0x0a, 0x0d, 0x4e, + 0x65, 0x74, 0x6d, 0x61, 0x70, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x60, 0x0a, 0x0d, + 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x26, 0x2e, + 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, + 0x2e, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x27, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x4e, 0x6f, + 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x4f, + 0x5a, 0x37, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, + 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, + 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2f, 0x67, 0x72, + 0x70, 0x63, 0x3b, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0xaa, 0x02, 0x13, 0x4e, 0x65, 0x6f, 0x46, + 0x53, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } -func init() { proto.RegisterFile("v2/netmap/grpc/service.proto", fileDescriptor_d8a816fa1f32c636) } +var ( + file_v2_netmap_grpc_service_proto_rawDescOnce sync.Once + file_v2_netmap_grpc_service_proto_rawDescData = file_v2_netmap_grpc_service_proto_rawDesc +) -var fileDescriptor_d8a816fa1f32c636 = []byte{ - // 438 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x93, 0xdf, 0x6a, 0xd4, 0x40, - 0x14, 0xc6, 0xcd, 0x5a, 0xaa, 0x4e, 0x5d, 0x90, 0x51, 0x71, 0x89, 0x12, 0xa4, 0xf8, 0x0f, 0x6c, - 0x66, 0x30, 0x5e, 0xf4, 0xc2, 0x0b, 0xb5, 0x60, 0xb1, 0xa0, 0x8b, 0xa6, 0xd0, 0x0b, 0x6f, 0xd6, - 0x6c, 0x72, 0xb2, 0x1d, 0x30, 0x73, 0xd2, 0x99, 0xe9, 0x40, 0xde, 0xc4, 0x67, 0xf0, 0x49, 0xbc, - 0xf4, 0x11, 0x64, 0xbd, 0xf2, 0x11, 0xbc, 0x93, 0x64, 0xd2, 0xb2, 0x7f, 0xd2, 0xee, 0xde, 0x9d, - 0xe5, 0x7c, 0xdf, 0xb7, 0xe7, 0x77, 0x72, 0x86, 0x3c, 0xb0, 0x11, 0x97, 0x60, 0x8a, 0xa4, 0xe4, - 0x13, 0x55, 0xa6, 0x5c, 0x83, 0xb2, 0x22, 0x05, 0x56, 0x2a, 0x34, 0x48, 0x6f, 0x49, 0x40, 0x96, - 0x6b, 0x66, 0x23, 0xe6, 0x44, 0xbe, 0xbf, 0xa0, 0x37, 0x55, 0x09, 0xda, 0xa9, 0xfd, 0x81, 0x8d, - 0xb8, 0x82, 0x5c, 0x2f, 0x77, 0xee, 0xdb, 0x88, 0x6b, 0xd0, 0x5a, 0xa0, 0x5c, 0x6a, 0x6e, 0xff, - 0xf3, 0xc8, 0x9d, 0x0f, 0x98, 0x26, 0xdf, 0x86, 0x98, 0xc1, 0x81, 0xcc, 0x31, 0x86, 0x93, 0x53, - 0xd0, 0x86, 0xbe, 0x26, 0x1b, 0x63, 0xcc, 0xaa, 0x81, 0xf7, 0xd0, 0x7b, 0xb6, 0x15, 0x3d, 0x67, - 0x8b, 0xc3, 0xb0, 0x2e, 0x17, 0xdb, 0xc3, 0xac, 0x8a, 0x1b, 0x23, 0x7d, 0x47, 0xb6, 0x0a, 0x30, - 0xc9, 0xe8, 0x18, 0x92, 0x0c, 0xd4, 0xa0, 0xd7, 0xe4, 0x3c, 0x9a, 0xc9, 0x69, 0x67, 0x62, 0xad, - 0xf7, 0x23, 0x98, 0xe4, 0x7d, 0xa3, 0x8d, 0x49, 0x71, 0x5e, 0xd3, 0xcf, 0xa4, 0x6f, 0x41, 0x89, - 0xbc, 0x3a, 0x0b, 0xba, 0xda, 0x04, 0xed, 0x5c, 0x1c, 0x74, 0x54, 0xcb, 0x45, 0x9a, 0x18, 0x81, - 0xb2, 0x0d, 0xbc, 0xe9, 0x22, 0xdc, 0x2f, 0x7f, 0x93, 0x6c, 0xd4, 0x73, 0x6e, 0xff, 0xed, 0x91, - 0xbb, 0x0b, 0x14, 0xba, 0x44, 0xa9, 0x81, 0xbe, 0x99, 0x83, 0xdf, 0x59, 0x09, 0xef, 0x6c, 0xb3, - 0xf4, 0xfb, 0x5d, 0xf4, 0x8f, 0x3b, 0x87, 0x76, 0xe6, 0x0b, 0xf0, 0xe3, 0x6e, 0xfc, 0xf0, 0x92, - 0xa4, 0x95, 0xfc, 0xca, 0xf1, 0xd3, 0x17, 0xe4, 0x9a, 0x05, 0x55, 0x7b, 0x5b, 0xd0, 0x7b, 0x33, - 0xa9, 0xf5, 0x2d, 0xb1, 0x23, 0xd7, 0x8e, 0xcf, 0x74, 0x74, 0x97, 0xdc, 0x90, 0x98, 0xc1, 0x48, - 0xc8, 0x1c, 0x5b, 0x28, 0x7f, 0x79, 0x3b, 0xe7, 0x8b, 0xb9, 0x2e, 0xdb, 0x2a, 0x3a, 0x21, 0xfd, - 0x61, 0xd3, 0x3c, 0x74, 0x37, 0x4e, 0xbf, 0x92, 0xfe, 0xdc, 0x12, 0xe9, 0x93, 0xf5, 0x4e, 0xcc, - 0x7f, 0xba, 0xe6, 0xd7, 0xd8, 0x1b, 0xfd, 0x9c, 0x06, 0xde, 0xaf, 0x69, 0xe0, 0xfd, 0x9e, 0x06, - 0xde, 0xf7, 0x3f, 0xc1, 0x95, 0x2f, 0xbb, 0x13, 0x61, 0x8e, 0x4f, 0xc7, 0x2c, 0xc5, 0x82, 0x4b, - 0x5d, 0xa6, 0x69, 0x98, 0x81, 0xe5, 0x12, 0x30, 0xd7, 0x61, 0x52, 0x8a, 0x70, 0x82, 0x7c, 0xfe, - 0x85, 0xbd, 0x72, 0xf5, 0x8f, 0xde, 0xed, 0x21, 0xe0, 0xfe, 0x21, 0x7b, 0xfb, 0xe9, 0xa0, 0xfe, - 0x5b, 0x47, 0x32, 0xde, 0x6c, 0x9e, 0xd0, 0xcb, 0xff, 0x01, 0x00, 0x00, 0xff, 0xff, 0xad, 0xd6, - 0xfb, 0x46, 0xc7, 0x03, 0x00, 0x00, +func file_v2_netmap_grpc_service_proto_rawDescGZIP() []byte { + file_v2_netmap_grpc_service_proto_rawDescOnce.Do(func() { + file_v2_netmap_grpc_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_v2_netmap_grpc_service_proto_rawDescData) + }) + return file_v2_netmap_grpc_service_proto_rawDescData +} + +var file_v2_netmap_grpc_service_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_v2_netmap_grpc_service_proto_goTypes = []interface{}{ + (*LocalNodeInfoRequest)(nil), // 0: neo.fs.v2.netmap.LocalNodeInfoRequest + (*LocalNodeInfoResponse)(nil), // 1: neo.fs.v2.netmap.LocalNodeInfoResponse + (*LocalNodeInfoRequest_Body)(nil), // 2: neo.fs.v2.netmap.LocalNodeInfoRequest.Body + (*LocalNodeInfoResponse_Body)(nil), // 3: neo.fs.v2.netmap.LocalNodeInfoResponse.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.Version)(nil), // 8: neo.fs.v2.refs.Version + (*NodeInfo)(nil), // 9: neo.fs.v2.netmap.NodeInfo +} +var file_v2_netmap_grpc_service_proto_depIdxs = []int32{ + 2, // 0: neo.fs.v2.netmap.LocalNodeInfoRequest.body:type_name -> neo.fs.v2.netmap.LocalNodeInfoRequest.Body + 4, // 1: neo.fs.v2.netmap.LocalNodeInfoRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader + 5, // 2: neo.fs.v2.netmap.LocalNodeInfoRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader + 3, // 3: neo.fs.v2.netmap.LocalNodeInfoResponse.body:type_name -> neo.fs.v2.netmap.LocalNodeInfoResponse.Body + 6, // 4: neo.fs.v2.netmap.LocalNodeInfoResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader + 7, // 5: neo.fs.v2.netmap.LocalNodeInfoResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 8, // 6: neo.fs.v2.netmap.LocalNodeInfoResponse.Body.version:type_name -> neo.fs.v2.refs.Version + 9, // 7: neo.fs.v2.netmap.LocalNodeInfoResponse.Body.node_info:type_name -> neo.fs.v2.netmap.NodeInfo + 0, // 8: neo.fs.v2.netmap.NetmapService.LocalNodeInfo:input_type -> neo.fs.v2.netmap.LocalNodeInfoRequest + 1, // 9: neo.fs.v2.netmap.NetmapService.LocalNodeInfo:output_type -> neo.fs.v2.netmap.LocalNodeInfoResponse + 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_v2_netmap_grpc_service_proto_init() } +func file_v2_netmap_grpc_service_proto_init() { + if File_v2_netmap_grpc_service_proto != nil { + return + } + file_v2_netmap_grpc_types_proto_init() + if !protoimpl.UnsafeEnabled { + file_v2_netmap_grpc_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*LocalNodeInfoRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_netmap_grpc_service_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*LocalNodeInfoResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_netmap_grpc_service_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*LocalNodeInfoRequest_Body); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_netmap_grpc_service_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*LocalNodeInfoResponse_Body); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_v2_netmap_grpc_service_proto_rawDesc, + NumEnums: 0, + NumMessages: 4, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_v2_netmap_grpc_service_proto_goTypes, + DependencyIndexes: file_v2_netmap_grpc_service_proto_depIdxs, + MessageInfos: file_v2_netmap_grpc_service_proto_msgTypes, + }.Build() + File_v2_netmap_grpc_service_proto = out.File + file_v2_netmap_grpc_service_proto_rawDesc = nil + file_v2_netmap_grpc_service_proto_goTypes = nil + file_v2_netmap_grpc_service_proto_depIdxs = nil } // Reference imports to suppress errors if they are not otherwise used. var _ context.Context -var _ grpc2.ClientConn +var _ grpc2.ClientConnInterface // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -const _ = grpc2.SupportPackageIsVersion4 +const _ = grpc2.SupportPackageIsVersion6 // NetmapServiceClient is the client API for NetmapService service. // @@ -328,10 +473,10 @@ type NetmapServiceClient interface { } type netmapServiceClient struct { - cc *grpc2.ClientConn + cc grpc2.ClientConnInterface } -func NewNetmapServiceClient(cc *grpc2.ClientConn) NetmapServiceClient { +func NewNetmapServiceClient(cc grpc2.ClientConnInterface) NetmapServiceClient { return &netmapServiceClient{cc} } @@ -358,7 +503,7 @@ type NetmapServiceServer interface { type UnimplementedNetmapServiceServer struct { } -func (*UnimplementedNetmapServiceServer) LocalNodeInfo(ctx context.Context, req *LocalNodeInfoRequest) (*LocalNodeInfoResponse, error) { +func (*UnimplementedNetmapServiceServer) LocalNodeInfo(context.Context, *LocalNodeInfoRequest) (*LocalNodeInfoResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method LocalNodeInfo not implemented") } @@ -396,893 +541,3 @@ var _NetmapService_serviceDesc = grpc2.ServiceDesc{ Streams: []grpc2.StreamDesc{}, Metadata: "v2/netmap/grpc/service.proto", } - -func (m *LocalNodeInfoRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *LocalNodeInfoRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *LocalNodeInfoRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.VerifyHeader != nil { - { - size, err := m.VerifyHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if m.MetaHeader != nil { - { - size, err := m.MetaHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.Body != nil { - { - size, err := m.Body.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *LocalNodeInfoRequest_Body) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *LocalNodeInfoRequest_Body) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *LocalNodeInfoRequest_Body) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - return len(dAtA) - i, nil -} - -func (m *LocalNodeInfoResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *LocalNodeInfoResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *LocalNodeInfoResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.VerifyHeader != nil { - { - size, err := m.VerifyHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if m.MetaHeader != nil { - { - size, err := m.MetaHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.Body != nil { - { - size, err := m.Body.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *LocalNodeInfoResponse_Body) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *LocalNodeInfoResponse_Body) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *LocalNodeInfoResponse_Body) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.NodeInfo != nil { - { - size, err := m.NodeInfo.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.Version != nil { - { - size, err := m.Version.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func encodeVarintService(dAtA []byte, offset int, v uint64) int { - offset -= sovService(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *LocalNodeInfoRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Body != nil { - l = m.Body.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.MetaHeader != nil { - l = m.MetaHeader.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.VerifyHeader != nil { - l = m.VerifyHeader.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *LocalNodeInfoRequest_Body) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *LocalNodeInfoResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Body != nil { - l = m.Body.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.MetaHeader != nil { - l = m.MetaHeader.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.VerifyHeader != nil { - l = m.VerifyHeader.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *LocalNodeInfoResponse_Body) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Version != nil { - l = m.Version.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.NodeInfo != nil { - l = m.NodeInfo.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func sovService(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozService(x uint64) (n int) { - return sovService(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *LocalNodeInfoRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: LocalNodeInfoRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: LocalNodeInfoRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Body", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Body == nil { - m.Body = &LocalNodeInfoRequest_Body{} - } - if err := m.Body.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MetaHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.MetaHeader == nil { - m.MetaHeader = &grpc.RequestMetaHeader{} - } - if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field VerifyHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.VerifyHeader == nil { - m.VerifyHeader = &grpc.RequestVerificationHeader{} - } - if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *LocalNodeInfoRequest_Body) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Body: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Body: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *LocalNodeInfoResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: LocalNodeInfoResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: LocalNodeInfoResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Body", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Body == nil { - m.Body = &LocalNodeInfoResponse_Body{} - } - if err := m.Body.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MetaHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.MetaHeader == nil { - m.MetaHeader = &grpc.ResponseMetaHeader{} - } - if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field VerifyHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.VerifyHeader == nil { - m.VerifyHeader = &grpc.ResponseVerificationHeader{} - } - if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *LocalNodeInfoResponse_Body) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Body: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Body: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Version == nil { - m.Version = &grpc1.Version{} - } - if err := m.Version.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NodeInfo", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.NodeInfo == nil { - m.NodeInfo = &NodeInfo{} - } - if err := m.NodeInfo.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipService(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowService - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowService - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowService - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthService - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupService - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthService - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthService = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowService = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupService = fmt.Errorf("proto: unexpected end of group") -) diff --git a/v2/netmap/grpc/types.pb.go b/v2/netmap/grpc/types.pb.go index 45b60fb..b7347eb 100644 --- a/v2/netmap/grpc/types.pb.go +++ b/v2/netmap/grpc/types.pb.go @@ -1,26 +1,29 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.23.0 +// protoc v3.13.0 // source: v2/netmap/grpc/types.proto package netmap import ( - fmt "fmt" proto "github.com/golang/protobuf/proto" - io "io" - math "math" - math_bits "math/bits" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +// This is a compile-time assertion that a sufficiently up-to-date version +// of the legacy proto package is being used. +const _ = proto.ProtoPackageIsVersion4 // Operations on filters type Operation int32 @@ -46,36 +49,57 @@ const ( Operation_AND Operation = 8 ) -var Operation_name = map[int32]string{ - 0: "OPERATION_UNSPECIFIED", - 1: "EQ", - 2: "NE", - 3: "GT", - 4: "GE", - 5: "LT", - 6: "LE", - 7: "OR", - 8: "AND", -} +// Enum value maps for Operation. +var ( + Operation_name = map[int32]string{ + 0: "OPERATION_UNSPECIFIED", + 1: "EQ", + 2: "NE", + 3: "GT", + 4: "GE", + 5: "LT", + 6: "LE", + 7: "OR", + 8: "AND", + } + Operation_value = map[string]int32{ + "OPERATION_UNSPECIFIED": 0, + "EQ": 1, + "NE": 2, + "GT": 3, + "GE": 4, + "LT": 5, + "LE": 6, + "OR": 7, + "AND": 8, + } +) -var Operation_value = map[string]int32{ - "OPERATION_UNSPECIFIED": 0, - "EQ": 1, - "NE": 2, - "GT": 3, - "GE": 4, - "LT": 5, - "LE": 6, - "OR": 7, - "AND": 8, +func (x Operation) Enum() *Operation { + p := new(Operation) + *p = x + return p } func (x Operation) String() string { - return proto.EnumName(Operation_name, int32(x)) + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) } +func (Operation) Descriptor() protoreflect.EnumDescriptor { + return file_v2_netmap_grpc_types_proto_enumTypes[0].Descriptor() +} + +func (Operation) Type() protoreflect.EnumType { + return &file_v2_netmap_grpc_types_proto_enumTypes[0] +} + +func (x Operation) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use Operation.Descriptor instead. func (Operation) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_91a1332b2376641a, []int{0} + return file_v2_netmap_grpc_types_proto_rawDescGZIP(), []int{0} } // Selector modifier shows how the node set will be formed. By default selector @@ -92,24 +116,45 @@ const ( Clause_DISTINCT Clause = 2 ) -var Clause_name = map[int32]string{ - 0: "CLAUSE_UNSPECIFIED", - 1: "SAME", - 2: "DISTINCT", -} +// Enum value maps for Clause. +var ( + Clause_name = map[int32]string{ + 0: "CLAUSE_UNSPECIFIED", + 1: "SAME", + 2: "DISTINCT", + } + Clause_value = map[string]int32{ + "CLAUSE_UNSPECIFIED": 0, + "SAME": 1, + "DISTINCT": 2, + } +) -var Clause_value = map[string]int32{ - "CLAUSE_UNSPECIFIED": 0, - "SAME": 1, - "DISTINCT": 2, +func (x Clause) Enum() *Clause { + p := new(Clause) + *p = x + return p } func (x Clause) String() string { - return proto.EnumName(Clause_name, int32(x)) + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) } +func (Clause) Descriptor() protoreflect.EnumDescriptor { + return file_v2_netmap_grpc_types_proto_enumTypes[1].Descriptor() +} + +func (Clause) Type() protoreflect.EnumType { + return &file_v2_netmap_grpc_types_proto_enumTypes[1] +} + +func (x Clause) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use Clause.Descriptor instead. func (Clause) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_91a1332b2376641a, []int{1} + return file_v2_netmap_grpc_types_proto_rawDescGZIP(), []int{1} } // Represents the enumeration of various states of the NeoFS node. @@ -124,29 +169,54 @@ const ( NodeInfo_OFFLINE NodeInfo_State = 2 ) -var NodeInfo_State_name = map[int32]string{ - 0: "UNSPECIFIED", - 1: "ONLINE", - 2: "OFFLINE", -} +// Enum value maps for NodeInfo_State. +var ( + NodeInfo_State_name = map[int32]string{ + 0: "UNSPECIFIED", + 1: "ONLINE", + 2: "OFFLINE", + } + NodeInfo_State_value = map[string]int32{ + "UNSPECIFIED": 0, + "ONLINE": 1, + "OFFLINE": 2, + } +) -var NodeInfo_State_value = map[string]int32{ - "UNSPECIFIED": 0, - "ONLINE": 1, - "OFFLINE": 2, +func (x NodeInfo_State) Enum() *NodeInfo_State { + p := new(NodeInfo_State) + *p = x + return p } func (x NodeInfo_State) String() string { - return proto.EnumName(NodeInfo_State_name, int32(x)) + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) } +func (NodeInfo_State) Descriptor() protoreflect.EnumDescriptor { + return file_v2_netmap_grpc_types_proto_enumTypes[2].Descriptor() +} + +func (NodeInfo_State) Type() protoreflect.EnumType { + return &file_v2_netmap_grpc_types_proto_enumTypes[2] +} + +func (x NodeInfo_State) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use NodeInfo_State.Descriptor instead. func (NodeInfo_State) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_91a1332b2376641a, []int{4, 0} + return file_v2_netmap_grpc_types_proto_rawDescGZIP(), []int{4, 0} } // Filter will return the subset of nodes from `NetworkMap` or another filter's // results, that will satisfy filter's conditions. type Filter struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // Name of the filter or a reference to the named filter. '*' means // application to the whole unfiltered NetworkMap. At top level it's used as a // filter name. At lower levels it's considered to be a reference to another @@ -160,76 +230,72 @@ type Filter struct { Value string `protobuf:"bytes,4,opt,name=value,proto3" json:"value,omitempty"` // List of inner filters. Top level operation will be applied to the whole // list. - Filters []*Filter `protobuf:"bytes,5,rep,name=filters,proto3" json:"filters,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Filters []*Filter `protobuf:"bytes,5,rep,name=filters,proto3" json:"filters,omitempty"` } -func (m *Filter) Reset() { *m = Filter{} } -func (m *Filter) String() string { return proto.CompactTextString(m) } -func (*Filter) ProtoMessage() {} -func (*Filter) Descriptor() ([]byte, []int) { - return fileDescriptor_91a1332b2376641a, []int{0} +func (x *Filter) Reset() { + *x = Filter{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_netmap_grpc_types_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *Filter) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) + +func (x *Filter) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *Filter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Filter.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err + +func (*Filter) ProtoMessage() {} + +func (x *Filter) ProtoReflect() protoreflect.Message { + mi := &file_v2_netmap_grpc_types_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) } - return b[:n], nil + return ms } -} -func (m *Filter) XXX_Merge(src proto.Message) { - xxx_messageInfo_Filter.Merge(m, src) -} -func (m *Filter) XXX_Size() int { - return m.Size() -} -func (m *Filter) XXX_DiscardUnknown() { - xxx_messageInfo_Filter.DiscardUnknown(m) + return mi.MessageOf(x) } -var xxx_messageInfo_Filter proto.InternalMessageInfo +// Deprecated: Use Filter.ProtoReflect.Descriptor instead. +func (*Filter) Descriptor() ([]byte, []int) { + return file_v2_netmap_grpc_types_proto_rawDescGZIP(), []int{0} +} -func (m *Filter) GetName() string { - if m != nil { - return m.Name +func (x *Filter) GetName() string { + if x != nil { + return x.Name } return "" } -func (m *Filter) GetKey() string { - if m != nil { - return m.Key +func (x *Filter) GetKey() string { + if x != nil { + return x.Key } return "" } -func (m *Filter) GetOp() Operation { - if m != nil { - return m.Op +func (x *Filter) GetOp() Operation { + if x != nil { + return x.Op } return Operation_OPERATION_UNSPECIFIED } -func (m *Filter) GetValue() string { - if m != nil { - return m.Value +func (x *Filter) GetValue() string { + if x != nil { + return x.Value } return "" } -func (m *Filter) GetFilters() []*Filter { - if m != nil { - return m.Filters +func (x *Filter) GetFilters() []*Filter { + if x != nil { + return x.Filters } return nil } @@ -237,6 +303,10 @@ func (m *Filter) GetFilters() []*Filter { // Selector chooses a number of nodes from the bucket taking the nearest nodes // to the provided `ContainerID` by hash distance. type Selector struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // Selector name to reference in object placement section Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` // How many nodes to select from the bucket @@ -246,76 +316,72 @@ type Selector struct { // Attribute bucket to select from Attribute string `protobuf:"bytes,4,opt,name=attribute,proto3" json:"attribute,omitempty"` // Filter reference to select from - Filter string `protobuf:"bytes,5,opt,name=filter,proto3" json:"filter,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Filter string `protobuf:"bytes,5,opt,name=filter,proto3" json:"filter,omitempty"` } -func (m *Selector) Reset() { *m = Selector{} } -func (m *Selector) String() string { return proto.CompactTextString(m) } -func (*Selector) ProtoMessage() {} -func (*Selector) Descriptor() ([]byte, []int) { - return fileDescriptor_91a1332b2376641a, []int{1} -} -func (m *Selector) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Selector) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Selector.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil +func (x *Selector) Reset() { + *x = Selector{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_netmap_grpc_types_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } } -func (m *Selector) XXX_Merge(src proto.Message) { - xxx_messageInfo_Selector.Merge(m, src) -} -func (m *Selector) XXX_Size() int { - return m.Size() -} -func (m *Selector) XXX_DiscardUnknown() { - xxx_messageInfo_Selector.DiscardUnknown(m) + +func (x *Selector) String() string { + return protoimpl.X.MessageStringOf(x) } -var xxx_messageInfo_Selector proto.InternalMessageInfo +func (*Selector) ProtoMessage() {} -func (m *Selector) GetName() string { - if m != nil { - return m.Name +func (x *Selector) ProtoReflect() protoreflect.Message { + mi := &file_v2_netmap_grpc_types_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Selector.ProtoReflect.Descriptor instead. +func (*Selector) Descriptor() ([]byte, []int) { + return file_v2_netmap_grpc_types_proto_rawDescGZIP(), []int{1} +} + +func (x *Selector) GetName() string { + if x != nil { + return x.Name } return "" } -func (m *Selector) GetCount() uint32 { - if m != nil { - return m.Count +func (x *Selector) GetCount() uint32 { + if x != nil { + return x.Count } return 0 } -func (m *Selector) GetClause() Clause { - if m != nil { - return m.Clause +func (x *Selector) GetClause() Clause { + if x != nil { + return x.Clause } return Clause_CLAUSE_UNSPECIFIED } -func (m *Selector) GetAttribute() string { - if m != nil { - return m.Attribute +func (x *Selector) GetAttribute() string { + if x != nil { + return x.Attribute } return "" } -func (m *Selector) GetFilter() string { - if m != nil { - return m.Filter +func (x *Selector) GetFilter() string { + if x != nil { + return x.Filter } return "" } @@ -324,58 +390,58 @@ func (m *Selector) GetFilter() string { // selector set the root bucket containing all possible nodes will be used by // default. type Replica struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // How many object replicas to put Count uint32 `protobuf:"varint,1,opt,name=count,proto3" json:"count,omitempty"` // Named selector bucket to put replicas - Selector string `protobuf:"bytes,2,opt,name=selector,proto3" json:"selector,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Selector string `protobuf:"bytes,2,opt,name=selector,proto3" json:"selector,omitempty"` } -func (m *Replica) Reset() { *m = Replica{} } -func (m *Replica) String() string { return proto.CompactTextString(m) } -func (*Replica) ProtoMessage() {} -func (*Replica) Descriptor() ([]byte, []int) { - return fileDescriptor_91a1332b2376641a, []int{2} -} -func (m *Replica) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Replica) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Replica.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil +func (x *Replica) Reset() { + *x = Replica{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_netmap_grpc_types_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } } -func (m *Replica) XXX_Merge(src proto.Message) { - xxx_messageInfo_Replica.Merge(m, src) -} -func (m *Replica) XXX_Size() int { - return m.Size() -} -func (m *Replica) XXX_DiscardUnknown() { - xxx_messageInfo_Replica.DiscardUnknown(m) + +func (x *Replica) String() string { + return protoimpl.X.MessageStringOf(x) } -var xxx_messageInfo_Replica proto.InternalMessageInfo +func (*Replica) ProtoMessage() {} -func (m *Replica) GetCount() uint32 { - if m != nil { - return m.Count +func (x *Replica) ProtoReflect() protoreflect.Message { + mi := &file_v2_netmap_grpc_types_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Replica.ProtoReflect.Descriptor instead. +func (*Replica) Descriptor() ([]byte, []int) { + return file_v2_netmap_grpc_types_proto_rawDescGZIP(), []int{2} +} + +func (x *Replica) GetCount() uint32 { + if x != nil { + return x.Count } return 0 } -func (m *Replica) GetSelector() string { - if m != nil { - return m.Selector +func (x *Replica) GetSelector() string { + if x != nil { + return x.Selector } return "" } @@ -384,6 +450,10 @@ func (m *Replica) GetSelector() string { // container's objects. The format is simple enough to transpile from different // storage policy definition languages. type PlacementPolicy struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // Rules to set number of object replicas and place each one into a named // bucket Replicas []*Replica `protobuf:"bytes,1,rep,name=replicas,proto3" json:"replicas,omitempty"` @@ -393,75 +463,75 @@ type PlacementPolicy struct { // Set of Selectors to form the container's nodes subset Selectors []*Selector `protobuf:"bytes,3,rep,name=selectors,proto3" json:"selectors,omitempty"` // List of named filters to reference in selectors - Filters []*Filter `protobuf:"bytes,4,rep,name=filters,proto3" json:"filters,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Filters []*Filter `protobuf:"bytes,4,rep,name=filters,proto3" json:"filters,omitempty"` } -func (m *PlacementPolicy) Reset() { *m = PlacementPolicy{} } -func (m *PlacementPolicy) String() string { return proto.CompactTextString(m) } -func (*PlacementPolicy) ProtoMessage() {} -func (*PlacementPolicy) Descriptor() ([]byte, []int) { - return fileDescriptor_91a1332b2376641a, []int{3} -} -func (m *PlacementPolicy) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *PlacementPolicy) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_PlacementPolicy.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil +func (x *PlacementPolicy) Reset() { + *x = PlacementPolicy{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_netmap_grpc_types_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } } -func (m *PlacementPolicy) XXX_Merge(src proto.Message) { - xxx_messageInfo_PlacementPolicy.Merge(m, src) -} -func (m *PlacementPolicy) XXX_Size() int { - return m.Size() -} -func (m *PlacementPolicy) XXX_DiscardUnknown() { - xxx_messageInfo_PlacementPolicy.DiscardUnknown(m) + +func (x *PlacementPolicy) String() string { + return protoimpl.X.MessageStringOf(x) } -var xxx_messageInfo_PlacementPolicy proto.InternalMessageInfo +func (*PlacementPolicy) ProtoMessage() {} -func (m *PlacementPolicy) GetReplicas() []*Replica { - if m != nil { - return m.Replicas +func (x *PlacementPolicy) ProtoReflect() protoreflect.Message { + mi := &file_v2_netmap_grpc_types_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PlacementPolicy.ProtoReflect.Descriptor instead. +func (*PlacementPolicy) Descriptor() ([]byte, []int) { + return file_v2_netmap_grpc_types_proto_rawDescGZIP(), []int{3} +} + +func (x *PlacementPolicy) GetReplicas() []*Replica { + if x != nil { + return x.Replicas } return nil } -func (m *PlacementPolicy) GetContainerBackupFactor() uint32 { - if m != nil { - return m.ContainerBackupFactor +func (x *PlacementPolicy) GetContainerBackupFactor() uint32 { + if x != nil { + return x.ContainerBackupFactor } return 0 } -func (m *PlacementPolicy) GetSelectors() []*Selector { - if m != nil { - return m.Selectors +func (x *PlacementPolicy) GetSelectors() []*Selector { + if x != nil { + return x.Selectors } return nil } -func (m *PlacementPolicy) GetFilters() []*Filter { - if m != nil { - return m.Filters +func (x *PlacementPolicy) GetFilters() []*Filter { + if x != nil { + return x.Filters } return nil } // NeoFS node description type NodeInfo struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // Public key of the NeoFS node in a binary format. PublicKey []byte `protobuf:"bytes,1,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"` // Ways to connect to a node @@ -469,69 +539,65 @@ type NodeInfo struct { // Carries list of the NeoFS node attributes in a string key-value format. Attributes []*NodeInfo_Attribute `protobuf:"bytes,3,rep,name=attributes,proto3" json:"attributes,omitempty"` // Carries state of the NeoFS node. - State NodeInfo_State `protobuf:"varint,4,opt,name=state,proto3,enum=neo.fs.v2.netmap.NodeInfo_State" json:"state,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + State NodeInfo_State `protobuf:"varint,4,opt,name=state,proto3,enum=neo.fs.v2.netmap.NodeInfo_State" json:"state,omitempty"` } -func (m *NodeInfo) Reset() { *m = NodeInfo{} } -func (m *NodeInfo) String() string { return proto.CompactTextString(m) } -func (*NodeInfo) ProtoMessage() {} -func (*NodeInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_91a1332b2376641a, []int{4} -} -func (m *NodeInfo) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *NodeInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_NodeInfo.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil +func (x *NodeInfo) Reset() { + *x = NodeInfo{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_netmap_grpc_types_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } } -func (m *NodeInfo) XXX_Merge(src proto.Message) { - xxx_messageInfo_NodeInfo.Merge(m, src) -} -func (m *NodeInfo) XXX_Size() int { - return m.Size() -} -func (m *NodeInfo) XXX_DiscardUnknown() { - xxx_messageInfo_NodeInfo.DiscardUnknown(m) + +func (x *NodeInfo) String() string { + return protoimpl.X.MessageStringOf(x) } -var xxx_messageInfo_NodeInfo proto.InternalMessageInfo +func (*NodeInfo) ProtoMessage() {} -func (m *NodeInfo) GetPublicKey() []byte { - if m != nil { - return m.PublicKey +func (x *NodeInfo) ProtoReflect() protoreflect.Message { + mi := &file_v2_netmap_grpc_types_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use NodeInfo.ProtoReflect.Descriptor instead. +func (*NodeInfo) Descriptor() ([]byte, []int) { + return file_v2_netmap_grpc_types_proto_rawDescGZIP(), []int{4} +} + +func (x *NodeInfo) GetPublicKey() []byte { + if x != nil { + return x.PublicKey } return nil } -func (m *NodeInfo) GetAddress() string { - if m != nil { - return m.Address +func (x *NodeInfo) GetAddress() string { + if x != nil { + return x.Address } return "" } -func (m *NodeInfo) GetAttributes() []*NodeInfo_Attribute { - if m != nil { - return m.Attributes +func (x *NodeInfo) GetAttributes() []*NodeInfo_Attribute { + if x != nil { + return x.Attributes } return nil } -func (m *NodeInfo) GetState() NodeInfo_State { - if m != nil { - return m.State +func (x *NodeInfo) GetState() NodeInfo_State { + if x != nil { + return x.State } return NodeInfo_UNSPECIFIED } @@ -573,1743 +639,293 @@ func (m *NodeInfo) GetState() NodeInfo_State { // For detailed description of each well-known attribute please see the // corresponding section in NeoFS Technical specification. type NodeInfo_Attribute struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // Key of the node attribute. Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` // Value of the node attribute. Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` // Parent keys, if any. For example for `City` it could be `Region` and // `Country`. - Parents []string `protobuf:"bytes,3,rep,name=parents,proto3" json:"parents,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Parents []string `protobuf:"bytes,3,rep,name=parents,proto3" json:"parents,omitempty"` } -func (m *NodeInfo_Attribute) Reset() { *m = NodeInfo_Attribute{} } -func (m *NodeInfo_Attribute) String() string { return proto.CompactTextString(m) } -func (*NodeInfo_Attribute) ProtoMessage() {} +func (x *NodeInfo_Attribute) Reset() { + *x = NodeInfo_Attribute{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_netmap_grpc_types_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *NodeInfo_Attribute) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NodeInfo_Attribute) ProtoMessage() {} + +func (x *NodeInfo_Attribute) ProtoReflect() protoreflect.Message { + mi := &file_v2_netmap_grpc_types_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use NodeInfo_Attribute.ProtoReflect.Descriptor instead. func (*NodeInfo_Attribute) Descriptor() ([]byte, []int) { - return fileDescriptor_91a1332b2376641a, []int{4, 0} -} -func (m *NodeInfo_Attribute) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *NodeInfo_Attribute) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_NodeInfo_Attribute.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *NodeInfo_Attribute) XXX_Merge(src proto.Message) { - xxx_messageInfo_NodeInfo_Attribute.Merge(m, src) -} -func (m *NodeInfo_Attribute) XXX_Size() int { - return m.Size() -} -func (m *NodeInfo_Attribute) XXX_DiscardUnknown() { - xxx_messageInfo_NodeInfo_Attribute.DiscardUnknown(m) + return file_v2_netmap_grpc_types_proto_rawDescGZIP(), []int{4, 0} } -var xxx_messageInfo_NodeInfo_Attribute proto.InternalMessageInfo - -func (m *NodeInfo_Attribute) GetKey() string { - if m != nil { - return m.Key +func (x *NodeInfo_Attribute) GetKey() string { + if x != nil { + return x.Key } return "" } -func (m *NodeInfo_Attribute) GetValue() string { - if m != nil { - return m.Value +func (x *NodeInfo_Attribute) GetValue() string { + if x != nil { + return x.Value } return "" } -func (m *NodeInfo_Attribute) GetParents() []string { - if m != nil { - return m.Parents +func (x *NodeInfo_Attribute) GetParents() []string { + if x != nil { + return x.Parents } return nil } -func init() { - proto.RegisterEnum("neo.fs.v2.netmap.Operation", Operation_name, Operation_value) - proto.RegisterEnum("neo.fs.v2.netmap.Clause", Clause_name, Clause_value) - proto.RegisterEnum("neo.fs.v2.netmap.NodeInfo_State", NodeInfo_State_name, NodeInfo_State_value) - proto.RegisterType((*Filter)(nil), "neo.fs.v2.netmap.Filter") - proto.RegisterType((*Selector)(nil), "neo.fs.v2.netmap.Selector") - proto.RegisterType((*Replica)(nil), "neo.fs.v2.netmap.Replica") - proto.RegisterType((*PlacementPolicy)(nil), "neo.fs.v2.netmap.PlacementPolicy") - proto.RegisterType((*NodeInfo)(nil), "neo.fs.v2.netmap.NodeInfo") - proto.RegisterType((*NodeInfo_Attribute)(nil), "neo.fs.v2.netmap.NodeInfo.Attribute") -} +var File_v2_netmap_grpc_types_proto protoreflect.FileDescriptor -func init() { proto.RegisterFile("v2/netmap/grpc/types.proto", fileDescriptor_91a1332b2376641a) } - -var fileDescriptor_91a1332b2376641a = []byte{ - // 686 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x54, 0xcd, 0x6e, 0xda, 0x40, - 0x10, 0x8e, 0x0d, 0x18, 0x98, 0xfc, 0x59, 0xdb, 0x24, 0x75, 0x68, 0x8b, 0x10, 0xea, 0x21, 0x4a, - 0x15, 0xd3, 0x52, 0x35, 0x8d, 0x94, 0x13, 0x01, 0x53, 0x59, 0x4d, 0x0c, 0x35, 0xe4, 0xd2, 0x0b, - 0x5a, 0xcc, 0x42, 0xad, 0x18, 0xaf, 0x65, 0x2f, 0x48, 0xbc, 0x49, 0x0f, 0xbd, 0xf6, 0xd2, 0xd7, - 0xe8, 0xa5, 0xc7, 0x3e, 0x42, 0x95, 0xde, 0xfb, 0x0c, 0x95, 0xd7, 0x3f, 0x90, 0x10, 0x55, 0x3d, - 0xcd, 0xce, 0xce, 0xe7, 0xef, 0xfb, 0x34, 0xb3, 0x63, 0x28, 0xcd, 0xeb, 0x35, 0x97, 0xb0, 0x29, - 0xf6, 0x6a, 0x13, 0xdf, 0xb3, 0x6a, 0x6c, 0xe1, 0x91, 0x40, 0xf5, 0x7c, 0xca, 0x28, 0x92, 0x5d, - 0x42, 0xd5, 0x71, 0xa0, 0xce, 0xeb, 0x6a, 0x04, 0xa9, 0x7e, 0x15, 0x40, 0x6a, 0xdb, 0x0e, 0x23, - 0x3e, 0x42, 0x90, 0x75, 0xf1, 0x94, 0x28, 0x42, 0x45, 0x38, 0x2a, 0x9a, 0xfc, 0x8c, 0x64, 0xc8, - 0xdc, 0x90, 0x85, 0x22, 0xf2, 0xab, 0xf0, 0x88, 0x5e, 0x80, 0x48, 0x3d, 0x25, 0x53, 0x11, 0x8e, - 0x76, 0xea, 0x4f, 0xd4, 0xfb, 0x7c, 0x6a, 0xc7, 0x23, 0x3e, 0x66, 0x36, 0x75, 0x4d, 0x91, 0x7a, - 0x68, 0x0f, 0x72, 0x73, 0xec, 0xcc, 0x88, 0x92, 0xe5, 0x04, 0x51, 0x82, 0xea, 0x90, 0x1f, 0x73, - 0xc9, 0x40, 0xc9, 0x55, 0x32, 0x47, 0x9b, 0x75, 0x65, 0x9d, 0x27, 0xf2, 0x64, 0x26, 0xc0, 0xea, - 0x17, 0x01, 0x0a, 0x3d, 0xe2, 0x10, 0x8b, 0xd1, 0x87, 0x9d, 0xee, 0x41, 0xce, 0xa2, 0x33, 0x97, - 0x71, 0xaf, 0xdb, 0x66, 0x94, 0xa0, 0x97, 0x20, 0x59, 0x0e, 0x9e, 0x05, 0x24, 0x76, 0xfc, 0x80, - 0x52, 0x93, 0xd7, 0xcd, 0x18, 0x87, 0x9e, 0x42, 0x11, 0x33, 0xe6, 0xdb, 0xc3, 0x19, 0x4b, 0x6c, - 0x2f, 0x2f, 0xd0, 0x01, 0x48, 0x91, 0x23, 0x25, 0xc7, 0x4b, 0x71, 0x56, 0x3d, 0x87, 0xbc, 0x49, - 0x3c, 0xc7, 0xb6, 0xf0, 0xd2, 0x88, 0xb0, 0x6a, 0xa4, 0x04, 0x85, 0x20, 0xb6, 0x1f, 0x77, 0x33, - 0xcd, 0xab, 0x7f, 0x04, 0xd8, 0xed, 0x3a, 0xd8, 0x22, 0x53, 0xe2, 0xb2, 0x2e, 0x75, 0x6c, 0x6b, - 0x81, 0xde, 0x40, 0xc1, 0x8f, 0x08, 0x03, 0x45, 0xe0, 0x4d, 0x3a, 0x5c, 0xb7, 0x1e, 0x4b, 0x9a, - 0x29, 0x14, 0x9d, 0xc2, 0x63, 0x8b, 0xba, 0x0c, 0xdb, 0x2e, 0xf1, 0x07, 0x43, 0x6c, 0xdd, 0xcc, - 0xbc, 0xc1, 0x18, 0xa7, 0xaa, 0xdb, 0xe6, 0x7e, 0x5a, 0xbe, 0xe0, 0xd5, 0x36, 0x2f, 0xa2, 0x33, - 0x28, 0x26, 0x76, 0x02, 0x25, 0xc3, 0xf5, 0x4a, 0xeb, 0x7a, 0xc9, 0x00, 0xcc, 0x25, 0x78, 0x75, - 0x98, 0xd9, 0xff, 0x1d, 0xe6, 0x77, 0x11, 0x0a, 0x06, 0x1d, 0x11, 0xdd, 0x1d, 0x53, 0xf4, 0x0c, - 0xc0, 0x9b, 0x0d, 0x1d, 0xdb, 0x1a, 0x84, 0x2f, 0x2d, 0x6c, 0xda, 0x96, 0x59, 0x8c, 0x6e, 0xde, - 0x93, 0x05, 0x52, 0x20, 0x8f, 0x47, 0x23, 0x9f, 0x04, 0x41, 0xdc, 0xb7, 0x24, 0x45, 0x2d, 0x80, - 0x74, 0x30, 0x89, 0xe9, 0xe7, 0xeb, 0xe2, 0x89, 0x90, 0xda, 0x48, 0xc0, 0xe6, 0xca, 0x77, 0xe8, - 0x14, 0x72, 0x01, 0xc3, 0xf1, 0xac, 0x77, 0xea, 0x95, 0x7f, 0x10, 0xf4, 0x42, 0x9c, 0x19, 0xc1, - 0x4b, 0x57, 0x50, 0x4c, 0x09, 0x93, 0x35, 0x11, 0x96, 0x6b, 0x92, 0xbe, 0x7c, 0x71, 0xf5, 0xe5, - 0x2b, 0x90, 0xf7, 0xb0, 0x4f, 0x5c, 0x16, 0xf9, 0x2d, 0x9a, 0x49, 0x5a, 0x7d, 0x05, 0x39, 0x4e, - 0x8f, 0x76, 0x61, 0xf3, 0xda, 0xe8, 0x75, 0xb5, 0xa6, 0xde, 0xd6, 0xb5, 0x96, 0xbc, 0x81, 0x00, - 0xa4, 0x8e, 0x71, 0xa9, 0x1b, 0x9a, 0x2c, 0xa0, 0x4d, 0xc8, 0x77, 0xda, 0x6d, 0x9e, 0x88, 0xc7, - 0x13, 0x28, 0xa6, 0xdb, 0x86, 0x0e, 0x61, 0xbf, 0xd3, 0xd5, 0xcc, 0x46, 0x5f, 0xef, 0x18, 0x83, - 0xbb, 0x04, 0x12, 0x88, 0xda, 0x07, 0x59, 0x08, 0x63, 0xf8, 0x5d, 0x18, 0xdf, 0xf5, 0xe5, 0x0c, - 0x8f, 0x9a, 0x9c, 0x0d, 0xe3, 0x65, 0x5f, 0xce, 0xf1, 0xa8, 0xc9, 0x52, 0x18, 0x3b, 0xa6, 0x9c, - 0x47, 0x79, 0xc8, 0x34, 0x8c, 0x96, 0x5c, 0x38, 0x3e, 0x03, 0x29, 0x5a, 0x12, 0x74, 0x00, 0xa8, - 0x79, 0xd9, 0xb8, 0xee, 0x69, 0xf7, 0x24, 0x0a, 0x90, 0xed, 0x35, 0xae, 0x42, 0x87, 0x5b, 0x50, - 0x68, 0xe9, 0xbd, 0xbe, 0x6e, 0x34, 0xfb, 0xb2, 0x78, 0x31, 0xf8, 0x71, 0x5b, 0x16, 0x7e, 0xde, - 0x96, 0x85, 0x5f, 0xb7, 0x65, 0xe1, 0xf3, 0xef, 0xf2, 0xc6, 0xc7, 0xb7, 0x13, 0x9b, 0x7d, 0x9a, - 0x0d, 0x55, 0x8b, 0x4e, 0x6b, 0x6e, 0xe0, 0x59, 0xd6, 0xc9, 0x88, 0xcc, 0x6b, 0x2e, 0xa1, 0xe3, - 0xe0, 0x04, 0x7b, 0xf6, 0xc9, 0x84, 0xd6, 0xee, 0xfe, 0xbf, 0xce, 0xa3, 0xf3, 0x37, 0xf1, 0x91, - 0x41, 0x68, 0xbb, 0xa7, 0x36, 0xba, 0x7a, 0x38, 0x1b, 0x83, 0xdf, 0x0e, 0x25, 0xfe, 0x5f, 0x7b, - 0xfd, 0x37, 0x00, 0x00, 0xff, 0xff, 0xcc, 0x69, 0xba, 0x7f, 0xf5, 0x04, 0x00, 0x00, -} - -func (m *Filter) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Filter) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Filter) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.Filters) > 0 { - for iNdEx := len(m.Filters) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Filters[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2a - } - } - if len(m.Value) > 0 { - i -= len(m.Value) - copy(dAtA[i:], m.Value) - i = encodeVarintTypes(dAtA, i, uint64(len(m.Value))) - i-- - dAtA[i] = 0x22 - } - if m.Op != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.Op)) - i-- - dAtA[i] = 0x18 - } - if len(m.Key) > 0 { - i -= len(m.Key) - copy(dAtA[i:], m.Key) - i = encodeVarintTypes(dAtA, i, uint64(len(m.Key))) - i-- - dAtA[i] = 0x12 - } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintTypes(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Selector) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Selector) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Selector) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.Filter) > 0 { - i -= len(m.Filter) - copy(dAtA[i:], m.Filter) - i = encodeVarintTypes(dAtA, i, uint64(len(m.Filter))) - i-- - dAtA[i] = 0x2a - } - if len(m.Attribute) > 0 { - i -= len(m.Attribute) - copy(dAtA[i:], m.Attribute) - i = encodeVarintTypes(dAtA, i, uint64(len(m.Attribute))) - i-- - dAtA[i] = 0x22 - } - if m.Clause != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.Clause)) - i-- - dAtA[i] = 0x18 - } - if m.Count != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.Count)) - i-- - dAtA[i] = 0x10 - } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintTypes(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Replica) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Replica) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Replica) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.Selector) > 0 { - i -= len(m.Selector) - copy(dAtA[i:], m.Selector) - i = encodeVarintTypes(dAtA, i, uint64(len(m.Selector))) - i-- - dAtA[i] = 0x12 - } - if m.Count != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.Count)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *PlacementPolicy) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *PlacementPolicy) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *PlacementPolicy) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.Filters) > 0 { - for iNdEx := len(m.Filters) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Filters[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } - } - if len(m.Selectors) > 0 { - for iNdEx := len(m.Selectors) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Selectors[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - } - if m.ContainerBackupFactor != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.ContainerBackupFactor)) - i-- - dAtA[i] = 0x10 - } - if len(m.Replicas) > 0 { - for iNdEx := len(m.Replicas) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Replicas[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *NodeInfo) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *NodeInfo) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *NodeInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.State != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.State)) - i-- - dAtA[i] = 0x20 - } - if len(m.Attributes) > 0 { - for iNdEx := len(m.Attributes) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Attributes[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - } - if len(m.Address) > 0 { - i -= len(m.Address) - copy(dAtA[i:], m.Address) - i = encodeVarintTypes(dAtA, i, uint64(len(m.Address))) - i-- - dAtA[i] = 0x12 - } - if len(m.PublicKey) > 0 { - i -= len(m.PublicKey) - copy(dAtA[i:], m.PublicKey) - i = encodeVarintTypes(dAtA, i, uint64(len(m.PublicKey))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *NodeInfo_Attribute) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *NodeInfo_Attribute) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *NodeInfo_Attribute) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.Parents) > 0 { - for iNdEx := len(m.Parents) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Parents[iNdEx]) - copy(dAtA[i:], m.Parents[iNdEx]) - i = encodeVarintTypes(dAtA, i, uint64(len(m.Parents[iNdEx]))) - i-- - dAtA[i] = 0x1a - } - } - if len(m.Value) > 0 { - i -= len(m.Value) - copy(dAtA[i:], m.Value) - i = encodeVarintTypes(dAtA, i, uint64(len(m.Value))) - i-- - dAtA[i] = 0x12 - } - if len(m.Key) > 0 { - i -= len(m.Key) - copy(dAtA[i:], m.Key) - i = encodeVarintTypes(dAtA, i, uint64(len(m.Key))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func encodeVarintTypes(dAtA []byte, offset int, v uint64) int { - offset -= sovTypes(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *Filter) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Name) - if l > 0 { - n += 1 + l + sovTypes(uint64(l)) - } - l = len(m.Key) - if l > 0 { - n += 1 + l + sovTypes(uint64(l)) - } - if m.Op != 0 { - n += 1 + sovTypes(uint64(m.Op)) - } - l = len(m.Value) - if l > 0 { - n += 1 + l + sovTypes(uint64(l)) - } - if len(m.Filters) > 0 { - for _, e := range m.Filters { - l = e.Size() - n += 1 + l + sovTypes(uint64(l)) - } - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *Selector) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Name) - if l > 0 { - n += 1 + l + sovTypes(uint64(l)) - } - if m.Count != 0 { - n += 1 + sovTypes(uint64(m.Count)) - } - if m.Clause != 0 { - n += 1 + sovTypes(uint64(m.Clause)) - } - l = len(m.Attribute) - if l > 0 { - n += 1 + l + sovTypes(uint64(l)) - } - l = len(m.Filter) - if l > 0 { - n += 1 + l + sovTypes(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *Replica) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Count != 0 { - n += 1 + sovTypes(uint64(m.Count)) - } - l = len(m.Selector) - if l > 0 { - n += 1 + l + sovTypes(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *PlacementPolicy) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Replicas) > 0 { - for _, e := range m.Replicas { - l = e.Size() - n += 1 + l + sovTypes(uint64(l)) - } - } - if m.ContainerBackupFactor != 0 { - n += 1 + sovTypes(uint64(m.ContainerBackupFactor)) - } - if len(m.Selectors) > 0 { - for _, e := range m.Selectors { - l = e.Size() - n += 1 + l + sovTypes(uint64(l)) - } - } - if len(m.Filters) > 0 { - for _, e := range m.Filters { - l = e.Size() - n += 1 + l + sovTypes(uint64(l)) - } - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *NodeInfo) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.PublicKey) - if l > 0 { - n += 1 + l + sovTypes(uint64(l)) - } - l = len(m.Address) - if l > 0 { - n += 1 + l + sovTypes(uint64(l)) - } - if len(m.Attributes) > 0 { - for _, e := range m.Attributes { - l = e.Size() - n += 1 + l + sovTypes(uint64(l)) - } - } - if m.State != 0 { - n += 1 + sovTypes(uint64(m.State)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *NodeInfo_Attribute) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Key) - if l > 0 { - n += 1 + l + sovTypes(uint64(l)) - } - l = len(m.Value) - if l > 0 { - n += 1 + l + sovTypes(uint64(l)) - } - if len(m.Parents) > 0 { - for _, s := range m.Parents { - l = len(s) - n += 1 + l + sovTypes(uint64(l)) - } - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func sovTypes(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozTypes(x uint64) (n int) { - return sovTypes(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *Filter) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Filter: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Filter: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Key = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Op", wireType) - } - m.Op = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Op |= Operation(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Value = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Filters", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Filters = append(m.Filters, &Filter{}) - if err := m.Filters[len(m.Filters)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Selector) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Selector: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Selector: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Count", wireType) - } - m.Count = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Count |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Clause", wireType) - } - m.Clause = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Clause |= Clause(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Attribute", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Attribute = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Filter", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Filter = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Replica) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Replica: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Replica: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Count", wireType) - } - m.Count = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Count |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Selector", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Selector = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *PlacementPolicy) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: PlacementPolicy: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: PlacementPolicy: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Replicas", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Replicas = append(m.Replicas, &Replica{}) - if err := m.Replicas[len(m.Replicas)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ContainerBackupFactor", wireType) - } - m.ContainerBackupFactor = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ContainerBackupFactor |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Selectors", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Selectors = append(m.Selectors, &Selector{}) - if err := m.Selectors[len(m.Selectors)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Filters", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Filters = append(m.Filters, &Filter{}) - if err := m.Filters[len(m.Filters)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *NodeInfo) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: NodeInfo: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: NodeInfo: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PublicKey", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.PublicKey = append(m.PublicKey[:0], dAtA[iNdEx:postIndex]...) - if m.PublicKey == nil { - m.PublicKey = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Address = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Attributes", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Attributes = append(m.Attributes, &NodeInfo_Attribute{}) - if err := m.Attributes[len(m.Attributes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field State", wireType) - } - m.State = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.State |= NodeInfo_State(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *NodeInfo_Attribute) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Attribute: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Attribute: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Key = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Value = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Parents", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Parents = append(m.Parents, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipTypes(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTypes - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTypes - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTypes - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthTypes - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupTypes - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthTypes - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF +var file_v2_netmap_grpc_types_proto_rawDesc = []byte{ + 0x0a, 0x1a, 0x76, 0x32, 0x2f, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2f, 0x67, 0x72, 0x70, 0x63, + 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x10, 0x6e, 0x65, + 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x22, 0xa5, + 0x01, 0x0a, 0x06, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x10, 0x0a, + 0x03, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, + 0x2b, 0x0a, 0x02, 0x6f, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1b, 0x2e, 0x6e, 0x65, + 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4f, + 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x02, 0x6f, 0x70, 0x12, 0x14, 0x0a, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x12, 0x32, 0x0a, 0x07, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x73, 0x18, 0x05, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, + 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x07, 0x66, + 0x69, 0x6c, 0x74, 0x65, 0x72, 0x73, 0x22, 0x9c, 0x01, 0x0a, 0x08, 0x53, 0x65, 0x6c, 0x65, 0x63, + 0x74, 0x6f, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x30, 0x0a, + 0x06, 0x63, 0x6c, 0x61, 0x75, 0x73, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x18, 0x2e, + 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, + 0x2e, 0x43, 0x6c, 0x61, 0x75, 0x73, 0x65, 0x52, 0x06, 0x63, 0x6c, 0x61, 0x75, 0x73, 0x65, 0x12, + 0x1c, 0x0a, 0x09, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x09, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x12, 0x16, 0x0a, + 0x06, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x66, + 0x69, 0x6c, 0x74, 0x65, 0x72, 0x22, 0x3b, 0x0a, 0x07, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, + 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, + 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, + 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, + 0x6f, 0x72, 0x22, 0xee, 0x01, 0x0a, 0x0f, 0x50, 0x6c, 0x61, 0x63, 0x65, 0x6d, 0x65, 0x6e, 0x74, + 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x35, 0x0a, 0x08, 0x72, 0x65, 0x70, 0x6c, 0x69, 0x63, + 0x61, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x52, 0x65, 0x70, 0x6c, + 0x69, 0x63, 0x61, 0x52, 0x08, 0x72, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x73, 0x12, 0x36, 0x0a, + 0x17, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x62, 0x61, 0x63, 0x6b, 0x75, + 0x70, 0x5f, 0x66, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x15, + 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x42, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x46, + 0x61, 0x63, 0x74, 0x6f, 0x72, 0x12, 0x38, 0x0a, 0x09, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, + 0x72, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x53, 0x65, 0x6c, 0x65, + 0x63, 0x74, 0x6f, 0x72, 0x52, 0x09, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x73, 0x12, + 0x32, 0x0a, 0x07, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, + 0x6d, 0x61, 0x70, 0x2e, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x07, 0x66, 0x69, 0x6c, 0x74, + 0x65, 0x72, 0x73, 0x22, 0xc3, 0x02, 0x0a, 0x08, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, + 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x12, + 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x44, 0x0a, 0x0a, 0x61, 0x74, 0x74, + 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, + 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, + 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, + 0x75, 0x74, 0x65, 0x52, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, + 0x36, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x20, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, + 0x70, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x65, + 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x1a, 0x4d, 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, 0x12, 0x18, 0x0a, 0x07, + 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x70, + 0x61, 0x72, 0x65, 0x6e, 0x74, 0x73, 0x22, 0x31, 0x0a, 0x05, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, + 0x0f, 0x0a, 0x0b, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, + 0x12, 0x0a, 0x0a, 0x06, 0x4f, 0x4e, 0x4c, 0x49, 0x4e, 0x45, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, + 0x4f, 0x46, 0x46, 0x4c, 0x49, 0x4e, 0x45, 0x10, 0x02, 0x2a, 0x67, 0x0a, 0x09, 0x4f, 0x70, 0x65, + 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x19, 0x0a, 0x15, 0x4f, 0x50, 0x45, 0x52, 0x41, 0x54, + 0x49, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, + 0x00, 0x12, 0x06, 0x0a, 0x02, 0x45, 0x51, 0x10, 0x01, 0x12, 0x06, 0x0a, 0x02, 0x4e, 0x45, 0x10, + 0x02, 0x12, 0x06, 0x0a, 0x02, 0x47, 0x54, 0x10, 0x03, 0x12, 0x06, 0x0a, 0x02, 0x47, 0x45, 0x10, + 0x04, 0x12, 0x06, 0x0a, 0x02, 0x4c, 0x54, 0x10, 0x05, 0x12, 0x06, 0x0a, 0x02, 0x4c, 0x45, 0x10, + 0x06, 0x12, 0x06, 0x0a, 0x02, 0x4f, 0x52, 0x10, 0x07, 0x12, 0x07, 0x0a, 0x03, 0x41, 0x4e, 0x44, + 0x10, 0x08, 0x2a, 0x38, 0x0a, 0x06, 0x43, 0x6c, 0x61, 0x75, 0x73, 0x65, 0x12, 0x16, 0x0a, 0x12, + 0x43, 0x4c, 0x41, 0x55, 0x53, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, + 0x45, 0x44, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x53, 0x41, 0x4d, 0x45, 0x10, 0x01, 0x12, 0x0c, + 0x0a, 0x08, 0x44, 0x49, 0x53, 0x54, 0x49, 0x4e, 0x43, 0x54, 0x10, 0x02, 0x42, 0x4f, 0x5a, 0x37, + 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, + 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, + 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2f, 0x67, 0x72, 0x70, 0x63, + 0x3b, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0xaa, 0x02, 0x13, 0x4e, 0x65, 0x6f, 0x46, 0x53, 0x2e, + 0x41, 0x50, 0x49, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( - ErrInvalidLengthTypes = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowTypes = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupTypes = fmt.Errorf("proto: unexpected end of group") + file_v2_netmap_grpc_types_proto_rawDescOnce sync.Once + file_v2_netmap_grpc_types_proto_rawDescData = file_v2_netmap_grpc_types_proto_rawDesc ) + +func file_v2_netmap_grpc_types_proto_rawDescGZIP() []byte { + file_v2_netmap_grpc_types_proto_rawDescOnce.Do(func() { + file_v2_netmap_grpc_types_proto_rawDescData = protoimpl.X.CompressGZIP(file_v2_netmap_grpc_types_proto_rawDescData) + }) + return file_v2_netmap_grpc_types_proto_rawDescData +} + +var file_v2_netmap_grpc_types_proto_enumTypes = make([]protoimpl.EnumInfo, 3) +var file_v2_netmap_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 6) +var file_v2_netmap_grpc_types_proto_goTypes = []interface{}{ + (Operation)(0), // 0: neo.fs.v2.netmap.Operation + (Clause)(0), // 1: neo.fs.v2.netmap.Clause + (NodeInfo_State)(0), // 2: neo.fs.v2.netmap.NodeInfo.State + (*Filter)(nil), // 3: neo.fs.v2.netmap.Filter + (*Selector)(nil), // 4: neo.fs.v2.netmap.Selector + (*Replica)(nil), // 5: neo.fs.v2.netmap.Replica + (*PlacementPolicy)(nil), // 6: neo.fs.v2.netmap.PlacementPolicy + (*NodeInfo)(nil), // 7: neo.fs.v2.netmap.NodeInfo + (*NodeInfo_Attribute)(nil), // 8: neo.fs.v2.netmap.NodeInfo.Attribute +} +var file_v2_netmap_grpc_types_proto_depIdxs = []int32{ + 0, // 0: neo.fs.v2.netmap.Filter.op:type_name -> neo.fs.v2.netmap.Operation + 3, // 1: neo.fs.v2.netmap.Filter.filters:type_name -> neo.fs.v2.netmap.Filter + 1, // 2: neo.fs.v2.netmap.Selector.clause:type_name -> neo.fs.v2.netmap.Clause + 5, // 3: neo.fs.v2.netmap.PlacementPolicy.replicas:type_name -> neo.fs.v2.netmap.Replica + 4, // 4: neo.fs.v2.netmap.PlacementPolicy.selectors:type_name -> neo.fs.v2.netmap.Selector + 3, // 5: neo.fs.v2.netmap.PlacementPolicy.filters:type_name -> neo.fs.v2.netmap.Filter + 8, // 6: neo.fs.v2.netmap.NodeInfo.attributes:type_name -> neo.fs.v2.netmap.NodeInfo.Attribute + 2, // 7: neo.fs.v2.netmap.NodeInfo.state:type_name -> neo.fs.v2.netmap.NodeInfo.State + 8, // [8:8] is the sub-list for method output_type + 8, // [8:8] 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_v2_netmap_grpc_types_proto_init() } +func file_v2_netmap_grpc_types_proto_init() { + if File_v2_netmap_grpc_types_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_v2_netmap_grpc_types_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Filter); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_netmap_grpc_types_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Selector); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_netmap_grpc_types_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Replica); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_netmap_grpc_types_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PlacementPolicy); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_netmap_grpc_types_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*NodeInfo); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_netmap_grpc_types_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*NodeInfo_Attribute); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_v2_netmap_grpc_types_proto_rawDesc, + NumEnums: 3, + NumMessages: 6, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_v2_netmap_grpc_types_proto_goTypes, + DependencyIndexes: file_v2_netmap_grpc_types_proto_depIdxs, + EnumInfos: file_v2_netmap_grpc_types_proto_enumTypes, + MessageInfos: file_v2_netmap_grpc_types_proto_msgTypes, + }.Build() + File_v2_netmap_grpc_types_proto = out.File + file_v2_netmap_grpc_types_proto_rawDesc = nil + file_v2_netmap_grpc_types_proto_goTypes = nil + file_v2_netmap_grpc_types_proto_depIdxs = nil +} diff --git a/v2/netmap/marshal_test.go b/v2/netmap/marshal_test.go index 82132a0..361bc50 100644 --- a/v2/netmap/marshal_test.go +++ b/v2/netmap/marshal_test.go @@ -8,6 +8,7 @@ import ( grpc "github.com/nspcc-dev/neofs-api-go/v2/netmap/grpc" "github.com/nspcc-dev/neofs-api-go/v2/refs" "github.com/stretchr/testify/require" + goproto "google.golang.org/protobuf/proto" ) func TestAttribute_StableMarshal(t *testing.T) { @@ -18,7 +19,7 @@ func TestAttribute_StableMarshal(t *testing.T) { wire, err := from.StableMarshal(nil) require.NoError(t, err) - err = transport.Unmarshal(wire) + err = goproto.Unmarshal(wire, transport) require.NoError(t, err) to := netmap.AttributeFromGRPCMessage(transport) @@ -34,7 +35,7 @@ func TestNodeInfo_StableMarshal(t *testing.T) { wire, err := from.StableMarshal(nil) require.NoError(t, err) - err = transport.Unmarshal(wire) + err = goproto.Unmarshal(wire, transport) require.NoError(t, err) to := netmap.NodeInfoFromGRPCMessage(transport) @@ -50,7 +51,7 @@ func TestFilter_StableMarshal(t *testing.T) { wire, err := from.StableMarshal(nil) require.NoError(t, err) - err = transport.Unmarshal(wire) + err = goproto.Unmarshal(wire, transport) require.NoError(t, err) to := netmap.FilterFromGRPCMessage(transport) @@ -66,7 +67,7 @@ func TestSelector_StableMarshal(t *testing.T) { wire, err := from.StableMarshal(nil) require.NoError(t, err) - err = transport.Unmarshal(wire) + err = goproto.Unmarshal(wire, transport) require.NoError(t, err) to := netmap.SelectorFromGRPCMessage(transport) @@ -82,7 +83,7 @@ func TestReplica_StableMarshal(t *testing.T) { wire, err := from.StableMarshal(nil) require.NoError(t, err) - err = transport.Unmarshal(wire) + err = goproto.Unmarshal(wire, transport) require.NoError(t, err) to := netmap.ReplicaFromGRPCMessage(transport) @@ -98,7 +99,7 @@ func TestPlacementPolicy_StableMarshal(t *testing.T) { wire, err := from.StableMarshal(nil) require.NoError(t, err) - err = transport.Unmarshal(wire) + err = goproto.Unmarshal(wire, transport) require.NoError(t, err) to := netmap.PlacementPolicyFromGRPCMessage(transport) @@ -114,7 +115,7 @@ func TestLocalNodeInfoResponseBody_StableMarshal(t *testing.T) { wire, err := from.StableMarshal(nil) require.NoError(t, err) - err = transport.Unmarshal(wire) + err = goproto.Unmarshal(wire, transport) require.NoError(t, err) to := netmap.LocalNodeInfoResponseBodyFromGRPCMessage(transport) diff --git a/v2/object/grpc/service.pb.go b/v2/object/grpc/service.pb.go index 1f5276a..0f82c0f 100644 --- a/v2/object/grpc/service.pb.go +++ b/v2/object/grpc/service.pb.go @@ -1,35 +1,42 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.23.0 +// protoc v3.13.0 // source: v2/object/grpc/service.proto package object import ( context "context" - fmt "fmt" proto "github.com/golang/protobuf/proto" grpc1 "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" grpc "github.com/nspcc-dev/neofs-api-go/v2/session/grpc" grpc2 "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" - io "io" - math "math" - math_bits "math/bits" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +// This is a compile-time assertion that a sufficiently up-to-date version +// of the legacy proto package is being used. +const _ = proto.ProtoPackageIsVersion4 // GET object request type GetRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // Body of get object request message. Body *GetRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` // Carries request meta information. Header data is used only to regulate @@ -38,127 +45,68 @@ type GetRequest struct { // 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,proto3" json:"verify_header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + VerifyHeader *grpc.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` } -func (m *GetRequest) Reset() { *m = GetRequest{} } -func (m *GetRequest) String() string { return proto.CompactTextString(m) } -func (*GetRequest) ProtoMessage() {} +func (x *GetRequest) Reset() { + *x = GetRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_object_grpc_service_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetRequest) ProtoMessage() {} + +func (x *GetRequest) ProtoReflect() protoreflect.Message { + mi := &file_v2_object_grpc_service_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetRequest.ProtoReflect.Descriptor instead. func (*GetRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_1d7d92b1e85e5b48, []int{0} -} -func (m *GetRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *GetRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_GetRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *GetRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetRequest.Merge(m, src) -} -func (m *GetRequest) XXX_Size() int { - return m.Size() -} -func (m *GetRequest) XXX_DiscardUnknown() { - xxx_messageInfo_GetRequest.DiscardUnknown(m) + return file_v2_object_grpc_service_proto_rawDescGZIP(), []int{0} } -var xxx_messageInfo_GetRequest proto.InternalMessageInfo - -func (m *GetRequest) GetBody() *GetRequest_Body { - if m != nil { - return m.Body +func (x *GetRequest) GetBody() *GetRequest_Body { + if x != nil { + return x.Body } return nil } -func (m *GetRequest) GetMetaHeader() *grpc.RequestMetaHeader { - if m != nil { - return m.MetaHeader +func (x *GetRequest) GetMetaHeader() *grpc.RequestMetaHeader { + if x != nil { + return x.MetaHeader } return nil } -func (m *GetRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { - if m != nil { - return m.VerifyHeader +func (x *GetRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { + if x != nil { + return x.VerifyHeader } return nil } -// GET Object request body -type GetRequest_Body struct { - // Address of the requested object - Address *grpc1.Address `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` - // If `raw` flag is set, request will work only with objects that are - // physically stored on the peer node - Raw bool `protobuf:"varint,2,opt,name=raw,proto3" json:"raw,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GetRequest_Body) Reset() { *m = GetRequest_Body{} } -func (m *GetRequest_Body) String() string { return proto.CompactTextString(m) } -func (*GetRequest_Body) ProtoMessage() {} -func (*GetRequest_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_1d7d92b1e85e5b48, []int{0, 0} -} -func (m *GetRequest_Body) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *GetRequest_Body) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_GetRequest_Body.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *GetRequest_Body) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetRequest_Body.Merge(m, src) -} -func (m *GetRequest_Body) XXX_Size() int { - return m.Size() -} -func (m *GetRequest_Body) XXX_DiscardUnknown() { - xxx_messageInfo_GetRequest_Body.DiscardUnknown(m) -} - -var xxx_messageInfo_GetRequest_Body proto.InternalMessageInfo - -func (m *GetRequest_Body) GetAddress() *grpc1.Address { - if m != nil { - return m.Address - } - return nil -} - -func (m *GetRequest_Body) GetRaw() bool { - if m != nil { - return m.Raw - } - return false -} - // GET object response type GetResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // Body of get object response message. Body *GetResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` // Carries response meta information. Header data is used only to regulate @@ -167,227 +115,68 @@ type GetResponse struct { // 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,proto3" json:"verify_header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + VerifyHeader *grpc.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` } -func (m *GetResponse) Reset() { *m = GetResponse{} } -func (m *GetResponse) String() string { return proto.CompactTextString(m) } -func (*GetResponse) ProtoMessage() {} +func (x *GetResponse) Reset() { + *x = GetResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_object_grpc_service_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetResponse) ProtoMessage() {} + +func (x *GetResponse) ProtoReflect() protoreflect.Message { + mi := &file_v2_object_grpc_service_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetResponse.ProtoReflect.Descriptor instead. func (*GetResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_1d7d92b1e85e5b48, []int{1} -} -func (m *GetResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *GetResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_GetResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *GetResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetResponse.Merge(m, src) -} -func (m *GetResponse) XXX_Size() int { - return m.Size() -} -func (m *GetResponse) XXX_DiscardUnknown() { - xxx_messageInfo_GetResponse.DiscardUnknown(m) + return file_v2_object_grpc_service_proto_rawDescGZIP(), []int{1} } -var xxx_messageInfo_GetResponse proto.InternalMessageInfo - -func (m *GetResponse) GetBody() *GetResponse_Body { - if m != nil { - return m.Body +func (x *GetResponse) GetBody() *GetResponse_Body { + if x != nil { + return x.Body } return nil } -func (m *GetResponse) GetMetaHeader() *grpc.ResponseMetaHeader { - if m != nil { - return m.MetaHeader +func (x *GetResponse) GetMetaHeader() *grpc.ResponseMetaHeader { + if x != nil { + return x.MetaHeader } return nil } -func (m *GetResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { - if m != nil { - return m.VerifyHeader - } - return nil -} - -// GET Object Response body -type GetResponse_Body struct { - // Single message in the response stream. - // - // Types that are valid to be assigned to ObjectPart: - // *GetResponse_Body_Init_ - // *GetResponse_Body_Chunk - ObjectPart isGetResponse_Body_ObjectPart `protobuf_oneof:"object_part"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GetResponse_Body) Reset() { *m = GetResponse_Body{} } -func (m *GetResponse_Body) String() string { return proto.CompactTextString(m) } -func (*GetResponse_Body) ProtoMessage() {} -func (*GetResponse_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_1d7d92b1e85e5b48, []int{1, 0} -} -func (m *GetResponse_Body) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *GetResponse_Body) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_GetResponse_Body.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *GetResponse_Body) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetResponse_Body.Merge(m, src) -} -func (m *GetResponse_Body) XXX_Size() int { - return m.Size() -} -func (m *GetResponse_Body) XXX_DiscardUnknown() { - xxx_messageInfo_GetResponse_Body.DiscardUnknown(m) -} - -var xxx_messageInfo_GetResponse_Body proto.InternalMessageInfo - -type isGetResponse_Body_ObjectPart interface { - isGetResponse_Body_ObjectPart() - MarshalTo([]byte) (int, error) - Size() int -} - -type GetResponse_Body_Init_ struct { - Init *GetResponse_Body_Init `protobuf:"bytes,1,opt,name=init,proto3,oneof" json:"init,omitempty"` -} -type GetResponse_Body_Chunk struct { - Chunk []byte `protobuf:"bytes,2,opt,name=chunk,proto3,oneof" json:"chunk,omitempty"` -} - -func (*GetResponse_Body_Init_) isGetResponse_Body_ObjectPart() {} -func (*GetResponse_Body_Chunk) isGetResponse_Body_ObjectPart() {} - -func (m *GetResponse_Body) GetObjectPart() isGetResponse_Body_ObjectPart { - if m != nil { - return m.ObjectPart - } - return nil -} - -func (m *GetResponse_Body) GetInit() *GetResponse_Body_Init { - if x, ok := m.GetObjectPart().(*GetResponse_Body_Init_); ok { - return x.Init - } - return nil -} - -func (m *GetResponse_Body) GetChunk() []byte { - if x, ok := m.GetObjectPart().(*GetResponse_Body_Chunk); ok { - return x.Chunk - } - return nil -} - -// XXX_OneofWrappers is for the internal use of the proto package. -func (*GetResponse_Body) XXX_OneofWrappers() []interface{} { - return []interface{}{ - (*GetResponse_Body_Init_)(nil), - (*GetResponse_Body_Chunk)(nil), - } -} - -// Initial part of the `Object` structure stream. Technically it's a -// set of all `Object` structure's fields except `payload`. -type GetResponse_Body_Init struct { - // Object's unique identifier. - ObjectId *grpc1.ObjectID `protobuf:"bytes,1,opt,name=object_id,json=objectId,proto3" json:"object_id,omitempty"` - // Signed `ObjectID` - Signature *grpc1.Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` - // Object metadata headers - Header *Header `protobuf:"bytes,3,opt,name=header,proto3" json:"header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GetResponse_Body_Init) Reset() { *m = GetResponse_Body_Init{} } -func (m *GetResponse_Body_Init) String() string { return proto.CompactTextString(m) } -func (*GetResponse_Body_Init) ProtoMessage() {} -func (*GetResponse_Body_Init) Descriptor() ([]byte, []int) { - return fileDescriptor_1d7d92b1e85e5b48, []int{1, 0, 0} -} -func (m *GetResponse_Body_Init) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *GetResponse_Body_Init) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_GetResponse_Body_Init.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *GetResponse_Body_Init) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetResponse_Body_Init.Merge(m, src) -} -func (m *GetResponse_Body_Init) XXX_Size() int { - return m.Size() -} -func (m *GetResponse_Body_Init) XXX_DiscardUnknown() { - xxx_messageInfo_GetResponse_Body_Init.DiscardUnknown(m) -} - -var xxx_messageInfo_GetResponse_Body_Init proto.InternalMessageInfo - -func (m *GetResponse_Body_Init) GetObjectId() *grpc1.ObjectID { - if m != nil { - return m.ObjectId - } - return nil -} - -func (m *GetResponse_Body_Init) GetSignature() *grpc1.Signature { - if m != nil { - return m.Signature - } - return nil -} - -func (m *GetResponse_Body_Init) GetHeader() *Header { - if m != nil { - return m.Header +func (x *GetResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { + if x != nil { + return x.VerifyHeader } return nil } // PUT object request type PutRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // Body of put object request message. Body *PutRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` // Carries request meta information. Header data is used only to regulate @@ -396,237 +185,68 @@ type PutRequest struct { // 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,proto3" json:"verify_header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + VerifyHeader *grpc.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` } -func (m *PutRequest) Reset() { *m = PutRequest{} } -func (m *PutRequest) String() string { return proto.CompactTextString(m) } -func (*PutRequest) ProtoMessage() {} +func (x *PutRequest) Reset() { + *x = PutRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_object_grpc_service_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PutRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PutRequest) ProtoMessage() {} + +func (x *PutRequest) ProtoReflect() protoreflect.Message { + mi := &file_v2_object_grpc_service_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PutRequest.ProtoReflect.Descriptor instead. func (*PutRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_1d7d92b1e85e5b48, []int{2} -} -func (m *PutRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *PutRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_PutRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *PutRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_PutRequest.Merge(m, src) -} -func (m *PutRequest) XXX_Size() int { - return m.Size() -} -func (m *PutRequest) XXX_DiscardUnknown() { - xxx_messageInfo_PutRequest.DiscardUnknown(m) + return file_v2_object_grpc_service_proto_rawDescGZIP(), []int{2} } -var xxx_messageInfo_PutRequest proto.InternalMessageInfo - -func (m *PutRequest) GetBody() *PutRequest_Body { - if m != nil { - return m.Body +func (x *PutRequest) GetBody() *PutRequest_Body { + if x != nil { + return x.Body } return nil } -func (m *PutRequest) GetMetaHeader() *grpc.RequestMetaHeader { - if m != nil { - return m.MetaHeader +func (x *PutRequest) GetMetaHeader() *grpc.RequestMetaHeader { + if x != nil { + return x.MetaHeader } return nil } -func (m *PutRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { - if m != nil { - return m.VerifyHeader +func (x *PutRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { + if x != nil { + return x.VerifyHeader } return nil } -// PUT request body -type PutRequest_Body struct { - // Single message in the request stream. - // - // Types that are valid to be assigned to ObjectPart: - // *PutRequest_Body_Init_ - // *PutRequest_Body_Chunk - ObjectPart isPutRequest_Body_ObjectPart `protobuf_oneof:"object_part"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *PutRequest_Body) Reset() { *m = PutRequest_Body{} } -func (m *PutRequest_Body) String() string { return proto.CompactTextString(m) } -func (*PutRequest_Body) ProtoMessage() {} -func (*PutRequest_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_1d7d92b1e85e5b48, []int{2, 0} -} -func (m *PutRequest_Body) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *PutRequest_Body) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_PutRequest_Body.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *PutRequest_Body) XXX_Merge(src proto.Message) { - xxx_messageInfo_PutRequest_Body.Merge(m, src) -} -func (m *PutRequest_Body) XXX_Size() int { - return m.Size() -} -func (m *PutRequest_Body) XXX_DiscardUnknown() { - xxx_messageInfo_PutRequest_Body.DiscardUnknown(m) -} - -var xxx_messageInfo_PutRequest_Body proto.InternalMessageInfo - -type isPutRequest_Body_ObjectPart interface { - isPutRequest_Body_ObjectPart() - MarshalTo([]byte) (int, error) - Size() int -} - -type PutRequest_Body_Init_ struct { - Init *PutRequest_Body_Init `protobuf:"bytes,1,opt,name=init,proto3,oneof" json:"init,omitempty"` -} -type PutRequest_Body_Chunk struct { - Chunk []byte `protobuf:"bytes,2,opt,name=chunk,proto3,oneof" json:"chunk,omitempty"` -} - -func (*PutRequest_Body_Init_) isPutRequest_Body_ObjectPart() {} -func (*PutRequest_Body_Chunk) isPutRequest_Body_ObjectPart() {} - -func (m *PutRequest_Body) GetObjectPart() isPutRequest_Body_ObjectPart { - if m != nil { - return m.ObjectPart - } - return nil -} - -func (m *PutRequest_Body) GetInit() *PutRequest_Body_Init { - if x, ok := m.GetObjectPart().(*PutRequest_Body_Init_); ok { - return x.Init - } - return nil -} - -func (m *PutRequest_Body) GetChunk() []byte { - if x, ok := m.GetObjectPart().(*PutRequest_Body_Chunk); ok { - return x.Chunk - } - return nil -} - -// XXX_OneofWrappers is for the internal use of the proto package. -func (*PutRequest_Body) XXX_OneofWrappers() []interface{} { - return []interface{}{ - (*PutRequest_Body_Init_)(nil), - (*PutRequest_Body_Chunk)(nil), - } -} - -// Newly created object structure parameters. If some optional parameters -// are not set, they will be calculated by a peer node. -type PutRequest_Body_Init struct { - // ObjectID if available. - ObjectId *grpc1.ObjectID `protobuf:"bytes,1,opt,name=object_id,json=objectId,proto3" json:"object_id,omitempty"` - // Object signature if available - Signature *grpc1.Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` - // Object's Header - Header *Header `protobuf:"bytes,3,opt,name=header,proto3" json:"header,omitempty"` - // Number of the object copies to store within the RPC call. By default - // object is processed according to the container's placement policy. - CopiesNumber uint32 `protobuf:"varint,4,opt,name=copies_number,json=copiesNumber,proto3" json:"copies_number,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *PutRequest_Body_Init) Reset() { *m = PutRequest_Body_Init{} } -func (m *PutRequest_Body_Init) String() string { return proto.CompactTextString(m) } -func (*PutRequest_Body_Init) ProtoMessage() {} -func (*PutRequest_Body_Init) Descriptor() ([]byte, []int) { - return fileDescriptor_1d7d92b1e85e5b48, []int{2, 0, 0} -} -func (m *PutRequest_Body_Init) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *PutRequest_Body_Init) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_PutRequest_Body_Init.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *PutRequest_Body_Init) XXX_Merge(src proto.Message) { - xxx_messageInfo_PutRequest_Body_Init.Merge(m, src) -} -func (m *PutRequest_Body_Init) XXX_Size() int { - return m.Size() -} -func (m *PutRequest_Body_Init) XXX_DiscardUnknown() { - xxx_messageInfo_PutRequest_Body_Init.DiscardUnknown(m) -} - -var xxx_messageInfo_PutRequest_Body_Init proto.InternalMessageInfo - -func (m *PutRequest_Body_Init) GetObjectId() *grpc1.ObjectID { - if m != nil { - return m.ObjectId - } - return nil -} - -func (m *PutRequest_Body_Init) GetSignature() *grpc1.Signature { - if m != nil { - return m.Signature - } - return nil -} - -func (m *PutRequest_Body_Init) GetHeader() *Header { - if m != nil { - return m.Header - } - return nil -} - -func (m *PutRequest_Body_Init) GetCopiesNumber() uint32 { - if m != nil { - return m.CopiesNumber - } - return 0 -} - // PUT Object response type PutResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // Body of put object response message. Body *PutResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` // Carries response meta information. Header data is used only to regulate @@ -635,117 +255,68 @@ type PutResponse struct { // 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,proto3" json:"verify_header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + VerifyHeader *grpc.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` } -func (m *PutResponse) Reset() { *m = PutResponse{} } -func (m *PutResponse) String() string { return proto.CompactTextString(m) } -func (*PutResponse) ProtoMessage() {} +func (x *PutResponse) Reset() { + *x = PutResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_object_grpc_service_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PutResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PutResponse) ProtoMessage() {} + +func (x *PutResponse) ProtoReflect() protoreflect.Message { + mi := &file_v2_object_grpc_service_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PutResponse.ProtoReflect.Descriptor instead. func (*PutResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_1d7d92b1e85e5b48, []int{3} -} -func (m *PutResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *PutResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_PutResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *PutResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_PutResponse.Merge(m, src) -} -func (m *PutResponse) XXX_Size() int { - return m.Size() -} -func (m *PutResponse) XXX_DiscardUnknown() { - xxx_messageInfo_PutResponse.DiscardUnknown(m) + return file_v2_object_grpc_service_proto_rawDescGZIP(), []int{3} } -var xxx_messageInfo_PutResponse proto.InternalMessageInfo - -func (m *PutResponse) GetBody() *PutResponse_Body { - if m != nil { - return m.Body +func (x *PutResponse) GetBody() *PutResponse_Body { + if x != nil { + return x.Body } return nil } -func (m *PutResponse) GetMetaHeader() *grpc.ResponseMetaHeader { - if m != nil { - return m.MetaHeader +func (x *PutResponse) GetMetaHeader() *grpc.ResponseMetaHeader { + if x != nil { + return x.MetaHeader } return nil } -func (m *PutResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { - if m != nil { - return m.VerifyHeader - } - return nil -} - -// PUT Object response body -type PutResponse_Body struct { - // Identifier of the saved object - ObjectId *grpc1.ObjectID `protobuf:"bytes,1,opt,name=object_id,json=objectId,proto3" json:"object_id,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *PutResponse_Body) Reset() { *m = PutResponse_Body{} } -func (m *PutResponse_Body) String() string { return proto.CompactTextString(m) } -func (*PutResponse_Body) ProtoMessage() {} -func (*PutResponse_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_1d7d92b1e85e5b48, []int{3, 0} -} -func (m *PutResponse_Body) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *PutResponse_Body) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_PutResponse_Body.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *PutResponse_Body) XXX_Merge(src proto.Message) { - xxx_messageInfo_PutResponse_Body.Merge(m, src) -} -func (m *PutResponse_Body) XXX_Size() int { - return m.Size() -} -func (m *PutResponse_Body) XXX_DiscardUnknown() { - xxx_messageInfo_PutResponse_Body.DiscardUnknown(m) -} - -var xxx_messageInfo_PutResponse_Body proto.InternalMessageInfo - -func (m *PutResponse_Body) GetObjectId() *grpc1.ObjectID { - if m != nil { - return m.ObjectId +func (x *PutResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { + if x != nil { + return x.VerifyHeader } return nil } // Object DELETE request type DeleteRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // Body of delete object request message. Body *DeleteRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` // Carries request meta information. Header data is used only to regulate @@ -754,111 +325,58 @@ type DeleteRequest struct { // 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,proto3" json:"verify_header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + VerifyHeader *grpc.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` } -func (m *DeleteRequest) Reset() { *m = DeleteRequest{} } -func (m *DeleteRequest) String() string { return proto.CompactTextString(m) } -func (*DeleteRequest) ProtoMessage() {} +func (x *DeleteRequest) Reset() { + *x = DeleteRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_object_grpc_service_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeleteRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteRequest) ProtoMessage() {} + +func (x *DeleteRequest) ProtoReflect() protoreflect.Message { + mi := &file_v2_object_grpc_service_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteRequest.ProtoReflect.Descriptor instead. func (*DeleteRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_1d7d92b1e85e5b48, []int{4} -} -func (m *DeleteRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *DeleteRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_DeleteRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *DeleteRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_DeleteRequest.Merge(m, src) -} -func (m *DeleteRequest) XXX_Size() int { - return m.Size() -} -func (m *DeleteRequest) XXX_DiscardUnknown() { - xxx_messageInfo_DeleteRequest.DiscardUnknown(m) + return file_v2_object_grpc_service_proto_rawDescGZIP(), []int{4} } -var xxx_messageInfo_DeleteRequest proto.InternalMessageInfo - -func (m *DeleteRequest) GetBody() *DeleteRequest_Body { - if m != nil { - return m.Body +func (x *DeleteRequest) GetBody() *DeleteRequest_Body { + if x != nil { + return x.Body } return nil } -func (m *DeleteRequest) GetMetaHeader() *grpc.RequestMetaHeader { - if m != nil { - return m.MetaHeader +func (x *DeleteRequest) GetMetaHeader() *grpc.RequestMetaHeader { + if x != nil { + return x.MetaHeader } return nil } -func (m *DeleteRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { - if m != nil { - return m.VerifyHeader - } - return nil -} - -// Object DELETE request body -type DeleteRequest_Body struct { - // Address of the object to be deleted - Address *grpc1.Address `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *DeleteRequest_Body) Reset() { *m = DeleteRequest_Body{} } -func (m *DeleteRequest_Body) String() string { return proto.CompactTextString(m) } -func (*DeleteRequest_Body) ProtoMessage() {} -func (*DeleteRequest_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_1d7d92b1e85e5b48, []int{4, 0} -} -func (m *DeleteRequest_Body) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *DeleteRequest_Body) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_DeleteRequest_Body.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *DeleteRequest_Body) XXX_Merge(src proto.Message) { - xxx_messageInfo_DeleteRequest_Body.Merge(m, src) -} -func (m *DeleteRequest_Body) XXX_Size() int { - return m.Size() -} -func (m *DeleteRequest_Body) XXX_DiscardUnknown() { - xxx_messageInfo_DeleteRequest_Body.DiscardUnknown(m) -} - -var xxx_messageInfo_DeleteRequest_Body proto.InternalMessageInfo - -func (m *DeleteRequest_Body) GetAddress() *grpc1.Address { - if m != nil { - return m.Address +func (x *DeleteRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { + if x != nil { + return x.VerifyHeader } return nil } @@ -866,6 +384,10 @@ func (m *DeleteRequest_Body) GetAddress() *grpc1.Address { // DeleteResponse body is empty because we cannot guarantee permanent object // removal in distributed system. type DeleteResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // Body of delete object response message. Body *DeleteResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` // Carries response meta information. Header data is used only to regulate @@ -874,108 +396,68 @@ type DeleteResponse struct { // 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,proto3" json:"verify_header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + VerifyHeader *grpc.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` } -func (m *DeleteResponse) Reset() { *m = DeleteResponse{} } -func (m *DeleteResponse) String() string { return proto.CompactTextString(m) } -func (*DeleteResponse) ProtoMessage() {} +func (x *DeleteResponse) Reset() { + *x = DeleteResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_object_grpc_service_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeleteResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteResponse) ProtoMessage() {} + +func (x *DeleteResponse) ProtoReflect() protoreflect.Message { + mi := &file_v2_object_grpc_service_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteResponse.ProtoReflect.Descriptor instead. func (*DeleteResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_1d7d92b1e85e5b48, []int{5} -} -func (m *DeleteResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *DeleteResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_DeleteResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *DeleteResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_DeleteResponse.Merge(m, src) -} -func (m *DeleteResponse) XXX_Size() int { - return m.Size() -} -func (m *DeleteResponse) XXX_DiscardUnknown() { - xxx_messageInfo_DeleteResponse.DiscardUnknown(m) + return file_v2_object_grpc_service_proto_rawDescGZIP(), []int{5} } -var xxx_messageInfo_DeleteResponse proto.InternalMessageInfo - -func (m *DeleteResponse) GetBody() *DeleteResponse_Body { - if m != nil { - return m.Body +func (x *DeleteResponse) GetBody() *DeleteResponse_Body { + if x != nil { + return x.Body } return nil } -func (m *DeleteResponse) GetMetaHeader() *grpc.ResponseMetaHeader { - if m != nil { - return m.MetaHeader +func (x *DeleteResponse) GetMetaHeader() *grpc.ResponseMetaHeader { + if x != nil { + return x.MetaHeader } return nil } -func (m *DeleteResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { - if m != nil { - return m.VerifyHeader +func (x *DeleteResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { + if x != nil { + return x.VerifyHeader } return nil } -// Object DELETE Response has an empty body. -type DeleteResponse_Body struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *DeleteResponse_Body) Reset() { *m = DeleteResponse_Body{} } -func (m *DeleteResponse_Body) String() string { return proto.CompactTextString(m) } -func (*DeleteResponse_Body) ProtoMessage() {} -func (*DeleteResponse_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_1d7d92b1e85e5b48, []int{5, 0} -} -func (m *DeleteResponse_Body) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *DeleteResponse_Body) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_DeleteResponse_Body.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *DeleteResponse_Body) XXX_Merge(src proto.Message) { - xxx_messageInfo_DeleteResponse_Body.Merge(m, src) -} -func (m *DeleteResponse_Body) XXX_Size() int { - return m.Size() -} -func (m *DeleteResponse_Body) XXX_DiscardUnknown() { - xxx_messageInfo_DeleteResponse_Body.DiscardUnknown(m) -} - -var xxx_messageInfo_DeleteResponse_Body proto.InternalMessageInfo - // Object HEAD request type HeadRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // Body of head object request message. Body *HeadRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` // Carries request meta information. Header data is used only to regulate @@ -984,134 +466,62 @@ type HeadRequest struct { // 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,proto3" json:"verify_header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + VerifyHeader *grpc.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` } -func (m *HeadRequest) Reset() { *m = HeadRequest{} } -func (m *HeadRequest) String() string { return proto.CompactTextString(m) } -func (*HeadRequest) ProtoMessage() {} +func (x *HeadRequest) Reset() { + *x = HeadRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_object_grpc_service_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *HeadRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HeadRequest) ProtoMessage() {} + +func (x *HeadRequest) ProtoReflect() protoreflect.Message { + mi := &file_v2_object_grpc_service_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HeadRequest.ProtoReflect.Descriptor instead. func (*HeadRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_1d7d92b1e85e5b48, []int{6} -} -func (m *HeadRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *HeadRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_HeadRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *HeadRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_HeadRequest.Merge(m, src) -} -func (m *HeadRequest) XXX_Size() int { - return m.Size() -} -func (m *HeadRequest) XXX_DiscardUnknown() { - xxx_messageInfo_HeadRequest.DiscardUnknown(m) + return file_v2_object_grpc_service_proto_rawDescGZIP(), []int{6} } -var xxx_messageInfo_HeadRequest proto.InternalMessageInfo - -func (m *HeadRequest) GetBody() *HeadRequest_Body { - if m != nil { - return m.Body +func (x *HeadRequest) GetBody() *HeadRequest_Body { + if x != nil { + return x.Body } return nil } -func (m *HeadRequest) GetMetaHeader() *grpc.RequestMetaHeader { - if m != nil { - return m.MetaHeader +func (x *HeadRequest) GetMetaHeader() *grpc.RequestMetaHeader { + if x != nil { + return x.MetaHeader } return nil } -func (m *HeadRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { - if m != nil { - return m.VerifyHeader +func (x *HeadRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { + if x != nil { + return x.VerifyHeader } return nil } -// Object HEAD request body -type HeadRequest_Body struct { - // Address of the object with the requested Header - Address *grpc1.Address `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` - // Return only minimal header subset - MainOnly bool `protobuf:"varint,2,opt,name=main_only,json=mainOnly,proto3" json:"main_only,omitempty"` - // If `raw` flag is set, request will work only with objects that are - // physically stored on the peer node - Raw bool `protobuf:"varint,3,opt,name=raw,proto3" json:"raw,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *HeadRequest_Body) Reset() { *m = HeadRequest_Body{} } -func (m *HeadRequest_Body) String() string { return proto.CompactTextString(m) } -func (*HeadRequest_Body) ProtoMessage() {} -func (*HeadRequest_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_1d7d92b1e85e5b48, []int{6, 0} -} -func (m *HeadRequest_Body) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *HeadRequest_Body) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_HeadRequest_Body.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *HeadRequest_Body) XXX_Merge(src proto.Message) { - xxx_messageInfo_HeadRequest_Body.Merge(m, src) -} -func (m *HeadRequest_Body) XXX_Size() int { - return m.Size() -} -func (m *HeadRequest_Body) XXX_DiscardUnknown() { - xxx_messageInfo_HeadRequest_Body.DiscardUnknown(m) -} - -var xxx_messageInfo_HeadRequest_Body proto.InternalMessageInfo - -func (m *HeadRequest_Body) GetAddress() *grpc1.Address { - if m != nil { - return m.Address - } - return nil -} - -func (m *HeadRequest_Body) GetMainOnly() bool { - if m != nil { - return m.MainOnly - } - return false -} - -func (m *HeadRequest_Body) GetRaw() bool { - if m != nil { - return m.Raw - } - return false -} - // Tuple of full object header and signature of `ObjectID`. \ // Signed `ObjectID` is present to verify full header's authenticity through the // following steps: @@ -1120,64 +530,68 @@ func (m *HeadRequest_Body) GetRaw() bool { // 2. Check if the resulting hash matched `ObjectID` // 3. Check if `ObjectID` signature in `signature` field is correct type HeaderWithSignature struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // Full object header Header *Header `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` // Signed `ObjectID` to verify full header's authenticity - Signature *grpc1.Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Signature *grpc1.Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` } -func (m *HeaderWithSignature) Reset() { *m = HeaderWithSignature{} } -func (m *HeaderWithSignature) String() string { return proto.CompactTextString(m) } -func (*HeaderWithSignature) ProtoMessage() {} -func (*HeaderWithSignature) Descriptor() ([]byte, []int) { - return fileDescriptor_1d7d92b1e85e5b48, []int{7} -} -func (m *HeaderWithSignature) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *HeaderWithSignature) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_HeaderWithSignature.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil +func (x *HeaderWithSignature) Reset() { + *x = HeaderWithSignature{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_object_grpc_service_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } } -func (m *HeaderWithSignature) XXX_Merge(src proto.Message) { - xxx_messageInfo_HeaderWithSignature.Merge(m, src) -} -func (m *HeaderWithSignature) XXX_Size() int { - return m.Size() -} -func (m *HeaderWithSignature) XXX_DiscardUnknown() { - xxx_messageInfo_HeaderWithSignature.DiscardUnknown(m) + +func (x *HeaderWithSignature) String() string { + return protoimpl.X.MessageStringOf(x) } -var xxx_messageInfo_HeaderWithSignature proto.InternalMessageInfo +func (*HeaderWithSignature) ProtoMessage() {} -func (m *HeaderWithSignature) GetHeader() *Header { - if m != nil { - return m.Header +func (x *HeaderWithSignature) ProtoReflect() protoreflect.Message { + mi := &file_v2_object_grpc_service_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HeaderWithSignature.ProtoReflect.Descriptor instead. +func (*HeaderWithSignature) Descriptor() ([]byte, []int) { + return file_v2_object_grpc_service_proto_rawDescGZIP(), []int{7} +} + +func (x *HeaderWithSignature) GetHeader() *Header { + if x != nil { + return x.Header } return nil } -func (m *HeaderWithSignature) GetSignature() *grpc1.Signature { - if m != nil { - return m.Signature +func (x *HeaderWithSignature) GetSignature() *grpc1.Signature { + if x != nil { + return x.Signature } return nil } // Object HEAD response type HeadResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // Body of head object response message. Body *HeadResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` // Carries response meta information. Header data is used only to regulate @@ -1186,159 +600,68 @@ type HeadResponse struct { // 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,proto3" json:"verify_header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + VerifyHeader *grpc.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` } -func (m *HeadResponse) Reset() { *m = HeadResponse{} } -func (m *HeadResponse) String() string { return proto.CompactTextString(m) } -func (*HeadResponse) ProtoMessage() {} +func (x *HeadResponse) Reset() { + *x = HeadResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_object_grpc_service_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *HeadResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HeadResponse) ProtoMessage() {} + +func (x *HeadResponse) ProtoReflect() protoreflect.Message { + mi := &file_v2_object_grpc_service_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HeadResponse.ProtoReflect.Descriptor instead. func (*HeadResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_1d7d92b1e85e5b48, []int{8} -} -func (m *HeadResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *HeadResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_HeadResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *HeadResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_HeadResponse.Merge(m, src) -} -func (m *HeadResponse) XXX_Size() int { - return m.Size() -} -func (m *HeadResponse) XXX_DiscardUnknown() { - xxx_messageInfo_HeadResponse.DiscardUnknown(m) + return file_v2_object_grpc_service_proto_rawDescGZIP(), []int{8} } -var xxx_messageInfo_HeadResponse proto.InternalMessageInfo - -func (m *HeadResponse) GetBody() *HeadResponse_Body { - if m != nil { - return m.Body +func (x *HeadResponse) GetBody() *HeadResponse_Body { + if x != nil { + return x.Body } return nil } -func (m *HeadResponse) GetMetaHeader() *grpc.ResponseMetaHeader { - if m != nil { - return m.MetaHeader +func (x *HeadResponse) GetMetaHeader() *grpc.ResponseMetaHeader { + if x != nil { + return x.MetaHeader } return nil } -func (m *HeadResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { - if m != nil { - return m.VerifyHeader +func (x *HeadResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { + if x != nil { + return x.VerifyHeader } return nil } -// Object HEAD response body -type HeadResponse_Body struct { - // Requested object header or it's part. - // - // Types that are valid to be assigned to Head: - // *HeadResponse_Body_Header - // *HeadResponse_Body_ShortHeader - Head isHeadResponse_Body_Head `protobuf_oneof:"head"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *HeadResponse_Body) Reset() { *m = HeadResponse_Body{} } -func (m *HeadResponse_Body) String() string { return proto.CompactTextString(m) } -func (*HeadResponse_Body) ProtoMessage() {} -func (*HeadResponse_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_1d7d92b1e85e5b48, []int{8, 0} -} -func (m *HeadResponse_Body) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *HeadResponse_Body) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_HeadResponse_Body.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *HeadResponse_Body) XXX_Merge(src proto.Message) { - xxx_messageInfo_HeadResponse_Body.Merge(m, src) -} -func (m *HeadResponse_Body) XXX_Size() int { - return m.Size() -} -func (m *HeadResponse_Body) XXX_DiscardUnknown() { - xxx_messageInfo_HeadResponse_Body.DiscardUnknown(m) -} - -var xxx_messageInfo_HeadResponse_Body proto.InternalMessageInfo - -type isHeadResponse_Body_Head interface { - isHeadResponse_Body_Head() - MarshalTo([]byte) (int, error) - Size() int -} - -type HeadResponse_Body_Header struct { - Header *HeaderWithSignature `protobuf:"bytes,1,opt,name=header,proto3,oneof" json:"header,omitempty"` -} -type HeadResponse_Body_ShortHeader struct { - ShortHeader *ShortHeader `protobuf:"bytes,2,opt,name=short_header,json=shortHeader,proto3,oneof" json:"short_header,omitempty"` -} - -func (*HeadResponse_Body_Header) isHeadResponse_Body_Head() {} -func (*HeadResponse_Body_ShortHeader) isHeadResponse_Body_Head() {} - -func (m *HeadResponse_Body) GetHead() isHeadResponse_Body_Head { - if m != nil { - return m.Head - } - return nil -} - -func (m *HeadResponse_Body) GetHeader() *HeaderWithSignature { - if x, ok := m.GetHead().(*HeadResponse_Body_Header); ok { - return x.Header - } - return nil -} - -func (m *HeadResponse_Body) GetShortHeader() *ShortHeader { - if x, ok := m.GetHead().(*HeadResponse_Body_ShortHeader); ok { - return x.ShortHeader - } - return nil -} - -// XXX_OneofWrappers is for the internal use of the proto package. -func (*HeadResponse_Body) XXX_OneofWrappers() []interface{} { - return []interface{}{ - (*HeadResponse_Body_Header)(nil), - (*HeadResponse_Body_ShortHeader)(nil), - } -} - // Object Search request type SearchRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // Body of search object request message. Body *SearchRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` // Carries request meta information. Header data is used only to regulate @@ -1347,202 +670,68 @@ type SearchRequest struct { // 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,proto3" json:"verify_header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + VerifyHeader *grpc.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` } -func (m *SearchRequest) Reset() { *m = SearchRequest{} } -func (m *SearchRequest) String() string { return proto.CompactTextString(m) } -func (*SearchRequest) ProtoMessage() {} +func (x *SearchRequest) Reset() { + *x = SearchRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_object_grpc_service_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SearchRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SearchRequest) ProtoMessage() {} + +func (x *SearchRequest) ProtoReflect() protoreflect.Message { + mi := &file_v2_object_grpc_service_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SearchRequest.ProtoReflect.Descriptor instead. func (*SearchRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_1d7d92b1e85e5b48, []int{9} -} -func (m *SearchRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *SearchRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_SearchRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *SearchRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_SearchRequest.Merge(m, src) -} -func (m *SearchRequest) XXX_Size() int { - return m.Size() -} -func (m *SearchRequest) XXX_DiscardUnknown() { - xxx_messageInfo_SearchRequest.DiscardUnknown(m) + return file_v2_object_grpc_service_proto_rawDescGZIP(), []int{9} } -var xxx_messageInfo_SearchRequest proto.InternalMessageInfo - -func (m *SearchRequest) GetBody() *SearchRequest_Body { - if m != nil { - return m.Body +func (x *SearchRequest) GetBody() *SearchRequest_Body { + if x != nil { + return x.Body } return nil } -func (m *SearchRequest) GetMetaHeader() *grpc.RequestMetaHeader { - if m != nil { - return m.MetaHeader +func (x *SearchRequest) GetMetaHeader() *grpc.RequestMetaHeader { + if x != nil { + return x.MetaHeader } return nil } -func (m *SearchRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { - if m != nil { - return m.VerifyHeader +func (x *SearchRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { + if x != nil { + return x.VerifyHeader } return nil } -// Object Search request body -type SearchRequest_Body struct { - // Container identifier were to search - ContainerId *grpc1.ContainerID `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` - // Version of the Query Language used - Version uint32 `protobuf:"varint,2,opt,name=version,proto3" json:"version,omitempty"` - // List of search expressions - Filters []*SearchRequest_Body_Filter `protobuf:"bytes,3,rep,name=filters,proto3" json:"filters,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *SearchRequest_Body) Reset() { *m = SearchRequest_Body{} } -func (m *SearchRequest_Body) String() string { return proto.CompactTextString(m) } -func (*SearchRequest_Body) ProtoMessage() {} -func (*SearchRequest_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_1d7d92b1e85e5b48, []int{9, 0} -} -func (m *SearchRequest_Body) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *SearchRequest_Body) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_SearchRequest_Body.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *SearchRequest_Body) XXX_Merge(src proto.Message) { - xxx_messageInfo_SearchRequest_Body.Merge(m, src) -} -func (m *SearchRequest_Body) XXX_Size() int { - return m.Size() -} -func (m *SearchRequest_Body) XXX_DiscardUnknown() { - xxx_messageInfo_SearchRequest_Body.DiscardUnknown(m) -} - -var xxx_messageInfo_SearchRequest_Body proto.InternalMessageInfo - -func (m *SearchRequest_Body) GetContainerId() *grpc1.ContainerID { - if m != nil { - return m.ContainerId - } - return nil -} - -func (m *SearchRequest_Body) GetVersion() uint32 { - if m != nil { - return m.Version - } - return 0 -} - -func (m *SearchRequest_Body) GetFilters() []*SearchRequest_Body_Filter { - if m != nil { - return m.Filters - } - return nil -} - -// Filter structure -type SearchRequest_Body_Filter struct { - // Match type to use - MatchType MatchType `protobuf:"varint,1,opt,name=match_type,json=matchType,proto3,enum=neo.fs.v2.object.MatchType" json:"match_type,omitempty"` - // Header name to match - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` - // Header value to match - Value string `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *SearchRequest_Body_Filter) Reset() { *m = SearchRequest_Body_Filter{} } -func (m *SearchRequest_Body_Filter) String() string { return proto.CompactTextString(m) } -func (*SearchRequest_Body_Filter) ProtoMessage() {} -func (*SearchRequest_Body_Filter) Descriptor() ([]byte, []int) { - return fileDescriptor_1d7d92b1e85e5b48, []int{9, 0, 0} -} -func (m *SearchRequest_Body_Filter) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *SearchRequest_Body_Filter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_SearchRequest_Body_Filter.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *SearchRequest_Body_Filter) XXX_Merge(src proto.Message) { - xxx_messageInfo_SearchRequest_Body_Filter.Merge(m, src) -} -func (m *SearchRequest_Body_Filter) XXX_Size() int { - return m.Size() -} -func (m *SearchRequest_Body_Filter) XXX_DiscardUnknown() { - xxx_messageInfo_SearchRequest_Body_Filter.DiscardUnknown(m) -} - -var xxx_messageInfo_SearchRequest_Body_Filter proto.InternalMessageInfo - -func (m *SearchRequest_Body_Filter) GetMatchType() MatchType { - if m != nil { - return m.MatchType - } - return MatchType_MATCH_TYPE_UNSPECIFIED -} - -func (m *SearchRequest_Body_Filter) GetName() string { - if m != nil { - return m.Name - } - return "" -} - -func (m *SearchRequest_Body_Filter) GetValue() string { - if m != nil { - return m.Value - } - return "" -} - // Search response type SearchResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // Body of search object response message. Body *SearchResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` // Carries response meta information. Header data is used only to regulate @@ -1551,175 +740,126 @@ type SearchResponse struct { // 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,proto3" json:"verify_header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + VerifyHeader *grpc.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` } -func (m *SearchResponse) Reset() { *m = SearchResponse{} } -func (m *SearchResponse) String() string { return proto.CompactTextString(m) } -func (*SearchResponse) ProtoMessage() {} +func (x *SearchResponse) Reset() { + *x = SearchResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_object_grpc_service_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SearchResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SearchResponse) ProtoMessage() {} + +func (x *SearchResponse) ProtoReflect() protoreflect.Message { + mi := &file_v2_object_grpc_service_proto_msgTypes[10] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SearchResponse.ProtoReflect.Descriptor instead. func (*SearchResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_1d7d92b1e85e5b48, []int{10} -} -func (m *SearchResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *SearchResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_SearchResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *SearchResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_SearchResponse.Merge(m, src) -} -func (m *SearchResponse) XXX_Size() int { - return m.Size() -} -func (m *SearchResponse) XXX_DiscardUnknown() { - xxx_messageInfo_SearchResponse.DiscardUnknown(m) + return file_v2_object_grpc_service_proto_rawDescGZIP(), []int{10} } -var xxx_messageInfo_SearchResponse proto.InternalMessageInfo - -func (m *SearchResponse) GetBody() *SearchResponse_Body { - if m != nil { - return m.Body +func (x *SearchResponse) GetBody() *SearchResponse_Body { + if x != nil { + return x.Body } return nil } -func (m *SearchResponse) GetMetaHeader() *grpc.ResponseMetaHeader { - if m != nil { - return m.MetaHeader +func (x *SearchResponse) GetMetaHeader() *grpc.ResponseMetaHeader { + if x != nil { + return x.MetaHeader } return nil } -func (m *SearchResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { - if m != nil { - return m.VerifyHeader - } - return nil -} - -// Object Search response body -type SearchResponse_Body struct { - // List of `ObjectID`s that match the search query - IdList []*grpc1.ObjectID `protobuf:"bytes,1,rep,name=id_list,json=idList,proto3" json:"id_list,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *SearchResponse_Body) Reset() { *m = SearchResponse_Body{} } -func (m *SearchResponse_Body) String() string { return proto.CompactTextString(m) } -func (*SearchResponse_Body) ProtoMessage() {} -func (*SearchResponse_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_1d7d92b1e85e5b48, []int{10, 0} -} -func (m *SearchResponse_Body) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *SearchResponse_Body) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_SearchResponse_Body.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *SearchResponse_Body) XXX_Merge(src proto.Message) { - xxx_messageInfo_SearchResponse_Body.Merge(m, src) -} -func (m *SearchResponse_Body) XXX_Size() int { - return m.Size() -} -func (m *SearchResponse_Body) XXX_DiscardUnknown() { - xxx_messageInfo_SearchResponse_Body.DiscardUnknown(m) -} - -var xxx_messageInfo_SearchResponse_Body proto.InternalMessageInfo - -func (m *SearchResponse_Body) GetIdList() []*grpc1.ObjectID { - if m != nil { - return m.IdList +func (x *SearchResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { + if x != nil { + return x.VerifyHeader } return nil } // Object payload range.Ranges of zero length SHOULD be considered as invalid. type Range struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // Offset of the range from the object payload start Offset uint64 `protobuf:"varint,1,opt,name=offset,proto3" json:"offset,omitempty"` // Length in bytes of the object payload range - Length uint64 `protobuf:"varint,2,opt,name=length,proto3" json:"length,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Length uint64 `protobuf:"varint,2,opt,name=length,proto3" json:"length,omitempty"` } -func (m *Range) Reset() { *m = Range{} } -func (m *Range) String() string { return proto.CompactTextString(m) } -func (*Range) ProtoMessage() {} -func (*Range) Descriptor() ([]byte, []int) { - return fileDescriptor_1d7d92b1e85e5b48, []int{11} -} -func (m *Range) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Range) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Range.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil +func (x *Range) Reset() { + *x = Range{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_object_grpc_service_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } } -func (m *Range) XXX_Merge(src proto.Message) { - xxx_messageInfo_Range.Merge(m, src) -} -func (m *Range) XXX_Size() int { - return m.Size() -} -func (m *Range) XXX_DiscardUnknown() { - xxx_messageInfo_Range.DiscardUnknown(m) + +func (x *Range) String() string { + return protoimpl.X.MessageStringOf(x) } -var xxx_messageInfo_Range proto.InternalMessageInfo +func (*Range) ProtoMessage() {} -func (m *Range) GetOffset() uint64 { - if m != nil { - return m.Offset +func (x *Range) ProtoReflect() protoreflect.Message { + mi := &file_v2_object_grpc_service_proto_msgTypes[11] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Range.ProtoReflect.Descriptor instead. +func (*Range) Descriptor() ([]byte, []int) { + return file_v2_object_grpc_service_proto_rawDescGZIP(), []int{11} +} + +func (x *Range) GetOffset() uint64 { + if x != nil { + return x.Offset } return 0 } -func (m *Range) GetLength() uint64 { - if m != nil { - return m.Length +func (x *Range) GetLength() uint64 { + if x != nil { + return x.Length } return 0 } // Request part of object's payload type GetRangeRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // Body of get range object request message. Body *GetRangeRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` // Carries request meta information. Header data is used only to regulate @@ -1728,126 +868,68 @@ type GetRangeRequest struct { // 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,proto3" json:"verify_header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + VerifyHeader *grpc.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` } -func (m *GetRangeRequest) Reset() { *m = GetRangeRequest{} } -func (m *GetRangeRequest) String() string { return proto.CompactTextString(m) } -func (*GetRangeRequest) ProtoMessage() {} +func (x *GetRangeRequest) Reset() { + *x = GetRangeRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_object_grpc_service_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetRangeRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetRangeRequest) ProtoMessage() {} + +func (x *GetRangeRequest) ProtoReflect() protoreflect.Message { + mi := &file_v2_object_grpc_service_proto_msgTypes[12] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetRangeRequest.ProtoReflect.Descriptor instead. func (*GetRangeRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_1d7d92b1e85e5b48, []int{12} -} -func (m *GetRangeRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *GetRangeRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_GetRangeRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *GetRangeRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetRangeRequest.Merge(m, src) -} -func (m *GetRangeRequest) XXX_Size() int { - return m.Size() -} -func (m *GetRangeRequest) XXX_DiscardUnknown() { - xxx_messageInfo_GetRangeRequest.DiscardUnknown(m) + return file_v2_object_grpc_service_proto_rawDescGZIP(), []int{12} } -var xxx_messageInfo_GetRangeRequest proto.InternalMessageInfo - -func (m *GetRangeRequest) GetBody() *GetRangeRequest_Body { - if m != nil { - return m.Body +func (x *GetRangeRequest) GetBody() *GetRangeRequest_Body { + if x != nil { + return x.Body } return nil } -func (m *GetRangeRequest) GetMetaHeader() *grpc.RequestMetaHeader { - if m != nil { - return m.MetaHeader +func (x *GetRangeRequest) GetMetaHeader() *grpc.RequestMetaHeader { + if x != nil { + return x.MetaHeader } return nil } -func (m *GetRangeRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { - if m != nil { - return m.VerifyHeader - } - return nil -} - -// Byte range of object's payload request body -type GetRangeRequest_Body struct { - // Address of the object containing the requested payload range - Address *grpc1.Address `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` - // Requested payload range - Range *Range `protobuf:"bytes,2,opt,name=range,proto3" json:"range,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GetRangeRequest_Body) Reset() { *m = GetRangeRequest_Body{} } -func (m *GetRangeRequest_Body) String() string { return proto.CompactTextString(m) } -func (*GetRangeRequest_Body) ProtoMessage() {} -func (*GetRangeRequest_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_1d7d92b1e85e5b48, []int{12, 0} -} -func (m *GetRangeRequest_Body) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *GetRangeRequest_Body) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_GetRangeRequest_Body.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *GetRangeRequest_Body) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetRangeRequest_Body.Merge(m, src) -} -func (m *GetRangeRequest_Body) XXX_Size() int { - return m.Size() -} -func (m *GetRangeRequest_Body) XXX_DiscardUnknown() { - xxx_messageInfo_GetRangeRequest_Body.DiscardUnknown(m) -} - -var xxx_messageInfo_GetRangeRequest_Body proto.InternalMessageInfo - -func (m *GetRangeRequest_Body) GetAddress() *grpc1.Address { - if m != nil { - return m.Address - } - return nil -} - -func (m *GetRangeRequest_Body) GetRange() *Range { - if m != nil { - return m.Range +func (x *GetRangeRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { + if x != nil { + return x.VerifyHeader } return nil } // Get part of object's payload type GetRangeResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // Body of get range object response message. Body *GetRangeResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` // Carries response meta information. Header data is used only to regulate @@ -1856,62 +938,1104 @@ type GetRangeResponse struct { // 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,proto3" json:"verify_header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + VerifyHeader *grpc.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` } -func (m *GetRangeResponse) Reset() { *m = GetRangeResponse{} } -func (m *GetRangeResponse) String() string { return proto.CompactTextString(m) } -func (*GetRangeResponse) ProtoMessage() {} -func (*GetRangeResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_1d7d92b1e85e5b48, []int{13} +func (x *GetRangeResponse) Reset() { + *x = GetRangeResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_object_grpc_service_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *GetRangeResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) + +func (x *GetRangeResponse) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *GetRangeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_GetRangeResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err + +func (*GetRangeResponse) ProtoMessage() {} + +func (x *GetRangeResponse) ProtoReflect() protoreflect.Message { + mi := &file_v2_object_grpc_service_proto_msgTypes[13] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) } - return b[:n], nil + return ms } -} -func (m *GetRangeResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetRangeResponse.Merge(m, src) -} -func (m *GetRangeResponse) XXX_Size() int { - return m.Size() -} -func (m *GetRangeResponse) XXX_DiscardUnknown() { - xxx_messageInfo_GetRangeResponse.DiscardUnknown(m) + return mi.MessageOf(x) } -var xxx_messageInfo_GetRangeResponse proto.InternalMessageInfo +// Deprecated: Use GetRangeResponse.ProtoReflect.Descriptor instead. +func (*GetRangeResponse) Descriptor() ([]byte, []int) { + return file_v2_object_grpc_service_proto_rawDescGZIP(), []int{13} +} -func (m *GetRangeResponse) GetBody() *GetRangeResponse_Body { - if m != nil { - return m.Body +func (x *GetRangeResponse) GetBody() *GetRangeResponse_Body { + if x != nil { + return x.Body } return nil } -func (m *GetRangeResponse) GetMetaHeader() *grpc.ResponseMetaHeader { - if m != nil { - return m.MetaHeader +func (x *GetRangeResponse) GetMetaHeader() *grpc.ResponseMetaHeader { + if x != nil { + return x.MetaHeader } return nil } -func (m *GetRangeResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { +func (x *GetRangeResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} + +// Get hash of object's payload part +type GetRangeHashRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Body of get range hash object request message. + Body *GetRangeHashRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" 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,proto3" json:"verify_header,omitempty"` +} + +func (x *GetRangeHashRequest) Reset() { + *x = GetRangeHashRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_object_grpc_service_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetRangeHashRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetRangeHashRequest) ProtoMessage() {} + +func (x *GetRangeHashRequest) ProtoReflect() protoreflect.Message { + mi := &file_v2_object_grpc_service_proto_msgTypes[14] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetRangeHashRequest.ProtoReflect.Descriptor instead. +func (*GetRangeHashRequest) Descriptor() ([]byte, []int) { + return file_v2_object_grpc_service_proto_rawDescGZIP(), []int{14} +} + +func (x *GetRangeHashRequest) GetBody() *GetRangeHashRequest_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *GetRangeHashRequest) GetMetaHeader() *grpc.RequestMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} + +func (x *GetRangeHashRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} + +// Get hash of object's payload part +type GetRangeHashResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Body of get range hash object response message. + Body *GetRangeHashResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" 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,proto3" json:"verify_header,omitempty"` +} + +func (x *GetRangeHashResponse) Reset() { + *x = GetRangeHashResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_object_grpc_service_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetRangeHashResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetRangeHashResponse) ProtoMessage() {} + +func (x *GetRangeHashResponse) ProtoReflect() protoreflect.Message { + mi := &file_v2_object_grpc_service_proto_msgTypes[15] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetRangeHashResponse.ProtoReflect.Descriptor instead. +func (*GetRangeHashResponse) Descriptor() ([]byte, []int) { + return file_v2_object_grpc_service_proto_rawDescGZIP(), []int{15} +} + +func (x *GetRangeHashResponse) GetBody() *GetRangeHashResponse_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *GetRangeHashResponse) GetMetaHeader() *grpc.ResponseMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} + +func (x *GetRangeHashResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} + +// GET Object request body +type GetRequest_Body struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Address of the requested object + Address *grpc1.Address `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + // If `raw` flag is set, request will work only with objects that are + // physically stored on the peer node + Raw bool `protobuf:"varint,2,opt,name=raw,proto3" json:"raw,omitempty"` +} + +func (x *GetRequest_Body) Reset() { + *x = GetRequest_Body{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_object_grpc_service_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetRequest_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetRequest_Body) ProtoMessage() {} + +func (x *GetRequest_Body) ProtoReflect() protoreflect.Message { + mi := &file_v2_object_grpc_service_proto_msgTypes[16] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetRequest_Body.ProtoReflect.Descriptor instead. +func (*GetRequest_Body) Descriptor() ([]byte, []int) { + return file_v2_object_grpc_service_proto_rawDescGZIP(), []int{0, 0} +} + +func (x *GetRequest_Body) GetAddress() *grpc1.Address { + if x != nil { + return x.Address + } + return nil +} + +func (x *GetRequest_Body) GetRaw() bool { + if x != nil { + return x.Raw + } + return false +} + +// GET Object Response body +type GetResponse_Body struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Single message in the response stream. + // + // Types that are assignable to ObjectPart: + // *GetResponse_Body_Init_ + // *GetResponse_Body_Chunk + ObjectPart isGetResponse_Body_ObjectPart `protobuf_oneof:"object_part"` +} + +func (x *GetResponse_Body) Reset() { + *x = GetResponse_Body{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_object_grpc_service_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetResponse_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetResponse_Body) ProtoMessage() {} + +func (x *GetResponse_Body) ProtoReflect() protoreflect.Message { + mi := &file_v2_object_grpc_service_proto_msgTypes[17] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetResponse_Body.ProtoReflect.Descriptor instead. +func (*GetResponse_Body) Descriptor() ([]byte, []int) { + return file_v2_object_grpc_service_proto_rawDescGZIP(), []int{1, 0} +} + +func (m *GetResponse_Body) GetObjectPart() isGetResponse_Body_ObjectPart { if m != nil { - return m.VerifyHeader + return m.ObjectPart + } + return nil +} + +func (x *GetResponse_Body) GetInit() *GetResponse_Body_Init { + if x, ok := x.GetObjectPart().(*GetResponse_Body_Init_); ok { + return x.Init + } + return nil +} + +func (x *GetResponse_Body) GetChunk() []byte { + if x, ok := x.GetObjectPart().(*GetResponse_Body_Chunk); ok { + return x.Chunk + } + return nil +} + +type isGetResponse_Body_ObjectPart interface { + isGetResponse_Body_ObjectPart() +} + +type GetResponse_Body_Init_ struct { + // Initial part of the object stream + Init *GetResponse_Body_Init `protobuf:"bytes,1,opt,name=init,proto3,oneof"` +} + +type GetResponse_Body_Chunk struct { + // Chunked object payload + Chunk []byte `protobuf:"bytes,2,opt,name=chunk,proto3,oneof"` +} + +func (*GetResponse_Body_Init_) isGetResponse_Body_ObjectPart() {} + +func (*GetResponse_Body_Chunk) isGetResponse_Body_ObjectPart() {} + +// Initial part of the `Object` structure stream. Technically it's a +// set of all `Object` structure's fields except `payload`. +type GetResponse_Body_Init struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Object's unique identifier. + ObjectId *grpc1.ObjectID `protobuf:"bytes,1,opt,name=object_id,json=objectId,proto3" json:"object_id,omitempty"` + // Signed `ObjectID` + Signature *grpc1.Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` + // Object metadata headers + Header *Header `protobuf:"bytes,3,opt,name=header,proto3" json:"header,omitempty"` +} + +func (x *GetResponse_Body_Init) Reset() { + *x = GetResponse_Body_Init{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_object_grpc_service_proto_msgTypes[18] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetResponse_Body_Init) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetResponse_Body_Init) ProtoMessage() {} + +func (x *GetResponse_Body_Init) ProtoReflect() protoreflect.Message { + mi := &file_v2_object_grpc_service_proto_msgTypes[18] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetResponse_Body_Init.ProtoReflect.Descriptor instead. +func (*GetResponse_Body_Init) Descriptor() ([]byte, []int) { + return file_v2_object_grpc_service_proto_rawDescGZIP(), []int{1, 0, 0} +} + +func (x *GetResponse_Body_Init) GetObjectId() *grpc1.ObjectID { + if x != nil { + return x.ObjectId + } + return nil +} + +func (x *GetResponse_Body_Init) GetSignature() *grpc1.Signature { + if x != nil { + return x.Signature + } + return nil +} + +func (x *GetResponse_Body_Init) GetHeader() *Header { + if x != nil { + return x.Header + } + return nil +} + +// PUT request body +type PutRequest_Body struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Single message in the request stream. + // + // Types that are assignable to ObjectPart: + // *PutRequest_Body_Init_ + // *PutRequest_Body_Chunk + ObjectPart isPutRequest_Body_ObjectPart `protobuf_oneof:"object_part"` +} + +func (x *PutRequest_Body) Reset() { + *x = PutRequest_Body{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_object_grpc_service_proto_msgTypes[19] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PutRequest_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PutRequest_Body) ProtoMessage() {} + +func (x *PutRequest_Body) ProtoReflect() protoreflect.Message { + mi := &file_v2_object_grpc_service_proto_msgTypes[19] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PutRequest_Body.ProtoReflect.Descriptor instead. +func (*PutRequest_Body) Descriptor() ([]byte, []int) { + return file_v2_object_grpc_service_proto_rawDescGZIP(), []int{2, 0} +} + +func (m *PutRequest_Body) GetObjectPart() isPutRequest_Body_ObjectPart { + if m != nil { + return m.ObjectPart + } + return nil +} + +func (x *PutRequest_Body) GetInit() *PutRequest_Body_Init { + if x, ok := x.GetObjectPart().(*PutRequest_Body_Init_); ok { + return x.Init + } + return nil +} + +func (x *PutRequest_Body) GetChunk() []byte { + if x, ok := x.GetObjectPart().(*PutRequest_Body_Chunk); ok { + return x.Chunk + } + return nil +} + +type isPutRequest_Body_ObjectPart interface { + isPutRequest_Body_ObjectPart() +} + +type PutRequest_Body_Init_ struct { + // Initial part of the object stream + Init *PutRequest_Body_Init `protobuf:"bytes,1,opt,name=init,proto3,oneof"` +} + +type PutRequest_Body_Chunk struct { + // Chunked object payload + Chunk []byte `protobuf:"bytes,2,opt,name=chunk,proto3,oneof"` +} + +func (*PutRequest_Body_Init_) isPutRequest_Body_ObjectPart() {} + +func (*PutRequest_Body_Chunk) isPutRequest_Body_ObjectPart() {} + +// Newly created object structure parameters. If some optional parameters +// are not set, they will be calculated by a peer node. +type PutRequest_Body_Init struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // ObjectID if available. + ObjectId *grpc1.ObjectID `protobuf:"bytes,1,opt,name=object_id,json=objectId,proto3" json:"object_id,omitempty"` + // Object signature if available + Signature *grpc1.Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` + // Object's Header + Header *Header `protobuf:"bytes,3,opt,name=header,proto3" json:"header,omitempty"` + // Number of the object copies to store within the RPC call. By default + // object is processed according to the container's placement policy. + CopiesNumber uint32 `protobuf:"varint,4,opt,name=copies_number,json=copiesNumber,proto3" json:"copies_number,omitempty"` +} + +func (x *PutRequest_Body_Init) Reset() { + *x = PutRequest_Body_Init{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_object_grpc_service_proto_msgTypes[20] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PutRequest_Body_Init) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PutRequest_Body_Init) ProtoMessage() {} + +func (x *PutRequest_Body_Init) ProtoReflect() protoreflect.Message { + mi := &file_v2_object_grpc_service_proto_msgTypes[20] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PutRequest_Body_Init.ProtoReflect.Descriptor instead. +func (*PutRequest_Body_Init) Descriptor() ([]byte, []int) { + return file_v2_object_grpc_service_proto_rawDescGZIP(), []int{2, 0, 0} +} + +func (x *PutRequest_Body_Init) GetObjectId() *grpc1.ObjectID { + if x != nil { + return x.ObjectId + } + return nil +} + +func (x *PutRequest_Body_Init) GetSignature() *grpc1.Signature { + if x != nil { + return x.Signature + } + return nil +} + +func (x *PutRequest_Body_Init) GetHeader() *Header { + if x != nil { + return x.Header + } + return nil +} + +func (x *PutRequest_Body_Init) GetCopiesNumber() uint32 { + if x != nil { + return x.CopiesNumber + } + return 0 +} + +// PUT Object response body +type PutResponse_Body struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Identifier of the saved object + ObjectId *grpc1.ObjectID `protobuf:"bytes,1,opt,name=object_id,json=objectId,proto3" json:"object_id,omitempty"` +} + +func (x *PutResponse_Body) Reset() { + *x = PutResponse_Body{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_object_grpc_service_proto_msgTypes[21] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PutResponse_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PutResponse_Body) ProtoMessage() {} + +func (x *PutResponse_Body) ProtoReflect() protoreflect.Message { + mi := &file_v2_object_grpc_service_proto_msgTypes[21] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PutResponse_Body.ProtoReflect.Descriptor instead. +func (*PutResponse_Body) Descriptor() ([]byte, []int) { + return file_v2_object_grpc_service_proto_rawDescGZIP(), []int{3, 0} +} + +func (x *PutResponse_Body) GetObjectId() *grpc1.ObjectID { + if x != nil { + return x.ObjectId + } + return nil +} + +// Object DELETE request body +type DeleteRequest_Body struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Address of the object to be deleted + Address *grpc1.Address `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` +} + +func (x *DeleteRequest_Body) Reset() { + *x = DeleteRequest_Body{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_object_grpc_service_proto_msgTypes[22] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeleteRequest_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteRequest_Body) ProtoMessage() {} + +func (x *DeleteRequest_Body) ProtoReflect() protoreflect.Message { + mi := &file_v2_object_grpc_service_proto_msgTypes[22] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteRequest_Body.ProtoReflect.Descriptor instead. +func (*DeleteRequest_Body) Descriptor() ([]byte, []int) { + return file_v2_object_grpc_service_proto_rawDescGZIP(), []int{4, 0} +} + +func (x *DeleteRequest_Body) GetAddress() *grpc1.Address { + if x != nil { + return x.Address + } + return nil +} + +// Object DELETE Response has an empty body. +type DeleteResponse_Body struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *DeleteResponse_Body) Reset() { + *x = DeleteResponse_Body{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_object_grpc_service_proto_msgTypes[23] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeleteResponse_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteResponse_Body) ProtoMessage() {} + +func (x *DeleteResponse_Body) ProtoReflect() protoreflect.Message { + mi := &file_v2_object_grpc_service_proto_msgTypes[23] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteResponse_Body.ProtoReflect.Descriptor instead. +func (*DeleteResponse_Body) Descriptor() ([]byte, []int) { + return file_v2_object_grpc_service_proto_rawDescGZIP(), []int{5, 0} +} + +// Object HEAD request body +type HeadRequest_Body struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Address of the object with the requested Header + Address *grpc1.Address `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + // Return only minimal header subset + MainOnly bool `protobuf:"varint,2,opt,name=main_only,json=mainOnly,proto3" json:"main_only,omitempty"` + // If `raw` flag is set, request will work only with objects that are + // physically stored on the peer node + Raw bool `protobuf:"varint,3,opt,name=raw,proto3" json:"raw,omitempty"` +} + +func (x *HeadRequest_Body) Reset() { + *x = HeadRequest_Body{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_object_grpc_service_proto_msgTypes[24] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *HeadRequest_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HeadRequest_Body) ProtoMessage() {} + +func (x *HeadRequest_Body) ProtoReflect() protoreflect.Message { + mi := &file_v2_object_grpc_service_proto_msgTypes[24] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HeadRequest_Body.ProtoReflect.Descriptor instead. +func (*HeadRequest_Body) Descriptor() ([]byte, []int) { + return file_v2_object_grpc_service_proto_rawDescGZIP(), []int{6, 0} +} + +func (x *HeadRequest_Body) GetAddress() *grpc1.Address { + if x != nil { + return x.Address + } + return nil +} + +func (x *HeadRequest_Body) GetMainOnly() bool { + if x != nil { + return x.MainOnly + } + return false +} + +func (x *HeadRequest_Body) GetRaw() bool { + if x != nil { + return x.Raw + } + return false +} + +// Object HEAD response body +type HeadResponse_Body struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Requested object header or it's part. + // + // Types that are assignable to Head: + // *HeadResponse_Body_Header + // *HeadResponse_Body_ShortHeader + Head isHeadResponse_Body_Head `protobuf_oneof:"head"` +} + +func (x *HeadResponse_Body) Reset() { + *x = HeadResponse_Body{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_object_grpc_service_proto_msgTypes[25] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *HeadResponse_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HeadResponse_Body) ProtoMessage() {} + +func (x *HeadResponse_Body) ProtoReflect() protoreflect.Message { + mi := &file_v2_object_grpc_service_proto_msgTypes[25] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HeadResponse_Body.ProtoReflect.Descriptor instead. +func (*HeadResponse_Body) Descriptor() ([]byte, []int) { + return file_v2_object_grpc_service_proto_rawDescGZIP(), []int{8, 0} +} + +func (m *HeadResponse_Body) GetHead() isHeadResponse_Body_Head { + if m != nil { + return m.Head + } + return nil +} + +func (x *HeadResponse_Body) GetHeader() *HeaderWithSignature { + if x, ok := x.GetHead().(*HeadResponse_Body_Header); ok { + return x.Header + } + return nil +} + +func (x *HeadResponse_Body) GetShortHeader() *ShortHeader { + if x, ok := x.GetHead().(*HeadResponse_Body_ShortHeader); ok { + return x.ShortHeader + } + return nil +} + +type isHeadResponse_Body_Head interface { + isHeadResponse_Body_Head() +} + +type HeadResponse_Body_Header struct { + // Full object's `Header` with `ObjectID` signature + Header *HeaderWithSignature `protobuf:"bytes,1,opt,name=header,proto3,oneof"` +} + +type HeadResponse_Body_ShortHeader struct { + // Short object header + ShortHeader *ShortHeader `protobuf:"bytes,2,opt,name=short_header,json=shortHeader,proto3,oneof"` +} + +func (*HeadResponse_Body_Header) isHeadResponse_Body_Head() {} + +func (*HeadResponse_Body_ShortHeader) isHeadResponse_Body_Head() {} + +// Object Search request body +type SearchRequest_Body struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Container identifier were to search + ContainerId *grpc1.ContainerID `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` + // Version of the Query Language used + Version uint32 `protobuf:"varint,2,opt,name=version,proto3" json:"version,omitempty"` + // List of search expressions + Filters []*SearchRequest_Body_Filter `protobuf:"bytes,3,rep,name=filters,proto3" json:"filters,omitempty"` +} + +func (x *SearchRequest_Body) Reset() { + *x = SearchRequest_Body{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_object_grpc_service_proto_msgTypes[26] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SearchRequest_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SearchRequest_Body) ProtoMessage() {} + +func (x *SearchRequest_Body) ProtoReflect() protoreflect.Message { + mi := &file_v2_object_grpc_service_proto_msgTypes[26] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SearchRequest_Body.ProtoReflect.Descriptor instead. +func (*SearchRequest_Body) Descriptor() ([]byte, []int) { + return file_v2_object_grpc_service_proto_rawDescGZIP(), []int{9, 0} +} + +func (x *SearchRequest_Body) GetContainerId() *grpc1.ContainerID { + if x != nil { + return x.ContainerId + } + return nil +} + +func (x *SearchRequest_Body) GetVersion() uint32 { + if x != nil { + return x.Version + } + return 0 +} + +func (x *SearchRequest_Body) GetFilters() []*SearchRequest_Body_Filter { + if x != nil { + return x.Filters + } + return nil +} + +// Filter structure +type SearchRequest_Body_Filter struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Match type to use + MatchType MatchType `protobuf:"varint,1,opt,name=match_type,json=matchType,proto3,enum=neo.fs.v2.object.MatchType" json:"match_type,omitempty"` + // Header name to match + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + // Header value to match + Value string `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"` +} + +func (x *SearchRequest_Body_Filter) Reset() { + *x = SearchRequest_Body_Filter{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_object_grpc_service_proto_msgTypes[27] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SearchRequest_Body_Filter) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SearchRequest_Body_Filter) ProtoMessage() {} + +func (x *SearchRequest_Body_Filter) ProtoReflect() protoreflect.Message { + mi := &file_v2_object_grpc_service_proto_msgTypes[27] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SearchRequest_Body_Filter.ProtoReflect.Descriptor instead. +func (*SearchRequest_Body_Filter) Descriptor() ([]byte, []int) { + return file_v2_object_grpc_service_proto_rawDescGZIP(), []int{9, 0, 0} +} + +func (x *SearchRequest_Body_Filter) GetMatchType() MatchType { + if x != nil { + return x.MatchType + } + return MatchType_MATCH_TYPE_UNSPECIFIED +} + +func (x *SearchRequest_Body_Filter) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *SearchRequest_Body_Filter) GetValue() string { + if x != nil { + return x.Value + } + return "" +} + +// Object Search response body +type SearchResponse_Body struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // List of `ObjectID`s that match the search query + IdList []*grpc1.ObjectID `protobuf:"bytes,1,rep,name=id_list,json=idList,proto3" json:"id_list,omitempty"` +} + +func (x *SearchResponse_Body) Reset() { + *x = SearchResponse_Body{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_object_grpc_service_proto_msgTypes[28] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SearchResponse_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SearchResponse_Body) ProtoMessage() {} + +func (x *SearchResponse_Body) ProtoReflect() protoreflect.Message { + mi := &file_v2_object_grpc_service_proto_msgTypes[28] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SearchResponse_Body.ProtoReflect.Descriptor instead. +func (*SearchResponse_Body) Descriptor() ([]byte, []int) { + return file_v2_object_grpc_service_proto_rawDescGZIP(), []int{10, 0} +} + +func (x *SearchResponse_Body) GetIdList() []*grpc1.ObjectID { + if x != nil { + return x.IdList + } + return nil +} + +// Byte range of object's payload request body +type GetRangeRequest_Body struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Address of the object containing the requested payload range + Address *grpc1.Address `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + // Requested payload range + Range *Range `protobuf:"bytes,2,opt,name=range,proto3" json:"range,omitempty"` +} + +func (x *GetRangeRequest_Body) Reset() { + *x = GetRangeRequest_Body{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_object_grpc_service_proto_msgTypes[29] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetRangeRequest_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetRangeRequest_Body) ProtoMessage() {} + +func (x *GetRangeRequest_Body) ProtoReflect() protoreflect.Message { + mi := &file_v2_object_grpc_service_proto_msgTypes[29] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetRangeRequest_Body.ProtoReflect.Descriptor instead. +func (*GetRangeRequest_Body) Descriptor() ([]byte, []int) { + return file_v2_object_grpc_service_proto_rawDescGZIP(), []int{12, 0} +} + +func (x *GetRangeRequest_Body) GetAddress() *grpc1.Address { + if x != nil { + return x.Address + } + return nil +} + +func (x *GetRangeRequest_Body) GetRange() *Range { + if x != nil { + return x.Range } return nil } @@ -1921,125 +2045,59 @@ func (m *GetRangeResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { // initial preamble message. The requested byte range is sent as a series // chunks. type GetRangeResponse_Body struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // Chunked object payload's range - Chunk []byte `protobuf:"bytes,1,opt,name=chunk,proto3" json:"chunk,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Chunk []byte `protobuf:"bytes,1,opt,name=chunk,proto3" json:"chunk,omitempty"` } -func (m *GetRangeResponse_Body) Reset() { *m = GetRangeResponse_Body{} } -func (m *GetRangeResponse_Body) String() string { return proto.CompactTextString(m) } -func (*GetRangeResponse_Body) ProtoMessage() {} +func (x *GetRangeResponse_Body) Reset() { + *x = GetRangeResponse_Body{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_object_grpc_service_proto_msgTypes[30] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetRangeResponse_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetRangeResponse_Body) ProtoMessage() {} + +func (x *GetRangeResponse_Body) ProtoReflect() protoreflect.Message { + mi := &file_v2_object_grpc_service_proto_msgTypes[30] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetRangeResponse_Body.ProtoReflect.Descriptor instead. func (*GetRangeResponse_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_1d7d92b1e85e5b48, []int{13, 0} -} -func (m *GetRangeResponse_Body) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *GetRangeResponse_Body) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_GetRangeResponse_Body.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *GetRangeResponse_Body) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetRangeResponse_Body.Merge(m, src) -} -func (m *GetRangeResponse_Body) XXX_Size() int { - return m.Size() -} -func (m *GetRangeResponse_Body) XXX_DiscardUnknown() { - xxx_messageInfo_GetRangeResponse_Body.DiscardUnknown(m) + return file_v2_object_grpc_service_proto_rawDescGZIP(), []int{13, 0} } -var xxx_messageInfo_GetRangeResponse_Body proto.InternalMessageInfo - -func (m *GetRangeResponse_Body) GetChunk() []byte { - if m != nil { - return m.Chunk - } - return nil -} - -// Get hash of object's payload part -type GetRangeHashRequest struct { - // Body of get range hash object request message. - Body *GetRangeHashRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" 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,proto3" json:"verify_header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GetRangeHashRequest) Reset() { *m = GetRangeHashRequest{} } -func (m *GetRangeHashRequest) String() string { return proto.CompactTextString(m) } -func (*GetRangeHashRequest) ProtoMessage() {} -func (*GetRangeHashRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_1d7d92b1e85e5b48, []int{14} -} -func (m *GetRangeHashRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *GetRangeHashRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_GetRangeHashRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *GetRangeHashRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetRangeHashRequest.Merge(m, src) -} -func (m *GetRangeHashRequest) XXX_Size() int { - return m.Size() -} -func (m *GetRangeHashRequest) XXX_DiscardUnknown() { - xxx_messageInfo_GetRangeHashRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_GetRangeHashRequest proto.InternalMessageInfo - -func (m *GetRangeHashRequest) GetBody() *GetRangeHashRequest_Body { - if m != nil { - return m.Body - } - return nil -} - -func (m *GetRangeHashRequest) GetMetaHeader() *grpc.RequestMetaHeader { - if m != nil { - return m.MetaHeader - } - return nil -} - -func (m *GetRangeHashRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { - if m != nil { - return m.VerifyHeader +func (x *GetRangeResponse_Body) GetChunk() []byte { + if x != nil { + return x.Chunk } return nil } // Get hash of object's payload part request body. type GetRangeHashRequest_Body struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // Address of the object that containing the requested payload range Address *grpc1.Address `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` // List of object's payload ranges to calculate homomorphic hash @@ -2047,331 +2105,1102 @@ type GetRangeHashRequest_Body struct { // Binary salt to XOR object's payload ranges before hash calculation Salt []byte `protobuf:"bytes,3,opt,name=salt,proto3" json:"salt,omitempty"` // Checksum algorithm type - Type grpc1.ChecksumType `protobuf:"varint,4,opt,name=type,proto3,enum=neo.fs.v2.refs.ChecksumType" json:"type,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Type grpc1.ChecksumType `protobuf:"varint,4,opt,name=type,proto3,enum=neo.fs.v2.refs.ChecksumType" json:"type,omitempty"` } -func (m *GetRangeHashRequest_Body) Reset() { *m = GetRangeHashRequest_Body{} } -func (m *GetRangeHashRequest_Body) String() string { return proto.CompactTextString(m) } -func (*GetRangeHashRequest_Body) ProtoMessage() {} -func (*GetRangeHashRequest_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_1d7d92b1e85e5b48, []int{14, 0} +func (x *GetRangeHashRequest_Body) Reset() { + *x = GetRangeHashRequest_Body{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_object_grpc_service_proto_msgTypes[31] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *GetRangeHashRequest_Body) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) + +func (x *GetRangeHashRequest_Body) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *GetRangeHashRequest_Body) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_GetRangeHashRequest_Body.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err + +func (*GetRangeHashRequest_Body) ProtoMessage() {} + +func (x *GetRangeHashRequest_Body) ProtoReflect() protoreflect.Message { + mi := &file_v2_object_grpc_service_proto_msgTypes[31] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) } - return b[:n], nil + return ms } -} -func (m *GetRangeHashRequest_Body) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetRangeHashRequest_Body.Merge(m, src) -} -func (m *GetRangeHashRequest_Body) XXX_Size() int { - return m.Size() -} -func (m *GetRangeHashRequest_Body) XXX_DiscardUnknown() { - xxx_messageInfo_GetRangeHashRequest_Body.DiscardUnknown(m) + return mi.MessageOf(x) } -var xxx_messageInfo_GetRangeHashRequest_Body proto.InternalMessageInfo +// Deprecated: Use GetRangeHashRequest_Body.ProtoReflect.Descriptor instead. +func (*GetRangeHashRequest_Body) Descriptor() ([]byte, []int) { + return file_v2_object_grpc_service_proto_rawDescGZIP(), []int{14, 0} +} -func (m *GetRangeHashRequest_Body) GetAddress() *grpc1.Address { - if m != nil { - return m.Address +func (x *GetRangeHashRequest_Body) GetAddress() *grpc1.Address { + if x != nil { + return x.Address } return nil } -func (m *GetRangeHashRequest_Body) GetRanges() []*Range { - if m != nil { - return m.Ranges +func (x *GetRangeHashRequest_Body) GetRanges() []*Range { + if x != nil { + return x.Ranges } return nil } -func (m *GetRangeHashRequest_Body) GetSalt() []byte { - if m != nil { - return m.Salt +func (x *GetRangeHashRequest_Body) GetSalt() []byte { + if x != nil { + return x.Salt } return nil } -func (m *GetRangeHashRequest_Body) GetType() grpc1.ChecksumType { - if m != nil { - return m.Type +func (x *GetRangeHashRequest_Body) GetType() grpc1.ChecksumType { + if x != nil { + return x.Type } return grpc1.ChecksumType_CHECKSUM_TYPE_UNSPECIFIED } -// Get hash of object's payload part -type GetRangeHashResponse struct { - // Body of get range hash object response message. - Body *GetRangeHashResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" 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,proto3" json:"verify_header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GetRangeHashResponse) Reset() { *m = GetRangeHashResponse{} } -func (m *GetRangeHashResponse) String() string { return proto.CompactTextString(m) } -func (*GetRangeHashResponse) ProtoMessage() {} -func (*GetRangeHashResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_1d7d92b1e85e5b48, []int{15} -} -func (m *GetRangeHashResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *GetRangeHashResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_GetRangeHashResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *GetRangeHashResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetRangeHashResponse.Merge(m, src) -} -func (m *GetRangeHashResponse) XXX_Size() int { - return m.Size() -} -func (m *GetRangeHashResponse) XXX_DiscardUnknown() { - xxx_messageInfo_GetRangeHashResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_GetRangeHashResponse proto.InternalMessageInfo - -func (m *GetRangeHashResponse) GetBody() *GetRangeHashResponse_Body { - if m != nil { - return m.Body - } - return nil -} - -func (m *GetRangeHashResponse) GetMetaHeader() *grpc.ResponseMetaHeader { - if m != nil { - return m.MetaHeader - } - return nil -} - -func (m *GetRangeHashResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { - if m != nil { - return m.VerifyHeader - } - return nil -} - // Get hash of object's payload part response body. type GetRangeHashResponse_Body struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // Checksum algorithm type Type grpc1.ChecksumType `protobuf:"varint,1,opt,name=type,proto3,enum=neo.fs.v2.refs.ChecksumType" json:"type,omitempty"` // List of range hashes in a binary format - HashList [][]byte `protobuf:"bytes,2,rep,name=hash_list,json=hashList,proto3" json:"hash_list,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + HashList [][]byte `protobuf:"bytes,2,rep,name=hash_list,json=hashList,proto3" json:"hash_list,omitempty"` } -func (m *GetRangeHashResponse_Body) Reset() { *m = GetRangeHashResponse_Body{} } -func (m *GetRangeHashResponse_Body) String() string { return proto.CompactTextString(m) } -func (*GetRangeHashResponse_Body) ProtoMessage() {} -func (*GetRangeHashResponse_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_1d7d92b1e85e5b48, []int{15, 0} -} -func (m *GetRangeHashResponse_Body) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *GetRangeHashResponse_Body) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_GetRangeHashResponse_Body.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil +func (x *GetRangeHashResponse_Body) Reset() { + *x = GetRangeHashResponse_Body{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_object_grpc_service_proto_msgTypes[32] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } } -func (m *GetRangeHashResponse_Body) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetRangeHashResponse_Body.Merge(m, src) -} -func (m *GetRangeHashResponse_Body) XXX_Size() int { - return m.Size() -} -func (m *GetRangeHashResponse_Body) XXX_DiscardUnknown() { - xxx_messageInfo_GetRangeHashResponse_Body.DiscardUnknown(m) + +func (x *GetRangeHashResponse_Body) String() string { + return protoimpl.X.MessageStringOf(x) } -var xxx_messageInfo_GetRangeHashResponse_Body proto.InternalMessageInfo +func (*GetRangeHashResponse_Body) ProtoMessage() {} -func (m *GetRangeHashResponse_Body) GetType() grpc1.ChecksumType { - if m != nil { - return m.Type +func (x *GetRangeHashResponse_Body) ProtoReflect() protoreflect.Message { + mi := &file_v2_object_grpc_service_proto_msgTypes[32] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetRangeHashResponse_Body.ProtoReflect.Descriptor instead. +func (*GetRangeHashResponse_Body) Descriptor() ([]byte, []int) { + return file_v2_object_grpc_service_proto_rawDescGZIP(), []int{15, 0} +} + +func (x *GetRangeHashResponse_Body) GetType() grpc1.ChecksumType { + if x != nil { + return x.Type } return grpc1.ChecksumType_CHECKSUM_TYPE_UNSPECIFIED } -func (m *GetRangeHashResponse_Body) GetHashList() [][]byte { - if m != nil { - return m.HashList +func (x *GetRangeHashResponse_Body) GetHashList() [][]byte { + if x != nil { + return x.HashList } return nil } -func init() { - proto.RegisterType((*GetRequest)(nil), "neo.fs.v2.object.GetRequest") - proto.RegisterType((*GetRequest_Body)(nil), "neo.fs.v2.object.GetRequest.Body") - proto.RegisterType((*GetResponse)(nil), "neo.fs.v2.object.GetResponse") - proto.RegisterType((*GetResponse_Body)(nil), "neo.fs.v2.object.GetResponse.Body") - proto.RegisterType((*GetResponse_Body_Init)(nil), "neo.fs.v2.object.GetResponse.Body.Init") - proto.RegisterType((*PutRequest)(nil), "neo.fs.v2.object.PutRequest") - proto.RegisterType((*PutRequest_Body)(nil), "neo.fs.v2.object.PutRequest.Body") - proto.RegisterType((*PutRequest_Body_Init)(nil), "neo.fs.v2.object.PutRequest.Body.Init") - proto.RegisterType((*PutResponse)(nil), "neo.fs.v2.object.PutResponse") - proto.RegisterType((*PutResponse_Body)(nil), "neo.fs.v2.object.PutResponse.Body") - proto.RegisterType((*DeleteRequest)(nil), "neo.fs.v2.object.DeleteRequest") - proto.RegisterType((*DeleteRequest_Body)(nil), "neo.fs.v2.object.DeleteRequest.Body") - proto.RegisterType((*DeleteResponse)(nil), "neo.fs.v2.object.DeleteResponse") - proto.RegisterType((*DeleteResponse_Body)(nil), "neo.fs.v2.object.DeleteResponse.Body") - proto.RegisterType((*HeadRequest)(nil), "neo.fs.v2.object.HeadRequest") - proto.RegisterType((*HeadRequest_Body)(nil), "neo.fs.v2.object.HeadRequest.Body") - proto.RegisterType((*HeaderWithSignature)(nil), "neo.fs.v2.object.HeaderWithSignature") - proto.RegisterType((*HeadResponse)(nil), "neo.fs.v2.object.HeadResponse") - proto.RegisterType((*HeadResponse_Body)(nil), "neo.fs.v2.object.HeadResponse.Body") - proto.RegisterType((*SearchRequest)(nil), "neo.fs.v2.object.SearchRequest") - proto.RegisterType((*SearchRequest_Body)(nil), "neo.fs.v2.object.SearchRequest.Body") - proto.RegisterType((*SearchRequest_Body_Filter)(nil), "neo.fs.v2.object.SearchRequest.Body.Filter") - proto.RegisterType((*SearchResponse)(nil), "neo.fs.v2.object.SearchResponse") - proto.RegisterType((*SearchResponse_Body)(nil), "neo.fs.v2.object.SearchResponse.Body") - proto.RegisterType((*Range)(nil), "neo.fs.v2.object.Range") - proto.RegisterType((*GetRangeRequest)(nil), "neo.fs.v2.object.GetRangeRequest") - proto.RegisterType((*GetRangeRequest_Body)(nil), "neo.fs.v2.object.GetRangeRequest.Body") - proto.RegisterType((*GetRangeResponse)(nil), "neo.fs.v2.object.GetRangeResponse") - proto.RegisterType((*GetRangeResponse_Body)(nil), "neo.fs.v2.object.GetRangeResponse.Body") - proto.RegisterType((*GetRangeHashRequest)(nil), "neo.fs.v2.object.GetRangeHashRequest") - proto.RegisterType((*GetRangeHashRequest_Body)(nil), "neo.fs.v2.object.GetRangeHashRequest.Body") - proto.RegisterType((*GetRangeHashResponse)(nil), "neo.fs.v2.object.GetRangeHashResponse") - proto.RegisterType((*GetRangeHashResponse_Body)(nil), "neo.fs.v2.object.GetRangeHashResponse.Body") +var File_v2_object_grpc_service_proto protoreflect.FileDescriptor + +var file_v2_object_grpc_service_proto_rawDesc = []byte{ + 0x0a, 0x1c, 0x76, 0x32, 0x2f, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2f, 0x67, 0x72, 0x70, 0x63, + 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x10, + 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, + 0x1a, 0x1a, 0x76, 0x32, 0x2f, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2f, 0x67, 0x72, 0x70, 0x63, + 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x18, 0x76, 0x32, + 0x2f, 0x72, 0x65, 0x66, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x76, 0x32, 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, 0xaa, 0x02, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x35, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x21, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, + 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 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, 0x4b, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x31, 0x0a, 0x07, 0x61, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x41, 0x64, + 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x10, + 0x0a, 0x03, 0x72, 0x61, 0x77, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x03, 0x72, 0x61, 0x77, + 0x22, 0xfb, 0x03, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x36, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, + 0x74, 0x2e, 0x47, 0x65, 0x74, 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, 0x97, 0x02, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x3d, 0x0a, + 0x04, 0x69, 0x6e, 0x69, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x6e, 0x65, + 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, + 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x2e, + 0x49, 0x6e, 0x69, 0x74, 0x48, 0x00, 0x52, 0x04, 0x69, 0x6e, 0x69, 0x74, 0x12, 0x16, 0x0a, 0x05, + 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, 0x05, 0x63, + 0x68, 0x75, 0x6e, 0x6b, 0x1a, 0xa8, 0x01, 0x0a, 0x04, 0x49, 0x6e, 0x69, 0x74, 0x12, 0x35, 0x0a, + 0x09, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 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, 0x08, 0x6f, 0x62, 0x6a, 0x65, + 0x63, 0x74, 0x49, 0x64, 0x12, 0x37, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, + 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, + 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x30, 0x0a, + 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, + 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, + 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x42, + 0x0d, 0x0a, 0x0b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x70, 0x61, 0x72, 0x74, 0x22, 0x9b, + 0x04, 0x0a, 0x0a, 0x50, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x35, 0x0a, + 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x6e, 0x65, + 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x50, + 0x75, 0x74, 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, 0xbb, + 0x02, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x3c, 0x0a, 0x04, 0x69, 0x6e, 0x69, 0x74, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x50, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x2e, 0x49, 0x6e, 0x69, 0x74, 0x48, 0x00, 0x52, + 0x04, 0x69, 0x6e, 0x69, 0x74, 0x12, 0x16, 0x0a, 0x05, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, 0x05, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x1a, 0xcd, 0x01, + 0x0a, 0x04, 0x49, 0x6e, 0x69, 0x74, 0x12, 0x35, 0x0a, 0x09, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, + 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 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, 0x08, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x64, 0x12, 0x37, 0x0a, + 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, + 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, + 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x30, 0x0a, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, + 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, + 0x52, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x23, 0x0a, 0x0d, 0x63, 0x6f, 0x70, 0x69, + 0x65, 0x73, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x52, + 0x0c, 0x63, 0x6f, 0x70, 0x69, 0x65, 0x73, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x42, 0x0d, 0x0a, + 0x0b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x70, 0x61, 0x72, 0x74, 0x22, 0xa0, 0x02, 0x0a, + 0x0b, 0x50, 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x36, 0x0a, 0x04, + 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6e, 0x65, 0x6f, + 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x50, 0x75, + 0x74, 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, 0x3d, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x35, 0x0a, 0x09, 0x6f, 0x62, 0x6a, 0x65, + 0x63, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 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, 0x08, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x64, 0x22, + 0x9e, 0x02, 0x0a, 0x0d, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x38, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x24, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, + 0x63, 0x74, 0x2e, 0x44, 0x65, 0x6c, 0x65, 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, 0x39, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x31, 0x0a, + 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, + 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, + 0x22, 0xef, 0x01, 0x0a, 0x0e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 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, 0x6f, 0x62, + 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x44, 0x65, 0x6c, 0x65, 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, 0x06, 0x0a, 0x04, 0x42, 0x6f, + 0x64, 0x79, 0x22, 0xc9, 0x02, 0x0a, 0x0b, 0x48, 0x65, 0x61, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x36, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x22, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, + 0x65, 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 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, 0x68, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x31, 0x0a, 0x07, + 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, + 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x41, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, + 0x1b, 0x0a, 0x09, 0x6d, 0x61, 0x69, 0x6e, 0x5f, 0x6f, 0x6e, 0x6c, 0x79, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x08, 0x52, 0x08, 0x6d, 0x61, 0x69, 0x6e, 0x4f, 0x6e, 0x6c, 0x79, 0x12, 0x10, 0x0a, 0x03, + 0x72, 0x61, 0x77, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x03, 0x72, 0x61, 0x77, 0x22, 0x80, + 0x01, 0x0a, 0x13, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x57, 0x69, 0x74, 0x68, 0x53, 0x69, 0x67, + 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x30, 0x0a, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, + 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, + 0x52, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x37, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, + 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, + 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, + 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, + 0x65, 0x22, 0xf9, 0x02, 0x0a, 0x0c, 0x48, 0x65, 0x61, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x37, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x23, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, + 0x65, 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 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, 0x93, 0x01, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, + 0x12, 0x3f, 0x0a, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x25, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, + 0x65, 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x57, 0x69, 0x74, 0x68, 0x53, 0x69, + 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x48, 0x00, 0x52, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, + 0x72, 0x12, 0x42, 0x0a, 0x0c, 0x73, 0x68, 0x6f, 0x72, 0x74, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, + 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, + 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x53, 0x68, 0x6f, 0x72, 0x74, + 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x48, 0x00, 0x52, 0x0b, 0x73, 0x68, 0x6f, 0x72, 0x74, 0x48, + 0x65, 0x61, 0x64, 0x65, 0x72, 0x42, 0x06, 0x0a, 0x04, 0x68, 0x65, 0x61, 0x64, 0x22, 0xfd, 0x03, + 0x0a, 0x0d, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x38, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, + 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, + 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 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, 0x97, 0x02, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x3e, 0x0a, 0x0c, + 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, + 0x65, 0x66, 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x52, + 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, + 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x76, + 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x45, 0x0a, 0x07, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, + 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, + 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, + 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x2e, 0x46, 0x69, + 0x6c, 0x74, 0x65, 0x72, 0x52, 0x07, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x73, 0x1a, 0x6e, 0x0a, + 0x06, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x3a, 0x0a, 0x0a, 0x6d, 0x61, 0x74, 0x63, 0x68, + 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1b, 0x2e, 0x6e, 0x65, + 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x4d, + 0x61, 0x74, 0x63, 0x68, 0x54, 0x79, 0x70, 0x65, 0x52, 0x09, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x54, + 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xa2, 0x02, + 0x0a, 0x0e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 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, 0x6f, 0x62, 0x6a, 0x65, 0x63, + 0x74, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 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, 0x39, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, + 0x31, 0x0a, 0x07, 0x69, 0x64, 0x5f, 0x6c, 0x69, 0x73, 0x74, 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, 0x06, 0x69, 0x64, 0x4c, 0x69, + 0x73, 0x74, 0x22, 0x37, 0x0a, 0x05, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x6f, + 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x6f, 0x66, 0x66, + 0x73, 0x65, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x04, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xd1, 0x02, 0x0a, 0x0f, + 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 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, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, + 0x2e, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 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, 0x68, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x31, 0x0a, + 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, + 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, + 0x12, 0x2d, 0x0a, 0x05, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x17, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, + 0x63, 0x74, 0x2e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x05, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x22, + 0x89, 0x02, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3b, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, + 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 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, 0x1c, 0x0a, + 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x22, 0xa2, 0x03, 0x0a, 0x13, + 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x48, 0x61, 0x73, 0x68, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 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, 0x6f, 0x62, + 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x48, 0x61, 0x73, + 0x68, 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, 0xb0, 0x01, + 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x31, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, + 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, + 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, + 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x2f, 0x0a, 0x06, 0x72, 0x61, 0x6e, + 0x67, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, + 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x52, 0x61, 0x6e, + 0x67, 0x65, 0x52, 0x06, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x61, + 0x6c, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x73, 0x61, 0x6c, 0x74, 0x12, 0x30, + 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1c, 0x2e, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x68, + 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, + 0x22, 0xca, 0x02, 0x0a, 0x14, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x48, 0x61, 0x73, + 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3f, 0x0a, 0x04, 0x62, 0x6f, 0x64, + 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, + 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x61, + 0x6e, 0x67, 0x65, 0x48, 0x61, 0x73, 0x68, 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, 0x55, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x30, + 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1c, 0x2e, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x68, + 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, + 0x12, 0x1b, 0x0a, 0x09, 0x68, 0x61, 0x73, 0x68, 0x5f, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x02, 0x20, + 0x03, 0x28, 0x0c, 0x52, 0x08, 0x68, 0x61, 0x73, 0x68, 0x4c, 0x69, 0x73, 0x74, 0x32, 0xb2, 0x04, + 0x0a, 0x0d, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, + 0x44, 0x0a, 0x03, 0x47, 0x65, 0x74, 0x12, 0x1c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, + 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x30, 0x01, 0x12, 0x44, 0x0a, 0x03, 0x50, 0x75, 0x74, 0x12, 0x1c, 0x2e, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, + 0x50, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x6e, 0x65, 0x6f, + 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x50, 0x75, + 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x28, 0x01, 0x12, 0x4b, 0x0a, 0x06, 0x44, + 0x65, 0x6c, 0x65, 0x74, 0x65, 0x12, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, + 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x45, 0x0a, 0x04, 0x48, 0x65, 0x61, 0x64, + 0x12, 0x1d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, + 0x65, 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x1e, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, + 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x4d, 0x0a, 0x06, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x12, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, + 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x53, 0x65, 0x61, + 0x72, 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x6e, 0x65, 0x6f, + 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x53, 0x65, + 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x30, 0x01, 0x12, 0x53, + 0x0a, 0x08, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x21, 0x2e, 0x6e, 0x65, 0x6f, + 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, + 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x22, 0x2e, + 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, + 0x2e, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x30, 0x01, 0x12, 0x5d, 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x48, + 0x61, 0x73, 0x68, 0x12, 0x25, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, + 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x48, + 0x61, 0x73, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x26, 0x2e, 0x6e, 0x65, 0x6f, + 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, + 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x48, 0x61, 0x73, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x42, 0x4f, 0x5a, 0x37, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, + 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, + 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x6f, 0x62, 0x6a, 0x65, 0x63, + 0x74, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0xaa, 0x02, 0x13, + 0x4e, 0x65, 0x6f, 0x46, 0x53, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x76, 0x32, 0x2e, 0x4f, 0x62, 0x6a, + 0x65, 0x63, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } -func init() { proto.RegisterFile("v2/object/grpc/service.proto", fileDescriptor_1d7d92b1e85e5b48) } +var ( + file_v2_object_grpc_service_proto_rawDescOnce sync.Once + file_v2_object_grpc_service_proto_rawDescData = file_v2_object_grpc_service_proto_rawDesc +) -var fileDescriptor_1d7d92b1e85e5b48 = []byte{ - // 1290 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x58, 0xcd, 0x6f, 0x1b, 0x45, - 0x14, 0xcf, 0xae, 0x37, 0x4e, 0xfc, 0x6c, 0x87, 0x68, 0x12, 0xb5, 0xc6, 0xf9, 0x20, 0xdd, 0x36, - 0x69, 0x44, 0xc9, 0x3a, 0x18, 0x95, 0xd0, 0x96, 0xb6, 0x6a, 0x48, 0x52, 0x5b, 0x25, 0x6d, 0x58, - 0xf3, 0x21, 0x21, 0x21, 0x6b, 0xb3, 0x1e, 0x7b, 0x97, 0xda, 0xbb, 0x66, 0x67, 0x6d, 0xe4, 0x1b, - 0x57, 0xce, 0x1c, 0x40, 0x42, 0x42, 0xa8, 0x27, 0xd4, 0x13, 0xe2, 0xca, 0x3f, 0x00, 0x48, 0x48, - 0xf0, 0x1f, 0xa0, 0xf0, 0x07, 0x70, 0x46, 0x08, 0x09, 0xcd, 0xc7, 0xc6, 0x5e, 0x7f, 0x2b, 0xb7, - 0xe5, 0x36, 0x33, 0xfb, 0x7b, 0x6f, 0xe7, 0xfd, 0xde, 0xc7, 0xbc, 0x19, 0x58, 0x6d, 0xe7, 0x73, - 0xee, 0xe9, 0xc7, 0xd8, 0xf4, 0x73, 0x35, 0xaf, 0x69, 0xe6, 0x08, 0xf6, 0xda, 0xb6, 0x89, 0xb5, - 0xa6, 0xe7, 0xfa, 0x2e, 0x5a, 0x74, 0xb0, 0xab, 0x55, 0x89, 0xd6, 0xce, 0x6b, 0x1c, 0x94, 0xcd, - 0xf6, 0xe1, 0xfd, 0x4e, 0x13, 0x13, 0x8e, 0xce, 0x66, 0xda, 0xf9, 0x9c, 0x87, 0xab, 0x64, 0xf0, - 0xcb, 0x4a, 0x3b, 0x9f, 0x23, 0x98, 0x10, 0xdb, 0x75, 0x06, 0x3e, 0xaa, 0xcf, 0x65, 0x80, 0x87, - 0xd8, 0xd7, 0xf1, 0x27, 0x2d, 0x4c, 0x7c, 0x74, 0x13, 0x94, 0x53, 0xb7, 0xd2, 0xc9, 0x48, 0x1b, - 0xd2, 0x76, 0x32, 0x7f, 0x45, 0xeb, 0xdf, 0x82, 0xd6, 0xc5, 0x6a, 0xfb, 0x6e, 0xa5, 0xa3, 0x33, - 0x38, 0x3a, 0x84, 0x64, 0x03, 0xfb, 0x46, 0xd9, 0xc2, 0x46, 0x05, 0x7b, 0x19, 0x99, 0x49, 0x5f, - 0xeb, 0x91, 0x16, 0xff, 0xd7, 0x84, 0xec, 0x31, 0xf6, 0x8d, 0x02, 0xc3, 0xea, 0xd0, 0x38, 0x1f, - 0xa3, 0x77, 0x20, 0xdd, 0xc6, 0x9e, 0x5d, 0xed, 0x04, 0x8a, 0x62, 0x4c, 0xd1, 0x2b, 0xa3, 0x15, - 0xbd, 0x4f, 0xe1, 0xb6, 0x69, 0xf8, 0xb6, 0xeb, 0x08, 0x85, 0x29, 0xae, 0x82, 0xcf, 0xb2, 0x8f, - 0x40, 0xa1, 0xfb, 0x44, 0xaf, 0xc2, 0x9c, 0x51, 0xa9, 0x78, 0x98, 0x10, 0x61, 0xdb, 0xe5, 0x1e, - 0xa5, 0x94, 0x37, 0xed, 0x01, 0xff, 0xac, 0x07, 0x38, 0xb4, 0x08, 0x31, 0xcf, 0xf8, 0x94, 0x19, - 0x33, 0xaf, 0xd3, 0xa1, 0xfa, 0x4f, 0x0c, 0x92, 0x8c, 0x00, 0xd2, 0x74, 0x1d, 0x82, 0xd1, 0xeb, - 0x21, 0xb6, 0xd4, 0x11, 0x6c, 0x71, 0x70, 0x2f, 0x5d, 0x47, 0xc3, 0xe8, 0xda, 0x1c, 0x6a, 0x25, - 0x17, 0x1e, 0xc1, 0x97, 0x3e, 0x9c, 0xaf, 0x9d, 0x31, 0x9a, 0x26, 0x12, 0xf6, 0xa5, 0x2c, 0x18, - 0xbb, 0x0b, 0x8a, 0xed, 0xd8, 0xbe, 0x30, 0xee, 0xfa, 0x64, 0xe3, 0xb4, 0xa2, 0x63, 0xfb, 0x85, - 0x19, 0x9d, 0x89, 0xa1, 0x4b, 0x30, 0x6b, 0x5a, 0x2d, 0xe7, 0x29, 0xb3, 0x2e, 0x55, 0x98, 0xd1, - 0xf9, 0x34, 0xfb, 0x9d, 0x04, 0x0a, 0x05, 0xa2, 0x9b, 0x90, 0xe0, 0x8a, 0xca, 0x76, 0x45, 0xfc, - 0x24, 0xd3, 0xef, 0x93, 0x27, 0x0c, 0x50, 0x3c, 0xd0, 0xe7, 0x39, 0xb4, 0x58, 0x41, 0x7b, 0x90, - 0x20, 0x76, 0xcd, 0x31, 0xfc, 0x96, 0x87, 0x05, 0x73, 0x2f, 0xf6, 0x8b, 0x95, 0x02, 0x80, 0xde, - 0xc5, 0xa2, 0x5d, 0x88, 0x87, 0x58, 0xca, 0x0c, 0x5a, 0x24, 0x08, 0x11, 0xb8, 0xfd, 0x34, 0x24, - 0xc5, 0x0e, 0x9b, 0x86, 0xe7, 0xab, 0x5f, 0x2b, 0x00, 0x27, 0xad, 0xe9, 0x53, 0xa5, 0x8b, 0x8d, - 0x46, 0xaa, 0xfc, 0x18, 0x78, 0xfe, 0xcd, 0x90, 0xe7, 0xb7, 0x26, 0x5a, 0x36, 0x9d, 0xe3, 0x7f, - 0x8d, 0x8c, 0xe3, 0xd1, 0x55, 0x48, 0x9b, 0x6e, 0xd3, 0xc6, 0xa4, 0xec, 0xb4, 0x1a, 0xa7, 0xd8, - 0xcb, 0x28, 0x1b, 0xd2, 0x76, 0x5a, 0x4f, 0xf1, 0xc5, 0xc7, 0x6c, 0xad, 0x3f, 0x3a, 0xbe, 0x95, - 0x21, 0xc9, 0x78, 0x99, 0xb6, 0x36, 0xf4, 0x80, 0xa3, 0x52, 0x1b, 0xee, 0x8a, 0x00, 0xb9, 0x98, - 0x07, 0xd5, 0x6f, 0x64, 0x48, 0x1f, 0xe0, 0x3a, 0xf6, 0x71, 0x90, 0x43, 0x6f, 0x84, 0x48, 0xba, - 0x36, 0x48, 0x52, 0x08, 0x1e, 0x8d, 0x34, 0xba, 0x75, 0xe1, 0x13, 0x47, 0xfd, 0x4b, 0x82, 0x85, - 0xc0, 0x62, 0x11, 0x46, 0xb7, 0x42, 0x0c, 0x6d, 0x8e, 0x66, 0x28, 0x5a, 0x91, 0x14, 0xe7, 0x24, - 0xa9, 0x3f, 0xcb, 0x90, 0xa4, 0x4b, 0x41, 0x40, 0x4c, 0xcc, 0x9a, 0x1e, 0x70, 0x34, 0xc2, 0xc1, - 0xba, 0x78, 0x03, 0xb2, 0x02, 0x89, 0x86, 0x61, 0x3b, 0x65, 0xd7, 0xa9, 0x77, 0x44, 0x1b, 0x32, - 0x4f, 0x17, 0x9e, 0x38, 0xf5, 0x4e, 0xd0, 0x9d, 0xc4, 0xba, 0xdd, 0xc9, 0x67, 0x12, 0x2c, 0xf1, - 0x9f, 0x7e, 0x60, 0xfb, 0x56, 0x69, 0x48, 0xfd, 0x93, 0xa6, 0xac, 0x7f, 0x17, 0x2d, 0xb5, 0xea, - 0xdf, 0x32, 0xa4, 0xb8, 0x87, 0x44, 0xf8, 0xee, 0x85, 0xfc, 0x79, 0x75, 0x94, 0x3f, 0xa3, 0x15, - 0xbc, 0x5f, 0x48, 0xc2, 0xa7, 0xf7, 0xfb, 0x98, 0xdd, 0x1c, 0xc5, 0x6c, 0xc8, 0x21, 0x85, 0x99, - 0x73, 0xa2, 0xf7, 0x21, 0x45, 0x2c, 0xd7, 0xf3, 0xc3, 0x66, 0xae, 0x0d, 0xaa, 0x29, 0x51, 0x14, - 0xd7, 0x55, 0x98, 0xd1, 0x93, 0xa4, 0x3b, 0xdd, 0x8f, 0x83, 0x42, 0xa5, 0xd5, 0x7f, 0x63, 0x90, - 0x2e, 0x61, 0xc3, 0x33, 0xad, 0xa9, 0xab, 0x6b, 0x08, 0x1e, 0x8d, 0x74, 0x3a, 0x6f, 0x4f, 0xef, - 0x41, 0xca, 0x74, 0x1d, 0xdf, 0xb0, 0x1d, 0xec, 0x75, 0x8f, 0xa1, 0x95, 0xfe, 0x30, 0x7d, 0x2b, - 0xc0, 0x14, 0x0f, 0xf4, 0xe4, 0xb9, 0x40, 0xb1, 0x82, 0x32, 0x30, 0xd7, 0xc6, 0x1e, 0xfd, 0x37, - 0x33, 0x2f, 0xad, 0x07, 0x53, 0x74, 0x08, 0x73, 0x55, 0xbb, 0xee, 0x63, 0x8f, 0x64, 0x62, 0x1b, - 0xb1, 0xed, 0x64, 0xfe, 0xc6, 0x34, 0xcc, 0x69, 0x47, 0x4c, 0x46, 0x0f, 0x64, 0xb3, 0x0e, 0xc4, - 0xf9, 0x12, 0xba, 0x0d, 0xd0, 0x30, 0x7c, 0xd3, 0x2a, 0xd3, 0x8b, 0x17, 0xdb, 0xe8, 0x42, 0x68, - 0xa3, 0x42, 0xe7, 0x31, 0xc5, 0xbc, 0xdb, 0x69, 0x62, 0x3d, 0xd1, 0x08, 0x86, 0x08, 0x81, 0xe2, - 0x18, 0x0d, 0x9e, 0x85, 0x09, 0x9d, 0x8d, 0xd1, 0x32, 0xcc, 0xb6, 0x8d, 0x7a, 0x0b, 0x33, 0x3a, - 0x13, 0x3a, 0x9f, 0xa8, 0xcf, 0x64, 0x58, 0x08, 0xb6, 0x35, 0xed, 0xe1, 0x11, 0xc6, 0x47, 0x25, - 0xff, 0x7a, 0x4e, 0x58, 0xbb, 0x52, 0xae, 0xdb, 0x84, 0xb6, 0xaa, 0xb1, 0xb1, 0x4d, 0x48, 0xdc, - 0xae, 0xbc, 0x6d, 0x13, 0x5f, 0xdd, 0x83, 0x59, 0xdd, 0x70, 0x6a, 0x18, 0x5d, 0x82, 0xb8, 0x5b, - 0xad, 0x12, 0xcc, 0xbb, 0x5c, 0x45, 0x17, 0x33, 0xba, 0x5e, 0xc7, 0x4e, 0xcd, 0xb7, 0x98, 0xc9, - 0x8a, 0x2e, 0x66, 0xea, 0xef, 0x32, 0xbc, 0x40, 0x2f, 0x3c, 0x54, 0x38, 0xc8, 0xaf, 0xdb, 0x21, - 0x7a, 0xb7, 0x86, 0xdf, 0x90, 0x7a, 0x04, 0xfe, 0xf7, 0x07, 0xd6, 0x0e, 0xcc, 0x7a, 0xd4, 0x5e, - 0x61, 0xce, 0xe5, 0x41, 0x46, 0x38, 0x1d, 0x1c, 0xa5, 0x7e, 0x2e, 0xc3, 0x62, 0x97, 0x22, 0x11, - 0xb3, 0x77, 0x42, 0xa4, 0x5e, 0x1f, 0x47, 0x6a, 0xb4, 0xa2, 0x76, 0x55, 0xf0, 0xba, 0x1c, 0xdc, - 0x8f, 0xa8, 0x85, 0x29, 0x71, 0x3b, 0x52, 0x9f, 0xc5, 0x60, 0x29, 0xb0, 0xac, 0x60, 0x90, 0xf3, - 0x1a, 0x7e, 0x2f, 0x44, 0xc7, 0xcb, 0xa3, 0xe9, 0xe8, 0x11, 0x8a, 0x46, 0x9c, 0x7d, 0x2f, 0x5d, - 0x3c, 0xd0, 0x72, 0x10, 0x67, 0x21, 0x44, 0x32, 0x32, 0x4b, 0xfc, 0x91, 0x91, 0x26, 0x60, 0xb4, - 0x8c, 0x12, 0xa3, 0xee, 0xb3, 0x6d, 0xa7, 0x74, 0x36, 0x46, 0xbb, 0xa0, 0xb0, 0x82, 0xac, 0xb0, - 0x82, 0xbc, 0x3a, 0x70, 0x72, 0x58, 0xd8, 0x7c, 0x4a, 0x5a, 0x0d, 0x56, 0x91, 0x19, 0x52, 0xfd, - 0x45, 0x86, 0xe5, 0x30, 0xdf, 0x22, 0x68, 0xef, 0x87, 0xbc, 0x74, 0x63, 0x92, 0x97, 0xa2, 0x15, - 0xb8, 0xef, 0x09, 0x3f, 0x05, 0x7c, 0x49, 0xd3, 0xf2, 0x45, 0x1b, 0x58, 0xcb, 0x20, 0x16, 0x2f, - 0xd1, 0xd4, 0x53, 0x29, 0x7d, 0x9e, 0x2e, 0xd0, 0x52, 0x9c, 0xff, 0x41, 0x81, 0x34, 0xaf, 0xcf, - 0x25, 0xfe, 0xec, 0x89, 0x0e, 0x20, 0xf6, 0x10, 0xfb, 0x68, 0x75, 0xdc, 0xab, 0x63, 0x76, 0x6d, - 0xec, 0x43, 0xd4, 0xae, 0x44, 0xb5, 0x9c, 0xb4, 0x86, 0x6a, 0xe9, 0x3e, 0x5b, 0x0c, 0xd3, 0xd2, - 0x73, 0x1f, 0xdf, 0x96, 0xd0, 0x23, 0x88, 0xf3, 0x9b, 0x15, 0x7a, 0x69, 0xc2, 0xad, 0x34, 0xbb, - 0x31, 0xe9, 0x52, 0x86, 0x0e, 0x41, 0xa1, 0x5c, 0xa2, 0xb5, 0xb1, 0xf7, 0x99, 0xec, 0xfa, 0xf8, - 0xf6, 0x18, 0x1d, 0x43, 0x9c, 0x1f, 0xd8, 0xc3, 0xf6, 0x14, 0xea, 0x48, 0x86, 0xed, 0x29, 0x7c, - 0xd6, 0xef, 0x4a, 0xa8, 0x04, 0xf3, 0x41, 0x58, 0xa2, 0x2b, 0x13, 0x0f, 0xaf, 0xac, 0x3a, 0xb9, - 0x14, 0xef, 0x4a, 0xe8, 0x23, 0x48, 0xf5, 0xc6, 0x3a, 0xda, 0x9c, 0xaa, 0x62, 0x65, 0xb7, 0xa6, - 0x4b, 0x99, 0xfd, 0xf2, 0x4f, 0x67, 0xeb, 0xd2, 0x6f, 0x67, 0xeb, 0xd2, 0x1f, 0x67, 0xeb, 0xd2, - 0x57, 0x7f, 0xae, 0xcf, 0x7c, 0xb8, 0x57, 0xb3, 0x7d, 0xab, 0x75, 0xaa, 0x99, 0x6e, 0x23, 0xe7, - 0x90, 0xa6, 0x69, 0xee, 0x54, 0x70, 0x3b, 0xe7, 0x60, 0xb7, 0x4a, 0x76, 0x8c, 0xa6, 0xbd, 0x53, - 0x73, 0x73, 0xe1, 0x57, 0xf3, 0x3b, 0x7c, 0xfc, 0x5c, 0x5e, 0x7a, 0x8c, 0xdd, 0xa3, 0x92, 0xf6, - 0xe0, 0xa4, 0x48, 0xff, 0xca, 0x43, 0xf1, 0x34, 0xce, 0x9e, 0xc5, 0x5f, 0xfb, 0x2f, 0x00, 0x00, - 0xff, 0xff, 0x31, 0xd1, 0xce, 0x46, 0x9b, 0x17, 0x00, 0x00, +func file_v2_object_grpc_service_proto_rawDescGZIP() []byte { + file_v2_object_grpc_service_proto_rawDescOnce.Do(func() { + file_v2_object_grpc_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_v2_object_grpc_service_proto_rawDescData) + }) + return file_v2_object_grpc_service_proto_rawDescData +} + +var file_v2_object_grpc_service_proto_msgTypes = make([]protoimpl.MessageInfo, 33) +var file_v2_object_grpc_service_proto_goTypes = []interface{}{ + (*GetRequest)(nil), // 0: neo.fs.v2.object.GetRequest + (*GetResponse)(nil), // 1: neo.fs.v2.object.GetResponse + (*PutRequest)(nil), // 2: neo.fs.v2.object.PutRequest + (*PutResponse)(nil), // 3: neo.fs.v2.object.PutResponse + (*DeleteRequest)(nil), // 4: neo.fs.v2.object.DeleteRequest + (*DeleteResponse)(nil), // 5: neo.fs.v2.object.DeleteResponse + (*HeadRequest)(nil), // 6: neo.fs.v2.object.HeadRequest + (*HeaderWithSignature)(nil), // 7: neo.fs.v2.object.HeaderWithSignature + (*HeadResponse)(nil), // 8: neo.fs.v2.object.HeadResponse + (*SearchRequest)(nil), // 9: neo.fs.v2.object.SearchRequest + (*SearchResponse)(nil), // 10: neo.fs.v2.object.SearchResponse + (*Range)(nil), // 11: neo.fs.v2.object.Range + (*GetRangeRequest)(nil), // 12: neo.fs.v2.object.GetRangeRequest + (*GetRangeResponse)(nil), // 13: neo.fs.v2.object.GetRangeResponse + (*GetRangeHashRequest)(nil), // 14: neo.fs.v2.object.GetRangeHashRequest + (*GetRangeHashResponse)(nil), // 15: neo.fs.v2.object.GetRangeHashResponse + (*GetRequest_Body)(nil), // 16: neo.fs.v2.object.GetRequest.Body + (*GetResponse_Body)(nil), // 17: neo.fs.v2.object.GetResponse.Body + (*GetResponse_Body_Init)(nil), // 18: neo.fs.v2.object.GetResponse.Body.Init + (*PutRequest_Body)(nil), // 19: neo.fs.v2.object.PutRequest.Body + (*PutRequest_Body_Init)(nil), // 20: neo.fs.v2.object.PutRequest.Body.Init + (*PutResponse_Body)(nil), // 21: neo.fs.v2.object.PutResponse.Body + (*DeleteRequest_Body)(nil), // 22: neo.fs.v2.object.DeleteRequest.Body + (*DeleteResponse_Body)(nil), // 23: neo.fs.v2.object.DeleteResponse.Body + (*HeadRequest_Body)(nil), // 24: neo.fs.v2.object.HeadRequest.Body + (*HeadResponse_Body)(nil), // 25: neo.fs.v2.object.HeadResponse.Body + (*SearchRequest_Body)(nil), // 26: neo.fs.v2.object.SearchRequest.Body + (*SearchRequest_Body_Filter)(nil), // 27: neo.fs.v2.object.SearchRequest.Body.Filter + (*SearchResponse_Body)(nil), // 28: neo.fs.v2.object.SearchResponse.Body + (*GetRangeRequest_Body)(nil), // 29: neo.fs.v2.object.GetRangeRequest.Body + (*GetRangeResponse_Body)(nil), // 30: neo.fs.v2.object.GetRangeResponse.Body + (*GetRangeHashRequest_Body)(nil), // 31: neo.fs.v2.object.GetRangeHashRequest.Body + (*GetRangeHashResponse_Body)(nil), // 32: neo.fs.v2.object.GetRangeHashResponse.Body + (*grpc.RequestMetaHeader)(nil), // 33: neo.fs.v2.session.RequestMetaHeader + (*grpc.RequestVerificationHeader)(nil), // 34: neo.fs.v2.session.RequestVerificationHeader + (*grpc.ResponseMetaHeader)(nil), // 35: neo.fs.v2.session.ResponseMetaHeader + (*grpc.ResponseVerificationHeader)(nil), // 36: neo.fs.v2.session.ResponseVerificationHeader + (*Header)(nil), // 37: neo.fs.v2.object.Header + (*grpc1.Signature)(nil), // 38: neo.fs.v2.refs.Signature + (*grpc1.Address)(nil), // 39: neo.fs.v2.refs.Address + (*grpc1.ObjectID)(nil), // 40: neo.fs.v2.refs.ObjectID + (*ShortHeader)(nil), // 41: neo.fs.v2.object.ShortHeader + (*grpc1.ContainerID)(nil), // 42: neo.fs.v2.refs.ContainerID + (MatchType)(0), // 43: neo.fs.v2.object.MatchType + (grpc1.ChecksumType)(0), // 44: neo.fs.v2.refs.ChecksumType +} +var file_v2_object_grpc_service_proto_depIdxs = []int32{ + 16, // 0: neo.fs.v2.object.GetRequest.body:type_name -> neo.fs.v2.object.GetRequest.Body + 33, // 1: neo.fs.v2.object.GetRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader + 34, // 2: neo.fs.v2.object.GetRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader + 17, // 3: neo.fs.v2.object.GetResponse.body:type_name -> neo.fs.v2.object.GetResponse.Body + 35, // 4: neo.fs.v2.object.GetResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader + 36, // 5: neo.fs.v2.object.GetResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 19, // 6: neo.fs.v2.object.PutRequest.body:type_name -> neo.fs.v2.object.PutRequest.Body + 33, // 7: neo.fs.v2.object.PutRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader + 34, // 8: neo.fs.v2.object.PutRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader + 21, // 9: neo.fs.v2.object.PutResponse.body:type_name -> neo.fs.v2.object.PutResponse.Body + 35, // 10: neo.fs.v2.object.PutResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader + 36, // 11: neo.fs.v2.object.PutResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 22, // 12: neo.fs.v2.object.DeleteRequest.body:type_name -> neo.fs.v2.object.DeleteRequest.Body + 33, // 13: neo.fs.v2.object.DeleteRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader + 34, // 14: neo.fs.v2.object.DeleteRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader + 23, // 15: neo.fs.v2.object.DeleteResponse.body:type_name -> neo.fs.v2.object.DeleteResponse.Body + 35, // 16: neo.fs.v2.object.DeleteResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader + 36, // 17: neo.fs.v2.object.DeleteResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 24, // 18: neo.fs.v2.object.HeadRequest.body:type_name -> neo.fs.v2.object.HeadRequest.Body + 33, // 19: neo.fs.v2.object.HeadRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader + 34, // 20: neo.fs.v2.object.HeadRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader + 37, // 21: neo.fs.v2.object.HeaderWithSignature.header:type_name -> neo.fs.v2.object.Header + 38, // 22: neo.fs.v2.object.HeaderWithSignature.signature:type_name -> neo.fs.v2.refs.Signature + 25, // 23: neo.fs.v2.object.HeadResponse.body:type_name -> neo.fs.v2.object.HeadResponse.Body + 35, // 24: neo.fs.v2.object.HeadResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader + 36, // 25: neo.fs.v2.object.HeadResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 26, // 26: neo.fs.v2.object.SearchRequest.body:type_name -> neo.fs.v2.object.SearchRequest.Body + 33, // 27: neo.fs.v2.object.SearchRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader + 34, // 28: neo.fs.v2.object.SearchRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader + 28, // 29: neo.fs.v2.object.SearchResponse.body:type_name -> neo.fs.v2.object.SearchResponse.Body + 35, // 30: neo.fs.v2.object.SearchResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader + 36, // 31: neo.fs.v2.object.SearchResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 29, // 32: neo.fs.v2.object.GetRangeRequest.body:type_name -> neo.fs.v2.object.GetRangeRequest.Body + 33, // 33: neo.fs.v2.object.GetRangeRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader + 34, // 34: neo.fs.v2.object.GetRangeRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader + 30, // 35: neo.fs.v2.object.GetRangeResponse.body:type_name -> neo.fs.v2.object.GetRangeResponse.Body + 35, // 36: neo.fs.v2.object.GetRangeResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader + 36, // 37: neo.fs.v2.object.GetRangeResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 31, // 38: neo.fs.v2.object.GetRangeHashRequest.body:type_name -> neo.fs.v2.object.GetRangeHashRequest.Body + 33, // 39: neo.fs.v2.object.GetRangeHashRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader + 34, // 40: neo.fs.v2.object.GetRangeHashRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader + 32, // 41: neo.fs.v2.object.GetRangeHashResponse.body:type_name -> neo.fs.v2.object.GetRangeHashResponse.Body + 35, // 42: neo.fs.v2.object.GetRangeHashResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader + 36, // 43: neo.fs.v2.object.GetRangeHashResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 39, // 44: neo.fs.v2.object.GetRequest.Body.address:type_name -> neo.fs.v2.refs.Address + 18, // 45: neo.fs.v2.object.GetResponse.Body.init:type_name -> neo.fs.v2.object.GetResponse.Body.Init + 40, // 46: neo.fs.v2.object.GetResponse.Body.Init.object_id:type_name -> neo.fs.v2.refs.ObjectID + 38, // 47: neo.fs.v2.object.GetResponse.Body.Init.signature:type_name -> neo.fs.v2.refs.Signature + 37, // 48: neo.fs.v2.object.GetResponse.Body.Init.header:type_name -> neo.fs.v2.object.Header + 20, // 49: neo.fs.v2.object.PutRequest.Body.init:type_name -> neo.fs.v2.object.PutRequest.Body.Init + 40, // 50: neo.fs.v2.object.PutRequest.Body.Init.object_id:type_name -> neo.fs.v2.refs.ObjectID + 38, // 51: neo.fs.v2.object.PutRequest.Body.Init.signature:type_name -> neo.fs.v2.refs.Signature + 37, // 52: neo.fs.v2.object.PutRequest.Body.Init.header:type_name -> neo.fs.v2.object.Header + 40, // 53: neo.fs.v2.object.PutResponse.Body.object_id:type_name -> neo.fs.v2.refs.ObjectID + 39, // 54: neo.fs.v2.object.DeleteRequest.Body.address:type_name -> neo.fs.v2.refs.Address + 39, // 55: neo.fs.v2.object.HeadRequest.Body.address:type_name -> neo.fs.v2.refs.Address + 7, // 56: neo.fs.v2.object.HeadResponse.Body.header:type_name -> neo.fs.v2.object.HeaderWithSignature + 41, // 57: neo.fs.v2.object.HeadResponse.Body.short_header:type_name -> neo.fs.v2.object.ShortHeader + 42, // 58: neo.fs.v2.object.SearchRequest.Body.container_id:type_name -> neo.fs.v2.refs.ContainerID + 27, // 59: neo.fs.v2.object.SearchRequest.Body.filters:type_name -> neo.fs.v2.object.SearchRequest.Body.Filter + 43, // 60: neo.fs.v2.object.SearchRequest.Body.Filter.match_type:type_name -> neo.fs.v2.object.MatchType + 40, // 61: neo.fs.v2.object.SearchResponse.Body.id_list:type_name -> neo.fs.v2.refs.ObjectID + 39, // 62: neo.fs.v2.object.GetRangeRequest.Body.address:type_name -> neo.fs.v2.refs.Address + 11, // 63: neo.fs.v2.object.GetRangeRequest.Body.range:type_name -> neo.fs.v2.object.Range + 39, // 64: neo.fs.v2.object.GetRangeHashRequest.Body.address:type_name -> neo.fs.v2.refs.Address + 11, // 65: neo.fs.v2.object.GetRangeHashRequest.Body.ranges:type_name -> neo.fs.v2.object.Range + 44, // 66: neo.fs.v2.object.GetRangeHashRequest.Body.type:type_name -> neo.fs.v2.refs.ChecksumType + 44, // 67: neo.fs.v2.object.GetRangeHashResponse.Body.type:type_name -> neo.fs.v2.refs.ChecksumType + 0, // 68: neo.fs.v2.object.ObjectService.Get:input_type -> neo.fs.v2.object.GetRequest + 2, // 69: neo.fs.v2.object.ObjectService.Put:input_type -> neo.fs.v2.object.PutRequest + 4, // 70: neo.fs.v2.object.ObjectService.Delete:input_type -> neo.fs.v2.object.DeleteRequest + 6, // 71: neo.fs.v2.object.ObjectService.Head:input_type -> neo.fs.v2.object.HeadRequest + 9, // 72: neo.fs.v2.object.ObjectService.Search:input_type -> neo.fs.v2.object.SearchRequest + 12, // 73: neo.fs.v2.object.ObjectService.GetRange:input_type -> neo.fs.v2.object.GetRangeRequest + 14, // 74: neo.fs.v2.object.ObjectService.GetRangeHash:input_type -> neo.fs.v2.object.GetRangeHashRequest + 1, // 75: neo.fs.v2.object.ObjectService.Get:output_type -> neo.fs.v2.object.GetResponse + 3, // 76: neo.fs.v2.object.ObjectService.Put:output_type -> neo.fs.v2.object.PutResponse + 5, // 77: neo.fs.v2.object.ObjectService.Delete:output_type -> neo.fs.v2.object.DeleteResponse + 8, // 78: neo.fs.v2.object.ObjectService.Head:output_type -> neo.fs.v2.object.HeadResponse + 10, // 79: neo.fs.v2.object.ObjectService.Search:output_type -> neo.fs.v2.object.SearchResponse + 13, // 80: neo.fs.v2.object.ObjectService.GetRange:output_type -> neo.fs.v2.object.GetRangeResponse + 15, // 81: neo.fs.v2.object.ObjectService.GetRangeHash:output_type -> neo.fs.v2.object.GetRangeHashResponse + 75, // [75:82] is the sub-list for method output_type + 68, // [68:75] is the sub-list for method input_type + 68, // [68:68] is the sub-list for extension type_name + 68, // [68:68] is the sub-list for extension extendee + 0, // [0:68] is the sub-list for field type_name +} + +func init() { file_v2_object_grpc_service_proto_init() } +func file_v2_object_grpc_service_proto_init() { + if File_v2_object_grpc_service_proto != nil { + return + } + file_v2_object_grpc_types_proto_init() + if !protoimpl.UnsafeEnabled { + file_v2_object_grpc_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_object_grpc_service_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_object_grpc_service_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PutRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_object_grpc_service_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PutResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_object_grpc_service_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_object_grpc_service_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_object_grpc_service_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*HeadRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_object_grpc_service_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*HeaderWithSignature); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_object_grpc_service_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*HeadResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_object_grpc_service_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SearchRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_object_grpc_service_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SearchResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_object_grpc_service_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Range); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_object_grpc_service_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetRangeRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_object_grpc_service_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetRangeResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_object_grpc_service_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetRangeHashRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_object_grpc_service_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetRangeHashResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_object_grpc_service_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetRequest_Body); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_object_grpc_service_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetResponse_Body); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_object_grpc_service_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetResponse_Body_Init); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_object_grpc_service_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PutRequest_Body); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_object_grpc_service_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PutRequest_Body_Init); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_object_grpc_service_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PutResponse_Body); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_object_grpc_service_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteRequest_Body); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_object_grpc_service_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteResponse_Body); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_object_grpc_service_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*HeadRequest_Body); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_object_grpc_service_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*HeadResponse_Body); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_object_grpc_service_proto_msgTypes[26].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SearchRequest_Body); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_object_grpc_service_proto_msgTypes[27].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SearchRequest_Body_Filter); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_object_grpc_service_proto_msgTypes[28].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SearchResponse_Body); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_object_grpc_service_proto_msgTypes[29].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetRangeRequest_Body); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_object_grpc_service_proto_msgTypes[30].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetRangeResponse_Body); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_object_grpc_service_proto_msgTypes[31].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetRangeHashRequest_Body); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_object_grpc_service_proto_msgTypes[32].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetRangeHashResponse_Body); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_v2_object_grpc_service_proto_msgTypes[17].OneofWrappers = []interface{}{ + (*GetResponse_Body_Init_)(nil), + (*GetResponse_Body_Chunk)(nil), + } + file_v2_object_grpc_service_proto_msgTypes[19].OneofWrappers = []interface{}{ + (*PutRequest_Body_Init_)(nil), + (*PutRequest_Body_Chunk)(nil), + } + file_v2_object_grpc_service_proto_msgTypes[25].OneofWrappers = []interface{}{ + (*HeadResponse_Body_Header)(nil), + (*HeadResponse_Body_ShortHeader)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_v2_object_grpc_service_proto_rawDesc, + NumEnums: 0, + NumMessages: 33, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_v2_object_grpc_service_proto_goTypes, + DependencyIndexes: file_v2_object_grpc_service_proto_depIdxs, + MessageInfos: file_v2_object_grpc_service_proto_msgTypes, + }.Build() + File_v2_object_grpc_service_proto = out.File + file_v2_object_grpc_service_proto_rawDesc = nil + file_v2_object_grpc_service_proto_goTypes = nil + file_v2_object_grpc_service_proto_depIdxs = nil } // Reference imports to suppress errors if they are not otherwise used. var _ context.Context -var _ grpc2.ClientConn +var _ grpc2.ClientConnInterface // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -const _ = grpc2.SupportPackageIsVersion4 +const _ = grpc2.SupportPackageIsVersion6 // ObjectServiceClient is the client API for ObjectService service. // @@ -2415,10 +3244,10 @@ type ObjectServiceClient interface { } type objectServiceClient struct { - cc *grpc2.ClientConn + cc grpc2.ClientConnInterface } -func NewObjectServiceClient(cc *grpc2.ClientConn) ObjectServiceClient { +func NewObjectServiceClient(cc grpc2.ClientConnInterface) ObjectServiceClient { return &objectServiceClient{cc} } @@ -2622,25 +3451,25 @@ type ObjectServiceServer interface { type UnimplementedObjectServiceServer struct { } -func (*UnimplementedObjectServiceServer) Get(req *GetRequest, srv ObjectService_GetServer) error { +func (*UnimplementedObjectServiceServer) Get(*GetRequest, ObjectService_GetServer) error { return status.Errorf(codes.Unimplemented, "method Get not implemented") } -func (*UnimplementedObjectServiceServer) Put(srv ObjectService_PutServer) error { +func (*UnimplementedObjectServiceServer) Put(ObjectService_PutServer) error { return status.Errorf(codes.Unimplemented, "method Put not implemented") } -func (*UnimplementedObjectServiceServer) Delete(ctx context.Context, req *DeleteRequest) (*DeleteResponse, error) { +func (*UnimplementedObjectServiceServer) Delete(context.Context, *DeleteRequest) (*DeleteResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Delete not implemented") } -func (*UnimplementedObjectServiceServer) Head(ctx context.Context, req *HeadRequest) (*HeadResponse, error) { +func (*UnimplementedObjectServiceServer) Head(context.Context, *HeadRequest) (*HeadResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Head not implemented") } -func (*UnimplementedObjectServiceServer) Search(req *SearchRequest, srv ObjectService_SearchServer) error { +func (*UnimplementedObjectServiceServer) Search(*SearchRequest, ObjectService_SearchServer) error { return status.Errorf(codes.Unimplemented, "method Search not implemented") } -func (*UnimplementedObjectServiceServer) GetRange(req *GetRangeRequest, srv ObjectService_GetRangeServer) error { +func (*UnimplementedObjectServiceServer) GetRange(*GetRangeRequest, ObjectService_GetRangeServer) error { return status.Errorf(codes.Unimplemented, "method GetRange not implemented") } -func (*UnimplementedObjectServiceServer) GetRangeHash(ctx context.Context, req *GetRangeHashRequest) (*GetRangeHashResponse, error) { +func (*UnimplementedObjectServiceServer) GetRangeHash(context.Context, *GetRangeHashRequest) (*GetRangeHashResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method GetRangeHash not implemented") } @@ -2832,7293 +3661,3 @@ var _ObjectService_serviceDesc = grpc2.ServiceDesc{ }, Metadata: "v2/object/grpc/service.proto", } - -func (m *GetRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *GetRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *GetRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.VerifyHeader != nil { - { - size, err := m.VerifyHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if m.MetaHeader != nil { - { - size, err := m.MetaHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.Body != nil { - { - size, err := m.Body.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *GetRequest_Body) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *GetRequest_Body) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *GetRequest_Body) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.Raw { - i-- - if m.Raw { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x10 - } - if m.Address != nil { - { - size, err := m.Address.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *GetResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *GetResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *GetResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.VerifyHeader != nil { - { - size, err := m.VerifyHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if m.MetaHeader != nil { - { - size, err := m.MetaHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.Body != nil { - { - size, err := m.Body.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *GetResponse_Body) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *GetResponse_Body) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *GetResponse_Body) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.ObjectPart != nil { - { - size := m.ObjectPart.Size() - i -= size - if _, err := m.ObjectPart.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - } - } - return len(dAtA) - i, nil -} - -func (m *GetResponse_Body_Init_) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *GetResponse_Body_Init_) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.Init != nil { - { - size, err := m.Init.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} -func (m *GetResponse_Body_Chunk) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *GetResponse_Body_Chunk) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.Chunk != nil { - i -= len(m.Chunk) - copy(dAtA[i:], m.Chunk) - i = encodeVarintService(dAtA, i, uint64(len(m.Chunk))) - i-- - dAtA[i] = 0x12 - } - return len(dAtA) - i, nil -} -func (m *GetResponse_Body_Init) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *GetResponse_Body_Init) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *GetResponse_Body_Init) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.Header != nil { - { - size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if m.Signature != nil { - { - size, err := m.Signature.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.ObjectId != nil { - { - size, err := m.ObjectId.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *PutRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *PutRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *PutRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.VerifyHeader != nil { - { - size, err := m.VerifyHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if m.MetaHeader != nil { - { - size, err := m.MetaHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.Body != nil { - { - size, err := m.Body.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *PutRequest_Body) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *PutRequest_Body) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *PutRequest_Body) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.ObjectPart != nil { - { - size := m.ObjectPart.Size() - i -= size - if _, err := m.ObjectPart.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - } - } - return len(dAtA) - i, nil -} - -func (m *PutRequest_Body_Init_) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *PutRequest_Body_Init_) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.Init != nil { - { - size, err := m.Init.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} -func (m *PutRequest_Body_Chunk) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *PutRequest_Body_Chunk) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.Chunk != nil { - i -= len(m.Chunk) - copy(dAtA[i:], m.Chunk) - i = encodeVarintService(dAtA, i, uint64(len(m.Chunk))) - i-- - dAtA[i] = 0x12 - } - return len(dAtA) - i, nil -} -func (m *PutRequest_Body_Init) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *PutRequest_Body_Init) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *PutRequest_Body_Init) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.CopiesNumber != 0 { - i = encodeVarintService(dAtA, i, uint64(m.CopiesNumber)) - i-- - dAtA[i] = 0x20 - } - if m.Header != nil { - { - size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if m.Signature != nil { - { - size, err := m.Signature.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.ObjectId != nil { - { - size, err := m.ObjectId.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *PutResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *PutResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *PutResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.VerifyHeader != nil { - { - size, err := m.VerifyHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if m.MetaHeader != nil { - { - size, err := m.MetaHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.Body != nil { - { - size, err := m.Body.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *PutResponse_Body) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *PutResponse_Body) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *PutResponse_Body) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.ObjectId != nil { - { - size, err := m.ObjectId.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *DeleteRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *DeleteRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *DeleteRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.VerifyHeader != nil { - { - size, err := m.VerifyHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if m.MetaHeader != nil { - { - size, err := m.MetaHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.Body != nil { - { - size, err := m.Body.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *DeleteRequest_Body) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *DeleteRequest_Body) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *DeleteRequest_Body) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.Address != nil { - { - size, err := m.Address.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *DeleteResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *DeleteResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *DeleteResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.VerifyHeader != nil { - { - size, err := m.VerifyHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if m.MetaHeader != nil { - { - size, err := m.MetaHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.Body != nil { - { - size, err := m.Body.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *DeleteResponse_Body) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *DeleteResponse_Body) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *DeleteResponse_Body) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - return len(dAtA) - i, nil -} - -func (m *HeadRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *HeadRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *HeadRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.VerifyHeader != nil { - { - size, err := m.VerifyHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if m.MetaHeader != nil { - { - size, err := m.MetaHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.Body != nil { - { - size, err := m.Body.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *HeadRequest_Body) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *HeadRequest_Body) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *HeadRequest_Body) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.Raw { - i-- - if m.Raw { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x18 - } - if m.MainOnly { - i-- - if m.MainOnly { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x10 - } - if m.Address != nil { - { - size, err := m.Address.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *HeaderWithSignature) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *HeaderWithSignature) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *HeaderWithSignature) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.Signature != nil { - { - size, err := m.Signature.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.Header != nil { - { - size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *HeadResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *HeadResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *HeadResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.VerifyHeader != nil { - { - size, err := m.VerifyHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if m.MetaHeader != nil { - { - size, err := m.MetaHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.Body != nil { - { - size, err := m.Body.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *HeadResponse_Body) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *HeadResponse_Body) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *HeadResponse_Body) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.Head != nil { - { - size := m.Head.Size() - i -= size - if _, err := m.Head.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - } - } - return len(dAtA) - i, nil -} - -func (m *HeadResponse_Body_Header) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *HeadResponse_Body_Header) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.Header != nil { - { - size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} -func (m *HeadResponse_Body_ShortHeader) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *HeadResponse_Body_ShortHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.ShortHeader != nil { - { - size, err := m.ShortHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - return len(dAtA) - i, nil -} -func (m *SearchRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *SearchRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *SearchRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.VerifyHeader != nil { - { - size, err := m.VerifyHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if m.MetaHeader != nil { - { - size, err := m.MetaHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.Body != nil { - { - size, err := m.Body.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *SearchRequest_Body) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *SearchRequest_Body) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *SearchRequest_Body) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.Filters) > 0 { - for iNdEx := len(m.Filters) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Filters[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - } - if m.Version != 0 { - i = encodeVarintService(dAtA, i, uint64(m.Version)) - i-- - dAtA[i] = 0x10 - } - if m.ContainerId != nil { - { - size, err := m.ContainerId.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *SearchRequest_Body_Filter) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *SearchRequest_Body_Filter) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *SearchRequest_Body_Filter) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.Value) > 0 { - i -= len(m.Value) - copy(dAtA[i:], m.Value) - i = encodeVarintService(dAtA, i, uint64(len(m.Value))) - i-- - dAtA[i] = 0x1a - } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintService(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0x12 - } - if m.MatchType != 0 { - i = encodeVarintService(dAtA, i, uint64(m.MatchType)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *SearchResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *SearchResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *SearchResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.VerifyHeader != nil { - { - size, err := m.VerifyHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if m.MetaHeader != nil { - { - size, err := m.MetaHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.Body != nil { - { - size, err := m.Body.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *SearchResponse_Body) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *SearchResponse_Body) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *SearchResponse_Body) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.IdList) > 0 { - for iNdEx := len(m.IdList) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.IdList[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *Range) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Range) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Range) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.Length != 0 { - i = encodeVarintService(dAtA, i, uint64(m.Length)) - i-- - dAtA[i] = 0x10 - } - if m.Offset != 0 { - i = encodeVarintService(dAtA, i, uint64(m.Offset)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *GetRangeRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *GetRangeRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *GetRangeRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.VerifyHeader != nil { - { - size, err := m.VerifyHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if m.MetaHeader != nil { - { - size, err := m.MetaHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.Body != nil { - { - size, err := m.Body.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *GetRangeRequest_Body) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *GetRangeRequest_Body) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *GetRangeRequest_Body) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.Range != nil { - { - size, err := m.Range.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.Address != nil { - { - size, err := m.Address.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *GetRangeResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *GetRangeResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *GetRangeResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.VerifyHeader != nil { - { - size, err := m.VerifyHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if m.MetaHeader != nil { - { - size, err := m.MetaHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.Body != nil { - { - size, err := m.Body.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *GetRangeResponse_Body) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *GetRangeResponse_Body) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *GetRangeResponse_Body) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.Chunk) > 0 { - i -= len(m.Chunk) - copy(dAtA[i:], m.Chunk) - i = encodeVarintService(dAtA, i, uint64(len(m.Chunk))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *GetRangeHashRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *GetRangeHashRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *GetRangeHashRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.VerifyHeader != nil { - { - size, err := m.VerifyHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if m.MetaHeader != nil { - { - size, err := m.MetaHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.Body != nil { - { - size, err := m.Body.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *GetRangeHashRequest_Body) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *GetRangeHashRequest_Body) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *GetRangeHashRequest_Body) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.Type != 0 { - i = encodeVarintService(dAtA, i, uint64(m.Type)) - i-- - dAtA[i] = 0x20 - } - if len(m.Salt) > 0 { - i -= len(m.Salt) - copy(dAtA[i:], m.Salt) - i = encodeVarintService(dAtA, i, uint64(len(m.Salt))) - i-- - dAtA[i] = 0x1a - } - if len(m.Ranges) > 0 { - for iNdEx := len(m.Ranges) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Ranges[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - if m.Address != nil { - { - size, err := m.Address.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *GetRangeHashResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *GetRangeHashResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *GetRangeHashResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.VerifyHeader != nil { - { - size, err := m.VerifyHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if m.MetaHeader != nil { - { - size, err := m.MetaHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.Body != nil { - { - size, err := m.Body.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *GetRangeHashResponse_Body) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *GetRangeHashResponse_Body) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *GetRangeHashResponse_Body) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.HashList) > 0 { - for iNdEx := len(m.HashList) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.HashList[iNdEx]) - copy(dAtA[i:], m.HashList[iNdEx]) - i = encodeVarintService(dAtA, i, uint64(len(m.HashList[iNdEx]))) - i-- - dAtA[i] = 0x12 - } - } - if m.Type != 0 { - i = encodeVarintService(dAtA, i, uint64(m.Type)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func encodeVarintService(dAtA []byte, offset int, v uint64) int { - offset -= sovService(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *GetRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Body != nil { - l = m.Body.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.MetaHeader != nil { - l = m.MetaHeader.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.VerifyHeader != nil { - l = m.VerifyHeader.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *GetRequest_Body) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Address != nil { - l = m.Address.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.Raw { - n += 2 - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *GetResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Body != nil { - l = m.Body.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.MetaHeader != nil { - l = m.MetaHeader.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.VerifyHeader != nil { - l = m.VerifyHeader.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *GetResponse_Body) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ObjectPart != nil { - n += m.ObjectPart.Size() - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *GetResponse_Body_Init_) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Init != nil { - l = m.Init.Size() - n += 1 + l + sovService(uint64(l)) - } - return n -} -func (m *GetResponse_Body_Chunk) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Chunk != nil { - l = len(m.Chunk) - n += 1 + l + sovService(uint64(l)) - } - return n -} -func (m *GetResponse_Body_Init) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ObjectId != nil { - l = m.ObjectId.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.Signature != nil { - l = m.Signature.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.Header != nil { - l = m.Header.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *PutRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Body != nil { - l = m.Body.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.MetaHeader != nil { - l = m.MetaHeader.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.VerifyHeader != nil { - l = m.VerifyHeader.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *PutRequest_Body) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ObjectPart != nil { - n += m.ObjectPart.Size() - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *PutRequest_Body_Init_) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Init != nil { - l = m.Init.Size() - n += 1 + l + sovService(uint64(l)) - } - return n -} -func (m *PutRequest_Body_Chunk) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Chunk != nil { - l = len(m.Chunk) - n += 1 + l + sovService(uint64(l)) - } - return n -} -func (m *PutRequest_Body_Init) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ObjectId != nil { - l = m.ObjectId.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.Signature != nil { - l = m.Signature.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.Header != nil { - l = m.Header.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.CopiesNumber != 0 { - n += 1 + sovService(uint64(m.CopiesNumber)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *PutResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Body != nil { - l = m.Body.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.MetaHeader != nil { - l = m.MetaHeader.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.VerifyHeader != nil { - l = m.VerifyHeader.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *PutResponse_Body) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ObjectId != nil { - l = m.ObjectId.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *DeleteRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Body != nil { - l = m.Body.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.MetaHeader != nil { - l = m.MetaHeader.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.VerifyHeader != nil { - l = m.VerifyHeader.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *DeleteRequest_Body) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Address != nil { - l = m.Address.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *DeleteResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Body != nil { - l = m.Body.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.MetaHeader != nil { - l = m.MetaHeader.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.VerifyHeader != nil { - l = m.VerifyHeader.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *DeleteResponse_Body) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *HeadRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Body != nil { - l = m.Body.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.MetaHeader != nil { - l = m.MetaHeader.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.VerifyHeader != nil { - l = m.VerifyHeader.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *HeadRequest_Body) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Address != nil { - l = m.Address.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.MainOnly { - n += 2 - } - if m.Raw { - n += 2 - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *HeaderWithSignature) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Header != nil { - l = m.Header.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.Signature != nil { - l = m.Signature.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *HeadResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Body != nil { - l = m.Body.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.MetaHeader != nil { - l = m.MetaHeader.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.VerifyHeader != nil { - l = m.VerifyHeader.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *HeadResponse_Body) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Head != nil { - n += m.Head.Size() - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *HeadResponse_Body_Header) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Header != nil { - l = m.Header.Size() - n += 1 + l + sovService(uint64(l)) - } - return n -} -func (m *HeadResponse_Body_ShortHeader) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ShortHeader != nil { - l = m.ShortHeader.Size() - n += 1 + l + sovService(uint64(l)) - } - return n -} -func (m *SearchRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Body != nil { - l = m.Body.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.MetaHeader != nil { - l = m.MetaHeader.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.VerifyHeader != nil { - l = m.VerifyHeader.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *SearchRequest_Body) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ContainerId != nil { - l = m.ContainerId.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.Version != 0 { - n += 1 + sovService(uint64(m.Version)) - } - if len(m.Filters) > 0 { - for _, e := range m.Filters { - l = e.Size() - n += 1 + l + sovService(uint64(l)) - } - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *SearchRequest_Body_Filter) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.MatchType != 0 { - n += 1 + sovService(uint64(m.MatchType)) - } - l = len(m.Name) - if l > 0 { - n += 1 + l + sovService(uint64(l)) - } - l = len(m.Value) - if l > 0 { - n += 1 + l + sovService(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *SearchResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Body != nil { - l = m.Body.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.MetaHeader != nil { - l = m.MetaHeader.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.VerifyHeader != nil { - l = m.VerifyHeader.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *SearchResponse_Body) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.IdList) > 0 { - for _, e := range m.IdList { - l = e.Size() - n += 1 + l + sovService(uint64(l)) - } - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *Range) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Offset != 0 { - n += 1 + sovService(uint64(m.Offset)) - } - if m.Length != 0 { - n += 1 + sovService(uint64(m.Length)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *GetRangeRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Body != nil { - l = m.Body.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.MetaHeader != nil { - l = m.MetaHeader.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.VerifyHeader != nil { - l = m.VerifyHeader.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *GetRangeRequest_Body) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Address != nil { - l = m.Address.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.Range != nil { - l = m.Range.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *GetRangeResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Body != nil { - l = m.Body.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.MetaHeader != nil { - l = m.MetaHeader.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.VerifyHeader != nil { - l = m.VerifyHeader.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *GetRangeResponse_Body) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Chunk) - if l > 0 { - n += 1 + l + sovService(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *GetRangeHashRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Body != nil { - l = m.Body.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.MetaHeader != nil { - l = m.MetaHeader.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.VerifyHeader != nil { - l = m.VerifyHeader.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *GetRangeHashRequest_Body) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Address != nil { - l = m.Address.Size() - n += 1 + l + sovService(uint64(l)) - } - if len(m.Ranges) > 0 { - for _, e := range m.Ranges { - l = e.Size() - n += 1 + l + sovService(uint64(l)) - } - } - l = len(m.Salt) - if l > 0 { - n += 1 + l + sovService(uint64(l)) - } - if m.Type != 0 { - n += 1 + sovService(uint64(m.Type)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *GetRangeHashResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Body != nil { - l = m.Body.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.MetaHeader != nil { - l = m.MetaHeader.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.VerifyHeader != nil { - l = m.VerifyHeader.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *GetRangeHashResponse_Body) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Type != 0 { - n += 1 + sovService(uint64(m.Type)) - } - if len(m.HashList) > 0 { - for _, b := range m.HashList { - l = len(b) - n += 1 + l + sovService(uint64(l)) - } - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func sovService(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozService(x uint64) (n int) { - return sovService(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *GetRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: GetRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GetRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Body", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Body == nil { - m.Body = &GetRequest_Body{} - } - if err := m.Body.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MetaHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.MetaHeader == nil { - m.MetaHeader = &grpc.RequestMetaHeader{} - } - if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field VerifyHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.VerifyHeader == nil { - m.VerifyHeader = &grpc.RequestVerificationHeader{} - } - if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *GetRequest_Body) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Body: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Body: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Address == nil { - m.Address = &grpc1.Address{} - } - if err := m.Address.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Raw", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Raw = bool(v != 0) - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *GetResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: GetResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GetResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Body", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Body == nil { - m.Body = &GetResponse_Body{} - } - if err := m.Body.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MetaHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.MetaHeader == nil { - m.MetaHeader = &grpc.ResponseMetaHeader{} - } - if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field VerifyHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.VerifyHeader == nil { - m.VerifyHeader = &grpc.ResponseVerificationHeader{} - } - if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *GetResponse_Body) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Body: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Body: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Init", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := &GetResponse_Body_Init{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.ObjectPart = &GetResponse_Body_Init_{v} - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Chunk", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := make([]byte, postIndex-iNdEx) - copy(v, dAtA[iNdEx:postIndex]) - m.ObjectPart = &GetResponse_Body_Chunk{v} - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *GetResponse_Body_Init) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Init: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Init: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ObjectId", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.ObjectId == nil { - m.ObjectId = &grpc1.ObjectID{} - } - if err := m.ObjectId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Signature", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Signature == nil { - m.Signature = &grpc1.Signature{} - } - if err := m.Signature.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Header == nil { - m.Header = &Header{} - } - if err := m.Header.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *PutRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: PutRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: PutRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Body", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Body == nil { - m.Body = &PutRequest_Body{} - } - if err := m.Body.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MetaHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.MetaHeader == nil { - m.MetaHeader = &grpc.RequestMetaHeader{} - } - if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field VerifyHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.VerifyHeader == nil { - m.VerifyHeader = &grpc.RequestVerificationHeader{} - } - if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *PutRequest_Body) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Body: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Body: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Init", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := &PutRequest_Body_Init{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.ObjectPart = &PutRequest_Body_Init_{v} - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Chunk", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := make([]byte, postIndex-iNdEx) - copy(v, dAtA[iNdEx:postIndex]) - m.ObjectPart = &PutRequest_Body_Chunk{v} - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *PutRequest_Body_Init) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Init: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Init: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ObjectId", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.ObjectId == nil { - m.ObjectId = &grpc1.ObjectID{} - } - if err := m.ObjectId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Signature", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Signature == nil { - m.Signature = &grpc1.Signature{} - } - if err := m.Signature.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Header == nil { - m.Header = &Header{} - } - if err := m.Header.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field CopiesNumber", wireType) - } - m.CopiesNumber = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.CopiesNumber |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *PutResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: PutResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: PutResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Body", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Body == nil { - m.Body = &PutResponse_Body{} - } - if err := m.Body.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MetaHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.MetaHeader == nil { - m.MetaHeader = &grpc.ResponseMetaHeader{} - } - if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field VerifyHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.VerifyHeader == nil { - m.VerifyHeader = &grpc.ResponseVerificationHeader{} - } - if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *PutResponse_Body) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Body: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Body: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ObjectId", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.ObjectId == nil { - m.ObjectId = &grpc1.ObjectID{} - } - if err := m.ObjectId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *DeleteRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: DeleteRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: DeleteRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Body", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Body == nil { - m.Body = &DeleteRequest_Body{} - } - if err := m.Body.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MetaHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.MetaHeader == nil { - m.MetaHeader = &grpc.RequestMetaHeader{} - } - if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field VerifyHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.VerifyHeader == nil { - m.VerifyHeader = &grpc.RequestVerificationHeader{} - } - if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *DeleteRequest_Body) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Body: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Body: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Address == nil { - m.Address = &grpc1.Address{} - } - if err := m.Address.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *DeleteResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: DeleteResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: DeleteResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Body", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Body == nil { - m.Body = &DeleteResponse_Body{} - } - if err := m.Body.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MetaHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.MetaHeader == nil { - m.MetaHeader = &grpc.ResponseMetaHeader{} - } - if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field VerifyHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.VerifyHeader == nil { - m.VerifyHeader = &grpc.ResponseVerificationHeader{} - } - if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *DeleteResponse_Body) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Body: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Body: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *HeadRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: HeadRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: HeadRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Body", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Body == nil { - m.Body = &HeadRequest_Body{} - } - if err := m.Body.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MetaHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.MetaHeader == nil { - m.MetaHeader = &grpc.RequestMetaHeader{} - } - if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field VerifyHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.VerifyHeader == nil { - m.VerifyHeader = &grpc.RequestVerificationHeader{} - } - if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *HeadRequest_Body) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Body: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Body: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Address == nil { - m.Address = &grpc1.Address{} - } - if err := m.Address.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MainOnly", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.MainOnly = bool(v != 0) - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Raw", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Raw = bool(v != 0) - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *HeaderWithSignature) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: HeaderWithSignature: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: HeaderWithSignature: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Header == nil { - m.Header = &Header{} - } - if err := m.Header.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Signature", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Signature == nil { - m.Signature = &grpc1.Signature{} - } - if err := m.Signature.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *HeadResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: HeadResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: HeadResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Body", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Body == nil { - m.Body = &HeadResponse_Body{} - } - if err := m.Body.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MetaHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.MetaHeader == nil { - m.MetaHeader = &grpc.ResponseMetaHeader{} - } - if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field VerifyHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.VerifyHeader == nil { - m.VerifyHeader = &grpc.ResponseVerificationHeader{} - } - if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *HeadResponse_Body) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Body: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Body: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := &HeaderWithSignature{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Head = &HeadResponse_Body_Header{v} - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ShortHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := &ShortHeader{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Head = &HeadResponse_Body_ShortHeader{v} - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *SearchRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: SearchRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: SearchRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Body", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Body == nil { - m.Body = &SearchRequest_Body{} - } - if err := m.Body.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MetaHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.MetaHeader == nil { - m.MetaHeader = &grpc.RequestMetaHeader{} - } - if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field VerifyHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.VerifyHeader == nil { - m.VerifyHeader = &grpc.RequestVerificationHeader{} - } - if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *SearchRequest_Body) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Body: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Body: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ContainerId", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.ContainerId == nil { - m.ContainerId = &grpc1.ContainerID{} - } - if err := m.ContainerId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) - } - m.Version = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Version |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Filters", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Filters = append(m.Filters, &SearchRequest_Body_Filter{}) - if err := m.Filters[len(m.Filters)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *SearchRequest_Body_Filter) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Filter: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Filter: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MatchType", wireType) - } - m.MatchType = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MatchType |= MatchType(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Value = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *SearchResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: SearchResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: SearchResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Body", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Body == nil { - m.Body = &SearchResponse_Body{} - } - if err := m.Body.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MetaHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.MetaHeader == nil { - m.MetaHeader = &grpc.ResponseMetaHeader{} - } - if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field VerifyHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.VerifyHeader == nil { - m.VerifyHeader = &grpc.ResponseVerificationHeader{} - } - if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *SearchResponse_Body) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Body: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Body: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field IdList", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.IdList = append(m.IdList, &grpc1.ObjectID{}) - if err := m.IdList[len(m.IdList)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Range) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Range: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Range: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Offset", wireType) - } - m.Offset = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Offset |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Length", wireType) - } - m.Length = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Length |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *GetRangeRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: GetRangeRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GetRangeRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Body", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Body == nil { - m.Body = &GetRangeRequest_Body{} - } - if err := m.Body.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MetaHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.MetaHeader == nil { - m.MetaHeader = &grpc.RequestMetaHeader{} - } - if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field VerifyHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.VerifyHeader == nil { - m.VerifyHeader = &grpc.RequestVerificationHeader{} - } - if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *GetRangeRequest_Body) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Body: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Body: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Address == nil { - m.Address = &grpc1.Address{} - } - if err := m.Address.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Range", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Range == nil { - m.Range = &Range{} - } - if err := m.Range.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *GetRangeResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: GetRangeResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GetRangeResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Body", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Body == nil { - m.Body = &GetRangeResponse_Body{} - } - if err := m.Body.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MetaHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.MetaHeader == nil { - m.MetaHeader = &grpc.ResponseMetaHeader{} - } - if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field VerifyHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.VerifyHeader == nil { - m.VerifyHeader = &grpc.ResponseVerificationHeader{} - } - if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *GetRangeResponse_Body) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Body: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Body: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Chunk", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Chunk = append(m.Chunk[:0], dAtA[iNdEx:postIndex]...) - if m.Chunk == nil { - m.Chunk = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *GetRangeHashRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: GetRangeHashRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GetRangeHashRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Body", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Body == nil { - m.Body = &GetRangeHashRequest_Body{} - } - if err := m.Body.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MetaHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.MetaHeader == nil { - m.MetaHeader = &grpc.RequestMetaHeader{} - } - if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field VerifyHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.VerifyHeader == nil { - m.VerifyHeader = &grpc.RequestVerificationHeader{} - } - if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *GetRangeHashRequest_Body) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Body: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Body: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Address == nil { - m.Address = &grpc1.Address{} - } - if err := m.Address.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Ranges", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Ranges = append(m.Ranges, &Range{}) - if err := m.Ranges[len(m.Ranges)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Salt", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Salt = append(m.Salt[:0], dAtA[iNdEx:postIndex]...) - if m.Salt == nil { - m.Salt = []byte{} - } - iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) - } - m.Type = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Type |= grpc1.ChecksumType(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *GetRangeHashResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: GetRangeHashResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GetRangeHashResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Body", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Body == nil { - m.Body = &GetRangeHashResponse_Body{} - } - if err := m.Body.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MetaHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.MetaHeader == nil { - m.MetaHeader = &grpc.ResponseMetaHeader{} - } - if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field VerifyHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.VerifyHeader == nil { - m.VerifyHeader = &grpc.ResponseVerificationHeader{} - } - if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *GetRangeHashResponse_Body) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Body: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Body: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) - } - m.Type = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Type |= grpc1.ChecksumType(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field HashList", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.HashList = append(m.HashList, make([]byte, postIndex-iNdEx)) - copy(m.HashList[len(m.HashList)-1], dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipService(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowService - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowService - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowService - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthService - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupService - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthService - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthService = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowService = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupService = fmt.Errorf("proto: unexpected end of group") -) diff --git a/v2/object/grpc/types.pb.go b/v2/object/grpc/types.pb.go index bd1dfd4..8e64894 100644 --- a/v2/object/grpc/types.pb.go +++ b/v2/object/grpc/types.pb.go @@ -1,28 +1,31 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.23.0 +// protoc v3.13.0 // source: v2/object/grpc/types.proto package object import ( - fmt "fmt" proto "github.com/golang/protobuf/proto" grpc "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" grpc1 "github.com/nspcc-dev/neofs-api-go/v2/session/grpc" - io "io" - math "math" - math_bits "math/bits" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +// This is a compile-time assertion that a sufficiently up-to-date version +// of the legacy proto package is being used. +const _ = proto.ProtoPackageIsVersion4 // Type of the object payload content. type ObjectType int32 @@ -36,24 +39,45 @@ const ( ObjectType_STORAGE_GROUP ObjectType = 2 ) -var ObjectType_name = map[int32]string{ - 0: "REGULAR", - 1: "TOMBSTONE", - 2: "STORAGE_GROUP", -} +// Enum value maps for ObjectType. +var ( + ObjectType_name = map[int32]string{ + 0: "REGULAR", + 1: "TOMBSTONE", + 2: "STORAGE_GROUP", + } + ObjectType_value = map[string]int32{ + "REGULAR": 0, + "TOMBSTONE": 1, + "STORAGE_GROUP": 2, + } +) -var ObjectType_value = map[string]int32{ - "REGULAR": 0, - "TOMBSTONE": 1, - "STORAGE_GROUP": 2, +func (x ObjectType) Enum() *ObjectType { + p := new(ObjectType) + *p = x + return p } func (x ObjectType) String() string { - return proto.EnumName(ObjectType_name, int32(x)) + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) } +func (ObjectType) Descriptor() protoreflect.EnumDescriptor { + return file_v2_object_grpc_types_proto_enumTypes[0].Descriptor() +} + +func (ObjectType) Type() protoreflect.EnumType { + return &file_v2_object_grpc_types_proto_enumTypes[0] +} + +func (x ObjectType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use ObjectType.Descriptor instead. func (ObjectType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_545319325da7b9b1, []int{0} + return file_v2_object_grpc_types_proto_rawDescGZIP(), []int{0} } // Type of match expression @@ -66,26 +90,51 @@ const ( MatchType_STRING_EQUAL MatchType = 1 ) -var MatchType_name = map[int32]string{ - 0: "MATCH_TYPE_UNSPECIFIED", - 1: "STRING_EQUAL", -} +// Enum value maps for MatchType. +var ( + MatchType_name = map[int32]string{ + 0: "MATCH_TYPE_UNSPECIFIED", + 1: "STRING_EQUAL", + } + MatchType_value = map[string]int32{ + "MATCH_TYPE_UNSPECIFIED": 0, + "STRING_EQUAL": 1, + } +) -var MatchType_value = map[string]int32{ - "MATCH_TYPE_UNSPECIFIED": 0, - "STRING_EQUAL": 1, +func (x MatchType) Enum() *MatchType { + p := new(MatchType) + *p = x + return p } func (x MatchType) String() string { - return proto.EnumName(MatchType_name, int32(x)) + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) } +func (MatchType) Descriptor() protoreflect.EnumDescriptor { + return file_v2_object_grpc_types_proto_enumTypes[1].Descriptor() +} + +func (MatchType) Type() protoreflect.EnumType { + return &file_v2_object_grpc_types_proto_enumTypes[1] +} + +func (x MatchType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use MatchType.Descriptor instead. func (MatchType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_545319325da7b9b1, []int{1} + return file_v2_object_grpc_types_proto_rawDescGZIP(), []int{1} } // Short header fields type ShortHeader struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // Object format version. Effectively the version of API library used to // create particular object Version *grpc.Version `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` @@ -97,82 +146,82 @@ type ShortHeader struct { ObjectType ObjectType `protobuf:"varint,4,opt,name=object_type,json=objectType,proto3,enum=neo.fs.v2.object.ObjectType" json:"object_type,omitempty"` // Size of payload in bytes. // `0xFFFFFFFFFFFFFFFF` means `payload_length` is unknown - PayloadLength uint64 `protobuf:"varint,5,opt,name=payload_length,json=payloadLength,proto3" json:"payload_length,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + PayloadLength uint64 `protobuf:"varint,5,opt,name=payload_length,json=payloadLength,proto3" json:"payload_length,omitempty"` } -func (m *ShortHeader) Reset() { *m = ShortHeader{} } -func (m *ShortHeader) String() string { return proto.CompactTextString(m) } -func (*ShortHeader) ProtoMessage() {} -func (*ShortHeader) Descriptor() ([]byte, []int) { - return fileDescriptor_545319325da7b9b1, []int{0} -} -func (m *ShortHeader) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ShortHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ShortHeader.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil +func (x *ShortHeader) Reset() { + *x = ShortHeader{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_object_grpc_types_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } } -func (m *ShortHeader) XXX_Merge(src proto.Message) { - xxx_messageInfo_ShortHeader.Merge(m, src) -} -func (m *ShortHeader) XXX_Size() int { - return m.Size() -} -func (m *ShortHeader) XXX_DiscardUnknown() { - xxx_messageInfo_ShortHeader.DiscardUnknown(m) + +func (x *ShortHeader) String() string { + return protoimpl.X.MessageStringOf(x) } -var xxx_messageInfo_ShortHeader proto.InternalMessageInfo +func (*ShortHeader) ProtoMessage() {} -func (m *ShortHeader) GetVersion() *grpc.Version { - if m != nil { - return m.Version +func (x *ShortHeader) ProtoReflect() protoreflect.Message { + mi := &file_v2_object_grpc_types_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ShortHeader.ProtoReflect.Descriptor instead. +func (*ShortHeader) Descriptor() ([]byte, []int) { + return file_v2_object_grpc_types_proto_rawDescGZIP(), []int{0} +} + +func (x *ShortHeader) GetVersion() *grpc.Version { + if x != nil { + return x.Version } return nil } -func (m *ShortHeader) GetCreationEpoch() uint64 { - if m != nil { - return m.CreationEpoch +func (x *ShortHeader) GetCreationEpoch() uint64 { + if x != nil { + return x.CreationEpoch } return 0 } -func (m *ShortHeader) GetOwnerId() *grpc.OwnerID { - if m != nil { - return m.OwnerId +func (x *ShortHeader) GetOwnerId() *grpc.OwnerID { + if x != nil { + return x.OwnerId } return nil } -func (m *ShortHeader) GetObjectType() ObjectType { - if m != nil { - return m.ObjectType +func (x *ShortHeader) GetObjectType() ObjectType { + if x != nil { + return x.ObjectType } return ObjectType_REGULAR } -func (m *ShortHeader) GetPayloadLength() uint64 { - if m != nil { - return m.PayloadLength +func (x *ShortHeader) GetPayloadLength() uint64 { + if x != nil { + return x.PayloadLength } return 0 } // Object Header type Header struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // Object format version. Effectively the version of API library used to // create particular object Version *grpc.Version `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` @@ -197,118 +246,192 @@ type Header struct { // User-defined object attributes Attributes []*Header_Attribute `protobuf:"bytes,10,rep,name=attributes,proto3" json:"attributes,omitempty"` // Position of the object in the split hierarchy - Split *Header_Split `protobuf:"bytes,11,opt,name=split,proto3" json:"split,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Split *Header_Split `protobuf:"bytes,11,opt,name=split,proto3" json:"split,omitempty"` } -func (m *Header) Reset() { *m = Header{} } -func (m *Header) String() string { return proto.CompactTextString(m) } -func (*Header) ProtoMessage() {} -func (*Header) Descriptor() ([]byte, []int) { - return fileDescriptor_545319325da7b9b1, []int{1} +func (x *Header) Reset() { + *x = Header{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_object_grpc_types_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *Header) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) + +func (x *Header) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *Header) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Header.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err + +func (*Header) ProtoMessage() {} + +func (x *Header) ProtoReflect() protoreflect.Message { + mi := &file_v2_object_grpc_types_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) } - return b[:n], nil + return ms } -} -func (m *Header) XXX_Merge(src proto.Message) { - xxx_messageInfo_Header.Merge(m, src) -} -func (m *Header) XXX_Size() int { - return m.Size() -} -func (m *Header) XXX_DiscardUnknown() { - xxx_messageInfo_Header.DiscardUnknown(m) + return mi.MessageOf(x) } -var xxx_messageInfo_Header proto.InternalMessageInfo +// Deprecated: Use Header.ProtoReflect.Descriptor instead. +func (*Header) Descriptor() ([]byte, []int) { + return file_v2_object_grpc_types_proto_rawDescGZIP(), []int{1} +} -func (m *Header) GetVersion() *grpc.Version { - if m != nil { - return m.Version +func (x *Header) GetVersion() *grpc.Version { + if x != nil { + return x.Version } return nil } -func (m *Header) GetContainerId() *grpc.ContainerID { - if m != nil { - return m.ContainerId +func (x *Header) GetContainerId() *grpc.ContainerID { + if x != nil { + return x.ContainerId } return nil } -func (m *Header) GetOwnerId() *grpc.OwnerID { - if m != nil { - return m.OwnerId +func (x *Header) GetOwnerId() *grpc.OwnerID { + if x != nil { + return x.OwnerId } return nil } -func (m *Header) GetCreationEpoch() uint64 { - if m != nil { - return m.CreationEpoch +func (x *Header) GetCreationEpoch() uint64 { + if x != nil { + return x.CreationEpoch } return 0 } -func (m *Header) GetPayloadLength() uint64 { - if m != nil { - return m.PayloadLength +func (x *Header) GetPayloadLength() uint64 { + if x != nil { + return x.PayloadLength } return 0 } -func (m *Header) GetPayloadHash() *grpc.Checksum { - if m != nil { - return m.PayloadHash +func (x *Header) GetPayloadHash() *grpc.Checksum { + if x != nil { + return x.PayloadHash } return nil } -func (m *Header) GetObjectType() ObjectType { - if m != nil { - return m.ObjectType +func (x *Header) GetObjectType() ObjectType { + if x != nil { + return x.ObjectType } return ObjectType_REGULAR } -func (m *Header) GetHomomorphicHash() *grpc.Checksum { - if m != nil { - return m.HomomorphicHash +func (x *Header) GetHomomorphicHash() *grpc.Checksum { + if x != nil { + return x.HomomorphicHash } return nil } -func (m *Header) GetSessionToken() *grpc1.SessionToken { - if m != nil { - return m.SessionToken +func (x *Header) GetSessionToken() *grpc1.SessionToken { + if x != nil { + return x.SessionToken } return nil } -func (m *Header) GetAttributes() []*Header_Attribute { - if m != nil { - return m.Attributes +func (x *Header) GetAttributes() []*Header_Attribute { + if x != nil { + return x.Attributes } return nil } -func (m *Header) GetSplit() *Header_Split { - if m != nil { - return m.Split +func (x *Header) GetSplit() *Header_Split { + if x != nil { + return x.Split + } + return nil +} + +// Object structure. Object is immutable and content-addressed. It means +// `ObjectID` will change if header or payload changes. It's calculated as a +// hash of header field, which contains hash of object's payload. +type Object struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Object's unique identifier. + ObjectId *grpc.ObjectID `protobuf:"bytes,1,opt,name=object_id,json=objectID,proto3" json:"object_id,omitempty"` + // Signed object_id + Signature *grpc.Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` + // Object metadata headers + Header *Header `protobuf:"bytes,3,opt,name=header,proto3" json:"header,omitempty"` + // Payload bytes. + Payload []byte `protobuf:"bytes,4,opt,name=payload,proto3" json:"payload,omitempty"` +} + +func (x *Object) Reset() { + *x = Object{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_object_grpc_types_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Object) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Object) ProtoMessage() {} + +func (x *Object) ProtoReflect() protoreflect.Message { + mi := &file_v2_object_grpc_types_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Object.ProtoReflect.Descriptor instead. +func (*Object) Descriptor() ([]byte, []int) { + return file_v2_object_grpc_types_proto_rawDescGZIP(), []int{2} +} + +func (x *Object) GetObjectId() *grpc.ObjectID { + if x != nil { + return x.ObjectId + } + return nil +} + +func (x *Object) GetSignature() *grpc.Signature { + if x != nil { + return x.Signature + } + return nil +} + +func (x *Object) GetHeader() *Header { + if x != nil { + return x.Header + } + return nil +} + +func (x *Object) GetPayload() []byte { + if x != nil { + return x.Payload } return nil } @@ -325,58 +448,58 @@ func (m *Header) GetSplit() *Header_Split { // For detailed description of each well-known attribute please see the // corresponding section in NeoFS Technical specification. type Header_Attribute struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // string key to the object attribute Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` // string value of the object attribute - Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` } -func (m *Header_Attribute) Reset() { *m = Header_Attribute{} } -func (m *Header_Attribute) String() string { return proto.CompactTextString(m) } -func (*Header_Attribute) ProtoMessage() {} -func (*Header_Attribute) Descriptor() ([]byte, []int) { - return fileDescriptor_545319325da7b9b1, []int{1, 0} -} -func (m *Header_Attribute) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Header_Attribute) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Header_Attribute.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil +func (x *Header_Attribute) Reset() { + *x = Header_Attribute{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_object_grpc_types_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } } -func (m *Header_Attribute) XXX_Merge(src proto.Message) { - xxx_messageInfo_Header_Attribute.Merge(m, src) -} -func (m *Header_Attribute) XXX_Size() int { - return m.Size() -} -func (m *Header_Attribute) XXX_DiscardUnknown() { - xxx_messageInfo_Header_Attribute.DiscardUnknown(m) + +func (x *Header_Attribute) String() string { + return protoimpl.X.MessageStringOf(x) } -var xxx_messageInfo_Header_Attribute proto.InternalMessageInfo +func (*Header_Attribute) ProtoMessage() {} -func (m *Header_Attribute) GetKey() string { - if m != nil { - return m.Key +func (x *Header_Attribute) ProtoReflect() protoreflect.Message { + mi := &file_v2_object_grpc_types_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Header_Attribute.ProtoReflect.Descriptor instead. +func (*Header_Attribute) Descriptor() ([]byte, []int) { + return file_v2_object_grpc_types_proto_rawDescGZIP(), []int{1, 0} +} + +func (x *Header_Attribute) GetKey() string { + if x != nil { + return x.Key } return "" } -func (m *Header_Attribute) GetValue() string { - if m != nil { - return m.Value +func (x *Header_Attribute) GetValue() string { + if x != nil { + return x.Value } return "" } @@ -386,6 +509,10 @@ func (m *Header_Attribute) GetValue() string { // the original one is in the `Split` headers. Parent and children objects // must be within the same container. type Header_Split struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // Identifier of the origin object. Known only to the minor child. Parent *grpc.ObjectID `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"` // Identifier of the left split neighbor @@ -395,2020 +522,334 @@ type Header_Split struct { // `header` field of the parent object. Used to reconstruct parent. ParentHeader *Header `protobuf:"bytes,4,opt,name=parent_header,json=parentHeader,proto3" json:"parent_header,omitempty"` // List of identifiers of the objects generated by splitting current one. - Children []*grpc.ObjectID `protobuf:"bytes,5,rep,name=children,proto3" json:"children,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Children []*grpc.ObjectID `protobuf:"bytes,5,rep,name=children,proto3" json:"children,omitempty"` } -func (m *Header_Split) Reset() { *m = Header_Split{} } -func (m *Header_Split) String() string { return proto.CompactTextString(m) } -func (*Header_Split) ProtoMessage() {} +func (x *Header_Split) Reset() { + *x = Header_Split{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_object_grpc_types_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Header_Split) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Header_Split) ProtoMessage() {} + +func (x *Header_Split) ProtoReflect() protoreflect.Message { + mi := &file_v2_object_grpc_types_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Header_Split.ProtoReflect.Descriptor instead. func (*Header_Split) Descriptor() ([]byte, []int) { - return fileDescriptor_545319325da7b9b1, []int{1, 1} -} -func (m *Header_Split) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Header_Split) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Header_Split.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *Header_Split) XXX_Merge(src proto.Message) { - xxx_messageInfo_Header_Split.Merge(m, src) -} -func (m *Header_Split) XXX_Size() int { - return m.Size() -} -func (m *Header_Split) XXX_DiscardUnknown() { - xxx_messageInfo_Header_Split.DiscardUnknown(m) + return file_v2_object_grpc_types_proto_rawDescGZIP(), []int{1, 1} } -var xxx_messageInfo_Header_Split proto.InternalMessageInfo - -func (m *Header_Split) GetParent() *grpc.ObjectID { - if m != nil { - return m.Parent +func (x *Header_Split) GetParent() *grpc.ObjectID { + if x != nil { + return x.Parent } return nil } -func (m *Header_Split) GetPrevious() *grpc.ObjectID { - if m != nil { - return m.Previous +func (x *Header_Split) GetPrevious() *grpc.ObjectID { + if x != nil { + return x.Previous } return nil } -func (m *Header_Split) GetParentSignature() *grpc.Signature { - if m != nil { - return m.ParentSignature +func (x *Header_Split) GetParentSignature() *grpc.Signature { + if x != nil { + return x.ParentSignature } return nil } -func (m *Header_Split) GetParentHeader() *Header { - if m != nil { - return m.ParentHeader +func (x *Header_Split) GetParentHeader() *Header { + if x != nil { + return x.ParentHeader } return nil } -func (m *Header_Split) GetChildren() []*grpc.ObjectID { - if m != nil { - return m.Children +func (x *Header_Split) GetChildren() []*grpc.ObjectID { + if x != nil { + return x.Children } return nil } -// Object structure. Object is immutable and content-addressed. It means -// `ObjectID` will change if header or payload changes. It's calculated as a -// hash of header field, which contains hash of object's payload. -type Object struct { - // Object's unique identifier. - ObjectId *grpc.ObjectID `protobuf:"bytes,1,opt,name=object_id,json=objectID,proto3" json:"object_id,omitempty"` - // Signed object_id - Signature *grpc.Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` - // Object metadata headers - Header *Header `protobuf:"bytes,3,opt,name=header,proto3" json:"header,omitempty"` - // Payload bytes. - Payload []byte `protobuf:"bytes,4,opt,name=payload,proto3" json:"payload,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} +var File_v2_object_grpc_types_proto protoreflect.FileDescriptor -func (m *Object) Reset() { *m = Object{} } -func (m *Object) String() string { return proto.CompactTextString(m) } -func (*Object) ProtoMessage() {} -func (*Object) Descriptor() ([]byte, []int) { - return fileDescriptor_545319325da7b9b1, []int{2} -} -func (m *Object) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Object) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Object.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *Object) XXX_Merge(src proto.Message) { - xxx_messageInfo_Object.Merge(m, src) -} -func (m *Object) XXX_Size() int { - return m.Size() -} -func (m *Object) XXX_DiscardUnknown() { - xxx_messageInfo_Object.DiscardUnknown(m) -} - -var xxx_messageInfo_Object proto.InternalMessageInfo - -func (m *Object) GetObjectId() *grpc.ObjectID { - if m != nil { - return m.ObjectId - } - return nil -} - -func (m *Object) GetSignature() *grpc.Signature { - if m != nil { - return m.Signature - } - return nil -} - -func (m *Object) GetHeader() *Header { - if m != nil { - return m.Header - } - return nil -} - -func (m *Object) GetPayload() []byte { - if m != nil { - return m.Payload - } - return nil -} - -func init() { - proto.RegisterEnum("neo.fs.v2.object.ObjectType", ObjectType_name, ObjectType_value) - proto.RegisterEnum("neo.fs.v2.object.MatchType", MatchType_name, MatchType_value) - proto.RegisterType((*ShortHeader)(nil), "neo.fs.v2.object.ShortHeader") - proto.RegisterType((*Header)(nil), "neo.fs.v2.object.Header") - proto.RegisterType((*Header_Attribute)(nil), "neo.fs.v2.object.Header.Attribute") - proto.RegisterType((*Header_Split)(nil), "neo.fs.v2.object.Header.Split") - proto.RegisterType((*Object)(nil), "neo.fs.v2.object.Object") -} - -func init() { proto.RegisterFile("v2/object/grpc/types.proto", fileDescriptor_545319325da7b9b1) } - -var fileDescriptor_545319325da7b9b1 = []byte{ - // 793 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x55, 0xdd, 0x6e, 0xe3, 0x44, - 0x14, 0xae, 0xd3, 0xe6, 0xef, 0x38, 0xd9, 0x35, 0x03, 0x02, 0x93, 0x45, 0xa1, 0xaa, 0x84, 0x54, - 0xad, 0x54, 0x1b, 0xbc, 0x45, 0x2b, 0x54, 0x2d, 0x52, 0xda, 0x78, 0xdb, 0x48, 0x6d, 0x53, 0xc6, - 0x2e, 0x12, 0xdc, 0x58, 0xae, 0x33, 0x8d, 0x4d, 0x53, 0x8f, 0xe5, 0x99, 0x18, 0xf5, 0x92, 0xb7, - 0xe0, 0x19, 0xf6, 0x39, 0xb8, 0xe0, 0x92, 0x47, 0x58, 0x95, 0x17, 0x41, 0x9e, 0x19, 0x37, 0x6d, - 0xb3, 0x4b, 0x60, 0xaf, 0x7c, 0xe6, 0xcc, 0xf7, 0x9d, 0x39, 0xdf, 0x37, 0x67, 0x64, 0xe8, 0x15, - 0x8e, 0x4d, 0x2f, 0x7e, 0x21, 0x11, 0xb7, 0xa7, 0x79, 0x16, 0xd9, 0xfc, 0x26, 0x23, 0xcc, 0xca, - 0x72, 0xca, 0x29, 0x32, 0x52, 0x42, 0xad, 0x4b, 0x66, 0x15, 0x8e, 0x25, 0x21, 0x3d, 0xb3, 0x70, - 0xec, 0x9c, 0x5c, 0xb2, 0x25, 0x6c, 0xef, 0x59, 0xe1, 0xd8, 0x8c, 0x30, 0x96, 0xd0, 0x74, 0x69, - 0x73, 0xeb, 0xb7, 0x1a, 0xe8, 0x5e, 0x4c, 0x73, 0x7e, 0x44, 0xc2, 0x09, 0xc9, 0xd1, 0x37, 0xd0, - 0x2c, 0x48, 0x5e, 0x62, 0x4d, 0x6d, 0x53, 0xdb, 0xd6, 0x9d, 0xcf, 0xac, 0xc5, 0x51, 0x65, 0x7d, - 0xeb, 0x47, 0xb9, 0x8d, 0x2b, 0x1c, 0xfa, 0x0a, 0x9e, 0x44, 0x39, 0x09, 0x79, 0x42, 0xd3, 0x80, - 0x64, 0x34, 0x8a, 0xcd, 0xda, 0xa6, 0xb6, 0xbd, 0x81, 0xbb, 0x55, 0xd6, 0x2d, 0x93, 0xc8, 0x81, - 0x16, 0xfd, 0x35, 0x25, 0x79, 0x90, 0x4c, 0xcc, 0xf5, 0x77, 0x97, 0x1e, 0x97, 0xfb, 0xa3, 0x21, - 0x6e, 0x52, 0x19, 0xa0, 0x57, 0xa0, 0x4b, 0x79, 0x41, 0xd9, 0xb3, 0xb9, 0xb1, 0xa9, 0x6d, 0x3f, - 0x71, 0xbe, 0xb0, 0x1e, 0x8b, 0xb7, 0xc6, 0xe2, 0xe3, 0xdf, 0x64, 0x04, 0x03, 0xbd, 0x8b, 0xcb, - 0xce, 0xb2, 0xf0, 0x66, 0x46, 0xc3, 0x49, 0x30, 0x23, 0xe9, 0x94, 0xc7, 0x66, 0x5d, 0x76, 0xa6, - 0xb2, 0xc7, 0x22, 0xb9, 0xf5, 0xb6, 0x09, 0x8d, 0x0f, 0x97, 0xff, 0x3d, 0x74, 0x22, 0x9a, 0xf2, - 0x30, 0x51, 0xda, 0x6a, 0x82, 0xf7, 0xec, 0x31, 0xef, 0xa0, 0xc2, 0x8c, 0x86, 0x58, 0x8f, 0x16, - 0x8b, 0x0f, 0xf2, 0x65, 0xd9, 0xf2, 0x8d, 0x77, 0x59, 0xfe, 0xdf, 0xf4, 0xa3, 0x3d, 0xe8, 0x54, - 0xb0, 0x38, 0x64, 0xb1, 0xd9, 0x10, 0x5d, 0x98, 0x4b, 0x0a, 0x62, 0x12, 0x5d, 0xb1, 0xf9, 0x35, - 0xd6, 0x15, 0xfa, 0x28, 0x64, 0xf1, 0xe3, 0x2b, 0x6a, 0xfe, 0xcf, 0x2b, 0x3a, 0x00, 0x23, 0xa6, - 0xd7, 0xf4, 0x9a, 0xe6, 0x59, 0x9c, 0x44, 0xf2, 0xfc, 0xd6, 0x8a, 0xf3, 0x9f, 0xde, 0x63, 0x88, - 0x1e, 0x86, 0xd0, 0x55, 0x03, 0x1e, 0x70, 0x7a, 0x45, 0x52, 0xb3, 0x2d, 0x2a, 0x7c, 0x79, 0xaf, - 0x82, 0xda, 0xb7, 0x3c, 0xf9, 0xf5, 0x4b, 0x18, 0xee, 0xb0, 0x7b, 0x2b, 0xb4, 0x0f, 0x10, 0x72, - 0x9e, 0x27, 0x17, 0x73, 0x4e, 0x98, 0x09, 0x9b, 0xeb, 0xdb, 0xba, 0xb3, 0xb5, 0x2c, 0x44, 0x4e, - 0x8a, 0x35, 0xa8, 0xa0, 0xf8, 0x1e, 0x0b, 0xed, 0x42, 0x9d, 0x65, 0xb3, 0x84, 0x9b, 0xba, 0xe8, - 0xa0, 0xff, 0x5e, 0xba, 0x57, 0xa2, 0xb0, 0x04, 0xf7, 0x5e, 0x40, 0xfb, 0xae, 0x1c, 0x32, 0x60, - 0xfd, 0x8a, 0xdc, 0x88, 0xf1, 0x6b, 0xe3, 0x32, 0x44, 0x9f, 0x40, 0xbd, 0x08, 0x67, 0x73, 0x22, - 0x46, 0xab, 0x8d, 0xe5, 0xa2, 0xf7, 0xa6, 0x06, 0x75, 0x51, 0x05, 0x7d, 0x0d, 0x8d, 0x2c, 0xcc, - 0x49, 0xca, 0xd5, 0xcc, 0x2e, 0x39, 0x27, 0xbd, 0x1f, 0x0d, 0xb1, 0xc2, 0xa1, 0x5d, 0x68, 0x65, - 0x39, 0x29, 0x12, 0x3a, 0x67, 0x6a, 0x5e, 0xdf, 0xcf, 0xb9, 0x43, 0xa2, 0x21, 0x18, 0x92, 0x1f, - 0xb0, 0x64, 0x9a, 0x86, 0x7c, 0x9e, 0x13, 0x35, 0xb1, 0x9f, 0x3f, 0x66, 0x7b, 0x15, 0x00, 0x3f, - 0x95, 0x94, 0xbb, 0x04, 0x7a, 0x05, 0x5d, 0x55, 0x25, 0x16, 0x56, 0x88, 0xd1, 0x7d, 0xd8, 0xc0, - 0x03, 0xab, 0x70, 0x47, 0xc2, 0xd5, 0x0b, 0xdd, 0x85, 0x56, 0x14, 0x27, 0xb3, 0x49, 0x4e, 0x52, - 0xb3, 0x2e, 0xee, 0xe8, 0x5f, 0x5a, 0xaf, 0x90, 0x5b, 0x7f, 0x68, 0xd0, 0x90, 0x69, 0xf4, 0x2d, - 0xb4, 0xd5, 0xc0, 0x26, 0x93, 0x95, 0x86, 0xb5, 0xa8, 0x8a, 0xd0, 0x4b, 0x68, 0x2f, 0x54, 0xd7, - 0x56, 0xa9, 0x5e, 0x60, 0xcb, 0xdb, 0x51, 0x42, 0xd7, 0x57, 0x08, 0x55, 0x38, 0x64, 0x42, 0x53, - 0xbd, 0x30, 0xe1, 0x4d, 0x07, 0x57, 0xcb, 0xe7, 0x7b, 0x00, 0x8b, 0x77, 0x84, 0x74, 0x68, 0x62, - 0xf7, 0xf0, 0xfc, 0x78, 0x80, 0x8d, 0x35, 0xd4, 0x85, 0xb6, 0x3f, 0x3e, 0xd9, 0xf7, 0xfc, 0xf1, - 0xa9, 0x6b, 0x68, 0xe8, 0x23, 0xe8, 0x7a, 0xfe, 0x18, 0x0f, 0x0e, 0xdd, 0xe0, 0x10, 0x8f, 0xcf, - 0xcf, 0x8c, 0xda, 0xf3, 0xef, 0xa0, 0x7d, 0x12, 0xf2, 0x28, 0x16, 0xdc, 0x1e, 0x7c, 0x7a, 0x32, - 0xf0, 0x0f, 0x8e, 0x02, 0xff, 0xa7, 0x33, 0x37, 0x38, 0x3f, 0xf5, 0xce, 0xdc, 0x83, 0xd1, 0xeb, - 0x91, 0x3b, 0x34, 0xd6, 0x90, 0x01, 0x1d, 0xcf, 0xc7, 0xa3, 0xd3, 0xc3, 0xc0, 0xfd, 0xe1, 0x7c, - 0x70, 0x6c, 0x68, 0xfb, 0xc1, 0x9f, 0xb7, 0x7d, 0xed, 0xaf, 0xdb, 0xbe, 0xf6, 0xf6, 0xb6, 0xaf, - 0xfd, 0xfe, 0x77, 0x7f, 0xed, 0xe7, 0x97, 0xd3, 0x84, 0xc7, 0xf3, 0x0b, 0x2b, 0xa2, 0xd7, 0x76, - 0xca, 0xb2, 0x28, 0xda, 0x99, 0x90, 0xc2, 0x4e, 0x09, 0xbd, 0x64, 0x3b, 0x61, 0x96, 0xec, 0x4c, - 0xa9, 0xfd, 0xf0, 0xf7, 0xb5, 0x27, 0xe3, 0x37, 0xb5, 0x8f, 0x4f, 0x09, 0x7d, 0xed, 0x59, 0x83, - 0xb3, 0x51, 0xe9, 0x80, 0x94, 0x73, 0xd1, 0x10, 0x7f, 0xa3, 0x17, 0xff, 0x04, 0x00, 0x00, 0xff, - 0xff, 0x21, 0xf4, 0xc9, 0x66, 0xf4, 0x06, 0x00, 0x00, -} - -func (m *ShortHeader) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ShortHeader) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ShortHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.PayloadLength != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.PayloadLength)) - i-- - dAtA[i] = 0x28 - } - if m.ObjectType != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.ObjectType)) - i-- - dAtA[i] = 0x20 - } - if m.OwnerId != nil { - { - size, err := m.OwnerId.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if m.CreationEpoch != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.CreationEpoch)) - i-- - dAtA[i] = 0x10 - } - if m.Version != nil { - { - size, err := m.Version.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Header) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Header) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Header) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.Split != nil { - { - size, err := m.Split.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x5a - } - if len(m.Attributes) > 0 { - for iNdEx := len(m.Attributes) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Attributes[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x52 - } - } - if m.SessionToken != nil { - { - size, err := m.SessionToken.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x4a - } - if m.HomomorphicHash != nil { - { - size, err := m.HomomorphicHash.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x42 - } - if m.ObjectType != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.ObjectType)) - i-- - dAtA[i] = 0x38 - } - if m.PayloadHash != nil { - { - size, err := m.PayloadHash.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x32 - } - if m.PayloadLength != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.PayloadLength)) - i-- - dAtA[i] = 0x28 - } - if m.CreationEpoch != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.CreationEpoch)) - i-- - dAtA[i] = 0x20 - } - if m.OwnerId != nil { - { - size, err := m.OwnerId.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if m.ContainerId != nil { - { - size, err := m.ContainerId.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.Version != nil { - { - size, err := m.Version.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Header_Attribute) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Header_Attribute) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Header_Attribute) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.Value) > 0 { - i -= len(m.Value) - copy(dAtA[i:], m.Value) - i = encodeVarintTypes(dAtA, i, uint64(len(m.Value))) - i-- - dAtA[i] = 0x12 - } - if len(m.Key) > 0 { - i -= len(m.Key) - copy(dAtA[i:], m.Key) - i = encodeVarintTypes(dAtA, i, uint64(len(m.Key))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Header_Split) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Header_Split) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Header_Split) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.Children) > 0 { - for iNdEx := len(m.Children) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Children[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2a - } - } - if m.ParentHeader != nil { - { - size, err := m.ParentHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } - if m.ParentSignature != nil { - { - size, err := m.ParentSignature.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if m.Previous != nil { - { - size, err := m.Previous.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.Parent != nil { - { - size, err := m.Parent.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Object) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Object) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Object) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.Payload) > 0 { - i -= len(m.Payload) - copy(dAtA[i:], m.Payload) - i = encodeVarintTypes(dAtA, i, uint64(len(m.Payload))) - i-- - dAtA[i] = 0x22 - } - if m.Header != nil { - { - size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if m.Signature != nil { - { - size, err := m.Signature.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.ObjectId != nil { - { - size, err := m.ObjectId.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func encodeVarintTypes(dAtA []byte, offset int, v uint64) int { - offset -= sovTypes(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *ShortHeader) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Version != nil { - l = m.Version.Size() - n += 1 + l + sovTypes(uint64(l)) - } - if m.CreationEpoch != 0 { - n += 1 + sovTypes(uint64(m.CreationEpoch)) - } - if m.OwnerId != nil { - l = m.OwnerId.Size() - n += 1 + l + sovTypes(uint64(l)) - } - if m.ObjectType != 0 { - n += 1 + sovTypes(uint64(m.ObjectType)) - } - if m.PayloadLength != 0 { - n += 1 + sovTypes(uint64(m.PayloadLength)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *Header) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Version != nil { - l = m.Version.Size() - n += 1 + l + sovTypes(uint64(l)) - } - if m.ContainerId != nil { - l = m.ContainerId.Size() - n += 1 + l + sovTypes(uint64(l)) - } - if m.OwnerId != nil { - l = m.OwnerId.Size() - n += 1 + l + sovTypes(uint64(l)) - } - if m.CreationEpoch != 0 { - n += 1 + sovTypes(uint64(m.CreationEpoch)) - } - if m.PayloadLength != 0 { - n += 1 + sovTypes(uint64(m.PayloadLength)) - } - if m.PayloadHash != nil { - l = m.PayloadHash.Size() - n += 1 + l + sovTypes(uint64(l)) - } - if m.ObjectType != 0 { - n += 1 + sovTypes(uint64(m.ObjectType)) - } - if m.HomomorphicHash != nil { - l = m.HomomorphicHash.Size() - n += 1 + l + sovTypes(uint64(l)) - } - if m.SessionToken != nil { - l = m.SessionToken.Size() - n += 1 + l + sovTypes(uint64(l)) - } - if len(m.Attributes) > 0 { - for _, e := range m.Attributes { - l = e.Size() - n += 1 + l + sovTypes(uint64(l)) - } - } - if m.Split != nil { - l = m.Split.Size() - n += 1 + l + sovTypes(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *Header_Attribute) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Key) - if l > 0 { - n += 1 + l + sovTypes(uint64(l)) - } - l = len(m.Value) - if l > 0 { - n += 1 + l + sovTypes(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *Header_Split) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Parent != nil { - l = m.Parent.Size() - n += 1 + l + sovTypes(uint64(l)) - } - if m.Previous != nil { - l = m.Previous.Size() - n += 1 + l + sovTypes(uint64(l)) - } - if m.ParentSignature != nil { - l = m.ParentSignature.Size() - n += 1 + l + sovTypes(uint64(l)) - } - if m.ParentHeader != nil { - l = m.ParentHeader.Size() - n += 1 + l + sovTypes(uint64(l)) - } - if len(m.Children) > 0 { - for _, e := range m.Children { - l = e.Size() - n += 1 + l + sovTypes(uint64(l)) - } - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *Object) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ObjectId != nil { - l = m.ObjectId.Size() - n += 1 + l + sovTypes(uint64(l)) - } - if m.Signature != nil { - l = m.Signature.Size() - n += 1 + l + sovTypes(uint64(l)) - } - if m.Header != nil { - l = m.Header.Size() - n += 1 + l + sovTypes(uint64(l)) - } - l = len(m.Payload) - if l > 0 { - n += 1 + l + sovTypes(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func sovTypes(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozTypes(x uint64) (n int) { - return sovTypes(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *ShortHeader) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ShortHeader: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ShortHeader: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Version == nil { - m.Version = &grpc.Version{} - } - if err := m.Version.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field CreationEpoch", wireType) - } - m.CreationEpoch = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.CreationEpoch |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OwnerId", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.OwnerId == nil { - m.OwnerId = &grpc.OwnerID{} - } - if err := m.OwnerId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ObjectType", wireType) - } - m.ObjectType = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ObjectType |= ObjectType(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field PayloadLength", wireType) - } - m.PayloadLength = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.PayloadLength |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Header) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Header: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Header: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Version == nil { - m.Version = &grpc.Version{} - } - if err := m.Version.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ContainerId", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.ContainerId == nil { - m.ContainerId = &grpc.ContainerID{} - } - if err := m.ContainerId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OwnerId", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.OwnerId == nil { - m.OwnerId = &grpc.OwnerID{} - } - if err := m.OwnerId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field CreationEpoch", wireType) - } - m.CreationEpoch = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.CreationEpoch |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field PayloadLength", wireType) - } - m.PayloadLength = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.PayloadLength |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PayloadHash", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.PayloadHash == nil { - m.PayloadHash = &grpc.Checksum{} - } - if err := m.PayloadHash.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 7: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ObjectType", wireType) - } - m.ObjectType = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ObjectType |= ObjectType(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 8: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field HomomorphicHash", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.HomomorphicHash == nil { - m.HomomorphicHash = &grpc.Checksum{} - } - if err := m.HomomorphicHash.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 9: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SessionToken", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.SessionToken == nil { - m.SessionToken = &grpc1.SessionToken{} - } - if err := m.SessionToken.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 10: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Attributes", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Attributes = append(m.Attributes, &Header_Attribute{}) - if err := m.Attributes[len(m.Attributes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 11: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Split", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Split == nil { - m.Split = &Header_Split{} - } - if err := m.Split.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Header_Attribute) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Attribute: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Attribute: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Key = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Value = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Header_Split) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Split: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Split: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Parent", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Parent == nil { - m.Parent = &grpc.ObjectID{} - } - if err := m.Parent.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Previous", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Previous == nil { - m.Previous = &grpc.ObjectID{} - } - if err := m.Previous.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ParentSignature", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.ParentSignature == nil { - m.ParentSignature = &grpc.Signature{} - } - if err := m.ParentSignature.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ParentHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.ParentHeader == nil { - m.ParentHeader = &Header{} - } - if err := m.ParentHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Children", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Children = append(m.Children, &grpc.ObjectID{}) - if err := m.Children[len(m.Children)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Object) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Object: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Object: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ObjectId", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.ObjectId == nil { - m.ObjectId = &grpc.ObjectID{} - } - if err := m.ObjectId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Signature", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Signature == nil { - m.Signature = &grpc.Signature{} - } - if err := m.Signature.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Header == nil { - m.Header = &Header{} - } - if err := m.Header.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Payload", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Payload = append(m.Payload[:0], dAtA[iNdEx:postIndex]...) - if m.Payload == nil { - m.Payload = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipTypes(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTypes - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTypes - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTypes - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthTypes - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupTypes - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthTypes - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF +var file_v2_object_grpc_types_proto_rawDesc = []byte{ + 0x0a, 0x1a, 0x76, 0x32, 0x2f, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2f, 0x67, 0x72, 0x70, 0x63, + 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x10, 0x6e, 0x65, + 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x1a, 0x18, + 0x76, 0x32, 0x2f, 0x72, 0x65, 0x66, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, + 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x76, 0x32, 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, 0x81, 0x02, 0x0a, 0x0b, 0x53, 0x68, 0x6f, 0x72, 0x74, 0x48, + 0x65, 0x61, 0x64, 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, 0x25, 0x0a, 0x0e, 0x63, 0x72, 0x65, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, + 0x52, 0x0d, 0x63, 0x72, 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x70, 0x6f, 0x63, 0x68, 0x12, + 0x32, 0x0a, 0x08, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x03, 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, 0x3d, 0x0a, 0x0b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x74, 0x79, + 0x70, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x4f, 0x62, 0x6a, 0x65, + 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x52, 0x0a, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x54, 0x79, + 0x70, 0x65, 0x12, 0x25, 0x0a, 0x0e, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x5f, 0x6c, 0x65, + 0x6e, 0x67, 0x74, 0x68, 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0d, 0x70, 0x61, 0x79, 0x6c, + 0x6f, 0x61, 0x64, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xe0, 0x07, 0x0a, 0x06, 0x48, 0x65, + 0x61, 0x64, 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, 0x3e, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x61, + 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, + 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, + 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, + 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x12, 0x32, 0x0a, 0x08, 0x6f, 0x77, 0x6e, 0x65, 0x72, + 0x5f, 0x69, 0x64, 0x18, 0x03, 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, 0x25, 0x0a, 0x0e, 0x63, + 0x72, 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x18, 0x04, 0x20, + 0x01, 0x28, 0x04, 0x52, 0x0d, 0x63, 0x72, 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x70, 0x6f, + 0x63, 0x68, 0x12, 0x25, 0x0a, 0x0e, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x5f, 0x6c, 0x65, + 0x6e, 0x67, 0x74, 0x68, 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0d, 0x70, 0x61, 0x79, 0x6c, + 0x6f, 0x61, 0x64, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x3b, 0x0a, 0x0c, 0x70, 0x61, 0x79, + 0x6c, 0x6f, 0x61, 0x64, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, + 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x52, 0x0b, 0x70, 0x61, 0x79, 0x6c, 0x6f, + 0x61, 0x64, 0x48, 0x61, 0x73, 0x68, 0x12, 0x3d, 0x0a, 0x0b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, + 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1c, 0x2e, 0x6e, 0x65, + 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x4f, + 0x62, 0x6a, 0x65, 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x52, 0x0a, 0x6f, 0x62, 0x6a, 0x65, 0x63, + 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x43, 0x0a, 0x10, 0x68, 0x6f, 0x6d, 0x6f, 0x6d, 0x6f, 0x72, + 0x70, 0x68, 0x69, 0x63, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, + 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x52, 0x0f, 0x68, 0x6f, 0x6d, 0x6f, 0x6d, + 0x6f, 0x72, 0x70, 0x68, 0x69, 0x63, 0x48, 0x61, 0x73, 0x68, 0x12, 0x44, 0x0a, 0x0d, 0x73, 0x65, + 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x09, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, + 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x6f, 0x6b, + 0x65, 0x6e, 0x52, 0x0c, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, + 0x12, 0x42, 0x0a, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x0a, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 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, 0x34, 0x0a, 0x05, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x18, 0x0b, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, + 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x2e, 0x53, 0x70, + 0x6c, 0x69, 0x74, 0x52, 0x05, 0x73, 0x70, 0x6c, 0x69, 0x74, 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, 0x1a, + 0xaa, 0x02, 0x0a, 0x05, 0x53, 0x70, 0x6c, 0x69, 0x74, 0x12, 0x30, 0x0a, 0x06, 0x70, 0x61, 0x72, + 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 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, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x12, 0x34, 0x0a, 0x08, 0x70, + 0x72, 0x65, 0x76, 0x69, 0x6f, 0x75, 0x73, 0x18, 0x02, 0x20, 0x01, 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, 0x08, 0x70, 0x72, 0x65, 0x76, 0x69, 0x6f, 0x75, + 0x73, 0x12, 0x44, 0x0a, 0x10, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x73, 0x69, 0x67, 0x6e, + 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, + 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, + 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x0f, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x53, 0x69, + 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x3d, 0x0a, 0x0d, 0x70, 0x61, 0x72, 0x65, 0x6e, + 0x74, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, + 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0c, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, + 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x34, 0x0a, 0x08, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x72, + 0x65, 0x6e, 0x18, 0x05, 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, 0x08, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x72, 0x65, 0x6e, 0x22, 0xc4, 0x01, 0x0a, + 0x06, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x35, 0x0a, 0x09, 0x6f, 0x62, 0x6a, 0x65, 0x63, + 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 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, 0x08, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x44, 0x12, 0x37, + 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, + 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, + 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x30, 0x0a, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, + 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, + 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, + 0x72, 0x52, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x79, + 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x70, 0x61, 0x79, 0x6c, + 0x6f, 0x61, 0x64, 0x2a, 0x3b, 0x0a, 0x0a, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x54, 0x79, 0x70, + 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x52, 0x45, 0x47, 0x55, 0x4c, 0x41, 0x52, 0x10, 0x00, 0x12, 0x0d, + 0x0a, 0x09, 0x54, 0x4f, 0x4d, 0x42, 0x53, 0x54, 0x4f, 0x4e, 0x45, 0x10, 0x01, 0x12, 0x11, 0x0a, + 0x0d, 0x53, 0x54, 0x4f, 0x52, 0x41, 0x47, 0x45, 0x5f, 0x47, 0x52, 0x4f, 0x55, 0x50, 0x10, 0x02, + 0x2a, 0x39, 0x0a, 0x09, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1a, 0x0a, + 0x16, 0x4d, 0x41, 0x54, 0x43, 0x48, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, + 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x10, 0x0a, 0x0c, 0x53, 0x54, 0x52, + 0x49, 0x4e, 0x47, 0x5f, 0x45, 0x51, 0x55, 0x41, 0x4c, 0x10, 0x01, 0x42, 0x4f, 0x5a, 0x37, 0x67, + 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, + 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, + 0x2f, 0x76, 0x32, 0x2f, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, + 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0xaa, 0x02, 0x13, 0x4e, 0x65, 0x6f, 0x46, 0x53, 0x2e, 0x41, + 0x50, 0x49, 0x2e, 0x76, 0x32, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, } var ( - ErrInvalidLengthTypes = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowTypes = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupTypes = fmt.Errorf("proto: unexpected end of group") + file_v2_object_grpc_types_proto_rawDescOnce sync.Once + file_v2_object_grpc_types_proto_rawDescData = file_v2_object_grpc_types_proto_rawDesc ) + +func file_v2_object_grpc_types_proto_rawDescGZIP() []byte { + file_v2_object_grpc_types_proto_rawDescOnce.Do(func() { + file_v2_object_grpc_types_proto_rawDescData = protoimpl.X.CompressGZIP(file_v2_object_grpc_types_proto_rawDescData) + }) + return file_v2_object_grpc_types_proto_rawDescData +} + +var file_v2_object_grpc_types_proto_enumTypes = make([]protoimpl.EnumInfo, 2) +var file_v2_object_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 5) +var file_v2_object_grpc_types_proto_goTypes = []interface{}{ + (ObjectType)(0), // 0: neo.fs.v2.object.ObjectType + (MatchType)(0), // 1: neo.fs.v2.object.MatchType + (*ShortHeader)(nil), // 2: neo.fs.v2.object.ShortHeader + (*Header)(nil), // 3: neo.fs.v2.object.Header + (*Object)(nil), // 4: neo.fs.v2.object.Object + (*Header_Attribute)(nil), // 5: neo.fs.v2.object.Header.Attribute + (*Header_Split)(nil), // 6: neo.fs.v2.object.Header.Split + (*grpc.Version)(nil), // 7: neo.fs.v2.refs.Version + (*grpc.OwnerID)(nil), // 8: neo.fs.v2.refs.OwnerID + (*grpc.ContainerID)(nil), // 9: neo.fs.v2.refs.ContainerID + (*grpc.Checksum)(nil), // 10: neo.fs.v2.refs.Checksum + (*grpc1.SessionToken)(nil), // 11: neo.fs.v2.session.SessionToken + (*grpc.ObjectID)(nil), // 12: neo.fs.v2.refs.ObjectID + (*grpc.Signature)(nil), // 13: neo.fs.v2.refs.Signature +} +var file_v2_object_grpc_types_proto_depIdxs = []int32{ + 7, // 0: neo.fs.v2.object.ShortHeader.version:type_name -> neo.fs.v2.refs.Version + 8, // 1: neo.fs.v2.object.ShortHeader.owner_id:type_name -> neo.fs.v2.refs.OwnerID + 0, // 2: neo.fs.v2.object.ShortHeader.object_type:type_name -> neo.fs.v2.object.ObjectType + 7, // 3: neo.fs.v2.object.Header.version:type_name -> neo.fs.v2.refs.Version + 9, // 4: neo.fs.v2.object.Header.container_id:type_name -> neo.fs.v2.refs.ContainerID + 8, // 5: neo.fs.v2.object.Header.owner_id:type_name -> neo.fs.v2.refs.OwnerID + 10, // 6: neo.fs.v2.object.Header.payload_hash:type_name -> neo.fs.v2.refs.Checksum + 0, // 7: neo.fs.v2.object.Header.object_type:type_name -> neo.fs.v2.object.ObjectType + 10, // 8: neo.fs.v2.object.Header.homomorphic_hash:type_name -> neo.fs.v2.refs.Checksum + 11, // 9: neo.fs.v2.object.Header.session_token:type_name -> neo.fs.v2.session.SessionToken + 5, // 10: neo.fs.v2.object.Header.attributes:type_name -> neo.fs.v2.object.Header.Attribute + 6, // 11: neo.fs.v2.object.Header.split:type_name -> neo.fs.v2.object.Header.Split + 12, // 12: neo.fs.v2.object.Object.object_id:type_name -> neo.fs.v2.refs.ObjectID + 13, // 13: neo.fs.v2.object.Object.signature:type_name -> neo.fs.v2.refs.Signature + 3, // 14: neo.fs.v2.object.Object.header:type_name -> neo.fs.v2.object.Header + 12, // 15: neo.fs.v2.object.Header.Split.parent:type_name -> neo.fs.v2.refs.ObjectID + 12, // 16: neo.fs.v2.object.Header.Split.previous:type_name -> neo.fs.v2.refs.ObjectID + 13, // 17: neo.fs.v2.object.Header.Split.parent_signature:type_name -> neo.fs.v2.refs.Signature + 3, // 18: neo.fs.v2.object.Header.Split.parent_header:type_name -> neo.fs.v2.object.Header + 12, // 19: neo.fs.v2.object.Header.Split.children:type_name -> neo.fs.v2.refs.ObjectID + 20, // [20:20] is the sub-list for method output_type + 20, // [20:20] is the sub-list for method input_type + 20, // [20:20] is the sub-list for extension type_name + 20, // [20:20] is the sub-list for extension extendee + 0, // [0:20] is the sub-list for field type_name +} + +func init() { file_v2_object_grpc_types_proto_init() } +func file_v2_object_grpc_types_proto_init() { + if File_v2_object_grpc_types_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_v2_object_grpc_types_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ShortHeader); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_object_grpc_types_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Header); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_object_grpc_types_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Object); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_object_grpc_types_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Header_Attribute); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_object_grpc_types_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Header_Split); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_v2_object_grpc_types_proto_rawDesc, + NumEnums: 2, + NumMessages: 5, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_v2_object_grpc_types_proto_goTypes, + DependencyIndexes: file_v2_object_grpc_types_proto_depIdxs, + EnumInfos: file_v2_object_grpc_types_proto_enumTypes, + MessageInfos: file_v2_object_grpc_types_proto_msgTypes, + }.Build() + File_v2_object_grpc_types_proto = out.File + file_v2_object_grpc_types_proto_rawDesc = nil + file_v2_object_grpc_types_proto_goTypes = nil + file_v2_object_grpc_types_proto_depIdxs = nil +} diff --git a/v2/object/marshal.go b/v2/object/marshal.go index c1ceea1..a79e454 100644 --- a/v2/object/marshal.go +++ b/v2/object/marshal.go @@ -3,6 +3,7 @@ package object import ( "github.com/nspcc-dev/neofs-api-go/util/proto" object "github.com/nspcc-dev/neofs-api-go/v2/object/grpc" + goproto "google.golang.org/protobuf/proto" ) const ( @@ -492,7 +493,7 @@ func (o *Object) StableUnmarshal(data []byte) error { } objGRPC := new(object.Object) - if err := objGRPC.Unmarshal(data); err != nil { + if err := goproto.Unmarshal(data, objGRPC); err != nil { return err } diff --git a/v2/object/marshal_test.go b/v2/object/marshal_test.go index 8c7777f..c3315f5 100644 --- a/v2/object/marshal_test.go +++ b/v2/object/marshal_test.go @@ -10,6 +10,7 @@ import ( "github.com/nspcc-dev/neofs-api-go/v2/refs" "github.com/nspcc-dev/neofs-api-go/v2/session" "github.com/stretchr/testify/require" + goproto "google.golang.org/protobuf/proto" ) func TestShortHeader_StableMarshal(t *testing.T) { @@ -20,7 +21,7 @@ func TestShortHeader_StableMarshal(t *testing.T) { wire, err := hdrFrom.StableMarshal(nil) require.NoError(t, err) - err = transport.Unmarshal(wire) + err = goproto.Unmarshal(wire, transport) require.NoError(t, err) hdrTo := object.ShortHeaderFromGRPCMessage(transport) @@ -36,7 +37,7 @@ func TestAttribute_StableMarshal(t *testing.T) { wire, err := from.StableMarshal(nil) require.NoError(t, err) - err = transport.Unmarshal(wire) + err = goproto.Unmarshal(wire, transport) require.NoError(t, err) to := object.AttributeFromGRPCMessage(transport) @@ -55,7 +56,7 @@ func TestSplitHeader_StableMarshal(t *testing.T) { wire, err := from.StableMarshal(nil) require.NoError(t, err) - err = transport.Unmarshal(wire) + err = goproto.Unmarshal(wire, transport) require.NoError(t, err) to := object.SplitHeaderFromGRPCMessage(transport) @@ -77,7 +78,7 @@ func TestHeader_StableMarshal(t *testing.T) { wire, err := from.StableMarshal(nil) require.NoError(t, err) - err = transport.Unmarshal(wire) + err = goproto.Unmarshal(wire, transport) require.NoError(t, err) to := object.HeaderFromGRPCMessage(transport) @@ -93,7 +94,7 @@ func TestObject_StableMarshal(t *testing.T) { wire, err := from.StableMarshal(nil) require.NoError(t, err) - err = transport.Unmarshal(wire) + err = goproto.Unmarshal(wire, transport) require.NoError(t, err) to := object.ObjectFromGRPCMessage(transport) @@ -109,7 +110,7 @@ func TestGetRequestBody_StableMarshal(t *testing.T) { wire, err := from.StableMarshal(nil) require.NoError(t, err) - err = transport.Unmarshal(wire) + err = goproto.Unmarshal(wire, transport) require.NoError(t, err) to := object.GetRequestBodyFromGRPCMessage(transport) @@ -126,7 +127,7 @@ func TestGetResponseBody_StableMarshal(t *testing.T) { wire, err := initFrom.StableMarshal(nil) require.NoError(t, err) - err = transport.Unmarshal(wire) + err = goproto.Unmarshal(wire, transport) require.NoError(t, err) to := object.GetResponseBodyFromGRPCMessage(transport) @@ -137,7 +138,7 @@ func TestGetResponseBody_StableMarshal(t *testing.T) { wire, err := chunkFrom.StableMarshal(nil) require.NoError(t, err) - err = transport.Unmarshal(wire) + err = goproto.Unmarshal(wire, transport) require.NoError(t, err) to := object.GetResponseBodyFromGRPCMessage(transport) @@ -154,7 +155,7 @@ func TestPutRequestBody_StableMarshal(t *testing.T) { wire, err := initFrom.StableMarshal(nil) require.NoError(t, err) - err = transport.Unmarshal(wire) + err = goproto.Unmarshal(wire, transport) require.NoError(t, err) to := object.PutRequestBodyFromGRPCMessage(transport) @@ -165,7 +166,7 @@ func TestPutRequestBody_StableMarshal(t *testing.T) { wire, err := chunkFrom.StableMarshal(nil) require.NoError(t, err) - err = transport.Unmarshal(wire) + err = goproto.Unmarshal(wire, transport) require.NoError(t, err) to := object.PutRequestBodyFromGRPCMessage(transport) @@ -181,7 +182,7 @@ func TestPutRequestBody_StableSize(t *testing.T) { wire, err := from.StableMarshal(nil) require.NoError(t, err) - err = transport.Unmarshal(wire) + err = goproto.Unmarshal(wire, transport) require.NoError(t, err) to := object.PutResponseBodyFromGRPCMessage(transport) @@ -197,7 +198,7 @@ func TestDeleteRequestBody_StableMarshal(t *testing.T) { wire, err := from.StableMarshal(nil) require.NoError(t, err) - err = transport.Unmarshal(wire) + err = goproto.Unmarshal(wire, transport) require.NoError(t, err) to := object.DeleteRequestBodyFromGRPCMessage(transport) @@ -213,7 +214,7 @@ func TestDeleteResponseBody_StableMarshal(t *testing.T) { wire, err := from.StableMarshal(nil) require.NoError(t, err) - err = transport.Unmarshal(wire) + err = goproto.Unmarshal(wire, transport) require.NoError(t, err) to := object.DeleteResponseBodyFromGRPCMessage(transport) @@ -229,7 +230,7 @@ func TestSplitHeaderFromGRPCMessage(t *testing.T) { wire, err := from.StableMarshal(nil) require.NoError(t, err) - err = transport.Unmarshal(wire) + err = goproto.Unmarshal(wire, transport) require.NoError(t, err) to := object.HeadRequestBodyFromGRPCMessage(transport) @@ -246,7 +247,7 @@ func TestHeadResponseBody_StableMarshal(t *testing.T) { wire, err := shortFrom.StableMarshal(nil) require.NoError(t, err) - err = transport.Unmarshal(wire) + err = goproto.Unmarshal(wire, transport) require.NoError(t, err) to := object.HeadResponseBodyFromGRPCMessage(transport) @@ -257,7 +258,7 @@ func TestHeadResponseBody_StableMarshal(t *testing.T) { wire, err := fullFrom.StableMarshal(nil) require.NoError(t, err) - err = transport.Unmarshal(wire) + err = goproto.Unmarshal(wire, transport) require.NoError(t, err) to := object.HeadResponseBodyFromGRPCMessage(transport) @@ -273,7 +274,7 @@ func TestSearchRequestBody_StableMarshal(t *testing.T) { wire, err := from.StableMarshal(nil) require.NoError(t, err) - err = transport.Unmarshal(wire) + err = goproto.Unmarshal(wire, transport) require.NoError(t, err) to := object.SearchRequestBodyFromGRPCMessage(transport) @@ -289,7 +290,7 @@ func TestSearchResponseBody_StableMarshal(t *testing.T) { wire, err := from.StableMarshal(nil) require.NoError(t, err) - err = transport.Unmarshal(wire) + err = goproto.Unmarshal(wire, transport) require.NoError(t, err) to := object.SearchResponseBodyFromGRPCMessage(transport) @@ -305,7 +306,7 @@ func TestGetRangeRequestBody_StableMarshal(t *testing.T) { wire, err := from.StableMarshal(nil) require.NoError(t, err) - err = transport.Unmarshal(wire) + err = goproto.Unmarshal(wire, transport) require.NoError(t, err) to := object.GetRangeRequestBodyFromGRPCMessage(transport) @@ -321,7 +322,7 @@ func TestGetRangeResponseBody_StableMarshal(t *testing.T) { wire, err := from.StableMarshal(nil) require.NoError(t, err) - err = transport.Unmarshal(wire) + err = goproto.Unmarshal(wire, transport) require.NoError(t, err) to := object.GetRangeResponseBodyFromGRPCMessage(transport) @@ -337,7 +338,7 @@ func TestGetRangeHashRequestBody_StableMarshal(t *testing.T) { wire, err := from.StableMarshal(nil) require.NoError(t, err) - err = transport.Unmarshal(wire) + err = goproto.Unmarshal(wire, transport) require.NoError(t, err) to := object.GetRangeHashRequestBodyFromGRPCMessage(transport) @@ -353,7 +354,7 @@ func TestGetRangeHashResponseBody_StableMarshal(t *testing.T) { wire, err := from.StableMarshal(nil) require.NoError(t, err) - err = transport.Unmarshal(wire) + err = goproto.Unmarshal(wire, transport) require.NoError(t, err) to := object.GetRangeHashResponseBodyFromGRPCMessage(transport) diff --git a/v2/refs/grpc/types.pb.go b/v2/refs/grpc/types.pb.go index fef3672..c9994bd 100644 --- a/v2/refs/grpc/types.pb.go +++ b/v2/refs/grpc/types.pb.go @@ -1,26 +1,29 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.23.0 +// protoc v3.13.0 // source: v2/refs/grpc/types.proto package refs import ( - fmt "fmt" proto "github.com/golang/protobuf/proto" - io "io" - math "math" - math_bits "math/bits" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +// This is a compile-time assertion that a sufficiently up-to-date version +// of the legacy proto package is being used. +const _ = proto.ProtoPackageIsVersion4 // Checksum algorithm type. type ChecksumType int32 @@ -34,81 +37,102 @@ const ( ChecksumType_SHA256 ChecksumType = 2 ) -var ChecksumType_name = map[int32]string{ - 0: "CHECKSUM_TYPE_UNSPECIFIED", - 1: "TZ", - 2: "SHA256", -} +// Enum value maps for ChecksumType. +var ( + ChecksumType_name = map[int32]string{ + 0: "CHECKSUM_TYPE_UNSPECIFIED", + 1: "TZ", + 2: "SHA256", + } + ChecksumType_value = map[string]int32{ + "CHECKSUM_TYPE_UNSPECIFIED": 0, + "TZ": 1, + "SHA256": 2, + } +) -var ChecksumType_value = map[string]int32{ - "CHECKSUM_TYPE_UNSPECIFIED": 0, - "TZ": 1, - "SHA256": 2, +func (x ChecksumType) Enum() *ChecksumType { + p := new(ChecksumType) + *p = x + return p } func (x ChecksumType) String() string { - return proto.EnumName(ChecksumType_name, int32(x)) + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) } +func (ChecksumType) Descriptor() protoreflect.EnumDescriptor { + return file_v2_refs_grpc_types_proto_enumTypes[0].Descriptor() +} + +func (ChecksumType) Type() protoreflect.EnumType { + return &file_v2_refs_grpc_types_proto_enumTypes[0] +} + +func (x ChecksumType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use ChecksumType.Descriptor instead. func (ChecksumType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_08f084e5f91ec87c, []int{0} + return file_v2_refs_grpc_types_proto_rawDescGZIP(), []int{0} } // Object in NeoFS can be addressed by it's ContainerID and ObjectID. In string // format there MUST be a '/' delimeter between them. type Address struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // Container identifier ContainerId *ContainerID `protobuf:"bytes,1,opt,name=container_id,json=containerID,proto3" json:"container_id,omitempty"` // Object identifier - ObjectId *ObjectID `protobuf:"bytes,2,opt,name=object_id,json=objectID,proto3" json:"object_id,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + ObjectId *ObjectID `protobuf:"bytes,2,opt,name=object_id,json=objectID,proto3" json:"object_id,omitempty"` } -func (m *Address) Reset() { *m = Address{} } -func (m *Address) String() string { return proto.CompactTextString(m) } -func (*Address) ProtoMessage() {} -func (*Address) Descriptor() ([]byte, []int) { - return fileDescriptor_08f084e5f91ec87c, []int{0} -} -func (m *Address) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Address) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Address.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil +func (x *Address) Reset() { + *x = Address{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_refs_grpc_types_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } } -func (m *Address) XXX_Merge(src proto.Message) { - xxx_messageInfo_Address.Merge(m, src) -} -func (m *Address) XXX_Size() int { - return m.Size() -} -func (m *Address) XXX_DiscardUnknown() { - xxx_messageInfo_Address.DiscardUnknown(m) + +func (x *Address) String() string { + return protoimpl.X.MessageStringOf(x) } -var xxx_messageInfo_Address proto.InternalMessageInfo +func (*Address) ProtoMessage() {} -func (m *Address) GetContainerId() *ContainerID { - if m != nil { - return m.ContainerId +func (x *Address) ProtoReflect() protoreflect.Message { + mi := &file_v2_refs_grpc_types_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Address.ProtoReflect.Descriptor instead. +func (*Address) Descriptor() ([]byte, []int) { + return file_v2_refs_grpc_types_proto_rawDescGZIP(), []int{0} +} + +func (x *Address) GetContainerId() *ContainerID { + if x != nil { + return x.ContainerId } return nil } -func (m *Address) GetObjectId() *ObjectID { - if m != nil { - return m.ObjectId +func (x *Address) GetObjectId() *ObjectID { + if x != nil { + return x.ObjectId } return nil } @@ -118,49 +142,49 @@ func (m *Address) GetObjectId() *ObjectID { // is calculated as a hash of `header` field, which contains hash of object's // payload. type ObjectID struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // Object identifier in a binary format - Value []byte `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Value []byte `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` } -func (m *ObjectID) Reset() { *m = ObjectID{} } -func (m *ObjectID) String() string { return proto.CompactTextString(m) } -func (*ObjectID) ProtoMessage() {} -func (*ObjectID) Descriptor() ([]byte, []int) { - return fileDescriptor_08f084e5f91ec87c, []int{1} -} -func (m *ObjectID) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ObjectID) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ObjectID.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil +func (x *ObjectID) Reset() { + *x = ObjectID{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_refs_grpc_types_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } } -func (m *ObjectID) XXX_Merge(src proto.Message) { - xxx_messageInfo_ObjectID.Merge(m, src) -} -func (m *ObjectID) XXX_Size() int { - return m.Size() -} -func (m *ObjectID) XXX_DiscardUnknown() { - xxx_messageInfo_ObjectID.DiscardUnknown(m) + +func (x *ObjectID) String() string { + return protoimpl.X.MessageStringOf(x) } -var xxx_messageInfo_ObjectID proto.InternalMessageInfo +func (*ObjectID) ProtoMessage() {} -func (m *ObjectID) GetValue() []byte { - if m != nil { - return m.Value +func (x *ObjectID) ProtoReflect() protoreflect.Message { + mi := &file_v2_refs_grpc_types_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ObjectID.ProtoReflect.Descriptor instead. +func (*ObjectID) Descriptor() ([]byte, []int) { + return file_v2_refs_grpc_types_proto_rawDescGZIP(), []int{1} +} + +func (x *ObjectID) GetValue() []byte { + if x != nil { + return x.Value } return nil } @@ -169,49 +193,49 @@ func (m *ObjectID) GetValue() []byte { // content-addressed. `ContainerID` is a 32 byte long SHA256 hash of // stable-marshalled container message. type ContainerID struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // Container identifier in a binary format. - Value []byte `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Value []byte `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` } -func (m *ContainerID) Reset() { *m = ContainerID{} } -func (m *ContainerID) String() string { return proto.CompactTextString(m) } -func (*ContainerID) ProtoMessage() {} -func (*ContainerID) Descriptor() ([]byte, []int) { - return fileDescriptor_08f084e5f91ec87c, []int{2} -} -func (m *ContainerID) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ContainerID) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ContainerID.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil +func (x *ContainerID) Reset() { + *x = ContainerID{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_refs_grpc_types_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } } -func (m *ContainerID) XXX_Merge(src proto.Message) { - xxx_messageInfo_ContainerID.Merge(m, src) -} -func (m *ContainerID) XXX_Size() int { - return m.Size() -} -func (m *ContainerID) XXX_DiscardUnknown() { - xxx_messageInfo_ContainerID.DiscardUnknown(m) + +func (x *ContainerID) String() string { + return protoimpl.X.MessageStringOf(x) } -var xxx_messageInfo_ContainerID proto.InternalMessageInfo +func (*ContainerID) ProtoMessage() {} -func (m *ContainerID) GetValue() []byte { - if m != nil { - return m.Value +func (x *ContainerID) ProtoReflect() protoreflect.Message { + mi := &file_v2_refs_grpc_types_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ContainerID.ProtoReflect.Descriptor instead. +func (*ContainerID) Descriptor() ([]byte, []int) { + return file_v2_refs_grpc_types_proto_rawDescGZIP(), []int{2} +} + +func (x *ContainerID) GetValue() []byte { + if x != nil { + return x.Value } return nil } @@ -220,1475 +244,414 @@ func (m *ContainerID) GetValue() []byte { // algorithm is the same as for Neo3 wallet addresses. Neo3 wallet address can // be directly used as `OwnerID`. type OwnerID struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // Identifier of the container owner in a binary format - Value []byte `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Value []byte `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` } -func (m *OwnerID) Reset() { *m = OwnerID{} } -func (m *OwnerID) String() string { return proto.CompactTextString(m) } -func (*OwnerID) ProtoMessage() {} -func (*OwnerID) Descriptor() ([]byte, []int) { - return fileDescriptor_08f084e5f91ec87c, []int{3} -} -func (m *OwnerID) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *OwnerID) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_OwnerID.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil +func (x *OwnerID) Reset() { + *x = OwnerID{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_refs_grpc_types_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } } -func (m *OwnerID) XXX_Merge(src proto.Message) { - xxx_messageInfo_OwnerID.Merge(m, src) -} -func (m *OwnerID) XXX_Size() int { - return m.Size() -} -func (m *OwnerID) XXX_DiscardUnknown() { - xxx_messageInfo_OwnerID.DiscardUnknown(m) + +func (x *OwnerID) String() string { + return protoimpl.X.MessageStringOf(x) } -var xxx_messageInfo_OwnerID proto.InternalMessageInfo +func (*OwnerID) ProtoMessage() {} -func (m *OwnerID) GetValue() []byte { - if m != nil { - return m.Value +func (x *OwnerID) ProtoReflect() protoreflect.Message { + mi := &file_v2_refs_grpc_types_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use OwnerID.ProtoReflect.Descriptor instead. +func (*OwnerID) Descriptor() ([]byte, []int) { + return file_v2_refs_grpc_types_proto_rawDescGZIP(), []int{3} +} + +func (x *OwnerID) GetValue() []byte { + if x != nil { + return x.Value } return nil } // API version used by a node. type Version struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // Major API version Major uint32 `protobuf:"varint,1,opt,name=major,proto3" json:"major,omitempty"` // Minor API version - Minor uint32 `protobuf:"varint,2,opt,name=minor,proto3" json:"minor,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Minor uint32 `protobuf:"varint,2,opt,name=minor,proto3" json:"minor,omitempty"` } -func (m *Version) Reset() { *m = Version{} } -func (m *Version) String() string { return proto.CompactTextString(m) } -func (*Version) ProtoMessage() {} -func (*Version) Descriptor() ([]byte, []int) { - return fileDescriptor_08f084e5f91ec87c, []int{4} -} -func (m *Version) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Version) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Version.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil +func (x *Version) Reset() { + *x = Version{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_refs_grpc_types_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } } -func (m *Version) XXX_Merge(src proto.Message) { - xxx_messageInfo_Version.Merge(m, src) -} -func (m *Version) XXX_Size() int { - return m.Size() -} -func (m *Version) XXX_DiscardUnknown() { - xxx_messageInfo_Version.DiscardUnknown(m) + +func (x *Version) String() string { + return protoimpl.X.MessageStringOf(x) } -var xxx_messageInfo_Version proto.InternalMessageInfo +func (*Version) ProtoMessage() {} -func (m *Version) GetMajor() uint32 { - if m != nil { - return m.Major +func (x *Version) ProtoReflect() protoreflect.Message { + mi := &file_v2_refs_grpc_types_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Version.ProtoReflect.Descriptor instead. +func (*Version) Descriptor() ([]byte, []int) { + return file_v2_refs_grpc_types_proto_rawDescGZIP(), []int{4} +} + +func (x *Version) GetMajor() uint32 { + if x != nil { + return x.Major } return 0 } -func (m *Version) GetMinor() uint32 { - if m != nil { - return m.Minor +func (x *Version) GetMinor() uint32 { + if x != nil { + return x.Minor } return 0 } // Signature of something in NeoFS. type Signature struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // Public key used for signing Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` // Signature - Sign []byte `protobuf:"bytes,2,opt,name=sign,json=signature,proto3" json:"sign,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Sign []byte `protobuf:"bytes,2,opt,name=sign,json=signature,proto3" json:"sign,omitempty"` } -func (m *Signature) Reset() { *m = Signature{} } -func (m *Signature) String() string { return proto.CompactTextString(m) } -func (*Signature) ProtoMessage() {} -func (*Signature) Descriptor() ([]byte, []int) { - return fileDescriptor_08f084e5f91ec87c, []int{5} -} -func (m *Signature) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Signature) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Signature.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil +func (x *Signature) Reset() { + *x = Signature{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_refs_grpc_types_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } } -func (m *Signature) XXX_Merge(src proto.Message) { - xxx_messageInfo_Signature.Merge(m, src) -} -func (m *Signature) XXX_Size() int { - return m.Size() -} -func (m *Signature) XXX_DiscardUnknown() { - xxx_messageInfo_Signature.DiscardUnknown(m) + +func (x *Signature) String() string { + return protoimpl.X.MessageStringOf(x) } -var xxx_messageInfo_Signature proto.InternalMessageInfo +func (*Signature) ProtoMessage() {} -func (m *Signature) GetKey() []byte { - if m != nil { - return m.Key +func (x *Signature) ProtoReflect() protoreflect.Message { + mi := &file_v2_refs_grpc_types_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Signature.ProtoReflect.Descriptor instead. +func (*Signature) Descriptor() ([]byte, []int) { + return file_v2_refs_grpc_types_proto_rawDescGZIP(), []int{5} +} + +func (x *Signature) GetKey() []byte { + if x != nil { + return x.Key } return nil } -func (m *Signature) GetSign() []byte { - if m != nil { - return m.Sign +func (x *Signature) GetSign() []byte { + if x != nil { + return x.Sign } return nil } // Checksum message. type Checksum struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // Checksum algorithm type Type ChecksumType `protobuf:"varint,1,opt,name=type,proto3,enum=neo.fs.v2.refs.ChecksumType" json:"type,omitempty"` // Checksum itself - Sum []byte `protobuf:"bytes,2,opt,name=sum,proto3" json:"sum,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Sum []byte `protobuf:"bytes,2,opt,name=sum,proto3" json:"sum,omitempty"` } -func (m *Checksum) Reset() { *m = Checksum{} } -func (m *Checksum) String() string { return proto.CompactTextString(m) } -func (*Checksum) ProtoMessage() {} -func (*Checksum) Descriptor() ([]byte, []int) { - return fileDescriptor_08f084e5f91ec87c, []int{6} -} -func (m *Checksum) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Checksum) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Checksum.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil +func (x *Checksum) Reset() { + *x = Checksum{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_refs_grpc_types_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } } -func (m *Checksum) XXX_Merge(src proto.Message) { - xxx_messageInfo_Checksum.Merge(m, src) -} -func (m *Checksum) XXX_Size() int { - return m.Size() -} -func (m *Checksum) XXX_DiscardUnknown() { - xxx_messageInfo_Checksum.DiscardUnknown(m) + +func (x *Checksum) String() string { + return protoimpl.X.MessageStringOf(x) } -var xxx_messageInfo_Checksum proto.InternalMessageInfo +func (*Checksum) ProtoMessage() {} -func (m *Checksum) GetType() ChecksumType { - if m != nil { - return m.Type +func (x *Checksum) ProtoReflect() protoreflect.Message { + mi := &file_v2_refs_grpc_types_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Checksum.ProtoReflect.Descriptor instead. +func (*Checksum) Descriptor() ([]byte, []int) { + return file_v2_refs_grpc_types_proto_rawDescGZIP(), []int{6} +} + +func (x *Checksum) GetType() ChecksumType { + if x != nil { + return x.Type } return ChecksumType_CHECKSUM_TYPE_UNSPECIFIED } -func (m *Checksum) GetSum() []byte { - if m != nil { - return m.Sum +func (x *Checksum) GetSum() []byte { + if x != nil { + return x.Sum } return nil } -func init() { - proto.RegisterEnum("neo.fs.v2.refs.ChecksumType", ChecksumType_name, ChecksumType_value) - proto.RegisterType((*Address)(nil), "neo.fs.v2.refs.Address") - proto.RegisterType((*ObjectID)(nil), "neo.fs.v2.refs.ObjectID") - proto.RegisterType((*ContainerID)(nil), "neo.fs.v2.refs.ContainerID") - proto.RegisterType((*OwnerID)(nil), "neo.fs.v2.refs.OwnerID") - proto.RegisterType((*Version)(nil), "neo.fs.v2.refs.Version") - proto.RegisterType((*Signature)(nil), "neo.fs.v2.refs.Signature") - proto.RegisterType((*Checksum)(nil), "neo.fs.v2.refs.Checksum") -} +var File_v2_refs_grpc_types_proto protoreflect.FileDescriptor -func init() { proto.RegisterFile("v2/refs/grpc/types.proto", fileDescriptor_08f084e5f91ec87c) } - -var fileDescriptor_08f084e5f91ec87c = []byte{ - // 428 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x92, 0xdf, 0x6a, 0x13, 0x41, - 0x14, 0xc6, 0xbb, 0xb1, 0xe6, 0xcf, 0x49, 0x2c, 0x71, 0x10, 0x8c, 0xa8, 0xb1, 0xac, 0x37, 0x22, - 0x64, 0x57, 0xb6, 0xa4, 0x37, 0x82, 0x10, 0x37, 0x29, 0x5d, 0xc4, 0x34, 0xec, 0xa6, 0x42, 0x7b, - 0x13, 0x36, 0x93, 0x93, 0xed, 0xb4, 0x66, 0x66, 0x99, 0xd9, 0x8d, 0xe4, 0xce, 0xc7, 0xf0, 0x19, - 0x7c, 0x12, 0x2f, 0x7d, 0x04, 0x89, 0x2f, 0x22, 0x33, 0xd9, 0x60, 0x54, 0xec, 0xdd, 0xf7, 0x1d, - 0x7e, 0xdf, 0x39, 0xf3, 0xe7, 0x40, 0x6b, 0xe9, 0xb9, 0x12, 0xe7, 0xca, 0x4d, 0x64, 0x4a, 0xdd, - 0x6c, 0x95, 0xa2, 0x72, 0x52, 0x29, 0x32, 0x41, 0x0e, 0x38, 0x0a, 0x67, 0xae, 0x9c, 0xa5, 0xe7, - 0x68, 0xc0, 0xfe, 0x6c, 0x41, 0xa5, 0x37, 0x9b, 0x49, 0x54, 0x8a, 0xbc, 0x81, 0x06, 0x15, 0x3c, - 0x8b, 0x19, 0x47, 0x39, 0x61, 0xb3, 0x96, 0x75, 0x68, 0xbd, 0xa8, 0x7b, 0x8f, 0x9d, 0x3f, 0x23, - 0x8e, 0xbf, 0x65, 0x82, 0x7e, 0x58, 0xa7, 0xbf, 0x0d, 0xe9, 0x42, 0x4d, 0x4c, 0xaf, 0x91, 0x66, - 0x3a, 0x5c, 0x32, 0xe1, 0xd6, 0xdf, 0xe1, 0x33, 0x03, 0x04, 0xfd, 0xb0, 0x2a, 0x0a, 0x65, 0x1f, - 0x42, 0x75, 0x5b, 0x25, 0x0f, 0xe0, 0xee, 0x32, 0xfe, 0x98, 0xa3, 0x99, 0xdd, 0x08, 0x37, 0xc6, - 0x7e, 0x0e, 0xf5, 0x9d, 0xa1, 0xff, 0x81, 0x9e, 0x41, 0xe5, 0xec, 0xd3, 0x6d, 0x40, 0x17, 0x2a, - 0x1f, 0x50, 0x2a, 0x26, 0xb8, 0x06, 0x16, 0xf1, 0xb5, 0x90, 0x06, 0xb8, 0x17, 0x6e, 0x8c, 0xa9, - 0x32, 0x2e, 0xa4, 0x39, 0xbb, 0xae, 0x6a, 0x63, 0x1f, 0x43, 0x2d, 0x62, 0x09, 0x8f, 0xb3, 0x5c, - 0x22, 0x69, 0xc2, 0x9d, 0x1b, 0x5c, 0x15, 0x7d, 0xb5, 0x24, 0x0f, 0x61, 0x5f, 0xb1, 0x84, 0x9b, - 0x4c, 0x23, 0xac, 0xa9, 0x2d, 0x6a, 0x0f, 0xa1, 0xea, 0x5f, 0x21, 0xbd, 0x51, 0xf9, 0x82, 0xbc, - 0x82, 0x7d, 0xfd, 0x09, 0x26, 0x77, 0xe0, 0x3d, 0xf9, 0xe7, 0x45, 0x0b, 0x6e, 0xbc, 0x4a, 0x31, - 0x34, 0xa4, 0x1e, 0xa4, 0xf2, 0x45, 0xd1, 0x55, 0xcb, 0x97, 0x3d, 0x68, 0xec, 0x72, 0xe4, 0x29, - 0x3c, 0xf2, 0x4f, 0x07, 0xfe, 0xbb, 0xe8, 0xfc, 0xfd, 0x64, 0x7c, 0x31, 0x1a, 0x4c, 0xce, 0x87, - 0xd1, 0x68, 0xe0, 0x07, 0x27, 0xc1, 0xa0, 0xdf, 0xdc, 0x23, 0x65, 0x28, 0x8d, 0x2f, 0x9b, 0x16, - 0x01, 0x28, 0x47, 0xa7, 0x3d, 0xaf, 0x7b, 0xdc, 0x2c, 0xbd, 0xbd, 0xf8, 0xb6, 0x6e, 0x5b, 0xdf, - 0xd7, 0x6d, 0xeb, 0xc7, 0xba, 0x6d, 0x7d, 0xf9, 0xd9, 0xde, 0xbb, 0x3c, 0x4a, 0x58, 0x76, 0x95, - 0x4f, 0x1d, 0x2a, 0x16, 0x2e, 0x57, 0x29, 0xa5, 0x9d, 0x19, 0x2e, 0x5d, 0x8e, 0x62, 0xae, 0x3a, - 0x71, 0xca, 0x3a, 0x89, 0x70, 0x77, 0x57, 0xe9, 0xb5, 0x56, 0x5f, 0x4b, 0xf7, 0x87, 0x28, 0x4e, - 0x22, 0xa7, 0x37, 0x0a, 0xf4, 0x15, 0x42, 0x9c, 0xab, 0x69, 0xd9, 0xac, 0xd7, 0xd1, 0xaf, 0x00, - 0x00, 0x00, 0xff, 0xff, 0xa0, 0xaf, 0x9d, 0x5e, 0x7a, 0x02, 0x00, 0x00, -} - -func (m *Address) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Address) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Address) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.ObjectId != nil { - { - size, err := m.ObjectId.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.ContainerId != nil { - { - size, err := m.ContainerId.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *ObjectID) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ObjectID) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ObjectID) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.Value) > 0 { - i -= len(m.Value) - copy(dAtA[i:], m.Value) - i = encodeVarintTypes(dAtA, i, uint64(len(m.Value))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *ContainerID) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ContainerID) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ContainerID) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.Value) > 0 { - i -= len(m.Value) - copy(dAtA[i:], m.Value) - i = encodeVarintTypes(dAtA, i, uint64(len(m.Value))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *OwnerID) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *OwnerID) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *OwnerID) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.Value) > 0 { - i -= len(m.Value) - copy(dAtA[i:], m.Value) - i = encodeVarintTypes(dAtA, i, uint64(len(m.Value))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Version) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Version) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Version) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.Minor != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.Minor)) - i-- - dAtA[i] = 0x10 - } - if m.Major != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.Major)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *Signature) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Signature) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Signature) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.Sign) > 0 { - i -= len(m.Sign) - copy(dAtA[i:], m.Sign) - i = encodeVarintTypes(dAtA, i, uint64(len(m.Sign))) - i-- - dAtA[i] = 0x12 - } - if len(m.Key) > 0 { - i -= len(m.Key) - copy(dAtA[i:], m.Key) - i = encodeVarintTypes(dAtA, i, uint64(len(m.Key))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Checksum) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Checksum) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Checksum) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.Sum) > 0 { - i -= len(m.Sum) - copy(dAtA[i:], m.Sum) - i = encodeVarintTypes(dAtA, i, uint64(len(m.Sum))) - i-- - dAtA[i] = 0x12 - } - if m.Type != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.Type)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func encodeVarintTypes(dAtA []byte, offset int, v uint64) int { - offset -= sovTypes(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *Address) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ContainerId != nil { - l = m.ContainerId.Size() - n += 1 + l + sovTypes(uint64(l)) - } - if m.ObjectId != nil { - l = m.ObjectId.Size() - n += 1 + l + sovTypes(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *ObjectID) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Value) - if l > 0 { - n += 1 + l + sovTypes(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *ContainerID) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Value) - if l > 0 { - n += 1 + l + sovTypes(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *OwnerID) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Value) - if l > 0 { - n += 1 + l + sovTypes(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *Version) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Major != 0 { - n += 1 + sovTypes(uint64(m.Major)) - } - if m.Minor != 0 { - n += 1 + sovTypes(uint64(m.Minor)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *Signature) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Key) - if l > 0 { - n += 1 + l + sovTypes(uint64(l)) - } - l = len(m.Sign) - if l > 0 { - n += 1 + l + sovTypes(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *Checksum) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Type != 0 { - n += 1 + sovTypes(uint64(m.Type)) - } - l = len(m.Sum) - if l > 0 { - n += 1 + l + sovTypes(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func sovTypes(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozTypes(x uint64) (n int) { - return sovTypes(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *Address) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Address: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Address: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ContainerId", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.ContainerId == nil { - m.ContainerId = &ContainerID{} - } - if err := m.ContainerId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ObjectId", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.ObjectId == nil { - m.ObjectId = &ObjectID{} - } - if err := m.ObjectId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ObjectID) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ObjectID: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ObjectID: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Value = append(m.Value[:0], dAtA[iNdEx:postIndex]...) - if m.Value == nil { - m.Value = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ContainerID) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ContainerID: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ContainerID: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Value = append(m.Value[:0], dAtA[iNdEx:postIndex]...) - if m.Value == nil { - m.Value = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *OwnerID) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: OwnerID: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: OwnerID: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Value = append(m.Value[:0], dAtA[iNdEx:postIndex]...) - if m.Value == nil { - m.Value = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Version) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Version: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Version: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Major", wireType) - } - m.Major = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Major |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Minor", wireType) - } - m.Minor = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Minor |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Signature) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Signature: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Signature: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Key = append(m.Key[:0], dAtA[iNdEx:postIndex]...) - if m.Key == nil { - m.Key = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Sign", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Sign = append(m.Sign[:0], dAtA[iNdEx:postIndex]...) - if m.Sign == nil { - m.Sign = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Checksum) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Checksum: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Checksum: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) - } - m.Type = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Type |= ChecksumType(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Sum", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Sum = append(m.Sum[:0], dAtA[iNdEx:postIndex]...) - if m.Sum == nil { - m.Sum = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipTypes(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTypes - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTypes - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTypes - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthTypes - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupTypes - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthTypes - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF +var file_v2_refs_grpc_types_proto_rawDesc = []byte{ + 0x0a, 0x18, 0x76, 0x32, 0x2f, 0x72, 0x65, 0x66, 0x73, 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, 0x72, 0x65, 0x66, 0x73, 0x22, 0x80, 0x01, 0x0a, 0x07, 0x41, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x3e, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, + 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x6f, + 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x61, + 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x12, 0x35, 0x0a, 0x09, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, + 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 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, 0x08, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x44, 0x22, 0x20, 0x0a, + 0x08, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x44, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, + 0x23, 0x0a, 0x0b, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x12, 0x14, + 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x22, 0x1f, 0x0a, 0x07, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x12, + 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x35, 0x0a, 0x07, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, + 0x12, 0x14, 0x0a, 0x05, 0x6d, 0x61, 0x6a, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, + 0x05, 0x6d, 0x61, 0x6a, 0x6f, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x6d, 0x69, 0x6e, 0x6f, 0x72, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x6d, 0x69, 0x6e, 0x6f, 0x72, 0x22, 0x36, 0x0a, 0x09, + 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x17, 0x0a, 0x04, 0x73, + 0x69, 0x67, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, + 0x74, 0x75, 0x72, 0x65, 0x22, 0x4e, 0x0a, 0x08, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, + 0x12, 0x30, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1c, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, + 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, + 0x70, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x75, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, + 0x03, 0x73, 0x75, 0x6d, 0x2a, 0x41, 0x0a, 0x0c, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, + 0x54, 0x79, 0x70, 0x65, 0x12, 0x1d, 0x0a, 0x19, 0x43, 0x48, 0x45, 0x43, 0x4b, 0x53, 0x55, 0x4d, + 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, + 0x44, 0x10, 0x00, 0x12, 0x06, 0x0a, 0x02, 0x54, 0x5a, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x53, + 0x48, 0x41, 0x32, 0x35, 0x36, 0x10, 0x02, 0x42, 0x49, 0x5a, 0x33, 0x67, 0x69, 0x74, 0x68, 0x75, + 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, + 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, + 0x72, 0x65, 0x66, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x72, 0x65, 0x66, 0x73, 0xaa, 0x02, + 0x11, 0x4e, 0x65, 0x6f, 0x46, 0x53, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x76, 0x32, 0x2e, 0x52, 0x65, + 0x66, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( - ErrInvalidLengthTypes = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowTypes = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupTypes = fmt.Errorf("proto: unexpected end of group") + file_v2_refs_grpc_types_proto_rawDescOnce sync.Once + file_v2_refs_grpc_types_proto_rawDescData = file_v2_refs_grpc_types_proto_rawDesc ) + +func file_v2_refs_grpc_types_proto_rawDescGZIP() []byte { + file_v2_refs_grpc_types_proto_rawDescOnce.Do(func() { + file_v2_refs_grpc_types_proto_rawDescData = protoimpl.X.CompressGZIP(file_v2_refs_grpc_types_proto_rawDescData) + }) + return file_v2_refs_grpc_types_proto_rawDescData +} + +var file_v2_refs_grpc_types_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_v2_refs_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 7) +var file_v2_refs_grpc_types_proto_goTypes = []interface{}{ + (ChecksumType)(0), // 0: neo.fs.v2.refs.ChecksumType + (*Address)(nil), // 1: neo.fs.v2.refs.Address + (*ObjectID)(nil), // 2: neo.fs.v2.refs.ObjectID + (*ContainerID)(nil), // 3: neo.fs.v2.refs.ContainerID + (*OwnerID)(nil), // 4: neo.fs.v2.refs.OwnerID + (*Version)(nil), // 5: neo.fs.v2.refs.Version + (*Signature)(nil), // 6: neo.fs.v2.refs.Signature + (*Checksum)(nil), // 7: neo.fs.v2.refs.Checksum +} +var file_v2_refs_grpc_types_proto_depIdxs = []int32{ + 3, // 0: neo.fs.v2.refs.Address.container_id:type_name -> neo.fs.v2.refs.ContainerID + 2, // 1: neo.fs.v2.refs.Address.object_id:type_name -> neo.fs.v2.refs.ObjectID + 0, // 2: neo.fs.v2.refs.Checksum.type:type_name -> neo.fs.v2.refs.ChecksumType + 3, // [3:3] is the sub-list for method output_type + 3, // [3:3] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name +} + +func init() { file_v2_refs_grpc_types_proto_init() } +func file_v2_refs_grpc_types_proto_init() { + if File_v2_refs_grpc_types_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_v2_refs_grpc_types_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Address); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_refs_grpc_types_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ObjectID); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_refs_grpc_types_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ContainerID); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_refs_grpc_types_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*OwnerID); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_refs_grpc_types_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Version); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_refs_grpc_types_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Signature); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_refs_grpc_types_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Checksum); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_v2_refs_grpc_types_proto_rawDesc, + NumEnums: 1, + NumMessages: 7, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_v2_refs_grpc_types_proto_goTypes, + DependencyIndexes: file_v2_refs_grpc_types_proto_depIdxs, + EnumInfos: file_v2_refs_grpc_types_proto_enumTypes, + MessageInfos: file_v2_refs_grpc_types_proto_msgTypes, + }.Build() + File_v2_refs_grpc_types_proto = out.File + file_v2_refs_grpc_types_proto_rawDesc = nil + file_v2_refs_grpc_types_proto_goTypes = nil + file_v2_refs_grpc_types_proto_depIdxs = nil +} diff --git a/v2/refs/marshal.go b/v2/refs/marshal.go index 2f3f265..868b157 100644 --- a/v2/refs/marshal.go +++ b/v2/refs/marshal.go @@ -3,6 +3,7 @@ package refs import ( "github.com/nspcc-dev/neofs-api-go/util/proto" refs "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" + goproto "google.golang.org/protobuf/proto" ) const ( @@ -147,7 +148,7 @@ func (a *Address) StableUnmarshal(data []byte) error { } addrGRPC := new(refs.Address) - if err := addrGRPC.Unmarshal(data); err != nil { + if err := goproto.Unmarshal(data, addrGRPC); err != nil { return err } diff --git a/v2/refs/marshal_test.go b/v2/refs/marshal_test.go index 5ba3994..4745147 100644 --- a/v2/refs/marshal_test.go +++ b/v2/refs/marshal_test.go @@ -6,6 +6,7 @@ import ( "github.com/nspcc-dev/neofs-api-go/v2/refs" grpc "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" "github.com/stretchr/testify/require" + goproto "google.golang.org/protobuf/proto" ) func TestOwnerID_StableMarshal(t *testing.T) { @@ -18,7 +19,7 @@ func TestOwnerID_StableMarshal(t *testing.T) { wire, err := ownerFrom.StableMarshal(nil) require.NoError(t, err) - err = ownerTransport.Unmarshal(wire) + err = goproto.Unmarshal(wire, ownerTransport) require.NoError(t, err) ownerTo := refs.OwnerIDFromGRPCMessage(ownerTransport) @@ -36,7 +37,7 @@ func TestContainerID_StableMarshal(t *testing.T) { wire, err := cnrFrom.StableMarshal(nil) require.NoError(t, err) - err = cnrTransport.Unmarshal(wire) + err = goproto.Unmarshal(wire, cnrTransport) require.NoError(t, err) cnrTo := refs.ContainerIDFromGRPCMessage(cnrTransport) @@ -54,7 +55,7 @@ func TestObjectID_StableMarshal(t *testing.T) { wire, err := objectIDFrom.StableMarshal(nil) require.NoError(t, err) - err = objectIDTransport.Unmarshal(wire) + err = goproto.Unmarshal(wire, objectIDTransport) require.NoError(t, err) objectIDTo := refs.ObjectIDFromGRPCMessage(objectIDTransport) @@ -74,7 +75,7 @@ func TestAddress_StableMarshal(t *testing.T) { wire, err := addressFrom.StableMarshal(nil) require.NoError(t, err) - err = addressTransport.Unmarshal(wire) + err = goproto.Unmarshal(wire, addressTransport) require.NoError(t, err) addressTo := refs.AddressFromGRPCMessage(addressTransport) @@ -93,7 +94,7 @@ func TestChecksum_StableMarshal(t *testing.T) { wire, err := checksumFrom.StableMarshal(nil) require.NoError(t, err) - err = transport.Unmarshal(wire) + err = goproto.Unmarshal(wire, transport) require.NoError(t, err) checksumTo := refs.ChecksumFromGRPCMessage(transport) @@ -109,7 +110,7 @@ func TestSignature_StableMarshal(t *testing.T) { wire, err := signatureFrom.StableMarshal(nil) require.NoError(t, err) - err = transport.Unmarshal(wire) + err = goproto.Unmarshal(wire, transport) require.NoError(t, err) signatureTo := refs.SignatureFromGRPCMessage(transport) @@ -125,7 +126,7 @@ func TestVersion_StableMarshal(t *testing.T) { wire, err := versionFrom.StableMarshal(nil) require.NoError(t, err) - err = transport.Unmarshal(wire) + err = goproto.Unmarshal(wire, transport) require.NoError(t, err) versionTo := refs.VersionFromGRPCMessage(transport) diff --git a/v2/session/grpc/service.pb.go b/v2/session/grpc/service.pb.go index 1229a1e..712500e 100644 --- a/v2/session/grpc/service.pb.go +++ b/v2/session/grpc/service.pb.go @@ -1,34 +1,41 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.23.0 +// protoc v3.13.0 // source: v2/session/grpc/service.proto package session import ( context "context" - fmt "fmt" proto "github.com/golang/protobuf/proto" grpc "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" grpc1 "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" - io "io" - math "math" - math_bits "math/bits" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +// This is a compile-time assertion that a sufficiently up-to-date version +// of the legacy proto package is being used. +const _ = proto.ProtoPackageIsVersion4 // Information necessary for opening a session. type CreateRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // Body of create session token request message. Body *CreateRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` // Carries request meta information. Header data is used only to regulate @@ -37,126 +44,68 @@ type CreateRequest struct { // 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,proto3" json:"verify_header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + VerifyHeader *RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` } -func (m *CreateRequest) Reset() { *m = CreateRequest{} } -func (m *CreateRequest) String() string { return proto.CompactTextString(m) } -func (*CreateRequest) ProtoMessage() {} +func (x *CreateRequest) Reset() { + *x = CreateRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_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_v2_session_grpc_service_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateRequest.ProtoReflect.Descriptor instead. func (*CreateRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_4ed1365cc8e16cd4, []int{0} -} -func (m *CreateRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *CreateRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_CreateRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *CreateRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_CreateRequest.Merge(m, src) -} -func (m *CreateRequest) XXX_Size() int { - return m.Size() -} -func (m *CreateRequest) XXX_DiscardUnknown() { - xxx_messageInfo_CreateRequest.DiscardUnknown(m) + return file_v2_session_grpc_service_proto_rawDescGZIP(), []int{0} } -var xxx_messageInfo_CreateRequest proto.InternalMessageInfo - -func (m *CreateRequest) GetBody() *CreateRequest_Body { - if m != nil { - return m.Body +func (x *CreateRequest) GetBody() *CreateRequest_Body { + if x != nil { + return x.Body } return nil } -func (m *CreateRequest) GetMetaHeader() *RequestMetaHeader { - if m != nil { - return m.MetaHeader +func (x *CreateRequest) GetMetaHeader() *RequestMetaHeader { + if x != nil { + return x.MetaHeader } return nil } -func (m *CreateRequest) GetVerifyHeader() *RequestVerificationHeader { - if m != nil { - return m.VerifyHeader +func (x *CreateRequest) GetVerifyHeader() *RequestVerificationHeader { + if x != nil { + return x.VerifyHeader } return nil } -// Session creation request body -type CreateRequest_Body struct { - // Dession initiating user's or node's key derived `OwnerID`. - OwnerId *grpc.OwnerID `protobuf:"bytes,1,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"` - // Session expiration `Epoch` - Expiration uint64 `protobuf:"varint,2,opt,name=expiration,proto3" json:"expiration,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *CreateRequest_Body) Reset() { *m = CreateRequest_Body{} } -func (m *CreateRequest_Body) String() string { return proto.CompactTextString(m) } -func (*CreateRequest_Body) ProtoMessage() {} -func (*CreateRequest_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_4ed1365cc8e16cd4, []int{0, 0} -} -func (m *CreateRequest_Body) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *CreateRequest_Body) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_CreateRequest_Body.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *CreateRequest_Body) XXX_Merge(src proto.Message) { - xxx_messageInfo_CreateRequest_Body.Merge(m, src) -} -func (m *CreateRequest_Body) XXX_Size() int { - return m.Size() -} -func (m *CreateRequest_Body) XXX_DiscardUnknown() { - xxx_messageInfo_CreateRequest_Body.DiscardUnknown(m) -} - -var xxx_messageInfo_CreateRequest_Body proto.InternalMessageInfo - -func (m *CreateRequest_Body) GetOwnerId() *grpc.OwnerID { - if m != nil { - return m.OwnerId - } - return nil -} - -func (m *CreateRequest_Body) GetExpiration() uint64 { - if m != nil { - return m.Expiration - } - return 0 -} - // Information about the opened session. type CreateResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // Body of create session token response message. Body *CreateResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` // Carries response meta information. Header data is used only to regulate @@ -165,172 +114,364 @@ type CreateResponse struct { // 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,proto3" json:"verify_header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + VerifyHeader *ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` } -func (m *CreateResponse) Reset() { *m = CreateResponse{} } -func (m *CreateResponse) String() string { return proto.CompactTextString(m) } -func (*CreateResponse) ProtoMessage() {} -func (*CreateResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_4ed1365cc8e16cd4, []int{1} +func (x *CreateResponse) Reset() { + *x = CreateResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_session_grpc_service_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *CreateResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) + +func (x *CreateResponse) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *CreateResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_CreateResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err + +func (*CreateResponse) ProtoMessage() {} + +func (x *CreateResponse) ProtoReflect() protoreflect.Message { + mi := &file_v2_session_grpc_service_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) } - return b[:n], nil + return ms } -} -func (m *CreateResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_CreateResponse.Merge(m, src) -} -func (m *CreateResponse) XXX_Size() int { - return m.Size() -} -func (m *CreateResponse) XXX_DiscardUnknown() { - xxx_messageInfo_CreateResponse.DiscardUnknown(m) + return mi.MessageOf(x) } -var xxx_messageInfo_CreateResponse proto.InternalMessageInfo +// Deprecated: Use CreateResponse.ProtoReflect.Descriptor instead. +func (*CreateResponse) Descriptor() ([]byte, []int) { + return file_v2_session_grpc_service_proto_rawDescGZIP(), []int{1} +} -func (m *CreateResponse) GetBody() *CreateResponse_Body { - if m != nil { - return m.Body +func (x *CreateResponse) GetBody() *CreateResponse_Body { + if x != nil { + return x.Body } return nil } -func (m *CreateResponse) GetMetaHeader() *ResponseMetaHeader { - if m != nil { - return m.MetaHeader +func (x *CreateResponse) GetMetaHeader() *ResponseMetaHeader { + if x != nil { + return x.MetaHeader } return nil } -func (m *CreateResponse) GetVerifyHeader() *ResponseVerificationHeader { - if m != nil { - return m.VerifyHeader +func (x *CreateResponse) GetVerifyHeader() *ResponseVerificationHeader { + if x != nil { + return x.VerifyHeader } return nil } +// Session creation request body +type CreateRequest_Body struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Dession initiating user's or node's key derived `OwnerID`. + OwnerId *grpc.OwnerID `protobuf:"bytes,1,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"` + // Session expiration `Epoch` + Expiration uint64 `protobuf:"varint,2,opt,name=expiration,proto3" json:"expiration,omitempty"` +} + +func (x *CreateRequest_Body) Reset() { + *x = CreateRequest_Body{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_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_v2_session_grpc_service_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateRequest_Body.ProtoReflect.Descriptor instead. +func (*CreateRequest_Body) Descriptor() ([]byte, []int) { + return file_v2_session_grpc_service_proto_rawDescGZIP(), []int{0, 0} +} + +func (x *CreateRequest_Body) GetOwnerId() *grpc.OwnerID { + if x != nil { + return x.OwnerId + } + return nil +} + +func (x *CreateRequest_Body) GetExpiration() uint64 { + if x != nil { + return x.Expiration + } + return 0 +} + // Session creation response body type CreateResponse_Body struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // Identifier of a newly created session Id []byte `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` // Public key used for session - SessionKey []byte `protobuf:"bytes,2,opt,name=session_key,json=sessionKey,proto3" json:"session_key,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + SessionKey []byte `protobuf:"bytes,2,opt,name=session_key,json=sessionKey,proto3" json:"session_key,omitempty"` } -func (m *CreateResponse_Body) Reset() { *m = CreateResponse_Body{} } -func (m *CreateResponse_Body) String() string { return proto.CompactTextString(m) } -func (*CreateResponse_Body) ProtoMessage() {} -func (*CreateResponse_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_4ed1365cc8e16cd4, []int{1, 0} +func (x *CreateResponse_Body) Reset() { + *x = CreateResponse_Body{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_session_grpc_service_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *CreateResponse_Body) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) + +func (x *CreateResponse_Body) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *CreateResponse_Body) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_CreateResponse_Body.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err + +func (*CreateResponse_Body) ProtoMessage() {} + +func (x *CreateResponse_Body) ProtoReflect() protoreflect.Message { + mi := &file_v2_session_grpc_service_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) } - return b[:n], nil + return ms } -} -func (m *CreateResponse_Body) XXX_Merge(src proto.Message) { - xxx_messageInfo_CreateResponse_Body.Merge(m, src) -} -func (m *CreateResponse_Body) XXX_Size() int { - return m.Size() -} -func (m *CreateResponse_Body) XXX_DiscardUnknown() { - xxx_messageInfo_CreateResponse_Body.DiscardUnknown(m) + return mi.MessageOf(x) } -var xxx_messageInfo_CreateResponse_Body proto.InternalMessageInfo +// Deprecated: Use CreateResponse_Body.ProtoReflect.Descriptor instead. +func (*CreateResponse_Body) Descriptor() ([]byte, []int) { + return file_v2_session_grpc_service_proto_rawDescGZIP(), []int{1, 0} +} -func (m *CreateResponse_Body) GetId() []byte { - if m != nil { - return m.Id +func (x *CreateResponse_Body) GetId() []byte { + if x != nil { + return x.Id } return nil } -func (m *CreateResponse_Body) GetSessionKey() []byte { - if m != nil { - return m.SessionKey +func (x *CreateResponse_Body) GetSessionKey() []byte { + if x != nil { + return x.SessionKey } return nil } -func init() { - proto.RegisterType((*CreateRequest)(nil), "neo.fs.v2.session.CreateRequest") - proto.RegisterType((*CreateRequest_Body)(nil), "neo.fs.v2.session.CreateRequest.Body") - proto.RegisterType((*CreateResponse)(nil), "neo.fs.v2.session.CreateResponse") - proto.RegisterType((*CreateResponse_Body)(nil), "neo.fs.v2.session.CreateResponse.Body") +var File_v2_session_grpc_service_proto protoreflect.FileDescriptor + +var file_v2_session_grpc_service_proto_rawDesc = []byte{ + 0x0a, 0x1d, 0x76, 0x32, 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, 0x18, 0x76, 0x32, 0x2f, 0x72, 0x65, 0x66, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, + 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x76, 0x32, + 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, 0x52, 0x5a, 0x39, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, + 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, + 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, + 0x6e, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0xaa, 0x02, + 0x14, 0x4e, 0x65, 0x6f, 0x46, 0x53, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x76, 0x32, 0x2e, 0x53, 0x65, + 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } -func init() { proto.RegisterFile("v2/session/grpc/service.proto", fileDescriptor_4ed1365cc8e16cd4) } +var ( + file_v2_session_grpc_service_proto_rawDescOnce sync.Once + file_v2_session_grpc_service_proto_rawDescData = file_v2_session_grpc_service_proto_rawDesc +) -var fileDescriptor_4ed1365cc8e16cd4 = []byte{ - // 444 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x93, 0x4d, 0x6f, 0xd3, 0x30, - 0x18, 0xc7, 0x49, 0xa8, 0x06, 0x7a, 0xda, 0x55, 0xc2, 0x42, 0xa2, 0x2a, 0x22, 0x8c, 0x89, 0x21, - 0x0e, 0xd4, 0x91, 0xc2, 0x01, 0x0d, 0x4e, 0x0c, 0x98, 0xa8, 0xd0, 0x78, 0x71, 0x25, 0x0e, 0xbb, - 0x54, 0x79, 0x79, 0xd2, 0x59, 0xa8, 0x71, 0xb0, 0xbd, 0x40, 0xbe, 0x09, 0x57, 0xae, 0x7c, 0x0a, - 0x8e, 0x1c, 0xf9, 0x08, 0xa8, 0x7c, 0x11, 0x14, 0xdb, 0x43, 0xd9, 0x96, 0xad, 0xb7, 0x38, 0xfe, - 0x3f, 0x3f, 0x3f, 0xcf, 0x4f, 0x36, 0xdc, 0xa9, 0xa2, 0x50, 0xa1, 0x52, 0x5c, 0x14, 0xe1, 0x42, - 0x96, 0x69, 0xa8, 0x50, 0x56, 0x3c, 0x45, 0x5a, 0x4a, 0xa1, 0x05, 0xb9, 0x51, 0xa0, 0xa0, 0xb9, - 0xa2, 0x55, 0x44, 0x5d, 0x6a, 0x3c, 0xaa, 0xa2, 0x50, 0x62, 0xae, 0x6c, 0x5c, 0xd7, 0x25, 0x2a, - 0x1b, 0x1e, 0xdf, 0x3e, 0xcb, 0x6a, 0x6d, 0x6e, 0xff, 0xf4, 0x61, 0xf3, 0x85, 0xc4, 0x58, 0x23, - 0xc3, 0xcf, 0xc7, 0xa8, 0x34, 0xd9, 0x85, 0x5e, 0x22, 0xb2, 0x7a, 0xe4, 0x6d, 0x79, 0x0f, 0xfb, - 0xd1, 0x0e, 0x3d, 0x77, 0x14, 0x3d, 0x95, 0xa7, 0x7b, 0x22, 0xab, 0x99, 0x29, 0x21, 0xaf, 0xa0, - 0xbf, 0x44, 0x1d, 0xcf, 0x8f, 0x30, 0xce, 0x50, 0x8e, 0x7c, 0x43, 0xb8, 0xdf, 0x41, 0x70, 0xb5, - 0x07, 0xa8, 0xe3, 0xd7, 0x26, 0xcb, 0x60, 0xf9, 0xff, 0x9b, 0x7c, 0x80, 0xcd, 0x0a, 0x25, 0xcf, - 0xeb, 0x13, 0xd0, 0x55, 0x03, 0x7a, 0x74, 0x31, 0xe8, 0x63, 0x13, 0xe7, 0x69, 0xac, 0xb9, 0x28, - 0x1c, 0x70, 0x60, 0x11, 0x76, 0x35, 0x3e, 0x84, 0x5e, 0xd3, 0x27, 0x89, 0xe0, 0xba, 0xf8, 0x52, - 0xa0, 0x9c, 0xf3, 0xcc, 0x0d, 0x78, 0xab, 0x45, 0x6d, 0xfc, 0xd1, 0x77, 0xcd, 0xfe, 0xf4, 0x25, - 0xbb, 0x66, 0x82, 0xd3, 0x8c, 0x04, 0x00, 0xf8, 0xb5, 0xe4, 0xd2, 0xd0, 0xcd, 0x50, 0x3d, 0xd6, - 0xfa, 0xb3, 0xfd, 0xdd, 0x87, 0xe1, 0x89, 0x12, 0x55, 0x8a, 0x42, 0x21, 0x79, 0x7a, 0xca, 0xe1, - 0x83, 0x4b, 0x1c, 0xda, 0x82, 0xb6, 0xc4, 0xfd, 0x2e, 0x89, 0x3b, 0x9d, 0xb3, 0xdb, 0xe2, 0x0b, - 0x2c, 0xb2, 0x6e, 0x8b, 0x93, 0x4b, 0x48, 0x6b, 0x35, 0x3e, 0x71, 0x1a, 0x87, 0xe0, 0x3b, 0x81, - 0x03, 0xe6, 0xf3, 0x8c, 0xdc, 0x85, 0xbe, 0x63, 0xcd, 0x3f, 0x61, 0x6d, 0x7a, 0x1e, 0x30, 0x70, - 0xbf, 0xde, 0x60, 0x1d, 0xcd, 0x61, 0x38, 0xb3, 0xab, 0x99, 0xbd, 0xc8, 0xe4, 0x00, 0x36, 0xac, - 0x03, 0xb2, 0xb5, 0xee, 0x8a, 0x8d, 0xef, 0xad, 0x15, 0xb8, 0x97, 0xfc, 0x5a, 0x05, 0xde, 0xef, - 0x55, 0xe0, 0xfd, 0x59, 0x05, 0xde, 0xb7, 0xbf, 0xc1, 0x95, 0xc3, 0xdd, 0x05, 0xd7, 0x47, 0xc7, - 0x09, 0x4d, 0xc5, 0x32, 0x2c, 0x54, 0x99, 0xa6, 0x93, 0x0c, 0xab, 0xb0, 0x40, 0x91, 0xab, 0x49, - 0x5c, 0xf2, 0xc9, 0x42, 0x84, 0x67, 0x1e, 0xc6, 0x33, 0xb7, 0xf8, 0xe1, 0xdf, 0x7c, 0x8b, 0x62, - 0x7f, 0x46, 0x9f, 0xbf, 0x9f, 0x36, 0x47, 0xba, 0xce, 0x93, 0x0d, 0xf3, 0x64, 0x1e, 0xff, 0x0b, - 0x00, 0x00, 0xff, 0xff, 0xd3, 0xaa, 0x38, 0x65, 0x9d, 0x03, 0x00, 0x00, +func file_v2_session_grpc_service_proto_rawDescGZIP() []byte { + file_v2_session_grpc_service_proto_rawDescOnce.Do(func() { + file_v2_session_grpc_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_v2_session_grpc_service_proto_rawDescData) + }) + return file_v2_session_grpc_service_proto_rawDescData +} + +var file_v2_session_grpc_service_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_v2_session_grpc_service_proto_goTypes = []interface{}{ + (*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_v2_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_v2_session_grpc_service_proto_init() } +func file_v2_session_grpc_service_proto_init() { + if File_v2_session_grpc_service_proto != nil { + return + } + file_v2_session_grpc_types_proto_init() + if !protoimpl.UnsafeEnabled { + file_v2_session_grpc_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_session_grpc_service_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_session_grpc_service_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateRequest_Body); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_session_grpc_service_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateResponse_Body); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_v2_session_grpc_service_proto_rawDesc, + NumEnums: 0, + NumMessages: 4, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_v2_session_grpc_service_proto_goTypes, + DependencyIndexes: file_v2_session_grpc_service_proto_depIdxs, + MessageInfos: file_v2_session_grpc_service_proto_msgTypes, + }.Build() + File_v2_session_grpc_service_proto = out.File + file_v2_session_grpc_service_proto_rawDesc = nil + file_v2_session_grpc_service_proto_goTypes = nil + file_v2_session_grpc_service_proto_depIdxs = nil } // Reference imports to suppress errors if they are not otherwise used. var _ context.Context -var _ grpc1.ClientConn +var _ grpc1.ClientConnInterface // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -const _ = grpc1.SupportPackageIsVersion4 +const _ = grpc1.SupportPackageIsVersion6 // SessionServiceClient is the client API for SessionService service. // @@ -341,10 +482,10 @@ type SessionServiceClient interface { } type sessionServiceClient struct { - cc *grpc1.ClientConn + cc grpc1.ClientConnInterface } -func NewSessionServiceClient(cc *grpc1.ClientConn) SessionServiceClient { +func NewSessionServiceClient(cc grpc1.ClientConnInterface) SessionServiceClient { return &sessionServiceClient{cc} } @@ -367,7 +508,7 @@ type SessionServiceServer interface { type UnimplementedSessionServiceServer struct { } -func (*UnimplementedSessionServiceServer) Create(ctx context.Context, req *CreateRequest) (*CreateResponse, error) { +func (*UnimplementedSessionServiceServer) Create(context.Context, *CreateRequest) (*CreateResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Create not implemented") } @@ -405,958 +546,3 @@ var _SessionService_serviceDesc = grpc1.ServiceDesc{ Streams: []grpc1.StreamDesc{}, Metadata: "v2/session/grpc/service.proto", } - -func (m *CreateRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *CreateRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *CreateRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.VerifyHeader != nil { - { - size, err := m.VerifyHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if m.MetaHeader != nil { - { - size, err := m.MetaHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.Body != nil { - { - size, err := m.Body.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *CreateRequest_Body) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *CreateRequest_Body) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *CreateRequest_Body) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.Expiration != 0 { - i = encodeVarintService(dAtA, i, uint64(m.Expiration)) - i-- - dAtA[i] = 0x10 - } - if m.OwnerId != nil { - { - size, err := m.OwnerId.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *CreateResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *CreateResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *CreateResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.VerifyHeader != nil { - { - size, err := m.VerifyHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if m.MetaHeader != nil { - { - size, err := m.MetaHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.Body != nil { - { - size, err := m.Body.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *CreateResponse_Body) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *CreateResponse_Body) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *CreateResponse_Body) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.SessionKey) > 0 { - i -= len(m.SessionKey) - copy(dAtA[i:], m.SessionKey) - i = encodeVarintService(dAtA, i, uint64(len(m.SessionKey))) - i-- - dAtA[i] = 0x12 - } - if len(m.Id) > 0 { - i -= len(m.Id) - copy(dAtA[i:], m.Id) - i = encodeVarintService(dAtA, i, uint64(len(m.Id))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func encodeVarintService(dAtA []byte, offset int, v uint64) int { - offset -= sovService(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *CreateRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Body != nil { - l = m.Body.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.MetaHeader != nil { - l = m.MetaHeader.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.VerifyHeader != nil { - l = m.VerifyHeader.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *CreateRequest_Body) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.OwnerId != nil { - l = m.OwnerId.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.Expiration != 0 { - n += 1 + sovService(uint64(m.Expiration)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *CreateResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Body != nil { - l = m.Body.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.MetaHeader != nil { - l = m.MetaHeader.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.VerifyHeader != nil { - l = m.VerifyHeader.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *CreateResponse_Body) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Id) - if l > 0 { - n += 1 + l + sovService(uint64(l)) - } - l = len(m.SessionKey) - if l > 0 { - n += 1 + l + sovService(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func sovService(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozService(x uint64) (n int) { - return sovService(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *CreateRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: CreateRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: CreateRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Body", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Body == nil { - m.Body = &CreateRequest_Body{} - } - if err := m.Body.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MetaHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.MetaHeader == nil { - m.MetaHeader = &RequestMetaHeader{} - } - if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field VerifyHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.VerifyHeader == nil { - m.VerifyHeader = &RequestVerificationHeader{} - } - if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *CreateRequest_Body) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Body: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Body: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OwnerId", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.OwnerId == nil { - m.OwnerId = &grpc.OwnerID{} - } - if err := m.OwnerId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Expiration", wireType) - } - m.Expiration = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Expiration |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *CreateResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: CreateResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: CreateResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Body", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Body == nil { - m.Body = &CreateResponse_Body{} - } - if err := m.Body.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MetaHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.MetaHeader == nil { - m.MetaHeader = &ResponseMetaHeader{} - } - if err := m.MetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field VerifyHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.VerifyHeader == nil { - m.VerifyHeader = &ResponseVerificationHeader{} - } - if err := m.VerifyHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *CreateResponse_Body) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Body: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Body: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Id = append(m.Id[:0], dAtA[iNdEx:postIndex]...) - if m.Id == nil { - m.Id = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SessionKey", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.SessionKey = append(m.SessionKey[:0], dAtA[iNdEx:postIndex]...) - if m.SessionKey == nil { - m.SessionKey = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipService(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowService - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowService - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowService - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthService - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupService - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthService - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthService = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowService = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupService = fmt.Errorf("proto: unexpected end of group") -) diff --git a/v2/session/grpc/types.pb.go b/v2/session/grpc/types.pb.go index 77f5291..7140ceb 100644 --- a/v2/session/grpc/types.pb.go +++ b/v2/session/grpc/types.pb.go @@ -1,28 +1,31 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.23.0 +// protoc v3.13.0 // source: v2/session/grpc/types.proto package session import ( - fmt "fmt" proto "github.com/golang/protobuf/proto" grpc1 "github.com/nspcc-dev/neofs-api-go/v2/acl/grpc" grpc "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" - io "io" - math "math" - math_bits "math/bits" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +// This is a compile-time assertion that a sufficiently up-to-date version +// of the legacy proto package is being used. +const _ = proto.ProtoPackageIsVersion4 // Object request verbs type ObjectSessionContext_Verb int32 @@ -46,389 +49,229 @@ const ( ObjectSessionContext_RANGEHASH ObjectSessionContext_Verb = 7 ) -var ObjectSessionContext_Verb_name = map[int32]string{ - 0: "VERB_UNSPECIFIED", - 1: "PUT", - 2: "GET", - 3: "HEAD", - 4: "SEARCH", - 5: "DELETE", - 6: "RANGE", - 7: "RANGEHASH", -} +// Enum value maps for ObjectSessionContext_Verb. +var ( + ObjectSessionContext_Verb_name = map[int32]string{ + 0: "VERB_UNSPECIFIED", + 1: "PUT", + 2: "GET", + 3: "HEAD", + 4: "SEARCH", + 5: "DELETE", + 6: "RANGE", + 7: "RANGEHASH", + } + ObjectSessionContext_Verb_value = map[string]int32{ + "VERB_UNSPECIFIED": 0, + "PUT": 1, + "GET": 2, + "HEAD": 3, + "SEARCH": 4, + "DELETE": 5, + "RANGE": 6, + "RANGEHASH": 7, + } +) -var ObjectSessionContext_Verb_value = map[string]int32{ - "VERB_UNSPECIFIED": 0, - "PUT": 1, - "GET": 2, - "HEAD": 3, - "SEARCH": 4, - "DELETE": 5, - "RANGE": 6, - "RANGEHASH": 7, +func (x ObjectSessionContext_Verb) Enum() *ObjectSessionContext_Verb { + p := new(ObjectSessionContext_Verb) + *p = x + return p } func (x ObjectSessionContext_Verb) String() string { - return proto.EnumName(ObjectSessionContext_Verb_name, int32(x)) + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) } +func (ObjectSessionContext_Verb) Descriptor() protoreflect.EnumDescriptor { + return file_v2_session_grpc_types_proto_enumTypes[0].Descriptor() +} + +func (ObjectSessionContext_Verb) Type() protoreflect.EnumType { + return &file_v2_session_grpc_types_proto_enumTypes[0] +} + +func (x ObjectSessionContext_Verb) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use ObjectSessionContext_Verb.Descriptor instead. func (ObjectSessionContext_Verb) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_6bbc551f310b2b05, []int{0, 0} + return file_v2_session_grpc_types_proto_rawDescGZIP(), []int{0, 0} } // Context information for Session Tokens related to ObjectService requests type ObjectSessionContext struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // Type of request for which the token is issued Verb ObjectSessionContext_Verb `protobuf:"varint,1,opt,name=verb,proto3,enum=neo.fs.v2.session.ObjectSessionContext_Verb" json:"verb,omitempty"` // Related Object address - Address *grpc.Address `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Address *grpc.Address `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"` } -func (m *ObjectSessionContext) Reset() { *m = ObjectSessionContext{} } -func (m *ObjectSessionContext) String() string { return proto.CompactTextString(m) } -func (*ObjectSessionContext) ProtoMessage() {} -func (*ObjectSessionContext) Descriptor() ([]byte, []int) { - return fileDescriptor_6bbc551f310b2b05, []int{0} -} -func (m *ObjectSessionContext) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ObjectSessionContext) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ObjectSessionContext.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil +func (x *ObjectSessionContext) Reset() { + *x = ObjectSessionContext{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_session_grpc_types_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } } -func (m *ObjectSessionContext) XXX_Merge(src proto.Message) { - xxx_messageInfo_ObjectSessionContext.Merge(m, src) -} -func (m *ObjectSessionContext) XXX_Size() int { - return m.Size() -} -func (m *ObjectSessionContext) XXX_DiscardUnknown() { - xxx_messageInfo_ObjectSessionContext.DiscardUnknown(m) + +func (x *ObjectSessionContext) String() string { + return protoimpl.X.MessageStringOf(x) } -var xxx_messageInfo_ObjectSessionContext proto.InternalMessageInfo +func (*ObjectSessionContext) ProtoMessage() {} -func (m *ObjectSessionContext) GetVerb() ObjectSessionContext_Verb { - if m != nil { - return m.Verb +func (x *ObjectSessionContext) ProtoReflect() protoreflect.Message { + mi := &file_v2_session_grpc_types_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ObjectSessionContext.ProtoReflect.Descriptor instead. +func (*ObjectSessionContext) Descriptor() ([]byte, []int) { + return file_v2_session_grpc_types_proto_rawDescGZIP(), []int{0} +} + +func (x *ObjectSessionContext) GetVerb() ObjectSessionContext_Verb { + if x != nil { + return x.Verb } return ObjectSessionContext_VERB_UNSPECIFIED } -func (m *ObjectSessionContext) GetAddress() *grpc.Address { - if m != nil { - return m.Address +func (x *ObjectSessionContext) GetAddress() *grpc.Address { + if x != nil { + return x.Address } return nil } // NeoFS Session Token. type SessionToken struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // Session Token contains the proof of trust between peers to be attached in // requests for further verification. Please see corresponding section of // NeoFS Technical Specification for details. Body *SessionToken_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` // Signature of `SessionToken` information - Signature *grpc.Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Signature *grpc.Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` } -func (m *SessionToken) Reset() { *m = SessionToken{} } -func (m *SessionToken) String() string { return proto.CompactTextString(m) } -func (*SessionToken) ProtoMessage() {} +func (x *SessionToken) Reset() { + *x = SessionToken{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_session_grpc_types_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SessionToken) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SessionToken) ProtoMessage() {} + +func (x *SessionToken) ProtoReflect() protoreflect.Message { + mi := &file_v2_session_grpc_types_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SessionToken.ProtoReflect.Descriptor instead. func (*SessionToken) Descriptor() ([]byte, []int) { - return fileDescriptor_6bbc551f310b2b05, []int{1} -} -func (m *SessionToken) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *SessionToken) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_SessionToken.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *SessionToken) XXX_Merge(src proto.Message) { - xxx_messageInfo_SessionToken.Merge(m, src) -} -func (m *SessionToken) XXX_Size() int { - return m.Size() -} -func (m *SessionToken) XXX_DiscardUnknown() { - xxx_messageInfo_SessionToken.DiscardUnknown(m) + return file_v2_session_grpc_types_proto_rawDescGZIP(), []int{1} } -var xxx_messageInfo_SessionToken proto.InternalMessageInfo - -func (m *SessionToken) GetBody() *SessionToken_Body { - if m != nil { - return m.Body +func (x *SessionToken) GetBody() *SessionToken_Body { + if x != nil { + return x.Body } return nil } -func (m *SessionToken) GetSignature() *grpc.Signature { - if m != nil { - return m.Signature +func (x *SessionToken) GetSignature() *grpc.Signature { + if x != nil { + return x.Signature } return nil } -// Session Token body -type SessionToken_Body struct { - // Token identifier is a valid UUIDv4 in binary form - Id []byte `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - // Identifier of the session initiator - OwnerId *grpc.OwnerID `protobuf:"bytes,2,opt,name=owner_id,json=ownerID,proto3" json:"owner_id,omitempty"` - // Lifetime of the session - Lifetime *SessionToken_Body_TokenLifetime `protobuf:"bytes,3,opt,name=lifetime,proto3" json:"lifetime,omitempty"` - // Public key used in session - SessionKey []byte `protobuf:"bytes,4,opt,name=session_key,json=sessionKey,proto3" json:"session_key,omitempty"` - // Session Context information - // - // Types that are valid to be assigned to Context: - // *SessionToken_Body_Object - Context isSessionToken_Body_Context `protobuf_oneof:"context"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *SessionToken_Body) Reset() { *m = SessionToken_Body{} } -func (m *SessionToken_Body) String() string { return proto.CompactTextString(m) } -func (*SessionToken_Body) ProtoMessage() {} -func (*SessionToken_Body) Descriptor() ([]byte, []int) { - return fileDescriptor_6bbc551f310b2b05, []int{1, 0} -} -func (m *SessionToken_Body) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *SessionToken_Body) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_SessionToken_Body.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *SessionToken_Body) XXX_Merge(src proto.Message) { - xxx_messageInfo_SessionToken_Body.Merge(m, src) -} -func (m *SessionToken_Body) XXX_Size() int { - return m.Size() -} -func (m *SessionToken_Body) XXX_DiscardUnknown() { - xxx_messageInfo_SessionToken_Body.DiscardUnknown(m) -} - -var xxx_messageInfo_SessionToken_Body proto.InternalMessageInfo - -type isSessionToken_Body_Context interface { - isSessionToken_Body_Context() - MarshalTo([]byte) (int, error) - Size() int -} - -type SessionToken_Body_Object struct { - Object *ObjectSessionContext `protobuf:"bytes,5,opt,name=object,proto3,oneof" json:"object,omitempty"` -} - -func (*SessionToken_Body_Object) isSessionToken_Body_Context() {} - -func (m *SessionToken_Body) GetContext() isSessionToken_Body_Context { - if m != nil { - return m.Context - } - return nil -} - -func (m *SessionToken_Body) GetId() []byte { - if m != nil { - return m.Id - } - return nil -} - -func (m *SessionToken_Body) GetOwnerId() *grpc.OwnerID { - if m != nil { - return m.OwnerId - } - return nil -} - -func (m *SessionToken_Body) GetLifetime() *SessionToken_Body_TokenLifetime { - if m != nil { - return m.Lifetime - } - return nil -} - -func (m *SessionToken_Body) GetSessionKey() []byte { - if m != nil { - return m.SessionKey - } - return nil -} - -func (m *SessionToken_Body) GetObject() *ObjectSessionContext { - if x, ok := m.GetContext().(*SessionToken_Body_Object); ok { - return x.Object - } - return nil -} - -// XXX_OneofWrappers is for the internal use of the proto package. -func (*SessionToken_Body) XXX_OneofWrappers() []interface{} { - return []interface{}{ - (*SessionToken_Body_Object)(nil), - } -} - -// Lifetime parameters of the token. Filed names taken from rfc7519. -type SessionToken_Body_TokenLifetime struct { - // Expiration Epoch - Exp uint64 `protobuf:"varint,1,opt,name=exp,proto3" json:"exp,omitempty"` - // Not valid before Epoch - Nbf uint64 `protobuf:"varint,2,opt,name=nbf,proto3" json:"nbf,omitempty"` - // Issued at Epoch - Iat uint64 `protobuf:"varint,3,opt,name=iat,proto3" json:"iat,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *SessionToken_Body_TokenLifetime) Reset() { *m = SessionToken_Body_TokenLifetime{} } -func (m *SessionToken_Body_TokenLifetime) String() string { return proto.CompactTextString(m) } -func (*SessionToken_Body_TokenLifetime) ProtoMessage() {} -func (*SessionToken_Body_TokenLifetime) Descriptor() ([]byte, []int) { - return fileDescriptor_6bbc551f310b2b05, []int{1, 0, 0} -} -func (m *SessionToken_Body_TokenLifetime) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *SessionToken_Body_TokenLifetime) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_SessionToken_Body_TokenLifetime.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *SessionToken_Body_TokenLifetime) XXX_Merge(src proto.Message) { - xxx_messageInfo_SessionToken_Body_TokenLifetime.Merge(m, src) -} -func (m *SessionToken_Body_TokenLifetime) XXX_Size() int { - return m.Size() -} -func (m *SessionToken_Body_TokenLifetime) XXX_DiscardUnknown() { - xxx_messageInfo_SessionToken_Body_TokenLifetime.DiscardUnknown(m) -} - -var xxx_messageInfo_SessionToken_Body_TokenLifetime proto.InternalMessageInfo - -func (m *SessionToken_Body_TokenLifetime) GetExp() uint64 { - if m != nil { - return m.Exp - } - return 0 -} - -func (m *SessionToken_Body_TokenLifetime) GetNbf() uint64 { - if m != nil { - return m.Nbf - } - return 0 -} - -func (m *SessionToken_Body_TokenLifetime) GetIat() uint64 { - if m != nil { - return m.Iat - } - return 0 -} - // Extended headers for Request/Response. type XHeader struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // Key of the X-Header Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` // Value of the X-Header - Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` } -func (m *XHeader) Reset() { *m = XHeader{} } -func (m *XHeader) String() string { return proto.CompactTextString(m) } -func (*XHeader) ProtoMessage() {} -func (*XHeader) Descriptor() ([]byte, []int) { - return fileDescriptor_6bbc551f310b2b05, []int{2} -} -func (m *XHeader) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *XHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_XHeader.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil +func (x *XHeader) Reset() { + *x = XHeader{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_session_grpc_types_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } } -func (m *XHeader) XXX_Merge(src proto.Message) { - xxx_messageInfo_XHeader.Merge(m, src) -} -func (m *XHeader) XXX_Size() int { - return m.Size() -} -func (m *XHeader) XXX_DiscardUnknown() { - xxx_messageInfo_XHeader.DiscardUnknown(m) + +func (x *XHeader) String() string { + return protoimpl.X.MessageStringOf(x) } -var xxx_messageInfo_XHeader proto.InternalMessageInfo +func (*XHeader) ProtoMessage() {} -func (m *XHeader) GetKey() string { - if m != nil { - return m.Key +func (x *XHeader) ProtoReflect() protoreflect.Message { + mi := &file_v2_session_grpc_types_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use XHeader.ProtoReflect.Descriptor instead. +func (*XHeader) Descriptor() ([]byte, []int) { + return file_v2_session_grpc_types_proto_rawDescGZIP(), []int{2} +} + +func (x *XHeader) GetKey() string { + if x != nil { + return x.Key } return "" } -func (m *XHeader) GetValue() string { - if m != nil { - return m.Value +func (x *XHeader) GetValue() string { + if x != nil { + return x.Value } return "" } @@ -436,6 +279,10 @@ func (m *XHeader) GetValue() string { // Meta information attached to the request. When forwarded between peers, // request meta headers are folded in matryoshka style. type RequestMetaHeader struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // Peer's API version used Version *grpc.Version `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` // Peer's local epoch number. Set to 0 if unknown. @@ -449,96 +296,96 @@ type RequestMetaHeader struct { // `BearerToken` with eACL overrides for the request BearerToken *grpc1.BearerToken `protobuf:"bytes,6,opt,name=bearer_token,json=bearerToken,proto3" json:"bearer_token,omitempty"` // `RequestMetaHeader` of the origin request - Origin *RequestMetaHeader `protobuf:"bytes,7,opt,name=origin,proto3" json:"origin,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Origin *RequestMetaHeader `protobuf:"bytes,7,opt,name=origin,proto3" json:"origin,omitempty"` } -func (m *RequestMetaHeader) Reset() { *m = RequestMetaHeader{} } -func (m *RequestMetaHeader) String() string { return proto.CompactTextString(m) } -func (*RequestMetaHeader) ProtoMessage() {} -func (*RequestMetaHeader) Descriptor() ([]byte, []int) { - return fileDescriptor_6bbc551f310b2b05, []int{3} +func (x *RequestMetaHeader) Reset() { + *x = RequestMetaHeader{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_session_grpc_types_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *RequestMetaHeader) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) + +func (x *RequestMetaHeader) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *RequestMetaHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_RequestMetaHeader.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err + +func (*RequestMetaHeader) ProtoMessage() {} + +func (x *RequestMetaHeader) ProtoReflect() protoreflect.Message { + mi := &file_v2_session_grpc_types_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) } - return b[:n], nil + return ms } -} -func (m *RequestMetaHeader) XXX_Merge(src proto.Message) { - xxx_messageInfo_RequestMetaHeader.Merge(m, src) -} -func (m *RequestMetaHeader) XXX_Size() int { - return m.Size() -} -func (m *RequestMetaHeader) XXX_DiscardUnknown() { - xxx_messageInfo_RequestMetaHeader.DiscardUnknown(m) + return mi.MessageOf(x) } -var xxx_messageInfo_RequestMetaHeader proto.InternalMessageInfo +// Deprecated: Use RequestMetaHeader.ProtoReflect.Descriptor instead. +func (*RequestMetaHeader) Descriptor() ([]byte, []int) { + return file_v2_session_grpc_types_proto_rawDescGZIP(), []int{3} +} -func (m *RequestMetaHeader) GetVersion() *grpc.Version { - if m != nil { - return m.Version +func (x *RequestMetaHeader) GetVersion() *grpc.Version { + if x != nil { + return x.Version } return nil } -func (m *RequestMetaHeader) GetEpoch() uint64 { - if m != nil { - return m.Epoch +func (x *RequestMetaHeader) GetEpoch() uint64 { + if x != nil { + return x.Epoch } return 0 } -func (m *RequestMetaHeader) GetTtl() uint32 { - if m != nil { - return m.Ttl +func (x *RequestMetaHeader) GetTtl() uint32 { + if x != nil { + return x.Ttl } return 0 } -func (m *RequestMetaHeader) GetXHeaders() []*XHeader { - if m != nil { - return m.XHeaders +func (x *RequestMetaHeader) GetXHeaders() []*XHeader { + if x != nil { + return x.XHeaders } return nil } -func (m *RequestMetaHeader) GetSessionToken() *SessionToken { - if m != nil { - return m.SessionToken +func (x *RequestMetaHeader) GetSessionToken() *SessionToken { + if x != nil { + return x.SessionToken } return nil } -func (m *RequestMetaHeader) GetBearerToken() *grpc1.BearerToken { - if m != nil { - return m.BearerToken +func (x *RequestMetaHeader) GetBearerToken() *grpc1.BearerToken { + if x != nil { + return x.BearerToken } return nil } -func (m *RequestMetaHeader) GetOrigin() *RequestMetaHeader { - if m != nil { - return m.Origin +func (x *RequestMetaHeader) GetOrigin() *RequestMetaHeader { + if x != nil { + return x.Origin } return nil } // Information about the response type ResponseMetaHeader struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // Peer's API version used Version *grpc.Version `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` // Peer's local epoch number @@ -548,82 +395,82 @@ type ResponseMetaHeader struct { // Response X-Headers XHeaders []*XHeader `protobuf:"bytes,4,rep,name=x_headers,json=xHeaders,proto3" json:"x_headers,omitempty"` // `ResponseMetaHeader` of the origin request - Origin *ResponseMetaHeader `protobuf:"bytes,5,opt,name=origin,proto3" json:"origin,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Origin *ResponseMetaHeader `protobuf:"bytes,5,opt,name=origin,proto3" json:"origin,omitempty"` } -func (m *ResponseMetaHeader) Reset() { *m = ResponseMetaHeader{} } -func (m *ResponseMetaHeader) String() string { return proto.CompactTextString(m) } -func (*ResponseMetaHeader) ProtoMessage() {} -func (*ResponseMetaHeader) Descriptor() ([]byte, []int) { - return fileDescriptor_6bbc551f310b2b05, []int{4} +func (x *ResponseMetaHeader) Reset() { + *x = ResponseMetaHeader{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_session_grpc_types_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *ResponseMetaHeader) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) + +func (x *ResponseMetaHeader) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *ResponseMetaHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ResponseMetaHeader.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err + +func (*ResponseMetaHeader) ProtoMessage() {} + +func (x *ResponseMetaHeader) ProtoReflect() protoreflect.Message { + mi := &file_v2_session_grpc_types_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) } - return b[:n], nil + return ms } -} -func (m *ResponseMetaHeader) XXX_Merge(src proto.Message) { - xxx_messageInfo_ResponseMetaHeader.Merge(m, src) -} -func (m *ResponseMetaHeader) XXX_Size() int { - return m.Size() -} -func (m *ResponseMetaHeader) XXX_DiscardUnknown() { - xxx_messageInfo_ResponseMetaHeader.DiscardUnknown(m) + return mi.MessageOf(x) } -var xxx_messageInfo_ResponseMetaHeader proto.InternalMessageInfo +// Deprecated: Use ResponseMetaHeader.ProtoReflect.Descriptor instead. +func (*ResponseMetaHeader) Descriptor() ([]byte, []int) { + return file_v2_session_grpc_types_proto_rawDescGZIP(), []int{4} +} -func (m *ResponseMetaHeader) GetVersion() *grpc.Version { - if m != nil { - return m.Version +func (x *ResponseMetaHeader) GetVersion() *grpc.Version { + if x != nil { + return x.Version } return nil } -func (m *ResponseMetaHeader) GetEpoch() uint64 { - if m != nil { - return m.Epoch +func (x *ResponseMetaHeader) GetEpoch() uint64 { + if x != nil { + return x.Epoch } return 0 } -func (m *ResponseMetaHeader) GetTtl() uint32 { - if m != nil { - return m.Ttl +func (x *ResponseMetaHeader) GetTtl() uint32 { + if x != nil { + return x.Ttl } return 0 } -func (m *ResponseMetaHeader) GetXHeaders() []*XHeader { - if m != nil { - return m.XHeaders +func (x *ResponseMetaHeader) GetXHeaders() []*XHeader { + if x != nil { + return x.XHeaders } return nil } -func (m *ResponseMetaHeader) GetOrigin() *ResponseMetaHeader { - if m != nil { - return m.Origin +func (x *ResponseMetaHeader) GetOrigin() *ResponseMetaHeader { + if x != nil { + return x.Origin } return nil } // Verification info for request signed by all intermediate nodes. type RequestVerificationHeader struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // Request Body signature. Should be generated once by request initiator. BodySignature *grpc.Signature `protobuf:"bytes,1,opt,name=body_signature,json=bodySignature,proto3" json:"body_signature,omitempty"` // Request Meta signature is added and signed by each intermediate node @@ -631,75 +478,75 @@ type RequestVerificationHeader struct { // Signature of previous hops OriginSignature *grpc.Signature `protobuf:"bytes,3,opt,name=origin_signature,json=originSignature,proto3" json:"origin_signature,omitempty"` // Chain of previous hops signatures - Origin *RequestVerificationHeader `protobuf:"bytes,4,opt,name=origin,proto3" json:"origin,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Origin *RequestVerificationHeader `protobuf:"bytes,4,opt,name=origin,proto3" json:"origin,omitempty"` } -func (m *RequestVerificationHeader) Reset() { *m = RequestVerificationHeader{} } -func (m *RequestVerificationHeader) String() string { return proto.CompactTextString(m) } -func (*RequestVerificationHeader) ProtoMessage() {} -func (*RequestVerificationHeader) Descriptor() ([]byte, []int) { - return fileDescriptor_6bbc551f310b2b05, []int{5} +func (x *RequestVerificationHeader) Reset() { + *x = RequestVerificationHeader{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_session_grpc_types_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *RequestVerificationHeader) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) + +func (x *RequestVerificationHeader) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *RequestVerificationHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_RequestVerificationHeader.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err + +func (*RequestVerificationHeader) ProtoMessage() {} + +func (x *RequestVerificationHeader) ProtoReflect() protoreflect.Message { + mi := &file_v2_session_grpc_types_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) } - return b[:n], nil + return ms } -} -func (m *RequestVerificationHeader) XXX_Merge(src proto.Message) { - xxx_messageInfo_RequestVerificationHeader.Merge(m, src) -} -func (m *RequestVerificationHeader) XXX_Size() int { - return m.Size() -} -func (m *RequestVerificationHeader) XXX_DiscardUnknown() { - xxx_messageInfo_RequestVerificationHeader.DiscardUnknown(m) + return mi.MessageOf(x) } -var xxx_messageInfo_RequestVerificationHeader proto.InternalMessageInfo +// Deprecated: Use RequestVerificationHeader.ProtoReflect.Descriptor instead. +func (*RequestVerificationHeader) Descriptor() ([]byte, []int) { + return file_v2_session_grpc_types_proto_rawDescGZIP(), []int{5} +} -func (m *RequestVerificationHeader) GetBodySignature() *grpc.Signature { - if m != nil { - return m.BodySignature +func (x *RequestVerificationHeader) GetBodySignature() *grpc.Signature { + if x != nil { + return x.BodySignature } return nil } -func (m *RequestVerificationHeader) GetMetaSignature() *grpc.Signature { - if m != nil { - return m.MetaSignature +func (x *RequestVerificationHeader) GetMetaSignature() *grpc.Signature { + if x != nil { + return x.MetaSignature } return nil } -func (m *RequestVerificationHeader) GetOriginSignature() *grpc.Signature { - if m != nil { - return m.OriginSignature +func (x *RequestVerificationHeader) GetOriginSignature() *grpc.Signature { + if x != nil { + return x.OriginSignature } return nil } -func (m *RequestVerificationHeader) GetOrigin() *RequestVerificationHeader { - if m != nil { - return m.Origin +func (x *RequestVerificationHeader) GetOrigin() *RequestVerificationHeader { + if x != nil { + return x.Origin } return nil } // Verification info for response signed by all intermediate nodes type ResponseVerificationHeader struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // Response Body signature. Should be generated once by answering node. BodySignature *grpc.Signature `protobuf:"bytes,1,opt,name=body_signature,json=bodySignature,proto3" json:"body_signature,omitempty"` // Response Meta signature is added and signed by each intermediate node @@ -707,2648 +554,580 @@ type ResponseVerificationHeader struct { // Signature of previous hops OriginSignature *grpc.Signature `protobuf:"bytes,3,opt,name=origin_signature,json=originSignature,proto3" json:"origin_signature,omitempty"` // Chain of previous hops signatures - Origin *ResponseVerificationHeader `protobuf:"bytes,4,opt,name=origin,proto3" json:"origin,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Origin *ResponseVerificationHeader `protobuf:"bytes,4,opt,name=origin,proto3" json:"origin,omitempty"` } -func (m *ResponseVerificationHeader) Reset() { *m = ResponseVerificationHeader{} } -func (m *ResponseVerificationHeader) String() string { return proto.CompactTextString(m) } -func (*ResponseVerificationHeader) ProtoMessage() {} +func (x *ResponseVerificationHeader) Reset() { + *x = ResponseVerificationHeader{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_session_grpc_types_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ResponseVerificationHeader) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ResponseVerificationHeader) ProtoMessage() {} + +func (x *ResponseVerificationHeader) ProtoReflect() protoreflect.Message { + mi := &file_v2_session_grpc_types_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ResponseVerificationHeader.ProtoReflect.Descriptor instead. func (*ResponseVerificationHeader) Descriptor() ([]byte, []int) { - return fileDescriptor_6bbc551f310b2b05, []int{6} + return file_v2_session_grpc_types_proto_rawDescGZIP(), []int{6} } -func (m *ResponseVerificationHeader) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) + +func (x *ResponseVerificationHeader) GetBodySignature() *grpc.Signature { + if x != nil { + return x.BodySignature + } + return nil } -func (m *ResponseVerificationHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ResponseVerificationHeader.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil + +func (x *ResponseVerificationHeader) GetMetaSignature() *grpc.Signature { + if x != nil { + return x.MetaSignature + } + return nil +} + +func (x *ResponseVerificationHeader) GetOriginSignature() *grpc.Signature { + if x != nil { + return x.OriginSignature + } + return nil +} + +func (x *ResponseVerificationHeader) GetOrigin() *ResponseVerificationHeader { + if x != nil { + return x.Origin + } + return nil +} + +// Session Token body +type SessionToken_Body struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Token identifier is a valid UUIDv4 in binary form + Id []byte `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + // Identifier of the session initiator + OwnerId *grpc.OwnerID `protobuf:"bytes,2,opt,name=owner_id,json=ownerID,proto3" json:"owner_id,omitempty"` + // Lifetime of the session + Lifetime *SessionToken_Body_TokenLifetime `protobuf:"bytes,3,opt,name=lifetime,proto3" json:"lifetime,omitempty"` + // Public key used in session + SessionKey []byte `protobuf:"bytes,4,opt,name=session_key,json=sessionKey,proto3" json:"session_key,omitempty"` + // Session Context information + // + // Types that are assignable to Context: + // *SessionToken_Body_Object + Context isSessionToken_Body_Context `protobuf_oneof:"context"` +} + +func (x *SessionToken_Body) Reset() { + *x = SessionToken_Body{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_session_grpc_types_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } } -func (m *ResponseVerificationHeader) XXX_Merge(src proto.Message) { - xxx_messageInfo_ResponseVerificationHeader.Merge(m, src) -} -func (m *ResponseVerificationHeader) XXX_Size() int { - return m.Size() -} -func (m *ResponseVerificationHeader) XXX_DiscardUnknown() { - xxx_messageInfo_ResponseVerificationHeader.DiscardUnknown(m) + +func (x *SessionToken_Body) String() string { + return protoimpl.X.MessageStringOf(x) } -var xxx_messageInfo_ResponseVerificationHeader proto.InternalMessageInfo +func (*SessionToken_Body) ProtoMessage() {} -func (m *ResponseVerificationHeader) GetBodySignature() *grpc.Signature { +func (x *SessionToken_Body) ProtoReflect() protoreflect.Message { + mi := &file_v2_session_grpc_types_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SessionToken_Body.ProtoReflect.Descriptor instead. +func (*SessionToken_Body) Descriptor() ([]byte, []int) { + return file_v2_session_grpc_types_proto_rawDescGZIP(), []int{1, 0} +} + +func (x *SessionToken_Body) GetId() []byte { + if x != nil { + return x.Id + } + return nil +} + +func (x *SessionToken_Body) GetOwnerId() *grpc.OwnerID { + if x != nil { + return x.OwnerId + } + return nil +} + +func (x *SessionToken_Body) GetLifetime() *SessionToken_Body_TokenLifetime { + if x != nil { + return x.Lifetime + } + return nil +} + +func (x *SessionToken_Body) GetSessionKey() []byte { + if x != nil { + return x.SessionKey + } + return nil +} + +func (m *SessionToken_Body) GetContext() isSessionToken_Body_Context { if m != nil { - return m.BodySignature + return m.Context } return nil } -func (m *ResponseVerificationHeader) GetMetaSignature() *grpc.Signature { - if m != nil { - return m.MetaSignature +func (x *SessionToken_Body) GetObject() *ObjectSessionContext { + if x, ok := x.GetContext().(*SessionToken_Body_Object); ok { + return x.Object } return nil } -func (m *ResponseVerificationHeader) GetOriginSignature() *grpc.Signature { - if m != nil { - return m.OriginSignature - } - return nil +type isSessionToken_Body_Context interface { + isSessionToken_Body_Context() } -func (m *ResponseVerificationHeader) GetOrigin() *ResponseVerificationHeader { - if m != nil { - return m.Origin - } - return nil +type SessionToken_Body_Object struct { + // ObjectService session context + Object *ObjectSessionContext `protobuf:"bytes,5,opt,name=object,proto3,oneof"` } -func init() { - proto.RegisterEnum("neo.fs.v2.session.ObjectSessionContext_Verb", ObjectSessionContext_Verb_name, ObjectSessionContext_Verb_value) - proto.RegisterType((*ObjectSessionContext)(nil), "neo.fs.v2.session.ObjectSessionContext") - proto.RegisterType((*SessionToken)(nil), "neo.fs.v2.session.SessionToken") - proto.RegisterType((*SessionToken_Body)(nil), "neo.fs.v2.session.SessionToken.Body") - proto.RegisterType((*SessionToken_Body_TokenLifetime)(nil), "neo.fs.v2.session.SessionToken.Body.TokenLifetime") - proto.RegisterType((*XHeader)(nil), "neo.fs.v2.session.XHeader") - proto.RegisterType((*RequestMetaHeader)(nil), "neo.fs.v2.session.RequestMetaHeader") - proto.RegisterType((*ResponseMetaHeader)(nil), "neo.fs.v2.session.ResponseMetaHeader") - proto.RegisterType((*RequestVerificationHeader)(nil), "neo.fs.v2.session.RequestVerificationHeader") - proto.RegisterType((*ResponseVerificationHeader)(nil), "neo.fs.v2.session.ResponseVerificationHeader") +func (*SessionToken_Body_Object) isSessionToken_Body_Context() {} + +// Lifetime parameters of the token. Filed names taken from rfc7519. +type SessionToken_Body_TokenLifetime struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Expiration Epoch + Exp uint64 `protobuf:"varint,1,opt,name=exp,proto3" json:"exp,omitempty"` + // Not valid before Epoch + Nbf uint64 `protobuf:"varint,2,opt,name=nbf,proto3" json:"nbf,omitempty"` + // Issued at Epoch + Iat uint64 `protobuf:"varint,3,opt,name=iat,proto3" json:"iat,omitempty"` } -func init() { proto.RegisterFile("v2/session/grpc/types.proto", fileDescriptor_6bbc551f310b2b05) } - -var fileDescriptor_6bbc551f310b2b05 = []byte{ - // 839 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x56, 0xdd, 0x6e, 0x1b, 0x45, - 0x14, 0xce, 0xae, 0x37, 0x76, 0x7c, 0x1c, 0x87, 0xed, 0x28, 0x52, 0x5d, 0x23, 0xa5, 0x91, 0x05, - 0x22, 0x17, 0xcd, 0x5a, 0x59, 0x2e, 0x00, 0x41, 0xa5, 0xda, 0xf1, 0xb6, 0x8e, 0x28, 0x69, 0x34, - 0x4e, 0x23, 0xc4, 0x8d, 0xb5, 0x3f, 0xc7, 0xce, 0xb6, 0xce, 0xce, 0xb2, 0x33, 0x59, 0xe2, 0x37, - 0xe1, 0x19, 0x40, 0xbc, 0x07, 0x97, 0xbd, 0xe0, 0x01, 0x50, 0xb8, 0x40, 0xe2, 0x05, 0xb8, 0x45, - 0x33, 0x3b, 0x76, 0x4c, 0x9c, 0x90, 0x70, 0x87, 0xb8, 0x3b, 0xb3, 0x73, 0xbe, 0x6f, 0xbe, 0xef, - 0x9b, 0xe3, 0x91, 0xe1, 0xfd, 0xdc, 0x6d, 0x73, 0xe4, 0x3c, 0x66, 0x49, 0x7b, 0x9c, 0xa5, 0x61, - 0x5b, 0x4c, 0x53, 0xe4, 0x4e, 0x9a, 0x31, 0xc1, 0xc8, 0x83, 0x04, 0x99, 0x33, 0xe2, 0x4e, 0xee, - 0x3a, 0xba, 0xa7, 0xd9, 0xc8, 0xdd, 0x76, 0x86, 0x23, 0xbe, 0xd4, 0xdc, 0x7c, 0x98, 0xbb, 0x6d, - 0x3f, 0x9c, 0x2c, 0x6d, 0xb4, 0xfe, 0x34, 0x60, 0xf3, 0x55, 0xf0, 0x06, 0x43, 0x31, 0x28, 0x48, - 0xf6, 0x59, 0x22, 0xf0, 0x42, 0x90, 0x67, 0x60, 0xe5, 0x98, 0x05, 0x0d, 0x63, 0xdb, 0xd8, 0xd9, - 0x70, 0x9f, 0x38, 0x4b, 0xa7, 0x39, 0x37, 0xc1, 0x9c, 0x13, 0xcc, 0x02, 0xaa, 0x90, 0x64, 0x0f, - 0x2a, 0x7e, 0x14, 0x65, 0xc8, 0x79, 0xc3, 0xdc, 0x36, 0x76, 0x6a, 0xee, 0xc3, 0x05, 0x12, 0x29, - 0xd3, 0xe9, 0x14, 0xdb, 0x74, 0xd6, 0xd7, 0x7a, 0x03, 0x96, 0x24, 0x20, 0x9b, 0x60, 0x9f, 0x78, - 0xb4, 0x3b, 0x7c, 0x7d, 0x38, 0x38, 0xf2, 0xf6, 0x0f, 0x9e, 0x1f, 0x78, 0x3d, 0x7b, 0x85, 0x54, - 0xa0, 0x74, 0xf4, 0xfa, 0xd8, 0x36, 0x64, 0xf1, 0xc2, 0x3b, 0xb6, 0x4d, 0xb2, 0x06, 0x56, 0xdf, - 0xeb, 0xf4, 0xec, 0x12, 0x01, 0x28, 0x0f, 0xbc, 0x0e, 0xdd, 0xef, 0xdb, 0x96, 0xac, 0x7b, 0xde, - 0x4b, 0xef, 0xd8, 0xb3, 0x57, 0x49, 0x15, 0x56, 0x69, 0xe7, 0xf0, 0x85, 0x67, 0x97, 0x49, 0x1d, - 0xaa, 0xaa, 0xec, 0x77, 0x06, 0x7d, 0xbb, 0xd2, 0xfa, 0xa5, 0x04, 0xeb, 0x5a, 0xfc, 0x31, 0x7b, - 0x8b, 0x09, 0xf9, 0x14, 0xac, 0x80, 0x45, 0x53, 0xe5, 0xb8, 0xe6, 0x7e, 0x70, 0x83, 0xe3, 0xc5, - 0x76, 0xa7, 0xcb, 0xa2, 0x29, 0x55, 0x08, 0xf2, 0x09, 0x54, 0x79, 0x3c, 0x4e, 0x7c, 0x71, 0x9e, - 0xa1, 0xf6, 0xfa, 0xe8, 0xba, 0xd7, 0xc1, 0xac, 0x81, 0x5e, 0xf5, 0x36, 0xdf, 0x99, 0x60, 0x49, - 0x1e, 0xb2, 0x01, 0x66, 0x1c, 0xa9, 0x93, 0xd7, 0xa9, 0x19, 0x47, 0xc4, 0x85, 0x35, 0xf6, 0x5d, - 0x82, 0xd9, 0x30, 0x8e, 0x6e, 0x0b, 0xef, 0x95, 0xdc, 0x3f, 0xe8, 0xd1, 0x0a, 0x2b, 0x0a, 0x72, - 0x08, 0x6b, 0x93, 0x78, 0x84, 0x22, 0x3e, 0xc3, 0x46, 0x49, 0x61, 0xdc, 0xfb, 0x78, 0x70, 0x54, - 0xf9, 0x52, 0x23, 0xe9, 0x9c, 0x83, 0x3c, 0x86, 0x9a, 0x06, 0x0d, 0xdf, 0xe2, 0xb4, 0x61, 0x29, - 0x71, 0xa0, 0x3f, 0x7d, 0x89, 0x53, 0xd2, 0x81, 0x32, 0x53, 0x33, 0xd0, 0x58, 0x55, 0xc7, 0x7d, - 0x74, 0xcf, 0x21, 0xe9, 0xaf, 0x50, 0x0d, 0x6c, 0x7a, 0x50, 0xff, 0xdb, 0xf1, 0xc4, 0x86, 0x12, - 0x5e, 0xa4, 0x2a, 0x09, 0x8b, 0xca, 0x52, 0x7e, 0x49, 0x82, 0x91, 0x4a, 0xc1, 0xa2, 0xb2, 0x94, - 0x5f, 0x62, 0x5f, 0x28, 0x8f, 0x16, 0x95, 0x65, 0xb7, 0x0a, 0x95, 0xb0, 0xe0, 0x6e, 0xed, 0x41, - 0xe5, 0xeb, 0x3e, 0xfa, 0x11, 0x66, 0xb2, 0x4f, 0x0a, 0x97, 0x5c, 0x55, 0x2a, 0x4b, 0xb2, 0x09, - 0xab, 0xb9, 0x3f, 0x39, 0x2f, 0x2e, 0xa9, 0x4a, 0x8b, 0x45, 0xeb, 0x0f, 0x13, 0x1e, 0x50, 0xfc, - 0xf6, 0x1c, 0xb9, 0xf8, 0x0a, 0x85, 0xaf, 0xd1, 0x7b, 0x50, 0xc9, 0x31, 0x93, 0xb2, 0xf5, 0x44, - 0x2c, 0xdd, 0xc0, 0x49, 0xb1, 0x4d, 0x67, 0x7d, 0x92, 0x1e, 0x53, 0x16, 0x9e, 0x6a, 0xb1, 0xc5, - 0x42, 0xca, 0x10, 0x62, 0xa2, 0xe4, 0xd6, 0xa9, 0x2c, 0xe5, 0xbc, 0x5c, 0x0c, 0x4f, 0xd5, 0x31, - 0xbc, 0x61, 0x6d, 0x97, 0x76, 0x6a, 0x6e, 0xf3, 0x86, 0xec, 0xb4, 0x0f, 0xba, 0x76, 0x51, 0x14, - 0x9c, 0xf4, 0xa0, 0x3e, 0xbb, 0x12, 0x21, 0x63, 0xd3, 0xc1, 0x3f, 0xbe, 0xe3, 0x9e, 0xe9, 0x3a, - 0x5f, 0x1c, 0xf4, 0xa7, 0xb0, 0x1e, 0xa0, 0x9f, 0x61, 0xa6, 0x49, 0xca, 0x8a, 0x64, 0x51, 0x81, - 0x1f, 0x4e, 0x9c, 0xae, 0x6a, 0x29, 0xf0, 0xb5, 0xe0, 0x6a, 0x41, 0xbe, 0x80, 0x32, 0xcb, 0xe2, - 0x71, 0x9c, 0x34, 0x2a, 0xb7, 0xfe, 0x52, 0x96, 0xe2, 0xa4, 0x1a, 0xd3, 0xfa, 0xdd, 0x00, 0x42, - 0x91, 0xa7, 0x2c, 0xe1, 0xf8, 0x1f, 0x4f, 0xfb, 0xe9, 0xdc, 0x68, 0x11, 0xf3, 0x87, 0x37, 0x1a, - 0xbd, 0x6e, 0x65, 0xee, 0xf4, 0x47, 0x13, 0x1e, 0xe9, 0x1c, 0x4e, 0x30, 0x8b, 0x47, 0x71, 0xe8, - 0x8b, 0x98, 0x25, 0xda, 0xf0, 0x33, 0xd8, 0x90, 0x6f, 0xc7, 0xf0, 0xea, 0xe1, 0x30, 0xee, 0x7a, - 0x38, 0xea, 0x12, 0x30, 0x5f, 0x4a, 0x86, 0x33, 0x14, 0xfe, 0xf0, 0x5f, 0x3c, 0x3d, 0x75, 0x09, - 0xb8, 0x62, 0xe8, 0x81, 0x5d, 0x68, 0x5d, 0xe0, 0x28, 0xdd, 0xc5, 0xf1, 0x5e, 0x01, 0x59, 0x64, - 0x99, 0xc5, 0x64, 0x29, 0xec, 0x93, 0xdb, 0xe7, 0x61, 0x39, 0x87, 0x79, 0x5a, 0x3f, 0x99, 0xd0, - 0x9c, 0x85, 0xf9, 0xbf, 0x8e, 0xcb, 0xbb, 0x16, 0xd7, 0xee, 0x3f, 0x4c, 0xd5, 0xed, 0x79, 0x75, - 0x83, 0x9f, 0x2f, 0xb7, 0x8c, 0x77, 0x97, 0x5b, 0xc6, 0xaf, 0x97, 0x5b, 0xc6, 0xf7, 0xbf, 0x6d, - 0xad, 0x7c, 0xf3, 0xd9, 0x38, 0x16, 0xa7, 0xe7, 0x81, 0x13, 0xb2, 0xb3, 0x76, 0xc2, 0xd3, 0x30, - 0xdc, 0x8d, 0x30, 0x6f, 0x27, 0xc8, 0x46, 0x7c, 0xd7, 0x4f, 0xe3, 0xdd, 0x31, 0x6b, 0x5f, 0xfb, - 0x3f, 0xf1, 0xb9, 0x5e, 0xfc, 0x60, 0x6e, 0x1e, 0x22, 0x7b, 0x3e, 0x70, 0x3a, 0x47, 0x07, 0x52, - 0x86, 0x7e, 0x3b, 0x82, 0xb2, 0xfa, 0x8f, 0xf0, 0xf1, 0x5f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x18, - 0x2f, 0x25, 0xb1, 0x88, 0x08, 0x00, 0x00, +func (x *SessionToken_Body_TokenLifetime) Reset() { + *x = SessionToken_Body_TokenLifetime{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_session_grpc_types_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *ObjectSessionContext) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil +func (x *SessionToken_Body_TokenLifetime) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *ObjectSessionContext) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func (*SessionToken_Body_TokenLifetime) ProtoMessage() {} + +func (x *SessionToken_Body_TokenLifetime) ProtoReflect() protoreflect.Message { + mi := &file_v2_session_grpc_types_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -func (m *ObjectSessionContext) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.Address != nil { - { - size, err := m.Address.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.Verb != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.Verb)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil +// Deprecated: Use SessionToken_Body_TokenLifetime.ProtoReflect.Descriptor instead. +func (*SessionToken_Body_TokenLifetime) Descriptor() ([]byte, []int) { + return file_v2_session_grpc_types_proto_rawDescGZIP(), []int{1, 0, 0} } -func (m *SessionToken) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err +func (x *SessionToken_Body_TokenLifetime) GetExp() uint64 { + if x != nil { + return x.Exp } - return dAtA[:n], nil + return 0 } -func (m *SessionToken) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func (x *SessionToken_Body_TokenLifetime) GetNbf() uint64 { + if x != nil { + return x.Nbf + } + return 0 } -func (m *SessionToken) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) +func (x *SessionToken_Body_TokenLifetime) GetIat() uint64 { + if x != nil { + return x.Iat } - if m.Signature != nil { - { - size, err := m.Signature.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.Body != nil { - { - size, err := m.Body.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil + return 0 } -func (m *SessionToken_Body) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} +var File_v2_session_grpc_types_proto protoreflect.FileDescriptor -func (m *SessionToken_Body) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *SessionToken_Body) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.Context != nil { - { - size := m.Context.Size() - i -= size - if _, err := m.Context.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - } - } - if len(m.SessionKey) > 0 { - i -= len(m.SessionKey) - copy(dAtA[i:], m.SessionKey) - i = encodeVarintTypes(dAtA, i, uint64(len(m.SessionKey))) - i-- - dAtA[i] = 0x22 - } - if m.Lifetime != nil { - { - size, err := m.Lifetime.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if m.OwnerId != nil { - { - size, err := m.OwnerId.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if len(m.Id) > 0 { - i -= len(m.Id) - copy(dAtA[i:], m.Id) - i = encodeVarintTypes(dAtA, i, uint64(len(m.Id))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *SessionToken_Body_Object) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *SessionToken_Body_Object) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.Object != nil { - { - size, err := m.Object.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2a - } - return len(dAtA) - i, nil -} -func (m *SessionToken_Body_TokenLifetime) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *SessionToken_Body_TokenLifetime) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *SessionToken_Body_TokenLifetime) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.Iat != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.Iat)) - i-- - dAtA[i] = 0x18 - } - if m.Nbf != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.Nbf)) - i-- - dAtA[i] = 0x10 - } - if m.Exp != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.Exp)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *XHeader) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *XHeader) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *XHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.Value) > 0 { - i -= len(m.Value) - copy(dAtA[i:], m.Value) - i = encodeVarintTypes(dAtA, i, uint64(len(m.Value))) - i-- - dAtA[i] = 0x12 - } - if len(m.Key) > 0 { - i -= len(m.Key) - copy(dAtA[i:], m.Key) - i = encodeVarintTypes(dAtA, i, uint64(len(m.Key))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *RequestMetaHeader) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *RequestMetaHeader) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *RequestMetaHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.Origin != nil { - { - size, err := m.Origin.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x3a - } - if m.BearerToken != nil { - { - size, err := m.BearerToken.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x32 - } - if m.SessionToken != nil { - { - size, err := m.SessionToken.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2a - } - if len(m.XHeaders) > 0 { - for iNdEx := len(m.XHeaders) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.XHeaders[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } - } - if m.Ttl != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.Ttl)) - i-- - dAtA[i] = 0x18 - } - if m.Epoch != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.Epoch)) - i-- - dAtA[i] = 0x10 - } - if m.Version != nil { - { - size, err := m.Version.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *ResponseMetaHeader) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ResponseMetaHeader) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ResponseMetaHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.Origin != nil { - { - size, err := m.Origin.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2a - } - if len(m.XHeaders) > 0 { - for iNdEx := len(m.XHeaders) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.XHeaders[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } - } - if m.Ttl != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.Ttl)) - i-- - dAtA[i] = 0x18 - } - if m.Epoch != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.Epoch)) - i-- - dAtA[i] = 0x10 - } - if m.Version != nil { - { - size, err := m.Version.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *RequestVerificationHeader) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *RequestVerificationHeader) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *RequestVerificationHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.Origin != nil { - { - size, err := m.Origin.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } - if m.OriginSignature != nil { - { - size, err := m.OriginSignature.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if m.MetaSignature != nil { - { - size, err := m.MetaSignature.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.BodySignature != nil { - { - size, err := m.BodySignature.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *ResponseVerificationHeader) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ResponseVerificationHeader) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ResponseVerificationHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.Origin != nil { - { - size, err := m.Origin.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } - if m.OriginSignature != nil { - { - size, err := m.OriginSignature.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if m.MetaSignature != nil { - { - size, err := m.MetaSignature.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.BodySignature != nil { - { - size, err := m.BodySignature.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func encodeVarintTypes(dAtA []byte, offset int, v uint64) int { - offset -= sovTypes(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *ObjectSessionContext) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Verb != 0 { - n += 1 + sovTypes(uint64(m.Verb)) - } - if m.Address != nil { - l = m.Address.Size() - n += 1 + l + sovTypes(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *SessionToken) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Body != nil { - l = m.Body.Size() - n += 1 + l + sovTypes(uint64(l)) - } - if m.Signature != nil { - l = m.Signature.Size() - n += 1 + l + sovTypes(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *SessionToken_Body) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Id) - if l > 0 { - n += 1 + l + sovTypes(uint64(l)) - } - if m.OwnerId != nil { - l = m.OwnerId.Size() - n += 1 + l + sovTypes(uint64(l)) - } - if m.Lifetime != nil { - l = m.Lifetime.Size() - n += 1 + l + sovTypes(uint64(l)) - } - l = len(m.SessionKey) - if l > 0 { - n += 1 + l + sovTypes(uint64(l)) - } - if m.Context != nil { - n += m.Context.Size() - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *SessionToken_Body_Object) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Object != nil { - l = m.Object.Size() - n += 1 + l + sovTypes(uint64(l)) - } - return n -} -func (m *SessionToken_Body_TokenLifetime) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Exp != 0 { - n += 1 + sovTypes(uint64(m.Exp)) - } - if m.Nbf != 0 { - n += 1 + sovTypes(uint64(m.Nbf)) - } - if m.Iat != 0 { - n += 1 + sovTypes(uint64(m.Iat)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *XHeader) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Key) - if l > 0 { - n += 1 + l + sovTypes(uint64(l)) - } - l = len(m.Value) - if l > 0 { - n += 1 + l + sovTypes(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *RequestMetaHeader) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Version != nil { - l = m.Version.Size() - n += 1 + l + sovTypes(uint64(l)) - } - if m.Epoch != 0 { - n += 1 + sovTypes(uint64(m.Epoch)) - } - if m.Ttl != 0 { - n += 1 + sovTypes(uint64(m.Ttl)) - } - if len(m.XHeaders) > 0 { - for _, e := range m.XHeaders { - l = e.Size() - n += 1 + l + sovTypes(uint64(l)) - } - } - if m.SessionToken != nil { - l = m.SessionToken.Size() - n += 1 + l + sovTypes(uint64(l)) - } - if m.BearerToken != nil { - l = m.BearerToken.Size() - n += 1 + l + sovTypes(uint64(l)) - } - if m.Origin != nil { - l = m.Origin.Size() - n += 1 + l + sovTypes(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *ResponseMetaHeader) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Version != nil { - l = m.Version.Size() - n += 1 + l + sovTypes(uint64(l)) - } - if m.Epoch != 0 { - n += 1 + sovTypes(uint64(m.Epoch)) - } - if m.Ttl != 0 { - n += 1 + sovTypes(uint64(m.Ttl)) - } - if len(m.XHeaders) > 0 { - for _, e := range m.XHeaders { - l = e.Size() - n += 1 + l + sovTypes(uint64(l)) - } - } - if m.Origin != nil { - l = m.Origin.Size() - n += 1 + l + sovTypes(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *RequestVerificationHeader) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.BodySignature != nil { - l = m.BodySignature.Size() - n += 1 + l + sovTypes(uint64(l)) - } - if m.MetaSignature != nil { - l = m.MetaSignature.Size() - n += 1 + l + sovTypes(uint64(l)) - } - if m.OriginSignature != nil { - l = m.OriginSignature.Size() - n += 1 + l + sovTypes(uint64(l)) - } - if m.Origin != nil { - l = m.Origin.Size() - n += 1 + l + sovTypes(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *ResponseVerificationHeader) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.BodySignature != nil { - l = m.BodySignature.Size() - n += 1 + l + sovTypes(uint64(l)) - } - if m.MetaSignature != nil { - l = m.MetaSignature.Size() - n += 1 + l + sovTypes(uint64(l)) - } - if m.OriginSignature != nil { - l = m.OriginSignature.Size() - n += 1 + l + sovTypes(uint64(l)) - } - if m.Origin != nil { - l = m.Origin.Size() - n += 1 + l + sovTypes(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func sovTypes(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozTypes(x uint64) (n int) { - return sovTypes(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *ObjectSessionContext) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ObjectSessionContext: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ObjectSessionContext: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Verb", wireType) - } - m.Verb = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Verb |= ObjectSessionContext_Verb(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Address == nil { - m.Address = &grpc.Address{} - } - if err := m.Address.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *SessionToken) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: SessionToken: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: SessionToken: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Body", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Body == nil { - m.Body = &SessionToken_Body{} - } - if err := m.Body.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Signature", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Signature == nil { - m.Signature = &grpc.Signature{} - } - if err := m.Signature.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *SessionToken_Body) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Body: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Body: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Id = append(m.Id[:0], dAtA[iNdEx:postIndex]...) - if m.Id == nil { - m.Id = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OwnerId", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.OwnerId == nil { - m.OwnerId = &grpc.OwnerID{} - } - if err := m.OwnerId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Lifetime", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Lifetime == nil { - m.Lifetime = &SessionToken_Body_TokenLifetime{} - } - if err := m.Lifetime.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SessionKey", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.SessionKey = append(m.SessionKey[:0], dAtA[iNdEx:postIndex]...) - if m.SessionKey == nil { - m.SessionKey = []byte{} - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Object", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := &ObjectSessionContext{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Context = &SessionToken_Body_Object{v} - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *SessionToken_Body_TokenLifetime) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: TokenLifetime: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: TokenLifetime: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Exp", wireType) - } - m.Exp = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Exp |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Nbf", wireType) - } - m.Nbf = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Nbf |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Iat", wireType) - } - m.Iat = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Iat |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *XHeader) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: XHeader: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: XHeader: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Key = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Value = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *RequestMetaHeader) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: RequestMetaHeader: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: RequestMetaHeader: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Version == nil { - m.Version = &grpc.Version{} - } - if err := m.Version.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Epoch", wireType) - } - m.Epoch = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Epoch |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Ttl", wireType) - } - m.Ttl = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Ttl |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field XHeaders", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.XHeaders = append(m.XHeaders, &XHeader{}) - if err := m.XHeaders[len(m.XHeaders)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SessionToken", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.SessionToken == nil { - m.SessionToken = &SessionToken{} - } - if err := m.SessionToken.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BearerToken", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.BearerToken == nil { - m.BearerToken = &grpc1.BearerToken{} - } - if err := m.BearerToken.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Origin", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Origin == nil { - m.Origin = &RequestMetaHeader{} - } - if err := m.Origin.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ResponseMetaHeader) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ResponseMetaHeader: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ResponseMetaHeader: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Version == nil { - m.Version = &grpc.Version{} - } - if err := m.Version.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Epoch", wireType) - } - m.Epoch = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Epoch |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Ttl", wireType) - } - m.Ttl = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Ttl |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field XHeaders", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.XHeaders = append(m.XHeaders, &XHeader{}) - if err := m.XHeaders[len(m.XHeaders)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Origin", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Origin == nil { - m.Origin = &ResponseMetaHeader{} - } - if err := m.Origin.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *RequestVerificationHeader) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: RequestVerificationHeader: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: RequestVerificationHeader: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BodySignature", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.BodySignature == nil { - m.BodySignature = &grpc.Signature{} - } - if err := m.BodySignature.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MetaSignature", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.MetaSignature == nil { - m.MetaSignature = &grpc.Signature{} - } - if err := m.MetaSignature.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OriginSignature", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.OriginSignature == nil { - m.OriginSignature = &grpc.Signature{} - } - if err := m.OriginSignature.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Origin", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Origin == nil { - m.Origin = &RequestVerificationHeader{} - } - if err := m.Origin.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ResponseVerificationHeader) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ResponseVerificationHeader: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ResponseVerificationHeader: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BodySignature", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.BodySignature == nil { - m.BodySignature = &grpc.Signature{} - } - if err := m.BodySignature.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MetaSignature", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.MetaSignature == nil { - m.MetaSignature = &grpc.Signature{} - } - if err := m.MetaSignature.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OriginSignature", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.OriginSignature == nil { - m.OriginSignature = &grpc.Signature{} - } - if err := m.OriginSignature.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Origin", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Origin == nil { - m.Origin = &ResponseVerificationHeader{} - } - if err := m.Origin.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipTypes(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTypes - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTypes - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTypes - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthTypes - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupTypes - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthTypes - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF +var file_v2_session_grpc_types_proto_rawDesc = []byte{ + 0x0a, 0x1b, 0x76, 0x32, 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, 0x12, 0x11, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, + 0x1a, 0x18, 0x76, 0x32, 0x2f, 0x72, 0x65, 0x66, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, + 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x76, 0x32, 0x2f, 0x61, + 0x63, 0x6c, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x22, 0xf7, 0x01, 0x0a, 0x14, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x53, 0x65, + 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x12, 0x40, 0x0a, 0x04, + 0x76, 0x65, 0x72, 0x62, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2c, 0x2e, 0x6e, 0x65, 0x6f, + 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x4f, + 0x62, 0x6a, 0x65, 0x63, 0x74, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x74, + 0x65, 0x78, 0x74, 0x2e, 0x56, 0x65, 0x72, 0x62, 0x52, 0x04, 0x76, 0x65, 0x72, 0x62, 0x12, 0x31, + 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x17, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, + 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, + 0x73, 0x22, 0x6a, 0x0a, 0x04, 0x56, 0x65, 0x72, 0x62, 0x12, 0x14, 0x0a, 0x10, 0x56, 0x45, 0x52, + 0x42, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, + 0x07, 0x0a, 0x03, 0x50, 0x55, 0x54, 0x10, 0x01, 0x12, 0x07, 0x0a, 0x03, 0x47, 0x45, 0x54, 0x10, + 0x02, 0x12, 0x08, 0x0a, 0x04, 0x48, 0x45, 0x41, 0x44, 0x10, 0x03, 0x12, 0x0a, 0x0a, 0x06, 0x53, + 0x45, 0x41, 0x52, 0x43, 0x48, 0x10, 0x04, 0x12, 0x0a, 0x0a, 0x06, 0x44, 0x45, 0x4c, 0x45, 0x54, + 0x45, 0x10, 0x05, 0x12, 0x09, 0x0a, 0x05, 0x52, 0x41, 0x4e, 0x47, 0x45, 0x10, 0x06, 0x12, 0x0d, + 0x0a, 0x09, 0x52, 0x41, 0x4e, 0x47, 0x45, 0x48, 0x41, 0x53, 0x48, 0x10, 0x07, 0x22, 0xd4, 0x03, + 0x0a, 0x0c, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x38, + 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 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, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x42, 0x6f, + 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x37, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, + 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, + 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, + 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, + 0x65, 0x1a, 0xd0, 0x02, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x02, 0x69, 0x64, 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, 0x4e, + 0x0a, 0x08, 0x6c, 0x69, 0x66, 0x65, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x32, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, + 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x6f, 0x6b, 0x65, + 0x6e, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x2e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x4c, 0x69, 0x66, 0x65, + 0x74, 0x69, 0x6d, 0x65, 0x52, 0x08, 0x6c, 0x69, 0x66, 0x65, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x1f, + 0x0a, 0x0b, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x04, 0x20, + 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x4b, 0x65, 0x79, 0x12, + 0x41, 0x0a, 0x06, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x27, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, + 0x69, 0x6f, 0x6e, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, + 0x6e, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x48, 0x00, 0x52, 0x06, 0x6f, 0x62, 0x6a, 0x65, + 0x63, 0x74, 0x1a, 0x45, 0x0a, 0x0d, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x4c, 0x69, 0x66, 0x65, 0x74, + 0x69, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x78, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, + 0x52, 0x03, 0x65, 0x78, 0x70, 0x12, 0x10, 0x0a, 0x03, 0x6e, 0x62, 0x66, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x04, 0x52, 0x03, 0x6e, 0x62, 0x66, 0x12, 0x10, 0x0a, 0x03, 0x69, 0x61, 0x74, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x69, 0x61, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x63, 0x6f, 0x6e, + 0x74, 0x65, 0x78, 0x74, 0x22, 0x31, 0x0a, 0x07, 0x58, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 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, 0x22, 0xea, 0x02, 0x0a, 0x11, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 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, 0x14, 0x0a, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, + 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x12, 0x10, 0x0a, 0x03, 0x74, 0x74, 0x6c, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x0d, 0x52, 0x03, 0x74, 0x74, 0x6c, 0x12, 0x37, 0x0a, 0x09, 0x78, 0x5f, 0x68, 0x65, + 0x61, 0x64, 0x65, 0x72, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6e, 0x65, + 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, + 0x58, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x08, 0x78, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, + 0x73, 0x12, 0x44, 0x0a, 0x0d, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x74, 0x6f, 0x6b, + 0x65, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x65, 0x73, + 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x0c, 0x73, 0x65, 0x73, 0x73, 0x69, + 0x6f, 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x3d, 0x0a, 0x0c, 0x62, 0x65, 0x61, 0x72, 0x65, + 0x72, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, + 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x42, 0x65, + 0x61, 0x72, 0x65, 0x72, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x0b, 0x62, 0x65, 0x61, 0x72, 0x65, + 0x72, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x3c, 0x0a, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, + 0x18, 0x07, 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, 0x06, 0x6f, 0x72, + 0x69, 0x67, 0x69, 0x6e, 0x22, 0xe7, 0x01, 0x0a, 0x12, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x4d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 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, 0x14, + 0x0a, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x65, + 0x70, 0x6f, 0x63, 0x68, 0x12, 0x10, 0x0a, 0x03, 0x74, 0x74, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x0d, 0x52, 0x03, 0x74, 0x74, 0x6c, 0x12, 0x37, 0x0a, 0x09, 0x78, 0x5f, 0x68, 0x65, 0x61, 0x64, + 0x65, 0x72, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, + 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x58, 0x48, + 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x08, 0x78, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x12, + 0x3d, 0x0a, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x18, 0x05, 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, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x22, 0xab, + 0x02, 0x0a, 0x19, 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, 0x12, 0x40, 0x0a, 0x0e, + 0x62, 0x6f, 0x64, 0x79, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, + 0x0d, 0x62, 0x6f, 0x64, 0x79, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x40, + 0x0a, 0x0e, 0x6d, 0x65, 0x74, 0x61, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, + 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, + 0x65, 0x52, 0x0d, 0x6d, 0x65, 0x74, 0x61, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, + 0x12, 0x44, 0x0a, 0x10, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, + 0x74, 0x75, 0x72, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, + 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, + 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x0f, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x53, 0x69, 0x67, + 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x44, 0x0a, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, + 0x18, 0x04, 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, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x22, 0xad, 0x02, 0x0a, + 0x1a, 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, 0x12, 0x40, 0x0a, 0x0e, 0x62, + 0x6f, 0x64, 0x79, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, + 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x0d, + 0x62, 0x6f, 0x64, 0x79, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x40, 0x0a, + 0x0e, 0x6d, 0x65, 0x74, 0x61, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, + 0x52, 0x0d, 0x6d, 0x65, 0x74, 0x61, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, + 0x44, 0x0a, 0x10, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, + 0x75, 0x72, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, + 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, + 0x74, 0x75, 0x72, 0x65, 0x52, 0x0f, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x53, 0x69, 0x67, 0x6e, + 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x45, 0x0a, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x18, + 0x04, 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, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x42, 0x52, 0x5a, 0x39, + 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, + 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, + 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2f, 0x67, 0x72, 0x70, + 0x63, 0x3b, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0xaa, 0x02, 0x14, 0x4e, 0x65, 0x6f, 0x46, + 0x53, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x76, 0x32, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, + 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( - ErrInvalidLengthTypes = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowTypes = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupTypes = fmt.Errorf("proto: unexpected end of group") + file_v2_session_grpc_types_proto_rawDescOnce sync.Once + file_v2_session_grpc_types_proto_rawDescData = file_v2_session_grpc_types_proto_rawDesc ) + +func file_v2_session_grpc_types_proto_rawDescGZIP() []byte { + file_v2_session_grpc_types_proto_rawDescOnce.Do(func() { + file_v2_session_grpc_types_proto_rawDescData = protoimpl.X.CompressGZIP(file_v2_session_grpc_types_proto_rawDescData) + }) + return file_v2_session_grpc_types_proto_rawDescData +} + +var file_v2_session_grpc_types_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_v2_session_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 9) +var file_v2_session_grpc_types_proto_goTypes = []interface{}{ + (ObjectSessionContext_Verb)(0), // 0: neo.fs.v2.session.ObjectSessionContext.Verb + (*ObjectSessionContext)(nil), // 1: neo.fs.v2.session.ObjectSessionContext + (*SessionToken)(nil), // 2: neo.fs.v2.session.SessionToken + (*XHeader)(nil), // 3: neo.fs.v2.session.XHeader + (*RequestMetaHeader)(nil), // 4: neo.fs.v2.session.RequestMetaHeader + (*ResponseMetaHeader)(nil), // 5: neo.fs.v2.session.ResponseMetaHeader + (*RequestVerificationHeader)(nil), // 6: neo.fs.v2.session.RequestVerificationHeader + (*ResponseVerificationHeader)(nil), // 7: neo.fs.v2.session.ResponseVerificationHeader + (*SessionToken_Body)(nil), // 8: neo.fs.v2.session.SessionToken.Body + (*SessionToken_Body_TokenLifetime)(nil), // 9: neo.fs.v2.session.SessionToken.Body.TokenLifetime + (*grpc.Address)(nil), // 10: neo.fs.v2.refs.Address + (*grpc.Signature)(nil), // 11: neo.fs.v2.refs.Signature + (*grpc.Version)(nil), // 12: neo.fs.v2.refs.Version + (*grpc1.BearerToken)(nil), // 13: neo.fs.v2.acl.BearerToken + (*grpc.OwnerID)(nil), // 14: neo.fs.v2.refs.OwnerID +} +var file_v2_session_grpc_types_proto_depIdxs = []int32{ + 0, // 0: neo.fs.v2.session.ObjectSessionContext.verb:type_name -> neo.fs.v2.session.ObjectSessionContext.Verb + 10, // 1: neo.fs.v2.session.ObjectSessionContext.address:type_name -> neo.fs.v2.refs.Address + 8, // 2: neo.fs.v2.session.SessionToken.body:type_name -> neo.fs.v2.session.SessionToken.Body + 11, // 3: neo.fs.v2.session.SessionToken.signature:type_name -> neo.fs.v2.refs.Signature + 12, // 4: neo.fs.v2.session.RequestMetaHeader.version:type_name -> neo.fs.v2.refs.Version + 3, // 5: neo.fs.v2.session.RequestMetaHeader.x_headers:type_name -> neo.fs.v2.session.XHeader + 2, // 6: neo.fs.v2.session.RequestMetaHeader.session_token:type_name -> neo.fs.v2.session.SessionToken + 13, // 7: neo.fs.v2.session.RequestMetaHeader.bearer_token:type_name -> neo.fs.v2.acl.BearerToken + 4, // 8: neo.fs.v2.session.RequestMetaHeader.origin:type_name -> neo.fs.v2.session.RequestMetaHeader + 12, // 9: neo.fs.v2.session.ResponseMetaHeader.version:type_name -> neo.fs.v2.refs.Version + 3, // 10: neo.fs.v2.session.ResponseMetaHeader.x_headers:type_name -> neo.fs.v2.session.XHeader + 5, // 11: neo.fs.v2.session.ResponseMetaHeader.origin:type_name -> neo.fs.v2.session.ResponseMetaHeader + 11, // 12: neo.fs.v2.session.RequestVerificationHeader.body_signature:type_name -> neo.fs.v2.refs.Signature + 11, // 13: neo.fs.v2.session.RequestVerificationHeader.meta_signature:type_name -> neo.fs.v2.refs.Signature + 11, // 14: neo.fs.v2.session.RequestVerificationHeader.origin_signature:type_name -> neo.fs.v2.refs.Signature + 6, // 15: neo.fs.v2.session.RequestVerificationHeader.origin:type_name -> neo.fs.v2.session.RequestVerificationHeader + 11, // 16: neo.fs.v2.session.ResponseVerificationHeader.body_signature:type_name -> neo.fs.v2.refs.Signature + 11, // 17: neo.fs.v2.session.ResponseVerificationHeader.meta_signature:type_name -> neo.fs.v2.refs.Signature + 11, // 18: neo.fs.v2.session.ResponseVerificationHeader.origin_signature:type_name -> neo.fs.v2.refs.Signature + 7, // 19: neo.fs.v2.session.ResponseVerificationHeader.origin:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 14, // 20: neo.fs.v2.session.SessionToken.Body.owner_id:type_name -> neo.fs.v2.refs.OwnerID + 9, // 21: neo.fs.v2.session.SessionToken.Body.lifetime:type_name -> neo.fs.v2.session.SessionToken.Body.TokenLifetime + 1, // 22: neo.fs.v2.session.SessionToken.Body.object:type_name -> neo.fs.v2.session.ObjectSessionContext + 23, // [23:23] is the sub-list for method output_type + 23, // [23:23] is the sub-list for method input_type + 23, // [23:23] is the sub-list for extension type_name + 23, // [23:23] is the sub-list for extension extendee + 0, // [0:23] is the sub-list for field type_name +} + +func init() { file_v2_session_grpc_types_proto_init() } +func file_v2_session_grpc_types_proto_init() { + if File_v2_session_grpc_types_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_v2_session_grpc_types_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ObjectSessionContext); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_session_grpc_types_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SessionToken); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_session_grpc_types_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*XHeader); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_session_grpc_types_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RequestMetaHeader); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_session_grpc_types_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ResponseMetaHeader); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_session_grpc_types_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RequestVerificationHeader); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_session_grpc_types_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ResponseVerificationHeader); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_session_grpc_types_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SessionToken_Body); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_session_grpc_types_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SessionToken_Body_TokenLifetime); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_v2_session_grpc_types_proto_msgTypes[7].OneofWrappers = []interface{}{ + (*SessionToken_Body_Object)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_v2_session_grpc_types_proto_rawDesc, + NumEnums: 1, + NumMessages: 9, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_v2_session_grpc_types_proto_goTypes, + DependencyIndexes: file_v2_session_grpc_types_proto_depIdxs, + EnumInfos: file_v2_session_grpc_types_proto_enumTypes, + MessageInfos: file_v2_session_grpc_types_proto_msgTypes, + }.Build() + File_v2_session_grpc_types_proto = out.File + file_v2_session_grpc_types_proto_rawDesc = nil + file_v2_session_grpc_types_proto_goTypes = nil + file_v2_session_grpc_types_proto_depIdxs = nil +} diff --git a/v2/session/marshal_test.go b/v2/session/marshal_test.go index 0f48735..5164f79 100644 --- a/v2/session/marshal_test.go +++ b/v2/session/marshal_test.go @@ -9,6 +9,7 @@ import ( "github.com/nspcc-dev/neofs-api-go/v2/session" grpc "github.com/nspcc-dev/neofs-api-go/v2/session/grpc" "github.com/stretchr/testify/require" + goproto "google.golang.org/protobuf/proto" ) func TestCreateRequestBody_StableMarshal(t *testing.T) { @@ -19,7 +20,7 @@ func TestCreateRequestBody_StableMarshal(t *testing.T) { wire, err := requestFrom.StableMarshal(nil) require.NoError(t, err) - err = transport.Unmarshal(wire) + err = goproto.Unmarshal(wire, transport) require.NoError(t, err) requestTo := session.CreateRequestBodyFromGRPCMessage(transport) @@ -35,7 +36,7 @@ func TestCreateResponseBody_StableMarshal(t *testing.T) { wire, err := responseFrom.StableMarshal(nil) require.NoError(t, err) - err = transport.Unmarshal(wire) + err = goproto.Unmarshal(wire, transport) require.NoError(t, err) responseTo := session.CreateResponseBodyFromGRPCMessage(transport) @@ -51,7 +52,7 @@ func TestXHeader_StableMarshal(t *testing.T) { wire, err := xheaderFrom.StableMarshal(nil) require.NoError(t, err) - err = transport.Unmarshal(wire) + err = goproto.Unmarshal(wire, transport) require.NoError(t, err) xheaderTo := session.XHeaderFromGRPCMessage(transport) @@ -67,7 +68,7 @@ func TestTokenLifetime_StableMarshal(t *testing.T) { wire, err := lifetimeFrom.StableMarshal(nil) require.NoError(t, err) - err = transport.Unmarshal(wire) + err = goproto.Unmarshal(wire, transport) require.NoError(t, err) lifetimeTo := session.TokenLifetimeFromGRPCMessage(transport) @@ -83,7 +84,7 @@ func TestObjectSessionContext_StableMarshal(t *testing.T) { wire, err := objectCtxFrom.StableMarshal(nil) require.NoError(t, err) - err = transport.Unmarshal(wire) + err = goproto.Unmarshal(wire, transport) require.NoError(t, err) objectCtxTo := session.ObjectSessionContextFromGRPCMessage(transport) @@ -99,7 +100,7 @@ func TestSessionTokenBody_StableMarshal(t *testing.T) { wire, err := sessionTokenBodyFrom.StableMarshal(nil) require.NoError(t, err) - err = transport.Unmarshal(wire) + err = goproto.Unmarshal(wire, transport) require.NoError(t, err) sessionTokenBodyTo := session.SessionTokenBodyFromGRPCMessage(transport) @@ -115,7 +116,7 @@ func TestSessionToken_StableMarshal(t *testing.T) { wire, err := sessionTokenFrom.StableMarshal(nil) require.NoError(t, err) - err = transport.Unmarshal(wire) + err = goproto.Unmarshal(wire, transport) require.NoError(t, err) sessionTokenTo := session.SessionTokenFromGRPCMessage(transport) @@ -133,7 +134,7 @@ func TestRequestMetaHeader_StableMarshal(t *testing.T) { wire, err := metaHeaderFrom.StableMarshal(nil) require.NoError(t, err) - err = transport.Unmarshal(wire) + err = goproto.Unmarshal(wire, transport) require.NoError(t, err) metaHeaderTo := session.RequestMetaHeaderFromGRPCMessage(transport) @@ -151,7 +152,7 @@ func TestRequestVerificationHeader_StableMarshal(t *testing.T) { wire, err := verifHeaderFrom.StableMarshal(nil) require.NoError(t, err) - err = transport.Unmarshal(wire) + err = goproto.Unmarshal(wire, transport) require.NoError(t, err) verifHeaderTo := session.RequestVerificationHeaderFromGRPCMessage(transport) @@ -169,7 +170,7 @@ func TestResponseMetaHeader_StableMarshal(t *testing.T) { wire, err := metaHeaderFrom.StableMarshal(nil) require.NoError(t, err) - err = transport.Unmarshal(wire) + err = goproto.Unmarshal(wire, transport) require.NoError(t, err) metaHeaderTo := session.ResponseMetaHeaderFromGRPCMessage(transport) @@ -187,7 +188,7 @@ func TestResponseVerificationHeader_StableMarshal(t *testing.T) { wire, err := verifHeaderFrom.StableMarshal(nil) require.NoError(t, err) - err = transport.Unmarshal(wire) + err = goproto.Unmarshal(wire, transport) require.NoError(t, err) verifHeaderTo := session.ResponseVerificationHeaderFromGRPCMessage(transport) diff --git a/v2/storagegroup/grpc/types.pb.go b/v2/storagegroup/grpc/types.pb.go index 59e73e7..96e9d87 100644 --- a/v2/storagegroup/grpc/types.pb.go +++ b/v2/storagegroup/grpc/types.pb.go @@ -1,33 +1,40 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.23.0 +// protoc v3.13.0 // source: v2/storagegroup/grpc/types.proto package storagegroup import ( - fmt "fmt" proto "github.com/golang/protobuf/proto" grpc "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" - io "io" - math "math" - math_bits "math/bits" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +// This is a compile-time assertion that a sufficiently up-to-date version +// of the legacy proto package is being used. +const _ = proto.ProtoPackageIsVersion4 // StorageGroup keeps verification information for Data Audit sessions. Objects // that require payed storage guaranties are gathered in `StorageGroups` with // additional information used for proof of storage. `StorageGroup` only // contains objects from the same container. type StorageGroup struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // Total size of the payloads of objects in the storage group ValidationDataSize uint64 `protobuf:"varint,1,opt,name=validation_data_size,json=validationDataSize,proto3" json:"validation_data_size,omitempty"` // Homomorphic hash from the concatenation of the payloads of the storage @@ -37,454 +44,164 @@ type StorageGroup struct { // Last NeoFS epoch number of the storage group lifetime ExpirationEpoch uint64 `protobuf:"varint,3,opt,name=expiration_epoch,json=expirationEpoch,proto3" json:"expiration_epoch,omitempty"` // Strictly ordered list of storage group member objects - Members []*grpc.ObjectID `protobuf:"bytes,4,rep,name=members,proto3" json:"members,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Members []*grpc.ObjectID `protobuf:"bytes,4,rep,name=members,proto3" json:"members,omitempty"` } -func (m *StorageGroup) Reset() { *m = StorageGroup{} } -func (m *StorageGroup) String() string { return proto.CompactTextString(m) } -func (*StorageGroup) ProtoMessage() {} +func (x *StorageGroup) Reset() { + *x = StorageGroup{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_storagegroup_grpc_types_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *StorageGroup) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StorageGroup) ProtoMessage() {} + +func (x *StorageGroup) ProtoReflect() protoreflect.Message { + mi := &file_v2_storagegroup_grpc_types_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use StorageGroup.ProtoReflect.Descriptor instead. func (*StorageGroup) Descriptor() ([]byte, []int) { - return fileDescriptor_f1685cc94b670845, []int{0} -} -func (m *StorageGroup) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *StorageGroup) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_StorageGroup.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *StorageGroup) XXX_Merge(src proto.Message) { - xxx_messageInfo_StorageGroup.Merge(m, src) -} -func (m *StorageGroup) XXX_Size() int { - return m.Size() -} -func (m *StorageGroup) XXX_DiscardUnknown() { - xxx_messageInfo_StorageGroup.DiscardUnknown(m) + return file_v2_storagegroup_grpc_types_proto_rawDescGZIP(), []int{0} } -var xxx_messageInfo_StorageGroup proto.InternalMessageInfo - -func (m *StorageGroup) GetValidationDataSize() uint64 { - if m != nil { - return m.ValidationDataSize +func (x *StorageGroup) GetValidationDataSize() uint64 { + if x != nil { + return x.ValidationDataSize } return 0 } -func (m *StorageGroup) GetValidationHash() *grpc.Checksum { - if m != nil { - return m.ValidationHash +func (x *StorageGroup) GetValidationHash() *grpc.Checksum { + if x != nil { + return x.ValidationHash } return nil } -func (m *StorageGroup) GetExpirationEpoch() uint64 { - if m != nil { - return m.ExpirationEpoch +func (x *StorageGroup) GetExpirationEpoch() uint64 { + if x != nil { + return x.ExpirationEpoch } return 0 } -func (m *StorageGroup) GetMembers() []*grpc.ObjectID { - if m != nil { - return m.Members +func (x *StorageGroup) GetMembers() []*grpc.ObjectID { + if x != nil { + return x.Members } return nil } -func init() { - proto.RegisterType((*StorageGroup)(nil), "neo.fs.v2.storagegroup.StorageGroup") -} +var File_v2_storagegroup_grpc_types_proto protoreflect.FileDescriptor -func init() { proto.RegisterFile("v2/storagegroup/grpc/types.proto", fileDescriptor_f1685cc94b670845) } - -var fileDescriptor_f1685cc94b670845 = []byte{ - // 306 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x90, 0x3f, 0x4e, 0xc3, 0x30, - 0x18, 0xc5, 0x71, 0x5b, 0x81, 0x14, 0x10, 0x45, 0x11, 0x42, 0x86, 0x21, 0x8a, 0x98, 0xca, 0x50, - 0x1b, 0x85, 0x91, 0xa9, 0xb4, 0xfc, 0xe9, 0x02, 0xa8, 0xdd, 0x58, 0x2a, 0xc7, 0xfd, 0x1a, 0x1b, - 0x48, 0x6c, 0x6c, 0x37, 0x82, 0x9e, 0x84, 0x33, 0x70, 0x12, 0x46, 0x8e, 0x80, 0xc2, 0x45, 0x50, - 0x5a, 0xa1, 0x44, 0xa2, 0xeb, 0xf3, 0xef, 0xf9, 0xf7, 0xe9, 0x79, 0x61, 0x1e, 0x51, 0xeb, 0x94, - 0x61, 0x09, 0x24, 0x46, 0xcd, 0x35, 0x4d, 0x8c, 0xe6, 0xd4, 0xbd, 0x69, 0xb0, 0x44, 0x1b, 0xe5, - 0x94, 0x7f, 0x90, 0x81, 0x22, 0x33, 0x4b, 0xf2, 0x88, 0xd4, 0xc1, 0x23, 0x9c, 0x47, 0xd4, 0xc0, - 0xcc, 0xfe, 0x6b, 0x1c, 0x17, 0xc8, 0xdb, 0x19, 0xaf, 0xd0, 0xeb, 0x12, 0xf5, 0x4f, 0xbd, 0xfd, - 0x9c, 0x3d, 0xcb, 0x29, 0x73, 0x52, 0x65, 0x93, 0x29, 0x73, 0x6c, 0x62, 0xe5, 0x02, 0x30, 0x0a, - 0x51, 0xa7, 0x35, 0xf2, 0xab, 0xb7, 0x01, 0x73, 0x6c, 0x2c, 0x17, 0xe0, 0xf7, 0xbc, 0x76, 0xad, - 0x21, 0x98, 0x15, 0xb8, 0x11, 0xa2, 0xce, 0x76, 0x84, 0x49, 0x75, 0x4e, 0x69, 0x27, 0x7d, 0x01, - 0xfc, 0xc9, 0xce, 0xd3, 0xd1, 0x6e, 0x55, 0xb8, 0x61, 0x56, 0xf8, 0x27, 0xde, 0x1e, 0xbc, 0x6a, - 0x69, 0x56, 0x5f, 0x80, 0x56, 0x5c, 0xe0, 0xe6, 0x52, 0xd8, 0xae, 0xf2, 0xcb, 0x32, 0xf6, 0x23, - 0x6f, 0x2b, 0x85, 0x34, 0x06, 0x63, 0x71, 0x2b, 0x6c, 0xae, 0xb3, 0xdc, 0xc5, 0x8f, 0xc0, 0xdd, - 0x70, 0x30, 0xfa, 0x03, 0x2f, 0x5e, 0x3e, 0x8b, 0x00, 0x7d, 0x15, 0x01, 0xfa, 0x2e, 0x02, 0xf4, - 0xfe, 0x13, 0x6c, 0x3c, 0xf4, 0x13, 0xe9, 0xc4, 0x3c, 0x26, 0x5c, 0xa5, 0x34, 0xb3, 0x9a, 0xf3, - 0xee, 0x14, 0x72, 0x9a, 0x81, 0x9a, 0xd9, 0x2e, 0xd3, 0xb2, 0x9b, 0x28, 0xba, 0x6e, 0xec, 0xf3, - 0x7a, 0xf2, 0xd1, 0x38, 0xbc, 0x05, 0x75, 0x35, 0x26, 0xbd, 0xfb, 0x61, 0x29, 0xaf, 0xcf, 0x18, - 0x6f, 0x2e, 0xe7, 0x3d, 0xfb, 0x0d, 0x00, 0x00, 0xff, 0xff, 0x31, 0x2e, 0xd2, 0x63, 0xb4, 0x01, - 0x00, 0x00, -} - -func (m *StorageGroup) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *StorageGroup) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *StorageGroup) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.Members) > 0 { - for iNdEx := len(m.Members) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Members[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } - } - if m.ExpirationEpoch != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.ExpirationEpoch)) - i-- - dAtA[i] = 0x18 - } - if m.ValidationHash != nil { - { - size, err := m.ValidationHash.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.ValidationDataSize != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.ValidationDataSize)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func encodeVarintTypes(dAtA []byte, offset int, v uint64) int { - offset -= sovTypes(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *StorageGroup) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ValidationDataSize != 0 { - n += 1 + sovTypes(uint64(m.ValidationDataSize)) - } - if m.ValidationHash != nil { - l = m.ValidationHash.Size() - n += 1 + l + sovTypes(uint64(l)) - } - if m.ExpirationEpoch != 0 { - n += 1 + sovTypes(uint64(m.ExpirationEpoch)) - } - if len(m.Members) > 0 { - for _, e := range m.Members { - l = e.Size() - n += 1 + l + sovTypes(uint64(l)) - } - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func sovTypes(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozTypes(x uint64) (n int) { - return sovTypes(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *StorageGroup) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: StorageGroup: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: StorageGroup: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ValidationDataSize", wireType) - } - m.ValidationDataSize = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ValidationDataSize |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ValidationHash", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.ValidationHash == nil { - m.ValidationHash = &grpc.Checksum{} - } - if err := m.ValidationHash.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ExpirationEpoch", wireType) - } - m.ExpirationEpoch = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ExpirationEpoch |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Members", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Members = append(m.Members, &grpc.ObjectID{}) - if err := m.Members[len(m.Members)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipTypes(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTypes - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTypes - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTypes - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthTypes - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupTypes - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthTypes - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF +var file_v2_storagegroup_grpc_types_proto_rawDesc = []byte{ + 0x0a, 0x20, 0x76, 0x32, 0x2f, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x67, 0x72, 0x6f, 0x75, + 0x70, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x12, 0x16, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x74, + 0x6f, 0x72, 0x61, 0x67, 0x65, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x1a, 0x18, 0x76, 0x32, 0x2f, 0x72, + 0x65, 0x66, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xe2, 0x01, 0x0a, 0x0c, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, + 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x30, 0x0a, 0x14, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x04, 0x52, 0x12, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x44, + 0x61, 0x74, 0x61, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x41, 0x0a, 0x0f, 0x76, 0x61, 0x6c, 0x69, 0x64, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, + 0x73, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x52, 0x0e, 0x76, 0x61, 0x6c, 0x69, + 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x61, 0x73, 0x68, 0x12, 0x29, 0x0a, 0x10, 0x65, 0x78, + 0x70, 0x69, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x04, 0x52, 0x0f, 0x65, 0x78, 0x70, 0x69, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x45, 0x70, 0x6f, 0x63, 0x68, 0x12, 0x32, 0x0a, 0x07, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, + 0x18, 0x04, 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, 0x61, 0x5a, 0x43, 0x67, 0x69, 0x74, + 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, + 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, + 0x32, 0x2f, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x2f, 0x67, + 0x72, 0x70, 0x63, 0x3b, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x67, 0x72, 0x6f, 0x75, 0x70, + 0xaa, 0x02, 0x19, 0x4e, 0x65, 0x6f, 0x46, 0x53, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x76, 0x32, 0x2e, + 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, } var ( - ErrInvalidLengthTypes = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowTypes = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupTypes = fmt.Errorf("proto: unexpected end of group") + file_v2_storagegroup_grpc_types_proto_rawDescOnce sync.Once + file_v2_storagegroup_grpc_types_proto_rawDescData = file_v2_storagegroup_grpc_types_proto_rawDesc ) + +func file_v2_storagegroup_grpc_types_proto_rawDescGZIP() []byte { + file_v2_storagegroup_grpc_types_proto_rawDescOnce.Do(func() { + file_v2_storagegroup_grpc_types_proto_rawDescData = protoimpl.X.CompressGZIP(file_v2_storagegroup_grpc_types_proto_rawDescData) + }) + return file_v2_storagegroup_grpc_types_proto_rawDescData +} + +var file_v2_storagegroup_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_v2_storagegroup_grpc_types_proto_goTypes = []interface{}{ + (*StorageGroup)(nil), // 0: neo.fs.v2.storagegroup.StorageGroup + (*grpc.Checksum)(nil), // 1: neo.fs.v2.refs.Checksum + (*grpc.ObjectID)(nil), // 2: neo.fs.v2.refs.ObjectID +} +var file_v2_storagegroup_grpc_types_proto_depIdxs = []int32{ + 1, // 0: neo.fs.v2.storagegroup.StorageGroup.validation_hash:type_name -> neo.fs.v2.refs.Checksum + 2, // 1: neo.fs.v2.storagegroup.StorageGroup.members:type_name -> neo.fs.v2.refs.ObjectID + 2, // [2:2] is the sub-list for method output_type + 2, // [2:2] is the sub-list for method input_type + 2, // [2:2] is the sub-list for extension type_name + 2, // [2:2] is the sub-list for extension extendee + 0, // [0:2] is the sub-list for field type_name +} + +func init() { file_v2_storagegroup_grpc_types_proto_init() } +func file_v2_storagegroup_grpc_types_proto_init() { + if File_v2_storagegroup_grpc_types_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_v2_storagegroup_grpc_types_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*StorageGroup); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_v2_storagegroup_grpc_types_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_v2_storagegroup_grpc_types_proto_goTypes, + DependencyIndexes: file_v2_storagegroup_grpc_types_proto_depIdxs, + MessageInfos: file_v2_storagegroup_grpc_types_proto_msgTypes, + }.Build() + File_v2_storagegroup_grpc_types_proto = out.File + file_v2_storagegroup_grpc_types_proto_rawDesc = nil + file_v2_storagegroup_grpc_types_proto_goTypes = nil + file_v2_storagegroup_grpc_types_proto_depIdxs = nil +} diff --git a/v2/storagegroup/marshal_test.go b/v2/storagegroup/marshal_test.go index 0b6a191..f3f79b8 100644 --- a/v2/storagegroup/marshal_test.go +++ b/v2/storagegroup/marshal_test.go @@ -7,6 +7,7 @@ import ( "github.com/nspcc-dev/neofs-api-go/v2/storagegroup" grpc "github.com/nspcc-dev/neofs-api-go/v2/storagegroup/grpc" "github.com/stretchr/testify/require" + goproto "google.golang.org/protobuf/proto" ) func TestStorageGroup_StableMarshal(t *testing.T) { @@ -28,7 +29,7 @@ func TestStorageGroup_StableMarshal(t *testing.T) { wire, err := storageGroupFrom.StableMarshal(nil) require.NoError(t, err) - err = transport.Unmarshal(wire) + err = goproto.Unmarshal(wire, transport) require.NoError(t, err) storageGroupTo := storagegroup.StorageGroupFromGRPCMessage(transport) From fd8e691f619d96640b24a8887b115ba793f58d16 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Mon, 19 Oct 2020 22:12:43 +0300 Subject: [PATCH 0476/1196] [#172] util/proto: Resolve protobuf compile warnings Signed-off-by: Alex Vanin --- util/proto/test/test.pb.go | 3 ++- util/proto/test/test.proto | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/util/proto/test/test.pb.go b/util/proto/test/test.pb.go index 63134e7..f581442 100644 --- a/util/proto/test/test.pb.go +++ b/util/proto/test/test.pb.go @@ -299,7 +299,8 @@ var file_util_proto_test_test_proto_rawDesc = []byte{ 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x65, 0x18, 0x05, 0x20, 0x03, 0x28, 0x03, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x45, 0x12, 0x17, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x66, 0x18, 0x06, 0x20, 0x03, 0x28, 0x04, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x46, - 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x42, 0x11, 0x5a, 0x0f, 0x75, 0x74, 0x69, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x74, + 0x65, 0x73, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/util/proto/test/test.proto b/util/proto/test/test.proto index 8170b87..ea6125f 100644 --- a/util/proto/test/test.proto +++ b/util/proto/test/test.proto @@ -2,6 +2,8 @@ syntax = "proto3"; package test; +option go_package = "util/proto/test"; + message Primitives { bytes field_a = 1; string field_b = 2; From e6035a3249010727c275c785d9a7ebd2977d311d Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Mon, 19 Oct 2020 22:09:13 +0300 Subject: [PATCH 0477/1196] [#172] v2: Use protojson package Signed-off-by: Alex Vanin --- v2/acl/json.go | 25 +++++++++++-------------- v2/container/json.go | 11 +++++------ v2/netmap/json.go | 11 +++++------ 3 files changed, 21 insertions(+), 26 deletions(-) diff --git a/v2/acl/json.go b/v2/acl/json.go index 2707793..d2237f8 100644 --- a/v2/acl/json.go +++ b/v2/acl/json.go @@ -1,24 +1,23 @@ package acl import ( - "github.com/golang/protobuf/jsonpb" acl "github.com/nspcc-dev/neofs-api-go/v2/acl/grpc" + "google.golang.org/protobuf/encoding/protojson" ) -func RecordToJSON(r *Record) []byte { +func RecordToJSON(r *Record) (data []byte) { if r == nil { return nil } msg := RecordToGRPCMessage(r) - m := jsonpb.Marshaler{} - s, err := m.MarshalToString(msg) + data, err := protojson.Marshal(msg) if err != nil { return nil } - return []byte(s) + return } func RecordFromJSON(data []byte) *Record { @@ -28,7 +27,7 @@ func RecordFromJSON(data []byte) *Record { msg := new(acl.EACLRecord) - if err := jsonpb.UnmarshalString(string(data), msg); err != nil { + if err := protojson.Unmarshal(data, msg); err != nil { return nil } @@ -41,14 +40,13 @@ func TableToJSON(t *Table) (data []byte) { } msg := TableToGRPCMessage(t) - m := jsonpb.Marshaler{} - s, err := m.MarshalToString(msg) + data, err := protojson.Marshal(msg) if err != nil { return nil } - return []byte(s) + return } func TableFromJSON(data []byte) *Table { @@ -58,7 +56,7 @@ func TableFromJSON(data []byte) *Table { msg := new(acl.EACLTable) - if jsonpb.UnmarshalString(string(data), msg) != nil { + if err := protojson.Unmarshal(data, msg); err != nil { return nil } @@ -71,14 +69,13 @@ func BearerTokenToJSON(t *BearerToken) (data []byte) { } msg := BearerTokenToGRPCMessage(t) - m := jsonpb.Marshaler{} - s, err := m.MarshalToString(msg) + data, err := protojson.Marshal(msg) if err != nil { return nil } - return []byte(s) + return } func BearerTokenFromJSON(data []byte) *BearerToken { @@ -88,7 +85,7 @@ func BearerTokenFromJSON(data []byte) *BearerToken { msg := new(acl.BearerToken) - if jsonpb.UnmarshalString(string(data), msg) != nil { + if err := protojson.Unmarshal(data, msg); err != nil { return nil } diff --git a/v2/container/json.go b/v2/container/json.go index edd7d48..c932fba 100644 --- a/v2/container/json.go +++ b/v2/container/json.go @@ -1,24 +1,23 @@ package container import ( - "github.com/golang/protobuf/jsonpb" container "github.com/nspcc-dev/neofs-api-go/v2/container/grpc" + "google.golang.org/protobuf/encoding/protojson" ) -func ContainerToJSON(c *Container) []byte { +func ContainerToJSON(c *Container) (data []byte) { if c == nil { return nil } msg := ContainerToGRPCMessage(c) - m := jsonpb.Marshaler{} - s, err := m.MarshalToString(msg) + data, err := protojson.Marshal(msg) if err != nil { return nil } - return []byte(s) + return } func ContainerFromJSON(data []byte) *Container { @@ -28,7 +27,7 @@ func ContainerFromJSON(data []byte) *Container { msg := new(container.Container) - if err := jsonpb.UnmarshalString(string(data), msg); err != nil { + if err := protojson.Unmarshal(data, msg); err != nil { return nil } diff --git a/v2/netmap/json.go b/v2/netmap/json.go index 6b840ca..bb1ed99 100644 --- a/v2/netmap/json.go +++ b/v2/netmap/json.go @@ -1,24 +1,23 @@ package netmap import ( - "github.com/golang/protobuf/jsonpb" netmap "github.com/nspcc-dev/neofs-api-go/v2/netmap/grpc" + "google.golang.org/protobuf/encoding/protojson" ) -func NodeInfoToJSON(n *NodeInfo) []byte { +func NodeInfoToJSON(n *NodeInfo) (data []byte) { if n == nil { return nil } msg := NodeInfoToGRPCMessage(n) - m := jsonpb.Marshaler{} - s, err := m.MarshalToString(msg) + data, err := protojson.Marshal(msg) if err != nil { return nil } - return []byte(s) + return } func NodeInfoFromJSON(data []byte) *NodeInfo { @@ -28,7 +27,7 @@ func NodeInfoFromJSON(data []byte) *NodeInfo { msg := new(netmap.NodeInfo) - if err := jsonpb.UnmarshalString(string(data), msg); err != nil { + if err := protojson.Unmarshal(data, msg); err != nil { return nil } From 2aa40b0dd3a5a1d3fc37ce4ab77ffeb9c29477fb Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Tue, 20 Oct 2020 15:17:53 +0300 Subject: [PATCH 0478/1196] [#177] sdk/client: Set version of new EACL table Signed-off-by: Alex Vanin --- pkg/client/container.go | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/client/container.go b/pkg/client/container.go index 5c87a2b..e4eb75a 100644 --- a/pkg/client/container.go +++ b/pkg/client/container.go @@ -369,6 +369,7 @@ func (c Client) setEACLV2(ctx context.Context, eacl *eacl.Table, opts ...CallOpt reqBody := new(v2container.SetExtendedACLRequestBody) reqBody.SetEACL(eacl.ToV2()) + reqBody.GetEACL().SetVersion(c.remoteNode.Version.ToV2()) signWrapper := v2signature.StableMarshalerWrapper{SM: reqBody.GetEACL()} err := signature.SignDataWithHandler(c.key, signWrapper, func(key []byte, sig []byte) { From c8f46f7d976270f9f3e496802c303b98f1a07ff0 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Tue, 20 Oct 2020 17:57:56 +0300 Subject: [PATCH 0479/1196] [#178] v2: Print default values in JSON Signed-off-by: Alex Vanin --- v2/acl/json.go | 6 +++--- v2/container/json.go | 2 +- v2/netmap/json.go | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/v2/acl/json.go b/v2/acl/json.go index d2237f8..bb70fe6 100644 --- a/v2/acl/json.go +++ b/v2/acl/json.go @@ -12,7 +12,7 @@ func RecordToJSON(r *Record) (data []byte) { msg := RecordToGRPCMessage(r) - data, err := protojson.Marshal(msg) + data, err := protojson.MarshalOptions{EmitUnpopulated: true}.Marshal(msg) if err != nil { return nil } @@ -41,7 +41,7 @@ func TableToJSON(t *Table) (data []byte) { msg := TableToGRPCMessage(t) - data, err := protojson.Marshal(msg) + data, err := protojson.MarshalOptions{EmitUnpopulated: true}.Marshal(msg) if err != nil { return nil } @@ -70,7 +70,7 @@ func BearerTokenToJSON(t *BearerToken) (data []byte) { msg := BearerTokenToGRPCMessage(t) - data, err := protojson.Marshal(msg) + data, err := protojson.MarshalOptions{EmitUnpopulated: true}.Marshal(msg) if err != nil { return nil } diff --git a/v2/container/json.go b/v2/container/json.go index c932fba..d425353 100644 --- a/v2/container/json.go +++ b/v2/container/json.go @@ -12,7 +12,7 @@ func ContainerToJSON(c *Container) (data []byte) { msg := ContainerToGRPCMessage(c) - data, err := protojson.Marshal(msg) + data, err := protojson.MarshalOptions{EmitUnpopulated: true}.Marshal(msg) if err != nil { return nil } diff --git a/v2/netmap/json.go b/v2/netmap/json.go index bb1ed99..7fec579 100644 --- a/v2/netmap/json.go +++ b/v2/netmap/json.go @@ -12,7 +12,7 @@ func NodeInfoToJSON(n *NodeInfo) (data []byte) { msg := NodeInfoToGRPCMessage(n) - data, err := protojson.Marshal(msg) + data, err := protojson.MarshalOptions{EmitUnpopulated: true}.Marshal(msg) if err != nil { return nil } From e023b6e51e7ebb2a553e1c1f3a1abacc22d72591 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Wed, 21 Oct 2020 18:10:49 +0300 Subject: [PATCH 0480/1196] [#179] sdk/client: Ease bearer token sanity check Now owner ID field is not required to be set. According to latest neofs-api, this field set if token was issued for specific owner ID. If this field is not set, then any user can use this token while it is correctly signed and has valid lifetime. Lifetime is also can be omitted since node interpret empty lifetime as a lifetime with zero values. Signed-off-by: Alex Vanin --- pkg/token/bearer.go | 4 ---- 1 file changed, 4 deletions(-) diff --git a/pkg/token/bearer.go b/pkg/token/bearer.go index 13e26cb..579d055 100644 --- a/pkg/token/bearer.go +++ b/pkg/token/bearer.go @@ -95,12 +95,8 @@ func sanityCheck(b *BearerToken) error { return errors.New("bearer token is not set") case b.token.GetBody() == nil: return errors.New("bearer token body is not set") - case b.token.GetBody().GetLifetime() == nil: - return errors.New("bearer token lifetime is not set") case b.token.GetBody().GetEACL() == nil: return errors.New("bearer token EACL table is not set") - case b.token.GetBody().GetOwnerID() == nil: - return errors.New("bearer token owner is not set") } // consider checking EACL sanity there, lifetime correctness, etc. From 7b212431df0bab3e3015653be2199738e039a0a3 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Thu, 22 Oct 2020 12:18:07 +0300 Subject: [PATCH 0481/1196] [#179] sdk/token: Add function to return token issuer With new neofs-api changes, token issuer will not be stored in ownerID field of bearer token. We can identify owner by public key that has been used in signature. Signed-off-by: Alex Vanin --- pkg/token/bearer.go | 15 +++++++++++++++ pkg/token/bearer_test.go | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 pkg/token/bearer_test.go diff --git a/pkg/token/bearer.go b/pkg/token/bearer.go index 579d055..87ecbc5 100644 --- a/pkg/token/bearer.go +++ b/pkg/token/bearer.go @@ -10,6 +10,7 @@ import ( "github.com/nspcc-dev/neofs-api-go/v2/acl" "github.com/nspcc-dev/neofs-api-go/v2/refs" v2signature "github.com/nspcc-dev/neofs-api-go/v2/signature" + crypto "github.com/nspcc-dev/neofs-crypto" ) type BearerToken struct { @@ -70,6 +71,20 @@ func (b *BearerToken) SignToken(key *ecdsa.PrivateKey) error { }) } +// Issuer returns owner.ID associated with the key that signed bearer token. +// To pass node validation it should be owner of requested container. Returns +// nil if token is not signed. +func (b *BearerToken) Issuer() *owner.ID { + pubKey := crypto.UnmarshalPublicKey(b.token.GetSignature().GetKey()) + + wallet, err := owner.NEO3WalletFromPublicKey(pubKey) + if err != nil { + return nil + } + + return owner.NewIDFromNeo3Wallet(wallet) +} + func NewBearerToken() *BearerToken { b := new(BearerToken) b.token = acl.BearerToken{} diff --git a/pkg/token/bearer_test.go b/pkg/token/bearer_test.go new file mode 100644 index 0000000..a06510b --- /dev/null +++ b/pkg/token/bearer_test.go @@ -0,0 +1,32 @@ +package token_test + +import ( + "testing" + + "github.com/nspcc-dev/neofs-api-go/pkg/acl/eacl" + "github.com/nspcc-dev/neofs-api-go/pkg/owner" + "github.com/nspcc-dev/neofs-api-go/pkg/token" + "github.com/nspcc-dev/neofs-crypto/test" + "github.com/stretchr/testify/require" +) + +func TestBearerToken_Issuer(t *testing.T) { + bearerToken := token.NewBearerToken() + + t.Run("non signed token", func(t *testing.T) { + require.Nil(t, bearerToken.Issuer()) + }) + + t.Run("signed token", func(t *testing.T) { + key := test.DecodeKey(1) + + wallet, err := owner.NEO3WalletFromPublicKey(&key.PublicKey) + require.NoError(t, err) + + ownerID := owner.NewIDFromNeo3Wallet(wallet) + + bearerToken.SetEACLTable(eacl.NewTable()) + require.NoError(t, bearerToken.SignToken(key)) + require.Equal(t, bearerToken.Issuer().String(), ownerID.String()) + }) +} From 634f7e92e8664140a127368b8c7e826c315ee7e1 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 22 Oct 2020 18:40:55 +0300 Subject: [PATCH 0482/1196] [#172] v2/container: Define well-known system attributes Signed-off-by: Leonard Lyubich --- v2/container/attributes.go | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 v2/container/attributes.go diff --git a/v2/container/attributes.go b/v2/container/attributes.go new file mode 100644 index 0000000..2dc0c92 --- /dev/null +++ b/v2/container/attributes.go @@ -0,0 +1,9 @@ +package container + +// SysAttrPrefix is a prefix of key to system attribute. +const SysAttrPrefix = "__NEOFS__" + +const ( + // SysAttrSubnet is a string ID of container's storage subnet. + SysAttrSubnet = SysAttrPrefix + "SUBNET" +) From 342eeb47a8b5a17271a6336f10123bd528a58df8 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 22 Oct 2020 18:41:08 +0300 Subject: [PATCH 0483/1196] [#172] v2/object: Define well-known system attributes Signed-off-by: Leonard Lyubich --- v2/object/attributes.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 v2/object/attributes.go diff --git a/v2/object/attributes.go b/v2/object/attributes.go new file mode 100644 index 0000000..0da07b8 --- /dev/null +++ b/v2/object/attributes.go @@ -0,0 +1,12 @@ +package object + +// SysAttrPrefix is a prefix of key to system attribute. +const SysAttrPrefix = "__NEOFS__" + +const ( + // SysAttrUploadID marks smaller parts of a split bigger object. + SysAttrUploadID = SysAttrPrefix + "UPLOAD_ID" + + // SysAttrExpEpoch tells GC to delete object after that epoch. + SysAttrExpEpoch = SysAttrPrefix + "EXPIRATION_EPOCH" +) From 4357430e0f0be55caf1bfa3dd62449594a797e55 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 22 Oct 2020 18:41:34 +0300 Subject: [PATCH 0484/1196] [#172] sdk/container: Define well-known application attributes Signed-off-by: Leonard Lyubich --- pkg/container/wellknown_attributes.go | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 pkg/container/wellknown_attributes.go diff --git a/pkg/container/wellknown_attributes.go b/pkg/container/wellknown_attributes.go new file mode 100644 index 0000000..143be14 --- /dev/null +++ b/pkg/container/wellknown_attributes.go @@ -0,0 +1,11 @@ +package container + +const ( + // AttrName is an attribute key that is commonly used to denote + // human-friendly name. + AttrName = "Name" + + // AttrTimestamp is an attribute key that is commonly used to denote + // user-defined local time of container creation in Unix Timestamp format. + AttrTimestamp = "Timestamp" +) From 5494d3417f8360b46c776188c65c276f633ae71b Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 22 Oct 2020 18:41:49 +0300 Subject: [PATCH 0485/1196] [#172] sdk/object: Define well-known application attributes Signed-off-by: Leonard Lyubich --- pkg/object/wellknown_attributes.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 pkg/object/wellknown_attributes.go diff --git a/pkg/object/wellknown_attributes.go b/pkg/object/wellknown_attributes.go new file mode 100644 index 0000000..3c9df3d --- /dev/null +++ b/pkg/object/wellknown_attributes.go @@ -0,0 +1,15 @@ +package object + +const ( + // AttrName is an attribute key that is commonly used to denote + // human-friendly name. + AttrName = "Name" + + // AttrFileName is an attribute key that is commonly used to denote + // file name to be associated with the object on saving. + AttrFileName = "FileName" + + // AttrTimestamp is an attribute key that is commonly used to denote + // user-defined local time of object creation in Unix Timestamp format. + AttrTimestamp = "Timestamp" +) From ad0b01e892dd4d8a9b4c92082caece27d5663462 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 22 Oct 2020 19:10:42 +0300 Subject: [PATCH 0486/1196] [#172] Improve the readability of named attribute constants Signed-off-by: Leonard Lyubich --- pkg/container/wellknown_attributes.go | 8 ++++---- pkg/object/wellknown_attributes.go | 12 ++++++------ v2/container/attributes.go | 8 ++++---- v2/object/attributes.go | 12 ++++++------ 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/pkg/container/wellknown_attributes.go b/pkg/container/wellknown_attributes.go index 143be14..241c745 100644 --- a/pkg/container/wellknown_attributes.go +++ b/pkg/container/wellknown_attributes.go @@ -1,11 +1,11 @@ package container const ( - // AttrName is an attribute key that is commonly used to denote + // AttributeName is an attribute key that is commonly used to denote // human-friendly name. - AttrName = "Name" + AttributeName = "Name" - // AttrTimestamp is an attribute key that is commonly used to denote + // AttributeTimestamp is an attribute key that is commonly used to denote // user-defined local time of container creation in Unix Timestamp format. - AttrTimestamp = "Timestamp" + AttributeTimestamp = "Timestamp" ) diff --git a/pkg/object/wellknown_attributes.go b/pkg/object/wellknown_attributes.go index 3c9df3d..423b5fb 100644 --- a/pkg/object/wellknown_attributes.go +++ b/pkg/object/wellknown_attributes.go @@ -1,15 +1,15 @@ package object const ( - // AttrName is an attribute key that is commonly used to denote + // AttributeName is an attribute key that is commonly used to denote // human-friendly name. - AttrName = "Name" + AttributeName = "Name" - // AttrFileName is an attribute key that is commonly used to denote + // AttributeFileName is an attribute key that is commonly used to denote // file name to be associated with the object on saving. - AttrFileName = "FileName" + AttributeFileName = "FileName" - // AttrTimestamp is an attribute key that is commonly used to denote + // AttributeTimestamp is an attribute key that is commonly used to denote // user-defined local time of object creation in Unix Timestamp format. - AttrTimestamp = "Timestamp" + AttributeTimestamp = "Timestamp" ) diff --git a/v2/container/attributes.go b/v2/container/attributes.go index 2dc0c92..b91dcc6 100644 --- a/v2/container/attributes.go +++ b/v2/container/attributes.go @@ -1,9 +1,9 @@ package container -// SysAttrPrefix is a prefix of key to system attribute. -const SysAttrPrefix = "__NEOFS__" +// SysAttributePrefix is a prefix of key to system attribute. +const SysAttributePrefix = "__NEOFS__" const ( - // SysAttrSubnet is a string ID of container's storage subnet. - SysAttrSubnet = SysAttrPrefix + "SUBNET" + // SysAttributeSubnet is a string ID of container's storage subnet. + SysAttributeSubnet = SysAttributePrefix + "SUBNET" ) diff --git a/v2/object/attributes.go b/v2/object/attributes.go index 0da07b8..6a9dfd2 100644 --- a/v2/object/attributes.go +++ b/v2/object/attributes.go @@ -1,12 +1,12 @@ package object -// SysAttrPrefix is a prefix of key to system attribute. -const SysAttrPrefix = "__NEOFS__" +// SysAttributePrefix is a prefix of key to system attribute. +const SysAttributePrefix = "__NEOFS__" const ( - // SysAttrUploadID marks smaller parts of a split bigger object. - SysAttrUploadID = SysAttrPrefix + "UPLOAD_ID" + // SysAttributeUploadID marks smaller parts of a split bigger object. + SysAttributeUploadID = SysAttributePrefix + "UPLOAD_ID" - // SysAttrExpEpoch tells GC to delete object after that epoch. - SysAttrExpEpoch = SysAttrPrefix + "EXPIRATION_EPOCH" + // SysAttributeExpEpoch tells GC to delete object after that epoch. + SysAttributeExpEpoch = SysAttributePrefix + "EXPIRATION_EPOCH" ) From 805ad54f41481a29e20e73b2c7fcd4449c2d6a2c Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 27 Oct 2020 15:54:02 +0300 Subject: [PATCH 0487/1196] [#180] sdk/client: Make defaultOptions func a Client method Signed-off-by: Leonard Lyubich --- pkg/client/accounting.go | 2 +- pkg/client/container.go | 12 ++++++------ pkg/client/netmap.go | 2 +- pkg/client/object.go | 14 +++++++------- pkg/client/opts.go | 2 +- pkg/client/session.go | 2 +- 6 files changed, 17 insertions(+), 17 deletions(-) diff --git a/pkg/client/accounting.go b/pkg/client/accounting.go index 92c5e12..52d25c4 100644 --- a/pkg/client/accounting.go +++ b/pkg/client/accounting.go @@ -35,7 +35,7 @@ func (c Client) GetBalance(ctx context.Context, owner *owner.ID, opts ...CallOpt func (c Client) getBalanceV2(ctx context.Context, owner *owner.ID, opts ...CallOption) (*accounting.Decimal, error) { // apply all available options - callOptions := defaultCallOptions() + callOptions := c.defaultCallOptions() for i := range opts { opts[i].apply(&callOptions) } diff --git a/pkg/client/container.go b/pkg/client/container.go index e4eb75a..c723de1 100644 --- a/pkg/client/container.go +++ b/pkg/client/container.go @@ -94,7 +94,7 @@ func (c Client) SetEACL(ctx context.Context, eacl *eacl.Table, opts ...CallOptio func (c Client) putContainerV2(ctx context.Context, cnr *container.Container, opts ...CallOption) (*container.ID, error) { // apply all available options - callOptions := defaultCallOptions() + callOptions := c.defaultCallOptions() for i := range opts { opts[i].apply(&callOptions) } @@ -164,7 +164,7 @@ func (c Client) putContainerV2(ctx context.Context, cnr *container.Container, op func (c Client) getContainerV2(ctx context.Context, id *container.ID, opts ...CallOption) (*container.Container, error) { // apply all available options - callOptions := defaultCallOptions() + callOptions := c.defaultCallOptions() for i := range opts { opts[i].apply(&callOptions) } @@ -206,7 +206,7 @@ func (c Client) getContainerV2(ctx context.Context, id *container.ID, opts ...Ca func (c Client) listContainerV2(ctx context.Context, owner *owner.ID, opts ...CallOption) ([]*container.ID, error) { // apply all available options - callOptions := defaultCallOptions() + callOptions := c.defaultCallOptions() for i := range opts { opts[i].apply(&callOptions) } @@ -253,7 +253,7 @@ func (c Client) listContainerV2(ctx context.Context, owner *owner.ID, opts ...Ca func (c Client) delContainerV2(ctx context.Context, id *container.ID, opts ...CallOption) error { // apply all available options - callOptions := defaultCallOptions() + callOptions := c.defaultCallOptions() for i := range opts { opts[i].apply(&callOptions) } @@ -311,7 +311,7 @@ func (c Client) delContainerV2(ctx context.Context, id *container.ID, opts ...Ca func (c Client) getEACLV2(ctx context.Context, id *container.ID, opts ...CallOption) (*eacl.Table, error) { // apply all available options - callOptions := defaultCallOptions() + callOptions := c.defaultCallOptions() for i := range opts { opts[i].apply(&callOptions) } @@ -362,7 +362,7 @@ func (c Client) getEACLV2(ctx context.Context, id *container.ID, opts ...CallOpt func (c Client) setEACLV2(ctx context.Context, eacl *eacl.Table, opts ...CallOption) error { // apply all available options - callOptions := defaultCallOptions() + callOptions := c.defaultCallOptions() for i := range opts { opts[i].apply(&callOptions) } diff --git a/pkg/client/netmap.go b/pkg/client/netmap.go index c400332..515d130 100644 --- a/pkg/client/netmap.go +++ b/pkg/client/netmap.go @@ -23,7 +23,7 @@ func (c Client) EndpointInfo(ctx context.Context, opts ...CallOption) (*netmap.N func (c Client) endpointInfoV2(ctx context.Context, opts ...CallOption) (*netmap.NodeInfo, error) { // apply all available options - callOptions := defaultCallOptions() + callOptions := c.defaultCallOptions() for i := range opts { opts[i].apply(&callOptions) } diff --git a/pkg/client/object.go b/pkg/client/object.go index 1784af3..5d29e5d 100644 --- a/pkg/client/object.go +++ b/pkg/client/object.go @@ -164,7 +164,7 @@ func (c *Client) putObjectV2(ctx context.Context, p *PutObjectParams, opts ...Ca return nil, errors.Wrap(err, "could not open Put object stream") } - callOpts := defaultCallOptions() + callOpts := c.defaultCallOptions() for i := range opts { if opts[i] != nil { @@ -279,7 +279,7 @@ func (c *Client) deleteObjectV2(ctx context.Context, p *DeleteObjectParams, opts return errors.Wrap(err, "could not create Object V2 client") } - callOpts := defaultCallOptions() + callOpts := c.defaultCallOptions() for i := range opts { if opts[i] != nil { @@ -359,7 +359,7 @@ func (c *Client) getObjectV2(ctx context.Context, p *GetObjectParams, opts ...Ca return nil, errors.Wrap(err, "could not create Object V2 client") } - callOpts := defaultCallOptions() + callOpts := c.defaultCallOptions() for i := range opts { if opts[i] != nil { @@ -492,7 +492,7 @@ func (c *Client) getObjectHeaderV2(ctx context.Context, p *ObjectHeaderParams, o return nil, errors.Wrap(err, "could not create Object V2 client") } - callOpts := defaultCallOptions() + callOpts := c.defaultCallOptions() for i := range opts { if opts[i] != nil { @@ -625,7 +625,7 @@ func (c *Client) objectPayloadRangeV2(ctx context.Context, p *RangeDataParams, o return nil, errors.Wrap(err, "could not create Object V2 client") } - callOpts := defaultCallOptions() + callOpts := c.defaultCallOptions() for i := range opts { if opts[i] != nil { @@ -767,7 +767,7 @@ func (c *Client) objectPayloadRangeHashV2(ctx context.Context, p *RangeChecksumP return nil, errors.Wrap(err, "could not create Object V2 client") } - callOpts := defaultCallOptions() + callOpts := c.defaultCallOptions() for i := range opts { if opts[i] != nil { @@ -899,7 +899,7 @@ func (c *Client) searchObjectV2(ctx context.Context, p *SearchObjectParams, opts return nil, errors.Wrap(err, "could not create Object V2 client") } - callOpts := defaultCallOptions() + callOpts := c.defaultCallOptions() for i := range opts { if opts[i] != nil { diff --git a/pkg/client/opts.go b/pkg/client/opts.go index ff3546d..f8d2528 100644 --- a/pkg/client/opts.go +++ b/pkg/client/opts.go @@ -58,7 +58,7 @@ type ( } ) -func defaultCallOptions() callOptions { +func (c Client) defaultCallOptions() callOptions { return callOptions{ ttl: 2, version: pkg.SDKVersion(), diff --git a/pkg/client/session.go b/pkg/client/session.go index 6c912a0..48d0806 100644 --- a/pkg/client/session.go +++ b/pkg/client/session.go @@ -22,7 +22,7 @@ func (c Client) CreateSession(ctx context.Context, expiration uint64, opts ...Ca func (c Client) createSessionV2(ctx context.Context, expiration uint64, opts ...CallOption) (*token.SessionToken, error) { // apply all available options - callOptions := defaultCallOptions() + callOptions := c.defaultCallOptions() for i := range opts { opts[i].apply(&callOptions) } From b2ba0eef0721002ca591d0e58f9e31131d8cb173 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 27 Oct 2020 15:55:19 +0300 Subject: [PATCH 0488/1196] [#180] sdk/client: Implement methods that attach tokens to Client Signed-off-by: Leonard Lyubich --- pkg/client/client.go | 5 +++++ pkg/client/opts.go | 2 ++ pkg/client/session.go | 16 ++++++++++++++++ 3 files changed, 23 insertions(+) diff --git a/pkg/client/client.go b/pkg/client/client.go index e5e8e3b..9b73fa0 100644 --- a/pkg/client/client.go +++ b/pkg/client/client.go @@ -5,6 +5,7 @@ import ( "errors" "github.com/nspcc-dev/neofs-api-go/pkg" + "github.com/nspcc-dev/neofs-api-go/pkg/token" ) type ( @@ -13,6 +14,10 @@ type ( remoteNode TransportInfo opts *clientOptions + + sessionToken *token.SessionToken + + bearerToken *token.BearerToken } TransportProtocol uint32 diff --git a/pkg/client/opts.go b/pkg/client/opts.go index f8d2528..6c204e7 100644 --- a/pkg/client/opts.go +++ b/pkg/client/opts.go @@ -62,6 +62,8 @@ func (c Client) defaultCallOptions() callOptions { return callOptions{ ttl: 2, version: pkg.SDKVersion(), + session: c.sessionToken, + bearer: c.bearerToken, } } diff --git a/pkg/client/session.go b/pkg/client/session.go index 48d0806..7f9d6a0 100644 --- a/pkg/client/session.go +++ b/pkg/client/session.go @@ -110,3 +110,19 @@ func v2SessionClientFromOptions(opts *clientOptions) (cli *v2session.Client, err return cli, nil } + +// AttachSessionToken attaches session token to client. +// +// Provided token is attached to all requests without WithSession option. +// Use WithSession(nil) option in order to send request without session token. +func (c *Client) AttachSessionToken(token *token.SessionToken) { + c.sessionToken = token +} + +// AttachBearerToken attaches bearer token to client. +// +// Provided bearer is attached to all requests without WithBearer option. +// Use WithBearer(nil) option in order to send request without bearer token. +func (c *Client) AttachBearerToken(token *token.BearerToken) { + c.bearerToken = token +} From 7f0f42bc30c79d89ad9249fa25ed4098a4ece865 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 27 Oct 2020 16:27:16 +0300 Subject: [PATCH 0489/1196] [#180] sdk/client: Set session token field in all requests Signed-off-by: Leonard Lyubich --- pkg/client/opts.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkg/client/opts.go b/pkg/client/opts.go index 6c204e7..702f4c2 100644 --- a/pkg/client/opts.go +++ b/pkg/client/opts.go @@ -134,6 +134,8 @@ func v2MetaHeaderFromOpts(options callOptions) *v2session.RequestMetaHeader { meta.SetBearerToken(options.bearer.ToV2()) } + meta.SetSessionToken(options.session.ToV2()) + return meta } From 5be034ab80cd04da5d33d6eade81b8efb0d05c68 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 27 Oct 2020 16:48:17 +0300 Subject: [PATCH 0490/1196] [#182] Regenerate proto-compiled files Signed-off-by: Leonard Lyubich --- util/proto/test/test.pb.go | 2 +- v2/accounting/grpc/service.pb.go | 2 +- v2/accounting/grpc/types.pb.go | 2 +- v2/acl/grpc/types.pb.go | 193 +++++++++-------- v2/container/grpc/service.pb.go | 2 +- v2/container/grpc/types.pb.go | 11 +- v2/netmap/grpc/service.pb.go | 2 +- v2/netmap/grpc/types.pb.go | 2 +- v2/object/grpc/service.pb.go | 356 +++++++++++++++++-------------- v2/object/grpc/types.pb.go | 17 +- v2/refs/grpc/types.pb.go | 2 +- v2/session/grpc/service.pb.go | 2 +- v2/session/grpc/types.pb.go | 2 +- v2/storagegroup/grpc/types.pb.go | 2 +- 14 files changed, 338 insertions(+), 259 deletions(-) diff --git a/util/proto/test/test.pb.go b/util/proto/test/test.pb.go index f581442..91c3f8b 100644 --- a/util/proto/test/test.pb.go +++ b/util/proto/test/test.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.23.0 -// protoc v3.13.0 +// protoc v3.11.4 // source: util/proto/test/test.proto package test diff --git a/v2/accounting/grpc/service.pb.go b/v2/accounting/grpc/service.pb.go index 2f29d12..2ef4b19 100644 --- a/v2/accounting/grpc/service.pb.go +++ b/v2/accounting/grpc/service.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.23.0 -// protoc v3.13.0 +// protoc v3.11.4 // source: v2/accounting/grpc/service.proto package accounting diff --git a/v2/accounting/grpc/types.pb.go b/v2/accounting/grpc/types.pb.go index dd62f96..13c3bf9 100644 --- a/v2/accounting/grpc/types.pb.go +++ b/v2/accounting/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.23.0 -// protoc v3.13.0 +// protoc v3.11.4 // source: v2/accounting/grpc/types.proto package accounting diff --git a/v2/acl/grpc/types.pb.go b/v2/acl/grpc/types.pb.go index a421a7c..2e9656b 100644 --- a/v2/acl/grpc/types.pb.go +++ b/v2/acl/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.23.0 -// protoc v3.13.0 +// protoc v3.11.4 // source: v2/acl/grpc/types.proto package acl @@ -471,6 +471,9 @@ func (x *EACLTable) GetRecords() []*EACLRecord { // like [JWT](https://jwt.io), it has a limited lifetime and scope, hence can be // used in the similar use cases, like providing authorisation to externally // authenticated party. +// +// BearerToken can be issued only by container's owner and must be signed using +// the key associated with container's `OwnerID`. type BearerToken struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -529,6 +532,28 @@ func (x *BearerToken) GetSignature() *grpc.Signature { } // Filter to check particular properties of the request or object. +// +// By default `key` field refers to the corresponding object's `Attribute`. +// Some Object's header fields can also be accessed by adding `$Object:` +// prefix to the name. Here is the list of fields available via this prefix: +// +// * $Object:version \ +// version +// * $Object:containerID \ +// container_id +// * $Object:ownerID \ +// owner_id +// * $Object:creationEpoch \ +// creation_epoch +// * $Object:payloadLength \ +// payload_length +// * $Object:payloadHash \ +// payload_hash +// * $Object:objectType \ +// object_type +// * $Object:homomorphicHash \ +// homomorphic_hash +// type EACLRecord_Filter struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -539,9 +564,9 @@ type EACLRecord_Filter struct { // Match operation type MatchType MatchType `protobuf:"varint,2,opt,name=match_type,json=matchType,proto3,enum=neo.fs.v2.acl.MatchType" json:"match_type,omitempty"` // Name of the Header to use - HeaderName string `protobuf:"bytes,3,opt,name=header_name,json=headerName,proto3" json:"header_name,omitempty"` + Key string `protobuf:"bytes,3,opt,name=key,proto3" json:"key,omitempty"` // Expected Header Value or pattern to match - HeaderVal string `protobuf:"bytes,4,opt,name=header_val,json=value,proto3" json:"header_val,omitempty"` + Value string `protobuf:"bytes,4,opt,name=value,proto3" json:"value,omitempty"` } func (x *EACLRecord_Filter) Reset() { @@ -590,16 +615,16 @@ func (x *EACLRecord_Filter) GetMatchType() MatchType { return MatchType_MATCH_TYPE_UNSPECIFIED } -func (x *EACLRecord_Filter) GetHeaderName() string { +func (x *EACLRecord_Filter) GetKey() string { if x != nil { - return x.HeaderName + return x.Key } return "" } -func (x *EACLRecord_Filter) GetHeaderVal() string { +func (x *EACLRecord_Filter) GetValue() string { if x != nil { - return x.HeaderVal + return x.Value } return "" } @@ -673,8 +698,8 @@ type BearerToken_Body struct { // Table of Extended ACL rules to use instead of the ones attached to the // container EaclTable *EACLTable `protobuf:"bytes,1,opt,name=eacl_table,json=eaclTable,proto3" json:"eacl_table,omitempty"` - // `OwnerID` to whom the token was issued. MUST match with the request - // originator's `OwnerID` + // `OwnerID` to whom the token was issued. Must match the request + // originator's `OwnerID`. If empty, any token bearer will be accepted. OwnerId *grpc.OwnerID `protobuf:"bytes,2,opt,name=owner_id,json=ownerID,proto3" json:"owner_id,omitempty"` // Token expiration and valid time period parameters Lifetime *BearerToken_Body_TokenLifetime `protobuf:"bytes,3,opt,name=lifetime,proto3" json:"lifetime,omitempty"` @@ -808,7 +833,7 @@ var file_v2_acl_grpc_types_proto_rawDesc = []byte{ 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0d, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x1a, 0x18, 0x76, 0x32, 0x2f, 0x72, 0x65, 0x66, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x22, 0xee, 0x03, 0x0a, 0x0a, 0x45, 0x41, 0x43, 0x4c, 0x52, 0x65, 0x63, 0x6f, 0x72, + 0x74, 0x6f, 0x22, 0xda, 0x03, 0x0a, 0x0a, 0x45, 0x41, 0x43, 0x4c, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x12, 0x36, 0x0a, 0x09, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x09, @@ -823,7 +848,7 @@ var file_v2_acl_grpc_types_proto_rawDesc = []byte{ 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x45, 0x41, 0x43, 0x4c, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x2e, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x52, 0x07, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, - 0x1a, 0xb9, 0x01, 0x0a, 0x06, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x3a, 0x0a, 0x0b, 0x68, + 0x1a, 0xa5, 0x01, 0x0a, 0x06, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x3a, 0x0a, 0x0b, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x52, 0x0a, 0x68, 0x65, 0x61, @@ -831,80 +856,78 @@ var file_v2_acl_grpc_types_proto_rawDesc = []byte{ 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x54, 0x79, 0x70, 0x65, 0x52, 0x09, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x54, 0x79, 0x70, 0x65, - 0x12, 0x1f, 0x0a, 0x0b, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x4e, 0x61, 0x6d, - 0x65, 0x12, 0x19, 0x0a, 0x0a, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x5f, 0x76, 0x61, 0x6c, 0x18, - 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x1a, 0x45, 0x0a, 0x06, - 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x12, 0x27, 0x0a, 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0e, 0x32, 0x13, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, - 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x52, 0x6f, 0x6c, 0x65, 0x52, 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x12, - 0x12, 0x0a, 0x04, 0x6b, 0x65, 0x79, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x04, 0x6b, - 0x65, 0x79, 0x73, 0x22, 0xb3, 0x01, 0x0a, 0x09, 0x45, 0x41, 0x43, 0x4c, 0x54, 0x61, 0x62, 0x6c, - 0x65, 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, 0x3e, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, - 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, - 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x74, - 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, - 0x65, 0x72, 0x49, 0x44, 0x12, 0x33, 0x0a, 0x07, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x18, - 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, - 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x45, 0x41, 0x43, 0x4c, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, - 0x52, 0x07, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x22, 0x83, 0x03, 0x0a, 0x0b, 0x42, 0x65, - 0x61, 0x72, 0x65, 0x72, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x33, 0x0a, 0x04, 0x62, 0x6f, 0x64, - 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, - 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x42, 0x65, 0x61, 0x72, 0x65, 0x72, 0x54, 0x6f, - 0x6b, 0x65, 0x6e, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x37, - 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, - 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, - 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x1a, 0x85, 0x02, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, - 0x12, 0x37, 0x0a, 0x0a, 0x65, 0x61, 0x63, 0x6c, 0x5f, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, - 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x45, 0x41, 0x43, 0x4c, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x52, 0x09, - 0x65, 0x61, 0x63, 0x6c, 0x54, 0x61, 0x62, 0x6c, 0x65, 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, 0x49, 0x0a, - 0x08, 0x6c, 0x69, 0x66, 0x65, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x2d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, - 0x42, 0x65, 0x61, 0x72, 0x65, 0x72, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x42, 0x6f, 0x64, 0x79, - 0x2e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x4c, 0x69, 0x66, 0x65, 0x74, 0x69, 0x6d, 0x65, 0x52, 0x08, - 0x6c, 0x69, 0x66, 0x65, 0x74, 0x69, 0x6d, 0x65, 0x1a, 0x45, 0x0a, 0x0d, 0x54, 0x6f, 0x6b, 0x65, - 0x6e, 0x4c, 0x69, 0x66, 0x65, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x78, 0x70, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x65, 0x78, 0x70, 0x12, 0x10, 0x0a, 0x03, 0x6e, - 0x62, 0x66, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x6e, 0x62, 0x66, 0x12, 0x10, 0x0a, - 0x03, 0x69, 0x61, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x69, 0x61, 0x74, 0x2a, - 0x3e, 0x0a, 0x04, 0x52, 0x6f, 0x6c, 0x65, 0x12, 0x14, 0x0a, 0x10, 0x52, 0x4f, 0x4c, 0x45, 0x5f, - 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x08, 0x0a, - 0x04, 0x55, 0x53, 0x45, 0x52, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x53, 0x59, 0x53, 0x54, 0x45, - 0x4d, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x4f, 0x54, 0x48, 0x45, 0x52, 0x53, 0x10, 0x03, 0x2a, - 0x4f, 0x0a, 0x09, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1a, 0x0a, 0x16, - 0x4d, 0x41, 0x54, 0x43, 0x48, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, - 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x10, 0x0a, 0x0c, 0x53, 0x54, 0x52, 0x49, - 0x4e, 0x47, 0x5f, 0x45, 0x51, 0x55, 0x41, 0x4c, 0x10, 0x01, 0x12, 0x14, 0x0a, 0x10, 0x53, 0x54, - 0x52, 0x49, 0x4e, 0x47, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x45, 0x51, 0x55, 0x41, 0x4c, 0x10, 0x02, - 0x2a, 0x7a, 0x0a, 0x09, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x19, 0x0a, - 0x15, 0x4f, 0x50, 0x45, 0x52, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, - 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x47, 0x45, 0x54, 0x10, - 0x01, 0x12, 0x08, 0x0a, 0x04, 0x48, 0x45, 0x41, 0x44, 0x10, 0x02, 0x12, 0x07, 0x0a, 0x03, 0x50, - 0x55, 0x54, 0x10, 0x03, 0x12, 0x0a, 0x0a, 0x06, 0x44, 0x45, 0x4c, 0x45, 0x54, 0x45, 0x10, 0x04, - 0x12, 0x0a, 0x0a, 0x06, 0x53, 0x45, 0x41, 0x52, 0x43, 0x48, 0x10, 0x05, 0x12, 0x0c, 0x0a, 0x08, - 0x47, 0x45, 0x54, 0x52, 0x41, 0x4e, 0x47, 0x45, 0x10, 0x06, 0x12, 0x10, 0x0a, 0x0c, 0x47, 0x45, - 0x54, 0x52, 0x41, 0x4e, 0x47, 0x45, 0x48, 0x41, 0x53, 0x48, 0x10, 0x07, 0x2a, 0x35, 0x0a, 0x06, - 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x12, 0x41, 0x43, 0x54, 0x49, 0x4f, 0x4e, - 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x09, - 0x0a, 0x05, 0x41, 0x4c, 0x4c, 0x4f, 0x57, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x44, 0x45, 0x4e, - 0x59, 0x10, 0x02, 0x2a, 0x3d, 0x0a, 0x0a, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x54, 0x79, 0x70, - 0x65, 0x12, 0x16, 0x0a, 0x12, 0x48, 0x45, 0x41, 0x44, 0x45, 0x52, 0x5f, 0x55, 0x4e, 0x53, 0x50, - 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x52, 0x45, 0x51, - 0x55, 0x45, 0x53, 0x54, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x4f, 0x42, 0x4a, 0x45, 0x43, 0x54, - 0x10, 0x02, 0x42, 0x46, 0x5a, 0x31, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, - 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, - 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x61, 0x63, 0x6c, 0x2f, 0x67, - 0x72, 0x70, 0x63, 0x3b, 0x61, 0x63, 0x6c, 0xaa, 0x02, 0x10, 0x4e, 0x65, 0x6f, 0x46, 0x53, 0x2e, - 0x41, 0x50, 0x49, 0x2e, 0x76, 0x32, 0x2e, 0x41, 0x63, 0x6c, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x33, + 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, + 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x1a, 0x45, 0x0a, 0x06, 0x54, 0x61, 0x72, 0x67, + 0x65, 0x74, 0x12, 0x27, 0x0a, 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, + 0x32, 0x13, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, + 0x2e, 0x52, 0x6f, 0x6c, 0x65, 0x52, 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6b, + 0x65, 0x79, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x04, 0x6b, 0x65, 0x79, 0x73, 0x22, + 0xb3, 0x01, 0x0a, 0x09, 0x45, 0x41, 0x43, 0x4c, 0x54, 0x61, 0x62, 0x6c, 0x65, 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, 0x3e, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, + 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, + 0x72, 0x49, 0x44, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, + 0x12, 0x33, 0x0a, 0x07, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, + 0x6c, 0x2e, 0x45, 0x41, 0x43, 0x4c, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x07, 0x72, 0x65, + 0x63, 0x6f, 0x72, 0x64, 0x73, 0x22, 0x83, 0x03, 0x0a, 0x0b, 0x42, 0x65, 0x61, 0x72, 0x65, 0x72, + 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x33, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, + 0x61, 0x63, 0x6c, 0x2e, 0x42, 0x65, 0x61, 0x72, 0x65, 0x72, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, + 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x37, 0x0a, 0x09, 0x73, 0x69, + 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, + 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, + 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, + 0x75, 0x72, 0x65, 0x1a, 0x85, 0x02, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x37, 0x0a, 0x0a, + 0x65, 0x61, 0x63, 0x6c, 0x5f, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, + 0x2e, 0x45, 0x41, 0x43, 0x4c, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x52, 0x09, 0x65, 0x61, 0x63, 0x6c, + 0x54, 0x61, 0x62, 0x6c, 0x65, 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, 0x49, 0x0a, 0x08, 0x6c, 0x69, 0x66, + 0x65, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x6e, 0x65, + 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x42, 0x65, 0x61, 0x72, + 0x65, 0x72, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x2e, 0x54, 0x6f, 0x6b, + 0x65, 0x6e, 0x4c, 0x69, 0x66, 0x65, 0x74, 0x69, 0x6d, 0x65, 0x52, 0x08, 0x6c, 0x69, 0x66, 0x65, + 0x74, 0x69, 0x6d, 0x65, 0x1a, 0x45, 0x0a, 0x0d, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x4c, 0x69, 0x66, + 0x65, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x78, 0x70, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x04, 0x52, 0x03, 0x65, 0x78, 0x70, 0x12, 0x10, 0x0a, 0x03, 0x6e, 0x62, 0x66, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x6e, 0x62, 0x66, 0x12, 0x10, 0x0a, 0x03, 0x69, 0x61, 0x74, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x69, 0x61, 0x74, 0x2a, 0x3e, 0x0a, 0x04, 0x52, + 0x6f, 0x6c, 0x65, 0x12, 0x14, 0x0a, 0x10, 0x52, 0x4f, 0x4c, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, + 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x55, 0x53, 0x45, + 0x52, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x53, 0x59, 0x53, 0x54, 0x45, 0x4d, 0x10, 0x02, 0x12, + 0x0a, 0x0a, 0x06, 0x4f, 0x54, 0x48, 0x45, 0x52, 0x53, 0x10, 0x03, 0x2a, 0x4f, 0x0a, 0x09, 0x4d, + 0x61, 0x74, 0x63, 0x68, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1a, 0x0a, 0x16, 0x4d, 0x41, 0x54, 0x43, + 0x48, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, + 0x45, 0x44, 0x10, 0x00, 0x12, 0x10, 0x0a, 0x0c, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x5f, 0x45, + 0x51, 0x55, 0x41, 0x4c, 0x10, 0x01, 0x12, 0x14, 0x0a, 0x10, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, + 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x45, 0x51, 0x55, 0x41, 0x4c, 0x10, 0x02, 0x2a, 0x7a, 0x0a, 0x09, + 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x19, 0x0a, 0x15, 0x4f, 0x50, 0x45, + 0x52, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, + 0x45, 0x44, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x47, 0x45, 0x54, 0x10, 0x01, 0x12, 0x08, 0x0a, + 0x04, 0x48, 0x45, 0x41, 0x44, 0x10, 0x02, 0x12, 0x07, 0x0a, 0x03, 0x50, 0x55, 0x54, 0x10, 0x03, + 0x12, 0x0a, 0x0a, 0x06, 0x44, 0x45, 0x4c, 0x45, 0x54, 0x45, 0x10, 0x04, 0x12, 0x0a, 0x0a, 0x06, + 0x53, 0x45, 0x41, 0x52, 0x43, 0x48, 0x10, 0x05, 0x12, 0x0c, 0x0a, 0x08, 0x47, 0x45, 0x54, 0x52, + 0x41, 0x4e, 0x47, 0x45, 0x10, 0x06, 0x12, 0x10, 0x0a, 0x0c, 0x47, 0x45, 0x54, 0x52, 0x41, 0x4e, + 0x47, 0x45, 0x48, 0x41, 0x53, 0x48, 0x10, 0x07, 0x2a, 0x35, 0x0a, 0x06, 0x41, 0x63, 0x74, 0x69, + 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x12, 0x41, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x53, + 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x41, 0x4c, + 0x4c, 0x4f, 0x57, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x44, 0x45, 0x4e, 0x59, 0x10, 0x02, 0x2a, + 0x3d, 0x0a, 0x0a, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, + 0x12, 0x48, 0x45, 0x41, 0x44, 0x45, 0x52, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, + 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x52, 0x45, 0x51, 0x55, 0x45, 0x53, 0x54, + 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x4f, 0x42, 0x4a, 0x45, 0x43, 0x54, 0x10, 0x02, 0x42, 0x46, + 0x5a, 0x31, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, + 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, + 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x61, 0x63, 0x6c, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, + 0x61, 0x63, 0x6c, 0xaa, 0x02, 0x10, 0x4e, 0x65, 0x6f, 0x46, 0x53, 0x2e, 0x41, 0x50, 0x49, 0x2e, + 0x76, 0x32, 0x2e, 0x41, 0x63, 0x6c, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/v2/container/grpc/service.pb.go b/v2/container/grpc/service.pb.go index 68d8392..6edd4ce 100644 --- a/v2/container/grpc/service.pb.go +++ b/v2/container/grpc/service.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.23.0 -// protoc v3.13.0 +// protoc v3.11.4 // source: v2/container/grpc/service.proto package container diff --git a/v2/container/grpc/types.pb.go b/v2/container/grpc/types.pb.go index 28c23cf..5103e7d 100644 --- a/v2/container/grpc/types.pb.go +++ b/v2/container/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.23.0 -// protoc v3.13.0 +// protoc v3.11.4 // source: v2/container/grpc/types.proto package container @@ -132,9 +132,16 @@ func (x *Container) GetPlacementPolicy() *grpc1.PlacementPolicy { // // There are some "well-known" attributes affecting system behaviour: // -// * Subnet \ +// * __NEOFS__SUBNET \ // String ID of container's storage subnet. Container can be attached to // only one subnet. +// +// 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 sizeCache protoimpl.SizeCache diff --git a/v2/netmap/grpc/service.pb.go b/v2/netmap/grpc/service.pb.go index 721f282..b30be26 100644 --- a/v2/netmap/grpc/service.pb.go +++ b/v2/netmap/grpc/service.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.23.0 -// protoc v3.13.0 +// protoc v3.11.4 // source: v2/netmap/grpc/service.proto package netmap diff --git a/v2/netmap/grpc/types.pb.go b/v2/netmap/grpc/types.pb.go index b7347eb..9bc0e1d 100644 --- a/v2/netmap/grpc/types.pb.go +++ b/v2/netmap/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.23.0 -// protoc v3.13.0 +// protoc v3.11.4 // source: v2/netmap/grpc/types.proto package netmap diff --git a/v2/object/grpc/service.pb.go b/v2/object/grpc/service.pb.go index 0f82c0f..3a49b0d 100644 --- a/v2/object/grpc/service.pb.go +++ b/v2/object/grpc/service.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.23.0 -// protoc v3.13.0 +// protoc v3.11.4 // source: v2/object/grpc/service.proto package object @@ -1866,7 +1866,45 @@ func (x *SearchRequest_Body) GetFilters() []*SearchRequest_Body_Filter { return nil } -// Filter structure +// Filter structure checks if object header field or attribute content +// matches a value. +// +// By default `key` field refers to the corresponding object's `Attribute`. +// Some Object's header fields can also be accessed by adding `$Object:` +// prefix to the name. Here is the list of fields available via this prefix: +// +// * $Object:version \ +// version +// * $Object:containerID \ +// container_id +// * $Object:ownerID \ +// owner_id +// * $Object:creationEpoch \ +// creation_epoch +// * $Object:payloadLength \ +// payload_length +// * $Object:payloadHash \ +// payload_hash +// * $Object:objectType \ +// object_type +// * $Object:homomorphicHash \ +// homomorphic_hash +// * $Object:split.parent \ +// object_id of parent +// +// There are some well-known filter aliases to match objects by certain +// properties: +// +// * $Object:ROOT \ +// With the `value` set to `true` checks if an object is a top object in a +// split hierarchy. With other values returns non-root objects. +// * $Object:LEAF \ +// With the `value` set to `true` checks if an object is a leaf in a split +// hierarchy. With other values returns non-leaf objects. +// * $Object:CHILDFREE \ +// With the `value` set to `true` checks if an object has empty +// children list in `Split` header. With other values returns +// non-childfree objects. type SearchRequest_Body_Filter struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -1874,9 +1912,9 @@ type SearchRequest_Body_Filter struct { // Match type to use MatchType MatchType `protobuf:"varint,1,opt,name=match_type,json=matchType,proto3,enum=neo.fs.v2.object.MatchType" json:"match_type,omitempty"` - // Header name to match - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` - // Header value to match + // Attribute or Header fields to match + Key string `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` + // Value to match Value string `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"` } @@ -1919,9 +1957,9 @@ func (x *SearchRequest_Body_Filter) GetMatchType() MatchType { return MatchType_MATCH_TYPE_UNSPECIFIED } -func (x *SearchRequest_Body_Filter) GetName() string { +func (x *SearchRequest_Body_Filter) GetKey() string { if x != nil { - return x.Name + return x.Key } return "" } @@ -2425,7 +2463,7 @@ var file_v2_object_grpc_service_proto_rawDesc = []byte{ 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x53, 0x68, 0x6f, 0x72, 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x48, 0x00, 0x52, 0x0b, 0x73, 0x68, 0x6f, 0x72, 0x74, 0x48, - 0x65, 0x61, 0x64, 0x65, 0x72, 0x42, 0x06, 0x0a, 0x04, 0x68, 0x65, 0x61, 0x64, 0x22, 0xfd, 0x03, + 0x65, 0x61, 0x64, 0x65, 0x72, 0x42, 0x06, 0x0a, 0x04, 0x68, 0x65, 0x61, 0x64, 0x22, 0xfb, 0x03, 0x0a, 0x0d, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x38, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, @@ -2440,7 +2478,7 @@ var file_v2_object_grpc_service_proto_rawDesc = []byte{ 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, 0x97, 0x02, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x3e, 0x0a, 0x0c, + 0x64, 0x65, 0x72, 0x1a, 0x95, 0x02, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x3e, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x52, @@ -2450,162 +2488,162 @@ var file_v2_object_grpc_service_proto_rawDesc = []byte{ 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x2e, 0x46, 0x69, - 0x6c, 0x74, 0x65, 0x72, 0x52, 0x07, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x73, 0x1a, 0x6e, 0x0a, + 0x6c, 0x74, 0x65, 0x72, 0x52, 0x07, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x73, 0x1a, 0x6c, 0x0a, 0x06, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x3a, 0x0a, 0x0a, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x54, 0x79, 0x70, 0x65, 0x52, 0x09, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x54, - 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xa2, 0x02, - 0x0a, 0x0e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 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, 0x6f, 0x62, 0x6a, 0x65, 0x63, - 0x74, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 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, 0x39, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, - 0x31, 0x0a, 0x07, 0x69, 0x64, 0x5f, 0x6c, 0x69, 0x73, 0x74, 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, 0x06, 0x69, 0x64, 0x4c, 0x69, - 0x73, 0x74, 0x22, 0x37, 0x0a, 0x05, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x6f, - 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x6f, 0x66, 0x66, - 0x73, 0x65, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x04, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xd1, 0x02, 0x0a, 0x0f, - 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 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, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, - 0x2e, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 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, 0x68, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x31, 0x0a, - 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, - 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, - 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, - 0x12, 0x2d, 0x0a, 0x05, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x17, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, - 0x63, 0x74, 0x2e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x05, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x22, - 0x89, 0x02, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3b, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, - 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 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, 0x1c, 0x0a, - 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x22, 0xa2, 0x03, 0x0a, 0x13, - 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x48, 0x61, 0x73, 0x68, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 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, 0x6f, 0x62, - 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x48, 0x61, 0x73, - 0x68, 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, 0xb0, 0x01, - 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x31, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, - 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, - 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, - 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x2f, 0x0a, 0x06, 0x72, 0x61, 0x6e, - 0x67, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, - 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x52, 0x61, 0x6e, - 0x67, 0x65, 0x52, 0x06, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x61, - 0x6c, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x73, 0x61, 0x6c, 0x74, 0x12, 0x30, - 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1c, 0x2e, 0x6e, - 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x68, - 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, - 0x22, 0xca, 0x02, 0x0a, 0x14, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x48, 0x61, 0x73, - 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3f, 0x0a, 0x04, 0x62, 0x6f, 0x64, - 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, - 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x61, - 0x6e, 0x67, 0x65, 0x48, 0x61, 0x73, 0x68, 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, 0x55, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x30, - 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1c, 0x2e, 0x6e, - 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x68, - 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, - 0x12, 0x1b, 0x0a, 0x09, 0x68, 0x61, 0x73, 0x68, 0x5f, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x02, 0x20, - 0x03, 0x28, 0x0c, 0x52, 0x08, 0x68, 0x61, 0x73, 0x68, 0x4c, 0x69, 0x73, 0x74, 0x32, 0xb2, 0x04, - 0x0a, 0x0d, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, - 0x44, 0x0a, 0x03, 0x47, 0x65, 0x74, 0x12, 0x1c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, - 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, - 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x30, 0x01, 0x12, 0x44, 0x0a, 0x03, 0x50, 0x75, 0x74, 0x12, 0x1c, 0x2e, 0x6e, + 0x79, 0x70, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xa2, 0x02, 0x0a, 0x0e, + 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 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, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, - 0x50, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x6e, 0x65, 0x6f, - 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x50, 0x75, - 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x28, 0x01, 0x12, 0x4b, 0x0a, 0x06, 0x44, - 0x65, 0x6c, 0x65, 0x74, 0x65, 0x12, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, - 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, - 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x45, 0x0a, 0x04, 0x48, 0x65, 0x61, 0x64, - 0x12, 0x1d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, - 0x65, 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x1e, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, - 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, - 0x4d, 0x0a, 0x06, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x12, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, - 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x53, 0x65, 0x61, - 0x72, 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x6e, 0x65, 0x6f, - 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x53, 0x65, - 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x30, 0x01, 0x12, 0x53, - 0x0a, 0x08, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x21, 0x2e, 0x6e, 0x65, 0x6f, - 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, - 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x22, 0x2e, + 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 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, 0x39, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x31, 0x0a, + 0x07, 0x69, 0x64, 0x5f, 0x6c, 0x69, 0x73, 0x74, 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, 0x06, 0x69, 0x64, 0x4c, 0x69, 0x73, 0x74, + 0x22, 0x37, 0x0a, 0x05, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x66, 0x66, + 0x73, 0x65, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, + 0x74, 0x12, 0x16, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x04, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xd1, 0x02, 0x0a, 0x0f, 0x47, 0x65, + 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 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, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, + 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 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, 0x68, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x31, 0x0a, 0x07, 0x61, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x41, 0x64, + 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x2d, + 0x0a, 0x05, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, - 0x2e, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x30, 0x01, 0x12, 0x5d, 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x48, - 0x61, 0x73, 0x68, 0x12, 0x25, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, - 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x48, - 0x61, 0x73, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x26, 0x2e, 0x6e, 0x65, 0x6f, - 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, - 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x48, 0x61, 0x73, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x42, 0x4f, 0x5a, 0x37, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, - 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, - 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x6f, 0x62, 0x6a, 0x65, 0x63, - 0x74, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0xaa, 0x02, 0x13, - 0x4e, 0x65, 0x6f, 0x46, 0x53, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x76, 0x32, 0x2e, 0x4f, 0x62, 0x6a, - 0x65, 0x63, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x2e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x05, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x22, 0x89, 0x02, + 0x0a, 0x10, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x3b, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x27, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, + 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 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, 0x1c, 0x0a, 0x04, 0x42, + 0x6f, 0x64, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0c, 0x52, 0x05, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x22, 0xa2, 0x03, 0x0a, 0x13, 0x47, 0x65, + 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x48, 0x61, 0x73, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 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, 0x6f, 0x62, 0x6a, 0x65, + 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x48, 0x61, 0x73, 0x68, 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, 0xb0, 0x01, 0x0a, 0x04, + 0x42, 0x6f, 0x64, 0x79, 0x12, 0x31, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x07, + 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x2f, 0x0a, 0x06, 0x72, 0x61, 0x6e, 0x67, 0x65, + 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, + 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x52, 0x61, 0x6e, 0x67, 0x65, + 0x52, 0x06, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x61, 0x6c, 0x74, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x73, 0x61, 0x6c, 0x74, 0x12, 0x30, 0x0a, 0x04, + 0x74, 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1c, 0x2e, 0x6e, 0x65, 0x6f, + 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x68, 0x65, 0x63, + 0x6b, 0x73, 0x75, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x22, 0xca, + 0x02, 0x0a, 0x14, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x48, 0x61, 0x73, 0x68, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3f, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, + 0x65, 0x48, 0x61, 0x73, 0x68, 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, 0x55, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x30, 0x0a, 0x04, + 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1c, 0x2e, 0x6e, 0x65, 0x6f, + 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x68, 0x65, 0x63, + 0x6b, 0x73, 0x75, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x1b, + 0x0a, 0x09, 0x68, 0x61, 0x73, 0x68, 0x5f, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x02, 0x20, 0x03, 0x28, + 0x0c, 0x52, 0x08, 0x68, 0x61, 0x73, 0x68, 0x4c, 0x69, 0x73, 0x74, 0x32, 0xb2, 0x04, 0x0a, 0x0d, + 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x44, 0x0a, + 0x03, 0x47, 0x65, 0x74, 0x12, 0x1c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, + 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x30, 0x01, 0x12, 0x44, 0x0a, 0x03, 0x50, 0x75, 0x74, 0x12, 0x1c, 0x2e, 0x6e, 0x65, 0x6f, + 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x50, 0x75, + 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x50, 0x75, 0x74, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x28, 0x01, 0x12, 0x4b, 0x0a, 0x06, 0x44, 0x65, 0x6c, + 0x65, 0x74, 0x65, 0x12, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, + 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x45, 0x0a, 0x04, 0x48, 0x65, 0x61, 0x64, 0x12, 0x1d, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, + 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, + 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, + 0x2e, 0x48, 0x65, 0x61, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4d, 0x0a, + 0x06, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x12, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, + 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, + 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x53, 0x65, 0x61, 0x72, + 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x30, 0x01, 0x12, 0x53, 0x0a, 0x08, + 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x21, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, + 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x22, 0x2e, 0x6e, 0x65, + 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, + 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x30, + 0x01, 0x12, 0x5d, 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x48, 0x61, 0x73, + 0x68, 0x12, 0x25, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, + 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x48, 0x61, 0x73, + 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x26, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, + 0x61, 0x6e, 0x67, 0x65, 0x48, 0x61, 0x73, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x42, 0x4f, 0x5a, 0x37, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, + 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, + 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2f, + 0x67, 0x72, 0x70, 0x63, 0x3b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0xaa, 0x02, 0x13, 0x4e, 0x65, + 0x6f, 0x46, 0x53, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x76, 0x32, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, + 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/v2/object/grpc/types.pb.go b/v2/object/grpc/types.pb.go index 8e64894..fd62c34 100644 --- a/v2/object/grpc/types.pb.go +++ b/v2/object/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.23.0 -// protoc v3.13.0 +// protoc v3.11.4 // source: v2/object/grpc/types.proto package object @@ -442,8 +442,19 @@ func (x *Object) GetPayload() []byte { // There are some "well-known" attributes starting with `__NEOFS__` prefix // that affect system behaviour: // -// * __NEOFS__UPLOAD_ID -// * __NEOFS__EXPIRATION_EPOCH +// * __NEOFS__UPLOAD_ID \ +// Marks smaller parts of a split bigger object +// * __NEOFS__EXPIRATION_EPOCH \ +// Tells GC to delete object after that epoch +// +// And some well-known attributes used by applications only: +// +// * Name \ +// Human-friendly name +// * FileName \ +// File name to be associated with the object on saving +// * Timestamp \ +// User-defined local time of object creation in Unix Timestamp format // // For detailed description of each well-known attribute please see the // corresponding section in NeoFS Technical specification. diff --git a/v2/refs/grpc/types.pb.go b/v2/refs/grpc/types.pb.go index c9994bd..2d4be15 100644 --- a/v2/refs/grpc/types.pb.go +++ b/v2/refs/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.23.0 -// protoc v3.13.0 +// protoc v3.11.4 // source: v2/refs/grpc/types.proto package refs diff --git a/v2/session/grpc/service.pb.go b/v2/session/grpc/service.pb.go index 712500e..19f9e62 100644 --- a/v2/session/grpc/service.pb.go +++ b/v2/session/grpc/service.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.23.0 -// protoc v3.13.0 +// protoc v3.11.4 // source: v2/session/grpc/service.proto package session diff --git a/v2/session/grpc/types.pb.go b/v2/session/grpc/types.pb.go index 7140ceb..ac38c54 100644 --- a/v2/session/grpc/types.pb.go +++ b/v2/session/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.23.0 -// protoc v3.13.0 +// protoc v3.11.4 // source: v2/session/grpc/types.proto package session diff --git a/v2/storagegroup/grpc/types.pb.go b/v2/storagegroup/grpc/types.pb.go index 96e9d87..5b00a18 100644 --- a/v2/storagegroup/grpc/types.pb.go +++ b/v2/storagegroup/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.23.0 -// protoc v3.13.0 +// protoc v3.11.4 // source: v2/storagegroup/grpc/types.proto package storagegroup From dc9fcd5d9808bd128dcf291d6745e83cdf20f7e4 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 27 Oct 2020 16:55:19 +0300 Subject: [PATCH 0491/1196] [#182] Rename methods to match updated field names Signed-off-by: Leonard Lyubich --- pkg/acl/eacl/filter.go | 10 +++++----- pkg/acl/eacl/filter_test.go | 4 ++-- pkg/acl/eacl/record.go | 2 +- pkg/acl/eacl/record_test.go | 6 +++--- pkg/object/search.go | 4 ++-- v2/acl/convert.go | 8 ++++---- v2/acl/grpc/types.go | 12 ++++++------ v2/acl/marshal.go | 4 ++-- v2/acl/marshal_test.go | 4 ++-- v2/acl/types.go | 10 +++++----- v2/container/marshal_test.go | 2 +- v2/object/convert.go | 4 ++-- v2/object/grpc/service.go | 6 +++--- v2/object/marshal.go | 4 ++-- v2/object/marshal_test.go | 2 +- v2/object/types.go | 10 +++++----- v2/session/marshal_test.go | 2 +- 17 files changed, 47 insertions(+), 47 deletions(-) diff --git a/pkg/acl/eacl/filter.go b/pkg/acl/eacl/filter.go index 8ea8537..29e8128 100644 --- a/pkg/acl/eacl/filter.go +++ b/pkg/acl/eacl/filter.go @@ -8,7 +8,7 @@ import ( // header means that request should be processed according to EACL action. type Filter struct { from FilterHeaderType - name string + key string matcher Match value string } @@ -21,8 +21,8 @@ func (a Filter) Matcher() Match { return a.matcher } -func (a Filter) Name() string { - return a.name +func (a Filter) Key() string { + return a.key } func (a Filter) From() FilterHeaderType { @@ -32,7 +32,7 @@ func (a Filter) From() FilterHeaderType { func (a *Filter) ToV2() *v2acl.HeaderFilter { filter := new(v2acl.HeaderFilter) filter.SetValue(a.value) - filter.SetName(a.name) + filter.SetKey(a.key) filter.SetMatchType(a.matcher.ToV2()) filter.SetHeaderType(a.from.ToV2()) @@ -48,7 +48,7 @@ func NewFilterFromV2(filter *v2acl.HeaderFilter) *Filter { f.from = FilterHeaderTypeFromV2(filter.GetHeaderType()) f.matcher = MatchFromV2(filter.GetMatchType()) - f.name = filter.GetName() + f.key = filter.GetKey() f.value = filter.GetValue() return f diff --git a/pkg/acl/eacl/filter_test.go b/pkg/acl/eacl/filter_test.go index a38d392..0fa874d 100644 --- a/pkg/acl/eacl/filter_test.go +++ b/pkg/acl/eacl/filter_test.go @@ -10,7 +10,7 @@ import ( func TestFilter(t *testing.T) { filter := &Filter{ from: HeaderFromObject, - name: "some name", + key: "some name", matcher: MatchStringEqual, value: "200", } @@ -19,7 +19,7 @@ func TestFilter(t *testing.T) { require.NotNil(t, v2) require.Equal(t, v2acl.HeaderTypeObject, v2.GetHeaderType()) require.EqualValues(t, v2acl.MatchTypeStringEqual, v2.GetMatchType()) - require.Equal(t, filter.Name(), v2.GetName()) + require.Equal(t, filter.Key(), v2.GetKey()) require.Equal(t, filter.Value(), v2.GetValue()) newFilter := NewFilterFromV2(v2) diff --git a/pkg/acl/eacl/record.go b/pkg/acl/eacl/record.go index 9c46d2f..f0792b7 100644 --- a/pkg/acl/eacl/record.go +++ b/pkg/acl/eacl/record.go @@ -57,7 +57,7 @@ func (r *Record) AddTarget(role Role, keys ...ecdsa.PublicKey) { func (r *Record) AddFilter(from FilterHeaderType, matcher Match, name, value string) { filter := Filter{ from: from, - name: name, + key: name, matcher: matcher, value: value, } diff --git a/pkg/acl/eacl/record_test.go b/pkg/acl/eacl/record_test.go index c91042c..428794a 100644 --- a/pkg/acl/eacl/record_test.go +++ b/pkg/acl/eacl/record_test.go @@ -62,13 +62,13 @@ func TestRecord_AddFilter(t *testing.T) { filters := []Filter{ { from: HeaderFromObject, - name: "some name", + key: "some name", matcher: MatchStringEqual, value: "ContainerID", }, { from: HeaderFromRequest, - name: "X-Header-Name", + key: "X-Header-Name", matcher: MatchStringNotEqual, value: "X-Header-Value", }, @@ -76,7 +76,7 @@ func TestRecord_AddFilter(t *testing.T) { r := NewRecord() for _, filter := range filters { - r.AddFilter(filter.From(), filter.Matcher(), filter.Name(), filter.Value()) + r.AddFilter(filter.From(), filter.Matcher(), filter.Key(), filter.Value()) } require.Equal(t, filters, r.Filters()) diff --git a/pkg/object/search.go b/pkg/object/search.go index e17d35b..2f1571d 100644 --- a/pkg/object/search.go +++ b/pkg/object/search.go @@ -64,7 +64,7 @@ func NewSearchFiltersFromV2(v2 []*v2object.SearchFilter) SearchFilters { } filters = append(filters, SearchFilter{ - header: v2[i].GetName(), + header: v2[i].GetKey(), value: v2[i].GetValue(), op: SearchMatchFromV2(v2[i].GetMatchType()), }) @@ -89,7 +89,7 @@ func (f SearchFilters) ToV2() []*v2object.SearchFilter { result := make([]*v2object.SearchFilter, 0, len(f)) for i := range f { v2 := new(v2object.SearchFilter) - v2.SetName(f[i].header) + v2.SetKey(f[i].header) v2.SetValue(f[i].value) v2.SetMatchType(f[i].op.ToV2()) diff --git a/v2/acl/convert.go b/v2/acl/convert.go index 0a005fe..462baa7 100644 --- a/v2/acl/convert.go +++ b/v2/acl/convert.go @@ -165,8 +165,8 @@ func HeaderFilterToGRPCMessage(f *HeaderFilter) *acl.EACLRecord_Filter { MatchTypeToGRPCField(f.GetMatchType()), ) - m.SetHeaderName(f.GetName()) - m.SetHeaderVal(f.GetValue()) + m.SetKey(f.GetKey()) + m.SetValue(f.GetValue()) return m } @@ -187,8 +187,8 @@ func HeaderFilterFromGRPCMessage(m *acl.EACLRecord_Filter) *HeaderFilter { MatchTypeFromGRPCField(m.GetMatchType()), ) - f.SetName(m.GetHeaderName()) - f.SetValue(m.GetHeaderVal()) + f.SetKey(m.GetKey()) + f.SetValue(m.GetValue()) return f } diff --git a/v2/acl/grpc/types.go b/v2/acl/grpc/types.go index 341b760..bfb28ed 100644 --- a/v2/acl/grpc/types.go +++ b/v2/acl/grpc/types.go @@ -67,17 +67,17 @@ func (m *EACLRecord_Filter) SetMatchType(v MatchType) { } } -// SetHeaderName sets header name of the eACL filter. -func (m *EACLRecord_Filter) SetHeaderName(v string) { +// SetKey sets key of the eACL filter. +func (m *EACLRecord_Filter) SetKey(v string) { if m != nil { - m.HeaderName = v + m.Key = v } } -// SetHeaderVal sets header value of the eACL filter. -func (m *EACLRecord_Filter) SetHeaderVal(v string) { +// SetValue sets value of the eACL filter. +func (m *EACLRecord_Filter) SetValue(v string) { if m != nil { - m.HeaderVal = v + m.Value = v } } diff --git a/v2/acl/marshal.go b/v2/acl/marshal.go index 95b2e7d..a87bfc8 100644 --- a/v2/acl/marshal.go +++ b/v2/acl/marshal.go @@ -193,7 +193,7 @@ func (f *HeaderFilter) StableMarshal(buf []byte) ([]byte, error) { offset += n - n, err = proto.StringMarshal(filterNameField, buf[offset:], f.name) + n, err = proto.StringMarshal(filterNameField, buf[offset:], f.key) if err != nil { return nil, err } @@ -216,7 +216,7 @@ func (f *HeaderFilter) StableSize() (size int) { size += proto.EnumSize(filterHeaderTypeField, int32(f.hdrType)) size += proto.EnumSize(filterMatchTypeField, int32(f.matchType)) - size += proto.StringSize(filterNameField, f.name) + size += proto.StringSize(filterNameField, f.key) size += proto.StringSize(filterValueField, f.value) return size diff --git a/v2/acl/marshal_test.go b/v2/acl/marshal_test.go index 70f3a81..4727a2f 100644 --- a/v2/acl/marshal_test.go +++ b/v2/acl/marshal_test.go @@ -29,7 +29,7 @@ func generateFilter(t acl.HeaderType, k, v string) *acl.HeaderFilter { filter := new(acl.HeaderFilter) filter.SetHeaderType(t) filter.SetMatchType(acl.MatchTypeStringEqual) - filter.SetName(k) + filter.SetKey(k) filter.SetValue(v) return filter @@ -122,7 +122,7 @@ func TestHeaderFilter_StableMarshal(t *testing.T) { t.Run("non empty", func(t *testing.T) { filterFrom.SetHeaderType(acl.HeaderTypeObject) filterFrom.SetMatchType(acl.MatchTypeStringEqual) - filterFrom.SetName("Hello") + filterFrom.SetKey("Hello") filterFrom.SetValue("World") wire, err := filterFrom.StableMarshal(nil) diff --git a/v2/acl/types.go b/v2/acl/types.go index e5ed3a2..f777531 100644 --- a/v2/acl/types.go +++ b/v2/acl/types.go @@ -9,7 +9,7 @@ type HeaderFilter struct { matchType MatchType - name, value string + key, value string } // Target is a unified structure of Target @@ -139,17 +139,17 @@ func (f *HeaderFilter) SetMatchType(v MatchType) { } } -func (f *HeaderFilter) GetName() string { +func (f *HeaderFilter) GetKey() string { if f != nil { - return f.name + return f.key } return "" } -func (f *HeaderFilter) SetName(v string) { +func (f *HeaderFilter) SetKey(v string) { if f != nil { - f.name = v + f.key = v } } diff --git a/v2/container/marshal_test.go b/v2/container/marshal_test.go index 5a2668c..6bbab9c 100644 --- a/v2/container/marshal_test.go +++ b/v2/container/marshal_test.go @@ -364,7 +364,7 @@ func generateEACL(n int, k, v string) *acl.Table { filter := new(acl.HeaderFilter) filter.SetHeaderType(acl.HeaderTypeObject) filter.SetMatchType(acl.MatchTypeStringEqual) - filter.SetName(k) + filter.SetKey(k) filter.SetValue(v) record := new(acl.Record) diff --git a/v2/object/convert.go b/v2/object/convert.go index a18d43f..51a2cd8 100644 --- a/v2/object/convert.go +++ b/v2/object/convert.go @@ -1118,7 +1118,7 @@ func SearchFilterToGRPCMessage(f *SearchFilter) *object.SearchRequest_Body_Filte MatchTypeToGRPCField(f.GetMatchType()), ) - m.SetName(f.GetName()) + m.SetKey(f.GetKey()) m.SetValue(f.GetValue()) @@ -1136,7 +1136,7 @@ func SearchFilterFromGRPCMessage(m *object.SearchRequest_Body_Filter) *SearchFil MatchTypeFromGRPCField(m.GetMatchType()), ) - f.SetName(m.GetName()) + f.SetKey(m.GetKey()) f.SetValue(m.GetValue()) diff --git a/v2/object/grpc/service.go b/v2/object/grpc/service.go index 025af1c..aefa5b4 100644 --- a/v2/object/grpc/service.go +++ b/v2/object/grpc/service.go @@ -402,10 +402,10 @@ func (m *SearchRequest_Body_Filter) SetMatchType(v MatchType) { } } -// SetName sets name of the filtering header. -func (m *SearchRequest_Body_Filter) SetName(v string) { +// SetKey sets key to the filtering header. +func (m *SearchRequest_Body_Filter) SetKey(v string) { if m != nil { - m.Name = v + m.Key = v } } diff --git a/v2/object/marshal.go b/v2/object/marshal.go index a79e454..43d4749 100644 --- a/v2/object/marshal.go +++ b/v2/object/marshal.go @@ -937,7 +937,7 @@ func (f *SearchFilter) StableMarshal(buf []byte) ([]byte, error) { offset += n - n, err = proto.StringMarshal(searchFilterNameField, buf[offset:], f.name) + n, err = proto.StringMarshal(searchFilterNameField, buf[offset:], f.key) if err != nil { return nil, err } @@ -958,7 +958,7 @@ func (f *SearchFilter) StableSize() (size int) { } size += proto.EnumSize(searchFilterMatchField, int32(f.matchType)) - size += proto.StringSize(searchFilterNameField, f.name) + size += proto.StringSize(searchFilterNameField, f.key) size += proto.StringSize(searchFilterValueField, f.val) return size diff --git a/v2/object/marshal_test.go b/v2/object/marshal_test.go index c3315f5..616c3c1 100644 --- a/v2/object/marshal_test.go +++ b/v2/object/marshal_test.go @@ -608,7 +608,7 @@ func generateHeadResponseBody(flag bool) *object.HeadResponseBody { func generateFilter(k, v string) *object.SearchFilter { f := new(object.SearchFilter) - f.SetName(k) + f.SetKey(k) f.SetValue(v) f.SetMatchType(object.MatchStringEqual) diff --git a/v2/object/types.go b/v2/object/types.go index 5c6c9ac..d5b37ef 100644 --- a/v2/object/types.go +++ b/v2/object/types.go @@ -156,7 +156,7 @@ type HeadResponseBody struct { type SearchFilter struct { matchType MatchType - name, val string + key, val string } type SearchRequestBody struct { @@ -1274,17 +1274,17 @@ func (f *SearchFilter) SetMatchType(v MatchType) { } } -func (f *SearchFilter) GetName() string { +func (f *SearchFilter) GetKey() string { if f != nil { - return f.name + return f.key } return "" } -func (f *SearchFilter) SetName(v string) { +func (f *SearchFilter) SetKey(v string) { if f != nil { - f.name = v + f.key = v } } diff --git a/v2/session/marshal_test.go b/v2/session/marshal_test.go index 5164f79..8e35d86 100644 --- a/v2/session/marshal_test.go +++ b/v2/session/marshal_test.go @@ -295,7 +295,7 @@ func generateEACL(n int, k, v string) *acl.Table { filter := new(acl.HeaderFilter) filter.SetHeaderType(acl.HeaderTypeObject) filter.SetMatchType(acl.MatchTypeStringEqual) - filter.SetName(k) + filter.SetKey(k) filter.SetValue(v) record := new(acl.Record) From 31b1bed5d78b840a17e71569f8fa65e5e34af6df Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 27 Oct 2020 18:11:36 +0300 Subject: [PATCH 0492/1196] [#182] v2/object: Define reserved search filter keys Signed-off-by: Leonard Lyubich --- v2/object/filters.go | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 v2/object/filters.go diff --git a/v2/object/filters.go b/v2/object/filters.go new file mode 100644 index 0000000..24209af --- /dev/null +++ b/v2/object/filters.go @@ -0,0 +1,44 @@ +package object + +// ReservedFilterPrefix is a prefix of key to object header value or property. +const ReservedFilterPrefix = "$Object:" + +const ( + // FilterHeaderVersion is a filter key to "version" field of the object header. + FilterHeaderVersion = ReservedFilterPrefix + "version" + + // FilterHeaderContainerID is a filter key to "container_id" field of the object header. + FilterHeaderContainerID = ReservedFilterPrefix + "containerID" + + // FilterHeaderOwnerID is a filter key to "owner_id" field of the object header. + FilterHeaderOwnerID = ReservedFilterPrefix + "ownerID" + + // FilterHeaderCreationEpoch is a filter key to "creation_epoch" field of the object header. + FilterHeaderCreationEpoch = ReservedFilterPrefix + "creationEpoch" + + // FilterHeaderPayloadLength is a filter key to "payload_length" field of the object header. + FilterHeaderPayloadLength = ReservedFilterPrefix + "payloadLength" + + // FilterHeaderPayloadHash is a filter key to "payload_hash" field of the object header. + FilterHeaderPayloadHash = ReservedFilterPrefix + "payloadHash" + + // FilterHeaderObjectType is a filter key to "object_type" field of the object header. + FilterHeaderObjectType = ReservedFilterPrefix + "objectType" + + // FilterHeaderHomomorphicHash is a filter key to "homomorphic_hash" field of the object header. + FilterHeaderHomomorphicHash = ReservedFilterPrefix + "homomorphicHash" + + // FilterHeaderParent is a filter key to "split.parent" field of the object header. + FilterHeaderParent = ReservedFilterPrefix + "split.parent" +) + +const ( + // FilterPropertyRoot is a filter key to check if an object is a top object in a split hierarchy. + FilterPropertyRoot = ReservedFilterPrefix + "ROOT" + + // FilterPropertyLeaf is a filter key to check if an object is a leaf in a split hierarchy. + FilterPropertyLeaf = ReservedFilterPrefix + "LEAF" + + // FilterPropertyChildfree is a filter key to check if an object has empty children list in `Split` header. + FilterPropertyChildfree = ReservedFilterPrefix + "CHILDFREE" +) From 309c39481e0a090cf33f160cd4243352cfa01ba8 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 27 Oct 2020 18:13:14 +0300 Subject: [PATCH 0493/1196] [#182] v2/acl: Define filter keys for object headers Signed-off-by: Leonard Lyubich --- v2/acl/filters.go | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 v2/acl/filters.go diff --git a/v2/acl/filters.go b/v2/acl/filters.go new file mode 100644 index 0000000..8b73f42 --- /dev/null +++ b/v2/acl/filters.go @@ -0,0 +1,33 @@ +package acl + +// ObjectFilterPrefix is a prefix of key to object header value or property. +const ObjectFilterPrefix = "$Object:" + +const ( + // FilterObjectVersion is a filter key to "version" field of the object header. + FilterObjectVersion = ObjectFilterPrefix + "version" + + // FilterObjectContainerID is a filter key to "container_id" field of the object header. + FilterObjectContainerID = ObjectFilterPrefix + "containerID" + + // FilterObjectOwnerID is a filter key to "owner_id" field of the object header. + FilterObjectOwnerID = ObjectFilterPrefix + "ownerID" + + // FilterObjectCreationEpoch is a filter key to "creation_epoch" field of the object header. + FilterObjectCreationEpoch = ObjectFilterPrefix + "creationEpoch" + + // FilterObjectPayloadLength is a filter key to "payload_length" field of the object header. + FilterObjectPayloadLength = ObjectFilterPrefix + "payloadLength" + + // FilterObjectPayloadHash is a filter key to "payload_hash" field of the object header. + FilterObjectPayloadHash = ObjectFilterPrefix + "payloadHash" + + // FilterObjectType is a filter key to "object_type" field of the object header. + FilterObjectType = ObjectFilterPrefix + "objectType" + + // FilterObjectHomomorphicHash is a filter key to "homomorphic_hash" field of the object header. + FilterObjectHomomorphicHash = ObjectFilterPrefix + "homomorphicHash" + + // FilterObjectParent is a filter key to "split.parent" field of the object header. + FilterObjectParent = ObjectFilterPrefix + "split.parent" +) From 6f45f713c17faf99017aebd68fff2176af03ad94 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 27 Oct 2020 20:20:01 +0300 Subject: [PATCH 0494/1196] [#182] sdk/eacl: Implement convenient methods for adding object filters Signed-off-by: Leonard Lyubich --- pkg/acl/eacl/filter.go | 68 ++++++++++++++++++++++++++++++++----- pkg/acl/eacl/filter_test.go | 18 ++++++---- pkg/acl/eacl/record.go | 47 ++++++++++++++++++++++--- pkg/acl/eacl/record_test.go | 14 ++------ 4 files changed, 116 insertions(+), 31 deletions(-) diff --git a/pkg/acl/eacl/filter.go b/pkg/acl/eacl/filter.go index 29e8128..1771b95 100644 --- a/pkg/acl/eacl/filter.go +++ b/pkg/acl/eacl/filter.go @@ -1,6 +1,8 @@ package eacl import ( + "fmt" + v2acl "github.com/nspcc-dev/neofs-api-go/v2/acl" ) @@ -8,13 +10,40 @@ import ( // header means that request should be processed according to EACL action. type Filter struct { from FilterHeaderType - key string + key filterKey matcher Match - value string + value fmt.Stringer +} + +type staticStringer string + +type filterKey struct { + typ filterKeyType + + str string +} + +// enumeration of reserved filter keys. +type filterKeyType int + +const ( + _ filterKeyType = iota + fKeyObjVersion + fKeyObjContainerID + fKeyObjOwnerID + fKeyObjCreationEpoch + fKeyObjPayloadLength + fKeyObjPayloadHash + fKeyObjType + fKeyObjHomomorphicHash +) + +func (s staticStringer) String() string { + return string(s) } func (a Filter) Value() string { - return a.value + return a.value.String() } func (a Filter) Matcher() Match { @@ -22,7 +51,7 @@ func (a Filter) Matcher() Match { } func (a Filter) Key() string { - return a.key + return a.key.String() } func (a Filter) From() FilterHeaderType { @@ -31,14 +60,37 @@ func (a Filter) From() FilterHeaderType { func (a *Filter) ToV2() *v2acl.HeaderFilter { filter := new(v2acl.HeaderFilter) - filter.SetValue(a.value) - filter.SetKey(a.key) + filter.SetValue(a.value.String()) + filter.SetKey(a.key.String()) filter.SetMatchType(a.matcher.ToV2()) filter.SetHeaderType(a.from.ToV2()) return filter } +func (k filterKey) String() string { + switch k.typ { + default: + return k.str + case fKeyObjVersion: + return v2acl.FilterObjectVersion + case fKeyObjContainerID: + return v2acl.FilterObjectContainerID + case fKeyObjOwnerID: + return v2acl.FilterObjectOwnerID + case fKeyObjCreationEpoch: + return v2acl.FilterObjectCreationEpoch + case fKeyObjPayloadLength: + return v2acl.FilterObjectPayloadLength + case fKeyObjPayloadHash: + return v2acl.FilterObjectPayloadHash + case fKeyObjType: + return v2acl.FilterObjectType + case fKeyObjHomomorphicHash: + return v2acl.FilterObjectHomomorphicHash + } +} + func NewFilterFromV2(filter *v2acl.HeaderFilter) *Filter { f := new(Filter) @@ -48,8 +100,8 @@ func NewFilterFromV2(filter *v2acl.HeaderFilter) *Filter { f.from = FilterHeaderTypeFromV2(filter.GetHeaderType()) f.matcher = MatchFromV2(filter.GetMatchType()) - f.key = filter.GetKey() - f.value = filter.GetValue() + f.key.str = filter.GetKey() + f.value = staticStringer(filter.GetValue()) return f } diff --git a/pkg/acl/eacl/filter_test.go b/pkg/acl/eacl/filter_test.go index 0fa874d..f87033c 100644 --- a/pkg/acl/eacl/filter_test.go +++ b/pkg/acl/eacl/filter_test.go @@ -7,13 +7,19 @@ import ( "github.com/stretchr/testify/require" ) -func TestFilter(t *testing.T) { - filter := &Filter{ - from: HeaderFromObject, - key: "some name", - matcher: MatchStringEqual, - value: "200", +func newObjectFilter(match Match, key, val string) *Filter { + return &Filter{ + from: HeaderFromObject, + key: filterKey{ + str: key, + }, + matcher: match, + value: staticStringer(val), } +} + +func TestFilter(t *testing.T) { + filter := newObjectFilter(MatchStringEqual, "some name", "200") v2 := filter.ToV2() require.NotNil(t, v2) diff --git a/pkg/acl/eacl/record.go b/pkg/acl/eacl/record.go index f0792b7..126652e 100644 --- a/pkg/acl/eacl/record.go +++ b/pkg/acl/eacl/record.go @@ -2,7 +2,11 @@ package eacl import ( "crypto/ecdsa" + "fmt" + "github.com/nspcc-dev/neofs-api-go/pkg" + "github.com/nspcc-dev/neofs-api-go/pkg/container" + "github.com/nspcc-dev/neofs-api-go/pkg/owner" v2acl "github.com/nspcc-dev/neofs-api-go/v2/acl" ) @@ -54,17 +58,50 @@ func (r *Record) AddTarget(role Role, keys ...ecdsa.PublicKey) { r.targets = append(r.targets, t) } -func (r *Record) AddFilter(from FilterHeaderType, matcher Match, name, value string) { +func (r *Record) addFilter(from FilterHeaderType, m Match, keyTyp filterKeyType, key string, val fmt.Stringer) { filter := Filter{ - from: from, - key: name, - matcher: matcher, - value: value, + from: from, + key: filterKey{ + typ: keyTyp, + str: key, + }, + matcher: m, + value: val, } r.filters = append(r.filters, filter) } +func (r *Record) addObjectFilter(m Match, keyTyp filterKeyType, key string, val fmt.Stringer) { + r.addFilter(HeaderFromObject, m, keyTyp, key, val) +} + +func (r *Record) addObjectReservedFilter(m Match, typ filterKeyType, val fmt.Stringer) { + r.addObjectFilter(m, typ, "", val) +} + +func (r *Record) AddFilter(from FilterHeaderType, matcher Match, name, value string) { + r.addFilter(from, matcher, 0, name, staticStringer(value)) +} + +func (r *Record) AddObjectAttributeFilter(m Match, key, value string) { + r.addObjectFilter(m, 0, key, staticStringer(value)) +} + +func (r *Record) AddObjectVersionFilter(m Match, v *pkg.Version) { + r.addObjectReservedFilter(m, fKeyObjVersion, v) +} + +func (r *Record) AddObjectContainerIDFilter(m Match, id *container.ID) { + r.addObjectReservedFilter(m, fKeyObjContainerID, id) +} + +func (r *Record) AddObjectOwnerIDFilter(m Match, id *owner.ID) { + r.addObjectReservedFilter(m, fKeyObjOwnerID, id) +} + +// TODO: add remaining filters after neofs-api#72 + func (r *Record) ToV2() *v2acl.Record { targets := make([]*v2acl.Target, 0, len(r.targets)) for _, target := range r.targets { diff --git a/pkg/acl/eacl/record_test.go b/pkg/acl/eacl/record_test.go index 428794a..7cddd2e 100644 --- a/pkg/acl/eacl/record_test.go +++ b/pkg/acl/eacl/record_test.go @@ -60,18 +60,8 @@ func TestRecord_AddTarget(t *testing.T) { func TestRecord_AddFilter(t *testing.T) { filters := []Filter{ - { - from: HeaderFromObject, - key: "some name", - matcher: MatchStringEqual, - value: "ContainerID", - }, - { - from: HeaderFromRequest, - key: "X-Header-Name", - matcher: MatchStringNotEqual, - value: "X-Header-Value", - }, + *newObjectFilter(MatchStringEqual, "some name", "ContainerID"), + *newObjectFilter(MatchStringNotEqual, "X-Header-Name", "X-Header-Value"), } r := NewRecord() From 88c8c08c6b188ecb04f014adf5fbdb70cf6d79fa Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 27 Oct 2020 20:39:41 +0300 Subject: [PATCH 0495/1196] [#182] sdk/object: Implement methods for adding object search filters Signed-off-by: Leonard Lyubich --- pkg/object/search.go | 111 +++++++++++++++++++++++++++++++++++++------ 1 file changed, 96 insertions(+), 15 deletions(-) diff --git a/pkg/object/search.go b/pkg/object/search.go index 2f1571d..dcf7cc9 100644 --- a/pkg/object/search.go +++ b/pkg/object/search.go @@ -1,6 +1,11 @@ package object import ( + "fmt" + + "github.com/nspcc-dev/neofs-api-go/pkg" + "github.com/nspcc-dev/neofs-api-go/pkg/container" + "github.com/nspcc-dev/neofs-api-go/pkg/owner" v2object "github.com/nspcc-dev/neofs-api-go/v2/object" ) @@ -33,19 +38,72 @@ func SearchMatchFromV2(t v2object.MatchType) (m SearchMatchType) { } type SearchFilter struct { - header string - value string + header filterKey + value fmt.Stringer op SearchMatchType } +type staticStringer string + +type filterKey struct { + typ filterKeyType + + str string +} + +// enumeration of reserved filter keys. +type filterKeyType int + type SearchFilters []SearchFilter +const ( + _ filterKeyType = iota + fKeyVersion + fKeyContainerID + fKeyOwnerID + fKeyCreationEpoch + fKeyPayloadLength + fKeyPayloadHash + fKeyType + fKeyHomomorphicHash + fKeyParent +) + +func (k filterKey) String() string { + switch k.typ { + default: + return k.str + case fKeyVersion: + return v2object.FilterHeaderVersion + case fKeyContainerID: + return v2object.FilterHeaderContainerID + case fKeyOwnerID: + return v2object.FilterHeaderOwnerID + case fKeyCreationEpoch: + return v2object.FilterHeaderCreationEpoch + case fKeyPayloadLength: + return v2object.FilterHeaderPayloadLength + case fKeyPayloadHash: + return v2object.FilterHeaderPayloadHash + case fKeyType: + return v2object.FilterHeaderObjectType + case fKeyHomomorphicHash: + return v2object.FilterHeaderHomomorphicHash + case fKeyParent: + return v2object.FilterHeaderParent + } +} + +func (s staticStringer) String() string { + return string(s) +} + func (f *SearchFilter) Header() string { - return f.header + return f.header.String() } func (f *SearchFilter) Value() string { - return f.value + return f.value.String() } func (f *SearchFilter) Operation() SearchMatchType { @@ -63,34 +121,57 @@ func NewSearchFiltersFromV2(v2 []*v2object.SearchFilter) SearchFilters { continue } - filters = append(filters, SearchFilter{ - header: v2[i].GetKey(), - value: v2[i].GetValue(), - op: SearchMatchFromV2(v2[i].GetMatchType()), - }) + filters.AddFilter( + v2[i].GetKey(), + v2[i].GetValue(), + SearchMatchFromV2(v2[i].GetMatchType()), + ) } return filters } -func (f *SearchFilters) AddFilter(header, value string, op SearchMatchType) { +func (f *SearchFilters) addFilter(op SearchMatchType, keyTyp filterKeyType, key string, val fmt.Stringer) { if *f == nil { *f = make(SearchFilters, 0, 1) } *f = append(*f, SearchFilter{ - header: header, - value: value, - op: op, + header: filterKey{ + typ: keyTyp, + str: key, + }, + value: val, + op: op, }) } +func (f *SearchFilters) AddFilter(header, value string, op SearchMatchType) { + f.addFilter(op, 0, header, staticStringer(value)) +} + +func (f *SearchFilters) addReservedFilter(op SearchMatchType, keyTyp filterKeyType, val fmt.Stringer) { + f.addFilter(op, keyTyp, "", val) +} + +func (f *SearchFilters) AddObjectVersionFilter(op SearchMatchType, v *pkg.Version) { + f.addReservedFilter(op, fKeyVersion, v) +} + +func (f *SearchFilters) AddObjectContainerIDFilter(m SearchMatchType, id *container.ID) { + f.addReservedFilter(m, fKeyContainerID, id) +} + +func (f *SearchFilters) AddObjectOwnerIDFilter(m SearchMatchType, id *owner.ID) { + f.addReservedFilter(m, fKeyOwnerID, id) +} + func (f SearchFilters) ToV2() []*v2object.SearchFilter { result := make([]*v2object.SearchFilter, 0, len(f)) for i := range f { v2 := new(v2object.SearchFilter) - v2.SetKey(f[i].header) - v2.SetValue(f[i].value) + v2.SetKey(f[i].header.String()) + v2.SetValue(f[i].value.String()) v2.SetMatchType(f[i].op.ToV2()) result = append(result, v2) From 6b5401914813664706ddee9d7645e349f61882e8 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 27 Oct 2020 20:51:27 +0300 Subject: [PATCH 0496/1196] [#182] v2/object: Define boolean property values Signed-off-by: Leonard Lyubich --- v2/object/filters.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/v2/object/filters.go b/v2/object/filters.go index 24209af..a9eecbe 100644 --- a/v2/object/filters.go +++ b/v2/object/filters.go @@ -42,3 +42,11 @@ const ( // FilterPropertyChildfree is a filter key to check if an object has empty children list in `Split` header. FilterPropertyChildfree = ReservedFilterPrefix + "CHILDFREE" ) + +const ( + // BooleanPropertyValueTrue is a true value for boolean property filters. + BooleanPropertyValueTrue = "true" + + // BooleanPropertyValueFalse is a false value for boolean property filters. + BooleanPropertyValueFalse = "" +) From ac38d13f04ff7f4c1680f82675108945f3f8c489 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 27 Oct 2020 21:11:58 +0300 Subject: [PATCH 0497/1196] [#182] sdk/object: Refactor a way to add filters by properties Signed-off-by: Leonard Lyubich --- pkg/object/search.go | 47 +++++++++++++++++++++++++++------ pkg/object/search_test.go | 17 ++++++------ pkg/object/wellknown_filters.go | 31 ---------------------- pkg/object/wellknown_headers.go | 31 ---------------------- 4 files changed, 47 insertions(+), 79 deletions(-) delete mode 100644 pkg/object/wellknown_filters.go delete mode 100644 pkg/object/wellknown_headers.go diff --git a/pkg/object/search.go b/pkg/object/search.go index dcf7cc9..ac83220 100644 --- a/pkg/object/search.go +++ b/pkg/object/search.go @@ -54,6 +54,8 @@ type filterKey struct { // enumeration of reserved filter keys. type filterKeyType int +type boolStringer bool + type SearchFilters []SearchFilter const ( @@ -67,6 +69,9 @@ const ( fKeyType fKeyHomomorphicHash fKeyParent + fKeyPropRoot + fKeyPropLeaf + fKeyPropChildfree ) func (k filterKey) String() string { @@ -91,6 +96,12 @@ func (k filterKey) String() string { return v2object.FilterHeaderHomomorphicHash case fKeyParent: return v2object.FilterHeaderParent + case fKeyPropRoot: + return v2object.FilterPropertyRoot + case fKeyPropLeaf: + return v2object.FilterPropertyLeaf + case fKeyPropChildfree: + return v2object.FilterPropertyChildfree } } @@ -98,6 +109,14 @@ func (s staticStringer) String() string { return string(s) } +func (s boolStringer) String() string { + if s { + return v2object.BooleanPropertyValueTrue + } + + return v2object.BooleanPropertyValueFalse +} + func (f *SearchFilter) Header() string { return f.header.String() } @@ -180,26 +199,38 @@ func (f SearchFilters) ToV2() []*v2object.SearchFilter { return result } -func (f *SearchFilters) addRootFilter(val string) { - f.AddFilter(KeyRoot, val, MatchStringEqual) +func (f *SearchFilters) addRootFilter(val bool) { + f.addReservedFilter(MatchStringEqual, fKeyPropRoot, boolStringer(val)) } func (f *SearchFilters) AddRootFilter() { - f.addRootFilter(ValRoot) + f.addRootFilter(true) } func (f *SearchFilters) AddNonRootFilter() { - f.addRootFilter(ValNonRoot) + f.addRootFilter(false) } -func (f *SearchFilters) addLeafFilter(val string) { - f.AddFilter(KeyLeaf, val, MatchStringEqual) +func (f *SearchFilters) addLeafFilter(val bool) { + f.addReservedFilter(MatchStringEqual, fKeyPropLeaf, boolStringer(val)) } func (f *SearchFilters) AddLeafFilter() { - f.addLeafFilter(ValLeaf) + f.addLeafFilter(true) } func (f *SearchFilters) AddNonLeafFilter() { - f.addLeafFilter(ValNonLeaf) + f.addLeafFilter(false) +} + +func (f *SearchFilters) addChildFreeFilter(val bool) { + f.addReservedFilter(MatchStringEqual, fKeyPropChildfree, boolStringer(val)) +} + +func (f *SearchFilters) AddChildfreeFilter() { + f.addChildFreeFilter(true) +} + +func (f *SearchFilters) AddNonChildfreeFilter() { + f.addChildFreeFilter(false) } diff --git a/pkg/object/search_test.go b/pkg/object/search_test.go index d3916ad..8abce4b 100644 --- a/pkg/object/search_test.go +++ b/pkg/object/search_test.go @@ -32,7 +32,6 @@ func TestMatch(t *testing.T) { func TestFilter(t *testing.T) { inputs := [][]string{ {"user-header", "user-value"}, - {object.HdrSysNameID, "objectID"}, } filters := object.NewSearchFilters() @@ -62,8 +61,8 @@ func TestSearchFilters_AddRootFilter(t *testing.T) { f := (*fs)[0] require.Equal(t, object.MatchStringEqual, f.Operation()) - require.Equal(t, object.KeyRoot, f.Header()) - require.Equal(t, object.ValRoot, f.Value()) + require.Equal(t, v2object.FilterPropertyRoot, f.Header()) + require.Equal(t, v2object.BooleanPropertyValueTrue, f.Value()) } func TestSearchFilters_AddNonRootFilter(t *testing.T) { @@ -76,8 +75,8 @@ func TestSearchFilters_AddNonRootFilter(t *testing.T) { f := (*fs)[0] require.Equal(t, object.MatchStringEqual, f.Operation()) - require.Equal(t, object.KeyRoot, f.Header()) - require.Equal(t, object.ValNonRoot, f.Value()) + require.Equal(t, v2object.FilterPropertyRoot, f.Header()) + require.Equal(t, v2object.BooleanPropertyValueFalse, f.Value()) } func TestSearchFilters_AddLeafFilter(t *testing.T) { @@ -90,8 +89,8 @@ func TestSearchFilters_AddLeafFilter(t *testing.T) { f := (*fs)[0] require.Equal(t, object.MatchStringEqual, f.Operation()) - require.Equal(t, object.KeyLeaf, f.Header()) - require.Equal(t, object.ValLeaf, f.Value()) + require.Equal(t, v2object.FilterPropertyLeaf, f.Header()) + require.Equal(t, v2object.BooleanPropertyValueTrue, f.Value()) } func TestSearchFilters_AddNonLeafFilter(t *testing.T) { @@ -104,6 +103,6 @@ func TestSearchFilters_AddNonLeafFilter(t *testing.T) { f := (*fs)[0] require.Equal(t, object.MatchStringEqual, f.Operation()) - require.Equal(t, object.KeyLeaf, f.Header()) - require.Equal(t, object.ValNonLeaf, f.Value()) + require.Equal(t, v2object.FilterPropertyLeaf, f.Header()) + require.Equal(t, v2object.BooleanPropertyValueFalse, f.Value()) } diff --git a/pkg/object/wellknown_filters.go b/pkg/object/wellknown_filters.go deleted file mode 100644 index 734a196..0000000 --- a/pkg/object/wellknown_filters.go +++ /dev/null @@ -1,31 +0,0 @@ -package object - -const ( - valFalse = "false" - valTrue = "true" -) - -// ReservedFilterPrefix is a reserved prefix for system search filter keys. -const ReservedFilterPrefix = "$Object:" - -const ( - // KeyRoot is a reserved search filter key to source objects. - KeyRoot = ReservedFilterPrefix + "ROOT" - - // ValRoot is a value of root object filter. - ValRoot = valTrue - - // ValNonRoot is a value of non-root object filter. - ValNonRoot = valFalse -) - -const ( - // KeyLeaf is a reserved search filter key to physically stored objects. - KeyLeaf = ReservedFilterPrefix + "LEAF" - - // ValLeaf is a value of physically stored object filter. - ValLeaf = valTrue - - // ValNonLeaf is a value of virtual object filter. - ValNonLeaf = valFalse -) diff --git a/pkg/object/wellknown_headers.go b/pkg/object/wellknown_headers.go deleted file mode 100644 index 02e2e78..0000000 --- a/pkg/object/wellknown_headers.go +++ /dev/null @@ -1,31 +0,0 @@ -package object - -// This file contains well-known header names for eACL filters and search -// request filters. Both of them encode header type as string. There are -// constant strings for well-known object headers. - -const ( - // ReservedHeaderNamePrefix used in filter names to specify well known - // headers such as container id, object id, owner id, etc. - // All names without this prefix used to lookup through user defined headers - // in object or x-headers in request. - ReservedHeaderNamePrefix = "_" - - // HdrSysNameID is a name of ID field in system header of object. - HdrSysNameID = ReservedHeaderNamePrefix + "ID" - - // HdrSysNameCID is a name of cid field in system header of object. - HdrSysNameCID = ReservedHeaderNamePrefix + "CID" - - // HdrSysNameOwnerID is a name of OwnerID field in system header of object. - HdrSysNameOwnerID = ReservedHeaderNamePrefix + "OWNER_ID" - - // HdrSysNameVersion is a name of version field in system header of object. - HdrSysNameVersion = ReservedHeaderNamePrefix + "VERSION" - - // HdrSysNamePayloadLength is a name of PayloadLength field in system header of object. - HdrSysNamePayloadLength = ReservedHeaderNamePrefix + "PAYLOAD_LENGTH" - - // HdrSysNameCreatedEpoch is a name of CreatedAt.Epoch field in system header of object. - HdrSysNameCreatedEpoch = ReservedHeaderNamePrefix + "CREATED_EPOCH" -) From 352e99d9b91a90f66a18d330a23454719b11bdcb Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Wed, 28 Oct 2020 15:10:54 +0300 Subject: [PATCH 0498/1196] [#185] v2: Return errors in JSON converters Signed-off-by: Alex Vanin --- v2/acl/json.go | 63 +++++++++++++++++---------------------- v2/acl/json_test.go | 40 +++++++++++++++++-------- v2/container/json.go | 25 ++++++++-------- v2/container/json_test.go | 16 +++++++--- v2/netmap/json.go | 25 ++++++++-------- v2/netmap/json_test.go | 16 +++++++--- 6 files changed, 105 insertions(+), 80 deletions(-) diff --git a/v2/acl/json.go b/v2/acl/json.go index bb70fe6..d9bbb45 100644 --- a/v2/acl/json.go +++ b/v2/acl/json.go @@ -1,93 +1,84 @@ package acl import ( + "errors" + acl "github.com/nspcc-dev/neofs-api-go/v2/acl/grpc" "google.golang.org/protobuf/encoding/protojson" ) -func RecordToJSON(r *Record) (data []byte) { +var ( + errEmptyInput = errors.New("empty input") +) + +func RecordToJSON(r *Record) ([]byte, error) { if r == nil { - return nil + return nil, errEmptyInput } msg := RecordToGRPCMessage(r) - data, err := protojson.MarshalOptions{EmitUnpopulated: true}.Marshal(msg) - if err != nil { - return nil - } - - return + return protojson.MarshalOptions{EmitUnpopulated: true}.Marshal(msg) } -func RecordFromJSON(data []byte) *Record { +func RecordFromJSON(data []byte) (*Record, error) { if len(data) == 0 { - return nil + return nil, errEmptyInput } msg := new(acl.EACLRecord) if err := protojson.Unmarshal(data, msg); err != nil { - return nil + return nil, err } - return RecordFromGRPCMessage(msg) + return RecordFromGRPCMessage(msg), nil } -func TableToJSON(t *Table) (data []byte) { +func TableToJSON(t *Table) ([]byte, error) { if t == nil { - return nil + return nil, errEmptyInput } msg := TableToGRPCMessage(t) - data, err := protojson.MarshalOptions{EmitUnpopulated: true}.Marshal(msg) - if err != nil { - return nil - } - - return + return protojson.MarshalOptions{EmitUnpopulated: true}.Marshal(msg) } -func TableFromJSON(data []byte) *Table { +func TableFromJSON(data []byte) (*Table, error) { if len(data) == 0 { - return nil + return nil, errEmptyInput } msg := new(acl.EACLTable) if err := protojson.Unmarshal(data, msg); err != nil { - return nil + return nil, err } - return TableFromGRPCMessage(msg) + return TableFromGRPCMessage(msg), nil } -func BearerTokenToJSON(t *BearerToken) (data []byte) { +func BearerTokenToJSON(t *BearerToken) ([]byte, error) { if t == nil { - return nil + return nil, errEmptyInput } msg := BearerTokenToGRPCMessage(t) - data, err := protojson.MarshalOptions{EmitUnpopulated: true}.Marshal(msg) - if err != nil { - return nil - } - - return + return protojson.MarshalOptions{EmitUnpopulated: true}.Marshal(msg) } -func BearerTokenFromJSON(data []byte) *BearerToken { +func BearerTokenFromJSON(data []byte) (*BearerToken, error) { if len(data) == 0 { - return nil + return nil, errEmptyInput } msg := new(acl.BearerToken) if err := protojson.Unmarshal(data, msg); err != nil { - return nil + return nil, err } - return BearerTokenFromGRPCMessage(msg) + return BearerTokenFromGRPCMessage(msg), nil } diff --git a/v2/acl/json_test.go b/v2/acl/json_test.go index 046141c..9d9e67e 100644 --- a/v2/acl/json_test.go +++ b/v2/acl/json_test.go @@ -11,39 +11,55 @@ func TestRecordJSON(t *testing.T) { exp := generateRecord(false) t.Run("non empty", func(t *testing.T) { - data := acl.RecordToJSON(exp) - require.NotNil(t, data) + data, err := acl.RecordToJSON(exp) + require.NoError(t, err) - got := acl.RecordFromJSON(data) - require.NotNil(t, got) + got, err := acl.RecordFromJSON(data) + require.NoError(t, err) require.Equal(t, exp, got) }) + + t.Run("empty", func(t *testing.T) { + _, err := acl.RecordToJSON(nil) + require.Error(t, err) + + _, err = acl.RecordFromJSON(nil) + require.Error(t, err) + }) } func TestEACLTableJSON(t *testing.T) { exp := generateEACL() t.Run("non empty", func(t *testing.T) { - data := acl.TableToJSON(exp) - require.NotNil(t, data) + data, err := acl.TableToJSON(exp) + require.NoError(t, err) - got := acl.TableFromJSON(data) - require.NotNil(t, got) + got, err := acl.TableFromJSON(data) + require.NoError(t, err) require.Equal(t, exp, got) }) + + t.Run("empty", func(t *testing.T) { + _, err := acl.TableToJSON(nil) + require.Error(t, err) + + _, err = acl.TableFromJSON(nil) + require.Error(t, err) + }) } func TestBearerTokenJSON(t *testing.T) { exp := generateBearerToken("token") t.Run("non empty", func(t *testing.T) { - data := acl.BearerTokenToJSON(exp) - require.NotNil(t, data) + data, err := acl.BearerTokenToJSON(exp) + require.NoError(t, err) - got := acl.BearerTokenFromJSON(data) - require.NotNil(t, got) + got, err := acl.BearerTokenFromJSON(data) + require.NoError(t, err) require.Equal(t, exp, got) }) diff --git a/v2/container/json.go b/v2/container/json.go index d425353..b8bfc7a 100644 --- a/v2/container/json.go +++ b/v2/container/json.go @@ -1,35 +1,36 @@ package container import ( + "errors" + container "github.com/nspcc-dev/neofs-api-go/v2/container/grpc" "google.golang.org/protobuf/encoding/protojson" ) -func ContainerToJSON(c *Container) (data []byte) { +var ( + errEmptyInput = errors.New("empty input") +) + +func ContainerToJSON(c *Container) ([]byte, error) { if c == nil { - return nil + return nil, errEmptyInput } msg := ContainerToGRPCMessage(c) - data, err := protojson.MarshalOptions{EmitUnpopulated: true}.Marshal(msg) - if err != nil { - return nil - } - - return + return protojson.MarshalOptions{EmitUnpopulated: true}.Marshal(msg) } -func ContainerFromJSON(data []byte) *Container { +func ContainerFromJSON(data []byte) (*Container, error) { if len(data) == 0 { - return nil + return nil, errEmptyInput } msg := new(container.Container) if err := protojson.Unmarshal(data, msg); err != nil { - return nil + return nil, err } - return ContainerFromGRPCMessage(msg) + return ContainerFromGRPCMessage(msg), nil } diff --git a/v2/container/json_test.go b/v2/container/json_test.go index 5a3f551..cbba965 100644 --- a/v2/container/json_test.go +++ b/v2/container/json_test.go @@ -11,12 +11,20 @@ func TestContainerJSON(t *testing.T) { exp := generateContainer("container") t.Run("non empty", func(t *testing.T) { - data := container.ContainerToJSON(exp) - require.NotNil(t, data) + data, err := container.ContainerToJSON(exp) + require.NoError(t, err) - got := container.ContainerFromJSON(data) - require.NotNil(t, got) + got, err := container.ContainerFromJSON(data) + require.NoError(t, err) require.Equal(t, exp, got) }) + + t.Run("empty", func(t *testing.T) { + _, err := container.ContainerToJSON(nil) + require.Error(t, err) + + _, err = container.ContainerFromJSON(nil) + require.Error(t, err) + }) } diff --git a/v2/netmap/json.go b/v2/netmap/json.go index 7fec579..cfe4dbf 100644 --- a/v2/netmap/json.go +++ b/v2/netmap/json.go @@ -1,35 +1,36 @@ package netmap import ( + "errors" + netmap "github.com/nspcc-dev/neofs-api-go/v2/netmap/grpc" "google.golang.org/protobuf/encoding/protojson" ) -func NodeInfoToJSON(n *NodeInfo) (data []byte) { +var ( + errEmptyInput = errors.New("empty input") +) + +func NodeInfoToJSON(n *NodeInfo) ([]byte, error) { if n == nil { - return nil + return nil, errEmptyInput } msg := NodeInfoToGRPCMessage(n) - data, err := protojson.MarshalOptions{EmitUnpopulated: true}.Marshal(msg) - if err != nil { - return nil - } - - return + return protojson.MarshalOptions{EmitUnpopulated: true}.Marshal(msg) } -func NodeInfoFromJSON(data []byte) *NodeInfo { +func NodeInfoFromJSON(data []byte) (*NodeInfo, error) { if len(data) == 0 { - return nil + return nil, errEmptyInput } msg := new(netmap.NodeInfo) if err := protojson.Unmarshal(data, msg); err != nil { - return nil + return nil, err } - return NodeInfoFromGRPCMessage(msg) + return NodeInfoFromGRPCMessage(msg), nil } diff --git a/v2/netmap/json_test.go b/v2/netmap/json_test.go index 2dae126..528fb3e 100644 --- a/v2/netmap/json_test.go +++ b/v2/netmap/json_test.go @@ -11,12 +11,20 @@ func TestNodeInfoJSON(t *testing.T) { exp := generateNodeInfo("public key", "/multi/addr", 2) t.Run("non empty", func(t *testing.T) { - data := netmap.NodeInfoToJSON(exp) - require.NotNil(t, data) + data, err := netmap.NodeInfoToJSON(exp) + require.NoError(t, err) - got := netmap.NodeInfoFromJSON(data) - require.NotNil(t, got) + got, err := netmap.NodeInfoFromJSON(data) + require.NoError(t, err) require.Equal(t, exp, got) }) + + t.Run("empty", func(t *testing.T) { + _, err := netmap.NodeInfoToJSON(nil) + require.Error(t, err) + + _, err = netmap.NodeInfoFromJSON(nil) + require.Error(t, err) + }) } From 89a7a946dcd500b01b772a2f418c8adf0ea9a5bd Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 3 Nov 2020 11:29:41 +0300 Subject: [PATCH 0499/1196] [#187] sdk: Implement IsSupportedVersion function Implement function that checks the compatibility of the specified version with the current NeoFS revision. Signed-off-by: Leonard Lyubich --- pkg/version.go | 17 +++++++++++++++++ pkg/version_test.go | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) diff --git a/pkg/version.go b/pkg/version.go index 6ffc54c..a1c8316 100644 --- a/pkg/version.go +++ b/pkg/version.go @@ -4,6 +4,7 @@ import ( "fmt" "github.com/nspcc-dev/neofs-api-go/v2/refs" + "github.com/pkg/errors" ) // Version represents v2-compatible version. @@ -65,3 +66,19 @@ func (v *Version) ToV2() *refs.Version { func (v *Version) String() string { return fmt.Sprintf("v%d.%d", v.GetMajor(), v.GetMinor()) } + +// IsSupportedVersion returns error if v is not supported by current SDK. +func IsSupportedVersion(v *Version) error { + switch mjr := v.GetMajor(); mjr { + case 2: + switch mnr := v.GetMinor(); mnr { + case 0: + return nil + } + } + + return errors.Errorf("unsupported version %d.%d", + v.GetMajor(), + v.GetMinor(), + ) +} diff --git a/pkg/version_test.go b/pkg/version_test.go index 18e842a..a5cc7fa 100644 --- a/pkg/version_test.go +++ b/pkg/version_test.go @@ -29,3 +29,36 @@ func TestSDKVersion(t *testing.T) { require.Equal(t, uint32(sdkMjr), v.GetMajor()) require.Equal(t, uint32(sdkMnr), v.GetMinor()) } + +func TestIsSupportedVersion(t *testing.T) { + require.Error(t, IsSupportedVersion(nil)) + + v := NewVersion() + + v.SetMajor(1) + require.Error(t, IsSupportedVersion(v)) + + v.SetMajor(3) + require.Error(t, IsSupportedVersion(v)) + + for _, item := range []struct { + mjr, maxMnr uint32 + }{ + { + mjr: 2, + maxMnr: 0, + }, + } { + v.SetMajor(item.mjr) + + for i := uint32(0); i < item.maxMnr; i++ { + v.SetMinor(i) + + require.NoError(t, IsSupportedVersion(v)) + } + + v.SetMinor(item.maxMnr + 1) + + require.Error(t, IsSupportedVersion(v)) + } +} From 2b171e161721b1dbc2776c076df7a25b5fea8747 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 3 Nov 2020 18:59:57 +0300 Subject: [PATCH 0500/1196] [#188] sdk: Implement Epoch method Implement Epoch method on Client that receives epoch number through Netmap .LocalNodeInfo call. Signed-off-by: Leonard Lyubich --- pkg/client/netmap.go | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/pkg/client/netmap.go b/pkg/client/netmap.go index 515d130..d8a66d2 100644 --- a/pkg/client/netmap.go +++ b/pkg/client/netmap.go @@ -15,13 +15,33 @@ import ( func (c Client) EndpointInfo(ctx context.Context, opts ...CallOption) (*netmap.NodeInfo, error) { switch c.remoteNode.Version.GetMajor() { case 2: - return c.endpointInfoV2(ctx, opts...) + resp, err := c.endpointInfoV2(ctx, opts...) + if err != nil { + return nil, err + } + + return resp.GetBody().GetNodeInfo(), nil default: return nil, unsupportedProtocolErr } } -func (c Client) endpointInfoV2(ctx context.Context, opts ...CallOption) (*netmap.NodeInfo, error) { +// Epoch returns the epoch number from the local state of the remote host. +func (c Client) Epoch(ctx context.Context, opts ...CallOption) (uint64, error) { + switch c.remoteNode.Version.GetMajor() { + case 2: + resp, err := c.endpointInfoV2(ctx, opts...) + if err != nil { + return 0, err + } + + return resp.GetMetaHeader().GetEpoch(), nil + default: + return 0, unsupportedProtocolErr + } +} + +func (c Client) endpointInfoV2(ctx context.Context, opts ...CallOption) (*netmap.LocalNodeInfoResponse, error) { // apply all available options callOptions := c.defaultCallOptions() for i := range opts { @@ -56,7 +76,7 @@ func (c Client) endpointInfoV2(ctx context.Context, opts ...CallOption) (*netmap return nil, errors.Wrap(err, "can't verify response message") } - return resp.GetBody().GetNodeInfo(), nil + return resp, nil default: return nil, unsupportedProtocolErr } From e4d94bbe0306bdebdc1f8e315a2c6a915809ce8b Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Thu, 29 Oct 2020 20:13:07 +0300 Subject: [PATCH 0501/1196] [#186] v2/netmap: Add JSON converter for placement policy Signed-off-by: Alex Vanin --- go.mod | 1 + go.sum | 3 +++ v2/netmap/json.go | 24 ++++++++++++++++++++++++ v2/netmap/json_test.go | 22 ++++++++++++++++++++++ 4 files changed, 50 insertions(+) diff --git a/go.mod b/go.mod index 6ea4d69..49151e1 100644 --- a/go.mod +++ b/go.mod @@ -3,6 +3,7 @@ module github.com/nspcc-dev/neofs-api-go go 1.14 require ( + github.com/alecthomas/participle v0.6.0 github.com/golang/protobuf v1.4.3 github.com/google/uuid v1.1.1 github.com/mr-tron/base58 v1.1.2 diff --git a/go.sum b/go.sum index 163f26c..612803a 100644 --- a/go.sum +++ b/go.sum @@ -11,6 +11,9 @@ github.com/Workiva/go-datastructures v1.0.50/go.mod h1:Z+F2Rca0qCsVYDS8z7bAGm8f3 github.com/abiosoft/ishell v2.0.0+incompatible/go.mod h1:HQR9AqF2R3P4XXpMpI0NAzgHf/aS6+zVXRj14cVk9qg= github.com/abiosoft/readline v0.0.0-20180607040430-155bce2042db/go.mod h1:rB3B4rKii8V21ydCbIzH5hZiCQE7f5E9SzUb/ZZx530= github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= +github.com/alecthomas/participle v0.6.0 h1:Pvo8XUCQKgIywVjz/+Ci3IsjGg+g/TdKkMcfgghKCEw= +github.com/alecthomas/participle v0.6.0/go.mod h1:HfdmEuwvr12HXQN44HPWXR0lHmVolVYe4dyL6lQ3duY= +github.com/alecthomas/repr v0.0.0-20181024024818-d37bc2a10ba1/go.mod h1:xTS7Pm1pD1mvyM075QCDSRqH6qRLXylzS24ZTpRiSzQ= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= diff --git a/v2/netmap/json.go b/v2/netmap/json.go index cfe4dbf..03c79f7 100644 --- a/v2/netmap/json.go +++ b/v2/netmap/json.go @@ -34,3 +34,27 @@ func NodeInfoFromJSON(data []byte) (*NodeInfo, error) { return NodeInfoFromGRPCMessage(msg), nil } + +func PlacementPolicyToJSON(n *PlacementPolicy) ([]byte, error) { + if n == nil { + return nil, errEmptyInput + } + + msg := PlacementPolicyToGRPCMessage(n) + + return protojson.MarshalOptions{EmitUnpopulated: true}.Marshal(msg) +} + +func PlacementPolicyFromJSON(data []byte) (*PlacementPolicy, error) { + if len(data) == 0 { + return nil, errEmptyInput + } + + msg := new(netmap.PlacementPolicy) + + if err := protojson.Unmarshal(data, msg); err != nil { + return nil, err + } + + return PlacementPolicyFromGRPCMessage(msg), nil +} diff --git a/v2/netmap/json_test.go b/v2/netmap/json_test.go index 528fb3e..34abad1 100644 --- a/v2/netmap/json_test.go +++ b/v2/netmap/json_test.go @@ -28,3 +28,25 @@ func TestNodeInfoJSON(t *testing.T) { require.Error(t, err) }) } + +func TestPlacementPolicyJSON(t *testing.T) { + exp := generatePolicy(3) + + t.Run("non empty", func(t *testing.T) { + data, err := netmap.PlacementPolicyToJSON(exp) + require.NoError(t, err) + + got, err := netmap.PlacementPolicyFromJSON(data) + require.NoError(t, err) + + require.Equal(t, exp, got) + }) + + t.Run("empty", func(t *testing.T) { + _, err := netmap.PlacementPolicyToJSON(nil) + require.Error(t, err) + + _, err = netmap.PlacementPolicyFromJSON(nil) + require.Error(t, err) + }) +} From 3fb3cfd1a59acc036793744507be07a177030b63 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Mon, 2 Nov 2020 18:17:15 +0300 Subject: [PATCH 0502/1196] [#186] sdk/netmap: Use JSON placement policy converters in SDK Signed-off-by: Alex Vanin --- pkg/netmap/policy.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pkg/netmap/policy.go b/pkg/netmap/policy.go index 3a3e45a..3ed5cc3 100644 --- a/pkg/netmap/policy.go +++ b/pkg/netmap/policy.go @@ -11,3 +11,11 @@ type Filter = netmap.Filter type Replica = netmap.Replica type Clause = netmap.Clause type Operation = netmap.Operation + +func PlacementPolicyToJSON(p *PlacementPolicy) ([]byte, error) { + return netmap.PlacementPolicyToJSON(p) +} + +func PlacementPolicyFromJSON(data []byte) (*PlacementPolicy, error) { + return netmap.PlacementPolicyFromJSON(data) +} From e4111ff3e7a42d61bd0934b78bf9a9cbd4e64015 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 5 Nov 2020 19:31:23 +0300 Subject: [PATCH 0503/1196] [#190] sdk/object: Implement AddParentIDFilter method on SearchFilters Signed-off-by: Leonard Lyubich --- pkg/object/search.go | 4 ++++ pkg/object/search_test.go | 28 ++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/pkg/object/search.go b/pkg/object/search.go index ac83220..23eeb2c 100644 --- a/pkg/object/search.go +++ b/pkg/object/search.go @@ -234,3 +234,7 @@ func (f *SearchFilters) AddChildfreeFilter() { func (f *SearchFilters) AddNonChildfreeFilter() { f.addChildFreeFilter(false) } + +func (f *SearchFilters) AddParentIDFilter(m SearchMatchType, id *ID) { + f.addReservedFilter(m, fKeyParent, id) +} diff --git a/pkg/object/search_test.go b/pkg/object/search_test.go index 8abce4b..e126b5b 100644 --- a/pkg/object/search_test.go +++ b/pkg/object/search_test.go @@ -1,6 +1,8 @@ package object_test import ( + "crypto/rand" + "crypto/sha256" "testing" "github.com/nspcc-dev/neofs-api-go/pkg/object" @@ -106,3 +108,29 @@ func TestSearchFilters_AddNonLeafFilter(t *testing.T) { require.Equal(t, v2object.FilterPropertyLeaf, f.Header()) require.Equal(t, v2object.BooleanPropertyValueFalse, f.Value()) } + +func testOID() *object.ID { + cs := [sha256.Size]byte{} + + rand.Read(cs[:]) + + id := object.NewID() + id.SetSHA256(cs) + + return id +} + +func TestSearchFilters_AddParentIDFilter(t *testing.T) { + par := testOID() + + fs := object.SearchFilters{} + fs.AddParentIDFilter(object.MatchStringEqual, par) + + fsV2 := fs.ToV2() + + require.Len(t, fsV2, 1) + + require.Equal(t, v2object.FilterHeaderParent, fsV2[0].GetKey()) + require.Equal(t, par.String(), fsV2[0].GetValue()) + require.Equal(t, v2object.MatchStringEqual, fsV2[0].GetMatchType()) +} From 6d8612fd51fec57c5375a894e5b40020578a0072 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 5 Nov 2020 12:03:26 +0300 Subject: [PATCH 0504/1196] [#189] sdk/netmap: Refactor Operation enum Replace alias to v2 type Operation with v2-compatible implementation. Signed-off-by: Leonard Lyubich --- pkg/netmap/operation.go | 107 +++++++++++++++++++++++++++++++++++ pkg/netmap/operation_test.go | 55 ++++++++++++++++++ pkg/netmap/policy.go | 1 - 3 files changed, 162 insertions(+), 1 deletion(-) create mode 100644 pkg/netmap/operation.go create mode 100644 pkg/netmap/operation_test.go diff --git a/pkg/netmap/operation.go b/pkg/netmap/operation.go new file mode 100644 index 0000000..2a8281c --- /dev/null +++ b/pkg/netmap/operation.go @@ -0,0 +1,107 @@ +package netmap + +import ( + "github.com/nspcc-dev/neofs-api-go/v2/netmap" +) + +// Operation is an enumeration of v2-compatible filtering operations. +type Operation uint32 + +const ( + _ Operation = iota + + // OpEQ is an "Equal" operation. + OpEQ + + // OpNE is a "Not equal" operation. + OpNE + + // OpGT is a "Greater than" operation. + OpGT + + // OpGE is a "Greater than or equal to" operation. + OpGE + + // OpLT is a "Less than" operation. + OpLT + + // OpLE is a "Less than or equal to" operation. + OpLE + + // OpOR is an "OR" operation. + OpOR + + // OpAND is an "AND" operation. + OpAND +) + +// OperationFromV2 converts v2 Operation to Operation. +func OperationFromV2(op netmap.Operation) Operation { + switch op { + default: + return 0 + case netmap.OR: + return OpOR + case netmap.AND: + return OpAND + case netmap.GE: + return OpGE + case netmap.GT: + return OpGT + case netmap.LE: + return OpLE + case netmap.LT: + return OpLT + case netmap.EQ: + return OpEQ + case netmap.NE: + return OpNE + } +} + +// ToV2 converts Operation to v2 Operation. +func (op Operation) ToV2() netmap.Operation { + switch op { + default: + return netmap.UnspecifiedOperation + case OpOR: + return netmap.OR + case OpAND: + return netmap.AND + case OpGE: + return netmap.GE + case OpGT: + return netmap.GT + case OpLE: + return netmap.LE + case OpLT: + return netmap.LT + case OpEQ: + return netmap.EQ + case OpNE: + return netmap.NE + } +} + +func (op Operation) String() string { + switch op { + default: + return "UNSPECIFIED" + case OpNE: + return "NE" + case OpEQ: + return "EQ" + case OpLT: + return "LT" + case OpLE: + return "LE" + case OpGT: + return "GT" + case OpGE: + return "GE" + case OpAND: + return "AND" + case OpOR: + return "OR" + } +} diff --git a/pkg/netmap/operation_test.go b/pkg/netmap/operation_test.go new file mode 100644 index 0000000..c60479b --- /dev/null +++ b/pkg/netmap/operation_test.go @@ -0,0 +1,55 @@ +package netmap + +import ( + "testing" + + "github.com/nspcc-dev/neofs-api-go/v2/netmap" + "github.com/stretchr/testify/require" +) + +func TestOperationFromV2(t *testing.T) { + for _, item := range []struct { + op Operation + opV2 netmap.Operation + }{ + { + op: 0, + opV2: netmap.UnspecifiedOperation, + }, + { + op: OpEQ, + opV2: netmap.EQ, + }, + { + op: OpNE, + opV2: netmap.NE, + }, + { + op: OpOR, + opV2: netmap.OR, + }, + { + op: OpAND, + opV2: netmap.AND, + }, + { + op: OpLE, + opV2: netmap.LE, + }, + { + op: OpLT, + opV2: netmap.LT, + }, + { + op: OpGT, + opV2: netmap.GT, + }, + { + op: OpGE, + opV2: netmap.GE, + }, + } { + require.Equal(t, item.op, OperationFromV2(item.opV2)) + require.Equal(t, item.opV2, item.op.ToV2()) + } +} diff --git a/pkg/netmap/policy.go b/pkg/netmap/policy.go index 3ed5cc3..be5c6e8 100644 --- a/pkg/netmap/policy.go +++ b/pkg/netmap/policy.go @@ -10,7 +10,6 @@ type Selector = netmap.Selector type Filter = netmap.Filter type Replica = netmap.Replica type Clause = netmap.Clause -type Operation = netmap.Operation func PlacementPolicyToJSON(p *PlacementPolicy) ([]byte, error) { return netmap.PlacementPolicyToJSON(p) From 8c1afc6bab688cd225c9377c90721f6b47958ce3 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 5 Nov 2020 12:24:19 +0300 Subject: [PATCH 0505/1196] [#189] sdk/netmap: Refactor Clause enum Replace alias to v2 type Clause with v2-compatible implementation. Signed-off-by: Leonard Lyubich --- pkg/netmap/clause.go | 54 +++++++++++++++++++++++++++++++++++++++ pkg/netmap/clause_test.go | 31 ++++++++++++++++++++++ pkg/netmap/policy.go | 1 - 3 files changed, 85 insertions(+), 1 deletion(-) create mode 100644 pkg/netmap/clause.go create mode 100644 pkg/netmap/clause_test.go diff --git a/pkg/netmap/clause.go b/pkg/netmap/clause.go new file mode 100644 index 0000000..87b4e47 --- /dev/null +++ b/pkg/netmap/clause.go @@ -0,0 +1,54 @@ +package netmap + +import ( + "github.com/nspcc-dev/neofs-api-go/v2/netmap" +) + +// Clause is an enumeration of selector modifiers +// that shows how the node set will be formed. +type Clause uint32 + +const ( + _ Clause = iota + + // ClauseSame is a selector modifier to select only nodes having the same value of bucket attribute. + ClauseSame + + // ClauseDistinct is a selector modifier to select nodes having different values of bucket attribute. + ClauseDistinct +) + +// ClauseFromV2 converts v2 Clause to Clause. +func ClauseFromV2(c netmap.Clause) Clause { + switch c { + default: + return 0 + case netmap.Same: + return ClauseSame + case netmap.Distinct: + return ClauseDistinct + } +} + +// ToV2 converts Clause to v2 Clause. +func (c Clause) ToV2() netmap.Clause { + switch c { + default: + return netmap.UnspecifiedClause + case ClauseDistinct: + return netmap.Distinct + case ClauseSame: + return netmap.Same + } +} + +func (c Clause) String() string { + switch c { + default: + return "UNSPECIFIED" + case ClauseDistinct: + return "DISTINCT" + case ClauseSame: + return "SAME" + } +} diff --git a/pkg/netmap/clause_test.go b/pkg/netmap/clause_test.go new file mode 100644 index 0000000..fd3a464 --- /dev/null +++ b/pkg/netmap/clause_test.go @@ -0,0 +1,31 @@ +package netmap + +import ( + "testing" + + "github.com/nspcc-dev/neofs-api-go/v2/netmap" + "github.com/stretchr/testify/require" +) + +func TestClauseFromV2(t *testing.T) { + for _, item := range []struct { + c Clause + cV2 netmap.Clause + }{ + { + c: 0, + cV2: netmap.UnspecifiedClause, + }, + { + c: ClauseSame, + cV2: netmap.Same, + }, + { + c: ClauseDistinct, + cV2: netmap.Distinct, + }, + } { + require.Equal(t, item.c, ClauseFromV2(item.cV2)) + require.Equal(t, item.cV2, item.c.ToV2()) + } +} diff --git a/pkg/netmap/policy.go b/pkg/netmap/policy.go index be5c6e8..736cdff 100644 --- a/pkg/netmap/policy.go +++ b/pkg/netmap/policy.go @@ -9,7 +9,6 @@ type PlacementPolicy = netmap.PlacementPolicy type Selector = netmap.Selector type Filter = netmap.Filter type Replica = netmap.Replica -type Clause = netmap.Clause func PlacementPolicyToJSON(p *PlacementPolicy) ([]byte, error) { return netmap.PlacementPolicyToJSON(p) From fd0c10b832016d8156d2d9225e724e0b6bbdc4a4 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 5 Nov 2020 13:02:31 +0300 Subject: [PATCH 0506/1196] [#189] sdk/netmap: Refactor Filter type Replace alias to v2 type Filter with v2-compatible implementation. Signed-off-by: Leonard Lyubich --- pkg/netmap/filter.go | 94 +++++++++++++++++++++++++++++++++++++++ pkg/netmap/filter_test.go | 68 ++++++++++++++++++++++++++++ pkg/netmap/policy.go | 1 - 3 files changed, 162 insertions(+), 1 deletion(-) diff --git a/pkg/netmap/filter.go b/pkg/netmap/filter.go index e4df979..50492ec 100644 --- a/pkg/netmap/filter.go +++ b/pkg/netmap/filter.go @@ -7,6 +7,9 @@ import ( "github.com/nspcc-dev/neofs-api-go/v2/netmap" ) +// Filter represents v2-compatible netmap filter. +type Filter netmap.Filter + // MainFilterName is a name of the filter // which points to the whole netmap. const MainFilterName = "*" @@ -127,3 +130,94 @@ func (c *Context) matchKeyValue(f *netmap.Filter, b *Node) bool { // will not happen if context was created from f (maybe panic?) return false } + +// NewFilter creates and returns new Filter instance. +func NewFilter() *Filter { + return NewFilterFromV2(new(netmap.Filter)) +} + +// NewFilterFromV2 converts v2 Filter to Filter. +func NewFilterFromV2(f *netmap.Filter) *Filter { + return (*Filter)(f) +} + +// ToV2 converts Filter to v2 Filter. +func (f *Filter) ToV2() *netmap.Filter { + return (*netmap.Filter)(f) +} + +// Key returns key to filter. +func (f *Filter) Key() string { + return (*netmap.Filter)(f). + GetKey() +} + +// SetKey sets key to filter. +func (f *Filter) SetKey(key string) { + (*netmap.Filter)(f). + SetKey(key) +} + +// Value returns value to match. +func (f *Filter) Value() string { + return (*netmap.Filter)(f). + GetValue() +} + +// SetValue sets value to match. +func (f *Filter) SetValue(val string) { + (*netmap.Filter)(f). + SetValue(val) +} + +// Name returns filter name. +func (f *Filter) Name() string { + return (*netmap.Filter)(f). + GetName() +} + +// SetName sets filter name. +func (f *Filter) SetName(name string) { + (*netmap.Filter)(f). + SetName(name) +} + +// Operation returns filtering operation. +func (f *Filter) Operation() Operation { + return OperationFromV2( + (*netmap.Filter)(f). + GetOp(), + ) +} + +// SetOperation sets filtering operation. +func (f *Filter) SetOperation(op Operation) { + (*netmap.Filter)(f). + SetOp(op.ToV2()) +} + +// InnerFilters returns list of inner filters. +func (f *Filter) InnerFilters() []*Filter { + fs := (*netmap.Filter)(f). + GetFilters() + + res := make([]*Filter, 0, len(fs)) + + for i := range fs { + res = append(res, NewFilterFromV2(fs[i])) + } + + return res +} + +// SetInnerFilters sets list of inner filters. +func (f *Filter) SetInnerFilters(fs ...*Filter) { + fsV2 := make([]*netmap.Filter, 0, len(fs)) + + for i := range fs { + fsV2 = append(fsV2, fs[i].ToV2()) + } + + (*netmap.Filter)(f). + SetFilters(fsV2) +} diff --git a/pkg/netmap/filter_test.go b/pkg/netmap/filter_test.go index 82a5445..46c3567 100644 --- a/pkg/netmap/filter_test.go +++ b/pkg/netmap/filter_test.go @@ -201,3 +201,71 @@ func TestFilter_Match(t *testing.T) { require.False(t, c.applyFilter("Main", n)) }) } + +func testFilter() *Filter { + f := NewFilter() + f.SetOperation(OpGE) + f.SetName("name") + f.SetKey("key") + f.SetValue("value") + + return f +} + +func TestFilterFromV2(t *testing.T) { + fV2 := new(netmap.Filter) + fV2.SetOp(netmap.GE) + fV2.SetName("name") + fV2.SetKey("key") + fV2.SetValue("value") + + f := NewFilterFromV2(fV2) + + require.Equal(t, fV2, f.ToV2()) +} + +func TestFilter_Key(t *testing.T) { + f := NewFilter() + key := "some key" + + f.SetKey(key) + + require.Equal(t, key, f.Key()) +} + +func TestFilter_Value(t *testing.T) { + f := NewFilter() + val := "some value" + + f.SetValue(val) + + require.Equal(t, val, f.Value()) +} + +func TestFilter_Name(t *testing.T) { + f := NewFilter() + name := "some name" + + f.SetName(name) + + require.Equal(t, name, f.Name()) +} + +func TestFilter_Operation(t *testing.T) { + f := NewFilter() + op := OpGE + + f.SetOperation(op) + + require.Equal(t, op, f.Operation()) +} + +func TestFilter_InnerFilters(t *testing.T) { + f := NewFilter() + + f1, f2 := testFilter(), testFilter() + + f.SetInnerFilters(f1, f2) + + require.Equal(t, []*Filter{f1, f2}, f.InnerFilters()) +} diff --git a/pkg/netmap/policy.go b/pkg/netmap/policy.go index 736cdff..31ced83 100644 --- a/pkg/netmap/policy.go +++ b/pkg/netmap/policy.go @@ -7,7 +7,6 @@ import ( // fixme: make types instead of aliases to v2 structures type PlacementPolicy = netmap.PlacementPolicy type Selector = netmap.Selector -type Filter = netmap.Filter type Replica = netmap.Replica func PlacementPolicyToJSON(p *PlacementPolicy) ([]byte, error) { From eb96fffa5cabf73c12934d0069ac476b3dda9660 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 5 Nov 2020 13:19:21 +0300 Subject: [PATCH 0507/1196] [#189] sdk/netmap: Refactor Selector type Replace alias to v2 type Selector with v2-compatible implementation. Signed-off-by: Leonard Lyubich --- pkg/netmap/policy.go | 1 - pkg/netmap/selector.go | 80 +++++++++++++++++++++++++++++++++++++ pkg/netmap/selector_test.go | 58 +++++++++++++++++++++++++++ 3 files changed, 138 insertions(+), 1 deletion(-) diff --git a/pkg/netmap/policy.go b/pkg/netmap/policy.go index 31ced83..b0e46d6 100644 --- a/pkg/netmap/policy.go +++ b/pkg/netmap/policy.go @@ -6,7 +6,6 @@ import ( // fixme: make types instead of aliases to v2 structures type PlacementPolicy = netmap.PlacementPolicy -type Selector = netmap.Selector type Replica = netmap.Replica func PlacementPolicyToJSON(p *PlacementPolicy) ([]byte, error) { diff --git a/pkg/netmap/selector.go b/pkg/netmap/selector.go index 30985ac..99fb903 100644 --- a/pkg/netmap/selector.go +++ b/pkg/netmap/selector.go @@ -8,6 +8,9 @@ import ( "github.com/nspcc-dev/neofs-api-go/v2/netmap" ) +// Selector represents v2-compatible netmap selector. +type Selector netmap.Selector + // processSelectors processes selectors and returns error is any of them is invalid. func (c *Context) processSelectors(p *netmap.PlacementPolicy) error { for _, s := range p.GetSelectors() { @@ -118,3 +121,80 @@ func (c *Context) getSelectionBase(s *netmap.Selector) []nodeAttrPair { } return result } + +// NewSelector creates and returns new Selector instance. +func NewSelector() *Selector { + return NewSelectorFromV2(new(netmap.Selector)) +} + +// NewSelectorFromV2 converts v2 Selector to Selector. +func NewSelectorFromV2(f *netmap.Selector) *Selector { + return (*Selector)(f) +} + +// ToV2 converts Selector to v2 Selector. +func (s *Selector) ToV2() *netmap.Selector { + return (*netmap.Selector)(s) +} + +// Name returns selector name. +func (s *Selector) Name() string { + return (*netmap.Selector)(s). + GetName() +} + +// SetName sets selector name. +func (s *Selector) SetName(name string) { + (*netmap.Selector)(s). + SetName(name) +} + +// Count returns count of nodes to select from bucket. +func (s *Selector) Count() uint32 { + return (*netmap.Selector)(s). + GetCount() +} + +// SetCount sets count of nodes to select from bucket. +func (s *Selector) SetCount(c uint32) { + (*netmap.Selector)(s). + SetCount(c) +} + +// Clause returns modifier showing how to form a bucket. +func (s *Selector) Clause() Clause { + return ClauseFromV2( + (*netmap.Selector)(s). + GetClause(), + ) +} + +// SetClause sets modifier showing how to form a bucket. +func (s *Selector) SetClause(c Clause) { + (*netmap.Selector)(s). + SetClause(c.ToV2()) +} + +// Attribute returns attribute bucket to select from. +func (s *Selector) Attribute() string { + return (*netmap.Selector)(s). + GetAttribute() +} + +// SetAttribute sets attribute bucket to select from. +func (s *Selector) SetAttribute(a string) { + (*netmap.Selector)(s). + SetAttribute(a) +} + +// Filter returns filter reference to select from. +func (s *Selector) Filter() string { + return (*netmap.Selector)(s). + GetFilter() +} + +// SetFilter sets filter reference to select from. +func (s *Selector) SetFilter(f string) { + (*netmap.Selector)(s). + SetFilter(f) +} diff --git a/pkg/netmap/selector_test.go b/pkg/netmap/selector_test.go index cf581d0..ee31c75 100644 --- a/pkg/netmap/selector_test.go +++ b/pkg/netmap/selector_test.go @@ -238,3 +238,61 @@ func TestPlacementPolicy_ProcessSelectorsInvalid(t *testing.T) { }) } } + +func TestSelectorFromV2(t *testing.T) { + sV2 := new(netmap.Selector) + sV2.SetName("name") + sV2.SetCount(3) + sV2.SetClause(netmap.Distinct) + sV2.SetAttribute("attribute") + sV2.SetFilter("filter") + + s := NewSelectorFromV2(sV2) + + require.Equal(t, sV2, s.ToV2()) +} + +func TestSelector_Name(t *testing.T) { + s := NewSelector() + name := "some name" + + s.SetName(name) + + require.Equal(t, name, s.Name()) +} + +func TestSelector_Count(t *testing.T) { + s := NewSelector() + c := uint32(3) + + s.SetCount(c) + + require.Equal(t, c, s.Count()) +} + +func TestSelector_Clause(t *testing.T) { + s := NewSelector() + c := ClauseSame + + s.SetClause(c) + + require.Equal(t, c, s.Clause()) +} + +func TestSelector_Attribute(t *testing.T) { + s := NewSelector() + a := "some attribute" + + s.SetAttribute(a) + + require.Equal(t, a, s.Attribute()) +} + +func TestSelector_Filter(t *testing.T) { + s := NewSelector() + f := "some filter" + + s.SetFilter(f) + + require.Equal(t, f, s.Filter()) +} From 6a29d9c360a9baa52ddfa1c21020fdd7dedb7af9 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 5 Nov 2020 13:28:29 +0300 Subject: [PATCH 0508/1196] [#189] sdk/netmap: Refactor Replica type Replace alias to v2 type Replica with v2-compatible implementation. Signed-off-by: Leonard Lyubich --- pkg/netmap/policy.go | 1 - pkg/netmap/replica.go | 47 ++++++++++++++++++++++++++++++++++++++ pkg/netmap/replica_test.go | 36 +++++++++++++++++++++++++++++ 3 files changed, 83 insertions(+), 1 deletion(-) create mode 100644 pkg/netmap/replica.go create mode 100644 pkg/netmap/replica_test.go diff --git a/pkg/netmap/policy.go b/pkg/netmap/policy.go index b0e46d6..cde2a16 100644 --- a/pkg/netmap/policy.go +++ b/pkg/netmap/policy.go @@ -6,7 +6,6 @@ import ( // fixme: make types instead of aliases to v2 structures type PlacementPolicy = netmap.PlacementPolicy -type Replica = netmap.Replica func PlacementPolicyToJSON(p *PlacementPolicy) ([]byte, error) { return netmap.PlacementPolicyToJSON(p) diff --git a/pkg/netmap/replica.go b/pkg/netmap/replica.go new file mode 100644 index 0000000..153a269 --- /dev/null +++ b/pkg/netmap/replica.go @@ -0,0 +1,47 @@ +package netmap + +import ( + "github.com/nspcc-dev/neofs-api-go/v2/netmap" +) + +// Replica represents v2-compatible object replica descriptor. +type Replica netmap.Replica + +// NewReplica creates and returns new Replica instance. +func NewReplica() *Replica { + return NewReplicaFromV2(new(netmap.Replica)) +} + +// NewReplicaFromV2 converts v2 Replica to Replica. +func NewReplicaFromV2(f *netmap.Replica) *Replica { + return (*Replica)(f) +} + +// ToV2 converts Replica to v2 Replica. +func (r *Replica) ToV2() *netmap.Replica { + return (*netmap.Replica)(r) +} + +// Count returns number of object replicas. +func (r *Replica) Count() uint32 { + return (*netmap.Replica)(r). + GetCount() +} + +// SetCount sets number of object replicas. +func (r *Replica) SetCount(c uint32) { + (*netmap.Replica)(r). + SetCount(c) +} + +// Selector returns name of selector bucket to put replicas. +func (r *Replica) Selector() string { + return (*netmap.Replica)(r). + GetSelector() +} + +// SetSelector sets name of selector bucket to put replicas. +func (r *Replica) SetSelector(s string) { + (*netmap.Replica)(r). + SetSelector(s) +} diff --git a/pkg/netmap/replica_test.go b/pkg/netmap/replica_test.go new file mode 100644 index 0000000..b5d4dc0 --- /dev/null +++ b/pkg/netmap/replica_test.go @@ -0,0 +1,36 @@ +package netmap + +import ( + "testing" + + "github.com/nspcc-dev/neofs-api-go/v2/netmap" + "github.com/stretchr/testify/require" +) + +func TestReplicaFromV2(t *testing.T) { + rV2 := new(netmap.Replica) + rV2.SetCount(3) + rV2.SetSelector("selector") + + r := NewReplicaFromV2(rV2) + + require.Equal(t, rV2, r.ToV2()) +} + +func TestReplica_Count(t *testing.T) { + r := NewReplica() + c := uint32(3) + + r.SetCount(c) + + require.Equal(t, c, r.Count()) +} + +func TestReplica_Selector(t *testing.T) { + r := NewReplica() + s := "some selector" + + r.SetSelector(s) + + require.Equal(t, s, r.Selector()) +} From 9f19139999c3fdbbff357b5603d704842ede0f1d Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 5 Nov 2020 14:08:19 +0300 Subject: [PATCH 0509/1196] [#189] sdk/netmap: Refactor PlacementPolicy type Replace alias to v2 type PlacementPolicy with v2-compatible implementation. Signed-off-by: Leonard Lyubich --- pkg/netmap/filter.go | 26 ++++++--- pkg/netmap/policy.go | 108 ++++++++++++++++++++++++++++++++++-- pkg/netmap/policy_test.go | 69 +++++++++++++++++++++++ pkg/netmap/replica_test.go | 8 +++ pkg/netmap/selector_test.go | 11 ++++ 5 files changed, 209 insertions(+), 13 deletions(-) create mode 100644 pkg/netmap/policy_test.go diff --git a/pkg/netmap/filter.go b/pkg/netmap/filter.go index 50492ec..c712fdd 100644 --- a/pkg/netmap/filter.go +++ b/pkg/netmap/filter.go @@ -196,11 +196,7 @@ func (f *Filter) SetOperation(op Operation) { SetOp(op.ToV2()) } -// InnerFilters returns list of inner filters. -func (f *Filter) InnerFilters() []*Filter { - fs := (*netmap.Filter)(f). - GetFilters() - +func filtersFromV2(fs []*netmap.Filter) []*Filter { res := make([]*Filter, 0, len(fs)) for i := range fs { @@ -210,14 +206,26 @@ func (f *Filter) InnerFilters() []*Filter { return res } -// SetInnerFilters sets list of inner filters. -func (f *Filter) SetInnerFilters(fs ...*Filter) { +// InnerFilters returns list of inner filters. +func (f *Filter) InnerFilters() []*Filter { + return filtersFromV2( + (*netmap.Filter)(f). + GetFilters(), + ) +} + +func filtersToV2(fs []*Filter) []*netmap.Filter { fsV2 := make([]*netmap.Filter, 0, len(fs)) for i := range fs { fsV2 = append(fsV2, fs[i].ToV2()) } - (*netmap.Filter)(f). - SetFilters(fsV2) + return fsV2 +} + +// SetInnerFilters sets list of inner filters. +func (f *Filter) SetInnerFilters(fs ...*Filter) { + (*netmap.Filter)(f). + SetFilters(filtersToV2(fs)) } diff --git a/pkg/netmap/policy.go b/pkg/netmap/policy.go index cde2a16..a592573 100644 --- a/pkg/netmap/policy.go +++ b/pkg/netmap/policy.go @@ -4,13 +4,113 @@ import ( "github.com/nspcc-dev/neofs-api-go/v2/netmap" ) -// fixme: make types instead of aliases to v2 structures -type PlacementPolicy = netmap.PlacementPolicy +// PlacementPolicy represents v2-compatible placement policy. +type PlacementPolicy netmap.PlacementPolicy +// PlacementPolicyToJSON encodes PlacementPolicy to JSON format. func PlacementPolicyToJSON(p *PlacementPolicy) ([]byte, error) { - return netmap.PlacementPolicyToJSON(p) + return netmap.PlacementPolicyToJSON(p.ToV2()) } +// PlacementPolicyFromJSON decodes PlacementPolicy from JSON format. func PlacementPolicyFromJSON(data []byte) (*PlacementPolicy, error) { - return netmap.PlacementPolicyFromJSON(data) + p, err := netmap.PlacementPolicyFromJSON(data) + if err != nil { + return nil, err + } + + return NewPlacementPolicyFromV2(p), nil +} + +// NewPlacementPolicy creates and returns new PlacementPolicy instance. +func NewPlacementPolicy() *PlacementPolicy { + return NewPlacementPolicyFromV2(new(netmap.PlacementPolicy)) +} + +// NewPlacementPolicyFromV2 converts v2 PlacementPolicy to PlacementPolicy. +func NewPlacementPolicyFromV2(f *netmap.PlacementPolicy) *PlacementPolicy { + return (*PlacementPolicy)(f) +} + +// ToV2 converts PlacementPolicy to v2 PlacementPolicy. +func (p *PlacementPolicy) ToV2() *netmap.PlacementPolicy { + return (*netmap.PlacementPolicy)(p) +} + +// Replicas returns list of object replica descriptors. +func (p *PlacementPolicy) Replicas() []*Replica { + rs := (*netmap.PlacementPolicy)(p). + GetReplicas() + + res := make([]*Replica, 0, len(rs)) + + for i := range rs { + res = append(res, NewReplicaFromV2(rs[i])) + } + + return res +} + +// SetReplicas sets list of object replica descriptors. +func (p *PlacementPolicy) SetReplicas(rs ...*Replica) { + rsV2 := make([]*netmap.Replica, 0, len(rs)) + + for i := range rs { + rsV2 = append(rsV2, rs[i].ToV2()) + } + + (*netmap.PlacementPolicy)(p). + SetReplicas(rsV2) +} + +// ContainerBackupFactor returns container backup factor. +func (p *PlacementPolicy) ContainerBackupFactor() uint32 { + return (*netmap.PlacementPolicy)(p). + GetContainerBackupFactor() +} + +// SetContainerBackupFactor sets container backup factor. +func (p *PlacementPolicy) SetContainerBackupFactor(f uint32) { + (*netmap.PlacementPolicy)(p). + SetContainerBackupFactor(f) +} + +// Selector returns set of selectors to form the container's nodes subset. +func (p *PlacementPolicy) Selectors() []*Selector { + rs := (*netmap.PlacementPolicy)(p). + GetSelectors() + + res := make([]*Selector, 0, len(rs)) + + for i := range rs { + res = append(res, NewSelectorFromV2(rs[i])) + } + + return res +} + +// SetSelectors sets set of selectors to form the container's nodes subset. +func (p *PlacementPolicy) SetSelectors(ss ...*Selector) { + rsV2 := make([]*netmap.Selector, 0, len(ss)) + + for i := range ss { + rsV2 = append(rsV2, ss[i].ToV2()) + } + + (*netmap.PlacementPolicy)(p). + SetSelectors(rsV2) +} + +// Filters returns list of named filters to reference in selectors. +func (p *PlacementPolicy) Filters() []*Filter { + return filtersFromV2( + (*netmap.PlacementPolicy)(p). + GetFilters(), + ) +} + +// SetFilters sets list of named filters to reference in selectors. +func (p *PlacementPolicy) SetFilters(fs ...*Filter) { + (*netmap.PlacementPolicy)(p). + SetFilters(filtersToV2(fs)) } diff --git a/pkg/netmap/policy_test.go b/pkg/netmap/policy_test.go new file mode 100644 index 0000000..705c875 --- /dev/null +++ b/pkg/netmap/policy_test.go @@ -0,0 +1,69 @@ +package netmap + +import ( + "testing" + + "github.com/nspcc-dev/neofs-api-go/v2/netmap" + "github.com/stretchr/testify/require" +) + +func TestPlacementPolicyFromV2(t *testing.T) { + pV2 := new(netmap.PlacementPolicy) + + pV2.SetReplicas([]*netmap.Replica{ + testReplica().ToV2(), + testReplica().ToV2(), + }) + + pV2.SetContainerBackupFactor(3) + + pV2.SetSelectors([]*netmap.Selector{ + testSelector().ToV2(), + testSelector().ToV2(), + }) + + pV2.SetFilters([]*netmap.Filter{ + testFilter().ToV2(), + testFilter().ToV2(), + }) + + p := NewPlacementPolicyFromV2(pV2) + + require.Equal(t, pV2, p.ToV2()) +} + +func TestPlacementPolicy_Replicas(t *testing.T) { + p := NewPlacementPolicy() + rs := []*Replica{testReplica(), testReplica()} + + p.SetReplicas(rs...) + + require.Equal(t, rs, p.Replicas()) +} + +func TestPlacementPolicy_ContainerBackupFactor(t *testing.T) { + p := NewPlacementPolicy() + f := uint32(3) + + p.SetContainerBackupFactor(f) + + require.Equal(t, f, p.ContainerBackupFactor()) +} + +func TestPlacementPolicy_Selectors(t *testing.T) { + p := NewPlacementPolicy() + ss := []*Selector{testSelector(), testSelector()} + + p.SetSelectors(ss...) + + require.Equal(t, ss, p.Selectors()) +} + +func TestPlacementPolicy_Filters(t *testing.T) { + p := NewPlacementPolicy() + fs := []*Filter{testFilter(), testFilter()} + + p.SetFilters(fs...) + + require.Equal(t, fs, p.Filters()) +} diff --git a/pkg/netmap/replica_test.go b/pkg/netmap/replica_test.go index b5d4dc0..bd7c368 100644 --- a/pkg/netmap/replica_test.go +++ b/pkg/netmap/replica_test.go @@ -7,6 +7,14 @@ import ( "github.com/stretchr/testify/require" ) +func testReplica() *Replica { + r := new(Replica) + r.SetCount(3) + r.SetSelector("selector") + + return r +} + func TestReplicaFromV2(t *testing.T) { rV2 := new(netmap.Replica) rV2.SetCount(3) diff --git a/pkg/netmap/selector_test.go b/pkg/netmap/selector_test.go index ee31c75..5ae4cf4 100644 --- a/pkg/netmap/selector_test.go +++ b/pkg/netmap/selector_test.go @@ -239,6 +239,17 @@ func TestPlacementPolicy_ProcessSelectorsInvalid(t *testing.T) { } } +func testSelector() *Selector { + s := new(Selector) + s.SetName("name") + s.SetCount(3) + s.SetFilter("filter") + s.SetAttribute("attribute") + s.SetClause(ClauseDistinct) + + return s +} + func TestSelectorFromV2(t *testing.T) { sV2 := new(netmap.Selector) sV2.SetName("name") From 53697081ceabc6c8c830860fe0576f2630c788b9 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 5 Nov 2020 14:15:54 +0300 Subject: [PATCH 0510/1196] [#189] sdk: Fix type conflicts after netmap package refactoring Signed-off-by: Leonard Lyubich --- pkg/client/client_test.go | 2 +- pkg/container/container.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/client/client_test.go b/pkg/client/client_test.go index 3aebaab..50b5f56 100644 --- a/pkg/client/client_test.go +++ b/pkg/client/client_test.go @@ -42,7 +42,7 @@ func TestExample(t *testing.T) { policy := new(netmap.PlacementPolicy) policy.SetContainerBackupFactor(2) - policy.SetReplicas([]*netmap.Replica{replica}) + policy.SetReplicas(replica) // this container has random nonce and it does not set owner id cnr := container.New( diff --git a/pkg/container/container.go b/pkg/container/container.go index a14f257..df6732f 100644 --- a/pkg/container/container.go +++ b/pkg/container/container.go @@ -25,7 +25,7 @@ func New(opts ...NewOption) *Container { } if cnrOptions.policy != nil { - cnr.SetPlacementPolicy(cnrOptions.policy) + cnr.SetPlacementPolicy(cnrOptions.policy.ToV2()) } attributes := make([]*container.Attribute, len(cnrOptions.attributes)) From d4f5c27d47e220cddf1fe50a580ef8052269a417 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 5 Nov 2020 14:24:52 +0300 Subject: [PATCH 0511/1196] [#189] sdk/netmap: Implement NodeState enum Signed-off-by: Leonard Lyubich --- pkg/netmap/node_info.go | 48 ++++++++++++++++++++++++++++++++++++ pkg/netmap/node_info_test.go | 23 +++++++++++++++++ 2 files changed, 71 insertions(+) diff --git a/pkg/netmap/node_info.go b/pkg/netmap/node_info.go index 981a930..8db1cae 100644 --- a/pkg/netmap/node_info.go +++ b/pkg/netmap/node_info.go @@ -23,6 +23,19 @@ type ( Nodes []*Node ) +// NodeState is an enumeration of various states of the NeoFS node. +type NodeState uint32 + +const ( + _ NodeState = iota + + // NodeStateOffline is network unavailable state. + NodeStateOffline + + // NodeStateOnline is an active state in the network. + NodeStateOnline +) + // Enumeration of well-known attributes. const ( CapacityAttr = "Capacity" @@ -98,3 +111,38 @@ func GetBucketWeight(ns Nodes, a aggregator, wf weightFunc) float64 { } return a.Compute() } + +// NodeStateFromV2 converts v2 NodeState to NodeState. +func NodeStateFromV2(s netmap.NodeState) NodeState { + switch s { + default: + return 0 + case netmap.Online: + return NodeStateOnline + case netmap.Offline: + return NodeStateOffline + } +} + +// ToV2 converts NodeState to v2 NodeState. +func (s NodeState) ToV2() netmap.NodeState { + switch s { + default: + return netmap.UnspecifiedState + case NodeStateOffline: + return netmap.Offline + case NodeStateOnline: + return netmap.Online + } +} + +func (s NodeState) String() string { + switch s { + default: + return "UNSPECIFIED" + case NodeStateOffline: + return "OFFLINE" + case NodeStateOnline: + return "ONLINE" + } +} diff --git a/pkg/netmap/node_info_test.go b/pkg/netmap/node_info_test.go index 0da6ad2..93d1568 100644 --- a/pkg/netmap/node_info_test.go +++ b/pkg/netmap/node_info_test.go @@ -19,3 +19,26 @@ func TestNode_NetworkAddress(t *testing.T) { require.Equal(t, addr, n.NetworkAddress()) } + +func TestNodeStateFromV2(t *testing.T) { + for _, item := range []struct { + s NodeState + sV2 netmap.NodeState + }{ + { + s: 0, + sV2: netmap.UnspecifiedState, + }, + { + s: NodeStateOnline, + sV2: netmap.Online, + }, + { + s: NodeStateOffline, + sV2: netmap.Offline, + }, + } { + require.Equal(t, item.s, NodeStateFromV2(item.sV2)) + require.Equal(t, item.sV2, item.s.ToV2()) + } +} From 6347f846ebff0b1cc49b099d47939973681b0c8b Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 5 Nov 2020 14:39:50 +0300 Subject: [PATCH 0512/1196] [#189] sdk/netmap: Implement NodeAttribute type Signed-off-by: Leonard Lyubich --- pkg/netmap/node_info.go | 54 ++++++++++++++++++++++++++++++++++++ pkg/netmap/node_info_test.go | 38 +++++++++++++++++++++++++ 2 files changed, 92 insertions(+) diff --git a/pkg/netmap/node_info.go b/pkg/netmap/node_info.go index 8db1cae..2c14de2 100644 --- a/pkg/netmap/node_info.go +++ b/pkg/netmap/node_info.go @@ -26,6 +26,9 @@ type ( // NodeState is an enumeration of various states of the NeoFS node. type NodeState uint32 +// NodeAttribute represents v2 compatible attribute of the NeoFS Storage Node. +type NodeAttribute netmap.Attribute + const ( _ NodeState = iota @@ -146,3 +149,54 @@ func (s NodeState) String() string { return "ONLINE" } } + +// NewNodeAttribute creates and returns new NodeAttribute instance. +func NewNodeAttribute() *NodeAttribute { + return NewNodeAttributeFromV2(new(netmap.Attribute)) +} + +// NodeAttributeFromV2 converts v2 node Attribute to NodeAttribute. +func NewNodeAttributeFromV2(a *netmap.Attribute) *NodeAttribute { + return (*NodeAttribute)(a) +} + +// ToV2 converts NodeAttribute to v2 node Attribute. +func (a *NodeAttribute) ToV2() *netmap.Attribute { + return (*netmap.Attribute)(a) +} + +// Key returns key to the node attribute. +func (a *NodeAttribute) Key() string { + return (*netmap.Attribute)(a). + GetKey() +} + +// SetKey sets key to the node attribute. +func (a *NodeAttribute) SetKey(key string) { + (*netmap.Attribute)(a). + SetKey(key) +} + +// Value returns value of the node attribute. +func (a *NodeAttribute) Value() string { + return (*netmap.Attribute)(a). + GetValue() +} + +// SetValue sets value of the node attribute. +func (a *NodeAttribute) SetValue(val string) { + (*netmap.Attribute)(a). + SetValue(val) +} + +// ParentKeys returns list of parent keys. +func (a *NodeAttribute) ParentKeys() []string { + return (*netmap.Attribute)(a). + GetParents() +} + +// SetParentKeys sets list of parent keys. +func (a *NodeAttribute) SetParentKeys(keys ...string) { + (*netmap.Attribute)(a). + SetParents(keys) +} diff --git a/pkg/netmap/node_info_test.go b/pkg/netmap/node_info_test.go index 93d1568..abbc96f 100644 --- a/pkg/netmap/node_info_test.go +++ b/pkg/netmap/node_info_test.go @@ -42,3 +42,41 @@ func TestNodeStateFromV2(t *testing.T) { require.Equal(t, item.sV2, item.s.ToV2()) } } + +func TestNodeAttributeFromV2(t *testing.T) { + aV2 := new(netmap.Attribute) + aV2.SetKey("key") + aV2.SetValue("value") + aV2.SetParents([]string{"par1", "par2"}) + + a := NewNodeAttributeFromV2(aV2) + + require.Equal(t, aV2, a.ToV2()) +} + +func TestNodeAttribute_Key(t *testing.T) { + a := NewNodeAttribute() + key := "some key" + + a.SetKey(key) + + require.Equal(t, key, a.Key()) +} + +func TestNodeAttribute_Value(t *testing.T) { + a := NewNodeAttribute() + val := "some value" + + a.SetValue(val) + + require.Equal(t, val, a.Value()) +} + +func TestNodeAttribute_ParentKeys(t *testing.T) { + a := NewNodeAttribute() + keys := []string{"par1", "par2"} + + a.SetParentKeys(keys...) + + require.Equal(t, keys, a.ParentKeys()) +} From 8367b498d9ceb51758cb11ad012c773c66fedbdb Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 5 Nov 2020 15:01:24 +0300 Subject: [PATCH 0513/1196] [#189] sdk/netmap: Implement NodeInfo type Signed-off-by: Leonard Lyubich --- pkg/netmap/node_info.go | 82 ++++++++++++++++++++++++++++++++++++ pkg/netmap/node_info_test.go | 60 ++++++++++++++++++++++++++ 2 files changed, 142 insertions(+) diff --git a/pkg/netmap/node_info.go b/pkg/netmap/node_info.go index 2c14de2..327e77a 100644 --- a/pkg/netmap/node_info.go +++ b/pkg/netmap/node_info.go @@ -29,6 +29,9 @@ type NodeState uint32 // NodeAttribute represents v2 compatible attribute of the NeoFS Storage Node. type NodeAttribute netmap.Attribute +// NodeInfo represents v2 compatible descriptor of the NeoFS node. +type NodeInfo netmap.NodeInfo + const ( _ NodeState = iota @@ -200,3 +203,82 @@ func (a *NodeAttribute) SetParentKeys(keys ...string) { (*netmap.Attribute)(a). SetParents(keys) } + +// NewNodeInfo creates and returns new NodeInfo instance. +func NewNodeInfo() *NodeInfo { + return NewNodeInfoFromV2(new(netmap.NodeInfo)) +} + +// NewNodeInfoFromV2 converts v2 NodeInfo to NodeInfo. +func NewNodeInfoFromV2(i *netmap.NodeInfo) *NodeInfo { + return (*NodeInfo)(i) +} + +// ToV2 converts NodeInfo to v2 NodeInfo. +func (i *NodeInfo) ToV2() *netmap.NodeInfo { + return (*netmap.NodeInfo)(i) +} + +// PublicKey returns public key of the node in a binary format. +func (i *NodeInfo) PublicKey() []byte { + return (*netmap.NodeInfo)(i). + GetPublicKey() +} + +// SetPublicKey sets public key of the node in a binary format. +func (i *NodeInfo) SetPublicKey(key []byte) { + (*netmap.NodeInfo)(i). + SetPublicKey(key) +} + +// Address returns network endpoint address of the node. +func (i *NodeInfo) Address() string { + return (*netmap.NodeInfo)(i). + GetAddress() +} + +// SetAddress sets network endpoint address of the node. +func (i *NodeInfo) SetAddress(addr string) { + (*netmap.NodeInfo)(i). + SetAddress(addr) +} + +// Attributes returns list of the node attributes. +func (i *NodeInfo) Attributes() []*NodeAttribute { + as := (*netmap.NodeInfo)(i). + GetAttributes() + + res := make([]*NodeAttribute, 0, len(as)) + + for i := range as { + res = append(res, NewNodeAttributeFromV2(as[i])) + } + + return res +} + +// SetAttributes sets list of the node attributes. +func (i *NodeInfo) SetAttributes(as ...*NodeAttribute) { + asV2 := make([]*netmap.Attribute, 0, len(as)) + + for i := range as { + asV2 = append(asV2, as[i].ToV2()) + } + + (*netmap.NodeInfo)(i). + SetAttributes(asV2) +} + +// State returns node state. +func (i *NodeInfo) State() NodeState { + return NodeStateFromV2( + (*netmap.NodeInfo)(i). + GetState(), + ) +} + +// SetState sets node state. +func (i *NodeInfo) SetState(s NodeState) { + (*netmap.NodeInfo)(i). + SetState(s.ToV2()) +} diff --git a/pkg/netmap/node_info_test.go b/pkg/netmap/node_info_test.go index abbc96f..75de15d 100644 --- a/pkg/netmap/node_info_test.go +++ b/pkg/netmap/node_info_test.go @@ -80,3 +80,63 @@ func TestNodeAttribute_ParentKeys(t *testing.T) { require.Equal(t, keys, a.ParentKeys()) } + +func testNodeAttribute() *NodeAttribute { + a := new(NodeAttribute) + a.SetKey("key") + a.SetValue("value") + a.SetParentKeys("par1", "par2") + + return a +} + +func TestNodeInfoFromV2(t *testing.T) { + iV2 := new(netmap.NodeInfo) + iV2.SetPublicKey([]byte{1, 2, 3}) + iV2.SetAddress("456") + iV2.SetState(netmap.Online) + iV2.SetAttributes([]*netmap.Attribute{ + testNodeAttribute().ToV2(), + testNodeAttribute().ToV2(), + }) + + i := NewNodeInfoFromV2(iV2) + + require.Equal(t, iV2, i.ToV2()) +} + +func TestNodeInfo_PublicKey(t *testing.T) { + i := new(NodeInfo) + key := []byte{1, 2, 3} + + i.SetPublicKey(key) + + require.Equal(t, key, i.PublicKey()) +} + +func TestNodeInfo_Address(t *testing.T) { + i := new(NodeInfo) + a := "127.0.0.1:8080" + + i.SetAddress(a) + + require.Equal(t, a, i.Address()) +} + +func TestNodeInfo_State(t *testing.T) { + i := new(NodeInfo) + s := NodeStateOnline + + i.SetState(s) + + require.Equal(t, s, i.State()) +} + +func TestNodeInfo_Attributes(t *testing.T) { + i := new(NodeInfo) + as := []*NodeAttribute{testNodeAttribute(), testNodeAttribute()} + + i.SetAttributes(as...) + + require.Equal(t, as, i.Attributes()) +} From 40d7c9cd938bb5db48e465ea49ddf14b44404103 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 5 Nov 2020 15:20:07 +0300 Subject: [PATCH 0514/1196] [#189] sdk/netmap: Implement NodeInfo JSON encode/decode functions Signed-off-by: Leonard Lyubich --- pkg/netmap/node_info.go | 15 +++++++++++++++ pkg/netmap/node_info_test.go | 16 ++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/pkg/netmap/node_info.go b/pkg/netmap/node_info.go index 327e77a..81f2767 100644 --- a/pkg/netmap/node_info.go +++ b/pkg/netmap/node_info.go @@ -214,6 +214,21 @@ func NewNodeInfoFromV2(i *netmap.NodeInfo) *NodeInfo { return (*NodeInfo)(i) } +// NodeInfoToJSON encodes NodeInfo to JSON format. +func NodeInfoToJSON(i *NodeInfo) ([]byte, error) { + return netmap.NodeInfoToJSON(i.ToV2()) +} + +// NodeInfoFromJSON decodes NodeInfo from JSON-encoded data. +func NodeInfoFromJSON(data []byte) (*NodeInfo, error) { + i, err := netmap.NodeInfoFromJSON(data) + if err != nil { + return nil, err + } + + return NewNodeInfoFromV2(i), nil +} + // ToV2 converts NodeInfo to v2 NodeInfo. func (i *NodeInfo) ToV2() *netmap.NodeInfo { return (*netmap.NodeInfo)(i) diff --git a/pkg/netmap/node_info_test.go b/pkg/netmap/node_info_test.go index 75de15d..366b9ff 100644 --- a/pkg/netmap/node_info_test.go +++ b/pkg/netmap/node_info_test.go @@ -140,3 +140,19 @@ func TestNodeInfo_Attributes(t *testing.T) { require.Equal(t, as, i.Attributes()) } + +func TestNodeInfoJSON(t *testing.T) { + i := NewNodeInfo() + i.SetPublicKey([]byte{1, 2, 3}) + i.SetAddress("some node address") + i.SetState(NodeStateOnline) + i.SetAttributes(testNodeAttribute(), testNodeAttribute()) + + j, err := NodeInfoToJSON(i) + require.NoError(t, err) + + i2, err := NodeInfoFromJSON(j) + require.NoError(t, err) + + require.Equal(t, i, i2) +} From 9834ed4e688dcbe09f4190e105a987de5cac887a Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 5 Nov 2020 15:45:06 +0300 Subject: [PATCH 0515/1196] [#189] sdk/netmap: Get rid of the use of v2 types in the placement code Signed-off-by: Leonard Lyubich --- pkg/netmap/context.go | 13 +++-- pkg/netmap/filter.go | 80 ++++++++++++++--------------- pkg/netmap/filter_test.go | 80 ++++++++++++++--------------- pkg/netmap/helper_test.go | 42 +++++++--------- pkg/netmap/netmap.go | 17 +++---- pkg/netmap/node_info.go | 37 +++++--------- pkg/netmap/node_info_test.go | 13 ----- pkg/netmap/selector.go | 40 +++++++-------- pkg/netmap/selector_test.go | 98 ++++++++++++++++++------------------ 9 files changed, 195 insertions(+), 225 deletions(-) diff --git a/pkg/netmap/context.go b/pkg/netmap/context.go index 9de49a9..992d2bd 100644 --- a/pkg/netmap/context.go +++ b/pkg/netmap/context.go @@ -4,7 +4,6 @@ import ( "errors" "github.com/nspcc-dev/hrw" - "github.com/nspcc-dev/neofs-api-go/v2/netmap" ) // Context contains references to named filters and cached numeric values. @@ -12,14 +11,14 @@ type Context struct { // Netmap is a netmap structure to operate on. Netmap *Netmap // Filters stores processed filters. - Filters map[string]*netmap.Filter + Filters map[string]*Filter // Selectors stores processed selectors. - Selectors map[string]*netmap.Selector + Selectors map[string]*Selector // Selections stores result of selector processing. Selections map[string][]Nodes // numCache stores parsed numeric values. - numCache map[*netmap.Filter]uint64 + numCache map[*Filter]uint64 // pivot is a seed for HRW. pivot []byte // pivotHash is a saved HRW hash of pivot @@ -50,11 +49,11 @@ var ( func NewContext(nm *Netmap) *Context { return &Context{ Netmap: nm, - Filters: make(map[string]*netmap.Filter), - Selectors: make(map[string]*netmap.Selector), + Filters: make(map[string]*Filter), + Selectors: make(map[string]*Selector), Selections: make(map[string][]Nodes), - numCache: make(map[*netmap.Filter]uint64), + numCache: make(map[*Filter]uint64), aggregator: newMeanIQRAgg, weightFunc: GetDefaultWeightFunc(nm.Nodes), } diff --git a/pkg/netmap/filter.go b/pkg/netmap/filter.go index c712fdd..fa4efc2 100644 --- a/pkg/netmap/filter.go +++ b/pkg/netmap/filter.go @@ -20,8 +20,8 @@ func (c *Context) applyFilter(name string, b *Node) bool { } // processFilters processes filters and returns error is any of them is invalid. -func (c *Context) processFilters(p *netmap.PlacementPolicy) error { - for _, f := range p.GetFilters() { +func (c *Context) processFilters(p *PlacementPolicy) error { + for _, f := range p.Filters() { if err := c.processFilter(f, true); err != nil { return err } @@ -29,46 +29,46 @@ func (c *Context) processFilters(p *netmap.PlacementPolicy) error { return nil } -func (c *Context) processFilter(f *netmap.Filter, top bool) error { +func (c *Context) processFilter(f *Filter, top bool) error { if f == nil { return fmt.Errorf("%w: FILTER", ErrMissingField) } - if f.GetName() == MainFilterName { + if f.Name() == MainFilterName { return fmt.Errorf("%w: '*' is reserved", ErrInvalidFilterName) } - if top && f.GetName() == "" { + if top && f.Name() == "" { return ErrUnnamedTopFilter } - if !top && f.GetName() != "" && c.Filters[f.GetName()] == nil { - return fmt.Errorf("%w: '%s'", ErrFilterNotFound, f.GetName()) + if !top && f.Name() != "" && c.Filters[f.Name()] == nil { + return fmt.Errorf("%w: '%s'", ErrFilterNotFound, f.Name()) } - switch f.GetOp() { - case netmap.AND, netmap.OR: - for _, flt := range f.GetFilters() { + switch f.Operation() { + case OpAND, OpOR: + for _, flt := range f.InnerFilters() { if err := c.processFilter(flt, false); err != nil { return err } } default: - if len(f.GetFilters()) != 0 { + if len(f.InnerFilters()) != 0 { return ErrNonEmptyFilters - } else if !top && f.GetName() != "" { // named reference + } else if !top && f.Name() != "" { // named reference return nil } - switch f.GetOp() { - case netmap.EQ, netmap.NE: - case netmap.GT, netmap.GE, netmap.LT, netmap.LE: - n, err := strconv.ParseUint(f.GetValue(), 10, 64) + switch f.Operation() { + case OpEQ, OpNE: + case OpGT, OpGE, OpLT, OpLE: + n, err := strconv.ParseUint(f.Value(), 10, 64) if err != nil { - return fmt.Errorf("%w: '%s'", ErrInvalidNumber, f.GetValue()) + return fmt.Errorf("%w: '%s'", ErrInvalidNumber, f.Value()) } c.numCache[f] = n default: - return fmt.Errorf("%w: %d", ErrInvalidFilterOp, f.GetOp()) + return fmt.Errorf("%w: %s", ErrInvalidFilterOp, f.Operation()) } } if top { - c.Filters[f.GetName()] = f + c.Filters[f.Name()] = f } return nil } @@ -76,54 +76,54 @@ func (c *Context) processFilter(f *netmap.Filter, top bool) error { // match matches f against b. It returns no errors because // filter should have been parsed during context creation // and missing node properties are considered as a regular fail. -func (c *Context) match(f *netmap.Filter, b *Node) bool { - switch f.GetOp() { - case netmap.AND, netmap.OR: - for _, lf := range f.GetFilters() { - if lf.GetName() != "" { - lf = c.Filters[lf.GetName()] +func (c *Context) match(f *Filter, b *Node) bool { + switch f.Operation() { + case OpAND, OpOR: + for _, lf := range f.InnerFilters() { + if lf.Name() != "" { + lf = c.Filters[lf.Name()] } ok := c.match(lf, b) - if ok == (f.GetOp() == netmap.OR) { + if ok == (f.Operation() == OpOR) { return ok } } - return f.GetOp() == netmap.AND + return f.Operation() == OpAND default: return c.matchKeyValue(f, b) } } -func (c *Context) matchKeyValue(f *netmap.Filter, b *Node) bool { - switch f.GetOp() { - case netmap.EQ: - return b.Attribute(f.GetKey()) == f.GetValue() - case netmap.NE: - return b.Attribute(f.GetKey()) != f.GetValue() +func (c *Context) matchKeyValue(f *Filter, b *Node) bool { + switch f.Operation() { + case OpEQ: + return b.Attribute(f.Key()) == f.Value() + case OpNE: + return b.Attribute(f.Key()) != f.Value() default: var attr uint64 - switch f.GetKey() { + switch f.Key() { case PriceAttr: attr = b.Price case CapacityAttr: attr = b.Capacity default: var err error - attr, err = strconv.ParseUint(b.Attribute(f.GetKey()), 10, 64) + attr, err = strconv.ParseUint(b.Attribute(f.Key()), 10, 64) if err != nil { // Note: because filters are somewhat independent from nodes attributes, // We don't report an error here, and fail filter instead. return false } } - switch f.GetOp() { - case netmap.GT: + switch f.Operation() { + case OpGT: return attr > c.numCache[f] - case netmap.GE: + case OpGE: return attr >= c.numCache[f] - case netmap.LT: + case OpLT: return attr < c.numCache[f] - case netmap.LE: + case OpLE: return attr <= c.numCache[f] } } diff --git a/pkg/netmap/filter_test.go b/pkg/netmap/filter_test.go index 46c3567..512e431 100644 --- a/pkg/netmap/filter_test.go +++ b/pkg/netmap/filter_test.go @@ -9,12 +9,12 @@ import ( ) func TestContext_ProcessFilters(t *testing.T) { - fs := []*netmap.Filter{ - newFilter("StorageSSD", "Storage", "SSD", netmap.EQ), - newFilter("GoodRating", "Rating", "4", netmap.GE), - newFilter("Main", "", "", netmap.AND, + fs := []*Filter{ + newFilter("StorageSSD", "Storage", "SSD", OpEQ), + newFilter("GoodRating", "Rating", "4", OpGE), + newFilter("Main", "", "", OpAND, newFilter("StorageSSD", "", "", 0), - newFilter("", "IntField", "123", netmap.LT), + newFilter("", "IntField", "123", OpLT), newFilter("GoodRating", "", "", 0)), } nm, err := NewNetmap(nil) @@ -24,49 +24,49 @@ func TestContext_ProcessFilters(t *testing.T) { require.NoError(t, c.processFilters(p)) require.Equal(t, 3, len(c.Filters)) for _, f := range fs { - require.Equal(t, f, c.Filters[f.GetName()]) + require.Equal(t, f, c.Filters[f.Name()]) } require.Equal(t, uint64(4), c.numCache[fs[1]]) - require.Equal(t, uint64(123), c.numCache[fs[2].GetFilters()[1]]) + require.Equal(t, uint64(123), c.numCache[fs[2].InnerFilters()[1]]) } func TestContext_ProcessFiltersInvalid(t *testing.T) { errTestCases := []struct { name string - filter *netmap.Filter + filter *Filter err error }{ { "UnnamedTop", - newFilter("", "Storage", "SSD", netmap.EQ), + newFilter("", "Storage", "SSD", OpEQ), ErrUnnamedTopFilter, }, { "InvalidReference", - newFilter("Main", "", "", netmap.AND, + newFilter("Main", "", "", OpAND, newFilter("StorageSSD", "", "", 0)), ErrFilterNotFound, }, { "NonEmptyKeyed", - newFilter("Main", "Storage", "SSD", netmap.EQ, + newFilter("Main", "Storage", "SSD", OpEQ, newFilter("StorageSSD", "", "", 0)), ErrNonEmptyFilters, }, { "InvalidNumber", - newFilter("Main", "Rating", "three", netmap.GE), + newFilter("Main", "Rating", "three", OpGE), ErrInvalidNumber, }, { "InvalidOp", - newFilter("Main", "Rating", "3", netmap.UnspecifiedOperation), + newFilter("Main", "Rating", "3", 0), ErrInvalidFilterOp, }, { "InvalidName", - newFilter("*", "Rating", "3", netmap.GE), + newFilter("*", "Rating", "3", OpGE), ErrInvalidFilterName, }, { @@ -78,7 +78,7 @@ func TestContext_ProcessFiltersInvalid(t *testing.T) { for _, tc := range errTestCases { t.Run(tc.name, func(t *testing.T) { c := NewContext(new(Netmap)) - p := newPlacementPolicy(1, nil, nil, []*netmap.Filter{tc.filter}) + p := newPlacementPolicy(1, nil, nil, []*Filter{tc.filter}) err := c.processFilters(p) require.True(t, errors.Is(err, tc.err), "got: %v", err) }) @@ -93,87 +93,87 @@ func TestFilter_MatchSimple(t *testing.T) { testCases := []struct { name string ok bool - f *netmap.Filter + f *Filter }{ { "GE_true", true, - newFilter("Main", "Rating", "4", netmap.GE), + newFilter("Main", "Rating", "4", OpGE), }, { "GE_false", false, - newFilter("Main", "Rating", "5", netmap.GE), + newFilter("Main", "Rating", "5", OpGE), }, { "GT_true", true, - newFilter("Main", "Rating", "3", netmap.GT), + newFilter("Main", "Rating", "3", OpGT), }, { "GT_false", false, - newFilter("Main", "Rating", "4", netmap.GT), + newFilter("Main", "Rating", "4", OpGT), }, { "LE_true", true, - newFilter("Main", "Rating", "4", netmap.LE), + newFilter("Main", "Rating", "4", OpLE), }, { "LE_false", false, - newFilter("Main", "Rating", "3", netmap.LE), + newFilter("Main", "Rating", "3", OpLE), }, { "LT_true", true, - newFilter("Main", "Rating", "5", netmap.LT), + newFilter("Main", "Rating", "5", OpLT), }, { "LT_false", false, - newFilter("Main", "Rating", "4", netmap.LT), + newFilter("Main", "Rating", "4", OpLT), }, { "EQ_true", true, - newFilter("Main", "Country", "Germany", netmap.EQ), + newFilter("Main", "Country", "Germany", OpEQ), }, { "EQ_false", false, - newFilter("Main", "Country", "China", netmap.EQ), + newFilter("Main", "Country", "China", OpEQ), }, { "NE_true", true, - newFilter("Main", "Country", "France", netmap.NE), + newFilter("Main", "Country", "France", OpNE), }, { "NE_false", false, - newFilter("Main", "Country", "Germany", netmap.NE), + newFilter("Main", "Country", "Germany", OpNE), }, } for _, tc := range testCases { c := NewContext(new(Netmap)) - p := newPlacementPolicy(1, nil, nil, []*netmap.Filter{tc.f}) + p := newPlacementPolicy(1, nil, nil, []*Filter{tc.f}) require.NoError(t, c.processFilters(p)) require.Equal(t, tc.ok, c.match(tc.f, b)) } t.Run("InvalidOp", func(t *testing.T) { - f := newFilter("Main", "Rating", "5", netmap.EQ) + f := newFilter("Main", "Rating", "5", OpEQ) c := NewContext(new(Netmap)) - p := newPlacementPolicy(1, nil, nil, []*netmap.Filter{f}) + p := newPlacementPolicy(1, nil, nil, []*Filter{f}) require.NoError(t, c.processFilters(p)) // just for the coverage - f.SetOp(netmap.UnspecifiedOperation) + f.SetOperation(0) require.False(t, c.match(f, b)) }) } func TestFilter_Match(t *testing.T) { - fs := []*netmap.Filter{ - newFilter("StorageSSD", "Storage", "SSD", netmap.EQ), - newFilter("GoodRating", "Rating", "4", netmap.GE), - newFilter("Main", "", "", netmap.AND, + fs := []*Filter{ + newFilter("StorageSSD", "Storage", "SSD", OpEQ), + newFilter("GoodRating", "Rating", "4", OpGE), + newFilter("Main", "", "", OpAND, newFilter("StorageSSD", "", "", 0), - newFilter("", "IntField", "123", netmap.LT), + newFilter("", "IntField", "123", OpLT), newFilter("GoodRating", "", "", 0), - newFilter("", "", "", netmap.OR, - newFilter("", "Param", "Value1", netmap.EQ), - newFilter("", "Param", "Value2", netmap.EQ), + newFilter("", "", "", OpOR, + newFilter("", "Param", "Value1", OpEQ), + newFilter("", "Param", "Value2", OpEQ), )), } c := NewContext(new(Netmap)) diff --git a/pkg/netmap/helper_test.go b/pkg/netmap/helper_test.go index bcf9da5..35df5b5 100644 --- a/pkg/netmap/helper_test.go +++ b/pkg/netmap/helper_test.go @@ -1,21 +1,17 @@ package netmap -import ( - "github.com/nspcc-dev/neofs-api-go/v2/netmap" -) - -func newFilter(name string, k, v string, op netmap.Operation, fs ...*netmap.Filter) *netmap.Filter { - f := new(netmap.Filter) +func newFilter(name string, k, v string, op Operation, fs ...*Filter) *Filter { + f := NewFilter() f.SetName(name) f.SetKey(k) - f.SetOp(op) + f.SetOperation(op) f.SetValue(v) - f.SetFilters(fs) + f.SetInnerFilters(fs...) return f } -func newSelector(name string, attr string, c netmap.Clause, count uint32, filter string) *netmap.Selector { - s := new(netmap.Selector) +func newSelector(name string, attr string, c Clause, count uint32, filter string) *Selector { + s := NewSelector() s.SetName(name) s.SetAttribute(attr) s.SetCount(count) @@ -24,32 +20,32 @@ func newSelector(name string, attr string, c netmap.Clause, count uint32, filter return s } -func newPlacementPolicy(bf uint32, rs []*netmap.Replica, ss []*netmap.Selector, fs []*netmap.Filter) *netmap.PlacementPolicy { - p := new(netmap.PlacementPolicy) +func newPlacementPolicy(bf uint32, rs []*Replica, ss []*Selector, fs []*Filter) *PlacementPolicy { + p := NewPlacementPolicy() p.SetContainerBackupFactor(bf) - p.SetReplicas(rs) - p.SetSelectors(ss) - p.SetFilters(fs) + p.SetReplicas(rs...) + p.SetSelectors(ss...) + p.SetFilters(fs...) return p } -func newReplica(c uint32, s string) *netmap.Replica { - r := new(netmap.Replica) +func newReplica(c uint32, s string) *Replica { + r := NewReplica() r.SetCount(c) r.SetSelector(s) return r } -func nodeInfoFromAttributes(props ...string) netmap.NodeInfo { - attrs := make([]*netmap.Attribute, len(props)/2) +func nodeInfoFromAttributes(props ...string) NodeInfo { + attrs := make([]*NodeAttribute, len(props)/2) for i := range attrs { - attrs[i] = new(netmap.Attribute) + attrs[i] = NewNodeAttribute() attrs[i].SetKey(props[i*2]) attrs[i].SetValue(props[i*2+1]) } - var n netmap.NodeInfo - n.SetAttributes(attrs) - return n + n := NewNodeInfo() + n.SetAttributes(attrs...) + return *n } func getTestNode(props ...string) *Node { diff --git a/pkg/netmap/netmap.go b/pkg/netmap/netmap.go index b886999..3be6092 100644 --- a/pkg/netmap/netmap.go +++ b/pkg/netmap/netmap.go @@ -4,7 +4,6 @@ import ( "fmt" "github.com/nspcc-dev/hrw" - "github.com/nspcc-dev/neofs-api-go/v2/netmap" ) // Netmap represents netmap which contains preprocessed nodes. @@ -43,7 +42,7 @@ func (m *Netmap) GetPlacementVectors(cnt ContainerNodes, pivot []byte) ([]Nodes, // GetContainerNodes returns nodes corresponding to each replica. // Order of returned nodes corresponds to order of replicas in p. // pivot is a seed for HRW sorting. -func (m *Netmap) GetContainerNodes(p *netmap.PlacementPolicy, pivot []byte) (ContainerNodes, error) { +func (m *Netmap) GetContainerNodes(p *PlacementPolicy, pivot []byte) (ContainerNodes, error) { c := NewContext(m) c.setPivot(pivot) if err := c.processFilters(p); err != nil { @@ -52,19 +51,19 @@ func (m *Netmap) GetContainerNodes(p *netmap.PlacementPolicy, pivot []byte) (Con if err := c.processSelectors(p); err != nil { return nil, err } - result := make([]Nodes, len(p.GetReplicas())) - for i, r := range p.GetReplicas() { + result := make([]Nodes, len(p.Replicas())) + for i, r := range p.Replicas() { if r == nil { return nil, fmt.Errorf("%w: REPLICA", ErrMissingField) } - if r.GetSelector() == "" { - for _, s := range p.GetSelectors() { - result[i] = append(result[i], flattenNodes(c.Selections[s.GetName()])...) + if r.Selector() == "" { + for _, s := range p.Selectors() { + result[i] = append(result[i], flattenNodes(c.Selections[s.Name()])...) } } - nodes, ok := c.Selections[r.GetSelector()] + nodes, ok := c.Selections[r.Selector()] if !ok { - return nil, fmt.Errorf("%w: REPLICA '%s'", ErrSelectorNotFound, r.GetSelector()) + return nil, fmt.Errorf("%w: REPLICA '%s'", ErrSelectorNotFound, r.Selector()) } result[i] = append(result[i], flattenNodes(nodes)...) diff --git a/pkg/netmap/node_info.go b/pkg/netmap/node_info.go index 81f2767..121eaba 100644 --- a/pkg/netmap/node_info.go +++ b/pkg/netmap/node_info.go @@ -16,7 +16,7 @@ type ( Price uint64 AttrMap map[string]string - InfoV2 *netmap.NodeInfo + *NodeInfo } // Nodes represents slice of graph leafs. @@ -57,19 +57,8 @@ func (n Node) Hash() uint64 { return n.ID } -// NetworkAddress returns network address -// of the node in a string format. -func (n Node) NetworkAddress() string { - return n.InfoV2.GetAddress() -} - -// PublicKey returns public key of the node in bytes. -func (n Node) PublicKey() []byte { - return n.InfoV2.GetPublicKey() -} - -// NodesFromV2 converts slice of v2 netmap.NodeInfo to a generic node slice. -func NodesFromV2(infos []netmap.NodeInfo) Nodes { +// NodesFromInfo converts slice of NodeInfo to a generic node slice. +func NodesFromInfo(infos []NodeInfo) Nodes { nodes := make(Nodes, len(infos)) for i := range infos { nodes[i] = newNodeV2(i, &infos[i]) @@ -77,21 +66,21 @@ func NodesFromV2(infos []netmap.NodeInfo) Nodes { return nodes } -func newNodeV2(index int, ni *netmap.NodeInfo) *Node { +func newNodeV2(index int, ni *NodeInfo) *Node { n := &Node{ - ID: hrw.Hash(ni.GetPublicKey()), - Index: index, - AttrMap: make(map[string]string, len(ni.GetAttributes())), - InfoV2: ni, + ID: hrw.Hash(ni.PublicKey()), + Index: index, + AttrMap: make(map[string]string, len(ni.Attributes())), + NodeInfo: ni, } - for _, attr := range ni.GetAttributes() { - switch attr.GetKey() { + for _, attr := range ni.Attributes() { + switch attr.Key() { case CapacityAttr: - n.Capacity, _ = strconv.ParseUint(attr.GetValue(), 10, 64) + n.Capacity, _ = strconv.ParseUint(attr.Value(), 10, 64) case PriceAttr: - n.Price, _ = strconv.ParseUint(attr.GetValue(), 10, 64) + n.Price, _ = strconv.ParseUint(attr.Value(), 10, 64) } - n.AttrMap[attr.GetKey()] = attr.GetValue() + n.AttrMap[attr.Key()] = attr.Value() } return n } diff --git a/pkg/netmap/node_info_test.go b/pkg/netmap/node_info_test.go index 366b9ff..92227a1 100644 --- a/pkg/netmap/node_info_test.go +++ b/pkg/netmap/node_info_test.go @@ -7,19 +7,6 @@ import ( "github.com/stretchr/testify/require" ) -func TestNode_NetworkAddress(t *testing.T) { - addr := "127.0.0.1:8080" - - nV2 := new(netmap.NodeInfo) - nV2.SetAddress(addr) - - n := Node{ - InfoV2: nV2, - } - - require.Equal(t, addr, n.NetworkAddress()) -} - func TestNodeStateFromV2(t *testing.T) { for _, item := range []struct { s NodeState diff --git a/pkg/netmap/selector.go b/pkg/netmap/selector.go index 99fb903..0217c41 100644 --- a/pkg/netmap/selector.go +++ b/pkg/netmap/selector.go @@ -12,48 +12,48 @@ import ( type Selector netmap.Selector // processSelectors processes selectors and returns error is any of them is invalid. -func (c *Context) processSelectors(p *netmap.PlacementPolicy) error { - for _, s := range p.GetSelectors() { +func (c *Context) processSelectors(p *PlacementPolicy) error { + for _, s := range p.Selectors() { if s == nil { return fmt.Errorf("%w: SELECT", ErrMissingField) - } else if s.GetFilter() != MainFilterName { - _, ok := c.Filters[s.GetFilter()] + } else if s.Filter() != MainFilterName { + _, ok := c.Filters[s.Filter()] if !ok { - return fmt.Errorf("%w: SELECT FROM '%s'", ErrFilterNotFound, s.GetFilter()) + return fmt.Errorf("%w: SELECT FROM '%s'", ErrFilterNotFound, s.Filter()) } } - c.Selectors[s.GetName()] = s + c.Selectors[s.Name()] = s result, err := c.getSelection(p, s) if err != nil { return err } - c.Selections[s.GetName()] = result + c.Selections[s.Name()] = result } return nil } // GetNodesCount returns amount of buckets and nodes in every bucket // for a given placement policy. -func GetNodesCount(p *netmap.PlacementPolicy, s *netmap.Selector) (int, int) { - switch s.GetClause() { - case netmap.Same: - return 1, int(p.GetContainerBackupFactor() * s.GetCount()) +func GetNodesCount(p *PlacementPolicy, s *Selector) (int, int) { + switch s.Clause() { + case ClauseSame: + return 1, int(p.ContainerBackupFactor() * s.Count()) default: - return int(s.GetCount()), int(p.GetContainerBackupFactor()) + return int(s.Count()), int(p.ContainerBackupFactor()) } } // getSelection returns nodes grouped by s.attribute. -func (c *Context) getSelection(p *netmap.PlacementPolicy, s *netmap.Selector) ([]Nodes, error) { +func (c *Context) getSelection(p *PlacementPolicy, s *Selector) ([]Nodes, error) { bucketCount, nodesInBucket := GetNodesCount(p, s) buckets := c.getSelectionBase(s) if len(buckets) < bucketCount { - return nil, fmt.Errorf("%w: '%s'", ErrNotEnoughNodes, s.GetName()) + return nil, fmt.Errorf("%w: '%s'", ErrNotEnoughNodes, s.Name()) } if len(c.pivot) == 0 { // Deterministic order in case of zero seed. - if s.GetAttribute() == "" { + if s.Attribute() == "" { sort.Slice(buckets, func(i, j int) bool { return buckets[i].nodes[0].ID < buckets[j].nodes[0].ID }) @@ -72,7 +72,7 @@ func (c *Context) getSelection(p *netmap.PlacementPolicy, s *netmap.Selector) ([ } } if len(nodes) < bucketCount { - return nil, fmt.Errorf("%w: '%s'", ErrNotEnoughNodes, s.GetName()) + return nil, fmt.Errorf("%w: '%s'", ErrNotEnoughNodes, s.Name()) } if len(c.pivot) != 0 { weights := make([]float64, len(nodes)) @@ -91,12 +91,12 @@ type nodeAttrPair struct { // getSelectionBase returns nodes grouped by selector attribute. // It it guaranteed that each pair will contain at least one node. -func (c *Context) getSelectionBase(s *netmap.Selector) []nodeAttrPair { - f := c.Filters[s.GetFilter()] - isMain := s.GetFilter() == MainFilterName +func (c *Context) getSelectionBase(s *Selector) []nodeAttrPair { + f := c.Filters[s.Filter()] + isMain := s.Filter() == MainFilterName result := []nodeAttrPair{} nodeMap := map[string]Nodes{} - attr := s.GetAttribute() + attr := s.Attribute() for i := range c.Netmap.Nodes { if isMain || c.match(f, c.Netmap.Nodes[i]) { if attr == "" { diff --git a/pkg/netmap/selector_test.go b/pkg/netmap/selector_test.go index 5ae4cf4..5ee2682 100644 --- a/pkg/netmap/selector_test.go +++ b/pkg/netmap/selector_test.go @@ -11,20 +11,20 @@ import ( func TestPlacementPolicy_UnspecifiedClause(t *testing.T) { p := newPlacementPolicy(1, - []*netmap.Replica{newReplica(1, "X")}, - []*netmap.Selector{ - newSelector("X", "", netmap.Distinct, 4, "*"), + []*Replica{newReplica(1, "X")}, + []*Selector{ + newSelector("X", "", ClauseDistinct, 4, "*"), }, nil, ) - nodes := []netmap.NodeInfo{ + nodes := []NodeInfo{ nodeInfoFromAttributes("ID", "1", "Country", "RU", "City", "St.Petersburg", "SSD", "0"), nodeInfoFromAttributes("ID", "2", "Country", "RU", "City", "St.Petersburg", "SSD", "1"), nodeInfoFromAttributes("ID", "3", "Country", "RU", "City", "Moscow", "SSD", "1"), nodeInfoFromAttributes("ID", "4", "Country", "RU", "City", "Moscow", "SSD", "1"), } - nm, err := NewNetmap(NodesFromV2(nodes)) + nm, err := NewNetmap(NodesFromInfo(nodes)) require.NoError(t, err) v, err := nm.GetContainerNodes(p, nil) require.NoError(t, err) @@ -33,24 +33,24 @@ func TestPlacementPolicy_UnspecifiedClause(t *testing.T) { func TestPlacementPolicy_GetPlacementVectors(t *testing.T) { p := newPlacementPolicy(2, - []*netmap.Replica{ + []*Replica{ newReplica(1, "SPB"), newReplica(2, "Americas"), }, - []*netmap.Selector{ - newSelector("SPB", "City", netmap.Same, 1, "SPBSSD"), - newSelector("Americas", "City", netmap.Distinct, 2, "Americas"), + []*Selector{ + newSelector("SPB", "City", ClauseSame, 1, "SPBSSD"), + newSelector("Americas", "City", ClauseDistinct, 2, "Americas"), }, - []*netmap.Filter{ - newFilter("SPBSSD", "", "", netmap.AND, - newFilter("", "Country", "RU", netmap.EQ), - newFilter("", "City", "St.Petersburg", netmap.EQ), - newFilter("", "SSD", "1", netmap.EQ)), - newFilter("Americas", "", "", netmap.OR, - newFilter("", "Continent", "NA", netmap.EQ), - newFilter("", "Continent", "SA", netmap.EQ)), + []*Filter{ + newFilter("SPBSSD", "", "", OpAND, + newFilter("", "Country", "RU", OpEQ), + newFilter("", "City", "St.Petersburg", OpEQ), + newFilter("", "SSD", "1", OpEQ)), + newFilter("Americas", "", "", OpOR, + newFilter("", "Continent", "NA", OpEQ), + newFilter("", "Continent", "SA", OpEQ)), }) - nodes := []netmap.NodeInfo{ + nodes := []NodeInfo{ nodeInfoFromAttributes("ID", "1", "Country", "RU", "City", "St.Petersburg", "SSD", "0"), nodeInfoFromAttributes("ID", "2", "Country", "RU", "City", "St.Petersburg", "SSD", "1"), nodeInfoFromAttributes("ID", "3", "Country", "RU", "City", "Moscow", "SSD", "1"), @@ -66,7 +66,7 @@ func TestPlacementPolicy_GetPlacementVectors(t *testing.T) { nodeInfoFromAttributes("ID", "13", "Continent", "SA", "City", "Lima"), } - nm, err := NewNetmap(NodesFromV2(nodes)) + nm, err := NewNetmap(NodesFromInfo(nodes)) require.NoError(t, err) v, err := nm.GetContainerNodes(p, nil) require.NoError(t, err) @@ -94,17 +94,17 @@ func TestPlacementPolicy_GetPlacementVectors(t *testing.T) { func TestPlacementPolicy_ProcessSelectors(t *testing.T) { p := newPlacementPolicy(2, nil, - []*netmap.Selector{ - newSelector("SameRU", "City", netmap.Same, 2, "FromRU"), - newSelector("DistinctRU", "City", netmap.Distinct, 2, "FromRU"), - newSelector("Good", "Country", netmap.Distinct, 2, "Good"), - newSelector("Main", "Country", netmap.Distinct, 3, "*"), + []*Selector{ + newSelector("SameRU", "City", ClauseSame, 2, "FromRU"), + newSelector("DistinctRU", "City", ClauseDistinct, 2, "FromRU"), + newSelector("Good", "Country", ClauseDistinct, 2, "Good"), + newSelector("Main", "Country", ClauseDistinct, 3, "*"), }, - []*netmap.Filter{ - newFilter("FromRU", "Country", "Russia", netmap.EQ), - newFilter("Good", "Rating", "4", netmap.GE), + []*Filter{ + newFilter("FromRU", "Country", "Russia", OpEQ), + newFilter("Good", "Rating", "4", OpGE), }) - nodes := []netmap.NodeInfo{ + nodes := []NodeInfo{ nodeInfoFromAttributes("Country", "Russia", "Rating", "1", "City", "SPB"), nodeInfoFromAttributes("Country", "Germany", "Rating", "5", "City", "Berlin"), nodeInfoFromAttributes("Country", "Russia", "Rating", "6", "City", "Moscow"), @@ -118,22 +118,22 @@ func TestPlacementPolicy_ProcessSelectors(t *testing.T) { nodeInfoFromAttributes("Country", "Russia", "Rating", "9", "City", "SPB"), } - nm, err := NewNetmap(NodesFromV2(nodes)) + nm, err := NewNetmap(NodesFromInfo(nodes)) require.NoError(t, err) c := NewContext(nm) require.NoError(t, c.processFilters(p)) require.NoError(t, c.processSelectors(p)) - for _, s := range p.GetSelectors() { - sel := c.Selections[s.GetName()] - s := c.Selectors[s.GetName()] + for _, s := range p.Selectors() { + sel := c.Selections[s.Name()] + s := c.Selectors[s.Name()] bucketCount, nodesInBucket := GetNodesCount(p, s) - targ := fmt.Sprintf("selector '%s'", s.GetName()) + targ := fmt.Sprintf("selector '%s'", s.Name()) require.Equal(t, bucketCount, len(sel), targ) for _, res := range sel { require.Equal(t, nodesInBucket, len(res), targ) for j := range res { - require.True(t, c.applyFilter(s.GetFilter(), res[j]), targ) + require.True(t, c.applyFilter(s.Filter(), res[j]), targ) } } } @@ -142,12 +142,12 @@ func TestPlacementPolicy_ProcessSelectors(t *testing.T) { func TestPlacementPolicy_ProcessSelectorsHRW(t *testing.T) { p := newPlacementPolicy(1, nil, - []*netmap.Selector{ - newSelector("Main", "Country", netmap.Distinct, 3, "*"), + []*Selector{ + newSelector("Main", "Country", ClauseDistinct, 3, "*"), }, nil) // bucket weight order: RU > DE > FR - nodes := []netmap.NodeInfo{ + nodes := []NodeInfo{ nodeInfoFromAttributes("Country", "Germany", PriceAttr, "2", CapacityAttr, "10000"), nodeInfoFromAttributes("Country", "Germany", PriceAttr, "4", CapacityAttr, "1"), nodeInfoFromAttributes("Country", "France", PriceAttr, "3", CapacityAttr, "10"), @@ -158,7 +158,7 @@ func TestPlacementPolicy_ProcessSelectorsHRW(t *testing.T) { nodeInfoFromAttributes("Country", "France", PriceAttr, "7", CapacityAttr, "10000"), nodeInfoFromAttributes("Country", "Russia", PriceAttr, "2", CapacityAttr, "1"), } - nm, err := NewNetmap(NodesFromV2(nodes)) + nm, err := NewNetmap(NodesFromInfo(nodes)) require.NoError(t, err) c := NewContext(nm) c.setPivot([]byte("containerID")) @@ -189,46 +189,46 @@ func TestPlacementPolicy_ProcessSelectorsHRW(t *testing.T) { func TestPlacementPolicy_ProcessSelectorsInvalid(t *testing.T) { testCases := []struct { name string - p *netmap.PlacementPolicy + p *PlacementPolicy err error }{ { "MissingSelector", newPlacementPolicy(2, nil, - []*netmap.Selector{nil}, - []*netmap.Filter{}), + []*Selector{nil}, + []*Filter{}), ErrMissingField, }, { "InvalidFilterReference", newPlacementPolicy(1, nil, - []*netmap.Selector{newSelector("MyStore", "Country", netmap.Distinct, 1, "FromNL")}, - []*netmap.Filter{newFilter("FromRU", "Country", "Russia", netmap.EQ)}), + []*Selector{newSelector("MyStore", "Country", ClauseDistinct, 1, "FromNL")}, + []*Filter{newFilter("FromRU", "Country", "Russia", OpEQ)}), ErrFilterNotFound, }, { "NotEnoughNodes (backup factor)", newPlacementPolicy(2, nil, - []*netmap.Selector{newSelector("MyStore", "Country", netmap.Distinct, 1, "FromRU")}, - []*netmap.Filter{newFilter("FromRU", "Country", "Russia", netmap.EQ)}), + []*Selector{newSelector("MyStore", "Country", ClauseDistinct, 1, "FromRU")}, + []*Filter{newFilter("FromRU", "Country", "Russia", OpEQ)}), ErrNotEnoughNodes, }, { "NotEnoughNodes (buckets)", newPlacementPolicy(1, nil, - []*netmap.Selector{newSelector("MyStore", "Country", netmap.Distinct, 2, "FromRU")}, - []*netmap.Filter{newFilter("FromRU", "Country", "Russia", netmap.EQ)}), + []*Selector{newSelector("MyStore", "Country", ClauseDistinct, 2, "FromRU")}, + []*Filter{newFilter("FromRU", "Country", "Russia", OpEQ)}), ErrNotEnoughNodes, }, } - nodes := []netmap.NodeInfo{ + nodes := []NodeInfo{ nodeInfoFromAttributes("Country", "Russia"), nodeInfoFromAttributes("Country", "Germany"), nodeInfoFromAttributes(), } for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { - nm, err := NewNetmap(NodesFromV2(nodes)) + nm, err := NewNetmap(NodesFromInfo(nodes)) require.NoError(t, err) c := NewContext(nm) require.NoError(t, c.processFilters(tc.p)) From 162b0de725f3e75b02baaa3af7fe352dcac4e278 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 5 Nov 2020 15:49:31 +0300 Subject: [PATCH 0516/1196] [#189] sdk/client: Return NodeInfo SDK type from EndpointInfo method Signed-off-by: Leonard Lyubich --- pkg/client/netmap.go | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/pkg/client/netmap.go b/pkg/client/netmap.go index d8a66d2..869b91c 100644 --- a/pkg/client/netmap.go +++ b/pkg/client/netmap.go @@ -3,8 +3,9 @@ package client import ( "context" + "github.com/nspcc-dev/neofs-api-go/pkg/netmap" "github.com/nspcc-dev/neofs-api-go/v2/client" - "github.com/nspcc-dev/neofs-api-go/v2/netmap" + v2netmap "github.com/nspcc-dev/neofs-api-go/v2/netmap" v2signature "github.com/nspcc-dev/neofs-api-go/v2/signature" "github.com/pkg/errors" ) @@ -20,7 +21,7 @@ func (c Client) EndpointInfo(ctx context.Context, opts ...CallOption) (*netmap.N return nil, err } - return resp.GetBody().GetNodeInfo(), nil + return netmap.NewNodeInfoFromV2(resp.GetBody().GetNodeInfo()), nil default: return nil, unsupportedProtocolErr } @@ -41,16 +42,16 @@ func (c Client) Epoch(ctx context.Context, opts ...CallOption) (uint64, error) { } } -func (c Client) endpointInfoV2(ctx context.Context, opts ...CallOption) (*netmap.LocalNodeInfoResponse, error) { +func (c Client) endpointInfoV2(ctx context.Context, opts ...CallOption) (*v2netmap.LocalNodeInfoResponse, error) { // apply all available options callOptions := c.defaultCallOptions() for i := range opts { opts[i].apply(&callOptions) } - reqBody := new(netmap.LocalNodeInfoRequestBody) + reqBody := new(v2netmap.LocalNodeInfoRequestBody) - req := new(netmap.LocalNodeInfoRequest) + req := new(v2netmap.LocalNodeInfoRequest) req.SetBody(reqBody) req.SetMetaHeader(v2MetaHeaderFromOpts(callOptions)) @@ -82,19 +83,19 @@ func (c Client) endpointInfoV2(ctx context.Context, opts ...CallOption) (*netmap } } -func v2NetmapClientFromOptions(opts *clientOptions) (cli *netmap.Client, err error) { +func v2NetmapClientFromOptions(opts *clientOptions) (cli *v2netmap.Client, err error) { switch { case opts.grpcOpts.v2NetmapClient != nil: // return value from client cache return opts.grpcOpts.v2NetmapClient, nil case opts.grpcOpts.conn != nil: - cli, err = netmap.NewClient(netmap.WithGlobalOpts( + cli, err = v2netmap.NewClient(v2netmap.WithGlobalOpts( client.WithGRPCConn(opts.grpcOpts.conn)), ) case opts.addr != "": - cli, err = netmap.NewClient(netmap.WithGlobalOpts( + cli, err = v2netmap.NewClient(v2netmap.WithGlobalOpts( client.WithNetworkAddress(opts.addr)), ) From d704795dcc7b7b3f7a6ec6b798b9323615c390a7 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Thu, 5 Nov 2020 18:35:58 +0300 Subject: [PATCH 0517/1196] [#189] sdk/netmap: Define unspecified clause Signed-off-by: Alex Vanin --- pkg/netmap/clause.go | 4 ++-- pkg/netmap/clause_test.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/netmap/clause.go b/pkg/netmap/clause.go index 87b4e47..2e0278b 100644 --- a/pkg/netmap/clause.go +++ b/pkg/netmap/clause.go @@ -9,7 +9,7 @@ import ( type Clause uint32 const ( - _ Clause = iota + ClauseUnspecified Clause = iota // ClauseSame is a selector modifier to select only nodes having the same value of bucket attribute. ClauseSame @@ -22,7 +22,7 @@ const ( func ClauseFromV2(c netmap.Clause) Clause { switch c { default: - return 0 + return ClauseUnspecified case netmap.Same: return ClauseSame case netmap.Distinct: diff --git a/pkg/netmap/clause_test.go b/pkg/netmap/clause_test.go index fd3a464..b30d89b 100644 --- a/pkg/netmap/clause_test.go +++ b/pkg/netmap/clause_test.go @@ -13,7 +13,7 @@ func TestClauseFromV2(t *testing.T) { cV2 netmap.Clause }{ { - c: 0, + c: ClauseUnspecified, cV2: netmap.UnspecifiedClause, }, { From ef31dec43ae40ed60244c3d09d1cbfaab225ab1f Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Tue, 10 Nov 2020 13:08:32 +0300 Subject: [PATCH 0518/1196] [#191] Recompile latest neofs-api repository Signed-off-by: Alex Vanin --- go.mod | 1 - go.sum | 3 --- util/proto/test/test.pb.go | 2 +- v2/accounting/grpc/service.pb.go | 2 +- v2/accounting/grpc/types.pb.go | 2 +- v2/acl/grpc/types.pb.go | 4 +++- v2/container/grpc/service.pb.go | 2 +- v2/container/grpc/types.pb.go | 2 +- v2/netmap/grpc/service.pb.go | 2 +- v2/netmap/grpc/types.pb.go | 2 +- v2/object/grpc/service.pb.go | 20 ++++++++++++++------ v2/object/grpc/types.pb.go | 6 ++++-- v2/refs/grpc/types.pb.go | 2 +- v2/session/grpc/service.pb.go | 2 +- v2/session/grpc/types.pb.go | 2 +- v2/storagegroup/grpc/types.pb.go | 2 +- 16 files changed, 32 insertions(+), 24 deletions(-) diff --git a/go.mod b/go.mod index 49151e1..6ea4d69 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,6 @@ module github.com/nspcc-dev/neofs-api-go go 1.14 require ( - github.com/alecthomas/participle v0.6.0 github.com/golang/protobuf v1.4.3 github.com/google/uuid v1.1.1 github.com/mr-tron/base58 v1.1.2 diff --git a/go.sum b/go.sum index 612803a..163f26c 100644 --- a/go.sum +++ b/go.sum @@ -11,9 +11,6 @@ github.com/Workiva/go-datastructures v1.0.50/go.mod h1:Z+F2Rca0qCsVYDS8z7bAGm8f3 github.com/abiosoft/ishell v2.0.0+incompatible/go.mod h1:HQR9AqF2R3P4XXpMpI0NAzgHf/aS6+zVXRj14cVk9qg= github.com/abiosoft/readline v0.0.0-20180607040430-155bce2042db/go.mod h1:rB3B4rKii8V21ydCbIzH5hZiCQE7f5E9SzUb/ZZx530= github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= -github.com/alecthomas/participle v0.6.0 h1:Pvo8XUCQKgIywVjz/+Ci3IsjGg+g/TdKkMcfgghKCEw= -github.com/alecthomas/participle v0.6.0/go.mod h1:HfdmEuwvr12HXQN44HPWXR0lHmVolVYe4dyL6lQ3duY= -github.com/alecthomas/repr v0.0.0-20181024024818-d37bc2a10ba1/go.mod h1:xTS7Pm1pD1mvyM075QCDSRqH6qRLXylzS24ZTpRiSzQ= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= diff --git a/util/proto/test/test.pb.go b/util/proto/test/test.pb.go index 91c3f8b..f581442 100644 --- a/util/proto/test/test.pb.go +++ b/util/proto/test/test.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.23.0 -// protoc v3.11.4 +// protoc v3.13.0 // source: util/proto/test/test.proto package test diff --git a/v2/accounting/grpc/service.pb.go b/v2/accounting/grpc/service.pb.go index 2ef4b19..2f29d12 100644 --- a/v2/accounting/grpc/service.pb.go +++ b/v2/accounting/grpc/service.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.23.0 -// protoc v3.11.4 +// protoc v3.13.0 // source: v2/accounting/grpc/service.proto package accounting diff --git a/v2/accounting/grpc/types.pb.go b/v2/accounting/grpc/types.pb.go index 13c3bf9..dd62f96 100644 --- a/v2/accounting/grpc/types.pb.go +++ b/v2/accounting/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.23.0 -// protoc v3.11.4 +// protoc v3.13.0 // source: v2/accounting/grpc/types.proto package accounting diff --git a/v2/acl/grpc/types.pb.go b/v2/acl/grpc/types.pb.go index 2e9656b..e1805a3 100644 --- a/v2/acl/grpc/types.pb.go +++ b/v2/acl/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.23.0 -// protoc v3.11.4 +// protoc v3.13.0 // source: v2/acl/grpc/types.proto package acl @@ -539,6 +539,8 @@ func (x *BearerToken) GetSignature() *grpc.Signature { // // * $Object:version \ // version +// * $Object:objectID \ +// object_id // * $Object:containerID \ // container_id // * $Object:ownerID \ diff --git a/v2/container/grpc/service.pb.go b/v2/container/grpc/service.pb.go index 6edd4ce..68d8392 100644 --- a/v2/container/grpc/service.pb.go +++ b/v2/container/grpc/service.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.23.0 -// protoc v3.11.4 +// protoc v3.13.0 // source: v2/container/grpc/service.proto package container diff --git a/v2/container/grpc/types.pb.go b/v2/container/grpc/types.pb.go index 5103e7d..f5232e5 100644 --- a/v2/container/grpc/types.pb.go +++ b/v2/container/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.23.0 -// protoc v3.11.4 +// protoc v3.13.0 // source: v2/container/grpc/types.proto package container diff --git a/v2/netmap/grpc/service.pb.go b/v2/netmap/grpc/service.pb.go index b30be26..721f282 100644 --- a/v2/netmap/grpc/service.pb.go +++ b/v2/netmap/grpc/service.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.23.0 -// protoc v3.11.4 +// protoc v3.13.0 // source: v2/netmap/grpc/service.proto package netmap diff --git a/v2/netmap/grpc/types.pb.go b/v2/netmap/grpc/types.pb.go index 9bc0e1d..b7347eb 100644 --- a/v2/netmap/grpc/types.pb.go +++ b/v2/netmap/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.23.0 -// protoc v3.11.4 +// protoc v3.13.0 // source: v2/netmap/grpc/types.proto package netmap diff --git a/v2/object/grpc/service.pb.go b/v2/object/grpc/service.pb.go index 3a49b0d..e35c1d0 100644 --- a/v2/object/grpc/service.pb.go +++ b/v2/object/grpc/service.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.23.0 -// protoc v3.11.4 +// protoc v3.13.0 // source: v2/object/grpc/service.proto package object @@ -1875,6 +1875,8 @@ func (x *SearchRequest_Body) GetFilters() []*SearchRequest_Body_Filter { // // * $Object:version \ // version +// * $Object:objectID \ +// object_id // * $Object:containerID \ // container_id // * $Object:ownerID \ @@ -1896,11 +1898,17 @@ func (x *SearchRequest_Body) GetFilters() []*SearchRequest_Body_Filter { // properties: // // * $Object:ROOT \ -// With the `value` set to `true` checks if an object is a top object in a -// split hierarchy. With other values returns non-root objects. -// * $Object:LEAF \ -// With the `value` set to `true` checks if an object is a leaf in a split -// hierarchy. With other values returns non-leaf objects. +// Returns only `REGULAR` type objects that are not split or are the top +// level root objects in a split hierarchy. This includes objects not +// present physically, like large objects split into smaller objects +// without separate top-level root object. Other type objects like +// StorageGroups and Tombstones will not be shown. This filter may be +// useful for listing objects like `ls` command of some virtual file +// system. This filter is activated if the `key` exists, disregarding the +// value and matcher type. +// * $Object:PHY \ +// Returns only objects physically stored in the system. This filter is +// activated if the `key` exists, disregarding the value and matcher type. // * $Object:CHILDFREE \ // With the `value` set to `true` checks if an object has empty // children list in `Split` header. With other values returns diff --git a/v2/object/grpc/types.pb.go b/v2/object/grpc/types.pb.go index fd62c34..0498da0 100644 --- a/v2/object/grpc/types.pb.go +++ b/v2/object/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.23.0 -// protoc v3.11.4 +// protoc v3.13.0 // source: v2/object/grpc/types.proto package object @@ -27,7 +27,9 @@ const ( // of the legacy proto package is being used. const _ = proto.ProtoPackageIsVersion4 -// Type of the object payload content. +// Type of the object payload content. Only `REGULAR` type objects can be split, +// hence `TOMBSTONE` and `STORAGEGROUP` payload is limited by maximal object +// size. type ObjectType int32 const ( diff --git a/v2/refs/grpc/types.pb.go b/v2/refs/grpc/types.pb.go index 2d4be15..c9994bd 100644 --- a/v2/refs/grpc/types.pb.go +++ b/v2/refs/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.23.0 -// protoc v3.11.4 +// protoc v3.13.0 // source: v2/refs/grpc/types.proto package refs diff --git a/v2/session/grpc/service.pb.go b/v2/session/grpc/service.pb.go index 19f9e62..712500e 100644 --- a/v2/session/grpc/service.pb.go +++ b/v2/session/grpc/service.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.23.0 -// protoc v3.11.4 +// protoc v3.13.0 // source: v2/session/grpc/service.proto package session diff --git a/v2/session/grpc/types.pb.go b/v2/session/grpc/types.pb.go index ac38c54..7140ceb 100644 --- a/v2/session/grpc/types.pb.go +++ b/v2/session/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.23.0 -// protoc v3.11.4 +// protoc v3.13.0 // source: v2/session/grpc/types.proto package session diff --git a/v2/storagegroup/grpc/types.pb.go b/v2/storagegroup/grpc/types.pb.go index 5b00a18..96e9d87 100644 --- a/v2/storagegroup/grpc/types.pb.go +++ b/v2/storagegroup/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.23.0 -// protoc v3.11.4 +// protoc v3.13.0 // source: v2/storagegroup/grpc/types.proto package storagegroup From 91eade02cd0bd79435fcbc7ccbfc4dc0d71cbded Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Mon, 9 Nov 2020 15:29:26 +0300 Subject: [PATCH 0519/1196] [#191] v2/object: Rename `leaf` filter to `phy` Signed-off-by: Alex Vanin --- pkg/object/search.go | 18 +++++++++--------- pkg/object/search_test.go | 12 ++++++------ v2/object/filters.go | 6 +++--- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/pkg/object/search.go b/pkg/object/search.go index 23eeb2c..2fdcd9e 100644 --- a/pkg/object/search.go +++ b/pkg/object/search.go @@ -70,7 +70,7 @@ const ( fKeyHomomorphicHash fKeyParent fKeyPropRoot - fKeyPropLeaf + fKeyPropPhy fKeyPropChildfree ) @@ -98,8 +98,8 @@ func (k filterKey) String() string { return v2object.FilterHeaderParent case fKeyPropRoot: return v2object.FilterPropertyRoot - case fKeyPropLeaf: - return v2object.FilterPropertyLeaf + case fKeyPropPhy: + return v2object.FilterPropertyPhy case fKeyPropChildfree: return v2object.FilterPropertyChildfree } @@ -211,16 +211,16 @@ func (f *SearchFilters) AddNonRootFilter() { f.addRootFilter(false) } -func (f *SearchFilters) addLeafFilter(val bool) { - f.addReservedFilter(MatchStringEqual, fKeyPropLeaf, boolStringer(val)) +func (f *SearchFilters) addPhyFilter(val bool) { + f.addReservedFilter(MatchStringEqual, fKeyPropPhy, boolStringer(val)) } -func (f *SearchFilters) AddLeafFilter() { - f.addLeafFilter(true) +func (f *SearchFilters) AddPhyFilter() { + f.addPhyFilter(true) } -func (f *SearchFilters) AddNonLeafFilter() { - f.addLeafFilter(false) +func (f *SearchFilters) AddNonPhyFilter() { + f.addPhyFilter(false) } func (f *SearchFilters) addChildFreeFilter(val bool) { diff --git a/pkg/object/search_test.go b/pkg/object/search_test.go index e126b5b..f6caae7 100644 --- a/pkg/object/search_test.go +++ b/pkg/object/search_test.go @@ -81,31 +81,31 @@ func TestSearchFilters_AddNonRootFilter(t *testing.T) { require.Equal(t, v2object.BooleanPropertyValueFalse, f.Value()) } -func TestSearchFilters_AddLeafFilter(t *testing.T) { +func TestSearchFilters_AddPhyFilter(t *testing.T) { fs := new(object.SearchFilters) - fs.AddLeafFilter() + fs.AddPhyFilter() require.Len(t, *fs, 1) f := (*fs)[0] require.Equal(t, object.MatchStringEqual, f.Operation()) - require.Equal(t, v2object.FilterPropertyLeaf, f.Header()) + require.Equal(t, v2object.FilterPropertyPhy, f.Header()) require.Equal(t, v2object.BooleanPropertyValueTrue, f.Value()) } -func TestSearchFilters_AddNonLeafFilter(t *testing.T) { +func TestSearchFilters_AddNonPhyFilter(t *testing.T) { fs := new(object.SearchFilters) - fs.AddNonLeafFilter() + fs.AddNonPhyFilter() require.Len(t, *fs, 1) f := (*fs)[0] require.Equal(t, object.MatchStringEqual, f.Operation()) - require.Equal(t, v2object.FilterPropertyLeaf, f.Header()) + require.Equal(t, v2object.FilterPropertyPhy, f.Header()) require.Equal(t, v2object.BooleanPropertyValueFalse, f.Value()) } diff --git a/v2/object/filters.go b/v2/object/filters.go index a9eecbe..a5f548f 100644 --- a/v2/object/filters.go +++ b/v2/object/filters.go @@ -33,11 +33,11 @@ const ( ) const ( - // FilterPropertyRoot is a filter key to check if an object is a top object in a split hierarchy. + // FilterPropertyRoot is a filter key to check if regular object is on top of split hierarchy. FilterPropertyRoot = ReservedFilterPrefix + "ROOT" - // FilterPropertyLeaf is a filter key to check if an object is a leaf in a split hierarchy. - FilterPropertyLeaf = ReservedFilterPrefix + "LEAF" + // FilterPropertyPhy is a filter key to check if an object physically stored on a node. + FilterPropertyPhy = ReservedFilterPrefix + "PHY" // FilterPropertyChildfree is a filter key to check if an object has empty children list in `Split` header. FilterPropertyChildfree = ReservedFilterPrefix + "CHILDFREE" From fe48e3ab5b535c56302b909a539840340e874ef1 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Mon, 9 Nov 2020 15:41:40 +0300 Subject: [PATCH 0520/1196] [#191] pkg/object: Use `root` and `phy` filters as flags Inverted values for `root` and `phy` filters now are not supported. Therefore these filters works like flags. It either presented in search query or not. Signed-off-by: Alex Vanin --- pkg/object/search.go | 27 +++++++++++++-------------- pkg/object/search_test.go | 36 ++++-------------------------------- 2 files changed, 17 insertions(+), 46 deletions(-) diff --git a/pkg/object/search.go b/pkg/object/search.go index 2fdcd9e..167f21f 100644 --- a/pkg/object/search.go +++ b/pkg/object/search.go @@ -173,6 +173,13 @@ func (f *SearchFilters) addReservedFilter(op SearchMatchType, keyTyp filterKeyTy f.addFilter(op, keyTyp, "", val) } +// addFlagFilters adds filters that works like flags: they don't need to have +// specific match type or value. They processed by NeoFS nodes by the fact +// of presence in search query. E.g.: PHY, ROOT. +func (f *SearchFilters) addFlagFilter(keyTyp filterKeyType) { + f.addFilter(MatchUnknown, keyTyp, "", staticStringer("")) +} + func (f *SearchFilters) AddObjectVersionFilter(op SearchMatchType, v *pkg.Version) { f.addReservedFilter(op, fKeyVersion, v) } @@ -199,28 +206,20 @@ func (f SearchFilters) ToV2() []*v2object.SearchFilter { return result } -func (f *SearchFilters) addRootFilter(val bool) { - f.addReservedFilter(MatchStringEqual, fKeyPropRoot, boolStringer(val)) +func (f *SearchFilters) addRootFilter() { + f.addFlagFilter(fKeyPropRoot) } func (f *SearchFilters) AddRootFilter() { - f.addRootFilter(true) + f.addRootFilter() } -func (f *SearchFilters) AddNonRootFilter() { - f.addRootFilter(false) -} - -func (f *SearchFilters) addPhyFilter(val bool) { - f.addReservedFilter(MatchStringEqual, fKeyPropPhy, boolStringer(val)) +func (f *SearchFilters) addPhyFilter() { + f.addFlagFilter(fKeyPropPhy) } func (f *SearchFilters) AddPhyFilter() { - f.addPhyFilter(true) -} - -func (f *SearchFilters) AddNonPhyFilter() { - f.addPhyFilter(false) + f.addPhyFilter() } func (f *SearchFilters) addChildFreeFilter(val bool) { diff --git a/pkg/object/search_test.go b/pkg/object/search_test.go index f6caae7..ca28f1f 100644 --- a/pkg/object/search_test.go +++ b/pkg/object/search_test.go @@ -62,23 +62,9 @@ func TestSearchFilters_AddRootFilter(t *testing.T) { f := (*fs)[0] - require.Equal(t, object.MatchStringEqual, f.Operation()) + require.Equal(t, object.MatchUnknown, f.Operation()) require.Equal(t, v2object.FilterPropertyRoot, f.Header()) - require.Equal(t, v2object.BooleanPropertyValueTrue, f.Value()) -} - -func TestSearchFilters_AddNonRootFilter(t *testing.T) { - fs := new(object.SearchFilters) - - fs.AddNonRootFilter() - - require.Len(t, *fs, 1) - - f := (*fs)[0] - - require.Equal(t, object.MatchStringEqual, f.Operation()) - require.Equal(t, v2object.FilterPropertyRoot, f.Header()) - require.Equal(t, v2object.BooleanPropertyValueFalse, f.Value()) + require.Equal(t, "", f.Value()) } func TestSearchFilters_AddPhyFilter(t *testing.T) { @@ -90,23 +76,9 @@ func TestSearchFilters_AddPhyFilter(t *testing.T) { f := (*fs)[0] - require.Equal(t, object.MatchStringEqual, f.Operation()) + require.Equal(t, object.MatchUnknown, f.Operation()) require.Equal(t, v2object.FilterPropertyPhy, f.Header()) - require.Equal(t, v2object.BooleanPropertyValueTrue, f.Value()) -} - -func TestSearchFilters_AddNonPhyFilter(t *testing.T) { - fs := new(object.SearchFilters) - - fs.AddNonPhyFilter() - - require.Len(t, *fs, 1) - - f := (*fs)[0] - - require.Equal(t, object.MatchStringEqual, f.Operation()) - require.Equal(t, v2object.FilterPropertyPhy, f.Header()) - require.Equal(t, v2object.BooleanPropertyValueFalse, f.Value()) + require.Equal(t, "", f.Value()) } func testOID() *object.ID { From abed8a915631534df876e3b79edfbc6d67eef798 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Tue, 10 Nov 2020 13:43:25 +0300 Subject: [PATCH 0521/1196] [#191] v2: Add ObjectID filters for ACL and Object packages Signed-off-by: Alex Vanin --- pkg/acl/eacl/filter.go | 3 +++ pkg/object/search.go | 3 +++ v2/acl/filters.go | 3 +++ v2/object/filters.go | 3 +++ 4 files changed, 12 insertions(+) diff --git a/pkg/acl/eacl/filter.go b/pkg/acl/eacl/filter.go index 1771b95..7608f3f 100644 --- a/pkg/acl/eacl/filter.go +++ b/pkg/acl/eacl/filter.go @@ -29,6 +29,7 @@ type filterKeyType int const ( _ filterKeyType = iota fKeyObjVersion + fKeyObjID fKeyObjContainerID fKeyObjOwnerID fKeyObjCreationEpoch @@ -74,6 +75,8 @@ func (k filterKey) String() string { return k.str case fKeyObjVersion: return v2acl.FilterObjectVersion + case fKeyObjID: + return v2acl.FilterObjectID case fKeyObjContainerID: return v2acl.FilterObjectContainerID case fKeyObjOwnerID: diff --git a/pkg/object/search.go b/pkg/object/search.go index 167f21f..d2cb849 100644 --- a/pkg/object/search.go +++ b/pkg/object/search.go @@ -61,6 +61,7 @@ type SearchFilters []SearchFilter const ( _ filterKeyType = iota fKeyVersion + fKeyObjectID fKeyContainerID fKeyOwnerID fKeyCreationEpoch @@ -80,6 +81,8 @@ func (k filterKey) String() string { return k.str case fKeyVersion: return v2object.FilterHeaderVersion + case fKeyObjectID: + return v2object.FilterHeaderObjectID case fKeyContainerID: return v2object.FilterHeaderContainerID case fKeyOwnerID: diff --git a/v2/acl/filters.go b/v2/acl/filters.go index 8b73f42..461d2b9 100644 --- a/v2/acl/filters.go +++ b/v2/acl/filters.go @@ -7,6 +7,9 @@ const ( // FilterObjectVersion is a filter key to "version" field of the object header. FilterObjectVersion = ObjectFilterPrefix + "version" + // FilterObjectID is a filter key to "object_id" field of the object. + FilterObjectID = ObjectFilterPrefix + "objectID" + // FilterObjectContainerID is a filter key to "container_id" field of the object header. FilterObjectContainerID = ObjectFilterPrefix + "containerID" diff --git a/v2/object/filters.go b/v2/object/filters.go index a5f548f..e0e750a 100644 --- a/v2/object/filters.go +++ b/v2/object/filters.go @@ -7,6 +7,9 @@ const ( // FilterHeaderVersion is a filter key to "version" field of the object header. FilterHeaderVersion = ReservedFilterPrefix + "version" + // FilterHeaderObjectID is a filter key to "object_id" field of the object. + FilterHeaderObjectID = ReservedFilterPrefix + "objectID" + // FilterHeaderContainerID is a filter key to "container_id" field of the object header. FilterHeaderContainerID = ReservedFilterPrefix + "containerID" From 789474906015337ba790d1781c6c1ec230f2edb7 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Wed, 11 Nov 2020 10:48:51 +0300 Subject: [PATCH 0522/1196] [#192] v2/netmap: Fix client error messages Signed-off-by: Alex Vanin --- v2/netmap/client.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/v2/netmap/client.go b/v2/netmap/client.go index 6d375d7..b71533f 100644 --- a/v2/netmap/client.go +++ b/v2/netmap/client.go @@ -47,7 +47,7 @@ type localNodeInfoClient struct { func (c *Client) LocalNodeInfo(ctx context.Context, req *LocalNodeInfoRequest) (*LocalNodeInfoResponse, error) { resp, err := c.cLocalNodeInfo.caller(ctx, c.cLocalNodeInfo.requestConverter(req)) if err != nil { - return nil, errors.Wrap(err, "could not send container put request") + return nil, errors.Wrap(err, "could not send local node info request") } return c.cLocalNodeInfo.responseConverter(resp), nil @@ -93,7 +93,7 @@ func NewClient(opts ...Option) (*Client, error) { err = client.ErrProtoUnsupported } - return nil, errors.Wrapf(err, "could not create %s Session client", cfg.proto) + return nil, errors.Wrapf(err, "could not create %s Netmap client", cfg.proto) } func newGRPCClient(cfg *cfg) (*netmap.Client, error) { From f16a420bed509e129b65a14fc0751ffb850a4752 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Wed, 11 Nov 2020 16:49:54 +0300 Subject: [PATCH 0523/1196] [#193] pkg/container: Wrap container structure with SDK functions All setters and getters should work with SDK types. Signed-off-by: Alex Vanin --- pkg/container/attribute.go | 56 +++++++++++++++++++++++++++++ pkg/container/container.go | 72 ++++++++++++++++++++++++++++++-------- pkg/container/opts.go | 10 +++--- 3 files changed, 118 insertions(+), 20 deletions(-) create mode 100644 pkg/container/attribute.go diff --git a/pkg/container/attribute.go b/pkg/container/attribute.go new file mode 100644 index 0000000..6f72c4c --- /dev/null +++ b/pkg/container/attribute.go @@ -0,0 +1,56 @@ +package container + +import ( + "github.com/nspcc-dev/neofs-api-go/v2/container" +) + +type ( + Attribute container.Attribute + Attributes []*Attribute +) + +func NewAttribute() *Attribute { + return NewAttributeFromV2(new(container.Attribute)) +} + +func (a *Attribute) SetKey(v string) { + (*container.Attribute)(a).SetKey(v) +} + +func (a *Attribute) SetValue(v string) { + (*container.Attribute)(a).SetValue(v) +} + +func (a *Attribute) Key() string { + return (*container.Attribute)(a).GetKey() +} + +func (a *Attribute) Value() string { + return (*container.Attribute)(a).GetValue() +} + +func NewAttributeFromV2(v *container.Attribute) *Attribute { + return (*Attribute)(v) +} + +func (a *Attribute) ToV2() *container.Attribute { + return (*container.Attribute)(a) +} + +func NewAttributesFromV2(v []*container.Attribute) Attributes { + attrs := make(Attributes, 0, len(v)) + for i := range v { + attrs = append(attrs, NewAttributeFromV2(v[i])) + } + + return attrs +} + +func (a Attributes) ToV2() []*container.Attribute { + attrs := make([]*container.Attribute, 0, len(a)) + for i := range a { + attrs = append(attrs, a[i].ToV2()) + } + + return attrs +} diff --git a/pkg/container/container.go b/pkg/container/container.go index df6732f..3d64633 100644 --- a/pkg/container/container.go +++ b/pkg/container/container.go @@ -3,11 +3,14 @@ package container import ( "crypto/sha256" + "github.com/nspcc-dev/neofs-api-go/pkg" + "github.com/nspcc-dev/neofs-api-go/pkg/netmap" + "github.com/nspcc-dev/neofs-api-go/pkg/owner" "github.com/nspcc-dev/neofs-api-go/v2/container" ) type Container struct { - container.Container + v2 container.Container } func New(opts ...NewOption) *Container { @@ -21,36 +24,27 @@ func New(opts ...NewOption) *Container { cnr.SetBasicACL(cnrOptions.acl) if cnrOptions.owner != nil { - cnr.SetOwnerID(cnrOptions.owner.ToV2()) + cnr.SetOwnerID(cnrOptions.owner) } if cnrOptions.policy != nil { - cnr.SetPlacementPolicy(cnrOptions.policy.ToV2()) + cnr.SetPlacementPolicy(cnrOptions.policy) } - attributes := make([]*container.Attribute, len(cnrOptions.attributes)) - for i := range cnrOptions.attributes { - attribute := new(container.Attribute) - attribute.SetKey(cnrOptions.attributes[i].key) - attribute.SetValue(cnrOptions.attributes[i].value) - attributes[i] = attribute - } - if len(attributes) > 0 { - cnr.SetAttributes(attributes) - } + cnr.SetAttributes(cnrOptions.attributes) return cnr } func (c Container) ToV2() *container.Container { - return &c.Container + return &c.v2 } func NewContainerFromV2(c *container.Container) *Container { cnr := new(Container) if c != nil { - cnr.Container = *c + cnr.v2 = *c } return cnr @@ -69,3 +63,51 @@ func CalculateID(c *Container) *ID { return id } + +func (c *Container) Version() *pkg.Version { + return pkg.NewVersionFromV2(c.v2.GetVersion()) +} + +func (c *Container) SetVersion(v *pkg.Version) { + c.v2.SetVersion(v.ToV2()) +} + +func (c *Container) OwnerID() *owner.ID { + return owner.NewIDFromV2(c.v2.GetOwnerID()) +} + +func (c *Container) SetOwnerID(v *owner.ID) { + c.v2.SetOwnerID(v.ToV2()) +} + +func (c *Container) Nonce() []byte { + return c.v2.GetNonce() // return uuid? +} + +func (c *Container) SetNonce(v []byte) { + c.v2.SetNonce(v) // set uuid? +} + +func (c *Container) BasicACL() uint32 { + return c.v2.GetBasicACL() +} + +func (c *Container) SetBasicACL(v uint32) { + c.v2.SetBasicACL(v) +} + +func (c *Container) Attributes() Attributes { + return NewAttributesFromV2(c.v2.GetAttributes()) +} + +func (c *Container) SetAttributes(v Attributes) { + c.v2.SetAttributes(v.ToV2()) +} + +func (c *Container) PlacementPolicy() *netmap.PlacementPolicy { + return netmap.NewPlacementPolicyFromV2(c.v2.GetPlacementPolicy()) +} + +func (c *Container) SetPlacementPolicy(v *netmap.PlacementPolicy) { + c.v2.SetPlacementPolicy(v.ToV2()) +} diff --git a/pkg/container/opts.go b/pkg/container/opts.go index 106f52b..424891d 100644 --- a/pkg/container/opts.go +++ b/pkg/container/opts.go @@ -20,7 +20,7 @@ type ( containerOptions struct { acl uint32 policy *netmap.PlacementPolicy - attributes []attribute + attributes Attributes owner *owner.ID nonce uuid.UUID } @@ -100,10 +100,10 @@ func WithPolicy(policy *netmap.PlacementPolicy) NewOption { func WithAttribute(key, value string) NewOption { return newFuncContainerOption(func(option *containerOptions) { - attr := attribute{ - key: key, - value: value, - } + attr := NewAttribute() + attr.SetKey(key) + attr.SetValue(value) + option.attributes = append(option.attributes, attr) }) } From 5ff7b5ba6b88c26fe48b77101177afa8ba05e09c Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Wed, 11 Nov 2020 17:21:55 +0300 Subject: [PATCH 0524/1196] [#193] pkg/container: Increase test coverage Signed-off-by: Alex Vanin --- pkg/container/attribute_test.go | 84 +++++++++++++++++++++++++++++++++ pkg/container/container_test.go | 68 ++++++++++++++++++++++++++ 2 files changed, 152 insertions(+) create mode 100644 pkg/container/attribute_test.go create mode 100644 pkg/container/container_test.go diff --git a/pkg/container/attribute_test.go b/pkg/container/attribute_test.go new file mode 100644 index 0000000..a7a700d --- /dev/null +++ b/pkg/container/attribute_test.go @@ -0,0 +1,84 @@ +package container_test + +import ( + "testing" + + "github.com/nspcc-dev/neofs-api-go/pkg/container" + "github.com/stretchr/testify/require" +) + +func TestAttribute(t *testing.T) { + const ( + key = "key" + value = "value" + ) + + attr := container.NewAttribute() + attr.SetKey(key) + attr.SetValue(value) + + require.Equal(t, key, attr.Key()) + require.Equal(t, value, attr.Value()) + + t.Run("test v2", func(t *testing.T) { + const ( + newKey = "newKey" + newValue = "newValue" + ) + + v2 := attr.ToV2() + require.Equal(t, key, v2.GetKey()) + require.Equal(t, value, v2.GetValue()) + + v2.SetKey(newKey) + v2.SetValue(newValue) + + newAttr := container.NewAttributeFromV2(v2) + + require.Equal(t, newKey, newAttr.Key()) + require.Equal(t, newValue, newAttr.Value()) + }) +} + +func TestAttributes(t *testing.T) { + var ( + keys = []string{"key1", "key2", "key3"} + vals = []string{"val1", "val2", "val3"} + ) + + attrs := make(container.Attributes, 0, len(keys)) + + for i := range keys { + attr := container.NewAttribute() + attr.SetKey(keys[i]) + attr.SetValue(vals[i]) + + attrs = append(attrs, attr) + } + + t.Run("test v2", func(t *testing.T) { + const postfix = "x" + + v2 := attrs.ToV2() + require.Len(t, v2, len(keys)) + + for i := range v2 { + k := v2[i].GetKey() + v := v2[i].GetValue() + + require.Equal(t, keys[i], k) + require.Equal(t, vals[i], v) + + v2[i].SetKey(k + postfix) + v2[i].SetValue(v + postfix) + } + + newAttrs := container.NewAttributesFromV2(v2) + require.Len(t, newAttrs, len(keys)) + + for i := range newAttrs { + require.Equal(t, keys[i]+postfix, newAttrs[i].Key()) + require.Equal(t, vals[i]+postfix, newAttrs[i].Value()) + } + }) +} diff --git a/pkg/container/container_test.go b/pkg/container/container_test.go new file mode 100644 index 0000000..ec5e273 --- /dev/null +++ b/pkg/container/container_test.go @@ -0,0 +1,68 @@ +package container_test + +import ( + "strconv" + "testing" + + "github.com/google/uuid" + "github.com/nspcc-dev/neofs-api-go/pkg" + "github.com/nspcc-dev/neofs-api-go/pkg/acl" + "github.com/nspcc-dev/neofs-api-go/pkg/container" + "github.com/nspcc-dev/neofs-api-go/pkg/netmap" + "github.com/nspcc-dev/neofs-api-go/pkg/owner" + "github.com/nspcc-dev/neofs-crypto/test" + "github.com/stretchr/testify/require" +) + +func TestNewContainer(t *testing.T) { + c := container.New() + + nonce, err := uuid.New().MarshalBinary() + require.NoError(t, err) + + wallet, err := owner.NEO3WalletFromPublicKey(&test.DecodeKey(1).PublicKey) + require.NoError(t, err) + + ownerID := owner.NewIDFromNeo3Wallet(wallet) + policy := generatePlacementPolicy() + + c.SetBasicACL(acl.PublicBasicRule) + c.SetAttributes(generateAttributes(5)) + c.SetPlacementPolicy(policy) + c.SetNonce(nonce) + c.SetOwnerID(ownerID) + c.SetVersion(pkg.SDKVersion()) + + v2 := c.ToV2() + newContainer := container.NewContainerFromV2(v2) + + require.EqualValues(t, newContainer.PlacementPolicy(), policy) + require.EqualValues(t, newContainer.Attributes(), generateAttributes(5)) + require.EqualValues(t, newContainer.BasicACL(), acl.PublicBasicRule) + require.EqualValues(t, newContainer.Nonce(), nonce) + require.EqualValues(t, newContainer.OwnerID(), ownerID) + require.EqualValues(t, newContainer.Version(), pkg.SDKVersion()) +} + +func generateAttributes(n int) container.Attributes { + attrs := make(container.Attributes, 0, n) + + for i := 0; i < n; i++ { + strN := strconv.Itoa(n) + + attr := container.NewAttribute() + attr.SetKey("key" + strN) + attr.SetValue("val" + strN) + + attrs = append(attrs, attr) + } + + return attrs +} + +func generatePlacementPolicy() *netmap.PlacementPolicy { + p := new(netmap.PlacementPolicy) + p.SetContainerBackupFactor(10) + + return p +} From d442b204ca12f4c99a93a58bba7780290371d15a Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Wed, 11 Nov 2020 16:50:34 +0300 Subject: [PATCH 0525/1196] [#193] pkg/client: Update container structure Signed-off-by: Alex Vanin --- pkg/client/container.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/client/container.go b/pkg/client/container.go index c723de1..e0e5a37 100644 --- a/pkg/client/container.go +++ b/pkg/client/container.go @@ -100,10 +100,10 @@ func (c Client) putContainerV2(ctx context.Context, cnr *container.Container, op } // set transport version - cnr.SetVersion(c.remoteNode.Version.ToV2()) + cnr.SetVersion(c.remoteNode.Version) // if container owner is not set, then use client key as owner - if cnr.GetOwnerID() == nil { + if cnr.OwnerID() == nil { w, err := owner.NEO3WalletFromPublicKey(&c.key.PublicKey) if err != nil { return nil, err @@ -112,7 +112,7 @@ func (c Client) putContainerV2(ctx context.Context, cnr *container.Container, op ownerID := new(owner.ID) ownerID.SetNeo3Wallet(w) - cnr.SetOwnerID(ownerID.ToV2()) + cnr.SetOwnerID(ownerID) } reqBody := new(v2container.PutRequestBody) From 874a4b937f94539648f5df57fcfbc5a267c5cfb6 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Thu, 12 Nov 2020 09:40:45 +0300 Subject: [PATCH 0526/1196] [#193] pkg/client: Fix error message typos Signed-off-by: Alex Vanin --- pkg/client/container.go | 2 +- pkg/client/netmap.go | 2 +- pkg/client/session.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/client/container.go b/pkg/client/container.go index e0e5a37..a4bc942 100644 --- a/pkg/client/container.go +++ b/pkg/client/container.go @@ -431,7 +431,7 @@ func v2ContainerClientFromOptions(opts *clientOptions) (cli *v2container.Client, ) default: - return nil, errors.New("lack of sdk client options to create accounting client") + return nil, errors.New("lack of sdk client options to create container client") } // check if client correct and save in cache diff --git a/pkg/client/netmap.go b/pkg/client/netmap.go index 869b91c..ea71b05 100644 --- a/pkg/client/netmap.go +++ b/pkg/client/netmap.go @@ -100,7 +100,7 @@ func v2NetmapClientFromOptions(opts *clientOptions) (cli *v2netmap.Client, err e ) default: - return nil, errors.New("lack of sdk client options to create accounting client") + return nil, errors.New("lack of sdk client options to create netmap client") } // check if client correct and save in cache diff --git a/pkg/client/session.go b/pkg/client/session.go index 7f9d6a0..51d08ce 100644 --- a/pkg/client/session.go +++ b/pkg/client/session.go @@ -98,7 +98,7 @@ func v2SessionClientFromOptions(opts *clientOptions) (cli *v2session.Client, err ) default: - return nil, errors.New("lack of sdk client options to create accounting client") + return nil, errors.New("lack of sdk client options to create session client") } // check if client correct and save in cache From e72173459975a6b0b3796bd42d16daaea40e4418 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 13 Nov 2020 11:45:59 +0300 Subject: [PATCH 0527/1196] [#168] netmap: Implement binary and JSON encoders/decoders on Filter Signed-off-by: Leonard Lyubich --- pkg/netmap/filter.go | 31 +++++++ pkg/netmap/filter_test.go | 26 ++++++ pkg/netmap/node_info.go | 79 ++++++++++++---- pkg/netmap/node_info_test.go | 52 +++++++++-- pkg/netmap/policy.go | 47 ++++++---- pkg/netmap/policy_test.go | 24 +++++ pkg/netmap/replica.go | 32 +++++++ pkg/netmap/replica_test.go | 24 +++++ pkg/netmap/selector.go | 31 +++++++ pkg/netmap/selector_test.go | 24 +++++ v2/netmap/json.go | 156 ++++++++++++++++++++++---------- v2/netmap/json_test.go | 92 +++++++++++-------- v2/netmap/marshal.go | 170 ++++++++++++++++++++++++----------- v2/netmap/marshal_test.go | 36 +++----- 14 files changed, 628 insertions(+), 196 deletions(-) diff --git a/pkg/netmap/filter.go b/pkg/netmap/filter.go index fa4efc2..c9b0515 100644 --- a/pkg/netmap/filter.go +++ b/pkg/netmap/filter.go @@ -229,3 +229,34 @@ func (f *Filter) SetInnerFilters(fs ...*Filter) { (*netmap.Filter)(f). SetFilters(filtersToV2(fs)) } + +// Marshal marshals Filter into a protobuf binary form. +// +// Buffer is allocated when the argument is empty. +// Otherwise, the first buffer is used. +func (f *Filter) Marshal(b ...[]byte) ([]byte, error) { + var buf []byte + if len(b) > 0 { + buf = b[0] + } + + return (*netmap.Filter)(f).StableMarshal(buf) +} + +// Unmarshal unmarshals protobuf binary representation of Filter. +func (f *Filter) Unmarshal(data []byte) error { + return (*netmap.Filter)(f). + Unmarshal(data) +} + +// MarshalJSON encodes Filter to protobuf JSON format. +func (f *Filter) MarshalJSON() ([]byte, error) { + return (*netmap.Filter)(f). + MarshalJSON() +} + +// UnmarshalJSON decodes Filter from protobuf JSON format. +func (f *Filter) UnmarshalJSON(data []byte) error { + return (*netmap.Filter)(f). + UnmarshalJSON(data) +} diff --git a/pkg/netmap/filter_test.go b/pkg/netmap/filter_test.go index 512e431..4778432 100644 --- a/pkg/netmap/filter_test.go +++ b/pkg/netmap/filter_test.go @@ -269,3 +269,29 @@ func TestFilter_InnerFilters(t *testing.T) { require.Equal(t, []*Filter{f1, f2}, f.InnerFilters()) } + +func TestFilterEncoding(t *testing.T) { + f := newFilter("name", "key", "value", OpEQ, + newFilter("name2", "key2", "value", OpOR), + ) + + t.Run("binary", func(t *testing.T) { + data, err := f.Marshal() + require.NoError(t, err) + + f2 := NewFilter() + require.NoError(t, f2.Unmarshal(data)) + + require.Equal(t, f, f2) + }) + + t.Run("json", func(t *testing.T) { + data, err := f.MarshalJSON() + require.NoError(t, err) + + f2 := NewFilter() + require.NoError(t, f2.UnmarshalJSON(data)) + + require.Equal(t, f, f2) + }) +} diff --git a/pkg/netmap/node_info.go b/pkg/netmap/node_info.go index 121eaba..80ec7d1 100644 --- a/pkg/netmap/node_info.go +++ b/pkg/netmap/node_info.go @@ -193,6 +193,38 @@ func (a *NodeAttribute) SetParentKeys(keys ...string) { SetParents(keys) } +// Marshal marshals NodeAttribute into a protobuf binary form. +// +// Buffer is allocated when the argument is empty. +// Otherwise, the first buffer is used. +func (a *NodeAttribute) Marshal(b ...[]byte) ([]byte, error) { + var buf []byte + if len(b) > 0 { + buf = b[0] + } + + return (*netmap.Attribute)(a). + StableMarshal(buf) +} + +// Unmarshal unmarshals protobuf binary representation of NodeAttribute. +func (a *NodeAttribute) Unmarshal(data []byte) error { + return (*netmap.Attribute)(a). + Unmarshal(data) +} + +// MarshalJSON encodes NodeAttribute to protobuf JSON format. +func (a *NodeAttribute) MarshalJSON() ([]byte, error) { + return (*netmap.Attribute)(a). + MarshalJSON() +} + +// UnmarshalJSON decodes NodeAttribute from protobuf JSON format. +func (a *NodeAttribute) UnmarshalJSON(data []byte) error { + return (*netmap.Attribute)(a). + UnmarshalJSON(data) +} + // NewNodeInfo creates and returns new NodeInfo instance. func NewNodeInfo() *NodeInfo { return NewNodeInfoFromV2(new(netmap.NodeInfo)) @@ -203,21 +235,6 @@ func NewNodeInfoFromV2(i *netmap.NodeInfo) *NodeInfo { return (*NodeInfo)(i) } -// NodeInfoToJSON encodes NodeInfo to JSON format. -func NodeInfoToJSON(i *NodeInfo) ([]byte, error) { - return netmap.NodeInfoToJSON(i.ToV2()) -} - -// NodeInfoFromJSON decodes NodeInfo from JSON-encoded data. -func NodeInfoFromJSON(data []byte) (*NodeInfo, error) { - i, err := netmap.NodeInfoFromJSON(data) - if err != nil { - return nil, err - } - - return NewNodeInfoFromV2(i), nil -} - // ToV2 converts NodeInfo to v2 NodeInfo. func (i *NodeInfo) ToV2() *netmap.NodeInfo { return (*netmap.NodeInfo)(i) @@ -286,3 +303,35 @@ func (i *NodeInfo) SetState(s NodeState) { (*netmap.NodeInfo)(i). SetState(s.ToV2()) } + +// Marshal marshals NodeInfo into a protobuf binary form. +// +// Buffer is allocated when the argument is empty. +// Otherwise, the first buffer is used. +func (i *NodeInfo) Marshal(b ...[]byte) ([]byte, error) { + var buf []byte + if len(b) > 0 { + buf = b[0] + } + + return (*netmap.NodeInfo)(i). + StableMarshal(buf) +} + +// Unmarshal unmarshals protobuf binary representation of NodeInfo. +func (i *NodeInfo) Unmarshal(data []byte) error { + return (*netmap.NodeInfo)(i). + Unmarshal(data) +} + +// MarshalJSON encodes NodeInfo to protobuf JSON format. +func (i *NodeInfo) MarshalJSON() ([]byte, error) { + return (*netmap.NodeInfo)(i). + MarshalJSON() +} + +// UnmarshalJSON decodes NodeInfo from protobuf JSON format. +func (i *NodeInfo) UnmarshalJSON(data []byte) error { + return (*netmap.NodeInfo)(i). + UnmarshalJSON(data) +} diff --git a/pkg/netmap/node_info_test.go b/pkg/netmap/node_info_test.go index 92227a1..9b50a9b 100644 --- a/pkg/netmap/node_info_test.go +++ b/pkg/netmap/node_info_test.go @@ -128,18 +128,54 @@ func TestNodeInfo_Attributes(t *testing.T) { require.Equal(t, as, i.Attributes()) } -func TestNodeInfoJSON(t *testing.T) { +func TestNodeAttributeEncoding(t *testing.T) { + a := testNodeAttribute() + + t.Run("binary", func(t *testing.T) { + data, err := a.Marshal() + require.NoError(t, err) + + a2 := NewNodeAttribute() + require.NoError(t, a2.Unmarshal(data)) + + require.Equal(t, a, a2) + }) + + t.Run("json", func(t *testing.T) { + data, err := a.MarshalJSON() + require.NoError(t, err) + + a2 := NewNodeAttribute() + require.NoError(t, a2.UnmarshalJSON(data)) + + require.Equal(t, a, a2) + }) +} + +func TestNodeInfoEncoding(t *testing.T) { i := NewNodeInfo() i.SetPublicKey([]byte{1, 2, 3}) - i.SetAddress("some node address") + i.SetAddress("192.168.0.1") i.SetState(NodeStateOnline) - i.SetAttributes(testNodeAttribute(), testNodeAttribute()) + i.SetAttributes(testNodeAttribute()) - j, err := NodeInfoToJSON(i) - require.NoError(t, err) + t.Run("binary", func(t *testing.T) { + data, err := i.Marshal() + require.NoError(t, err) - i2, err := NodeInfoFromJSON(j) - require.NoError(t, err) + i2 := NewNodeInfo() + require.NoError(t, i2.Unmarshal(data)) - require.Equal(t, i, i2) + require.Equal(t, i, i2) + }) + + t.Run("json", func(t *testing.T) { + data, err := i.MarshalJSON() + require.NoError(t, err) + + i2 := NewNodeInfo() + require.NoError(t, i2.UnmarshalJSON(data)) + + require.Equal(t, i, i2) + }) } diff --git a/pkg/netmap/policy.go b/pkg/netmap/policy.go index a592573..84a5583 100644 --- a/pkg/netmap/policy.go +++ b/pkg/netmap/policy.go @@ -7,21 +7,6 @@ import ( // PlacementPolicy represents v2-compatible placement policy. type PlacementPolicy netmap.PlacementPolicy -// PlacementPolicyToJSON encodes PlacementPolicy to JSON format. -func PlacementPolicyToJSON(p *PlacementPolicy) ([]byte, error) { - return netmap.PlacementPolicyToJSON(p.ToV2()) -} - -// PlacementPolicyFromJSON decodes PlacementPolicy from JSON format. -func PlacementPolicyFromJSON(data []byte) (*PlacementPolicy, error) { - p, err := netmap.PlacementPolicyFromJSON(data) - if err != nil { - return nil, err - } - - return NewPlacementPolicyFromV2(p), nil -} - // NewPlacementPolicy creates and returns new PlacementPolicy instance. func NewPlacementPolicy() *PlacementPolicy { return NewPlacementPolicyFromV2(new(netmap.PlacementPolicy)) @@ -114,3 +99,35 @@ func (p *PlacementPolicy) SetFilters(fs ...*Filter) { (*netmap.PlacementPolicy)(p). SetFilters(filtersToV2(fs)) } + +// Marshal marshals PlacementPolicy into a protobuf binary form. +// +// Buffer is allocated when the argument is empty. +// Otherwise, the first buffer is used. +func (p *PlacementPolicy) Marshal(b ...[]byte) ([]byte, error) { + var buf []byte + if len(b) > 0 { + buf = b[0] + } + + return (*netmap.PlacementPolicy)(p). + StableMarshal(buf) +} + +// Unmarshal unmarshals protobuf binary representation of PlacementPolicy. +func (p *PlacementPolicy) Unmarshal(data []byte) error { + return (*netmap.PlacementPolicy)(p). + Unmarshal(data) +} + +// MarshalJSON encodes PlacementPolicy to protobuf JSON format. +func (p *PlacementPolicy) MarshalJSON() ([]byte, error) { + return (*netmap.PlacementPolicy)(p). + MarshalJSON() +} + +// UnmarshalJSON decodes PlacementPolicy from protobuf JSON format. +func (p *PlacementPolicy) UnmarshalJSON(data []byte) error { + return (*netmap.PlacementPolicy)(p). + UnmarshalJSON(data) +} diff --git a/pkg/netmap/policy_test.go b/pkg/netmap/policy_test.go index 705c875..5db6d5b 100644 --- a/pkg/netmap/policy_test.go +++ b/pkg/netmap/policy_test.go @@ -67,3 +67,27 @@ func TestPlacementPolicy_Filters(t *testing.T) { require.Equal(t, fs, p.Filters()) } + +func TestPlacementPolicyEncoding(t *testing.T) { + p := newPlacementPolicy(3, nil, nil, nil) + + t.Run("binary", func(t *testing.T) { + data, err := p.Marshal() + require.NoError(t, err) + + p2 := NewPlacementPolicy() + require.NoError(t, p2.Unmarshal(data)) + + require.Equal(t, p, p2) + }) + + t.Run("json", func(t *testing.T) { + data, err := p.MarshalJSON() + require.NoError(t, err) + + p2 := NewPlacementPolicy() + require.NoError(t, p2.UnmarshalJSON(data)) + + require.Equal(t, p, p2) + }) +} diff --git a/pkg/netmap/replica.go b/pkg/netmap/replica.go index 153a269..95349e6 100644 --- a/pkg/netmap/replica.go +++ b/pkg/netmap/replica.go @@ -45,3 +45,35 @@ func (r *Replica) SetSelector(s string) { (*netmap.Replica)(r). SetSelector(s) } + +// Marshal marshals Replica into a protobuf binary form. +// +// Buffer is allocated when the argument is empty. +// Otherwise, the first buffer is used. +func (r *Replica) Marshal(b ...[]byte) ([]byte, error) { + var buf []byte + if len(b) > 0 { + buf = b[0] + } + + return (*netmap.Replica)(r). + StableMarshal(buf) +} + +// Unmarshal unmarshals protobuf binary representation of Replica. +func (r *Replica) Unmarshal(data []byte) error { + return (*netmap.Replica)(r). + Unmarshal(data) +} + +// MarshalJSON encodes Replica to protobuf JSON format. +func (r *Replica) MarshalJSON() ([]byte, error) { + return (*netmap.Replica)(r). + MarshalJSON() +} + +// UnmarshalJSON decodes Replica from protobuf JSON format. +func (r *Replica) UnmarshalJSON(data []byte) error { + return (*netmap.Replica)(r). + UnmarshalJSON(data) +} diff --git a/pkg/netmap/replica_test.go b/pkg/netmap/replica_test.go index bd7c368..e366c2e 100644 --- a/pkg/netmap/replica_test.go +++ b/pkg/netmap/replica_test.go @@ -42,3 +42,27 @@ func TestReplica_Selector(t *testing.T) { require.Equal(t, s, r.Selector()) } + +func TestReplicaEncoding(t *testing.T) { + r := newReplica(3, "selector") + + t.Run("binary", func(t *testing.T) { + data, err := r.Marshal() + require.NoError(t, err) + + r2 := NewReplica() + require.NoError(t, r2.Unmarshal(data)) + + require.Equal(t, r, r2) + }) + + t.Run("json", func(t *testing.T) { + data, err := r.MarshalJSON() + require.NoError(t, err) + + r2 := NewReplica() + require.NoError(t, r2.UnmarshalJSON(data)) + + require.Equal(t, r, r2) + }) +} diff --git a/pkg/netmap/selector.go b/pkg/netmap/selector.go index 0217c41..c77e062 100644 --- a/pkg/netmap/selector.go +++ b/pkg/netmap/selector.go @@ -198,3 +198,34 @@ func (s *Selector) SetFilter(f string) { (*netmap.Selector)(s). SetFilter(f) } + +// Marshal marshals Selector into a protobuf binary form. +// +// Buffer is allocated when the argument is empty. +// Otherwise, the first buffer is used. +func (s *Selector) Marshal(b ...[]byte) ([]byte, error) { + var buf []byte + if len(b) > 0 { + buf = b[0] + } + + return (*netmap.Selector)(s).StableMarshal(buf) +} + +// Unmarshal unmarshals protobuf binary representation of Selector. +func (s *Selector) Unmarshal(data []byte) error { + return (*netmap.Selector)(s). + Unmarshal(data) +} + +// MarshalJSON encodes Selector to protobuf JSON format. +func (s *Selector) MarshalJSON() ([]byte, error) { + return (*netmap.Selector)(s). + MarshalJSON() +} + +// UnmarshalJSON decodes Selector from protobuf JSON format. +func (s *Selector) UnmarshalJSON(data []byte) error { + return (*netmap.Selector)(s). + UnmarshalJSON(data) +} diff --git a/pkg/netmap/selector_test.go b/pkg/netmap/selector_test.go index 5ee2682..2c8abee 100644 --- a/pkg/netmap/selector_test.go +++ b/pkg/netmap/selector_test.go @@ -307,3 +307,27 @@ func TestSelector_Filter(t *testing.T) { require.Equal(t, f, s.Filter()) } + +func TestSelectorEncoding(t *testing.T) { + s := newSelector("name", "atte", ClauseSame, 1, "filter") + + t.Run("binary", func(t *testing.T) { + data, err := s.Marshal() + require.NoError(t, err) + + s2 := NewSelector() + require.NoError(t, s2.Unmarshal(data)) + + require.Equal(t, s, s2) + }) + + t.Run("json", func(t *testing.T) { + data, err := s.MarshalJSON() + require.NoError(t, err) + + s2 := NewSelector() + require.NoError(t, s2.UnmarshalJSON(data)) + + require.Equal(t, s, s2) + }) +} diff --git a/v2/netmap/json.go b/v2/netmap/json.go index 03c79f7..7210501 100644 --- a/v2/netmap/json.go +++ b/v2/netmap/json.go @@ -1,60 +1,126 @@ package netmap import ( - "errors" - netmap "github.com/nspcc-dev/neofs-api-go/v2/netmap/grpc" "google.golang.org/protobuf/encoding/protojson" ) -var ( - errEmptyInput = errors.New("empty input") -) - -func NodeInfoToJSON(n *NodeInfo) ([]byte, error) { - if n == nil { - return nil, errEmptyInput - } - - msg := NodeInfoToGRPCMessage(n) - - return protojson.MarshalOptions{EmitUnpopulated: true}.Marshal(msg) +func (p *PlacementPolicy) MarshalJSON() ([]byte, error) { + return protojson.MarshalOptions{ + EmitUnpopulated: true, + }.Marshal( + PlacementPolicyToGRPCMessage(p), + ) } -func NodeInfoFromJSON(data []byte) (*NodeInfo, error) { - if len(data) == 0 { - return nil, errEmptyInput - } - - msg := new(netmap.NodeInfo) - - if err := protojson.Unmarshal(data, msg); err != nil { - return nil, err - } - - return NodeInfoFromGRPCMessage(msg), nil -} - -func PlacementPolicyToJSON(n *PlacementPolicy) ([]byte, error) { - if n == nil { - return nil, errEmptyInput - } - - msg := PlacementPolicyToGRPCMessage(n) - - return protojson.MarshalOptions{EmitUnpopulated: true}.Marshal(msg) -} - -func PlacementPolicyFromJSON(data []byte) (*PlacementPolicy, error) { - if len(data) == 0 { - return nil, errEmptyInput - } - +func (p *PlacementPolicy) UnmarshalJSON(data []byte) error { msg := new(netmap.PlacementPolicy) if err := protojson.Unmarshal(data, msg); err != nil { - return nil, err + return err } - return PlacementPolicyFromGRPCMessage(msg), nil + *p = *PlacementPolicyFromGRPCMessage(msg) + + return nil +} + +func (f *Filter) MarshalJSON() ([]byte, error) { + return protojson.MarshalOptions{ + EmitUnpopulated: true, + }.Marshal( + FilterToGRPCMessage(f), + ) +} + +func (f *Filter) UnmarshalJSON(data []byte) error { + msg := new(netmap.Filter) + + if err := protojson.Unmarshal(data, msg); err != nil { + return err + } + + *f = *FilterFromGRPCMessage(msg) + + return nil +} + +func (s *Selector) MarshalJSON() ([]byte, error) { + return protojson.MarshalOptions{ + EmitUnpopulated: true, + }.Marshal( + SelectorToGRPCMessage(s), + ) +} + +func (s *Selector) UnmarshalJSON(data []byte) error { + msg := new(netmap.Selector) + + if err := protojson.Unmarshal(data, msg); err != nil { + return err + } + + *s = *SelectorFromGRPCMessage(msg) + + return nil +} + +func (r *Replica) MarshalJSON() ([]byte, error) { + return protojson.MarshalOptions{ + EmitUnpopulated: true, + }.Marshal( + ReplicaToGRPCMessage(r), + ) +} + +func (r *Replica) UnmarshalJSON(data []byte) error { + msg := new(netmap.Replica) + + if err := protojson.Unmarshal(data, msg); err != nil { + return err + } + + *r = *ReplicaFromGRPCMessage(msg) + + return nil +} + +func (a *Attribute) MarshalJSON() ([]byte, error) { + return protojson.MarshalOptions{ + EmitUnpopulated: true, + }.Marshal( + AttributeToGRPCMessage(a), + ) +} + +func (a *Attribute) UnmarshalJSON(data []byte) error { + msg := new(netmap.NodeInfo_Attribute) + + if err := protojson.Unmarshal(data, msg); err != nil { + return err + } + + *a = *AttributeFromGRPCMessage(msg) + + return nil +} + +func (ni *NodeInfo) MarshalJSON() ([]byte, error) { + return protojson.MarshalOptions{ + EmitUnpopulated: true, + }.Marshal( + NodeInfoToGRPCMessage(ni), + ) +} + +func (ni *NodeInfo) UnmarshalJSON(data []byte) error { + msg := new(netmap.NodeInfo) + + if err := protojson.Unmarshal(data, msg); err != nil { + return err + } + + *ni = *NodeInfoFromGRPCMessage(msg) + + return nil } diff --git a/v2/netmap/json_test.go b/v2/netmap/json_test.go index 34abad1..561dbf1 100644 --- a/v2/netmap/json_test.go +++ b/v2/netmap/json_test.go @@ -7,46 +7,62 @@ import ( "github.com/stretchr/testify/require" ) +func TestFilterJSON(t *testing.T) { + f := generateFilter("key", "value", false) + + d, err := f.MarshalJSON() + require.NoError(t, err) + + f2 := new(netmap.Filter) + require.NoError(t, f2.UnmarshalJSON(d)) + + require.Equal(t, f, f2) +} + +func TestSelectorJSON(t *testing.T) { + s := generateSelector("name") + + data, err := s.MarshalJSON() + require.NoError(t, err) + + s2 := new(netmap.Selector) + require.NoError(t, s2.UnmarshalJSON(data)) + + require.Equal(t, s, s2) +} + +func TestReplicaJSON(t *testing.T) { + s := generateReplica("selector") + + data, err := s.MarshalJSON() + require.NoError(t, err) + + s2 := new(netmap.Replica) + require.NoError(t, s2.UnmarshalJSON(data)) + + require.Equal(t, s, s2) +} + +func TestAttributeJSON(t *testing.T) { + a := generateAttribute("key", "value") + + data, err := a.MarshalJSON() + require.NoError(t, err) + + a2 := new(netmap.Attribute) + require.NoError(t, a2.UnmarshalJSON(data)) + + require.Equal(t, a, a2) +} + func TestNodeInfoJSON(t *testing.T) { - exp := generateNodeInfo("public key", "/multi/addr", 2) + i := generateNodeInfo("key", "value", 3) - t.Run("non empty", func(t *testing.T) { - data, err := netmap.NodeInfoToJSON(exp) - require.NoError(t, err) + data, err := i.MarshalJSON() + require.NoError(t, err) - got, err := netmap.NodeInfoFromJSON(data) - require.NoError(t, err) + i2 := new(netmap.NodeInfo) + require.NoError(t, i2.UnmarshalJSON(data)) - require.Equal(t, exp, got) - }) - - t.Run("empty", func(t *testing.T) { - _, err := netmap.NodeInfoToJSON(nil) - require.Error(t, err) - - _, err = netmap.NodeInfoFromJSON(nil) - require.Error(t, err) - }) -} - -func TestPlacementPolicyJSON(t *testing.T) { - exp := generatePolicy(3) - - t.Run("non empty", func(t *testing.T) { - data, err := netmap.PlacementPolicyToJSON(exp) - require.NoError(t, err) - - got, err := netmap.PlacementPolicyFromJSON(data) - require.NoError(t, err) - - require.Equal(t, exp, got) - }) - - t.Run("empty", func(t *testing.T) { - _, err := netmap.PlacementPolicyToJSON(nil) - require.Error(t, err) - - _, err = netmap.PlacementPolicyFromJSON(nil) - require.Error(t, err) - }) + require.Equal(t, i, i2) } diff --git a/v2/netmap/marshal.go b/v2/netmap/marshal.go index d8b9a26..b619628 100644 --- a/v2/netmap/marshal.go +++ b/v2/netmap/marshal.go @@ -1,7 +1,9 @@ package netmap import ( - "github.com/nspcc-dev/neofs-api-go/util/proto" + protoutil "github.com/nspcc-dev/neofs-api-go/util/proto" + netmap "github.com/nspcc-dev/neofs-api-go/v2/netmap/grpc" + "google.golang.org/protobuf/proto" ) const ( @@ -52,28 +54,28 @@ func (f *Filter) StableMarshal(buf []byte) ([]byte, error) { err error ) - n, err = proto.StringMarshal(nameFilterField, buf[offset:], f.name) + n, err = protoutil.StringMarshal(nameFilterField, buf[offset:], f.name) if err != nil { return nil, err } offset += n - n, err = proto.StringMarshal(keyFilterField, buf[offset:], f.key) + n, err = protoutil.StringMarshal(keyFilterField, buf[offset:], f.key) if err != nil { return nil, err } offset += n - n, err = proto.EnumMarshal(opFilterField, buf[offset:], int32(f.op)) + n, err = protoutil.EnumMarshal(opFilterField, buf[offset:], int32(f.op)) if err != nil { return nil, err } offset += n - n, err = proto.StringMarshal(valueFilterField, buf[offset:], f.value) + n, err = protoutil.StringMarshal(valueFilterField, buf[offset:], f.value) if err != nil { return nil, err } @@ -81,7 +83,7 @@ func (f *Filter) StableMarshal(buf []byte) ([]byte, error) { offset += n for i := range f.filters { - n, err = proto.NestedStructureMarshal(filtersFilterField, buf[offset:], f.filters[i]) + n, err = protoutil.NestedStructureMarshal(filtersFilterField, buf[offset:], f.filters[i]) if err != nil { return nil, err } @@ -93,17 +95,28 @@ func (f *Filter) StableMarshal(buf []byte) ([]byte, error) { } func (f *Filter) StableSize() (size int) { - size += proto.StringSize(nameFilterField, f.name) - size += proto.StringSize(keyFilterField, f.key) - size += proto.EnumSize(opFilterField, int32(f.op)) - size += proto.StringSize(valueFilterField, f.value) + size += protoutil.StringSize(nameFilterField, f.name) + size += protoutil.StringSize(keyFilterField, f.key) + size += protoutil.EnumSize(opFilterField, int32(f.op)) + size += protoutil.StringSize(valueFilterField, f.value) for i := range f.filters { - size += proto.NestedStructureSize(filtersFilterField, f.filters[i]) + size += protoutil.NestedStructureSize(filtersFilterField, f.filters[i]) } return size } +func (f *Filter) Unmarshal(data []byte) error { + m := new(netmap.Filter) + if err := proto.Unmarshal(data, m); err != nil { + return err + } + + *f = *FilterFromGRPCMessage(m) + + return nil +} + func (s *Selector) StableMarshal(buf []byte) ([]byte, error) { if s == nil { return []byte{}, nil @@ -118,35 +131,35 @@ func (s *Selector) StableMarshal(buf []byte) ([]byte, error) { err error ) - n, err = proto.StringMarshal(nameSelectorField, buf[offset:], s.name) + n, err = protoutil.StringMarshal(nameSelectorField, buf[offset:], s.name) if err != nil { return nil, err } offset += n - n, err = proto.UInt32Marshal(countSelectorField, buf[offset:], s.count) + n, err = protoutil.UInt32Marshal(countSelectorField, buf[offset:], s.count) if err != nil { return nil, err } offset += n - n, err = proto.EnumMarshal(clauseSelectorField, buf[offset:], int32(s.clause)) + n, err = protoutil.EnumMarshal(clauseSelectorField, buf[offset:], int32(s.clause)) if err != nil { return nil, err } offset += n - n, err = proto.StringMarshal(attributeSelectorField, buf[offset:], s.attribute) + n, err = protoutil.StringMarshal(attributeSelectorField, buf[offset:], s.attribute) if err != nil { return nil, err } offset += n - n, err = proto.StringMarshal(filterSelectorField, buf[offset:], s.filter) + n, err = protoutil.StringMarshal(filterSelectorField, buf[offset:], s.filter) if err != nil { return nil, err } @@ -155,15 +168,26 @@ func (s *Selector) StableMarshal(buf []byte) ([]byte, error) { } func (s *Selector) StableSize() (size int) { - size += proto.StringSize(nameSelectorField, s.name) - size += proto.UInt32Size(countSelectorField, s.count) - size += proto.EnumSize(countSelectorField, int32(s.clause)) - size += proto.StringSize(attributeSelectorField, s.attribute) - size += proto.StringSize(filterSelectorField, s.filter) + size += protoutil.StringSize(nameSelectorField, s.name) + size += protoutil.UInt32Size(countSelectorField, s.count) + size += protoutil.EnumSize(countSelectorField, int32(s.clause)) + size += protoutil.StringSize(attributeSelectorField, s.attribute) + size += protoutil.StringSize(filterSelectorField, s.filter) return size } +func (s *Selector) Unmarshal(data []byte) error { + m := new(netmap.Selector) + if err := proto.Unmarshal(data, m); err != nil { + return err + } + + *s = *SelectorFromGRPCMessage(m) + + return nil +} + func (r *Replica) StableMarshal(buf []byte) ([]byte, error) { if r == nil { return []byte{}, nil @@ -178,14 +202,14 @@ func (r *Replica) StableMarshal(buf []byte) ([]byte, error) { err error ) - n, err = proto.UInt32Marshal(countReplicaField, buf[offset:], r.count) + n, err = protoutil.UInt32Marshal(countReplicaField, buf[offset:], r.count) if err != nil { return nil, err } offset += n - n, err = proto.StringMarshal(selectorReplicaField, buf[offset:], r.selector) + n, err = protoutil.StringMarshal(selectorReplicaField, buf[offset:], r.selector) if err != nil { return nil, err } @@ -194,12 +218,23 @@ func (r *Replica) StableMarshal(buf []byte) ([]byte, error) { } func (r *Replica) StableSize() (size int) { - size += proto.UInt32Size(countReplicaField, r.count) - size += proto.StringSize(selectorReplicaField, r.selector) + size += protoutil.UInt32Size(countReplicaField, r.count) + size += protoutil.StringSize(selectorReplicaField, r.selector) return size } +func (r *Replica) Unmarshal(data []byte) error { + m := new(netmap.Replica) + if err := proto.Unmarshal(data, m); err != nil { + return err + } + + *r = *ReplicaFromGRPCMessage(m) + + return nil +} + func (p *PlacementPolicy) StableMarshal(buf []byte) ([]byte, error) { if p == nil { return []byte{}, nil @@ -215,7 +250,7 @@ func (p *PlacementPolicy) StableMarshal(buf []byte) ([]byte, error) { ) for i := range p.replicas { - n, err = proto.NestedStructureMarshal(replicasPolicyField, buf[offset:], p.replicas[i]) + n, err = protoutil.NestedStructureMarshal(replicasPolicyField, buf[offset:], p.replicas[i]) if err != nil { return nil, err } @@ -223,7 +258,7 @@ func (p *PlacementPolicy) StableMarshal(buf []byte) ([]byte, error) { offset += n } - n, err = proto.UInt32Marshal(backupPolicyField, buf[offset:], p.backupFactor) + n, err = protoutil.UInt32Marshal(backupPolicyField, buf[offset:], p.backupFactor) if err != nil { return nil, err } @@ -231,7 +266,7 @@ func (p *PlacementPolicy) StableMarshal(buf []byte) ([]byte, error) { offset += n for i := range p.selectors { - n, err = proto.NestedStructureMarshal(selectorsPolicyField, buf[offset:], p.selectors[i]) + n, err = protoutil.NestedStructureMarshal(selectorsPolicyField, buf[offset:], p.selectors[i]) if err != nil { return nil, err } @@ -240,7 +275,7 @@ func (p *PlacementPolicy) StableMarshal(buf []byte) ([]byte, error) { } for i := range p.filters { - n, err = proto.NestedStructureMarshal(filtersPolicyField, buf[offset:], p.filters[i]) + n, err = protoutil.NestedStructureMarshal(filtersPolicyField, buf[offset:], p.filters[i]) if err != nil { return nil, err } @@ -253,22 +288,33 @@ func (p *PlacementPolicy) StableMarshal(buf []byte) ([]byte, error) { func (p *PlacementPolicy) StableSize() (size int) { for i := range p.replicas { - size += proto.NestedStructureSize(replicasPolicyField, p.replicas[i]) + size += protoutil.NestedStructureSize(replicasPolicyField, p.replicas[i]) } - size += proto.UInt32Size(backupPolicyField, p.backupFactor) + size += protoutil.UInt32Size(backupPolicyField, p.backupFactor) for i := range p.selectors { - size += proto.NestedStructureSize(selectorsPolicyField, p.selectors[i]) + size += protoutil.NestedStructureSize(selectorsPolicyField, p.selectors[i]) } for i := range p.filters { - size += proto.NestedStructureSize(filtersPolicyField, p.filters[i]) + size += protoutil.NestedStructureSize(filtersPolicyField, p.filters[i]) } return size } +func (p *PlacementPolicy) Unmarshal(data []byte) error { + m := new(netmap.PlacementPolicy) + if err := proto.Unmarshal(data, m); err != nil { + return err + } + + *p = *PlacementPolicyFromGRPCMessage(m) + + return nil +} + func (a *Attribute) StableMarshal(buf []byte) ([]byte, error) { if a == nil { return []byte{}, nil @@ -283,14 +329,14 @@ func (a *Attribute) StableMarshal(buf []byte) ([]byte, error) { err error ) - n, err = proto.StringMarshal(keyAttributeField, buf[offset:], a.key) + n, err = protoutil.StringMarshal(keyAttributeField, buf[offset:], a.key) if err != nil { return nil, err } offset += n - n, err = proto.StringMarshal(valueAttributeField, buf[offset:], a.value) + n, err = protoutil.StringMarshal(valueAttributeField, buf[offset:], a.value) if err != nil { return nil, err } @@ -298,7 +344,7 @@ func (a *Attribute) StableMarshal(buf []byte) ([]byte, error) { offset += n for i := range a.parents { - n, err = proto.StringMarshal(parentsAttributeField, buf[offset:], a.parents[i]) + n, err = protoutil.StringMarshal(parentsAttributeField, buf[offset:], a.parents[i]) if err != nil { return nil, err } @@ -314,16 +360,27 @@ func (a *Attribute) StableSize() (size int) { return 0 } - size += proto.StringSize(keyAttributeField, a.key) - size += proto.StringSize(valueAttributeField, a.value) + size += protoutil.StringSize(keyAttributeField, a.key) + size += protoutil.StringSize(valueAttributeField, a.value) for i := range a.parents { - size += proto.StringSize(parentsAttributeField, a.parents[i]) + size += protoutil.StringSize(parentsAttributeField, a.parents[i]) } return size } +func (a *Attribute) Unmarshal(data []byte) error { + m := new(netmap.NodeInfo_Attribute) + if err := proto.Unmarshal(data, m); err != nil { + return err + } + + *a = *AttributeFromGRPCMessage(m) + + return nil +} + func (ni *NodeInfo) StableMarshal(buf []byte) ([]byte, error) { if ni == nil { return []byte{}, nil @@ -338,14 +395,14 @@ func (ni *NodeInfo) StableMarshal(buf []byte) ([]byte, error) { err error ) - n, err = proto.BytesMarshal(keyNodeInfoField, buf[offset:], ni.publicKey) + n, err = protoutil.BytesMarshal(keyNodeInfoField, buf[offset:], ni.publicKey) if err != nil { return nil, err } offset += n - n, err = proto.StringMarshal(addressNodeInfoField, buf[offset:], ni.address) + n, err = protoutil.StringMarshal(addressNodeInfoField, buf[offset:], ni.address) if err != nil { return nil, err } @@ -353,7 +410,7 @@ func (ni *NodeInfo) StableMarshal(buf []byte) ([]byte, error) { offset += n for i := range ni.attributes { - n, err = proto.NestedStructureMarshal(attributesNodeInfoField, buf[offset:], ni.attributes[i]) + n, err = protoutil.NestedStructureMarshal(attributesNodeInfoField, buf[offset:], ni.attributes[i]) if err != nil { return nil, err } @@ -361,7 +418,7 @@ func (ni *NodeInfo) StableMarshal(buf []byte) ([]byte, error) { offset += n } - n, err = proto.EnumMarshal(stateNodeInfoField, buf[offset:], int32(ni.state)) + n, err = protoutil.EnumMarshal(stateNodeInfoField, buf[offset:], int32(ni.state)) if err != nil { return nil, err } @@ -374,17 +431,28 @@ func (ni *NodeInfo) StableSize() (size int) { return 0 } - size += proto.BytesSize(keyNodeInfoField, ni.publicKey) - size += proto.StringSize(addressNodeInfoField, ni.address) + size += protoutil.BytesSize(keyNodeInfoField, ni.publicKey) + size += protoutil.StringSize(addressNodeInfoField, ni.address) for i := range ni.attributes { - size += proto.NestedStructureSize(attributesNodeInfoField, ni.attributes[i]) + size += protoutil.NestedStructureSize(attributesNodeInfoField, ni.attributes[i]) } - size += proto.EnumSize(stateNodeInfoField, int32(ni.state)) + size += protoutil.EnumSize(stateNodeInfoField, int32(ni.state)) return size } +func (ni *NodeInfo) Unmarshal(data []byte) error { + m := new(netmap.NodeInfo) + if err := proto.Unmarshal(data, m); err != nil { + return err + } + + *ni = *NodeInfoFromGRPCMessage(m) + + return nil +} + func (l *LocalNodeInfoRequestBody) StableMarshal(buf []byte) ([]byte, error) { return nil, nil } @@ -407,14 +475,14 @@ func (l *LocalNodeInfoResponseBody) StableMarshal(buf []byte) ([]byte, error) { err error ) - n, err = proto.NestedStructureMarshal(versionInfoResponseBodyField, buf[offset:], l.version) + n, err = protoutil.NestedStructureMarshal(versionInfoResponseBodyField, buf[offset:], l.version) if err != nil { return nil, err } offset += n - _, err = proto.NestedStructureMarshal(nodeInfoResponseBodyField, buf[offset:], l.nodeInfo) + _, err = protoutil.NestedStructureMarshal(nodeInfoResponseBodyField, buf[offset:], l.nodeInfo) if err != nil { return nil, err } @@ -427,8 +495,8 @@ func (l *LocalNodeInfoResponseBody) StableSize() (size int) { return 0 } - size += proto.NestedStructureSize(versionInfoResponseBodyField, l.version) - size += proto.NestedStructureSize(nodeInfoResponseBodyField, l.nodeInfo) + size += protoutil.NestedStructureSize(versionInfoResponseBodyField, l.version) + size += protoutil.NestedStructureSize(nodeInfoResponseBodyField, l.nodeInfo) return size } diff --git a/v2/netmap/marshal_test.go b/v2/netmap/marshal_test.go index 361bc50..63347ad 100644 --- a/v2/netmap/marshal_test.go +++ b/v2/netmap/marshal_test.go @@ -13,96 +13,84 @@ import ( func TestAttribute_StableMarshal(t *testing.T) { from := generateAttribute("key", "value") - transport := new(grpc.NodeInfo_Attribute) t.Run("non empty", func(t *testing.T) { wire, err := from.StableMarshal(nil) require.NoError(t, err) - err = goproto.Unmarshal(wire, transport) - require.NoError(t, err) + to := new(netmap.Attribute) + require.NoError(t, to.Unmarshal(wire)) - to := netmap.AttributeFromGRPCMessage(transport) require.Equal(t, from, to) }) } func TestNodeInfo_StableMarshal(t *testing.T) { from := generateNodeInfo("publicKey", "/multi/addr", 10) - transport := new(grpc.NodeInfo) t.Run("non empty", func(t *testing.T) { wire, err := from.StableMarshal(nil) require.NoError(t, err) - err = goproto.Unmarshal(wire, transport) - require.NoError(t, err) + to := new(netmap.NodeInfo) + require.NoError(t, to.Unmarshal(wire)) - to := netmap.NodeInfoFromGRPCMessage(transport) require.Equal(t, from, to) }) } func TestFilter_StableMarshal(t *testing.T) { from := generateFilter("key", "value", false) - transport := new(grpc.Filter) t.Run("non empty", func(t *testing.T) { wire, err := from.StableMarshal(nil) require.NoError(t, err) - err = goproto.Unmarshal(wire, transport) - require.NoError(t, err) + to := new(netmap.Filter) + require.NoError(t, to.Unmarshal(wire)) - to := netmap.FilterFromGRPCMessage(transport) require.Equal(t, from, to) }) } func TestSelector_StableMarshal(t *testing.T) { from := generateSelector("name") - transport := new(grpc.Selector) t.Run("non empty", func(t *testing.T) { wire, err := from.StableMarshal(nil) require.NoError(t, err) - err = goproto.Unmarshal(wire, transport) - require.NoError(t, err) + to := new(netmap.Selector) + require.NoError(t, to.Unmarshal(wire)) - to := netmap.SelectorFromGRPCMessage(transport) require.Equal(t, from, to) }) } func TestReplica_StableMarshal(t *testing.T) { from := generateReplica("selector") - transport := new(grpc.Replica) t.Run("non empty", func(t *testing.T) { wire, err := from.StableMarshal(nil) require.NoError(t, err) - err = goproto.Unmarshal(wire, transport) - require.NoError(t, err) + to := new(netmap.Replica) + require.NoError(t, to.Unmarshal(wire)) - to := netmap.ReplicaFromGRPCMessage(transport) require.Equal(t, from, to) }) } func TestPlacementPolicy_StableMarshal(t *testing.T) { from := generatePolicy(3) - transport := new(grpc.PlacementPolicy) t.Run("non empty", func(t *testing.T) { wire, err := from.StableMarshal(nil) require.NoError(t, err) - err = goproto.Unmarshal(wire, transport) - require.NoError(t, err) + to := new(netmap.PlacementPolicy) + require.NoError(t, to.Unmarshal(wire)) - to := netmap.PlacementPolicyFromGRPCMessage(transport) require.Equal(t, from, to) }) } From 52fae76533902c21985177b5c943f1fd70900d1d Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 13 Nov 2020 13:36:18 +0300 Subject: [PATCH 0528/1196] [#168] sdk/accounting: Refactor Decimal type Signed-off-by: Leonard Lyubich --- pkg/accounting/decimal.go | 37 ++++++++++++++++++++++++++++++++-- pkg/accounting/decimal_test.go | 25 +++++++++++++++++++++++ pkg/client/accounting.go | 4 +--- pkg/client/client_test.go | 2 +- 4 files changed, 62 insertions(+), 6 deletions(-) create mode 100644 pkg/accounting/decimal_test.go diff --git a/pkg/accounting/decimal.go b/pkg/accounting/decimal.go index 9e73e54..b6e275f 100644 --- a/pkg/accounting/decimal.go +++ b/pkg/accounting/decimal.go @@ -4,6 +4,39 @@ import ( "github.com/nspcc-dev/neofs-api-go/v2/accounting" ) -type Decimal struct { - accounting.Decimal +// Decimal represents v2-compatible decimal number. +type Decimal accounting.Decimal + +// NewDecimal creates, initializes and returns blank Decimal instance. +func NewDecimal() *Decimal { + return NewDecimalFromV2(new(accounting.Decimal)) +} + +// NewDecimalFromV2 converts v2 Decimal to Decimal. +func NewDecimalFromV2(d *accounting.Decimal) *Decimal { + return (*Decimal)(d) +} + +// Value returns value of the decimal number. +func (d *Decimal) Value() int64 { + return (*accounting.Decimal)(d). + GetValue() +} + +// SetValue sets value of the decimal number. +func (d *Decimal) SetValue(v int64) { + (*accounting.Decimal)(d). + SetValue(v) +} + +// Precision returns precision of the decimal number. +func (d *Decimal) Precision() uint32 { + return (*accounting.Decimal)(d). + GetPrecision() +} + +// SetPrecision sets precision of the decimal number. +func (d *Decimal) SetPrecision(p uint32) { + (*accounting.Decimal)(d). + SetPrecision(p) } diff --git a/pkg/accounting/decimal_test.go b/pkg/accounting/decimal_test.go new file mode 100644 index 0000000..e02a92f --- /dev/null +++ b/pkg/accounting/decimal_test.go @@ -0,0 +1,25 @@ +package accounting + +import ( + "testing" + + "github.com/stretchr/testify/require" +) + +func TestDecimal_Value(t *testing.T) { + d := NewDecimal() + + v := int64(3) + d.SetValue(v) + + require.Equal(t, v, d.Value()) +} + +func TestDecimal_Precision(t *testing.T) { + d := NewDecimal() + + p := uint32(3) + d.SetPrecision(p) + + require.Equal(t, p, d.Precision()) +} diff --git a/pkg/client/accounting.go b/pkg/client/accounting.go index 52d25c4..b9e8660 100644 --- a/pkg/client/accounting.go +++ b/pkg/client/accounting.go @@ -69,9 +69,7 @@ func (c Client) getBalanceV2(ctx context.Context, owner *owner.ID, opts ...CallO return nil, errors.Wrap(err, "can't verify response message") } - return &accounting.Decimal{ - Decimal: *resp.GetBody().GetBalance(), - }, nil + return accounting.NewDecimalFromV2(resp.GetBody().GetBalance()), nil default: return nil, unsupportedProtocolErr } diff --git a/pkg/client/client_test.go b/pkg/client/client_test.go index 50b5f56..cb36606 100644 --- a/pkg/client/client_test.go +++ b/pkg/client/client_test.go @@ -27,7 +27,7 @@ func TestExample(t *testing.T) { resp, err := cli.GetSelfBalance(context.Background()) require.NoError(t, err) - fmt.Println(resp.GetValue(), resp.GetPrecision()) + fmt.Println(resp.Value(), resp.Precision()) // create client from grpc connection conn, err := grpc.DialContext(context.Background(), target, grpc.WithBlock(), grpc.WithInsecure()) From 9bebc1247dbb43d501614c1ca73eb18b643c3d9e Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 13 Nov 2020 13:38:49 +0300 Subject: [PATCH 0529/1196] [#168] accounting: Implement binary/JSON encoders/decoders on Decimal Signed-off-by: Leonard Lyubich --- pkg/accounting/decimal.go | 32 ++++++++++++++++++++++++++++++++ pkg/accounting/decimal_test.go | 26 ++++++++++++++++++++++++++ v2/accounting/json.go | 26 ++++++++++++++++++++++++++ v2/accounting/json_test.go | 20 ++++++++++++++++++++ v2/accounting/marshal.go | 31 ++++++++++++++++++++++--------- v2/accounting/marshal_test.go | 29 +++++++++++++---------------- 6 files changed, 139 insertions(+), 25 deletions(-) create mode 100644 v2/accounting/json.go create mode 100644 v2/accounting/json_test.go diff --git a/pkg/accounting/decimal.go b/pkg/accounting/decimal.go index b6e275f..07b11d6 100644 --- a/pkg/accounting/decimal.go +++ b/pkg/accounting/decimal.go @@ -40,3 +40,35 @@ func (d *Decimal) SetPrecision(p uint32) { (*accounting.Decimal)(d). SetPrecision(p) } + +// Marshal marshals Decimal into a protobuf binary form. +// +// Buffer is allocated when the argument is empty. +// Otherwise, the first buffer is used. +func (d *Decimal) Marshal(b ...[]byte) ([]byte, error) { + var buf []byte + if len(b) > 0 { + buf = b[0] + } + + return (*accounting.Decimal)(d). + StableMarshal(buf) +} + +// Unmarshal unmarshals protobuf binary representation of Decimal. +func (d *Decimal) Unmarshal(data []byte) error { + return (*accounting.Decimal)(d). + Unmarshal(data) +} + +// MarshalJSON encodes Decimal to protobuf JSON format. +func (d *Decimal) MarshalJSON() ([]byte, error) { + return (*accounting.Decimal)(d). + MarshalJSON() +} + +// UnmarshalJSON decodes Decimal from protobuf JSON format. +func (d *Decimal) UnmarshalJSON(data []byte) error { + return (*accounting.Decimal)(d). + UnmarshalJSON(data) +} diff --git a/pkg/accounting/decimal_test.go b/pkg/accounting/decimal_test.go index e02a92f..a15334b 100644 --- a/pkg/accounting/decimal_test.go +++ b/pkg/accounting/decimal_test.go @@ -23,3 +23,29 @@ func TestDecimal_Precision(t *testing.T) { require.Equal(t, p, d.Precision()) } + +func TestDecimalEncoding(t *testing.T) { + d := NewDecimal() + d.SetValue(1) + d.SetPrecision(2) + + t.Run("binary", func(t *testing.T) { + data, err := d.Marshal() + require.NoError(t, err) + + d2 := NewDecimal() + require.NoError(t, d2.Unmarshal(data)) + + require.Equal(t, d, d2) + }) + + t.Run("json", func(t *testing.T) { + data, err := d.MarshalJSON() + require.NoError(t, err) + + d2 := NewDecimal() + require.NoError(t, d2.UnmarshalJSON(data)) + + require.Equal(t, d, d2) + }) +} diff --git a/v2/accounting/json.go b/v2/accounting/json.go new file mode 100644 index 0000000..322ca5c --- /dev/null +++ b/v2/accounting/json.go @@ -0,0 +1,26 @@ +package accounting + +import ( + accounting "github.com/nspcc-dev/neofs-api-go/v2/accounting/grpc" + "google.golang.org/protobuf/encoding/protojson" +) + +func (d *Decimal) MarshalJSON() ([]byte, error) { + return protojson.MarshalOptions{ + EmitUnpopulated: true, + }.Marshal( + DecimalToGRPCMessage(d), + ) +} + +func (d *Decimal) UnmarshalJSON(data []byte) error { + msg := new(accounting.Decimal) + + if err := protojson.Unmarshal(data, msg); err != nil { + return err + } + + *d = *DecimalFromGRPCMessage(msg) + + return nil +} diff --git a/v2/accounting/json_test.go b/v2/accounting/json_test.go new file mode 100644 index 0000000..1145e05 --- /dev/null +++ b/v2/accounting/json_test.go @@ -0,0 +1,20 @@ +package accounting_test + +import ( + "testing" + + "github.com/nspcc-dev/neofs-api-go/v2/accounting" + "github.com/stretchr/testify/require" +) + +func TestDecimalJSON(t *testing.T) { + i := generateDecimal(10) + + data, err := i.MarshalJSON() + require.NoError(t, err) + + i2 := new(accounting.Decimal) + require.NoError(t, i2.UnmarshalJSON(data)) + + require.Equal(t, i, i2) +} diff --git a/v2/accounting/marshal.go b/v2/accounting/marshal.go index 83fd0e7..684599f 100644 --- a/v2/accounting/marshal.go +++ b/v2/accounting/marshal.go @@ -1,7 +1,9 @@ package accounting import ( - "github.com/nspcc-dev/neofs-api-go/util/proto" + protoutil "github.com/nspcc-dev/neofs-api-go/util/proto" + accounting "github.com/nspcc-dev/neofs-api-go/v2/accounting/grpc" + "google.golang.org/protobuf/proto" ) const ( @@ -27,14 +29,14 @@ func (d *Decimal) StableMarshal(buf []byte) ([]byte, error) { err error ) - n, err = proto.Int64Marshal(decimalValueField, buf[offset:], d.val) + n, err = protoutil.Int64Marshal(decimalValueField, buf[offset:], d.val) if err != nil { return nil, err } offset += n - n, err = proto.UInt32Marshal(decimalPrecisionField, buf[offset:], d.prec) + n, err = protoutil.UInt32Marshal(decimalPrecisionField, buf[offset:], d.prec) if err != nil { return nil, err } @@ -47,12 +49,23 @@ func (d *Decimal) StableSize() (size int) { return 0 } - size += proto.Int64Size(decimalValueField, d.val) - size += proto.UInt32Size(decimalPrecisionField, d.prec) + size += protoutil.Int64Size(decimalValueField, d.val) + size += protoutil.UInt32Size(decimalPrecisionField, d.prec) return size } +func (d *Decimal) Unmarshal(data []byte) error { + m := new(accounting.Decimal) + if err := proto.Unmarshal(data, m); err != nil { + return err + } + + *d = *DecimalFromGRPCMessage(m) + + return nil +} + func (b *BalanceRequestBody) StableMarshal(buf []byte) ([]byte, error) { if b == nil { return []byte{}, nil @@ -62,7 +75,7 @@ func (b *BalanceRequestBody) StableMarshal(buf []byte) ([]byte, error) { buf = make([]byte, b.StableSize()) } - _, err := proto.NestedStructureMarshal(balanceReqBodyOwnerField, buf, b.ownerID) + _, err := protoutil.NestedStructureMarshal(balanceReqBodyOwnerField, buf, b.ownerID) if err != nil { return nil, err } @@ -75,7 +88,7 @@ func (b *BalanceRequestBody) StableSize() (size int) { return 0 } - size = proto.NestedStructureSize(balanceReqBodyOwnerField, b.ownerID) + size = protoutil.NestedStructureSize(balanceReqBodyOwnerField, b.ownerID) return size } @@ -89,7 +102,7 @@ func (br *BalanceResponseBody) StableMarshal(buf []byte) ([]byte, error) { buf = make([]byte, br.StableSize()) } - _, err := proto.NestedStructureMarshal(balanceRespBodyDecimalField, buf, br.bal) + _, err := protoutil.NestedStructureMarshal(balanceRespBodyDecimalField, buf, br.bal) if err != nil { return nil, err } @@ -102,7 +115,7 @@ func (br *BalanceResponseBody) StableSize() (size int) { return 0 } - size = proto.NestedStructureSize(balanceRespBodyDecimalField, br.bal) + size = protoutil.NestedStructureSize(balanceRespBodyDecimalField, br.bal) return size } diff --git a/v2/accounting/marshal_test.go b/v2/accounting/marshal_test.go index 4b42304..6ace77f 100644 --- a/v2/accounting/marshal_test.go +++ b/v2/accounting/marshal_test.go @@ -10,22 +10,6 @@ import ( goproto "google.golang.org/protobuf/proto" ) -func TestDecimal_StableMarshal(t *testing.T) { - decimalFrom := generateDecimal(888) - transport := new(grpc.Decimal) - - t.Run("non empty", func(t *testing.T) { - wire, err := decimalFrom.StableMarshal(nil) - require.NoError(t, err) - - err = goproto.Unmarshal(wire, transport) - require.NoError(t, err) - - decimalTo := accounting.DecimalFromGRPCMessage(transport) - require.Equal(t, decimalFrom, decimalTo) - }) -} - func TestBalanceRequestBody_StableMarshal(t *testing.T) { requestBodyFrom := generateBalanceRequestBody("Owner ID") transport := new(grpc.BalanceRequest_Body) @@ -82,3 +66,16 @@ func generateBalanceResponseBody(val int64) *accounting.BalanceResponseBody { return response } + +func TestDecimalMarshal(t *testing.T) { + d := generateDecimal(3) + + data, err := d.StableMarshal(nil) + require.NoError(t, err) + + d2 := new(accounting.Decimal) + + require.NoError(t, d2.Unmarshal(data)) + + require.Equal(t, d, d2) +} From 7f421562013e48ba440ad881eb98767f16703c38 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 13 Nov 2020 14:31:53 +0300 Subject: [PATCH 0530/1196] [#168] acl: Implement binary/JSON encoders/decoders on HeaderFilter Signed-off-by: Leonard Lyubich --- pkg/acl/eacl/filter.go | 74 ++++++++++++++++++++++----- pkg/acl/eacl/filter_test.go | 24 +++++++++ v2/acl/json.go | 20 ++++++++ v2/acl/json_test.go | 12 +++++ v2/acl/marshal.go | 99 +++++++++++++++++++++---------------- v2/acl/marshal_test.go | 6 +-- 6 files changed, 175 insertions(+), 60 deletions(-) diff --git a/pkg/acl/eacl/filter.go b/pkg/acl/eacl/filter.go index 7608f3f..efed7ef 100644 --- a/pkg/acl/eacl/filter.go +++ b/pkg/acl/eacl/filter.go @@ -43,28 +43,28 @@ func (s staticStringer) String() string { return string(s) } -func (a Filter) Value() string { - return a.value.String() +func (f Filter) Value() string { + return f.value.String() } -func (a Filter) Matcher() Match { - return a.matcher +func (f Filter) Matcher() Match { + return f.matcher } -func (a Filter) Key() string { - return a.key.String() +func (f Filter) Key() string { + return f.key.String() } -func (a Filter) From() FilterHeaderType { - return a.from +func (f Filter) From() FilterHeaderType { + return f.from } -func (a *Filter) ToV2() *v2acl.HeaderFilter { +func (f *Filter) ToV2() *v2acl.HeaderFilter { filter := new(v2acl.HeaderFilter) - filter.SetValue(a.value.String()) - filter.SetKey(a.key.String()) - filter.SetMatchType(a.matcher.ToV2()) - filter.SetHeaderType(a.from.ToV2()) + filter.SetValue(f.value.String()) + filter.SetKey(f.key.String()) + filter.SetMatchType(f.matcher.ToV2()) + filter.SetHeaderType(f.from.ToV2()) return filter } @@ -94,6 +94,10 @@ func (k filterKey) String() string { } } +func NewFilter() *Filter { + return NewFilterFromV2(new(v2acl.HeaderFilter)) +} + func NewFilterFromV2(filter *v2acl.HeaderFilter) *Filter { f := new(Filter) @@ -108,3 +112,47 @@ func NewFilterFromV2(filter *v2acl.HeaderFilter) *Filter { return f } + +// Marshal marshals Filter into a protobuf binary form. +// +// Buffer is allocated when the argument is empty. +// Otherwise, the first buffer is used. +func (f *Filter) Marshal(b ...[]byte) ([]byte, error) { + var buf []byte + if len(b) > 0 { + buf = b[0] + } + + return f.ToV2(). + StableMarshal(buf) +} + +// Unmarshal unmarshals protobuf binary representation of Filter. +func (f *Filter) Unmarshal(data []byte) error { + fV2 := new(v2acl.HeaderFilter) + if err := fV2.Unmarshal(data); err != nil { + return err + } + + *f = *NewFilterFromV2(fV2) + + return nil +} + +// MarshalJSON encodes Filter to protobuf JSON format. +func (f *Filter) MarshalJSON() ([]byte, error) { + return f.ToV2(). + MarshalJSON() +} + +// UnmarshalJSON decodes Filter from protobuf JSON format. +func (f *Filter) UnmarshalJSON(data []byte) error { + fV2 := new(v2acl.HeaderFilter) + if err := fV2.UnmarshalJSON(data); err != nil { + return err + } + + *f = *NewFilterFromV2(fV2) + + return nil +} diff --git a/pkg/acl/eacl/filter_test.go b/pkg/acl/eacl/filter_test.go index f87033c..64636cc 100644 --- a/pkg/acl/eacl/filter_test.go +++ b/pkg/acl/eacl/filter_test.go @@ -35,3 +35,27 @@ func TestFilter(t *testing.T) { require.Equal(t, new(Filter), NewFilterFromV2(nil)) }) } + +func TestFilterEncoding(t *testing.T) { + f := newObjectFilter(MatchStringEqual, "key", "value") + + t.Run("binary", func(t *testing.T) { + data, err := f.Marshal() + require.NoError(t, err) + + f2 := NewFilter() + require.NoError(t, f2.Unmarshal(data)) + + require.Equal(t, f, f2) + }) + + t.Run("json", func(t *testing.T) { + data, err := f.MarshalJSON() + require.NoError(t, err) + + d2 := NewFilter() + require.NoError(t, d2.UnmarshalJSON(data)) + + require.Equal(t, f, d2) + }) +} diff --git a/v2/acl/json.go b/v2/acl/json.go index d9bbb45..e8baf1c 100644 --- a/v2/acl/json.go +++ b/v2/acl/json.go @@ -82,3 +82,23 @@ func BearerTokenFromJSON(data []byte) (*BearerToken, error) { return BearerTokenFromGRPCMessage(msg), nil } + +func (f *HeaderFilter) MarshalJSON() ([]byte, error) { + return protojson.MarshalOptions{ + EmitUnpopulated: true, + }.Marshal( + HeaderFilterToGRPCMessage(f), + ) +} + +func (f *HeaderFilter) UnmarshalJSON(data []byte) error { + msg := new(acl.EACLRecord_Filter) + + if err := protojson.Unmarshal(data, msg); err != nil { + return err + } + + *f = *HeaderFilterFromGRPCMessage(msg) + + return nil +} diff --git a/v2/acl/json_test.go b/v2/acl/json_test.go index 9d9e67e..d2d6845 100644 --- a/v2/acl/json_test.go +++ b/v2/acl/json_test.go @@ -64,3 +64,15 @@ func TestBearerTokenJSON(t *testing.T) { require.Equal(t, exp, got) }) } + +func TestFilterJSON(t *testing.T) { + f := generateFilter(acl.HeaderTypeObject, "key", "value") + + data, err := f.MarshalJSON() + require.NoError(t, err) + + f2 := new(acl.HeaderFilter) + require.NoError(t, f2.UnmarshalJSON(data)) + + require.Equal(t, f, f2) +} diff --git a/v2/acl/marshal.go b/v2/acl/marshal.go index a87bfc8..152d0f1 100644 --- a/v2/acl/marshal.go +++ b/v2/acl/marshal.go @@ -1,7 +1,9 @@ package acl import ( - "github.com/nspcc-dev/neofs-api-go/util/proto" + protoutil "github.com/nspcc-dev/neofs-api-go/util/proto" + acl "github.com/nspcc-dev/neofs-api-go/v2/acl/grpc" + "google.golang.org/protobuf/proto" ) const ( @@ -50,14 +52,14 @@ func (t *Table) StableMarshal(buf []byte) ([]byte, error) { err error ) - n, err = proto.NestedStructureMarshal(tableVersionField, buf[offset:], t.version) + n, err = protoutil.NestedStructureMarshal(tableVersionField, buf[offset:], t.version) if err != nil { return nil, err } offset += n - n, err = proto.NestedStructureMarshal(tableContainerIDField, buf[offset:], t.cid) + n, err = protoutil.NestedStructureMarshal(tableContainerIDField, buf[offset:], t.cid) if err != nil { return nil, err } @@ -65,7 +67,7 @@ func (t *Table) StableMarshal(buf []byte) ([]byte, error) { offset += n for i := range t.records { - n, err = proto.NestedStructureMarshal(tableRecordsField, buf[offset:], t.records[i]) + n, err = protoutil.NestedStructureMarshal(tableRecordsField, buf[offset:], t.records[i]) if err != nil { return nil, err } @@ -82,11 +84,11 @@ func (t *Table) StableSize() (size int) { return 0 } - size += proto.NestedStructureSize(tableVersionField, t.version) - size += proto.NestedStructureSize(tableContainerIDField, t.cid) + size += protoutil.NestedStructureSize(tableVersionField, t.version) + size += protoutil.NestedStructureSize(tableContainerIDField, t.cid) for i := range t.records { - size += proto.NestedStructureSize(tableRecordsField, t.records[i]) + size += protoutil.NestedStructureSize(tableRecordsField, t.records[i]) } return size @@ -108,14 +110,14 @@ func (r *Record) StableMarshal(buf []byte) ([]byte, error) { err error ) - n, err = proto.EnumMarshal(recordOperationField, buf[offset:], int32(r.op)) + n, err = protoutil.EnumMarshal(recordOperationField, buf[offset:], int32(r.op)) if err != nil { return nil, err } offset += n - n, err = proto.EnumMarshal(recordActionField, buf[offset:], int32(r.action)) + n, err = protoutil.EnumMarshal(recordActionField, buf[offset:], int32(r.action)) if err != nil { return nil, err } @@ -123,7 +125,7 @@ func (r *Record) StableMarshal(buf []byte) ([]byte, error) { offset += n for i := range r.filters { - n, err = proto.NestedStructureMarshal(recordFiltersField, buf[offset:], r.filters[i]) + n, err = protoutil.NestedStructureMarshal(recordFiltersField, buf[offset:], r.filters[i]) if err != nil { return nil, err } @@ -132,7 +134,7 @@ func (r *Record) StableMarshal(buf []byte) ([]byte, error) { } for i := range r.targets { - n, err = proto.NestedStructureMarshal(recordTargetsField, buf[offset:], r.targets[i]) + n, err = protoutil.NestedStructureMarshal(recordTargetsField, buf[offset:], r.targets[i]) if err != nil { return nil, err } @@ -149,15 +151,15 @@ func (r *Record) StableSize() (size int) { return 0 } - size += proto.EnumSize(recordOperationField, int32(r.op)) - size += proto.EnumSize(recordActionField, int32(r.action)) + size += protoutil.EnumSize(recordOperationField, int32(r.op)) + size += protoutil.EnumSize(recordActionField, int32(r.action)) for i := range r.filters { - size += proto.NestedStructureSize(recordFiltersField, r.filters[i]) + size += protoutil.NestedStructureSize(recordFiltersField, r.filters[i]) } for i := range r.targets { - size += proto.NestedStructureSize(recordTargetsField, r.targets[i]) + size += protoutil.NestedStructureSize(recordTargetsField, r.targets[i]) } return size @@ -179,28 +181,28 @@ func (f *HeaderFilter) StableMarshal(buf []byte) ([]byte, error) { err error ) - n, err = proto.EnumMarshal(filterHeaderTypeField, buf[offset:], int32(f.hdrType)) + n, err = protoutil.EnumMarshal(filterHeaderTypeField, buf[offset:], int32(f.hdrType)) if err != nil { return nil, err } offset += n - n, err = proto.EnumMarshal(filterMatchTypeField, buf[offset:], int32(f.matchType)) + n, err = protoutil.EnumMarshal(filterMatchTypeField, buf[offset:], int32(f.matchType)) if err != nil { return nil, err } offset += n - n, err = proto.StringMarshal(filterNameField, buf[offset:], f.key) + n, err = protoutil.StringMarshal(filterNameField, buf[offset:], f.key) if err != nil { return nil, err } offset += n - _, err = proto.StringMarshal(filterValueField, buf[offset:], f.value) + _, err = protoutil.StringMarshal(filterValueField, buf[offset:], f.value) if err != nil { return nil, err } @@ -214,14 +216,25 @@ func (f *HeaderFilter) StableSize() (size int) { return 0 } - size += proto.EnumSize(filterHeaderTypeField, int32(f.hdrType)) - size += proto.EnumSize(filterMatchTypeField, int32(f.matchType)) - size += proto.StringSize(filterNameField, f.key) - size += proto.StringSize(filterValueField, f.value) + size += protoutil.EnumSize(filterHeaderTypeField, int32(f.hdrType)) + size += protoutil.EnumSize(filterMatchTypeField, int32(f.matchType)) + size += protoutil.StringSize(filterNameField, f.key) + size += protoutil.StringSize(filterValueField, f.value) return size } +func (f *HeaderFilter) Unmarshal(data []byte) error { + m := new(acl.EACLRecord_Filter) + if err := proto.Unmarshal(data, m); err != nil { + return err + } + + *f = *HeaderFilterFromGRPCMessage(m) + + return nil +} + // StableMarshal marshals unified role info structure in a protobuf // compatible way without field order shuffle. func (t *Target) StableMarshal(buf []byte) ([]byte, error) { @@ -238,14 +251,14 @@ func (t *Target) StableMarshal(buf []byte) ([]byte, error) { err error ) - n, err = proto.EnumMarshal(targetTypeField, buf[offset:], int32(t.role)) + n, err = protoutil.EnumMarshal(targetTypeField, buf[offset:], int32(t.role)) if err != nil { return nil, err } offset += n - _, err = proto.RepeatedBytesMarshal(targetKeysField, buf[offset:], t.keys) + _, err = protoutil.RepeatedBytesMarshal(targetKeysField, buf[offset:], t.keys) if err != nil { return nil, err } @@ -259,8 +272,8 @@ func (t *Target) StableSize() (size int) { return 0 } - size += proto.EnumSize(targetTypeField, int32(t.role)) - size += proto.RepeatedBytesSize(targetKeysField, t.keys) + size += protoutil.EnumSize(targetTypeField, int32(t.role)) + size += protoutil.RepeatedBytesSize(targetKeysField, t.keys) return size } @@ -279,21 +292,21 @@ func (l *TokenLifetime) StableMarshal(buf []byte) ([]byte, error) { err error ) - n, err = proto.UInt64Marshal(lifetimeExpirationField, buf[offset:], l.exp) + n, err = protoutil.UInt64Marshal(lifetimeExpirationField, buf[offset:], l.exp) if err != nil { return nil, err } offset += n - n, err = proto.UInt64Marshal(lifetimeNotValidBeforeField, buf[offset:], l.nbf) + n, err = protoutil.UInt64Marshal(lifetimeNotValidBeforeField, buf[offset:], l.nbf) if err != nil { return nil, err } offset += n - _, err = proto.UInt64Marshal(lifetimeIssuedAtField, buf[offset:], l.iat) + _, err = protoutil.UInt64Marshal(lifetimeIssuedAtField, buf[offset:], l.iat) if err != nil { return nil, err } @@ -306,9 +319,9 @@ func (l *TokenLifetime) StableSize() (size int) { return 0 } - size += proto.UInt64Size(lifetimeExpirationField, l.exp) - size += proto.UInt64Size(lifetimeNotValidBeforeField, l.nbf) - size += proto.UInt64Size(lifetimeIssuedAtField, l.iat) + size += protoutil.UInt64Size(lifetimeExpirationField, l.exp) + size += protoutil.UInt64Size(lifetimeNotValidBeforeField, l.nbf) + size += protoutil.UInt64Size(lifetimeIssuedAtField, l.iat) return size } @@ -327,21 +340,21 @@ func (bt *BearerTokenBody) StableMarshal(buf []byte) ([]byte, error) { err error ) - n, err = proto.NestedStructureMarshal(bearerTokenBodyACLField, buf[offset:], bt.eacl) + n, err = protoutil.NestedStructureMarshal(bearerTokenBodyACLField, buf[offset:], bt.eacl) if err != nil { return nil, err } offset += n - n, err = proto.NestedStructureMarshal(bearerTokenBodyOwnerField, buf[offset:], bt.ownerID) + n, err = protoutil.NestedStructureMarshal(bearerTokenBodyOwnerField, buf[offset:], bt.ownerID) if err != nil { return nil, err } offset += n - _, err = proto.NestedStructureMarshal(bearerTokenBodyLifetimeField, buf[offset:], bt.lifetime) + _, err = protoutil.NestedStructureMarshal(bearerTokenBodyLifetimeField, buf[offset:], bt.lifetime) if err != nil { return nil, err } @@ -354,9 +367,9 @@ func (bt *BearerTokenBody) StableSize() (size int) { return 0 } - size += proto.NestedStructureSize(bearerTokenBodyACLField, bt.eacl) - size += proto.NestedStructureSize(bearerTokenBodyOwnerField, bt.ownerID) - size += proto.NestedStructureSize(bearerTokenBodyLifetimeField, bt.lifetime) + size += protoutil.NestedStructureSize(bearerTokenBodyACLField, bt.eacl) + size += protoutil.NestedStructureSize(bearerTokenBodyOwnerField, bt.ownerID) + size += protoutil.NestedStructureSize(bearerTokenBodyLifetimeField, bt.lifetime) return size } @@ -375,14 +388,14 @@ func (bt *BearerToken) StableMarshal(buf []byte) ([]byte, error) { err error ) - n, err = proto.NestedStructureMarshal(bearerTokenBodyField, buf[offset:], bt.body) + n, err = protoutil.NestedStructureMarshal(bearerTokenBodyField, buf[offset:], bt.body) if err != nil { return nil, err } offset += n - _, err = proto.NestedStructureMarshal(bearerTokenSignatureField, buf[offset:], bt.sig) + _, err = protoutil.NestedStructureMarshal(bearerTokenSignatureField, buf[offset:], bt.sig) if err != nil { return nil, err } @@ -395,8 +408,8 @@ func (bt *BearerToken) StableSize() (size int) { return 0 } - size += proto.NestedStructureSize(bearerTokenBodyField, bt.body) - size += proto.NestedStructureSize(bearerTokenSignatureField, bt.sig) + size += protoutil.NestedStructureSize(bearerTokenBodyField, bt.body) + size += protoutil.NestedStructureSize(bearerTokenSignatureField, bt.sig) return size } diff --git a/v2/acl/marshal_test.go b/v2/acl/marshal_test.go index 4727a2f..af5f56e 100644 --- a/v2/acl/marshal_test.go +++ b/v2/acl/marshal_test.go @@ -117,7 +117,6 @@ func generateBearerToken(id string) *acl.BearerToken { func TestHeaderFilter_StableMarshal(t *testing.T) { filterFrom := generateFilter(acl.HeaderTypeObject, "CID", "Container ID Value") - transport := new(grpc.EACLRecord_Filter) t.Run("non empty", func(t *testing.T) { filterFrom.SetHeaderType(acl.HeaderTypeObject) @@ -128,10 +127,9 @@ func TestHeaderFilter_StableMarshal(t *testing.T) { wire, err := filterFrom.StableMarshal(nil) require.NoError(t, err) - err = goproto.Unmarshal(wire, transport) - require.NoError(t, err) + filterTo := new(acl.HeaderFilter) + require.NoError(t, filterTo.Unmarshal(wire)) - filterTo := acl.HeaderFilterFromGRPCMessage(transport) require.Equal(t, filterFrom, filterTo) }) } From 9ddc4c1f488bda350234457f52541229e2b447d6 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 13 Nov 2020 14:40:57 +0300 Subject: [PATCH 0531/1196] [#168] acl: Implement binary/JSON encoders/decoders on Target Signed-off-by: Leonard Lyubich --- pkg/acl/eacl/target.go | 56 +++++++++++++++++++++++++++++++++++++ pkg/acl/eacl/target_test.go | 26 +++++++++++++++++ v2/acl/json.go | 20 +++++++++++++ v2/acl/json_test.go | 12 ++++++++ v2/acl/marshal.go | 11 ++++++++ v2/acl/marshal_test.go | 6 ++-- 6 files changed, 127 insertions(+), 4 deletions(-) diff --git a/pkg/acl/eacl/target.go b/pkg/acl/eacl/target.go index 73a7bf2..ca6af2e 100644 --- a/pkg/acl/eacl/target.go +++ b/pkg/acl/eacl/target.go @@ -14,10 +14,18 @@ type Target struct { keys []ecdsa.PublicKey } +func (t *Target) SetKeys(keys ...ecdsa.PublicKey) { + t.keys = keys +} + func (t Target) Keys() []ecdsa.PublicKey { return t.keys } +func (t *Target) SetRole(r Role) { + t.role = r +} + func (t Target) Role() Role { return t.role } @@ -37,6 +45,10 @@ func (t *Target) ToV2() *v2acl.Target { return target } +func NewTarget() *Target { + return NewTargetFromV2(new(v2acl.Target)) +} + func NewTargetFromV2(target *v2acl.Target) *Target { t := new(Target) @@ -54,3 +66,47 @@ func NewTargetFromV2(target *v2acl.Target) *Target { return t } + +// Marshal marshals Target into a protobuf binary form. +// +// Buffer is allocated when the argument is empty. +// Otherwise, the first buffer is used. +func (t *Target) Marshal(b ...[]byte) ([]byte, error) { + var buf []byte + if len(b) > 0 { + buf = b[0] + } + + return t.ToV2(). + StableMarshal(buf) +} + +// Unmarshal unmarshals protobuf binary representation of Target. +func (t *Target) Unmarshal(data []byte) error { + fV2 := new(v2acl.Target) + if err := fV2.Unmarshal(data); err != nil { + return err + } + + *t = *NewTargetFromV2(fV2) + + return nil +} + +// MarshalJSON encodes Target to protobuf JSON format. +func (t *Target) MarshalJSON() ([]byte, error) { + return t.ToV2(). + MarshalJSON() +} + +// UnmarshalJSON decodes Target from protobuf JSON format. +func (t *Target) UnmarshalJSON(data []byte) error { + tV2 := new(v2acl.Target) + if err := tV2.UnmarshalJSON(data); err != nil { + return err + } + + *t = *NewTargetFromV2(tV2) + + return nil +} diff --git a/pkg/acl/eacl/target_test.go b/pkg/acl/eacl/target_test.go index 077dbf4..712804c 100644 --- a/pkg/acl/eacl/target_test.go +++ b/pkg/acl/eacl/target_test.go @@ -36,3 +36,29 @@ func TestTarget(t *testing.T) { require.Equal(t, new(Target), NewTargetFromV2(nil)) }) } + +func TestTargetEncoding(t *testing.T) { + tar := NewTarget() + tar.SetRole(RoleSystem) + tar.SetKeys(test.DecodeKey(-1).PublicKey) + + t.Run("binary", func(t *testing.T) { + data, err := tar.Marshal() + require.NoError(t, err) + + tar2 := NewTarget() + require.NoError(t, tar2.Unmarshal(data)) + + require.Equal(t, tar, tar2) + }) + + t.Run("json", func(t *testing.T) { + data, err := tar.MarshalJSON() + require.NoError(t, err) + + tar2 := NewTarget() + require.NoError(t, tar2.UnmarshalJSON(data)) + + require.Equal(t, tar, tar2) + }) +} diff --git a/v2/acl/json.go b/v2/acl/json.go index e8baf1c..72cf022 100644 --- a/v2/acl/json.go +++ b/v2/acl/json.go @@ -102,3 +102,23 @@ func (f *HeaderFilter) UnmarshalJSON(data []byte) error { return nil } + +func (t *Target) MarshalJSON() ([]byte, error) { + return protojson.MarshalOptions{ + EmitUnpopulated: true, + }.Marshal( + TargetToGRPCMessage(t), + ) +} + +func (t *Target) UnmarshalJSON(data []byte) error { + msg := new(acl.EACLRecord_Target) + + if err := protojson.Unmarshal(data, msg); err != nil { + return err + } + + *t = *TargetInfoFromGRPCMessage(msg) + + return nil +} diff --git a/v2/acl/json_test.go b/v2/acl/json_test.go index d2d6845..b7e2b0c 100644 --- a/v2/acl/json_test.go +++ b/v2/acl/json_test.go @@ -76,3 +76,15 @@ func TestFilterJSON(t *testing.T) { require.Equal(t, f, f2) } + +func TestTargetJSON(t *testing.T) { + tar := generateTarget(acl.RoleSystem, 3) + + data, err := tar.MarshalJSON() + require.NoError(t, err) + + tar2 := new(acl.Target) + require.NoError(t, tar2.UnmarshalJSON(data)) + + require.Equal(t, tar, tar2) +} diff --git a/v2/acl/marshal.go b/v2/acl/marshal.go index 152d0f1..8b61472 100644 --- a/v2/acl/marshal.go +++ b/v2/acl/marshal.go @@ -278,6 +278,17 @@ func (t *Target) StableSize() (size int) { return size } +func (t *Target) Unmarshal(data []byte) error { + m := new(acl.EACLRecord_Target) + if err := proto.Unmarshal(data, m); err != nil { + return err + } + + *t = *TargetInfoFromGRPCMessage(m) + + return nil +} + func (l *TokenLifetime) StableMarshal(buf []byte) ([]byte, error) { if l == nil { return []byte{}, nil diff --git a/v2/acl/marshal_test.go b/v2/acl/marshal_test.go index af5f56e..f2df14a 100644 --- a/v2/acl/marshal_test.go +++ b/v2/acl/marshal_test.go @@ -136,7 +136,6 @@ func TestHeaderFilter_StableMarshal(t *testing.T) { func TestTargetInfo_StableMarshal(t *testing.T) { targetFrom := generateTarget(acl.RoleUser, 2) - transport := new(grpc.EACLRecord_Target) t.Run("non empty", func(t *testing.T) { targetFrom.SetRole(acl.RoleUser) @@ -148,10 +147,9 @@ func TestTargetInfo_StableMarshal(t *testing.T) { wire, err := targetFrom.StableMarshal(nil) require.NoError(t, err) - err = goproto.Unmarshal(wire, transport) - require.NoError(t, err) + targetTo := new(acl.Target) + require.NoError(t, targetTo.Unmarshal(wire)) - targetTo := acl.TargetInfoFromGRPCMessage(transport) require.Equal(t, targetFrom, targetTo) }) } From ae68790bbd40f3ead2807827f0af555a5f002cbf Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 13 Nov 2020 14:48:19 +0300 Subject: [PATCH 0532/1196] [#168] acl: Implement binary/JSON encoders/decoders on Record Signed-off-by: Leonard Lyubich --- pkg/acl/eacl/record.go | 44 +++++++++++++++++++++++++++++++++++++ pkg/acl/eacl/record_test.go | 28 +++++++++++++++++++++++ v2/acl/json.go | 20 +++++++++++++++++ v2/acl/marshal.go | 11 ++++++++++ v2/acl/marshal_test.go | 8 +++---- 5 files changed, 106 insertions(+), 5 deletions(-) diff --git a/pkg/acl/eacl/record.go b/pkg/acl/eacl/record.go index 126652e..db077aa 100644 --- a/pkg/acl/eacl/record.go +++ b/pkg/acl/eacl/record.go @@ -162,3 +162,47 @@ func NewRecordFromV2(record *v2acl.Record) *Record { return r } + +// Marshal marshals Record into a protobuf binary form. +// +// Buffer is allocated when the argument is empty. +// Otherwise, the first buffer is used. +func (r *Record) Marshal(b ...[]byte) ([]byte, error) { + var buf []byte + if len(b) > 0 { + buf = b[0] + } + + return r.ToV2(). + StableMarshal(buf) +} + +// Unmarshal unmarshals protobuf binary representation of Record. +func (r *Record) Unmarshal(data []byte) error { + fV2 := new(v2acl.Record) + if err := fV2.Unmarshal(data); err != nil { + return err + } + + *r = *NewRecordFromV2(fV2) + + return nil +} + +// MarshalJSON encodes Record to protobuf JSON format. +func (r *Record) MarshalJSON() ([]byte, error) { + return r.ToV2(). + MarshalJSON() +} + +// UnmarshalJSON decodes Record from protobuf JSON format. +func (r *Record) UnmarshalJSON(data []byte) error { + tV2 := new(v2acl.Record) + if err := tV2.UnmarshalJSON(data); err != nil { + return err + } + + *r = *NewRecordFromV2(tV2) + + return nil +} diff --git a/pkg/acl/eacl/record_test.go b/pkg/acl/eacl/record_test.go index 7cddd2e..fef691d 100644 --- a/pkg/acl/eacl/record_test.go +++ b/pkg/acl/eacl/record_test.go @@ -71,3 +71,31 @@ func TestRecord_AddFilter(t *testing.T) { require.Equal(t, filters, r.Filters()) } + +func TestRecordEncoding(t *testing.T) { + r := NewRecord() + r.SetOperation(OperationHead) + r.SetAction(ActionDeny) + r.AddObjectAttributeFilter(MatchStringEqual, "key", "value") + r.AddTarget(RoleSystem, test.DecodeKey(-1).PublicKey) + + t.Run("binary", func(t *testing.T) { + data, err := r.Marshal() + require.NoError(t, err) + + r2 := NewRecord() + require.NoError(t, r2.Unmarshal(data)) + + require.Equal(t, r, r2) + }) + + t.Run("json", func(t *testing.T) { + data, err := r.MarshalJSON() + require.NoError(t, err) + + r2 := NewRecord() + require.NoError(t, r2.UnmarshalJSON(data)) + + require.Equal(t, r, r2) + }) +} diff --git a/v2/acl/json.go b/v2/acl/json.go index 72cf022..a45f666 100644 --- a/v2/acl/json.go +++ b/v2/acl/json.go @@ -122,3 +122,23 @@ func (t *Target) UnmarshalJSON(data []byte) error { return nil } + +func (r *Record) MarshalJSON() ([]byte, error) { + return protojson.MarshalOptions{ + EmitUnpopulated: true, + }.Marshal( + RecordToGRPCMessage(r), + ) +} + +func (r *Record) UnmarshalJSON(data []byte) error { + msg := new(acl.EACLRecord) + + if err := protojson.Unmarshal(data, msg); err != nil { + return err + } + + *r = *RecordFromGRPCMessage(msg) + + return nil +} diff --git a/v2/acl/marshal.go b/v2/acl/marshal.go index 8b61472..fcf70b7 100644 --- a/v2/acl/marshal.go +++ b/v2/acl/marshal.go @@ -165,6 +165,17 @@ func (r *Record) StableSize() (size int) { return size } +func (r *Record) Unmarshal(data []byte) error { + m := new(acl.EACLRecord) + if err := proto.Unmarshal(data, m); err != nil { + return err + } + + *r = *RecordFromGRPCMessage(m) + + return nil +} + // StableMarshal marshals unified header filter structure in a protobuf // compatible way without field order shuffle. func (f *HeaderFilter) StableMarshal(buf []byte) ([]byte, error) { diff --git a/v2/acl/marshal_test.go b/v2/acl/marshal_test.go index f2df14a..8d79bc1 100644 --- a/v2/acl/marshal_test.go +++ b/v2/acl/marshal_test.go @@ -156,17 +156,15 @@ func TestTargetInfo_StableMarshal(t *testing.T) { func TestRecord_StableMarshal(t *testing.T) { recordFrom := generateRecord(false) - transport := new(grpc.EACLRecord) t.Run("non empty", func(t *testing.T) { wire, err := recordFrom.StableMarshal(nil) require.NoError(t, err) - err = goproto.Unmarshal(wire, transport) - require.NoError(t, err) + to := new(acl.Record) + require.NoError(t, to.Unmarshal(wire)) - recordTo := acl.RecordFromGRPCMessage(transport) - require.Equal(t, recordFrom, recordTo) + require.Equal(t, recordFrom, to) }) } From 233756ca8facbbf08599ecdcabd708d205db3294 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 13 Nov 2020 14:55:45 +0300 Subject: [PATCH 0533/1196] [#168] acl: Implement binary/JSON encoders/decoders on Table Signed-off-by: Leonard Lyubich --- pkg/acl/eacl/table.go | 44 ++++++++++++++++++++++++ pkg/acl/eacl/table_test.go | 27 +++++++++++++++ v2/acl/json.go | 68 +++++++++++--------------------------- v2/acl/json_test.go | 57 ++++++++------------------------ v2/acl/marshal.go | 11 ++++++ v2/acl/marshal_test.go | 6 ++-- 6 files changed, 117 insertions(+), 96 deletions(-) diff --git a/pkg/acl/eacl/table.go b/pkg/acl/eacl/table.go index a0fe857..ff14093 100644 --- a/pkg/acl/eacl/table.go +++ b/pkg/acl/eacl/table.go @@ -111,3 +111,47 @@ func NewTableFromV2(table *v2acl.Table) *Table { return t } + +// Marshal marshals Table into a protobuf binary form. +// +// Buffer is allocated when the argument is empty. +// Otherwise, the first buffer is used. +func (t *Table) Marshal(b ...[]byte) ([]byte, error) { + var buf []byte + if len(b) > 0 { + buf = b[0] + } + + return t.ToV2(). + StableMarshal(buf) +} + +// Unmarshal unmarshals protobuf binary representation of Table. +func (t *Table) Unmarshal(data []byte) error { + fV2 := new(v2acl.Table) + if err := fV2.Unmarshal(data); err != nil { + return err + } + + *t = *NewTableFromV2(fV2) + + return nil +} + +// MarshalJSON encodes Table to protobuf JSON format. +func (t *Table) MarshalJSON() ([]byte, error) { + return t.ToV2(). + MarshalJSON() +} + +// UnmarshalJSON decodes Table from protobuf JSON format. +func (t *Table) UnmarshalJSON(data []byte) error { + tV2 := new(v2acl.Table) + if err := tV2.UnmarshalJSON(data); err != nil { + return err + } + + *t = *NewTableFromV2(tV2) + + return nil +} diff --git a/pkg/acl/eacl/table_test.go b/pkg/acl/eacl/table_test.go index e7121fb..cdf7a6a 100644 --- a/pkg/acl/eacl/table_test.go +++ b/pkg/acl/eacl/table_test.go @@ -78,3 +78,30 @@ func TestTable_AddRecord(t *testing.T) { require.Equal(t, records, table.Records()) } + +func TestRecordEncoding(t *testing.T) { + tab := eacl.NewTable() + tab.AddRecord( + eacl.CreateRecord(eacl.ActionDeny, eacl.OperationHead), + ) + + t.Run("binary", func(t *testing.T) { + data, err := tab.Marshal() + require.NoError(t, err) + + tab2 := eacl.NewTable() + require.NoError(t, tab2.Unmarshal(data)) + + require.Equal(t, tab, tab2) + }) + + t.Run("json", func(t *testing.T) { + data, err := tab.MarshalJSON() + require.NoError(t, err) + + r2 := eacl.NewTable() + require.NoError(t, r2.UnmarshalJSON(data)) + + require.Equal(t, tab, r2) + }) +} diff --git a/v2/acl/json.go b/v2/acl/json.go index a45f666..04256f7 100644 --- a/v2/acl/json.go +++ b/v2/acl/json.go @@ -11,54 +11,6 @@ var ( errEmptyInput = errors.New("empty input") ) -func RecordToJSON(r *Record) ([]byte, error) { - if r == nil { - return nil, errEmptyInput - } - - msg := RecordToGRPCMessage(r) - - return protojson.MarshalOptions{EmitUnpopulated: true}.Marshal(msg) -} - -func RecordFromJSON(data []byte) (*Record, error) { - if len(data) == 0 { - return nil, errEmptyInput - } - - msg := new(acl.EACLRecord) - - if err := protojson.Unmarshal(data, msg); err != nil { - return nil, err - } - - return RecordFromGRPCMessage(msg), nil -} - -func TableToJSON(t *Table) ([]byte, error) { - if t == nil { - return nil, errEmptyInput - } - - msg := TableToGRPCMessage(t) - - return protojson.MarshalOptions{EmitUnpopulated: true}.Marshal(msg) -} - -func TableFromJSON(data []byte) (*Table, error) { - if len(data) == 0 { - return nil, errEmptyInput - } - - msg := new(acl.EACLTable) - - if err := protojson.Unmarshal(data, msg); err != nil { - return nil, err - } - - return TableFromGRPCMessage(msg), nil -} - func BearerTokenToJSON(t *BearerToken) ([]byte, error) { if t == nil { return nil, errEmptyInput @@ -142,3 +94,23 @@ func (r *Record) UnmarshalJSON(data []byte) error { return nil } + +func (t *Table) MarshalJSON() ([]byte, error) { + return protojson.MarshalOptions{ + EmitUnpopulated: true, + }.Marshal( + TableToGRPCMessage(t), + ) +} + +func (t *Table) UnmarshalJSON(data []byte) error { + msg := new(acl.EACLTable) + + if err := protojson.Unmarshal(data, msg); err != nil { + return err + } + + *t = *TableFromGRPCMessage(msg) + + return nil +} diff --git a/v2/acl/json_test.go b/v2/acl/json_test.go index b7e2b0c..cc5a834 100644 --- a/v2/acl/json_test.go +++ b/v2/acl/json_test.go @@ -7,50 +7,6 @@ import ( "github.com/stretchr/testify/require" ) -func TestRecordJSON(t *testing.T) { - exp := generateRecord(false) - - t.Run("non empty", func(t *testing.T) { - data, err := acl.RecordToJSON(exp) - require.NoError(t, err) - - got, err := acl.RecordFromJSON(data) - require.NoError(t, err) - - require.Equal(t, exp, got) - }) - - t.Run("empty", func(t *testing.T) { - _, err := acl.RecordToJSON(nil) - require.Error(t, err) - - _, err = acl.RecordFromJSON(nil) - require.Error(t, err) - }) -} - -func TestEACLTableJSON(t *testing.T) { - exp := generateEACL() - - t.Run("non empty", func(t *testing.T) { - data, err := acl.TableToJSON(exp) - require.NoError(t, err) - - got, err := acl.TableFromJSON(data) - require.NoError(t, err) - - require.Equal(t, exp, got) - }) - - t.Run("empty", func(t *testing.T) { - _, err := acl.TableToJSON(nil) - require.Error(t, err) - - _, err = acl.TableFromJSON(nil) - require.Error(t, err) - }) -} - func TestBearerTokenJSON(t *testing.T) { exp := generateBearerToken("token") @@ -88,3 +44,16 @@ func TestTargetJSON(t *testing.T) { require.Equal(t, tar, tar2) } + +func TestTable_MarshalJSON(t *testing.T) { + tab := new(acl.Table) + tab.SetRecords([]*acl.Record{generateRecord(false)}) + + data, err := tab.MarshalJSON() + require.NoError(t, err) + + tab2 := new(acl.Table) + require.NoError(t, tab2.UnmarshalJSON(data)) + + require.Equal(t, tab, tab2) +} diff --git a/v2/acl/marshal.go b/v2/acl/marshal.go index fcf70b7..f434970 100644 --- a/v2/acl/marshal.go +++ b/v2/acl/marshal.go @@ -94,6 +94,17 @@ func (t *Table) StableSize() (size int) { return size } +func (t *Table) Unmarshal(data []byte) error { + m := new(acl.EACLTable) + if err := proto.Unmarshal(data, m); err != nil { + return err + } + + *t = *TableFromGRPCMessage(m) + + return nil +} + // StableMarshal marshals unified acl record structure in a protobuf // compatible way without field order shuffle. func (r *Record) StableMarshal(buf []byte) ([]byte, error) { diff --git a/v2/acl/marshal_test.go b/v2/acl/marshal_test.go index 8d79bc1..0aecf97 100644 --- a/v2/acl/marshal_test.go +++ b/v2/acl/marshal_test.go @@ -170,7 +170,6 @@ func TestRecord_StableMarshal(t *testing.T) { func TestTable_StableMarshal(t *testing.T) { tableFrom := new(acl.Table) - transport := new(grpc.EACLTable) t.Run("non empty", func(t *testing.T) { cid := new(refs.ContainerID) @@ -190,10 +189,9 @@ func TestTable_StableMarshal(t *testing.T) { wire, err := tableFrom.StableMarshal(nil) require.NoError(t, err) - err = goproto.Unmarshal(wire, transport) - require.NoError(t, err) + tableTo := new(acl.Table) + require.NoError(t, tableTo.Unmarshal(wire)) - tableTo := acl.TableFromGRPCMessage(transport) require.Equal(t, tableFrom, tableTo) }) } From 0f4d5d5f1e2da3d774d1ba470c89e6dd0a382966 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 13 Nov 2020 15:00:03 +0300 Subject: [PATCH 0534/1196] [#168] acl: Implement binary/JSON encoders/decoders on TokenLifetime Signed-off-by: Leonard Lyubich --- v2/acl/json.go | 20 ++++++++++++++++++++ v2/acl/json_test.go | 12 ++++++++++++ v2/acl/marshal.go | 11 +++++++++++ v2/acl/marshal_test.go | 6 ++---- 4 files changed, 45 insertions(+), 4 deletions(-) diff --git a/v2/acl/json.go b/v2/acl/json.go index 04256f7..c80c165 100644 --- a/v2/acl/json.go +++ b/v2/acl/json.go @@ -114,3 +114,23 @@ func (t *Table) UnmarshalJSON(data []byte) error { return nil } + +func (l *TokenLifetime) MarshalJSON() ([]byte, error) { + return protojson.MarshalOptions{ + EmitUnpopulated: true, + }.Marshal( + TokenLifetimeToGRPCMessage(l), + ) +} + +func (l *TokenLifetime) UnmarshalJSON(data []byte) error { + msg := new(acl.BearerToken_Body_TokenLifetime) + + if err := protojson.Unmarshal(data, msg); err != nil { + return err + } + + *l = *TokenLifetimeFromGRPCMessage(msg) + + return nil +} diff --git a/v2/acl/json_test.go b/v2/acl/json_test.go index cc5a834..b860d35 100644 --- a/v2/acl/json_test.go +++ b/v2/acl/json_test.go @@ -57,3 +57,15 @@ func TestTable_MarshalJSON(t *testing.T) { require.Equal(t, tab, tab2) } + +func TestTokenLifetimeJSON(t *testing.T) { + l := generateLifetime(1, 2, 3) + + data, err := l.MarshalJSON() + require.NoError(t, err) + + l2 := new(acl.TokenLifetime) + require.NoError(t, l2.UnmarshalJSON(data)) + + require.Equal(t, l, l2) +} diff --git a/v2/acl/marshal.go b/v2/acl/marshal.go index f434970..8ff9964 100644 --- a/v2/acl/marshal.go +++ b/v2/acl/marshal.go @@ -359,6 +359,17 @@ func (l *TokenLifetime) StableSize() (size int) { return size } +func (l *TokenLifetime) Unmarshal(data []byte) error { + m := new(acl.BearerToken_Body_TokenLifetime) + if err := proto.Unmarshal(data, m); err != nil { + return err + } + + *l = *TokenLifetimeFromGRPCMessage(m) + + return nil +} + func (bt *BearerTokenBody) StableMarshal(buf []byte) ([]byte, error) { if bt == nil { return []byte{}, nil diff --git a/v2/acl/marshal_test.go b/v2/acl/marshal_test.go index 0aecf97..f55834b 100644 --- a/v2/acl/marshal_test.go +++ b/v2/acl/marshal_test.go @@ -198,16 +198,14 @@ func TestTable_StableMarshal(t *testing.T) { func TestTokenLifetime_StableMarshal(t *testing.T) { lifetimeFrom := generateLifetime(10, 20, 30) - transport := new(grpc.BearerToken_Body_TokenLifetime) t.Run("non empty", func(t *testing.T) { wire, err := lifetimeFrom.StableMarshal(nil) require.NoError(t, err) - err = goproto.Unmarshal(wire, transport) - require.NoError(t, err) + lifetimeTo := new(acl.TokenLifetime) + require.NoError(t, lifetimeTo.Unmarshal(wire)) - lifetimeTo := acl.TokenLifetimeFromGRPCMessage(transport) require.Equal(t, lifetimeFrom, lifetimeTo) }) } From d8fa8df442a8df3f16efd0d14d4ba00a837562b2 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 13 Nov 2020 15:03:29 +0300 Subject: [PATCH 0535/1196] [#168] acl: Implement binary/JSON encoders/decoders on BearerTokenBody Signed-off-by: Leonard Lyubich --- v2/acl/json.go | 20 ++++++++++++++++++++ v2/acl/json_test.go | 12 ++++++++++++ v2/acl/marshal.go | 11 +++++++++++ v2/acl/marshal_test.go | 6 ++---- 4 files changed, 45 insertions(+), 4 deletions(-) diff --git a/v2/acl/json.go b/v2/acl/json.go index c80c165..fcbd335 100644 --- a/v2/acl/json.go +++ b/v2/acl/json.go @@ -134,3 +134,23 @@ func (l *TokenLifetime) UnmarshalJSON(data []byte) error { return nil } + +func (bt *BearerTokenBody) MarshalJSON() ([]byte, error) { + return protojson.MarshalOptions{ + EmitUnpopulated: true, + }.Marshal( + BearerTokenBodyToGRPCMessage(bt), + ) +} + +func (bt *BearerTokenBody) UnmarshalJSON(data []byte) error { + msg := new(acl.BearerToken_Body) + + if err := protojson.Unmarshal(data, msg); err != nil { + return err + } + + *bt = *BearerTokenBodyFromGRPCMessage(msg) + + return nil +} diff --git a/v2/acl/json_test.go b/v2/acl/json_test.go index b860d35..1962c1d 100644 --- a/v2/acl/json_test.go +++ b/v2/acl/json_test.go @@ -69,3 +69,15 @@ func TestTokenLifetimeJSON(t *testing.T) { require.Equal(t, l, l2) } + +func TestBearerTokenBodyJSON(t *testing.T) { + b := generateBearerTokenBody("id") + + data, err := b.MarshalJSON() + require.NoError(t, err) + + b2 := new(acl.BearerTokenBody) + require.NoError(t, b2.UnmarshalJSON(data)) + + require.Equal(t, b, b2) +} diff --git a/v2/acl/marshal.go b/v2/acl/marshal.go index 8ff9964..ac378cc 100644 --- a/v2/acl/marshal.go +++ b/v2/acl/marshal.go @@ -418,6 +418,17 @@ func (bt *BearerTokenBody) StableSize() (size int) { return size } +func (bt *BearerTokenBody) Unmarshal(data []byte) error { + m := new(acl.BearerToken_Body) + if err := proto.Unmarshal(data, m); err != nil { + return err + } + + *bt = *BearerTokenBodyFromGRPCMessage(m) + + return nil +} + func (bt *BearerToken) StableMarshal(buf []byte) ([]byte, error) { if bt == nil { return []byte{}, nil diff --git a/v2/acl/marshal_test.go b/v2/acl/marshal_test.go index f55834b..bb1ba98 100644 --- a/v2/acl/marshal_test.go +++ b/v2/acl/marshal_test.go @@ -212,16 +212,14 @@ func TestTokenLifetime_StableMarshal(t *testing.T) { func TestBearerTokenBody_StableMarshal(t *testing.T) { bearerTokenBodyFrom := generateBearerTokenBody("Bearer Token Body") - transport := new(grpc.BearerToken_Body) t.Run("non empty", func(t *testing.T) { wire, err := bearerTokenBodyFrom.StableMarshal(nil) require.NoError(t, err) - err = goproto.Unmarshal(wire, transport) - require.NoError(t, err) + bearerTokenBodyTo := new(acl.BearerTokenBody) + require.NoError(t, bearerTokenBodyTo.Unmarshal(wire)) - bearerTokenBodyTo := acl.BearerTokenBodyFromGRPCMessage(transport) require.Equal(t, bearerTokenBodyFrom, bearerTokenBodyTo) }) } From ec957be60c62d8129f453430e80dff7ffd660c8a Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 13 Nov 2020 15:08:37 +0300 Subject: [PATCH 0536/1196] [#168] acl: Implement binary/JSON encoders/decoders on BearerToken Signed-off-by: Leonard Lyubich --- pkg/token/bearer.go | 44 +++++++++++++++++++++++++++++++++++ pkg/token/bearer_test.go | 25 ++++++++++++++++++++ v2/acl/json.go | 50 ++++++++++++++++------------------------ v2/acl/json_test.go | 14 +++++------ v2/acl/marshal.go | 11 +++++++++ v2/acl/marshal_test.go | 8 ++----- 6 files changed, 108 insertions(+), 44 deletions(-) diff --git a/pkg/token/bearer.go b/pkg/token/bearer.go index 87ecbc5..6dbb457 100644 --- a/pkg/token/bearer.go +++ b/pkg/token/bearer.go @@ -118,3 +118,47 @@ func sanityCheck(b *BearerToken) error { return nil } + +// Marshal marshals BearerToken into a protobuf binary form. +// +// Buffer is allocated when the argument is empty. +// Otherwise, the first buffer is used. +func (b *BearerToken) Marshal(bs ...[]byte) ([]byte, error) { + var buf []byte + if len(bs) > 0 { + buf = bs[0] + } + + return b.ToV2(). + StableMarshal(buf) +} + +// Unmarshal unmarshals protobuf binary representation of BearerToken. +func (b *BearerToken) Unmarshal(data []byte) error { + fV2 := new(acl.BearerToken) + if err := fV2.Unmarshal(data); err != nil { + return err + } + + *b = *NewBearerTokenFromV2(fV2) + + return nil +} + +// MarshalJSON encodes BearerToken to protobuf JSON format. +func (b *BearerToken) MarshalJSON() ([]byte, error) { + return b.ToV2(). + MarshalJSON() +} + +// UnmarshalJSON decodes BearerToken from protobuf JSON format. +func (b *BearerToken) UnmarshalJSON(data []byte) error { + fV2 := new(acl.BearerToken) + if err := fV2.UnmarshalJSON(data); err != nil { + return err + } + + *b = *NewBearerTokenFromV2(fV2) + + return nil +} diff --git a/pkg/token/bearer_test.go b/pkg/token/bearer_test.go index a06510b..353a1b7 100644 --- a/pkg/token/bearer_test.go +++ b/pkg/token/bearer_test.go @@ -30,3 +30,28 @@ func TestBearerToken_Issuer(t *testing.T) { require.Equal(t, bearerToken.Issuer().String(), ownerID.String()) }) } + +func TestFilterEncoding(t *testing.T) { + f := token.NewBearerToken() + f.SetLifetime(1, 2, 3) + + t.Run("binary", func(t *testing.T) { + data, err := f.Marshal() + require.NoError(t, err) + + f2 := token.NewBearerToken() + require.NoError(t, f2.Unmarshal(data)) + + require.Equal(t, f, f2) + }) + + t.Run("json", func(t *testing.T) { + data, err := f.MarshalJSON() + require.NoError(t, err) + + d2 := token.NewBearerToken() + require.NoError(t, d2.UnmarshalJSON(data)) + + require.Equal(t, f, d2) + }) +} diff --git a/v2/acl/json.go b/v2/acl/json.go index fcbd335..91f2d32 100644 --- a/v2/acl/json.go +++ b/v2/acl/json.go @@ -1,40 +1,10 @@ package acl import ( - "errors" - acl "github.com/nspcc-dev/neofs-api-go/v2/acl/grpc" "google.golang.org/protobuf/encoding/protojson" ) -var ( - errEmptyInput = errors.New("empty input") -) - -func BearerTokenToJSON(t *BearerToken) ([]byte, error) { - if t == nil { - return nil, errEmptyInput - } - - msg := BearerTokenToGRPCMessage(t) - - return protojson.MarshalOptions{EmitUnpopulated: true}.Marshal(msg) -} - -func BearerTokenFromJSON(data []byte) (*BearerToken, error) { - if len(data) == 0 { - return nil, errEmptyInput - } - - msg := new(acl.BearerToken) - - if err := protojson.Unmarshal(data, msg); err != nil { - return nil, err - } - - return BearerTokenFromGRPCMessage(msg), nil -} - func (f *HeaderFilter) MarshalJSON() ([]byte, error) { return protojson.MarshalOptions{ EmitUnpopulated: true, @@ -154,3 +124,23 @@ func (bt *BearerTokenBody) UnmarshalJSON(data []byte) error { return nil } + +func (bt *BearerToken) MarshalJSON() ([]byte, error) { + return protojson.MarshalOptions{ + EmitUnpopulated: true, + }.Marshal( + BearerTokenToGRPCMessage(bt), + ) +} + +func (bt *BearerToken) UnmarshalJSON(data []byte) error { + msg := new(acl.BearerToken) + + if err := protojson.Unmarshal(data, msg); err != nil { + return err + } + + *bt = *BearerTokenFromGRPCMessage(msg) + + return nil +} diff --git a/v2/acl/json_test.go b/v2/acl/json_test.go index 1962c1d..6d95755 100644 --- a/v2/acl/json_test.go +++ b/v2/acl/json_test.go @@ -8,17 +8,15 @@ import ( ) func TestBearerTokenJSON(t *testing.T) { - exp := generateBearerToken("token") + b := generateBearerToken("id") - t.Run("non empty", func(t *testing.T) { - data, err := acl.BearerTokenToJSON(exp) - require.NoError(t, err) + data, err := b.MarshalJSON() + require.NoError(t, err) - got, err := acl.BearerTokenFromJSON(data) - require.NoError(t, err) + b2 := new(acl.BearerToken) + require.NoError(t, b2.UnmarshalJSON(data)) - require.Equal(t, exp, got) - }) + require.Equal(t, b, b2) } func TestFilterJSON(t *testing.T) { diff --git a/v2/acl/marshal.go b/v2/acl/marshal.go index ac378cc..f477848 100644 --- a/v2/acl/marshal.go +++ b/v2/acl/marshal.go @@ -468,3 +468,14 @@ func (bt *BearerToken) StableSize() (size int) { return size } + +func (bt *BearerToken) Unmarshal(data []byte) error { + m := new(acl.BearerToken) + if err := proto.Unmarshal(data, m); err != nil { + return err + } + + *bt = *BearerTokenFromGRPCMessage(m) + + return nil +} diff --git a/v2/acl/marshal_test.go b/v2/acl/marshal_test.go index bb1ba98..8b85411 100644 --- a/v2/acl/marshal_test.go +++ b/v2/acl/marshal_test.go @@ -5,10 +5,8 @@ import ( "testing" "github.com/nspcc-dev/neofs-api-go/v2/acl" - grpc "github.com/nspcc-dev/neofs-api-go/v2/acl/grpc" "github.com/nspcc-dev/neofs-api-go/v2/refs" "github.com/stretchr/testify/require" - goproto "google.golang.org/protobuf/proto" ) func generateTarget(u acl.Role, k int) *acl.Target { @@ -226,16 +224,14 @@ func TestBearerTokenBody_StableMarshal(t *testing.T) { func TestBearerToken_StableMarshal(t *testing.T) { bearerTokenFrom := generateBearerToken("Bearer Token") - transport := new(grpc.BearerToken) t.Run("non empty", func(t *testing.T) { wire, err := bearerTokenFrom.StableMarshal(nil) require.NoError(t, err) - err = goproto.Unmarshal(wire, transport) - require.NoError(t, err) + bearerTokenTo := new(acl.BearerToken) + require.NoError(t, bearerTokenTo.Unmarshal(wire)) - bearerTokenTo := acl.BearerTokenFromGRPCMessage(transport) require.Equal(t, bearerTokenFrom, bearerTokenTo) }) } From bc5d9dcce5cc56bbe625a123faf89559e786dcdc Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 13 Nov 2020 15:14:39 +0300 Subject: [PATCH 0537/1196] [#168] container: Implement binary/JSON encoders/decoders on Attribute Signed-off-by: Leonard Lyubich --- v2/container/json.go | 20 +++++++ v2/container/json_test.go | 12 ++++ v2/container/marshal.go | 103 ++++++++++++++++++++--------------- v2/container/marshal_test.go | 6 +- 4 files changed, 92 insertions(+), 49 deletions(-) diff --git a/v2/container/json.go b/v2/container/json.go index b8bfc7a..0cf7c63 100644 --- a/v2/container/json.go +++ b/v2/container/json.go @@ -34,3 +34,23 @@ func ContainerFromJSON(data []byte) (*Container, error) { return ContainerFromGRPCMessage(msg), nil } + +func (a *Attribute) MarshalJSON() ([]byte, error) { + return protojson.MarshalOptions{ + EmitUnpopulated: true, + }.Marshal( + AttributeToGRPCMessage(a), + ) +} + +func (a *Attribute) UnmarshalJSON(data []byte) error { + msg := new(container.Container_Attribute) + + if err := protojson.Unmarshal(data, msg); err != nil { + return err + } + + *a = *AttributeFromGRPCMessage(msg) + + return nil +} diff --git a/v2/container/json_test.go b/v2/container/json_test.go index cbba965..d25b09d 100644 --- a/v2/container/json_test.go +++ b/v2/container/json_test.go @@ -28,3 +28,15 @@ func TestContainerJSON(t *testing.T) { require.Error(t, err) }) } + +func TestAttributeJSON(t *testing.T) { + b := generateAttribute("key", "value") + + data, err := b.MarshalJSON() + require.NoError(t, err) + + b2 := new(container.Attribute) + require.NoError(t, b2.UnmarshalJSON(data)) + + require.Equal(t, b, b2) +} diff --git a/v2/container/marshal.go b/v2/container/marshal.go index a9fdd02..c89597d 100644 --- a/v2/container/marshal.go +++ b/v2/container/marshal.go @@ -1,7 +1,9 @@ package container import ( - "github.com/nspcc-dev/neofs-api-go/util/proto" + protoutil "github.com/nspcc-dev/neofs-api-go/util/proto" + container "github.com/nspcc-dev/neofs-api-go/v2/container/grpc" + "google.golang.org/protobuf/proto" ) const ( @@ -54,14 +56,14 @@ func (a *Attribute) StableMarshal(buf []byte) ([]byte, error) { err error ) - n, err = proto.StringMarshal(attributeKeyField, buf[offset:], a.key) + n, err = protoutil.StringMarshal(attributeKeyField, buf[offset:], a.key) if err != nil { return nil, err } offset += n - _, err = proto.StringMarshal(attributeValueField, buf[offset:], a.val) + _, err = protoutil.StringMarshal(attributeValueField, buf[offset:], a.val) if err != nil { return nil, err } @@ -74,12 +76,23 @@ func (a *Attribute) StableSize() (size int) { return 0 } - size += proto.StringSize(attributeKeyField, a.key) - size += proto.StringSize(attributeValueField, a.val) + size += protoutil.StringSize(attributeKeyField, a.key) + size += protoutil.StringSize(attributeValueField, a.val) return size } +func (a *Attribute) Unmarshal(data []byte) error { + m := new(container.Container_Attribute) + if err := proto.Unmarshal(data, m); err != nil { + return err + } + + *a = *AttributeFromGRPCMessage(m) + + return nil +} + func (c *Container) StableMarshal(buf []byte) ([]byte, error) { if c == nil { return []byte{}, nil @@ -94,28 +107,28 @@ func (c *Container) StableMarshal(buf []byte) ([]byte, error) { err error ) - n, err = proto.NestedStructureMarshal(containerVersionField, buf[offset:], c.version) + n, err = protoutil.NestedStructureMarshal(containerVersionField, buf[offset:], c.version) if err != nil { return nil, err } offset += n - n, err = proto.NestedStructureMarshal(containerOwnerField, buf[offset:], c.ownerID) + n, err = protoutil.NestedStructureMarshal(containerOwnerField, buf[offset:], c.ownerID) if err != nil { return nil, err } offset += n - n, err = proto.BytesMarshal(containerNonceField, buf[offset:], c.nonce) + n, err = protoutil.BytesMarshal(containerNonceField, buf[offset:], c.nonce) if err != nil { return nil, err } offset += n - n, err = proto.UInt32Marshal(containerBasicACLField, buf[offset:], c.basicACL) + n, err = protoutil.UInt32Marshal(containerBasicACLField, buf[offset:], c.basicACL) if err != nil { return nil, err } @@ -123,7 +136,7 @@ func (c *Container) StableMarshal(buf []byte) ([]byte, error) { offset += n for i := range c.attr { - n, err = proto.NestedStructureMarshal(containerAttributesField, buf[offset:], c.attr[i]) + n, err = protoutil.NestedStructureMarshal(containerAttributesField, buf[offset:], c.attr[i]) if err != nil { return nil, err } @@ -131,7 +144,7 @@ func (c *Container) StableMarshal(buf []byte) ([]byte, error) { offset += n } - _, err = proto.NestedStructureMarshal(containerPlacementField, buf[offset:], c.policy) + _, err = protoutil.NestedStructureMarshal(containerPlacementField, buf[offset:], c.policy) if err != nil { return nil, err } @@ -144,16 +157,16 @@ func (c *Container) StableSize() (size int) { return 0 } - size += proto.NestedStructureSize(containerVersionField, c.version) - size += proto.NestedStructureSize(containerOwnerField, c.ownerID) - size += proto.BytesSize(containerNonceField, c.nonce) - size += proto.UInt32Size(containerBasicACLField, c.basicACL) + size += protoutil.NestedStructureSize(containerVersionField, c.version) + size += protoutil.NestedStructureSize(containerOwnerField, c.ownerID) + size += protoutil.BytesSize(containerNonceField, c.nonce) + size += protoutil.UInt32Size(containerBasicACLField, c.basicACL) for i := range c.attr { - size += proto.NestedStructureSize(containerAttributesField, c.attr[i]) + size += protoutil.NestedStructureSize(containerAttributesField, c.attr[i]) } - size += proto.NestedStructureSize(containerPlacementField, c.policy) + size += protoutil.NestedStructureSize(containerPlacementField, c.policy) return size } @@ -172,14 +185,14 @@ func (r *PutRequestBody) StableMarshal(buf []byte) ([]byte, error) { err error ) - n, err = proto.NestedStructureMarshal(putReqBodyContainerField, buf[offset:], r.cnr) + n, err = protoutil.NestedStructureMarshal(putReqBodyContainerField, buf[offset:], r.cnr) if err != nil { return nil, err } offset += n - _, err = proto.NestedStructureMarshal(putReqBodySignatureField, buf[offset:], r.sig) + _, err = protoutil.NestedStructureMarshal(putReqBodySignatureField, buf[offset:], r.sig) if err != nil { return nil, err } @@ -192,8 +205,8 @@ func (r *PutRequestBody) StableSize() (size int) { return 0 } - size += proto.NestedStructureSize(putReqBodyContainerField, r.cnr) - size += proto.NestedStructureSize(putReqBodySignatureField, r.sig) + size += protoutil.NestedStructureSize(putReqBodyContainerField, r.cnr) + size += protoutil.NestedStructureSize(putReqBodySignatureField, r.sig) return size } @@ -211,7 +224,7 @@ func (r *PutResponseBody) StableMarshal(buf []byte) ([]byte, error) { err error ) - _, err = proto.NestedStructureMarshal(putRespBodyIDField, buf, r.cid) + _, err = protoutil.NestedStructureMarshal(putRespBodyIDField, buf, r.cid) if err != nil { return nil, err } @@ -224,7 +237,7 @@ func (r *PutResponseBody) StableSize() (size int) { return 0 } - size += proto.NestedStructureSize(putRespBodyIDField, r.cid) + size += protoutil.NestedStructureSize(putRespBodyIDField, r.cid) return size } @@ -243,14 +256,14 @@ func (r *DeleteRequestBody) StableMarshal(buf []byte) ([]byte, error) { err error ) - n, err = proto.NestedStructureMarshal(deleteReqBodyIDField, buf[offset:], r.cid) + n, err = protoutil.NestedStructureMarshal(deleteReqBodyIDField, buf[offset:], r.cid) if err != nil { return nil, err } offset += n - _, err = proto.NestedStructureMarshal(deleteReqBodySignatureField, buf[offset:], r.sig) + _, err = protoutil.NestedStructureMarshal(deleteReqBodySignatureField, buf[offset:], r.sig) if err != nil { return nil, err } @@ -263,8 +276,8 @@ func (r *DeleteRequestBody) StableSize() (size int) { return 0 } - size += proto.NestedStructureSize(deleteReqBodyIDField, r.cid) - size += proto.NestedStructureSize(deleteReqBodySignatureField, r.sig) + size += protoutil.NestedStructureSize(deleteReqBodyIDField, r.cid) + size += protoutil.NestedStructureSize(deleteReqBodySignatureField, r.sig) return size } @@ -286,7 +299,7 @@ func (r *GetRequestBody) StableMarshal(buf []byte) ([]byte, error) { buf = make([]byte, r.StableSize()) } - _, err := proto.NestedStructureMarshal(getReqBodyIDField, buf, r.cid) + _, err := protoutil.NestedStructureMarshal(getReqBodyIDField, buf, r.cid) if err != nil { return nil, err } @@ -299,7 +312,7 @@ func (r *GetRequestBody) StableSize() (size int) { return 0 } - size += proto.NestedStructureSize(getReqBodyIDField, r.cid) + size += protoutil.NestedStructureSize(getReqBodyIDField, r.cid) return size } @@ -313,7 +326,7 @@ func (r *GetResponseBody) StableMarshal(buf []byte) ([]byte, error) { buf = make([]byte, r.StableSize()) } - _, err := proto.NestedStructureMarshal(getRespBodyContainerField, buf, r.cnr) + _, err := protoutil.NestedStructureMarshal(getRespBodyContainerField, buf, r.cnr) if err != nil { return nil, err } @@ -326,7 +339,7 @@ func (r *GetResponseBody) StableSize() (size int) { return 0 } - size += proto.NestedStructureSize(getRespBodyContainerField, r.cnr) + size += protoutil.NestedStructureSize(getRespBodyContainerField, r.cnr) return size } @@ -340,7 +353,7 @@ func (r *ListRequestBody) StableMarshal(buf []byte) ([]byte, error) { buf = make([]byte, r.StableSize()) } - _, err := proto.NestedStructureMarshal(listReqBodyOwnerField, buf, r.ownerID) + _, err := protoutil.NestedStructureMarshal(listReqBodyOwnerField, buf, r.ownerID) if err != nil { return nil, err } @@ -353,7 +366,7 @@ func (r *ListRequestBody) StableSize() (size int) { return 0 } - size += proto.NestedStructureSize(listReqBodyOwnerField, r.ownerID) + size += protoutil.NestedStructureSize(listReqBodyOwnerField, r.ownerID) return size } @@ -373,7 +386,7 @@ func (r *ListResponseBody) StableMarshal(buf []byte) ([]byte, error) { ) for i := range r.cidList { - n, err = proto.NestedStructureMarshal(listRespBodyIDsField, buf[offset:], r.cidList[i]) + n, err = protoutil.NestedStructureMarshal(listRespBodyIDsField, buf[offset:], r.cidList[i]) if err != nil { return nil, err } @@ -390,7 +403,7 @@ func (r *ListResponseBody) StableSize() (size int) { } for i := range r.cidList { - size += proto.NestedStructureSize(listRespBodyIDsField, r.cidList[i]) + size += protoutil.NestedStructureSize(listRespBodyIDsField, r.cidList[i]) } return size @@ -410,14 +423,14 @@ func (r *SetExtendedACLRequestBody) StableMarshal(buf []byte) ([]byte, error) { err error ) - n, err = proto.NestedStructureMarshal(setEACLReqBodyTableField, buf[offset:], r.eacl) + n, err = protoutil.NestedStructureMarshal(setEACLReqBodyTableField, buf[offset:], r.eacl) if err != nil { return nil, err } offset += n - _, err = proto.NestedStructureMarshal(setEACLReqBodySignatureField, buf[offset:], r.sig) + _, err = protoutil.NestedStructureMarshal(setEACLReqBodySignatureField, buf[offset:], r.sig) if err != nil { return nil, err } @@ -430,8 +443,8 @@ func (r *SetExtendedACLRequestBody) StableSize() (size int) { return 0 } - size += proto.NestedStructureSize(setEACLReqBodyTableField, r.eacl) - size += proto.NestedStructureSize(setEACLReqBodySignatureField, r.sig) + size += protoutil.NestedStructureSize(setEACLReqBodyTableField, r.eacl) + size += protoutil.NestedStructureSize(setEACLReqBodySignatureField, r.sig) return size } @@ -453,7 +466,7 @@ func (r *GetExtendedACLRequestBody) StableMarshal(buf []byte) ([]byte, error) { buf = make([]byte, r.StableSize()) } - _, err := proto.NestedStructureMarshal(getEACLReqBodyIDField, buf, r.cid) + _, err := protoutil.NestedStructureMarshal(getEACLReqBodyIDField, buf, r.cid) if err != nil { return nil, err } @@ -466,7 +479,7 @@ func (r *GetExtendedACLRequestBody) StableSize() (size int) { return 0 } - size += proto.NestedStructureSize(getEACLReqBodyIDField, r.cid) + size += protoutil.NestedStructureSize(getEACLReqBodyIDField, r.cid) return size } @@ -485,14 +498,14 @@ func (r *GetExtendedACLResponseBody) StableMarshal(buf []byte) ([]byte, error) { err error ) - n, err = proto.NestedStructureMarshal(getEACLRespBodyTableField, buf[offset:], r.eacl) + n, err = protoutil.NestedStructureMarshal(getEACLRespBodyTableField, buf[offset:], r.eacl) if err != nil { return nil, err } offset += n - _, err = proto.NestedStructureMarshal(getEACLRespBodySignatureField, buf[offset:], r.sig) + _, err = protoutil.NestedStructureMarshal(getEACLRespBodySignatureField, buf[offset:], r.sig) if err != nil { return nil, err } @@ -505,8 +518,8 @@ func (r *GetExtendedACLResponseBody) StableSize() (size int) { return 0 } - size += proto.NestedStructureSize(getEACLRespBodyTableField, r.eacl) - size += proto.NestedStructureSize(getEACLRespBodySignatureField, r.sig) + size += protoutil.NestedStructureSize(getEACLRespBodyTableField, r.eacl) + size += protoutil.NestedStructureSize(getEACLRespBodySignatureField, r.sig) return size } diff --git a/v2/container/marshal_test.go b/v2/container/marshal_test.go index 6bbab9c..a46d11f 100644 --- a/v2/container/marshal_test.go +++ b/v2/container/marshal_test.go @@ -14,16 +14,14 @@ import ( func TestAttribute_StableMarshal(t *testing.T) { attributeFrom := generateAttribute("key", "value") - transport := new(grpc.Container_Attribute) t.Run("non empty", func(t *testing.T) { wire, err := attributeFrom.StableMarshal(nil) require.NoError(t, err) - err = goproto.Unmarshal(wire, transport) - require.NoError(t, err) + attributeTo := new(container.Attribute) + require.NoError(t, attributeTo.Unmarshal(wire)) - attributeTo := container.AttributeFromGRPCMessage(transport) require.Equal(t, attributeFrom, attributeTo) }) } From a684da61186b09fa5e5aa05064d3a26da302ebf2 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 13 Nov 2020 15:21:34 +0300 Subject: [PATCH 0538/1196] [#168] container: Implement binary/JSON encoders/decoders on Container Signed-off-by: Leonard Lyubich --- pkg/container/container.go | 32 +++++++++++++++++++++ pkg/container/container_test.go | 26 +++++++++++++++++ v2/container/json.go | 50 +++++++++++++-------------------- v2/container/json_test.go | 22 ++++----------- v2/container/marshal.go | 11 ++++++++ v2/container/marshal_test.go | 6 ++-- 6 files changed, 97 insertions(+), 50 deletions(-) diff --git a/pkg/container/container.go b/pkg/container/container.go index 3d64633..44efd9e 100644 --- a/pkg/container/container.go +++ b/pkg/container/container.go @@ -111,3 +111,35 @@ func (c *Container) PlacementPolicy() *netmap.PlacementPolicy { func (c *Container) SetPlacementPolicy(v *netmap.PlacementPolicy) { c.v2.SetPlacementPolicy(v.ToV2()) } + +// Marshal marshals Container into a protobuf binary form. +// +// Buffer is allocated when the argument is empty. +// Otherwise, the first buffer is used. +func (c *Container) Marshal(b ...[]byte) ([]byte, error) { + var buf []byte + if len(b) > 0 { + buf = b[0] + } + + return c.v2. + StableMarshal(buf) +} + +// Unmarshal unmarshals protobuf binary representation of Container. +func (c *Container) Unmarshal(data []byte) error { + return c.v2. + Unmarshal(data) +} + +// MarshalJSON encodes Container to protobuf JSON format. +func (c *Container) MarshalJSON() ([]byte, error) { + return c.v2. + MarshalJSON() +} + +// UnmarshalJSON decodes Container from protobuf JSON format. +func (c *Container) UnmarshalJSON(data []byte) error { + return c.v2. + UnmarshalJSON(data) +} diff --git a/pkg/container/container_test.go b/pkg/container/container_test.go index ec5e273..391b983 100644 --- a/pkg/container/container_test.go +++ b/pkg/container/container_test.go @@ -66,3 +66,29 @@ func generatePlacementPolicy() *netmap.PlacementPolicy { return p } + +func TestContainerEncoding(t *testing.T) { + c := container.New( + container.WithAttribute("key", "value"), + ) + + t.Run("binary", func(t *testing.T) { + data, err := c.Marshal() + require.NoError(t, err) + + c2 := container.New() + require.NoError(t, c2.Unmarshal(data)) + + require.Equal(t, c, c2) + }) + + t.Run("json", func(t *testing.T) { + data, err := c.MarshalJSON() + require.NoError(t, err) + + c2 := container.New() + require.NoError(t, c2.UnmarshalJSON(data)) + + require.Equal(t, c, c2) + }) +} diff --git a/v2/container/json.go b/v2/container/json.go index 0cf7c63..7ce52da 100644 --- a/v2/container/json.go +++ b/v2/container/json.go @@ -1,40 +1,10 @@ package container import ( - "errors" - container "github.com/nspcc-dev/neofs-api-go/v2/container/grpc" "google.golang.org/protobuf/encoding/protojson" ) -var ( - errEmptyInput = errors.New("empty input") -) - -func ContainerToJSON(c *Container) ([]byte, error) { - if c == nil { - return nil, errEmptyInput - } - - msg := ContainerToGRPCMessage(c) - - return protojson.MarshalOptions{EmitUnpopulated: true}.Marshal(msg) -} - -func ContainerFromJSON(data []byte) (*Container, error) { - if len(data) == 0 { - return nil, errEmptyInput - } - - msg := new(container.Container) - - if err := protojson.Unmarshal(data, msg); err != nil { - return nil, err - } - - return ContainerFromGRPCMessage(msg), nil -} - func (a *Attribute) MarshalJSON() ([]byte, error) { return protojson.MarshalOptions{ EmitUnpopulated: true, @@ -54,3 +24,23 @@ func (a *Attribute) UnmarshalJSON(data []byte) error { return nil } + +func (c *Container) MarshalJSON() ([]byte, error) { + return protojson.MarshalOptions{ + EmitUnpopulated: true, + }.Marshal( + ContainerToGRPCMessage(c), + ) +} + +func (c *Container) UnmarshalJSON(data []byte) error { + msg := new(container.Container) + + if err := protojson.Unmarshal(data, msg); err != nil { + return err + } + + *c = *ContainerFromGRPCMessage(msg) + + return nil +} diff --git a/v2/container/json_test.go b/v2/container/json_test.go index d25b09d..40228a2 100644 --- a/v2/container/json_test.go +++ b/v2/container/json_test.go @@ -8,25 +8,15 @@ import ( ) func TestContainerJSON(t *testing.T) { - exp := generateContainer("container") + c := generateContainer("nonce") - t.Run("non empty", func(t *testing.T) { - data, err := container.ContainerToJSON(exp) - require.NoError(t, err) + data, err := c.MarshalJSON() + require.NoError(t, err) - got, err := container.ContainerFromJSON(data) - require.NoError(t, err) + c2 := new(container.Container) + require.NoError(t, c2.UnmarshalJSON(data)) - require.Equal(t, exp, got) - }) - - t.Run("empty", func(t *testing.T) { - _, err := container.ContainerToJSON(nil) - require.Error(t, err) - - _, err = container.ContainerFromJSON(nil) - require.Error(t, err) - }) + require.Equal(t, c, c2) } func TestAttributeJSON(t *testing.T) { diff --git a/v2/container/marshal.go b/v2/container/marshal.go index c89597d..8486b02 100644 --- a/v2/container/marshal.go +++ b/v2/container/marshal.go @@ -171,6 +171,17 @@ func (c *Container) StableSize() (size int) { return size } +func (c *Container) Unmarshal(data []byte) error { + m := new(container.Container) + if err := proto.Unmarshal(data, m); err != nil { + return err + } + + *c = *ContainerFromGRPCMessage(m) + + return nil +} + func (r *PutRequestBody) StableMarshal(buf []byte) ([]byte, error) { if r == nil { return []byte{}, nil diff --git a/v2/container/marshal_test.go b/v2/container/marshal_test.go index a46d11f..d2c25e5 100644 --- a/v2/container/marshal_test.go +++ b/v2/container/marshal_test.go @@ -28,16 +28,14 @@ func TestAttribute_StableMarshal(t *testing.T) { func TestContainer_StableMarshal(t *testing.T) { cnrFrom := generateContainer("nonce") - transport := new(grpc.Container) t.Run("non empty", func(t *testing.T) { wire, err := cnrFrom.StableMarshal(nil) require.NoError(t, err) - err = goproto.Unmarshal(wire, transport) - require.NoError(t, err) + cnrTo := new(container.Container) + require.NoError(t, cnrTo.Unmarshal(wire)) - cnrTo := container.ContainerFromGRPCMessage(transport) require.Equal(t, cnrFrom, cnrTo) }) } From ce0d70fa029f38f00bae2a0775a04107851d1f4c Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 13 Nov 2020 15:26:23 +0300 Subject: [PATCH 0539/1196] [#168] object: Implement binary/JSON encoders/decoders on ShortHeader Signed-off-by: Leonard Lyubich --- v2/object/json.go | 26 ++++++++++++++++++++++++++ v2/object/json_test.go | 20 ++++++++++++++++++++ v2/object/marshal.go | 11 +++++++++++ v2/object/marshal_test.go | 6 ++---- 4 files changed, 59 insertions(+), 4 deletions(-) create mode 100644 v2/object/json.go create mode 100644 v2/object/json_test.go diff --git a/v2/object/json.go b/v2/object/json.go new file mode 100644 index 0000000..8038523 --- /dev/null +++ b/v2/object/json.go @@ -0,0 +1,26 @@ +package object + +import ( + object "github.com/nspcc-dev/neofs-api-go/v2/object/grpc" + "google.golang.org/protobuf/encoding/protojson" +) + +func (h *ShortHeader) MarshalJSON() ([]byte, error) { + return protojson.MarshalOptions{ + EmitUnpopulated: true, + }.Marshal( + ShortHeaderToGRPCMessage(h), + ) +} + +func (h *ShortHeader) UnmarshalJSON(data []byte) error { + msg := new(object.ShortHeader) + + if err := protojson.Unmarshal(data, msg); err != nil { + return err + } + + *h = *ShortHeaderFromGRPCMessage(msg) + + return nil +} diff --git a/v2/object/json_test.go b/v2/object/json_test.go new file mode 100644 index 0000000..51d0aee --- /dev/null +++ b/v2/object/json_test.go @@ -0,0 +1,20 @@ +package object_test + +import ( + "testing" + + "github.com/nspcc-dev/neofs-api-go/v2/object" + "github.com/stretchr/testify/require" +) + +func TestShortHeaderJSON(t *testing.T) { + h := generateShortHeader("id") + + data, err := h.MarshalJSON() + require.NoError(t, err) + + h2 := new(object.ShortHeader) + require.NoError(t, h2.UnmarshalJSON(data)) + + require.Equal(t, h, h2) +} diff --git a/v2/object/marshal.go b/v2/object/marshal.go index 43d4749..5e080c9 100644 --- a/v2/object/marshal.go +++ b/v2/object/marshal.go @@ -162,6 +162,17 @@ func (h *ShortHeader) StableSize() (size int) { return size } +func (h *ShortHeader) Unmarshal(data []byte) error { + m := new(object.ShortHeader) + if err := goproto.Unmarshal(data, m); err != nil { + return err + } + + *h = *ShortHeaderFromGRPCMessage(m) + + return nil +} + func (a *Attribute) StableMarshal(buf []byte) ([]byte, error) { if a == nil { return []byte{}, nil diff --git a/v2/object/marshal_test.go b/v2/object/marshal_test.go index 616c3c1..505c6b1 100644 --- a/v2/object/marshal_test.go +++ b/v2/object/marshal_test.go @@ -15,16 +15,14 @@ import ( func TestShortHeader_StableMarshal(t *testing.T) { hdrFrom := generateShortHeader("Owner ID") - transport := new(grpc.ShortHeader) t.Run("non empty", func(t *testing.T) { wire, err := hdrFrom.StableMarshal(nil) require.NoError(t, err) - err = goproto.Unmarshal(wire, transport) - require.NoError(t, err) + hdrTo := new(object.ShortHeader) + require.NoError(t, hdrTo.Unmarshal(wire)) - hdrTo := object.ShortHeaderFromGRPCMessage(transport) require.Equal(t, hdrFrom, hdrTo) }) } From 0caff85fb7684ff5aceccef57a28be5df63a5112 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 13 Nov 2020 15:31:15 +0300 Subject: [PATCH 0540/1196] [#168] object: Implement binary/JSON encoders/decoders on Attribute Signed-off-by: Leonard Lyubich --- pkg/object/attribute.go | 32 ++++++++++++++++++++++++++++++++ pkg/object/attribute_test.go | 26 ++++++++++++++++++++++++++ v2/object/json.go | 20 ++++++++++++++++++++ v2/object/json_test.go | 12 ++++++++++++ v2/object/marshal.go | 11 +++++++++++ v2/object/marshal_test.go | 6 ++---- 6 files changed, 103 insertions(+), 4 deletions(-) diff --git a/pkg/object/attribute.go b/pkg/object/attribute.go index 0b43bcc..6af3d21 100644 --- a/pkg/object/attribute.go +++ b/pkg/object/attribute.go @@ -43,3 +43,35 @@ func (a *Attribute) SetValue(v string) { func (a *Attribute) ToV2() *object.Attribute { return (*object.Attribute)(a) } + +// Marshal marshals Attribute into a protobuf binary form. +// +// Buffer is allocated when the argument is empty. +// Otherwise, the first buffer is used. +func (d *Attribute) Marshal(b ...[]byte) ([]byte, error) { + var buf []byte + if len(b) > 0 { + buf = b[0] + } + + return (*object.Attribute)(d). + StableMarshal(buf) +} + +// Unmarshal unmarshals protobuf binary representation of Attribute. +func (d *Attribute) Unmarshal(data []byte) error { + return (*object.Attribute)(d). + Unmarshal(data) +} + +// MarshalJSON encodes Attribute to protobuf JSON format. +func (d *Attribute) MarshalJSON() ([]byte, error) { + return (*object.Attribute)(d). + MarshalJSON() +} + +// UnmarshalJSON decodes Attribute from protobuf JSON format. +func (d *Attribute) UnmarshalJSON(data []byte) error { + return (*object.Attribute)(d). + UnmarshalJSON(data) +} diff --git a/pkg/object/attribute_test.go b/pkg/object/attribute_test.go index cc503e4..500ec2c 100644 --- a/pkg/object/attribute_test.go +++ b/pkg/object/attribute_test.go @@ -21,3 +21,29 @@ func TestAttribute(t *testing.T) { require.Equal(t, key, aV2.GetKey()) require.Equal(t, val, aV2.GetValue()) } + +func TestAttributeEncoding(t *testing.T) { + a := NewAttribute() + a.SetKey("key") + a.SetValue("value") + + t.Run("binary", func(t *testing.T) { + data, err := a.Marshal() + require.NoError(t, err) + + a2 := NewAttribute() + require.NoError(t, a2.Unmarshal(data)) + + require.Equal(t, a, a2) + }) + + t.Run("json", func(t *testing.T) { + data, err := a.MarshalJSON() + require.NoError(t, err) + + a2 := NewAttribute() + require.NoError(t, a2.UnmarshalJSON(data)) + + require.Equal(t, a, a2) + }) +} diff --git a/v2/object/json.go b/v2/object/json.go index 8038523..7a3c246 100644 --- a/v2/object/json.go +++ b/v2/object/json.go @@ -24,3 +24,23 @@ func (h *ShortHeader) UnmarshalJSON(data []byte) error { return nil } + +func (a *Attribute) MarshalJSON() ([]byte, error) { + return protojson.MarshalOptions{ + EmitUnpopulated: true, + }.Marshal( + AttributeToGRPCMessage(a), + ) +} + +func (a *Attribute) UnmarshalJSON(data []byte) error { + msg := new(object.Header_Attribute) + + if err := protojson.Unmarshal(data, msg); err != nil { + return err + } + + *a = *AttributeFromGRPCMessage(msg) + + return nil +} diff --git a/v2/object/json_test.go b/v2/object/json_test.go index 51d0aee..aa82f63 100644 --- a/v2/object/json_test.go +++ b/v2/object/json_test.go @@ -18,3 +18,15 @@ func TestShortHeaderJSON(t *testing.T) { require.Equal(t, h, h2) } + +func TestAttributeJSON(t *testing.T) { + a := generateAttribute("key", "value") + + data, err := a.MarshalJSON() + require.NoError(t, err) + + a2 := new(object.Attribute) + require.NoError(t, a2.UnmarshalJSON(data)) + + require.Equal(t, a, a2) +} diff --git a/v2/object/marshal.go b/v2/object/marshal.go index 5e080c9..657ddf1 100644 --- a/v2/object/marshal.go +++ b/v2/object/marshal.go @@ -213,6 +213,17 @@ func (a *Attribute) StableSize() (size int) { return size } +func (a *Attribute) Unmarshal(data []byte) error { + m := new(object.Header_Attribute) + if err := goproto.Unmarshal(data, m); err != nil { + return err + } + + *a = *AttributeFromGRPCMessage(m) + + return nil +} + func (h *SplitHeader) StableMarshal(buf []byte) ([]byte, error) { if h == nil { return []byte{}, nil diff --git a/v2/object/marshal_test.go b/v2/object/marshal_test.go index 505c6b1..f73766e 100644 --- a/v2/object/marshal_test.go +++ b/v2/object/marshal_test.go @@ -29,16 +29,14 @@ func TestShortHeader_StableMarshal(t *testing.T) { func TestAttribute_StableMarshal(t *testing.T) { from := generateAttribute("Key", "Value") - transport := new(grpc.Header_Attribute) t.Run("non empty", func(t *testing.T) { wire, err := from.StableMarshal(nil) require.NoError(t, err) - err = goproto.Unmarshal(wire, transport) - require.NoError(t, err) + to := new(object.Attribute) + require.NoError(t, to.Unmarshal(wire)) - to := object.AttributeFromGRPCMessage(transport) require.Equal(t, from, to) }) } From 78374caa4137817bee9bf71562984f8f456540d3 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 13 Nov 2020 15:34:13 +0300 Subject: [PATCH 0541/1196] [#168] object: Implement binary/JSON encoders/decoders on SplitHeader Signed-off-by: Leonard Lyubich --- v2/object/json.go | 20 ++++++++++++++++++++ v2/object/json_test.go | 12 ++++++++++++ v2/object/marshal.go | 11 +++++++++++ v2/object/marshal_test.go | 7 ++----- 4 files changed, 45 insertions(+), 5 deletions(-) diff --git a/v2/object/json.go b/v2/object/json.go index 7a3c246..fe0a848 100644 --- a/v2/object/json.go +++ b/v2/object/json.go @@ -44,3 +44,23 @@ func (a *Attribute) UnmarshalJSON(data []byte) error { return nil } + +func (h *SplitHeader) MarshalJSON() ([]byte, error) { + return protojson.MarshalOptions{ + EmitUnpopulated: true, + }.Marshal( + SplitHeaderToGRPCMessage(h), + ) +} + +func (h *SplitHeader) UnmarshalJSON(data []byte) error { + msg := new(object.Header_Split) + + if err := protojson.Unmarshal(data, msg); err != nil { + return err + } + + *h = *SplitHeaderFromGRPCMessage(msg) + + return nil +} diff --git a/v2/object/json_test.go b/v2/object/json_test.go index aa82f63..0c63b1b 100644 --- a/v2/object/json_test.go +++ b/v2/object/json_test.go @@ -30,3 +30,15 @@ func TestAttributeJSON(t *testing.T) { require.Equal(t, a, a2) } + +func TestSplitHeaderJSON(t *testing.T) { + h := generateSplit("sig") + + data, err := h.MarshalJSON() + require.NoError(t, err) + + h2 := new(object.SplitHeader) + require.NoError(t, h2.UnmarshalJSON(data)) + + require.Equal(t, h, h2) +} diff --git a/v2/object/marshal.go b/v2/object/marshal.go index 657ddf1..8b15beb 100644 --- a/v2/object/marshal.go +++ b/v2/object/marshal.go @@ -295,6 +295,17 @@ func (h *SplitHeader) StableSize() (size int) { return size } +func (h *SplitHeader) Unmarshal(data []byte) error { + m := new(object.Header_Split) + if err := goproto.Unmarshal(data, m); err != nil { + return err + } + + *h = *SplitHeaderFromGRPCMessage(m) + + return nil +} + func (h *Header) StableMarshal(buf []byte) ([]byte, error) { if h == nil { return []byte{}, nil diff --git a/v2/object/marshal_test.go b/v2/object/marshal_test.go index f73766e..aac122a 100644 --- a/v2/object/marshal_test.go +++ b/v2/object/marshal_test.go @@ -46,16 +46,13 @@ func TestSplitHeader_StableMarshal(t *testing.T) { hdr := generateHeader(123) from.SetParentHeader(hdr) - transport := new(grpc.Header_Split) - t.Run("non empty", func(t *testing.T) { wire, err := from.StableMarshal(nil) require.NoError(t, err) - err = goproto.Unmarshal(wire, transport) - require.NoError(t, err) + to := new(object.SplitHeader) + require.NoError(t, to.Unmarshal(wire)) - to := object.SplitHeaderFromGRPCMessage(transport) require.Equal(t, from, to) }) } From b8f86f1a606a252e0f9bdbf98e26a38bffd93559 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 13 Nov 2020 15:38:55 +0300 Subject: [PATCH 0542/1196] [#168] object: Implement binary/JSON encoders/decoders on Header Signed-off-by: Leonard Lyubich --- v2/object/json.go | 20 ++++++++++++++++++++ v2/object/json_test.go | 12 ++++++++++++ v2/object/marshal.go | 11 +++++++++++ v2/object/marshal_test.go | 7 ++----- 4 files changed, 45 insertions(+), 5 deletions(-) diff --git a/v2/object/json.go b/v2/object/json.go index fe0a848..19c0018 100644 --- a/v2/object/json.go +++ b/v2/object/json.go @@ -64,3 +64,23 @@ func (h *SplitHeader) UnmarshalJSON(data []byte) error { return nil } + +func (h *Header) MarshalJSON() ([]byte, error) { + return protojson.MarshalOptions{ + EmitUnpopulated: true, + }.Marshal( + HeaderToGRPCMessage(h), + ) +} + +func (h *Header) UnmarshalJSON(data []byte) error { + msg := new(object.Header) + + if err := protojson.Unmarshal(data, msg); err != nil { + return err + } + + *h = *HeaderFromGRPCMessage(msg) + + return nil +} diff --git a/v2/object/json_test.go b/v2/object/json_test.go index 0c63b1b..917dc7a 100644 --- a/v2/object/json_test.go +++ b/v2/object/json_test.go @@ -42,3 +42,15 @@ func TestSplitHeaderJSON(t *testing.T) { require.Equal(t, h, h2) } + +func TestHeaderJSON(t *testing.T) { + h := generateHeader(10) + + data, err := h.MarshalJSON() + require.NoError(t, err) + + h2 := new(object.Header) + require.NoError(t, h2.UnmarshalJSON(data)) + + require.Equal(t, h, h2) +} diff --git a/v2/object/marshal.go b/v2/object/marshal.go index 8b15beb..9a5eec2 100644 --- a/v2/object/marshal.go +++ b/v2/object/marshal.go @@ -422,6 +422,17 @@ func (h *Header) StableSize() (size int) { return size } +func (h *Header) Unmarshal(data []byte) error { + m := new(object.Header) + if err := goproto.Unmarshal(data, m); err != nil { + return err + } + + *h = *HeaderFromGRPCMessage(m) + + return nil +} + func (h *HeaderWithSignature) StableMarshal(buf []byte) ([]byte, error) { if h == nil { return []byte{}, nil diff --git a/v2/object/marshal_test.go b/v2/object/marshal_test.go index aac122a..62f7d09 100644 --- a/v2/object/marshal_test.go +++ b/v2/object/marshal_test.go @@ -65,16 +65,13 @@ func TestHeader_StableMarshal(t *testing.T) { from := generateHeader(500) from.SetSplit(split) - transport := new(grpc.Header) - t.Run("non empty", func(t *testing.T) { wire, err := from.StableMarshal(nil) require.NoError(t, err) - err = goproto.Unmarshal(wire, transport) - require.NoError(t, err) + to := new(object.Header) + require.NoError(t, to.Unmarshal(wire)) - to := object.HeaderFromGRPCMessage(transport) require.Equal(t, from, to) }) } From 9cdd14841a59f05c02eb373224f563a2dde7e3bf Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 13 Nov 2020 15:43:02 +0300 Subject: [PATCH 0543/1196] [#168] object: Implement binary/JSON encoders/decoders on HeaderWithSig Signed-off-by: Leonard Lyubich --- v2/object/json.go | 20 ++++++++++++++++++++ v2/object/json_test.go | 12 ++++++++++++ v2/object/marshal.go | 11 +++++++++++ v2/object/marshal_test.go | 28 +++++++++++++++++++++++----- 4 files changed, 66 insertions(+), 5 deletions(-) diff --git a/v2/object/json.go b/v2/object/json.go index 19c0018..3cf3584 100644 --- a/v2/object/json.go +++ b/v2/object/json.go @@ -84,3 +84,23 @@ func (h *Header) UnmarshalJSON(data []byte) error { return nil } + +func (h *HeaderWithSignature) MarshalJSON() ([]byte, error) { + return protojson.MarshalOptions{ + EmitUnpopulated: true, + }.Marshal( + HeaderWithSignatureToGRPCMessage(h), + ) +} + +func (h *HeaderWithSignature) UnmarshalJSON(data []byte) error { + msg := new(object.HeaderWithSignature) + + if err := protojson.Unmarshal(data, msg); err != nil { + return err + } + + *h = *HeaderWithSignatureFromGRPCMessage(msg) + + return nil +} diff --git a/v2/object/json_test.go b/v2/object/json_test.go index 917dc7a..87d05c9 100644 --- a/v2/object/json_test.go +++ b/v2/object/json_test.go @@ -54,3 +54,15 @@ func TestHeaderJSON(t *testing.T) { require.Equal(t, h, h2) } + +func TestHeaderWithSignatureJSON(t *testing.T) { + h := generateHeaderWithSignature() + + data, err := h.MarshalJSON() + require.NoError(t, err) + + h2 := new(object.HeaderWithSignature) + require.NoError(t, h2.UnmarshalJSON(data)) + + require.Equal(t, h, h2) +} diff --git a/v2/object/marshal.go b/v2/object/marshal.go index 9a5eec2..0728cb6 100644 --- a/v2/object/marshal.go +++ b/v2/object/marshal.go @@ -475,6 +475,17 @@ func (h *HeaderWithSignature) StableSize() (size int) { return size } +func (h *HeaderWithSignature) Unmarshal(data []byte) error { + m := new(object.HeaderWithSignature) + if err := goproto.Unmarshal(data, m); err != nil { + return err + } + + *h = *HeaderWithSignatureFromGRPCMessage(m) + + return nil +} + func (o *Object) StableMarshal(buf []byte) ([]byte, error) { if o == nil { return []byte{}, nil diff --git a/v2/object/marshal_test.go b/v2/object/marshal_test.go index 62f7d09..dbaf2f3 100644 --- a/v2/object/marshal_test.go +++ b/v2/object/marshal_test.go @@ -352,6 +352,20 @@ func TestGetRangeHashResponseBody_StableMarshal(t *testing.T) { }) } +func TestHeaderWithSignature_StableMarshal(t *testing.T) { + from := generateHeaderWithSignature() + + t.Run("non empty", func(t *testing.T) { + wire, err := from.StableMarshal(nil) + require.NoError(t, err) + + to := new(object.HeaderWithSignature) + require.NoError(t, to.Unmarshal(wire)) + + require.Equal(t, from, to) + }) +} + func generateOwner(id string) *refs.OwnerID { owner := new(refs.OwnerID) owner.SetValue([]byte(id)) @@ -582,12 +596,8 @@ func generateHeadResponseBody(flag bool) *object.HeadResponseBody { short.SetShortHeader(generateShortHeader("short id")) part = short } else { - hdrWithSig := new(object.HeaderWithSignature) - hdrWithSig.SetHeader(generateHeader(30)) - hdrWithSig.SetSignature(generateSignature("sig", "key")) - full := new(object.GetHeaderPartFull) - full.SetHeaderWithSignature(hdrWithSig) + full.SetHeaderWithSignature(generateHeaderWithSignature()) part = full } @@ -596,6 +606,14 @@ func generateHeadResponseBody(flag bool) *object.HeadResponseBody { return req } +func generateHeaderWithSignature() *object.HeaderWithSignature { + hdrWithSig := new(object.HeaderWithSignature) + hdrWithSig.SetHeader(generateHeader(30)) + hdrWithSig.SetSignature(generateSignature("sig", "key")) + + return hdrWithSig +} + func generateFilter(k, v string) *object.SearchFilter { f := new(object.SearchFilter) f.SetKey(k) From 9325e22871a4c996890c8f3d805e3aab73a5dc79 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 13 Nov 2020 15:51:27 +0300 Subject: [PATCH 0544/1196] [#168] object: Implement binary/JSON encoders/decoders on Object Signed-off-by: Leonard Lyubich --- pkg/object/object.go | 11 ----------- pkg/object/raw_test.go | 25 +++++++++++++++++++++++++ pkg/object/rw.go | 32 ++++++++++++++++++++++++++++++++ v2/object/json.go | 20 ++++++++++++++++++++ v2/object/json_test.go | 12 ++++++++++++ v2/object/marshal.go | 11 +++++++++++ v2/object/marshal_test.go | 6 ++---- 7 files changed, 102 insertions(+), 15 deletions(-) diff --git a/pkg/object/object.go b/pkg/object/object.go index 9de49a7..e447be5 100644 --- a/pkg/object/object.go +++ b/pkg/object/object.go @@ -37,14 +37,3 @@ func (o *Object) ToV2() *object.Object { return nil } - -// FromBytes restores Object instance from a binary representation. -func FromBytes(data []byte) (*Object, error) { - oV2 := new(object.Object) - - if err := oV2.StableUnmarshal(data); err != nil { - return nil, err - } - - return NewFromV2(oV2), nil -} diff --git a/pkg/object/raw_test.go b/pkg/object/raw_test.go index 2e39322..344bd28 100644 --- a/pkg/object/raw_test.go +++ b/pkg/object/raw_test.go @@ -287,3 +287,28 @@ func TestRwObject_HasParent(t *testing.T) { require.False(t, obj.HasParent()) } + +func TestRWObjectEncoding(t *testing.T) { + o := NewRaw() + o.SetID(randID(t)) + + t.Run("binary", func(t *testing.T) { + data, err := o.Marshal() + require.NoError(t, err) + + o2 := NewRaw() + require.NoError(t, o2.Unmarshal(data)) + + require.Equal(t, o, o2) + }) + + t.Run("json", func(t *testing.T) { + data, err := o.MarshalJSON() + require.NoError(t, err) + + o2 := NewRaw() + require.NoError(t, o2.UnmarshalJSON(data)) + + require.Equal(t, o, o2) + }) +} diff --git a/pkg/object/rw.go b/pkg/object/rw.go index 0aab2c7..8d0380c 100644 --- a/pkg/object/rw.go +++ b/pkg/object/rw.go @@ -352,3 +352,35 @@ func (o *rwObject) HasParent() bool { GetHeader(). GetSplit() != nil } + +// Marshal marshals object into a protobuf binary form. +// +// Buffer is allocated when the argument is empty. +// Otherwise, the first buffer is used. +func (o *rwObject) Marshal(b ...[]byte) ([]byte, error) { + var buf []byte + if len(b) > 0 { + buf = b[0] + } + + return (*object.Object)(o). + StableMarshal(buf) +} + +// Unmarshal unmarshals protobuf binary representation of object. +func (o *rwObject) Unmarshal(data []byte) error { + return (*object.Object)(o). + Unmarshal(data) +} + +// MarshalJSON encodes object to protobuf JSON format. +func (o *rwObject) MarshalJSON() ([]byte, error) { + return (*object.Object)(o). + MarshalJSON() +} + +// UnmarshalJSON decodes object from protobuf JSON format. +func (o *rwObject) UnmarshalJSON(data []byte) error { + return (*object.Object)(o). + UnmarshalJSON(data) +} diff --git a/v2/object/json.go b/v2/object/json.go index 3cf3584..940aa7c 100644 --- a/v2/object/json.go +++ b/v2/object/json.go @@ -104,3 +104,23 @@ func (h *HeaderWithSignature) UnmarshalJSON(data []byte) error { return nil } + +func (o *Object) MarshalJSON() ([]byte, error) { + return protojson.MarshalOptions{ + EmitUnpopulated: true, + }.Marshal( + ObjectToGRPCMessage(o), + ) +} + +func (o *Object) UnmarshalJSON(data []byte) error { + msg := new(object.Object) + + if err := protojson.Unmarshal(data, msg); err != nil { + return err + } + + *o = *ObjectFromGRPCMessage(msg) + + return nil +} diff --git a/v2/object/json_test.go b/v2/object/json_test.go index 87d05c9..ceefd96 100644 --- a/v2/object/json_test.go +++ b/v2/object/json_test.go @@ -66,3 +66,15 @@ func TestHeaderWithSignatureJSON(t *testing.T) { require.Equal(t, h, h2) } + +func TestObjectJSON(t *testing.T) { + o := generateObject("data") + + data, err := o.MarshalJSON() + require.NoError(t, err) + + o2 := new(object.Object) + require.NoError(t, o2.UnmarshalJSON(data)) + + require.Equal(t, o, o2) +} diff --git a/v2/object/marshal.go b/v2/object/marshal.go index 0728cb6..b59419e 100644 --- a/v2/object/marshal.go +++ b/v2/object/marshal.go @@ -557,6 +557,17 @@ func (o *Object) StableUnmarshal(data []byte) error { return nil } +func (o *Object) Unmarshal(data []byte) error { + m := new(object.Object) + if err := goproto.Unmarshal(data, m); err != nil { + return err + } + + *o = *ObjectFromGRPCMessage(m) + + return nil +} + func (r *GetRequestBody) StableMarshal(buf []byte) ([]byte, error) { if r == nil { return []byte{}, nil diff --git a/v2/object/marshal_test.go b/v2/object/marshal_test.go index dbaf2f3..efd5df3 100644 --- a/v2/object/marshal_test.go +++ b/v2/object/marshal_test.go @@ -78,16 +78,14 @@ func TestHeader_StableMarshal(t *testing.T) { func TestObject_StableMarshal(t *testing.T) { from := generateObject("Payload") - transport := new(grpc.Object) t.Run("non empty", func(t *testing.T) { wire, err := from.StableMarshal(nil) require.NoError(t, err) - err = goproto.Unmarshal(wire, transport) - require.NoError(t, err) + to := new(object.Object) + require.NoError(t, to.Unmarshal(wire)) - to := object.ObjectFromGRPCMessage(transport) require.Equal(t, from, to) }) } From 4ce751f13c6ae888da59a31e8af3215fe3b2028e Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 13 Nov 2020 15:58:53 +0300 Subject: [PATCH 0545/1196] [#168] refs: Implement binary/JSON encoders/decoders on Address Signed-off-by: Leonard Lyubich --- pkg/object/address.go | 43 ++++++++++++++++++++++++++++---------- pkg/object/address_test.go | 26 +++++++++++++++++++++++ pkg/object/raw_test.go | 7 +++++++ v2/refs/json.go | 26 +++++++++++++++++++++++ v2/refs/json_test.go | 20 ++++++++++++++++++ v2/refs/marshal.go | 6 +----- v2/refs/marshal_test.go | 19 ++--------------- 7 files changed, 114 insertions(+), 33 deletions(-) create mode 100644 v2/refs/json.go create mode 100644 v2/refs/json_test.go diff --git a/pkg/object/address.go b/pkg/object/address.go index a1c2475..9f61c9f 100644 --- a/pkg/object/address.go +++ b/pkg/object/address.go @@ -6,7 +6,6 @@ import ( "github.com/nspcc-dev/neofs-api-go/internal" "github.com/nspcc-dev/neofs-api-go/pkg/container" "github.com/nspcc-dev/neofs-api-go/v2/refs" - "github.com/pkg/errors" ) // Address represents v2-compatible object address. @@ -38,16 +37,6 @@ func (a *Address) ToV2() *refs.Address { return (*refs.Address)(a) } -// AddressFromBytes restores Address from a binary representation. -func AddressFromBytes(data []byte) (*Address, error) { - addrV2 := new(refs.Address) - if err := addrV2.StableUnmarshal(data); err != nil { - return nil, errors.Wrap(err, "could not unmarshal object address") - } - - return NewAddressFromV2(addrV2), nil -} - // GetContainerID returns container identifier. func (a *Address) GetContainerID() *container.ID { return container.NewIDFromV2( @@ -102,3 +91,35 @@ func (a *Address) String() string { a.GetObjectID().String(), }, addressSeparator) } + +// Marshal marshals Address into a protobuf binary form. +// +// Buffer is allocated when the argument is empty. +// Otherwise, the first buffer is used. +func (a *Address) Marshal(b ...[]byte) ([]byte, error) { + var buf []byte + if len(b) > 0 { + buf = b[0] + } + + return (*refs.Address)(a). + StableMarshal(buf) +} + +// Unmarshal unmarshals protobuf binary representation of Address. +func (a *Address) Unmarshal(data []byte) error { + return (*refs.Address)(a). + Unmarshal(data) +} + +// MarshalJSON encodes Address to protobuf JSON format. +func (a *Address) MarshalJSON() ([]byte, error) { + return (*refs.Address)(a). + MarshalJSON() +} + +// UnmarshalJSON decodes Address from protobuf JSON format. +func (a *Address) UnmarshalJSON(data []byte) error { + return (*refs.Address)(a). + UnmarshalJSON(data) +} diff --git a/pkg/object/address_test.go b/pkg/object/address_test.go index 5b4ae1b..aa67e58 100644 --- a/pkg/object/address_test.go +++ b/pkg/object/address_test.go @@ -60,3 +60,29 @@ func TestAddress_Parse(t *testing.T) { require.EqualError(t, NewAddress().Parse(s), ErrBadID.Error()) }) } + +func TestAddressEncoding(t *testing.T) { + a := NewAddress() + a.SetObjectID(randID(t)) + a.SetContainerID(randCID(t)) + + t.Run("binary", func(t *testing.T) { + data, err := a.Marshal() + require.NoError(t, err) + + a2 := NewAddress() + require.NoError(t, a2.Unmarshal(data)) + + require.Equal(t, a, a2) + }) + + t.Run("json", func(t *testing.T) { + data, err := a.MarshalJSON() + require.NoError(t, err) + + a2 := NewAddress() + require.NoError(t, a2.UnmarshalJSON(data)) + + require.Equal(t, a, a2) + }) +} diff --git a/pkg/object/raw_test.go b/pkg/object/raw_test.go index 344bd28..1c40ea9 100644 --- a/pkg/object/raw_test.go +++ b/pkg/object/raw_test.go @@ -20,6 +20,13 @@ func randID(t *testing.T) *ID { return id } +func randCID(t *testing.T) *container.ID { + id := container.NewID() + id.SetSHA256(randSHA256Checksum(t)) + + return id +} + func randSHA256Checksum(t *testing.T) (cs [sha256.Size]byte) { _, err := rand.Read(cs[:]) require.NoError(t, err) diff --git a/v2/refs/json.go b/v2/refs/json.go new file mode 100644 index 0000000..f8c20d6 --- /dev/null +++ b/v2/refs/json.go @@ -0,0 +1,26 @@ +package refs + +import ( + refs "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" + "google.golang.org/protobuf/encoding/protojson" +) + +func (a *Address) MarshalJSON() ([]byte, error) { + return protojson.MarshalOptions{ + EmitUnpopulated: true, + }.Marshal( + AddressToGRPCMessage(a), + ) +} + +func (a *Address) UnmarshalJSON(data []byte) error { + msg := new(refs.Address) + + if err := protojson.Unmarshal(data, msg); err != nil { + return err + } + + *a = *AddressFromGRPCMessage(msg) + + return nil +} diff --git a/v2/refs/json_test.go b/v2/refs/json_test.go new file mode 100644 index 0000000..ce40de7 --- /dev/null +++ b/v2/refs/json_test.go @@ -0,0 +1,20 @@ +package refs_test + +import ( + "testing" + + "github.com/nspcc-dev/neofs-api-go/v2/refs" + "github.com/stretchr/testify/require" +) + +func TestAddressJSON(t *testing.T) { + a := generateAddress([]byte{1}, []byte{2}) + + data, err := a.MarshalJSON() + require.NoError(t, err) + + a2 := new(refs.Address) + require.NoError(t, a2.UnmarshalJSON(data)) + + require.Equal(t, a, a2) +} diff --git a/v2/refs/marshal.go b/v2/refs/marshal.go index 868b157..c39ce81 100644 --- a/v2/refs/marshal.go +++ b/v2/refs/marshal.go @@ -142,11 +142,7 @@ func (a *Address) StableSize() (size int) { return size } -func (a *Address) StableUnmarshal(data []byte) error { - if a == nil { - return nil - } - +func (a *Address) Unmarshal(data []byte) error { addrGRPC := new(refs.Address) if err := goproto.Unmarshal(data, addrGRPC); err != nil { return err diff --git a/v2/refs/marshal_test.go b/v2/refs/marshal_test.go index 4745147..3d8bfac 100644 --- a/v2/refs/marshal_test.go +++ b/v2/refs/marshal_test.go @@ -69,16 +69,13 @@ func TestAddress_StableMarshal(t *testing.T) { addressFrom := generateAddress(cid, oid) - addressTransport := new(grpc.Address) - t.Run("non empty", func(t *testing.T) { wire, err := addressFrom.StableMarshal(nil) require.NoError(t, err) - err = goproto.Unmarshal(wire, addressTransport) - require.NoError(t, err) + addressTo := new(refs.Address) + require.NoError(t, addressTo.Unmarshal(wire)) - addressTo := refs.AddressFromGRPCMessage(addressTransport) require.Equal(t, addressFrom, addressTo) }) } @@ -161,15 +158,3 @@ func generateAddress(bCid, bOid []byte) *refs.Address { return addr } - -func TestAddress_StableUnmarshal(t *testing.T) { - addr := generateAddress([]byte("container id"), []byte("object id")) - - data, err := addr.StableMarshal(nil) - require.NoError(t, err) - - addr2 := new(refs.Address) - require.NoError(t, addr2.StableUnmarshal(data)) - - require.Equal(t, addr, addr2) -} From 7289ff6c6458b41302193691646400d6f3d062e1 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 13 Nov 2020 16:04:09 +0300 Subject: [PATCH 0546/1196] [#168] refs: Implement binary/JSON encoders/decoders on ObjectID Signed-off-by: Leonard Lyubich --- pkg/object/id.go | 32 ++++++++++++++++++++++++++++++++ pkg/object/id_test.go | 24 ++++++++++++++++++++++++ v2/refs/json.go | 20 ++++++++++++++++++++ v2/refs/json_test.go | 13 +++++++++++++ v2/refs/marshal.go | 11 +++++++++++ v2/refs/marshal_test.go | 6 ++---- 6 files changed, 102 insertions(+), 4 deletions(-) diff --git a/pkg/object/id.go b/pkg/object/id.go index 1fcb595..c62451d 100644 --- a/pkg/object/id.go +++ b/pkg/object/id.go @@ -65,3 +65,35 @@ func (id *ID) Parse(s string) error { func (id *ID) String() string { return base58.Encode((*refs.ObjectID)(id).GetValue()) } + +// Marshal marshals ID into a protobuf binary form. +// +// Buffer is allocated when the argument is empty. +// Otherwise, the first buffer is used. +func (id *ID) Marshal(b ...[]byte) ([]byte, error) { + var buf []byte + if len(b) > 0 { + buf = b[0] + } + + return (*refs.ObjectID)(id). + StableMarshal(buf) +} + +// Unmarshal unmarshals protobuf binary representation of ID. +func (id *ID) Unmarshal(data []byte) error { + return (*refs.ObjectID)(id). + Unmarshal(data) +} + +// MarshalJSON encodes ID to protobuf JSON format. +func (id *ID) MarshalJSON() ([]byte, error) { + return (*refs.ObjectID)(id). + MarshalJSON() +} + +// UnmarshalJSON decodes ID from protobuf JSON format. +func (id *ID) UnmarshalJSON(data []byte) error { + return (*refs.ObjectID)(id). + UnmarshalJSON(data) +} diff --git a/pkg/object/id_test.go b/pkg/object/id_test.go index e56ff96..14ab6c6 100644 --- a/pkg/object/id_test.go +++ b/pkg/object/id_test.go @@ -83,3 +83,27 @@ func TestID_String(t *testing.T) { } }) } + +func TestObjectIDEncoding(t *testing.T) { + id := randID(t) + + t.Run("binary", func(t *testing.T) { + data, err := id.Marshal() + require.NoError(t, err) + + id2 := NewID() + require.NoError(t, id2.Unmarshal(data)) + + require.Equal(t, id, id2) + }) + + t.Run("json", func(t *testing.T) { + data, err := id.MarshalJSON() + require.NoError(t, err) + + a2 := NewID() + require.NoError(t, a2.UnmarshalJSON(data)) + + require.Equal(t, id, a2) + }) +} diff --git a/v2/refs/json.go b/v2/refs/json.go index f8c20d6..37cb6f3 100644 --- a/v2/refs/json.go +++ b/v2/refs/json.go @@ -24,3 +24,23 @@ func (a *Address) UnmarshalJSON(data []byte) error { return nil } + +func (o *ObjectID) MarshalJSON() ([]byte, error) { + return protojson.MarshalOptions{ + EmitUnpopulated: true, + }.Marshal( + ObjectIDToGRPCMessage(o), + ) +} + +func (o *ObjectID) UnmarshalJSON(data []byte) error { + msg := new(refs.ObjectID) + + if err := protojson.Unmarshal(data, msg); err != nil { + return err + } + + *o = *ObjectIDFromGRPCMessage(msg) + + return nil +} diff --git a/v2/refs/json_test.go b/v2/refs/json_test.go index ce40de7..196dc6c 100644 --- a/v2/refs/json_test.go +++ b/v2/refs/json_test.go @@ -18,3 +18,16 @@ func TestAddressJSON(t *testing.T) { require.Equal(t, a, a2) } + +func TestObjectIDJSON(t *testing.T) { + o := new(refs.ObjectID) + o.SetValue([]byte{1}) + + data, err := o.MarshalJSON() + require.NoError(t, err) + + o2 := new(refs.ObjectID) + require.NoError(t, o2.UnmarshalJSON(data)) + + require.Equal(t, o, o2) +} diff --git a/v2/refs/marshal.go b/v2/refs/marshal.go index c39ce81..e860b04 100644 --- a/v2/refs/marshal.go +++ b/v2/refs/marshal.go @@ -101,6 +101,17 @@ func (o *ObjectID) StableSize() int { return proto.BytesSize(objectIDValField, o.val) } +func (o *ObjectID) Unmarshal(data []byte) error { + m := new(refs.ObjectID) + if err := goproto.Unmarshal(data, m); err != nil { + return err + } + + *o = *ObjectIDFromGRPCMessage(m) + + return nil +} + func (a *Address) StableMarshal(buf []byte) ([]byte, error) { if a == nil { return []byte{}, nil diff --git a/v2/refs/marshal_test.go b/v2/refs/marshal_test.go index 3d8bfac..268dc28 100644 --- a/v2/refs/marshal_test.go +++ b/v2/refs/marshal_test.go @@ -47,7 +47,6 @@ func TestContainerID_StableMarshal(t *testing.T) { func TestObjectID_StableMarshal(t *testing.T) { objectIDFrom := new(refs.ObjectID) - objectIDTransport := new(grpc.ObjectID) t.Run("non empty", func(t *testing.T) { objectIDFrom.SetValue([]byte("Object ID")) @@ -55,10 +54,9 @@ func TestObjectID_StableMarshal(t *testing.T) { wire, err := objectIDFrom.StableMarshal(nil) require.NoError(t, err) - err = goproto.Unmarshal(wire, objectIDTransport) - require.NoError(t, err) + objectIDTo := new(refs.ObjectID) + require.NoError(t, objectIDTo.Unmarshal(wire)) - objectIDTo := refs.ObjectIDFromGRPCMessage(objectIDTransport) require.Equal(t, objectIDFrom, objectIDTo) }) } From c0f3ac51d464dfcade85b8492711fbd034e9518b Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 13 Nov 2020 16:07:32 +0300 Subject: [PATCH 0547/1196] [#168] refs: Implement binary/JSON encoders/decoders on ContainerID Signed-off-by: Leonard Lyubich --- pkg/container/id.go | 32 ++++++++++++++++++++++++++++++++ pkg/container/id_test.go | 25 +++++++++++++++++++++++++ v2/refs/json.go | 20 ++++++++++++++++++++ v2/refs/json_test.go | 13 +++++++++++++ v2/refs/marshal.go | 11 +++++++++++ v2/refs/marshal_test.go | 6 ++---- 6 files changed, 103 insertions(+), 4 deletions(-) diff --git a/pkg/container/id.go b/pkg/container/id.go index 2649def..659828f 100644 --- a/pkg/container/id.go +++ b/pkg/container/id.go @@ -65,3 +65,35 @@ func (id *ID) Parse(s string) error { func (id *ID) String() string { return base58.Encode((*refs.ContainerID)(id).GetValue()) } + +// Marshal marshals ID into a protobuf binary form. +// +// Buffer is allocated when the argument is empty. +// Otherwise, the first buffer is used. +func (id *ID) Marshal(b ...[]byte) ([]byte, error) { + var buf []byte + if len(b) > 0 { + buf = b[0] + } + + return (*refs.ContainerID)(id). + StableMarshal(buf) +} + +// Unmarshal unmarshals protobuf binary representation of ID. +func (id *ID) Unmarshal(data []byte) error { + return (*refs.ContainerID)(id). + Unmarshal(data) +} + +// MarshalJSON encodes ID to protobuf JSON format. +func (id *ID) MarshalJSON() ([]byte, error) { + return (*refs.ContainerID)(id). + MarshalJSON() +} + +// UnmarshalJSON decodes ID from protobuf JSON format. +func (id *ID) UnmarshalJSON(data []byte) error { + return (*refs.ContainerID)(id). + UnmarshalJSON(data) +} diff --git a/pkg/container/id_test.go b/pkg/container/id_test.go index 3942a70..3346975 100644 --- a/pkg/container/id_test.go +++ b/pkg/container/id_test.go @@ -90,3 +90,28 @@ func TestID_String(t *testing.T) { } }) } + +func TestContainerIDEncoding(t *testing.T) { + id := NewID() + id.SetSHA256(randSHA256Checksum(t)) + + t.Run("binary", func(t *testing.T) { + data, err := id.Marshal() + require.NoError(t, err) + + id2 := NewID() + require.NoError(t, id2.Unmarshal(data)) + + require.Equal(t, id, id2) + }) + + t.Run("json", func(t *testing.T) { + data, err := id.MarshalJSON() + require.NoError(t, err) + + a2 := NewID() + require.NoError(t, a2.UnmarshalJSON(data)) + + require.Equal(t, id, a2) + }) +} diff --git a/v2/refs/json.go b/v2/refs/json.go index 37cb6f3..d2fd4ed 100644 --- a/v2/refs/json.go +++ b/v2/refs/json.go @@ -44,3 +44,23 @@ func (o *ObjectID) UnmarshalJSON(data []byte) error { return nil } + +func (c *ContainerID) MarshalJSON() ([]byte, error) { + return protojson.MarshalOptions{ + EmitUnpopulated: true, + }.Marshal( + ContainerIDToGRPCMessage(c), + ) +} + +func (c *ContainerID) UnmarshalJSON(data []byte) error { + msg := new(refs.ContainerID) + + if err := protojson.Unmarshal(data, msg); err != nil { + return err + } + + *c = *ContainerIDFromGRPCMessage(msg) + + return nil +} diff --git a/v2/refs/json_test.go b/v2/refs/json_test.go index 196dc6c..b56b1d0 100644 --- a/v2/refs/json_test.go +++ b/v2/refs/json_test.go @@ -31,3 +31,16 @@ func TestObjectIDJSON(t *testing.T) { require.Equal(t, o, o2) } + +func TestContainerIDJSON(t *testing.T) { + cid := new(refs.ContainerID) + cid.SetValue([]byte{1}) + + data, err := cid.MarshalJSON() + require.NoError(t, err) + + cid2 := new(refs.ContainerID) + require.NoError(t, cid2.UnmarshalJSON(data)) + + require.Equal(t, cid, cid2) +} diff --git a/v2/refs/marshal.go b/v2/refs/marshal.go index e860b04..37b950d 100644 --- a/v2/refs/marshal.go +++ b/v2/refs/marshal.go @@ -76,6 +76,17 @@ func (c *ContainerID) StableSize() int { return proto.BytesSize(containerIDValField, c.val) } +func (c *ContainerID) Unmarshal(data []byte) error { + m := new(refs.ContainerID) + if err := goproto.Unmarshal(data, m); err != nil { + return err + } + + *c = *ContainerIDFromGRPCMessage(m) + + return nil +} + func (o *ObjectID) StableMarshal(buf []byte) ([]byte, error) { if o == nil { return []byte{}, nil diff --git a/v2/refs/marshal_test.go b/v2/refs/marshal_test.go index 268dc28..d0eb75f 100644 --- a/v2/refs/marshal_test.go +++ b/v2/refs/marshal_test.go @@ -29,7 +29,6 @@ func TestOwnerID_StableMarshal(t *testing.T) { func TestContainerID_StableMarshal(t *testing.T) { cnrFrom := new(refs.ContainerID) - cnrTransport := new(grpc.ContainerID) t.Run("non empty", func(t *testing.T) { cnrFrom.SetValue([]byte("Container ID")) @@ -37,10 +36,9 @@ func TestContainerID_StableMarshal(t *testing.T) { wire, err := cnrFrom.StableMarshal(nil) require.NoError(t, err) - err = goproto.Unmarshal(wire, cnrTransport) - require.NoError(t, err) + cnrTo := new(refs.ContainerID) + require.NoError(t, cnrTo.Unmarshal(wire)) - cnrTo := refs.ContainerIDFromGRPCMessage(cnrTransport) require.Equal(t, cnrFrom, cnrTo) }) } From 9ec57ee9f8da7e3e523d2afcde123646407650f4 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 13 Nov 2020 16:14:00 +0300 Subject: [PATCH 0548/1196] [#168] refs: Implement binary/JSON encoders/decoders on OwnerID Signed-off-by: Leonard Lyubich --- pkg/owner/id.go | 32 ++++++++++++++++++++++++++++++++ pkg/owner/id_test.go | 34 ++++++++++++++++++++++++++++++++-- v2/refs/json.go | 20 ++++++++++++++++++++ v2/refs/json_test.go | 13 +++++++++++++ v2/refs/marshal.go | 11 +++++++++++ v2/refs/marshal_test.go | 6 ++---- 6 files changed, 110 insertions(+), 6 deletions(-) diff --git a/pkg/owner/id.go b/pkg/owner/id.go index 08971e8..49acb2c 100644 --- a/pkg/owner/id.go +++ b/pkg/owner/id.go @@ -71,3 +71,35 @@ func (id *ID) Parse(s string) error { return nil } + +// Marshal marshals ID into a protobuf binary form. +// +// Buffer is allocated when the argument is empty. +// Otherwise, the first buffer is used. +func (id *ID) Marshal(b ...[]byte) ([]byte, error) { + var buf []byte + if len(b) > 0 { + buf = b[0] + } + + return (*refs.OwnerID)(id). + StableMarshal(buf) +} + +// Unmarshal unmarshals protobuf binary representation of ID. +func (id *ID) Unmarshal(data []byte) error { + return (*refs.OwnerID)(id). + Unmarshal(data) +} + +// MarshalJSON encodes ID to protobuf JSON format. +func (id *ID) MarshalJSON() ([]byte, error) { + return (*refs.OwnerID)(id). + MarshalJSON() +} + +// UnmarshalJSON decodes ID from protobuf JSON format. +func (id *ID) UnmarshalJSON(data []byte) error { + return (*refs.OwnerID)(id). + UnmarshalJSON(data) +} diff --git a/pkg/owner/id_test.go b/pkg/owner/id_test.go index a36324f..8d867df 100644 --- a/pkg/owner/id_test.go +++ b/pkg/owner/id_test.go @@ -10,7 +10,7 @@ import ( "github.com/stretchr/testify/require" ) -func TestIDV2(t *testing.T) { +func randID(t *testing.T) *ID { id := NewID() wallet := new(NEO3Wallet) @@ -20,9 +20,15 @@ func TestIDV2(t *testing.T) { id.SetNeo3Wallet(wallet) + return id +} + +func TestIDV2(t *testing.T) { + id := randID(t) + idV2 := id.ToV2() - require.Equal(t, wallet.Bytes(), idV2.GetValue()) + require.Equal(t, id, NewIDFromV2(idV2)) } func TestNewIDFromNeo3Wallet(t *testing.T) { @@ -63,3 +69,27 @@ func TestID_Parse(t *testing.T) { } }) } + +func TestIDEncoding(t *testing.T) { + id := randID(t) + + t.Run("binary", func(t *testing.T) { + data, err := id.Marshal() + require.NoError(t, err) + + id2 := NewID() + require.NoError(t, id2.Unmarshal(data)) + + require.Equal(t, id, id2) + }) + + t.Run("json", func(t *testing.T) { + data, err := id.MarshalJSON() + require.NoError(t, err) + + a2 := NewID() + require.NoError(t, a2.UnmarshalJSON(data)) + + require.Equal(t, id, a2) + }) +} diff --git a/v2/refs/json.go b/v2/refs/json.go index d2fd4ed..e552ae1 100644 --- a/v2/refs/json.go +++ b/v2/refs/json.go @@ -64,3 +64,23 @@ func (c *ContainerID) UnmarshalJSON(data []byte) error { return nil } + +func (o *OwnerID) MarshalJSON() ([]byte, error) { + return protojson.MarshalOptions{ + EmitUnpopulated: true, + }.Marshal( + OwnerIDToGRPCMessage(o), + ) +} + +func (o *OwnerID) UnmarshalJSON(data []byte) error { + msg := new(refs.OwnerID) + + if err := protojson.Unmarshal(data, msg); err != nil { + return err + } + + *o = *OwnerIDFromGRPCMessage(msg) + + return nil +} diff --git a/v2/refs/json_test.go b/v2/refs/json_test.go index b56b1d0..c5684e9 100644 --- a/v2/refs/json_test.go +++ b/v2/refs/json_test.go @@ -44,3 +44,16 @@ func TestContainerIDJSON(t *testing.T) { require.Equal(t, cid, cid2) } + +func TestOwnerIDJSON(t *testing.T) { + o := new(refs.OwnerID) + o.SetValue([]byte{1}) + + data, err := o.MarshalJSON() + require.NoError(t, err) + + o2 := new(refs.OwnerID) + require.NoError(t, o2.UnmarshalJSON(data)) + + require.Equal(t, o, o2) +} diff --git a/v2/refs/marshal.go b/v2/refs/marshal.go index 37b950d..0a2484a 100644 --- a/v2/refs/marshal.go +++ b/v2/refs/marshal.go @@ -51,6 +51,17 @@ func (o *OwnerID) StableSize() int { return proto.BytesSize(ownerIDValField, o.val) } +func (o *OwnerID) Unmarshal(data []byte) error { + m := new(refs.OwnerID) + if err := goproto.Unmarshal(data, m); err != nil { + return err + } + + *o = *OwnerIDFromGRPCMessage(m) + + return nil +} + func (c *ContainerID) StableMarshal(buf []byte) ([]byte, error) { if c == nil { return []byte{}, nil diff --git a/v2/refs/marshal_test.go b/v2/refs/marshal_test.go index d0eb75f..4c12ea2 100644 --- a/v2/refs/marshal_test.go +++ b/v2/refs/marshal_test.go @@ -11,7 +11,6 @@ import ( func TestOwnerID_StableMarshal(t *testing.T) { ownerFrom := new(refs.OwnerID) - ownerTransport := new(grpc.OwnerID) t.Run("non empty", func(t *testing.T) { ownerFrom.SetValue([]byte("Owner ID")) @@ -19,10 +18,9 @@ func TestOwnerID_StableMarshal(t *testing.T) { wire, err := ownerFrom.StableMarshal(nil) require.NoError(t, err) - err = goproto.Unmarshal(wire, ownerTransport) - require.NoError(t, err) + ownerTo := new(refs.OwnerID) + require.NoError(t, ownerTo.Unmarshal(wire)) - ownerTo := refs.OwnerIDFromGRPCMessage(ownerTransport) require.Equal(t, ownerFrom, ownerTo) }) } From 1519a02d63ed7526703e18620e89342c9d7736ad Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 13 Nov 2020 16:19:16 +0300 Subject: [PATCH 0549/1196] [#168] refs: Implement binary/JSON encoders/decoders on Version Signed-off-by: Leonard Lyubich --- pkg/version.go | 32 ++++++++++++++++++++++++++++++++ pkg/version_test.go | 26 ++++++++++++++++++++++++++ v2/refs/json.go | 20 ++++++++++++++++++++ v2/refs/json_test.go | 12 ++++++++++++ v2/refs/marshal.go | 11 +++++++++++ v2/refs/marshal_test.go | 6 ++---- 6 files changed, 103 insertions(+), 4 deletions(-) diff --git a/pkg/version.go b/pkg/version.go index a1c8316..c72722d 100644 --- a/pkg/version.go +++ b/pkg/version.go @@ -82,3 +82,35 @@ func IsSupportedVersion(v *Version) error { v.GetMinor(), ) } + +// Marshal marshals Version into a protobuf binary form. +// +// Buffer is allocated when the argument is empty. +// Otherwise, the first buffer is used. +func (v *Version) Marshal(b ...[]byte) ([]byte, error) { + var buf []byte + if len(b) > 0 { + buf = b[0] + } + + return (*refs.Version)(v). + StableMarshal(buf) +} + +// Unmarshal unmarshals protobuf binary representation of Version. +func (v *Version) Unmarshal(data []byte) error { + return (*refs.Version)(v). + Unmarshal(data) +} + +// MarshalJSON encodes Version to protobuf JSON format. +func (v *Version) MarshalJSON() ([]byte, error) { + return (*refs.Version)(v). + MarshalJSON() +} + +// UnmarshalJSON decodes Version from protobuf JSON format. +func (v *Version) UnmarshalJSON(data []byte) error { + return (*refs.Version)(v). + UnmarshalJSON(data) +} diff --git a/pkg/version_test.go b/pkg/version_test.go index a5cc7fa..ce8b883 100644 --- a/pkg/version_test.go +++ b/pkg/version_test.go @@ -62,3 +62,29 @@ func TestIsSupportedVersion(t *testing.T) { require.Error(t, IsSupportedVersion(v)) } } + +func TestVersionEncoding(t *testing.T) { + v := NewVersion() + v.SetMajor(1) + v.SetMinor(2) + + t.Run("binary", func(t *testing.T) { + data, err := v.Marshal() + require.NoError(t, err) + + v2 := NewVersion() + require.NoError(t, v2.Unmarshal(data)) + + require.Equal(t, v, v2) + }) + + t.Run("json", func(t *testing.T) { + data, err := v.MarshalJSON() + require.NoError(t, err) + + v2 := NewVersion() + require.NoError(t, v2.UnmarshalJSON(data)) + + require.Equal(t, v, v2) + }) +} diff --git a/v2/refs/json.go b/v2/refs/json.go index e552ae1..3fe253e 100644 --- a/v2/refs/json.go +++ b/v2/refs/json.go @@ -84,3 +84,23 @@ func (o *OwnerID) UnmarshalJSON(data []byte) error { return nil } + +func (v *Version) MarshalJSON() ([]byte, error) { + return protojson.MarshalOptions{ + EmitUnpopulated: true, + }.Marshal( + VersionToGRPCMessage(v), + ) +} + +func (v *Version) UnmarshalJSON(data []byte) error { + msg := new(refs.Version) + + if err := protojson.Unmarshal(data, msg); err != nil { + return err + } + + *v = *VersionFromGRPCMessage(msg) + + return nil +} diff --git a/v2/refs/json_test.go b/v2/refs/json_test.go index c5684e9..ae41e9f 100644 --- a/v2/refs/json_test.go +++ b/v2/refs/json_test.go @@ -57,3 +57,15 @@ func TestOwnerIDJSON(t *testing.T) { require.Equal(t, o, o2) } + +func TestVersionSON(t *testing.T) { + v := generateVersion(1, 2) + + data, err := v.MarshalJSON() + require.NoError(t, err) + + v2 := new(refs.Version) + require.NoError(t, v2.UnmarshalJSON(data)) + + require.Equal(t, v, v2) +} diff --git a/v2/refs/marshal.go b/v2/refs/marshal.go index 0a2484a..353729c 100644 --- a/v2/refs/marshal.go +++ b/v2/refs/marshal.go @@ -305,3 +305,14 @@ func (v *Version) StableSize() (size int) { return size } + +func (v *Version) Unmarshal(data []byte) error { + m := new(refs.Version) + if err := goproto.Unmarshal(data, m); err != nil { + return err + } + + *v = *VersionFromGRPCMessage(m) + + return nil +} diff --git a/v2/refs/marshal_test.go b/v2/refs/marshal_test.go index 4c12ea2..f92e361 100644 --- a/v2/refs/marshal_test.go +++ b/v2/refs/marshal_test.go @@ -111,16 +111,14 @@ func TestSignature_StableMarshal(t *testing.T) { func TestVersion_StableMarshal(t *testing.T) { versionFrom := generateVersion(2, 0) - transport := new(grpc.Version) t.Run("non empty", func(t *testing.T) { wire, err := versionFrom.StableMarshal(nil) require.NoError(t, err) - err = goproto.Unmarshal(wire, transport) - require.NoError(t, err) + versionTo := new(refs.Version) + require.NoError(t, versionTo.Unmarshal(wire)) - versionTo := refs.VersionFromGRPCMessage(transport) require.Equal(t, versionFrom, versionTo) }) } From 4b55b0678013e4b49b20437e95877c12886ef043 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 13 Nov 2020 16:23:41 +0300 Subject: [PATCH 0550/1196] [#168] refs: Implement binary/JSON encoders/decoders on Signature Signed-off-by: Leonard Lyubich --- pkg/signature.go | 32 ++++++++++++++++++++++++++++++++ pkg/signature_test.go | 33 +++++++++++++++++++++++++++++++++ v2/refs/json.go | 20 ++++++++++++++++++++ v2/refs/json_test.go | 12 ++++++++++++ v2/refs/marshal.go | 11 +++++++++++ v2/refs/marshal_test.go | 6 ++---- 6 files changed, 110 insertions(+), 4 deletions(-) create mode 100644 pkg/signature_test.go diff --git a/pkg/signature.go b/pkg/signature.go index 7322c50..992b183 100644 --- a/pkg/signature.go +++ b/pkg/signature.go @@ -42,3 +42,35 @@ func (s *Signature) SetSign(v []byte) { func (s *Signature) ToV2() *refs.Signature { return (*refs.Signature)(s) } + +// Marshal marshals Signature into a protobuf binary form. +// +// Buffer is allocated when the argument is empty. +// Otherwise, the first buffer is used. +func (s *Signature) Marshal(b ...[]byte) ([]byte, error) { + var buf []byte + if len(b) > 0 { + buf = b[0] + } + + return (*refs.Signature)(s). + StableMarshal(buf) +} + +// Unmarshal unmarshals protobuf binary representation of Signature. +func (s *Signature) Unmarshal(data []byte) error { + return (*refs.Signature)(s). + Unmarshal(data) +} + +// MarshalJSON encodes Signature to protobuf JSON format. +func (s *Signature) MarshalJSON() ([]byte, error) { + return (*refs.Signature)(s). + MarshalJSON() +} + +// UnmarshalJSON decodes Signature from protobuf JSON format. +func (s *Signature) UnmarshalJSON(data []byte) error { + return (*refs.Signature)(s). + UnmarshalJSON(data) +} diff --git a/pkg/signature_test.go b/pkg/signature_test.go new file mode 100644 index 0000000..72196c8 --- /dev/null +++ b/pkg/signature_test.go @@ -0,0 +1,33 @@ +package pkg + +import ( + "testing" + + "github.com/stretchr/testify/require" +) + +func TestSignatureEncoding(t *testing.T) { + s := NewSignature() + s.SetKey([]byte("key")) + s.SetSign([]byte("sign")) + + t.Run("binary", func(t *testing.T) { + data, err := s.Marshal() + require.NoError(t, err) + + s2 := NewSignature() + require.NoError(t, s2.Unmarshal(data)) + + require.Equal(t, s, s2) + }) + + t.Run("json", func(t *testing.T) { + data, err := s.MarshalJSON() + require.NoError(t, err) + + s2 := NewSignature() + require.NoError(t, s2.UnmarshalJSON(data)) + + require.Equal(t, s, s2) + }) +} diff --git a/v2/refs/json.go b/v2/refs/json.go index 3fe253e..dd0f836 100644 --- a/v2/refs/json.go +++ b/v2/refs/json.go @@ -104,3 +104,23 @@ func (v *Version) UnmarshalJSON(data []byte) error { return nil } + +func (s *Signature) MarshalJSON() ([]byte, error) { + return protojson.MarshalOptions{ + EmitUnpopulated: true, + }.Marshal( + SignatureToGRPCMessage(s), + ) +} + +func (s *Signature) UnmarshalJSON(data []byte) error { + msg := new(refs.Signature) + + if err := protojson.Unmarshal(data, msg); err != nil { + return err + } + + *s = *SignatureFromGRPCMessage(msg) + + return nil +} diff --git a/v2/refs/json_test.go b/v2/refs/json_test.go index ae41e9f..5671ed2 100644 --- a/v2/refs/json_test.go +++ b/v2/refs/json_test.go @@ -69,3 +69,15 @@ func TestVersionSON(t *testing.T) { require.Equal(t, v, v2) } + +func TestSignatureSON(t *testing.T) { + s := generateSignature("key", "sig") + + data, err := s.MarshalJSON() + require.NoError(t, err) + + s2 := new(refs.Signature) + require.NoError(t, s2.UnmarshalJSON(data)) + + require.Equal(t, s, s2) +} diff --git a/v2/refs/marshal.go b/v2/refs/marshal.go index 353729c..5f2358b 100644 --- a/v2/refs/marshal.go +++ b/v2/refs/marshal.go @@ -266,6 +266,17 @@ func (s *Signature) StableSize() (size int) { return size } +func (s *Signature) Unmarshal(data []byte) error { + m := new(refs.Signature) + if err := goproto.Unmarshal(data, m); err != nil { + return err + } + + *s = *SignatureFromGRPCMessage(m) + + return nil +} + func (v *Version) StableMarshal(buf []byte) ([]byte, error) { if v == nil { return []byte{}, nil diff --git a/v2/refs/marshal_test.go b/v2/refs/marshal_test.go index f92e361..3cead07 100644 --- a/v2/refs/marshal_test.go +++ b/v2/refs/marshal_test.go @@ -95,16 +95,14 @@ func TestChecksum_StableMarshal(t *testing.T) { func TestSignature_StableMarshal(t *testing.T) { signatureFrom := generateSignature("Public Key", "Signature") - transport := new(grpc.Signature) t.Run("non empty", func(t *testing.T) { wire, err := signatureFrom.StableMarshal(nil) require.NoError(t, err) - err = goproto.Unmarshal(wire, transport) - require.NoError(t, err) + signatureTo := new(refs.Signature) + require.NoError(t, signatureTo.Unmarshal(wire)) - signatureTo := refs.SignatureFromGRPCMessage(transport) require.Equal(t, signatureFrom, signatureTo) }) } From 93df2fd7651c5abd61e8d77ecf53f9492176bf33 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 13 Nov 2020 16:30:35 +0300 Subject: [PATCH 0551/1196] [#168] refs: Implement binary/JSON encoders/decoders on Checksum Signed-off-by: Leonard Lyubich --- pkg/checksum.go | 32 ++++++++++++++++++++++++++++++++ pkg/checksum_test.go | 33 +++++++++++++++++++++++++++++++++ v2/refs/json.go | 20 ++++++++++++++++++++ v2/refs/json_test.go | 14 ++++++++++++++ v2/refs/marshal.go | 11 +++++++++++ v2/refs/marshal_test.go | 8 ++------ 6 files changed, 112 insertions(+), 6 deletions(-) diff --git a/pkg/checksum.go b/pkg/checksum.go index 2a93b39..4182b71 100644 --- a/pkg/checksum.go +++ b/pkg/checksum.go @@ -77,3 +77,35 @@ func (c *Checksum) ToV2() *refs.Checksum { func EqualChecksums(cs1, cs2 *Checksum) bool { return cs1.GetType() == cs2.GetType() && bytes.Equal(cs1.GetSum(), cs2.GetSum()) } + +// Marshal marshals Checksum into a protobuf binary form. +// +// Buffer is allocated when the argument is empty. +// Otherwise, the first buffer is used. +func (c *Checksum) Marshal(b ...[]byte) ([]byte, error) { + var buf []byte + if len(b) > 0 { + buf = b[0] + } + + return (*refs.Checksum)(c). + StableMarshal(buf) +} + +// Unmarshal unmarshals protobuf binary representation of Checksum. +func (c *Checksum) Unmarshal(data []byte) error { + return (*refs.Checksum)(c). + Unmarshal(data) +} + +// MarshalJSON encodes Checksum to protobuf JSON format. +func (c *Checksum) MarshalJSON() ([]byte, error) { + return (*refs.Checksum)(c). + MarshalJSON() +} + +// UnmarshalJSON decodes Checksum from protobuf JSON format. +func (c *Checksum) UnmarshalJSON(data []byte) error { + return (*refs.Checksum)(c). + UnmarshalJSON(data) +} diff --git a/pkg/checksum_test.go b/pkg/checksum_test.go index 906f68b..9d402a4 100644 --- a/pkg/checksum_test.go +++ b/pkg/checksum_test.go @@ -9,6 +9,14 @@ import ( "github.com/stretchr/testify/require" ) +func randSHA256(t *testing.T) [sha256.Size]byte { + cSHA256 := [sha256.Size]byte{} + _, err := rand.Read(cSHA256[:]) + require.NoError(t, err) + + return cSHA256 +} + func TestChecksum(t *testing.T) { c := NewChecksum() @@ -58,3 +66,28 @@ func TestEqualChecksums(t *testing.T) { require.False(t, EqualChecksums(cs1, cs2)) } + +func TestChecksumEncoding(t *testing.T) { + cs := NewChecksum() + cs.SetSHA256(randSHA256(t)) + + t.Run("binary", func(t *testing.T) { + data, err := cs.Marshal() + require.NoError(t, err) + + c2 := NewChecksum() + require.NoError(t, c2.Unmarshal(data)) + + require.Equal(t, cs, c2) + }) + + t.Run("json", func(t *testing.T) { + data, err := cs.MarshalJSON() + require.NoError(t, err) + + cs2 := NewChecksum() + require.NoError(t, cs2.UnmarshalJSON(data)) + + require.Equal(t, cs, cs2) + }) +} diff --git a/v2/refs/json.go b/v2/refs/json.go index dd0f836..bd68cd6 100644 --- a/v2/refs/json.go +++ b/v2/refs/json.go @@ -124,3 +124,23 @@ func (s *Signature) UnmarshalJSON(data []byte) error { return nil } + +func (c *Checksum) MarshalJSON() ([]byte, error) { + return protojson.MarshalOptions{ + EmitUnpopulated: true, + }.Marshal( + ChecksumToGRPCMessage(c), + ) +} + +func (c *Checksum) UnmarshalJSON(data []byte) error { + msg := new(refs.Checksum) + + if err := protojson.Unmarshal(data, msg); err != nil { + return err + } + + *c = *ChecksumFromGRPCMessage(msg) + + return nil +} diff --git a/v2/refs/json_test.go b/v2/refs/json_test.go index 5671ed2..b04df1a 100644 --- a/v2/refs/json_test.go +++ b/v2/refs/json_test.go @@ -81,3 +81,17 @@ func TestSignatureSON(t *testing.T) { require.Equal(t, s, s2) } + +func TestChecksumJSON(t *testing.T) { + cs := new(refs.Checksum) + cs.SetType(refs.SHA256) + cs.SetSum([]byte{1, 2, 3}) + + data, err := cs.MarshalJSON() + require.NoError(t, err) + + cs2 := new(refs.Checksum) + require.NoError(t, cs2.UnmarshalJSON(data)) + + require.Equal(t, cs, cs2) +} diff --git a/v2/refs/marshal.go b/v2/refs/marshal.go index 5f2358b..3c3ef1e 100644 --- a/v2/refs/marshal.go +++ b/v2/refs/marshal.go @@ -226,6 +226,17 @@ func (c *Checksum) StableSize() (size int) { return size } +func (c *Checksum) Unmarshal(data []byte) error { + m := new(refs.Checksum) + if err := goproto.Unmarshal(data, m); err != nil { + return err + } + + *c = *ChecksumFromGRPCMessage(m) + + return nil +} + func (s *Signature) StableMarshal(buf []byte) ([]byte, error) { if s == nil { return []byte{}, nil diff --git a/v2/refs/marshal_test.go b/v2/refs/marshal_test.go index 3cead07..3bc2eb2 100644 --- a/v2/refs/marshal_test.go +++ b/v2/refs/marshal_test.go @@ -4,9 +4,7 @@ import ( "testing" "github.com/nspcc-dev/neofs-api-go/v2/refs" - grpc "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" "github.com/stretchr/testify/require" - goproto "google.golang.org/protobuf/proto" ) func TestOwnerID_StableMarshal(t *testing.T) { @@ -76,7 +74,6 @@ func TestAddress_StableMarshal(t *testing.T) { func TestChecksum_StableMarshal(t *testing.T) { checksumFrom := new(refs.Checksum) - transport := new(grpc.Checksum) t.Run("non empty", func(t *testing.T) { checksumFrom.SetType(refs.TillichZemor) @@ -85,10 +82,9 @@ func TestChecksum_StableMarshal(t *testing.T) { wire, err := checksumFrom.StableMarshal(nil) require.NoError(t, err) - err = goproto.Unmarshal(wire, transport) - require.NoError(t, err) + checksumTo := new(refs.Checksum) + require.NoError(t, checksumTo.Unmarshal(wire)) - checksumTo := refs.ChecksumFromGRPCMessage(transport) require.Equal(t, checksumFrom, checksumTo) }) } From 86351a8f908da5d8e896b983d078eefe11322ba0 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 13 Nov 2020 16:40:00 +0300 Subject: [PATCH 0552/1196] [#168] session: Implement binary/JSON encoders/decoders on SessionContext Signed-off-by: Leonard Lyubich --- v2/session/json.go | 26 ++++++++++++++++++++++++++ v2/session/json_test.go | 20 ++++++++++++++++++++ v2/session/marshal.go | 13 +++++++++++++ v2/session/marshal_test.go | 6 ++---- 4 files changed, 61 insertions(+), 4 deletions(-) create mode 100644 v2/session/json.go create mode 100644 v2/session/json_test.go diff --git a/v2/session/json.go b/v2/session/json.go new file mode 100644 index 0000000..bb9489e --- /dev/null +++ b/v2/session/json.go @@ -0,0 +1,26 @@ +package session + +import ( + session "github.com/nspcc-dev/neofs-api-go/v2/session/grpc" + "google.golang.org/protobuf/encoding/protojson" +) + +func (c *ObjectSessionContext) MarshalJSON() ([]byte, error) { + return protojson.MarshalOptions{ + EmitUnpopulated: true, + }.Marshal( + ObjectSessionContextToGRPCMessage(c), + ) +} + +func (c *ObjectSessionContext) UnmarshalJSON(data []byte) error { + msg := new(session.ObjectSessionContext) + + if err := protojson.Unmarshal(data, msg); err != nil { + return err + } + + *c = *ObjectSessionContextFromGRPCMessage(msg) + + return nil +} diff --git a/v2/session/json_test.go b/v2/session/json_test.go new file mode 100644 index 0000000..d76b6f4 --- /dev/null +++ b/v2/session/json_test.go @@ -0,0 +1,20 @@ +package session_test + +import ( + "testing" + + "github.com/nspcc-dev/neofs-api-go/v2/session" + "github.com/stretchr/testify/require" +) + +func TestChecksumJSON(t *testing.T) { + ctx := generateObjectCtx("id") + + data, err := ctx.MarshalJSON() + require.NoError(t, err) + + ctx2 := new(session.ObjectSessionContext) + require.NoError(t, ctx2.UnmarshalJSON(data)) + + require.Equal(t, ctx, ctx2) +} diff --git a/v2/session/marshal.go b/v2/session/marshal.go index 9bd4eb1..34e038e 100644 --- a/v2/session/marshal.go +++ b/v2/session/marshal.go @@ -2,6 +2,8 @@ package session import ( "github.com/nspcc-dev/neofs-api-go/util/proto" + session "github.com/nspcc-dev/neofs-api-go/v2/session/grpc" + goproto "google.golang.org/protobuf/proto" ) const ( @@ -263,6 +265,17 @@ func (c *ObjectSessionContext) StableSize() (size int) { return size } +func (c *ObjectSessionContext) Unmarshal(data []byte) error { + m := new(session.ObjectSessionContext) + if err := goproto.Unmarshal(data, m); err != nil { + return err + } + + *c = *ObjectSessionContextFromGRPCMessage(m) + + return nil +} + func (t *SessionTokenBody) StableMarshal(buf []byte) ([]byte, error) { if t == nil { return []byte{}, nil diff --git a/v2/session/marshal_test.go b/v2/session/marshal_test.go index 8e35d86..8fd889e 100644 --- a/v2/session/marshal_test.go +++ b/v2/session/marshal_test.go @@ -78,16 +78,14 @@ func TestTokenLifetime_StableMarshal(t *testing.T) { func TestObjectSessionContext_StableMarshal(t *testing.T) { objectCtxFrom := generateObjectCtx("Object ID") - transport := new(grpc.ObjectSessionContext) t.Run("non empty", func(t *testing.T) { wire, err := objectCtxFrom.StableMarshal(nil) require.NoError(t, err) - err = goproto.Unmarshal(wire, transport) - require.NoError(t, err) + objectCtxTo := new(session.ObjectSessionContext) + require.NoError(t, objectCtxTo.Unmarshal(wire)) - objectCtxTo := session.ObjectSessionContextFromGRPCMessage(transport) require.Equal(t, objectCtxFrom, objectCtxTo) }) } From 20bf21e5e45ae894f5f6373c920cd4f9cf659cfa Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 13 Nov 2020 16:43:54 +0300 Subject: [PATCH 0553/1196] [#168] session: Implement binary/JSON encoders/decoders on TokenLifetime Signed-off-by: Leonard Lyubich --- v2/session/json.go | 20 ++++++++++++++++++++ v2/session/json_test.go | 12 ++++++++++++ v2/session/marshal.go | 11 +++++++++++ v2/session/marshal_test.go | 6 ++---- 4 files changed, 45 insertions(+), 4 deletions(-) diff --git a/v2/session/json.go b/v2/session/json.go index bb9489e..f8cf61d 100644 --- a/v2/session/json.go +++ b/v2/session/json.go @@ -24,3 +24,23 @@ func (c *ObjectSessionContext) UnmarshalJSON(data []byte) error { return nil } + +func (l *TokenLifetime) MarshalJSON() ([]byte, error) { + return protojson.MarshalOptions{ + EmitUnpopulated: true, + }.Marshal( + TokenLifetimeToGRPCMessage(l), + ) +} + +func (l *TokenLifetime) UnmarshalJSON(data []byte) error { + msg := new(session.SessionToken_Body_TokenLifetime) + + if err := protojson.Unmarshal(data, msg); err != nil { + return err + } + + *l = *TokenLifetimeFromGRPCMessage(msg) + + return nil +} diff --git a/v2/session/json_test.go b/v2/session/json_test.go index d76b6f4..add7614 100644 --- a/v2/session/json_test.go +++ b/v2/session/json_test.go @@ -18,3 +18,15 @@ func TestChecksumJSON(t *testing.T) { require.Equal(t, ctx, ctx2) } + +func TestTokenLifetimeJSON(t *testing.T) { + l := generateLifetime(1, 2, 3) + + data, err := l.MarshalJSON() + require.NoError(t, err) + + l2 := new(session.TokenLifetime) + require.NoError(t, l2.UnmarshalJSON(data)) + + require.Equal(t, l, l2) +} diff --git a/v2/session/marshal.go b/v2/session/marshal.go index 34e038e..2e103a0 100644 --- a/v2/session/marshal.go +++ b/v2/session/marshal.go @@ -225,6 +225,17 @@ func (l *TokenLifetime) StableSize() (size int) { return size } +func (l *TokenLifetime) Unmarshal(data []byte) error { + m := new(session.SessionToken_Body_TokenLifetime) + if err := goproto.Unmarshal(data, m); err != nil { + return err + } + + *l = *TokenLifetimeFromGRPCMessage(m) + + return nil +} + func (c *ObjectSessionContext) StableMarshal(buf []byte) ([]byte, error) { if c == nil { return []byte{}, nil diff --git a/v2/session/marshal_test.go b/v2/session/marshal_test.go index 8fd889e..059aa84 100644 --- a/v2/session/marshal_test.go +++ b/v2/session/marshal_test.go @@ -62,16 +62,14 @@ func TestXHeader_StableMarshal(t *testing.T) { func TestTokenLifetime_StableMarshal(t *testing.T) { lifetimeFrom := generateLifetime(10, 20, 30) - transport := new(grpc.SessionToken_Body_TokenLifetime) t.Run("non empty", func(t *testing.T) { wire, err := lifetimeFrom.StableMarshal(nil) require.NoError(t, err) - err = goproto.Unmarshal(wire, transport) - require.NoError(t, err) + lifetimeTo := new(session.TokenLifetime) + require.NoError(t, lifetimeTo.Unmarshal(wire)) - lifetimeTo := session.TokenLifetimeFromGRPCMessage(transport) require.Equal(t, lifetimeFrom, lifetimeTo) }) } From 4e163617d145928b7f7428fe38a11dc1201609d1 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 13 Nov 2020 16:49:46 +0300 Subject: [PATCH 0554/1196] [#168] session: Implement binary/JSON encoders/decoders on TokenBody Signed-off-by: Leonard Lyubich --- v2/session/json.go | 20 ++++++++++++++++++++ v2/session/json_test.go | 12 ++++++++++++ v2/session/marshal.go | 11 +++++++++++ v2/session/marshal_test.go | 6 ++---- 4 files changed, 45 insertions(+), 4 deletions(-) diff --git a/v2/session/json.go b/v2/session/json.go index f8cf61d..d192b65 100644 --- a/v2/session/json.go +++ b/v2/session/json.go @@ -44,3 +44,23 @@ func (l *TokenLifetime) UnmarshalJSON(data []byte) error { return nil } + +func (t *SessionTokenBody) MarshalJSON() ([]byte, error) { + return protojson.MarshalOptions{ + EmitUnpopulated: true, + }.Marshal( + SessionTokenBodyToGRPCMessage(t), + ) +} + +func (t *SessionTokenBody) UnmarshalJSON(data []byte) error { + msg := new(session.SessionToken_Body) + + if err := protojson.Unmarshal(data, msg); err != nil { + return err + } + + *t = *SessionTokenBodyFromGRPCMessage(msg) + + return nil +} diff --git a/v2/session/json_test.go b/v2/session/json_test.go index add7614..10eda4e 100644 --- a/v2/session/json_test.go +++ b/v2/session/json_test.go @@ -30,3 +30,15 @@ func TestTokenLifetimeJSON(t *testing.T) { require.Equal(t, l, l2) } + +func TestSessionTokenBodyJSON(t *testing.T) { + b := generateSessionTokenBody("id") + + data, err := b.MarshalJSON() + require.NoError(t, err) + + b2 := new(session.SessionTokenBody) + require.NoError(t, b2.UnmarshalJSON(data)) + + require.Equal(t, b, b2) +} diff --git a/v2/session/marshal.go b/v2/session/marshal.go index 2e103a0..437147d 100644 --- a/v2/session/marshal.go +++ b/v2/session/marshal.go @@ -366,6 +366,17 @@ func (t *SessionTokenBody) StableSize() (size int) { return size } +func (t *SessionTokenBody) Unmarshal(data []byte) error { + m := new(session.SessionToken_Body) + if err := goproto.Unmarshal(data, m); err != nil { + return err + } + + *t = *SessionTokenBodyFromGRPCMessage(m) + + return nil +} + func (t *SessionToken) StableMarshal(buf []byte) ([]byte, error) { if t == nil { return []byte{}, nil diff --git a/v2/session/marshal_test.go b/v2/session/marshal_test.go index 059aa84..1dc5397 100644 --- a/v2/session/marshal_test.go +++ b/v2/session/marshal_test.go @@ -90,16 +90,14 @@ func TestObjectSessionContext_StableMarshal(t *testing.T) { func TestSessionTokenBody_StableMarshal(t *testing.T) { sessionTokenBodyFrom := generateSessionTokenBody("Session Token Body") - transport := new(grpc.SessionToken_Body) t.Run("non empty", func(t *testing.T) { wire, err := sessionTokenBodyFrom.StableMarshal(nil) require.NoError(t, err) - err = goproto.Unmarshal(wire, transport) - require.NoError(t, err) + sessionTokenBodyTo := new(session.SessionTokenBody) + require.NoError(t, sessionTokenBodyTo.Unmarshal(wire)) - sessionTokenBodyTo := session.SessionTokenBodyFromGRPCMessage(transport) require.Equal(t, sessionTokenBodyFrom, sessionTokenBodyTo) }) } From 85d4713348109abdf5d8a6adc09dd299f922f6e2 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 13 Nov 2020 16:53:42 +0300 Subject: [PATCH 0555/1196] [#168] session: Implement binary/JSON encoders/decoders on SessionToken Signed-off-by: Leonard Lyubich --- pkg/token/session.go | 44 ++++++++++++++++++++++++++++++++++++++ pkg/token/session_test.go | 25 ++++++++++++++++++++++ v2/session/json.go | 20 +++++++++++++++++ v2/session/json_test.go | 12 +++++++++++ v2/session/marshal.go | 11 ++++++++++ v2/session/marshal_test.go | 6 ++---- 6 files changed, 114 insertions(+), 4 deletions(-) diff --git a/pkg/token/session.go b/pkg/token/session.go index d9e1c47..834110b 100644 --- a/pkg/token/session.go +++ b/pkg/token/session.go @@ -76,3 +76,47 @@ func (t *SessionToken) Signature() *pkg.Signature { GetSignature(), ) } + +// Marshal marshals SessionToken into a protobuf binary form. +// +// Buffer is allocated when the argument is empty. +// Otherwise, the first buffer is used. +func (t *SessionToken) Marshal(bs ...[]byte) ([]byte, error) { + var buf []byte + if len(bs) > 0 { + buf = bs[0] + } + + return (*session.SessionToken)(t). + StableMarshal(buf) +} + +// Unmarshal unmarshals protobuf binary representation of SessionToken. +func (t *SessionToken) Unmarshal(data []byte) error { + tV2 := new(session.SessionToken) + if err := tV2.Unmarshal(data); err != nil { + return err + } + + *t = *NewSessionTokenFromV2(tV2) + + return nil +} + +// MarshalJSON encodes SessionToken to protobuf JSON format. +func (t *SessionToken) MarshalJSON() ([]byte, error) { + return (*session.SessionToken)(t). + MarshalJSON() +} + +// UnmarshalJSON decodes SessionToken from protobuf JSON format. +func (t *SessionToken) UnmarshalJSON(data []byte) error { + tV2 := new(session.SessionToken) + if err := tV2.UnmarshalJSON(data); err != nil { + return err + } + + *t = *NewSessionTokenFromV2(tV2) + + return nil +} diff --git a/pkg/token/session_test.go b/pkg/token/session_test.go index f155bc9..8a399ae 100644 --- a/pkg/token/session_test.go +++ b/pkg/token/session_test.go @@ -40,3 +40,28 @@ func TestSessionToken_SetSessionKey(t *testing.T) { require.Equal(t, key, token.SessionKey()) } + +func TestSessionTokenEncoding(t *testing.T) { + tok := NewSessionToken() + tok.SetID([]byte("id")) + + t.Run("binary", func(t *testing.T) { + data, err := tok.Marshal() + require.NoError(t, err) + + tok2 := NewSessionToken() + require.NoError(t, tok2.Unmarshal(data)) + + require.Equal(t, tok, tok2) + }) + + t.Run("json", func(t *testing.T) { + data, err := tok.MarshalJSON() + require.NoError(t, err) + + tok2 := NewSessionToken() + require.NoError(t, tok2.UnmarshalJSON(data)) + + require.Equal(t, tok, tok2) + }) +} diff --git a/v2/session/json.go b/v2/session/json.go index d192b65..ec24b58 100644 --- a/v2/session/json.go +++ b/v2/session/json.go @@ -64,3 +64,23 @@ func (t *SessionTokenBody) UnmarshalJSON(data []byte) error { return nil } + +func (t *SessionToken) MarshalJSON() ([]byte, error) { + return protojson.MarshalOptions{ + EmitUnpopulated: true, + }.Marshal( + SessionTokenToGRPCMessage(t), + ) +} + +func (t *SessionToken) UnmarshalJSON(data []byte) error { + msg := new(session.SessionToken) + + if err := protojson.Unmarshal(data, msg); err != nil { + return err + } + + *t = *SessionTokenFromGRPCMessage(msg) + + return nil +} diff --git a/v2/session/json_test.go b/v2/session/json_test.go index 10eda4e..eee4878 100644 --- a/v2/session/json_test.go +++ b/v2/session/json_test.go @@ -42,3 +42,15 @@ func TestSessionTokenBodyJSON(t *testing.T) { require.Equal(t, b, b2) } + +func TestSessionTokenJSON(t *testing.T) { + tok := generateSessionToken("id") + + data, err := tok.MarshalJSON() + require.NoError(t, err) + + tok2 := new(session.SessionToken) + require.NoError(t, tok2.UnmarshalJSON(data)) + + require.Equal(t, tok, tok2) +} diff --git a/v2/session/marshal.go b/v2/session/marshal.go index 437147d..5b21964 100644 --- a/v2/session/marshal.go +++ b/v2/session/marshal.go @@ -417,6 +417,17 @@ func (t *SessionToken) StableSize() (size int) { return size } +func (t *SessionToken) Unmarshal(data []byte) error { + m := new(session.SessionToken) + if err := goproto.Unmarshal(data, m); err != nil { + return err + } + + *t = *SessionTokenFromGRPCMessage(m) + + return nil +} + func (r *RequestMetaHeader) StableMarshal(buf []byte) ([]byte, error) { if r == nil { return []byte{}, nil diff --git a/v2/session/marshal_test.go b/v2/session/marshal_test.go index 1dc5397..5d257a5 100644 --- a/v2/session/marshal_test.go +++ b/v2/session/marshal_test.go @@ -104,16 +104,14 @@ func TestSessionTokenBody_StableMarshal(t *testing.T) { func TestSessionToken_StableMarshal(t *testing.T) { sessionTokenFrom := generateSessionToken("Session Token") - transport := new(grpc.SessionToken) t.Run("non empty", func(t *testing.T) { wire, err := sessionTokenFrom.StableMarshal(nil) require.NoError(t, err) - err = goproto.Unmarshal(wire, transport) - require.NoError(t, err) + sessionTokenTo := new(session.SessionToken) + require.NoError(t, sessionTokenTo.Unmarshal(wire)) - sessionTokenTo := session.SessionTokenFromGRPCMessage(transport) require.Equal(t, sessionTokenFrom, sessionTokenTo) }) } From 7e3e9e1cba38579bd2e278c7ab0415ee9891014c Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 13 Nov 2020 16:58:08 +0300 Subject: [PATCH 0556/1196] [#168] session: Implement binary/JSON encoders/decoders on XHeader Signed-off-by: Leonard Lyubich --- v2/session/json.go | 20 ++++++++++++++++++++ v2/session/json_test.go | 12 ++++++++++++ v2/session/marshal.go | 11 +++++++++++ v2/session/marshal_test.go | 6 ++---- 4 files changed, 45 insertions(+), 4 deletions(-) diff --git a/v2/session/json.go b/v2/session/json.go index ec24b58..e8306a8 100644 --- a/v2/session/json.go +++ b/v2/session/json.go @@ -84,3 +84,23 @@ func (t *SessionToken) UnmarshalJSON(data []byte) error { return nil } + +func (x *XHeader) MarshalJSON() ([]byte, error) { + return protojson.MarshalOptions{ + EmitUnpopulated: true, + }.Marshal( + XHeaderToGRPCMessage(x), + ) +} + +func (x *XHeader) UnmarshalJSON(data []byte) error { + msg := new(session.XHeader) + + if err := protojson.Unmarshal(data, msg); err != nil { + return err + } + + *x = *XHeaderFromGRPCMessage(msg) + + return nil +} diff --git a/v2/session/json_test.go b/v2/session/json_test.go index eee4878..0a2033b 100644 --- a/v2/session/json_test.go +++ b/v2/session/json_test.go @@ -54,3 +54,15 @@ func TestSessionTokenJSON(t *testing.T) { require.Equal(t, tok, tok2) } + +func TestXHeaderJSON(t *testing.T) { + x := generateXHeader("key", "value") + + data, err := x.MarshalJSON() + require.NoError(t, err) + + x2 := new(session.XHeader) + require.NoError(t, x2.UnmarshalJSON(data)) + + require.Equal(t, x, x2) +} diff --git a/v2/session/marshal.go b/v2/session/marshal.go index 5b21964..cd5b3a9 100644 --- a/v2/session/marshal.go +++ b/v2/session/marshal.go @@ -177,6 +177,17 @@ func (x *XHeader) StableSize() (size int) { return size } +func (x *XHeader) Unmarshal(data []byte) error { + m := new(session.XHeader) + if err := goproto.Unmarshal(data, m); err != nil { + return err + } + + *x = *XHeaderFromGRPCMessage(m) + + return nil +} + func (l *TokenLifetime) StableMarshal(buf []byte) ([]byte, error) { if l == nil { return []byte{}, nil diff --git a/v2/session/marshal_test.go b/v2/session/marshal_test.go index 5d257a5..0043917 100644 --- a/v2/session/marshal_test.go +++ b/v2/session/marshal_test.go @@ -46,16 +46,14 @@ func TestCreateResponseBody_StableMarshal(t *testing.T) { func TestXHeader_StableMarshal(t *testing.T) { xheaderFrom := generateXHeader("X-Header-Key", "X-Header-Value") - transport := new(grpc.XHeader) t.Run("non empty", func(t *testing.T) { wire, err := xheaderFrom.StableMarshal(nil) require.NoError(t, err) - err = goproto.Unmarshal(wire, transport) - require.NoError(t, err) + xheaderTo := new(session.XHeader) + require.NoError(t, xheaderTo.Unmarshal(wire)) - xheaderTo := session.XHeaderFromGRPCMessage(transport) require.Equal(t, xheaderFrom, xheaderTo) }) } From 8f8e977a3e772000c82f13ff8053cd9315db1bb4 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 13 Nov 2020 17:02:30 +0300 Subject: [PATCH 0557/1196] [#168] session: Implement binary/JSON encoders/decoders on RequestMeta Signed-off-by: Leonard Lyubich --- v2/session/json.go | 20 ++++++++++++++++++++ v2/session/json_test.go | 12 ++++++++++++ v2/session/marshal.go | 11 +++++++++++ v2/session/marshal_test.go | 6 ++---- 4 files changed, 45 insertions(+), 4 deletions(-) diff --git a/v2/session/json.go b/v2/session/json.go index e8306a8..063f4a8 100644 --- a/v2/session/json.go +++ b/v2/session/json.go @@ -104,3 +104,23 @@ func (x *XHeader) UnmarshalJSON(data []byte) error { return nil } + +func (r *RequestMetaHeader) MarshalJSON() ([]byte, error) { + return protojson.MarshalOptions{ + EmitUnpopulated: true, + }.Marshal( + RequestMetaHeaderToGRPCMessage(r), + ) +} + +func (r *RequestMetaHeader) UnmarshalJSON(data []byte) error { + msg := new(session.RequestMetaHeader) + + if err := protojson.Unmarshal(data, msg); err != nil { + return err + } + + *r = *RequestMetaHeaderFromGRPCMessage(msg) + + return nil +} diff --git a/v2/session/json_test.go b/v2/session/json_test.go index 0a2033b..595a74c 100644 --- a/v2/session/json_test.go +++ b/v2/session/json_test.go @@ -66,3 +66,15 @@ func TestXHeaderJSON(t *testing.T) { require.Equal(t, x, x2) } + +func TestRequestMetaHeaderJSON(t *testing.T) { + r := generateRequestMetaHeader(1, "bearer", "session") + + data, err := r.MarshalJSON() + require.NoError(t, err) + + r2 := new(session.RequestMetaHeader) + require.NoError(t, r2.UnmarshalJSON(data)) + + require.Equal(t, r, r2) +} diff --git a/v2/session/marshal.go b/v2/session/marshal.go index cd5b3a9..e5db851 100644 --- a/v2/session/marshal.go +++ b/v2/session/marshal.go @@ -528,6 +528,17 @@ func (r *RequestMetaHeader) StableSize() (size int) { return size } +func (r *RequestMetaHeader) Unmarshal(data []byte) error { + m := new(session.RequestMetaHeader) + if err := goproto.Unmarshal(data, m); err != nil { + return err + } + + *r = *RequestMetaHeaderFromGRPCMessage(m) + + return nil +} + func (r *RequestVerificationHeader) StableMarshal(buf []byte) ([]byte, error) { if r == nil { return []byte{}, nil diff --git a/v2/session/marshal_test.go b/v2/session/marshal_test.go index 0043917..a7fbbea 100644 --- a/v2/session/marshal_test.go +++ b/v2/session/marshal_test.go @@ -118,16 +118,14 @@ func TestRequestMetaHeader_StableMarshal(t *testing.T) { metaHeaderOrigin := generateRequestMetaHeader(10, "Bearer One", "Session One") metaHeaderFrom := generateRequestMetaHeader(20, "Bearer Two", "Session Two") metaHeaderFrom.SetOrigin(metaHeaderOrigin) - transport := new(grpc.RequestMetaHeader) t.Run("non empty", func(t *testing.T) { wire, err := metaHeaderFrom.StableMarshal(nil) require.NoError(t, err) - err = goproto.Unmarshal(wire, transport) - require.NoError(t, err) + metaHeaderTo := new(session.RequestMetaHeader) + require.NoError(t, metaHeaderTo.Unmarshal(wire)) - metaHeaderTo := session.RequestMetaHeaderFromGRPCMessage(transport) require.Equal(t, metaHeaderFrom, metaHeaderTo) }) } From 986bc1b0eaaacf605f0f7b676c4947aaeba49509 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 13 Nov 2020 17:07:49 +0300 Subject: [PATCH 0558/1196] [#168] session: Implement binary/JSON encoders/decoders on RequestVerify Signed-off-by: Leonard Lyubich --- v2/session/json.go | 20 ++++++++++++++++++++ v2/session/json_test.go | 12 ++++++++++++ v2/session/marshal.go | 11 +++++++++++ v2/session/marshal_test.go | 6 ++---- 4 files changed, 45 insertions(+), 4 deletions(-) diff --git a/v2/session/json.go b/v2/session/json.go index 063f4a8..7929e4e 100644 --- a/v2/session/json.go +++ b/v2/session/json.go @@ -124,3 +124,23 @@ func (r *RequestMetaHeader) UnmarshalJSON(data []byte) error { return nil } + +func (r *RequestVerificationHeader) MarshalJSON() ([]byte, error) { + return protojson.MarshalOptions{ + EmitUnpopulated: true, + }.Marshal( + RequestVerificationHeaderToGRPCMessage(r), + ) +} + +func (r *RequestVerificationHeader) UnmarshalJSON(data []byte) error { + msg := new(session.RequestVerificationHeader) + + if err := protojson.Unmarshal(data, msg); err != nil { + return err + } + + *r = *RequestVerificationHeaderFromGRPCMessage(msg) + + return nil +} diff --git a/v2/session/json_test.go b/v2/session/json_test.go index 595a74c..78bd9d3 100644 --- a/v2/session/json_test.go +++ b/v2/session/json_test.go @@ -78,3 +78,15 @@ func TestRequestMetaHeaderJSON(t *testing.T) { require.Equal(t, r, r2) } + +func TestRequestVerificationHeaderJSON(t *testing.T) { + r := generateRequestVerificationHeader("key", "value") + + data, err := r.MarshalJSON() + require.NoError(t, err) + + r2 := new(session.RequestVerificationHeader) + require.NoError(t, r2.UnmarshalJSON(data)) + + require.Equal(t, r, r2) +} diff --git a/v2/session/marshal.go b/v2/session/marshal.go index e5db851..fd48a5b 100644 --- a/v2/session/marshal.go +++ b/v2/session/marshal.go @@ -595,6 +595,17 @@ func (r *RequestVerificationHeader) StableSize() (size int) { return size } +func (r *RequestVerificationHeader) Unmarshal(data []byte) error { + m := new(session.RequestVerificationHeader) + if err := goproto.Unmarshal(data, m); err != nil { + return err + } + + *r = *RequestVerificationHeaderFromGRPCMessage(m) + + return nil +} + func (r *ResponseMetaHeader) StableMarshal(buf []byte) ([]byte, error) { if r == nil { return []byte{}, nil diff --git a/v2/session/marshal_test.go b/v2/session/marshal_test.go index a7fbbea..1e48cc9 100644 --- a/v2/session/marshal_test.go +++ b/v2/session/marshal_test.go @@ -134,16 +134,14 @@ func TestRequestVerificationHeader_StableMarshal(t *testing.T) { verifHeaderOrigin := generateRequestVerificationHeader("Key", "Inside") verifHeaderFrom := generateRequestVerificationHeader("Value", "Outside") verifHeaderFrom.SetOrigin(verifHeaderOrigin) - transport := new(grpc.RequestVerificationHeader) t.Run("non empty", func(t *testing.T) { wire, err := verifHeaderFrom.StableMarshal(nil) require.NoError(t, err) - err = goproto.Unmarshal(wire, transport) - require.NoError(t, err) + verifHeaderTo := new(session.RequestVerificationHeader) + require.NoError(t, verifHeaderTo.Unmarshal(wire)) - verifHeaderTo := session.RequestVerificationHeaderFromGRPCMessage(transport) require.Equal(t, verifHeaderFrom, verifHeaderTo) }) } From edf6ec05b3c97910799369ac4db13fbab5a4fe5b Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 13 Nov 2020 17:11:09 +0300 Subject: [PATCH 0559/1196] [#168] session: Implement binary/JSON encoders/decoders on ResponseMeta Signed-off-by: Leonard Lyubich --- v2/session/json.go | 20 ++++++++++++++++++++ v2/session/json_test.go | 12 ++++++++++++ v2/session/marshal.go | 11 +++++++++++ v2/session/marshal_test.go | 6 ++---- 4 files changed, 45 insertions(+), 4 deletions(-) diff --git a/v2/session/json.go b/v2/session/json.go index 7929e4e..36525d3 100644 --- a/v2/session/json.go +++ b/v2/session/json.go @@ -144,3 +144,23 @@ func (r *RequestVerificationHeader) UnmarshalJSON(data []byte) error { return nil } + +func (r *ResponseMetaHeader) MarshalJSON() ([]byte, error) { + return protojson.MarshalOptions{ + EmitUnpopulated: true, + }.Marshal( + ResponseMetaHeaderToGRPCMessage(r), + ) +} + +func (r *ResponseMetaHeader) UnmarshalJSON(data []byte) error { + msg := new(session.ResponseMetaHeader) + + if err := protojson.Unmarshal(data, msg); err != nil { + return err + } + + *r = *ResponseMetaHeaderFromGRPCMessage(msg) + + return nil +} diff --git a/v2/session/json_test.go b/v2/session/json_test.go index 78bd9d3..442395c 100644 --- a/v2/session/json_test.go +++ b/v2/session/json_test.go @@ -90,3 +90,15 @@ func TestRequestVerificationHeaderJSON(t *testing.T) { require.Equal(t, r, r2) } + +func TestResponseMetaHeaderJSON(t *testing.T) { + r := generateResponseMetaHeader(1) + + data, err := r.MarshalJSON() + require.NoError(t, err) + + r2 := new(session.ResponseMetaHeader) + require.NoError(t, r2.UnmarshalJSON(data)) + + require.Equal(t, r, r2) +} diff --git a/v2/session/marshal.go b/v2/session/marshal.go index fd48a5b..a10ee0f 100644 --- a/v2/session/marshal.go +++ b/v2/session/marshal.go @@ -679,6 +679,17 @@ func (r *ResponseMetaHeader) StableSize() (size int) { return size } +func (r *ResponseMetaHeader) Unmarshal(data []byte) error { + m := new(session.ResponseMetaHeader) + if err := goproto.Unmarshal(data, m); err != nil { + return err + } + + *r = *ResponseMetaHeaderFromGRPCMessage(m) + + return nil +} + func (r *ResponseVerificationHeader) StableMarshal(buf []byte) ([]byte, error) { if r == nil { return []byte{}, nil diff --git a/v2/session/marshal_test.go b/v2/session/marshal_test.go index 1e48cc9..4a79ef6 100644 --- a/v2/session/marshal_test.go +++ b/v2/session/marshal_test.go @@ -150,16 +150,14 @@ func TestResponseMetaHeader_StableMarshal(t *testing.T) { metaHeaderOrigin := generateResponseMetaHeader(10) metaHeaderFrom := generateResponseMetaHeader(20) metaHeaderFrom.SetOrigin(metaHeaderOrigin) - transport := new(grpc.ResponseMetaHeader) t.Run("non empty", func(t *testing.T) { wire, err := metaHeaderFrom.StableMarshal(nil) require.NoError(t, err) - err = goproto.Unmarshal(wire, transport) - require.NoError(t, err) + metaHeaderTo := new(session.ResponseMetaHeader) + require.NoError(t, metaHeaderTo.Unmarshal(wire)) - metaHeaderTo := session.ResponseMetaHeaderFromGRPCMessage(transport) require.Equal(t, metaHeaderFrom, metaHeaderTo) }) } From 6456fcf8fade90ce2895b6ace54ea6a4442e8357 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 13 Nov 2020 17:14:43 +0300 Subject: [PATCH 0560/1196] [#168] session: Implement binary/JSON encoders/decoders on ResponseVerify Signed-off-by: Leonard Lyubich --- v2/session/json.go | 20 ++++++++++++++++++++ v2/session/json_test.go | 12 ++++++++++++ v2/session/marshal.go | 11 +++++++++++ v2/session/marshal_test.go | 6 ++---- 4 files changed, 45 insertions(+), 4 deletions(-) diff --git a/v2/session/json.go b/v2/session/json.go index 36525d3..2dea2d4 100644 --- a/v2/session/json.go +++ b/v2/session/json.go @@ -164,3 +164,23 @@ func (r *ResponseMetaHeader) UnmarshalJSON(data []byte) error { return nil } + +func (r *ResponseVerificationHeader) MarshalJSON() ([]byte, error) { + return protojson.MarshalOptions{ + EmitUnpopulated: true, + }.Marshal( + ResponseVerificationHeaderToGRPCMessage(r), + ) +} + +func (r *ResponseVerificationHeader) UnmarshalJSON(data []byte) error { + msg := new(session.ResponseVerificationHeader) + + if err := protojson.Unmarshal(data, msg); err != nil { + return err + } + + *r = *ResponseVerificationHeaderFromGRPCMessage(msg) + + return nil +} diff --git a/v2/session/json_test.go b/v2/session/json_test.go index 442395c..00bf382 100644 --- a/v2/session/json_test.go +++ b/v2/session/json_test.go @@ -102,3 +102,15 @@ func TestResponseMetaHeaderJSON(t *testing.T) { require.Equal(t, r, r2) } + +func TestResponseVerificationHeaderJSON(t *testing.T) { + r := generateResponseVerificationHeader("key", "value") + + data, err := r.MarshalJSON() + require.NoError(t, err) + + r2 := new(session.ResponseVerificationHeader) + require.NoError(t, r2.UnmarshalJSON(data)) + + require.Equal(t, r, r2) +} diff --git a/v2/session/marshal.go b/v2/session/marshal.go index a10ee0f..568dfed 100644 --- a/v2/session/marshal.go +++ b/v2/session/marshal.go @@ -745,3 +745,14 @@ func (r *ResponseVerificationHeader) StableSize() (size int) { return size } + +func (r *ResponseVerificationHeader) Unmarshal(data []byte) error { + m := new(session.ResponseVerificationHeader) + if err := goproto.Unmarshal(data, m); err != nil { + return err + } + + *r = *ResponseVerificationHeaderFromGRPCMessage(m) + + return nil +} diff --git a/v2/session/marshal_test.go b/v2/session/marshal_test.go index 4a79ef6..a2b5d9d 100644 --- a/v2/session/marshal_test.go +++ b/v2/session/marshal_test.go @@ -166,16 +166,14 @@ func TestResponseVerificationHeader_StableMarshal(t *testing.T) { verifHeaderOrigin := generateResponseVerificationHeader("Key", "Inside") verifHeaderFrom := generateResponseVerificationHeader("Value", "Outside") verifHeaderFrom.SetOrigin(verifHeaderOrigin) - transport := new(grpc.ResponseVerificationHeader) t.Run("non empty", func(t *testing.T) { wire, err := verifHeaderFrom.StableMarshal(nil) require.NoError(t, err) - err = goproto.Unmarshal(wire, transport) - require.NoError(t, err) + verifHeaderTo := new(session.ResponseVerificationHeader) + require.NoError(t, verifHeaderTo.Unmarshal(wire)) - verifHeaderTo := session.ResponseVerificationHeaderFromGRPCMessage(transport) require.Equal(t, verifHeaderFrom, verifHeaderTo) }) } From 55948c2ab16a78f32e49304e8a03b3dae99d2588 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 13 Nov 2020 17:20:24 +0300 Subject: [PATCH 0561/1196] [#168] storageGroup: Implement binary/JSON encoders/decoders on SG Signed-off-by: Leonard Lyubich --- v2/storagegroup/json.go | 26 ++++++++++++++++++++++ v2/storagegroup/json_test.go | 20 +++++++++++++++++ v2/storagegroup/marshal.go | 13 +++++++++++ v2/storagegroup/marshal_test.go | 38 +++++++++++++++++---------------- 4 files changed, 79 insertions(+), 18 deletions(-) create mode 100644 v2/storagegroup/json.go create mode 100644 v2/storagegroup/json_test.go diff --git a/v2/storagegroup/json.go b/v2/storagegroup/json.go new file mode 100644 index 0000000..efdb311 --- /dev/null +++ b/v2/storagegroup/json.go @@ -0,0 +1,26 @@ +package storagegroup + +import ( + storagegroup "github.com/nspcc-dev/neofs-api-go/v2/storagegroup/grpc" + "google.golang.org/protobuf/encoding/protojson" +) + +func (s *StorageGroup) MarshalJSON() ([]byte, error) { + return protojson.MarshalOptions{ + EmitUnpopulated: true, + }.Marshal( + StorageGroupToGRPCMessage(s), + ) +} + +func (s *StorageGroup) UnmarshalJSON(data []byte) error { + msg := new(storagegroup.StorageGroup) + + if err := protojson.Unmarshal(data, msg); err != nil { + return err + } + + *s = *StorageGroupFromGRPCMessage(msg) + + return nil +} diff --git a/v2/storagegroup/json_test.go b/v2/storagegroup/json_test.go new file mode 100644 index 0000000..9da4920 --- /dev/null +++ b/v2/storagegroup/json_test.go @@ -0,0 +1,20 @@ +package storagegroup_test + +import ( + "testing" + + "github.com/nspcc-dev/neofs-api-go/v2/storagegroup" + "github.com/stretchr/testify/require" +) + +func TestStorageGroupJSON(t *testing.T) { + sg := generateSG() + + data, err := sg.MarshalJSON() + require.NoError(t, err) + + sg2 := new(storagegroup.StorageGroup) + require.NoError(t, sg2.UnmarshalJSON(data)) + + require.Equal(t, sg, sg2) +} diff --git a/v2/storagegroup/marshal.go b/v2/storagegroup/marshal.go index 33b0c15..bfcb896 100644 --- a/v2/storagegroup/marshal.go +++ b/v2/storagegroup/marshal.go @@ -2,6 +2,8 @@ package storagegroup import ( "github.com/nspcc-dev/neofs-api-go/util/proto" + storagegroup "github.com/nspcc-dev/neofs-api-go/v2/storagegroup/grpc" + goproto "google.golang.org/protobuf/proto" ) const ( @@ -76,3 +78,14 @@ func (s *StorageGroup) StableSize() (size int) { return size } + +func (s *StorageGroup) Unmarshal(data []byte) error { + m := new(storagegroup.StorageGroup) + if err := goproto.Unmarshal(data, m); err != nil { + return err + } + + *s = *StorageGroupFromGRPCMessage(m) + + return nil +} diff --git a/v2/storagegroup/marshal_test.go b/v2/storagegroup/marshal_test.go index f3f79b8..15f12c9 100644 --- a/v2/storagegroup/marshal_test.go +++ b/v2/storagegroup/marshal_test.go @@ -5,34 +5,19 @@ import ( "github.com/nspcc-dev/neofs-api-go/v2/refs" "github.com/nspcc-dev/neofs-api-go/v2/storagegroup" - grpc "github.com/nspcc-dev/neofs-api-go/v2/storagegroup/grpc" "github.com/stretchr/testify/require" - goproto "google.golang.org/protobuf/proto" ) func TestStorageGroup_StableMarshal(t *testing.T) { - ownerID1 := new(refs.ObjectID) - ownerID1.SetValue([]byte("Object ID 1")) - - ownerID2 := new(refs.ObjectID) - ownerID2.SetValue([]byte("Object ID 2")) - - storageGroupFrom := new(storagegroup.StorageGroup) - transport := new(grpc.StorageGroup) + storageGroupFrom := generateSG() t.Run("non empty", func(t *testing.T) { - storageGroupFrom.SetValidationDataSize(300) - storageGroupFrom.SetValidationHash(generateChecksum("Homomorphic hash")) - storageGroupFrom.SetExpirationEpoch(100) - storageGroupFrom.SetMembers([]*refs.ObjectID{ownerID1, ownerID2}) - wire, err := storageGroupFrom.StableMarshal(nil) require.NoError(t, err) - err = goproto.Unmarshal(wire, transport) - require.NoError(t, err) + storageGroupTo := new(storagegroup.StorageGroup) + require.NoError(t, storageGroupTo.Unmarshal(wire)) - storageGroupTo := storagegroup.StorageGroupFromGRPCMessage(transport) require.Equal(t, storageGroupFrom, storageGroupTo) }) } @@ -44,3 +29,20 @@ func generateChecksum(data string) *refs.Checksum { return checksum } + +func generateSG() *storagegroup.StorageGroup { + sg := new(storagegroup.StorageGroup) + + oid1 := new(refs.ObjectID) + oid1.SetValue([]byte("Object ID 1")) + + oid2 := new(refs.ObjectID) + oid2.SetValue([]byte("Object ID 2")) + + sg.SetValidationDataSize(300) + sg.SetValidationHash(generateChecksum("Homomorphic hash")) + sg.SetExpirationEpoch(100) + sg.SetMembers([]*refs.ObjectID{oid1, oid2}) + + return sg +} From f886d7556085e90d113875d3cd1bbd41838ae258 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Fri, 13 Nov 2020 18:04:03 +0300 Subject: [PATCH 0562/1196] [#168] pkg/object: Fix lint error on attribute receiver Signed-off-by: Alex Vanin --- pkg/object/attribute.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/pkg/object/attribute.go b/pkg/object/attribute.go index 6af3d21..dbedf69 100644 --- a/pkg/object/attribute.go +++ b/pkg/object/attribute.go @@ -48,30 +48,30 @@ func (a *Attribute) ToV2() *object.Attribute { // // Buffer is allocated when the argument is empty. // Otherwise, the first buffer is used. -func (d *Attribute) Marshal(b ...[]byte) ([]byte, error) { +func (a *Attribute) Marshal(b ...[]byte) ([]byte, error) { var buf []byte if len(b) > 0 { buf = b[0] } - return (*object.Attribute)(d). + return (*object.Attribute)(a). StableMarshal(buf) } // Unmarshal unmarshals protobuf binary representation of Attribute. -func (d *Attribute) Unmarshal(data []byte) error { - return (*object.Attribute)(d). +func (a *Attribute) Unmarshal(data []byte) error { + return (*object.Attribute)(a). Unmarshal(data) } // MarshalJSON encodes Attribute to protobuf JSON format. -func (d *Attribute) MarshalJSON() ([]byte, error) { - return (*object.Attribute)(d). +func (a *Attribute) MarshalJSON() ([]byte, error) { + return (*object.Attribute)(a). MarshalJSON() } // UnmarshalJSON decodes Attribute from protobuf JSON format. -func (d *Attribute) UnmarshalJSON(data []byte) error { - return (*object.Attribute)(d). +func (a *Attribute) UnmarshalJSON(data []byte) error { + return (*object.Attribute)(a). UnmarshalJSON(data) } From 2bcbd48972f8d07b880063e40485adea34ba37ab Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 16 Nov 2020 11:08:47 +0300 Subject: [PATCH 0563/1196] [#197] sdk: Rename getters of Version type Signed-off-by: Leonard Lyubich --- pkg/client/accounting.go | 2 +- pkg/client/container.go | 12 ++++++------ pkg/client/netmap.go | 4 ++-- pkg/client/object.go | 14 +++++++------- pkg/client/session.go | 2 +- pkg/version.go | 18 +++++++++--------- pkg/version_test.go | 8 ++++---- 7 files changed, 30 insertions(+), 30 deletions(-) diff --git a/pkg/client/accounting.go b/pkg/client/accounting.go index b9e8660..0b553f2 100644 --- a/pkg/client/accounting.go +++ b/pkg/client/accounting.go @@ -25,7 +25,7 @@ func (c Client) GetSelfBalance(ctx context.Context, opts ...CallOption) (*accoun func (c Client) GetBalance(ctx context.Context, owner *owner.ID, opts ...CallOption) (*accounting.Decimal, error) { // check remote node version - switch c.remoteNode.Version.GetMajor() { + switch c.remoteNode.Version.Major() { case 2: return c.getBalanceV2(ctx, owner, opts...) default: diff --git a/pkg/client/container.go b/pkg/client/container.go index a4bc942..279a340 100644 --- a/pkg/client/container.go +++ b/pkg/client/container.go @@ -27,7 +27,7 @@ func (c delContainerSignWrapper) SignedDataSize() int { } func (c Client) PutContainer(ctx context.Context, cnr *container.Container, opts ...CallOption) (*container.ID, error) { - switch c.remoteNode.Version.GetMajor() { + switch c.remoteNode.Version.Major() { case 2: return c.putContainerV2(ctx, cnr, opts...) default: @@ -36,7 +36,7 @@ func (c Client) PutContainer(ctx context.Context, cnr *container.Container, opts } func (c Client) GetContainer(ctx context.Context, id *container.ID, opts ...CallOption) (*container.Container, error) { - switch c.remoteNode.Version.GetMajor() { + switch c.remoteNode.Version.Major() { case 2: return c.getContainerV2(ctx, id, opts...) default: @@ -45,7 +45,7 @@ func (c Client) GetContainer(ctx context.Context, id *container.ID, opts ...Call } func (c Client) ListContainers(ctx context.Context, owner *owner.ID, opts ...CallOption) ([]*container.ID, error) { - switch c.remoteNode.Version.GetMajor() { + switch c.remoteNode.Version.Major() { case 2: return c.listContainerV2(ctx, owner, opts...) default: @@ -66,7 +66,7 @@ func (c Client) ListSelfContainers(ctx context.Context, opts ...CallOption) ([]* } func (c Client) DeleteContainer(ctx context.Context, id *container.ID, opts ...CallOption) error { - switch c.remoteNode.Version.GetMajor() { + switch c.remoteNode.Version.Major() { case 2: return c.delContainerV2(ctx, id, opts...) default: @@ -75,7 +75,7 @@ func (c Client) DeleteContainer(ctx context.Context, id *container.ID, opts ...C } func (c Client) GetEACL(ctx context.Context, id *container.ID, opts ...CallOption) (*eacl.Table, error) { - switch c.remoteNode.Version.GetMajor() { + switch c.remoteNode.Version.Major() { case 2: return c.getEACLV2(ctx, id, opts...) default: @@ -84,7 +84,7 @@ func (c Client) GetEACL(ctx context.Context, id *container.ID, opts ...CallOptio } func (c Client) SetEACL(ctx context.Context, eacl *eacl.Table, opts ...CallOption) error { - switch c.remoteNode.Version.GetMajor() { + switch c.remoteNode.Version.Major() { case 2: return c.setEACLV2(ctx, eacl, opts...) default: diff --git a/pkg/client/netmap.go b/pkg/client/netmap.go index ea71b05..81ed41b 100644 --- a/pkg/client/netmap.go +++ b/pkg/client/netmap.go @@ -14,7 +14,7 @@ import ( // in client constructor via address or open connection. This can be used as a // health check to see if node is alive and responses to requests. func (c Client) EndpointInfo(ctx context.Context, opts ...CallOption) (*netmap.NodeInfo, error) { - switch c.remoteNode.Version.GetMajor() { + switch c.remoteNode.Version.Major() { case 2: resp, err := c.endpointInfoV2(ctx, opts...) if err != nil { @@ -29,7 +29,7 @@ func (c Client) EndpointInfo(ctx context.Context, opts ...CallOption) (*netmap.N // Epoch returns the epoch number from the local state of the remote host. func (c Client) Epoch(ctx context.Context, opts ...CallOption) (uint64, error) { - switch c.remoteNode.Version.GetMajor() { + switch c.remoteNode.Version.Major() { case 2: resp, err := c.endpointInfoV2(ctx, opts...) if err != nil { diff --git a/pkg/client/object.go b/pkg/client/object.go index 5d29e5d..4ce865f 100644 --- a/pkg/client/object.go +++ b/pkg/client/object.go @@ -144,7 +144,7 @@ func (p *PutObjectParams) WithPayloadReader(v io.Reader) *PutObjectParams { func (c *Client) PutObject(ctx context.Context, p *PutObjectParams, opts ...CallOption) (*object.ID, error) { // check remote node version - switch c.remoteNode.Version.GetMajor() { + switch c.remoteNode.Version.Major() { case 2: return c.putObjectV2(ctx, p, opts...) default: @@ -264,7 +264,7 @@ func (p *DeleteObjectParams) WithAddress(v *object.Address) *DeleteObjectParams func (c *Client) DeleteObject(ctx context.Context, p *DeleteObjectParams, opts ...CallOption) error { // check remote node version - switch c.remoteNode.Version.GetMajor() { + switch c.remoteNode.Version.Major() { case 2: return c.deleteObjectV2(ctx, p, opts...) default: @@ -344,7 +344,7 @@ func (p *GetObjectParams) WithPayloadWriter(w io.Writer) *GetObjectParams { func (c *Client) GetObject(ctx context.Context, p *GetObjectParams, opts ...CallOption) (*object.Object, error) { // check remote node version - switch c.remoteNode.Version.GetMajor() { + switch c.remoteNode.Version.Major() { case 2: return c.getObjectV2(ctx, p, opts...) default: @@ -477,7 +477,7 @@ func (p *ObjectHeaderParams) WithMainFields() *ObjectHeaderParams { func (c *Client) GetObjectHeader(ctx context.Context, p *ObjectHeaderParams, opts ...CallOption) (*object.Object, error) { // check remote node version - switch c.remoteNode.Version.GetMajor() { + switch c.remoteNode.Version.Major() { case 2: return c.getObjectHeaderV2(ctx, p, opts...) default: @@ -610,7 +610,7 @@ func (p *RangeDataParams) WithDataWriter(v io.Writer) *RangeDataParams { func (c *Client) ObjectPayloadRangeData(ctx context.Context, p *RangeDataParams, opts ...CallOption) ([]byte, error) { // check remote node version - switch c.remoteNode.Version.GetMajor() { + switch c.remoteNode.Version.Major() { case 2: return c.objectPayloadRangeV2(ctx, p, opts...) default: @@ -752,7 +752,7 @@ func (c *Client) ObjectPayloadRangeTZ(ctx context.Context, p *RangeChecksumParam func (c *Client) objectPayloadRangeHash(ctx context.Context, p *RangeChecksumParams, opts ...CallOption) (interface{}, error) { // check remote node version - switch c.remoteNode.Version.GetMajor() { + switch c.remoteNode.Version.Major() { case 2: return c.objectPayloadRangeHashV2(ctx, p, opts...) default: @@ -884,7 +884,7 @@ func (p *SearchObjectParams) WithSearchFilters(v object.SearchFilters) *SearchOb func (c *Client) SearchObject(ctx context.Context, p *SearchObjectParams, opts ...CallOption) ([]*object.ID, error) { // check remote node version - switch c.remoteNode.Version.GetMajor() { + switch c.remoteNode.Version.Major() { case 2: return c.searchObjectV2(ctx, p, opts...) default: diff --git a/pkg/client/session.go b/pkg/client/session.go index 51d08ce..e845b0d 100644 --- a/pkg/client/session.go +++ b/pkg/client/session.go @@ -12,7 +12,7 @@ import ( ) func (c Client) CreateSession(ctx context.Context, expiration uint64, opts ...CallOption) (*token.SessionToken, error) { - switch c.remoteNode.Version.GetMajor() { + switch c.remoteNode.Version.Major() { case 2: return c.createSessionV2(ctx, expiration, opts...) default: diff --git a/pkg/version.go b/pkg/version.go index c72722d..1d5f5f7 100644 --- a/pkg/version.go +++ b/pkg/version.go @@ -34,8 +34,8 @@ func SDKVersion() *Version { return v } -// GetMajor returns major number of the revision. -func (v *Version) GetMajor() uint32 { +// Major returns major number of the revision. +func (v *Version) Major() uint32 { return (*refs.Version)(v). GetMajor() } @@ -46,8 +46,8 @@ func (v *Version) SetMajor(val uint32) { SetMajor(val) } -// GetMinor returns minor number of the revision. -func (v *Version) GetMinor() uint32 { +// Minor returns minor number of the revision. +func (v *Version) Minor() uint32 { return (*refs.Version)(v). GetMinor() } @@ -64,22 +64,22 @@ func (v *Version) ToV2() *refs.Version { } func (v *Version) String() string { - return fmt.Sprintf("v%d.%d", v.GetMajor(), v.GetMinor()) + return fmt.Sprintf("v%d.%d", v.Major(), v.Minor()) } // IsSupportedVersion returns error if v is not supported by current SDK. func IsSupportedVersion(v *Version) error { - switch mjr := v.GetMajor(); mjr { + switch mjr := v.Major(); mjr { case 2: - switch mnr := v.GetMinor(); mnr { + switch mnr := v.Minor(); mnr { case 0: return nil } } return errors.Errorf("unsupported version %d.%d", - v.GetMajor(), - v.GetMinor(), + v.Major(), + v.Minor(), ) } diff --git a/pkg/version_test.go b/pkg/version_test.go index ce8b883..73ee6ff 100644 --- a/pkg/version_test.go +++ b/pkg/version_test.go @@ -14,8 +14,8 @@ func TestNewVersionFromV2(t *testing.T) { v.SetMajor(mjr) v.SetMinor(mnr) - require.Equal(t, mjr, v.GetMajor()) - require.Equal(t, mnr, v.GetMinor()) + require.Equal(t, mjr, v.Major()) + require.Equal(t, mnr, v.Minor()) ver := v.ToV2() @@ -26,8 +26,8 @@ func TestNewVersionFromV2(t *testing.T) { func TestSDKVersion(t *testing.T) { v := SDKVersion() - require.Equal(t, uint32(sdkMjr), v.GetMajor()) - require.Equal(t, uint32(sdkMnr), v.GetMinor()) + require.Equal(t, uint32(sdkMjr), v.Major()) + require.Equal(t, uint32(sdkMnr), v.Minor()) } func TestIsSupportedVersion(t *testing.T) { From 2afc6843135d4cdd8c5a3824151bb9bcb624ee88 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 16 Nov 2020 11:19:03 +0300 Subject: [PATCH 0564/1196] [#197] sdk: Rename getters of Signature type Signed-off-by: Leonard Lyubich --- pkg/object/fmt.go | 2 +- pkg/object/fmt_test.go | 8 ++++---- pkg/signature.go | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/pkg/object/fmt.go b/pkg/object/fmt.go index 04cb5f4..637fa22 100644 --- a/pkg/object/fmt.go +++ b/pkg/object/fmt.go @@ -119,7 +119,7 @@ func VerifyIDSignature(obj *Object) error { func() ([]byte, []byte) { sig := obj.GetSignature() - return sig.GetKey(), sig.GetSign() + return sig.Key(), sig.Sign() }, ) } diff --git a/pkg/object/fmt_test.go b/pkg/object/fmt_test.go index 5a65e49..2f94b37 100644 --- a/pkg/object/fmt_test.go +++ b/pkg/object/fmt_test.go @@ -51,18 +51,18 @@ func TestVerificationFields(t *testing.T) { }, { corrupt: func() { - obj.GetSignature().GetKey()[0]++ + obj.GetSignature().Key()[0]++ }, restore: func() { - obj.GetSignature().GetKey()[0]-- + obj.GetSignature().Key()[0]-- }, }, { corrupt: func() { - obj.GetSignature().GetSign()[0]++ + obj.GetSignature().Sign()[0]++ }, restore: func() { - obj.GetSignature().GetSign()[0]-- + obj.GetSignature().Sign()[0]-- }, }, } diff --git a/pkg/signature.go b/pkg/signature.go index 992b183..7cf318d 100644 --- a/pkg/signature.go +++ b/pkg/signature.go @@ -19,8 +19,8 @@ func NewSignature() *Signature { return NewSignatureFromV2(new(refs.Signature)) } -// GetKey sets binary public key. -func (s *Signature) GetKey() []byte { +// Key sets binary public key. +func (s *Signature) Key() []byte { return (*refs.Signature)(s).GetKey() } @@ -29,8 +29,8 @@ func (s *Signature) SetKey(v []byte) { (*refs.Signature)(s).SetKey(v) } -// GetSign return signature value. -func (s *Signature) GetSign() []byte { +// Sign return signature value. +func (s *Signature) Sign() []byte { return (*refs.Signature)(s).GetSign() } From 9f0bc50e539f4b00bba2eeeb5037f41e11a69e3d Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 16 Nov 2020 11:21:28 +0300 Subject: [PATCH 0565/1196] [#197] sdk: Rename getters of Checksum type Signed-off-by: Leonard Lyubich --- pkg/checksum.go | 10 +++++----- pkg/checksum_test.go | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/pkg/checksum.go b/pkg/checksum.go index 4182b71..72087a7 100644 --- a/pkg/checksum.go +++ b/pkg/checksum.go @@ -37,8 +37,8 @@ func NewChecksum() *Checksum { return NewChecksumFromV2(new(refs.Checksum)) } -// GetType returns checksum type. -func (c *Checksum) GetType() ChecksumType { +// Type returns checksum type. +func (c *Checksum) Type() ChecksumType { switch (*refs.Checksum)(c).GetType() { case refs.SHA256: return ChecksumSHA256 @@ -49,8 +49,8 @@ func (c *Checksum) GetType() ChecksumType { } } -// GetSum returns checksum bytes. -func (c *Checksum) GetSum() []byte { +// Sum returns checksum bytes. +func (c *Checksum) Sum() []byte { return (*refs.Checksum)(c).GetSum() } @@ -75,7 +75,7 @@ func (c *Checksum) ToV2() *refs.Checksum { } func EqualChecksums(cs1, cs2 *Checksum) bool { - return cs1.GetType() == cs2.GetType() && bytes.Equal(cs1.GetSum(), cs2.GetSum()) + return cs1.Type() == cs2.Type() && bytes.Equal(cs1.Sum(), cs2.Sum()) } // Marshal marshals Checksum into a protobuf binary form. diff --git a/pkg/checksum_test.go b/pkg/checksum_test.go index 9d402a4..41cc9d3 100644 --- a/pkg/checksum_test.go +++ b/pkg/checksum_test.go @@ -25,8 +25,8 @@ func TestChecksum(t *testing.T) { c.SetSHA256(cSHA256) - require.Equal(t, ChecksumSHA256, c.GetType()) - require.Equal(t, cSHA256[:], c.GetSum()) + require.Equal(t, ChecksumSHA256, c.Type()) + require.Equal(t, cSHA256[:], c.Sum()) cV2 := c.ToV2() @@ -38,8 +38,8 @@ func TestChecksum(t *testing.T) { c.SetTillichZemor(cTZ) - require.Equal(t, ChecksumTZ, c.GetType()) - require.Equal(t, cTZ[:], c.GetSum()) + require.Equal(t, ChecksumTZ, c.Type()) + require.Equal(t, cTZ[:], c.Sum()) cV2 = c.ToV2() From 67bcf6eb4d2c1bae77d4534227465134467cd825 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 16 Nov 2020 11:42:19 +0300 Subject: [PATCH 0566/1196] [#197] sdk/object: Rename getters of Address type Signed-off-by: Leonard Lyubich --- pkg/client/object.go | 2 +- pkg/object/address.go | 12 ++++++------ pkg/object/address_test.go | 8 ++++---- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/pkg/client/object.go b/pkg/client/object.go index 4ce865f..11296e1 100644 --- a/pkg/client/object.go +++ b/pkg/client/object.go @@ -578,7 +578,7 @@ func (c *Client) getObjectHeaderV2(ctx context.Context, p *ObjectHeaderParams, o obj.SetHeader(hdr) raw := object.NewRawFromV2(obj) - raw.SetID(p.addr.GetObjectID()) + raw.SetID(p.addr.ObjectID()) // convert the object return raw.Object(), nil diff --git a/pkg/object/address.go b/pkg/object/address.go index 9f61c9f..7f2bfe7 100644 --- a/pkg/object/address.go +++ b/pkg/object/address.go @@ -37,8 +37,8 @@ func (a *Address) ToV2() *refs.Address { return (*refs.Address)(a) } -// GetContainerID returns container identifier. -func (a *Address) GetContainerID() *container.ID { +// ContainerID returns container identifier. +func (a *Address) ContainerID() *container.ID { return container.NewIDFromV2( (*refs.Address)(a).GetContainerID(), ) @@ -49,8 +49,8 @@ func (a *Address) SetContainerID(id *container.ID) { (*refs.Address)(a).SetContainerID(id.ToV2()) } -// GetObjectID returns object identifier. -func (a *Address) GetObjectID() *ID { +// ObjectID returns object identifier. +func (a *Address) ObjectID() *ID { return NewIDFromV2( (*refs.Address)(a).GetObjectID(), ) @@ -87,8 +87,8 @@ func (a *Address) Parse(s string) error { // String returns string representation of Object.Address. func (a *Address) String() string { return strings.Join([]string{ - a.GetContainerID().String(), - a.GetObjectID().String(), + a.ContainerID().String(), + a.ObjectID().String(), }, addressSeparator) } diff --git a/pkg/object/address_test.go b/pkg/object/address_test.go index aa67e58..d031670 100644 --- a/pkg/object/address_test.go +++ b/pkg/object/address_test.go @@ -16,7 +16,7 @@ func TestAddress_SetContainerID(t *testing.T) { a.SetContainerID(cid) - require.Equal(t, cid, a.GetContainerID()) + require.Equal(t, cid, a.ContainerID()) } func TestAddress_SetObjectID(t *testing.T) { @@ -26,7 +26,7 @@ func TestAddress_SetObjectID(t *testing.T) { a.SetObjectID(oid) - require.Equal(t, oid, a.GetObjectID()) + require.Equal(t, oid, a.ObjectID()) } func TestAddress_Parse(t *testing.T) { @@ -41,8 +41,8 @@ func TestAddress_Parse(t *testing.T) { a := NewAddress() require.NoError(t, a.Parse(s)) - require.Equal(t, oid, a.GetObjectID()) - require.Equal(t, cid, a.GetContainerID()) + require.Equal(t, oid, a.ObjectID()) + require.Equal(t, cid, a.ContainerID()) }) t.Run("should fail for bad address", func(t *testing.T) { From 5f5e5ac5dd7812358f511a491a1338544faad11b Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 16 Nov 2020 11:48:38 +0300 Subject: [PATCH 0567/1196] [#197] sdk/object: Rename getters of Attribute and Object types Signed-off-by: Leonard Lyubich --- pkg/client/object.go | 4 +-- pkg/object/attribute.go | 8 ++--- pkg/object/attribute_test.go | 4 +-- pkg/object/fmt.go | 14 ++++---- pkg/object/fmt_test.go | 16 ++++----- pkg/object/raw_test.go | 50 +++++++++++++------------- pkg/object/rw.go | 68 ++++++++++++++++++------------------ 7 files changed, 82 insertions(+), 82 deletions(-) diff --git a/pkg/client/object.go b/pkg/client/object.go index 11296e1..527a619 100644 --- a/pkg/client/object.go +++ b/pkg/client/object.go @@ -180,8 +180,8 @@ func (c *Client) putObjectV2(ctx context.Context, p *PutObjectParams, opts ...Ca req.SetBody(body) v2Addr := new(v2refs.Address) - v2Addr.SetObjectID(p.obj.GetID().ToV2()) - v2Addr.SetContainerID(p.obj.GetContainerID().ToV2()) + v2Addr.SetObjectID(p.obj.ID().ToV2()) + v2Addr.SetContainerID(p.obj.ContainerID().ToV2()) // set meta header meta := v2MetaHeaderFromOpts(callOpts) diff --git a/pkg/object/attribute.go b/pkg/object/attribute.go index dbedf69..cbc318d 100644 --- a/pkg/object/attribute.go +++ b/pkg/object/attribute.go @@ -19,8 +19,8 @@ func NewAttribute() *Attribute { return NewAttributeFromV2(new(object.Attribute)) } -// GetKey returns key to the object attribute. -func (a *Attribute) GetKey() string { +// Key returns key to the object attribute. +func (a *Attribute) Key() string { return (*object.Attribute)(a).GetKey() } @@ -29,8 +29,8 @@ func (a *Attribute) SetKey(v string) { (*object.Attribute)(a).SetKey(v) } -// GetValue return value of the object attribute. -func (a *Attribute) GetValue() string { +// Value return value of the object attribute. +func (a *Attribute) Value() string { return (*object.Attribute)(a).GetValue() } diff --git a/pkg/object/attribute_test.go b/pkg/object/attribute_test.go index 500ec2c..a4ab8ae 100644 --- a/pkg/object/attribute_test.go +++ b/pkg/object/attribute_test.go @@ -13,8 +13,8 @@ func TestAttribute(t *testing.T) { a.SetKey(key) a.SetValue(val) - require.Equal(t, key, a.GetKey()) - require.Equal(t, val, a.GetValue()) + require.Equal(t, key, a.Key()) + require.Equal(t, val, a.Value()) aV2 := a.ToV2() diff --git a/pkg/object/fmt.go b/pkg/object/fmt.go index 637fa22..0432195 100644 --- a/pkg/object/fmt.go +++ b/pkg/object/fmt.go @@ -23,7 +23,7 @@ func CalculatePayloadChecksum(payload []byte) *pkg.Checksum { // object payload and writes it to the object. func CalculateAndSetPayloadChecksum(obj *RawObject) { obj.SetPayloadChecksum( - CalculatePayloadChecksum(obj.GetPayload()), + CalculatePayloadChecksum(obj.Payload()), ) } @@ -31,8 +31,8 @@ func CalculateAndSetPayloadChecksum(obj *RawObject) { // corresponds to its payload. func VerifyPayloadChecksum(obj *Object) error { if !pkg.EqualChecksums( - obj.GetPayloadChecksum(), - CalculatePayloadChecksum(obj.GetPayload()), + obj.PayloadChecksum(), + CalculatePayloadChecksum(obj.Payload()), ) { return errors.New("payload checksum mismatch") } @@ -74,7 +74,7 @@ func VerifyID(obj *Object) error { return err } - if !id.Equal(obj.GetID()) { + if !id.Equal(obj.ID()) { return errors.New("incorrect object identifier") } @@ -101,7 +101,7 @@ func CalculateIDSignature(key *ecdsa.PrivateKey, id *ID) (*pkg.Signature, error) } func CalculateAndSetSignature(key *ecdsa.PrivateKey, obj *RawObject) error { - sig, err := CalculateIDSignature(key, obj.GetID()) + sig, err := CalculateIDSignature(key, obj.ID()) if err != nil { return err } @@ -114,10 +114,10 @@ func CalculateAndSetSignature(key *ecdsa.PrivateKey, obj *RawObject) error { func VerifyIDSignature(obj *Object) error { return signature.VerifyDataWithSource( signatureV2.StableMarshalerWrapper{ - SM: obj.GetID().ToV2(), + SM: obj.ID().ToV2(), }, func() ([]byte, []byte) { - sig := obj.GetSignature() + sig := obj.Signature() return sig.Key(), sig.Sign() }, diff --git a/pkg/object/fmt_test.go b/pkg/object/fmt_test.go index 2f94b37..b1731c9 100644 --- a/pkg/object/fmt_test.go +++ b/pkg/object/fmt_test.go @@ -35,34 +35,34 @@ func TestVerificationFields(t *testing.T) { }, { corrupt: func() { - obj.SetPayloadSize(obj.GetPayloadSize() + 1) + obj.SetPayloadSize(obj.PayloadSize() + 1) }, restore: func() { - obj.SetPayloadSize(obj.GetPayloadSize() - 1) + obj.SetPayloadSize(obj.PayloadSize() - 1) }, }, { corrupt: func() { - obj.GetID().ToV2().GetValue()[0]++ + obj.ID().ToV2().GetValue()[0]++ }, restore: func() { - obj.GetID().ToV2().GetValue()[0]-- + obj.ID().ToV2().GetValue()[0]-- }, }, { corrupt: func() { - obj.GetSignature().Key()[0]++ + obj.Signature().Key()[0]++ }, restore: func() { - obj.GetSignature().Key()[0]-- + obj.Signature().Key()[0]-- }, }, { corrupt: func() { - obj.GetSignature().Sign()[0]++ + obj.Signature().Sign()[0]++ }, restore: func() { - obj.GetSignature().Sign()[0]-- + obj.Signature().Sign()[0]-- }, }, } diff --git a/pkg/object/raw_test.go b/pkg/object/raw_test.go index 1c40ea9..2aabca4 100644 --- a/pkg/object/raw_test.go +++ b/pkg/object/raw_test.go @@ -48,7 +48,7 @@ func TestRawObject_SetID(t *testing.T) { obj.SetID(id) - require.Equal(t, id, obj.GetID()) + require.Equal(t, id, obj.ID()) } func TestRawObject_SetSignature(t *testing.T) { @@ -60,7 +60,7 @@ func TestRawObject_SetSignature(t *testing.T) { obj.SetSignature(sig) - require.Equal(t, sig, obj.GetSignature()) + require.Equal(t, sig, obj.Signature()) } func TestRawObject_SetPayload(t *testing.T) { @@ -71,7 +71,7 @@ func TestRawObject_SetPayload(t *testing.T) { obj.SetPayload(payload) - require.Equal(t, payload, obj.GetPayload()) + require.Equal(t, payload, obj.Payload()) } func TestRawObject_SetVersion(t *testing.T) { @@ -83,7 +83,7 @@ func TestRawObject_SetVersion(t *testing.T) { obj.SetVersion(ver) - require.Equal(t, ver, obj.GetVersion()) + require.Equal(t, ver, obj.Version()) } func TestRawObject_SetPayloadSize(t *testing.T) { @@ -92,7 +92,7 @@ func TestRawObject_SetPayloadSize(t *testing.T) { sz := uint64(133) obj.SetPayloadSize(sz) - require.Equal(t, sz, obj.GetPayloadSize()) + require.Equal(t, sz, obj.PayloadSize()) } func TestRawObject_SetContainerID(t *testing.T) { @@ -105,7 +105,7 @@ func TestRawObject_SetContainerID(t *testing.T) { obj.SetContainerID(cid) - require.Equal(t, cid, obj.GetContainerID()) + require.Equal(t, cid, obj.ContainerID()) } func TestRawObject_SetOwnerID(t *testing.T) { @@ -119,7 +119,7 @@ func TestRawObject_SetOwnerID(t *testing.T) { obj.SetOwnerID(ownerID) - require.Equal(t, ownerID, obj.GetOwnerID()) + require.Equal(t, ownerID, obj.OwnerID()) } func TestRawObject_SetCreationEpoch(t *testing.T) { @@ -128,7 +128,7 @@ func TestRawObject_SetCreationEpoch(t *testing.T) { creat := uint64(228) obj.setCreationEpoch(creat) - require.Equal(t, creat, obj.GetCreationEpoch()) + require.Equal(t, creat, obj.CreationEpoch()) } func TestRawObject_SetPayloadChecksum(t *testing.T) { @@ -139,7 +139,7 @@ func TestRawObject_SetPayloadChecksum(t *testing.T) { obj.SetPayloadChecksum(cs) - require.Equal(t, cs, obj.GetPayloadChecksum()) + require.Equal(t, cs, obj.PayloadChecksum()) } func TestRawObject_SetPayloadHomomorphicHash(t *testing.T) { @@ -150,7 +150,7 @@ func TestRawObject_SetPayloadHomomorphicHash(t *testing.T) { obj.SetPayloadHomomorphicHash(cs) - require.Equal(t, cs, obj.GetPayloadHomomorphicHash()) + require.Equal(t, cs, obj.PayloadHomomorphicHash()) } func TestRawObject_SetAttributes(t *testing.T) { @@ -166,7 +166,7 @@ func TestRawObject_SetAttributes(t *testing.T) { obj.SetAttributes(a1, a2) - require.Equal(t, []*Attribute{a1, a2}, obj.GetAttributes()) + require.Equal(t, []*Attribute{a1, a2}, obj.Attributes()) } func TestRawObject_SetPreviousID(t *testing.T) { @@ -176,7 +176,7 @@ func TestRawObject_SetPreviousID(t *testing.T) { obj.SetPreviousID(prev) - require.Equal(t, prev, obj.GetPreviousID()) + require.Equal(t, prev, obj.PreviousID()) } func TestRawObject_SetChildren(t *testing.T) { @@ -187,13 +187,13 @@ func TestRawObject_SetChildren(t *testing.T) { obj.SetChildren(id1, id2) - require.Equal(t, []*ID{id1, id2}, obj.GetChildren()) + require.Equal(t, []*ID{id1, id2}, obj.Children()) } func TestRawObject_SetParent(t *testing.T) { obj := NewRaw() - require.Nil(t, obj.GetParent()) + require.Nil(t, obj.Parent()) par := NewRaw() par.SetID(randID(t)) @@ -204,7 +204,7 @@ func TestRawObject_SetParent(t *testing.T) { obj.SetParent(parObj) - require.Equal(t, parObj, obj.GetParent()) + require.Equal(t, parObj, obj.Parent()) } func TestRawObject_ToV2(t *testing.T) { @@ -224,7 +224,7 @@ func TestRawObject_SetSessionToken(t *testing.T) { obj.SetSessionToken(tok) - require.Equal(t, tok, obj.GetSessionToken()) + require.Equal(t, tok, obj.SessionToken()) } func TestRawObject_SetType(t *testing.T) { @@ -234,7 +234,7 @@ func TestRawObject_SetType(t *testing.T) { obj.SetType(typ) - require.Equal(t, typ, obj.GetType()) + require.Equal(t, typ, obj.Type()) } func TestRawObject_CutPayload(t *testing.T) { @@ -248,20 +248,20 @@ func TestRawObject_CutPayload(t *testing.T) { o2 := o1.CutPayload() - require.Equal(t, sz, o2.GetPayloadSize()) - require.Empty(t, o2.GetPayload()) + require.Equal(t, sz, o2.PayloadSize()) + require.Empty(t, o2.Payload()) sz++ o1.SetPayloadSize(sz) - require.Equal(t, sz, o1.GetPayloadSize()) - require.Equal(t, sz, o2.GetPayloadSize()) + require.Equal(t, sz, o1.PayloadSize()) + require.Equal(t, sz, o2.PayloadSize()) p2 := []byte{4, 5, 6} o2.SetPayload(p2) - require.Equal(t, p2, o2.GetPayload()) - require.Equal(t, p1, o1.GetPayload()) + require.Equal(t, p2, o2.Payload()) + require.Equal(t, p1, o1.Payload()) } func TestRawObject_SetParentID(t *testing.T) { @@ -270,7 +270,7 @@ func TestRawObject_SetParentID(t *testing.T) { id := randID(t) obj.setParentID(id) - require.Equal(t, id, obj.GetParentID()) + require.Equal(t, id, obj.ParentID()) } func TestRawObject_ResetRelations(t *testing.T) { @@ -280,7 +280,7 @@ func TestRawObject_ResetRelations(t *testing.T) { obj.ResetRelations() - require.Nil(t, obj.GetPreviousID()) + require.Nil(t, obj.PreviousID()) } func TestRwObject_HasParent(t *testing.T) { diff --git a/pkg/object/rw.go b/pkg/object/rw.go index 8d0380c..e6be2e5 100644 --- a/pkg/object/rw.go +++ b/pkg/object/rw.go @@ -42,8 +42,8 @@ func (o *rwObject) setSplitFields(setter func(*object.SplitHeader)) { }) } -// GetID returns object identifier. -func (o *rwObject) GetID() *ID { +// ID returns object identifier. +func (o *rwObject) ID() *ID { return NewIDFromV2( (*object.Object)(o). GetObjectID(), @@ -55,8 +55,8 @@ func (o *rwObject) setID(v *ID) { SetObjectID(v.ToV2()) } -// GetSignature returns signature of the object identifier. -func (o *rwObject) GetSignature() *pkg.Signature { +// Signature returns signature of the object identifier. +func (o *rwObject) Signature() *pkg.Signature { return pkg.NewSignatureFromV2( (*object.Object)(o). GetSignature(), @@ -68,8 +68,8 @@ func (o *rwObject) setSignature(v *pkg.Signature) { SetSignature(v.ToV2()) } -// GetPayload returns payload bytes. -func (o *rwObject) GetPayload() []byte { +// Payload returns payload bytes. +func (o *rwObject) Payload() []byte { return (*object.Object)(o). GetPayload() } @@ -79,8 +79,8 @@ func (o *rwObject) setPayload(v []byte) { SetPayload(v) } -// GetVersion returns version of the object. -func (o *rwObject) GetVersion() *pkg.Version { +// Version returns version of the object. +func (o *rwObject) Version() *pkg.Version { return pkg.NewVersionFromV2( (*object.Object)(o). GetHeader(). @@ -94,8 +94,8 @@ func (o *rwObject) setVersion(v *pkg.Version) { }) } -// GetPayloadSize returns payload length of the object. -func (o *rwObject) GetPayloadSize() uint64 { +// PayloadSize returns payload length of the object. +func (o *rwObject) PayloadSize() uint64 { return (*object.Object)(o). GetHeader(). GetPayloadLength() @@ -107,8 +107,8 @@ func (o *rwObject) setPayloadSize(v uint64) { }) } -// GetContainerID returns identifier of the related container. -func (o *rwObject) GetContainerID() *container.ID { +// ContainerID returns identifier of the related container. +func (o *rwObject) ContainerID() *container.ID { return container.NewIDFromV2( (*object.Object)(o). GetHeader(). @@ -122,8 +122,8 @@ func (o *rwObject) setContainerID(v *container.ID) { }) } -// GetOwnerID returns identifier of the object owner. -func (o *rwObject) GetOwnerID() *owner.ID { +// OwnerID returns identifier of the object owner. +func (o *rwObject) OwnerID() *owner.ID { return owner.NewIDFromV2( (*object.Object)(o). GetHeader(). @@ -137,8 +137,8 @@ func (o *rwObject) setOwnerID(v *owner.ID) { }) } -// GetCreationEpoch returns epoch number in which object was created. -func (o *rwObject) GetCreationEpoch() uint64 { +// CreationEpoch returns epoch number in which object was created. +func (o *rwObject) CreationEpoch() uint64 { return (*object.Object)(o). GetHeader(). GetCreationEpoch() @@ -150,8 +150,8 @@ func (o *rwObject) setCreationEpoch(v uint64) { }) } -// GetPayloadChecksum returns checksum of the object payload. -func (o *rwObject) GetPayloadChecksum() *pkg.Checksum { +// PayloadChecksum returns checksum of the object payload. +func (o *rwObject) PayloadChecksum() *pkg.Checksum { return pkg.NewChecksumFromV2( (*object.Object)(o). GetHeader(). @@ -165,8 +165,8 @@ func (o *rwObject) setPayloadChecksum(v *pkg.Checksum) { }) } -// GetPayloadHomomorphicHash returns homomorphic hash of the object payload. -func (o *rwObject) GetPayloadHomomorphicHash() *pkg.Checksum { +// PayloadHomomorphicHash returns homomorphic hash of the object payload. +func (o *rwObject) PayloadHomomorphicHash() *pkg.Checksum { return pkg.NewChecksumFromV2( (*object.Object)(o). GetHeader(). @@ -180,8 +180,8 @@ func (o *rwObject) setPayloadHomomorphicHash(v *pkg.Checksum) { }) } -// GetAttributes returns object attributes. -func (o *rwObject) GetAttributes() []*Attribute { +// Attributes returns object attributes. +func (o *rwObject) Attributes() []*Attribute { attrs := (*object.Object)(o). GetHeader(). GetAttributes() @@ -207,8 +207,8 @@ func (o *rwObject) setAttributes(v ...*Attribute) { }) } -// GetPreviousID returns identifier of the previous sibling object. -func (o *rwObject) GetPreviousID() *ID { +// PreviousID returns identifier of the previous sibling object. +func (o *rwObject) PreviousID() *ID { return NewIDFromV2( (*object.Object)(o). GetHeader(). @@ -223,8 +223,8 @@ func (o *rwObject) setPreviousID(v *ID) { }) } -// GetChildren return list of the identifiers of the child objects. -func (o *rwObject) GetChildren() []*ID { +// Children return list of the identifiers of the child objects. +func (o *rwObject) Children() []*ID { ids := (*object.Object)(o). GetHeader(). GetSplit(). @@ -251,8 +251,8 @@ func (o *rwObject) setChildren(v ...*ID) { }) } -// GetParentID returns identifier of the parent object. -func (o *rwObject) GetParentID() *ID { +// ParentID returns identifier of the parent object. +func (o *rwObject) ParentID() *ID { return NewIDFromV2( (*object.Object)(o). GetHeader(). @@ -267,8 +267,8 @@ func (o *rwObject) setParentID(v *ID) { }) } -// GetParent returns parent object w/o payload. -func (o *rwObject) GetParent() *Object { +// Parent returns parent object w/o payload. +func (o *rwObject) Parent() *Object { h := (*object.Object)(o). GetHeader(). GetSplit() @@ -308,9 +308,9 @@ func (o *rwObject) resetRelations() { }) } -// GetSessionToken returns token of the session +// SessionToken returns token of the session // within which object was created. -func (o *rwObject) GetSessionToken() *token.SessionToken { +func (o *rwObject) SessionToken() *token.SessionToken { return token.NewSessionTokenFromV2( (*object.Object)(o). GetHeader(). @@ -324,8 +324,8 @@ func (o *rwObject) setSessionToken(v *token.SessionToken) { }) } -// GetType returns type of the object. -func (o *rwObject) GetType() Type { +// Type returns type of the object. +func (o *rwObject) Type() Type { return TypeFromV2( (*object.Object)(o). GetHeader(). From 5452554b58e525e444fce7479fc956cb2f8fea21 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 16 Nov 2020 12:30:46 +0300 Subject: [PATCH 0568/1196] [#198] sdk: Implement XHeader type Signed-off-by: Leonard Lyubich --- pkg/xheader.go | 47 +++++++++++++++++++++++++++++++++++++++++++++ pkg/xheader_test.go | 25 ++++++++++++++++++++++++ 2 files changed, 72 insertions(+) create mode 100644 pkg/xheader.go create mode 100644 pkg/xheader_test.go diff --git a/pkg/xheader.go b/pkg/xheader.go new file mode 100644 index 0000000..84d645c --- /dev/null +++ b/pkg/xheader.go @@ -0,0 +1,47 @@ +package pkg + +import ( + "github.com/nspcc-dev/neofs-api-go/v2/session" +) + +// XHeader represents v2-compatible XHeader. +type XHeader session.XHeader + +// NewXHeaderFromV2 wraps v2 XHeader message to XHeader. +func NewXHeaderFromV2(v *session.XHeader) *XHeader { + return (*XHeader)(v) +} + +// NewXHeader creates, initializes and returns blank XHeader instance. +func NewXHeader() *XHeader { + return NewXHeaderFromV2(new(session.XHeader)) +} + +// ToV2 converts XHeader to v2 XHeader message. +func (x *XHeader) ToV2() *session.XHeader { + return (*session.XHeader)(x) +} + +// Key returns key to X-Header. +func (x *XHeader) Key() string { + return (*session.XHeader)(x). + GetKey() +} + +// SetKey sets key to X-Header. +func (x *XHeader) SetKey(k string) { + (*session.XHeader)(x). + SetKey(k) +} + +// Value returns value of X-Header. +func (x *XHeader) Value() string { + return (*session.XHeader)(x). + GetValue() +} + +// SetValue sets value of X-Header. +func (x *XHeader) SetValue(k string) { + (*session.XHeader)(x). + SetValue(k) +} diff --git a/pkg/xheader_test.go b/pkg/xheader_test.go new file mode 100644 index 0000000..8f65227 --- /dev/null +++ b/pkg/xheader_test.go @@ -0,0 +1,25 @@ +package pkg + +import ( + "testing" + + "github.com/stretchr/testify/require" +) + +func TestXHeader(t *testing.T) { + x := NewXHeader() + + key := "some key" + val := "some value" + + x.SetKey(key) + x.SetValue(val) + + require.Equal(t, key, x.Key()) + require.Equal(t, val, x.Value()) + + xV2 := x.ToV2() + + require.Equal(t, key, xV2.GetKey()) + require.Equal(t, val, xV2.GetValue()) +} From fe336fd5ba28ea66deae7713e02f304809e1ad4e Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 16 Nov 2020 12:31:25 +0300 Subject: [PATCH 0569/1196] [#198] sdk/client: Use XHeader type Signed-off-by: Leonard Lyubich --- pkg/client/opts.go | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/pkg/client/opts.go b/pkg/client/opts.go index 702f4c2..4404ab6 100644 --- a/pkg/client/opts.go +++ b/pkg/client/opts.go @@ -21,13 +21,9 @@ type ( apply(*clientOptions) } - xHeader struct { - v2session.XHeader - } - callOptions struct { version *pkg.Version - xHeaders []xHeader + xHeaders []*pkg.XHeader ttl uint32 epoch uint64 session *token.SessionToken @@ -81,15 +77,9 @@ func newFuncCallOption(f func(option *callOptions)) *funcCallOption { } } -func WithXHeader(key, value string) CallOption { +func WithXHeader(x *pkg.XHeader) CallOption { return newFuncCallOption(func(option *callOptions) { - xhdr := new(v2session.XHeader) - xhdr.SetKey(key) - xhdr.SetValue(value) - - option.xHeaders = append(option.xHeaders, xHeader{ - XHeader: *xhdr, - }) + option.xHeaders = append(option.xHeaders, x) }) } @@ -125,7 +115,7 @@ func v2MetaHeaderFromOpts(options callOptions) *v2session.RequestMetaHeader { xhdrs := make([]*v2session.XHeader, len(options.xHeaders)) for i := range options.xHeaders { - xhdrs[i] = &options.xHeaders[i].XHeader + xhdrs[i] = options.xHeaders[i].ToV2() } meta.SetXHeaders(xhdrs) From 79f72e10c9b1a988cadba270668a9b2e4e4adbff Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 16 Nov 2020 16:33:41 +0300 Subject: [PATCH 0570/1196] [#199] sdk: Refactor string parse errors Signed-off-by: Leonard Lyubich --- internal/error.go | 9 --------- pkg/container/id.go | 7 ++----- pkg/container/id_test.go | 2 +- pkg/object/address.go | 8 +++----- pkg/object/address_test.go | 6 +++--- pkg/object/id.go | 7 ++----- pkg/object/id_test.go | 2 +- pkg/owner/id.go | 7 ++----- pkg/owner/id_test.go | 2 +- 9 files changed, 15 insertions(+), 35 deletions(-) delete mode 100644 internal/error.go diff --git a/internal/error.go b/internal/error.go deleted file mode 100644 index 537c02c..0000000 --- a/internal/error.go +++ /dev/null @@ -1,9 +0,0 @@ -package internal - -// Error is constant type error. -type Error string - -// Error implementation of error interface. -func (e Error) Error() string { - return string(e) -} diff --git a/pkg/container/id.go b/pkg/container/id.go index 659828f..bdf3f8e 100644 --- a/pkg/container/id.go +++ b/pkg/container/id.go @@ -5,7 +5,6 @@ import ( "crypto/sha256" "github.com/mr-tron/base58" - "github.com/nspcc-dev/neofs-api-go/internal" "github.com/nspcc-dev/neofs-api-go/v2/refs" "github.com/pkg/errors" ) @@ -13,9 +12,7 @@ import ( // ID represents v2-compatible container identifier. type ID refs.ContainerID -// ErrBadID should be returned when bytes slice isn't Container.ID size (sha256.Size). -// Notice: if byte slice changed, please, replace error message. -const ErrBadID = internal.Error("object.ID should be 32 bytes length") +var errInvalidIDString = errors.New("incorrect format of the string container ID") // NewIDFromV2 wraps v2 ContainerID message to ID. func NewIDFromV2(idV2 *refs.ContainerID) *ID { @@ -53,7 +50,7 @@ func (id *ID) Parse(s string) error { if err != nil { return errors.Wrap(err, "could not parse container.ID from string") } else if len(data) != sha256.Size { - return ErrBadID + return errInvalidIDString } (*refs.ContainerID)(id).SetValue(data) diff --git a/pkg/container/id_test.go b/pkg/container/id_test.go index 3346975..346a187 100644 --- a/pkg/container/id_test.go +++ b/pkg/container/id_test.go @@ -70,7 +70,7 @@ func TestID_Parse(t *testing.T) { str := base58.Encode(cs) cid := NewID() - require.EqualError(t, cid.Parse(str), ErrBadID.Error()) + require.Error(t, cid.Parse(str)) }) } }) diff --git a/pkg/object/address.go b/pkg/object/address.go index 7f2bfe7..a2281a7 100644 --- a/pkg/object/address.go +++ b/pkg/object/address.go @@ -1,9 +1,9 @@ package object import ( + "errors" "strings" - "github.com/nspcc-dev/neofs-api-go/internal" "github.com/nspcc-dev/neofs-api-go/pkg/container" "github.com/nspcc-dev/neofs-api-go/v2/refs" ) @@ -11,9 +11,7 @@ import ( // Address represents v2-compatible object address. type Address refs.Address -// ErrBadAddress returns when string representation doesn't -// contains Container.ID and Object.ID separated by `/`. -const ErrBadAddress = internal.Error("address should contains container.ID and object.ID separated with `/`") +var errInvalidAddressString = errors.New("incorrect format of the string object address") const ( addressParts = 2 @@ -71,7 +69,7 @@ func (a *Address) Parse(s string) error { ) if len(parts) != addressParts { - return ErrBadAddress + return errInvalidAddressString } else if err = cid.Parse(parts[0]); err != nil { return err } else if err = oid.Parse(parts[1]); err != nil { diff --git a/pkg/object/address_test.go b/pkg/object/address_test.go index d031670..e17fc4d 100644 --- a/pkg/object/address_test.go +++ b/pkg/object/address_test.go @@ -47,17 +47,17 @@ func TestAddress_Parse(t *testing.T) { t.Run("should fail for bad address", func(t *testing.T) { s := strings.Join([]string{cid.String()}, addressSeparator) - require.EqualError(t, NewAddress().Parse(s), ErrBadAddress.Error()) + require.EqualError(t, NewAddress().Parse(s), errInvalidAddressString.Error()) }) t.Run("should fail on container.ID", func(t *testing.T) { s := strings.Join([]string{"1", "2"}, addressSeparator) - require.EqualError(t, NewAddress().Parse(s), container.ErrBadID.Error()) + require.Error(t, NewAddress().Parse(s)) }) t.Run("should fail on object.ID", func(t *testing.T) { s := strings.Join([]string{cid.String(), "2"}, addressSeparator) - require.EqualError(t, NewAddress().Parse(s), ErrBadID.Error()) + require.Error(t, NewAddress().Parse(s)) }) } diff --git a/pkg/object/id.go b/pkg/object/id.go index c62451d..813793d 100644 --- a/pkg/object/id.go +++ b/pkg/object/id.go @@ -5,7 +5,6 @@ import ( "crypto/sha256" "github.com/mr-tron/base58" - "github.com/nspcc-dev/neofs-api-go/internal" "github.com/nspcc-dev/neofs-api-go/v2/refs" "github.com/pkg/errors" ) @@ -13,9 +12,7 @@ import ( // ID represents v2-compatible object identifier. type ID refs.ObjectID -// ErrBadID should be returned when bytes slice hasn't sha256.Size -// Notice: if byte slice changed, please, replace error message. -const ErrBadID = internal.Error("object.ID should be 32 bytes length") +var errInvalidIDString = errors.New("incorrect format of the string object ID") // NewIDFromV2 wraps v2 ObjectID message to ID. func NewIDFromV2(idV2 *refs.ObjectID) *ID { @@ -53,7 +50,7 @@ func (id *ID) Parse(s string) error { if err != nil { return errors.Wrap(err, "could not parse object.ID from string") } else if len(data) != sha256.Size { - return ErrBadID + return errInvalidIDString } (*refs.ObjectID)(id).SetValue(data) diff --git a/pkg/object/id_test.go b/pkg/object/id_test.go index 14ab6c6..a11e80b 100644 --- a/pkg/object/id_test.go +++ b/pkg/object/id_test.go @@ -63,7 +63,7 @@ func TestID_Parse(t *testing.T) { str := base58.Encode(cs) oid := NewID() - require.EqualError(t, oid.Parse(str), ErrBadID.Error()) + require.Error(t, oid.Parse(str)) }) } }) diff --git a/pkg/owner/id.go b/pkg/owner/id.go index 49acb2c..e6a240d 100644 --- a/pkg/owner/id.go +++ b/pkg/owner/id.go @@ -3,7 +3,6 @@ package owner import ( "github.com/mr-tron/base58" "github.com/nspcc-dev/neo-go/pkg/encoding/address" - "github.com/nspcc-dev/neofs-api-go/internal" "github.com/nspcc-dev/neofs-api-go/v2/refs" "github.com/pkg/errors" ) @@ -11,9 +10,7 @@ import ( // ID represents v2-compatible owner identifier. type ID refs.OwnerID -// ErrBadID should be returned when bytes slice isn't Owner.ID size (NEO3WalletSize). -// Notice: if byte slice changed, please, replace error message. -const ErrBadID = internal.Error("owner.ID should be 25 bytes length") +var errInvalidIDString = errors.New("incorrect format of the string owner ID") // NewIDFromV2 wraps v2 OwnerID message to ID. func NewIDFromV2(idV2 *refs.OwnerID) *ID { @@ -64,7 +61,7 @@ func (id *ID) Parse(s string) error { if err != nil { return errors.Wrap(err, "could not parse owner.ID from string") } else if len(data) != NEO3WalletSize { - return ErrBadID + return errInvalidIDString } (*refs.OwnerID)(id).SetValue(data) diff --git a/pkg/owner/id_test.go b/pkg/owner/id_test.go index 8d867df..49816bf 100644 --- a/pkg/owner/id_test.go +++ b/pkg/owner/id_test.go @@ -64,7 +64,7 @@ func TestID_Parse(t *testing.T) { str := base58.Encode(cs) cid := NewID() - require.EqualError(t, cid.Parse(str), ErrBadID.Error()) + require.Error(t, cid.Parse(str)) }) } }) From 154e09f4e4139490d8d48219dd3e2024349eeab8 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 16 Nov 2020 16:35:34 +0300 Subject: [PATCH 0571/1196] [#199] sdk/accounting: Rename test file package Signed-off-by: Leonard Lyubich --- pkg/accounting/decimal_test.go | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/pkg/accounting/decimal_test.go b/pkg/accounting/decimal_test.go index a15334b..ecab5bb 100644 --- a/pkg/accounting/decimal_test.go +++ b/pkg/accounting/decimal_test.go @@ -1,13 +1,14 @@ -package accounting +package accounting_test import ( "testing" + "github.com/nspcc-dev/neofs-api-go/pkg/accounting" "github.com/stretchr/testify/require" ) func TestDecimal_Value(t *testing.T) { - d := NewDecimal() + d := accounting.NewDecimal() v := int64(3) d.SetValue(v) @@ -16,7 +17,7 @@ func TestDecimal_Value(t *testing.T) { } func TestDecimal_Precision(t *testing.T) { - d := NewDecimal() + d := accounting.NewDecimal() p := uint32(3) d.SetPrecision(p) @@ -25,7 +26,7 @@ func TestDecimal_Precision(t *testing.T) { } func TestDecimalEncoding(t *testing.T) { - d := NewDecimal() + d := accounting.NewDecimal() d.SetValue(1) d.SetPrecision(2) @@ -33,7 +34,7 @@ func TestDecimalEncoding(t *testing.T) { data, err := d.Marshal() require.NoError(t, err) - d2 := NewDecimal() + d2 := accounting.NewDecimal() require.NoError(t, d2.Unmarshal(data)) require.Equal(t, d, d2) @@ -43,7 +44,7 @@ func TestDecimalEncoding(t *testing.T) { data, err := d.MarshalJSON() require.NoError(t, err) - d2 := NewDecimal() + d2 := accounting.NewDecimal() require.NoError(t, d2.UnmarshalJSON(data)) require.Equal(t, d, d2) From 2b3502d6c0cc9d06befee10519ac0e5ef86d2b75 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 16 Nov 2020 16:37:40 +0300 Subject: [PATCH 0572/1196] [#199] sdk/acl: Add comments for basic ACL constants Signed-off-by: Leonard Lyubich --- pkg/acl/types.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pkg/acl/types.go b/pkg/acl/types.go index 8bae41c..ab337a0 100644 --- a/pkg/acl/types.go +++ b/pkg/acl/types.go @@ -1,7 +1,12 @@ package acl const ( - PublicBasicRule = 0x1FFFFFFF - PrivateBasicRule = 0x18888888 + // PublicBasicRule is a basic ACL value for public container. + PublicBasicRule = 0x1FFFFFFF + + // PrivateBasicRule is a basic ACL value for private container. + PrivateBasicRule = 0x18888888 + + // ReadOnlyBasicRule is a basic ACL value for read-only container. ReadOnlyBasicRule = 0x1FFF88FF ) From c6884f9823841bb44e967097b5bbce2b38f0c6c7 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 16 Nov 2020 17:24:06 +0300 Subject: [PATCH 0573/1196] [#199] sdk/eacl: Correct linter's remarks Signed-off-by: Leonard Lyubich --- pkg/acl/eacl/enums.go | 49 ++++++++++++++++++++++++++++++++ pkg/acl/eacl/filter.go | 11 +++++++- pkg/acl/eacl/record.go | 56 ++++++++++++++++++++++++------------- pkg/acl/eacl/record_test.go | 8 +++--- pkg/acl/eacl/table.go | 36 ++++++++++++++++-------- pkg/acl/eacl/table_test.go | 22 +++------------ pkg/acl/eacl/target.go | 10 +++++++ 7 files changed, 137 insertions(+), 55 deletions(-) diff --git a/pkg/acl/eacl/enums.go b/pkg/acl/eacl/enums.go index f861d66..19fa5b9 100644 --- a/pkg/acl/eacl/enums.go +++ b/pkg/acl/eacl/enums.go @@ -5,60 +5,100 @@ import ( ) // Action taken if EACL record matched request. +// Action is compatible with v2 acl.Action enum. type Action uint32 const ( + // ActionUnknown is an Action value used to mark action as undefined. ActionUnknown Action = iota + + // ActionAllow is an Action value that allows access to the operation from context. ActionAllow + + // ActionDeny is an Action value that denies access to the operation from context. ActionDeny ) // Operation is a object service method to match request. +// Operation is compatible with v2 acl.Operation enum. type Operation uint32 const ( + // OperationUnknown is an Operation value used to mark operation as undefined. OperationUnknown Operation = iota + + // OperationGet is an object get Operation. OperationGet + + // OperationHead is an Operation of getting the object header. OperationHead + + // OperationPut is an object put Operation. OperationPut + + // OperationDelete is an object delete Operation. OperationDelete + + // OperationSearch is an object search Operation. OperationSearch + + // OperationRange is an object payload range retrieval Operation. OperationRange + + // OperationRangeHash is an object payload range hashing Operation. OperationRangeHash ) // Role is a group of request senders to match request. +// Role is compatible with v2 acl.Role enum. type Role uint32 const ( + // RoleUnknown is a Role value used to mark role as undefined. RoleUnknown Role = iota + // RoleUser is a group of senders that contains only key of container owner. RoleUser + // RoleSystem is a group of senders that contains keys of container nodes and // inner ring nodes. RoleSystem + // RoleOthers is a group of senders that contains none of above keys. RoleOthers ) // Match is binary operation on filer name and value to check if request is matched. +// Match is compatible with v2 acl.MatchType enum. type Match uint32 const ( + // MatchUnknown is a Match value used to mark matcher as undefined. MatchUnknown Match = iota + + // MatchStringEqual is a Match of string equality. MatchStringEqual + + // MatchStringNotEqual is a Match of string inequality. MatchStringNotEqual ) // FilterHeaderType indicates source of headers to make matches. +// FilterHeaderType is compatible with v2 acl.HeaderType enum. type FilterHeaderType uint32 const ( + // HeaderTypeUnknown is a FilterHeaderType value used to mark header type as undefined. HeaderTypeUnknown FilterHeaderType = iota + + // HeaderFromRequest is a FilterHeaderType for request X-Header. HeaderFromRequest + + // HeaderFromObject is a FilterHeaderType for object header. HeaderFromObject ) +// ToV2 converts Action to v2 Action enum value. func (a Action) ToV2() v2acl.Action { switch a { case ActionAllow: @@ -70,6 +110,7 @@ func (a Action) ToV2() v2acl.Action { } } +// ActionFromV2 converts v2 Action enum value to Action. func ActionFromV2(action v2acl.Action) (a Action) { switch action { case v2acl.ActionAllow: @@ -83,6 +124,7 @@ func ActionFromV2(action v2acl.Action) (a Action) { return a } +// ToV2 converts Operation to v2 Operation enum value. func (o Operation) ToV2() v2acl.Operation { switch o { case OperationGet: @@ -104,6 +146,7 @@ func (o Operation) ToV2() v2acl.Operation { } } +// OperationFromV2 converts v2 Operation enum value to Operation. func OperationFromV2(operation v2acl.Operation) (o Operation) { switch operation { case v2acl.OperationGet: @@ -127,6 +170,7 @@ func OperationFromV2(operation v2acl.Operation) (o Operation) { return o } +// ToV2 converts Role to v2 Role enum value. func (r Role) ToV2() v2acl.Role { switch r { case RoleUser: @@ -140,6 +184,7 @@ func (r Role) ToV2() v2acl.Role { } } +// RoleFromV2 converts v2 Role enum value to Role. func RoleFromV2(role v2acl.Role) (r Role) { switch role { case v2acl.RoleUser: @@ -155,6 +200,7 @@ func RoleFromV2(role v2acl.Role) (r Role) { return r } +// ToV2 converts Match to v2 MatchType enum value. func (m Match) ToV2() v2acl.MatchType { switch m { case MatchStringEqual: @@ -166,6 +212,7 @@ func (m Match) ToV2() v2acl.MatchType { } } +// MatchFromV2 converts v2 MatchType enum value to Match. func MatchFromV2(match v2acl.MatchType) (m Match) { switch match { case v2acl.MatchTypeStringEqual: @@ -179,6 +226,7 @@ func MatchFromV2(match v2acl.MatchType) (m Match) { return m } +// ToV2 converts FilterHeaderType to v2 HeaderType enum value. func (h FilterHeaderType) ToV2() v2acl.HeaderType { switch h { case HeaderFromRequest: @@ -190,6 +238,7 @@ func (h FilterHeaderType) ToV2() v2acl.HeaderType { } } +// FilterHeaderTypeFromV2 converts v2 HeaderType enum value to FilterHeaderType. func FilterHeaderTypeFromV2(header v2acl.HeaderType) (h FilterHeaderType) { switch header { case v2acl.HeaderTypeRequest: diff --git a/pkg/acl/eacl/filter.go b/pkg/acl/eacl/filter.go index efed7ef..d66978b 100644 --- a/pkg/acl/eacl/filter.go +++ b/pkg/acl/eacl/filter.go @@ -8,10 +8,12 @@ import ( // Filter defines check conditions if request header is matched or not. Matched // header means that request should be processed according to EACL action. +// +// Filter is compatible with v2 acl.EACLRecord.Filter message. type Filter struct { from FilterHeaderType - key filterKey matcher Match + key filterKey value fmt.Stringer } @@ -43,22 +45,27 @@ func (s staticStringer) String() string { return string(s) } +// Value returns filtered string value. func (f Filter) Value() string { return f.value.String() } +// Matcher returns filter Match type. func (f Filter) Matcher() Match { return f.matcher } +// Key returns key to the filtered header. func (f Filter) Key() string { return f.key.String() } +// From returns FilterHeaderType that defined which header will be filtered. func (f Filter) From() FilterHeaderType { return f.from } +// ToV2 converts Filter to v2 acl.EACLRecord.Filter message. func (f *Filter) ToV2() *v2acl.HeaderFilter { filter := new(v2acl.HeaderFilter) filter.SetValue(f.value.String()) @@ -94,10 +101,12 @@ func (k filterKey) String() string { } } +// NewFilter creates, initializes and returns blank Filter instance. func NewFilter() *Filter { return NewFilterFromV2(new(v2acl.HeaderFilter)) } +// NewFilterFromV2 converts v2 acl.EACLRecord.Filter message to Filter. func NewFilterFromV2(filter *v2acl.HeaderFilter) *Filter { f := new(Filter) diff --git a/pkg/acl/eacl/record.go b/pkg/acl/eacl/record.go index db077aa..dd4abbf 100644 --- a/pkg/acl/eacl/record.go +++ b/pkg/acl/eacl/record.go @@ -10,43 +10,50 @@ import ( v2acl "github.com/nspcc-dev/neofs-api-go/v2/acl" ) -type ( - // Record of the EACL rule, that defines EACL action, targets for this action, - // object service operation and filters for request headers. - Record struct { - action Action - operation Operation - filters []Filter - targets []Target - } -) +// Record of the EACL rule, that defines EACL action, targets for this action, +// object service operation and filters for request headers. +// +// Record is compatible with v2 acl.EACLRecord message. +type Record struct { + action Action + operation Operation + filters []*Filter + targets []*Target +} -func (r Record) Targets() []Target { +// Targets returns list of target subjects to apply ACL rule to. +func (r Record) Targets() []*Target { return r.targets } -func (r Record) Filters() []Filter { +// Filters returns list of filters to match and see if rule is applicable. +func (r Record) Filters() []*Filter { return r.filters } +// Operation returns NeoFS request verb to match. func (r Record) Operation() Operation { return r.operation } +// SetOperation sets NeoFS request verb to match. func (r *Record) SetOperation(operation Operation) { r.operation = operation } +// Action returns rule execution result. func (r Record) Action() Action { return r.action } +// SetAction sets rule execution result. func (r *Record) SetAction(action Action) { r.action = action } +// AddTarget adds target subject with specified Role and key list. func (r *Record) AddTarget(role Role, keys ...ecdsa.PublicKey) { - t := Target{ + t := &Target{ role: role, keys: make([]ecdsa.PublicKey, 0, len(keys)), } @@ -59,7 +66,7 @@ func (r *Record) AddTarget(role Role, keys ...ecdsa.PublicKey) { } func (r *Record) addFilter(from FilterHeaderType, m Match, keyTyp filterKeyType, key string, val fmt.Stringer) { - filter := Filter{ + filter := &Filter{ from: from, key: filterKey{ typ: keyTyp, @@ -80,28 +87,34 @@ func (r *Record) addObjectReservedFilter(m Match, typ filterKeyType, val fmt.Str r.addObjectFilter(m, typ, "", val) } +// AddFilter adds generic filter. func (r *Record) AddFilter(from FilterHeaderType, matcher Match, name, value string) { r.addFilter(from, matcher, 0, name, staticStringer(value)) } +// AddObjectAttributeFilter adds filter by object attribute. func (r *Record) AddObjectAttributeFilter(m Match, key, value string) { r.addObjectFilter(m, 0, key, staticStringer(value)) } +// AddObjectVersionFilter adds filter by object version. func (r *Record) AddObjectVersionFilter(m Match, v *pkg.Version) { r.addObjectReservedFilter(m, fKeyObjVersion, v) } +// AddObjectContainerIDFilter adds filter by object container ID. func (r *Record) AddObjectContainerIDFilter(m Match, id *container.ID) { r.addObjectReservedFilter(m, fKeyObjContainerID, id) } +// AddObjectOwnerIDFilter adds filter by object owner ID. func (r *Record) AddObjectOwnerIDFilter(m Match, id *owner.ID) { r.addObjectReservedFilter(m, fKeyObjOwnerID, id) } // TODO: add remaining filters after neofs-api#72 +// ToV2 converts Record to v2 acl.EACLRecord message. func (r *Record) ToV2() *v2acl.Record { targets := make([]*v2acl.Target, 0, len(r.targets)) for _, target := range r.targets { @@ -123,20 +136,23 @@ func (r *Record) ToV2() *v2acl.Record { return v2 } +// NewRecord creates and returns blank Record instance. func NewRecord() *Record { return new(Record) } +// CreateRecord creates, initializes with parameters and returns Record instance. func CreateRecord(action Action, operation Operation) *Record { r := NewRecord() r.action = action r.operation = operation - r.targets = []Target{} - r.filters = []Filter{} + r.targets = []*Target{} + r.filters = []*Filter{} return r } +// NewRecordFromV2 converts v2 acl.EACLRecord message to Record. func NewRecordFromV2(record *v2acl.Record) *Record { r := NewRecord() @@ -150,14 +166,14 @@ func NewRecordFromV2(record *v2acl.Record) *Record { v2targets := record.GetTargets() v2filters := record.GetFilters() - r.targets = make([]Target, 0, len(v2targets)) + r.targets = make([]*Target, 0, len(v2targets)) for i := range v2targets { - r.targets = append(r.targets, *NewTargetFromV2(v2targets[i])) + r.targets = append(r.targets, NewTargetFromV2(v2targets[i])) } - r.filters = make([]Filter, 0, len(v2filters)) + r.filters = make([]*Filter, 0, len(v2filters)) for i := range v2filters { - r.filters = append(r.filters, *NewFilterFromV2(v2filters[i])) + r.filters = append(r.filters, NewFilterFromV2(v2filters[i])) } return r diff --git a/pkg/acl/eacl/record_test.go b/pkg/acl/eacl/record_test.go index fef691d..87b5345 100644 --- a/pkg/acl/eacl/record_test.go +++ b/pkg/acl/eacl/record_test.go @@ -39,7 +39,7 @@ func TestRecord(t *testing.T) { } func TestRecord_AddTarget(t *testing.T) { - targets := []Target{ + targets := []*Target{ { role: RoleUnknown, keys: []ecdsa.PublicKey{test.DecodeKey(1).PublicKey}, @@ -59,9 +59,9 @@ func TestRecord_AddTarget(t *testing.T) { } func TestRecord_AddFilter(t *testing.T) { - filters := []Filter{ - *newObjectFilter(MatchStringEqual, "some name", "ContainerID"), - *newObjectFilter(MatchStringNotEqual, "X-Header-Name", "X-Header-Value"), + filters := []*Filter{ + newObjectFilter(MatchStringEqual, "some name", "ContainerID"), + newObjectFilter(MatchStringNotEqual, "X-Header-Name", "X-Header-Value"), } r := NewRecord() diff --git a/pkg/acl/eacl/table.go b/pkg/acl/eacl/table.go index ff14093..606d5b2 100644 --- a/pkg/acl/eacl/table.go +++ b/pkg/acl/eacl/table.go @@ -8,41 +8,48 @@ import ( v2acl "github.com/nspcc-dev/neofs-api-go/v2/acl" ) -type ( - // Table is a group of EACL records for single container. - Table struct { - version pkg.Version - cid *container.ID - records []Record - } -) +// Table is a group of EACL records for single container. +// +// Table is compatible with v2 acl.EACLTable message. +type Table struct { + version pkg.Version + cid *container.ID + records []*Record +} +// CID returns identifier of the container that should use given access control rules. func (t Table) CID() *container.ID { return t.cid } +// SetCID sets identifier of the container that should use given access control rules. func (t *Table) SetCID(cid *container.ID) { t.cid = cid } +// Version returns version of eACL format. func (t Table) Version() pkg.Version { return t.version } +// SetVersion sets version of eACL format. func (t *Table) SetVersion(version pkg.Version) { t.version = version } -func (t Table) Records() []Record { +// Records returns list of extended ACL rules. +func (t Table) Records() []*Record { return t.records } +// AddRecord adds single eACL rule. func (t *Table) AddRecord(r *Record) { if r != nil { - t.records = append(t.records, *r) + t.records = append(t.records, r) } } +// ToV2 converts Table to v2 acl.EACLTable message. func (t *Table) ToV2() *v2acl.Table { v2 := new(v2acl.Table) @@ -61,6 +68,7 @@ func (t *Table) ToV2() *v2acl.Table { return v2 } +// NewTable creates, initializes and returns blank Table instance. func NewTable() *Table { t := new(Table) t.SetVersion(*pkg.SDKVersion()) @@ -68,6 +76,7 @@ func NewTable() *Table { return t } +// CreateTable creates, initializes with parameters and returns Table instance. func CreateTable(cid container.ID) *Table { t := NewTable() t.SetCID(&cid) @@ -75,6 +84,7 @@ func CreateTable(cid container.ID) *Table { return t } +// NewTableFromV2 converts v2 acl.EACLTable message to Table. func NewTableFromV2(table *v2acl.Table) *Table { t := new(Table) @@ -98,15 +108,17 @@ func NewTableFromV2(table *v2acl.Table) *Table { } var h [sha256.Size]byte + copy(h[:], table.GetContainerID().GetValue()) t.cid.SetSHA256(h) } // set eacl records v2records := table.GetRecords() - t.records = make([]Record, 0, len(v2records)) + t.records = make([]*Record, 0, len(v2records)) + for i := range v2records { - t.records = append(t.records, *NewRecordFromV2(v2records[i])) + t.records = append(t.records, NewRecordFromV2(v2records[i])) } return t diff --git a/pkg/acl/eacl/table_test.go b/pkg/acl/eacl/table_test.go index cdf7a6a..7092aea 100644 --- a/pkg/acl/eacl/table_test.go +++ b/pkg/acl/eacl/table_test.go @@ -7,23 +7,9 @@ import ( "github.com/nspcc-dev/neofs-api-go/pkg" "github.com/nspcc-dev/neofs-api-go/pkg/acl/eacl" "github.com/nspcc-dev/neofs-api-go/pkg/container" - "github.com/nspcc-dev/neofs-crypto/test" "github.com/stretchr/testify/require" ) -// example how to create eACL tables in applications -func example() { - record := eacl.CreateRecord(eacl.ActionDeny, eacl.OperationPut) - record.AddFilter(eacl.HeaderFromObject, eacl.MatchStringEqual, "filename", "cat.jpg") - record.AddTarget(eacl.RoleOthers, test.DecodeKey(1).PublicKey, test.DecodeKey(2).PublicKey) - - var cid container.ID - cid.SetSHA256(sha256.Sum256([]byte("container id"))) - - table := eacl.CreateTable(cid) - table.AddRecord(record) -} - func TestTable(t *testing.T) { var ( v pkg.Version @@ -66,14 +52,14 @@ func TestTable(t *testing.T) { } func TestTable_AddRecord(t *testing.T) { - records := []eacl.Record{ - *eacl.CreateRecord(eacl.ActionDeny, eacl.OperationDelete), - *eacl.CreateRecord(eacl.ActionAllow, eacl.OperationPut), + records := []*eacl.Record{ + eacl.CreateRecord(eacl.ActionDeny, eacl.OperationDelete), + eacl.CreateRecord(eacl.ActionAllow, eacl.OperationPut), } table := eacl.NewTable() for _, record := range records { - table.AddRecord(&record) + table.AddRecord(record) } require.Equal(t, records, table.Records()) diff --git a/pkg/acl/eacl/target.go b/pkg/acl/eacl/target.go index ca6af2e..0d15bda 100644 --- a/pkg/acl/eacl/target.go +++ b/pkg/acl/eacl/target.go @@ -9,27 +9,34 @@ import ( // Target is a group of request senders to match EACL. Defined by role enum // and set of public keys. +// +// Target is compatible with v2 acl.EACLRecord.Target message. type Target struct { role Role keys []ecdsa.PublicKey } +// SetKeys sets list of public keys to identify target subject. func (t *Target) SetKeys(keys ...ecdsa.PublicKey) { t.keys = keys } +// Keys returns list of public keys to identify target subject. func (t Target) Keys() []ecdsa.PublicKey { return t.keys } +// SetRole sets target subject's role class. func (t *Target) SetRole(r Role) { t.role = r } +// Role returns target subject's role class. func (t Target) Role() Role { return t.role } +// ToV2 converts Target to v2 acl.EACLRecord.Target message. func (t *Target) ToV2() *v2acl.Target { keys := make([][]byte, 0, len(t.keys)) for i := range t.keys { @@ -45,10 +52,12 @@ func (t *Target) ToV2() *v2acl.Target { return target } +// NewTarget creates, initializes and returns blank Target instance. func NewTarget() *Target { return NewTargetFromV2(new(v2acl.Target)) } +// NewTargetFromV2 converts v2 acl.EACLRecord.Target message to Target. func NewTargetFromV2(target *v2acl.Target) *Target { t := new(Target) @@ -59,6 +68,7 @@ func NewTargetFromV2(target *v2acl.Target) *Target { t.role = RoleFromV2(target.GetRole()) v2keys := target.GetKeys() t.keys = make([]ecdsa.PublicKey, 0, len(v2keys)) + for i := range v2keys { key := crypto.UnmarshalPublicKey(v2keys[i]) t.keys = append(t.keys, *key) From 3097059f85ddd8b6661b00dacd5678974d932571 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 16 Nov 2020 17:33:04 +0300 Subject: [PATCH 0574/1196] [#199] sdk/client: Verify header signature in GetObjectHeader method Signed-off-by: Leonard Lyubich --- pkg/client/object.go | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/pkg/client/object.go b/pkg/client/object.go index 527a619..197fd93 100644 --- a/pkg/client/object.go +++ b/pkg/client/object.go @@ -569,7 +569,19 @@ func (c *Client) getObjectHeaderV2(ctx context.Context, p *ObjectHeaderParams, o return nil, errors.New("got nil instead of header with signature") } hdr = hdrWithSig.GetHeader() - // todo: check signature there + + if err := signer.VerifyDataWithSource( + signature.StableMarshalerWrapper{ + SM: hdrWithSig.GetHeader(), + }, + func() (key, sig []byte) { + s := hdrWithSig.GetSignature() + + return s.GetKey(), s.GetSign() + }, + ); err != nil { + return nil, errors.Wrap(err, "incorrect object header signature") + } default: panic(fmt.Sprintf("unexpected Head object type %T", v)) } From 7611c218e385f291a01e2d6c8efb3df694713782 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 16 Nov 2020 17:35:52 +0300 Subject: [PATCH 0575/1196] [#199] sdk/client: Verify eACL table signature in GetEACL method Signed-off-by: Leonard Lyubich --- pkg/client/container.go | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/pkg/client/container.go b/pkg/client/container.go index 279a340..5857037 100644 --- a/pkg/client/container.go +++ b/pkg/client/container.go @@ -350,9 +350,20 @@ func (c Client) getEACLV2(ctx context.Context, id *container.ID, opts ...CallOpt return nil, errors.New("response body is nil") } - result := eacl.NewTableFromV2(body.GetEACL()) + if err := signature.VerifyDataWithSource( + v2signature.StableMarshalerWrapper{ + SM: body.GetEACL(), + }, + func() (key, sig []byte) { + s := body.GetSignature() - // todo: check signature + return s.GetKey(), s.GetSign() + }, + ); err != nil { + return nil, errors.Wrap(err, "incorrect signature") + } + + result := eacl.NewTableFromV2(body.GetEACL()) return result, nil default: From 459d295788bcd34f8c4489676061cfa68698c174 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 16 Nov 2020 17:39:06 +0300 Subject: [PATCH 0576/1196] [#199] sdk/container: Correct linter's remarks Signed-off-by: Leonard Lyubich --- pkg/container/container.go | 3 ++- pkg/container/opts.go | 5 ----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/pkg/container/container.go b/pkg/container/container.go index 44efd9e..1638ca5 100644 --- a/pkg/container/container.go +++ b/pkg/container/container.go @@ -15,6 +15,7 @@ type Container struct { func New(opts ...NewOption) *Container { cnrOptions := defaultContainerOptions() + for i := range opts { opts[i].apply(&cnrOptions) } @@ -36,7 +37,7 @@ func New(opts ...NewOption) *Container { return cnr } -func (c Container) ToV2() *container.Container { +func (c *Container) ToV2() *container.Container { return &c.v2 } diff --git a/pkg/container/opts.go b/pkg/container/opts.go index 424891d..8c15ed1 100644 --- a/pkg/container/opts.go +++ b/pkg/container/opts.go @@ -12,11 +12,6 @@ type ( apply(*containerOptions) } - attribute struct { - key string - value string - } - containerOptions struct { acl uint32 policy *netmap.PlacementPolicy From 3a966ee5dfbc32a7540e10f4c216cffe68b41925 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 16 Nov 2020 17:52:15 +0300 Subject: [PATCH 0577/1196] [#199] sdk/netmap: Correct linter's remarks Signed-off-by: Leonard Lyubich --- pkg/netmap/aggregator.go | 44 ++++++++++--------------------------- pkg/netmap/clause.go | 2 +- pkg/netmap/context.go | 2 ++ pkg/netmap/filter.go | 14 ++++++++++++ pkg/netmap/netmap.go | 12 +++++++++- pkg/netmap/node_info.go | 8 ++++++- pkg/netmap/operation.go | 2 +- pkg/netmap/selector.go | 13 +++++++++++ pkg/netmap/selector_test.go | 9 +++++++- 9 files changed, 69 insertions(+), 37 deletions(-) diff --git a/pkg/netmap/aggregator.go b/pkg/netmap/aggregator.go index ab66f7f..d1c6061 100644 --- a/pkg/netmap/aggregator.go +++ b/pkg/netmap/aggregator.go @@ -73,12 +73,6 @@ var ( _ normalizer = (*constNorm)(nil) ) -// capWeightFunc calculates weight which is equal to capacity. -func capWeightFunc(n *Node) float64 { return float64(n.Capacity) } - -// priceWeightFunc calculates weight which is equal to price. -func priceWeightFunc(n *Node) float64 { return float64(n.Price) } - // newWeightFunc returns weightFunc which multiplies normalized // capacity and price. func newWeightFunc(capNorm, priceNorm normalizer) weightFunc { @@ -87,12 +81,6 @@ func newWeightFunc(capNorm, priceNorm normalizer) weightFunc { } } -// newMeanSumAgg returns an aggregator which -// computes mean value by keeping total sum. -func newMeanSumAgg() aggregator { - return new(meanSumAgg) -} - // newMeanAgg returns an aggregator which // computes mean value by recalculating it on // every addition. @@ -106,12 +94,6 @@ func newMinAgg() aggregator { return new(minAgg) } -// newMaxAgg returns an aggregator which -// computes max value. -func newMaxAgg() aggregator { - return new(maxAgg) -} - // newMeanIQRAgg returns an aggregator which // computes mean value of values from IQR interval. func newMeanIQRAgg() aggregator { @@ -124,24 +106,12 @@ func newReverseMinNorm(min float64) normalizer { return &reverseMinNorm{min: min} } -// newMaxNorm returns a normalizer which -// normalize values in range of 0.0 to 1.0 to a maximum value. -func newMaxNorm(max float64) normalizer { - return &maxNorm{max: max} -} - // newSigmoidNorm returns a normalizer which // normalize values in range of 0.0 to 1.0 to a scaled sigmoid. func newSigmoidNorm(scale float64) normalizer { return &sigmoidNorm{scale: scale} } -// newConstNorm returns a normalizer which -// returns a constant values -func newConstNorm(value float64) normalizer { - return &constNorm{value: value} -} - func (a *meanSumAgg) Add(n float64) { a.sum += n a.count++ @@ -151,6 +121,7 @@ func (a *meanSumAgg) Compute() float64 { if a.count == 0 { return 0 } + return a.sum / float64(a.count) } @@ -197,22 +168,27 @@ func (a *meanIQRAgg) Compute() float64 { sort.Slice(a.arr, func(i, j int) bool { return a.arr[i] < a.arr[j] }) var min, max float64 - if l < 4 { + + const minLn = 4 + + if l < minLn { min, max = a.arr[0], a.arr[l-1] } else { - start, end := l/4, l*3/4-1 + start, end := l/minLn, l*3/minLn-1 iqr := a.k * (a.arr[end] - a.arr[start]) min, max = a.arr[start]-iqr, a.arr[end]+iqr } count := 0 sum := float64(0) + for _, e := range a.arr { if e >= min && e <= max { sum += e count++ } } + return sum / float64(count) } @@ -220,6 +196,7 @@ func (r *reverseMinNorm) Normalize(w float64) float64 { if w == 0 { return 0 } + return r.min / w } @@ -227,6 +204,7 @@ func (r *maxNorm) Normalize(w float64) float64 { if r.max == 0 { return 0 } + return w / r.max } @@ -234,7 +212,9 @@ func (r *sigmoidNorm) Normalize(w float64) float64 { if r.scale == 0 { return 0 } + x := w / r.scale + return x / (1 + x) } diff --git a/pkg/netmap/clause.go b/pkg/netmap/clause.go index 2e0278b..37ea3a0 100644 --- a/pkg/netmap/clause.go +++ b/pkg/netmap/clause.go @@ -45,7 +45,7 @@ func (c Clause) ToV2() netmap.Clause { func (c Clause) String() string { switch c { default: - return "UNSPECIFIED" + return "CLAUSE_UNSPECIFIED" case ClauseDistinct: return "DISTINCT" case ClauseSame: diff --git a/pkg/netmap/context.go b/pkg/netmap/context.go index 992d2bd..cedb729 100644 --- a/pkg/netmap/context.go +++ b/pkg/netmap/context.go @@ -70,10 +70,12 @@ func (c *Context) setPivot(pivot []byte) { func GetDefaultWeightFunc(ns Nodes) weightFunc { mean := newMeanAgg() min := newMinAgg() + for i := range ns { mean.Add(float64(ns[i].Capacity)) min.Add(float64(ns[i].Price)) } + return newWeightFunc( newSigmoidNorm(mean.Compute()), newReverseMinNorm(min.Compute())) diff --git a/pkg/netmap/filter.go b/pkg/netmap/filter.go index c9b0515..531645e 100644 --- a/pkg/netmap/filter.go +++ b/pkg/netmap/filter.go @@ -26,6 +26,7 @@ func (c *Context) processFilters(p *PlacementPolicy) error { return err } } + return nil } @@ -33,15 +34,19 @@ func (c *Context) processFilter(f *Filter, top bool) error { if f == nil { return fmt.Errorf("%w: FILTER", ErrMissingField) } + if f.Name() == MainFilterName { return fmt.Errorf("%w: '*' is reserved", ErrInvalidFilterName) } + if top && f.Name() == "" { return ErrUnnamedTopFilter } + if !top && f.Name() != "" && c.Filters[f.Name()] == nil { return fmt.Errorf("%w: '%s'", ErrFilterNotFound, f.Name()) } + switch f.Operation() { case OpAND, OpOR: for _, flt := range f.InnerFilters() { @@ -55,6 +60,7 @@ func (c *Context) processFilter(f *Filter, top bool) error { } else if !top && f.Name() != "" { // named reference return nil } + switch f.Operation() { case OpEQ, OpNE: case OpGT, OpGE, OpLT, OpLE: @@ -62,14 +68,17 @@ func (c *Context) processFilter(f *Filter, top bool) error { if err != nil { return fmt.Errorf("%w: '%s'", ErrInvalidNumber, f.Value()) } + c.numCache[f] = n default: return fmt.Errorf("%w: %s", ErrInvalidFilterOp, f.Operation()) } } + if top { c.Filters[f.Name()] = f } + return nil } @@ -83,11 +92,13 @@ func (c *Context) match(f *Filter, b *Node) bool { if lf.Name() != "" { lf = c.Filters[lf.Name()] } + ok := c.match(lf, b) if ok == (f.Operation() == OpOR) { return ok } } + return f.Operation() == OpAND default: return c.matchKeyValue(f, b) @@ -102,6 +113,7 @@ func (c *Context) matchKeyValue(f *Filter, b *Node) bool { return b.Attribute(f.Key()) != f.Value() default: var attr uint64 + switch f.Key() { case PriceAttr: attr = b.Price @@ -109,6 +121,7 @@ func (c *Context) matchKeyValue(f *Filter, b *Node) bool { attr = b.Capacity default: var err error + attr, err = strconv.ParseUint(b.Attribute(f.Key()), 10, 64) if err != nil { // Note: because filters are somewhat independent from nodes attributes, @@ -116,6 +129,7 @@ func (c *Context) matchKeyValue(f *Filter, b *Node) bool { return false } } + switch f.Operation() { case OpGT: return attr > c.numCache[f] diff --git a/pkg/netmap/netmap.go b/pkg/netmap/netmap.go index 3be6092..95e823b 100644 --- a/pkg/netmap/netmap.go +++ b/pkg/netmap/netmap.go @@ -23,6 +23,7 @@ func flattenNodes(ns []Nodes) Nodes { for i := range ns { result = append(result, ns[i]...) } + return result } @@ -31,11 +32,13 @@ func (m *Netmap) GetPlacementVectors(cnt ContainerNodes, pivot []byte) ([]Nodes, h := hrw.Hash(pivot) wf := GetDefaultWeightFunc(m.Nodes) result := make([]Nodes, len(cnt.Replicas())) + for i, rep := range cnt.Replicas() { result[i] = make(Nodes, len(rep)) copy(result[i], rep) hrw.SortSliceByWeightValue(result[i], result[i].Weights(wf), h) } + return result, nil } @@ -45,28 +48,35 @@ func (m *Netmap) GetPlacementVectors(cnt ContainerNodes, pivot []byte) ([]Nodes, func (m *Netmap) GetContainerNodes(p *PlacementPolicy, pivot []byte) (ContainerNodes, error) { c := NewContext(m) c.setPivot(pivot) + if err := c.processFilters(p); err != nil { return nil, err } + if err := c.processSelectors(p); err != nil { return nil, err } + result := make([]Nodes, len(p.Replicas())) + for i, r := range p.Replicas() { if r == nil { return nil, fmt.Errorf("%w: REPLICA", ErrMissingField) } + if r.Selector() == "" { for _, s := range p.Selectors() { result[i] = append(result[i], flattenNodes(c.Selections[s.Name()])...) } } + nodes, ok := c.Selections[r.Selector()] if !ok { return nil, fmt.Errorf("%w: REPLICA '%s'", ErrSelectorNotFound, r.Selector()) } - result[i] = append(result[i], flattenNodes(nodes)...) + result[i] = append(result[i], flattenNodes(nodes)...) } + return containerNodes(result), nil } diff --git a/pkg/netmap/node_info.go b/pkg/netmap/node_info.go index 80ec7d1..a4debbc 100644 --- a/pkg/netmap/node_info.go +++ b/pkg/netmap/node_info.go @@ -63,6 +63,7 @@ func NodesFromInfo(infos []NodeInfo) Nodes { for i := range infos { nodes[i] = newNodeV2(i, &infos[i]) } + return nodes } @@ -73,6 +74,7 @@ func newNodeV2(index int, ni *NodeInfo) *Node { AttrMap: make(map[string]string, len(ni.Attributes())), NodeInfo: ni, } + for _, attr := range ni.Attributes() { switch attr.Key() { case CapacityAttr: @@ -80,8 +82,10 @@ func newNodeV2(index int, ni *NodeInfo) *Node { case PriceAttr: n.Price, _ = strconv.ParseUint(attr.Value(), 10, 64) } + n.AttrMap[attr.Key()] = attr.Value() } + return n } @@ -91,6 +95,7 @@ func (n Nodes) Weights(wf weightFunc) []float64 { for i := range n { w = append(w, wf(n[i])) } + return w } @@ -104,6 +109,7 @@ func GetBucketWeight(ns Nodes, a aggregator, wf weightFunc) float64 { for i := range ns { a.Add(wf(ns[i])) } + return a.Compute() } @@ -134,7 +140,7 @@ func (s NodeState) ToV2() netmap.NodeState { func (s NodeState) String() string { switch s { default: - return "UNSPECIFIED" + return "STATE_UNSPECIFIED" case NodeStateOffline: return "OFFLINE" case NodeStateOnline: diff --git a/pkg/netmap/operation.go b/pkg/netmap/operation.go index 2a8281c..dd388ff 100644 --- a/pkg/netmap/operation.go +++ b/pkg/netmap/operation.go @@ -86,7 +86,7 @@ func (op Operation) ToV2() netmap.Operation { func (op Operation) String() string { switch op { default: - return "UNSPECIFIED" + return "OPERATION_UNSPECIFIED" case OpNE: return "NE" case OpEQ: diff --git a/pkg/netmap/selector.go b/pkg/netmap/selector.go index c77e062..f12027c 100644 --- a/pkg/netmap/selector.go +++ b/pkg/netmap/selector.go @@ -22,13 +22,17 @@ func (c *Context) processSelectors(p *PlacementPolicy) error { return fmt.Errorf("%w: SELECT FROM '%s'", ErrFilterNotFound, s.Filter()) } } + c.Selectors[s.Name()] = s + result, err := c.getSelection(p, s) if err != nil { return err } + c.Selections[s.Name()] = result } + return nil } @@ -47,6 +51,7 @@ func GetNodesCount(p *PlacementPolicy, s *Selector) (int, int) { func (c *Context) getSelection(p *PlacementPolicy, s *Selector) ([]Nodes, error) { bucketCount, nodesInBucket := GetNodesCount(p, s) buckets := c.getSelectionBase(s) + if len(buckets) < bucketCount { return nil, fmt.Errorf("%w: '%s'", ErrNotEnoughNodes, s.Name()) } @@ -65,22 +70,27 @@ func (c *Context) getSelection(p *PlacementPolicy, s *Selector) ([]Nodes, error) } nodes := make([]Nodes, 0, len(buckets)) + for i := range buckets { ns := buckets[i].nodes if len(ns) >= nodesInBucket { nodes = append(nodes, ns[:nodesInBucket]) } } + if len(nodes) < bucketCount { return nil, fmt.Errorf("%w: '%s'", ErrNotEnoughNodes, s.Name()) } + if len(c.pivot) != 0 { weights := make([]float64, len(nodes)) for i := range nodes { weights[i] = GetBucketWeight(nodes[i], c.aggregator(), c.weightFunc) } + hrw.SortSliceByWeightIndex(nodes, weights, c.pivotHash) } + return nodes[:bucketCount], nil } @@ -97,6 +107,7 @@ func (c *Context) getSelectionBase(s *Selector) []nodeAttrPair { result := []nodeAttrPair{} nodeMap := map[string]Nodes{} attr := s.Attribute() + for i := range c.Netmap.Nodes { if isMain || c.match(f, c.Netmap.Nodes[i]) { if attr == "" { @@ -108,6 +119,7 @@ func (c *Context) getSelectionBase(s *Selector) []nodeAttrPair { } } } + if attr != "" { for k, ns := range nodeMap { result = append(result, nodeAttrPair{attr: k, nodes: ns}) @@ -119,6 +131,7 @@ func (c *Context) getSelectionBase(s *Selector) []nodeAttrPair { hrw.SortSliceByWeightValue(result[i].nodes, result[i].nodes.Weights(c.weightFunc), c.pivotHash) } } + return result } diff --git a/pkg/netmap/selector_test.go b/pkg/netmap/selector_test.go index 2c8abee..7f74f21 100644 --- a/pkg/netmap/selector_test.go +++ b/pkg/netmap/selector_test.go @@ -163,7 +163,10 @@ func TestPlacementPolicy_ProcessSelectorsHRW(t *testing.T) { c := NewContext(nm) c.setPivot([]byte("containerID")) c.weightFunc = newWeightFunc(newMaxNorm(10000), newReverseMinNorm(1)) - c.aggregator = newMaxAgg + c.aggregator = func() aggregator { + return new(maxAgg) + } + require.NoError(t, c.processFilters(p)) require.NoError(t, c.processSelectors(p)) @@ -186,6 +189,10 @@ func TestPlacementPolicy_ProcessSelectorsHRW(t *testing.T) { require.Equal(t, res, cnt) } +func newMaxNorm(max float64) normalizer { + return &maxNorm{max: max} +} + func TestPlacementPolicy_ProcessSelectorsInvalid(t *testing.T) { testCases := []struct { name string From 1ff8b3fd947fc98d14d2295c61bbc4906f0b3fe3 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 16 Nov 2020 17:54:43 +0300 Subject: [PATCH 0578/1196] [#199] sdk/object: Correct linter's remarks Signed-off-by: Leonard Lyubich --- pkg/object/fmt.go | 8 ++++++-- pkg/object/search.go | 2 ++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/pkg/object/fmt.go b/pkg/object/fmt.go index 0432195..0ada68b 100644 --- a/pkg/object/fmt.go +++ b/pkg/object/fmt.go @@ -10,6 +10,10 @@ import ( "github.com/pkg/errors" ) +var errCheckSumMismatch = errors.New("payload checksum mismatch") + +var errIncorrectID = errors.New("incorrect object identifier") + // CalculatePayloadChecksum calculates and returns checksum of // object payload bytes. func CalculatePayloadChecksum(payload []byte) *pkg.Checksum { @@ -34,7 +38,7 @@ func VerifyPayloadChecksum(obj *Object) error { obj.PayloadChecksum(), CalculatePayloadChecksum(obj.Payload()), ) { - return errors.New("payload checksum mismatch") + return errCheckSumMismatch } return nil @@ -75,7 +79,7 @@ func VerifyID(obj *Object) error { } if !id.Equal(obj.ID()) { - return errors.New("incorrect object identifier") + return errIncorrectID } return nil diff --git a/pkg/object/search.go b/pkg/object/search.go index d2cb849..b9383e2 100644 --- a/pkg/object/search.go +++ b/pkg/object/search.go @@ -138,6 +138,7 @@ func NewSearchFilters() SearchFilters { func NewSearchFiltersFromV2(v2 []*v2object.SearchFilter) SearchFilters { filters := make(SearchFilters, 0, len(v2)) + for i := range v2 { if v2[i] == nil { continue @@ -197,6 +198,7 @@ func (f *SearchFilters) AddObjectOwnerIDFilter(m SearchMatchType, id *owner.ID) func (f SearchFilters) ToV2() []*v2object.SearchFilter { result := make([]*v2object.SearchFilter, 0, len(f)) + for i := range f { v2 := new(v2object.SearchFilter) v2.SetKey(f[i].header.String()) From c0de2bf9e5e4778d2fc1b811b1c108dca40dac9a Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 16 Nov 2020 17:55:48 +0300 Subject: [PATCH 0579/1196] [#199] sdk/owner: Correct linter's remarks Signed-off-by: Leonard Lyubich --- pkg/owner/id.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/owner/id.go b/pkg/owner/id.go index e6a240d..3606117 100644 --- a/pkg/owner/id.go +++ b/pkg/owner/id.go @@ -1,6 +1,8 @@ package owner import ( + "fmt" + "github.com/mr-tron/base58" "github.com/nspcc-dev/neo-go/pkg/encoding/address" "github.com/nspcc-dev/neofs-api-go/v2/refs" @@ -38,7 +40,7 @@ func (id *ID) String() string { return base58.Encode((*refs.OwnerID)(id).GetValue()) } -func ScriptHashBE(id *ID) ([]byte, error) { +func ScriptHashBE(id fmt.Stringer) ([]byte, error) { addr, err := address.StringToUint160(id.String()) if err != nil { return nil, err From 00ce980d82a95b0c50e27ff354710ce1e9912021 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 16 Nov 2020 17:58:07 +0300 Subject: [PATCH 0580/1196] [#199] sdk/token: Correct linter's remarks Signed-off-by: Leonard Lyubich --- pkg/token/bearer.go | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/pkg/token/bearer.go b/pkg/token/bearer.go index 6dbb457..812faf2 100644 --- a/pkg/token/bearer.go +++ b/pkg/token/bearer.go @@ -13,6 +13,12 @@ import ( crypto "github.com/nspcc-dev/neofs-crypto" ) +var ( + errNilBearerToken = errors.New("bearer token is not set") + errNilBearerTokenBody = errors.New("bearer token body is not set") + errNilBearerTokenEACL = errors.New("bearer token EACL table is not set") +) + type BearerToken struct { token acl.BearerToken } @@ -63,6 +69,7 @@ func (b *BearerToken) SignToken(key *ecdsa.PrivateKey) error { } signWrapper := v2signature.StableMarshalerWrapper{SM: b.token.GetBody()} + return signature.SignDataWithHandler(key, signWrapper, func(key []byte, sig []byte) { bearerSignature := new(refs.Signature) bearerSignature.SetKey(key) @@ -103,15 +110,15 @@ func NewBearerTokenFromV2(v2 *acl.BearerToken) *BearerToken { } } -// sanityCheck if bearer token is ready to be issued +// sanityCheck if bearer token is ready to be issued. func sanityCheck(b *BearerToken) error { switch { case b == nil: - return errors.New("bearer token is not set") + return errNilBearerToken case b.token.GetBody() == nil: - return errors.New("bearer token body is not set") + return errNilBearerTokenBody case b.token.GetBody().GetEACL() == nil: - return errors.New("bearer token EACL table is not set") + return errNilBearerTokenEACL } // consider checking EACL sanity there, lifetime correctness, etc. From 0620a3b1eb92d8c4cb99dec2c5b528b47352e0d1 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 16 Nov 2020 18:10:51 +0300 Subject: [PATCH 0581/1196] [#199] sdk/client: Correct linter's remarks Signed-off-by: Leonard Lyubich --- pkg/client/accounting.go | 7 ++++--- pkg/client/client.go | 7 +++---- pkg/client/container.go | 38 ++++++++++++++++++++++++-------------- pkg/client/netmap.go | 9 +++++---- pkg/client/object.go | 33 ++++++++++++++++++++++----------- pkg/client/opts.go | 14 +++++++++++--- pkg/client/session.go | 11 +++++++---- 7 files changed, 76 insertions(+), 43 deletions(-) diff --git a/pkg/client/accounting.go b/pkg/client/accounting.go index 0b553f2..a0cdf4b 100644 --- a/pkg/client/accounting.go +++ b/pkg/client/accounting.go @@ -29,13 +29,14 @@ func (c Client) GetBalance(ctx context.Context, owner *owner.ID, opts ...CallOpt case 2: return c.getBalanceV2(ctx, owner, opts...) default: - return nil, unsupportedProtocolErr + return nil, errUnsupportedProtocol } } func (c Client) getBalanceV2(ctx context.Context, owner *owner.ID, opts ...CallOption) (*accounting.Decimal, error) { // apply all available options callOptions := c.defaultCallOptions() + for i := range opts { opts[i].apply(&callOptions) } @@ -71,7 +72,7 @@ func (c Client) getBalanceV2(ctx context.Context, owner *owner.ID, opts ...CallO return accounting.NewDecimalFromV2(resp.GetBody().GetBalance()), nil default: - return nil, unsupportedProtocolErr + return nil, errUnsupportedProtocol } } @@ -92,7 +93,7 @@ func v2AccountingClientFromOptions(opts *clientOptions) (cli *v2accounting.Clien ) default: - return nil, errors.New("lack of sdk client options to create accounting client") + return nil, errOptionsLack("Accounting") } // check if client correct and save in cache diff --git a/pkg/client/client.go b/pkg/client/client.go index 9b73fa0..94770d4 100644 --- a/pkg/client/client.go +++ b/pkg/client/client.go @@ -33,12 +33,11 @@ const ( GRPC ) -var ( - unsupportedProtocolErr = errors.New("unsupported transport protocol") -) +var errUnsupportedProtocol = errors.New("unsupported transport protocol") -func New(key *ecdsa.PrivateKey, opts ...ClientOption) (*Client, error) { +func New(key *ecdsa.PrivateKey, opts ...Option) (*Client, error) { clientOptions := defaultClientOptions() + for i := range opts { opts[i].apply(clientOptions) } diff --git a/pkg/client/container.go b/pkg/client/container.go index 5857037..fff2e92 100644 --- a/pkg/client/container.go +++ b/pkg/client/container.go @@ -18,6 +18,8 @@ type delContainerSignWrapper struct { body *v2container.DeleteRequestBody } +var errNilReponseBody = errors.New("response body is nil") + func (c delContainerSignWrapper) ReadSignedData(bytes []byte) ([]byte, error) { return c.body.GetContainerID().GetValue(), nil } @@ -31,7 +33,7 @@ func (c Client) PutContainer(ctx context.Context, cnr *container.Container, opts case 2: return c.putContainerV2(ctx, cnr, opts...) default: - return nil, unsupportedProtocolErr + return nil, errUnsupportedProtocol } } @@ -40,7 +42,7 @@ func (c Client) GetContainer(ctx context.Context, id *container.ID, opts ...Call case 2: return c.getContainerV2(ctx, id, opts...) default: - return nil, unsupportedProtocolErr + return nil, errUnsupportedProtocol } } @@ -49,7 +51,7 @@ func (c Client) ListContainers(ctx context.Context, owner *owner.ID, opts ...Cal case 2: return c.listContainerV2(ctx, owner, opts...) default: - return nil, unsupportedProtocolErr + return nil, errUnsupportedProtocol } } @@ -70,7 +72,7 @@ func (c Client) DeleteContainer(ctx context.Context, id *container.ID, opts ...C case 2: return c.delContainerV2(ctx, id, opts...) default: - return unsupportedProtocolErr + return errUnsupportedProtocol } } @@ -79,7 +81,7 @@ func (c Client) GetEACL(ctx context.Context, id *container.ID, opts ...CallOptio case 2: return c.getEACLV2(ctx, id, opts...) default: - return nil, unsupportedProtocolErr + return nil, errUnsupportedProtocol } } @@ -88,13 +90,14 @@ func (c Client) SetEACL(ctx context.Context, eacl *eacl.Table, opts ...CallOptio case 2: return c.setEACLV2(ctx, eacl, opts...) default: - return unsupportedProtocolErr + return errUnsupportedProtocol } } func (c Client) putContainerV2(ctx context.Context, cnr *container.Container, opts ...CallOption) (*container.ID, error) { // apply all available options callOptions := c.defaultCallOptions() + for i := range opts { opts[i].apply(&callOptions) } @@ -120,6 +123,7 @@ func (c Client) putContainerV2(ctx context.Context, cnr *container.Container, op // sign container signWrapper := v2signature.StableMarshalerWrapper{SM: reqBody.GetContainer()} + err := signature.SignDataWithHandler(c.key, signWrapper, func(key []byte, sig []byte) { containerSignature := new(refs.Signature) containerSignature.SetKey(key) @@ -158,13 +162,14 @@ func (c Client) putContainerV2(ctx context.Context, cnr *container.Container, op return container.NewIDFromV2(resp.GetBody().GetContainerID()), nil default: - return nil, unsupportedProtocolErr + return nil, errUnsupportedProtocol } } func (c Client) getContainerV2(ctx context.Context, id *container.ID, opts ...CallOption) (*container.Container, error) { // apply all available options callOptions := c.defaultCallOptions() + for i := range opts { opts[i].apply(&callOptions) } @@ -200,13 +205,14 @@ func (c Client) getContainerV2(ctx context.Context, id *container.ID, opts ...Ca return container.NewContainerFromV2(resp.GetBody().GetContainer()), nil default: - return nil, unsupportedProtocolErr + return nil, errUnsupportedProtocol } } func (c Client) listContainerV2(ctx context.Context, owner *owner.ID, opts ...CallOption) ([]*container.ID, error) { // apply all available options callOptions := c.defaultCallOptions() + for i := range opts { opts[i].apply(&callOptions) } @@ -247,13 +253,14 @@ func (c Client) listContainerV2(ctx context.Context, owner *owner.ID, opts ...Ca return result, nil default: - return nil, unsupportedProtocolErr + return nil, errUnsupportedProtocol } } func (c Client) delContainerV2(ctx context.Context, id *container.ID, opts ...CallOption) error { // apply all available options callOptions := c.defaultCallOptions() + for i := range opts { opts[i].apply(&callOptions) } @@ -305,13 +312,14 @@ func (c Client) delContainerV2(ctx context.Context, id *container.ID, opts ...Ca return nil default: - return unsupportedProtocolErr + return errUnsupportedProtocol } } func (c Client) getEACLV2(ctx context.Context, id *container.ID, opts ...CallOption) (*eacl.Table, error) { // apply all available options callOptions := c.defaultCallOptions() + for i := range opts { opts[i].apply(&callOptions) } @@ -347,7 +355,7 @@ func (c Client) getEACLV2(ctx context.Context, id *container.ID, opts ...CallOpt body := resp.GetBody() if body == nil { - return nil, errors.New("response body is nil") + return nil, errNilReponseBody } if err := signature.VerifyDataWithSource( @@ -367,13 +375,14 @@ func (c Client) getEACLV2(ctx context.Context, id *container.ID, opts ...CallOpt return result, nil default: - return nil, unsupportedProtocolErr + return nil, errUnsupportedProtocol } } func (c Client) setEACLV2(ctx context.Context, eacl *eacl.Table, opts ...CallOption) error { // apply all available options callOptions := c.defaultCallOptions() + for i := range opts { opts[i].apply(&callOptions) } @@ -383,6 +392,7 @@ func (c Client) setEACLV2(ctx context.Context, eacl *eacl.Table, opts ...CallOpt reqBody.GetEACL().SetVersion(c.remoteNode.Version.ToV2()) signWrapper := v2signature.StableMarshalerWrapper{SM: reqBody.GetEACL()} + err := signature.SignDataWithHandler(c.key, signWrapper, func(key []byte, sig []byte) { eaclSignature := new(refs.Signature) eaclSignature.SetKey(key) @@ -421,7 +431,7 @@ func (c Client) setEACLV2(ctx context.Context, eacl *eacl.Table, opts ...CallOpt return nil default: - return unsupportedProtocolErr + return errUnsupportedProtocol } } @@ -442,7 +452,7 @@ func v2ContainerClientFromOptions(opts *clientOptions) (cli *v2container.Client, ) default: - return nil, errors.New("lack of sdk client options to create container client") + return nil, errOptionsLack("Container") } // check if client correct and save in cache diff --git a/pkg/client/netmap.go b/pkg/client/netmap.go index 81ed41b..f4b0b09 100644 --- a/pkg/client/netmap.go +++ b/pkg/client/netmap.go @@ -23,7 +23,7 @@ func (c Client) EndpointInfo(ctx context.Context, opts ...CallOption) (*netmap.N return netmap.NewNodeInfoFromV2(resp.GetBody().GetNodeInfo()), nil default: - return nil, unsupportedProtocolErr + return nil, errUnsupportedProtocol } } @@ -38,13 +38,14 @@ func (c Client) Epoch(ctx context.Context, opts ...CallOption) (uint64, error) { return resp.GetMetaHeader().GetEpoch(), nil default: - return 0, unsupportedProtocolErr + return 0, errUnsupportedProtocol } } func (c Client) endpointInfoV2(ctx context.Context, opts ...CallOption) (*v2netmap.LocalNodeInfoResponse, error) { // apply all available options callOptions := c.defaultCallOptions() + for i := range opts { opts[i].apply(&callOptions) } @@ -79,7 +80,7 @@ func (c Client) endpointInfoV2(ctx context.Context, opts ...CallOption) (*v2netm return resp, nil default: - return nil, unsupportedProtocolErr + return nil, errUnsupportedProtocol } } @@ -100,7 +101,7 @@ func v2NetmapClientFromOptions(opts *clientOptions) (cli *v2netmap.Client, err e ) default: - return nil, errors.New("lack of sdk client options to create netmap client") + return nil, errOptionsLack("Netmap") } // check if client correct and save in cache diff --git a/pkg/client/object.go b/pkg/client/object.go index 197fd93..87842c4 100644 --- a/pkg/client/object.go +++ b/pkg/client/object.go @@ -89,6 +89,8 @@ const TZSize = 64 const searchQueryVersion uint32 = 1 +var errNilObjectPart = errors.New("received nil object part") + func rangesToV2(rs []*object.Range) []*v2object.Range { r2 := make([]*v2object.Range, 0, len(rs)) @@ -148,7 +150,7 @@ func (c *Client) PutObject(ctx context.Context, p *PutObjectParams, opts ...Call case 2: return c.putObjectV2(ctx, p, opts...) default: - return nil, unsupportedProtocolErr + return nil, errUnsupportedProtocol } } @@ -191,6 +193,7 @@ func (c *Client) putObjectV2(ctx context.Context, p *PutObjectParams, opts ...Ca }); err != nil { return nil, errors.Wrap(err, "could not sign session token") } + req.SetMetaHeader(meta) // initialize init part @@ -268,7 +271,7 @@ func (c *Client) DeleteObject(ctx context.Context, p *DeleteObjectParams, opts . case 2: return c.deleteObjectV2(ctx, p, opts...) default: - return unsupportedProtocolErr + return errUnsupportedProtocol } } @@ -302,6 +305,7 @@ func (c *Client) deleteObjectV2(ctx context.Context, p *DeleteObjectParams, opts }); err != nil { return errors.Wrap(err, "could not sign session token") } + req.SetMetaHeader(meta) // fill body fields @@ -348,7 +352,7 @@ func (c *Client) GetObject(ctx context.Context, p *GetObjectParams, opts ...Call case 2: return c.getObjectV2(ctx, p, opts...) default: - return nil, unsupportedProtocolErr + return nil, errUnsupportedProtocol } } @@ -382,6 +386,7 @@ func (c *Client) getObjectV2(ctx context.Context, p *GetObjectParams, opts ...Ca }); err != nil { return nil, errors.Wrap(err, "could not sign session token") } + req.SetMetaHeader(meta) // fill body fields @@ -421,7 +426,7 @@ func (c *Client) getObjectV2(ctx context.Context, p *GetObjectParams, opts ...Ca switch v := resp.GetBody().GetObjectPart().(type) { case nil: - return nil, errors.New("received nil object part") + return nil, errNilObjectPart case *v2object.GetObjectPartInit: obj.SetObjectID(v.GetObjectID()) obj.SetSignature(v.GetSignature()) @@ -481,7 +486,7 @@ func (c *Client) GetObjectHeader(ctx context.Context, p *ObjectHeaderParams, opt case 2: return c.getObjectHeaderV2(ctx, p, opts...) default: - return nil, unsupportedProtocolErr + return nil, errUnsupportedProtocol } } @@ -515,6 +520,7 @@ func (c *Client) getObjectHeaderV2(ctx context.Context, p *ObjectHeaderParams, o }); err != nil { return nil, errors.Wrap(err, "could not sign session token") } + req.SetMetaHeader(meta) // fill body fields @@ -541,7 +547,7 @@ func (c *Client) getObjectHeaderV2(ctx context.Context, p *ObjectHeaderParams, o switch v := resp.GetBody().GetHeaderPart().(type) { case nil: - return nil, errors.New("received nil object header part") + return nil, errNilObjectPart case *v2object.GetHeaderPartShort: if !p.short { return nil, errors.Errorf("wrong header part type: expected %T, received %T", @@ -566,8 +572,9 @@ func (c *Client) getObjectHeaderV2(ctx context.Context, p *ObjectHeaderParams, o hdrWithSig := v.GetHeaderWithSignature() if hdrWithSig == nil { - return nil, errors.New("got nil instead of header with signature") + return nil, errNilObjectPart } + hdr = hdrWithSig.GetHeader() if err := signer.VerifyDataWithSource( @@ -626,7 +633,7 @@ func (c *Client) ObjectPayloadRangeData(ctx context.Context, p *RangeDataParams, case 2: return c.objectPayloadRangeV2(ctx, p, opts...) default: - return nil, unsupportedProtocolErr + return nil, errUnsupportedProtocol } } @@ -660,6 +667,7 @@ func (c *Client) objectPayloadRangeV2(ctx context.Context, p *RangeDataParams, o }); err != nil { return nil, errors.Wrap(err, "could not sign session token") } + req.SetMetaHeader(meta) // fill body fields @@ -768,7 +776,7 @@ func (c *Client) objectPayloadRangeHash(ctx context.Context, p *RangeChecksumPar case 2: return c.objectPayloadRangeHashV2(ctx, p, opts...) default: - return nil, unsupportedProtocolErr + return nil, errUnsupportedProtocol } } @@ -802,6 +810,7 @@ func (c *Client) objectPayloadRangeHashV2(ctx context.Context, p *RangeChecksumP }); err != nil { return nil, errors.Wrap(err, "could not sign session token") } + req.SetMetaHeader(meta) // fill body fields @@ -900,7 +909,7 @@ func (c *Client) SearchObject(ctx context.Context, p *SearchObjectParams, opts . case 2: return c.searchObjectV2(ctx, p, opts...) default: - return nil, unsupportedProtocolErr + return nil, errUnsupportedProtocol } } @@ -937,6 +946,7 @@ func (c *Client) searchObjectV2(ctx context.Context, p *SearchObjectParams, opts }); err != nil { return nil, errors.Wrap(err, "could not sign session token") } + req.SetMetaHeader(meta) // fill body fields @@ -1009,7 +1019,7 @@ func v2ObjectClient(proto TransportProtocol, opts *clientOptions) (*v2object.Cli return opts.grpcOpts.objectClientV2, err default: - return nil, unsupportedProtocolErr + return nil, errUnsupportedProtocol } } @@ -1042,6 +1052,7 @@ func (c Client) attachV2SessionToken(opts callOptions, hdr *v2session.RequestMet body.SetLifetime(lt) signWrapper := signature.StableMarshalerWrapper{SM: token.GetBody()} + err := signer.SignDataWithHandler(c.key, signWrapper, func(key []byte, sig []byte) { sessionTokenSignature := new(v2refs.Signature) sessionTokenSignature.SetKey(key) diff --git a/pkg/client/opts.go b/pkg/client/opts.go index 4404ab6..e4dd299 100644 --- a/pkg/client/opts.go +++ b/pkg/client/opts.go @@ -1,6 +1,8 @@ package client import ( + "fmt" + "github.com/nspcc-dev/neofs-api-go/pkg" "github.com/nspcc-dev/neofs-api-go/pkg/token" v2accounting "github.com/nspcc-dev/neofs-api-go/v2/accounting" @@ -17,7 +19,7 @@ type ( apply(*callOptions) } - ClientOption interface { + Option interface { apply(*clientOptions) } @@ -54,6 +56,12 @@ type ( } ) +type errOptionsLack string + +func (e errOptionsLack) Error() string { + return fmt.Sprintf("lack of sdk client options to create %s client", string(e)) +} + func (c Client) defaultCallOptions() callOptions { return callOptions{ ttl: 2, @@ -149,13 +157,13 @@ func newFuncClientOption(f func(option *clientOptions)) *funcClientOption { } } -func WithAddress(addr string) ClientOption { +func WithAddress(addr string) Option { return newFuncClientOption(func(option *clientOptions) { option.addr = addr }) } -func WithGRPCConnection(grpcConn *grpc.ClientConn) ClientOption { +func WithGRPCConnection(grpcConn *grpc.ClientConn) Option { return newFuncClientOption(func(option *clientOptions) { option.grpcOpts.conn = grpcConn }) diff --git a/pkg/client/session.go b/pkg/client/session.go index e845b0d..c45f784 100644 --- a/pkg/client/session.go +++ b/pkg/client/session.go @@ -11,18 +11,21 @@ import ( "github.com/pkg/errors" ) +var errMalformedResponseBody = errors.New("malformed response body") + func (c Client) CreateSession(ctx context.Context, expiration uint64, opts ...CallOption) (*token.SessionToken, error) { switch c.remoteNode.Version.Major() { case 2: return c.createSessionV2(ctx, expiration, opts...) default: - return nil, unsupportedProtocolErr + return nil, errUnsupportedProtocol } } func (c Client) createSessionV2(ctx context.Context, expiration uint64, opts ...CallOption) (*token.SessionToken, error) { // apply all available options callOptions := c.defaultCallOptions() + for i := range opts { opts[i].apply(&callOptions) } @@ -67,7 +70,7 @@ func (c Client) createSessionV2(ctx context.Context, expiration uint64, opts ... body := resp.GetBody() if body == nil { - return nil, errors.New("malformed response body") + return nil, errMalformedResponseBody } sessionToken := token.NewSessionToken() @@ -77,7 +80,7 @@ func (c Client) createSessionV2(ctx context.Context, expiration uint64, opts ... return sessionToken, nil default: - return nil, unsupportedProtocolErr + return nil, errUnsupportedProtocol } } @@ -98,7 +101,7 @@ func v2SessionClientFromOptions(opts *clientOptions) (cli *v2session.Client, err ) default: - return nil, errors.New("lack of sdk client options to create session client") + return nil, errOptionsLack("Session") } // check if client correct and save in cache From 87a216dd96855ab79c1c355c15ef46957158e002 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 16 Nov 2020 18:13:47 +0300 Subject: [PATCH 0582/1196] Update changelog for v2.0.0 Signed-off-by: Leonard Lyubich --- CHANGELOG.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 934ded0..f62fb8f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,15 @@ # Changelog -## [2.0.0] - 2020-XX-XX - Jindo (진도, 珍島) +## [2.0.0] - 2020-11-16 - Jindo (진도, 珍島) Major API refactoring and simplification. +### Added +- cross-protocol ```v2``` message types +- utility functions for message signing/verification +- ```v2```/ ```gRPC``` back and forth conversions +- primary SDK + ### Removed - v0 and v1 NeoFS API is not supported anymore @@ -390,3 +396,4 @@ Initial public release [1.1.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.0.0...v1.1.0 [1.2.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.1.0...v1.2.0 [1.3.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.2.0...v1.3.0 +[2.0.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.3.0...v2.0.0 From dd19eb7ecae1dd496521aafb32b3a71f08c13efd Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Tue, 17 Nov 2020 09:52:50 +0300 Subject: [PATCH 0583/1196] Fix changelog and add compatibility matrix in readme file Signed-off-by: Alex Vanin --- CHANGELOG.md | 10 +++++++--- README.md | 8 ++++++++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f62fb8f..5d74744 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,12 @@ # Changelog -## [2.0.0] - 2020-11-16 - Jindo (진도, 珍島) +## [1.20.0] - 2020-11-16 - Jindo (진도, 珍島) + +Major API refactoring and simplification. From now on this library will have +backward compatibility and support of major versions of NeoFS-API by having +**version specific** files in `vN` dirs and **version independent** SDK +structures and client in `pkg`. This version supports NeoFS-API v2.0.X -Major API refactoring and simplification. ### Added - cross-protocol ```v2``` message types @@ -396,4 +400,4 @@ Initial public release [1.1.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.0.0...v1.1.0 [1.2.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.1.0...v1.2.0 [1.3.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.2.0...v1.3.0 -[2.0.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.3.0...v2.0.0 +[1.20.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.3.0...v1.20.0 \ No newline at end of file diff --git a/README.md b/README.md index ca3684b..0024640 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,14 @@ Go implementation of recent [NeoFS API](https://github.com/nspcc-dev/neofs-api) versions and SDK layer working with all of them in a handy way. +## NeoFS-API compatibility + +|neofs-api-go version|supported NeoFS-API versions| +|:------------------:|:--------------------------:| +|< v1.20.0 **(unsupported)**|up to v1.2.0| +|v1.20.0|[v2.0.2](https://github.com/nspcc-dev/neofs-api/releases/tag/v2.0.2)| + + ## Contributing Feel free to contribute to this project after reading the [contributing From 9ceba98198d0fd5ea578900a6395a5d5a96c0b8b Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Tue, 17 Nov 2020 14:17:15 +0300 Subject: [PATCH 0584/1196] [#202] pkg/client: Fix signature check in object header getter According to API object.Head response contains signature of object ID rather than signature of object header itself. Signed-off-by: Alex Vanin --- pkg/client/object.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/pkg/client/object.go b/pkg/client/object.go index 87842c4..f30ca0d 100644 --- a/pkg/client/object.go +++ b/pkg/client/object.go @@ -543,7 +543,10 @@ func (c *Client) getObjectHeaderV2(ctx context.Context, p *ObjectHeaderParams, o return nil, errors.Wrapf(err, "could not verify %T", resp) } - var hdr *v2object.Header + var ( + hdr *v2object.Header + idSig *v2refs.Signature + ) switch v := resp.GetBody().GetHeaderPart().(type) { case nil: @@ -576,15 +579,14 @@ func (c *Client) getObjectHeaderV2(ctx context.Context, p *ObjectHeaderParams, o } hdr = hdrWithSig.GetHeader() + idSig = hdrWithSig.GetSignature() if err := signer.VerifyDataWithSource( signature.StableMarshalerWrapper{ - SM: hdrWithSig.GetHeader(), + SM: p.addr.ObjectID().ToV2(), }, func() (key, sig []byte) { - s := hdrWithSig.GetSignature() - - return s.GetKey(), s.GetSign() + return idSig.GetKey(), idSig.GetSign() }, ); err != nil { return nil, errors.Wrap(err, "incorrect object header signature") @@ -595,6 +597,7 @@ func (c *Client) getObjectHeaderV2(ctx context.Context, p *ObjectHeaderParams, o obj := new(v2object.Object) obj.SetHeader(hdr) + obj.SetSignature(idSig) raw := object.NewRawFromV2(obj) raw.SetID(p.addr.ObjectID()) From 43d5b9d8581fc0f6bd7c36b4f451562c8e80aa2d Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Tue, 17 Nov 2020 14:37:50 +0300 Subject: [PATCH 0585/1196] Update changelog for v1.20.1 Signed-off-by: Alex Vanin --- CHANGELOG.md | 9 ++++++++- README.md | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5d74744..1237c4d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## [1.20.1] - 2020-11-17 + +### Fixed + +- Signature check of head response in `pkg/client` (#202) + ## [1.20.0] - 2020-11-16 - Jindo (진도, 珍島) Major API refactoring and simplification. From now on this library will have @@ -400,4 +406,5 @@ Initial public release [1.1.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.0.0...v1.1.0 [1.2.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.1.0...v1.2.0 [1.3.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.2.0...v1.3.0 -[1.20.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.3.0...v1.20.0 \ No newline at end of file +[1.20.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.3.0...v1.20.0 +[1.20.1]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.20.0...v1.20.1 diff --git a/README.md b/README.md index 0024640..f6552fe 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ versions and SDK layer working with all of them in a handy way. |neofs-api-go version|supported NeoFS-API versions| |:------------------:|:--------------------------:| |< v1.20.0 **(unsupported)**|up to v1.2.0| -|v1.20.0|[v2.0.2](https://github.com/nspcc-dev/neofs-api/releases/tag/v2.0.2)| +|v1.20.x|[v2.0.2](https://github.com/nspcc-dev/neofs-api/releases/tag/v2.0.2)| ## Contributing From fe6677f30f14f55fd04014e7b281e31862761c6f Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Tue, 17 Nov 2020 17:14:00 +0300 Subject: [PATCH 0586/1196] Update readme badges and changelog Signed-off-by: Alex Vanin --- CHANGELOG.md | 7 +++++++ README.md | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1237c4d..2e90cd9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## [1.20.2] - 2020-11-17 + +### Fixed + +- Readme badges + ## [1.20.1] - 2020-11-17 ### Fixed @@ -408,3 +414,4 @@ Initial public release [1.3.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.2.0...v1.3.0 [1.20.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.3.0...v1.20.0 [1.20.1]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.20.0...v1.20.1 +[1.20.2]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.20.1...v1.20.2 diff --git a/README.md b/README.md index f6552fe..f95a315 100644 --- a/README.md +++ b/README.md @@ -9,8 +9,8 @@ ![Go](https://github.com/nspcc-dev/neofs-api-go/workflows/Go/badge.svg) [![codecov](https://codecov.io/gh/nspcc-dev/neofs-api-go/branch/master/graph/badge.svg)](https://codecov.io/gh/nspcc-dev/neofs-api-go) [![Report](https://goreportcard.com/badge/github.com/nspcc-dev/neofs-api-go)](https://goreportcard.com/report/github.com/nspcc-dev/neofs-api-go) -[![GitHub release](https://img.shields.io/github/release/nspcc-dev/neofs-api.svg)](https://github.com/nspcc-dev/neofs-api-go) -![GitHub license](https://img.shields.io/github/license/nspcc-dev/neofs-api.svg?style=popout) +[![GitHub release](https://img.shields.io/github/release/nspcc-dev/neofs-api-go.svg)](https://github.com/nspcc-dev/neofs-api-go) +![GitHub license](https://img.shields.io/github/license/nspcc-dev/neofs-api-go.svg?style=popout) # Overview From 20ede88fe753526b49dd0aae9ef68b4b9d344087 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 20 Nov 2020 09:55:15 +0300 Subject: [PATCH 0587/1196] [#204] sdk/object: Add SearchFilters method to filter by object ID Signed-off-by: Leonard Lyubich --- pkg/object/search.go | 5 +++++ pkg/object/search_test.go | 17 +++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/pkg/object/search.go b/pkg/object/search.go index b9383e2..6c596d6 100644 --- a/pkg/object/search.go +++ b/pkg/object/search.go @@ -242,3 +242,8 @@ func (f *SearchFilters) AddNonChildfreeFilter() { func (f *SearchFilters) AddParentIDFilter(m SearchMatchType, id *ID) { f.addReservedFilter(m, fKeyParent, id) } + +// AddObjectIDFilter adds filter by object identifier. +func (f *SearchFilters) AddObjectIDFilter(m SearchMatchType, id *ID) { + f.addReservedFilter(m, fKeyObjectID, id) +} diff --git a/pkg/object/search_test.go b/pkg/object/search_test.go index ca28f1f..b3407cc 100644 --- a/pkg/object/search_test.go +++ b/pkg/object/search_test.go @@ -106,3 +106,20 @@ func TestSearchFilters_AddParentIDFilter(t *testing.T) { require.Equal(t, par.String(), fsV2[0].GetValue()) require.Equal(t, v2object.MatchStringEqual, fsV2[0].GetMatchType()) } + +func TestSearchFilters_AddObjectIDFilter(t *testing.T) { + id := testOID() + + fs := new(object.SearchFilters) + fs.AddObjectIDFilter(object.MatchStringEqual, id) + + t.Run("v2", func(t *testing.T) { + fsV2 := fs.ToV2() + + require.Len(t, fsV2, 1) + + require.Equal(t, v2object.FilterHeaderObjectID, fsV2[0].GetKey()) + require.Equal(t, id.String(), fsV2[0].GetValue()) + require.Equal(t, v2object.MatchStringEqual, fsV2[0].GetMatchType()) + }) +} From 03ac6bedb475645b51b0fc44106f71ae2ed8ec0d Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 23 Nov 2020 14:04:33 +0300 Subject: [PATCH 0588/1196] [#205] v2/client: Replace WithGRPCDialContext option with WithDialTimeout There is a need to set dial timeout in v2 client that is used in case of internal connection opening. Add DialTimeout option constructor to support this feature. Remove unused and no longer needed WithGRPCDialContext function. Signed-off-by: Leonard Lyubich --- v2/client/options.go | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/v2/client/options.go b/v2/client/options.go index 3dcdff1..1c9e60a 100644 --- a/v2/client/options.go +++ b/v2/client/options.go @@ -3,6 +3,7 @@ package client import ( "context" "net" + "time" "google.golang.org/grpc" ) @@ -15,24 +16,26 @@ type cfg struct { conn net.Conn gRPC cfgGRPC + + dialTimeout time.Duration } type cfgGRPC struct { - dialCtx context.Context - dialOpts []grpc.DialOption conn *grpc.ClientConn } +const defaultDialTimeout = 5 * time.Second + func defaultCfg() *cfg { return &cfg{ gRPC: cfgGRPC{ - dialCtx: context.Background(), dialOpts: []grpc.DialOption{ grpc.WithInsecure(), }, }, + dialTimeout: defaultDialTimeout, } } @@ -58,7 +61,11 @@ func NewGRPCClientConn(opts ...Option) (*grpc.ClientConn, error) { ) } - cfg.gRPC.conn, err = grpc.DialContext(cfg.gRPC.dialCtx, cfg.addr, cfg.gRPC.dialOpts...) + dialCtx, cancel := context.WithTimeout(context.Background(), cfg.dialTimeout) + + cfg.gRPC.conn, err = grpc.DialContext(dialCtx, cfg.addr, cfg.gRPC.dialOpts...) + + cancel() if err != nil { return nil, err } @@ -83,10 +90,10 @@ func WithNetConn(v net.Conn) Option { } } -func WithGRPCDialContext(v context.Context) Option { +func WithDialTimeout(v time.Duration) Option { return func(c *cfg) { - if v != nil { - c.gRPC.dialCtx = v + if v > 0 { + c.dialTimeout = v } } } From 5ee500bb43c68708df323b27653f82d29bc156fd Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 23 Nov 2020 14:05:27 +0300 Subject: [PATCH 0589/1196] [#205] sdk/client: Support option to set dial timeout There is a need to set dial timeout in SDK client that is used in case of internal connection opening. Add DialTimeout option constructor to support this feature. Signed-off-by: Leonard Lyubich --- pkg/client/accounting.go | 5 +++-- pkg/client/container.go | 5 +++-- pkg/client/netmap.go | 5 +++-- pkg/client/object.go | 1 + pkg/client/opts.go | 10 ++++++++++ pkg/client/session.go | 5 +++-- 6 files changed, 23 insertions(+), 8 deletions(-) diff --git a/pkg/client/accounting.go b/pkg/client/accounting.go index a0cdf4b..7446233 100644 --- a/pkg/client/accounting.go +++ b/pkg/client/accounting.go @@ -89,8 +89,9 @@ func v2AccountingClientFromOptions(opts *clientOptions) (cli *v2accounting.Clien case opts.addr != "": cli, err = v2accounting.NewClient(v2accounting.WithGlobalOpts( - client.WithNetworkAddress(opts.addr)), - ) + client.WithNetworkAddress(opts.addr), + client.WithDialTimeout(opts.dialTimeout), + )) default: return nil, errOptionsLack("Accounting") diff --git a/pkg/client/container.go b/pkg/client/container.go index fff2e92..0c90d9d 100644 --- a/pkg/client/container.go +++ b/pkg/client/container.go @@ -448,8 +448,9 @@ func v2ContainerClientFromOptions(opts *clientOptions) (cli *v2container.Client, case opts.addr != "": cli, err = v2container.NewClient(v2container.WithGlobalOpts( - client.WithNetworkAddress(opts.addr)), - ) + client.WithNetworkAddress(opts.addr), + client.WithDialTimeout(opts.dialTimeout), + )) default: return nil, errOptionsLack("Container") diff --git a/pkg/client/netmap.go b/pkg/client/netmap.go index f4b0b09..749b640 100644 --- a/pkg/client/netmap.go +++ b/pkg/client/netmap.go @@ -97,8 +97,9 @@ func v2NetmapClientFromOptions(opts *clientOptions) (cli *v2netmap.Client, err e case opts.addr != "": cli, err = v2netmap.NewClient(v2netmap.WithGlobalOpts( - client.WithNetworkAddress(opts.addr)), - ) + client.WithNetworkAddress(opts.addr), + client.WithDialTimeout(opts.dialTimeout), + )) default: return nil, errOptionsLack("Netmap") diff --git a/pkg/client/object.go b/pkg/client/object.go index f30ca0d..04812da 100644 --- a/pkg/client/object.go +++ b/pkg/client/object.go @@ -1013,6 +1013,7 @@ func v2ObjectClient(proto TransportProtocol, opts *clientOptions) (*v2object.Cli optsV2 = []v2object.Option{ v2object.WithGlobalOpts( client.WithNetworkAddress(opts.addr), + client.WithDialTimeout(opts.dialTimeout), ), } } diff --git a/pkg/client/opts.go b/pkg/client/opts.go index e4dd299..9e84665 100644 --- a/pkg/client/opts.go +++ b/pkg/client/opts.go @@ -2,6 +2,7 @@ package client import ( "fmt" + "time" "github.com/nspcc-dev/neofs-api-go/pkg" "github.com/nspcc-dev/neofs-api-go/pkg/token" @@ -35,6 +36,8 @@ type ( clientOptions struct { addr string + dialTimeout time.Duration + grpcOpts *grpcOptions } @@ -168,3 +171,10 @@ func WithGRPCConnection(grpcConn *grpc.ClientConn) Option { option.grpcOpts.conn = grpcConn }) } + +// WithDialTimeout returns option to set connection timeout to the remote node. +func WithDialTimeout(dur time.Duration) Option { + return newFuncClientOption(func(option *clientOptions) { + option.dialTimeout = dur + }) +} diff --git a/pkg/client/session.go b/pkg/client/session.go index c45f784..769c517 100644 --- a/pkg/client/session.go +++ b/pkg/client/session.go @@ -97,8 +97,9 @@ func v2SessionClientFromOptions(opts *clientOptions) (cli *v2session.Client, err case opts.addr != "": cli, err = v2session.NewClient(v2session.WithGlobalOpts( - client.WithNetworkAddress(opts.addr)), - ) + client.WithNetworkAddress(opts.addr), + client.WithDialTimeout(opts.dialTimeout), + )) default: return nil, errOptionsLack("Session") From 3ebfef9f94ed7c5723efa02c1cea71af491e079e Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 24 Nov 2020 10:50:36 +0300 Subject: [PATCH 0590/1196] [#207] sdk/client: Fix signature verification in GetEACL method Extended ACL tables should be signed with RFC-6979 standard. Fix Client .GetEACL implementation to verify eACL signature with SignRFC6979 option. Signed-off-by: Leonard Lyubich --- pkg/client/container.go | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/client/container.go b/pkg/client/container.go index 0c90d9d..a09107e 100644 --- a/pkg/client/container.go +++ b/pkg/client/container.go @@ -367,6 +367,7 @@ func (c Client) getEACLV2(ctx context.Context, id *container.ID, opts ...CallOpt return s.GetKey(), s.GetSign() }, + signature.SignWithRFC6979(), ); err != nil { return nil, errors.Wrap(err, "incorrect signature") } From 8c99d9d54c5ce9a64612091e11f992fc3f13f6aa Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 24 Nov 2020 13:22:07 +0300 Subject: [PATCH 0591/1196] [#207] sdk/client: Implement GetEACLWithSignature method GetEACL method of Client receives eACL table with signature, verifies the signature and return the table. In some cases we need to receive table and signature regardless of their correctness. New method GetEACLWithSignature provides such an opportunity. Signed-off-by: Leonard Lyubich --- pkg/client/container.go | 71 +++++++++++++++++++++++++++++++---------- 1 file changed, 55 insertions(+), 16 deletions(-) diff --git a/pkg/client/container.go b/pkg/client/container.go index a09107e..3bd61e2 100644 --- a/pkg/client/container.go +++ b/pkg/client/container.go @@ -3,6 +3,7 @@ package client import ( "context" + "github.com/nspcc-dev/neofs-api-go/pkg" "github.com/nspcc-dev/neofs-api-go/pkg/acl/eacl" "github.com/nspcc-dev/neofs-api-go/pkg/container" "github.com/nspcc-dev/neofs-api-go/pkg/owner" @@ -18,6 +19,13 @@ type delContainerSignWrapper struct { body *v2container.DeleteRequestBody } +// EACLWithSignature represents eACL table/signature pair. +type EACLWithSignature struct { + table *eacl.Table + + sig *pkg.Signature +} + var errNilReponseBody = errors.New("response body is nil") func (c delContainerSignWrapper) ReadSignedData(bytes []byte) ([]byte, error) { @@ -28,6 +36,16 @@ func (c delContainerSignWrapper) SignedDataSize() int { return len(c.body.GetContainerID().GetValue()) } +// EACL returns eACL table. +func (e EACLWithSignature) EACL() *eacl.Table { + return e.table +} + +// Signature returns table signature. +func (e EACLWithSignature) Signature() *pkg.Signature { + return e.sig +} + func (c Client) PutContainer(ctx context.Context, cnr *container.Container, opts ...CallOption) (*container.ID, error) { switch c.remoteNode.Version.Major() { case 2: @@ -77,9 +95,30 @@ func (c Client) DeleteContainer(ctx context.Context, id *container.ID, opts ...C } func (c Client) GetEACL(ctx context.Context, id *container.ID, opts ...CallOption) (*eacl.Table, error) { + v, err := c.getEACL(ctx, id, true, opts...) + if err != nil { + return nil, err + } + + return v.table, nil +} + +func (c Client) GetEACLWithSignature(ctx context.Context, id *container.ID, opts ...CallOption) (*EACLWithSignature, error) { + return c.getEACL(ctx, id, false, opts...) +} + +func (c Client) getEACL(ctx context.Context, id *container.ID, verify bool, opts ...CallOption) (*EACLWithSignature, error) { switch c.remoteNode.Version.Major() { case 2: - return c.getEACLV2(ctx, id, opts...) + resp, err := c.getEACLV2(ctx, id, verify, opts...) + if err != nil { + return nil, err + } + + return &EACLWithSignature{ + table: eacl.NewTableFromV2(resp.GetEACL()), + sig: pkg.NewSignatureFromV2(resp.GetSignature()), + }, nil default: return nil, errUnsupportedProtocol } @@ -316,7 +355,7 @@ func (c Client) delContainerV2(ctx context.Context, id *container.ID, opts ...Ca } } -func (c Client) getEACLV2(ctx context.Context, id *container.ID, opts ...CallOption) (*eacl.Table, error) { +func (c Client) getEACLV2(ctx context.Context, id *container.ID, verify bool, opts ...CallOption) (*v2container.GetExtendedACLResponseBody, error) { // apply all available options callOptions := c.defaultCallOptions() @@ -358,23 +397,23 @@ func (c Client) getEACLV2(ctx context.Context, id *container.ID, opts ...CallOpt return nil, errNilReponseBody } - if err := signature.VerifyDataWithSource( - v2signature.StableMarshalerWrapper{ - SM: body.GetEACL(), - }, - func() (key, sig []byte) { - s := body.GetSignature() + if verify { + if err := signature.VerifyDataWithSource( + v2signature.StableMarshalerWrapper{ + SM: body.GetEACL(), + }, + func() (key, sig []byte) { + s := body.GetSignature() - return s.GetKey(), s.GetSign() - }, - signature.SignWithRFC6979(), - ); err != nil { - return nil, errors.Wrap(err, "incorrect signature") + return s.GetKey(), s.GetSign() + }, + signature.SignWithRFC6979(), + ); err != nil { + return nil, errors.Wrap(err, "incorrect signature") + } } - result := eacl.NewTableFromV2(body.GetEACL()) - - return result, nil + return body, nil default: return nil, errUnsupportedProtocol } From ee0484acd951c34d4a9d4b32cec79b683c1a88c2 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 25 Nov 2020 14:51:26 +0300 Subject: [PATCH 0592/1196] Update changelog for v1.20.3 Signed-off-by: Leonard Lyubich --- CHANGELOG.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2e90cd9..6292824 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,17 @@ # Changelog +## [1.20.3] - 2020-11-25 + +### Added + +- `AddObjectIDFilter` method of `SearchFilters` type +- `WithDialTimeout` option of v2 and SDK `Client`'s +- `GetEACLWithSignature` method of SDK `Client` type + +### Fixed + +- incorrect signature verification algorithm in `GetEACL` method of SDK `Client` + ## [1.20.2] - 2020-11-17 ### Fixed @@ -415,3 +427,4 @@ Initial public release [1.20.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.3.0...v1.20.0 [1.20.1]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.20.0...v1.20.1 [1.20.2]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.20.1...v1.20.2 +[1.20.3]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.20.2...v1.20.3 From d44119395287ccd664fc78c8d6424b8207ee23a7 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Tue, 24 Nov 2020 20:12:45 +0300 Subject: [PATCH 0593/1196] [#209] v2/object: Recompile GRPC files and add SplitID setter Signed-off-by: Alex Vanin --- v2/acl/grpc/types.pb.go | 2 +- v2/object/grpc/service.pb.go | 8 ++--- v2/object/grpc/types.go | 7 ++++ v2/object/grpc/types.pb.go | 70 +++++++++++++++++++++--------------- v2/session/grpc/types.pb.go | 2 +- 5 files changed, 53 insertions(+), 36 deletions(-) diff --git a/v2/acl/grpc/types.pb.go b/v2/acl/grpc/types.pb.go index e1805a3..fe81184 100644 --- a/v2/acl/grpc/types.pb.go +++ b/v2/acl/grpc/types.pb.go @@ -760,7 +760,7 @@ func (x *BearerToken_Body) GetLifetime() *BearerToken_Body_TokenLifetime { return nil } -// Lifetime parameters of the token. Filed names taken from +// Lifetime parameters of the token. Field names taken from // [rfc7519](https://tools.ietf.org/html/rfc7519). type BearerToken_Body_TokenLifetime struct { state protoimpl.MessageState diff --git a/v2/object/grpc/service.pb.go b/v2/object/grpc/service.pb.go index e35c1d0..77f84ef 100644 --- a/v2/object/grpc/service.pb.go +++ b/v2/object/grpc/service.pb.go @@ -1875,7 +1875,7 @@ func (x *SearchRequest_Body) GetFilters() []*SearchRequest_Body_Filter { // // * $Object:version \ // version -// * $Object:objectID \ +// * $Object:objectID \ // object_id // * $Object:containerID \ // container_id @@ -1893,6 +1893,8 @@ func (x *SearchRequest_Body) GetFilters() []*SearchRequest_Body_Filter { // homomorphic_hash // * $Object:split.parent \ // object_id of parent +// * $Object:split.splitID \ +// 16 byte UUID used to identify the split object hierarchy parts // // There are some well-known filter aliases to match objects by certain // properties: @@ -1909,10 +1911,6 @@ func (x *SearchRequest_Body) GetFilters() []*SearchRequest_Body_Filter { // * $Object:PHY \ // Returns only objects physically stored in the system. This filter is // activated if the `key` exists, disregarding the value and matcher type. -// * $Object:CHILDFREE \ -// With the `value` set to `true` checks if an object has empty -// children list in `Split` header. With other values returns -// non-childfree objects. type SearchRequest_Body_Filter struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache diff --git a/v2/object/grpc/types.go b/v2/object/grpc/types.go index fa3ae76..b1f46c8 100644 --- a/v2/object/grpc/types.go +++ b/v2/object/grpc/types.go @@ -54,6 +54,13 @@ func (m *Header_Split) SetChildren(v []*refs.ObjectID) { } } +// SetSplitID sets split ID of the object. +func (m *Header_Split) SetSplitId(v []byte) { + if m != nil { + m.SplitId = v + } +} + // SetContainerId sets identifier of the container. func (m *Header) SetContainerId(v *refs.ContainerID) { if m != nil { diff --git a/v2/object/grpc/types.pb.go b/v2/object/grpc/types.pb.go index 0498da0..8d5eede 100644 --- a/v2/object/grpc/types.pb.go +++ b/v2/object/grpc/types.pb.go @@ -536,6 +536,10 @@ type Header_Split struct { ParentHeader *Header `protobuf:"bytes,4,opt,name=parent_header,json=parentHeader,proto3" json:"parent_header,omitempty"` // List of identifiers of the objects generated by splitting current one. Children []*grpc.ObjectID `protobuf:"bytes,5,rep,name=children,proto3" json:"children,omitempty"` + // 16 byte UUID used to identify the split object hierarchy parts. Must be + // unique inside container. All objects participating in the split must + // have the same `split_id` value. + SplitId []byte `protobuf:"bytes,6,opt,name=split_id,json=splitID,proto3" json:"split_id,omitempty"` } func (x *Header_Split) Reset() { @@ -605,6 +609,13 @@ func (x *Header_Split) GetChildren() []*grpc.ObjectID { return nil } +func (x *Header_Split) GetSplitId() []byte { + if x != nil { + return x.SplitId + } + return nil +} + var File_v2_object_grpc_types_proto protoreflect.FileDescriptor var file_v2_object_grpc_types_proto_rawDesc = []byte{ @@ -630,7 +641,7 @@ var file_v2_object_grpc_types_proto_rawDesc = []byte{ 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x52, 0x0a, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x25, 0x0a, 0x0e, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0d, 0x70, 0x61, 0x79, 0x6c, - 0x6f, 0x61, 0x64, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xe0, 0x07, 0x0a, 0x06, 0x48, 0x65, + 0x6f, 0x61, 0x64, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xfb, 0x07, 0x0a, 0x06, 0x48, 0x65, 0x61, 0x64, 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, @@ -674,7 +685,7 @@ var file_v2_object_grpc_types_proto_rawDesc = []byte{ 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, 0x1a, - 0xaa, 0x02, 0x0a, 0x05, 0x53, 0x70, 0x6c, 0x69, 0x74, 0x12, 0x30, 0x0a, 0x06, 0x70, 0x61, 0x72, + 0xc5, 0x02, 0x0a, 0x05, 0x53, 0x70, 0x6c, 0x69, 0x74, 0x12, 0x30, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 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, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x12, 0x34, 0x0a, 0x08, 0x70, @@ -692,33 +703,34 @@ var file_v2_object_grpc_types_proto_rawDesc = []byte{ 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x34, 0x0a, 0x08, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x72, 0x65, 0x6e, 0x18, 0x05, 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, 0x08, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x72, 0x65, 0x6e, 0x22, 0xc4, 0x01, 0x0a, - 0x06, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x35, 0x0a, 0x09, 0x6f, 0x62, 0x6a, 0x65, 0x63, - 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 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, 0x08, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x44, 0x12, 0x37, - 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, - 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, - 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x30, 0x0a, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, - 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, - 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, - 0x72, 0x52, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x79, - 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x70, 0x61, 0x79, 0x6c, - 0x6f, 0x61, 0x64, 0x2a, 0x3b, 0x0a, 0x0a, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x54, 0x79, 0x70, - 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x52, 0x45, 0x47, 0x55, 0x4c, 0x41, 0x52, 0x10, 0x00, 0x12, 0x0d, - 0x0a, 0x09, 0x54, 0x4f, 0x4d, 0x42, 0x53, 0x54, 0x4f, 0x4e, 0x45, 0x10, 0x01, 0x12, 0x11, 0x0a, - 0x0d, 0x53, 0x54, 0x4f, 0x52, 0x41, 0x47, 0x45, 0x5f, 0x47, 0x52, 0x4f, 0x55, 0x50, 0x10, 0x02, - 0x2a, 0x39, 0x0a, 0x09, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1a, 0x0a, - 0x16, 0x4d, 0x41, 0x54, 0x43, 0x48, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, - 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x10, 0x0a, 0x0c, 0x53, 0x54, 0x52, - 0x49, 0x4e, 0x47, 0x5f, 0x45, 0x51, 0x55, 0x41, 0x4c, 0x10, 0x01, 0x42, 0x4f, 0x5a, 0x37, 0x67, - 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, - 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, - 0x2f, 0x76, 0x32, 0x2f, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, - 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0xaa, 0x02, 0x13, 0x4e, 0x65, 0x6f, 0x46, 0x53, 0x2e, 0x41, - 0x50, 0x49, 0x2e, 0x76, 0x32, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x62, 0x06, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, + 0x49, 0x44, 0x52, 0x08, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x72, 0x65, 0x6e, 0x12, 0x19, 0x0a, 0x08, + 0x73, 0x70, 0x6c, 0x69, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, + 0x73, 0x70, 0x6c, 0x69, 0x74, 0x49, 0x44, 0x22, 0xc4, 0x01, 0x0a, 0x06, 0x4f, 0x62, 0x6a, 0x65, + 0x63, 0x74, 0x12, 0x35, 0x0a, 0x09, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x69, 0x64, 0x18, + 0x01, 0x20, 0x01, 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, + 0x08, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x44, 0x12, 0x37, 0x0a, 0x09, 0x73, 0x69, 0x67, + 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, + 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, + 0x72, 0x65, 0x12, 0x30, 0x0a, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, + 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x06, 0x68, 0x65, + 0x61, 0x64, 0x65, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x2a, 0x3b, + 0x0a, 0x0a, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0b, 0x0a, 0x07, + 0x52, 0x45, 0x47, 0x55, 0x4c, 0x41, 0x52, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x54, 0x4f, 0x4d, + 0x42, 0x53, 0x54, 0x4f, 0x4e, 0x45, 0x10, 0x01, 0x12, 0x11, 0x0a, 0x0d, 0x53, 0x54, 0x4f, 0x52, + 0x41, 0x47, 0x45, 0x5f, 0x47, 0x52, 0x4f, 0x55, 0x50, 0x10, 0x02, 0x2a, 0x39, 0x0a, 0x09, 0x4d, + 0x61, 0x74, 0x63, 0x68, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1a, 0x0a, 0x16, 0x4d, 0x41, 0x54, 0x43, + 0x48, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, + 0x45, 0x44, 0x10, 0x00, 0x12, 0x10, 0x0a, 0x0c, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x5f, 0x45, + 0x51, 0x55, 0x41, 0x4c, 0x10, 0x01, 0x42, 0x4f, 0x5a, 0x37, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, + 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, + 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x6f, + 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x6f, 0x62, 0x6a, 0x65, 0x63, + 0x74, 0xaa, 0x02, 0x13, 0x4e, 0x65, 0x6f, 0x46, 0x53, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x76, 0x32, + 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/v2/session/grpc/types.pb.go b/v2/session/grpc/types.pb.go index 7140ceb..76331a0 100644 --- a/v2/session/grpc/types.pb.go +++ b/v2/session/grpc/types.pb.go @@ -723,7 +723,7 @@ type SessionToken_Body_Object struct { func (*SessionToken_Body_Object) isSessionToken_Body_Context() {} -// Lifetime parameters of the token. Filed names taken from rfc7519. +// Lifetime parameters of the token. Field names taken from rfc7519. type SessionToken_Body_TokenLifetime struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache From b9778464b9589b4590191efa0628151aa551c19a Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Tue, 24 Nov 2020 20:14:03 +0300 Subject: [PATCH 0594/1196] [#209] v2/object: Add splitID to unified structure * Add getters/setters * Support stable marshaling * Support converters Signed-off-by: Alex Vanin --- v2/object/convert.go | 4 ++++ v2/object/marshal.go | 8 ++++++++ v2/object/marshal_test.go | 1 + v2/object/types.go | 16 ++++++++++++++++ 4 files changed, 29 insertions(+) diff --git a/v2/object/convert.go b/v2/object/convert.go index 51a2cd8..0768689 100644 --- a/v2/object/convert.go +++ b/v2/object/convert.go @@ -135,6 +135,8 @@ func SplitHeaderToGRPCMessage(h *SplitHeader) *object.Header_Split { m.SetChildren(childMsg) + m.SetSplitId(h.GetSplitID()) + return m } @@ -170,6 +172,8 @@ func SplitHeaderFromGRPCMessage(m *object.Header_Split) *SplitHeader { h.SetChildren(children) + h.SetSplitID(m.GetSplitId()) + return h } diff --git a/v2/object/marshal.go b/v2/object/marshal.go index b59419e..4e54b34 100644 --- a/v2/object/marshal.go +++ b/v2/object/marshal.go @@ -21,6 +21,7 @@ const ( splitHdrParentSignatureField = 3 splitHdrParentHeaderField = 4 splitHdrChildrenField = 5 + splitHdrSplitIDField = 6 hdrVersionField = 1 hdrContainerIDField = 2 @@ -275,6 +276,11 @@ func (h *SplitHeader) StableMarshal(buf []byte) ([]byte, error) { offset += n } + _, err = proto.BytesMarshal(splitHdrSplitIDField, buf[offset:], h.splitID) + if err != nil { + return nil, err + } + return buf, nil } @@ -292,6 +298,8 @@ func (h *SplitHeader) StableSize() (size int) { size += proto.NestedStructureSize(splitHdrChildrenField, h.children[i]) } + size += proto.BytesSize(splitHdrSplitIDField, h.splitID) + return size } diff --git a/v2/object/marshal_test.go b/v2/object/marshal_test.go index efd5df3..7f811af 100644 --- a/v2/object/marshal_test.go +++ b/v2/object/marshal_test.go @@ -461,6 +461,7 @@ func generateSplit(sig string) *object.SplitHeader { split.SetParent(generateObjectID("Parent")) split.SetParentSignature(generateSignature("Key", sig)) split.SetPrevious(generateObjectID("Previous")) + split.SetSplitID([]byte("UUIDv4")) return split } diff --git a/v2/object/types.go b/v2/object/types.go index d5b37ef..6898cf6 100644 --- a/v2/object/types.go +++ b/v2/object/types.go @@ -33,6 +33,8 @@ type SplitHeader struct { parHdr *Header children []*refs.ObjectID + + splitID []byte } type Header struct { @@ -380,6 +382,20 @@ func (h *SplitHeader) SetChildren(v []*refs.ObjectID) { } } +func (h *SplitHeader) GetSplitID() []byte { + if h != nil { + return h.splitID + } + + return nil +} + +func (h *SplitHeader) SetSplitID(v []byte) { + if h != nil { + h.splitID = v + } +} + func (h *Header) GetVersion() *refs.Version { if h != nil { return h.version From 6b0bd42f25369636fb28fa99f0b72cb95b6503a5 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Tue, 24 Nov 2020 20:15:12 +0300 Subject: [PATCH 0595/1196] [#209] pkg/object: Support splitID field in SDK library Signed-off-by: Alex Vanin --- pkg/object/raw.go | 5 +++++ pkg/object/raw_test.go | 14 ++++++++++++++ pkg/object/rw.go | 15 +++++++++++++++ 3 files changed, 34 insertions(+) diff --git a/pkg/object/raw.go b/pkg/object/raw.go index 2615530..5ae3108 100644 --- a/pkg/object/raw.go +++ b/pkg/object/raw.go @@ -110,6 +110,11 @@ func (o *RawObject) SetChildren(v ...*ID) { o.setChildren(v...) } +// SetSplitID sets split identifier for the split object. +func (o *RawObject) SetSplitID(v []byte) { + o.setSplitID(v) +} + // SetParentID sets identifier of the parent object. func (o *RawObject) SetParentID(v *ID) { o.setParentID(v) diff --git a/pkg/object/raw_test.go b/pkg/object/raw_test.go index 2aabca4..f6e85a8 100644 --- a/pkg/object/raw_test.go +++ b/pkg/object/raw_test.go @@ -5,6 +5,7 @@ import ( "crypto/sha256" "testing" + "github.com/google/uuid" "github.com/nspcc-dev/neofs-api-go/pkg" "github.com/nspcc-dev/neofs-api-go/pkg/container" "github.com/nspcc-dev/neofs-api-go/pkg/owner" @@ -190,6 +191,19 @@ func TestRawObject_SetChildren(t *testing.T) { require.Equal(t, []*ID{id1, id2}, obj.Children()) } +func TestRawObject_SetSplitID(t *testing.T) { + obj := NewRaw() + + require.Nil(t, obj.SplitID()) + + splitID, err := uuid.New().MarshalBinary() + require.NoError(t, err) + + obj.SetSplitID(splitID) + + require.Equal(t, obj.SplitID(), splitID) +} + func TestRawObject_SetParent(t *testing.T) { obj := NewRaw() diff --git a/pkg/object/rw.go b/pkg/object/rw.go index e6be2e5..0412f91 100644 --- a/pkg/object/rw.go +++ b/pkg/object/rw.go @@ -251,6 +251,21 @@ func (o *rwObject) setChildren(v ...*ID) { }) } +// SplitID return split identity of split object. If object is not split +// returns nil. +func (o *rwObject) SplitID() []byte { + return (*object.Object)(o). + GetHeader(). + GetSplit(). + GetSplitID() +} + +func (o *rwObject) setSplitID(id []byte) { + o.setSplitFields(func(split *object.SplitHeader) { + split.SetSplitID(id) + }) +} + // ParentID returns identifier of the parent object. func (o *rwObject) ParentID() *ID { return NewIDFromV2( From 79c76e87e43f253b7721552a32c567dfe8df54e0 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Wed, 25 Nov 2020 16:31:48 +0300 Subject: [PATCH 0596/1196] [#209] object: Remove `childfree` search attribute Signed-off-by: Alex Vanin --- pkg/object/search.go | 15 --------------- v2/object/filters.go | 3 --- 2 files changed, 18 deletions(-) diff --git a/pkg/object/search.go b/pkg/object/search.go index 6c596d6..2a835ba 100644 --- a/pkg/object/search.go +++ b/pkg/object/search.go @@ -72,7 +72,6 @@ const ( fKeyParent fKeyPropRoot fKeyPropPhy - fKeyPropChildfree ) func (k filterKey) String() string { @@ -103,8 +102,6 @@ func (k filterKey) String() string { return v2object.FilterPropertyRoot case fKeyPropPhy: return v2object.FilterPropertyPhy - case fKeyPropChildfree: - return v2object.FilterPropertyChildfree } } @@ -227,18 +224,6 @@ func (f *SearchFilters) AddPhyFilter() { f.addPhyFilter() } -func (f *SearchFilters) addChildFreeFilter(val bool) { - f.addReservedFilter(MatchStringEqual, fKeyPropChildfree, boolStringer(val)) -} - -func (f *SearchFilters) AddChildfreeFilter() { - f.addChildFreeFilter(true) -} - -func (f *SearchFilters) AddNonChildfreeFilter() { - f.addChildFreeFilter(false) -} - func (f *SearchFilters) AddParentIDFilter(m SearchMatchType, id *ID) { f.addReservedFilter(m, fKeyParent, id) } diff --git a/v2/object/filters.go b/v2/object/filters.go index e0e750a..0777e96 100644 --- a/v2/object/filters.go +++ b/v2/object/filters.go @@ -41,9 +41,6 @@ const ( // FilterPropertyPhy is a filter key to check if an object physically stored on a node. FilterPropertyPhy = ReservedFilterPrefix + "PHY" - - // FilterPropertyChildfree is a filter key to check if an object has empty children list in `Split` header. - FilterPropertyChildfree = ReservedFilterPrefix + "CHILDFREE" ) const ( From 3d08d8140fa0c7be722c7bbbdcf0c1db539476a2 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Wed, 25 Nov 2020 19:32:52 +0300 Subject: [PATCH 0597/1196] [#209] object: Support `splitID` search attribute Signed-off-by: Alex Vanin --- pkg/object/raw.go | 4 +-- pkg/object/raw_test.go | 5 +--- pkg/object/rw.go | 16 ++++++----- pkg/object/search.go | 8 ++++++ pkg/object/search_test.go | 17 +++++++++++ pkg/object/splitid.go | 59 ++++++++++++++++++++++++++++++++++++++ pkg/object/splitid_test.go | 38 ++++++++++++++++++++++++ v2/object/filters.go | 3 ++ 8 files changed, 137 insertions(+), 13 deletions(-) create mode 100644 pkg/object/splitid.go create mode 100644 pkg/object/splitid_test.go diff --git a/pkg/object/raw.go b/pkg/object/raw.go index 5ae3108..b7b3b17 100644 --- a/pkg/object/raw.go +++ b/pkg/object/raw.go @@ -111,8 +111,8 @@ func (o *RawObject) SetChildren(v ...*ID) { } // SetSplitID sets split identifier for the split object. -func (o *RawObject) SetSplitID(v []byte) { - o.setSplitID(v) +func (o *RawObject) SetSplitID(id *SplitID) { + o.setSplitID(id) } // SetParentID sets identifier of the parent object. diff --git a/pkg/object/raw_test.go b/pkg/object/raw_test.go index f6e85a8..902e3fa 100644 --- a/pkg/object/raw_test.go +++ b/pkg/object/raw_test.go @@ -5,7 +5,6 @@ import ( "crypto/sha256" "testing" - "github.com/google/uuid" "github.com/nspcc-dev/neofs-api-go/pkg" "github.com/nspcc-dev/neofs-api-go/pkg/container" "github.com/nspcc-dev/neofs-api-go/pkg/owner" @@ -196,9 +195,7 @@ func TestRawObject_SetSplitID(t *testing.T) { require.Nil(t, obj.SplitID()) - splitID, err := uuid.New().MarshalBinary() - require.NoError(t, err) - + splitID := NewSplitID() obj.SetSplitID(splitID) require.Equal(t, obj.SplitID(), splitID) diff --git a/pkg/object/rw.go b/pkg/object/rw.go index 0412f91..35e56f1 100644 --- a/pkg/object/rw.go +++ b/pkg/object/rw.go @@ -253,16 +253,18 @@ func (o *rwObject) setChildren(v ...*ID) { // SplitID return split identity of split object. If object is not split // returns nil. -func (o *rwObject) SplitID() []byte { - return (*object.Object)(o). - GetHeader(). - GetSplit(). - GetSplitID() +func (o *rwObject) SplitID() *SplitID { + return NewSplitIDFromV2( + (*object.Object)(o). + GetHeader(). + GetSplit(). + GetSplitID(), + ) } -func (o *rwObject) setSplitID(id []byte) { +func (o *rwObject) setSplitID(id *SplitID) { o.setSplitFields(func(split *object.SplitHeader) { - split.SetSplitID(id) + split.SetSplitID(id.ToV2()) }) } diff --git a/pkg/object/search.go b/pkg/object/search.go index 2a835ba..d23b3df 100644 --- a/pkg/object/search.go +++ b/pkg/object/search.go @@ -70,6 +70,7 @@ const ( fKeyType fKeyHomomorphicHash fKeyParent + fKeySplitID fKeyPropRoot fKeyPropPhy ) @@ -98,6 +99,8 @@ func (k filterKey) String() string { return v2object.FilterHeaderHomomorphicHash case fKeyParent: return v2object.FilterHeaderParent + case fKeySplitID: + return v2object.FilterHeaderSplitID case fKeyPropRoot: return v2object.FilterPropertyRoot case fKeyPropPhy: @@ -224,6 +227,7 @@ func (f *SearchFilters) AddPhyFilter() { f.addPhyFilter() } +// AddParentIDFilter adds filter by parent identifier. func (f *SearchFilters) AddParentIDFilter(m SearchMatchType, id *ID) { f.addReservedFilter(m, fKeyParent, id) } @@ -232,3 +236,7 @@ func (f *SearchFilters) AddParentIDFilter(m SearchMatchType, id *ID) { func (f *SearchFilters) AddObjectIDFilter(m SearchMatchType, id *ID) { f.addReservedFilter(m, fKeyObjectID, id) } + +func (f *SearchFilters) AddSplitIDFilter(m SearchMatchType, id *SplitID) { + f.addReservedFilter(m, fKeySplitID, id) +} diff --git a/pkg/object/search_test.go b/pkg/object/search_test.go index b3407cc..f477f4f 100644 --- a/pkg/object/search_test.go +++ b/pkg/object/search_test.go @@ -123,3 +123,20 @@ func TestSearchFilters_AddObjectIDFilter(t *testing.T) { require.Equal(t, v2object.MatchStringEqual, fsV2[0].GetMatchType()) }) } + +func TestSearchFilters_AddSplitIDFilter(t *testing.T) { + id := object.NewSplitID() + + fs := new(object.SearchFilters) + fs.AddSplitIDFilter(object.MatchStringEqual, id) + + t.Run("v2", func(t *testing.T) { + fsV2 := fs.ToV2() + + require.Len(t, fsV2, 1) + + require.Equal(t, v2object.FilterHeaderSplitID, fsV2[0].GetKey()) + require.Equal(t, id.String(), fsV2[0].GetValue()) + require.Equal(t, v2object.MatchStringEqual, fsV2[0].GetMatchType()) + }) +} diff --git a/pkg/object/splitid.go b/pkg/object/splitid.go new file mode 100644 index 0000000..7f39567 --- /dev/null +++ b/pkg/object/splitid.go @@ -0,0 +1,59 @@ +package object + +import ( + "github.com/google/uuid" +) + +// SplitID is a UUIDv4 used as attribute in split objects. +type SplitID struct { + uuid uuid.UUID +} + +// NewSplitID returns UUID representation of splitID attribute. +func NewSplitID() *SplitID { + return &SplitID{ + uuid: uuid.New(), + } +} + +// NewSplitIDFromV2 returns parsed UUID from bytes. +// If v is invalid UUIDv4 byte sequence, then function returns nil. +func NewSplitIDFromV2(v []byte) *SplitID { + id := uuid.New() + + err := id.UnmarshalBinary(v) + if err != nil { + return nil + } + + return &SplitID{ + uuid: id, + } +} + +// Parse converts UUIDv4 string representation into SplitID. +func (id *SplitID) Parse(s string) (err error) { + id.uuid, err = uuid.Parse(s) + if err != nil { + return err + } + + return nil +} + +// String returns UUIDv4 string representation of SplitID. +func (id SplitID) String() string { + return id.uuid.String() +} + +// SetUUID sets pre created UUID structure as SplitID. +func (id *SplitID) SetUUID(v uuid.UUID) { + id.uuid = v +} + +// ToV2 converts SplitID to a representation of SplitID in neofs-api v2. +func (id SplitID) ToV2() []byte { + data, _ := id.uuid.MarshalBinary() // err is always nil + + return data +} diff --git a/pkg/object/splitid_test.go b/pkg/object/splitid_test.go new file mode 100644 index 0000000..3e144eb --- /dev/null +++ b/pkg/object/splitid_test.go @@ -0,0 +1,38 @@ +package object_test + +import ( + "testing" + + "github.com/google/uuid" + "github.com/nspcc-dev/neofs-api-go/pkg/object" + "github.com/stretchr/testify/require" +) + +func TestSplitID(t *testing.T) { + id := object.NewSplitID() + + t.Run("toV2/fromV2", func(t *testing.T) { + data := id.ToV2() + + newID := object.NewSplitIDFromV2(data) + require.NotNil(t, newID) + + require.Equal(t, id, newID) + }) + + t.Run("string/parse", func(t *testing.T) { + idStr := id.String() + + newID := object.NewSplitID() + require.NoError(t, newID.Parse(idStr)) + + require.Equal(t, id, newID) + }) + + t.Run("set UUID", func(t *testing.T) { + newUUID := uuid.New() + id.SetUUID(newUUID) + + require.Equal(t, newUUID.String(), id.String()) + }) +} diff --git a/v2/object/filters.go b/v2/object/filters.go index 0777e96..8340cea 100644 --- a/v2/object/filters.go +++ b/v2/object/filters.go @@ -33,6 +33,9 @@ const ( // FilterHeaderParent is a filter key to "split.parent" field of the object header. FilterHeaderParent = ReservedFilterPrefix + "split.parent" + + // FilterHeaderParent is a filter key to "split.splitID" field of the object header. + FilterHeaderSplitID = ReservedFilterPrefix + "split.splitID" ) const ( From 2a94fdc5e70977c94100aa6bc145bd9310efcbf2 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Thu, 26 Nov 2020 13:00:03 +0300 Subject: [PATCH 0598/1196] [#209] Support nil value in SplitID SplitID is not set on non-split and virtual objects, so we should support this state in library. Signed-off-by: Alex Vanin --- pkg/object/splitid.go | 16 +++++++++++++--- pkg/object/splitid_test.go | 9 +++++++++ 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/pkg/object/splitid.go b/pkg/object/splitid.go index 7f39567..8e9eaa2 100644 --- a/pkg/object/splitid.go +++ b/pkg/object/splitid.go @@ -42,17 +42,27 @@ func (id *SplitID) Parse(s string) (err error) { } // String returns UUIDv4 string representation of SplitID. -func (id SplitID) String() string { +func (id *SplitID) String() string { + if id == nil { + return "" + } + return id.uuid.String() } // SetUUID sets pre created UUID structure as SplitID. func (id *SplitID) SetUUID(v uuid.UUID) { - id.uuid = v + if id != nil { + id.uuid = v + } } // ToV2 converts SplitID to a representation of SplitID in neofs-api v2. -func (id SplitID) ToV2() []byte { +func (id *SplitID) ToV2() []byte { + if id == nil { + return nil + } + data, _ := id.uuid.MarshalBinary() // err is always nil return data diff --git a/pkg/object/splitid_test.go b/pkg/object/splitid_test.go index 3e144eb..8adcc86 100644 --- a/pkg/object/splitid_test.go +++ b/pkg/object/splitid_test.go @@ -35,4 +35,13 @@ func TestSplitID(t *testing.T) { require.Equal(t, newUUID.String(), id.String()) }) + + t.Run("nil value", func(t *testing.T) { + var newID *object.SplitID + + require.NotPanics(t, func() { + require.Nil(t, newID.ToV2()) + require.Equal(t, "", newID.String()) + }) + }) } From c01024b5531ad1b123fb6f400b16173fc01f7307 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 1 Dec 2020 09:39:35 +0300 Subject: [PATCH 0599/1196] [#217] pkg/eacl: Change interface for working with keys on Target and Record In previous implementation Target provided Keys/SetKeys methods which allowed working with ECDSA keys. There was also a bug in the NewTargetFromV2 function when the binary key differed in format from the ECDSA key. New BinaryKeys/SetBinaryKeys methods work with binary keys. To work with ECDSA keys added functions TargetECDSAKeys/SetTargetECDSAKeys. Old methods are left and marked deprecated. Type Record provided an interface for adding a Target by Role and a list of ECDSA keys. New SetTargets method allows to set the list of Target's, AddTarget function allows to add a single Target. AddFormedTarget works like old AddTarget method, which is now deprecated. Signed-off-by: Leonard Lyubich --- pkg/acl/eacl/record.go | 29 ++++++++--- pkg/acl/eacl/record_test.go | 34 ++++++++++--- pkg/acl/eacl/target.go | 97 +++++++++++++++++++++++++++++-------- pkg/acl/eacl/target_test.go | 17 +++---- 4 files changed, 134 insertions(+), 43 deletions(-) diff --git a/pkg/acl/eacl/record.go b/pkg/acl/eacl/record.go index dd4abbf..fec9d50 100644 --- a/pkg/acl/eacl/record.go +++ b/pkg/acl/eacl/record.go @@ -26,6 +26,11 @@ func (r Record) Targets() []*Target { return r.targets } +// SetTargets sets list of target subjects to apply ACL rule to. +func (r *Record) SetTargets(targets ...*Target) { + r.targets = targets +} + // Filters returns list of filters to match and see if rule is applicable. func (r Record) Filters() []*Filter { return r.filters @@ -52,17 +57,25 @@ func (r *Record) SetAction(action Action) { } // AddTarget adds target subject with specified Role and key list. +// +// Deprecated: use AddFormedTarget instead. func (r *Record) AddTarget(role Role, keys ...ecdsa.PublicKey) { - t := &Target{ - role: role, - keys: make([]ecdsa.PublicKey, 0, len(keys)), - } + AddFormedTarget(r, role, keys...) +} - for i := range keys { - t.keys = append(t.keys, keys[i]) - } +// AddRecordTarget adds single Target to the Record. +func AddRecordTarget(r *Record, t *Target) { + r.SetTargets(append(r.Targets(), t)...) +} - r.targets = append(r.targets, t) +// AddFormedTarget forms Target with specified Role and list of +// ECDSA public keys and adds it to the Record. +func AddFormedTarget(r *Record, role Role, keys ...ecdsa.PublicKey) { + t := NewTarget() + t.SetRole(role) + SetTargetECDSAKeys(t, ecdsaKeysToPtrs(keys)...) + + AddRecordTarget(r, t) } func (r *Record) addFilter(from FilterHeaderType, m Match, keyTyp filterKeyType, key string, val fmt.Stringer) { diff --git a/pkg/acl/eacl/record_test.go b/pkg/acl/eacl/record_test.go index 87b5345..a22f223 100644 --- a/pkg/acl/eacl/record_test.go +++ b/pkg/acl/eacl/record_test.go @@ -15,7 +15,10 @@ func TestRecord(t *testing.T) { record.SetAction(ActionAllow) record.AddFilter(HeaderFromRequest, MatchStringEqual, "A", "B") record.AddFilter(HeaderFromRequest, MatchStringNotEqual, "C", "D") - record.AddTarget(RoleSystem) + + target := NewTarget() + target.SetRole(RoleSystem) + AddRecordTarget(record, target) v2 := record.ToV2() require.NotNil(t, v2) @@ -38,8 +41,11 @@ func TestRecord(t *testing.T) { }) } -func TestRecord_AddTarget(t *testing.T) { - targets := []*Target{ +func TestAddFormedTarget(t *testing.T) { + items := []struct { + role Role + keys []ecdsa.PublicKey + }{ { role: RoleUnknown, keys: []ecdsa.PublicKey{test.DecodeKey(1).PublicKey}, @@ -50,12 +56,26 @@ func TestRecord_AddTarget(t *testing.T) { }, } + targets := make([]*Target, 0, len(items)) + r := NewRecord() - for _, target := range targets { - r.AddTarget(target.Role(), target.Keys()...) + + for _, item := range items { + tgt := NewTarget() + tgt.SetRole(item.role) + SetTargetECDSAKeys(tgt, ecdsaKeysToPtrs(item.keys)...) + + targets = append(targets, tgt) + + AddFormedTarget(r, item.role, item.keys...) } - require.Equal(t, targets, r.Targets()) + tgts := r.Targets() + require.Len(t, tgts, len(targets)) + + for _, tgt := range targets { + require.Contains(t, tgts, tgt) + } } func TestRecord_AddFilter(t *testing.T) { @@ -77,7 +97,7 @@ func TestRecordEncoding(t *testing.T) { r.SetOperation(OperationHead) r.SetAction(ActionDeny) r.AddObjectAttributeFilter(MatchStringEqual, "key", "value") - r.AddTarget(RoleSystem, test.DecodeKey(-1).PublicKey) + AddFormedTarget(r, RoleSystem, test.DecodeKey(-1).PublicKey) t.Run("binary", func(t *testing.T) { data, err := r.Marshal() diff --git a/pkg/acl/eacl/target.go b/pkg/acl/eacl/target.go index 0d15bda..b951082 100644 --- a/pkg/acl/eacl/target.go +++ b/pkg/acl/eacl/target.go @@ -13,17 +13,88 @@ import ( // Target is compatible with v2 acl.EACLRecord.Target message. type Target struct { role Role - keys []ecdsa.PublicKey + keys [][]byte } -// SetKeys sets list of public keys to identify target subject. +func ecdsaKeysToPtrs(keys []ecdsa.PublicKey) []*ecdsa.PublicKey { + keysPtr := make([]*ecdsa.PublicKey, len(keys)) + + for i := range keys { + keysPtr[i] = &keys[i] + } + + return keysPtr +} + +// SetKeys sets list of ECDSA public keys to identify target subject. +// +// Deprecated: use SetTargetECDSAKeys instead. func (t *Target) SetKeys(keys ...ecdsa.PublicKey) { + SetTargetECDSAKeys(t, ecdsaKeysToPtrs(keys)...) +} + +// Keys returns list of ECDSA public keys to identify target subject. +// If some key has a different format, it is ignored. +// +// Deprecated: use TargetECDSAKeys instead. +func (t *Target) Keys() []ecdsa.PublicKey { + keysPtr := TargetECDSAKeys(t) + keys := make([]ecdsa.PublicKey, 0, len(keysPtr)) + + for i := range keysPtr { + if keysPtr[i] != nil { + keys = append(keys, *keysPtr[i]) + } + } + + return keys +} + +// BinaryKeys returns list of public keys to identify +// target subject in a binary format. +func (t *Target) BinaryKeys() [][]byte { + return t.keys +} + +// SetBinaryKeys sets list of binary public keys to identify +// target subject. +func (t *Target) SetBinaryKeys(keys [][]byte) { t.keys = keys } -// Keys returns list of public keys to identify target subject. -func (t Target) Keys() []ecdsa.PublicKey { - return t.keys +// SetTargetECDSAKeys converts ECDSA public keys to a binary +// format and stores them in Target. +func SetTargetECDSAKeys(t *Target, keys ...*ecdsa.PublicKey) { + binKeys := t.BinaryKeys() + ln := len(keys) + + if cap(binKeys) >= ln { + binKeys = binKeys[:0] + } else { + binKeys = make([][]byte, 0, ln) + } + + for i := 0; i < ln; i++ { + binKeys = append(binKeys, crypto.MarshalPublicKey(keys[i])) + } + + t.SetBinaryKeys(binKeys) +} + +// TargetECDSAKeys interprets binary public keys of Target +// as ECDSA public keys. If any key has a different format, +// the corresponding element will be nil. +func TargetECDSAKeys(t *Target) []*ecdsa.PublicKey { + binKeys := t.BinaryKeys() + ln := len(binKeys) + + keys := make([]*ecdsa.PublicKey, ln) + + for i := 0; i < ln; i++ { + keys[i] = crypto.UnmarshalPublicKey(binKeys[i]) + } + + return keys } // SetRole sets target subject's role class. @@ -38,16 +109,10 @@ func (t Target) Role() Role { // ToV2 converts Target to v2 acl.EACLRecord.Target message. func (t *Target) ToV2() *v2acl.Target { - keys := make([][]byte, 0, len(t.keys)) - for i := range t.keys { - key := crypto.MarshalPublicKey(&t.keys[i]) - keys = append(keys, key) - } - target := new(v2acl.Target) target.SetRole(t.role.ToV2()) - target.SetKeys(keys) + target.SetKeys(t.keys) return target } @@ -66,13 +131,7 @@ func NewTargetFromV2(target *v2acl.Target) *Target { } t.role = RoleFromV2(target.GetRole()) - v2keys := target.GetKeys() - t.keys = make([]ecdsa.PublicKey, 0, len(v2keys)) - - for i := range v2keys { - key := crypto.UnmarshalPublicKey(v2keys[i]) - t.keys = append(t.keys, *key) - } + t.keys = target.GetKeys() return t } diff --git a/pkg/acl/eacl/target_test.go b/pkg/acl/eacl/target_test.go index 712804c..5c33ec7 100644 --- a/pkg/acl/eacl/target_test.go +++ b/pkg/acl/eacl/target_test.go @@ -11,22 +11,21 @@ import ( ) func TestTarget(t *testing.T) { - keys := []ecdsa.PublicKey{ - test.DecodeKey(1).PublicKey, - test.DecodeKey(2).PublicKey, + keys := []*ecdsa.PublicKey{ + &test.DecodeKey(1).PublicKey, + &test.DecodeKey(2).PublicKey, } - target := &Target{ - role: RoleSystem, - keys: keys, - } + target := NewTarget() + target.SetRole(RoleSystem) + SetTargetECDSAKeys(target, keys...) v2 := target.ToV2() require.NotNil(t, v2) require.Equal(t, v2acl.RoleSystem, v2.GetRole()) require.Len(t, v2.GetKeys(), len(keys)) for i, key := range v2.GetKeys() { - require.Equal(t, key, crypto.MarshalPublicKey(&keys[i])) + require.Equal(t, key, crypto.MarshalPublicKey(keys[i])) } newTarget := NewTargetFromV2(v2) @@ -40,7 +39,7 @@ func TestTarget(t *testing.T) { func TestTargetEncoding(t *testing.T) { tar := NewTarget() tar.SetRole(RoleSystem) - tar.SetKeys(test.DecodeKey(-1).PublicKey) + SetTargetECDSAKeys(tar, &test.DecodeKey(-1).PublicKey) t.Run("binary", func(t *testing.T) { data, err := tar.Marshal() From ea6b6adfe029815d6f5cf82ba2c68128e5d8a1ed Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Fri, 27 Nov 2020 11:46:25 +0300 Subject: [PATCH 0600/1196] [#157] netmap: Fallback to using minimal backup factor Use CBF=1 when strict policy can't be satisfied. Signed-off-by: Evgenii Stratonikov --- pkg/netmap/selector.go | 24 ++++++++++++++++-------- pkg/netmap/selector_test.go | 30 +++++++++++++++++++++++++++++- 2 files changed, 45 insertions(+), 9 deletions(-) diff --git a/pkg/netmap/selector.go b/pkg/netmap/selector.go index f12027c..ec1aa3d 100644 --- a/pkg/netmap/selector.go +++ b/pkg/netmap/selector.go @@ -36,14 +36,14 @@ func (c *Context) processSelectors(p *PlacementPolicy) error { return nil } -// GetNodesCount returns amount of buckets and nodes in every bucket -// for a given placement policy. -func GetNodesCount(p *PlacementPolicy, s *Selector) (int, int) { +// GetNodesCount returns amount of buckets and minimum number of nodes in every bucket +// for the given selector. +func GetNodesCount(_ *PlacementPolicy, s *Selector) (int, int) { switch s.Clause() { case ClauseSame: - return 1, int(p.ContainerBackupFactor() * s.Count()) + return 1, int(s.Count()) default: - return int(s.Count()), int(p.ContainerBackupFactor()) + return int(s.Count()), 1 } } @@ -69,17 +69,25 @@ func (c *Context) getSelection(p *PlacementPolicy, s *Selector) ([]Nodes, error) } } + maxNodesInBucket := nodesInBucket * int(p.ContainerBackupFactor()) nodes := make([]Nodes, 0, len(buckets)) + fallback := make([]Nodes, 0, len(buckets)) for i := range buckets { ns := buckets[i].nodes - if len(ns) >= nodesInBucket { - nodes = append(nodes, ns[:nodesInBucket]) + if len(ns) >= maxNodesInBucket { + nodes = append(nodes, ns[:maxNodesInBucket]) + } else if len(ns) >= nodesInBucket { + fallback = append(fallback, ns) } } if len(nodes) < bucketCount { - return nil, fmt.Errorf("%w: '%s'", ErrNotEnoughNodes, s.Name()) + // Fallback to using minimum allowed backup factor (1). + nodes = append(nodes, fallback...) + if len(nodes) < bucketCount { + return nil, fmt.Errorf("%w: '%s'", ErrNotEnoughNodes, s.Name()) + } } if len(c.pivot) != 0 { diff --git a/pkg/netmap/selector_test.go b/pkg/netmap/selector_test.go index 7f74f21..b1cf378 100644 --- a/pkg/netmap/selector_test.go +++ b/pkg/netmap/selector_test.go @@ -92,6 +92,33 @@ func TestPlacementPolicy_GetPlacementVectors(t *testing.T) { require.Equal(t, len(v.Replicas()[1]), len(ids), "not all nodes we distinct") } +func TestPlacementPolicy_LowerBound(t *testing.T) { + p := newPlacementPolicy( + 2, // backup factor + []*Replica{ + newReplica(1, "X"), + }, + []*Selector{ + newSelector("X", "Country", ClauseSame, 2, "*"), + }, + nil, // filters + ) + + nodes := []NodeInfo{ + nodeInfoFromAttributes("ID", "1", "Country", "DE"), + nodeInfoFromAttributes("ID", "2", "Country", "DE"), + nodeInfoFromAttributes("ID", "3", "Country", "DE"), + } + + nm, err := NewNetmap(NodesFromInfo(nodes)) + require.NoError(t, err) + + v, err := nm.GetContainerNodes(p, nil) + require.NoError(t, err) + + require.Equal(t, 3, len(v.Flatten())) +} + func TestPlacementPolicy_ProcessSelectors(t *testing.T) { p := newPlacementPolicy(2, nil, []*Selector{ @@ -128,6 +155,7 @@ func TestPlacementPolicy_ProcessSelectors(t *testing.T) { sel := c.Selections[s.Name()] s := c.Selectors[s.Name()] bucketCount, nodesInBucket := GetNodesCount(p, s) + nodesInBucket *= int(p.ContainerBackupFactor()) targ := fmt.Sprintf("selector '%s'", s.Name()) require.Equal(t, bucketCount, len(sel), targ) for _, res := range sel { @@ -216,7 +244,7 @@ func TestPlacementPolicy_ProcessSelectorsInvalid(t *testing.T) { { "NotEnoughNodes (backup factor)", newPlacementPolicy(2, nil, - []*Selector{newSelector("MyStore", "Country", ClauseDistinct, 1, "FromRU")}, + []*Selector{newSelector("MyStore", "Country", ClauseDistinct, 2, "FromRU")}, []*Filter{newFilter("FromRU", "Country", "Russia", OpEQ)}), ErrNotEnoughNodes, }, From 4e65fa41b8eb6cd24bcf8012a57c552f24f02078 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Fri, 27 Nov 2020 12:20:06 +0300 Subject: [PATCH 0601/1196] [#213] netmap: Do not append not twice if selector is unnamed Signed-off-by: Evgenii Stratonikov --- pkg/netmap/netmap.go | 2 ++ pkg/netmap/selector_test.go | 26 ++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/pkg/netmap/netmap.go b/pkg/netmap/netmap.go index 95e823b..e8ea647 100644 --- a/pkg/netmap/netmap.go +++ b/pkg/netmap/netmap.go @@ -68,6 +68,8 @@ func (m *Netmap) GetContainerNodes(p *PlacementPolicy, pivot []byte) (ContainerN for _, s := range p.Selectors() { result[i] = append(result[i], flattenNodes(c.Selections[s.Name()])...) } + + continue } nodes, ok := c.Selections[r.Selector()] diff --git a/pkg/netmap/selector_test.go b/pkg/netmap/selector_test.go index b1cf378..20f5beb 100644 --- a/pkg/netmap/selector_test.go +++ b/pkg/netmap/selector_test.go @@ -119,6 +119,32 @@ func TestPlacementPolicy_LowerBound(t *testing.T) { require.Equal(t, 3, len(v.Flatten())) } +func TestIssue213(t *testing.T) { + p := newPlacementPolicy(1, + []*Replica{ + newReplica(4, ""), + }, + []*Selector{ + newSelector("", "", ClauseDistinct, 4, "LOC_EU"), + }, + []*Filter{ + newFilter("LOC_EU", "Location", "Europe", OpEQ), + }) + nodes := []NodeInfo{ + nodeInfoFromAttributes("Location", "Europe", "Country", "Russia", "City", "Moscow"), + nodeInfoFromAttributes("Location", "Europe", "Country", "Russia", "City", "Saint-Petersburg"), + nodeInfoFromAttributes("Location", "Europe", "Country", "Sweden", "City", "Stockholm"), + nodeInfoFromAttributes("Location", "Europe", "Country", "Finalnd", "City", "Helsinki"), + } + + nm, err := NewNetmap(NodesFromInfo(nodes)) + require.NoError(t, err) + + v, err := nm.GetContainerNodes(p, nil) + require.NoError(t, err) + require.Equal(t, 4, len(v.Flatten())) +} + func TestPlacementPolicy_ProcessSelectors(t *testing.T) { p := newPlacementPolicy(2, nil, []*Selector{ From 4e0a11b71a76f8268c8302067e821c719b16aed9 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Fri, 27 Nov 2020 12:41:56 +0300 Subject: [PATCH 0602/1196] [#156] netmap: Use default value for CBF if unset Signed-off-by: Evgenii Stratonikov --- pkg/netmap/netmap.go | 6 ++++++ pkg/netmap/selector_test.go | 23 +++++++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/pkg/netmap/netmap.go b/pkg/netmap/netmap.go index e8ea647..4e63e15 100644 --- a/pkg/netmap/netmap.go +++ b/pkg/netmap/netmap.go @@ -6,6 +6,8 @@ import ( "github.com/nspcc-dev/hrw" ) +const defaultCBF = 3 + // Netmap represents netmap which contains preprocessed nodes. type Netmap struct { Nodes Nodes @@ -49,6 +51,10 @@ func (m *Netmap) GetContainerNodes(p *PlacementPolicy, pivot []byte) (ContainerN c := NewContext(m) c.setPivot(pivot) + if p.ContainerBackupFactor() == 0 { + p.SetContainerBackupFactor(defaultCBF) + } + if err := c.processFilters(p); err != nil { return nil, err } diff --git a/pkg/netmap/selector_test.go b/pkg/netmap/selector_test.go index 20f5beb..8ba4465 100644 --- a/pkg/netmap/selector_test.go +++ b/pkg/netmap/selector_test.go @@ -31,6 +31,29 @@ func TestPlacementPolicy_UnspecifiedClause(t *testing.T) { require.Equal(t, 4, len(v.Flatten())) } +func TestPlacementPolicy_DefaultCBF(t *testing.T) { + p := newPlacementPolicy(0, + []*Replica{ + newReplica(1, "EU"), + }, + []*Selector{ + newSelector("EU", "Location", ClauseSame, 1, "*"), + }, + nil) + nodes := []NodeInfo{ + nodeInfoFromAttributes("Location", "Europe", "Country", "RU", "City", "St.Petersburg"), + nodeInfoFromAttributes("Location", "Europe", "Country", "RU", "City", "Moscow"), + nodeInfoFromAttributes("Location", "Europe", "Country", "DE", "City", "Berlin"), + nodeInfoFromAttributes("Location", "Europe", "Country", "FR", "City", "Paris"), + } + + nm, err := NewNetmap(NodesFromInfo(nodes)) + require.NoError(t, err) + v, err := nm.GetContainerNodes(p, nil) + require.NoError(t, err) + require.Equal(t, defaultCBF, len(v.Flatten())) +} + func TestPlacementPolicy_GetPlacementVectors(t *testing.T) { p := newPlacementPolicy(2, []*Replica{ From 576841e0e091a895691637763dfe6c573ed14462 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Mon, 30 Nov 2020 13:32:52 +0300 Subject: [PATCH 0603/1196] [#215] netmap: add test with multiple replicas Signed-off-by: Evgenii Stratonikov --- pkg/netmap/selector_test.go | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/pkg/netmap/selector_test.go b/pkg/netmap/selector_test.go index 8ba4465..15ab572 100644 --- a/pkg/netmap/selector_test.go +++ b/pkg/netmap/selector_test.go @@ -31,6 +31,42 @@ func TestPlacementPolicy_UnspecifiedClause(t *testing.T) { require.Equal(t, 4, len(v.Flatten())) } +// Issue #215. +func TestPlacementPolicy_MultipleREP(t *testing.T) { + p := newPlacementPolicy(1, + []*Replica{ + newReplica(1, "LOC_SPB_PLACE"), + newReplica(1, "LOC_MSK_PLACE"), + }, + []*Selector{ + newSelector("LOC_SPB_PLACE", "", ClauseUnspecified, 1, "LOC_SPB"), + newSelector("LOC_MSK_PLACE", "", ClauseUnspecified, 1, "LOC_MSK"), + }, + []*Filter{ + newFilter("LOC_SPB", "City", "Saint-Petersburg", OpEQ), + newFilter("LOC_MSK", "City", "Moscow", OpEQ), + }, + ) + nodes := []NodeInfo{ + nodeInfoFromAttributes("City", "Saint-Petersburg"), + nodeInfoFromAttributes("City", "Moscow"), + nodeInfoFromAttributes("City", "Berlin"), + nodeInfoFromAttributes("City", "Paris"), + } + nm, err := NewNetmap(NodesFromInfo(nodes)) + require.NoError(t, err) + + v, err := nm.GetContainerNodes(p, nil) + require.NoError(t, err) + + rs := v.Replicas() + require.Equal(t, 2, len(rs)) + require.Equal(t, 1, len(rs[0])) + require.Equal(t, "Saint-Petersburg", rs[0][0].Attribute("City")) + require.Equal(t, 1, len(rs[1])) + require.Equal(t, "Moscow", rs[1][0].Attribute("City")) +} + func TestPlacementPolicy_DefaultCBF(t *testing.T) { p := newPlacementPolicy(0, []*Replica{ From 707a0bcb3589ccfad668b6690e9378acebceb75c Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Thu, 3 Dec 2020 13:52:36 +0300 Subject: [PATCH 0604/1196] [#220] netmap: process `REP X` policies correctly For `REP X` select X nodes from the default filter and fail if it cannot be done. Signed-off-by: Evgenii Stratonikov --- pkg/netmap/netmap.go | 13 +++++++++++++ pkg/netmap/selector_test.go | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) diff --git a/pkg/netmap/netmap.go b/pkg/netmap/netmap.go index 4e63e15..080dd77 100644 --- a/pkg/netmap/netmap.go +++ b/pkg/netmap/netmap.go @@ -71,6 +71,19 @@ func (m *Netmap) GetContainerNodes(p *PlacementPolicy, pivot []byte) (ContainerN } if r.Selector() == "" { + if len(p.Selectors()) == 0 { + s := new(Selector) + s.SetCount(r.Count()) + s.SetFilter(MainFilterName) + + nodes, err := c.getSelection(p, s) + if err != nil { + return nil, err + } + + result[i] = flattenNodes(nodes) + } + for _, s := range p.Selectors() { result[i] = append(result[i], flattenNodes(c.Selections[s.Name()])...) } diff --git a/pkg/netmap/selector_test.go b/pkg/netmap/selector_test.go index 15ab572..81fcd58 100644 --- a/pkg/netmap/selector_test.go +++ b/pkg/netmap/selector_test.go @@ -31,6 +31,43 @@ func TestPlacementPolicy_UnspecifiedClause(t *testing.T) { require.Equal(t, 4, len(v.Flatten())) } +func TestPlacementPolicy_Minimal(t *testing.T) { + nodes := []NodeInfo{ + nodeInfoFromAttributes("City", "Saint-Petersburg"), + nodeInfoFromAttributes("City", "Moscow"), + nodeInfoFromAttributes("City", "Berlin"), + nodeInfoFromAttributes("City", "Paris"), + } + nm, err := NewNetmap(NodesFromInfo(nodes)) + require.NoError(t, err) + + runTest := func(t *testing.T, rep uint32, expectError bool) { + p := newPlacementPolicy(0, + []*Replica{newReplica(rep, "")}, + nil, nil) + + v, err := nm.GetContainerNodes(p, nil) + + if expectError { + require.Error(t, err) + return + } + + require.NoError(t, err) + require.EqualValues(t, rep, len(v.Flatten())) + } + + t.Run("REP 1", func(t *testing.T) { + runTest(t, 1, false) + }) + t.Run("REP 3", func(t *testing.T) { + runTest(t, 3, false) + }) + t.Run("REP 5", func(t *testing.T) { + runTest(t, 5, true) + }) +} + // Issue #215. func TestPlacementPolicy_MultipleREP(t *testing.T) { p := newPlacementPolicy(1, From 1fdeca84e15bf65249c52031568d1035f90816b8 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Wed, 2 Dec 2020 13:10:43 +0300 Subject: [PATCH 0605/1196] [#218] Support SplitInfo structure Signed-off-by: Alex Vanin --- pkg/client/object.go | 2 + pkg/object/splitinfo.go | 49 +++ pkg/object/splitinfo_test.go | 42 ++ v2/object/convert.go | 48 +++ v2/object/grpc/service.go | 9 + v2/object/grpc/service.pb.go | 724 ++++++++++++++++++----------------- v2/object/grpc/types.go | 21 + v2/object/grpc/types.pb.go | 201 +++++++--- v2/object/marshal.go | 64 +++- v2/object/marshal_test.go | 30 +- v2/object/types.go | 52 +++ 11 files changed, 832 insertions(+), 410 deletions(-) create mode 100644 pkg/object/splitinfo.go create mode 100644 pkg/object/splitinfo_test.go diff --git a/pkg/client/object.go b/pkg/client/object.go index 04812da..df60f6f 100644 --- a/pkg/client/object.go +++ b/pkg/client/object.go @@ -445,6 +445,8 @@ func (c *Client) getObjectV2(ctx context.Context, p *GetObjectParams, opts ...Ca } else { payload = append(payload, v.GetChunk()...) } + case *v2object.SplitInfo: // what else can we do here? + return nil, errors.New("object not found, split info has been provided") default: panic(fmt.Sprintf("unexpected Get object part type %T", v)) } diff --git a/pkg/object/splitinfo.go b/pkg/object/splitinfo.go new file mode 100644 index 0000000..1f7494d --- /dev/null +++ b/pkg/object/splitinfo.go @@ -0,0 +1,49 @@ +package object + +import ( + "github.com/nspcc-dev/neofs-api-go/v2/object" +) + +type SplitInfo object.SplitInfo + +func NewSplitInfoFromV2(v2 *object.SplitInfo) *SplitInfo { + return (*SplitInfo)(v2) +} + +func NewSplitInfo() *SplitInfo { + return NewSplitInfoFromV2(new(object.SplitInfo)) +} + +func (s *SplitInfo) ToV2() *object.SplitInfo { + return (*object.SplitInfo)(s) +} + +func (s *SplitInfo) SplitID() *SplitID { + return NewSplitIDFromV2( + (*object.SplitInfo)(s).GetSplitID(), + ) +} + +func (s *SplitInfo) SetSplitID(v *SplitID) { + (*object.SplitInfo)(s).SetSplitID(v.ToV2()) +} + +func (s *SplitInfo) LastPart() *ID { + return NewIDFromV2( + (*object.SplitInfo)(s).GetLastPart(), + ) +} + +func (s *SplitInfo) SetLastPart(v *ID) { + (*object.SplitInfo)(s).SetLastPart(v.ToV2()) +} + +func (s *SplitInfo) Link() *ID { + return NewIDFromV2( + (*object.SplitInfo)(s).GetLink(), + ) +} + +func (s *SplitInfo) SetLink(v *ID) { + (*object.SplitInfo)(s).SetLink(v.ToV2()) +} diff --git a/pkg/object/splitinfo_test.go b/pkg/object/splitinfo_test.go new file mode 100644 index 0000000..854defe --- /dev/null +++ b/pkg/object/splitinfo_test.go @@ -0,0 +1,42 @@ +package object_test + +import ( + "crypto/rand" + "testing" + + "github.com/nspcc-dev/neofs-api-go/pkg/object" + "github.com/stretchr/testify/require" +) + +func TestSplitInfo(t *testing.T) { + s := object.NewSplitInfo() + splitID := object.NewSplitID() + lastPart := generateID() + link := generateID() + + s.SetSplitID(splitID) + require.Equal(t, splitID, s.SplitID()) + + s.SetLastPart(lastPart) + require.Equal(t, lastPart, s.LastPart()) + + s.SetLink(link) + require.Equal(t, link, s.Link()) + + t.Run("to and from v2", func(t *testing.T) { + v2 := s.ToV2() + newS := object.NewSplitInfoFromV2(v2) + + require.Equal(t, s, newS) + }) +} + +func generateID() *object.ID { + var buf [32]byte + _, _ = rand.Read(buf[:]) + + id := object.NewID() + id.SetSHA256(buf) + + return id +} diff --git a/v2/object/convert.go b/v2/object/convert.go index 0768689..ddeafb1 100644 --- a/v2/object/convert.go +++ b/v2/object/convert.go @@ -371,6 +371,46 @@ func ObjectFromGRPCMessage(m *object.Object) *Object { return o } +func SplitInfoToGRPCMessage(s *SplitInfo) *object.SplitInfo { + if s == nil { + return nil + } + + m := new(object.SplitInfo) + + m.SetSplitId(s.GetSplitID()) + + m.SetLastPart( + refs.ObjectIDToGRPCMessage(s.GetLastPart()), + ) + + m.SetLink( + refs.ObjectIDToGRPCMessage(s.GetLink()), + ) + + return m +} + +func SplitInfoFromGRPCMessage(m *object.SplitInfo) *SplitInfo { + if m == nil { + return nil + } + + r := new(SplitInfo) + + r.SetSplitID(m.GetSplitId()) + + r.SetLastPart( + refs.ObjectIDFromGRPCMessage(m.GetLastPart()), + ) + + r.SetLink( + refs.ObjectIDFromGRPCMessage(m.GetLink()), + ) + + return r +} + func GetRequestBodyToGRPCMessage(r *GetRequestBody) *object.GetRequest_Body { if r == nil { return nil @@ -520,6 +560,10 @@ func GetResponseBodyToGRPCMessage(r *GetResponseBody) *object.GetResponse_Body { m.SetChunk( GetObjectPartChunkToGRPCMessage(t), ) + case *SplitInfo: + m.SetSplitInfo( + SplitInfoToGRPCMessage(t), + ) default: panic(fmt.Sprintf("unknown object part %T", t)) } @@ -544,6 +588,10 @@ func GetResponseBodyFromGRPCMessage(m *object.GetResponse_Body) *GetResponseBody r.SetObjectPart( GetObjectPartChunkFromGRPCMessage(v), ) + case *object.GetResponse_Body_SplitInfo: + r.SetObjectPart( + SplitInfoFromGRPCMessage(v.SplitInfo), + ) default: panic(fmt.Sprintf("unknown object part %T", v)) } diff --git a/v2/object/grpc/service.go b/v2/object/grpc/service.go index aefa5b4..7acad62 100644 --- a/v2/object/grpc/service.go +++ b/v2/object/grpc/service.go @@ -93,6 +93,15 @@ func (m *GetResponse_Body) SetChunk(v *GetResponse_Body_Chunk) { } } +// SetSplitInfo sets part of the object payload. +func (m *GetResponse_Body) SetSplitInfo(v *SplitInfo) { + if m != nil { + m.ObjectPart = &GetResponse_Body_SplitInfo{ + SplitInfo: v, + } + } +} + // SetBody sets body of the response. func (m *GetResponse) SetBody(v *GetResponse_Body) { if m != nil { diff --git a/v2/object/grpc/service.pb.go b/v2/object/grpc/service.pb.go index 77f84ef..4d6c26a 100644 --- a/v2/object/grpc/service.pb.go +++ b/v2/object/grpc/service.pb.go @@ -1204,6 +1204,7 @@ type GetResponse_Body struct { // Types that are assignable to ObjectPart: // *GetResponse_Body_Init_ // *GetResponse_Body_Chunk + // *GetResponse_Body_SplitInfo ObjectPart isGetResponse_Body_ObjectPart `protobuf_oneof:"object_part"` } @@ -1260,6 +1261,13 @@ func (x *GetResponse_Body) GetChunk() []byte { return nil } +func (x *GetResponse_Body) GetSplitInfo() *SplitInfo { + if x, ok := x.GetObjectPart().(*GetResponse_Body_SplitInfo); ok { + return x.SplitInfo + } + return nil +} + type isGetResponse_Body_ObjectPart interface { isGetResponse_Body_ObjectPart() } @@ -1274,10 +1282,17 @@ type GetResponse_Body_Chunk struct { Chunk []byte `protobuf:"bytes,2,opt,name=chunk,proto3,oneof"` } +type GetResponse_Body_SplitInfo struct { + // Meta information of split hierarchy for object assembly. + SplitInfo *SplitInfo `protobuf:"bytes,3,opt,name=split_info,json=splitInfo,proto3,oneof"` +} + func (*GetResponse_Body_Init_) isGetResponse_Body_ObjectPart() {} func (*GetResponse_Body_Chunk) isGetResponse_Body_ObjectPart() {} +func (*GetResponse_Body_SplitInfo) isGetResponse_Body_ObjectPart() {} + // Initial part of the `Object` structure stream. Technically it's a // set of all `Object` structure's fields except `payload`. type GetResponse_Body_Init struct { @@ -2300,7 +2315,7 @@ var file_v2_object_grpc_service_proto_rawDesc = []byte{ 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x10, 0x0a, 0x03, 0x72, 0x61, 0x77, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x03, 0x72, 0x61, 0x77, - 0x22, 0xfb, 0x03, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x22, 0xb9, 0x04, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x36, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x42, 0x6f, @@ -2314,166 +2329,84 @@ var file_v2_object_grpc_service_proto_rawDesc = []byte{ 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, 0x97, 0x02, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x3d, 0x0a, + 0x61, 0x64, 0x65, 0x72, 0x1a, 0xd5, 0x02, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x3d, 0x0a, 0x04, 0x69, 0x6e, 0x69, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x2e, 0x49, 0x6e, 0x69, 0x74, 0x48, 0x00, 0x52, 0x04, 0x69, 0x6e, 0x69, 0x74, 0x12, 0x16, 0x0a, 0x05, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, 0x05, 0x63, - 0x68, 0x75, 0x6e, 0x6b, 0x1a, 0xa8, 0x01, 0x0a, 0x04, 0x49, 0x6e, 0x69, 0x74, 0x12, 0x35, 0x0a, - 0x09, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 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, 0x08, 0x6f, 0x62, 0x6a, 0x65, - 0x63, 0x74, 0x49, 0x64, 0x12, 0x37, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, - 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, - 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, - 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x30, 0x0a, - 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, - 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, - 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x42, - 0x0d, 0x0a, 0x0b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x70, 0x61, 0x72, 0x74, 0x22, 0x9b, - 0x04, 0x0a, 0x0a, 0x50, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x35, 0x0a, - 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x6e, 0x65, - 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x50, - 0x75, 0x74, 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, + 0x68, 0x75, 0x6e, 0x6b, 0x12, 0x3c, 0x0a, 0x0a, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x5f, 0x69, 0x6e, + 0x66, 0x6f, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x53, 0x70, 0x6c, 0x69, + 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x48, 0x00, 0x52, 0x09, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x49, 0x6e, + 0x66, 0x6f, 0x1a, 0xa8, 0x01, 0x0a, 0x04, 0x49, 0x6e, 0x69, 0x74, 0x12, 0x35, 0x0a, 0x09, 0x6f, + 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 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, 0x08, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, + 0x49, 0x64, 0x12, 0x37, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, + 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x30, 0x0a, 0x06, 0x68, + 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, + 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x48, + 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x42, 0x0d, 0x0a, + 0x0b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x70, 0x61, 0x72, 0x74, 0x22, 0x9b, 0x04, 0x0a, + 0x0a, 0x50, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x35, 0x0a, 0x04, 0x62, + 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, + 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x50, 0x75, 0x74, + 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, 0xbb, 0x02, 0x0a, + 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x3c, 0x0a, 0x04, 0x69, 0x6e, 0x69, 0x74, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, + 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x50, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x2e, 0x49, 0x6e, 0x69, 0x74, 0x48, 0x00, 0x52, 0x04, 0x69, + 0x6e, 0x69, 0x74, 0x12, 0x16, 0x0a, 0x05, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0c, 0x48, 0x00, 0x52, 0x05, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x1a, 0xcd, 0x01, 0x0a, 0x04, + 0x49, 0x6e, 0x69, 0x74, 0x12, 0x35, 0x0a, 0x09, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x69, + 0x64, 0x18, 0x01, 0x20, 0x01, 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, 0x08, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x64, 0x12, 0x37, 0x0a, 0x09, 0x73, + 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, + 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, + 0x74, 0x75, 0x72, 0x65, 0x12, 0x30, 0x0a, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x06, + 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x23, 0x0a, 0x0d, 0x63, 0x6f, 0x70, 0x69, 0x65, 0x73, + 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0c, 0x63, + 0x6f, 0x70, 0x69, 0x65, 0x73, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x42, 0x0d, 0x0a, 0x0b, 0x6f, + 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x70, 0x61, 0x72, 0x74, 0x22, 0xa0, 0x02, 0x0a, 0x0b, 0x50, + 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x36, 0x0a, 0x04, 0x62, 0x6f, + 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x50, 0x75, 0x74, 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, 0xbb, - 0x02, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x3c, 0x0a, 0x04, 0x69, 0x6e, 0x69, 0x74, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, - 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x50, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x2e, 0x49, 0x6e, 0x69, 0x74, 0x48, 0x00, 0x52, - 0x04, 0x69, 0x6e, 0x69, 0x74, 0x12, 0x16, 0x0a, 0x05, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, 0x05, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x1a, 0xcd, 0x01, - 0x0a, 0x04, 0x49, 0x6e, 0x69, 0x74, 0x12, 0x35, 0x0a, 0x09, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, + 0x52, 0x0c, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x1a, 0x3d, + 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x35, 0x0a, 0x09, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 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, 0x08, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x64, 0x12, 0x37, 0x0a, - 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, - 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, - 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x30, 0x0a, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, - 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, - 0x52, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x23, 0x0a, 0x0d, 0x63, 0x6f, 0x70, 0x69, - 0x65, 0x73, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x52, - 0x0c, 0x63, 0x6f, 0x70, 0x69, 0x65, 0x73, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x42, 0x0d, 0x0a, - 0x0b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x70, 0x61, 0x72, 0x74, 0x22, 0xa0, 0x02, 0x0a, - 0x0b, 0x50, 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x36, 0x0a, 0x04, - 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6e, 0x65, 0x6f, - 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x50, 0x75, - 0x74, 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, 0x3d, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x35, 0x0a, 0x09, 0x6f, 0x62, 0x6a, 0x65, - 0x63, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 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, 0x08, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x64, 0x22, - 0x9e, 0x02, 0x0a, 0x0d, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x12, 0x38, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x24, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, - 0x63, 0x74, 0x2e, 0x44, 0x65, 0x6c, 0x65, 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, 0x39, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x31, 0x0a, - 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, - 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, - 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, - 0x22, 0xef, 0x01, 0x0a, 0x0e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 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, 0x6f, 0x62, - 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x44, 0x65, 0x6c, 0x65, 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, 0x06, 0x0a, 0x04, 0x42, 0x6f, - 0x64, 0x79, 0x22, 0xc9, 0x02, 0x0a, 0x0b, 0x48, 0x65, 0x61, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x12, 0x36, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x22, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, - 0x65, 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 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, 0x68, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x31, 0x0a, 0x07, - 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, - 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x41, - 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, - 0x1b, 0x0a, 0x09, 0x6d, 0x61, 0x69, 0x6e, 0x5f, 0x6f, 0x6e, 0x6c, 0x79, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x08, 0x52, 0x08, 0x6d, 0x61, 0x69, 0x6e, 0x4f, 0x6e, 0x6c, 0x79, 0x12, 0x10, 0x0a, 0x03, - 0x72, 0x61, 0x77, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x03, 0x72, 0x61, 0x77, 0x22, 0x80, - 0x01, 0x0a, 0x13, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x57, 0x69, 0x74, 0x68, 0x53, 0x69, 0x67, - 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x30, 0x0a, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, - 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, - 0x52, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x37, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, - 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, - 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, - 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, - 0x65, 0x22, 0xf9, 0x02, 0x0a, 0x0c, 0x48, 0x65, 0x61, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x37, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x23, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, - 0x65, 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 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, 0x93, 0x01, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, - 0x12, 0x3f, 0x0a, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x25, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, - 0x65, 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x57, 0x69, 0x74, 0x68, 0x53, 0x69, - 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x48, 0x00, 0x52, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, - 0x72, 0x12, 0x42, 0x0a, 0x0c, 0x73, 0x68, 0x6f, 0x72, 0x74, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, - 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, - 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x53, 0x68, 0x6f, 0x72, 0x74, - 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x48, 0x00, 0x52, 0x0b, 0x73, 0x68, 0x6f, 0x72, 0x74, 0x48, - 0x65, 0x61, 0x64, 0x65, 0x72, 0x42, 0x06, 0x0a, 0x04, 0x68, 0x65, 0x61, 0x64, 0x22, 0xfb, 0x03, - 0x0a, 0x0d, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x74, 0x49, 0x44, 0x52, 0x08, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x64, 0x22, 0x9e, 0x02, + 0x0a, 0x0d, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x38, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, - 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x42, + 0x2e, 0x44, 0x65, 0x6c, 0x65, 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, @@ -2484,28 +2417,58 @@ var file_v2_object_grpc_service_proto_rawDesc = []byte{ 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, 0x95, 0x02, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x3e, 0x0a, 0x0c, - 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, - 0x65, 0x66, 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x52, - 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, - 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x76, - 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x45, 0x0a, 0x07, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, - 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, - 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, - 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x2e, 0x46, 0x69, - 0x6c, 0x74, 0x65, 0x72, 0x52, 0x07, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x73, 0x1a, 0x6c, 0x0a, - 0x06, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x3a, 0x0a, 0x0a, 0x6d, 0x61, 0x74, 0x63, 0x68, - 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1b, 0x2e, 0x6e, 0x65, - 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x4d, - 0x61, 0x74, 0x63, 0x68, 0x54, 0x79, 0x70, 0x65, 0x52, 0x09, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x54, - 0x79, 0x70, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xa2, 0x02, 0x0a, 0x0e, - 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 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, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, - 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x42, + 0x64, 0x65, 0x72, 0x1a, 0x39, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x31, 0x0a, 0x07, 0x61, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x41, 0x64, + 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0xef, + 0x01, 0x0a, 0x0e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 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, 0x6f, 0x62, 0x6a, 0x65, + 0x63, 0x74, 0x2e, 0x44, 0x65, 0x6c, 0x65, 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, 0x06, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, + 0x22, 0xc9, 0x02, 0x0a, 0x0b, 0x48, 0x65, 0x61, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x36, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, + 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 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, 0x68, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x31, 0x0a, 0x07, 0x61, 0x64, + 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6e, 0x65, + 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x41, 0x64, 0x64, + 0x72, 0x65, 0x73, 0x73, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x1b, 0x0a, + 0x09, 0x6d, 0x61, 0x69, 0x6e, 0x5f, 0x6f, 0x6e, 0x6c, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, + 0x52, 0x08, 0x6d, 0x61, 0x69, 0x6e, 0x4f, 0x6e, 0x6c, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x72, 0x61, + 0x77, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x03, 0x72, 0x61, 0x77, 0x22, 0x80, 0x01, 0x0a, + 0x13, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x57, 0x69, 0x74, 0x68, 0x53, 0x69, 0x67, 0x6e, 0x61, + 0x74, 0x75, 0x72, 0x65, 0x12, 0x30, 0x0a, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x06, + 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x37, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, + 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, + 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, + 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x22, + 0xf9, 0x02, 0x0a, 0x0c, 0x48, 0x65, 0x61, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x37, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, + 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 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, @@ -2516,140 +2479,196 @@ var file_v2_object_grpc_service_proto_rawDesc = []byte{ 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, 0x39, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x31, 0x0a, - 0x07, 0x69, 0x64, 0x5f, 0x6c, 0x69, 0x73, 0x74, 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, 0x06, 0x69, 0x64, 0x4c, 0x69, 0x73, 0x74, - 0x22, 0x37, 0x0a, 0x05, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x66, 0x66, - 0x73, 0x65, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, - 0x74, 0x12, 0x16, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x04, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xd1, 0x02, 0x0a, 0x0f, 0x47, 0x65, - 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 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, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, - 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 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, 0x68, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x31, 0x0a, 0x07, 0x61, - 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6e, - 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x41, 0x64, - 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x2d, - 0x0a, 0x05, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, - 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, - 0x2e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x05, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x22, 0x89, 0x02, - 0x0a, 0x10, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x3b, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x27, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, - 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 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, 0x1c, 0x0a, 0x04, 0x42, - 0x6f, 0x64, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0c, 0x52, 0x05, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x22, 0xa2, 0x03, 0x0a, 0x13, 0x47, 0x65, - 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x48, 0x61, 0x73, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 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, 0x6f, 0x62, 0x6a, 0x65, - 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x48, 0x61, 0x73, 0x68, 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, 0xb0, 0x01, 0x0a, 0x04, - 0x42, 0x6f, 0x64, 0x79, 0x12, 0x31, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, - 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x07, - 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x2f, 0x0a, 0x06, 0x72, 0x61, 0x6e, 0x67, 0x65, - 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, - 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x52, 0x61, 0x6e, 0x67, 0x65, - 0x52, 0x06, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x61, 0x6c, 0x74, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x73, 0x61, 0x6c, 0x74, 0x12, 0x30, 0x0a, 0x04, - 0x74, 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1c, 0x2e, 0x6e, 0x65, 0x6f, - 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x68, 0x65, 0x63, - 0x6b, 0x73, 0x75, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x22, 0xca, - 0x02, 0x0a, 0x14, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x48, 0x61, 0x73, 0x68, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3f, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, - 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, - 0x65, 0x48, 0x61, 0x73, 0x68, 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, 0x55, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x30, 0x0a, 0x04, - 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1c, 0x2e, 0x6e, 0x65, 0x6f, - 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x68, 0x65, 0x63, - 0x6b, 0x73, 0x75, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x1b, - 0x0a, 0x09, 0x68, 0x61, 0x73, 0x68, 0x5f, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x02, 0x20, 0x03, 0x28, - 0x0c, 0x52, 0x08, 0x68, 0x61, 0x73, 0x68, 0x4c, 0x69, 0x73, 0x74, 0x32, 0xb2, 0x04, 0x0a, 0x0d, - 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x44, 0x0a, - 0x03, 0x47, 0x65, 0x74, 0x12, 0x1c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, - 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, - 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x30, 0x01, 0x12, 0x44, 0x0a, 0x03, 0x50, 0x75, 0x74, 0x12, 0x1c, 0x2e, 0x6e, 0x65, 0x6f, - 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x50, 0x75, - 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, - 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x50, 0x75, 0x74, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x28, 0x01, 0x12, 0x4b, 0x0a, 0x06, 0x44, 0x65, 0x6c, - 0x65, 0x74, 0x65, 0x12, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, - 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, - 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x45, 0x0a, 0x04, 0x48, 0x65, 0x61, 0x64, 0x12, 0x1d, + 0x65, 0x61, 0x64, 0x65, 0x72, 0x1a, 0x93, 0x01, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x3f, + 0x0a, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, - 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, + 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x57, 0x69, 0x74, 0x68, 0x53, 0x69, 0x67, 0x6e, + 0x61, 0x74, 0x75, 0x72, 0x65, 0x48, 0x00, 0x52, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, + 0x42, 0x0a, 0x0c, 0x73, 0x68, 0x6f, 0x72, 0x74, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x53, 0x68, 0x6f, 0x72, 0x74, 0x48, 0x65, + 0x61, 0x64, 0x65, 0x72, 0x48, 0x00, 0x52, 0x0b, 0x73, 0x68, 0x6f, 0x72, 0x74, 0x48, 0x65, 0x61, + 0x64, 0x65, 0x72, 0x42, 0x06, 0x0a, 0x04, 0x68, 0x65, 0x61, 0x64, 0x22, 0xfb, 0x03, 0x0a, 0x0d, + 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x38, 0x0a, + 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6e, 0x65, + 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x53, + 0x65, 0x61, 0x72, 0x63, 0x68, 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, 0x95, 0x02, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x3e, 0x0a, 0x0c, 0x63, 0x6f, + 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, + 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x52, 0x0b, 0x63, + 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, + 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x76, 0x65, 0x72, + 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x45, 0x0a, 0x07, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x73, 0x18, + 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x2e, 0x46, 0x69, 0x6c, 0x74, + 0x65, 0x72, 0x52, 0x07, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x73, 0x1a, 0x6c, 0x0a, 0x06, 0x46, + 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x3a, 0x0a, 0x0a, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x5f, 0x74, + 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, + 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x4d, 0x61, 0x74, + 0x63, 0x68, 0x54, 0x79, 0x70, 0x65, 0x52, 0x09, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x54, 0x79, 0x70, + 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, + 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xa2, 0x02, 0x0a, 0x0e, 0x53, 0x65, + 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 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, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x53, 0x65, + 0x61, 0x72, 0x63, 0x68, 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, 0x39, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x31, 0x0a, 0x07, 0x69, + 0x64, 0x5f, 0x6c, 0x69, 0x73, 0x74, 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, 0x06, 0x69, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x22, 0x37, + 0x0a, 0x05, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, + 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x12, + 0x16, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, + 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xd1, 0x02, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x52, + 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 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, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, + 0x52, 0x61, 0x6e, 0x67, 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, 0x68, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x31, 0x0a, 0x07, 0x61, 0x64, 0x64, + 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6e, 0x65, 0x6f, + 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x2d, 0x0a, 0x05, + 0x72, 0x61, 0x6e, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6e, 0x65, + 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x52, + 0x61, 0x6e, 0x67, 0x65, 0x52, 0x05, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x22, 0x89, 0x02, 0x0a, 0x10, + 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x3b, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, + 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 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, 0x1c, 0x0a, 0x04, 0x42, 0x6f, 0x64, + 0x79, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, + 0x52, 0x05, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x22, 0xa2, 0x03, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x52, + 0x61, 0x6e, 0x67, 0x65, 0x48, 0x61, 0x73, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 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, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, - 0x2e, 0x48, 0x65, 0x61, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4d, 0x0a, - 0x06, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x12, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, - 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, - 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, - 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x53, 0x65, 0x61, 0x72, - 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x30, 0x01, 0x12, 0x53, 0x0a, 0x08, - 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x21, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, - 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, - 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x22, 0x2e, 0x6e, 0x65, - 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, - 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x30, - 0x01, 0x12, 0x5d, 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x48, 0x61, 0x73, - 0x68, 0x12, 0x25, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, - 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x48, 0x61, 0x73, - 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x26, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, - 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, - 0x61, 0x6e, 0x67, 0x65, 0x48, 0x61, 0x73, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x42, 0x4f, 0x5a, 0x37, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, - 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, - 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2f, - 0x67, 0x72, 0x70, 0x63, 0x3b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0xaa, 0x02, 0x13, 0x4e, 0x65, - 0x6f, 0x46, 0x53, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x76, 0x32, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, - 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x2e, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x48, 0x61, 0x73, 0x68, 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, 0xb0, 0x01, 0x0a, 0x04, 0x42, 0x6f, + 0x64, 0x79, 0x12, 0x31, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, + 0x72, 0x65, 0x66, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x07, 0x61, 0x64, + 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x2f, 0x0a, 0x06, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x73, 0x18, + 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x06, + 0x72, 0x61, 0x6e, 0x67, 0x65, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x61, 0x6c, 0x74, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x73, 0x61, 0x6c, 0x74, 0x12, 0x30, 0x0a, 0x04, 0x74, 0x79, + 0x70, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, + 0x75, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x22, 0xca, 0x02, 0x0a, + 0x14, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x48, 0x61, 0x73, 0x68, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3f, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, + 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x48, + 0x61, 0x73, 0x68, 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, 0x55, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x30, 0x0a, 0x04, 0x74, 0x79, + 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, + 0x75, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x1b, 0x0a, 0x09, + 0x68, 0x61, 0x73, 0x68, 0x5f, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0c, 0x52, + 0x08, 0x68, 0x61, 0x73, 0x68, 0x4c, 0x69, 0x73, 0x74, 0x32, 0xb2, 0x04, 0x0a, 0x0d, 0x4f, 0x62, + 0x6a, 0x65, 0x63, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x44, 0x0a, 0x03, 0x47, + 0x65, 0x74, 0x12, 0x1c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, + 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x1d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, + 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x30, + 0x01, 0x12, 0x44, 0x0a, 0x03, 0x50, 0x75, 0x74, 0x12, 0x1c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x50, 0x75, 0x74, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, + 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x50, 0x75, 0x74, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x28, 0x01, 0x12, 0x4b, 0x0a, 0x06, 0x44, 0x65, 0x6c, 0x65, 0x74, + 0x65, 0x12, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, + 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, + 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x45, 0x0a, 0x04, 0x48, 0x65, 0x61, 0x64, 0x12, 0x1d, 0x2e, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, + 0x48, 0x65, 0x61, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x6e, 0x65, + 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x48, + 0x65, 0x61, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4d, 0x0a, 0x06, 0x53, + 0x65, 0x61, 0x72, 0x63, 0x68, 0x12, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, + 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x30, 0x01, 0x12, 0x53, 0x0a, 0x08, 0x47, 0x65, + 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x21, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, + 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, + 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x22, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, + 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, + 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x30, 0x01, 0x12, + 0x5d, 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x48, 0x61, 0x73, 0x68, 0x12, + 0x25, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, + 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x48, 0x61, 0x73, 0x68, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x26, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, + 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, + 0x67, 0x65, 0x48, 0x61, 0x73, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x4f, + 0x5a, 0x37, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, + 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, + 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2f, 0x67, 0x72, + 0x70, 0x63, 0x3b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0xaa, 0x02, 0x13, 0x4e, 0x65, 0x6f, 0x46, + 0x53, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x76, 0x32, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -2706,11 +2725,12 @@ var file_v2_object_grpc_service_proto_goTypes = []interface{}{ (*Header)(nil), // 37: neo.fs.v2.object.Header (*grpc1.Signature)(nil), // 38: neo.fs.v2.refs.Signature (*grpc1.Address)(nil), // 39: neo.fs.v2.refs.Address - (*grpc1.ObjectID)(nil), // 40: neo.fs.v2.refs.ObjectID - (*ShortHeader)(nil), // 41: neo.fs.v2.object.ShortHeader - (*grpc1.ContainerID)(nil), // 42: neo.fs.v2.refs.ContainerID - (MatchType)(0), // 43: neo.fs.v2.object.MatchType - (grpc1.ChecksumType)(0), // 44: neo.fs.v2.refs.ChecksumType + (*SplitInfo)(nil), // 40: neo.fs.v2.object.SplitInfo + (*grpc1.ObjectID)(nil), // 41: neo.fs.v2.refs.ObjectID + (*ShortHeader)(nil), // 42: neo.fs.v2.object.ShortHeader + (*grpc1.ContainerID)(nil), // 43: neo.fs.v2.refs.ContainerID + (MatchType)(0), // 44: neo.fs.v2.object.MatchType + (grpc1.ChecksumType)(0), // 45: neo.fs.v2.refs.ChecksumType } var file_v2_object_grpc_service_proto_depIdxs = []int32{ 16, // 0: neo.fs.v2.object.GetRequest.body:type_name -> neo.fs.v2.object.GetRequest.Body @@ -2759,47 +2779,48 @@ var file_v2_object_grpc_service_proto_depIdxs = []int32{ 36, // 43: neo.fs.v2.object.GetRangeHashResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader 39, // 44: neo.fs.v2.object.GetRequest.Body.address:type_name -> neo.fs.v2.refs.Address 18, // 45: neo.fs.v2.object.GetResponse.Body.init:type_name -> neo.fs.v2.object.GetResponse.Body.Init - 40, // 46: neo.fs.v2.object.GetResponse.Body.Init.object_id:type_name -> neo.fs.v2.refs.ObjectID - 38, // 47: neo.fs.v2.object.GetResponse.Body.Init.signature:type_name -> neo.fs.v2.refs.Signature - 37, // 48: neo.fs.v2.object.GetResponse.Body.Init.header:type_name -> neo.fs.v2.object.Header - 20, // 49: neo.fs.v2.object.PutRequest.Body.init:type_name -> neo.fs.v2.object.PutRequest.Body.Init - 40, // 50: neo.fs.v2.object.PutRequest.Body.Init.object_id:type_name -> neo.fs.v2.refs.ObjectID - 38, // 51: neo.fs.v2.object.PutRequest.Body.Init.signature:type_name -> neo.fs.v2.refs.Signature - 37, // 52: neo.fs.v2.object.PutRequest.Body.Init.header:type_name -> neo.fs.v2.object.Header - 40, // 53: neo.fs.v2.object.PutResponse.Body.object_id:type_name -> neo.fs.v2.refs.ObjectID - 39, // 54: neo.fs.v2.object.DeleteRequest.Body.address:type_name -> neo.fs.v2.refs.Address - 39, // 55: neo.fs.v2.object.HeadRequest.Body.address:type_name -> neo.fs.v2.refs.Address - 7, // 56: neo.fs.v2.object.HeadResponse.Body.header:type_name -> neo.fs.v2.object.HeaderWithSignature - 41, // 57: neo.fs.v2.object.HeadResponse.Body.short_header:type_name -> neo.fs.v2.object.ShortHeader - 42, // 58: neo.fs.v2.object.SearchRequest.Body.container_id:type_name -> neo.fs.v2.refs.ContainerID - 27, // 59: neo.fs.v2.object.SearchRequest.Body.filters:type_name -> neo.fs.v2.object.SearchRequest.Body.Filter - 43, // 60: neo.fs.v2.object.SearchRequest.Body.Filter.match_type:type_name -> neo.fs.v2.object.MatchType - 40, // 61: neo.fs.v2.object.SearchResponse.Body.id_list:type_name -> neo.fs.v2.refs.ObjectID - 39, // 62: neo.fs.v2.object.GetRangeRequest.Body.address:type_name -> neo.fs.v2.refs.Address - 11, // 63: neo.fs.v2.object.GetRangeRequest.Body.range:type_name -> neo.fs.v2.object.Range - 39, // 64: neo.fs.v2.object.GetRangeHashRequest.Body.address:type_name -> neo.fs.v2.refs.Address - 11, // 65: neo.fs.v2.object.GetRangeHashRequest.Body.ranges:type_name -> neo.fs.v2.object.Range - 44, // 66: neo.fs.v2.object.GetRangeHashRequest.Body.type:type_name -> neo.fs.v2.refs.ChecksumType - 44, // 67: neo.fs.v2.object.GetRangeHashResponse.Body.type:type_name -> neo.fs.v2.refs.ChecksumType - 0, // 68: neo.fs.v2.object.ObjectService.Get:input_type -> neo.fs.v2.object.GetRequest - 2, // 69: neo.fs.v2.object.ObjectService.Put:input_type -> neo.fs.v2.object.PutRequest - 4, // 70: neo.fs.v2.object.ObjectService.Delete:input_type -> neo.fs.v2.object.DeleteRequest - 6, // 71: neo.fs.v2.object.ObjectService.Head:input_type -> neo.fs.v2.object.HeadRequest - 9, // 72: neo.fs.v2.object.ObjectService.Search:input_type -> neo.fs.v2.object.SearchRequest - 12, // 73: neo.fs.v2.object.ObjectService.GetRange:input_type -> neo.fs.v2.object.GetRangeRequest - 14, // 74: neo.fs.v2.object.ObjectService.GetRangeHash:input_type -> neo.fs.v2.object.GetRangeHashRequest - 1, // 75: neo.fs.v2.object.ObjectService.Get:output_type -> neo.fs.v2.object.GetResponse - 3, // 76: neo.fs.v2.object.ObjectService.Put:output_type -> neo.fs.v2.object.PutResponse - 5, // 77: neo.fs.v2.object.ObjectService.Delete:output_type -> neo.fs.v2.object.DeleteResponse - 8, // 78: neo.fs.v2.object.ObjectService.Head:output_type -> neo.fs.v2.object.HeadResponse - 10, // 79: neo.fs.v2.object.ObjectService.Search:output_type -> neo.fs.v2.object.SearchResponse - 13, // 80: neo.fs.v2.object.ObjectService.GetRange:output_type -> neo.fs.v2.object.GetRangeResponse - 15, // 81: neo.fs.v2.object.ObjectService.GetRangeHash:output_type -> neo.fs.v2.object.GetRangeHashResponse - 75, // [75:82] is the sub-list for method output_type - 68, // [68:75] is the sub-list for method input_type - 68, // [68:68] is the sub-list for extension type_name - 68, // [68:68] is the sub-list for extension extendee - 0, // [0:68] is the sub-list for field type_name + 40, // 46: neo.fs.v2.object.GetResponse.Body.split_info:type_name -> neo.fs.v2.object.SplitInfo + 41, // 47: neo.fs.v2.object.GetResponse.Body.Init.object_id:type_name -> neo.fs.v2.refs.ObjectID + 38, // 48: neo.fs.v2.object.GetResponse.Body.Init.signature:type_name -> neo.fs.v2.refs.Signature + 37, // 49: neo.fs.v2.object.GetResponse.Body.Init.header:type_name -> neo.fs.v2.object.Header + 20, // 50: neo.fs.v2.object.PutRequest.Body.init:type_name -> neo.fs.v2.object.PutRequest.Body.Init + 41, // 51: neo.fs.v2.object.PutRequest.Body.Init.object_id:type_name -> neo.fs.v2.refs.ObjectID + 38, // 52: neo.fs.v2.object.PutRequest.Body.Init.signature:type_name -> neo.fs.v2.refs.Signature + 37, // 53: neo.fs.v2.object.PutRequest.Body.Init.header:type_name -> neo.fs.v2.object.Header + 41, // 54: neo.fs.v2.object.PutResponse.Body.object_id:type_name -> neo.fs.v2.refs.ObjectID + 39, // 55: neo.fs.v2.object.DeleteRequest.Body.address:type_name -> neo.fs.v2.refs.Address + 39, // 56: neo.fs.v2.object.HeadRequest.Body.address:type_name -> neo.fs.v2.refs.Address + 7, // 57: neo.fs.v2.object.HeadResponse.Body.header:type_name -> neo.fs.v2.object.HeaderWithSignature + 42, // 58: neo.fs.v2.object.HeadResponse.Body.short_header:type_name -> neo.fs.v2.object.ShortHeader + 43, // 59: neo.fs.v2.object.SearchRequest.Body.container_id:type_name -> neo.fs.v2.refs.ContainerID + 27, // 60: neo.fs.v2.object.SearchRequest.Body.filters:type_name -> neo.fs.v2.object.SearchRequest.Body.Filter + 44, // 61: neo.fs.v2.object.SearchRequest.Body.Filter.match_type:type_name -> neo.fs.v2.object.MatchType + 41, // 62: neo.fs.v2.object.SearchResponse.Body.id_list:type_name -> neo.fs.v2.refs.ObjectID + 39, // 63: neo.fs.v2.object.GetRangeRequest.Body.address:type_name -> neo.fs.v2.refs.Address + 11, // 64: neo.fs.v2.object.GetRangeRequest.Body.range:type_name -> neo.fs.v2.object.Range + 39, // 65: neo.fs.v2.object.GetRangeHashRequest.Body.address:type_name -> neo.fs.v2.refs.Address + 11, // 66: neo.fs.v2.object.GetRangeHashRequest.Body.ranges:type_name -> neo.fs.v2.object.Range + 45, // 67: neo.fs.v2.object.GetRangeHashRequest.Body.type:type_name -> neo.fs.v2.refs.ChecksumType + 45, // 68: neo.fs.v2.object.GetRangeHashResponse.Body.type:type_name -> neo.fs.v2.refs.ChecksumType + 0, // 69: neo.fs.v2.object.ObjectService.Get:input_type -> neo.fs.v2.object.GetRequest + 2, // 70: neo.fs.v2.object.ObjectService.Put:input_type -> neo.fs.v2.object.PutRequest + 4, // 71: neo.fs.v2.object.ObjectService.Delete:input_type -> neo.fs.v2.object.DeleteRequest + 6, // 72: neo.fs.v2.object.ObjectService.Head:input_type -> neo.fs.v2.object.HeadRequest + 9, // 73: neo.fs.v2.object.ObjectService.Search:input_type -> neo.fs.v2.object.SearchRequest + 12, // 74: neo.fs.v2.object.ObjectService.GetRange:input_type -> neo.fs.v2.object.GetRangeRequest + 14, // 75: neo.fs.v2.object.ObjectService.GetRangeHash:input_type -> neo.fs.v2.object.GetRangeHashRequest + 1, // 76: neo.fs.v2.object.ObjectService.Get:output_type -> neo.fs.v2.object.GetResponse + 3, // 77: neo.fs.v2.object.ObjectService.Put:output_type -> neo.fs.v2.object.PutResponse + 5, // 78: neo.fs.v2.object.ObjectService.Delete:output_type -> neo.fs.v2.object.DeleteResponse + 8, // 79: neo.fs.v2.object.ObjectService.Head:output_type -> neo.fs.v2.object.HeadResponse + 10, // 80: neo.fs.v2.object.ObjectService.Search:output_type -> neo.fs.v2.object.SearchResponse + 13, // 81: neo.fs.v2.object.ObjectService.GetRange:output_type -> neo.fs.v2.object.GetRangeResponse + 15, // 82: neo.fs.v2.object.ObjectService.GetRangeHash:output_type -> neo.fs.v2.object.GetRangeHashResponse + 76, // [76:83] is the sub-list for method output_type + 69, // [69:76] is the sub-list for method input_type + 69, // [69:69] is the sub-list for extension type_name + 69, // [69:69] is the sub-list for extension extendee + 0, // [0:69] is the sub-list for field type_name } func init() { file_v2_object_grpc_service_proto_init() } @@ -3209,6 +3230,7 @@ func file_v2_object_grpc_service_proto_init() { file_v2_object_grpc_service_proto_msgTypes[17].OneofWrappers = []interface{}{ (*GetResponse_Body_Init_)(nil), (*GetResponse_Body_Chunk)(nil), + (*GetResponse_Body_SplitInfo)(nil), } file_v2_object_grpc_service_proto_msgTypes[19].OneofWrappers = []interface{}{ (*PutRequest_Body_Init_)(nil), diff --git a/v2/object/grpc/types.go b/v2/object/grpc/types.go index b1f46c8..df1151a 100644 --- a/v2/object/grpc/types.go +++ b/v2/object/grpc/types.go @@ -200,3 +200,24 @@ func (m *ShortHeader) SetPayloadLength(v uint64) { m.PayloadLength = v } } + +// SetSplitId sets id of split hierarchy. +func (m *SplitInfo) SetSplitId(v []byte) { + if m != nil { + m.SplitId = v + } +} + +// SetLastPart sets id of most right child in split hierarchy. +func (m *SplitInfo) SetLastPart(v *refs.ObjectID) { + if m != nil { + m.LastPart = v + } +} + +// SetLink sets id of linking object in split hierarchy. +func (m *SplitInfo) SetLink(v *refs.ObjectID) { + if m != nil { + m.Link = v + } +} diff --git a/v2/object/grpc/types.pb.go b/v2/object/grpc/types.pb.go index 8d5eede..48b2b73 100644 --- a/v2/object/grpc/types.pb.go +++ b/v2/object/grpc/types.pb.go @@ -438,6 +438,79 @@ func (x *Object) GetPayload() []byte { return nil } +// Meta information of split hierarchy for object assembly. With last part +// one can traverse linked list of split hierarchy back to first part and +// assemble original object. With linking object one can assembly object +// straight away from the object parts. +type SplitInfo struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // 16 byte UUID used to identify the split object hierarchy parts. + SplitId []byte `protobuf:"bytes,1,opt,name=split_id,json=splitId,proto3" json:"split_id,omitempty"` + // Identifier of the last object in split hierarchy parts. It contains + // split header with original object header. + LastPart *grpc.ObjectID `protobuf:"bytes,2,opt,name=last_part,json=lastPart,proto3" json:"last_part,omitempty"` + // Identifier of linking object for split hierarchy parts. It contains + // split header with original object header and sorted list of + // object parts. + Link *grpc.ObjectID `protobuf:"bytes,3,opt,name=link,proto3" json:"link,omitempty"` +} + +func (x *SplitInfo) Reset() { + *x = SplitInfo{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_object_grpc_types_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SplitInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SplitInfo) ProtoMessage() {} + +func (x *SplitInfo) ProtoReflect() protoreflect.Message { + mi := &file_v2_object_grpc_types_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SplitInfo.ProtoReflect.Descriptor instead. +func (*SplitInfo) Descriptor() ([]byte, []int) { + return file_v2_object_grpc_types_proto_rawDescGZIP(), []int{3} +} + +func (x *SplitInfo) GetSplitId() []byte { + if x != nil { + return x.SplitId + } + return nil +} + +func (x *SplitInfo) GetLastPart() *grpc.ObjectID { + if x != nil { + return x.LastPart + } + return nil +} + +func (x *SplitInfo) GetLink() *grpc.ObjectID { + if x != nil { + return x.Link + } + return nil +} + // `Attribute` is a user-defined Key-Value metadata pair attached to the // object. // @@ -474,7 +547,7 @@ type Header_Attribute struct { func (x *Header_Attribute) Reset() { *x = Header_Attribute{} if protoimpl.UnsafeEnabled { - mi := &file_v2_object_grpc_types_proto_msgTypes[3] + mi := &file_v2_object_grpc_types_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -487,7 +560,7 @@ func (x *Header_Attribute) String() string { func (*Header_Attribute) ProtoMessage() {} func (x *Header_Attribute) ProtoReflect() protoreflect.Message { - mi := &file_v2_object_grpc_types_proto_msgTypes[3] + mi := &file_v2_object_grpc_types_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -545,7 +618,7 @@ type Header_Split struct { func (x *Header_Split) Reset() { *x = Header_Split{} if protoimpl.UnsafeEnabled { - mi := &file_v2_object_grpc_types_proto_msgTypes[4] + mi := &file_v2_object_grpc_types_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -558,7 +631,7 @@ func (x *Header_Split) String() string { func (*Header_Split) ProtoMessage() {} func (x *Header_Split) ProtoReflect() protoreflect.Message { - mi := &file_v2_object_grpc_types_proto_msgTypes[4] + mi := &file_v2_object_grpc_types_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -717,20 +790,29 @@ var file_v2_object_grpc_types_proto_rawDesc = []byte{ 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x18, - 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x2a, 0x3b, - 0x0a, 0x0a, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0b, 0x0a, 0x07, - 0x52, 0x45, 0x47, 0x55, 0x4c, 0x41, 0x52, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x54, 0x4f, 0x4d, - 0x42, 0x53, 0x54, 0x4f, 0x4e, 0x45, 0x10, 0x01, 0x12, 0x11, 0x0a, 0x0d, 0x53, 0x54, 0x4f, 0x52, - 0x41, 0x47, 0x45, 0x5f, 0x47, 0x52, 0x4f, 0x55, 0x50, 0x10, 0x02, 0x2a, 0x39, 0x0a, 0x09, 0x4d, - 0x61, 0x74, 0x63, 0x68, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1a, 0x0a, 0x16, 0x4d, 0x41, 0x54, 0x43, - 0x48, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, - 0x45, 0x44, 0x10, 0x00, 0x12, 0x10, 0x0a, 0x0c, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x5f, 0x45, - 0x51, 0x55, 0x41, 0x4c, 0x10, 0x01, 0x42, 0x4f, 0x5a, 0x37, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, - 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, - 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x6f, - 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x6f, 0x62, 0x6a, 0x65, 0x63, - 0x74, 0xaa, 0x02, 0x13, 0x4e, 0x65, 0x6f, 0x46, 0x53, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x76, 0x32, - 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x22, 0x8b, + 0x01, 0x0a, 0x09, 0x53, 0x70, 0x6c, 0x69, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x19, 0x0a, 0x08, + 0x73, 0x70, 0x6c, 0x69, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, + 0x73, 0x70, 0x6c, 0x69, 0x74, 0x49, 0x64, 0x12, 0x35, 0x0a, 0x09, 0x6c, 0x61, 0x73, 0x74, 0x5f, + 0x70, 0x61, 0x72, 0x74, 0x18, 0x02, 0x20, 0x01, 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, 0x08, 0x6c, 0x61, 0x73, 0x74, 0x50, 0x61, 0x72, 0x74, 0x12, 0x2c, + 0x0a, 0x04, 0x6c, 0x69, 0x6e, 0x6b, 0x18, 0x03, 0x20, 0x01, 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, 0x04, 0x6c, 0x69, 0x6e, 0x6b, 0x2a, 0x3b, 0x0a, 0x0a, + 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x52, 0x45, + 0x47, 0x55, 0x4c, 0x41, 0x52, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x54, 0x4f, 0x4d, 0x42, 0x53, + 0x54, 0x4f, 0x4e, 0x45, 0x10, 0x01, 0x12, 0x11, 0x0a, 0x0d, 0x53, 0x54, 0x4f, 0x52, 0x41, 0x47, + 0x45, 0x5f, 0x47, 0x52, 0x4f, 0x55, 0x50, 0x10, 0x02, 0x2a, 0x39, 0x0a, 0x09, 0x4d, 0x61, 0x74, + 0x63, 0x68, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1a, 0x0a, 0x16, 0x4d, 0x41, 0x54, 0x43, 0x48, 0x5f, + 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, + 0x10, 0x00, 0x12, 0x10, 0x0a, 0x0c, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x5f, 0x45, 0x51, 0x55, + 0x41, 0x4c, 0x10, 0x01, 0x42, 0x4f, 0x5a, 0x37, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, + 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, + 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x6f, 0x62, 0x6a, + 0x65, 0x63, 0x74, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0xaa, + 0x02, 0x13, 0x4e, 0x65, 0x6f, 0x46, 0x53, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x76, 0x32, 0x2e, 0x4f, + 0x62, 0x6a, 0x65, 0x63, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -746,49 +828,52 @@ func file_v2_object_grpc_types_proto_rawDescGZIP() []byte { } var file_v2_object_grpc_types_proto_enumTypes = make([]protoimpl.EnumInfo, 2) -var file_v2_object_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 5) +var file_v2_object_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 6) var file_v2_object_grpc_types_proto_goTypes = []interface{}{ (ObjectType)(0), // 0: neo.fs.v2.object.ObjectType (MatchType)(0), // 1: neo.fs.v2.object.MatchType (*ShortHeader)(nil), // 2: neo.fs.v2.object.ShortHeader (*Header)(nil), // 3: neo.fs.v2.object.Header (*Object)(nil), // 4: neo.fs.v2.object.Object - (*Header_Attribute)(nil), // 5: neo.fs.v2.object.Header.Attribute - (*Header_Split)(nil), // 6: neo.fs.v2.object.Header.Split - (*grpc.Version)(nil), // 7: neo.fs.v2.refs.Version - (*grpc.OwnerID)(nil), // 8: neo.fs.v2.refs.OwnerID - (*grpc.ContainerID)(nil), // 9: neo.fs.v2.refs.ContainerID - (*grpc.Checksum)(nil), // 10: neo.fs.v2.refs.Checksum - (*grpc1.SessionToken)(nil), // 11: neo.fs.v2.session.SessionToken - (*grpc.ObjectID)(nil), // 12: neo.fs.v2.refs.ObjectID - (*grpc.Signature)(nil), // 13: neo.fs.v2.refs.Signature + (*SplitInfo)(nil), // 5: neo.fs.v2.object.SplitInfo + (*Header_Attribute)(nil), // 6: neo.fs.v2.object.Header.Attribute + (*Header_Split)(nil), // 7: neo.fs.v2.object.Header.Split + (*grpc.Version)(nil), // 8: neo.fs.v2.refs.Version + (*grpc.OwnerID)(nil), // 9: neo.fs.v2.refs.OwnerID + (*grpc.ContainerID)(nil), // 10: neo.fs.v2.refs.ContainerID + (*grpc.Checksum)(nil), // 11: neo.fs.v2.refs.Checksum + (*grpc1.SessionToken)(nil), // 12: neo.fs.v2.session.SessionToken + (*grpc.ObjectID)(nil), // 13: neo.fs.v2.refs.ObjectID + (*grpc.Signature)(nil), // 14: neo.fs.v2.refs.Signature } var file_v2_object_grpc_types_proto_depIdxs = []int32{ - 7, // 0: neo.fs.v2.object.ShortHeader.version:type_name -> neo.fs.v2.refs.Version - 8, // 1: neo.fs.v2.object.ShortHeader.owner_id:type_name -> neo.fs.v2.refs.OwnerID + 8, // 0: neo.fs.v2.object.ShortHeader.version:type_name -> neo.fs.v2.refs.Version + 9, // 1: neo.fs.v2.object.ShortHeader.owner_id:type_name -> neo.fs.v2.refs.OwnerID 0, // 2: neo.fs.v2.object.ShortHeader.object_type:type_name -> neo.fs.v2.object.ObjectType - 7, // 3: neo.fs.v2.object.Header.version:type_name -> neo.fs.v2.refs.Version - 9, // 4: neo.fs.v2.object.Header.container_id:type_name -> neo.fs.v2.refs.ContainerID - 8, // 5: neo.fs.v2.object.Header.owner_id:type_name -> neo.fs.v2.refs.OwnerID - 10, // 6: neo.fs.v2.object.Header.payload_hash:type_name -> neo.fs.v2.refs.Checksum + 8, // 3: neo.fs.v2.object.Header.version:type_name -> neo.fs.v2.refs.Version + 10, // 4: neo.fs.v2.object.Header.container_id:type_name -> neo.fs.v2.refs.ContainerID + 9, // 5: neo.fs.v2.object.Header.owner_id:type_name -> neo.fs.v2.refs.OwnerID + 11, // 6: neo.fs.v2.object.Header.payload_hash:type_name -> neo.fs.v2.refs.Checksum 0, // 7: neo.fs.v2.object.Header.object_type:type_name -> neo.fs.v2.object.ObjectType - 10, // 8: neo.fs.v2.object.Header.homomorphic_hash:type_name -> neo.fs.v2.refs.Checksum - 11, // 9: neo.fs.v2.object.Header.session_token:type_name -> neo.fs.v2.session.SessionToken - 5, // 10: neo.fs.v2.object.Header.attributes:type_name -> neo.fs.v2.object.Header.Attribute - 6, // 11: neo.fs.v2.object.Header.split:type_name -> neo.fs.v2.object.Header.Split - 12, // 12: neo.fs.v2.object.Object.object_id:type_name -> neo.fs.v2.refs.ObjectID - 13, // 13: neo.fs.v2.object.Object.signature:type_name -> neo.fs.v2.refs.Signature + 11, // 8: neo.fs.v2.object.Header.homomorphic_hash:type_name -> neo.fs.v2.refs.Checksum + 12, // 9: neo.fs.v2.object.Header.session_token:type_name -> neo.fs.v2.session.SessionToken + 6, // 10: neo.fs.v2.object.Header.attributes:type_name -> neo.fs.v2.object.Header.Attribute + 7, // 11: neo.fs.v2.object.Header.split:type_name -> neo.fs.v2.object.Header.Split + 13, // 12: neo.fs.v2.object.Object.object_id:type_name -> neo.fs.v2.refs.ObjectID + 14, // 13: neo.fs.v2.object.Object.signature:type_name -> neo.fs.v2.refs.Signature 3, // 14: neo.fs.v2.object.Object.header:type_name -> neo.fs.v2.object.Header - 12, // 15: neo.fs.v2.object.Header.Split.parent:type_name -> neo.fs.v2.refs.ObjectID - 12, // 16: neo.fs.v2.object.Header.Split.previous:type_name -> neo.fs.v2.refs.ObjectID - 13, // 17: neo.fs.v2.object.Header.Split.parent_signature:type_name -> neo.fs.v2.refs.Signature - 3, // 18: neo.fs.v2.object.Header.Split.parent_header:type_name -> neo.fs.v2.object.Header - 12, // 19: neo.fs.v2.object.Header.Split.children:type_name -> neo.fs.v2.refs.ObjectID - 20, // [20:20] is the sub-list for method output_type - 20, // [20:20] is the sub-list for method input_type - 20, // [20:20] is the sub-list for extension type_name - 20, // [20:20] is the sub-list for extension extendee - 0, // [0:20] is the sub-list for field type_name + 13, // 15: neo.fs.v2.object.SplitInfo.last_part:type_name -> neo.fs.v2.refs.ObjectID + 13, // 16: neo.fs.v2.object.SplitInfo.link:type_name -> neo.fs.v2.refs.ObjectID + 13, // 17: neo.fs.v2.object.Header.Split.parent:type_name -> neo.fs.v2.refs.ObjectID + 13, // 18: neo.fs.v2.object.Header.Split.previous:type_name -> neo.fs.v2.refs.ObjectID + 14, // 19: neo.fs.v2.object.Header.Split.parent_signature:type_name -> neo.fs.v2.refs.Signature + 3, // 20: neo.fs.v2.object.Header.Split.parent_header:type_name -> neo.fs.v2.object.Header + 13, // 21: neo.fs.v2.object.Header.Split.children:type_name -> neo.fs.v2.refs.ObjectID + 22, // [22:22] is the sub-list for method output_type + 22, // [22:22] is the sub-list for method input_type + 22, // [22:22] is the sub-list for extension type_name + 22, // [22:22] is the sub-list for extension extendee + 0, // [0:22] is the sub-list for field type_name } func init() { file_v2_object_grpc_types_proto_init() } @@ -834,7 +919,7 @@ func file_v2_object_grpc_types_proto_init() { } } file_v2_object_grpc_types_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Header_Attribute); i { + switch v := v.(*SplitInfo); i { case 0: return &v.state case 1: @@ -846,6 +931,18 @@ func file_v2_object_grpc_types_proto_init() { } } file_v2_object_grpc_types_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Header_Attribute); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_object_grpc_types_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Header_Split); i { case 0: return &v.state @@ -864,7 +961,7 @@ func file_v2_object_grpc_types_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_v2_object_grpc_types_proto_rawDesc, NumEnums: 2, - NumMessages: 5, + NumMessages: 6, NumExtensions: 0, NumServices: 0, }, diff --git a/v2/object/marshal.go b/v2/object/marshal.go index 4e54b34..9f91b67 100644 --- a/v2/object/marshal.go +++ b/v2/object/marshal.go @@ -43,6 +43,10 @@ const ( objHeaderField = 3 objPayloadField = 4 + splitInfoSplitIDField = 1 + splitInfoLastPartField = 2 + splitInfoLinkField = 3 + getReqBodyAddressField = 1 getReqBodyRawFlagField = 2 @@ -50,8 +54,9 @@ const ( getRespInitSignatureField = 2 getRespInitHeaderField = 3 - getRespBodyInitField = 1 - getRespBodyChunkField = 2 + getRespBodyInitField = 1 + getRespBodyChunkField = 2 + getRespBodySplitInfoField = 3 putReqInitObjectIDField = 1 putReqInitSignatureField = 2 @@ -576,6 +581,54 @@ func (o *Object) Unmarshal(data []byte) error { return nil } +func (s *SplitInfo) StableMarshal(buf []byte) ([]byte, error) { + if s == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, s.StableSize()) + } + + var ( + offset, n int + err error + ) + + n, err = proto.BytesMarshal(splitInfoSplitIDField, buf[offset:], s.splitID) + if err != nil { + return nil, err + } + + offset += n + + n, err = proto.NestedStructureMarshal(splitInfoLastPartField, buf[offset:], s.lastPart) + if err != nil { + return nil, err + } + + offset += n + + _, err = proto.NestedStructureMarshal(splitInfoLinkField, buf[offset:], s.link) + if err != nil { + return nil, err + } + + return buf, nil +} + +func (s *SplitInfo) StableSize() (size int) { + if s == nil { + return 0 + } + + size += proto.BytesSize(splitInfoSplitIDField, s.splitID) + size += proto.NestedStructureSize(splitInfoLastPartField, s.lastPart) + size += proto.NestedStructureSize(splitInfoLinkField, s.link) + + return size +} + func (r *GetRequestBody) StableMarshal(buf []byte) ([]byte, error) { if r == nil { return []byte{}, nil @@ -687,6 +740,11 @@ func (r *GetResponseBody) StableMarshal(buf []byte) ([]byte, error) { return nil, err } } + case *SplitInfo: + _, err := proto.NestedStructureMarshal(getRespBodySplitInfoField, buf, v) + if err != nil { + return nil, err + } default: panic("unknown one of object get response body type") } @@ -708,6 +766,8 @@ func (r *GetResponseBody) StableSize() (size int) { if v != nil { size += proto.BytesSize(getRespBodyChunkField, v.chunk) } + case *SplitInfo: + size += proto.NestedStructureSize(getRespBodySplitInfoField, v) default: panic("unknown one of object get response body type") } diff --git a/v2/object/marshal_test.go b/v2/object/marshal_test.go index 7f811af..142b423 100644 --- a/v2/object/marshal_test.go +++ b/v2/object/marshal_test.go @@ -107,8 +107,9 @@ func TestGetRequestBody_StableMarshal(t *testing.T) { } func TestGetResponseBody_StableMarshal(t *testing.T) { - initFrom := generateGetResponseBody(true) - chunkFrom := generateGetResponseBody(false) + initFrom := generateGetResponseBody(0) + chunkFrom := generateGetResponseBody(1) + splitInfoFrom := generateGetResponseBody(2) transport := new(grpc.GetResponse_Body) t.Run("init non empty", func(t *testing.T) { @@ -132,6 +133,17 @@ func TestGetResponseBody_StableMarshal(t *testing.T) { to := object.GetResponseBodyFromGRPCMessage(transport) require.Equal(t, chunkFrom, to) }) + + t.Run("split info non empty", func(t *testing.T) { + wire, err := splitInfoFrom.StableMarshal(nil) + require.NoError(t, err) + + err = goproto.Unmarshal(wire, transport) + require.NoError(t, err) + + to := object.GetResponseBodyFromGRPCMessage(transport) + require.Equal(t, splitInfoFrom, to) + }) } func TestPutRequestBody_StableMarshal(t *testing.T) { @@ -518,21 +530,29 @@ func generateGetRequestBody(cid, oid string) *object.GetRequestBody { return req } -func generateGetResponseBody(flag bool) *object.GetResponseBody { +func generateGetResponseBody(i int) *object.GetResponseBody { resp := new(object.GetResponseBody) var part object.GetObjectPart - if flag { + switch i { + case 0: init := new(object.GetObjectPartInit) init.SetObjectID(generateObjectID("Object ID")) init.SetSignature(generateSignature("Key", "Signature")) init.SetHeader(generateHeader(10)) part = init - } else { + case 1: chunk := new(object.GetObjectPartChunk) chunk.SetChunk([]byte("Some data chunk")) part = chunk + default: + splitInfo := new(object.SplitInfo) + splitInfo.SetSplitID([]byte("splitID")) + splitInfo.SetLastPart(generateObjectID("Right ID")) + splitInfo.SetLink(generateObjectID("Link ID")) + part = splitInfo } + resp.SetObjectPart(part) return resp diff --git a/v2/object/types.go b/v2/object/types.go index 6898cf6..9d50cbf 100644 --- a/v2/object/types.go +++ b/v2/object/types.go @@ -75,6 +75,14 @@ type Object struct { payload []byte } +type SplitInfo struct { + splitID []byte + + lastPart *refs.ObjectID + + link *refs.ObjectID +} + type GetRequestBody struct { addr *refs.Address @@ -634,6 +642,50 @@ func (o *Object) SetPayload(v []byte) { } } +func (s *SplitInfo) GetSplitID() []byte { + if s.splitID != nil { + return s.splitID + } + + return nil +} + +func (s *SplitInfo) SetSplitID(v []byte) { + if s != nil { + s.splitID = v + } +} + +func (s *SplitInfo) GetLastPart() *refs.ObjectID { + if s != nil { + return s.lastPart + } + + return nil +} + +func (s *SplitInfo) SetLastPart(v *refs.ObjectID) { + if s != nil { + s.lastPart = v + } +} + +func (s *SplitInfo) GetLink() *refs.ObjectID { + if s != nil { + return s.link + } + + return nil +} + +func (s *SplitInfo) SetLink(v *refs.ObjectID) { + if s != nil { + s.link = v + } +} + +func (s *SplitInfo) getObjectPart() {} // implement interface to be one of response body + func (r *GetRequestBody) GetAddress() *refs.Address { if r != nil { return r.addr From e11b1728beb9921050cc6544b0c12f62f7ba058f Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Wed, 2 Dec 2020 14:25:25 +0300 Subject: [PATCH 0606/1196] [#218] pkg/object: Define custom error for SplitInfo Signed-off-by: Alex Vanin --- pkg/client/object.go | 5 +++-- pkg/object/error.go | 19 +++++++++++++++++++ pkg/object/error_test.go | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 54 insertions(+), 2 deletions(-) create mode 100644 pkg/object/error.go create mode 100644 pkg/object/error_test.go diff --git a/pkg/client/object.go b/pkg/client/object.go index df60f6f..21d0d50 100644 --- a/pkg/client/object.go +++ b/pkg/client/object.go @@ -445,8 +445,9 @@ func (c *Client) getObjectV2(ctx context.Context, p *GetObjectParams, opts ...Ca } else { payload = append(payload, v.GetChunk()...) } - case *v2object.SplitInfo: // what else can we do here? - return nil, errors.New("object not found, split info has been provided") + case *v2object.SplitInfo: + si := object.NewSplitInfoFromV2(v) + return nil, object.NewSplitInfoError(si) default: panic(fmt.Sprintf("unexpected Get object part type %T", v)) } diff --git a/pkg/object/error.go b/pkg/object/error.go new file mode 100644 index 0000000..98bd3f2 --- /dev/null +++ b/pkg/object/error.go @@ -0,0 +1,19 @@ +package object + +type SplitInfoError struct { + si *SplitInfo +} + +const splitInfoErrorMsg = "object not found, split info has been provided" + +func (s SplitInfoError) Error() string { + return splitInfoErrorMsg +} + +func (s SplitInfoError) SplitInfo() *SplitInfo { + return s.si +} + +func NewSplitInfoError(v *SplitInfo) SplitInfoError { + return SplitInfoError{si: v} +} diff --git a/pkg/object/error_test.go b/pkg/object/error_test.go new file mode 100644 index 0000000..ce3bcd2 --- /dev/null +++ b/pkg/object/error_test.go @@ -0,0 +1,32 @@ +package object_test + +import ( + "errors" + "testing" + + "github.com/nspcc-dev/neofs-api-go/pkg/object" + "github.com/stretchr/testify/require" +) + +func TestNewSplitInfoError(t *testing.T) { + var ( + si = generateSplitInfo() + + err error = object.NewSplitInfoError(si) + ) + + require.True(t, errors.As(err, new(object.SplitInfoError))) + + siErr, ok := err.(object.SplitInfoError) + require.True(t, ok) + require.Equal(t, si, siErr.SplitInfo()) +} + +func generateSplitInfo() *object.SplitInfo { + si := object.NewSplitInfo() + si.SetSplitID(object.NewSplitID()) + si.SetLastPart(generateID()) + si.SetLink(generateID()) + + return si +} From 582cdd4ba38c8288112be0d030232f406fdee53e Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Wed, 2 Dec 2020 14:30:50 +0300 Subject: [PATCH 0607/1196] [#218] pkg/client: Add raw flag for object.Get Signed-off-by: Alex Vanin --- pkg/client/object.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pkg/client/object.go b/pkg/client/object.go index 21d0d50..ea2609d 100644 --- a/pkg/client/object.go +++ b/pkg/client/object.go @@ -32,6 +32,8 @@ type DeleteObjectParams struct { type GetObjectParams struct { addr *object.Address + raw bool + w io.Writer } @@ -346,6 +348,14 @@ func (p *GetObjectParams) WithPayloadWriter(w io.Writer) *GetObjectParams { return p } +func (p *GetObjectParams) WithRawFlag(v bool) *GetObjectParams { + if p != nil { + p.raw = v + } + + return p +} + func (c *Client) GetObject(ctx context.Context, p *GetObjectParams, opts ...CallOption) (*object.Object, error) { // check remote node version switch c.remoteNode.Version.Major() { @@ -391,6 +401,7 @@ func (c *Client) getObjectV2(ctx context.Context, p *GetObjectParams, opts ...Ca // fill body fields body.SetAddress(p.addr.ToV2()) + body.SetRaw(p.raw) // sign the request if err := signature.SignServiceMessage(c.key, req); err != nil { From 664ebfd8a72da9fca96a7f475f60387dba43d29c Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Wed, 2 Dec 2020 14:32:18 +0300 Subject: [PATCH 0608/1196] [#218] pkg/client: Add raw flag for object.Head Signed-off-by: Alex Vanin --- pkg/client/object.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pkg/client/object.go b/pkg/client/object.go index ea2609d..c9e5d92 100644 --- a/pkg/client/object.go +++ b/pkg/client/object.go @@ -40,6 +40,8 @@ type GetObjectParams struct { type ObjectHeaderParams struct { addr *object.Address + raw bool + short bool } @@ -494,6 +496,14 @@ func (p *ObjectHeaderParams) WithMainFields() *ObjectHeaderParams { return p } +func (p *ObjectHeaderParams) WithRawFlag(v bool) *ObjectHeaderParams { + if p != nil { + p.raw = v + } + + return p +} + func (c *Client) GetObjectHeader(ctx context.Context, p *ObjectHeaderParams, opts ...CallOption) (*object.Object, error) { // check remote node version switch c.remoteNode.Version.Major() { @@ -540,6 +550,7 @@ func (c *Client) getObjectHeaderV2(ctx context.Context, p *ObjectHeaderParams, o // fill body fields body.SetAddress(p.addr.ToV2()) body.SetMainOnly(p.short) + body.SetRaw(p.raw) // sign the request if err := signature.SignServiceMessage(c.key, req); err != nil { From b683dbe7e657687d35a793c000c9792401533369 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Wed, 2 Dec 2020 16:57:06 +0300 Subject: [PATCH 0609/1196] [#218] pkg/object: Add marshal operations for SplitInfo Signed-off-by: Alex Vanin --- pkg/object/splitinfo.go | 13 +++++++++++++ pkg/object/splitinfo_test.go | 11 +++++++++++ v2/object/marshal.go | 11 +++++++++++ 3 files changed, 35 insertions(+) diff --git a/pkg/object/splitinfo.go b/pkg/object/splitinfo.go index 1f7494d..600b87b 100644 --- a/pkg/object/splitinfo.go +++ b/pkg/object/splitinfo.go @@ -47,3 +47,16 @@ func (s *SplitInfo) Link() *ID { func (s *SplitInfo) SetLink(v *ID) { (*object.SplitInfo)(s).SetLink(v.ToV2()) } + +func (s *SplitInfo) Marshal(b ...[]byte) ([]byte, error) { + var buf []byte + if len(b) > 0 { + buf = b[0] + } + + return (*object.SplitInfo)(s).StableMarshal(buf) +} + +func (s *SplitInfo) Unmarshal(data []byte) error { + return (*object.SplitInfo)(s).Unmarshal(data) +} diff --git a/pkg/object/splitinfo_test.go b/pkg/object/splitinfo_test.go index 854defe..8f07313 100644 --- a/pkg/object/splitinfo_test.go +++ b/pkg/object/splitinfo_test.go @@ -29,6 +29,17 @@ func TestSplitInfo(t *testing.T) { require.Equal(t, s, newS) }) + + t.Run("marshal and unmarshal", func(t *testing.T) { + data, err := s.Marshal() + require.NoError(t, err) + + newS := object.NewSplitInfo() + + err = newS.Unmarshal(data) + require.NoError(t, err) + require.Equal(t, s, newS) + }) } func generateID() *object.ID { diff --git a/v2/object/marshal.go b/v2/object/marshal.go index 9f91b67..b814737 100644 --- a/v2/object/marshal.go +++ b/v2/object/marshal.go @@ -629,6 +629,17 @@ func (s *SplitInfo) StableSize() (size int) { return size } +func (s *SplitInfo) Unmarshal(data []byte) error { + m := new(object.SplitInfo) + if err := goproto.Unmarshal(data, m); err != nil { + return err + } + + *s = *SplitInfoFromGRPCMessage(m) + + return nil +} + func (r *GetRequestBody) StableMarshal(buf []byte) ([]byte, error) { if r == nil { return []byte{}, nil From 1fe03077119f3f40d5cb58ccf983d1a5fb37997a Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Thu, 3 Dec 2020 16:23:59 +0300 Subject: [PATCH 0610/1196] [#223] pkg/object: Work with SplitInfoError via pointer Closes #221 Signed-off-by: Alex Vanin --- pkg/object/error.go | 8 ++++---- pkg/object/error_test.go | 7 ++++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/pkg/object/error.go b/pkg/object/error.go index 98bd3f2..96048c2 100644 --- a/pkg/object/error.go +++ b/pkg/object/error.go @@ -6,14 +6,14 @@ type SplitInfoError struct { const splitInfoErrorMsg = "object not found, split info has been provided" -func (s SplitInfoError) Error() string { +func (s *SplitInfoError) Error() string { return splitInfoErrorMsg } -func (s SplitInfoError) SplitInfo() *SplitInfo { +func (s *SplitInfoError) SplitInfo() *SplitInfo { return s.si } -func NewSplitInfoError(v *SplitInfo) SplitInfoError { - return SplitInfoError{si: v} +func NewSplitInfoError(v *SplitInfo) *SplitInfoError { + return &SplitInfoError{si: v} } diff --git a/pkg/object/error_test.go b/pkg/object/error_test.go index ce3bcd2..870c2d6 100644 --- a/pkg/object/error_test.go +++ b/pkg/object/error_test.go @@ -12,12 +12,13 @@ func TestNewSplitInfoError(t *testing.T) { var ( si = generateSplitInfo() - err error = object.NewSplitInfoError(si) + err error = object.NewSplitInfoError(si) + expectedErr *object.SplitInfoError ) - require.True(t, errors.As(err, new(object.SplitInfoError))) + require.True(t, errors.As(err, &expectedErr)) - siErr, ok := err.(object.SplitInfoError) + siErr, ok := err.(*object.SplitInfoError) require.True(t, ok) require.Equal(t, si, siErr.SplitInfo()) } From 6db6b569e098dfa520df9c2ba36a249dd78b60c7 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Thu, 3 Dec 2020 16:36:57 +0300 Subject: [PATCH 0611/1196] [#223] pkg/client: Add getters for object params Signed-off-by: Alex Vanin --- pkg/client/object.go | 138 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 138 insertions(+) diff --git a/pkg/client/object.go b/pkg/client/object.go index c9e5d92..404272f 100644 --- a/pkg/client/object.go +++ b/pkg/client/object.go @@ -140,6 +140,14 @@ func (p *PutObjectParams) WithObject(v *object.Object) *PutObjectParams { return p } +func (p *PutObjectParams) Object() *object.Object { + if p != nil { + return p.obj + } + + return nil +} + func (p *PutObjectParams) WithPayloadReader(v io.Reader) *PutObjectParams { if p != nil { p.r = v @@ -148,6 +156,14 @@ func (p *PutObjectParams) WithPayloadReader(v io.Reader) *PutObjectParams { return p } +func (p *PutObjectParams) PayloadReader() io.Reader { + if p != nil { + return p.r + } + + return nil +} + func (c *Client) PutObject(ctx context.Context, p *PutObjectParams, opts ...CallOption) (*object.ID, error) { // check remote node version switch c.remoteNode.Version.Major() { @@ -269,6 +285,14 @@ func (p *DeleteObjectParams) WithAddress(v *object.Address) *DeleteObjectParams return p } +func (p *DeleteObjectParams) Address() *object.Address { + if p != nil { + return p.addr + } + + return nil +} + func (c *Client) DeleteObject(ctx context.Context, p *DeleteObjectParams, opts ...CallOption) error { // check remote node version switch c.remoteNode.Version.Major() { @@ -342,6 +366,14 @@ func (p *GetObjectParams) WithAddress(v *object.Address) *GetObjectParams { return p } +func (p *GetObjectParams) Address() *object.Address { + if p != nil { + return p.addr + } + + return nil +} + func (p *GetObjectParams) WithPayloadWriter(w io.Writer) *GetObjectParams { if p != nil { p.w = w @@ -350,6 +382,14 @@ func (p *GetObjectParams) WithPayloadWriter(w io.Writer) *GetObjectParams { return p } +func (p *GetObjectParams) PayloadWriter() io.Writer { + if p != nil { + return p.w + } + + return nil +} + func (p *GetObjectParams) WithRawFlag(v bool) *GetObjectParams { if p != nil { p.raw = v @@ -358,6 +398,14 @@ func (p *GetObjectParams) WithRawFlag(v bool) *GetObjectParams { return p } +func (p *GetObjectParams) RawFlag() bool { + if p != nil { + return p.raw + } + + return false +} + func (c *Client) GetObject(ctx context.Context, p *GetObjectParams, opts ...CallOption) (*object.Object, error) { // check remote node version switch c.remoteNode.Version.Major() { @@ -480,6 +528,14 @@ func (p *ObjectHeaderParams) WithAddress(v *object.Address) *ObjectHeaderParams return p } +func (p *ObjectHeaderParams) Address() *object.Address { + if p != nil { + return p.addr + } + + return nil +} + func (p *ObjectHeaderParams) WithAllFields() *ObjectHeaderParams { if p != nil { p.short = false @@ -488,6 +544,16 @@ func (p *ObjectHeaderParams) WithAllFields() *ObjectHeaderParams { return p } +// AllFields return true if parameter set to return all header fields, returns +// false if parameter set to return only main fields of header. +func (p *ObjectHeaderParams) AllFields() bool { + if p != nil { + return !p.short + } + + return false +} + func (p *ObjectHeaderParams) WithMainFields() *ObjectHeaderParams { if p != nil { p.short = true @@ -504,6 +570,14 @@ func (p *ObjectHeaderParams) WithRawFlag(v bool) *ObjectHeaderParams { return p } +func (p *ObjectHeaderParams) RawFlag() bool { + if p != nil { + return p.raw + } + + return false +} + func (c *Client) GetObjectHeader(ctx context.Context, p *ObjectHeaderParams, opts ...CallOption) (*object.Object, error) { // check remote node version switch c.remoteNode.Version.Major() { @@ -639,6 +713,14 @@ func (p *RangeDataParams) WithAddress(v *object.Address) *RangeDataParams { return p } +func (p *RangeDataParams) Address() *object.Address { + if p != nil { + return p.addr + } + + return nil +} + func (p *RangeDataParams) WithRange(v *object.Range) *RangeDataParams { if p != nil { p.r = v @@ -647,6 +729,14 @@ func (p *RangeDataParams) WithRange(v *object.Range) *RangeDataParams { return p } +func (p *RangeDataParams) Range() *object.Range { + if p != nil { + return p.r + } + + return nil +} + func (p *RangeDataParams) WithDataWriter(v io.Writer) *RangeDataParams { if p != nil { p.w = v @@ -655,6 +745,14 @@ func (p *RangeDataParams) WithDataWriter(v io.Writer) *RangeDataParams { return p } +func (p *RangeDataParams) DataWriter() io.Writer { + if p != nil { + return p.w + } + + return nil +} + func (c *Client) ObjectPayloadRangeData(ctx context.Context, p *RangeDataParams, opts ...CallOption) ([]byte, error) { // check remote node version switch c.remoteNode.Version.Major() { @@ -756,6 +854,14 @@ func (p *RangeChecksumParams) WithAddress(v *object.Address) *RangeChecksumParam return p } +func (p *RangeChecksumParams) Address() *object.Address { + if p != nil { + return p.addr + } + + return nil +} + func (p *RangeChecksumParams) WithRangeList(rs ...*object.Range) *RangeChecksumParams { if p != nil { p.rs = rs @@ -764,6 +870,14 @@ func (p *RangeChecksumParams) WithRangeList(rs ...*object.Range) *RangeChecksumP return p } +func (p *RangeChecksumParams) RangeList() []*object.Range { + if p != nil { + return p.rs + } + + return nil +} + func (p *RangeChecksumParams) WithSalt(v []byte) *RangeChecksumParams { if p != nil { p.salt = v @@ -772,6 +886,14 @@ func (p *RangeChecksumParams) WithSalt(v []byte) *RangeChecksumParams { return p } +func (p *RangeChecksumParams) Salt() []byte { + if p != nil { + return p.salt + } + + return nil +} + func (p *RangeChecksumParams) withChecksumType(t checksumType) *RangeChecksumParams { if p != nil { p.typ = t @@ -923,6 +1045,14 @@ func (p *SearchObjectParams) WithContainerID(v *container.ID) *SearchObjectParam return p } +func (p *SearchObjectParams) ContainerID() *container.ID { + if p != nil { + return p.cid + } + + return nil +} + func (p *SearchObjectParams) WithSearchFilters(v object.SearchFilters) *SearchObjectParams { if p != nil { p.filters = v @@ -931,6 +1061,14 @@ func (p *SearchObjectParams) WithSearchFilters(v object.SearchFilters) *SearchOb return p } +func (p *SearchObjectParams) SearchFilters() object.SearchFilters { + if p != nil { + return p.filters + } + + return nil +} + func (c *Client) SearchObject(ctx context.Context, p *SearchObjectParams, opts ...CallOption) ([]*object.ID, error) { // check remote node version switch c.remoteNode.Version.Major() { From 28aad71860812df11bdb8db3aee8f2bcdb06e377 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Mon, 7 Dec 2020 17:41:05 +0300 Subject: [PATCH 0612/1196] [#225] Do not use wrappers on oneof object.HeadResponse types Signed-off-by: Alex Vanin --- pkg/client/object.go | 12 +++---- v2/object/convert.go | 68 ++++------------------------------- v2/object/grpc/service.go | 44 +++++------------------ v2/object/marshal.go | 16 ++++----- v2/object/marshal_test.go | 8 ++--- v2/object/test/client_test.go | 5 +-- v2/object/types.go | 44 +++-------------------- 7 files changed, 35 insertions(+), 162 deletions(-) diff --git a/pkg/client/object.go b/pkg/client/object.go index 404272f..601bbdc 100644 --- a/pkg/client/object.go +++ b/pkg/client/object.go @@ -650,14 +650,14 @@ func (c *Client) getObjectHeaderV2(ctx context.Context, p *ObjectHeaderParams, o switch v := resp.GetBody().GetHeaderPart().(type) { case nil: return nil, errNilObjectPart - case *v2object.GetHeaderPartShort: + case *v2object.ShortHeader: if !p.short { return nil, errors.Errorf("wrong header part type: expected %T, received %T", - (*v2object.GetHeaderPartFull)(nil), (*v2object.GetHeaderPartShort)(nil), + (*v2object.ShortHeader)(nil), (*v2object.HeaderWithSignature)(nil), ) } - h := v.GetShortHeader() + h := v hdr = new(v2object.Header) hdr.SetPayloadLength(h.GetPayloadLength()) @@ -665,14 +665,14 @@ func (c *Client) getObjectHeaderV2(ctx context.Context, p *ObjectHeaderParams, o hdr.SetOwnerID(h.GetOwnerID()) hdr.SetObjectType(h.GetObjectType()) hdr.SetCreationEpoch(h.GetCreationEpoch()) - case *v2object.GetHeaderPartFull: + case *v2object.HeaderWithSignature: if p.short { return nil, errors.Errorf("wrong header part type: expected %T, received %T", - (*v2object.GetHeaderPartShort)(nil), (*v2object.GetHeaderPartFull)(nil), + (*v2object.HeaderWithSignature)(nil), (*v2object.ShortHeader)(nil), ) } - hdrWithSig := v.GetHeaderWithSignature() + hdrWithSig := v if hdrWithSig == nil { return nil, errNilObjectPart } diff --git a/v2/object/convert.go b/v2/object/convert.go index ddeafb1..5407578 100644 --- a/v2/object/convert.go +++ b/v2/object/convert.go @@ -1023,62 +1023,6 @@ func HeadRequestFromGRPCMessage(m *object.HeadRequest) *HeadRequest { return r } -func GetHeaderPartFullToGRPCMessage(r *GetHeaderPartFull) *object.HeadResponse_Body_Header { - if r == nil { - return nil - } - - m := new(object.HeadResponse_Body_Header) - - m.SetHeaderWithSignature( - HeaderWithSignatureToGRPCMessage(r.GetHeaderWithSignature()), - ) - - return m -} - -func GetHeaderPartFullFromGRPCMessage(m *object.HeadResponse_Body_Header) *GetHeaderPartFull { - if m == nil { - return nil - } - - r := new(GetHeaderPartFull) - - r.SetHeaderWithSignature( - HeaderWithSignatureFromGRPCMessage(m.GetHeaderWithSignature()), - ) - - return r -} - -func GetHeaderPartShortToGRPCMessage(r *GetHeaderPartShort) *object.HeadResponse_Body_ShortHeader { - if r == nil { - return nil - } - - m := new(object.HeadResponse_Body_ShortHeader) - - m.SetShortHeader( - ShortHeaderToGRPCMessage(r.GetShortHeader()), - ) - - return m -} - -func GetHeaderPartShortFromGRPCMessage(m *object.HeadResponse_Body_ShortHeader) *GetHeaderPartShort { - if m == nil { - return nil - } - - r := new(GetHeaderPartShort) - - r.SetShortHeader( - ShortHeaderFromGRPCMessage(m.GetShortHeader()), - ) - - return r -} - func HeadResponseBodyToGRPCMessage(r *HeadResponseBody) *object.HeadResponse_Body { if r == nil { return nil @@ -1088,13 +1032,13 @@ func HeadResponseBodyToGRPCMessage(r *HeadResponseBody) *object.HeadResponse_Bod switch v := r.GetHeaderPart(); t := v.(type) { case nil: - case *GetHeaderPartFull: + case *HeaderWithSignature: m.SetHeader( - GetHeaderPartFullToGRPCMessage(t), + HeaderWithSignatureToGRPCMessage(t), ) - case *GetHeaderPartShort: + case *ShortHeader: m.SetShortHeader( - GetHeaderPartShortToGRPCMessage(t), + ShortHeaderToGRPCMessage(t), ) default: panic(fmt.Sprintf("unknown header part %T", t)) @@ -1114,11 +1058,11 @@ func HeadResponseBodyFromGRPCMessage(m *object.HeadResponse_Body) *HeadResponseB case nil: case *object.HeadResponse_Body_Header: r.SetHeaderPart( - GetHeaderPartFullFromGRPCMessage(v), + HeaderWithSignatureFromGRPCMessage(v.Header), ) case *object.HeadResponse_Body_ShortHeader: r.SetHeaderPart( - GetHeaderPartShortFromGRPCMessage(v), + ShortHeaderFromGRPCMessage(v.ShortHeader), ) default: panic(fmt.Sprintf("unknown header part %T", v)) diff --git a/v2/object/grpc/service.go b/v2/object/grpc/service.go index 7acad62..9b53705 100644 --- a/v2/object/grpc/service.go +++ b/v2/object/grpc/service.go @@ -323,38 +323,6 @@ func (m *HeadRequest) SetVerifyHeader(v *session.RequestVerificationHeader) { } } -// GetShortHeader returns short header of the object. -func (m *HeadResponse_Body_ShortHeader) GetShortHeader() *ShortHeader { - if m != nil { - return m.ShortHeader - } - - return nil -} - -// SetShortHeader sets short header of the object. -func (m *HeadResponse_Body_ShortHeader) SetShortHeader(v *ShortHeader) { - if m != nil { - m.ShortHeader = v - } -} - -// GetHeaderWithSignature returns object header. -func (m *HeadResponse_Body_Header) GetHeaderWithSignature() *HeaderWithSignature { - if m != nil { - return m.Header - } - - return nil -} - -// SetHeaderWithSignature sets object header. -func (m *HeadResponse_Body_Header) SetHeaderWithSignature(v *HeaderWithSignature) { - if m != nil { - m.Header = v - } -} - // SetHeader sets object header. func (m *HeaderWithSignature) SetHeader(v *Header) { if m != nil { @@ -370,16 +338,20 @@ func (m *HeaderWithSignature) SetSignature(v *refs.Signature) { } // SetHeader sets full header of the object. -func (m *HeadResponse_Body) SetHeader(v *HeadResponse_Body_Header) { +func (m *HeadResponse_Body) SetHeader(v *HeaderWithSignature) { if m != nil { - m.Head = v + m.Head = &HeadResponse_Body_Header{ + Header: v, + } } } // SetShortHeader sets short header of the object. -func (m *HeadResponse_Body) SetShortHeader(v *HeadResponse_Body_ShortHeader) { +func (m *HeadResponse_Body) SetShortHeader(v *ShortHeader) { if m != nil { - m.Head = v + m.Head = &HeadResponse_Body_ShortHeader{ + ShortHeader: v, + } } } diff --git a/v2/object/marshal.go b/v2/object/marshal.go index b814737..fc71f56 100644 --- a/v2/object/marshal.go +++ b/v2/object/marshal.go @@ -1016,16 +1016,16 @@ func (r *HeadResponseBody) StableMarshal(buf []byte) ([]byte, error) { if r.hdrPart != nil { switch v := r.hdrPart.(type) { - case *GetHeaderPartFull: + case *HeaderWithSignature: if v != nil { - _, err := proto.NestedStructureMarshal(headRespBodyHeaderField, buf, v.hdr) + _, err := proto.NestedStructureMarshal(headRespBodyHeaderField, buf, v) if err != nil { return nil, err } } - case *GetHeaderPartShort: + case *ShortHeader: if v != nil { - _, err := proto.NestedStructureMarshal(headRespBodyShortHeaderField, buf, v.hdr) + _, err := proto.NestedStructureMarshal(headRespBodyShortHeaderField, buf, v) if err != nil { return nil, err } @@ -1045,13 +1045,13 @@ func (r *HeadResponseBody) StableSize() (size int) { if r.hdrPart != nil { switch v := r.hdrPart.(type) { - case *GetHeaderPartFull: + case *HeaderWithSignature: if v != nil { - size += proto.NestedStructureSize(headRespBodyHeaderField, v.hdr) + size += proto.NestedStructureSize(headRespBodyHeaderField, v) } - case *GetHeaderPartShort: + case *ShortHeader: if v != nil { - size += proto.NestedStructureSize(headRespBodyShortHeaderField, v.hdr) + size += proto.NestedStructureSize(headRespBodyShortHeaderField, v) } default: panic("unknown one of object put request body type") diff --git a/v2/object/marshal_test.go b/v2/object/marshal_test.go index 142b423..ee79a3f 100644 --- a/v2/object/marshal_test.go +++ b/v2/object/marshal_test.go @@ -611,13 +611,9 @@ func generateHeadResponseBody(flag bool) *object.HeadResponseBody { var part object.GetHeaderPart if flag { - short := new(object.GetHeaderPartShort) - short.SetShortHeader(generateShortHeader("short id")) - part = short + part = generateShortHeader("short id") } else { - full := new(object.GetHeaderPartFull) - full.SetHeaderWithSignature(generateHeaderWithSignature()) - part = full + part = generateHeaderWithSignature() } req.SetHeaderPart(part) diff --git a/v2/object/test/client_test.go b/v2/object/test/client_test.go index 323320e..43590f0 100644 --- a/v2/object/test/client_test.go +++ b/v2/object/test/client_test.go @@ -161,11 +161,8 @@ func testHeadResponse() *object.HeadResponse { shortHdr := new(object.ShortHeader) shortHdr.SetCreationEpoch(100) - hdrPart := new(object.GetHeaderPartShort) - hdrPart.SetShortHeader(shortHdr) - body := new(object.HeadResponseBody) - body.SetHeaderPart(hdrPart) + body.SetHeaderPart(shortHdr) meta := new(session.ResponseMetaHeader) meta.SetTTL(1) diff --git a/v2/object/types.go b/v2/object/types.go index 9d50cbf..7a94c5d 100644 --- a/v2/object/types.go +++ b/v2/object/types.go @@ -151,14 +151,6 @@ type GetHeaderPart interface { getHeaderPart() } -type GetHeaderPartFull struct { - hdr *HeaderWithSignature -} - -type GetHeaderPartShort struct { - hdr *ShortHeader -} - type HeadResponseBody struct { hdrPart GetHeaderPart } @@ -292,6 +284,8 @@ func (h *ShortHeader) SetPayloadLength(v uint64) { } } +func (h *ShortHeader) getHeaderPart() {} + func (a *Attribute) GetKey() string { if a != nil { return a.key @@ -586,6 +580,8 @@ func (h *HeaderWithSignature) SetSignature(v *refs.Signature) { } } +func (h *HeaderWithSignature) getHeaderPart() {} + func (o *Object) GetObjectID() *refs.ObjectID { if o != nil { return o.objectID @@ -1240,38 +1236,6 @@ func (r *HeadRequest) SetVerificationHeader(v *session.RequestVerificationHeader } } -func (h *GetHeaderPartFull) GetHeaderWithSignature() *HeaderWithSignature { - if h != nil { - return h.hdr - } - - return nil -} - -func (h *GetHeaderPartFull) SetHeaderWithSignature(v *HeaderWithSignature) { - if h != nil { - h.hdr = v - } -} - -func (*GetHeaderPartFull) getHeaderPart() {} - -func (h *GetHeaderPartShort) GetShortHeader() *ShortHeader { - if h != nil { - return h.hdr - } - - return nil -} - -func (h *GetHeaderPartShort) SetShortHeader(v *ShortHeader) { - if h != nil { - h.hdr = v - } -} - -func (*GetHeaderPartShort) getHeaderPart() {} - func (r *HeadResponseBody) GetHeaderPart() GetHeaderPart { if r != nil { return r.hdrPart From 42cd897b257519169f2e3f0d66d7c63c435d9e7a Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Mon, 7 Dec 2020 18:52:46 +0300 Subject: [PATCH 0613/1196] [#225] v2/object: Update GRPC files from neofs-api Signed-off-by: Alex Vanin --- v2/object/grpc/service.go | 47 +++- v2/object/grpc/service.pb.go | 477 ++++++++++++++++++++--------------- 2 files changed, 322 insertions(+), 202 deletions(-) diff --git a/v2/object/grpc/service.go b/v2/object/grpc/service.go index 9b53705..323522b 100644 --- a/v2/object/grpc/service.go +++ b/v2/object/grpc/service.go @@ -355,6 +355,15 @@ func (m *HeadResponse_Body) SetShortHeader(v *ShortHeader) { } } +// SetSplitInfo sets meta info about split hierarchy of the object. +func (m *HeadResponse_Body) SetSplitInfo(v *SplitInfo) { + if m != nil { + m.Head = &HeadResponse_Body_SplitInfo{ + SplitInfo: v, + } + } +} + // SetBody sets body of the response. func (m *HeadResponse) SetBody(v *HeadResponse_Body) { if m != nil { @@ -411,7 +420,7 @@ func (m *SearchRequest_Body) SetFilters(v []*SearchRequest_Body_Filter) { } } -// SetRaw sets raw flag of the request. +// SetContainerId sets container ID of the search requets. func (m *SearchRequest_Body) SetContainerId(v *refs.ContainerID) { if m != nil { m.ContainerId = v @@ -495,6 +504,13 @@ func (m *GetRangeRequest_Body) SetRange(v *Range) { } } +// SetRaw sets raw flag of the request. +func (m *GetRangeRequest_Body) SetRaw(v bool) { + if m != nil { + m.Raw = v + } +} + // SetBody sets body of the request. func (m *GetRangeRequest) SetBody(v *GetRangeRequest_Body) { if m != nil { @@ -516,13 +532,38 @@ func (m *GetRangeRequest) SetVerifyHeader(v *session.RequestVerificationHeader) } } -// SetChunk sets chunk of the object payload. -func (m *GetRangeResponse_Body) SetChunk(v []byte) { +// GetChunk returns chunk of the object payload range bytes. +func (m *GetRangeResponse_Body_Chunk) GetChunk() []byte { + if m != nil { + return m.Chunk + } + + return nil +} + +// SetChunk sets chunk of the object payload range bytes. +func (m *GetRangeResponse_Body_Chunk) SetChunk(v []byte) { if m != nil { m.Chunk = v } } +// SetChunk sets chunk of the object payload. +func (m *GetRangeResponse_Body) SetChunk(v *GetRangeResponse_Body_Chunk) { + if m != nil { + m.RangePart = v + } +} + +// SetSplitInfo sets meta info about split hierarchy of the object. +func (m *GetRangeResponse_Body) SetSplitInfo(v *SplitInfo) { + if m != nil { + m.RangePart = &GetRangeResponse_Body_SplitInfo{ + SplitInfo: v, + } + } +} + // SetBody sets body of the response. func (m *GetRangeResponse) SetBody(v *GetRangeResponse_Body) { if m != nil { diff --git a/v2/object/grpc/service.pb.go b/v2/object/grpc/service.pb.go index 4d6c26a..9b70a42 100644 --- a/v2/object/grpc/service.pb.go +++ b/v2/object/grpc/service.pb.go @@ -1735,11 +1735,13 @@ type HeadResponse_Body struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // Requested object header or it's part. + // Requested object header, it's part or meta information about split + // object. // // Types that are assignable to Head: // *HeadResponse_Body_Header // *HeadResponse_Body_ShortHeader + // *HeadResponse_Body_SplitInfo Head isHeadResponse_Body_Head `protobuf_oneof:"head"` } @@ -1796,6 +1798,13 @@ func (x *HeadResponse_Body) GetShortHeader() *ShortHeader { return nil } +func (x *HeadResponse_Body) GetSplitInfo() *SplitInfo { + if x, ok := x.GetHead().(*HeadResponse_Body_SplitInfo); ok { + return x.SplitInfo + } + return nil +} + type isHeadResponse_Body_Head interface { isHeadResponse_Body_Head() } @@ -1810,10 +1819,17 @@ type HeadResponse_Body_ShortHeader struct { ShortHeader *ShortHeader `protobuf:"bytes,2,opt,name=short_header,json=shortHeader,proto3,oneof"` } +type HeadResponse_Body_SplitInfo struct { + // Meta information of split hierarchy. + SplitInfo *SplitInfo `protobuf:"bytes,3,opt,name=split_info,json=splitInfo,proto3,oneof"` +} + func (*HeadResponse_Body_Header) isHeadResponse_Body_Head() {} func (*HeadResponse_Body_ShortHeader) isHeadResponse_Body_Head() {} +func (*HeadResponse_Body_SplitInfo) isHeadResponse_Body_Head() {} + // Object Search request body type SearchRequest_Body struct { state protoimpl.MessageState @@ -2051,6 +2067,9 @@ type GetRangeRequest_Body struct { Address *grpc1.Address `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` // Requested payload range Range *Range `protobuf:"bytes,2,opt,name=range,proto3" json:"range,omitempty"` + // If `raw` flag is set, request will work only with objects that are + // physically stored on the peer node. + Raw bool `protobuf:"varint,3,opt,name=raw,proto3" json:"raw,omitempty"` } func (x *GetRangeRequest_Body) Reset() { @@ -2099,6 +2118,13 @@ func (x *GetRangeRequest_Body) GetRange() *Range { return nil } +func (x *GetRangeRequest_Body) GetRaw() bool { + if x != nil { + return x.Raw + } + return false +} + // Get Range response body uses streams to transfer the response. Because // object payload considered a byte sequence, there is no need to have some // initial preamble message. The requested byte range is sent as a series @@ -2108,8 +2134,12 @@ type GetRangeResponse_Body struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // Chunked object payload's range - Chunk []byte `protobuf:"bytes,1,opt,name=chunk,proto3" json:"chunk,omitempty"` + // Requested object range or meta information about split object. + // + // Types that are assignable to RangePart: + // *GetRangeResponse_Body_Chunk + // *GetRangeResponse_Body_SplitInfo + RangePart isGetRangeResponse_Body_RangePart `protobuf_oneof:"range_part"` } func (x *GetRangeResponse_Body) Reset() { @@ -2144,13 +2174,45 @@ func (*GetRangeResponse_Body) Descriptor() ([]byte, []int) { return file_v2_object_grpc_service_proto_rawDescGZIP(), []int{13, 0} } +func (m *GetRangeResponse_Body) GetRangePart() isGetRangeResponse_Body_RangePart { + if m != nil { + return m.RangePart + } + return nil +} + func (x *GetRangeResponse_Body) GetChunk() []byte { - if x != nil { + if x, ok := x.GetRangePart().(*GetRangeResponse_Body_Chunk); ok { return x.Chunk } return nil } +func (x *GetRangeResponse_Body) GetSplitInfo() *SplitInfo { + if x, ok := x.GetRangePart().(*GetRangeResponse_Body_SplitInfo); ok { + return x.SplitInfo + } + return nil +} + +type isGetRangeResponse_Body_RangePart interface { + isGetRangeResponse_Body_RangePart() +} + +type GetRangeResponse_Body_Chunk struct { + // Chunked object payload's range. + Chunk []byte `protobuf:"bytes,1,opt,name=chunk,proto3,oneof"` +} + +type GetRangeResponse_Body_SplitInfo struct { + // Meta information of split hierarchy. + SplitInfo *SplitInfo `protobuf:"bytes,2,opt,name=split_info,json=splitInfo,proto3,oneof"` +} + +func (*GetRangeResponse_Body_Chunk) isGetRangeResponse_Body_RangePart() {} + +func (*GetRangeResponse_Body_SplitInfo) isGetRangeResponse_Body_RangePart() {} + // Get hash of object's payload part request body. type GetRangeHashRequest_Body struct { state protoimpl.MessageState @@ -2465,7 +2527,7 @@ var file_v2_object_grpc_service_proto_rawDesc = []byte{ 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x22, - 0xf9, 0x02, 0x0a, 0x0c, 0x48, 0x65, 0x61, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0xb7, 0x03, 0x0a, 0x0c, 0x48, 0x65, 0x61, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x37, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x42, @@ -2479,7 +2541,7 @@ var file_v2_object_grpc_service_proto_rawDesc = []byte{ 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, 0x93, 0x01, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x3f, + 0x65, 0x61, 0x64, 0x65, 0x72, 0x1a, 0xd1, 0x01, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x3f, 0x0a, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x57, 0x69, 0x74, 0x68, 0x53, 0x69, 0x67, 0x6e, @@ -2488,82 +2550,87 @@ var file_v2_object_grpc_service_proto_rawDesc = []byte{ 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x53, 0x68, 0x6f, 0x72, 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x48, 0x00, 0x52, 0x0b, 0x73, 0x68, 0x6f, 0x72, 0x74, 0x48, 0x65, 0x61, - 0x64, 0x65, 0x72, 0x42, 0x06, 0x0a, 0x04, 0x68, 0x65, 0x61, 0x64, 0x22, 0xfb, 0x03, 0x0a, 0x0d, - 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x38, 0x0a, - 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6e, 0x65, - 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x53, - 0x65, 0x61, 0x72, 0x63, 0x68, 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, 0x12, 0x3c, 0x0a, 0x0a, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x5f, 0x69, 0x6e, 0x66, + 0x6f, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, + 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x53, 0x70, 0x6c, 0x69, 0x74, + 0x49, 0x6e, 0x66, 0x6f, 0x48, 0x00, 0x52, 0x09, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x49, 0x6e, 0x66, + 0x6f, 0x42, 0x06, 0x0a, 0x04, 0x68, 0x65, 0x61, 0x64, 0x22, 0xfb, 0x03, 0x0a, 0x0d, 0x53, 0x65, + 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x38, 0x0a, 0x04, 0x62, + 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, + 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x53, 0x65, 0x61, + 0x72, 0x63, 0x68, 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, + 0x95, 0x02, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x3e, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, + 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, + 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x52, 0x0b, 0x63, 0x6f, 0x6e, + 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, + 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, + 0x6f, 0x6e, 0x12, 0x45, 0x0a, 0x07, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x73, 0x18, 0x03, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, + 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x2e, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, + 0x52, 0x07, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x73, 0x1a, 0x6c, 0x0a, 0x06, 0x46, 0x69, 0x6c, + 0x74, 0x65, 0x72, 0x12, 0x3a, 0x0a, 0x0a, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x5f, 0x74, 0x79, 0x70, + 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, + 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, + 0x54, 0x79, 0x70, 0x65, 0x52, 0x09, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x54, 0x79, 0x70, 0x65, 0x12, + 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, + 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xa2, 0x02, 0x0a, 0x0e, 0x53, 0x65, 0x61, 0x72, + 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 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, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x53, 0x65, 0x61, 0x72, + 0x63, 0x68, 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, 0x95, 0x02, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x3e, 0x0a, 0x0c, 0x63, 0x6f, - 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, - 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x52, 0x0b, 0x63, - 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, - 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x76, 0x65, 0x72, - 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x45, 0x0a, 0x07, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x73, 0x18, - 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, - 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x2e, 0x46, 0x69, 0x6c, 0x74, - 0x65, 0x72, 0x52, 0x07, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x73, 0x1a, 0x6c, 0x0a, 0x06, 0x46, - 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x3a, 0x0a, 0x0a, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x5f, 0x74, - 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, - 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x4d, 0x61, 0x74, - 0x63, 0x68, 0x54, 0x79, 0x70, 0x65, 0x52, 0x09, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x54, 0x79, 0x70, - 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, - 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xa2, 0x02, 0x0a, 0x0e, 0x53, 0x65, - 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 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, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x53, 0x65, - 0x61, 0x72, 0x63, 0x68, 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, 0x39, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x31, 0x0a, 0x07, 0x69, - 0x64, 0x5f, 0x6c, 0x69, 0x73, 0x74, 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, 0x06, 0x69, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x22, 0x37, - 0x0a, 0x05, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, - 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x12, - 0x16, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, - 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xd1, 0x02, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x52, - 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 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, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, - 0x52, 0x61, 0x6e, 0x67, 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, 0x68, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x31, 0x0a, 0x07, 0x61, 0x64, 0x64, - 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6e, 0x65, 0x6f, - 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, - 0x65, 0x73, 0x73, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x2d, 0x0a, 0x05, - 0x72, 0x61, 0x6e, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6e, 0x65, - 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x52, - 0x61, 0x6e, 0x67, 0x65, 0x52, 0x05, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x22, 0x89, 0x02, 0x0a, 0x10, + 0x72, 0x1a, 0x39, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x31, 0x0a, 0x07, 0x69, 0x64, 0x5f, + 0x6c, 0x69, 0x73, 0x74, 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, 0x06, 0x69, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x22, 0x37, 0x0a, 0x05, + 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x12, 0x16, 0x0a, + 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x6c, + 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xe3, 0x02, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, + 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 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, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x61, + 0x6e, 0x67, 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, + 0x7a, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x31, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, + 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, + 0x73, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x2d, 0x0a, 0x05, 0x72, 0x61, + 0x6e, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, + 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x52, 0x61, 0x6e, + 0x67, 0x65, 0x52, 0x05, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x72, 0x61, 0x77, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x03, 0x72, 0x61, 0x77, 0x22, 0xd7, 0x02, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3b, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, @@ -2578,97 +2645,102 @@ var file_v2_object_grpc_service_proto_rawDesc = []byte{ 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, 0x1c, 0x0a, 0x04, 0x42, 0x6f, 0x64, - 0x79, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, - 0x52, 0x05, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x22, 0xa2, 0x03, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x52, - 0x61, 0x6e, 0x67, 0x65, 0x48, 0x61, 0x73, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, - 0x3e, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, + 0x69, 0x66, 0x79, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x1a, 0x6a, 0x0a, 0x04, 0x42, 0x6f, 0x64, + 0x79, 0x12, 0x16, 0x0a, 0x05, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, + 0x48, 0x00, 0x52, 0x05, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x12, 0x3c, 0x0a, 0x0a, 0x73, 0x70, 0x6c, + 0x69, 0x74, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, + 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, + 0x2e, 0x53, 0x70, 0x6c, 0x69, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x48, 0x00, 0x52, 0x09, 0x73, 0x70, + 0x6c, 0x69, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x42, 0x0c, 0x0a, 0x0a, 0x72, 0x61, 0x6e, 0x67, 0x65, + 0x5f, 0x70, 0x61, 0x72, 0x74, 0x22, 0xa2, 0x03, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, + 0x67, 0x65, 0x48, 0x61, 0x73, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 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, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, + 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x48, 0x61, 0x73, 0x68, 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, 0xb0, 0x01, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, + 0x12, 0x31, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x17, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, + 0x66, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0x12, 0x2f, 0x0a, 0x06, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x73, 0x18, 0x02, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, + 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x06, 0x72, 0x61, + 0x6e, 0x67, 0x65, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x61, 0x6c, 0x74, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x0c, 0x52, 0x04, 0x73, 0x61, 0x6c, 0x74, 0x12, 0x30, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, + 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, + 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x22, 0xca, 0x02, 0x0a, 0x14, 0x47, + 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x48, 0x61, 0x73, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x3f, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x2b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, + 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x48, 0x61, 0x73, + 0x68, 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, 0x55, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x30, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, + 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, + 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x68, 0x61, + 0x73, 0x68, 0x5f, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x08, 0x68, + 0x61, 0x73, 0x68, 0x4c, 0x69, 0x73, 0x74, 0x32, 0xb2, 0x04, 0x0a, 0x0d, 0x4f, 0x62, 0x6a, 0x65, + 0x63, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x44, 0x0a, 0x03, 0x47, 0x65, 0x74, + 0x12, 0x1c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, + 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, + 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x30, 0x01, 0x12, + 0x44, 0x0a, 0x03, 0x50, 0x75, 0x74, 0x12, 0x1c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, + 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x50, 0x75, 0x74, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x50, 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x28, 0x01, 0x12, 0x4b, 0x0a, 0x06, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x12, + 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, + 0x63, 0x74, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, + 0x65, 0x63, 0x74, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x45, 0x0a, 0x04, 0x48, 0x65, 0x61, 0x64, 0x12, 0x1d, 0x2e, 0x6e, 0x65, 0x6f, + 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x48, 0x65, + 0x61, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, + 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, + 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4d, 0x0a, 0x06, 0x53, 0x65, 0x61, + 0x72, 0x63, 0x68, 0x12, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, + 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x30, 0x01, 0x12, 0x53, 0x0a, 0x08, 0x47, 0x65, 0x74, 0x52, + 0x61, 0x6e, 0x67, 0x65, 0x12, 0x21, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x22, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, + 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x61, + 0x6e, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x30, 0x01, 0x12, 0x5d, 0x0a, + 0x0c, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x48, 0x61, 0x73, 0x68, 0x12, 0x25, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x48, 0x61, 0x73, 0x68, 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, 0xb0, 0x01, 0x0a, 0x04, 0x42, 0x6f, - 0x64, 0x79, 0x12, 0x31, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, - 0x72, 0x65, 0x66, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x07, 0x61, 0x64, - 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x2f, 0x0a, 0x06, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x73, 0x18, - 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, - 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x06, - 0x72, 0x61, 0x6e, 0x67, 0x65, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x61, 0x6c, 0x74, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x73, 0x61, 0x6c, 0x74, 0x12, 0x30, 0x0a, 0x04, 0x74, 0x79, - 0x70, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, - 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, - 0x75, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x22, 0xca, 0x02, 0x0a, - 0x14, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x48, 0x61, 0x73, 0x68, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3f, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, - 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x48, - 0x61, 0x73, 0x68, 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, 0x55, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x30, 0x0a, 0x04, 0x74, 0x79, - 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, - 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, - 0x75, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x1b, 0x0a, 0x09, - 0x68, 0x61, 0x73, 0x68, 0x5f, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0c, 0x52, - 0x08, 0x68, 0x61, 0x73, 0x68, 0x4c, 0x69, 0x73, 0x74, 0x32, 0xb2, 0x04, 0x0a, 0x0d, 0x4f, 0x62, - 0x6a, 0x65, 0x63, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x44, 0x0a, 0x03, 0x47, - 0x65, 0x74, 0x12, 0x1c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, - 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x1d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, - 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x30, - 0x01, 0x12, 0x44, 0x0a, 0x03, 0x50, 0x75, 0x74, 0x12, 0x1c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, - 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x50, 0x75, 0x74, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, - 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x50, 0x75, 0x74, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x28, 0x01, 0x12, 0x4b, 0x0a, 0x06, 0x44, 0x65, 0x6c, 0x65, 0x74, - 0x65, 0x12, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, - 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, - 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x45, 0x0a, 0x04, 0x48, 0x65, 0x61, 0x64, 0x12, 0x1d, 0x2e, 0x6e, - 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, - 0x48, 0x65, 0x61, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x6e, 0x65, - 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x48, - 0x65, 0x61, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4d, 0x0a, 0x06, 0x53, - 0x65, 0x61, 0x72, 0x63, 0x68, 0x12, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, - 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, - 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x30, 0x01, 0x12, 0x53, 0x0a, 0x08, 0x47, 0x65, - 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x21, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, - 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, - 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x22, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, - 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, - 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x30, 0x01, 0x12, - 0x5d, 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x48, 0x61, 0x73, 0x68, 0x12, - 0x25, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, - 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x48, 0x61, 0x73, 0x68, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x26, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, - 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, - 0x67, 0x65, 0x48, 0x61, 0x73, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x4f, - 0x5a, 0x37, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, - 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, - 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2f, 0x67, 0x72, - 0x70, 0x63, 0x3b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0xaa, 0x02, 0x13, 0x4e, 0x65, 0x6f, 0x46, - 0x53, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x76, 0x32, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x26, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, + 0x48, 0x61, 0x73, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x4f, 0x5a, 0x37, + 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, + 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, + 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2f, 0x67, 0x72, 0x70, 0x63, + 0x3b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0xaa, 0x02, 0x13, 0x4e, 0x65, 0x6f, 0x46, 0x53, 0x2e, + 0x41, 0x50, 0x49, 0x2e, 0x76, 0x32, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -2792,35 +2864,37 @@ var file_v2_object_grpc_service_proto_depIdxs = []int32{ 39, // 56: neo.fs.v2.object.HeadRequest.Body.address:type_name -> neo.fs.v2.refs.Address 7, // 57: neo.fs.v2.object.HeadResponse.Body.header:type_name -> neo.fs.v2.object.HeaderWithSignature 42, // 58: neo.fs.v2.object.HeadResponse.Body.short_header:type_name -> neo.fs.v2.object.ShortHeader - 43, // 59: neo.fs.v2.object.SearchRequest.Body.container_id:type_name -> neo.fs.v2.refs.ContainerID - 27, // 60: neo.fs.v2.object.SearchRequest.Body.filters:type_name -> neo.fs.v2.object.SearchRequest.Body.Filter - 44, // 61: neo.fs.v2.object.SearchRequest.Body.Filter.match_type:type_name -> neo.fs.v2.object.MatchType - 41, // 62: neo.fs.v2.object.SearchResponse.Body.id_list:type_name -> neo.fs.v2.refs.ObjectID - 39, // 63: neo.fs.v2.object.GetRangeRequest.Body.address:type_name -> neo.fs.v2.refs.Address - 11, // 64: neo.fs.v2.object.GetRangeRequest.Body.range:type_name -> neo.fs.v2.object.Range - 39, // 65: neo.fs.v2.object.GetRangeHashRequest.Body.address:type_name -> neo.fs.v2.refs.Address - 11, // 66: neo.fs.v2.object.GetRangeHashRequest.Body.ranges:type_name -> neo.fs.v2.object.Range - 45, // 67: neo.fs.v2.object.GetRangeHashRequest.Body.type:type_name -> neo.fs.v2.refs.ChecksumType - 45, // 68: neo.fs.v2.object.GetRangeHashResponse.Body.type:type_name -> neo.fs.v2.refs.ChecksumType - 0, // 69: neo.fs.v2.object.ObjectService.Get:input_type -> neo.fs.v2.object.GetRequest - 2, // 70: neo.fs.v2.object.ObjectService.Put:input_type -> neo.fs.v2.object.PutRequest - 4, // 71: neo.fs.v2.object.ObjectService.Delete:input_type -> neo.fs.v2.object.DeleteRequest - 6, // 72: neo.fs.v2.object.ObjectService.Head:input_type -> neo.fs.v2.object.HeadRequest - 9, // 73: neo.fs.v2.object.ObjectService.Search:input_type -> neo.fs.v2.object.SearchRequest - 12, // 74: neo.fs.v2.object.ObjectService.GetRange:input_type -> neo.fs.v2.object.GetRangeRequest - 14, // 75: neo.fs.v2.object.ObjectService.GetRangeHash:input_type -> neo.fs.v2.object.GetRangeHashRequest - 1, // 76: neo.fs.v2.object.ObjectService.Get:output_type -> neo.fs.v2.object.GetResponse - 3, // 77: neo.fs.v2.object.ObjectService.Put:output_type -> neo.fs.v2.object.PutResponse - 5, // 78: neo.fs.v2.object.ObjectService.Delete:output_type -> neo.fs.v2.object.DeleteResponse - 8, // 79: neo.fs.v2.object.ObjectService.Head:output_type -> neo.fs.v2.object.HeadResponse - 10, // 80: neo.fs.v2.object.ObjectService.Search:output_type -> neo.fs.v2.object.SearchResponse - 13, // 81: neo.fs.v2.object.ObjectService.GetRange:output_type -> neo.fs.v2.object.GetRangeResponse - 15, // 82: neo.fs.v2.object.ObjectService.GetRangeHash:output_type -> neo.fs.v2.object.GetRangeHashResponse - 76, // [76:83] is the sub-list for method output_type - 69, // [69:76] is the sub-list for method input_type - 69, // [69:69] is the sub-list for extension type_name - 69, // [69:69] is the sub-list for extension extendee - 0, // [0:69] is the sub-list for field type_name + 40, // 59: neo.fs.v2.object.HeadResponse.Body.split_info:type_name -> neo.fs.v2.object.SplitInfo + 43, // 60: neo.fs.v2.object.SearchRequest.Body.container_id:type_name -> neo.fs.v2.refs.ContainerID + 27, // 61: neo.fs.v2.object.SearchRequest.Body.filters:type_name -> neo.fs.v2.object.SearchRequest.Body.Filter + 44, // 62: neo.fs.v2.object.SearchRequest.Body.Filter.match_type:type_name -> neo.fs.v2.object.MatchType + 41, // 63: neo.fs.v2.object.SearchResponse.Body.id_list:type_name -> neo.fs.v2.refs.ObjectID + 39, // 64: neo.fs.v2.object.GetRangeRequest.Body.address:type_name -> neo.fs.v2.refs.Address + 11, // 65: neo.fs.v2.object.GetRangeRequest.Body.range:type_name -> neo.fs.v2.object.Range + 40, // 66: neo.fs.v2.object.GetRangeResponse.Body.split_info:type_name -> neo.fs.v2.object.SplitInfo + 39, // 67: neo.fs.v2.object.GetRangeHashRequest.Body.address:type_name -> neo.fs.v2.refs.Address + 11, // 68: neo.fs.v2.object.GetRangeHashRequest.Body.ranges:type_name -> neo.fs.v2.object.Range + 45, // 69: neo.fs.v2.object.GetRangeHashRequest.Body.type:type_name -> neo.fs.v2.refs.ChecksumType + 45, // 70: neo.fs.v2.object.GetRangeHashResponse.Body.type:type_name -> neo.fs.v2.refs.ChecksumType + 0, // 71: neo.fs.v2.object.ObjectService.Get:input_type -> neo.fs.v2.object.GetRequest + 2, // 72: neo.fs.v2.object.ObjectService.Put:input_type -> neo.fs.v2.object.PutRequest + 4, // 73: neo.fs.v2.object.ObjectService.Delete:input_type -> neo.fs.v2.object.DeleteRequest + 6, // 74: neo.fs.v2.object.ObjectService.Head:input_type -> neo.fs.v2.object.HeadRequest + 9, // 75: neo.fs.v2.object.ObjectService.Search:input_type -> neo.fs.v2.object.SearchRequest + 12, // 76: neo.fs.v2.object.ObjectService.GetRange:input_type -> neo.fs.v2.object.GetRangeRequest + 14, // 77: neo.fs.v2.object.ObjectService.GetRangeHash:input_type -> neo.fs.v2.object.GetRangeHashRequest + 1, // 78: neo.fs.v2.object.ObjectService.Get:output_type -> neo.fs.v2.object.GetResponse + 3, // 79: neo.fs.v2.object.ObjectService.Put:output_type -> neo.fs.v2.object.PutResponse + 5, // 80: neo.fs.v2.object.ObjectService.Delete:output_type -> neo.fs.v2.object.DeleteResponse + 8, // 81: neo.fs.v2.object.ObjectService.Head:output_type -> neo.fs.v2.object.HeadResponse + 10, // 82: neo.fs.v2.object.ObjectService.Search:output_type -> neo.fs.v2.object.SearchResponse + 13, // 83: neo.fs.v2.object.ObjectService.GetRange:output_type -> neo.fs.v2.object.GetRangeResponse + 15, // 84: neo.fs.v2.object.ObjectService.GetRangeHash:output_type -> neo.fs.v2.object.GetRangeHashResponse + 78, // [78:85] is the sub-list for method output_type + 71, // [71:78] is the sub-list for method input_type + 71, // [71:71] is the sub-list for extension type_name + 71, // [71:71] is the sub-list for extension extendee + 0, // [0:71] is the sub-list for field type_name } func init() { file_v2_object_grpc_service_proto_init() } @@ -3239,6 +3313,11 @@ func file_v2_object_grpc_service_proto_init() { file_v2_object_grpc_service_proto_msgTypes[25].OneofWrappers = []interface{}{ (*HeadResponse_Body_Header)(nil), (*HeadResponse_Body_ShortHeader)(nil), + (*HeadResponse_Body_SplitInfo)(nil), + } + file_v2_object_grpc_service_proto_msgTypes[30].OneofWrappers = []interface{}{ + (*GetRangeResponse_Body_Chunk)(nil), + (*GetRangeResponse_Body_SplitInfo)(nil), } type x struct{} out := protoimpl.TypeBuilder{ From ded06674ac1b028377d72f74eb61745efdc867cf Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Mon, 7 Dec 2020 18:59:01 +0300 Subject: [PATCH 0614/1196] [#225] v2/object: Support more SplitInfo structures - SplitInfo structure in object.HeadResponse - SplitInfo structure in object.GetRangeResponse - Raw flag in object.GetRangeRequest Signed-off-by: Alex Vanin --- v2/object/convert.go | 64 ++++++++++++++++++++++++++++++++-- v2/object/marshal.go | 63 ++++++++++++++++++++++++++++++---- v2/object/marshal_test.go | 72 ++++++++++++++++++++++++++++++--------- v2/object/types.go | 52 +++++++++++++++++++++++++--- 4 files changed, 223 insertions(+), 28 deletions(-) diff --git a/v2/object/convert.go b/v2/object/convert.go index 5407578..24d4f47 100644 --- a/v2/object/convert.go +++ b/v2/object/convert.go @@ -1040,6 +1040,10 @@ func HeadResponseBodyToGRPCMessage(r *HeadResponseBody) *object.HeadResponse_Bod m.SetShortHeader( ShortHeaderToGRPCMessage(t), ) + case *SplitInfo: + m.SetSplitInfo( + SplitInfoToGRPCMessage(t), + ) default: panic(fmt.Sprintf("unknown header part %T", t)) } @@ -1064,6 +1068,10 @@ func HeadResponseBodyFromGRPCMessage(m *object.HeadResponse_Body) *HeadResponseB r.SetHeaderPart( ShortHeaderFromGRPCMessage(v.ShortHeader), ) + case *object.HeadResponse_Body_SplitInfo: + r.SetHeaderPart( + SplitInfoFromGRPCMessage(v.SplitInfo), + ) default: panic(fmt.Sprintf("unknown header part %T", v)) } @@ -1332,6 +1340,8 @@ func GetRangeRequestBodyToGRPCMessage(r *GetRangeRequestBody) *object.GetRangeRe RangeToGRPCMessage(r.GetRange()), ) + m.SetRaw(r.GetRaw()) + return m } @@ -1350,6 +1360,8 @@ func GetRangeRequestBodyFromGRPCMessage(m *object.GetRangeRequest_Body) *GetRang RangeFromGRPCMessage(m.GetRange()), ) + r.SetRaw(m.GetRaw()) + return r } @@ -1385,6 +1397,30 @@ func GetRangeRequestFromGRPCMessage(m *object.GetRangeRequest) *GetRangeRequest return r } +func GetRangePartChunkToGRPCMessage(r *GetRangePartChunk) *object.GetRangeResponse_Body_Chunk { + if r == nil { + return nil + } + + m := new(object.GetRangeResponse_Body_Chunk) + + m.SetChunk(r.GetChunk()) + + return m +} + +func GetRangePartChunkFromGRPCMessage(m *object.GetRangeResponse_Body_Chunk) *GetRangePartChunk { + if m == nil { + return nil + } + + r := new(GetRangePartChunk) + + r.SetChunk(m.GetChunk()) + + return r +} + func GetRangeResponseBodyToGRPCMessage(r *GetRangeResponseBody) *object.GetRangeResponse_Body { if r == nil { return nil @@ -1392,7 +1428,19 @@ func GetRangeResponseBodyToGRPCMessage(r *GetRangeResponseBody) *object.GetRange m := new(object.GetRangeResponse_Body) - m.SetChunk(r.GetChunk()) + switch v := r.GetRangePart(); t := v.(type) { + case nil: + case *GetRangePartChunk: + m.SetChunk( + GetRangePartChunkToGRPCMessage(t), + ) + case *SplitInfo: + m.SetSplitInfo( + SplitInfoToGRPCMessage(t), + ) + default: + panic(fmt.Sprintf("unknown get range part %T", t)) + } return m } @@ -1404,7 +1452,19 @@ func GetRangeResponseBodyFromGRPCMessage(m *object.GetRangeResponse_Body) *GetRa r := new(GetRangeResponseBody) - r.SetChunk(m.GetChunk()) + switch v := m.GetRangePart().(type) { + case nil: + case *object.GetRangeResponse_Body_Chunk: + r.SetRangePart( + GetRangePartChunkFromGRPCMessage(v), + ) + case *object.GetRangeResponse_Body_SplitInfo: + r.SetRangePart( + SplitInfoFromGRPCMessage(v.SplitInfo), + ) + default: + panic(fmt.Sprintf("unknown get range part %T", v)) + } return r } diff --git a/v2/object/marshal.go b/v2/object/marshal.go index fc71f56..04737b6 100644 --- a/v2/object/marshal.go +++ b/v2/object/marshal.go @@ -76,6 +76,7 @@ const ( headRespBodyHeaderField = 1 headRespBodyShortHeaderField = 2 + headRespBodySplitInfoField = 3 searchFilterMatchField = 1 searchFilterNameField = 2 @@ -92,8 +93,10 @@ const ( getRangeReqBodyAddressField = 1 getRangeReqBodyRangeField = 2 + getRangeReqBodyRawField = 3 - getRangeRespChunkField = 1 + getRangeRespChunkField = 1 + getRangeRespSplitInfoField = 2 getRangeHashReqBodyAddressField = 1 getRangeHashReqBodyRangesField = 2 @@ -1030,6 +1033,13 @@ func (r *HeadResponseBody) StableMarshal(buf []byte) ([]byte, error) { return nil, err } } + case *SplitInfo: + if v != nil { + _, err := proto.NestedStructureMarshal(headRespBodySplitInfoField, buf, v) + if err != nil { + return nil, err + } + } default: panic("unknown one of object put request body type") } @@ -1053,6 +1063,10 @@ func (r *HeadResponseBody) StableSize() (size int) { if v != nil { size += proto.NestedStructureSize(headRespBodyShortHeaderField, v) } + case *SplitInfo: + if v != nil { + size += proto.NestedStructureSize(headRespBodySplitInfoField, v) + } default: panic("unknown one of object put request body type") } @@ -1263,7 +1277,14 @@ func (r *GetRangeRequestBody) StableMarshal(buf []byte) ([]byte, error) { offset += n - _, err = proto.NestedStructureMarshal(getRangeReqBodyRangeField, buf[offset:], r.rng) + n, err = proto.NestedStructureMarshal(getRangeReqBodyRangeField, buf[offset:], r.rng) + if err != nil { + return nil, err + } + + offset += n + + _, err = proto.BoolMarshal(getRangeReqBodyRawField, buf[offset:], r.raw) if err != nil { return nil, err } @@ -1278,6 +1299,7 @@ func (r *GetRangeRequestBody) StableSize() (size int) { size += proto.NestedStructureSize(getRangeReqBodyAddressField, r.addr) size += proto.NestedStructureSize(getRangeReqBodyRangeField, r.rng) + size += proto.BoolSize(getRangeReqBodyRawField, r.raw) return size } @@ -1291,9 +1313,25 @@ func (r *GetRangeResponseBody) StableMarshal(buf []byte) ([]byte, error) { buf = make([]byte, r.StableSize()) } - _, err := proto.BytesMarshal(getRangeRespChunkField, buf, r.chunk) - if err != nil { - return nil, err + if r.rngPart != nil { + switch v := r.rngPart.(type) { + case *GetRangePartChunk: + if v != nil { + _, err := proto.BytesMarshal(getRangeRespChunkField, buf, v.chunk) + if err != nil { + return nil, err + } + } + case *SplitInfo: + if v != nil { + _, err := proto.NestedStructureMarshal(getRangeRespSplitInfoField, buf, v) + if err != nil { + return nil, err + } + } + default: + panic("unknown one of object get range request body type") + } } return buf, nil @@ -1304,7 +1342,20 @@ func (r *GetRangeResponseBody) StableSize() (size int) { return 0 } - size += proto.BytesSize(getRangeRespChunkField, r.chunk) + if r.rngPart != nil { + switch v := r.rngPart.(type) { + case *GetRangePartChunk: + if v != nil { + size += proto.BytesSize(getRangeRespChunkField, v.chunk) + } + case *SplitInfo: + if v != nil { + size = proto.NestedStructureSize(getRangeRespSplitInfoField, v) + } + default: + panic("unknown one of object get range request body type") + } + } return size } diff --git a/v2/object/marshal_test.go b/v2/object/marshal_test.go index ee79a3f..cc702af 100644 --- a/v2/object/marshal_test.go +++ b/v2/object/marshal_test.go @@ -239,8 +239,9 @@ func TestSplitHeaderFromGRPCMessage(t *testing.T) { } func TestHeadResponseBody_StableMarshal(t *testing.T) { - shortFrom := generateHeadResponseBody(true) - fullFrom := generateHeadResponseBody(false) + shortFrom := generateHeadResponseBody(0) + fullFrom := generateHeadResponseBody(1) + splitInfoFrom := generateHeadResponseBody(2) transport := new(grpc.HeadResponse_Body) t.Run("short header non empty", func(t *testing.T) { @@ -264,6 +265,17 @@ func TestHeadResponseBody_StableMarshal(t *testing.T) { to := object.HeadResponseBodyFromGRPCMessage(transport) require.Equal(t, fullFrom, to) }) + + t.Run("split info non empty", func(t *testing.T) { + wire, err := splitInfoFrom.StableMarshal(nil) + require.NoError(t, err) + + err = goproto.Unmarshal(wire, transport) + require.NoError(t, err) + + to := object.HeadResponseBodyFromGRPCMessage(transport) + require.Equal(t, splitInfoFrom, to) + }) } func TestSearchRequestBody_StableMarshal(t *testing.T) { @@ -315,18 +327,30 @@ func TestGetRangeRequestBody_StableMarshal(t *testing.T) { } func TestGetRangeResponseBody_StableMarshal(t *testing.T) { - from := generateRangeResponseBody("some data") + dataFrom := generateRangeResponseBody("some data", true) + splitInfoFrom := generateRangeResponseBody("some data", false) transport := new(grpc.GetRangeResponse_Body) - t.Run("non empty", func(t *testing.T) { - wire, err := from.StableMarshal(nil) + t.Run("data non empty", func(t *testing.T) { + wire, err := dataFrom.StableMarshal(nil) require.NoError(t, err) err = goproto.Unmarshal(wire, transport) require.NoError(t, err) to := object.GetRangeResponseBodyFromGRPCMessage(transport) - require.Equal(t, from, to) + require.Equal(t, dataFrom, to) + }) + + t.Run("split info non empty", func(t *testing.T) { + wire, err := splitInfoFrom.StableMarshal(nil) + require.NoError(t, err) + + err = goproto.Unmarshal(wire, transport) + require.NoError(t, err) + + to := object.GetRangeResponseBodyFromGRPCMessage(transport) + require.Equal(t, splitInfoFrom, to) }) } @@ -546,11 +570,7 @@ func generateGetResponseBody(i int) *object.GetResponseBody { chunk.SetChunk([]byte("Some data chunk")) part = chunk default: - splitInfo := new(object.SplitInfo) - splitInfo.SetSplitID([]byte("splitID")) - splitInfo.SetLastPart(generateObjectID("Right ID")) - splitInfo.SetLink(generateObjectID("Link ID")) - part = splitInfo + part = generateSplitInfo() } resp.SetObjectPart(part) @@ -606,14 +626,17 @@ func generateHeadRequestBody(cid, oid string) *object.HeadRequestBody { return req } -func generateHeadResponseBody(flag bool) *object.HeadResponseBody { +func generateHeadResponseBody(flag int) *object.HeadResponseBody { req := new(object.HeadResponseBody) var part object.GetHeaderPart - if flag { + switch flag { + case 0: part = generateShortHeader("short id") - } else { + case 1: part = generateHeaderWithSignature() + default: + part = generateSplitInfo() } req.SetHeaderPart(part) @@ -677,13 +700,21 @@ func generateRangeRequestBody(cid, oid string) *object.GetRangeRequestBody { req := new(object.GetRangeRequestBody) req.SetAddress(generateAddress(cid, oid)) req.SetRange(generateRange(10, 20)) + req.SetRaw(true) return req } -func generateRangeResponseBody(data string) *object.GetRangeResponseBody { +func generateRangeResponseBody(data string, flag bool) *object.GetRangeResponseBody { resp := new(object.GetRangeResponseBody) - resp.SetChunk([]byte(data)) + + if flag { + p := new(object.GetRangePartChunk) + p.SetChunk([]byte(data)) + resp.SetRangePart(p) + } else { + resp.SetRangePart(generateSplitInfo()) + } return resp } @@ -729,3 +760,12 @@ func TestObject_StableUnmarshal(t *testing.T) { require.Equal(t, obj, obj2) } + +func generateSplitInfo() *object.SplitInfo { + splitInfo := new(object.SplitInfo) + splitInfo.SetSplitID([]byte("splitID")) + splitInfo.SetLastPart(generateObjectID("Right ID")) + splitInfo.SetLink(generateObjectID("Link ID")) + + return splitInfo +} diff --git a/v2/object/types.go b/v2/object/types.go index 7a94c5d..2ab3ff5 100644 --- a/v2/object/types.go +++ b/v2/object/types.go @@ -181,10 +181,20 @@ type GetRangeRequestBody struct { addr *refs.Address rng *Range + + raw bool +} + +type GetRangePart interface { + getRangePart() +} + +type GetRangePartChunk struct { + chunk []byte } type GetRangeResponseBody struct { - chunk []byte + rngPart GetRangePart } type GetRangeHashRequestBody struct { @@ -680,7 +690,11 @@ func (s *SplitInfo) SetLink(v *refs.ObjectID) { } } -func (s *SplitInfo) getObjectPart() {} // implement interface to be one of response body +func (s *SplitInfo) getObjectPart() {} + +func (s *SplitInfo) getHeaderPart() {} + +func (s *SplitInfo) getRangePart() {} func (r *GetRequestBody) GetAddress() *refs.Address { if r != nil { @@ -1530,6 +1544,20 @@ func (r *GetRangeRequestBody) SetRange(v *Range) { } } +func (r *GetRangeRequestBody) GetRaw() bool { + if r != nil { + return r.raw + } + + return false +} + +func (r *GetRangeRequestBody) SetRaw(v bool) { + if r != nil { + r.raw = v + } +} + func (r *GetRangeRequest) GetBody() *GetRangeRequestBody { if r != nil { return r.body @@ -1572,7 +1600,7 @@ func (r *GetRangeRequest) SetVerificationHeader(v *session.RequestVerificationHe } } -func (r *GetRangeResponseBody) GetChunk() []byte { +func (r *GetRangePartChunk) GetChunk() []byte { if r != nil { return r.chunk } @@ -1580,12 +1608,28 @@ func (r *GetRangeResponseBody) GetChunk() []byte { return nil } -func (r *GetRangeResponseBody) SetChunk(v []byte) { +func (r *GetRangePartChunk) SetChunk(v []byte) { if r != nil { r.chunk = v } } +func (r *GetRangePartChunk) getRangePart() {} + +func (r *GetRangeResponseBody) GetRangePart() GetRangePart { + if r != nil { + return r.rngPart + } + + return nil +} + +func (r *GetRangeResponseBody) SetRangePart(v GetRangePart) { + if r != nil { + r.rngPart = v + } +} + func (r *GetRangeResponse) GetBody() *GetRangeResponseBody { if r != nil { return r.body From 139660c6ff5951a247c3a7a15cfa34ce87ab67b2 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Mon, 7 Dec 2020 19:06:11 +0300 Subject: [PATCH 0615/1196] [#225] pkg/client: Update object methods - Support errors with SplitInfo in head and range methods. - Support raw flat in range method. Signed-off-by: Alex Vanin --- pkg/client/object.go | 46 +++++++++++++++++++++++++++++++++++++------- 1 file changed, 39 insertions(+), 7 deletions(-) diff --git a/pkg/client/object.go b/pkg/client/object.go index 601bbdc..fe31788 100644 --- a/pkg/client/object.go +++ b/pkg/client/object.go @@ -48,6 +48,8 @@ type ObjectHeaderParams struct { type RangeDataParams struct { addr *object.Address + raw bool + r *object.Range w io.Writer @@ -690,6 +692,10 @@ func (c *Client) getObjectHeaderV2(ctx context.Context, p *ObjectHeaderParams, o ); err != nil { return nil, errors.Wrap(err, "incorrect object header signature") } + case *v2object.SplitInfo: + si := object.NewSplitInfoFromV2(v) + + return nil, object.NewSplitInfoError(si) default: panic(fmt.Sprintf("unexpected Head object type %T", v)) } @@ -721,6 +727,22 @@ func (p *RangeDataParams) Address() *object.Address { return nil } +func (p *RangeDataParams) WithRaw(v bool) *RangeDataParams { + if p != nil { + p.raw = v + } + + return p +} + +func (p *RangeDataParams) Raw() bool { + if p != nil { + return p.raw + } + + return false +} + func (p *RangeDataParams) WithRange(v *object.Range) *RangeDataParams { if p != nil { p.r = v @@ -799,6 +821,7 @@ func (c *Client) objectPayloadRangeV2(ctx context.Context, p *RangeDataParams, o // fill body fields body.SetAddress(p.addr.ToV2()) body.SetRange(p.r.ToV2()) + body.SetRaw(p.raw) // sign the request if err := signature.SignServiceMessage(c.key, req); err != nil { @@ -832,14 +855,23 @@ func (c *Client) objectPayloadRangeV2(ctx context.Context, p *RangeDataParams, o return nil, errors.Wrapf(err, "could not verify %T", resp) } - chunk := resp.GetBody().GetChunk() - - if p.w != nil { - if _, err := p.w.Write(chunk); err != nil { - return nil, errors.Wrap(err, "could not write payload chunk") + switch v := resp.GetBody().GetRangePart().(type) { + case nil: + return nil, errNilObjectPart + case *v2object.GetRangePartChunk: + if p.w != nil { + if _, err = p.w.Write(v.GetChunk()); err != nil { + return nil, errors.Wrap(err, "could not write payload chunk") + } + } else { + payload = append(payload, v.GetChunk()...) } - } else { - payload = append(payload, chunk...) + case *v2object.SplitInfo: + si := object.NewSplitInfoFromV2(v) + + return nil, object.NewSplitInfoError(si) + default: + panic(fmt.Sprintf("unexpected GetRange object type %T", v)) } } From 2f3e5742d36a0bf42b13e8c92efe1502753715b9 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 10 Dec 2020 10:48:09 +0300 Subject: [PATCH 0616/1196] [#226] v2/grpc: Re-compile protobuf definitions Add compiled tombstone message. Extend Object.DeleteResponse.Body with tombstone address field. Signed-off-by: Leonard Lyubich --- util/proto/test/test.pb.go | 2 +- v2/accounting/grpc/service.pb.go | 2 +- v2/accounting/grpc/types.pb.go | 2 +- v2/acl/grpc/types.pb.go | 2 +- v2/container/grpc/service.pb.go | 2 +- v2/container/grpc/types.pb.go | 10 +- v2/netmap/grpc/service.pb.go | 2 +- v2/netmap/grpc/types.pb.go | 5 +- v2/object/grpc/service.pb.go | 546 ++++++++++++++++--------------- v2/object/grpc/types.pb.go | 24 +- v2/refs/grpc/types.pb.go | 41 ++- v2/session/grpc/service.pb.go | 2 +- v2/session/grpc/types.pb.go | 2 +- v2/storagegroup/grpc/types.pb.go | 2 +- v2/tombstone/grpc/types.pb.go | 188 +++++++++++ 15 files changed, 535 insertions(+), 297 deletions(-) create mode 100644 v2/tombstone/grpc/types.pb.go diff --git a/util/proto/test/test.pb.go b/util/proto/test/test.pb.go index f581442..0254baa 100644 --- a/util/proto/test/test.pb.go +++ b/util/proto/test/test.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.23.0 -// protoc v3.13.0 +// protoc v3.14.0 // source: util/proto/test/test.proto package test diff --git a/v2/accounting/grpc/service.pb.go b/v2/accounting/grpc/service.pb.go index 2f29d12..7e6a461 100644 --- a/v2/accounting/grpc/service.pb.go +++ b/v2/accounting/grpc/service.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.23.0 -// protoc v3.13.0 +// protoc v3.14.0 // source: v2/accounting/grpc/service.proto package accounting diff --git a/v2/accounting/grpc/types.pb.go b/v2/accounting/grpc/types.pb.go index dd62f96..84ecf9f 100644 --- a/v2/accounting/grpc/types.pb.go +++ b/v2/accounting/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.23.0 -// protoc v3.13.0 +// protoc v3.14.0 // source: v2/accounting/grpc/types.proto package accounting diff --git a/v2/acl/grpc/types.pb.go b/v2/acl/grpc/types.pb.go index fe81184..3d0f0e1 100644 --- a/v2/acl/grpc/types.pb.go +++ b/v2/acl/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.23.0 -// protoc v3.13.0 +// protoc v3.14.0 // source: v2/acl/grpc/types.proto package acl diff --git a/v2/container/grpc/service.pb.go b/v2/container/grpc/service.pb.go index 68d8392..809418f 100644 --- a/v2/container/grpc/service.pb.go +++ b/v2/container/grpc/service.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.23.0 -// protoc v3.13.0 +// protoc v3.14.0 // source: v2/container/grpc/service.proto package container diff --git a/v2/container/grpc/types.pb.go b/v2/container/grpc/types.pb.go index f5232e5..f23cad5 100644 --- a/v2/container/grpc/types.pb.go +++ b/v2/container/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.23.0 -// protoc v3.13.0 +// protoc v3.14.0 // source: v2/container/grpc/types.proto package container @@ -41,7 +41,7 @@ type Container struct { Version *grpc.Version `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` // Identifier of the container owner OwnerId *grpc.OwnerID `protobuf:"bytes,2,opt,name=owner_id,json=ownerID,proto3" json:"owner_id,omitempty"` - // Nonce is a 16 byte UUID, used to avoid collisions of container id + // Nonce is a 16 byte UUIDv4, used to avoid collisions of `ContainerID`s Nonce []byte `protobuf:"bytes,3,opt,name=nonce,proto3" json:"nonce,omitempty"` // `BasicACL` contains access control rules for owner, system, others groups // and permission bits for `BearerToken` and `Extended ACL` @@ -127,8 +127,10 @@ func (x *Container) GetPlacementPolicy() *grpc1.PlacementPolicy { } // `Attribute` is a user-defined Key-Value metadata pair attached to the -// container. Container attribute are immutable. They are set at container -// creation and cna never be added or updated. +// container. Container attributes are immutable. They are set at container +// creation and can never be added or updated. +// +// Key name must be a valid UTF-8 string. Value can't be empty. // // There are some "well-known" attributes affecting system behaviour: // diff --git a/v2/netmap/grpc/service.pb.go b/v2/netmap/grpc/service.pb.go index 721f282..70de9ab 100644 --- a/v2/netmap/grpc/service.pb.go +++ b/v2/netmap/grpc/service.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.23.0 -// protoc v3.13.0 +// protoc v3.14.0 // source: v2/netmap/grpc/service.proto package netmap diff --git a/v2/netmap/grpc/types.pb.go b/v2/netmap/grpc/types.pb.go index b7347eb..178d975 100644 --- a/v2/netmap/grpc/types.pb.go +++ b/v2/netmap/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.23.0 -// protoc v3.13.0 +// protoc v3.14.0 // source: v2/netmap/grpc/types.proto package netmap @@ -604,6 +604,9 @@ func (x *NodeInfo) GetState() NodeInfo_State { // Administrator-defined Attributes of the NeoFS Storage Node. // +// `Attribute` is a Key-Value metadata pair. Key name must be a valid UTF-8 +// string. Value can't be empty. +// // Node's attributes are mostly used during Storage Policy evaluation to // calculate object's placement and find a set of nodes satisfying policy // requirements. There are some "well-known" node attributes common to all the diff --git a/v2/object/grpc/service.pb.go b/v2/object/grpc/service.pb.go index 9b70a42..890ac96 100644 --- a/v2/object/grpc/service.pb.go +++ b/v2/object/grpc/service.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.23.0 -// protoc v3.13.0 +// protoc v3.14.0 // source: v2/object/grpc/service.proto package object @@ -1627,6 +1627,9 @@ type DeleteResponse_Body struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields + + // Address of the tombstone created for the deleted object + Tombstone *grpc1.Address `protobuf:"bytes,1,opt,name=tombstone,proto3" json:"tombstone,omitempty"` } func (x *DeleteResponse_Body) Reset() { @@ -1661,6 +1664,13 @@ func (*DeleteResponse_Body) Descriptor() ([]byte, []int) { return file_v2_object_grpc_service_proto_rawDescGZIP(), []int{5, 0} } +func (x *DeleteResponse_Body) GetTombstone() *grpc1.Address { + if x != nil { + return x.Tombstone + } + return nil +} + // Object HEAD request body type HeadRequest_Body struct { state protoimpl.MessageState @@ -1925,7 +1935,7 @@ func (x *SearchRequest_Body) GetFilters() []*SearchRequest_Body_Filter { // * $Object:split.parent \ // object_id of parent // * $Object:split.splitID \ -// 16 byte UUID used to identify the split object hierarchy parts +// 16 byte UUIDv4 used to identify the split object hierarchy parts // // There are some well-known filter aliases to match objects by certain // properties: @@ -2482,8 +2492,8 @@ var file_v2_object_grpc_service_proto_rawDesc = []byte{ 0x64, 0x65, 0x72, 0x1a, 0x39, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x31, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x41, 0x64, - 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0xef, - 0x01, 0x0a, 0x0e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0xa6, + 0x02, 0x0a, 0x0e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 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, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, @@ -2497,193 +2507,148 @@ var file_v2_object_grpc_service_proto_rawDesc = []byte{ 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, 0x06, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, - 0x22, 0xc9, 0x02, 0x0a, 0x0b, 0x48, 0x65, 0x61, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x12, 0x36, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, - 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, - 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 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, + 0x66, 0x79, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x1a, 0x3d, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, + 0x12, 0x35, 0x0a, 0x09, 0x74, 0x6f, 0x6d, 0x62, 0x73, 0x74, 0x6f, 0x6e, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, + 0x72, 0x65, 0x66, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x09, 0x74, 0x6f, + 0x6d, 0x62, 0x73, 0x74, 0x6f, 0x6e, 0x65, 0x22, 0xc9, 0x02, 0x0a, 0x0b, 0x48, 0x65, 0x61, 0x64, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x36, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 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, 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, 0x68, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x31, 0x0a, 0x07, 0x61, 0x64, - 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6e, 0x65, - 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x41, 0x64, 0x64, - 0x72, 0x65, 0x73, 0x73, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x1b, 0x0a, - 0x09, 0x6d, 0x61, 0x69, 0x6e, 0x5f, 0x6f, 0x6e, 0x6c, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, - 0x52, 0x08, 0x6d, 0x61, 0x69, 0x6e, 0x4f, 0x6e, 0x6c, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x72, 0x61, - 0x77, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x03, 0x72, 0x61, 0x77, 0x22, 0x80, 0x01, 0x0a, - 0x13, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x57, 0x69, 0x74, 0x68, 0x53, 0x69, 0x67, 0x6e, 0x61, - 0x74, 0x75, 0x72, 0x65, 0x12, 0x30, 0x0a, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, - 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x06, - 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x37, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, - 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, - 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, - 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x22, - 0xb7, 0x03, 0x0a, 0x0c, 0x48, 0x65, 0x61, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x12, 0x37, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, - 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, - 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 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, 0xd1, 0x01, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x3f, - 0x0a, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, - 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, - 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x57, 0x69, 0x74, 0x68, 0x53, 0x69, 0x67, 0x6e, - 0x61, 0x74, 0x75, 0x72, 0x65, 0x48, 0x00, 0x52, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, - 0x42, 0x0a, 0x0c, 0x73, 0x68, 0x6f, 0x72, 0x74, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, - 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x53, 0x68, 0x6f, 0x72, 0x74, 0x48, 0x65, - 0x61, 0x64, 0x65, 0x72, 0x48, 0x00, 0x52, 0x0b, 0x73, 0x68, 0x6f, 0x72, 0x74, 0x48, 0x65, 0x61, - 0x64, 0x65, 0x72, 0x12, 0x3c, 0x0a, 0x0a, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x5f, 0x69, 0x6e, 0x66, - 0x6f, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, - 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x53, 0x70, 0x6c, 0x69, 0x74, - 0x49, 0x6e, 0x66, 0x6f, 0x48, 0x00, 0x52, 0x09, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x49, 0x6e, 0x66, - 0x6f, 0x42, 0x06, 0x0a, 0x04, 0x68, 0x65, 0x61, 0x64, 0x22, 0xfb, 0x03, 0x0a, 0x0d, 0x53, 0x65, - 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x38, 0x0a, 0x04, 0x62, - 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, - 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x53, 0x65, 0x61, - 0x72, 0x63, 0x68, 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, - 0x95, 0x02, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x3e, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, - 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, - 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, - 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x52, 0x0b, 0x63, 0x6f, 0x6e, - 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, - 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, - 0x6f, 0x6e, 0x12, 0x45, 0x0a, 0x07, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x73, 0x18, 0x03, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, - 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x2e, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, - 0x52, 0x07, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x73, 0x1a, 0x6c, 0x0a, 0x06, 0x46, 0x69, 0x6c, - 0x74, 0x65, 0x72, 0x12, 0x3a, 0x0a, 0x0a, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x5f, 0x74, 0x79, 0x70, - 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, - 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, - 0x54, 0x79, 0x70, 0x65, 0x52, 0x09, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x54, 0x79, 0x70, 0x65, 0x12, - 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, - 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xa2, 0x02, 0x0a, 0x0e, 0x53, 0x65, 0x61, 0x72, - 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 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, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x53, 0x65, 0x61, 0x72, - 0x63, 0x68, 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, 0x39, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x31, 0x0a, 0x07, 0x69, 0x64, 0x5f, - 0x6c, 0x69, 0x73, 0x74, 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, 0x06, 0x69, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x22, 0x37, 0x0a, 0x05, - 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x12, 0x16, 0x0a, - 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x6c, - 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xe3, 0x02, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, - 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 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, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x61, - 0x6e, 0x67, 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, - 0x7a, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x31, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, - 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, - 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, - 0x73, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x2d, 0x0a, 0x05, 0x72, 0x61, - 0x6e, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, - 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x52, 0x61, 0x6e, - 0x67, 0x65, 0x52, 0x05, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x72, 0x61, 0x77, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x03, 0x72, 0x61, 0x77, 0x22, 0xd7, 0x02, 0x0a, 0x10, - 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x12, 0x3b, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, - 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, - 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 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, + 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, 0x6a, 0x0a, 0x04, 0x42, 0x6f, 0x64, - 0x79, 0x12, 0x16, 0x0a, 0x05, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, - 0x48, 0x00, 0x52, 0x05, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x12, 0x3c, 0x0a, 0x0a, 0x73, 0x70, 0x6c, - 0x69, 0x74, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, - 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, - 0x2e, 0x53, 0x70, 0x6c, 0x69, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x48, 0x00, 0x52, 0x09, 0x73, 0x70, - 0x6c, 0x69, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x42, 0x0c, 0x0a, 0x0a, 0x72, 0x61, 0x6e, 0x67, 0x65, - 0x5f, 0x70, 0x61, 0x72, 0x74, 0x22, 0xa2, 0x03, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, - 0x67, 0x65, 0x48, 0x61, 0x73, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 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, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, - 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x48, 0x61, 0x73, 0x68, 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, + 0x69, 0x66, 0x79, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x1a, 0x68, 0x0a, 0x04, 0x42, 0x6f, 0x64, + 0x79, 0x12, 0x31, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, + 0x65, 0x66, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x07, 0x61, 0x64, 0x64, + 0x72, 0x65, 0x73, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x61, 0x69, 0x6e, 0x5f, 0x6f, 0x6e, 0x6c, + 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x6d, 0x61, 0x69, 0x6e, 0x4f, 0x6e, 0x6c, + 0x79, 0x12, 0x10, 0x0a, 0x03, 0x72, 0x61, 0x77, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x03, + 0x72, 0x61, 0x77, 0x22, 0x80, 0x01, 0x0a, 0x13, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x57, 0x69, + 0x74, 0x68, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x30, 0x0a, 0x06, 0x68, + 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, + 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x48, + 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x37, 0x0a, + 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, + 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, + 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x22, 0xb7, 0x03, 0x0a, 0x0c, 0x48, 0x65, 0x61, 0x64, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x37, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 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, 0xd1, 0x01, 0x0a, + 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x3f, 0x0a, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x57, + 0x69, 0x74, 0x68, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x48, 0x00, 0x52, 0x06, + 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x42, 0x0a, 0x0c, 0x73, 0x68, 0x6f, 0x72, 0x74, 0x5f, + 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, + 0x53, 0x68, 0x6f, 0x72, 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x48, 0x00, 0x52, 0x0b, 0x73, + 0x68, 0x6f, 0x72, 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x3c, 0x0a, 0x0a, 0x73, 0x70, + 0x6c, 0x69, 0x74, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, + 0x74, 0x2e, 0x53, 0x70, 0x6c, 0x69, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x48, 0x00, 0x52, 0x09, 0x73, + 0x70, 0x6c, 0x69, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x42, 0x06, 0x0a, 0x04, 0x68, 0x65, 0x61, 0x64, + 0x22, 0xfb, 0x03, 0x0a, 0x0d, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x38, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x24, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, + 0x65, 0x63, 0x74, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 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, 0x95, 0x02, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, + 0x3e, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, + 0x49, 0x44, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x64, 0x12, + 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, + 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x45, 0x0a, 0x07, 0x66, 0x69, 0x6c, + 0x74, 0x65, 0x72, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x6e, 0x65, 0x6f, + 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x53, 0x65, + 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x42, 0x6f, 0x64, 0x79, + 0x2e, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x07, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x73, + 0x1a, 0x6c, 0x0a, 0x06, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x3a, 0x0a, 0x0a, 0x6d, 0x61, + 0x74, 0x63, 0x68, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1b, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, + 0x74, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x54, 0x79, 0x70, 0x65, 0x52, 0x09, 0x6d, 0x61, 0x74, + 0x63, 0x68, 0x54, 0x79, 0x70, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xa2, + 0x02, 0x0a, 0x0e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 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, 0x6f, 0x62, 0x6a, 0x65, + 0x63, 0x74, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 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, 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, + 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, 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, 0xb0, 0x01, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, - 0x12, 0x31, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x17, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, - 0x66, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, - 0x65, 0x73, 0x73, 0x12, 0x2f, 0x0a, 0x06, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x73, 0x18, 0x02, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, - 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x06, 0x72, 0x61, - 0x6e, 0x67, 0x65, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x61, 0x6c, 0x74, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x0c, 0x52, 0x04, 0x73, 0x61, 0x6c, 0x74, 0x12, 0x30, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, - 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, - 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, - 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x22, 0xca, 0x02, 0x0a, 0x14, 0x47, - 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x48, 0x61, 0x73, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x12, 0x3f, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x2b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, - 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x48, 0x61, 0x73, - 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, + 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, 0x39, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, + 0x12, 0x31, 0x0a, 0x07, 0x69, 0x64, 0x5f, 0x6c, 0x69, 0x73, 0x74, 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, 0x06, 0x69, 0x64, 0x4c, + 0x69, 0x73, 0x74, 0x22, 0x37, 0x0a, 0x05, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x16, 0x0a, 0x06, + 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x6f, 0x66, + 0x66, 0x73, 0x65, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xe3, 0x02, 0x0a, + 0x0f, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 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, 0x6f, 0x62, 0x6a, 0x65, 0x63, + 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 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, 0x7a, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x31, + 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x17, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, + 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, + 0x73, 0x12, 0x2d, 0x0a, 0x05, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x17, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, + 0x65, 0x63, 0x74, 0x2e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x05, 0x72, 0x61, 0x6e, 0x67, 0x65, + 0x12, 0x10, 0x0a, 0x03, 0x72, 0x61, 0x77, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x03, 0x72, + 0x61, 0x77, 0x22, 0xd7, 0x02, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3b, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, + 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, @@ -2694,53 +2659,101 @@ var file_v2_object_grpc_service_proto_rawDesc = []byte{ 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, 0x55, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x30, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, - 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, - 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x68, 0x61, - 0x73, 0x68, 0x5f, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x08, 0x68, - 0x61, 0x73, 0x68, 0x4c, 0x69, 0x73, 0x74, 0x32, 0xb2, 0x04, 0x0a, 0x0d, 0x4f, 0x62, 0x6a, 0x65, - 0x63, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x44, 0x0a, 0x03, 0x47, 0x65, 0x74, - 0x12, 0x1c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, - 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, - 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, - 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x30, 0x01, 0x12, - 0x44, 0x0a, 0x03, 0x50, 0x75, 0x74, 0x12, 0x1c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, - 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x50, 0x75, 0x74, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, - 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x50, 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x28, 0x01, 0x12, 0x4b, 0x0a, 0x06, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x12, - 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, - 0x63, 0x74, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, - 0x65, 0x63, 0x74, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x45, 0x0a, 0x04, 0x48, 0x65, 0x61, 0x64, 0x12, 0x1d, 0x2e, 0x6e, 0x65, 0x6f, - 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x48, 0x65, - 0x61, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, - 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, - 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4d, 0x0a, 0x06, 0x53, 0x65, 0x61, - 0x72, 0x63, 0x68, 0x12, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, - 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, - 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x30, 0x01, 0x12, 0x53, 0x0a, 0x08, 0x47, 0x65, 0x74, 0x52, - 0x61, 0x6e, 0x67, 0x65, 0x12, 0x21, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, - 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x22, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, - 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x61, - 0x6e, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x30, 0x01, 0x12, 0x5d, 0x0a, - 0x0c, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x48, 0x61, 0x73, 0x68, 0x12, 0x25, 0x2e, + 0x1a, 0x6a, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x16, 0x0a, 0x05, 0x63, 0x68, 0x75, 0x6e, + 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, 0x05, 0x63, 0x68, 0x75, 0x6e, 0x6b, + 0x12, 0x3c, 0x0a, 0x0a, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x53, 0x70, 0x6c, 0x69, 0x74, 0x49, 0x6e, 0x66, + 0x6f, 0x48, 0x00, 0x52, 0x09, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x42, 0x0c, + 0x0a, 0x0a, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x5f, 0x70, 0x61, 0x72, 0x74, 0x22, 0xa2, 0x03, 0x0a, + 0x13, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x48, 0x61, 0x73, 0x68, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 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, 0x6f, + 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x48, 0x61, + 0x73, 0x68, 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, 0xb0, + 0x01, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x31, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, + 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, + 0x73, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x2f, 0x0a, 0x06, 0x72, 0x61, + 0x6e, 0x67, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6e, 0x65, 0x6f, + 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x52, 0x61, + 0x6e, 0x67, 0x65, 0x52, 0x06, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x73, + 0x61, 0x6c, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x73, 0x61, 0x6c, 0x74, 0x12, + 0x30, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1c, 0x2e, + 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, + 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, + 0x65, 0x22, 0xca, 0x02, 0x0a, 0x14, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x48, 0x61, + 0x73, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3f, 0x0a, 0x04, 0x62, 0x6f, + 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, + 0x61, 0x6e, 0x67, 0x65, 0x48, 0x61, 0x73, 0x68, 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, 0x55, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, + 0x30, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1c, 0x2e, + 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, + 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, + 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x68, 0x61, 0x73, 0x68, 0x5f, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x02, + 0x20, 0x03, 0x28, 0x0c, 0x52, 0x08, 0x68, 0x61, 0x73, 0x68, 0x4c, 0x69, 0x73, 0x74, 0x32, 0xb2, + 0x04, 0x0a, 0x0d, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x12, 0x44, 0x0a, 0x03, 0x47, 0x65, 0x74, 0x12, 0x1c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, + 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x30, 0x01, 0x12, 0x44, 0x0a, 0x03, 0x50, 0x75, 0x74, 0x12, 0x1c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, - 0x2e, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x48, 0x61, 0x73, 0x68, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x26, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x50, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x6e, 0x65, + 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x50, + 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x28, 0x01, 0x12, 0x4b, 0x0a, 0x06, + 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x12, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, + 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, + 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, + 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x45, 0x0a, 0x04, 0x48, 0x65, 0x61, + 0x64, 0x12, 0x1d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, + 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x1e, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, + 0x65, 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x4d, 0x0a, 0x06, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x12, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, + 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x53, 0x65, + 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x6e, 0x65, + 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x53, + 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x30, 0x01, 0x12, + 0x53, 0x0a, 0x08, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x21, 0x2e, 0x6e, 0x65, + 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, + 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x22, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, + 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x30, 0x01, 0x12, 0x5d, 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, + 0x48, 0x61, 0x73, 0x68, 0x12, 0x25, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, - 0x48, 0x61, 0x73, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x4f, 0x5a, 0x37, - 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, - 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, - 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2f, 0x67, 0x72, 0x70, 0x63, - 0x3b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0xaa, 0x02, 0x13, 0x4e, 0x65, 0x6f, 0x46, 0x53, 0x2e, - 0x41, 0x50, 0x49, 0x2e, 0x76, 0x32, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x62, 0x06, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x48, 0x61, 0x73, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x26, 0x2e, 0x6e, 0x65, + 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, + 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x48, 0x61, 0x73, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x42, 0x4f, 0x5a, 0x37, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, + 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, + 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x6f, 0x62, 0x6a, 0x65, + 0x63, 0x74, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0xaa, 0x02, + 0x13, 0x4e, 0x65, 0x6f, 0x46, 0x53, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x76, 0x32, 0x2e, 0x4f, 0x62, + 0x6a, 0x65, 0x63, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -2861,40 +2874,41 @@ var file_v2_object_grpc_service_proto_depIdxs = []int32{ 37, // 53: neo.fs.v2.object.PutRequest.Body.Init.header:type_name -> neo.fs.v2.object.Header 41, // 54: neo.fs.v2.object.PutResponse.Body.object_id:type_name -> neo.fs.v2.refs.ObjectID 39, // 55: neo.fs.v2.object.DeleteRequest.Body.address:type_name -> neo.fs.v2.refs.Address - 39, // 56: neo.fs.v2.object.HeadRequest.Body.address:type_name -> neo.fs.v2.refs.Address - 7, // 57: neo.fs.v2.object.HeadResponse.Body.header:type_name -> neo.fs.v2.object.HeaderWithSignature - 42, // 58: neo.fs.v2.object.HeadResponse.Body.short_header:type_name -> neo.fs.v2.object.ShortHeader - 40, // 59: neo.fs.v2.object.HeadResponse.Body.split_info:type_name -> neo.fs.v2.object.SplitInfo - 43, // 60: neo.fs.v2.object.SearchRequest.Body.container_id:type_name -> neo.fs.v2.refs.ContainerID - 27, // 61: neo.fs.v2.object.SearchRequest.Body.filters:type_name -> neo.fs.v2.object.SearchRequest.Body.Filter - 44, // 62: neo.fs.v2.object.SearchRequest.Body.Filter.match_type:type_name -> neo.fs.v2.object.MatchType - 41, // 63: neo.fs.v2.object.SearchResponse.Body.id_list:type_name -> neo.fs.v2.refs.ObjectID - 39, // 64: neo.fs.v2.object.GetRangeRequest.Body.address:type_name -> neo.fs.v2.refs.Address - 11, // 65: neo.fs.v2.object.GetRangeRequest.Body.range:type_name -> neo.fs.v2.object.Range - 40, // 66: neo.fs.v2.object.GetRangeResponse.Body.split_info:type_name -> neo.fs.v2.object.SplitInfo - 39, // 67: neo.fs.v2.object.GetRangeHashRequest.Body.address:type_name -> neo.fs.v2.refs.Address - 11, // 68: neo.fs.v2.object.GetRangeHashRequest.Body.ranges:type_name -> neo.fs.v2.object.Range - 45, // 69: neo.fs.v2.object.GetRangeHashRequest.Body.type:type_name -> neo.fs.v2.refs.ChecksumType - 45, // 70: neo.fs.v2.object.GetRangeHashResponse.Body.type:type_name -> neo.fs.v2.refs.ChecksumType - 0, // 71: neo.fs.v2.object.ObjectService.Get:input_type -> neo.fs.v2.object.GetRequest - 2, // 72: neo.fs.v2.object.ObjectService.Put:input_type -> neo.fs.v2.object.PutRequest - 4, // 73: neo.fs.v2.object.ObjectService.Delete:input_type -> neo.fs.v2.object.DeleteRequest - 6, // 74: neo.fs.v2.object.ObjectService.Head:input_type -> neo.fs.v2.object.HeadRequest - 9, // 75: neo.fs.v2.object.ObjectService.Search:input_type -> neo.fs.v2.object.SearchRequest - 12, // 76: neo.fs.v2.object.ObjectService.GetRange:input_type -> neo.fs.v2.object.GetRangeRequest - 14, // 77: neo.fs.v2.object.ObjectService.GetRangeHash:input_type -> neo.fs.v2.object.GetRangeHashRequest - 1, // 78: neo.fs.v2.object.ObjectService.Get:output_type -> neo.fs.v2.object.GetResponse - 3, // 79: neo.fs.v2.object.ObjectService.Put:output_type -> neo.fs.v2.object.PutResponse - 5, // 80: neo.fs.v2.object.ObjectService.Delete:output_type -> neo.fs.v2.object.DeleteResponse - 8, // 81: neo.fs.v2.object.ObjectService.Head:output_type -> neo.fs.v2.object.HeadResponse - 10, // 82: neo.fs.v2.object.ObjectService.Search:output_type -> neo.fs.v2.object.SearchResponse - 13, // 83: neo.fs.v2.object.ObjectService.GetRange:output_type -> neo.fs.v2.object.GetRangeResponse - 15, // 84: neo.fs.v2.object.ObjectService.GetRangeHash:output_type -> neo.fs.v2.object.GetRangeHashResponse - 78, // [78:85] is the sub-list for method output_type - 71, // [71:78] is the sub-list for method input_type - 71, // [71:71] is the sub-list for extension type_name - 71, // [71:71] is the sub-list for extension extendee - 0, // [0:71] is the sub-list for field type_name + 39, // 56: neo.fs.v2.object.DeleteResponse.Body.tombstone:type_name -> neo.fs.v2.refs.Address + 39, // 57: neo.fs.v2.object.HeadRequest.Body.address:type_name -> neo.fs.v2.refs.Address + 7, // 58: neo.fs.v2.object.HeadResponse.Body.header:type_name -> neo.fs.v2.object.HeaderWithSignature + 42, // 59: neo.fs.v2.object.HeadResponse.Body.short_header:type_name -> neo.fs.v2.object.ShortHeader + 40, // 60: neo.fs.v2.object.HeadResponse.Body.split_info:type_name -> neo.fs.v2.object.SplitInfo + 43, // 61: neo.fs.v2.object.SearchRequest.Body.container_id:type_name -> neo.fs.v2.refs.ContainerID + 27, // 62: neo.fs.v2.object.SearchRequest.Body.filters:type_name -> neo.fs.v2.object.SearchRequest.Body.Filter + 44, // 63: neo.fs.v2.object.SearchRequest.Body.Filter.match_type:type_name -> neo.fs.v2.object.MatchType + 41, // 64: neo.fs.v2.object.SearchResponse.Body.id_list:type_name -> neo.fs.v2.refs.ObjectID + 39, // 65: neo.fs.v2.object.GetRangeRequest.Body.address:type_name -> neo.fs.v2.refs.Address + 11, // 66: neo.fs.v2.object.GetRangeRequest.Body.range:type_name -> neo.fs.v2.object.Range + 40, // 67: neo.fs.v2.object.GetRangeResponse.Body.split_info:type_name -> neo.fs.v2.object.SplitInfo + 39, // 68: neo.fs.v2.object.GetRangeHashRequest.Body.address:type_name -> neo.fs.v2.refs.Address + 11, // 69: neo.fs.v2.object.GetRangeHashRequest.Body.ranges:type_name -> neo.fs.v2.object.Range + 45, // 70: neo.fs.v2.object.GetRangeHashRequest.Body.type:type_name -> neo.fs.v2.refs.ChecksumType + 45, // 71: neo.fs.v2.object.GetRangeHashResponse.Body.type:type_name -> neo.fs.v2.refs.ChecksumType + 0, // 72: neo.fs.v2.object.ObjectService.Get:input_type -> neo.fs.v2.object.GetRequest + 2, // 73: neo.fs.v2.object.ObjectService.Put:input_type -> neo.fs.v2.object.PutRequest + 4, // 74: neo.fs.v2.object.ObjectService.Delete:input_type -> neo.fs.v2.object.DeleteRequest + 6, // 75: neo.fs.v2.object.ObjectService.Head:input_type -> neo.fs.v2.object.HeadRequest + 9, // 76: neo.fs.v2.object.ObjectService.Search:input_type -> neo.fs.v2.object.SearchRequest + 12, // 77: neo.fs.v2.object.ObjectService.GetRange:input_type -> neo.fs.v2.object.GetRangeRequest + 14, // 78: neo.fs.v2.object.ObjectService.GetRangeHash:input_type -> neo.fs.v2.object.GetRangeHashRequest + 1, // 79: neo.fs.v2.object.ObjectService.Get:output_type -> neo.fs.v2.object.GetResponse + 3, // 80: neo.fs.v2.object.ObjectService.Put:output_type -> neo.fs.v2.object.PutResponse + 5, // 81: neo.fs.v2.object.ObjectService.Delete:output_type -> neo.fs.v2.object.DeleteResponse + 8, // 82: neo.fs.v2.object.ObjectService.Head:output_type -> neo.fs.v2.object.HeadResponse + 10, // 83: neo.fs.v2.object.ObjectService.Search:output_type -> neo.fs.v2.object.SearchResponse + 13, // 84: neo.fs.v2.object.ObjectService.GetRange:output_type -> neo.fs.v2.object.GetRangeResponse + 15, // 85: neo.fs.v2.object.ObjectService.GetRangeHash:output_type -> neo.fs.v2.object.GetRangeHashResponse + 79, // [79:86] is the sub-list for method output_type + 72, // [72:79] is the sub-list for method input_type + 72, // [72:72] is the sub-list for extension type_name + 72, // [72:72] is the sub-list for extension extendee + 0, // [0:72] is the sub-list for field type_name } func init() { file_v2_object_grpc_service_proto_init() } diff --git a/v2/object/grpc/types.pb.go b/v2/object/grpc/types.pb.go index 48b2b73..e2de279 100644 --- a/v2/object/grpc/types.pb.go +++ b/v2/object/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.23.0 -// protoc v3.13.0 +// protoc v3.14.0 // source: v2/object/grpc/types.proto package object @@ -30,6 +30,12 @@ const _ = proto.ProtoPackageIsVersion4 // Type of the object payload content. Only `REGULAR` type objects can be split, // hence `TOMBSTONE` and `STORAGEGROUP` payload is limited by maximal object // size. +// +// String presentation of object type is PascalCased `ObjectType` enumeration +// item name: +// * Regular +// * Tombstone +// * StorageGroup type ObjectType int32 const ( @@ -138,7 +144,7 @@ type ShortHeader struct { unknownFields protoimpl.UnknownFields // Object format version. Effectively the version of API library used to - // create particular object + // create particular object. Version *grpc.Version `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` // Epoch when the object was created CreationEpoch uint64 `protobuf:"varint,2,opt,name=creation_epoch,json=creationEpoch,proto3" json:"creation_epoch,omitempty"` @@ -234,13 +240,13 @@ type Header struct { // Object creation Epoch CreationEpoch uint64 `protobuf:"varint,4,opt,name=creation_epoch,json=creationEpoch,proto3" json:"creation_epoch,omitempty"` // Size of payload in bytes. - // `0xFFFFFFFFFFFFFFFF` means `payload_length` is unknown + // `0xFFFFFFFFFFFFFFFF` means `payload_length` is unknown. PayloadLength uint64 `protobuf:"varint,5,opt,name=payload_length,json=payloadLength,proto3" json:"payload_length,omitempty"` // Hash of payload bytes PayloadHash *grpc.Checksum `protobuf:"bytes,6,opt,name=payload_hash,json=payloadHash,proto3" json:"payload_hash,omitempty"` // Type of the object payload content ObjectType ObjectType `protobuf:"varint,7,opt,name=object_type,json=objectType,proto3,enum=neo.fs.v2.object.ObjectType" json:"object_type,omitempty"` - // Homomorphic hash of the object payload. + // Homomorphic hash of the object payload HomomorphicHash *grpc.Checksum `protobuf:"bytes,8,opt,name=homomorphic_hash,json=homomorphicHash,proto3" json:"homomorphic_hash,omitempty"` // Session token, if it was used during Object creation. Need it to verify // integrity and authenticity out of Request scope. @@ -374,7 +380,7 @@ type Object struct { Signature *grpc.Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` // Object metadata headers Header *Header `protobuf:"bytes,3,opt,name=header,proto3" json:"header,omitempty"` - // Payload bytes. + // Payload bytes Payload []byte `protobuf:"bytes,4,opt,name=payload,proto3" json:"payload,omitempty"` } @@ -514,6 +520,8 @@ func (x *SplitInfo) GetLink() *grpc.ObjectID { // `Attribute` is a user-defined Key-Value metadata pair attached to the // object. // +// Key name must be a valid UTF-8 string. Value can't be empty. +// // There are some "well-known" attributes starting with `__NEOFS__` prefix // that affect system behaviour: // @@ -609,9 +617,9 @@ type Header_Split struct { ParentHeader *Header `protobuf:"bytes,4,opt,name=parent_header,json=parentHeader,proto3" json:"parent_header,omitempty"` // List of identifiers of the objects generated by splitting current one. Children []*grpc.ObjectID `protobuf:"bytes,5,rep,name=children,proto3" json:"children,omitempty"` - // 16 byte UUID used to identify the split object hierarchy parts. Must be - // unique inside container. All objects participating in the split must - // have the same `split_id` value. + // 16 byte UUIDv4 used to identify the split object hierarchy parts. Must be + // unique inside container. All objects participating in the split must have + // the same `split_id` value. SplitId []byte `protobuf:"bytes,6,opt,name=split_id,json=splitID,proto3" json:"split_id,omitempty"` } diff --git a/v2/refs/grpc/types.pb.go b/v2/refs/grpc/types.pb.go index c9994bd..b0e18b5 100644 --- a/v2/refs/grpc/types.pb.go +++ b/v2/refs/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.23.0 -// protoc v3.13.0 +// protoc v3.14.0 // source: v2/refs/grpc/types.proto package refs @@ -78,8 +78,10 @@ func (ChecksumType) EnumDescriptor() ([]byte, []int) { return file_v2_refs_grpc_types_proto_rawDescGZIP(), []int{0} } -// Object in NeoFS can be addressed by it's ContainerID and ObjectID. In string -// format there MUST be a '/' delimeter between them. +// Objects in NeoFS are addressed by their ContainerID and ObjectID. +// +// String presentation of `Address` is the concatenation of string encoded +// `ContainerID` and `ObjectID` delimited by '/' character. type Address struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -138,9 +140,12 @@ func (x *Address) GetObjectId() *ObjectID { } // NeoFS Object unique identifier. Objects are immutable and content-addressed. -// It means `ObjectID` will change if `header` or `payload` changes. `ObjectID` -// is calculated as a hash of `header` field, which contains hash of object's -// payload. +// It means `ObjectID` will change if `header` or `payload` changes. +// +// `ObjectID` is a 32 byte long SHA256 hash of object's `header` field, which, +// in it's turn, contains hash of object's payload. +// +// String presentation is base58 encoded string. type ObjectID struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -190,8 +195,12 @@ func (x *ObjectID) GetValue() []byte { } // NeoFS container identifier. Container structures are immutable and -// content-addressed. `ContainerID` is a 32 byte long SHA256 hash of -// stable-marshalled container message. +// content-addressed. +// +// `ContainerID` is a 32 byte long SHA256 hash of stable-marshalled container +// message. +// +// String presentation is base58 encoded string. type ContainerID struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -240,9 +249,14 @@ func (x *ContainerID) GetValue() []byte { return nil } -// OwnerID is a derivative of a user's main public key. The transformation +// `OwnerID` is a derivative of a user's main public key. The transformation // algorithm is the same as for Neo3 wallet addresses. Neo3 wallet address can // be directly used as `OwnerID`. +// +// `OwnerID` is a 25 bytes sequence starting with Neo version prefix byte +// followed by 20 bytes of ScrptHash and 4 bytes of checksum. +// +// String presentation is Base58 Check Encoded string. type OwnerID struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -292,6 +306,9 @@ func (x *OwnerID) GetValue() []byte { } // API version used by a node. +// +// String presentation is a Semantic Versioning 2.0.0 compatible version string +// with 'v' prefix. I.e. `vX.Y`, where `X` - major number, `Y` - minor number. type Version struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -408,6 +425,12 @@ func (x *Signature) GetSign() []byte { } // Checksum message. +// Depending on checksum algorithm type the string presentation may vary: +// +// * TZ \ +// Hex encoded string without `0x` prefix +// * SHA256 \ +// Hex encoded string without `0x` prefix type Checksum struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache diff --git a/v2/session/grpc/service.pb.go b/v2/session/grpc/service.pb.go index 712500e..e18b8f3 100644 --- a/v2/session/grpc/service.pb.go +++ b/v2/session/grpc/service.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.23.0 -// protoc v3.13.0 +// protoc v3.14.0 // source: v2/session/grpc/service.proto package session diff --git a/v2/session/grpc/types.pb.go b/v2/session/grpc/types.pb.go index 76331a0..fe557fd 100644 --- a/v2/session/grpc/types.pb.go +++ b/v2/session/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.23.0 -// protoc v3.13.0 +// protoc v3.14.0 // source: v2/session/grpc/types.proto package session diff --git a/v2/storagegroup/grpc/types.pb.go b/v2/storagegroup/grpc/types.pb.go index 96e9d87..ece2c37 100644 --- a/v2/storagegroup/grpc/types.pb.go +++ b/v2/storagegroup/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.23.0 -// protoc v3.13.0 +// protoc v3.14.0 // source: v2/storagegroup/grpc/types.proto package storagegroup diff --git a/v2/tombstone/grpc/types.pb.go b/v2/tombstone/grpc/types.pb.go new file mode 100644 index 0000000..d14e2b9 --- /dev/null +++ b/v2/tombstone/grpc/types.pb.go @@ -0,0 +1,188 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.23.0 +// protoc v3.14.0 +// source: v2/tombstone/grpc/types.proto + +package tombstone + +import ( + proto "github.com/golang/protobuf/proto" + grpc "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// This is a compile-time assertion that a sufficiently up-to-date version +// of the legacy proto package is being used. +const _ = proto.ProtoPackageIsVersion4 + +// Tombstone keeps record of deleted objects for few epochs until they are +// purged from the NeoFS network. +type Tombstone struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Last NeoFS epoch number of the tombstone lifetime. It's set by tombstone + // creator depending on current NeoFS network settings. + ExpirationEpoch uint64 `protobuf:"varint,1,opt,name=expiration_epoch,json=expirationEpoch,proto3" json:"expiration_epoch,omitempty"` + // 16 byte UUID used to identify the split object hierarchy parts. Must be + // unique inside container. All objects participating in the split must + // have the same `split_id` value. + SplitId []byte `protobuf:"bytes,2,opt,name=split_id,json=splitID,proto3" json:"split_id,omitempty"` + // List of objects to be deleted. + Members []*grpc.ObjectID `protobuf:"bytes,3,rep,name=members,proto3" json:"members,omitempty"` +} + +func (x *Tombstone) Reset() { + *x = Tombstone{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_tombstone_grpc_types_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Tombstone) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Tombstone) ProtoMessage() {} + +func (x *Tombstone) ProtoReflect() protoreflect.Message { + mi := &file_v2_tombstone_grpc_types_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Tombstone.ProtoReflect.Descriptor instead. +func (*Tombstone) Descriptor() ([]byte, []int) { + return file_v2_tombstone_grpc_types_proto_rawDescGZIP(), []int{0} +} + +func (x *Tombstone) GetExpirationEpoch() uint64 { + if x != nil { + return x.ExpirationEpoch + } + return 0 +} + +func (x *Tombstone) GetSplitId() []byte { + if x != nil { + return x.SplitId + } + return nil +} + +func (x *Tombstone) GetMembers() []*grpc.ObjectID { + if x != nil { + return x.Members + } + return nil +} + +var File_v2_tombstone_grpc_types_proto protoreflect.FileDescriptor + +var file_v2_tombstone_grpc_types_proto_rawDesc = []byte{ + 0x0a, 0x1d, 0x76, 0x32, 0x2f, 0x74, 0x6f, 0x6d, 0x62, 0x73, 0x74, 0x6f, 0x6e, 0x65, 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, 0x74, 0x6f, 0x6d, 0x62, 0x73, + 0x74, 0x6f, 0x6e, 0x65, 0x1a, 0x18, 0x76, 0x32, 0x2f, 0x72, 0x65, 0x66, 0x73, 0x2f, 0x67, 0x72, + 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x85, + 0x01, 0x0a, 0x09, 0x54, 0x6f, 0x6d, 0x62, 0x73, 0x74, 0x6f, 0x6e, 0x65, 0x12, 0x29, 0x0a, 0x10, + 0x65, 0x78, 0x70, 0x69, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x70, 0x6f, 0x63, 0x68, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0f, 0x65, 0x78, 0x70, 0x69, 0x72, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x45, 0x70, 0x6f, 0x63, 0x68, 0x12, 0x19, 0x0a, 0x08, 0x73, 0x70, 0x6c, 0x69, 0x74, + 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x73, 0x70, 0x6c, 0x69, 0x74, + 0x49, 0x44, 0x12, 0x32, 0x0a, 0x07, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x18, 0x03, 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, 0x58, 0x5a, 0x3d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, + 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, + 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x74, + 0x6f, 0x6d, 0x62, 0x73, 0x74, 0x6f, 0x6e, 0x65, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x74, 0x6f, + 0x6d, 0x62, 0x73, 0x74, 0x6f, 0x6e, 0x65, 0xaa, 0x02, 0x16, 0x4e, 0x65, 0x6f, 0x46, 0x53, 0x2e, + 0x41, 0x50, 0x49, 0x2e, 0x76, 0x32, 0x2e, 0x54, 0x6f, 0x6d, 0x62, 0x73, 0x74, 0x6f, 0x6e, 0x65, + 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_v2_tombstone_grpc_types_proto_rawDescOnce sync.Once + file_v2_tombstone_grpc_types_proto_rawDescData = file_v2_tombstone_grpc_types_proto_rawDesc +) + +func file_v2_tombstone_grpc_types_proto_rawDescGZIP() []byte { + file_v2_tombstone_grpc_types_proto_rawDescOnce.Do(func() { + file_v2_tombstone_grpc_types_proto_rawDescData = protoimpl.X.CompressGZIP(file_v2_tombstone_grpc_types_proto_rawDescData) + }) + return file_v2_tombstone_grpc_types_proto_rawDescData +} + +var file_v2_tombstone_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_v2_tombstone_grpc_types_proto_goTypes = []interface{}{ + (*Tombstone)(nil), // 0: neo.fs.v2.tombstone.Tombstone + (*grpc.ObjectID)(nil), // 1: neo.fs.v2.refs.ObjectID +} +var file_v2_tombstone_grpc_types_proto_depIdxs = []int32{ + 1, // 0: neo.fs.v2.tombstone.Tombstone.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_v2_tombstone_grpc_types_proto_init() } +func file_v2_tombstone_grpc_types_proto_init() { + if File_v2_tombstone_grpc_types_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_v2_tombstone_grpc_types_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Tombstone); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_v2_tombstone_grpc_types_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_v2_tombstone_grpc_types_proto_goTypes, + DependencyIndexes: file_v2_tombstone_grpc_types_proto_depIdxs, + MessageInfos: file_v2_tombstone_grpc_types_proto_msgTypes, + }.Build() + File_v2_tombstone_grpc_types_proto = out.File + file_v2_tombstone_grpc_types_proto_rawDesc = nil + file_v2_tombstone_grpc_types_proto_goTypes = nil + file_v2_tombstone_grpc_types_proto_depIdxs = nil +} From 6037a26a35bbaabd22e66358b72efa517614d2df Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 10 Dec 2020 11:30:14 +0300 Subject: [PATCH 0617/1196] [#226] v2/tombstone: Implement unified message structure with methods Signed-off-by: Leonard Lyubich --- v2/tombstone/convert.go | 53 +++++++++++++++++++++++ v2/tombstone/grpc/types.go | 26 +++++++++++ v2/tombstone/json.go | 26 +++++++++++ v2/tombstone/json_test.go | 20 +++++++++ v2/tombstone/marshal.go | 83 ++++++++++++++++++++++++++++++++++++ v2/tombstone/marshal_test.go | 39 +++++++++++++++++ v2/tombstone/types.go | 63 +++++++++++++++++++++++++++ 7 files changed, 310 insertions(+) create mode 100644 v2/tombstone/convert.go create mode 100644 v2/tombstone/grpc/types.go create mode 100644 v2/tombstone/json.go create mode 100644 v2/tombstone/json_test.go create mode 100644 v2/tombstone/marshal.go create mode 100644 v2/tombstone/marshal_test.go create mode 100644 v2/tombstone/types.go diff --git a/v2/tombstone/convert.go b/v2/tombstone/convert.go new file mode 100644 index 0000000..c2e6ecd --- /dev/null +++ b/v2/tombstone/convert.go @@ -0,0 +1,53 @@ +package tombstone + +import ( + "github.com/nspcc-dev/neofs-api-go/v2/refs" + refsGRPC "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" + tombstone "github.com/nspcc-dev/neofs-api-go/v2/tombstone/grpc" +) + +// TombstoneToGRPCMessage converts unified tombstone message into gRPC message. +func TombstoneToGRPCMessage(t *Tombstone) *tombstone.Tombstone { + if t == nil { + return nil + } + + m := new(tombstone.Tombstone) + + m.SetExpirationEpoch(t.GetExpirationEpoch()) + m.SetSplitId(t.GetSplitID()) + + members := t.GetMembers() + memberMsg := make([]*refsGRPC.ObjectID, 0, len(members)) + + for i := range members { + memberMsg = append(memberMsg, refs.ObjectIDToGRPCMessage(members[i])) + } + + m.SetMembers(memberMsg) + + return m +} + +// TombstoneFromGRPCMessage converts gRPC message into unified tombstone message. +func TombstoneFromGRPCMessage(m *tombstone.Tombstone) *Tombstone { + if m == nil { + return nil + } + + t := new(Tombstone) + + t.SetExpirationEpoch(m.GetExpirationEpoch()) + t.SetSplitID(m.GetSplitId()) + + memberMsg := m.GetMembers() + members := make([]*refs.ObjectID, 0, len(memberMsg)) + + for i := range memberMsg { + members = append(members, refs.ObjectIDFromGRPCMessage(memberMsg[i])) + } + + t.SetMembers(members) + + return t +} diff --git a/v2/tombstone/grpc/types.go b/v2/tombstone/grpc/types.go new file mode 100644 index 0000000..17fe9db --- /dev/null +++ b/v2/tombstone/grpc/types.go @@ -0,0 +1,26 @@ +package tombstone + +import ( + refs "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" +) + +// SetExpirationEpoch sets number of tombstone expiration epoch. +func (x *Tombstone) SetExpirationEpoch(v uint64) { + if x != nil { + x.ExpirationEpoch = v + } +} + +// SetSplitId sets identifier of split object hierarchy. +func (x *Tombstone) SetSplitId(v []byte) { + if x != nil { + x.SplitId = v + } +} + +// SetMembers sets list of objects to be deleted. +func (x *Tombstone) SetMembers(v []*refs.ObjectID) { + if x != nil { + x.Members = v + } +} diff --git a/v2/tombstone/json.go b/v2/tombstone/json.go new file mode 100644 index 0000000..ffa0e15 --- /dev/null +++ b/v2/tombstone/json.go @@ -0,0 +1,26 @@ +package tombstone + +import ( + tombstone "github.com/nspcc-dev/neofs-api-go/v2/tombstone/grpc" + "google.golang.org/protobuf/encoding/protojson" +) + +func (s *Tombstone) MarshalJSON() ([]byte, error) { + return protojson.MarshalOptions{ + EmitUnpopulated: true, + }.Marshal( + TombstoneToGRPCMessage(s), + ) +} + +func (s *Tombstone) UnmarshalJSON(data []byte) error { + msg := new(tombstone.Tombstone) + + if err := protojson.Unmarshal(data, msg); err != nil { + return err + } + + *s = *TombstoneFromGRPCMessage(msg) + + return nil +} diff --git a/v2/tombstone/json_test.go b/v2/tombstone/json_test.go new file mode 100644 index 0000000..441f173 --- /dev/null +++ b/v2/tombstone/json_test.go @@ -0,0 +1,20 @@ +package tombstone_test + +import ( + "testing" + + "github.com/nspcc-dev/neofs-api-go/v2/tombstone" + "github.com/stretchr/testify/require" +) + +func TestTombstoneJSON(t *testing.T) { + from := generateTombstone() + + data, err := from.MarshalJSON() + require.NoError(t, err) + + to := new(tombstone.Tombstone) + require.NoError(t, to.UnmarshalJSON(data)) + + require.Equal(t, from, to) +} diff --git a/v2/tombstone/marshal.go b/v2/tombstone/marshal.go new file mode 100644 index 0000000..9b9c898 --- /dev/null +++ b/v2/tombstone/marshal.go @@ -0,0 +1,83 @@ +package tombstone + +import ( + "github.com/nspcc-dev/neofs-api-go/util/proto" + tombstone "github.com/nspcc-dev/neofs-api-go/v2/tombstone/grpc" + goproto "google.golang.org/protobuf/proto" +) + +const ( + expFNum = 1 + splitIDFNum = 2 + membersFNum = 3 +) + +// StableMarshal marshals unified tombstone message in a protobuf +// compatible way without field order shuffle. +func (s *Tombstone) StableMarshal(buf []byte) ([]byte, error) { + if s == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, s.StableSize()) + } + + var ( + offset, n int + err error + ) + + n, err = proto.UInt64Marshal(expFNum, buf[offset:], s.exp) + if err != nil { + return nil, err + } + + offset += n + + n, err = proto.BytesMarshal(splitIDFNum, buf[offset:], s.splitID) + if err != nil { + return nil, err + } + + offset += n + + for i := range s.members { + n, err = proto.NestedStructureMarshal(membersFNum, buf[offset:], s.members[i]) + if err != nil { + return nil, err + } + + offset += n + } + + return buf, nil +} + +// StableSize returns size of tombstone message marshalled by StableMarshal function. +func (s *Tombstone) StableSize() (size int) { + if s == nil { + return 0 + } + + size += proto.UInt64Size(expFNum, s.exp) + size += proto.BytesSize(splitIDFNum, s.splitID) + + for i := range s.members { + size += proto.NestedStructureSize(membersFNum, s.members[i]) + } + + return size +} + +// Unmarshal unmarshal tombstone message from its binary representation. +func (s *Tombstone) Unmarshal(data []byte) error { + m := new(tombstone.Tombstone) + if err := goproto.Unmarshal(data, m); err != nil { + return err + } + + *s = *TombstoneFromGRPCMessage(m) + + return nil +} diff --git a/v2/tombstone/marshal_test.go b/v2/tombstone/marshal_test.go new file mode 100644 index 0000000..c7eda2b --- /dev/null +++ b/v2/tombstone/marshal_test.go @@ -0,0 +1,39 @@ +package tombstone_test + +import ( + "testing" + + "github.com/nspcc-dev/neofs-api-go/v2/refs" + "github.com/nspcc-dev/neofs-api-go/v2/tombstone" + "github.com/stretchr/testify/require" +) + +func TestTombstone_StableMarshal(t *testing.T) { + from := generateTombstone() + + t.Run("non empty", func(t *testing.T) { + wire, err := from.StableMarshal(nil) + require.NoError(t, err) + + to := new(tombstone.Tombstone) + require.NoError(t, to.Unmarshal(wire)) + + require.Equal(t, from, to) + }) +} + +func generateTombstone() *tombstone.Tombstone { + t := new(tombstone.Tombstone) + + oid1 := new(refs.ObjectID) + oid1.SetValue([]byte("Object ID 1")) + + oid2 := new(refs.ObjectID) + oid2.SetValue([]byte("Object ID 2")) + + t.SetExpirationEpoch(100) + t.SetSplitID([]byte("split ID")) + t.SetMembers([]*refs.ObjectID{oid1, oid2}) + + return t +} diff --git a/v2/tombstone/types.go b/v2/tombstone/types.go new file mode 100644 index 0000000..2bcc19d --- /dev/null +++ b/v2/tombstone/types.go @@ -0,0 +1,63 @@ +package tombstone + +import ( + "github.com/nspcc-dev/neofs-api-go/v2/refs" +) + +// Tombstone is a unified structure of Tombstone +// message from proto definition. +type Tombstone struct { + exp uint64 + + splitID []byte + + members []*refs.ObjectID +} + +// GetExpirationEpoch returns number of tombstone expiration epoch. +func (s *Tombstone) GetExpirationEpoch() uint64 { + if s != nil { + return s.exp + } + + return 0 +} + +// SetExpirationEpoch sets number of tombstone expiration epoch. +func (s *Tombstone) SetExpirationEpoch(v uint64) { + if s != nil { + s.exp = v + } +} + +// GetSplitID returns identifier of split object hierarchy. +func (s *Tombstone) GetSplitID() []byte { + if s != nil { + return s.splitID + } + + return nil +} + +// SetSplitID sets identifier of split object hierarchy. +func (s *Tombstone) SetSplitID(v []byte) { + if s != nil { + s.splitID = v + } +} + +// GetMembers returns list of objects to be deleted. +func (s *Tombstone) GetMembers() []*refs.ObjectID { + if s != nil { + return s.members + } + + return nil +} + +// SetMembers sets list of objects to be deleted. +func (s *Tombstone) SetMembers(v []*refs.ObjectID) { + if s != nil { + s.members = v + } +} From c064760f5d1b534f943e43df3c29e24a2b972ad4 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 10 Dec 2020 11:56:18 +0300 Subject: [PATCH 0618/1196] [#226] sdk/object: Implement Tombstone type with field access and encoding Signed-off-by: Leonard Lyubich --- pkg/object/tombstone.go | 118 +++++++++++++++++++++++++++++++++++ pkg/object/tombstone_test.go | 65 +++++++++++++++++++ 2 files changed, 183 insertions(+) create mode 100644 pkg/object/tombstone.go create mode 100644 pkg/object/tombstone_test.go diff --git a/pkg/object/tombstone.go b/pkg/object/tombstone.go new file mode 100644 index 0000000..85fb569 --- /dev/null +++ b/pkg/object/tombstone.go @@ -0,0 +1,118 @@ +package object + +import ( + "github.com/nspcc-dev/neofs-api-go/v2/refs" + "github.com/nspcc-dev/neofs-api-go/v2/tombstone" +) + +// Tombstone represents v2-compatible tombstone structure. +type Tombstone tombstone.Tombstone + +// NewTombstoneFromV2 wraps v2 Tombstone message to Tombstone. +func NewTombstoneFromV2(tV2 *tombstone.Tombstone) *Tombstone { + return (*Tombstone)(tV2) +} + +// NewTombstone creates and initializes blank Tombstone. +func NewTombstone() *Tombstone { + return NewTombstoneFromV2(new(tombstone.Tombstone)) +} + +// ExpirationEpoch return number of tombstone expiration epoch. +func (t *Tombstone) ExpirationEpoch() uint64 { + return (*tombstone.Tombstone)(t). + GetExpirationEpoch() +} + +// SetExpirationEpoch sets number of tombstone expiration epoch. +func (t *Tombstone) SetExpirationEpoch(v uint64) { + (*tombstone.Tombstone)(t). + SetExpirationEpoch(v) +} + +// SplitID returns identifier of object split hierarchy. +func (t *Tombstone) SplitID() *SplitID { + return NewSplitIDFromV2( + (*tombstone.Tombstone)(t). + GetSplitID(), + ) +} + +// SetSplitID sets identifier of object split hierarchy. +func (t *Tombstone) SetSplitID(v *SplitID) { + (*tombstone.Tombstone)(t). + SetSplitID(v.ToV2()) +} + +// SplitID returns identifier of object split hierarchy. +func (t *Tombstone) Members() []*ID { + msV2 := (*tombstone.Tombstone)(t). + GetMembers() + + if msV2 == nil { + return nil + } + + ms := make([]*ID, 0, len(msV2)) + + for i := range msV2 { + ms = append(ms, NewIDFromV2(msV2[i])) + } + + return ms +} + +// SplitID returns identifier of object split hierarchy. +func (t *Tombstone) SetMembers(v []*ID) { + var ms []*refs.ObjectID + + if v != nil { + ms = (*tombstone.Tombstone)(t). + GetMembers() + + if ln := len(v); cap(ms) >= ln { + ms = ms[:0] + } else { + ms = make([]*refs.ObjectID, 0, ln) + } + + for i := range v { + ms = append(ms, v[i].ToV2()) + } + } + + (*tombstone.Tombstone)(t). + SetMembers(ms) +} + +// Marshal marshals Tombstone into a protobuf binary form. +// +// Buffer is allocated when the argument is empty. +// Otherwise, the first buffer is used. +func (t *Tombstone) Marshal(b ...[]byte) ([]byte, error) { + var buf []byte + if len(b) > 0 { + buf = b[0] + } + + return (*tombstone.Tombstone)(t). + StableMarshal(buf) +} + +// Unmarshal unmarshals protobuf binary representation of Tombstone. +func (t *Tombstone) Unmarshal(data []byte) error { + return (*tombstone.Tombstone)(t). + Unmarshal(data) +} + +// MarshalJSON encodes Tombstone to protobuf JSON format. +func (t *Tombstone) MarshalJSON() ([]byte, error) { + return (*tombstone.Tombstone)(t). + MarshalJSON() +} + +// UnmarshalJSON decodes Tombstone from protobuf JSON format. +func (t *Tombstone) UnmarshalJSON(data []byte) error { + return (*tombstone.Tombstone)(t). + UnmarshalJSON(data) +} diff --git a/pkg/object/tombstone_test.go b/pkg/object/tombstone_test.go new file mode 100644 index 0000000..21103ba --- /dev/null +++ b/pkg/object/tombstone_test.go @@ -0,0 +1,65 @@ +package object + +import ( + "crypto/rand" + "crypto/sha256" + "testing" + + "github.com/stretchr/testify/require" +) + +func generateIDList(sz int) []*ID { + res := make([]*ID, sz) + cs := [sha256.Size]byte{} + + for i := 0; i < sz; i++ { + res[i] = NewID() + rand.Read(cs[:]) + res[i].SetSHA256(cs) + } + + return res +} + +func TestTombstone(t *testing.T) { + ts := NewTombstone() + + exp := uint64(13) + ts.SetExpirationEpoch(exp) + require.Equal(t, exp, ts.ExpirationEpoch()) + + splitID := NewSplitID() + ts.SetSplitID(splitID) + require.Equal(t, splitID, ts.SplitID()) + + members := generateIDList(3) + ts.SetMembers(members) + require.Equal(t, members, ts.Members()) +} + +func TestTombstoneEncoding(t *testing.T) { + ts := NewTombstone() + ts.SetExpirationEpoch(13) + ts.SetSplitID(NewSplitID()) + ts.SetMembers(generateIDList(5)) + + t.Run("binary", func(t *testing.T) { + data, err := ts.Marshal() + require.NoError(t, err) + + ts2 := NewTombstone() + require.NoError(t, ts2.Unmarshal(data)) + + require.Equal(t, ts, ts2) + }) + + t.Run("json", func(t *testing.T) { + data, err := ts.MarshalJSON() + require.NoError(t, err) + + ts2 := NewTombstone() + require.NoError(t, ts2.UnmarshalJSON(data)) + + require.Equal(t, ts, ts2) + }) +} From 4567986682df932bbd7d134e17d0fc1657102aff Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 10 Dec 2020 12:15:17 +0300 Subject: [PATCH 0619/1196] [#226] v2/object: Add tombstone field to DeleteResponseBody Signed-off-by: Leonard Lyubich --- v2/object/convert.go | 6 ++++++ v2/object/grpc/service.go | 7 +++++++ v2/object/marshal.go | 25 +++++++++++++++++++++++-- v2/object/marshal_test.go | 9 ++++++--- v2/object/types.go | 20 +++++++++++++++++++- 5 files changed, 61 insertions(+), 6 deletions(-) diff --git a/v2/object/convert.go b/v2/object/convert.go index 24d4f47..f9d5a06 100644 --- a/v2/object/convert.go +++ b/v2/object/convert.go @@ -909,6 +909,9 @@ func DeleteResponseBodyToGRPCMessage(r *DeleteResponseBody) *object.DeleteRespon } m := new(object.DeleteResponse_Body) + m.SetTombstone( + refs.AddressToGRPCMessage(r.GetTombstone()), + ) return m } @@ -919,6 +922,9 @@ func DeleteResponseBodyFromGRPCMessage(m *object.DeleteResponse_Body) *DeleteRes } r := new(DeleteResponseBody) + r.SetTombstone( + refs.AddressFromGRPCMessage(m.GetTombstone()), + ) return r } diff --git a/v2/object/grpc/service.go b/v2/object/grpc/service.go index 323522b..e9b7659 100644 --- a/v2/object/grpc/service.go +++ b/v2/object/grpc/service.go @@ -260,6 +260,13 @@ func (m *DeleteRequest) SetVerifyHeader(v *session.RequestVerificationHeader) { } } +// SetTombstone sets tombstone address. +func (x *DeleteResponse_Body) SetTombstone(v *refs.Address) { + if x != nil { + x.Tombstone = v + } +} + // SetBody sets body of the response. func (m *DeleteResponse) SetBody(v *DeleteResponse_Body) { if m != nil { diff --git a/v2/object/marshal.go b/v2/object/marshal.go index 04737b6..f08c71d 100644 --- a/v2/object/marshal.go +++ b/v2/object/marshal.go @@ -70,6 +70,8 @@ const ( deleteReqBodyAddressField = 1 + deleteRespBodyTombstoneFNum = 1 + headReqBodyAddressField = 1 headReqBodyMainFlagField = 2 headReqBodyRawFlagField = 3 @@ -953,11 +955,30 @@ func (r *DeleteRequestBody) StableSize() (size int) { } func (r *DeleteResponseBody) StableMarshal(buf []byte) ([]byte, error) { - return nil, nil + if r == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, r.StableSize()) + } + + _, err := proto.NestedStructureMarshal(deleteRespBodyTombstoneFNum, buf, r.tombstone) + if err != nil { + return nil, err + } + + return buf, nil } func (r *DeleteResponseBody) StableSize() (size int) { - return 0 + if r == nil { + return 0 + } + + size += proto.NestedStructureSize(deleteRespBodyTombstoneFNum, r.tombstone) + + return size } func (r *HeadRequestBody) StableMarshal(buf []byte) ([]byte, error) { diff --git a/v2/object/marshal_test.go b/v2/object/marshal_test.go index cc702af..cafe099 100644 --- a/v2/object/marshal_test.go +++ b/v2/object/marshal_test.go @@ -207,7 +207,7 @@ func TestDeleteRequestBody_StableMarshal(t *testing.T) { } func TestDeleteResponseBody_StableMarshal(t *testing.T) { - from := generateDeleteResponseBody() + from := generateDeleteResponseBody("CID", "OID") transport := new(grpc.DeleteResponse_Body) t.Run("non empty", func(t *testing.T) { @@ -613,8 +613,11 @@ func generateDeleteRequestBody(cid, oid string) *object.DeleteRequestBody { return req } -func generateDeleteResponseBody() *object.DeleteResponseBody { - return new(object.DeleteResponseBody) +func generateDeleteResponseBody(cid, oid string) *object.DeleteResponseBody { + resp := new(object.DeleteResponseBody) + resp.SetTombstone(generateAddress(cid, oid)) + + return resp } func generateHeadRequestBody(cid, oid string) *object.HeadRequestBody { diff --git a/v2/object/types.go b/v2/object/types.go index 2ab3ff5..3441958 100644 --- a/v2/object/types.go +++ b/v2/object/types.go @@ -139,7 +139,9 @@ type DeleteRequestBody struct { addr *refs.Address } -type DeleteResponseBody struct{} +type DeleteResponseBody struct { + tombstone *refs.Address +} type HeadRequestBody struct { addr *refs.Address @@ -1124,6 +1126,22 @@ func (r *DeleteRequest) SetVerificationHeader(v *session.RequestVerificationHead } } +// GetTombstone returns tombstone address. +func (r *DeleteResponseBody) GetTombstone() *refs.Address { + if r != nil { + return r.tombstone + } + + return nil +} + +// SetTombstone sets tombstone address. +func (r *DeleteResponseBody) SetTombstone(v *refs.Address) { + if r != nil { + r.tombstone = v + } +} + func (r *DeleteResponse) GetBody() *DeleteResponseBody { if r != nil { return r.body From 803c91b3eb2bd7d2a7eab0378897a73bc984941f Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 10 Dec 2020 12:25:13 +0300 Subject: [PATCH 0620/1196] [#226] sdk/client: Add tombstone address to the return of DeleteObject Signed-off-by: Leonard Lyubich --- pkg/client/object.go | 79 ++++++++++++++++++++++++++++++++++++----- pkg/object/tombstone.go | 4 +-- 2 files changed, 73 insertions(+), 10 deletions(-) diff --git a/pkg/client/object.go b/pkg/client/object.go index fe31788..d7fba42 100644 --- a/pkg/client/object.go +++ b/pkg/client/object.go @@ -25,8 +25,20 @@ type PutObjectParams struct { r io.Reader } +// ObjectAddressWriter is an interface of the +// component that writes the object address. +type ObjectAddressWriter interface { + SetAddress(*object.Address) +} + +type objectAddressWriter struct { + addr *object.Address +} + type DeleteObjectParams struct { addr *object.Address + + tombTgt ObjectAddressWriter } type GetObjectParams struct { @@ -97,6 +109,10 @@ const searchQueryVersion uint32 = 1 var errNilObjectPart = errors.New("received nil object part") +func (w objectAddressWriter) SetAddress(addr *object.Address) { + w.addr = addr +} + func rangesToV2(rs []*object.Range) []*v2object.Range { r2 := make([]*v2object.Range, 0, len(rs)) @@ -295,21 +311,68 @@ func (p *DeleteObjectParams) Address() *object.Address { return nil } +// WithTombstoneAddressTarget sets target component to write tombstone address. +func (p *DeleteObjectParams) WithTombstoneAddressTarget(v ObjectAddressWriter) *DeleteObjectParams { + if p != nil { + p.tombTgt = v + } + + return p +} + +// TombstoneAddressTarget returns target component to write tombstone address. +func (p *DeleteObjectParams) TombstoneAddressTarget() ObjectAddressWriter { + if p != nil { + return p.tombTgt + } + + return nil +} + +// DeleteObject is a wrapper over Client.DeleteObject method +// that provides the ability to receive tombstone address +// without setting a target in the parameters. +func DeleteObject(c *Client, ctx context.Context, p *DeleteObjectParams, opts ...CallOption) (*object.Address, error) { + w := new(objectAddressWriter) + + err := c.DeleteObject(ctx, p.WithTombstoneAddressTarget(w), opts...) + if err != nil { + return nil, err + } + + return w.addr, nil +} + +// DeleteObject removes object by address. +// +// If target of tombstone address is not set, the address is ignored. func (c *Client) DeleteObject(ctx context.Context, p *DeleteObjectParams, opts ...CallOption) error { // check remote node version switch c.remoteNode.Version.Major() { case 2: - return c.deleteObjectV2(ctx, p, opts...) + if p.tombTgt == nil { + p.tombTgt = new(objectAddressWriter) + } + + resp, err := c.deleteObjectV2(ctx, p, opts...) + if err != nil { + return err + } + + addrV2 := resp.GetBody().GetTombstone() + p.tombTgt.SetAddress(object.NewAddressFromV2(addrV2)) + + return nil default: return errUnsupportedProtocol } } -func (c *Client) deleteObjectV2(ctx context.Context, p *DeleteObjectParams, opts ...CallOption) error { +func (c *Client) deleteObjectV2(ctx context.Context, p *DeleteObjectParams, opts ...CallOption) (*v2object.DeleteResponse, error) { // create V2 Object client cli, err := v2ObjectClient(c.remoteNode.Protocol, c.opts) if err != nil { - return errors.Wrap(err, "could not create Object V2 client") + return nil, errors.Wrap(err, "could not create Object V2 client") } callOpts := c.defaultCallOptions() @@ -333,7 +396,7 @@ func (c *Client) deleteObjectV2(ctx context.Context, p *DeleteObjectParams, opts addr: p.addr.ToV2(), verb: v2session.ObjectVerbDelete, }); err != nil { - return errors.Wrap(err, "could not sign session token") + return nil, errors.Wrap(err, "could not sign session token") } req.SetMetaHeader(meta) @@ -343,21 +406,21 @@ func (c *Client) deleteObjectV2(ctx context.Context, p *DeleteObjectParams, opts // sign the request if err := signature.SignServiceMessage(c.key, req); err != nil { - return errors.Wrapf(err, "could not sign %T", req) + return nil, errors.Wrapf(err, "could not sign %T", req) } // send request resp, err := cli.Delete(ctx, req) if err != nil { - return errors.Wrapf(err, "could not send %T", req) + return nil, errors.Wrapf(err, "could not send %T", req) } // verify response structure if err := signature.VerifyServiceMessage(resp); err != nil { - return errors.Wrapf(err, "could not verify %T", resp) + return nil, errors.Wrapf(err, "could not verify %T", resp) } - return nil + return resp, nil } func (p *GetObjectParams) WithAddress(v *object.Address) *GetObjectParams { diff --git a/pkg/object/tombstone.go b/pkg/object/tombstone.go index 85fb569..469e684 100644 --- a/pkg/object/tombstone.go +++ b/pkg/object/tombstone.go @@ -44,7 +44,7 @@ func (t *Tombstone) SetSplitID(v *SplitID) { SetSplitID(v.ToV2()) } -// SplitID returns identifier of object split hierarchy. +// Members returns list of objects to be deleted. func (t *Tombstone) Members() []*ID { msV2 := (*tombstone.Tombstone)(t). GetMembers() @@ -62,7 +62,7 @@ func (t *Tombstone) Members() []*ID { return ms } -// SplitID returns identifier of object split hierarchy. +// SetMembers sets list of objects to be deleted. func (t *Tombstone) SetMembers(v []*ID) { var ms []*refs.ObjectID From 1bc91466aa7b82b7fa360caf02b1b0e2b2c0dab9 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 11 Dec 2020 11:19:45 +0300 Subject: [PATCH 0621/1196] sdk/client: Fix setter of objectAddressWriter structure value Signed-off-by: Leonard Lyubich --- pkg/client/object.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/client/object.go b/pkg/client/object.go index d7fba42..a96f2f2 100644 --- a/pkg/client/object.go +++ b/pkg/client/object.go @@ -109,7 +109,7 @@ const searchQueryVersion uint32 = 1 var errNilObjectPart = errors.New("received nil object part") -func (w objectAddressWriter) SetAddress(addr *object.Address) { +func (w *objectAddressWriter) SetAddress(addr *object.Address) { w.addr = addr } From 2aa51d3add2922296c8e0faa521e2de826f683c8 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 11 Dec 2020 14:48:27 +0300 Subject: [PATCH 0622/1196] v2/object: Fix NPE in SplitInfo.GetObject Signed-off-by: Leonard Lyubich --- v2/object/types.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/v2/object/types.go b/v2/object/types.go index 3441958..d192715 100644 --- a/v2/object/types.go +++ b/v2/object/types.go @@ -651,7 +651,7 @@ func (o *Object) SetPayload(v []byte) { } func (s *SplitInfo) GetSplitID() []byte { - if s.splitID != nil { + if s != nil { return s.splitID } From 7d1a795d76627c7b99c1e945c3d17fc8d5b95965 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 11 Dec 2020 17:45:58 +0300 Subject: [PATCH 0623/1196] Update changelog and readme for v1.21.0 Signed-off-by: Leonard Lyubich --- CHANGELOG.md | 29 +++++++++++++++++++++++++++++ README.md | 1 + 2 files changed, 30 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6292824..108f995 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,33 @@ # Changelog +## [1.21.0] - 2020-12-11 - Modo (모도, 茅島) + +### Added + +- `SplitID` message support +- Search filter by `SplitID` field +- `SplitInfo` message support and related error +- `Raw` flag support in `Client.GetObject(Header)` +- Getters for parameter structures in `pkg/client` package +- `Tombstone` message support +- Tombstone address target parameter of `Client.DeleteObject` method +- `client.DeleteObject` helpful function +- Usage of default value for backup factor in placement builder + +### Removed + +- Object search filter by `CHILDFREE` property + +### Renamed + +- `AddLeafFilter` to `AddPhyFilter` + +### Fixed + +- NPE in `eacl.NewTargetFromV2` function +- Processing `REP X` policies in placement builder + + ## [1.20.3] - 2020-11-25 ### Added @@ -428,3 +456,4 @@ Initial public release [1.20.1]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.20.0...v1.20.1 [1.20.2]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.20.1...v1.20.2 [1.20.3]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.20.2...v1.20.3 +[1.21.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.20.3...v1.21.0 diff --git a/README.md b/README.md index f95a315..a960339 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,7 @@ versions and SDK layer working with all of them in a handy way. |:------------------:|:--------------------------:| |< v1.20.0 **(unsupported)**|up to v1.2.0| |v1.20.x|[v2.0.2](https://github.com/nspcc-dev/neofs-api/releases/tag/v2.0.2)| +|v1.21.x|[v2.1.0](https://github.com/nspcc-dev/neofs-api/releases/tag/v2.1.0)| ## Contributing From 84839b09c254b6ff48fdba5679aa2e9fdcde472f Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 17 Dec 2020 12:50:36 +0300 Subject: [PATCH 0624/1196] [#208] pkg/container: Define standard error for mismatch identifiers Signed-off-by: Leonard Lyubich --- pkg/container/id.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/container/id.go b/pkg/container/id.go index bdf3f8e..3ab170c 100644 --- a/pkg/container/id.go +++ b/pkg/container/id.go @@ -12,6 +12,10 @@ import ( // ID represents v2-compatible container identifier. type ID refs.ContainerID +// ErrIDMismatch is returned when container structure does not match +// a specific identifier. +var ErrIDMismatch = errors.New("container structure does not match the identifier") + var errInvalidIDString = errors.New("incorrect format of the string container ID") // NewIDFromV2 wraps v2 ContainerID message to ID. From 5395988efcd3c5b801cc745d266c214312d9b330 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 17 Dec 2020 12:51:03 +0300 Subject: [PATCH 0625/1196] [#208] pkg/client: Add function to get container and verify ID GetContainer method reads container structure by identifier from the network. In some cases it is required to additionally check the correspondence of the container structure to the identifier as a hash from the binary representation. To do this, a new function GetVerifiedContainerStructure is defined to execute the check after receiving the container. Signed-off-by: Leonard Lyubich --- pkg/client/container.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/pkg/client/container.go b/pkg/client/container.go index 3bd61e2..d28bec7 100644 --- a/pkg/client/container.go +++ b/pkg/client/container.go @@ -64,6 +64,23 @@ func (c Client) GetContainer(ctx context.Context, id *container.ID, opts ...Call } } +// GetVerifiedContainerStructure is a wrapper over Client.GetContainer method +// which checks if the structure of the resulting container matches its identifier. +// +// Returns container.ErrIDMismatch if container does not match the identifier. +func GetVerifiedContainerStructure(ctx context.Context, c *Client, id *container.ID, opts ...CallOption) (*container.Container, error) { + cnr, err := c.GetContainer(ctx, id, opts...) + if err != nil { + return nil, err + } + + if !container.CalculateID(cnr).Equal(id) { + return nil, container.ErrIDMismatch + } + + return cnr, nil +} + func (c Client) ListContainers(ctx context.Context, owner *owner.ID, opts ...CallOption) ([]*container.ID, error) { switch c.remoteNode.Version.Major() { case 2: From adb681878befd5e81cd505efcd2e8536c81d9ef0 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 18 Dec 2020 16:00:50 +0300 Subject: [PATCH 0626/1196] Recompile protobuf files from neofs-api v2.1.1 Signed-off-by: Leonard Lyubich --- v2/acl/grpc/types.pb.go | 5 +++++ v2/container/grpc/types.pb.go | 4 +++- v2/netmap/grpc/types.pb.go | 5 ++++- v2/object/grpc/types.pb.go | 4 +++- v2/refs/grpc/types.pb.go | 38 ++++++++++++++++++++++++++++------- 5 files changed, 46 insertions(+), 10 deletions(-) diff --git a/v2/acl/grpc/types.pb.go b/v2/acl/grpc/types.pb.go index 3d0f0e1..052ceb2 100644 --- a/v2/acl/grpc/types.pb.go +++ b/v2/acl/grpc/types.pb.go @@ -556,6 +556,11 @@ func (x *BearerToken) GetSignature() *grpc.Signature { // * $Object:homomorphicHash \ // homomorphic_hash // +// Please note, that if request or response does not have object's headers or +// full object (Range, RangeHash, Search, Delete), it will not be possible to +// filter by object header fields or user attributes. From the well-known list +// only `$Object:objectID` and `$Object:containerID` will be available, as +// it's possible to take that information from the requested address. type EACLRecord_Filter struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache diff --git a/v2/container/grpc/types.pb.go b/v2/container/grpc/types.pb.go index f23cad5..6639bc3 100644 --- a/v2/container/grpc/types.pb.go +++ b/v2/container/grpc/types.pb.go @@ -130,7 +130,9 @@ func (x *Container) GetPlacementPolicy() *grpc1.PlacementPolicy { // container. Container attributes are immutable. They are set at container // creation and can never be added or updated. // -// Key name must be a valid UTF-8 string. Value can't be empty. +// 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: // diff --git a/v2/netmap/grpc/types.pb.go b/v2/netmap/grpc/types.pb.go index 178d975..3fd7d8f 100644 --- a/v2/netmap/grpc/types.pb.go +++ b/v2/netmap/grpc/types.pb.go @@ -536,7 +536,10 @@ type NodeInfo struct { PublicKey []byte `protobuf:"bytes,1,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"` // Ways to connect to a node Address string `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"` - // Carries list of the NeoFS node attributes in a string key-value format. + // Carries list of the NeoFS node attributes in a key-value form. Key name + // must be a node-unique valid UTF-8 string. Value can't be empty. NodeInfo + // structures with duplicated attribute names or attributes with empty values + // will be considered invalid. Attributes []*NodeInfo_Attribute `protobuf:"bytes,3,rep,name=attributes,proto3" json:"attributes,omitempty"` // Carries state of the NeoFS node. State NodeInfo_State `protobuf:"varint,4,opt,name=state,proto3,enum=neo.fs.v2.netmap.NodeInfo_State" json:"state,omitempty"` diff --git a/v2/object/grpc/types.pb.go b/v2/object/grpc/types.pb.go index e2de279..2f900b8 100644 --- a/v2/object/grpc/types.pb.go +++ b/v2/object/grpc/types.pb.go @@ -520,7 +520,9 @@ func (x *SplitInfo) GetLink() *grpc.ObjectID { // `Attribute` is a user-defined Key-Value metadata pair attached to the // object. // -// Key name must be a valid UTF-8 string. Value can't be empty. +// Key name must be a object-unique valid UTF-8 string. Value can't be empty. +// Objects with duplicated attribute names or attributes with empty values +// will be considered invalid. // // There are some "well-known" attributes starting with `__NEOFS__` prefix // that affect system behaviour: diff --git a/v2/refs/grpc/types.pb.go b/v2/refs/grpc/types.pb.go index b0e18b5..55a80f4 100644 --- a/v2/refs/grpc/types.pb.go +++ b/v2/refs/grpc/types.pb.go @@ -142,10 +142,19 @@ func (x *Address) GetObjectId() *ObjectID { // NeoFS Object unique identifier. Objects are immutable and content-addressed. // It means `ObjectID` will change if `header` or `payload` changes. // -// `ObjectID` is a 32 byte long SHA256 hash of object's `header` field, which, -// in it's turn, contains hash of object's payload. +// `ObjectID` is a 32 byte long +// [SHA256](https://csrc.nist.gov/publications/detail/fips/180/4/final) hash of +// object's `header` field, which, in it's turn, contains hash of object's +// payload. // -// String presentation is base58 encoded string. +// String presentation is +// [base58](https://tools.ietf.org/html/draft-msporny-base58-02) encoded string. +// +// JSON value will be the data encoded as a string using standard base64 +// encoding with paddings. Either +// [standard](https://tools.ietf.org/html/rfc4648#section-4) or +// [URL-safe](https://tools.ietf.org/html/rfc4648#section-5) base64 encoding +// with/without paddings are accepted. type ObjectID struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -197,10 +206,18 @@ func (x *ObjectID) GetValue() []byte { // NeoFS container identifier. Container structures are immutable and // content-addressed. // -// `ContainerID` is a 32 byte long SHA256 hash of stable-marshalled container -// message. +// `ContainerID` is a 32 byte long +// [SHA256](https://csrc.nist.gov/publications/detail/fips/180/4/final) hash of +// stable-marshalled container message. // -// String presentation is base58 encoded string. +// String presentation is +// [base58](https://tools.ietf.org/html/draft-msporny-base58-02) encoded string. +// +// JSON value will be the data encoded as a string using standard base64 +// encoding with paddings. Either +// [standard](https://tools.ietf.org/html/rfc4648#section-4) or +// [URL-safe](https://tools.ietf.org/html/rfc4648#section-5) base64 encoding +// with/without paddings are accepted. type ContainerID struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -256,7 +273,14 @@ func (x *ContainerID) GetValue() []byte { // `OwnerID` is a 25 bytes sequence starting with Neo version prefix byte // followed by 20 bytes of ScrptHash and 4 bytes of checksum. // -// String presentation is Base58 Check Encoded string. +// String presentation is [Base58 +// Check](https://en.bitcoin.it/wiki/Base58Check_encoding) Encoded string. +// +// JSON value will be the data encoded as a string using standard base64 +// encoding with paddings. Either +// [standard](https://tools.ietf.org/html/rfc4648#section-4) or +// [URL-safe](https://tools.ietf.org/html/rfc4648#section-5) base64 encoding +// with/without paddings are accepted. type OwnerID struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache From 9480742d7b0d5a41673870683b4bddfe7090e9a0 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 18 Dec 2020 16:04:36 +0300 Subject: [PATCH 0627/1196] Update changelog for v1.21.1 Signed-off-by: Leonard Lyubich --- CHANGELOG.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 108f995..21634d5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## [1.21.1] - 2020-12-18 + +Support neofs-api v2.1.1. + +### Added + +- `client.GetVerifiedContainerStructure` function to check + that the container structure matches the requested identifier. + ## [1.21.0] - 2020-12-11 - Modo (모도, 茅島) ### Added @@ -457,3 +466,4 @@ Initial public release [1.20.2]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.20.1...v1.20.2 [1.20.3]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.20.2...v1.20.3 [1.21.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.20.3...v1.21.0 +[1.21.1]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.21.0...v1.21.1 From 3550e128bbd9c6a5f7b297beef1184d08e97c4a6 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 24 Dec 2020 10:24:38 +0300 Subject: [PATCH 0628/1196] [#236] Fix SDK minor version number Signed-off-by: Leonard Lyubich --- pkg/version.go | 4 ++-- pkg/version_test.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/version.go b/pkg/version.go index 1d5f5f7..0c64956 100644 --- a/pkg/version.go +++ b/pkg/version.go @@ -10,7 +10,7 @@ import ( // Version represents v2-compatible version. type Version refs.Version -const sdkMjr, sdkMnr = 2, 0 +const sdkMjr, sdkMnr = 2, 1 // NewVersionFromV2 wraps v2 Version message to Version. func NewVersionFromV2(v *refs.Version) *Version { @@ -72,7 +72,7 @@ func IsSupportedVersion(v *Version) error { switch mjr := v.Major(); mjr { case 2: switch mnr := v.Minor(); mnr { - case 0: + case 0, 1: return nil } } diff --git a/pkg/version_test.go b/pkg/version_test.go index 73ee6ff..fe7f661 100644 --- a/pkg/version_test.go +++ b/pkg/version_test.go @@ -46,7 +46,7 @@ func TestIsSupportedVersion(t *testing.T) { }{ { mjr: 2, - maxMnr: 0, + maxMnr: 1, }, } { v.SetMajor(item.mjr) From 70c29ca3e5f687c219e502cb815186f6cf86fd9d Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 24 Dec 2020 12:26:41 +0300 Subject: [PATCH 0629/1196] [#194] pkg/container: Implement container nonce getter/setter as UUID Implement NonceUUID/SetNonceUUID methods on container structure. Change implementation of Nonce/SetNonce methods and mark them deprecated. Signed-off-by: Leonard Lyubich --- pkg/container/container.go | 41 ++++++++++++++++++++++++++++++--- pkg/container/container_test.go | 11 +++++---- 2 files changed, 45 insertions(+), 7 deletions(-) diff --git a/pkg/container/container.go b/pkg/container/container.go index 1638ca5..2c94938 100644 --- a/pkg/container/container.go +++ b/pkg/container/container.go @@ -3,6 +3,7 @@ package container import ( "crypto/sha256" + "github.com/google/uuid" "github.com/nspcc-dev/neofs-api-go/pkg" "github.com/nspcc-dev/neofs-api-go/pkg/netmap" "github.com/nspcc-dev/neofs-api-go/pkg/owner" @@ -21,7 +22,7 @@ func New(opts ...NewOption) *Container { } cnr := new(Container) - cnr.SetNonce(cnrOptions.nonce[:]) + cnr.SetNonceUUID(cnrOptions.nonce) cnr.SetBasicACL(cnrOptions.acl) if cnrOptions.owner != nil { @@ -81,12 +82,46 @@ func (c *Container) SetOwnerID(v *owner.ID) { c.v2.SetOwnerID(v.ToV2()) } +// Nonce returns container nonce in a binary format. +// +// Returns nil if container nonce is not a valid UUID. +// +// Deprecated: use NonceUUID instead. func (c *Container) Nonce() []byte { - return c.v2.GetNonce() // return uuid? + uid, err := c.NonceUUID() + if err == nil { + data, _ := uid.MarshalBinary() + return data + } + + return nil } +// SetNonce sets container nonce in a binary format. +// +// If slice length is less than UUID size, than +// value is padded with a sequence of zeros. +// If slice length is more than UUID size, than +// value is cut. +// +// Deprecated: use SetNonceUUID instead. func (c *Container) SetNonce(v []byte) { - c.v2.SetNonce(v) // set uuid? + u := uuid.UUID{} + copy(u[:], v) + c.v2.SetNonce(u[:]) +} + +// Returns container nonce in UUID format. +// +// Returns error if container nonce is not a valid UUID. +func (c *Container) NonceUUID() (uuid.UUID, error) { + return uuid.FromBytes(c.v2.GetNonce()) +} + +// SetNonceUUID sets container nonce as UUID. +func (c *Container) SetNonceUUID(v uuid.UUID) { + data, _ := v.MarshalBinary() + c.v2.SetNonce(data) } func (c *Container) BasicACL() uint32 { diff --git a/pkg/container/container_test.go b/pkg/container/container_test.go index 391b983..f4739ab 100644 --- a/pkg/container/container_test.go +++ b/pkg/container/container_test.go @@ -17,8 +17,7 @@ import ( func TestNewContainer(t *testing.T) { c := container.New() - nonce, err := uuid.New().MarshalBinary() - require.NoError(t, err) + nonce := uuid.New() wallet, err := owner.NEO3WalletFromPublicKey(&test.DecodeKey(1).PublicKey) require.NoError(t, err) @@ -29,7 +28,7 @@ func TestNewContainer(t *testing.T) { c.SetBasicACL(acl.PublicBasicRule) c.SetAttributes(generateAttributes(5)) c.SetPlacementPolicy(policy) - c.SetNonce(nonce) + c.SetNonceUUID(nonce) c.SetOwnerID(ownerID) c.SetVersion(pkg.SDKVersion()) @@ -39,7 +38,11 @@ func TestNewContainer(t *testing.T) { require.EqualValues(t, newContainer.PlacementPolicy(), policy) require.EqualValues(t, newContainer.Attributes(), generateAttributes(5)) require.EqualValues(t, newContainer.BasicACL(), acl.PublicBasicRule) - require.EqualValues(t, newContainer.Nonce(), nonce) + + newNonce, err := newContainer.NonceUUID() + require.NoError(t, err) + + require.EqualValues(t, newNonce, nonce) require.EqualValues(t, newContainer.OwnerID(), ownerID) require.EqualValues(t, newContainer.Version(), pkg.SDKVersion()) } From 79884057533fee2c9698ca372394209189072f3d Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 24 Dec 2020 12:28:33 +0300 Subject: [PATCH 0630/1196] [#194] pkg/container: Implement container constructor with format check Implement NewVerifiedFromV2 function that verifies format of NeoFS API V2 Container message. Signed-off-by: Leonard Lyubich --- pkg/container/container.go | 4 ++++ pkg/container/fmt.go | 27 +++++++++++++++++++++ pkg/container/fmt_test.go | 49 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 80 insertions(+) create mode 100644 pkg/container/fmt.go create mode 100644 pkg/container/fmt_test.go diff --git a/pkg/container/container.go b/pkg/container/container.go index 2c94938..f4a52a1 100644 --- a/pkg/container/container.go +++ b/pkg/container/container.go @@ -42,6 +42,10 @@ func (c *Container) ToV2() *container.Container { return &c.v2 } +// NewVerifiedFromV2 constructs Container from NeoFS API V2 Container message. +// +// Does not perform if message meets NeoFS API V2 specification. To do this +// use NewVerifiedFromV2 constructor. func NewContainerFromV2(c *container.Container) *Container { cnr := new(Container) diff --git a/pkg/container/fmt.go b/pkg/container/fmt.go new file mode 100644 index 0000000..8579bea --- /dev/null +++ b/pkg/container/fmt.go @@ -0,0 +1,27 @@ +package container + +import ( + "github.com/nspcc-dev/neofs-api-go/pkg" + "github.com/nspcc-dev/neofs-api-go/v2/container" + "github.com/pkg/errors" +) + +// NewVerifiedFromV2 constructs Container from NeoFS API V2 Container message. +// Returns error if message does not meet NeoFS API V2 specification. +// +// Additionally checks if message carries supported version. +func NewVerifiedFromV2(cnrV2 *container.Container) (*Container, error) { + cnr := NewContainerFromV2(cnrV2) + + // check version support + if err := pkg.IsSupportedVersion(cnr.Version()); err != nil { + return nil, err + } + + // check nonce format + if _, err := cnr.NonceUUID(); err != nil { + return nil, errors.Wrap(err, "invalid nonce") + } + + return cnr, nil +} diff --git a/pkg/container/fmt_test.go b/pkg/container/fmt_test.go new file mode 100644 index 0000000..c27bdde --- /dev/null +++ b/pkg/container/fmt_test.go @@ -0,0 +1,49 @@ +package container_test + +import ( + "testing" + + "github.com/google/uuid" + "github.com/nspcc-dev/neofs-api-go/pkg" + "github.com/nspcc-dev/neofs-api-go/pkg/container" + containerV2 "github.com/nspcc-dev/neofs-api-go/v2/container" + "github.com/stretchr/testify/require" +) + +func TestNewVerifiedFromV2(t *testing.T) { + cnrV2 := new(containerV2.Container) + + errAssert := func() { + _, err := container.NewVerifiedFromV2(cnrV2) + require.Error(t, err) + } + + // set unsupported version + v := pkg.SDKVersion() + v.SetMajor(0) + require.Error(t, pkg.IsSupportedVersion(v)) + cnrV2.SetVersion(v.ToV2()) + + errAssert() + + // set supported version + v.SetMajor(2) + require.NoError(t, pkg.IsSupportedVersion(v)) + cnrV2.SetVersion(v.ToV2()) + + errAssert() + + // set invalid nonce + nonce := []byte{1, 2, 3} + cnrV2.SetNonce(nonce) + + errAssert() + + // set valid nonce + uid := uuid.New() + data, _ := uid.MarshalBinary() + cnrV2.SetNonce(data) + + _, err := container.NewVerifiedFromV2(cnrV2) + require.NoError(t, err) +} From c4f7be19ea14c056ff92a80bc737cd104148677c Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 24 Dec 2020 12:51:59 +0300 Subject: [PATCH 0631/1196] [#194] pkg/client: Verify container format in GetContainer method Make Client.GetContainer method to return an error if received container structure does not meet NeoFS API specification. Signed-off-by: Leonard Lyubich --- pkg/client/container.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/client/container.go b/pkg/client/container.go index d28bec7..29b9871 100644 --- a/pkg/client/container.go +++ b/pkg/client/container.go @@ -55,6 +55,9 @@ func (c Client) PutContainer(ctx context.Context, cnr *container.Container, opts } } +// GetContainer receives container structure through NeoFS API call. +// +// Returns error if container structure is received but does not meet NeoFS API specification. func (c Client) GetContainer(ctx context.Context, id *container.ID, opts ...CallOption) (*container.Container, error) { switch c.remoteNode.Version.Major() { case 2: @@ -259,7 +262,7 @@ func (c Client) getContainerV2(ctx context.Context, id *container.ID, opts ...Ca return nil, errors.Wrap(err, "can't verify response message") } - return container.NewContainerFromV2(resp.GetBody().GetContainer()), nil + return container.NewVerifiedFromV2(resp.GetBody().GetContainer()) default: return nil, errUnsupportedProtocol } From 6f7f6da042a1e89da88f57139d139130ad959710 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 24 Dec 2020 14:47:45 +0300 Subject: [PATCH 0632/1196] Update changelog for release v1.21.2 Signed-off-by: Leonard Lyubich --- CHANGELOG.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 21634d5..793be7a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,25 @@ # Changelog +## [1.21.2] - 2020-12-24 + +### Added + +- `Container.NonceUUID` getter of container nonce in UUID format. +- `Container.SetNonceUUID` setter of container nonce in UUID format. +- `NewVerifiedContainerFromV2` container constructor that preliminary + checks if container message argument meets NeoFS API V2 specification. + +### Changed + +- `Container.Nonce`/`Container.SetNonce` marked as deprecated. +- `Client.GetContainer` method returns an error if received + container does not meet NeoFS API specification. + +### Fixed + +- `pkg.SDKVersion` to return version with minor `1`. +- `pkg.IsSupportedVersion` to consider `2.1` as supported. + ## [1.21.1] - 2020-12-18 Support neofs-api v2.1.1. @@ -467,3 +487,4 @@ Initial public release [1.20.3]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.20.2...v1.20.3 [1.21.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.20.3...v1.21.0 [1.21.1]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.21.0...v1.21.1 +[1.21.2]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.21.1...v1.21.2 From b2528d4c59eb9baa58f0f64e7576693a9f42f525 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 17 Dec 2020 13:02:58 +0300 Subject: [PATCH 0633/1196] Recompile protobuf files with neofs-api yeouido Signed-off-by: Leonard Lyubich --- v2/object/grpc/types.pb.go | 266 ++++++++++++++++++++----------------- 1 file changed, 147 insertions(+), 119 deletions(-) diff --git a/v2/object/grpc/types.pb.go b/v2/object/grpc/types.pb.go index 2f900b8..1109640 100644 --- a/v2/object/grpc/types.pb.go +++ b/v2/object/grpc/types.pb.go @@ -155,6 +155,10 @@ type ShortHeader struct { // Size of payload in bytes. // `0xFFFFFFFFFFFFFFFF` means `payload_length` is unknown PayloadLength uint64 `protobuf:"varint,5,opt,name=payload_length,json=payloadLength,proto3" json:"payload_length,omitempty"` + // Hash of payload bytes + PayloadHash *grpc.Checksum `protobuf:"bytes,6,opt,name=payload_hash,json=payloadHash,proto3" json:"payload_hash,omitempty"` + // Homomorphic hash of the object payload + HomomorphicHash *grpc.Checksum `protobuf:"bytes,7,opt,name=homomorphic_hash,json=homomorphicHash,proto3" json:"homomorphic_hash,omitempty"` } func (x *ShortHeader) Reset() { @@ -224,6 +228,20 @@ func (x *ShortHeader) GetPayloadLength() uint64 { return 0 } +func (x *ShortHeader) GetPayloadHash() *grpc.Checksum { + if x != nil { + return x.PayloadHash + } + return nil +} + +func (x *ShortHeader) GetHomomorphicHash() *grpc.Checksum { + if x != nil { + return x.HomomorphicHash + } + return nil +} + // Object Header type Header struct { state protoimpl.MessageState @@ -708,7 +726,7 @@ var file_v2_object_grpc_types_proto_rawDesc = []byte{ 0x76, 0x32, 0x2f, 0x72, 0x65, 0x66, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x76, 0x32, 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, 0x81, 0x02, 0x0a, 0x0b, 0x53, 0x68, 0x6f, 0x72, 0x74, 0x48, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x83, 0x03, 0x0a, 0x0b, 0x53, 0x68, 0x6f, 0x72, 0x74, 0x48, 0x65, 0x61, 0x64, 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, @@ -724,105 +742,113 @@ var file_v2_object_grpc_types_proto_rawDesc = []byte{ 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x52, 0x0a, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x25, 0x0a, 0x0e, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0d, 0x70, 0x61, 0x79, 0x6c, - 0x6f, 0x61, 0x64, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xfb, 0x07, 0x0a, 0x06, 0x48, 0x65, - 0x61, 0x64, 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, 0x3e, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x61, - 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, - 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, - 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, - 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x12, 0x32, 0x0a, 0x08, 0x6f, 0x77, 0x6e, 0x65, 0x72, - 0x5f, 0x69, 0x64, 0x18, 0x03, 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, 0x25, 0x0a, 0x0e, 0x63, - 0x72, 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x18, 0x04, 0x20, - 0x01, 0x28, 0x04, 0x52, 0x0d, 0x63, 0x72, 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x70, 0x6f, - 0x63, 0x68, 0x12, 0x25, 0x0a, 0x0e, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x5f, 0x6c, 0x65, - 0x6e, 0x67, 0x74, 0x68, 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0d, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x3b, 0x0a, 0x0c, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x52, 0x0b, 0x70, 0x61, 0x79, 0x6c, 0x6f, - 0x61, 0x64, 0x48, 0x61, 0x73, 0x68, 0x12, 0x3d, 0x0a, 0x0b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, - 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1c, 0x2e, 0x6e, 0x65, - 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x4f, - 0x62, 0x6a, 0x65, 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x52, 0x0a, 0x6f, 0x62, 0x6a, 0x65, 0x63, - 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x43, 0x0a, 0x10, 0x68, 0x6f, 0x6d, 0x6f, 0x6d, 0x6f, 0x72, - 0x70, 0x68, 0x69, 0x63, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x61, 0x64, 0x48, 0x61, 0x73, 0x68, 0x12, 0x43, 0x0a, 0x10, 0x68, 0x6f, 0x6d, 0x6f, 0x6d, 0x6f, + 0x72, 0x70, 0x68, 0x69, 0x63, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, + 0x73, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x52, 0x0f, 0x68, 0x6f, 0x6d, 0x6f, + 0x6d, 0x6f, 0x72, 0x70, 0x68, 0x69, 0x63, 0x48, 0x61, 0x73, 0x68, 0x22, 0xfb, 0x07, 0x0a, 0x06, + 0x48, 0x65, 0x61, 0x64, 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, 0x3e, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, + 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, + 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x52, 0x0b, 0x63, 0x6f, + 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x12, 0x32, 0x0a, 0x08, 0x6f, 0x77, 0x6e, + 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x03, 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, 0x25, 0x0a, + 0x0e, 0x63, 0x72, 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0d, 0x63, 0x72, 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, + 0x70, 0x6f, 0x63, 0x68, 0x12, 0x25, 0x0a, 0x0e, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x5f, + 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0d, 0x70, 0x61, + 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x3b, 0x0a, 0x0c, 0x70, + 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x06, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, + 0x66, 0x73, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x52, 0x0b, 0x70, 0x61, 0x79, + 0x6c, 0x6f, 0x61, 0x64, 0x48, 0x61, 0x73, 0x68, 0x12, 0x3d, 0x0a, 0x0b, 0x6f, 0x62, 0x6a, 0x65, + 0x63, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1c, 0x2e, + 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, + 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x52, 0x0a, 0x6f, 0x62, 0x6a, + 0x65, 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x43, 0x0a, 0x10, 0x68, 0x6f, 0x6d, 0x6f, 0x6d, + 0x6f, 0x72, 0x70, 0x68, 0x69, 0x63, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x08, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, + 0x66, 0x73, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x52, 0x0f, 0x68, 0x6f, 0x6d, + 0x6f, 0x6d, 0x6f, 0x72, 0x70, 0x68, 0x69, 0x63, 0x48, 0x61, 0x73, 0x68, 0x12, 0x44, 0x0a, 0x0d, + 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x09, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, + 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x54, + 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x0c, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x6f, 0x6b, + 0x65, 0x6e, 0x12, 0x42, 0x0a, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, + 0x18, 0x0a, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, + 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 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, 0x34, 0x0a, 0x05, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x18, + 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x2e, + 0x53, 0x70, 0x6c, 0x69, 0x74, 0x52, 0x05, 0x73, 0x70, 0x6c, 0x69, 0x74, 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, 0x1a, 0xc5, 0x02, 0x0a, 0x05, 0x53, 0x70, 0x6c, 0x69, 0x74, 0x12, 0x30, 0x0a, 0x06, 0x70, + 0x61, 0x72, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 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, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x12, 0x34, 0x0a, + 0x08, 0x70, 0x72, 0x65, 0x76, 0x69, 0x6f, 0x75, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, - 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x52, 0x0f, 0x68, 0x6f, 0x6d, 0x6f, 0x6d, - 0x6f, 0x72, 0x70, 0x68, 0x69, 0x63, 0x48, 0x61, 0x73, 0x68, 0x12, 0x44, 0x0a, 0x0d, 0x73, 0x65, - 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x09, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, - 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x6f, 0x6b, - 0x65, 0x6e, 0x52, 0x0c, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, - 0x12, 0x42, 0x0a, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x0a, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, - 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 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, 0x34, 0x0a, 0x05, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x18, 0x0b, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, - 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x2e, 0x53, 0x70, - 0x6c, 0x69, 0x74, 0x52, 0x05, 0x73, 0x70, 0x6c, 0x69, 0x74, 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, 0x1a, - 0xc5, 0x02, 0x0a, 0x05, 0x53, 0x70, 0x6c, 0x69, 0x74, 0x12, 0x30, 0x0a, 0x06, 0x70, 0x61, 0x72, - 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 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, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x12, 0x34, 0x0a, 0x08, 0x70, - 0x72, 0x65, 0x76, 0x69, 0x6f, 0x75, 0x73, 0x18, 0x02, 0x20, 0x01, 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, 0x08, 0x70, 0x72, 0x65, 0x76, 0x69, 0x6f, 0x75, - 0x73, 0x12, 0x44, 0x0a, 0x10, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x73, 0x69, 0x67, 0x6e, - 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, - 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, - 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x0f, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x53, 0x69, - 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x3d, 0x0a, 0x0d, 0x70, 0x61, 0x72, 0x65, 0x6e, - 0x74, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, - 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, - 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0c, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, - 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x34, 0x0a, 0x08, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x72, - 0x65, 0x6e, 0x18, 0x05, 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, 0x08, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x72, 0x65, 0x6e, 0x12, 0x19, 0x0a, 0x08, - 0x73, 0x70, 0x6c, 0x69, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, - 0x73, 0x70, 0x6c, 0x69, 0x74, 0x49, 0x44, 0x22, 0xc4, 0x01, 0x0a, 0x06, 0x4f, 0x62, 0x6a, 0x65, - 0x63, 0x74, 0x12, 0x35, 0x0a, 0x09, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x69, 0x64, 0x18, - 0x01, 0x20, 0x01, 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, - 0x08, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x44, 0x12, 0x37, 0x0a, 0x09, 0x73, 0x69, 0x67, - 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, - 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, - 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, - 0x72, 0x65, 0x12, 0x30, 0x0a, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, - 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x06, 0x68, 0x65, - 0x61, 0x64, 0x65, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x18, - 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x22, 0x8b, - 0x01, 0x0a, 0x09, 0x53, 0x70, 0x6c, 0x69, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x19, 0x0a, 0x08, - 0x73, 0x70, 0x6c, 0x69, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, - 0x73, 0x70, 0x6c, 0x69, 0x74, 0x49, 0x64, 0x12, 0x35, 0x0a, 0x09, 0x6c, 0x61, 0x73, 0x74, 0x5f, - 0x70, 0x61, 0x72, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, + 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x44, 0x52, 0x08, 0x70, 0x72, 0x65, 0x76, 0x69, + 0x6f, 0x75, 0x73, 0x12, 0x44, 0x0a, 0x10, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x73, 0x69, + 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, + 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, + 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x0f, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, + 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x3d, 0x0a, 0x0d, 0x70, 0x61, 0x72, + 0x65, 0x6e, 0x74, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, + 0x65, 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0c, 0x70, 0x61, 0x72, 0x65, + 0x6e, 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x34, 0x0a, 0x08, 0x63, 0x68, 0x69, 0x6c, + 0x64, 0x72, 0x65, 0x6e, 0x18, 0x05, 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, 0x08, 0x6c, 0x61, 0x73, 0x74, 0x50, 0x61, 0x72, 0x74, 0x12, 0x2c, - 0x0a, 0x04, 0x6c, 0x69, 0x6e, 0x6b, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, + 0x63, 0x74, 0x49, 0x44, 0x52, 0x08, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x72, 0x65, 0x6e, 0x12, 0x19, + 0x0a, 0x08, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0c, + 0x52, 0x07, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x49, 0x44, 0x22, 0xc4, 0x01, 0x0a, 0x06, 0x4f, 0x62, + 0x6a, 0x65, 0x63, 0x74, 0x12, 0x35, 0x0a, 0x09, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x69, + 0x64, 0x18, 0x01, 0x20, 0x01, 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, 0x08, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x44, 0x12, 0x37, 0x0a, 0x09, 0x73, + 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, + 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, + 0x74, 0x75, 0x72, 0x65, 0x12, 0x30, 0x0a, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x06, + 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, + 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, + 0x22, 0x8b, 0x01, 0x0a, 0x09, 0x53, 0x70, 0x6c, 0x69, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x19, + 0x0a, 0x08, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, + 0x52, 0x07, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x49, 0x64, 0x12, 0x35, 0x0a, 0x09, 0x6c, 0x61, 0x73, + 0x74, 0x5f, 0x70, 0x61, 0x72, 0x74, 0x18, 0x02, 0x20, 0x01, 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, 0x04, 0x6c, 0x69, 0x6e, 0x6b, 0x2a, 0x3b, 0x0a, 0x0a, - 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x52, 0x45, - 0x47, 0x55, 0x4c, 0x41, 0x52, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x54, 0x4f, 0x4d, 0x42, 0x53, - 0x54, 0x4f, 0x4e, 0x45, 0x10, 0x01, 0x12, 0x11, 0x0a, 0x0d, 0x53, 0x54, 0x4f, 0x52, 0x41, 0x47, - 0x45, 0x5f, 0x47, 0x52, 0x4f, 0x55, 0x50, 0x10, 0x02, 0x2a, 0x39, 0x0a, 0x09, 0x4d, 0x61, 0x74, - 0x63, 0x68, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1a, 0x0a, 0x16, 0x4d, 0x41, 0x54, 0x43, 0x48, 0x5f, - 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, - 0x10, 0x00, 0x12, 0x10, 0x0a, 0x0c, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x5f, 0x45, 0x51, 0x55, - 0x41, 0x4c, 0x10, 0x01, 0x42, 0x4f, 0x5a, 0x37, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, - 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, - 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x6f, 0x62, 0x6a, - 0x65, 0x63, 0x74, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0xaa, - 0x02, 0x13, 0x4e, 0x65, 0x6f, 0x46, 0x53, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x76, 0x32, 0x2e, 0x4f, - 0x62, 0x6a, 0x65, 0x63, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6a, 0x65, 0x63, 0x74, 0x49, 0x44, 0x52, 0x08, 0x6c, 0x61, 0x73, 0x74, 0x50, 0x61, 0x72, 0x74, + 0x12, 0x2c, 0x0a, 0x04, 0x6c, 0x69, 0x6e, 0x6b, 0x18, 0x03, 0x20, 0x01, 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, 0x04, 0x6c, 0x69, 0x6e, 0x6b, 0x2a, 0x3b, + 0x0a, 0x0a, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0b, 0x0a, 0x07, + 0x52, 0x45, 0x47, 0x55, 0x4c, 0x41, 0x52, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x54, 0x4f, 0x4d, + 0x42, 0x53, 0x54, 0x4f, 0x4e, 0x45, 0x10, 0x01, 0x12, 0x11, 0x0a, 0x0d, 0x53, 0x54, 0x4f, 0x52, + 0x41, 0x47, 0x45, 0x5f, 0x47, 0x52, 0x4f, 0x55, 0x50, 0x10, 0x02, 0x2a, 0x39, 0x0a, 0x09, 0x4d, + 0x61, 0x74, 0x63, 0x68, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1a, 0x0a, 0x16, 0x4d, 0x41, 0x54, 0x43, + 0x48, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, + 0x45, 0x44, 0x10, 0x00, 0x12, 0x10, 0x0a, 0x0c, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x5f, 0x45, + 0x51, 0x55, 0x41, 0x4c, 0x10, 0x01, 0x42, 0x4f, 0x5a, 0x37, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, + 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, + 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x6f, + 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x6f, 0x62, 0x6a, 0x65, 0x63, + 0x74, 0xaa, 0x02, 0x13, 0x4e, 0x65, 0x6f, 0x46, 0x53, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x76, 0x32, + 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -850,8 +876,8 @@ var file_v2_object_grpc_types_proto_goTypes = []interface{}{ (*Header_Split)(nil), // 7: neo.fs.v2.object.Header.Split (*grpc.Version)(nil), // 8: neo.fs.v2.refs.Version (*grpc.OwnerID)(nil), // 9: neo.fs.v2.refs.OwnerID - (*grpc.ContainerID)(nil), // 10: neo.fs.v2.refs.ContainerID - (*grpc.Checksum)(nil), // 11: neo.fs.v2.refs.Checksum + (*grpc.Checksum)(nil), // 10: neo.fs.v2.refs.Checksum + (*grpc.ContainerID)(nil), // 11: neo.fs.v2.refs.ContainerID (*grpc1.SessionToken)(nil), // 12: neo.fs.v2.session.SessionToken (*grpc.ObjectID)(nil), // 13: neo.fs.v2.refs.ObjectID (*grpc.Signature)(nil), // 14: neo.fs.v2.refs.Signature @@ -860,30 +886,32 @@ var file_v2_object_grpc_types_proto_depIdxs = []int32{ 8, // 0: neo.fs.v2.object.ShortHeader.version:type_name -> neo.fs.v2.refs.Version 9, // 1: neo.fs.v2.object.ShortHeader.owner_id:type_name -> neo.fs.v2.refs.OwnerID 0, // 2: neo.fs.v2.object.ShortHeader.object_type:type_name -> neo.fs.v2.object.ObjectType - 8, // 3: neo.fs.v2.object.Header.version:type_name -> neo.fs.v2.refs.Version - 10, // 4: neo.fs.v2.object.Header.container_id:type_name -> neo.fs.v2.refs.ContainerID - 9, // 5: neo.fs.v2.object.Header.owner_id:type_name -> neo.fs.v2.refs.OwnerID - 11, // 6: neo.fs.v2.object.Header.payload_hash:type_name -> neo.fs.v2.refs.Checksum - 0, // 7: neo.fs.v2.object.Header.object_type:type_name -> neo.fs.v2.object.ObjectType - 11, // 8: neo.fs.v2.object.Header.homomorphic_hash:type_name -> neo.fs.v2.refs.Checksum - 12, // 9: neo.fs.v2.object.Header.session_token:type_name -> neo.fs.v2.session.SessionToken - 6, // 10: neo.fs.v2.object.Header.attributes:type_name -> neo.fs.v2.object.Header.Attribute - 7, // 11: neo.fs.v2.object.Header.split:type_name -> neo.fs.v2.object.Header.Split - 13, // 12: neo.fs.v2.object.Object.object_id:type_name -> neo.fs.v2.refs.ObjectID - 14, // 13: neo.fs.v2.object.Object.signature:type_name -> neo.fs.v2.refs.Signature - 3, // 14: neo.fs.v2.object.Object.header:type_name -> neo.fs.v2.object.Header - 13, // 15: neo.fs.v2.object.SplitInfo.last_part:type_name -> neo.fs.v2.refs.ObjectID - 13, // 16: neo.fs.v2.object.SplitInfo.link:type_name -> neo.fs.v2.refs.ObjectID - 13, // 17: neo.fs.v2.object.Header.Split.parent:type_name -> neo.fs.v2.refs.ObjectID - 13, // 18: neo.fs.v2.object.Header.Split.previous:type_name -> neo.fs.v2.refs.ObjectID - 14, // 19: neo.fs.v2.object.Header.Split.parent_signature:type_name -> neo.fs.v2.refs.Signature - 3, // 20: neo.fs.v2.object.Header.Split.parent_header:type_name -> neo.fs.v2.object.Header - 13, // 21: neo.fs.v2.object.Header.Split.children:type_name -> neo.fs.v2.refs.ObjectID - 22, // [22:22] is the sub-list for method output_type - 22, // [22:22] is the sub-list for method input_type - 22, // [22:22] is the sub-list for extension type_name - 22, // [22:22] is the sub-list for extension extendee - 0, // [0:22] is the sub-list for field type_name + 10, // 3: neo.fs.v2.object.ShortHeader.payload_hash:type_name -> neo.fs.v2.refs.Checksum + 10, // 4: neo.fs.v2.object.ShortHeader.homomorphic_hash:type_name -> neo.fs.v2.refs.Checksum + 8, // 5: neo.fs.v2.object.Header.version:type_name -> neo.fs.v2.refs.Version + 11, // 6: neo.fs.v2.object.Header.container_id:type_name -> neo.fs.v2.refs.ContainerID + 9, // 7: neo.fs.v2.object.Header.owner_id:type_name -> neo.fs.v2.refs.OwnerID + 10, // 8: neo.fs.v2.object.Header.payload_hash:type_name -> neo.fs.v2.refs.Checksum + 0, // 9: neo.fs.v2.object.Header.object_type:type_name -> neo.fs.v2.object.ObjectType + 10, // 10: neo.fs.v2.object.Header.homomorphic_hash:type_name -> neo.fs.v2.refs.Checksum + 12, // 11: neo.fs.v2.object.Header.session_token:type_name -> neo.fs.v2.session.SessionToken + 6, // 12: neo.fs.v2.object.Header.attributes:type_name -> neo.fs.v2.object.Header.Attribute + 7, // 13: neo.fs.v2.object.Header.split:type_name -> neo.fs.v2.object.Header.Split + 13, // 14: neo.fs.v2.object.Object.object_id:type_name -> neo.fs.v2.refs.ObjectID + 14, // 15: neo.fs.v2.object.Object.signature:type_name -> neo.fs.v2.refs.Signature + 3, // 16: neo.fs.v2.object.Object.header:type_name -> neo.fs.v2.object.Header + 13, // 17: neo.fs.v2.object.SplitInfo.last_part:type_name -> neo.fs.v2.refs.ObjectID + 13, // 18: neo.fs.v2.object.SplitInfo.link:type_name -> neo.fs.v2.refs.ObjectID + 13, // 19: neo.fs.v2.object.Header.Split.parent:type_name -> neo.fs.v2.refs.ObjectID + 13, // 20: neo.fs.v2.object.Header.Split.previous:type_name -> neo.fs.v2.refs.ObjectID + 14, // 21: neo.fs.v2.object.Header.Split.parent_signature:type_name -> neo.fs.v2.refs.Signature + 3, // 22: neo.fs.v2.object.Header.Split.parent_header:type_name -> neo.fs.v2.object.Header + 13, // 23: neo.fs.v2.object.Header.Split.children:type_name -> neo.fs.v2.refs.ObjectID + 24, // [24:24] is the sub-list for method output_type + 24, // [24:24] is the sub-list for method input_type + 24, // [24:24] is the sub-list for extension type_name + 24, // [24:24] is the sub-list for extension extendee + 0, // [0:24] is the sub-list for field type_name } func init() { file_v2_object_grpc_types_proto_init() } From 8fe135ab8c3ac1bd878a597d3d56383b1d242be1 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 17 Dec 2020 13:18:07 +0300 Subject: [PATCH 0634/1196] [#229] v2/object: Add hash fields to ShortHeader message Signed-off-by: Leonard Lyubich --- v2/object/convert.go | 16 ++++++++++++++++ v2/object/grpc/types.go | 14 ++++++++++++++ v2/object/marshal.go | 20 +++++++++++++++++++- v2/object/marshal_test.go | 2 ++ v2/object/types.go | 30 ++++++++++++++++++++++++++++++ 5 files changed, 81 insertions(+), 1 deletion(-) diff --git a/v2/object/convert.go b/v2/object/convert.go index f9d5a06..84ae218 100644 --- a/v2/object/convert.go +++ b/v2/object/convert.go @@ -48,6 +48,14 @@ func ShortHeaderToGRPCMessage(h *ShortHeader) *object.ShortHeader { m.SetPayloadLength(h.GetPayloadLength()) + m.SetPayloadHash( + refs.ChecksumToGRPCMessage(h.GetPayloadHash()), + ) + + m.SetHomomorphicHash( + refs.ChecksumToGRPCMessage(h.GetHomomorphicHash()), + ) + return m } @@ -74,6 +82,14 @@ func ShortHeaderFromGRPCMessage(m *object.ShortHeader) *ShortHeader { h.SetPayloadLength(m.GetPayloadLength()) + h.SetPayloadHash( + refs.ChecksumFromGRPCMessage(m.GetPayloadHash()), + ) + + h.SetHomomorphicHash( + refs.ChecksumFromGRPCMessage(m.GetHomomorphicHash()), + ) + return h } diff --git a/v2/object/grpc/types.go b/v2/object/grpc/types.go index df1151a..9d86393 100644 --- a/v2/object/grpc/types.go +++ b/v2/object/grpc/types.go @@ -201,6 +201,20 @@ func (m *ShortHeader) SetPayloadLength(v uint64) { } } +// SetPayloadHash sets hash of the object payload. +func (m *ShortHeader) SetPayloadHash(v *refs.Checksum) { + if m != nil { + m.PayloadHash = v + } +} + +// SetHomomorphicHash sets homomorphic hash of the object payload. +func (m *ShortHeader) SetHomomorphicHash(v *refs.Checksum) { + if m != nil { + m.HomomorphicHash = v + } +} + // SetSplitId sets id of split hierarchy. func (m *SplitInfo) SetSplitId(v []byte) { if m != nil { diff --git a/v2/object/marshal.go b/v2/object/marshal.go index f08c71d..c321ed3 100644 --- a/v2/object/marshal.go +++ b/v2/object/marshal.go @@ -12,6 +12,8 @@ const ( shortHdrOwnerField = 3 shortHdrObjectTypeField = 4 shortHdrPayloadLength = 5 + shortHdrHashField = 6 + shortHdrHomoHashField = 7 attributeKeyField = 1 attributeValueField = 2 @@ -151,7 +153,21 @@ func (h *ShortHeader) StableMarshal(buf []byte) ([]byte, error) { offset += n - _, err = proto.UInt64Marshal(shortHdrPayloadLength, buf[offset:], h.payloadLen) + n, err = proto.UInt64Marshal(shortHdrPayloadLength, buf[offset:], h.payloadLen) + if err != nil { + return nil, err + } + + offset += n + + n, err = proto.NestedStructureMarshal(shortHdrHashField, buf[offset:], h.payloadHash) + if err != nil { + return nil, err + } + + offset += n + + n, err = proto.NestedStructureMarshal(shortHdrHomoHashField, buf[offset:], h.homoHash) if err != nil { return nil, err } @@ -169,6 +185,8 @@ func (h *ShortHeader) StableSize() (size int) { size += proto.NestedStructureSize(shortHdrOwnerField, h.ownerID) size += proto.EnumSize(shortHdrObjectTypeField, int32(h.typ)) size += proto.UInt64Size(shortHdrPayloadLength, h.payloadLen) + size += proto.NestedStructureSize(shortHdrHashField, h.payloadHash) + size += proto.NestedStructureSize(shortHdrHomoHashField, h.homoHash) return size } diff --git a/v2/object/marshal_test.go b/v2/object/marshal_test.go index cafe099..c2686dc 100644 --- a/v2/object/marshal_test.go +++ b/v2/object/marshal_test.go @@ -476,6 +476,8 @@ func generateShortHeader(id string) *object.ShortHeader { hdr.SetCreationEpoch(200) hdr.SetObjectType(object.TypeRegular) hdr.SetPayloadLength(10) + hdr.SetPayloadHash(generateChecksum("payload hash")) + hdr.SetHomomorphicHash(generateChecksum("homomorphic hash")) return hdr } diff --git a/v2/object/types.go b/v2/object/types.go index d192715..3c258eb 100644 --- a/v2/object/types.go +++ b/v2/object/types.go @@ -19,6 +19,8 @@ type ShortHeader struct { typ Type payloadLen uint64 + + payloadHash, homoHash *refs.Checksum } type Attribute struct { @@ -296,6 +298,34 @@ func (h *ShortHeader) SetPayloadLength(v uint64) { } } +func (h *ShortHeader) GetPayloadHash() *refs.Checksum { + if h != nil { + return h.payloadHash + } + + return nil +} + +func (h *ShortHeader) SetPayloadHash(v *refs.Checksum) { + if h != nil { + h.payloadHash = v + } +} + +func (h *ShortHeader) GetHomomorphicHash() *refs.Checksum { + if h != nil { + return h.homoHash + } + + return nil +} + +func (h *ShortHeader) SetHomomorphicHash(v *refs.Checksum) { + if h != nil { + h.homoHash = v + } +} + func (h *ShortHeader) getHeaderPart() {} func (a *Attribute) GetKey() string { From 37e2cab93b3e5619329d8237e17a88f9462318e1 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 17 Dec 2020 13:20:29 +0300 Subject: [PATCH 0635/1196] [#229] pkg/client: Set hash fields to result of short HEAD operation Signed-off-by: Leonard Lyubich --- pkg/client/object.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkg/client/object.go b/pkg/client/object.go index a96f2f2..cd6dbb4 100644 --- a/pkg/client/object.go +++ b/pkg/client/object.go @@ -730,6 +730,8 @@ func (c *Client) getObjectHeaderV2(ctx context.Context, p *ObjectHeaderParams, o hdr.SetOwnerID(h.GetOwnerID()) hdr.SetObjectType(h.GetObjectType()) hdr.SetCreationEpoch(h.GetCreationEpoch()) + hdr.SetPayloadHash(h.GetPayloadHash()) + hdr.SetHomomorphicHash(h.GetHomomorphicHash()) case *v2object.HeaderWithSignature: if p.short { return nil, errors.Errorf("wrong header part type: expected %T, received %T", From 6861de042b0275040154dae3718e97da6544b01e Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 17 Dec 2020 17:37:58 +0300 Subject: [PATCH 0636/1196] [#230] pkg: Implement storage group type with basic methods Signed-off-by: Leonard Lyubich --- pkg/storagegroup/storagegroup.go | 147 ++++++++++++++++++++++++++ pkg/storagegroup/storagegroup_test.go | 79 ++++++++++++++ 2 files changed, 226 insertions(+) create mode 100644 pkg/storagegroup/storagegroup.go create mode 100644 pkg/storagegroup/storagegroup_test.go diff --git a/pkg/storagegroup/storagegroup.go b/pkg/storagegroup/storagegroup.go new file mode 100644 index 0000000..0ae52ab --- /dev/null +++ b/pkg/storagegroup/storagegroup.go @@ -0,0 +1,147 @@ +package storagegroup + +import ( + "github.com/nspcc-dev/neofs-api-go/pkg" + "github.com/nspcc-dev/neofs-api-go/pkg/object" + "github.com/nspcc-dev/neofs-api-go/v2/refs" + "github.com/nspcc-dev/neofs-api-go/v2/storagegroup" +) + +// StorageGroup represents v2-compatible storage group. +type StorageGroup storagegroup.StorageGroup + +// NewFromV2 wraps v2 StorageGroup message to StorageGroup. +func NewFromV2(aV2 *storagegroup.StorageGroup) *StorageGroup { + return (*StorageGroup)(aV2) +} + +// New creates and initializes blank StorageGroup. +func New() *StorageGroup { + return NewFromV2(new(storagegroup.StorageGroup)) +} + +// ValidationDataSize returns total size of the payloads +// of objects in the storage group +func (sg *StorageGroup) ValidationDataSize() uint64 { + return (*storagegroup.StorageGroup)(sg). + GetValidationDataSize() +} + +// SetValidationDataSize sets total size of the payloads +// of objects in the storage group. +func (sg *StorageGroup) SetValidationDataSize(epoch uint64) { + (*storagegroup.StorageGroup)(sg). + SetValidationDataSize(epoch) +} + +// ValidationDataHash returns homomorphic hash from the +// concatenation of the payloads of the storage group members. +func (sg *StorageGroup) ValidationDataHash() *pkg.Checksum { + return pkg.NewChecksumFromV2( + (*storagegroup.StorageGroup)(sg). + GetValidationHash(), + ) +} + +// SetValidationDataHash sets homomorphic hash from the +// concatenation of the payloads of the storage group members. +func (sg *StorageGroup) SetValidationDataHash(hash *pkg.Checksum) { + (*storagegroup.StorageGroup)(sg). + SetValidationHash(hash.ToV2()) +} + +// ExpirationEpoch returns last NeoFS epoch number +// of the storage group lifetime. +func (sg *StorageGroup) ExpirationEpoch() uint64 { + return (*storagegroup.StorageGroup)(sg). + GetExpirationEpoch() +} + +// SetExpirationEpoch sets last NeoFS epoch number +// of the storage group lifetime. +func (sg *StorageGroup) SetExpirationEpoch(epoch uint64) { + (*storagegroup.StorageGroup)(sg). + SetExpirationEpoch(epoch) +} + +// Members returns strictly ordered list of +// storage group member objects. +func (sg *StorageGroup) Members() []*object.ID { + mV2 := (*storagegroup.StorageGroup)(sg). + GetMembers() + + if mV2 == nil { + return nil + } + + m := make([]*object.ID, len(mV2)) + + for i := range mV2 { + m[i] = object.NewIDFromV2(mV2[i]) + } + + return m +} + +// SetMembers sets strictly ordered list of +// storage group member objects. +func (sg *StorageGroup) SetMembers(members []*object.ID) { + mV2 := (*storagegroup.StorageGroup)(sg). + GetMembers() + + if members == nil { + mV2 = nil + } else { + ln := len(members) + + if cap(mV2) >= ln { + mV2 = mV2[:0] + } else { + mV2 = make([]*refs.ObjectID, 0, ln) + } + + for i := 0; i < ln; i++ { + mV2 = append(mV2, members[i].ToV2()) + } + } + + (*storagegroup.StorageGroup)(sg). + SetMembers(mV2) +} + +// ToV2 converts StorageGroup to v2 StorageGroup message. +func (sg *StorageGroup) ToV2() *storagegroup.StorageGroup { + return (*storagegroup.StorageGroup)(sg) +} + +// Marshal marshals StorageGroup into a protobuf binary form. +// +// Buffer is allocated when the argument is empty. +// Otherwise, the first buffer is used. +func (sg *StorageGroup) Marshal(b ...[]byte) ([]byte, error) { + var buf []byte + if len(b) > 0 { + buf = b[0] + } + + return (*storagegroup.StorageGroup)(sg). + StableMarshal(buf) +} + +// Unmarshal unmarshals protobuf binary representation of StorageGroup. +func (sg *StorageGroup) Unmarshal(data []byte) error { + return (*storagegroup.StorageGroup)(sg). + Unmarshal(data) +} + +// MarshalJSON encodes StorageGroup to protobuf JSON format. +func (sg *StorageGroup) MarshalJSON() ([]byte, error) { + return (*storagegroup.StorageGroup)(sg). + MarshalJSON() +} + +// UnmarshalJSON decodes StorageGroup from protobuf JSON format. +func (sg *StorageGroup) UnmarshalJSON(data []byte) error { + return (*storagegroup.StorageGroup)(sg). + UnmarshalJSON(data) +} diff --git a/pkg/storagegroup/storagegroup_test.go b/pkg/storagegroup/storagegroup_test.go new file mode 100644 index 0000000..027c0f6 --- /dev/null +++ b/pkg/storagegroup/storagegroup_test.go @@ -0,0 +1,79 @@ +package storagegroup_test + +import ( + "crypto/rand" + "crypto/sha256" + "testing" + + "github.com/nspcc-dev/neofs-api-go/pkg" + "github.com/nspcc-dev/neofs-api-go/pkg/object" + "github.com/nspcc-dev/neofs-api-go/pkg/storagegroup" + "github.com/stretchr/testify/require" +) + +func testSHA256() (cs [sha256.Size]byte) { + _, _ = rand.Read(cs[:]) + return +} + +func testChecksum() *pkg.Checksum { + h := pkg.NewChecksum() + h.SetSHA256(testSHA256()) + + return h +} + +func testOID() *object.ID { + id := object.NewID() + id.SetSHA256(testSHA256()) + + return id +} + +func TestStorageGroup(t *testing.T) { + sg := storagegroup.New() + + sz := uint64(13) + sg.SetValidationDataSize(sz) + require.Equal(t, sz, sg.ValidationDataSize()) + + cs := testChecksum() + sg.SetValidationDataHash(cs) + require.Equal(t, cs, sg.ValidationDataHash()) + + exp := uint64(33) + sg.SetExpirationEpoch(exp) + require.Equal(t, exp, sg.ExpirationEpoch()) + + members := []*object.ID{testOID(), testOID()} + sg.SetMembers(members) + require.Equal(t, members, sg.Members()) +} + +func TestStorageGroupEncoding(t *testing.T) { + sg := storagegroup.New() + sg.SetValidationDataSize(13) + sg.SetValidationDataHash(testChecksum()) + sg.SetExpirationEpoch(33) + sg.SetMembers([]*object.ID{testOID(), testOID()}) + + t.Run("binary", func(t *testing.T) { + data, err := sg.Marshal() + require.NoError(t, err) + + sg2 := storagegroup.New() + require.NoError(t, sg2.Unmarshal(data)) + + require.Equal(t, sg, sg2) + }) + + t.Run("json", func(t *testing.T) { + data, err := sg.MarshalJSON() + require.NoError(t, err) + + sg2 := storagegroup.New() + require.NoError(t, sg2.UnmarshalJSON(data)) + + require.Equal(t, sg, sg2) + }) +} From 0f040875433d51b28bb78ede9e9690a4f869f0fb Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 17 Dec 2020 18:25:17 +0300 Subject: [PATCH 0637/1196] [#230] pkg: Implement string encode/decode methods on Checksum Signed-off-by: Leonard Lyubich --- pkg/checksum.go | 34 ++++++++++++++++++++++++++++++++++ pkg/checksum_test.go | 8 ++++++++ 2 files changed, 42 insertions(+) diff --git a/pkg/checksum.go b/pkg/checksum.go index 72087a7..c03071f 100644 --- a/pkg/checksum.go +++ b/pkg/checksum.go @@ -3,8 +3,10 @@ package pkg import ( "bytes" "crypto/sha256" + "encoding/hex" "github.com/nspcc-dev/neofs-api-go/v2/refs" + "github.com/pkg/errors" ) // Checksum represents v2-compatible checksum. @@ -109,3 +111,35 @@ func (c *Checksum) UnmarshalJSON(data []byte) error { return (*refs.Checksum)(c). UnmarshalJSON(data) } + +func (c *Checksum) String() string { + return hex.EncodeToString( + (*refs.Checksum)(c). + GetSum(), + ) +} + +// Parse parses Checksum from its string representation. +func (c *Checksum) Parse(s string) error { + data, err := hex.DecodeString(s) + if err != nil { + return err + } + + var typ refs.ChecksumType + + switch ln := len(data); ln { + default: + return errors.Errorf("unsupported checksum length %d", ln) + case sha256.Size: + typ = refs.SHA256 + case 64: + typ = refs.TillichZemor + } + + cV2 := (*refs.Checksum)(c) + cV2.SetType(typ) + cV2.SetSum(data) + + return nil +} diff --git a/pkg/checksum_test.go b/pkg/checksum_test.go index 41cc9d3..e636f40 100644 --- a/pkg/checksum_test.go +++ b/pkg/checksum_test.go @@ -90,4 +90,12 @@ func TestChecksumEncoding(t *testing.T) { require.Equal(t, cs, cs2) }) + + t.Run("string", func(t *testing.T) { + cs2 := NewChecksum() + + require.NoError(t, cs2.Parse(cs.String())) + + require.Equal(t, cs, cs2) + }) } From 53e275676275a717404893a1525907ba8f54e698 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 17 Dec 2020 18:46:19 +0300 Subject: [PATCH 0638/1196] [#231] object: Implement string encode/decode methods on Type Signed-off-by: Leonard Lyubich --- pkg/object/type.go | 11 +++++++++++ pkg/object/type_test.go | 10 ++++++++++ v2/object/string.go | 29 +++++++++++++++++++++++++++++ 3 files changed, 50 insertions(+) create mode 100644 v2/object/string.go diff --git a/pkg/object/type.go b/pkg/object/type.go index afcbdf2..fde1aaa 100644 --- a/pkg/object/type.go +++ b/pkg/object/type.go @@ -33,3 +33,14 @@ func TypeFromV2(t object.Type) Type { return TypeRegular } } + +func (t Type) String() string { + return t.ToV2().String() +} + +// TypeFromString parses Type from its string representation. +func TypeFromString(s string) Type { + return TypeFromV2( + object.TypeFromString(s), + ) +} diff --git a/pkg/object/type_test.go b/pkg/object/type_test.go index 82f8bf2..7ade2ef 100644 --- a/pkg/object/type_test.go +++ b/pkg/object/type_test.go @@ -34,3 +34,13 @@ func TestType_ToV2(t *testing.T) { require.Equal(t, item.t, TypeFromV2(item.t2)) } } + +func TestType_String(t *testing.T) { + for _, typ := range []Type{ + TypeRegular, + TypeTombstone, + TypeStorageGroup, + } { + require.Equal(t, typ, TypeFromString(typ.String())) + } +} diff --git a/v2/object/string.go b/v2/object/string.go new file mode 100644 index 0000000..ad82a12 --- /dev/null +++ b/v2/object/string.go @@ -0,0 +1,29 @@ +package object + +const ( + typeRegularString = "Regular" + typeTombstoneString = "Tombstone" + typeStorageGroupString = "StorageGroup" +) + +func (t Type) String() string { + switch t { + default: + return typeRegularString + case TypeTombstone: + return typeTombstoneString + case TypeStorageGroup: + return typeStorageGroupString + } +} + +func TypeFromString(s string) Type { + switch s { + default: + return TypeRegular + case typeTombstoneString: + return TypeTombstone + case typeStorageGroupString: + return TypeStorageGroup + } +} From f0ebe80a78e3a6ced9969e46bab936fd64544af9 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 17 Dec 2020 18:48:09 +0300 Subject: [PATCH 0639/1196] [#231] object/search: Implement method to add search filter by type Signed-off-by: Leonard Lyubich --- pkg/object/search.go | 5 +++++ pkg/object/search_test.go | 17 +++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/pkg/object/search.go b/pkg/object/search.go index d23b3df..5d59e1a 100644 --- a/pkg/object/search.go +++ b/pkg/object/search.go @@ -240,3 +240,8 @@ func (f *SearchFilters) AddObjectIDFilter(m SearchMatchType, id *ID) { func (f *SearchFilters) AddSplitIDFilter(m SearchMatchType, id *SplitID) { f.addReservedFilter(m, fKeySplitID, id) } + +// AddTypeFilter adds filter by object type. +func (f *SearchFilters) AddTypeFilter(m SearchMatchType, typ Type) { + f.addReservedFilter(m, fKeyType, typ) +} diff --git a/pkg/object/search_test.go b/pkg/object/search_test.go index f477f4f..82a06d3 100644 --- a/pkg/object/search_test.go +++ b/pkg/object/search_test.go @@ -140,3 +140,20 @@ func TestSearchFilters_AddSplitIDFilter(t *testing.T) { require.Equal(t, v2object.MatchStringEqual, fsV2[0].GetMatchType()) }) } + +func TestSearchFilters_AddTypeFilter(t *testing.T) { + typ := object.TypeTombstone + + fs := new(object.SearchFilters) + fs.AddTypeFilter(object.MatchStringEqual, typ) + + t.Run("v2", func(t *testing.T) { + fsV2 := fs.ToV2() + + require.Len(t, fsV2, 1) + + require.Equal(t, v2object.FilterHeaderObjectType, fsV2[0].GetKey()) + require.Equal(t, typ.String(), fsV2[0].GetValue()) + require.Equal(t, v2object.MatchStringEqual, fsV2[0].GetMatchType()) + }) +} From eaa99af2b2c9852710a275300427a4e6b82adb5c Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 17 Dec 2020 13:02:58 +0300 Subject: [PATCH 0640/1196] Recompile protobuf files with neofs-api yeouido Signed-off-by: Leonard Lyubich --- v2/audit/grpc/types.pb.go | 268 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 268 insertions(+) create mode 100644 v2/audit/grpc/types.pb.go diff --git a/v2/audit/grpc/types.pb.go b/v2/audit/grpc/types.pb.go new file mode 100644 index 0000000..10158d4 --- /dev/null +++ b/v2/audit/grpc/types.pb.go @@ -0,0 +1,268 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.23.0 +// protoc v3.14.0 +// source: v2/audit/grpc/types.proto + +package audit + +import ( + proto "github.com/golang/protobuf/proto" + grpc "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// This is a compile-time assertion that a sufficiently up-to-date version +// of the legacy proto package is being used. +const _ = proto.ProtoPackageIsVersion4 + +// DataAuditResult keeps record of conducted Data Audits. The detailed report is +// generated separately. +type DataAuditResult struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Epoch number when the Data Audit was conducted + AuditEpoch uint64 `protobuf:"fixed64,1,opt,name=audit_epoch,json=auditEpoch,proto3" json:"audit_epoch,omitempty"` + // Container under audit + ContainerId *grpc.ContainerID `protobuf:"bytes,2,opt,name=container_id,json=containerID,proto3" json:"container_id,omitempty"` + // Public key of the auditing InnerRing node in a binary format + PublicKey []byte `protobuf:"bytes,3,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"` + // List of Storage Groups that passed audit PoR stage + PassSg []*grpc.ObjectID `protobuf:"bytes,4,rep,name=pass_sg,json=passSG,proto3" json:"pass_sg,omitempty"` + // List of Storage Groups that failed audit PoR stage + FailSg []*grpc.ObjectID `protobuf:"bytes,5,rep,name=fail_sg,json=failSG,proto3" json:"fail_sg,omitempty"` + // Number of sampled objects under audit placed in an optimal way according to + // the containers placement policy when checking PoP + Hit uint32 `protobuf:"varint,6,opt,name=hit,proto3" json:"hit,omitempty"` + // Number of sampled objects under audit placed in suboptimal way according to + // the containers placement policy, but still at a satisfactory level when + // checking PoP + Miss uint32 `protobuf:"varint,7,opt,name=miss,proto3" json:"miss,omitempty"` + // Number of sampled objects under audit stored in a way not confirming + // placement policy or not found at all when checking PoP + Fail uint32 `protobuf:"varint,8,opt,name=fail,proto3" json:"fail,omitempty"` + // List of storage node public keys that passed at least one PDP + PassNodes [][]byte `protobuf:"bytes,9,rep,name=pass_nodes,json=passNodes,proto3" json:"pass_nodes,omitempty"` + // List of storage node public keys that failed at least one PDP + FailNodes [][]byte `protobuf:"bytes,10,rep,name=fail_nodes,json=failNodes,proto3" json:"fail_nodes,omitempty"` +} + +func (x *DataAuditResult) Reset() { + *x = DataAuditResult{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_audit_grpc_types_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DataAuditResult) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DataAuditResult) ProtoMessage() {} + +func (x *DataAuditResult) ProtoReflect() protoreflect.Message { + mi := &file_v2_audit_grpc_types_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DataAuditResult.ProtoReflect.Descriptor instead. +func (*DataAuditResult) Descriptor() ([]byte, []int) { + return file_v2_audit_grpc_types_proto_rawDescGZIP(), []int{0} +} + +func (x *DataAuditResult) GetAuditEpoch() uint64 { + if x != nil { + return x.AuditEpoch + } + return 0 +} + +func (x *DataAuditResult) GetContainerId() *grpc.ContainerID { + if x != nil { + return x.ContainerId + } + return nil +} + +func (x *DataAuditResult) GetPublicKey() []byte { + if x != nil { + return x.PublicKey + } + return nil +} + +func (x *DataAuditResult) GetPassSg() []*grpc.ObjectID { + if x != nil { + return x.PassSg + } + return nil +} + +func (x *DataAuditResult) GetFailSg() []*grpc.ObjectID { + if x != nil { + return x.FailSg + } + return nil +} + +func (x *DataAuditResult) GetHit() uint32 { + if x != nil { + return x.Hit + } + return 0 +} + +func (x *DataAuditResult) GetMiss() uint32 { + if x != nil { + return x.Miss + } + return 0 +} + +func (x *DataAuditResult) GetFail() uint32 { + if x != nil { + return x.Fail + } + return 0 +} + +func (x *DataAuditResult) GetPassNodes() [][]byte { + if x != nil { + return x.PassNodes + } + return nil +} + +func (x *DataAuditResult) GetFailNodes() [][]byte { + if x != nil { + return x.FailNodes + } + return nil +} + +var File_v2_audit_grpc_types_proto protoreflect.FileDescriptor + +var file_v2_audit_grpc_types_proto_rawDesc = []byte{ + 0x0a, 0x19, 0x76, 0x32, 0x2f, 0x61, 0x75, 0x64, 0x69, 0x74, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, + 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0f, 0x6e, 0x65, 0x6f, + 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x75, 0x64, 0x69, 0x74, 0x1a, 0x18, 0x76, 0x32, + 0x2f, 0x72, 0x65, 0x66, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xef, 0x02, 0x0a, 0x0f, 0x44, 0x61, 0x74, 0x61, 0x41, + 0x75, 0x64, 0x69, 0x74, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x61, 0x75, + 0x64, 0x69, 0x74, 0x5f, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x06, 0x52, + 0x0a, 0x61, 0x75, 0x64, 0x69, 0x74, 0x45, 0x70, 0x6f, 0x63, 0x68, 0x12, 0x3e, 0x0a, 0x0c, 0x63, + 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, + 0x66, 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x52, 0x0b, + 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x12, 0x1d, 0x0a, 0x0a, 0x70, + 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, + 0x09, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x12, 0x31, 0x0a, 0x07, 0x70, 0x61, + 0x73, 0x73, 0x5f, 0x73, 0x67, 0x18, 0x04, 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, 0x06, 0x70, 0x61, 0x73, 0x73, 0x53, 0x47, 0x12, 0x31, 0x0a, + 0x07, 0x66, 0x61, 0x69, 0x6c, 0x5f, 0x73, 0x67, 0x18, 0x05, 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, 0x06, 0x66, 0x61, 0x69, 0x6c, 0x53, 0x47, + 0x12, 0x10, 0x0a, 0x03, 0x68, 0x69, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x03, 0x68, + 0x69, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6d, 0x69, 0x73, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0d, + 0x52, 0x04, 0x6d, 0x69, 0x73, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x66, 0x61, 0x69, 0x6c, 0x18, 0x08, + 0x20, 0x01, 0x28, 0x0d, 0x52, 0x04, 0x66, 0x61, 0x69, 0x6c, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x61, + 0x73, 0x73, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x09, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x09, + 0x70, 0x61, 0x73, 0x73, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x66, 0x61, 0x69, + 0x6c, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x09, 0x66, + 0x61, 0x69, 0x6c, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x42, 0x4c, 0x5a, 0x35, 0x67, 0x69, 0x74, 0x68, + 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, + 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, + 0x2f, 0x61, 0x75, 0x64, 0x69, 0x74, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x61, 0x75, 0x64, 0x69, + 0x74, 0xaa, 0x02, 0x12, 0x4e, 0x65, 0x6f, 0x46, 0x53, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x76, 0x32, + 0x2e, 0x41, 0x75, 0x64, 0x69, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_v2_audit_grpc_types_proto_rawDescOnce sync.Once + file_v2_audit_grpc_types_proto_rawDescData = file_v2_audit_grpc_types_proto_rawDesc +) + +func file_v2_audit_grpc_types_proto_rawDescGZIP() []byte { + file_v2_audit_grpc_types_proto_rawDescOnce.Do(func() { + file_v2_audit_grpc_types_proto_rawDescData = protoimpl.X.CompressGZIP(file_v2_audit_grpc_types_proto_rawDescData) + }) + return file_v2_audit_grpc_types_proto_rawDescData +} + +var file_v2_audit_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_v2_audit_grpc_types_proto_goTypes = []interface{}{ + (*DataAuditResult)(nil), // 0: neo.fs.v2.audit.DataAuditResult + (*grpc.ContainerID)(nil), // 1: neo.fs.v2.refs.ContainerID + (*grpc.ObjectID)(nil), // 2: neo.fs.v2.refs.ObjectID +} +var file_v2_audit_grpc_types_proto_depIdxs = []int32{ + 1, // 0: neo.fs.v2.audit.DataAuditResult.container_id:type_name -> neo.fs.v2.refs.ContainerID + 2, // 1: neo.fs.v2.audit.DataAuditResult.pass_sg:type_name -> neo.fs.v2.refs.ObjectID + 2, // 2: neo.fs.v2.audit.DataAuditResult.fail_sg:type_name -> neo.fs.v2.refs.ObjectID + 3, // [3:3] is the sub-list for method output_type + 3, // [3:3] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name +} + +func init() { file_v2_audit_grpc_types_proto_init() } +func file_v2_audit_grpc_types_proto_init() { + if File_v2_audit_grpc_types_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_v2_audit_grpc_types_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DataAuditResult); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_v2_audit_grpc_types_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_v2_audit_grpc_types_proto_goTypes, + DependencyIndexes: file_v2_audit_grpc_types_proto_depIdxs, + MessageInfos: file_v2_audit_grpc_types_proto_msgTypes, + }.Build() + File_v2_audit_grpc_types_proto = out.File + file_v2_audit_grpc_types_proto_rawDesc = nil + file_v2_audit_grpc_types_proto_goTypes = nil + file_v2_audit_grpc_types_proto_depIdxs = nil +} From 51e8e318c2cae33664ba423c39be96dd3878f6a2 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 21 Dec 2020 10:51:04 +0300 Subject: [PATCH 0641/1196] [#233] proto: Implement functions for fixed64 protobuf data type Signed-off-by: Leonard Lyubich --- util/proto/marshal.go | 25 ++++++++++++++++++ util/proto/marshal_test.go | 38 ++++++++++++++++++++++++++++ util/proto/test/test.pb.go | 52 +++++++++++++++++++++++--------------- util/proto/test/test.proto | 1 + 4 files changed, 95 insertions(+), 21 deletions(-) diff --git a/util/proto/marshal.go b/util/proto/marshal.go index 250db0f..66824b3 100644 --- a/util/proto/marshal.go +++ b/util/proto/marshal.go @@ -335,3 +335,28 @@ func NestedStructureSize(field int64, v stableMarshaller) (size int) { return size } + +func Fixed64Marshal(field int, buf []byte, v uint64) (int, error) { + if v == 0 { + return 0, nil + } + + prefix := field<<3 | 1 + + // buf length check can prevent panic at PutUvarint, but it will make + // marshaller a bit slower. + i := binary.PutUvarint(buf, uint64(prefix)) + binary.LittleEndian.PutUint64(buf[i:], v) + + return i + 8, nil +} + +func Fixed64Size(fNum int, v uint64) int { + if v == 0 { + return 0 + } + + prefix := fNum<<3 | 1 + + return VarUIntSize(uint64(prefix)) + 8 +} diff --git a/util/proto/marshal_test.go b/util/proto/marshal_test.go index 56e0a23..6844309 100644 --- a/util/proto/marshal_test.go +++ b/util/proto/marshal_test.go @@ -22,6 +22,7 @@ type stablePrimitives struct { FieldF int64 FieldG uint64 FieldH SomeEnum + FieldI uint64 // fixed64 } type stableRepPrimitives struct { @@ -122,6 +123,16 @@ func (s *stablePrimitives) stableMarshal(buf []byte, wrongField bool) ([]byte, e } i += offset + fieldNum = 205 + if wrongField { + fieldNum++ + } + offset, err = proto.Fixed64Marshal(fieldNum, buf, s.FieldI) + if err != nil { + return nil, errors.Wrap(err, "can't marshal field I") + } + i += offset + fieldNum = 300 if wrongField { fieldNum++ @@ -143,6 +154,7 @@ func (s *stablePrimitives) stableSize() int { proto.UInt32Size(202, s.FieldE) + proto.Int64Size(203, s.FieldF) + proto.UInt64Size(204, s.FieldG) + + proto.Fixed64Size(205, s.FieldI) + proto.EnumSize(300, int32(s.FieldH)) } @@ -430,6 +442,17 @@ func TestRepeatedUInt64Marshal(t *testing.T) { }) } +func TestFixed64Marshal(t *testing.T) { + t.Run("zero", func(t *testing.T) { + testFixed64Marshal(t, 0, false) + }) + + t.Run("non zero", func(t *testing.T) { + testFixed64Marshal(t, math.MaxUint64, false) + testFixed64Marshal(t, math.MaxUint64, true) + }) +} + func testMarshal(t *testing.T, c stablePrimitives, tr test.Primitives, wrongField bool) *test.Primitives { var ( wire []byte @@ -713,3 +736,18 @@ func testRepeatedUInt64Marshal(t *testing.T, n []uint64, wrongField bool) { require.Len(t, result.FieldF, 0) } } + +func testFixed64Marshal(t *testing.T, n uint64, wrongField bool) { + var ( + custom = stablePrimitives{FieldI: n} + transport = test.Primitives{FieldI: n} + ) + + result := testMarshal(t, custom, transport, wrongField) + + if !wrongField { + require.Equal(t, n, result.FieldI) + } else { + require.EqualValues(t, 0, result.FieldI) + } +} diff --git a/util/proto/test/test.pb.go b/util/proto/test/test.pb.go index 0254baa..a0808f8 100644 --- a/util/proto/test/test.pb.go +++ b/util/proto/test/test.pb.go @@ -86,6 +86,7 @@ type Primitives struct { FieldE uint32 `protobuf:"varint,202,opt,name=field_e,json=fieldE,proto3" json:"field_e,omitempty"` FieldF int64 `protobuf:"varint,203,opt,name=field_f,json=fieldF,proto3" json:"field_f,omitempty"` FieldG uint64 `protobuf:"varint,204,opt,name=field_g,json=fieldG,proto3" json:"field_g,omitempty"` + FieldI uint64 `protobuf:"fixed64,205,opt,name=field_i,json=fieldI,proto3" json:"field_i,omitempty"` FieldH Primitives_SomeEnum `protobuf:"varint,300,opt,name=field_h,json=fieldH,proto3,enum=test.Primitives_SomeEnum" json:"field_h,omitempty"` } @@ -170,6 +171,13 @@ func (x *Primitives) GetFieldG() uint64 { return 0 } +func (x *Primitives) GetFieldI() uint64 { + if x != nil { + return x.FieldI + } + return 0 +} + func (x *Primitives) GetFieldH() Primitives_SomeEnum { if x != nil { return x.FieldH @@ -269,7 +277,7 @@ var File_util_proto_test_test_proto protoreflect.FileDescriptor var file_util_proto_test_test_proto_rawDesc = []byte{ 0x0a, 0x1a, 0x75, 0x74, 0x69, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x04, 0x74, 0x65, - 0x73, 0x74, 0x22, 0xb3, 0x02, 0x0a, 0x0a, 0x50, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, + 0x73, 0x74, 0x22, 0xcd, 0x02, 0x0a, 0x0a, 0x50, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, 0x12, 0x17, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x41, 0x12, 0x17, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x62, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x66, 0x69, 0x65, @@ -281,26 +289,28 @@ var file_util_proto_test_test_proto_rawDesc = []byte{ 0x45, 0x12, 0x18, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x66, 0x18, 0xcb, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x46, 0x12, 0x18, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x67, 0x18, 0xcc, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x66, - 0x69, 0x65, 0x6c, 0x64, 0x47, 0x12, 0x33, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x68, - 0x18, 0xac, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x19, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x50, - 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, 0x2e, 0x53, 0x6f, 0x6d, 0x65, 0x45, 0x6e, - 0x75, 0x6d, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x48, 0x22, 0x3c, 0x0a, 0x08, 0x53, 0x6f, - 0x6d, 0x65, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, - 0x4e, 0x10, 0x00, 0x12, 0x0c, 0x0a, 0x08, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x49, 0x56, 0x45, 0x10, - 0x01, 0x12, 0x15, 0x0a, 0x08, 0x4e, 0x45, 0x47, 0x41, 0x54, 0x49, 0x56, 0x45, 0x10, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0x22, 0xa5, 0x01, 0x0a, 0x0d, 0x52, 0x65, 0x70, - 0x50, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, 0x12, 0x17, 0x0a, 0x07, 0x66, 0x69, - 0x65, 0x6c, 0x64, 0x5f, 0x61, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x06, 0x66, 0x69, 0x65, - 0x6c, 0x64, 0x41, 0x12, 0x17, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x62, 0x18, 0x02, - 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x42, 0x12, 0x17, 0x0a, 0x07, - 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x63, 0x18, 0x03, 0x20, 0x03, 0x28, 0x05, 0x52, 0x06, 0x66, - 0x69, 0x65, 0x6c, 0x64, 0x43, 0x12, 0x17, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x64, - 0x18, 0x04, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x44, 0x12, 0x17, - 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x65, 0x18, 0x05, 0x20, 0x03, 0x28, 0x03, 0x52, - 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x45, 0x12, 0x17, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, - 0x5f, 0x66, 0x18, 0x06, 0x20, 0x03, 0x28, 0x04, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x46, - 0x42, 0x11, 0x5a, 0x0f, 0x75, 0x74, 0x69, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x74, - 0x65, 0x73, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x69, 0x65, 0x6c, 0x64, 0x47, 0x12, 0x18, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x69, + 0x18, 0xcd, 0x01, 0x20, 0x01, 0x28, 0x06, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x49, 0x12, + 0x33, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x68, 0x18, 0xac, 0x02, 0x20, 0x01, 0x28, + 0x0e, 0x32, 0x19, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x50, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, + 0x76, 0x65, 0x73, 0x2e, 0x53, 0x6f, 0x6d, 0x65, 0x45, 0x6e, 0x75, 0x6d, 0x52, 0x06, 0x66, 0x69, + 0x65, 0x6c, 0x64, 0x48, 0x22, 0x3c, 0x0a, 0x08, 0x53, 0x6f, 0x6d, 0x65, 0x45, 0x6e, 0x75, 0x6d, + 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x0c, 0x0a, + 0x08, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x49, 0x56, 0x45, 0x10, 0x01, 0x12, 0x15, 0x0a, 0x08, 0x4e, + 0x45, 0x47, 0x41, 0x54, 0x49, 0x56, 0x45, 0x10, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0x01, 0x22, 0xa5, 0x01, 0x0a, 0x0d, 0x52, 0x65, 0x70, 0x50, 0x72, 0x69, 0x6d, 0x69, 0x74, + 0x69, 0x76, 0x65, 0x73, 0x12, 0x17, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x61, 0x18, + 0x01, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x41, 0x12, 0x17, 0x0a, + 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x62, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, + 0x66, 0x69, 0x65, 0x6c, 0x64, 0x42, 0x12, 0x17, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, + 0x63, 0x18, 0x03, 0x20, 0x03, 0x28, 0x05, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x43, 0x12, + 0x17, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x64, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0d, + 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x44, 0x12, 0x17, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, + 0x64, 0x5f, 0x65, 0x18, 0x05, 0x20, 0x03, 0x28, 0x03, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, + 0x45, 0x12, 0x17, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x66, 0x18, 0x06, 0x20, 0x03, + 0x28, 0x04, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x46, 0x42, 0x11, 0x5a, 0x0f, 0x75, 0x74, + 0x69, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/util/proto/test/test.proto b/util/proto/test/test.proto index ea6125f..e9c2758 100644 --- a/util/proto/test/test.proto +++ b/util/proto/test/test.proto @@ -12,6 +12,7 @@ message Primitives { uint32 field_e = 202; int64 field_f = 203; uint64 field_g = 204; + fixed64 field_i = 205; enum SomeEnum { UNKNOWN = 0; From 3039aa20c7782b7da54b0a696cad6d5aeb556d67 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 21 Dec 2020 10:51:45 +0300 Subject: [PATCH 0642/1196] [#233] v2/refs: Implement converters for object ID list type Signed-off-by: Leonard Lyubich --- v2/object/convert.go | 22 ++++++---------------- v2/object/marshal.go | 37 +++++++++++++------------------------ v2/refs/convert.go | 28 ++++++++++++++++++++++++++++ v2/refs/marshal.go | 27 +++++++++++++++++++++++++++ v2/storagegroup/convert.go | 23 ++++++----------------- v2/storagegroup/marshal.go | 16 +++++----------- 6 files changed, 85 insertions(+), 68 deletions(-) diff --git a/v2/object/convert.go b/v2/object/convert.go index 84ae218..88b0e0e 100644 --- a/v2/object/convert.go +++ b/v2/object/convert.go @@ -1258,14 +1258,9 @@ func SearchResponseBodyToGRPCMessage(r *SearchResponseBody) *object.SearchRespon m := new(object.SearchResponse_Body) - ids := r.GetIDList() - idMsg := make([]*refsGRPC.ObjectID, 0, len(ids)) - - for i := range ids { - idMsg = append(idMsg, refs.ObjectIDToGRPCMessage(ids[i])) - } - - m.SetIdList(idMsg) + m.SetIdList( + refs.ObjectIDListToGRPCMessage(r.GetIDList()), + ) return m } @@ -1277,14 +1272,9 @@ func SearchResponseBodyFromGRPCMessage(m *object.SearchResponse_Body) *SearchRes r := new(SearchResponseBody) - idMsg := m.GetIdList() - ids := make([]*refs.ObjectID, 0, len(idMsg)) - - for i := range idMsg { - ids = append(ids, refs.ObjectIDFromGRPCMessage(idMsg[i])) - } - - r.SetIDList(ids) + r.SetIDList( + refs.ObjectIDListFromGRPCMessage(m.GetIdList()), + ) return r } diff --git a/v2/object/marshal.go b/v2/object/marshal.go index c321ed3..59ac0ad 100644 --- a/v2/object/marshal.go +++ b/v2/object/marshal.go @@ -3,6 +3,7 @@ package object import ( "github.com/nspcc-dev/neofs-api-go/util/proto" object "github.com/nspcc-dev/neofs-api-go/v2/object/grpc" + "github.com/nspcc-dev/neofs-api-go/v2/refs" goproto "google.golang.org/protobuf/proto" ) @@ -295,15 +296,13 @@ func (h *SplitHeader) StableMarshal(buf []byte) ([]byte, error) { offset += n - for i := range h.children { - n, err = proto.NestedStructureMarshal(splitHdrChildrenField, buf[offset:], h.children[i]) - if err != nil { - return nil, err - } - - offset += n + n, err = refs.ObjectIDNestedListMarshal(splitHdrChildrenField, buf[offset:], h.children) + if err != nil { + return nil, err } + offset += n + _, err = proto.BytesMarshal(splitHdrSplitIDField, buf[offset:], h.splitID) if err != nil { return nil, err @@ -321,11 +320,7 @@ func (h *SplitHeader) StableSize() (size int) { size += proto.NestedStructureSize(splitHdrPreviousField, h.prev) size += proto.NestedStructureSize(splitHdrParentSignatureField, h.parSig) size += proto.NestedStructureSize(splitHdrParentHeaderField, h.parHdr) - - for i := range h.children { - size += proto.NestedStructureSize(splitHdrChildrenField, h.children[i]) - } - + size += refs.ObjectIDNestedListSize(splitHdrChildrenField, h.children) size += proto.BytesSize(splitHdrSplitIDField, h.splitID) return size @@ -1227,17 +1222,13 @@ func (r *SearchResponseBody) StableMarshal(buf []byte) ([]byte, error) { } var ( - offset, n int - err error + offset int + err error ) - for i := range r.idList { - n, err = proto.NestedStructureMarshal(searchRespBodyObjectIDsField, buf[offset:], r.idList[i]) - if err != nil { - return nil, err - } - - offset += n + _, err = refs.ObjectIDNestedListMarshal(searchRespBodyObjectIDsField, buf[offset:], r.idList) + if err != nil { + return nil, err } return buf, nil @@ -1248,9 +1239,7 @@ func (r *SearchResponseBody) StableSize() (size int) { return 0 } - for i := range r.idList { - size += proto.NestedStructureSize(searchRespBodyObjectIDsField, r.idList[i]) - } + size += refs.ObjectIDNestedListSize(searchRespBodyObjectIDsField, r.idList) return size } diff --git a/v2/refs/convert.go b/v2/refs/convert.go index 00971be..673fbf0 100644 --- a/v2/refs/convert.go +++ b/v2/refs/convert.go @@ -76,6 +76,34 @@ func ObjectIDFromGRPCMessage(m *refs.ObjectID) *ObjectID { return o } +func ObjectIDListToGRPCMessage(ids []*ObjectID) []*refs.ObjectID { + if ids == nil { + return nil + } + + idsV2 := make([]*refs.ObjectID, 0, len(ids)) + + for i := range ids { + idsV2 = append(idsV2, ObjectIDToGRPCMessage(ids[i])) + } + + return idsV2 +} + +func ObjectIDListFromGRPCMessage(idsV2 []*refs.ObjectID) []*ObjectID { + if idsV2 == nil { + return nil + } + + ids := make([]*ObjectID, 0, len(idsV2)) + + for i := range idsV2 { + ids = append(ids, ObjectIDFromGRPCMessage(idsV2[i])) + } + + return ids +} + func AddressToGRPCMessage(a *Address) *refs.Address { if a == nil { return nil diff --git a/v2/refs/marshal.go b/v2/refs/marshal.go index 3c3ef1e..28b4d4e 100644 --- a/v2/refs/marshal.go +++ b/v2/refs/marshal.go @@ -115,6 +115,16 @@ func (o *ObjectID) StableMarshal(buf []byte) ([]byte, error) { return buf, nil } +// ObjectIDNestedListSize returns byte length of nested +// repeated ObjectID field with fNum number. +func ObjectIDNestedListSize(fNum int64, ids []*ObjectID) (sz int) { + for i := range ids { + sz += proto.NestedStructureSize(fNum, ids[i]) + } + + return +} + func (o *ObjectID) StableSize() int { if o == nil { return 0 @@ -123,6 +133,23 @@ func (o *ObjectID) StableSize() int { return proto.BytesSize(objectIDValField, o.val) } +// ObjectIDNestedListMarshal writes protobuf repeated ObjectID field +// with fNum number to buf. +func ObjectIDNestedListMarshal(fNum int64, buf []byte, ids []*ObjectID) (off int, err error) { + for i := range ids { + var n int + + n, err = proto.NestedStructureMarshal(fNum, buf[off:], ids[i]) + if err != nil { + return + } + + off += n + } + + return +} + func (o *ObjectID) Unmarshal(data []byte) error { m := new(refs.ObjectID) if err := goproto.Unmarshal(data, m); err != nil { diff --git a/v2/storagegroup/convert.go b/v2/storagegroup/convert.go index 6712619..e78312c 100644 --- a/v2/storagegroup/convert.go +++ b/v2/storagegroup/convert.go @@ -2,7 +2,6 @@ package storagegroup import ( "github.com/nspcc-dev/neofs-api-go/v2/refs" - refsGRPC "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" sg "github.com/nspcc-dev/neofs-api-go/v2/storagegroup/grpc" ) @@ -20,14 +19,9 @@ func StorageGroupToGRPCMessage(s *StorageGroup) *sg.StorageGroup { ) m.SetExpirationEpoch(s.GetExpirationEpoch()) - members := s.GetMembers() - memberMsg := make([]*refsGRPC.ObjectID, 0, len(members)) - - for i := range members { - memberMsg = append(memberMsg, refs.ObjectIDToGRPCMessage(members[i])) - } - - m.SetMembers(memberMsg) + m.SetMembers( + refs.ObjectIDListToGRPCMessage(s.GetMembers()), + ) return m } @@ -46,14 +40,9 @@ func StorageGroupFromGRPCMessage(m *sg.StorageGroup) *StorageGroup { ) s.SetExpirationEpoch(m.GetExpirationEpoch()) - memberMsg := m.GetMembers() - members := make([]*refs.ObjectID, 0, len(memberMsg)) - - for i := range memberMsg { - members = append(members, refs.ObjectIDFromGRPCMessage(memberMsg[i])) - } - - s.SetMembers(members) + s.SetMembers( + refs.ObjectIDListFromGRPCMessage(m.GetMembers()), + ) return s } diff --git a/v2/storagegroup/marshal.go b/v2/storagegroup/marshal.go index bfcb896..c7d4e75 100644 --- a/v2/storagegroup/marshal.go +++ b/v2/storagegroup/marshal.go @@ -2,6 +2,7 @@ package storagegroup import ( "github.com/nspcc-dev/neofs-api-go/util/proto" + "github.com/nspcc-dev/neofs-api-go/v2/refs" storagegroup "github.com/nspcc-dev/neofs-api-go/v2/storagegroup/grpc" goproto "google.golang.org/protobuf/proto" ) @@ -50,13 +51,9 @@ func (s *StorageGroup) StableMarshal(buf []byte) ([]byte, error) { offset += n - for i := range s.members { - n, err = proto.NestedStructureMarshal(objectIDsField, buf[offset:], s.members[i]) - if err != nil { - return nil, err - } - - offset += n + n, err = refs.ObjectIDNestedListMarshal(objectIDsField, buf[offset:], s.members) + if err != nil { + return nil, err } return buf, nil @@ -71,10 +68,7 @@ func (s *StorageGroup) StableSize() (size int) { size += proto.UInt64Size(sizeField, s.size) size += proto.NestedStructureSize(hashField, s.hash) size += proto.UInt64Size(expirationField, s.exp) - - for i := range s.members { - size += proto.NestedStructureSize(objectIDsField, s.members[i]) - } + size += refs.ObjectIDNestedListSize(objectIDsField, s.members) return size } From 9986a4ecd120d2369efd23177afb4b972408c7a4 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 21 Dec 2020 10:52:34 +0300 Subject: [PATCH 0643/1196] [#233] Implement data audit result type with basic methods Signed-off-by: Leonard Lyubich --- pkg/audit/result.go | 258 +++++++++++++++++++++++++++++++++++++++ pkg/audit/result_test.go | 109 +++++++++++++++++ v2/audit/convert.go | 76 ++++++++++++ v2/audit/grpc/types.go | 75 ++++++++++++ v2/audit/json.go | 26 ++++ v2/audit/json_test.go | 20 +++ v2/audit/marshal.go | 143 ++++++++++++++++++++++ v2/audit/marshal_test.go | 55 +++++++++ v2/audit/types.go | 197 ++++++++++++++++++++++++++++++ 9 files changed, 959 insertions(+) create mode 100644 pkg/audit/result.go create mode 100644 pkg/audit/result_test.go create mode 100644 v2/audit/convert.go create mode 100644 v2/audit/grpc/types.go create mode 100644 v2/audit/json.go create mode 100644 v2/audit/json_test.go create mode 100644 v2/audit/marshal.go create mode 100644 v2/audit/marshal_test.go create mode 100644 v2/audit/types.go diff --git a/pkg/audit/result.go b/pkg/audit/result.go new file mode 100644 index 0000000..c5af81a --- /dev/null +++ b/pkg/audit/result.go @@ -0,0 +1,258 @@ +package audit + +import ( + "github.com/nspcc-dev/neofs-api-go/pkg/container" + "github.com/nspcc-dev/neofs-api-go/pkg/object" + "github.com/nspcc-dev/neofs-api-go/v2/audit" + "github.com/nspcc-dev/neofs-api-go/v2/refs" +) + +// Result represents v2-compatible data audit result. +type Result audit.DataAuditResult + +// NewFromV2 wraps v2 DataAuditResult message to Result. +func NewResultFromV2(aV2 *audit.DataAuditResult) *Result { + return (*Result)(aV2) +} + +// New creates and initializes blank Result. +func NewResult() *Result { + return NewResultFromV2(new(audit.DataAuditResult)) +} + +// ToV2 converts Result to v2 DataAuditResult message. +func (r *Result) ToV2() *audit.DataAuditResult { + return (*audit.DataAuditResult)(r) +} + +// Marshal marshals Result into a protobuf binary form. +// +// Buffer is allocated when the argument is empty. +// Otherwise, the first buffer is used. +func (r *Result) Marshal(b ...[]byte) ([]byte, error) { + var buf []byte + if len(b) > 0 { + buf = b[0] + } + + return (*audit.DataAuditResult)(r). + StableMarshal(buf) +} + +// Unmarshal unmarshals protobuf binary representation of Result. +func (r *Result) Unmarshal(data []byte) error { + return (*audit.DataAuditResult)(r). + Unmarshal(data) +} + +// MarshalJSON encodes Result to protobuf JSON format. +func (r *Result) MarshalJSON() ([]byte, error) { + return (*audit.DataAuditResult)(r). + MarshalJSON() +} + +// UnmarshalJSON decodes Result from protobuf JSON format. +func (r *Result) UnmarshalJSON(data []byte) error { + return (*audit.DataAuditResult)(r). + UnmarshalJSON(data) +} + +// AuditEpoch returns epoch number when the Data Audit was conducted. +func (r *Result) AuditEpoch() uint64 { + return (*audit.DataAuditResult)(r). + GetAuditEpoch() +} + +// SetAuditEpoch sets epoch number when the Data Audit was conducted. +func (r *Result) SetAuditEpoch(epoch uint64) { + (*audit.DataAuditResult)(r). + SetAuditEpoch(epoch) +} + +// ContainerID returns container under audit. +func (r *Result) ContainerID() *container.ID { + return container.NewIDFromV2( + (*audit.DataAuditResult)(r). + GetContainerID(), + ) +} + +// SetContainerID sets container under audit. +func (r *Result) SetContainerID(id *container.ID) { + (*audit.DataAuditResult)(r). + SetContainerID(id.ToV2()) +} + +// PublicKey returns public key of the auditing InnerRing node in a binary format. +func (r *Result) PublicKey() []byte { + return (*audit.DataAuditResult)(r). + GetPublicKey() +} + +// SetPublicKey sets public key of the auditing InnerRing node in a binary format. +func (r *Result) SetPublicKey(key []byte) { + (*audit.DataAuditResult)(r). + SetPublicKey(key) +} + +// PassSG returns list of Storage Groups that passed audit PoR stage. +func (r *Result) PassSG() []*object.ID { + mV2 := (*audit.DataAuditResult)(r). + GetPassSG() + + if mV2 == nil { + return nil + } + + m := make([]*object.ID, len(mV2)) + + for i := range mV2 { + m[i] = object.NewIDFromV2(mV2[i]) + } + + return m +} + +// SetPassSG sets list of Storage Groups that passed audit PoR stage. +func (r *Result) SetPassSG(list []*object.ID) { + mV2 := (*audit.DataAuditResult)(r). + GetPassSG() + + if list == nil { + mV2 = nil + } else { + ln := len(list) + + if cap(mV2) >= ln { + mV2 = mV2[:0] + } else { + mV2 = make([]*refs.ObjectID, 0, ln) + } + + for i := 0; i < ln; i++ { + mV2 = append(mV2, list[i].ToV2()) + } + } + + (*audit.DataAuditResult)(r). + SetPassSG(mV2) +} + +// FailSG returns list of Storage Groups that failed audit PoR stage. +func (r *Result) FailSG() []*object.ID { + mV2 := (*audit.DataAuditResult)(r). + GetFailSG() + + if mV2 == nil { + return nil + } + + m := make([]*object.ID, len(mV2)) + + for i := range mV2 { + m[i] = object.NewIDFromV2(mV2[i]) + } + + return m +} + +// SetFailSG sets list of Storage Groups that failed audit PoR stage. +func (r *Result) SetFailSG(list []*object.ID) { + mV2 := (*audit.DataAuditResult)(r). + GetFailSG() + + if list == nil { + mV2 = nil + } else { + ln := len(list) + + if cap(mV2) >= ln { + mV2 = mV2[:0] + } else { + mV2 = make([]*refs.ObjectID, 0, ln) + } + + for i := 0; i < ln; i++ { + mV2 = append(mV2, list[i].ToV2()) + } + } + + (*audit.DataAuditResult)(r). + SetFailSG(mV2) +} + +// Hit returns number of sampled objects under audit placed +// in an optimal way according to the containers placement policy +// when checking PoP. +func (r *Result) Hit() uint32 { + return (*audit.DataAuditResult)(r). + GetHit() +} + +// SetHit sets number of sampled objects under audit placed +// in an optimal way according to the containers placement policy +// when checking PoP. +func (r *Result) SetHit(hit uint32) { + (*audit.DataAuditResult)(r). + SetHit(hit) +} + +// Miss returns number of sampled objects under audit placed +// in suboptimal way according to the containers placement policy, +// but still at a satisfactory level when checking PoP. +func (r *Result) Miss() uint32 { + return (*audit.DataAuditResult)(r). + GetMiss() +} + +// SetMiss sets number of sampled objects under audit placed +// in suboptimal way according to the containers placement policy, +// but still at a satisfactory level when checking PoP. +func (r *Result) SetMiss(miss uint32) { + (*audit.DataAuditResult)(r). + SetMiss(miss) +} + +// Fail returns number of sampled objects under audit stored +// in a way not confirming placement policy or not found at all +// when checking PoP. +func (r *Result) Fail() uint32 { + return (*audit.DataAuditResult)(r). + GetFail() +} + +// SetFail sets number of sampled objects under audit stored +// in a way not confirming placement policy or not found at all +// when checking PoP. +func (r *Result) SetFail(fail uint32) { + (*audit.DataAuditResult)(r). + SetFail(fail) +} + +// PassNodes returns list of storage node public keys that +// passed at least one PDP. +func (r *Result) PassNodes() [][]byte { + return (*audit.DataAuditResult)(r). + GetPassNodes() +} + +// SetPassNodes sets list of storage node public keys that +// passed at least one PDP. +func (r *Result) SetPassNodes(list [][]byte) { + (*audit.DataAuditResult)(r). + SetPassNodes(list) +} + +// FailNodes returns list of storage node public keys that +// failed at least one PDP. +func (r *Result) FailNodes() [][]byte { + return (*audit.DataAuditResult)(r). + GetFailNodes() +} + +// SetFailNodes sets list of storage node public keys that +// failed at least one PDP. +func (r *Result) SetFailNodes(list [][]byte) { + (*audit.DataAuditResult)(r). + SetFailNodes(list) +} diff --git a/pkg/audit/result_test.go b/pkg/audit/result_test.go new file mode 100644 index 0000000..8f86037 --- /dev/null +++ b/pkg/audit/result_test.go @@ -0,0 +1,109 @@ +package audit_test + +import ( + "crypto/rand" + "crypto/sha256" + "testing" + + "github.com/nspcc-dev/neofs-api-go/pkg/audit" + "github.com/nspcc-dev/neofs-api-go/pkg/container" + "github.com/nspcc-dev/neofs-api-go/pkg/object" + "github.com/stretchr/testify/require" +) + +func testSHA256() (cs [sha256.Size]byte) { + _, _ = rand.Read(cs[:]) + return +} + +func testCID() *container.ID { + cid := container.NewID() + cid.SetSHA256(testSHA256()) + + return cid +} + +func testOID() *object.ID { + id := object.NewID() + id.SetSHA256(testSHA256()) + + return id +} + +func TestResult(t *testing.T) { + r := audit.NewResult() + + epoch := uint64(13) + r.SetAuditEpoch(epoch) + require.Equal(t, epoch, r.AuditEpoch()) + + cid := testCID() + r.SetContainerID(cid) + require.Equal(t, cid, r.ContainerID()) + + key := []byte{1, 2, 3} + r.SetPublicKey(key) + require.Equal(t, key, r.PublicKey()) + + passSG := []*object.ID{testOID(), testOID()} + r.SetPassSG(passSG) + require.Equal(t, passSG, r.PassSG()) + + failSG := []*object.ID{testOID(), testOID()} + r.SetFailSG(failSG) + require.Equal(t, failSG, r.FailSG()) + + hit := uint32(1) + r.SetHit(hit) + require.Equal(t, hit, r.Hit()) + + miss := uint32(2) + r.SetMiss(miss) + require.Equal(t, miss, r.Miss()) + + fail := uint32(3) + r.SetFail(fail) + require.Equal(t, fail, r.Fail()) + + passNodes := [][]byte{{1}, {2}} + r.SetPassNodes(passNodes) + require.Equal(t, passNodes, r.PassNodes()) + + failNodes := [][]byte{{3}, {4}} + r.SetFailNodes(failNodes) + require.Equal(t, failNodes, r.FailNodes()) +} + +func TestStorageGroupEncoding(t *testing.T) { + r := audit.NewResult() + r.SetAuditEpoch(13) + r.SetContainerID(testCID()) + r.SetPublicKey([]byte{1, 2, 3}) + r.SetPassSG([]*object.ID{testOID(), testOID()}) + r.SetFailSG([]*object.ID{testOID(), testOID()}) + r.SetHit(1) + r.SetMiss(2) + r.SetFail(3) + r.SetPassNodes([][]byte{{1}, {2}}) + r.SetFailNodes([][]byte{{3}, {4}}) + + t.Run("binary", func(t *testing.T) { + data, err := r.Marshal() + require.NoError(t, err) + + r2 := audit.NewResult() + require.NoError(t, r2.Unmarshal(data)) + + require.Equal(t, r, r2) + }) + + t.Run("json", func(t *testing.T) { + data, err := r.MarshalJSON() + require.NoError(t, err) + + r2 := audit.NewResult() + require.NoError(t, r2.UnmarshalJSON(data)) + + require.Equal(t, r, r2) + }) +} diff --git a/v2/audit/convert.go b/v2/audit/convert.go new file mode 100644 index 0000000..40dcd3b --- /dev/null +++ b/v2/audit/convert.go @@ -0,0 +1,76 @@ +package audit + +import ( + audit "github.com/nspcc-dev/neofs-api-go/v2/audit/grpc" + "github.com/nspcc-dev/neofs-api-go/v2/refs" +) + +// DataAuditResultToGRPCMessage converts unified DataAuditResult structure +// into gRPC DataAuditResult message. +func DataAuditResultToGRPCMessage(a *DataAuditResult) *audit.DataAuditResult { + if a == nil { + return nil + } + + m := new(audit.DataAuditResult) + + m.SetAuditEpoch(a.GetAuditEpoch()) + + m.SetContainerId( + refs.ContainerIDToGRPCMessage(a.GetContainerID()), + ) + + m.SetPublicKey(a.GetPublicKey()) + + m.SetPassSg( + refs.ObjectIDListToGRPCMessage(a.GetPassSG()), + ) + + m.SetFailSg( + refs.ObjectIDListToGRPCMessage(a.GetFailSG()), + ) + + m.SetHit(a.GetHit()) + m.SetMiss(a.GetMiss()) + m.SetFail(a.GetFail()) + + m.SetPassNodes(a.GetPassNodes()) + m.SetFailNodes(a.GetFailNodes()) + + return m +} + +// DataAuditResultFromGRPCMessage converts gRPC message DataAuditResult +// into unified DataAuditResult structure. +func DataAuditResultFromGRPCMessage(m *audit.DataAuditResult) *DataAuditResult { + if m == nil { + return nil + } + + a := new(DataAuditResult) + + a.SetAuditEpoch(m.GetAuditEpoch()) + + a.SetContainerID( + refs.ContainerIDFromGRPCMessage(m.GetContainerId()), + ) + + a.SetPublicKey(m.GetPublicKey()) + + a.SetPassSG( + refs.ObjectIDListFromGRPCMessage(m.GetPassSg()), + ) + + a.SetFailSG( + refs.ObjectIDListFromGRPCMessage(m.GetFailSg()), + ) + + a.SetHit(m.GetHit()) + a.SetMiss(m.GetMiss()) + a.SetFail(m.GetFail()) + + a.SetPassNodes(m.GetPassNodes()) + a.SetFailNodes(m.GetFailNodes()) + + return a +} diff --git a/v2/audit/grpc/types.go b/v2/audit/grpc/types.go new file mode 100644 index 0000000..7390d89 --- /dev/null +++ b/v2/audit/grpc/types.go @@ -0,0 +1,75 @@ +package audit + +import ( + refs "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" +) + +// SetAuditEpoch is an AuditEpoch field setter. +func (x *DataAuditResult) SetAuditEpoch(v uint64) { + if x != nil { + x.AuditEpoch = v + } +} + +// SetContainerId is a ContainerId field setter. +func (x *DataAuditResult) SetContainerId(v *refs.ContainerID) { + if x != nil { + x.ContainerId = v + } +} + +// SetPublicKey is a PublicKey field setter. +func (x *DataAuditResult) SetPublicKey(v []byte) { + if x != nil { + x.PublicKey = v + } +} + +// SetPassSg is a PassSg field setter. +func (x *DataAuditResult) SetPassSg(v []*refs.ObjectID) { + if x != nil { + x.PassSg = v + } +} + +// SetFailSg is a FailSg field setter. +func (x *DataAuditResult) SetFailSg(v []*refs.ObjectID) { + if x != nil { + x.FailSg = v + } +} + +// SetHit is a Hit field setter. +func (x *DataAuditResult) SetHit(v uint32) { + if x != nil { + x.Hit = v + } +} + +// SetMiss is a Miss field setter. +func (x *DataAuditResult) SetMiss(v uint32) { + if x != nil { + x.Miss = v + } +} + +// SetFail is a Fail field setter. +func (x *DataAuditResult) SetFail(v uint32) { + if x != nil { + x.Fail = v + } +} + +// SetPassNodes is a PassNodes field setter. +func (x *DataAuditResult) SetPassNodes(v [][]byte) { + if x != nil { + x.PassNodes = v + } +} + +// SetFailNodes is a FailNodes field setter. +func (x *DataAuditResult) SetFailNodes(v [][]byte) { + if x != nil { + x.FailNodes = v + } +} diff --git a/v2/audit/json.go b/v2/audit/json.go new file mode 100644 index 0000000..80cb33a --- /dev/null +++ b/v2/audit/json.go @@ -0,0 +1,26 @@ +package audit + +import ( + audit "github.com/nspcc-dev/neofs-api-go/v2/audit/grpc" + "google.golang.org/protobuf/encoding/protojson" +) + +func (a *DataAuditResult) MarshalJSON() ([]byte, error) { + return protojson.MarshalOptions{ + EmitUnpopulated: true, + }.Marshal( + DataAuditResultToGRPCMessage(a), + ) +} + +func (a *DataAuditResult) UnmarshalJSON(data []byte) error { + msg := new(audit.DataAuditResult) + + if err := protojson.Unmarshal(data, msg); err != nil { + return err + } + + *a = *DataAuditResultFromGRPCMessage(msg) + + return nil +} diff --git a/v2/audit/json_test.go b/v2/audit/json_test.go new file mode 100644 index 0000000..f1cae45 --- /dev/null +++ b/v2/audit/json_test.go @@ -0,0 +1,20 @@ +package audit_test + +import ( + "testing" + + "github.com/nspcc-dev/neofs-api-go/v2/audit" + "github.com/stretchr/testify/require" +) + +func TestDataAuditResultJSON(t *testing.T) { + a := generateDataAuditResult() + + data, err := a.MarshalJSON() + require.NoError(t, err) + + a2 := new(audit.DataAuditResult) + require.NoError(t, a2.UnmarshalJSON(data)) + + require.Equal(t, a, a2) +} diff --git a/v2/audit/marshal.go b/v2/audit/marshal.go new file mode 100644 index 0000000..c0174c7 --- /dev/null +++ b/v2/audit/marshal.go @@ -0,0 +1,143 @@ +package audit + +import ( + "github.com/nspcc-dev/neofs-api-go/util/proto" + audit "github.com/nspcc-dev/neofs-api-go/v2/audit/grpc" + "github.com/nspcc-dev/neofs-api-go/v2/refs" + goproto "google.golang.org/protobuf/proto" +) + +const ( + _ = iota + auditEpochFNum + cidFNum + pubKeyFNum + passSGFNum + failSGFNum + hitFNum + missFNum + failFNum + passNodesFNum + failNodesFNum +) + +// StableMarshal marshals unified DataAuditResult structure into a protobuf +// binary format without field order shuffle. +func (a *DataAuditResult) StableMarshal(buf []byte) ([]byte, error) { + if a == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, a.StableSize()) + } + + var ( + offset, n int + err error + ) + + n, err = proto.Fixed64Marshal(auditEpochFNum, buf[offset:], a.auditEpoch) + if err != nil { + return nil, err + } + + offset += n + + n, err = proto.NestedStructureMarshal(cidFNum, buf[offset:], a.cid) + if err != nil { + return nil, err + } + + offset += n + + n, err = proto.BytesMarshal(pubKeyFNum, buf[offset:], a.pubKey) + if err != nil { + return nil, err + } + + offset += n + + n, err = refs.ObjectIDNestedListMarshal(passSGFNum, buf[offset:], a.passSG) + if err != nil { + return nil, err + } + + offset += n + + n, err = refs.ObjectIDNestedListMarshal(failSGFNum, buf[offset:], a.failSG) + if err != nil { + return nil, err + } + + offset += n + + n, err = proto.UInt32Marshal(hitFNum, buf[offset:], a.hit) + if err != nil { + return nil, err + } + + offset += n + + n, err = proto.UInt32Marshal(missFNum, buf[offset:], a.miss) + if err != nil { + return nil, err + } + + offset += n + + n, err = proto.UInt32Marshal(failFNum, buf[offset:], a.fail) + if err != nil { + return nil, err + } + + offset += n + + n, err = proto.RepeatedBytesMarshal(passNodesFNum, buf[offset:], a.passNodes) + if err != nil { + return nil, err + } + + offset += n + + n, err = proto.RepeatedBytesMarshal(failNodesFNum, buf[offset:], a.failNodes) + if err != nil { + return nil, err + } + + return buf, nil +} + +// StableSize returns byte length of DataAuditResult structure +// marshaled by StableMarshal function. +func (a *DataAuditResult) StableSize() (size int) { + if a == nil { + return 0 + } + + size += proto.Fixed64Size(auditEpochFNum, a.auditEpoch) + size += proto.NestedStructureSize(cidFNum, a.cid) + size += proto.BytesSize(pubKeyFNum, a.pubKey) + size += refs.ObjectIDNestedListSize(passSGFNum, a.passSG) + size += refs.ObjectIDNestedListSize(failSGFNum, a.failSG) + size += proto.UInt32Size(hitFNum, a.hit) + size += proto.UInt32Size(missFNum, a.miss) + size += proto.UInt32Size(failFNum, a.fail) + size += proto.RepeatedBytesSize(passNodesFNum, a.passNodes) + size += proto.RepeatedBytesSize(failNodesFNum, a.failNodes) + + return size +} + +// Unmarshal unmarshals DataAuditResult structure from its protobuf +// binary representation. +func (a *DataAuditResult) Unmarshal(data []byte) error { + m := new(audit.DataAuditResult) + if err := goproto.Unmarshal(data, m); err != nil { + return err + } + + *a = *DataAuditResultFromGRPCMessage(m) + + return nil +} diff --git a/v2/audit/marshal_test.go b/v2/audit/marshal_test.go new file mode 100644 index 0000000..bb80652 --- /dev/null +++ b/v2/audit/marshal_test.go @@ -0,0 +1,55 @@ +package audit_test + +import ( + "testing" + + "github.com/nspcc-dev/neofs-api-go/v2/audit" + "github.com/nspcc-dev/neofs-api-go/v2/refs" + "github.com/stretchr/testify/require" +) + +func TestDataAuditResult_StableMarshal(t *testing.T) { + from := generateDataAuditResult() + + t.Run("non empty", func(t *testing.T) { + wire, err := from.StableMarshal(nil) + require.NoError(t, err) + + to := new(audit.DataAuditResult) + require.NoError(t, to.Unmarshal(wire)) + + require.Equal(t, from, to) + }) +} + +func generateDataAuditResult() *audit.DataAuditResult { + a := new(audit.DataAuditResult) + + oid1 := new(refs.ObjectID) + oid1.SetValue([]byte("Object ID 1")) + + oid2 := new(refs.ObjectID) + oid2.SetValue([]byte("Object ID 2")) + + cid := new(refs.ContainerID) + cid.SetValue([]byte("Container ID")) + + a.SetAuditEpoch(13) + a.SetContainerID(cid) + a.SetPublicKey([]byte("Public key")) + a.SetPassSG([]*refs.ObjectID{oid1, oid2}) + a.SetFailSG([]*refs.ObjectID{oid2, oid1}) + a.SetHit(1) + a.SetMiss(2) + a.SetFail(3) + a.SetPassNodes([][]byte{ + {1, 2}, + {3, 4}, + }) + a.SetFailNodes([][]byte{ + {5, 6}, + {7, 8}, + }) + + return a +} diff --git a/v2/audit/types.go b/v2/audit/types.go new file mode 100644 index 0000000..97676e1 --- /dev/null +++ b/v2/audit/types.go @@ -0,0 +1,197 @@ +package audit + +import ( + "github.com/nspcc-dev/neofs-api-go/v2/refs" +) + +// DataAuditResult is a unified structure of +// DataAuditResult message from proto definition. +type DataAuditResult struct { + auditEpoch uint64 + + hit, miss, fail uint32 + + cid *refs.ContainerID + + pubKey []byte + + passSG, failSG []*refs.ObjectID + + failNodes, passNodes [][]byte +} + +// GetAuditEpoch returns epoch number when the Data Audit was conducted. +func (a *DataAuditResult) GetAuditEpoch() uint64 { + if a != nil { + return a.auditEpoch + } + + return 0 +} + +// SetAuditEpoch sets epoch number when the Data Audit was conducted. +func (a *DataAuditResult) SetAuditEpoch(v uint64) { + if a != nil { + a.auditEpoch = v + } +} + +// GetContainerID returns container under audit. +func (a *DataAuditResult) GetContainerID() *refs.ContainerID { + if a != nil { + return a.cid + } + + return nil +} + +// SetContainerID sets container under audit. +func (a *DataAuditResult) SetContainerID(v *refs.ContainerID) { + if a != nil { + a.cid = v + } +} + +// GetPublicKey returns public key of the auditing InnerRing node in a binary format. +func (a *DataAuditResult) GetPublicKey() []byte { + if a != nil { + return a.pubKey + } + + return nil +} + +// SetPublicKey sets public key of the auditing InnerRing node in a binary format. +func (a *DataAuditResult) SetPublicKey(v []byte) { + if a != nil { + a.pubKey = v + } +} + +// GetPassSG returns list of Storage Groups that passed audit PoR stage. +func (a *DataAuditResult) GetPassSG() []*refs.ObjectID { + if a != nil { + return a.passSG + } + + return nil +} + +// SetPassSG sets list of Storage Groups that passed audit PoR stage. +func (a *DataAuditResult) SetPassSG(v []*refs.ObjectID) { + if a != nil { + a.passSG = v + } +} + +// GetFailSG returns list of Storage Groups that failed audit PoR stage. +func (a *DataAuditResult) GetFailSG() []*refs.ObjectID { + if a != nil { + return a.failSG + } + + return nil +} + +// SetFailSG sets list of Storage Groups that failed audit PoR stage. +func (a *DataAuditResult) SetFailSG(v []*refs.ObjectID) { + if a != nil { + a.failSG = v + } +} + +// GetHit returns number of sampled objects under audit placed +// in an optimal way according to the containers placement policy +// when checking PoP. +func (a *DataAuditResult) GetHit() uint32 { + if a != nil { + return a.hit + } + + return 0 +} + +// SetHit sets number of sampled objects under audit placed +// in an optimal way according to the containers placement policy +// when checking PoP. +func (a *DataAuditResult) SetHit(v uint32) { + if a != nil { + a.hit = v + } +} + +// GetMiss returns number of sampled objects under audit placed +// in suboptimal way according to the containers placement policy, +// but still at a satisfactory level when checking PoP. +func (a *DataAuditResult) GetMiss() uint32 { + if a != nil { + return a.miss + } + + return 0 +} + +// SetMiss sets number of sampled objects under audit placed +// in suboptimal way according to the containers placement policy, +// but still at a satisfactory level when checking PoP. +func (a *DataAuditResult) SetMiss(v uint32) { + if a != nil { + a.miss = v + } +} + +// GetFail returns number of sampled objects under audit stored +// in a way not confirming placement policy or not found at all +// when checking PoP. +func (a *DataAuditResult) GetFail() uint32 { + if a != nil { + return a.fail + } + + return 0 +} + +// SetFail sets number of sampled objects under audit stored +// in a way not confirming placement policy or not found at all +// when checking PoP. +func (a *DataAuditResult) SetFail(v uint32) { + if a != nil { + a.fail = v + } +} + +// GetPassNodes returns list of storage node public keys that +// passed at least one PDP. +func (a *DataAuditResult) GetPassNodes() [][]byte { + if a != nil { + return a.passNodes + } + + return nil +} + +// SetPassNodes sets list of storage node public keys that +// passed at least one PDP. +func (a *DataAuditResult) SetPassNodes(v [][]byte) { + if a != nil { + a.passNodes = v + } +} + +// GetFailNodes returns list of storage node public keys that +// failed at least one PDP. +func (a *DataAuditResult) GetFailNodes() [][]byte { + if a != nil { + return a.failNodes + } + + return nil +} + +// SetFailNodes sets list of storage node public keys that +// failed at least one PDP. +func (a *DataAuditResult) SetFailNodes(v [][]byte) { + if a != nil { + a.failNodes = v + } +} From 1c25c3904baa8383dc21f0bfd59fba61b50d2ae2 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Mon, 21 Dec 2020 17:35:03 +0300 Subject: [PATCH 0644/1196] [#234] Update audit result struct definition Signed-off-by: Alex Vanin --- pkg/audit/result.go | 31 +++++++++- pkg/audit/result_test.go | 5 ++ v2/audit/convert.go | 12 ++++ v2/audit/grpc/types.go | 14 +++++ v2/audit/grpc/types.pb.go | 124 +++++++++++++++++++++++--------------- v2/audit/marshal.go | 18 ++++++ v2/audit/marshal_test.go | 6 ++ v2/audit/types.go | 36 +++++++++++ 8 files changed, 196 insertions(+), 50 deletions(-) diff --git a/pkg/audit/result.go b/pkg/audit/result.go index c5af81a..6f5ea9f 100644 --- a/pkg/audit/result.go +++ b/pkg/audit/result.go @@ -1,6 +1,7 @@ package audit import ( + "github.com/nspcc-dev/neofs-api-go/pkg" "github.com/nspcc-dev/neofs-api-go/pkg/container" "github.com/nspcc-dev/neofs-api-go/pkg/object" "github.com/nspcc-dev/neofs-api-go/v2/audit" @@ -17,7 +18,10 @@ func NewResultFromV2(aV2 *audit.DataAuditResult) *Result { // New creates and initializes blank Result. func NewResult() *Result { - return NewResultFromV2(new(audit.DataAuditResult)) + r := NewResultFromV2(new(audit.DataAuditResult)) + r.SetVersion(pkg.SDKVersion()) + + return r } // ToV2 converts Result to v2 DataAuditResult message. @@ -57,6 +61,19 @@ func (r *Result) UnmarshalJSON(data []byte) error { UnmarshalJSON(data) } +// Version returns Data Audit structure version. +func (r *Result) Version() *pkg.Version { + return pkg.NewVersionFromV2( + (*audit.DataAuditResult)(r).GetVersion(), + ) +} + +// SetVersion sets Data Audit structure version. +func (r *Result) SetVersion(v *pkg.Version) { + (*audit.DataAuditResult)(r). + SetVersion(v.ToV2()) +} + // AuditEpoch returns epoch number when the Data Audit was conducted. func (r *Result) AuditEpoch() uint64 { return (*audit.DataAuditResult)(r). @@ -95,6 +112,18 @@ func (r *Result) SetPublicKey(key []byte) { SetPublicKey(key) } +// Complete returns completion state of audit result. +func (r *Result) Complete() bool { + return (*audit.DataAuditResult)(r). + GetComplete() +} + +// SetComplete sets completion state of audit result. +func (r *Result) SetComplete(v bool) { + (*audit.DataAuditResult)(r). + SetComplete(v) +} + // PassSG returns list of Storage Groups that passed audit PoR stage. func (r *Result) PassSG() []*object.ID { mV2 := (*audit.DataAuditResult)(r). diff --git a/pkg/audit/result_test.go b/pkg/audit/result_test.go index 8f86037..57038a3 100644 --- a/pkg/audit/result_test.go +++ b/pkg/audit/result_test.go @@ -5,6 +5,7 @@ import ( "crypto/sha256" "testing" + "github.com/nspcc-dev/neofs-api-go/pkg" "github.com/nspcc-dev/neofs-api-go/pkg/audit" "github.com/nspcc-dev/neofs-api-go/pkg/container" "github.com/nspcc-dev/neofs-api-go/pkg/object" @@ -32,6 +33,7 @@ func testOID() *object.ID { func TestResult(t *testing.T) { r := audit.NewResult() + require.Equal(t, pkg.SDKVersion(), r.Version()) epoch := uint64(13) r.SetAuditEpoch(epoch) @@ -45,6 +47,9 @@ func TestResult(t *testing.T) { r.SetPublicKey(key) require.Equal(t, key, r.PublicKey()) + r.SetComplete(true) + require.True(t, r.Complete()) + passSG := []*object.ID{testOID(), testOID()} r.SetPassSG(passSG) require.Equal(t, passSG, r.PassSG()) diff --git a/v2/audit/convert.go b/v2/audit/convert.go index 40dcd3b..4384953 100644 --- a/v2/audit/convert.go +++ b/v2/audit/convert.go @@ -14,6 +14,10 @@ func DataAuditResultToGRPCMessage(a *DataAuditResult) *audit.DataAuditResult { m := new(audit.DataAuditResult) + m.SetVersion( + refs.VersionToGRPCMessage(a.GetVersion()), + ) + m.SetAuditEpoch(a.GetAuditEpoch()) m.SetContainerId( @@ -22,6 +26,8 @@ func DataAuditResultToGRPCMessage(a *DataAuditResult) *audit.DataAuditResult { m.SetPublicKey(a.GetPublicKey()) + m.SetComplete(a.GetComplete()) + m.SetPassSg( refs.ObjectIDListToGRPCMessage(a.GetPassSG()), ) @@ -49,6 +55,10 @@ func DataAuditResultFromGRPCMessage(m *audit.DataAuditResult) *DataAuditResult { a := new(DataAuditResult) + a.SetVersion( + refs.VersionFromGRPCMessage(m.GetVersion()), + ) + a.SetAuditEpoch(m.GetAuditEpoch()) a.SetContainerID( @@ -57,6 +67,8 @@ func DataAuditResultFromGRPCMessage(m *audit.DataAuditResult) *DataAuditResult { a.SetPublicKey(m.GetPublicKey()) + a.SetComplete(m.GetComplete()) + a.SetPassSG( refs.ObjectIDListFromGRPCMessage(m.GetPassSg()), ) diff --git a/v2/audit/grpc/types.go b/v2/audit/grpc/types.go index 7390d89..2c225ef 100644 --- a/v2/audit/grpc/types.go +++ b/v2/audit/grpc/types.go @@ -4,6 +4,13 @@ import ( refs "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" ) +// SetVersion is a Version field setter. +func (x *DataAuditResult) SetVersion(v *refs.Version) { + if x != nil { + x.Version = v + } +} + // SetAuditEpoch is an AuditEpoch field setter. func (x *DataAuditResult) SetAuditEpoch(v uint64) { if x != nil { @@ -25,6 +32,13 @@ func (x *DataAuditResult) SetPublicKey(v []byte) { } } +// SetComplete is a Complete field setter. +func (x *DataAuditResult) SetComplete(v bool) { + if x != nil { + x.Complete = v + } +} + // SetPassSg is a PassSg field setter. func (x *DataAuditResult) SetPassSg(v []*refs.ObjectID) { if x != nil { diff --git a/v2/audit/grpc/types.pb.go b/v2/audit/grpc/types.pb.go index 10158d4..32daf3a 100644 --- a/v2/audit/grpc/types.pb.go +++ b/v2/audit/grpc/types.pb.go @@ -33,30 +33,35 @@ type DataAuditResult struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields + // Data Audit Result format version. Effectively the version of API library + // used to report DataAuditResult structure. + Version *grpc.Version `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` // Epoch number when the Data Audit was conducted - AuditEpoch uint64 `protobuf:"fixed64,1,opt,name=audit_epoch,json=auditEpoch,proto3" json:"audit_epoch,omitempty"` + AuditEpoch uint64 `protobuf:"fixed64,2,opt,name=audit_epoch,json=auditEpoch,proto3" json:"audit_epoch,omitempty"` // Container under audit - ContainerId *grpc.ContainerID `protobuf:"bytes,2,opt,name=container_id,json=containerID,proto3" json:"container_id,omitempty"` + ContainerId *grpc.ContainerID `protobuf:"bytes,3,opt,name=container_id,json=containerID,proto3" json:"container_id,omitempty"` // Public key of the auditing InnerRing node in a binary format - PublicKey []byte `protobuf:"bytes,3,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"` + PublicKey []byte `protobuf:"bytes,4,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"` + // Shows if Data Audit process was complete in time or if it was cancelled + Complete bool `protobuf:"varint,5,opt,name=complete,proto3" json:"complete,omitempty"` // List of Storage Groups that passed audit PoR stage - PassSg []*grpc.ObjectID `protobuf:"bytes,4,rep,name=pass_sg,json=passSG,proto3" json:"pass_sg,omitempty"` + PassSg []*grpc.ObjectID `protobuf:"bytes,6,rep,name=pass_sg,json=passSG,proto3" json:"pass_sg,omitempty"` // List of Storage Groups that failed audit PoR stage - FailSg []*grpc.ObjectID `protobuf:"bytes,5,rep,name=fail_sg,json=failSG,proto3" json:"fail_sg,omitempty"` + FailSg []*grpc.ObjectID `protobuf:"bytes,7,rep,name=fail_sg,json=failSG,proto3" json:"fail_sg,omitempty"` // Number of sampled objects under audit placed in an optimal way according to // the containers placement policy when checking PoP - Hit uint32 `protobuf:"varint,6,opt,name=hit,proto3" json:"hit,omitempty"` + Hit uint32 `protobuf:"varint,8,opt,name=hit,proto3" json:"hit,omitempty"` // Number of sampled objects under audit placed in suboptimal way according to // the containers placement policy, but still at a satisfactory level when // checking PoP - Miss uint32 `protobuf:"varint,7,opt,name=miss,proto3" json:"miss,omitempty"` + Miss uint32 `protobuf:"varint,9,opt,name=miss,proto3" json:"miss,omitempty"` // Number of sampled objects under audit stored in a way not confirming // placement policy or not found at all when checking PoP - Fail uint32 `protobuf:"varint,8,opt,name=fail,proto3" json:"fail,omitempty"` + Fail uint32 `protobuf:"varint,10,opt,name=fail,proto3" json:"fail,omitempty"` // List of storage node public keys that passed at least one PDP - PassNodes [][]byte `protobuf:"bytes,9,rep,name=pass_nodes,json=passNodes,proto3" json:"pass_nodes,omitempty"` + PassNodes [][]byte `protobuf:"bytes,11,rep,name=pass_nodes,json=passNodes,proto3" json:"pass_nodes,omitempty"` // List of storage node public keys that failed at least one PDP - FailNodes [][]byte `protobuf:"bytes,10,rep,name=fail_nodes,json=failNodes,proto3" json:"fail_nodes,omitempty"` + FailNodes [][]byte `protobuf:"bytes,12,rep,name=fail_nodes,json=failNodes,proto3" json:"fail_nodes,omitempty"` } func (x *DataAuditResult) Reset() { @@ -91,6 +96,13 @@ func (*DataAuditResult) Descriptor() ([]byte, []int) { return file_v2_audit_grpc_types_proto_rawDescGZIP(), []int{0} } +func (x *DataAuditResult) GetVersion() *grpc.Version { + if x != nil { + return x.Version + } + return nil +} + func (x *DataAuditResult) GetAuditEpoch() uint64 { if x != nil { return x.AuditEpoch @@ -112,6 +124,13 @@ func (x *DataAuditResult) GetPublicKey() []byte { return nil } +func (x *DataAuditResult) GetComplete() bool { + if x != nil { + return x.Complete + } + return false +} + func (x *DataAuditResult) GetPassSg() []*grpc.ObjectID { if x != nil { return x.PassSg @@ -168,35 +187,40 @@ var file_v2_audit_grpc_types_proto_rawDesc = []byte{ 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0f, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x75, 0x64, 0x69, 0x74, 0x1a, 0x18, 0x76, 0x32, 0x2f, 0x72, 0x65, 0x66, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xef, 0x02, 0x0a, 0x0f, 0x44, 0x61, 0x74, 0x61, 0x41, - 0x75, 0x64, 0x69, 0x74, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x61, 0x75, - 0x64, 0x69, 0x74, 0x5f, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x06, 0x52, - 0x0a, 0x61, 0x75, 0x64, 0x69, 0x74, 0x45, 0x70, 0x6f, 0x63, 0x68, 0x12, 0x3e, 0x0a, 0x0c, 0x63, - 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, - 0x66, 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x52, 0x0b, - 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x12, 0x1d, 0x0a, 0x0a, 0x70, - 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, - 0x09, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x12, 0x31, 0x0a, 0x07, 0x70, 0x61, - 0x73, 0x73, 0x5f, 0x73, 0x67, 0x18, 0x04, 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, 0x06, 0x70, 0x61, 0x73, 0x73, 0x53, 0x47, 0x12, 0x31, 0x0a, - 0x07, 0x66, 0x61, 0x69, 0x6c, 0x5f, 0x73, 0x67, 0x18, 0x05, 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, 0x06, 0x66, 0x61, 0x69, 0x6c, 0x53, 0x47, - 0x12, 0x10, 0x0a, 0x03, 0x68, 0x69, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x03, 0x68, - 0x69, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6d, 0x69, 0x73, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0d, - 0x52, 0x04, 0x6d, 0x69, 0x73, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x66, 0x61, 0x69, 0x6c, 0x18, 0x08, - 0x20, 0x01, 0x28, 0x0d, 0x52, 0x04, 0x66, 0x61, 0x69, 0x6c, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x61, - 0x73, 0x73, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x09, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x09, - 0x70, 0x61, 0x73, 0x73, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x66, 0x61, 0x69, - 0x6c, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x09, 0x66, - 0x61, 0x69, 0x6c, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x42, 0x4c, 0x5a, 0x35, 0x67, 0x69, 0x74, 0x68, - 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, - 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, - 0x2f, 0x61, 0x75, 0x64, 0x69, 0x74, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x61, 0x75, 0x64, 0x69, - 0x74, 0xaa, 0x02, 0x12, 0x4e, 0x65, 0x6f, 0x46, 0x53, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x76, 0x32, - 0x2e, 0x41, 0x75, 0x64, 0x69, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xbe, 0x03, 0x0a, 0x0f, 0x44, 0x61, 0x74, 0x61, 0x41, + 0x75, 0x64, 0x69, 0x74, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 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, 0x1f, 0x0a, + 0x0b, 0x61, 0x75, 0x64, 0x69, 0x74, 0x5f, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x06, 0x52, 0x0a, 0x61, 0x75, 0x64, 0x69, 0x74, 0x45, 0x70, 0x6f, 0x63, 0x68, 0x12, 0x3e, + 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, + 0x44, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x12, 0x1d, + 0x0a, 0x0a, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x0c, 0x52, 0x09, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x12, 0x1a, 0x0a, + 0x08, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, + 0x08, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x12, 0x31, 0x0a, 0x07, 0x70, 0x61, 0x73, + 0x73, 0x5f, 0x73, 0x67, 0x18, 0x06, 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, 0x06, 0x70, 0x61, 0x73, 0x73, 0x53, 0x47, 0x12, 0x31, 0x0a, 0x07, + 0x66, 0x61, 0x69, 0x6c, 0x5f, 0x73, 0x67, 0x18, 0x07, 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, 0x06, 0x66, 0x61, 0x69, 0x6c, 0x53, 0x47, 0x12, + 0x10, 0x0a, 0x03, 0x68, 0x69, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x03, 0x68, 0x69, + 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6d, 0x69, 0x73, 0x73, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0d, 0x52, + 0x04, 0x6d, 0x69, 0x73, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x66, 0x61, 0x69, 0x6c, 0x18, 0x0a, 0x20, + 0x01, 0x28, 0x0d, 0x52, 0x04, 0x66, 0x61, 0x69, 0x6c, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x61, 0x73, + 0x73, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x0b, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x09, 0x70, + 0x61, 0x73, 0x73, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x66, 0x61, 0x69, 0x6c, + 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x0c, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x09, 0x66, 0x61, + 0x69, 0x6c, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x42, 0x4c, 0x5a, 0x35, 0x67, 0x69, 0x74, 0x68, 0x75, + 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, + 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, + 0x61, 0x75, 0x64, 0x69, 0x74, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x61, 0x75, 0x64, 0x69, 0x74, + 0xaa, 0x02, 0x12, 0x4e, 0x65, 0x6f, 0x46, 0x53, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x76, 0x32, 0x2e, + 0x41, 0x75, 0x64, 0x69, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -214,18 +238,20 @@ func file_v2_audit_grpc_types_proto_rawDescGZIP() []byte { var file_v2_audit_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 1) var file_v2_audit_grpc_types_proto_goTypes = []interface{}{ (*DataAuditResult)(nil), // 0: neo.fs.v2.audit.DataAuditResult - (*grpc.ContainerID)(nil), // 1: neo.fs.v2.refs.ContainerID - (*grpc.ObjectID)(nil), // 2: neo.fs.v2.refs.ObjectID + (*grpc.Version)(nil), // 1: neo.fs.v2.refs.Version + (*grpc.ContainerID)(nil), // 2: neo.fs.v2.refs.ContainerID + (*grpc.ObjectID)(nil), // 3: neo.fs.v2.refs.ObjectID } var file_v2_audit_grpc_types_proto_depIdxs = []int32{ - 1, // 0: neo.fs.v2.audit.DataAuditResult.container_id:type_name -> neo.fs.v2.refs.ContainerID - 2, // 1: neo.fs.v2.audit.DataAuditResult.pass_sg:type_name -> neo.fs.v2.refs.ObjectID - 2, // 2: neo.fs.v2.audit.DataAuditResult.fail_sg:type_name -> neo.fs.v2.refs.ObjectID - 3, // [3:3] is the sub-list for method output_type - 3, // [3:3] is the sub-list for method input_type - 3, // [3:3] is the sub-list for extension type_name - 3, // [3:3] is the sub-list for extension extendee - 0, // [0:3] is the sub-list for field type_name + 1, // 0: neo.fs.v2.audit.DataAuditResult.version:type_name -> neo.fs.v2.refs.Version + 2, // 1: neo.fs.v2.audit.DataAuditResult.container_id:type_name -> neo.fs.v2.refs.ContainerID + 3, // 2: neo.fs.v2.audit.DataAuditResult.pass_sg:type_name -> neo.fs.v2.refs.ObjectID + 3, // 3: neo.fs.v2.audit.DataAuditResult.fail_sg:type_name -> neo.fs.v2.refs.ObjectID + 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_v2_audit_grpc_types_proto_init() } diff --git a/v2/audit/marshal.go b/v2/audit/marshal.go index c0174c7..9aedb16 100644 --- a/v2/audit/marshal.go +++ b/v2/audit/marshal.go @@ -9,9 +9,11 @@ import ( const ( _ = iota + versionFNum auditEpochFNum cidFNum pubKeyFNum + completeFNum passSGFNum failSGFNum hitFNum @@ -37,6 +39,13 @@ func (a *DataAuditResult) StableMarshal(buf []byte) ([]byte, error) { err error ) + n, err = proto.NestedStructureMarshal(versionFNum, buf[offset:], a.version) + if err != nil { + return nil, err + } + + offset += n + n, err = proto.Fixed64Marshal(auditEpochFNum, buf[offset:], a.auditEpoch) if err != nil { return nil, err @@ -58,6 +67,13 @@ func (a *DataAuditResult) StableMarshal(buf []byte) ([]byte, error) { offset += n + n, err = proto.BoolMarshal(completeFNum, buf[offset:], a.complete) + if err != nil { + return nil, err + } + + offset += n + n, err = refs.ObjectIDNestedListMarshal(passSGFNum, buf[offset:], a.passSG) if err != nil { return nil, err @@ -115,9 +131,11 @@ func (a *DataAuditResult) StableSize() (size int) { return 0 } + size += proto.NestedStructureSize(versionFNum, a.version) size += proto.Fixed64Size(auditEpochFNum, a.auditEpoch) size += proto.NestedStructureSize(cidFNum, a.cid) size += proto.BytesSize(pubKeyFNum, a.pubKey) + size += proto.BoolSize(completeFNum, a.complete) size += refs.ObjectIDNestedListSize(passSGFNum, a.passSG) size += refs.ObjectIDNestedListSize(failSGFNum, a.failSG) size += proto.UInt32Size(hitFNum, a.hit) diff --git a/v2/audit/marshal_test.go b/v2/audit/marshal_test.go index bb80652..e9212ed 100644 --- a/v2/audit/marshal_test.go +++ b/v2/audit/marshal_test.go @@ -25,6 +25,10 @@ func TestDataAuditResult_StableMarshal(t *testing.T) { func generateDataAuditResult() *audit.DataAuditResult { a := new(audit.DataAuditResult) + v := new(refs.Version) + v.SetMajor(2) + v.SetMinor(1) + oid1 := new(refs.ObjectID) oid1.SetValue([]byte("Object ID 1")) @@ -34,9 +38,11 @@ func generateDataAuditResult() *audit.DataAuditResult { cid := new(refs.ContainerID) cid.SetValue([]byte("Container ID")) + a.SetVersion(v) a.SetAuditEpoch(13) a.SetContainerID(cid) a.SetPublicKey([]byte("Public key")) + a.SetComplete(true) a.SetPassSG([]*refs.ObjectID{oid1, oid2}) a.SetFailSG([]*refs.ObjectID{oid2, oid1}) a.SetHit(1) diff --git a/v2/audit/types.go b/v2/audit/types.go index 97676e1..67a6fd3 100644 --- a/v2/audit/types.go +++ b/v2/audit/types.go @@ -7,6 +7,8 @@ import ( // DataAuditResult is a unified structure of // DataAuditResult message from proto definition. type DataAuditResult struct { + version *refs.Version + auditEpoch uint64 hit, miss, fail uint32 @@ -18,6 +20,24 @@ type DataAuditResult struct { passSG, failSG []*refs.ObjectID failNodes, passNodes [][]byte + + complete bool +} + +// GetVersion returns version of Data Audit structure. +func (a *DataAuditResult) GetVersion() *refs.Version { + if a != nil { + return a.version + } + + return nil +} + +// SetVersion sets version of Data Audit structure. +func (a *DataAuditResult) SetVersion(v *refs.Version) { + if a != nil { + a.version = v + } } // GetAuditEpoch returns epoch number when the Data Audit was conducted. @@ -195,3 +215,19 @@ func (a *DataAuditResult) SetFailNodes(v [][]byte) { a.failNodes = v } } + +// GetComplete returns boolean completion statement of audit result. +func (a *DataAuditResult) GetComplete() bool { + if a != nil { + return a.complete + } + + return false // bool default +} + +// SetComplete sets boolean completion statement of audit result. +func (a *DataAuditResult) SetComplete(v bool) { + if a != nil { + a.complete = v + } +} From aafeb70bdbba01c36fb660613871c454f0653753 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Wed, 23 Dec 2020 18:45:00 +0300 Subject: [PATCH 0645/1196] [#235] v2/audit: Regenerate protobuf Signed-off-by: Alex Vanin --- pkg/audit/result.go | 28 ++++++++++++++ pkg/audit/result_test.go | 10 +++++ v2/audit/convert.go | 6 +++ v2/audit/grpc/types.go | 14 +++++++ v2/audit/grpc/types.pb.go | 78 +++++++++++++++++++++++++-------------- v2/audit/marshal.go | 18 +++++++++ v2/audit/marshal_test.go | 2 + v2/audit/types.go | 38 +++++++++++++++++++ 8 files changed, 166 insertions(+), 28 deletions(-) diff --git a/pkg/audit/result.go b/pkg/audit/result.go index 6f5ea9f..9ebb564 100644 --- a/pkg/audit/result.go +++ b/pkg/audit/result.go @@ -124,6 +124,34 @@ func (r *Result) SetComplete(v bool) { SetComplete(v) } +// Requests returns number of requests made by PoR audit check to get +// all headers of the objects inside storage groups. +func (r *Result) Requests() uint32 { + return (*audit.DataAuditResult)(r). + GetRequests() +} + +// SetRequests sets number of requests made by PoR audit check to get +// all headers of the objects inside storage groups. +func (r *Result) SetRequests(v uint32) { + (*audit.DataAuditResult)(r). + SetRequests(v) +} + +// Retries returns number of retries made by PoR audit check to get +// all headers of the objects inside storage groups. +func (r *Result) Retries() uint32 { + return (*audit.DataAuditResult)(r). + GetRetries() +} + +// SetRetries sets number of retries made by PoR audit check to get +// all headers of the objects inside storage groups. +func (r *Result) SetRetries(v uint32) { + (*audit.DataAuditResult)(r). + SetRetries(v) +} + // PassSG returns list of Storage Groups that passed audit PoR stage. func (r *Result) PassSG() []*object.ID { mV2 := (*audit.DataAuditResult)(r). diff --git a/pkg/audit/result_test.go b/pkg/audit/result_test.go index 57038a3..af4a497 100644 --- a/pkg/audit/result_test.go +++ b/pkg/audit/result_test.go @@ -50,6 +50,14 @@ func TestResult(t *testing.T) { r.SetComplete(true) require.True(t, r.Complete()) + requests := uint32(2) + r.SetRequests(requests) + require.Equal(t, requests, r.Requests()) + + retries := uint32(1) + r.SetRetries(retries) + require.Equal(t, retries, r.Retries()) + passSG := []*object.ID{testOID(), testOID()} r.SetPassSG(passSG) require.Equal(t, passSG, r.PassSG()) @@ -86,6 +94,8 @@ func TestStorageGroupEncoding(t *testing.T) { r.SetPublicKey([]byte{1, 2, 3}) r.SetPassSG([]*object.ID{testOID(), testOID()}) r.SetFailSG([]*object.ID{testOID(), testOID()}) + r.SetRequests(3) + r.SetRetries(2) r.SetHit(1) r.SetMiss(2) r.SetFail(3) diff --git a/v2/audit/convert.go b/v2/audit/convert.go index 4384953..6402041 100644 --- a/v2/audit/convert.go +++ b/v2/audit/convert.go @@ -36,6 +36,9 @@ func DataAuditResultToGRPCMessage(a *DataAuditResult) *audit.DataAuditResult { refs.ObjectIDListToGRPCMessage(a.GetFailSG()), ) + m.SetRequests(a.GetRequests()) + m.SetRetries(a.GetRetries()) + m.SetHit(a.GetHit()) m.SetMiss(a.GetMiss()) m.SetFail(a.GetFail()) @@ -77,6 +80,9 @@ func DataAuditResultFromGRPCMessage(m *audit.DataAuditResult) *DataAuditResult { refs.ObjectIDListFromGRPCMessage(m.GetFailSg()), ) + a.SetRequests(m.GetRequests()) + a.SetRetries(m.GetRetries()) + a.SetHit(m.GetHit()) a.SetMiss(m.GetMiss()) a.SetFail(m.GetFail()) diff --git a/v2/audit/grpc/types.go b/v2/audit/grpc/types.go index 2c225ef..d8dd0d1 100644 --- a/v2/audit/grpc/types.go +++ b/v2/audit/grpc/types.go @@ -39,6 +39,20 @@ func (x *DataAuditResult) SetComplete(v bool) { } } +// SetRequests is a Requests field setter. +func (x *DataAuditResult) SetRequests(v uint32) { + if x != nil { + x.Requests = v + } +} + +// SetRetries is a Retries field setter. +func (x *DataAuditResult) SetRetries(v uint32) { + if x != nil { + x.Retries = v + } +} + // SetPassSg is a PassSg field setter. func (x *DataAuditResult) SetPassSg(v []*refs.ObjectID) { if x != nil { diff --git a/v2/audit/grpc/types.pb.go b/v2/audit/grpc/types.pb.go index 32daf3a..dddc441 100644 --- a/v2/audit/grpc/types.pb.go +++ b/v2/audit/grpc/types.pb.go @@ -44,24 +44,28 @@ type DataAuditResult struct { PublicKey []byte `protobuf:"bytes,4,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"` // Shows if Data Audit process was complete in time or if it was cancelled Complete bool `protobuf:"varint,5,opt,name=complete,proto3" json:"complete,omitempty"` + // Number of request done at PoR stage + Requests uint32 `protobuf:"varint,6,opt,name=requests,proto3" json:"requests,omitempty"` + // Number of retries done at PoR stage + Retries uint32 `protobuf:"varint,7,opt,name=retries,proto3" json:"retries,omitempty"` // List of Storage Groups that passed audit PoR stage - PassSg []*grpc.ObjectID `protobuf:"bytes,6,rep,name=pass_sg,json=passSG,proto3" json:"pass_sg,omitempty"` + PassSg []*grpc.ObjectID `protobuf:"bytes,8,rep,name=pass_sg,json=passSG,proto3" json:"pass_sg,omitempty"` // List of Storage Groups that failed audit PoR stage - FailSg []*grpc.ObjectID `protobuf:"bytes,7,rep,name=fail_sg,json=failSG,proto3" json:"fail_sg,omitempty"` + FailSg []*grpc.ObjectID `protobuf:"bytes,9,rep,name=fail_sg,json=failSG,proto3" json:"fail_sg,omitempty"` // Number of sampled objects under audit placed in an optimal way according to // the containers placement policy when checking PoP - Hit uint32 `protobuf:"varint,8,opt,name=hit,proto3" json:"hit,omitempty"` + Hit uint32 `protobuf:"varint,10,opt,name=hit,proto3" json:"hit,omitempty"` // Number of sampled objects under audit placed in suboptimal way according to // the containers placement policy, but still at a satisfactory level when // checking PoP - Miss uint32 `protobuf:"varint,9,opt,name=miss,proto3" json:"miss,omitempty"` + Miss uint32 `protobuf:"varint,11,opt,name=miss,proto3" json:"miss,omitempty"` // Number of sampled objects under audit stored in a way not confirming // placement policy or not found at all when checking PoP - Fail uint32 `protobuf:"varint,10,opt,name=fail,proto3" json:"fail,omitempty"` + Fail uint32 `protobuf:"varint,12,opt,name=fail,proto3" json:"fail,omitempty"` // List of storage node public keys that passed at least one PDP - PassNodes [][]byte `protobuf:"bytes,11,rep,name=pass_nodes,json=passNodes,proto3" json:"pass_nodes,omitempty"` + PassNodes [][]byte `protobuf:"bytes,13,rep,name=pass_nodes,json=passNodes,proto3" json:"pass_nodes,omitempty"` // List of storage node public keys that failed at least one PDP - FailNodes [][]byte `protobuf:"bytes,12,rep,name=fail_nodes,json=failNodes,proto3" json:"fail_nodes,omitempty"` + FailNodes [][]byte `protobuf:"bytes,14,rep,name=fail_nodes,json=failNodes,proto3" json:"fail_nodes,omitempty"` } func (x *DataAuditResult) Reset() { @@ -131,6 +135,20 @@ func (x *DataAuditResult) GetComplete() bool { return false } +func (x *DataAuditResult) GetRequests() uint32 { + if x != nil { + return x.Requests + } + return 0 +} + +func (x *DataAuditResult) GetRetries() uint32 { + if x != nil { + return x.Retries + } + return 0 +} + func (x *DataAuditResult) GetPassSg() []*grpc.ObjectID { if x != nil { return x.PassSg @@ -187,7 +205,7 @@ var file_v2_audit_grpc_types_proto_rawDesc = []byte{ 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0f, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x75, 0x64, 0x69, 0x74, 0x1a, 0x18, 0x76, 0x32, 0x2f, 0x72, 0x65, 0x66, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xbe, 0x03, 0x0a, 0x0f, 0x44, 0x61, 0x74, 0x61, 0x41, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xf4, 0x03, 0x0a, 0x0f, 0x44, 0x61, 0x74, 0x61, 0x41, 0x75, 0x64, 0x69, 0x74, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 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, @@ -201,26 +219,30 @@ var file_v2_audit_grpc_types_proto_rawDesc = []byte{ 0x0a, 0x0a, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, - 0x08, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x12, 0x31, 0x0a, 0x07, 0x70, 0x61, 0x73, - 0x73, 0x5f, 0x73, 0x67, 0x18, 0x06, 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, 0x06, 0x70, 0x61, 0x73, 0x73, 0x53, 0x47, 0x12, 0x31, 0x0a, 0x07, - 0x66, 0x61, 0x69, 0x6c, 0x5f, 0x73, 0x67, 0x18, 0x07, 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, 0x06, 0x66, 0x61, 0x69, 0x6c, 0x53, 0x47, 0x12, - 0x10, 0x0a, 0x03, 0x68, 0x69, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x03, 0x68, 0x69, - 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6d, 0x69, 0x73, 0x73, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0d, 0x52, - 0x04, 0x6d, 0x69, 0x73, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x66, 0x61, 0x69, 0x6c, 0x18, 0x0a, 0x20, - 0x01, 0x28, 0x0d, 0x52, 0x04, 0x66, 0x61, 0x69, 0x6c, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x61, 0x73, - 0x73, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x0b, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x09, 0x70, - 0x61, 0x73, 0x73, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x66, 0x61, 0x69, 0x6c, - 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x0c, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x09, 0x66, 0x61, - 0x69, 0x6c, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x42, 0x4c, 0x5a, 0x35, 0x67, 0x69, 0x74, 0x68, 0x75, - 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, - 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, - 0x61, 0x75, 0x64, 0x69, 0x74, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x61, 0x75, 0x64, 0x69, 0x74, - 0xaa, 0x02, 0x12, 0x4e, 0x65, 0x6f, 0x46, 0x53, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x76, 0x32, 0x2e, - 0x41, 0x75, 0x64, 0x69, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x08, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x72, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x74, 0x72, 0x69, 0x65, 0x73, + 0x18, 0x07, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x72, 0x65, 0x74, 0x72, 0x69, 0x65, 0x73, 0x12, + 0x31, 0x0a, 0x07, 0x70, 0x61, 0x73, 0x73, 0x5f, 0x73, 0x67, 0x18, 0x08, 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, 0x06, 0x70, 0x61, 0x73, 0x73, + 0x53, 0x47, 0x12, 0x31, 0x0a, 0x07, 0x66, 0x61, 0x69, 0x6c, 0x5f, 0x73, 0x67, 0x18, 0x09, 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, 0x06, 0x66, + 0x61, 0x69, 0x6c, 0x53, 0x47, 0x12, 0x10, 0x0a, 0x03, 0x68, 0x69, 0x74, 0x18, 0x0a, 0x20, 0x01, + 0x28, 0x0d, 0x52, 0x03, 0x68, 0x69, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6d, 0x69, 0x73, 0x73, 0x18, + 0x0b, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x04, 0x6d, 0x69, 0x73, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x66, + 0x61, 0x69, 0x6c, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x04, 0x66, 0x61, 0x69, 0x6c, 0x12, + 0x1d, 0x0a, 0x0a, 0x70, 0x61, 0x73, 0x73, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x0d, 0x20, + 0x03, 0x28, 0x0c, 0x52, 0x09, 0x70, 0x61, 0x73, 0x73, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x12, 0x1d, + 0x0a, 0x0a, 0x66, 0x61, 0x69, 0x6c, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x0e, 0x20, 0x03, + 0x28, 0x0c, 0x52, 0x09, 0x66, 0x61, 0x69, 0x6c, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x42, 0x4c, 0x5a, + 0x35, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, + 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, + 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x61, 0x75, 0x64, 0x69, 0x74, 0x2f, 0x67, 0x72, 0x70, 0x63, + 0x3b, 0x61, 0x75, 0x64, 0x69, 0x74, 0xaa, 0x02, 0x12, 0x4e, 0x65, 0x6f, 0x46, 0x53, 0x2e, 0x41, + 0x50, 0x49, 0x2e, 0x76, 0x32, 0x2e, 0x41, 0x75, 0x64, 0x69, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, } var ( diff --git a/v2/audit/marshal.go b/v2/audit/marshal.go index 9aedb16..f1a0c59 100644 --- a/v2/audit/marshal.go +++ b/v2/audit/marshal.go @@ -14,6 +14,8 @@ const ( cidFNum pubKeyFNum completeFNum + requestsFNum + retriesFNum passSGFNum failSGFNum hitFNum @@ -74,6 +76,20 @@ func (a *DataAuditResult) StableMarshal(buf []byte) ([]byte, error) { offset += n + n, err = proto.UInt32Marshal(requestsFNum, buf[offset:], a.requests) + if err != nil { + return nil, err + } + + offset += n + + n, err = proto.UInt32Marshal(retriesFNum, buf[offset:], a.retries) + if err != nil { + return nil, err + } + + offset += n + n, err = refs.ObjectIDNestedListMarshal(passSGFNum, buf[offset:], a.passSG) if err != nil { return nil, err @@ -136,6 +152,8 @@ func (a *DataAuditResult) StableSize() (size int) { size += proto.NestedStructureSize(cidFNum, a.cid) size += proto.BytesSize(pubKeyFNum, a.pubKey) size += proto.BoolSize(completeFNum, a.complete) + size += proto.UInt32Size(requestsFNum, a.requests) + size += proto.UInt32Size(retriesFNum, a.retries) size += refs.ObjectIDNestedListSize(passSGFNum, a.passSG) size += refs.ObjectIDNestedListSize(failSGFNum, a.failSG) size += proto.UInt32Size(hitFNum, a.hit) diff --git a/v2/audit/marshal_test.go b/v2/audit/marshal_test.go index e9212ed..bac2dbe 100644 --- a/v2/audit/marshal_test.go +++ b/v2/audit/marshal_test.go @@ -43,6 +43,8 @@ func generateDataAuditResult() *audit.DataAuditResult { a.SetContainerID(cid) a.SetPublicKey([]byte("Public key")) a.SetComplete(true) + a.SetRequests(10) + a.SetRetries(9) a.SetPassSG([]*refs.ObjectID{oid1, oid2}) a.SetFailSG([]*refs.ObjectID{oid2, oid1}) a.SetHit(1) diff --git a/v2/audit/types.go b/v2/audit/types.go index 67a6fd3..35aa52a 100644 --- a/v2/audit/types.go +++ b/v2/audit/types.go @@ -11,6 +11,8 @@ type DataAuditResult struct { auditEpoch uint64 + requests, retries uint32 + hit, miss, fail uint32 cid *refs.ContainerID @@ -120,6 +122,42 @@ func (a *DataAuditResult) SetFailSG(v []*refs.ObjectID) { } } +// GetRequests returns number of requests made by PoR audit check to get +// all headers of the objects inside storage groups. +func (a *DataAuditResult) GetRequests() uint32 { + if a != nil { + return a.requests + } + + return 0 +} + +// SetRequests sets number of requests made by PoR audit check to get +// all headers of the objects inside storage groups. +func (a *DataAuditResult) SetRequests(v uint32) { + if a != nil { + a.requests = v + } +} + +// GetRetries returns number of retries made by PoR audit check to get +// all headers of the objects inside storage groups. +func (a *DataAuditResult) GetRetries() uint32 { + if a != nil { + return a.retries + } + + return 0 +} + +// SetRetries sets number of retries made by PoR audit check to get +// all headers of the objects inside storage groups. +func (a *DataAuditResult) SetRetries(v uint32) { + if a != nil { + a.retries = v + } +} + // GetHit returns number of sampled objects under audit placed // in an optimal way according to the containers placement policy // when checking PoP. From f0a0bc4cda8b1fa947b61527a8365a2991109ba0 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 25 Dec 2020 15:59:42 +0300 Subject: [PATCH 0646/1196] Update changelog and readme for v1.22.0 Signed-off-by: Leonard Lyubich --- CHANGELOG.md | 19 +++++++++++++++++++ README.md | 1 + 2 files changed, 20 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 793be7a..24033a5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,23 @@ # Changelog +## [1.22.0] - 2020-12-XX - Yeouido (여의도, 汝矣島) + +Support changes from NeoFS API Yeouido. + +### Added + +- Payload hash field to `ShortHeader` message. +- Payload homomorphic hash field to `ShortHeader` message. +- Support of `StorageGroup` message. +- Support of `DataAuditResult` message. +- Stringer and string parser for `Checksum` type of client library. +- Stringer and string parser for `Type` message. +- Stringer and string parser for `Type` type of client library. +- `AddTypeFilter` method on `SearchFilters` type of client library + that adds filter by object type. +- Utility functions for working with `fixed64` protobuf type to `proto` library. +- Converters for `repeated` object ID messages in `v2` library. + ## [1.21.2] - 2020-12-24 ### Added @@ -488,3 +506,4 @@ Initial public release [1.21.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.20.3...v1.21.0 [1.21.1]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.21.0...v1.21.1 [1.21.2]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.21.1...v1.21.2 +[1.22.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.21.2...v1.22.0 diff --git a/README.md b/README.md index a960339..19ed248 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,7 @@ versions and SDK layer working with all of them in a handy way. |< v1.20.0 **(unsupported)**|up to v1.2.0| |v1.20.x|[v2.0.2](https://github.com/nspcc-dev/neofs-api/releases/tag/v2.0.2)| |v1.21.x|[v2.1.0](https://github.com/nspcc-dev/neofs-api/releases/tag/v2.1.0)| +|v1.22.x|[v2.2.0](https://github.com/nspcc-dev/neofs-api/releases/tag/v2.2.0)| ## Contributing From 0f740d51d9359ee4717d461da7bf8936478577fe Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Wed, 30 Dec 2020 12:21:58 +0300 Subject: [PATCH 0647/1196] =?UTF-8?q?Release=20v1.22.0=20-=20Yeouido=20(?= =?UTF-8?q?=EC=97=AC=EC=9D=98=EB=8F=84,=20=E6=B1=9D=E7=9F=A3=E5=B3=B6)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Alex Vanin --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 24033a5..264a7c5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -## [1.22.0] - 2020-12-XX - Yeouido (여의도, 汝矣島) +## [1.22.0] - 2020-12-30 - Yeouido (여의도, 汝矣島) Support changes from NeoFS API Yeouido. From aa55079b698e8238489368f13b1b241f57176930 Mon Sep 17 00:00:00 2001 From: Stanislav Bogatyrev Date: Wed, 30 Dec 2020 12:32:29 +0300 Subject: [PATCH 0648/1196] Minor typo fixes Signed-off-by: Stanislav Bogatyrev --- CHANGELOG.md | 2 +- CONTRIBUTING.md | 4 ++-- Makefile | 4 ++-- README.md | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 264a7c5..856e28e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ ## [1.22.0] - 2020-12-30 - Yeouido (여의도, 汝矣島) -Support changes from NeoFS API Yeouido. +Support changes from NeoFS API v2.2.0 "Yeouido" release. ### Added diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 9e40175..99dfb26 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -25,7 +25,7 @@ Start by forking the `neofs-api-go` repository, make changes in a branch and the send a pull request. We encourage pull requests to discuss code changes. Here are the steps in details: -### Setup your GitHub Repository +### Set up your GitHub Repository Fork [NeoFS node upstream](https://github.com/nspcc-dev/neofs-api-go/fork) source repository to your own personal repository. Copy the URL of your fork (you will need it for the `git clone` command below). @@ -109,7 +109,7 @@ Signed-off-by: Samii Sakisaka This can easily be done with the `--signoff` option to `git commit`. By doing this you state that you can certify the following (from [The Developer -Certificate of Origin](https://developercertificate.org/): +Certificate of Origin](https://developercertificate.org/)): ``` Developer Certificate of Origin diff --git a/Makefile b/Makefile index 72a8f89..c38de89 100644 --- a/Makefile +++ b/Makefile @@ -20,7 +20,7 @@ dep: GO111MODULE=on \ go test -i ./... && echo OK -# Run all code formaters +# Run all code formatters fmts: fmt imports # Reformat code @@ -53,7 +53,7 @@ protoc: # Run Unit Test with go test test: - @echo "⇒ Runnning go test" + @echo "⇒ Running go test" @GO111MODULE=on go test ./... # Run linters diff --git a/README.md b/README.md index 19ed248..94bb623 100644 --- a/README.md +++ b/README.md @@ -32,8 +32,8 @@ versions and SDK layer working with all of them in a handy way. Feel free to contribute to this project after reading the [contributing guidelines](CONTRIBUTING.md). -Before starting to work on a certain topic, create an new issue first, -describing the feature/topic you are going to implement. +Before starting to work on a certain topic, create a new issue first, describing +the feature/topic you are going to implement. ## License From f8018f9c3d38cdbfc664aee6026bb8abd1acd233 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 11 Jan 2021 18:14:07 +0300 Subject: [PATCH 0649/1196] [#241] v2/session: Define keys of the well-known X-headers Signed-off-by: Leonard Lyubich --- v2/session/grpc/service.pb.go | 2 +- v2/session/grpc/types.pb.go | 20 +++++++++++++++++++- v2/session/xheaders.go | 16 ++++++++++++++++ 3 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 v2/session/xheaders.go diff --git a/v2/session/grpc/service.pb.go b/v2/session/grpc/service.pb.go index e18b8f3..223c38b 100644 --- a/v2/session/grpc/service.pb.go +++ b/v2/session/grpc/service.pb.go @@ -176,7 +176,7 @@ type CreateRequest_Body struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // Dession initiating user's or node's key derived `OwnerID`. + // Session initiating user's or node's key derived `OwnerID` OwnerId *grpc.OwnerID `protobuf:"bytes,1,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"` // Session expiration `Epoch` Expiration uint64 `protobuf:"varint,2,opt,name=expiration,proto3" json:"expiration,omitempty"` diff --git a/v2/session/grpc/types.pb.go b/v2/session/grpc/types.pb.go index fe557fd..aba3ceb 100644 --- a/v2/session/grpc/types.pb.go +++ b/v2/session/grpc/types.pb.go @@ -218,7 +218,25 @@ func (x *SessionToken) GetSignature() *grpc.Signature { return nil } -// Extended headers for Request/Response. +// Extended headers for Request/Response. May contain any user-defined headers +// to be interpreted on application level. +// +// Key name must be unique valid UTF-8 string. Value can't be empty. Requests or +// Responses with duplicated header names or headers with empty values will be +// considered invalid. +// +// There are some "well-known" headers starting with `__NEOFS__` prefix that +// affect system behaviour: +// +// * __NEOFS__NETMAP_EPOCH \ +// Netmap epoch to use for object placement calculation. The `value` is string +// encoded `uint64` in decimal presentation. If set to '0' or not set, the +// current epoch only will be used. +// * __NEOFS__NETMAP_LOOKUP_DEPTH \ +// If object can't be found using current epoch's netmap, this header limits +// how many past epochs back the node can lookup. The `value` is string +// encoded `uint64` in decimal presentation. If set to '0' or not set, the +// current epoch only will be used. type XHeader struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache diff --git a/v2/session/xheaders.go b/v2/session/xheaders.go new file mode 100644 index 0000000..64b16de --- /dev/null +++ b/v2/session/xheaders.go @@ -0,0 +1,16 @@ +package session + +// ReservedXHeaderPrefix is a prefix of keys to "well-known" X-headers. +const ReservedXHeaderPrefix = "__NEOFS__" + +const ( + // XHeaderNetmapEpoch is a key to the reserved X-header that specifies netmap epoch + // to use for object placement calculation. If set to '0' or not set, the current + // epoch only will be used. + XHeaderNetmapEpoch = ReservedXHeaderPrefix + "NETMAP_EPOCH" + + // XHeaderNetmapLookupDepth is a key to the reserved X-header that limits + // how many past epochs back the node will can lookup. If set to '0' or not + // set, the current epoch only will be used. + XHeaderNetmapLookupDepth = ReservedXHeaderPrefix + "NETMAP_LOOKUP_DEPTH" +) From 0c9440c972604690a8709695023c2cf06bed5f26 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Mon, 11 Jan 2021 19:29:29 +0300 Subject: [PATCH 0650/1196] [#243] Update linter config Signed-off-by: Alex Vanin --- .golangci.yml | 174 +++++++++++++++----------------------------------- 1 file changed, 51 insertions(+), 123 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 7fc9abf..882a9ff 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,136 +1,64 @@ -# https://habr.com/company/roistat/blog/413175/ -# https://github.com/golangci/golangci-lint -linters-settings: - govet: - check-shadowing: false - golint: - # minimal confidence for issues, default is 0.8 - min-confidence: 0.8 - gofmt: - # simplify code: gofmt with `-s` option, true by default - simplify: true - gocyclo: - min-complexity: 30 - maligned: - suggest-new: true - dupl: - threshold: 100 - goconst: - min-len: 2 - min-occurrences: 2 - gosimple: - gocritic: - # Which checks should be enabled; can't be combined with 'disabled-checks'; - # See https://go-critic.github.io/overview#checks-overview - # To check which checks are enabled run `GL_DEBUG=gocritic golangci-lint run` - # By default list of stable checks is used. -# enabled-checks: -# - rangeValCopy - # Which checks should be disabled; can't be combined with 'enabled-checks'; default is empty - disabled-checks: - - regexpMust - # Enable multiple checks by tags, run `GL_DEBUG=gocritic golangci-lint` run to see all tags and checks. - # Empty list by default. See https://github.com/go-critic/go-critic#usage -> section "Tags". - enabled-tags: - - performance - - settings: # settings passed to gocritic - captLocal: # must be valid enabled check name - paramsOnly: true - rangeValCopy: - sizeThreshold: 32 -# depguard: -# list-type: blacklist -# include-go-root: false -# packages: -# - github.com/davecgh/go-spew/spew - lll: - # max line length, lines longer will be reported. Default is 120. - # '\t' is counted as 1 character by default, and can be changed with the tab-width option - line-length: 120 - # tab width in spaces. Default to 1. - tab-width: 1 - unused: - # treat code as a program (not a library) and report unused exported identifiers; default is false. - # XXX: if you enable this setting, unused will report a lot of false-positives in text editors: - # if it's called for subdir of a project it can't find funcs usages. All text editor integrations - # with golangci-lint call it on a directory with the changed file. - check-exported: false - unparam: - # Inspect exported functions, default is false. Set to true if no external program/library imports your code. - # XXX: if you enable this setting, unparam will report a lot of false-positives in text editors: - # if it's called for subdir of a project it can't find external interfaces. All text editor integrations - # with golangci-lint call it on a directory with the changed file. - check-exported: false - nakedret: - # make an issue if func has more lines of code than this setting and it has naked returns; default is 30 - max-func-lines: 30 - - -linters: - enable-all: true - fast: false - disable: - - gochecknoglobals -# - maligned -# - prealloc -# disable-all: false -# presets: -# - bugs -# - unused +# This file contains all available configuration options +# with their default values. # options for analysis running run: - # default concurrency is a available CPU number -# concurrency: 8 - # timeout for analysis, e.g. 30s, 5m, default is 1m -# deadline: 1m - - # exit code when at least one issue was found, default is 1 -# issues-exit-code: 1 + timeout: 2m # include test files or not, default is true -# tests: true - - # list of build tags, all linters use it. Default is empty list. -# build-tags: -# - mytag - - # which dirs to skip: they won't be analyzed; - # can use regexp here: generated.*, regexp is applied on full path; - # default value is empty list, but next dirs are always skipped independently - # from this option's value: - # vendor$, third_party$, testdata$, examples$, Godeps$, builtin$ -# skip-dirs: -# - src/external_libs -# - autogenerated_by_my_lib - - # which files to skip: they will be analyzed, but issues from them - # won't be reported. Default value is empty list, but there is - # no need to include all autogenerated files, we confidently recognize - # autogenerated files. If it's not please let us know. -# skip-files: -# - ".*\\.my\\.go$" -# - lib/bad.go - - # by default isn't set. If set we pass it to "go list -mod={option}". From "go help modules": - # If invoked with -mod=readonly, the go command is disallowed from the implicit - # automatic updating of go.mod described above. Instead, it fails when any changes - # to go.mod are needed. This setting is most useful to check that go.mod does - # not need updates, such as in a continuous integration and testing system. - # If invoked with -mod=vendor, the go command assumes that the vendor - # directory holds the correct copies of dependencies and ignores - # the dependency descriptions in go.mod. -# modules-download-mode: readonly|release|vendor + tests: false # output configuration options output: # colored-line-number|line-number|json|tab|checkstyle|code-climate, default is "colored-line-number" format: tab - # print lines of code with issue, default is true - print-issued-lines: true +# all available settings of specific linters +linters-settings: + exhaustive: + # indicates that switch statements are to be considered exhaustive if a + # 'default' case is present, even if all enum members aren't listed in the + # switch + default-signifies-exhaustive: true + govet: + # report about shadowed variables + check-shadowing: false - # print linter name in the end of issue text, default is true - print-linter-name: true \ No newline at end of file +linters: + enable: + # mandatory linters + - govet + - golint + + # some default golangci-lint linters + - errcheck + - gosimple + - ineffassign + - staticcheck + - typecheck + + # extra linters + - exhaustive + - gofmt + - whitespace + - goimports + disable-all: true + fast: false + +issues: + # Excluding configuration per-path, per-linter, per-text and per-source + exclude-rules: + - path: v2 # ignore stutters in universal structures due to protobuf compatibility + linters: + - golint + text: "stutters;" + + - path: grpc # ignore case errors in grpc setters due to protobuf compatibility + linters: + - golint + text: "should be" + + - linters: # ignore SA6002 since we use pool of []byte, however we can switch to *bytes.Buffer + - staticcheck + text: "SA6002:" \ No newline at end of file From 2fa752864f2349b1d67f601d5794c41a1ed0dcac Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Mon, 11 Jan 2021 19:30:37 +0300 Subject: [PATCH 0651/1196] [#243] Fix goimports linter errors Signed-off-by: Alex Vanin --- v2/netmap/grpc/service.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/v2/netmap/grpc/service.go b/v2/netmap/grpc/service.go index 8f27bfd..ae00b21 100644 --- a/v2/netmap/grpc/service.go +++ b/v2/netmap/grpc/service.go @@ -1,8 +1,8 @@ package netmap import ( - "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" - "github.com/nspcc-dev/neofs-api-go/v2/session/grpc" + refs "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" + session "github.com/nspcc-dev/neofs-api-go/v2/session/grpc" ) // SetBody sets body of the request. From 60a55ea6c1c9e086c8d96dfa9559fb10adf26fb8 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Mon, 11 Jan 2021 19:30:51 +0300 Subject: [PATCH 0652/1196] [#243] Fix whitespace linter errors Signed-off-by: Alex Vanin --- v2/netmap/grpc/types.go | 1 - 1 file changed, 1 deletion(-) diff --git a/v2/netmap/grpc/types.go b/v2/netmap/grpc/types.go index e478d98..e1e5a84 100644 --- a/v2/netmap/grpc/types.go +++ b/v2/netmap/grpc/types.go @@ -46,7 +46,6 @@ func (m *Filter) SetKey(v string) { func (m *Filter) SetOp(v Operation) { if m != nil { m.Op = v - } } From c2db2a54a1b89be7778dddd252e99a082b4d1868 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Mon, 11 Jan 2021 19:31:23 +0300 Subject: [PATCH 0653/1196] [#243] Fix exhaustive linter errors Signed-off-by: Alex Vanin --- pkg/netmap/filter.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkg/netmap/filter.go b/pkg/netmap/filter.go index 531645e..6838802 100644 --- a/pkg/netmap/filter.go +++ b/pkg/netmap/filter.go @@ -139,6 +139,8 @@ func (c *Context) matchKeyValue(f *Filter, b *Node) bool { return attr < c.numCache[f] case OpLE: return attr <= c.numCache[f] + default: + // do nothing and return false } } // will not happen if context was created from f (maybe panic?) From 8a8240045157b7982005217b46bc7023c0e2282e Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Mon, 11 Jan 2021 19:31:49 +0300 Subject: [PATCH 0654/1196] [#243] Fix golint linter errors Signed-off-by: Alex Vanin --- pkg/client/object.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/client/object.go b/pkg/client/object.go index cd6dbb4..34f7d04 100644 --- a/pkg/client/object.go +++ b/pkg/client/object.go @@ -332,7 +332,7 @@ func (p *DeleteObjectParams) TombstoneAddressTarget() ObjectAddressWriter { // DeleteObject is a wrapper over Client.DeleteObject method // that provides the ability to receive tombstone address // without setting a target in the parameters. -func DeleteObject(c *Client, ctx context.Context, p *DeleteObjectParams, opts ...CallOption) (*object.Address, error) { +func DeleteObject(ctx context.Context, c *Client, p *DeleteObjectParams, opts ...CallOption) (*object.Address, error) { w := new(objectAddressWriter) err := c.DeleteObject(ctx, p.WithTombstoneAddressTarget(w), opts...) From 43c579f6704dd232294010536d54d83d8adde2f6 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Mon, 11 Jan 2021 19:32:37 +0300 Subject: [PATCH 0655/1196] [#243] Fix ineffassign linter errors Signed-off-by: Alex Vanin --- v2/accounting/marshal.go | 2 +- v2/audit/marshal.go | 2 +- v2/netmap/marshal.go | 6 +++--- v2/object/marshal.go | 8 +++----- v2/storagegroup/marshal.go | 2 +- 5 files changed, 9 insertions(+), 11 deletions(-) diff --git a/v2/accounting/marshal.go b/v2/accounting/marshal.go index 684599f..e25ab90 100644 --- a/v2/accounting/marshal.go +++ b/v2/accounting/marshal.go @@ -36,7 +36,7 @@ func (d *Decimal) StableMarshal(buf []byte) ([]byte, error) { offset += n - n, err = protoutil.UInt32Marshal(decimalPrecisionField, buf[offset:], d.prec) + _, err = protoutil.UInt32Marshal(decimalPrecisionField, buf[offset:], d.prec) if err != nil { return nil, err } diff --git a/v2/audit/marshal.go b/v2/audit/marshal.go index f1a0c59..5ea8ef5 100644 --- a/v2/audit/marshal.go +++ b/v2/audit/marshal.go @@ -132,7 +132,7 @@ func (a *DataAuditResult) StableMarshal(buf []byte) ([]byte, error) { offset += n - n, err = proto.RepeatedBytesMarshal(failNodesFNum, buf[offset:], a.failNodes) + _, err = proto.RepeatedBytesMarshal(failNodesFNum, buf[offset:], a.failNodes) if err != nil { return nil, err } diff --git a/v2/netmap/marshal.go b/v2/netmap/marshal.go index b619628..32a6b76 100644 --- a/v2/netmap/marshal.go +++ b/v2/netmap/marshal.go @@ -159,7 +159,7 @@ func (s *Selector) StableMarshal(buf []byte) ([]byte, error) { offset += n - n, err = protoutil.StringMarshal(filterSelectorField, buf[offset:], s.filter) + _, err = protoutil.StringMarshal(filterSelectorField, buf[offset:], s.filter) if err != nil { return nil, err } @@ -209,7 +209,7 @@ func (r *Replica) StableMarshal(buf []byte) ([]byte, error) { offset += n - n, err = protoutil.StringMarshal(selectorReplicaField, buf[offset:], r.selector) + _, err = protoutil.StringMarshal(selectorReplicaField, buf[offset:], r.selector) if err != nil { return nil, err } @@ -418,7 +418,7 @@ func (ni *NodeInfo) StableMarshal(buf []byte) ([]byte, error) { offset += n } - n, err = protoutil.EnumMarshal(stateNodeInfoField, buf[offset:], int32(ni.state)) + _, err = protoutil.EnumMarshal(stateNodeInfoField, buf[offset:], int32(ni.state)) if err != nil { return nil, err } diff --git a/v2/object/marshal.go b/v2/object/marshal.go index 59ac0ad..b836d13 100644 --- a/v2/object/marshal.go +++ b/v2/object/marshal.go @@ -168,7 +168,7 @@ func (h *ShortHeader) StableMarshal(buf []byte) ([]byte, error) { offset += n - n, err = proto.NestedStructureMarshal(shortHdrHomoHashField, buf[offset:], h.homoHash) + _, err = proto.NestedStructureMarshal(shortHdrHomoHashField, buf[offset:], h.homoHash) if err != nil { return nil, err } @@ -485,13 +485,11 @@ func (h *HeaderWithSignature) StableMarshal(buf []byte) ([]byte, error) { offset += n - n, err = proto.NestedStructureMarshal(hdrWithSigSignatureField, buf[offset:], h.signature) + _, err = proto.NestedStructureMarshal(hdrWithSigSignatureField, buf[offset:], h.signature) if err != nil { return nil, err } - offset += n - return buf, nil } @@ -840,7 +838,7 @@ func (r *PutObjectPartInit) StableMarshal(buf []byte) ([]byte, error) { offset += n - n, err = proto.UInt32Marshal(putReqInitCopiesNumField, buf[offset:], r.copyNum) + _, err = proto.UInt32Marshal(putReqInitCopiesNumField, buf[offset:], r.copyNum) if err != nil { return nil, err } diff --git a/v2/storagegroup/marshal.go b/v2/storagegroup/marshal.go index c7d4e75..f7b1ed1 100644 --- a/v2/storagegroup/marshal.go +++ b/v2/storagegroup/marshal.go @@ -51,7 +51,7 @@ func (s *StorageGroup) StableMarshal(buf []byte) ([]byte, error) { offset += n - n, err = refs.ObjectIDNestedListMarshal(objectIDsField, buf[offset:], s.members) + _, err = refs.ObjectIDNestedListMarshal(objectIDsField, buf[offset:], s.members) if err != nil { return nil, err } From c7dcea9e49f017629f4c6c4bf10a27961fb8e19e Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 15 Jan 2021 12:23:16 +0300 Subject: [PATCH 0656/1196] Update changelog for release v1.22.1 Signed-off-by: Leonard Lyubich --- CHANGELOG.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 856e28e..92604df 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,23 @@ # Changelog +## [1.22.1] - 2021-01-15 + +Support changes from NeoFS API v2.2.1 release. + +### Added + +- Constant prefix of the reserved keys to X-headers (`__NEOFS__`). +- Constant string key to netmap epoch X-header (`__NEOFS__NETMAP_EPOCH`). +- Constant string key to netmap lookup depth X-header (`__NEOFS__NETMAP_LOOKUP_DEPTH`). + +### Changed + +- Linter's configuration in `.golangci.yml`. + +### Fixed + +- Remarks of the updated linter. + ## [1.22.0] - 2020-12-30 - Yeouido (여의도, 汝矣島) Support changes from NeoFS API v2.2.0 "Yeouido" release. @@ -507,3 +525,4 @@ Initial public release [1.21.1]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.21.0...v1.21.1 [1.21.2]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.21.1...v1.21.2 [1.22.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.21.2...v1.22.0 +[1.22.1]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.22.0...v1.22.1 From 9401724b9c00ef7f3c3041b1fe0d61605859b628 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Mon, 25 Jan 2021 10:59:08 +0300 Subject: [PATCH 0657/1196] [#246] pkg/client: Use io.Reader wrapper at object put Object payload transferred in chunks. Size of the chunks may be limited by transport protocols. To split it we use `io.CopyBuffer` with pre-allocated buffer size of one chunk. However this function may ignore buffer if reader or writer implements `WriteTo` or `ReadFrom` methods. Unfortunately `bytes.Reader` implements `WriteTo` function. To fix this we wrap reader so wrapper implements only `io.Reader` interface. Related to github.com/nspcc-dev/neofs-node/issues/338 Signed-off-by: Alex Vanin --- pkg/client/object.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/pkg/client/object.go b/pkg/client/object.go index 34f7d04..7e84f72 100644 --- a/pkg/client/object.go +++ b/pkg/client/object.go @@ -83,6 +83,10 @@ type SearchObjectParams struct { filters object.SearchFilters } +type putObjectV2Reader struct { + r io.Reader +} + type putObjectV2Writer struct { key *ecdsa.PrivateKey @@ -134,6 +138,10 @@ func (t checksumType) toV2() v2refs.ChecksumType { } } +func (w *putObjectV2Reader) Read(p []byte) (int, error) { + return w.r.Read(p) +} + func (w *putObjectV2Writer) Write(p []byte) (int, error) { w.chunkPart.SetChunk(p) @@ -272,8 +280,10 @@ func (c *Client) putObjectV2(ctx context.Context, p *PutObjectParams, opts ...Ca stream: stream, } + r := &putObjectV2Reader{r: rPayload} + // copy payload from reader to stream writer - _, err = io.CopyBuffer(w, rPayload, make([]byte, chunkSize)) + _, err = io.CopyBuffer(w, r, make([]byte, chunkSize)) if err != nil && !errors.Is(errors.Cause(err), io.EOF) { return nil, errors.Wrap(err, "could not send payload bytes to Put object stream") } From 98284f0bfa9d1eebf0e74fc7a42c296ed70493e9 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Mon, 25 Jan 2021 13:24:30 +0300 Subject: [PATCH 0658/1196] Fix badge in README file We don't have `go` workflow in the repository. Signed-off-by: Alex Vanin --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 94bb623..0c6df6e 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@

--- -![Go](https://github.com/nspcc-dev/neofs-api-go/workflows/Go/badge.svg) +![Tests](https://github.com/nspcc-dev/neofs-api-go/workflows/neofs-api-go%20tests/badge.svg) [![codecov](https://codecov.io/gh/nspcc-dev/neofs-api-go/branch/master/graph/badge.svg)](https://codecov.io/gh/nspcc-dev/neofs-api-go) [![Report](https://goreportcard.com/badge/github.com/nspcc-dev/neofs-api-go)](https://goreportcard.com/report/github.com/nspcc-dev/neofs-api-go) [![GitHub release](https://img.shields.io/github/release/nspcc-dev/neofs-api-go.svg)](https://github.com/nspcc-dev/neofs-api-go) From c35e15a758a579270068e186fab319f3e2f28cb5 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Tue, 26 Jan 2021 18:01:02 +0300 Subject: [PATCH 0659/1196] [#249] pkg/netmap: Add CBF field in placement context If CBF value is not set, then netmap package uses default CBF value. However it modifies placement policy structure in `GetContainerNodes()` because policy passed as a pointer. Instead package can store CBF value in internal context and use it without policy modification. Signed-off-by: Alex Vanin --- pkg/netmap/context.go | 12 ++++++++++++ pkg/netmap/netmap.go | 5 +---- pkg/netmap/selector.go | 2 +- pkg/netmap/selector_test.go | 5 ++++- 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/pkg/netmap/context.go b/pkg/netmap/context.go index cedb729..29b8167 100644 --- a/pkg/netmap/context.go +++ b/pkg/netmap/context.go @@ -29,6 +29,9 @@ type Context struct { // weightFunc is a weighting function for determining node priority. // By default in combines favours low price and high capacity. weightFunc weightFunc + // container backup factor is a factor for selector counters that expand + // amount of chosen nodes. + cbf uint32 } // Various validation errors. @@ -56,6 +59,7 @@ func NewContext(nm *Netmap) *Context { numCache: make(map[*Filter]uint64), aggregator: newMeanIQRAgg, weightFunc: GetDefaultWeightFunc(nm.Nodes), + cbf: defaultCBF, } } @@ -66,6 +70,14 @@ func (c *Context) setPivot(pivot []byte) { } } +func (c *Context) setCBF(cbf uint32) { + if cbf == 0 { + c.cbf = defaultCBF + } else { + c.cbf = cbf + } +} + // GetDefaultWeightFunc returns default weighting function. func GetDefaultWeightFunc(ns Nodes) weightFunc { mean := newMeanAgg() diff --git a/pkg/netmap/netmap.go b/pkg/netmap/netmap.go index 080dd77..369d9ac 100644 --- a/pkg/netmap/netmap.go +++ b/pkg/netmap/netmap.go @@ -50,10 +50,7 @@ func (m *Netmap) GetPlacementVectors(cnt ContainerNodes, pivot []byte) ([]Nodes, func (m *Netmap) GetContainerNodes(p *PlacementPolicy, pivot []byte) (ContainerNodes, error) { c := NewContext(m) c.setPivot(pivot) - - if p.ContainerBackupFactor() == 0 { - p.SetContainerBackupFactor(defaultCBF) - } + c.setCBF(p.ContainerBackupFactor()) if err := c.processFilters(p); err != nil { return nil, err diff --git a/pkg/netmap/selector.go b/pkg/netmap/selector.go index ec1aa3d..ff83f1b 100644 --- a/pkg/netmap/selector.go +++ b/pkg/netmap/selector.go @@ -69,7 +69,7 @@ func (c *Context) getSelection(p *PlacementPolicy, s *Selector) ([]Nodes, error) } } - maxNodesInBucket := nodesInBucket * int(p.ContainerBackupFactor()) + maxNodesInBucket := nodesInBucket * int(c.cbf) nodes := make([]Nodes, 0, len(buckets)) fallback := make([]Nodes, 0, len(buckets)) diff --git a/pkg/netmap/selector_test.go b/pkg/netmap/selector_test.go index 81fcd58..135a7b3 100644 --- a/pkg/netmap/selector_test.go +++ b/pkg/netmap/selector_test.go @@ -270,6 +270,7 @@ func TestPlacementPolicy_ProcessSelectors(t *testing.T) { nm, err := NewNetmap(NodesFromInfo(nodes)) require.NoError(t, err) c := NewContext(nm) + c.setCBF(p.ContainerBackupFactor()) require.NoError(t, c.processFilters(p)) require.NoError(t, c.processSelectors(p)) @@ -277,7 +278,7 @@ func TestPlacementPolicy_ProcessSelectors(t *testing.T) { sel := c.Selections[s.Name()] s := c.Selectors[s.Name()] bucketCount, nodesInBucket := GetNodesCount(p, s) - nodesInBucket *= int(p.ContainerBackupFactor()) + nodesInBucket *= int(c.cbf) targ := fmt.Sprintf("selector '%s'", s.Name()) require.Equal(t, bucketCount, len(sel), targ) for _, res := range sel { @@ -312,6 +313,7 @@ func TestPlacementPolicy_ProcessSelectorsHRW(t *testing.T) { require.NoError(t, err) c := NewContext(nm) c.setPivot([]byte("containerID")) + c.setCBF(p.ContainerBackupFactor()) c.weightFunc = newWeightFunc(newMaxNorm(10000), newReverseMinNorm(1)) c.aggregator = func() aggregator { return new(maxAgg) @@ -388,6 +390,7 @@ func TestPlacementPolicy_ProcessSelectorsInvalid(t *testing.T) { nm, err := NewNetmap(NodesFromInfo(nodes)) require.NoError(t, err) c := NewContext(nm) + c.setCBF(tc.p.ContainerBackupFactor()) require.NoError(t, c.processFilters(tc.p)) err = c.processSelectors(tc.p) From 42657aaf1142950b583f9d367f977ea5ce7935dc Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Wed, 27 Jan 2021 17:02:34 +0300 Subject: [PATCH 0660/1196] Update changelog for release v1.22.2 Signed-off-by: Alex Vanin --- CHANGELOG.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 92604df..6beaa6c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [1.22.2] - 2021-01-27 + +### Fixed + +- Fix size limit for grpc messages in object.Put operation. +- Fix `GetContainerNode()` function, so that it does not modify placement policy. + ## [1.22.1] - 2021-01-15 Support changes from NeoFS API v2.2.1 release. @@ -526,3 +533,4 @@ Initial public release [1.21.2]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.21.1...v1.21.2 [1.22.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.21.2...v1.22.0 [1.22.1]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.22.0...v1.22.1 +[1.22.2]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.22.1...v1.22.2 From 5d9ef5feec1c8e6c3a7da4071770d3c34031b02f Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Thu, 28 Jan 2021 14:52:51 +0300 Subject: [PATCH 0661/1196] [#248] netmap: fulfill backup factor for default attribute Signed-off-by: Evgenii Stratonikov --- pkg/netmap/policy_test.go | 53 +++++++++++++++++++++++++++++++++++++ pkg/netmap/selector.go | 12 +++++++++ pkg/netmap/selector_test.go | 6 ++++- 3 files changed, 70 insertions(+), 1 deletion(-) diff --git a/pkg/netmap/policy_test.go b/pkg/netmap/policy_test.go index 5db6d5b..9fca579 100644 --- a/pkg/netmap/policy_test.go +++ b/pkg/netmap/policy_test.go @@ -4,9 +4,62 @@ import ( "testing" "github.com/nspcc-dev/neofs-api-go/v2/netmap" + "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) +func TestPlacementPolicy_CBFWithEmptySelector(t *testing.T) { + nodes := []NodeInfo{ + nodeInfoFromAttributes("ID", "1", "Attr", "Same"), + nodeInfoFromAttributes("ID", "2", "Attr", "Same"), + nodeInfoFromAttributes("ID", "3", "Attr", "Same"), + nodeInfoFromAttributes("ID", "4", "Attr", "Same"), + } + + p1 := newPlacementPolicy(0, + []*Replica{newReplica(2, "")}, + nil, // selectors + nil, // filters + ) + + p2 := newPlacementPolicy(3, + []*Replica{newReplica(2, "")}, + nil, // selectors + nil, // filters + ) + + p3 := newPlacementPolicy(3, + []*Replica{newReplica(2, "X")}, + []*Selector{newSelector("X", "", ClauseDistinct, 2, "*")}, + nil, // filters + ) + + p4 := newPlacementPolicy(3, + []*Replica{newReplica(2, "X")}, + []*Selector{newSelector("X", "Attr", ClauseSame, 2, "*")}, + nil, // filters + ) + + nm, err := NewNetmap(NodesFromInfo(nodes)) + require.NoError(t, err) + + v, err := nm.GetContainerNodes(p1, nil) + require.NoError(t, err) + assert.Len(t, v.Flatten(), 4) + + v, err = nm.GetContainerNodes(p2, nil) + require.NoError(t, err) + assert.Len(t, v.Flatten(), 4) + + v, err = nm.GetContainerNodes(p3, nil) + require.NoError(t, err) + assert.Len(t, v.Flatten(), 4) + + v, err = nm.GetContainerNodes(p4, nil) + require.NoError(t, err) + assert.Len(t, v.Flatten(), 4) +} + func TestPlacementPolicyFromV2(t *testing.T) { pV2 := new(netmap.PlacementPolicy) diff --git a/pkg/netmap/selector.go b/pkg/netmap/selector.go index ff83f1b..7a7f297 100644 --- a/pkg/netmap/selector.go +++ b/pkg/netmap/selector.go @@ -48,6 +48,7 @@ func GetNodesCount(_ *PlacementPolicy, s *Selector) (int, int) { } // getSelection returns nodes grouped by s.attribute. +// Last argument specifies if more buckets can be used to fullfill CBF. func (c *Context) getSelection(p *PlacementPolicy, s *Selector) ([]Nodes, error) { bucketCount, nodesInBucket := GetNodesCount(p, s) buckets := c.getSelectionBase(s) @@ -99,6 +100,17 @@ func (c *Context) getSelection(p *PlacementPolicy, s *Selector) ([]Nodes, error) hrw.SortSliceByWeightIndex(nodes, weights, c.pivotHash) } + if s.Attribute() == "" { + nodes, fallback = nodes[:bucketCount], nodes[bucketCount:] + for i := range fallback { + index := i % bucketCount + if len(nodes[index]) >= maxNodesInBucket { + break + } + nodes[index] = append(nodes[index], fallback[i]...) + } + } + return nodes[:bucketCount], nil } diff --git a/pkg/netmap/selector_test.go b/pkg/netmap/selector_test.go index 135a7b3..e434821 100644 --- a/pkg/netmap/selector_test.go +++ b/pkg/netmap/selector_test.go @@ -54,7 +54,11 @@ func TestPlacementPolicy_Minimal(t *testing.T) { } require.NoError(t, err) - require.EqualValues(t, rep, len(v.Flatten())) + count := int(rep * defaultCBF) + if count > len(nm.Nodes) { + count = len(nm.Nodes) + } + require.EqualValues(t, count, len(v.Flatten())) } t.Run("REP 1", func(t *testing.T) { From d2ee6b469a3e5ac047eaa244db6f9efefb3716ae Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Thu, 21 Jan 2021 17:57:04 +0300 Subject: [PATCH 0662/1196] [#245] v2/container: Add AnnounceUsedSpace method Signed-off-by: Alex Vanin --- v2/container/client.go | 34 ++ v2/container/convert.go | 160 ++++++ v2/container/grpc/client.go | 4 + v2/container/grpc/service.go | 63 +++ v2/container/grpc/service.pb.go | 810 ++++++++++++++++++++++++------- v2/container/marshal.go | 91 ++++ v2/container/marshal_test.go | 59 +++ v2/container/service.go | 17 + v2/container/test/client_test.go | 156 +++++- v2/container/types.go | 138 ++++++ v2/signature/sign.go | 4 + 11 files changed, 1351 insertions(+), 185 deletions(-) diff --git a/v2/container/client.go b/v2/container/client.go index bffe3b8..c0921b6 100644 --- a/v2/container/client.go +++ b/v2/container/client.go @@ -23,6 +23,8 @@ type Client struct { cSetEACL *setEACLClient cGetEACL *getEACLClient + + cAnnounce *announceUsedSpaceClient } // Option represents Client option. @@ -94,6 +96,14 @@ type getEACLClient struct { responseConverter func(interface{}) *GetExtendedACLResponse } +type announceUsedSpaceClient struct { + requestConverter func(request *AnnounceUsedSpaceRequest) interface{} + + caller func(context.Context, interface{}) (interface{}, error) + + responseConverter func(interface{}) *AnnounceUsedSpaceResponse +} + // Put sends PutRequest over the network and returns PutResponse. // // It returns any error encountered during the call. @@ -166,6 +176,19 @@ func (c *Client) GetExtendedACL(ctx context.Context, req *GetExtendedACLRequest) return c.cGetEACL.responseConverter(resp), nil } +// AnnounceUsedSpace sends AnnounceUsedSpaceRequest over the network and returns +// AnnounceUsedSpaceResponse. +// +// It returns any error encountered during the call. +func (c *Client) AnnounceUsedSpace(ctx context.Context, req *AnnounceUsedSpaceRequest) (*AnnounceUsedSpaceResponse, error) { + resp, err := c.cAnnounce.caller(ctx, c.cAnnounce.requestConverter(req)) + if err != nil { + return nil, errors.Wrap(err, "could not send announce used space request") + } + + return c.cAnnounce.responseConverter(resp), nil +} + func defaultCfg() *cfg { return &cfg{ proto: client.ProtoGRPC, @@ -255,6 +278,17 @@ func NewClient(opts ...Option) (*Client, error) { return GetExtendedACLResponseFromGRPCMessage(resp.(*container.GetExtendedACLResponse)) }, }, + cAnnounce: &announceUsedSpaceClient{ + requestConverter: func(req *AnnounceUsedSpaceRequest) interface{} { + return AnnounceUsedSpaceRequestToGRPCMessage(req) + }, + caller: func(ctx context.Context, req interface{}) (interface{}, error) { + return c.AnnounceUsedSpace(ctx, req.(*container.AnnounceUsedSpaceRequest)) + }, + responseConverter: func(resp interface{}) *AnnounceUsedSpaceResponse { + return AnnounceUsedSpaceResponseFromGRPCMessage(resp.(*container.AnnounceUsedSpaceResponse)) + }, + }, }, nil default: err = client.ErrProtoUnsupported diff --git a/v2/container/convert.go b/v2/container/convert.go index b60d9a3..d40813f 100644 --- a/v2/container/convert.go +++ b/v2/container/convert.go @@ -849,3 +849,163 @@ func GetExtendedACLResponseFromGRPCMessage(m *container.GetExtendedACLResponse) return r } + +func UsedSpaceAnnouncementToGRPCMessage(a *UsedSpaceAnnouncement) *container.AnnounceUsedSpaceRequest_Body_Announcement { + if a == nil { + return nil + } + + m := new(container.AnnounceUsedSpaceRequest_Body_Announcement) + + m.SetContainerId( + refs.ContainerIDToGRPCMessage(a.GetContainerID()), + ) + + m.SetUsedSpace(a.GetUsedSpace()) + + return m +} + +func UsedSpaceAnnouncementFromGRPCMessage(m *container.AnnounceUsedSpaceRequest_Body_Announcement) *UsedSpaceAnnouncement { + if m == nil { + return nil + } + + a := new(UsedSpaceAnnouncement) + + a.SetContainerID( + refs.ContainerIDFromGRPCMessage(m.GetContainerId()), + ) + + a.SetUsedSpace(m.GetUsedSpace()) + + return a +} + +func AnnounceUsedSpaceRequestBodyToGRPCMessage(r *AnnounceUsedSpaceRequestBody) *container.AnnounceUsedSpaceRequest_Body { + if r == nil { + return nil + } + + m := new(container.AnnounceUsedSpaceRequest_Body) + + announcements := r.GetAnnouncements() + msgAnnouncements := make([]*container.AnnounceUsedSpaceRequest_Body_Announcement, 0, len(announcements)) + + for i := range announcements { + msgAnnouncements = append( + msgAnnouncements, + UsedSpaceAnnouncementToGRPCMessage(announcements[i]), + ) + } + + m.SetAnnouncements(msgAnnouncements) + + return m +} + +func AnnounceUsedSpaceRequestBodyFromGRPCMessage(m *container.AnnounceUsedSpaceRequest_Body) *AnnounceUsedSpaceRequestBody { + if m == nil { + return nil + } + + r := new(AnnounceUsedSpaceRequestBody) + + msgAnnouncements := m.GetAnnouncements() + announcements := make([]*UsedSpaceAnnouncement, 0, len(msgAnnouncements)) + + for i := range msgAnnouncements { + announcements = append( + announcements, + UsedSpaceAnnouncementFromGRPCMessage(msgAnnouncements[i]), + ) + } + + r.SetAnnouncements(announcements) + + return r +} + +func AnnounceUsedSpaceRequestToGRPCMessage(r *AnnounceUsedSpaceRequest) *container.AnnounceUsedSpaceRequest { + if r == nil { + return nil + } + + m := new(container.AnnounceUsedSpaceRequest) + + m.SetBody( + AnnounceUsedSpaceRequestBodyToGRPCMessage(r.GetBody()), + ) + + session.RequestHeadersToGRPC(r, m) + + return m +} + +func AnnounceUsedSpaceRequestFromGRPCMessage(m *container.AnnounceUsedSpaceRequest) *AnnounceUsedSpaceRequest { + if m == nil { + return nil + } + + r := new(AnnounceUsedSpaceRequest) + + r.SetBody( + AnnounceUsedSpaceRequestBodyFromGRPCMessage(m.GetBody()), + ) + + session.RequestHeadersFromGRPC(m, r) + + return r +} + +func AnnounceUsedSpaceResponseBodyToGRPCMessage(r *AnnounceUsedSpaceResponseBody) *container.AnnounceUsedSpaceResponse_Body { + if r == nil { + return nil + } + + m := new(container.AnnounceUsedSpaceResponse_Body) + + return m +} + +func AnnounceUsedSpaceResponseBodyFromGRPCMessage(m *container.AnnounceUsedSpaceResponse_Body) *AnnounceUsedSpaceResponseBody { + if m == nil { + return nil + } + + r := new(AnnounceUsedSpaceResponseBody) + + return r +} + +func AnnounceUsedSpaceResponseToGRPCMessage(r *AnnounceUsedSpaceResponse) *container.AnnounceUsedSpaceResponse { + if r == nil { + return nil + } + + m := new(container.AnnounceUsedSpaceResponse) + + m.SetBody( + AnnounceUsedSpaceResponseBodyToGRPCMessage(r.GetBody()), + ) + + session.ResponseHeadersToGRPC(r, m) + + return m +} + +func AnnounceUsedSpaceResponseFromGRPCMessage(m *container.AnnounceUsedSpaceResponse) *AnnounceUsedSpaceResponse { + if m == nil { + return nil + } + + r := new(AnnounceUsedSpaceResponse) + + r.SetBody( + AnnounceUsedSpaceResponseBodyFromGRPCMessage(m.GetBody()), + ) + + session.ResponseHeadersFromGRPC(m, r) + + return r +} diff --git a/v2/container/grpc/client.go b/v2/container/grpc/client.go index 8e3cdf9..7e126d2 100644 --- a/v2/container/grpc/client.go +++ b/v2/container/grpc/client.go @@ -73,6 +73,10 @@ func (c *Client) GetExtendedACL(ctx context.Context, req *GetExtendedACLRequest) return c.client.GetExtendedACL(ctx, req, c.callOpts...) } +func (c *Client) AnnounceUsedSpace(ctx context.Context, req *AnnounceUsedSpaceRequest) (*AnnounceUsedSpaceResponse, error) { + return c.client.AnnounceUsedSpace(ctx, req, c.callOpts...) +} + // WithCallOptions returns Option that configures // Client to attach call options to each rpc call. func WithCallOptions(opts []grpc.CallOption) Option { diff --git a/v2/container/grpc/service.go b/v2/container/grpc/service.go index 61648b5..98c5cc6 100644 --- a/v2/container/grpc/service.go +++ b/v2/container/grpc/service.go @@ -353,3 +353,66 @@ func (m *GetExtendedACLResponse) SetVerifyHeader(v *session.ResponseVerification m.VerifyHeader = v } } + +// SetContainerId sets identifier of the container. +func (m *AnnounceUsedSpaceRequest_Body_Announcement) SetContainerId(v *refs.ContainerID) { + if m != nil { + m.ContainerId = v + } +} + +// SetUsedSpace sets used space value of the container. +func (m *AnnounceUsedSpaceRequest_Body_Announcement) SetUsedSpace(v uint64) { + if m != nil { + m.UsedSpace = v + } +} + +// SetAnnouncements sets list of announcement for shared containers between nodes. +func (m *AnnounceUsedSpaceRequest_Body) SetAnnouncements(v []*AnnounceUsedSpaceRequest_Body_Announcement) { + if m != nil { + m.Announcements = v + } +} + +// SetBody sets body of the request. +func (m *AnnounceUsedSpaceRequest) SetBody(v *AnnounceUsedSpaceRequest_Body) { + if m != nil { + m.Body = v + } +} + +// SetMetaHeader sets meta header of the request. +func (m *AnnounceUsedSpaceRequest) SetMetaHeader(v *session.RequestMetaHeader) { + if m != nil { + m.MetaHeader = v + } +} + +// SetVerifyHeader sets verification header of the request. +func (m *AnnounceUsedSpaceRequest) SetVerifyHeader(v *session.RequestVerificationHeader) { + if m != nil { + m.VerifyHeader = v + } +} + +// SetBody sets body of the response. +func (m *AnnounceUsedSpaceResponse) SetBody(v *AnnounceUsedSpaceResponse_Body) { + if m != nil { + m.Body = v + } +} + +// SetMetaHeader sets meta header of the response. +func (m *AnnounceUsedSpaceResponse) SetMetaHeader(v *session.ResponseMetaHeader) { + if m != nil { + m.MetaHeader = v + } +} + +// SetVerifyHeader sets verification header of the response. +func (m *AnnounceUsedSpaceResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) { + if m != nil { + m.VerifyHeader = v + } +} diff --git a/v2/container/grpc/service.pb.go b/v2/container/grpc/service.pb.go index 809418f..2951a95 100644 --- a/v2/container/grpc/service.pb.go +++ b/v2/container/grpc/service.pb.go @@ -873,6 +873,146 @@ func (x *GetExtendedACLResponse) GetVerifyHeader() *grpc.ResponseVerificationHea return nil } +// Announce container used space +type AnnounceUsedSpaceRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Body of announce used space request message. + Body *AnnounceUsedSpaceRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" 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,proto3" json:"verify_header,omitempty"` +} + +func (x *AnnounceUsedSpaceRequest) Reset() { + *x = AnnounceUsedSpaceRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_container_grpc_service_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AnnounceUsedSpaceRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AnnounceUsedSpaceRequest) ProtoMessage() {} + +func (x *AnnounceUsedSpaceRequest) ProtoReflect() protoreflect.Message { + mi := &file_v2_container_grpc_service_proto_msgTypes[12] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AnnounceUsedSpaceRequest.ProtoReflect.Descriptor instead. +func (*AnnounceUsedSpaceRequest) Descriptor() ([]byte, []int) { + return file_v2_container_grpc_service_proto_rawDescGZIP(), []int{12} +} + +func (x *AnnounceUsedSpaceRequest) GetBody() *AnnounceUsedSpaceRequest_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *AnnounceUsedSpaceRequest) GetMetaHeader() *grpc.RequestMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} + +func (x *AnnounceUsedSpaceRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} + +// Announce container used space +type AnnounceUsedSpaceResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Body of announce used space response message. + Body *AnnounceUsedSpaceResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" 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,proto3" json:"verify_header,omitempty"` +} + +func (x *AnnounceUsedSpaceResponse) Reset() { + *x = AnnounceUsedSpaceResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_container_grpc_service_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AnnounceUsedSpaceResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AnnounceUsedSpaceResponse) ProtoMessage() {} + +func (x *AnnounceUsedSpaceResponse) ProtoReflect() protoreflect.Message { + mi := &file_v2_container_grpc_service_proto_msgTypes[13] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AnnounceUsedSpaceResponse.ProtoReflect.Descriptor instead. +func (*AnnounceUsedSpaceResponse) Descriptor() ([]byte, []int) { + return file_v2_container_grpc_service_proto_rawDescGZIP(), []int{13} +} + +func (x *AnnounceUsedSpaceResponse) GetBody() *AnnounceUsedSpaceResponse_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *AnnounceUsedSpaceResponse) GetMetaHeader() *grpc.ResponseMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} + +func (x *AnnounceUsedSpaceResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} + // Container creation request has container structure's signature as a // separate field. It's not stored in sidechain, just verified on container // creation by `Container` smart contract. `ContainerID` is a SHA256 hash of @@ -892,7 +1032,7 @@ type PutRequest_Body struct { func (x *PutRequest_Body) Reset() { *x = PutRequest_Body{} if protoimpl.UnsafeEnabled { - mi := &file_v2_container_grpc_service_proto_msgTypes[12] + mi := &file_v2_container_grpc_service_proto_msgTypes[14] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -905,7 +1045,7 @@ func (x *PutRequest_Body) String() string { func (*PutRequest_Body) ProtoMessage() {} func (x *PutRequest_Body) ProtoReflect() protoreflect.Message { - mi := &file_v2_container_grpc_service_proto_msgTypes[12] + mi := &file_v2_container_grpc_service_proto_msgTypes[14] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -951,7 +1091,7 @@ type PutResponse_Body struct { func (x *PutResponse_Body) Reset() { *x = PutResponse_Body{} if protoimpl.UnsafeEnabled { - mi := &file_v2_container_grpc_service_proto_msgTypes[13] + mi := &file_v2_container_grpc_service_proto_msgTypes[15] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -964,7 +1104,7 @@ func (x *PutResponse_Body) String() string { func (*PutResponse_Body) ProtoMessage() {} func (x *PutResponse_Body) ProtoReflect() protoreflect.Message { - mi := &file_v2_container_grpc_service_proto_msgTypes[13] + mi := &file_v2_container_grpc_service_proto_msgTypes[15] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1004,7 +1144,7 @@ type DeleteRequest_Body struct { func (x *DeleteRequest_Body) Reset() { *x = DeleteRequest_Body{} if protoimpl.UnsafeEnabled { - mi := &file_v2_container_grpc_service_proto_msgTypes[14] + mi := &file_v2_container_grpc_service_proto_msgTypes[16] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1017,7 +1157,7 @@ func (x *DeleteRequest_Body) String() string { func (*DeleteRequest_Body) ProtoMessage() {} func (x *DeleteRequest_Body) ProtoReflect() protoreflect.Message { - mi := &file_v2_container_grpc_service_proto_msgTypes[14] + mi := &file_v2_container_grpc_service_proto_msgTypes[16] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1058,7 +1198,7 @@ type DeleteResponse_Body struct { func (x *DeleteResponse_Body) Reset() { *x = DeleteResponse_Body{} if protoimpl.UnsafeEnabled { - mi := &file_v2_container_grpc_service_proto_msgTypes[15] + mi := &file_v2_container_grpc_service_proto_msgTypes[17] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1071,7 +1211,7 @@ func (x *DeleteResponse_Body) String() string { func (*DeleteResponse_Body) ProtoMessage() {} func (x *DeleteResponse_Body) ProtoReflect() protoreflect.Message { - mi := &file_v2_container_grpc_service_proto_msgTypes[15] + mi := &file_v2_container_grpc_service_proto_msgTypes[17] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1100,7 +1240,7 @@ type GetRequest_Body struct { func (x *GetRequest_Body) Reset() { *x = GetRequest_Body{} if protoimpl.UnsafeEnabled { - mi := &file_v2_container_grpc_service_proto_msgTypes[16] + mi := &file_v2_container_grpc_service_proto_msgTypes[18] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1113,7 +1253,7 @@ func (x *GetRequest_Body) String() string { func (*GetRequest_Body) ProtoMessage() {} func (x *GetRequest_Body) ProtoReflect() protoreflect.Message { - mi := &file_v2_container_grpc_service_proto_msgTypes[16] + mi := &file_v2_container_grpc_service_proto_msgTypes[18] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1150,7 +1290,7 @@ type GetResponse_Body struct { func (x *GetResponse_Body) Reset() { *x = GetResponse_Body{} if protoimpl.UnsafeEnabled { - mi := &file_v2_container_grpc_service_proto_msgTypes[17] + mi := &file_v2_container_grpc_service_proto_msgTypes[19] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1163,7 +1303,7 @@ func (x *GetResponse_Body) String() string { func (*GetResponse_Body) ProtoMessage() {} func (x *GetResponse_Body) ProtoReflect() protoreflect.Message { - mi := &file_v2_container_grpc_service_proto_msgTypes[17] + mi := &file_v2_container_grpc_service_proto_msgTypes[19] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1199,7 +1339,7 @@ type ListRequest_Body struct { func (x *ListRequest_Body) Reset() { *x = ListRequest_Body{} if protoimpl.UnsafeEnabled { - mi := &file_v2_container_grpc_service_proto_msgTypes[18] + mi := &file_v2_container_grpc_service_proto_msgTypes[20] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1212,7 +1352,7 @@ func (x *ListRequest_Body) String() string { func (*ListRequest_Body) ProtoMessage() {} func (x *ListRequest_Body) ProtoReflect() protoreflect.Message { - mi := &file_v2_container_grpc_service_proto_msgTypes[18] + mi := &file_v2_container_grpc_service_proto_msgTypes[20] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1248,7 +1388,7 @@ type ListResponse_Body struct { func (x *ListResponse_Body) Reset() { *x = ListResponse_Body{} if protoimpl.UnsafeEnabled { - mi := &file_v2_container_grpc_service_proto_msgTypes[19] + mi := &file_v2_container_grpc_service_proto_msgTypes[21] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1261,7 +1401,7 @@ func (x *ListResponse_Body) String() string { func (*ListResponse_Body) ProtoMessage() {} func (x *ListResponse_Body) ProtoReflect() protoreflect.Message { - mi := &file_v2_container_grpc_service_proto_msgTypes[19] + mi := &file_v2_container_grpc_service_proto_msgTypes[21] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1300,7 +1440,7 @@ type SetExtendedACLRequest_Body struct { func (x *SetExtendedACLRequest_Body) Reset() { *x = SetExtendedACLRequest_Body{} if protoimpl.UnsafeEnabled { - mi := &file_v2_container_grpc_service_proto_msgTypes[20] + mi := &file_v2_container_grpc_service_proto_msgTypes[22] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1313,7 +1453,7 @@ func (x *SetExtendedACLRequest_Body) String() string { func (*SetExtendedACLRequest_Body) ProtoMessage() {} func (x *SetExtendedACLRequest_Body) ProtoReflect() protoreflect.Message { - mi := &file_v2_container_grpc_service_proto_msgTypes[20] + mi := &file_v2_container_grpc_service_proto_msgTypes[22] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1355,7 +1495,7 @@ type SetExtendedACLResponse_Body struct { func (x *SetExtendedACLResponse_Body) Reset() { *x = SetExtendedACLResponse_Body{} if protoimpl.UnsafeEnabled { - mi := &file_v2_container_grpc_service_proto_msgTypes[21] + mi := &file_v2_container_grpc_service_proto_msgTypes[23] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1368,7 +1508,7 @@ func (x *SetExtendedACLResponse_Body) String() string { func (*SetExtendedACLResponse_Body) ProtoMessage() {} func (x *SetExtendedACLResponse_Body) ProtoReflect() protoreflect.Message { - mi := &file_v2_container_grpc_service_proto_msgTypes[21] + mi := &file_v2_container_grpc_service_proto_msgTypes[23] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1397,7 +1537,7 @@ type GetExtendedACLRequest_Body struct { func (x *GetExtendedACLRequest_Body) Reset() { *x = GetExtendedACLRequest_Body{} if protoimpl.UnsafeEnabled { - mi := &file_v2_container_grpc_service_proto_msgTypes[22] + mi := &file_v2_container_grpc_service_proto_msgTypes[24] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1410,7 +1550,7 @@ func (x *GetExtendedACLRequest_Body) String() string { func (*GetExtendedACLRequest_Body) ProtoMessage() {} func (x *GetExtendedACLRequest_Body) ProtoReflect() protoreflect.Message { - mi := &file_v2_container_grpc_service_proto_msgTypes[22] + mi := &file_v2_container_grpc_service_proto_msgTypes[24] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1450,7 +1590,7 @@ type GetExtendedACLResponse_Body struct { func (x *GetExtendedACLResponse_Body) Reset() { *x = GetExtendedACLResponse_Body{} if protoimpl.UnsafeEnabled { - mi := &file_v2_container_grpc_service_proto_msgTypes[23] + mi := &file_v2_container_grpc_service_proto_msgTypes[25] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1463,7 +1603,7 @@ func (x *GetExtendedACLResponse_Body) String() string { func (*GetExtendedACLResponse_Body) ProtoMessage() {} func (x *GetExtendedACLResponse_Body) ProtoReflect() protoreflect.Message { - mi := &file_v2_container_grpc_service_proto_msgTypes[23] + mi := &file_v2_container_grpc_service_proto_msgTypes[25] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1493,6 +1633,155 @@ func (x *GetExtendedACLResponse_Body) GetSignature() *grpc1.Signature { return nil } +// Container used space announcement body. +type AnnounceUsedSpaceRequest_Body struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // List of announcements. If nodes share several containers, then + // announcements transferred in a batch. + Announcements []*AnnounceUsedSpaceRequest_Body_Announcement `protobuf:"bytes,1,rep,name=announcements,proto3" json:"announcements,omitempty"` +} + +func (x *AnnounceUsedSpaceRequest_Body) Reset() { + *x = AnnounceUsedSpaceRequest_Body{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_container_grpc_service_proto_msgTypes[26] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AnnounceUsedSpaceRequest_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AnnounceUsedSpaceRequest_Body) ProtoMessage() {} + +func (x *AnnounceUsedSpaceRequest_Body) ProtoReflect() protoreflect.Message { + mi := &file_v2_container_grpc_service_proto_msgTypes[26] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AnnounceUsedSpaceRequest_Body.ProtoReflect.Descriptor instead. +func (*AnnounceUsedSpaceRequest_Body) Descriptor() ([]byte, []int) { + return file_v2_container_grpc_service_proto_rawDescGZIP(), []int{12, 0} +} + +func (x *AnnounceUsedSpaceRequest_Body) GetAnnouncements() []*AnnounceUsedSpaceRequest_Body_Announcement { + if x != nil { + return x.Announcements + } + return nil +} + +// Announcement contains used space information about single container. +type AnnounceUsedSpaceRequest_Body_Announcement struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Identifier of the container + ContainerId *grpc1.ContainerID `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` + // used_space is a sum of object payused space sizes of specified + // container, stored in the node. It must not include inhumed objects. + UsedSpace uint64 `protobuf:"varint,2,opt,name=used_space,json=usedSpace,proto3" json:"used_space,omitempty"` +} + +func (x *AnnounceUsedSpaceRequest_Body_Announcement) Reset() { + *x = AnnounceUsedSpaceRequest_Body_Announcement{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_container_grpc_service_proto_msgTypes[27] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AnnounceUsedSpaceRequest_Body_Announcement) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AnnounceUsedSpaceRequest_Body_Announcement) ProtoMessage() {} + +func (x *AnnounceUsedSpaceRequest_Body_Announcement) ProtoReflect() protoreflect.Message { + mi := &file_v2_container_grpc_service_proto_msgTypes[27] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AnnounceUsedSpaceRequest_Body_Announcement.ProtoReflect.Descriptor instead. +func (*AnnounceUsedSpaceRequest_Body_Announcement) Descriptor() ([]byte, []int) { + return file_v2_container_grpc_service_proto_rawDescGZIP(), []int{12, 0, 0} +} + +func (x *AnnounceUsedSpaceRequest_Body_Announcement) GetContainerId() *grpc1.ContainerID { + if x != nil { + return x.ContainerId + } + return nil +} + +func (x *AnnounceUsedSpaceRequest_Body_Announcement) GetUsedSpace() uint64 { + if x != nil { + return x.UsedSpace + } + return 0 +} + +// `AnnounceUsedSpaceResponse` has an empty body because announcements are +// one way communication. +type AnnounceUsedSpaceResponse_Body struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *AnnounceUsedSpaceResponse_Body) Reset() { + *x = AnnounceUsedSpaceResponse_Body{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_container_grpc_service_proto_msgTypes[28] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AnnounceUsedSpaceResponse_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AnnounceUsedSpaceResponse_Body) ProtoMessage() {} + +func (x *AnnounceUsedSpaceResponse_Body) ProtoReflect() protoreflect.Message { + mi := &file_v2_container_grpc_service_proto_msgTypes[28] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AnnounceUsedSpaceResponse_Body.ProtoReflect.Descriptor instead. +func (*AnnounceUsedSpaceResponse_Body) Descriptor() ([]byte, []int) { + return file_v2_container_grpc_service_proto_rawDescGZIP(), []int{13, 0} +} + var File_v2_container_grpc_service_proto protoreflect.FileDescriptor var file_v2_container_grpc_service_proto_rawDesc = []byte{ @@ -1741,47 +2030,101 @@ var file_v2_container_grpc_service_proto_rawDesc = []byte{ 0x63, 0x6c, 0x12, 0x37, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, - 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x32, 0x9c, 0x04, 0x0a, 0x10, - 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, - 0x12, 0x48, 0x0a, 0x03, 0x50, 0x75, 0x74, 0x12, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, - 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x75, - 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, - 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x50, - 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x51, 0x0a, 0x06, 0x44, 0x65, - 0x6c, 0x65, 0x74, 0x65, 0x12, 0x22, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, - 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, - 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, - 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x44, - 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x48, 0x0a, - 0x03, 0x47, 0x65, 0x74, 0x12, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, - 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, - 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x74, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4b, 0x0a, 0x04, 0x4c, 0x69, 0x73, 0x74, 0x12, - 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, - 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x21, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, - 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x69, 0x0a, 0x0e, 0x53, 0x65, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, - 0x64, 0x65, 0x64, 0x41, 0x43, 0x4c, 0x12, 0x2a, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, - 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x53, 0x65, 0x74, - 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x41, 0x43, 0x4c, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x2b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, - 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x53, 0x65, 0x74, 0x45, 0x78, 0x74, 0x65, - 0x6e, 0x64, 0x65, 0x64, 0x41, 0x43, 0x4c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, - 0x69, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x41, 0x43, - 0x4c, 0x12, 0x2a, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, - 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, - 0x64, 0x65, 0x64, 0x41, 0x43, 0x4c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2b, 0x2e, + 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x22, 0xdb, 0x03, 0x0a, 0x18, + 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x55, 0x73, 0x65, 0x64, 0x53, 0x70, 0x61, 0x63, + 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x46, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x32, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, + 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x41, 0x6e, 0x6e, + 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x55, 0x73, 0x65, 0x64, 0x53, 0x70, 0x61, 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, 0xdc, 0x01, 0x0a, 0x04, 0x42, + 0x6f, 0x64, 0x79, 0x12, 0x65, 0x0a, 0x0d, 0x61, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x6d, + 0x65, 0x6e, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x3f, 0x2e, 0x6e, 0x65, 0x6f, + 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, + 0x2e, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x55, 0x73, 0x65, 0x64, 0x53, 0x70, 0x61, + 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x2e, 0x41, + 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x0d, 0x61, 0x6e, 0x6e, + 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x1a, 0x6d, 0x0a, 0x0c, 0x41, 0x6e, + 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x3e, 0x0a, 0x0c, 0x63, 0x6f, + 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, + 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x52, 0x0b, 0x63, + 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x75, 0x73, + 0x65, 0x64, 0x5f, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, + 0x75, 0x73, 0x65, 0x64, 0x53, 0x70, 0x61, 0x63, 0x65, 0x22, 0x88, 0x02, 0x0a, 0x19, 0x41, 0x6e, + 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x55, 0x73, 0x65, 0x64, 0x53, 0x70, 0x61, 0x63, 0x65, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x47, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x33, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x41, 0x6e, 0x6e, 0x6f, + 0x75, 0x6e, 0x63, 0x65, 0x55, 0x73, 0x65, 0x64, 0x53, 0x70, 0x61, 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, 0x06, 0x0a, 0x04, + 0x42, 0x6f, 0x64, 0x79, 0x32, 0x90, 0x05, 0x0a, 0x10, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, + 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x48, 0x0a, 0x03, 0x50, 0x75, 0x74, + 0x12, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, + 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, + 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x51, 0x0a, 0x06, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x12, 0x22, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, - 0x6e, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x41, - 0x43, 0x4c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x58, 0x5a, 0x3d, 0x67, 0x69, - 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, - 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, - 0x76, 0x32, 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, 0x16, 0x4e, 0x65, - 0x6f, 0x46, 0x53, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x76, 0x32, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, - 0x69, 0x6e, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6e, 0x65, 0x72, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x23, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, + 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x48, 0x0a, 0x03, 0x47, 0x65, 0x74, 0x12, 0x1f, 0x2e, + 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, + 0x6e, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, + 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x4b, 0x0a, 0x04, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x4c, + 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x6e, 0x65, 0x6f, + 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, + 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x69, 0x0a, + 0x0e, 0x53, 0x65, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x41, 0x43, 0x4c, 0x12, + 0x2a, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, + 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x53, 0x65, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, + 0x64, 0x41, 0x43, 0x4c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2b, 0x2e, 0x6e, 0x65, + 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, + 0x72, 0x2e, 0x53, 0x65, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x41, 0x43, 0x4c, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x69, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x45, + 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x41, 0x43, 0x4c, 0x12, 0x2a, 0x2e, 0x6e, 0x65, 0x6f, + 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, + 0x2e, 0x47, 0x65, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x41, 0x43, 0x4c, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, + 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x74, + 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x41, 0x43, 0x4c, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x72, 0x0a, 0x11, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x55, + 0x73, 0x65, 0x64, 0x53, 0x70, 0x61, 0x63, 0x65, 0x12, 0x2d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x41, + 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x55, 0x73, 0x65, 0x64, 0x53, 0x70, 0x61, 0x63, 0x65, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2e, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, + 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x41, 0x6e, + 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x55, 0x73, 0x65, 0x64, 0x53, 0x70, 0x61, 0x63, 0x65, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x58, 0x5a, 0x3d, 0x67, 0x69, 0x74, 0x68, 0x75, + 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, + 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 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, 0x16, 0x4e, 0x65, 0x6f, 0x46, 0x53, + 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x76, 0x32, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, + 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -1796,110 +2139,125 @@ func file_v2_container_grpc_service_proto_rawDescGZIP() []byte { return file_v2_container_grpc_service_proto_rawDescData } -var file_v2_container_grpc_service_proto_msgTypes = make([]protoimpl.MessageInfo, 24) +var file_v2_container_grpc_service_proto_msgTypes = make([]protoimpl.MessageInfo, 29) var file_v2_container_grpc_service_proto_goTypes = []interface{}{ - (*PutRequest)(nil), // 0: neo.fs.v2.container.PutRequest - (*PutResponse)(nil), // 1: neo.fs.v2.container.PutResponse - (*DeleteRequest)(nil), // 2: neo.fs.v2.container.DeleteRequest - (*DeleteResponse)(nil), // 3: neo.fs.v2.container.DeleteResponse - (*GetRequest)(nil), // 4: neo.fs.v2.container.GetRequest - (*GetResponse)(nil), // 5: neo.fs.v2.container.GetResponse - (*ListRequest)(nil), // 6: neo.fs.v2.container.ListRequest - (*ListResponse)(nil), // 7: neo.fs.v2.container.ListResponse - (*SetExtendedACLRequest)(nil), // 8: neo.fs.v2.container.SetExtendedACLRequest - (*SetExtendedACLResponse)(nil), // 9: neo.fs.v2.container.SetExtendedACLResponse - (*GetExtendedACLRequest)(nil), // 10: neo.fs.v2.container.GetExtendedACLRequest - (*GetExtendedACLResponse)(nil), // 11: neo.fs.v2.container.GetExtendedACLResponse - (*PutRequest_Body)(nil), // 12: neo.fs.v2.container.PutRequest.Body - (*PutResponse_Body)(nil), // 13: neo.fs.v2.container.PutResponse.Body - (*DeleteRequest_Body)(nil), // 14: neo.fs.v2.container.DeleteRequest.Body - (*DeleteResponse_Body)(nil), // 15: neo.fs.v2.container.DeleteResponse.Body - (*GetRequest_Body)(nil), // 16: neo.fs.v2.container.GetRequest.Body - (*GetResponse_Body)(nil), // 17: neo.fs.v2.container.GetResponse.Body - (*ListRequest_Body)(nil), // 18: neo.fs.v2.container.ListRequest.Body - (*ListResponse_Body)(nil), // 19: neo.fs.v2.container.ListResponse.Body - (*SetExtendedACLRequest_Body)(nil), // 20: neo.fs.v2.container.SetExtendedACLRequest.Body - (*SetExtendedACLResponse_Body)(nil), // 21: neo.fs.v2.container.SetExtendedACLResponse.Body - (*GetExtendedACLRequest_Body)(nil), // 22: neo.fs.v2.container.GetExtendedACLRequest.Body - (*GetExtendedACLResponse_Body)(nil), // 23: neo.fs.v2.container.GetExtendedACLResponse.Body - (*grpc.RequestMetaHeader)(nil), // 24: neo.fs.v2.session.RequestMetaHeader - (*grpc.RequestVerificationHeader)(nil), // 25: neo.fs.v2.session.RequestVerificationHeader - (*grpc.ResponseMetaHeader)(nil), // 26: neo.fs.v2.session.ResponseMetaHeader - (*grpc.ResponseVerificationHeader)(nil), // 27: neo.fs.v2.session.ResponseVerificationHeader - (*Container)(nil), // 28: neo.fs.v2.container.Container - (*grpc1.Signature)(nil), // 29: neo.fs.v2.refs.Signature - (*grpc1.ContainerID)(nil), // 30: neo.fs.v2.refs.ContainerID - (*grpc1.OwnerID)(nil), // 31: neo.fs.v2.refs.OwnerID - (*grpc2.EACLTable)(nil), // 32: neo.fs.v2.acl.EACLTable + (*PutRequest)(nil), // 0: neo.fs.v2.container.PutRequest + (*PutResponse)(nil), // 1: neo.fs.v2.container.PutResponse + (*DeleteRequest)(nil), // 2: neo.fs.v2.container.DeleteRequest + (*DeleteResponse)(nil), // 3: neo.fs.v2.container.DeleteResponse + (*GetRequest)(nil), // 4: neo.fs.v2.container.GetRequest + (*GetResponse)(nil), // 5: neo.fs.v2.container.GetResponse + (*ListRequest)(nil), // 6: neo.fs.v2.container.ListRequest + (*ListResponse)(nil), // 7: neo.fs.v2.container.ListResponse + (*SetExtendedACLRequest)(nil), // 8: neo.fs.v2.container.SetExtendedACLRequest + (*SetExtendedACLResponse)(nil), // 9: neo.fs.v2.container.SetExtendedACLResponse + (*GetExtendedACLRequest)(nil), // 10: neo.fs.v2.container.GetExtendedACLRequest + (*GetExtendedACLResponse)(nil), // 11: neo.fs.v2.container.GetExtendedACLResponse + (*AnnounceUsedSpaceRequest)(nil), // 12: neo.fs.v2.container.AnnounceUsedSpaceRequest + (*AnnounceUsedSpaceResponse)(nil), // 13: neo.fs.v2.container.AnnounceUsedSpaceResponse + (*PutRequest_Body)(nil), // 14: neo.fs.v2.container.PutRequest.Body + (*PutResponse_Body)(nil), // 15: neo.fs.v2.container.PutResponse.Body + (*DeleteRequest_Body)(nil), // 16: neo.fs.v2.container.DeleteRequest.Body + (*DeleteResponse_Body)(nil), // 17: neo.fs.v2.container.DeleteResponse.Body + (*GetRequest_Body)(nil), // 18: neo.fs.v2.container.GetRequest.Body + (*GetResponse_Body)(nil), // 19: neo.fs.v2.container.GetResponse.Body + (*ListRequest_Body)(nil), // 20: neo.fs.v2.container.ListRequest.Body + (*ListResponse_Body)(nil), // 21: neo.fs.v2.container.ListResponse.Body + (*SetExtendedACLRequest_Body)(nil), // 22: neo.fs.v2.container.SetExtendedACLRequest.Body + (*SetExtendedACLResponse_Body)(nil), // 23: neo.fs.v2.container.SetExtendedACLResponse.Body + (*GetExtendedACLRequest_Body)(nil), // 24: neo.fs.v2.container.GetExtendedACLRequest.Body + (*GetExtendedACLResponse_Body)(nil), // 25: neo.fs.v2.container.GetExtendedACLResponse.Body + (*AnnounceUsedSpaceRequest_Body)(nil), // 26: neo.fs.v2.container.AnnounceUsedSpaceRequest.Body + (*AnnounceUsedSpaceRequest_Body_Announcement)(nil), // 27: neo.fs.v2.container.AnnounceUsedSpaceRequest.Body.Announcement + (*AnnounceUsedSpaceResponse_Body)(nil), // 28: neo.fs.v2.container.AnnounceUsedSpaceResponse.Body + (*grpc.RequestMetaHeader)(nil), // 29: neo.fs.v2.session.RequestMetaHeader + (*grpc.RequestVerificationHeader)(nil), // 30: neo.fs.v2.session.RequestVerificationHeader + (*grpc.ResponseMetaHeader)(nil), // 31: neo.fs.v2.session.ResponseMetaHeader + (*grpc.ResponseVerificationHeader)(nil), // 32: neo.fs.v2.session.ResponseVerificationHeader + (*Container)(nil), // 33: neo.fs.v2.container.Container + (*grpc1.Signature)(nil), // 34: neo.fs.v2.refs.Signature + (*grpc1.ContainerID)(nil), // 35: neo.fs.v2.refs.ContainerID + (*grpc1.OwnerID)(nil), // 36: neo.fs.v2.refs.OwnerID + (*grpc2.EACLTable)(nil), // 37: neo.fs.v2.acl.EACLTable } var file_v2_container_grpc_service_proto_depIdxs = []int32{ - 12, // 0: neo.fs.v2.container.PutRequest.body:type_name -> neo.fs.v2.container.PutRequest.Body - 24, // 1: neo.fs.v2.container.PutRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader - 25, // 2: neo.fs.v2.container.PutRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader - 13, // 3: neo.fs.v2.container.PutResponse.body:type_name -> neo.fs.v2.container.PutResponse.Body - 26, // 4: neo.fs.v2.container.PutResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader - 27, // 5: neo.fs.v2.container.PutResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader - 14, // 6: neo.fs.v2.container.DeleteRequest.body:type_name -> neo.fs.v2.container.DeleteRequest.Body - 24, // 7: neo.fs.v2.container.DeleteRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader - 25, // 8: neo.fs.v2.container.DeleteRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader - 15, // 9: neo.fs.v2.container.DeleteResponse.body:type_name -> neo.fs.v2.container.DeleteResponse.Body - 26, // 10: neo.fs.v2.container.DeleteResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader - 27, // 11: neo.fs.v2.container.DeleteResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader - 16, // 12: neo.fs.v2.container.GetRequest.body:type_name -> neo.fs.v2.container.GetRequest.Body - 24, // 13: neo.fs.v2.container.GetRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader - 25, // 14: neo.fs.v2.container.GetRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader - 17, // 15: neo.fs.v2.container.GetResponse.body:type_name -> neo.fs.v2.container.GetResponse.Body - 26, // 16: neo.fs.v2.container.GetResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader - 27, // 17: neo.fs.v2.container.GetResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader - 18, // 18: neo.fs.v2.container.ListRequest.body:type_name -> neo.fs.v2.container.ListRequest.Body - 24, // 19: neo.fs.v2.container.ListRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader - 25, // 20: neo.fs.v2.container.ListRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader - 19, // 21: neo.fs.v2.container.ListResponse.body:type_name -> neo.fs.v2.container.ListResponse.Body - 26, // 22: neo.fs.v2.container.ListResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader - 27, // 23: neo.fs.v2.container.ListResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader - 20, // 24: neo.fs.v2.container.SetExtendedACLRequest.body:type_name -> neo.fs.v2.container.SetExtendedACLRequest.Body - 24, // 25: neo.fs.v2.container.SetExtendedACLRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader - 25, // 26: neo.fs.v2.container.SetExtendedACLRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader - 21, // 27: neo.fs.v2.container.SetExtendedACLResponse.body:type_name -> neo.fs.v2.container.SetExtendedACLResponse.Body - 26, // 28: neo.fs.v2.container.SetExtendedACLResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader - 27, // 29: neo.fs.v2.container.SetExtendedACLResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader - 22, // 30: neo.fs.v2.container.GetExtendedACLRequest.body:type_name -> neo.fs.v2.container.GetExtendedACLRequest.Body - 24, // 31: neo.fs.v2.container.GetExtendedACLRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader - 25, // 32: neo.fs.v2.container.GetExtendedACLRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader - 23, // 33: neo.fs.v2.container.GetExtendedACLResponse.body:type_name -> neo.fs.v2.container.GetExtendedACLResponse.Body - 26, // 34: neo.fs.v2.container.GetExtendedACLResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader - 27, // 35: neo.fs.v2.container.GetExtendedACLResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader - 28, // 36: neo.fs.v2.container.PutRequest.Body.container:type_name -> neo.fs.v2.container.Container - 29, // 37: neo.fs.v2.container.PutRequest.Body.signature:type_name -> neo.fs.v2.refs.Signature - 30, // 38: neo.fs.v2.container.PutResponse.Body.container_id:type_name -> neo.fs.v2.refs.ContainerID - 30, // 39: neo.fs.v2.container.DeleteRequest.Body.container_id:type_name -> neo.fs.v2.refs.ContainerID - 29, // 40: neo.fs.v2.container.DeleteRequest.Body.signature:type_name -> neo.fs.v2.refs.Signature - 30, // 41: neo.fs.v2.container.GetRequest.Body.container_id:type_name -> neo.fs.v2.refs.ContainerID - 28, // 42: neo.fs.v2.container.GetResponse.Body.container:type_name -> neo.fs.v2.container.Container - 31, // 43: neo.fs.v2.container.ListRequest.Body.owner_id:type_name -> neo.fs.v2.refs.OwnerID - 30, // 44: neo.fs.v2.container.ListResponse.Body.container_ids:type_name -> neo.fs.v2.refs.ContainerID - 32, // 45: neo.fs.v2.container.SetExtendedACLRequest.Body.eacl:type_name -> neo.fs.v2.acl.EACLTable - 29, // 46: neo.fs.v2.container.SetExtendedACLRequest.Body.signature:type_name -> neo.fs.v2.refs.Signature - 30, // 47: neo.fs.v2.container.GetExtendedACLRequest.Body.container_id:type_name -> neo.fs.v2.refs.ContainerID - 32, // 48: neo.fs.v2.container.GetExtendedACLResponse.Body.eacl:type_name -> neo.fs.v2.acl.EACLTable - 29, // 49: neo.fs.v2.container.GetExtendedACLResponse.Body.signature:type_name -> neo.fs.v2.refs.Signature - 0, // 50: neo.fs.v2.container.ContainerService.Put:input_type -> neo.fs.v2.container.PutRequest - 2, // 51: neo.fs.v2.container.ContainerService.Delete:input_type -> neo.fs.v2.container.DeleteRequest - 4, // 52: neo.fs.v2.container.ContainerService.Get:input_type -> neo.fs.v2.container.GetRequest - 6, // 53: neo.fs.v2.container.ContainerService.List:input_type -> neo.fs.v2.container.ListRequest - 8, // 54: neo.fs.v2.container.ContainerService.SetExtendedACL:input_type -> neo.fs.v2.container.SetExtendedACLRequest - 10, // 55: neo.fs.v2.container.ContainerService.GetExtendedACL:input_type -> neo.fs.v2.container.GetExtendedACLRequest - 1, // 56: neo.fs.v2.container.ContainerService.Put:output_type -> neo.fs.v2.container.PutResponse - 3, // 57: neo.fs.v2.container.ContainerService.Delete:output_type -> neo.fs.v2.container.DeleteResponse - 5, // 58: neo.fs.v2.container.ContainerService.Get:output_type -> neo.fs.v2.container.GetResponse - 7, // 59: neo.fs.v2.container.ContainerService.List:output_type -> neo.fs.v2.container.ListResponse - 9, // 60: neo.fs.v2.container.ContainerService.SetExtendedACL:output_type -> neo.fs.v2.container.SetExtendedACLResponse - 11, // 61: neo.fs.v2.container.ContainerService.GetExtendedACL:output_type -> neo.fs.v2.container.GetExtendedACLResponse - 56, // [56:62] is the sub-list for method output_type - 50, // [50:56] is the sub-list for method input_type - 50, // [50:50] is the sub-list for extension type_name - 50, // [50:50] is the sub-list for extension extendee - 0, // [0:50] is the sub-list for field type_name + 14, // 0: neo.fs.v2.container.PutRequest.body:type_name -> neo.fs.v2.container.PutRequest.Body + 29, // 1: neo.fs.v2.container.PutRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader + 30, // 2: neo.fs.v2.container.PutRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader + 15, // 3: neo.fs.v2.container.PutResponse.body:type_name -> neo.fs.v2.container.PutResponse.Body + 31, // 4: neo.fs.v2.container.PutResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader + 32, // 5: neo.fs.v2.container.PutResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 16, // 6: neo.fs.v2.container.DeleteRequest.body:type_name -> neo.fs.v2.container.DeleteRequest.Body + 29, // 7: neo.fs.v2.container.DeleteRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader + 30, // 8: neo.fs.v2.container.DeleteRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader + 17, // 9: neo.fs.v2.container.DeleteResponse.body:type_name -> neo.fs.v2.container.DeleteResponse.Body + 31, // 10: neo.fs.v2.container.DeleteResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader + 32, // 11: neo.fs.v2.container.DeleteResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 18, // 12: neo.fs.v2.container.GetRequest.body:type_name -> neo.fs.v2.container.GetRequest.Body + 29, // 13: neo.fs.v2.container.GetRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader + 30, // 14: neo.fs.v2.container.GetRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader + 19, // 15: neo.fs.v2.container.GetResponse.body:type_name -> neo.fs.v2.container.GetResponse.Body + 31, // 16: neo.fs.v2.container.GetResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader + 32, // 17: neo.fs.v2.container.GetResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 20, // 18: neo.fs.v2.container.ListRequest.body:type_name -> neo.fs.v2.container.ListRequest.Body + 29, // 19: neo.fs.v2.container.ListRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader + 30, // 20: neo.fs.v2.container.ListRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader + 21, // 21: neo.fs.v2.container.ListResponse.body:type_name -> neo.fs.v2.container.ListResponse.Body + 31, // 22: neo.fs.v2.container.ListResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader + 32, // 23: neo.fs.v2.container.ListResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 22, // 24: neo.fs.v2.container.SetExtendedACLRequest.body:type_name -> neo.fs.v2.container.SetExtendedACLRequest.Body + 29, // 25: neo.fs.v2.container.SetExtendedACLRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader + 30, // 26: neo.fs.v2.container.SetExtendedACLRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader + 23, // 27: neo.fs.v2.container.SetExtendedACLResponse.body:type_name -> neo.fs.v2.container.SetExtendedACLResponse.Body + 31, // 28: neo.fs.v2.container.SetExtendedACLResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader + 32, // 29: neo.fs.v2.container.SetExtendedACLResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 24, // 30: neo.fs.v2.container.GetExtendedACLRequest.body:type_name -> neo.fs.v2.container.GetExtendedACLRequest.Body + 29, // 31: neo.fs.v2.container.GetExtendedACLRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader + 30, // 32: neo.fs.v2.container.GetExtendedACLRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader + 25, // 33: neo.fs.v2.container.GetExtendedACLResponse.body:type_name -> neo.fs.v2.container.GetExtendedACLResponse.Body + 31, // 34: neo.fs.v2.container.GetExtendedACLResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader + 32, // 35: neo.fs.v2.container.GetExtendedACLResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 26, // 36: neo.fs.v2.container.AnnounceUsedSpaceRequest.body:type_name -> neo.fs.v2.container.AnnounceUsedSpaceRequest.Body + 29, // 37: neo.fs.v2.container.AnnounceUsedSpaceRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader + 30, // 38: neo.fs.v2.container.AnnounceUsedSpaceRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader + 28, // 39: neo.fs.v2.container.AnnounceUsedSpaceResponse.body:type_name -> neo.fs.v2.container.AnnounceUsedSpaceResponse.Body + 31, // 40: neo.fs.v2.container.AnnounceUsedSpaceResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader + 32, // 41: neo.fs.v2.container.AnnounceUsedSpaceResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 33, // 42: neo.fs.v2.container.PutRequest.Body.container:type_name -> neo.fs.v2.container.Container + 34, // 43: neo.fs.v2.container.PutRequest.Body.signature:type_name -> neo.fs.v2.refs.Signature + 35, // 44: neo.fs.v2.container.PutResponse.Body.container_id:type_name -> neo.fs.v2.refs.ContainerID + 35, // 45: neo.fs.v2.container.DeleteRequest.Body.container_id:type_name -> neo.fs.v2.refs.ContainerID + 34, // 46: neo.fs.v2.container.DeleteRequest.Body.signature:type_name -> neo.fs.v2.refs.Signature + 35, // 47: neo.fs.v2.container.GetRequest.Body.container_id:type_name -> neo.fs.v2.refs.ContainerID + 33, // 48: neo.fs.v2.container.GetResponse.Body.container:type_name -> neo.fs.v2.container.Container + 36, // 49: neo.fs.v2.container.ListRequest.Body.owner_id:type_name -> neo.fs.v2.refs.OwnerID + 35, // 50: neo.fs.v2.container.ListResponse.Body.container_ids:type_name -> neo.fs.v2.refs.ContainerID + 37, // 51: neo.fs.v2.container.SetExtendedACLRequest.Body.eacl:type_name -> neo.fs.v2.acl.EACLTable + 34, // 52: neo.fs.v2.container.SetExtendedACLRequest.Body.signature:type_name -> neo.fs.v2.refs.Signature + 35, // 53: neo.fs.v2.container.GetExtendedACLRequest.Body.container_id:type_name -> neo.fs.v2.refs.ContainerID + 37, // 54: neo.fs.v2.container.GetExtendedACLResponse.Body.eacl:type_name -> neo.fs.v2.acl.EACLTable + 34, // 55: neo.fs.v2.container.GetExtendedACLResponse.Body.signature:type_name -> neo.fs.v2.refs.Signature + 27, // 56: neo.fs.v2.container.AnnounceUsedSpaceRequest.Body.announcements:type_name -> neo.fs.v2.container.AnnounceUsedSpaceRequest.Body.Announcement + 35, // 57: neo.fs.v2.container.AnnounceUsedSpaceRequest.Body.Announcement.container_id:type_name -> neo.fs.v2.refs.ContainerID + 0, // 58: neo.fs.v2.container.ContainerService.Put:input_type -> neo.fs.v2.container.PutRequest + 2, // 59: neo.fs.v2.container.ContainerService.Delete:input_type -> neo.fs.v2.container.DeleteRequest + 4, // 60: neo.fs.v2.container.ContainerService.Get:input_type -> neo.fs.v2.container.GetRequest + 6, // 61: neo.fs.v2.container.ContainerService.List:input_type -> neo.fs.v2.container.ListRequest + 8, // 62: neo.fs.v2.container.ContainerService.SetExtendedACL:input_type -> neo.fs.v2.container.SetExtendedACLRequest + 10, // 63: neo.fs.v2.container.ContainerService.GetExtendedACL:input_type -> neo.fs.v2.container.GetExtendedACLRequest + 12, // 64: neo.fs.v2.container.ContainerService.AnnounceUsedSpace:input_type -> neo.fs.v2.container.AnnounceUsedSpaceRequest + 1, // 65: neo.fs.v2.container.ContainerService.Put:output_type -> neo.fs.v2.container.PutResponse + 3, // 66: neo.fs.v2.container.ContainerService.Delete:output_type -> neo.fs.v2.container.DeleteResponse + 5, // 67: neo.fs.v2.container.ContainerService.Get:output_type -> neo.fs.v2.container.GetResponse + 7, // 68: neo.fs.v2.container.ContainerService.List:output_type -> neo.fs.v2.container.ListResponse + 9, // 69: neo.fs.v2.container.ContainerService.SetExtendedACL:output_type -> neo.fs.v2.container.SetExtendedACLResponse + 11, // 70: neo.fs.v2.container.ContainerService.GetExtendedACL:output_type -> neo.fs.v2.container.GetExtendedACLResponse + 13, // 71: neo.fs.v2.container.ContainerService.AnnounceUsedSpace:output_type -> neo.fs.v2.container.AnnounceUsedSpaceResponse + 65, // [65:72] is the sub-list for method output_type + 58, // [58:65] is the sub-list for method input_type + 58, // [58:58] is the sub-list for extension type_name + 58, // [58:58] is the sub-list for extension extendee + 0, // [0:58] is the sub-list for field type_name } func init() { file_v2_container_grpc_service_proto_init() } @@ -2054,7 +2412,7 @@ func file_v2_container_grpc_service_proto_init() { } } file_v2_container_grpc_service_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PutRequest_Body); i { + switch v := v.(*AnnounceUsedSpaceRequest); i { case 0: return &v.state case 1: @@ -2066,7 +2424,7 @@ func file_v2_container_grpc_service_proto_init() { } } file_v2_container_grpc_service_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PutResponse_Body); i { + switch v := v.(*AnnounceUsedSpaceResponse); i { case 0: return &v.state case 1: @@ -2078,7 +2436,7 @@ func file_v2_container_grpc_service_proto_init() { } } file_v2_container_grpc_service_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DeleteRequest_Body); i { + switch v := v.(*PutRequest_Body); i { case 0: return &v.state case 1: @@ -2090,7 +2448,7 @@ func file_v2_container_grpc_service_proto_init() { } } file_v2_container_grpc_service_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DeleteResponse_Body); i { + switch v := v.(*PutResponse_Body); i { case 0: return &v.state case 1: @@ -2102,7 +2460,7 @@ func file_v2_container_grpc_service_proto_init() { } } file_v2_container_grpc_service_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetRequest_Body); i { + switch v := v.(*DeleteRequest_Body); i { case 0: return &v.state case 1: @@ -2114,7 +2472,7 @@ func file_v2_container_grpc_service_proto_init() { } } file_v2_container_grpc_service_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetResponse_Body); i { + switch v := v.(*DeleteResponse_Body); i { case 0: return &v.state case 1: @@ -2126,7 +2484,7 @@ func file_v2_container_grpc_service_proto_init() { } } file_v2_container_grpc_service_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ListRequest_Body); i { + switch v := v.(*GetRequest_Body); i { case 0: return &v.state case 1: @@ -2138,7 +2496,7 @@ func file_v2_container_grpc_service_proto_init() { } } file_v2_container_grpc_service_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ListResponse_Body); i { + switch v := v.(*GetResponse_Body); i { case 0: return &v.state case 1: @@ -2150,7 +2508,7 @@ func file_v2_container_grpc_service_proto_init() { } } file_v2_container_grpc_service_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SetExtendedACLRequest_Body); i { + switch v := v.(*ListRequest_Body); i { case 0: return &v.state case 1: @@ -2162,7 +2520,7 @@ func file_v2_container_grpc_service_proto_init() { } } file_v2_container_grpc_service_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SetExtendedACLResponse_Body); i { + switch v := v.(*ListResponse_Body); i { case 0: return &v.state case 1: @@ -2174,7 +2532,7 @@ func file_v2_container_grpc_service_proto_init() { } } file_v2_container_grpc_service_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetExtendedACLRequest_Body); i { + switch v := v.(*SetExtendedACLRequest_Body); i { case 0: return &v.state case 1: @@ -2186,6 +2544,30 @@ func file_v2_container_grpc_service_proto_init() { } } file_v2_container_grpc_service_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SetExtendedACLResponse_Body); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_container_grpc_service_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetExtendedACLRequest_Body); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_container_grpc_service_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GetExtendedACLResponse_Body); i { case 0: return &v.state @@ -2197,6 +2579,42 @@ func file_v2_container_grpc_service_proto_init() { return nil } } + file_v2_container_grpc_service_proto_msgTypes[26].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AnnounceUsedSpaceRequest_Body); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_container_grpc_service_proto_msgTypes[27].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AnnounceUsedSpaceRequest_Body_Announcement); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_container_grpc_service_proto_msgTypes[28].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AnnounceUsedSpaceResponse_Body); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } type x struct{} out := protoimpl.TypeBuilder{ @@ -2204,7 +2622,7 @@ func file_v2_container_grpc_service_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_v2_container_grpc_service_proto_rawDesc, NumEnums: 0, - NumMessages: 24, + NumMessages: 29, NumExtensions: 0, NumServices: 1, }, @@ -2251,6 +2669,8 @@ type ContainerServiceClient interface { // Returns Extended ACL table and signature from `Container` smart contract // storage. GetExtendedACL(ctx context.Context, in *GetExtendedACLRequest, opts ...grpc3.CallOption) (*GetExtendedACLResponse, error) + // Announce container used space values for P2P synchronization. + AnnounceUsedSpace(ctx context.Context, in *AnnounceUsedSpaceRequest, opts ...grpc3.CallOption) (*AnnounceUsedSpaceResponse, error) } type containerServiceClient struct { @@ -2315,6 +2735,15 @@ func (c *containerServiceClient) GetExtendedACL(ctx context.Context, in *GetExte return out, nil } +func (c *containerServiceClient) AnnounceUsedSpace(ctx context.Context, in *AnnounceUsedSpaceRequest, opts ...grpc3.CallOption) (*AnnounceUsedSpaceResponse, error) { + out := new(AnnounceUsedSpaceResponse) + err := c.cc.Invoke(ctx, "/neo.fs.v2.container.ContainerService/AnnounceUsedSpace", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // ContainerServiceServer is the server API for ContainerService service. type ContainerServiceServer interface { // `Put` invokes `Container` smart contract's `Put` method and returns @@ -2338,6 +2767,8 @@ type ContainerServiceServer interface { // Returns Extended ACL table and signature from `Container` smart contract // storage. GetExtendedACL(context.Context, *GetExtendedACLRequest) (*GetExtendedACLResponse, error) + // Announce container used space values for P2P synchronization. + AnnounceUsedSpace(context.Context, *AnnounceUsedSpaceRequest) (*AnnounceUsedSpaceResponse, error) } // UnimplementedContainerServiceServer can be embedded to have forward compatible implementations. @@ -2362,6 +2793,9 @@ func (*UnimplementedContainerServiceServer) SetExtendedACL(context.Context, *Set func (*UnimplementedContainerServiceServer) GetExtendedACL(context.Context, *GetExtendedACLRequest) (*GetExtendedACLResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method GetExtendedACL not implemented") } +func (*UnimplementedContainerServiceServer) AnnounceUsedSpace(context.Context, *AnnounceUsedSpaceRequest) (*AnnounceUsedSpaceResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method AnnounceUsedSpace not implemented") +} func RegisterContainerServiceServer(s *grpc3.Server, srv ContainerServiceServer) { s.RegisterService(&_ContainerService_serviceDesc, srv) @@ -2475,6 +2909,24 @@ func _ContainerService_GetExtendedACL_Handler(srv interface{}, ctx context.Conte return interceptor(ctx, in, info, handler) } +func _ContainerService_AnnounceUsedSpace_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc3.UnaryServerInterceptor) (interface{}, error) { + in := new(AnnounceUsedSpaceRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ContainerServiceServer).AnnounceUsedSpace(ctx, in) + } + info := &grpc3.UnaryServerInfo{ + Server: srv, + FullMethod: "/neo.fs.v2.container.ContainerService/AnnounceUsedSpace", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ContainerServiceServer).AnnounceUsedSpace(ctx, req.(*AnnounceUsedSpaceRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _ContainerService_serviceDesc = grpc3.ServiceDesc{ ServiceName: "neo.fs.v2.container.ContainerService", HandlerType: (*ContainerServiceServer)(nil), @@ -2503,6 +2955,10 @@ var _ContainerService_serviceDesc = grpc3.ServiceDesc{ MethodName: "GetExtendedACL", Handler: _ContainerService_GetExtendedACL_Handler, }, + { + MethodName: "AnnounceUsedSpace", + Handler: _ContainerService_AnnounceUsedSpace_Handler, + }, }, Streams: []grpc3.StreamDesc{}, Metadata: "v2/container/grpc/service.proto", diff --git a/v2/container/marshal.go b/v2/container/marshal.go index 8486b02..f86d964 100644 --- a/v2/container/marshal.go +++ b/v2/container/marshal.go @@ -40,6 +40,11 @@ const ( getEACLRespBodyTableField = 1 getEACLRespBodySignatureField = 2 + + usedSpaceAnnounceCIDField = 1 + usedSpaceAnnounceUsedSpaceField = 2 + + usedSpaceReqBodyAnnouncementsField = 1 ) func (a *Attribute) StableMarshal(buf []byte) ([]byte, error) { @@ -534,3 +539,89 @@ func (r *GetExtendedACLResponseBody) StableSize() (size int) { return size } + +func (a *UsedSpaceAnnouncement) StableMarshal(buf []byte) ([]byte, error) { + if a == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, a.StableSize()) + } + + var ( + offset, n int + err error + ) + + n, err = protoutil.NestedStructureMarshal(usedSpaceAnnounceCIDField, buf[offset:], a.cid) + if err != nil { + return nil, err + } + + offset += n + + _, err = protoutil.UInt64Marshal(usedSpaceAnnounceUsedSpaceField, buf[offset:], a.usedSpace) + if err != nil { + return nil, err + } + + return buf, nil +} + +func (a *UsedSpaceAnnouncement) StableSize() (size int) { + if a == nil { + return 0 + } + + size += protoutil.NestedStructureSize(usedSpaceAnnounceCIDField, a.cid) + size += protoutil.UInt64Size(usedSpaceAnnounceUsedSpaceField, a.usedSpace) + + return size +} + +func (r *AnnounceUsedSpaceRequestBody) StableMarshal(buf []byte) ([]byte, error) { + if r == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, r.StableSize()) + } + + var ( + offset, n int + err error + ) + + for i := range r.announcements { + n, err = protoutil.NestedStructureMarshal(usedSpaceReqBodyAnnouncementsField, buf[offset:], r.announcements[i]) + if err != nil { + return nil, err + } + + offset += n + } + + return buf, nil +} + +func (r *AnnounceUsedSpaceRequestBody) StableSize() (size int) { + if r == nil { + return 0 + } + + for i := range r.announcements { + size += protoutil.NestedStructureSize(usedSpaceReqBodyAnnouncementsField, r.announcements[i]) + } + + return size +} + +func (r *AnnounceUsedSpaceResponseBody) StableMarshal(buf []byte) ([]byte, error) { + return nil, nil +} + +func (r *AnnounceUsedSpaceResponseBody) StableSize() (size int) { + return 0 +} diff --git a/v2/container/marshal_test.go b/v2/container/marshal_test.go index d2c25e5..5a86e88 100644 --- a/v2/container/marshal_test.go +++ b/v2/container/marshal_test.go @@ -1,7 +1,9 @@ package container_test import ( + "crypto/sha256" "fmt" + "math/rand" "testing" "github.com/nspcc-dev/neofs-api-go/v2/acl" @@ -232,6 +234,38 @@ func TestGetEACLResponseBody_StableMarshal(t *testing.T) { }) } +func TestAnnounceUsedSpaceRequestBody_StableMarshal(t *testing.T) { + requestFrom := generateAnnounceRequestBody(10) + transport := new(grpc.AnnounceUsedSpaceRequest_Body) + + t.Run("non empty", func(t *testing.T) { + wire, err := requestFrom.StableMarshal(nil) + require.NoError(t, err) + + err = goproto.Unmarshal(wire, transport) + require.NoError(t, err) + + requestTo := container.AnnounceUsedSpaceRequestBodyFromGRPCMessage(transport) + require.Equal(t, requestFrom, requestTo) + }) +} + +func TestAnnounceUsedSpaceResponseBody_StableMarshal(t *testing.T) { + responseFrom := generateAnnounceResponseBody() + transport := new(grpc.AnnounceUsedSpaceResponse_Body) + + t.Run("non empty", func(t *testing.T) { + wire, err := responseFrom.StableMarshal(nil) + require.NoError(t, err) + + err = goproto.Unmarshal(wire, transport) + require.NoError(t, err) + + responseTo := container.AnnounceUsedSpaceResponseBodyFromGRPCMessage(transport) + require.Equal(t, responseFrom, responseTo) + }) +} + func generateAttribute(k, v string) *container.Attribute { attr := new(container.Attribute) attr.SetKey(k) @@ -408,3 +442,28 @@ func generateGetEACLResponseBody(n int, k, v string) *container.GetExtendedACLRe return resp } + +func generateAnnounceRequestBody(n int) *container.AnnounceUsedSpaceRequestBody { + resp := new(container.AnnounceUsedSpaceRequestBody) + buf := make([]byte, sha256.Size) + + announcements := make([]*container.UsedSpaceAnnouncement, 0, n) + for i := 0; i < n; i++ { + rand.Read(buf) + + cid := new(refs.ContainerID) + cid.SetValue(buf) + + a := new(container.UsedSpaceAnnouncement) + a.SetContainerID(cid) + a.SetUsedSpace(rand.Uint64()) + } + + resp.SetAnnouncements(announcements) + + return resp +} + +func generateAnnounceResponseBody() *container.AnnounceUsedSpaceResponseBody { + return new(container.AnnounceUsedSpaceResponseBody) +} diff --git a/v2/container/service.go b/v2/container/service.go index f664084..7c369b2 100644 --- a/v2/container/service.go +++ b/v2/container/service.go @@ -13,6 +13,7 @@ type Service interface { List(context.Context, *ListRequest) (*ListResponse, error) SetExtendedACL(context.Context, *SetExtendedACLRequest) (*SetExtendedACLResponse, error) GetExtendedACL(context.Context, *GetExtendedACLRequest) (*GetExtendedACLResponse, error) + AnnounceUsedSpace(context.Context, *AnnounceUsedSpaceRequest) (*AnnounceUsedSpaceResponse, error) } type PutRequest struct { @@ -94,3 +95,19 @@ type GetExtendedACLResponse struct { verifyHeader *session.ResponseVerificationHeader } + +type AnnounceUsedSpaceRequest struct { + body *AnnounceUsedSpaceRequestBody + + metaHeader *session.RequestMetaHeader + + verifyHeader *session.RequestVerificationHeader +} + +type AnnounceUsedSpaceResponse struct { + body *AnnounceUsedSpaceResponseBody + + metaHeader *session.ResponseMetaHeader + + verifyHeader *session.ResponseVerificationHeader +} diff --git a/v2/container/test/client_test.go b/v2/container/test/client_test.go index 2eed490..da7cad0 100644 --- a/v2/container/test/client_test.go +++ b/v2/container/test/client_test.go @@ -22,14 +22,15 @@ type testGRPCClient struct { } type testGRPCServer struct { - key *ecdsa.PrivateKey - putResp *container.PutResponse - getResp *container.GetResponse - delResp *container.DeleteResponse - listResp *container.ListResponse - sEaclResp *container.SetExtendedACLResponse - gEaclResp *container.GetExtendedACLResponse - err error + key *ecdsa.PrivateKey + putResp *container.PutResponse + getResp *container.GetResponse + delResp *container.DeleteResponse + listResp *container.ListResponse + sEaclResp *container.SetExtendedACLResponse + gEaclResp *container.GetExtendedACLResponse + announceResp *container.AnnounceUsedSpaceResponse + err error } func (s *testGRPCClient) Put(ctx context.Context, in *containerGRPC.PutRequest, opts ...grpc.CallOption) (*containerGRPC.PutResponse, error) { @@ -56,6 +57,10 @@ func (s *testGRPCClient) GetExtendedACL(ctx context.Context, in *containerGRPC.G return s.server.GetExtendedACL(ctx, in) } +func (s *testGRPCClient) AnnounceUsedSpace(ctx context.Context, in *containerGRPC.AnnounceUsedSpaceRequest, opts ...grpc.CallOption) (*containerGRPC.AnnounceUsedSpaceResponse, error) { + return s.server.AnnounceUsedSpace(ctx, in) +} + func (s *testGRPCServer) Put(_ context.Context, req *containerGRPC.PutRequest) (*containerGRPC.PutResponse, error) { if s.err != nil { return nil, s.err @@ -176,6 +181,26 @@ func (s *testGRPCServer) GetExtendedACL(_ context.Context, req *containerGRPC.Ge return container.GetExtendedACLResponseToGRPCMessage(s.gEaclResp), nil } +func (s *testGRPCServer) AnnounceUsedSpace(_ context.Context, req *containerGRPC.AnnounceUsedSpaceRequest) (*containerGRPC.AnnounceUsedSpaceResponse, error) { + if s.err != nil { + return nil, s.err + } + + // verify request structure + if err := signature.VerifyServiceMessage( + container.AnnounceUsedSpaceRequestFromGRPCMessage(req), + ); err != nil { + return nil, err + } + + // sign response structure + if err := signature.SignServiceMessage(s.key, s.announceResp); err != nil { + return nil, err + } + + return container.AnnounceUsedSpaceResponseToGRPCMessage(s.announceResp), nil +} + func testPutRequest() *container.PutRequest { cnr := new(container.Container) cnr.SetBasicACL(1) @@ -385,6 +410,50 @@ func testGetEACLResponse() *container.GetExtendedACLResponse { return resp } +func testAnnounceRequest() *container.AnnounceUsedSpaceRequest { + cid1 := new(refs.ContainerID) + cid1.SetValue([]byte{1, 2, 3}) + + cid2 := new(refs.ContainerID) + cid2.SetValue([]byte{4, 5, 6}) + + a1 := new(container.UsedSpaceAnnouncement) + a1.SetUsedSpace(10) + a1.SetContainerID(cid1) + + a2 := new(container.UsedSpaceAnnouncement) + a2.SetUsedSpace(20) + a2.SetContainerID(cid2) + + announcements := []*container.UsedSpaceAnnouncement{a1, a2} + + body := new(container.AnnounceUsedSpaceRequestBody) + body.SetAnnouncements(announcements) + + meta := new(session.RequestMetaHeader) + meta.SetTTL(1) + + req := new(container.AnnounceUsedSpaceRequest) + req.SetBody(body) + req.SetMetaHeader(meta) + + return req +} + +func testAnnounceResponse() *container.AnnounceUsedSpaceResponse { + body := new(container.AnnounceUsedSpaceResponseBody) + + meta := new(session.ResponseMetaHeader) + meta.SetTTL(1) + meta.SetXHeaders([]*session.XHeader{}) // w/o this require.Equal fails due to nil and []T{} difference + + resp := new(container.AnnounceUsedSpaceResponse) + resp.SetBody(body) + resp.SetMetaHeader(meta) + + return resp +} + func TestGRPCClient_Put(t *testing.T) { ctx := context.TODO() @@ -814,3 +883,74 @@ func TestGRPCClient_GetEACL(t *testing.T) { require.Equal(t, resp.GetMetaHeader(), r.GetMetaHeader()) }) } + +func TestGRPCClient_AnnounceUsedSpace(t *testing.T) { + ctx := context.TODO() + + cliKey := test.DecodeKey(0) + srvKey := test.DecodeKey(1) + + t.Run("gRPC server error", func(t *testing.T) { + srvErr := errors.New("test server error") + + srv := &testGRPCServer{ + err: srvErr, + } + + cli := &testGRPCClient{ + server: srv, + } + + c, err := container.NewClient(container.WithGRPCServiceClient(cli)) + require.NoError(t, err) + + resp, err := c.AnnounceUsedSpace(ctx, new(container.AnnounceUsedSpaceRequest)) + require.True(t, errors.Is(err, srvErr)) + require.Nil(t, resp) + }) + t.Run("invalid request structure", func(t *testing.T) { + req := testAnnounceRequest() + + require.Error(t, signature.VerifyServiceMessage(req)) + + c, err := container.NewClient( + container.WithGRPCServiceClient( + &testGRPCClient{ + server: new(testGRPCServer), + }, + ), + ) + require.NoError(t, err) + + resp, err := c.AnnounceUsedSpace(ctx, req) + require.Error(t, err) + require.Nil(t, resp) + }) + + t.Run("correct response", func(t *testing.T) { + req := testAnnounceRequest() + + require.NoError(t, signature.SignServiceMessage(cliKey, req)) + + resp := testAnnounceResponse() + + c, err := container.NewClient( + container.WithGRPCServiceClient( + &testGRPCClient{ + server: &testGRPCServer{ + key: srvKey, + announceResp: resp, + }, + }, + ), + ) + require.NoError(t, err) + + r, err := c.AnnounceUsedSpace(ctx, req) + require.NoError(t, err) + + require.NoError(t, signature.VerifyServiceMessage(r)) + require.Equal(t, resp.GetBody(), r.GetBody()) + require.Equal(t, resp.GetMetaHeader(), r.GetMetaHeader()) + }) +} diff --git a/v2/container/types.go b/v2/container/types.go index 0e53639..07b65e6 100644 --- a/v2/container/types.go +++ b/v2/container/types.go @@ -93,6 +93,18 @@ type GetExtendedACLResponseBody struct { sig *refs.Signature } +type UsedSpaceAnnouncement struct { + cid *refs.ContainerID + + usedSpace uint64 +} + +type AnnounceUsedSpaceRequestBody struct { + announcements []*UsedSpaceAnnouncement +} + +type AnnounceUsedSpaceResponseBody struct{} + func (a *Attribute) GetKey() string { if a != nil { return a.key @@ -904,3 +916,129 @@ func (r *GetExtendedACLResponse) SetVerificationHeader(v *session.ResponseVerifi r.verifyHeader = v } } + +func (a *UsedSpaceAnnouncement) GetUsedSpace() uint64 { + if a != nil { + return a.usedSpace + } + + return 0 +} + +func (a *UsedSpaceAnnouncement) SetUsedSpace(v uint64) { + if a != nil { + a.usedSpace = v + } +} + +func (a *UsedSpaceAnnouncement) GetContainerID() *refs.ContainerID { + if a != nil { + return a.cid + } + + return nil +} + +func (a *UsedSpaceAnnouncement) SetContainerID(v *refs.ContainerID) { + if a != nil { + a.cid = v + } +} + +func (r *AnnounceUsedSpaceRequestBody) GetAnnouncements() []*UsedSpaceAnnouncement { + if r != nil { + return r.announcements + } + + return nil +} + +func (r *AnnounceUsedSpaceRequestBody) SetAnnouncements(v []*UsedSpaceAnnouncement) { + if r != nil { + r.announcements = v + } +} + +func (r *AnnounceUsedSpaceRequest) GetBody() *AnnounceUsedSpaceRequestBody { + if r != nil { + return r.body + } + + return nil +} + +func (r *AnnounceUsedSpaceRequest) SetBody(v *AnnounceUsedSpaceRequestBody) { + if r != nil { + r.body = v + } +} + +func (r *AnnounceUsedSpaceRequest) GetMetaHeader() *session.RequestMetaHeader { + if r != nil { + return r.metaHeader + } + + return nil +} + +func (r *AnnounceUsedSpaceRequest) SetMetaHeader(v *session.RequestMetaHeader) { + if r != nil { + r.metaHeader = v + } +} + +func (r *AnnounceUsedSpaceRequest) GetVerificationHeader() *session.RequestVerificationHeader { + if r != nil { + return r.verifyHeader + } + + return nil +} + +func (r *AnnounceUsedSpaceRequest) SetVerificationHeader(v *session.RequestVerificationHeader) { + if r != nil { + r.verifyHeader = v + } +} + +func (r *AnnounceUsedSpaceResponse) GetBody() *AnnounceUsedSpaceResponseBody { + if r != nil { + return r.body + } + + return nil +} + +func (r *AnnounceUsedSpaceResponse) SetBody(v *AnnounceUsedSpaceResponseBody) { + if r != nil { + r.body = v + } +} + +func (r *AnnounceUsedSpaceResponse) GetMetaHeader() *session.ResponseMetaHeader { + if r != nil { + return r.metaHeader + } + + return nil +} + +func (r *AnnounceUsedSpaceResponse) SetMetaHeader(v *session.ResponseMetaHeader) { + if r != nil { + r.metaHeader = v + } +} + +func (r *AnnounceUsedSpaceResponse) GetVerificationHeader() *session.ResponseVerificationHeader { + if r != nil { + return r.verifyHeader + } + + return nil +} + +func (r *AnnounceUsedSpaceResponse) SetVerificationHeader(v *session.ResponseVerificationHeader) { + if r != nil { + r.verifyHeader = v + } +} diff --git a/v2/signature/sign.go b/v2/signature/sign.go index 405f70f..3a898de 100644 --- a/v2/signature/sign.go +++ b/v2/signature/sign.go @@ -330,6 +330,10 @@ func serviceMessageBody(req interface{}) stableMarshaler { return v.GetBody() case *container.GetExtendedACLResponse: return v.GetBody() + case *container.AnnounceUsedSpaceRequest: + return v.GetBody() + case *container.AnnounceUsedSpaceResponse: + return v.GetBody() /* Object */ case *object.PutRequest: From 5566081d2d5640c8bd282782dd248c94d9d03d1a Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Thu, 21 Jan 2021 18:47:00 +0300 Subject: [PATCH 0663/1196] [#245] pkg/client: Add AnnounceContainerUsedSpace method Signed-off-by: Alex Vanin --- pkg/client/container.go | 68 ++++++++++++++++++++++++++++++ pkg/container/announcement.go | 47 +++++++++++++++++++++ pkg/container/announcement_test.go | 44 +++++++++++++++++++ 3 files changed, 159 insertions(+) create mode 100644 pkg/container/announcement.go create mode 100644 pkg/container/announcement_test.go diff --git a/pkg/client/container.go b/pkg/client/container.go index 29b9871..6c7ef73 100644 --- a/pkg/client/container.go +++ b/pkg/client/container.go @@ -153,6 +153,20 @@ func (c Client) SetEACL(ctx context.Context, eacl *eacl.Table, opts ...CallOptio } } +// AnnounceContainerUsedSpace used by storage nodes to estimate their container +// sizes during lifetime. Use it only in storage node applications. +func (c Client) AnnounceContainerUsedSpace( + ctx context.Context, + announce []container.UsedSpaceAnnouncement, + opts ...CallOption) error { + switch c.remoteNode.Version.Major() { + case 2: + return c.announceContainerUsedSpaceV2(ctx, announce, opts...) + default: + return errUnsupportedProtocol + } +} + func (c Client) putContainerV2(ctx context.Context, cnr *container.Container, opts ...CallOption) (*container.ID, error) { // apply all available options callOptions := c.defaultCallOptions() @@ -495,6 +509,60 @@ func (c Client) setEACLV2(ctx context.Context, eacl *eacl.Table, opts ...CallOpt } } +func (c Client) announceContainerUsedSpaceV2( + ctx context.Context, + announce []container.UsedSpaceAnnouncement, + opts ...CallOption) error { + callOptions := c.defaultCallOptions() // apply all available options + + for i := range opts { + opts[i].apply(&callOptions) + } + + // convert list of SDK announcement structures into NeoFS-API v2 list + v2announce := make([]*v2container.UsedSpaceAnnouncement, 0, len(announce)) + for i := range announce { + v2announce = append(v2announce, announce[i].ToV2()) + } + + // prepare body of the NeoFS-API v2 request and request itself + reqBody := new(v2container.AnnounceUsedSpaceRequestBody) + reqBody.SetAnnouncements(v2announce) + + req := new(v2container.AnnounceUsedSpaceRequest) + req.SetBody(reqBody) + req.SetMetaHeader(v2MetaHeaderFromOpts(callOptions)) + + // sign the request + err := v2signature.SignServiceMessage(c.key, req) + if err != nil { + return err + } + + // choose underline transport protocol and send message over it + switch c.remoteNode.Protocol { + case GRPC: + cli, err := v2ContainerClientFromOptions(c.opts) + if err != nil { + return errors.Wrap(err, "can't create grpc client") + } + + resp, err := cli.AnnounceUsedSpace(ctx, req) + if err != nil { + return errors.Wrap(err, "transport error") + } + + err = v2signature.VerifyServiceMessage(resp) + if err != nil { + return errors.Wrap(err, "can't verify response message") + } + + return nil + default: + return errUnsupportedProtocol + } +} + func v2ContainerClientFromOptions(opts *clientOptions) (cli *v2container.Client, err error) { switch { case opts.grpcOpts.v2ContainerClient != nil: diff --git a/pkg/container/announcement.go b/pkg/container/announcement.go new file mode 100644 index 0000000..412272b --- /dev/null +++ b/pkg/container/announcement.go @@ -0,0 +1,47 @@ +package container + +import ( + "github.com/nspcc-dev/neofs-api-go/v2/container" +) + +// UsedSpaceAnnouncement is an announcement message used by storage nodes to +// estimate actual container sizes. +type UsedSpaceAnnouncement container.UsedSpaceAnnouncement + +// NewAnnouncement initialize empty UsedSpaceAnnouncement message. +func NewAnnouncement() *UsedSpaceAnnouncement { + return NewAnnouncementFromV2(new(container.UsedSpaceAnnouncement)) +} + +// NewAnnouncementFromV2 wraps protocol dependent version of +// UsedSpaceAnnouncement message. +func NewAnnouncementFromV2(v *container.UsedSpaceAnnouncement) *UsedSpaceAnnouncement { + return (*UsedSpaceAnnouncement)(v) +} + +// ContainerID of the announcement. +func (a *UsedSpaceAnnouncement) ContainerID() *ID { + return NewIDFromV2( + (*container.UsedSpaceAnnouncement)(a).GetContainerID(), + ) +} + +// SetContainerID sets announcement container value. +func (a *UsedSpaceAnnouncement) SetContainerID(cid *ID) { + (*container.UsedSpaceAnnouncement)(a).SetContainerID(cid.ToV2()) +} + +// UsedSpace in container. +func (a *UsedSpaceAnnouncement) UsedSpace() uint64 { + return (*container.UsedSpaceAnnouncement)(a).GetUsedSpace() +} + +// SetUsedSpace sets used space value by specified container. +func (a *UsedSpaceAnnouncement) SetUsedSpace(value uint64) { + (*container.UsedSpaceAnnouncement)(a).SetUsedSpace(value) +} + +// ToV2 returns protocol dependent version of UsedSpaceAnnouncement message. +func (a *UsedSpaceAnnouncement) ToV2() *container.UsedSpaceAnnouncement { + return (*container.UsedSpaceAnnouncement)(a) +} diff --git a/pkg/container/announcement_test.go b/pkg/container/announcement_test.go new file mode 100644 index 0000000..3fca102 --- /dev/null +++ b/pkg/container/announcement_test.go @@ -0,0 +1,44 @@ +package container_test + +import ( + "testing" + + "github.com/nspcc-dev/neofs-api-go/pkg/container" + "github.com/nspcc-dev/neofs-api-go/v2/refs" + "github.com/stretchr/testify/require" +) + +func TestAnnouncement(t *testing.T) { + const usedSpace uint64 = 100 + + cidValue := [32]byte{1, 2, 3} + cid := container.NewID() + cid.SetSHA256(cidValue) + + a := container.NewAnnouncement() + a.SetContainerID(cid) + a.SetUsedSpace(usedSpace) + + require.Equal(t, usedSpace, a.UsedSpace()) + require.Equal(t, cid, a.ContainerID()) + + t.Run("test v2", func(t *testing.T) { + const newUsedSpace uint64 = 200 + + newCidValue := [32]byte{4, 5, 6} + newCID := new(refs.ContainerID) + newCID.SetValue(newCidValue[:]) + + v2 := a.ToV2() + require.Equal(t, usedSpace, v2.GetUsedSpace()) + require.Equal(t, cidValue[:], v2.GetContainerID().GetValue()) + + v2.SetUsedSpace(newUsedSpace) + v2.SetContainerID(newCID) + + newA := container.NewAnnouncementFromV2(v2) + + require.Equal(t, newUsedSpace, newA.UsedSpace()) + require.Equal(t, container.NewIDFromV2(newCID), newA.ContainerID()) + }) +} From e27d76e80400fe9532b1d765e8fe9ea33cbd28f9 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Tue, 26 Jan 2021 21:32:33 +0300 Subject: [PATCH 0664/1196] [#250] v2/container: Add epoch field to size announce body Signed-off-by: Alex Vanin --- v2/container/convert.go | 4 + v2/container/grpc/service.go | 7 ++ v2/container/grpc/service.pb.go | 162 ++++++++++++++++--------------- v2/container/marshal.go | 13 ++- v2/container/marshal_test.go | 1 + v2/container/test/client_test.go | 2 + v2/container/types.go | 16 +++ 7 files changed, 127 insertions(+), 78 deletions(-) diff --git a/v2/container/convert.go b/v2/container/convert.go index d40813f..386eb8e 100644 --- a/v2/container/convert.go +++ b/v2/container/convert.go @@ -857,6 +857,8 @@ func UsedSpaceAnnouncementToGRPCMessage(a *UsedSpaceAnnouncement) *container.Ann m := new(container.AnnounceUsedSpaceRequest_Body_Announcement) + m.SetEpoch(a.GetEpoch()) + m.SetContainerId( refs.ContainerIDToGRPCMessage(a.GetContainerID()), ) @@ -873,6 +875,8 @@ func UsedSpaceAnnouncementFromGRPCMessage(m *container.AnnounceUsedSpaceRequest_ a := new(UsedSpaceAnnouncement) + a.SetEpoch(m.GetEpoch()) + a.SetContainerID( refs.ContainerIDFromGRPCMessage(m.GetContainerId()), ) diff --git a/v2/container/grpc/service.go b/v2/container/grpc/service.go index 98c5cc6..644ca3a 100644 --- a/v2/container/grpc/service.go +++ b/v2/container/grpc/service.go @@ -354,6 +354,13 @@ func (m *GetExtendedACLResponse) SetVerifyHeader(v *session.ResponseVerification } } +// SetEpoch sets epoch of the size estimation. +func (m *AnnounceUsedSpaceRequest_Body_Announcement) SetEpoch(v uint64) { + if m != nil { + m.Epoch = v + } +} + // SetContainerId sets identifier of the container. func (m *AnnounceUsedSpaceRequest_Body_Announcement) SetContainerId(v *refs.ContainerID) { if m != nil { diff --git a/v2/container/grpc/service.pb.go b/v2/container/grpc/service.pb.go index 2951a95..88dbb48 100644 --- a/v2/container/grpc/service.pb.go +++ b/v2/container/grpc/service.pb.go @@ -1689,11 +1689,13 @@ type AnnounceUsedSpaceRequest_Body_Announcement struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // Identifier of the container - ContainerId *grpc1.ContainerID `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` - // used_space is a sum of object payused space sizes of specified + // Epoch number for which container size estimation was produced. + Epoch uint64 `protobuf:"varint,1,opt,name=epoch,proto3" json:"epoch,omitempty"` + // Identifier of the container. + ContainerId *grpc1.ContainerID `protobuf:"bytes,2,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` + // Used space is a sum of object payload sizes of specified // container, stored in the node. It must not include inhumed objects. - UsedSpace uint64 `protobuf:"varint,2,opt,name=used_space,json=usedSpace,proto3" json:"used_space,omitempty"` + UsedSpace uint64 `protobuf:"varint,3,opt,name=used_space,json=usedSpace,proto3" json:"used_space,omitempty"` } func (x *AnnounceUsedSpaceRequest_Body_Announcement) Reset() { @@ -1728,6 +1730,13 @@ func (*AnnounceUsedSpaceRequest_Body_Announcement) Descriptor() ([]byte, []int) return file_v2_container_grpc_service_proto_rawDescGZIP(), []int{12, 0, 0} } +func (x *AnnounceUsedSpaceRequest_Body_Announcement) GetEpoch() uint64 { + if x != nil { + return x.Epoch + } + return 0 +} + func (x *AnnounceUsedSpaceRequest_Body_Announcement) GetContainerId() *grpc1.ContainerID { if x != nil { return x.ContainerId @@ -2030,7 +2039,7 @@ var file_v2_container_grpc_service_proto_rawDesc = []byte{ 0x63, 0x6c, 0x12, 0x37, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, - 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x22, 0xdb, 0x03, 0x0a, 0x18, + 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x22, 0xf2, 0x03, 0x0a, 0x18, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x55, 0x73, 0x65, 0x64, 0x53, 0x70, 0x61, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x46, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x32, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, @@ -2046,85 +2055,86 @@ var file_v2_container_grpc_service_proto_rawDesc = []byte{ 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, 0xdc, 0x01, 0x0a, 0x04, 0x42, + 0x72, 0x69, 0x66, 0x79, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x1a, 0xf3, 0x01, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x65, 0x0a, 0x0d, 0x61, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x3f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x55, 0x73, 0x65, 0x64, 0x53, 0x70, 0x61, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x2e, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x0d, 0x61, 0x6e, 0x6e, - 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x1a, 0x6d, 0x0a, 0x0c, 0x41, 0x6e, - 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x3e, 0x0a, 0x0c, 0x63, 0x6f, - 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, - 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x52, 0x0b, 0x63, - 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x75, 0x73, - 0x65, 0x64, 0x5f, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, - 0x75, 0x73, 0x65, 0x64, 0x53, 0x70, 0x61, 0x63, 0x65, 0x22, 0x88, 0x02, 0x0a, 0x19, 0x41, 0x6e, - 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x55, 0x73, 0x65, 0x64, 0x53, 0x70, 0x61, 0x63, 0x65, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x47, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x33, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, - 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x41, 0x6e, 0x6e, 0x6f, - 0x75, 0x6e, 0x63, 0x65, 0x55, 0x73, 0x65, 0x64, 0x53, 0x70, 0x61, 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, 0x06, 0x0a, 0x04, - 0x42, 0x6f, 0x64, 0x79, 0x32, 0x90, 0x05, 0x0a, 0x10, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, - 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x48, 0x0a, 0x03, 0x50, 0x75, 0x74, - 0x12, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, - 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, - 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x12, 0x51, 0x0a, 0x06, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x12, 0x22, 0x2e, + 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x1a, 0x83, 0x01, 0x0a, 0x0c, 0x41, + 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x65, + 0x70, 0x6f, 0x63, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x65, 0x70, 0x6f, 0x63, + 0x68, 0x12, 0x3e, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, + 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, + 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, + 0x65, 0x72, 0x49, 0x44, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, + 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x75, 0x73, 0x65, 0x64, 0x5f, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x75, 0x73, 0x65, 0x64, 0x53, 0x70, 0x61, 0x63, 0x65, + 0x22, 0x88, 0x02, 0x0a, 0x19, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x55, 0x73, 0x65, + 0x64, 0x53, 0x70, 0x61, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x47, + 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x33, 0x2e, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, + 0x65, 0x72, 0x2e, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x55, 0x73, 0x65, 0x64, 0x53, + 0x70, 0x61, 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, 0x06, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x32, 0x90, 0x05, 0x0a, 0x10, + 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x12, 0x48, 0x0a, 0x03, 0x50, 0x75, 0x74, 0x12, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, + 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x75, + 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x50, + 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x51, 0x0a, 0x06, 0x44, 0x65, + 0x6c, 0x65, 0x74, 0x65, 0x12, 0x22, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, + 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x44, + 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x48, 0x0a, + 0x03, 0x47, 0x65, 0x74, 0x12, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x74, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4b, 0x0a, 0x04, 0x4c, 0x69, 0x73, 0x74, 0x12, + 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, + 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x21, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, + 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x69, 0x0a, 0x0e, 0x53, 0x65, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, + 0x64, 0x65, 0x64, 0x41, 0x43, 0x4c, 0x12, 0x2a, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, + 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x53, 0x65, 0x74, + 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x41, 0x43, 0x4c, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x2b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, + 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x53, 0x65, 0x74, 0x45, 0x78, 0x74, 0x65, + 0x6e, 0x64, 0x65, 0x64, 0x41, 0x43, 0x4c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x69, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x41, 0x43, + 0x4c, 0x12, 0x2a, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, + 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, + 0x64, 0x65, 0x64, 0x41, 0x43, 0x4c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, - 0x6e, 0x65, 0x72, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x23, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, - 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x48, 0x0a, 0x03, 0x47, 0x65, 0x74, 0x12, 0x1f, 0x2e, - 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, - 0x6e, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, + 0x6e, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x41, + 0x43, 0x4c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x72, 0x0a, 0x11, 0x41, 0x6e, + 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x55, 0x73, 0x65, 0x64, 0x53, 0x70, 0x61, 0x63, 0x65, 0x12, + 0x2d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, + 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x55, 0x73, + 0x65, 0x64, 0x53, 0x70, 0x61, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2e, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, - 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x12, 0x4b, 0x0a, 0x04, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, - 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x4c, - 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x6e, 0x65, 0x6f, - 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, - 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x69, 0x0a, - 0x0e, 0x53, 0x65, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x41, 0x43, 0x4c, 0x12, - 0x2a, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, - 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x53, 0x65, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, - 0x64, 0x41, 0x43, 0x4c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2b, 0x2e, 0x6e, 0x65, - 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, - 0x72, 0x2e, 0x53, 0x65, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x41, 0x43, 0x4c, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x69, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x45, - 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x41, 0x43, 0x4c, 0x12, 0x2a, 0x2e, 0x6e, 0x65, 0x6f, - 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, - 0x2e, 0x47, 0x65, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x41, 0x43, 0x4c, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, - 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x74, - 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x41, 0x43, 0x4c, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x12, 0x72, 0x0a, 0x11, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x55, - 0x73, 0x65, 0x64, 0x53, 0x70, 0x61, 0x63, 0x65, 0x12, 0x2d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, - 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x41, - 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x55, 0x73, 0x65, 0x64, 0x53, 0x70, 0x61, 0x63, 0x65, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2e, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, - 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x41, 0x6e, - 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x55, 0x73, 0x65, 0x64, 0x53, 0x70, 0x61, 0x63, 0x65, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x58, 0x5a, 0x3d, 0x67, 0x69, 0x74, 0x68, 0x75, - 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, - 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 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, 0x16, 0x4e, 0x65, 0x6f, 0x46, 0x53, - 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x76, 0x32, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, - 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x55, 0x73, 0x65, + 0x64, 0x53, 0x70, 0x61, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x58, + 0x5a, 0x3d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, + 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, + 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 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, 0x16, 0x4e, 0x65, 0x6f, 0x46, 0x53, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x76, 0x32, 0x2e, 0x43, + 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/v2/container/marshal.go b/v2/container/marshal.go index f86d964..ae190bd 100644 --- a/v2/container/marshal.go +++ b/v2/container/marshal.go @@ -41,8 +41,9 @@ const ( getEACLRespBodyTableField = 1 getEACLRespBodySignatureField = 2 - usedSpaceAnnounceCIDField = 1 - usedSpaceAnnounceUsedSpaceField = 2 + usedSpaceAnnounceEpochField = 1 + usedSpaceAnnounceCIDField = 2 + usedSpaceAnnounceUsedSpaceField = 3 usedSpaceReqBodyAnnouncementsField = 1 ) @@ -554,6 +555,13 @@ func (a *UsedSpaceAnnouncement) StableMarshal(buf []byte) ([]byte, error) { err error ) + n, err = protoutil.UInt64Marshal(usedSpaceAnnounceEpochField, buf[offset:], a.epoch) + if err != nil { + return nil, err + } + + offset += n + n, err = protoutil.NestedStructureMarshal(usedSpaceAnnounceCIDField, buf[offset:], a.cid) if err != nil { return nil, err @@ -574,6 +582,7 @@ func (a *UsedSpaceAnnouncement) StableSize() (size int) { return 0 } + size += protoutil.UInt64Size(usedSpaceAnnounceEpochField, a.epoch) size += protoutil.NestedStructureSize(usedSpaceAnnounceCIDField, a.cid) size += protoutil.UInt64Size(usedSpaceAnnounceUsedSpaceField, a.usedSpace) diff --git a/v2/container/marshal_test.go b/v2/container/marshal_test.go index 5a86e88..dd6599f 100644 --- a/v2/container/marshal_test.go +++ b/v2/container/marshal_test.go @@ -455,6 +455,7 @@ func generateAnnounceRequestBody(n int) *container.AnnounceUsedSpaceRequestBody cid.SetValue(buf) a := new(container.UsedSpaceAnnouncement) + a.SetEpoch(rand.Uint64()) a.SetContainerID(cid) a.SetUsedSpace(rand.Uint64()) } diff --git a/v2/container/test/client_test.go b/v2/container/test/client_test.go index da7cad0..177b9c9 100644 --- a/v2/container/test/client_test.go +++ b/v2/container/test/client_test.go @@ -418,10 +418,12 @@ func testAnnounceRequest() *container.AnnounceUsedSpaceRequest { cid2.SetValue([]byte{4, 5, 6}) a1 := new(container.UsedSpaceAnnouncement) + a1.SetEpoch(20) a1.SetUsedSpace(10) a1.SetContainerID(cid1) a2 := new(container.UsedSpaceAnnouncement) + a2.SetEpoch(20) a2.SetUsedSpace(20) a2.SetContainerID(cid2) diff --git a/v2/container/types.go b/v2/container/types.go index 07b65e6..004ddd7 100644 --- a/v2/container/types.go +++ b/v2/container/types.go @@ -94,6 +94,8 @@ type GetExtendedACLResponseBody struct { } type UsedSpaceAnnouncement struct { + epoch uint64 + cid *refs.ContainerID usedSpace uint64 @@ -917,6 +919,20 @@ func (r *GetExtendedACLResponse) SetVerificationHeader(v *session.ResponseVerifi } } +func (a *UsedSpaceAnnouncement) GetEpoch() uint64 { + if a != nil { + return a.epoch + } + + return 0 +} + +func (a *UsedSpaceAnnouncement) SetEpoch(v uint64) { + if a != nil { + a.epoch = v + } +} + func (a *UsedSpaceAnnouncement) GetUsedSpace() uint64 { if a != nil { return a.usedSpace From 9e01f29dda60e029b3b5aa75b0417805017c12c9 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Tue, 26 Jan 2021 21:35:26 +0300 Subject: [PATCH 0665/1196] [#250] pkg/container: Add epoch field to size announce body Signed-off-by: Alex Vanin --- pkg/container/announcement.go | 10 ++++++++++ pkg/container/announcement_test.go | 9 +++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/pkg/container/announcement.go b/pkg/container/announcement.go index 412272b..bc8b6e4 100644 --- a/pkg/container/announcement.go +++ b/pkg/container/announcement.go @@ -19,6 +19,16 @@ func NewAnnouncementFromV2(v *container.UsedSpaceAnnouncement) *UsedSpaceAnnounc return (*UsedSpaceAnnouncement)(v) } +// Epoch of the announcement. +func (a *UsedSpaceAnnouncement) Epoch() uint64 { + return (*container.UsedSpaceAnnouncement)(a).GetEpoch() +} + +// SetEpoch sets announcement epoch value. +func (a *UsedSpaceAnnouncement) SetEpoch(epoch uint64) { + (*container.UsedSpaceAnnouncement)(a).SetEpoch(epoch) +} + // ContainerID of the announcement. func (a *UsedSpaceAnnouncement) ContainerID() *ID { return NewIDFromV2( diff --git a/pkg/container/announcement_test.go b/pkg/container/announcement_test.go index 3fca102..ad3b16f 100644 --- a/pkg/container/announcement_test.go +++ b/pkg/container/announcement_test.go @@ -9,21 +9,23 @@ import ( ) func TestAnnouncement(t *testing.T) { - const usedSpace uint64 = 100 + const epoch, usedSpace uint64 = 10, 100 cidValue := [32]byte{1, 2, 3} cid := container.NewID() cid.SetSHA256(cidValue) a := container.NewAnnouncement() + a.SetEpoch(epoch) a.SetContainerID(cid) a.SetUsedSpace(usedSpace) + require.Equal(t, epoch, a.Epoch()) require.Equal(t, usedSpace, a.UsedSpace()) require.Equal(t, cid, a.ContainerID()) t.Run("test v2", func(t *testing.T) { - const newUsedSpace uint64 = 200 + const newEpoch, newUsedSpace uint64 = 20, 200 newCidValue := [32]byte{4, 5, 6} newCID := new(refs.ContainerID) @@ -31,13 +33,16 @@ func TestAnnouncement(t *testing.T) { v2 := a.ToV2() require.Equal(t, usedSpace, v2.GetUsedSpace()) + require.Equal(t, epoch, v2.GetEpoch()) require.Equal(t, cidValue[:], v2.GetContainerID().GetValue()) + v2.SetEpoch(newEpoch) v2.SetUsedSpace(newUsedSpace) v2.SetContainerID(newCID) newA := container.NewAnnouncementFromV2(v2) + require.Equal(t, newEpoch, newA.Epoch()) require.Equal(t, newUsedSpace, newA.UsedSpace()) require.Equal(t, container.NewIDFromV2(newCID), newA.ContainerID()) }) From 93e15806840572236637da8bf46ce55e19009143 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 28 Jan 2021 16:01:07 +0300 Subject: [PATCH 0666/1196] [#253] container: Implement marshalers on UsedSpaceAnnouncement structure Implement Unmarshal method on UsedSpaceAnnouncement v2 message. Implement Marshal/Unmarshal methods on cross-version UsedSpaceAnnouncement type. Signed-off-by: Leonard Lyubich --- pkg/container/announcement.go | 20 ++++++++++++++ pkg/container/announcement_test.go | 22 ++++++++++++++++ v2/container/marshal.go | 11 ++++++++ v2/container/marshal_test.go | 42 +++++++++++++++++++++++------- 4 files changed, 85 insertions(+), 10 deletions(-) diff --git a/pkg/container/announcement.go b/pkg/container/announcement.go index bc8b6e4..8af1950 100644 --- a/pkg/container/announcement.go +++ b/pkg/container/announcement.go @@ -55,3 +55,23 @@ func (a *UsedSpaceAnnouncement) SetUsedSpace(value uint64) { func (a *UsedSpaceAnnouncement) ToV2() *container.UsedSpaceAnnouncement { return (*container.UsedSpaceAnnouncement)(a) } + +// Marshal marshals UsedSpaceAnnouncement into a protobuf binary form. +// +// Buffer is allocated when the argument is empty. +// Otherwise, the first buffer is used. +func (a *UsedSpaceAnnouncement) Marshal(b ...[]byte) ([]byte, error) { + var buf []byte + if len(b) > 0 { + buf = b[0] + } + + return a.ToV2(). + StableMarshal(buf) +} + +// Unmarshal unmarshals protobuf binary representation of UsedSpaceAnnouncement. +func (a *UsedSpaceAnnouncement) Unmarshal(data []byte) error { + return a.ToV2(). + Unmarshal(data) +} diff --git a/pkg/container/announcement_test.go b/pkg/container/announcement_test.go index ad3b16f..011b297 100644 --- a/pkg/container/announcement_test.go +++ b/pkg/container/announcement_test.go @@ -1,6 +1,7 @@ package container_test import ( + "crypto/sha256" "testing" "github.com/nspcc-dev/neofs-api-go/pkg/container" @@ -47,3 +48,24 @@ func TestAnnouncement(t *testing.T) { require.Equal(t, container.NewIDFromV2(newCID), newA.ContainerID()) }) } + +func TestUsedSpaceEncoding(t *testing.T) { + a := container.NewAnnouncement() + a.SetUsedSpace(13) + a.SetEpoch(666) + + id := container.NewID() + id.SetSHA256([sha256.Size]byte{1, 2, 3}) + + a.SetContainerID(id) + + t.Run("binary", func(t *testing.T) { + data, err := a.Marshal() + require.NoError(t, err) + + a2 := container.NewAnnouncement() + require.NoError(t, a2.Unmarshal(data)) + + require.Equal(t, a, a2) + }) +} diff --git a/v2/container/marshal.go b/v2/container/marshal.go index ae190bd..cf16e8a 100644 --- a/v2/container/marshal.go +++ b/v2/container/marshal.go @@ -589,6 +589,17 @@ func (a *UsedSpaceAnnouncement) StableSize() (size int) { return size } +func (a *UsedSpaceAnnouncement) Unmarshal(data []byte) error { + m := new(container.AnnounceUsedSpaceRequest_Body_Announcement) + if err := proto.Unmarshal(data, m); err != nil { + return err + } + + *a = *UsedSpaceAnnouncementFromGRPCMessage(m) + + return nil +} + func (r *AnnounceUsedSpaceRequestBody) StableMarshal(buf []byte) ([]byte, error) { if r == nil { return []byte{}, nil diff --git a/v2/container/marshal_test.go b/v2/container/marshal_test.go index dd6599f..f1fc189 100644 --- a/v2/container/marshal_test.go +++ b/v2/container/marshal_test.go @@ -234,6 +234,22 @@ func TestGetEACLResponseBody_StableMarshal(t *testing.T) { }) } +func TestUsedSpaceAnnouncement_StableMarshal(t *testing.T) { + from := generateAnnouncement() + transport := new(grpc.AnnounceUsedSpaceRequest_Body_Announcement) + + t.Run("non empty", func(t *testing.T) { + wire, err := from.StableMarshal(nil) + require.NoError(t, err) + + err = goproto.Unmarshal(wire, transport) + require.NoError(t, err) + + to := container.UsedSpaceAnnouncementFromGRPCMessage(transport) + require.Equal(t, from, to) + }) +} + func TestAnnounceUsedSpaceRequestBody_StableMarshal(t *testing.T) { requestFrom := generateAnnounceRequestBody(10) transport := new(grpc.AnnounceUsedSpaceRequest_Body) @@ -443,21 +459,27 @@ func generateGetEACLResponseBody(n int, k, v string) *container.GetExtendedACLRe return resp } +func generateAnnouncement() *container.UsedSpaceAnnouncement { + buf := make([]byte, sha256.Size) + rand.Read(buf) + + cid := new(refs.ContainerID) + cid.SetValue(buf) + + a := new(container.UsedSpaceAnnouncement) + a.SetEpoch(rand.Uint64()) + a.SetContainerID(cid) + a.SetUsedSpace(rand.Uint64()) + + return a +} + func generateAnnounceRequestBody(n int) *container.AnnounceUsedSpaceRequestBody { resp := new(container.AnnounceUsedSpaceRequestBody) - buf := make([]byte, sha256.Size) announcements := make([]*container.UsedSpaceAnnouncement, 0, n) for i := 0; i < n; i++ { - rand.Read(buf) - - cid := new(refs.ContainerID) - cid.SetValue(buf) - - a := new(container.UsedSpaceAnnouncement) - a.SetEpoch(rand.Uint64()) - a.SetContainerID(cid) - a.SetUsedSpace(rand.Uint64()) + announcements = append(announcements, generateAnnouncement()) } resp.SetAnnouncements(announcements) From e9ae408c3af965d908b008716e352c0dc322fb01 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 1 Feb 2021 20:54:33 +0300 Subject: [PATCH 0667/1196] [#254] pkg/object: Rewrite unit test of MatchType enum Avoid direct usage of naming constants where it is not necessary. Signed-off-by: Leonard Lyubich --- pkg/object/search_test.go | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/pkg/object/search_test.go b/pkg/object/search_test.go index 82a06d3..4829106 100644 --- a/pkg/object/search_test.go +++ b/pkg/object/search_test.go @@ -19,15 +19,32 @@ var ( func TestMatch(t *testing.T) { t.Run("known matches", func(t *testing.T) { - for i := object.MatchUnknown; i <= object.MatchStringEqual; i++ { - require.Equal(t, eqV2Matches[i], i.ToV2()) - require.Equal(t, object.SearchMatchFromV2(i.ToV2()), i) + for matchType, matchTypeV2 := range eqV2Matches { + require.Equal(t, matchTypeV2, matchType.ToV2()) + require.Equal(t, object.SearchMatchFromV2(matchTypeV2), matchType) } }) t.Run("unknown matches", func(t *testing.T) { - require.Equal(t, (object.MatchStringEqual + 1).ToV2(), v2object.MatchUnknown) - require.Equal(t, object.SearchMatchFromV2(v2object.MatchStringEqual+1), object.MatchUnknown) + var unknownMatchType object.SearchMatchType + + for matchType := range eqV2Matches { + unknownMatchType += matchType + } + + unknownMatchType++ + + require.Equal(t, unknownMatchType.ToV2(), v2object.MatchUnknown) + + var unknownMatchTypeV2 v2object.MatchType + + for _, matchTypeV2 := range eqV2Matches { + unknownMatchTypeV2 += matchTypeV2 + } + + unknownMatchTypeV2++ + + require.Equal(t, object.SearchMatchFromV2(unknownMatchTypeV2), object.MatchUnknown) }) } From ebff07aaf2040f2ef48490ad54eee78295659e21 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 1 Feb 2021 20:57:18 +0300 Subject: [PATCH 0668/1196] [#254] object: Support new values of search match type Support STRING_NOT_EQUAL and NOT_PRESENT match types of object search filters. Signed-off-by: Leonard Lyubich --- pkg/object/search.go | 10 ++++++++++ pkg/object/search_test.go | 6 ++++-- v2/object/grpc/service.pb.go | 4 ++++ v2/object/grpc/types.pb.go | 25 ++++++++++++++++++------- v2/object/types.go | 2 ++ 5 files changed, 38 insertions(+), 9 deletions(-) diff --git a/pkg/object/search.go b/pkg/object/search.go index 5d59e1a..208fcf4 100644 --- a/pkg/object/search.go +++ b/pkg/object/search.go @@ -15,12 +15,18 @@ type SearchMatchType uint32 const ( MatchUnknown SearchMatchType = iota MatchStringEqual + MatchStringNotEqual + MatchNotPresent ) func (m SearchMatchType) ToV2() v2object.MatchType { switch m { case MatchStringEqual: return v2object.MatchStringEqual + case MatchStringNotEqual: + return v2object.MatchStringNotEqual + case MatchNotPresent: + return v2object.MatchNotPresent default: return v2object.MatchUnknown } @@ -30,6 +36,10 @@ func SearchMatchFromV2(t v2object.MatchType) (m SearchMatchType) { switch t { case v2object.MatchStringEqual: m = MatchStringEqual + case v2object.MatchStringNotEqual: + m = MatchStringNotEqual + case v2object.MatchNotPresent: + m = MatchNotPresent default: m = MatchUnknown } diff --git a/pkg/object/search_test.go b/pkg/object/search_test.go index 4829106..573d06b 100644 --- a/pkg/object/search_test.go +++ b/pkg/object/search_test.go @@ -12,8 +12,10 @@ import ( var ( eqV2Matches = map[object.SearchMatchType]v2object.MatchType{ - object.MatchUnknown: v2object.MatchUnknown, - object.MatchStringEqual: v2object.MatchStringEqual, + object.MatchUnknown: v2object.MatchUnknown, + object.MatchStringEqual: v2object.MatchStringEqual, + object.MatchStringNotEqual: v2object.MatchStringNotEqual, + object.MatchNotPresent: v2object.MatchNotPresent, } ) diff --git a/v2/object/grpc/service.pb.go b/v2/object/grpc/service.pb.go index 890ac96..8f0ea63 100644 --- a/v2/object/grpc/service.pb.go +++ b/v2/object/grpc/service.pb.go @@ -1952,6 +1952,10 @@ func (x *SearchRequest_Body) GetFilters() []*SearchRequest_Body_Filter { // * $Object:PHY \ // Returns only objects physically stored in the system. This filter is // activated if the `key` exists, disregarding the value and matcher type. +// +// Note: using filters with a key with prefix `$Object:` and match type +// `NOT_PRESENT `is not recommended since this is not a cross-version approach. +// Behavior when processing this kind of filters is undefined. type SearchRequest_Body_Filter struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache diff --git a/v2/object/grpc/types.pb.go b/v2/object/grpc/types.pb.go index 1109640..b7fdd95 100644 --- a/v2/object/grpc/types.pb.go +++ b/v2/object/grpc/types.pb.go @@ -96,6 +96,10 @@ const ( MatchType_MATCH_TYPE_UNSPECIFIED MatchType = 0 // Full string match MatchType_STRING_EQUAL MatchType = 1 + // Full string mismatch + MatchType_STRING_NOT_EQUAL MatchType = 2 + // Lack of key + MatchType_NOT_PRESENT MatchType = 3 ) // Enum value maps for MatchType. @@ -103,10 +107,14 @@ var ( MatchType_name = map[int32]string{ 0: "MATCH_TYPE_UNSPECIFIED", 1: "STRING_EQUAL", + 2: "STRING_NOT_EQUAL", + 3: "NOT_PRESENT", } MatchType_value = map[string]int32{ "MATCH_TYPE_UNSPECIFIED": 0, "STRING_EQUAL": 1, + "STRING_NOT_EQUAL": 2, + "NOT_PRESENT": 3, } ) @@ -839,16 +847,19 @@ var file_v2_object_grpc_types_proto_rawDesc = []byte{ 0x0a, 0x0a, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x52, 0x45, 0x47, 0x55, 0x4c, 0x41, 0x52, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x54, 0x4f, 0x4d, 0x42, 0x53, 0x54, 0x4f, 0x4e, 0x45, 0x10, 0x01, 0x12, 0x11, 0x0a, 0x0d, 0x53, 0x54, 0x4f, 0x52, - 0x41, 0x47, 0x45, 0x5f, 0x47, 0x52, 0x4f, 0x55, 0x50, 0x10, 0x02, 0x2a, 0x39, 0x0a, 0x09, 0x4d, + 0x41, 0x47, 0x45, 0x5f, 0x47, 0x52, 0x4f, 0x55, 0x50, 0x10, 0x02, 0x2a, 0x60, 0x0a, 0x09, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1a, 0x0a, 0x16, 0x4d, 0x41, 0x54, 0x43, 0x48, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x10, 0x0a, 0x0c, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x5f, 0x45, - 0x51, 0x55, 0x41, 0x4c, 0x10, 0x01, 0x42, 0x4f, 0x5a, 0x37, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, - 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, - 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x6f, - 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x6f, 0x62, 0x6a, 0x65, 0x63, - 0x74, 0xaa, 0x02, 0x13, 0x4e, 0x65, 0x6f, 0x46, 0x53, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x76, 0x32, - 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x51, 0x55, 0x41, 0x4c, 0x10, 0x01, 0x12, 0x14, 0x0a, 0x10, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, + 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x45, 0x51, 0x55, 0x41, 0x4c, 0x10, 0x02, 0x12, 0x0f, 0x0a, 0x0b, + 0x4e, 0x4f, 0x54, 0x5f, 0x50, 0x52, 0x45, 0x53, 0x45, 0x4e, 0x54, 0x10, 0x03, 0x42, 0x4f, 0x5a, + 0x37, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, + 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, + 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2f, 0x67, 0x72, 0x70, + 0x63, 0x3b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0xaa, 0x02, 0x13, 0x4e, 0x65, 0x6f, 0x46, 0x53, + 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x76, 0x32, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/v2/object/types.go b/v2/object/types.go index 3c258eb..bed48d4 100644 --- a/v2/object/types.go +++ b/v2/object/types.go @@ -226,6 +226,8 @@ const ( const ( MatchUnknown MatchType = iota MatchStringEqual + MatchStringNotEqual + MatchNotPresent ) func (h *ShortHeader) GetVersion() *refs.Version { From f9939e8c902f872884fc10d93973710cf5d6349a Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 10 Feb 2021 01:31:50 +0300 Subject: [PATCH 0669/1196] [#255] v2/object: Implement json.Marshaler/Unmarshaler on SearchFilter Signed-off-by: Leonard Lyubich --- v2/object/json.go | 20 ++++++++++++++++++++ v2/object/json_test.go | 12 ++++++++++++ 2 files changed, 32 insertions(+) diff --git a/v2/object/json.go b/v2/object/json.go index 940aa7c..e2caede 100644 --- a/v2/object/json.go +++ b/v2/object/json.go @@ -124,3 +124,23 @@ func (o *Object) UnmarshalJSON(data []byte) error { return nil } + +func (f *SearchFilter) MarshalJSON() ([]byte, error) { + return protojson.MarshalOptions{ + EmitUnpopulated: true, + }.Marshal( + SearchFilterToGRPCMessage(f), + ) +} + +func (f *SearchFilter) UnmarshalJSON(data []byte) error { + msg := new(object.SearchRequest_Body_Filter) + + if err := protojson.Unmarshal(data, msg); err != nil { + return err + } + + *f = *SearchFilterFromGRPCMessage(msg) + + return nil +} diff --git a/v2/object/json_test.go b/v2/object/json_test.go index ceefd96..e8ad5d2 100644 --- a/v2/object/json_test.go +++ b/v2/object/json_test.go @@ -78,3 +78,15 @@ func TestObjectJSON(t *testing.T) { require.Equal(t, o, o2) } + +func TestSearchFilterJSON(t *testing.T) { + f := generateFilter("key", "value") + + data, err := f.MarshalJSON() + require.NoError(t, err) + + f2 := new(object.SearchFilter) + require.NoError(t, f2.UnmarshalJSON(data)) + + require.Equal(t, f, f2) +} From e782531f252c964860365eff88405d0e52a7eb7a Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 10 Feb 2021 01:32:13 +0300 Subject: [PATCH 0670/1196] [#255] pkg/object: Implement json.Marshaler/Unmarshaler on SearchFilters Signed-off-by: Leonard Lyubich --- pkg/object/search.go | 19 +++++++++++++++++++ pkg/object/search_test.go | 16 ++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/pkg/object/search.go b/pkg/object/search.go index 208fcf4..84c3303 100644 --- a/pkg/object/search.go +++ b/pkg/object/search.go @@ -1,6 +1,7 @@ package object import ( + "encoding/json" "fmt" "github.com/nspcc-dev/neofs-api-go/pkg" @@ -255,3 +256,21 @@ func (f *SearchFilters) AddSplitIDFilter(m SearchMatchType, id *SplitID) { func (f *SearchFilters) AddTypeFilter(m SearchMatchType, typ Type) { f.addReservedFilter(m, fKeyType, typ) } + +// MarshalJSON encodes SearchFilters to protobuf JSON format. +func (f *SearchFilters) MarshalJSON() ([]byte, error) { + return json.Marshal(f.ToV2()) +} + +// UnmarshalJSON decodes SearchFilters from protobuf JSON format. +func (f *SearchFilters) UnmarshalJSON(data []byte) error { + var fsV2 []*v2object.SearchFilter + + if err := json.Unmarshal(data, &fsV2); err != nil { + return err + } + + *f = NewSearchFiltersFromV2(fsV2) + + return nil +} diff --git a/pkg/object/search_test.go b/pkg/object/search_test.go index 573d06b..62cca9b 100644 --- a/pkg/object/search_test.go +++ b/pkg/object/search_test.go @@ -176,3 +176,19 @@ func TestSearchFilters_AddTypeFilter(t *testing.T) { require.Equal(t, v2object.MatchStringEqual, fsV2[0].GetMatchType()) }) } + +func TestSearchFiltersEncoding(t *testing.T) { + fs := object.NewSearchFilters() + fs.AddFilter("key 1", "value 2", object.MatchStringEqual) + fs.AddFilter("key 2", "value 2", object.MatchStringNotEqual) + + t.Run("json", func(t *testing.T) { + data, err := fs.MarshalJSON() + require.NoError(t, err) + + fs2 := object.NewSearchFilters() + require.NoError(t, fs2.UnmarshalJSON(data)) + + require.Equal(t, fs, fs2) + }) +} From 783c323d95dddf4b5faf1b6c2593fa3f9f39b72b Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 10 Feb 2021 20:36:10 +0300 Subject: [PATCH 0671/1196] [#255] v2/netmap: Recompile proto files with update node attributes Signed-off-by: Leonard Lyubich --- v2/netmap/grpc/types.pb.go | 38 +++++++++++++++++++++++++++----------- 1 file changed, 27 insertions(+), 11 deletions(-) diff --git a/v2/netmap/grpc/types.pb.go b/v2/netmap/grpc/types.pb.go index 3fd7d8f..6692079 100644 --- a/v2/netmap/grpc/types.pb.go +++ b/v2/netmap/grpc/types.pb.go @@ -626,21 +626,37 @@ func (x *NodeInfo) GetState() NodeInfo_State { // * Subnet \ // String ID of Node's storage subnet. There can be only one subnet served // by the Storage Node. -// * Locode \ +// * UN-LOCODE \ // Node's geographic location in // [UN/LOCODE](https://www.unece.org/cefact/codesfortrade/codes_index.html) -// format approximated to the nearest point defined in standard. -// * Country \ +// format approximated to the nearest point defined in the standard. +// * CountryCode \ // Country code in // [ISO 3166-1_alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) -// format. Calculated automatically from `Locode` attribute -// * Region \ -// Country's administative subdivision where node is located. Calculated -// automatically from `Locode` attribute based on `SubDiv` field. Presented -// in [ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2) format. -// * City \ -// City, town, village or rural area name where node is located written -// without diacritics . Calculated automatically from `Locode` attribute. +// format. Calculated automatically from `UN-LOCODE` attribute. +// * Country \ +// Country short name in English, as defined in +// [ISO-3166](https://www.iso.org/obp/ui/#search). Calculated automatically +// from `UN-LOCODE` attribute. +// * Location \ +// Place names are given, whenever possible, in their national language +// versions as expressed in the Roman alphabet using the 26 characters of +// the character set adopted for international trade data interchange, +// written without diacritics . Calculated automatically from `UN-LOCODE` +// attribute. +// * SubDivCode \ +// Country's administrative subdivision where node is located. Calculated +// automatically from `UN-LOCODE` attribute based on `SubDiv` field. +// Presented in [ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2) +// format. +// * SubDiv \ +// Country's administrative subdivision name, as defined in +// [ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2). Calculated +// automatically from `UN-LOCODE` attribute. +// * Continent \ +// Node's continent name according to the [Seven-Continent model] +// (https://en.wikipedia.org/wiki/Continent#Number). Calculated +// automatically from `UN-LOCODE` attribute. // // For detailed description of each well-known attribute please see the // corresponding section in NeoFS Technical specification. From 8254da2890af5917af1934cb2389cc144d65bb6f Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 10 Feb 2021 21:51:16 +0300 Subject: [PATCH 0672/1196] [#255] pkg/netmap: Move common substring of well-known attributes to prefix Rename `PriceAttr` constant to `AttrPrice`. Rename `CapacityAttr` constant to `AttrCapacity`. Add documentation to both of them. Signed-off-by: Leonard Lyubich --- pkg/netmap/filter.go | 4 ++-- pkg/netmap/node_info.go | 13 +++++++++---- pkg/netmap/selector_test.go | 18 +++++++++--------- 3 files changed, 20 insertions(+), 15 deletions(-) diff --git a/pkg/netmap/filter.go b/pkg/netmap/filter.go index 6838802..37b106a 100644 --- a/pkg/netmap/filter.go +++ b/pkg/netmap/filter.go @@ -115,9 +115,9 @@ func (c *Context) matchKeyValue(f *Filter, b *Node) bool { var attr uint64 switch f.Key() { - case PriceAttr: + case AttrPrice: attr = b.Price - case CapacityAttr: + case AttrCapacity: attr = b.Capacity default: var err error diff --git a/pkg/netmap/node_info.go b/pkg/netmap/node_info.go index a4debbc..90cccfa 100644 --- a/pkg/netmap/node_info.go +++ b/pkg/netmap/node_info.go @@ -44,8 +44,13 @@ const ( // Enumeration of well-known attributes. const ( - CapacityAttr = "Capacity" - PriceAttr = "Price" + // AttrPrice is a key to the node attribute that indicates the + // price in GAS tokens for storing one GB of data during one Epoch. + AttrPrice = "Price" + + // AttrCapacity is a key to the node attribute that indicates the + // total available disk space in Gigabytes. + AttrCapacity = "Capacity" ) var _ hrw.Hasher = (*Node)(nil) @@ -77,9 +82,9 @@ func newNodeV2(index int, ni *NodeInfo) *Node { for _, attr := range ni.Attributes() { switch attr.Key() { - case CapacityAttr: + case AttrCapacity: n.Capacity, _ = strconv.ParseUint(attr.Value(), 10, 64) - case PriceAttr: + case AttrPrice: n.Price, _ = strconv.ParseUint(attr.Value(), 10, 64) } diff --git a/pkg/netmap/selector_test.go b/pkg/netmap/selector_test.go index e434821..e8e1f32 100644 --- a/pkg/netmap/selector_test.go +++ b/pkg/netmap/selector_test.go @@ -303,15 +303,15 @@ func TestPlacementPolicy_ProcessSelectorsHRW(t *testing.T) { // bucket weight order: RU > DE > FR nodes := []NodeInfo{ - nodeInfoFromAttributes("Country", "Germany", PriceAttr, "2", CapacityAttr, "10000"), - nodeInfoFromAttributes("Country", "Germany", PriceAttr, "4", CapacityAttr, "1"), - nodeInfoFromAttributes("Country", "France", PriceAttr, "3", CapacityAttr, "10"), - nodeInfoFromAttributes("Country", "Russia", PriceAttr, "2", CapacityAttr, "10000"), - nodeInfoFromAttributes("Country", "Russia", PriceAttr, "1", CapacityAttr, "10000"), - nodeInfoFromAttributes("Country", "Russia", CapacityAttr, "10000"), - nodeInfoFromAttributes("Country", "France", PriceAttr, "100", CapacityAttr, "1"), - nodeInfoFromAttributes("Country", "France", PriceAttr, "7", CapacityAttr, "10000"), - nodeInfoFromAttributes("Country", "Russia", PriceAttr, "2", CapacityAttr, "1"), + nodeInfoFromAttributes("Country", "Germany", AttrPrice, "2", AttrCapacity, "10000"), + nodeInfoFromAttributes("Country", "Germany", AttrPrice, "4", AttrCapacity, "1"), + nodeInfoFromAttributes("Country", "France", AttrPrice, "3", AttrCapacity, "10"), + nodeInfoFromAttributes("Country", "Russia", AttrPrice, "2", AttrCapacity, "10000"), + nodeInfoFromAttributes("Country", "Russia", AttrPrice, "1", AttrCapacity, "10000"), + nodeInfoFromAttributes("Country", "Russia", AttrCapacity, "10000"), + nodeInfoFromAttributes("Country", "France", AttrPrice, "100", AttrCapacity, "1"), + nodeInfoFromAttributes("Country", "France", AttrPrice, "7", AttrCapacity, "10000"), + nodeInfoFromAttributes("Country", "Russia", AttrPrice, "2", AttrCapacity, "1"), } nm, err := NewNetmap(NodesFromInfo(nodes)) require.NoError(t, err) From 521df90def4632e16eb2fa6a0a4c18e6b0b052a5 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 10 Feb 2021 23:26:34 +0300 Subject: [PATCH 0673/1196] [#255] pkg/netmap: Define constant keys to all well-known attributes Signed-off-by: Leonard Lyubich --- pkg/netmap/node_info.go | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/pkg/netmap/node_info.go b/pkg/netmap/node_info.go index 90cccfa..17aa9f4 100644 --- a/pkg/netmap/node_info.go +++ b/pkg/netmap/node_info.go @@ -51,6 +51,40 @@ const ( // AttrCapacity is a key to the node attribute that indicates the // total available disk space in Gigabytes. AttrCapacity = "Capacity" + + // AttrSubnet is a key to the node attribute that indicates the + // string ID of node's storage subnet. + AttrSubnet = "Subnet" + + // AttrUNLOCODE is a key to the node attribute that indicates the + // node's geographic location in UN/LOCODE format. + AttrUNLOCODE = "UN-LOCODE" + + // AttrCountryCode is a key to the node attribute that indicates the + // Country code in ISO 3166-1_alpha-2 format. + AttrCountryCode = "CountryCode" + + // AttrCountry is a key to the node attribute that indicates the + // country short name in English, as defined in ISO-3166. + AttrCountry = "Country" + + // AttrLocation is a key to the node attribute that indicates the + // place name of the node location. + AttrLocation = "Location" + + // AttrSubDivCode is a key to the node attribute that indicates the + // country's administrative subdivision where node is located + // in ISO 3166-2 format. + AttrSubDivCode = "SubDivCode" + + // AttrSubDiv is a key to the node attribute that indicates the + // country's administrative subdivision name, as defined in + // ISO 3166-2. + AttrSubDiv = "SubDiv" + + // AttrContinent is a key to the node attribute that indicates the + // node's continent name according to the Seven-Continent model. + AttrContinent = "Continent" ) var _ hrw.Hasher = (*Node)(nil) From e4613fcffb5302d0ec64d0bb1bcd582b8428c0bb Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 11 Feb 2021 17:14:04 +0300 Subject: [PATCH 0674/1196] Update changelog and readme for release v1.23.0 Signed-off-by: Leonard Lyubich --- CHANGELOG.md | 20 ++++++++++++++++++++ README.md | 1 + 2 files changed, 21 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6beaa6c..629becf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,24 @@ # Changelog +## [1.23.0] - 2021-02-11 - Seonyudo (선유도, 仙遊島) + +Support changes from NeoFS API v2.3.0 "Seonyudo" release. + +### Added + +- Fulfill backup factor for default attribute in placement. +- Support of `Container.AnnounceUsedSpace` RPC from NeoFS API. +- New `pkg/client.Client.AnnounceContainerUsedSpace` method. +- Support of `STRING_NOT_EQUAL` and `NOT_PRESENT` object search filters. +- Implementation of `json.Marshaler`/`json.Unmarshaler` on `v2/object/SearchFilter`. +- Implementation of `json.Marshaler`/`json.Unmarshaler` on `pkg/object/SearchFilters`. +- Named constants of well-known node attributes in `pkg/netmap`. + +### Renamed + +- `pkg/netmap/PriceAttr` to `pkg/netmap/AttrPrice`. +- `pkg/netmap/CapacityAttr` to `pkg/netmap/AttrCapacity`. + ## [1.22.2] - 2021-01-27 ### Fixed @@ -534,3 +553,4 @@ Initial public release [1.22.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.21.2...v1.22.0 [1.22.1]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.22.0...v1.22.1 [1.22.2]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.22.1...v1.22.2 +[1.23.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.22.2...v1.23.0 diff --git a/README.md b/README.md index 0c6df6e..8bb9cae 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,7 @@ versions and SDK layer working with all of them in a handy way. |v1.20.x|[v2.0.2](https://github.com/nspcc-dev/neofs-api/releases/tag/v2.0.2)| |v1.21.x|[v2.1.0](https://github.com/nspcc-dev/neofs-api/releases/tag/v2.1.0)| |v1.22.x|[v2.2.0](https://github.com/nspcc-dev/neofs-api/releases/tag/v2.2.0)| +|v1.23.x|[v2.3.0](https://github.com/nspcc-dev/neofs-api/releases/tag/v2.3.0)| ## Contributing From 786462c2a2d0e1ba05d771b50d167ee0f0233a9e Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 17 Feb 2021 19:33:44 +0300 Subject: [PATCH 0675/1196] Recompile NeoFS API proto definitions Signed-off-by: Leonard Lyubich --- v2/netmap/grpc/service.pb.go | 455 +++++++++++++++++++++++++++++++---- v2/netmap/grpc/types.pb.go | 122 ++++++++-- 2 files changed, 510 insertions(+), 67 deletions(-) diff --git a/v2/netmap/grpc/service.pb.go b/v2/netmap/grpc/service.pb.go index 70de9ab..c7864c8 100644 --- a/v2/netmap/grpc/service.pb.go +++ b/v2/netmap/grpc/service.pb.go @@ -171,6 +171,144 @@ func (x *LocalNodeInfoResponse) GetVerifyHeader() *grpc.ResponseVerificationHead return nil } +type NetworkInfoRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Body of the NetworkInfo request message + Body *NetworkInfoRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" 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,proto3" json:"verify_header,omitempty"` +} + +func (x *NetworkInfoRequest) Reset() { + *x = NetworkInfoRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_netmap_grpc_service_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *NetworkInfoRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NetworkInfoRequest) ProtoMessage() {} + +func (x *NetworkInfoRequest) ProtoReflect() protoreflect.Message { + mi := &file_v2_netmap_grpc_service_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use NetworkInfoRequest.ProtoReflect.Descriptor instead. +func (*NetworkInfoRequest) Descriptor() ([]byte, []int) { + return file_v2_netmap_grpc_service_proto_rawDescGZIP(), []int{2} +} + +func (x *NetworkInfoRequest) GetBody() *NetworkInfoRequest_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *NetworkInfoRequest) GetMetaHeader() *grpc.RequestMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} + +func (x *NetworkInfoRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} + +type NetworkInfoResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Body of the NetworkInfo response message. + Body *NetworkInfoResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` + // Carries response meta information. Header data is used only to regulate + // message transport and does not affect response execution. + MetaHeader *grpc.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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,proto3" json:"verify_header,omitempty"` +} + +func (x *NetworkInfoResponse) Reset() { + *x = NetworkInfoResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_netmap_grpc_service_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *NetworkInfoResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NetworkInfoResponse) ProtoMessage() {} + +func (x *NetworkInfoResponse) ProtoReflect() protoreflect.Message { + mi := &file_v2_netmap_grpc_service_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use NetworkInfoResponse.ProtoReflect.Descriptor instead. +func (*NetworkInfoResponse) Descriptor() ([]byte, []int) { + return file_v2_netmap_grpc_service_proto_rawDescGZIP(), []int{3} +} + +func (x *NetworkInfoResponse) GetBody() *NetworkInfoResponse_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *NetworkInfoResponse) GetMetaHeader() *grpc.ResponseMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} + +func (x *NetworkInfoResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} + // LocalNodeInfo request body is empty. type LocalNodeInfoRequest_Body struct { state protoimpl.MessageState @@ -181,7 +319,7 @@ type LocalNodeInfoRequest_Body struct { func (x *LocalNodeInfoRequest_Body) Reset() { *x = LocalNodeInfoRequest_Body{} if protoimpl.UnsafeEnabled { - mi := &file_v2_netmap_grpc_service_proto_msgTypes[2] + mi := &file_v2_netmap_grpc_service_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -194,7 +332,7 @@ func (x *LocalNodeInfoRequest_Body) String() string { func (*LocalNodeInfoRequest_Body) ProtoMessage() {} func (x *LocalNodeInfoRequest_Body) ProtoReflect() protoreflect.Message { - mi := &file_v2_netmap_grpc_service_proto_msgTypes[2] + mi := &file_v2_netmap_grpc_service_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -225,7 +363,7 @@ type LocalNodeInfoResponse_Body struct { func (x *LocalNodeInfoResponse_Body) Reset() { *x = LocalNodeInfoResponse_Body{} if protoimpl.UnsafeEnabled { - mi := &file_v2_netmap_grpc_service_proto_msgTypes[3] + mi := &file_v2_netmap_grpc_service_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -238,7 +376,7 @@ func (x *LocalNodeInfoResponse_Body) String() string { func (*LocalNodeInfoResponse_Body) ProtoMessage() {} func (x *LocalNodeInfoResponse_Body) ProtoReflect() protoreflect.Message { - mi := &file_v2_netmap_grpc_service_proto_msgTypes[3] + mi := &file_v2_netmap_grpc_service_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -268,6 +406,94 @@ func (x *LocalNodeInfoResponse_Body) GetNodeInfo() *NodeInfo { return nil } +// NetworkInfo request body is empty. +type NetworkInfoRequest_Body struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *NetworkInfoRequest_Body) Reset() { + *x = NetworkInfoRequest_Body{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_netmap_grpc_service_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *NetworkInfoRequest_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NetworkInfoRequest_Body) ProtoMessage() {} + +func (x *NetworkInfoRequest_Body) ProtoReflect() protoreflect.Message { + mi := &file_v2_netmap_grpc_service_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use NetworkInfoRequest_Body.ProtoReflect.Descriptor instead. +func (*NetworkInfoRequest_Body) Descriptor() ([]byte, []int) { + return file_v2_netmap_grpc_service_proto_rawDescGZIP(), []int{2, 0} +} + +// Information about the network. +type NetworkInfoResponse_Body struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // NetworkInfo structure with recent information. + NetworkInfo *NetworkInfo `protobuf:"bytes,1,opt,name=network_info,json=networkInfo,proto3" json:"network_info,omitempty"` +} + +func (x *NetworkInfoResponse_Body) Reset() { + *x = NetworkInfoResponse_Body{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_netmap_grpc_service_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *NetworkInfoResponse_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NetworkInfoResponse_Body) ProtoMessage() {} + +func (x *NetworkInfoResponse_Body) ProtoReflect() protoreflect.Message { + mi := &file_v2_netmap_grpc_service_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use NetworkInfoResponse_Body.ProtoReflect.Descriptor instead. +func (*NetworkInfoResponse_Body) Descriptor() ([]byte, []int) { + return file_v2_netmap_grpc_service_proto_rawDescGZIP(), []int{3, 0} +} + +func (x *NetworkInfoResponse_Body) GetNetworkInfo() *NetworkInfo { + if x != nil { + return x.NetworkInfo + } + return nil +} + var File_v2_netmap_grpc_service_proto protoreflect.FileDescriptor var file_v2_netmap_grpc_service_proto_rawDesc = []byte{ @@ -317,20 +543,61 @@ var file_v2_netmap_grpc_service_proto_rawDesc = []byte{ 0x6f, 0x6e, 0x12, 0x37, 0x0a, 0x09, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, - 0x6f, 0x52, 0x08, 0x6e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x32, 0x71, 0x0a, 0x0d, 0x4e, - 0x65, 0x74, 0x6d, 0x61, 0x70, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x60, 0x0a, 0x0d, - 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x26, 0x2e, - 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, - 0x2e, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x27, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, - 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x4e, 0x6f, - 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x4f, - 0x5a, 0x37, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, - 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, - 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2f, 0x67, 0x72, - 0x70, 0x63, 0x3b, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0xaa, 0x02, 0x13, 0x4e, 0x65, 0x6f, 0x46, - 0x53, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6f, 0x52, 0x08, 0x6e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x22, 0xf5, 0x01, 0x0a, 0x12, + 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 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, 0x6e, 0x65, 0x74, + 0x6d, 0x61, 0x70, 0x2e, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 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, 0x06, 0x0a, 0x04, 0x42, + 0x6f, 0x64, 0x79, 0x22, 0xbb, 0x02, 0x0a, 0x13, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x49, + 0x6e, 0x66, 0x6f, 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, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4e, 0x65, 0x74, + 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 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, 0x48, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, + 0x40, 0x0a, 0x0c, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, + 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x0b, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x66, + 0x6f, 0x32, 0xcd, 0x01, 0x0a, 0x0d, 0x4e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x53, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x12, 0x60, 0x0a, 0x0d, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x4e, 0x6f, 0x64, 0x65, + 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x26, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x4e, 0x6f, 0x64, + 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x27, 0x2e, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, + 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5a, 0x0a, 0x0b, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, + 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x24, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x49, + 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x25, 0x2e, 0x6e, 0x65, 0x6f, + 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4e, 0x65, + 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x42, 0x4f, 0x5a, 0x37, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, + 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, + 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, + 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0xaa, 0x02, 0x13, 0x4e, + 0x65, 0x6f, 0x46, 0x53, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x65, 0x74, 0x6d, + 0x61, 0x70, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -345,35 +612,49 @@ func file_v2_netmap_grpc_service_proto_rawDescGZIP() []byte { return file_v2_netmap_grpc_service_proto_rawDescData } -var file_v2_netmap_grpc_service_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_v2_netmap_grpc_service_proto_msgTypes = make([]protoimpl.MessageInfo, 8) var file_v2_netmap_grpc_service_proto_goTypes = []interface{}{ (*LocalNodeInfoRequest)(nil), // 0: neo.fs.v2.netmap.LocalNodeInfoRequest (*LocalNodeInfoResponse)(nil), // 1: neo.fs.v2.netmap.LocalNodeInfoResponse - (*LocalNodeInfoRequest_Body)(nil), // 2: neo.fs.v2.netmap.LocalNodeInfoRequest.Body - (*LocalNodeInfoResponse_Body)(nil), // 3: neo.fs.v2.netmap.LocalNodeInfoResponse.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.Version)(nil), // 8: neo.fs.v2.refs.Version - (*NodeInfo)(nil), // 9: neo.fs.v2.netmap.NodeInfo + (*NetworkInfoRequest)(nil), // 2: neo.fs.v2.netmap.NetworkInfoRequest + (*NetworkInfoResponse)(nil), // 3: neo.fs.v2.netmap.NetworkInfoResponse + (*LocalNodeInfoRequest_Body)(nil), // 4: neo.fs.v2.netmap.LocalNodeInfoRequest.Body + (*LocalNodeInfoResponse_Body)(nil), // 5: neo.fs.v2.netmap.LocalNodeInfoResponse.Body + (*NetworkInfoRequest_Body)(nil), // 6: neo.fs.v2.netmap.NetworkInfoRequest.Body + (*NetworkInfoResponse_Body)(nil), // 7: neo.fs.v2.netmap.NetworkInfoResponse.Body + (*grpc.RequestMetaHeader)(nil), // 8: neo.fs.v2.session.RequestMetaHeader + (*grpc.RequestVerificationHeader)(nil), // 9: neo.fs.v2.session.RequestVerificationHeader + (*grpc.ResponseMetaHeader)(nil), // 10: neo.fs.v2.session.ResponseMetaHeader + (*grpc.ResponseVerificationHeader)(nil), // 11: neo.fs.v2.session.ResponseVerificationHeader + (*grpc1.Version)(nil), // 12: neo.fs.v2.refs.Version + (*NodeInfo)(nil), // 13: neo.fs.v2.netmap.NodeInfo + (*NetworkInfo)(nil), // 14: neo.fs.v2.netmap.NetworkInfo } var file_v2_netmap_grpc_service_proto_depIdxs = []int32{ - 2, // 0: neo.fs.v2.netmap.LocalNodeInfoRequest.body:type_name -> neo.fs.v2.netmap.LocalNodeInfoRequest.Body - 4, // 1: neo.fs.v2.netmap.LocalNodeInfoRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader - 5, // 2: neo.fs.v2.netmap.LocalNodeInfoRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader - 3, // 3: neo.fs.v2.netmap.LocalNodeInfoResponse.body:type_name -> neo.fs.v2.netmap.LocalNodeInfoResponse.Body - 6, // 4: neo.fs.v2.netmap.LocalNodeInfoResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader - 7, // 5: neo.fs.v2.netmap.LocalNodeInfoResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader - 8, // 6: neo.fs.v2.netmap.LocalNodeInfoResponse.Body.version:type_name -> neo.fs.v2.refs.Version - 9, // 7: neo.fs.v2.netmap.LocalNodeInfoResponse.Body.node_info:type_name -> neo.fs.v2.netmap.NodeInfo - 0, // 8: neo.fs.v2.netmap.NetmapService.LocalNodeInfo:input_type -> neo.fs.v2.netmap.LocalNodeInfoRequest - 1, // 9: neo.fs.v2.netmap.NetmapService.LocalNodeInfo:output_type -> neo.fs.v2.netmap.LocalNodeInfoResponse - 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 + 4, // 0: neo.fs.v2.netmap.LocalNodeInfoRequest.body:type_name -> neo.fs.v2.netmap.LocalNodeInfoRequest.Body + 8, // 1: neo.fs.v2.netmap.LocalNodeInfoRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader + 9, // 2: neo.fs.v2.netmap.LocalNodeInfoRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader + 5, // 3: neo.fs.v2.netmap.LocalNodeInfoResponse.body:type_name -> neo.fs.v2.netmap.LocalNodeInfoResponse.Body + 10, // 4: neo.fs.v2.netmap.LocalNodeInfoResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader + 11, // 5: neo.fs.v2.netmap.LocalNodeInfoResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 6, // 6: neo.fs.v2.netmap.NetworkInfoRequest.body:type_name -> neo.fs.v2.netmap.NetworkInfoRequest.Body + 8, // 7: neo.fs.v2.netmap.NetworkInfoRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader + 9, // 8: neo.fs.v2.netmap.NetworkInfoRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader + 7, // 9: neo.fs.v2.netmap.NetworkInfoResponse.body:type_name -> neo.fs.v2.netmap.NetworkInfoResponse.Body + 10, // 10: neo.fs.v2.netmap.NetworkInfoResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader + 11, // 11: neo.fs.v2.netmap.NetworkInfoResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 12, // 12: neo.fs.v2.netmap.LocalNodeInfoResponse.Body.version:type_name -> neo.fs.v2.refs.Version + 13, // 13: neo.fs.v2.netmap.LocalNodeInfoResponse.Body.node_info:type_name -> neo.fs.v2.netmap.NodeInfo + 14, // 14: neo.fs.v2.netmap.NetworkInfoResponse.Body.network_info:type_name -> neo.fs.v2.netmap.NetworkInfo + 0, // 15: neo.fs.v2.netmap.NetmapService.LocalNodeInfo:input_type -> neo.fs.v2.netmap.LocalNodeInfoRequest + 2, // 16: neo.fs.v2.netmap.NetmapService.NetworkInfo:input_type -> neo.fs.v2.netmap.NetworkInfoRequest + 1, // 17: neo.fs.v2.netmap.NetmapService.LocalNodeInfo:output_type -> neo.fs.v2.netmap.LocalNodeInfoResponse + 3, // 18: neo.fs.v2.netmap.NetmapService.NetworkInfo:output_type -> neo.fs.v2.netmap.NetworkInfoResponse + 17, // [17:19] is the sub-list for method output_type + 15, // [15:17] is the sub-list for method input_type + 15, // [15:15] is the sub-list for extension type_name + 15, // [15:15] is the sub-list for extension extendee + 0, // [0:15] is the sub-list for field type_name } func init() { file_v2_netmap_grpc_service_proto_init() } @@ -408,7 +689,7 @@ func file_v2_netmap_grpc_service_proto_init() { } } file_v2_netmap_grpc_service_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*LocalNodeInfoRequest_Body); i { + switch v := v.(*NetworkInfoRequest); i { case 0: return &v.state case 1: @@ -420,6 +701,30 @@ func file_v2_netmap_grpc_service_proto_init() { } } file_v2_netmap_grpc_service_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*NetworkInfoResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_netmap_grpc_service_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*LocalNodeInfoRequest_Body); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_netmap_grpc_service_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*LocalNodeInfoResponse_Body); i { case 0: return &v.state @@ -431,6 +736,30 @@ func file_v2_netmap_grpc_service_proto_init() { return nil } } + file_v2_netmap_grpc_service_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*NetworkInfoRequest_Body); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_netmap_grpc_service_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*NetworkInfoResponse_Body); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } type x struct{} out := protoimpl.TypeBuilder{ @@ -438,7 +767,7 @@ func file_v2_netmap_grpc_service_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_v2_netmap_grpc_service_proto_rawDesc, NumEnums: 0, - NumMessages: 4, + NumMessages: 8, NumExtensions: 0, NumServices: 1, }, @@ -470,6 +799,8 @@ type NetmapServiceClient interface { // present in `Network Map` to find out what API version can be used for // further communication. Can also be used to check if node is up and running. LocalNodeInfo(ctx context.Context, in *LocalNodeInfoRequest, opts ...grpc2.CallOption) (*LocalNodeInfoResponse, error) + // Read recent information about the NeoFS network. + NetworkInfo(ctx context.Context, in *NetworkInfoRequest, opts ...grpc2.CallOption) (*NetworkInfoResponse, error) } type netmapServiceClient struct { @@ -489,6 +820,15 @@ func (c *netmapServiceClient) LocalNodeInfo(ctx context.Context, in *LocalNodeIn return out, nil } +func (c *netmapServiceClient) NetworkInfo(ctx context.Context, in *NetworkInfoRequest, opts ...grpc2.CallOption) (*NetworkInfoResponse, error) { + out := new(NetworkInfoResponse) + err := c.cc.Invoke(ctx, "/neo.fs.v2.netmap.NetmapService/NetworkInfo", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // NetmapServiceServer is the server API for NetmapService service. type NetmapServiceServer interface { // Get NodeInfo structure from the particular node directly. Node information @@ -497,6 +837,8 @@ type NetmapServiceServer interface { // present in `Network Map` to find out what API version can be used for // further communication. Can also be used to check if node is up and running. LocalNodeInfo(context.Context, *LocalNodeInfoRequest) (*LocalNodeInfoResponse, error) + // Read recent information about the NeoFS network. + NetworkInfo(context.Context, *NetworkInfoRequest) (*NetworkInfoResponse, error) } // UnimplementedNetmapServiceServer can be embedded to have forward compatible implementations. @@ -506,6 +848,9 @@ type UnimplementedNetmapServiceServer struct { func (*UnimplementedNetmapServiceServer) LocalNodeInfo(context.Context, *LocalNodeInfoRequest) (*LocalNodeInfoResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method LocalNodeInfo not implemented") } +func (*UnimplementedNetmapServiceServer) NetworkInfo(context.Context, *NetworkInfoRequest) (*NetworkInfoResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method NetworkInfo not implemented") +} func RegisterNetmapServiceServer(s *grpc2.Server, srv NetmapServiceServer) { s.RegisterService(&_NetmapService_serviceDesc, srv) @@ -529,6 +874,24 @@ func _NetmapService_LocalNodeInfo_Handler(srv interface{}, ctx context.Context, return interceptor(ctx, in, info, handler) } +func _NetmapService_NetworkInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc2.UnaryServerInterceptor) (interface{}, error) { + in := new(NetworkInfoRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(NetmapServiceServer).NetworkInfo(ctx, in) + } + info := &grpc2.UnaryServerInfo{ + Server: srv, + FullMethod: "/neo.fs.v2.netmap.NetmapService/NetworkInfo", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(NetmapServiceServer).NetworkInfo(ctx, req.(*NetworkInfoRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _NetmapService_serviceDesc = grpc2.ServiceDesc{ ServiceName: "neo.fs.v2.netmap.NetmapService", HandlerType: (*NetmapServiceServer)(nil), @@ -537,6 +900,10 @@ var _NetmapService_serviceDesc = grpc2.ServiceDesc{ MethodName: "LocalNodeInfo", Handler: _NetmapService_LocalNodeInfo_Handler, }, + { + MethodName: "NetworkInfo", + Handler: _NetmapService_NetworkInfo_Handler, + }, }, Streams: []grpc2.StreamDesc{}, Metadata: "v2/netmap/grpc/service.proto", diff --git a/v2/netmap/grpc/types.pb.go b/v2/netmap/grpc/types.pb.go index 6692079..00cef87 100644 --- a/v2/netmap/grpc/types.pb.go +++ b/v2/netmap/grpc/types.pb.go @@ -605,6 +605,64 @@ func (x *NodeInfo) GetState() NodeInfo_State { return NodeInfo_UNSPECIFIED } +// Information about NeoFS network +type NetworkInfo struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Number of the current epoch in the NeoFS network. + CurrentEpoch uint64 `protobuf:"varint,1,opt,name=current_epoch,json=currentEpoch,proto3" json:"current_epoch,omitempty"` + // Magic number of the sidechain of the NeoFS network. + MagicNumber uint64 `protobuf:"varint,2,opt,name=magic_number,json=magicNumber,proto3" json:"magic_number,omitempty"` +} + +func (x *NetworkInfo) Reset() { + *x = NetworkInfo{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_netmap_grpc_types_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *NetworkInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NetworkInfo) ProtoMessage() {} + +func (x *NetworkInfo) ProtoReflect() protoreflect.Message { + mi := &file_v2_netmap_grpc_types_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use NetworkInfo.ProtoReflect.Descriptor instead. +func (*NetworkInfo) Descriptor() ([]byte, []int) { + return file_v2_netmap_grpc_types_proto_rawDescGZIP(), []int{5} +} + +func (x *NetworkInfo) GetCurrentEpoch() uint64 { + if x != nil { + return x.CurrentEpoch + } + return 0 +} + +func (x *NetworkInfo) GetMagicNumber() uint64 { + if x != nil { + return x.MagicNumber + } + return 0 +} + // Administrator-defined Attributes of the NeoFS Storage Node. // // `Attribute` is a Key-Value metadata pair. Key name must be a valid UTF-8 @@ -677,7 +735,7 @@ type NodeInfo_Attribute struct { func (x *NodeInfo_Attribute) Reset() { *x = NodeInfo_Attribute{} if protoimpl.UnsafeEnabled { - mi := &file_v2_netmap_grpc_types_proto_msgTypes[5] + mi := &file_v2_netmap_grpc_types_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -690,7 +748,7 @@ func (x *NodeInfo_Attribute) String() string { func (*NodeInfo_Attribute) ProtoMessage() {} func (x *NodeInfo_Attribute) ProtoReflect() protoreflect.Message { - mi := &file_v2_netmap_grpc_types_proto_msgTypes[5] + mi := &file_v2_netmap_grpc_types_proto_msgTypes[6] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -792,23 +850,28 @@ var file_v2_netmap_grpc_types_proto_rawDesc = []byte{ 0x61, 0x72, 0x65, 0x6e, 0x74, 0x73, 0x22, 0x31, 0x0a, 0x05, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x0f, 0x0a, 0x0b, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x4f, 0x4e, 0x4c, 0x49, 0x4e, 0x45, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, - 0x4f, 0x46, 0x46, 0x4c, 0x49, 0x4e, 0x45, 0x10, 0x02, 0x2a, 0x67, 0x0a, 0x09, 0x4f, 0x70, 0x65, - 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x19, 0x0a, 0x15, 0x4f, 0x50, 0x45, 0x52, 0x41, 0x54, - 0x49, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, - 0x00, 0x12, 0x06, 0x0a, 0x02, 0x45, 0x51, 0x10, 0x01, 0x12, 0x06, 0x0a, 0x02, 0x4e, 0x45, 0x10, - 0x02, 0x12, 0x06, 0x0a, 0x02, 0x47, 0x54, 0x10, 0x03, 0x12, 0x06, 0x0a, 0x02, 0x47, 0x45, 0x10, - 0x04, 0x12, 0x06, 0x0a, 0x02, 0x4c, 0x54, 0x10, 0x05, 0x12, 0x06, 0x0a, 0x02, 0x4c, 0x45, 0x10, - 0x06, 0x12, 0x06, 0x0a, 0x02, 0x4f, 0x52, 0x10, 0x07, 0x12, 0x07, 0x0a, 0x03, 0x41, 0x4e, 0x44, - 0x10, 0x08, 0x2a, 0x38, 0x0a, 0x06, 0x43, 0x6c, 0x61, 0x75, 0x73, 0x65, 0x12, 0x16, 0x0a, 0x12, - 0x43, 0x4c, 0x41, 0x55, 0x53, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, - 0x45, 0x44, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x53, 0x41, 0x4d, 0x45, 0x10, 0x01, 0x12, 0x0c, - 0x0a, 0x08, 0x44, 0x49, 0x53, 0x54, 0x49, 0x4e, 0x43, 0x54, 0x10, 0x02, 0x42, 0x4f, 0x5a, 0x37, - 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, - 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, - 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2f, 0x67, 0x72, 0x70, 0x63, - 0x3b, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0xaa, 0x02, 0x13, 0x4e, 0x65, 0x6f, 0x46, 0x53, 0x2e, - 0x41, 0x50, 0x49, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x62, 0x06, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x4f, 0x46, 0x46, 0x4c, 0x49, 0x4e, 0x45, 0x10, 0x02, 0x22, 0x55, 0x0a, 0x0b, 0x4e, 0x65, 0x74, + 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x23, 0x0a, 0x0d, 0x63, 0x75, 0x72, 0x72, + 0x65, 0x6e, 0x74, 0x5f, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, + 0x0c, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x45, 0x70, 0x6f, 0x63, 0x68, 0x12, 0x21, 0x0a, + 0x0c, 0x6d, 0x61, 0x67, 0x69, 0x63, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x04, 0x52, 0x0b, 0x6d, 0x61, 0x67, 0x69, 0x63, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, + 0x2a, 0x67, 0x0a, 0x09, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x19, 0x0a, + 0x15, 0x4f, 0x50, 0x45, 0x52, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, + 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x06, 0x0a, 0x02, 0x45, 0x51, 0x10, 0x01, + 0x12, 0x06, 0x0a, 0x02, 0x4e, 0x45, 0x10, 0x02, 0x12, 0x06, 0x0a, 0x02, 0x47, 0x54, 0x10, 0x03, + 0x12, 0x06, 0x0a, 0x02, 0x47, 0x45, 0x10, 0x04, 0x12, 0x06, 0x0a, 0x02, 0x4c, 0x54, 0x10, 0x05, + 0x12, 0x06, 0x0a, 0x02, 0x4c, 0x45, 0x10, 0x06, 0x12, 0x06, 0x0a, 0x02, 0x4f, 0x52, 0x10, 0x07, + 0x12, 0x07, 0x0a, 0x03, 0x41, 0x4e, 0x44, 0x10, 0x08, 0x2a, 0x38, 0x0a, 0x06, 0x43, 0x6c, 0x61, + 0x75, 0x73, 0x65, 0x12, 0x16, 0x0a, 0x12, 0x43, 0x4c, 0x41, 0x55, 0x53, 0x45, 0x5f, 0x55, 0x4e, + 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x53, + 0x41, 0x4d, 0x45, 0x10, 0x01, 0x12, 0x0c, 0x0a, 0x08, 0x44, 0x49, 0x53, 0x54, 0x49, 0x4e, 0x43, + 0x54, 0x10, 0x02, 0x42, 0x4f, 0x5a, 0x37, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, + 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, + 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x6e, 0x65, 0x74, 0x6d, + 0x61, 0x70, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0xaa, 0x02, + 0x13, 0x4e, 0x65, 0x6f, 0x46, 0x53, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x65, + 0x74, 0x6d, 0x61, 0x70, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -824,7 +887,7 @@ func file_v2_netmap_grpc_types_proto_rawDescGZIP() []byte { } var file_v2_netmap_grpc_types_proto_enumTypes = make([]protoimpl.EnumInfo, 3) -var file_v2_netmap_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 6) +var file_v2_netmap_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 7) var file_v2_netmap_grpc_types_proto_goTypes = []interface{}{ (Operation)(0), // 0: neo.fs.v2.netmap.Operation (Clause)(0), // 1: neo.fs.v2.netmap.Clause @@ -834,7 +897,8 @@ var file_v2_netmap_grpc_types_proto_goTypes = []interface{}{ (*Replica)(nil), // 5: neo.fs.v2.netmap.Replica (*PlacementPolicy)(nil), // 6: neo.fs.v2.netmap.PlacementPolicy (*NodeInfo)(nil), // 7: neo.fs.v2.netmap.NodeInfo - (*NodeInfo_Attribute)(nil), // 8: neo.fs.v2.netmap.NodeInfo.Attribute + (*NetworkInfo)(nil), // 8: neo.fs.v2.netmap.NetworkInfo + (*NodeInfo_Attribute)(nil), // 9: neo.fs.v2.netmap.NodeInfo.Attribute } var file_v2_netmap_grpc_types_proto_depIdxs = []int32{ 0, // 0: neo.fs.v2.netmap.Filter.op:type_name -> neo.fs.v2.netmap.Operation @@ -843,7 +907,7 @@ var file_v2_netmap_grpc_types_proto_depIdxs = []int32{ 5, // 3: neo.fs.v2.netmap.PlacementPolicy.replicas:type_name -> neo.fs.v2.netmap.Replica 4, // 4: neo.fs.v2.netmap.PlacementPolicy.selectors:type_name -> neo.fs.v2.netmap.Selector 3, // 5: neo.fs.v2.netmap.PlacementPolicy.filters:type_name -> neo.fs.v2.netmap.Filter - 8, // 6: neo.fs.v2.netmap.NodeInfo.attributes:type_name -> neo.fs.v2.netmap.NodeInfo.Attribute + 9, // 6: neo.fs.v2.netmap.NodeInfo.attributes:type_name -> neo.fs.v2.netmap.NodeInfo.Attribute 2, // 7: neo.fs.v2.netmap.NodeInfo.state:type_name -> neo.fs.v2.netmap.NodeInfo.State 8, // [8:8] is the sub-list for method output_type 8, // [8:8] is the sub-list for method input_type @@ -919,6 +983,18 @@ func file_v2_netmap_grpc_types_proto_init() { } } file_v2_netmap_grpc_types_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*NetworkInfo); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_netmap_grpc_types_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*NodeInfo_Attribute); i { case 0: return &v.state @@ -937,7 +1013,7 @@ func file_v2_netmap_grpc_types_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_v2_netmap_grpc_types_proto_rawDesc, NumEnums: 3, - NumMessages: 6, + NumMessages: 7, NumExtensions: 0, NumServices: 0, }, From d0d2f8d5db126aef1478b71d4838b3579dd28352 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 17 Feb 2021 19:36:03 +0300 Subject: [PATCH 0676/1196] [#259] netmap: Define NetworkInfo RPC and all related messages Signed-off-by: Leonard Lyubich --- v2/netmap/service.go | 19 ++++++ v2/netmap/types.go | 140 +++++++++++++++++++++++++++++++++++++++++++ v2/session/util.go | 81 +++++++++++++++++++++++++ 3 files changed, 240 insertions(+) create mode 100644 v2/session/util.go diff --git a/v2/netmap/service.go b/v2/netmap/service.go index 98e5101..a57819b 100644 --- a/v2/netmap/service.go +++ b/v2/netmap/service.go @@ -8,6 +8,7 @@ import ( type Service interface { LocalNodeInfo(ctx context.Context, request *LocalNodeInfoRequest) (*LocalNodeInfoResponse, error) + NetworkInfo(ctx context.Context, request *NetworkInfoRequest) (*NetworkInfoResponse, error) } type LocalNodeInfoRequest struct { @@ -25,3 +26,21 @@ type LocalNodeInfoResponse struct { verifyHeader *session.ResponseVerificationHeader } + +// NetworkInfoRequest is a structure of NetworkInfo request. +type NetworkInfoRequest struct { + body *NetworkInfoRequestBody + + metaHeader *session.RequestMetaHeader + + verifyHeader *session.RequestVerificationHeader +} + +// NetworkInfoResponse is a structure of NetworkInfo response. +type NetworkInfoResponse struct { + body *NetworkInfoResponseBody + + metaHeader *session.ResponseMetaHeader + + verifyHeader *session.ResponseVerificationHeader +} diff --git a/v2/netmap/types.go b/v2/netmap/types.go index a65bd31..320384e 100644 --- a/v2/netmap/types.go +++ b/v2/netmap/types.go @@ -507,3 +507,143 @@ func (l *LocalNodeInfoResponse) SetVerificationHeader(verifyHeader *session.Resp l.verifyHeader = verifyHeader } } + +// NetworkInfo groups information about +// NeoFS network. +type NetworkInfo struct { + curEpoch, magicNum uint64 +} + +// GetCurrentEpoch returns number of the current epoch. +func (i *NetworkInfo) GetCurrentEpoch() uint64 { + if i != nil { + return i.curEpoch + } + + return 0 +} + +// SetCurrentEpoch sets number of the current epoch. +func (i *NetworkInfo) SetCurrentEpoch(epoch uint64) { + if i != nil { + i.curEpoch = epoch + } +} + +// GetMagicNumber returns magic number of the sidechain. +func (i *NetworkInfo) GetMagicNumber() uint64 { + if i != nil { + return i.magicNum + } + + return 0 +} + +// SetMagicNumber sets magic number of the sidechain. +func (i *NetworkInfo) SetMagicNumber(magic uint64) { + if i != nil { + i.magicNum = magic + } +} + +// NetworkInfoRequestBody is a structure of NetworkInfo request body. +type NetworkInfoRequestBody struct{} + +// NetworkInfoResponseBody is a structure of NetworkInfo response body. +type NetworkInfoResponseBody struct { + netInfo *NetworkInfo +} + +// GetNetworkInfo returns information about the NeoFS network. +func (i *NetworkInfoResponseBody) GetNetworkInfo() *NetworkInfo { + if i != nil { + return i.netInfo + } + + return nil +} + +// SetNetworkInfo sets information about the NeoFS network. +func (i *NetworkInfoResponseBody) SetNetworkInfo(netInfo *NetworkInfo) { + if i != nil { + i.netInfo = netInfo + } +} + +func (l *NetworkInfoRequest) GetBody() *NetworkInfoRequestBody { + if l != nil { + return l.body + } + return nil +} + +func (l *NetworkInfoRequest) SetBody(body *NetworkInfoRequestBody) { + if l != nil { + l.body = body + } +} + +func (l *NetworkInfoRequest) GetMetaHeader() *session.RequestMetaHeader { + if l != nil { + return l.metaHeader + } + return nil +} + +func (l *NetworkInfoRequest) SetMetaHeader(metaHeader *session.RequestMetaHeader) { + if l != nil { + l.metaHeader = metaHeader + } +} + +func (l *NetworkInfoRequest) GetVerificationHeader() *session.RequestVerificationHeader { + if l != nil { + return l.verifyHeader + } + return nil +} + +func (l *NetworkInfoRequest) SetVerificationHeader(verifyHeader *session.RequestVerificationHeader) { + if l != nil { + l.verifyHeader = verifyHeader + } +} + +func (l *NetworkInfoResponse) GetBody() *NetworkInfoResponseBody { + if l != nil { + return l.body + } + return nil +} + +func (l *NetworkInfoResponse) SetBody(body *NetworkInfoResponseBody) { + if l != nil { + l.body = body + } +} + +func (l *NetworkInfoResponse) GetMetaHeader() *session.ResponseMetaHeader { + if l != nil { + return l.metaHeader + } + return nil +} + +func (l *NetworkInfoResponse) SetMetaHeader(metaHeader *session.ResponseMetaHeader) { + if l != nil { + l.metaHeader = metaHeader + } +} + +func (l *NetworkInfoResponse) GetVerificationHeader() *session.ResponseVerificationHeader { + if l != nil { + return l.verifyHeader + } + return nil +} + +func (l *NetworkInfoResponse) SetVerificationHeader(verifyHeader *session.ResponseVerificationHeader) { + if l != nil { + l.verifyHeader = verifyHeader + } +} diff --git a/v2/session/util.go b/v2/session/util.go new file mode 100644 index 0000000..0235429 --- /dev/null +++ b/v2/session/util.go @@ -0,0 +1,81 @@ +package session + +// RequestHeaders represents common part of +// all NeoFS requests including headers. +type RequestHeaders struct { + metaHeader *RequestMetaHeader + + verifyHeader *RequestVerificationHeader +} + +// GetMetaHeader returns meta header of the request. +func (c *RequestHeaders) GetMetaHeader() *RequestMetaHeader { + if c != nil { + return c.metaHeader + } + + return nil +} + +// SetMetaHeader sets meta header of the request. +func (c *RequestHeaders) SetMetaHeader(v *RequestMetaHeader) { + if c != nil { + c.metaHeader = v + } +} + +// GetVerificationHeader returns verification header of the request. +func (c *RequestHeaders) GetVerificationHeader() *RequestVerificationHeader { + if c != nil { + return c.verifyHeader + } + + return nil +} + +// SetVerificationHeader sets verification header of the request. +func (c *RequestHeaders) SetVerificationHeader(v *RequestVerificationHeader) { + if c != nil { + c.verifyHeader = v + } +} + +// ResponseHeaders represents common part of +// all NeoFS responses including headers. +type ResponseHeaders struct { + metaHeader *ResponseMetaHeader + + verifyHeader *ResponseVerificationHeader +} + +// GetMetaHeader returns meta header of the response. +func (c *ResponseHeaders) GetMetaHeader() *ResponseMetaHeader { + if c != nil { + return c.metaHeader + } + + return nil +} + +// SetMetaHeader sets meta header of the response. +func (c *ResponseHeaders) SetMetaHeader(v *ResponseMetaHeader) { + if c != nil { + c.metaHeader = v + } +} + +// GetVerificationHeader returns verification header of the response. +func (c *ResponseHeaders) GetVerificationHeader() *ResponseVerificationHeader { + if c != nil { + return c.verifyHeader + } + + return nil +} + +// SetVerificationHeader sets verification header of the response. +func (c *ResponseHeaders) SetVerificationHeader(v *ResponseVerificationHeader) { + if c != nil { + c.verifyHeader = v + } +} From ae35f1782718da67b9aff96ebce1137775c95361 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 17 Feb 2021 20:02:02 +0300 Subject: [PATCH 0677/1196] [#259] netmap/grpc: Implement field setters of NetworkInfo RPC messages Signed-off-by: Leonard Lyubich --- v2/netmap/grpc/service.go | 49 +++++++++++++++++++++++++++++++++++++++ v2/netmap/grpc/types.go | 14 +++++++++++ 2 files changed, 63 insertions(+) diff --git a/v2/netmap/grpc/service.go b/v2/netmap/grpc/service.go index ae00b21..36ed88d 100644 --- a/v2/netmap/grpc/service.go +++ b/v2/netmap/grpc/service.go @@ -60,3 +60,52 @@ func (m *LocalNodeInfoResponse) SetVerifyHeader(v *session.ResponseVerificationH m.VerifyHeader = v } } + +// SetBody sets body of the request. +func (x *NetworkInfoRequest) SetBody(v *NetworkInfoRequest_Body) { + if x != nil { + x.Body = v + } +} + +// SetMetaHeader sets meta header of the request. +func (x *NetworkInfoRequest) SetMetaHeader(v *session.RequestMetaHeader) { + if x != nil { + x.MetaHeader = v + } +} + +// SetVerifyHeader sets verification header of the request. +func (x *NetworkInfoRequest) SetVerifyHeader(v *session.RequestVerificationHeader) { + if x != nil { + x.VerifyHeader = v + } +} + +// SetNetworkInfo sets information about the network. +func (x *NetworkInfoResponse_Body) SetNetworkInfo(v *NetworkInfo) { + if x != nil { + x.NetworkInfo = v + } +} + +// SetBody sets body of the response. +func (x *NetworkInfoResponse) SetBody(v *NetworkInfoResponse_Body) { + if x != nil { + x.Body = v + } +} + +// SetMetaHeader sets meta header of the response. +func (x *NetworkInfoResponse) SetMetaHeader(v *session.ResponseMetaHeader) { + if x != nil { + x.MetaHeader = v + } +} + +// SetVerifyHeader sets verification header of the response. +func (x *NetworkInfoResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) { + if x != nil { + x.VerifyHeader = v + } +} diff --git a/v2/netmap/grpc/types.go b/v2/netmap/grpc/types.go index e1e5a84..d3e2120 100644 --- a/v2/netmap/grpc/types.go +++ b/v2/netmap/grpc/types.go @@ -160,3 +160,17 @@ func (m *NodeInfo) SetState(v NodeInfo_State) { m.State = v } } + +// SetCurrentEpoch sets number of the current epoch. +func (x *NetworkInfo) SetCurrentEpoch(v uint64) { + if x != nil { + x.CurrentEpoch = v + } +} + +// SetMagicNumber sets magic number of the sidechain. +func (x *NetworkInfo) SetMagicNumber(v uint64) { + if x != nil { + x.MagicNumber = v + } +} From c3be9dc27047bbbb1bccd065a2d3eebb9775d8fe Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 17 Feb 2021 20:17:44 +0300 Subject: [PATCH 0678/1196] [#259] netmap: Implement converters for NetworkInfo RPC messages Signed-off-by: Leonard Lyubich --- v2/netmap/convert.go | 117 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 117 insertions(+) diff --git a/v2/netmap/convert.go b/v2/netmap/convert.go index ca069c9..caf30bd 100644 --- a/v2/netmap/convert.go +++ b/v2/netmap/convert.go @@ -354,3 +354,120 @@ func LocalNodeInfoResponseFromGRPCMessage(m *netmap.LocalNodeInfoResponse) *Loca return r } + +func NetworkInfoToGRPCMessage(n *NetworkInfo) *netmap.NetworkInfo { + if n == nil { + return nil + } + + m := new(netmap.NetworkInfo) + + m.SetCurrentEpoch(n.GetCurrentEpoch()) + m.SetMagicNumber(n.GetMagicNumber()) + + return m +} + +func NetworkInfoFromGRPCMessage(m *netmap.NetworkInfo) *NetworkInfo { + if m == nil { + return nil + } + + n := new(NetworkInfo) + + n.SetCurrentEpoch(m.GetCurrentEpoch()) + n.SetMagicNumber(m.GetMagicNumber()) + + return n +} + +func NetworkInfoRequestBodyToGRPCMessage(r *NetworkInfoRequestBody) *netmap.NetworkInfoRequest_Body { + if r == nil { + return nil + } + + return new(netmap.NetworkInfoRequest_Body) +} + +func NetworkInfoRequestBodyFromGRPCMessage(m *netmap.NetworkInfoRequest_Body) *NetworkInfoRequestBody { + if m == nil { + return nil + } + + return new(NetworkInfoRequestBody) +} + +func NetworkInfoResponseBodyToGRPCMessage(r *NetworkInfoResponseBody) *netmap.NetworkInfoResponse_Body { + if r == nil { + return nil + } + + m := new(netmap.NetworkInfoResponse_Body) + + m.SetNetworkInfo(NetworkInfoToGRPCMessage(r.GetNetworkInfo())) + + return m +} + +func NetworkInfoResponseBodyFromGRPCMessage(m *netmap.NetworkInfoResponse_Body) *NetworkInfoResponseBody { + if m == nil { + return nil + } + + r := new(NetworkInfoResponseBody) + r.SetNetworkInfo(NetworkInfoFromGRPCMessage(m.GetNetworkInfo())) + + return r +} + +func NetworkInfoRequestToGRPCMessage(r *NetworkInfoRequest) *netmap.NetworkInfoRequest { + if r == nil { + return nil + } + + m := new(netmap.NetworkInfoRequest) + m.SetBody(NetworkInfoRequestBodyToGRPCMessage(r.GetBody())) + + session.RequestHeadersToGRPC(r, m) + + return m +} + +func NetworkInfoRequestFromGRPCMessage(m *netmap.NetworkInfoRequest) *NetworkInfoRequest { + if m == nil { + return nil + } + + r := new(NetworkInfoRequest) + r.SetBody(NetworkInfoRequestBodyFromGRPCMessage(m.GetBody())) + + session.RequestHeadersFromGRPC(m, r) + + return r +} + +func NetworkInfoResponseToGRPCMessage(r *NetworkInfoResponse) *netmap.NetworkInfoResponse { + if r == nil { + return nil + } + + m := new(netmap.NetworkInfoResponse) + m.SetBody(NetworkInfoResponseBodyToGRPCMessage(r.GetBody())) + + session.ResponseHeadersToGRPC(r, m) + + return m +} + +func NetworkInfoResponseFromGRPCMessage(m *netmap.NetworkInfoResponse) *NetworkInfoResponse { + if m == nil { + return nil + } + + r := new(NetworkInfoResponse) + r.SetBody(NetworkInfoResponseBodyFromGRPCMessage(m.GetBody())) + + session.ResponseHeadersFromGRPC(m, r) + + return r +} From 276d863fd5451bce415396d100c8741aaa19cdd7 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 17 Feb 2021 20:28:46 +0300 Subject: [PATCH 0679/1196] [#259] netmap: Implement binary encoding for NetworkInfo RPC messages Signed-off-by: Leonard Lyubich --- v2/netmap/marshal.go | 97 +++++++++++++++++++++++++++++++++++++++ v2/netmap/marshal_test.go | 33 +++++++++++++ 2 files changed, 130 insertions(+) diff --git a/v2/netmap/marshal.go b/v2/netmap/marshal.go index 32a6b76..3fa3388 100644 --- a/v2/netmap/marshal.go +++ b/v2/netmap/marshal.go @@ -500,3 +500,100 @@ func (l *LocalNodeInfoResponseBody) StableSize() (size int) { return size } + +const ( + _ = iota + netInfoCurEpochFNum + netInfoMagicNumFNum +) + +func (i *NetworkInfo) StableMarshal(buf []byte) ([]byte, error) { + if i == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, i.StableSize()) + } + + var ( + offset, n int + err error + ) + + n, err = protoutil.UInt64Marshal(netInfoCurEpochFNum, buf[offset:], i.curEpoch) + if err != nil { + return nil, err + } + + offset += n + + _, err = protoutil.UInt64Marshal(netInfoMagicNumFNum, buf[offset:], i.magicNum) + if err != nil { + return nil, err + } + + return buf, nil +} + +func (i *NetworkInfo) StableSize() (size int) { + if i == nil { + return 0 + } + + size += protoutil.UInt64Size(netInfoCurEpochFNum, i.curEpoch) + size += protoutil.UInt64Size(netInfoMagicNumFNum, i.magicNum) + + return size +} + +func (i *NetworkInfo) Unmarshal(data []byte) error { + m := new(netmap.NetworkInfo) + if err := proto.Unmarshal(data, m); err != nil { + return err + } + + *i = *NetworkInfoFromGRPCMessage(m) + + return nil +} + +func (l *NetworkInfoRequestBody) StableMarshal(buf []byte) ([]byte, error) { + return nil, nil +} + +func (l *NetworkInfoRequestBody) StableSize() (size int) { + return 0 +} + +const ( + _ = iota + netInfoRespBodyNetInfoFNum +) + +func (i *NetworkInfoResponseBody) StableMarshal(buf []byte) ([]byte, error) { + if i == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, i.StableSize()) + } + + _, err := protoutil.NestedStructureMarshal(netInfoRespBodyNetInfoFNum, buf, i.netInfo) + if err != nil { + return nil, err + } + + return buf, nil +} + +func (i *NetworkInfoResponseBody) StableSize() (size int) { + if i == nil { + return 0 + } + + size += protoutil.NestedStructureSize(netInfoRespBodyNetInfoFNum, i.netInfo) + + return size +} diff --git a/v2/netmap/marshal_test.go b/v2/netmap/marshal_test.go index 63347ad..0acbd4b 100644 --- a/v2/netmap/marshal_test.go +++ b/v2/netmap/marshal_test.go @@ -111,6 +111,22 @@ func TestLocalNodeInfoResponseBody_StableMarshal(t *testing.T) { }) } +func TestNetworkInfoResponseBody_StableMarshal(t *testing.T) { + from := generateNetworkInfoResponseBody() + transport := new(grpc.NetworkInfoResponse_Body) + + t.Run("non empty", func(t *testing.T) { + wire, err := from.StableMarshal(nil) + require.NoError(t, err) + + err = goproto.Unmarshal(wire, transport) + require.NoError(t, err) + + to := netmap.NetworkInfoResponseBodyFromGRPCMessage(transport) + require.Equal(t, from, to) + }) +} + func generateAttribute(k, v string) *netmap.Attribute { attr := new(netmap.Attribute) attr.SetKey(k) @@ -213,3 +229,20 @@ func generateVersion(maj, min uint32) *refs.Version { return version } + +func generateNetworkInfo() *netmap.NetworkInfo { + ni := new(netmap.NetworkInfo) + ni.SetCurrentEpoch(13) + ni.SetMagicNumber(666) + + return ni +} + +func generateNetworkInfoResponseBody() *netmap.NetworkInfoResponseBody { + ni := generateNetworkInfo() + + r := new(netmap.NetworkInfoResponseBody) + r.SetNetworkInfo(ni) + + return r +} From 9eda317efe1a145695bafdd307baf40e9ed56275 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 17 Feb 2021 20:32:23 +0300 Subject: [PATCH 0680/1196] [#259] netmap: Implement JSON encoding for NetworkInfo RPC messages Signed-off-by: Leonard Lyubich --- v2/netmap/json.go | 20 ++++++++++++++++++++ v2/netmap/json_test.go | 12 ++++++++++++ 2 files changed, 32 insertions(+) diff --git a/v2/netmap/json.go b/v2/netmap/json.go index 7210501..3445f05 100644 --- a/v2/netmap/json.go +++ b/v2/netmap/json.go @@ -124,3 +124,23 @@ func (ni *NodeInfo) UnmarshalJSON(data []byte) error { return nil } + +func (i *NetworkInfo) MarshalJSON() ([]byte, error) { + return protojson.MarshalOptions{ + EmitUnpopulated: true, + }.Marshal( + NetworkInfoToGRPCMessage(i), + ) +} + +func (i *NetworkInfo) UnmarshalJSON(data []byte) error { + msg := new(netmap.NetworkInfo) + + if err := protojson.Unmarshal(data, msg); err != nil { + return err + } + + *i = *NetworkInfoFromGRPCMessage(msg) + + return nil +} diff --git a/v2/netmap/json_test.go b/v2/netmap/json_test.go index 561dbf1..3f01b03 100644 --- a/v2/netmap/json_test.go +++ b/v2/netmap/json_test.go @@ -66,3 +66,15 @@ func TestNodeInfoJSON(t *testing.T) { require.Equal(t, i, i2) } + +func TestNetworkInfoJSON(t *testing.T) { + i := generateNetworkInfo() + + data, err := i.MarshalJSON() + require.NoError(t, err) + + i2 := new(netmap.NetworkInfo) + require.NoError(t, i2.UnmarshalJSON(data)) + + require.Equal(t, i, i2) +} From 8cb1f960f4a024a15be0aa0e2571ca631c18b5e0 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 17 Feb 2021 20:34:44 +0300 Subject: [PATCH 0681/1196] [#259] netmap/grpc: Add NetworkInfo call to Client Signed-off-by: Leonard Lyubich --- v2/netmap/grpc/client.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/v2/netmap/grpc/client.go b/v2/netmap/grpc/client.go index d22a79a..5ed5e5b 100644 --- a/v2/netmap/grpc/client.go +++ b/v2/netmap/grpc/client.go @@ -53,6 +53,10 @@ func (c *Client) LocalNodeInfo(ctx context.Context, req *LocalNodeInfoRequest) ( return c.client.LocalNodeInfo(ctx, req, c.callOpts...) } +func (c *Client) NetworkInfo(ctx context.Context, req *NetworkInfoRequest) (*NetworkInfoResponse, error) { + return c.client.NetworkInfo(ctx, req, c.callOpts...) +} + // WithCallOptions returns Option that configures // Client to attach call options to each rpc call. func WithCallOptions(opts []grpc.CallOption) Option { From 88d6857a3cc77fca702dfce64ef0ad8597db11d3 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 17 Feb 2021 20:39:29 +0300 Subject: [PATCH 0682/1196] [#259] netmap: Add NetworkInfo call to Client Signed-off-by: Leonard Lyubich --- v2/netmap/client.go | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/v2/netmap/client.go b/v2/netmap/client.go index b71533f..e00f2db 100644 --- a/v2/netmap/client.go +++ b/v2/netmap/client.go @@ -12,6 +12,8 @@ import ( // Client represents universal netmap transport client. type Client struct { cLocalNodeInfo *localNodeInfoClient + + cNetworkInfo *networkInfoClient } // Option represents Client option. @@ -43,6 +45,14 @@ type localNodeInfoClient struct { responseConverter func(interface{}) *LocalNodeInfoResponse } +type networkInfoClient struct { + requestConverter func(*NetworkInfoRequest) interface{} + + caller func(context.Context, interface{}) (interface{}, error) + + responseConverter func(interface{}) *NetworkInfoResponse +} + // LocalNodeInfo sends LocalNodeInfoRequest over the network. func (c *Client) LocalNodeInfo(ctx context.Context, req *LocalNodeInfoRequest) (*LocalNodeInfoResponse, error) { resp, err := c.cLocalNodeInfo.caller(ctx, c.cLocalNodeInfo.requestConverter(req)) @@ -53,6 +63,16 @@ func (c *Client) LocalNodeInfo(ctx context.Context, req *LocalNodeInfoRequest) ( return c.cLocalNodeInfo.responseConverter(resp), nil } +// NetworkInfo sends NetworkInfoRequest over the network. +func (c *Client) NetworkInfo(ctx context.Context, req *NetworkInfoRequest) (*NetworkInfoResponse, error) { + resp, err := c.cNetworkInfo.caller(ctx, c.cNetworkInfo.requestConverter(req)) + if err != nil { + return nil, errors.Wrap(err, "could not send network info request") + } + + return c.cNetworkInfo.responseConverter(resp), nil +} + func defaultCfg() *cfg { return &cfg{ proto: client.ProtoGRPC, @@ -88,6 +108,17 @@ func NewClient(opts ...Option) (*Client, error) { return LocalNodeInfoResponseFromGRPCMessage(resp.(*netmap.LocalNodeInfoResponse)) }, }, + cNetworkInfo: &networkInfoClient{ + requestConverter: func(req *NetworkInfoRequest) interface{} { + return NetworkInfoRequestToGRPCMessage(req) + }, + caller: func(ctx context.Context, req interface{}) (interface{}, error) { + return c.NetworkInfo(ctx, req.(*netmap.NetworkInfoRequest)) + }, + responseConverter: func(resp interface{}) *NetworkInfoResponse { + return NetworkInfoResponseFromGRPCMessage(resp.(*netmap.NetworkInfoResponse)) + }, + }, }, nil default: err = client.ErrProtoUnsupported From f6268339d033fd21e74ccba3b59f716031a3cdae Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 17 Feb 2021 20:55:02 +0300 Subject: [PATCH 0683/1196] [#259] pkg/netmap: Implement v2-compatible NetworkInfo type Define NetworkInfo structure. Implement constructors, fields getters and setters, binary and JSON encoding methods. Signed-off-by: Leonard Lyubich --- pkg/netmap/network_info.go | 80 +++++++++++++++++++++++++++++++++ pkg/netmap/network_info_test.go | 53 ++++++++++++++++++++++ 2 files changed, 133 insertions(+) create mode 100644 pkg/netmap/network_info.go create mode 100644 pkg/netmap/network_info_test.go diff --git a/pkg/netmap/network_info.go b/pkg/netmap/network_info.go new file mode 100644 index 0000000..ba3f204 --- /dev/null +++ b/pkg/netmap/network_info.go @@ -0,0 +1,80 @@ +package netmap + +import ( + "github.com/nspcc-dev/neofs-api-go/v2/netmap" +) + +// NetworkInfo represents v2-compatible structure +// with information about NeoFS network. +type NetworkInfo netmap.NetworkInfo + +// NewNetworkInfoFromV2 wraps v2 NetworkInfo message to NetworkInfo. +func NewNetworkInfoFromV2(iV2 *netmap.NetworkInfo) *NetworkInfo { + return (*NetworkInfo)(iV2) +} + +// NewNetworkInfo creates and initializes blank NetworkInfo. +func NewNetworkInfo() *NetworkInfo { + return NewNetworkInfoFromV2(new(netmap.NetworkInfo)) +} + +// ToV2 converts NetworkInfo to v2 NetworkInfo. +func (i *NetworkInfo) ToV2() *netmap.NetworkInfo { + return (*netmap.NetworkInfo)(i) +} + +// CurrentEpoch returns current epoch of the NeoFS network. +func (i *NetworkInfo) CurrentEpoch() uint64 { + return (*netmap.NetworkInfo)(i). + GetCurrentEpoch() +} + +// SetCurrentEpoch sets current epoch of the NeoFS network. +func (i *NetworkInfo) SetCurrentEpoch(epoch uint64) { + (*netmap.NetworkInfo)(i). + SetCurrentEpoch(epoch) +} + +// MagicNumber returns magic number of the sidechain. +func (i *NetworkInfo) MagicNumber() uint64 { + return (*netmap.NetworkInfo)(i). + GetMagicNumber() +} + +// SetMagicNumber sets magic number of the sidechain. +func (i *NetworkInfo) SetMagicNumber(epoch uint64) { + (*netmap.NetworkInfo)(i). + SetMagicNumber(epoch) +} + +// Marshal marshals NetworkInfo into a protobuf binary form. +// +// Buffer is allocated when the argument is empty. +// Otherwise, the first buffer is used. +func (i *NetworkInfo) Marshal(b ...[]byte) ([]byte, error) { + var buf []byte + if len(b) > 0 { + buf = b[0] + } + + return (*netmap.NetworkInfo)(i). + StableMarshal(buf) +} + +// Unmarshal unmarshals protobuf binary representation of NetworkInfo. +func (i *NetworkInfo) Unmarshal(data []byte) error { + return (*netmap.NetworkInfo)(i). + Unmarshal(data) +} + +// MarshalJSON encodes NetworkInfo to protobuf JSON format. +func (i *NetworkInfo) MarshalJSON() ([]byte, error) { + return (*netmap.NetworkInfo)(i). + MarshalJSON() +} + +// UnmarshalJSON decodes NetworkInfo from protobuf JSON format. +func (i *NetworkInfo) UnmarshalJSON(data []byte) error { + return (*netmap.NetworkInfo)(i). + UnmarshalJSON(data) +} diff --git a/pkg/netmap/network_info_test.go b/pkg/netmap/network_info_test.go new file mode 100644 index 0000000..bb8643f --- /dev/null +++ b/pkg/netmap/network_info_test.go @@ -0,0 +1,53 @@ +package netmap + +import ( + "testing" + + "github.com/stretchr/testify/require" +) + +func TestNetworkInfo_CurrentEpoch(t *testing.T) { + i := NewNetworkInfo() + e := uint64(13) + + i.SetCurrentEpoch(e) + + require.Equal(t, e, i.CurrentEpoch()) + require.Equal(t, e, i.ToV2().GetCurrentEpoch()) +} + +func TestNetworkInfo_MagicNumber(t *testing.T) { + i := NewNetworkInfo() + m := uint64(666) + + i.SetMagicNumber(m) + + require.Equal(t, m, i.MagicNumber()) + require.Equal(t, m, i.ToV2().GetMagicNumber()) +} + +func TestNetworkInfoEncoding(t *testing.T) { + i := NewNetworkInfo() + i.SetCurrentEpoch(13) + i.SetMagicNumber(666) + + t.Run("binary", func(t *testing.T) { + data, err := i.Marshal() + require.NoError(t, err) + + i2 := NewNetworkInfo() + require.NoError(t, i2.Unmarshal(data)) + + require.Equal(t, i, i2) + }) + + t.Run("json", func(t *testing.T) { + data, err := i.MarshalJSON() + require.NoError(t, err) + + i2 := NewNetworkInfo() + require.NoError(t, i2.UnmarshalJSON(data)) + + require.Equal(t, i, i2) + }) +} From 8529aa2a931e005f980f0d2632f8255213f5b4f8 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 17 Feb 2021 21:03:48 +0300 Subject: [PATCH 0684/1196] [#259] pkg/client: Add NetworkInfo method Implement NetworkInfo method that performs NeoFS API NetmapService NetworkInfo RPC. Signed-off-by: Leonard Lyubich --- pkg/client/netmap.go | 57 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/pkg/client/netmap.go b/pkg/client/netmap.go index 749b640..f45eb78 100644 --- a/pkg/client/netmap.go +++ b/pkg/client/netmap.go @@ -114,3 +114,60 @@ func v2NetmapClientFromOptions(opts *clientOptions) (cli *v2netmap.Client, err e return cli, nil } + +// NetworkInfo returns information about the NeoFS network of which the remote server is a part. +func (c Client) NetworkInfo(ctx context.Context, opts ...CallOption) (*netmap.NetworkInfo, error) { + switch c.remoteNode.Version.Major() { + case 2: + resp, err := c.networkInfoV2(ctx, opts...) + if err != nil { + return nil, err + } + + return netmap.NewNetworkInfoFromV2(resp.GetBody().GetNetworkInfo()), nil + default: + return nil, errUnsupportedProtocol + } +} + +func (c Client) networkInfoV2(ctx context.Context, opts ...CallOption) (*v2netmap.NetworkInfoResponse, error) { + // apply all available options + callOptions := c.defaultCallOptions() + + for i := range opts { + opts[i].apply(&callOptions) + } + + reqBody := new(v2netmap.NetworkInfoRequestBody) + + req := new(v2netmap.NetworkInfoRequest) + req.SetBody(reqBody) + req.SetMetaHeader(v2MetaHeaderFromOpts(callOptions)) + + err := v2signature.SignServiceMessage(c.key, req) + if err != nil { + return nil, err + } + + switch c.remoteNode.Protocol { + case GRPC: + cli, err := v2NetmapClientFromOptions(c.opts) + if err != nil { + return nil, errors.Wrap(err, "could not create grpc client") + } + + resp, err := cli.NetworkInfo(ctx, req) + if err != nil { + return nil, errors.Wrap(err, "v2 NetworkInfo RPC failure") + } + + err = v2signature.VerifyServiceMessage(resp) + if err != nil { + return nil, errors.Wrap(err, "response message verification failed") + } + + return resp, nil + default: + return nil, errUnsupportedProtocol + } +} From e2b0887be93d2fbac9b4e430f4e23fc9ef57bf87 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 19 Feb 2021 10:16:22 +0300 Subject: [PATCH 0685/1196] [#259] v2/signature: Support NetworkInfo request/response messages Signed-off-by: Leonard Lyubich --- v2/signature/sign.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/v2/signature/sign.go b/v2/signature/sign.go index 3a898de..f006bfb 100644 --- a/v2/signature/sign.go +++ b/v2/signature/sign.go @@ -370,5 +370,9 @@ func serviceMessageBody(req interface{}) stableMarshaler { return v.GetBody() case *netmap.LocalNodeInfoResponse: return v.GetBody() + case *netmap.NetworkInfoRequest: + return v.GetBody() + case *netmap.NetworkInfoResponse: + return v.GetBody() } } From a4d52c2d23df0d2030788f1ceae65909790aa8d0 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Fri, 26 Feb 2021 11:43:01 +0300 Subject: [PATCH 0686/1196] Recompile NeoFS API proto definitions Signed-off-by: Alex Vanin --- v2/netmap/grpc/service.pb.go | 3 +++ v2/object/grpc/service.pb.go | 5 +++++ v2/tombstone/grpc/types.pb.go | 4 +++- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/v2/netmap/grpc/service.pb.go b/v2/netmap/grpc/service.pb.go index c7864c8..a56abe4 100644 --- a/v2/netmap/grpc/service.pb.go +++ b/v2/netmap/grpc/service.pb.go @@ -171,6 +171,7 @@ func (x *LocalNodeInfoResponse) GetVerifyHeader() *grpc.ResponseVerificationHead return nil } +// Get NetworkInfo structure with the network view from particular node. type NetworkInfoRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -240,6 +241,8 @@ func (x *NetworkInfoRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { return nil } +// Response with NetworkInfo structure including current epoch and +// sidechain magic number. type NetworkInfoResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache diff --git a/v2/object/grpc/service.pb.go b/v2/object/grpc/service.pb.go index 8f0ea63..81a9c41 100644 --- a/v2/object/grpc/service.pb.go +++ b/v2/object/grpc/service.pb.go @@ -1910,6 +1910,11 @@ func (x *SearchRequest_Body) GetFilters() []*SearchRequest_Body_Filter { // Filter structure checks if object header field or attribute content // matches a value. // +// If no filters set, search request will return all objects of the +// container, including Regular object, Tombstones and Storage Group +// objects. Most human users expect to get only object they can directly +// work with. In that case the `$Object:ROOT` filter should be used. +// // By default `key` field refers to the corresponding object's `Attribute`. // Some Object's header fields can also be accessed by adding `$Object:` // prefix to the name. Here is the list of fields available via this prefix: diff --git a/v2/tombstone/grpc/types.pb.go b/v2/tombstone/grpc/types.pb.go index d14e2b9..c7a7dc0 100644 --- a/v2/tombstone/grpc/types.pb.go +++ b/v2/tombstone/grpc/types.pb.go @@ -34,7 +34,9 @@ type Tombstone struct { unknownFields protoimpl.UnknownFields // Last NeoFS epoch number of the tombstone lifetime. It's set by tombstone - // creator depending on current NeoFS network settings. + // creator depending on current NeoFS network settings. Tombstone object + // must have the same expiration epoch value in `__NEOFS__EXPIRATION_EPOCH` + // attribute. Otherwise tombstone will be rejected by storage node. ExpirationEpoch uint64 `protobuf:"varint,1,opt,name=expiration_epoch,json=expirationEpoch,proto3" json:"expiration_epoch,omitempty"` // 16 byte UUID used to identify the split object hierarchy parts. Must be // unique inside container. All objects participating in the split must From 18e9122e4360ad639efecd0bbc2c2801ae521186 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Fri, 26 Feb 2021 11:50:35 +0300 Subject: [PATCH 0687/1196] Update changelog and readme for release v1.24.0 Signed-off-by: Alex Vanin --- CHANGELOG.md | 14 ++++++++++++++ README.md | 1 + 2 files changed, 15 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 629becf..70972b1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,18 @@ # Changelog +## [1.24.0] - 2021-02-26 - Ganghwado (강화도, 江華島) + +Support changes from NeoFS API v2.4.0 "Ganghwado" release. + +### Added + +- `netmap.NetworkInfo` definitions in `v2` and `pkg/netmap`. +- `netmap.NetworkInfo` RPC support in `pkg/client`. + +### Changed + +- Updated in-line docs from NeoFS API "Ganghwado" release. + ## [1.23.0] - 2021-02-11 - Seonyudo (선유도, 仙遊島) Support changes from NeoFS API v2.3.0 "Seonyudo" release. @@ -554,3 +567,4 @@ Initial public release [1.22.1]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.22.0...v1.22.1 [1.22.2]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.22.1...v1.22.2 [1.23.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.22.2...v1.23.0 +[1.24.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.23.0...v1.24.0 diff --git a/README.md b/README.md index 8bb9cae..fd1c1c7 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,7 @@ versions and SDK layer working with all of them in a handy way. |v1.21.x|[v2.1.0](https://github.com/nspcc-dev/neofs-api/releases/tag/v2.1.0)| |v1.22.x|[v2.2.0](https://github.com/nspcc-dev/neofs-api/releases/tag/v2.2.0)| |v1.23.x|[v2.3.0](https://github.com/nspcc-dev/neofs-api/releases/tag/v2.3.0)| +|v1.24.x|[v2.4.0](https://github.com/nspcc-dev/neofs-api/releases/tag/v2.4.0)| ## Contributing From 74769323bea433a7a141ab2c0d25ab9329b4cb86 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Wed, 10 Mar 2021 15:07:06 +0300 Subject: [PATCH 0688/1196] [#261] pkg/client: Use self address as default in `ListContainers`/`GetBalance` This will allow us to overwrite key for every request. Signed-off-by: Evgenii Stratonikov --- pkg/client/accounting.go | 24 +++++++++++++----------- pkg/client/container.go | 24 +++++++++++++----------- 2 files changed, 26 insertions(+), 22 deletions(-) diff --git a/pkg/client/accounting.go b/pkg/client/accounting.go index 7446233..9b3f129 100644 --- a/pkg/client/accounting.go +++ b/pkg/client/accounting.go @@ -12,15 +12,7 @@ import ( ) func (c Client) GetSelfBalance(ctx context.Context, opts ...CallOption) (*accounting.Decimal, error) { - w, err := owner.NEO3WalletFromPublicKey(&c.key.PublicKey) - if err != nil { - return nil, err - } - - ownerID := new(owner.ID) - ownerID.SetNeo3Wallet(w) - - return c.GetBalance(ctx, ownerID, opts...) + return c.GetBalance(ctx, nil, opts...) } func (c Client) GetBalance(ctx context.Context, owner *owner.ID, opts ...CallOption) (*accounting.Decimal, error) { @@ -33,7 +25,7 @@ func (c Client) GetBalance(ctx context.Context, owner *owner.ID, opts ...CallOpt } } -func (c Client) getBalanceV2(ctx context.Context, owner *owner.ID, opts ...CallOption) (*accounting.Decimal, error) { +func (c Client) getBalanceV2(ctx context.Context, ownerID *owner.ID, opts ...CallOption) (*accounting.Decimal, error) { // apply all available options callOptions := c.defaultCallOptions() @@ -41,8 +33,18 @@ func (c Client) getBalanceV2(ctx context.Context, owner *owner.ID, opts ...CallO opts[i].apply(&callOptions) } + if ownerID == nil { + w, err := owner.NEO3WalletFromPublicKey(&c.key.PublicKey) + if err != nil { + return nil, err + } + + ownerID = new(owner.ID) + ownerID.SetNeo3Wallet(w) + } + reqBody := new(v2accounting.BalanceRequestBody) - reqBody.SetOwnerID(owner.ToV2()) + reqBody.SetOwnerID(ownerID.ToV2()) req := new(v2accounting.BalanceRequest) req.SetBody(reqBody) diff --git a/pkg/client/container.go b/pkg/client/container.go index 6c7ef73..4e7e6fa 100644 --- a/pkg/client/container.go +++ b/pkg/client/container.go @@ -94,15 +94,7 @@ func (c Client) ListContainers(ctx context.Context, owner *owner.ID, opts ...Cal } func (c Client) ListSelfContainers(ctx context.Context, opts ...CallOption) ([]*container.ID, error) { - w, err := owner.NEO3WalletFromPublicKey(&c.key.PublicKey) - if err != nil { - return nil, err - } - - ownerID := new(owner.ID) - ownerID.SetNeo3Wallet(w) - - return c.ListContainers(ctx, ownerID, opts...) + return c.ListContainers(ctx, nil, opts...) } func (c Client) DeleteContainer(ctx context.Context, id *container.ID, opts ...CallOption) error { @@ -282,7 +274,7 @@ func (c Client) getContainerV2(ctx context.Context, id *container.ID, opts ...Ca } } -func (c Client) listContainerV2(ctx context.Context, owner *owner.ID, opts ...CallOption) ([]*container.ID, error) { +func (c Client) listContainerV2(ctx context.Context, ownerID *owner.ID, opts ...CallOption) ([]*container.ID, error) { // apply all available options callOptions := c.defaultCallOptions() @@ -290,8 +282,18 @@ func (c Client) listContainerV2(ctx context.Context, owner *owner.ID, opts ...Ca opts[i].apply(&callOptions) } + if ownerID == nil { + w, err := owner.NEO3WalletFromPublicKey(&c.key.PublicKey) + if err != nil { + return nil, err + } + + ownerID = new(owner.ID) + ownerID.SetNeo3Wallet(w) + } + reqBody := new(v2container.ListRequestBody) - reqBody.SetOwnerID(owner.ToV2()) + reqBody.SetOwnerID(ownerID.ToV2()) req := new(v2container.ListRequest) req.SetBody(reqBody) From 64505180b400b30917649f4b54ac29748e949d41 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Wed, 10 Mar 2021 15:15:54 +0300 Subject: [PATCH 0689/1196] [#261] pkg/client: Provide signing key in call options Allow to reuse underlying connection for requests with different key. If no key is specified the one provided on client creation is used. Signed-off-by: Evgenii Stratonikov --- pkg/client/accounting.go | 4 ++-- pkg/client/container.go | 24 ++++++++++++------------ pkg/client/netmap.go | 4 ++-- pkg/client/object.go | 18 +++++++++--------- pkg/client/opts.go | 22 ++++++++++++++++++++++ pkg/client/session.go | 4 ++-- 6 files changed, 49 insertions(+), 27 deletions(-) diff --git a/pkg/client/accounting.go b/pkg/client/accounting.go index 9b3f129..99e520c 100644 --- a/pkg/client/accounting.go +++ b/pkg/client/accounting.go @@ -34,7 +34,7 @@ func (c Client) getBalanceV2(ctx context.Context, ownerID *owner.ID, opts ...Cal } if ownerID == nil { - w, err := owner.NEO3WalletFromPublicKey(&c.key.PublicKey) + w, err := owner.NEO3WalletFromPublicKey(&callOptions.key.PublicKey) if err != nil { return nil, err } @@ -50,7 +50,7 @@ func (c Client) getBalanceV2(ctx context.Context, ownerID *owner.ID, opts ...Cal req.SetBody(reqBody) req.SetMetaHeader(v2MetaHeaderFromOpts(callOptions)) - err := v2signature.SignServiceMessage(c.key, req) + err := v2signature.SignServiceMessage(callOptions.key, req) if err != nil { return nil, err } diff --git a/pkg/client/container.go b/pkg/client/container.go index 4e7e6fa..83ea657 100644 --- a/pkg/client/container.go +++ b/pkg/client/container.go @@ -172,7 +172,7 @@ func (c Client) putContainerV2(ctx context.Context, cnr *container.Container, op // if container owner is not set, then use client key as owner if cnr.OwnerID() == nil { - w, err := owner.NEO3WalletFromPublicKey(&c.key.PublicKey) + w, err := owner.NEO3WalletFromPublicKey(&callOptions.key.PublicKey) if err != nil { return nil, err } @@ -189,7 +189,7 @@ func (c Client) putContainerV2(ctx context.Context, cnr *container.Container, op // sign container signWrapper := v2signature.StableMarshalerWrapper{SM: reqBody.GetContainer()} - err := signature.SignDataWithHandler(c.key, signWrapper, func(key []byte, sig []byte) { + err := signature.SignDataWithHandler(callOptions.key, signWrapper, func(key []byte, sig []byte) { containerSignature := new(refs.Signature) containerSignature.SetKey(key) containerSignature.SetSign(sig) @@ -203,7 +203,7 @@ func (c Client) putContainerV2(ctx context.Context, cnr *container.Container, op req.SetBody(reqBody) req.SetMetaHeader(v2MetaHeaderFromOpts(callOptions)) - err = v2signature.SignServiceMessage(c.key, req) + err = v2signature.SignServiceMessage(callOptions.key, req) if err != nil { return nil, err } @@ -246,7 +246,7 @@ func (c Client) getContainerV2(ctx context.Context, id *container.ID, opts ...Ca req.SetBody(reqBody) req.SetMetaHeader(v2MetaHeaderFromOpts(callOptions)) - err := v2signature.SignServiceMessage(c.key, req) + err := v2signature.SignServiceMessage(callOptions.key, req) if err != nil { return nil, err } @@ -283,7 +283,7 @@ func (c Client) listContainerV2(ctx context.Context, ownerID *owner.ID, opts ... } if ownerID == nil { - w, err := owner.NEO3WalletFromPublicKey(&c.key.PublicKey) + w, err := owner.NEO3WalletFromPublicKey(&callOptions.key.PublicKey) if err != nil { return nil, err } @@ -299,7 +299,7 @@ func (c Client) listContainerV2(ctx context.Context, ownerID *owner.ID, opts ... req.SetBody(reqBody) req.SetMetaHeader(v2MetaHeaderFromOpts(callOptions)) - err := v2signature.SignServiceMessage(c.key, req) + err := v2signature.SignServiceMessage(callOptions.key, req) if err != nil { return nil, err } @@ -344,7 +344,7 @@ func (c Client) delContainerV2(ctx context.Context, id *container.ID, opts ...Ca reqBody.SetContainerID(id.ToV2()) // sign container - err := signature.SignDataWithHandler(c.key, + err := signature.SignDataWithHandler(callOptions.key, delContainerSignWrapper{ body: reqBody, }, @@ -363,7 +363,7 @@ func (c Client) delContainerV2(ctx context.Context, id *container.ID, opts ...Ca req.SetBody(reqBody) req.SetMetaHeader(v2MetaHeaderFromOpts(callOptions)) - err = v2signature.SignServiceMessage(c.key, req) + err = v2signature.SignServiceMessage(callOptions.key, req) if err != nil { return err } @@ -406,7 +406,7 @@ func (c Client) getEACLV2(ctx context.Context, id *container.ID, verify bool, op req.SetBody(reqBody) req.SetMetaHeader(v2MetaHeaderFromOpts(callOptions)) - err := v2signature.SignServiceMessage(c.key, req) + err := v2signature.SignServiceMessage(callOptions.key, req) if err != nil { return nil, err } @@ -469,7 +469,7 @@ func (c Client) setEACLV2(ctx context.Context, eacl *eacl.Table, opts ...CallOpt signWrapper := v2signature.StableMarshalerWrapper{SM: reqBody.GetEACL()} - err := signature.SignDataWithHandler(c.key, signWrapper, func(key []byte, sig []byte) { + err := signature.SignDataWithHandler(callOptions.key, signWrapper, func(key []byte, sig []byte) { eaclSignature := new(refs.Signature) eaclSignature.SetKey(key) eaclSignature.SetSign(sig) @@ -483,7 +483,7 @@ func (c Client) setEACLV2(ctx context.Context, eacl *eacl.Table, opts ...CallOpt req.SetBody(reqBody) req.SetMetaHeader(v2MetaHeaderFromOpts(callOptions)) - err = v2signature.SignServiceMessage(c.key, req) + err = v2signature.SignServiceMessage(callOptions.key, req) if err != nil { return err } @@ -536,7 +536,7 @@ func (c Client) announceContainerUsedSpaceV2( req.SetMetaHeader(v2MetaHeaderFromOpts(callOptions)) // sign the request - err := v2signature.SignServiceMessage(c.key, req) + err := v2signature.SignServiceMessage(callOptions.key, req) if err != nil { return err } diff --git a/pkg/client/netmap.go b/pkg/client/netmap.go index f45eb78..c440aa1 100644 --- a/pkg/client/netmap.go +++ b/pkg/client/netmap.go @@ -56,7 +56,7 @@ func (c Client) endpointInfoV2(ctx context.Context, opts ...CallOption) (*v2netm req.SetBody(reqBody) req.SetMetaHeader(v2MetaHeaderFromOpts(callOptions)) - err := v2signature.SignServiceMessage(c.key, req) + err := v2signature.SignServiceMessage(callOptions.key, req) if err != nil { return nil, err } @@ -144,7 +144,7 @@ func (c Client) networkInfoV2(ctx context.Context, opts ...CallOption) (*v2netma req.SetBody(reqBody) req.SetMetaHeader(v2MetaHeaderFromOpts(callOptions)) - err := v2signature.SignServiceMessage(c.key, req) + err := v2signature.SignServiceMessage(callOptions.key, req) if err != nil { return nil, err } diff --git a/pkg/client/object.go b/pkg/client/object.go index 7e84f72..7c07051 100644 --- a/pkg/client/object.go +++ b/pkg/client/object.go @@ -254,7 +254,7 @@ func (c *Client) putObjectV2(ctx context.Context, p *PutObjectParams, opts ...Ca initPart.SetHeader(obj.GetHeader()) // sign the request - if err := signature.SignServiceMessage(c.key, req); err != nil { + if err := signature.SignServiceMessage(callOpts.key, req); err != nil { return nil, errors.Wrapf(err, "could not sign %T", req) } @@ -274,7 +274,7 @@ func (c *Client) putObjectV2(ctx context.Context, p *PutObjectParams, opts ...Ca body.SetObjectPart(chunkPart) w := &putObjectV2Writer{ - key: c.key, + key: callOpts.key, chunkPart: chunkPart, req: req, stream: stream, @@ -415,7 +415,7 @@ func (c *Client) deleteObjectV2(ctx context.Context, p *DeleteObjectParams, opts body.SetAddress(p.addr.ToV2()) // sign the request - if err := signature.SignServiceMessage(c.key, req); err != nil { + if err := signature.SignServiceMessage(callOpts.key, req); err != nil { return nil, errors.Wrapf(err, "could not sign %T", req) } @@ -529,7 +529,7 @@ func (c *Client) getObjectV2(ctx context.Context, p *GetObjectParams, opts ...Ca body.SetRaw(p.raw) // sign the request - if err := signature.SignServiceMessage(c.key, req); err != nil { + if err := signature.SignServiceMessage(callOpts.key, req); err != nil { return nil, errors.Wrapf(err, "could not sign %T", req) } @@ -702,7 +702,7 @@ func (c *Client) getObjectHeaderV2(ctx context.Context, p *ObjectHeaderParams, o body.SetRaw(p.raw) // sign the request - if err := signature.SignServiceMessage(c.key, req); err != nil { + if err := signature.SignServiceMessage(callOpts.key, req); err != nil { return nil, errors.Wrapf(err, "could not sign %T", req) } @@ -899,7 +899,7 @@ func (c *Client) objectPayloadRangeV2(ctx context.Context, p *RangeDataParams, o body.SetRaw(p.raw) // sign the request - if err := signature.SignServiceMessage(c.key, req); err != nil { + if err := signature.SignServiceMessage(callOpts.key, req); err != nil { return nil, errors.Wrapf(err, "could not sign %T", req) } @@ -1081,7 +1081,7 @@ func (c *Client) objectPayloadRangeHashV2(ctx context.Context, p *RangeChecksumP body.SetRanges(rsV2) // sign the request - if err := signature.SignServiceMessage(c.key, req); err != nil { + if err := signature.SignServiceMessage(callOpts.key, req); err != nil { return nil, errors.Wrapf(err, "could not sign %T", req) } @@ -1228,7 +1228,7 @@ func (c *Client) searchObjectV2(ctx context.Context, p *SearchObjectParams, opts body.SetFilters(p.filters.ToV2()) // sign the request - if err := signature.SignServiceMessage(c.key, req); err != nil { + if err := signature.SignServiceMessage(callOpts.key, req); err != nil { return nil, errors.Wrapf(err, "could not sign %T", req) } @@ -1327,7 +1327,7 @@ func (c Client) attachV2SessionToken(opts callOptions, hdr *v2session.RequestMet signWrapper := signature.StableMarshalerWrapper{SM: token.GetBody()} - err := signer.SignDataWithHandler(c.key, signWrapper, func(key []byte, sig []byte) { + err := signer.SignDataWithHandler(opts.key, signWrapper, func(key []byte, sig []byte) { sessionTokenSignature := new(v2refs.Signature) sessionTokenSignature.SetKey(key) sessionTokenSignature.SetSign(sig) diff --git a/pkg/client/opts.go b/pkg/client/opts.go index 9e84665..7450d12 100644 --- a/pkg/client/opts.go +++ b/pkg/client/opts.go @@ -1,10 +1,12 @@ package client import ( + "crypto/ecdsa" "fmt" "time" "github.com/nspcc-dev/neofs-api-go/pkg" + "github.com/nspcc-dev/neofs-api-go/pkg/owner" "github.com/nspcc-dev/neofs-api-go/pkg/token" v2accounting "github.com/nspcc-dev/neofs-api-go/v2/accounting" v2container "github.com/nspcc-dev/neofs-api-go/v2/container" @@ -29,6 +31,7 @@ type ( xHeaders []*pkg.XHeader ttl uint32 epoch uint64 + key *ecdsa.PrivateKey session *token.SessionToken bearer *token.BearerToken } @@ -69,6 +72,7 @@ func (c Client) defaultCallOptions() callOptions { return callOptions{ ttl: 2, version: pkg.SDKVersion(), + key: c.key, session: c.sessionToken, bearer: c.bearerToken, } @@ -100,6 +104,13 @@ func WithTTL(ttl uint32) CallOption { }) } +// WithKey sets client's key for the next request. +func WithKey(key *ecdsa.PrivateKey) CallOption { + return newFuncCallOption(func(option *callOptions) { + option.key = key + }) +} + func WithEpoch(epoch uint64) CallOption { return newFuncCallOption(func(option *callOptions) { option.epoch = epoch @@ -178,3 +189,14 @@ func WithDialTimeout(dur time.Duration) Option { option.dialTimeout = dur }) } + +func newOwnerIDFromKey(key *ecdsa.PublicKey) (*owner.ID, error) { + w, err := owner.NEO3WalletFromPublicKey(key) + if err != nil { + return nil, err + } + + ownerID := new(owner.ID) + ownerID.SetNeo3Wallet(w) + return ownerID, nil +} diff --git a/pkg/client/session.go b/pkg/client/session.go index 769c517..6f368e1 100644 --- a/pkg/client/session.go +++ b/pkg/client/session.go @@ -30,7 +30,7 @@ func (c Client) createSessionV2(ctx context.Context, expiration uint64, opts ... opts[i].apply(&callOptions) } - w, err := owner.NEO3WalletFromPublicKey(&c.key.PublicKey) + w, err := owner.NEO3WalletFromPublicKey(&callOptions.key.PublicKey) if err != nil { return nil, err } @@ -46,7 +46,7 @@ func (c Client) createSessionV2(ctx context.Context, expiration uint64, opts ... req.SetBody(reqBody) req.SetMetaHeader(v2MetaHeaderFromOpts(callOptions)) - err = v2signature.SignServiceMessage(c.key, req) + err = v2signature.SignServiceMessage(callOptions.key, req) if err != nil { return nil, err } From 471c7e0df90d643b798cf37930a890b423175012 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Mon, 15 Mar 2021 10:39:48 +0300 Subject: [PATCH 0690/1196] v2: Regenerate protobuf files Protobuf definition has updated import path for C# library and new well-known object K-V header. Signed-off-by: Alex Vanin --- v2/accounting/grpc/service.pb.go | 9 +++++---- v2/accounting/grpc/types.pb.go | 9 +++++---- v2/acl/grpc/types.pb.go | 7 ++++--- v2/audit/grpc/types.pb.go | 8 ++++---- v2/container/grpc/service.pb.go | 7 ++++--- v2/container/grpc/types.pb.go | 8 ++++---- v2/netmap/grpc/service.pb.go | 9 +++++---- v2/netmap/grpc/types.pb.go | 7 ++++--- v2/object/grpc/service.pb.go | 7 ++++--- v2/object/grpc/types.pb.go | 10 ++++++---- v2/refs/grpc/types.pb.go | 7 ++++--- v2/session/grpc/service.pb.go | 7 ++++--- v2/session/grpc/types.pb.go | 8 ++++---- v2/storagegroup/grpc/types.pb.go | 8 ++++---- v2/tombstone/grpc/types.pb.go | 8 ++++---- 15 files changed, 65 insertions(+), 54 deletions(-) diff --git a/v2/accounting/grpc/service.pb.go b/v2/accounting/grpc/service.pb.go index 7e6a461..cdfce8c 100644 --- a/v2/accounting/grpc/service.pb.go +++ b/v2/accounting/grpc/service.pb.go @@ -330,13 +330,14 @@ var file_v2_accounting_grpc_service_proto_rawDesc = []byte{ 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, 0x5b, 0x5a, 0x3f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x62, 0x5a, 0x3f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 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, 0x17, 0x4e, 0x65, 0x6f, 0x46, 0x53, - 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x76, 0x32, 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x69, - 0x6e, 0x67, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 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, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, } var ( diff --git a/v2/accounting/grpc/types.pb.go b/v2/accounting/grpc/types.pb.go index 84ecf9f..d1a9428 100644 --- a/v2/accounting/grpc/types.pb.go +++ b/v2/accounting/grpc/types.pb.go @@ -100,13 +100,14 @@ var file_v2_accounting_grpc_types_proto_rawDesc = []byte{ 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, 0x5b, 0x5a, 0x3f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, + 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x42, 0x62, 0x5a, 0x3f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 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, 0x17, 0x4e, 0x65, 0x6f, 0x46, 0x53, - 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x76, 0x32, 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x69, - 0x6e, 0x67, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 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, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, } var ( diff --git a/v2/acl/grpc/types.pb.go b/v2/acl/grpc/types.pb.go index 052ceb2..319a472 100644 --- a/v2/acl/grpc/types.pb.go +++ b/v2/acl/grpc/types.pb.go @@ -929,12 +929,13 @@ var file_v2_acl_grpc_types_proto_rawDesc = []byte{ 0x3d, 0x0a, 0x0a, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x12, 0x48, 0x45, 0x41, 0x44, 0x45, 0x52, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x52, 0x45, 0x51, 0x55, 0x45, 0x53, 0x54, - 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x4f, 0x42, 0x4a, 0x45, 0x43, 0x54, 0x10, 0x02, 0x42, 0x46, + 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x4f, 0x42, 0x4a, 0x45, 0x43, 0x54, 0x10, 0x02, 0x42, 0x4d, 0x5a, 0x31, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x61, 0x63, 0x6c, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, - 0x61, 0x63, 0x6c, 0xaa, 0x02, 0x10, 0x4e, 0x65, 0x6f, 0x46, 0x53, 0x2e, 0x41, 0x50, 0x49, 0x2e, - 0x76, 0x32, 0x2e, 0x41, 0x63, 0x6c, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x61, 0x63, 0x6c, 0xaa, 0x02, 0x17, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, + 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x41, 0x63, 0x6c, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/v2/audit/grpc/types.pb.go b/v2/audit/grpc/types.pb.go index dddc441..e50e91a 100644 --- a/v2/audit/grpc/types.pb.go +++ b/v2/audit/grpc/types.pb.go @@ -236,13 +236,13 @@ var file_v2_audit_grpc_types_proto_rawDesc = []byte{ 0x1d, 0x0a, 0x0a, 0x70, 0x61, 0x73, 0x73, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x0d, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x09, 0x70, 0x61, 0x73, 0x73, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x66, 0x61, 0x69, 0x6c, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x0e, 0x20, 0x03, - 0x28, 0x0c, 0x52, 0x09, 0x66, 0x61, 0x69, 0x6c, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x42, 0x4c, 0x5a, + 0x28, 0x0c, 0x52, 0x09, 0x66, 0x61, 0x69, 0x6c, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x42, 0x53, 0x5a, 0x35, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x61, 0x75, 0x64, 0x69, 0x74, 0x2f, 0x67, 0x72, 0x70, 0x63, - 0x3b, 0x61, 0x75, 0x64, 0x69, 0x74, 0xaa, 0x02, 0x12, 0x4e, 0x65, 0x6f, 0x46, 0x53, 0x2e, 0x41, - 0x50, 0x49, 0x2e, 0x76, 0x32, 0x2e, 0x41, 0x75, 0x64, 0x69, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, + 0x3b, 0x61, 0x75, 0x64, 0x69, 0x74, 0xaa, 0x02, 0x19, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, + 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x41, 0x75, 0x64, + 0x69, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/v2/container/grpc/service.pb.go b/v2/container/grpc/service.pb.go index 88dbb48..b9d7b2c 100644 --- a/v2/container/grpc/service.pb.go +++ b/v2/container/grpc/service.pb.go @@ -2128,13 +2128,14 @@ var file_v2_container_grpc_service_proto_rawDesc = []byte{ 0x65, 0x64, 0x53, 0x70, 0x61, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2e, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x55, 0x73, 0x65, - 0x64, 0x53, 0x70, 0x61, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x58, + 0x64, 0x53, 0x70, 0x61, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x5f, 0x5a, 0x3d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 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, 0x16, 0x4e, 0x65, 0x6f, 0x46, 0x53, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x76, 0x32, 0x2e, 0x43, - 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 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, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/v2/container/grpc/types.pb.go b/v2/container/grpc/types.pb.go index 6639bc3..490a529 100644 --- a/v2/container/grpc/types.pb.go +++ b/v2/container/grpc/types.pb.go @@ -236,13 +236,13 @@ var file_v2_container_grpc_types_proto_rawDesc = []byte{ 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, - 0x58, 0x5a, 0x3d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, + 0x5f, 0x5a, 0x3d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 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, 0x16, 0x4e, 0x65, 0x6f, 0x46, 0x53, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x76, 0x32, 0x2e, - 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x33, + 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, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/v2/netmap/grpc/service.pb.go b/v2/netmap/grpc/service.pb.go index a56abe4..50a30d9 100644 --- a/v2/netmap/grpc/service.pb.go +++ b/v2/netmap/grpc/service.pb.go @@ -595,12 +595,13 @@ var file_v2_netmap_grpc_service_proto_rawDesc = []byte{ 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x25, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x42, 0x4f, 0x5a, 0x37, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, + 0x65, 0x42, 0x56, 0x5a, 0x37, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, - 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0xaa, 0x02, 0x13, 0x4e, - 0x65, 0x6f, 0x46, 0x53, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x65, 0x74, 0x6d, - 0x61, 0x70, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0xaa, 0x02, 0x1a, 0x4e, + 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, + 0x50, 0x49, 0x2e, 0x4e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, } var ( diff --git a/v2/netmap/grpc/types.pb.go b/v2/netmap/grpc/types.pb.go index 00cef87..ca9190e 100644 --- a/v2/netmap/grpc/types.pb.go +++ b/v2/netmap/grpc/types.pb.go @@ -866,12 +866,13 @@ var file_v2_netmap_grpc_types_proto_rawDesc = []byte{ 0x75, 0x73, 0x65, 0x12, 0x16, 0x0a, 0x12, 0x43, 0x4c, 0x41, 0x55, 0x53, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x53, 0x41, 0x4d, 0x45, 0x10, 0x01, 0x12, 0x0c, 0x0a, 0x08, 0x44, 0x49, 0x53, 0x54, 0x49, 0x4e, 0x43, - 0x54, 0x10, 0x02, 0x42, 0x4f, 0x5a, 0x37, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, + 0x54, 0x10, 0x02, 0x42, 0x56, 0x5a, 0x37, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0xaa, 0x02, - 0x13, 0x4e, 0x65, 0x6f, 0x46, 0x53, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x65, - 0x74, 0x6d, 0x61, 0x70, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x1a, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, + 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x4e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, } var ( diff --git a/v2/object/grpc/service.pb.go b/v2/object/grpc/service.pb.go index 81a9c41..4bcdb6d 100644 --- a/v2/object/grpc/service.pb.go +++ b/v2/object/grpc/service.pb.go @@ -2757,12 +2757,13 @@ var file_v2_object_grpc_service_proto_rawDesc = []byte{ 0x48, 0x61, 0x73, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x26, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x48, 0x61, 0x73, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x42, 0x4f, 0x5a, 0x37, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, + 0x6e, 0x73, 0x65, 0x42, 0x56, 0x5a, 0x37, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0xaa, 0x02, - 0x13, 0x4e, 0x65, 0x6f, 0x46, 0x53, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x76, 0x32, 0x2e, 0x4f, 0x62, - 0x6a, 0x65, 0x63, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x1a, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, + 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, } var ( diff --git a/v2/object/grpc/types.pb.go b/v2/object/grpc/types.pb.go index b7fdd95..6334877 100644 --- a/v2/object/grpc/types.pb.go +++ b/v2/object/grpc/types.pb.go @@ -566,6 +566,8 @@ func (x *SplitInfo) GetLink() *grpc.ObjectID { // File name to be associated with the object on saving // * Timestamp \ // User-defined local time of object creation in Unix Timestamp format +// * Content-Type \ +// MIME Content Type of object's payload // // For detailed description of each well-known attribute please see the // corresponding section in NeoFS Technical specification. @@ -853,13 +855,13 @@ var file_v2_object_grpc_types_proto_rawDesc = []byte{ 0x45, 0x44, 0x10, 0x00, 0x12, 0x10, 0x0a, 0x0c, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x5f, 0x45, 0x51, 0x55, 0x41, 0x4c, 0x10, 0x01, 0x12, 0x14, 0x0a, 0x10, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x45, 0x51, 0x55, 0x41, 0x4c, 0x10, 0x02, 0x12, 0x0f, 0x0a, 0x0b, - 0x4e, 0x4f, 0x54, 0x5f, 0x50, 0x52, 0x45, 0x53, 0x45, 0x4e, 0x54, 0x10, 0x03, 0x42, 0x4f, 0x5a, + 0x4e, 0x4f, 0x54, 0x5f, 0x50, 0x52, 0x45, 0x53, 0x45, 0x4e, 0x54, 0x10, 0x03, 0x42, 0x56, 0x5a, 0x37, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2f, 0x67, 0x72, 0x70, - 0x63, 0x3b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0xaa, 0x02, 0x13, 0x4e, 0x65, 0x6f, 0x46, 0x53, - 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x76, 0x32, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x62, 0x06, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x63, 0x3b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0xaa, 0x02, 0x1a, 0x4e, 0x65, 0x6f, 0x2e, 0x46, + 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x4f, + 0x62, 0x6a, 0x65, 0x63, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/v2/refs/grpc/types.pb.go b/v2/refs/grpc/types.pb.go index 55a80f4..16b10f6 100644 --- a/v2/refs/grpc/types.pb.go +++ b/v2/refs/grpc/types.pb.go @@ -548,12 +548,13 @@ var file_v2_refs_grpc_types_proto_rawDesc = []byte{ 0x54, 0x79, 0x70, 0x65, 0x12, 0x1d, 0x0a, 0x19, 0x43, 0x48, 0x45, 0x43, 0x4b, 0x53, 0x55, 0x4d, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x06, 0x0a, 0x02, 0x54, 0x5a, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x53, - 0x48, 0x41, 0x32, 0x35, 0x36, 0x10, 0x02, 0x42, 0x49, 0x5a, 0x33, 0x67, 0x69, 0x74, 0x68, 0x75, + 0x48, 0x41, 0x32, 0x35, 0x36, 0x10, 0x02, 0x42, 0x50, 0x5a, 0x33, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x72, 0x65, 0x66, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x72, 0x65, 0x66, 0x73, 0xaa, 0x02, - 0x11, 0x4e, 0x65, 0x6f, 0x46, 0x53, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x76, 0x32, 0x2e, 0x52, 0x65, - 0x66, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x18, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, + 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x52, 0x65, 0x66, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, } var ( diff --git a/v2/session/grpc/service.pb.go b/v2/session/grpc/service.pb.go index 223c38b..89e1437 100644 --- a/v2/session/grpc/service.pb.go +++ b/v2/session/grpc/service.pb.go @@ -340,12 +340,13 @@ var file_v2_session_grpc_service_proto_rawDesc = []byte{ 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, 0x52, 0x5a, 0x39, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, + 0x65, 0x42, 0x59, 0x5a, 0x39, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0xaa, 0x02, - 0x14, 0x4e, 0x65, 0x6f, 0x46, 0x53, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x76, 0x32, 0x2e, 0x53, 0x65, - 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 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, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/v2/session/grpc/types.pb.go b/v2/session/grpc/types.pb.go index aba3ceb..3c73d23 100644 --- a/v2/session/grpc/types.pb.go +++ b/v2/session/grpc/types.pb.go @@ -940,13 +940,13 @@ var file_v2_session_grpc_types_proto_rawDesc = []byte{ 0x04, 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, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x42, 0x52, 0x5a, 0x39, + 0x61, 0x64, 0x65, 0x72, 0x52, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x42, 0x59, 0x5a, 0x39, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2f, 0x67, 0x72, 0x70, - 0x63, 0x3b, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0xaa, 0x02, 0x14, 0x4e, 0x65, 0x6f, 0x46, - 0x53, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x76, 0x32, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, - 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 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, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/v2/storagegroup/grpc/types.pb.go b/v2/storagegroup/grpc/types.pb.go index ece2c37..6f4c644 100644 --- a/v2/storagegroup/grpc/types.pb.go +++ b/v2/storagegroup/grpc/types.pb.go @@ -129,14 +129,14 @@ var file_v2_storagegroup_grpc_types_proto_rawDesc = []byte{ 0x45, 0x70, 0x6f, 0x63, 0x68, 0x12, 0x32, 0x0a, 0x07, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x18, 0x04, 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, 0x61, 0x5a, 0x43, 0x67, 0x69, 0x74, + 0x52, 0x07, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x42, 0x68, 0x5a, 0x43, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x67, 0x72, 0x6f, 0x75, 0x70, - 0xaa, 0x02, 0x19, 0x4e, 0x65, 0x6f, 0x46, 0x53, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x76, 0x32, 0x2e, - 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x62, 0x06, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, + 0xaa, 0x02, 0x20, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, + 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x47, 0x72, + 0x6f, 0x75, 0x70, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/v2/tombstone/grpc/types.pb.go b/v2/tombstone/grpc/types.pb.go index c7a7dc0..75c0f6c 100644 --- a/v2/tombstone/grpc/types.pb.go +++ b/v2/tombstone/grpc/types.pb.go @@ -115,13 +115,13 @@ var file_v2_tombstone_grpc_types_proto_rawDesc = []byte{ 0x49, 0x44, 0x12, 0x32, 0x0a, 0x07, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x18, 0x03, 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, 0x58, 0x5a, 0x3d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, + 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x42, 0x5f, 0x5a, 0x3d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x74, 0x6f, 0x6d, 0x62, 0x73, 0x74, 0x6f, 0x6e, 0x65, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x74, 0x6f, - 0x6d, 0x62, 0x73, 0x74, 0x6f, 0x6e, 0x65, 0xaa, 0x02, 0x16, 0x4e, 0x65, 0x6f, 0x46, 0x53, 0x2e, - 0x41, 0x50, 0x49, 0x2e, 0x76, 0x32, 0x2e, 0x54, 0x6f, 0x6d, 0x62, 0x73, 0x74, 0x6f, 0x6e, 0x65, - 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6d, 0x62, 0x73, 0x74, 0x6f, 0x6e, 0x65, 0xaa, 0x02, 0x1d, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, + 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x54, 0x6f, + 0x6d, 0x62, 0x73, 0x74, 0x6f, 0x6e, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( From e39a1fd9497f9b1f6368af61af05f77795db2478 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Mon, 15 Mar 2021 10:47:13 +0300 Subject: [PATCH 0691/1196] pkg/object: Add content type constant Specification defined one more well-known object attribute `Content-Type`. Signed-off-by: Alex Vanin --- pkg/object/wellknown_attributes.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/object/wellknown_attributes.go b/pkg/object/wellknown_attributes.go index 423b5fb..9e1793e 100644 --- a/pkg/object/wellknown_attributes.go +++ b/pkg/object/wellknown_attributes.go @@ -12,4 +12,8 @@ const ( // AttributeTimestamp is an attribute key that is commonly used to denote // user-defined local time of object creation in Unix Timestamp format. AttributeTimestamp = "Timestamp" + + // AttributeTimestamp is an attribute key that is commonly used to denote + // MIME Content Type of object's payload. + AttributeContentType = "Content-Type" ) From ae2fb263f1f08d5c24adfb54988ca3bb930d774d Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Fri, 12 Mar 2021 18:02:26 +0300 Subject: [PATCH 0692/1196] [#266] pkg/client: Export `Client` interface instead of structure Make it easier to test API clients and mock specific methods. Also add comments on exported methods. Signed-off-by: Evgenii Stratonikov --- pkg/client/accounting.go | 14 +++++++--- pkg/client/client.go | 16 ++++++++--- pkg/client/container.go | 58 +++++++++++++++++++++++++++------------- pkg/client/netmap.go | 22 +++++++++++---- pkg/client/object.go | 56 +++++++++++++++++++++++++------------- pkg/client/opts.go | 2 +- pkg/client/session.go | 18 ++++++++++--- 7 files changed, 134 insertions(+), 52 deletions(-) diff --git a/pkg/client/accounting.go b/pkg/client/accounting.go index 99e520c..e9db7f1 100644 --- a/pkg/client/accounting.go +++ b/pkg/client/accounting.go @@ -11,11 +11,19 @@ import ( "github.com/pkg/errors" ) -func (c Client) GetSelfBalance(ctx context.Context, opts ...CallOption) (*accounting.Decimal, error) { +// Accounting contains methods related to balance querying. +type Accounting interface { + // GetSelfBalance returns balance of the account deduced from client's key. + GetSelfBalance(context.Context, ...CallOption) (*accounting.Decimal, error) + // GetBalance returns balance of provided account. + GetBalance(context.Context, *owner.ID, ...CallOption) (*accounting.Decimal, error) +} + +func (c clientImpl) GetSelfBalance(ctx context.Context, opts ...CallOption) (*accounting.Decimal, error) { return c.GetBalance(ctx, nil, opts...) } -func (c Client) GetBalance(ctx context.Context, owner *owner.ID, opts ...CallOption) (*accounting.Decimal, error) { +func (c clientImpl) GetBalance(ctx context.Context, owner *owner.ID, opts ...CallOption) (*accounting.Decimal, error) { // check remote node version switch c.remoteNode.Version.Major() { case 2: @@ -25,7 +33,7 @@ func (c Client) GetBalance(ctx context.Context, owner *owner.ID, opts ...CallOpt } } -func (c Client) getBalanceV2(ctx context.Context, ownerID *owner.ID, opts ...CallOption) (*accounting.Decimal, error) { +func (c clientImpl) getBalanceV2(ctx context.Context, ownerID *owner.ID, opts ...CallOption) (*accounting.Decimal, error) { // apply all available options callOptions := c.defaultCallOptions() diff --git a/pkg/client/client.go b/pkg/client/client.go index 94770d4..42bd454 100644 --- a/pkg/client/client.go +++ b/pkg/client/client.go @@ -9,7 +9,16 @@ import ( ) type ( - Client struct { + // Client represents NeoFS client. + Client interface { + Accounting + Container + Netmap + Object + Session + } + + clientImpl struct { key *ecdsa.PrivateKey remoteNode TransportInfo @@ -35,7 +44,8 @@ const ( var errUnsupportedProtocol = errors.New("unsupported transport protocol") -func New(key *ecdsa.PrivateKey, opts ...Option) (*Client, error) { +// New returns new client which uses key as default signing key. +func New(key *ecdsa.PrivateKey, opts ...Option) (Client, error) { clientOptions := defaultClientOptions() for i := range opts { @@ -43,7 +53,7 @@ func New(key *ecdsa.PrivateKey, opts ...Option) (*Client, error) { } // todo: make handshake to check latest version - return &Client{ + return &clientImpl{ key: key, remoteNode: TransportInfo{ Version: pkg.SDKVersion(), diff --git a/pkg/client/container.go b/pkg/client/container.go index 83ea657..1328028 100644 --- a/pkg/client/container.go +++ b/pkg/client/container.go @@ -15,6 +15,28 @@ import ( "github.com/pkg/errors" ) +// Container contains methods related to container and ACL. +type Container interface { + // PutContainer creates new container in the NeoFS network. + PutContainer(context.Context, *container.Container, ...CallOption) (*container.ID, error) + // GetContainer returns container by ID. + GetContainer(context.Context, *container.ID, ...CallOption) (*container.Container, error) + // ListContainers return container list with the provided owner. + ListContainers(context.Context, *owner.ID, ...CallOption) ([]*container.ID, error) + // ListSelfContainers is similar to ListContainers but uses client's key to deduce owner ID. + ListSelfContainers(context.Context, ...CallOption) ([]*container.ID, error) + // DeleteContainer removes container from NeoFS network. + DeleteContainer(context.Context, *container.ID, ...CallOption) error + // GetEACL returns extended ACL for a given container. + GetEACL(context.Context, *container.ID, ...CallOption) (*eacl.Table, error) + // GetEACLWithSignature is similar to GetEACL but returns signed ACL. + GetEACLWithSignature(context.Context, *container.ID, ...CallOption) (*EACLWithSignature, error) + // SetEACL sets extended ACL. + SetEACL(context.Context, *eacl.Table, ...CallOption) error + // AnnounceContainerUsedSpace announces amount of space which is taken by stored objects. + AnnounceContainerUsedSpace(context.Context, []container.UsedSpaceAnnouncement, ...CallOption) error +} + type delContainerSignWrapper struct { body *v2container.DeleteRequestBody } @@ -46,7 +68,7 @@ func (e EACLWithSignature) Signature() *pkg.Signature { return e.sig } -func (c Client) PutContainer(ctx context.Context, cnr *container.Container, opts ...CallOption) (*container.ID, error) { +func (c clientImpl) PutContainer(ctx context.Context, cnr *container.Container, opts ...CallOption) (*container.ID, error) { switch c.remoteNode.Version.Major() { case 2: return c.putContainerV2(ctx, cnr, opts...) @@ -58,7 +80,7 @@ func (c Client) PutContainer(ctx context.Context, cnr *container.Container, opts // GetContainer receives container structure through NeoFS API call. // // Returns error if container structure is received but does not meet NeoFS API specification. -func (c Client) GetContainer(ctx context.Context, id *container.ID, opts ...CallOption) (*container.Container, error) { +func (c clientImpl) GetContainer(ctx context.Context, id *container.ID, opts ...CallOption) (*container.Container, error) { switch c.remoteNode.Version.Major() { case 2: return c.getContainerV2(ctx, id, opts...) @@ -71,7 +93,7 @@ func (c Client) GetContainer(ctx context.Context, id *container.ID, opts ...Call // which checks if the structure of the resulting container matches its identifier. // // Returns container.ErrIDMismatch if container does not match the identifier. -func GetVerifiedContainerStructure(ctx context.Context, c *Client, id *container.ID, opts ...CallOption) (*container.Container, error) { +func GetVerifiedContainerStructure(ctx context.Context, c Client, id *container.ID, opts ...CallOption) (*container.Container, error) { cnr, err := c.GetContainer(ctx, id, opts...) if err != nil { return nil, err @@ -84,7 +106,7 @@ func GetVerifiedContainerStructure(ctx context.Context, c *Client, id *container return cnr, nil } -func (c Client) ListContainers(ctx context.Context, owner *owner.ID, opts ...CallOption) ([]*container.ID, error) { +func (c clientImpl) ListContainers(ctx context.Context, owner *owner.ID, opts ...CallOption) ([]*container.ID, error) { switch c.remoteNode.Version.Major() { case 2: return c.listContainerV2(ctx, owner, opts...) @@ -93,11 +115,11 @@ func (c Client) ListContainers(ctx context.Context, owner *owner.ID, opts ...Cal } } -func (c Client) ListSelfContainers(ctx context.Context, opts ...CallOption) ([]*container.ID, error) { +func (c clientImpl) ListSelfContainers(ctx context.Context, opts ...CallOption) ([]*container.ID, error) { return c.ListContainers(ctx, nil, opts...) } -func (c Client) DeleteContainer(ctx context.Context, id *container.ID, opts ...CallOption) error { +func (c clientImpl) DeleteContainer(ctx context.Context, id *container.ID, opts ...CallOption) error { switch c.remoteNode.Version.Major() { case 2: return c.delContainerV2(ctx, id, opts...) @@ -106,7 +128,7 @@ func (c Client) DeleteContainer(ctx context.Context, id *container.ID, opts ...C } } -func (c Client) GetEACL(ctx context.Context, id *container.ID, opts ...CallOption) (*eacl.Table, error) { +func (c clientImpl) GetEACL(ctx context.Context, id *container.ID, opts ...CallOption) (*eacl.Table, error) { v, err := c.getEACL(ctx, id, true, opts...) if err != nil { return nil, err @@ -115,11 +137,11 @@ func (c Client) GetEACL(ctx context.Context, id *container.ID, opts ...CallOptio return v.table, nil } -func (c Client) GetEACLWithSignature(ctx context.Context, id *container.ID, opts ...CallOption) (*EACLWithSignature, error) { +func (c clientImpl) GetEACLWithSignature(ctx context.Context, id *container.ID, opts ...CallOption) (*EACLWithSignature, error) { return c.getEACL(ctx, id, false, opts...) } -func (c Client) getEACL(ctx context.Context, id *container.ID, verify bool, opts ...CallOption) (*EACLWithSignature, error) { +func (c clientImpl) getEACL(ctx context.Context, id *container.ID, verify bool, opts ...CallOption) (*EACLWithSignature, error) { switch c.remoteNode.Version.Major() { case 2: resp, err := c.getEACLV2(ctx, id, verify, opts...) @@ -136,7 +158,7 @@ func (c Client) getEACL(ctx context.Context, id *container.ID, verify bool, opts } } -func (c Client) SetEACL(ctx context.Context, eacl *eacl.Table, opts ...CallOption) error { +func (c clientImpl) SetEACL(ctx context.Context, eacl *eacl.Table, opts ...CallOption) error { switch c.remoteNode.Version.Major() { case 2: return c.setEACLV2(ctx, eacl, opts...) @@ -147,7 +169,7 @@ func (c Client) SetEACL(ctx context.Context, eacl *eacl.Table, opts ...CallOptio // AnnounceContainerUsedSpace used by storage nodes to estimate their container // sizes during lifetime. Use it only in storage node applications. -func (c Client) AnnounceContainerUsedSpace( +func (c clientImpl) AnnounceContainerUsedSpace( ctx context.Context, announce []container.UsedSpaceAnnouncement, opts ...CallOption) error { @@ -159,7 +181,7 @@ func (c Client) AnnounceContainerUsedSpace( } } -func (c Client) putContainerV2(ctx context.Context, cnr *container.Container, opts ...CallOption) (*container.ID, error) { +func (c clientImpl) putContainerV2(ctx context.Context, cnr *container.Container, opts ...CallOption) (*container.ID, error) { // apply all available options callOptions := c.defaultCallOptions() @@ -231,7 +253,7 @@ func (c Client) putContainerV2(ctx context.Context, cnr *container.Container, op } } -func (c Client) getContainerV2(ctx context.Context, id *container.ID, opts ...CallOption) (*container.Container, error) { +func (c clientImpl) getContainerV2(ctx context.Context, id *container.ID, opts ...CallOption) (*container.Container, error) { // apply all available options callOptions := c.defaultCallOptions() @@ -274,7 +296,7 @@ func (c Client) getContainerV2(ctx context.Context, id *container.ID, opts ...Ca } } -func (c Client) listContainerV2(ctx context.Context, ownerID *owner.ID, opts ...CallOption) ([]*container.ID, error) { +func (c clientImpl) listContainerV2(ctx context.Context, ownerID *owner.ID, opts ...CallOption) ([]*container.ID, error) { // apply all available options callOptions := c.defaultCallOptions() @@ -332,7 +354,7 @@ func (c Client) listContainerV2(ctx context.Context, ownerID *owner.ID, opts ... } } -func (c Client) delContainerV2(ctx context.Context, id *container.ID, opts ...CallOption) error { +func (c clientImpl) delContainerV2(ctx context.Context, id *container.ID, opts ...CallOption) error { // apply all available options callOptions := c.defaultCallOptions() @@ -391,7 +413,7 @@ func (c Client) delContainerV2(ctx context.Context, id *container.ID, opts ...Ca } } -func (c Client) getEACLV2(ctx context.Context, id *container.ID, verify bool, opts ...CallOption) (*v2container.GetExtendedACLResponseBody, error) { +func (c clientImpl) getEACLV2(ctx context.Context, id *container.ID, verify bool, opts ...CallOption) (*v2container.GetExtendedACLResponseBody, error) { // apply all available options callOptions := c.defaultCallOptions() @@ -455,7 +477,7 @@ func (c Client) getEACLV2(ctx context.Context, id *container.ID, verify bool, op } } -func (c Client) setEACLV2(ctx context.Context, eacl *eacl.Table, opts ...CallOption) error { +func (c clientImpl) setEACLV2(ctx context.Context, eacl *eacl.Table, opts ...CallOption) error { // apply all available options callOptions := c.defaultCallOptions() @@ -511,7 +533,7 @@ func (c Client) setEACLV2(ctx context.Context, eacl *eacl.Table, opts ...CallOpt } } -func (c Client) announceContainerUsedSpaceV2( +func (c clientImpl) announceContainerUsedSpaceV2( ctx context.Context, announce []container.UsedSpaceAnnouncement, opts ...CallOption) error { diff --git a/pkg/client/netmap.go b/pkg/client/netmap.go index c440aa1..b3f8966 100644 --- a/pkg/client/netmap.go +++ b/pkg/client/netmap.go @@ -10,10 +10,22 @@ import ( "github.com/pkg/errors" ) +// Netmap contains methods related to netmap. +type Netmap interface { + // EndpointInfo returns attributes, address and public key of the node, specified + // in client constructor via address or open connection. This can be used as a + // health check to see if node is alive and responses to requests. + EndpointInfo(context.Context, ...CallOption) (*netmap.NodeInfo, error) + // Epoch returns the epoch number from the local state of the remote host. + Epoch(context.Context, ...CallOption) (uint64, error) + // NetworkInfo returns information about the NeoFS network of which the remote server is a part. + NetworkInfo(context.Context, ...CallOption) (*netmap.NetworkInfo, error) +} + // EndpointInfo returns attributes, address and public key of the node, specified // in client constructor via address or open connection. This can be used as a // health check to see if node is alive and responses to requests. -func (c Client) EndpointInfo(ctx context.Context, opts ...CallOption) (*netmap.NodeInfo, error) { +func (c clientImpl) EndpointInfo(ctx context.Context, opts ...CallOption) (*netmap.NodeInfo, error) { switch c.remoteNode.Version.Major() { case 2: resp, err := c.endpointInfoV2(ctx, opts...) @@ -28,7 +40,7 @@ func (c Client) EndpointInfo(ctx context.Context, opts ...CallOption) (*netmap.N } // Epoch returns the epoch number from the local state of the remote host. -func (c Client) Epoch(ctx context.Context, opts ...CallOption) (uint64, error) { +func (c clientImpl) Epoch(ctx context.Context, opts ...CallOption) (uint64, error) { switch c.remoteNode.Version.Major() { case 2: resp, err := c.endpointInfoV2(ctx, opts...) @@ -42,7 +54,7 @@ func (c Client) Epoch(ctx context.Context, opts ...CallOption) (uint64, error) { } } -func (c Client) endpointInfoV2(ctx context.Context, opts ...CallOption) (*v2netmap.LocalNodeInfoResponse, error) { +func (c clientImpl) endpointInfoV2(ctx context.Context, opts ...CallOption) (*v2netmap.LocalNodeInfoResponse, error) { // apply all available options callOptions := c.defaultCallOptions() @@ -116,7 +128,7 @@ func v2NetmapClientFromOptions(opts *clientOptions) (cli *v2netmap.Client, err e } // NetworkInfo returns information about the NeoFS network of which the remote server is a part. -func (c Client) NetworkInfo(ctx context.Context, opts ...CallOption) (*netmap.NetworkInfo, error) { +func (c clientImpl) NetworkInfo(ctx context.Context, opts ...CallOption) (*netmap.NetworkInfo, error) { switch c.remoteNode.Version.Major() { case 2: resp, err := c.networkInfoV2(ctx, opts...) @@ -130,7 +142,7 @@ func (c Client) NetworkInfo(ctx context.Context, opts ...CallOption) (*netmap.Ne } } -func (c Client) networkInfoV2(ctx context.Context, opts ...CallOption) (*v2netmap.NetworkInfoResponse, error) { +func (c clientImpl) networkInfoV2(ctx context.Context, opts ...CallOption) (*v2netmap.NetworkInfoResponse, error) { // apply all available options callOptions := c.defaultCallOptions() diff --git a/pkg/client/object.go b/pkg/client/object.go index 7c07051..62f99cf 100644 --- a/pkg/client/object.go +++ b/pkg/client/object.go @@ -19,6 +19,26 @@ import ( "github.com/pkg/errors" ) +// Object contains methods for working with objects. +type Object interface { + // PutObject puts new object to NeoFS. + PutObject(context.Context, *PutObjectParams, ...CallOption) (*object.ID, error) + // DeleteObject deletes object to NeoFS. + DeleteObject(context.Context, *DeleteObjectParams, ...CallOption) error + // GetObject returns object stored in NeoFS. + GetObject(context.Context, *GetObjectParams, ...CallOption) (*object.Object, error) + // GetObjectHeader returns object header. + GetObjectHeader(context.Context, *ObjectHeaderParams, ...CallOption) (*object.Object, error) + // ObjectPayloadRangeData returns range of object payload. + ObjectPayloadRangeData(context.Context, *RangeDataParams, ...CallOption) ([]byte, error) + // ObjectPayloadRangeSHA256 returns sha-256 hashes of object sub-ranges from NeoFS. + ObjectPayloadRangeSHA256(context.Context, *RangeChecksumParams, ...CallOption) ([][sha256.Size]byte, error) + // ObjectPayloadRangeTZ returns homomorphic hashes of object sub-ranges from NeoFS. + ObjectPayloadRangeTZ(context.Context, *RangeChecksumParams, ...CallOption) ([][TZSize]byte, error) + // SearchObject searches for objects in NeoFS using provided parameters. + SearchObject(context.Context, *SearchObjectParams, ...CallOption) ([]*object.ID, error) +} + type PutObjectParams struct { obj *object.Object @@ -190,7 +210,7 @@ func (p *PutObjectParams) PayloadReader() io.Reader { return nil } -func (c *Client) PutObject(ctx context.Context, p *PutObjectParams, opts ...CallOption) (*object.ID, error) { +func (c *clientImpl) PutObject(ctx context.Context, p *PutObjectParams, opts ...CallOption) (*object.ID, error) { // check remote node version switch c.remoteNode.Version.Major() { case 2: @@ -200,7 +220,7 @@ func (c *Client) PutObject(ctx context.Context, p *PutObjectParams, opts ...Call } } -func (c *Client) putObjectV2(ctx context.Context, p *PutObjectParams, opts ...CallOption) (*object.ID, error) { +func (c *clientImpl) putObjectV2(ctx context.Context, p *PutObjectParams, opts ...CallOption) (*object.ID, error) { // create V2 Object client cli, err := v2ObjectClient(c.remoteNode.Protocol, c.opts) if err != nil { @@ -342,7 +362,7 @@ func (p *DeleteObjectParams) TombstoneAddressTarget() ObjectAddressWriter { // DeleteObject is a wrapper over Client.DeleteObject method // that provides the ability to receive tombstone address // without setting a target in the parameters. -func DeleteObject(ctx context.Context, c *Client, p *DeleteObjectParams, opts ...CallOption) (*object.Address, error) { +func DeleteObject(ctx context.Context, c Client, p *DeleteObjectParams, opts ...CallOption) (*object.Address, error) { w := new(objectAddressWriter) err := c.DeleteObject(ctx, p.WithTombstoneAddressTarget(w), opts...) @@ -356,7 +376,7 @@ func DeleteObject(ctx context.Context, c *Client, p *DeleteObjectParams, opts .. // DeleteObject removes object by address. // // If target of tombstone address is not set, the address is ignored. -func (c *Client) DeleteObject(ctx context.Context, p *DeleteObjectParams, opts ...CallOption) error { +func (c *clientImpl) DeleteObject(ctx context.Context, p *DeleteObjectParams, opts ...CallOption) error { // check remote node version switch c.remoteNode.Version.Major() { case 2: @@ -378,7 +398,7 @@ func (c *Client) DeleteObject(ctx context.Context, p *DeleteObjectParams, opts . } } -func (c *Client) deleteObjectV2(ctx context.Context, p *DeleteObjectParams, opts ...CallOption) (*v2object.DeleteResponse, error) { +func (c *clientImpl) deleteObjectV2(ctx context.Context, p *DeleteObjectParams, opts ...CallOption) (*v2object.DeleteResponse, error) { // create V2 Object client cli, err := v2ObjectClient(c.remoteNode.Protocol, c.opts) if err != nil { @@ -481,7 +501,7 @@ func (p *GetObjectParams) RawFlag() bool { return false } -func (c *Client) GetObject(ctx context.Context, p *GetObjectParams, opts ...CallOption) (*object.Object, error) { +func (c *clientImpl) GetObject(ctx context.Context, p *GetObjectParams, opts ...CallOption) (*object.Object, error) { // check remote node version switch c.remoteNode.Version.Major() { case 2: @@ -491,7 +511,7 @@ func (c *Client) GetObject(ctx context.Context, p *GetObjectParams, opts ...Call } } -func (c *Client) getObjectV2(ctx context.Context, p *GetObjectParams, opts ...CallOption) (*object.Object, error) { +func (c *clientImpl) getObjectV2(ctx context.Context, p *GetObjectParams, opts ...CallOption) (*object.Object, error) { // create V2 Object client cli, err := v2ObjectClient(c.remoteNode.Protocol, c.opts) if err != nil { @@ -653,7 +673,7 @@ func (p *ObjectHeaderParams) RawFlag() bool { return false } -func (c *Client) GetObjectHeader(ctx context.Context, p *ObjectHeaderParams, opts ...CallOption) (*object.Object, error) { +func (c *clientImpl) GetObjectHeader(ctx context.Context, p *ObjectHeaderParams, opts ...CallOption) (*object.Object, error) { // check remote node version switch c.remoteNode.Version.Major() { case 2: @@ -663,7 +683,7 @@ func (c *Client) GetObjectHeader(ctx context.Context, p *ObjectHeaderParams, opt } } -func (c *Client) getObjectHeaderV2(ctx context.Context, p *ObjectHeaderParams, opts ...CallOption) (*object.Object, error) { +func (c *clientImpl) getObjectHeaderV2(ctx context.Context, p *ObjectHeaderParams, opts ...CallOption) (*object.Object, error) { // create V2 Object client cli, err := v2ObjectClient(c.remoteNode.Protocol, c.opts) if err != nil { @@ -850,7 +870,7 @@ func (p *RangeDataParams) DataWriter() io.Writer { return nil } -func (c *Client) ObjectPayloadRangeData(ctx context.Context, p *RangeDataParams, opts ...CallOption) ([]byte, error) { +func (c *clientImpl) ObjectPayloadRangeData(ctx context.Context, p *RangeDataParams, opts ...CallOption) ([]byte, error) { // check remote node version switch c.remoteNode.Version.Major() { case 2: @@ -860,7 +880,7 @@ func (c *Client) ObjectPayloadRangeData(ctx context.Context, p *RangeDataParams, } } -func (c *Client) objectPayloadRangeV2(ctx context.Context, p *RangeDataParams, opts ...CallOption) ([]byte, error) { +func (c *clientImpl) objectPayloadRangeV2(ctx context.Context, p *RangeDataParams, opts ...CallOption) ([]byte, error) { // create V2 Object client cli, err := v2ObjectClient(c.remoteNode.Protocol, c.opts) if err != nil { @@ -1009,7 +1029,7 @@ func (p *RangeChecksumParams) withChecksumType(t checksumType) *RangeChecksumPar return p } -func (c *Client) ObjectPayloadRangeSHA256(ctx context.Context, p *RangeChecksumParams, opts ...CallOption) ([][sha256.Size]byte, error) { +func (c *clientImpl) ObjectPayloadRangeSHA256(ctx context.Context, p *RangeChecksumParams, opts ...CallOption) ([][sha256.Size]byte, error) { res, err := c.objectPayloadRangeHash(ctx, p.withChecksumType(checksumSHA256), opts...) if err != nil { return nil, err @@ -1018,7 +1038,7 @@ func (c *Client) ObjectPayloadRangeSHA256(ctx context.Context, p *RangeChecksumP return res.([][sha256.Size]byte), nil } -func (c *Client) ObjectPayloadRangeTZ(ctx context.Context, p *RangeChecksumParams, opts ...CallOption) ([][TZSize]byte, error) { +func (c *clientImpl) ObjectPayloadRangeTZ(ctx context.Context, p *RangeChecksumParams, opts ...CallOption) ([][TZSize]byte, error) { res, err := c.objectPayloadRangeHash(ctx, p.withChecksumType(checksumTZ), opts...) if err != nil { return nil, err @@ -1027,7 +1047,7 @@ func (c *Client) ObjectPayloadRangeTZ(ctx context.Context, p *RangeChecksumParam return res.([][TZSize]byte), nil } -func (c *Client) objectPayloadRangeHash(ctx context.Context, p *RangeChecksumParams, opts ...CallOption) (interface{}, error) { +func (c *clientImpl) objectPayloadRangeHash(ctx context.Context, p *RangeChecksumParams, opts ...CallOption) (interface{}, error) { // check remote node version switch c.remoteNode.Version.Major() { case 2: @@ -1037,7 +1057,7 @@ func (c *Client) objectPayloadRangeHash(ctx context.Context, p *RangeChecksumPar } } -func (c *Client) objectPayloadRangeHashV2(ctx context.Context, p *RangeChecksumParams, opts ...CallOption) (interface{}, error) { +func (c *clientImpl) objectPayloadRangeHashV2(ctx context.Context, p *RangeChecksumParams, opts ...CallOption) (interface{}, error) { // create V2 Object client cli, err := v2ObjectClient(c.remoteNode.Protocol, c.opts) if err != nil { @@ -1176,7 +1196,7 @@ func (p *SearchObjectParams) SearchFilters() object.SearchFilters { return nil } -func (c *Client) SearchObject(ctx context.Context, p *SearchObjectParams, opts ...CallOption) ([]*object.ID, error) { +func (c *clientImpl) SearchObject(ctx context.Context, p *SearchObjectParams, opts ...CallOption) ([]*object.ID, error) { // check remote node version switch c.remoteNode.Version.Major() { case 2: @@ -1186,7 +1206,7 @@ func (c *Client) SearchObject(ctx context.Context, p *SearchObjectParams, opts . } } -func (c *Client) searchObjectV2(ctx context.Context, p *SearchObjectParams, opts ...CallOption) ([]*object.ID, error) { +func (c *clientImpl) searchObjectV2(ctx context.Context, p *SearchObjectParams, opts ...CallOption) ([]*object.ID, error) { // create V2 Object client cli, err := v2ObjectClient(c.remoteNode.Protocol, c.opts) if err != nil { @@ -1297,7 +1317,7 @@ func v2ObjectClient(proto TransportProtocol, opts *clientOptions) (*v2object.Cli } } -func (c Client) attachV2SessionToken(opts callOptions, hdr *v2session.RequestMetaHeader, info v2SessionReqInfo) error { +func (c clientImpl) attachV2SessionToken(opts callOptions, hdr *v2session.RequestMetaHeader, info v2SessionReqInfo) error { if opts.session == nil { return nil } diff --git a/pkg/client/opts.go b/pkg/client/opts.go index 7450d12..9f16888 100644 --- a/pkg/client/opts.go +++ b/pkg/client/opts.go @@ -68,7 +68,7 @@ func (e errOptionsLack) Error() string { return fmt.Sprintf("lack of sdk client options to create %s client", string(e)) } -func (c Client) defaultCallOptions() callOptions { +func (c clientImpl) defaultCallOptions() callOptions { return callOptions{ ttl: 2, version: pkg.SDKVersion(), diff --git a/pkg/client/session.go b/pkg/client/session.go index 6f368e1..4df7263 100644 --- a/pkg/client/session.go +++ b/pkg/client/session.go @@ -11,9 +11,19 @@ import ( "github.com/pkg/errors" ) +// Session contains session-related methods. +type Session interface { + // CreateSession creates session using provided expiration time. + CreateSession(context.Context, uint64, ...CallOption) (*token.SessionToken, error) + // AttachSessionToken attaches session token to be used by default for following requests. + AttachSessionToken(*token.SessionToken) + // AttachBearerToken attaches bearer token to be used by default for following requests. + AttachBearerToken(*token.BearerToken) +} + var errMalformedResponseBody = errors.New("malformed response body") -func (c Client) CreateSession(ctx context.Context, expiration uint64, opts ...CallOption) (*token.SessionToken, error) { +func (c clientImpl) CreateSession(ctx context.Context, expiration uint64, opts ...CallOption) (*token.SessionToken, error) { switch c.remoteNode.Version.Major() { case 2: return c.createSessionV2(ctx, expiration, opts...) @@ -22,7 +32,7 @@ func (c Client) CreateSession(ctx context.Context, expiration uint64, opts ...Ca } } -func (c Client) createSessionV2(ctx context.Context, expiration uint64, opts ...CallOption) (*token.SessionToken, error) { +func (c clientImpl) createSessionV2(ctx context.Context, expiration uint64, opts ...CallOption) (*token.SessionToken, error) { // apply all available options callOptions := c.defaultCallOptions() @@ -119,7 +129,7 @@ func v2SessionClientFromOptions(opts *clientOptions) (cli *v2session.Client, err // // Provided token is attached to all requests without WithSession option. // Use WithSession(nil) option in order to send request without session token. -func (c *Client) AttachSessionToken(token *token.SessionToken) { +func (c *clientImpl) AttachSessionToken(token *token.SessionToken) { c.sessionToken = token } @@ -127,6 +137,6 @@ func (c *Client) AttachSessionToken(token *token.SessionToken) { // // Provided bearer is attached to all requests without WithBearer option. // Use WithBearer(nil) option in order to send request without bearer token. -func (c *Client) AttachBearerToken(token *token.BearerToken) { +func (c *clientImpl) AttachBearerToken(token *token.BearerToken) { c.bearerToken = token } From cf765a61a6a502cca1aae5d318d93dff59586209 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 12 Mar 2021 14:17:16 +0300 Subject: [PATCH 0693/1196] [#263] Implement client for exchanging raw messages using gRPC protocol Implement gRPC client that can uniformly execute any RPC on the remote server. In the primary implementation, the client is a thin wrapper over gRPC client connection that is required to create the client. In the future, it is planned to expand the library with convenient functionality. Signed-off-by: Leonard Lyubich --- rpc/common/call.go | 75 ++++++++++++++++++++++++++++++++++++++++ rpc/common/call_test.go | 49 ++++++++++++++++++++++++++ rpc/grpc/call_options.go | 25 ++++++++++++++ rpc/grpc/client.go | 23 ++++++++++++ rpc/grpc/init.go | 65 ++++++++++++++++++++++++++++++++++ rpc/grpc/options.go | 21 +++++++++++ rpc/grpc/util.go | 13 +++++++ 7 files changed, 271 insertions(+) create mode 100644 rpc/common/call.go create mode 100644 rpc/common/call_test.go create mode 100644 rpc/grpc/call_options.go create mode 100644 rpc/grpc/client.go create mode 100644 rpc/grpc/init.go create mode 100644 rpc/grpc/options.go create mode 100644 rpc/grpc/util.go diff --git a/rpc/common/call.go b/rpc/common/call.go new file mode 100644 index 0000000..bc3410a --- /dev/null +++ b/rpc/common/call.go @@ -0,0 +1,75 @@ +package common + +type callType uint8 + +const ( + _ callType = iota + callUnary + callClientStream + callServerStream + callBidirStream +) + +// CallMethodInfo is an information about the RPC. +type CallMethodInfo struct { + // Name of the service. + Service string + + // Name of the RPC. + Name string + + t callType +} + +// ServerStream checks if CallMethodInfo contains +// information about the server-side streaming RPC. +func (c CallMethodInfo) ServerStream() bool { + return c.t == callServerStream || c.t == callBidirStream +} + +// ClientStream checks if CallMethodInfo contains +// information about the client-side streaming RPC. +func (c CallMethodInfo) ClientStream() bool { + return c.t == callClientStream || c.t == callBidirStream +} + +func (c *CallMethodInfo) setCommon(service, name string) { + c.Service = service + c.Name = name +} + +// CallMethodInfoUnary returns CallMethodInfo structure +// initialized for the unary RPC. +func CallMethodInfoUnary(service, name string) (info CallMethodInfo) { + info.setCommon(service, name) + info.t = callUnary + + return +} + +// CallMethodInfoClientStream returns CallMethodInfo structure +// initialized for the client-side streaming RPC. +func CallMethodInfoClientStream(service, name string) (info CallMethodInfo) { + info.setCommon(service, name) + info.t = callClientStream + + return +} + +// CallMethodInfoServerStream returns CallMethodInfo structure +// initialized for the server-side streaming RPC. +func CallMethodInfoServerStream(service, name string) (info CallMethodInfo) { + info.setCommon(service, name) + info.t = callServerStream + + return +} + +// CallMethodInfoBidirectionalStream returns CallMethodInfo structure +// initialized for the bidirectional streaming RPC. +func CallMethodInfoBidirectionalStream(service, name string) (info CallMethodInfo) { + info.setCommon(service, name) + info.t = callBidirStream + + return +} diff --git a/rpc/common/call_test.go b/rpc/common/call_test.go new file mode 100644 index 0000000..e1414e3 --- /dev/null +++ b/rpc/common/call_test.go @@ -0,0 +1,49 @@ +package common_test + +import ( + "testing" + + "github.com/nspcc-dev/neofs-api-go/rpc/common" + "github.com/stretchr/testify/require" +) + +const ( + testServiceName = "test service" + testRPCName = "test RPC" +) + +func TestCallMethodInfoUnary(t *testing.T) { + i := common.CallMethodInfoUnary(testServiceName, testRPCName) + + require.Equal(t, testServiceName, i.Service) + require.Equal(t, testRPCName, i.Name) + require.False(t, i.ClientStream()) + require.False(t, i.ServerStream()) +} + +func TestCallMethodInfoServerStream(t *testing.T) { + i := common.CallMethodInfoServerStream(testServiceName, testRPCName) + + require.Equal(t, testServiceName, i.Service) + require.Equal(t, testRPCName, i.Name) + require.False(t, i.ClientStream()) + require.True(t, i.ServerStream()) +} + +func TestCallMethodInfoClientStream(t *testing.T) { + i := common.CallMethodInfoClientStream(testServiceName, testRPCName) + + require.Equal(t, testServiceName, i.Service) + require.Equal(t, testRPCName, i.Name) + require.True(t, i.ClientStream()) + require.False(t, i.ServerStream()) +} + +func TestCallMethodInfoBidirectionalStream(t *testing.T) { + i := common.CallMethodInfoBidirectionalStream(testServiceName, testRPCName) + + require.Equal(t, testServiceName, i.Service) + require.Equal(t, testRPCName, i.Name) + require.True(t, i.ClientStream()) + require.True(t, i.ServerStream()) +} diff --git a/rpc/grpc/call_options.go b/rpc/grpc/call_options.go new file mode 100644 index 0000000..6faf019 --- /dev/null +++ b/rpc/grpc/call_options.go @@ -0,0 +1,25 @@ +package grpc + +import ( + "context" +) + +// CallOption is a messaging session option within RPC. +type CallOption func(*callParameters) + +type callParameters struct { + ctx context.Context +} + +func defaultCallParameters() *callParameters { + return &callParameters{ + ctx: context.Background(), + } +} + +// WithContext returns option to set RPC context. +func WithContext(ctx context.Context) CallOption { + return func(prm *callParameters) { + prm.ctx = ctx + } +} diff --git a/rpc/grpc/client.go b/rpc/grpc/client.go new file mode 100644 index 0000000..82df2ce --- /dev/null +++ b/rpc/grpc/client.go @@ -0,0 +1,23 @@ +package grpc + +// Client represents client for exchanging messages +// with a remote server using gRPC protocol. +type Client struct { + *cfg +} + +// Option is a Client's constructor option. +type Option func(*cfg) + +// New creates, configures via options and returns new Client instance. +func New(opts ...Option) *Client { + c := defaultCfg() + + for _, opt := range opts { + opt(c) + } + + return &Client{ + cfg: c, + } +} diff --git a/rpc/grpc/init.go b/rpc/grpc/init.go new file mode 100644 index 0000000..ec3bc5a --- /dev/null +++ b/rpc/grpc/init.go @@ -0,0 +1,65 @@ +package grpc + +import ( + "io" + + "github.com/nspcc-dev/neofs-api-go/rpc/common" + "google.golang.org/grpc" +) + +// Message represents raw gRPC message. +type Message interface{} + +// MessageReadWriter is a component interface +// for transmitting raw messages over gRPC protocol. +type MessageReadWriter interface { + // ReadMessage reads the next message from the remote server, + // and writes it to the argument. + ReadMessage(Message) error + + // WriteMessage sends message from argument to remote server. + WriteMessage(Message) error + + // Closes the communication session with the remote server. + // + // All calls to send/receive messages must be done before closing. + io.Closer +} + +type streamWrapper struct { + grpc.ClientStream +} + +func (w streamWrapper) ReadMessage(m Message) error { + return w.ClientStream.RecvMsg(m) +} + +func (w streamWrapper) WriteMessage(m Message) error { + return w.ClientStream.SendMsg(m) +} + +func (w *streamWrapper) Close() error { + return w.ClientStream.CloseSend() +} + +// Init initiates a messaging session within the RPC configured by options. +func (c *Client) Init(info common.CallMethodInfo, opts ...CallOption) (MessageReadWriter, error) { + prm := defaultCallParameters() + + for _, opt := range opts { + opt(prm) + } + + stream, err := c.con.NewStream(prm.ctx, &grpc.StreamDesc{ + StreamName: info.Name, + ServerStreams: info.ServerStream(), + ClientStreams: info.ClientStream(), + }, toMethodName(info)) + if err != nil { + return nil, err + } + + return &streamWrapper{ + ClientStream: stream, + }, nil +} diff --git a/rpc/grpc/options.go b/rpc/grpc/options.go new file mode 100644 index 0000000..389bd63 --- /dev/null +++ b/rpc/grpc/options.go @@ -0,0 +1,21 @@ +package grpc + +import ( + "google.golang.org/grpc" +) + +type cfg struct { + con *grpc.ClientConn +} + +func defaultCfg() *cfg { + return new(cfg) +} + +// WithClientConnection returns option to set gRPC connection +// to the remote server. +func WithClientConnection(con *grpc.ClientConn) Option { + return func(c *cfg) { + c.con = con + } +} diff --git a/rpc/grpc/util.go b/rpc/grpc/util.go new file mode 100644 index 0000000..61d9abb --- /dev/null +++ b/rpc/grpc/util.go @@ -0,0 +1,13 @@ +package grpc + +import ( + "fmt" + + "github.com/nspcc-dev/neofs-api-go/rpc/common" +) + +const methodNameFmt = "%s/%s" + +func toMethodName(p common.CallMethodInfo) string { + return fmt.Sprintf(methodNameFmt, p.Service, p.Name) +} From c61656a43f97b18b18c3e9d42e8351935247d38e Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 12 Mar 2021 15:06:02 +0300 Subject: [PATCH 0694/1196] [#263] Define generic protobuf message Define `Message` interface of the generic protobuf message. In the initial implementation, the message should be convertible to and from related gRPC message. Implement encoding functions over the `Message` that can: * unmarshal the `Message` via related gRPC message; * decode the `Message` from JSON format via related gRPC message; * encode the `Message` to JSON. Implement nested `test` package for testing the implementation. Signed-off-by: Leonard Lyubich --- rpc/message/encoding.go | 48 ++++++++++++++++++++++++++ rpc/message/message.go | 43 +++++++++++++++++++++++ rpc/message/test/message.go | 68 +++++++++++++++++++++++++++++++++++++ 3 files changed, 159 insertions(+) create mode 100644 rpc/message/encoding.go create mode 100644 rpc/message/message.go create mode 100644 rpc/message/test/message.go diff --git a/rpc/message/encoding.go b/rpc/message/encoding.go new file mode 100644 index 0000000..7d9f7e9 --- /dev/null +++ b/rpc/message/encoding.go @@ -0,0 +1,48 @@ +package message + +import ( + "github.com/nspcc-dev/neofs-api-go/rpc/grpc" + "google.golang.org/protobuf/encoding/protojson" + "google.golang.org/protobuf/proto" +) + +// GRPCConvertedMessage is an interface +// of the gRPC message that is used +// for Message encoding/decoding. +type GRPCConvertedMessage interface { + grpc.Message + proto.Message +} + +// Unmarshal decodes m from its Protobuf binary representation +// via related gRPC message. +// +// 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 { + return err + } + + return m.FromGRPCMessage(gm) +} + +// MarshalJSON encodes m to Protobuf JSON representation. +func MarshalJSON(m Message) ([]byte, error) { + return protojson.MarshalOptions{ + EmitUnpopulated: true, + }.Marshal( + m.ToGRPCMessage().(proto.Message), + ) +} + +// 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 { + return err + } + + return m.FromGRPCMessage(gm) +} diff --git a/rpc/message/message.go b/rpc/message/message.go new file mode 100644 index 0000000..5cc3702 --- /dev/null +++ b/rpc/message/message.go @@ -0,0 +1,43 @@ +package message + +import ( + "fmt" + + "github.com/nspcc-dev/neofs-api-go/rpc/grpc" +) + +// Message represents raw Protobuf message +// that can be transmitted via several +// transport protocols. +type Message interface { + // Must return gRPC message that can + // be used for gRPC protocol transmission. + ToGRPCMessage() grpc.Message + + // Must restore the message from related + // gRPC message. + // + // If gRPC message is not a related one, + // ErrUnexpectedMessageType can be returned + // to indicate this. + FromGRPCMessage(grpc.Message) error +} + +// ErrUnexpectedMessageType is an error that +// is used to indicate message mismatch. +type ErrUnexpectedMessageType struct { + exp, act interface{} +} + +// NewUnexpectedMessageType initializes an error about message mismatch +// between act and exp. +func NewUnexpectedMessageType(act, exp interface{}) ErrUnexpectedMessageType { + return ErrUnexpectedMessageType{ + exp: exp, + act: act, + } +} + +func (e ErrUnexpectedMessageType) Error() string { + return fmt.Sprintf("unexpected message type %T: expected %T", e.act, e.exp) +} diff --git a/rpc/message/test/message.go b/rpc/message/test/message.go new file mode 100644 index 0000000..12ad8ad --- /dev/null +++ b/rpc/message/test/message.go @@ -0,0 +1,68 @@ +package messagetest + +import ( + "encoding/json" + "fmt" + "testing" + + "github.com/nspcc-dev/neofs-api-go/rpc/message" + "github.com/pkg/errors" + "github.com/stretchr/testify/require" +) + +type jsonMessage interface { + json.Marshaler + json.Unmarshaler +} + +type binaryMessage interface { + StableMarshal([]byte) ([]byte, error) + Unmarshal([]byte) error +} + +func TestRPCMessage(t *testing.T, msgGens ...func(empty bool) message.Message) { + for _, msgGen := range msgGens { + msg := msgGen(false) + + t.Run(fmt.Sprintf("convert_%T", msg), func(t *testing.T) { + msg := msgGen(false) + + err := msg.FromGRPCMessage(100) + + require.True(t, errors.As(err, new(message.ErrUnexpectedMessageType))) + + msg2 := msgGen(true) + + err = msg2.FromGRPCMessage(msg.ToGRPCMessage()) + require.NoError(t, err) + + require.Equal(t, msg, msg2) + }) + + t.Run("encoding", func(t *testing.T) { + if jm, ok := msg.(jsonMessage); ok { + t.Run(fmt.Sprintf("JSON_%T", msg), func(t *testing.T) { + data, err := jm.MarshalJSON() + require.NoError(t, err) + + jm2 := msgGen(true).(jsonMessage) + require.NoError(t, jm2.UnmarshalJSON(data)) + + require.Equal(t, jm, jm2) + }) + } + + if bm, ok := msg.(binaryMessage); ok { + t.Run(fmt.Sprintf("Binary_%T", msg), func(t *testing.T) { + data, err := bm.StableMarshal(nil) + require.NoError(t, err) + + bm2 := msgGen(true).(binaryMessage) + require.NoError(t, bm2.Unmarshal(data)) + + require.Equal(t, bm, bm2) + }) + } + }) + } +} From 30c6ca0714566ade0d14bc2288a28b772900de3b Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 12 Mar 2021 15:33:32 +0300 Subject: [PATCH 0695/1196] [#263] Implement client for exchanging raw Protobuf messages Implement generic `Client` that can communicate with the remote server via protobuf `Message`'s. The client can uniformly execute any protobuf RPC on the remote server using any of the supported transport protocols. Currently only gRPC protocol is supported. Additionally implement helpful functions to transmit messages by one of the flow types: unary, client- or server-side stream. Signed-off-by: Leonard Lyubich --- rpc/client/call_options.go | 27 ++++++++ rpc/client/client.go | 29 +++++++++ rpc/client/connect.go | 41 ++++++++++++ rpc/client/flows.go | 124 +++++++++++++++++++++++++++++++++++++ rpc/client/init.go | 83 +++++++++++++++++++++++++ rpc/client/options.go | 60 ++++++++++++++++++ 6 files changed, 364 insertions(+) create mode 100644 rpc/client/call_options.go create mode 100644 rpc/client/client.go create mode 100644 rpc/client/connect.go create mode 100644 rpc/client/flows.go create mode 100644 rpc/client/init.go create mode 100644 rpc/client/options.go diff --git a/rpc/client/call_options.go b/rpc/client/call_options.go new file mode 100644 index 0000000..ef849f3 --- /dev/null +++ b/rpc/client/call_options.go @@ -0,0 +1,27 @@ +package client + +import ( + "context" + + "github.com/nspcc-dev/neofs-api-go/rpc/grpc" +) + +// CallOption is a messaging session option within Protobuf RPC. +type CallOption func(*callParameters) + +type callParameters struct { + callOpts []grpc.CallOption +} + +func defaultCallParameters() *callParameters { + return &callParameters{ + callOpts: make([]grpc.CallOption, 0, 1), + } +} + +// WithContext return options to specify call context. +func WithContext(ctx context.Context) CallOption { + return func(prm *callParameters) { + prm.callOpts = append(prm.callOpts, grpc.WithContext(ctx)) + } +} diff --git a/rpc/client/client.go b/rpc/client/client.go new file mode 100644 index 0000000..e51cdcf --- /dev/null +++ b/rpc/client/client.go @@ -0,0 +1,29 @@ +package client + +import ( + "sync" + + "github.com/nspcc-dev/neofs-api-go/rpc/grpc" +) + +// Client represents client for exchanging messages +// with a remote server using Protobuf RPC. +type Client struct { + *cfg + + gRPCClientOnce sync.Once + gRPCClient *grpc.Client +} + +// New creates, configures via options and returns new Client instance. +func New(opts ...Option) *Client { + c := defaultCfg() + + for _, opt := range opts { + opt(c) + } + + return &Client{ + cfg: c, + } +} diff --git a/rpc/client/connect.go b/rpc/client/connect.go new file mode 100644 index 0000000..f9cd940 --- /dev/null +++ b/rpc/client/connect.go @@ -0,0 +1,41 @@ +package client + +import ( + "context" + "errors" + + "github.com/nspcc-dev/neofs-api-go/rpc/grpc" + grpcstd "google.golang.org/grpc" +) + +func (c *Client) createGRPCClient() (err error) { + c.gRPCClientOnce.Do(func() { + if err = c.openGRPCConn(); err != nil { + return + } + + c.gRPCClient = grpc.New(grpc.WithClientConnection(c.conn)) + }) + + return +} + +var errInvalidEndpoint = errors.New("invalid endpoint options") + +func (c *Client) openGRPCConn() error { + if c.conn != nil { + return nil + } + + if c.addr == "" { + return errInvalidEndpoint + } + + var err error + + dialCtx, cancel := context.WithTimeout(context.Background(), c.dialTimeout) + c.conn, err = grpcstd.DialContext(dialCtx, c.addr, grpcstd.WithInsecure()) + cancel() + + return err +} diff --git a/rpc/client/flows.go b/rpc/client/flows.go new file mode 100644 index 0000000..ceb890e --- /dev/null +++ b/rpc/client/flows.go @@ -0,0 +1,124 @@ +package client + +import ( + "io" + "sync" + + "github.com/nspcc-dev/neofs-api-go/rpc/common" + "github.com/nspcc-dev/neofs-api-go/rpc/message" + "github.com/pkg/errors" +) + +// 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.Init(info, opts...) + if err != nil { + return err + } + + err = rw.WriteMessage(req) + if err != nil { + return err + } + + err = rw.ReadMessage(resp) + if err != nil { + return err + } + + return rw.Close() +} + +// MessageWriterCloser wraps MessageWriter +// and io.Closer interfaces. +type MessageWriterCloser interface { + MessageWriter + io.Closer +} + +type clientStreamWriterCloser struct { + MessageReadWriter + + resp message.Message +} + +func (c *clientStreamWriterCloser) Close() error { + err := c.MessageReadWriter.Close() + if err != nil { + return err + } + + return c.ReadMessage(c.resp) +} + +// OpenClientStream initializes communication session by RPC info, opens client-side stream +// and returns its interface. +// +// 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.Init(info, opts...) + if err != nil { + return nil, err + } + + return &clientStreamWriterCloser{ + MessageReadWriter: rw, + resp: resp, + }, nil +} + +// MessageReaderCloser wraps MessageReader +// and io.Closer interface. +type MessageReaderCloser interface { + MessageReader + io.Closer +} + +type serverStreamReaderCloser struct { + rw MessageReadWriter + + once sync.Once + + req message.Message +} + +func (s *serverStreamReaderCloser) ReadMessage(msg message.Message) error { + var err error + + s.once.Do(func() { + err = s.rw.WriteMessage(s.req) + }) + + if err != nil { + return err + } + + err = s.rw.ReadMessage(msg) + if !errors.Is(err, io.EOF) { + return err + } + + err = s.rw.Close() + if err != nil { + return err + } + + return io.EOF +} + +// OpenServerStream initializes communication session by RPC info, opens server-side stream +// and returns its interface. +// +// 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.Init(info, opts...) + if err != nil { + return nil, err + } + + return &serverStreamReaderCloser{ + rw: rw, + req: req, + }, nil +} diff --git a/rpc/client/init.go b/rpc/client/init.go new file mode 100644 index 0000000..aa0d420 --- /dev/null +++ b/rpc/client/init.go @@ -0,0 +1,83 @@ +package client + +import ( + "io" + + "github.com/nspcc-dev/neofs-api-go/rpc/common" + "github.com/nspcc-dev/neofs-api-go/rpc/grpc" + "github.com/nspcc-dev/neofs-api-go/rpc/message" +) + +// MessageReader is an interface of the Message reader. +type MessageReader interface { + // ReadMessage reads the next Message. + // + // Returns io.EOF if there are no more messages to read. + // ReadMessage should not be called after io.EOF occasion. + ReadMessage(message.Message) error +} + +// MessageWriter is an interface of the Message writer. +type MessageWriter interface { + // WriteMessage writers the next Message. + // + // WriteMessage should not be called after any error. + WriteMessage(message.Message) error +} + +// MessageReadWriter is a component interface +// for transmitting raw Protobuf messages. +type MessageReadWriter interface { + MessageReader + MessageWriter + + // Closes the communication session. + // + // All calls to send/receive messages must be done before closing. + io.Closer +} + +// Init initiates a messaging session and returns the interface for message transmitting. +func (c *Client) Init(info common.CallMethodInfo, opts ...CallOption) (MessageReadWriter, error) { + prm := defaultCallParameters() + + for _, opt := range opts { + opt(prm) + } + + return c.initGRPC(info, prm) +} + +type rwGRPC struct { + grpc.MessageReadWriter +} + +func (g rwGRPC) ReadMessage(m message.Message) error { + // Can be optimized: we can create blank message here. + gm := m.ToGRPCMessage() + + if err := g.MessageReadWriter.ReadMessage(gm); err != nil { + return err + } + + return m.FromGRPCMessage(gm) +} + +func (g rwGRPC) WriteMessage(m message.Message) error { + return g.MessageReadWriter.WriteMessage(m.ToGRPCMessage()) +} + +func (c *Client) initGRPC(info common.CallMethodInfo, prm *callParameters) (MessageReadWriter, error) { + if err := c.createGRPCClient(); err != nil { + return nil, err + } + + rw, err := c.gRPCClient.Init(info, prm.callOpts...) + if err != nil { + return nil, err + } + + return &rwGRPC{ + MessageReadWriter: rw, + }, nil +} diff --git a/rpc/client/options.go b/rpc/client/options.go new file mode 100644 index 0000000..9f2a226 --- /dev/null +++ b/rpc/client/options.go @@ -0,0 +1,60 @@ +package client + +import ( + "time" + + "google.golang.org/grpc" +) + +// Option is a Client's option. +type Option func(*cfg) + +type cfg struct { + addr string + + dialTimeout time.Duration + + conn *grpc.ClientConn +} + +const defaultDialTimeout = 5 * time.Second + +func defaultCfg() *cfg { + return &cfg{ + dialTimeout: defaultDialTimeout, + } +} + +// WithNetworkAddress returns option to specify +// network address of the remote server. +// +// Ignored if WithGRPCConn is provided. +func WithNetworkAddress(v string) Option { + return func(c *cfg) { + if v != "" { + c.addr = v + } + } +} + +// WithDialTimeout returns option to specify +// dial timeout of the remote server connection. +// +// Ignored if WithGRPCConn is provided. +func WithDialTimeout(v time.Duration) Option { + return func(c *cfg) { + if v > 0 { + c.dialTimeout = v + } + } +} + +// WithGRPCConn returns option to specify +// gRPC virtual connection. +func WithGRPCConn(v *grpc.ClientConn) Option { + return func(c *cfg) { + if v != nil { + c.conn = v + } + } +} From 1031f3122ee1c02e30526445f485d2970e3b1121 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 12 Mar 2021 15:57:23 +0300 Subject: [PATCH 0696/1196] [#263] v2: Support new rpc library Implement `message.Message` interface on all structures and use new methods for conversion instead of functions. make `Unmarshal` and JSON methods to use encoding functions from `message` library. Remove all per-service clients and implement `rpc` library of the functions which execute NeoFS API RPC through new RPC client. Remove no longer used gRPC per-service clients. Signed-off-by: Leonard Lyubich --- v2/accounting/accounting.go | 68 +- v2/accounting/client.go | 156 -- v2/accounting/convert.go | 207 +- v2/accounting/grpc/client.go | 62 - v2/accounting/json.go | 18 +- v2/accounting/json_test.go | 20 - v2/accounting/marshal.go | 19 +- v2/accounting/marshal_test.go | 81 - v2/accounting/message_test.go | 19 + v2/accounting/service.go | 27 - v2/accounting/test/client_test.go | 163 -- v2/accounting/test/generate.go | 54 + v2/acl/convert.go | 504 +++-- v2/acl/json.go | 114 +- v2/acl/json_test.go | 81 - v2/acl/marshal.go | 65 +- v2/acl/marshal_test.go | 237 -- v2/acl/message_test.go | 21 + v2/acl/test/generate.go | 124 ++ v2/audit/convert.go | 142 +- v2/audit/json.go | 18 +- v2/audit/json_test.go | 20 - v2/audit/marshal.go | 11 +- v2/audit/marshal_test.go | 63 - v2/audit/message_test.go | 15 + v2/audit/test/generate.go | 30 + v2/client/options.go | 115 - v2/client/proto.go | 23 - v2/container/client.go | 355 --- v2/container/convert.go | 1494 +++++++------ v2/container/grpc/client.go | 86 - v2/container/json.go | 34 +- v2/container/json_test.go | 32 - v2/container/marshal.go | 85 +- v2/container/marshal_test.go | 492 ----- v2/container/message_test.go | 43 + v2/container/service.go | 113 - v2/container/test/client_test.go | 958 -------- v2/container/test/generate.go | 318 +++ v2/container/types.go | 471 +--- v2/netmap/client.go | 190 -- v2/netmap/convert.go | 768 ++++--- v2/netmap/grpc/client.go | 66 - v2/netmap/json.go | 114 +- v2/netmap/json_test.go | 80 - v2/netmap/marshal.go | 81 +- v2/netmap/marshal_test.go | 248 --- v2/netmap/message_test.go | 25 + v2/netmap/service.go | 46 - v2/netmap/test/generate.go | 219 ++ v2/netmap/types.go | 130 +- v2/object/client.go | 408 ---- v2/object/client_stream.go | 60 - v2/object/convert.go | 3390 ++++++++++++++++------------- v2/object/json.go | 126 +- v2/object/json_test.go | 92 - v2/object/marshal.go | 400 ++-- v2/object/marshal_test.go | 776 ------- v2/object/message_test.go | 54 + v2/object/service.go | 129 -- v2/object/test/client_test.go | 471 ---- v2/object/test/generate.go | 512 +++++ v2/object/types.go | 476 +--- v2/refs/convert.go | 345 +-- v2/refs/json.go | 114 +- v2/refs/json_test.go | 97 - v2/refs/marshal.go | 65 +- v2/refs/marshal_test.go | 146 -- v2/refs/message_test.go | 21 + v2/refs/test/generate.go | 101 + v2/rpc/accounting.go | 29 + v2/rpc/common.go | 3 + v2/rpc/container.go | 131 ++ v2/rpc/netmap.go | 46 + v2/rpc/object.go | 190 ++ v2/rpc/session.go | 28 + v2/session/client.go | 156 -- v2/session/convert.go | 1021 +++++---- v2/session/json.go | 103 +- v2/session/json_test.go | 116 - v2/session/marshal.go | 45 +- v2/session/marshal_test.go | 385 ---- v2/session/message_test.go | 26 + v2/session/service.go | 25 - v2/session/test/client_test.go | 159 -- v2/session/test/generate.go | 204 ++ v2/session/types.go | 12 + v2/session/util.go | 90 + v2/storagegroup/convert.go | 65 +- v2/storagegroup/json.go | 18 +- v2/storagegroup/json_test.go | 20 - v2/storagegroup/marshal.go | 11 +- v2/storagegroup/marshal_test.go | 48 - v2/storagegroup/message_test.go | 15 + v2/storagegroup/test/generate.go | 20 + v2/tombstone/convert.go | 56 +- v2/tombstone/json.go | 18 +- v2/tombstone/json_test.go | 20 - v2/tombstone/marshal.go | 11 +- v2/tombstone/marshal_test.go | 39 - v2/tombstone/message_test.go | 15 + v2/tombstone/test/generate.go | 19 + 102 files changed, 7554 insertions(+), 12298 deletions(-) delete mode 100644 v2/accounting/client.go delete mode 100644 v2/accounting/grpc/client.go delete mode 100644 v2/accounting/json_test.go delete mode 100644 v2/accounting/marshal_test.go create mode 100644 v2/accounting/message_test.go delete mode 100644 v2/accounting/service.go delete mode 100644 v2/accounting/test/client_test.go create mode 100644 v2/accounting/test/generate.go delete mode 100644 v2/acl/json_test.go delete mode 100644 v2/acl/marshal_test.go create mode 100644 v2/acl/message_test.go create mode 100644 v2/acl/test/generate.go delete mode 100644 v2/audit/json_test.go delete mode 100644 v2/audit/marshal_test.go create mode 100644 v2/audit/message_test.go create mode 100644 v2/audit/test/generate.go delete mode 100644 v2/client/options.go delete mode 100644 v2/client/proto.go delete mode 100644 v2/container/client.go delete mode 100644 v2/container/grpc/client.go delete mode 100644 v2/container/json_test.go delete mode 100644 v2/container/marshal_test.go create mode 100644 v2/container/message_test.go delete mode 100644 v2/container/service.go delete mode 100644 v2/container/test/client_test.go create mode 100644 v2/container/test/generate.go delete mode 100644 v2/netmap/client.go delete mode 100644 v2/netmap/grpc/client.go delete mode 100644 v2/netmap/json_test.go delete mode 100644 v2/netmap/marshal_test.go create mode 100644 v2/netmap/message_test.go delete mode 100644 v2/netmap/service.go create mode 100644 v2/netmap/test/generate.go delete mode 100644 v2/object/client.go delete mode 100644 v2/object/client_stream.go delete mode 100644 v2/object/json_test.go delete mode 100644 v2/object/marshal_test.go create mode 100644 v2/object/message_test.go delete mode 100644 v2/object/service.go delete mode 100644 v2/object/test/client_test.go create mode 100644 v2/object/test/generate.go delete mode 100644 v2/refs/json_test.go delete mode 100644 v2/refs/marshal_test.go create mode 100644 v2/refs/message_test.go create mode 100644 v2/refs/test/generate.go create mode 100644 v2/rpc/accounting.go create mode 100644 v2/rpc/common.go create mode 100644 v2/rpc/container.go create mode 100644 v2/rpc/netmap.go create mode 100644 v2/rpc/object.go create mode 100644 v2/rpc/session.go delete mode 100644 v2/session/client.go delete mode 100644 v2/session/json_test.go delete mode 100644 v2/session/marshal_test.go create mode 100644 v2/session/message_test.go delete mode 100644 v2/session/service.go delete mode 100644 v2/session/test/client_test.go create mode 100644 v2/session/test/generate.go delete mode 100644 v2/storagegroup/json_test.go delete mode 100644 v2/storagegroup/marshal_test.go create mode 100644 v2/storagegroup/message_test.go create mode 100644 v2/storagegroup/test/generate.go delete mode 100644 v2/tombstone/json_test.go delete mode 100644 v2/tombstone/marshal_test.go create mode 100644 v2/tombstone/message_test.go create mode 100644 v2/tombstone/test/generate.go diff --git a/v2/accounting/accounting.go b/v2/accounting/accounting.go index 619f220..d2d287f 100644 --- a/v2/accounting/accounting.go +++ b/v2/accounting/accounting.go @@ -19,6 +19,18 @@ type Decimal struct { prec uint32 } +type BalanceRequest struct { + body *BalanceRequestBody + + session.RequestHeaders +} + +type BalanceResponse struct { + body *BalanceResponseBody + + session.ResponseHeaders +} + func (b *BalanceRequestBody) GetOwnerID() *refs.OwnerID { if b != nil { return b.ownerID @@ -47,34 +59,6 @@ func (b *BalanceRequest) SetBody(v *BalanceRequestBody) { } } -func (b *BalanceRequest) GetMetaHeader() *session.RequestMetaHeader { - if b != nil { - return b.metaHeader - } - - return nil -} - -func (b *BalanceRequest) SetMetaHeader(v *session.RequestMetaHeader) { - if b != nil { - b.metaHeader = v - } -} - -func (b *BalanceRequest) GetVerificationHeader() *session.RequestVerificationHeader { - if b != nil { - return b.verifyHeader - } - - return nil -} - -func (b *BalanceRequest) SetVerificationHeader(v *session.RequestVerificationHeader) { - if b != nil { - b.verifyHeader = v - } -} - func (d *Decimal) GetValue() int64 { if d != nil { return d.val @@ -130,31 +114,3 @@ func (br *BalanceResponse) SetBody(v *BalanceResponseBody) { br.body = v } } - -func (br *BalanceResponse) GetMetaHeader() *session.ResponseMetaHeader { - if br != nil { - return br.metaHeader - } - - return nil -} - -func (br *BalanceResponse) SetMetaHeader(v *session.ResponseMetaHeader) { - if br != nil { - br.metaHeader = v - } -} - -func (br *BalanceResponse) GetVerificationHeader() *session.ResponseVerificationHeader { - if br != nil { - return br.verifyHeader - } - - return nil -} - -func (br *BalanceResponse) SetVerificationHeader(v *session.ResponseVerificationHeader) { - if br != nil { - br.verifyHeader = v - } -} diff --git a/v2/accounting/client.go b/v2/accounting/client.go deleted file mode 100644 index 3d9e51d..0000000 --- a/v2/accounting/client.go +++ /dev/null @@ -1,156 +0,0 @@ -package accounting - -import ( - "context" - - accounting "github.com/nspcc-dev/neofs-api-go/v2/accounting/grpc" - "github.com/nspcc-dev/neofs-api-go/v2/client" - "github.com/pkg/errors" - "google.golang.org/grpc" -) - -// Client represents universal accounting -// transport client. -type Client struct { - client *getBalanceClient -} - -// Option represents Client option. -type Option func(*cfg) - -type cfg struct { - proto client.Protocol - - globalOpts []client.Option - - gRPC cfgGRPC -} - -type cfgGRPC struct { - serviceClient accounting.AccountingServiceClient - - grpcCallOpts []grpc.CallOption - - callOpts []accounting.Option - - client *accounting.Client -} - -type getBalanceClient struct { - requestConverter func(*BalanceRequest) interface{} - - caller func(context.Context, interface{}) (interface{}, error) - - responseConverter func(interface{}) *BalanceResponse -} - -// Balance sends BalanceRequest over the network and returns BalanceResponse. -// -// It returns any error encountered during the call. -func (c *Client) Balance(ctx context.Context, req *BalanceRequest) (*BalanceResponse, error) { - resp, err := c.client.caller(ctx, c.client.requestConverter(req)) - if err != nil { - return nil, errors.Wrap(err, "could not send balance request") - } - - return c.client.responseConverter(resp), nil -} - -func defaultCfg() *cfg { - return &cfg{ - proto: client.ProtoGRPC, - } -} - -func NewClient(opts ...Option) (*Client, error) { - cfg := defaultCfg() - - for i := range opts { - opts[i](cfg) - } - - var err error - - switch cfg.proto { - case client.ProtoGRPC: - var c *accounting.Client - if c, err = newGRPCClient(cfg); err != nil { - break - } - - return &Client{ - client: &getBalanceClient{ - requestConverter: func(req *BalanceRequest) interface{} { - return BalanceRequestToGRPCMessage(req) - }, - caller: func(ctx context.Context, req interface{}) (interface{}, error) { - return c.Balance(ctx, req.(*accounting.BalanceRequest)) - }, - responseConverter: func(resp interface{}) *BalanceResponse { - return BalanceResponseFromGRPCMessage(resp.(*accounting.BalanceResponse)) - }, - }, - }, nil - default: - err = client.ErrProtoUnsupported - } - - return nil, errors.Wrapf(err, "could not create %s Accounting client", cfg.proto) -} - -func newGRPCClient(cfg *cfg) (*accounting.Client, error) { - var err error - - if cfg.gRPC.client == nil { - if cfg.gRPC.serviceClient == nil { - conn, err := client.NewGRPCClientConn(cfg.globalOpts...) - if err != nil { - return nil, errors.Wrap(err, "could not open gRPC client connection") - } - - cfg.gRPC.serviceClient = accounting.NewAccountingServiceClient(conn) - } - - cfg.gRPC.client, err = accounting.NewClient( - cfg.gRPC.serviceClient, - append( - cfg.gRPC.callOpts, - accounting.WithCallOptions(cfg.gRPC.grpcCallOpts), - )..., - ) - } - - return cfg.gRPC.client, err -} - -func WithGlobalOpts(v ...client.Option) Option { - return func(c *cfg) { - if len(v) > 0 { - c.globalOpts = v - } - } -} - -func WithGRPCServiceClient(v accounting.AccountingServiceClient) Option { - return func(c *cfg) { - c.gRPC.serviceClient = v - } -} - -func WithGRPCCallOpts(v []grpc.CallOption) Option { - return func(c *cfg) { - c.gRPC.grpcCallOpts = v - } -} - -func WithGRPCClientOpts(v []accounting.Option) Option { - return func(c *cfg) { - c.gRPC.callOpts = v - } -} - -func WithGRPCClient(v *accounting.Client) Option { - return func(c *cfg) { - c.gRPC.client = v - } -} diff --git a/v2/accounting/convert.go b/v2/accounting/convert.go index d7fe95c..2a842f8 100644 --- a/v2/accounting/convert.go +++ b/v2/accounting/convert.go @@ -1,153 +1,178 @@ package accounting import ( + "github.com/nspcc-dev/neofs-api-go/rpc/grpc" + "github.com/nspcc-dev/neofs-api-go/rpc/message" accounting "github.com/nspcc-dev/neofs-api-go/v2/accounting/grpc" "github.com/nspcc-dev/neofs-api-go/v2/refs" - "github.com/nspcc-dev/neofs-api-go/v2/session" + refsGRPC "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" ) -func BalanceRequestBodyToGRPCMessage(b *BalanceRequestBody) *accounting.BalanceRequest_Body { - if b == nil { - return nil +func (b *BalanceRequestBody) ToGRPCMessage() grpc.Message { + var m *accounting.BalanceRequest_Body + + if b != nil { + m = new(accounting.BalanceRequest_Body) + + m.SetOwnerId(b.ownerID.ToGRPCMessage().(*refsGRPC.OwnerID)) } - m := new(accounting.BalanceRequest_Body) - - m.SetOwnerId( - refs.OwnerIDToGRPCMessage(b.GetOwnerID()), - ) - return m } -func BalanceRequestBodyFromGRPCMessage(m *accounting.BalanceRequest_Body) *BalanceRequestBody { - if m == nil { - return nil +func (b *BalanceRequestBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*accounting.BalanceRequest_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) } - b := new(BalanceRequestBody) + var err error - b.SetOwnerID( - refs.OwnerIDFromGRPCMessage(m.GetOwnerId()), - ) + ownerID := v.GetOwnerId() + if ownerID == nil { + b.ownerID = nil + } else { + if b.ownerID == nil { + b.ownerID = new(refs.OwnerID) + } - return b + err = b.ownerID.FromGRPCMessage(ownerID) + } + + return err } -func BalanceRequestToGRPCMessage(b *BalanceRequest) *accounting.BalanceRequest { - if b == nil { - return nil +func (b *BalanceRequest) ToGRPCMessage() grpc.Message { + var m *accounting.BalanceRequest + + if b != nil { + m = new(accounting.BalanceRequest) + + m.SetBody(b.body.ToGRPCMessage().(*accounting.BalanceRequest_Body)) + b.RequestHeaders.ToMessage(m) } - m := new(accounting.BalanceRequest) - - m.SetBody( - BalanceRequestBodyToGRPCMessage(b.GetBody()), - ) - - session.RequestHeadersToGRPC(b, m) - return m } -func BalanceRequestFromGRPCMessage(m *accounting.BalanceRequest) *BalanceRequest { - if m == nil { - return nil +func (b *BalanceRequest) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*accounting.BalanceRequest) + if !ok { + return message.NewUnexpectedMessageType(m, v) } - b := new(BalanceRequest) + var err error - b.SetBody( - BalanceRequestBodyFromGRPCMessage(m.GetBody()), - ) + body := v.GetBody() + if body == nil { + b.body = nil + } else { + if b.body == nil { + b.body = new(BalanceRequestBody) + } - session.RequestHeadersFromGRPC(m, b) + err = b.body.FromGRPCMessage(body) + if err != nil { + return err + } + } - return b + return b.RequestHeaders.FromMessage(v) } -func DecimalToGRPCMessage(d *Decimal) *accounting.Decimal { - if d == nil { - return nil +func (d *Decimal) ToGRPCMessage() grpc.Message { + var m *accounting.Decimal + + if d != nil { + m = new(accounting.Decimal) + + m.SetValue(d.val) + m.SetPrecision(d.prec) } - m := new(accounting.Decimal) - - m.SetValue(d.GetValue()) - m.SetPrecision(d.GetPrecision()) - return m } -func DecimalFromGRPCMessage(m *accounting.Decimal) *Decimal { - if m == nil { - return nil +func (d *Decimal) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*accounting.Decimal) + if !ok { + return message.NewUnexpectedMessageType(m, v) } - d := new(Decimal) + d.val = v.GetValue() + d.prec = v.GetPrecision() - d.SetValue(m.GetValue()) - d.SetPrecision(m.GetPrecision()) - - return d + return nil } -func BalanceResponseBodyToGRPCMessage(br *BalanceResponseBody) *accounting.BalanceResponse_Body { - if br == nil { - return nil +func (br *BalanceResponseBody) ToGRPCMessage() grpc.Message { + var m *accounting.BalanceResponse_Body + + if br != nil { + m = new(accounting.BalanceResponse_Body) + + m.SetBalance(br.bal.ToGRPCMessage().(*accounting.Decimal)) } - m := new(accounting.BalanceResponse_Body) - - m.SetBalance( - DecimalToGRPCMessage(br.GetBalance()), - ) - return m } -func BalanceResponseBodyFromGRPCMessage(m *accounting.BalanceResponse_Body) *BalanceResponseBody { - if m == nil { - return nil +func (br *BalanceResponseBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*accounting.BalanceResponse_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) } - br := new(BalanceResponseBody) + var err error - br.SetBalance( - DecimalFromGRPCMessage(m.GetBalance()), - ) + bal := v.GetBalance() + if bal == nil { + br.bal = nil + } else { + if br.bal == nil { + br.bal = new(Decimal) + } - return br + err = br.bal.FromGRPCMessage(bal) + } + + return err } -func BalanceResponseToGRPCMessage(br *BalanceResponse) *accounting.BalanceResponse { - if br == nil { - return nil +func (br *BalanceResponse) ToGRPCMessage() grpc.Message { + var m *accounting.BalanceResponse + + if br != nil { + m = new(accounting.BalanceResponse) + + m.SetBody(br.body.ToGRPCMessage().(*accounting.BalanceResponse_Body)) + br.ResponseHeaders.ToMessage(m) } - m := new(accounting.BalanceResponse) - - m.SetBody( - BalanceResponseBodyToGRPCMessage(br.GetBody()), - ) - - session.ResponseHeadersToGRPC(br, m) - return m } -func BalanceResponseFromGRPCMessage(m *accounting.BalanceResponse) *BalanceResponse { - if m == nil { - return nil +func (br *BalanceResponse) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*accounting.BalanceResponse) + if !ok { + return message.NewUnexpectedMessageType(m, v) } - br := new(BalanceResponse) + var err error - br.SetBody( - BalanceResponseBodyFromGRPCMessage(m.GetBody()), - ) + body := v.GetBody() + if body == nil { + br.body = nil + } else { + if br.body == nil { + br.body = new(BalanceResponseBody) + } - session.ResponseHeadersFromGRPC(m, br) + err = br.body.FromGRPCMessage(body) + if err != nil { + return err + } + } - return br + return br.ResponseHeaders.FromMessage(v) } diff --git a/v2/accounting/grpc/client.go b/v2/accounting/grpc/client.go deleted file mode 100644 index 6a626b1..0000000 --- a/v2/accounting/grpc/client.go +++ /dev/null @@ -1,62 +0,0 @@ -package accounting - -import ( - "context" - - "github.com/pkg/errors" - "google.golang.org/grpc" -) - -// Client wraps AccountingServiceClient -// with pre-defined configurations. -type Client struct { - *cfg - - client AccountingServiceClient -} - -// Option represents Client option. -type Option func(*cfg) - -type cfg struct { - callOpts []grpc.CallOption -} - -// ErrNilAccountingServiceClient is returned by functions that expect -// a non-nil AccountingServiceClient, but received nil. -var ErrNilAccountingServiceClient = errors.New("accounting gRPC client is nil") - -func defaultCfg() *cfg { - return new(cfg) -} - -// NewClient creates, initializes and returns a new Client instance. -// -// Options are applied one by one in order. -func NewClient(c AccountingServiceClient, opts ...Option) (*Client, error) { - if c == nil { - return nil, ErrNilAccountingServiceClient - } - - cfg := defaultCfg() - for i := range opts { - opts[i](cfg) - } - - return &Client{ - cfg: cfg, - client: c, - }, nil -} - -func (c *Client) Balance(ctx context.Context, req *BalanceRequest) (*BalanceResponse, error) { - return c.client.Balance(ctx, req, c.callOpts...) -} - -// WithCallOptions returns Option that configures -// Client to attach call options to each rpc call. -func WithCallOptions(opts []grpc.CallOption) Option { - return func(c *cfg) { - c.callOpts = opts - } -} diff --git a/v2/accounting/json.go b/v2/accounting/json.go index 322ca5c..6229885 100644 --- a/v2/accounting/json.go +++ b/v2/accounting/json.go @@ -1,26 +1,14 @@ package accounting import ( + "github.com/nspcc-dev/neofs-api-go/rpc/message" accounting "github.com/nspcc-dev/neofs-api-go/v2/accounting/grpc" - "google.golang.org/protobuf/encoding/protojson" ) func (d *Decimal) MarshalJSON() ([]byte, error) { - return protojson.MarshalOptions{ - EmitUnpopulated: true, - }.Marshal( - DecimalToGRPCMessage(d), - ) + return message.MarshalJSON(d) } func (d *Decimal) UnmarshalJSON(data []byte) error { - msg := new(accounting.Decimal) - - if err := protojson.Unmarshal(data, msg); err != nil { - return err - } - - *d = *DecimalFromGRPCMessage(msg) - - return nil + return message.UnmarshalJSON(d, data, new(accounting.Decimal)) } diff --git a/v2/accounting/json_test.go b/v2/accounting/json_test.go deleted file mode 100644 index 1145e05..0000000 --- a/v2/accounting/json_test.go +++ /dev/null @@ -1,20 +0,0 @@ -package accounting_test - -import ( - "testing" - - "github.com/nspcc-dev/neofs-api-go/v2/accounting" - "github.com/stretchr/testify/require" -) - -func TestDecimalJSON(t *testing.T) { - i := generateDecimal(10) - - data, err := i.MarshalJSON() - require.NoError(t, err) - - i2 := new(accounting.Decimal) - require.NoError(t, i2.UnmarshalJSON(data)) - - require.Equal(t, i, i2) -} diff --git a/v2/accounting/marshal.go b/v2/accounting/marshal.go index e25ab90..11ae796 100644 --- a/v2/accounting/marshal.go +++ b/v2/accounting/marshal.go @@ -1,9 +1,9 @@ package accounting import ( + "github.com/nspcc-dev/neofs-api-go/rpc/message" protoutil "github.com/nspcc-dev/neofs-api-go/util/proto" accounting "github.com/nspcc-dev/neofs-api-go/v2/accounting/grpc" - "google.golang.org/protobuf/proto" ) const ( @@ -56,14 +56,7 @@ func (d *Decimal) StableSize() (size int) { } func (d *Decimal) Unmarshal(data []byte) error { - m := new(accounting.Decimal) - if err := proto.Unmarshal(data, m); err != nil { - return err - } - - *d = *DecimalFromGRPCMessage(m) - - return nil + return message.Unmarshal(d, data, new(accounting.Decimal)) } func (b *BalanceRequestBody) StableMarshal(buf []byte) ([]byte, error) { @@ -93,6 +86,10 @@ func (b *BalanceRequestBody) StableSize() (size int) { return size } +func (b *BalanceRequestBody) Unmarshal(data []byte) error { + return message.Unmarshal(b, data, new(accounting.BalanceRequest_Body)) +} + func (br *BalanceResponseBody) StableMarshal(buf []byte) ([]byte, error) { if br == nil { return []byte{}, nil @@ -119,3 +116,7 @@ func (br *BalanceResponseBody) StableSize() (size int) { return size } + +func (br *BalanceResponseBody) Unmarshal(data []byte) error { + return message.Unmarshal(br, data, new(accounting.BalanceResponse_Body)) +} diff --git a/v2/accounting/marshal_test.go b/v2/accounting/marshal_test.go deleted file mode 100644 index 6ace77f..0000000 --- a/v2/accounting/marshal_test.go +++ /dev/null @@ -1,81 +0,0 @@ -package accounting_test - -import ( - "testing" - - "github.com/nspcc-dev/neofs-api-go/v2/accounting" - grpc "github.com/nspcc-dev/neofs-api-go/v2/accounting/grpc" - "github.com/nspcc-dev/neofs-api-go/v2/refs" - "github.com/stretchr/testify/require" - goproto "google.golang.org/protobuf/proto" -) - -func TestBalanceRequestBody_StableMarshal(t *testing.T) { - requestBodyFrom := generateBalanceRequestBody("Owner ID") - transport := new(grpc.BalanceRequest_Body) - - t.Run("non empty", func(t *testing.T) { - wire, err := requestBodyFrom.StableMarshal(nil) - require.NoError(t, err) - - err = goproto.Unmarshal(wire, transport) - require.NoError(t, err) - - requestBodyTo := accounting.BalanceRequestBodyFromGRPCMessage(transport) - require.Equal(t, requestBodyFrom, requestBodyTo) - }) -} - -func TestBalanceResponseBody_StableMarshal(t *testing.T) { - responseBodyFrom := generateBalanceResponseBody(444) - transport := new(grpc.BalanceResponse_Body) - - t.Run("non empty", func(t *testing.T) { - wire, err := responseBodyFrom.StableMarshal(nil) - require.NoError(t, err) - - err = goproto.Unmarshal(wire, transport) - require.NoError(t, err) - - responseBodyTo := accounting.BalanceResponseBodyFromGRPCMessage(transport) - require.Equal(t, responseBodyFrom, responseBodyTo) - }) -} - -func generateDecimal(val int64) *accounting.Decimal { - decimal := new(accounting.Decimal) - decimal.SetValue(val) - decimal.SetPrecision(1000) - - return decimal -} - -func generateBalanceRequestBody(id string) *accounting.BalanceRequestBody { - owner := new(refs.OwnerID) - owner.SetValue([]byte(id)) - - request := new(accounting.BalanceRequestBody) - request.SetOwnerID(owner) - - return request -} - -func generateBalanceResponseBody(val int64) *accounting.BalanceResponseBody { - response := new(accounting.BalanceResponseBody) - response.SetBalance(generateDecimal(val)) - - return response -} - -func TestDecimalMarshal(t *testing.T) { - d := generateDecimal(3) - - data, err := d.StableMarshal(nil) - require.NoError(t, err) - - d2 := new(accounting.Decimal) - - require.NoError(t, d2.Unmarshal(data)) - - require.Equal(t, d, d2) -} diff --git a/v2/accounting/message_test.go b/v2/accounting/message_test.go new file mode 100644 index 0000000..baf71fa --- /dev/null +++ b/v2/accounting/message_test.go @@ -0,0 +1,19 @@ +package accounting_test + +import ( + "testing" + + "github.com/nspcc-dev/neofs-api-go/rpc/message" + messagetest "github.com/nspcc-dev/neofs-api-go/rpc/message/test" + accountingtest "github.com/nspcc-dev/neofs-api-go/v2/accounting/test" +) + +func TestMessage(t *testing.T) { + messagetest.TestRPCMessage(t, + func(empty bool) message.Message { return accountingtest.GenerateDecimal(empty) }, + func(empty bool) message.Message { return accountingtest.GenerateBalanceRequestBody(empty) }, + func(empty bool) message.Message { return accountingtest.GenerateBalanceRequest(empty) }, + func(empty bool) message.Message { return accountingtest.GenerateBalanceResponseBody(empty) }, + func(empty bool) message.Message { return accountingtest.GenerateBalanceResponse(empty) }, + ) +} diff --git a/v2/accounting/service.go b/v2/accounting/service.go deleted file mode 100644 index 8443c66..0000000 --- a/v2/accounting/service.go +++ /dev/null @@ -1,27 +0,0 @@ -package accounting - -import ( - "context" - - "github.com/nspcc-dev/neofs-api-go/v2/session" -) - -type Service interface { - Balance(context.Context, *BalanceRequest) (*BalanceResponse, error) -} - -type BalanceRequest struct { - body *BalanceRequestBody - - metaHeader *session.RequestMetaHeader - - verifyHeader *session.RequestVerificationHeader -} - -type BalanceResponse struct { - body *BalanceResponseBody - - metaHeader *session.ResponseMetaHeader - - verifyHeader *session.ResponseVerificationHeader -} diff --git a/v2/accounting/test/client_test.go b/v2/accounting/test/client_test.go deleted file mode 100644 index 7c63dcf..0000000 --- a/v2/accounting/test/client_test.go +++ /dev/null @@ -1,163 +0,0 @@ -package main - -import ( - "context" - "crypto/ecdsa" - "errors" - "testing" - - "github.com/nspcc-dev/neofs-api-go/v2/accounting" - accountingGRPC "github.com/nspcc-dev/neofs-api-go/v2/accounting/grpc" - "github.com/nspcc-dev/neofs-api-go/v2/refs" - "github.com/nspcc-dev/neofs-api-go/v2/session" - "github.com/nspcc-dev/neofs-api-go/v2/signature" - "github.com/nspcc-dev/neofs-crypto/test" - "github.com/stretchr/testify/require" - "google.golang.org/grpc" -) - -type testGRPCClient struct { - server *testGRPCServer -} - -type testGRPCServer struct { - key *ecdsa.PrivateKey - resp *accounting.BalanceResponse - err error -} - -func (s *testGRPCClient) Balance(ctx context.Context, in *accountingGRPC.BalanceRequest, opts ...grpc.CallOption) (*accountingGRPC.BalanceResponse, error) { - return s.server.Balance(ctx, in) -} - -func (s *testGRPCServer) Balance(_ context.Context, req *accountingGRPC.BalanceRequest) (*accountingGRPC.BalanceResponse, error) { - if s.err != nil { - return nil, s.err - } - - // verify request structure - if err := signature.VerifyServiceMessage( - accounting.BalanceRequestFromGRPCMessage(req), - ); err != nil { - return nil, err - } - - // sign response structure - if err := signature.SignServiceMessage(s.key, s.resp); err != nil { - return nil, err - } - - return accounting.BalanceResponseToGRPCMessage(s.resp), nil -} - -func testRequest() *accounting.BalanceRequest { - ownerID := new(refs.OwnerID) - ownerID.SetValue([]byte{1, 2, 3}) - - body := new(accounting.BalanceRequestBody) - body.SetOwnerID(ownerID) - - meta := new(session.RequestMetaHeader) - meta.SetTTL(1) - - req := new(accounting.BalanceRequest) - req.SetBody(body) - req.SetMetaHeader(meta) - - return req -} - -func testResponse() *accounting.BalanceResponse { - dec := new(accounting.Decimal) - dec.SetValue(10) - - body := new(accounting.BalanceResponseBody) - body.SetBalance(dec) - - meta := new(session.ResponseMetaHeader) - meta.SetTTL(1) - - resp := new(accounting.BalanceResponse) - resp.SetBody(body) - resp.SetMetaHeader(meta) - - return resp -} - -func TestGRPCClient(t *testing.T) { - ctx := context.TODO() - - cliKey := test.DecodeKey(0) - srvKey := test.DecodeKey(1) - - t.Run("gRPC server error", func(t *testing.T) { - srvErr := errors.New("test server error") - - srv := &testGRPCServer{ - err: srvErr, - } - - cli := &testGRPCClient{ - server: srv, - } - - c, err := accounting.NewClient(accounting.WithGRPCServiceClient(cli)) - require.NoError(t, err) - - resp, err := c.Balance(ctx, new(accounting.BalanceRequest)) - require.True(t, errors.Is(err, srvErr)) - require.Nil(t, resp) - }) - - t.Run("invalid request structure", func(t *testing.T) { - req := testRequest() - - require.Error(t, signature.VerifyServiceMessage(req)) - - c, err := accounting.NewClient( - accounting.WithGRPCServiceClient( - &testGRPCClient{ - server: new(testGRPCServer), - }, - ), - ) - require.NoError(t, err) - - resp, err := c.Balance(ctx, req) - require.Error(t, err) - require.Nil(t, resp) - }) - - t.Run("correct response", func(t *testing.T) { - req := testRequest() - - require.NoError(t, signature.SignServiceMessage(cliKey, req)) - - resp := testResponse() - - { // w/o this require.Equal fails due to nil and []T{} difference - meta := new(session.ResponseMetaHeader) - meta.SetXHeaders([]*session.XHeader{}) - resp.SetMetaHeader(meta) - } - - c, err := accounting.NewClient( - accounting.WithGRPCServiceClient( - &testGRPCClient{ - server: &testGRPCServer{ - key: srvKey, - resp: resp, - }, - }, - ), - ) - require.NoError(t, err) - - r, err := c.Balance(ctx, req) - require.NoError(t, err) - - require.NoError(t, signature.VerifyServiceMessage(r)) - require.Equal(t, resp.GetBody(), r.GetBody()) - require.Equal(t, resp.GetMetaHeader(), r.GetMetaHeader()) - }) -} diff --git a/v2/accounting/test/generate.go b/v2/accounting/test/generate.go new file mode 100644 index 0000000..b2c0d95 --- /dev/null +++ b/v2/accounting/test/generate.go @@ -0,0 +1,54 @@ +package accountingtest + +import ( + "github.com/nspcc-dev/neofs-api-go/v2/accounting" + accountingtest "github.com/nspcc-dev/neofs-api-go/v2/refs/test" + sessiontest "github.com/nspcc-dev/neofs-api-go/v2/session/test" +) + +func GenerateBalanceRequest(empty bool) *accounting.BalanceRequest { + m := new(accounting.BalanceRequest) + + m.SetBody(GenerateBalanceRequestBody(empty)) + m.SetMetaHeader(sessiontest.GenerateRequestMetaHeader(empty)) + m.SetVerificationHeader(sessiontest.GenerateRequestVerificationHeader(empty)) + + return m +} + +func GenerateBalanceRequestBody(empty bool) *accounting.BalanceRequestBody { + m := new(accounting.BalanceRequestBody) + + m.SetOwnerID(accountingtest.GenerateOwnerID(empty)) + + return m +} + +func GenerateBalanceResponse(empty bool) *accounting.BalanceResponse { + m := new(accounting.BalanceResponse) + + m.SetBody(GenerateBalanceResponseBody(empty)) + m.SetMetaHeader(sessiontest.GenerateResponseMetaHeader(empty)) + m.SetVerificationHeader(sessiontest.GenerateResponseVerificationHeader(empty)) + + return m +} + +func GenerateBalanceResponseBody(empty bool) *accounting.BalanceResponseBody { + m := new(accounting.BalanceResponseBody) + + m.SetBalance(GenerateDecimal(empty)) + + return m +} + +func GenerateDecimal(empty bool) *accounting.Decimal { + m := new(accounting.Decimal) + + if !empty { + m.SetValue(1) + m.SetPrecision(2) + } + + return m +} diff --git a/v2/acl/convert.go b/v2/acl/convert.go index 462baa7..d4a52b8 100644 --- a/v2/acl/convert.go +++ b/v2/acl/convert.go @@ -1,8 +1,11 @@ package acl import ( + "github.com/nspcc-dev/neofs-api-go/rpc/grpc" + "github.com/nspcc-dev/neofs-api-go/rpc/message" acl "github.com/nspcc-dev/neofs-api-go/v2/acl/grpc" "github.com/nspcc-dev/neofs-api-go/v2/refs" + refsGRPC "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" ) // RoleToGRPCField converts unified role enum into grpc enum. @@ -149,316 +152,395 @@ func MatchTypeFromGRPCField(t acl.MatchType) MatchType { } } -// HeaderFilterToGRPCMessage converts unified header filter struct into grpc struct. -func HeaderFilterToGRPCMessage(f *HeaderFilter) *acl.EACLRecord_Filter { - if f == nil { - return nil +func (f *HeaderFilter) ToGRPCMessage() grpc.Message { + var m *acl.EACLRecord_Filter + + if f != nil { + m = new(acl.EACLRecord_Filter) + + m.SetKey(f.key) + m.SetValue(f.value) + m.SetHeader(HeaderTypeToGRPCField(f.hdrType)) + m.SetMatchType(MatchTypeToGRPCField(f.matchType)) } - m := new(acl.EACLRecord_Filter) - - m.SetHeader( - HeaderTypeToGRPCField(f.GetHeaderType()), - ) - - m.SetMatchType( - MatchTypeToGRPCField(f.GetMatchType()), - ) - - m.SetKey(f.GetKey()) - m.SetValue(f.GetValue()) - return m } -// HeaderFilterFromGRPCMessage converts grpc struct into unified header filter struct. -func HeaderFilterFromGRPCMessage(m *acl.EACLRecord_Filter) *HeaderFilter { - if m == nil { - return nil +func (f *HeaderFilter) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*acl.EACLRecord_Filter) + if !ok { + return message.NewUnexpectedMessageType(m, v) } - f := new(HeaderFilter) + f.key = v.GetKey() + f.value = v.GetValue() + f.hdrType = HeaderTypeFromGRPCField(v.GetHeaderType()) + f.matchType = MatchTypeFromGRPCField(v.GetMatchType()) - f.SetHeaderType( - HeaderTypeFromGRPCField(m.GetHeaderType()), - ) - - f.SetMatchType( - MatchTypeFromGRPCField(m.GetMatchType()), - ) - - f.SetKey(m.GetKey()) - f.SetValue(m.GetValue()) - - return f + return nil } -// TargetToGRPCMessage converts unified role info struct into grpc struct. -func TargetToGRPCMessage(t *Target) *acl.EACLRecord_Target { - if t == nil { - return nil +func HeaderFiltersToGRPC(fs []*HeaderFilter) (res []*acl.EACLRecord_Filter) { + if fs != nil { + res = make([]*acl.EACLRecord_Filter, 0, len(fs)) + + for i := range fs { + res = append(res, fs[i].ToGRPCMessage().(*acl.EACLRecord_Filter)) + } } - m := new(acl.EACLRecord_Target) + return +} - m.SetRole( - RoleToGRPCField(t.GetRole()), - ) +func HeaderFiltersFromGRPC(fs []*acl.EACLRecord_Filter) (res []*HeaderFilter, err error) { + if fs != nil { + res = make([]*HeaderFilter, 0, len(fs)) - m.SetKeys(t.GetKeys()) + for i := range fs { + var x *HeaderFilter + + if fs[i] != nil { + x = new(HeaderFilter) + + err = x.FromGRPCMessage(fs[i]) + if err != nil { + return + } + } + + res = append(res, x) + } + } + + return +} + +func (t *Target) ToGRPCMessage() grpc.Message { + var m *acl.EACLRecord_Target + + if t != nil { + m = new(acl.EACLRecord_Target) + + m.SetRole(RoleToGRPCField(t.role)) + m.SetKeys(t.keys) + } return m } -// TargetInfoFromGRPCMessage converts grpc struct into unified role info struct. -func TargetInfoFromGRPCMessage(m *acl.EACLRecord_Target) *Target { - if m == nil { - return nil +func (t *Target) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*acl.EACLRecord_Target) + if !ok { + return message.NewUnexpectedMessageType(m, v) } - t := new(Target) + t.role = RoleFromGRPCField(v.GetRole()) + t.keys = v.GetKeys() - t.SetRole( - RoleFromGRPCField(m.GetRole()), - ) - - t.SetKeys(m.GetKeys()) - - return t + return nil } -// RecordToGRPCMessage converts unified acl record struct into grpc struct. -func RecordToGRPCMessage(r *Record) *acl.EACLRecord { - if r == nil { - return nil +func TargetsToGRPC(ts []*Target) (res []*acl.EACLRecord_Target) { + if ts != nil { + res = make([]*acl.EACLRecord_Target, 0, len(ts)) + + for i := range ts { + res = append(res, ts[i].ToGRPCMessage().(*acl.EACLRecord_Target)) + } } - m := new(acl.EACLRecord) + return +} - m.SetOperation( - OperationToGRPCField(r.GetOperation()), - ) +func TargetsFromGRPC(fs []*acl.EACLRecord_Target) (res []*Target, err error) { + if fs != nil { + res = make([]*Target, 0, len(fs)) - m.SetAction( - ActionToGRPCField(r.GetAction()), - ) + for i := range fs { + var x *Target - filters := r.GetFilters() - filterMsg := make([]*acl.EACLRecord_Filter, 0, len(filters)) + if fs[i] != nil { + x = new(Target) - for i := range filters { - filterMsg = append(filterMsg, HeaderFilterToGRPCMessage(filters[i])) + err = x.FromGRPCMessage(fs[i]) + if err != nil { + return + } + } + + res = append(res, x) + } } - m.SetFilters(filterMsg) + return +} - targets := r.GetTargets() - targetMsg := make([]*acl.EACLRecord_Target, 0, len(targets)) +func (r *Record) ToGRPCMessage() grpc.Message { + var m *acl.EACLRecord - for i := range targets { - targetMsg = append(targetMsg, TargetToGRPCMessage(targets[i])) + if r != nil { + m = new(acl.EACLRecord) + + m.SetOperation(OperationToGRPCField(r.op)) + m.SetAction(ActionToGRPCField(r.action)) + m.SetFilters(HeaderFiltersToGRPC(r.filters)) + m.SetTargets(TargetsToGRPC(r.targets)) } - m.SetTargets(targetMsg) - return m } -// RecordFromGRPCMessage converts grpc struct into unified acl record struct. -func RecordFromGRPCMessage(m *acl.EACLRecord) *Record { - if m == nil { - return nil +func (r *Record) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*acl.EACLRecord) + if !ok { + return message.NewUnexpectedMessageType(m, v) } - r := new(Record) + var err error - r.SetOperation( - OperationFromGRPCField(m.GetOperation()), - ) - - r.SetAction( - ActionFromGRPCField(m.GetAction()), - ) - - filterMsg := m.GetFilters() - filters := make([]*HeaderFilter, 0, len(filterMsg)) - - for i := range filterMsg { - filters = append(filters, HeaderFilterFromGRPCMessage(filterMsg[i])) + r.filters, err = HeaderFiltersFromGRPC(v.GetFilters()) + if err != nil { + return err } - r.SetFilters(filters) - - targetMsg := m.GetTargets() - targets := make([]*Target, 0, len(targetMsg)) - - for i := range targetMsg { - targets = append(targets, TargetInfoFromGRPCMessage(targetMsg[i])) + r.targets, err = TargetsFromGRPC(v.GetTargets()) + if err != nil { + return err } - r.SetTargets(targets) + r.op = OperationFromGRPCField(v.GetOperation()) + r.action = ActionFromGRPCField(v.GetAction()) - return r + return nil } -// TableToGRPCMessage converts unified acl table struct into grpc struct. -func TableToGRPCMessage(t *Table) *acl.EACLTable { - if t == nil { - return nil +func RecordsToGRPC(ts []*Record) (res []*acl.EACLRecord) { + if ts != nil { + res = make([]*acl.EACLRecord, 0, len(ts)) + + for i := range ts { + res = append(res, ts[i].ToGRPCMessage().(*acl.EACLRecord)) + } } - m := new(acl.EACLTable) + return +} - m.SetVersion( - refs.VersionToGRPCMessage(t.GetVersion()), - ) - m.SetContainerId( - refs.ContainerIDToGRPCMessage(t.GetContainerID()), - ) +func RecordsFromGRPC(fs []*acl.EACLRecord) (res []*Record, err error) { + if fs != nil { + res = make([]*Record, 0, len(fs)) - records := t.GetRecords() - recordMsg := make([]*acl.EACLRecord, 0, len(records)) + for i := range fs { + var x *Record - for i := range records { - recordMsg = append(recordMsg, RecordToGRPCMessage(records[i])) + if fs[i] != nil { + x = new(Record) + + err = x.FromGRPCMessage(fs[i]) + if err != nil { + return + } + } + + res = append(res, x) + } } - m.SetRecords(recordMsg) + return +} + +func (t *Table) ToGRPCMessage() grpc.Message { + var m *acl.EACLTable + + if t != nil { + m = new(acl.EACLTable) + + m.SetVersion(t.version.ToGRPCMessage().(*refsGRPC.Version)) + m.SetContainerId(t.cid.ToGRPCMessage().(*refsGRPC.ContainerID)) + m.SetRecords(RecordsToGRPC(t.records)) + } return m } -// TableFromGRPCMessage converts grpc struct into unified acl table struct. -func TableFromGRPCMessage(m *acl.EACLTable) *Table { - if m == nil { - return nil +func (t *Table) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*acl.EACLTable) + if !ok { + return message.NewUnexpectedMessageType(m, v) } - t := new(Table) + var err error - t.SetVersion( - refs.VersionFromGRPCMessage(m.GetVersion()), - ) - t.SetContainerID( - refs.ContainerIDFromGRPCMessage(m.GetContainerId()), - ) + cid := v.GetContainerId() + if cid == nil { + t.cid = nil + } else { + if t.cid == nil { + t.cid = new(refs.ContainerID) + } - recordMsg := m.GetRecords() - records := make([]*Record, 0, len(recordMsg)) - - for i := range recordMsg { - records = append(records, RecordFromGRPCMessage(recordMsg[i])) + err = t.cid.FromGRPCMessage(cid) + if err != nil { + return err + } } - t.SetRecords(records) + version := v.GetVersion() + if version == nil { + t.version = nil + } else { + if t.version == nil { + t.version = new(refs.Version) + } - return t + err = t.version.FromGRPCMessage(version) + if err != nil { + return err + } + } + + t.records, err = RecordsFromGRPC(v.GetRecords()) + + return err } -func TokenLifetimeToGRPCMessage(tl *TokenLifetime) *acl.BearerToken_Body_TokenLifetime { - if tl == nil { - return nil +func (l *TokenLifetime) ToGRPCMessage() grpc.Message { + var m *acl.BearerToken_Body_TokenLifetime + + if l != nil { + m = new(acl.BearerToken_Body_TokenLifetime) + + m.SetExp(l.exp) + m.SetIat(l.iat) + m.SetNbf(l.nbf) } - m := new(acl.BearerToken_Body_TokenLifetime) - - m.SetExp(tl.GetExp()) - m.SetNbf(tl.GetNbf()) - m.SetIat(tl.GetIat()) - return m } -func TokenLifetimeFromGRPCMessage(m *acl.BearerToken_Body_TokenLifetime) *TokenLifetime { - if m == nil { - return nil +func (l *TokenLifetime) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*acl.BearerToken_Body_TokenLifetime) + if !ok { + return message.NewUnexpectedMessageType(m, v) } - tl := new(TokenLifetime) + l.exp = v.GetExp() + l.iat = v.GetIat() + l.nbf = v.GetNbf() - tl.SetExp(m.GetExp()) - tl.SetNbf(m.GetNbf()) - tl.SetIat(m.GetIat()) - - return tl + return nil } -func BearerTokenBodyToGRPCMessage(v *BearerTokenBody) *acl.BearerToken_Body { - if v == nil { - return nil +func (bt *BearerTokenBody) ToGRPCMessage() grpc.Message { + var m *acl.BearerToken_Body + + if bt != nil { + m = new(acl.BearerToken_Body) + + m.SetOwnerId(bt.ownerID.ToGRPCMessage().(*refsGRPC.OwnerID)) + m.SetLifetime(bt.lifetime.ToGRPCMessage().(*acl.BearerToken_Body_TokenLifetime)) + m.SetEaclTable(bt.eacl.ToGRPCMessage().(*acl.EACLTable)) } - m := new(acl.BearerToken_Body) - - m.SetEaclTable( - TableToGRPCMessage(v.GetEACL()), - ) - - m.SetOwnerId( - refs.OwnerIDToGRPCMessage(v.GetOwnerID()), - ) - - m.SetLifetime( - TokenLifetimeToGRPCMessage(v.GetLifetime()), - ) - return m } -func BearerTokenBodyFromGRPCMessage(m *acl.BearerToken_Body) *BearerTokenBody { - if m == nil { - return nil +func (bt *BearerTokenBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*acl.BearerToken_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) } - bt := new(BearerTokenBody) + var err error - bt.SetEACL( - TableFromGRPCMessage(m.GetEaclTable()), - ) + ownerID := v.GetOwnerId() + if ownerID == nil { + bt.ownerID = nil + } else { + if bt.ownerID == nil { + bt.ownerID = new(refs.OwnerID) + } - bt.SetOwnerID( - refs.OwnerIDFromGRPCMessage(m.GetOwnerId()), - ) + err = bt.ownerID.FromGRPCMessage(ownerID) + if err != nil { + return err + } + } - bt.SetLifetime( - TokenLifetimeFromGRPCMessage(m.GetLifetime()), - ) + lifetime := v.GetLifetime() + if lifetime == nil { + bt.lifetime = nil + } else { + if bt.lifetime == nil { + bt.lifetime = new(TokenLifetime) + } - return bt + err = bt.lifetime.FromGRPCMessage(lifetime) + if err != nil { + return err + } + } + + eacl := v.GetEaclTable() + if eacl == nil { + bt.eacl = nil + } else { + if bt.eacl == nil { + bt.eacl = new(Table) + } + + err = bt.eacl.FromGRPCMessage(eacl) + } + + return err } -func BearerTokenToGRPCMessage(t *BearerToken) *acl.BearerToken { - if t == nil { - return nil +func (bt *BearerToken) ToGRPCMessage() grpc.Message { + var m *acl.BearerToken + + if bt != nil { + m = new(acl.BearerToken) + + m.SetBody(bt.body.ToGRPCMessage().(*acl.BearerToken_Body)) + m.SetSignature(bt.sig.ToGRPCMessage().(*refsGRPC.Signature)) } - m := new(acl.BearerToken) - - m.SetBody( - BearerTokenBodyToGRPCMessage(t.GetBody()), - ) - - m.SetSignature( - refs.SignatureToGRPCMessage(t.GetSignature()), - ) - return m } -func BearerTokenFromGRPCMessage(m *acl.BearerToken) *BearerToken { - if m == nil { - return nil +func (bt *BearerToken) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*acl.BearerToken) + if !ok { + return message.NewUnexpectedMessageType(m, v) } - bt := new(BearerToken) + var err error - bt.SetBody( - BearerTokenBodyFromGRPCMessage(m.GetBody()), - ) + body := v.GetBody() + if body == nil { + bt.body = nil + } else { + if bt.body == nil { + bt.body = new(BearerTokenBody) + } - bt.SetSignature( - refs.SignatureFromGRPCMessage(m.GetSignature()), - ) + err = bt.body.FromGRPCMessage(body) + if err != nil { + return err + } + } - return bt + sig := v.GetSignature() + if sig == nil { + bt.sig = nil + } else { + if bt.sig == nil { + bt.sig = new(refs.Signature) + } + + err = bt.sig.FromGRPCMessage(sig) + } + + return err } diff --git a/v2/acl/json.go b/v2/acl/json.go index 91f2d32..1a3cacd 100644 --- a/v2/acl/json.go +++ b/v2/acl/json.go @@ -1,146 +1,62 @@ package acl import ( + "github.com/nspcc-dev/neofs-api-go/rpc/message" acl "github.com/nspcc-dev/neofs-api-go/v2/acl/grpc" - "google.golang.org/protobuf/encoding/protojson" ) func (f *HeaderFilter) MarshalJSON() ([]byte, error) { - return protojson.MarshalOptions{ - EmitUnpopulated: true, - }.Marshal( - HeaderFilterToGRPCMessage(f), - ) + return message.MarshalJSON(f) } func (f *HeaderFilter) UnmarshalJSON(data []byte) error { - msg := new(acl.EACLRecord_Filter) - - if err := protojson.Unmarshal(data, msg); err != nil { - return err - } - - *f = *HeaderFilterFromGRPCMessage(msg) - - return nil + return message.UnmarshalJSON(f, data, new(acl.EACLRecord_Filter)) } func (t *Target) MarshalJSON() ([]byte, error) { - return protojson.MarshalOptions{ - EmitUnpopulated: true, - }.Marshal( - TargetToGRPCMessage(t), - ) + return message.MarshalJSON(t) } func (t *Target) UnmarshalJSON(data []byte) error { - msg := new(acl.EACLRecord_Target) - - if err := protojson.Unmarshal(data, msg); err != nil { - return err - } - - *t = *TargetInfoFromGRPCMessage(msg) - - return nil + return message.UnmarshalJSON(t, data, new(acl.EACLRecord_Target)) } func (r *Record) MarshalJSON() ([]byte, error) { - return protojson.MarshalOptions{ - EmitUnpopulated: true, - }.Marshal( - RecordToGRPCMessage(r), - ) + return message.MarshalJSON(r) } func (r *Record) UnmarshalJSON(data []byte) error { - msg := new(acl.EACLRecord) - - if err := protojson.Unmarshal(data, msg); err != nil { - return err - } - - *r = *RecordFromGRPCMessage(msg) - - return nil + return message.UnmarshalJSON(r, data, new(acl.EACLRecord)) } func (t *Table) MarshalJSON() ([]byte, error) { - return protojson.MarshalOptions{ - EmitUnpopulated: true, - }.Marshal( - TableToGRPCMessage(t), - ) + return message.MarshalJSON(t) } func (t *Table) UnmarshalJSON(data []byte) error { - msg := new(acl.EACLTable) - - if err := protojson.Unmarshal(data, msg); err != nil { - return err - } - - *t = *TableFromGRPCMessage(msg) - - return nil + return message.UnmarshalJSON(t, data, new(acl.EACLTable)) } func (l *TokenLifetime) MarshalJSON() ([]byte, error) { - return protojson.MarshalOptions{ - EmitUnpopulated: true, - }.Marshal( - TokenLifetimeToGRPCMessage(l), - ) + return message.MarshalJSON(l) } func (l *TokenLifetime) UnmarshalJSON(data []byte) error { - msg := new(acl.BearerToken_Body_TokenLifetime) - - if err := protojson.Unmarshal(data, msg); err != nil { - return err - } - - *l = *TokenLifetimeFromGRPCMessage(msg) - - return nil + return message.UnmarshalJSON(l, data, new(acl.BearerToken_Body_TokenLifetime)) } func (bt *BearerTokenBody) MarshalJSON() ([]byte, error) { - return protojson.MarshalOptions{ - EmitUnpopulated: true, - }.Marshal( - BearerTokenBodyToGRPCMessage(bt), - ) + return message.MarshalJSON(bt) } func (bt *BearerTokenBody) UnmarshalJSON(data []byte) error { - msg := new(acl.BearerToken_Body) - - if err := protojson.Unmarshal(data, msg); err != nil { - return err - } - - *bt = *BearerTokenBodyFromGRPCMessage(msg) - - return nil + return message.UnmarshalJSON(bt, data, new(acl.BearerToken_Body)) } func (bt *BearerToken) MarshalJSON() ([]byte, error) { - return protojson.MarshalOptions{ - EmitUnpopulated: true, - }.Marshal( - BearerTokenToGRPCMessage(bt), - ) + return message.MarshalJSON(bt) } func (bt *BearerToken) UnmarshalJSON(data []byte) error { - msg := new(acl.BearerToken) - - if err := protojson.Unmarshal(data, msg); err != nil { - return err - } - - *bt = *BearerTokenFromGRPCMessage(msg) - - return nil + return message.UnmarshalJSON(bt, data, new(acl.BearerToken)) } diff --git a/v2/acl/json_test.go b/v2/acl/json_test.go deleted file mode 100644 index 6d95755..0000000 --- a/v2/acl/json_test.go +++ /dev/null @@ -1,81 +0,0 @@ -package acl_test - -import ( - "testing" - - "github.com/nspcc-dev/neofs-api-go/v2/acl" - "github.com/stretchr/testify/require" -) - -func TestBearerTokenJSON(t *testing.T) { - b := generateBearerToken("id") - - data, err := b.MarshalJSON() - require.NoError(t, err) - - b2 := new(acl.BearerToken) - require.NoError(t, b2.UnmarshalJSON(data)) - - require.Equal(t, b, b2) -} - -func TestFilterJSON(t *testing.T) { - f := generateFilter(acl.HeaderTypeObject, "key", "value") - - data, err := f.MarshalJSON() - require.NoError(t, err) - - f2 := new(acl.HeaderFilter) - require.NoError(t, f2.UnmarshalJSON(data)) - - require.Equal(t, f, f2) -} - -func TestTargetJSON(t *testing.T) { - tar := generateTarget(acl.RoleSystem, 3) - - data, err := tar.MarshalJSON() - require.NoError(t, err) - - tar2 := new(acl.Target) - require.NoError(t, tar2.UnmarshalJSON(data)) - - require.Equal(t, tar, tar2) -} - -func TestTable_MarshalJSON(t *testing.T) { - tab := new(acl.Table) - tab.SetRecords([]*acl.Record{generateRecord(false)}) - - data, err := tab.MarshalJSON() - require.NoError(t, err) - - tab2 := new(acl.Table) - require.NoError(t, tab2.UnmarshalJSON(data)) - - require.Equal(t, tab, tab2) -} - -func TestTokenLifetimeJSON(t *testing.T) { - l := generateLifetime(1, 2, 3) - - data, err := l.MarshalJSON() - require.NoError(t, err) - - l2 := new(acl.TokenLifetime) - require.NoError(t, l2.UnmarshalJSON(data)) - - require.Equal(t, l, l2) -} - -func TestBearerTokenBodyJSON(t *testing.T) { - b := generateBearerTokenBody("id") - - data, err := b.MarshalJSON() - require.NoError(t, err) - - b2 := new(acl.BearerTokenBody) - require.NoError(t, b2.UnmarshalJSON(data)) - - require.Equal(t, b, b2) -} diff --git a/v2/acl/marshal.go b/v2/acl/marshal.go index f477848..15a317d 100644 --- a/v2/acl/marshal.go +++ b/v2/acl/marshal.go @@ -1,9 +1,9 @@ package acl import ( + "github.com/nspcc-dev/neofs-api-go/rpc/message" protoutil "github.com/nspcc-dev/neofs-api-go/util/proto" acl "github.com/nspcc-dev/neofs-api-go/v2/acl/grpc" - "google.golang.org/protobuf/proto" ) const ( @@ -95,14 +95,7 @@ func (t *Table) StableSize() (size int) { } func (t *Table) Unmarshal(data []byte) error { - m := new(acl.EACLTable) - if err := proto.Unmarshal(data, m); err != nil { - return err - } - - *t = *TableFromGRPCMessage(m) - - return nil + return message.Unmarshal(t, data, new(acl.EACLTable)) } // StableMarshal marshals unified acl record structure in a protobuf @@ -177,14 +170,7 @@ func (r *Record) StableSize() (size int) { } func (r *Record) Unmarshal(data []byte) error { - m := new(acl.EACLRecord) - if err := proto.Unmarshal(data, m); err != nil { - return err - } - - *r = *RecordFromGRPCMessage(m) - - return nil + return message.Unmarshal(r, data, new(acl.EACLRecord)) } // StableMarshal marshals unified header filter structure in a protobuf @@ -247,14 +233,7 @@ func (f *HeaderFilter) StableSize() (size int) { } func (f *HeaderFilter) Unmarshal(data []byte) error { - m := new(acl.EACLRecord_Filter) - if err := proto.Unmarshal(data, m); err != nil { - return err - } - - *f = *HeaderFilterFromGRPCMessage(m) - - return nil + return message.Unmarshal(f, data, new(acl.EACLRecord_Filter)) } // StableMarshal marshals unified role info structure in a protobuf @@ -301,14 +280,7 @@ func (t *Target) StableSize() (size int) { } func (t *Target) Unmarshal(data []byte) error { - m := new(acl.EACLRecord_Target) - if err := proto.Unmarshal(data, m); err != nil { - return err - } - - *t = *TargetInfoFromGRPCMessage(m) - - return nil + return message.Unmarshal(t, data, new(acl.EACLRecord_Target)) } func (l *TokenLifetime) StableMarshal(buf []byte) ([]byte, error) { @@ -360,14 +332,7 @@ func (l *TokenLifetime) StableSize() (size int) { } func (l *TokenLifetime) Unmarshal(data []byte) error { - m := new(acl.BearerToken_Body_TokenLifetime) - if err := proto.Unmarshal(data, m); err != nil { - return err - } - - *l = *TokenLifetimeFromGRPCMessage(m) - - return nil + return message.Unmarshal(l, data, new(acl.BearerToken_Body_TokenLifetime)) } func (bt *BearerTokenBody) StableMarshal(buf []byte) ([]byte, error) { @@ -419,14 +384,7 @@ func (bt *BearerTokenBody) StableSize() (size int) { } func (bt *BearerTokenBody) Unmarshal(data []byte) error { - m := new(acl.BearerToken_Body) - if err := proto.Unmarshal(data, m); err != nil { - return err - } - - *bt = *BearerTokenBodyFromGRPCMessage(m) - - return nil + return message.Unmarshal(bt, data, new(acl.BearerToken_Body)) } func (bt *BearerToken) StableMarshal(buf []byte) ([]byte, error) { @@ -470,12 +428,5 @@ func (bt *BearerToken) StableSize() (size int) { } func (bt *BearerToken) Unmarshal(data []byte) error { - m := new(acl.BearerToken) - if err := proto.Unmarshal(data, m); err != nil { - return err - } - - *bt = *BearerTokenFromGRPCMessage(m) - - return nil + return message.Unmarshal(bt, data, new(acl.BearerToken)) } diff --git a/v2/acl/marshal_test.go b/v2/acl/marshal_test.go deleted file mode 100644 index 8b85411..0000000 --- a/v2/acl/marshal_test.go +++ /dev/null @@ -1,237 +0,0 @@ -package acl_test - -import ( - "fmt" - "testing" - - "github.com/nspcc-dev/neofs-api-go/v2/acl" - "github.com/nspcc-dev/neofs-api-go/v2/refs" - "github.com/stretchr/testify/require" -) - -func generateTarget(u acl.Role, k int) *acl.Target { - target := new(acl.Target) - target.SetRole(u) - - keys := make([][]byte, k) - - for i := 0; i < k; i++ { - s := fmt.Sprintf("Public Key %d", i+1) - keys[i] = []byte(s) - } - - return target -} - -func generateFilter(t acl.HeaderType, k, v string) *acl.HeaderFilter { - filter := new(acl.HeaderFilter) - filter.SetHeaderType(t) - filter.SetMatchType(acl.MatchTypeStringEqual) - filter.SetKey(k) - filter.SetValue(v) - - return filter -} - -func generateRecord(another bool) *acl.Record { - record := new(acl.Record) - - switch another { - case true: - t1 := generateTarget(acl.RoleUser, 2) - f1 := generateFilter(acl.HeaderTypeObject, "OID", "ObjectID Value") - - record.SetOperation(acl.OperationHead) - record.SetAction(acl.ActionDeny) - record.SetTargets([]*acl.Target{t1}) - record.SetFilters([]*acl.HeaderFilter{f1}) - default: - t1 := generateTarget(acl.RoleUser, 2) - t2 := generateTarget(acl.RoleSystem, 0) - f1 := generateFilter(acl.HeaderTypeObject, "CID", "Container ID Value") - f2 := generateFilter(acl.HeaderTypeRequest, "X-Header-Key", "X-Header-Value") - - record.SetOperation(acl.OperationPut) - record.SetAction(acl.ActionAllow) - record.SetTargets([]*acl.Target{t1, t2}) - record.SetFilters([]*acl.HeaderFilter{f1, f2}) - } - - return record -} - -func generateEACL() *acl.Table { - cid := new(refs.ContainerID) - cid.SetValue([]byte("Container ID")) - - ver := new(refs.Version) - ver.SetMajor(2) - ver.SetMinor(3) - - table := new(acl.Table) - table.SetVersion(ver) - table.SetContainerID(cid) - table.SetRecords([]*acl.Record{generateRecord(true)}) - - return table -} - -func generateSignature(k, v string) *refs.Signature { - sig := new(refs.Signature) - sig.SetKey([]byte(k)) - sig.SetSign([]byte(v)) - - return sig -} - -func generateLifetime(exp, nbf, iat uint64) *acl.TokenLifetime { - lifetime := new(acl.TokenLifetime) - lifetime.SetExp(exp) - lifetime.SetNbf(nbf) - lifetime.SetIat(iat) - - return lifetime -} - -func generateBearerTokenBody(id string) *acl.BearerTokenBody { - owner := new(refs.OwnerID) - owner.SetValue([]byte(id)) - - tokenBody := new(acl.BearerTokenBody) - tokenBody.SetOwnerID(owner) - tokenBody.SetLifetime(generateLifetime(1, 2, 3)) - tokenBody.SetEACL(generateEACL()) - - return tokenBody -} - -func generateBearerToken(id string) *acl.BearerToken { - bearerToken := new(acl.BearerToken) - bearerToken.SetBody(generateBearerTokenBody(id)) - bearerToken.SetSignature(generateSignature("id", id)) - - return bearerToken -} - -func TestHeaderFilter_StableMarshal(t *testing.T) { - filterFrom := generateFilter(acl.HeaderTypeObject, "CID", "Container ID Value") - - t.Run("non empty", func(t *testing.T) { - filterFrom.SetHeaderType(acl.HeaderTypeObject) - filterFrom.SetMatchType(acl.MatchTypeStringEqual) - filterFrom.SetKey("Hello") - filterFrom.SetValue("World") - - wire, err := filterFrom.StableMarshal(nil) - require.NoError(t, err) - - filterTo := new(acl.HeaderFilter) - require.NoError(t, filterTo.Unmarshal(wire)) - - require.Equal(t, filterFrom, filterTo) - }) -} - -func TestTargetInfo_StableMarshal(t *testing.T) { - targetFrom := generateTarget(acl.RoleUser, 2) - - t.Run("non empty", func(t *testing.T) { - targetFrom.SetRole(acl.RoleUser) - targetFrom.SetKeys([][]byte{ - []byte("Public Key 1"), - []byte("Public Key 2"), - }) - - wire, err := targetFrom.StableMarshal(nil) - require.NoError(t, err) - - targetTo := new(acl.Target) - require.NoError(t, targetTo.Unmarshal(wire)) - - require.Equal(t, targetFrom, targetTo) - }) -} - -func TestRecord_StableMarshal(t *testing.T) { - recordFrom := generateRecord(false) - - t.Run("non empty", func(t *testing.T) { - wire, err := recordFrom.StableMarshal(nil) - require.NoError(t, err) - - to := new(acl.Record) - require.NoError(t, to.Unmarshal(wire)) - - require.Equal(t, recordFrom, to) - }) -} - -func TestTable_StableMarshal(t *testing.T) { - tableFrom := new(acl.Table) - - t.Run("non empty", func(t *testing.T) { - cid := new(refs.ContainerID) - cid.SetValue([]byte("Container ID")) - - ver := new(refs.Version) - ver.SetMajor(2) - ver.SetMinor(3) - - r1 := generateRecord(false) - r2 := generateRecord(true) - - tableFrom.SetVersion(ver) - tableFrom.SetContainerID(cid) - tableFrom.SetRecords([]*acl.Record{r1, r2}) - - wire, err := tableFrom.StableMarshal(nil) - require.NoError(t, err) - - tableTo := new(acl.Table) - require.NoError(t, tableTo.Unmarshal(wire)) - - require.Equal(t, tableFrom, tableTo) - }) -} - -func TestTokenLifetime_StableMarshal(t *testing.T) { - lifetimeFrom := generateLifetime(10, 20, 30) - - t.Run("non empty", func(t *testing.T) { - wire, err := lifetimeFrom.StableMarshal(nil) - require.NoError(t, err) - - lifetimeTo := new(acl.TokenLifetime) - require.NoError(t, lifetimeTo.Unmarshal(wire)) - - require.Equal(t, lifetimeFrom, lifetimeTo) - }) -} - -func TestBearerTokenBody_StableMarshal(t *testing.T) { - bearerTokenBodyFrom := generateBearerTokenBody("Bearer Token Body") - - t.Run("non empty", func(t *testing.T) { - wire, err := bearerTokenBodyFrom.StableMarshal(nil) - require.NoError(t, err) - - bearerTokenBodyTo := new(acl.BearerTokenBody) - require.NoError(t, bearerTokenBodyTo.Unmarshal(wire)) - - require.Equal(t, bearerTokenBodyFrom, bearerTokenBodyTo) - }) -} - -func TestBearerToken_StableMarshal(t *testing.T) { - bearerTokenFrom := generateBearerToken("Bearer Token") - - t.Run("non empty", func(t *testing.T) { - wire, err := bearerTokenFrom.StableMarshal(nil) - require.NoError(t, err) - - bearerTokenTo := new(acl.BearerToken) - require.NoError(t, bearerTokenTo.Unmarshal(wire)) - - require.Equal(t, bearerTokenFrom, bearerTokenTo) - }) -} diff --git a/v2/acl/message_test.go b/v2/acl/message_test.go new file mode 100644 index 0000000..bb6d991 --- /dev/null +++ b/v2/acl/message_test.go @@ -0,0 +1,21 @@ +package acl_test + +import ( + "testing" + + "github.com/nspcc-dev/neofs-api-go/rpc/message" + messagetest "github.com/nspcc-dev/neofs-api-go/rpc/message/test" + acltest "github.com/nspcc-dev/neofs-api-go/v2/acl/test" +) + +func TestMessageConvert(t *testing.T) { + messagetest.TestRPCMessage(t, + func(empty bool) message.Message { return acltest.GenerateFilter(empty) }, + func(empty bool) message.Message { return acltest.GenerateTarget(empty) }, + func(empty bool) message.Message { return acltest.GenerateRecord(empty) }, + func(empty bool) message.Message { return acltest.GenerateTable(empty) }, + func(empty bool) message.Message { return acltest.GenerateTokenLifetime(empty) }, + func(empty bool) message.Message { return acltest.GenerateBearerTokenBody(empty) }, + func(empty bool) message.Message { return acltest.GenerateBearerToken(empty) }, + ) +} diff --git a/v2/acl/test/generate.go b/v2/acl/test/generate.go new file mode 100644 index 0000000..3b1e1a7 --- /dev/null +++ b/v2/acl/test/generate.go @@ -0,0 +1,124 @@ +package acltest + +import ( + "github.com/nspcc-dev/neofs-api-go/v2/acl" + accountingtest "github.com/nspcc-dev/neofs-api-go/v2/refs/test" +) + +func GenerateBearerToken(empty bool) *acl.BearerToken { + m := new(acl.BearerToken) + + m.SetBody(GenerateBearerTokenBody(empty)) + m.SetSignature(accountingtest.GenerateSignature(empty)) + + return m +} + +func GenerateBearerTokenBody(empty bool) *acl.BearerTokenBody { + m := new(acl.BearerTokenBody) + + m.SetOwnerID(accountingtest.GenerateOwnerID(empty)) + m.SetEACL(GenerateTable(empty)) + m.SetLifetime(GenerateTokenLifetime(empty)) + + return m +} + +func GenerateTable(empty bool) *acl.Table { + m := new(acl.Table) + + m.SetRecords(GenerateRecords(empty)) + m.SetContainerID(accountingtest.GenerateContainerID(empty)) + m.SetVersion(accountingtest.GenerateVersion(empty)) + + return m +} + +func GenerateRecords(empty bool) []*acl.Record { + rs := make([]*acl.Record, 0) + + if !empty { + rs = append(rs, + GenerateRecord(false), + GenerateRecord(false), + ) + } + + return rs +} + +func GenerateRecord(empty bool) *acl.Record { + m := new(acl.Record) + + if !empty { + m.SetAction(acl.ActionAllow) + m.SetOperation(acl.OperationGet) + } + + m.SetFilters(GenerateFilters(empty)) + m.SetTargets(GenerateTargets(empty)) + + return m +} + +func GenerateFilters(empty bool) []*acl.HeaderFilter { + fs := make([]*acl.HeaderFilter, 0) + + if !empty { + fs = append(fs, + GenerateFilter(false), + GenerateFilter(false), + ) + } + + return fs +} + +func GenerateFilter(empty bool) *acl.HeaderFilter { + m := new(acl.HeaderFilter) + + if !empty { + m.SetKey("key") + m.SetValue("val") + m.SetHeaderType(acl.HeaderTypeRequest) + m.SetMatchType(acl.MatchTypeStringEqual) + } + + return m +} + +func GenerateTargets(empty bool) []*acl.Target { + ts := make([]*acl.Target, 0) + + if !empty { + ts = append(ts, + GenerateTarget(false), + GenerateTarget(false), + ) + } + + return ts +} + +func GenerateTarget(empty bool) *acl.Target { + m := new(acl.Target) + + if !empty { + m.SetRole(acl.RoleSystem) + m.SetKeys([][]byte{{1}, {2}}) + } + + return m +} + +func GenerateTokenLifetime(empty bool) *acl.TokenLifetime { + m := new(acl.TokenLifetime) + + if !empty { + m.SetExp(1) + m.SetIat(2) + m.SetExp(3) + } + + return m +} diff --git a/v2/audit/convert.go b/v2/audit/convert.go index 6402041..1b2a998 100644 --- a/v2/audit/convert.go +++ b/v2/audit/convert.go @@ -1,94 +1,94 @@ package audit import ( + "github.com/nspcc-dev/neofs-api-go/rpc/grpc" + "github.com/nspcc-dev/neofs-api-go/rpc/message" audit "github.com/nspcc-dev/neofs-api-go/v2/audit/grpc" "github.com/nspcc-dev/neofs-api-go/v2/refs" + refsGRPC "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" ) -// DataAuditResultToGRPCMessage converts unified DataAuditResult structure -// into gRPC DataAuditResult message. -func DataAuditResultToGRPCMessage(a *DataAuditResult) *audit.DataAuditResult { - if a == nil { - return nil +func (a *DataAuditResult) ToGRPCMessage() grpc.Message { + var m *audit.DataAuditResult + + if a != nil { + m = new(audit.DataAuditResult) + + m.SetAuditEpoch(a.auditEpoch) + m.SetPublicKey(a.pubKey) + m.SetContainerId(a.cid.ToGRPCMessage().(*refsGRPC.ContainerID)) + m.SetComplete(a.complete) + m.SetVersion(a.version.ToGRPCMessage().(*refsGRPC.Version)) + m.SetPassNodes(a.passNodes) + m.SetFailNodes(a.failNodes) + m.SetRetries(a.retries) + m.SetRequests(a.requests) + m.SetHit(a.hit) + m.SetMiss(a.miss) + m.SetFail(a.fail) + m.SetPassSg(refs.ObjectIDListToGRPCMessage(a.passSG)) + m.SetFailSg(refs.ObjectIDListToGRPCMessage(a.failSG)) } - m := new(audit.DataAuditResult) - - m.SetVersion( - refs.VersionToGRPCMessage(a.GetVersion()), - ) - - m.SetAuditEpoch(a.GetAuditEpoch()) - - m.SetContainerId( - refs.ContainerIDToGRPCMessage(a.GetContainerID()), - ) - - m.SetPublicKey(a.GetPublicKey()) - - m.SetComplete(a.GetComplete()) - - m.SetPassSg( - refs.ObjectIDListToGRPCMessage(a.GetPassSG()), - ) - - m.SetFailSg( - refs.ObjectIDListToGRPCMessage(a.GetFailSG()), - ) - - m.SetRequests(a.GetRequests()) - m.SetRetries(a.GetRetries()) - - m.SetHit(a.GetHit()) - m.SetMiss(a.GetMiss()) - m.SetFail(a.GetFail()) - - m.SetPassNodes(a.GetPassNodes()) - m.SetFailNodes(a.GetFailNodes()) - return m } -// DataAuditResultFromGRPCMessage converts gRPC message DataAuditResult -// into unified DataAuditResult structure. -func DataAuditResultFromGRPCMessage(m *audit.DataAuditResult) *DataAuditResult { - if m == nil { - return nil +func (a *DataAuditResult) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*audit.DataAuditResult) + if !ok { + return message.NewUnexpectedMessageType(m, v) } - a := new(DataAuditResult) + var err error - a.SetVersion( - refs.VersionFromGRPCMessage(m.GetVersion()), - ) + cid := v.GetContainerId() + if cid == nil { + a.cid = nil + } else { + if a.cid == nil { + a.cid = new(refs.ContainerID) + } - a.SetAuditEpoch(m.GetAuditEpoch()) + err = a.cid.FromGRPCMessage(cid) + if err != nil { + return err + } + } - a.SetContainerID( - refs.ContainerIDFromGRPCMessage(m.GetContainerId()), - ) + version := v.GetVersion() + if version == nil { + a.version = nil + } else { + if a.version == nil { + a.version = new(refs.Version) + } - a.SetPublicKey(m.GetPublicKey()) + err = a.version.FromGRPCMessage(version) + if err != nil { + return err + } + } - a.SetComplete(m.GetComplete()) + a.passSG, err = refs.ObjectIDListFromGRPCMessage(v.GetPassSg()) + if err != nil { + return err + } - a.SetPassSG( - refs.ObjectIDListFromGRPCMessage(m.GetPassSg()), - ) + a.failSG, err = refs.ObjectIDListFromGRPCMessage(v.GetFailSg()) + if err != nil { + return err + } - a.SetFailSG( - refs.ObjectIDListFromGRPCMessage(m.GetFailSg()), - ) + a.auditEpoch = v.GetAuditEpoch() + a.pubKey = v.GetPublicKey() + a.complete = v.GetComplete() + a.passNodes = v.GetPassNodes() + a.failNodes = v.GetFailNodes() + a.retries = v.GetRetries() + a.requests = v.GetRequests() + a.hit = v.GetHit() + a.miss = v.GetMiss() + a.fail = v.GetFail() - a.SetRequests(m.GetRequests()) - a.SetRetries(m.GetRetries()) - - a.SetHit(m.GetHit()) - a.SetMiss(m.GetMiss()) - a.SetFail(m.GetFail()) - - a.SetPassNodes(m.GetPassNodes()) - a.SetFailNodes(m.GetFailNodes()) - - return a + return err } diff --git a/v2/audit/json.go b/v2/audit/json.go index 80cb33a..b119aa1 100644 --- a/v2/audit/json.go +++ b/v2/audit/json.go @@ -1,26 +1,14 @@ package audit import ( + "github.com/nspcc-dev/neofs-api-go/rpc/message" audit "github.com/nspcc-dev/neofs-api-go/v2/audit/grpc" - "google.golang.org/protobuf/encoding/protojson" ) func (a *DataAuditResult) MarshalJSON() ([]byte, error) { - return protojson.MarshalOptions{ - EmitUnpopulated: true, - }.Marshal( - DataAuditResultToGRPCMessage(a), - ) + return message.MarshalJSON(a) } func (a *DataAuditResult) UnmarshalJSON(data []byte) error { - msg := new(audit.DataAuditResult) - - if err := protojson.Unmarshal(data, msg); err != nil { - return err - } - - *a = *DataAuditResultFromGRPCMessage(msg) - - return nil + return message.UnmarshalJSON(a, data, new(audit.DataAuditResult)) } diff --git a/v2/audit/json_test.go b/v2/audit/json_test.go deleted file mode 100644 index f1cae45..0000000 --- a/v2/audit/json_test.go +++ /dev/null @@ -1,20 +0,0 @@ -package audit_test - -import ( - "testing" - - "github.com/nspcc-dev/neofs-api-go/v2/audit" - "github.com/stretchr/testify/require" -) - -func TestDataAuditResultJSON(t *testing.T) { - a := generateDataAuditResult() - - data, err := a.MarshalJSON() - require.NoError(t, err) - - a2 := new(audit.DataAuditResult) - require.NoError(t, a2.UnmarshalJSON(data)) - - require.Equal(t, a, a2) -} diff --git a/v2/audit/marshal.go b/v2/audit/marshal.go index 5ea8ef5..e1c1b53 100644 --- a/v2/audit/marshal.go +++ b/v2/audit/marshal.go @@ -1,10 +1,10 @@ package audit import ( + "github.com/nspcc-dev/neofs-api-go/rpc/message" "github.com/nspcc-dev/neofs-api-go/util/proto" audit "github.com/nspcc-dev/neofs-api-go/v2/audit/grpc" "github.com/nspcc-dev/neofs-api-go/v2/refs" - goproto "google.golang.org/protobuf/proto" ) const ( @@ -168,12 +168,5 @@ func (a *DataAuditResult) StableSize() (size int) { // Unmarshal unmarshals DataAuditResult structure from its protobuf // binary representation. func (a *DataAuditResult) Unmarshal(data []byte) error { - m := new(audit.DataAuditResult) - if err := goproto.Unmarshal(data, m); err != nil { - return err - } - - *a = *DataAuditResultFromGRPCMessage(m) - - return nil + return message.Unmarshal(a, data, new(audit.DataAuditResult)) } diff --git a/v2/audit/marshal_test.go b/v2/audit/marshal_test.go deleted file mode 100644 index bac2dbe..0000000 --- a/v2/audit/marshal_test.go +++ /dev/null @@ -1,63 +0,0 @@ -package audit_test - -import ( - "testing" - - "github.com/nspcc-dev/neofs-api-go/v2/audit" - "github.com/nspcc-dev/neofs-api-go/v2/refs" - "github.com/stretchr/testify/require" -) - -func TestDataAuditResult_StableMarshal(t *testing.T) { - from := generateDataAuditResult() - - t.Run("non empty", func(t *testing.T) { - wire, err := from.StableMarshal(nil) - require.NoError(t, err) - - to := new(audit.DataAuditResult) - require.NoError(t, to.Unmarshal(wire)) - - require.Equal(t, from, to) - }) -} - -func generateDataAuditResult() *audit.DataAuditResult { - a := new(audit.DataAuditResult) - - v := new(refs.Version) - v.SetMajor(2) - v.SetMinor(1) - - oid1 := new(refs.ObjectID) - oid1.SetValue([]byte("Object ID 1")) - - oid2 := new(refs.ObjectID) - oid2.SetValue([]byte("Object ID 2")) - - cid := new(refs.ContainerID) - cid.SetValue([]byte("Container ID")) - - a.SetVersion(v) - a.SetAuditEpoch(13) - a.SetContainerID(cid) - a.SetPublicKey([]byte("Public key")) - a.SetComplete(true) - a.SetRequests(10) - a.SetRetries(9) - a.SetPassSG([]*refs.ObjectID{oid1, oid2}) - a.SetFailSG([]*refs.ObjectID{oid2, oid1}) - a.SetHit(1) - a.SetMiss(2) - a.SetFail(3) - a.SetPassNodes([][]byte{ - {1, 2}, - {3, 4}, - }) - a.SetFailNodes([][]byte{ - {5, 6}, - {7, 8}, - }) - - return a -} diff --git a/v2/audit/message_test.go b/v2/audit/message_test.go new file mode 100644 index 0000000..dbfc7b7 --- /dev/null +++ b/v2/audit/message_test.go @@ -0,0 +1,15 @@ +package audit_test + +import ( + "testing" + + "github.com/nspcc-dev/neofs-api-go/rpc/message" + messagetest "github.com/nspcc-dev/neofs-api-go/rpc/message/test" + audittest "github.com/nspcc-dev/neofs-api-go/v2/audit/test" +) + +func TestMessageConvert(t *testing.T) { + messagetest.TestRPCMessage(t, + func(empty bool) message.Message { return audittest.GenerateDataAuditResult(empty) }, + ) +} diff --git a/v2/audit/test/generate.go b/v2/audit/test/generate.go new file mode 100644 index 0000000..76d85a9 --- /dev/null +++ b/v2/audit/test/generate.go @@ -0,0 +1,30 @@ +package audittest + +import ( + "github.com/nspcc-dev/neofs-api-go/v2/audit" + refstest "github.com/nspcc-dev/neofs-api-go/v2/refs/test" +) + +func GenerateDataAuditResult(empty bool) *audit.DataAuditResult { + m := new(audit.DataAuditResult) + + if !empty { + m.SetPublicKey([]byte{1, 2, 3}) + m.SetAuditEpoch(13) + m.SetHit(100) + m.SetMiss(200) + m.SetFail(300) + m.SetComplete(true) + m.SetPassNodes([][]byte{{1}, {2}}) + m.SetFailNodes([][]byte{{3}, {4}}) + m.SetRequests(666) + m.SetRetries(777) + } + + m.SetVersion(refstest.GenerateVersion(empty)) + m.SetContainerID(refstest.GenerateContainerID(empty)) + m.SetPassSG(refstest.GenerateObjectIDs(empty)) + m.SetFailSG(refstest.GenerateObjectIDs(empty)) + + return m +} diff --git a/v2/client/options.go b/v2/client/options.go deleted file mode 100644 index 1c9e60a..0000000 --- a/v2/client/options.go +++ /dev/null @@ -1,115 +0,0 @@ -package client - -import ( - "context" - "net" - "time" - - "google.golang.org/grpc" -) - -type Option func(*cfg) - -type cfg struct { - addr string - - conn net.Conn - - gRPC cfgGRPC - - dialTimeout time.Duration -} - -type cfgGRPC struct { - dialOpts []grpc.DialOption - - conn *grpc.ClientConn -} - -const defaultDialTimeout = 5 * time.Second - -func defaultCfg() *cfg { - return &cfg{ - gRPC: cfgGRPC{ - dialOpts: []grpc.DialOption{ - grpc.WithInsecure(), - }, - }, - dialTimeout: defaultDialTimeout, - } -} - -func NewGRPCClientConn(opts ...Option) (*grpc.ClientConn, error) { - cfg := defaultCfg() - - for i := range opts { - opts[i](cfg) - } - - var err error - - if cfg.gRPC.conn == nil { - if cfg.conn != nil { - if cfg.addr == "" { - cfg.addr = cfg.conn.RemoteAddr().String() - } - - cfg.gRPC.dialOpts = append(cfg.gRPC.dialOpts, - grpc.WithContextDialer(func(context.Context, string) (net.Conn, error) { - return cfg.conn, nil - }), - ) - } - - dialCtx, cancel := context.WithTimeout(context.Background(), cfg.dialTimeout) - - cfg.gRPC.conn, err = grpc.DialContext(dialCtx, cfg.addr, cfg.gRPC.dialOpts...) - - cancel() - if err != nil { - return nil, err - } - } - - return cfg.gRPC.conn, err -} - -func WithNetworkAddress(v string) Option { - return func(c *cfg) { - if v != "" { - c.addr = v - } - } -} - -func WithNetConn(v net.Conn) Option { - return func(c *cfg) { - if v != nil { - c.conn = v - } - } -} - -func WithDialTimeout(v time.Duration) Option { - return func(c *cfg) { - if v > 0 { - c.dialTimeout = v - } - } -} - -func WithGRPCDialOpts(v []grpc.DialOption) Option { - return func(c *cfg) { - if len(v) > 0 { - c.gRPC.dialOpts = v - } - } -} - -func WithGRPCConn(v *grpc.ClientConn) Option { - return func(c *cfg) { - if v != nil { - c.gRPC.conn = v - } - } -} diff --git a/v2/client/proto.go b/v2/client/proto.go deleted file mode 100644 index f6a6aa6..0000000 --- a/v2/client/proto.go +++ /dev/null @@ -1,23 +0,0 @@ -package client - -import ( - "github.com/pkg/errors" -) - -type Protocol uint32 - -const ( - _ Protocol = iota - ProtoGRPC -) - -var ErrProtoUnsupported = errors.New("unsupported protocol") - -func (p Protocol) String() string { - switch p { - case ProtoGRPC: - return "GRPC" - default: - return "UNKNOWN" - } -} diff --git a/v2/container/client.go b/v2/container/client.go deleted file mode 100644 index c0921b6..0000000 --- a/v2/container/client.go +++ /dev/null @@ -1,355 +0,0 @@ -package container - -import ( - "context" - - "github.com/nspcc-dev/neofs-api-go/v2/client" - container "github.com/nspcc-dev/neofs-api-go/v2/container/grpc" - "github.com/pkg/errors" - "google.golang.org/grpc" -) - -// Client represents universal container -// transport client. -type Client struct { - cPut *putClient - - cGet *getClient - - cDel *delClient - - cList *listClient - - cSetEACL *setEACLClient - - cGetEACL *getEACLClient - - cAnnounce *announceUsedSpaceClient -} - -// Option represents Client option. -type Option func(*cfg) - -type cfg struct { - proto client.Protocol - - globalOpts []client.Option - - gRPC cfgGRPC -} - -type cfgGRPC struct { - serviceClient container.ContainerServiceClient - - grpcCallOpts []grpc.CallOption - - callOpts []container.Option - - client *container.Client -} - -type putClient struct { - requestConverter func(*PutRequest) interface{} - - caller func(context.Context, interface{}) (interface{}, error) - - responseConverter func(interface{}) *PutResponse -} - -type getClient struct { - requestConverter func(*GetRequest) interface{} - - caller func(context.Context, interface{}) (interface{}, error) - - responseConverter func(interface{}) *GetResponse -} - -type delClient struct { - requestConverter func(*DeleteRequest) interface{} - - caller func(context.Context, interface{}) (interface{}, error) - - responseConverter func(interface{}) *DeleteResponse -} - -type listClient struct { - requestConverter func(*ListRequest) interface{} - - caller func(context.Context, interface{}) (interface{}, error) - - responseConverter func(interface{}) *ListResponse -} - -type setEACLClient struct { - requestConverter func(*SetExtendedACLRequest) interface{} - - caller func(context.Context, interface{}) (interface{}, error) - - responseConverter func(interface{}) *SetExtendedACLResponse -} - -type getEACLClient struct { - requestConverter func(*GetExtendedACLRequest) interface{} - - caller func(context.Context, interface{}) (interface{}, error) - - responseConverter func(interface{}) *GetExtendedACLResponse -} - -type announceUsedSpaceClient struct { - requestConverter func(request *AnnounceUsedSpaceRequest) interface{} - - caller func(context.Context, interface{}) (interface{}, error) - - responseConverter func(interface{}) *AnnounceUsedSpaceResponse -} - -// Put sends PutRequest over the network and returns PutResponse. -// -// It returns any error encountered during the call. -func (c *Client) Put(ctx context.Context, req *PutRequest) (*PutResponse, error) { - resp, err := c.cPut.caller(ctx, c.cPut.requestConverter(req)) - if err != nil { - return nil, errors.Wrap(err, "could not send container put request") - } - - return c.cPut.responseConverter(resp), nil -} - -// Get sends GetRequest over the network and returns GetResponse. -// -// It returns any error encountered during the call. -func (c *Client) Get(ctx context.Context, req *GetRequest) (*GetResponse, error) { - resp, err := c.cGet.caller(ctx, c.cGet.requestConverter(req)) - if err != nil { - return nil, errors.Wrap(err, "could not send container get request") - } - - return c.cGet.responseConverter(resp), nil -} - -// Delete sends GetRequest over the network and returns GetResponse. -// -// It returns any error encountered during the call. -func (c *Client) Delete(ctx context.Context, req *DeleteRequest) (*DeleteResponse, error) { - resp, err := c.cDel.caller(ctx, c.cDel.requestConverter(req)) - if err != nil { - return nil, errors.Wrap(err, "could not send container delete request") - } - - return c.cDel.responseConverter(resp), nil -} - -// List sends ListRequest over the network and returns ListResponse. -// -// It returns any error encountered during the call. -func (c *Client) List(ctx context.Context, req *ListRequest) (*ListResponse, error) { - resp, err := c.cList.caller(ctx, c.cList.requestConverter(req)) - if err != nil { - return nil, errors.Wrap(err, "could not send container list request") - } - - return c.cList.responseConverter(resp), nil -} - -// SetExtendedACL sends SetExtendedACLRequest over the network and returns SetExtendedACLResponse. -// -// It returns any error encountered during the call. -func (c *Client) SetExtendedACL(ctx context.Context, req *SetExtendedACLRequest) (*SetExtendedACLResponse, error) { - resp, err := c.cSetEACL.caller(ctx, c.cSetEACL.requestConverter(req)) - if err != nil { - return nil, errors.Wrap(err, "could not send container set EACL request") - } - - return c.cSetEACL.responseConverter(resp), nil -} - -// GetExtendedACL sends GetExtendedACLRequest over the network and returns GetExtendedACLResponse. -// -// It returns any error encountered during the call. -func (c *Client) GetExtendedACL(ctx context.Context, req *GetExtendedACLRequest) (*GetExtendedACLResponse, error) { - resp, err := c.cGetEACL.caller(ctx, c.cGetEACL.requestConverter(req)) - if err != nil { - return nil, errors.Wrap(err, "could not send container get EACL request") - } - - return c.cGetEACL.responseConverter(resp), nil -} - -// AnnounceUsedSpace sends AnnounceUsedSpaceRequest over the network and returns -// AnnounceUsedSpaceResponse. -// -// It returns any error encountered during the call. -func (c *Client) AnnounceUsedSpace(ctx context.Context, req *AnnounceUsedSpaceRequest) (*AnnounceUsedSpaceResponse, error) { - resp, err := c.cAnnounce.caller(ctx, c.cAnnounce.requestConverter(req)) - if err != nil { - return nil, errors.Wrap(err, "could not send announce used space request") - } - - return c.cAnnounce.responseConverter(resp), nil -} - -func defaultCfg() *cfg { - return &cfg{ - proto: client.ProtoGRPC, - } -} - -func NewClient(opts ...Option) (*Client, error) { - cfg := defaultCfg() - - for i := range opts { - opts[i](cfg) - } - - var err error - - switch cfg.proto { - case client.ProtoGRPC: - var c *container.Client - if c, err = newGRPCClient(cfg); err != nil { - break - } - - return &Client{ - cPut: &putClient{ - requestConverter: func(req *PutRequest) interface{} { - return PutRequestToGRPCMessage(req) - }, - caller: func(ctx context.Context, req interface{}) (interface{}, error) { - return c.Put(ctx, req.(*container.PutRequest)) - }, - responseConverter: func(resp interface{}) *PutResponse { - return PutResponseFromGRPCMessage(resp.(*container.PutResponse)) - }, - }, - cGet: &getClient{ - requestConverter: func(req *GetRequest) interface{} { - return GetRequestToGRPCMessage(req) - }, - caller: func(ctx context.Context, req interface{}) (interface{}, error) { - return c.Get(ctx, req.(*container.GetRequest)) - }, - responseConverter: func(resp interface{}) *GetResponse { - return GetResponseFromGRPCMessage(resp.(*container.GetResponse)) - }, - }, - cDel: &delClient{ - requestConverter: func(req *DeleteRequest) interface{} { - return DeleteRequestToGRPCMessage(req) - }, - caller: func(ctx context.Context, req interface{}) (interface{}, error) { - return c.Delete(ctx, req.(*container.DeleteRequest)) - }, - responseConverter: func(resp interface{}) *DeleteResponse { - return DeleteResponseFromGRPCMessage(resp.(*container.DeleteResponse)) - }, - }, - cList: &listClient{ - requestConverter: func(req *ListRequest) interface{} { - return ListRequestToGRPCMessage(req) - }, - caller: func(ctx context.Context, req interface{}) (interface{}, error) { - return c.List(ctx, req.(*container.ListRequest)) - }, - responseConverter: func(resp interface{}) *ListResponse { - return ListResponseFromGRPCMessage(resp.(*container.ListResponse)) - }, - }, - cSetEACL: &setEACLClient{ - requestConverter: func(req *SetExtendedACLRequest) interface{} { - return SetExtendedACLRequestToGRPCMessage(req) - }, - caller: func(ctx context.Context, req interface{}) (interface{}, error) { - return c.SetExtendedACL(ctx, req.(*container.SetExtendedACLRequest)) - }, - responseConverter: func(resp interface{}) *SetExtendedACLResponse { - return SetExtendedACLResponseFromGRPCMessage(resp.(*container.SetExtendedACLResponse)) - }, - }, - cGetEACL: &getEACLClient{ - requestConverter: func(req *GetExtendedACLRequest) interface{} { - return GetExtendedACLRequestToGRPCMessage(req) - }, - caller: func(ctx context.Context, req interface{}) (interface{}, error) { - return c.GetExtendedACL(ctx, req.(*container.GetExtendedACLRequest)) - }, - responseConverter: func(resp interface{}) *GetExtendedACLResponse { - return GetExtendedACLResponseFromGRPCMessage(resp.(*container.GetExtendedACLResponse)) - }, - }, - cAnnounce: &announceUsedSpaceClient{ - requestConverter: func(req *AnnounceUsedSpaceRequest) interface{} { - return AnnounceUsedSpaceRequestToGRPCMessage(req) - }, - caller: func(ctx context.Context, req interface{}) (interface{}, error) { - return c.AnnounceUsedSpace(ctx, req.(*container.AnnounceUsedSpaceRequest)) - }, - responseConverter: func(resp interface{}) *AnnounceUsedSpaceResponse { - return AnnounceUsedSpaceResponseFromGRPCMessage(resp.(*container.AnnounceUsedSpaceResponse)) - }, - }, - }, nil - default: - err = client.ErrProtoUnsupported - } - - return nil, errors.Wrapf(err, "could not create %s Session client", cfg.proto) -} - -func newGRPCClient(cfg *cfg) (*container.Client, error) { - var err error - - if cfg.gRPC.client == nil { - if cfg.gRPC.serviceClient == nil { - conn, err := client.NewGRPCClientConn(cfg.globalOpts...) - if err != nil { - return nil, errors.Wrap(err, "could not open gRPC client connection") - } - - cfg.gRPC.serviceClient = container.NewContainerServiceClient(conn) - } - - cfg.gRPC.client, err = container.NewClient( - cfg.gRPC.serviceClient, - append( - cfg.gRPC.callOpts, - container.WithCallOptions(cfg.gRPC.grpcCallOpts), - )..., - ) - } - - return cfg.gRPC.client, err -} - -func WithGlobalOpts(v ...client.Option) Option { - return func(c *cfg) { - if len(v) > 0 { - c.globalOpts = v - } - } -} - -func WithGRPCServiceClient(v container.ContainerServiceClient) Option { - return func(c *cfg) { - c.gRPC.serviceClient = v - } -} - -func WithGRPCCallOpts(v []grpc.CallOption) Option { - return func(c *cfg) { - c.gRPC.grpcCallOpts = v - } -} - -func WithGRPCClientOpts(v []container.Option) Option { - return func(c *cfg) { - c.gRPC.callOpts = v - } -} - -func WithGRPCClient(v *container.Client) Option { - return func(c *cfg) { - c.gRPC.client = v - } -} diff --git a/v2/container/convert.go b/v2/container/convert.go index 386eb8e..5ef3fed 100644 --- a/v2/container/convert.go +++ b/v2/container/convert.go @@ -1,1015 +1,1237 @@ package container import ( + "github.com/nspcc-dev/neofs-api-go/rpc/grpc" + "github.com/nspcc-dev/neofs-api-go/rpc/message" "github.com/nspcc-dev/neofs-api-go/v2/acl" + aclGRPC "github.com/nspcc-dev/neofs-api-go/v2/acl/grpc" container "github.com/nspcc-dev/neofs-api-go/v2/container/grpc" "github.com/nspcc-dev/neofs-api-go/v2/netmap" + netmapGRPC "github.com/nspcc-dev/neofs-api-go/v2/netmap/grpc" "github.com/nspcc-dev/neofs-api-go/v2/refs" refsGRPC "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" - "github.com/nspcc-dev/neofs-api-go/v2/session" ) -func AttributeToGRPCMessage(a *Attribute) *container.Container_Attribute { - if a == nil { - return nil +func (a *Attribute) ToGRPCMessage() grpc.Message { + var m *container.Container_Attribute + + if a != nil { + m = new(container.Container_Attribute) + + m.SetKey(a.key) + m.SetValue(a.val) } - m := new(container.Container_Attribute) - - m.SetKey(a.GetKey()) - m.SetValue(a.GetValue()) - return m } -func AttributeFromGRPCMessage(m *container.Container_Attribute) *Attribute { - if m == nil { - return nil +func (a *Attribute) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*container.Container_Attribute) + if !ok { + return message.NewUnexpectedMessageType(m, v) } - a := new(Attribute) + a.key = v.GetKey() + a.val = v.GetValue() - a.SetKey(m.GetKey()) - a.SetValue(m.GetValue()) - - return a + return nil } -func ContainerToGRPCMessage(c *Container) *container.Container { - if c == nil { - return nil +func AttributesToGRPC(xs []*Attribute) (res []*container.Container_Attribute) { + if xs != nil { + res = make([]*container.Container_Attribute, 0, len(xs)) + + for i := range xs { + res = append(res, xs[i].ToGRPCMessage().(*container.Container_Attribute)) + } } - m := new(container.Container) + return +} - m.SetVersion( - refs.VersionToGRPCMessage(c.GetVersion()), - ) +func AttributesFromGRPC(xs []*container.Container_Attribute) (res []*Attribute, err error) { + if xs != nil { + res = make([]*Attribute, 0, len(xs)) - m.SetOwnerId( - refs.OwnerIDToGRPCMessage(c.GetOwnerID()), - ) + for i := range xs { + var x *Attribute - m.SetNonce(c.GetNonce()) + if xs[i] != nil { + x = new(Attribute) - m.SetBasicAcl(c.GetBasicACL()) + err = x.FromGRPCMessage(xs[i]) + if err != nil { + return + } + } - m.SetPlacementPolicy( - netmap.PlacementPolicyToGRPCMessage(c.GetPlacementPolicy()), - ) - - attr := c.GetAttributes() - attrMsg := make([]*container.Container_Attribute, 0, len(attr)) - - for i := range attr { - attrMsg = append(attrMsg, AttributeToGRPCMessage(attr[i])) + res = append(res, x) + } } - m.SetAttributes(attrMsg) + return +} + +func (c *Container) ToGRPCMessage() grpc.Message { + var m *container.Container + + if c != nil { + m = new(container.Container) + + m.SetVersion(c.version.ToGRPCMessage().(*refsGRPC.Version)) + m.SetOwnerId(c.ownerID.ToGRPCMessage().(*refsGRPC.OwnerID)) + m.SetPlacementPolicy(c.policy.ToGRPCMessage().(*netmapGRPC.PlacementPolicy)) + m.SetAttributes(AttributesToGRPC(c.attr)) + m.SetBasicAcl(c.basicACL) + m.SetNonce(c.nonce) + } return m } -func ContainerFromGRPCMessage(m *container.Container) *Container { - if m == nil { - return nil +func (c *Container) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*container.Container) + if !ok { + return message.NewUnexpectedMessageType(m, v) } - c := new(Container) + var err error - c.SetVersion( - refs.VersionFromGRPCMessage(m.GetVersion()), - ) + version := v.GetVersion() + if version == nil { + c.version = nil + } else { + if c.version == nil { + c.version = new(refs.Version) + } - c.SetOwnerID( - refs.OwnerIDFromGRPCMessage(m.GetOwnerId()), - ) - - c.SetNonce(m.GetNonce()) - - c.SetBasicACL(m.GetBasicAcl()) - - c.SetPlacementPolicy( - netmap.PlacementPolicyFromGRPCMessage(m.GetPlacementPolicy()), - ) - - attrMsg := m.GetAttributes() - attr := make([]*Attribute, 0, len(attrMsg)) - - for i := range attrMsg { - attr = append(attr, AttributeFromGRPCMessage(attrMsg[i])) + err = c.version.FromGRPCMessage(version) + if err != nil { + return err + } } - c.SetAttributes(attr) + ownerID := v.GetOwnerId() + if ownerID == nil { + c.ownerID = nil + } else { + if c.ownerID == nil { + c.ownerID = new(refs.OwnerID) + } - return c + err = c.ownerID.FromGRPCMessage(ownerID) + if err != nil { + return err + } + } + + policy := v.GetPlacementPolicy() + if policy == nil { + c.policy = nil + } else { + if c.policy == nil { + c.policy = new(netmap.PlacementPolicy) + } + + err = c.policy.FromGRPCMessage(policy) + if err != nil { + return err + } + } + + c.attr, err = AttributesFromGRPC(v.GetAttributes()) + if err != nil { + return err + } + + c.basicACL = v.GetBasicAcl() + c.nonce = v.GetNonce() + + return nil } -func PutRequestBodyToGRPCMessage(r *PutRequestBody) *container.PutRequest_Body { - if r == nil { - return nil +func (r *PutRequestBody) ToGRPCMessage() grpc.Message { + var m *container.PutRequest_Body + + if r != nil { + m = new(container.PutRequest_Body) + + m.SetContainer(r.cnr.ToGRPCMessage().(*container.Container)) + m.SetSignature(r.sig.ToGRPCMessage().(*refsGRPC.Signature)) } - m := new(container.PutRequest_Body) - - m.SetContainer( - ContainerToGRPCMessage(r.GetContainer()), - ) - - m.SetSignature( - refs.SignatureToGRPCMessage(r.GetSignature()), - ) - return m } -func PutRequestBodyFromGRPCMessage(m *container.PutRequest_Body) *PutRequestBody { - if m == nil { - return nil +func (r *PutRequestBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*container.PutRequest_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) } - r := new(PutRequestBody) + var err error - r.SetContainer( - ContainerFromGRPCMessage(m.GetContainer()), - ) + cnr := v.GetContainer() + if cnr == nil { + r.cnr = nil + } else { + if r.cnr == nil { + r.cnr = new(Container) + } - r.SetSignature( - refs.SignatureFromGRPCMessage(m.GetSignature()), - ) + err = r.cnr.FromGRPCMessage(cnr) + if err != nil { + return err + } + } - return r + sig := v.GetSignature() + if sig == nil { + r.sig = nil + } else { + if r.sig == nil { + r.sig = new(refs.Signature) + } + + err = r.sig.FromGRPCMessage(sig) + } + + return err } -func PutRequestToGRPCMessage(r *PutRequest) *container.PutRequest { - if r == nil { - return nil +func (r *PutRequest) ToGRPCMessage() grpc.Message { + var m *container.PutRequest + + if r != nil { + m = new(container.PutRequest) + + m.SetBody(r.body.ToGRPCMessage().(*container.PutRequest_Body)) + r.RequestHeaders.ToMessage(m) } - m := new(container.PutRequest) - - m.SetBody( - PutRequestBodyToGRPCMessage(r.GetBody()), - ) - - session.RequestHeadersToGRPC(r, m) - return m } -func PutRequestFromGRPCMessage(m *container.PutRequest) *PutRequest { - if m == nil { - return nil +func (r *PutRequest) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*container.PutRequest) + if !ok { + return message.NewUnexpectedMessageType(m, v) } - r := new(PutRequest) + var err error - r.SetBody( - PutRequestBodyFromGRPCMessage(m.GetBody()), - ) + body := v.GetBody() + if body == nil { + r.body = nil + } else { + if r.body == nil { + r.body = new(PutRequestBody) + } - session.RequestHeadersFromGRPC(m, r) + err = r.body.FromGRPCMessage(body) + if err != nil { + return err + } + } - return r + return r.RequestHeaders.FromMessage(v) } -func PutResponseBodyToGRPCMessage(r *PutResponseBody) *container.PutResponse_Body { - if r == nil { - return nil +func (r *PutResponseBody) ToGRPCMessage() grpc.Message { + var m *container.PutResponse_Body + + if r != nil { + m = new(container.PutResponse_Body) + + m.SetContainerId(r.cid.ToGRPCMessage().(*refsGRPC.ContainerID)) } - m := new(container.PutResponse_Body) - - m.SetContainerId( - refs.ContainerIDToGRPCMessage(r.GetContainerID()), - ) - return m } -func PutResponseBodyFromGRPCMessage(m *container.PutResponse_Body) *PutResponseBody { - if m == nil { - return nil +func (r *PutResponseBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*container.PutResponse_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) } - r := new(PutResponseBody) + var err error - r.SetContainerID( - refs.ContainerIDFromGRPCMessage(m.GetContainerId()), - ) + cid := v.GetContainerId() + if cid == nil { + r.cid = nil + } else { + if r.cid == nil { + r.cid = new(refs.ContainerID) + } - return r + err = r.cid.FromGRPCMessage(cid) + } + + return err } -func PutResponseToGRPCMessage(r *PutResponse) *container.PutResponse { - if r == nil { - return nil +func (r *PutResponse) ToGRPCMessage() grpc.Message { + var m *container.PutResponse + + if r != nil { + m = new(container.PutResponse) + + m.SetBody(r.body.ToGRPCMessage().(*container.PutResponse_Body)) + r.ResponseHeaders.ToMessage(m) } - m := new(container.PutResponse) - - m.SetBody( - PutResponseBodyToGRPCMessage(r.GetBody()), - ) - - session.ResponseHeadersToGRPC(r, m) - return m } -func PutResponseFromGRPCMessage(m *container.PutResponse) *PutResponse { - if m == nil { - return nil +func (r *PutResponse) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*container.PutResponse) + if !ok { + return message.NewUnexpectedMessageType(m, v) } - r := new(PutResponse) + var err error - r.SetBody( - PutResponseBodyFromGRPCMessage(m.GetBody()), - ) + body := v.GetBody() + if body == nil { + r.body = nil + } else { + if r.body == nil { + r.body = new(PutResponseBody) + } - session.ResponseHeadersFromGRPC(m, r) + err = r.body.FromGRPCMessage(body) + if err != nil { + return err + } + } - return r + return r.ResponseHeaders.FromMessage(v) } -func GetRequestBodyToGRPCMessage(r *GetRequestBody) *container.GetRequest_Body { - if r == nil { - return nil +func (r *GetRequestBody) ToGRPCMessage() grpc.Message { + var m *container.GetRequest_Body + + if r != nil { + m = new(container.GetRequest_Body) + + m.SetContainerId(r.cid.ToGRPCMessage().(*refsGRPC.ContainerID)) } - m := new(container.GetRequest_Body) - - m.SetContainerId( - refs.ContainerIDToGRPCMessage(r.GetContainerID()), - ) - return m } -func GetRequestBodyFromGRPCMessage(m *container.GetRequest_Body) *GetRequestBody { - if m == nil { - return nil +func (r *GetRequestBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*container.GetRequest_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) } - r := new(GetRequestBody) + var err error - r.SetContainerID( - refs.ContainerIDFromGRPCMessage(m.GetContainerId()), - ) + cid := v.GetContainerId() + if cid == nil { + r.cid = nil + } else { + if r.cid == nil { + r.cid = new(refs.ContainerID) + } - return r + err = r.cid.FromGRPCMessage(cid) + } + + return err } -func GetRequestToGRPCMessage(r *GetRequest) *container.GetRequest { - if r == nil { - return nil +func (r *GetRequest) ToGRPCMessage() grpc.Message { + var m *container.GetRequest + + if r != nil { + m = new(container.GetRequest) + + m.SetBody(r.body.ToGRPCMessage().(*container.GetRequest_Body)) + r.RequestHeaders.ToMessage(m) } - m := new(container.GetRequest) - - m.SetBody( - GetRequestBodyToGRPCMessage(r.GetBody()), - ) - - session.RequestHeadersToGRPC(r, m) - return m } -func GetRequestFromGRPCMessage(m *container.GetRequest) *GetRequest { - if m == nil { - return nil +func (r *GetRequest) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*container.GetRequest) + if !ok { + return message.NewUnexpectedMessageType(m, v) } - r := new(GetRequest) + var err error - r.SetBody( - GetRequestBodyFromGRPCMessage(m.GetBody()), - ) + body := v.GetBody() + if body == nil { + r.body = nil + } else { + if r.body == nil { + r.body = new(GetRequestBody) + } - session.RequestHeadersFromGRPC(m, r) + err = r.body.FromGRPCMessage(body) + if err != nil { + return err + } + } - return r + return r.RequestHeaders.FromMessage(v) } -func GetResponseBodyToGRPCMessage(r *GetResponseBody) *container.GetResponse_Body { - if r == nil { - return nil +func (r *GetResponseBody) ToGRPCMessage() grpc.Message { + var m *container.GetResponse_Body + + if r != nil { + m = new(container.GetResponse_Body) + + m.SetContainer(r.cnr.ToGRPCMessage().(*container.Container)) } - m := new(container.GetResponse_Body) - - m.SetContainer( - ContainerToGRPCMessage(r.GetContainer()), - ) - return m } -func GetResponseBodyFromGRPCMessage(m *container.GetResponse_Body) *GetResponseBody { - if m == nil { - return nil +func (r *GetResponseBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*container.GetResponse_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) } - r := new(GetResponseBody) + var err error - r.SetContainer( - ContainerFromGRPCMessage(m.GetContainer()), - ) + cnr := v.GetContainer() + if cnr == nil { + r.cnr = nil + } else { + if r.cnr == nil { + r.cnr = new(Container) + } - return r + err = r.cnr.FromGRPCMessage(cnr) + } + + return err } -func GetResponseToGRPCMessage(r *GetResponse) *container.GetResponse { - if r == nil { - return nil +func (r *GetResponse) ToGRPCMessage() grpc.Message { + var m *container.GetResponse + + if r != nil { + m = new(container.GetResponse) + + m.SetBody(r.body.ToGRPCMessage().(*container.GetResponse_Body)) + r.ResponseHeaders.ToMessage(m) } - m := new(container.GetResponse) - - m.SetBody( - GetResponseBodyToGRPCMessage(r.GetBody()), - ) - - session.ResponseHeadersToGRPC(r, m) - return m } -func GetResponseFromGRPCMessage(m *container.GetResponse) *GetResponse { - if m == nil { - return nil +func (r *GetResponse) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*container.GetResponse) + if !ok { + return message.NewUnexpectedMessageType(m, v) } - r := new(GetResponse) + var err error - r.SetBody( - GetResponseBodyFromGRPCMessage(m.GetBody()), - ) + body := v.GetBody() + if body == nil { + r.body = nil + } else { + if r.body == nil { + r.body = new(GetResponseBody) + } - session.ResponseHeadersFromGRPC(m, r) + err = r.body.FromGRPCMessage(body) + if err != nil { + return err + } + } - return r + return r.ResponseHeaders.FromMessage(v) } -func DeleteRequestBodyToGRPCMessage(r *DeleteRequestBody) *container.DeleteRequest_Body { - if r == nil { - return nil +func (r *DeleteRequestBody) ToGRPCMessage() grpc.Message { + var m *container.DeleteRequest_Body + + if r != nil { + m = new(container.DeleteRequest_Body) + + m.SetContainerId(r.cid.ToGRPCMessage().(*refsGRPC.ContainerID)) + m.SetSignature(r.sig.ToGRPCMessage().(*refsGRPC.Signature)) } - m := new(container.DeleteRequest_Body) - - m.SetContainerId( - refs.ContainerIDToGRPCMessage(r.GetContainerID()), - ) - - m.SetSignature( - refs.SignatureToGRPCMessage(r.GetSignature()), - ) - return m } -func DeleteRequestBodyFromGRPCMessage(m *container.DeleteRequest_Body) *DeleteRequestBody { - if m == nil { - return nil +func (r *DeleteRequestBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*container.DeleteRequest_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) } - r := new(DeleteRequestBody) + var err error - r.SetContainerID( - refs.ContainerIDFromGRPCMessage(m.GetContainerId()), - ) + cid := v.GetContainerId() + if cid == nil { + r.cid = nil + } else { + if r.cid == nil { + r.cid = new(refs.ContainerID) + } - r.SetSignature( - refs.SignatureFromGRPCMessage(m.GetSignature()), - ) + err = r.cid.FromGRPCMessage(cid) + if err != nil { + return err + } + } - return r + sig := v.GetSignature() + if sig == nil { + r.sig = nil + } else { + if r.sig == nil { + r.sig = new(refs.Signature) + } + + err = r.sig.FromGRPCMessage(sig) + } + + return err } -func DeleteRequestToGRPCMessage(r *DeleteRequest) *container.DeleteRequest { - if r == nil { - return nil +func (r *DeleteRequest) ToGRPCMessage() grpc.Message { + var m *container.DeleteRequest + + if r != nil { + m = new(container.DeleteRequest) + + m.SetBody(r.body.ToGRPCMessage().(*container.DeleteRequest_Body)) + r.RequestHeaders.ToMessage(m) } - m := new(container.DeleteRequest) - - m.SetBody( - DeleteRequestBodyToGRPCMessage(r.GetBody()), - ) - - session.RequestHeadersToGRPC(r, m) - return m } -func DeleteRequestFromGRPCMessage(m *container.DeleteRequest) *DeleteRequest { - if m == nil { - return nil +func (r *DeleteRequest) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*container.DeleteRequest) + if !ok { + return message.NewUnexpectedMessageType(m, v) } - r := new(DeleteRequest) + var err error - r.SetBody( - DeleteRequestBodyFromGRPCMessage(m.GetBody()), - ) + body := v.GetBody() + if body == nil { + r.body = nil + } else { + if r.body == nil { + r.body = new(DeleteRequestBody) + } - session.RequestHeadersFromGRPC(m, r) + err = r.body.FromGRPCMessage(body) + if err != nil { + return err + } + } - return r + return r.RequestHeaders.FromMessage(v) } -func DeleteResponseBodyToGRPCMessage(r *DeleteResponseBody) *container.DeleteResponse_Body { - if r == nil { - return nil - } +func (r *DeleteResponseBody) ToGRPCMessage() grpc.Message { + var m *container.DeleteResponse_Body - m := new(container.DeleteResponse_Body) + if r != nil { + m = new(container.DeleteResponse_Body) + } return m } -func DeleteResponseBodyFromGRPCMessage(m *container.DeleteResponse_Body) *DeleteResponseBody { - if m == nil { - return nil +func (r *DeleteResponseBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*container.DeleteResponse_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) } - r := new(DeleteResponseBody) - - return r + return nil } -func DeleteResponseToGRPCMessage(r *DeleteResponse) *container.DeleteResponse { - if r == nil { - return nil +func (r *DeleteResponse) ToGRPCMessage() grpc.Message { + var m *container.DeleteResponse + + if r != nil { + m = new(container.DeleteResponse) + + m.SetBody(r.body.ToGRPCMessage().(*container.DeleteResponse_Body)) + r.ResponseHeaders.ToMessage(m) } - m := new(container.DeleteResponse) - - m.SetBody( - DeleteResponseBodyToGRPCMessage(r.GetBody()), - ) - - session.ResponseHeadersToGRPC(r, m) - return m } -func DeleteResponseFromGRPCMessage(m *container.DeleteResponse) *DeleteResponse { - if m == nil { - return nil +func (r *DeleteResponse) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*container.DeleteResponse) + if !ok { + return message.NewUnexpectedMessageType(m, v) } - r := new(DeleteResponse) + var err error - r.SetBody( - DeleteResponseBodyFromGRPCMessage(m.GetBody()), - ) + body := v.GetBody() + if body == nil { + r.body = nil + } else { + if r.body == nil { + r.body = new(DeleteResponseBody) + } - session.ResponseHeadersFromGRPC(m, r) + err = r.body.FromGRPCMessage(body) + if err != nil { + return err + } + } - return r + return r.ResponseHeaders.FromMessage(v) } -func ListRequestBodyToGRPCMessage(r *ListRequestBody) *container.ListRequest_Body { - if r == nil { - return nil +func (r *ListRequestBody) ToGRPCMessage() grpc.Message { + var m *container.ListRequest_Body + + if r != nil { + m = new(container.ListRequest_Body) + + m.SetOwnerId(r.ownerID.ToGRPCMessage().(*refsGRPC.OwnerID)) } - m := new(container.ListRequest_Body) - - m.SetOwnerId( - refs.OwnerIDToGRPCMessage(r.GetOwnerID()), - ) - return m } -func ListRequestBodyFromGRPCMessage(m *container.ListRequest_Body) *ListRequestBody { - if m == nil { - return nil +func (r *ListRequestBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*container.ListRequest_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) } - r := new(ListRequestBody) + var err error - r.SetOwnerID( - refs.OwnerIDFromGRPCMessage(m.GetOwnerId()), - ) + ownerID := v.GetOwnerId() + if ownerID == nil { + r.ownerID = nil + } else { + if r.ownerID == nil { + r.ownerID = new(refs.OwnerID) + } - return r + err = r.ownerID.FromGRPCMessage(ownerID) + } + + return err } -func ListRequestToGRPCMessage(r *ListRequest) *container.ListRequest { - if r == nil { - return nil +func (r *ListRequest) ToGRPCMessage() grpc.Message { + var m *container.ListRequest + + if r != nil { + m = new(container.ListRequest) + + m.SetBody(r.body.ToGRPCMessage().(*container.ListRequest_Body)) + r.RequestHeaders.ToMessage(m) } - m := new(container.ListRequest) - - m.SetBody( - ListRequestBodyToGRPCMessage(r.GetBody()), - ) - - session.RequestHeadersToGRPC(r, m) - return m } -func ListRequestFromGRPCMessage(m *container.ListRequest) *ListRequest { - if m == nil { - return nil +func (r *ListRequest) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*container.ListRequest) + if !ok { + return message.NewUnexpectedMessageType(m, v) } - r := new(ListRequest) + var err error - r.SetBody( - ListRequestBodyFromGRPCMessage(m.GetBody()), - ) + body := v.GetBody() + if body == nil { + r.body = nil + } else { + if r.body == nil { + r.body = new(ListRequestBody) + } - session.RequestHeadersFromGRPC(m, r) + err = r.body.FromGRPCMessage(body) + if err != nil { + return err + } + } - return r + return r.RequestHeaders.FromMessage(v) } -func ListResponseBodyToGRPCMessage(r *ListResponseBody) *container.ListResponse_Body { - if r == nil { - return nil +func (r *ListResponseBody) ToGRPCMessage() grpc.Message { + var m *container.ListResponse_Body + + if r != nil { + m = new(container.ListResponse_Body) + + m.SetContainerIds(refs.ContainerIDsToGRPCMessage(r.cidList)) } - m := new(container.ListResponse_Body) - - cids := r.GetContainerIDs() - cidMsg := make([]*refsGRPC.ContainerID, 0, len(cids)) - - for i := range cids { - cidMsg = append(cidMsg, refs.ContainerIDToGRPCMessage(cids[i])) - } - - m.SetContainerIds(cidMsg) - return m } -func ListResponseBodyFromGRPCMessage(m *container.ListResponse_Body) *ListResponseBody { - if m == nil { - return nil +func (r *ListResponseBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*container.ListResponse_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) } - r := new(ListResponseBody) + var err error - cidMsg := m.GetContainerIds() - cids := make([]*refs.ContainerID, 0, len(cidMsg)) + r.cidList, err = refs.ContainerIDsFromGRPCMessage(v.GetContainerIds()) - for i := range cidMsg { - cids = append(cids, refs.ContainerIDFromGRPCMessage(cidMsg[i])) - } - - r.SetContainerIDs(cids) - - return r + return err } -func ListResponseToGRPCMessage(r *ListResponse) *container.ListResponse { - if r == nil { - return nil +func (r *ListResponse) ToGRPCMessage() grpc.Message { + var m *container.ListResponse + + if r != nil { + m = new(container.ListResponse) + + m.SetBody(r.body.ToGRPCMessage().(*container.ListResponse_Body)) + r.ResponseHeaders.ToMessage(m) } - m := new(container.ListResponse) - - m.SetBody( - ListResponseBodyToGRPCMessage(r.GetBody()), - ) - - session.ResponseHeadersToGRPC(r, m) - return m } -func ListResponseFromGRPCMessage(m *container.ListResponse) *ListResponse { - if m == nil { - return nil +func (r *ListResponse) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*container.ListResponse) + if !ok { + return message.NewUnexpectedMessageType(m, v) } - r := new(ListResponse) + var err error - r.SetBody( - ListResponseBodyFromGRPCMessage(m.GetBody()), - ) + body := v.GetBody() + if body == nil { + r.body = nil + } else { + if r.body == nil { + r.body = new(ListResponseBody) + } - session.ResponseHeadersFromGRPC(m, r) + err = r.body.FromGRPCMessage(body) + if err != nil { + return err + } + } - return r + return r.ResponseHeaders.FromMessage(v) } -func SetExtendedACLRequestBodyToGRPCMessage(r *SetExtendedACLRequestBody) *container.SetExtendedACLRequest_Body { - if r == nil { - return nil +func (r *SetExtendedACLRequestBody) ToGRPCMessage() grpc.Message { + var m *container.SetExtendedACLRequest_Body + + if r != nil { + m = new(container.SetExtendedACLRequest_Body) + + m.SetEacl(r.eacl.ToGRPCMessage().(*aclGRPC.EACLTable)) + m.SetSignature(r.sig.ToGRPCMessage().(*refsGRPC.Signature)) } - m := new(container.SetExtendedACLRequest_Body) - - m.SetEacl( - acl.TableToGRPCMessage(r.GetEACL()), - ) - - m.SetSignature( - refs.SignatureToGRPCMessage(r.GetSignature())) - return m } -func SetExtendedACLRequestBodyFromGRPCMessage(m *container.SetExtendedACLRequest_Body) *SetExtendedACLRequestBody { - if m == nil { - return nil +func (r *SetExtendedACLRequestBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*container.SetExtendedACLRequest_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) } - r := new(SetExtendedACLRequestBody) + var err error - r.SetEACL( - acl.TableFromGRPCMessage(m.GetEacl()), - ) + eacl := v.GetEacl() + if eacl == nil { + r.eacl = nil + } else { + if r.eacl == nil { + r.eacl = new(acl.Table) + } - r.SetSignature( - refs.SignatureFromGRPCMessage(m.GetSignature()), - ) + err = r.eacl.FromGRPCMessage(eacl) + if err != nil { + return err + } + } - return r + sig := v.GetSignature() + if sig == nil { + r.sig = nil + } else { + if r.sig == nil { + r.sig = new(refs.Signature) + } + + err = r.sig.FromGRPCMessage(sig) + } + + return err } -func SetExtendedACLRequestToGRPCMessage(r *SetExtendedACLRequest) *container.SetExtendedACLRequest { - if r == nil { - return nil +func (r *SetExtendedACLRequest) ToGRPCMessage() grpc.Message { + var m *container.SetExtendedACLRequest + + if r != nil { + m = new(container.SetExtendedACLRequest) + + m.SetBody(r.body.ToGRPCMessage().(*container.SetExtendedACLRequest_Body)) + r.RequestHeaders.ToMessage(m) } - m := new(container.SetExtendedACLRequest) - - m.SetBody( - SetExtendedACLRequestBodyToGRPCMessage(r.GetBody()), - ) - - session.RequestHeadersToGRPC(r, m) - return m } -func SetExtendedACLRequestFromGRPCMessage(m *container.SetExtendedACLRequest) *SetExtendedACLRequest { - if m == nil { - return nil +func (r *SetExtendedACLRequest) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*container.SetExtendedACLRequest) + if !ok { + return message.NewUnexpectedMessageType(m, v) } - r := new(SetExtendedACLRequest) + var err error - r.SetBody( - SetExtendedACLRequestBodyFromGRPCMessage(m.GetBody()), - ) + body := v.GetBody() + if body == nil { + r.body = nil + } else { + if r.body == nil { + r.body = new(SetExtendedACLRequestBody) + } - session.RequestHeadersFromGRPC(m, r) + err = r.body.FromGRPCMessage(body) + if err != nil { + return err + } + } - return r + return r.RequestHeaders.FromMessage(v) } -func SetExtendedACLResponseBodyToGRPCMessage(r *SetExtendedACLResponseBody) *container.SetExtendedACLResponse_Body { - if r == nil { - return nil - } +func (r *SetExtendedACLResponseBody) ToGRPCMessage() grpc.Message { + var m *container.SetExtendedACLResponse_Body - m := new(container.SetExtendedACLResponse_Body) + if r != nil { + m = new(container.SetExtendedACLResponse_Body) + } return m } -func SetExtendedACLResponseBodyFromGRPCMessage(m *container.SetExtendedACLResponse_Body) *SetExtendedACLResponseBody { - if m == nil { - return nil +func (r *SetExtendedACLResponseBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*container.SetExtendedACLResponse_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) } - r := new(SetExtendedACLResponseBody) - - return r + return nil } -func SetExtendedACLResponseToGRPCMessage(r *SetExtendedACLResponse) *container.SetExtendedACLResponse { - if r == nil { - return nil +func (r *SetExtendedACLResponse) ToGRPCMessage() grpc.Message { + var m *container.SetExtendedACLResponse + + if r != nil { + m = new(container.SetExtendedACLResponse) + + m.SetBody(r.body.ToGRPCMessage().(*container.SetExtendedACLResponse_Body)) + r.ResponseHeaders.ToMessage(m) } - m := new(container.SetExtendedACLResponse) - - m.SetBody( - SetExtendedACLResponseBodyToGRPCMessage(r.GetBody()), - ) - - session.ResponseHeadersToGRPC(r, m) - return m } -func SetExtendedACLResponseFromGRPCMessage(m *container.SetExtendedACLResponse) *SetExtendedACLResponse { - if m == nil { - return nil +func (r *SetExtendedACLResponse) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*container.SetExtendedACLResponse) + if !ok { + return message.NewUnexpectedMessageType(m, v) } - r := new(SetExtendedACLResponse) + var err error - r.SetBody( - SetExtendedACLResponseBodyFromGRPCMessage(m.GetBody()), - ) + body := v.GetBody() + if body == nil { + r.body = nil + } else { + if r.body == nil { + r.body = new(SetExtendedACLResponseBody) + } - session.ResponseHeadersFromGRPC(m, r) + err = r.body.FromGRPCMessage(body) + if err != nil { + return err + } + } - return r + return r.ResponseHeaders.FromMessage(v) } -func GetExtendedACLRequestBodyToGRPCMessage(r *GetExtendedACLRequestBody) *container.GetExtendedACLRequest_Body { - if r == nil { - return nil +func (r *GetExtendedACLRequestBody) ToGRPCMessage() grpc.Message { + var m *container.GetExtendedACLRequest_Body + + if r != nil { + m = new(container.GetExtendedACLRequest_Body) + + m.SetContainerId(r.cid.ToGRPCMessage().(*refsGRPC.ContainerID)) } - m := new(container.GetExtendedACLRequest_Body) - - m.SetContainerId( - refs.ContainerIDToGRPCMessage(r.GetContainerID()), - ) - return m } -func GetExtendedACLRequestBodyFromGRPCMessage(m *container.GetExtendedACLRequest_Body) *GetExtendedACLRequestBody { - if m == nil { - return nil +func (r *GetExtendedACLRequestBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*container.GetExtendedACLRequest_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) } - r := new(GetExtendedACLRequestBody) + var err error - r.SetContainerID( - refs.ContainerIDFromGRPCMessage(m.GetContainerId()), - ) + cid := v.GetContainerId() + if cid == nil { + r.cid = nil + } else { + if r.cid == nil { + r.cid = new(refs.ContainerID) + } - return r + err = r.cid.FromGRPCMessage(cid) + } + + return err } -func GetExtendedACLRequestToGRPCMessage(r *GetExtendedACLRequest) *container.GetExtendedACLRequest { - if r == nil { - return nil +func (r *GetExtendedACLRequest) ToGRPCMessage() grpc.Message { + var m *container.GetExtendedACLRequest + + if r != nil { + m = new(container.GetExtendedACLRequest) + + m.SetBody(r.body.ToGRPCMessage().(*container.GetExtendedACLRequest_Body)) + r.RequestHeaders.ToMessage(m) } - m := new(container.GetExtendedACLRequest) - - m.SetBody( - GetExtendedACLRequestBodyToGRPCMessage(r.GetBody()), - ) - - session.RequestHeadersToGRPC(r, m) - return m } -func GetExtendedACLRequestFromGRPCMessage(m *container.GetExtendedACLRequest) *GetExtendedACLRequest { - if m == nil { - return nil +func (r *GetExtendedACLRequest) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*container.GetExtendedACLRequest) + if !ok { + return message.NewUnexpectedMessageType(m, v) } - r := new(GetExtendedACLRequest) + var err error - r.SetBody( - GetExtendedACLRequestBodyFromGRPCMessage(m.GetBody()), - ) + body := v.GetBody() + if body == nil { + r.body = nil + } else { + if r.body == nil { + r.body = new(GetExtendedACLRequestBody) + } - session.RequestHeadersFromGRPC(m, r) + err = r.body.FromGRPCMessage(body) + if err != nil { + return err + } + } - return r + return r.RequestHeaders.FromMessage(v) } -func GetExtendedACLResponseBodyToGRPCMessage(r *GetExtendedACLResponseBody) *container.GetExtendedACLResponse_Body { - if r == nil { - return nil +func (r *GetExtendedACLResponseBody) ToGRPCMessage() grpc.Message { + var m *container.GetExtendedACLResponse_Body + + if r != nil { + m = new(container.GetExtendedACLResponse_Body) + + m.SetEacl(r.eacl.ToGRPCMessage().(*aclGRPC.EACLTable)) + m.SetSignature(r.sig.ToGRPCMessage().(*refsGRPC.Signature)) } - m := new(container.GetExtendedACLResponse_Body) - - m.SetEacl( - acl.TableToGRPCMessage(r.GetEACL()), - ) - - m.SetSignature( - refs.SignatureToGRPCMessage(r.GetSignature()), - ) - return m } -func GetExtendedACLResponseBodyFromGRPCMessage(m *container.GetExtendedACLResponse_Body) *GetExtendedACLResponseBody { - if m == nil { - return nil +func (r *GetExtendedACLResponseBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*container.GetExtendedACLResponse_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) } - r := new(GetExtendedACLResponseBody) + var err error - r.SetEACL( - acl.TableFromGRPCMessage(m.GetEacl()), - ) + eacl := v.GetEacl() + if eacl == nil { + r.eacl = nil + } else { + if r.eacl == nil { + r.eacl = new(acl.Table) + } - r.SetSignature( - refs.SignatureFromGRPCMessage(m.GetSignature()), - ) + err = r.eacl.FromGRPCMessage(eacl) + if err != nil { + return err + } + } - return r + sig := v.GetSignature() + if sig == nil { + r.sig = nil + } else { + if r.sig == nil { + r.sig = new(refs.Signature) + } + + err = r.sig.FromGRPCMessage(sig) + } + + return err } -func GetExtendedACLResponseToGRPCMessage(r *GetExtendedACLResponse) *container.GetExtendedACLResponse { - if r == nil { - return nil +func (r *GetExtendedACLResponse) ToGRPCMessage() grpc.Message { + var m *container.GetExtendedACLResponse + + if r != nil { + m = new(container.GetExtendedACLResponse) + + m.SetBody(r.body.ToGRPCMessage().(*container.GetExtendedACLResponse_Body)) + r.ResponseHeaders.ToMessage(m) } - m := new(container.GetExtendedACLResponse) - - m.SetBody( - GetExtendedACLResponseBodyToGRPCMessage(r.GetBody()), - ) - - session.ResponseHeadersToGRPC(r, m) - return m } -func GetExtendedACLResponseFromGRPCMessage(m *container.GetExtendedACLResponse) *GetExtendedACLResponse { - if m == nil { - return nil +func (r *GetExtendedACLResponse) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*container.GetExtendedACLResponse) + if !ok { + return message.NewUnexpectedMessageType(m, v) } - r := new(GetExtendedACLResponse) + var err error - r.SetBody( - GetExtendedACLResponseBodyFromGRPCMessage(m.GetBody()), - ) + body := v.GetBody() + if body == nil { + r.body = nil + } else { + if r.body == nil { + r.body = new(GetExtendedACLResponseBody) + } - session.ResponseHeadersFromGRPC(m, r) + err = r.body.FromGRPCMessage(body) + if err != nil { + return err + } + } - return r + return r.ResponseHeaders.FromMessage(v) } -func UsedSpaceAnnouncementToGRPCMessage(a *UsedSpaceAnnouncement) *container.AnnounceUsedSpaceRequest_Body_Announcement { - if a == nil { - return nil +func (a *UsedSpaceAnnouncement) ToGRPCMessage() grpc.Message { + var m *container.AnnounceUsedSpaceRequest_Body_Announcement + + if a != nil { + m = new(container.AnnounceUsedSpaceRequest_Body_Announcement) + + m.SetContainerId(a.cid.ToGRPCMessage().(*refsGRPC.ContainerID)) + m.SetEpoch(a.epoch) + m.SetUsedSpace(a.usedSpace) } - m := new(container.AnnounceUsedSpaceRequest_Body_Announcement) - - m.SetEpoch(a.GetEpoch()) - - m.SetContainerId( - refs.ContainerIDToGRPCMessage(a.GetContainerID()), - ) - - m.SetUsedSpace(a.GetUsedSpace()) - return m } -func UsedSpaceAnnouncementFromGRPCMessage(m *container.AnnounceUsedSpaceRequest_Body_Announcement) *UsedSpaceAnnouncement { - if m == nil { - return nil +func (a *UsedSpaceAnnouncement) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*container.AnnounceUsedSpaceRequest_Body_Announcement) + if !ok { + return message.NewUnexpectedMessageType(m, v) } - a := new(UsedSpaceAnnouncement) + var err error - a.SetEpoch(m.GetEpoch()) + cid := v.GetContainerId() + if cid == nil { + a.cid = nil + } else { + if a.cid == nil { + a.cid = new(refs.ContainerID) + } - a.SetContainerID( - refs.ContainerIDFromGRPCMessage(m.GetContainerId()), - ) + err = a.cid.FromGRPCMessage(cid) + if err != nil { + return err + } + } - a.SetUsedSpace(m.GetUsedSpace()) + a.epoch = v.GetEpoch() + a.usedSpace = v.GetUsedSpace() - return a + return nil } -func AnnounceUsedSpaceRequestBodyToGRPCMessage(r *AnnounceUsedSpaceRequestBody) *container.AnnounceUsedSpaceRequest_Body { - if r == nil { - return nil +func UsedSpaceAnnouncementsToGRPCMessage( + ids []*UsedSpaceAnnouncement, +) (res []*container.AnnounceUsedSpaceRequest_Body_Announcement) { + if ids != nil { + res = make([]*container.AnnounceUsedSpaceRequest_Body_Announcement, 0, len(ids)) + + for i := range ids { + res = append(res, ids[i].ToGRPCMessage().(*container.AnnounceUsedSpaceRequest_Body_Announcement)) + } } - m := new(container.AnnounceUsedSpaceRequest_Body) + return +} - announcements := r.GetAnnouncements() - msgAnnouncements := make([]*container.AnnounceUsedSpaceRequest_Body_Announcement, 0, len(announcements)) +func UsedSpaceAnnouncementssFromGRPCMessage( + asV2 []*container.AnnounceUsedSpaceRequest_Body_Announcement, +) (res []*UsedSpaceAnnouncement, err error) { + if asV2 != nil { + res = make([]*UsedSpaceAnnouncement, 0, len(asV2)) - for i := range announcements { - msgAnnouncements = append( - msgAnnouncements, - UsedSpaceAnnouncementToGRPCMessage(announcements[i]), - ) + for i := range asV2 { + var a *UsedSpaceAnnouncement + + if asV2[i] != nil { + a = new(UsedSpaceAnnouncement) + + err = a.FromGRPCMessage(asV2[i]) + if err != nil { + return + } + } + + res = append(res, a) + } } - m.SetAnnouncements(msgAnnouncements) + return +} + +func (r *AnnounceUsedSpaceRequestBody) ToGRPCMessage() grpc.Message { + var m *container.AnnounceUsedSpaceRequest_Body + + if r != nil { + m = new(container.AnnounceUsedSpaceRequest_Body) + + m.SetAnnouncements(UsedSpaceAnnouncementsToGRPCMessage(r.announcements)) + } return m } -func AnnounceUsedSpaceRequestBodyFromGRPCMessage(m *container.AnnounceUsedSpaceRequest_Body) *AnnounceUsedSpaceRequestBody { - if m == nil { - return nil +func (r *AnnounceUsedSpaceRequestBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*container.AnnounceUsedSpaceRequest_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) } - r := new(AnnounceUsedSpaceRequestBody) + var err error - msgAnnouncements := m.GetAnnouncements() - announcements := make([]*UsedSpaceAnnouncement, 0, len(msgAnnouncements)) + r.announcements, err = UsedSpaceAnnouncementssFromGRPCMessage(v.GetAnnouncements()) - for i := range msgAnnouncements { - announcements = append( - announcements, - UsedSpaceAnnouncementFromGRPCMessage(msgAnnouncements[i]), - ) - } - - r.SetAnnouncements(announcements) - - return r + return err } -func AnnounceUsedSpaceRequestToGRPCMessage(r *AnnounceUsedSpaceRequest) *container.AnnounceUsedSpaceRequest { - if r == nil { - return nil +func (r *AnnounceUsedSpaceRequest) ToGRPCMessage() grpc.Message { + var m *container.AnnounceUsedSpaceRequest + + if r != nil { + m = new(container.AnnounceUsedSpaceRequest) + + m.SetBody(r.body.ToGRPCMessage().(*container.AnnounceUsedSpaceRequest_Body)) + r.RequestHeaders.ToMessage(m) } - m := new(container.AnnounceUsedSpaceRequest) - - m.SetBody( - AnnounceUsedSpaceRequestBodyToGRPCMessage(r.GetBody()), - ) - - session.RequestHeadersToGRPC(r, m) - return m } -func AnnounceUsedSpaceRequestFromGRPCMessage(m *container.AnnounceUsedSpaceRequest) *AnnounceUsedSpaceRequest { - if m == nil { - return nil +func (r *AnnounceUsedSpaceRequest) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*container.AnnounceUsedSpaceRequest) + if !ok { + return message.NewUnexpectedMessageType(m, v) } - r := new(AnnounceUsedSpaceRequest) + var err error - r.SetBody( - AnnounceUsedSpaceRequestBodyFromGRPCMessage(m.GetBody()), - ) + body := v.GetBody() + if body == nil { + r.body = nil + } else { + if r.body == nil { + r.body = new(AnnounceUsedSpaceRequestBody) + } - session.RequestHeadersFromGRPC(m, r) + err = r.body.FromGRPCMessage(body) + if err != nil { + return err + } + } - return r + return r.RequestHeaders.FromMessage(v) } -func AnnounceUsedSpaceResponseBodyToGRPCMessage(r *AnnounceUsedSpaceResponseBody) *container.AnnounceUsedSpaceResponse_Body { - if r == nil { - return nil - } +func (r *AnnounceUsedSpaceResponseBody) ToGRPCMessage() grpc.Message { + var m *container.AnnounceUsedSpaceResponse_Body - m := new(container.AnnounceUsedSpaceResponse_Body) + if r != nil { + m = new(container.AnnounceUsedSpaceResponse_Body) + } return m } -func AnnounceUsedSpaceResponseBodyFromGRPCMessage(m *container.AnnounceUsedSpaceResponse_Body) *AnnounceUsedSpaceResponseBody { - if m == nil { - return nil +func (r *AnnounceUsedSpaceResponseBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*container.AnnounceUsedSpaceResponse_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) } - r := new(AnnounceUsedSpaceResponseBody) - - return r + return nil } -func AnnounceUsedSpaceResponseToGRPCMessage(r *AnnounceUsedSpaceResponse) *container.AnnounceUsedSpaceResponse { - if r == nil { - return nil +func (r *AnnounceUsedSpaceResponse) ToGRPCMessage() grpc.Message { + var m *container.AnnounceUsedSpaceResponse + + if r != nil { + m = new(container.AnnounceUsedSpaceResponse) + + m.SetBody(r.body.ToGRPCMessage().(*container.AnnounceUsedSpaceResponse_Body)) + r.ResponseHeaders.ToMessage(m) } - m := new(container.AnnounceUsedSpaceResponse) - - m.SetBody( - AnnounceUsedSpaceResponseBodyToGRPCMessage(r.GetBody()), - ) - - session.ResponseHeadersToGRPC(r, m) - return m } -func AnnounceUsedSpaceResponseFromGRPCMessage(m *container.AnnounceUsedSpaceResponse) *AnnounceUsedSpaceResponse { - if m == nil { - return nil +func (r *AnnounceUsedSpaceResponse) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*container.AnnounceUsedSpaceResponse) + if !ok { + return message.NewUnexpectedMessageType(m, v) } - r := new(AnnounceUsedSpaceResponse) + var err error - r.SetBody( - AnnounceUsedSpaceResponseBodyFromGRPCMessage(m.GetBody()), - ) + body := v.GetBody() + if body == nil { + r.body = nil + } else { + if r.body == nil { + r.body = new(AnnounceUsedSpaceResponseBody) + } - session.ResponseHeadersFromGRPC(m, r) + err = r.body.FromGRPCMessage(body) + if err != nil { + return err + } + } - return r + return r.ResponseHeaders.FromMessage(v) } diff --git a/v2/container/grpc/client.go b/v2/container/grpc/client.go deleted file mode 100644 index 7e126d2..0000000 --- a/v2/container/grpc/client.go +++ /dev/null @@ -1,86 +0,0 @@ -package container - -import ( - "context" - - "github.com/pkg/errors" - "google.golang.org/grpc" -) - -// Client wraps ContainerServiceClient -// with pre-defined configurations. -type Client struct { - *cfg - - client ContainerServiceClient -} - -// Option represents Client option. -type Option func(*cfg) - -type cfg struct { - callOpts []grpc.CallOption -} - -// ErrNilContainerServiceClient is returned by functions that expect -// a non-nil ContainerServiceClient, but received nil. -var ErrNilContainerServiceClient = errors.New("container gRPC client is nil") - -func defaultCfg() *cfg { - return new(cfg) -} - -// NewClient creates, initializes and returns a new Client instance. -// -// Options are applied one by one in order. -func NewClient(c ContainerServiceClient, opts ...Option) (*Client, error) { - if c == nil { - return nil, ErrNilContainerServiceClient - } - - cfg := defaultCfg() - for i := range opts { - opts[i](cfg) - } - - return &Client{ - cfg: cfg, - client: c, - }, nil -} - -func (c *Client) Put(ctx context.Context, req *PutRequest) (*PutResponse, error) { - return c.client.Put(ctx, req, c.callOpts...) -} - -func (c *Client) Get(ctx context.Context, req *GetRequest) (*GetResponse, error) { - return c.client.Get(ctx, req, c.callOpts...) -} - -func (c *Client) Delete(ctx context.Context, req *DeleteRequest) (*DeleteResponse, error) { - return c.client.Delete(ctx, req, c.callOpts...) -} - -func (c *Client) List(ctx context.Context, req *ListRequest) (*ListResponse, error) { - return c.client.List(ctx, req, c.callOpts...) -} - -func (c *Client) SetExtendedACL(ctx context.Context, req *SetExtendedACLRequest) (*SetExtendedACLResponse, error) { - return c.client.SetExtendedACL(ctx, req, c.callOpts...) -} - -func (c *Client) GetExtendedACL(ctx context.Context, req *GetExtendedACLRequest) (*GetExtendedACLResponse, error) { - return c.client.GetExtendedACL(ctx, req, c.callOpts...) -} - -func (c *Client) AnnounceUsedSpace(ctx context.Context, req *AnnounceUsedSpaceRequest) (*AnnounceUsedSpaceResponse, error) { - return c.client.AnnounceUsedSpace(ctx, req, c.callOpts...) -} - -// WithCallOptions returns Option that configures -// Client to attach call options to each rpc call. -func WithCallOptions(opts []grpc.CallOption) Option { - return func(c *cfg) { - c.callOpts = opts - } -} diff --git a/v2/container/json.go b/v2/container/json.go index 7ce52da..c681540 100644 --- a/v2/container/json.go +++ b/v2/container/json.go @@ -1,46 +1,22 @@ package container import ( + "github.com/nspcc-dev/neofs-api-go/rpc/message" container "github.com/nspcc-dev/neofs-api-go/v2/container/grpc" - "google.golang.org/protobuf/encoding/protojson" ) func (a *Attribute) MarshalJSON() ([]byte, error) { - return protojson.MarshalOptions{ - EmitUnpopulated: true, - }.Marshal( - AttributeToGRPCMessage(a), - ) + return message.MarshalJSON(a) } func (a *Attribute) UnmarshalJSON(data []byte) error { - msg := new(container.Container_Attribute) - - if err := protojson.Unmarshal(data, msg); err != nil { - return err - } - - *a = *AttributeFromGRPCMessage(msg) - - return nil + return message.UnmarshalJSON(a, data, new(container.Container_Attribute)) } func (c *Container) MarshalJSON() ([]byte, error) { - return protojson.MarshalOptions{ - EmitUnpopulated: true, - }.Marshal( - ContainerToGRPCMessage(c), - ) + return message.MarshalJSON(c) } func (c *Container) UnmarshalJSON(data []byte) error { - msg := new(container.Container) - - if err := protojson.Unmarshal(data, msg); err != nil { - return err - } - - *c = *ContainerFromGRPCMessage(msg) - - return nil + return message.UnmarshalJSON(c, data, new(container.Container)) } diff --git a/v2/container/json_test.go b/v2/container/json_test.go deleted file mode 100644 index 40228a2..0000000 --- a/v2/container/json_test.go +++ /dev/null @@ -1,32 +0,0 @@ -package container_test - -import ( - "testing" - - "github.com/nspcc-dev/neofs-api-go/v2/container" - "github.com/stretchr/testify/require" -) - -func TestContainerJSON(t *testing.T) { - c := generateContainer("nonce") - - data, err := c.MarshalJSON() - require.NoError(t, err) - - c2 := new(container.Container) - require.NoError(t, c2.UnmarshalJSON(data)) - - require.Equal(t, c, c2) -} - -func TestAttributeJSON(t *testing.T) { - b := generateAttribute("key", "value") - - data, err := b.MarshalJSON() - require.NoError(t, err) - - b2 := new(container.Attribute) - require.NoError(t, b2.UnmarshalJSON(data)) - - require.Equal(t, b, b2) -} diff --git a/v2/container/marshal.go b/v2/container/marshal.go index cf16e8a..3c0af3e 100644 --- a/v2/container/marshal.go +++ b/v2/container/marshal.go @@ -1,9 +1,9 @@ package container import ( + "github.com/nspcc-dev/neofs-api-go/rpc/message" protoutil "github.com/nspcc-dev/neofs-api-go/util/proto" container "github.com/nspcc-dev/neofs-api-go/v2/container/grpc" - "google.golang.org/protobuf/proto" ) const ( @@ -89,14 +89,7 @@ func (a *Attribute) StableSize() (size int) { } func (a *Attribute) Unmarshal(data []byte) error { - m := new(container.Container_Attribute) - if err := proto.Unmarshal(data, m); err != nil { - return err - } - - *a = *AttributeFromGRPCMessage(m) - - return nil + return message.Unmarshal(a, data, new(container.Container_Attribute)) } func (c *Container) StableMarshal(buf []byte) ([]byte, error) { @@ -178,14 +171,7 @@ func (c *Container) StableSize() (size int) { } func (c *Container) Unmarshal(data []byte) error { - m := new(container.Container) - if err := proto.Unmarshal(data, m); err != nil { - return err - } - - *c = *ContainerFromGRPCMessage(m) - - return nil + return message.Unmarshal(c, data, new(container.Container)) } func (r *PutRequestBody) StableMarshal(buf []byte) ([]byte, error) { @@ -228,6 +214,10 @@ func (r *PutRequestBody) StableSize() (size int) { return size } +func (r *PutRequestBody) Unmarshal(data []byte) error { + return message.Unmarshal(r, data, new(container.PutRequest_Body)) +} + func (r *PutResponseBody) StableMarshal(buf []byte) ([]byte, error) { if r == nil { return []byte{}, nil @@ -259,6 +249,10 @@ func (r *PutResponseBody) StableSize() (size int) { return size } +func (r *PutResponseBody) Unmarshal(data []byte) error { + return message.Unmarshal(r, data, new(container.PutResponse_Body)) +} + func (r *DeleteRequestBody) StableMarshal(buf []byte) ([]byte, error) { if r == nil { return []byte{}, nil @@ -299,6 +293,10 @@ func (r *DeleteRequestBody) StableSize() (size int) { return size } +func (r *DeleteRequestBody) Unmarshal(data []byte) error { + return message.Unmarshal(r, data, new(container.DeleteRequest_Body)) +} + func (r *DeleteResponseBody) StableMarshal(buf []byte) ([]byte, error) { return nil, nil } @@ -307,6 +305,10 @@ func (r *DeleteResponseBody) StableSize() (size int) { return 0 } +func (r *DeleteResponseBody) Unmarshal([]byte) error { + return nil +} + func (r *GetRequestBody) StableMarshal(buf []byte) ([]byte, error) { if r == nil { return []byte{}, nil @@ -334,6 +336,10 @@ func (r *GetRequestBody) StableSize() (size int) { return size } +func (r *GetRequestBody) Unmarshal(data []byte) error { + return message.Unmarshal(r, data, new(container.GetRequest_Body)) +} + func (r *GetResponseBody) StableMarshal(buf []byte) ([]byte, error) { if r == nil { return []byte{}, nil @@ -361,6 +367,10 @@ func (r *GetResponseBody) StableSize() (size int) { return size } +func (r *GetResponseBody) Unmarshal(data []byte) error { + return message.Unmarshal(r, data, new(container.GetResponse_Body)) +} + func (r *ListRequestBody) StableMarshal(buf []byte) ([]byte, error) { if r == nil { return []byte{}, nil @@ -388,6 +398,10 @@ func (r *ListRequestBody) StableSize() (size int) { return size } +func (r *ListRequestBody) Unmarshal(data []byte) error { + return message.Unmarshal(r, data, new(container.ListRequest_Body)) +} + func (r *ListResponseBody) StableMarshal(buf []byte) ([]byte, error) { if r == nil { return []byte{}, nil @@ -426,6 +440,10 @@ func (r *ListResponseBody) StableSize() (size int) { return size } +func (r *ListResponseBody) Unmarshal(data []byte) error { + return message.Unmarshal(r, data, new(container.ListResponse_Body)) +} + func (r *SetExtendedACLRequestBody) StableMarshal(buf []byte) ([]byte, error) { if r == nil { return []byte{}, nil @@ -466,6 +484,10 @@ func (r *SetExtendedACLRequestBody) StableSize() (size int) { return size } +func (r *SetExtendedACLRequestBody) Unmarshal(data []byte) error { + return message.Unmarshal(r, data, new(container.SetExtendedACLRequest_Body)) +} + func (r *SetExtendedACLResponseBody) StableMarshal(buf []byte) ([]byte, error) { return nil, nil } @@ -474,6 +496,10 @@ func (r *SetExtendedACLResponseBody) StableSize() (size int) { return 0 } +func (r *SetExtendedACLResponseBody) Unmarshal([]byte) error { + return nil +} + func (r *GetExtendedACLRequestBody) StableMarshal(buf []byte) ([]byte, error) { if r == nil { return []byte{}, nil @@ -501,6 +527,10 @@ func (r *GetExtendedACLRequestBody) StableSize() (size int) { return size } +func (r *GetExtendedACLRequestBody) Unmarshal(data []byte) error { + return message.Unmarshal(r, data, new(container.GetExtendedACLRequest_Body)) +} + func (r *GetExtendedACLResponseBody) StableMarshal(buf []byte) ([]byte, error) { if r == nil { return []byte{}, nil @@ -541,6 +571,10 @@ func (r *GetExtendedACLResponseBody) StableSize() (size int) { return size } +func (r *GetExtendedACLResponseBody) Unmarshal(data []byte) error { + return message.Unmarshal(r, data, new(container.GetExtendedACLResponse_Body)) +} + func (a *UsedSpaceAnnouncement) StableMarshal(buf []byte) ([]byte, error) { if a == nil { return []byte{}, nil @@ -590,14 +624,7 @@ func (a *UsedSpaceAnnouncement) StableSize() (size int) { } func (a *UsedSpaceAnnouncement) Unmarshal(data []byte) error { - m := new(container.AnnounceUsedSpaceRequest_Body_Announcement) - if err := proto.Unmarshal(data, m); err != nil { - return err - } - - *a = *UsedSpaceAnnouncementFromGRPCMessage(m) - - return nil + return message.Unmarshal(a, data, new(container.AnnounceUsedSpaceRequest_Body_Announcement)) } func (r *AnnounceUsedSpaceRequestBody) StableMarshal(buf []byte) ([]byte, error) { @@ -638,6 +665,10 @@ func (r *AnnounceUsedSpaceRequestBody) StableSize() (size int) { return size } +func (r *AnnounceUsedSpaceRequestBody) Unmarshal(data []byte) error { + return message.Unmarshal(r, data, new(container.AnnounceUsedSpaceRequest_Body)) +} + func (r *AnnounceUsedSpaceResponseBody) StableMarshal(buf []byte) ([]byte, error) { return nil, nil } @@ -645,3 +676,7 @@ func (r *AnnounceUsedSpaceResponseBody) StableMarshal(buf []byte) ([]byte, error func (r *AnnounceUsedSpaceResponseBody) StableSize() (size int) { return 0 } + +func (r *AnnounceUsedSpaceResponseBody) Unmarshal([]byte) error { + return nil +} diff --git a/v2/container/marshal_test.go b/v2/container/marshal_test.go deleted file mode 100644 index f1fc189..0000000 --- a/v2/container/marshal_test.go +++ /dev/null @@ -1,492 +0,0 @@ -package container_test - -import ( - "crypto/sha256" - "fmt" - "math/rand" - "testing" - - "github.com/nspcc-dev/neofs-api-go/v2/acl" - "github.com/nspcc-dev/neofs-api-go/v2/container" - grpc "github.com/nspcc-dev/neofs-api-go/v2/container/grpc" - "github.com/nspcc-dev/neofs-api-go/v2/refs" - "github.com/stretchr/testify/require" - goproto "google.golang.org/protobuf/proto" -) - -func TestAttribute_StableMarshal(t *testing.T) { - attributeFrom := generateAttribute("key", "value") - - t.Run("non empty", func(t *testing.T) { - wire, err := attributeFrom.StableMarshal(nil) - require.NoError(t, err) - - attributeTo := new(container.Attribute) - require.NoError(t, attributeTo.Unmarshal(wire)) - - require.Equal(t, attributeFrom, attributeTo) - }) -} - -func TestContainer_StableMarshal(t *testing.T) { - cnrFrom := generateContainer("nonce") - - t.Run("non empty", func(t *testing.T) { - wire, err := cnrFrom.StableMarshal(nil) - require.NoError(t, err) - - cnrTo := new(container.Container) - require.NoError(t, cnrTo.Unmarshal(wire)) - - require.Equal(t, cnrFrom, cnrTo) - }) -} - -func TestPutRequestBody_StableMarshal(t *testing.T) { - requestFrom := generatePutRequestBody("nonce") - transport := new(grpc.PutRequest_Body) - - t.Run("non empty", func(t *testing.T) { - wire, err := requestFrom.StableMarshal(nil) - require.NoError(t, err) - - err = goproto.Unmarshal(wire, transport) - require.NoError(t, err) - - requestTo := container.PutRequestBodyFromGRPCMessage(transport) - require.Equal(t, requestFrom, requestTo) - }) -} - -func TestPutResponseBody_StableMarshal(t *testing.T) { - responseFrom := generatePutResponseBody("Container ID") - transport := new(grpc.PutResponse_Body) - - t.Run("non empty", func(t *testing.T) { - wire, err := responseFrom.StableMarshal(nil) - require.NoError(t, err) - - err = goproto.Unmarshal(wire, transport) - require.NoError(t, err) - - responseTo := container.PutResponseBodyFromGRPCMessage(transport) - require.Equal(t, responseFrom, responseTo) - }) -} - -func TestDeleteRequestBody_StableMarshal(t *testing.T) { - requestFrom := generateDeleteRequestBody("Container ID") - transport := new(grpc.DeleteRequest_Body) - - t.Run("non empty", func(t *testing.T) { - wire, err := requestFrom.StableMarshal(nil) - require.NoError(t, err) - - err = goproto.Unmarshal(wire, transport) - require.NoError(t, err) - - requestTo := container.DeleteRequestBodyFromGRPCMessage(transport) - require.Equal(t, requestFrom, requestTo) - }) -} - -func TestDeleteResponseBody_StableMarshal(t *testing.T) { - responseFrom := generateDeleteResponseBody() - transport := new(grpc.DeleteResponse_Body) - - t.Run("non empty", func(t *testing.T) { - wire, err := responseFrom.StableMarshal(nil) - require.NoError(t, err) - - err = goproto.Unmarshal(wire, transport) - require.NoError(t, err) - - responseTo := container.DeleteResponseBodyFromGRPCMessage(transport) - require.Equal(t, responseFrom, responseTo) - }) -} - -func TestGetRequestBody_StableMarshal(t *testing.T) { - requestFrom := generateGetRequestBody("Container ID") - transport := new(grpc.GetRequest_Body) - - t.Run("non empty", func(t *testing.T) { - wire, err := requestFrom.StableMarshal(nil) - require.NoError(t, err) - - err = goproto.Unmarshal(wire, transport) - require.NoError(t, err) - - requestTo := container.GetRequestBodyFromGRPCMessage(transport) - require.Equal(t, requestFrom, requestTo) - }) -} - -func TestGetResponseBody_StableMarshal(t *testing.T) { - responseFrom := generateGetResponseBody("nonce") - transport := new(grpc.GetResponse_Body) - - t.Run("non empty", func(t *testing.T) { - wire, err := responseFrom.StableMarshal(nil) - require.NoError(t, err) - - err = goproto.Unmarshal(wire, transport) - require.NoError(t, err) - - responseTo := container.GetResponseBodyFromGRPCMessage(transport) - require.Equal(t, responseFrom, responseTo) - }) -} - -func TestListRequestBody_StableMarshal(t *testing.T) { - requestFrom := generateListRequestBody("Owner ID") - transport := new(grpc.ListRequest_Body) - - t.Run("non empty", func(t *testing.T) { - wire, err := requestFrom.StableMarshal(nil) - require.NoError(t, err) - - err = goproto.Unmarshal(wire, transport) - require.NoError(t, err) - - requestTo := container.ListRequestBodyFromGRPCMessage(transport) - require.Equal(t, requestFrom, requestTo) - }) -} - -func TestListResponseBody_StableMarshal(t *testing.T) { - responseFrom := generateListResponseBody(3) - transport := new(grpc.ListResponse_Body) - - t.Run("non empty", func(t *testing.T) { - wire, err := responseFrom.StableMarshal(nil) - require.NoError(t, err) - - err = goproto.Unmarshal(wire, transport) - require.NoError(t, err) - - responseTo := container.ListResponseBodyFromGRPCMessage(transport) - require.Equal(t, responseFrom, responseTo) - }) -} - -func TestSetEACLRequestBody_StableMarshal(t *testing.T) { - requestFrom := generateSetEACLRequestBody(4, "Filter Key", "Filter Value") - transport := new(grpc.SetExtendedACLRequest_Body) - - t.Run("non empty", func(t *testing.T) { - wire, err := requestFrom.StableMarshal(nil) - require.NoError(t, err) - - err = goproto.Unmarshal(wire, transport) - require.NoError(t, err) - - requestTo := container.SetExtendedACLRequestBodyFromGRPCMessage(transport) - require.Equal(t, requestFrom, requestTo) - }) -} - -func TestSetEACLResponseBody_StableMarshal(t *testing.T) { - responseFrom := generateSetEACLResponseBody() - transport := new(grpc.SetExtendedACLResponse_Body) - - t.Run("non empty", func(t *testing.T) { - wire, err := responseFrom.StableMarshal(nil) - require.NoError(t, err) - - err = goproto.Unmarshal(wire, transport) - require.NoError(t, err) - - responseTo := container.SetExtendedACLResponseBodyFromGRPCMessage(transport) - require.Equal(t, responseFrom, responseTo) - }) -} - -func TestGetEACLRequestBody_StableMarshal(t *testing.T) { - requestFrom := generateGetEACLRequestBody("Container ID") - transport := new(grpc.GetExtendedACLRequest_Body) - - t.Run("non empty", func(t *testing.T) { - wire, err := requestFrom.StableMarshal(nil) - require.NoError(t, err) - - err = goproto.Unmarshal(wire, transport) - require.NoError(t, err) - - requestTo := container.GetExtendedACLRequestBodyFromGRPCMessage(transport) - require.Equal(t, requestFrom, requestTo) - }) -} - -func TestGetEACLResponseBody_StableMarshal(t *testing.T) { - responseFrom := generateGetEACLResponseBody(3, "Filter Key", "Filter Value") - transport := new(grpc.GetExtendedACLResponse_Body) - - t.Run("non empty", func(t *testing.T) { - wire, err := responseFrom.StableMarshal(nil) - require.NoError(t, err) - - err = goproto.Unmarshal(wire, transport) - require.NoError(t, err) - - responseTo := container.GetExtendedACLResponseBodyFromGRPCMessage(transport) - require.Equal(t, responseFrom, responseTo) - }) -} - -func TestUsedSpaceAnnouncement_StableMarshal(t *testing.T) { - from := generateAnnouncement() - transport := new(grpc.AnnounceUsedSpaceRequest_Body_Announcement) - - t.Run("non empty", func(t *testing.T) { - wire, err := from.StableMarshal(nil) - require.NoError(t, err) - - err = goproto.Unmarshal(wire, transport) - require.NoError(t, err) - - to := container.UsedSpaceAnnouncementFromGRPCMessage(transport) - require.Equal(t, from, to) - }) -} - -func TestAnnounceUsedSpaceRequestBody_StableMarshal(t *testing.T) { - requestFrom := generateAnnounceRequestBody(10) - transport := new(grpc.AnnounceUsedSpaceRequest_Body) - - t.Run("non empty", func(t *testing.T) { - wire, err := requestFrom.StableMarshal(nil) - require.NoError(t, err) - - err = goproto.Unmarshal(wire, transport) - require.NoError(t, err) - - requestTo := container.AnnounceUsedSpaceRequestBodyFromGRPCMessage(transport) - require.Equal(t, requestFrom, requestTo) - }) -} - -func TestAnnounceUsedSpaceResponseBody_StableMarshal(t *testing.T) { - responseFrom := generateAnnounceResponseBody() - transport := new(grpc.AnnounceUsedSpaceResponse_Body) - - t.Run("non empty", func(t *testing.T) { - wire, err := responseFrom.StableMarshal(nil) - require.NoError(t, err) - - err = goproto.Unmarshal(wire, transport) - require.NoError(t, err) - - responseTo := container.AnnounceUsedSpaceResponseBodyFromGRPCMessage(transport) - require.Equal(t, responseFrom, responseTo) - }) -} - -func generateAttribute(k, v string) *container.Attribute { - attr := new(container.Attribute) - attr.SetKey(k) - attr.SetValue(v) - - return attr -} - -func generateContainer(n string) *container.Container { - owner := new(refs.OwnerID) - owner.SetValue([]byte("Owner ID")) - - version := new(refs.Version) - version.SetMajor(2) - version.SetMinor(0) - - // todo: add placement rule - - cnr := new(container.Container) - cnr.SetOwnerID(owner) - cnr.SetVersion(version) - cnr.SetAttributes([]*container.Attribute{ - generateAttribute("one", "two"), - generateAttribute("three", "four"), - }) - cnr.SetBasicACL(100) - cnr.SetNonce([]byte(n)) - - return cnr -} - -func generateSignature(k, v string) *refs.Signature { - sig := new(refs.Signature) - sig.SetKey([]byte(k)) - sig.SetSign([]byte(v)) - - return sig -} - -func generatePutRequestBody(n string) *container.PutRequestBody { - req := new(container.PutRequestBody) - req.SetContainer(generateContainer(n)) - req.SetSignature(generateSignature("public key", "signature")) - - return req -} - -func generatePutResponseBody(id string) *container.PutResponseBody { - cid := new(refs.ContainerID) - cid.SetValue([]byte(id)) - - resp := new(container.PutResponseBody) - resp.SetContainerID(cid) - - return resp -} - -func generateDeleteRequestBody(id string) *container.DeleteRequestBody { - cid := new(refs.ContainerID) - cid.SetValue([]byte(id)) - - req := new(container.DeleteRequestBody) - req.SetContainerID(cid) - req.SetSignature(generateSignature("public key", "signature")) - - return req -} - -func generateDeleteResponseBody() *container.DeleteResponseBody { - return new(container.DeleteResponseBody) -} - -func generateGetRequestBody(id string) *container.GetRequestBody { - cid := new(refs.ContainerID) - cid.SetValue([]byte(id)) - - req := new(container.GetRequestBody) - req.SetContainerID(cid) - - return req -} - -func generateGetResponseBody(n string) *container.GetResponseBody { - resp := new(container.GetResponseBody) - resp.SetContainer(generateContainer(n)) - - return resp -} - -func generateListRequestBody(id string) *container.ListRequestBody { - owner := new(refs.OwnerID) - owner.SetValue([]byte(id)) - - req := new(container.ListRequestBody) - req.SetOwnerID(owner) - - return req -} - -func generateListResponseBody(n int) *container.ListResponseBody { - resp := new(container.ListResponseBody) - - ids := make([]*refs.ContainerID, n) - for i := 0; i < n; i++ { - cid := new(refs.ContainerID) - cid.SetValue([]byte(fmt.Sprintf("Container ID %d", n+1))) - ids[i] = cid - } - - resp.SetContainerIDs(ids) - - return resp -} - -func generateEACL(n int, k, v string) *acl.Table { - target := new(acl.Target) - target.SetRole(acl.RoleUser) - - keys := make([][]byte, n) - - for i := 0; i < n; i++ { - s := fmt.Sprintf("Public Key %d", i+1) - keys[i] = []byte(s) - } - - filter := new(acl.HeaderFilter) - filter.SetHeaderType(acl.HeaderTypeObject) - filter.SetMatchType(acl.MatchTypeStringEqual) - filter.SetKey(k) - filter.SetValue(v) - - record := new(acl.Record) - record.SetOperation(acl.OperationHead) - record.SetAction(acl.ActionDeny) - record.SetTargets([]*acl.Target{target}) - record.SetFilters([]*acl.HeaderFilter{filter}) - - table := new(acl.Table) - cid := new(refs.ContainerID) - cid.SetValue([]byte("Container ID")) - - table.SetContainerID(cid) - table.SetRecords([]*acl.Record{record}) - - return table -} - -func generateSetEACLRequestBody(n int, k, v string) *container.SetExtendedACLRequestBody { - req := new(container.SetExtendedACLRequestBody) - req.SetEACL(generateEACL(n, k, v)) - req.SetSignature(generateSignature("public key", "signature")) - - return req -} - -func generateSetEACLResponseBody() *container.SetExtendedACLResponseBody { - return new(container.SetExtendedACLResponseBody) -} - -func generateGetEACLRequestBody(id string) *container.GetExtendedACLRequestBody { - cid := new(refs.ContainerID) - cid.SetValue([]byte(id)) - - req := new(container.GetExtendedACLRequestBody) - req.SetContainerID(cid) - - return req -} - -func generateGetEACLResponseBody(n int, k, v string) *container.GetExtendedACLResponseBody { - resp := new(container.GetExtendedACLResponseBody) - resp.SetEACL(generateEACL(n, k, v)) - resp.SetSignature(generateSignature("public key", "signature")) - - return resp -} - -func generateAnnouncement() *container.UsedSpaceAnnouncement { - buf := make([]byte, sha256.Size) - rand.Read(buf) - - cid := new(refs.ContainerID) - cid.SetValue(buf) - - a := new(container.UsedSpaceAnnouncement) - a.SetEpoch(rand.Uint64()) - a.SetContainerID(cid) - a.SetUsedSpace(rand.Uint64()) - - return a -} - -func generateAnnounceRequestBody(n int) *container.AnnounceUsedSpaceRequestBody { - resp := new(container.AnnounceUsedSpaceRequestBody) - - announcements := make([]*container.UsedSpaceAnnouncement, 0, n) - for i := 0; i < n; i++ { - announcements = append(announcements, generateAnnouncement()) - } - - resp.SetAnnouncements(announcements) - - return resp -} - -func generateAnnounceResponseBody() *container.AnnounceUsedSpaceResponseBody { - return new(container.AnnounceUsedSpaceResponseBody) -} diff --git a/v2/container/message_test.go b/v2/container/message_test.go new file mode 100644 index 0000000..592fcbe --- /dev/null +++ b/v2/container/message_test.go @@ -0,0 +1,43 @@ +package container_test + +import ( + "testing" + + "github.com/nspcc-dev/neofs-api-go/rpc/message" + messagetest "github.com/nspcc-dev/neofs-api-go/rpc/message/test" + containertest "github.com/nspcc-dev/neofs-api-go/v2/container/test" +) + +func TestMessageConvert(t *testing.T) { + messagetest.TestRPCMessage(t, + func(empty bool) message.Message { return containertest.GenerateAttribute(empty) }, + func(empty bool) message.Message { return containertest.GenerateContainer(empty) }, + func(empty bool) message.Message { return containertest.GeneratePutRequestBody(empty) }, + func(empty bool) message.Message { return containertest.GeneratePutRequest(empty) }, + func(empty bool) message.Message { return containertest.GeneratePutResponseBody(empty) }, + func(empty bool) message.Message { return containertest.GeneratePutResponse(empty) }, + func(empty bool) message.Message { return containertest.GenerateGetRequestBody(empty) }, + func(empty bool) message.Message { return containertest.GenerateGetRequest(empty) }, + func(empty bool) message.Message { return containertest.GenerateGetResponseBody(empty) }, + func(empty bool) message.Message { return containertest.GenerateGetResponse(empty) }, + func(empty bool) message.Message { return containertest.GenerateDeleteRequestBody(empty) }, + func(empty bool) message.Message { return containertest.GenerateDeleteRequest(empty) }, + func(empty bool) message.Message { return containertest.GenerateDeleteResponseBody(empty) }, + func(empty bool) message.Message { return containertest.GenerateDeleteResponse(empty) }, + func(empty bool) message.Message { return containertest.GenerateListRequestBody(empty) }, + func(empty bool) message.Message { return containertest.GenerateListRequest(empty) }, + func(empty bool) message.Message { return containertest.GenerateListResponseBody(empty) }, + func(empty bool) message.Message { return containertest.GenerateListResponse(empty) }, + func(empty bool) message.Message { return containertest.GenerateSetExtendedACLRequestBody(empty) }, + func(empty bool) message.Message { return containertest.GenerateSetExtendedACLRequest(empty) }, + func(empty bool) message.Message { return containertest.GenerateGetRequestBody(empty) }, + func(empty bool) message.Message { return containertest.GenerateGetRequest(empty) }, + func(empty bool) message.Message { return containertest.GenerateGetResponseBody(empty) }, + func(empty bool) message.Message { return containertest.GenerateGetResponse(empty) }, + func(empty bool) message.Message { return containertest.GenerateUsedSpaceAnnouncement(empty) }, + func(empty bool) message.Message { return containertest.GenerateAnnounceUsedSpaceRequestBody(empty) }, + func(empty bool) message.Message { return containertest.GenerateAnnounceUsedSpaceRequest(empty) }, + func(empty bool) message.Message { return containertest.GenerateAnnounceUsedSpaceResponseBody(empty) }, + func(empty bool) message.Message { return containertest.GenerateAnnounceUsedSpaceResponse(empty) }, + ) +} diff --git a/v2/container/service.go b/v2/container/service.go deleted file mode 100644 index 7c369b2..0000000 --- a/v2/container/service.go +++ /dev/null @@ -1,113 +0,0 @@ -package container - -import ( - "context" - - "github.com/nspcc-dev/neofs-api-go/v2/session" -) - -type Service interface { - Put(context.Context, *PutRequest) (*PutResponse, error) - Delete(context.Context, *DeleteRequest) (*DeleteResponse, error) - Get(context.Context, *GetRequest) (*GetResponse, error) - List(context.Context, *ListRequest) (*ListResponse, error) - SetExtendedACL(context.Context, *SetExtendedACLRequest) (*SetExtendedACLResponse, error) - GetExtendedACL(context.Context, *GetExtendedACLRequest) (*GetExtendedACLResponse, error) - AnnounceUsedSpace(context.Context, *AnnounceUsedSpaceRequest) (*AnnounceUsedSpaceResponse, error) -} - -type PutRequest struct { - body *PutRequestBody - - metaHeader *session.RequestMetaHeader - - verifyHeader *session.RequestVerificationHeader -} - -type PutResponse struct { - body *PutResponseBody - - metaHeader *session.ResponseMetaHeader - - verifyHeader *session.ResponseVerificationHeader -} - -type DeleteRequest struct { - body *DeleteRequestBody - - metaHeader *session.RequestMetaHeader - - verifyHeader *session.RequestVerificationHeader -} - -type DeleteResponse struct { - body *DeleteResponseBody - - metaHeader *session.ResponseMetaHeader - - verifyHeader *session.ResponseVerificationHeader -} - -type ListRequest struct { - body *ListRequestBody - - metaHeader *session.RequestMetaHeader - - verifyHeader *session.RequestVerificationHeader -} - -type ListResponse struct { - body *ListResponseBody - - metaHeader *session.ResponseMetaHeader - - verifyHeader *session.ResponseVerificationHeader -} - -type SetExtendedACLRequest struct { - body *SetExtendedACLRequestBody - - metaHeader *session.RequestMetaHeader - - verifyHeader *session.RequestVerificationHeader -} - -type SetExtendedACLResponse struct { - body *SetExtendedACLResponseBody - - metaHeader *session.ResponseMetaHeader - - verifyHeader *session.ResponseVerificationHeader -} - -type GetExtendedACLRequest struct { - body *GetExtendedACLRequestBody - - metaHeader *session.RequestMetaHeader - - verifyHeader *session.RequestVerificationHeader -} - -type GetExtendedACLResponse struct { - body *GetExtendedACLResponseBody - - metaHeader *session.ResponseMetaHeader - - verifyHeader *session.ResponseVerificationHeader -} - -type AnnounceUsedSpaceRequest struct { - body *AnnounceUsedSpaceRequestBody - - metaHeader *session.RequestMetaHeader - - verifyHeader *session.RequestVerificationHeader -} - -type AnnounceUsedSpaceResponse struct { - body *AnnounceUsedSpaceResponseBody - - metaHeader *session.ResponseMetaHeader - - verifyHeader *session.ResponseVerificationHeader -} diff --git a/v2/container/test/client_test.go b/v2/container/test/client_test.go deleted file mode 100644 index 177b9c9..0000000 --- a/v2/container/test/client_test.go +++ /dev/null @@ -1,958 +0,0 @@ -package main - -import ( - "context" - "crypto/ecdsa" - "errors" - "testing" - - "github.com/nspcc-dev/neofs-api-go/v2/acl" - "github.com/nspcc-dev/neofs-api-go/v2/container" - containerGRPC "github.com/nspcc-dev/neofs-api-go/v2/container/grpc" - "github.com/nspcc-dev/neofs-api-go/v2/refs" - "github.com/nspcc-dev/neofs-api-go/v2/session" - "github.com/nspcc-dev/neofs-api-go/v2/signature" - "github.com/nspcc-dev/neofs-crypto/test" - "github.com/stretchr/testify/require" - "google.golang.org/grpc" -) - -type testGRPCClient struct { - server containerGRPC.ContainerServiceServer -} - -type testGRPCServer struct { - key *ecdsa.PrivateKey - putResp *container.PutResponse - getResp *container.GetResponse - delResp *container.DeleteResponse - listResp *container.ListResponse - sEaclResp *container.SetExtendedACLResponse - gEaclResp *container.GetExtendedACLResponse - announceResp *container.AnnounceUsedSpaceResponse - err error -} - -func (s *testGRPCClient) Put(ctx context.Context, in *containerGRPC.PutRequest, opts ...grpc.CallOption) (*containerGRPC.PutResponse, error) { - return s.server.Put(ctx, in) -} - -func (s *testGRPCClient) Delete(ctx context.Context, in *containerGRPC.DeleteRequest, opts ...grpc.CallOption) (*containerGRPC.DeleteResponse, error) { - return s.server.Delete(ctx, in) -} - -func (s *testGRPCClient) Get(ctx context.Context, in *containerGRPC.GetRequest, opts ...grpc.CallOption) (*containerGRPC.GetResponse, error) { - return s.server.Get(ctx, in) -} - -func (s *testGRPCClient) List(ctx context.Context, in *containerGRPC.ListRequest, opts ...grpc.CallOption) (*containerGRPC.ListResponse, error) { - return s.server.List(ctx, in) -} - -func (s *testGRPCClient) SetExtendedACL(ctx context.Context, in *containerGRPC.SetExtendedACLRequest, opts ...grpc.CallOption) (*containerGRPC.SetExtendedACLResponse, error) { - return s.server.SetExtendedACL(ctx, in) -} - -func (s *testGRPCClient) GetExtendedACL(ctx context.Context, in *containerGRPC.GetExtendedACLRequest, opts ...grpc.CallOption) (*containerGRPC.GetExtendedACLResponse, error) { - return s.server.GetExtendedACL(ctx, in) -} - -func (s *testGRPCClient) AnnounceUsedSpace(ctx context.Context, in *containerGRPC.AnnounceUsedSpaceRequest, opts ...grpc.CallOption) (*containerGRPC.AnnounceUsedSpaceResponse, error) { - return s.server.AnnounceUsedSpace(ctx, in) -} - -func (s *testGRPCServer) Put(_ context.Context, req *containerGRPC.PutRequest) (*containerGRPC.PutResponse, error) { - if s.err != nil { - return nil, s.err - } - - // verify request structure - if err := signature.VerifyServiceMessage( - container.PutRequestFromGRPCMessage(req), - ); err != nil { - return nil, err - } - - // sign response structure - if err := signature.SignServiceMessage(s.key, s.putResp); err != nil { - return nil, err - } - - return container.PutResponseToGRPCMessage(s.putResp), nil -} - -func (s *testGRPCServer) Delete(_ context.Context, req *containerGRPC.DeleteRequest) (*containerGRPC.DeleteResponse, error) { - if s.err != nil { - return nil, s.err - } - - // verify request structure - if err := signature.VerifyServiceMessage( - container.DeleteRequestFromGRPCMessage(req), - ); err != nil { - return nil, err - } - - // sign response structure - if err := signature.SignServiceMessage(s.key, s.delResp); err != nil { - return nil, err - } - - return container.DeleteResponseToGRPCMessage(s.delResp), nil -} - -func (s *testGRPCServer) Get(_ context.Context, req *containerGRPC.GetRequest) (*containerGRPC.GetResponse, error) { - if s.err != nil { - return nil, s.err - } - - // verify request structure - if err := signature.VerifyServiceMessage( - container.GetRequestFromGRPCMessage(req), - ); err != nil { - return nil, err - } - - // sign response structure - if err := signature.SignServiceMessage(s.key, s.getResp); err != nil { - return nil, err - } - - return container.GetResponseToGRPCMessage(s.getResp), nil -} - -func (s *testGRPCServer) List(_ context.Context, req *containerGRPC.ListRequest) (*containerGRPC.ListResponse, error) { - if s.err != nil { - return nil, s.err - } - - // verify request structure - if err := signature.VerifyServiceMessage( - container.ListRequestFromGRPCMessage(req), - ); err != nil { - return nil, err - } - - // sign response structure - if err := signature.SignServiceMessage(s.key, s.listResp); err != nil { - return nil, err - } - - return container.ListResponseToGRPCMessage(s.listResp), nil -} - -func (s *testGRPCServer) SetExtendedACL(_ context.Context, req *containerGRPC.SetExtendedACLRequest) (*containerGRPC.SetExtendedACLResponse, error) { - if s.err != nil { - return nil, s.err - } - - // verify request structure - if err := signature.VerifyServiceMessage( - container.SetExtendedACLRequestFromGRPCMessage(req), - ); err != nil { - return nil, err - } - - // sign response structure - if err := signature.SignServiceMessage(s.key, s.sEaclResp); err != nil { - return nil, err - } - - return container.SetExtendedACLResponseToGRPCMessage(s.sEaclResp), nil -} - -func (s *testGRPCServer) GetExtendedACL(_ context.Context, req *containerGRPC.GetExtendedACLRequest) (*containerGRPC.GetExtendedACLResponse, error) { - if s.err != nil { - return nil, s.err - } - - // verify request structure - if err := signature.VerifyServiceMessage( - container.GetExtendedACLRequestFromGRPCMessage(req), - ); err != nil { - return nil, err - } - - // sign response structure - if err := signature.SignServiceMessage(s.key, s.gEaclResp); err != nil { - return nil, err - } - - return container.GetExtendedACLResponseToGRPCMessage(s.gEaclResp), nil -} - -func (s *testGRPCServer) AnnounceUsedSpace(_ context.Context, req *containerGRPC.AnnounceUsedSpaceRequest) (*containerGRPC.AnnounceUsedSpaceResponse, error) { - if s.err != nil { - return nil, s.err - } - - // verify request structure - if err := signature.VerifyServiceMessage( - container.AnnounceUsedSpaceRequestFromGRPCMessage(req), - ); err != nil { - return nil, err - } - - // sign response structure - if err := signature.SignServiceMessage(s.key, s.announceResp); err != nil { - return nil, err - } - - return container.AnnounceUsedSpaceResponseToGRPCMessage(s.announceResp), nil -} - -func testPutRequest() *container.PutRequest { - cnr := new(container.Container) - cnr.SetBasicACL(1) - - body := new(container.PutRequestBody) - body.SetContainer(cnr) - - meta := new(session.RequestMetaHeader) - meta.SetTTL(1) - - req := new(container.PutRequest) - req.SetBody(body) - req.SetMetaHeader(meta) - - return req -} - -func testPutResponse() *container.PutResponse { - cid := new(refs.ContainerID) - cid.SetValue([]byte{1, 2, 3}) - - body := new(container.PutResponseBody) - body.SetContainerID(cid) - - meta := new(session.ResponseMetaHeader) - meta.SetTTL(1) - meta.SetXHeaders([]*session.XHeader{}) // w/o this require.Equal fails due to nil and []T{} difference - - resp := new(container.PutResponse) - resp.SetBody(body) - resp.SetMetaHeader(meta) - - return resp -} - -func testGetRequest() *container.GetRequest { - cid := new(refs.ContainerID) - cid.SetValue([]byte{1, 2, 3}) - - body := new(container.GetRequestBody) - body.SetContainerID(cid) - - meta := new(session.RequestMetaHeader) - meta.SetTTL(1) - - req := new(container.GetRequest) - req.SetBody(body) - req.SetMetaHeader(meta) - - return req -} - -func testGetResponse() *container.GetResponse { - cnr := new(container.Container) - cnr.SetAttributes([]*container.Attribute{}) // w/o this require.Equal fails due to nil and []T{} difference - - body := new(container.GetResponseBody) - body.SetContainer(cnr) - - meta := new(session.ResponseMetaHeader) - meta.SetTTL(1) - meta.SetXHeaders([]*session.XHeader{}) // w/o this require.Equal fails due to nil and []T{} difference - - resp := new(container.GetResponse) - resp.SetBody(body) - resp.SetMetaHeader(meta) - - return resp -} - -func testDelRequest() *container.DeleteRequest { - cid := new(refs.ContainerID) - cid.SetValue([]byte{1, 2, 3}) - - body := new(container.DeleteRequestBody) - body.SetContainerID(cid) - - meta := new(session.RequestMetaHeader) - meta.SetTTL(1) - - req := new(container.DeleteRequest) - req.SetBody(body) - req.SetMetaHeader(meta) - - return req -} - -func testDelResponse() *container.DeleteResponse { - body := new(container.DeleteResponseBody) - - meta := new(session.ResponseMetaHeader) - meta.SetTTL(1) - meta.SetXHeaders([]*session.XHeader{}) // w/o this require.Equal fails due to nil and []T{} difference - - resp := new(container.DeleteResponse) - resp.SetBody(body) - resp.SetMetaHeader(meta) - - return resp -} - -func testListRequest() *container.ListRequest { - ownerID := new(refs.OwnerID) - ownerID.SetValue([]byte{1, 2, 3}) - - body := new(container.ListRequestBody) - body.SetOwnerID(ownerID) - - meta := new(session.RequestMetaHeader) - meta.SetTTL(1) - - req := new(container.ListRequest) - req.SetBody(body) - req.SetMetaHeader(meta) - - return req -} - -func testListResponse() *container.ListResponse { - cid := new(refs.ContainerID) - cid.SetValue([]byte{1, 2, 3}) - - body := new(container.ListResponseBody) - body.SetContainerIDs([]*refs.ContainerID{cid}) - - meta := new(session.ResponseMetaHeader) - meta.SetTTL(1) - meta.SetXHeaders([]*session.XHeader{}) // w/o this require.Equal fails due to nil and []T{} difference - - resp := new(container.ListResponse) - resp.SetBody(body) - resp.SetMetaHeader(meta) - - return resp -} - -func testSetEACLRequest() *container.SetExtendedACLRequest { - cid := new(refs.ContainerID) - cid.SetValue([]byte{1, 2, 3}) - - eacl := new(acl.Table) - eacl.SetContainerID(cid) - - body := new(container.SetExtendedACLRequestBody) - body.SetEACL(eacl) - - meta := new(session.RequestMetaHeader) - meta.SetTTL(1) - - req := new(container.SetExtendedACLRequest) - req.SetBody(body) - req.SetMetaHeader(meta) - - return req -} - -func testSetEACLResponse() *container.SetExtendedACLResponse { - body := new(container.SetExtendedACLResponseBody) - - meta := new(session.ResponseMetaHeader) - meta.SetTTL(1) - meta.SetXHeaders([]*session.XHeader{}) // w/o this require.Equal fails due to nil and []T{} difference - - resp := new(container.SetExtendedACLResponse) - resp.SetBody(body) - resp.SetMetaHeader(meta) - - return resp -} - -func testGetEACLRequest() *container.GetExtendedACLRequest { - cid := new(refs.ContainerID) - cid.SetValue([]byte{1, 2, 3}) - - body := new(container.GetExtendedACLRequestBody) - body.SetContainerID(cid) - - meta := new(session.RequestMetaHeader) - meta.SetTTL(1) - - req := new(container.GetExtendedACLRequest) - req.SetBody(body) - req.SetMetaHeader(meta) - - return req -} - -func testGetEACLResponse() *container.GetExtendedACLResponse { - cid := new(refs.ContainerID) - cid.SetValue([]byte{1, 2, 3}) - - eacl := new(acl.Table) - eacl.SetContainerID(cid) - eacl.SetRecords([]*acl.Record{}) // w/o this require.Equal fails due to nil and []T{} difference - - body := new(container.GetExtendedACLResponseBody) - body.SetEACL(eacl) - - meta := new(session.ResponseMetaHeader) - meta.SetTTL(1) - meta.SetXHeaders([]*session.XHeader{}) // w/o this require.Equal fails due to nil and []T{} difference - - resp := new(container.GetExtendedACLResponse) - resp.SetBody(body) - resp.SetMetaHeader(meta) - - return resp -} - -func testAnnounceRequest() *container.AnnounceUsedSpaceRequest { - cid1 := new(refs.ContainerID) - cid1.SetValue([]byte{1, 2, 3}) - - cid2 := new(refs.ContainerID) - cid2.SetValue([]byte{4, 5, 6}) - - a1 := new(container.UsedSpaceAnnouncement) - a1.SetEpoch(20) - a1.SetUsedSpace(10) - a1.SetContainerID(cid1) - - a2 := new(container.UsedSpaceAnnouncement) - a2.SetEpoch(20) - a2.SetUsedSpace(20) - a2.SetContainerID(cid2) - - announcements := []*container.UsedSpaceAnnouncement{a1, a2} - - body := new(container.AnnounceUsedSpaceRequestBody) - body.SetAnnouncements(announcements) - - meta := new(session.RequestMetaHeader) - meta.SetTTL(1) - - req := new(container.AnnounceUsedSpaceRequest) - req.SetBody(body) - req.SetMetaHeader(meta) - - return req -} - -func testAnnounceResponse() *container.AnnounceUsedSpaceResponse { - body := new(container.AnnounceUsedSpaceResponseBody) - - meta := new(session.ResponseMetaHeader) - meta.SetTTL(1) - meta.SetXHeaders([]*session.XHeader{}) // w/o this require.Equal fails due to nil and []T{} difference - - resp := new(container.AnnounceUsedSpaceResponse) - resp.SetBody(body) - resp.SetMetaHeader(meta) - - return resp -} - -func TestGRPCClient_Put(t *testing.T) { - ctx := context.TODO() - - cliKey := test.DecodeKey(0) - srvKey := test.DecodeKey(1) - - t.Run("gRPC server error", func(t *testing.T) { - srvErr := errors.New("test server error") - - srv := &testGRPCServer{ - err: srvErr, - } - - cli := &testGRPCClient{ - server: srv, - } - - c, err := container.NewClient(container.WithGRPCServiceClient(cli)) - require.NoError(t, err) - - resp, err := c.Put(ctx, new(container.PutRequest)) - require.True(t, errors.Is(err, srvErr)) - require.Nil(t, resp) - }) - - t.Run("invalid request structure", func(t *testing.T) { - req := testPutRequest() - - require.Error(t, signature.VerifyServiceMessage(req)) - - c, err := container.NewClient( - container.WithGRPCServiceClient( - &testGRPCClient{ - server: new(testGRPCServer), - }, - ), - ) - require.NoError(t, err) - - resp, err := c.Put(ctx, req) - require.Error(t, err) - require.Nil(t, resp) - }) - - t.Run("correct response", func(t *testing.T) { - req := testPutRequest() - - require.NoError(t, signature.SignServiceMessage(cliKey, req)) - - resp := testPutResponse() - - c, err := container.NewClient( - container.WithGRPCServiceClient( - &testGRPCClient{ - server: &testGRPCServer{ - key: srvKey, - putResp: resp, - }, - }, - ), - ) - require.NoError(t, err) - - r, err := c.Put(ctx, req) - require.NoError(t, err) - - require.NoError(t, signature.VerifyServiceMessage(r)) - require.Equal(t, resp.GetBody(), r.GetBody()) - require.Equal(t, resp.GetMetaHeader(), r.GetMetaHeader()) - }) -} - -func TestGRPCClient_Get(t *testing.T) { - ctx := context.TODO() - - cliKey := test.DecodeKey(0) - srvKey := test.DecodeKey(1) - - t.Run("gRPC server error", func(t *testing.T) { - srvErr := errors.New("test server error") - - srv := &testGRPCServer{ - err: srvErr, - } - - cli := &testGRPCClient{ - server: srv, - } - - c, err := container.NewClient(container.WithGRPCServiceClient(cli)) - require.NoError(t, err) - - resp, err := c.Get(ctx, new(container.GetRequest)) - require.True(t, errors.Is(err, srvErr)) - require.Nil(t, resp) - }) - - t.Run("invalid request structure", func(t *testing.T) { - req := testGetRequest() - - require.Error(t, signature.VerifyServiceMessage(req)) - - c, err := container.NewClient( - container.WithGRPCServiceClient( - &testGRPCClient{ - server: new(testGRPCServer), - }, - ), - ) - require.NoError(t, err) - - resp, err := c.Get(ctx, req) - require.Error(t, err) - require.Nil(t, resp) - }) - - t.Run("correct response", func(t *testing.T) { - req := testGetRequest() - - require.NoError(t, signature.SignServiceMessage(cliKey, req)) - - resp := testGetResponse() - - c, err := container.NewClient( - container.WithGRPCServiceClient( - &testGRPCClient{ - server: &testGRPCServer{ - key: srvKey, - getResp: resp, - }, - }, - ), - ) - require.NoError(t, err) - - r, err := c.Get(ctx, req) - require.NoError(t, err) - - require.NoError(t, signature.VerifyServiceMessage(r)) - require.Equal(t, resp.GetBody(), r.GetBody()) - require.Equal(t, resp.GetMetaHeader(), r.GetMetaHeader()) - }) -} - -func TestGRPCClient_Delete(t *testing.T) { - ctx := context.TODO() - - cliKey := test.DecodeKey(0) - srvKey := test.DecodeKey(1) - - t.Run("gRPC server error", func(t *testing.T) { - srvErr := errors.New("test server error") - - srv := &testGRPCServer{ - err: srvErr, - } - - cli := &testGRPCClient{ - server: srv, - } - - c, err := container.NewClient(container.WithGRPCServiceClient(cli)) - require.NoError(t, err) - - resp, err := c.Delete(ctx, new(container.DeleteRequest)) - require.True(t, errors.Is(err, srvErr)) - require.Nil(t, resp) - }) - - t.Run("invalid request structure", func(t *testing.T) { - req := testDelRequest() - - require.Error(t, signature.VerifyServiceMessage(req)) - - c, err := container.NewClient( - container.WithGRPCServiceClient( - &testGRPCClient{ - server: new(testGRPCServer), - }, - ), - ) - require.NoError(t, err) - - resp, err := c.Delete(ctx, req) - require.Error(t, err) - require.Nil(t, resp) - }) - - t.Run("correct response", func(t *testing.T) { - req := testDelRequest() - - require.NoError(t, signature.SignServiceMessage(cliKey, req)) - - resp := testDelResponse() - - c, err := container.NewClient( - container.WithGRPCServiceClient( - &testGRPCClient{ - server: &testGRPCServer{ - key: srvKey, - delResp: resp, - }, - }, - ), - ) - require.NoError(t, err) - - r, err := c.Delete(ctx, req) - require.NoError(t, err) - - require.NoError(t, signature.VerifyServiceMessage(r)) - require.Equal(t, resp.GetBody(), r.GetBody()) - require.Equal(t, resp.GetMetaHeader(), r.GetMetaHeader()) - }) -} - -func TestGRPCClient_List(t *testing.T) { - ctx := context.TODO() - - cliKey := test.DecodeKey(0) - srvKey := test.DecodeKey(1) - - t.Run("gRPC server error", func(t *testing.T) { - srvErr := errors.New("test server error") - - srv := &testGRPCServer{ - err: srvErr, - } - - cli := &testGRPCClient{ - server: srv, - } - - c, err := container.NewClient(container.WithGRPCServiceClient(cli)) - require.NoError(t, err) - - resp, err := c.List(ctx, new(container.ListRequest)) - require.True(t, errors.Is(err, srvErr)) - require.Nil(t, resp) - }) - - t.Run("invalid request structure", func(t *testing.T) { - req := testListRequest() - - require.Error(t, signature.VerifyServiceMessage(req)) - - c, err := container.NewClient( - container.WithGRPCServiceClient( - &testGRPCClient{ - server: new(testGRPCServer), - }, - ), - ) - require.NoError(t, err) - - resp, err := c.List(ctx, req) - require.Error(t, err) - require.Nil(t, resp) - }) - - t.Run("correct response", func(t *testing.T) { - req := testListRequest() - - require.NoError(t, signature.SignServiceMessage(cliKey, req)) - - resp := testListResponse() - - c, err := container.NewClient( - container.WithGRPCServiceClient( - &testGRPCClient{ - server: &testGRPCServer{ - key: srvKey, - listResp: resp, - }, - }, - ), - ) - require.NoError(t, err) - - r, err := c.List(ctx, req) - require.NoError(t, err) - - require.NoError(t, signature.VerifyServiceMessage(r)) - require.Equal(t, resp.GetBody(), r.GetBody()) - require.Equal(t, resp.GetMetaHeader(), r.GetMetaHeader()) - }) -} - -func TestGRPCClient_SetEACL(t *testing.T) { - ctx := context.TODO() - - cliKey := test.DecodeKey(0) - srvKey := test.DecodeKey(1) - - t.Run("gRPC server error", func(t *testing.T) { - srvErr := errors.New("test server error") - - srv := &testGRPCServer{ - err: srvErr, - } - - cli := &testGRPCClient{ - server: srv, - } - - c, err := container.NewClient(container.WithGRPCServiceClient(cli)) - require.NoError(t, err) - - resp, err := c.SetExtendedACL(ctx, new(container.SetExtendedACLRequest)) - require.True(t, errors.Is(err, srvErr)) - require.Nil(t, resp) - }) - t.Run("invalid request structure", func(t *testing.T) { - req := testSetEACLRequest() - - require.Error(t, signature.VerifyServiceMessage(req)) - - c, err := container.NewClient( - container.WithGRPCServiceClient( - &testGRPCClient{ - server: new(testGRPCServer), - }, - ), - ) - require.NoError(t, err) - - resp, err := c.SetExtendedACL(ctx, req) - require.Error(t, err) - require.Nil(t, resp) - }) - - t.Run("correct response", func(t *testing.T) { - req := testSetEACLRequest() - - require.NoError(t, signature.SignServiceMessage(cliKey, req)) - - resp := testSetEACLResponse() - - c, err := container.NewClient( - container.WithGRPCServiceClient( - &testGRPCClient{ - server: &testGRPCServer{ - key: srvKey, - sEaclResp: resp, - }, - }, - ), - ) - require.NoError(t, err) - - r, err := c.SetExtendedACL(ctx, req) - require.NoError(t, err) - - require.NoError(t, signature.VerifyServiceMessage(r)) - require.Equal(t, resp.GetBody(), r.GetBody()) - require.Equal(t, resp.GetMetaHeader(), r.GetMetaHeader()) - }) -} - -func TestGRPCClient_GetEACL(t *testing.T) { - ctx := context.TODO() - - cliKey := test.DecodeKey(0) - srvKey := test.DecodeKey(1) - - t.Run("gRPC server error", func(t *testing.T) { - srvErr := errors.New("test server error") - - srv := &testGRPCServer{ - err: srvErr, - } - - cli := &testGRPCClient{ - server: srv, - } - - c, err := container.NewClient(container.WithGRPCServiceClient(cli)) - require.NoError(t, err) - - resp, err := c.GetExtendedACL(ctx, new(container.GetExtendedACLRequest)) - require.True(t, errors.Is(err, srvErr)) - require.Nil(t, resp) - }) - t.Run("invalid request structure", func(t *testing.T) { - req := testGetEACLRequest() - - require.Error(t, signature.VerifyServiceMessage(req)) - - c, err := container.NewClient( - container.WithGRPCServiceClient( - &testGRPCClient{ - server: new(testGRPCServer), - }, - ), - ) - require.NoError(t, err) - - resp, err := c.GetExtendedACL(ctx, req) - require.Error(t, err) - require.Nil(t, resp) - }) - - t.Run("correct response", func(t *testing.T) { - req := testGetEACLRequest() - - require.NoError(t, signature.SignServiceMessage(cliKey, req)) - - resp := testGetEACLResponse() - - c, err := container.NewClient( - container.WithGRPCServiceClient( - &testGRPCClient{ - server: &testGRPCServer{ - key: srvKey, - gEaclResp: resp, - }, - }, - ), - ) - require.NoError(t, err) - - r, err := c.GetExtendedACL(ctx, req) - require.NoError(t, err) - - require.NoError(t, signature.VerifyServiceMessage(r)) - require.Equal(t, resp.GetBody(), r.GetBody()) - require.Equal(t, resp.GetMetaHeader(), r.GetMetaHeader()) - }) -} - -func TestGRPCClient_AnnounceUsedSpace(t *testing.T) { - ctx := context.TODO() - - cliKey := test.DecodeKey(0) - srvKey := test.DecodeKey(1) - - t.Run("gRPC server error", func(t *testing.T) { - srvErr := errors.New("test server error") - - srv := &testGRPCServer{ - err: srvErr, - } - - cli := &testGRPCClient{ - server: srv, - } - - c, err := container.NewClient(container.WithGRPCServiceClient(cli)) - require.NoError(t, err) - - resp, err := c.AnnounceUsedSpace(ctx, new(container.AnnounceUsedSpaceRequest)) - require.True(t, errors.Is(err, srvErr)) - require.Nil(t, resp) - }) - t.Run("invalid request structure", func(t *testing.T) { - req := testAnnounceRequest() - - require.Error(t, signature.VerifyServiceMessage(req)) - - c, err := container.NewClient( - container.WithGRPCServiceClient( - &testGRPCClient{ - server: new(testGRPCServer), - }, - ), - ) - require.NoError(t, err) - - resp, err := c.AnnounceUsedSpace(ctx, req) - require.Error(t, err) - require.Nil(t, resp) - }) - - t.Run("correct response", func(t *testing.T) { - req := testAnnounceRequest() - - require.NoError(t, signature.SignServiceMessage(cliKey, req)) - - resp := testAnnounceResponse() - - c, err := container.NewClient( - container.WithGRPCServiceClient( - &testGRPCClient{ - server: &testGRPCServer{ - key: srvKey, - announceResp: resp, - }, - }, - ), - ) - require.NoError(t, err) - - r, err := c.AnnounceUsedSpace(ctx, req) - require.NoError(t, err) - - require.NoError(t, signature.VerifyServiceMessage(r)) - require.Equal(t, resp.GetBody(), r.GetBody()) - require.Equal(t, resp.GetMetaHeader(), r.GetMetaHeader()) - }) -} diff --git a/v2/container/test/generate.go b/v2/container/test/generate.go new file mode 100644 index 0000000..032bde7 --- /dev/null +++ b/v2/container/test/generate.go @@ -0,0 +1,318 @@ +package containertest + +import ( + acltest "github.com/nspcc-dev/neofs-api-go/v2/acl/test" + "github.com/nspcc-dev/neofs-api-go/v2/container" + netmaptest "github.com/nspcc-dev/neofs-api-go/v2/netmap/test" + refstest "github.com/nspcc-dev/neofs-api-go/v2/refs/test" + sessiontest "github.com/nspcc-dev/neofs-api-go/v2/session/test" +) + +func GenerateAttribute(empty bool) *container.Attribute { + m := new(container.Attribute) + + if !empty { + m.SetKey("key") + m.SetValue("val") + } + + return m +} + +func GenerateAttributes(empty bool) (res []*container.Attribute) { + if !empty { + res = append(res, + GenerateAttribute(false), + GenerateAttribute(false), + ) + } + + return +} + +func GenerateContainer(empty bool) *container.Container { + m := new(container.Container) + + if !empty { + m.SetBasicACL(12) + m.SetNonce([]byte{1, 2, 3}) + } + + m.SetOwnerID(refstest.GenerateOwnerID(empty)) + m.SetVersion(refstest.GenerateVersion(empty)) + m.SetAttributes(GenerateAttributes(empty)) + m.SetPlacementPolicy(netmaptest.GeneratePlacementPolicy(empty)) + + return m +} + +func GeneratePutRequestBody(empty bool) *container.PutRequestBody { + m := new(container.PutRequestBody) + + m.SetContainer(GenerateContainer(empty)) + m.SetSignature(refstest.GenerateSignature(empty)) + + return m +} + +func GeneratePutRequest(empty bool) *container.PutRequest { + m := new(container.PutRequest) + + m.SetBody(GeneratePutRequestBody(empty)) + m.SetMetaHeader(sessiontest.GenerateRequestMetaHeader(empty)) + m.SetVerificationHeader(sessiontest.GenerateRequestVerificationHeader(empty)) + + return m +} + +func GeneratePutResponseBody(empty bool) *container.PutResponseBody { + m := new(container.PutResponseBody) + + m.SetContainerID(refstest.GenerateContainerID(empty)) + + return m +} + +func GeneratePutResponse(empty bool) *container.PutResponse { + m := new(container.PutResponse) + + m.SetBody(GeneratePutResponseBody(empty)) + m.SetMetaHeader(sessiontest.GenerateResponseMetaHeader(empty)) + m.SetVerificationHeader(sessiontest.GenerateResponseVerificationHeader(empty)) + + return m +} + +func GenerateGetRequestBody(empty bool) *container.GetRequestBody { + m := new(container.GetRequestBody) + + m.SetContainerID(refstest.GenerateContainerID(empty)) + + return m +} + +func GenerateGetRequest(empty bool) *container.GetRequest { + m := new(container.GetRequest) + + m.SetBody(GenerateGetRequestBody(empty)) + m.SetMetaHeader(sessiontest.GenerateRequestMetaHeader(empty)) + m.SetVerificationHeader(sessiontest.GenerateRequestVerificationHeader(empty)) + + return m +} + +func GenerateGetResponseBody(empty bool) *container.GetResponseBody { + m := new(container.GetResponseBody) + + m.SetContainer(GenerateContainer(empty)) + + return m +} + +func GenerateGetResponse(empty bool) *container.GetResponse { + m := new(container.GetResponse) + + m.SetBody(GenerateGetResponseBody(empty)) + m.SetMetaHeader(sessiontest.GenerateResponseMetaHeader(empty)) + m.SetVerificationHeader(sessiontest.GenerateResponseVerificationHeader(empty)) + + return m +} + +func GenerateDeleteRequestBody(empty bool) *container.DeleteRequestBody { + m := new(container.DeleteRequestBody) + + m.SetContainerID(refstest.GenerateContainerID(empty)) + m.SetSignature(refstest.GenerateSignature(empty)) + + return m +} + +func GenerateDeleteRequest(empty bool) *container.DeleteRequest { + m := new(container.DeleteRequest) + + m.SetBody(GenerateDeleteRequestBody(empty)) + m.SetMetaHeader(sessiontest.GenerateRequestMetaHeader(empty)) + m.SetVerificationHeader(sessiontest.GenerateRequestVerificationHeader(empty)) + + return m +} + +func GenerateDeleteResponseBody(empty bool) *container.DeleteResponseBody { + m := new(container.DeleteResponseBody) + + return m +} + +func GenerateDeleteResponse(empty bool) *container.DeleteResponse { + m := new(container.DeleteResponse) + + m.SetBody(GenerateDeleteResponseBody(empty)) + m.SetMetaHeader(sessiontest.GenerateResponseMetaHeader(empty)) + m.SetVerificationHeader(sessiontest.GenerateResponseVerificationHeader(empty)) + + return m +} + +func GenerateListRequestBody(empty bool) *container.ListRequestBody { + m := new(container.ListRequestBody) + + m.SetOwnerID(refstest.GenerateOwnerID(empty)) + + return m +} + +func GenerateListRequest(empty bool) *container.ListRequest { + m := new(container.ListRequest) + + m.SetBody(GenerateListRequestBody(empty)) + m.SetMetaHeader(sessiontest.GenerateRequestMetaHeader(empty)) + m.SetVerificationHeader(sessiontest.GenerateRequestVerificationHeader(empty)) + + return m +} + +func GenerateListResponseBody(empty bool) *container.ListResponseBody { + m := new(container.ListResponseBody) + + m.SetContainerIDs(refstest.GenerateContainerIDs(empty)) + + return m +} + +func GenerateListResponse(empty bool) *container.ListResponse { + m := new(container.ListResponse) + + m.SetBody(GenerateListResponseBody(empty)) + m.SetMetaHeader(sessiontest.GenerateResponseMetaHeader(empty)) + m.SetVerificationHeader(sessiontest.GenerateResponseVerificationHeader(empty)) + + return m +} + +func GenerateSetExtendedACLRequestBody(empty bool) *container.SetExtendedACLRequestBody { + m := new(container.SetExtendedACLRequestBody) + + m.SetEACL(acltest.GenerateTable(empty)) + m.SetSignature(refstest.GenerateSignature(empty)) + + return m +} + +func GenerateSetExtendedACLRequest(empty bool) *container.SetExtendedACLRequest { + m := new(container.SetExtendedACLRequest) + + m.SetBody(GenerateSetExtendedACLRequestBody(empty)) + m.SetMetaHeader(sessiontest.GenerateRequestMetaHeader(empty)) + m.SetVerificationHeader(sessiontest.GenerateRequestVerificationHeader(empty)) + + return m +} + +func GenerateSetExtendedACLResponseBody(empty bool) *container.SetExtendedACLResponseBody { + m := new(container.SetExtendedACLResponseBody) + + return m +} + +func GenerateSetExtendedACLResponse(empty bool) *container.SetExtendedACLResponse { + m := new(container.SetExtendedACLResponse) + + m.SetBody(GenerateSetExtendedACLResponseBody(empty)) + m.SetMetaHeader(sessiontest.GenerateResponseMetaHeader(empty)) + m.SetVerificationHeader(sessiontest.GenerateResponseVerificationHeader(empty)) + + return m +} + +func GenerateGetExtendedACLRequestBody(empty bool) *container.GetExtendedACLRequestBody { + m := new(container.GetExtendedACLRequestBody) + + m.SetContainerID(refstest.GenerateContainerID(empty)) + + return m +} + +func GenerateGetExtendedACLRequest(empty bool) *container.GetExtendedACLRequest { + m := new(container.GetExtendedACLRequest) + + m.SetBody(GenerateGetExtendedACLRequestBody(empty)) + m.SetMetaHeader(sessiontest.GenerateRequestMetaHeader(empty)) + m.SetVerificationHeader(sessiontest.GenerateRequestVerificationHeader(empty)) + + return m +} + +func GenerateGetExtendedACLResponseBody(empty bool) *container.GetExtendedACLResponseBody { + m := new(container.GetExtendedACLResponseBody) + + m.SetEACL(acltest.GenerateTable(empty)) + m.SetSignature(refstest.GenerateSignature(empty)) + + return m +} + +func GenerateGetExtendedACLResponse(empty bool) *container.GetExtendedACLResponse { + m := new(container.GetExtendedACLResponse) + + m.SetBody(GenerateGetExtendedACLResponseBody(empty)) + m.SetMetaHeader(sessiontest.GenerateResponseMetaHeader(empty)) + m.SetVerificationHeader(sessiontest.GenerateResponseVerificationHeader(empty)) + + return m +} + +func GenerateUsedSpaceAnnouncement(empty bool) *container.UsedSpaceAnnouncement { + m := new(container.UsedSpaceAnnouncement) + + m.SetContainerID(refstest.GenerateContainerID(empty)) + m.SetEpoch(1) + m.SetUsedSpace(2) + + return m +} + +func GenerateUsedSpaceAnnouncements(empty bool) (res []*container.UsedSpaceAnnouncement) { + if !empty { + res = append(res, + GenerateUsedSpaceAnnouncement(false), + GenerateUsedSpaceAnnouncement(false), + ) + } + + return +} + +func GenerateAnnounceUsedSpaceRequestBody(empty bool) *container.AnnounceUsedSpaceRequestBody { + m := new(container.AnnounceUsedSpaceRequestBody) + + m.SetAnnouncements(GenerateUsedSpaceAnnouncements(empty)) + + return m +} + +func GenerateAnnounceUsedSpaceRequest(empty bool) *container.AnnounceUsedSpaceRequest { + m := new(container.AnnounceUsedSpaceRequest) + + m.SetBody(GenerateAnnounceUsedSpaceRequestBody(empty)) + m.SetMetaHeader(sessiontest.GenerateRequestMetaHeader(empty)) + m.SetVerificationHeader(sessiontest.GenerateRequestVerificationHeader(empty)) + + return m +} + +func GenerateAnnounceUsedSpaceResponseBody(empty bool) *container.AnnounceUsedSpaceResponseBody { + m := new(container.AnnounceUsedSpaceResponseBody) + + return m +} + +func GenerateAnnounceUsedSpaceResponse(empty bool) *container.AnnounceUsedSpaceResponse { + m := new(container.AnnounceUsedSpaceResponse) + + m.SetBody(GenerateAnnounceUsedSpaceResponseBody(empty)) + m.SetMetaHeader(sessiontest.GenerateResponseMetaHeader(empty)) + m.SetVerificationHeader(sessiontest.GenerateResponseVerificationHeader(empty)) + + return m +} diff --git a/v2/container/types.go b/v2/container/types.go index 004ddd7..a790f03 100644 --- a/v2/container/types.go +++ b/v2/container/types.go @@ -30,11 +30,22 @@ type PutRequestBody struct { sig *refs.Signature } +type PutRequest struct { + body *PutRequestBody + + session.RequestHeaders +} type PutResponseBody struct { cid *refs.ContainerID } +type PutResponse struct { + body *PutResponseBody + + session.ResponseHeaders +} + type GetRequestBody struct { cid *refs.ContainerID } @@ -42,9 +53,7 @@ type GetRequestBody struct { type GetRequest struct { body *GetRequestBody - metaHeader *session.RequestMetaHeader - - verifyHeader *session.RequestVerificationHeader + session.RequestHeaders } type GetResponseBody struct { @@ -54,9 +63,7 @@ type GetResponseBody struct { type GetResponse struct { body *GetResponseBody - metaHeader *session.ResponseMetaHeader - - verifyHeader *session.ResponseVerificationHeader + session.ResponseHeaders } type DeleteRequestBody struct { @@ -65,34 +72,82 @@ type DeleteRequestBody struct { sig *refs.Signature } +type DeleteRequest struct { + body *DeleteRequestBody + + session.RequestHeaders +} + type DeleteResponseBody struct{} +type DeleteResponse struct { + body *DeleteResponseBody + + session.ResponseHeaders +} + type ListRequestBody struct { ownerID *refs.OwnerID } +type ListRequest struct { + body *ListRequestBody + + session.RequestHeaders +} + type ListResponseBody struct { cidList []*refs.ContainerID } +type ListResponse struct { + body *ListResponseBody + + session.ResponseHeaders +} + type SetExtendedACLRequestBody struct { eacl *acl.Table sig *refs.Signature } +type SetExtendedACLRequest struct { + body *SetExtendedACLRequestBody + + session.RequestHeaders +} + type SetExtendedACLResponseBody struct{} +type SetExtendedACLResponse struct { + body *SetExtendedACLResponseBody + + session.ResponseHeaders +} + type GetExtendedACLRequestBody struct { cid *refs.ContainerID } +type GetExtendedACLRequest struct { + body *GetExtendedACLRequestBody + + session.RequestHeaders +} + type GetExtendedACLResponseBody struct { eacl *acl.Table sig *refs.Signature } +type GetExtendedACLResponse struct { + body *GetExtendedACLResponseBody + + session.ResponseHeaders +} + type UsedSpaceAnnouncement struct { epoch uint64 @@ -105,8 +160,20 @@ type AnnounceUsedSpaceRequestBody struct { announcements []*UsedSpaceAnnouncement } +type AnnounceUsedSpaceRequest struct { + body *AnnounceUsedSpaceRequestBody + + session.RequestHeaders +} + type AnnounceUsedSpaceResponseBody struct{} +type AnnounceUsedSpaceResponse struct { + body *AnnounceUsedSpaceResponseBody + + session.ResponseHeaders +} + func (a *Attribute) GetKey() string { if a != nil { return a.key @@ -261,34 +328,6 @@ func (r *PutRequest) SetBody(v *PutRequestBody) { } } -func (r *PutRequest) GetMetaHeader() *session.RequestMetaHeader { - if r != nil { - return r.metaHeader - } - - return nil -} - -func (r *PutRequest) SetMetaHeader(v *session.RequestMetaHeader) { - if r != nil { - r.metaHeader = v - } -} - -func (r *PutRequest) GetVerificationHeader() *session.RequestVerificationHeader { - if r != nil { - return r.verifyHeader - } - - return nil -} - -func (r *PutRequest) SetVerificationHeader(v *session.RequestVerificationHeader) { - if r != nil { - r.verifyHeader = v - } -} - func (r *PutResponseBody) GetContainerID() *refs.ContainerID { if r != nil { return r.cid @@ -317,34 +356,6 @@ func (r *PutResponse) SetBody(v *PutResponseBody) { } } -func (r *PutResponse) GetMetaHeader() *session.ResponseMetaHeader { - if r != nil { - return r.metaHeader - } - - return nil -} - -func (r *PutResponse) SetMetaHeader(v *session.ResponseMetaHeader) { - if r != nil { - r.metaHeader = v - } -} - -func (r *PutResponse) GetVerificationHeader() *session.ResponseVerificationHeader { - if r != nil { - return r.verifyHeader - } - - return nil -} - -func (r *PutResponse) SetVerificationHeader(v *session.ResponseVerificationHeader) { - if r != nil { - r.verifyHeader = v - } -} - func (r *GetRequestBody) GetContainerID() *refs.ContainerID { if r != nil { return r.cid @@ -373,34 +384,6 @@ func (r *GetRequest) SetBody(v *GetRequestBody) { } } -func (r *GetRequest) GetMetaHeader() *session.RequestMetaHeader { - if r != nil { - return r.metaHeader - } - - return nil -} - -func (r *GetRequest) SetMetaHeader(v *session.RequestMetaHeader) { - if r != nil { - r.metaHeader = v - } -} - -func (r *GetRequest) GetVerificationHeader() *session.RequestVerificationHeader { - if r != nil { - return r.verifyHeader - } - - return nil -} - -func (r *GetRequest) SetVerificationHeader(v *session.RequestVerificationHeader) { - if r != nil { - r.verifyHeader = v - } -} - func (r *GetResponseBody) GetContainer() *Container { if r != nil { return r.cnr @@ -429,34 +412,6 @@ func (r *GetResponse) SetBody(v *GetResponseBody) { } } -func (r *GetResponse) GetMetaHeader() *session.ResponseMetaHeader { - if r != nil { - return r.metaHeader - } - - return nil -} - -func (r *GetResponse) SetMetaHeader(v *session.ResponseMetaHeader) { - if r != nil { - r.metaHeader = v - } -} - -func (r *GetResponse) GetVerificationHeader() *session.ResponseVerificationHeader { - if r != nil { - return r.verifyHeader - } - - return nil -} - -func (r *GetResponse) SetVerificationHeader(v *session.ResponseVerificationHeader) { - if r != nil { - r.verifyHeader = v - } -} - func (r *DeleteRequestBody) GetContainerID() *refs.ContainerID { if r != nil { return r.cid @@ -499,34 +454,6 @@ func (r *DeleteRequest) SetBody(v *DeleteRequestBody) { } } -func (r *DeleteRequest) GetMetaHeader() *session.RequestMetaHeader { - if r != nil { - return r.metaHeader - } - - return nil -} - -func (r *DeleteRequest) SetMetaHeader(v *session.RequestMetaHeader) { - if r != nil { - r.metaHeader = v - } -} - -func (r *DeleteRequest) GetVerificationHeader() *session.RequestVerificationHeader { - if r != nil { - return r.verifyHeader - } - - return nil -} - -func (r *DeleteRequest) SetVerificationHeader(v *session.RequestVerificationHeader) { - if r != nil { - r.verifyHeader = v - } -} - func (r *DeleteResponse) GetBody() *DeleteResponseBody { if r != nil { return r.body @@ -541,34 +468,6 @@ func (r *DeleteResponse) SetBody(v *DeleteResponseBody) { } } -func (r *DeleteResponse) GetMetaHeader() *session.ResponseMetaHeader { - if r != nil { - return r.metaHeader - } - - return nil -} - -func (r *DeleteResponse) SetMetaHeader(v *session.ResponseMetaHeader) { - if r != nil { - r.metaHeader = v - } -} - -func (r *DeleteResponse) GetVerificationHeader() *session.ResponseVerificationHeader { - if r != nil { - return r.verifyHeader - } - - return nil -} - -func (r *DeleteResponse) SetVerificationHeader(v *session.ResponseVerificationHeader) { - if r != nil { - r.verifyHeader = v - } -} - func (r *ListRequestBody) GetOwnerID() *refs.OwnerID { if r != nil { return r.ownerID @@ -597,34 +496,6 @@ func (r *ListRequest) SetBody(v *ListRequestBody) { } } -func (r *ListRequest) GetMetaHeader() *session.RequestMetaHeader { - if r != nil { - return r.metaHeader - } - - return nil -} - -func (r *ListRequest) SetMetaHeader(v *session.RequestMetaHeader) { - if r != nil { - r.metaHeader = v - } -} - -func (r *ListRequest) GetVerificationHeader() *session.RequestVerificationHeader { - if r != nil { - return r.verifyHeader - } - - return nil -} - -func (r *ListRequest) SetVerificationHeader(v *session.RequestVerificationHeader) { - if r != nil { - r.verifyHeader = v - } -} - func (r *ListResponseBody) GetContainerIDs() []*refs.ContainerID { if r != nil { return r.cidList @@ -653,34 +524,6 @@ func (r *ListResponse) SetBody(v *ListResponseBody) { } } -func (r *ListResponse) GetMetaHeader() *session.ResponseMetaHeader { - if r != nil { - return r.metaHeader - } - - return nil -} - -func (r *ListResponse) SetMetaHeader(v *session.ResponseMetaHeader) { - if r != nil { - r.metaHeader = v - } -} - -func (r *ListResponse) GetVerificationHeader() *session.ResponseVerificationHeader { - if r != nil { - return r.verifyHeader - } - - return nil -} - -func (r *ListResponse) SetVerificationHeader(v *session.ResponseVerificationHeader) { - if r != nil { - r.verifyHeader = v - } -} - func (r *SetExtendedACLRequestBody) GetEACL() *acl.Table { if r != nil { return r.eacl @@ -723,34 +566,6 @@ func (r *SetExtendedACLRequest) SetBody(v *SetExtendedACLRequestBody) { } } -func (r *SetExtendedACLRequest) GetMetaHeader() *session.RequestMetaHeader { - if r != nil { - return r.metaHeader - } - - return nil -} - -func (r *SetExtendedACLRequest) SetMetaHeader(v *session.RequestMetaHeader) { - if r != nil { - r.metaHeader = v - } -} - -func (r *SetExtendedACLRequest) GetVerificationHeader() *session.RequestVerificationHeader { - if r != nil { - return r.verifyHeader - } - - return nil -} - -func (r *SetExtendedACLRequest) SetVerificationHeader(v *session.RequestVerificationHeader) { - if r != nil { - r.verifyHeader = v - } -} - func (r *SetExtendedACLResponse) GetBody() *SetExtendedACLResponseBody { if r != nil { return r.body @@ -765,34 +580,6 @@ func (r *SetExtendedACLResponse) SetBody(v *SetExtendedACLResponseBody) { } } -func (r *SetExtendedACLResponse) GetMetaHeader() *session.ResponseMetaHeader { - if r != nil { - return r.metaHeader - } - - return nil -} - -func (r *SetExtendedACLResponse) SetMetaHeader(v *session.ResponseMetaHeader) { - if r != nil { - r.metaHeader = v - } -} - -func (r *SetExtendedACLResponse) GetVerificationHeader() *session.ResponseVerificationHeader { - if r != nil { - return r.verifyHeader - } - - return nil -} - -func (r *SetExtendedACLResponse) SetVerificationHeader(v *session.ResponseVerificationHeader) { - if r != nil { - r.verifyHeader = v - } -} - func (r *GetExtendedACLRequestBody) GetContainerID() *refs.ContainerID { if r != nil { return r.cid @@ -821,34 +608,6 @@ func (r *GetExtendedACLRequest) SetBody(v *GetExtendedACLRequestBody) { } } -func (r *GetExtendedACLRequest) GetMetaHeader() *session.RequestMetaHeader { - if r != nil { - return r.metaHeader - } - - return nil -} - -func (r *GetExtendedACLRequest) SetMetaHeader(v *session.RequestMetaHeader) { - if r != nil { - r.metaHeader = v - } -} - -func (r *GetExtendedACLRequest) GetVerificationHeader() *session.RequestVerificationHeader { - if r != nil { - return r.verifyHeader - } - - return nil -} - -func (r *GetExtendedACLRequest) SetVerificationHeader(v *session.RequestVerificationHeader) { - if r != nil { - r.verifyHeader = v - } -} - func (r *GetExtendedACLResponseBody) GetEACL() *acl.Table { if r != nil { return r.eacl @@ -891,34 +650,6 @@ func (r *GetExtendedACLResponse) SetBody(v *GetExtendedACLResponseBody) { } } -func (r *GetExtendedACLResponse) GetMetaHeader() *session.ResponseMetaHeader { - if r != nil { - return r.metaHeader - } - - return nil -} - -func (r *GetExtendedACLResponse) SetMetaHeader(v *session.ResponseMetaHeader) { - if r != nil { - r.metaHeader = v - } -} - -func (r *GetExtendedACLResponse) GetVerificationHeader() *session.ResponseVerificationHeader { - if r != nil { - return r.verifyHeader - } - - return nil -} - -func (r *GetExtendedACLResponse) SetVerificationHeader(v *session.ResponseVerificationHeader) { - if r != nil { - r.verifyHeader = v - } -} - func (a *UsedSpaceAnnouncement) GetEpoch() uint64 { if a != nil { return a.epoch @@ -989,34 +720,6 @@ func (r *AnnounceUsedSpaceRequest) SetBody(v *AnnounceUsedSpaceRequestBody) { } } -func (r *AnnounceUsedSpaceRequest) GetMetaHeader() *session.RequestMetaHeader { - if r != nil { - return r.metaHeader - } - - return nil -} - -func (r *AnnounceUsedSpaceRequest) SetMetaHeader(v *session.RequestMetaHeader) { - if r != nil { - r.metaHeader = v - } -} - -func (r *AnnounceUsedSpaceRequest) GetVerificationHeader() *session.RequestVerificationHeader { - if r != nil { - return r.verifyHeader - } - - return nil -} - -func (r *AnnounceUsedSpaceRequest) SetVerificationHeader(v *session.RequestVerificationHeader) { - if r != nil { - r.verifyHeader = v - } -} - func (r *AnnounceUsedSpaceResponse) GetBody() *AnnounceUsedSpaceResponseBody { if r != nil { return r.body @@ -1030,31 +733,3 @@ func (r *AnnounceUsedSpaceResponse) SetBody(v *AnnounceUsedSpaceResponseBody) { r.body = v } } - -func (r *AnnounceUsedSpaceResponse) GetMetaHeader() *session.ResponseMetaHeader { - if r != nil { - return r.metaHeader - } - - return nil -} - -func (r *AnnounceUsedSpaceResponse) SetMetaHeader(v *session.ResponseMetaHeader) { - if r != nil { - r.metaHeader = v - } -} - -func (r *AnnounceUsedSpaceResponse) GetVerificationHeader() *session.ResponseVerificationHeader { - if r != nil { - return r.verifyHeader - } - - return nil -} - -func (r *AnnounceUsedSpaceResponse) SetVerificationHeader(v *session.ResponseVerificationHeader) { - if r != nil { - r.verifyHeader = v - } -} diff --git a/v2/netmap/client.go b/v2/netmap/client.go deleted file mode 100644 index e00f2db..0000000 --- a/v2/netmap/client.go +++ /dev/null @@ -1,190 +0,0 @@ -package netmap - -import ( - "context" - - "github.com/nspcc-dev/neofs-api-go/v2/client" - netmap "github.com/nspcc-dev/neofs-api-go/v2/netmap/grpc" - "github.com/pkg/errors" - "google.golang.org/grpc" -) - -// Client represents universal netmap transport client. -type Client struct { - cLocalNodeInfo *localNodeInfoClient - - cNetworkInfo *networkInfoClient -} - -// Option represents Client option. -type Option func(*cfg) - -type cfg struct { - proto client.Protocol - - globalOpts []client.Option - - gRPC cfgGRPC -} - -type cfgGRPC struct { - serviceClient netmap.NetmapServiceClient - - grpcCallOpts []grpc.CallOption - - callOpts []netmap.Option - - client *netmap.Client -} - -type localNodeInfoClient struct { - requestConverter func(*LocalNodeInfoRequest) interface{} - - caller func(context.Context, interface{}) (interface{}, error) - - responseConverter func(interface{}) *LocalNodeInfoResponse -} - -type networkInfoClient struct { - requestConverter func(*NetworkInfoRequest) interface{} - - caller func(context.Context, interface{}) (interface{}, error) - - responseConverter func(interface{}) *NetworkInfoResponse -} - -// LocalNodeInfo sends LocalNodeInfoRequest over the network. -func (c *Client) LocalNodeInfo(ctx context.Context, req *LocalNodeInfoRequest) (*LocalNodeInfoResponse, error) { - resp, err := c.cLocalNodeInfo.caller(ctx, c.cLocalNodeInfo.requestConverter(req)) - if err != nil { - return nil, errors.Wrap(err, "could not send local node info request") - } - - return c.cLocalNodeInfo.responseConverter(resp), nil -} - -// NetworkInfo sends NetworkInfoRequest over the network. -func (c *Client) NetworkInfo(ctx context.Context, req *NetworkInfoRequest) (*NetworkInfoResponse, error) { - resp, err := c.cNetworkInfo.caller(ctx, c.cNetworkInfo.requestConverter(req)) - if err != nil { - return nil, errors.Wrap(err, "could not send network info request") - } - - return c.cNetworkInfo.responseConverter(resp), nil -} - -func defaultCfg() *cfg { - return &cfg{ - proto: client.ProtoGRPC, - } -} - -// NewClient is a constructor for netmap transport client. -func NewClient(opts ...Option) (*Client, error) { - cfg := defaultCfg() - - for i := range opts { - opts[i](cfg) - } - - var err error - - switch cfg.proto { - case client.ProtoGRPC: - var c *netmap.Client - if c, err = newGRPCClient(cfg); err != nil { - break - } - - return &Client{ - cLocalNodeInfo: &localNodeInfoClient{ - requestConverter: func(req *LocalNodeInfoRequest) interface{} { - return LocalNodeInfoRequestToGRPCMessage(req) - }, - caller: func(ctx context.Context, req interface{}) (interface{}, error) { - return c.LocalNodeInfo(ctx, req.(*netmap.LocalNodeInfoRequest)) - }, - responseConverter: func(resp interface{}) *LocalNodeInfoResponse { - return LocalNodeInfoResponseFromGRPCMessage(resp.(*netmap.LocalNodeInfoResponse)) - }, - }, - cNetworkInfo: &networkInfoClient{ - requestConverter: func(req *NetworkInfoRequest) interface{} { - return NetworkInfoRequestToGRPCMessage(req) - }, - caller: func(ctx context.Context, req interface{}) (interface{}, error) { - return c.NetworkInfo(ctx, req.(*netmap.NetworkInfoRequest)) - }, - responseConverter: func(resp interface{}) *NetworkInfoResponse { - return NetworkInfoResponseFromGRPCMessage(resp.(*netmap.NetworkInfoResponse)) - }, - }, - }, nil - default: - err = client.ErrProtoUnsupported - } - - return nil, errors.Wrapf(err, "could not create %s Netmap client", cfg.proto) -} - -func newGRPCClient(cfg *cfg) (*netmap.Client, error) { - var err error - - if cfg.gRPC.client == nil { - if cfg.gRPC.serviceClient == nil { - conn, err := client.NewGRPCClientConn(cfg.globalOpts...) - if err != nil { - return nil, errors.Wrap(err, "could not open gRPC client connection") - } - - cfg.gRPC.serviceClient = netmap.NewNetmapServiceClient(conn) - } - - cfg.gRPC.client, err = netmap.NewClient( - cfg.gRPC.serviceClient, - append( - cfg.gRPC.callOpts, - netmap.WithCallOptions(cfg.gRPC.grpcCallOpts), - )..., - ) - } - - return cfg.gRPC.client, err -} - -// WithGlobalOpts sets global client options to client. -func WithGlobalOpts(v ...client.Option) Option { - return func(c *cfg) { - if len(v) > 0 { - c.globalOpts = v - } - } -} - -// WithGRPCServiceClient sets existing service client. -func WithGRPCServiceClient(v netmap.NetmapServiceClient) Option { - return func(c *cfg) { - c.gRPC.serviceClient = v - } -} - -// WithGRPCServiceClient sets GRPC specific call options. -func WithGRPCCallOpts(v []grpc.CallOption) Option { - return func(c *cfg) { - c.gRPC.grpcCallOpts = v - } -} - -// WithGRPCServiceClient sets GRPC specific client options. -func WithGRPCClientOpts(v []netmap.Option) Option { - return func(c *cfg) { - c.gRPC.callOpts = v - } -} - -// WithGRPCServiceClient sets existing GRPC client. -func WithGRPCClient(v *netmap.Client) Option { - return func(c *cfg) { - c.gRPC.client = v - } -} diff --git a/v2/netmap/convert.go b/v2/netmap/convert.go index caf30bd..3c64495 100644 --- a/v2/netmap/convert.go +++ b/v2/netmap/convert.go @@ -1,167 +1,252 @@ package netmap import ( + "github.com/nspcc-dev/neofs-api-go/rpc/grpc" + "github.com/nspcc-dev/neofs-api-go/rpc/message" netmap "github.com/nspcc-dev/neofs-api-go/v2/netmap/grpc" "github.com/nspcc-dev/neofs-api-go/v2/refs" - "github.com/nspcc-dev/neofs-api-go/v2/session" + refsGRPC "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" ) -func FilterToGRPCMessage(f *Filter) *netmap.Filter { - if f == nil { - return nil +func (f *Filter) ToGRPCMessage() grpc.Message { + var m *netmap.Filter + + if f != nil { + m = new(netmap.Filter) + + m.SetKey(f.key) + m.SetValue(f.value) + m.SetName(f.name) + m.SetOp(OperationToGRPCMessage(f.op)) + m.SetFilters(FiltersToGRPC(f.filters)) } - m := new(netmap.Filter) - - m.SetName(f.GetName()) - m.SetKey(f.GetKey()) - m.SetValue(f.GetValue()) - m.SetOp(OperationToGRPCMessage(f.GetOp())) - - filters := make([]*netmap.Filter, 0, len(f.GetFilters())) - for _, filter := range f.GetFilters() { - filters = append(filters, FilterToGRPCMessage(filter)) - } - m.SetFilters(filters) - return m } -func FilterFromGRPCMessage(m *netmap.Filter) *Filter { - if m == nil { - return nil +func (f *Filter) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*netmap.Filter) + if !ok { + return message.NewUnexpectedMessageType(m, v) } - f := new(Filter) - f.SetName(m.GetName()) - f.SetKey(m.GetKey()) - f.SetValue(m.GetValue()) - f.SetOp(OperationFromGRPCMessage(m.GetOp())) + var err error - filters := make([]*Filter, 0, len(f.GetFilters())) - for _, filter := range m.GetFilters() { - filters = append(filters, FilterFromGRPCMessage(filter)) + f.filters, err = FiltersFromGRPC(v.GetFilters()) + if err != nil { + return err } - f.SetFilters(filters) - return f + f.key = v.GetKey() + f.value = v.GetValue() + f.name = v.GetName() + f.op = OperationFromGRPCMessage(v.GetOp()) + + return nil } -func SelectorToGRPCMessage(s *Selector) *netmap.Selector { - if s == nil { - return nil +func FiltersToGRPC(fs []*Filter) (res []*netmap.Filter) { + if fs != nil { + res = make([]*netmap.Filter, 0, len(fs)) + + for i := range fs { + res = append(res, fs[i].ToGRPCMessage().(*netmap.Filter)) + } } - m := new(netmap.Selector) + return +} - m.SetName(s.GetName()) - m.SetCount(s.GetCount()) - m.SetClause(ClauseToGRPCMessage(s.GetClause())) - m.SetFilter(s.GetFilter()) - m.SetAttribute(s.GetAttribute()) +func FiltersFromGRPC(fs []*netmap.Filter) (res []*Filter, err error) { + if fs != nil { + res = make([]*Filter, 0, len(fs)) + + for i := range fs { + var f *Filter + + if fs[i] != nil { + f = new(Filter) + + err = f.FromGRPCMessage(fs[i]) + if err != nil { + return + } + } + + res = append(res, f) + } + } + + return +} + +func (s *Selector) ToGRPCMessage() grpc.Message { + var m *netmap.Selector + + if s != nil { + m = new(netmap.Selector) + + m.SetName(s.name) + m.SetAttribute(s.attribute) + m.SetFilter(s.filter) + m.SetCount(s.count) + m.SetClause(ClauseToGRPCMessage(s.clause)) + } return m } -func SelectorFromGRPCMessage(m *netmap.Selector) *Selector { - if m == nil { - return nil +func (s *Selector) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*netmap.Selector) + if !ok { + return message.NewUnexpectedMessageType(m, v) } - s := new(Selector) + s.name = v.GetName() + s.attribute = v.GetAttribute() + s.filter = v.GetFilter() + s.count = v.GetCount() + s.clause = ClauseFromGRPCMessage(v.GetClause()) - s.SetName(m.GetName()) - s.SetCount(m.GetCount()) - s.SetClause(ClauseFromGRPCMessage(m.GetClause())) - s.SetFilter(m.GetFilter()) - s.SetAttribute(m.GetAttribute()) - - return s + return nil } -func ReplicaToGRPCMessage(r *Replica) *netmap.Replica { - if r == nil { - return nil +func SelectorsToGRPC(ss []*Selector) (res []*netmap.Selector) { + if ss != nil { + res = make([]*netmap.Selector, 0, len(ss)) + + for i := range ss { + res = append(res, ss[i].ToGRPCMessage().(*netmap.Selector)) + } } - m := new(netmap.Replica) + return +} - m.SetCount(r.GetCount()) - m.SetSelector(r.GetSelector()) +func SelectorsFromGRPC(ss []*netmap.Selector) (res []*Selector, err error) { + if ss != nil { + res = make([]*Selector, 0, len(ss)) + + for i := range ss { + var s *Selector + + if ss[i] != nil { + s = new(Selector) + + err = s.FromGRPCMessage(ss[i]) + if err != nil { + return + } + } + + res = append(res, s) + } + } + + return +} + +func (r *Replica) ToGRPCMessage() grpc.Message { + var m *netmap.Replica + + if r != nil { + m = new(netmap.Replica) + + m.SetSelector(r.selector) + m.SetCount(r.count) + } return m } -func ReplicaFromGRPCMessage(m *netmap.Replica) *Replica { - if m == nil { - return nil +func (r *Replica) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*netmap.Replica) + if !ok { + return message.NewUnexpectedMessageType(m, v) } - r := new(Replica) - r.SetSelector(m.GetSelector()) - r.SetCount(m.GetCount()) + r.selector = v.GetSelector() + r.count = v.GetCount() - return r + return nil } -func PlacementPolicyToGRPCMessage(p *PlacementPolicy) *netmap.PlacementPolicy { - if p == nil { - return nil +func ReplicasToGRPC(rs []*Replica) (res []*netmap.Replica) { + if rs != nil { + res = make([]*netmap.Replica, 0, len(rs)) + + for i := range rs { + res = append(res, rs[i].ToGRPCMessage().(*netmap.Replica)) + } } - filters := make([]*netmap.Filter, 0, len(p.GetFilters())) - for _, filter := range p.GetFilters() { - filters = append(filters, FilterToGRPCMessage(filter)) + return +} + +func ReplicasFromGRPC(rs []*netmap.Replica) (res []*Replica, err error) { + if rs != nil { + res = make([]*Replica, 0, len(rs)) + + for i := range rs { + var r *Replica + + if rs[i] != nil { + r = new(Replica) + + err = r.FromGRPCMessage(rs[i]) + if err != nil { + return + } + } + + res = append(res, r) + } } - selectors := make([]*netmap.Selector, 0, len(p.GetSelectors())) - for _, selector := range p.GetSelectors() { - selectors = append(selectors, SelectorToGRPCMessage(selector)) + return +} + +func (p *PlacementPolicy) ToGRPCMessage() grpc.Message { + var m *netmap.PlacementPolicy + + if p != nil { + m = new(netmap.PlacementPolicy) + + m.SetFilters(FiltersToGRPC(p.filters)) + m.SetSelectors(SelectorsToGRPC(p.selectors)) + m.SetReplicas(ReplicasToGRPC(p.replicas)) + m.SetContainerBackupFactor(p.backupFactor) } - replicas := make([]*netmap.Replica, 0, len(p.GetReplicas())) - for _, replica := range p.GetReplicas() { - replicas = append(replicas, ReplicaToGRPCMessage(replica)) - } - - m := new(netmap.PlacementPolicy) - - m.SetContainerBackupFactor(p.GetContainerBackupFactor()) - m.SetFilters(filters) - m.SetSelectors(selectors) - m.SetReplicas(replicas) - return m } -func PlacementPolicyFromGRPCMessage(m *netmap.PlacementPolicy) *PlacementPolicy { - if m == nil { - return nil +func (p *PlacementPolicy) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*netmap.PlacementPolicy) + if !ok { + return message.NewUnexpectedMessageType(m, v) } - filters := make([]*Filter, 0, len(m.GetFilters())) - for _, filter := range m.GetFilters() { - filters = append(filters, FilterFromGRPCMessage(filter)) + var err error + + p.filters, err = FiltersFromGRPC(v.GetFilters()) + if err != nil { + return err } - selectors := make([]*Selector, 0, len(m.GetSelectors())) - for _, selector := range m.GetSelectors() { - selectors = append(selectors, SelectorFromGRPCMessage(selector)) + p.selectors, err = SelectorsFromGRPC(v.GetSelectors()) + if err != nil { + return err } - replicas := make([]*Replica, 0, len(m.GetReplicas())) - for _, replica := range m.GetReplicas() { - replicas = append(replicas, ReplicaFromGRPCMessage(replica)) + p.replicas, err = ReplicasFromGRPC(v.GetReplicas()) + if err != nil { + return err } - p := new(PlacementPolicy) + p.backupFactor = v.GetContainerBackupFactor() - p.SetContainerBackupFactor(m.GetContainerBackupFactor()) - p.SetFilters(filters) - p.SetSelectors(selectors) - p.SetReplicas(replicas) - - return p + return nil } func ClauseToGRPCMessage(n Clause) netmap.Clause { @@ -188,286 +273,397 @@ func NodeStateFromRPCMessage(n netmap.NodeInfo_State) NodeState { return NodeState(n) } -func AttributeToGRPCMessage(a *Attribute) *netmap.NodeInfo_Attribute { - if a == nil { - return nil +func (a *Attribute) ToGRPCMessage() grpc.Message { + var m *netmap.NodeInfo_Attribute + + if a != nil { + m = new(netmap.NodeInfo_Attribute) + + m.SetKey(a.key) + m.SetValue(a.value) + m.SetParents(a.parents) } - m := new(netmap.NodeInfo_Attribute) - - m.SetKey(a.GetKey()) - m.SetValue(a.GetValue()) - m.SetParents(a.GetParents()) - return m } -func AttributeFromGRPCMessage(m *netmap.NodeInfo_Attribute) *Attribute { - if m == nil { - return nil +func (a *Attribute) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*netmap.NodeInfo_Attribute) + if !ok { + return message.NewUnexpectedMessageType(m, v) } - a := new(Attribute) + a.key = v.GetKey() + a.value = v.GetValue() + a.parents = v.GetParents() - a.SetKey(m.GetKey()) - a.SetValue(m.GetValue()) - a.SetParents(m.GetParents()) - - return a + return nil } -func NodeInfoToGRPCMessage(n *NodeInfo) *netmap.NodeInfo { - if n == nil { - return nil +func AttributesToGRPC(as []*Attribute) (res []*netmap.NodeInfo_Attribute) { + if as != nil { + res = make([]*netmap.NodeInfo_Attribute, 0, len(as)) + + for i := range as { + res = append(res, as[i].ToGRPCMessage().(*netmap.NodeInfo_Attribute)) + } } - m := new(netmap.NodeInfo) + return +} - m.SetPublicKey(n.GetPublicKey()) - m.SetAddress(n.GetAddress()) - m.SetState(NodeStateToGRPCMessage(n.GetState())) +func AttributesFromGRPC(as []*netmap.NodeInfo_Attribute) (res []*Attribute, err error) { + if as != nil { + res = make([]*Attribute, 0, len(as)) - attr := n.GetAttributes() - attrMsg := make([]*netmap.NodeInfo_Attribute, 0, len(attr)) + for i := range as { + var a *Attribute - for i := range attr { - attrMsg = append(attrMsg, AttributeToGRPCMessage(attr[i])) + if as[i] != nil { + a = new(Attribute) + + err = a.FromGRPCMessage(as[i]) + if err != nil { + return + } + } + + res = append(res, a) + } } - m.SetAttributes(attrMsg) + return +} + +func (ni *NodeInfo) ToGRPCMessage() grpc.Message { + var m *netmap.NodeInfo + + if ni != nil { + m = new(netmap.NodeInfo) + + m.SetPublicKey(ni.publicKey) + m.SetAddress(ni.address) + m.SetState(NodeStateToGRPCMessage(ni.state)) + m.SetAttributes(AttributesToGRPC(ni.attributes)) + } return m } -func NodeInfoFromGRPCMessage(m *netmap.NodeInfo) *NodeInfo { - if m == nil { - return nil +func (ni *NodeInfo) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*netmap.NodeInfo) + if !ok { + return message.NewUnexpectedMessageType(m, v) } - a := new(NodeInfo) + var err error - a.SetPublicKey(m.GetPublicKey()) - a.SetAddress(m.GetAddress()) - a.SetState(NodeStateFromRPCMessage(m.GetState())) - - attrMsg := m.GetAttributes() - attr := make([]*Attribute, 0, len(attrMsg)) - - for i := range attrMsg { - attr = append(attr, AttributeFromGRPCMessage(attrMsg[i])) + ni.attributes, err = AttributesFromGRPC(v.GetAttributes()) + if err != nil { + return err } - a.SetAttributes(attr) + ni.publicKey = v.GetPublicKey() + ni.address = v.GetAddress() + ni.state = NodeStateFromRPCMessage(v.GetState()) - return a + return nil } -func LocalNodeInfoRequestBodyToGRPCMessage(r *LocalNodeInfoRequestBody) *netmap.LocalNodeInfoRequest_Body { - if r == nil { - return nil +func (l *LocalNodeInfoRequestBody) ToGRPCMessage() grpc.Message { + var m *netmap.LocalNodeInfoRequest_Body + + if l != nil { + m = new(netmap.LocalNodeInfoRequest_Body) } - return new(netmap.LocalNodeInfoRequest_Body) -} - -func LocalNodeInfoRequestBodyFromGRPCMessage(m *netmap.LocalNodeInfoRequest_Body) *LocalNodeInfoRequestBody { - if m == nil { - return nil - } - - return new(LocalNodeInfoRequestBody) -} - -func LocalNodeInfoResponseBodyToGRPCMessage(r *LocalNodeInfoResponseBody) *netmap.LocalNodeInfoResponse_Body { - if r == nil { - return nil - } - - m := new(netmap.LocalNodeInfoResponse_Body) - - m.SetVersion(refs.VersionToGRPCMessage(r.GetVersion())) - m.SetNodeInfo(NodeInfoToGRPCMessage(r.GetNodeInfo())) - return m } -func LocalNodeInfoResponseBodyFromGRPCMessage(m *netmap.LocalNodeInfoResponse_Body) *LocalNodeInfoResponseBody { - if m == nil { - return nil +func (l *LocalNodeInfoRequestBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*netmap.LocalNodeInfoRequest_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) } - r := new(LocalNodeInfoResponseBody) - r.SetVersion(refs.VersionFromGRPCMessage(m.GetVersion())) - r.SetNodeInfo(NodeInfoFromGRPCMessage(m.GetNodeInfo())) - - return r + return nil } -func LocalNodeInfoRequestToGRPCMessage(r *LocalNodeInfoRequest) *netmap.LocalNodeInfoRequest { - if r == nil { - return nil +func (l *LocalNodeInfoRequest) ToGRPCMessage() grpc.Message { + var m *netmap.LocalNodeInfoRequest + + if l != nil { + m = new(netmap.LocalNodeInfoRequest) + + m.SetBody(l.body.ToGRPCMessage().(*netmap.LocalNodeInfoRequest_Body)) + l.RequestHeaders.ToMessage(m) } - m := new(netmap.LocalNodeInfoRequest) - m.SetBody(LocalNodeInfoRequestBodyToGRPCMessage(r.GetBody())) - - session.RequestHeadersToGRPC(r, m) - return m } -func LocalNodeInfoRequestFromGRPCMessage(m *netmap.LocalNodeInfoRequest) *LocalNodeInfoRequest { - if m == nil { - return nil +func (l *LocalNodeInfoRequest) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*netmap.LocalNodeInfoRequest) + if !ok { + return message.NewUnexpectedMessageType(m, v) } - r := new(LocalNodeInfoRequest) - r.SetBody(LocalNodeInfoRequestBodyFromGRPCMessage(m.GetBody())) + var err error - session.RequestHeadersFromGRPC(m, r) + body := v.GetBody() + if body == nil { + l.body = nil + } else { + if l.body == nil { + l.body = new(LocalNodeInfoRequestBody) + } - return r + err = l.body.FromGRPCMessage(body) + if err != nil { + return err + } + } + + return l.RequestHeaders.FromMessage(v) } -func LocalNodeInfoResponseToGRPCMessage(r *LocalNodeInfoResponse) *netmap.LocalNodeInfoResponse { - if r == nil { - return nil +func (l *LocalNodeInfoResponseBody) ToGRPCMessage() grpc.Message { + var m *netmap.LocalNodeInfoResponse_Body + + if l != nil { + m = new(netmap.LocalNodeInfoResponse_Body) + + m.SetVersion(l.version.ToGRPCMessage().(*refsGRPC.Version)) + m.SetNodeInfo(l.nodeInfo.ToGRPCMessage().(*netmap.NodeInfo)) } - m := new(netmap.LocalNodeInfoResponse) - m.SetBody(LocalNodeInfoResponseBodyToGRPCMessage(r.GetBody())) - - session.ResponseHeadersToGRPC(r, m) - return m } -func LocalNodeInfoResponseFromGRPCMessage(m *netmap.LocalNodeInfoResponse) *LocalNodeInfoResponse { - if m == nil { - return nil +func (l *LocalNodeInfoResponseBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*netmap.LocalNodeInfoResponse_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) } - r := new(LocalNodeInfoResponse) - r.SetBody(LocalNodeInfoResponseBodyFromGRPCMessage(m.GetBody())) + var err error - session.ResponseHeadersFromGRPC(m, r) + version := v.GetVersion() + if version == nil { + l.version = nil + } else { + if l.version == nil { + l.version = new(refs.Version) + } - return r + err = l.version.FromGRPCMessage(version) + if err != nil { + return err + } + } + + nodeInfo := v.GetNodeInfo() + if nodeInfo == nil { + l.nodeInfo = nil + } else { + if l.nodeInfo == nil { + l.nodeInfo = new(NodeInfo) + } + + err = l.nodeInfo.FromGRPCMessage(nodeInfo) + } + + return err } -func NetworkInfoToGRPCMessage(n *NetworkInfo) *netmap.NetworkInfo { - if n == nil { - return nil +func (l *LocalNodeInfoResponse) ToGRPCMessage() grpc.Message { + var m *netmap.LocalNodeInfoResponse + + if l != nil { + m = new(netmap.LocalNodeInfoResponse) + + m.SetBody(l.body.ToGRPCMessage().(*netmap.LocalNodeInfoResponse_Body)) + l.ResponseHeaders.ToMessage(m) } - m := new(netmap.NetworkInfo) - - m.SetCurrentEpoch(n.GetCurrentEpoch()) - m.SetMagicNumber(n.GetMagicNumber()) - return m } -func NetworkInfoFromGRPCMessage(m *netmap.NetworkInfo) *NetworkInfo { - if m == nil { - return nil +func (l *LocalNodeInfoResponse) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*netmap.LocalNodeInfoResponse) + if !ok { + return message.NewUnexpectedMessageType(m, v) } - n := new(NetworkInfo) + var err error - n.SetCurrentEpoch(m.GetCurrentEpoch()) - n.SetMagicNumber(m.GetMagicNumber()) + body := v.GetBody() + if body == nil { + l.body = nil + } else { + if l.body == nil { + l.body = new(LocalNodeInfoResponseBody) + } - return n + err = l.body.FromGRPCMessage(body) + if err != nil { + return err + } + } + + return l.ResponseHeaders.FromMessage(v) } -func NetworkInfoRequestBodyToGRPCMessage(r *NetworkInfoRequestBody) *netmap.NetworkInfoRequest_Body { - if r == nil { - return nil +func (i *NetworkInfo) ToGRPCMessage() grpc.Message { + var m *netmap.NetworkInfo + + if i != nil { + m = new(netmap.NetworkInfo) + + m.SetMagicNumber(i.magicNum) + m.SetCurrentEpoch(i.curEpoch) } - return new(netmap.NetworkInfoRequest_Body) -} - -func NetworkInfoRequestBodyFromGRPCMessage(m *netmap.NetworkInfoRequest_Body) *NetworkInfoRequestBody { - if m == nil { - return nil - } - - return new(NetworkInfoRequestBody) -} - -func NetworkInfoResponseBodyToGRPCMessage(r *NetworkInfoResponseBody) *netmap.NetworkInfoResponse_Body { - if r == nil { - return nil - } - - m := new(netmap.NetworkInfoResponse_Body) - - m.SetNetworkInfo(NetworkInfoToGRPCMessage(r.GetNetworkInfo())) - return m } -func NetworkInfoResponseBodyFromGRPCMessage(m *netmap.NetworkInfoResponse_Body) *NetworkInfoResponseBody { - if m == nil { - return nil +func (i *NetworkInfo) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*netmap.NetworkInfo) + if !ok { + return message.NewUnexpectedMessageType(m, v) } - r := new(NetworkInfoResponseBody) - r.SetNetworkInfo(NetworkInfoFromGRPCMessage(m.GetNetworkInfo())) + i.magicNum = v.GetMagicNumber() + i.curEpoch = v.GetCurrentEpoch() - return r + return nil } -func NetworkInfoRequestToGRPCMessage(r *NetworkInfoRequest) *netmap.NetworkInfoRequest { - if r == nil { - return nil +func (l *NetworkInfoRequestBody) ToGRPCMessage() grpc.Message { + var m *netmap.NetworkInfoRequest_Body + + if l != nil { + m = new(netmap.NetworkInfoRequest_Body) } - m := new(netmap.NetworkInfoRequest) - m.SetBody(NetworkInfoRequestBodyToGRPCMessage(r.GetBody())) - - session.RequestHeadersToGRPC(r, m) - return m } -func NetworkInfoRequestFromGRPCMessage(m *netmap.NetworkInfoRequest) *NetworkInfoRequest { - if m == nil { - return nil +func (l *NetworkInfoRequestBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*netmap.NetworkInfoRequest_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) } - r := new(NetworkInfoRequest) - r.SetBody(NetworkInfoRequestBodyFromGRPCMessage(m.GetBody())) - - session.RequestHeadersFromGRPC(m, r) - - return r + return nil } -func NetworkInfoResponseToGRPCMessage(r *NetworkInfoResponse) *netmap.NetworkInfoResponse { - if r == nil { - return nil +func (l *NetworkInfoRequest) ToGRPCMessage() grpc.Message { + var m *netmap.NetworkInfoRequest + + if l != nil { + m = new(netmap.NetworkInfoRequest) + + m.SetBody(l.body.ToGRPCMessage().(*netmap.NetworkInfoRequest_Body)) + l.RequestHeaders.ToMessage(m) } - m := new(netmap.NetworkInfoResponse) - m.SetBody(NetworkInfoResponseBodyToGRPCMessage(r.GetBody())) - - session.ResponseHeadersToGRPC(r, m) - return m } -func NetworkInfoResponseFromGRPCMessage(m *netmap.NetworkInfoResponse) *NetworkInfoResponse { - if m == nil { - return nil +func (l *NetworkInfoRequest) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*netmap.NetworkInfoRequest) + if !ok { + return message.NewUnexpectedMessageType(m, v) } - r := new(NetworkInfoResponse) - r.SetBody(NetworkInfoResponseBodyFromGRPCMessage(m.GetBody())) + var err error - session.ResponseHeadersFromGRPC(m, r) + body := v.GetBody() + if body == nil { + l.body = nil + } else { + if l.body == nil { + l.body = new(NetworkInfoRequestBody) + } - return r + err = l.body.FromGRPCMessage(body) + if err != nil { + return err + } + } + + return l.RequestHeaders.FromMessage(v) +} + +func (i *NetworkInfoResponseBody) ToGRPCMessage() grpc.Message { + var m *netmap.NetworkInfoResponse_Body + + if i != nil { + m = new(netmap.NetworkInfoResponse_Body) + + m.SetNetworkInfo(i.netInfo.ToGRPCMessage().(*netmap.NetworkInfo)) + } + + return m +} + +func (i *NetworkInfoResponseBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*netmap.NetworkInfoResponse_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + netInfo := v.GetNetworkInfo() + if netInfo == nil { + i.netInfo = nil + } else { + if i.netInfo == nil { + i.netInfo = new(NetworkInfo) + } + + err = i.netInfo.FromGRPCMessage(netInfo) + } + + return err +} + +func (l *NetworkInfoResponse) ToGRPCMessage() grpc.Message { + var m *netmap.NetworkInfoResponse + + if l != nil { + m = new(netmap.NetworkInfoResponse) + + m.SetBody(l.body.ToGRPCMessage().(*netmap.NetworkInfoResponse_Body)) + l.ResponseHeaders.ToMessage(m) + } + + return m +} + +func (l *NetworkInfoResponse) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*netmap.NetworkInfoResponse) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + body := v.GetBody() + if body == nil { + l.body = nil + } else { + if l.body == nil { + l.body = new(NetworkInfoResponseBody) + } + + err = l.body.FromGRPCMessage(body) + if err != nil { + return err + } + } + + return l.ResponseHeaders.FromMessage(v) } diff --git a/v2/netmap/grpc/client.go b/v2/netmap/grpc/client.go deleted file mode 100644 index 5ed5e5b..0000000 --- a/v2/netmap/grpc/client.go +++ /dev/null @@ -1,66 +0,0 @@ -package netmap - -import ( - "context" - - "github.com/pkg/errors" - "google.golang.org/grpc" -) - -// Client wraps NetmapServiceClient -// with pre-defined configurations. -type Client struct { - *cfg - - client NetmapServiceClient -} - -// Option represents Client option. -type Option func(*cfg) - -type cfg struct { - callOpts []grpc.CallOption -} - -// ErrNilNetmapServiceClient is returned by functions that expect -// a non-nil ContainerServiceClient, but received nil. -var ErrNilNetmapServiceClient = errors.New("netmap gRPC client is nil") - -func defaultCfg() *cfg { - return new(cfg) -} - -// NewClient creates, initializes and returns a new Client instance. -// -// Options are applied one by one in order. -func NewClient(c NetmapServiceClient, opts ...Option) (*Client, error) { - if c == nil { - return nil, ErrNilNetmapServiceClient - } - - cfg := defaultCfg() - for i := range opts { - opts[i](cfg) - } - - return &Client{ - cfg: cfg, - client: c, - }, nil -} - -func (c *Client) LocalNodeInfo(ctx context.Context, req *LocalNodeInfoRequest) (*LocalNodeInfoResponse, error) { - return c.client.LocalNodeInfo(ctx, req, c.callOpts...) -} - -func (c *Client) NetworkInfo(ctx context.Context, req *NetworkInfoRequest) (*NetworkInfoResponse, error) { - return c.client.NetworkInfo(ctx, req, c.callOpts...) -} - -// WithCallOptions returns Option that configures -// Client to attach call options to each rpc call. -func WithCallOptions(opts []grpc.CallOption) Option { - return func(c *cfg) { - c.callOpts = opts - } -} diff --git a/v2/netmap/json.go b/v2/netmap/json.go index 3445f05..64f2f6d 100644 --- a/v2/netmap/json.go +++ b/v2/netmap/json.go @@ -1,146 +1,62 @@ package netmap import ( + "github.com/nspcc-dev/neofs-api-go/rpc/message" netmap "github.com/nspcc-dev/neofs-api-go/v2/netmap/grpc" - "google.golang.org/protobuf/encoding/protojson" ) func (p *PlacementPolicy) MarshalJSON() ([]byte, error) { - return protojson.MarshalOptions{ - EmitUnpopulated: true, - }.Marshal( - PlacementPolicyToGRPCMessage(p), - ) + return message.MarshalJSON(p) } func (p *PlacementPolicy) UnmarshalJSON(data []byte) error { - msg := new(netmap.PlacementPolicy) - - if err := protojson.Unmarshal(data, msg); err != nil { - return err - } - - *p = *PlacementPolicyFromGRPCMessage(msg) - - return nil + return message.UnmarshalJSON(p, data, new(netmap.PlacementPolicy)) } func (f *Filter) MarshalJSON() ([]byte, error) { - return protojson.MarshalOptions{ - EmitUnpopulated: true, - }.Marshal( - FilterToGRPCMessage(f), - ) + return message.MarshalJSON(f) } func (f *Filter) UnmarshalJSON(data []byte) error { - msg := new(netmap.Filter) - - if err := protojson.Unmarshal(data, msg); err != nil { - return err - } - - *f = *FilterFromGRPCMessage(msg) - - return nil + return message.UnmarshalJSON(f, data, new(netmap.Filter)) } func (s *Selector) MarshalJSON() ([]byte, error) { - return protojson.MarshalOptions{ - EmitUnpopulated: true, - }.Marshal( - SelectorToGRPCMessage(s), - ) + return message.MarshalJSON(s) } func (s *Selector) UnmarshalJSON(data []byte) error { - msg := new(netmap.Selector) - - if err := protojson.Unmarshal(data, msg); err != nil { - return err - } - - *s = *SelectorFromGRPCMessage(msg) - - return nil + return message.UnmarshalJSON(s, data, new(netmap.Selector)) } func (r *Replica) MarshalJSON() ([]byte, error) { - return protojson.MarshalOptions{ - EmitUnpopulated: true, - }.Marshal( - ReplicaToGRPCMessage(r), - ) + return message.MarshalJSON(r) } func (r *Replica) UnmarshalJSON(data []byte) error { - msg := new(netmap.Replica) - - if err := protojson.Unmarshal(data, msg); err != nil { - return err - } - - *r = *ReplicaFromGRPCMessage(msg) - - return nil + return message.UnmarshalJSON(r, data, new(netmap.Replica)) } func (a *Attribute) MarshalJSON() ([]byte, error) { - return protojson.MarshalOptions{ - EmitUnpopulated: true, - }.Marshal( - AttributeToGRPCMessage(a), - ) + return message.MarshalJSON(a) } func (a *Attribute) UnmarshalJSON(data []byte) error { - msg := new(netmap.NodeInfo_Attribute) - - if err := protojson.Unmarshal(data, msg); err != nil { - return err - } - - *a = *AttributeFromGRPCMessage(msg) - - return nil + return message.UnmarshalJSON(a, data, new(netmap.NodeInfo_Attribute)) } func (ni *NodeInfo) MarshalJSON() ([]byte, error) { - return protojson.MarshalOptions{ - EmitUnpopulated: true, - }.Marshal( - NodeInfoToGRPCMessage(ni), - ) + return message.MarshalJSON(ni) } func (ni *NodeInfo) UnmarshalJSON(data []byte) error { - msg := new(netmap.NodeInfo) - - if err := protojson.Unmarshal(data, msg); err != nil { - return err - } - - *ni = *NodeInfoFromGRPCMessage(msg) - - return nil + return message.UnmarshalJSON(ni, data, new(netmap.NodeInfo)) } func (i *NetworkInfo) MarshalJSON() ([]byte, error) { - return protojson.MarshalOptions{ - EmitUnpopulated: true, - }.Marshal( - NetworkInfoToGRPCMessage(i), - ) + return message.MarshalJSON(i) } func (i *NetworkInfo) UnmarshalJSON(data []byte) error { - msg := new(netmap.NetworkInfo) - - if err := protojson.Unmarshal(data, msg); err != nil { - return err - } - - *i = *NetworkInfoFromGRPCMessage(msg) - - return nil + return message.UnmarshalJSON(i, data, new(netmap.NetworkInfo)) } diff --git a/v2/netmap/json_test.go b/v2/netmap/json_test.go deleted file mode 100644 index 3f01b03..0000000 --- a/v2/netmap/json_test.go +++ /dev/null @@ -1,80 +0,0 @@ -package netmap_test - -import ( - "testing" - - "github.com/nspcc-dev/neofs-api-go/v2/netmap" - "github.com/stretchr/testify/require" -) - -func TestFilterJSON(t *testing.T) { - f := generateFilter("key", "value", false) - - d, err := f.MarshalJSON() - require.NoError(t, err) - - f2 := new(netmap.Filter) - require.NoError(t, f2.UnmarshalJSON(d)) - - require.Equal(t, f, f2) -} - -func TestSelectorJSON(t *testing.T) { - s := generateSelector("name") - - data, err := s.MarshalJSON() - require.NoError(t, err) - - s2 := new(netmap.Selector) - require.NoError(t, s2.UnmarshalJSON(data)) - - require.Equal(t, s, s2) -} - -func TestReplicaJSON(t *testing.T) { - s := generateReplica("selector") - - data, err := s.MarshalJSON() - require.NoError(t, err) - - s2 := new(netmap.Replica) - require.NoError(t, s2.UnmarshalJSON(data)) - - require.Equal(t, s, s2) -} - -func TestAttributeJSON(t *testing.T) { - a := generateAttribute("key", "value") - - data, err := a.MarshalJSON() - require.NoError(t, err) - - a2 := new(netmap.Attribute) - require.NoError(t, a2.UnmarshalJSON(data)) - - require.Equal(t, a, a2) -} - -func TestNodeInfoJSON(t *testing.T) { - i := generateNodeInfo("key", "value", 3) - - data, err := i.MarshalJSON() - require.NoError(t, err) - - i2 := new(netmap.NodeInfo) - require.NoError(t, i2.UnmarshalJSON(data)) - - require.Equal(t, i, i2) -} - -func TestNetworkInfoJSON(t *testing.T) { - i := generateNetworkInfo() - - data, err := i.MarshalJSON() - require.NoError(t, err) - - i2 := new(netmap.NetworkInfo) - require.NoError(t, i2.UnmarshalJSON(data)) - - require.Equal(t, i, i2) -} diff --git a/v2/netmap/marshal.go b/v2/netmap/marshal.go index 3fa3388..79da27a 100644 --- a/v2/netmap/marshal.go +++ b/v2/netmap/marshal.go @@ -1,9 +1,9 @@ package netmap import ( + "github.com/nspcc-dev/neofs-api-go/rpc/message" protoutil "github.com/nspcc-dev/neofs-api-go/util/proto" netmap "github.com/nspcc-dev/neofs-api-go/v2/netmap/grpc" - "google.golang.org/protobuf/proto" ) const ( @@ -107,14 +107,7 @@ func (f *Filter) StableSize() (size int) { } func (f *Filter) Unmarshal(data []byte) error { - m := new(netmap.Filter) - if err := proto.Unmarshal(data, m); err != nil { - return err - } - - *f = *FilterFromGRPCMessage(m) - - return nil + return message.Unmarshal(f, data, new(netmap.Filter)) } func (s *Selector) StableMarshal(buf []byte) ([]byte, error) { @@ -178,14 +171,7 @@ func (s *Selector) StableSize() (size int) { } func (s *Selector) Unmarshal(data []byte) error { - m := new(netmap.Selector) - if err := proto.Unmarshal(data, m); err != nil { - return err - } - - *s = *SelectorFromGRPCMessage(m) - - return nil + return message.Unmarshal(s, data, new(netmap.Selector)) } func (r *Replica) StableMarshal(buf []byte) ([]byte, error) { @@ -225,14 +211,7 @@ func (r *Replica) StableSize() (size int) { } func (r *Replica) Unmarshal(data []byte) error { - m := new(netmap.Replica) - if err := proto.Unmarshal(data, m); err != nil { - return err - } - - *r = *ReplicaFromGRPCMessage(m) - - return nil + return message.Unmarshal(r, data, new(netmap.Replica)) } func (p *PlacementPolicy) StableMarshal(buf []byte) ([]byte, error) { @@ -305,14 +284,7 @@ func (p *PlacementPolicy) StableSize() (size int) { } func (p *PlacementPolicy) Unmarshal(data []byte) error { - m := new(netmap.PlacementPolicy) - if err := proto.Unmarshal(data, m); err != nil { - return err - } - - *p = *PlacementPolicyFromGRPCMessage(m) - - return nil + return message.Unmarshal(p, data, new(netmap.PlacementPolicy)) } func (a *Attribute) StableMarshal(buf []byte) ([]byte, error) { @@ -371,14 +343,7 @@ func (a *Attribute) StableSize() (size int) { } func (a *Attribute) Unmarshal(data []byte) error { - m := new(netmap.NodeInfo_Attribute) - if err := proto.Unmarshal(data, m); err != nil { - return err - } - - *a = *AttributeFromGRPCMessage(m) - - return nil + return message.Unmarshal(a, data, new(netmap.NodeInfo_Attribute)) } func (ni *NodeInfo) StableMarshal(buf []byte) ([]byte, error) { @@ -443,14 +408,7 @@ func (ni *NodeInfo) StableSize() (size int) { } func (ni *NodeInfo) Unmarshal(data []byte) error { - m := new(netmap.NodeInfo) - if err := proto.Unmarshal(data, m); err != nil { - return err - } - - *ni = *NodeInfoFromGRPCMessage(m) - - return nil + return message.Unmarshal(ni, data, new(netmap.NodeInfo)) } func (l *LocalNodeInfoRequestBody) StableMarshal(buf []byte) ([]byte, error) { @@ -461,6 +419,10 @@ func (l *LocalNodeInfoRequestBody) StableSize() (size int) { return 0 } +func (l *LocalNodeInfoRequestBody) Unmarshal([]byte) error { + return nil +} + func (l *LocalNodeInfoResponseBody) StableMarshal(buf []byte) ([]byte, error) { if l == nil { return []byte{}, nil @@ -501,6 +463,10 @@ func (l *LocalNodeInfoResponseBody) StableSize() (size int) { return size } +func (l *LocalNodeInfoResponseBody) Unmarshal(data []byte) error { + return message.Unmarshal(l, data, new(netmap.LocalNodeInfoResponse_Body)) +} + const ( _ = iota netInfoCurEpochFNum @@ -548,14 +514,7 @@ func (i *NetworkInfo) StableSize() (size int) { } func (i *NetworkInfo) Unmarshal(data []byte) error { - m := new(netmap.NetworkInfo) - if err := proto.Unmarshal(data, m); err != nil { - return err - } - - *i = *NetworkInfoFromGRPCMessage(m) - - return nil + return message.Unmarshal(i, data, new(netmap.NetworkInfo)) } func (l *NetworkInfoRequestBody) StableMarshal(buf []byte) ([]byte, error) { @@ -566,6 +525,10 @@ func (l *NetworkInfoRequestBody) StableSize() (size int) { return 0 } +func (l *NetworkInfoRequestBody) Unmarshal(data []byte) error { + return message.Unmarshal(l, data, new(netmap.NetworkInfoRequest_Body)) +} + const ( _ = iota netInfoRespBodyNetInfoFNum @@ -597,3 +560,7 @@ func (i *NetworkInfoResponseBody) StableSize() (size int) { return size } + +func (i *NetworkInfoResponseBody) Unmarshal(data []byte) error { + return message.Unmarshal(i, data, new(netmap.NetworkInfoResponse_Body)) +} diff --git a/v2/netmap/marshal_test.go b/v2/netmap/marshal_test.go deleted file mode 100644 index 0acbd4b..0000000 --- a/v2/netmap/marshal_test.go +++ /dev/null @@ -1,248 +0,0 @@ -package netmap_test - -import ( - "strconv" - "testing" - - "github.com/nspcc-dev/neofs-api-go/v2/netmap" - grpc "github.com/nspcc-dev/neofs-api-go/v2/netmap/grpc" - "github.com/nspcc-dev/neofs-api-go/v2/refs" - "github.com/stretchr/testify/require" - goproto "google.golang.org/protobuf/proto" -) - -func TestAttribute_StableMarshal(t *testing.T) { - from := generateAttribute("key", "value") - - t.Run("non empty", func(t *testing.T) { - wire, err := from.StableMarshal(nil) - require.NoError(t, err) - - to := new(netmap.Attribute) - require.NoError(t, to.Unmarshal(wire)) - - require.Equal(t, from, to) - }) -} - -func TestNodeInfo_StableMarshal(t *testing.T) { - from := generateNodeInfo("publicKey", "/multi/addr", 10) - - t.Run("non empty", func(t *testing.T) { - wire, err := from.StableMarshal(nil) - require.NoError(t, err) - - to := new(netmap.NodeInfo) - require.NoError(t, to.Unmarshal(wire)) - - require.Equal(t, from, to) - }) -} - -func TestFilter_StableMarshal(t *testing.T) { - from := generateFilter("key", "value", false) - - t.Run("non empty", func(t *testing.T) { - wire, err := from.StableMarshal(nil) - require.NoError(t, err) - - to := new(netmap.Filter) - require.NoError(t, to.Unmarshal(wire)) - - require.Equal(t, from, to) - }) -} - -func TestSelector_StableMarshal(t *testing.T) { - from := generateSelector("name") - - t.Run("non empty", func(t *testing.T) { - wire, err := from.StableMarshal(nil) - require.NoError(t, err) - - to := new(netmap.Selector) - require.NoError(t, to.Unmarshal(wire)) - - require.Equal(t, from, to) - }) -} - -func TestReplica_StableMarshal(t *testing.T) { - from := generateReplica("selector") - - t.Run("non empty", func(t *testing.T) { - wire, err := from.StableMarshal(nil) - require.NoError(t, err) - - to := new(netmap.Replica) - require.NoError(t, to.Unmarshal(wire)) - - require.Equal(t, from, to) - }) -} - -func TestPlacementPolicy_StableMarshal(t *testing.T) { - from := generatePolicy(3) - - t.Run("non empty", func(t *testing.T) { - wire, err := from.StableMarshal(nil) - require.NoError(t, err) - - to := new(netmap.PlacementPolicy) - require.NoError(t, to.Unmarshal(wire)) - - require.Equal(t, from, to) - }) -} - -func TestLocalNodeInfoResponseBody_StableMarshal(t *testing.T) { - from := generateNodeInfoResponseBody() - transport := new(grpc.LocalNodeInfoResponse_Body) - - t.Run("non empty", func(t *testing.T) { - wire, err := from.StableMarshal(nil) - require.NoError(t, err) - - err = goproto.Unmarshal(wire, transport) - require.NoError(t, err) - - to := netmap.LocalNodeInfoResponseBodyFromGRPCMessage(transport) - require.Equal(t, from, to) - }) -} - -func TestNetworkInfoResponseBody_StableMarshal(t *testing.T) { - from := generateNetworkInfoResponseBody() - transport := new(grpc.NetworkInfoResponse_Body) - - t.Run("non empty", func(t *testing.T) { - wire, err := from.StableMarshal(nil) - require.NoError(t, err) - - err = goproto.Unmarshal(wire, transport) - require.NoError(t, err) - - to := netmap.NetworkInfoResponseBodyFromGRPCMessage(transport) - require.Equal(t, from, to) - }) -} - -func generateAttribute(k, v string) *netmap.Attribute { - attr := new(netmap.Attribute) - attr.SetKey(k) - attr.SetValue(v) - attr.SetParents([]string{k, v}) - - return attr -} - -func generateNodeInfo(key, addr string, n int) *netmap.NodeInfo { - nodeInfo := new(netmap.NodeInfo) - nodeInfo.SetPublicKey([]byte(key)) - nodeInfo.SetAddress(addr) - nodeInfo.SetState(netmap.Online) - - attrs := make([]*netmap.Attribute, n) - for i := 0; i < n; i++ { - j := strconv.Itoa(n) - attrs[i] = generateAttribute("key"+j, "value"+j) - } - - nodeInfo.SetAttributes(attrs) - - return nodeInfo -} - -func generateFilter(key, value string, fin bool) *netmap.Filter { - f := new(netmap.Filter) - f.SetKey(key) - f.SetValue(value) - f.SetName("name") - f.SetOp(netmap.AND) - if !fin { - ff := generateFilter(key+"fin", value+"fin", true) - f.SetFilters([]*netmap.Filter{ff}) - } else { - f.SetFilters([]*netmap.Filter{}) - } - - return f -} - -func generateSelector(name string) *netmap.Selector { - s := new(netmap.Selector) - s.SetName(name) - s.SetAttribute("attribute") - s.SetClause(netmap.Distinct) - s.SetCount(10) - s.SetFilter("filter") - - return s -} - -func generateReplica(selector string) *netmap.Replica { - r := new(netmap.Replica) - r.SetCount(10) - r.SetSelector(selector) - - return r -} - -func generatePolicy(n int) *netmap.PlacementPolicy { - var ( - p = new(netmap.PlacementPolicy) - f = make([]*netmap.Filter, 0, n) - s = make([]*netmap.Selector, 0, n) - r = make([]*netmap.Replica, 0, n) - ) - - for i := 0; i < n; i++ { - ind := strconv.Itoa(i) - - f = append(f, generateFilter("key"+ind, "val"+ind, false)) - s = append(s, generateSelector("name"+ind)) - r = append(r, generateReplica("selector"+ind)) - } - - p.SetFilters(f) - p.SetSelectors(s) - p.SetReplicas(r) - p.SetContainerBackupFactor(10) - - return p -} - -func generateNodeInfoResponseBody() *netmap.LocalNodeInfoResponseBody { - ni := generateNodeInfo("key", "/multi/addr", 2) - - r := new(netmap.LocalNodeInfoResponseBody) - r.SetVersion(generateVersion(2, 1)) - r.SetNodeInfo(ni) - - return r -} - -func generateVersion(maj, min uint32) *refs.Version { - version := new(refs.Version) - version.SetMajor(maj) - version.SetMinor(min) - - return version -} - -func generateNetworkInfo() *netmap.NetworkInfo { - ni := new(netmap.NetworkInfo) - ni.SetCurrentEpoch(13) - ni.SetMagicNumber(666) - - return ni -} - -func generateNetworkInfoResponseBody() *netmap.NetworkInfoResponseBody { - ni := generateNetworkInfo() - - r := new(netmap.NetworkInfoResponseBody) - r.SetNetworkInfo(ni) - - return r -} diff --git a/v2/netmap/message_test.go b/v2/netmap/message_test.go new file mode 100644 index 0000000..4a653bf --- /dev/null +++ b/v2/netmap/message_test.go @@ -0,0 +1,25 @@ +package netmap_test + +import ( + "testing" + + "github.com/nspcc-dev/neofs-api-go/rpc/message" + messagetest "github.com/nspcc-dev/neofs-api-go/rpc/message/test" + netmaptest "github.com/nspcc-dev/neofs-api-go/v2/netmap/test" +) + +func TestMessageConvert(t *testing.T) { + messagetest.TestRPCMessage(t, + func(empty bool) message.Message { return netmaptest.GenerateFilter(empty) }, + func(empty bool) message.Message { return netmaptest.GenerateSelector(empty) }, + func(empty bool) message.Message { return netmaptest.GenerateReplica(empty) }, + func(empty bool) message.Message { return netmaptest.GeneratePlacementPolicy(empty) }, + func(empty bool) message.Message { return netmaptest.GenerateAttribute(empty) }, + func(empty bool) message.Message { return netmaptest.GenerateNodeInfo(empty) }, + func(empty bool) message.Message { return netmaptest.GenerateLocalNodeInfoRequest(empty) }, + func(empty bool) message.Message { return netmaptest.GenerateLocalNodeInfoResponseBody(empty) }, + func(empty bool) message.Message { return netmaptest.GenerateNetworkInfo(empty) }, + func(empty bool) message.Message { return netmaptest.GenerateNetworkInfoRequest(empty) }, + func(empty bool) message.Message { return netmaptest.GenerateNetworkInfoResponseBody(empty) }, + ) +} diff --git a/v2/netmap/service.go b/v2/netmap/service.go deleted file mode 100644 index a57819b..0000000 --- a/v2/netmap/service.go +++ /dev/null @@ -1,46 +0,0 @@ -package netmap - -import ( - "context" - - "github.com/nspcc-dev/neofs-api-go/v2/session" -) - -type Service interface { - LocalNodeInfo(ctx context.Context, request *LocalNodeInfoRequest) (*LocalNodeInfoResponse, error) - NetworkInfo(ctx context.Context, request *NetworkInfoRequest) (*NetworkInfoResponse, error) -} - -type LocalNodeInfoRequest struct { - body *LocalNodeInfoRequestBody - - metaHeader *session.RequestMetaHeader - - verifyHeader *session.RequestVerificationHeader -} - -type LocalNodeInfoResponse struct { - body *LocalNodeInfoResponseBody - - metaHeader *session.ResponseMetaHeader - - verifyHeader *session.ResponseVerificationHeader -} - -// NetworkInfoRequest is a structure of NetworkInfo request. -type NetworkInfoRequest struct { - body *NetworkInfoRequestBody - - metaHeader *session.RequestMetaHeader - - verifyHeader *session.RequestVerificationHeader -} - -// NetworkInfoResponse is a structure of NetworkInfo response. -type NetworkInfoResponse struct { - body *NetworkInfoResponseBody - - metaHeader *session.ResponseMetaHeader - - verifyHeader *session.ResponseVerificationHeader -} diff --git a/v2/netmap/test/generate.go b/v2/netmap/test/generate.go new file mode 100644 index 0000000..3818596 --- /dev/null +++ b/v2/netmap/test/generate.go @@ -0,0 +1,219 @@ +package netmaptest + +import ( + "github.com/nspcc-dev/neofs-api-go/v2/netmap" + refstest "github.com/nspcc-dev/neofs-api-go/v2/refs/test" + sessiontest "github.com/nspcc-dev/neofs-api-go/v2/session/test" +) + +func GenerateFilter(empty bool) *netmap.Filter { + return generateFilter(empty, true) +} + +func generateFilter(empty, withSub bool) *netmap.Filter { + m := new(netmap.Filter) + + if !empty { + m.SetKey("filter key") + m.SetValue("filter value") + m.SetName("filter name") + m.SetOp(1) + + if withSub { + m.SetFilters([]*netmap.Filter{ + generateFilter(empty, false), + generateFilter(empty, false), + }) + } + } + + return m +} + +func GenerateFilters(empty bool) (res []*netmap.Filter) { + if !empty { + res = append(res, + GenerateFilter(false), + GenerateFilter(false), + ) + } + + return +} + +func GenerateSelector(empty bool) *netmap.Selector { + m := new(netmap.Selector) + + if !empty { + m.SetCount(66) + m.SetAttribute("selector attribute") + m.SetFilter("select filter") + m.SetName("select name") + m.SetClause(1) + } + + return m +} + +func GenerateSelectors(empty bool) (res []*netmap.Selector) { + if !empty { + res = append(res, + GenerateSelector(false), + GenerateSelector(false), + ) + } + + return +} + +func GenerateReplica(empty bool) *netmap.Replica { + m := new(netmap.Replica) + + if !empty { + m.SetCount(42) + m.SetSelector("replica selector") + } + + return m +} + +func GenerateReplicas(empty bool) (res []*netmap.Replica) { + if !empty { + res = append(res, + GenerateReplica(false), + GenerateReplica(false), + ) + } + + return +} + +func GeneratePlacementPolicy(empty bool) *netmap.PlacementPolicy { + m := new(netmap.PlacementPolicy) + + if !empty { + m.SetContainerBackupFactor(322) + } + + m.SetFilters(GenerateFilters(empty)) + m.SetSelectors(GenerateSelectors(empty)) + m.SetReplicas(GenerateReplicas(empty)) + + return m +} + +func GenerateAttribute(empty bool) *netmap.Attribute { + m := new(netmap.Attribute) + + if !empty { + m.SetKey("attribute key") + m.SetValue("attribute val") + } + + return m +} + +func GenerateAttributes(empty bool) (res []*netmap.Attribute) { + if !empty { + res = append(res, + GenerateAttribute(false), + GenerateAttribute(false), + ) + } + + return +} + +func GenerateNodeInfo(empty bool) *netmap.NodeInfo { + m := new(netmap.NodeInfo) + + if !empty { + m.SetAddress("node address") + m.SetPublicKey([]byte{1, 2, 3}) + m.SetState(33) + } + + m.SetAttributes(GenerateAttributes(empty)) + + return m +} + +func GenerateLocalNodeInfoRequestBody(empty bool) *netmap.LocalNodeInfoRequestBody { + m := new(netmap.LocalNodeInfoRequestBody) + + return m +} + +func GenerateLocalNodeInfoRequest(empty bool) *netmap.LocalNodeInfoRequest { + m := new(netmap.LocalNodeInfoRequest) + + m.SetBody(GenerateLocalNodeInfoRequestBody(empty)) + m.SetMetaHeader(sessiontest.GenerateRequestMetaHeader(empty)) + m.SetVerificationHeader(sessiontest.GenerateRequestVerificationHeader(empty)) + + return m +} + +func GenerateLocalNodeInfoResponseBody(empty bool) *netmap.LocalNodeInfoResponseBody { + m := new(netmap.LocalNodeInfoResponseBody) + + m.SetVersion(refstest.GenerateVersion(empty)) + m.SetNodeInfo(GenerateNodeInfo(empty)) + + return m +} + +func GenerateLocalNodeInfoResponse(empty bool) *netmap.LocalNodeInfoResponse { + m := new(netmap.LocalNodeInfoResponse) + + m.SetBody(GenerateLocalNodeInfoResponseBody(empty)) + m.SetMetaHeader(sessiontest.GenerateResponseMetaHeader(empty)) + m.SetVerificationHeader(sessiontest.GenerateResponseVerificationHeader(empty)) + + return m +} + +func GenerateNetworkInfo(empty bool) *netmap.NetworkInfo { + m := new(netmap.NetworkInfo) + + if !empty { + m.SetMagicNumber(228) + m.SetCurrentEpoch(666) + } + + return m +} + +func GenerateNetworkInfoRequestBody(empty bool) *netmap.NetworkInfoRequestBody { + m := new(netmap.NetworkInfoRequestBody) + + return m +} + +func GenerateNetworkInfoRequest(empty bool) *netmap.NetworkInfoRequest { + m := new(netmap.NetworkInfoRequest) + + m.SetBody(GenerateNetworkInfoRequestBody(empty)) + m.SetMetaHeader(sessiontest.GenerateRequestMetaHeader(empty)) + m.SetVerificationHeader(sessiontest.GenerateRequestVerificationHeader(empty)) + + return m +} + +func GenerateNetworkInfoResponseBody(empty bool) *netmap.NetworkInfoResponseBody { + m := new(netmap.NetworkInfoResponseBody) + + m.SetNetworkInfo(GenerateNetworkInfo(empty)) + + return m +} + +func GenerateNetworkInfoResponse(empty bool) *netmap.NetworkInfoResponse { + m := new(netmap.NetworkInfoResponse) + + m.SetBody(GenerateNetworkInfoResponseBody(empty)) + m.SetMetaHeader(sessiontest.GenerateResponseMetaHeader(empty)) + m.SetVerificationHeader(sessiontest.GenerateResponseVerificationHeader(empty)) + + return m +} diff --git a/v2/netmap/types.go b/v2/netmap/types.go index 320384e..e67e0a6 100644 --- a/v2/netmap/types.go +++ b/v2/netmap/types.go @@ -5,6 +5,32 @@ import ( "github.com/nspcc-dev/neofs-api-go/v2/session" ) +type LocalNodeInfoRequest struct { + body *LocalNodeInfoRequestBody + + session.RequestHeaders +} + +type LocalNodeInfoResponse struct { + body *LocalNodeInfoResponseBody + + session.ResponseHeaders +} + +// NetworkInfoRequest is a structure of NetworkInfo request. +type NetworkInfoRequest struct { + body *NetworkInfoRequestBody + + session.RequestHeaders +} + +// NetworkInfoResponse is a structure of NetworkInfo response. +type NetworkInfoResponse struct { + body *NetworkInfoResponseBody + + session.ResponseHeaders +} + type Filter struct { name string key string @@ -443,32 +469,6 @@ func (l *LocalNodeInfoRequest) SetBody(body *LocalNodeInfoRequestBody) { } } -func (l *LocalNodeInfoRequest) GetMetaHeader() *session.RequestMetaHeader { - if l != nil { - return l.metaHeader - } - return nil -} - -func (l *LocalNodeInfoRequest) SetMetaHeader(metaHeader *session.RequestMetaHeader) { - if l != nil { - l.metaHeader = metaHeader - } -} - -func (l *LocalNodeInfoRequest) GetVerificationHeader() *session.RequestVerificationHeader { - if l != nil { - return l.verifyHeader - } - return nil -} - -func (l *LocalNodeInfoRequest) SetVerificationHeader(verifyHeader *session.RequestVerificationHeader) { - if l != nil { - l.verifyHeader = verifyHeader - } -} - func (l *LocalNodeInfoResponse) GetBody() *LocalNodeInfoResponseBody { if l != nil { return l.body @@ -482,32 +482,6 @@ func (l *LocalNodeInfoResponse) SetBody(body *LocalNodeInfoResponseBody) { } } -func (l *LocalNodeInfoResponse) GetMetaHeader() *session.ResponseMetaHeader { - if l != nil { - return l.metaHeader - } - return nil -} - -func (l *LocalNodeInfoResponse) SetMetaHeader(metaHeader *session.ResponseMetaHeader) { - if l != nil { - l.metaHeader = metaHeader - } -} - -func (l *LocalNodeInfoResponse) GetVerificationHeader() *session.ResponseVerificationHeader { - if l != nil { - return l.verifyHeader - } - return nil -} - -func (l *LocalNodeInfoResponse) SetVerificationHeader(verifyHeader *session.ResponseVerificationHeader) { - if l != nil { - l.verifyHeader = verifyHeader - } -} - // NetworkInfo groups information about // NeoFS network. type NetworkInfo struct { @@ -583,32 +557,6 @@ func (l *NetworkInfoRequest) SetBody(body *NetworkInfoRequestBody) { } } -func (l *NetworkInfoRequest) GetMetaHeader() *session.RequestMetaHeader { - if l != nil { - return l.metaHeader - } - return nil -} - -func (l *NetworkInfoRequest) SetMetaHeader(metaHeader *session.RequestMetaHeader) { - if l != nil { - l.metaHeader = metaHeader - } -} - -func (l *NetworkInfoRequest) GetVerificationHeader() *session.RequestVerificationHeader { - if l != nil { - return l.verifyHeader - } - return nil -} - -func (l *NetworkInfoRequest) SetVerificationHeader(verifyHeader *session.RequestVerificationHeader) { - if l != nil { - l.verifyHeader = verifyHeader - } -} - func (l *NetworkInfoResponse) GetBody() *NetworkInfoResponseBody { if l != nil { return l.body @@ -621,29 +569,3 @@ func (l *NetworkInfoResponse) SetBody(body *NetworkInfoResponseBody) { l.body = body } } - -func (l *NetworkInfoResponse) GetMetaHeader() *session.ResponseMetaHeader { - if l != nil { - return l.metaHeader - } - return nil -} - -func (l *NetworkInfoResponse) SetMetaHeader(metaHeader *session.ResponseMetaHeader) { - if l != nil { - l.metaHeader = metaHeader - } -} - -func (l *NetworkInfoResponse) GetVerificationHeader() *session.ResponseVerificationHeader { - if l != nil { - return l.verifyHeader - } - return nil -} - -func (l *NetworkInfoResponse) SetVerificationHeader(verifyHeader *session.ResponseVerificationHeader) { - if l != nil { - l.verifyHeader = verifyHeader - } -} diff --git a/v2/object/client.go b/v2/object/client.go deleted file mode 100644 index 0287090..0000000 --- a/v2/object/client.go +++ /dev/null @@ -1,408 +0,0 @@ -package object - -import ( - "context" - - "github.com/nspcc-dev/neofs-api-go/v2/client" - object "github.com/nspcc-dev/neofs-api-go/v2/object/grpc" - "github.com/pkg/errors" - "google.golang.org/grpc" -) - -// Client represents universal object -// transport client. -type Client struct { - getClient *getObjectClient - - putClient *putObjectClient - - headClient *headObjectClient - - searchClient *searchObjectClient - - deleteClient *deleteObjectClient - - getRangeClient *getRangeObjectClient - - getRangeHashClient *getRangeHashObjectClient -} - -// Option represents Client option. -type Option func(*cfg) - -type cfg struct { - proto client.Protocol - - globalOpts []client.Option - - gRPC cfgGRPC -} - -type cfgGRPC struct { - serviceClient object.ObjectServiceClient - - grpcCallOpts []grpc.CallOption - - callOpts []object.Option - - client *object.Client -} - -// types of upper level sub-clients, accessed directly from object.Client -type ( - getObjectClient struct { - streamClientGetter func(context.Context, *GetRequest) (interface{}, error) - - streamerConstructor func(interface{}) (GetObjectStreamer, error) - } - - putObjectClient struct { - streamClientGetter func(context.Context) (interface{}, error) - - streamerConstructor func(interface{}) (PutObjectStreamer, error) - } - - headObjectClient struct { - requestConverter func(request *HeadRequest) interface{} - - caller func(context.Context, interface{}) (interface{}, error) - - responseConverter func(interface{}) *HeadResponse - } - - deleteObjectClient struct { - requestConverter func(request *DeleteRequest) interface{} - - caller func(context.Context, interface{}) (interface{}, error) - - responseConverter func(interface{}) *DeleteResponse - } - - searchObjectClient struct { - streamClientGetter func(context.Context, *SearchRequest) (interface{}, error) - - streamerConstructor func(interface{}) (SearchObjectStreamer, error) - } - - getRangeObjectClient struct { - streamClientGetter func(context.Context, *GetRangeRequest) (interface{}, error) - - streamerConstructor func(interface{}) (GetRangeObjectStreamer, error) - } - - getRangeHashObjectClient struct { - requestConverter func(request *GetRangeHashRequest) interface{} - - caller func(context.Context, interface{}) (interface{}, error) - - responseConverter func(interface{}) *GetRangeHashResponse - } -) - -func (c *Client) Get(ctx context.Context, req *GetRequest) (GetObjectStreamer, error) { - cli, err := c.getClient.streamClientGetter(ctx, req) - if err != nil { - return nil, errors.Wrap(err, "could not send get object request") - } - - return c.getClient.streamerConstructor(cli) -} - -func (c *Client) Put(ctx context.Context) (PutObjectStreamer, error) { - cli, err := c.putClient.streamClientGetter(ctx) - if err != nil { - return nil, errors.Wrap(err, "could not prepare put object streamer") - } - - return c.putClient.streamerConstructor(cli) -} - -func (c *Client) Head(ctx context.Context, req *HeadRequest) (*HeadResponse, error) { - resp, err := c.headClient.caller(ctx, c.headClient.requestConverter(req)) - if err != nil { - return nil, errors.Wrap(err, "could not send head object request") - } - - return c.headClient.responseConverter(resp), nil -} - -func (c *Client) Search(ctx context.Context, req *SearchRequest) (SearchObjectStreamer, error) { - cli, err := c.searchClient.streamClientGetter(ctx, req) - if err != nil { - return nil, err - } - - return c.searchClient.streamerConstructor(cli) -} - -func (c *Client) Delete(ctx context.Context, req *DeleteRequest) (*DeleteResponse, error) { - resp, err := c.deleteClient.caller(ctx, c.deleteClient.requestConverter(req)) - if err != nil { - return nil, errors.Wrap(err, "could not send delete object request") - } - - return c.deleteClient.responseConverter(resp), nil -} - -func (c *Client) GetRange(ctx context.Context, req *GetRangeRequest) (GetRangeObjectStreamer, error) { - cli, err := c.getRangeClient.streamClientGetter(ctx, req) - if err != nil { - return nil, errors.Wrap(err, "could not send get object range request") - } - - return c.getRangeClient.streamerConstructor(cli) -} - -func (c *Client) GetRangeHash(ctx context.Context, req *GetRangeHashRequest) (*GetRangeHashResponse, error) { - resp, err := c.getRangeHashClient.caller(ctx, c.getRangeHashClient.requestConverter(req)) - if err != nil { - return nil, errors.Wrap(err, "could not send get object range hash request") - } - - return c.getRangeHashClient.responseConverter(resp), nil -} - -func defaultCfg() *cfg { - return &cfg{ - proto: client.ProtoGRPC, - } -} - -func NewClient(opts ...Option) (*Client, error) { - cfg := defaultCfg() - - for i := range opts { - opts[i](cfg) - } - - var err error - - switch cfg.proto { - case client.ProtoGRPC: - var c *object.Client - if c, err = newGRPCClient(cfg); err != nil { - break - } - - return &Client{ - getClient: newGRPCGetClient(c), - putClient: newGRPCPutClient(c), - headClient: newGRPCHeadClient(c), - searchClient: newGRPCSearchClient(c), - deleteClient: newGRPCDeleteClient(c), - getRangeClient: newGRPCGetRangeClient(c), - getRangeHashClient: newGRPCGetRangeHashClient(c), - }, nil - default: - err = client.ErrProtoUnsupported - } - - return nil, errors.Wrapf(err, "could not create %s object client", cfg.proto) -} - -func newGRPCClient(cfg *cfg) (*object.Client, error) { - var err error - - if cfg.gRPC.client == nil { - if cfg.gRPC.serviceClient == nil { - conn, err := client.NewGRPCClientConn(cfg.globalOpts...) - if err != nil { - return nil, errors.Wrap(err, "could not open gRPC getClient connection") - } - - cfg.gRPC.serviceClient = object.NewObjectServiceClient(conn) - } - - cfg.gRPC.client, err = object.NewClient( - cfg.gRPC.serviceClient, - append( - cfg.gRPC.callOpts, - object.WithCallOptions(cfg.gRPC.grpcCallOpts), - )..., - ) - } - - return cfg.gRPC.client, err -} - -func newGRPCGetClient(c *object.Client) *getObjectClient { - cli := &getObjectClient{ - streamClientGetter: func(ctx context.Context, request *GetRequest) (interface{}, error) { - return c.Get(ctx, GetRequestToGRPCMessage(request)) - }, - streamerConstructor: func(i interface{}) (GetObjectStreamer, error) { - cli, ok := i.(object.ObjectService_GetClient) - if !ok { - return nil, errors.New("can't convert interface to grpc get getClient") - } - return &getObjectGRPCStream{ - recv: func() (*GetResponse, error) { - resp, err := cli.Recv() - if err != nil { - return nil, err - } - - return GetResponseFromGRPCMessage(resp), nil - }, - }, nil - }, - } - - return cli -} - -func newGRPCPutClient(c *object.Client) *putObjectClient { - cli := &putObjectClient{ - streamClientGetter: func(ctx context.Context) (interface{}, error) { - return c.Put(ctx) - }, - streamerConstructor: func(i interface{}) (PutObjectStreamer, error) { - cli, ok := i.(object.ObjectService_PutClient) - if !ok { - return nil, errors.New("can't convert interface to grpc get getClient") - } - - return &putObjectGRPCStream{ - send: func(request *PutRequest) error { - return cli.Send(PutRequestToGRPCMessage(request)) - }, - closeAndRecv: func() (*PutResponse, error) { - resp, err := cli.CloseAndRecv() - if err != nil { - return nil, err - } - - return PutResponseFromGRPCMessage(resp), nil - }, - }, nil - }, - } - - return cli -} - -func newGRPCHeadClient(c *object.Client) *headObjectClient { - return &headObjectClient{ - requestConverter: func(req *HeadRequest) interface{} { - return HeadRequestToGRPCMessage(req) - }, - caller: func(ctx context.Context, req interface{}) (interface{}, error) { - return c.Head(ctx, req.(*object.HeadRequest)) - }, - responseConverter: func(resp interface{}) *HeadResponse { - return HeadResponseFromGRPCMessage(resp.(*object.HeadResponse)) - }, - } -} - -func newGRPCSearchClient(c *object.Client) *searchObjectClient { - cli := &searchObjectClient{ - streamClientGetter: func(ctx context.Context, request *SearchRequest) (interface{}, error) { - return c.Search(ctx, SearchRequestToGRPCMessage(request)) - }, - streamerConstructor: func(i interface{}) (SearchObjectStreamer, error) { - cli, ok := i.(object.ObjectService_SearchClient) - if !ok { - return nil, errors.New("can't convert interface to grpc get getClient") - } - return &searchObjectGRPCStream{ - recv: func() (*SearchResponse, error) { - resp, err := cli.Recv() - if err != nil { - return nil, err - } - - return SearchResponseFromGRPCMessage(resp), nil - }, - }, nil - }, - } - - return cli -} - -func newGRPCDeleteClient(c *object.Client) *deleteObjectClient { - return &deleteObjectClient{ - requestConverter: func(req *DeleteRequest) interface{} { - return DeleteRequestToGRPCMessage(req) - }, - caller: func(ctx context.Context, req interface{}) (interface{}, error) { - return c.Delete(ctx, req.(*object.DeleteRequest)) - }, - responseConverter: func(resp interface{}) *DeleteResponse { - return DeleteResponseFromGRPCMessage(resp.(*object.DeleteResponse)) - }, - } -} - -func newGRPCGetRangeClient(c *object.Client) *getRangeObjectClient { - cli := &getRangeObjectClient{ - streamClientGetter: func(ctx context.Context, request *GetRangeRequest) (interface{}, error) { - return c.GetRange(ctx, GetRangeRequestToGRPCMessage(request)) - }, - streamerConstructor: func(i interface{}) (GetRangeObjectStreamer, error) { - cli, ok := i.(object.ObjectService_GetRangeClient) - if !ok { - return nil, errors.New("can't convert interface to grpc get getClient") - } - return &getRangeObjectGRPCStream{ - recv: func() (*GetRangeResponse, error) { - resp, err := cli.Recv() - if err != nil { - return nil, err - } - - return GetRangeResponseFromGRPCMessage(resp), nil - }, - }, nil - }, - } - - return cli -} - -func newGRPCGetRangeHashClient(c *object.Client) *getRangeHashObjectClient { - return &getRangeHashObjectClient{ - requestConverter: func(req *GetRangeHashRequest) interface{} { - return GetRangeHashRequestToGRPCMessage(req) - }, - caller: func(ctx context.Context, req interface{}) (interface{}, error) { - return c.GetRangeHash(ctx, req.(*object.GetRangeHashRequest)) - }, - responseConverter: func(resp interface{}) *GetRangeHashResponse { - return GetRangeHashResponseFromGRPCMessage(resp.(*object.GetRangeHashResponse)) - }, - } -} - -func WithGlobalOpts(v ...client.Option) Option { - return func(c *cfg) { - if len(v) > 0 { - c.globalOpts = v - } - } -} - -func WithGRPCServiceClient(v object.ObjectServiceClient) Option { - return func(c *cfg) { - c.gRPC.serviceClient = v - } -} - -func WithGRPCCallOpts(v []grpc.CallOption) Option { - return func(c *cfg) { - c.gRPC.grpcCallOpts = v - } -} - -func WithGRPCClientOpts(v []object.Option) Option { - return func(c *cfg) { - c.gRPC.callOpts = v - } -} - -func WithGRPCClient(v *object.Client) Option { - return func(c *cfg) { - c.gRPC.client = v - } -} diff --git a/v2/object/client_stream.go b/v2/object/client_stream.go deleted file mode 100644 index ea9dc98..0000000 --- a/v2/object/client_stream.go +++ /dev/null @@ -1,60 +0,0 @@ -package object - -type ( - GetObjectStreamer interface { - Recv() (*GetResponse, error) - } - - PutObjectStreamer interface { - Send(*PutRequest) error - CloseAndRecv() (*PutResponse, error) - } - - SearchObjectStreamer interface { - Recv() (*SearchResponse, error) - } - - GetRangeObjectStreamer interface { - Recv() (*GetRangeResponse, error) - } -) - -type ( - getObjectGRPCStream struct { - recv func() (*GetResponse, error) - } - - putObjectGRPCStream struct { - send func(*PutRequest) error - - closeAndRecv func() (*PutResponse, error) - } - - searchObjectGRPCStream struct { - recv func() (*SearchResponse, error) - } - - getRangeObjectGRPCStream struct { - recv func() (*GetRangeResponse, error) - } -) - -func (s *getObjectGRPCStream) Recv() (*GetResponse, error) { - return s.recv() -} - -func (p *putObjectGRPCStream) Send(request *PutRequest) error { - return p.send(request) -} - -func (p *putObjectGRPCStream) CloseAndRecv() (*PutResponse, error) { - return p.closeAndRecv() -} - -func (s *searchObjectGRPCStream) Recv() (*SearchResponse, error) { - return s.recv() -} - -func (r *getRangeObjectGRPCStream) Recv() (*GetRangeResponse, error) { - return r.recv() -} diff --git a/v2/object/convert.go b/v2/object/convert.go index 88b0e0e..96b1b5b 100644 --- a/v2/object/convert.go +++ b/v2/object/convert.go @@ -3,10 +3,14 @@ package object import ( "fmt" + "github.com/nspcc-dev/neofs-api-go/rpc/grpc" + "github.com/nspcc-dev/neofs-api-go/rpc/message" object "github.com/nspcc-dev/neofs-api-go/v2/object/grpc" "github.com/nspcc-dev/neofs-api-go/v2/refs" refsGRPC "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" "github.com/nspcc-dev/neofs-api-go/v2/session" + sessionGRPC "github.com/nspcc-dev/neofs-api-go/v2/session/grpc" + "github.com/pkg/errors" ) func TypeToGRPCField(t Type) object.ObjectType { @@ -25,1636 +29,2020 @@ func MatchTypeFromGRPCField(t object.MatchType) MatchType { return MatchType(t) } -func ShortHeaderToGRPCMessage(h *ShortHeader) *object.ShortHeader { - if h == nil { - return nil - } - - m := new(object.ShortHeader) - - m.SetVersion( - refs.VersionToGRPCMessage(h.GetVersion()), - ) - - m.SetCreationEpoch(h.GetCreationEpoch()) - - m.SetOwnerId( - refs.OwnerIDToGRPCMessage(h.GetOwnerID()), - ) - - m.SetObjectType( - TypeToGRPCField(h.GetObjectType()), - ) - - m.SetPayloadLength(h.GetPayloadLength()) - - m.SetPayloadHash( - refs.ChecksumToGRPCMessage(h.GetPayloadHash()), - ) - - m.SetHomomorphicHash( - refs.ChecksumToGRPCMessage(h.GetHomomorphicHash()), - ) - - return m -} - -func ShortHeaderFromGRPCMessage(m *object.ShortHeader) *ShortHeader { - if m == nil { - return nil - } - - h := new(ShortHeader) - - h.SetVersion( - refs.VersionFromGRPCMessage(m.GetVersion()), - ) - - h.SetCreationEpoch(m.GetCreationEpoch()) - - h.SetOwnerID( - refs.OwnerIDFromGRPCMessage(m.GetOwnerId()), - ) - - h.SetObjectType( - TypeFromGRPCField(m.GetObjectType()), - ) - - h.SetPayloadLength(m.GetPayloadLength()) - - h.SetPayloadHash( - refs.ChecksumFromGRPCMessage(m.GetPayloadHash()), - ) - - h.SetHomomorphicHash( - refs.ChecksumFromGRPCMessage(m.GetHomomorphicHash()), - ) - - return h -} - -func AttributeToGRPCMessage(a *Attribute) *object.Header_Attribute { - if a == nil { - return nil - } - - m := new(object.Header_Attribute) - - m.SetKey(a.GetKey()) - m.SetValue(a.GetValue()) - - return m -} - -func AttributeFromGRPCMessage(m *object.Header_Attribute) *Attribute { - if m == nil { - return nil - } - - h := new(Attribute) - - h.SetKey(m.GetKey()) - h.SetValue(m.GetValue()) - - return h -} - -func SplitHeaderToGRPCMessage(h *SplitHeader) *object.Header_Split { - if h == nil { - return nil - } - - m := new(object.Header_Split) - - m.SetParent( - refs.ObjectIDToGRPCMessage(h.GetParent()), - ) - - m.SetPrevious( - refs.ObjectIDToGRPCMessage(h.GetPrevious()), - ) - - m.SetParentSignature( - refs.SignatureToGRPCMessage(h.GetParentSignature()), - ) - - m.SetParentHeader( - HeaderToGRPCMessage(h.GetParentHeader()), - ) - - children := h.GetChildren() - childMsg := make([]*refsGRPC.ObjectID, 0, len(children)) - - for i := range children { - childMsg = append(childMsg, refs.ObjectIDToGRPCMessage(children[i])) - } - - m.SetChildren(childMsg) - - m.SetSplitId(h.GetSplitID()) - - return m -} - -func SplitHeaderFromGRPCMessage(m *object.Header_Split) *SplitHeader { - if m == nil { - return nil - } - - h := new(SplitHeader) - - h.SetParent( - refs.ObjectIDFromGRPCMessage(m.GetParent()), - ) - - h.SetPrevious( - refs.ObjectIDFromGRPCMessage(m.GetPrevious()), - ) - - h.SetParentSignature( - refs.SignatureFromGRPCMessage(m.GetParentSignature()), - ) - - h.SetParentHeader( - HeaderFromGRPCMessage(m.GetParentHeader()), - ) - - childMsg := m.GetChildren() - children := make([]*refs.ObjectID, 0, len(childMsg)) - - for i := range childMsg { - children = append(children, refs.ObjectIDFromGRPCMessage(childMsg[i])) - } - - h.SetChildren(children) - - h.SetSplitID(m.GetSplitId()) - - return h -} - -func HeaderToGRPCMessage(h *Header) *object.Header { - if h == nil { - return nil - } - - m := new(object.Header) - - m.SetVersion( - refs.VersionToGRPCMessage(h.GetVersion()), - ) - - m.SetContainerId( - refs.ContainerIDToGRPCMessage(h.GetContainerID()), - ) - - m.SetOwnerId( - refs.OwnerIDToGRPCMessage(h.GetOwnerID()), - ) - - m.SetCreationEpoch(h.GetCreationEpoch()) - - m.SetPayloadLength(h.GetPayloadLength()) - - m.SetPayloadHash( - refs.ChecksumToGRPCMessage(h.GetPayloadHash()), - ) - - m.SetHomomorphicHash( - refs.ChecksumToGRPCMessage(h.GetHomomorphicHash()), - ) - - m.SetObjectType( - TypeToGRPCField(h.GetObjectType()), - ) - - m.SetSessionToken( - session.SessionTokenToGRPCMessage(h.GetSessionToken()), - ) - - attr := h.GetAttributes() - attrMsg := make([]*object.Header_Attribute, 0, len(attr)) - - for i := range attr { - attrMsg = append(attrMsg, AttributeToGRPCMessage(attr[i])) - } - - m.SetAttributes(attrMsg) - - m.SetSplit( - SplitHeaderToGRPCMessage(h.GetSplit()), - ) - - return m -} - -func HeaderFromGRPCMessage(m *object.Header) *Header { - if m == nil { - return nil - } - - h := new(Header) - - h.SetVersion( - refs.VersionFromGRPCMessage(m.GetVersion()), - ) - - h.SetContainerID( - refs.ContainerIDFromGRPCMessage(m.GetContainerId()), - ) - - h.SetOwnerID( - refs.OwnerIDFromGRPCMessage(m.GetOwnerId()), - ) - - h.SetCreationEpoch(m.GetCreationEpoch()) - - h.SetPayloadLength(m.GetPayloadLength()) - - h.SetPayloadHash( - refs.ChecksumFromGRPCMessage(m.GetPayloadHash()), - ) - - h.SetHomomorphicHash( - refs.ChecksumFromGRPCMessage(m.GetHomomorphicHash()), - ) - - h.SetObjectType( - TypeFromGRPCField(m.GetObjectType()), - ) - - h.SetSessionToken( - session.SessionTokenFromGRPCMessage(m.GetSessionToken()), - ) - - attrMsg := m.GetAttributes() - attr := make([]*Attribute, 0, len(attrMsg)) - - for i := range attrMsg { - attr = append(attr, AttributeFromGRPCMessage(attrMsg[i])) - } - - h.SetAttributes(attr) - - h.SetSplit( - SplitHeaderFromGRPCMessage(m.GetSplit()), - ) - - return h -} - -func HeaderWithSignatureToGRPCMessage(h *HeaderWithSignature) *object.HeaderWithSignature { - if h == nil { - return nil - } - - m := new(object.HeaderWithSignature) - - m.SetHeader( - HeaderToGRPCMessage(h.GetHeader()), - ) - - m.SetSignature( - refs.SignatureToGRPCMessage(h.GetSignature()), - ) - - return m -} - -func HeaderWithSignatureFromGRPCMessage(m *object.HeaderWithSignature) *HeaderWithSignature { - if m == nil { - return nil - } - - h := new(HeaderWithSignature) - - h.SetHeader( - HeaderFromGRPCMessage(m.GetHeader()), - ) - - h.SetSignature( - refs.SignatureFromGRPCMessage(m.GetSignature()), - ) - - return h -} - -func ObjectToGRPCMessage(o *Object) *object.Object { - if o == nil { - return nil - } - - m := new(object.Object) - - m.SetObjectId( - refs.ObjectIDToGRPCMessage(o.GetObjectID()), - ) - - m.SetSignature( - refs.SignatureToGRPCMessage(o.GetSignature()), - ) - - m.SetHeader( - HeaderToGRPCMessage(o.GetHeader()), - ) - - m.SetPayload(o.GetPayload()) - - return m -} - -func ObjectFromGRPCMessage(m *object.Object) *Object { - if m == nil { - return nil - } - - o := new(Object) - - o.SetObjectID( - refs.ObjectIDFromGRPCMessage(m.GetObjectId()), - ) - - o.SetSignature( - refs.SignatureFromGRPCMessage(m.GetSignature()), - ) - - o.SetHeader( - HeaderFromGRPCMessage(m.GetHeader()), - ) - - o.SetPayload(m.GetPayload()) - - return o -} - -func SplitInfoToGRPCMessage(s *SplitInfo) *object.SplitInfo { - if s == nil { - return nil - } - - m := new(object.SplitInfo) - - m.SetSplitId(s.GetSplitID()) - - m.SetLastPart( - refs.ObjectIDToGRPCMessage(s.GetLastPart()), - ) - - m.SetLink( - refs.ObjectIDToGRPCMessage(s.GetLink()), - ) - - return m -} - -func SplitInfoFromGRPCMessage(m *object.SplitInfo) *SplitInfo { - if m == nil { - return nil - } - - r := new(SplitInfo) - - r.SetSplitID(m.GetSplitId()) - - r.SetLastPart( - refs.ObjectIDFromGRPCMessage(m.GetLastPart()), - ) - - r.SetLink( - refs.ObjectIDFromGRPCMessage(m.GetLink()), - ) - - return r -} - -func GetRequestBodyToGRPCMessage(r *GetRequestBody) *object.GetRequest_Body { - if r == nil { - return nil - } - - m := new(object.GetRequest_Body) - - m.SetAddress( - refs.AddressToGRPCMessage(r.GetAddress()), - ) - - m.SetRaw(r.GetRaw()) - - return m -} - -func GetRequestBodyFromGRPCMessage(m *object.GetRequest_Body) *GetRequestBody { - if m == nil { - return nil - } - - r := new(GetRequestBody) - - r.SetAddress( - refs.AddressFromGRPCMessage(m.GetAddress()), - ) - - r.SetRaw(m.GetRaw()) - - return r -} - -func GetRequestToGRPCMessage(r *GetRequest) *object.GetRequest { - if r == nil { - return nil - } - - m := new(object.GetRequest) - - m.SetBody( - GetRequestBodyToGRPCMessage(r.GetBody()), - ) - - session.RequestHeadersToGRPC(r, m) - - return m -} - -func GetRequestFromGRPCMessage(m *object.GetRequest) *GetRequest { - if m == nil { - return nil - } - - r := new(GetRequest) - - r.SetBody( - GetRequestBodyFromGRPCMessage(m.GetBody()), - ) - - session.RequestHeadersFromGRPC(m, r) - - return r -} - -func GetObjectPartInitToGRPCMessage(r *GetObjectPartInit) *object.GetResponse_Body_Init { - if r == nil { - return nil - } - - m := new(object.GetResponse_Body_Init) - - m.SetObjectId( - refs.ObjectIDToGRPCMessage(r.GetObjectID()), - ) - - m.SetSignature( - refs.SignatureToGRPCMessage(r.GetSignature()), - ) - - m.SetHeader( - HeaderToGRPCMessage(r.GetHeader()), - ) - - return m -} - -func GetObjectPartInitFromGRPCMessage(m *object.GetResponse_Body_Init) *GetObjectPartInit { - if m == nil { - return nil - } - - r := new(GetObjectPartInit) - - r.SetObjectID( - refs.ObjectIDFromGRPCMessage(m.GetObjectId()), - ) - - r.SetSignature( - refs.SignatureFromGRPCMessage(m.GetSignature()), - ) - - r.SetHeader( - HeaderFromGRPCMessage(m.GetHeader()), - ) - - return r -} - -func GetObjectPartChunkToGRPCMessage(r *GetObjectPartChunk) *object.GetResponse_Body_Chunk { - if r == nil { - return nil - } - - m := new(object.GetResponse_Body_Chunk) - - m.SetChunk(r.GetChunk()) - - return m -} - -func GetObjectPartChunkFromGRPCMessage(m *object.GetResponse_Body_Chunk) *GetObjectPartChunk { - if m == nil { - return nil - } - - r := new(GetObjectPartChunk) - - r.SetChunk(m.GetChunk()) - - return r -} - -func GetResponseBodyToGRPCMessage(r *GetResponseBody) *object.GetResponse_Body { - if r == nil { - return nil - } - - m := new(object.GetResponse_Body) - - switch v := r.GetObjectPart(); t := v.(type) { - case nil: - case *GetObjectPartInit: - m.SetInit( - GetObjectPartInitToGRPCMessage(t), - ) - case *GetObjectPartChunk: - m.SetChunk( - GetObjectPartChunkToGRPCMessage(t), - ) - case *SplitInfo: - m.SetSplitInfo( - SplitInfoToGRPCMessage(t), - ) - default: - panic(fmt.Sprintf("unknown object part %T", t)) +func (h *ShortHeader) ToGRPCMessage() grpc.Message { + var m *object.ShortHeader + + if h != nil { + m = new(object.ShortHeader) + + m.SetVersion(h.version.ToGRPCMessage().(*refsGRPC.Version)) + m.SetOwnerId(h.ownerID.ToGRPCMessage().(*refsGRPC.OwnerID)) + m.SetHomomorphicHash(h.homoHash.ToGRPCMessage().(*refsGRPC.Checksum)) + m.SetPayloadHash(h.payloadHash.ToGRPCMessage().(*refsGRPC.Checksum)) + m.SetObjectType(TypeToGRPCField(h.typ)) + m.SetCreationEpoch(h.creatEpoch) + m.SetPayloadLength(h.payloadLen) } return m } -func GetResponseBodyFromGRPCMessage(m *object.GetResponse_Body) *GetResponseBody { - if m == nil { - return nil +func (h *ShortHeader) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.ShortHeader) + if !ok { + return message.NewUnexpectedMessageType(m, v) } - r := new(GetResponseBody) + var err error - switch v := m.GetObjectPart().(type) { + version := v.GetVersion() + if version == nil { + h.version = nil + } else { + if h.version == nil { + h.version = new(refs.Version) + } + + err = h.version.FromGRPCMessage(version) + if err != nil { + return err + } + } + + ownerID := v.GetOwnerId() + if ownerID == nil { + h.ownerID = nil + } else { + if h.ownerID == nil { + h.ownerID = new(refs.OwnerID) + } + + err = h.ownerID.FromGRPCMessage(ownerID) + if err != nil { + return err + } + } + + homoHash := v.GetHomomorphicHash() + if homoHash == nil { + h.homoHash = nil + } else { + if h.homoHash == nil { + h.homoHash = new(refs.Checksum) + } + + err = h.homoHash.FromGRPCMessage(homoHash) + if err != nil { + return err + } + } + + payloadHash := v.GetPayloadHash() + if payloadHash == nil { + h.payloadHash = nil + } else { + if h.payloadHash == nil { + h.payloadHash = new(refs.Checksum) + } + + err = h.payloadHash.FromGRPCMessage(payloadHash) + if err != nil { + return err + } + } + + h.typ = TypeFromGRPCField(v.GetObjectType()) + h.creatEpoch = v.GetCreationEpoch() + h.payloadLen = v.GetPayloadLength() + + return nil +} + +func (a *Attribute) ToGRPCMessage() grpc.Message { + var m *object.Header_Attribute + + if a != nil { + m = new(object.Header_Attribute) + + m.SetKey(a.key) + m.SetValue(a.val) + } + + return m +} + +func (a *Attribute) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.Header_Attribute) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + a.key = v.GetKey() + a.val = v.GetValue() + + return nil +} + +func AttributesToGRPC(xs []*Attribute) (res []*object.Header_Attribute) { + if xs != nil { + res = make([]*object.Header_Attribute, 0, len(xs)) + + for i := range xs { + res = append(res, xs[i].ToGRPCMessage().(*object.Header_Attribute)) + } + } + + return +} + +func AttributesFromGRPC(xs []*object.Header_Attribute) (res []*Attribute, err error) { + if xs != nil { + res = make([]*Attribute, 0, len(xs)) + + for i := range xs { + var x *Attribute + + if xs[i] != nil { + x = new(Attribute) + + err = x.FromGRPCMessage(xs[i]) + if err != nil { + return + } + } + + res = append(res, x) + } + } + + return +} + +func (h *SplitHeader) ToGRPCMessage() grpc.Message { + var m *object.Header_Split + + if h != nil { + m = new(object.Header_Split) + + m.SetParent(h.par.ToGRPCMessage().(*refsGRPC.ObjectID)) + m.SetPrevious(h.prev.ToGRPCMessage().(*refsGRPC.ObjectID)) + m.SetParentHeader(h.parHdr.ToGRPCMessage().(*object.Header)) + m.SetParentSignature(h.parSig.ToGRPCMessage().(*refsGRPC.Signature)) + m.SetChildren(refs.ObjectIDListToGRPCMessage(h.children)) + m.SetSplitId(h.splitID) + } + + return m +} + +func (h *SplitHeader) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.Header_Split) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + par := v.GetParent() + if par == nil { + h.par = nil + } else { + if h.par == nil { + h.par = new(refs.ObjectID) + } + + err = h.par.FromGRPCMessage(par) + if err != nil { + return err + } + } + + prev := v.GetPrevious() + if prev == nil { + h.prev = nil + } else { + if h.prev == nil { + h.prev = new(refs.ObjectID) + } + + err = h.prev.FromGRPCMessage(prev) + if err != nil { + return err + } + } + + parHdr := v.GetParentHeader() + if parHdr == nil { + h.parHdr = nil + } else { + if h.parHdr == nil { + h.parHdr = new(Header) + } + + err = h.parHdr.FromGRPCMessage(parHdr) + if err != nil { + return err + } + } + + parSig := v.GetParentSignature() + if parSig == nil { + h.parSig = nil + } else { + if h.parSig == nil { + h.parSig = new(refs.Signature) + } + + err = h.parSig.FromGRPCMessage(parSig) + if err != nil { + return err + } + } + + h.children, err = refs.ObjectIDListFromGRPCMessage(v.GetChildren()) + if err != nil { + return err + } + + h.splitID = v.GetSplitId() + + return nil +} + +func (h *Header) ToGRPCMessage() grpc.Message { + var m *object.Header + + if h != nil { + m = new(object.Header) + + m.SetVersion(h.version.ToGRPCMessage().(*refsGRPC.Version)) + m.SetPayloadHash(h.payloadHash.ToGRPCMessage().(*refsGRPC.Checksum)) + m.SetOwnerId(h.ownerID.ToGRPCMessage().(*refsGRPC.OwnerID)) + m.SetHomomorphicHash(h.homoHash.ToGRPCMessage().(*refsGRPC.Checksum)) + m.SetContainerId(h.cid.ToGRPCMessage().(*refsGRPC.ContainerID)) + m.SetSessionToken(h.sessionToken.ToGRPCMessage().(*sessionGRPC.SessionToken)) + m.SetSplit(h.split.ToGRPCMessage().(*object.Header_Split)) + m.SetAttributes(AttributesToGRPC(h.attr)) + m.SetPayloadLength(h.payloadLen) + m.SetCreationEpoch(h.creatEpoch) + m.SetObjectType(TypeToGRPCField(h.typ)) + } + + return m +} + +func (h *Header) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.Header) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + version := v.GetVersion() + if version == nil { + h.version = nil + } else { + if h.version == nil { + h.version = new(refs.Version) + } + + err = h.version.FromGRPCMessage(version) + if err != nil { + return err + } + } + + payloadHash := v.GetPayloadHash() + if payloadHash == nil { + h.payloadHash = nil + } else { + if h.payloadHash == nil { + h.payloadHash = new(refs.Checksum) + } + + err = h.payloadHash.FromGRPCMessage(payloadHash) + if err != nil { + return err + } + } + + ownerID := v.GetOwnerId() + if ownerID == nil { + h.ownerID = nil + } else { + if h.ownerID == nil { + h.ownerID = new(refs.OwnerID) + } + + err = h.ownerID.FromGRPCMessage(ownerID) + if err != nil { + return err + } + } + + homoHash := v.GetHomomorphicHash() + if homoHash == nil { + h.homoHash = nil + } else { + if h.homoHash == nil { + h.homoHash = new(refs.Checksum) + } + + err = h.homoHash.FromGRPCMessage(homoHash) + if err != nil { + return err + } + } + + cid := v.GetContainerId() + if cid == nil { + h.cid = nil + } else { + if h.cid == nil { + h.cid = new(refs.ContainerID) + } + + err = h.cid.FromGRPCMessage(cid) + if err != nil { + return err + } + } + + sessionToken := v.GetSessionToken() + if sessionToken == nil { + h.sessionToken = nil + } else { + if h.sessionToken == nil { + h.sessionToken = new(session.SessionToken) + } + + err = h.sessionToken.FromGRPCMessage(sessionToken) + if err != nil { + return err + } + } + + split := v.GetSplit() + if split == nil { + h.split = nil + } else { + if h.split == nil { + h.split = new(SplitHeader) + } + + err = h.split.FromGRPCMessage(split) + if err != nil { + return err + } + } + + h.attr, err = AttributesFromGRPC(v.GetAttributes()) + if err != nil { + return err + } + + h.payloadLen = v.GetPayloadLength() + h.creatEpoch = v.GetCreationEpoch() + h.typ = TypeFromGRPCField(v.GetObjectType()) + + return nil +} + +func (h *HeaderWithSignature) ToGRPCMessage() grpc.Message { + var m *object.HeaderWithSignature + + if h != nil { + m = new(object.HeaderWithSignature) + + m.SetSignature(h.signature.ToGRPCMessage().(*refsGRPC.Signature)) + m.SetHeader(h.header.ToGRPCMessage().(*object.Header)) + } + + return m +} + +func (h *HeaderWithSignature) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.HeaderWithSignature) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + signature := v.GetSignature() + if signature == nil { + h.signature = nil + } else { + if h.signature == nil { + h.signature = new(refs.Signature) + } + + err = h.signature.FromGRPCMessage(signature) + if err != nil { + return err + } + } + + header := v.GetHeader() + if header == nil { + h.header = nil + } else { + if h.header == nil { + h.header = new(Header) + } + + err = h.header.FromGRPCMessage(header) + } + + return err +} + +func (o *Object) ToGRPCMessage() grpc.Message { + var m *object.Object + + if o != nil { + m = new(object.Object) + + m.SetObjectId(o.objectID.ToGRPCMessage().(*refsGRPC.ObjectID)) + m.SetSignature(o.idSig.ToGRPCMessage().(*refsGRPC.Signature)) + m.SetHeader(o.header.ToGRPCMessage().(*object.Header)) + m.SetPayload(o.payload) + } + + return m +} + +func (o *Object) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.Object) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + objectID := v.GetObjectId() + if objectID == nil { + o.objectID = nil + } else { + if o.objectID == nil { + o.objectID = new(refs.ObjectID) + } + + err = o.objectID.FromGRPCMessage(objectID) + if err != nil { + return err + } + } + + idSig := v.GetSignature() + if idSig == nil { + o.idSig = nil + } else { + if o.idSig == nil { + o.idSig = new(refs.Signature) + } + + err = o.idSig.FromGRPCMessage(idSig) + if err != nil { + return err + } + } + + header := v.GetHeader() + if header == nil { + o.header = nil + } else { + if o.header == nil { + o.header = new(Header) + } + + err = o.header.FromGRPCMessage(header) + if err != nil { + return err + } + } + + o.payload = v.GetPayload() + + return nil +} + +func (s *SplitInfo) ToGRPCMessage() grpc.Message { + var m *object.SplitInfo + + if s != nil { + m = new(object.SplitInfo) + + m.SetLastPart(s.lastPart.ToGRPCMessage().(*refsGRPC.ObjectID)) + m.SetLink(s.link.ToGRPCMessage().(*refsGRPC.ObjectID)) + m.SetSplitId(s.splitID) + } + + return m +} + +func (s *SplitInfo) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.SplitInfo) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + lastPart := v.GetLastPart() + if lastPart == nil { + s.lastPart = nil + } else { + if s.lastPart == nil { + s.lastPart = new(refs.ObjectID) + } + + err = s.lastPart.FromGRPCMessage(lastPart) + if err != nil { + return err + } + } + + link := v.GetLink() + if link == nil { + s.link = nil + } else { + if s.link == nil { + s.link = new(refs.ObjectID) + } + + err = s.link.FromGRPCMessage(link) + if err != nil { + return err + } + } + + s.splitID = v.GetSplitId() + + return nil +} + +func (r *GetRequestBody) ToGRPCMessage() grpc.Message { + var m *object.GetRequest_Body + + if r != nil { + m = new(object.GetRequest_Body) + + m.SetAddress(r.addr.ToGRPCMessage().(*refsGRPC.Address)) + m.SetRaw(r.raw) + } + + return m +} + +func (r *GetRequestBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.GetRequest_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + addr := v.GetAddress() + if addr == nil { + r.addr = nil + } else { + if r.addr == nil { + r.addr = new(refs.Address) + } + + err = r.addr.FromGRPCMessage(addr) + if err != nil { + return err + } + } + + r.raw = v.GetRaw() + + return nil +} + +func (r *GetRequest) ToGRPCMessage() grpc.Message { + var m *object.GetRequest + + if r != nil { + m = new(object.GetRequest) + + m.SetBody(r.body.ToGRPCMessage().(*object.GetRequest_Body)) + r.RequestHeaders.ToMessage(m) + } + + return m +} + +func (r *GetRequest) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.GetRequest) + 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(GetRequestBody) + } + + err = r.body.FromGRPCMessage(body) + if err != nil { + return err + } + } + + return r.RequestHeaders.FromMessage(v) +} + +func (r *GetObjectPartInit) ToGRPCMessage() grpc.Message { + var m *object.GetResponse_Body_Init + + if r != nil { + m = new(object.GetResponse_Body_Init) + + m.SetObjectId(r.id.ToGRPCMessage().(*refsGRPC.ObjectID)) + m.SetSignature(r.sig.ToGRPCMessage().(*refsGRPC.Signature)) + m.SetHeader(r.hdr.ToGRPCMessage().(*object.Header)) + } + + return m +} + +func (r *GetObjectPartInit) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.GetResponse_Body_Init) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + id := v.GetObjectId() + if id == nil { + r.id = nil + } else { + if r.id == nil { + r.id = new(refs.ObjectID) + } + + err = r.id.FromGRPCMessage(id) + if err != nil { + return err + } + } + + sig := v.GetSignature() + if sig == nil { + r.sig = nil + } else { + if r.sig == nil { + r.sig = new(refs.Signature) + } + + err = r.sig.FromGRPCMessage(sig) + if err != nil { + return err + } + } + + hdr := v.GetHeader() + if hdr == nil { + r.hdr = nil + } else { + if r.hdr == nil { + r.hdr = new(Header) + } + + err = r.hdr.FromGRPCMessage(hdr) + } + + return err +} + +func (r *GetObjectPartChunk) ToGRPCMessage() grpc.Message { + var m *object.GetResponse_Body_Chunk + + if r != nil { + m = new(object.GetResponse_Body_Chunk) + + m.SetChunk(r.chunk) + } + + return m +} + +func (r *GetObjectPartChunk) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.GetResponse_Body_Chunk) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + r.chunk = v.GetChunk() + + return nil +} + +func (r *GetResponseBody) ToGRPCMessage() grpc.Message { + var m *object.GetResponse_Body + + if r != nil { + m = new(object.GetResponse_Body) + + switch v := r.GetObjectPart(); t := v.(type) { + case nil: + m.ObjectPart = nil + case *GetObjectPartInit: + m.SetInit(t.ToGRPCMessage().(*object.GetResponse_Body_Init)) + case *GetObjectPartChunk: + m.SetChunk(t.ToGRPCMessage().(*object.GetResponse_Body_Chunk)) + case *SplitInfo: + m.SetSplitInfo(t.ToGRPCMessage().(*object.SplitInfo)) + default: + panic(fmt.Sprintf("unknown get object part %T", t)) + } + } + + return m +} + +func (r *GetResponseBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.GetResponse_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + r.objPart = nil + + switch pt := v.GetObjectPart().(type) { case nil: case *object.GetResponse_Body_Init_: - r.SetObjectPart( - GetObjectPartInitFromGRPCMessage(v.Init), - ) + if pt != nil { + partInit := new(GetObjectPartInit) + r.objPart = partInit + err = partInit.FromGRPCMessage(pt.Init) + } case *object.GetResponse_Body_Chunk: - r.SetObjectPart( - GetObjectPartChunkFromGRPCMessage(v), - ) + if pt != nil { + partChunk := new(GetObjectPartChunk) + r.objPart = partChunk + err = partChunk.FromGRPCMessage(pt) + } case *object.GetResponse_Body_SplitInfo: - r.SetObjectPart( - SplitInfoFromGRPCMessage(v.SplitInfo), - ) + if pt != nil { + partSplit := new(SplitInfo) + r.objPart = partSplit + err = partSplit.FromGRPCMessage(pt.SplitInfo) + } default: - panic(fmt.Sprintf("unknown object part %T", v)) + err = errors.Errorf("unknown get object part %T", pt) } - return r + return err } -func GetResponseToGRPCMessage(r *GetResponse) *object.GetResponse { - if r == nil { - return nil - } +func (r *GetResponse) ToGRPCMessage() grpc.Message { + var m *object.GetResponse - m := new(object.GetResponse) + if r != nil { + m = new(object.GetResponse) - m.SetBody( - GetResponseBodyToGRPCMessage(r.GetBody()), - ) - - session.ResponseHeadersToGRPC(r, m) - - return m -} - -func GetResponseFromGRPCMessage(m *object.GetResponse) *GetResponse { - if m == nil { - return nil - } - - r := new(GetResponse) - - r.SetBody( - GetResponseBodyFromGRPCMessage(m.GetBody()), - ) - - session.ResponseHeadersFromGRPC(m, r) - - return r -} - -func PutObjectPartInitToGRPCMessage(r *PutObjectPartInit) *object.PutRequest_Body_Init { - if r == nil { - return nil - } - - m := new(object.PutRequest_Body_Init) - - m.SetObjectId( - refs.ObjectIDToGRPCMessage(r.GetObjectID()), - ) - - m.SetSignature( - refs.SignatureToGRPCMessage(r.GetSignature()), - ) - - m.SetHeader( - HeaderToGRPCMessage(r.GetHeader()), - ) - - m.SetCopiesNumber(r.GetCopiesNumber()) - - return m -} - -func PutObjectPartInitFromGRPCMessage(m *object.PutRequest_Body_Init) *PutObjectPartInit { - if m == nil { - return nil - } - - r := new(PutObjectPartInit) - - r.SetObjectID( - refs.ObjectIDFromGRPCMessage(m.GetObjectId()), - ) - - r.SetSignature( - refs.SignatureFromGRPCMessage(m.GetSignature()), - ) - - r.SetHeader( - HeaderFromGRPCMessage(m.GetHeader()), - ) - - r.SetCopiesNumber(m.GetCopiesNumber()) - - return r -} - -func PutObjectPartChunkToGRPCMessage(r *PutObjectPartChunk) *object.PutRequest_Body_Chunk { - if r == nil { - return nil - } - - m := new(object.PutRequest_Body_Chunk) - - m.SetChunk(r.GetChunk()) - - return m -} - -func PutObjectPartChunkFromGRPCMessage(m *object.PutRequest_Body_Chunk) *PutObjectPartChunk { - if m == nil { - return nil - } - - r := new(PutObjectPartChunk) - - r.SetChunk(m.GetChunk()) - - return r -} - -func PutRequestBodyToGRPCMessage(r *PutRequestBody) *object.PutRequest_Body { - if r == nil { - return nil - } - - m := new(object.PutRequest_Body) - - switch v := r.GetObjectPart(); t := v.(type) { - case nil: - case *PutObjectPartInit: - m.SetInit( - PutObjectPartInitToGRPCMessage(t), - ) - case *PutObjectPartChunk: - m.SetChunk( - PutObjectPartChunkToGRPCMessage(t), - ) - default: - panic(fmt.Sprintf("unknown object part %T", t)) + m.SetBody(r.body.ToGRPCMessage().(*object.GetResponse_Body)) + r.ResponseHeaders.ToMessage(m) } return m } -func PutRequestBodyFromGRPCMessage(m *object.PutRequest_Body) *PutRequestBody { - if m == nil { - return nil +func (r *GetResponse) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.GetResponse) + if !ok { + return message.NewUnexpectedMessageType(m, v) } - r := new(PutRequestBody) + var err error - switch v := m.GetObjectPart().(type) { + body := v.GetBody() + if body == nil { + r.body = nil + } else { + if r.body == nil { + r.body = new(GetResponseBody) + } + + err = r.body.FromGRPCMessage(body) + if err != nil { + return err + } + } + + return r.ResponseHeaders.FromMessage(v) +} + +func (r *PutObjectPartInit) ToGRPCMessage() grpc.Message { + var m *object.PutRequest_Body_Init + + if r != nil { + m = new(object.PutRequest_Body_Init) + + m.SetObjectId(r.id.ToGRPCMessage().(*refsGRPC.ObjectID)) + m.SetSignature(r.sig.ToGRPCMessage().(*refsGRPC.Signature)) + m.SetHeader(r.hdr.ToGRPCMessage().(*object.Header)) + m.SetCopiesNumber(r.copyNum) + } + + return m +} + +func (r *PutObjectPartInit) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.PutRequest_Body_Init) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + id := v.GetObjectId() + if id == nil { + r.id = nil + } else { + if r.id == nil { + r.id = new(refs.ObjectID) + } + + err = r.id.FromGRPCMessage(id) + if err != nil { + return err + } + } + + sig := v.GetSignature() + if sig == nil { + r.sig = nil + } else { + if r.sig == nil { + r.sig = new(refs.Signature) + } + + err = r.sig.FromGRPCMessage(sig) + if err != nil { + return err + } + } + + hdr := v.GetHeader() + if hdr == nil { + r.hdr = nil + } else { + if r.hdr == nil { + r.hdr = new(Header) + } + + err = r.hdr.FromGRPCMessage(hdr) + if err != nil { + return err + } + } + + r.copyNum = v.GetCopiesNumber() + + return nil +} + +func (r *PutObjectPartChunk) ToGRPCMessage() grpc.Message { + var m *object.PutRequest_Body_Chunk + + if r != nil { + m = new(object.PutRequest_Body_Chunk) + + m.SetChunk(r.chunk) + } + + return m +} + +func (r *PutObjectPartChunk) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.PutRequest_Body_Chunk) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + r.chunk = v.GetChunk() + + return nil +} + +func (r *PutRequestBody) ToGRPCMessage() grpc.Message { + var m *object.PutRequest_Body + + if r != nil { + m = new(object.PutRequest_Body) + + switch v := r.GetObjectPart(); t := v.(type) { + case nil: + m.ObjectPart = nil + case *PutObjectPartInit: + m.SetInit(t.ToGRPCMessage().(*object.PutRequest_Body_Init)) + case *PutObjectPartChunk: + m.SetChunk(t.ToGRPCMessage().(*object.PutRequest_Body_Chunk)) + default: + panic(fmt.Sprintf("unknown put object part %T", t)) + } + } + + return m +} + +func (r *PutRequestBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.PutRequest_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + r.objPart = nil + + switch pt := v.GetObjectPart().(type) { case nil: case *object.PutRequest_Body_Init_: - r.SetObjectPart( - PutObjectPartInitFromGRPCMessage(v.Init), - ) + if pt != nil { + partInit := new(PutObjectPartInit) + r.objPart = partInit + err = partInit.FromGRPCMessage(pt.Init) + } case *object.PutRequest_Body_Chunk: - r.SetObjectPart( - PutObjectPartChunkFromGRPCMessage(v), - ) + if pt != nil { + partChunk := new(PutObjectPartChunk) + r.objPart = partChunk + err = partChunk.FromGRPCMessage(pt) + } default: - panic(fmt.Sprintf("unknown object part %T", v)) + err = errors.Errorf("unknown put object part %T", pt) } - return r + return err } -func PutRequestToGRPCMessage(r *PutRequest) *object.PutRequest { - if r == nil { - return nil - } +func (r *PutRequest) ToGRPCMessage() grpc.Message { + var m *object.PutRequest - m := new(object.PutRequest) + if r != nil { + m = new(object.PutRequest) - m.SetBody( - PutRequestBodyToGRPCMessage(r.GetBody()), - ) - - session.RequestHeadersToGRPC(r, m) - - return m -} - -func PutRequestFromGRPCMessage(m *object.PutRequest) *PutRequest { - if m == nil { - return nil - } - - r := new(PutRequest) - - r.SetBody( - PutRequestBodyFromGRPCMessage(m.GetBody()), - ) - - session.RequestHeadersFromGRPC(m, r) - - return r -} - -func PutResponseBodyToGRPCMessage(r *PutResponseBody) *object.PutResponse_Body { - if r == nil { - return nil - } - - m := new(object.PutResponse_Body) - - m.SetObjectId( - refs.ObjectIDToGRPCMessage(r.GetObjectID()), - ) - - return m -} - -func PutResponseBodyFromGRPCMessage(m *object.PutResponse_Body) *PutResponseBody { - if m == nil { - return nil - } - - r := new(PutResponseBody) - - r.SetObjectID( - refs.ObjectIDFromGRPCMessage(m.GetObjectId()), - ) - - return r -} - -func PutResponseToGRPCMessage(r *PutResponse) *object.PutResponse { - if r == nil { - return nil - } - - m := new(object.PutResponse) - - m.SetBody( - PutResponseBodyToGRPCMessage(r.GetBody()), - ) - - session.ResponseHeadersToGRPC(r, m) - - return m -} - -func PutResponseFromGRPCMessage(m *object.PutResponse) *PutResponse { - if m == nil { - return nil - } - - r := new(PutResponse) - - r.SetBody( - PutResponseBodyFromGRPCMessage(m.GetBody()), - ) - - session.ResponseHeadersFromGRPC(m, r) - - return r -} - -func DeleteRequestBodyToGRPCMessage(r *DeleteRequestBody) *object.DeleteRequest_Body { - if r == nil { - return nil - } - - m := new(object.DeleteRequest_Body) - - m.SetAddress( - refs.AddressToGRPCMessage(r.GetAddress()), - ) - - return m -} - -func DeleteRequestBodyFromGRPCMessage(m *object.DeleteRequest_Body) *DeleteRequestBody { - if m == nil { - return nil - } - - r := new(DeleteRequestBody) - - r.SetAddress( - refs.AddressFromGRPCMessage(m.GetAddress()), - ) - - return r -} - -func DeleteRequestToGRPCMessage(r *DeleteRequest) *object.DeleteRequest { - if r == nil { - return nil - } - - m := new(object.DeleteRequest) - - m.SetBody( - DeleteRequestBodyToGRPCMessage(r.GetBody()), - ) - - session.RequestHeadersToGRPC(r, m) - - return m -} - -func DeleteRequestFromGRPCMessage(m *object.DeleteRequest) *DeleteRequest { - if m == nil { - return nil - } - - r := new(DeleteRequest) - - r.SetBody( - DeleteRequestBodyFromGRPCMessage(m.GetBody()), - ) - - session.RequestHeadersFromGRPC(m, r) - - return r -} - -func DeleteResponseBodyToGRPCMessage(r *DeleteResponseBody) *object.DeleteResponse_Body { - if r == nil { - return nil - } - - m := new(object.DeleteResponse_Body) - m.SetTombstone( - refs.AddressToGRPCMessage(r.GetTombstone()), - ) - - return m -} - -func DeleteResponseBodyFromGRPCMessage(m *object.DeleteResponse_Body) *DeleteResponseBody { - if m == nil { - return nil - } - - r := new(DeleteResponseBody) - r.SetTombstone( - refs.AddressFromGRPCMessage(m.GetTombstone()), - ) - - return r -} - -func DeleteResponseToGRPCMessage(r *DeleteResponse) *object.DeleteResponse { - if r == nil { - return nil - } - - m := new(object.DeleteResponse) - - m.SetBody( - DeleteResponseBodyToGRPCMessage(r.GetBody()), - ) - - session.ResponseHeadersToGRPC(r, m) - - return m -} - -func DeleteResponseFromGRPCMessage(m *object.DeleteResponse) *DeleteResponse { - if m == nil { - return nil - } - - r := new(DeleteResponse) - - r.SetBody( - DeleteResponseBodyFromGRPCMessage(m.GetBody()), - ) - - session.ResponseHeadersFromGRPC(m, r) - - return r -} - -func HeadRequestBodyToGRPCMessage(r *HeadRequestBody) *object.HeadRequest_Body { - if r == nil { - return nil - } - - m := new(object.HeadRequest_Body) - - m.SetAddress( - refs.AddressToGRPCMessage(r.GetAddress()), - ) - - m.SetMainOnly(r.GetMainOnly()) - - m.SetRaw(r.GetRaw()) - - return m -} - -func HeadRequestBodyFromGRPCMessage(m *object.HeadRequest_Body) *HeadRequestBody { - if m == nil { - return nil - } - - r := new(HeadRequestBody) - - r.SetAddress( - refs.AddressFromGRPCMessage(m.GetAddress()), - ) - - r.SetMainOnly(m.GetMainOnly()) - - r.SetRaw(m.GetRaw()) - - return r -} - -func HeadRequestToGRPCMessage(r *HeadRequest) *object.HeadRequest { - if r == nil { - return nil - } - - m := new(object.HeadRequest) - - m.SetBody( - HeadRequestBodyToGRPCMessage(r.GetBody()), - ) - - session.RequestHeadersToGRPC(r, m) - - return m -} - -func HeadRequestFromGRPCMessage(m *object.HeadRequest) *HeadRequest { - if m == nil { - return nil - } - - r := new(HeadRequest) - - r.SetBody( - HeadRequestBodyFromGRPCMessage(m.GetBody()), - ) - - session.RequestHeadersFromGRPC(m, r) - - return r -} - -func HeadResponseBodyToGRPCMessage(r *HeadResponseBody) *object.HeadResponse_Body { - if r == nil { - return nil - } - - m := new(object.HeadResponse_Body) - - switch v := r.GetHeaderPart(); t := v.(type) { - case nil: - case *HeaderWithSignature: - m.SetHeader( - HeaderWithSignatureToGRPCMessage(t), - ) - case *ShortHeader: - m.SetShortHeader( - ShortHeaderToGRPCMessage(t), - ) - case *SplitInfo: - m.SetSplitInfo( - SplitInfoToGRPCMessage(t), - ) - default: - panic(fmt.Sprintf("unknown header part %T", t)) + m.SetBody(r.body.ToGRPCMessage().(*object.PutRequest_Body)) + r.RequestHeaders.ToMessage(m) } return m } -func HeadResponseBodyFromGRPCMessage(m *object.HeadResponse_Body) *HeadResponseBody { - if m == nil { - return nil +func (r *PutRequest) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.PutRequest) + if !ok { + return message.NewUnexpectedMessageType(m, v) } - r := new(HeadResponseBody) + var err error - switch v := m.GetHead().(type) { + body := v.GetBody() + if body == nil { + r.body = nil + } else { + if r.body == nil { + r.body = new(PutRequestBody) + } + + err = r.body.FromGRPCMessage(body) + if err != nil { + return err + } + } + + return r.RequestHeaders.FromMessage(v) +} + +func (r *PutResponseBody) ToGRPCMessage() grpc.Message { + var m *object.PutResponse_Body + + if r != nil { + m = new(object.PutResponse_Body) + + m.SetObjectId(r.id.ToGRPCMessage().(*refsGRPC.ObjectID)) + } + + return m +} + +func (r *PutResponseBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.PutResponse_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + id := v.GetObjectId() + if id == nil { + r.id = nil + } else { + if r.id == nil { + r.id = new(refs.ObjectID) + } + + err = r.id.FromGRPCMessage(id) + } + + return err +} + +func (r *PutResponse) ToGRPCMessage() grpc.Message { + var m *object.PutResponse + + if r != nil { + m = new(object.PutResponse) + + m.SetBody(r.body.ToGRPCMessage().(*object.PutResponse_Body)) + r.ResponseHeaders.ToMessage(m) + } + + return m +} + +func (r *PutResponse) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.PutResponse) + 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(PutResponseBody) + } + + err = r.body.FromGRPCMessage(body) + if err != nil { + return err + } + } + + return r.ResponseHeaders.FromMessage(v) +} + +func (r *DeleteRequestBody) ToGRPCMessage() grpc.Message { + var m *object.DeleteRequest_Body + + if r != nil { + m = new(object.DeleteRequest_Body) + + m.SetAddress(r.addr.ToGRPCMessage().(*refsGRPC.Address)) + } + + return m +} + +func (r *DeleteRequestBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.DeleteRequest_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + addr := v.GetAddress() + if addr == nil { + r.addr = nil + } else { + if r.addr == nil { + r.addr = new(refs.Address) + } + + err = r.addr.FromGRPCMessage(addr) + } + + return err +} + +func (r *DeleteRequest) ToGRPCMessage() grpc.Message { + var m *object.DeleteRequest + + if r != nil { + m = new(object.DeleteRequest) + + m.SetBody(r.body.ToGRPCMessage().(*object.DeleteRequest_Body)) + r.RequestHeaders.ToMessage(m) + } + + return m +} + +func (r *DeleteRequest) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.DeleteRequest) + 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(DeleteRequestBody) + } + + err = r.body.FromGRPCMessage(body) + if err != nil { + return err + } + } + + return r.RequestHeaders.FromMessage(v) +} + +func (r *DeleteResponseBody) ToGRPCMessage() grpc.Message { + var m *object.DeleteResponse_Body + + if r != nil { + m = new(object.DeleteResponse_Body) + + m.SetTombstone(r.tombstone.ToGRPCMessage().(*refsGRPC.Address)) + } + + return m +} + +func (r *DeleteResponseBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.DeleteResponse_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + tombstone := v.GetTombstone() + if tombstone == nil { + r.tombstone = nil + } else { + if r.tombstone == nil { + r.tombstone = new(refs.Address) + } + + err = r.tombstone.FromGRPCMessage(tombstone) + } + + return err +} + +func (r *DeleteResponse) ToGRPCMessage() grpc.Message { + var m *object.DeleteResponse + + if r != nil { + m = new(object.DeleteResponse) + + m.SetBody(r.body.ToGRPCMessage().(*object.DeleteResponse_Body)) + r.ResponseHeaders.ToMessage(m) + } + + return m +} + +func (r *DeleteResponse) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.DeleteResponse) + 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(DeleteResponseBody) + } + + err = r.body.FromGRPCMessage(body) + if err != nil { + return err + } + } + + return r.ResponseHeaders.FromMessage(v) +} + +func (r *HeadRequestBody) ToGRPCMessage() grpc.Message { + var m *object.HeadRequest_Body + + if r != nil { + m = new(object.HeadRequest_Body) + + m.SetAddress(r.addr.ToGRPCMessage().(*refsGRPC.Address)) + m.SetRaw(r.raw) + m.SetMainOnly(r.mainOnly) + } + + return m +} + +func (r *HeadRequestBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.HeadRequest_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + addr := v.GetAddress() + if addr == nil { + r.addr = nil + } else { + if r.addr == nil { + r.addr = new(refs.Address) + } + + err = r.addr.FromGRPCMessage(addr) + if err != nil { + return err + } + } + + r.raw = v.GetRaw() + r.mainOnly = v.GetMainOnly() + + return nil +} + +func (r *HeadRequest) ToGRPCMessage() grpc.Message { + var m *object.HeadRequest + + if r != nil { + m = new(object.HeadRequest) + + m.SetBody(r.body.ToGRPCMessage().(*object.HeadRequest_Body)) + r.RequestHeaders.ToMessage(m) + } + + return m +} + +func (r *HeadRequest) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.HeadRequest) + 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(HeadRequestBody) + } + + err = r.body.FromGRPCMessage(body) + if err != nil { + return err + } + } + + return r.RequestHeaders.FromMessage(v) +} + +func (r *HeadResponseBody) ToGRPCMessage() grpc.Message { + var m *object.HeadResponse_Body + + if r != nil { + m = new(object.HeadResponse_Body) + + switch v := r.hdrPart.(type) { + case nil: + m.Head = nil + case *HeaderWithSignature: + m.SetHeader(v.ToGRPCMessage().(*object.HeaderWithSignature)) + case *ShortHeader: + m.SetShortHeader(v.ToGRPCMessage().(*object.ShortHeader)) + case *SplitInfo: + m.SetSplitInfo(v.ToGRPCMessage().(*object.SplitInfo)) + default: + panic(fmt.Sprintf("unknown head part %T", v)) + } + } + + return m +} + +func (r *HeadResponseBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.HeadResponse_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + r.hdrPart = nil + + switch pt := v.GetHead().(type) { case nil: case *object.HeadResponse_Body_Header: - r.SetHeaderPart( - HeaderWithSignatureFromGRPCMessage(v.Header), - ) + if pt != nil { + partHdr := new(HeaderWithSignature) + r.hdrPart = partHdr + err = partHdr.FromGRPCMessage(pt.Header) + } case *object.HeadResponse_Body_ShortHeader: - r.SetHeaderPart( - ShortHeaderFromGRPCMessage(v.ShortHeader), - ) + if pt != nil { + partShort := new(ShortHeader) + r.hdrPart = partShort + err = partShort.FromGRPCMessage(pt.ShortHeader) + } case *object.HeadResponse_Body_SplitInfo: - r.SetHeaderPart( - SplitInfoFromGRPCMessage(v.SplitInfo), - ) + if pt != nil { + partSplit := new(SplitInfo) + r.hdrPart = partSplit + err = partSplit.FromGRPCMessage(pt.SplitInfo) + } default: - panic(fmt.Sprintf("unknown header part %T", v)) + err = errors.Errorf("unknown head part %T", pt) } - return r + return err } -func HeadResponseToGRPCMessage(r *HeadResponse) *object.HeadResponse { - if r == nil { - return nil - } +func (r *HeadResponse) ToGRPCMessage() grpc.Message { + var m *object.HeadResponse - m := new(object.HeadResponse) + if r != nil { + m = new(object.HeadResponse) - m.SetBody( - HeadResponseBodyToGRPCMessage(r.GetBody()), - ) - - session.ResponseHeadersToGRPC(r, m) - - return m -} - -func HeadResponseFromGRPCMessage(m *object.HeadResponse) *HeadResponse { - if m == nil { - return nil - } - - r := new(HeadResponse) - - r.SetBody( - HeadResponseBodyFromGRPCMessage(m.GetBody()), - ) - - session.ResponseHeadersFromGRPC(m, r) - - return r -} - -func SearchFilterToGRPCMessage(f *SearchFilter) *object.SearchRequest_Body_Filter { - if f == nil { - return nil - } - - m := new(object.SearchRequest_Body_Filter) - - m.SetMatchType( - MatchTypeToGRPCField(f.GetMatchType()), - ) - - m.SetKey(f.GetKey()) - - m.SetValue(f.GetValue()) - - return m -} - -func SearchFilterFromGRPCMessage(m *object.SearchRequest_Body_Filter) *SearchFilter { - if m == nil { - return nil - } - - f := new(SearchFilter) - - f.SetMatchType( - MatchTypeFromGRPCField(m.GetMatchType()), - ) - - f.SetKey(m.GetKey()) - - f.SetValue(m.GetValue()) - - return f -} - -func SearchRequestBodyToGRPCMessage(r *SearchRequestBody) *object.SearchRequest_Body { - if r == nil { - return nil - } - - m := new(object.SearchRequest_Body) - - m.SetContainerId( - refs.ContainerIDToGRPCMessage(r.GetContainerID()), - ) - - m.SetVersion(r.GetVersion()) - - filters := r.GetFilters() - filterMsg := make([]*object.SearchRequest_Body_Filter, 0, len(filters)) - - for i := range filters { - filterMsg = append(filterMsg, SearchFilterToGRPCMessage(filters[i])) - } - - m.SetFilters(filterMsg) - - return m -} - -func SearchRequestBodyFromGRPCMessage(m *object.SearchRequest_Body) *SearchRequestBody { - if m == nil { - return nil - } - - r := new(SearchRequestBody) - - r.SetContainerID( - refs.ContainerIDFromGRPCMessage(m.GetContainerId()), - ) - - r.SetVersion(m.GetVersion()) - - filterMsg := m.GetFilters() - filters := make([]*SearchFilter, 0, len(filterMsg)) - - for i := range filterMsg { - filters = append(filters, SearchFilterFromGRPCMessage(filterMsg[i])) - } - - r.SetFilters(filters) - - return r -} - -func SearchRequestToGRPCMessage(r *SearchRequest) *object.SearchRequest { - if r == nil { - return nil - } - - m := new(object.SearchRequest) - - m.SetBody( - SearchRequestBodyToGRPCMessage(r.GetBody()), - ) - - session.RequestHeadersToGRPC(r, m) - - return m -} - -func SearchRequestFromGRPCMessage(m *object.SearchRequest) *SearchRequest { - if m == nil { - return nil - } - - r := new(SearchRequest) - - r.SetBody( - SearchRequestBodyFromGRPCMessage(m.GetBody()), - ) - - session.RequestHeadersFromGRPC(m, r) - - return r -} - -func SearchResponseBodyToGRPCMessage(r *SearchResponseBody) *object.SearchResponse_Body { - if r == nil { - return nil - } - - m := new(object.SearchResponse_Body) - - m.SetIdList( - refs.ObjectIDListToGRPCMessage(r.GetIDList()), - ) - - return m -} - -func SearchResponseBodyFromGRPCMessage(m *object.SearchResponse_Body) *SearchResponseBody { - if m == nil { - return nil - } - - r := new(SearchResponseBody) - - r.SetIDList( - refs.ObjectIDListFromGRPCMessage(m.GetIdList()), - ) - - return r -} - -func SearchResponseToGRPCMessage(r *SearchResponse) *object.SearchResponse { - if r == nil { - return nil - } - - m := new(object.SearchResponse) - - m.SetBody( - SearchResponseBodyToGRPCMessage(r.GetBody()), - ) - - session.ResponseHeadersToGRPC(r, m) - - return m -} - -func SearchResponseFromGRPCMessage(m *object.SearchResponse) *SearchResponse { - if m == nil { - return nil - } - - r := new(SearchResponse) - - r.SetBody( - SearchResponseBodyFromGRPCMessage(m.GetBody()), - ) - - session.ResponseHeadersFromGRPC(m, r) - - return r -} - -func RangeToGRPCMessage(r *Range) *object.Range { - if r == nil { - return nil - } - - m := new(object.Range) - - m.SetOffset(r.GetOffset()) - m.SetLength(r.GetLength()) - - return m -} - -func RangeFromGRPCMessage(m *object.Range) *Range { - if m == nil { - return nil - } - - r := new(Range) - - r.SetOffset(m.GetOffset()) - r.SetLength(m.GetLength()) - - return r -} - -func GetRangeRequestBodyToGRPCMessage(r *GetRangeRequestBody) *object.GetRangeRequest_Body { - if r == nil { - return nil - } - - m := new(object.GetRangeRequest_Body) - - m.SetAddress( - refs.AddressToGRPCMessage(r.GetAddress()), - ) - - m.SetRange( - RangeToGRPCMessage(r.GetRange()), - ) - - m.SetRaw(r.GetRaw()) - - return m -} - -func GetRangeRequestBodyFromGRPCMessage(m *object.GetRangeRequest_Body) *GetRangeRequestBody { - if m == nil { - return nil - } - - r := new(GetRangeRequestBody) - - r.SetAddress( - refs.AddressFromGRPCMessage(m.GetAddress()), - ) - - r.SetRange( - RangeFromGRPCMessage(m.GetRange()), - ) - - r.SetRaw(m.GetRaw()) - - return r -} - -func GetRangeRequestToGRPCMessage(r *GetRangeRequest) *object.GetRangeRequest { - if r == nil { - return nil - } - - m := new(object.GetRangeRequest) - - m.SetBody( - GetRangeRequestBodyToGRPCMessage(r.GetBody()), - ) - - session.RequestHeadersToGRPC(r, m) - - return m -} - -func GetRangeRequestFromGRPCMessage(m *object.GetRangeRequest) *GetRangeRequest { - if m == nil { - return nil - } - - r := new(GetRangeRequest) - - r.SetBody( - GetRangeRequestBodyFromGRPCMessage(m.GetBody()), - ) - - session.RequestHeadersFromGRPC(m, r) - - return r -} - -func GetRangePartChunkToGRPCMessage(r *GetRangePartChunk) *object.GetRangeResponse_Body_Chunk { - if r == nil { - return nil - } - - m := new(object.GetRangeResponse_Body_Chunk) - - m.SetChunk(r.GetChunk()) - - return m -} - -func GetRangePartChunkFromGRPCMessage(m *object.GetRangeResponse_Body_Chunk) *GetRangePartChunk { - if m == nil { - return nil - } - - r := new(GetRangePartChunk) - - r.SetChunk(m.GetChunk()) - - return r -} - -func GetRangeResponseBodyToGRPCMessage(r *GetRangeResponseBody) *object.GetRangeResponse_Body { - if r == nil { - return nil - } - - m := new(object.GetRangeResponse_Body) - - switch v := r.GetRangePart(); t := v.(type) { - case nil: - case *GetRangePartChunk: - m.SetChunk( - GetRangePartChunkToGRPCMessage(t), - ) - case *SplitInfo: - m.SetSplitInfo( - SplitInfoToGRPCMessage(t), - ) - default: - panic(fmt.Sprintf("unknown get range part %T", t)) + m.SetBody(r.body.ToGRPCMessage().(*object.HeadResponse_Body)) + r.ResponseHeaders.ToMessage(m) } return m } -func GetRangeResponseBodyFromGRPCMessage(m *object.GetRangeResponse_Body) *GetRangeResponseBody { - if m == nil { - return nil +func (r *HeadResponse) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.HeadResponse) + if !ok { + return message.NewUnexpectedMessageType(m, v) } - r := new(GetRangeResponseBody) + var err error - switch v := m.GetRangePart().(type) { + body := v.GetBody() + if body == nil { + r.body = nil + } else { + if r.body == nil { + r.body = new(HeadResponseBody) + } + + err = r.body.FromGRPCMessage(body) + if err != nil { + return err + } + } + + return r.ResponseHeaders.FromMessage(v) +} + +func (f *SearchFilter) ToGRPCMessage() grpc.Message { + var m *object.SearchRequest_Body_Filter + + if f != nil { + m = new(object.SearchRequest_Body_Filter) + + m.SetKey(f.key) + m.SetValue(f.val) + m.SetMatchType(MatchTypeToGRPCField(f.matchType)) + } + + return m +} + +func (f *SearchFilter) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.SearchRequest_Body_Filter) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + f.key = v.GetKey() + f.val = v.GetValue() + f.matchType = MatchTypeFromGRPCField(v.GetMatchType()) + + return nil +} + +func SearchFiltersToGRPC(fs []*SearchFilter) (res []*object.SearchRequest_Body_Filter) { + if fs != nil { + res = make([]*object.SearchRequest_Body_Filter, 0, len(fs)) + + for i := range fs { + res = append(res, fs[i].ToGRPCMessage().(*object.SearchRequest_Body_Filter)) + } + } + + return +} + +func SearchFiltersFromGRPC(fs []*object.SearchRequest_Body_Filter) (res []*SearchFilter, err error) { + if fs != nil { + res = make([]*SearchFilter, 0, len(fs)) + + for i := range fs { + var x *SearchFilter + + if fs[i] != nil { + x = new(SearchFilter) + + err = x.FromGRPCMessage(fs[i]) + if err != nil { + return + } + } + + res = append(res, x) + } + } + + return +} + +func (r *SearchRequestBody) ToGRPCMessage() grpc.Message { + var m *object.SearchRequest_Body + + if r != nil { + m = new(object.SearchRequest_Body) + + m.SetContainerId(r.cid.ToGRPCMessage().(*refsGRPC.ContainerID)) + m.SetFilters(SearchFiltersToGRPC(r.filters)) + m.SetVersion(r.version) + } + + return m +} + +func (r *SearchRequestBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.SearchRequest_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + cid := v.GetContainerId() + if cid == nil { + r.cid = nil + } else { + if r.cid == nil { + r.cid = new(refs.ContainerID) + } + + err = r.cid.FromGRPCMessage(cid) + if err != nil { + return err + } + } + + r.filters, err = SearchFiltersFromGRPC(v.GetFilters()) + if err != nil { + return err + } + + r.version = v.GetVersion() + + return nil +} + +func (r *SearchRequest) ToGRPCMessage() grpc.Message { + var m *object.SearchRequest + + if r != nil { + m = new(object.SearchRequest) + + m.SetBody(r.body.ToGRPCMessage().(*object.SearchRequest_Body)) + r.RequestHeaders.ToMessage(m) + } + + return m +} + +func (r *SearchRequest) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.SearchRequest) + 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(SearchRequestBody) + } + + err = r.body.FromGRPCMessage(body) + if err != nil { + return err + } + } + + return r.RequestHeaders.FromMessage(v) +} + +func (r *SearchResponseBody) ToGRPCMessage() grpc.Message { + var m *object.SearchResponse_Body + + if r != nil { + m = new(object.SearchResponse_Body) + + m.SetIdList(refs.ObjectIDListToGRPCMessage(r.idList)) + } + + return m +} + +func (r *SearchResponseBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.SearchResponse_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + r.idList, err = refs.ObjectIDListFromGRPCMessage(v.GetIdList()) + + return err +} + +func (r *SearchResponse) ToGRPCMessage() grpc.Message { + var m *object.SearchResponse + + if r != nil { + m = new(object.SearchResponse) + + m.SetBody(r.body.ToGRPCMessage().(*object.SearchResponse_Body)) + r.ResponseHeaders.ToMessage(m) + } + + return m +} + +func (r *SearchResponse) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.SearchResponse) + 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(SearchResponseBody) + } + + err = r.body.FromGRPCMessage(body) + if err != nil { + return err + } + } + + return r.ResponseHeaders.FromMessage(v) +} + +func (r *Range) ToGRPCMessage() grpc.Message { + var m *object.Range + + if r != nil { + m = new(object.Range) + + m.SetLength(r.len) + m.SetOffset(r.off) + } + + return m +} + +func (r *Range) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.Range) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + r.len = v.GetLength() + r.off = v.GetOffset() + + return nil +} + +func RangesToGRPC(rs []*Range) (res []*object.Range) { + if rs != nil { + res = make([]*object.Range, 0, len(rs)) + + for i := range rs { + res = append(res, rs[i].ToGRPCMessage().(*object.Range)) + } + } + + return +} + +func RangesFromGRPC(rs []*object.Range) (res []*Range, err error) { + if rs != nil { + res = make([]*Range, 0, len(rs)) + + for i := range rs { + var r *Range + + if rs[i] != nil { + r = new(Range) + + err = r.FromGRPCMessage(rs[i]) + if err != nil { + return + } + } + + res = append(res, r) + } + } + + return +} + +func (r *GetRangeRequestBody) ToGRPCMessage() grpc.Message { + var m *object.GetRangeRequest_Body + + if r != nil { + m = new(object.GetRangeRequest_Body) + + m.SetAddress(r.addr.ToGRPCMessage().(*refsGRPC.Address)) + m.SetRange(r.rng.ToGRPCMessage().(*object.Range)) + m.SetRaw(r.raw) + } + + return m +} + +func (r *GetRangeRequestBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.GetRangeRequest_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + addr := v.GetAddress() + if addr == nil { + r.addr = nil + } else { + if r.addr == nil { + r.addr = new(refs.Address) + } + + err = r.addr.FromGRPCMessage(addr) + if err != nil { + return err + } + } + + rng := v.GetRange() + if rng == nil { + r.rng = nil + } else { + if r.rng == nil { + r.rng = new(Range) + } + + err = r.rng.FromGRPCMessage(rng) + if err != nil { + return err + } + } + + r.raw = v.GetRaw() + + return nil +} + +func (r *GetRangeRequest) ToGRPCMessage() grpc.Message { + var m *object.GetRangeRequest + + if r != nil { + m = new(object.GetRangeRequest) + + m.SetBody(r.body.ToGRPCMessage().(*object.GetRangeRequest_Body)) + r.RequestHeaders.ToMessage(m) + } + + return m +} + +func (r *GetRangeRequest) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.GetRangeRequest) + 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(GetRangeRequestBody) + } + + err = r.body.FromGRPCMessage(body) + if err != nil { + return err + } + } + + return r.RequestHeaders.FromMessage(v) +} + +func (r *GetRangePartChunk) ToGRPCMessage() grpc.Message { + var m *object.GetRangeResponse_Body_Chunk + + if r != nil { + m = new(object.GetRangeResponse_Body_Chunk) + + m.SetChunk(r.chunk) + } + + return m +} + +func (r *GetRangePartChunk) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.GetRangeResponse_Body_Chunk) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + r.chunk = v.GetChunk() + + return nil +} + +func (r *GetRangeResponseBody) ToGRPCMessage() grpc.Message { + var m *object.GetRangeResponse_Body + + if r != nil { + m = new(object.GetRangeResponse_Body) + + switch v := r.rngPart.(type) { + case nil: + m.RangePart = nil + case *GetRangePartChunk: + m.SetChunk(v.ToGRPCMessage().(*object.GetRangeResponse_Body_Chunk)) + case *SplitInfo: + m.SetSplitInfo(v.ToGRPCMessage().(*object.SplitInfo)) + default: + panic(fmt.Sprintf("unknown get range part %T", v)) + } + } + + return m +} + +func (r *GetRangeResponseBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.GetRangeResponse_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + r.rngPart = nil + + switch pt := v.GetRangePart().(type) { case nil: case *object.GetRangeResponse_Body_Chunk: - r.SetRangePart( - GetRangePartChunkFromGRPCMessage(v), - ) + if pt != nil { + partChunk := new(GetRangePartChunk) + r.rngPart = partChunk + err = partChunk.FromGRPCMessage(pt) + } case *object.GetRangeResponse_Body_SplitInfo: - r.SetRangePart( - SplitInfoFromGRPCMessage(v.SplitInfo), - ) + if pt != nil { + partSplit := new(SplitInfo) + r.rngPart = partSplit + err = partSplit.FromGRPCMessage(pt) + } default: - panic(fmt.Sprintf("unknown get range part %T", v)) + err = errors.Errorf("unknown get range part %T", pt) } - return r + return err } -func GetRangeResponseToGRPCMessage(r *GetRangeResponse) *object.GetRangeResponse { - if r == nil { - return nil +func (r *GetRangeResponse) ToGRPCMessage() grpc.Message { + var m *object.GetRangeResponse + + if r != nil { + m = new(object.GetRangeResponse) + + m.SetBody(r.body.ToGRPCMessage().(*object.GetRangeResponse_Body)) + r.ResponseHeaders.ToMessage(m) } - m := new(object.GetRangeResponse) - - m.SetBody( - GetRangeResponseBodyToGRPCMessage(r.GetBody()), - ) - - session.ResponseHeadersToGRPC(r, m) - return m } -func GetRangeResponseFromGRPCMessage(m *object.GetRangeResponse) *GetRangeResponse { - if m == nil { - return nil +func (r *GetRangeResponse) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.GetRangeResponse) + if !ok { + return message.NewUnexpectedMessageType(m, v) } - r := new(GetRangeResponse) + var err error - r.SetBody( - GetRangeResponseBodyFromGRPCMessage(m.GetBody()), - ) + body := v.GetBody() + if body == nil { + r.body = nil + } else { + if r.body == nil { + r.body = new(GetRangeResponseBody) + } - session.ResponseHeadersFromGRPC(m, r) + err = r.body.FromGRPCMessage(body) + if err != nil { + return err + } + } - return r + return r.ResponseHeaders.FromMessage(v) } -func GetRangeHashRequestBodyToGRPCMessage(r *GetRangeHashRequestBody) *object.GetRangeHashRequest_Body { - if r == nil { - return nil +func (r *GetRangeHashRequestBody) ToGRPCMessage() grpc.Message { + var m *object.GetRangeHashRequest_Body + + if r != nil { + m = new(object.GetRangeHashRequest_Body) + + m.SetAddress(r.addr.ToGRPCMessage().(*refsGRPC.Address)) + m.SetRanges(RangesToGRPC(r.rngs)) + m.SetType(refs.ChecksumTypeToGRPC(r.typ)) + m.SetSalt(r.salt) } - m := new(object.GetRangeHashRequest_Body) - - m.SetAddress( - refs.AddressToGRPCMessage(r.GetAddress()), - ) - - m.SetSalt(r.GetSalt()) - - rngs := r.GetRanges() - rngMsg := make([]*object.Range, 0, len(rngs)) - - for i := range rngs { - rngMsg = append(rngMsg, RangeToGRPCMessage(rngs[i])) - } - - m.SetRanges(rngMsg) - - m.SetType(refsGRPC.ChecksumType(r.GetType())) - return m } -func GetRangeHashRequestBodyFromGRPCMessage(m *object.GetRangeHashRequest_Body) *GetRangeHashRequestBody { - if m == nil { - return nil +func (r *GetRangeHashRequestBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.GetRangeHashRequest_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) } - r := new(GetRangeHashRequestBody) + var err error - r.SetAddress( - refs.AddressFromGRPCMessage(m.GetAddress()), - ) + addr := v.GetAddress() + if addr == nil { + r.addr = nil + } else { + if r.addr == nil { + r.addr = new(refs.Address) + } - r.SetSalt(m.GetSalt()) - - rngMsg := m.GetRanges() - rngs := make([]*Range, 0, len(rngMsg)) - - for i := range rngMsg { - rngs = append(rngs, RangeFromGRPCMessage(rngMsg[i])) + err = r.addr.FromGRPCMessage(addr) + if err != nil { + return err + } } - r.SetRanges(rngs) + r.rngs, err = RangesFromGRPC(v.GetRanges()) + if err != nil { + return err + } - r.SetType(refs.ChecksumType(m.GetType())) + r.typ = refs.ChecksumTypeFromGRPC(v.GetType()) + r.salt = v.GetSalt() - return r + return nil } -func GetRangeHashRequestToGRPCMessage(r *GetRangeHashRequest) *object.GetRangeHashRequest { - if r == nil { - return nil +func (r *GetRangeHashRequest) ToGRPCMessage() grpc.Message { + var m *object.GetRangeHashRequest + + if r != nil { + m = new(object.GetRangeHashRequest) + + m.SetBody(r.body.ToGRPCMessage().(*object.GetRangeHashRequest_Body)) + r.RequestHeaders.ToMessage(m) } - m := new(object.GetRangeHashRequest) - - m.SetBody( - GetRangeHashRequestBodyToGRPCMessage(r.GetBody()), - ) - - session.RequestHeadersToGRPC(r, m) - return m } -func GetRangeHashRequestFromGRPCMessage(m *object.GetRangeHashRequest) *GetRangeHashRequest { - if m == nil { - return nil +func (r *GetRangeHashRequest) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.GetRangeHashRequest) + if !ok { + return message.NewUnexpectedMessageType(m, v) } - r := new(GetRangeHashRequest) + var err error - r.SetBody( - GetRangeHashRequestBodyFromGRPCMessage(m.GetBody()), - ) + body := v.GetBody() + if body == nil { + r.body = nil + } else { + if r.body == nil { + r.body = new(GetRangeHashRequestBody) + } - session.RequestHeadersFromGRPC(m, r) + err = r.body.FromGRPCMessage(body) + if err != nil { + return err + } + } - return r + return r.RequestHeaders.FromMessage(v) } -func GetRangeHashResponseBodyToGRPCMessage(r *GetRangeHashResponseBody) *object.GetRangeHashResponse_Body { - if r == nil { - return nil +func (r *GetRangeHashResponseBody) ToGRPCMessage() grpc.Message { + var m *object.GetRangeHashResponse_Body + + if r != nil { + m = new(object.GetRangeHashResponse_Body) + + m.SetType(refs.ChecksumTypeToGRPC(r.typ)) + m.SetHashList(r.hashList) } - m := new(object.GetRangeHashResponse_Body) - - m.SetType(refsGRPC.ChecksumType(r.GetType())) - - m.SetHashList(r.GetHashList()) - return m } -func GetRangeHashResponseBodyFromGRPCMessage(m *object.GetRangeHashResponse_Body) *GetRangeHashResponseBody { - if m == nil { - return nil +func (r *GetRangeHashResponseBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.GetRangeHashResponse_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) } - r := new(GetRangeHashResponseBody) + r.typ = refs.ChecksumTypeFromGRPC(v.GetType()) + r.hashList = v.GetHashList() - r.SetType(refs.ChecksumType(m.GetType())) - - r.SetHashList(m.GetHashList()) - - return r + return nil } -func GetRangeHashResponseToGRPCMessage(r *GetRangeHashResponse) *object.GetRangeHashResponse { - if r == nil { - return nil +func (r *GetRangeHashResponse) ToGRPCMessage() grpc.Message { + var m *object.GetRangeHashResponse + + if r != nil { + m = new(object.GetRangeHashResponse) + + m.SetBody(r.body.ToGRPCMessage().(*object.GetRangeHashResponse_Body)) + r.ResponseHeaders.ToMessage(m) } - m := new(object.GetRangeHashResponse) - - m.SetBody( - GetRangeHashResponseBodyToGRPCMessage(r.GetBody()), - ) - - session.ResponseHeadersToGRPC(r, m) - return m } -func GetRangeHashResponseFromGRPCMessage(m *object.GetRangeHashResponse) *GetRangeHashResponse { - if m == nil { - return nil +func (r *GetRangeHashResponse) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.GetRangeHashResponse) + if !ok { + return message.NewUnexpectedMessageType(m, v) } - r := new(GetRangeHashResponse) + var err error - r.SetBody( - GetRangeHashResponseBodyFromGRPCMessage(m.GetBody()), - ) + body := v.GetBody() + if body == nil { + r.body = nil + } else { + if r.body == nil { + r.body = new(GetRangeHashResponseBody) + } - session.ResponseHeadersFromGRPC(m, r) + err = r.body.FromGRPCMessage(body) + if err != nil { + return err + } + } - return r + return r.ResponseHeaders.FromMessage(v) } diff --git a/v2/object/json.go b/v2/object/json.go index e2caede..b80253e 100644 --- a/v2/object/json.go +++ b/v2/object/json.go @@ -1,146 +1,78 @@ package object import ( + "github.com/nspcc-dev/neofs-api-go/rpc/message" object "github.com/nspcc-dev/neofs-api-go/v2/object/grpc" - "google.golang.org/protobuf/encoding/protojson" ) func (h *ShortHeader) MarshalJSON() ([]byte, error) { - return protojson.MarshalOptions{ - EmitUnpopulated: true, - }.Marshal( - ShortHeaderToGRPCMessage(h), - ) + return message.MarshalJSON(h) } func (h *ShortHeader) UnmarshalJSON(data []byte) error { - msg := new(object.ShortHeader) - - if err := protojson.Unmarshal(data, msg); err != nil { - return err - } - - *h = *ShortHeaderFromGRPCMessage(msg) - - return nil + return message.UnmarshalJSON(h, data, new(object.ShortHeader)) } func (a *Attribute) MarshalJSON() ([]byte, error) { - return protojson.MarshalOptions{ - EmitUnpopulated: true, - }.Marshal( - AttributeToGRPCMessage(a), - ) + return message.MarshalJSON(a) } func (a *Attribute) UnmarshalJSON(data []byte) error { - msg := new(object.Header_Attribute) - - if err := protojson.Unmarshal(data, msg); err != nil { - return err - } - - *a = *AttributeFromGRPCMessage(msg) - - return nil + return message.UnmarshalJSON(a, data, new(object.Header_Attribute)) } func (h *SplitHeader) MarshalJSON() ([]byte, error) { - return protojson.MarshalOptions{ - EmitUnpopulated: true, - }.Marshal( - SplitHeaderToGRPCMessage(h), - ) + return message.MarshalJSON(h) } func (h *SplitHeader) UnmarshalJSON(data []byte) error { - msg := new(object.Header_Split) - - if err := protojson.Unmarshal(data, msg); err != nil { - return err - } - - *h = *SplitHeaderFromGRPCMessage(msg) - - return nil + return message.UnmarshalJSON(h, data, new(object.Header_Split)) } func (h *Header) MarshalJSON() ([]byte, error) { - return protojson.MarshalOptions{ - EmitUnpopulated: true, - }.Marshal( - HeaderToGRPCMessage(h), - ) + return message.MarshalJSON(h) } func (h *Header) UnmarshalJSON(data []byte) error { - msg := new(object.Header) - - if err := protojson.Unmarshal(data, msg); err != nil { - return err - } - - *h = *HeaderFromGRPCMessage(msg) - - return nil + return message.UnmarshalJSON(h, data, new(object.Header)) } func (h *HeaderWithSignature) MarshalJSON() ([]byte, error) { - return protojson.MarshalOptions{ - EmitUnpopulated: true, - }.Marshal( - HeaderWithSignatureToGRPCMessage(h), - ) + return message.MarshalJSON(h) } func (h *HeaderWithSignature) UnmarshalJSON(data []byte) error { - msg := new(object.HeaderWithSignature) - - if err := protojson.Unmarshal(data, msg); err != nil { - return err - } - - *h = *HeaderWithSignatureFromGRPCMessage(msg) - - return nil + return message.UnmarshalJSON(h, data, new(object.HeaderWithSignature)) } func (o *Object) MarshalJSON() ([]byte, error) { - return protojson.MarshalOptions{ - EmitUnpopulated: true, - }.Marshal( - ObjectToGRPCMessage(o), - ) + return message.MarshalJSON(o) } func (o *Object) UnmarshalJSON(data []byte) error { - msg := new(object.Object) + return message.UnmarshalJSON(o, data, new(object.Object)) +} - if err := protojson.Unmarshal(data, msg); err != nil { - return err - } +func (s *SplitInfo) MarshalJSON() ([]byte, error) { + return message.MarshalJSON(s) +} - *o = *ObjectFromGRPCMessage(msg) - - return nil +func (s *SplitInfo) UnmarshalJSON(data []byte) error { + return message.UnmarshalJSON(s, data, new(object.SplitInfo)) } func (f *SearchFilter) MarshalJSON() ([]byte, error) { - return protojson.MarshalOptions{ - EmitUnpopulated: true, - }.Marshal( - SearchFilterToGRPCMessage(f), - ) + return message.MarshalJSON(f) } func (f *SearchFilter) UnmarshalJSON(data []byte) error { - msg := new(object.SearchRequest_Body_Filter) - - if err := protojson.Unmarshal(data, msg); err != nil { - return err - } - - *f = *SearchFilterFromGRPCMessage(msg) - - return nil + return message.UnmarshalJSON(f, data, new(object.SearchRequest_Body_Filter)) +} + +func (r *Range) MarshalJSON() ([]byte, error) { + return message.MarshalJSON(r) +} + +func (r *Range) UnmarshalJSON(data []byte) error { + return message.UnmarshalJSON(r, data, new(object.Range)) } diff --git a/v2/object/json_test.go b/v2/object/json_test.go deleted file mode 100644 index e8ad5d2..0000000 --- a/v2/object/json_test.go +++ /dev/null @@ -1,92 +0,0 @@ -package object_test - -import ( - "testing" - - "github.com/nspcc-dev/neofs-api-go/v2/object" - "github.com/stretchr/testify/require" -) - -func TestShortHeaderJSON(t *testing.T) { - h := generateShortHeader("id") - - data, err := h.MarshalJSON() - require.NoError(t, err) - - h2 := new(object.ShortHeader) - require.NoError(t, h2.UnmarshalJSON(data)) - - require.Equal(t, h, h2) -} - -func TestAttributeJSON(t *testing.T) { - a := generateAttribute("key", "value") - - data, err := a.MarshalJSON() - require.NoError(t, err) - - a2 := new(object.Attribute) - require.NoError(t, a2.UnmarshalJSON(data)) - - require.Equal(t, a, a2) -} - -func TestSplitHeaderJSON(t *testing.T) { - h := generateSplit("sig") - - data, err := h.MarshalJSON() - require.NoError(t, err) - - h2 := new(object.SplitHeader) - require.NoError(t, h2.UnmarshalJSON(data)) - - require.Equal(t, h, h2) -} - -func TestHeaderJSON(t *testing.T) { - h := generateHeader(10) - - data, err := h.MarshalJSON() - require.NoError(t, err) - - h2 := new(object.Header) - require.NoError(t, h2.UnmarshalJSON(data)) - - require.Equal(t, h, h2) -} - -func TestHeaderWithSignatureJSON(t *testing.T) { - h := generateHeaderWithSignature() - - data, err := h.MarshalJSON() - require.NoError(t, err) - - h2 := new(object.HeaderWithSignature) - require.NoError(t, h2.UnmarshalJSON(data)) - - require.Equal(t, h, h2) -} - -func TestObjectJSON(t *testing.T) { - o := generateObject("data") - - data, err := o.MarshalJSON() - require.NoError(t, err) - - o2 := new(object.Object) - require.NoError(t, o2.UnmarshalJSON(data)) - - require.Equal(t, o, o2) -} - -func TestSearchFilterJSON(t *testing.T) { - f := generateFilter("key", "value") - - data, err := f.MarshalJSON() - require.NoError(t, err) - - f2 := new(object.SearchFilter) - require.NoError(t, f2.UnmarshalJSON(data)) - - require.Equal(t, f, f2) -} diff --git a/v2/object/marshal.go b/v2/object/marshal.go index b836d13..9897489 100644 --- a/v2/object/marshal.go +++ b/v2/object/marshal.go @@ -1,10 +1,10 @@ package object import ( + "github.com/nspcc-dev/neofs-api-go/rpc/message" "github.com/nspcc-dev/neofs-api-go/util/proto" object "github.com/nspcc-dev/neofs-api-go/v2/object/grpc" "github.com/nspcc-dev/neofs-api-go/v2/refs" - goproto "google.golang.org/protobuf/proto" ) const ( @@ -193,14 +193,7 @@ func (h *ShortHeader) StableSize() (size int) { } func (h *ShortHeader) Unmarshal(data []byte) error { - m := new(object.ShortHeader) - if err := goproto.Unmarshal(data, m); err != nil { - return err - } - - *h = *ShortHeaderFromGRPCMessage(m) - - return nil + return message.Unmarshal(h, data, new(object.ShortHeader)) } func (a *Attribute) StableMarshal(buf []byte) ([]byte, error) { @@ -244,14 +237,7 @@ func (a *Attribute) StableSize() (size int) { } func (a *Attribute) Unmarshal(data []byte) error { - m := new(object.Header_Attribute) - if err := goproto.Unmarshal(data, m); err != nil { - return err - } - - *a = *AttributeFromGRPCMessage(m) - - return nil + return message.Unmarshal(a, data, new(object.Header_Attribute)) } func (h *SplitHeader) StableMarshal(buf []byte) ([]byte, error) { @@ -327,14 +313,7 @@ func (h *SplitHeader) StableSize() (size int) { } func (h *SplitHeader) Unmarshal(data []byte) error { - m := new(object.Header_Split) - if err := goproto.Unmarshal(data, m); err != nil { - return err - } - - *h = *SplitHeaderFromGRPCMessage(m) - - return nil + return message.Unmarshal(h, data, new(object.Header_Split)) } func (h *Header) StableMarshal(buf []byte) ([]byte, error) { @@ -454,14 +433,7 @@ func (h *Header) StableSize() (size int) { } func (h *Header) Unmarshal(data []byte) error { - m := new(object.Header) - if err := goproto.Unmarshal(data, m); err != nil { - return err - } - - *h = *HeaderFromGRPCMessage(m) - - return nil + return message.Unmarshal(h, data, new(object.Header)) } func (h *HeaderWithSignature) StableMarshal(buf []byte) ([]byte, error) { @@ -505,14 +477,7 @@ func (h *HeaderWithSignature) StableSize() (size int) { } func (h *HeaderWithSignature) Unmarshal(data []byte) error { - m := new(object.HeaderWithSignature) - if err := goproto.Unmarshal(data, m); err != nil { - return err - } - - *h = *HeaderWithSignatureFromGRPCMessage(m) - - return nil + return message.Unmarshal(h, data, new(object.HeaderWithSignature)) } func (o *Object) StableMarshal(buf []byte) ([]byte, error) { @@ -571,30 +536,8 @@ func (o *Object) StableSize() (size int) { return size } -func (o *Object) StableUnmarshal(data []byte) error { - if o == nil { - return nil - } - - objGRPC := new(object.Object) - if err := goproto.Unmarshal(data, objGRPC); err != nil { - return err - } - - *o = *ObjectFromGRPCMessage(objGRPC) - - return nil -} - func (o *Object) Unmarshal(data []byte) error { - m := new(object.Object) - if err := goproto.Unmarshal(data, m); err != nil { - return err - } - - *o = *ObjectFromGRPCMessage(m) - - return nil + return message.Unmarshal(o, data, new(object.Object)) } func (s *SplitInfo) StableMarshal(buf []byte) ([]byte, error) { @@ -646,14 +589,7 @@ func (s *SplitInfo) StableSize() (size int) { } func (s *SplitInfo) Unmarshal(data []byte) error { - m := new(object.SplitInfo) - if err := goproto.Unmarshal(data, m); err != nil { - return err - } - - *s = *SplitInfoFromGRPCMessage(m) - - return nil + return message.Unmarshal(s, data, new(object.SplitInfo)) } func (r *GetRequestBody) StableMarshal(buf []byte) ([]byte, error) { @@ -696,6 +632,10 @@ func (r *GetRequestBody) StableSize() (size int) { return size } +func (r *GetRequestBody) Unmarshal(data []byte) error { + return message.Unmarshal(r, data, new(object.GetRequest_Body)) +} + func (r *GetObjectPartInit) StableMarshal(buf []byte) ([]byte, error) { if r == nil { return []byte{}, nil @@ -744,6 +684,10 @@ func (r *GetObjectPartInit) StableSize() (size int) { return size } +func (r *GetObjectPartInit) Unmarshal(data []byte) error { + return message.Unmarshal(r, data, new(object.GetResponse_Body_Init)) +} + func (r *GetResponseBody) StableMarshal(buf []byte) ([]byte, error) { if r == nil { return []byte{}, nil @@ -753,28 +697,27 @@ func (r *GetResponseBody) StableMarshal(buf []byte) ([]byte, error) { buf = make([]byte, r.StableSize()) } - if r.objPart != nil { - switch v := r.objPart.(type) { - case *GetObjectPartInit: - _, err := proto.NestedStructureMarshal(getRespBodyInitField, buf, v) - if err != nil { - return nil, err - } - case *GetObjectPartChunk: - if v != nil { - _, err := proto.BytesMarshal(getRespBodyChunkField, buf, v.chunk) - if err != nil { - return nil, err - } - } - case *SplitInfo: - _, err := proto.NestedStructureMarshal(getRespBodySplitInfoField, buf, v) - if err != nil { - return nil, err - } - default: - panic("unknown one of object get response body type") + switch v := r.objPart.(type) { + case nil: + case *GetObjectPartInit: + _, err := proto.NestedStructureMarshal(getRespBodyInitField, buf, v) + if err != nil { + return nil, err } + case *GetObjectPartChunk: + if v != nil { + _, err := proto.BytesMarshal(getRespBodyChunkField, buf, v.chunk) + if err != nil { + return nil, err + } + } + case *SplitInfo: + _, err := proto.NestedStructureMarshal(getRespBodySplitInfoField, buf, v) + if err != nil { + return nil, err + } + default: + panic("unknown one of object get response body type") } return buf, nil @@ -785,22 +728,25 @@ func (r *GetResponseBody) StableSize() (size int) { return 0 } - if r.objPart != nil { - switch v := r.objPart.(type) { - case *GetObjectPartInit: - size += proto.NestedStructureSize(getRespBodyInitField, v) - case *GetObjectPartChunk: - if v != nil { - size += proto.BytesSize(getRespBodyChunkField, v.chunk) - } - case *SplitInfo: - size += proto.NestedStructureSize(getRespBodySplitInfoField, v) - default: - panic("unknown one of object get response body type") + switch v := r.objPart.(type) { + case nil: + case *GetObjectPartInit: + size += proto.NestedStructureSize(getRespBodyInitField, v) + case *GetObjectPartChunk: + if v != nil { + size += proto.BytesSize(getRespBodyChunkField, v.chunk) } + case *SplitInfo: + size += proto.NestedStructureSize(getRespBodySplitInfoField, v) + default: + panic("unknown one of object get response body type") } - return size + return +} + +func (r *GetResponseBody) Unmarshal(data []byte) error { + return message.Unmarshal(r, data, new(object.GetResponse_Body)) } func (r *PutObjectPartInit) StableMarshal(buf []byte) ([]byte, error) { @@ -859,6 +805,10 @@ func (r *PutObjectPartInit) StableSize() (size int) { return size } +func (r *PutObjectPartInit) Unmarshal(data []byte) error { + return message.Unmarshal(r, data, new(object.PutRequest_Body_Init)) +} + func (r *PutRequestBody) StableMarshal(buf []byte) ([]byte, error) { if r == nil { return []byte{}, nil @@ -868,23 +818,22 @@ func (r *PutRequestBody) StableMarshal(buf []byte) ([]byte, error) { buf = make([]byte, r.StableSize()) } - if r.objPart != nil { - switch v := r.objPart.(type) { - case *PutObjectPartInit: - _, err := proto.NestedStructureMarshal(putReqBodyInitField, buf, v) + switch v := r.objPart.(type) { + case nil: + case *PutObjectPartInit: + _, err := proto.NestedStructureMarshal(putReqBodyInitField, buf, v) + if err != nil { + return nil, err + } + case *PutObjectPartChunk: + if v != nil { + _, err := proto.BytesMarshal(putReqBodyChunkField, buf, v.chunk) if err != nil { return nil, err } - case *PutObjectPartChunk: - if v != nil { - _, err := proto.BytesMarshal(putReqBodyChunkField, buf, v.chunk) - if err != nil { - return nil, err - } - } - default: - panic("unknown one of object put request body type") } + default: + panic("unknown one of object put request body type") } return buf, nil @@ -895,22 +844,25 @@ func (r *PutRequestBody) StableSize() (size int) { return 0 } - if r.objPart != nil { - switch v := r.objPart.(type) { - case *PutObjectPartInit: - size += proto.NestedStructureSize(putReqBodyInitField, v) - case *PutObjectPartChunk: - if v != nil { - size += proto.BytesSize(putReqBodyChunkField, v.chunk) - } - default: - panic("unknown one of object get response body type") + switch v := r.objPart.(type) { + case nil: + case *PutObjectPartInit: + size += proto.NestedStructureSize(putReqBodyInitField, v) + case *PutObjectPartChunk: + if v != nil { + size += proto.BytesSize(putReqBodyChunkField, v.chunk) } + default: + panic("unknown one of object get response body type") } return size } +func (r *PutRequestBody) Unmarshal(data []byte) error { + return message.Unmarshal(r, data, new(object.PutRequest_Body)) +} + func (r *PutResponseBody) StableMarshal(buf []byte) ([]byte, error) { if r == nil { return []byte{}, nil @@ -938,6 +890,10 @@ func (r *PutResponseBody) StableSize() (size int) { return size } +func (r *PutResponseBody) Unmarshal(data []byte) error { + return message.Unmarshal(r, data, new(object.PutResponse_Body)) +} + func (r *DeleteRequestBody) StableMarshal(buf []byte) ([]byte, error) { if r == nil { return []byte{}, nil @@ -965,6 +921,10 @@ func (r *DeleteRequestBody) StableSize() (size int) { return size } +func (r *DeleteRequestBody) Unmarshal(data []byte) error { + return message.Unmarshal(r, data, new(object.DeleteRequest_Body)) +} + func (r *DeleteResponseBody) StableMarshal(buf []byte) ([]byte, error) { if r == nil { return []byte{}, nil @@ -992,6 +952,10 @@ func (r *DeleteResponseBody) StableSize() (size int) { return size } +func (r *DeleteResponseBody) Unmarshal(data []byte) error { + return message.Unmarshal(r, data, new(object.DeleteResponse_Body)) +} + func (r *HeadRequestBody) StableMarshal(buf []byte) ([]byte, error) { if r == nil { return []byte{}, nil @@ -1040,6 +1004,10 @@ func (r *HeadRequestBody) StableSize() (size int) { return size } +func (r *HeadRequestBody) Unmarshal(data []byte) error { + return message.Unmarshal(r, data, new(object.HeadRequest_Body)) +} + func (r *HeadResponseBody) StableMarshal(buf []byte) ([]byte, error) { if r == nil { return []byte{}, nil @@ -1049,32 +1017,31 @@ func (r *HeadResponseBody) StableMarshal(buf []byte) ([]byte, error) { buf = make([]byte, r.StableSize()) } - if r.hdrPart != nil { - switch v := r.hdrPart.(type) { - case *HeaderWithSignature: - if v != nil { - _, err := proto.NestedStructureMarshal(headRespBodyHeaderField, buf, v) - if err != nil { - return nil, err - } + switch v := r.hdrPart.(type) { + case nil: + case *HeaderWithSignature: + if v != nil { + _, err := proto.NestedStructureMarshal(headRespBodyHeaderField, buf, v) + if err != nil { + return nil, err } - case *ShortHeader: - if v != nil { - _, err := proto.NestedStructureMarshal(headRespBodyShortHeaderField, buf, v) - if err != nil { - return nil, err - } - } - case *SplitInfo: - if v != nil { - _, err := proto.NestedStructureMarshal(headRespBodySplitInfoField, buf, v) - if err != nil { - return nil, err - } - } - default: - panic("unknown one of object put request body type") } + case *ShortHeader: + if v != nil { + _, err := proto.NestedStructureMarshal(headRespBodyShortHeaderField, buf, v) + if err != nil { + return nil, err + } + } + case *SplitInfo: + if v != nil { + _, err := proto.NestedStructureMarshal(headRespBodySplitInfoField, buf, v) + if err != nil { + return nil, err + } + } + default: + panic("unknown one of object put request body type") } return buf, nil @@ -1085,26 +1052,29 @@ func (r *HeadResponseBody) StableSize() (size int) { return 0 } - if r.hdrPart != nil { - switch v := r.hdrPart.(type) { - case *HeaderWithSignature: - if v != nil { - size += proto.NestedStructureSize(headRespBodyHeaderField, v) - } - case *ShortHeader: - if v != nil { - size += proto.NestedStructureSize(headRespBodyShortHeaderField, v) - } - case *SplitInfo: - if v != nil { - size += proto.NestedStructureSize(headRespBodySplitInfoField, v) - } - default: - panic("unknown one of object put request body type") + switch v := r.hdrPart.(type) { + case nil: + case *HeaderWithSignature: + if v != nil { + size += proto.NestedStructureSize(headRespBodyHeaderField, v) } + case *ShortHeader: + if v != nil { + size += proto.NestedStructureSize(headRespBodyShortHeaderField, v) + } + case *SplitInfo: + if v != nil { + size += proto.NestedStructureSize(headRespBodySplitInfoField, v) + } + default: + panic("unknown one of object put request body type") } - return size + return +} + +func (r *HeadResponseBody) Unmarshal(data []byte) error { + return message.Unmarshal(r, data, new(object.HeadResponse_Body)) } func (f *SearchFilter) StableMarshal(buf []byte) ([]byte, error) { @@ -1155,6 +1125,10 @@ func (f *SearchFilter) StableSize() (size int) { return size } +func (f *SearchFilter) Unmarshal(data []byte) error { + return message.Unmarshal(f, data, new(object.SearchRequest_Body_Filter)) +} + func (r *SearchRequestBody) StableMarshal(buf []byte) ([]byte, error) { if r == nil { return []byte{}, nil @@ -1210,6 +1184,10 @@ func (r *SearchRequestBody) StableSize() (size int) { return size } +func (r *SearchRequestBody) Unmarshal(data []byte) error { + return message.Unmarshal(r, data, new(object.SearchRequest_Body)) +} + func (r *SearchResponseBody) StableMarshal(buf []byte) ([]byte, error) { if r == nil { return []byte{}, nil @@ -1242,6 +1220,10 @@ func (r *SearchResponseBody) StableSize() (size int) { return size } +func (r *SearchResponseBody) Unmarshal(data []byte) error { + return message.Unmarshal(r, data, new(object.SearchResponse_Body)) +} + func (r *Range) StableMarshal(buf []byte) ([]byte, error) { if r == nil { return []byte{}, nil @@ -1282,6 +1264,10 @@ func (r *Range) StableSize() (size int) { return size } +func (r *Range) Unmarshal(data []byte) error { + return message.Unmarshal(r, data, new(object.Range)) +} + func (r *GetRangeRequestBody) StableMarshal(buf []byte) ([]byte, error) { if r == nil { return []byte{}, nil @@ -1330,6 +1316,10 @@ func (r *GetRangeRequestBody) StableSize() (size int) { return size } +func (r *GetRangeRequestBody) Unmarshal(data []byte) error { + return message.Unmarshal(r, data, new(object.GetRangeRequest_Body)) +} + func (r *GetRangeResponseBody) StableMarshal(buf []byte) ([]byte, error) { if r == nil { return []byte{}, nil @@ -1339,25 +1329,24 @@ func (r *GetRangeResponseBody) StableMarshal(buf []byte) ([]byte, error) { buf = make([]byte, r.StableSize()) } - if r.rngPart != nil { - switch v := r.rngPart.(type) { - case *GetRangePartChunk: - if v != nil { - _, err := proto.BytesMarshal(getRangeRespChunkField, buf, v.chunk) - if err != nil { - return nil, err - } + switch v := r.rngPart.(type) { + case nil: + case *GetRangePartChunk: + if v != nil { + _, err := proto.BytesMarshal(getRangeRespChunkField, buf, v.chunk) + if err != nil { + return nil, err } - case *SplitInfo: - if v != nil { - _, err := proto.NestedStructureMarshal(getRangeRespSplitInfoField, buf, v) - if err != nil { - return nil, err - } - } - default: - panic("unknown one of object get range request body type") } + case *SplitInfo: + if v != nil { + _, err := proto.NestedStructureMarshal(getRangeRespSplitInfoField, buf, v) + if err != nil { + return nil, err + } + } + default: + panic("unknown one of object get range request body type") } return buf, nil @@ -1368,22 +1357,25 @@ func (r *GetRangeResponseBody) StableSize() (size int) { return 0 } - if r.rngPart != nil { - switch v := r.rngPart.(type) { - case *GetRangePartChunk: - if v != nil { - size += proto.BytesSize(getRangeRespChunkField, v.chunk) - } - case *SplitInfo: - if v != nil { - size = proto.NestedStructureSize(getRangeRespSplitInfoField, v) - } - default: - panic("unknown one of object get range request body type") + switch v := r.rngPart.(type) { + case nil: + case *GetRangePartChunk: + if v != nil { + size += proto.BytesSize(getRangeRespChunkField, v.chunk) } + case *SplitInfo: + if v != nil { + size = proto.NestedStructureSize(getRangeRespSplitInfoField, v) + } + default: + panic("unknown one of object get range request body type") } - return size + return +} + +func (r *GetRangeResponseBody) Unmarshal(data []byte) error { + return message.Unmarshal(r, data, new(object.GetRangeResponse_Body)) } func (r *GetRangeHashRequestBody) StableMarshal(buf []byte) ([]byte, error) { @@ -1448,6 +1440,10 @@ func (r *GetRangeHashRequestBody) StableSize() (size int) { return size } +func (r *GetRangeHashRequestBody) Unmarshal(data []byte) error { + return message.Unmarshal(r, data, new(object.GetRangeHashRequest_Body)) +} + func (r *GetRangeHashResponseBody) StableMarshal(buf []byte) ([]byte, error) { if r == nil { return []byte{}, nil @@ -1487,3 +1483,7 @@ func (r *GetRangeHashResponseBody) StableSize() (size int) { return size } + +func (r *GetRangeHashResponseBody) Unmarshal(data []byte) error { + return message.Unmarshal(r, data, new(object.GetRangeHashResponse_Body)) +} diff --git a/v2/object/marshal_test.go b/v2/object/marshal_test.go deleted file mode 100644 index c2686dc..0000000 --- a/v2/object/marshal_test.go +++ /dev/null @@ -1,776 +0,0 @@ -package object_test - -import ( - "fmt" - "strconv" - "testing" - - "github.com/nspcc-dev/neofs-api-go/v2/object" - grpc "github.com/nspcc-dev/neofs-api-go/v2/object/grpc" - "github.com/nspcc-dev/neofs-api-go/v2/refs" - "github.com/nspcc-dev/neofs-api-go/v2/session" - "github.com/stretchr/testify/require" - goproto "google.golang.org/protobuf/proto" -) - -func TestShortHeader_StableMarshal(t *testing.T) { - hdrFrom := generateShortHeader("Owner ID") - - t.Run("non empty", func(t *testing.T) { - wire, err := hdrFrom.StableMarshal(nil) - require.NoError(t, err) - - hdrTo := new(object.ShortHeader) - require.NoError(t, hdrTo.Unmarshal(wire)) - - require.Equal(t, hdrFrom, hdrTo) - }) -} - -func TestAttribute_StableMarshal(t *testing.T) { - from := generateAttribute("Key", "Value") - - t.Run("non empty", func(t *testing.T) { - wire, err := from.StableMarshal(nil) - require.NoError(t, err) - - to := new(object.Attribute) - require.NoError(t, to.Unmarshal(wire)) - - require.Equal(t, from, to) - }) -} - -func TestSplitHeader_StableMarshal(t *testing.T) { - from := generateSplit("Split Outside") - hdr := generateHeader(123) - from.SetParentHeader(hdr) - - t.Run("non empty", func(t *testing.T) { - wire, err := from.StableMarshal(nil) - require.NoError(t, err) - - to := new(object.SplitHeader) - require.NoError(t, to.Unmarshal(wire)) - - require.Equal(t, from, to) - }) -} - -func TestHeader_StableMarshal(t *testing.T) { - insideHeader := generateHeader(100) - split := generateSplit("Split") - split.SetParentHeader(insideHeader) - - from := generateHeader(500) - from.SetSplit(split) - - t.Run("non empty", func(t *testing.T) { - wire, err := from.StableMarshal(nil) - require.NoError(t, err) - - to := new(object.Header) - require.NoError(t, to.Unmarshal(wire)) - - require.Equal(t, from, to) - }) -} - -func TestObject_StableMarshal(t *testing.T) { - from := generateObject("Payload") - - t.Run("non empty", func(t *testing.T) { - wire, err := from.StableMarshal(nil) - require.NoError(t, err) - - to := new(object.Object) - require.NoError(t, to.Unmarshal(wire)) - - require.Equal(t, from, to) - }) -} - -func TestGetRequestBody_StableMarshal(t *testing.T) { - from := generateGetRequestBody("Container ID", "Object ID") - transport := new(grpc.GetRequest_Body) - - t.Run("non empty", func(t *testing.T) { - wire, err := from.StableMarshal(nil) - require.NoError(t, err) - - err = goproto.Unmarshal(wire, transport) - require.NoError(t, err) - - to := object.GetRequestBodyFromGRPCMessage(transport) - require.Equal(t, from, to) - }) -} - -func TestGetResponseBody_StableMarshal(t *testing.T) { - initFrom := generateGetResponseBody(0) - chunkFrom := generateGetResponseBody(1) - splitInfoFrom := generateGetResponseBody(2) - transport := new(grpc.GetResponse_Body) - - t.Run("init non empty", func(t *testing.T) { - wire, err := initFrom.StableMarshal(nil) - require.NoError(t, err) - - err = goproto.Unmarshal(wire, transport) - require.NoError(t, err) - - to := object.GetResponseBodyFromGRPCMessage(transport) - require.Equal(t, initFrom, to) - }) - - t.Run("chunk non empty", func(t *testing.T) { - wire, err := chunkFrom.StableMarshal(nil) - require.NoError(t, err) - - err = goproto.Unmarshal(wire, transport) - require.NoError(t, err) - - to := object.GetResponseBodyFromGRPCMessage(transport) - require.Equal(t, chunkFrom, to) - }) - - t.Run("split info non empty", func(t *testing.T) { - wire, err := splitInfoFrom.StableMarshal(nil) - require.NoError(t, err) - - err = goproto.Unmarshal(wire, transport) - require.NoError(t, err) - - to := object.GetResponseBodyFromGRPCMessage(transport) - require.Equal(t, splitInfoFrom, to) - }) -} - -func TestPutRequestBody_StableMarshal(t *testing.T) { - initFrom := generatePutRequestBody(true) - chunkFrom := generatePutRequestBody(false) - transport := new(grpc.PutRequest_Body) - - t.Run("init non empty", func(t *testing.T) { - wire, err := initFrom.StableMarshal(nil) - require.NoError(t, err) - - err = goproto.Unmarshal(wire, transport) - require.NoError(t, err) - - to := object.PutRequestBodyFromGRPCMessage(transport) - require.Equal(t, initFrom, to) - }) - - t.Run("chunk non empty", func(t *testing.T) { - wire, err := chunkFrom.StableMarshal(nil) - require.NoError(t, err) - - err = goproto.Unmarshal(wire, transport) - require.NoError(t, err) - - to := object.PutRequestBodyFromGRPCMessage(transport) - require.Equal(t, chunkFrom, to) - }) -} - -func TestPutRequestBody_StableSize(t *testing.T) { - from := generatePutResponseBody("Object ID") - transport := new(grpc.PutResponse_Body) - - t.Run("non empty", func(t *testing.T) { - wire, err := from.StableMarshal(nil) - require.NoError(t, err) - - err = goproto.Unmarshal(wire, transport) - require.NoError(t, err) - - to := object.PutResponseBodyFromGRPCMessage(transport) - require.Equal(t, from, to) - }) -} - -func TestDeleteRequestBody_StableMarshal(t *testing.T) { - from := generateDeleteRequestBody("Container ID", "Object ID") - transport := new(grpc.DeleteRequest_Body) - - t.Run("non empty", func(t *testing.T) { - wire, err := from.StableMarshal(nil) - require.NoError(t, err) - - err = goproto.Unmarshal(wire, transport) - require.NoError(t, err) - - to := object.DeleteRequestBodyFromGRPCMessage(transport) - require.Equal(t, from, to) - }) -} - -func TestDeleteResponseBody_StableMarshal(t *testing.T) { - from := generateDeleteResponseBody("CID", "OID") - transport := new(grpc.DeleteResponse_Body) - - t.Run("non empty", func(t *testing.T) { - wire, err := from.StableMarshal(nil) - require.NoError(t, err) - - err = goproto.Unmarshal(wire, transport) - require.NoError(t, err) - - to := object.DeleteResponseBodyFromGRPCMessage(transport) - require.Equal(t, from, to) - }) -} - -func TestSplitHeaderFromGRPCMessage(t *testing.T) { - from := generateHeadRequestBody("Container ID", "Object ID") - transport := new(grpc.HeadRequest_Body) - - t.Run("non empty", func(t *testing.T) { - wire, err := from.StableMarshal(nil) - require.NoError(t, err) - - err = goproto.Unmarshal(wire, transport) - require.NoError(t, err) - - to := object.HeadRequestBodyFromGRPCMessage(transport) - require.Equal(t, from, to) - }) -} - -func TestHeadResponseBody_StableMarshal(t *testing.T) { - shortFrom := generateHeadResponseBody(0) - fullFrom := generateHeadResponseBody(1) - splitInfoFrom := generateHeadResponseBody(2) - transport := new(grpc.HeadResponse_Body) - - t.Run("short header non empty", func(t *testing.T) { - wire, err := shortFrom.StableMarshal(nil) - require.NoError(t, err) - - err = goproto.Unmarshal(wire, transport) - require.NoError(t, err) - - to := object.HeadResponseBodyFromGRPCMessage(transport) - require.Equal(t, shortFrom, to) - }) - - t.Run("full header non empty", func(t *testing.T) { - wire, err := fullFrom.StableMarshal(nil) - require.NoError(t, err) - - err = goproto.Unmarshal(wire, transport) - require.NoError(t, err) - - to := object.HeadResponseBodyFromGRPCMessage(transport) - require.Equal(t, fullFrom, to) - }) - - t.Run("split info non empty", func(t *testing.T) { - wire, err := splitInfoFrom.StableMarshal(nil) - require.NoError(t, err) - - err = goproto.Unmarshal(wire, transport) - require.NoError(t, err) - - to := object.HeadResponseBodyFromGRPCMessage(transport) - require.Equal(t, splitInfoFrom, to) - }) -} - -func TestSearchRequestBody_StableMarshal(t *testing.T) { - from := generateSearchRequestBody(10, "Container ID") - transport := new(grpc.SearchRequest_Body) - - t.Run("non empty", func(t *testing.T) { - wire, err := from.StableMarshal(nil) - require.NoError(t, err) - - err = goproto.Unmarshal(wire, transport) - require.NoError(t, err) - - to := object.SearchRequestBodyFromGRPCMessage(transport) - require.Equal(t, from, to) - }) -} - -func TestSearchResponseBody_StableMarshal(t *testing.T) { - from := generateSearchResponseBody(10) - transport := new(grpc.SearchResponse_Body) - - t.Run("non empty", func(t *testing.T) { - wire, err := from.StableMarshal(nil) - require.NoError(t, err) - - err = goproto.Unmarshal(wire, transport) - require.NoError(t, err) - - to := object.SearchResponseBodyFromGRPCMessage(transport) - require.Equal(t, from, to) - }) -} - -func TestGetRangeRequestBody_StableMarshal(t *testing.T) { - from := generateRangeRequestBody("Container ID", "Object ID") - transport := new(grpc.GetRangeRequest_Body) - - t.Run("non empty", func(t *testing.T) { - wire, err := from.StableMarshal(nil) - require.NoError(t, err) - - err = goproto.Unmarshal(wire, transport) - require.NoError(t, err) - - to := object.GetRangeRequestBodyFromGRPCMessage(transport) - require.Equal(t, from, to) - }) -} - -func TestGetRangeResponseBody_StableMarshal(t *testing.T) { - dataFrom := generateRangeResponseBody("some data", true) - splitInfoFrom := generateRangeResponseBody("some data", false) - transport := new(grpc.GetRangeResponse_Body) - - t.Run("data non empty", func(t *testing.T) { - wire, err := dataFrom.StableMarshal(nil) - require.NoError(t, err) - - err = goproto.Unmarshal(wire, transport) - require.NoError(t, err) - - to := object.GetRangeResponseBodyFromGRPCMessage(transport) - require.Equal(t, dataFrom, to) - }) - - t.Run("split info non empty", func(t *testing.T) { - wire, err := splitInfoFrom.StableMarshal(nil) - require.NoError(t, err) - - err = goproto.Unmarshal(wire, transport) - require.NoError(t, err) - - to := object.GetRangeResponseBodyFromGRPCMessage(transport) - require.Equal(t, splitInfoFrom, to) - }) -} - -func TestGetRangeHashRequestBody_StableMarshal(t *testing.T) { - from := generateRangeHashRequestBody("Container ID", "Object ID", 5) - transport := new(grpc.GetRangeHashRequest_Body) - - t.Run("non empty", func(t *testing.T) { - wire, err := from.StableMarshal(nil) - require.NoError(t, err) - - err = goproto.Unmarshal(wire, transport) - require.NoError(t, err) - - to := object.GetRangeHashRequestBodyFromGRPCMessage(transport) - require.Equal(t, from, to) - }) -} - -func TestGetRangeHashResponseBody_StableMarshal(t *testing.T) { - from := generateRangeHashResponseBody(5) - transport := new(grpc.GetRangeHashResponse_Body) - - t.Run("non empty", func(t *testing.T) { - wire, err := from.StableMarshal(nil) - require.NoError(t, err) - - err = goproto.Unmarshal(wire, transport) - require.NoError(t, err) - - to := object.GetRangeHashResponseBodyFromGRPCMessage(transport) - require.Equal(t, from, to) - }) -} - -func TestHeaderWithSignature_StableMarshal(t *testing.T) { - from := generateHeaderWithSignature() - - t.Run("non empty", func(t *testing.T) { - wire, err := from.StableMarshal(nil) - require.NoError(t, err) - - to := new(object.HeaderWithSignature) - require.NoError(t, to.Unmarshal(wire)) - - require.Equal(t, from, to) - }) -} - -func generateOwner(id string) *refs.OwnerID { - owner := new(refs.OwnerID) - owner.SetValue([]byte(id)) - - return owner -} - -func generateObjectID(id string) *refs.ObjectID { - oid := new(refs.ObjectID) - oid.SetValue([]byte(id)) - - return oid -} - -func generateContainerID(id string) *refs.ContainerID { - cid := new(refs.ContainerID) - cid.SetValue([]byte(id)) - - return cid -} - -func generateSignature(k, v string) *refs.Signature { - sig := new(refs.Signature) - sig.SetKey([]byte(k)) - sig.SetSign([]byte(v)) - - return sig -} - -func generateVersion(maj, min uint32) *refs.Version { - version := new(refs.Version) - version.SetMajor(maj) - version.SetMinor(min) - - return version -} - -func generateAddress(cid, oid string) *refs.Address { - addr := new(refs.Address) - addr.SetObjectID(generateObjectID(oid)) - addr.SetContainerID(generateContainerID(cid)) - - return addr -} - -func generateSessionToken(id string) *session.SessionToken { - lifetime := new(session.TokenLifetime) - lifetime.SetExp(1) - lifetime.SetNbf(2) - lifetime.SetIat(3) - - objectCtx := new(session.ObjectSessionContext) - objectCtx.SetVerb(session.ObjectVerbPut) - objectCtx.SetAddress(generateAddress("Container ID", "Object ID")) - - tokenBody := new(session.SessionTokenBody) - tokenBody.SetID([]byte(id)) - tokenBody.SetOwnerID(generateOwner("Owner ID")) - tokenBody.SetSessionKey([]byte(id)) - tokenBody.SetLifetime(lifetime) - tokenBody.SetContext(objectCtx) - - sessionToken := new(session.SessionToken) - sessionToken.SetBody(tokenBody) - sessionToken.SetSignature(generateSignature("public key", id)) - - return sessionToken -} - -func generateShortHeader(id string) *object.ShortHeader { - hdr := new(object.ShortHeader) - hdr.SetOwnerID(generateOwner(id)) - hdr.SetVersion(generateVersion(2, 0)) - hdr.SetCreationEpoch(200) - hdr.SetObjectType(object.TypeRegular) - hdr.SetPayloadLength(10) - hdr.SetPayloadHash(generateChecksum("payload hash")) - hdr.SetHomomorphicHash(generateChecksum("homomorphic hash")) - - return hdr -} - -func generateAttribute(k, v string) *object.Attribute { - attr := new(object.Attribute) - attr.SetValue(v) - attr.SetKey(k) - - return attr -} - -func generateSplit(sig string) *object.SplitHeader { - split := new(object.SplitHeader) - split.SetChildren([]*refs.ObjectID{ - generateObjectID("Child 1"), - generateObjectID("Child 2"), - }) - split.SetParent(generateObjectID("Parent")) - split.SetParentSignature(generateSignature("Key", sig)) - split.SetPrevious(generateObjectID("Previous")) - split.SetSplitID([]byte("UUIDv4")) - - return split -} - -func generateChecksum(data string) *refs.Checksum { - checksum := new(refs.Checksum) - checksum.SetType(refs.TillichZemor) - checksum.SetSum([]byte(data)) - - return checksum -} - -func generateHeader(ln uint64) *object.Header { - hdr := new(object.Header) - hdr.SetPayloadLength(ln) - hdr.SetCreationEpoch(ln / 2) - hdr.SetVersion(generateVersion(2, 0)) - hdr.SetOwnerID(generateOwner("Owner ID")) - hdr.SetContainerID(generateContainerID("Contanier ID")) - hdr.SetAttributes([]*object.Attribute{ - generateAttribute("One", "Two"), - generateAttribute("Three", "Four"), - }) - hdr.SetHomomorphicHash(generateChecksum("Homomorphic Hash")) - hdr.SetObjectType(object.TypeRegular) - hdr.SetPayloadHash(generateChecksum("Payload Hash")) - hdr.SetSessionToken(generateSessionToken(strconv.Itoa(int(ln)))) - - return hdr -} - -func generateObject(data string) *object.Object { - insideHeader := generateHeader(100) - split := generateSplit("Split") - split.SetParentHeader(insideHeader) - - outsideHeader := generateHeader(500) - outsideHeader.SetSplit(split) - - obj := new(object.Object) - obj.SetSignature(generateSignature("Public Key", "Signature")) - obj.SetObjectID(generateObjectID("Object ID")) - obj.SetPayload([]byte(data)) - obj.SetHeader(outsideHeader) - - return obj -} - -func generateGetRequestBody(cid, oid string) *object.GetRequestBody { - req := new(object.GetRequestBody) - req.SetAddress(generateAddress(cid, oid)) - req.SetRaw(true) - - return req -} - -func generateGetResponseBody(i int) *object.GetResponseBody { - resp := new(object.GetResponseBody) - var part object.GetObjectPart - - switch i { - case 0: - init := new(object.GetObjectPartInit) - init.SetObjectID(generateObjectID("Object ID")) - init.SetSignature(generateSignature("Key", "Signature")) - init.SetHeader(generateHeader(10)) - part = init - case 1: - chunk := new(object.GetObjectPartChunk) - chunk.SetChunk([]byte("Some data chunk")) - part = chunk - default: - part = generateSplitInfo() - } - - resp.SetObjectPart(part) - - return resp -} - -func generatePutRequestBody(flag bool) *object.PutRequestBody { - req := new(object.PutRequestBody) - var part object.PutObjectPart - - if flag { - init := new(object.PutObjectPartInit) - init.SetObjectID(generateObjectID("Object ID")) - init.SetSignature(generateSignature("Key", "Signature")) - init.SetHeader(generateHeader(10)) - init.SetCopiesNumber(1) - part = init - } else { - chunk := new(object.PutObjectPartChunk) - chunk.SetChunk([]byte("Some data chunk")) - part = chunk - } - req.SetObjectPart(part) - - return req -} - -func generatePutResponseBody(oid string) *object.PutResponseBody { - resp := new(object.PutResponseBody) - resp.SetObjectID(generateObjectID(oid)) - - return resp -} - -func generateDeleteRequestBody(cid, oid string) *object.DeleteRequestBody { - req := new(object.DeleteRequestBody) - req.SetAddress(generateAddress(cid, oid)) - - return req -} - -func generateDeleteResponseBody(cid, oid string) *object.DeleteResponseBody { - resp := new(object.DeleteResponseBody) - resp.SetTombstone(generateAddress(cid, oid)) - - return resp -} - -func generateHeadRequestBody(cid, oid string) *object.HeadRequestBody { - req := new(object.HeadRequestBody) - req.SetAddress(generateAddress(cid, oid)) - req.SetRaw(true) - req.SetMainOnly(true) - - return req -} - -func generateHeadResponseBody(flag int) *object.HeadResponseBody { - req := new(object.HeadResponseBody) - var part object.GetHeaderPart - - switch flag { - case 0: - part = generateShortHeader("short id") - case 1: - part = generateHeaderWithSignature() - default: - part = generateSplitInfo() - } - - req.SetHeaderPart(part) - - return req -} - -func generateHeaderWithSignature() *object.HeaderWithSignature { - hdrWithSig := new(object.HeaderWithSignature) - hdrWithSig.SetHeader(generateHeader(30)) - hdrWithSig.SetSignature(generateSignature("sig", "key")) - - return hdrWithSig -} - -func generateFilter(k, v string) *object.SearchFilter { - f := new(object.SearchFilter) - f.SetKey(k) - f.SetValue(v) - f.SetMatchType(object.MatchStringEqual) - - return f -} - -func generateSearchRequestBody(n int, id string) *object.SearchRequestBody { - req := new(object.SearchRequestBody) - req.SetContainerID(generateContainerID(id)) - req.SetVersion(1) - - ff := make([]*object.SearchFilter, n) - - for i := 0; i < n; i++ { - ff[i] = generateFilter("Some Key", fmt.Sprintf("Value %d", i+1)) - } - req.SetFilters(ff) - - return req -} - -func generateSearchResponseBody(n int) *object.SearchResponseBody { - resp := new(object.SearchResponseBody) - list := make([]*refs.ObjectID, n) - for i := 0; i < n; i++ { - list[i] = generateObjectID(fmt.Sprintf("Object ID %d", i+1)) - } - - resp.SetIDList(list) - - return resp -} - -func generateRange(off, ln uint64) *object.Range { - r := new(object.Range) - r.SetOffset(off) - r.SetLength(ln) - - return r -} - -func generateRangeRequestBody(cid, oid string) *object.GetRangeRequestBody { - req := new(object.GetRangeRequestBody) - req.SetAddress(generateAddress(cid, oid)) - req.SetRange(generateRange(10, 20)) - req.SetRaw(true) - - return req -} - -func generateRangeResponseBody(data string, flag bool) *object.GetRangeResponseBody { - resp := new(object.GetRangeResponseBody) - - if flag { - p := new(object.GetRangePartChunk) - p.SetChunk([]byte(data)) - resp.SetRangePart(p) - } else { - resp.SetRangePart(generateSplitInfo()) - } - - return resp -} - -func generateRangeHashRequestBody(cid, oid string, n int) *object.GetRangeHashRequestBody { - req := new(object.GetRangeHashRequestBody) - req.SetAddress(generateAddress(cid, oid)) - - rngs := make([]*object.Range, n) - for i := 0; i < n; i++ { - rngs[i] = generateRange(100, 200+uint64(n)) - } - - req.SetRanges(rngs) - req.SetSalt([]byte("xor salt")) - req.SetType(refs.TillichZemor) - - return req -} - -func generateRangeHashResponseBody(n int) *object.GetRangeHashResponseBody { - resp := new(object.GetRangeHashResponseBody) - - list := make([][]byte, n) - for i := 0; i < n; i++ { - list[i] = []byte("Some homomorphic hash data" + strconv.Itoa(n)) - } - - resp.SetType(refs.TillichZemor) - resp.SetHashList(list) - - return resp -} - -func TestObject_StableUnmarshal(t *testing.T) { - obj := generateObject("some data") - - data, err := obj.StableMarshal(nil) - require.NoError(t, err) - - obj2 := new(object.Object) - require.NoError(t, obj2.StableUnmarshal(data)) - - require.Equal(t, obj, obj2) -} - -func generateSplitInfo() *object.SplitInfo { - splitInfo := new(object.SplitInfo) - splitInfo.SetSplitID([]byte("splitID")) - splitInfo.SetLastPart(generateObjectID("Right ID")) - splitInfo.SetLink(generateObjectID("Link ID")) - - return splitInfo -} diff --git a/v2/object/message_test.go b/v2/object/message_test.go new file mode 100644 index 0000000..1639f35 --- /dev/null +++ b/v2/object/message_test.go @@ -0,0 +1,54 @@ +package object_test + +import ( + "testing" + + "github.com/nspcc-dev/neofs-api-go/rpc/message" + messagetest "github.com/nspcc-dev/neofs-api-go/rpc/message/test" + objecttest "github.com/nspcc-dev/neofs-api-go/v2/object/test" +) + +func TestMessageConvert(t *testing.T) { + messagetest.TestRPCMessage(t, + func(empty bool) message.Message { return objecttest.GenerateShortHeader(empty) }, + func(empty bool) message.Message { return objecttest.GenerateAttribute(empty) }, + func(empty bool) message.Message { return objecttest.GenerateSplitHeader(empty) }, + func(empty bool) message.Message { return objecttest.GenerateHeader(empty) }, + func(empty bool) message.Message { return objecttest.GenerateObject(empty) }, + func(empty bool) message.Message { return objecttest.GenerateSplitInfo(empty) }, + func(empty bool) message.Message { return objecttest.GenerateGetRequestBody(empty) }, + func(empty bool) message.Message { return objecttest.GenerateGetRequest(empty) }, + func(empty bool) message.Message { return objecttest.GenerateGetObjectPartInit(empty) }, + func(empty bool) message.Message { return objecttest.GenerateGetObjectPartChunk(empty) }, + func(empty bool) message.Message { return objecttest.GenerateGetResponseBody(empty) }, + func(empty bool) message.Message { return objecttest.GenerateGetResponse(empty) }, + func(empty bool) message.Message { return objecttest.GeneratePutObjectPartInit(empty) }, + func(empty bool) message.Message { return objecttest.GeneratePutObjectPartChunk(empty) }, + func(empty bool) message.Message { return objecttest.GeneratePutRequestBody(empty) }, + func(empty bool) message.Message { return objecttest.GeneratePutRequest(empty) }, + func(empty bool) message.Message { return objecttest.GeneratePutResponseBody(empty) }, + func(empty bool) message.Message { return objecttest.GeneratePutResponse(empty) }, + func(empty bool) message.Message { return objecttest.GenerateDeleteRequestBody(empty) }, + func(empty bool) message.Message { return objecttest.GenerateDeleteRequest(empty) }, + func(empty bool) message.Message { return objecttest.GenerateDeleteResponseBody(empty) }, + func(empty bool) message.Message { return objecttest.GenerateDeleteResponse(empty) }, + func(empty bool) message.Message { return objecttest.GenerateHeadRequestBody(empty) }, + func(empty bool) message.Message { return objecttest.GenerateHeadRequest(empty) }, + func(empty bool) message.Message { return objecttest.GenerateHeadResponseBody(empty) }, + func(empty bool) message.Message { return objecttest.GenerateHeadResponse(empty) }, + func(empty bool) message.Message { return objecttest.GenerateSearchFilter(empty) }, + func(empty bool) message.Message { return objecttest.GenerateSearchRequestBody(empty) }, + func(empty bool) message.Message { return objecttest.GenerateSearchRequest(empty) }, + func(empty bool) message.Message { return objecttest.GenerateSearchResponseBody(empty) }, + func(empty bool) message.Message { return objecttest.GenerateSearchResponse(empty) }, + func(empty bool) message.Message { return objecttest.GenerateRange(empty) }, + func(empty bool) message.Message { return objecttest.GenerateGetRangeRequestBody(empty) }, + func(empty bool) message.Message { return objecttest.GenerateGetRangeRequest(empty) }, + func(empty bool) message.Message { return objecttest.GenerateGetRangeResponseBody(empty) }, + func(empty bool) message.Message { return objecttest.GenerateGetRangeResponse(empty) }, + func(empty bool) message.Message { return objecttest.GenerateGetRangeHashRequestBody(empty) }, + func(empty bool) message.Message { return objecttest.GenerateGetRangeHashRequest(empty) }, + func(empty bool) message.Message { return objecttest.GenerateGetRangeHashResponseBody(empty) }, + func(empty bool) message.Message { return objecttest.GenerateGetRangeHashResponse(empty) }, + ) +} diff --git a/v2/object/service.go b/v2/object/service.go deleted file mode 100644 index 2bf69c8..0000000 --- a/v2/object/service.go +++ /dev/null @@ -1,129 +0,0 @@ -package object - -import ( - "context" - - "github.com/nspcc-dev/neofs-api-go/v2/session" -) - -type Service interface { - Get(context.Context, *GetRequest) (GetObjectStreamer, error) - Put(context.Context) (PutObjectStreamer, error) - Head(context.Context, *HeadRequest) (*HeadResponse, error) - Search(context.Context, *SearchRequest) (SearchObjectStreamer, error) - Delete(context.Context, *DeleteRequest) (*DeleteResponse, error) - GetRange(context.Context, *GetRangeRequest) (GetRangeObjectStreamer, error) - GetRangeHash(context.Context, *GetRangeHashRequest) (*GetRangeHashResponse, error) -} - -type GetRequest struct { - body *GetRequestBody - - metaHeader *session.RequestMetaHeader - - verifyHeader *session.RequestVerificationHeader -} - -type GetResponse struct { - body *GetResponseBody - - metaHeader *session.ResponseMetaHeader - - verifyHeader *session.ResponseVerificationHeader -} - -type PutRequest struct { - body *PutRequestBody - - metaHeader *session.RequestMetaHeader - - verifyHeader *session.RequestVerificationHeader -} - -type PutResponse struct { - body *PutResponseBody - - metaHeader *session.ResponseMetaHeader - - verifyHeader *session.ResponseVerificationHeader -} - -type DeleteRequest struct { - body *DeleteRequestBody - - metaHeader *session.RequestMetaHeader - - verifyHeader *session.RequestVerificationHeader -} - -type DeleteResponse struct { - body *DeleteResponseBody - - metaHeader *session.ResponseMetaHeader - - verifyHeader *session.ResponseVerificationHeader -} - -type HeadRequest struct { - body *HeadRequestBody - - metaHeader *session.RequestMetaHeader - - verifyHeader *session.RequestVerificationHeader -} - -type HeadResponse struct { - body *HeadResponseBody - - metaHeader *session.ResponseMetaHeader - - verifyHeader *session.ResponseVerificationHeader -} - -type SearchRequest struct { - body *SearchRequestBody - - metaHeader *session.RequestMetaHeader - - verifyHeader *session.RequestVerificationHeader -} - -type SearchResponse struct { - body *SearchResponseBody - - metaHeader *session.ResponseMetaHeader - - verifyHeader *session.ResponseVerificationHeader -} - -type GetRangeRequest struct { - body *GetRangeRequestBody - - metaHeader *session.RequestMetaHeader - - verifyHeader *session.RequestVerificationHeader -} - -type GetRangeResponse struct { - body *GetRangeResponseBody - - metaHeader *session.ResponseMetaHeader - - verifyHeader *session.ResponseVerificationHeader -} - -type GetRangeHashRequest struct { - body *GetRangeHashRequestBody - - metaHeader *session.RequestMetaHeader - - verifyHeader *session.RequestVerificationHeader -} - -type GetRangeHashResponse struct { - body *GetRangeHashResponseBody - - metaHeader *session.ResponseMetaHeader - - verifyHeader *session.ResponseVerificationHeader -} diff --git a/v2/object/test/client_test.go b/v2/object/test/client_test.go deleted file mode 100644 index 43590f0..0000000 --- a/v2/object/test/client_test.go +++ /dev/null @@ -1,471 +0,0 @@ -package main - -import ( - "context" - "crypto/ecdsa" - "errors" - "testing" - - "github.com/nspcc-dev/neofs-api-go/v2/object" - objectGRPC "github.com/nspcc-dev/neofs-api-go/v2/object/grpc" - "github.com/nspcc-dev/neofs-api-go/v2/refs" - "github.com/nspcc-dev/neofs-api-go/v2/session" - "github.com/nspcc-dev/neofs-api-go/v2/signature" - "github.com/nspcc-dev/neofs-crypto/test" - "github.com/stretchr/testify/require" - "google.golang.org/grpc" -) - -type testGRPCClient struct { - server objectGRPC.ObjectServiceServer -} - -func (s *testGRPCClient) Get(ctx context.Context, in *objectGRPC.GetRequest, opts ...grpc.CallOption) (objectGRPC.ObjectService_GetClient, error) { - panic("implement me") -} - -func (s *testGRPCClient) Put(ctx context.Context, opts ...grpc.CallOption) (objectGRPC.ObjectService_PutClient, error) { - panic("implement me") -} - -func (s *testGRPCClient) Delete(ctx context.Context, in *objectGRPC.DeleteRequest, opts ...grpc.CallOption) (*objectGRPC.DeleteResponse, error) { - return s.server.Delete(ctx, in) -} - -func (s *testGRPCClient) Head(ctx context.Context, in *objectGRPC.HeadRequest, opts ...grpc.CallOption) (*objectGRPC.HeadResponse, error) { - return s.server.Head(ctx, in) -} - -func (s *testGRPCClient) Search(ctx context.Context, in *objectGRPC.SearchRequest, opts ...grpc.CallOption) (objectGRPC.ObjectService_SearchClient, error) { - panic("implement me") -} - -func (s *testGRPCClient) GetRange(ctx context.Context, in *objectGRPC.GetRangeRequest, opts ...grpc.CallOption) (objectGRPC.ObjectService_GetRangeClient, error) { - panic("implement me") -} - -func (s *testGRPCClient) GetRangeHash(ctx context.Context, in *objectGRPC.GetRangeHashRequest, opts ...grpc.CallOption) (*objectGRPC.GetRangeHashResponse, error) { - return s.server.GetRangeHash(ctx, in) -} - -type testGRPCServer struct { - key *ecdsa.PrivateKey - headResp *object.HeadResponse - delResp *object.DeleteResponse - getRangeHashResp *object.GetRangeHashResponse - err error -} - -func (s *testGRPCServer) Get(request *objectGRPC.GetRequest, server objectGRPC.ObjectService_GetServer) error { - panic("implement me") -} - -func (s *testGRPCServer) Put(server objectGRPC.ObjectService_PutServer) error { - panic("implement me") -} - -func (s *testGRPCServer) Delete(ctx context.Context, request *objectGRPC.DeleteRequest) (*objectGRPC.DeleteResponse, error) { - if s.err != nil { - return nil, s.err - } - - // verify request structure - if err := signature.VerifyServiceMessage( - object.DeleteRequestFromGRPCMessage(request), - ); err != nil { - return nil, err - } - - // sign response structure - if err := signature.SignServiceMessage(s.key, s.delResp); err != nil { - return nil, err - } - - return object.DeleteResponseToGRPCMessage(s.delResp), nil -} - -func (s *testGRPCServer) Head(ctx context.Context, request *objectGRPC.HeadRequest) (*objectGRPC.HeadResponse, error) { - if s.err != nil { - return nil, s.err - } - - // verify request structure - if err := signature.VerifyServiceMessage( - object.HeadRequestFromGRPCMessage(request), - ); err != nil { - return nil, err - } - - // sign response structure - if err := signature.SignServiceMessage(s.key, s.headResp); err != nil { - return nil, err - } - - return object.HeadResponseToGRPCMessage(s.headResp), nil -} - -func (s *testGRPCServer) Search(request *objectGRPC.SearchRequest, server objectGRPC.ObjectService_SearchServer) error { - panic("implement me") -} - -func (s *testGRPCServer) GetRange(request *objectGRPC.GetRangeRequest, server objectGRPC.ObjectService_GetRangeServer) error { - panic("implement me") -} - -func (s *testGRPCServer) GetRangeHash(ctx context.Context, request *objectGRPC.GetRangeHashRequest) (*objectGRPC.GetRangeHashResponse, error) { - if s.err != nil { - return nil, s.err - } - - // verify request structure - if err := signature.VerifyServiceMessage( - object.GetRangeHashRequestFromGRPCMessage(request), - ); err != nil { - return nil, err - } - - // sign response structure - if err := signature.SignServiceMessage(s.key, s.getRangeHashResp); err != nil { - return nil, err - } - - return object.GetRangeHashResponseToGRPCMessage(s.getRangeHashResp), nil -} - -func testHeadRequest() *object.HeadRequest { - cid := new(refs.ContainerID) - cid.SetValue([]byte{1, 2, 3}) - - oid := new(refs.ObjectID) - oid.SetValue([]byte{4, 5, 6}) - - addr := new(refs.Address) - addr.SetContainerID(cid) - addr.SetObjectID(oid) - - body := new(object.HeadRequestBody) - body.SetAddress(addr) - - meta := new(session.RequestMetaHeader) - meta.SetTTL(1) - meta.SetXHeaders([]*session.XHeader{}) - - req := new(object.HeadRequest) - req.SetBody(body) - req.SetMetaHeader(meta) - - return req -} - -func testHeadResponse() *object.HeadResponse { - shortHdr := new(object.ShortHeader) - shortHdr.SetCreationEpoch(100) - - body := new(object.HeadResponseBody) - body.SetHeaderPart(shortHdr) - - meta := new(session.ResponseMetaHeader) - meta.SetTTL(1) - meta.SetXHeaders([]*session.XHeader{}) - - resp := new(object.HeadResponse) - resp.SetBody(body) - resp.SetMetaHeader(meta) - - return resp -} - -func testDeleteRequest() *object.DeleteRequest { - cid := new(refs.ContainerID) - cid.SetValue([]byte{1, 2, 3}) - - oid := new(refs.ObjectID) - oid.SetValue([]byte{4, 5, 6}) - - addr := new(refs.Address) - addr.SetContainerID(cid) - addr.SetObjectID(oid) - - body := new(object.DeleteRequestBody) - body.SetAddress(addr) - - meta := new(session.RequestMetaHeader) - meta.SetTTL(1) - meta.SetXHeaders([]*session.XHeader{}) - - req := new(object.DeleteRequest) - req.SetBody(body) - req.SetMetaHeader(meta) - - return req -} - -func testDeleteResponse() *object.DeleteResponse { - body := new(object.DeleteResponseBody) - - meta := new(session.ResponseMetaHeader) - meta.SetTTL(1) - meta.SetXHeaders([]*session.XHeader{}) - - resp := new(object.DeleteResponse) - resp.SetBody(body) - resp.SetMetaHeader(meta) - - return resp -} - -func testGetRangeHashRequest() *object.GetRangeHashRequest { - cid := new(refs.ContainerID) - cid.SetValue([]byte{1, 2, 3}) - - oid := new(refs.ObjectID) - oid.SetValue([]byte{4, 5, 6}) - - addr := new(refs.Address) - addr.SetContainerID(cid) - addr.SetObjectID(oid) - - body := new(object.GetRangeHashRequestBody) - body.SetAddress(addr) - - meta := new(session.RequestMetaHeader) - meta.SetTTL(1) - meta.SetXHeaders([]*session.XHeader{}) - - req := new(object.GetRangeHashRequest) - req.SetBody(body) - req.SetMetaHeader(meta) - - return req -} - -func testGetRangeHashResponse() *object.GetRangeHashResponse { - body := new(object.GetRangeHashResponseBody) - body.SetHashList([][]byte{{7, 8, 9}}) - - meta := new(session.ResponseMetaHeader) - meta.SetTTL(1) - meta.SetXHeaders([]*session.XHeader{}) - - resp := new(object.GetRangeHashResponse) - resp.SetBody(body) - resp.SetMetaHeader(meta) - - return resp -} - -func TestGRPCClient_Head(t *testing.T) { - ctx := context.TODO() - - cliKey := test.DecodeKey(0) - srvKey := test.DecodeKey(1) - - t.Run("gRPC server error", func(t *testing.T) { - srvErr := errors.New("test server error") - - srv := &testGRPCServer{ - err: srvErr, - } - - cli := &testGRPCClient{ - server: srv, - } - - c, err := object.NewClient(object.WithGRPCServiceClient(cli)) - require.NoError(t, err) - - resp, err := c.Head(ctx, new(object.HeadRequest)) - require.True(t, errors.Is(err, srvErr)) - require.Nil(t, resp) - }) - - t.Run("invalid request structure", func(t *testing.T) { - req := testHeadRequest() - - require.Error(t, signature.VerifyServiceMessage(req)) - - c, err := object.NewClient( - object.WithGRPCServiceClient( - &testGRPCClient{ - server: new(testGRPCServer), - }, - ), - ) - require.NoError(t, err) - - resp, err := c.Head(ctx, req) - require.Error(t, err) - require.Nil(t, resp) - }) - - t.Run("correct response", func(t *testing.T) { - req := testHeadRequest() - - require.NoError(t, signature.SignServiceMessage(cliKey, req)) - - resp := testHeadResponse() - - c, err := object.NewClient( - object.WithGRPCServiceClient( - &testGRPCClient{ - server: &testGRPCServer{ - key: srvKey, - headResp: resp, - }, - }, - ), - ) - require.NoError(t, err) - - r, err := c.Head(ctx, req) - require.NoError(t, err) - - require.NoError(t, signature.VerifyServiceMessage(r)) - require.Equal(t, resp.GetBody(), r.GetBody()) - require.Equal(t, resp.GetMetaHeader(), r.GetMetaHeader()) - }) -} - -func TestGRPCClient_Delete(t *testing.T) { - ctx := context.TODO() - - cliKey := test.DecodeKey(0) - srvKey := test.DecodeKey(1) - - t.Run("gRPC server error", func(t *testing.T) { - srvErr := errors.New("test server error") - - srv := &testGRPCServer{ - err: srvErr, - } - - cli := &testGRPCClient{ - server: srv, - } - - c, err := object.NewClient(object.WithGRPCServiceClient(cli)) - require.NoError(t, err) - - resp, err := c.Delete(ctx, new(object.DeleteRequest)) - require.True(t, errors.Is(err, srvErr)) - require.Nil(t, resp) - }) - - t.Run("invalid request structure", func(t *testing.T) { - req := testDeleteRequest() - - require.Error(t, signature.VerifyServiceMessage(req)) - - c, err := object.NewClient( - object.WithGRPCServiceClient( - &testGRPCClient{ - server: new(testGRPCServer), - }, - ), - ) - require.NoError(t, err) - - resp, err := c.Delete(ctx, req) - require.Error(t, err) - require.Nil(t, resp) - }) - - t.Run("correct response", func(t *testing.T) { - req := testDeleteRequest() - - require.NoError(t, signature.SignServiceMessage(cliKey, req)) - - resp := testDeleteResponse() - - c, err := object.NewClient( - object.WithGRPCServiceClient( - &testGRPCClient{ - server: &testGRPCServer{ - key: srvKey, - delResp: resp, - }, - }, - ), - ) - require.NoError(t, err) - - r, err := c.Delete(ctx, req) - require.NoError(t, err) - - require.NoError(t, signature.VerifyServiceMessage(r)) - require.Equal(t, resp.GetBody(), r.GetBody()) - require.Equal(t, resp.GetMetaHeader(), r.GetMetaHeader()) - }) -} - -func TestGRPCClient_GetRangeHash(t *testing.T) { - ctx := context.TODO() - - cliKey := test.DecodeKey(0) - srvKey := test.DecodeKey(1) - - t.Run("gRPC server error", func(t *testing.T) { - srvErr := errors.New("test server error") - - srv := &testGRPCServer{ - err: srvErr, - } - - cli := &testGRPCClient{ - server: srv, - } - - c, err := object.NewClient(object.WithGRPCServiceClient(cli)) - require.NoError(t, err) - - resp, err := c.GetRangeHash(ctx, new(object.GetRangeHashRequest)) - require.True(t, errors.Is(err, srvErr)) - require.Nil(t, resp) - }) - - t.Run("invalid request structure", func(t *testing.T) { - req := testGetRangeHashRequest() - - require.Error(t, signature.VerifyServiceMessage(req)) - - c, err := object.NewClient( - object.WithGRPCServiceClient( - &testGRPCClient{ - server: new(testGRPCServer), - }, - ), - ) - require.NoError(t, err) - - resp, err := c.GetRangeHash(ctx, req) - require.Error(t, err) - require.Nil(t, resp) - }) - - t.Run("correct response", func(t *testing.T) { - req := testGetRangeHashRequest() - - require.NoError(t, signature.SignServiceMessage(cliKey, req)) - - resp := testGetRangeHashResponse() - - c, err := object.NewClient( - object.WithGRPCServiceClient( - &testGRPCClient{ - server: &testGRPCServer{ - key: srvKey, - getRangeHashResp: resp, - }, - }, - ), - ) - require.NoError(t, err) - - r, err := c.GetRangeHash(ctx, req) - require.NoError(t, err) - - require.NoError(t, signature.VerifyServiceMessage(r)) - require.Equal(t, resp.GetBody(), r.GetBody()) - require.Equal(t, resp.GetMetaHeader(), r.GetMetaHeader()) - }) -} diff --git a/v2/object/test/generate.go b/v2/object/test/generate.go new file mode 100644 index 0000000..494645b --- /dev/null +++ b/v2/object/test/generate.go @@ -0,0 +1,512 @@ +package objecttest + +import ( + "github.com/nspcc-dev/neofs-api-go/v2/object" + refstest "github.com/nspcc-dev/neofs-api-go/v2/refs/test" + sessiontest "github.com/nspcc-dev/neofs-api-go/v2/session/test" +) + +func GenerateShortHeader(empty bool) *object.ShortHeader { + m := new(object.ShortHeader) + + if !empty { + m.SetObjectType(13) + m.SetCreationEpoch(100) + m.SetPayloadLength(12321) + } + + m.SetVersion(refstest.GenerateVersion(empty)) + m.SetOwnerID(refstest.GenerateOwnerID(empty)) + m.SetHomomorphicHash(refstest.GenerateChecksum(empty)) + m.SetPayloadHash(refstest.GenerateChecksum(empty)) + + return m +} + +func GenerateAttribute(empty bool) *object.Attribute { + m := new(object.Attribute) + + if !empty { + m.SetKey("object key") + m.SetValue("object value") + } + + return m +} + +func GenerateAttributes(empty bool) (res []*object.Attribute) { + if !empty { + res = append(res, + GenerateAttribute(false), + GenerateAttribute(false), + ) + } + + return +} + +func GenerateSplitHeader(empty bool) *object.SplitHeader { + return generateSplitHeader(empty, true) +} + +func generateSplitHeader(empty, withPar bool) *object.SplitHeader { + m := new(object.SplitHeader) + + if !empty { + m.SetSplitID([]byte{1, 3, 5}) + } + + m.SetParent(refstest.GenerateObjectID(empty)) + m.SetPrevious(refstest.GenerateObjectID(empty)) + m.SetParentSignature(refstest.GenerateSignature(empty)) + m.SetChildren(refstest.GenerateObjectIDs(empty)) + + if withPar { + m.SetParentHeader(generateHeader(empty, false)) + } + + return m +} + +func GenerateHeader(empty bool) *object.Header { + return generateHeader(empty, true) +} + +func generateHeader(empty, withSplit bool) *object.Header { + m := new(object.Header) + + if !empty { + m.SetPayloadLength(777) + m.SetCreationEpoch(432) + m.SetObjectType(111) + } + + m.SetVersion(refstest.GenerateVersion(empty)) + m.SetPayloadHash(refstest.GenerateChecksum(empty)) + m.SetOwnerID(refstest.GenerateOwnerID(empty)) + m.SetHomomorphicHash(refstest.GenerateChecksum(empty)) + m.SetContainerID(refstest.GenerateContainerID(empty)) + m.SetSessionToken(sessiontest.GenerateSessionToken(empty)) + m.SetAttributes(GenerateAttributes(empty)) + + if withSplit { + m.SetSplit(generateSplitHeader(empty, false)) + } + + return m +} + +func GenerateHeaderWithSignature(empty bool) *object.HeaderWithSignature { + m := new(object.HeaderWithSignature) + + m.SetSignature(refstest.GenerateSignature(empty)) + m.SetHeader(GenerateHeader(empty)) + + return m +} + +func GenerateObject(empty bool) *object.Object { + m := new(object.Object) + + if !empty { + m.SetPayload([]byte{7, 8, 9}) + } + + m.SetObjectID(refstest.GenerateObjectID(empty)) + m.SetSignature(refstest.GenerateSignature(empty)) + m.SetHeader(GenerateHeader(empty)) + + return m +} + +func GenerateSplitInfo(empty bool) *object.SplitInfo { + m := new(object.SplitInfo) + + if !empty { + m.SetSplitID([]byte("splitID")) + } + + m.SetLastPart(refstest.GenerateObjectID(empty)) + m.SetLink(refstest.GenerateObjectID(empty)) + + return m +} + +func GenerateGetRequestBody(empty bool) *object.GetRequestBody { + m := new(object.GetRequestBody) + + if !empty { + m.SetRaw(true) + } + + m.SetAddress(refstest.GenerateAddress(empty)) + + return m +} + +func GenerateGetRequest(empty bool) *object.GetRequest { + m := new(object.GetRequest) + + m.SetBody(GenerateGetRequestBody(empty)) + m.SetMetaHeader(sessiontest.GenerateRequestMetaHeader(empty)) + m.SetVerificationHeader(sessiontest.GenerateRequestVerificationHeader(empty)) + + return m +} + +func GenerateGetObjectPartInit(empty bool) *object.GetObjectPartInit { + m := new(object.GetObjectPartInit) + + m.SetObjectID(refstest.GenerateObjectID(empty)) + m.SetSignature(refstest.GenerateSignature(empty)) + m.SetHeader(GenerateHeader(empty)) + + return m +} + +func GenerateGetObjectPartChunk(empty bool) *object.GetObjectPartChunk { + m := new(object.GetObjectPartChunk) + + if !empty { + m.SetChunk([]byte("get chunk")) + } + + return m +} + +func GenerateGetResponseBody(empty bool) *object.GetResponseBody { + m := new(object.GetResponseBody) + + m.SetObjectPart(GenerateGetObjectPartInit(empty)) + + return m +} + +func GenerateGetResponse(empty bool) *object.GetResponse { + m := new(object.GetResponse) + + m.SetBody(GenerateGetResponseBody(empty)) + m.SetMetaHeader(sessiontest.GenerateResponseMetaHeader(empty)) + m.SetVerificationHeader(sessiontest.GenerateResponseVerificationHeader(empty)) + + return m +} + +func GeneratePutObjectPartInit(empty bool) *object.PutObjectPartInit { + m := new(object.PutObjectPartInit) + + if !empty { + m.SetCopiesNumber(234) + } + + m.SetObjectID(refstest.GenerateObjectID(empty)) + m.SetSignature(refstest.GenerateSignature(empty)) + m.SetHeader(GenerateHeader(empty)) + + return m +} + +func GeneratePutObjectPartChunk(empty bool) *object.PutObjectPartChunk { + m := new(object.PutObjectPartChunk) + + if !empty { + m.SetChunk([]byte("put chunk")) + } + + return m +} + +func GeneratePutRequestBody(empty bool) *object.PutRequestBody { + m := new(object.PutRequestBody) + + m.SetObjectPart(GeneratePutObjectPartInit(empty)) + + return m +} + +func GeneratePutRequest(empty bool) *object.PutRequest { + m := new(object.PutRequest) + + m.SetBody(GeneratePutRequestBody(empty)) + m.SetMetaHeader(sessiontest.GenerateRequestMetaHeader(empty)) + m.SetVerificationHeader(sessiontest.GenerateRequestVerificationHeader(empty)) + + return m +} + +func GeneratePutResponseBody(empty bool) *object.PutResponseBody { + m := new(object.PutResponseBody) + + m.SetObjectID(refstest.GenerateObjectID(empty)) + + return m +} + +func GeneratePutResponse(empty bool) *object.PutResponse { + m := new(object.PutResponse) + + m.SetBody(GeneratePutResponseBody(empty)) + m.SetMetaHeader(sessiontest.GenerateResponseMetaHeader(empty)) + m.SetVerificationHeader(sessiontest.GenerateResponseVerificationHeader(empty)) + + return m +} + +func GenerateDeleteRequestBody(empty bool) *object.DeleteRequestBody { + m := new(object.DeleteRequestBody) + + m.SetAddress(refstest.GenerateAddress(empty)) + + return m +} + +func GenerateDeleteRequest(empty bool) *object.DeleteRequest { + m := new(object.DeleteRequest) + + m.SetBody(GenerateDeleteRequestBody(empty)) + m.SetMetaHeader(sessiontest.GenerateRequestMetaHeader(empty)) + m.SetVerificationHeader(sessiontest.GenerateRequestVerificationHeader(empty)) + + return m +} + +func GenerateDeleteResponseBody(empty bool) *object.DeleteResponseBody { + m := new(object.DeleteResponseBody) + + m.SetTombstone(refstest.GenerateAddress(empty)) + + return m +} + +func GenerateDeleteResponse(empty bool) *object.DeleteResponse { + m := new(object.DeleteResponse) + + m.SetBody(GenerateDeleteResponseBody(empty)) + m.SetMetaHeader(sessiontest.GenerateResponseMetaHeader(empty)) + m.SetVerificationHeader(sessiontest.GenerateResponseVerificationHeader(empty)) + + return m +} + +func GenerateHeadRequestBody(empty bool) *object.HeadRequestBody { + m := new(object.HeadRequestBody) + + if !empty { + m.SetRaw(true) + m.SetMainOnly(true) + } + + m.SetAddress(refstest.GenerateAddress(empty)) + + return m +} + +func GenerateHeadRequest(empty bool) *object.HeadRequest { + m := new(object.HeadRequest) + + m.SetBody(GenerateHeadRequestBody(empty)) + m.SetMetaHeader(sessiontest.GenerateRequestMetaHeader(empty)) + m.SetVerificationHeader(sessiontest.GenerateRequestVerificationHeader(empty)) + + return m +} + +func GenerateHeadResponseBody(empty bool) *object.HeadResponseBody { + m := new(object.HeadResponseBody) + + m.SetHeaderPart(GenerateHeaderWithSignature(empty)) + + return m +} + +func GenerateHeadResponse(empty bool) *object.HeadResponse { + m := new(object.HeadResponse) + + m.SetBody(GenerateHeadResponseBody(empty)) + m.SetMetaHeader(sessiontest.GenerateResponseMetaHeader(empty)) + m.SetVerificationHeader(sessiontest.GenerateResponseVerificationHeader(empty)) + + return m +} + +func GenerateSearchFilter(empty bool) *object.SearchFilter { + m := new(object.SearchFilter) + + if !empty { + m.SetKey("search filter key") + m.SetValue("search filter val") + m.SetMatchType(987) + } + + return m +} + +func GenerateSearchFilters(empty bool) (res []*object.SearchFilter) { + if !empty { + res = append(res, + GenerateSearchFilter(false), + GenerateSearchFilter(false), + ) + } + + return +} + +func GenerateSearchRequestBody(empty bool) *object.SearchRequestBody { + m := new(object.SearchRequestBody) + + if !empty { + m.SetVersion(555) + } + + m.SetContainerID(refstest.GenerateContainerID(empty)) + m.SetFilters(GenerateSearchFilters(empty)) + + return m +} + +func GenerateSearchRequest(empty bool) *object.SearchRequest { + m := new(object.SearchRequest) + + m.SetBody(GenerateSearchRequestBody(empty)) + m.SetMetaHeader(sessiontest.GenerateRequestMetaHeader(empty)) + m.SetVerificationHeader(sessiontest.GenerateRequestVerificationHeader(empty)) + + return m +} + +func GenerateSearchResponseBody(empty bool) *object.SearchResponseBody { + m := new(object.SearchResponseBody) + + m.SetIDList(refstest.GenerateObjectIDs(empty)) + + return m +} + +func GenerateSearchResponse(empty bool) *object.SearchResponse { + m := new(object.SearchResponse) + + m.SetBody(GenerateSearchResponseBody(empty)) + m.SetMetaHeader(sessiontest.GenerateResponseMetaHeader(empty)) + m.SetVerificationHeader(sessiontest.GenerateResponseVerificationHeader(empty)) + + return m +} + +func GenerateRange(empty bool) *object.Range { + m := new(object.Range) + + if !empty { + m.SetLength(11) + m.SetOffset(22) + } + + return m +} + +func GenerateRanges(empty bool) (res []*object.Range) { + if !empty { + res = append(res, + GenerateRange(false), + GenerateRange(false), + ) + } + + return +} + +func GenerateGetRangeRequestBody(empty bool) *object.GetRangeRequestBody { + m := new(object.GetRangeRequestBody) + + if !empty { + m.SetRaw(true) + } + + m.SetAddress(refstest.GenerateAddress(empty)) + m.SetRange(GenerateRange(empty)) + + return m +} + +func GenerateGetRangeRequest(empty bool) *object.GetRangeRequest { + m := new(object.GetRangeRequest) + + m.SetBody(GenerateGetRangeRequestBody(empty)) + m.SetMetaHeader(sessiontest.GenerateRequestMetaHeader(empty)) + m.SetVerificationHeader(sessiontest.GenerateRequestVerificationHeader(empty)) + + return m +} + +func GenerateGetRangePartChunk(empty bool) *object.GetRangePartChunk { + m := new(object.GetRangePartChunk) + + if !empty { + m.SetChunk([]byte("get range chunk")) + } + + return m +} + +func GenerateGetRangeResponseBody(empty bool) *object.GetRangeResponseBody { + m := new(object.GetRangeResponseBody) + + m.SetRangePart(GenerateGetRangePartChunk(empty)) + + return m +} + +func GenerateGetRangeResponse(empty bool) *object.GetRangeResponse { + m := new(object.GetRangeResponse) + + m.SetBody(GenerateGetRangeResponseBody(empty)) + m.SetMetaHeader(sessiontest.GenerateResponseMetaHeader(empty)) + m.SetVerificationHeader(sessiontest.GenerateResponseVerificationHeader(empty)) + + return m +} + +func GenerateGetRangeHashRequestBody(empty bool) *object.GetRangeHashRequestBody { + m := new(object.GetRangeHashRequestBody) + + if !empty { + m.SetSalt([]byte("range hash salt")) + m.SetType(455) + } + + m.SetAddress(refstest.GenerateAddress(empty)) + m.SetRanges(GenerateRanges(empty)) + + return m +} + +func GenerateGetRangeHashRequest(empty bool) *object.GetRangeHashRequest { + m := new(object.GetRangeHashRequest) + + m.SetBody(GenerateGetRangeHashRequestBody(empty)) + m.SetMetaHeader(sessiontest.GenerateRequestMetaHeader(empty)) + m.SetVerificationHeader(sessiontest.GenerateRequestVerificationHeader(empty)) + + return m +} + +func GenerateGetRangeHashResponseBody(empty bool) *object.GetRangeHashResponseBody { + m := new(object.GetRangeHashResponseBody) + + if !empty { + m.SetType(678) + m.SetHashList([][]byte{{1}, {2}}) + } + + return m +} + +func GenerateGetRangeHashResponse(empty bool) *object.GetRangeHashResponse { + m := new(object.GetRangeHashResponse) + + m.SetBody(GenerateGetRangeHashResponseBody(empty)) + m.SetMetaHeader(sessiontest.GenerateResponseMetaHeader(empty)) + m.SetVerificationHeader(sessiontest.GenerateResponseVerificationHeader(empty)) + + return m +} diff --git a/v2/object/types.go b/v2/object/types.go index bed48d4..6b1dcc3 100644 --- a/v2/object/types.go +++ b/v2/object/types.go @@ -107,6 +107,12 @@ type GetObjectPartChunk struct { chunk []byte } +type GetRequest struct { + body *GetRequestBody + + session.RequestHeaders +} + type GetResponseBody struct { objPart GetObjectPart } @@ -129,22 +135,52 @@ type PutObjectPartChunk struct { chunk []byte } +type GetResponse struct { + body *GetResponseBody + + session.ResponseHeaders +} + type PutRequestBody struct { objPart PutObjectPart } +type PutRequest struct { + body *PutRequestBody + + session.RequestHeaders +} + type PutResponseBody struct { id *refs.ObjectID } +type PutResponse struct { + body *PutResponseBody + + session.ResponseHeaders +} + type DeleteRequestBody struct { addr *refs.Address } +type DeleteRequest struct { + body *DeleteRequestBody + + session.RequestHeaders +} + type DeleteResponseBody struct { tombstone *refs.Address } +type DeleteResponse struct { + body *DeleteResponseBody + + session.ResponseHeaders +} + type HeadRequestBody struct { addr *refs.Address @@ -155,10 +191,22 @@ type GetHeaderPart interface { getHeaderPart() } +type HeadRequest struct { + body *HeadRequestBody + + session.RequestHeaders +} + type HeadResponseBody struct { hdrPart GetHeaderPart } +type HeadResponse struct { + body *HeadResponseBody + + session.ResponseHeaders +} + type SearchFilter struct { matchType MatchType @@ -173,10 +221,22 @@ type SearchRequestBody struct { filters []*SearchFilter } +type SearchRequest struct { + body *SearchRequestBody + + session.RequestHeaders +} + type SearchResponseBody struct { idList []*refs.ObjectID } +type SearchResponse struct { + body *SearchResponseBody + + session.ResponseHeaders +} + type Range struct { off, len uint64 } @@ -189,6 +249,12 @@ type GetRangeRequestBody struct { raw bool } +type GetRangeRequest struct { + body *GetRangeRequestBody + + session.RequestHeaders +} + type GetRangePart interface { getRangePart() } @@ -201,6 +267,12 @@ type GetRangeResponseBody struct { rngPart GetRangePart } +type GetRangeResponse struct { + body *GetRangeResponseBody + + session.ResponseHeaders +} + type GetRangeHashRequestBody struct { addr *refs.Address @@ -211,12 +283,24 @@ type GetRangeHashRequestBody struct { typ refs.ChecksumType } +type GetRangeHashRequest struct { + body *GetRangeHashRequestBody + + session.RequestHeaders +} + type GetRangeHashResponseBody struct { typ refs.ChecksumType hashList [][]byte } +type GetRangeHashResponse struct { + body *GetRangeHashResponseBody + + session.ResponseHeaders +} + const ( TypeRegular Type = iota TypeTombstone @@ -772,34 +856,6 @@ func (r *GetRequest) SetBody(v *GetRequestBody) { } } -func (r *GetRequest) GetMetaHeader() *session.RequestMetaHeader { - if r != nil { - return r.metaHeader - } - - return nil -} - -func (r *GetRequest) SetMetaHeader(v *session.RequestMetaHeader) { - if r != nil { - r.metaHeader = v - } -} - -func (r *GetRequest) GetVerificationHeader() *session.RequestVerificationHeader { - if r != nil { - return r.verifyHeader - } - - return nil -} - -func (r *GetRequest) SetVerificationHeader(v *session.RequestVerificationHeader) { - if r != nil { - r.verifyHeader = v - } -} - func (r *GetObjectPartInit) GetObjectID() *refs.ObjectID { if r != nil { return r.id @@ -888,34 +944,6 @@ func (r *GetResponse) SetBody(v *GetResponseBody) { } } -func (r *GetResponse) GetMetaHeader() *session.ResponseMetaHeader { - if r != nil { - return r.metaHeader - } - - return nil -} - -func (r *GetResponse) SetMetaHeader(v *session.ResponseMetaHeader) { - if r != nil { - r.metaHeader = v - } -} - -func (r *GetResponse) GetVerificationHeader() *session.ResponseVerificationHeader { - if r != nil { - return r.verifyHeader - } - - return nil -} - -func (r *GetResponse) SetVerificationHeader(v *session.ResponseVerificationHeader) { - if r != nil { - r.verifyHeader = v - } -} - func (r *PutObjectPartInit) GetObjectID() *refs.ObjectID { if r != nil { return r.id @@ -1018,34 +1046,6 @@ func (r *PutRequest) SetBody(v *PutRequestBody) { } } -func (r *PutRequest) GetMetaHeader() *session.RequestMetaHeader { - if r != nil { - return r.metaHeader - } - - return nil -} - -func (r *PutRequest) SetMetaHeader(v *session.RequestMetaHeader) { - if r != nil { - r.metaHeader = v - } -} - -func (r *PutRequest) GetVerificationHeader() *session.RequestVerificationHeader { - if r != nil { - return r.verifyHeader - } - - return nil -} - -func (r *PutRequest) SetVerificationHeader(v *session.RequestVerificationHeader) { - if r != nil { - r.verifyHeader = v - } -} - func (r *PutResponseBody) GetObjectID() *refs.ObjectID { if r != nil { return r.id @@ -1074,34 +1074,6 @@ func (r *PutResponse) SetBody(v *PutResponseBody) { } } -func (r *PutResponse) GetMetaHeader() *session.ResponseMetaHeader { - if r != nil { - return r.metaHeader - } - - return nil -} - -func (r *PutResponse) SetMetaHeader(v *session.ResponseMetaHeader) { - if r != nil { - r.metaHeader = v - } -} - -func (r *PutResponse) GetVerificationHeader() *session.ResponseVerificationHeader { - if r != nil { - return r.verifyHeader - } - - return nil -} - -func (r *PutResponse) SetVerificationHeader(v *session.ResponseVerificationHeader) { - if r != nil { - r.verifyHeader = v - } -} - func (r *DeleteRequestBody) GetAddress() *refs.Address { if r != nil { return r.addr @@ -1130,34 +1102,6 @@ func (r *DeleteRequest) SetBody(v *DeleteRequestBody) { } } -func (r *DeleteRequest) GetMetaHeader() *session.RequestMetaHeader { - if r != nil { - return r.metaHeader - } - - return nil -} - -func (r *DeleteRequest) SetMetaHeader(v *session.RequestMetaHeader) { - if r != nil { - r.metaHeader = v - } -} - -func (r *DeleteRequest) GetVerificationHeader() *session.RequestVerificationHeader { - if r != nil { - return r.verifyHeader - } - - return nil -} - -func (r *DeleteRequest) SetVerificationHeader(v *session.RequestVerificationHeader) { - if r != nil { - r.verifyHeader = v - } -} - // GetTombstone returns tombstone address. func (r *DeleteResponseBody) GetTombstone() *refs.Address { if r != nil { @@ -1188,34 +1132,6 @@ func (r *DeleteResponse) SetBody(v *DeleteResponseBody) { } } -func (r *DeleteResponse) GetMetaHeader() *session.ResponseMetaHeader { - if r != nil { - return r.metaHeader - } - - return nil -} - -func (r *DeleteResponse) SetMetaHeader(v *session.ResponseMetaHeader) { - if r != nil { - r.metaHeader = v - } -} - -func (r *DeleteResponse) GetVerificationHeader() *session.ResponseVerificationHeader { - if r != nil { - return r.verifyHeader - } - - return nil -} - -func (r *DeleteResponse) SetVerificationHeader(v *session.ResponseVerificationHeader) { - if r != nil { - r.verifyHeader = v - } -} - func (r *HeadRequestBody) GetAddress() *refs.Address { if r != nil { return r.addr @@ -1272,34 +1188,6 @@ func (r *HeadRequest) SetBody(v *HeadRequestBody) { } } -func (r *HeadRequest) GetMetaHeader() *session.RequestMetaHeader { - if r != nil { - return r.metaHeader - } - - return nil -} - -func (r *HeadRequest) SetMetaHeader(v *session.RequestMetaHeader) { - if r != nil { - r.metaHeader = v - } -} - -func (r *HeadRequest) GetVerificationHeader() *session.RequestVerificationHeader { - if r != nil { - return r.verifyHeader - } - - return nil -} - -func (r *HeadRequest) SetVerificationHeader(v *session.RequestVerificationHeader) { - if r != nil { - r.verifyHeader = v - } -} - func (r *HeadResponseBody) GetHeaderPart() GetHeaderPart { if r != nil { return r.hdrPart @@ -1328,34 +1216,6 @@ func (r *HeadResponse) SetBody(v *HeadResponseBody) { } } -func (r *HeadResponse) GetMetaHeader() *session.ResponseMetaHeader { - if r != nil { - return r.metaHeader - } - - return nil -} - -func (r *HeadResponse) SetMetaHeader(v *session.ResponseMetaHeader) { - if r != nil { - r.metaHeader = v - } -} - -func (r *HeadResponse) GetVerificationHeader() *session.ResponseVerificationHeader { - if r != nil { - return r.verifyHeader - } - - return nil -} - -func (r *HeadResponse) SetVerificationHeader(v *session.ResponseVerificationHeader) { - if r != nil { - r.verifyHeader = v - } -} - func (f *SearchFilter) GetMatchType() MatchType { if f != nil { return f.matchType @@ -1454,34 +1314,6 @@ func (r *SearchRequest) SetBody(v *SearchRequestBody) { } } -func (r *SearchRequest) GetMetaHeader() *session.RequestMetaHeader { - if r != nil { - return r.metaHeader - } - - return nil -} - -func (r *SearchRequest) SetMetaHeader(v *session.RequestMetaHeader) { - if r != nil { - r.metaHeader = v - } -} - -func (r *SearchRequest) GetVerificationHeader() *session.RequestVerificationHeader { - if r != nil { - return r.verifyHeader - } - - return nil -} - -func (r *SearchRequest) SetVerificationHeader(v *session.RequestVerificationHeader) { - if r != nil { - r.verifyHeader = v - } -} - func (r *SearchResponseBody) GetIDList() []*refs.ObjectID { if r != nil { return r.idList @@ -1510,34 +1342,6 @@ func (r *SearchResponse) SetBody(v *SearchResponseBody) { } } -func (r *SearchResponse) GetMetaHeader() *session.ResponseMetaHeader { - if r != nil { - return r.metaHeader - } - - return nil -} - -func (r *SearchResponse) SetMetaHeader(v *session.ResponseMetaHeader) { - if r != nil { - r.metaHeader = v - } -} - -func (r *SearchResponse) GetVerificationHeader() *session.ResponseVerificationHeader { - if r != nil { - return r.verifyHeader - } - - return nil -} - -func (r *SearchResponse) SetVerificationHeader(v *session.ResponseVerificationHeader) { - if r != nil { - r.verifyHeader = v - } -} - func (r *Range) GetOffset() uint64 { if r != nil { return r.off @@ -1622,34 +1426,6 @@ func (r *GetRangeRequest) SetBody(v *GetRangeRequestBody) { } } -func (r *GetRangeRequest) GetMetaHeader() *session.RequestMetaHeader { - if r != nil { - return r.metaHeader - } - - return nil -} - -func (r *GetRangeRequest) SetMetaHeader(v *session.RequestMetaHeader) { - if r != nil { - r.metaHeader = v - } -} - -func (r *GetRangeRequest) GetVerificationHeader() *session.RequestVerificationHeader { - if r != nil { - return r.verifyHeader - } - - return nil -} - -func (r *GetRangeRequest) SetVerificationHeader(v *session.RequestVerificationHeader) { - if r != nil { - r.verifyHeader = v - } -} - func (r *GetRangePartChunk) GetChunk() []byte { if r != nil { return r.chunk @@ -1694,34 +1470,6 @@ func (r *GetRangeResponse) SetBody(v *GetRangeResponseBody) { } } -func (r *GetRangeResponse) GetMetaHeader() *session.ResponseMetaHeader { - if r != nil { - return r.metaHeader - } - - return nil -} - -func (r *GetRangeResponse) SetMetaHeader(v *session.ResponseMetaHeader) { - if r != nil { - r.metaHeader = v - } -} - -func (r *GetRangeResponse) GetVerificationHeader() *session.ResponseVerificationHeader { - if r != nil { - return r.verifyHeader - } - - return nil -} - -func (r *GetRangeResponse) SetVerificationHeader(v *session.ResponseVerificationHeader) { - if r != nil { - r.verifyHeader = v - } -} - func (r *GetRangeHashRequestBody) GetAddress() *refs.Address { if r != nil { return r.addr @@ -1792,34 +1540,6 @@ func (r *GetRangeHashRequest) SetBody(v *GetRangeHashRequestBody) { } } -func (r *GetRangeHashRequest) GetMetaHeader() *session.RequestMetaHeader { - if r != nil { - return r.metaHeader - } - - return nil -} - -func (r *GetRangeHashRequest) SetMetaHeader(v *session.RequestMetaHeader) { - if r != nil { - r.metaHeader = v - } -} - -func (r *GetRangeHashRequest) GetVerificationHeader() *session.RequestVerificationHeader { - if r != nil { - return r.verifyHeader - } - - return nil -} - -func (r *GetRangeHashRequest) SetVerificationHeader(v *session.RequestVerificationHeader) { - if r != nil { - r.verifyHeader = v - } -} - func (r *GetRangeHashResponseBody) GetType() refs.ChecksumType { if r != nil { return r.typ @@ -1861,31 +1581,3 @@ func (r *GetRangeHashResponse) SetBody(v *GetRangeHashResponseBody) { r.body = v } } - -func (r *GetRangeHashResponse) GetMetaHeader() *session.ResponseMetaHeader { - if r != nil { - return r.metaHeader - } - - return nil -} - -func (r *GetRangeHashResponse) SetMetaHeader(v *session.ResponseMetaHeader) { - if r != nil { - r.metaHeader = v - } -} - -func (r *GetRangeHashResponse) GetVerificationHeader() *session.ResponseVerificationHeader { - if r != nil { - return r.verifyHeader - } - - return nil -} - -func (r *GetRangeHashResponse) SetVerificationHeader(v *session.ResponseVerificationHeader) { - if r != nil { - r.verifyHeader = v - } -} diff --git a/v2/refs/convert.go b/v2/refs/convert.go index 673fbf0..3cd87d2 100644 --- a/v2/refs/convert.go +++ b/v2/refs/convert.go @@ -1,221 +1,278 @@ package refs import ( + "github.com/nspcc-dev/neofs-api-go/rpc/grpc" + "github.com/nspcc-dev/neofs-api-go/rpc/message" refs "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" ) -func OwnerIDToGRPCMessage(o *OwnerID) *refs.OwnerID { - if o == nil { - return nil +func (o *OwnerID) ToGRPCMessage() grpc.Message { + var m *refs.OwnerID + + if o != nil { + m = new(refs.OwnerID) + + m.SetValue(o.val) } - m := new(refs.OwnerID) - - m.SetValue(o.GetValue()) - return m } -func OwnerIDFromGRPCMessage(m *refs.OwnerID) *OwnerID { - if m == nil { - return nil +func (o *OwnerID) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*refs.OwnerID) + if !ok { + return message.NewUnexpectedMessageType(m, v) } - o := new(OwnerID) + o.val = v.GetValue() - o.SetValue(m.GetValue()) - - return o + return nil } -func ContainerIDToGRPCMessage(c *ContainerID) *refs.ContainerID { - if c == nil { - return nil +func (c *ContainerID) ToGRPCMessage() grpc.Message { + var m *refs.ContainerID + + if c != nil { + m = new(refs.ContainerID) + + m.SetValue(c.val) } - m := new(refs.ContainerID) - - m.SetValue(c.GetValue()) - return m } -func ContainerIDFromGRPCMessage(m *refs.ContainerID) *ContainerID { - if m == nil { - return nil +func (c *ContainerID) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*refs.ContainerID) + if !ok { + return message.NewUnexpectedMessageType(m, v) } - c := new(ContainerID) + c.val = v.GetValue() - c.SetValue(m.GetValue()) - - return c + return nil } -func ObjectIDToGRPCMessage(o *ObjectID) *refs.ObjectID { - if o == nil { - return nil +func ContainerIDsToGRPCMessage(ids []*ContainerID) (res []*refs.ContainerID) { + if ids != nil { + res = make([]*refs.ContainerID, 0, len(ids)) + + for i := range ids { + res = append(res, ids[i].ToGRPCMessage().(*refs.ContainerID)) + } } - m := new(refs.ObjectID) + return +} - m.SetValue(o.GetValue()) +func ContainerIDsFromGRPCMessage(idsV2 []*refs.ContainerID) (res []*ContainerID, err error) { + if idsV2 != nil { + res = make([]*ContainerID, 0, len(idsV2)) + + for i := range idsV2 { + var id *ContainerID + + if idsV2[i] != nil { + id = new(ContainerID) + + err = id.FromGRPCMessage(idsV2[i]) + if err != nil { + return + } + } + + res = append(res, id) + } + } + + return +} + +func (o *ObjectID) ToGRPCMessage() grpc.Message { + var m *refs.ObjectID + + if o != nil { + m = new(refs.ObjectID) + + m.SetValue(o.val) + } return m } -func ObjectIDFromGRPCMessage(m *refs.ObjectID) *ObjectID { - if m == nil { - return nil +func (o *ObjectID) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*refs.ObjectID) + if !ok { + return message.NewUnexpectedMessageType(m, v) } - o := new(ObjectID) + o.val = v.GetValue() - o.SetValue(m.GetValue()) - - return o + return nil } -func ObjectIDListToGRPCMessage(ids []*ObjectID) []*refs.ObjectID { - if ids == nil { - return nil +func ObjectIDListToGRPCMessage(ids []*ObjectID) (res []*refs.ObjectID) { + if ids != nil { + res = make([]*refs.ObjectID, 0, len(ids)) + + for i := range ids { + res = append(res, ids[i].ToGRPCMessage().(*refs.ObjectID)) + } } - idsV2 := make([]*refs.ObjectID, 0, len(ids)) - - for i := range ids { - idsV2 = append(idsV2, ObjectIDToGRPCMessage(ids[i])) - } - - return idsV2 + return } -func ObjectIDListFromGRPCMessage(idsV2 []*refs.ObjectID) []*ObjectID { - if idsV2 == nil { - return nil +func ObjectIDListFromGRPCMessage(idsV2 []*refs.ObjectID) (res []*ObjectID, err error) { + if idsV2 != nil { + res = make([]*ObjectID, 0, len(idsV2)) + + for i := range idsV2 { + var id *ObjectID + + if idsV2[i] != nil { + id = new(ObjectID) + + err = id.FromGRPCMessage(idsV2[i]) + if err != nil { + return + } + } + + res = append(res, id) + } } - ids := make([]*ObjectID, 0, len(idsV2)) - - for i := range idsV2 { - ids = append(ids, ObjectIDFromGRPCMessage(idsV2[i])) - } - - return ids + return } -func AddressToGRPCMessage(a *Address) *refs.Address { - if a == nil { - return nil +func (a *Address) ToGRPCMessage() grpc.Message { + var m *refs.Address + + if a != nil { + m = new(refs.Address) + + m.SetContainerId(a.cid.ToGRPCMessage().(*refs.ContainerID)) + m.SetObjectId(a.oid.ToGRPCMessage().(*refs.ObjectID)) } - m := new(refs.Address) - - m.SetContainerId( - ContainerIDToGRPCMessage(a.GetContainerID()), - ) - - m.SetObjectId( - ObjectIDToGRPCMessage(a.GetObjectID()), - ) - return m } -func AddressFromGRPCMessage(m *refs.Address) *Address { - if m == nil { - return nil +func (a *Address) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*refs.Address) + if !ok { + return message.NewUnexpectedMessageType(m, v) } - a := new(Address) + var err error - a.SetContainerID( - ContainerIDFromGRPCMessage(m.GetContainerId()), - ) + cid := v.GetContainerId() + if cid == nil { + a.cid = nil + } else { + if a.cid == nil { + a.cid = new(ContainerID) + } - a.SetObjectID( - ObjectIDFromGRPCMessage(m.GetObjectId()), - ) + err = a.cid.FromGRPCMessage(cid) + if err != nil { + return err + } + } - return a + oid := v.GetObjectId() + if oid == nil { + a.oid = nil + } else { + if a.oid == nil { + a.oid = new(ObjectID) + } + + err = a.oid.FromGRPCMessage(oid) + } + + return err } -func ChecksumToGRPCMessage(c *Checksum) *refs.Checksum { - if c == nil { - return nil +func ChecksumTypeToGRPC(t ChecksumType) refs.ChecksumType { + return refs.ChecksumType(t) +} + +func ChecksumTypeFromGRPC(t refs.ChecksumType) ChecksumType { + return ChecksumType(t) +} + +func (c *Checksum) ToGRPCMessage() grpc.Message { + var m *refs.Checksum + + if c != nil { + m = new(refs.Checksum) + + m.SetChecksumType(ChecksumTypeToGRPC(c.typ)) + m.SetSum(c.sum) } - m := new(refs.Checksum) - - m.SetChecksumType(refs.ChecksumType(c.GetType())) - - m.SetSum(c.GetSum()) - return m } -func ChecksumFromGRPCMessage(m *refs.Checksum) *Checksum { - if m == nil { - return nil +func (c *Checksum) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*refs.Checksum) + if !ok { + return message.NewUnexpectedMessageType(m, v) } - c := new(Checksum) + c.typ = ChecksumTypeFromGRPC(v.GetType()) + c.sum = v.GetSum() - c.SetType(ChecksumType(m.GetType())) - - c.SetSum(m.GetSum()) - - return c + return nil } -func VersionToGRPCMessage(v *Version) *refs.Version { - if v == nil { - return nil +func (v *Version) ToGRPCMessage() grpc.Message { + var m *refs.Version + + if v != nil { + m = new(refs.Version) + + m.SetMajor(v.major) + m.SetMinor(v.minor) } - msg := new(refs.Version) - - msg.SetMajor(v.GetMajor()) - msg.SetMinor(v.GetMinor()) - - return msg -} - -func VersionFromGRPCMessage(m *refs.Version) *Version { - if m == nil { - return nil - } - - v := new(Version) - - v.SetMajor(m.GetMajor()) - v.SetMinor(m.GetMinor()) - - return v -} - -func SignatureToGRPCMessage(s *Signature) *refs.Signature { - if s == nil { - return nil - } - - m := new(refs.Signature) - - m.SetKey(s.GetKey()) - m.SetSign(s.GetSign()) - return m } -func SignatureFromGRPCMessage(m *refs.Signature) *Signature { - if m == nil { - return nil +func (v *Version) FromGRPCMessage(m grpc.Message) error { + ver, ok := m.(*refs.Version) + if !ok { + return message.NewUnexpectedMessageType(m, v) } - s := new(Signature) + v.major = ver.GetMajor() + v.minor = ver.GetMinor() - s.SetKey(m.GetKey()) - s.SetSign(m.GetSign()) - - return s + return nil +} + +func (s *Signature) ToGRPCMessage() grpc.Message { + var m *refs.Signature + + if s != nil { + m = new(refs.Signature) + + m.SetKey(s.key) + m.SetSign(s.sign) + } + + return m +} + +func (s *Signature) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*refs.Signature) + if !ok { + return message.NewUnexpectedMessageType(m, s) + } + + s.key = v.GetKey() + s.sign = v.GetSign() + + return nil } diff --git a/v2/refs/json.go b/v2/refs/json.go index bd68cd6..4197e2f 100644 --- a/v2/refs/json.go +++ b/v2/refs/json.go @@ -1,146 +1,62 @@ package refs import ( + "github.com/nspcc-dev/neofs-api-go/rpc/message" refs "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" - "google.golang.org/protobuf/encoding/protojson" ) func (a *Address) MarshalJSON() ([]byte, error) { - return protojson.MarshalOptions{ - EmitUnpopulated: true, - }.Marshal( - AddressToGRPCMessage(a), - ) + return message.MarshalJSON(a) } func (a *Address) UnmarshalJSON(data []byte) error { - msg := new(refs.Address) - - if err := protojson.Unmarshal(data, msg); err != nil { - return err - } - - *a = *AddressFromGRPCMessage(msg) - - return nil + return message.UnmarshalJSON(a, data, new(refs.Address)) } func (o *ObjectID) MarshalJSON() ([]byte, error) { - return protojson.MarshalOptions{ - EmitUnpopulated: true, - }.Marshal( - ObjectIDToGRPCMessage(o), - ) + return message.MarshalJSON(o) } func (o *ObjectID) UnmarshalJSON(data []byte) error { - msg := new(refs.ObjectID) - - if err := protojson.Unmarshal(data, msg); err != nil { - return err - } - - *o = *ObjectIDFromGRPCMessage(msg) - - return nil + return message.UnmarshalJSON(o, data, new(refs.ObjectID)) } func (c *ContainerID) MarshalJSON() ([]byte, error) { - return protojson.MarshalOptions{ - EmitUnpopulated: true, - }.Marshal( - ContainerIDToGRPCMessage(c), - ) + return message.MarshalJSON(c) } func (c *ContainerID) UnmarshalJSON(data []byte) error { - msg := new(refs.ContainerID) - - if err := protojson.Unmarshal(data, msg); err != nil { - return err - } - - *c = *ContainerIDFromGRPCMessage(msg) - - return nil + return message.UnmarshalJSON(c, data, new(refs.ContainerID)) } func (o *OwnerID) MarshalJSON() ([]byte, error) { - return protojson.MarshalOptions{ - EmitUnpopulated: true, - }.Marshal( - OwnerIDToGRPCMessage(o), - ) + return message.MarshalJSON(o) } func (o *OwnerID) UnmarshalJSON(data []byte) error { - msg := new(refs.OwnerID) - - if err := protojson.Unmarshal(data, msg); err != nil { - return err - } - - *o = *OwnerIDFromGRPCMessage(msg) - - return nil + return message.UnmarshalJSON(o, data, new(refs.OwnerID)) } func (v *Version) MarshalJSON() ([]byte, error) { - return protojson.MarshalOptions{ - EmitUnpopulated: true, - }.Marshal( - VersionToGRPCMessage(v), - ) + return message.MarshalJSON(v) } func (v *Version) UnmarshalJSON(data []byte) error { - msg := new(refs.Version) - - if err := protojson.Unmarshal(data, msg); err != nil { - return err - } - - *v = *VersionFromGRPCMessage(msg) - - return nil + return message.UnmarshalJSON(v, data, new(refs.Version)) } func (s *Signature) MarshalJSON() ([]byte, error) { - return protojson.MarshalOptions{ - EmitUnpopulated: true, - }.Marshal( - SignatureToGRPCMessage(s), - ) + return message.MarshalJSON(s) } func (s *Signature) UnmarshalJSON(data []byte) error { - msg := new(refs.Signature) - - if err := protojson.Unmarshal(data, msg); err != nil { - return err - } - - *s = *SignatureFromGRPCMessage(msg) - - return nil + return message.UnmarshalJSON(s, data, new(refs.Signature)) } func (c *Checksum) MarshalJSON() ([]byte, error) { - return protojson.MarshalOptions{ - EmitUnpopulated: true, - }.Marshal( - ChecksumToGRPCMessage(c), - ) + return message.MarshalJSON(c) } func (c *Checksum) UnmarshalJSON(data []byte) error { - msg := new(refs.Checksum) - - if err := protojson.Unmarshal(data, msg); err != nil { - return err - } - - *c = *ChecksumFromGRPCMessage(msg) - - return nil + return message.UnmarshalJSON(c, data, new(refs.Checksum)) } diff --git a/v2/refs/json_test.go b/v2/refs/json_test.go deleted file mode 100644 index b04df1a..0000000 --- a/v2/refs/json_test.go +++ /dev/null @@ -1,97 +0,0 @@ -package refs_test - -import ( - "testing" - - "github.com/nspcc-dev/neofs-api-go/v2/refs" - "github.com/stretchr/testify/require" -) - -func TestAddressJSON(t *testing.T) { - a := generateAddress([]byte{1}, []byte{2}) - - data, err := a.MarshalJSON() - require.NoError(t, err) - - a2 := new(refs.Address) - require.NoError(t, a2.UnmarshalJSON(data)) - - require.Equal(t, a, a2) -} - -func TestObjectIDJSON(t *testing.T) { - o := new(refs.ObjectID) - o.SetValue([]byte{1}) - - data, err := o.MarshalJSON() - require.NoError(t, err) - - o2 := new(refs.ObjectID) - require.NoError(t, o2.UnmarshalJSON(data)) - - require.Equal(t, o, o2) -} - -func TestContainerIDJSON(t *testing.T) { - cid := new(refs.ContainerID) - cid.SetValue([]byte{1}) - - data, err := cid.MarshalJSON() - require.NoError(t, err) - - cid2 := new(refs.ContainerID) - require.NoError(t, cid2.UnmarshalJSON(data)) - - require.Equal(t, cid, cid2) -} - -func TestOwnerIDJSON(t *testing.T) { - o := new(refs.OwnerID) - o.SetValue([]byte{1}) - - data, err := o.MarshalJSON() - require.NoError(t, err) - - o2 := new(refs.OwnerID) - require.NoError(t, o2.UnmarshalJSON(data)) - - require.Equal(t, o, o2) -} - -func TestVersionSON(t *testing.T) { - v := generateVersion(1, 2) - - data, err := v.MarshalJSON() - require.NoError(t, err) - - v2 := new(refs.Version) - require.NoError(t, v2.UnmarshalJSON(data)) - - require.Equal(t, v, v2) -} - -func TestSignatureSON(t *testing.T) { - s := generateSignature("key", "sig") - - data, err := s.MarshalJSON() - require.NoError(t, err) - - s2 := new(refs.Signature) - require.NoError(t, s2.UnmarshalJSON(data)) - - require.Equal(t, s, s2) -} - -func TestChecksumJSON(t *testing.T) { - cs := new(refs.Checksum) - cs.SetType(refs.SHA256) - cs.SetSum([]byte{1, 2, 3}) - - data, err := cs.MarshalJSON() - require.NoError(t, err) - - cs2 := new(refs.Checksum) - require.NoError(t, cs2.UnmarshalJSON(data)) - - require.Equal(t, cs, cs2) -} diff --git a/v2/refs/marshal.go b/v2/refs/marshal.go index 28b4d4e..806d8e4 100644 --- a/v2/refs/marshal.go +++ b/v2/refs/marshal.go @@ -1,9 +1,9 @@ package refs import ( + "github.com/nspcc-dev/neofs-api-go/rpc/message" "github.com/nspcc-dev/neofs-api-go/util/proto" refs "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" - goproto "google.golang.org/protobuf/proto" ) const ( @@ -52,14 +52,7 @@ func (o *OwnerID) StableSize() int { } func (o *OwnerID) Unmarshal(data []byte) error { - m := new(refs.OwnerID) - if err := goproto.Unmarshal(data, m); err != nil { - return err - } - - *o = *OwnerIDFromGRPCMessage(m) - - return nil + return message.Unmarshal(o, data, new(refs.OwnerID)) } func (c *ContainerID) StableMarshal(buf []byte) ([]byte, error) { @@ -88,14 +81,7 @@ func (c *ContainerID) StableSize() int { } func (c *ContainerID) Unmarshal(data []byte) error { - m := new(refs.ContainerID) - if err := goproto.Unmarshal(data, m); err != nil { - return err - } - - *c = *ContainerIDFromGRPCMessage(m) - - return nil + return message.Unmarshal(c, data, new(refs.ContainerID)) } func (o *ObjectID) StableMarshal(buf []byte) ([]byte, error) { @@ -151,14 +137,7 @@ func ObjectIDNestedListMarshal(fNum int64, buf []byte, ids []*ObjectID) (off int } func (o *ObjectID) Unmarshal(data []byte) error { - m := new(refs.ObjectID) - if err := goproto.Unmarshal(data, m); err != nil { - return err - } - - *o = *ObjectIDFromGRPCMessage(m) - - return nil + return message.Unmarshal(o, data, new(refs.ObjectID)) } func (a *Address) StableMarshal(buf []byte) ([]byte, error) { @@ -203,14 +182,7 @@ func (a *Address) StableSize() (size int) { } func (a *Address) Unmarshal(data []byte) error { - addrGRPC := new(refs.Address) - if err := goproto.Unmarshal(data, addrGRPC); err != nil { - return err - } - - *a = *AddressFromGRPCMessage(addrGRPC) - - return nil + return message.Unmarshal(a, data, new(refs.Address)) } func (c *Checksum) StableMarshal(buf []byte) ([]byte, error) { @@ -254,14 +226,7 @@ func (c *Checksum) StableSize() (size int) { } func (c *Checksum) Unmarshal(data []byte) error { - m := new(refs.Checksum) - if err := goproto.Unmarshal(data, m); err != nil { - return err - } - - *c = *ChecksumFromGRPCMessage(m) - - return nil + return message.Unmarshal(c, data, new(refs.Checksum)) } func (s *Signature) StableMarshal(buf []byte) ([]byte, error) { @@ -305,14 +270,7 @@ func (s *Signature) StableSize() (size int) { } func (s *Signature) Unmarshal(data []byte) error { - m := new(refs.Signature) - if err := goproto.Unmarshal(data, m); err != nil { - return err - } - - *s = *SignatureFromGRPCMessage(m) - - return nil + return message.Unmarshal(s, data, new(refs.Signature)) } func (v *Version) StableMarshal(buf []byte) ([]byte, error) { @@ -356,12 +314,5 @@ func (v *Version) StableSize() (size int) { } func (v *Version) Unmarshal(data []byte) error { - m := new(refs.Version) - if err := goproto.Unmarshal(data, m); err != nil { - return err - } - - *v = *VersionFromGRPCMessage(m) - - return nil + return message.Unmarshal(v, data, new(refs.Version)) } diff --git a/v2/refs/marshal_test.go b/v2/refs/marshal_test.go deleted file mode 100644 index 3bc2eb2..0000000 --- a/v2/refs/marshal_test.go +++ /dev/null @@ -1,146 +0,0 @@ -package refs_test - -import ( - "testing" - - "github.com/nspcc-dev/neofs-api-go/v2/refs" - "github.com/stretchr/testify/require" -) - -func TestOwnerID_StableMarshal(t *testing.T) { - ownerFrom := new(refs.OwnerID) - - t.Run("non empty", func(t *testing.T) { - ownerFrom.SetValue([]byte("Owner ID")) - - wire, err := ownerFrom.StableMarshal(nil) - require.NoError(t, err) - - ownerTo := new(refs.OwnerID) - require.NoError(t, ownerTo.Unmarshal(wire)) - - require.Equal(t, ownerFrom, ownerTo) - }) -} - -func TestContainerID_StableMarshal(t *testing.T) { - cnrFrom := new(refs.ContainerID) - - t.Run("non empty", func(t *testing.T) { - cnrFrom.SetValue([]byte("Container ID")) - - wire, err := cnrFrom.StableMarshal(nil) - require.NoError(t, err) - - cnrTo := new(refs.ContainerID) - require.NoError(t, cnrTo.Unmarshal(wire)) - - require.Equal(t, cnrFrom, cnrTo) - }) -} - -func TestObjectID_StableMarshal(t *testing.T) { - objectIDFrom := new(refs.ObjectID) - - t.Run("non empty", func(t *testing.T) { - objectIDFrom.SetValue([]byte("Object ID")) - - wire, err := objectIDFrom.StableMarshal(nil) - require.NoError(t, err) - - objectIDTo := new(refs.ObjectID) - require.NoError(t, objectIDTo.Unmarshal(wire)) - - require.Equal(t, objectIDFrom, objectIDTo) - }) -} - -func TestAddress_StableMarshal(t *testing.T) { - cid := []byte("Container ID") - oid := []byte("Object ID") - - addressFrom := generateAddress(cid, oid) - - t.Run("non empty", func(t *testing.T) { - wire, err := addressFrom.StableMarshal(nil) - require.NoError(t, err) - - addressTo := new(refs.Address) - require.NoError(t, addressTo.Unmarshal(wire)) - - require.Equal(t, addressFrom, addressTo) - }) -} - -func TestChecksum_StableMarshal(t *testing.T) { - checksumFrom := new(refs.Checksum) - - t.Run("non empty", func(t *testing.T) { - checksumFrom.SetType(refs.TillichZemor) - checksumFrom.SetSum([]byte("Homomorphic Hash")) - - wire, err := checksumFrom.StableMarshal(nil) - require.NoError(t, err) - - checksumTo := new(refs.Checksum) - require.NoError(t, checksumTo.Unmarshal(wire)) - - require.Equal(t, checksumFrom, checksumTo) - }) -} - -func TestSignature_StableMarshal(t *testing.T) { - signatureFrom := generateSignature("Public Key", "Signature") - - t.Run("non empty", func(t *testing.T) { - wire, err := signatureFrom.StableMarshal(nil) - require.NoError(t, err) - - signatureTo := new(refs.Signature) - require.NoError(t, signatureTo.Unmarshal(wire)) - - require.Equal(t, signatureFrom, signatureTo) - }) -} - -func TestVersion_StableMarshal(t *testing.T) { - versionFrom := generateVersion(2, 0) - - t.Run("non empty", func(t *testing.T) { - wire, err := versionFrom.StableMarshal(nil) - require.NoError(t, err) - - versionTo := new(refs.Version) - require.NoError(t, versionTo.Unmarshal(wire)) - - require.Equal(t, versionFrom, versionTo) - }) -} - -func generateSignature(k, v string) *refs.Signature { - sig := new(refs.Signature) - sig.SetKey([]byte(k)) - sig.SetSign([]byte(v)) - - return sig -} - -func generateVersion(maj, min uint32) *refs.Version { - version := new(refs.Version) - version.SetMajor(maj) - version.SetMinor(min) - - return version -} - -func generateAddress(bCid, bOid []byte) *refs.Address { - addr := new(refs.Address) - - cid := new(refs.ContainerID) - cid.SetValue(bCid) - - oid := new(refs.ObjectID) - oid.SetValue(bOid) - - return addr -} diff --git a/v2/refs/message_test.go b/v2/refs/message_test.go new file mode 100644 index 0000000..92eb6df --- /dev/null +++ b/v2/refs/message_test.go @@ -0,0 +1,21 @@ +package refs_test + +import ( + "testing" + + "github.com/nspcc-dev/neofs-api-go/rpc/message" + messagetest "github.com/nspcc-dev/neofs-api-go/rpc/message/test" + refstest "github.com/nspcc-dev/neofs-api-go/v2/refs/test" +) + +func TestMessageConvert(t *testing.T) { + messagetest.TestRPCMessage(t, + func(empty bool) message.Message { return refstest.GenerateOwnerID(empty) }, + func(empty bool) message.Message { return refstest.GenerateObjectID(empty) }, + func(empty bool) message.Message { return refstest.GenerateContainerID(empty) }, + func(empty bool) message.Message { return refstest.GenerateAddress(empty) }, + func(empty bool) message.Message { return refstest.GenerateChecksum(empty) }, + func(empty bool) message.Message { return refstest.GenerateSignature(empty) }, + func(empty bool) message.Message { return refstest.GenerateVersion(empty) }, + ) +} diff --git a/v2/refs/test/generate.go b/v2/refs/test/generate.go new file mode 100644 index 0000000..1f90ce0 --- /dev/null +++ b/v2/refs/test/generate.go @@ -0,0 +1,101 @@ +package refstest + +import ( + "github.com/nspcc-dev/neofs-api-go/v2/refs" +) + +func GenerateVersion(empty bool) *refs.Version { + m := new(refs.Version) + + if !empty { + m.SetMajor(2) + m.SetMinor(1) + } + + return m +} + +func GenerateOwnerID(empty bool) *refs.OwnerID { + m := new(refs.OwnerID) + + if !empty { + m.SetValue([]byte{1, 2, 3}) + } + + return m +} + +func GenerateAddress(empty bool) *refs.Address { + m := new(refs.Address) + + m.SetObjectID(GenerateObjectID(empty)) + m.SetContainerID(GenerateContainerID(empty)) + + return m +} + +func GenerateObjectID(empty bool) *refs.ObjectID { + m := new(refs.ObjectID) + + if !empty { + m.SetValue([]byte{1, 2, 3}) + } + + return m +} + +func GenerateObjectIDs(empty bool) []*refs.ObjectID { + ids := make([]*refs.ObjectID, 0) + + if !empty { + ids = append(ids, + GenerateObjectID(false), + GenerateObjectID(false), + ) + } + + return ids +} + +func GenerateContainerID(empty bool) *refs.ContainerID { + m := new(refs.ContainerID) + + if !empty { + m.SetValue([]byte{1, 2, 3}) + } + + return m +} + +func GenerateContainerIDs(empty bool) (res []*refs.ContainerID) { + if !empty { + res = append(res, + GenerateContainerID(false), + GenerateContainerID(false), + ) + } + + return +} + +func GenerateSignature(empty bool) *refs.Signature { + m := new(refs.Signature) + + if !empty { + m.SetKey([]byte{1}) + m.SetSign([]byte{2}) + } + + return m +} + +func GenerateChecksum(empty bool) *refs.Checksum { + m := new(refs.Checksum) + + if !empty { + m.SetType(1) + m.SetSum([]byte{1, 2, 3}) + } + + return m +} diff --git a/v2/rpc/accounting.go b/v2/rpc/accounting.go new file mode 100644 index 0000000..0e031da --- /dev/null +++ b/v2/rpc/accounting.go @@ -0,0 +1,29 @@ +package rpc + +import ( + "github.com/nspcc-dev/neofs-api-go/rpc/client" + "github.com/nspcc-dev/neofs-api-go/rpc/common" + "github.com/nspcc-dev/neofs-api-go/v2/accounting" +) + +const serviceAccounting = serviceNamePrefix + "accounting.AccountingService" + +const ( + rpcAccountingBalance = "Balance" +) + +// Balance executes AccountingService.Balance RPC. +func Balance( + cli *client.Client, + req *accounting.BalanceRequest, + opts ...client.CallOption, +) (*accounting.BalanceResponse, error) { + resp := new(accounting.BalanceResponse) + + err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceAccounting, rpcAccountingBalance), req, resp, opts...) + if err != nil { + return nil, err + } + + return resp, nil +} diff --git a/v2/rpc/common.go b/v2/rpc/common.go new file mode 100644 index 0000000..7d0bf56 --- /dev/null +++ b/v2/rpc/common.go @@ -0,0 +1,3 @@ +package rpc + +const serviceNamePrefix = "neo.fs.v2." diff --git a/v2/rpc/container.go b/v2/rpc/container.go new file mode 100644 index 0000000..82dbe8a --- /dev/null +++ b/v2/rpc/container.go @@ -0,0 +1,131 @@ +package rpc + +import ( + "github.com/nspcc-dev/neofs-api-go/rpc/client" + "github.com/nspcc-dev/neofs-api-go/rpc/common" + "github.com/nspcc-dev/neofs-api-go/v2/container" +) + +const serviceContainer = serviceNamePrefix + "container.ContainerService" + +const ( + rpcContainerPut = "Put" + rpcContainerGet = "Get" + rpcContainerDel = "Delete" + rpcContainerList = "List" + rpcContainerSetEACL = "SetExtendedACL" + rpcContainerGetEACL = "GetExtendedACL" + rpcContainerUsedSpace = "AnnounceUsedSpace" +) + +// PutContainer executes ContainerService.Put RPC. +func PutContainer( + cli *client.Client, + req *container.PutRequest, + opts ...client.CallOption, +) (*container.PutResponse, error) { + resp := new(container.PutResponse) + + err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceContainer, rpcContainerPut), req, resp, opts...) + if err != nil { + return nil, err + } + + return resp, nil +} + +// GetContainer executes ContainerService.Get RPC. +func GetContainer( + cli *client.Client, + req *container.GetRequest, + opts ...client.CallOption, +) (*container.GetResponse, error) { + resp := new(container.GetResponse) + + err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceContainer, rpcContainerGet), req, resp, opts...) + if err != nil { + return nil, err + } + + return resp, nil +} + +// DeleteContainer executes ContainerService.Delete RPC. +func DeleteContainer( + cli *client.Client, + req *container.DeleteRequest, + opts ...client.CallOption, +) (*container.PutResponse, error) { + resp := new(container.PutResponse) + + err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceContainer, rpcContainerDel), req, resp, opts...) + if err != nil { + return nil, err + } + + return resp, nil +} + +// ListContainers executes ContainerService.List RPC. +func ListContainers( + cli *client.Client, + req *container.ListRequest, + opts ...client.CallOption, +) (*container.ListResponse, error) { + resp := new(container.ListResponse) + + err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceContainer, rpcContainerList), req, resp, opts...) + if err != nil { + return nil, err + } + + return resp, nil +} + +// SetEACL executes ContainerService.SetExtendedACL RPC. +func SetEACL( + cli *client.Client, + req *container.SetExtendedACLRequest, + opts ...client.CallOption, +) (*container.PutResponse, error) { + resp := new(container.PutResponse) + + err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceContainer, rpcContainerSetEACL), req, resp, opts...) + if err != nil { + return nil, err + } + + return resp, nil +} + +// GetEACL executes ContainerService.GetExtendedACL RPC. +func GetEACL( + cli *client.Client, + req *container.GetExtendedACLRequest, + opts ...client.CallOption, +) (*container.GetExtendedACLResponse, error) { + resp := new(container.GetExtendedACLResponse) + + err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceContainer, rpcContainerGetEACL), req, resp, opts...) + if err != nil { + return nil, err + } + + return resp, nil +} + +// AnnounceUsedSpace executes ContainerService.AnnounceUsedSpace RPC. +func AnnounceUsedSpace( + cli *client.Client, + req *container.AnnounceUsedSpaceRequest, + opts ...client.CallOption, +) (*container.PutResponse, error) { + resp := new(container.PutResponse) + + err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceContainer, rpcContainerUsedSpace), req, resp, opts...) + if err != nil { + return nil, err + } + + return resp, nil +} diff --git a/v2/rpc/netmap.go b/v2/rpc/netmap.go new file mode 100644 index 0000000..6e68456 --- /dev/null +++ b/v2/rpc/netmap.go @@ -0,0 +1,46 @@ +package rpc + +import ( + "github.com/nspcc-dev/neofs-api-go/rpc/client" + "github.com/nspcc-dev/neofs-api-go/rpc/common" + "github.com/nspcc-dev/neofs-api-go/v2/netmap" +) + +const serviceNetmap = serviceNamePrefix + "netmap.NetmapService" + +const ( + rpcNetmapNodeInfo = "LocalNodeInfo" + rpcNetmapNetInfo = "NetworkInfo" +) + +// LocalNodeInfo executes NetmapService.LocalNodeInfo RPC. +func LocalNodeInfo( + cli *client.Client, + req *netmap.LocalNodeInfoRequest, + opts ...client.CallOption, +) (*netmap.LocalNodeInfoResponse, error) { + resp := new(netmap.LocalNodeInfoResponse) + + err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceNetmap, rpcNetmapNodeInfo), req, resp, opts...) + if err != nil { + return nil, err + } + + return resp, nil +} + +// NetworkInfo executes NetmapService.NetworkInfo RPC. +func NetworkInfo( + cli *client.Client, + req *netmap.NetworkInfoRequest, + opts ...client.CallOption, +) (*netmap.NetworkInfoResponse, error) { + resp := new(netmap.NetworkInfoResponse) + + err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceNetmap, rpcNetmapNetInfo), req, resp, opts...) + if err != nil { + return nil, err + } + + return resp, nil +} diff --git a/v2/rpc/object.go b/v2/rpc/object.go new file mode 100644 index 0000000..7e64a61 --- /dev/null +++ b/v2/rpc/object.go @@ -0,0 +1,190 @@ +package rpc + +import ( + "github.com/nspcc-dev/neofs-api-go/rpc/client" + "github.com/nspcc-dev/neofs-api-go/rpc/common" + "github.com/nspcc-dev/neofs-api-go/rpc/message" + "github.com/nspcc-dev/neofs-api-go/v2/object" +) + +const serviceObject = serviceNamePrefix + "object.ObjectService" + +const ( + rpcObjectPut = "Put" + rpcObjectGet = "Get" + rpcObjectSearch = "Search" + rpcObjectRange = "GetRange" + rpcObjectHash = "GetRangeHash" + rpcObjectHead = "Head" + rpcObjectDelete = "Delete" +) + +// PutRequestWriter is an object.PutRequest +// message streaming component. +type PutRequestWriter struct { + wc client.MessageWriterCloser + + resp message.Message +} + +// Write writes req to the stream. +func (w *PutRequestWriter) Write(req *object.PutRequest) error { + return w.wc.WriteMessage(req) +} + +// Close closes the stream. +func (w *PutRequestWriter) Close() error { + return w.wc.Close() +} + +// PutObject executes ObjectService.Put RPC. +func PutObject( + cli *client.Client, + resp *object.PutResponse, + opts ...client.CallOption, +) (*PutRequestWriter, error) { + wc, err := client.OpenClientStream(cli, common.CallMethodInfoClientStream(serviceObject, rpcObjectPut), resp, opts...) + if err != nil { + return nil, err + } + + return &PutRequestWriter{ + wc: wc, + resp: resp, + }, nil +} + +// GetResponseReader is an object.GetResponse +// stream reader. +type GetResponseReader struct { + r client.MessageReader +} + +// Read reads response from the stream. +// +// Returns io.EOF of streaming is finished. +func (r *GetResponseReader) Read(resp *object.GetResponse) error { + return r.r.ReadMessage(resp) +} + +// GetObject executes ObjectService.Get RPC. +func GetObject( + cli *client.Client, + req *object.GetRequest, + opts ...client.CallOption, +) (*GetResponseReader, error) { + wc, err := client.OpenServerStream(cli, common.CallMethodInfoServerStream(serviceObject, rpcObjectGet), req, opts...) + if err != nil { + return nil, err + } + + return &GetResponseReader{ + r: wc, + }, nil +} + +// GetResponseReader is an object.SearchResponse +// stream reader. +type SearchResponseReader struct { + r client.MessageReader +} + +// Read reads response from the stream. +// +// Returns io.EOF of streaming is finished. +func (r *SearchResponseReader) Read(resp *object.SearchResponse) error { + return r.r.ReadMessage(resp) +} + +// SearchObjects executes ObjectService.Search RPC. +func SearchObjects( + cli *client.Client, + req *object.SearchRequest, + opts ...client.CallOption, +) (*SearchResponseReader, error) { + wc, err := client.OpenServerStream(cli, common.CallMethodInfoServerStream(serviceObject, rpcObjectSearch), req, opts...) + if err != nil { + return nil, err + } + + return &SearchResponseReader{ + r: wc, + }, nil +} + +// GetResponseReader is an object.GetRangeResponse +// stream reader. +type ObjectRangeResponseReader struct { + r client.MessageReader +} + +// Read reads response from the stream. +// +// Returns io.EOF of streaming is finished. +func (r *ObjectRangeResponseReader) Read(resp *object.GetRangeResponse) error { + return r.r.ReadMessage(resp) +} + +// GetObjectRange executes ObjectService.GetRange RPC. +func GetObjectRange( + cli *client.Client, + req *object.GetRangeRequest, + opts ...client.CallOption, +) (*ObjectRangeResponseReader, error) { + wc, err := client.OpenServerStream(cli, common.CallMethodInfoServerStream(serviceObject, rpcObjectRange), req, opts...) + if err != nil { + return nil, err + } + + return &ObjectRangeResponseReader{ + r: wc, + }, nil +} + +// HeadObject executes ObjectService.Head RPC. +func HeadObject( + cli *client.Client, + req *object.HeadRequest, + opts ...client.CallOption, +) (*object.HeadResponse, error) { + resp := new(object.HeadResponse) + + err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceObject, rpcObjectHead), req, resp, opts...) + if err != nil { + return nil, err + } + + return resp, nil +} + +// DeleteObject executes ObjectService.Delete RPC. +func DeleteObject( + cli *client.Client, + req *object.DeleteRequest, + opts ...client.CallOption, +) (*object.DeleteResponse, error) { + resp := new(object.DeleteResponse) + + err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceObject, rpcObjectDelete), req, resp, opts...) + if err != nil { + return nil, err + } + + return resp, nil +} + +// HashObjectRange executes ObjectService.GetRangeHash RPC. +func HashObjectRange( + cli *client.Client, + req *object.GetRangeHashRequest, + opts ...client.CallOption, +) (*object.GetRangeHashResponse, error) { + resp := new(object.GetRangeHashResponse) + + err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceObject, rpcObjectHash), req, resp, opts...) + if err != nil { + return nil, err + } + + return resp, nil +} diff --git a/v2/rpc/session.go b/v2/rpc/session.go new file mode 100644 index 0000000..89b5f1c --- /dev/null +++ b/v2/rpc/session.go @@ -0,0 +1,28 @@ +package rpc + +import ( + "github.com/nspcc-dev/neofs-api-go/rpc/client" + "github.com/nspcc-dev/neofs-api-go/rpc/common" + "github.com/nspcc-dev/neofs-api-go/v2/session" +) + +const serviceSession = serviceNamePrefix + "session.SessionService" + +const ( + rpcSessionCreate = "Create" +) + +func CreateSession( + cli *client.Client, + req *session.CreateRequest, + opts ...client.CallOption, +) (*session.CreateResponse, error) { + resp := new(session.CreateResponse) + + err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceSession, rpcSessionCreate), req, resp, opts...) + if err != nil { + return nil, err + } + + return resp, nil +} diff --git a/v2/session/client.go b/v2/session/client.go deleted file mode 100644 index f1709c7..0000000 --- a/v2/session/client.go +++ /dev/null @@ -1,156 +0,0 @@ -package session - -import ( - "context" - - "github.com/nspcc-dev/neofs-api-go/v2/client" - session "github.com/nspcc-dev/neofs-api-go/v2/session/grpc" - "github.com/pkg/errors" - "google.golang.org/grpc" -) - -// Client represents universal session -// transport client. -type Client struct { - client *createClient -} - -// Option represents Client option. -type Option func(*cfg) - -type cfg struct { - proto client.Protocol - - globalOpts []client.Option - - gRPC cfgGRPC -} - -type cfgGRPC struct { - serviceClient session.SessionServiceClient - - grpcCallOpts []grpc.CallOption - - callOpts []session.Option - - client *session.Client -} - -type createClient struct { - requestConverter func(*CreateRequest) interface{} - - caller func(context.Context, interface{}) (interface{}, error) - - responseConverter func(interface{}) *CreateResponse -} - -// Create sends CreateRequest over the network and returns CreateResponse. -// -// It returns any error encountered during the call. -func (c *Client) Create(ctx context.Context, req *CreateRequest) (*CreateResponse, error) { - resp, err := c.client.caller(ctx, c.client.requestConverter(req)) - if err != nil { - return nil, errors.Wrap(err, "could not send session init request") - } - - return c.client.responseConverter(resp), nil -} - -func defaultCfg() *cfg { - return &cfg{ - proto: client.ProtoGRPC, - } -} - -func NewClient(opts ...Option) (*Client, error) { - cfg := defaultCfg() - - for i := range opts { - opts[i](cfg) - } - - var err error - - switch cfg.proto { - case client.ProtoGRPC: - var c *session.Client - if c, err = newGRPCClient(cfg); err != nil { - break - } - - return &Client{ - client: &createClient{ - requestConverter: func(req *CreateRequest) interface{} { - return CreateRequestToGRPCMessage(req) - }, - caller: func(ctx context.Context, req interface{}) (interface{}, error) { - return c.Create(ctx, req.(*session.CreateRequest)) - }, - responseConverter: func(resp interface{}) *CreateResponse { - return CreateResponseFromGRPCMessage(resp.(*session.CreateResponse)) - }, - }, - }, nil - default: - err = client.ErrProtoUnsupported - } - - return nil, errors.Wrapf(err, "could not create %s Session client", cfg.proto) -} - -func newGRPCClient(cfg *cfg) (*session.Client, error) { - var err error - - if cfg.gRPC.client == nil { - if cfg.gRPC.serviceClient == nil { - conn, err := client.NewGRPCClientConn(cfg.globalOpts...) - if err != nil { - return nil, errors.Wrap(err, "could not open gRPC client connection") - } - - cfg.gRPC.serviceClient = session.NewSessionServiceClient(conn) - } - - cfg.gRPC.client, err = session.NewClient( - cfg.gRPC.serviceClient, - append( - cfg.gRPC.callOpts, - session.WithCallOptions(cfg.gRPC.grpcCallOpts), - )..., - ) - } - - return cfg.gRPC.client, err -} - -func WithGlobalOpts(v ...client.Option) Option { - return func(c *cfg) { - if len(v) > 0 { - c.globalOpts = v - } - } -} - -func WithGRPCServiceClient(v session.SessionServiceClient) Option { - return func(c *cfg) { - c.gRPC.serviceClient = v - } -} - -func WithGRPCCallOpts(v []grpc.CallOption) Option { - return func(c *cfg) { - c.gRPC.grpcCallOpts = v - } -} - -func WithGRPCClientOpts(v []session.Option) Option { - return func(c *cfg) { - c.gRPC.callOpts = v - } -} - -func WithGRPCClient(v *session.Client) Option { - return func(c *cfg) { - c.gRPC.client = v - } -} diff --git a/v2/session/convert.go b/v2/session/convert.go index 5d73dc4..084377e 100644 --- a/v2/session/convert.go +++ b/v2/session/convert.go @@ -3,537 +3,614 @@ package session import ( "fmt" + "github.com/nspcc-dev/neofs-api-go/rpc/grpc" + "github.com/nspcc-dev/neofs-api-go/rpc/message" "github.com/nspcc-dev/neofs-api-go/v2/acl" + aclGRPC "github.com/nspcc-dev/neofs-api-go/v2/acl/grpc" "github.com/nspcc-dev/neofs-api-go/v2/refs" + refsGRPC "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" session "github.com/nspcc-dev/neofs-api-go/v2/session/grpc" + "github.com/pkg/errors" ) -func CreateRequestBodyToGRPCMessage(c *CreateRequestBody) *session.CreateRequest_Body { - if c == nil { - return nil +func (c *CreateRequestBody) ToGRPCMessage() grpc.Message { + var m *session.CreateRequest_Body + + if c != nil { + m = new(session.CreateRequest_Body) + + m.SetOwnerId(c.ownerID.ToGRPCMessage().(*refsGRPC.OwnerID)) + m.SetExpiration(c.expiration) } - m := new(session.CreateRequest_Body) - - m.SetOwnerId( - refs.OwnerIDToGRPCMessage(c.GetOwnerID()), - ) - - m.SetExpiration(c.GetExpiration()) - return m } -func CreateRequestBodyFromGRPCMessage(m *session.CreateRequest_Body) *CreateRequestBody { - if m == nil { - return nil +func (c *CreateRequestBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*session.CreateRequest_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) } - c := new(CreateRequestBody) + var err error - c.SetOwnerID( - refs.OwnerIDFromGRPCMessage(m.GetOwnerId()), - ) + ownerID := v.GetOwnerId() + if ownerID == nil { + c.ownerID = nil + } else { + if c.ownerID == nil { + c.ownerID = new(refs.OwnerID) + } - c.SetExpiration(m.GetExpiration()) + err = c.ownerID.FromGRPCMessage(ownerID) + if err != nil { + return err + } + } - return c + c.expiration = v.GetExpiration() + + return nil } -func CreateRequestToGRPCMessage(c *CreateRequest) *session.CreateRequest { - if c == nil { - return nil +func (c *CreateRequest) ToGRPCMessage() grpc.Message { + var m *session.CreateRequest + + if c != nil { + m = new(session.CreateRequest) + + m.SetBody(c.body.ToGRPCMessage().(*session.CreateRequest_Body)) + c.RequestHeaders.ToMessage(m) } - m := new(session.CreateRequest) - - m.SetBody( - CreateRequestBodyToGRPCMessage(c.GetBody()), - ) - - RequestHeadersToGRPC(c, m) - return m } -func CreateRequestFromGRPCMessage(m *session.CreateRequest) *CreateRequest { - if m == nil { - return nil +func (c *CreateRequest) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*session.CreateRequest) + if !ok { + return message.NewUnexpectedMessageType(m, v) } - c := new(CreateRequest) + var err error - c.SetBody( - CreateRequestBodyFromGRPCMessage(m.GetBody()), - ) + body := v.GetBody() + if body == nil { + c.body = nil + } else { + if c.body == nil { + c.body = new(CreateRequestBody) + } - RequestHeadersFromGRPC(m, c) + err = c.body.FromGRPCMessage(body) + if err != nil { + return err + } + } - return c + return c.RequestHeaders.FromMessage(v) } -func CreateResponseBodyToGRPCMessage(c *CreateResponseBody) *session.CreateResponse_Body { - if c == nil { - return nil +func (c *CreateResponseBody) ToGRPCMessage() grpc.Message { + var m *session.CreateResponse_Body + + if c != nil { + m = new(session.CreateResponse_Body) + + m.SetSessionKey(c.sessionKey) + m.SetId(c.id) } - m := new(session.CreateResponse_Body) - - m.SetId(c.GetID()) - m.SetSessionKey(c.GetSessionKey()) - return m } -func CreateResponseBodyFromGRPCMessage(m *session.CreateResponse_Body) *CreateResponseBody { - if m == nil { - return nil +func (c *CreateResponseBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*session.CreateResponse_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) } - c := new(CreateResponseBody) + c.sessionKey = v.GetSessionKey() + c.id = v.GetId() - c.SetID(m.GetId()) - c.SetSessionKey(m.GetSessionKey()) - - return c + return nil } -func CreateResponseToGRPCMessage(c *CreateResponse) *session.CreateResponse { - if c == nil { - return nil +func (c *CreateResponse) ToGRPCMessage() grpc.Message { + var m *session.CreateResponse + + if c != nil { + m = new(session.CreateResponse) + + m.SetBody(c.body.ToGRPCMessage().(*session.CreateResponse_Body)) + c.ResponseHeaders.ToMessage(m) } - m := new(session.CreateResponse) - - m.SetBody( - CreateResponseBodyToGRPCMessage(c.GetBody()), - ) - - ResponseHeadersToGRPC(c, m) - return m } -func CreateResponseFromGRPCMessage(m *session.CreateResponse) *CreateResponse { - if m == nil { - return nil +func (c *CreateResponse) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*session.CreateResponse) + if !ok { + return message.NewUnexpectedMessageType(m, v) } - c := new(CreateResponse) + var err error - c.SetBody( - CreateResponseBodyFromGRPCMessage(m.GetBody()), - ) + body := v.GetBody() + if body == nil { + c.body = nil + } else { + if c.body == nil { + c.body = new(CreateResponseBody) + } - ResponseHeadersFromGRPC(m, c) + err = c.body.FromGRPCMessage(body) + if err != nil { + return err + } + } - return c + return c.ResponseHeaders.FromMessage(v) } -func TokenLifetimeToGRPCMessage(tl *TokenLifetime) *session.SessionToken_Body_TokenLifetime { - if tl == nil { - return nil +func (l *TokenLifetime) ToGRPCMessage() grpc.Message { + var m *session.SessionToken_Body_TokenLifetime + + if l != nil { + m = new(session.SessionToken_Body_TokenLifetime) + + m.SetExp(l.exp) + m.SetIat(l.iat) + m.SetNbf(l.nbf) } - m := new(session.SessionToken_Body_TokenLifetime) - - m.SetExp(tl.GetExp()) - m.SetNbf(tl.GetNbf()) - m.SetIat(tl.GetIat()) - return m } -func TokenLifetimeFromGRPCMessage(m *session.SessionToken_Body_TokenLifetime) *TokenLifetime { - if m == nil { - return nil +func (l *TokenLifetime) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*session.SessionToken_Body_TokenLifetime) + if !ok { + return message.NewUnexpectedMessageType(m, v) } - tl := new(TokenLifetime) + l.exp = v.GetExp() + l.iat = v.GetIat() + l.nbf = v.GetNbf() - tl.SetExp(m.GetExp()) - tl.SetNbf(m.GetNbf()) - tl.SetIat(m.GetIat()) - - return tl + return nil } -func XHeaderToGRPCMessage(x *XHeader) *session.XHeader { - if x == nil { - return nil +func (x *XHeader) ToGRPCMessage() grpc.Message { + var m *session.XHeader + + if x != nil { + m = new(session.XHeader) + + m.SetKey(x.key) + m.SetValue(x.val) } - m := new(session.XHeader) - - m.SetKey(x.GetKey()) - m.SetValue(x.GetValue()) - return m } -func XHeaderFromGRPCMessage(m *session.XHeader) *XHeader { - if m == nil { - return nil +func (x *XHeader) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*session.XHeader) + if !ok { + return message.NewUnexpectedMessageType(m, v) } - x := new(XHeader) + x.key = v.GetKey() + x.val = v.GetValue() - x.SetKey(m.GetKey()) - x.SetValue(m.GetValue()) - - return x + return nil } -func SessionTokenToGRPCMessage(t *SessionToken) *session.SessionToken { - if t == nil { - return nil +func XHeadersToGRPC(xs []*XHeader) (res []*session.XHeader) { + if xs != nil { + res = make([]*session.XHeader, 0, len(xs)) + + for i := range xs { + res = append(res, xs[i].ToGRPCMessage().(*session.XHeader)) + } } - m := new(session.SessionToken) + return +} - m.SetBody( - SessionTokenBodyToGRPCMessage(t.GetBody()), - ) +func XHeadersFromGRPC(xs []*session.XHeader) (res []*XHeader, err error) { + if xs != nil { + res = make([]*XHeader, 0, len(xs)) - m.SetSignature( - refs.SignatureToGRPCMessage(t.GetSignature()), - ) + for i := range xs { + var x *XHeader + + if xs[i] != nil { + x = new(XHeader) + + err = x.FromGRPCMessage(xs[i]) + if err != nil { + return + } + } + + res = append(res, x) + } + } + + return +} + +func (t *SessionToken) ToGRPCMessage() grpc.Message { + var m *session.SessionToken + + if t != nil { + m = new(session.SessionToken) + + m.SetBody(t.body.ToGRPCMessage().(*session.SessionToken_Body)) + m.SetSignature(t.sig.ToGRPCMessage().(*refsGRPC.Signature)) + } return m } -func SessionTokenFromGRPCMessage(m *session.SessionToken) *SessionToken { - if m == nil { - return nil +func (t *SessionToken) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*session.SessionToken) + if !ok { + return message.NewUnexpectedMessageType(m, v) } - t := new(SessionToken) + var err error - t.SetBody( - SessionTokenBodyFromGRPCMessage(m.GetBody()), - ) + body := v.GetBody() + if body == nil { + t.body = nil + } else { + if t.body == nil { + t.body = new(SessionTokenBody) + } - t.SetSignature( - refs.SignatureFromGRPCMessage(m.GetSignature()), - ) + err = t.body.FromGRPCMessage(body) + if err != nil { + return err + } + } - return t + sig := v.GetSignature() + if sig == nil { + t.sig = nil + } else { + if t.sig == nil { + t.sig = new(refs.Signature) + } + + err = t.sig.FromGRPCMessage(sig) + if err != nil { + return err + } + } + + return nil } -func RequestVerificationHeaderToGRPCMessage(r *RequestVerificationHeader) *session.RequestVerificationHeader { - if r == nil { - return nil +func (r *RequestVerificationHeader) ToGRPCMessage() grpc.Message { + var m *session.RequestVerificationHeader + + if r != nil { + m = new(session.RequestVerificationHeader) + + m.SetBodySignature(r.bodySig.ToGRPCMessage().(*refsGRPC.Signature)) + m.SetMetaSignature(r.metaSig.ToGRPCMessage().(*refsGRPC.Signature)) + m.SetOriginSignature(r.originSig.ToGRPCMessage().(*refsGRPC.Signature)) + m.SetOrigin(r.origin.ToGRPCMessage().(*session.RequestVerificationHeader)) } - m := new(session.RequestVerificationHeader) - - m.SetBodySignature( - refs.SignatureToGRPCMessage(r.GetBodySignature()), - ) - - m.SetMetaSignature( - refs.SignatureToGRPCMessage(r.GetMetaSignature()), - ) - - m.SetOriginSignature( - refs.SignatureToGRPCMessage(r.GetOriginSignature()), - ) - - m.SetOrigin( - RequestVerificationHeaderToGRPCMessage(r.GetOrigin()), - ) - return m } -func RequestVerificationHeaderFromGRPCMessage(m *session.RequestVerificationHeader) *RequestVerificationHeader { - if m == nil { - return nil +func (r *RequestVerificationHeader) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*session.RequestVerificationHeader) + if !ok { + return message.NewUnexpectedMessageType(m, v) } - r := new(RequestVerificationHeader) + var err error - r.SetBodySignature( - refs.SignatureFromGRPCMessage(m.GetBodySignature()), - ) + originSig := v.GetOriginSignature() + if originSig == nil { + r.originSig = nil + } else { + if r.originSig == nil { + r.originSig = new(refs.Signature) + } - r.SetMetaSignature( - refs.SignatureFromGRPCMessage(m.GetMetaSignature()), - ) + err = r.originSig.FromGRPCMessage(originSig) + if err != nil { + return err + } + } - r.SetOriginSignature( - refs.SignatureFromGRPCMessage(m.GetOriginSignature()), - ) + metaSig := v.GetMetaSignature() + if metaSig == nil { + r.metaSig = nil + } else { + if r.metaSig == nil { + r.metaSig = new(refs.Signature) + } - r.SetOrigin( - RequestVerificationHeaderFromGRPCMessage(m.GetOrigin()), - ) + err = r.metaSig.FromGRPCMessage(metaSig) + if err != nil { + return err + } + } - return r + bodySig := v.GetBodySignature() + if bodySig == nil { + r.bodySig = nil + } else { + if r.bodySig == nil { + r.bodySig = new(refs.Signature) + } + + err = r.bodySig.FromGRPCMessage(bodySig) + if err != nil { + return err + } + } + + origin := v.GetOrigin() + if origin == nil { + r.origin = nil + } else { + if r.origin == nil { + r.origin = new(RequestVerificationHeader) + } + + err = r.origin.FromGRPCMessage(origin) + if err != nil { + return err + } + } + + return nil } -func RequestMetaHeaderToGRPCMessage(r *RequestMetaHeader) *session.RequestMetaHeader { - if r == nil { - return nil +func (r *RequestMetaHeader) ToGRPCMessage() grpc.Message { + var m *session.RequestMetaHeader + + if r != nil { + m = new(session.RequestMetaHeader) + + m.SetVersion(r.version.ToGRPCMessage().(*refsGRPC.Version)) + m.SetSessionToken(r.sessionToken.ToGRPCMessage().(*session.SessionToken)) + m.SetBearerToken(r.bearerToken.ToGRPCMessage().(*aclGRPC.BearerToken)) + m.SetXHeaders(XHeadersToGRPC(r.xHeaders)) + m.SetEpoch(r.epoch) + m.SetTtl(r.ttl) + m.SetOrigin(r.origin.ToGRPCMessage().(*session.RequestMetaHeader)) } - m := new(session.RequestMetaHeader) - - m.SetTtl(r.GetTTL()) - m.SetEpoch(r.GetEpoch()) - - m.SetVersion( - refs.VersionToGRPCMessage(r.GetVersion()), - ) - - m.SetSessionToken( - SessionTokenToGRPCMessage(r.GetSessionToken()), - ) - - m.SetBearerToken( - acl.BearerTokenToGRPCMessage(r.GetBearerToken()), - ) - - m.SetOrigin( - RequestMetaHeaderToGRPCMessage(r.GetOrigin()), - ) - - xHeaders := r.GetXHeaders() - xHdrMsg := make([]*session.XHeader, 0, len(xHeaders)) - - for i := range xHeaders { - xHdrMsg = append(xHdrMsg, XHeaderToGRPCMessage(xHeaders[i])) - } - - m.SetXHeaders(xHdrMsg) - return m } -func RequestMetaHeaderFromGRPCMessage(m *session.RequestMetaHeader) *RequestMetaHeader { - if m == nil { - return nil +func (r *RequestMetaHeader) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*session.RequestMetaHeader) + if !ok { + return message.NewUnexpectedMessageType(m, v) } - r := new(RequestMetaHeader) + var err error - r.SetTTL(m.GetTtl()) - r.SetEpoch(m.GetEpoch()) + version := v.GetVersion() + if version == nil { + r.version = nil + } else { + if r.version == nil { + r.version = new(refs.Version) + } - r.SetVersion( - refs.VersionFromGRPCMessage(m.GetVersion()), - ) - - r.SetSessionToken( - SessionTokenFromGRPCMessage(m.GetSessionToken()), - ) - - r.SetBearerToken( - acl.BearerTokenFromGRPCMessage(m.GetBearerToken()), - ) - - r.SetOrigin( - RequestMetaHeaderFromGRPCMessage(m.GetOrigin()), - ) - - xHdrMsg := m.GetXHeaders() - xHeaders := make([]*XHeader, 0, len(xHdrMsg)) - - for i := range xHdrMsg { - xHeaders = append(xHeaders, XHeaderFromGRPCMessage(xHdrMsg[i])) + err = r.version.FromGRPCMessage(version) + if err != nil { + return err + } } - r.SetXHeaders(xHeaders) + sessionToken := v.GetSessionToken() + if sessionToken == nil { + r.sessionToken = nil + } else { + if r.sessionToken == nil { + r.sessionToken = new(SessionToken) + } - return r -} - -func RequestHeadersToGRPC( - src interface { - GetMetaHeader() *RequestMetaHeader - GetVerificationHeader() *RequestVerificationHeader - }, - dst interface { - SetMetaHeader(*session.RequestMetaHeader) - SetVerifyHeader(*session.RequestVerificationHeader) - }, -) { - dst.SetMetaHeader( - RequestMetaHeaderToGRPCMessage(src.GetMetaHeader()), - ) - - dst.SetVerifyHeader( - RequestVerificationHeaderToGRPCMessage(src.GetVerificationHeader()), - ) -} - -func RequestHeadersFromGRPC( - src interface { - GetMetaHeader() *session.RequestMetaHeader - GetVerifyHeader() *session.RequestVerificationHeader - }, - dst interface { - SetMetaHeader(*RequestMetaHeader) - SetVerificationHeader(*RequestVerificationHeader) - }, -) { - dst.SetMetaHeader( - RequestMetaHeaderFromGRPCMessage(src.GetMetaHeader()), - ) - - dst.SetVerificationHeader( - RequestVerificationHeaderFromGRPCMessage(src.GetVerifyHeader()), - ) -} - -func ResponseVerificationHeaderToGRPCMessage(r *ResponseVerificationHeader) *session.ResponseVerificationHeader { - if r == nil { - return nil + err = r.sessionToken.FromGRPCMessage(sessionToken) + if err != nil { + return err + } } - m := new(session.ResponseVerificationHeader) + bearerToken := v.GetBearerToken() + if bearerToken == nil { + r.bearerToken = nil + } else { + if r.bearerToken == nil { + r.bearerToken = new(acl.BearerToken) + } - m.SetBodySignature( - refs.SignatureToGRPCMessage(r.GetBodySignature()), - ) + err = r.bearerToken.FromGRPCMessage(bearerToken) + if err != nil { + return err + } + } - m.SetMetaSignature( - refs.SignatureToGRPCMessage(r.GetMetaSignature()), - ) + origin := v.GetOrigin() + if origin == nil { + r.origin = nil + } else { + if r.origin == nil { + r.origin = new(RequestMetaHeader) + } - m.SetOriginSignature( - refs.SignatureToGRPCMessage(r.GetOriginSignature()), - ) + err = r.origin.FromGRPCMessage(origin) + if err != nil { + return err + } + } - m.SetOrigin( - ResponseVerificationHeaderToGRPCMessage(r.GetOrigin()), - ) + r.xHeaders, err = XHeadersFromGRPC(v.GetXHeaders()) + if err != nil { + return err + } + + r.epoch = v.GetEpoch() + r.ttl = v.GetTtl() + + return nil +} + +func (r *ResponseVerificationHeader) ToGRPCMessage() grpc.Message { + var m *session.ResponseVerificationHeader + + if r != nil { + m = new(session.ResponseVerificationHeader) + + m.SetBodySignature(r.bodySig.ToGRPCMessage().(*refsGRPC.Signature)) + m.SetMetaSignature(r.metaSig.ToGRPCMessage().(*refsGRPC.Signature)) + m.SetOriginSignature(r.originSig.ToGRPCMessage().(*refsGRPC.Signature)) + m.SetOrigin(r.origin.ToGRPCMessage().(*session.ResponseVerificationHeader)) + } return m } -func ResponseVerificationHeaderFromGRPCMessage(m *session.ResponseVerificationHeader) *ResponseVerificationHeader { - if m == nil { - return nil +func (r *ResponseVerificationHeader) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*session.ResponseVerificationHeader) + if !ok { + return message.NewUnexpectedMessageType(m, v) } - r := new(ResponseVerificationHeader) + var err error - r.SetBodySignature( - refs.SignatureFromGRPCMessage(m.GetBodySignature()), - ) + originSig := v.GetOriginSignature() + if originSig == nil { + r.originSig = nil + } else { + if r.originSig == nil { + r.originSig = new(refs.Signature) + } - r.SetMetaSignature( - refs.SignatureFromGRPCMessage(m.GetMetaSignature()), - ) + err = r.originSig.FromGRPCMessage(originSig) + if err != nil { + return err + } + } - r.SetOriginSignature( - refs.SignatureFromGRPCMessage(m.GetOriginSignature()), - ) + metaSig := v.GetMetaSignature() + if metaSig == nil { + r.metaSig = nil + } else { + if r.metaSig == nil { + r.metaSig = new(refs.Signature) + } - r.SetOrigin( - ResponseVerificationHeaderFromGRPCMessage(m.GetOrigin()), - ) + err = r.metaSig.FromGRPCMessage(metaSig) + if err != nil { + return err + } + } - return r + bodySig := v.GetBodySignature() + if bodySig == nil { + r.bodySig = nil + } else { + if r.bodySig == nil { + r.bodySig = new(refs.Signature) + } + + err = r.bodySig.FromGRPCMessage(bodySig) + if err != nil { + return err + } + } + + origin := v.GetOrigin() + if origin == nil { + r.origin = nil + } else { + if r.origin == nil { + r.origin = new(ResponseVerificationHeader) + } + + err = r.origin.FromGRPCMessage(origin) + if err != nil { + return err + } + } + + return nil } -func ResponseMetaHeaderToGRPCMessage(r *ResponseMetaHeader) *session.ResponseMetaHeader { - if r == nil { - return nil +func (r *ResponseMetaHeader) ToGRPCMessage() grpc.Message { + var m *session.ResponseMetaHeader + + if r != nil { + m = new(session.ResponseMetaHeader) + + m.SetVersion(r.version.ToGRPCMessage().(*refsGRPC.Version)) + m.SetXHeaders(XHeadersToGRPC(r.xHeaders)) + m.SetEpoch(r.epoch) + m.SetTtl(r.ttl) + m.SetOrigin(r.origin.ToGRPCMessage().(*session.ResponseMetaHeader)) } - m := new(session.ResponseMetaHeader) - - m.SetTtl(r.GetTTL()) - m.SetEpoch(r.GetEpoch()) - - m.SetVersion( - refs.VersionToGRPCMessage(r.GetVersion()), - ) - - m.SetOrigin( - ResponseMetaHeaderToGRPCMessage(r.GetOrigin()), - ) - - xHeaders := r.GetXHeaders() - xHdrMsg := make([]*session.XHeader, 0, len(xHeaders)) - - for i := range xHeaders { - xHdrMsg = append(xHdrMsg, XHeaderToGRPCMessage(xHeaders[i])) - } - - m.SetXHeaders(xHdrMsg) - return m } -func ResponseMetaHeaderFromGRPCMessage(m *session.ResponseMetaHeader) *ResponseMetaHeader { - if m == nil { - return nil +func (r *ResponseMetaHeader) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*session.ResponseMetaHeader) + if !ok { + return message.NewUnexpectedMessageType(m, v) } - r := new(ResponseMetaHeader) + var err error - r.SetTTL(m.GetTtl()) - r.SetEpoch(m.GetEpoch()) + version := v.GetVersion() + if version == nil { + r.version = nil + } else { + if r.version == nil { + r.version = new(refs.Version) + } - r.SetVersion( - refs.VersionFromGRPCMessage(m.GetVersion()), - ) - - r.SetOrigin( - ResponseMetaHeaderFromGRPCMessage(m.GetOrigin()), - ) - - xHdrMsg := m.GetXHeaders() - xHeaders := make([]*XHeader, 0, len(xHdrMsg)) - - for i := range xHdrMsg { - xHeaders = append(xHeaders, XHeaderFromGRPCMessage(xHdrMsg[i])) + err = r.version.FromGRPCMessage(version) + if err != nil { + return err + } } - r.SetXHeaders(xHeaders) + origin := v.GetOrigin() + if origin == nil { + r.origin = nil + } else { + if r.origin == nil { + r.origin = new(ResponseMetaHeader) + } - return r -} + err = r.origin.FromGRPCMessage(origin) + if err != nil { + return err + } + } -func ResponseHeadersToGRPC( - src interface { - GetMetaHeader() *ResponseMetaHeader - GetVerificationHeader() *ResponseVerificationHeader - }, - dst interface { - SetMetaHeader(*session.ResponseMetaHeader) - SetVerifyHeader(*session.ResponseVerificationHeader) - }, -) { - dst.SetMetaHeader( - ResponseMetaHeaderToGRPCMessage(src.GetMetaHeader()), - ) + r.xHeaders, err = XHeadersFromGRPC(v.GetXHeaders()) + if err != nil { + return err + } - dst.SetVerifyHeader( - ResponseVerificationHeaderToGRPCMessage(src.GetVerificationHeader()), - ) -} + r.epoch = v.GetEpoch() + r.ttl = v.GetTtl() -func ResponseHeadersFromGRPC( - src interface { - GetMetaHeader() *session.ResponseMetaHeader - GetVerifyHeader() *session.ResponseVerificationHeader - }, - dst interface { - SetMetaHeader(*ResponseMetaHeader) - SetVerificationHeader(*ResponseVerificationHeader) - }, -) { - dst.SetMetaHeader( - ResponseMetaHeaderFromGRPCMessage(src.GetMetaHeader()), - ) - - dst.SetVerificationHeader( - ResponseVerificationHeaderFromGRPCMessage(src.GetVerifyHeader()), - ) + return nil } func ObjectSessionVerbToGRPCField(v ObjectSessionVerb) session.ObjectSessionContext_Verb { @@ -578,102 +655,128 @@ func ObjectSessionVerbFromGRPCField(v session.ObjectSessionContext_Verb) ObjectS } } -func ObjectSessionContextToGRPCMessage(c *ObjectSessionContext) *session.ObjectSessionContext { - if c == nil { - return nil +func (c *ObjectSessionContext) ToGRPCMessage() grpc.Message { + var m *session.ObjectSessionContext + + if c != nil { + m = new(session.ObjectSessionContext) + + m.SetVerb(ObjectSessionVerbToGRPCField(c.verb)) + m.SetAddress(c.addr.ToGRPCMessage().(*refsGRPC.Address)) } - m := new(session.ObjectSessionContext) - - m.SetVerb( - ObjectSessionVerbToGRPCField(c.GetVerb()), - ) - - m.SetAddress( - refs.AddressToGRPCMessage(c.GetAddress()), - ) - return m } -func ObjectSessionContextFromGRPCMessage(m *session.ObjectSessionContext) *ObjectSessionContext { - if m == nil { - return nil +func (c *ObjectSessionContext) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*session.ObjectSessionContext) + if !ok { + return message.NewUnexpectedMessageType(m, v) } - c := new(ObjectSessionContext) + var err error - c.SetVerb( - ObjectSessionVerbFromGRPCField(m.GetVerb()), - ) + addr := v.GetAddress() + if addr == nil { + c.addr = nil + } else { + if c.addr == nil { + c.addr = new(refs.Address) + } - c.SetAddress( - refs.AddressFromGRPCMessage(m.GetAddress()), - ) + err = c.addr.FromGRPCMessage(addr) + if err != nil { + return err + } + } - return c + c.verb = ObjectSessionVerbFromGRPCField(v.GetVerb()) + + return nil } -func SessionTokenBodyToGRPCMessage(t *SessionTokenBody) *session.SessionToken_Body { - if t == nil { - return nil +func (t *SessionTokenBody) ToGRPCMessage() grpc.Message { + var m *session.SessionToken_Body + + if t != nil { + m = new(session.SessionToken_Body) + + switch typ := t.ctx.(type) { + default: + panic(fmt.Sprintf("unknown session context %T", typ)) + case nil: + m.Context = nil + case *ObjectSessionContext: + m.SetObjectSessionContext(typ.ToGRPCMessage().(*session.ObjectSessionContext)) + } + + m.SetOwnerId(t.ownerID.ToGRPCMessage().(*refsGRPC.OwnerID)) + m.SetId(t.id) + m.SetSessionKey(t.sessionKey) + m.SetLifetime(t.lifetime.ToGRPCMessage().(*session.SessionToken_Body_TokenLifetime)) } - m := new(session.SessionToken_Body) + return m +} - switch v := t.GetContext(); t := v.(type) { - case nil: - case *ObjectSessionContext: - m.SetObjectSessionContext( - ObjectSessionContextToGRPCMessage(t), - ) +func (t *SessionTokenBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*session.SessionToken_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + t.ctx = nil + + switch val := v.GetContext().(type) { default: - panic(fmt.Sprintf("unknown session context %T", t)) - } - - m.SetId(t.GetID()) - - m.SetOwnerId( - refs.OwnerIDToGRPCMessage(t.GetOwnerID()), - ) - - m.SetLifetime( - TokenLifetimeToGRPCMessage(t.GetLifetime()), - ) - - m.SetSessionKey(t.GetSessionKey()) - - return m -} - -func SessionTokenBodyFromGRPCMessage(m *session.SessionToken_Body) *SessionTokenBody { - if m == nil { - return nil - } - - t := new(SessionTokenBody) - - switch v := m.GetContext().(type) { + err = errors.Errorf("unknown session context %T", val) case nil: case *session.SessionToken_Body_Object: - t.SetContext( - ObjectSessionContextFromGRPCMessage(v.Object), - ) - default: - panic(fmt.Sprintf("unknown session context %T", v)) + ctx, ok := t.ctx.(*ObjectSessionContext) + if !ok { + ctx = new(ObjectSessionContext) + t.ctx = ctx + } + + err = ctx.FromGRPCMessage(val.Object) } - t.SetID(m.GetId()) + if err != nil { + return err + } - t.SetOwnerID( - refs.OwnerIDFromGRPCMessage(m.GetOwnerId()), - ) + ownerID := v.GetOwnerId() + if ownerID == nil { + t.ownerID = nil + } else { + if t.ownerID == nil { + t.ownerID = new(refs.OwnerID) + } - t.SetLifetime( - TokenLifetimeFromGRPCMessage(m.GetLifetime()), - ) + err = t.ownerID.FromGRPCMessage(ownerID) + if err != nil { + return err + } + } - t.SetSessionKey(m.GetSessionKey()) + lifetime := v.GetLifetime() + if lifetime == nil { + t.lifetime = nil + } else { + if t.lifetime == nil { + t.lifetime = new(TokenLifetime) + } - return t + err = t.lifetime.FromGRPCMessage(lifetime) + if err != nil { + return err + } + } + + t.id = v.GetId() + t.sessionKey = v.GetSessionKey() + + return nil } diff --git a/v2/session/json.go b/v2/session/json.go index 2dea2d4..e296887 100644 --- a/v2/session/json.go +++ b/v2/session/json.go @@ -1,56 +1,29 @@ package session import ( + "github.com/nspcc-dev/neofs-api-go/rpc/message" session "github.com/nspcc-dev/neofs-api-go/v2/session/grpc" "google.golang.org/protobuf/encoding/protojson" ) func (c *ObjectSessionContext) MarshalJSON() ([]byte, error) { - return protojson.MarshalOptions{ - EmitUnpopulated: true, - }.Marshal( - ObjectSessionContextToGRPCMessage(c), - ) + return message.MarshalJSON(c) } func (c *ObjectSessionContext) UnmarshalJSON(data []byte) error { - msg := new(session.ObjectSessionContext) - - if err := protojson.Unmarshal(data, msg); err != nil { - return err - } - - *c = *ObjectSessionContextFromGRPCMessage(msg) - - return nil + return message.UnmarshalJSON(c, data, new(session.ObjectSessionContext)) } func (l *TokenLifetime) MarshalJSON() ([]byte, error) { - return protojson.MarshalOptions{ - EmitUnpopulated: true, - }.Marshal( - TokenLifetimeToGRPCMessage(l), - ) + return message.MarshalJSON(l) } func (l *TokenLifetime) UnmarshalJSON(data []byte) error { - msg := new(session.SessionToken_Body_TokenLifetime) - - if err := protojson.Unmarshal(data, msg); err != nil { - return err - } - - *l = *TokenLifetimeFromGRPCMessage(msg) - - return nil + return message.UnmarshalJSON(l, data, new(session.SessionToken_Body_TokenLifetime)) } func (t *SessionTokenBody) MarshalJSON() ([]byte, error) { - return protojson.MarshalOptions{ - EmitUnpopulated: true, - }.Marshal( - SessionTokenBodyToGRPCMessage(t), - ) + return message.MarshalJSON(t) } func (t *SessionTokenBody) UnmarshalJSON(data []byte) error { @@ -60,17 +33,11 @@ func (t *SessionTokenBody) UnmarshalJSON(data []byte) error { return err } - *t = *SessionTokenBodyFromGRPCMessage(msg) - - return nil + return t.FromGRPCMessage(msg) } func (t *SessionToken) MarshalJSON() ([]byte, error) { - return protojson.MarshalOptions{ - EmitUnpopulated: true, - }.Marshal( - SessionTokenToGRPCMessage(t), - ) + return message.MarshalJSON(t) } func (t *SessionToken) UnmarshalJSON(data []byte) error { @@ -80,17 +47,11 @@ func (t *SessionToken) UnmarshalJSON(data []byte) error { return err } - *t = *SessionTokenFromGRPCMessage(msg) - - return nil + return t.FromGRPCMessage(msg) } func (x *XHeader) MarshalJSON() ([]byte, error) { - return protojson.MarshalOptions{ - EmitUnpopulated: true, - }.Marshal( - XHeaderToGRPCMessage(x), - ) + return message.MarshalJSON(x) } func (x *XHeader) UnmarshalJSON(data []byte) error { @@ -100,17 +61,11 @@ func (x *XHeader) UnmarshalJSON(data []byte) error { return err } - *x = *XHeaderFromGRPCMessage(msg) - - return nil + return x.FromGRPCMessage(msg) } func (r *RequestMetaHeader) MarshalJSON() ([]byte, error) { - return protojson.MarshalOptions{ - EmitUnpopulated: true, - }.Marshal( - RequestMetaHeaderToGRPCMessage(r), - ) + return message.MarshalJSON(r) } func (r *RequestMetaHeader) UnmarshalJSON(data []byte) error { @@ -120,17 +75,11 @@ func (r *RequestMetaHeader) UnmarshalJSON(data []byte) error { return err } - *r = *RequestMetaHeaderFromGRPCMessage(msg) - - return nil + return r.FromGRPCMessage(msg) } func (r *RequestVerificationHeader) MarshalJSON() ([]byte, error) { - return protojson.MarshalOptions{ - EmitUnpopulated: true, - }.Marshal( - RequestVerificationHeaderToGRPCMessage(r), - ) + return message.MarshalJSON(r) } func (r *RequestVerificationHeader) UnmarshalJSON(data []byte) error { @@ -140,17 +89,11 @@ func (r *RequestVerificationHeader) UnmarshalJSON(data []byte) error { return err } - *r = *RequestVerificationHeaderFromGRPCMessage(msg) - - return nil + return r.FromGRPCMessage(msg) } func (r *ResponseMetaHeader) MarshalJSON() ([]byte, error) { - return protojson.MarshalOptions{ - EmitUnpopulated: true, - }.Marshal( - ResponseMetaHeaderToGRPCMessage(r), - ) + return message.MarshalJSON(r) } func (r *ResponseMetaHeader) UnmarshalJSON(data []byte) error { @@ -160,17 +103,11 @@ func (r *ResponseMetaHeader) UnmarshalJSON(data []byte) error { return err } - *r = *ResponseMetaHeaderFromGRPCMessage(msg) - - return nil + return r.FromGRPCMessage(msg) } func (r *ResponseVerificationHeader) MarshalJSON() ([]byte, error) { - return protojson.MarshalOptions{ - EmitUnpopulated: true, - }.Marshal( - ResponseVerificationHeaderToGRPCMessage(r), - ) + return message.MarshalJSON(r) } func (r *ResponseVerificationHeader) UnmarshalJSON(data []byte) error { @@ -180,7 +117,5 @@ func (r *ResponseVerificationHeader) UnmarshalJSON(data []byte) error { return err } - *r = *ResponseVerificationHeaderFromGRPCMessage(msg) - - return nil + return r.FromGRPCMessage(msg) } diff --git a/v2/session/json_test.go b/v2/session/json_test.go deleted file mode 100644 index 00bf382..0000000 --- a/v2/session/json_test.go +++ /dev/null @@ -1,116 +0,0 @@ -package session_test - -import ( - "testing" - - "github.com/nspcc-dev/neofs-api-go/v2/session" - "github.com/stretchr/testify/require" -) - -func TestChecksumJSON(t *testing.T) { - ctx := generateObjectCtx("id") - - data, err := ctx.MarshalJSON() - require.NoError(t, err) - - ctx2 := new(session.ObjectSessionContext) - require.NoError(t, ctx2.UnmarshalJSON(data)) - - require.Equal(t, ctx, ctx2) -} - -func TestTokenLifetimeJSON(t *testing.T) { - l := generateLifetime(1, 2, 3) - - data, err := l.MarshalJSON() - require.NoError(t, err) - - l2 := new(session.TokenLifetime) - require.NoError(t, l2.UnmarshalJSON(data)) - - require.Equal(t, l, l2) -} - -func TestSessionTokenBodyJSON(t *testing.T) { - b := generateSessionTokenBody("id") - - data, err := b.MarshalJSON() - require.NoError(t, err) - - b2 := new(session.SessionTokenBody) - require.NoError(t, b2.UnmarshalJSON(data)) - - require.Equal(t, b, b2) -} - -func TestSessionTokenJSON(t *testing.T) { - tok := generateSessionToken("id") - - data, err := tok.MarshalJSON() - require.NoError(t, err) - - tok2 := new(session.SessionToken) - require.NoError(t, tok2.UnmarshalJSON(data)) - - require.Equal(t, tok, tok2) -} - -func TestXHeaderJSON(t *testing.T) { - x := generateXHeader("key", "value") - - data, err := x.MarshalJSON() - require.NoError(t, err) - - x2 := new(session.XHeader) - require.NoError(t, x2.UnmarshalJSON(data)) - - require.Equal(t, x, x2) -} - -func TestRequestMetaHeaderJSON(t *testing.T) { - r := generateRequestMetaHeader(1, "bearer", "session") - - data, err := r.MarshalJSON() - require.NoError(t, err) - - r2 := new(session.RequestMetaHeader) - require.NoError(t, r2.UnmarshalJSON(data)) - - require.Equal(t, r, r2) -} - -func TestRequestVerificationHeaderJSON(t *testing.T) { - r := generateRequestVerificationHeader("key", "value") - - data, err := r.MarshalJSON() - require.NoError(t, err) - - r2 := new(session.RequestVerificationHeader) - require.NoError(t, r2.UnmarshalJSON(data)) - - require.Equal(t, r, r2) -} - -func TestResponseMetaHeaderJSON(t *testing.T) { - r := generateResponseMetaHeader(1) - - data, err := r.MarshalJSON() - require.NoError(t, err) - - r2 := new(session.ResponseMetaHeader) - require.NoError(t, r2.UnmarshalJSON(data)) - - require.Equal(t, r, r2) -} - -func TestResponseVerificationHeaderJSON(t *testing.T) { - r := generateResponseVerificationHeader("key", "value") - - data, err := r.MarshalJSON() - require.NoError(t, err) - - r2 := new(session.ResponseVerificationHeader) - require.NoError(t, r2.UnmarshalJSON(data)) - - require.Equal(t, r, r2) -} diff --git a/v2/session/marshal.go b/v2/session/marshal.go index 568dfed..b6ea2c0 100644 --- a/v2/session/marshal.go +++ b/v2/session/marshal.go @@ -1,6 +1,7 @@ package session import ( + "github.com/nspcc-dev/neofs-api-go/rpc/message" "github.com/nspcc-dev/neofs-api-go/util/proto" session "github.com/nspcc-dev/neofs-api-go/v2/session/grpc" goproto "google.golang.org/protobuf/proto" @@ -97,6 +98,10 @@ func (c *CreateRequestBody) StableSize() (size int) { return size } +func (c *CreateRequestBody) Unmarshal(data []byte) error { + return message.Unmarshal(c, data, new(session.CreateRequest_Body)) +} + func (c *CreateResponseBody) StableMarshal(buf []byte) ([]byte, error) { if c == nil { return []byte{}, nil @@ -137,6 +142,10 @@ func (c *CreateResponseBody) StableSize() (size int) { return size } +func (c *CreateResponseBody) Unmarshal(data []byte) error { + return message.Unmarshal(c, data, new(session.CreateResponse_Body)) +} + func (x *XHeader) StableMarshal(buf []byte) ([]byte, error) { if x == nil { return []byte{}, nil @@ -183,9 +192,7 @@ func (x *XHeader) Unmarshal(data []byte) error { return err } - *x = *XHeaderFromGRPCMessage(m) - - return nil + return x.FromGRPCMessage(m) } func (l *TokenLifetime) StableMarshal(buf []byte) ([]byte, error) { @@ -242,9 +249,7 @@ func (l *TokenLifetime) Unmarshal(data []byte) error { return err } - *l = *TokenLifetimeFromGRPCMessage(m) - - return nil + return l.FromGRPCMessage(m) } func (c *ObjectSessionContext) StableMarshal(buf []byte) ([]byte, error) { @@ -293,9 +298,7 @@ func (c *ObjectSessionContext) Unmarshal(data []byte) error { return err } - *c = *ObjectSessionContextFromGRPCMessage(m) - - return nil + return c.FromGRPCMessage(m) } func (t *SessionTokenBody) StableMarshal(buf []byte) ([]byte, error) { @@ -383,9 +386,7 @@ func (t *SessionTokenBody) Unmarshal(data []byte) error { return err } - *t = *SessionTokenBodyFromGRPCMessage(m) - - return nil + return t.FromGRPCMessage(m) } func (t *SessionToken) StableMarshal(buf []byte) ([]byte, error) { @@ -434,9 +435,7 @@ func (t *SessionToken) Unmarshal(data []byte) error { return err } - *t = *SessionTokenFromGRPCMessage(m) - - return nil + return t.FromGRPCMessage(m) } func (r *RequestMetaHeader) StableMarshal(buf []byte) ([]byte, error) { @@ -534,9 +533,7 @@ func (r *RequestMetaHeader) Unmarshal(data []byte) error { return err } - *r = *RequestMetaHeaderFromGRPCMessage(m) - - return nil + return r.FromGRPCMessage(m) } func (r *RequestVerificationHeader) StableMarshal(buf []byte) ([]byte, error) { @@ -601,9 +598,7 @@ func (r *RequestVerificationHeader) Unmarshal(data []byte) error { return err } - *r = *RequestVerificationHeaderFromGRPCMessage(m) - - return nil + return r.FromGRPCMessage(m) } func (r *ResponseMetaHeader) StableMarshal(buf []byte) ([]byte, error) { @@ -685,9 +680,7 @@ func (r *ResponseMetaHeader) Unmarshal(data []byte) error { return err } - *r = *ResponseMetaHeaderFromGRPCMessage(m) - - return nil + return r.FromGRPCMessage(m) } func (r *ResponseVerificationHeader) StableMarshal(buf []byte) ([]byte, error) { @@ -752,7 +745,5 @@ func (r *ResponseVerificationHeader) Unmarshal(data []byte) error { return err } - *r = *ResponseVerificationHeaderFromGRPCMessage(m) - - return nil + return r.FromGRPCMessage(m) } diff --git a/v2/session/marshal_test.go b/v2/session/marshal_test.go deleted file mode 100644 index a2b5d9d..0000000 --- a/v2/session/marshal_test.go +++ /dev/null @@ -1,385 +0,0 @@ -package session_test - -import ( - "fmt" - "testing" - - "github.com/nspcc-dev/neofs-api-go/v2/acl" - "github.com/nspcc-dev/neofs-api-go/v2/refs" - "github.com/nspcc-dev/neofs-api-go/v2/session" - grpc "github.com/nspcc-dev/neofs-api-go/v2/session/grpc" - "github.com/stretchr/testify/require" - goproto "google.golang.org/protobuf/proto" -) - -func TestCreateRequestBody_StableMarshal(t *testing.T) { - requestFrom := generateCreateSessionRequestBody("Owner ID") - transport := new(grpc.CreateRequest_Body) - - t.Run("non empty", func(t *testing.T) { - wire, err := requestFrom.StableMarshal(nil) - require.NoError(t, err) - - err = goproto.Unmarshal(wire, transport) - require.NoError(t, err) - - requestTo := session.CreateRequestBodyFromGRPCMessage(transport) - require.Equal(t, requestFrom, requestTo) - }) -} - -func TestCreateResponseBody_StableMarshal(t *testing.T) { - responseFrom := generateCreateSessionResponseBody("ID", "Session Public Key") - transport := new(grpc.CreateResponse_Body) - - t.Run("non empty", func(t *testing.T) { - wire, err := responseFrom.StableMarshal(nil) - require.NoError(t, err) - - err = goproto.Unmarshal(wire, transport) - require.NoError(t, err) - - responseTo := session.CreateResponseBodyFromGRPCMessage(transport) - require.Equal(t, responseFrom, responseTo) - }) -} - -func TestXHeader_StableMarshal(t *testing.T) { - xheaderFrom := generateXHeader("X-Header-Key", "X-Header-Value") - - t.Run("non empty", func(t *testing.T) { - wire, err := xheaderFrom.StableMarshal(nil) - require.NoError(t, err) - - xheaderTo := new(session.XHeader) - require.NoError(t, xheaderTo.Unmarshal(wire)) - - require.Equal(t, xheaderFrom, xheaderTo) - }) -} - -func TestTokenLifetime_StableMarshal(t *testing.T) { - lifetimeFrom := generateLifetime(10, 20, 30) - - t.Run("non empty", func(t *testing.T) { - wire, err := lifetimeFrom.StableMarshal(nil) - require.NoError(t, err) - - lifetimeTo := new(session.TokenLifetime) - require.NoError(t, lifetimeTo.Unmarshal(wire)) - - require.Equal(t, lifetimeFrom, lifetimeTo) - }) -} - -func TestObjectSessionContext_StableMarshal(t *testing.T) { - objectCtxFrom := generateObjectCtx("Object ID") - - t.Run("non empty", func(t *testing.T) { - wire, err := objectCtxFrom.StableMarshal(nil) - require.NoError(t, err) - - objectCtxTo := new(session.ObjectSessionContext) - require.NoError(t, objectCtxTo.Unmarshal(wire)) - - require.Equal(t, objectCtxFrom, objectCtxTo) - }) -} - -func TestSessionTokenBody_StableMarshal(t *testing.T) { - sessionTokenBodyFrom := generateSessionTokenBody("Session Token Body") - - t.Run("non empty", func(t *testing.T) { - wire, err := sessionTokenBodyFrom.StableMarshal(nil) - require.NoError(t, err) - - sessionTokenBodyTo := new(session.SessionTokenBody) - require.NoError(t, sessionTokenBodyTo.Unmarshal(wire)) - - require.Equal(t, sessionTokenBodyFrom, sessionTokenBodyTo) - }) -} - -func TestSessionToken_StableMarshal(t *testing.T) { - sessionTokenFrom := generateSessionToken("Session Token") - - t.Run("non empty", func(t *testing.T) { - wire, err := sessionTokenFrom.StableMarshal(nil) - require.NoError(t, err) - - sessionTokenTo := new(session.SessionToken) - require.NoError(t, sessionTokenTo.Unmarshal(wire)) - - require.Equal(t, sessionTokenFrom, sessionTokenTo) - }) -} - -func TestRequestMetaHeader_StableMarshal(t *testing.T) { - metaHeaderOrigin := generateRequestMetaHeader(10, "Bearer One", "Session One") - metaHeaderFrom := generateRequestMetaHeader(20, "Bearer Two", "Session Two") - metaHeaderFrom.SetOrigin(metaHeaderOrigin) - - t.Run("non empty", func(t *testing.T) { - wire, err := metaHeaderFrom.StableMarshal(nil) - require.NoError(t, err) - - metaHeaderTo := new(session.RequestMetaHeader) - require.NoError(t, metaHeaderTo.Unmarshal(wire)) - - require.Equal(t, metaHeaderFrom, metaHeaderTo) - }) -} - -func TestRequestVerificationHeader_StableMarshal(t *testing.T) { - verifHeaderOrigin := generateRequestVerificationHeader("Key", "Inside") - verifHeaderFrom := generateRequestVerificationHeader("Value", "Outside") - verifHeaderFrom.SetOrigin(verifHeaderOrigin) - - t.Run("non empty", func(t *testing.T) { - wire, err := verifHeaderFrom.StableMarshal(nil) - require.NoError(t, err) - - verifHeaderTo := new(session.RequestVerificationHeader) - require.NoError(t, verifHeaderTo.Unmarshal(wire)) - - require.Equal(t, verifHeaderFrom, verifHeaderTo) - }) -} - -func TestResponseMetaHeader_StableMarshal(t *testing.T) { - metaHeaderOrigin := generateResponseMetaHeader(10) - metaHeaderFrom := generateResponseMetaHeader(20) - metaHeaderFrom.SetOrigin(metaHeaderOrigin) - - t.Run("non empty", func(t *testing.T) { - wire, err := metaHeaderFrom.StableMarshal(nil) - require.NoError(t, err) - - metaHeaderTo := new(session.ResponseMetaHeader) - require.NoError(t, metaHeaderTo.Unmarshal(wire)) - - require.Equal(t, metaHeaderFrom, metaHeaderTo) - }) -} - -func TestResponseVerificationHeader_StableMarshal(t *testing.T) { - verifHeaderOrigin := generateResponseVerificationHeader("Key", "Inside") - verifHeaderFrom := generateResponseVerificationHeader("Value", "Outside") - verifHeaderFrom.SetOrigin(verifHeaderOrigin) - - t.Run("non empty", func(t *testing.T) { - wire, err := verifHeaderFrom.StableMarshal(nil) - require.NoError(t, err) - - verifHeaderTo := new(session.ResponseVerificationHeader) - require.NoError(t, verifHeaderTo.Unmarshal(wire)) - - require.Equal(t, verifHeaderFrom, verifHeaderTo) - }) -} - -func generateCreateSessionRequestBody(id string) *session.CreateRequestBody { - lifetime := new(session.TokenLifetime) - lifetime.SetIat(1) - lifetime.SetNbf(2) - lifetime.SetExp(3) - - owner := new(refs.OwnerID) - owner.SetValue([]byte(id)) - - s := new(session.CreateRequestBody) - s.SetOwnerID(owner) - s.SetExpiration(10) - - return s -} - -func generateCreateSessionResponseBody(id, key string) *session.CreateResponseBody { - s := new(session.CreateResponseBody) - s.SetID([]byte(id)) - s.SetSessionKey([]byte(key)) - - return s -} - -func generateSignature(k, v string) *refs.Signature { - sig := new(refs.Signature) - sig.SetKey([]byte(k)) - sig.SetSign([]byte(v)) - - return sig -} - -func generateVersion(maj, min uint32) *refs.Version { - version := new(refs.Version) - version.SetMajor(maj) - version.SetMinor(min) - - return version -} - -func generateXHeader(k, v string) *session.XHeader { - xheader := new(session.XHeader) - xheader.SetKey(k) - xheader.SetValue(v) - - return xheader -} - -func generateLifetime(exp, nbf, iat uint64) *session.TokenLifetime { - lifetime := new(session.TokenLifetime) - lifetime.SetExp(exp) - lifetime.SetNbf(nbf) - lifetime.SetIat(iat) - - return lifetime -} - -func generateBearerLifetime(exp, nbf, iat uint64) *acl.TokenLifetime { - lifetime := new(acl.TokenLifetime) - lifetime.SetExp(exp) - lifetime.SetNbf(nbf) - lifetime.SetIat(iat) - - return lifetime -} - -func generateObjectCtx(id string) *session.ObjectSessionContext { - objectCtx := new(session.ObjectSessionContext) - objectCtx.SetVerb(session.ObjectVerbPut) - - cid := new(refs.ContainerID) - cid.SetValue([]byte("ContainerID")) - - oid := new(refs.ObjectID) - oid.SetValue([]byte(id)) - - addr := new(refs.Address) - addr.SetContainerID(cid) - addr.SetObjectID(oid) - - objectCtx.SetAddress(addr) - - return objectCtx -} - -func generateEACL(n int, k, v string) *acl.Table { - target := new(acl.Target) - target.SetRole(acl.RoleUser) - - keys := make([][]byte, n) - - for i := 0; i < n; i++ { - s := fmt.Sprintf("Public Key %d", i+1) - keys[i] = []byte(s) - } - - filter := new(acl.HeaderFilter) - filter.SetHeaderType(acl.HeaderTypeObject) - filter.SetMatchType(acl.MatchTypeStringEqual) - filter.SetKey(k) - filter.SetValue(v) - - record := new(acl.Record) - record.SetOperation(acl.OperationHead) - record.SetAction(acl.ActionDeny) - record.SetTargets([]*acl.Target{target}) - record.SetFilters([]*acl.HeaderFilter{filter}) - - table := new(acl.Table) - cid := new(refs.ContainerID) - cid.SetValue([]byte("Container ID")) - - table.SetContainerID(cid) - table.SetRecords([]*acl.Record{record}) - - return table -} - -func generateSessionTokenBody(id string) *session.SessionTokenBody { - owner := new(refs.OwnerID) - owner.SetValue([]byte("Owner ID")) - - tokenBody := new(session.SessionTokenBody) - tokenBody.SetID([]byte(id)) - tokenBody.SetOwnerID(owner) - tokenBody.SetSessionKey([]byte(id)) - tokenBody.SetLifetime(generateLifetime(1, 2, 3)) - tokenBody.SetContext(generateObjectCtx(id)) - - return tokenBody -} - -func generateSessionToken(id string) *session.SessionToken { - sessionToken := new(session.SessionToken) - sessionToken.SetBody(generateSessionTokenBody(id)) - sessionToken.SetSignature(generateSignature("id", id)) - - return sessionToken -} - -func generateBearerTokenBody(id string) *acl.BearerTokenBody { - owner := new(refs.OwnerID) - owner.SetValue([]byte(id)) - - tokenBody := new(acl.BearerTokenBody) - tokenBody.SetOwnerID(owner) - tokenBody.SetLifetime(generateBearerLifetime(1, 2, 3)) - tokenBody.SetEACL(generateEACL(10, "id", id)) - - return tokenBody -} - -func generateBearerToken(id string) *acl.BearerToken { - bearerToken := new(acl.BearerToken) - bearerToken.SetBody(generateBearerTokenBody(id)) - bearerToken.SetSignature(generateSignature("id", id)) - - return bearerToken -} - -func generateRequestMetaHeader(n int, b, s string) *session.RequestMetaHeader { - reqMetaHeader := new(session.RequestMetaHeader) - reqMetaHeader.SetVersion(generateVersion(2, 0)) - reqMetaHeader.SetEpoch(uint64(n)) - reqMetaHeader.SetTTL(uint32(n)) - reqMetaHeader.SetXHeaders([]*session.XHeader{ - generateXHeader("key-one", "val-one"), - generateXHeader("key-two", "val-two"), - }) - reqMetaHeader.SetBearerToken(generateBearerToken(b)) - reqMetaHeader.SetSessionToken(generateSessionToken(s)) - - return reqMetaHeader -} - -func generateRequestVerificationHeader(k, v string) *session.RequestVerificationHeader { - reqVerifHeader := new(session.RequestVerificationHeader) - reqVerifHeader.SetBodySignature(generateSignature(k+"body", v+"body")) - reqVerifHeader.SetMetaSignature(generateSignature(k+"meta", v+"meta")) - reqVerifHeader.SetOriginSignature(generateSignature(k+"orig", v+"orig")) - - return reqVerifHeader -} - -func generateResponseMetaHeader(n int) *session.ResponseMetaHeader { - respMetaHeader := new(session.ResponseMetaHeader) - respMetaHeader.SetVersion(generateVersion(2, 0)) - respMetaHeader.SetEpoch(uint64(n)) - respMetaHeader.SetTTL(uint32(n)) - respMetaHeader.SetXHeaders([]*session.XHeader{ - generateXHeader("key-one", "val-one"), - generateXHeader("key-two", "val-two"), - }) - - return respMetaHeader -} - -func generateResponseVerificationHeader(k, v string) *session.ResponseVerificationHeader { - respVerifHeader := new(session.ResponseVerificationHeader) - respVerifHeader.SetBodySignature(generateSignature(k+"body", v+"body")) - respVerifHeader.SetMetaSignature(generateSignature(k+"meta", v+"meta")) - respVerifHeader.SetOriginSignature(generateSignature(k+"orig", v+"orig")) - - return respVerifHeader -} diff --git a/v2/session/message_test.go b/v2/session/message_test.go new file mode 100644 index 0000000..ea9f1cc --- /dev/null +++ b/v2/session/message_test.go @@ -0,0 +1,26 @@ +package session_test + +import ( + "testing" + + "github.com/nspcc-dev/neofs-api-go/rpc/message" + rpctest "github.com/nspcc-dev/neofs-api-go/rpc/message/test" + sessiontest "github.com/nspcc-dev/neofs-api-go/v2/session/test" +) + +func TestMessageConvert(t *testing.T) { + rpctest.TestRPCMessage(t, + func(empty bool) message.Message { return sessiontest.GenerateCreateRequestBody(empty) }, + func(empty bool) message.Message { return sessiontest.GenerateCreateRequest(empty) }, + func(empty bool) message.Message { return sessiontest.GenerateCreateResponseBody(empty) }, + func(empty bool) message.Message { return sessiontest.GenerateCreateResponse(empty) }, + func(empty bool) message.Message { return sessiontest.GenerateTokenLifetime(empty) }, + func(empty bool) message.Message { return sessiontest.GenerateXHeader(empty) }, + func(empty bool) message.Message { return sessiontest.GenerateSessionTokenBody(empty) }, + func(empty bool) message.Message { return sessiontest.GenerateSessionToken(empty) }, + func(empty bool) message.Message { return sessiontest.GenerateRequestMetaHeader(empty) }, + func(empty bool) message.Message { return sessiontest.GenerateRequestVerificationHeader(empty) }, + func(empty bool) message.Message { return sessiontest.GenerateResponseMetaHeader(empty) }, + func(empty bool) message.Message { return sessiontest.GenerateResponseVerificationHeader(empty) }, + ) +} diff --git a/v2/session/service.go b/v2/session/service.go deleted file mode 100644 index 5a07e2d..0000000 --- a/v2/session/service.go +++ /dev/null @@ -1,25 +0,0 @@ -package session - -import ( - "context" -) - -type Service interface { - Create(context.Context, *CreateRequest) (*CreateResponse, error) -} - -type CreateRequest struct { - body *CreateRequestBody - - metaHeader *RequestMetaHeader - - verifyHeader *RequestVerificationHeader -} - -type CreateResponse struct { - body *CreateResponseBody - - metaHeader *ResponseMetaHeader - - verifyHeader *ResponseVerificationHeader -} diff --git a/v2/session/test/client_test.go b/v2/session/test/client_test.go deleted file mode 100644 index 9ba4029..0000000 --- a/v2/session/test/client_test.go +++ /dev/null @@ -1,159 +0,0 @@ -package main - -import ( - "context" - "crypto/ecdsa" - "errors" - "testing" - - "github.com/nspcc-dev/neofs-api-go/v2/refs" - "github.com/nspcc-dev/neofs-api-go/v2/session" - sessionGRPC "github.com/nspcc-dev/neofs-api-go/v2/session/grpc" - "github.com/nspcc-dev/neofs-api-go/v2/signature" - "github.com/nspcc-dev/neofs-crypto/test" - "github.com/stretchr/testify/require" - "google.golang.org/grpc" -) - -type testGRPCClient struct { - server *testGRPCServer -} - -type testGRPCServer struct { - key *ecdsa.PrivateKey - resp *session.CreateResponse - err error -} - -func (s *testGRPCClient) Create(ctx context.Context, in *sessionGRPC.CreateRequest, opts ...grpc.CallOption) (*sessionGRPC.CreateResponse, error) { - return s.server.Create(ctx, in) -} - -func (s *testGRPCServer) Create(_ context.Context, req *sessionGRPC.CreateRequest) (*sessionGRPC.CreateResponse, error) { - if s.err != nil { - return nil, s.err - } - - // verify request structure - if err := signature.VerifyServiceMessage( - session.CreateRequestFromGRPCMessage(req), - ); err != nil { - return nil, err - } - - // sign response structure - if err := signature.SignServiceMessage(s.key, s.resp); err != nil { - return nil, err - } - - return session.CreateResponseToGRPCMessage(s.resp), nil -} - -func testRequest() *session.CreateRequest { - ownerID := new(refs.OwnerID) - ownerID.SetValue([]byte{1, 2, 3}) - - body := new(session.CreateRequestBody) - body.SetOwnerID(ownerID) - - meta := new(session.RequestMetaHeader) - meta.SetTTL(1) - - req := new(session.CreateRequest) - req.SetBody(body) - req.SetMetaHeader(meta) - - return req -} - -func testResponse() *session.CreateResponse { - body := new(session.CreateResponseBody) - body.SetID([]byte{1, 2, 3}) - - meta := new(session.ResponseMetaHeader) - meta.SetTTL(1) - - resp := new(session.CreateResponse) - resp.SetBody(body) - resp.SetMetaHeader(meta) - - return resp -} - -func TestGRPCClient(t *testing.T) { - ctx := context.TODO() - - cliKey := test.DecodeKey(0) - srvKey := test.DecodeKey(1) - - t.Run("gRPC server error", func(t *testing.T) { - srvErr := errors.New("test server error") - - srv := &testGRPCServer{ - err: srvErr, - } - - cli := &testGRPCClient{ - server: srv, - } - - c, err := session.NewClient(session.WithGRPCServiceClient(cli)) - require.NoError(t, err) - - resp, err := c.Create(ctx, new(session.CreateRequest)) - require.True(t, errors.Is(err, srvErr)) - require.Nil(t, resp) - }) - - t.Run("invalid request structure", func(t *testing.T) { - req := testRequest() - - require.Error(t, signature.VerifyServiceMessage(req)) - - c, err := session.NewClient( - session.WithGRPCServiceClient( - &testGRPCClient{ - server: new(testGRPCServer), - }, - ), - ) - require.NoError(t, err) - - resp, err := c.Create(ctx, req) - require.Error(t, err) - require.Nil(t, resp) - }) - - t.Run("correct response", func(t *testing.T) { - req := testRequest() - - require.NoError(t, signature.SignServiceMessage(cliKey, req)) - - resp := testResponse() - - { // w/o this require.Equal fails due to nil and []T{} difference - meta := new(session.ResponseMetaHeader) - meta.SetXHeaders([]*session.XHeader{}) - resp.SetMetaHeader(meta) - } - - c, err := session.NewClient( - session.WithGRPCServiceClient( - &testGRPCClient{ - server: &testGRPCServer{ - key: srvKey, - resp: resp, - }, - }, - ), - ) - require.NoError(t, err) - - r, err := c.Create(ctx, req) - require.NoError(t, err) - - require.NoError(t, signature.VerifyServiceMessage(r)) - require.Equal(t, resp.GetBody(), r.GetBody()) - require.Equal(t, resp.GetMetaHeader(), r.GetMetaHeader()) - }) -} diff --git a/v2/session/test/generate.go b/v2/session/test/generate.go new file mode 100644 index 0000000..d1a5b56 --- /dev/null +++ b/v2/session/test/generate.go @@ -0,0 +1,204 @@ +package sessiontest + +import ( + acltest "github.com/nspcc-dev/neofs-api-go/v2/acl/test" + refstest "github.com/nspcc-dev/neofs-api-go/v2/refs/test" + "github.com/nspcc-dev/neofs-api-go/v2/session" +) + +func GenerateCreateRequestBody(empty bool) *session.CreateRequestBody { + m := new(session.CreateRequestBody) + + if !empty { + m.SetExpiration(555) + } + + m.SetOwnerID(refstest.GenerateOwnerID(empty)) + + return m +} + +func GenerateCreateRequest(empty bool) *session.CreateRequest { + m := new(session.CreateRequest) + + m.SetBody(GenerateCreateRequestBody(empty)) + m.SetMetaHeader(GenerateRequestMetaHeader(empty)) + m.SetVerificationHeader(GenerateRequestVerificationHeader(empty)) + + return m +} + +func GenerateCreateResponseBody(empty bool) *session.CreateResponseBody { + m := new(session.CreateResponseBody) + + if !empty { + m.SetID([]byte{1, 2, 3}) + m.SetSessionKey([]byte{4, 5, 6}) + } + + return m +} + +func GenerateCreateResponse(empty bool) *session.CreateResponse { + m := new(session.CreateResponse) + + m.SetBody(GenerateCreateResponseBody(empty)) + m.SetMetaHeader(GenerateResponseMetaHeader(empty)) + m.SetVerificationHeader(GenerateResponseVerificationHeader(empty)) + + return m +} + +func GenerateResponseVerificationHeader(empty bool) *session.ResponseVerificationHeader { + return generateResponseVerificationHeader(empty, true) +} + +func generateResponseVerificationHeader(empty, withOrigin bool) *session.ResponseVerificationHeader { + m := new(session.ResponseVerificationHeader) + + m.SetBodySignature(refstest.GenerateSignature(empty)) + m.SetMetaSignature(refstest.GenerateSignature(empty)) + m.SetOriginSignature(refstest.GenerateSignature(empty)) + + if withOrigin { + m.SetOrigin(generateResponseVerificationHeader(empty, false)) + } + + return m +} + +func GenerateResponseMetaHeader(empty bool) *session.ResponseMetaHeader { + return generateResponseMetaHeader(empty, true) +} + +func generateResponseMetaHeader(empty, withOrigin bool) *session.ResponseMetaHeader { + m := new(session.ResponseMetaHeader) + + if !empty { + m.SetEpoch(13) + m.SetTTL(100) + } + + m.SetXHeaders(GenerateXHeaders(empty)) + m.SetVersion(refstest.GenerateVersion(empty)) + + if withOrigin { + m.SetOrigin(generateResponseMetaHeader(empty, false)) + } + + return m +} + +func GenerateRequestVerificationHeader(empty bool) *session.RequestVerificationHeader { + return generateRequestVerificationHeader(empty, true) +} + +func generateRequestVerificationHeader(empty, withOrigin bool) *session.RequestVerificationHeader { + m := new(session.RequestVerificationHeader) + + m.SetBodySignature(refstest.GenerateSignature(empty)) + m.SetMetaSignature(refstest.GenerateSignature(empty)) + m.SetOriginSignature(refstest.GenerateSignature(empty)) + + if withOrigin { + m.SetOrigin(generateRequestVerificationHeader(empty, false)) + } + + return m +} + +func GenerateRequestMetaHeader(empty bool) *session.RequestMetaHeader { + return generateRequestMetaHeader(empty, true) +} + +func generateRequestMetaHeader(empty, withOrigin bool) *session.RequestMetaHeader { + m := new(session.RequestMetaHeader) + + if !empty { + m.SetEpoch(13) + m.SetTTL(100) + } + + m.SetXHeaders(GenerateXHeaders(empty)) + m.SetVersion(refstest.GenerateVersion(empty)) + m.SetSessionToken(GenerateSessionToken(empty)) + m.SetBearerToken(acltest.GenerateBearerToken(empty)) + + if withOrigin { + m.SetOrigin(generateRequestMetaHeader(empty, false)) + } + + return m +} + +func GenerateSessionToken(empty bool) *session.SessionToken { + m := new(session.SessionToken) + + m.SetBody(GenerateSessionTokenBody(empty)) + m.SetSignature(refstest.GenerateSignature(empty)) + + return m +} + +func GenerateSessionTokenBody(empty bool) *session.SessionTokenBody { + m := new(session.SessionTokenBody) + + if !empty { + m.SetID([]byte{1}) + m.SetSessionKey([]byte{2}) + } + + m.SetOwnerID(refstest.GenerateOwnerID(empty)) + m.SetLifetime(GenerateTokenLifetime(empty)) + m.SetContext(GenerateObjectSessionContext(empty)) + + return m +} + +func GenerateTokenLifetime(empty bool) *session.TokenLifetime { + m := new(session.TokenLifetime) + + if !empty { + m.SetExp(1) + m.SetIat(2) + m.SetExp(3) + } + + return m +} + +func GenerateObjectSessionContext(empty bool) *session.ObjectSessionContext { + m := new(session.ObjectSessionContext) + + if !empty { + m.SetVerb(session.ObjectVerbHead) + } + + m.SetAddress(refstest.GenerateAddress(empty)) + + return m +} + +func GenerateXHeader(empty bool) *session.XHeader { + m := new(session.XHeader) + + if !empty { + m.SetKey("key") + m.SetValue("val") + } + + return m +} + +func GenerateXHeaders(empty bool) []*session.XHeader { + xs := make([]*session.XHeader, 0) + + if !empty { + xs = append(xs, + GenerateXHeader(false), + GenerateXHeader(false), + ) + } + + return xs +} diff --git a/v2/session/types.go b/v2/session/types.go index 0322b25..68c3a10 100644 --- a/v2/session/types.go +++ b/v2/session/types.go @@ -11,12 +11,24 @@ type CreateRequestBody struct { expiration uint64 } +type CreateRequest struct { + body *CreateRequestBody + + RequestHeaders +} + type CreateResponseBody struct { id []byte sessionKey []byte } +type CreateResponse struct { + body *CreateResponseBody + + ResponseHeaders +} + type XHeader struct { key, val string } diff --git a/v2/session/util.go b/v2/session/util.go index 0235429..5ee46d3 100644 --- a/v2/session/util.go +++ b/v2/session/util.go @@ -1,5 +1,9 @@ package session +import ( + session "github.com/nspcc-dev/neofs-api-go/v2/session/grpc" +) + // RequestHeaders represents common part of // all NeoFS requests including headers. type RequestHeaders struct { @@ -40,6 +44,49 @@ func (c *RequestHeaders) SetVerificationHeader(v *RequestVerificationHeader) { } } +func (c *RequestHeaders) ToMessage(m interface { + SetMetaHeader(*session.RequestMetaHeader) + SetVerifyHeader(*session.RequestVerificationHeader) +}) { + m.SetMetaHeader(c.metaHeader.ToGRPCMessage().(*session.RequestMetaHeader)) + m.SetVerifyHeader(c.verifyHeader.ToGRPCMessage().(*session.RequestVerificationHeader)) +} + +func (c *RequestHeaders) FromMessage(m interface { + GetMetaHeader() *session.RequestMetaHeader + GetVerifyHeader() *session.RequestVerificationHeader +}) error { + metaHdr := m.GetMetaHeader() + if metaHdr == nil { + c.metaHeader = nil + } else { + if c.metaHeader == nil { + c.metaHeader = new(RequestMetaHeader) + } + + err := c.metaHeader.FromGRPCMessage(metaHdr) + if err != nil { + return err + } + } + + verifyHdr := m.GetVerifyHeader() + if verifyHdr == nil { + c.verifyHeader = nil + } else { + if c.verifyHeader == nil { + c.verifyHeader = new(RequestVerificationHeader) + } + + err := c.verifyHeader.FromGRPCMessage(verifyHdr) + if err != nil { + return err + } + } + + return nil +} + // ResponseHeaders represents common part of // all NeoFS responses including headers. type ResponseHeaders struct { @@ -79,3 +126,46 @@ func (c *ResponseHeaders) SetVerificationHeader(v *ResponseVerificationHeader) { c.verifyHeader = v } } + +func (c *ResponseHeaders) ToMessage(m interface { + SetMetaHeader(*session.ResponseMetaHeader) + SetVerifyHeader(*session.ResponseVerificationHeader) +}) { + m.SetMetaHeader(c.metaHeader.ToGRPCMessage().(*session.ResponseMetaHeader)) + m.SetVerifyHeader(c.verifyHeader.ToGRPCMessage().(*session.ResponseVerificationHeader)) +} + +func (c *ResponseHeaders) FromMessage(m interface { + GetMetaHeader() *session.ResponseMetaHeader + GetVerifyHeader() *session.ResponseVerificationHeader +}) error { + metaHdr := m.GetMetaHeader() + if metaHdr == nil { + c.metaHeader = nil + } else { + if c.metaHeader == nil { + c.metaHeader = new(ResponseMetaHeader) + } + + err := c.metaHeader.FromGRPCMessage(metaHdr) + if err != nil { + return err + } + } + + verifyHdr := m.GetVerifyHeader() + if verifyHdr == nil { + c.verifyHeader = nil + } else { + if c.verifyHeader == nil { + c.verifyHeader = new(ResponseVerificationHeader) + } + + err := c.verifyHeader.FromGRPCMessage(verifyHdr) + if err != nil { + return err + } + } + + return nil +} diff --git a/v2/storagegroup/convert.go b/v2/storagegroup/convert.go index e78312c..61e49d0 100644 --- a/v2/storagegroup/convert.go +++ b/v2/storagegroup/convert.go @@ -1,48 +1,57 @@ package storagegroup import ( + "github.com/nspcc-dev/neofs-api-go/rpc/grpc" + "github.com/nspcc-dev/neofs-api-go/rpc/message" "github.com/nspcc-dev/neofs-api-go/v2/refs" + refsGRPC "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" sg "github.com/nspcc-dev/neofs-api-go/v2/storagegroup/grpc" ) -// StorageGroupToGRPCMessage converts unified proto structure into grpc structure. -func StorageGroupToGRPCMessage(s *StorageGroup) *sg.StorageGroup { - if s == nil { - return nil - } - +func (s *StorageGroup) ToGRPCMessage() grpc.Message { m := new(sg.StorageGroup) - m.SetValidationDataSize(s.GetValidationDataSize()) - m.SetValidationHash( - refs.ChecksumToGRPCMessage(s.GetValidationHash()), - ) - m.SetExpirationEpoch(s.GetExpirationEpoch()) + if s != nil { + m = new(sg.StorageGroup) - m.SetMembers( - refs.ObjectIDListToGRPCMessage(s.GetMembers()), - ) + m.SetMembers(refs.ObjectIDListToGRPCMessage(s.members)) + m.SetExpirationEpoch(s.exp) + m.SetValidationDataSize(s.size) + m.SetValidationHash(s.hash.ToGRPCMessage().(*refsGRPC.Checksum)) + } return m } -// StorageGroupFromGRPCMessage converts grpc structure into unified proto structure. -func StorageGroupFromGRPCMessage(m *sg.StorageGroup) *StorageGroup { - if m == nil { - return nil +func (s *StorageGroup) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*sg.StorageGroup) + if !ok { + return message.NewUnexpectedMessageType(m, v) } - s := new(StorageGroup) + var err error - s.SetValidationDataSize(m.GetValidationDataSize()) - s.SetValidationHash( - refs.ChecksumFromGRPCMessage(m.GetValidationHash()), - ) - s.SetExpirationEpoch(m.GetExpirationEpoch()) + hash := v.GetValidationHash() + if hash == nil { + s.hash = nil + } else { + if s.hash == nil { + s.hash = new(refs.Checksum) + } - s.SetMembers( - refs.ObjectIDListFromGRPCMessage(m.GetMembers()), - ) + err = s.hash.FromGRPCMessage(hash) + if err != nil { + return err + } + } - return s + s.members, err = refs.ObjectIDListFromGRPCMessage(v.GetMembers()) + if err != nil { + return err + } + + s.exp = v.GetExpirationEpoch() + s.size = v.GetValidationDataSize() + + return nil } diff --git a/v2/storagegroup/json.go b/v2/storagegroup/json.go index efdb311..82e97e9 100644 --- a/v2/storagegroup/json.go +++ b/v2/storagegroup/json.go @@ -1,26 +1,14 @@ package storagegroup import ( + "github.com/nspcc-dev/neofs-api-go/rpc/message" storagegroup "github.com/nspcc-dev/neofs-api-go/v2/storagegroup/grpc" - "google.golang.org/protobuf/encoding/protojson" ) func (s *StorageGroup) MarshalJSON() ([]byte, error) { - return protojson.MarshalOptions{ - EmitUnpopulated: true, - }.Marshal( - StorageGroupToGRPCMessage(s), - ) + return message.MarshalJSON(s) } func (s *StorageGroup) UnmarshalJSON(data []byte) error { - msg := new(storagegroup.StorageGroup) - - if err := protojson.Unmarshal(data, msg); err != nil { - return err - } - - *s = *StorageGroupFromGRPCMessage(msg) - - return nil + return message.UnmarshalJSON(s, data, new(storagegroup.StorageGroup)) } diff --git a/v2/storagegroup/json_test.go b/v2/storagegroup/json_test.go deleted file mode 100644 index 9da4920..0000000 --- a/v2/storagegroup/json_test.go +++ /dev/null @@ -1,20 +0,0 @@ -package storagegroup_test - -import ( - "testing" - - "github.com/nspcc-dev/neofs-api-go/v2/storagegroup" - "github.com/stretchr/testify/require" -) - -func TestStorageGroupJSON(t *testing.T) { - sg := generateSG() - - data, err := sg.MarshalJSON() - require.NoError(t, err) - - sg2 := new(storagegroup.StorageGroup) - require.NoError(t, sg2.UnmarshalJSON(data)) - - require.Equal(t, sg, sg2) -} diff --git a/v2/storagegroup/marshal.go b/v2/storagegroup/marshal.go index f7b1ed1..75b3360 100644 --- a/v2/storagegroup/marshal.go +++ b/v2/storagegroup/marshal.go @@ -1,10 +1,10 @@ package storagegroup import ( + "github.com/nspcc-dev/neofs-api-go/rpc/message" "github.com/nspcc-dev/neofs-api-go/util/proto" "github.com/nspcc-dev/neofs-api-go/v2/refs" storagegroup "github.com/nspcc-dev/neofs-api-go/v2/storagegroup/grpc" - goproto "google.golang.org/protobuf/proto" ) const ( @@ -74,12 +74,5 @@ func (s *StorageGroup) StableSize() (size int) { } func (s *StorageGroup) Unmarshal(data []byte) error { - m := new(storagegroup.StorageGroup) - if err := goproto.Unmarshal(data, m); err != nil { - return err - } - - *s = *StorageGroupFromGRPCMessage(m) - - return nil + return message.Unmarshal(s, data, new(storagegroup.StorageGroup)) } diff --git a/v2/storagegroup/marshal_test.go b/v2/storagegroup/marshal_test.go deleted file mode 100644 index 15f12c9..0000000 --- a/v2/storagegroup/marshal_test.go +++ /dev/null @@ -1,48 +0,0 @@ -package storagegroup_test - -import ( - "testing" - - "github.com/nspcc-dev/neofs-api-go/v2/refs" - "github.com/nspcc-dev/neofs-api-go/v2/storagegroup" - "github.com/stretchr/testify/require" -) - -func TestStorageGroup_StableMarshal(t *testing.T) { - storageGroupFrom := generateSG() - - t.Run("non empty", func(t *testing.T) { - wire, err := storageGroupFrom.StableMarshal(nil) - require.NoError(t, err) - - storageGroupTo := new(storagegroup.StorageGroup) - require.NoError(t, storageGroupTo.Unmarshal(wire)) - - require.Equal(t, storageGroupFrom, storageGroupTo) - }) -} - -func generateChecksum(data string) *refs.Checksum { - checksum := new(refs.Checksum) - checksum.SetType(refs.TillichZemor) - checksum.SetSum([]byte(data)) - - return checksum -} - -func generateSG() *storagegroup.StorageGroup { - sg := new(storagegroup.StorageGroup) - - oid1 := new(refs.ObjectID) - oid1.SetValue([]byte("Object ID 1")) - - oid2 := new(refs.ObjectID) - oid2.SetValue([]byte("Object ID 2")) - - sg.SetValidationDataSize(300) - sg.SetValidationHash(generateChecksum("Homomorphic hash")) - sg.SetExpirationEpoch(100) - sg.SetMembers([]*refs.ObjectID{oid1, oid2}) - - return sg -} diff --git a/v2/storagegroup/message_test.go b/v2/storagegroup/message_test.go new file mode 100644 index 0000000..3a787d2 --- /dev/null +++ b/v2/storagegroup/message_test.go @@ -0,0 +1,15 @@ +package storagegroup_test + +import ( + "testing" + + "github.com/nspcc-dev/neofs-api-go/rpc/message" + messagetest "github.com/nspcc-dev/neofs-api-go/rpc/message/test" + storagegrouptest "github.com/nspcc-dev/neofs-api-go/v2/storagegroup/test" +) + +func TestMessageConvert(t *testing.T) { + messagetest.TestRPCMessage(t, + func(empty bool) message.Message { return storagegrouptest.GenerateStorageGroup(empty) }, + ) +} diff --git a/v2/storagegroup/test/generate.go b/v2/storagegroup/test/generate.go new file mode 100644 index 0000000..c8c67ba --- /dev/null +++ b/v2/storagegroup/test/generate.go @@ -0,0 +1,20 @@ +package storagegrouptest + +import ( + refstest "github.com/nspcc-dev/neofs-api-go/v2/refs/test" + "github.com/nspcc-dev/neofs-api-go/v2/storagegroup" +) + +func GenerateStorageGroup(empty bool) *storagegroup.StorageGroup { + m := new(storagegroup.StorageGroup) + + if !empty { + m.SetValidationDataSize(44) + m.SetExpirationEpoch(55) + } + + m.SetValidationHash(refstest.GenerateChecksum(empty)) + m.SetMembers(refstest.GenerateObjectIDs(empty)) + + return m +} diff --git a/v2/tombstone/convert.go b/v2/tombstone/convert.go index c2e6ecd..204c0a3 100644 --- a/v2/tombstone/convert.go +++ b/v2/tombstone/convert.go @@ -1,53 +1,41 @@ package tombstone import ( + "github.com/nspcc-dev/neofs-api-go/rpc/grpc" + "github.com/nspcc-dev/neofs-api-go/rpc/message" "github.com/nspcc-dev/neofs-api-go/v2/refs" - refsGRPC "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" tombstone "github.com/nspcc-dev/neofs-api-go/v2/tombstone/grpc" ) -// TombstoneToGRPCMessage converts unified tombstone message into gRPC message. -func TombstoneToGRPCMessage(t *Tombstone) *tombstone.Tombstone { - if t == nil { - return nil +func (s *Tombstone) ToGRPCMessage() grpc.Message { + var m *tombstone.Tombstone + + if s != nil { + m = new(tombstone.Tombstone) + + m.SetMembers(refs.ObjectIDListToGRPCMessage(s.members)) + m.SetExpirationEpoch(s.exp) + m.SetSplitId(s.splitID) } - m := new(tombstone.Tombstone) - - m.SetExpirationEpoch(t.GetExpirationEpoch()) - m.SetSplitId(t.GetSplitID()) - - members := t.GetMembers() - memberMsg := make([]*refsGRPC.ObjectID, 0, len(members)) - - for i := range members { - memberMsg = append(memberMsg, refs.ObjectIDToGRPCMessage(members[i])) - } - - m.SetMembers(memberMsg) - return m } -// TombstoneFromGRPCMessage converts gRPC message into unified tombstone message. -func TombstoneFromGRPCMessage(m *tombstone.Tombstone) *Tombstone { - if m == nil { - return nil +func (s *Tombstone) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*tombstone.Tombstone) + if !ok { + return message.NewUnexpectedMessageType(m, v) } - t := new(Tombstone) + var err error - t.SetExpirationEpoch(m.GetExpirationEpoch()) - t.SetSplitID(m.GetSplitId()) - - memberMsg := m.GetMembers() - members := make([]*refs.ObjectID, 0, len(memberMsg)) - - for i := range memberMsg { - members = append(members, refs.ObjectIDFromGRPCMessage(memberMsg[i])) + s.members, err = refs.ObjectIDListFromGRPCMessage(v.GetMembers()) + if err != nil { + return err } - t.SetMembers(members) + s.exp = v.GetExpirationEpoch() + s.splitID = v.GetSplitId() - return t + return nil } diff --git a/v2/tombstone/json.go b/v2/tombstone/json.go index ffa0e15..be89a1c 100644 --- a/v2/tombstone/json.go +++ b/v2/tombstone/json.go @@ -1,26 +1,14 @@ package tombstone import ( + "github.com/nspcc-dev/neofs-api-go/rpc/message" tombstone "github.com/nspcc-dev/neofs-api-go/v2/tombstone/grpc" - "google.golang.org/protobuf/encoding/protojson" ) func (s *Tombstone) MarshalJSON() ([]byte, error) { - return protojson.MarshalOptions{ - EmitUnpopulated: true, - }.Marshal( - TombstoneToGRPCMessage(s), - ) + return message.MarshalJSON(s) } func (s *Tombstone) UnmarshalJSON(data []byte) error { - msg := new(tombstone.Tombstone) - - if err := protojson.Unmarshal(data, msg); err != nil { - return err - } - - *s = *TombstoneFromGRPCMessage(msg) - - return nil + return message.UnmarshalJSON(s, data, new(tombstone.Tombstone)) } diff --git a/v2/tombstone/json_test.go b/v2/tombstone/json_test.go deleted file mode 100644 index 441f173..0000000 --- a/v2/tombstone/json_test.go +++ /dev/null @@ -1,20 +0,0 @@ -package tombstone_test - -import ( - "testing" - - "github.com/nspcc-dev/neofs-api-go/v2/tombstone" - "github.com/stretchr/testify/require" -) - -func TestTombstoneJSON(t *testing.T) { - from := generateTombstone() - - data, err := from.MarshalJSON() - require.NoError(t, err) - - to := new(tombstone.Tombstone) - require.NoError(t, to.UnmarshalJSON(data)) - - require.Equal(t, from, to) -} diff --git a/v2/tombstone/marshal.go b/v2/tombstone/marshal.go index 9b9c898..eb5bb38 100644 --- a/v2/tombstone/marshal.go +++ b/v2/tombstone/marshal.go @@ -1,9 +1,9 @@ package tombstone import ( + "github.com/nspcc-dev/neofs-api-go/rpc/message" "github.com/nspcc-dev/neofs-api-go/util/proto" tombstone "github.com/nspcc-dev/neofs-api-go/v2/tombstone/grpc" - goproto "google.golang.org/protobuf/proto" ) const ( @@ -72,12 +72,5 @@ func (s *Tombstone) StableSize() (size int) { // Unmarshal unmarshal tombstone message from its binary representation. func (s *Tombstone) Unmarshal(data []byte) error { - m := new(tombstone.Tombstone) - if err := goproto.Unmarshal(data, m); err != nil { - return err - } - - *s = *TombstoneFromGRPCMessage(m) - - return nil + return message.Unmarshal(s, data, new(tombstone.Tombstone)) } diff --git a/v2/tombstone/marshal_test.go b/v2/tombstone/marshal_test.go deleted file mode 100644 index c7eda2b..0000000 --- a/v2/tombstone/marshal_test.go +++ /dev/null @@ -1,39 +0,0 @@ -package tombstone_test - -import ( - "testing" - - "github.com/nspcc-dev/neofs-api-go/v2/refs" - "github.com/nspcc-dev/neofs-api-go/v2/tombstone" - "github.com/stretchr/testify/require" -) - -func TestTombstone_StableMarshal(t *testing.T) { - from := generateTombstone() - - t.Run("non empty", func(t *testing.T) { - wire, err := from.StableMarshal(nil) - require.NoError(t, err) - - to := new(tombstone.Tombstone) - require.NoError(t, to.Unmarshal(wire)) - - require.Equal(t, from, to) - }) -} - -func generateTombstone() *tombstone.Tombstone { - t := new(tombstone.Tombstone) - - oid1 := new(refs.ObjectID) - oid1.SetValue([]byte("Object ID 1")) - - oid2 := new(refs.ObjectID) - oid2.SetValue([]byte("Object ID 2")) - - t.SetExpirationEpoch(100) - t.SetSplitID([]byte("split ID")) - t.SetMembers([]*refs.ObjectID{oid1, oid2}) - - return t -} diff --git a/v2/tombstone/message_test.go b/v2/tombstone/message_test.go new file mode 100644 index 0000000..4609cdd --- /dev/null +++ b/v2/tombstone/message_test.go @@ -0,0 +1,15 @@ +package tombstone_test + +import ( + "testing" + + "github.com/nspcc-dev/neofs-api-go/rpc/message" + messagetest "github.com/nspcc-dev/neofs-api-go/rpc/message/test" + tombstonetest "github.com/nspcc-dev/neofs-api-go/v2/tombstone/test" +) + +func TestMessageConvert(t *testing.T) { + messagetest.TestRPCMessage(t, + func(empty bool) message.Message { return tombstonetest.GenerateTombstone(empty) }, + ) +} diff --git a/v2/tombstone/test/generate.go b/v2/tombstone/test/generate.go new file mode 100644 index 0000000..678323a --- /dev/null +++ b/v2/tombstone/test/generate.go @@ -0,0 +1,19 @@ +package tombstonetest + +import ( + refstest "github.com/nspcc-dev/neofs-api-go/v2/refs/test" + "github.com/nspcc-dev/neofs-api-go/v2/tombstone" +) + +func GenerateTombstone(empty bool) *tombstone.Tombstone { + m := new(tombstone.Tombstone) + + if !empty { + m.SetExpirationEpoch(89) + m.SetSplitID([]byte{3, 2, 1}) + } + + m.SetMembers(refstest.GenerateObjectIDs(empty)) + + return m +} From 5a9dd7ab3f32152713135d22435c7e5bee9e2199 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 12 Mar 2021 15:58:37 +0300 Subject: [PATCH 0697/1196] [#263] pkg/netmap: Do not allocate nil repeated fields during conversion Signed-off-by: Leonard Lyubich --- pkg/netmap/filter.go | 12 +++++++----- pkg/netmap/policy.go | 22 +++++++++++++++------- 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/pkg/netmap/filter.go b/pkg/netmap/filter.go index 37b106a..bc281e6 100644 --- a/pkg/netmap/filter.go +++ b/pkg/netmap/filter.go @@ -230,14 +230,16 @@ func (f *Filter) InnerFilters() []*Filter { ) } -func filtersToV2(fs []*Filter) []*netmap.Filter { - fsV2 := make([]*netmap.Filter, 0, len(fs)) +func filtersToV2(fs []*Filter) (fsV2 []*netmap.Filter) { + if fs != nil { + fsV2 = make([]*netmap.Filter, 0, len(fs)) - for i := range fs { - fsV2 = append(fsV2, fs[i].ToV2()) + for i := range fs { + fsV2 = append(fsV2, fs[i].ToV2()) + } } - return fsV2 + return } // SetInnerFilters sets list of inner filters. diff --git a/pkg/netmap/policy.go b/pkg/netmap/policy.go index 84a5583..ce8a978 100644 --- a/pkg/netmap/policy.go +++ b/pkg/netmap/policy.go @@ -38,10 +38,14 @@ func (p *PlacementPolicy) Replicas() []*Replica { // SetReplicas sets list of object replica descriptors. func (p *PlacementPolicy) SetReplicas(rs ...*Replica) { - rsV2 := make([]*netmap.Replica, 0, len(rs)) + var rsV2 []*netmap.Replica - for i := range rs { - rsV2 = append(rsV2, rs[i].ToV2()) + if rs != nil { + rsV2 = make([]*netmap.Replica, 0, len(rs)) + + for i := range rs { + rsV2 = append(rsV2, rs[i].ToV2()) + } } (*netmap.PlacementPolicy)(p). @@ -76,14 +80,18 @@ func (p *PlacementPolicy) Selectors() []*Selector { // SetSelectors sets set of selectors to form the container's nodes subset. func (p *PlacementPolicy) SetSelectors(ss ...*Selector) { - rsV2 := make([]*netmap.Selector, 0, len(ss)) + var ssV2 []*netmap.Selector - for i := range ss { - rsV2 = append(rsV2, ss[i].ToV2()) + if ss != nil { + ssV2 = make([]*netmap.Selector, 0, len(ss)) + + for i := range ss { + ssV2 = append(ssV2, ss[i].ToV2()) + } } (*netmap.PlacementPolicy)(p). - SetSelectors(rsV2) + SetSelectors(ssV2) } // Filters returns list of named filters to reference in selectors. From c8199099060b7599fe79821aa9742b4c7d626e47 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 12 Mar 2021 16:07:52 +0300 Subject: [PATCH 0698/1196] [#263] pkg/client: Refactor the client to use raw protobuf client Make `Client` to be the wrapper over raw protobuf client. Provide public method to get the underlying raw client. Change implementations of all methods with the new approach of the RPC execution. Additional changes: * key replaced from `New` argument to `WithDefaultPrivateKey` option; * `GetSelfBalance` is removed as non-viable; * `GetEACLWithSignature` is removed, `GetEACL` returns `EACLWithSignature`; * `AttachSessionToken` / `AttachBearerToken` are removed as non-viable; * redundant options are removed. Signed-off-by: Leonard Lyubich --- pkg/client/accounting.go | 90 +------- pkg/client/client.go | 63 ++---- pkg/client/client_test.go | 67 ------ pkg/client/container.go | 446 ++++++++++---------------------------- pkg/client/netmap.go | 166 ++++---------- pkg/client/object.go | 345 ++++++++++------------------- pkg/client/opts.go | 150 ++++--------- pkg/client/raw.go | 14 ++ pkg/client/session.go | 107 ++------- 9 files changed, 380 insertions(+), 1068 deletions(-) delete mode 100644 pkg/client/client_test.go create mode 100644 pkg/client/raw.go diff --git a/pkg/client/accounting.go b/pkg/client/accounting.go index e9db7f1..a6028e4 100644 --- a/pkg/client/accounting.go +++ b/pkg/client/accounting.go @@ -5,54 +5,29 @@ import ( "github.com/nspcc-dev/neofs-api-go/pkg/accounting" "github.com/nspcc-dev/neofs-api-go/pkg/owner" + "github.com/nspcc-dev/neofs-api-go/rpc/client" v2accounting "github.com/nspcc-dev/neofs-api-go/v2/accounting" - "github.com/nspcc-dev/neofs-api-go/v2/client" + rpcapi "github.com/nspcc-dev/neofs-api-go/v2/rpc" v2signature "github.com/nspcc-dev/neofs-api-go/v2/signature" "github.com/pkg/errors" ) // Accounting contains methods related to balance querying. type Accounting interface { - // GetSelfBalance returns balance of the account deduced from client's key. - GetSelfBalance(context.Context, ...CallOption) (*accounting.Decimal, error) // GetBalance returns balance of provided account. GetBalance(context.Context, *owner.ID, ...CallOption) (*accounting.Decimal, error) } -func (c clientImpl) GetSelfBalance(ctx context.Context, opts ...CallOption) (*accounting.Decimal, error) { - return c.GetBalance(ctx, nil, opts...) -} - -func (c clientImpl) GetBalance(ctx context.Context, owner *owner.ID, opts ...CallOption) (*accounting.Decimal, error) { - // check remote node version - switch c.remoteNode.Version.Major() { - case 2: - return c.getBalanceV2(ctx, owner, opts...) - default: - return nil, errUnsupportedProtocol - } -} - -func (c clientImpl) getBalanceV2(ctx context.Context, ownerID *owner.ID, opts ...CallOption) (*accounting.Decimal, error) { +func (c *clientImpl) GetBalance(ctx context.Context, owner *owner.ID, opts ...CallOption) (*accounting.Decimal, error) { // apply all available options callOptions := c.defaultCallOptions() for i := range opts { - opts[i].apply(&callOptions) - } - - if ownerID == nil { - w, err := owner.NEO3WalletFromPublicKey(&callOptions.key.PublicKey) - if err != nil { - return nil, err - } - - ownerID = new(owner.ID) - ownerID.SetNeo3Wallet(w) + opts[i](callOptions) } reqBody := new(v2accounting.BalanceRequestBody) - reqBody.SetOwnerID(ownerID.ToV2()) + reqBody.SetOwnerID(owner.ToV2()) req := new(v2accounting.BalanceRequest) req.SetBody(reqBody) @@ -63,56 +38,15 @@ func (c clientImpl) getBalanceV2(ctx context.Context, ownerID *owner.ID, opts .. return nil, err } - switch c.remoteNode.Protocol { - case GRPC: - cli, err := v2AccountingClientFromOptions(c.opts) - if err != nil { - return nil, errors.Wrap(err, "can't create grpc client") - } - - resp, err := cli.Balance(ctx, req) - if err != nil { - return nil, errors.Wrap(err, "transport error") - } - - err = v2signature.VerifyServiceMessage(resp) - if err != nil { - return nil, errors.Wrap(err, "can't verify response message") - } - - return accounting.NewDecimalFromV2(resp.GetBody().GetBalance()), nil - default: - return nil, errUnsupportedProtocol - } -} - -func v2AccountingClientFromOptions(opts *clientOptions) (cli *v2accounting.Client, err error) { - switch { - case opts.grpcOpts.v2AccountingClient != nil: - // return value from client cache - return opts.grpcOpts.v2AccountingClient, nil - - case opts.grpcOpts.conn != nil: - cli, err = v2accounting.NewClient(v2accounting.WithGlobalOpts( - client.WithGRPCConn(opts.grpcOpts.conn)), - ) - - case opts.addr != "": - cli, err = v2accounting.NewClient(v2accounting.WithGlobalOpts( - client.WithNetworkAddress(opts.addr), - client.WithDialTimeout(opts.dialTimeout), - )) - - default: - return nil, errOptionsLack("Accounting") - } - - // check if client correct and save in cache + resp, err := rpcapi.Balance(c.Raw(), req, client.WithContext(ctx)) if err != nil { - return nil, err + return nil, errors.Wrap(err, "transport error") } - opts.grpcOpts.v2AccountingClient = cli + err = v2signature.VerifyServiceMessage(resp) + if err != nil { + return nil, errors.Wrap(err, "can't verify response message") + } - return cli, nil + return accounting.NewDecimalFromV2(resp.GetBody().GetBalance()), nil } diff --git a/pkg/client/client.go b/pkg/client/client.go index 42bd454..99d1e59 100644 --- a/pkg/client/client.go +++ b/pkg/client/client.go @@ -1,64 +1,37 @@ package client import ( - "crypto/ecdsa" - "errors" + "sync" - "github.com/nspcc-dev/neofs-api-go/pkg" - "github.com/nspcc-dev/neofs-api-go/pkg/token" + "github.com/nspcc-dev/neofs-api-go/rpc/client" ) -type ( - // Client represents NeoFS client. - Client interface { - Accounting - Container - Netmap - Object - Session - } +// Client represents NeoFS client. +type Client interface { + Accounting + Container + Netmap + Object + Session +} - clientImpl struct { - key *ecdsa.PrivateKey - remoteNode TransportInfo +type clientImpl struct { + onceInit sync.Once - opts *clientOptions + raw *client.Client - sessionToken *token.SessionToken + opts *clientOptions +} - bearerToken *token.BearerToken - } - - TransportProtocol uint32 - - TransportInfo struct { - Version *pkg.Version - Protocol TransportProtocol - } -) - -const ( - Unknown TransportProtocol = iota - GRPC -) - -var errUnsupportedProtocol = errors.New("unsupported transport protocol") - -// New returns new client which uses key as default signing key. -func New(key *ecdsa.PrivateKey, opts ...Option) (Client, error) { +func New(opts ...Option) (Client, error) { clientOptions := defaultClientOptions() for i := range opts { - opts[i].apply(clientOptions) + opts[i](clientOptions) } - // todo: make handshake to check latest version return &clientImpl{ - key: key, - remoteNode: TransportInfo{ - Version: pkg.SDKVersion(), - Protocol: GRPC, - }, + raw: client.New(), opts: clientOptions, }, nil } diff --git a/pkg/client/client_test.go b/pkg/client/client_test.go deleted file mode 100644 index cb36606..0000000 --- a/pkg/client/client_test.go +++ /dev/null @@ -1,67 +0,0 @@ -package client_test - -import ( - "context" - "fmt" - "testing" - "time" - - "github.com/nspcc-dev/neofs-api-go/pkg/client" - "github.com/nspcc-dev/neofs-api-go/pkg/container" - "github.com/nspcc-dev/neofs-api-go/pkg/netmap" - "github.com/nspcc-dev/neofs-crypto/test" - "github.com/stretchr/testify/require" - "google.golang.org/grpc" -) - -func TestExample(t *testing.T) { - t.Skip() - target := "s01.localtest.nspcc.ru:50501" - key := test.DecodeKey(-1) - - // create client from address - cli, err := client.New(key, client.WithAddress(target)) - require.NoError(t, err) - - // ask for balance - resp, err := cli.GetSelfBalance(context.Background()) - require.NoError(t, err) - - fmt.Println(resp.Value(), resp.Precision()) - - // create client from grpc connection - conn, err := grpc.DialContext(context.Background(), target, grpc.WithBlock(), grpc.WithInsecure()) - require.NoError(t, err) - - cli, err = client.New(key, client.WithGRPCConnection(conn)) - require.NoError(t, err) - - replica := new(netmap.Replica) - replica.SetCount(2) - replica.SetSelector("*") - - policy := new(netmap.PlacementPolicy) - policy.SetContainerBackupFactor(2) - policy.SetReplicas(replica) - - // this container has random nonce and it does not set owner id - cnr := container.New( - container.WithAttribute("CreatedAt", time.Now().String()), - container.WithPolicy(policy), - container.WithReadOnlyBasicACL(), - ) - require.NoError(t, err) - - // here container will have owner id from client key, and it will be signed - containerID, err := cli.PutContainer(context.Background(), cnr, client.WithTTL(10)) - require.NoError(t, err) - - fmt.Println(containerID) - - list, err := cli.ListSelfContainers(context.Background()) - require.NoError(t, err) - - for i := range list { - fmt.Println("found container:", list[i]) - } -} diff --git a/pkg/client/container.go b/pkg/client/container.go index 1328028..757fb46 100644 --- a/pkg/client/container.go +++ b/pkg/client/container.go @@ -7,10 +7,11 @@ import ( "github.com/nspcc-dev/neofs-api-go/pkg/acl/eacl" "github.com/nspcc-dev/neofs-api-go/pkg/container" "github.com/nspcc-dev/neofs-api-go/pkg/owner" + "github.com/nspcc-dev/neofs-api-go/rpc/client" "github.com/nspcc-dev/neofs-api-go/util/signature" - "github.com/nspcc-dev/neofs-api-go/v2/client" v2container "github.com/nspcc-dev/neofs-api-go/v2/container" "github.com/nspcc-dev/neofs-api-go/v2/refs" + rpcapi "github.com/nspcc-dev/neofs-api-go/v2/rpc" v2signature "github.com/nspcc-dev/neofs-api-go/v2/signature" "github.com/pkg/errors" ) @@ -23,14 +24,10 @@ type Container interface { GetContainer(context.Context, *container.ID, ...CallOption) (*container.Container, error) // ListContainers return container list with the provided owner. ListContainers(context.Context, *owner.ID, ...CallOption) ([]*container.ID, error) - // ListSelfContainers is similar to ListContainers but uses client's key to deduce owner ID. - ListSelfContainers(context.Context, ...CallOption) ([]*container.ID, error) // DeleteContainer removes container from NeoFS network. DeleteContainer(context.Context, *container.ID, ...CallOption) error // GetEACL returns extended ACL for a given container. - GetEACL(context.Context, *container.ID, ...CallOption) (*eacl.Table, error) - // GetEACLWithSignature is similar to GetEACL but returns signed ACL. - GetEACLWithSignature(context.Context, *container.ID, ...CallOption) (*EACLWithSignature, error) + GetEACL(context.Context, *container.ID, ...CallOption) (*EACLWithSignature, error) // SetEACL sets extended ACL. SetEACL(context.Context, *eacl.Table, ...CallOption) error // AnnounceContainerUsedSpace announces amount of space which is taken by stored objects. @@ -48,8 +45,6 @@ type EACLWithSignature struct { sig *pkg.Signature } -var errNilReponseBody = errors.New("response body is nil") - func (c delContainerSignWrapper) ReadSignedData(bytes []byte) ([]byte, error) { return c.body.GetContainerID().GetValue(), nil } @@ -68,129 +63,16 @@ func (e EACLWithSignature) Signature() *pkg.Signature { return e.sig } -func (c clientImpl) PutContainer(ctx context.Context, cnr *container.Container, opts ...CallOption) (*container.ID, error) { - switch c.remoteNode.Version.Major() { - case 2: - return c.putContainerV2(ctx, cnr, opts...) - default: - return nil, errUnsupportedProtocol - } -} - -// GetContainer receives container structure through NeoFS API call. -// -// Returns error if container structure is received but does not meet NeoFS API specification. -func (c clientImpl) GetContainer(ctx context.Context, id *container.ID, opts ...CallOption) (*container.Container, error) { - switch c.remoteNode.Version.Major() { - case 2: - return c.getContainerV2(ctx, id, opts...) - default: - return nil, errUnsupportedProtocol - } -} - -// GetVerifiedContainerStructure is a wrapper over Client.GetContainer method -// which checks if the structure of the resulting container matches its identifier. -// -// Returns container.ErrIDMismatch if container does not match the identifier. -func GetVerifiedContainerStructure(ctx context.Context, c Client, id *container.ID, opts ...CallOption) (*container.Container, error) { - cnr, err := c.GetContainer(ctx, id, opts...) - if err != nil { - return nil, err - } - - if !container.CalculateID(cnr).Equal(id) { - return nil, container.ErrIDMismatch - } - - return cnr, nil -} - -func (c clientImpl) ListContainers(ctx context.Context, owner *owner.ID, opts ...CallOption) ([]*container.ID, error) { - switch c.remoteNode.Version.Major() { - case 2: - return c.listContainerV2(ctx, owner, opts...) - default: - return nil, errUnsupportedProtocol - } -} - -func (c clientImpl) ListSelfContainers(ctx context.Context, opts ...CallOption) ([]*container.ID, error) { - return c.ListContainers(ctx, nil, opts...) -} - -func (c clientImpl) DeleteContainer(ctx context.Context, id *container.ID, opts ...CallOption) error { - switch c.remoteNode.Version.Major() { - case 2: - return c.delContainerV2(ctx, id, opts...) - default: - return errUnsupportedProtocol - } -} - -func (c clientImpl) GetEACL(ctx context.Context, id *container.ID, opts ...CallOption) (*eacl.Table, error) { - v, err := c.getEACL(ctx, id, true, opts...) - if err != nil { - return nil, err - } - - return v.table, nil -} - -func (c clientImpl) GetEACLWithSignature(ctx context.Context, id *container.ID, opts ...CallOption) (*EACLWithSignature, error) { - return c.getEACL(ctx, id, false, opts...) -} - -func (c clientImpl) getEACL(ctx context.Context, id *container.ID, verify bool, opts ...CallOption) (*EACLWithSignature, error) { - switch c.remoteNode.Version.Major() { - case 2: - resp, err := c.getEACLV2(ctx, id, verify, opts...) - if err != nil { - return nil, err - } - - return &EACLWithSignature{ - table: eacl.NewTableFromV2(resp.GetEACL()), - sig: pkg.NewSignatureFromV2(resp.GetSignature()), - }, nil - default: - return nil, errUnsupportedProtocol - } -} - -func (c clientImpl) SetEACL(ctx context.Context, eacl *eacl.Table, opts ...CallOption) error { - switch c.remoteNode.Version.Major() { - case 2: - return c.setEACLV2(ctx, eacl, opts...) - default: - return errUnsupportedProtocol - } -} - -// AnnounceContainerUsedSpace used by storage nodes to estimate their container -// sizes during lifetime. Use it only in storage node applications. -func (c clientImpl) AnnounceContainerUsedSpace( - ctx context.Context, - announce []container.UsedSpaceAnnouncement, - opts ...CallOption) error { - switch c.remoteNode.Version.Major() { - case 2: - return c.announceContainerUsedSpaceV2(ctx, announce, opts...) - default: - return errUnsupportedProtocol - } -} - -func (c clientImpl) putContainerV2(ctx context.Context, cnr *container.Container, opts ...CallOption) (*container.ID, error) { +func (c *clientImpl) PutContainer(ctx context.Context, cnr *container.Container, opts ...CallOption) (*container.ID, error) { // apply all available options callOptions := c.defaultCallOptions() for i := range opts { - opts[i].apply(&callOptions) + opts[i](callOptions) } // set transport version - cnr.SetVersion(c.remoteNode.Version) + cnr.SetVersion(pkg.SDKVersion()) // if container owner is not set, then use client key as owner if cnr.OwnerID() == nil { @@ -230,35 +112,28 @@ func (c clientImpl) putContainerV2(ctx context.Context, cnr *container.Container return nil, err } - switch c.remoteNode.Protocol { - case GRPC: - cli, err := v2ContainerClientFromOptions(c.opts) - if err != nil { - return nil, errors.Wrap(err, "can't create grpc client") - } - - resp, err := cli.Put(ctx, req) - if err != nil { - return nil, errors.Wrap(err, "transport error") - } - - err = v2signature.VerifyServiceMessage(resp) - if err != nil { - return nil, errors.Wrap(err, "can't verify response message") - } - - return container.NewIDFromV2(resp.GetBody().GetContainerID()), nil - default: - return nil, errUnsupportedProtocol + resp, err := rpcapi.PutContainer(c.Raw(), req, client.WithContext(ctx)) + if err != nil { + return nil, err } + + err = v2signature.VerifyServiceMessage(resp) + if err != nil { + return nil, errors.Wrap(err, "can't verify response message") + } + + return container.NewIDFromV2(resp.GetBody().GetContainerID()), nil } -func (c clientImpl) getContainerV2(ctx context.Context, id *container.ID, opts ...CallOption) (*container.Container, error) { +// GetContainer receives container structure through NeoFS API call. +// +// Returns error if container structure is received but does not meet NeoFS API specification. +func (c *clientImpl) GetContainer(ctx context.Context, id *container.ID, opts ...CallOption) (*container.Container, error) { // apply all available options callOptions := c.defaultCallOptions() for i := range opts { - opts[i].apply(&callOptions) + opts[i](callOptions) } reqBody := new(v2container.GetRequestBody) @@ -273,35 +148,42 @@ func (c clientImpl) getContainerV2(ctx context.Context, id *container.ID, opts . return nil, err } - switch c.remoteNode.Protocol { - case GRPC: - cli, err := v2ContainerClientFromOptions(c.opts) - if err != nil { - return nil, errors.Wrap(err, "can't create grpc client") - } - - resp, err := cli.Get(ctx, req) - if err != nil { - return nil, errors.Wrap(err, "transport error") - } - - err = v2signature.VerifyServiceMessage(resp) - if err != nil { - return nil, errors.Wrap(err, "can't verify response message") - } - - return container.NewVerifiedFromV2(resp.GetBody().GetContainer()) - default: - return nil, errUnsupportedProtocol + resp, err := rpcapi.GetContainer(c.Raw(), req, client.WithContext(ctx)) + if err != nil { + return nil, errors.Wrap(err, "transport error") } + + err = v2signature.VerifyServiceMessage(resp) + if err != nil { + return nil, errors.Wrap(err, "can't verify response message") + } + + return container.NewVerifiedFromV2(resp.GetBody().GetContainer()) } -func (c clientImpl) listContainerV2(ctx context.Context, ownerID *owner.ID, opts ...CallOption) ([]*container.ID, error) { +// GetVerifiedContainerStructure is a wrapper over Client.GetContainer method +// which checks if the structure of the resulting container matches its identifier. +// +// Returns container.ErrIDMismatch if container does not match the identifier. +func GetVerifiedContainerStructure(ctx context.Context, c Client, id *container.ID, opts ...CallOption) (*container.Container, error) { + cnr, err := c.GetContainer(ctx, id, opts...) + if err != nil { + return nil, err + } + + if !container.CalculateID(cnr).Equal(id) { + return nil, container.ErrIDMismatch + } + + return cnr, nil +} + +func (c *clientImpl) ListContainers(ctx context.Context, ownerID *owner.ID, opts ...CallOption) ([]*container.ID, error) { // apply all available options callOptions := c.defaultCallOptions() for i := range opts { - opts[i].apply(&callOptions) + opts[i](callOptions) } if ownerID == nil { @@ -326,40 +208,31 @@ func (c clientImpl) listContainerV2(ctx context.Context, ownerID *owner.ID, opts return nil, err } - switch c.remoteNode.Protocol { - case GRPC: - cli, err := v2ContainerClientFromOptions(c.opts) - if err != nil { - return nil, errors.Wrap(err, "can't create grpc client") - } - - resp, err := cli.List(ctx, req) - if err != nil { - return nil, errors.Wrap(err, "transport error") - } - - err = v2signature.VerifyServiceMessage(resp) - if err != nil { - return nil, errors.Wrap(err, "can't verify response message") - } - - result := make([]*container.ID, 0, len(resp.GetBody().GetContainerIDs())) - for _, cidV2 := range resp.GetBody().GetContainerIDs() { - result = append(result, container.NewIDFromV2(cidV2)) - } - - return result, nil - default: - return nil, errUnsupportedProtocol + resp, err := rpcapi.ListContainers(c.Raw(), req, client.WithContext(ctx)) + if err != nil { + return nil, errors.Wrap(err, "transport error") } + + err = v2signature.VerifyServiceMessage(resp) + if err != nil { + return nil, errors.Wrap(err, "can't verify response message") + } + + result := make([]*container.ID, 0, len(resp.GetBody().GetContainerIDs())) + for _, cidV2 := range resp.GetBody().GetContainerIDs() { + result = append(result, container.NewIDFromV2(cidV2)) + } + + return result, nil + } -func (c clientImpl) delContainerV2(ctx context.Context, id *container.ID, opts ...CallOption) error { +func (c *clientImpl) DeleteContainer(ctx context.Context, id *container.ID, opts ...CallOption) error { // apply all available options callOptions := c.defaultCallOptions() for i := range opts { - opts[i].apply(&callOptions) + opts[i](callOptions) } reqBody := new(v2container.DeleteRequestBody) @@ -390,35 +263,20 @@ func (c clientImpl) delContainerV2(ctx context.Context, id *container.ID, opts . return err } - switch c.remoteNode.Protocol { - case GRPC: - cli, err := v2ContainerClientFromOptions(c.opts) - if err != nil { - return errors.Wrap(err, "can't create grpc client") - } - - resp, err := cli.Delete(ctx, req) - if err != nil { - return errors.Wrap(err, "transport error") - } - - err = v2signature.VerifyServiceMessage(resp) - if err != nil { - return errors.Wrap(err, "can't verify response message") - } - - return nil - default: - return errUnsupportedProtocol + resp, err := rpcapi.DeleteContainer(c.Raw(), req, client.WithContext(ctx)) + if err != nil { + return errors.Wrap(err, "transport error") } + + return errors.Wrap(v2signature.VerifyServiceMessage(resp), "can't verify response message") } -func (c clientImpl) getEACLV2(ctx context.Context, id *container.ID, verify bool, opts ...CallOption) (*v2container.GetExtendedACLResponseBody, error) { +func (c *clientImpl) GetEACL(ctx context.Context, id *container.ID, opts ...CallOption) (*EACLWithSignature, error) { // apply all available options callOptions := c.defaultCallOptions() for i := range opts { - opts[i].apply(&callOptions) + opts[i](callOptions) } reqBody := new(v2container.GetExtendedACLRequestBody) @@ -433,61 +291,35 @@ func (c clientImpl) getEACLV2(ctx context.Context, id *container.ID, verify bool return nil, err } - switch c.remoteNode.Protocol { - case GRPC: - cli, err := v2ContainerClientFromOptions(c.opts) - if err != nil { - return nil, errors.Wrap(err, "can't create grpc client") - } - - resp, err := cli.GetExtendedACL(ctx, req) - if err != nil { - return nil, errors.Wrap(err, "transport error") - } - - err = v2signature.VerifyServiceMessage(resp) - if err != nil { - return nil, errors.Wrap(err, "can't verify response message") - } - - body := resp.GetBody() - if body == nil { - return nil, errNilReponseBody - } - - if verify { - if err := signature.VerifyDataWithSource( - v2signature.StableMarshalerWrapper{ - SM: body.GetEACL(), - }, - func() (key, sig []byte) { - s := body.GetSignature() - - return s.GetKey(), s.GetSign() - }, - signature.SignWithRFC6979(), - ); err != nil { - return nil, errors.Wrap(err, "incorrect signature") - } - } - - return body, nil - default: - return nil, errUnsupportedProtocol + resp, err := rpcapi.GetEACL(c.Raw(), req, client.WithContext(ctx)) + if err != nil { + return nil, errors.Wrap(err, "transport error") } + + err = v2signature.VerifyServiceMessage(resp) + if err != nil { + return nil, errors.Wrap(err, "can't verify response message") + } + + body := resp.GetBody() + + return &EACLWithSignature{ + table: eacl.NewTableFromV2(body.GetEACL()), + sig: pkg.NewSignatureFromV2(body.GetSignature()), + }, nil } -func (c clientImpl) setEACLV2(ctx context.Context, eacl *eacl.Table, opts ...CallOption) error { +func (c *clientImpl) SetEACL(ctx context.Context, eacl *eacl.Table, opts ...CallOption) error { // apply all available options callOptions := c.defaultCallOptions() for i := range opts { - opts[i].apply(&callOptions) + opts[i](callOptions) } reqBody := new(v2container.SetExtendedACLRequestBody) reqBody.SetEACL(eacl.ToV2()) - reqBody.GetEACL().SetVersion(c.remoteNode.Version.ToV2()) + reqBody.GetEACL().SetVersion(pkg.SDKVersion().ToV2()) signWrapper := v2signature.StableMarshalerWrapper{SM: reqBody.GetEACL()} @@ -510,37 +342,29 @@ func (c clientImpl) setEACLV2(ctx context.Context, eacl *eacl.Table, opts ...Cal return err } - switch c.remoteNode.Protocol { - case GRPC: - cli, err := v2ContainerClientFromOptions(c.opts) - if err != nil { - return errors.Wrap(err, "can't create grpc client") - } - - resp, err := cli.SetExtendedACL(ctx, req) - if err != nil { - return errors.Wrap(err, "transport error") - } - - err = v2signature.VerifyServiceMessage(resp) - if err != nil { - return errors.Wrap(err, "can't verify response message") - } - - return nil - default: - return errUnsupportedProtocol + resp, err := rpcapi.SetEACL(c.Raw(), req, client.WithContext(ctx)) + if err != nil { + return errors.Wrap(err, "transport error") } + + err = v2signature.VerifyServiceMessage(resp) + if err != nil { + return errors.Wrap(err, "can't verify response message") + } + + return nil } -func (c clientImpl) announceContainerUsedSpaceV2( +// AnnounceContainerUsedSpace used by storage nodes to estimate their container +// sizes during lifetime. Use it only in storage node applications. +func (c *clientImpl) AnnounceContainerUsedSpace( ctx context.Context, announce []container.UsedSpaceAnnouncement, opts ...CallOption) error { callOptions := c.defaultCallOptions() // apply all available options for i := range opts { - opts[i].apply(&callOptions) + opts[i](callOptions) } // convert list of SDK announcement structures into NeoFS-API v2 list @@ -563,57 +387,15 @@ func (c clientImpl) announceContainerUsedSpaceV2( return err } - // choose underline transport protocol and send message over it - switch c.remoteNode.Protocol { - case GRPC: - cli, err := v2ContainerClientFromOptions(c.opts) - if err != nil { - return errors.Wrap(err, "can't create grpc client") - } - - resp, err := cli.AnnounceUsedSpace(ctx, req) - if err != nil { - return errors.Wrap(err, "transport error") - } - - err = v2signature.VerifyServiceMessage(resp) - if err != nil { - return errors.Wrap(err, "can't verify response message") - } - - return nil - default: - return errUnsupportedProtocol - } -} - -func v2ContainerClientFromOptions(opts *clientOptions) (cli *v2container.Client, err error) { - switch { - case opts.grpcOpts.v2ContainerClient != nil: - // return value from client cache - return opts.grpcOpts.v2ContainerClient, nil - - case opts.grpcOpts.conn != nil: - cli, err = v2container.NewClient(v2container.WithGlobalOpts( - client.WithGRPCConn(opts.grpcOpts.conn)), - ) - - case opts.addr != "": - cli, err = v2container.NewClient(v2container.WithGlobalOpts( - client.WithNetworkAddress(opts.addr), - client.WithDialTimeout(opts.dialTimeout), - )) - - default: - return nil, errOptionsLack("Container") - } - - // check if client correct and save in cache + resp, err := rpcapi.AnnounceUsedSpace(c.Raw(), req, client.WithContext(ctx)) if err != nil { - return nil, err + return errors.Wrap(err, "transport error") } - opts.grpcOpts.v2ContainerClient = cli + err = v2signature.VerifyServiceMessage(resp) + if err != nil { + return errors.Wrap(err, "can't verify response message") + } - return cli, nil + return nil } diff --git a/pkg/client/netmap.go b/pkg/client/netmap.go index b3f8966..057b0c3 100644 --- a/pkg/client/netmap.go +++ b/pkg/client/netmap.go @@ -3,9 +3,11 @@ package client import ( "context" + "github.com/nspcc-dev/neofs-api-go/pkg" "github.com/nspcc-dev/neofs-api-go/pkg/netmap" - "github.com/nspcc-dev/neofs-api-go/v2/client" + "github.com/nspcc-dev/neofs-api-go/rpc/client" v2netmap "github.com/nspcc-dev/neofs-api-go/v2/netmap" + rpcapi "github.com/nspcc-dev/neofs-api-go/v2/rpc" v2signature "github.com/nspcc-dev/neofs-api-go/v2/signature" "github.com/pkg/errors" ) @@ -15,51 +17,37 @@ type Netmap interface { // EndpointInfo returns attributes, address and public key of the node, specified // in client constructor via address or open connection. This can be used as a // health check to see if node is alive and responses to requests. - EndpointInfo(context.Context, ...CallOption) (*netmap.NodeInfo, error) - // Epoch returns the epoch number from the local state of the remote host. - Epoch(context.Context, ...CallOption) (uint64, error) + EndpointInfo(context.Context, ...CallOption) (*EndpointInfo, error) // NetworkInfo returns information about the NeoFS network of which the remote server is a part. NetworkInfo(context.Context, ...CallOption) (*netmap.NetworkInfo, error) } +// EACLWithSignature represents eACL table/signature pair. +type EndpointInfo struct { + version *pkg.Version + + ni *netmap.NodeInfo +} + +// LatestVersion returns latest NeoFS API version in use. +func (e *EndpointInfo) LatestVersion() *pkg.Version { + return e.version +} + +// NodeInfo returns returns information about the NeoFS node. +func (e *EndpointInfo) NodeInfo() *netmap.NodeInfo { + return e.ni +} + // EndpointInfo returns attributes, address and public key of the node, specified // in client constructor via address or open connection. This can be used as a // health check to see if node is alive and responses to requests. -func (c clientImpl) EndpointInfo(ctx context.Context, opts ...CallOption) (*netmap.NodeInfo, error) { - switch c.remoteNode.Version.Major() { - case 2: - resp, err := c.endpointInfoV2(ctx, opts...) - if err != nil { - return nil, err - } - - return netmap.NewNodeInfoFromV2(resp.GetBody().GetNodeInfo()), nil - default: - return nil, errUnsupportedProtocol - } -} - -// Epoch returns the epoch number from the local state of the remote host. -func (c clientImpl) Epoch(ctx context.Context, opts ...CallOption) (uint64, error) { - switch c.remoteNode.Version.Major() { - case 2: - resp, err := c.endpointInfoV2(ctx, opts...) - if err != nil { - return 0, err - } - - return resp.GetMetaHeader().GetEpoch(), nil - default: - return 0, errUnsupportedProtocol - } -} - -func (c clientImpl) endpointInfoV2(ctx context.Context, opts ...CallOption) (*v2netmap.LocalNodeInfoResponse, error) { +func (c *clientImpl) EndpointInfo(ctx context.Context, opts ...CallOption) (*EndpointInfo, error) { // apply all available options callOptions := c.defaultCallOptions() for i := range opts { - opts[i].apply(&callOptions) + opts[i](callOptions) } reqBody := new(v2netmap.LocalNodeInfoRequestBody) @@ -73,81 +61,31 @@ func (c clientImpl) endpointInfoV2(ctx context.Context, opts ...CallOption) (*v2 return nil, err } - switch c.remoteNode.Protocol { - case GRPC: - cli, err := v2NetmapClientFromOptions(c.opts) - if err != nil { - return nil, errors.Wrap(err, "can't create grpc client") - } - - resp, err := cli.LocalNodeInfo(ctx, req) - if err != nil { - return nil, errors.Wrap(err, "transport error") - } - - err = v2signature.VerifyServiceMessage(resp) - if err != nil { - return nil, errors.Wrap(err, "can't verify response message") - } - - return resp, nil - default: - return nil, errUnsupportedProtocol - } -} - -func v2NetmapClientFromOptions(opts *clientOptions) (cli *v2netmap.Client, err error) { - switch { - case opts.grpcOpts.v2NetmapClient != nil: - // return value from client cache - return opts.grpcOpts.v2NetmapClient, nil - - case opts.grpcOpts.conn != nil: - cli, err = v2netmap.NewClient(v2netmap.WithGlobalOpts( - client.WithGRPCConn(opts.grpcOpts.conn)), - ) - - case opts.addr != "": - cli, err = v2netmap.NewClient(v2netmap.WithGlobalOpts( - client.WithNetworkAddress(opts.addr), - client.WithDialTimeout(opts.dialTimeout), - )) - - default: - return nil, errOptionsLack("Netmap") - } - - // check if client correct and save in cache + resp, err := rpcapi.LocalNodeInfo(c.Raw(), req) if err != nil { - return nil, err + return nil, errors.Wrap(err, "transport error") } - opts.grpcOpts.v2NetmapClient = cli + err = v2signature.VerifyServiceMessage(resp) + if err != nil { + return nil, errors.Wrap(err, "can't verify response message") + } - return cli, nil + body := resp.GetBody() + + return &EndpointInfo{ + version: pkg.NewVersionFromV2(body.GetVersion()), + ni: netmap.NewNodeInfoFromV2(body.GetNodeInfo()), + }, nil } // NetworkInfo returns information about the NeoFS network of which the remote server is a part. -func (c clientImpl) NetworkInfo(ctx context.Context, opts ...CallOption) (*netmap.NetworkInfo, error) { - switch c.remoteNode.Version.Major() { - case 2: - resp, err := c.networkInfoV2(ctx, opts...) - if err != nil { - return nil, err - } - - return netmap.NewNetworkInfoFromV2(resp.GetBody().GetNetworkInfo()), nil - default: - return nil, errUnsupportedProtocol - } -} - -func (c clientImpl) networkInfoV2(ctx context.Context, opts ...CallOption) (*v2netmap.NetworkInfoResponse, error) { +func (c *clientImpl) NetworkInfo(ctx context.Context, opts ...CallOption) (*netmap.NetworkInfo, error) { // apply all available options callOptions := c.defaultCallOptions() for i := range opts { - opts[i].apply(&callOptions) + opts[i](callOptions) } reqBody := new(v2netmap.NetworkInfoRequestBody) @@ -161,25 +99,15 @@ func (c clientImpl) networkInfoV2(ctx context.Context, opts ...CallOption) (*v2n return nil, err } - switch c.remoteNode.Protocol { - case GRPC: - cli, err := v2NetmapClientFromOptions(c.opts) - if err != nil { - return nil, errors.Wrap(err, "could not create grpc client") - } - - resp, err := cli.NetworkInfo(ctx, req) - if err != nil { - return nil, errors.Wrap(err, "v2 NetworkInfo RPC failure") - } - - err = v2signature.VerifyServiceMessage(resp) - if err != nil { - return nil, errors.Wrap(err, "response message verification failed") - } - - return resp, nil - default: - return nil, errUnsupportedProtocol + resp, err := rpcapi.NetworkInfo(c.Raw(), req, client.WithContext(ctx)) + if err != nil { + return nil, errors.Wrap(err, "v2 NetworkInfo RPC failure") } + + err = v2signature.VerifyServiceMessage(resp) + if err != nil { + return nil, errors.Wrap(err, "response message verification failed") + } + + return netmap.NewNetworkInfoFromV2(resp.GetBody().GetNetworkInfo()), nil } diff --git a/pkg/client/object.go b/pkg/client/object.go index 62f99cf..b242422 100644 --- a/pkg/client/object.go +++ b/pkg/client/object.go @@ -10,10 +10,11 @@ import ( "github.com/nspcc-dev/neofs-api-go/pkg/container" "github.com/nspcc-dev/neofs-api-go/pkg/object" + "github.com/nspcc-dev/neofs-api-go/rpc/client" signer "github.com/nspcc-dev/neofs-api-go/util/signature" - "github.com/nspcc-dev/neofs-api-go/v2/client" v2object "github.com/nspcc-dev/neofs-api-go/v2/object" v2refs "github.com/nspcc-dev/neofs-api-go/v2/refs" + rpcapi "github.com/nspcc-dev/neofs-api-go/v2/rpc" v2session "github.com/nspcc-dev/neofs-api-go/v2/session" "github.com/nspcc-dev/neofs-api-go/v2/signature" "github.com/pkg/errors" @@ -114,7 +115,7 @@ type putObjectV2Writer struct { req *v2object.PutRequest - stream v2object.PutObjectStreamer + stream *rpcapi.PutRequestWriter } type checksumType int @@ -171,7 +172,7 @@ func (w *putObjectV2Writer) Write(p []byte) (int, error) { return 0, errors.Wrap(err, "could not sign chunk request message") } - if err := w.stream.Send(w.req); err != nil { + if err := w.stream.Write(w.req); err != nil { return 0, errors.Wrap(err, "could not send chunk request message") } @@ -211,32 +212,11 @@ func (p *PutObjectParams) PayloadReader() io.Reader { } func (c *clientImpl) PutObject(ctx context.Context, p *PutObjectParams, opts ...CallOption) (*object.ID, error) { - // check remote node version - switch c.remoteNode.Version.Major() { - case 2: - return c.putObjectV2(ctx, p, opts...) - default: - return nil, errUnsupportedProtocol - } -} - -func (c *clientImpl) putObjectV2(ctx context.Context, p *PutObjectParams, opts ...CallOption) (*object.ID, error) { - // create V2 Object client - cli, err := v2ObjectClient(c.remoteNode.Protocol, c.opts) - if err != nil { - return nil, errors.Wrap(err, "could not create Object V2 client") - } - - stream, err := cli.Put(ctx) - if err != nil { - return nil, errors.Wrap(err, "could not open Put object stream") - } - callOpts := c.defaultCallOptions() for i := range opts { if opts[i] != nil { - opts[i].apply(&callOpts) + opts[i](callOpts) } } @@ -253,11 +233,12 @@ func (c *clientImpl) putObjectV2(ctx context.Context, p *PutObjectParams, opts . // set meta header meta := v2MetaHeaderFromOpts(callOpts) - if err = c.attachV2SessionToken(callOpts, meta, v2SessionReqInfo{ + + if err := c.attachV2SessionToken(callOpts, meta, v2SessionReqInfo{ addr: v2Addr, verb: v2session.ObjectVerbPut, }); err != nil { - return nil, errors.Wrap(err, "could not sign session token") + return nil, errors.Wrap(err, "could not attach session token") } req.SetMetaHeader(meta) @@ -275,12 +256,21 @@ func (c *clientImpl) putObjectV2(ctx context.Context, p *PutObjectParams, opts . // sign the request if err := signature.SignServiceMessage(callOpts.key, req); err != nil { - return nil, errors.Wrapf(err, "could not sign %T", req) + return nil, errors.Wrapf(err, "signing the request failed") + } + + // open stream + resp := new(v2object.PutResponse) + + stream, err := rpcapi.PutObject(c.Raw(), resp, client.WithContext(ctx)) + if err != nil { + return nil, errors.Wrap(err, "stream opening failed") } // send init part - if err := stream.Send(req); err != nil { - return nil, errors.Wrapf(err, "could not send %T", req) + err = stream.Write(req) + if err != nil { + return nil, errors.Wrap(err, "sending the initial message to stream failed") } // create payload bytes reader @@ -305,18 +295,18 @@ func (c *clientImpl) putObjectV2(ctx context.Context, p *PutObjectParams, opts . // copy payload from reader to stream writer _, err = io.CopyBuffer(w, r, make([]byte, chunkSize)) if err != nil && !errors.Is(errors.Cause(err), io.EOF) { - return nil, errors.Wrap(err, "could not send payload bytes to Put object stream") + return nil, errors.Wrap(err, "payload streaming failed") } // close object stream and receive response from remote node - resp, err := stream.CloseAndRecv() + err = stream.Close() if err != nil { - return nil, errors.Wrapf(err, "could not close %T", stream) + return nil, errors.Wrap(err, "closing the stream failed") } // verify response structure if err := signature.VerifyServiceMessage(resp); err != nil { - return nil, errors.Wrapf(err, "could not verify %T", resp) + return nil, errors.Wrap(err, "response verification failed") } // convert object identifier @@ -377,39 +367,11 @@ func DeleteObject(ctx context.Context, c Client, p *DeleteObjectParams, opts ... // // If target of tombstone address is not set, the address is ignored. func (c *clientImpl) DeleteObject(ctx context.Context, p *DeleteObjectParams, opts ...CallOption) error { - // check remote node version - switch c.remoteNode.Version.Major() { - case 2: - if p.tombTgt == nil { - p.tombTgt = new(objectAddressWriter) - } - - resp, err := c.deleteObjectV2(ctx, p, opts...) - if err != nil { - return err - } - - addrV2 := resp.GetBody().GetTombstone() - p.tombTgt.SetAddress(object.NewAddressFromV2(addrV2)) - - return nil - default: - return errUnsupportedProtocol - } -} - -func (c *clientImpl) deleteObjectV2(ctx context.Context, p *DeleteObjectParams, opts ...CallOption) (*v2object.DeleteResponse, error) { - // create V2 Object client - cli, err := v2ObjectClient(c.remoteNode.Protocol, c.opts) - if err != nil { - return nil, errors.Wrap(err, "could not create Object V2 client") - } - callOpts := c.defaultCallOptions() for i := range opts { if opts[i] != nil { - opts[i].apply(&callOpts) + opts[i](callOpts) } } @@ -422,11 +384,12 @@ func (c *clientImpl) deleteObjectV2(ctx context.Context, p *DeleteObjectParams, // set meta header meta := v2MetaHeaderFromOpts(callOpts) - if err = c.attachV2SessionToken(callOpts, meta, v2SessionReqInfo{ + + if err := c.attachV2SessionToken(callOpts, meta, v2SessionReqInfo{ addr: p.addr.ToV2(), verb: v2session.ObjectVerbDelete, }); err != nil { - return nil, errors.Wrap(err, "could not sign session token") + return errors.Wrap(err, "could not attach session token") } req.SetMetaHeader(meta) @@ -436,21 +399,25 @@ func (c *clientImpl) deleteObjectV2(ctx context.Context, p *DeleteObjectParams, // sign the request if err := signature.SignServiceMessage(callOpts.key, req); err != nil { - return nil, errors.Wrapf(err, "could not sign %T", req) + return errors.Wrap(err, "signing the request failed") } // send request - resp, err := cli.Delete(ctx, req) + resp, err := rpcapi.DeleteObject(c.Raw(), req, client.WithContext(ctx)) if err != nil { - return nil, errors.Wrapf(err, "could not send %T", req) + return errors.Wrap(err, "sending the request failed") } // verify response structure if err := signature.VerifyServiceMessage(resp); err != nil { - return nil, errors.Wrapf(err, "could not verify %T", resp) + return errors.Wrap(err, "response verification failed") } - return resp, nil + if p.tombTgt != nil { + p.tombTgt.SetAddress(object.NewAddressFromV2(resp.GetBody().GetTombstone())) + } + + return nil } func (p *GetObjectParams) WithAddress(v *object.Address) *GetObjectParams { @@ -501,28 +468,14 @@ func (p *GetObjectParams) RawFlag() bool { return false } +var errWrongMessageSeq = errors.New("incorrect message sequence") + func (c *clientImpl) GetObject(ctx context.Context, p *GetObjectParams, opts ...CallOption) (*object.Object, error) { - // check remote node version - switch c.remoteNode.Version.Major() { - case 2: - return c.getObjectV2(ctx, p, opts...) - default: - return nil, errUnsupportedProtocol - } -} - -func (c *clientImpl) getObjectV2(ctx context.Context, p *GetObjectParams, opts ...CallOption) (*object.Object, error) { - // create V2 Object client - cli, err := v2ObjectClient(c.remoteNode.Protocol, c.opts) - if err != nil { - return nil, errors.Wrap(err, "could not create Object V2 client") - } - callOpts := c.defaultCallOptions() for i := range opts { if opts[i] != nil { - opts[i].apply(&callOpts) + opts[i](callOpts) } } @@ -535,11 +488,12 @@ func (c *clientImpl) getObjectV2(ctx context.Context, p *GetObjectParams, opts . // set meta header meta := v2MetaHeaderFromOpts(callOpts) - if err = c.attachV2SessionToken(callOpts, meta, v2SessionReqInfo{ + + if err := c.attachV2SessionToken(callOpts, meta, v2SessionReqInfo{ addr: p.addr.ToV2(), verb: v2session.ObjectVerbGet, }); err != nil { - return nil, errors.Wrap(err, "could not sign session token") + return nil, errors.Wrap(err, "could not attach session token") } req.SetMetaHeader(meta) @@ -550,40 +504,52 @@ func (c *clientImpl) getObjectV2(ctx context.Context, p *GetObjectParams, opts . // sign the request if err := signature.SignServiceMessage(callOpts.key, req); err != nil { - return nil, errors.Wrapf(err, "could not sign %T", req) + return nil, errors.Wrap(err, "signing the request failed") } - // create Get object stream - stream, err := cli.Get(ctx, req) + // open stream + stream, err := rpcapi.GetObject(c.Raw(), req, client.WithContext(ctx)) if err != nil { - return nil, errors.Wrap(err, "could not create Get object stream") + return nil, errors.Wrap(err, "stream opening failed") } var ( + headWas bool payload []byte obj = new(v2object.Object) + resp = new(v2object.GetResponse) ) for { // receive message from server stream - resp, err := stream.Recv() + err := stream.Read(resp) if err != nil { if errors.Is(errors.Cause(err), io.EOF) { + if !headWas { + return nil, io.ErrUnexpectedEOF + } + break } - return nil, errors.Wrap(err, "could not receive Get response") + return nil, errors.Wrap(err, "reading the response failed") } // verify response structure if err := signature.VerifyServiceMessage(resp); err != nil { - return nil, errors.Wrapf(err, "could not verify %T", resp) + return nil, errors.Wrap(err, "response verification failed") } switch v := resp.GetBody().GetObjectPart().(type) { - case nil: - return nil, errNilObjectPart + default: + return nil, errors.Errorf("unexpected object part %T", v) case *v2object.GetObjectPartInit: + if headWas { + return nil, errWrongMessageSeq + } + + headWas = true + obj.SetObjectID(v.GetObjectID()) obj.SetSignature(v.GetSignature()) @@ -594,6 +560,10 @@ func (c *clientImpl) getObjectV2(ctx context.Context, p *GetObjectParams, opts . payload = make([]byte, 0, hdr.GetPayloadLength()) } case *v2object.GetObjectPartChunk: + if !headWas { + return nil, errWrongMessageSeq + } + if p.w != nil { if _, err := p.w.Write(v.GetChunk()); err != nil { return nil, errors.Wrap(err, "could not write payload chunk") @@ -604,8 +574,6 @@ func (c *clientImpl) getObjectV2(ctx context.Context, p *GetObjectParams, opts . case *v2object.SplitInfo: si := object.NewSplitInfoFromV2(v) return nil, object.NewSplitInfoError(si) - default: - panic(fmt.Sprintf("unexpected Get object part type %T", v)) } } @@ -674,27 +642,11 @@ func (p *ObjectHeaderParams) RawFlag() bool { } func (c *clientImpl) GetObjectHeader(ctx context.Context, p *ObjectHeaderParams, opts ...CallOption) (*object.Object, error) { - // check remote node version - switch c.remoteNode.Version.Major() { - case 2: - return c.getObjectHeaderV2(ctx, p, opts...) - default: - return nil, errUnsupportedProtocol - } -} - -func (c *clientImpl) getObjectHeaderV2(ctx context.Context, p *ObjectHeaderParams, opts ...CallOption) (*object.Object, error) { - // create V2 Object client - cli, err := v2ObjectClient(c.remoteNode.Protocol, c.opts) - if err != nil { - return nil, errors.Wrap(err, "could not create Object V2 client") - } - callOpts := c.defaultCallOptions() for i := range opts { if opts[i] != nil { - opts[i].apply(&callOpts) + opts[i](callOpts) } } @@ -707,11 +659,12 @@ func (c *clientImpl) getObjectHeaderV2(ctx context.Context, p *ObjectHeaderParam // set meta header meta := v2MetaHeaderFromOpts(callOpts) - if err = c.attachV2SessionToken(callOpts, meta, v2SessionReqInfo{ + + if err := c.attachV2SessionToken(callOpts, meta, v2SessionReqInfo{ addr: p.addr.ToV2(), verb: v2session.ObjectVerbHead, }); err != nil { - return nil, errors.Wrap(err, "could not sign session token") + return nil, errors.Wrap(err, "could not attach session token") } req.SetMetaHeader(meta) @@ -723,18 +676,18 @@ func (c *clientImpl) getObjectHeaderV2(ctx context.Context, p *ObjectHeaderParam // sign the request if err := signature.SignServiceMessage(callOpts.key, req); err != nil { - return nil, errors.Wrapf(err, "could not sign %T", req) + return nil, errors.Wrap(err, "signing the request failed") } // send Head request - resp, err := cli.Head(ctx, req) + resp, err := rpcapi.HeadObject(c.Raw(), req, client.WithContext(ctx)) if err != nil { - return nil, errors.Wrapf(err, "could not send %T", req) + return nil, errors.Wrap(err, "sending the request failed") } // verify response structure if err := signature.VerifyServiceMessage(resp); err != nil { - return nil, errors.Wrapf(err, "could not verify %T", resp) + return nil, errors.Wrap(err, "response verification failed") } var ( @@ -744,7 +697,7 @@ func (c *clientImpl) getObjectHeaderV2(ctx context.Context, p *ObjectHeaderParam switch v := resp.GetBody().GetHeaderPart().(type) { case nil: - return nil, errNilObjectPart + return nil, errors.Errorf("unexpected header type %T", v) case *v2object.ShortHeader: if !p.short { return nil, errors.Errorf("wrong header part type: expected %T, received %T", @@ -791,8 +744,6 @@ func (c *clientImpl) getObjectHeaderV2(ctx context.Context, p *ObjectHeaderParam si := object.NewSplitInfoFromV2(v) return nil, object.NewSplitInfoError(si) - default: - panic(fmt.Sprintf("unexpected Head object type %T", v)) } obj := new(v2object.Object) @@ -871,27 +822,11 @@ func (p *RangeDataParams) DataWriter() io.Writer { } func (c *clientImpl) ObjectPayloadRangeData(ctx context.Context, p *RangeDataParams, opts ...CallOption) ([]byte, error) { - // check remote node version - switch c.remoteNode.Version.Major() { - case 2: - return c.objectPayloadRangeV2(ctx, p, opts...) - default: - return nil, errUnsupportedProtocol - } -} - -func (c *clientImpl) objectPayloadRangeV2(ctx context.Context, p *RangeDataParams, opts ...CallOption) ([]byte, error) { - // create V2 Object client - cli, err := v2ObjectClient(c.remoteNode.Protocol, c.opts) - if err != nil { - return nil, errors.Wrap(err, "could not create Object V2 client") - } - callOpts := c.defaultCallOptions() for i := range opts { if opts[i] != nil { - opts[i].apply(&callOpts) + opts[i](callOpts) } } @@ -904,11 +839,12 @@ func (c *clientImpl) objectPayloadRangeV2(ctx context.Context, p *RangeDataParam // set meta header meta := v2MetaHeaderFromOpts(callOpts) - if err = c.attachV2SessionToken(callOpts, meta, v2SessionReqInfo{ + + if err := c.attachV2SessionToken(callOpts, meta, v2SessionReqInfo{ addr: p.addr.ToV2(), verb: v2session.ObjectVerbRange, }); err != nil { - return nil, errors.Wrap(err, "could not sign session token") + return nil, errors.Wrap(err, "could not attach session token") } req.SetMetaHeader(meta) @@ -920,11 +856,11 @@ func (c *clientImpl) objectPayloadRangeV2(ctx context.Context, p *RangeDataParam // sign the request if err := signature.SignServiceMessage(callOpts.key, req); err != nil { - return nil, errors.Wrapf(err, "could not sign %T", req) + return nil, errors.Wrapf(err, "signing the request failed") } - // create Get payload range stream - stream, err := cli.GetRange(ctx, req) + // open stream + stream, err := rpcapi.GetObjectRange(c.Raw(), req, client.WithContext(ctx)) if err != nil { return nil, errors.Wrap(err, "could not create Get payload range stream") } @@ -934,15 +870,17 @@ func (c *clientImpl) objectPayloadRangeV2(ctx context.Context, p *RangeDataParam payload = make([]byte, p.r.GetLength()) } + resp := new(v2object.GetRangeResponse) + for { // receive message from server stream - resp, err := stream.Recv() + err := stream.Read(resp) if err != nil { if errors.Is(errors.Cause(err), io.EOF) { break } - return nil, errors.Wrap(err, "could not receive Get payload range response") + return nil, errors.Wrap(err, "reading the response failed") } // verify response structure @@ -952,7 +890,7 @@ func (c *clientImpl) objectPayloadRangeV2(ctx context.Context, p *RangeDataParam switch v := resp.GetBody().GetRangePart().(type) { case nil: - return nil, errNilObjectPart + return nil, errors.Errorf("unexpected range type %T", v) case *v2object.GetRangePartChunk: if p.w != nil { if _, err = p.w.Write(v.GetChunk()); err != nil { @@ -965,8 +903,6 @@ func (c *clientImpl) objectPayloadRangeV2(ctx context.Context, p *RangeDataParam si := object.NewSplitInfoFromV2(v) return nil, object.NewSplitInfoError(si) - default: - panic(fmt.Sprintf("unexpected GetRange object type %T", v)) } } @@ -1048,27 +984,11 @@ func (c *clientImpl) ObjectPayloadRangeTZ(ctx context.Context, p *RangeChecksumP } func (c *clientImpl) objectPayloadRangeHash(ctx context.Context, p *RangeChecksumParams, opts ...CallOption) (interface{}, error) { - // check remote node version - switch c.remoteNode.Version.Major() { - case 2: - return c.objectPayloadRangeHashV2(ctx, p, opts...) - default: - return nil, errUnsupportedProtocol - } -} - -func (c *clientImpl) objectPayloadRangeHashV2(ctx context.Context, p *RangeChecksumParams, opts ...CallOption) (interface{}, error) { - // create V2 Object client - cli, err := v2ObjectClient(c.remoteNode.Protocol, c.opts) - if err != nil { - return nil, errors.Wrap(err, "could not create Object V2 client") - } - callOpts := c.defaultCallOptions() for i := range opts { if opts[i] != nil { - opts[i].apply(&callOpts) + opts[i](callOpts) } } @@ -1081,11 +1001,12 @@ func (c *clientImpl) objectPayloadRangeHashV2(ctx context.Context, p *RangeCheck // set meta header meta := v2MetaHeaderFromOpts(callOpts) - if err = c.attachV2SessionToken(callOpts, meta, v2SessionReqInfo{ + + if err := c.attachV2SessionToken(callOpts, meta, v2SessionReqInfo{ addr: p.addr.ToV2(), verb: v2session.ObjectVerbRangeHash, }); err != nil { - return nil, errors.Wrap(err, "could not sign session token") + return nil, errors.Wrap(err, "could not attach session token") } req.SetMetaHeader(meta) @@ -1102,18 +1023,18 @@ func (c *clientImpl) objectPayloadRangeHashV2(ctx context.Context, p *RangeCheck // sign the request if err := signature.SignServiceMessage(callOpts.key, req); err != nil { - return nil, errors.Wrapf(err, "could not sign %T", req) + return nil, errors.Wrapf(err, "signing the request failed") } // send request - resp, err := cli.GetRangeHash(ctx, req) + resp, err := rpcapi.HashObjectRange(c.Raw(), req, client.WithContext(ctx)) if err != nil { - return nil, errors.Wrapf(err, "could not send %T", req) + return nil, errors.Wrap(err, "sending the request failed") } // verify response structure if err := signature.VerifyServiceMessage(resp); err != nil { - return nil, errors.Wrapf(err, "could not verify %T", resp) + return nil, errors.Wrap(err, "response verification failed") } respBody := resp.GetBody() @@ -1197,27 +1118,11 @@ func (p *SearchObjectParams) SearchFilters() object.SearchFilters { } func (c *clientImpl) SearchObject(ctx context.Context, p *SearchObjectParams, opts ...CallOption) ([]*object.ID, error) { - // check remote node version - switch c.remoteNode.Version.Major() { - case 2: - return c.searchObjectV2(ctx, p, opts...) - default: - return nil, errUnsupportedProtocol - } -} - -func (c *clientImpl) searchObjectV2(ctx context.Context, p *SearchObjectParams, opts ...CallOption) ([]*object.ID, error) { - // create V2 Object client - cli, err := v2ObjectClient(c.remoteNode.Protocol, c.opts) - if err != nil { - return nil, errors.Wrap(err, "could not create Object V2 client") - } - callOpts := c.defaultCallOptions() for i := range opts { if opts[i] != nil { - opts[i].apply(&callOpts) + opts[i](callOpts) } } @@ -1233,11 +1138,12 @@ func (c *clientImpl) searchObjectV2(ctx context.Context, p *SearchObjectParams, // set meta header meta := v2MetaHeaderFromOpts(callOpts) - if err = c.attachV2SessionToken(callOpts, meta, v2SessionReqInfo{ + + if err := c.attachV2SessionToken(callOpts, meta, v2SessionReqInfo{ addr: v2Addr, verb: v2session.ObjectVerbSearch, }); err != nil { - return nil, errors.Wrap(err, "could not sign session token") + return nil, errors.Wrap(err, "could not attach session token") } req.SetMetaHeader(meta) @@ -1249,26 +1155,29 @@ func (c *clientImpl) searchObjectV2(ctx context.Context, p *SearchObjectParams, // sign the request if err := signature.SignServiceMessage(callOpts.key, req); err != nil { - return nil, errors.Wrapf(err, "could not sign %T", req) + return nil, errors.Wrapf(err, "signing the request failed") } // create search stream - stream, err := cli.Search(ctx, req) + stream, err := rpcapi.SearchObjects(c.Raw(), req, client.WithContext(ctx)) if err != nil { - return nil, errors.Wrap(err, "could not create search stream") + return nil, errors.Wrap(err, "stream opening failed") } - var searchResult []*object.ID + var ( + searchResult []*object.ID + resp = new(v2object.SearchResponse) + ) for { // receive message from server stream - resp, err := stream.Recv() + err := stream.Read(resp) if err != nil { if errors.Is(errors.Cause(err), io.EOF) { break } - return nil, errors.Wrap(err, "could not receive search response") + return nil, errors.Wrap(err, "reading the response failed") } // verify response structure @@ -1285,39 +1194,7 @@ func (c *clientImpl) searchObjectV2(ctx context.Context, p *SearchObjectParams, return searchResult, nil } -func v2ObjectClient(proto TransportProtocol, opts *clientOptions) (*v2object.Client, error) { - switch proto { - case GRPC: - var err error - - if opts.grpcOpts.objectClientV2 == nil { - var optsV2 []v2object.Option - - if opts.grpcOpts.conn != nil { - optsV2 = []v2object.Option{ - v2object.WithGlobalOpts( - client.WithGRPCConn(opts.grpcOpts.conn), - ), - } - } else { - optsV2 = []v2object.Option{ - v2object.WithGlobalOpts( - client.WithNetworkAddress(opts.addr), - client.WithDialTimeout(opts.dialTimeout), - ), - } - } - - opts.grpcOpts.objectClientV2, err = v2object.NewClient(optsV2...) - } - - return opts.grpcOpts.objectClientV2, err - default: - return nil, errUnsupportedProtocol - } -} - -func (c clientImpl) attachV2SessionToken(opts callOptions, hdr *v2session.RequestMetaHeader, info v2SessionReqInfo) error { +func (c *clientImpl) attachV2SessionToken(opts *callOptions, hdr *v2session.RequestMetaHeader, info v2SessionReqInfo) error { if opts.session == nil { return nil } diff --git a/pkg/client/opts.go b/pkg/client/opts.go index 9f16888..9825d49 100644 --- a/pkg/client/opts.go +++ b/pkg/client/opts.go @@ -2,29 +2,20 @@ package client import ( "crypto/ecdsa" - "fmt" "time" "github.com/nspcc-dev/neofs-api-go/pkg" - "github.com/nspcc-dev/neofs-api-go/pkg/owner" "github.com/nspcc-dev/neofs-api-go/pkg/token" - v2accounting "github.com/nspcc-dev/neofs-api-go/v2/accounting" - v2container "github.com/nspcc-dev/neofs-api-go/v2/container" - v2netmap "github.com/nspcc-dev/neofs-api-go/v2/netmap" - v2object "github.com/nspcc-dev/neofs-api-go/v2/object" + "github.com/nspcc-dev/neofs-api-go/rpc/client" "github.com/nspcc-dev/neofs-api-go/v2/refs" v2session "github.com/nspcc-dev/neofs-api-go/v2/session" "google.golang.org/grpc" ) type ( - CallOption interface { - apply(*callOptions) - } + CallOption func(*callOptions) - Option interface { - apply(*clientOptions) - } + Option func(*clientOptions) callOptions struct { version *pkg.Version @@ -37,21 +28,9 @@ type ( } clientOptions struct { - addr string + key *ecdsa.PrivateKey - dialTimeout time.Duration - - grpcOpts *grpcOptions - } - - grpcOptions struct { - conn *grpc.ClientConn - v2ContainerClient *v2container.Client - v2AccountingClient *v2accounting.Client - v2SessionClient *v2session.Client - v2NetmapClient *v2netmap.Client - - objectClientV2 *v2object.Client + rawOpts []client.Option } v2SessionReqInfo struct { @@ -62,74 +41,52 @@ type ( } ) -type errOptionsLack string - -func (e errOptionsLack) Error() string { - return fmt.Sprintf("lack of sdk client options to create %s client", string(e)) -} - -func (c clientImpl) defaultCallOptions() callOptions { - return callOptions{ - ttl: 2, +func (c *clientImpl) defaultCallOptions() *callOptions { + return &callOptions{ version: pkg.SDKVersion(), - key: c.key, - session: c.sessionToken, - bearer: c.bearerToken, - } -} - -type funcCallOption struct { - f func(*callOptions) -} - -func (fco *funcCallOption) apply(co *callOptions) { - fco.f(co) -} - -func newFuncCallOption(f func(option *callOptions)) *funcCallOption { - return &funcCallOption{ - f: f, + ttl: 2, + key: c.opts.key, } } func WithXHeader(x *pkg.XHeader) CallOption { - return newFuncCallOption(func(option *callOptions) { - option.xHeaders = append(option.xHeaders, x) - }) + return func(opts *callOptions) { + opts.xHeaders = append(opts.xHeaders, x) + } } func WithTTL(ttl uint32) CallOption { - return newFuncCallOption(func(option *callOptions) { - option.ttl = ttl - }) + return func(opts *callOptions) { + opts.ttl = ttl + } } // WithKey sets client's key for the next request. func WithKey(key *ecdsa.PrivateKey) CallOption { - return newFuncCallOption(func(option *callOptions) { - option.key = key - }) + return func(opts *callOptions) { + opts.key = key + } } func WithEpoch(epoch uint64) CallOption { - return newFuncCallOption(func(option *callOptions) { - option.epoch = epoch - }) + return func(opts *callOptions) { + opts.epoch = epoch + } } func WithSession(token *token.SessionToken) CallOption { - return newFuncCallOption(func(option *callOptions) { - option.session = token - }) + return func(opts *callOptions) { + opts.session = token + } } func WithBearer(token *token.BearerToken) CallOption { - return newFuncCallOption(func(option *callOptions) { - option.bearer = token - }) + return func(opts *callOptions) { + opts.bearer = token + } } -func v2MetaHeaderFromOpts(options callOptions) *v2session.RequestMetaHeader { +func v2MetaHeaderFromOpts(options *callOptions) *v2session.RequestMetaHeader { meta := new(v2session.RequestMetaHeader) meta.SetVersion(options.version.ToV2()) meta.SetTTL(options.ttl) @@ -153,50 +110,33 @@ func v2MetaHeaderFromOpts(options callOptions) *v2session.RequestMetaHeader { func defaultClientOptions() *clientOptions { return &clientOptions{ - grpcOpts: new(grpcOptions), - } -} - -type funcClientOption struct { - f func(*clientOptions) -} - -func (fco *funcClientOption) apply(co *clientOptions) { - fco.f(co) -} - -func newFuncClientOption(f func(option *clientOptions)) *funcClientOption { - return &funcClientOption{ - f: f, + rawOpts: make([]client.Option, 0, 3), } } func WithAddress(addr string) Option { - return newFuncClientOption(func(option *clientOptions) { - option.addr = addr - }) + return func(opts *clientOptions) { + opts.rawOpts = append(opts.rawOpts, client.WithNetworkAddress(addr)) + } } func WithGRPCConnection(grpcConn *grpc.ClientConn) Option { - return newFuncClientOption(func(option *clientOptions) { - option.grpcOpts.conn = grpcConn - }) + return func(opts *clientOptions) { + opts.rawOpts = append(opts.rawOpts, client.WithGRPCConn(grpcConn)) + } } // WithDialTimeout returns option to set connection timeout to the remote node. func WithDialTimeout(dur time.Duration) Option { - return newFuncClientOption(func(option *clientOptions) { - option.dialTimeout = dur - }) -} - -func newOwnerIDFromKey(key *ecdsa.PublicKey) (*owner.ID, error) { - w, err := owner.NEO3WalletFromPublicKey(key) - if err != nil { - return nil, err + return func(opts *clientOptions) { + opts.rawOpts = append(opts.rawOpts, client.WithDialTimeout(dur)) + } +} + +// WithDefaultPrivateKey returns option to set default private key +// used for the work. +func WithDefaultPrivateKey(key *ecdsa.PrivateKey) Option { + return func(opts *clientOptions) { + opts.key = key } - - ownerID := new(owner.ID) - ownerID.SetNeo3Wallet(w) - return ownerID, nil } diff --git a/pkg/client/raw.go b/pkg/client/raw.go new file mode 100644 index 0000000..a8fce33 --- /dev/null +++ b/pkg/client/raw.go @@ -0,0 +1,14 @@ +package client + +import ( + "github.com/nspcc-dev/neofs-api-go/rpc/client" +) + +// Raw returns underlying raw protobuf client. +func (c *clientImpl) Raw() *client.Client { + c.onceInit.Do(func() { + c.raw = client.New(c.opts.rawOpts...) + }) + + return c.raw +} diff --git a/pkg/client/session.go b/pkg/client/session.go index 4df7263..b7afa03 100644 --- a/pkg/client/session.go +++ b/pkg/client/session.go @@ -5,7 +5,8 @@ import ( "github.com/nspcc-dev/neofs-api-go/pkg/owner" "github.com/nspcc-dev/neofs-api-go/pkg/token" - "github.com/nspcc-dev/neofs-api-go/v2/client" + "github.com/nspcc-dev/neofs-api-go/rpc/client" + rpcapi "github.com/nspcc-dev/neofs-api-go/v2/rpc" v2session "github.com/nspcc-dev/neofs-api-go/v2/session" v2signature "github.com/nspcc-dev/neofs-api-go/v2/signature" "github.com/pkg/errors" @@ -15,29 +16,16 @@ import ( type Session interface { // CreateSession creates session using provided expiration time. CreateSession(context.Context, uint64, ...CallOption) (*token.SessionToken, error) - // AttachSessionToken attaches session token to be used by default for following requests. - AttachSessionToken(*token.SessionToken) - // AttachBearerToken attaches bearer token to be used by default for following requests. - AttachBearerToken(*token.BearerToken) } var errMalformedResponseBody = errors.New("malformed response body") -func (c clientImpl) CreateSession(ctx context.Context, expiration uint64, opts ...CallOption) (*token.SessionToken, error) { - switch c.remoteNode.Version.Major() { - case 2: - return c.createSessionV2(ctx, expiration, opts...) - default: - return nil, errUnsupportedProtocol - } -} - -func (c clientImpl) createSessionV2(ctx context.Context, expiration uint64, opts ...CallOption) (*token.SessionToken, error) { +func (c *clientImpl) CreateSession(ctx context.Context, expiration uint64, opts ...CallOption) (*token.SessionToken, error) { // apply all available options callOptions := c.defaultCallOptions() for i := range opts { - opts[i].apply(&callOptions) + opts[i](callOptions) } w, err := owner.NEO3WalletFromPublicKey(&callOptions.key.PublicKey) @@ -61,82 +49,25 @@ func (c clientImpl) createSessionV2(ctx context.Context, expiration uint64, opts return nil, err } - switch c.remoteNode.Protocol { - case GRPC: - cli, err := v2SessionClientFromOptions(c.opts) - if err != nil { - return nil, errors.Wrap(err, "can't create grpc client") - } - - resp, err := cli.Create(ctx, req) - if err != nil { - return nil, errors.Wrap(err, "transport error") - } - - err = v2signature.VerifyServiceMessage(resp) - if err != nil { - return nil, errors.Wrap(err, "can't verify response message") - } - - body := resp.GetBody() - if body == nil { - return nil, errMalformedResponseBody - } - - sessionToken := token.NewSessionToken() - sessionToken.SetID(body.GetID()) - sessionToken.SetSessionKey(body.GetSessionKey()) - sessionToken.SetOwnerID(ownerID) - - return sessionToken, nil - default: - return nil, errUnsupportedProtocol - } -} - -func v2SessionClientFromOptions(opts *clientOptions) (cli *v2session.Client, err error) { - switch { - case opts.grpcOpts.v2SessionClient != nil: - // return value from client cache - return opts.grpcOpts.v2SessionClient, nil - - case opts.grpcOpts.conn != nil: - cli, err = v2session.NewClient(v2session.WithGlobalOpts( - client.WithGRPCConn(opts.grpcOpts.conn)), - ) - - case opts.addr != "": - cli, err = v2session.NewClient(v2session.WithGlobalOpts( - client.WithNetworkAddress(opts.addr), - client.WithDialTimeout(opts.dialTimeout), - )) - - default: - return nil, errOptionsLack("Session") - } - - // check if client correct and save in cache + resp, err := rpcapi.CreateSession(c.Raw(), req, client.WithContext(ctx)) if err != nil { - return nil, err + return nil, errors.Wrap(err, "transport error") } - opts.grpcOpts.v2SessionClient = cli + err = v2signature.VerifyServiceMessage(resp) + if err != nil { + return nil, errors.Wrap(err, "can't verify response message") + } - return cli, nil -} + body := resp.GetBody() + if body == nil { + return nil, errMalformedResponseBody + } -// AttachSessionToken attaches session token to client. -// -// Provided token is attached to all requests without WithSession option. -// Use WithSession(nil) option in order to send request without session token. -func (c *clientImpl) AttachSessionToken(token *token.SessionToken) { - c.sessionToken = token -} + sessionToken := token.NewSessionToken() + sessionToken.SetID(body.GetID()) + sessionToken.SetSessionKey(body.GetSessionKey()) + sessionToken.SetOwnerID(ownerID) -// AttachBearerToken attaches bearer token to client. -// -// Provided bearer is attached to all requests without WithBearer option. -// Use WithBearer(nil) option in order to send request without bearer token. -func (c *clientImpl) AttachBearerToken(token *token.BearerToken) { - c.bearerToken = token + return sessionToken, nil } From a43175e2eacb409bfcd4adc482b1807268a58211 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 17 Mar 2021 13:59:45 +0300 Subject: [PATCH 0699/1196] [#263] pkg/client: Split interface method's declarations with linebreaks Signed-off-by: Leonard Lyubich --- pkg/client/container.go | 6 ++++++ pkg/client/netmap.go | 1 + pkg/client/object.go | 7 +++++++ 3 files changed, 14 insertions(+) diff --git a/pkg/client/container.go b/pkg/client/container.go index 757fb46..3430003 100644 --- a/pkg/client/container.go +++ b/pkg/client/container.go @@ -20,16 +20,22 @@ import ( type Container interface { // PutContainer creates new container in the NeoFS network. PutContainer(context.Context, *container.Container, ...CallOption) (*container.ID, error) + // GetContainer returns container by ID. GetContainer(context.Context, *container.ID, ...CallOption) (*container.Container, error) + // ListContainers return container list with the provided owner. ListContainers(context.Context, *owner.ID, ...CallOption) ([]*container.ID, error) + // DeleteContainer removes container from NeoFS network. DeleteContainer(context.Context, *container.ID, ...CallOption) error + // GetEACL returns extended ACL for a given container. GetEACL(context.Context, *container.ID, ...CallOption) (*EACLWithSignature, error) + // SetEACL sets extended ACL. SetEACL(context.Context, *eacl.Table, ...CallOption) error + // AnnounceContainerUsedSpace announces amount of space which is taken by stored objects. AnnounceContainerUsedSpace(context.Context, []container.UsedSpaceAnnouncement, ...CallOption) error } diff --git a/pkg/client/netmap.go b/pkg/client/netmap.go index 057b0c3..7ab3081 100644 --- a/pkg/client/netmap.go +++ b/pkg/client/netmap.go @@ -18,6 +18,7 @@ type Netmap interface { // in client constructor via address or open connection. This can be used as a // health check to see if node is alive and responses to requests. EndpointInfo(context.Context, ...CallOption) (*EndpointInfo, error) + // NetworkInfo returns information about the NeoFS network of which the remote server is a part. NetworkInfo(context.Context, ...CallOption) (*netmap.NetworkInfo, error) } diff --git a/pkg/client/object.go b/pkg/client/object.go index b242422..d970a20 100644 --- a/pkg/client/object.go +++ b/pkg/client/object.go @@ -24,18 +24,25 @@ import ( type Object interface { // PutObject puts new object to NeoFS. PutObject(context.Context, *PutObjectParams, ...CallOption) (*object.ID, error) + // DeleteObject deletes object to NeoFS. DeleteObject(context.Context, *DeleteObjectParams, ...CallOption) error + // GetObject returns object stored in NeoFS. GetObject(context.Context, *GetObjectParams, ...CallOption) (*object.Object, error) + // GetObjectHeader returns object header. GetObjectHeader(context.Context, *ObjectHeaderParams, ...CallOption) (*object.Object, error) + // ObjectPayloadRangeData returns range of object payload. ObjectPayloadRangeData(context.Context, *RangeDataParams, ...CallOption) ([]byte, error) + // ObjectPayloadRangeSHA256 returns sha-256 hashes of object sub-ranges from NeoFS. ObjectPayloadRangeSHA256(context.Context, *RangeChecksumParams, ...CallOption) ([][sha256.Size]byte, error) + // ObjectPayloadRangeTZ returns homomorphic hashes of object sub-ranges from NeoFS. ObjectPayloadRangeTZ(context.Context, *RangeChecksumParams, ...CallOption) ([][TZSize]byte, error) + // SearchObject searches for objects in NeoFS using provided parameters. SearchObject(context.Context, *SearchObjectParams, ...CallOption) ([]*object.ID, error) } From 7cb9b8f283c20746cfe1ebd8c64a3805040bd1f8 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 17 Mar 2021 14:16:22 +0300 Subject: [PATCH 0700/1196] [#267] pkg/client: Extend Client interface with Raw method Add `Client.Raw` method which returns underlying raw protobuf client. Signed-off-by: Leonard Lyubich --- pkg/client/client.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg/client/client.go b/pkg/client/client.go index 99d1e59..1db894b 100644 --- a/pkg/client/client.go +++ b/pkg/client/client.go @@ -13,6 +13,9 @@ type Client interface { Netmap Object Session + + // Raw must return underlying raw protobuf client. + Raw() *client.Client } type clientImpl struct { From 2fcb6d961335a7fd9676b3dad5e6f56bdf00f43a Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 17 Mar 2021 14:20:04 +0300 Subject: [PATCH 0701/1196] [#267] pkg: Fix IsSupportedVersion implementation Current API library supports versions up to 2.4.x. Signed-off-by: Leonard Lyubich --- pkg/version.go | 17 ++++++----------- pkg/version_test.go | 4 ++-- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/pkg/version.go b/pkg/version.go index 0c64956..424dde9 100644 --- a/pkg/version.go +++ b/pkg/version.go @@ -10,7 +10,7 @@ import ( // Version represents v2-compatible version. type Version refs.Version -const sdkMjr, sdkMnr = 2, 1 +const sdkMjr, sdkMnr = 2, 4 // NewVersionFromV2 wraps v2 Version message to Version. func NewVersionFromV2(v *refs.Version) *Version { @@ -69,18 +69,13 @@ func (v *Version) String() string { // IsSupportedVersion returns error if v is not supported by current SDK. func IsSupportedVersion(v *Version) error { - switch mjr := v.Major(); mjr { - case 2: - switch mnr := v.Minor(); mnr { - case 0, 1: - return nil - } + mjr, mnr := v.Major(), v.Minor() + + if mjr != 2 || mnr > sdkMnr { + return errors.Errorf("unsupported version %d.%d", mjr, mnr) } - return errors.Errorf("unsupported version %d.%d", - v.Major(), - v.Minor(), - ) + return nil } // Marshal marshals Version into a protobuf binary form. diff --git a/pkg/version_test.go b/pkg/version_test.go index fe7f661..2f5ee28 100644 --- a/pkg/version_test.go +++ b/pkg/version_test.go @@ -46,12 +46,12 @@ func TestIsSupportedVersion(t *testing.T) { }{ { mjr: 2, - maxMnr: 1, + maxMnr: sdkMnr, }, } { v.SetMajor(item.mjr) - for i := uint32(0); i < item.maxMnr; i++ { + for i := uint32(0); i <= item.maxMnr; i++ { v.SetMinor(i) require.NoError(t, IsSupportedVersion(v)) From 21bd2fb0d3d71ee69564d2fb062465d4c605bc9d Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Mon, 22 Mar 2021 10:05:16 +0300 Subject: [PATCH 0702/1196] Update changelog and readme for v1.25.0 release Signed-off-by: Alex Vanin --- CHANGELOG.md | 17 +++++++++++++++++ README.md | 1 + 2 files changed, 18 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 70972b1..20ef93d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,21 @@ # Changelog +## [1.25.0] - 2021-03-22 - Jebudo (제부도, 濟扶島) + +Raw client and support of NeoFS API v2.5.0 "Jebudo" release. + +### Added + +- Raw client for peer to peer communication. +- `client.WithKey` option to sign messages with different keys within single + client. +- `Content-Type` well-known object attribute constant. + +### Changed + +- Refactored `v2` sub-packages to support single raw client in all RPC methods. +- Client constructor returns `Client` interface instead of structure. + ## [1.24.0] - 2021-02-26 - Ganghwado (강화도, 江華島) Support changes from NeoFS API v2.4.0 "Ganghwado" release. @@ -568,3 +584,4 @@ Initial public release [1.22.2]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.22.1...v1.22.2 [1.23.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.22.2...v1.23.0 [1.24.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.23.0...v1.24.0 +[1.25.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.24.0...v1.25.0 diff --git a/README.md b/README.md index fd1c1c7..685f73d 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,7 @@ versions and SDK layer working with all of them in a handy way. |v1.22.x|[v2.2.0](https://github.com/nspcc-dev/neofs-api/releases/tag/v2.2.0)| |v1.23.x|[v2.3.0](https://github.com/nspcc-dev/neofs-api/releases/tag/v2.3.0)| |v1.24.x|[v2.4.0](https://github.com/nspcc-dev/neofs-api/releases/tag/v2.4.0)| +|v1.25.x|[v2.5.0](https://github.com/nspcc-dev/neofs-api/releases/tag/v2.5.0)| ## Contributing From 1039cd6963571fc642816d4e99478889e8acee1e Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 24 Mar 2021 08:31:46 +0300 Subject: [PATCH 0703/1196] [#265] reputation: Compile protobuf files Signed-off-by: Leonard Lyubich --- v2/reputation/grpc/service.pb.go | 534 +++++++++++++++++++++++++++++++ v2/reputation/grpc/types.pb.go | 169 ++++++++++ 2 files changed, 703 insertions(+) create mode 100644 v2/reputation/grpc/service.pb.go create mode 100644 v2/reputation/grpc/types.pb.go diff --git a/v2/reputation/grpc/service.pb.go b/v2/reputation/grpc/service.pb.go new file mode 100644 index 0000000..daced20 --- /dev/null +++ b/v2/reputation/grpc/service.pb.go @@ -0,0 +1,534 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.23.0 +// protoc v3.14.0 +// source: v2/reputation/grpc/service.proto + +package reputation + +import ( + context "context" + proto "github.com/golang/protobuf/proto" + grpc "github.com/nspcc-dev/neofs-api-go/v2/session/grpc" + grpc1 "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// This is a compile-time assertion that a sufficiently up-to-date version +// of the legacy proto package is being used. +const _ = proto.ProtoPackageIsVersion4 + +// Request to send local trust. +type SendLocalTrustRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Body of the request message. + Body *SendLocalTrustRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" 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,proto3" json:"verify_header,omitempty"` +} + +func (x *SendLocalTrustRequest) Reset() { + *x = SendLocalTrustRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_reputation_grpc_service_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SendLocalTrustRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SendLocalTrustRequest) ProtoMessage() {} + +func (x *SendLocalTrustRequest) ProtoReflect() protoreflect.Message { + mi := &file_v2_reputation_grpc_service_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SendLocalTrustRequest.ProtoReflect.Descriptor instead. +func (*SendLocalTrustRequest) Descriptor() ([]byte, []int) { + return file_v2_reputation_grpc_service_proto_rawDescGZIP(), []int{0} +} + +func (x *SendLocalTrustRequest) GetBody() *SendLocalTrustRequest_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *SendLocalTrustRequest) GetMetaHeader() *grpc.RequestMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} + +func (x *SendLocalTrustRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} + +// Response to request to send local trust. +type SendLocalTrustResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Body of the response message. + Body *SendLocalTrustResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" 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,proto3" json:"verify_header,omitempty"` +} + +func (x *SendLocalTrustResponse) Reset() { + *x = SendLocalTrustResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_reputation_grpc_service_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SendLocalTrustResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SendLocalTrustResponse) ProtoMessage() {} + +func (x *SendLocalTrustResponse) ProtoReflect() protoreflect.Message { + mi := &file_v2_reputation_grpc_service_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SendLocalTrustResponse.ProtoReflect.Descriptor instead. +func (*SendLocalTrustResponse) Descriptor() ([]byte, []int) { + return file_v2_reputation_grpc_service_proto_rawDescGZIP(), []int{1} +} + +func (x *SendLocalTrustResponse) GetBody() *SendLocalTrustResponse_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *SendLocalTrustResponse) GetMetaHeader() *grpc.ResponseMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} + +func (x *SendLocalTrustResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} + +// Request body structure. +type SendLocalTrustRequest_Body struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The number of the epoch in which the trust was assessed. + Epoch uint64 `protobuf:"varint,1,opt,name=epoch,proto3" json:"epoch,omitempty"` + // List of normalized local trust values of the client to the NeoFS peers. + // The value is calculated according to EigenTrust++ algorithm + // and must be in the range [0;1]. + Trusts []*Trust `protobuf:"bytes,2,rep,name=trusts,proto3" json:"trusts,omitempty"` +} + +func (x *SendLocalTrustRequest_Body) Reset() { + *x = SendLocalTrustRequest_Body{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_reputation_grpc_service_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SendLocalTrustRequest_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SendLocalTrustRequest_Body) ProtoMessage() {} + +func (x *SendLocalTrustRequest_Body) ProtoReflect() protoreflect.Message { + mi := &file_v2_reputation_grpc_service_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SendLocalTrustRequest_Body.ProtoReflect.Descriptor instead. +func (*SendLocalTrustRequest_Body) Descriptor() ([]byte, []int) { + return file_v2_reputation_grpc_service_proto_rawDescGZIP(), []int{0, 0} +} + +func (x *SendLocalTrustRequest_Body) GetEpoch() uint64 { + if x != nil { + return x.Epoch + } + return 0 +} + +func (x *SendLocalTrustRequest_Body) GetTrusts() []*Trust { + if x != nil { + return x.Trusts + } + return nil +} + +// Response body structure. +type SendLocalTrustResponse_Body struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *SendLocalTrustResponse_Body) Reset() { + *x = SendLocalTrustResponse_Body{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_reputation_grpc_service_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SendLocalTrustResponse_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SendLocalTrustResponse_Body) ProtoMessage() {} + +func (x *SendLocalTrustResponse_Body) ProtoReflect() protoreflect.Message { + mi := &file_v2_reputation_grpc_service_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SendLocalTrustResponse_Body.ProtoReflect.Descriptor instead. +func (*SendLocalTrustResponse_Body) Descriptor() ([]byte, []int) { + return file_v2_reputation_grpc_service_proto_rawDescGZIP(), []int{1, 0} +} + +var File_v2_reputation_grpc_service_proto protoreflect.FileDescriptor + +var file_v2_reputation_grpc_service_proto_rawDesc = []byte{ + 0x0a, 0x20, 0x76, 0x32, 0x2f, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 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, 0x72, 0x65, + 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0x1e, 0x76, 0x32, 0x2f, 0x72, 0x65, 0x70, + 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, + 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x76, 0x32, 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, 0xca, 0x02, 0x0a, 0x15, 0x53, 0x65, 0x6e, 0x64, 0x4c, 0x6f, + 0x63, 0x61, 0x6c, 0x54, 0x72, 0x75, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x44, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x30, 0x2e, + 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x54, 0x72, + 0x75, 0x73, 0x74, 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, + 0x51, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x12, 0x33, 0x0a, + 0x06, 0x74, 0x72, 0x75, 0x73, 0x74, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, + 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x54, 0x72, 0x75, 0x73, 0x74, 0x52, 0x06, 0x74, 0x72, 0x75, 0x73, + 0x74, 0x73, 0x22, 0x83, 0x02, 0x0a, 0x16, 0x53, 0x65, 0x6e, 0x64, 0x4c, 0x6f, 0x63, 0x61, 0x6c, + 0x54, 0x72, 0x75, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x45, 0x0a, + 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x31, 0x2e, 0x6e, 0x65, + 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x54, 0x72, 0x75, 0x73, + 0x74, 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, 0x06, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x32, 0x80, 0x01, 0x0a, 0x11, 0x52, 0x65, 0x70, + 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x6b, + 0x0a, 0x0e, 0x53, 0x65, 0x6e, 0x64, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x54, 0x72, 0x75, 0x73, 0x74, + 0x12, 0x2b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, + 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x4c, 0x6f, 0x63, 0x61, + 0x6c, 0x54, 0x72, 0x75, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2c, 0x2e, + 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x54, 0x72, + 0x75, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x62, 0x5a, 0x3f, 0x67, + 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, + 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, + 0x2f, 0x76, 0x32, 0x2f, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x67, + 0x72, 0x70, 0x63, 0x3b, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xaa, 0x02, + 0x1e, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, + 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x52, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_v2_reputation_grpc_service_proto_rawDescOnce sync.Once + file_v2_reputation_grpc_service_proto_rawDescData = file_v2_reputation_grpc_service_proto_rawDesc +) + +func file_v2_reputation_grpc_service_proto_rawDescGZIP() []byte { + file_v2_reputation_grpc_service_proto_rawDescOnce.Do(func() { + file_v2_reputation_grpc_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_v2_reputation_grpc_service_proto_rawDescData) + }) + return file_v2_reputation_grpc_service_proto_rawDescData +} + +var file_v2_reputation_grpc_service_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_v2_reputation_grpc_service_proto_goTypes = []interface{}{ + (*SendLocalTrustRequest)(nil), // 0: neo.fs.v2.reputation.SendLocalTrustRequest + (*SendLocalTrustResponse)(nil), // 1: neo.fs.v2.reputation.SendLocalTrustResponse + (*SendLocalTrustRequest_Body)(nil), // 2: neo.fs.v2.reputation.SendLocalTrustRequest.Body + (*SendLocalTrustResponse_Body)(nil), // 3: neo.fs.v2.reputation.SendLocalTrustResponse.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 + (*Trust)(nil), // 8: neo.fs.v2.reputation.Trust +} +var file_v2_reputation_grpc_service_proto_depIdxs = []int32{ + 2, // 0: neo.fs.v2.reputation.SendLocalTrustRequest.body:type_name -> neo.fs.v2.reputation.SendLocalTrustRequest.Body + 4, // 1: neo.fs.v2.reputation.SendLocalTrustRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader + 5, // 2: neo.fs.v2.reputation.SendLocalTrustRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader + 3, // 3: neo.fs.v2.reputation.SendLocalTrustResponse.body:type_name -> neo.fs.v2.reputation.SendLocalTrustResponse.Body + 6, // 4: neo.fs.v2.reputation.SendLocalTrustResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader + 7, // 5: neo.fs.v2.reputation.SendLocalTrustResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 8, // 6: neo.fs.v2.reputation.SendLocalTrustRequest.Body.trusts:type_name -> neo.fs.v2.reputation.Trust + 0, // 7: neo.fs.v2.reputation.ReputationService.SendLocalTrust:input_type -> neo.fs.v2.reputation.SendLocalTrustRequest + 1, // 8: neo.fs.v2.reputation.ReputationService.SendLocalTrust:output_type -> neo.fs.v2.reputation.SendLocalTrustResponse + 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_v2_reputation_grpc_service_proto_init() } +func file_v2_reputation_grpc_service_proto_init() { + if File_v2_reputation_grpc_service_proto != nil { + return + } + file_v2_reputation_grpc_types_proto_init() + if !protoimpl.UnsafeEnabled { + file_v2_reputation_grpc_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SendLocalTrustRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_reputation_grpc_service_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SendLocalTrustResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_reputation_grpc_service_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SendLocalTrustRequest_Body); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_reputation_grpc_service_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SendLocalTrustResponse_Body); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_v2_reputation_grpc_service_proto_rawDesc, + NumEnums: 0, + NumMessages: 4, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_v2_reputation_grpc_service_proto_goTypes, + DependencyIndexes: file_v2_reputation_grpc_service_proto_depIdxs, + MessageInfos: file_v2_reputation_grpc_service_proto_msgTypes, + }.Build() + File_v2_reputation_grpc_service_proto = out.File + file_v2_reputation_grpc_service_proto_rawDesc = nil + file_v2_reputation_grpc_service_proto_goTypes = nil + file_v2_reputation_grpc_service_proto_depIdxs = nil +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc1.ClientConnInterface + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc1.SupportPackageIsVersion6 + +// ReputationServiceClient is the client API for ReputationService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type ReputationServiceClient interface { + // Sends local client trust to any peer from NeoFS network. + SendLocalTrust(ctx context.Context, in *SendLocalTrustRequest, opts ...grpc1.CallOption) (*SendLocalTrustResponse, error) +} + +type reputationServiceClient struct { + cc grpc1.ClientConnInterface +} + +func NewReputationServiceClient(cc grpc1.ClientConnInterface) ReputationServiceClient { + return &reputationServiceClient{cc} +} + +func (c *reputationServiceClient) SendLocalTrust(ctx context.Context, in *SendLocalTrustRequest, opts ...grpc1.CallOption) (*SendLocalTrustResponse, error) { + out := new(SendLocalTrustResponse) + err := c.cc.Invoke(ctx, "/neo.fs.v2.reputation.ReputationService/SendLocalTrust", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// ReputationServiceServer is the server API for ReputationService service. +type ReputationServiceServer interface { + // Sends local client trust to any peer from NeoFS network. + SendLocalTrust(context.Context, *SendLocalTrustRequest) (*SendLocalTrustResponse, error) +} + +// UnimplementedReputationServiceServer can be embedded to have forward compatible implementations. +type UnimplementedReputationServiceServer struct { +} + +func (*UnimplementedReputationServiceServer) SendLocalTrust(context.Context, *SendLocalTrustRequest) (*SendLocalTrustResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SendLocalTrust not implemented") +} + +func RegisterReputationServiceServer(s *grpc1.Server, srv ReputationServiceServer) { + s.RegisterService(&_ReputationService_serviceDesc, srv) +} + +func _ReputationService_SendLocalTrust_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc1.UnaryServerInterceptor) (interface{}, error) { + in := new(SendLocalTrustRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ReputationServiceServer).SendLocalTrust(ctx, in) + } + info := &grpc1.UnaryServerInfo{ + Server: srv, + FullMethod: "/neo.fs.v2.reputation.ReputationService/SendLocalTrust", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ReputationServiceServer).SendLocalTrust(ctx, req.(*SendLocalTrustRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _ReputationService_serviceDesc = grpc1.ServiceDesc{ + ServiceName: "neo.fs.v2.reputation.ReputationService", + HandlerType: (*ReputationServiceServer)(nil), + Methods: []grpc1.MethodDesc{ + { + MethodName: "SendLocalTrust", + Handler: _ReputationService_SendLocalTrust_Handler, + }, + }, + Streams: []grpc1.StreamDesc{}, + Metadata: "v2/reputation/grpc/service.proto", +} diff --git a/v2/reputation/grpc/types.pb.go b/v2/reputation/grpc/types.pb.go new file mode 100644 index 0000000..6152ef0 --- /dev/null +++ b/v2/reputation/grpc/types.pb.go @@ -0,0 +1,169 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.23.0 +// protoc v3.14.0 +// source: v2/reputation/grpc/types.proto + +package reputation + +import ( + proto "github.com/golang/protobuf/proto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// This is a compile-time assertion that a sufficiently up-to-date version +// of the legacy proto package is being used. +const _ = proto.ProtoPackageIsVersion4 + +// Trust value to NeoFS network peer. +type Trust struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Identifier of the trusted peer. + // + // For storage nodes, it is the node's public key + // fixed in the network map. + Peer []byte `protobuf:"bytes,1,opt,name=peer,proto3" json:"peer,omitempty"` + // Trust value. + Value float64 `protobuf:"fixed64,2,opt,name=value,proto3" json:"value,omitempty"` +} + +func (x *Trust) Reset() { + *x = Trust{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_reputation_grpc_types_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Trust) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Trust) ProtoMessage() {} + +func (x *Trust) ProtoReflect() protoreflect.Message { + mi := &file_v2_reputation_grpc_types_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Trust.ProtoReflect.Descriptor instead. +func (*Trust) Descriptor() ([]byte, []int) { + return file_v2_reputation_grpc_types_proto_rawDescGZIP(), []int{0} +} + +func (x *Trust) GetPeer() []byte { + if x != nil { + return x.Peer + } + return nil +} + +func (x *Trust) GetValue() float64 { + if x != nil { + return x.Value + } + return 0 +} + +var File_v2_reputation_grpc_types_proto protoreflect.FileDescriptor + +var file_v2_reputation_grpc_types_proto_rawDesc = []byte{ + 0x0a, 0x1e, 0x76, 0x32, 0x2f, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 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, 0x72, 0x65, 0x70, 0x75, + 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x31, 0x0a, 0x05, 0x54, 0x72, 0x75, 0x73, 0x74, 0x12, + 0x12, 0x0a, 0x04, 0x70, 0x65, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x70, + 0x65, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x62, 0x5a, 0x3f, 0x67, 0x69, 0x74, + 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, + 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, + 0x32, 0x2f, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x67, 0x72, 0x70, + 0x63, 0x3b, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xaa, 0x02, 0x1e, 0x4e, + 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, + 0x50, 0x49, 0x2e, 0x52, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_v2_reputation_grpc_types_proto_rawDescOnce sync.Once + file_v2_reputation_grpc_types_proto_rawDescData = file_v2_reputation_grpc_types_proto_rawDesc +) + +func file_v2_reputation_grpc_types_proto_rawDescGZIP() []byte { + file_v2_reputation_grpc_types_proto_rawDescOnce.Do(func() { + file_v2_reputation_grpc_types_proto_rawDescData = protoimpl.X.CompressGZIP(file_v2_reputation_grpc_types_proto_rawDescData) + }) + return file_v2_reputation_grpc_types_proto_rawDescData +} + +var file_v2_reputation_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_v2_reputation_grpc_types_proto_goTypes = []interface{}{ + (*Trust)(nil), // 0: neo.fs.v2.reputation.Trust +} +var file_v2_reputation_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_v2_reputation_grpc_types_proto_init() } +func file_v2_reputation_grpc_types_proto_init() { + if File_v2_reputation_grpc_types_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_v2_reputation_grpc_types_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Trust); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_v2_reputation_grpc_types_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_v2_reputation_grpc_types_proto_goTypes, + DependencyIndexes: file_v2_reputation_grpc_types_proto_depIdxs, + MessageInfos: file_v2_reputation_grpc_types_proto_msgTypes, + }.Build() + File_v2_reputation_grpc_types_proto = out.File + file_v2_reputation_grpc_types_proto_rawDesc = nil + file_v2_reputation_grpc_types_proto_goTypes = nil + file_v2_reputation_grpc_types_proto_depIdxs = nil +} From 5b33eaec3678449c78211a46cda1057007b8a4bd Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 24 Mar 2021 08:42:20 +0300 Subject: [PATCH 0704/1196] [#265] reputation/grpc: Implement setters on generated messages Signed-off-by: Leonard Lyubich --- v2/reputation/grpc/service.go | 61 +++++++++++++++++++++++++++++++++++ v2/reputation/grpc/types.go | 15 +++++++++ 2 files changed, 76 insertions(+) create mode 100644 v2/reputation/grpc/service.go create mode 100644 v2/reputation/grpc/types.go diff --git a/v2/reputation/grpc/service.go b/v2/reputation/grpc/service.go new file mode 100644 index 0000000..80147df --- /dev/null +++ b/v2/reputation/grpc/service.go @@ -0,0 +1,61 @@ +package reputation + +import ( + session "github.com/nspcc-dev/neofs-api-go/v2/session/grpc" +) + +// SetEpoch sets epoch in which the trust was assessed. +func (x *SendLocalTrustRequest_Body) SetEpoch(v uint64) { + if x != nil { + x.Epoch = v + } +} + +// SetTrusts sets list of normalized trust values. +func (x *SendLocalTrustRequest_Body) SetTrusts(v []*Trust) { + if x != nil { + x.Trusts = v + } +} + +// SetBody sets body of the request. +func (x *SendLocalTrustRequest) SetBody(v *SendLocalTrustRequest_Body) { + if x != nil { + x.Body = v + } +} + +// SetMetaHeader sets meta header of the request. +func (x *SendLocalTrustRequest) SetMetaHeader(v *session.RequestMetaHeader) { + if x != nil { + x.MetaHeader = v + } +} + +// SetVerifyHeader sets verification header of the request. +func (x *SendLocalTrustRequest) SetVerifyHeader(v *session.RequestVerificationHeader) { + if x != nil { + x.VerifyHeader = v + } +} + +// SetBody sets body of the response. +func (x *SendLocalTrustResponse) SetBody(v *SendLocalTrustResponse_Body) { + if x != nil { + x.Body = v + } +} + +// SetMetaHeader sets meta header of the response. +func (x *SendLocalTrustResponse) SetMetaHeader(v *session.ResponseMetaHeader) { + if x != nil { + x.MetaHeader = v + } +} + +// SetVerifyHeader sets verification header of the response. +func (x *SendLocalTrustResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) { + if x != nil { + x.VerifyHeader = v + } +} diff --git a/v2/reputation/grpc/types.go b/v2/reputation/grpc/types.go new file mode 100644 index 0000000..84facde --- /dev/null +++ b/v2/reputation/grpc/types.go @@ -0,0 +1,15 @@ +package reputation + +// SetPeer sets trusted peer's ID. +func (x *Trust) SetPeer(v []byte) { + if x != nil { + x.Peer = v + } +} + +// SetValue sets trust value. +func (x *Trust) SetValue(v float64) { + if x != nil { + x.Value = v + } +} From 40505a523d7f31528ef34d2abd195177e906787a Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 24 Mar 2021 08:59:37 +0300 Subject: [PATCH 0705/1196] [#265] reputation: Define structures of protobuf messages Define Go structures of all messages from reputation package of NeoFs API. Implement getters and setters of message fields. Signed-off-by: Leonard Lyubich --- v2/reputation/types.go | 135 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 135 insertions(+) create mode 100644 v2/reputation/types.go diff --git a/v2/reputation/types.go b/v2/reputation/types.go new file mode 100644 index 0000000..12cb3de --- /dev/null +++ b/v2/reputation/types.go @@ -0,0 +1,135 @@ +package reputation + +import ( + "github.com/nspcc-dev/neofs-api-go/v2/session" +) + +// Trust represents reputation.Trust message +// from NeoFS API v2. +type Trust struct { + val float64 + + peer []byte +} + +// GetPeer returns trusted peer's ID. +func (x *Trust) GetPeer() []byte { + if x != nil { + return x.peer + } + + return nil +} + +// SetPeer sets trusted peer's ID. +func (x *Trust) SetPeer(v []byte) { + if x != nil { + x.peer = v + } +} + +// GetValue returns trust value. +func (x *Trust) GetValue() float64 { + if x != nil { + return x.val + } + + return 0 +} + +// SetValue sets trust value. +func (x *Trust) SetValue(v float64) { + if x != nil { + x.val = v + } +} + +// SendLocalTrustRequestBody is a structure of SendLocalTrust request body. +type SendLocalTrustRequestBody struct { + epoch uint64 + + trusts []*Trust +} + +// GetEpoch returns epoch in which the trust was assessed. +func (x *SendLocalTrustRequestBody) GetEpoch() uint64 { + if x != nil { + return x.epoch + } + + return 0 +} + +// SetEpoch sets epoch in which the trust was assessed. +func (x *SendLocalTrustRequestBody) SetEpoch(v uint64) { + if x != nil { + x.epoch = v + } +} + +// GetTrusts returns list of normalized trust values. +func (x *SendLocalTrustRequestBody) GetTrusts() []*Trust { + if x != nil { + return x.trusts + } + + return nil +} + +// SetTrusts sets list of normalized trust values. +func (x *SendLocalTrustRequestBody) SetTrusts(v []*Trust) { + if x != nil { + x.trusts = v + } +} + +// SendLocalTrustResponseBody is a structure of SendLocalTrust response body. +type SendLocalTrustResponseBody struct{} + +// SendLocalTrustRequest represents reputation.SendLocalTrustRequest +// message from NeoFS API v2. +type SendLocalTrustRequest struct { + body *SendLocalTrustRequestBody + + session.RequestHeaders +} + +// GetBody returns request body. +func (x *SendLocalTrustRequest) GetBody() *SendLocalTrustRequestBody { + if x != nil { + return x.body + } + + return nil +} + +// SetBody sets request body. +func (x *SendLocalTrustRequest) SetBody(v *SendLocalTrustRequestBody) { + if x != nil { + x.body = v + } +} + +// SendLocalTrustResponse represents reputation.SendLocalTrustResponse +// message from NeoFS API v2. +type SendLocalTrustResponse struct { + body *SendLocalTrustResponseBody + + session.ResponseHeaders +} + +// GetBody returns response body. +func (x *SendLocalTrustResponse) GetBody() *SendLocalTrustResponseBody { + if x != nil { + return x.body + } + + return nil +} + +// SetBody sets response body. +func (x *SendLocalTrustResponse) SetBody(v *SendLocalTrustResponseBody) { + if x != nil { + x.body = v + } +} From 101d14d40551c4bf11923d9bcb5feab9e51a647c Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 24 Mar 2021 09:04:26 +0300 Subject: [PATCH 0706/1196] [#265] reputation: Implement test package with message generators Signed-off-by: Leonard Lyubich --- v2/reputation/test/generate.go | 66 ++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 v2/reputation/test/generate.go diff --git a/v2/reputation/test/generate.go b/v2/reputation/test/generate.go new file mode 100644 index 0000000..9cbf328 --- /dev/null +++ b/v2/reputation/test/generate.go @@ -0,0 +1,66 @@ +package reputationtest + +import ( + "github.com/nspcc-dev/neofs-api-go/v2/reputation" + sessiontest "github.com/nspcc-dev/neofs-api-go/v2/session/test" +) + +func GenerateTrust(empty bool) *reputation.Trust { + m := new(reputation.Trust) + + if !empty { + m.SetPeer([]byte{1, 2, 3}) + m.SetValue(1) + } + + return m +} + +func GenerateTrusts(empty bool) (res []*reputation.Trust) { + if !empty { + res = append(res, + GenerateTrust(false), + GenerateTrust(false), + ) + } + + return +} + +func GenerateSendLocalTrustRequestBody(empty bool) *reputation.SendLocalTrustRequestBody { + m := new(reputation.SendLocalTrustRequestBody) + + if !empty { + m.SetEpoch(13) + } + + m.SetTrusts(GenerateTrusts(empty)) + + return m +} + +func GenerateSendLocalTrustRequest(empty bool) *reputation.SendLocalTrustRequest { + m := new(reputation.SendLocalTrustRequest) + + m.SetBody(GenerateSendLocalTrustRequestBody(empty)) + m.SetMetaHeader(sessiontest.GenerateRequestMetaHeader(empty)) + m.SetVerificationHeader(sessiontest.GenerateRequestVerificationHeader(empty)) + + return m +} + +func GenerateSendLocalTrustResponseBody(empty bool) *reputation.SendLocalTrustResponseBody { + m := new(reputation.SendLocalTrustResponseBody) + + return m +} + +func GenerateSendLocalTrustResponse(empty bool) *reputation.SendLocalTrustResponse { + m := new(reputation.SendLocalTrustResponse) + + m.SetBody(GenerateSendLocalTrustResponseBody(empty)) + m.SetMetaHeader(sessiontest.GenerateResponseMetaHeader(empty)) + m.SetVerificationHeader(sessiontest.GenerateResponseVerificationHeader(empty)) + + return m +} From 0cbb8d09135e39026e72a09872364ae22452e169 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 24 Mar 2021 10:10:30 +0300 Subject: [PATCH 0707/1196] [#265] proto: Implement functions for double (float64) protobuf data type Signed-off-by: Leonard Lyubich --- util/proto/marshal.go | 24 ++++++++++++++++++ util/proto/marshal_test.go | 40 ++++++++++++++++++++++++++++++ util/proto/test/test.pb.go | 51 ++++++++++++++++++++++---------------- util/proto/test/test.proto | 1 + 4 files changed, 95 insertions(+), 21 deletions(-) diff --git a/util/proto/marshal.go b/util/proto/marshal.go index 66824b3..a602b78 100644 --- a/util/proto/marshal.go +++ b/util/proto/marshal.go @@ -8,6 +8,7 @@ package proto import ( "encoding/binary" + "math" "math/bits" "reflect" ) @@ -360,3 +361,26 @@ func Fixed64Size(fNum int, v uint64) int { return VarUIntSize(uint64(prefix)) + 8 } + +func Float64Marshal(field int, buf []byte, v float64) (int, error) { + if v == 0 { + return 0, nil + } + + prefix := field<<3 | 1 + + i := binary.PutUvarint(buf, uint64(prefix)) + binary.LittleEndian.PutUint64(buf[i:], math.Float64bits(v)) + + return i + 8, nil +} + +func Float64Size(fNum int, v float64) int { + if v == 0 { + return 0 + } + + prefix := fNum<<3 | 1 + + return VarUIntSize(uint64(prefix)) + 8 +} diff --git a/util/proto/marshal_test.go b/util/proto/marshal_test.go index 6844309..34b5a44 100644 --- a/util/proto/marshal_test.go +++ b/util/proto/marshal_test.go @@ -23,6 +23,7 @@ type stablePrimitives struct { FieldG uint64 FieldH SomeEnum FieldI uint64 // fixed64 + FieldJ float64 } type stableRepPrimitives struct { @@ -133,6 +134,16 @@ func (s *stablePrimitives) stableMarshal(buf []byte, wrongField bool) ([]byte, e } i += offset + fieldNum = 206 + if wrongField { + fieldNum++ + } + offset, err = proto.Float64Marshal(fieldNum, buf, s.FieldJ) + if err != nil { + return nil, errors.Wrap(err, "can't marshal field J") + } + i += offset + fieldNum = 300 if wrongField { fieldNum++ @@ -155,6 +166,7 @@ func (s *stablePrimitives) stableSize() int { proto.Int64Size(203, s.FieldF) + proto.UInt64Size(204, s.FieldG) + proto.Fixed64Size(205, s.FieldI) + + proto.Float64Size(206, s.FieldJ) + proto.EnumSize(300, int32(s.FieldH)) } @@ -453,6 +465,19 @@ func TestFixed64Marshal(t *testing.T) { }) } +func TestFloat64Marshal(t *testing.T) { + t.Run("zero", func(t *testing.T) { + testFloat64Marshal(t, 0, false) + }) + + t.Run("non zero", func(t *testing.T) { + f := math.Float64frombits(12345677890) + + testFloat64Marshal(t, f, false) + testFloat64Marshal(t, f, true) + }) +} + func testMarshal(t *testing.T, c stablePrimitives, tr test.Primitives, wrongField bool) *test.Primitives { var ( wire []byte @@ -589,6 +614,21 @@ func testUInt64Marshal(t *testing.T, n uint64, wrongField bool) { } } +func testFloat64Marshal(t *testing.T, n float64, wrongField bool) { + var ( + custom = stablePrimitives{FieldJ: n} + transport = test.Primitives{FieldJ: n} + ) + + result := testMarshal(t, custom, transport, wrongField) + + if !wrongField { + require.Equal(t, n, result.FieldJ) + } else { + require.EqualValues(t, 0, result.FieldJ) + } +} + func testEnumMarshal(t *testing.T, e SomeEnum, wrongField bool) { var ( custom = stablePrimitives{FieldH: e} diff --git a/util/proto/test/test.pb.go b/util/proto/test/test.pb.go index a0808f8..b194e1f 100644 --- a/util/proto/test/test.pb.go +++ b/util/proto/test/test.pb.go @@ -87,6 +87,7 @@ type Primitives struct { FieldF int64 `protobuf:"varint,203,opt,name=field_f,json=fieldF,proto3" json:"field_f,omitempty"` FieldG uint64 `protobuf:"varint,204,opt,name=field_g,json=fieldG,proto3" json:"field_g,omitempty"` FieldI uint64 `protobuf:"fixed64,205,opt,name=field_i,json=fieldI,proto3" json:"field_i,omitempty"` + FieldJ float64 `protobuf:"fixed64,206,opt,name=field_j,json=fieldJ,proto3" json:"field_j,omitempty"` FieldH Primitives_SomeEnum `protobuf:"varint,300,opt,name=field_h,json=fieldH,proto3,enum=test.Primitives_SomeEnum" json:"field_h,omitempty"` } @@ -178,6 +179,13 @@ func (x *Primitives) GetFieldI() uint64 { return 0 } +func (x *Primitives) GetFieldJ() float64 { + if x != nil { + return x.FieldJ + } + return 0 +} + func (x *Primitives) GetFieldH() Primitives_SomeEnum { if x != nil { return x.FieldH @@ -277,7 +285,7 @@ var File_util_proto_test_test_proto protoreflect.FileDescriptor var file_util_proto_test_test_proto_rawDesc = []byte{ 0x0a, 0x1a, 0x75, 0x74, 0x69, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x04, 0x74, 0x65, - 0x73, 0x74, 0x22, 0xcd, 0x02, 0x0a, 0x0a, 0x50, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, + 0x73, 0x74, 0x22, 0xe7, 0x02, 0x0a, 0x0a, 0x50, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, 0x12, 0x17, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x41, 0x12, 0x17, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x62, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x66, 0x69, 0x65, @@ -291,26 +299,27 @@ var file_util_proto_test_test_proto_rawDesc = []byte{ 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x67, 0x18, 0xcc, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x47, 0x12, 0x18, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x69, 0x18, 0xcd, 0x01, 0x20, 0x01, 0x28, 0x06, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x49, 0x12, - 0x33, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x68, 0x18, 0xac, 0x02, 0x20, 0x01, 0x28, - 0x0e, 0x32, 0x19, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x50, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, - 0x76, 0x65, 0x73, 0x2e, 0x53, 0x6f, 0x6d, 0x65, 0x45, 0x6e, 0x75, 0x6d, 0x52, 0x06, 0x66, 0x69, - 0x65, 0x6c, 0x64, 0x48, 0x22, 0x3c, 0x0a, 0x08, 0x53, 0x6f, 0x6d, 0x65, 0x45, 0x6e, 0x75, 0x6d, - 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x0c, 0x0a, - 0x08, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x49, 0x56, 0x45, 0x10, 0x01, 0x12, 0x15, 0x0a, 0x08, 0x4e, - 0x45, 0x47, 0x41, 0x54, 0x49, 0x56, 0x45, 0x10, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0x01, 0x22, 0xa5, 0x01, 0x0a, 0x0d, 0x52, 0x65, 0x70, 0x50, 0x72, 0x69, 0x6d, 0x69, 0x74, - 0x69, 0x76, 0x65, 0x73, 0x12, 0x17, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x61, 0x18, - 0x01, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x41, 0x12, 0x17, 0x0a, - 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x62, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, - 0x66, 0x69, 0x65, 0x6c, 0x64, 0x42, 0x12, 0x17, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, - 0x63, 0x18, 0x03, 0x20, 0x03, 0x28, 0x05, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x43, 0x12, - 0x17, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x64, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0d, - 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x44, 0x12, 0x17, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, - 0x64, 0x5f, 0x65, 0x18, 0x05, 0x20, 0x03, 0x28, 0x03, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, - 0x45, 0x12, 0x17, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x66, 0x18, 0x06, 0x20, 0x03, - 0x28, 0x04, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x46, 0x42, 0x11, 0x5a, 0x0f, 0x75, 0x74, - 0x69, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x62, 0x06, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x18, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x6a, 0x18, 0xce, 0x01, 0x20, 0x01, 0x28, + 0x01, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x4a, 0x12, 0x33, 0x0a, 0x07, 0x66, 0x69, 0x65, + 0x6c, 0x64, 0x5f, 0x68, 0x18, 0xac, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x19, 0x2e, 0x74, 0x65, + 0x73, 0x74, 0x2e, 0x50, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, 0x2e, 0x53, 0x6f, + 0x6d, 0x65, 0x45, 0x6e, 0x75, 0x6d, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x48, 0x22, 0x3c, + 0x0a, 0x08, 0x53, 0x6f, 0x6d, 0x65, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, + 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x0c, 0x0a, 0x08, 0x50, 0x4f, 0x53, 0x49, 0x54, + 0x49, 0x56, 0x45, 0x10, 0x01, 0x12, 0x15, 0x0a, 0x08, 0x4e, 0x45, 0x47, 0x41, 0x54, 0x49, 0x56, + 0x45, 0x10, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0x22, 0xa5, 0x01, 0x0a, + 0x0d, 0x52, 0x65, 0x70, 0x50, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, 0x12, 0x17, + 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x61, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0c, 0x52, + 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x41, 0x12, 0x17, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, + 0x5f, 0x62, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x42, + 0x12, 0x17, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x63, 0x18, 0x03, 0x20, 0x03, 0x28, + 0x05, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x43, 0x12, 0x17, 0x0a, 0x07, 0x66, 0x69, 0x65, + 0x6c, 0x64, 0x5f, 0x64, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, + 0x64, 0x44, 0x12, 0x17, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x65, 0x18, 0x05, 0x20, + 0x03, 0x28, 0x03, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x45, 0x12, 0x17, 0x0a, 0x07, 0x66, + 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x66, 0x18, 0x06, 0x20, 0x03, 0x28, 0x04, 0x52, 0x06, 0x66, 0x69, + 0x65, 0x6c, 0x64, 0x46, 0x42, 0x11, 0x5a, 0x0f, 0x75, 0x74, 0x69, 0x6c, 0x2f, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/util/proto/test/test.proto b/util/proto/test/test.proto index e9c2758..c568a31 100644 --- a/util/proto/test/test.proto +++ b/util/proto/test/test.proto @@ -13,6 +13,7 @@ message Primitives { int64 field_f = 203; uint64 field_g = 204; fixed64 field_i = 205; + double field_j = 206; enum SomeEnum { UNKNOWN = 0; From 3adfdc5005595ad43d77e857326b679171b8d244 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 24 Mar 2021 10:10:51 +0300 Subject: [PATCH 0708/1196] [#265] reputation: Implement converters and encoding methods on messages Signed-off-by: Leonard Lyubich --- v2/reputation/convert.go | 227 ++++++++++++++++++++++++++++++++++ v2/reputation/json.go | 14 +++ v2/reputation/marshal.go | 118 ++++++++++++++++++ v2/reputation/message_test.go | 19 +++ 4 files changed, 378 insertions(+) create mode 100644 v2/reputation/convert.go create mode 100644 v2/reputation/json.go create mode 100644 v2/reputation/marshal.go create mode 100644 v2/reputation/message_test.go diff --git a/v2/reputation/convert.go b/v2/reputation/convert.go new file mode 100644 index 0000000..51b37bc --- /dev/null +++ b/v2/reputation/convert.go @@ -0,0 +1,227 @@ +package reputation + +import ( + "github.com/nspcc-dev/neofs-api-go/rpc/grpc" + "github.com/nspcc-dev/neofs-api-go/rpc/message" + reputation "github.com/nspcc-dev/neofs-api-go/v2/reputation/grpc" +) + +// ToGRPCMessage converts Trust to gRPC-generated +// reputation.Trust message. +func (x *Trust) ToGRPCMessage() grpc.Message { + var m *reputation.Trust + + if x != nil { + m = new(reputation.Trust) + + m.SetValue(x.val) + m.SetPeer(x.peer) + } + + return m +} + +// FromGRPCMessage tries to restore Trust from grpc.Message. +// +// Returns message.ErrUnexpectedMessageType if m is not +// a gRPC-generated reputation.Trust message. +func (x *Trust) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*reputation.Trust) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + x.val = v.GetValue() + x.peer = v.GetPeer() + + return nil +} + +// TrustsToGRPC converts slice of Trust structures +// to slice of gRPC-generated Trust messages. +func TrustsToGRPC(xs []*Trust) (res []*reputation.Trust) { + if xs != nil { + res = make([]*reputation.Trust, 0, len(xs)) + + for i := range xs { + res = append(res, xs[i].ToGRPCMessage().(*reputation.Trust)) + } + } + + return +} + +// TrustsFromGRPC tries to restore slice of Trust structures from +// slice of gRPC-generated reputation.Trust messages. +func TrustsFromGRPC(xs []*reputation.Trust) (res []*Trust, err error) { + if xs != nil { + res = make([]*Trust, 0, len(xs)) + + for i := range xs { + var x *Trust + + if xs[i] != nil { + x = new(Trust) + + err = x.FromGRPCMessage(xs[i]) + if err != nil { + return + } + } + + res = append(res, x) + } + } + + return +} + +// ToGRPCMessage converts SendLocalTrustRequestBody to gRPC-generated +// reputation.SendLocalTrustRequest_Body message. +func (x *SendLocalTrustRequestBody) ToGRPCMessage() grpc.Message { + var m *reputation.SendLocalTrustRequest_Body + + if x != nil { + m = new(reputation.SendLocalTrustRequest_Body) + + m.SetEpoch(x.epoch) + m.SetTrusts(TrustsToGRPC(x.trusts)) + } + + return m +} + +// FromGRPCMessage tries to restore SendLocalTrustRequestBody from grpc.Message. +// +// Returns message.ErrUnexpectedMessageType if m is not +// a gRPC-generated reputation.SendLocalTrustRequest_Body message. +func (x *SendLocalTrustRequestBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*reputation.SendLocalTrustRequest_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + x.trusts, err = TrustsFromGRPC(v.GetTrusts()) + if err != nil { + return err + } + + x.epoch = v.GetEpoch() + + return nil +} + +// ToGRPCMessage converts SendLocalTrustRequest to gRPC-generated +// reputation.SendLocalTrustRequest message. +func (x *SendLocalTrustRequest) ToGRPCMessage() grpc.Message { + var m *reputation.SendLocalTrustRequest + + if x != nil { + m = new(reputation.SendLocalTrustRequest) + + m.SetBody(x.body.ToGRPCMessage().(*reputation.SendLocalTrustRequest_Body)) + x.RequestHeaders.ToMessage(m) + } + + return m +} + +// FromGRPCMessage tries to restore SendLocalTrustRequest from grpc.Message. +// +// Returns message.ErrUnexpectedMessageType if m is not +// a gRPC-generated reputation.SendLocalTrustRequest message. +func (x *SendLocalTrustRequest) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*reputation.SendLocalTrustRequest) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + body := v.GetBody() + if body == nil { + x.body = nil + } else { + if x.body == nil { + x.body = new(SendLocalTrustRequestBody) + } + + err = x.body.FromGRPCMessage(body) + if err != nil { + return err + } + } + + return x.RequestHeaders.FromMessage(v) +} + +// ToGRPCMessage converts SendLocalTrustResponseBody to gRPC-generated +// reputation.SendLocalTrustResponse_Body message. +func (x *SendLocalTrustResponseBody) ToGRPCMessage() grpc.Message { + var m *reputation.SendLocalTrustResponse_Body + + if x != nil { + m = new(reputation.SendLocalTrustResponse_Body) + } + + return m +} + +// FromGRPCMessage tries to restore SendLocalTrustResponseBody from grpc.Message. +// +// Returns message.ErrUnexpectedMessageType if m is not +// a gRPC-generated reputation.SendLocalTrustResponse_Body message. +func (x *SendLocalTrustResponseBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*reputation.SendLocalTrustResponse_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + return nil +} + +// ToGRPCMessage converts SendLocalTrustResponse to gRPC-generated +// reputation.SendLocalTrustResponse message. +func (x *SendLocalTrustResponse) ToGRPCMessage() grpc.Message { + var m *reputation.SendLocalTrustResponse + + if x != nil { + m = new(reputation.SendLocalTrustResponse) + + m.SetBody(x.body.ToGRPCMessage().(*reputation.SendLocalTrustResponse_Body)) + x.ResponseHeaders.ToMessage(m) + } + + return m +} + +// FromGRPCMessage tries to restore SendLocalTrustResponse from grpc.Message. +// +// Returns message.ErrUnexpectedMessageType if m is not +// a gRPC-generated reputation.SendLocalTrustResponse message. +func (x *SendLocalTrustResponse) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*reputation.SendLocalTrustResponse) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + body := v.GetBody() + if body == nil { + x.body = nil + } else { + if x.body == nil { + x.body = new(SendLocalTrustResponseBody) + } + + err = x.body.FromGRPCMessage(body) + if err != nil { + return err + } + } + + return x.ResponseHeaders.FromMessage(v) +} diff --git a/v2/reputation/json.go b/v2/reputation/json.go new file mode 100644 index 0000000..202bae2 --- /dev/null +++ b/v2/reputation/json.go @@ -0,0 +1,14 @@ +package reputation + +import ( + "github.com/nspcc-dev/neofs-api-go/rpc/message" + reputation "github.com/nspcc-dev/neofs-api-go/v2/reputation/grpc" +) + +func (x *Trust) MarshalJSON() ([]byte, error) { + return message.MarshalJSON(x) +} + +func (x *Trust) UnmarshalJSON(data []byte) error { + return message.UnmarshalJSON(x, data, new(reputation.Trust)) +} diff --git a/v2/reputation/marshal.go b/v2/reputation/marshal.go new file mode 100644 index 0000000..d627f81 --- /dev/null +++ b/v2/reputation/marshal.go @@ -0,0 +1,118 @@ +package reputation + +import ( + "github.com/nspcc-dev/neofs-api-go/rpc/message" + protoutil "github.com/nspcc-dev/neofs-api-go/util/proto" + reputation "github.com/nspcc-dev/neofs-api-go/v2/reputation/grpc" +) + +const ( + _ = iota + trustPeerFNum + trustValueFNum +) + +func (x *Trust) StableMarshal(buf []byte) ([]byte, error) { + if x == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, x.StableSize()) + } + + var ( + offset, n int + err error + ) + + n, err = protoutil.BytesMarshal(trustPeerFNum, buf[offset:], x.peer) + if err != nil { + return nil, err + } + + offset += n + + _, err = protoutil.Float64Marshal(trustValueFNum, buf[offset:], x.val) + if err != nil { + return nil, err + } + + return buf, nil +} + +func (x *Trust) StableSize() (size int) { + size += protoutil.BytesSize(trustPeerFNum, x.peer) + size += protoutil.Float64Size(trustValueFNum, x.val) + + return +} + +func (x *Trust) Unmarshal(data []byte) error { + return message.Unmarshal(x, data, new(reputation.Trust)) +} + +const ( + _ = iota + sendLocalTrustBodyEpochFNum + sendLocalTrustBodyTrustsFNum +) + +func (x *SendLocalTrustRequestBody) StableMarshal(buf []byte) ([]byte, error) { + if x == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, x.StableSize()) + } + + var ( + offset, n int + err error + ) + + n, err = protoutil.UInt64Marshal(sendLocalTrustBodyEpochFNum, buf[offset:], x.epoch) + if err != nil { + return nil, err + } + + offset += n + + for i := range x.trusts { + n, err = protoutil.NestedStructureMarshal(sendLocalTrustBodyTrustsFNum, buf[offset:], x.trusts[i]) + if err != nil { + return nil, err + } + + offset += n + } + + return buf, nil +} + +func (x *SendLocalTrustRequestBody) StableSize() (size int) { + size += protoutil.UInt64Size(sendLocalTrustBodyEpochFNum, x.epoch) + + for i := range x.trusts { + size += protoutil.NestedStructureSize(sendLocalTrustBodyTrustsFNum, x.trusts[i]) + } + + return +} + +func (x *SendLocalTrustRequestBody) Unmarshal(data []byte) error { + return message.Unmarshal(x, data, new(reputation.SendLocalTrustRequest_Body)) +} + +func (x *SendLocalTrustResponseBody) StableMarshal(buf []byte) ([]byte, error) { + return buf, nil +} + +func (x *SendLocalTrustResponseBody) StableSize() int { + return 0 +} + +func (x *SendLocalTrustResponseBody) Unmarshal(data []byte) error { + return message.Unmarshal(x, data, new(reputation.SendLocalTrustResponse_Body)) +} diff --git a/v2/reputation/message_test.go b/v2/reputation/message_test.go new file mode 100644 index 0000000..07ca89f --- /dev/null +++ b/v2/reputation/message_test.go @@ -0,0 +1,19 @@ +package reputation_test + +import ( + "testing" + + "github.com/nspcc-dev/neofs-api-go/rpc/message" + messagetest "github.com/nspcc-dev/neofs-api-go/rpc/message/test" + reputationtest "github.com/nspcc-dev/neofs-api-go/v2/reputation/test" +) + +func TestMessageConvert(t *testing.T) { + messagetest.TestRPCMessage(t, + func(empty bool) message.Message { return reputationtest.GenerateTrust(empty) }, + func(empty bool) message.Message { return reputationtest.GenerateSendLocalTrustRequestBody(empty) }, + func(empty bool) message.Message { return reputationtest.GenerateSendLocalTrustRequest(empty) }, + func(empty bool) message.Message { return reputationtest.GenerateSendLocalTrustResponseBody(empty) }, + func(empty bool) message.Message { return reputationtest.GenerateSendLocalTrustResponse(empty) }, + ) +} From 1766228cfd1457e14975164d9c2c1c8256bd18fe Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 24 Mar 2021 11:10:36 +0300 Subject: [PATCH 0709/1196] [#265] v2/signature: Support SendLocalTrust request and response Signed-off-by: Leonard Lyubich --- v2/signature/sign.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/v2/signature/sign.go b/v2/signature/sign.go index f006bfb..eb35253 100644 --- a/v2/signature/sign.go +++ b/v2/signature/sign.go @@ -10,6 +10,7 @@ import ( "github.com/nspcc-dev/neofs-api-go/v2/netmap" "github.com/nspcc-dev/neofs-api-go/v2/object" "github.com/nspcc-dev/neofs-api-go/v2/refs" + "github.com/nspcc-dev/neofs-api-go/v2/reputation" "github.com/nspcc-dev/neofs-api-go/v2/session" "github.com/pkg/errors" ) @@ -374,5 +375,11 @@ func serviceMessageBody(req interface{}) stableMarshaler { return v.GetBody() case *netmap.NetworkInfoResponse: return v.GetBody() + + /* Reputation */ + case *reputation.SendLocalTrustRequest: + return v.GetBody() + case *reputation.SendLocalTrustResponse: + return v.GetBody() } } From 51d443c6fc5c284bdd4b55bbb980717708a0990f Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 24 Mar 2021 11:12:25 +0300 Subject: [PATCH 0710/1196] [#265] v2/rpc: Add SendLocalTrust RPC Signed-off-by: Leonard Lyubich --- v2/rpc/reputation.go | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 v2/rpc/reputation.go diff --git a/v2/rpc/reputation.go b/v2/rpc/reputation.go new file mode 100644 index 0000000..6cef706 --- /dev/null +++ b/v2/rpc/reputation.go @@ -0,0 +1,29 @@ +package rpc + +import ( + "github.com/nspcc-dev/neofs-api-go/rpc/client" + "github.com/nspcc-dev/neofs-api-go/rpc/common" + "github.com/nspcc-dev/neofs-api-go/v2/reputation" +) + +const serviceReputation = serviceNamePrefix + "reputation.ReputationService" + +const ( + rpcReputationSendLocalTrust = "SendLocalTrust" +) + +// SendLocalTrust executes ReputationService.SendLocalTrust RPC. +func SendLocalTrust( + cli *client.Client, + req *reputation.SendLocalTrustRequest, + opts ...client.CallOption, +) (*reputation.SendLocalTrustResponse, error) { + resp := new(reputation.SendLocalTrustResponse) + + err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceReputation, rpcReputationSendLocalTrust), req, resp, opts...) + if err != nil { + return nil, err + } + + return resp, nil +} From 009f704377acf7b042849554bff197c4869d797a Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 24 Mar 2021 11:27:30 +0300 Subject: [PATCH 0711/1196] [#265] pkg/reputation: Implement PeerID and Trust types Signed-off-by: Leonard Lyubich --- pkg/reputation/peer.go | 29 ++++++++++ pkg/reputation/peer_test.go | 18 +++++++ pkg/reputation/test/generate.go | 22 ++++++++ pkg/reputation/trust.go | 95 +++++++++++++++++++++++++++++++++ pkg/reputation/trust_test.go | 41 ++++++++++++++ 5 files changed, 205 insertions(+) create mode 100644 pkg/reputation/peer.go create mode 100644 pkg/reputation/peer_test.go create mode 100644 pkg/reputation/test/generate.go create mode 100644 pkg/reputation/trust.go create mode 100644 pkg/reputation/trust_test.go diff --git a/pkg/reputation/peer.go b/pkg/reputation/peer.go new file mode 100644 index 0000000..ef1a314 --- /dev/null +++ b/pkg/reputation/peer.go @@ -0,0 +1,29 @@ +package reputation + +// PeerID represents peer ID compatible with NeoFS API v2. +type PeerID []byte + +// NewPeerID creates and returns blank PeerID. +func NewPeerID() *PeerID { + return PeerIDFromV2(nil) +} + +// PeerIDFromV2 converts bytes slice to PeerID. +func PeerIDFromV2(data []byte) *PeerID { + return (*PeerID)(&data) +} + +// SetBytes sets bytes of peer ID. +func (x *PeerID) SetBytes(v []byte) { + *x = v +} + +// Bytes returns bytes of peer ID. +func (x PeerID) Bytes() []byte { + return x +} + +// ToV2 converts PeerID to byte slice. +func (x PeerID) ToV2() []byte { + return x +} diff --git a/pkg/reputation/peer_test.go b/pkg/reputation/peer_test.go new file mode 100644 index 0000000..79c0da7 --- /dev/null +++ b/pkg/reputation/peer_test.go @@ -0,0 +1,18 @@ +package reputation_test + +import ( + "testing" + + "github.com/nspcc-dev/neofs-api-go/pkg/reputation" + "github.com/stretchr/testify/require" +) + +func TestPeerID(t *testing.T) { + peerID := reputation.NewPeerID() + + data := []byte{1, 2, 3} + peerID.SetBytes(data) + require.Equal(t, data, peerID.Bytes()) + + require.Equal(t, peerID, reputation.PeerIDFromV2(peerID.ToV2())) +} diff --git a/pkg/reputation/test/generate.go b/pkg/reputation/test/generate.go new file mode 100644 index 0000000..7d02c8b --- /dev/null +++ b/pkg/reputation/test/generate.go @@ -0,0 +1,22 @@ +package reputationtest + +import ( + "github.com/nspcc-dev/neofs-api-go/pkg/reputation" + crypto "github.com/nspcc-dev/neofs-crypto" + "github.com/nspcc-dev/neofs-crypto/test" +) + +func GeneratePeerID() *reputation.PeerID { + v := reputation.NewPeerID() + v.SetBytes(crypto.MarshalPublicKey(&test.DecodeKey(-1).PublicKey)) + + return v +} + +func GenerateTrust() *reputation.Trust { + v := reputation.NewTrust() + v.SetPeer(GeneratePeerID()) + v.SetValue(1.5) + + return v +} diff --git a/pkg/reputation/trust.go b/pkg/reputation/trust.go new file mode 100644 index 0000000..bfa5126 --- /dev/null +++ b/pkg/reputation/trust.go @@ -0,0 +1,95 @@ +package reputation + +import ( + "github.com/nspcc-dev/neofs-api-go/v2/reputation" +) + +// Trust represents peer's trust compatible with NeoFS API v2. +type Trust reputation.Trust + +// NewTrust creates and returns blank Trust. +func NewTrust() *Trust { + return TrustFromV2(new(reputation.Trust)) +} + +// TrustFromV2 converts NeoFS API v2 +// reputation.Trust message structure to Trust. +func TrustFromV2(t *reputation.Trust) *Trust { + return (*Trust)(t) +} + +// ToV2 converts Trust to NeoFS API v2 +// reputation.Trust message structure. +func (x *Trust) ToV2() *reputation.Trust { + return (*reputation.Trust)(x) +} + +// TrustsToV2 converts slice of Trust's to slice of +// NeoFS API v2 reputation.Trust message structures. +func TrustsToV2(xs []*Trust) (res []*reputation.Trust) { + if xs != nil { + res = make([]*reputation.Trust, 0, len(xs)) + + for i := range xs { + res = append(res, xs[i].ToV2()) + } + } + + return +} + +// SetPeer sets trusted peer ID. +func (x *Trust) SetPeer(id *PeerID) { + (*reputation.Trust)(x). + SetPeer(id.ToV2()) +} + +// Peer returns trusted peer ID. +func (x *Trust) Peer() *PeerID { + return PeerIDFromV2( + (*reputation.Trust)(x).GetPeer(), + ) +} + +// SetValue sets trust value. +func (x *Trust) SetValue(val float64) { + (*reputation.Trust)(x). + SetValue(val) +} + +// Value returns trust value. +func (x *Trust) Value() float64 { + return (*reputation.Trust)(x). + GetValue() +} + +// Marshal marshals Trust into a protobuf binary form. +// +// Buffer is allocated when the argument is empty. +// Otherwise, the first buffer is used. +func (x *Trust) Marshal(b ...[]byte) ([]byte, error) { + var buf []byte + if len(b) > 0 { + buf = b[0] + } + + return (*reputation.Trust)(x).StableMarshal(buf) +} + +// Unmarshal unmarshals protobuf binary representation of Trust. +func (x *Trust) Unmarshal(data []byte) error { + return (*reputation.Trust)(x). + Unmarshal(data) +} + +// MarshalJSON encodes Trust to protobuf JSON format. +func (x *Trust) MarshalJSON() ([]byte, error) { + return (*reputation.Trust)(x). + MarshalJSON() +} + +// UnmarshalJSON decodes Trust from protobuf JSON format. +func (x *Trust) UnmarshalJSON(data []byte) error { + return (*reputation.Trust)(x). + UnmarshalJSON(data) +} diff --git a/pkg/reputation/trust_test.go b/pkg/reputation/trust_test.go new file mode 100644 index 0000000..5a36c01 --- /dev/null +++ b/pkg/reputation/trust_test.go @@ -0,0 +1,41 @@ +package reputation_test + +import ( + "testing" + + "github.com/nspcc-dev/neofs-api-go/pkg/reputation" + reputationtest "github.com/nspcc-dev/neofs-api-go/pkg/reputation/test" + "github.com/stretchr/testify/require" +) + +func TestTrust(t *testing.T) { + trust := reputation.NewTrust() + + id := reputationtest.GeneratePeerID() + trust.SetPeer(id) + require.Equal(t, id, trust.Peer()) + + val := 1.5 + trust.SetValue(val) + require.Equal(t, val, trust.Value()) + + t.Run("binary encoding", func(t *testing.T) { + trust := reputationtest.GenerateTrust() + data, err := trust.Marshal() + require.NoError(t, err) + + trust2 := reputation.NewTrust() + require.NoError(t, trust2.Unmarshal(data)) + require.Equal(t, trust, trust2) + }) + + t.Run("JSON encoding", func(t *testing.T) { + trust := reputationtest.GenerateTrust() + data, err := trust.MarshalJSON() + require.NoError(t, err) + + trust2 := reputation.NewTrust() + require.NoError(t, trust2.UnmarshalJSON(data)) + require.Equal(t, trust, trust2) + }) +} From b792e4e4647a47d539b9789ba2fc94aafb063d03 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 24 Mar 2021 11:29:02 +0300 Subject: [PATCH 0712/1196] [#265] pkg/client: Implement SendLocalTrust method Define `Reputation` section interface. Embed `Reputation` interface to `Client` one. Signed-off-by: Leonard Lyubich --- pkg/client/client.go | 1 + pkg/client/reputation.go | 82 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 83 insertions(+) create mode 100644 pkg/client/reputation.go diff --git a/pkg/client/client.go b/pkg/client/client.go index 1db894b..20b88b3 100644 --- a/pkg/client/client.go +++ b/pkg/client/client.go @@ -13,6 +13,7 @@ type Client interface { Netmap Object Session + Reputation // Raw must return underlying raw protobuf client. Raw() *client.Client diff --git a/pkg/client/reputation.go b/pkg/client/reputation.go new file mode 100644 index 0000000..8682f62 --- /dev/null +++ b/pkg/client/reputation.go @@ -0,0 +1,82 @@ +package client + +import ( + "context" + + "github.com/nspcc-dev/neofs-api-go/pkg/reputation" + "github.com/nspcc-dev/neofs-api-go/rpc/client" + v2reputation "github.com/nspcc-dev/neofs-api-go/v2/reputation" + rpcapi "github.com/nspcc-dev/neofs-api-go/v2/rpc" + v2signature "github.com/nspcc-dev/neofs-api-go/v2/signature" + "github.com/pkg/errors" +) + +// Reputation contains methods for working with Reputation system values. +type Reputation interface { + // SendLocalTrust sends local trust values of local peer. + SendLocalTrust(context.Context, SendLocalTrustPrm, ...CallOption) (*SendLocalTrustRes, error) +} + +// SendLocalTrustPrm groups parameters of SendLocalTrust operation. +type SendLocalTrustPrm struct { + epoch uint64 + + trusts []*reputation.Trust +} + +// Epoch returns epoch in which the trust was assessed. +func (x SendLocalTrustPrm) Epoch() uint64 { + return x.epoch +} + +// SetEpoch sets epoch in which the trust was assessed. +func (x *SendLocalTrustPrm) SetEpoch(epoch uint64) { + x.epoch = epoch +} + +// Trusts returns list of local trust values. +func (x SendLocalTrustPrm) Trusts() []*reputation.Trust { + return x.trusts +} + +// SetTrusts sets list of local trust values. +func (x *SendLocalTrustPrm) SetTrusts(trusts []*reputation.Trust) { + x.trusts = trusts +} + +// SendLocalTrustPrm groups results of SendLocalTrust operation. +type SendLocalTrustRes struct{} + +func (c *clientImpl) SendLocalTrust(ctx context.Context, prm SendLocalTrustPrm, opts ...CallOption) (*SendLocalTrustRes, error) { + // apply all available options + callOptions := c.defaultCallOptions() + + for i := range opts { + opts[i](callOptions) + } + + reqBody := new(v2reputation.SendLocalTrustRequestBody) + reqBody.SetEpoch(prm.Epoch()) + reqBody.SetTrusts(reputation.TrustsToV2(prm.Trusts())) + + req := new(v2reputation.SendLocalTrustRequest) + req.SetBody(reqBody) + req.SetMetaHeader(v2MetaHeaderFromOpts(callOptions)) + + err := v2signature.SignServiceMessage(callOptions.key, req) + if err != nil { + return nil, err + } + + resp, err := rpcapi.SendLocalTrust(c.Raw(), req, client.WithContext(ctx)) + if err != nil { + return nil, err + } + + err = v2signature.VerifyServiceMessage(resp) + if err != nil { + return nil, errors.Wrap(err, "can't verify response message") + } + + return new(SendLocalTrustRes), nil +} From 948cf3f174a8e873c1dfca4cf2f536f77681f331 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 1 Apr 2021 17:16:13 +0300 Subject: [PATCH 0713/1196] [#265] reputation: Compile protobuf files with new RPC Signed-off-by: Leonard Lyubich --- v2/reputation/grpc/service.pb.go | 478 ++++++++++++++++++++++++++++--- v2/reputation/grpc/types.pb.go | 310 ++++++++++++++++++-- 2 files changed, 715 insertions(+), 73 deletions(-) diff --git a/v2/reputation/grpc/service.pb.go b/v2/reputation/grpc/service.pb.go index daced20..fea43ea 100644 --- a/v2/reputation/grpc/service.pb.go +++ b/v2/reputation/grpc/service.pb.go @@ -170,6 +170,146 @@ func (x *SendLocalTrustResponse) GetVerifyHeader() *grpc.ResponseVerificationHea return nil } +// Request to send intermediate global trust. +type SendIntermediateResultRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Body of the request message. + Body *SendIntermediateResultRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" 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,proto3" json:"verify_header,omitempty"` +} + +func (x *SendIntermediateResultRequest) Reset() { + *x = SendIntermediateResultRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_reputation_grpc_service_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SendIntermediateResultRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SendIntermediateResultRequest) ProtoMessage() {} + +func (x *SendIntermediateResultRequest) ProtoReflect() protoreflect.Message { + mi := &file_v2_reputation_grpc_service_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SendIntermediateResultRequest.ProtoReflect.Descriptor instead. +func (*SendIntermediateResultRequest) Descriptor() ([]byte, []int) { + return file_v2_reputation_grpc_service_proto_rawDescGZIP(), []int{2} +} + +func (x *SendIntermediateResultRequest) GetBody() *SendIntermediateResultRequest_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *SendIntermediateResultRequest) GetMetaHeader() *grpc.RequestMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} + +func (x *SendIntermediateResultRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} + +// Response to request to send intermediate global trust. +type SendIntermediateResultResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Body of the response message. + Body *SendIntermediateResultResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" 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,proto3" json:"verify_header,omitempty"` +} + +func (x *SendIntermediateResultResponse) Reset() { + *x = SendIntermediateResultResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_reputation_grpc_service_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SendIntermediateResultResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SendIntermediateResultResponse) ProtoMessage() {} + +func (x *SendIntermediateResultResponse) ProtoReflect() protoreflect.Message { + mi := &file_v2_reputation_grpc_service_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SendIntermediateResultResponse.ProtoReflect.Descriptor instead. +func (*SendIntermediateResultResponse) Descriptor() ([]byte, []int) { + return file_v2_reputation_grpc_service_proto_rawDescGZIP(), []int{3} +} + +func (x *SendIntermediateResultResponse) GetBody() *SendIntermediateResultResponse_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *SendIntermediateResultResponse) GetMetaHeader() *grpc.ResponseMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} + +func (x *SendIntermediateResultResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} + // Request body structure. type SendLocalTrustRequest_Body struct { state protoimpl.MessageState @@ -187,7 +327,7 @@ type SendLocalTrustRequest_Body struct { func (x *SendLocalTrustRequest_Body) Reset() { *x = SendLocalTrustRequest_Body{} if protoimpl.UnsafeEnabled { - mi := &file_v2_reputation_grpc_service_proto_msgTypes[2] + mi := &file_v2_reputation_grpc_service_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -200,7 +340,7 @@ func (x *SendLocalTrustRequest_Body) String() string { func (*SendLocalTrustRequest_Body) ProtoMessage() {} func (x *SendLocalTrustRequest_Body) ProtoReflect() protoreflect.Message { - mi := &file_v2_reputation_grpc_service_proto_msgTypes[2] + mi := &file_v2_reputation_grpc_service_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -240,7 +380,7 @@ type SendLocalTrustResponse_Body struct { func (x *SendLocalTrustResponse_Body) Reset() { *x = SendLocalTrustResponse_Body{} if protoimpl.UnsafeEnabled { - mi := &file_v2_reputation_grpc_service_proto_msgTypes[3] + mi := &file_v2_reputation_grpc_service_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -253,7 +393,7 @@ func (x *SendLocalTrustResponse_Body) String() string { func (*SendLocalTrustResponse_Body) ProtoMessage() {} func (x *SendLocalTrustResponse_Body) ProtoReflect() protoreflect.Message { - mi := &file_v2_reputation_grpc_service_proto_msgTypes[3] + mi := &file_v2_reputation_grpc_service_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -269,6 +409,103 @@ func (*SendLocalTrustResponse_Body) Descriptor() ([]byte, []int) { return file_v2_reputation_grpc_service_proto_rawDescGZIP(), []int{1, 0} } +// Request body structure. +type SendIntermediateResultRequest_Body struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Sequence number of the iteration. + Iteration uint32 `protobuf:"varint,1,opt,name=iteration,proto3" json:"iteration,omitempty"` + // Current global trust value computed at the specified iteration. + Trust *Trust `protobuf:"bytes,2,opt,name=trust,proto3" json:"trust,omitempty"` +} + +func (x *SendIntermediateResultRequest_Body) Reset() { + *x = SendIntermediateResultRequest_Body{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_reputation_grpc_service_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SendIntermediateResultRequest_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SendIntermediateResultRequest_Body) ProtoMessage() {} + +func (x *SendIntermediateResultRequest_Body) ProtoReflect() protoreflect.Message { + mi := &file_v2_reputation_grpc_service_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SendIntermediateResultRequest_Body.ProtoReflect.Descriptor instead. +func (*SendIntermediateResultRequest_Body) Descriptor() ([]byte, []int) { + return file_v2_reputation_grpc_service_proto_rawDescGZIP(), []int{2, 0} +} + +func (x *SendIntermediateResultRequest_Body) GetIteration() uint32 { + if x != nil { + return x.Iteration + } + return 0 +} + +func (x *SendIntermediateResultRequest_Body) GetTrust() *Trust { + if x != nil { + return x.Trust + } + return nil +} + +// Response body structure. +type SendIntermediateResultResponse_Body struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *SendIntermediateResultResponse_Body) Reset() { + *x = SendIntermediateResultResponse_Body{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_reputation_grpc_service_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SendIntermediateResultResponse_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SendIntermediateResultResponse_Body) ProtoMessage() {} + +func (x *SendIntermediateResultResponse_Body) ProtoReflect() protoreflect.Message { + mi := &file_v2_reputation_grpc_service_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SendIntermediateResultResponse_Body.ProtoReflect.Descriptor instead. +func (*SendIntermediateResultResponse_Body) Descriptor() ([]byte, []int) { + return file_v2_reputation_grpc_service_proto_rawDescGZIP(), []int{3, 0} +} + var File_v2_reputation_grpc_service_proto protoreflect.FileDescriptor var file_v2_reputation_grpc_service_proto_rawDesc = []byte{ @@ -316,22 +553,70 @@ var file_v2_reputation_grpc_service_proto_rawDesc = []byte{ 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, 0x06, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x32, 0x80, 0x01, 0x0a, 0x11, 0x52, 0x65, 0x70, - 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x6b, - 0x0a, 0x0e, 0x53, 0x65, 0x6e, 0x64, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x54, 0x72, 0x75, 0x73, 0x74, - 0x12, 0x2b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, - 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x4c, 0x6f, 0x63, 0x61, - 0x6c, 0x54, 0x72, 0x75, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2c, 0x2e, - 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x54, 0x72, - 0x75, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x62, 0x5a, 0x3f, 0x67, - 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, - 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, - 0x2f, 0x76, 0x32, 0x2f, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x67, - 0x72, 0x70, 0x63, 0x3b, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xaa, 0x02, - 0x1e, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, - 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x52, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x1a, 0x06, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x22, 0xe0, 0x02, 0x0a, 0x1d, 0x53, 0x65, 0x6e, + 0x64, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, + 0x75, 0x6c, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x4c, 0x0a, 0x04, 0x62, 0x6f, + 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x38, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, + 0x53, 0x65, 0x6e, 0x64, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x74, 0x65, + 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 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, 0x57, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x1c, 0x0a, 0x09, 0x69, 0x74, + 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x69, + 0x74, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x31, 0x0a, 0x05, 0x74, 0x72, 0x75, 0x73, + 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, + 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x54, + 0x72, 0x75, 0x73, 0x74, 0x52, 0x05, 0x74, 0x72, 0x75, 0x73, 0x74, 0x22, 0x93, 0x02, 0x0a, 0x1e, + 0x53, 0x65, 0x6e, 0x64, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x74, 0x65, + 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4d, + 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x39, 0x2e, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6d, 0x65, 0x64, + 0x69, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 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, 0x06, 0x0a, 0x04, 0x42, 0x6f, 0x64, + 0x79, 0x32, 0x86, 0x02, 0x0a, 0x11, 0x52, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x6b, 0x0a, 0x0e, 0x53, 0x65, 0x6e, 0x64, 0x4c, + 0x6f, 0x63, 0x61, 0x6c, 0x54, 0x72, 0x75, 0x73, 0x74, 0x12, 0x2b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, + 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x54, 0x72, 0x75, 0x73, 0x74, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, + 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x65, + 0x6e, 0x64, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x54, 0x72, 0x75, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x83, 0x01, 0x0a, 0x16, 0x53, 0x65, 0x6e, 0x64, 0x49, 0x6e, 0x74, + 0x65, 0x72, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, + 0x33, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, + 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x49, 0x6e, 0x74, 0x65, 0x72, + 0x6d, 0x65, 0x64, 0x69, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x34, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x65, 0x6e, 0x64, + 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x75, + 0x6c, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x62, 0x5a, 0x3f, 0x67, 0x69, + 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, + 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, + 0x76, 0x32, 0x2f, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x67, 0x72, + 0x70, 0x63, 0x3b, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xaa, 0x02, 0x1e, + 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, + 0x41, 0x50, 0x49, 0x2e, 0x52, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -346,33 +631,46 @@ func file_v2_reputation_grpc_service_proto_rawDescGZIP() []byte { return file_v2_reputation_grpc_service_proto_rawDescData } -var file_v2_reputation_grpc_service_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_v2_reputation_grpc_service_proto_msgTypes = make([]protoimpl.MessageInfo, 8) var file_v2_reputation_grpc_service_proto_goTypes = []interface{}{ - (*SendLocalTrustRequest)(nil), // 0: neo.fs.v2.reputation.SendLocalTrustRequest - (*SendLocalTrustResponse)(nil), // 1: neo.fs.v2.reputation.SendLocalTrustResponse - (*SendLocalTrustRequest_Body)(nil), // 2: neo.fs.v2.reputation.SendLocalTrustRequest.Body - (*SendLocalTrustResponse_Body)(nil), // 3: neo.fs.v2.reputation.SendLocalTrustResponse.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 - (*Trust)(nil), // 8: neo.fs.v2.reputation.Trust + (*SendLocalTrustRequest)(nil), // 0: neo.fs.v2.reputation.SendLocalTrustRequest + (*SendLocalTrustResponse)(nil), // 1: neo.fs.v2.reputation.SendLocalTrustResponse + (*SendIntermediateResultRequest)(nil), // 2: neo.fs.v2.reputation.SendIntermediateResultRequest + (*SendIntermediateResultResponse)(nil), // 3: neo.fs.v2.reputation.SendIntermediateResultResponse + (*SendLocalTrustRequest_Body)(nil), // 4: neo.fs.v2.reputation.SendLocalTrustRequest.Body + (*SendLocalTrustResponse_Body)(nil), // 5: neo.fs.v2.reputation.SendLocalTrustResponse.Body + (*SendIntermediateResultRequest_Body)(nil), // 6: neo.fs.v2.reputation.SendIntermediateResultRequest.Body + (*SendIntermediateResultResponse_Body)(nil), // 7: neo.fs.v2.reputation.SendIntermediateResultResponse.Body + (*grpc.RequestMetaHeader)(nil), // 8: neo.fs.v2.session.RequestMetaHeader + (*grpc.RequestVerificationHeader)(nil), // 9: neo.fs.v2.session.RequestVerificationHeader + (*grpc.ResponseMetaHeader)(nil), // 10: neo.fs.v2.session.ResponseMetaHeader + (*grpc.ResponseVerificationHeader)(nil), // 11: neo.fs.v2.session.ResponseVerificationHeader + (*Trust)(nil), // 12: neo.fs.v2.reputation.Trust } var file_v2_reputation_grpc_service_proto_depIdxs = []int32{ - 2, // 0: neo.fs.v2.reputation.SendLocalTrustRequest.body:type_name -> neo.fs.v2.reputation.SendLocalTrustRequest.Body - 4, // 1: neo.fs.v2.reputation.SendLocalTrustRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader - 5, // 2: neo.fs.v2.reputation.SendLocalTrustRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader - 3, // 3: neo.fs.v2.reputation.SendLocalTrustResponse.body:type_name -> neo.fs.v2.reputation.SendLocalTrustResponse.Body - 6, // 4: neo.fs.v2.reputation.SendLocalTrustResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader - 7, // 5: neo.fs.v2.reputation.SendLocalTrustResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader - 8, // 6: neo.fs.v2.reputation.SendLocalTrustRequest.Body.trusts:type_name -> neo.fs.v2.reputation.Trust - 0, // 7: neo.fs.v2.reputation.ReputationService.SendLocalTrust:input_type -> neo.fs.v2.reputation.SendLocalTrustRequest - 1, // 8: neo.fs.v2.reputation.ReputationService.SendLocalTrust:output_type -> neo.fs.v2.reputation.SendLocalTrustResponse - 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 + 4, // 0: neo.fs.v2.reputation.SendLocalTrustRequest.body:type_name -> neo.fs.v2.reputation.SendLocalTrustRequest.Body + 8, // 1: neo.fs.v2.reputation.SendLocalTrustRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader + 9, // 2: neo.fs.v2.reputation.SendLocalTrustRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader + 5, // 3: neo.fs.v2.reputation.SendLocalTrustResponse.body:type_name -> neo.fs.v2.reputation.SendLocalTrustResponse.Body + 10, // 4: neo.fs.v2.reputation.SendLocalTrustResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader + 11, // 5: neo.fs.v2.reputation.SendLocalTrustResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 6, // 6: neo.fs.v2.reputation.SendIntermediateResultRequest.body:type_name -> neo.fs.v2.reputation.SendIntermediateResultRequest.Body + 8, // 7: neo.fs.v2.reputation.SendIntermediateResultRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader + 9, // 8: neo.fs.v2.reputation.SendIntermediateResultRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader + 7, // 9: neo.fs.v2.reputation.SendIntermediateResultResponse.body:type_name -> neo.fs.v2.reputation.SendIntermediateResultResponse.Body + 10, // 10: neo.fs.v2.reputation.SendIntermediateResultResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader + 11, // 11: neo.fs.v2.reputation.SendIntermediateResultResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 12, // 12: neo.fs.v2.reputation.SendLocalTrustRequest.Body.trusts:type_name -> neo.fs.v2.reputation.Trust + 12, // 13: neo.fs.v2.reputation.SendIntermediateResultRequest.Body.trust:type_name -> neo.fs.v2.reputation.Trust + 0, // 14: neo.fs.v2.reputation.ReputationService.SendLocalTrust:input_type -> neo.fs.v2.reputation.SendLocalTrustRequest + 2, // 15: neo.fs.v2.reputation.ReputationService.SendIntermediateResult:input_type -> neo.fs.v2.reputation.SendIntermediateResultRequest + 1, // 16: neo.fs.v2.reputation.ReputationService.SendLocalTrust:output_type -> neo.fs.v2.reputation.SendLocalTrustResponse + 3, // 17: neo.fs.v2.reputation.ReputationService.SendIntermediateResult:output_type -> neo.fs.v2.reputation.SendIntermediateResultResponse + 16, // [16:18] is the sub-list for method output_type + 14, // [14:16] is the sub-list for method input_type + 14, // [14:14] is the sub-list for extension type_name + 14, // [14:14] is the sub-list for extension extendee + 0, // [0:14] is the sub-list for field type_name } func init() { file_v2_reputation_grpc_service_proto_init() } @@ -407,7 +705,7 @@ func file_v2_reputation_grpc_service_proto_init() { } } file_v2_reputation_grpc_service_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SendLocalTrustRequest_Body); i { + switch v := v.(*SendIntermediateResultRequest); i { case 0: return &v.state case 1: @@ -419,6 +717,30 @@ func file_v2_reputation_grpc_service_proto_init() { } } file_v2_reputation_grpc_service_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SendIntermediateResultResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_reputation_grpc_service_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SendLocalTrustRequest_Body); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_reputation_grpc_service_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*SendLocalTrustResponse_Body); i { case 0: return &v.state @@ -430,6 +752,30 @@ func file_v2_reputation_grpc_service_proto_init() { return nil } } + file_v2_reputation_grpc_service_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SendIntermediateResultRequest_Body); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_reputation_grpc_service_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SendIntermediateResultResponse_Body); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } type x struct{} out := protoimpl.TypeBuilder{ @@ -437,7 +783,7 @@ func file_v2_reputation_grpc_service_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_v2_reputation_grpc_service_proto_rawDesc, NumEnums: 0, - NumMessages: 4, + NumMessages: 8, NumExtensions: 0, NumServices: 1, }, @@ -465,6 +811,9 @@ const _ = grpc1.SupportPackageIsVersion6 type ReputationServiceClient interface { // Sends local client trust to any peer from NeoFS network. SendLocalTrust(ctx context.Context, in *SendLocalTrustRequest, opts ...grpc1.CallOption) (*SendLocalTrustResponse, error) + // Sends the intermediate result of the iterative algorithm + // for calculating the global reputation of the node. + SendIntermediateResult(ctx context.Context, in *SendIntermediateResultRequest, opts ...grpc1.CallOption) (*SendIntermediateResultResponse, error) } type reputationServiceClient struct { @@ -484,10 +833,22 @@ func (c *reputationServiceClient) SendLocalTrust(ctx context.Context, in *SendLo return out, nil } +func (c *reputationServiceClient) SendIntermediateResult(ctx context.Context, in *SendIntermediateResultRequest, opts ...grpc1.CallOption) (*SendIntermediateResultResponse, error) { + out := new(SendIntermediateResultResponse) + err := c.cc.Invoke(ctx, "/neo.fs.v2.reputation.ReputationService/SendIntermediateResult", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // ReputationServiceServer is the server API for ReputationService service. type ReputationServiceServer interface { // Sends local client trust to any peer from NeoFS network. SendLocalTrust(context.Context, *SendLocalTrustRequest) (*SendLocalTrustResponse, error) + // Sends the intermediate result of the iterative algorithm + // for calculating the global reputation of the node. + SendIntermediateResult(context.Context, *SendIntermediateResultRequest) (*SendIntermediateResultResponse, error) } // UnimplementedReputationServiceServer can be embedded to have forward compatible implementations. @@ -497,6 +858,9 @@ type UnimplementedReputationServiceServer struct { func (*UnimplementedReputationServiceServer) SendLocalTrust(context.Context, *SendLocalTrustRequest) (*SendLocalTrustResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method SendLocalTrust not implemented") } +func (*UnimplementedReputationServiceServer) SendIntermediateResult(context.Context, *SendIntermediateResultRequest) (*SendIntermediateResultResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SendIntermediateResult not implemented") +} func RegisterReputationServiceServer(s *grpc1.Server, srv ReputationServiceServer) { s.RegisterService(&_ReputationService_serviceDesc, srv) @@ -520,6 +884,24 @@ func _ReputationService_SendLocalTrust_Handler(srv interface{}, ctx context.Cont return interceptor(ctx, in, info, handler) } +func _ReputationService_SendIntermediateResult_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc1.UnaryServerInterceptor) (interface{}, error) { + in := new(SendIntermediateResultRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ReputationServiceServer).SendIntermediateResult(ctx, in) + } + info := &grpc1.UnaryServerInfo{ + Server: srv, + FullMethod: "/neo.fs.v2.reputation.ReputationService/SendIntermediateResult", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ReputationServiceServer).SendIntermediateResult(ctx, req.(*SendIntermediateResultRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _ReputationService_serviceDesc = grpc1.ServiceDesc{ ServiceName: "neo.fs.v2.reputation.ReputationService", HandlerType: (*ReputationServiceServer)(nil), @@ -528,6 +910,10 @@ var _ReputationService_serviceDesc = grpc1.ServiceDesc{ MethodName: "SendLocalTrust", Handler: _ReputationService_SendLocalTrust_Handler, }, + { + MethodName: "SendIntermediateResult", + Handler: _ReputationService_SendIntermediateResult_Handler, + }, }, Streams: []grpc1.StreamDesc{}, Metadata: "v2/reputation/grpc/service.proto", diff --git a/v2/reputation/grpc/types.pb.go b/v2/reputation/grpc/types.pb.go index 6152ef0..c2adca5 100644 --- a/v2/reputation/grpc/types.pb.go +++ b/v2/reputation/grpc/types.pb.go @@ -8,6 +8,7 @@ package reputation import ( proto "github.com/golang/protobuf/proto" + grpc "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -25,6 +26,67 @@ const ( // of the legacy proto package is being used. const _ = proto.ProtoPackageIsVersion4 +// NeoFS unique peer identifier. +// +// `PeerID` is a 33 byte long compressed public key of the node +// stored in network map. +// +// String presentation is +// [base58](https://tools.ietf.org/html/draft-msporny-base58-02) encoded string. +// +// JSON value will be the data encoded as a string using standard base64 +// encoding with paddings. Either +// [standard](https://tools.ietf.org/html/rfc4648#section-4) or +// [URL-safe](https://tools.ietf.org/html/rfc4648#section-5) base64 encoding +// with/without paddings are accepted. +type PeerID struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Peer identifier in a binary format. + Value []byte `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` +} + +func (x *PeerID) Reset() { + *x = PeerID{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_reputation_grpc_types_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PeerID) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PeerID) ProtoMessage() {} + +func (x *PeerID) ProtoReflect() protoreflect.Message { + mi := &file_v2_reputation_grpc_types_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PeerID.ProtoReflect.Descriptor instead. +func (*PeerID) Descriptor() ([]byte, []int) { + return file_v2_reputation_grpc_types_proto_rawDescGZIP(), []int{0} +} + +func (x *PeerID) GetValue() []byte { + if x != nil { + return x.Value + } + return nil +} + // Trust value to NeoFS network peer. type Trust struct { state protoimpl.MessageState @@ -32,10 +94,7 @@ type Trust struct { unknownFields protoimpl.UnknownFields // Identifier of the trusted peer. - // - // For storage nodes, it is the node's public key - // fixed in the network map. - Peer []byte `protobuf:"bytes,1,opt,name=peer,proto3" json:"peer,omitempty"` + Peer *PeerID `protobuf:"bytes,1,opt,name=peer,proto3" json:"peer,omitempty"` // Trust value. Value float64 `protobuf:"fixed64,2,opt,name=value,proto3" json:"value,omitempty"` } @@ -43,7 +102,7 @@ type Trust struct { func (x *Trust) Reset() { *x = Trust{} if protoimpl.UnsafeEnabled { - mi := &file_v2_reputation_grpc_types_proto_msgTypes[0] + mi := &file_v2_reputation_grpc_types_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -56,7 +115,7 @@ func (x *Trust) String() string { func (*Trust) ProtoMessage() {} func (x *Trust) ProtoReflect() protoreflect.Message { - mi := &file_v2_reputation_grpc_types_proto_msgTypes[0] + mi := &file_v2_reputation_grpc_types_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -69,10 +128,10 @@ func (x *Trust) ProtoReflect() protoreflect.Message { // Deprecated: Use Trust.ProtoReflect.Descriptor instead. func (*Trust) Descriptor() ([]byte, []int) { - return file_v2_reputation_grpc_types_proto_rawDescGZIP(), []int{0} + return file_v2_reputation_grpc_types_proto_rawDescGZIP(), []int{1} } -func (x *Trust) GetPeer() []byte { +func (x *Trust) GetPeer() *PeerID { if x != nil { return x.Peer } @@ -86,23 +145,173 @@ func (x *Trust) GetValue() float64 { return 0 } +// Global trust value to NeoFS network peer. +type GlobalTrust struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Message format version. Effectively the version of API library used to create + // the message. + Version *grpc.Version `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` + // Message body. + Body *GlobalTrust_Body `protobuf:"bytes,2,opt,name=body,proto3" json:"body,omitempty"` + // Signature of the binary `body` field by the manager. + Signature *grpc.Signature `protobuf:"bytes,3,opt,name=signature,proto3" json:"signature,omitempty"` +} + +func (x *GlobalTrust) Reset() { + *x = GlobalTrust{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_reputation_grpc_types_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GlobalTrust) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GlobalTrust) ProtoMessage() {} + +func (x *GlobalTrust) ProtoReflect() protoreflect.Message { + mi := &file_v2_reputation_grpc_types_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GlobalTrust.ProtoReflect.Descriptor instead. +func (*GlobalTrust) Descriptor() ([]byte, []int) { + return file_v2_reputation_grpc_types_proto_rawDescGZIP(), []int{2} +} + +func (x *GlobalTrust) GetVersion() *grpc.Version { + if x != nil { + return x.Version + } + return nil +} + +func (x *GlobalTrust) GetBody() *GlobalTrust_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *GlobalTrust) GetSignature() *grpc.Signature { + if x != nil { + return x.Signature + } + return nil +} + +// Message body structure. +type GlobalTrust_Body struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Node manager ID. + Manager *PeerID `protobuf:"bytes,1,opt,name=manager,proto3" json:"manager,omitempty"` + // Global trust value. + Trust *Trust `protobuf:"bytes,2,opt,name=trust,proto3" json:"trust,omitempty"` +} + +func (x *GlobalTrust_Body) Reset() { + *x = GlobalTrust_Body{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_reputation_grpc_types_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GlobalTrust_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GlobalTrust_Body) ProtoMessage() {} + +func (x *GlobalTrust_Body) ProtoReflect() protoreflect.Message { + mi := &file_v2_reputation_grpc_types_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GlobalTrust_Body.ProtoReflect.Descriptor instead. +func (*GlobalTrust_Body) Descriptor() ([]byte, []int) { + return file_v2_reputation_grpc_types_proto_rawDescGZIP(), []int{2, 0} +} + +func (x *GlobalTrust_Body) GetManager() *PeerID { + if x != nil { + return x.Manager + } + return nil +} + +func (x *GlobalTrust_Body) GetTrust() *Trust { + if x != nil { + return x.Trust + } + return nil +} + var File_v2_reputation_grpc_types_proto protoreflect.FileDescriptor var file_v2_reputation_grpc_types_proto_rawDesc = []byte{ 0x0a, 0x1e, 0x76, 0x32, 0x2f, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 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, 0x72, 0x65, 0x70, 0x75, - 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x31, 0x0a, 0x05, 0x54, 0x72, 0x75, 0x73, 0x74, 0x12, - 0x12, 0x0a, 0x04, 0x70, 0x65, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x70, - 0x65, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x62, 0x5a, 0x3f, 0x67, 0x69, 0x74, - 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, - 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, - 0x32, 0x2f, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x67, 0x72, 0x70, - 0x63, 0x3b, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xaa, 0x02, 0x1e, 0x4e, - 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, - 0x50, 0x49, 0x2e, 0x52, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x62, 0x06, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0x18, 0x76, 0x32, 0x2f, 0x72, 0x65, 0x66, 0x73, 0x2f, + 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x22, 0x1e, 0x0a, 0x06, 0x50, 0x65, 0x65, 0x72, 0x49, 0x44, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x22, 0x4f, 0x0a, 0x05, 0x54, 0x72, 0x75, 0x73, 0x74, 0x12, 0x30, 0x0a, 0x04, 0x70, 0x65, 0x65, + 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, + 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x50, + 0x65, 0x65, 0x72, 0x49, 0x44, 0x52, 0x04, 0x70, 0x65, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x22, 0xa8, 0x02, 0x0a, 0x0b, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x54, 0x72, 0x75, 0x73, + 0x74, 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, 0x3a, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, + 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, + 0x54, 0x72, 0x75, 0x73, 0x74, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, + 0x12, 0x37, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, + 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, + 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x1a, 0x71, 0x0a, 0x04, 0x42, 0x6f, 0x64, + 0x79, 0x12, 0x36, 0x0a, 0x07, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, + 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x49, 0x44, + 0x52, 0x07, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x12, 0x31, 0x0a, 0x05, 0x74, 0x72, 0x75, + 0x73, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, + 0x54, 0x72, 0x75, 0x73, 0x74, 0x52, 0x05, 0x74, 0x72, 0x75, 0x73, 0x74, 0x42, 0x62, 0x5a, 0x3f, + 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, + 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, + 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, + 0x67, 0x72, 0x70, 0x63, 0x3b, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xaa, + 0x02, 0x1e, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, + 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x52, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -117,16 +326,27 @@ func file_v2_reputation_grpc_types_proto_rawDescGZIP() []byte { return file_v2_reputation_grpc_types_proto_rawDescData } -var file_v2_reputation_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_v2_reputation_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 4) var file_v2_reputation_grpc_types_proto_goTypes = []interface{}{ - (*Trust)(nil), // 0: neo.fs.v2.reputation.Trust + (*PeerID)(nil), // 0: neo.fs.v2.reputation.PeerID + (*Trust)(nil), // 1: neo.fs.v2.reputation.Trust + (*GlobalTrust)(nil), // 2: neo.fs.v2.reputation.GlobalTrust + (*GlobalTrust_Body)(nil), // 3: neo.fs.v2.reputation.GlobalTrust.Body + (*grpc.Version)(nil), // 4: neo.fs.v2.refs.Version + (*grpc.Signature)(nil), // 5: neo.fs.v2.refs.Signature } var file_v2_reputation_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 + 0, // 0: neo.fs.v2.reputation.Trust.peer:type_name -> neo.fs.v2.reputation.PeerID + 4, // 1: neo.fs.v2.reputation.GlobalTrust.version:type_name -> neo.fs.v2.refs.Version + 3, // 2: neo.fs.v2.reputation.GlobalTrust.body:type_name -> neo.fs.v2.reputation.GlobalTrust.Body + 5, // 3: neo.fs.v2.reputation.GlobalTrust.signature:type_name -> neo.fs.v2.refs.Signature + 0, // 4: neo.fs.v2.reputation.GlobalTrust.Body.manager:type_name -> neo.fs.v2.reputation.PeerID + 1, // 5: neo.fs.v2.reputation.GlobalTrust.Body.trust:type_name -> neo.fs.v2.reputation.Trust + 6, // [6:6] is the sub-list for method output_type + 6, // [6:6] is the sub-list for method input_type + 6, // [6:6] is the sub-list for extension type_name + 6, // [6:6] is the sub-list for extension extendee + 0, // [0:6] is the sub-list for field type_name } func init() { file_v2_reputation_grpc_types_proto_init() } @@ -136,6 +356,18 @@ func file_v2_reputation_grpc_types_proto_init() { } if !protoimpl.UnsafeEnabled { file_v2_reputation_grpc_types_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PeerID); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_reputation_grpc_types_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Trust); i { case 0: return &v.state @@ -147,6 +379,30 @@ func file_v2_reputation_grpc_types_proto_init() { return nil } } + file_v2_reputation_grpc_types_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GlobalTrust); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_reputation_grpc_types_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GlobalTrust_Body); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } type x struct{} out := protoimpl.TypeBuilder{ @@ -154,7 +410,7 @@ func file_v2_reputation_grpc_types_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_v2_reputation_grpc_types_proto_rawDesc, NumEnums: 0, - NumMessages: 1, + NumMessages: 4, NumExtensions: 0, NumServices: 0, }, From ca2e272d42bc779f01a20e6c0f5144b4101adcd2 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 1 Apr 2021 17:24:38 +0300 Subject: [PATCH 0714/1196] [#265] reputation/grpc: Implement setters on generated messages Signed-off-by: Leonard Lyubich --- v2/reputation/grpc/service.go | 56 +++++++++++++++++++++++++++++++++++ v2/reputation/grpc/types.go | 48 +++++++++++++++++++++++++++++- 2 files changed, 103 insertions(+), 1 deletion(-) diff --git a/v2/reputation/grpc/service.go b/v2/reputation/grpc/service.go index 80147df..bf8626e 100644 --- a/v2/reputation/grpc/service.go +++ b/v2/reputation/grpc/service.go @@ -59,3 +59,59 @@ func (x *SendLocalTrustResponse) SetVerifyHeader(v *session.ResponseVerification x.VerifyHeader = v } } + +// SetIteration sets sequence number of the iteration. +func (x *SendIntermediateResultRequest_Body) SetIteration(v uint32) { + if x != nil { + x.Iteration = v + } +} + +// SetTrust sets current global trust value. +func (x *SendIntermediateResultRequest_Body) SetTrust(v *Trust) { + if x != nil { + x.Trust = v + } +} + +// SetBody sets body of the request. +func (x *SendIntermediateResultRequest) SetBody(v *SendIntermediateResultRequest_Body) { + if x != nil { + x.Body = v + } +} + +// SetMetaHeader sets meta header of the request. +func (x *SendIntermediateResultRequest) SetMetaHeader(v *session.RequestMetaHeader) { + if x != nil { + x.MetaHeader = v + } +} + +// SetVerifyHeader sets verification header of the request. +func (x *SendIntermediateResultRequest) SetVerifyHeader(v *session.RequestVerificationHeader) { + if x != nil { + x.VerifyHeader = v + } +} + +// SetBody sets body of the response. +func (x *SendIntermediateResultResponse) SetBody(v *SendIntermediateResultResponse_Body) { + if x != nil { + x.Body = v + } +} + +// SetMetaHeader sets meta header of the response. +func (x *SendIntermediateResultResponse) SetMetaHeader(v *session.ResponseMetaHeader) { + if x != nil { + x.MetaHeader = v + } +} + +// SetVerifyHeader sets verification header of the response. +func (x *SendIntermediateResultResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) { + if x != nil { + x.VerifyHeader = v + } +} diff --git a/v2/reputation/grpc/types.go b/v2/reputation/grpc/types.go index 84facde..0a469bd 100644 --- a/v2/reputation/grpc/types.go +++ b/v2/reputation/grpc/types.go @@ -1,7 +1,18 @@ package reputation +import ( + refs "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" +) + +// SetValue sets binary ID. +func (x *PeerID) SetValue(v []byte) { + if x != nil { + x.Value = v + } +} + // SetPeer sets trusted peer's ID. -func (x *Trust) SetPeer(v []byte) { +func (x *Trust) SetPeer(v *PeerID) { if x != nil { x.Peer = v } @@ -13,3 +24,38 @@ func (x *Trust) SetValue(v float64) { x.Value = v } } + +// SetManager sets manager ID. +func (x *GlobalTrust_Body) SetManager(v *PeerID) { + if x != nil { + x.Manager = v + } +} + +// SetTrust sets global trust value. +func (x *GlobalTrust_Body) SetTrust(v *Trust) { + if x != nil { + x.Trust = v + } +} + +// SetVersion sets message format version. +func (x *GlobalTrust) SetVersion(v *refs.Version) { + if x != nil { + x.Version = v + } +} + +// SetBody sets message body. +func (x *GlobalTrust) SetBody(v *GlobalTrust_Body) { + if x != nil { + x.Body = v + } +} + +// SetSignature sets body signature. +func (x *GlobalTrust) SetSignature(v *refs.Signature) { + if x != nil { + x.Signature = v + } +} From 46b3feabe1e82b7a125b2195af9e84291e4b2eec Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 1 Apr 2021 17:35:40 +0300 Subject: [PATCH 0715/1196] [#265] reputation: Define structures of protobuf messages Define Go structures of `SendIntermediateResult` RPC-related messages from reputation package of NeoFS API. Implement getters and setters of message fields. Signed-off-by: Leonard Lyubich --- v2/reputation/types.go | 217 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 214 insertions(+), 3 deletions(-) diff --git a/v2/reputation/types.go b/v2/reputation/types.go index 12cb3de..3b67c13 100644 --- a/v2/reputation/types.go +++ b/v2/reputation/types.go @@ -1,19 +1,42 @@ package reputation import ( + "github.com/nspcc-dev/neofs-api-go/v2/refs" "github.com/nspcc-dev/neofs-api-go/v2/session" ) +// PeerID represents reputation.PeerID message +// from NeoFS API v2. +type PeerID struct { + val []byte +} + +// GetValue returns peer's binary ID. +func (x *PeerID) GetValue() []byte { + if x != nil { + return x.val + } + + return nil +} + +// SetValue sets peer's binary ID. +func (x *PeerID) SetValue(v []byte) { + if x != nil { + x.val = v + } +} + // Trust represents reputation.Trust message // from NeoFS API v2. type Trust struct { val float64 - peer []byte + peer *PeerID } // GetPeer returns trusted peer's ID. -func (x *Trust) GetPeer() []byte { +func (x *Trust) GetPeer() *PeerID { if x != nil { return x.peer } @@ -22,7 +45,7 @@ func (x *Trust) GetPeer() []byte { } // SetPeer sets trusted peer's ID. -func (x *Trust) SetPeer(v []byte) { +func (x *Trust) SetPeer(v *PeerID) { if x != nil { x.peer = v } @@ -44,6 +67,104 @@ func (x *Trust) SetValue(v float64) { } } +// GlobalTrustBody represents reputation.GlobalTrust.Body message +// from NeoFS API v2. +type GlobalTrustBody struct { + manager *PeerID + + trust *Trust +} + +// GetManager returns node manager ID. +func (x *GlobalTrustBody) GetManager() *PeerID { + if x != nil { + return x.manager + } + + return nil +} + +// SetManager sets node manager ID. +func (x *GlobalTrustBody) SetManager(v *PeerID) { + if x != nil { + x.manager = v + } +} + +// GetTrust returns global trust value. +func (x *GlobalTrustBody) GetTrust() *Trust { + if x != nil { + return x.trust + } + + return nil +} + +// SetTrust sets global trust value. +func (x *GlobalTrustBody) SetTrust(v *Trust) { + if x != nil { + x.trust = v + } +} + +// GlobalTrust represents reputation.GlobalTrust message +// from NeoFS API v2. +type GlobalTrust struct { + version *refs.Version + + body *GlobalTrustBody + + sig *refs.Signature +} + +// GetVersion returns message format version. +func (x *GlobalTrust) GetVersion() *refs.Version { + if x != nil { + return x.version + } + + return nil +} + +// SetVersion sets message format version. +func (x *GlobalTrust) SetVersion(v *refs.Version) { + if x != nil { + x.version = v + } +} + +// GetBody returns message body. +func (x *GlobalTrust) GetBody() *GlobalTrustBody { + if x != nil { + return x.body + } + + return nil +} + +// SetBody sets message body. +func (x *GlobalTrust) SetBody(v *GlobalTrustBody) { + if x != nil { + x.body = v + } +} + +// GetSignature returns body signature. +func (x *GlobalTrust) GetSignature() *refs.Signature { + if x != nil { + return x.sig + } + + return nil +} + +// SetSignature sets body signature. +func (x *GlobalTrust) SetSignature(v *refs.Signature) { + if x != nil { + x.sig = v + } +} + // SendLocalTrustRequestBody is a structure of SendLocalTrust request body. type SendLocalTrustRequestBody struct { epoch uint64 @@ -133,3 +254,93 @@ func (x *SendLocalTrustResponse) SetBody(v *SendLocalTrustResponseBody) { x.body = v } } + +// SendIntermediateResultRequestBody is a structure of SendIntermediateResult request body. +type SendIntermediateResultRequestBody struct { + iter uint32 + + trust *Trust +} + +// GetIteration returns sequence number of the iteration. +func (x *SendIntermediateResultRequestBody) GetIteration() uint32 { + if x != nil { + return x.iter + } + + return 0 +} + +// SetIteration sets sequence number of the iteration. +func (x *SendIntermediateResultRequestBody) SetIteration(v uint32) { + if x != nil { + x.iter = v + } +} + +// GetTrust returns current global trust value. +func (x *SendIntermediateResultRequestBody) GetTrust() *Trust { + if x != nil { + return x.trust + } + + return nil +} + +// SetTrust sets current global trust value. +func (x *SendIntermediateResultRequestBody) SetTrust(v *Trust) { + if x != nil { + x.trust = v + } +} + +// SendLocalTrustResponseBody is a structure of SendIntermediateResult response body. +type SendIntermediateResultResponseBody struct{} + +// SendIntermediateResultRequest represents reputation.SendIntermediateResult +// message from NeoFS API v2. +type SendIntermediateResultRequest struct { + body *SendIntermediateResultRequestBody + + session.RequestHeaders +} + +// GetBody returns request body. +func (x *SendIntermediateResultRequest) GetBody() *SendIntermediateResultRequestBody { + if x != nil { + return x.body + } + + return nil +} + +// SetBody sets request body. +func (x *SendIntermediateResultRequest) SetBody(v *SendIntermediateResultRequestBody) { + if x != nil { + x.body = v + } +} + +// SendIntermediateResultResponse represents reputation.SendIntermediateResultResponse +// message from NeoFS API v2. +type SendIntermediateResultResponse struct { + body *SendIntermediateResultResponseBody + + session.ResponseHeaders +} + +// GetBody returns response body. +func (x *SendIntermediateResultResponse) GetBody() *SendIntermediateResultResponseBody { + if x != nil { + return x.body + } + + return nil +} + +// SetBody sets response body. +func (x *SendIntermediateResultResponse) SetBody(v *SendIntermediateResultResponseBody) { + if x != nil { + x.body = v + } +} From 8ce1c5efcc6e49646b3fcfb2798e5e6ce651b001 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 1 Apr 2021 17:39:29 +0300 Subject: [PATCH 0716/1196] [#265] reputation: Implement generators of new RPC messages Signed-off-by: Leonard Lyubich --- v2/reputation/test/generate.go | 71 +++++++++++++++++++++++++++++++++- 1 file changed, 70 insertions(+), 1 deletion(-) diff --git a/v2/reputation/test/generate.go b/v2/reputation/test/generate.go index 9cbf328..4cb525f 100644 --- a/v2/reputation/test/generate.go +++ b/v2/reputation/test/generate.go @@ -1,18 +1,49 @@ package reputationtest import ( + refstest "github.com/nspcc-dev/neofs-api-go/v2/refs/test" "github.com/nspcc-dev/neofs-api-go/v2/reputation" sessiontest "github.com/nspcc-dev/neofs-api-go/v2/session/test" ) +func GeneratePeerID(empty bool) *reputation.PeerID { + m := new(reputation.PeerID) + + if !empty { + m.SetValue([]byte{1, 2, 3}) + } + + return m +} + func GenerateTrust(empty bool) *reputation.Trust { m := new(reputation.Trust) if !empty { - m.SetPeer([]byte{1, 2, 3}) m.SetValue(1) } + m.SetPeer(GeneratePeerID(empty)) + + return m +} + +func GenerateGlobalTrustBody(empty bool) *reputation.GlobalTrustBody { + m := new(reputation.GlobalTrustBody) + + m.SetManager(GeneratePeerID(empty)) + m.SetTrust(GenerateTrust(empty)) + + return m +} + +func GenerateGlobalTrust(empty bool) *reputation.GlobalTrust { + m := new(reputation.GlobalTrust) + + m.SetVersion(refstest.GenerateVersion(empty)) + m.SetBody(GenerateGlobalTrustBody(empty)) + m.SetSignature(refstest.GenerateSignature(empty)) + return m } @@ -64,3 +95,41 @@ func GenerateSendLocalTrustResponse(empty bool) *reputation.SendLocalTrustRespon return m } + +func GenerateSendIntermediateResultRequestBody(empty bool) *reputation.SendIntermediateResultRequestBody { + m := new(reputation.SendIntermediateResultRequestBody) + + if !empty { + m.SetIteration(564) + } + + m.SetTrust(GenerateTrust(empty)) + + return m +} + +func GenerateSendIntermediateResultRequest(empty bool) *reputation.SendIntermediateResultRequest { + m := new(reputation.SendIntermediateResultRequest) + + m.SetBody(GenerateSendIntermediateResultRequestBody(empty)) + m.SetMetaHeader(sessiontest.GenerateRequestMetaHeader(empty)) + m.SetVerificationHeader(sessiontest.GenerateRequestVerificationHeader(empty)) + + return m +} + +func GenerateSendIntermediateResultResponseBody(empty bool) *reputation.SendIntermediateResultResponseBody { + m := new(reputation.SendIntermediateResultResponseBody) + + return m +} + +func GenerateSendIntermediateResultResponse(empty bool) *reputation.SendIntermediateResultResponse { + m := new(reputation.SendIntermediateResultResponse) + + m.SetBody(GenerateSendIntermediateResultResponseBody(empty)) + m.SetMetaHeader(sessiontest.GenerateResponseMetaHeader(empty)) + m.SetVerificationHeader(sessiontest.GenerateResponseVerificationHeader(empty)) + + return m +} From ccae5a40ba94fca7fba922f6fa8eb0b99aedebcd Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 1 Apr 2021 17:53:14 +0300 Subject: [PATCH 0717/1196] [#265] reputation: Implement converters and encoding methods on messages Signed-off-by: Leonard Lyubich --- v2/reputation/convert.go | 321 +++++++++++++++++++++++++++++++++- v2/reputation/json.go | 16 ++ v2/reputation/marshal.go | 174 +++++++++++++++++- v2/reputation/message_test.go | 10 ++ 4 files changed, 517 insertions(+), 4 deletions(-) diff --git a/v2/reputation/convert.go b/v2/reputation/convert.go index 51b37bc..19be9f0 100644 --- a/v2/reputation/convert.go +++ b/v2/reputation/convert.go @@ -3,9 +3,40 @@ package reputation import ( "github.com/nspcc-dev/neofs-api-go/rpc/grpc" "github.com/nspcc-dev/neofs-api-go/rpc/message" + "github.com/nspcc-dev/neofs-api-go/v2/refs" + refsGRPC "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" reputation "github.com/nspcc-dev/neofs-api-go/v2/reputation/grpc" ) +// ToGRPCMessage converts PeerID to gRPC-generated +// reputation.PeerID message. +func (x *PeerID) ToGRPCMessage() grpc.Message { + var m *reputation.PeerID + + if x != nil { + m = new(reputation.PeerID) + + m.SetValue(x.val) + } + + return m +} + +// FromGRPCMessage tries to restore PeerID from grpc.Message. +// +// Returns message.ErrUnexpectedMessageType if m is not +// a gRPC-generated reputation.PeerID message. +func (x *PeerID) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*reputation.PeerID) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + x.val = v.GetValue() + + return nil +} + // ToGRPCMessage converts Trust to gRPC-generated // reputation.Trust message. func (x *Trust) ToGRPCMessage() grpc.Message { @@ -15,7 +46,7 @@ func (x *Trust) ToGRPCMessage() grpc.Message { m = new(reputation.Trust) m.SetValue(x.val) - m.SetPeer(x.peer) + m.SetPeer(x.peer.ToGRPCMessage().(*reputation.PeerID)) } return m @@ -31,8 +62,21 @@ func (x *Trust) FromGRPCMessage(m grpc.Message) error { return message.NewUnexpectedMessageType(m, v) } + peer := v.GetPeer() + if peer == nil { + x.peer = nil + } else { + if x.peer == nil { + x.peer = new(PeerID) + } + + err := x.peer.FromGRPCMessage(peer) + if err != nil { + return err + } + } + x.val = v.GetValue() - x.peer = v.GetPeer() return nil } @@ -76,6 +120,131 @@ func TrustsFromGRPC(xs []*reputation.Trust) (res []*Trust, err error) { return } +// ToGRPCMessage converts GlobalTrustBody to gRPC-generated +// reputation.GlobalTrust_Body message. +func (x *GlobalTrustBody) ToGRPCMessage() grpc.Message { + var m *reputation.GlobalTrust_Body + + if x != nil { + m = new(reputation.GlobalTrust_Body) + + m.SetManager(x.manager.ToGRPCMessage().(*reputation.PeerID)) + m.SetTrust(x.trust.ToGRPCMessage().(*reputation.Trust)) + } + + return m +} + +// FromGRPCMessage tries to restore GlobalTrustBody from grpc.Message. +// +// Returns message.ErrUnexpectedMessageType if m is not +// a gRPC-generated reputation.GlobalTrust_Body message. +func (x *GlobalTrustBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*reputation.GlobalTrust_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + manager := v.GetManager() + if manager == nil { + x.manager = nil + } else { + if x.manager == nil { + x.manager = new(PeerID) + } + + err = x.manager.FromGRPCMessage(manager) + if err != nil { + return err + } + } + + trust := v.GetTrust() + if trust == nil { + x.trust = nil + } else { + if x.trust == nil { + x.trust = new(Trust) + } + + err = x.trust.FromGRPCMessage(trust) + } + + return err +} + +// ToGRPCMessage converts GlobalTrust to gRPC-generated +// reputation.GlobalTrust message. +func (x *GlobalTrust) ToGRPCMessage() grpc.Message { + var m *reputation.GlobalTrust + + if x != nil { + m = new(reputation.GlobalTrust) + + m.SetVersion(x.version.ToGRPCMessage().(*refsGRPC.Version)) + m.SetBody(x.body.ToGRPCMessage().(*reputation.GlobalTrust_Body)) + m.SetSignature(x.sig.ToGRPCMessage().(*refsGRPC.Signature)) + } + + return m +} + +// FromGRPCMessage tries to restore GlobalTrust from grpc.Message. +// +// Returns message.ErrUnexpectedMessageType if m is not +// a gRPC-generated reputation.GlobalTrust message. +func (x *GlobalTrust) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*reputation.GlobalTrust) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + version := v.GetVersion() + if version == nil { + x.version = nil + } else { + if x.version == nil { + x.version = new(refs.Version) + } + + err = x.version.FromGRPCMessage(version) + if err != nil { + return err + } + } + + body := v.GetBody() + if body == nil { + x.body = nil + } else { + if x.body == nil { + x.body = new(GlobalTrustBody) + } + + err = x.body.FromGRPCMessage(body) + if err != nil { + return err + } + } + + sig := v.GetSignature() + if sig == nil { + x.sig = nil + } else { + if x.sig == nil { + x.sig = new(refs.Signature) + } + + err = x.sig.FromGRPCMessage(sig) + } + + return err +} + // ToGRPCMessage converts SendLocalTrustRequestBody to gRPC-generated // reputation.SendLocalTrustRequest_Body message. func (x *SendLocalTrustRequestBody) ToGRPCMessage() grpc.Message { @@ -225,3 +394,151 @@ func (x *SendLocalTrustResponse) FromGRPCMessage(m grpc.Message) error { return x.ResponseHeaders.FromMessage(v) } + +// ToGRPCMessage converts SendIntermediateResultRequestBody to gRPC-generated +// reputation.SendIntermediateResultRequest_Body message. +func (x *SendIntermediateResultRequestBody) ToGRPCMessage() grpc.Message { + var m *reputation.SendIntermediateResultRequest_Body + + if x != nil { + m = new(reputation.SendIntermediateResultRequest_Body) + + m.SetIteration(x.iter) + m.SetTrust(x.trust.ToGRPCMessage().(*reputation.Trust)) + } + + return m +} + +// FromGRPCMessage tries to restore SendIntermediateResultRequestBody from grpc.Message. +// +// Returns message.ErrUnexpectedMessageType if m is not +// a gRPC-generated reputation.SendIntermediateResultRequest_Body message. +func (x *SendIntermediateResultRequestBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*reputation.SendIntermediateResultRequest_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + err := x.trust.FromGRPCMessage(v.GetTrust()) + if err != nil { + return err + } + + x.iter = v.GetIteration() + + return nil +} + +// ToGRPCMessage converts SendIntermediateResultRequest to gRPC-generated +// reputation.SendIntermediateResultRequest message. +func (x *SendIntermediateResultRequest) ToGRPCMessage() grpc.Message { + var m *reputation.SendIntermediateResultRequest + + if x != nil { + m = new(reputation.SendIntermediateResultRequest) + + m.SetBody(x.body.ToGRPCMessage().(*reputation.SendIntermediateResultRequest_Body)) + x.RequestHeaders.ToMessage(m) + } + + return m +} + +// FromGRPCMessage tries to restore SendIntermediateResultRequest from grpc.Message. +// +// Returns message.ErrUnexpectedMessageType if m is not +// a gRPC-generated reputation.SendIntermediateResultRequest message. +func (x *SendIntermediateResultRequest) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*reputation.SendIntermediateResultRequest) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + body := v.GetBody() + if body == nil { + x.body = nil + } else { + if x.body == nil { + x.body = new(SendIntermediateResultRequestBody) + } + + err = x.body.FromGRPCMessage(body) + if err != nil { + return err + } + } + + return x.RequestHeaders.FromMessage(v) +} + +// ToGRPCMessage converts SendIntermediateResultResponseBody to gRPC-generated +// reputation.SendIntermediateResultResponse_Body message. +func (x *SendIntermediateResultResponseBody) ToGRPCMessage() grpc.Message { + var m *reputation.SendIntermediateResultResponse_Body + + if x != nil { + m = new(reputation.SendIntermediateResultResponse_Body) + } + + return m +} + +// FromGRPCMessage tries to restore SendIntermediateResultResponseBody from grpc.Message. +// +// Returns message.ErrUnexpectedMessageType if m is not +// a gRPC-generated reputation.SendIntermediateResultResponse_Body message. +func (x *SendIntermediateResultResponseBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*reputation.SendIntermediateResultResponse_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + return nil +} + +// ToGRPCMessage converts SendIntermediateResultResponse to gRPC-generated +// reputation.SendIntermediateResultResponse message. +func (x *SendIntermediateResultResponse) ToGRPCMessage() grpc.Message { + var m *reputation.SendIntermediateResultResponse + + if x != nil { + m = new(reputation.SendIntermediateResultResponse) + + m.SetBody(x.body.ToGRPCMessage().(*reputation.SendIntermediateResultResponse_Body)) + x.ResponseHeaders.ToMessage(m) + } + + return m +} + +// FromGRPCMessage tries to restore SendIntermediateResultResponse from grpc.Message. +// +// Returns message.ErrUnexpectedMessageType if m is not +// a gRPC-generated reputation.SendIntermediateResultResponse message. +func (x *SendIntermediateResultResponse) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*reputation.SendIntermediateResultResponse) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + body := v.GetBody() + if body == nil { + x.body = nil + } else { + if x.body == nil { + x.body = new(SendIntermediateResultResponseBody) + } + + err = x.body.FromGRPCMessage(body) + if err != nil { + return err + } + } + + return x.ResponseHeaders.FromMessage(v) +} diff --git a/v2/reputation/json.go b/v2/reputation/json.go index 202bae2..637035a 100644 --- a/v2/reputation/json.go +++ b/v2/reputation/json.go @@ -5,6 +5,14 @@ import ( reputation "github.com/nspcc-dev/neofs-api-go/v2/reputation/grpc" ) +func (x *PeerID) MarshalJSON() ([]byte, error) { + return message.MarshalJSON(x) +} + +func (x *PeerID) UnmarshalJSON(data []byte) error { + return message.UnmarshalJSON(x, data, new(reputation.PeerID)) +} + func (x *Trust) MarshalJSON() ([]byte, error) { return message.MarshalJSON(x) } @@ -12,3 +20,11 @@ func (x *Trust) MarshalJSON() ([]byte, error) { func (x *Trust) UnmarshalJSON(data []byte) error { return message.UnmarshalJSON(x, data, new(reputation.Trust)) } + +func (x *GlobalTrust) MarshalJSON() ([]byte, error) { + return message.MarshalJSON(x) +} + +func (x *GlobalTrust) UnmarshalJSON(data []byte) error { + return message.UnmarshalJSON(x, data, new(reputation.GlobalTrust)) +} diff --git a/v2/reputation/marshal.go b/v2/reputation/marshal.go index d627f81..76b5e9d 100644 --- a/v2/reputation/marshal.go +++ b/v2/reputation/marshal.go @@ -6,6 +6,38 @@ import ( reputation "github.com/nspcc-dev/neofs-api-go/v2/reputation/grpc" ) +const ( + _ = iota + peerIDValFNum +) + +func (x *PeerID) StableMarshal(buf []byte) ([]byte, error) { + if x == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, x.StableSize()) + } + + _, err := protoutil.BytesMarshal(peerIDValFNum, buf, x.val) + if err != nil { + return nil, err + } + + return buf, nil +} + +func (x *PeerID) StableSize() (size int) { + size += protoutil.BytesSize(peerIDValFNum, x.val) + + return +} + +func (x *PeerID) Unmarshal(data []byte) error { + return message.Unmarshal(x, data, new(reputation.PeerID)) +} + const ( _ = iota trustPeerFNum @@ -26,7 +58,7 @@ func (x *Trust) StableMarshal(buf []byte) ([]byte, error) { err error ) - n, err = protoutil.BytesMarshal(trustPeerFNum, buf[offset:], x.peer) + n, err = protoutil.NestedStructureMarshal(trustPeerFNum, buf[offset:], x.peer) if err != nil { return nil, err } @@ -42,7 +74,7 @@ func (x *Trust) StableMarshal(buf []byte) ([]byte, error) { } func (x *Trust) StableSize() (size int) { - size += protoutil.BytesSize(trustPeerFNum, x.peer) + size += protoutil.NestedStructureSize(trustPeerFNum, x.peer) size += protoutil.Float64Size(trustValueFNum, x.val) return @@ -52,6 +84,93 @@ func (x *Trust) Unmarshal(data []byte) error { return message.Unmarshal(x, data, new(reputation.Trust)) } +const ( + _ = iota + globalTrustBodyManagerFNum + globalTrustBodyValueFNum +) + +func (x *GlobalTrustBody) StableMarshal(buf []byte) ([]byte, error) { + if x == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, x.StableSize()) + } + + offset, err := protoutil.NestedStructureMarshal(globalTrustBodyManagerFNum, buf, x.manager) + if err != nil { + return nil, err + } + + _, err = protoutil.NestedStructureMarshal(globalTrustBodyValueFNum, buf[offset:], x.trust) + if err != nil { + return nil, err + } + + return buf, nil +} + +func (x *GlobalTrustBody) StableSize() (size int) { + size += protoutil.NestedStructureSize(globalTrustBodyManagerFNum, x.manager) + size += protoutil.NestedStructureSize(globalTrustBodyValueFNum, x.trust) + + return +} + +func (x *GlobalTrustBody) Unmarshal(data []byte) error { + return message.Unmarshal(x, data, new(reputation.GlobalTrust_Body)) +} + +const ( + _ = iota + globalTrustVersionFNum + globalTrustBodyFNum + globalTrustSigFNum +) + +func (x *GlobalTrust) StableMarshal(buf []byte) ([]byte, error) { + if x == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, x.StableSize()) + } + + offset, err := protoutil.NestedStructureMarshal(globalTrustVersionFNum, buf, x.version) + if err != nil { + return nil, err + } + + n, err := protoutil.NestedStructureMarshal(globalTrustBodyFNum, buf[offset:], x.body) + if err != nil { + return nil, err + } + + offset += n + + _, err = protoutil.NestedStructureMarshal(globalTrustSigFNum, buf[offset:], x.sig) + if err != nil { + return nil, err + } + + return buf, nil +} + +func (x *GlobalTrust) StableSize() (size int) { + size += protoutil.NestedStructureSize(globalTrustVersionFNum, x.version) + size += protoutil.NestedStructureSize(globalTrustBodyFNum, x.body) + size += protoutil.NestedStructureSize(globalTrustSigFNum, x.sig) + + return +} + +func (x *GlobalTrust) Unmarshal(data []byte) error { + return message.Unmarshal(x, data, new(reputation.GlobalTrust)) +} + const ( _ = iota sendLocalTrustBodyEpochFNum @@ -116,3 +235,54 @@ func (x *SendLocalTrustResponseBody) StableSize() int { func (x *SendLocalTrustResponseBody) Unmarshal(data []byte) error { return message.Unmarshal(x, data, new(reputation.SendLocalTrustResponse_Body)) } + +const ( + _ = iota + sendInterResBodyIterFNum + sendInterResBodyTrustFNum +) + +func (x *SendIntermediateResultRequestBody) StableMarshal(buf []byte) ([]byte, error) { + if x == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, x.StableSize()) + } + + offset, err := protoutil.UInt32Marshal(sendInterResBodyIterFNum, buf, x.iter) + if err != nil { + return nil, err + } + + _, err = protoutil.NestedStructureMarshal(sendInterResBodyTrustFNum, buf[offset:], x.trust) + if err != nil { + return nil, err + } + + return buf, nil +} + +func (x *SendIntermediateResultRequestBody) StableSize() (size int) { + size += protoutil.UInt32Size(sendInterResBodyIterFNum, x.iter) + size += protoutil.NestedStructureSize(sendInterResBodyTrustFNum, x.trust) + + return +} + +func (x *SendIntermediateResultRequestBody) Unmarshal(data []byte) error { + return message.Unmarshal(x, data, new(reputation.SendIntermediateResultRequest_Body)) +} + +func (x *SendIntermediateResultResponseBody) StableMarshal(buf []byte) ([]byte, error) { + return buf, nil +} + +func (x *SendIntermediateResultResponseBody) StableSize() int { + return 0 +} + +func (x *SendIntermediateResultResponseBody) Unmarshal(data []byte) error { + return message.Unmarshal(x, data, new(reputation.SendIntermediateResultResponse_Body)) +} diff --git a/v2/reputation/message_test.go b/v2/reputation/message_test.go index 07ca89f..ecbec7b 100644 --- a/v2/reputation/message_test.go +++ b/v2/reputation/message_test.go @@ -15,5 +15,15 @@ func TestMessageConvert(t *testing.T) { func(empty bool) message.Message { return reputationtest.GenerateSendLocalTrustRequest(empty) }, func(empty bool) message.Message { return reputationtest.GenerateSendLocalTrustResponseBody(empty) }, func(empty bool) message.Message { return reputationtest.GenerateSendLocalTrustResponse(empty) }, + func(empty bool) message.Message { + return reputationtest.GenerateSendIntermediateResultRequestBody(empty) + }, + func(empty bool) message.Message { return reputationtest.GenerateSendIntermediateResultRequest(empty) }, + func(empty bool) message.Message { + return reputationtest.GenerateSendIntermediateResultResponseBody(empty) + }, + func(empty bool) message.Message { return reputationtest.GenerateSendIntermediateResultResponse(empty) }, + func(empty bool) message.Message { return reputationtest.GenerateGlobalTrustBody(empty) }, + func(empty bool) message.Message { return reputationtest.GenerateGlobalTrust(empty) }, ) } From 35567afd11fc4d47d61570c941d9db6ec2c3b13b Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 1 Apr 2021 17:54:16 +0300 Subject: [PATCH 0718/1196] [#265] v2/signature: Support SendIntermediateResult request and response Signed-off-by: Leonard Lyubich --- v2/signature/sign.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/v2/signature/sign.go b/v2/signature/sign.go index eb35253..d90fa32 100644 --- a/v2/signature/sign.go +++ b/v2/signature/sign.go @@ -381,5 +381,9 @@ func serviceMessageBody(req interface{}) stableMarshaler { return v.GetBody() case *reputation.SendLocalTrustResponse: return v.GetBody() + case *reputation.SendIntermediateResultRequest: + return v.GetBody() + case *reputation.SendIntermediateResultResponse: + return v.GetBody() } } From 710d1994a48f3149af76b1152e6a30cf6153e95d Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 1 Apr 2021 18:11:14 +0300 Subject: [PATCH 0719/1196] [#265] v2/rpc: Add SendIntermediateResult RPC Signed-off-by: Leonard Lyubich --- v2/rpc/reputation.go | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/v2/rpc/reputation.go b/v2/rpc/reputation.go index 6cef706..88e2355 100644 --- a/v2/rpc/reputation.go +++ b/v2/rpc/reputation.go @@ -9,7 +9,8 @@ import ( const serviceReputation = serviceNamePrefix + "reputation.ReputationService" const ( - rpcReputationSendLocalTrust = "SendLocalTrust" + rpcReputationSendLocalTrust = "SendLocalTrust" + rpcReputationSendIntermediateResult = "SendIntermediateResult" ) // SendLocalTrust executes ReputationService.SendLocalTrust RPC. @@ -27,3 +28,19 @@ func SendLocalTrust( return resp, nil } + +// SendIntermediateResult executes ReputationService.SendIntermediateResult RPC. +func SendIntermediateResult( + cli *client.Client, + req *reputation.SendIntermediateResultRequest, + opts ...client.CallOption, +) (*reputation.SendIntermediateResultRequest, error) { + resp := new(reputation.SendIntermediateResultRequest) + + err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceReputation, rpcReputationSendIntermediateResult), req, resp, opts...) + if err != nil { + return nil, err + } + + return resp, nil +} From c5000a333467025a2acb5bb9559e0485ce906cd2 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 1 Apr 2021 18:32:13 +0300 Subject: [PATCH 0720/1196] [#265] pkg/client: Extend Client with SendIntermediateTrust method Signed-off-by: Leonard Lyubich --- pkg/client/reputation.go | 68 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/pkg/client/reputation.go b/pkg/client/reputation.go index 8682f62..261da88 100644 --- a/pkg/client/reputation.go +++ b/pkg/client/reputation.go @@ -15,6 +15,10 @@ import ( type Reputation interface { // SendLocalTrust sends local trust values of local peer. SendLocalTrust(context.Context, SendLocalTrustPrm, ...CallOption) (*SendLocalTrustRes, error) + + // SendIntermediateTrust sends the intermediate result of the iterative algorithm for calculating + // the global reputation of the node. + SendIntermediateTrust(context.Context, SendIntermediateTrustPrm, ...CallOption) (*SendIntermediateTrustRes, error) } // SendLocalTrustPrm groups parameters of SendLocalTrust operation. @@ -80,3 +84,67 @@ func (c *clientImpl) SendLocalTrust(ctx context.Context, prm SendLocalTrustPrm, return new(SendLocalTrustRes), nil } + +// SendIntermediateTrustPrm groups parameters of SendIntermediateTrust operation. +type SendIntermediateTrustPrm struct { + iter uint32 + + trust *reputation.Trust +} + +// Iteration returns sequence number of the iteration. +func (x SendIntermediateTrustPrm) Iteration() uint32 { + return x.iter +} + +// SetIteration sets sequence number of the iteration. +func (x *SendIntermediateTrustPrm) SetIteration(iter uint32) { + x.iter = iter +} + +// Trust returns current global trust value computed at the specified iteration. +func (x SendIntermediateTrustPrm) Trust() *reputation.Trust { + return x.trust +} + +// SetTrust sets current global trust value computed at the specified iteration. +func (x *SendIntermediateTrustPrm) SetTrust(trust *reputation.Trust) { + x.trust = trust +} + +// SendIntermediateTrustRes groups results of SendIntermediateTrust operation. +type SendIntermediateTrustRes struct{} + +func (c *clientImpl) SendIntermediateTrust(ctx context.Context, prm SendIntermediateTrustPrm, opts ...CallOption) (*SendIntermediateTrustRes, error) { + // apply all available options + callOptions := c.defaultCallOptions() + + for i := range opts { + opts[i](callOptions) + } + + reqBody := new(v2reputation.SendIntermediateResultRequestBody) + reqBody.SetIteration(prm.Iteration()) + reqBody.SetTrust(prm.Trust().ToV2()) + + req := new(v2reputation.SendIntermediateResultRequest) + req.SetBody(reqBody) + req.SetMetaHeader(v2MetaHeaderFromOpts(callOptions)) + + err := v2signature.SignServiceMessage(callOptions.key, req) + if err != nil { + return nil, err + } + + resp, err := rpcapi.SendIntermediateResult(c.Raw(), req, client.WithContext(ctx)) + if err != nil { + return nil, err + } + + err = v2signature.VerifyServiceMessage(resp) + if err != nil { + return nil, errors.Wrap(err, "can't verify response message") + } + + return new(SendIntermediateTrustRes), nil +} From 05a351d344ec33f8ad91ab88736d035a08223a0d Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 2 Apr 2021 12:20:09 +0300 Subject: [PATCH 0721/1196] [#265] pkg/reputation: Change PeerID implementation Make `PeerID` type to be the wrapper over v2 `PeerID` message structure. Signed-off-by: Leonard Lyubich --- pkg/reputation/peer.go | 92 ++++++++++++++++++++++++++++----- pkg/reputation/peer_test.go | 46 ++++++++++++++--- pkg/reputation/test/generate.go | 6 ++- 3 files changed, 123 insertions(+), 21 deletions(-) diff --git a/pkg/reputation/peer.go b/pkg/reputation/peer.go index ef1a314..60d4ea3 100644 --- a/pkg/reputation/peer.go +++ b/pkg/reputation/peer.go @@ -1,29 +1,93 @@ package reputation +import ( + "bytes" + + "github.com/mr-tron/base58" + "github.com/nspcc-dev/neofs-api-go/v2/reputation" + crypto "github.com/nspcc-dev/neofs-crypto" +) + // PeerID represents peer ID compatible with NeoFS API v2. -type PeerID []byte +type PeerID reputation.PeerID // NewPeerID creates and returns blank PeerID. func NewPeerID() *PeerID { - return PeerIDFromV2(nil) + return PeerIDFromV2(new(reputation.PeerID)) } -// PeerIDFromV2 converts bytes slice to PeerID. -func PeerIDFromV2(data []byte) *PeerID { - return (*PeerID)(&data) +// PeerIDFromV2 converts NeoFS API v2 reputation.PeerID message to PeerID. +func PeerIDFromV2(id *reputation.PeerID) *PeerID { + return (*PeerID)(id) } -// SetBytes sets bytes of peer ID. -func (x *PeerID) SetBytes(v []byte) { - *x = v +// SetPublicKey sets peer ID as a compressed public key. +func (x *PeerID) SetPublicKey(v [crypto.PublicKeyCompressedSize]byte) { + (*reputation.PeerID)(x). + SetValue(v[:]) } -// Bytes returns bytes of peer ID. -func (x PeerID) Bytes() []byte { - return x +// ToV2 converts PeerID to NeoFS API v2 reputation.PeerID message. +func (x *PeerID) ToV2() *reputation.PeerID { + return (*reputation.PeerID)(x) } -// ToV2 converts PeerID to byte slice. -func (x PeerID) ToV2() []byte { - return x +// Equal returns true if identifiers are identical. +func (x *PeerID) Equal(x2 *PeerID) bool { + return bytes.Equal( + (*reputation.PeerID)(x).GetValue(), + (*reputation.PeerID)(x2).GetValue(), + ) +} + +// Parse parses PeerID from base58 string. +func (x *PeerID) Parse(s string) error { + data, err := base58.Decode(s) + if err != nil { + return err + } + + (*reputation.PeerID)(x).SetValue(data) + + return nil +} + +// String returns base58 string representation of PeerID. +func (x *PeerID) String() string { + return base58.Encode( + (*reputation.PeerID)(x). + GetValue(), + ) +} + +// Marshal marshals PeerID into a protobuf binary form. +// +// Buffer is allocated when the argument is empty. +// Otherwise, the first buffer is used. +func (x *PeerID) Marshal(b ...[]byte) ([]byte, error) { + var buf []byte + if len(b) > 0 { + buf = b[0] + } + + return (*reputation.PeerID)(x). + StableMarshal(buf) +} + +// Unmarshal unmarshals protobuf binary representation of PeerID. +func (x *PeerID) Unmarshal(data []byte) error { + return (*reputation.PeerID)(x). + Unmarshal(data) +} + +// MarshalJSON encodes PeerID to protobuf JSON format. +func (x *PeerID) MarshalJSON() ([]byte, error) { + return (*reputation.PeerID)(x). + MarshalJSON() +} + +// UnmarshalJSON decodes PeerID from protobuf JSON format. +func (x *PeerID) UnmarshalJSON(data []byte) error { + return (*reputation.PeerID)(x). + UnmarshalJSON(data) } diff --git a/pkg/reputation/peer_test.go b/pkg/reputation/peer_test.go index 79c0da7..4a63546 100644 --- a/pkg/reputation/peer_test.go +++ b/pkg/reputation/peer_test.go @@ -4,15 +4,49 @@ import ( "testing" "github.com/nspcc-dev/neofs-api-go/pkg/reputation" + reputationtest "github.com/nspcc-dev/neofs-api-go/pkg/reputation/test" "github.com/stretchr/testify/require" ) -func TestPeerID(t *testing.T) { - peerID := reputation.NewPeerID() - - data := []byte{1, 2, 3} - peerID.SetBytes(data) - require.Equal(t, data, peerID.Bytes()) +func TestPeerID_ToV2(t *testing.T) { + peerID := reputationtest.GeneratePeerID() require.Equal(t, peerID, reputation.PeerIDFromV2(peerID.ToV2())) } + +func TestPeerID_String(t *testing.T) { + id := reputationtest.GeneratePeerID() + + strID := id.String() + + id2 := reputation.NewPeerID() + + err := id2.Parse(strID) + require.NoError(t, err) + + require.Equal(t, id, id2) +} + +func TestPeerIDEncoding(t *testing.T) { + id := reputationtest.GeneratePeerID() + + t.Run("binary", func(t *testing.T) { + data, err := id.Marshal() + require.NoError(t, err) + + id2 := reputation.NewPeerID() + require.NoError(t, id2.Unmarshal(data)) + + require.Equal(t, id, id2) + }) + + t.Run("json", func(t *testing.T) { + data, err := id.MarshalJSON() + require.NoError(t, err) + + id2 := reputation.NewPeerID() + require.NoError(t, id2.UnmarshalJSON(data)) + + require.Equal(t, id, id2) + }) +} diff --git a/pkg/reputation/test/generate.go b/pkg/reputation/test/generate.go index 7d02c8b..06676e9 100644 --- a/pkg/reputation/test/generate.go +++ b/pkg/reputation/test/generate.go @@ -8,7 +8,11 @@ import ( func GeneratePeerID() *reputation.PeerID { v := reputation.NewPeerID() - v.SetBytes(crypto.MarshalPublicKey(&test.DecodeKey(-1).PublicKey)) + + key := [crypto.PublicKeyCompressedSize]byte{} + copy(key[:], crypto.MarshalPublicKey(&test.DecodeKey(-1).PublicKey)) + + v.SetPublicKey(key) return v } From 771f395d9d4e77fc6c87b50dcd5b20149341e9f5 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 2 Apr 2021 12:57:53 +0300 Subject: [PATCH 0722/1196] [#265] pkg/reputation: Implement GlobalTrust type Signed-off-by: Leonard Lyubich --- pkg/reputation/test/generate.go | 19 ++++ pkg/reputation/trust.go | 159 ++++++++++++++++++++++++++++++++ pkg/reputation/trust_test.go | 64 +++++++++++++ 3 files changed, 242 insertions(+) diff --git a/pkg/reputation/test/generate.go b/pkg/reputation/test/generate.go index 06676e9..0d1f11e 100644 --- a/pkg/reputation/test/generate.go +++ b/pkg/reputation/test/generate.go @@ -1,9 +1,12 @@ package reputationtest import ( + "testing" + "github.com/nspcc-dev/neofs-api-go/pkg/reputation" crypto "github.com/nspcc-dev/neofs-crypto" "github.com/nspcc-dev/neofs-crypto/test" + "github.com/stretchr/testify/require" ) func GeneratePeerID() *reputation.PeerID { @@ -24,3 +27,19 @@ func GenerateTrust() *reputation.Trust { return v } + +func GenerateGlobalTrust() *reputation.GlobalTrust { + v := reputation.NewGlobalTrust() + v.SetManager(GeneratePeerID()) + v.SetTrust(GenerateTrust()) + + return v +} + +func GenerateSignedGlobalTrust(t testing.TB) *reputation.GlobalTrust { + gt := GenerateGlobalTrust() + + require.NoError(t, gt.Sign(test.DecodeKey(0))) + + return gt +} diff --git a/pkg/reputation/trust.go b/pkg/reputation/trust.go index bfa5126..960a22d 100644 --- a/pkg/reputation/trust.go +++ b/pkg/reputation/trust.go @@ -1,7 +1,13 @@ package reputation import ( + "crypto/ecdsa" + + "github.com/nspcc-dev/neofs-api-go/pkg" + "github.com/nspcc-dev/neofs-api-go/util/signature" + "github.com/nspcc-dev/neofs-api-go/v2/refs" "github.com/nspcc-dev/neofs-api-go/v2/reputation" + signatureV2 "github.com/nspcc-dev/neofs-api-go/v2/signature" ) // Trust represents peer's trust compatible with NeoFS API v2. @@ -93,3 +99,156 @@ func (x *Trust) UnmarshalJSON(data []byte) error { return (*reputation.Trust)(x). UnmarshalJSON(data) } + +// GlobalTrust represents peer's global trust compatible with NeoFS API v2. +type GlobalTrust reputation.GlobalTrust + +// NewGlobalTrust creates and returns blank GlobalTrust. +// +// Version is initialized to current library version. +func NewGlobalTrust() *GlobalTrust { + gt := GlobalTrustFromV2(new(reputation.GlobalTrust)) + gt.SetVersion(pkg.SDKVersion()) + + return gt +} + +// GlobalTrustFromV2 converts NeoFS API v2 +// reputation.GlobalTrust message structure to GlobalTrust. +func GlobalTrustFromV2(t *reputation.GlobalTrust) *GlobalTrust { + return (*GlobalTrust)(t) +} + +// ToV2 converts GlobalTrust to NeoFS API v2 +// reputation.GlobalTrust message structure. +func (x *GlobalTrust) ToV2() *reputation.GlobalTrust { + return (*reputation.GlobalTrust)(x) +} + +// SetVersion sets GlobalTrust's protocol version. +func (x *GlobalTrust) SetVersion(version *pkg.Version) { + (*reputation.GlobalTrust)(x). + SetVersion(version.ToV2()) +} + +// Version returns GlobalTrust's protocol version. +func (x *GlobalTrust) Version() *pkg.Version { + return pkg.NewVersionFromV2( + (*reputation.GlobalTrust)(x). + GetVersion(), + ) +} + +func (x *GlobalTrust) setBodyField(setter func(*reputation.GlobalTrustBody)) { + if x != nil { + v2 := (*reputation.GlobalTrust)(x) + + body := v2.GetBody() + if body == nil { + body = new(reputation.GlobalTrustBody) + v2.SetBody(body) + } + + setter(body) + } +} + +// SetManager sets node manager ID. +func (x *GlobalTrust) SetManager(id *PeerID) { + x.setBodyField(func(body *reputation.GlobalTrustBody) { + body.SetManager(id.ToV2()) + }) +} + +// Manager returns node manager ID. +func (x *GlobalTrust) Manager() *PeerID { + return PeerIDFromV2( + (*reputation.GlobalTrust)(x). + GetBody(). + GetManager(), + ) +} + +// SetTrust sets global trust value. +func (x *GlobalTrust) SetTrust(trust *Trust) { + x.setBodyField(func(body *reputation.GlobalTrustBody) { + body.SetTrust(trust.ToV2()) + }) +} + +// Trust returns global trust value. +func (x *GlobalTrust) Trust() *Trust { + return TrustFromV2( + (*reputation.GlobalTrust)(x). + GetBody(). + GetTrust(), + ) +} + +// Sign signs global trust value with key. +func (x *GlobalTrust) Sign(key *ecdsa.PrivateKey) error { + v2 := (*reputation.GlobalTrust)(x) + + sigV2 := v2.GetSignature() + if sigV2 == nil { + sigV2 = new(refs.Signature) + v2.SetSignature(sigV2) + } + + return signature.SignDataWithHandler( + key, + signatureV2.StableMarshalerWrapper{SM: v2.GetBody()}, + func(key, sig []byte) { + sigV2.SetKey(key) + sigV2.SetSign(sig) + }, + ) +} + +// VerifySignature verifies global trust signature. +func (x *GlobalTrust) VerifySignature() error { + v2 := (*reputation.GlobalTrust)(x) + + sigV2 := v2.GetSignature() + if sigV2 == nil { + sigV2 = new(refs.Signature) + } + + return signature.VerifyDataWithSource( + signatureV2.StableMarshalerWrapper{SM: v2.GetBody()}, + func() ([]byte, []byte) { + return sigV2.GetKey(), sigV2.GetSign() + }, + ) +} + +// Marshal marshals GlobalTrust into a protobuf binary form. +// +// Buffer is allocated when the argument is empty. +// Otherwise, the first buffer is used. +func (x *GlobalTrust) Marshal(b ...[]byte) ([]byte, error) { + var buf []byte + if len(b) > 0 { + buf = b[0] + } + + return (*reputation.GlobalTrust)(x).StableMarshal(buf) +} + +// Unmarshal unmarshals protobuf binary representation of GlobalTrust. +func (x *GlobalTrust) Unmarshal(data []byte) error { + return (*reputation.GlobalTrust)(x). + Unmarshal(data) +} + +// MarshalJSON encodes GlobalTrust to protobuf JSON format. +func (x *GlobalTrust) MarshalJSON() ([]byte, error) { + return (*reputation.GlobalTrust)(x). + MarshalJSON() +} + +// UnmarshalJSON decodes GlobalTrust from protobuf JSON format. +func (x *GlobalTrust) UnmarshalJSON(data []byte) error { + return (*reputation.GlobalTrust)(x). + UnmarshalJSON(data) +} diff --git a/pkg/reputation/trust_test.go b/pkg/reputation/trust_test.go index 5a36c01..8881777 100644 --- a/pkg/reputation/trust_test.go +++ b/pkg/reputation/trust_test.go @@ -3,8 +3,10 @@ package reputation_test import ( "testing" + "github.com/nspcc-dev/neofs-api-go/pkg" "github.com/nspcc-dev/neofs-api-go/pkg/reputation" reputationtest "github.com/nspcc-dev/neofs-api-go/pkg/reputation/test" + reputationtestV2 "github.com/nspcc-dev/neofs-api-go/v2/reputation/test" "github.com/stretchr/testify/require" ) @@ -39,3 +41,65 @@ func TestTrust(t *testing.T) { require.Equal(t, trust, trust2) }) } + +func TestGlobalTrust(t *testing.T) { + t.Run("v2", func(t *testing.T) { + gtV2 := reputationtestV2.GenerateGlobalTrust(false) + + gt := reputation.GlobalTrustFromV2(gtV2) + + require.Equal(t, gtV2, gt.ToV2()) + }) + + t.Run("getters+setters", func(t *testing.T) { + gt := reputation.NewGlobalTrust() + + require.Equal(t, pkg.SDKVersion(), gt.Version()) + require.Nil(t, gt.Manager()) + require.Nil(t, gt.Trust()) + + version := pkg.NewVersion() + version.SetMajor(13) + version.SetMinor(31) + gt.SetVersion(version) + require.Equal(t, version, gt.Version()) + + mngr := reputationtest.GeneratePeerID() + gt.SetManager(mngr) + require.Equal(t, mngr, gt.Manager()) + + trust := reputationtest.GenerateTrust() + gt.SetTrust(trust) + require.Equal(t, trust, gt.Trust()) + }) + + t.Run("sign+verify", func(t *testing.T) { + gt := reputationtest.GenerateSignedGlobalTrust(t) + + err := gt.VerifySignature() + require.NoError(t, err) + }) + + t.Run("encoding", func(t *testing.T) { + t.Run("binary", func(t *testing.T) { + gt := reputationtest.GenerateSignedGlobalTrust(t) + + data, err := gt.Marshal() + require.NoError(t, err) + + gt2 := reputation.NewGlobalTrust() + require.NoError(t, gt2.Unmarshal(data)) + require.Equal(t, gt, gt2) + }) + + t.Run("JSON", func(t *testing.T) { + gt := reputationtest.GenerateSignedGlobalTrust(t) + data, err := gt.MarshalJSON() + require.NoError(t, err) + + gt2 := reputation.NewGlobalTrust() + require.NoError(t, gt2.UnmarshalJSON(data)) + require.Equal(t, gt, gt2) + }) + }) +} From 269288119db586282d4df3bfb408a31a48ad7315 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 9 Apr 2021 11:28:06 +0300 Subject: [PATCH 0723/1196] [#265] v2/reputation: Support PeerToPeerTrust message Signed-off-by: Leonard Lyubich --- v2/reputation/convert.go | 57 +++++++++- v2/reputation/grpc/service.go | 2 +- v2/reputation/grpc/service.pb.go | 99 ++++++++--------- v2/reputation/grpc/types.go | 14 +++ v2/reputation/grpc/types.pb.go | 180 ++++++++++++++++++++++--------- v2/reputation/json.go | 8 ++ v2/reputation/marshal.go | 39 +++++++ v2/reputation/message_test.go | 1 + v2/reputation/test/generate.go | 11 +- v2/reputation/types.go | 46 +++++++- 10 files changed, 353 insertions(+), 104 deletions(-) diff --git a/v2/reputation/convert.go b/v2/reputation/convert.go index 19be9f0..52df2fa 100644 --- a/v2/reputation/convert.go +++ b/v2/reputation/convert.go @@ -81,6 +81,61 @@ func (x *Trust) FromGRPCMessage(m grpc.Message) error { return nil } +// ToGRPCMessage converts PeerToPeerTrust to gRPC-generated +// reputation.PeerToPeerTrust message. +func (x *PeerToPeerTrust) ToGRPCMessage() grpc.Message { + var m *reputation.PeerToPeerTrust + + if x != nil { + m = new(reputation.PeerToPeerTrust) + + m.SetTrustingPeer(x.trusting.ToGRPCMessage().(*reputation.PeerID)) + m.SetTrust(x.trust.ToGRPCMessage().(*reputation.Trust)) + } + + return m +} + +// FromGRPCMessage tries to restore PeerToPeerTrust from grpc.Message. +// +// Returns message.ErrUnexpectedMessageType if m is not +// a gRPC-generated reputation.PeerToPeerTrust message. +func (x *PeerToPeerTrust) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*reputation.PeerToPeerTrust) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + trusting := v.GetTrustingPeer() + if trusting == nil { + x.trusting = nil + } else { + if x.trusting == nil { + x.trusting = new(PeerID) + } + + err = x.trusting.FromGRPCMessage(trusting) + if err != nil { + return err + } + } + + trust := v.GetTrust() + if trust == nil { + x.trust = nil + } else { + if x.trust == nil { + x.trust = new(Trust) + } + + err = x.trust.FromGRPCMessage(trust) + } + + return err +} + // TrustsToGRPC converts slice of Trust structures // to slice of gRPC-generated Trust messages. func TrustsToGRPC(xs []*Trust) (res []*reputation.Trust) { @@ -404,7 +459,7 @@ func (x *SendIntermediateResultRequestBody) ToGRPCMessage() grpc.Message { m = new(reputation.SendIntermediateResultRequest_Body) m.SetIteration(x.iter) - m.SetTrust(x.trust.ToGRPCMessage().(*reputation.Trust)) + m.SetTrust(x.trust.ToGRPCMessage().(*reputation.PeerToPeerTrust)) } return m diff --git a/v2/reputation/grpc/service.go b/v2/reputation/grpc/service.go index bf8626e..2104d94 100644 --- a/v2/reputation/grpc/service.go +++ b/v2/reputation/grpc/service.go @@ -68,7 +68,7 @@ func (x *SendIntermediateResultRequest_Body) SetIteration(v uint32) { } // SetTrust sets current global trust value. -func (x *SendIntermediateResultRequest_Body) SetTrust(v *Trust) { +func (x *SendIntermediateResultRequest_Body) SetTrust(v *PeerToPeerTrust) { if x != nil { x.Trust = v } diff --git a/v2/reputation/grpc/service.pb.go b/v2/reputation/grpc/service.pb.go index fea43ea..0116189 100644 --- a/v2/reputation/grpc/service.pb.go +++ b/v2/reputation/grpc/service.pb.go @@ -418,7 +418,7 @@ type SendIntermediateResultRequest_Body struct { // Sequence number of the iteration. Iteration uint32 `protobuf:"varint,1,opt,name=iteration,proto3" json:"iteration,omitempty"` // Current global trust value computed at the specified iteration. - Trust *Trust `protobuf:"bytes,2,opt,name=trust,proto3" json:"trust,omitempty"` + Trust *PeerToPeerTrust `protobuf:"bytes,2,opt,name=trust,proto3" json:"trust,omitempty"` } func (x *SendIntermediateResultRequest_Body) Reset() { @@ -460,7 +460,7 @@ func (x *SendIntermediateResultRequest_Body) GetIteration() uint32 { return 0 } -func (x *SendIntermediateResultRequest_Body) GetTrust() *Trust { +func (x *SendIntermediateResultRequest_Body) GetTrust() *PeerToPeerTrust { if x != nil { return x.Trust } @@ -553,7 +553,7 @@ var file_v2_reputation_grpc_service_proto_rawDesc = []byte{ 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, 0x06, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x22, 0xe0, 0x02, 0x0a, 0x1d, 0x53, 0x65, 0x6e, + 0x1a, 0x06, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x22, 0xea, 0x02, 0x0a, 0x1d, 0x53, 0x65, 0x6e, 0x64, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x4c, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x38, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, @@ -570,53 +570,53 @@ var file_v2_reputation_grpc_service_proto_rawDesc = []byte{ 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, 0x57, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x1c, 0x0a, 0x09, 0x69, 0x74, + 0x65, 0x72, 0x1a, 0x61, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x1c, 0x0a, 0x09, 0x69, 0x74, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x69, - 0x74, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x31, 0x0a, 0x05, 0x74, 0x72, 0x75, 0x73, - 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, - 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x54, - 0x72, 0x75, 0x73, 0x74, 0x52, 0x05, 0x74, 0x72, 0x75, 0x73, 0x74, 0x22, 0x93, 0x02, 0x0a, 0x1e, - 0x53, 0x65, 0x6e, 0x64, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x74, 0x65, - 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4d, - 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x39, 0x2e, 0x6e, - 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6d, 0x65, 0x64, - 0x69, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 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, 0x06, 0x0a, 0x04, 0x42, 0x6f, 0x64, - 0x79, 0x32, 0x86, 0x02, 0x0a, 0x11, 0x52, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x6b, 0x0a, 0x0e, 0x53, 0x65, 0x6e, 0x64, 0x4c, - 0x6f, 0x63, 0x61, 0x6c, 0x54, 0x72, 0x75, 0x73, 0x74, 0x12, 0x2b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, - 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x54, 0x72, 0x75, 0x73, 0x74, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, + 0x74, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3b, 0x0a, 0x05, 0x74, 0x72, 0x75, 0x73, + 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, + 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x50, + 0x65, 0x65, 0x72, 0x54, 0x6f, 0x50, 0x65, 0x65, 0x72, 0x54, 0x72, 0x75, 0x73, 0x74, 0x52, 0x05, + 0x74, 0x72, 0x75, 0x73, 0x74, 0x22, 0x93, 0x02, 0x0a, 0x1e, 0x53, 0x65, 0x6e, 0x64, 0x49, 0x6e, + 0x74, 0x65, 0x72, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4d, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x39, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x65, - 0x6e, 0x64, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x54, 0x72, 0x75, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x83, 0x01, 0x0a, 0x16, 0x53, 0x65, 0x6e, 0x64, 0x49, 0x6e, 0x74, - 0x65, 0x72, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, - 0x33, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, - 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x49, 0x6e, 0x74, 0x65, 0x72, - 0x6d, 0x65, 0x64, 0x69, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x34, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, - 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x65, 0x6e, 0x64, - 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x75, - 0x6c, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x62, 0x5a, 0x3f, 0x67, 0x69, - 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, - 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, - 0x76, 0x32, 0x2f, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x67, 0x72, - 0x70, 0x63, 0x3b, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xaa, 0x02, 0x1e, - 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, - 0x41, 0x50, 0x49, 0x2e, 0x52, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x62, 0x06, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6e, 0x64, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x74, 0x65, 0x52, 0x65, + 0x73, 0x75, 0x6c, 0x74, 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, 0x06, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x32, 0x86, 0x02, 0x0a, 0x11, + 0x52, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x12, 0x6b, 0x0a, 0x0e, 0x53, 0x65, 0x6e, 0x64, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x54, 0x72, + 0x75, 0x73, 0x74, 0x12, 0x2b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, + 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x4c, + 0x6f, 0x63, 0x61, 0x6c, 0x54, 0x72, 0x75, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x2c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, + 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x4c, 0x6f, 0x63, 0x61, + 0x6c, 0x54, 0x72, 0x75, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x83, + 0x01, 0x0a, 0x16, 0x53, 0x65, 0x6e, 0x64, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6d, 0x65, 0x64, 0x69, + 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x33, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, + 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x74, + 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x34, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6d, + 0x65, 0x64, 0x69, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x62, 0x5a, 0x3f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, + 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, + 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x72, 0x65, 0x70, + 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x72, 0x65, 0x70, + 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xaa, 0x02, 0x1e, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, + 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x52, 0x65, + 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -646,6 +646,7 @@ var file_v2_reputation_grpc_service_proto_goTypes = []interface{}{ (*grpc.ResponseMetaHeader)(nil), // 10: neo.fs.v2.session.ResponseMetaHeader (*grpc.ResponseVerificationHeader)(nil), // 11: neo.fs.v2.session.ResponseVerificationHeader (*Trust)(nil), // 12: neo.fs.v2.reputation.Trust + (*PeerToPeerTrust)(nil), // 13: neo.fs.v2.reputation.PeerToPeerTrust } var file_v2_reputation_grpc_service_proto_depIdxs = []int32{ 4, // 0: neo.fs.v2.reputation.SendLocalTrustRequest.body:type_name -> neo.fs.v2.reputation.SendLocalTrustRequest.Body @@ -661,7 +662,7 @@ var file_v2_reputation_grpc_service_proto_depIdxs = []int32{ 10, // 10: neo.fs.v2.reputation.SendIntermediateResultResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader 11, // 11: neo.fs.v2.reputation.SendIntermediateResultResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader 12, // 12: neo.fs.v2.reputation.SendLocalTrustRequest.Body.trusts:type_name -> neo.fs.v2.reputation.Trust - 12, // 13: neo.fs.v2.reputation.SendIntermediateResultRequest.Body.trust:type_name -> neo.fs.v2.reputation.Trust + 13, // 13: neo.fs.v2.reputation.SendIntermediateResultRequest.Body.trust:type_name -> neo.fs.v2.reputation.PeerToPeerTrust 0, // 14: neo.fs.v2.reputation.ReputationService.SendLocalTrust:input_type -> neo.fs.v2.reputation.SendLocalTrustRequest 2, // 15: neo.fs.v2.reputation.ReputationService.SendIntermediateResult:input_type -> neo.fs.v2.reputation.SendIntermediateResultRequest 1, // 16: neo.fs.v2.reputation.ReputationService.SendLocalTrust:output_type -> neo.fs.v2.reputation.SendLocalTrustResponse diff --git a/v2/reputation/grpc/types.go b/v2/reputation/grpc/types.go index 0a469bd..07d1d8b 100644 --- a/v2/reputation/grpc/types.go +++ b/v2/reputation/grpc/types.go @@ -25,6 +25,20 @@ func (x *Trust) SetValue(v float64) { } } +// SetTrustingPeer sets trusting peer ID. +func (x *PeerToPeerTrust) SetTrustingPeer(v *PeerID) { + if x != nil { + x.TrustingPeer = v + } +} + +// SetTrust sets trust value of trusting peer to the trusted one. +func (x *PeerToPeerTrust) SetTrust(v *Trust) { + if x != nil { + x.Trust = v + } +} + // SetManager sets manager ID. func (x *GlobalTrust_Body) SetManager(v *PeerID) { if x != nil { diff --git a/v2/reputation/grpc/types.pb.go b/v2/reputation/grpc/types.pb.go index c2adca5..7c4ec04 100644 --- a/v2/reputation/grpc/types.pb.go +++ b/v2/reputation/grpc/types.pb.go @@ -145,6 +145,64 @@ func (x *Trust) GetValue() float64 { return 0 } +// Trust value of a peer to a peer. +type PeerToPeerTrust struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Identifier of the trusting peer. + TrustingPeer *PeerID `protobuf:"bytes,1,opt,name=trusting_peer,json=trustingPeer,proto3" json:"trusting_peer,omitempty"` + // Trust value. + Trust *Trust `protobuf:"bytes,2,opt,name=trust,proto3" json:"trust,omitempty"` +} + +func (x *PeerToPeerTrust) Reset() { + *x = PeerToPeerTrust{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_reputation_grpc_types_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PeerToPeerTrust) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PeerToPeerTrust) ProtoMessage() {} + +func (x *PeerToPeerTrust) ProtoReflect() protoreflect.Message { + mi := &file_v2_reputation_grpc_types_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PeerToPeerTrust.ProtoReflect.Descriptor instead. +func (*PeerToPeerTrust) Descriptor() ([]byte, []int) { + return file_v2_reputation_grpc_types_proto_rawDescGZIP(), []int{2} +} + +func (x *PeerToPeerTrust) GetTrustingPeer() *PeerID { + if x != nil { + return x.TrustingPeer + } + return nil +} + +func (x *PeerToPeerTrust) GetTrust() *Trust { + if x != nil { + return x.Trust + } + return nil +} + // Global trust value to NeoFS network peer. type GlobalTrust struct { state protoimpl.MessageState @@ -163,7 +221,7 @@ type GlobalTrust struct { func (x *GlobalTrust) Reset() { *x = GlobalTrust{} if protoimpl.UnsafeEnabled { - mi := &file_v2_reputation_grpc_types_proto_msgTypes[2] + mi := &file_v2_reputation_grpc_types_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -176,7 +234,7 @@ func (x *GlobalTrust) String() string { func (*GlobalTrust) ProtoMessage() {} func (x *GlobalTrust) ProtoReflect() protoreflect.Message { - mi := &file_v2_reputation_grpc_types_proto_msgTypes[2] + mi := &file_v2_reputation_grpc_types_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -189,7 +247,7 @@ func (x *GlobalTrust) ProtoReflect() protoreflect.Message { // Deprecated: Use GlobalTrust.ProtoReflect.Descriptor instead. func (*GlobalTrust) Descriptor() ([]byte, []int) { - return file_v2_reputation_grpc_types_proto_rawDescGZIP(), []int{2} + return file_v2_reputation_grpc_types_proto_rawDescGZIP(), []int{3} } func (x *GlobalTrust) GetVersion() *grpc.Version { @@ -228,7 +286,7 @@ type GlobalTrust_Body struct { func (x *GlobalTrust_Body) Reset() { *x = GlobalTrust_Body{} if protoimpl.UnsafeEnabled { - mi := &file_v2_reputation_grpc_types_proto_msgTypes[3] + mi := &file_v2_reputation_grpc_types_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -241,7 +299,7 @@ func (x *GlobalTrust_Body) String() string { func (*GlobalTrust_Body) ProtoMessage() {} func (x *GlobalTrust_Body) ProtoReflect() protoreflect.Message { - mi := &file_v2_reputation_grpc_types_proto_msgTypes[3] + mi := &file_v2_reputation_grpc_types_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -254,7 +312,7 @@ func (x *GlobalTrust_Body) ProtoReflect() protoreflect.Message { // Deprecated: Use GlobalTrust_Body.ProtoReflect.Descriptor instead. func (*GlobalTrust_Body) Descriptor() ([]byte, []int) { - return file_v2_reputation_grpc_types_proto_rawDescGZIP(), []int{2, 0} + return file_v2_reputation_grpc_types_proto_rawDescGZIP(), []int{3, 0} } func (x *GlobalTrust_Body) GetManager() *PeerID { @@ -286,32 +344,41 @@ var file_v2_reputation_grpc_types_proto_rawDesc = []byte{ 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x49, 0x44, 0x52, 0x04, 0x70, 0x65, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x22, 0xa8, 0x02, 0x0a, 0x0b, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x54, 0x72, 0x75, 0x73, - 0x74, 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, 0x3a, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, - 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, - 0x54, 0x72, 0x75, 0x73, 0x74, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, - 0x12, 0x37, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, - 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, - 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x1a, 0x71, 0x0a, 0x04, 0x42, 0x6f, 0x64, - 0x79, 0x12, 0x36, 0x0a, 0x07, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, - 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x49, 0x44, - 0x52, 0x07, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x12, 0x31, 0x0a, 0x05, 0x74, 0x72, 0x75, - 0x73, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, - 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, - 0x54, 0x72, 0x75, 0x73, 0x74, 0x52, 0x05, 0x74, 0x72, 0x75, 0x73, 0x74, 0x42, 0x62, 0x5a, 0x3f, - 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, - 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, - 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, - 0x67, 0x72, 0x70, 0x63, 0x3b, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xaa, - 0x02, 0x1e, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, - 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x52, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x65, 0x22, 0x87, 0x01, 0x0a, 0x0f, 0x50, 0x65, 0x65, 0x72, 0x54, 0x6f, 0x50, 0x65, 0x65, 0x72, + 0x54, 0x72, 0x75, 0x73, 0x74, 0x12, 0x41, 0x0a, 0x0d, 0x74, 0x72, 0x75, 0x73, 0x74, 0x69, 0x6e, + 0x67, 0x5f, 0x70, 0x65, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x49, 0x44, 0x52, 0x0c, 0x74, 0x72, 0x75, 0x73, + 0x74, 0x69, 0x6e, 0x67, 0x50, 0x65, 0x65, 0x72, 0x12, 0x31, 0x0a, 0x05, 0x74, 0x72, 0x75, 0x73, + 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, + 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x54, + 0x72, 0x75, 0x73, 0x74, 0x52, 0x05, 0x74, 0x72, 0x75, 0x73, 0x74, 0x22, 0xa8, 0x02, 0x0a, 0x0b, + 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x54, 0x72, 0x75, 0x73, 0x74, 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, 0x3a, + 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x2e, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x54, 0x72, 0x75, 0x73, 0x74, 0x2e, + 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x37, 0x0a, 0x09, 0x73, 0x69, + 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, + 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, + 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, + 0x75, 0x72, 0x65, 0x1a, 0x71, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x36, 0x0a, 0x07, 0x6d, + 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x49, 0x44, 0x52, 0x07, 0x6d, 0x61, 0x6e, 0x61, + 0x67, 0x65, 0x72, 0x12, 0x31, 0x0a, 0x05, 0x74, 0x72, 0x75, 0x73, 0x74, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, + 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x54, 0x72, 0x75, 0x73, 0x74, 0x52, + 0x05, 0x74, 0x72, 0x75, 0x73, 0x74, 0x42, 0x62, 0x5a, 0x3f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, + 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, + 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x72, + 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x72, + 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xaa, 0x02, 0x1e, 0x4e, 0x65, 0x6f, 0x2e, + 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, + 0x52, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, } var ( @@ -326,27 +393,30 @@ func file_v2_reputation_grpc_types_proto_rawDescGZIP() []byte { return file_v2_reputation_grpc_types_proto_rawDescData } -var file_v2_reputation_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_v2_reputation_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 5) var file_v2_reputation_grpc_types_proto_goTypes = []interface{}{ (*PeerID)(nil), // 0: neo.fs.v2.reputation.PeerID (*Trust)(nil), // 1: neo.fs.v2.reputation.Trust - (*GlobalTrust)(nil), // 2: neo.fs.v2.reputation.GlobalTrust - (*GlobalTrust_Body)(nil), // 3: neo.fs.v2.reputation.GlobalTrust.Body - (*grpc.Version)(nil), // 4: neo.fs.v2.refs.Version - (*grpc.Signature)(nil), // 5: neo.fs.v2.refs.Signature + (*PeerToPeerTrust)(nil), // 2: neo.fs.v2.reputation.PeerToPeerTrust + (*GlobalTrust)(nil), // 3: neo.fs.v2.reputation.GlobalTrust + (*GlobalTrust_Body)(nil), // 4: neo.fs.v2.reputation.GlobalTrust.Body + (*grpc.Version)(nil), // 5: neo.fs.v2.refs.Version + (*grpc.Signature)(nil), // 6: neo.fs.v2.refs.Signature } var file_v2_reputation_grpc_types_proto_depIdxs = []int32{ 0, // 0: neo.fs.v2.reputation.Trust.peer:type_name -> neo.fs.v2.reputation.PeerID - 4, // 1: neo.fs.v2.reputation.GlobalTrust.version:type_name -> neo.fs.v2.refs.Version - 3, // 2: neo.fs.v2.reputation.GlobalTrust.body:type_name -> neo.fs.v2.reputation.GlobalTrust.Body - 5, // 3: neo.fs.v2.reputation.GlobalTrust.signature:type_name -> neo.fs.v2.refs.Signature - 0, // 4: neo.fs.v2.reputation.GlobalTrust.Body.manager:type_name -> neo.fs.v2.reputation.PeerID - 1, // 5: neo.fs.v2.reputation.GlobalTrust.Body.trust:type_name -> neo.fs.v2.reputation.Trust - 6, // [6:6] is the sub-list for method output_type - 6, // [6:6] is the sub-list for method input_type - 6, // [6:6] is the sub-list for extension type_name - 6, // [6:6] is the sub-list for extension extendee - 0, // [0:6] is the sub-list for field type_name + 0, // 1: neo.fs.v2.reputation.PeerToPeerTrust.trusting_peer:type_name -> neo.fs.v2.reputation.PeerID + 1, // 2: neo.fs.v2.reputation.PeerToPeerTrust.trust:type_name -> neo.fs.v2.reputation.Trust + 5, // 3: neo.fs.v2.reputation.GlobalTrust.version:type_name -> neo.fs.v2.refs.Version + 4, // 4: neo.fs.v2.reputation.GlobalTrust.body:type_name -> neo.fs.v2.reputation.GlobalTrust.Body + 6, // 5: neo.fs.v2.reputation.GlobalTrust.signature:type_name -> neo.fs.v2.refs.Signature + 0, // 6: neo.fs.v2.reputation.GlobalTrust.Body.manager:type_name -> neo.fs.v2.reputation.PeerID + 1, // 7: neo.fs.v2.reputation.GlobalTrust.Body.trust:type_name -> neo.fs.v2.reputation.Trust + 8, // [8:8] is the sub-list for method output_type + 8, // [8:8] 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_v2_reputation_grpc_types_proto_init() } @@ -380,7 +450,7 @@ func file_v2_reputation_grpc_types_proto_init() { } } file_v2_reputation_grpc_types_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GlobalTrust); i { + switch v := v.(*PeerToPeerTrust); i { case 0: return &v.state case 1: @@ -392,6 +462,18 @@ func file_v2_reputation_grpc_types_proto_init() { } } file_v2_reputation_grpc_types_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GlobalTrust); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_reputation_grpc_types_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GlobalTrust_Body); i { case 0: return &v.state @@ -410,7 +492,7 @@ func file_v2_reputation_grpc_types_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_v2_reputation_grpc_types_proto_rawDesc, NumEnums: 0, - NumMessages: 4, + NumMessages: 5, NumExtensions: 0, NumServices: 0, }, diff --git a/v2/reputation/json.go b/v2/reputation/json.go index 637035a..5ee1cc2 100644 --- a/v2/reputation/json.go +++ b/v2/reputation/json.go @@ -21,6 +21,14 @@ func (x *Trust) UnmarshalJSON(data []byte) error { return message.UnmarshalJSON(x, data, new(reputation.Trust)) } +func (x *PeerToPeerTrust) MarshalJSON() ([]byte, error) { + return message.MarshalJSON(x) +} + +func (x *PeerToPeerTrust) UnmarshalJSON(data []byte) error { + return message.UnmarshalJSON(x, data, new(reputation.PeerToPeerTrust)) +} + func (x *GlobalTrust) MarshalJSON() ([]byte, error) { return message.MarshalJSON(x) } diff --git a/v2/reputation/marshal.go b/v2/reputation/marshal.go index 76b5e9d..20fa677 100644 --- a/v2/reputation/marshal.go +++ b/v2/reputation/marshal.go @@ -84,6 +84,45 @@ func (x *Trust) Unmarshal(data []byte) error { return message.Unmarshal(x, data, new(reputation.Trust)) } +const ( + _ = iota + p2pTrustTrustingFNum + p2pTrustValueFNum +) + +func (x *PeerToPeerTrust) StableMarshal(buf []byte) ([]byte, error) { + if x == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, x.StableSize()) + } + + offset, err := protoutil.NestedStructureMarshal(p2pTrustTrustingFNum, buf, x.trusting) + if err != nil { + return nil, err + } + + _, err = protoutil.NestedStructureMarshal(p2pTrustValueFNum, buf[offset:], x.trust) + if err != nil { + return nil, err + } + + return buf, nil +} + +func (x *PeerToPeerTrust) StableSize() (size int) { + size += protoutil.NestedStructureSize(p2pTrustTrustingFNum, x.trusting) + size += protoutil.NestedStructureSize(p2pTrustValueFNum, x.trust) + + return +} + +func (x *PeerToPeerTrust) Unmarshal(data []byte) error { + return message.Unmarshal(x, data, new(reputation.PeerToPeerTrust)) +} + const ( _ = iota globalTrustBodyManagerFNum diff --git a/v2/reputation/message_test.go b/v2/reputation/message_test.go index ecbec7b..2d5899a 100644 --- a/v2/reputation/message_test.go +++ b/v2/reputation/message_test.go @@ -25,5 +25,6 @@ func TestMessageConvert(t *testing.T) { func(empty bool) message.Message { return reputationtest.GenerateSendIntermediateResultResponse(empty) }, func(empty bool) message.Message { return reputationtest.GenerateGlobalTrustBody(empty) }, func(empty bool) message.Message { return reputationtest.GenerateGlobalTrust(empty) }, + func(empty bool) message.Message { return reputationtest.GeneratePeerToPeerTrust(empty) }, ) } diff --git a/v2/reputation/test/generate.go b/v2/reputation/test/generate.go index 4cb525f..65e50e8 100644 --- a/v2/reputation/test/generate.go +++ b/v2/reputation/test/generate.go @@ -28,6 +28,15 @@ func GenerateTrust(empty bool) *reputation.Trust { return m } +func GeneratePeerToPeerTrust(empty bool) *reputation.PeerToPeerTrust { + m := new(reputation.PeerToPeerTrust) + + m.SetTrustingPeer(GeneratePeerID(empty)) + m.SetTrust(GenerateTrust(empty)) + + return m +} + func GenerateGlobalTrustBody(empty bool) *reputation.GlobalTrustBody { m := new(reputation.GlobalTrustBody) @@ -103,7 +112,7 @@ func GenerateSendIntermediateResultRequestBody(empty bool) *reputation.SendInter m.SetIteration(564) } - m.SetTrust(GenerateTrust(empty)) + m.SetTrust(GeneratePeerToPeerTrust(empty)) return m } diff --git a/v2/reputation/types.go b/v2/reputation/types.go index 3b67c13..b7ef545 100644 --- a/v2/reputation/types.go +++ b/v2/reputation/types.go @@ -67,6 +67,46 @@ func (x *Trust) SetValue(v float64) { } } +// PeerToPeerTrust represents reputation.PeerToPeerTrust message +// from NeoFS API v2. +type PeerToPeerTrust struct { + trusting *PeerID + + trust *Trust +} + +// GetTrustingPeer returns trusting peer ID. +func (x *PeerToPeerTrust) GetTrustingPeer() *PeerID { + if x != nil { + return x.trusting + } + + return nil +} + +// SetTrustingPeer sets trusting peer ID. +func (x *PeerToPeerTrust) SetTrustingPeer(v *PeerID) { + if x != nil { + x.trusting = v + } +} + +// GetTrust returns trust value of trusting peer to the trusted one. +func (x *PeerToPeerTrust) GetTrust() *Trust { + if x != nil { + return x.trust + } + + return nil +} + +// SetTrust sets trust value of trusting peer to the trusted one. +func (x *PeerToPeerTrust) SetTrust(v *Trust) { + if x != nil { + x.trust = v + } +} + // GlobalTrustBody represents reputation.GlobalTrust.Body message // from NeoFS API v2. type GlobalTrustBody struct { @@ -259,7 +299,7 @@ func (x *SendLocalTrustResponse) SetBody(v *SendLocalTrustResponseBody) { type SendIntermediateResultRequestBody struct { iter uint32 - trust *Trust + trust *PeerToPeerTrust } // GetIteration returns sequence number of the iteration. @@ -279,7 +319,7 @@ func (x *SendIntermediateResultRequestBody) SetIteration(v uint32) { } // GetTrust returns current global trust value. -func (x *SendIntermediateResultRequestBody) GetTrust() *Trust { +func (x *SendIntermediateResultRequestBody) GetTrust() *PeerToPeerTrust { if x != nil { return x.trust } @@ -288,7 +328,7 @@ func (x *SendIntermediateResultRequestBody) GetTrust() *Trust { } // SetTrust sets current global trust value. -func (x *SendIntermediateResultRequestBody) SetTrust(v *Trust) { +func (x *SendIntermediateResultRequestBody) SetTrust(v *PeerToPeerTrust) { if x != nil { x.trust = v } From a61c15b9902119772e020e30cb9a4749d576f5da Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 9 Apr 2021 11:39:25 +0300 Subject: [PATCH 0724/1196] [#265] pkg/reputation: Implement PeerToPeerTrust structure Signed-off-by: Leonard Lyubich --- pkg/reputation/test/generate.go | 8 ++++ pkg/reputation/trust.go | 80 +++++++++++++++++++++++++++++++++ pkg/reputation/trust_test.go | 47 +++++++++++++++++++ 3 files changed, 135 insertions(+) diff --git a/pkg/reputation/test/generate.go b/pkg/reputation/test/generate.go index 0d1f11e..c103800 100644 --- a/pkg/reputation/test/generate.go +++ b/pkg/reputation/test/generate.go @@ -28,6 +28,14 @@ func GenerateTrust() *reputation.Trust { return v } +func GeneratePeerToPeerTrust() *reputation.PeerToPeerTrust { + v := reputation.NewPeerToPeerTrust() + v.SetTrustingPeer(GeneratePeerID()) + v.SetTrust(GenerateTrust()) + + return v +} + func GenerateGlobalTrust() *reputation.GlobalTrust { v := reputation.NewGlobalTrust() v.SetManager(GeneratePeerID()) diff --git a/pkg/reputation/trust.go b/pkg/reputation/trust.go index 960a22d..5a25b69 100644 --- a/pkg/reputation/trust.go +++ b/pkg/reputation/trust.go @@ -100,6 +100,86 @@ func (x *Trust) UnmarshalJSON(data []byte) error { UnmarshalJSON(data) } +// PeerToPeerTrust represents directed peer-to-peer trust +// compatible with NeoFS API v2. +type PeerToPeerTrust reputation.PeerToPeerTrust + +// NewPeerToPeerTrust creates and returns blank PeerToPeerTrust. +func NewPeerToPeerTrust() *PeerToPeerTrust { + return PeerToPeerTrustFromV2(new(reputation.PeerToPeerTrust)) +} + +// PeerToPeerTrustFromV2 converts NeoFS API v2 +// reputation.PeerToPeerTrust message structure to PeerToPeerTrust. +func PeerToPeerTrustFromV2(t *reputation.PeerToPeerTrust) *PeerToPeerTrust { + return (*PeerToPeerTrust)(t) +} + +// ToV2 converts PeerToPeerTrust to NeoFS API v2 +// reputation.PeerToPeerTrust message structure. +func (x *PeerToPeerTrust) ToV2() *reputation.PeerToPeerTrust { + return (*reputation.PeerToPeerTrust)(x) +} + +// SetTrustingPeer sets trusting peer ID. +func (x *PeerToPeerTrust) SetTrustingPeer(id *PeerID) { + (*reputation.PeerToPeerTrust)(x). + SetTrustingPeer(id.ToV2()) +} + +// TrustingPeer returns trusting peer ID. +func (x *PeerToPeerTrust) TrustingPeer() *PeerID { + return PeerIDFromV2( + (*reputation.PeerToPeerTrust)(x). + GetTrustingPeer(), + ) +} + +// SetTrust sets trust value of the trusting peer to the trusted one. +func (x *PeerToPeerTrust) SetTrust(t *Trust) { + (*reputation.PeerToPeerTrust)(x). + SetTrust(t.ToV2()) +} + +// Trust returns trust value of the trusting peer to the trusted one. +func (x *PeerToPeerTrust) Trust() *Trust { + return TrustFromV2( + (*reputation.PeerToPeerTrust)(x). + GetTrust(), + ) +} + +// Marshal marshals PeerToPeerTrust into a protobuf binary form. +// +// Buffer is allocated when the argument is empty. +// Otherwise, the first buffer is used. +func (x *PeerToPeerTrust) Marshal(b ...[]byte) ([]byte, error) { + var buf []byte + if len(b) > 0 { + buf = b[0] + } + + return (*reputation.PeerToPeerTrust)(x).StableMarshal(buf) +} + +// Unmarshal unmarshals protobuf binary representation of PeerToPeerTrust. +func (x *PeerToPeerTrust) Unmarshal(data []byte) error { + return (*reputation.PeerToPeerTrust)(x). + Unmarshal(data) +} + +// MarshalJSON encodes PeerToPeerTrust to protobuf JSON format. +func (x *PeerToPeerTrust) MarshalJSON() ([]byte, error) { + return (*reputation.PeerToPeerTrust)(x). + MarshalJSON() +} + +// UnmarshalJSON decodes PeerToPeerTrust from protobuf JSON format. +func (x *PeerToPeerTrust) UnmarshalJSON(data []byte) error { + return (*reputation.PeerToPeerTrust)(x). + UnmarshalJSON(data) +} + // GlobalTrust represents peer's global trust compatible with NeoFS API v2. type GlobalTrust reputation.GlobalTrust diff --git a/pkg/reputation/trust_test.go b/pkg/reputation/trust_test.go index 8881777..0e908ec 100644 --- a/pkg/reputation/trust_test.go +++ b/pkg/reputation/trust_test.go @@ -42,6 +42,53 @@ func TestTrust(t *testing.T) { }) } +func TestPeerToPeerTrust(t *testing.T) { + t.Run("v2", func(t *testing.T) { + p2ptV2 := reputationtestV2.GeneratePeerToPeerTrust(false) + + p2pt := reputation.PeerToPeerTrustFromV2(p2ptV2) + + require.Equal(t, p2ptV2, p2pt.ToV2()) + }) + + t.Run("getters+setters", func(t *testing.T) { + p2pt := reputation.NewPeerToPeerTrust() + + require.Nil(t, p2pt.TrustingPeer()) + require.Nil(t, p2pt.Trust()) + + trusting := reputationtest.GeneratePeerID() + p2pt.SetTrustingPeer(trusting) + require.Equal(t, trusting, p2pt.TrustingPeer()) + + trust := reputationtest.GenerateTrust() + p2pt.SetTrust(trust) + require.Equal(t, trust, p2pt.Trust()) + }) + + t.Run("encoding", func(t *testing.T) { + p2pt := reputationtest.GeneratePeerToPeerTrust() + + t.Run("binary", func(t *testing.T) { + data, err := p2pt.Marshal() + require.NoError(t, err) + + p2pt2 := reputation.NewPeerToPeerTrust() + require.NoError(t, p2pt2.Unmarshal(data)) + require.Equal(t, p2pt, p2pt2) + }) + + t.Run("JSON", func(t *testing.T) { + data, err := p2pt.MarshalJSON() + require.NoError(t, err) + + p2pt2 := reputation.NewPeerToPeerTrust() + require.NoError(t, p2pt2.UnmarshalJSON(data)) + require.Equal(t, p2pt, p2pt2) + }) + }) +} + func TestGlobalTrust(t *testing.T) { t.Run("v2", func(t *testing.T) { gtV2 := reputationtestV2.GenerateGlobalTrust(false) From 8128d598d022dea523bc3365b65479312d018f3d Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 9 Apr 2021 11:41:58 +0300 Subject: [PATCH 0725/1196] [#265] pkg/client: Change trust type in SendIntermediateTrustPrm Change accepted/returned value type of `SetTrust` / `Trust` methods of `SendIntermediateTrustPrm` structure to `reputation.PeerToPeerTrust`. Signed-off-by: Leonard Lyubich --- pkg/client/reputation.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/client/reputation.go b/pkg/client/reputation.go index 261da88..2ee6bc1 100644 --- a/pkg/client/reputation.go +++ b/pkg/client/reputation.go @@ -89,7 +89,7 @@ func (c *clientImpl) SendLocalTrust(ctx context.Context, prm SendLocalTrustPrm, type SendIntermediateTrustPrm struct { iter uint32 - trust *reputation.Trust + trust *reputation.PeerToPeerTrust } // Iteration returns sequence number of the iteration. @@ -103,12 +103,12 @@ func (x *SendIntermediateTrustPrm) SetIteration(iter uint32) { } // Trust returns current global trust value computed at the specified iteration. -func (x SendIntermediateTrustPrm) Trust() *reputation.Trust { +func (x SendIntermediateTrustPrm) Trust() *reputation.PeerToPeerTrust { return x.trust } // SetTrust sets current global trust value computed at the specified iteration. -func (x *SendIntermediateTrustPrm) SetTrust(trust *reputation.Trust) { +func (x *SendIntermediateTrustPrm) SetTrust(trust *reputation.PeerToPeerTrust) { x.trust = trust } From 5a507e0d1bb3d8d0ee52dc4a4d739928ee2ff67e Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Fri, 16 Apr 2021 14:33:15 +0300 Subject: [PATCH 0726/1196] [#273] Add go1.16 tests and fix linter error Signed-off-by: Alex Vanin --- .github/workflows/go.yml | 2 +- pkg/client/container.go | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index ab7b4a0..1f43e51 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -17,7 +17,7 @@ jobs: runs-on: ubuntu-20.04 strategy: matrix: - go: [ '1.14.x', '1.15.x' ] + go: [ '1.14.x', '1.15.x', '1.16.x' ] steps: - name: Setup go uses: actions/setup-go@v2 diff --git a/pkg/client/container.go b/pkg/client/container.go index 3430003..0071a60 100644 --- a/pkg/client/container.go +++ b/pkg/client/container.go @@ -230,7 +230,6 @@ func (c *clientImpl) ListContainers(ctx context.Context, ownerID *owner.ID, opts } return result, nil - } func (c *clientImpl) DeleteContainer(ctx context.Context, id *container.ID, opts ...CallOption) error { From 1076478b296c334891ca3f8153cc0d44c1d94d64 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Thu, 22 Apr 2021 09:32:55 +0300 Subject: [PATCH 0727/1196] [#274] reputation: Recompile proto files Signed-off-by: Pavel Karpy --- v2/reputation/grpc/service.go | 7 ++ v2/reputation/grpc/service.pb.go | 107 +++++++++++++++++-------------- 2 files changed, 66 insertions(+), 48 deletions(-) diff --git a/v2/reputation/grpc/service.go b/v2/reputation/grpc/service.go index 2104d94..77878bd 100644 --- a/v2/reputation/grpc/service.go +++ b/v2/reputation/grpc/service.go @@ -60,6 +60,13 @@ func (x *SendLocalTrustResponse) SetVerifyHeader(v *session.ResponseVerification } } +// SetEpoch sets epoch in which the intermediate trust was assessed. +func (x *SendIntermediateResultRequest_Body) SetEpoch(v uint64) { + if x != nil { + x.Epoch = v + } +} + // SetIteration sets sequence number of the iteration. func (x *SendIntermediateResultRequest_Body) SetIteration(v uint32) { if x != nil { diff --git a/v2/reputation/grpc/service.pb.go b/v2/reputation/grpc/service.pb.go index 0116189..0f0edfa 100644 --- a/v2/reputation/grpc/service.pb.go +++ b/v2/reputation/grpc/service.pb.go @@ -415,10 +415,12 @@ type SendIntermediateResultRequest_Body struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields + // The number of the epoch in which the iteration was executed. + Epoch uint64 `protobuf:"varint,1,opt,name=epoch,proto3" json:"epoch,omitempty"` // Sequence number of the iteration. - Iteration uint32 `protobuf:"varint,1,opt,name=iteration,proto3" json:"iteration,omitempty"` + Iteration uint32 `protobuf:"varint,2,opt,name=iteration,proto3" json:"iteration,omitempty"` // Current global trust value computed at the specified iteration. - Trust *PeerToPeerTrust `protobuf:"bytes,2,opt,name=trust,proto3" json:"trust,omitempty"` + Trust *PeerToPeerTrust `protobuf:"bytes,3,opt,name=trust,proto3" json:"trust,omitempty"` } func (x *SendIntermediateResultRequest_Body) Reset() { @@ -453,6 +455,13 @@ func (*SendIntermediateResultRequest_Body) Descriptor() ([]byte, []int) { return file_v2_reputation_grpc_service_proto_rawDescGZIP(), []int{2, 0} } +func (x *SendIntermediateResultRequest_Body) GetEpoch() uint64 { + if x != nil { + return x.Epoch + } + return 0 +} + func (x *SendIntermediateResultRequest_Body) GetIteration() uint32 { if x != nil { return x.Iteration @@ -553,7 +562,7 @@ var file_v2_reputation_grpc_service_proto_rawDesc = []byte{ 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, 0x06, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x22, 0xea, 0x02, 0x0a, 0x1d, 0x53, 0x65, 0x6e, + 0x1a, 0x06, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x22, 0x80, 0x03, 0x0a, 0x1d, 0x53, 0x65, 0x6e, 0x64, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x4c, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x38, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, @@ -570,53 +579,55 @@ var file_v2_reputation_grpc_service_proto_rawDesc = []byte{ 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, 0x61, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x1c, 0x0a, 0x09, 0x69, 0x74, - 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x69, - 0x74, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3b, 0x0a, 0x05, 0x74, 0x72, 0x75, 0x73, - 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, - 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x50, - 0x65, 0x65, 0x72, 0x54, 0x6f, 0x50, 0x65, 0x65, 0x72, 0x54, 0x72, 0x75, 0x73, 0x74, 0x52, 0x05, - 0x74, 0x72, 0x75, 0x73, 0x74, 0x22, 0x93, 0x02, 0x0a, 0x1e, 0x53, 0x65, 0x6e, 0x64, 0x49, 0x6e, - 0x74, 0x65, 0x72, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4d, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x39, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, - 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x65, - 0x6e, 0x64, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x74, 0x65, 0x52, 0x65, - 0x73, 0x75, 0x6c, 0x74, 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, 0x72, 0x1a, 0x77, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x70, + 0x6f, 0x63, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, + 0x12, 0x1c, 0x0a, 0x09, 0x69, 0x74, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0d, 0x52, 0x09, 0x69, 0x74, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3b, + 0x0a, 0x05, 0x74, 0x72, 0x75, 0x73, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, + 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x54, 0x6f, 0x50, 0x65, 0x65, 0x72, 0x54, + 0x72, 0x75, 0x73, 0x74, 0x52, 0x05, 0x74, 0x72, 0x75, 0x73, 0x74, 0x22, 0x93, 0x02, 0x0a, 0x1e, + 0x53, 0x65, 0x6e, 0x64, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x74, 0x65, + 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4d, + 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x39, 0x2e, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6d, 0x65, 0x64, + 0x69, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 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, 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, 0x06, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x32, 0x86, 0x02, 0x0a, 0x11, - 0x52, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, - 0x65, 0x12, 0x6b, 0x0a, 0x0e, 0x53, 0x65, 0x6e, 0x64, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x54, 0x72, - 0x75, 0x73, 0x74, 0x12, 0x2b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, - 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x4c, - 0x6f, 0x63, 0x61, 0x6c, 0x54, 0x72, 0x75, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x2c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, - 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x4c, 0x6f, 0x63, 0x61, - 0x6c, 0x54, 0x72, 0x75, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x83, - 0x01, 0x0a, 0x16, 0x53, 0x65, 0x6e, 0x64, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6d, 0x65, 0x64, 0x69, - 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x33, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, + 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, 0x06, 0x0a, 0x04, 0x42, 0x6f, 0x64, + 0x79, 0x32, 0x86, 0x02, 0x0a, 0x11, 0x52, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x6b, 0x0a, 0x0e, 0x53, 0x65, 0x6e, 0x64, 0x4c, + 0x6f, 0x63, 0x61, 0x6c, 0x54, 0x72, 0x75, 0x73, 0x74, 0x12, 0x2b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x74, - 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x34, - 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6d, - 0x65, 0x64, 0x69, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x62, 0x5a, 0x3f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, - 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, - 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x72, 0x65, 0x70, - 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x72, 0x65, 0x70, - 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xaa, 0x02, 0x1e, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, - 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x52, 0x65, - 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x54, 0x72, 0x75, 0x73, 0x74, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, + 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x65, + 0x6e, 0x64, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x54, 0x72, 0x75, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x83, 0x01, 0x0a, 0x16, 0x53, 0x65, 0x6e, 0x64, 0x49, 0x6e, 0x74, + 0x65, 0x72, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, + 0x33, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, + 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x49, 0x6e, 0x74, 0x65, 0x72, + 0x6d, 0x65, 0x64, 0x69, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x34, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x65, 0x6e, 0x64, + 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x75, + 0x6c, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x62, 0x5a, 0x3f, 0x67, 0x69, + 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, + 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, + 0x76, 0x32, 0x2f, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x67, 0x72, + 0x70, 0x63, 0x3b, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xaa, 0x02, 0x1e, + 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, + 0x41, 0x50, 0x49, 0x2e, 0x52, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( From 541a56aae1f8245d8b64512e58d3360df155dddc Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Thu, 22 Apr 2021 10:40:12 +0300 Subject: [PATCH 0728/1196] [#274] reputation: Adapt converters and encoding methods on messages Signed-off-by: Pavel Karpy --- v2/reputation/convert.go | 2 ++ v2/reputation/marshal.go | 18 +++++++++++++++++- v2/reputation/test/generate.go | 1 + v2/reputation/types.go | 18 ++++++++++++++++++ 4 files changed, 38 insertions(+), 1 deletion(-) diff --git a/v2/reputation/convert.go b/v2/reputation/convert.go index 52df2fa..8aa9aa0 100644 --- a/v2/reputation/convert.go +++ b/v2/reputation/convert.go @@ -458,6 +458,7 @@ func (x *SendIntermediateResultRequestBody) ToGRPCMessage() grpc.Message { if x != nil { m = new(reputation.SendIntermediateResultRequest_Body) + m.SetEpoch(x.epoch) m.SetIteration(x.iter) m.SetTrust(x.trust.ToGRPCMessage().(*reputation.PeerToPeerTrust)) } @@ -480,6 +481,7 @@ func (x *SendIntermediateResultRequestBody) FromGRPCMessage(m grpc.Message) erro return err } + x.epoch = v.GetEpoch() x.iter = v.GetIteration() return nil diff --git a/v2/reputation/marshal.go b/v2/reputation/marshal.go index 20fa677..2f08408 100644 --- a/v2/reputation/marshal.go +++ b/v2/reputation/marshal.go @@ -277,6 +277,7 @@ func (x *SendLocalTrustResponseBody) Unmarshal(data []byte) error { const ( _ = iota + sendInterResBodyEpochFNum sendInterResBodyIterFNum sendInterResBodyTrustFNum ) @@ -290,11 +291,25 @@ func (x *SendIntermediateResultRequestBody) StableMarshal(buf []byte) ([]byte, e buf = make([]byte, x.StableSize()) } - offset, err := protoutil.UInt32Marshal(sendInterResBodyIterFNum, buf, x.iter) + var ( + offset, n int + err error + ) + + n, err = protoutil.UInt64Marshal(sendInterResBodyEpochFNum, buf, x.epoch) if err != nil { return nil, err } + offset += n + + n, err = protoutil.UInt32Marshal(sendInterResBodyIterFNum, buf[offset:], x.iter) + if err != nil { + return nil, err + } + + offset += n + _, err = protoutil.NestedStructureMarshal(sendInterResBodyTrustFNum, buf[offset:], x.trust) if err != nil { return nil, err @@ -304,6 +319,7 @@ func (x *SendIntermediateResultRequestBody) StableMarshal(buf []byte) ([]byte, e } func (x *SendIntermediateResultRequestBody) StableSize() (size int) { + size += protoutil.UInt64Size(sendInterResBodyEpochFNum, x.epoch) size += protoutil.UInt32Size(sendInterResBodyIterFNum, x.iter) size += protoutil.NestedStructureSize(sendInterResBodyTrustFNum, x.trust) diff --git a/v2/reputation/test/generate.go b/v2/reputation/test/generate.go index 65e50e8..fbd4bd1 100644 --- a/v2/reputation/test/generate.go +++ b/v2/reputation/test/generate.go @@ -109,6 +109,7 @@ func GenerateSendIntermediateResultRequestBody(empty bool) *reputation.SendInter m := new(reputation.SendIntermediateResultRequestBody) if !empty { + m.SetEpoch(123) m.SetIteration(564) } diff --git a/v2/reputation/types.go b/v2/reputation/types.go index b7ef545..b1bd707 100644 --- a/v2/reputation/types.go +++ b/v2/reputation/types.go @@ -297,11 +297,29 @@ func (x *SendLocalTrustResponse) SetBody(v *SendLocalTrustResponseBody) { // SendIntermediateResultRequestBody is a structure of SendIntermediateResult request body. type SendIntermediateResultRequestBody struct { + epoch uint64 + iter uint32 trust *PeerToPeerTrust } +// GetEpoch returns epoch number in which the intermediate trust was assessed. +func (x *SendIntermediateResultRequestBody) GetEpoch() uint64 { + if x != nil { + return x.epoch + } + + return 0 +} + +// SetEpoch sets epoch number in which the intermediate trust was assessed. +func (x *SendIntermediateResultRequestBody) SetEpoch(v uint64) { + if x != nil { + x.epoch = v + } +} + // GetIteration returns sequence number of the iteration. func (x *SendIntermediateResultRequestBody) GetIteration() uint32 { if x != nil { From 0f7a14a69f49a115fc0feed4981a8f2b50cfad43 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Thu, 22 Apr 2021 11:09:36 +0300 Subject: [PATCH 0729/1196] [#274] pkg/client: Add `epoch` field to `SendIntermediateTrustPrm` Signed-off-by: Pavel Karpy --- pkg/client/reputation.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pkg/client/reputation.go b/pkg/client/reputation.go index 2ee6bc1..a096efb 100644 --- a/pkg/client/reputation.go +++ b/pkg/client/reputation.go @@ -87,11 +87,21 @@ func (c *clientImpl) SendLocalTrust(ctx context.Context, prm SendLocalTrustPrm, // SendIntermediateTrustPrm groups parameters of SendIntermediateTrust operation. type SendIntermediateTrustPrm struct { + epoch uint64 + iter uint32 trust *reputation.PeerToPeerTrust } +func (x *SendIntermediateTrustPrm) Epoch() uint64 { + return x.epoch +} + +func (x *SendIntermediateTrustPrm) SetEpoch(epoch uint64) { + x.epoch = epoch +} + // Iteration returns sequence number of the iteration. func (x SendIntermediateTrustPrm) Iteration() uint32 { return x.iter @@ -124,6 +134,7 @@ func (c *clientImpl) SendIntermediateTrust(ctx context.Context, prm SendIntermed } reqBody := new(v2reputation.SendIntermediateResultRequestBody) + reqBody.SetEpoch(prm.Epoch()) reqBody.SetIteration(prm.Iteration()) reqBody.SetTrust(prm.Trust().ToV2()) From bb217067f442a53a6c86101965ea142979afde42 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Tue, 27 Apr 2021 09:52:23 +0300 Subject: [PATCH 0730/1196] [#275] reputation/convert: Add nil check In `SendIntermediateResultRequestBody` add nil check for `trust` field. If true, allocate new `PeerToPeerTrust`. Signed-off-by: Pavel Karpy --- v2/reputation/convert.go | 15 ++++++++++++--- v2/reputation/test/generate.go | 3 +-- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/v2/reputation/convert.go b/v2/reputation/convert.go index 8aa9aa0..2e31df9 100644 --- a/v2/reputation/convert.go +++ b/v2/reputation/convert.go @@ -476,9 +476,18 @@ func (x *SendIntermediateResultRequestBody) FromGRPCMessage(m grpc.Message) erro return message.NewUnexpectedMessageType(m, v) } - err := x.trust.FromGRPCMessage(v.GetTrust()) - if err != nil { - return err + trust := v.GetTrust() + if trust == nil { + x.trust = nil + } else { + if x.trust == nil { + x.trust = new(PeerToPeerTrust) + } + + err := x.trust.FromGRPCMessage(trust) + if err != nil { + return err + } } x.epoch = v.GetEpoch() diff --git a/v2/reputation/test/generate.go b/v2/reputation/test/generate.go index fbd4bd1..8b2adc5 100644 --- a/v2/reputation/test/generate.go +++ b/v2/reputation/test/generate.go @@ -111,10 +111,9 @@ func GenerateSendIntermediateResultRequestBody(empty bool) *reputation.SendInter if !empty { m.SetEpoch(123) m.SetIteration(564) + m.SetTrust(GeneratePeerToPeerTrust(empty)) } - m.SetTrust(GeneratePeerToPeerTrust(empty)) - return m } From fcb2cce8a08016e835505dd2b46f9adf24e519a5 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 30 Apr 2021 10:52:45 +0300 Subject: [PATCH 0731/1196] [#278] pkg/client: Fix payload slice allocation in Object Range method Allocate capacity instead of length of the slice to write the object payload range since each chunk is written through `append`. Signed-off-by: Leonard Lyubich --- pkg/client/object.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/client/object.go b/pkg/client/object.go index d970a20..56cbf3c 100644 --- a/pkg/client/object.go +++ b/pkg/client/object.go @@ -874,7 +874,7 @@ func (c *clientImpl) ObjectPayloadRangeData(ctx context.Context, p *RangeDataPar var payload []byte if p.w != nil { - payload = make([]byte, p.r.GetLength()) + payload = make([]byte, 0, p.r.GetLength()) } resp := new(v2object.GetRangeResponse) From 099347d3bcc9b33b7e59798779bcf58e85047a89 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Fri, 7 May 2021 12:34:24 +0300 Subject: [PATCH 0732/1196] Synchronize namings with NeoFS API v2.6.0 Signed-off-by: Alex Vanin --- pkg/client/reputation.go | 64 ++-- pkg/reputation/peer.go | 10 +- v2/reputation/convert.go | 164 +++++----- v2/reputation/grpc/service.go | 34 +- v2/reputation/grpc/service.pb.go | 511 ++++++++++++++++--------------- v2/reputation/grpc/types.go | 6 +- v2/reputation/grpc/types.pb.go | 118 ++++--- v2/reputation/marshal.go | 68 ++-- v2/reputation/message_test.go | 20 +- v2/reputation/test/generate.go | 42 +-- v2/reputation/types.go | 90 +++--- v2/rpc/reputation.go | 28 +- v2/signature/sign.go | 8 +- 13 files changed, 586 insertions(+), 577 deletions(-) diff --git a/pkg/client/reputation.go b/pkg/client/reputation.go index a096efb..253e4df 100644 --- a/pkg/client/reputation.go +++ b/pkg/client/reputation.go @@ -13,45 +13,45 @@ import ( // Reputation contains methods for working with Reputation system values. type Reputation interface { - // SendLocalTrust sends local trust values of local peer. - SendLocalTrust(context.Context, SendLocalTrustPrm, ...CallOption) (*SendLocalTrustRes, error) + // AnnounceLocalTrust announces local trust values of local peer. + AnnounceLocalTrust(context.Context, AnnounceLocalTrustPrm, ...CallOption) (*AnnounceLocalTrustRes, error) - // SendIntermediateTrust sends the intermediate result of the iterative algorithm for calculating + // AnnounceIntermediateTrust announces the intermediate result of the iterative algorithm for calculating // the global reputation of the node. - SendIntermediateTrust(context.Context, SendIntermediateTrustPrm, ...CallOption) (*SendIntermediateTrustRes, error) + AnnounceIntermediateTrust(context.Context, AnnounceIntermediateTrustPrm, ...CallOption) (*AnnounceIntermediateTrustRes, error) } -// SendLocalTrustPrm groups parameters of SendLocalTrust operation. -type SendLocalTrustPrm struct { +// AnnounceLocalTrustPrm groups parameters of AnnounceLocalTrust operation. +type AnnounceLocalTrustPrm struct { epoch uint64 trusts []*reputation.Trust } // Epoch returns epoch in which the trust was assessed. -func (x SendLocalTrustPrm) Epoch() uint64 { +func (x AnnounceLocalTrustPrm) Epoch() uint64 { return x.epoch } // SetEpoch sets epoch in which the trust was assessed. -func (x *SendLocalTrustPrm) SetEpoch(epoch uint64) { +func (x *AnnounceLocalTrustPrm) SetEpoch(epoch uint64) { x.epoch = epoch } // Trusts returns list of local trust values. -func (x SendLocalTrustPrm) Trusts() []*reputation.Trust { +func (x AnnounceLocalTrustPrm) Trusts() []*reputation.Trust { return x.trusts } // SetTrusts sets list of local trust values. -func (x *SendLocalTrustPrm) SetTrusts(trusts []*reputation.Trust) { +func (x *AnnounceLocalTrustPrm) SetTrusts(trusts []*reputation.Trust) { x.trusts = trusts } -// SendLocalTrustPrm groups results of SendLocalTrust operation. -type SendLocalTrustRes struct{} +// AnnounceLocalTrustRes groups results of AnnounceLocalTrust operation. +type AnnounceLocalTrustRes struct{} -func (c *clientImpl) SendLocalTrust(ctx context.Context, prm SendLocalTrustPrm, opts ...CallOption) (*SendLocalTrustRes, error) { +func (c *clientImpl) AnnounceLocalTrust(ctx context.Context, prm AnnounceLocalTrustPrm, opts ...CallOption) (*AnnounceLocalTrustRes, error) { // apply all available options callOptions := c.defaultCallOptions() @@ -59,11 +59,11 @@ func (c *clientImpl) SendLocalTrust(ctx context.Context, prm SendLocalTrustPrm, opts[i](callOptions) } - reqBody := new(v2reputation.SendLocalTrustRequestBody) + reqBody := new(v2reputation.AnnounceLocalTrustRequestBody) reqBody.SetEpoch(prm.Epoch()) reqBody.SetTrusts(reputation.TrustsToV2(prm.Trusts())) - req := new(v2reputation.SendLocalTrustRequest) + req := new(v2reputation.AnnounceLocalTrustRequest) req.SetBody(reqBody) req.SetMetaHeader(v2MetaHeaderFromOpts(callOptions)) @@ -72,7 +72,7 @@ func (c *clientImpl) SendLocalTrust(ctx context.Context, prm SendLocalTrustPrm, return nil, err } - resp, err := rpcapi.SendLocalTrust(c.Raw(), req, client.WithContext(ctx)) + resp, err := rpcapi.AnnounceLocalTrust(c.Raw(), req, client.WithContext(ctx)) if err != nil { return nil, err } @@ -82,11 +82,11 @@ func (c *clientImpl) SendLocalTrust(ctx context.Context, prm SendLocalTrustPrm, return nil, errors.Wrap(err, "can't verify response message") } - return new(SendLocalTrustRes), nil + return new(AnnounceLocalTrustRes), nil } -// SendIntermediateTrustPrm groups parameters of SendIntermediateTrust operation. -type SendIntermediateTrustPrm struct { +// AnnounceIntermediateTrustPrm groups parameters of AnnounceIntermediateTrust operation. +type AnnounceIntermediateTrustPrm struct { epoch uint64 iter uint32 @@ -94,38 +94,38 @@ type SendIntermediateTrustPrm struct { trust *reputation.PeerToPeerTrust } -func (x *SendIntermediateTrustPrm) Epoch() uint64 { +func (x *AnnounceIntermediateTrustPrm) Epoch() uint64 { return x.epoch } -func (x *SendIntermediateTrustPrm) SetEpoch(epoch uint64) { +func (x *AnnounceIntermediateTrustPrm) SetEpoch(epoch uint64) { x.epoch = epoch } // Iteration returns sequence number of the iteration. -func (x SendIntermediateTrustPrm) Iteration() uint32 { +func (x AnnounceIntermediateTrustPrm) Iteration() uint32 { return x.iter } // SetIteration sets sequence number of the iteration. -func (x *SendIntermediateTrustPrm) SetIteration(iter uint32) { +func (x *AnnounceIntermediateTrustPrm) SetIteration(iter uint32) { x.iter = iter } // Trust returns current global trust value computed at the specified iteration. -func (x SendIntermediateTrustPrm) Trust() *reputation.PeerToPeerTrust { +func (x AnnounceIntermediateTrustPrm) Trust() *reputation.PeerToPeerTrust { return x.trust } // SetTrust sets current global trust value computed at the specified iteration. -func (x *SendIntermediateTrustPrm) SetTrust(trust *reputation.PeerToPeerTrust) { +func (x *AnnounceIntermediateTrustPrm) SetTrust(trust *reputation.PeerToPeerTrust) { x.trust = trust } -// SendIntermediateTrustRes groups results of SendIntermediateTrust operation. -type SendIntermediateTrustRes struct{} +// AnnounceIntermediateTrustRes groups results of AnnounceIntermediateTrust operation. +type AnnounceIntermediateTrustRes struct{} -func (c *clientImpl) SendIntermediateTrust(ctx context.Context, prm SendIntermediateTrustPrm, opts ...CallOption) (*SendIntermediateTrustRes, error) { +func (c *clientImpl) AnnounceIntermediateTrust(ctx context.Context, prm AnnounceIntermediateTrustPrm, opts ...CallOption) (*AnnounceIntermediateTrustRes, error) { // apply all available options callOptions := c.defaultCallOptions() @@ -133,12 +133,12 @@ func (c *clientImpl) SendIntermediateTrust(ctx context.Context, prm SendIntermed opts[i](callOptions) } - reqBody := new(v2reputation.SendIntermediateResultRequestBody) + reqBody := new(v2reputation.AnnounceIntermediateResultRequestBody) reqBody.SetEpoch(prm.Epoch()) reqBody.SetIteration(prm.Iteration()) reqBody.SetTrust(prm.Trust().ToV2()) - req := new(v2reputation.SendIntermediateResultRequest) + req := new(v2reputation.AnnounceIntermediateResultRequest) req.SetBody(reqBody) req.SetMetaHeader(v2MetaHeaderFromOpts(callOptions)) @@ -147,7 +147,7 @@ func (c *clientImpl) SendIntermediateTrust(ctx context.Context, prm SendIntermed return nil, err } - resp, err := rpcapi.SendIntermediateResult(c.Raw(), req, client.WithContext(ctx)) + resp, err := rpcapi.AnnounceIntermediateResult(c.Raw(), req, client.WithContext(ctx)) if err != nil { return nil, err } @@ -157,5 +157,5 @@ func (c *clientImpl) SendIntermediateTrust(ctx context.Context, prm SendIntermed return nil, errors.Wrap(err, "can't verify response message") } - return new(SendIntermediateTrustRes), nil + return new(AnnounceIntermediateTrustRes), nil } diff --git a/pkg/reputation/peer.go b/pkg/reputation/peer.go index 60d4ea3..f35b9ea 100644 --- a/pkg/reputation/peer.go +++ b/pkg/reputation/peer.go @@ -24,7 +24,7 @@ func PeerIDFromV2(id *reputation.PeerID) *PeerID { // SetPublicKey sets peer ID as a compressed public key. func (x *PeerID) SetPublicKey(v [crypto.PublicKeyCompressedSize]byte) { (*reputation.PeerID)(x). - SetValue(v[:]) + SetPublicKey(v[:]) } // ToV2 converts PeerID to NeoFS API v2 reputation.PeerID message. @@ -35,8 +35,8 @@ func (x *PeerID) ToV2() *reputation.PeerID { // Equal returns true if identifiers are identical. func (x *PeerID) Equal(x2 *PeerID) bool { return bytes.Equal( - (*reputation.PeerID)(x).GetValue(), - (*reputation.PeerID)(x2).GetValue(), + (*reputation.PeerID)(x).GetPublicKey(), + (*reputation.PeerID)(x2).GetPublicKey(), ) } @@ -47,7 +47,7 @@ func (x *PeerID) Parse(s string) error { return err } - (*reputation.PeerID)(x).SetValue(data) + (*reputation.PeerID)(x).SetPublicKey(data) return nil } @@ -56,7 +56,7 @@ func (x *PeerID) Parse(s string) error { func (x *PeerID) String() string { return base58.Encode( (*reputation.PeerID)(x). - GetValue(), + GetPublicKey(), ) } diff --git a/v2/reputation/convert.go b/v2/reputation/convert.go index 2e31df9..0c49508 100644 --- a/v2/reputation/convert.go +++ b/v2/reputation/convert.go @@ -16,7 +16,7 @@ func (x *PeerID) ToGRPCMessage() grpc.Message { if x != nil { m = new(reputation.PeerID) - m.SetValue(x.val) + m.SetPublicKey(x.publicKey) } return m @@ -32,7 +32,7 @@ func (x *PeerID) FromGRPCMessage(m grpc.Message) error { return message.NewUnexpectedMessageType(m, v) } - x.val = v.GetValue() + x.publicKey = v.GetPublicKey() return nil } @@ -300,13 +300,13 @@ func (x *GlobalTrust) FromGRPCMessage(m grpc.Message) error { return err } -// ToGRPCMessage converts SendLocalTrustRequestBody to gRPC-generated -// reputation.SendLocalTrustRequest_Body message. -func (x *SendLocalTrustRequestBody) ToGRPCMessage() grpc.Message { - var m *reputation.SendLocalTrustRequest_Body +// ToGRPCMessage converts AnnounceLocalTrustRequestBody to gRPC-generated +// reputation.AnnounceLocalTrustRequest_Body message. +func (x *AnnounceLocalTrustRequestBody) ToGRPCMessage() grpc.Message { + var m *reputation.AnnounceLocalTrustRequest_Body if x != nil { - m = new(reputation.SendLocalTrustRequest_Body) + m = new(reputation.AnnounceLocalTrustRequest_Body) m.SetEpoch(x.epoch) m.SetTrusts(TrustsToGRPC(x.trusts)) @@ -315,12 +315,12 @@ func (x *SendLocalTrustRequestBody) ToGRPCMessage() grpc.Message { return m } -// FromGRPCMessage tries to restore SendLocalTrustRequestBody from grpc.Message. +// FromGRPCMessage tries to restore AnnounceLocalTrustRequestBody from grpc.Message. // // Returns message.ErrUnexpectedMessageType if m is not -// a gRPC-generated reputation.SendLocalTrustRequest_Body message. -func (x *SendLocalTrustRequestBody) FromGRPCMessage(m grpc.Message) error { - v, ok := m.(*reputation.SendLocalTrustRequest_Body) +// a gRPC-generated reputation.AnnounceLocalTrustRequest_Body message. +func (x *AnnounceLocalTrustRequestBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*reputation.AnnounceLocalTrustRequest_Body) if !ok { return message.NewUnexpectedMessageType(m, v) } @@ -337,27 +337,27 @@ func (x *SendLocalTrustRequestBody) FromGRPCMessage(m grpc.Message) error { return nil } -// ToGRPCMessage converts SendLocalTrustRequest to gRPC-generated -// reputation.SendLocalTrustRequest message. -func (x *SendLocalTrustRequest) ToGRPCMessage() grpc.Message { - var m *reputation.SendLocalTrustRequest +// ToGRPCMessage converts AnnounceLocalTrustRequest to gRPC-generated +// reputation.AnnounceLocalTrustRequest message. +func (x *AnnounceLocalTrustRequest) ToGRPCMessage() grpc.Message { + var m *reputation.AnnounceLocalTrustRequest if x != nil { - m = new(reputation.SendLocalTrustRequest) + m = new(reputation.AnnounceLocalTrustRequest) - m.SetBody(x.body.ToGRPCMessage().(*reputation.SendLocalTrustRequest_Body)) + m.SetBody(x.body.ToGRPCMessage().(*reputation.AnnounceLocalTrustRequest_Body)) x.RequestHeaders.ToMessage(m) } return m } -// FromGRPCMessage tries to restore SendLocalTrustRequest from grpc.Message. +// FromGRPCMessage tries to restore AnnounceLocalTrustRequest from grpc.Message. // // Returns message.ErrUnexpectedMessageType if m is not -// a gRPC-generated reputation.SendLocalTrustRequest message. -func (x *SendLocalTrustRequest) FromGRPCMessage(m grpc.Message) error { - v, ok := m.(*reputation.SendLocalTrustRequest) +// a gRPC-generated reputation.AnnounceLocalTrustRequest message. +func (x *AnnounceLocalTrustRequest) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*reputation.AnnounceLocalTrustRequest) if !ok { return message.NewUnexpectedMessageType(m, v) } @@ -369,7 +369,7 @@ func (x *SendLocalTrustRequest) FromGRPCMessage(m grpc.Message) error { x.body = nil } else { if x.body == nil { - x.body = new(SendLocalTrustRequestBody) + x.body = new(AnnounceLocalTrustRequestBody) } err = x.body.FromGRPCMessage(body) @@ -381,24 +381,24 @@ func (x *SendLocalTrustRequest) FromGRPCMessage(m grpc.Message) error { return x.RequestHeaders.FromMessage(v) } -// ToGRPCMessage converts SendLocalTrustResponseBody to gRPC-generated -// reputation.SendLocalTrustResponse_Body message. -func (x *SendLocalTrustResponseBody) ToGRPCMessage() grpc.Message { - var m *reputation.SendLocalTrustResponse_Body +// ToGRPCMessage converts AnnounceLocalTrustResponseBody to gRPC-generated +// reputation.AnnounceLocalTrustResponse_Body message. +func (x *AnnounceLocalTrustResponseBody) ToGRPCMessage() grpc.Message { + var m *reputation.AnnounceLocalTrustResponse_Body if x != nil { - m = new(reputation.SendLocalTrustResponse_Body) + m = new(reputation.AnnounceLocalTrustResponse_Body) } return m } -// FromGRPCMessage tries to restore SendLocalTrustResponseBody from grpc.Message. +// FromGRPCMessage tries to restore AnnounceLocalTrustResponseBody from grpc.Message. // // Returns message.ErrUnexpectedMessageType if m is not -// a gRPC-generated reputation.SendLocalTrustResponse_Body message. -func (x *SendLocalTrustResponseBody) FromGRPCMessage(m grpc.Message) error { - v, ok := m.(*reputation.SendLocalTrustResponse_Body) +// a gRPC-generated reputation.AnnounceLocalTrustResponse_Body message. +func (x *AnnounceLocalTrustResponseBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*reputation.AnnounceLocalTrustResponse_Body) if !ok { return message.NewUnexpectedMessageType(m, v) } @@ -406,27 +406,27 @@ func (x *SendLocalTrustResponseBody) FromGRPCMessage(m grpc.Message) error { return nil } -// ToGRPCMessage converts SendLocalTrustResponse to gRPC-generated -// reputation.SendLocalTrustResponse message. -func (x *SendLocalTrustResponse) ToGRPCMessage() grpc.Message { - var m *reputation.SendLocalTrustResponse +// ToGRPCMessage converts AnnounceLocalTrustResponse to gRPC-generated +// reputation.AnnounceLocalTrustResponse message. +func (x *AnnounceLocalTrustResponse) ToGRPCMessage() grpc.Message { + var m *reputation.AnnounceLocalTrustResponse if x != nil { - m = new(reputation.SendLocalTrustResponse) + m = new(reputation.AnnounceLocalTrustResponse) - m.SetBody(x.body.ToGRPCMessage().(*reputation.SendLocalTrustResponse_Body)) + m.SetBody(x.body.ToGRPCMessage().(*reputation.AnnounceLocalTrustResponse_Body)) x.ResponseHeaders.ToMessage(m) } return m } -// FromGRPCMessage tries to restore SendLocalTrustResponse from grpc.Message. +// FromGRPCMessage tries to restore AnnounceLocalTrustResponse from grpc.Message. // // Returns message.ErrUnexpectedMessageType if m is not -// a gRPC-generated reputation.SendLocalTrustResponse message. -func (x *SendLocalTrustResponse) FromGRPCMessage(m grpc.Message) error { - v, ok := m.(*reputation.SendLocalTrustResponse) +// a gRPC-generated reputation.AnnounceLocalTrustResponse message. +func (x *AnnounceLocalTrustResponse) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*reputation.AnnounceLocalTrustResponse) if !ok { return message.NewUnexpectedMessageType(m, v) } @@ -438,7 +438,7 @@ func (x *SendLocalTrustResponse) FromGRPCMessage(m grpc.Message) error { x.body = nil } else { if x.body == nil { - x.body = new(SendLocalTrustResponseBody) + x.body = new(AnnounceLocalTrustResponseBody) } err = x.body.FromGRPCMessage(body) @@ -450,13 +450,13 @@ func (x *SendLocalTrustResponse) FromGRPCMessage(m grpc.Message) error { return x.ResponseHeaders.FromMessage(v) } -// ToGRPCMessage converts SendIntermediateResultRequestBody to gRPC-generated -// reputation.SendIntermediateResultRequest_Body message. -func (x *SendIntermediateResultRequestBody) ToGRPCMessage() grpc.Message { - var m *reputation.SendIntermediateResultRequest_Body +// ToGRPCMessage converts AnnounceIntermediateResultRequestBody to gRPC-generated +// reputation.AnnounceIntermediateResultRequest_Body message. +func (x *AnnounceIntermediateResultRequestBody) ToGRPCMessage() grpc.Message { + var m *reputation.AnnounceIntermediateResultRequest_Body if x != nil { - m = new(reputation.SendIntermediateResultRequest_Body) + m = new(reputation.AnnounceIntermediateResultRequest_Body) m.SetEpoch(x.epoch) m.SetIteration(x.iter) @@ -466,12 +466,12 @@ func (x *SendIntermediateResultRequestBody) ToGRPCMessage() grpc.Message { return m } -// FromGRPCMessage tries to restore SendIntermediateResultRequestBody from grpc.Message. +// FromGRPCMessage tries to restore AnnounceIntermediateResultRequestBody from grpc.Message. // // Returns message.ErrUnexpectedMessageType if m is not -// a gRPC-generated reputation.SendIntermediateResultRequest_Body message. -func (x *SendIntermediateResultRequestBody) FromGRPCMessage(m grpc.Message) error { - v, ok := m.(*reputation.SendIntermediateResultRequest_Body) +// a gRPC-generated reputation.AnnounceIntermediateResultRequest_Body message. +func (x *AnnounceIntermediateResultRequestBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*reputation.AnnounceIntermediateResultRequest_Body) if !ok { return message.NewUnexpectedMessageType(m, v) } @@ -496,27 +496,27 @@ func (x *SendIntermediateResultRequestBody) FromGRPCMessage(m grpc.Message) erro return nil } -// ToGRPCMessage converts SendIntermediateResultRequest to gRPC-generated -// reputation.SendIntermediateResultRequest message. -func (x *SendIntermediateResultRequest) ToGRPCMessage() grpc.Message { - var m *reputation.SendIntermediateResultRequest +// ToGRPCMessage converts AnnounceIntermediateResultRequest to gRPC-generated +// reputation.AnnounceIntermediateResultRequest message. +func (x *AnnounceIntermediateResultRequest) ToGRPCMessage() grpc.Message { + var m *reputation.AnnounceIntermediateResultRequest if x != nil { - m = new(reputation.SendIntermediateResultRequest) + m = new(reputation.AnnounceIntermediateResultRequest) - m.SetBody(x.body.ToGRPCMessage().(*reputation.SendIntermediateResultRequest_Body)) + m.SetBody(x.body.ToGRPCMessage().(*reputation.AnnounceIntermediateResultRequest_Body)) x.RequestHeaders.ToMessage(m) } return m } -// FromGRPCMessage tries to restore SendIntermediateResultRequest from grpc.Message. +// FromGRPCMessage tries to restore AnnounceIntermediateResultRequest from grpc.Message. // // Returns message.ErrUnexpectedMessageType if m is not -// a gRPC-generated reputation.SendIntermediateResultRequest message. -func (x *SendIntermediateResultRequest) FromGRPCMessage(m grpc.Message) error { - v, ok := m.(*reputation.SendIntermediateResultRequest) +// a gRPC-generated reputation.AnnounceIntermediateResultRequest message. +func (x *AnnounceIntermediateResultRequest) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*reputation.AnnounceIntermediateResultRequest) if !ok { return message.NewUnexpectedMessageType(m, v) } @@ -528,7 +528,7 @@ func (x *SendIntermediateResultRequest) FromGRPCMessage(m grpc.Message) error { x.body = nil } else { if x.body == nil { - x.body = new(SendIntermediateResultRequestBody) + x.body = new(AnnounceIntermediateResultRequestBody) } err = x.body.FromGRPCMessage(body) @@ -540,24 +540,24 @@ func (x *SendIntermediateResultRequest) FromGRPCMessage(m grpc.Message) error { return x.RequestHeaders.FromMessage(v) } -// ToGRPCMessage converts SendIntermediateResultResponseBody to gRPC-generated -// reputation.SendIntermediateResultResponse_Body message. -func (x *SendIntermediateResultResponseBody) ToGRPCMessage() grpc.Message { - var m *reputation.SendIntermediateResultResponse_Body +// ToGRPCMessage converts AnnounceIntermediateResultResponseBody to gRPC-generated +// reputation.AnnounceIntermediateResultResponse_Body message. +func (x *AnnounceIntermediateResultResponseBody) ToGRPCMessage() grpc.Message { + var m *reputation.AnnounceIntermediateResultResponse_Body if x != nil { - m = new(reputation.SendIntermediateResultResponse_Body) + m = new(reputation.AnnounceIntermediateResultResponse_Body) } return m } -// FromGRPCMessage tries to restore SendIntermediateResultResponseBody from grpc.Message. +// FromGRPCMessage tries to restore AnnounceIntermediateResultResponseBody from grpc.Message. // // Returns message.ErrUnexpectedMessageType if m is not -// a gRPC-generated reputation.SendIntermediateResultResponse_Body message. -func (x *SendIntermediateResultResponseBody) FromGRPCMessage(m grpc.Message) error { - v, ok := m.(*reputation.SendIntermediateResultResponse_Body) +// a gRPC-generated reputation.AnnounceIntermediateResultResponse_Body message. +func (x *AnnounceIntermediateResultResponseBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*reputation.AnnounceIntermediateResultResponse_Body) if !ok { return message.NewUnexpectedMessageType(m, v) } @@ -565,27 +565,27 @@ func (x *SendIntermediateResultResponseBody) FromGRPCMessage(m grpc.Message) err return nil } -// ToGRPCMessage converts SendIntermediateResultResponse to gRPC-generated -// reputation.SendIntermediateResultResponse message. -func (x *SendIntermediateResultResponse) ToGRPCMessage() grpc.Message { - var m *reputation.SendIntermediateResultResponse +// ToGRPCMessage converts AnnounceIntermediateResultResponse to gRPC-generated +// reputation.AnnounceIntermediateResultResponse message. +func (x *AnnounceIntermediateResultResponse) ToGRPCMessage() grpc.Message { + var m *reputation.AnnounceIntermediateResultResponse if x != nil { - m = new(reputation.SendIntermediateResultResponse) + m = new(reputation.AnnounceIntermediateResultResponse) - m.SetBody(x.body.ToGRPCMessage().(*reputation.SendIntermediateResultResponse_Body)) + m.SetBody(x.body.ToGRPCMessage().(*reputation.AnnounceIntermediateResultResponse_Body)) x.ResponseHeaders.ToMessage(m) } return m } -// FromGRPCMessage tries to restore SendIntermediateResultResponse from grpc.Message. +// FromGRPCMessage tries to restore AnnounceIntermediateResultResponse from grpc.Message. // // Returns message.ErrUnexpectedMessageType if m is not -// a gRPC-generated reputation.SendIntermediateResultResponse message. -func (x *SendIntermediateResultResponse) FromGRPCMessage(m grpc.Message) error { - v, ok := m.(*reputation.SendIntermediateResultResponse) +// a gRPC-generated reputation.AnnounceIntermediateResultResponse message. +func (x *AnnounceIntermediateResultResponse) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*reputation.AnnounceIntermediateResultResponse) if !ok { return message.NewUnexpectedMessageType(m, v) } @@ -597,7 +597,7 @@ func (x *SendIntermediateResultResponse) FromGRPCMessage(m grpc.Message) error { x.body = nil } else { if x.body == nil { - x.body = new(SendIntermediateResultResponseBody) + x.body = new(AnnounceIntermediateResultResponseBody) } err = x.body.FromGRPCMessage(body) diff --git a/v2/reputation/grpc/service.go b/v2/reputation/grpc/service.go index 77878bd..b48a275 100644 --- a/v2/reputation/grpc/service.go +++ b/v2/reputation/grpc/service.go @@ -5,119 +5,119 @@ import ( ) // SetEpoch sets epoch in which the trust was assessed. -func (x *SendLocalTrustRequest_Body) SetEpoch(v uint64) { +func (x *AnnounceLocalTrustRequest_Body) SetEpoch(v uint64) { if x != nil { x.Epoch = v } } // SetTrusts sets list of normalized trust values. -func (x *SendLocalTrustRequest_Body) SetTrusts(v []*Trust) { +func (x *AnnounceLocalTrustRequest_Body) SetTrusts(v []*Trust) { if x != nil { x.Trusts = v } } // SetBody sets body of the request. -func (x *SendLocalTrustRequest) SetBody(v *SendLocalTrustRequest_Body) { +func (x *AnnounceLocalTrustRequest) SetBody(v *AnnounceLocalTrustRequest_Body) { if x != nil { x.Body = v } } // SetMetaHeader sets meta header of the request. -func (x *SendLocalTrustRequest) SetMetaHeader(v *session.RequestMetaHeader) { +func (x *AnnounceLocalTrustRequest) SetMetaHeader(v *session.RequestMetaHeader) { if x != nil { x.MetaHeader = v } } // SetVerifyHeader sets verification header of the request. -func (x *SendLocalTrustRequest) SetVerifyHeader(v *session.RequestVerificationHeader) { +func (x *AnnounceLocalTrustRequest) SetVerifyHeader(v *session.RequestVerificationHeader) { if x != nil { x.VerifyHeader = v } } // SetBody sets body of the response. -func (x *SendLocalTrustResponse) SetBody(v *SendLocalTrustResponse_Body) { +func (x *AnnounceLocalTrustResponse) SetBody(v *AnnounceLocalTrustResponse_Body) { if x != nil { x.Body = v } } // SetMetaHeader sets meta header of the response. -func (x *SendLocalTrustResponse) SetMetaHeader(v *session.ResponseMetaHeader) { +func (x *AnnounceLocalTrustResponse) SetMetaHeader(v *session.ResponseMetaHeader) { if x != nil { x.MetaHeader = v } } // SetVerifyHeader sets verification header of the response. -func (x *SendLocalTrustResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) { +func (x *AnnounceLocalTrustResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) { if x != nil { x.VerifyHeader = v } } // SetEpoch sets epoch in which the intermediate trust was assessed. -func (x *SendIntermediateResultRequest_Body) SetEpoch(v uint64) { +func (x *AnnounceIntermediateResultRequest_Body) SetEpoch(v uint64) { if x != nil { x.Epoch = v } } // SetIteration sets sequence number of the iteration. -func (x *SendIntermediateResultRequest_Body) SetIteration(v uint32) { +func (x *AnnounceIntermediateResultRequest_Body) SetIteration(v uint32) { if x != nil { x.Iteration = v } } // SetTrust sets current global trust value. -func (x *SendIntermediateResultRequest_Body) SetTrust(v *PeerToPeerTrust) { +func (x *AnnounceIntermediateResultRequest_Body) SetTrust(v *PeerToPeerTrust) { if x != nil { x.Trust = v } } // SetBody sets body of the request. -func (x *SendIntermediateResultRequest) SetBody(v *SendIntermediateResultRequest_Body) { +func (x *AnnounceIntermediateResultRequest) SetBody(v *AnnounceIntermediateResultRequest_Body) { if x != nil { x.Body = v } } // SetMetaHeader sets meta header of the request. -func (x *SendIntermediateResultRequest) SetMetaHeader(v *session.RequestMetaHeader) { +func (x *AnnounceIntermediateResultRequest) SetMetaHeader(v *session.RequestMetaHeader) { if x != nil { x.MetaHeader = v } } // SetVerifyHeader sets verification header of the request. -func (x *SendIntermediateResultRequest) SetVerifyHeader(v *session.RequestVerificationHeader) { +func (x *AnnounceIntermediateResultRequest) SetVerifyHeader(v *session.RequestVerificationHeader) { if x != nil { x.VerifyHeader = v } } // SetBody sets body of the response. -func (x *SendIntermediateResultResponse) SetBody(v *SendIntermediateResultResponse_Body) { +func (x *AnnounceIntermediateResultResponse) SetBody(v *AnnounceIntermediateResultResponse_Body) { if x != nil { x.Body = v } } // SetMetaHeader sets meta header of the response. -func (x *SendIntermediateResultResponse) SetMetaHeader(v *session.ResponseMetaHeader) { +func (x *AnnounceIntermediateResultResponse) SetMetaHeader(v *session.ResponseMetaHeader) { if x != nil { x.MetaHeader = v } } // SetVerifyHeader sets verification header of the response. -func (x *SendIntermediateResultResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) { +func (x *AnnounceIntermediateResultResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) { if x != nil { x.VerifyHeader = v } diff --git a/v2/reputation/grpc/service.pb.go b/v2/reputation/grpc/service.pb.go index 0f0edfa..79234d6 100644 --- a/v2/reputation/grpc/service.pb.go +++ b/v2/reputation/grpc/service.pb.go @@ -30,14 +30,14 @@ const ( // of the legacy proto package is being used. const _ = proto.ProtoPackageIsVersion4 -// Request to send local trust. -type SendLocalTrustRequest struct { +// Announce node's local trust information. +type AnnounceLocalTrustRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields // Body of the request message. - Body *SendLocalTrustRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` + Body *AnnounceLocalTrustRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" json:"meta_header,omitempty"` @@ -47,8 +47,8 @@ type SendLocalTrustRequest struct { VerifyHeader *grpc.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` } -func (x *SendLocalTrustRequest) Reset() { - *x = SendLocalTrustRequest{} +func (x *AnnounceLocalTrustRequest) Reset() { + *x = AnnounceLocalTrustRequest{} if protoimpl.UnsafeEnabled { mi := &file_v2_reputation_grpc_service_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -56,13 +56,13 @@ func (x *SendLocalTrustRequest) Reset() { } } -func (x *SendLocalTrustRequest) String() string { +func (x *AnnounceLocalTrustRequest) String() string { return protoimpl.X.MessageStringOf(x) } -func (*SendLocalTrustRequest) ProtoMessage() {} +func (*AnnounceLocalTrustRequest) ProtoMessage() {} -func (x *SendLocalTrustRequest) ProtoReflect() protoreflect.Message { +func (x *AnnounceLocalTrustRequest) ProtoReflect() protoreflect.Message { mi := &file_v2_reputation_grpc_service_proto_msgTypes[0] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -74,40 +74,40 @@ func (x *SendLocalTrustRequest) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use SendLocalTrustRequest.ProtoReflect.Descriptor instead. -func (*SendLocalTrustRequest) Descriptor() ([]byte, []int) { +// Deprecated: Use AnnounceLocalTrustRequest.ProtoReflect.Descriptor instead. +func (*AnnounceLocalTrustRequest) Descriptor() ([]byte, []int) { return file_v2_reputation_grpc_service_proto_rawDescGZIP(), []int{0} } -func (x *SendLocalTrustRequest) GetBody() *SendLocalTrustRequest_Body { +func (x *AnnounceLocalTrustRequest) GetBody() *AnnounceLocalTrustRequest_Body { if x != nil { return x.Body } return nil } -func (x *SendLocalTrustRequest) GetMetaHeader() *grpc.RequestMetaHeader { +func (x *AnnounceLocalTrustRequest) GetMetaHeader() *grpc.RequestMetaHeader { if x != nil { return x.MetaHeader } return nil } -func (x *SendLocalTrustRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { +func (x *AnnounceLocalTrustRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { if x != nil { return x.VerifyHeader } return nil } -// Response to request to send local trust. -type SendLocalTrustResponse struct { +// Node's local trust information announce response. +type AnnounceLocalTrustResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields // Body of the response message. - Body *SendLocalTrustResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` + Body *AnnounceLocalTrustResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" json:"meta_header,omitempty"` @@ -117,8 +117,8 @@ type SendLocalTrustResponse struct { VerifyHeader *grpc.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` } -func (x *SendLocalTrustResponse) Reset() { - *x = SendLocalTrustResponse{} +func (x *AnnounceLocalTrustResponse) Reset() { + *x = AnnounceLocalTrustResponse{} if protoimpl.UnsafeEnabled { mi := &file_v2_reputation_grpc_service_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -126,13 +126,13 @@ func (x *SendLocalTrustResponse) Reset() { } } -func (x *SendLocalTrustResponse) String() string { +func (x *AnnounceLocalTrustResponse) String() string { return protoimpl.X.MessageStringOf(x) } -func (*SendLocalTrustResponse) ProtoMessage() {} +func (*AnnounceLocalTrustResponse) ProtoMessage() {} -func (x *SendLocalTrustResponse) ProtoReflect() protoreflect.Message { +func (x *AnnounceLocalTrustResponse) ProtoReflect() protoreflect.Message { mi := &file_v2_reputation_grpc_service_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -144,40 +144,40 @@ func (x *SendLocalTrustResponse) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use SendLocalTrustResponse.ProtoReflect.Descriptor instead. -func (*SendLocalTrustResponse) Descriptor() ([]byte, []int) { +// Deprecated: Use AnnounceLocalTrustResponse.ProtoReflect.Descriptor instead. +func (*AnnounceLocalTrustResponse) Descriptor() ([]byte, []int) { return file_v2_reputation_grpc_service_proto_rawDescGZIP(), []int{1} } -func (x *SendLocalTrustResponse) GetBody() *SendLocalTrustResponse_Body { +func (x *AnnounceLocalTrustResponse) GetBody() *AnnounceLocalTrustResponse_Body { if x != nil { return x.Body } return nil } -func (x *SendLocalTrustResponse) GetMetaHeader() *grpc.ResponseMetaHeader { +func (x *AnnounceLocalTrustResponse) GetMetaHeader() *grpc.ResponseMetaHeader { if x != nil { return x.MetaHeader } return nil } -func (x *SendLocalTrustResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { +func (x *AnnounceLocalTrustResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { if x != nil { return x.VerifyHeader } return nil } -// Request to send intermediate global trust. -type SendIntermediateResultRequest struct { +// Announce intermediate global trust information. +type AnnounceIntermediateResultRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields // Body of the request message. - Body *SendIntermediateResultRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` + Body *AnnounceIntermediateResultRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" json:"meta_header,omitempty"` @@ -187,8 +187,8 @@ type SendIntermediateResultRequest struct { VerifyHeader *grpc.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` } -func (x *SendIntermediateResultRequest) Reset() { - *x = SendIntermediateResultRequest{} +func (x *AnnounceIntermediateResultRequest) Reset() { + *x = AnnounceIntermediateResultRequest{} if protoimpl.UnsafeEnabled { mi := &file_v2_reputation_grpc_service_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -196,13 +196,13 @@ func (x *SendIntermediateResultRequest) Reset() { } } -func (x *SendIntermediateResultRequest) String() string { +func (x *AnnounceIntermediateResultRequest) String() string { return protoimpl.X.MessageStringOf(x) } -func (*SendIntermediateResultRequest) ProtoMessage() {} +func (*AnnounceIntermediateResultRequest) ProtoMessage() {} -func (x *SendIntermediateResultRequest) ProtoReflect() protoreflect.Message { +func (x *AnnounceIntermediateResultRequest) ProtoReflect() protoreflect.Message { mi := &file_v2_reputation_grpc_service_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -214,40 +214,40 @@ func (x *SendIntermediateResultRequest) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use SendIntermediateResultRequest.ProtoReflect.Descriptor instead. -func (*SendIntermediateResultRequest) Descriptor() ([]byte, []int) { +// Deprecated: Use AnnounceIntermediateResultRequest.ProtoReflect.Descriptor instead. +func (*AnnounceIntermediateResultRequest) Descriptor() ([]byte, []int) { return file_v2_reputation_grpc_service_proto_rawDescGZIP(), []int{2} } -func (x *SendIntermediateResultRequest) GetBody() *SendIntermediateResultRequest_Body { +func (x *AnnounceIntermediateResultRequest) GetBody() *AnnounceIntermediateResultRequest_Body { if x != nil { return x.Body } return nil } -func (x *SendIntermediateResultRequest) GetMetaHeader() *grpc.RequestMetaHeader { +func (x *AnnounceIntermediateResultRequest) GetMetaHeader() *grpc.RequestMetaHeader { if x != nil { return x.MetaHeader } return nil } -func (x *SendIntermediateResultRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { +func (x *AnnounceIntermediateResultRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { if x != nil { return x.VerifyHeader } return nil } -// Response to request to send intermediate global trust. -type SendIntermediateResultResponse struct { +// Intermediate global trust information announce response. +type AnnounceIntermediateResultResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields // Body of the response message. - Body *SendIntermediateResultResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` + Body *AnnounceIntermediateResultResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" json:"meta_header,omitempty"` @@ -257,8 +257,8 @@ type SendIntermediateResultResponse struct { VerifyHeader *grpc.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"` } -func (x *SendIntermediateResultResponse) Reset() { - *x = SendIntermediateResultResponse{} +func (x *AnnounceIntermediateResultResponse) Reset() { + *x = AnnounceIntermediateResultResponse{} if protoimpl.UnsafeEnabled { mi := &file_v2_reputation_grpc_service_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -266,13 +266,13 @@ func (x *SendIntermediateResultResponse) Reset() { } } -func (x *SendIntermediateResultResponse) String() string { +func (x *AnnounceIntermediateResultResponse) String() string { return protoimpl.X.MessageStringOf(x) } -func (*SendIntermediateResultResponse) ProtoMessage() {} +func (*AnnounceIntermediateResultResponse) ProtoMessage() {} -func (x *SendIntermediateResultResponse) ProtoReflect() protoreflect.Message { +func (x *AnnounceIntermediateResultResponse) ProtoReflect() protoreflect.Message { mi := &file_v2_reputation_grpc_service_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -284,48 +284,48 @@ func (x *SendIntermediateResultResponse) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use SendIntermediateResultResponse.ProtoReflect.Descriptor instead. -func (*SendIntermediateResultResponse) Descriptor() ([]byte, []int) { +// Deprecated: Use AnnounceIntermediateResultResponse.ProtoReflect.Descriptor instead. +func (*AnnounceIntermediateResultResponse) Descriptor() ([]byte, []int) { return file_v2_reputation_grpc_service_proto_rawDescGZIP(), []int{3} } -func (x *SendIntermediateResultResponse) GetBody() *SendIntermediateResultResponse_Body { +func (x *AnnounceIntermediateResultResponse) GetBody() *AnnounceIntermediateResultResponse_Body { if x != nil { return x.Body } return nil } -func (x *SendIntermediateResultResponse) GetMetaHeader() *grpc.ResponseMetaHeader { +func (x *AnnounceIntermediateResultResponse) GetMetaHeader() *grpc.ResponseMetaHeader { if x != nil { return x.MetaHeader } return nil } -func (x *SendIntermediateResultResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { +func (x *AnnounceIntermediateResultResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { if x != nil { return x.VerifyHeader } return nil } -// Request body structure. -type SendLocalTrustRequest_Body struct { +// Announce node's local trust information. +type AnnounceLocalTrustRequest_Body struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // The number of the epoch in which the trust was assessed. + // Trust assessment Epoch number Epoch uint64 `protobuf:"varint,1,opt,name=epoch,proto3" json:"epoch,omitempty"` - // List of normalized local trust values of the client to the NeoFS peers. - // The value is calculated according to EigenTrust++ algorithm - // and must be in the range [0;1]. + // List of normalized local trust values to other NeoFS nodes. The value + // is calculated according to EigenTrust++ algorithm and must be a + // floating point number in the [0;1] range. Trusts []*Trust `protobuf:"bytes,2,rep,name=trusts,proto3" json:"trusts,omitempty"` } -func (x *SendLocalTrustRequest_Body) Reset() { - *x = SendLocalTrustRequest_Body{} +func (x *AnnounceLocalTrustRequest_Body) Reset() { + *x = AnnounceLocalTrustRequest_Body{} if protoimpl.UnsafeEnabled { mi := &file_v2_reputation_grpc_service_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -333,13 +333,13 @@ func (x *SendLocalTrustRequest_Body) Reset() { } } -func (x *SendLocalTrustRequest_Body) String() string { +func (x *AnnounceLocalTrustRequest_Body) String() string { return protoimpl.X.MessageStringOf(x) } -func (*SendLocalTrustRequest_Body) ProtoMessage() {} +func (*AnnounceLocalTrustRequest_Body) ProtoMessage() {} -func (x *SendLocalTrustRequest_Body) ProtoReflect() protoreflect.Message { +func (x *AnnounceLocalTrustRequest_Body) ProtoReflect() protoreflect.Message { mi := &file_v2_reputation_grpc_service_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -351,34 +351,36 @@ func (x *SendLocalTrustRequest_Body) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use SendLocalTrustRequest_Body.ProtoReflect.Descriptor instead. -func (*SendLocalTrustRequest_Body) Descriptor() ([]byte, []int) { +// Deprecated: Use AnnounceLocalTrustRequest_Body.ProtoReflect.Descriptor instead. +func (*AnnounceLocalTrustRequest_Body) Descriptor() ([]byte, []int) { return file_v2_reputation_grpc_service_proto_rawDescGZIP(), []int{0, 0} } -func (x *SendLocalTrustRequest_Body) GetEpoch() uint64 { +func (x *AnnounceLocalTrustRequest_Body) GetEpoch() uint64 { if x != nil { return x.Epoch } return 0 } -func (x *SendLocalTrustRequest_Body) GetTrusts() []*Trust { +func (x *AnnounceLocalTrustRequest_Body) GetTrusts() []*Trust { if x != nil { return x.Trusts } return nil } -// Response body structure. -type SendLocalTrustResponse_Body struct { +// Response to the node's local trust information announce has an empty body +// because the trust exchange operation is asynchronous. If Trust information +// will not pass sanity checks it is silently ignored. +type AnnounceLocalTrustResponse_Body struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields } -func (x *SendLocalTrustResponse_Body) Reset() { - *x = SendLocalTrustResponse_Body{} +func (x *AnnounceLocalTrustResponse_Body) Reset() { + *x = AnnounceLocalTrustResponse_Body{} if protoimpl.UnsafeEnabled { mi := &file_v2_reputation_grpc_service_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -386,13 +388,13 @@ func (x *SendLocalTrustResponse_Body) Reset() { } } -func (x *SendLocalTrustResponse_Body) String() string { +func (x *AnnounceLocalTrustResponse_Body) String() string { return protoimpl.X.MessageStringOf(x) } -func (*SendLocalTrustResponse_Body) ProtoMessage() {} +func (*AnnounceLocalTrustResponse_Body) ProtoMessage() {} -func (x *SendLocalTrustResponse_Body) ProtoReflect() protoreflect.Message { +func (x *AnnounceLocalTrustResponse_Body) ProtoReflect() protoreflect.Message { mi := &file_v2_reputation_grpc_service_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -404,27 +406,27 @@ func (x *SendLocalTrustResponse_Body) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use SendLocalTrustResponse_Body.ProtoReflect.Descriptor instead. -func (*SendLocalTrustResponse_Body) Descriptor() ([]byte, []int) { +// Deprecated: Use AnnounceLocalTrustResponse_Body.ProtoReflect.Descriptor instead. +func (*AnnounceLocalTrustResponse_Body) Descriptor() ([]byte, []int) { return file_v2_reputation_grpc_service_proto_rawDescGZIP(), []int{1, 0} } -// Request body structure. -type SendIntermediateResultRequest_Body struct { +// Announce intermediate global trust information. +type AnnounceIntermediateResultRequest_Body struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // The number of the epoch in which the iteration was executed. + // Iteration execution Epoch number Epoch uint64 `protobuf:"varint,1,opt,name=epoch,proto3" json:"epoch,omitempty"` - // Sequence number of the iteration. + // Iteration sequence number Iteration uint32 `protobuf:"varint,2,opt,name=iteration,proto3" json:"iteration,omitempty"` - // Current global trust value computed at the specified iteration. + // Current global trust value calculated at the specified iteration Trust *PeerToPeerTrust `protobuf:"bytes,3,opt,name=trust,proto3" json:"trust,omitempty"` } -func (x *SendIntermediateResultRequest_Body) Reset() { - *x = SendIntermediateResultRequest_Body{} +func (x *AnnounceIntermediateResultRequest_Body) Reset() { + *x = AnnounceIntermediateResultRequest_Body{} if protoimpl.UnsafeEnabled { mi := &file_v2_reputation_grpc_service_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -432,13 +434,13 @@ func (x *SendIntermediateResultRequest_Body) Reset() { } } -func (x *SendIntermediateResultRequest_Body) String() string { +func (x *AnnounceIntermediateResultRequest_Body) String() string { return protoimpl.X.MessageStringOf(x) } -func (*SendIntermediateResultRequest_Body) ProtoMessage() {} +func (*AnnounceIntermediateResultRequest_Body) ProtoMessage() {} -func (x *SendIntermediateResultRequest_Body) ProtoReflect() protoreflect.Message { +func (x *AnnounceIntermediateResultRequest_Body) ProtoReflect() protoreflect.Message { mi := &file_v2_reputation_grpc_service_proto_msgTypes[6] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -450,41 +452,43 @@ func (x *SendIntermediateResultRequest_Body) ProtoReflect() protoreflect.Message return mi.MessageOf(x) } -// Deprecated: Use SendIntermediateResultRequest_Body.ProtoReflect.Descriptor instead. -func (*SendIntermediateResultRequest_Body) Descriptor() ([]byte, []int) { +// Deprecated: Use AnnounceIntermediateResultRequest_Body.ProtoReflect.Descriptor instead. +func (*AnnounceIntermediateResultRequest_Body) Descriptor() ([]byte, []int) { return file_v2_reputation_grpc_service_proto_rawDescGZIP(), []int{2, 0} } -func (x *SendIntermediateResultRequest_Body) GetEpoch() uint64 { +func (x *AnnounceIntermediateResultRequest_Body) GetEpoch() uint64 { if x != nil { return x.Epoch } return 0 } -func (x *SendIntermediateResultRequest_Body) GetIteration() uint32 { +func (x *AnnounceIntermediateResultRequest_Body) GetIteration() uint32 { if x != nil { return x.Iteration } return 0 } -func (x *SendIntermediateResultRequest_Body) GetTrust() *PeerToPeerTrust { +func (x *AnnounceIntermediateResultRequest_Body) GetTrust() *PeerToPeerTrust { if x != nil { return x.Trust } return nil } -// Response body structure. -type SendIntermediateResultResponse_Body struct { +// Response to the node's intermediate global trust information announce has +// an empty body because the trust exchange operation is asynchronous. If +// Trust information will not pass sanity checks it is silently ignored. +type AnnounceIntermediateResultResponse_Body struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields } -func (x *SendIntermediateResultResponse_Body) Reset() { - *x = SendIntermediateResultResponse_Body{} +func (x *AnnounceIntermediateResultResponse_Body) Reset() { + *x = AnnounceIntermediateResultResponse_Body{} if protoimpl.UnsafeEnabled { mi := &file_v2_reputation_grpc_service_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -492,13 +496,13 @@ func (x *SendIntermediateResultResponse_Body) Reset() { } } -func (x *SendIntermediateResultResponse_Body) String() string { +func (x *AnnounceIntermediateResultResponse_Body) String() string { return protoimpl.X.MessageStringOf(x) } -func (*SendIntermediateResultResponse_Body) ProtoMessage() {} +func (*AnnounceIntermediateResultResponse_Body) ProtoMessage() {} -func (x *SendIntermediateResultResponse_Body) ProtoReflect() protoreflect.Message { +func (x *AnnounceIntermediateResultResponse_Body) ProtoReflect() protoreflect.Message { mi := &file_v2_reputation_grpc_service_proto_msgTypes[7] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -510,8 +514,8 @@ func (x *SendIntermediateResultResponse_Body) ProtoReflect() protoreflect.Messag return mi.MessageOf(x) } -// Deprecated: Use SendIntermediateResultResponse_Body.ProtoReflect.Descriptor instead. -func (*SendIntermediateResultResponse_Body) Descriptor() ([]byte, []int) { +// Deprecated: Use AnnounceIntermediateResultResponse_Body.ProtoReflect.Descriptor instead. +func (*AnnounceIntermediateResultResponse_Body) Descriptor() ([]byte, []int) { return file_v2_reputation_grpc_service_proto_rawDescGZIP(), []int{3, 0} } @@ -525,32 +529,33 @@ var file_v2_reputation_grpc_service_proto_rawDesc = []byte{ 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x76, 0x32, 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, 0xca, 0x02, 0x0a, 0x15, 0x53, 0x65, 0x6e, 0x64, 0x4c, 0x6f, - 0x63, 0x61, 0x6c, 0x54, 0x72, 0x75, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, - 0x44, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x30, 0x2e, - 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x54, 0x72, - 0x75, 0x73, 0x74, 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, - 0x51, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x12, 0x33, 0x0a, - 0x06, 0x74, 0x72, 0x75, 0x73, 0x74, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, - 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x54, 0x72, 0x75, 0x73, 0x74, 0x52, 0x06, 0x74, 0x72, 0x75, 0x73, - 0x74, 0x73, 0x22, 0x83, 0x02, 0x0a, 0x16, 0x53, 0x65, 0x6e, 0x64, 0x4c, 0x6f, 0x63, 0x61, 0x6c, - 0x54, 0x72, 0x75, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x45, 0x0a, - 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x31, 0x2e, 0x6e, 0x65, - 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x54, 0x72, 0x75, 0x73, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xd2, 0x02, 0x0a, 0x19, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, + 0x63, 0x65, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x54, 0x72, 0x75, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x12, 0x48, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x34, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, + 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, + 0x65, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x54, 0x72, 0x75, 0x73, 0x74, 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, 0x51, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, + 0x14, 0x0a, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, + 0x65, 0x70, 0x6f, 0x63, 0x68, 0x12, 0x33, 0x0a, 0x06, 0x74, 0x72, 0x75, 0x73, 0x74, 0x73, 0x18, + 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x54, 0x72, 0x75, + 0x73, 0x74, 0x52, 0x06, 0x74, 0x72, 0x75, 0x73, 0x74, 0x73, 0x22, 0x8b, 0x02, 0x0a, 0x1a, 0x41, + 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x54, 0x72, 0x75, 0x73, + 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x49, 0x0a, 0x04, 0x62, 0x6f, 0x64, + 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x35, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, + 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x41, + 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x54, 0x72, 0x75, 0x73, 0x74, 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, @@ -562,36 +567,37 @@ var file_v2_reputation_grpc_service_proto_rawDesc = []byte{ 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, 0x06, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x22, 0x80, 0x03, 0x0a, 0x1d, 0x53, 0x65, 0x6e, - 0x64, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, - 0x75, 0x6c, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x4c, 0x0a, 0x04, 0x62, 0x6f, - 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x38, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, - 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, - 0x53, 0x65, 0x6e, 0x64, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x74, 0x65, - 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 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, 0x77, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x70, - 0x6f, 0x63, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, - 0x12, 0x1c, 0x0a, 0x09, 0x69, 0x74, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0d, 0x52, 0x09, 0x69, 0x74, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3b, - 0x0a, 0x05, 0x74, 0x72, 0x75, 0x73, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, - 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x54, 0x6f, 0x50, 0x65, 0x65, 0x72, 0x54, - 0x72, 0x75, 0x73, 0x74, 0x52, 0x05, 0x74, 0x72, 0x75, 0x73, 0x74, 0x22, 0x93, 0x02, 0x0a, 0x1e, - 0x53, 0x65, 0x6e, 0x64, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x74, 0x65, - 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4d, - 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x39, 0x2e, 0x6e, + 0x1a, 0x06, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x22, 0x88, 0x03, 0x0a, 0x21, 0x41, 0x6e, 0x6e, + 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x74, + 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x50, + 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6d, 0x65, 0x64, + 0x69, 0x6f, 0x6e, 0x2e, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x49, 0x6e, 0x74, 0x65, + 0x72, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 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, 0x77, 0x0a, 0x04, 0x42, 0x6f, + 0x64, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x04, 0x52, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x12, 0x1c, 0x0a, 0x09, 0x69, 0x74, 0x65, 0x72, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x69, 0x74, 0x65, + 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3b, 0x0a, 0x05, 0x74, 0x72, 0x75, 0x73, 0x74, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x50, 0x65, 0x65, + 0x72, 0x54, 0x6f, 0x50, 0x65, 0x65, 0x72, 0x54, 0x72, 0x75, 0x73, 0x74, 0x52, 0x05, 0x74, 0x72, + 0x75, 0x73, 0x74, 0x22, 0x9b, 0x02, 0x0a, 0x22, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, + 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x75, + 0x6c, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x51, 0x0a, 0x04, 0x62, 0x6f, + 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, + 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 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, @@ -604,30 +610,31 @@ var file_v2_reputation_grpc_service_proto_rawDesc = []byte{ 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, 0x06, 0x0a, 0x04, 0x42, 0x6f, 0x64, - 0x79, 0x32, 0x86, 0x02, 0x0a, 0x11, 0x52, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x6b, 0x0a, 0x0e, 0x53, 0x65, 0x6e, 0x64, 0x4c, - 0x6f, 0x63, 0x61, 0x6c, 0x54, 0x72, 0x75, 0x73, 0x74, 0x12, 0x2b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, - 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x54, 0x72, 0x75, 0x73, 0x74, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, - 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x65, - 0x6e, 0x64, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x54, 0x72, 0x75, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x83, 0x01, 0x0a, 0x16, 0x53, 0x65, 0x6e, 0x64, 0x49, 0x6e, 0x74, + 0x79, 0x32, 0x9e, 0x02, 0x0a, 0x11, 0x52, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x77, 0x0a, 0x12, 0x41, 0x6e, 0x6e, 0x6f, 0x75, + 0x6e, 0x63, 0x65, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x54, 0x72, 0x75, 0x73, 0x74, 0x12, 0x2f, 0x2e, + 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x4c, 0x6f, 0x63, + 0x61, 0x6c, 0x54, 0x72, 0x75, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x30, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x4c, 0x6f, + 0x63, 0x61, 0x6c, 0x54, 0x72, 0x75, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x8f, 0x01, 0x0a, 0x1a, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, - 0x33, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, - 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x49, 0x6e, 0x74, 0x65, 0x72, - 0x6d, 0x65, 0x64, 0x69, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x34, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, - 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x65, 0x6e, 0x64, - 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x75, - 0x6c, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x62, 0x5a, 0x3f, 0x67, 0x69, - 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, - 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, - 0x76, 0x32, 0x2f, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x67, 0x72, - 0x70, 0x63, 0x3b, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xaa, 0x02, 0x1e, - 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, - 0x41, 0x50, 0x49, 0x2e, 0x52, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x62, 0x06, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x37, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, + 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x49, + 0x6e, 0x74, 0x65, 0x72, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, + 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x38, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, + 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6d, 0x65, 0x64, + 0x69, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x42, 0x62, 0x5a, 0x3f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, + 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, + 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x72, 0x65, 0x70, 0x75, 0x74, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x72, 0x65, 0x70, 0x75, 0x74, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xaa, 0x02, 0x1e, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, + 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x52, 0x65, 0x70, 0x75, + 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -644,40 +651,40 @@ func file_v2_reputation_grpc_service_proto_rawDescGZIP() []byte { var file_v2_reputation_grpc_service_proto_msgTypes = make([]protoimpl.MessageInfo, 8) var file_v2_reputation_grpc_service_proto_goTypes = []interface{}{ - (*SendLocalTrustRequest)(nil), // 0: neo.fs.v2.reputation.SendLocalTrustRequest - (*SendLocalTrustResponse)(nil), // 1: neo.fs.v2.reputation.SendLocalTrustResponse - (*SendIntermediateResultRequest)(nil), // 2: neo.fs.v2.reputation.SendIntermediateResultRequest - (*SendIntermediateResultResponse)(nil), // 3: neo.fs.v2.reputation.SendIntermediateResultResponse - (*SendLocalTrustRequest_Body)(nil), // 4: neo.fs.v2.reputation.SendLocalTrustRequest.Body - (*SendLocalTrustResponse_Body)(nil), // 5: neo.fs.v2.reputation.SendLocalTrustResponse.Body - (*SendIntermediateResultRequest_Body)(nil), // 6: neo.fs.v2.reputation.SendIntermediateResultRequest.Body - (*SendIntermediateResultResponse_Body)(nil), // 7: neo.fs.v2.reputation.SendIntermediateResultResponse.Body - (*grpc.RequestMetaHeader)(nil), // 8: neo.fs.v2.session.RequestMetaHeader - (*grpc.RequestVerificationHeader)(nil), // 9: neo.fs.v2.session.RequestVerificationHeader - (*grpc.ResponseMetaHeader)(nil), // 10: neo.fs.v2.session.ResponseMetaHeader - (*grpc.ResponseVerificationHeader)(nil), // 11: neo.fs.v2.session.ResponseVerificationHeader - (*Trust)(nil), // 12: neo.fs.v2.reputation.Trust - (*PeerToPeerTrust)(nil), // 13: neo.fs.v2.reputation.PeerToPeerTrust + (*AnnounceLocalTrustRequest)(nil), // 0: neo.fs.v2.reputation.AnnounceLocalTrustRequest + (*AnnounceLocalTrustResponse)(nil), // 1: neo.fs.v2.reputation.AnnounceLocalTrustResponse + (*AnnounceIntermediateResultRequest)(nil), // 2: neo.fs.v2.reputation.AnnounceIntermediateResultRequest + (*AnnounceIntermediateResultResponse)(nil), // 3: neo.fs.v2.reputation.AnnounceIntermediateResultResponse + (*AnnounceLocalTrustRequest_Body)(nil), // 4: neo.fs.v2.reputation.AnnounceLocalTrustRequest.Body + (*AnnounceLocalTrustResponse_Body)(nil), // 5: neo.fs.v2.reputation.AnnounceLocalTrustResponse.Body + (*AnnounceIntermediateResultRequest_Body)(nil), // 6: neo.fs.v2.reputation.AnnounceIntermediateResultRequest.Body + (*AnnounceIntermediateResultResponse_Body)(nil), // 7: neo.fs.v2.reputation.AnnounceIntermediateResultResponse.Body + (*grpc.RequestMetaHeader)(nil), // 8: neo.fs.v2.session.RequestMetaHeader + (*grpc.RequestVerificationHeader)(nil), // 9: neo.fs.v2.session.RequestVerificationHeader + (*grpc.ResponseMetaHeader)(nil), // 10: neo.fs.v2.session.ResponseMetaHeader + (*grpc.ResponseVerificationHeader)(nil), // 11: neo.fs.v2.session.ResponseVerificationHeader + (*Trust)(nil), // 12: neo.fs.v2.reputation.Trust + (*PeerToPeerTrust)(nil), // 13: neo.fs.v2.reputation.PeerToPeerTrust } var file_v2_reputation_grpc_service_proto_depIdxs = []int32{ - 4, // 0: neo.fs.v2.reputation.SendLocalTrustRequest.body:type_name -> neo.fs.v2.reputation.SendLocalTrustRequest.Body - 8, // 1: neo.fs.v2.reputation.SendLocalTrustRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader - 9, // 2: neo.fs.v2.reputation.SendLocalTrustRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader - 5, // 3: neo.fs.v2.reputation.SendLocalTrustResponse.body:type_name -> neo.fs.v2.reputation.SendLocalTrustResponse.Body - 10, // 4: neo.fs.v2.reputation.SendLocalTrustResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader - 11, // 5: neo.fs.v2.reputation.SendLocalTrustResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader - 6, // 6: neo.fs.v2.reputation.SendIntermediateResultRequest.body:type_name -> neo.fs.v2.reputation.SendIntermediateResultRequest.Body - 8, // 7: neo.fs.v2.reputation.SendIntermediateResultRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader - 9, // 8: neo.fs.v2.reputation.SendIntermediateResultRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader - 7, // 9: neo.fs.v2.reputation.SendIntermediateResultResponse.body:type_name -> neo.fs.v2.reputation.SendIntermediateResultResponse.Body - 10, // 10: neo.fs.v2.reputation.SendIntermediateResultResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader - 11, // 11: neo.fs.v2.reputation.SendIntermediateResultResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader - 12, // 12: neo.fs.v2.reputation.SendLocalTrustRequest.Body.trusts:type_name -> neo.fs.v2.reputation.Trust - 13, // 13: neo.fs.v2.reputation.SendIntermediateResultRequest.Body.trust:type_name -> neo.fs.v2.reputation.PeerToPeerTrust - 0, // 14: neo.fs.v2.reputation.ReputationService.SendLocalTrust:input_type -> neo.fs.v2.reputation.SendLocalTrustRequest - 2, // 15: neo.fs.v2.reputation.ReputationService.SendIntermediateResult:input_type -> neo.fs.v2.reputation.SendIntermediateResultRequest - 1, // 16: neo.fs.v2.reputation.ReputationService.SendLocalTrust:output_type -> neo.fs.v2.reputation.SendLocalTrustResponse - 3, // 17: neo.fs.v2.reputation.ReputationService.SendIntermediateResult:output_type -> neo.fs.v2.reputation.SendIntermediateResultResponse + 4, // 0: neo.fs.v2.reputation.AnnounceLocalTrustRequest.body:type_name -> neo.fs.v2.reputation.AnnounceLocalTrustRequest.Body + 8, // 1: neo.fs.v2.reputation.AnnounceLocalTrustRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader + 9, // 2: neo.fs.v2.reputation.AnnounceLocalTrustRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader + 5, // 3: neo.fs.v2.reputation.AnnounceLocalTrustResponse.body:type_name -> neo.fs.v2.reputation.AnnounceLocalTrustResponse.Body + 10, // 4: neo.fs.v2.reputation.AnnounceLocalTrustResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader + 11, // 5: neo.fs.v2.reputation.AnnounceLocalTrustResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 6, // 6: neo.fs.v2.reputation.AnnounceIntermediateResultRequest.body:type_name -> neo.fs.v2.reputation.AnnounceIntermediateResultRequest.Body + 8, // 7: neo.fs.v2.reputation.AnnounceIntermediateResultRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader + 9, // 8: neo.fs.v2.reputation.AnnounceIntermediateResultRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader + 7, // 9: neo.fs.v2.reputation.AnnounceIntermediateResultResponse.body:type_name -> neo.fs.v2.reputation.AnnounceIntermediateResultResponse.Body + 10, // 10: neo.fs.v2.reputation.AnnounceIntermediateResultResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader + 11, // 11: neo.fs.v2.reputation.AnnounceIntermediateResultResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 12, // 12: neo.fs.v2.reputation.AnnounceLocalTrustRequest.Body.trusts:type_name -> neo.fs.v2.reputation.Trust + 13, // 13: neo.fs.v2.reputation.AnnounceIntermediateResultRequest.Body.trust:type_name -> neo.fs.v2.reputation.PeerToPeerTrust + 0, // 14: neo.fs.v2.reputation.ReputationService.AnnounceLocalTrust:input_type -> neo.fs.v2.reputation.AnnounceLocalTrustRequest + 2, // 15: neo.fs.v2.reputation.ReputationService.AnnounceIntermediateResult:input_type -> neo.fs.v2.reputation.AnnounceIntermediateResultRequest + 1, // 16: neo.fs.v2.reputation.ReputationService.AnnounceLocalTrust:output_type -> neo.fs.v2.reputation.AnnounceLocalTrustResponse + 3, // 17: neo.fs.v2.reputation.ReputationService.AnnounceIntermediateResult:output_type -> neo.fs.v2.reputation.AnnounceIntermediateResultResponse 16, // [16:18] is the sub-list for method output_type 14, // [14:16] is the sub-list for method input_type 14, // [14:14] is the sub-list for extension type_name @@ -693,7 +700,7 @@ func file_v2_reputation_grpc_service_proto_init() { file_v2_reputation_grpc_types_proto_init() if !protoimpl.UnsafeEnabled { file_v2_reputation_grpc_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SendLocalTrustRequest); i { + switch v := v.(*AnnounceLocalTrustRequest); i { case 0: return &v.state case 1: @@ -705,7 +712,7 @@ func file_v2_reputation_grpc_service_proto_init() { } } file_v2_reputation_grpc_service_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SendLocalTrustResponse); i { + switch v := v.(*AnnounceLocalTrustResponse); i { case 0: return &v.state case 1: @@ -717,7 +724,7 @@ func file_v2_reputation_grpc_service_proto_init() { } } file_v2_reputation_grpc_service_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SendIntermediateResultRequest); i { + switch v := v.(*AnnounceIntermediateResultRequest); i { case 0: return &v.state case 1: @@ -729,7 +736,7 @@ func file_v2_reputation_grpc_service_proto_init() { } } file_v2_reputation_grpc_service_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SendIntermediateResultResponse); i { + switch v := v.(*AnnounceIntermediateResultResponse); i { case 0: return &v.state case 1: @@ -741,7 +748,7 @@ func file_v2_reputation_grpc_service_proto_init() { } } file_v2_reputation_grpc_service_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SendLocalTrustRequest_Body); i { + switch v := v.(*AnnounceLocalTrustRequest_Body); i { case 0: return &v.state case 1: @@ -753,7 +760,7 @@ func file_v2_reputation_grpc_service_proto_init() { } } file_v2_reputation_grpc_service_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SendLocalTrustResponse_Body); i { + switch v := v.(*AnnounceLocalTrustResponse_Body); i { case 0: return &v.state case 1: @@ -765,7 +772,7 @@ func file_v2_reputation_grpc_service_proto_init() { } } file_v2_reputation_grpc_service_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SendIntermediateResultRequest_Body); i { + switch v := v.(*AnnounceIntermediateResultRequest_Body); i { case 0: return &v.state case 1: @@ -777,7 +784,7 @@ func file_v2_reputation_grpc_service_proto_init() { } } file_v2_reputation_grpc_service_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SendIntermediateResultResponse_Body); i { + switch v := v.(*AnnounceIntermediateResultResponse_Body); i { case 0: return &v.state case 1: @@ -821,11 +828,11 @@ const _ = grpc1.SupportPackageIsVersion6 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type ReputationServiceClient interface { - // Sends local client trust to any peer from NeoFS network. - SendLocalTrust(ctx context.Context, in *SendLocalTrustRequest, opts ...grpc1.CallOption) (*SendLocalTrustResponse, error) - // Sends the intermediate result of the iterative algorithm - // for calculating the global reputation of the node. - SendIntermediateResult(ctx context.Context, in *SendIntermediateResultRequest, opts ...grpc1.CallOption) (*SendIntermediateResultResponse, error) + // Announce local client trust information to any node in NeoFS network. + AnnounceLocalTrust(ctx context.Context, in *AnnounceLocalTrustRequest, opts ...grpc1.CallOption) (*AnnounceLocalTrustResponse, error) + // Announces the intermediate result of the iterative algorithm for + // calculating the global reputation of the node in NeoFS network. + AnnounceIntermediateResult(ctx context.Context, in *AnnounceIntermediateResultRequest, opts ...grpc1.CallOption) (*AnnounceIntermediateResultResponse, error) } type reputationServiceClient struct { @@ -836,18 +843,18 @@ func NewReputationServiceClient(cc grpc1.ClientConnInterface) ReputationServiceC return &reputationServiceClient{cc} } -func (c *reputationServiceClient) SendLocalTrust(ctx context.Context, in *SendLocalTrustRequest, opts ...grpc1.CallOption) (*SendLocalTrustResponse, error) { - out := new(SendLocalTrustResponse) - err := c.cc.Invoke(ctx, "/neo.fs.v2.reputation.ReputationService/SendLocalTrust", in, out, opts...) +func (c *reputationServiceClient) AnnounceLocalTrust(ctx context.Context, in *AnnounceLocalTrustRequest, opts ...grpc1.CallOption) (*AnnounceLocalTrustResponse, error) { + out := new(AnnounceLocalTrustResponse) + err := c.cc.Invoke(ctx, "/neo.fs.v2.reputation.ReputationService/AnnounceLocalTrust", in, out, opts...) if err != nil { return nil, err } return out, nil } -func (c *reputationServiceClient) SendIntermediateResult(ctx context.Context, in *SendIntermediateResultRequest, opts ...grpc1.CallOption) (*SendIntermediateResultResponse, error) { - out := new(SendIntermediateResultResponse) - err := c.cc.Invoke(ctx, "/neo.fs.v2.reputation.ReputationService/SendIntermediateResult", in, out, opts...) +func (c *reputationServiceClient) AnnounceIntermediateResult(ctx context.Context, in *AnnounceIntermediateResultRequest, opts ...grpc1.CallOption) (*AnnounceIntermediateResultResponse, error) { + out := new(AnnounceIntermediateResultResponse) + err := c.cc.Invoke(ctx, "/neo.fs.v2.reputation.ReputationService/AnnounceIntermediateResult", in, out, opts...) if err != nil { return nil, err } @@ -856,60 +863,60 @@ func (c *reputationServiceClient) SendIntermediateResult(ctx context.Context, in // ReputationServiceServer is the server API for ReputationService service. type ReputationServiceServer interface { - // Sends local client trust to any peer from NeoFS network. - SendLocalTrust(context.Context, *SendLocalTrustRequest) (*SendLocalTrustResponse, error) - // Sends the intermediate result of the iterative algorithm - // for calculating the global reputation of the node. - SendIntermediateResult(context.Context, *SendIntermediateResultRequest) (*SendIntermediateResultResponse, error) + // Announce local client trust information to any node in NeoFS network. + AnnounceLocalTrust(context.Context, *AnnounceLocalTrustRequest) (*AnnounceLocalTrustResponse, error) + // Announces the intermediate result of the iterative algorithm for + // calculating the global reputation of the node in NeoFS network. + AnnounceIntermediateResult(context.Context, *AnnounceIntermediateResultRequest) (*AnnounceIntermediateResultResponse, error) } // UnimplementedReputationServiceServer can be embedded to have forward compatible implementations. type UnimplementedReputationServiceServer struct { } -func (*UnimplementedReputationServiceServer) SendLocalTrust(context.Context, *SendLocalTrustRequest) (*SendLocalTrustResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method SendLocalTrust not implemented") +func (*UnimplementedReputationServiceServer) AnnounceLocalTrust(context.Context, *AnnounceLocalTrustRequest) (*AnnounceLocalTrustResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method AnnounceLocalTrust not implemented") } -func (*UnimplementedReputationServiceServer) SendIntermediateResult(context.Context, *SendIntermediateResultRequest) (*SendIntermediateResultResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method SendIntermediateResult not implemented") +func (*UnimplementedReputationServiceServer) AnnounceIntermediateResult(context.Context, *AnnounceIntermediateResultRequest) (*AnnounceIntermediateResultResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method AnnounceIntermediateResult not implemented") } func RegisterReputationServiceServer(s *grpc1.Server, srv ReputationServiceServer) { s.RegisterService(&_ReputationService_serviceDesc, srv) } -func _ReputationService_SendLocalTrust_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc1.UnaryServerInterceptor) (interface{}, error) { - in := new(SendLocalTrustRequest) +func _ReputationService_AnnounceLocalTrust_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc1.UnaryServerInterceptor) (interface{}, error) { + in := new(AnnounceLocalTrustRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(ReputationServiceServer).SendLocalTrust(ctx, in) + return srv.(ReputationServiceServer).AnnounceLocalTrust(ctx, in) } info := &grpc1.UnaryServerInfo{ Server: srv, - FullMethod: "/neo.fs.v2.reputation.ReputationService/SendLocalTrust", + FullMethod: "/neo.fs.v2.reputation.ReputationService/AnnounceLocalTrust", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ReputationServiceServer).SendLocalTrust(ctx, req.(*SendLocalTrustRequest)) + return srv.(ReputationServiceServer).AnnounceLocalTrust(ctx, req.(*AnnounceLocalTrustRequest)) } return interceptor(ctx, in, info, handler) } -func _ReputationService_SendIntermediateResult_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc1.UnaryServerInterceptor) (interface{}, error) { - in := new(SendIntermediateResultRequest) +func _ReputationService_AnnounceIntermediateResult_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc1.UnaryServerInterceptor) (interface{}, error) { + in := new(AnnounceIntermediateResultRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(ReputationServiceServer).SendIntermediateResult(ctx, in) + return srv.(ReputationServiceServer).AnnounceIntermediateResult(ctx, in) } info := &grpc1.UnaryServerInfo{ Server: srv, - FullMethod: "/neo.fs.v2.reputation.ReputationService/SendIntermediateResult", + FullMethod: "/neo.fs.v2.reputation.ReputationService/AnnounceIntermediateResult", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ReputationServiceServer).SendIntermediateResult(ctx, req.(*SendIntermediateResultRequest)) + return srv.(ReputationServiceServer).AnnounceIntermediateResult(ctx, req.(*AnnounceIntermediateResultRequest)) } return interceptor(ctx, in, info, handler) } @@ -919,12 +926,12 @@ var _ReputationService_serviceDesc = grpc1.ServiceDesc{ HandlerType: (*ReputationServiceServer)(nil), Methods: []grpc1.MethodDesc{ { - MethodName: "SendLocalTrust", - Handler: _ReputationService_SendLocalTrust_Handler, + MethodName: "AnnounceLocalTrust", + Handler: _ReputationService_AnnounceLocalTrust_Handler, }, { - MethodName: "SendIntermediateResult", - Handler: _ReputationService_SendIntermediateResult_Handler, + MethodName: "AnnounceIntermediateResult", + Handler: _ReputationService_AnnounceIntermediateResult_Handler, }, }, Streams: []grpc1.StreamDesc{}, diff --git a/v2/reputation/grpc/types.go b/v2/reputation/grpc/types.go index 07d1d8b..86fb05f 100644 --- a/v2/reputation/grpc/types.go +++ b/v2/reputation/grpc/types.go @@ -4,10 +4,10 @@ import ( refs "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" ) -// SetValue sets binary ID. -func (x *PeerID) SetValue(v []byte) { +// SetPublicKey sets binary public key of ID. +func (x *PeerID) SetPublicKey(v []byte) { if x != nil { - x.Value = v + x.PublicKey = v } } diff --git a/v2/reputation/grpc/types.pb.go b/v2/reputation/grpc/types.pb.go index 7c4ec04..d81fca4 100644 --- a/v2/reputation/grpc/types.pb.go +++ b/v2/reputation/grpc/types.pb.go @@ -26,10 +26,8 @@ const ( // of the legacy proto package is being used. const _ = proto.ProtoPackageIsVersion4 -// NeoFS unique peer identifier. -// -// `PeerID` is a 33 byte long compressed public key of the node -// stored in network map. +// NeoFS unique peer identifier is 33 byte long compressed public key of the +// node, the same as the one stored in the network map. // // String presentation is // [base58](https://tools.ietf.org/html/draft-msporny-base58-02) encoded string. @@ -44,8 +42,8 @@ type PeerID struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // Peer identifier in a binary format. - Value []byte `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` + // Peer node's public key + PublicKey []byte `protobuf:"bytes,1,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"` } func (x *PeerID) Reset() { @@ -80,22 +78,22 @@ func (*PeerID) Descriptor() ([]byte, []int) { return file_v2_reputation_grpc_types_proto_rawDescGZIP(), []int{0} } -func (x *PeerID) GetValue() []byte { +func (x *PeerID) GetPublicKey() []byte { if x != nil { - return x.Value + return x.PublicKey } return nil } -// Trust value to NeoFS network peer. +// Trust level to a NeoFS network peer. type Trust struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // Identifier of the trusted peer. + // Identifier of the trusted peer Peer *PeerID `protobuf:"bytes,1,opt,name=peer,proto3" json:"peer,omitempty"` - // Trust value. + // Trust level in [0:1] range Value float64 `protobuf:"fixed64,2,opt,name=value,proto3" json:"value,omitempty"` } @@ -145,15 +143,15 @@ func (x *Trust) GetValue() float64 { return 0 } -// Trust value of a peer to a peer. +// Trust level of a peer to a peer. type PeerToPeerTrust struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // Identifier of the trusting peer. + // Identifier of the trusting peer TrustingPeer *PeerID `protobuf:"bytes,1,opt,name=trusting_peer,json=trustingPeer,proto3" json:"trusting_peer,omitempty"` - // Trust value. + // Trust level Trust *Trust `protobuf:"bytes,2,opt,name=trust,proto3" json:"trust,omitempty"` } @@ -203,7 +201,7 @@ func (x *PeerToPeerTrust) GetTrust() *Trust { return nil } -// Global trust value to NeoFS network peer. +// Global trust level to NeoFS node. type GlobalTrust struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -212,7 +210,7 @@ type GlobalTrust struct { // Message format version. Effectively the version of API library used to create // the message. Version *grpc.Version `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` - // Message body. + // Message body Body *GlobalTrust_Body `protobuf:"bytes,2,opt,name=body,proto3" json:"body,omitempty"` // Signature of the binary `body` field by the manager. Signature *grpc.Signature `protobuf:"bytes,3,opt,name=signature,proto3" json:"signature,omitempty"` @@ -277,9 +275,9 @@ type GlobalTrust_Body struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // Node manager ID. + // Node manager ID Manager *PeerID `protobuf:"bytes,1,opt,name=manager,proto3" json:"manager,omitempty"` - // Global trust value. + // Global trust level Trust *Trust `protobuf:"bytes,2,opt,name=trust,proto3" json:"trust,omitempty"` } @@ -337,48 +335,48 @@ var file_v2_reputation_grpc_types_proto_rawDesc = []byte{ 0x12, 0x14, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0x18, 0x76, 0x32, 0x2f, 0x72, 0x65, 0x66, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x22, 0x1e, 0x0a, 0x06, 0x50, 0x65, 0x65, 0x72, 0x49, 0x44, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x22, 0x4f, 0x0a, 0x05, 0x54, 0x72, 0x75, 0x73, 0x74, 0x12, 0x30, 0x0a, 0x04, 0x70, 0x65, 0x65, - 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, - 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x50, - 0x65, 0x65, 0x72, 0x49, 0x44, 0x52, 0x04, 0x70, 0x65, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x22, 0x87, 0x01, 0x0a, 0x0f, 0x50, 0x65, 0x65, 0x72, 0x54, 0x6f, 0x50, 0x65, 0x65, 0x72, - 0x54, 0x72, 0x75, 0x73, 0x74, 0x12, 0x41, 0x0a, 0x0d, 0x74, 0x72, 0x75, 0x73, 0x74, 0x69, 0x6e, - 0x67, 0x5f, 0x70, 0x65, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x6e, - 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x49, 0x44, 0x52, 0x0c, 0x74, 0x72, 0x75, 0x73, - 0x74, 0x69, 0x6e, 0x67, 0x50, 0x65, 0x65, 0x72, 0x12, 0x31, 0x0a, 0x05, 0x74, 0x72, 0x75, 0x73, - 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, - 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x54, - 0x72, 0x75, 0x73, 0x74, 0x52, 0x05, 0x74, 0x72, 0x75, 0x73, 0x74, 0x22, 0xa8, 0x02, 0x0a, 0x0b, - 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x54, 0x72, 0x75, 0x73, 0x74, 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, 0x3a, - 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x6e, - 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x2e, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x54, 0x72, 0x75, 0x73, 0x74, 0x2e, - 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x37, 0x0a, 0x09, 0x73, 0x69, - 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, - 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, - 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, - 0x75, 0x72, 0x65, 0x1a, 0x71, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x36, 0x0a, 0x07, 0x6d, - 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x6e, - 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x49, 0x44, 0x52, 0x07, 0x6d, 0x61, 0x6e, 0x61, - 0x67, 0x65, 0x72, 0x12, 0x31, 0x0a, 0x05, 0x74, 0x72, 0x75, 0x73, 0x74, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, - 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x54, 0x72, 0x75, 0x73, 0x74, 0x52, - 0x05, 0x74, 0x72, 0x75, 0x73, 0x74, 0x42, 0x62, 0x5a, 0x3f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, - 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, - 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x72, - 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x72, - 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xaa, 0x02, 0x1e, 0x4e, 0x65, 0x6f, 0x2e, - 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, - 0x52, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x33, + 0x22, 0x27, 0x0a, 0x06, 0x50, 0x65, 0x65, 0x72, 0x49, 0x44, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x75, + 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, + 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x22, 0x4f, 0x0a, 0x05, 0x54, 0x72, 0x75, + 0x73, 0x74, 0x12, 0x30, 0x0a, 0x04, 0x70, 0x65, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x1c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, + 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x49, 0x44, 0x52, 0x04, + 0x70, 0x65, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x87, 0x01, 0x0a, 0x0f, 0x50, + 0x65, 0x65, 0x72, 0x54, 0x6f, 0x50, 0x65, 0x65, 0x72, 0x54, 0x72, 0x75, 0x73, 0x74, 0x12, 0x41, + 0x0a, 0x0d, 0x74, 0x72, 0x75, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x5f, 0x70, 0x65, 0x65, 0x72, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x50, 0x65, 0x65, + 0x72, 0x49, 0x44, 0x52, 0x0c, 0x74, 0x72, 0x75, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x50, 0x65, 0x65, + 0x72, 0x12, 0x31, 0x0a, 0x05, 0x74, 0x72, 0x75, 0x73, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, + 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x54, 0x72, 0x75, 0x73, 0x74, 0x52, 0x05, 0x74, + 0x72, 0x75, 0x73, 0x74, 0x22, 0xa8, 0x02, 0x0a, 0x0b, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x54, + 0x72, 0x75, 0x73, 0x74, 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, 0x3a, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x47, 0x6c, 0x6f, + 0x62, 0x61, 0x6c, 0x54, 0x72, 0x75, 0x73, 0x74, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, + 0x6f, 0x64, 0x79, 0x12, 0x37, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, + 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, + 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x1a, 0x71, 0x0a, 0x04, + 0x42, 0x6f, 0x64, 0x79, 0x12, 0x36, 0x0a, 0x07, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x50, 0x65, 0x65, + 0x72, 0x49, 0x44, 0x52, 0x07, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x12, 0x31, 0x0a, 0x05, + 0x74, 0x72, 0x75, 0x73, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, + 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x2e, 0x54, 0x72, 0x75, 0x73, 0x74, 0x52, 0x05, 0x74, 0x72, 0x75, 0x73, 0x74, 0x42, + 0x62, 0x5a, 0x3f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, + 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, + 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0xaa, 0x02, 0x1e, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, + 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x52, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/v2/reputation/marshal.go b/v2/reputation/marshal.go index 2f08408..6c15062 100644 --- a/v2/reputation/marshal.go +++ b/v2/reputation/marshal.go @@ -8,7 +8,7 @@ import ( const ( _ = iota - peerIDValFNum + peerIDPubKeyFNum ) func (x *PeerID) StableMarshal(buf []byte) ([]byte, error) { @@ -20,7 +20,7 @@ func (x *PeerID) StableMarshal(buf []byte) ([]byte, error) { buf = make([]byte, x.StableSize()) } - _, err := protoutil.BytesMarshal(peerIDValFNum, buf, x.val) + _, err := protoutil.BytesMarshal(peerIDPubKeyFNum, buf, x.publicKey) if err != nil { return nil, err } @@ -29,7 +29,7 @@ func (x *PeerID) StableMarshal(buf []byte) ([]byte, error) { } func (x *PeerID) StableSize() (size int) { - size += protoutil.BytesSize(peerIDValFNum, x.val) + size += protoutil.BytesSize(peerIDPubKeyFNum, x.publicKey) return } @@ -212,11 +212,11 @@ func (x *GlobalTrust) Unmarshal(data []byte) error { const ( _ = iota - sendLocalTrustBodyEpochFNum - sendLocalTrustBodyTrustsFNum + announceLocalTrustBodyEpochFNum + announceLocalTrustBodyTrustsFNum ) -func (x *SendLocalTrustRequestBody) StableMarshal(buf []byte) ([]byte, error) { +func (x *AnnounceLocalTrustRequestBody) StableMarshal(buf []byte) ([]byte, error) { if x == nil { return []byte{}, nil } @@ -230,7 +230,7 @@ func (x *SendLocalTrustRequestBody) StableMarshal(buf []byte) ([]byte, error) { err error ) - n, err = protoutil.UInt64Marshal(sendLocalTrustBodyEpochFNum, buf[offset:], x.epoch) + n, err = protoutil.UInt64Marshal(announceLocalTrustBodyEpochFNum, buf[offset:], x.epoch) if err != nil { return nil, err } @@ -238,7 +238,7 @@ func (x *SendLocalTrustRequestBody) StableMarshal(buf []byte) ([]byte, error) { offset += n for i := range x.trusts { - n, err = protoutil.NestedStructureMarshal(sendLocalTrustBodyTrustsFNum, buf[offset:], x.trusts[i]) + n, err = protoutil.NestedStructureMarshal(announceLocalTrustBodyTrustsFNum, buf[offset:], x.trusts[i]) if err != nil { return nil, err } @@ -249,40 +249,40 @@ func (x *SendLocalTrustRequestBody) StableMarshal(buf []byte) ([]byte, error) { return buf, nil } -func (x *SendLocalTrustRequestBody) StableSize() (size int) { - size += protoutil.UInt64Size(sendLocalTrustBodyEpochFNum, x.epoch) +func (x *AnnounceLocalTrustRequestBody) StableSize() (size int) { + size += protoutil.UInt64Size(announceLocalTrustBodyEpochFNum, x.epoch) for i := range x.trusts { - size += protoutil.NestedStructureSize(sendLocalTrustBodyTrustsFNum, x.trusts[i]) + size += protoutil.NestedStructureSize(announceLocalTrustBodyTrustsFNum, x.trusts[i]) } return } -func (x *SendLocalTrustRequestBody) Unmarshal(data []byte) error { - return message.Unmarshal(x, data, new(reputation.SendLocalTrustRequest_Body)) +func (x *AnnounceLocalTrustRequestBody) Unmarshal(data []byte) error { + return message.Unmarshal(x, data, new(reputation.AnnounceLocalTrustRequest_Body)) } -func (x *SendLocalTrustResponseBody) StableMarshal(buf []byte) ([]byte, error) { +func (x *AnnounceLocalTrustResponseBody) StableMarshal(buf []byte) ([]byte, error) { return buf, nil } -func (x *SendLocalTrustResponseBody) StableSize() int { +func (x *AnnounceLocalTrustResponseBody) StableSize() int { return 0 } -func (x *SendLocalTrustResponseBody) Unmarshal(data []byte) error { - return message.Unmarshal(x, data, new(reputation.SendLocalTrustResponse_Body)) +func (x *AnnounceLocalTrustResponseBody) Unmarshal(data []byte) error { + return message.Unmarshal(x, data, new(reputation.AnnounceLocalTrustResponse_Body)) } const ( _ = iota - sendInterResBodyEpochFNum - sendInterResBodyIterFNum - sendInterResBodyTrustFNum + announceInterResBodyEpochFNum + announceInterResBodyIterFNum + announceInterResBodyTrustFNum ) -func (x *SendIntermediateResultRequestBody) StableMarshal(buf []byte) ([]byte, error) { +func (x *AnnounceIntermediateResultRequestBody) StableMarshal(buf []byte) ([]byte, error) { if x == nil { return []byte{}, nil } @@ -296,21 +296,21 @@ func (x *SendIntermediateResultRequestBody) StableMarshal(buf []byte) ([]byte, e err error ) - n, err = protoutil.UInt64Marshal(sendInterResBodyEpochFNum, buf, x.epoch) + n, err = protoutil.UInt64Marshal(announceInterResBodyEpochFNum, buf, x.epoch) if err != nil { return nil, err } offset += n - n, err = protoutil.UInt32Marshal(sendInterResBodyIterFNum, buf[offset:], x.iter) + n, err = protoutil.UInt32Marshal(announceInterResBodyIterFNum, buf[offset:], x.iter) if err != nil { return nil, err } offset += n - _, err = protoutil.NestedStructureMarshal(sendInterResBodyTrustFNum, buf[offset:], x.trust) + _, err = protoutil.NestedStructureMarshal(announceInterResBodyTrustFNum, buf[offset:], x.trust) if err != nil { return nil, err } @@ -318,26 +318,26 @@ func (x *SendIntermediateResultRequestBody) StableMarshal(buf []byte) ([]byte, e return buf, nil } -func (x *SendIntermediateResultRequestBody) StableSize() (size int) { - size += protoutil.UInt64Size(sendInterResBodyEpochFNum, x.epoch) - size += protoutil.UInt32Size(sendInterResBodyIterFNum, x.iter) - size += protoutil.NestedStructureSize(sendInterResBodyTrustFNum, x.trust) +func (x *AnnounceIntermediateResultRequestBody) StableSize() (size int) { + size += protoutil.UInt64Size(announceInterResBodyEpochFNum, x.epoch) + size += protoutil.UInt32Size(announceInterResBodyIterFNum, x.iter) + size += protoutil.NestedStructureSize(announceInterResBodyTrustFNum, x.trust) return } -func (x *SendIntermediateResultRequestBody) Unmarshal(data []byte) error { - return message.Unmarshal(x, data, new(reputation.SendIntermediateResultRequest_Body)) +func (x *AnnounceIntermediateResultRequestBody) Unmarshal(data []byte) error { + return message.Unmarshal(x, data, new(reputation.AnnounceIntermediateResultRequest_Body)) } -func (x *SendIntermediateResultResponseBody) StableMarshal(buf []byte) ([]byte, error) { +func (x *AnnounceIntermediateResultResponseBody) StableMarshal(buf []byte) ([]byte, error) { return buf, nil } -func (x *SendIntermediateResultResponseBody) StableSize() int { +func (x *AnnounceIntermediateResultResponseBody) StableSize() int { return 0 } -func (x *SendIntermediateResultResponseBody) Unmarshal(data []byte) error { - return message.Unmarshal(x, data, new(reputation.SendIntermediateResultResponse_Body)) +func (x *AnnounceIntermediateResultResponseBody) Unmarshal(data []byte) error { + return message.Unmarshal(x, data, new(reputation.AnnounceIntermediateResultResponse_Body)) } diff --git a/v2/reputation/message_test.go b/v2/reputation/message_test.go index 2d5899a..f09c636 100644 --- a/v2/reputation/message_test.go +++ b/v2/reputation/message_test.go @@ -11,18 +11,22 @@ import ( func TestMessageConvert(t *testing.T) { messagetest.TestRPCMessage(t, func(empty bool) message.Message { return reputationtest.GenerateTrust(empty) }, - func(empty bool) message.Message { return reputationtest.GenerateSendLocalTrustRequestBody(empty) }, - func(empty bool) message.Message { return reputationtest.GenerateSendLocalTrustRequest(empty) }, - func(empty bool) message.Message { return reputationtest.GenerateSendLocalTrustResponseBody(empty) }, - func(empty bool) message.Message { return reputationtest.GenerateSendLocalTrustResponse(empty) }, + func(empty bool) message.Message { return reputationtest.GenerateAnnounceLocalTrustRequestBody(empty) }, + func(empty bool) message.Message { return reputationtest.GenerateAnnounceLocalTrustRequest(empty) }, + func(empty bool) message.Message { return reputationtest.GenerateAnnounceLocalTrustResponseBody(empty) }, + func(empty bool) message.Message { return reputationtest.GenerateAnnounceLocalTrustResponse(empty) }, func(empty bool) message.Message { - return reputationtest.GenerateSendIntermediateResultRequestBody(empty) + return reputationtest.GenerateAnnounceIntermediateResultRequestBody(empty) }, - func(empty bool) message.Message { return reputationtest.GenerateSendIntermediateResultRequest(empty) }, func(empty bool) message.Message { - return reputationtest.GenerateSendIntermediateResultResponseBody(empty) + return reputationtest.GenerateAnnounceIntermediateResultRequest(empty) + }, + func(empty bool) message.Message { + return reputationtest.GenerateAnnounceIntermediateResultResponseBody(empty) + }, + func(empty bool) message.Message { + return reputationtest.GenerateAnnounceIntermediateResultResponse(empty) }, - func(empty bool) message.Message { return reputationtest.GenerateSendIntermediateResultResponse(empty) }, func(empty bool) message.Message { return reputationtest.GenerateGlobalTrustBody(empty) }, func(empty bool) message.Message { return reputationtest.GenerateGlobalTrust(empty) }, func(empty bool) message.Message { return reputationtest.GeneratePeerToPeerTrust(empty) }, diff --git a/v2/reputation/test/generate.go b/v2/reputation/test/generate.go index 8b2adc5..cd6bd0c 100644 --- a/v2/reputation/test/generate.go +++ b/v2/reputation/test/generate.go @@ -10,7 +10,7 @@ func GeneratePeerID(empty bool) *reputation.PeerID { m := new(reputation.PeerID) if !empty { - m.SetValue([]byte{1, 2, 3}) + m.SetPublicKey([]byte{1, 2, 3}) } return m @@ -67,8 +67,8 @@ func GenerateTrusts(empty bool) (res []*reputation.Trust) { return } -func GenerateSendLocalTrustRequestBody(empty bool) *reputation.SendLocalTrustRequestBody { - m := new(reputation.SendLocalTrustRequestBody) +func GenerateAnnounceLocalTrustRequestBody(empty bool) *reputation.AnnounceLocalTrustRequestBody { + m := new(reputation.AnnounceLocalTrustRequestBody) if !empty { m.SetEpoch(13) @@ -79,34 +79,34 @@ func GenerateSendLocalTrustRequestBody(empty bool) *reputation.SendLocalTrustReq return m } -func GenerateSendLocalTrustRequest(empty bool) *reputation.SendLocalTrustRequest { - m := new(reputation.SendLocalTrustRequest) +func GenerateAnnounceLocalTrustRequest(empty bool) *reputation.AnnounceLocalTrustRequest { + m := new(reputation.AnnounceLocalTrustRequest) - m.SetBody(GenerateSendLocalTrustRequestBody(empty)) + m.SetBody(GenerateAnnounceLocalTrustRequestBody(empty)) m.SetMetaHeader(sessiontest.GenerateRequestMetaHeader(empty)) m.SetVerificationHeader(sessiontest.GenerateRequestVerificationHeader(empty)) return m } -func GenerateSendLocalTrustResponseBody(empty bool) *reputation.SendLocalTrustResponseBody { - m := new(reputation.SendLocalTrustResponseBody) +func GenerateAnnounceLocalTrustResponseBody(empty bool) *reputation.AnnounceLocalTrustResponseBody { + m := new(reputation.AnnounceLocalTrustResponseBody) return m } -func GenerateSendLocalTrustResponse(empty bool) *reputation.SendLocalTrustResponse { - m := new(reputation.SendLocalTrustResponse) +func GenerateAnnounceLocalTrustResponse(empty bool) *reputation.AnnounceLocalTrustResponse { + m := new(reputation.AnnounceLocalTrustResponse) - m.SetBody(GenerateSendLocalTrustResponseBody(empty)) + m.SetBody(GenerateAnnounceLocalTrustResponseBody(empty)) m.SetMetaHeader(sessiontest.GenerateResponseMetaHeader(empty)) m.SetVerificationHeader(sessiontest.GenerateResponseVerificationHeader(empty)) return m } -func GenerateSendIntermediateResultRequestBody(empty bool) *reputation.SendIntermediateResultRequestBody { - m := new(reputation.SendIntermediateResultRequestBody) +func GenerateAnnounceIntermediateResultRequestBody(empty bool) *reputation.AnnounceIntermediateResultRequestBody { + m := new(reputation.AnnounceIntermediateResultRequestBody) if !empty { m.SetEpoch(123) @@ -117,26 +117,26 @@ func GenerateSendIntermediateResultRequestBody(empty bool) *reputation.SendInter return m } -func GenerateSendIntermediateResultRequest(empty bool) *reputation.SendIntermediateResultRequest { - m := new(reputation.SendIntermediateResultRequest) +func GenerateAnnounceIntermediateResultRequest(empty bool) *reputation.AnnounceIntermediateResultRequest { + m := new(reputation.AnnounceIntermediateResultRequest) - m.SetBody(GenerateSendIntermediateResultRequestBody(empty)) + m.SetBody(GenerateAnnounceIntermediateResultRequestBody(empty)) m.SetMetaHeader(sessiontest.GenerateRequestMetaHeader(empty)) m.SetVerificationHeader(sessiontest.GenerateRequestVerificationHeader(empty)) return m } -func GenerateSendIntermediateResultResponseBody(empty bool) *reputation.SendIntermediateResultResponseBody { - m := new(reputation.SendIntermediateResultResponseBody) +func GenerateAnnounceIntermediateResultResponseBody(empty bool) *reputation.AnnounceIntermediateResultResponseBody { + m := new(reputation.AnnounceIntermediateResultResponseBody) return m } -func GenerateSendIntermediateResultResponse(empty bool) *reputation.SendIntermediateResultResponse { - m := new(reputation.SendIntermediateResultResponse) +func GenerateAnnounceIntermediateResultResponse(empty bool) *reputation.AnnounceIntermediateResultResponse { + m := new(reputation.AnnounceIntermediateResultResponse) - m.SetBody(GenerateSendIntermediateResultResponseBody(empty)) + m.SetBody(GenerateAnnounceIntermediateResultResponseBody(empty)) m.SetMetaHeader(sessiontest.GenerateResponseMetaHeader(empty)) m.SetVerificationHeader(sessiontest.GenerateResponseVerificationHeader(empty)) diff --git a/v2/reputation/types.go b/v2/reputation/types.go index b1bd707..4ce995d 100644 --- a/v2/reputation/types.go +++ b/v2/reputation/types.go @@ -8,22 +8,22 @@ import ( // PeerID represents reputation.PeerID message // from NeoFS API v2. type PeerID struct { - val []byte + publicKey []byte } -// GetValue returns peer's binary ID. -func (x *PeerID) GetValue() []byte { +// GetPublicKey returns peer's binary public key of ID. +func (x *PeerID) GetPublicKey() []byte { if x != nil { - return x.val + return x.publicKey } return nil } -// SetValue sets peer's binary ID. -func (x *PeerID) SetValue(v []byte) { +// SetPublicKey sets peer's binary public key of ID. +func (x *PeerID) SetPublicKey(v []byte) { if x != nil { - x.val = v + x.publicKey = v } } @@ -205,15 +205,15 @@ func (x *GlobalTrust) SetSignature(v *refs.Signature) { } } -// SendLocalTrustRequestBody is a structure of SendLocalTrust request body. -type SendLocalTrustRequestBody struct { +// AnnounceLocalTrustRequestBody is a structure of AnnounceLocalTrust request body. +type AnnounceLocalTrustRequestBody struct { epoch uint64 trusts []*Trust } // GetEpoch returns epoch in which the trust was assessed. -func (x *SendLocalTrustRequestBody) GetEpoch() uint64 { +func (x *AnnounceLocalTrustRequestBody) GetEpoch() uint64 { if x != nil { return x.epoch } @@ -222,14 +222,14 @@ func (x *SendLocalTrustRequestBody) GetEpoch() uint64 { } // SetEpoch sets epoch in which the trust was assessed. -func (x *SendLocalTrustRequestBody) SetEpoch(v uint64) { +func (x *AnnounceLocalTrustRequestBody) SetEpoch(v uint64) { if x != nil { x.epoch = v } } // GetTrusts returns list of normalized trust values. -func (x *SendLocalTrustRequestBody) GetTrusts() []*Trust { +func (x *AnnounceLocalTrustRequestBody) GetTrusts() []*Trust { if x != nil { return x.trusts } @@ -238,25 +238,25 @@ func (x *SendLocalTrustRequestBody) GetTrusts() []*Trust { } // SetTrusts sets list of normalized trust values. -func (x *SendLocalTrustRequestBody) SetTrusts(v []*Trust) { +func (x *AnnounceLocalTrustRequestBody) SetTrusts(v []*Trust) { if x != nil { x.trusts = v } } -// SendLocalTrustResponseBody is a structure of SendLocalTrust response body. -type SendLocalTrustResponseBody struct{} +// AnnounceLocalTrustResponseBody is a structure of AnnounceLocalTrust response body. +type AnnounceLocalTrustResponseBody struct{} -// SendLocalTrustRequest represents reputation.SendLocalTrustRequest +// AnnounceLocalTrustRequest represents reputation.AnnounceLocalTrustRequest // message from NeoFS API v2. -type SendLocalTrustRequest struct { - body *SendLocalTrustRequestBody +type AnnounceLocalTrustRequest struct { + body *AnnounceLocalTrustRequestBody session.RequestHeaders } // GetBody returns request body. -func (x *SendLocalTrustRequest) GetBody() *SendLocalTrustRequestBody { +func (x *AnnounceLocalTrustRequest) GetBody() *AnnounceLocalTrustRequestBody { if x != nil { return x.body } @@ -265,22 +265,22 @@ func (x *SendLocalTrustRequest) GetBody() *SendLocalTrustRequestBody { } // SetBody sets request body. -func (x *SendLocalTrustRequest) SetBody(v *SendLocalTrustRequestBody) { +func (x *AnnounceLocalTrustRequest) SetBody(v *AnnounceLocalTrustRequestBody) { if x != nil { x.body = v } } -// SendLocalTrustResponse represents reputation.SendLocalTrustResponse +// AnnounceLocalTrustResponse represents reputation.AnnounceLocalTrustResponse // message from NeoFS API v2. -type SendLocalTrustResponse struct { - body *SendLocalTrustResponseBody +type AnnounceLocalTrustResponse struct { + body *AnnounceLocalTrustResponseBody session.ResponseHeaders } // GetBody returns response body. -func (x *SendLocalTrustResponse) GetBody() *SendLocalTrustResponseBody { +func (x *AnnounceLocalTrustResponse) GetBody() *AnnounceLocalTrustResponseBody { if x != nil { return x.body } @@ -289,14 +289,14 @@ func (x *SendLocalTrustResponse) GetBody() *SendLocalTrustResponseBody { } // SetBody sets response body. -func (x *SendLocalTrustResponse) SetBody(v *SendLocalTrustResponseBody) { +func (x *AnnounceLocalTrustResponse) SetBody(v *AnnounceLocalTrustResponseBody) { if x != nil { x.body = v } } -// SendIntermediateResultRequestBody is a structure of SendIntermediateResult request body. -type SendIntermediateResultRequestBody struct { +// AnnounceIntermediateResultRequestBody is a structure of AnnounceIntermediateResult request body. +type AnnounceIntermediateResultRequestBody struct { epoch uint64 iter uint32 @@ -305,7 +305,7 @@ type SendIntermediateResultRequestBody struct { } // GetEpoch returns epoch number in which the intermediate trust was assessed. -func (x *SendIntermediateResultRequestBody) GetEpoch() uint64 { +func (x *AnnounceIntermediateResultRequestBody) GetEpoch() uint64 { if x != nil { return x.epoch } @@ -314,14 +314,14 @@ func (x *SendIntermediateResultRequestBody) GetEpoch() uint64 { } // SetEpoch sets epoch number in which the intermediate trust was assessed. -func (x *SendIntermediateResultRequestBody) SetEpoch(v uint64) { +func (x *AnnounceIntermediateResultRequestBody) SetEpoch(v uint64) { if x != nil { x.epoch = v } } // GetIteration returns sequence number of the iteration. -func (x *SendIntermediateResultRequestBody) GetIteration() uint32 { +func (x *AnnounceIntermediateResultRequestBody) GetIteration() uint32 { if x != nil { return x.iter } @@ -330,14 +330,14 @@ func (x *SendIntermediateResultRequestBody) GetIteration() uint32 { } // SetIteration sets sequence number of the iteration. -func (x *SendIntermediateResultRequestBody) SetIteration(v uint32) { +func (x *AnnounceIntermediateResultRequestBody) SetIteration(v uint32) { if x != nil { x.iter = v } } // GetTrust returns current global trust value. -func (x *SendIntermediateResultRequestBody) GetTrust() *PeerToPeerTrust { +func (x *AnnounceIntermediateResultRequestBody) GetTrust() *PeerToPeerTrust { if x != nil { return x.trust } @@ -346,25 +346,25 @@ func (x *SendIntermediateResultRequestBody) GetTrust() *PeerToPeerTrust { } // SetTrust sets current global trust value. -func (x *SendIntermediateResultRequestBody) SetTrust(v *PeerToPeerTrust) { +func (x *AnnounceIntermediateResultRequestBody) SetTrust(v *PeerToPeerTrust) { if x != nil { x.trust = v } } -// SendLocalTrustResponseBody is a structure of SendIntermediateResult response body. -type SendIntermediateResultResponseBody struct{} +// AnnounceIntermediateResultResponseBody is a structure of AnnounceIntermediateResult response body. +type AnnounceIntermediateResultResponseBody struct{} -// SendIntermediateResultRequest represents reputation.SendIntermediateResult +// AnnounceIntermediateResultRequest represents reputation.AnnounceIntermediateResult // message from NeoFS API v2. -type SendIntermediateResultRequest struct { - body *SendIntermediateResultRequestBody +type AnnounceIntermediateResultRequest struct { + body *AnnounceIntermediateResultRequestBody session.RequestHeaders } // GetBody returns request body. -func (x *SendIntermediateResultRequest) GetBody() *SendIntermediateResultRequestBody { +func (x *AnnounceIntermediateResultRequest) GetBody() *AnnounceIntermediateResultRequestBody { if x != nil { return x.body } @@ -373,22 +373,22 @@ func (x *SendIntermediateResultRequest) GetBody() *SendIntermediateResultRequest } // SetBody sets request body. -func (x *SendIntermediateResultRequest) SetBody(v *SendIntermediateResultRequestBody) { +func (x *AnnounceIntermediateResultRequest) SetBody(v *AnnounceIntermediateResultRequestBody) { if x != nil { x.body = v } } -// SendIntermediateResultResponse represents reputation.SendIntermediateResultResponse +// AnnounceIntermediateResultResponse represents reputation.AnnounceIntermediateResultResponse // message from NeoFS API v2. -type SendIntermediateResultResponse struct { - body *SendIntermediateResultResponseBody +type AnnounceIntermediateResultResponse struct { + body *AnnounceIntermediateResultResponseBody session.ResponseHeaders } // GetBody returns response body. -func (x *SendIntermediateResultResponse) GetBody() *SendIntermediateResultResponseBody { +func (x *AnnounceIntermediateResultResponse) GetBody() *AnnounceIntermediateResultResponseBody { if x != nil { return x.body } @@ -397,7 +397,7 @@ func (x *SendIntermediateResultResponse) GetBody() *SendIntermediateResultRespon } // SetBody sets response body. -func (x *SendIntermediateResultResponse) SetBody(v *SendIntermediateResultResponseBody) { +func (x *AnnounceIntermediateResultResponse) SetBody(v *AnnounceIntermediateResultResponseBody) { if x != nil { x.body = v } diff --git a/v2/rpc/reputation.go b/v2/rpc/reputation.go index 88e2355..3706e38 100644 --- a/v2/rpc/reputation.go +++ b/v2/rpc/reputation.go @@ -9,19 +9,19 @@ import ( const serviceReputation = serviceNamePrefix + "reputation.ReputationService" const ( - rpcReputationSendLocalTrust = "SendLocalTrust" - rpcReputationSendIntermediateResult = "SendIntermediateResult" + rpcReputationAnnounceLocalTrust = "AnnounceLocalTrust" + rpcReputationAnnounceIntermediateResult = "AnnounceIntermediateResult" ) -// SendLocalTrust executes ReputationService.SendLocalTrust RPC. -func SendLocalTrust( +// AnnounceLocalTrust executes ReputationService.AnnounceLocalTrust RPC. +func AnnounceLocalTrust( cli *client.Client, - req *reputation.SendLocalTrustRequest, + req *reputation.AnnounceLocalTrustRequest, opts ...client.CallOption, -) (*reputation.SendLocalTrustResponse, error) { - resp := new(reputation.SendLocalTrustResponse) +) (*reputation.AnnounceLocalTrustResponse, error) { + resp := new(reputation.AnnounceLocalTrustResponse) - err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceReputation, rpcReputationSendLocalTrust), req, resp, opts...) + err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceReputation, rpcReputationAnnounceLocalTrust), req, resp, opts...) if err != nil { return nil, err } @@ -29,15 +29,15 @@ func SendLocalTrust( return resp, nil } -// SendIntermediateResult executes ReputationService.SendIntermediateResult RPC. -func SendIntermediateResult( +// AnnounceIntermediateResult executes ReputationService.AnnounceIntermediateResult RPC. +func AnnounceIntermediateResult( cli *client.Client, - req *reputation.SendIntermediateResultRequest, + req *reputation.AnnounceIntermediateResultRequest, opts ...client.CallOption, -) (*reputation.SendIntermediateResultRequest, error) { - resp := new(reputation.SendIntermediateResultRequest) +) (*reputation.AnnounceIntermediateResultRequest, error) { + resp := new(reputation.AnnounceIntermediateResultRequest) - err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceReputation, rpcReputationSendIntermediateResult), req, resp, opts...) + err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceReputation, rpcReputationAnnounceIntermediateResult), req, resp, opts...) if err != nil { return nil, err } diff --git a/v2/signature/sign.go b/v2/signature/sign.go index d90fa32..33c7386 100644 --- a/v2/signature/sign.go +++ b/v2/signature/sign.go @@ -377,13 +377,13 @@ func serviceMessageBody(req interface{}) stableMarshaler { return v.GetBody() /* Reputation */ - case *reputation.SendLocalTrustRequest: + case *reputation.AnnounceLocalTrustRequest: return v.GetBody() - case *reputation.SendLocalTrustResponse: + case *reputation.AnnounceLocalTrustResponse: return v.GetBody() - case *reputation.SendIntermediateResultRequest: + case *reputation.AnnounceIntermediateResultRequest: return v.GetBody() - case *reputation.SendIntermediateResultResponse: + case *reputation.AnnounceIntermediateResultResponse: return v.GetBody() } } From 2e9db28f1cbd15e166bdd78d996b5d28efdbb5b6 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Fri, 7 May 2021 14:58:47 +0300 Subject: [PATCH 0733/1196] Bump version in `pkg` Signed-off-by: Alex Vanin --- pkg/version.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/version.go b/pkg/version.go index 424dde9..b469b3e 100644 --- a/pkg/version.go +++ b/pkg/version.go @@ -10,7 +10,7 @@ import ( // Version represents v2-compatible version. type Version refs.Version -const sdkMjr, sdkMnr = 2, 4 +const sdkMjr, sdkMnr = 2, 6 // NewVersionFromV2 wraps v2 Version message to Version. func NewVersionFromV2(v *refs.Version) *Version { From 3d28709b69db1b2da32b868a8f1493061663f339 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Fri, 7 May 2021 12:45:20 +0300 Subject: [PATCH 0734/1196] =?UTF-8?q?Release=20v1.26.0=20-=20Daecheongdo?= =?UTF-8?q?=20(=EB=8C=80=EC=B2=AD=EB=8F=84,=20=E5=A4=A7=E9=9D=91=E5=B3=B6)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Alex Vanin --- CHANGELOG.md | 9 +++++++++ CREDITS.md | 1 + README.md | 1 + 3 files changed, 11 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 20ef93d..b528cc9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## [1.26.0] - 2021-05-07 - Daecheongdo (대청도, 大靑島) + +### Added + +- Implementation of `v2/reputation` package. +- Implementation of reputation methods in `pkg/client`. +- Float64 stable marshaling wrappers in `util/proto`. + ## [1.25.0] - 2021-03-22 - Jebudo (제부도, 濟扶島) Raw client and support of NeoFS API v2.5.0 "Jebudo" release. @@ -585,3 +593,4 @@ Initial public release [1.23.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.22.2...v1.23.0 [1.24.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.23.0...v1.24.0 [1.25.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.24.0...v1.25.0 +[1.26.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.25.0...v1.26.0 diff --git a/CREDITS.md b/CREDITS.md index 6d45ff2..f786376 100644 --- a/CREDITS.md +++ b/CREDITS.md @@ -18,6 +18,7 @@ In alphabetical order: In chronological order: - Pavel Korotkov +- Pavel Karpy # Special Thanks diff --git a/README.md b/README.md index 685f73d..300a39d 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,7 @@ versions and SDK layer working with all of them in a handy way. |v1.23.x|[v2.3.0](https://github.com/nspcc-dev/neofs-api/releases/tag/v2.3.0)| |v1.24.x|[v2.4.0](https://github.com/nspcc-dev/neofs-api/releases/tag/v2.4.0)| |v1.25.x|[v2.5.0](https://github.com/nspcc-dev/neofs-api/releases/tag/v2.5.0)| +|v1.26.x|[v2.6.0](https://github.com/nspcc-dev/neofs-api/releases/tag/v2.6.0)| ## Contributing From 442f35d4a1d74d069bb7003e3754c2124ffc09d0 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Tue, 18 May 2021 10:18:27 +0300 Subject: [PATCH 0735/1196] [#284] Update neo-go to v0.95.0 Signed-off-by: Alex Vanin --- go.mod | 2 +- go.sum | 25 ++++++++++--------------- 2 files changed, 11 insertions(+), 16 deletions(-) diff --git a/go.mod b/go.mod index 6ea4d69..a3e860e 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/google/uuid v1.1.1 github.com/mr-tron/base58 v1.1.2 github.com/nspcc-dev/hrw v1.0.9 - github.com/nspcc-dev/neo-go v0.91.0 + github.com/nspcc-dev/neo-go v0.95.0 github.com/nspcc-dev/neofs-crypto v0.3.0 github.com/pkg/errors v0.9.1 github.com/stretchr/testify v1.6.1 diff --git a/go.sum b/go.sum index 163f26c..4cb378c 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,4 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/CityOfZion/neo-go v0.62.1-pre.0.20191114145240-e740fbe708f8/go.mod h1:MJCkWUBhi9pn/CrYO1Q3P687y2KeahrOPS9BD9LDGb0= github.com/CityOfZion/neo-go v0.70.1-pre.0.20191209120015-fccb0085941e/go.mod h1:0enZl0az8xA6PVkwzEOwPWVJGqlt/GO4hA4kmQ5Xzig= @@ -43,7 +42,6 @@ github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8Nz github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -65,24 +63,18 @@ github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9 github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-redis/redis v6.10.2+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= -github.com/go-yaml/yaml v2.1.0+incompatible h1:RYi2hDdss1u4YE7GwixGzWwVo47T8UQwnTLB6vQiq+o= github.com/go-yaml/yaml v2.1.0+incompatible/go.mod h1:w2MrLa16VYP0jy6N7M5kHaCkaLENm+P+Tv+MfurjSw0= -github.com/gogo/protobuf v1.1.1 h1:72R+M5VuhED/KujmZVcIquuo8mBgX4oVda//DQb3PXo= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.3 h1:gyjaxf+svBWX08ZjK86iN9geUJF0H6gp2IRKX6Nf6/I= github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= -github.com/golang/protobuf v1.4.0 h1:oOuy+ugB+P/kBdUnG5QaMXSIyJ1q38wWSojYCb3z5VQ= github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= github.com/golang/protobuf v1.4.3 h1:JjCZWpVbqXDqFVmTfYWEVTMIYrL/NPdPSCHPJ0T/raM= github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= @@ -98,6 +90,8 @@ github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/ github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+lJfyTc= +github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= @@ -136,11 +130,14 @@ github.com/nspcc-dev/dbft v0.0.0-20191209120240-0d6b7568d9ae/go.mod h1:3FjXOoHmA github.com/nspcc-dev/dbft v0.0.0-20200117124306-478e5cfbf03a/go.mod h1:/YFK+XOxxg0Bfm6P92lY5eDSLYfp06XOdL8KAVgXjVk= github.com/nspcc-dev/dbft v0.0.0-20200219114139-199d286ed6c1/go.mod h1:O0qtn62prQSqizzoagHmuuKoz8QMkU3SzBoKdEvm3aQ= github.com/nspcc-dev/dbft v0.0.0-20200711144034-c526ccc6f570/go.mod h1:1FYQXSbb6/9HQIkoF8XO7W/S8N7AZRkBsgwbcXRvk0E= +github.com/nspcc-dev/dbft v0.0.0-20210302103605-cc75991b7cfb/go.mod h1:U8MSnEShH+o5hexfWJdze6uMFJteP0ko7J2frO7Yu1Y= github.com/nspcc-dev/hrw v1.0.9 h1:17VcAuTtrstmFppBjfRiia4K2wA/ukXZhLFS8Y8rz5Y= github.com/nspcc-dev/hrw v1.0.9/go.mod h1:l/W2vx83vMQo6aStyx2AuZrJ+07lGv2JQGlVkPG06MU= github.com/nspcc-dev/neo-go v0.73.1-pre.0.20200303142215-f5a1b928ce09/go.mod h1:pPYwPZ2ks+uMnlRLUyXOpLieaDQSEaf4NM3zHVbRjmg= -github.com/nspcc-dev/neo-go v0.91.0 h1:KKOPMKs0fm8JIau1SuwxiLdrZ+1kDPBiVRlWwzfebWE= github.com/nspcc-dev/neo-go v0.91.0/go.mod h1:G6HdOWvzQ6tlvFdvFSN/PgCzLPN/X/X4d5hTjFRUDcc= +github.com/nspcc-dev/neo-go v0.95.0 h1:bttArYkIuhBJWSZsZ1xVW8MJsj5SvZwAhqVN3HZPNbo= +github.com/nspcc-dev/neo-go v0.95.0/go.mod h1:bW07ge1WFXsBgqrcPpLUr6OcyQxHqM26MZNesWMdH0c= +github.com/nspcc-dev/neofs-api-go v1.24.0/go.mod h1:G7dqincfdjBrAbL5nxVp82emF05fSVEqe59ICsoRDI8= github.com/nspcc-dev/neofs-crypto v0.2.0/go.mod h1:F/96fUzPM3wR+UGsPi3faVNmFlA9KAEAUQR7dMxZmNA= github.com/nspcc-dev/neofs-crypto v0.2.3/go.mod h1:8w16GEJbH6791ktVqHN9YRNH3s9BEEKYxGhlFnp0cDw= github.com/nspcc-dev/neofs-crypto v0.3.0 h1:zlr3pgoxuzrmGCxc5W8dGVfA9Rro8diFvVnBg0L4ifM= @@ -167,7 +164,6 @@ github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5Fsn github.com/prometheus/client_golang v1.2.1/go.mod h1:XMU6Z2MjaRKVu/dC1qupJI9SiNkDYzz3xecMgSW/F+U= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4 h1:gQz4mCbXsO+nc9n1hCxHcGA3Zx3Eo+UHZoInFGUIXNM= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt26CguLLsqA= @@ -196,6 +192,7 @@ github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/syndtr/goleveldb v0.0.0-20180307113352-169b1b37be73/go.mod h1:Z4AUp2Km+PwemOoO/VB5AOx9XSsIItzFjoJlOSiYmn0= github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= +github.com/virtuald/go-ordered-json v0.0.0-20170621173500-b18e6e673d74/go.mod h1:RmMWU37GKR2s6pgrIEB4ixgpVCt/cf7dnJv3fuH1J1c= github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= github.com/yuin/gopher-lua v0.0.0-20190514113301-1cd887cd7036/go.mod h1:gqRgreBUhTSL0GeU64rtZ3Uq3wtjOa/TB2YfrtkCbVQ= github.com/yuin/gopher-lua v0.0.0-20191128022950-c6266f4fe8d7/go.mod h1:gqRgreBUhTSL0GeU64rtZ3Uq3wtjOa/TB2YfrtkCbVQ= @@ -244,8 +241,10 @@ golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20191008105621-543471e840be/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191010194322-b09406accb47/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd h1:xhmwyvizuTgC2qz7ZlMluP20uW+C3Rm0FD/WLDX8884= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68 h1:nxC68pudNYkKU6jWhgrqdreuFiOQWj1Fs7T3VrH4Pjw= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/term v0.0.0-20201210144234-2321bbc49cbf/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/tools v0.0.0-20180318012157-96caea41033d/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -257,7 +256,6 @@ golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IV golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8 h1:Nw54tB0rB7hY/N0NQvRW8DG4Yk3Q6T9cu9RcFQDu1tc= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55 h1:gSJIx1SDwno+2ElGhA4+qG2zF97qiUzTM+rQ0klBOcE= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= @@ -270,13 +268,11 @@ google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLY google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= -google.golang.org/protobuf v1.21.0 h1:qdOKuR/EIArgaWNjetjgTzgVTAZ+S/WXVrq9HW9zimw= google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= google.golang.org/protobuf v1.23.0 h1:4MY060fB1DLGMB/7MBTLnwQUY6+F09GEiz6SsrNqyzM= google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= gopkg.in/abiosoft/ishell.v2 v2.0.0/go.mod h1:sFp+cGtH6o4s1FtpVPTMcHq2yue+c4DGOVohJCPUzwY= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= @@ -284,7 +280,6 @@ gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMy gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= From 9ddfcdfbba4d759a51c2658ceb0fe627fb5b5909 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Mon, 17 May 2021 15:56:17 +0300 Subject: [PATCH 0736/1196] [#277] go.mod: remove `pkg/errors` Use stdlib `errors` instead. Signed-off-by: Evgenii Stratonikov --- go.mod | 1 - pkg/checksum.go | 4 +- pkg/client/accounting.go | 6 +- pkg/client/container.go | 32 ++++++----- pkg/client/netmap.go | 10 ++-- pkg/client/object.go | 106 ++++++++++++++++++------------------ pkg/client/reputation.go | 6 +- pkg/client/session.go | 7 ++- pkg/container/fmt.go | 5 +- pkg/container/id.go | 5 +- pkg/object/fmt.go | 15 ++--- pkg/object/id.go | 5 +- pkg/owner/id.go | 4 +- pkg/owner/wallet.go | 4 +- pkg/version.go | 3 +- rpc/client/flows.go | 2 +- rpc/message/test/message.go | 2 +- util/proto/marshal_test.go | 34 ++++++------ util/signature/util.go | 3 +- v2/object/convert.go | 9 ++- v2/object/grpc/client.go | 2 +- v2/session/convert.go | 3 +- v2/session/grpc/client.go | 2 +- v2/signature/sign.go | 14 ++--- 24 files changed, 144 insertions(+), 140 deletions(-) diff --git a/go.mod b/go.mod index a3e860e..180beae 100644 --- a/go.mod +++ b/go.mod @@ -9,7 +9,6 @@ require ( github.com/nspcc-dev/hrw v1.0.9 github.com/nspcc-dev/neo-go v0.95.0 github.com/nspcc-dev/neofs-crypto v0.3.0 - github.com/pkg/errors v0.9.1 github.com/stretchr/testify v1.6.1 google.golang.org/grpc v1.29.1 google.golang.org/protobuf v1.23.0 diff --git a/pkg/checksum.go b/pkg/checksum.go index c03071f..59ece9d 100644 --- a/pkg/checksum.go +++ b/pkg/checksum.go @@ -4,9 +4,9 @@ import ( "bytes" "crypto/sha256" "encoding/hex" + "fmt" "github.com/nspcc-dev/neofs-api-go/v2/refs" - "github.com/pkg/errors" ) // Checksum represents v2-compatible checksum. @@ -130,7 +130,7 @@ func (c *Checksum) Parse(s string) error { switch ln := len(data); ln { default: - return errors.Errorf("unsupported checksum length %d", ln) + return fmt.Errorf("unsupported checksum length %d", ln) case sha256.Size: typ = refs.SHA256 case 64: diff --git a/pkg/client/accounting.go b/pkg/client/accounting.go index a6028e4..580b225 100644 --- a/pkg/client/accounting.go +++ b/pkg/client/accounting.go @@ -2,6 +2,7 @@ package client import ( "context" + "fmt" "github.com/nspcc-dev/neofs-api-go/pkg/accounting" "github.com/nspcc-dev/neofs-api-go/pkg/owner" @@ -9,7 +10,6 @@ import ( v2accounting "github.com/nspcc-dev/neofs-api-go/v2/accounting" rpcapi "github.com/nspcc-dev/neofs-api-go/v2/rpc" v2signature "github.com/nspcc-dev/neofs-api-go/v2/signature" - "github.com/pkg/errors" ) // Accounting contains methods related to balance querying. @@ -40,12 +40,12 @@ func (c *clientImpl) GetBalance(ctx context.Context, owner *owner.ID, opts ...Ca resp, err := rpcapi.Balance(c.Raw(), req, client.WithContext(ctx)) if err != nil { - return nil, errors.Wrap(err, "transport error") + return nil, fmt.Errorf("transport error: %w", err) } err = v2signature.VerifyServiceMessage(resp) if err != nil { - return nil, errors.Wrap(err, "can't verify response message") + return nil, fmt.Errorf("can't verify response message: %w", err) } return accounting.NewDecimalFromV2(resp.GetBody().GetBalance()), nil diff --git a/pkg/client/container.go b/pkg/client/container.go index 0071a60..e2257e3 100644 --- a/pkg/client/container.go +++ b/pkg/client/container.go @@ -2,6 +2,7 @@ package client import ( "context" + "fmt" "github.com/nspcc-dev/neofs-api-go/pkg" "github.com/nspcc-dev/neofs-api-go/pkg/acl/eacl" @@ -13,7 +14,6 @@ import ( "github.com/nspcc-dev/neofs-api-go/v2/refs" rpcapi "github.com/nspcc-dev/neofs-api-go/v2/rpc" v2signature "github.com/nspcc-dev/neofs-api-go/v2/signature" - "github.com/pkg/errors" ) // Container contains methods related to container and ACL. @@ -125,7 +125,7 @@ func (c *clientImpl) PutContainer(ctx context.Context, cnr *container.Container, err = v2signature.VerifyServiceMessage(resp) if err != nil { - return nil, errors.Wrap(err, "can't verify response message") + return nil, fmt.Errorf("can't verify response message: %w", err) } return container.NewIDFromV2(resp.GetBody().GetContainerID()), nil @@ -156,12 +156,12 @@ func (c *clientImpl) GetContainer(ctx context.Context, id *container.ID, opts .. resp, err := rpcapi.GetContainer(c.Raw(), req, client.WithContext(ctx)) if err != nil { - return nil, errors.Wrap(err, "transport error") + return nil, fmt.Errorf("transport error: %w", err) } err = v2signature.VerifyServiceMessage(resp) if err != nil { - return nil, errors.Wrap(err, "can't verify response message") + return nil, fmt.Errorf("can't verify response message: %w", err) } return container.NewVerifiedFromV2(resp.GetBody().GetContainer()) @@ -216,12 +216,12 @@ func (c *clientImpl) ListContainers(ctx context.Context, ownerID *owner.ID, opts resp, err := rpcapi.ListContainers(c.Raw(), req, client.WithContext(ctx)) if err != nil { - return nil, errors.Wrap(err, "transport error") + return nil, fmt.Errorf("transport error: %w", err) } err = v2signature.VerifyServiceMessage(resp) if err != nil { - return nil, errors.Wrap(err, "can't verify response message") + return nil, fmt.Errorf("can't verify response message: %w", err) } result := make([]*container.ID, 0, len(resp.GetBody().GetContainerIDs())) @@ -270,10 +270,14 @@ func (c *clientImpl) DeleteContainer(ctx context.Context, id *container.ID, opts resp, err := rpcapi.DeleteContainer(c.Raw(), req, client.WithContext(ctx)) if err != nil { - return errors.Wrap(err, "transport error") + return fmt.Errorf("transport error: %w", err) } - return errors.Wrap(v2signature.VerifyServiceMessage(resp), "can't verify response message") + if err := v2signature.VerifyServiceMessage(resp); err != nil { + return fmt.Errorf("can't verify response message: %w", err) + } + + return nil } func (c *clientImpl) GetEACL(ctx context.Context, id *container.ID, opts ...CallOption) (*EACLWithSignature, error) { @@ -298,12 +302,12 @@ func (c *clientImpl) GetEACL(ctx context.Context, id *container.ID, opts ...Call resp, err := rpcapi.GetEACL(c.Raw(), req, client.WithContext(ctx)) if err != nil { - return nil, errors.Wrap(err, "transport error") + return nil, fmt.Errorf("transport error: %w", err) } err = v2signature.VerifyServiceMessage(resp) if err != nil { - return nil, errors.Wrap(err, "can't verify response message") + return nil, fmt.Errorf("can't verify response message: %w", err) } body := resp.GetBody() @@ -349,12 +353,12 @@ func (c *clientImpl) SetEACL(ctx context.Context, eacl *eacl.Table, opts ...Call resp, err := rpcapi.SetEACL(c.Raw(), req, client.WithContext(ctx)) if err != nil { - return errors.Wrap(err, "transport error") + return fmt.Errorf("transport error: %w", err) } err = v2signature.VerifyServiceMessage(resp) if err != nil { - return errors.Wrap(err, "can't verify response message") + return fmt.Errorf("can't verify response message: %w", err) } return nil @@ -394,12 +398,12 @@ func (c *clientImpl) AnnounceContainerUsedSpace( resp, err := rpcapi.AnnounceUsedSpace(c.Raw(), req, client.WithContext(ctx)) if err != nil { - return errors.Wrap(err, "transport error") + return fmt.Errorf("transport error: %w", err) } err = v2signature.VerifyServiceMessage(resp) if err != nil { - return errors.Wrap(err, "can't verify response message") + return fmt.Errorf("can't verify response message: %w", err) } return nil diff --git a/pkg/client/netmap.go b/pkg/client/netmap.go index 7ab3081..be551f0 100644 --- a/pkg/client/netmap.go +++ b/pkg/client/netmap.go @@ -2,6 +2,7 @@ package client import ( "context" + "fmt" "github.com/nspcc-dev/neofs-api-go/pkg" "github.com/nspcc-dev/neofs-api-go/pkg/netmap" @@ -9,7 +10,6 @@ import ( v2netmap "github.com/nspcc-dev/neofs-api-go/v2/netmap" rpcapi "github.com/nspcc-dev/neofs-api-go/v2/rpc" v2signature "github.com/nspcc-dev/neofs-api-go/v2/signature" - "github.com/pkg/errors" ) // Netmap contains methods related to netmap. @@ -64,12 +64,12 @@ func (c *clientImpl) EndpointInfo(ctx context.Context, opts ...CallOption) (*End resp, err := rpcapi.LocalNodeInfo(c.Raw(), req) if err != nil { - return nil, errors.Wrap(err, "transport error") + return nil, fmt.Errorf("transport error: %w", err) } err = v2signature.VerifyServiceMessage(resp) if err != nil { - return nil, errors.Wrap(err, "can't verify response message") + return nil, fmt.Errorf("can't verify response message: %w", err) } body := resp.GetBody() @@ -102,12 +102,12 @@ func (c *clientImpl) NetworkInfo(ctx context.Context, opts ...CallOption) (*netm resp, err := rpcapi.NetworkInfo(c.Raw(), req, client.WithContext(ctx)) if err != nil { - return nil, errors.Wrap(err, "v2 NetworkInfo RPC failure") + return nil, fmt.Errorf("v2 NetworkInfo RPC failure: %w", err) } err = v2signature.VerifyServiceMessage(resp) if err != nil { - return nil, errors.Wrap(err, "response message verification failed") + return nil, fmt.Errorf("response message verification failed: %w", err) } return netmap.NewNetworkInfoFromV2(resp.GetBody().GetNetworkInfo()), nil diff --git a/pkg/client/object.go b/pkg/client/object.go index 56cbf3c..a362b32 100644 --- a/pkg/client/object.go +++ b/pkg/client/object.go @@ -5,6 +5,7 @@ import ( "context" "crypto/ecdsa" "crypto/sha256" + "errors" "fmt" "io" @@ -17,7 +18,6 @@ import ( rpcapi "github.com/nspcc-dev/neofs-api-go/v2/rpc" v2session "github.com/nspcc-dev/neofs-api-go/v2/session" "github.com/nspcc-dev/neofs-api-go/v2/signature" - "github.com/pkg/errors" ) // Object contains methods for working with objects. @@ -176,11 +176,11 @@ func (w *putObjectV2Writer) Write(p []byte) (int, error) { w.req.SetVerificationHeader(nil) if err := signature.SignServiceMessage(w.key, w.req); err != nil { - return 0, errors.Wrap(err, "could not sign chunk request message") + return 0, fmt.Errorf("could not sign chunk request message: %w", err) } if err := w.stream.Write(w.req); err != nil { - return 0, errors.Wrap(err, "could not send chunk request message") + return 0, fmt.Errorf("could not send chunk request message: %w", err) } return len(p), nil @@ -245,7 +245,7 @@ func (c *clientImpl) PutObject(ctx context.Context, p *PutObjectParams, opts ... addr: v2Addr, verb: v2session.ObjectVerbPut, }); err != nil { - return nil, errors.Wrap(err, "could not attach session token") + return nil, fmt.Errorf("could not attach session token: %w", err) } req.SetMetaHeader(meta) @@ -263,7 +263,7 @@ func (c *clientImpl) PutObject(ctx context.Context, p *PutObjectParams, opts ... // sign the request if err := signature.SignServiceMessage(callOpts.key, req); err != nil { - return nil, errors.Wrapf(err, "signing the request failed") + return nil, fmt.Errorf("signing the request failed: %w", err) } // open stream @@ -271,13 +271,13 @@ func (c *clientImpl) PutObject(ctx context.Context, p *PutObjectParams, opts ... stream, err := rpcapi.PutObject(c.Raw(), resp, client.WithContext(ctx)) if err != nil { - return nil, errors.Wrap(err, "stream opening failed") + return nil, fmt.Errorf("stream opening failed: %w", err) } // send init part err = stream.Write(req) if err != nil { - return nil, errors.Wrap(err, "sending the initial message to stream failed") + return nil, fmt.Errorf("sending the initial message to stream failed: %w", err) } // create payload bytes reader @@ -301,19 +301,19 @@ func (c *clientImpl) PutObject(ctx context.Context, p *PutObjectParams, opts ... // copy payload from reader to stream writer _, err = io.CopyBuffer(w, r, make([]byte, chunkSize)) - if err != nil && !errors.Is(errors.Cause(err), io.EOF) { - return nil, errors.Wrap(err, "payload streaming failed") + if err != nil && !errors.Is(err, io.EOF) { + return nil, fmt.Errorf("payload streaming failed: %w", err) } // close object stream and receive response from remote node err = stream.Close() if err != nil { - return nil, errors.Wrap(err, "closing the stream failed") + return nil, fmt.Errorf("closing the stream failed: %w", err) } // verify response structure if err := signature.VerifyServiceMessage(resp); err != nil { - return nil, errors.Wrap(err, "response verification failed") + return nil, fmt.Errorf("response verification failed: %w", err) } // convert object identifier @@ -396,7 +396,7 @@ func (c *clientImpl) DeleteObject(ctx context.Context, p *DeleteObjectParams, op addr: p.addr.ToV2(), verb: v2session.ObjectVerbDelete, }); err != nil { - return errors.Wrap(err, "could not attach session token") + return fmt.Errorf("could not attach session token: %w", err) } req.SetMetaHeader(meta) @@ -406,18 +406,18 @@ func (c *clientImpl) DeleteObject(ctx context.Context, p *DeleteObjectParams, op // sign the request if err := signature.SignServiceMessage(callOpts.key, req); err != nil { - return errors.Wrap(err, "signing the request failed") + return fmt.Errorf("signing the request failed: %w", err) } // send request resp, err := rpcapi.DeleteObject(c.Raw(), req, client.WithContext(ctx)) if err != nil { - return errors.Wrap(err, "sending the request failed") + return fmt.Errorf("sending the request failed: %w", err) } // verify response structure if err := signature.VerifyServiceMessage(resp); err != nil { - return errors.Wrap(err, "response verification failed") + return fmt.Errorf("response verification failed: %w", err) } if p.tombTgt != nil { @@ -500,7 +500,7 @@ func (c *clientImpl) GetObject(ctx context.Context, p *GetObjectParams, opts ... addr: p.addr.ToV2(), verb: v2session.ObjectVerbGet, }); err != nil { - return nil, errors.Wrap(err, "could not attach session token") + return nil, fmt.Errorf("could not attach session token: %w", err) } req.SetMetaHeader(meta) @@ -511,13 +511,13 @@ func (c *clientImpl) GetObject(ctx context.Context, p *GetObjectParams, opts ... // sign the request if err := signature.SignServiceMessage(callOpts.key, req); err != nil { - return nil, errors.Wrap(err, "signing the request failed") + return nil, fmt.Errorf("signing the request failed: %w", err) } // open stream stream, err := rpcapi.GetObject(c.Raw(), req, client.WithContext(ctx)) if err != nil { - return nil, errors.Wrap(err, "stream opening failed") + return nil, fmt.Errorf("stream opening failed: %w", err) } var ( @@ -531,7 +531,7 @@ func (c *clientImpl) GetObject(ctx context.Context, p *GetObjectParams, opts ... // receive message from server stream err := stream.Read(resp) if err != nil { - if errors.Is(errors.Cause(err), io.EOF) { + if errors.Is(err, io.EOF) { if !headWas { return nil, io.ErrUnexpectedEOF } @@ -539,17 +539,17 @@ func (c *clientImpl) GetObject(ctx context.Context, p *GetObjectParams, opts ... break } - return nil, errors.Wrap(err, "reading the response failed") + return nil, fmt.Errorf("reading the response failed: %w", err) } // verify response structure if err := signature.VerifyServiceMessage(resp); err != nil { - return nil, errors.Wrap(err, "response verification failed") + return nil, fmt.Errorf("response verification failed: %w", err) } switch v := resp.GetBody().GetObjectPart().(type) { default: - return nil, errors.Errorf("unexpected object part %T", v) + return nil, fmt.Errorf("unexpected object part %T", v) case *v2object.GetObjectPartInit: if headWas { return nil, errWrongMessageSeq @@ -573,7 +573,7 @@ func (c *clientImpl) GetObject(ctx context.Context, p *GetObjectParams, opts ... if p.w != nil { if _, err := p.w.Write(v.GetChunk()); err != nil { - return nil, errors.Wrap(err, "could not write payload chunk") + return nil, fmt.Errorf("could not write payload chunk: %w", err) } } else { payload = append(payload, v.GetChunk()...) @@ -671,7 +671,7 @@ func (c *clientImpl) GetObjectHeader(ctx context.Context, p *ObjectHeaderParams, addr: p.addr.ToV2(), verb: v2session.ObjectVerbHead, }); err != nil { - return nil, errors.Wrap(err, "could not attach session token") + return nil, fmt.Errorf("could not attach session token: %w", err) } req.SetMetaHeader(meta) @@ -683,18 +683,18 @@ func (c *clientImpl) GetObjectHeader(ctx context.Context, p *ObjectHeaderParams, // sign the request if err := signature.SignServiceMessage(callOpts.key, req); err != nil { - return nil, errors.Wrap(err, "signing the request failed") + return nil, fmt.Errorf("signing the request failed: %w", err) } // send Head request resp, err := rpcapi.HeadObject(c.Raw(), req, client.WithContext(ctx)) if err != nil { - return nil, errors.Wrap(err, "sending the request failed") + return nil, fmt.Errorf("sending the request failed: %w", err) } // verify response structure if err := signature.VerifyServiceMessage(resp); err != nil { - return nil, errors.Wrap(err, "response verification failed") + return nil, fmt.Errorf("response verification failed: %w", err) } var ( @@ -704,10 +704,10 @@ func (c *clientImpl) GetObjectHeader(ctx context.Context, p *ObjectHeaderParams, switch v := resp.GetBody().GetHeaderPart().(type) { case nil: - return nil, errors.Errorf("unexpected header type %T", v) + return nil, fmt.Errorf("unexpected header type %T", v) case *v2object.ShortHeader: if !p.short { - return nil, errors.Errorf("wrong header part type: expected %T, received %T", + return nil, fmt.Errorf("wrong header part type: expected %T, received %T", (*v2object.ShortHeader)(nil), (*v2object.HeaderWithSignature)(nil), ) } @@ -724,7 +724,7 @@ func (c *clientImpl) GetObjectHeader(ctx context.Context, p *ObjectHeaderParams, hdr.SetHomomorphicHash(h.GetHomomorphicHash()) case *v2object.HeaderWithSignature: if p.short { - return nil, errors.Errorf("wrong header part type: expected %T, received %T", + return nil, fmt.Errorf("wrong header part type: expected %T, received %T", (*v2object.HeaderWithSignature)(nil), (*v2object.ShortHeader)(nil), ) } @@ -745,7 +745,7 @@ func (c *clientImpl) GetObjectHeader(ctx context.Context, p *ObjectHeaderParams, return idSig.GetKey(), idSig.GetSign() }, ); err != nil { - return nil, errors.Wrap(err, "incorrect object header signature") + return nil, fmt.Errorf("incorrect object header signature: %w", err) } case *v2object.SplitInfo: si := object.NewSplitInfoFromV2(v) @@ -851,7 +851,7 @@ func (c *clientImpl) ObjectPayloadRangeData(ctx context.Context, p *RangeDataPar addr: p.addr.ToV2(), verb: v2session.ObjectVerbRange, }); err != nil { - return nil, errors.Wrap(err, "could not attach session token") + return nil, fmt.Errorf("could not attach session token: %w", err) } req.SetMetaHeader(meta) @@ -863,13 +863,13 @@ func (c *clientImpl) ObjectPayloadRangeData(ctx context.Context, p *RangeDataPar // sign the request if err := signature.SignServiceMessage(callOpts.key, req); err != nil { - return nil, errors.Wrapf(err, "signing the request failed") + return nil, fmt.Errorf("signing the request failed: %w", err) } // open stream stream, err := rpcapi.GetObjectRange(c.Raw(), req, client.WithContext(ctx)) if err != nil { - return nil, errors.Wrap(err, "could not create Get payload range stream") + return nil, fmt.Errorf("could not create Get payload range stream: %w", err) } var payload []byte @@ -883,25 +883,25 @@ func (c *clientImpl) ObjectPayloadRangeData(ctx context.Context, p *RangeDataPar // receive message from server stream err := stream.Read(resp) if err != nil { - if errors.Is(errors.Cause(err), io.EOF) { + if errors.Is(err, io.EOF) { break } - return nil, errors.Wrap(err, "reading the response failed") + return nil, fmt.Errorf("reading the response failed: %w", err) } // verify response structure if err := signature.VerifyServiceMessage(resp); err != nil { - return nil, errors.Wrapf(err, "could not verify %T", resp) + return nil, fmt.Errorf("could not verify %T: %w", resp, err) } switch v := resp.GetBody().GetRangePart().(type) { case nil: - return nil, errors.Errorf("unexpected range type %T", v) + return nil, fmt.Errorf("unexpected range type %T", v) case *v2object.GetRangePartChunk: if p.w != nil { if _, err = p.w.Write(v.GetChunk()); err != nil { - return nil, errors.Wrap(err, "could not write payload chunk") + return nil, fmt.Errorf("could not write payload chunk: %w", err) } } else { payload = append(payload, v.GetChunk()...) @@ -1013,7 +1013,7 @@ func (c *clientImpl) objectPayloadRangeHash(ctx context.Context, p *RangeChecksu addr: p.addr.ToV2(), verb: v2session.ObjectVerbRangeHash, }); err != nil { - return nil, errors.Wrap(err, "could not attach session token") + return nil, fmt.Errorf("could not attach session token: %w", err) } req.SetMetaHeader(meta) @@ -1030,18 +1030,18 @@ func (c *clientImpl) objectPayloadRangeHash(ctx context.Context, p *RangeChecksu // sign the request if err := signature.SignServiceMessage(callOpts.key, req); err != nil { - return nil, errors.Wrapf(err, "signing the request failed") + return nil, fmt.Errorf("signing the request failed: %w", err) } // send request resp, err := rpcapi.HashObjectRange(c.Raw(), req, client.WithContext(ctx)) if err != nil { - return nil, errors.Wrap(err, "sending the request failed") + return nil, fmt.Errorf("sending the request failed: %w", err) } // verify response structure if err := signature.VerifyServiceMessage(resp); err != nil { - return nil, errors.Wrap(err, "response verification failed") + return nil, fmt.Errorf("response verification failed: %w", err) } respBody := resp.GetBody() @@ -1049,9 +1049,9 @@ func (c *clientImpl) objectPayloadRangeHash(ctx context.Context, p *RangeChecksu respHashes := respBody.GetHashList() if t := p.typ.toV2(); respType != t { - return nil, errors.Errorf("invalid checksum type: expected %v, received %v", t, respType) + return nil, fmt.Errorf("invalid checksum type: expected %v, received %v", t, respType) } else if reqLn, respLn := len(rsV2), len(respHashes); reqLn != respLn { - return nil, errors.Errorf("wrong checksum number: expected %d, received %d", reqLn, respLn) + return nil, fmt.Errorf("wrong checksum number: expected %d, received %d", reqLn, respLn) } var res interface{} @@ -1062,7 +1062,7 @@ func (c *clientImpl) objectPayloadRangeHash(ctx context.Context, p *RangeChecksu for i := range respHashes { if ln := len(respHashes[i]); ln != sha256.Size { - return nil, errors.Errorf("invalid checksum length: expected %d, received %d", sha256.Size, ln) + return nil, fmt.Errorf("invalid checksum length: expected %d, received %d", sha256.Size, ln) } cs := [sha256.Size]byte{} @@ -1077,7 +1077,7 @@ func (c *clientImpl) objectPayloadRangeHash(ctx context.Context, p *RangeChecksu for i := range respHashes { if ln := len(respHashes[i]); ln != TZSize { - return nil, errors.Errorf("invalid checksum length: expected %d, received %d", TZSize, ln) + return nil, fmt.Errorf("invalid checksum length: expected %d, received %d", TZSize, ln) } cs := [TZSize]byte{} @@ -1150,7 +1150,7 @@ func (c *clientImpl) SearchObject(ctx context.Context, p *SearchObjectParams, op addr: v2Addr, verb: v2session.ObjectVerbSearch, }); err != nil { - return nil, errors.Wrap(err, "could not attach session token") + return nil, fmt.Errorf("could not attach session token: %w", err) } req.SetMetaHeader(meta) @@ -1162,13 +1162,13 @@ func (c *clientImpl) SearchObject(ctx context.Context, p *SearchObjectParams, op // sign the request if err := signature.SignServiceMessage(callOpts.key, req); err != nil { - return nil, errors.Wrapf(err, "signing the request failed") + return nil, fmt.Errorf("signing the request failed: %w", err) } // create search stream stream, err := rpcapi.SearchObjects(c.Raw(), req, client.WithContext(ctx)) if err != nil { - return nil, errors.Wrap(err, "stream opening failed") + return nil, fmt.Errorf("stream opening failed: %w", err) } var ( @@ -1180,16 +1180,16 @@ func (c *clientImpl) SearchObject(ctx context.Context, p *SearchObjectParams, op // receive message from server stream err := stream.Read(resp) if err != nil { - if errors.Is(errors.Cause(err), io.EOF) { + if errors.Is(err, io.EOF) { break } - return nil, errors.Wrap(err, "reading the response failed") + return nil, fmt.Errorf("reading the response failed: %w", err) } // verify response structure if err := signature.VerifyServiceMessage(resp); err != nil { - return nil, errors.Wrapf(err, "could not verify %T", resp) + return nil, fmt.Errorf("could not verify %T: %w", resp, err) } chunk := resp.GetBody().GetIDList() diff --git a/pkg/client/reputation.go b/pkg/client/reputation.go index 253e4df..ec55218 100644 --- a/pkg/client/reputation.go +++ b/pkg/client/reputation.go @@ -2,13 +2,13 @@ package client import ( "context" + "fmt" "github.com/nspcc-dev/neofs-api-go/pkg/reputation" "github.com/nspcc-dev/neofs-api-go/rpc/client" v2reputation "github.com/nspcc-dev/neofs-api-go/v2/reputation" rpcapi "github.com/nspcc-dev/neofs-api-go/v2/rpc" v2signature "github.com/nspcc-dev/neofs-api-go/v2/signature" - "github.com/pkg/errors" ) // Reputation contains methods for working with Reputation system values. @@ -79,7 +79,7 @@ func (c *clientImpl) AnnounceLocalTrust(ctx context.Context, prm AnnounceLocalTr err = v2signature.VerifyServiceMessage(resp) if err != nil { - return nil, errors.Wrap(err, "can't verify response message") + return nil, fmt.Errorf("can't verify response message: %w", err) } return new(AnnounceLocalTrustRes), nil @@ -154,7 +154,7 @@ func (c *clientImpl) AnnounceIntermediateTrust(ctx context.Context, prm Announce err = v2signature.VerifyServiceMessage(resp) if err != nil { - return nil, errors.Wrap(err, "can't verify response message") + return nil, fmt.Errorf("can't verify response message: %w", err) } return new(AnnounceIntermediateTrustRes), nil diff --git a/pkg/client/session.go b/pkg/client/session.go index b7afa03..5e3048b 100644 --- a/pkg/client/session.go +++ b/pkg/client/session.go @@ -2,6 +2,8 @@ package client import ( "context" + "errors" + "fmt" "github.com/nspcc-dev/neofs-api-go/pkg/owner" "github.com/nspcc-dev/neofs-api-go/pkg/token" @@ -9,7 +11,6 @@ import ( rpcapi "github.com/nspcc-dev/neofs-api-go/v2/rpc" v2session "github.com/nspcc-dev/neofs-api-go/v2/session" v2signature "github.com/nspcc-dev/neofs-api-go/v2/signature" - "github.com/pkg/errors" ) // Session contains session-related methods. @@ -51,12 +52,12 @@ func (c *clientImpl) CreateSession(ctx context.Context, expiration uint64, opts resp, err := rpcapi.CreateSession(c.Raw(), req, client.WithContext(ctx)) if err != nil { - return nil, errors.Wrap(err, "transport error") + return nil, fmt.Errorf("transport error: %w", err) } err = v2signature.VerifyServiceMessage(resp) if err != nil { - return nil, errors.Wrap(err, "can't verify response message") + return nil, fmt.Errorf("can't verify response message: %w", err) } body := resp.GetBody() diff --git a/pkg/container/fmt.go b/pkg/container/fmt.go index 8579bea..ad1cada 100644 --- a/pkg/container/fmt.go +++ b/pkg/container/fmt.go @@ -1,9 +1,10 @@ package container import ( + "fmt" + "github.com/nspcc-dev/neofs-api-go/pkg" "github.com/nspcc-dev/neofs-api-go/v2/container" - "github.com/pkg/errors" ) // NewVerifiedFromV2 constructs Container from NeoFS API V2 Container message. @@ -20,7 +21,7 @@ func NewVerifiedFromV2(cnrV2 *container.Container) (*Container, error) { // check nonce format if _, err := cnr.NonceUUID(); err != nil { - return nil, errors.Wrap(err, "invalid nonce") + return nil, fmt.Errorf("invalid nonce: %w", err) } return cnr, nil diff --git a/pkg/container/id.go b/pkg/container/id.go index 3ab170c..86bb3e3 100644 --- a/pkg/container/id.go +++ b/pkg/container/id.go @@ -3,10 +3,11 @@ package container import ( "bytes" "crypto/sha256" + "errors" + "fmt" "github.com/mr-tron/base58" "github.com/nspcc-dev/neofs-api-go/v2/refs" - "github.com/pkg/errors" ) // ID represents v2-compatible container identifier. @@ -52,7 +53,7 @@ func (id *ID) Equal(id2 *ID) bool { func (id *ID) Parse(s string) error { data, err := base58.Decode(s) if err != nil { - return errors.Wrap(err, "could not parse container.ID from string") + return fmt.Errorf("could not parse container.ID from string: %w", err) } else if len(data) != sha256.Size { return errInvalidIDString } diff --git a/pkg/object/fmt.go b/pkg/object/fmt.go index 0ada68b..d99a2c6 100644 --- a/pkg/object/fmt.go +++ b/pkg/object/fmt.go @@ -3,11 +3,12 @@ package object import ( "crypto/ecdsa" "crypto/sha256" + "errors" + "fmt" "github.com/nspcc-dev/neofs-api-go/pkg" "github.com/nspcc-dev/neofs-api-go/util/signature" signatureV2 "github.com/nspcc-dev/neofs-api-go/v2/signature" - "github.com/pkg/errors" ) var errCheckSumMismatch = errors.New("payload checksum mismatch") @@ -131,11 +132,11 @@ func VerifyIDSignature(obj *Object) error { // SetIDWithSignature sets object identifier and signature. func SetIDWithSignature(key *ecdsa.PrivateKey, obj *RawObject) error { if err := CalculateAndSetID(obj); err != nil { - return errors.Wrap(err, "could not set identifier") + return fmt.Errorf("could not set identifier: %w", err) } if err := CalculateAndSetSignature(key, obj); err != nil { - return errors.Wrap(err, "could not set signature") + return fmt.Errorf("could not set signature: %w", err) } return nil @@ -151,11 +152,11 @@ func SetVerificationFields(key *ecdsa.PrivateKey, obj *RawObject) error { // CheckVerificationFields checks all verification fields of the object. func CheckVerificationFields(obj *Object) error { if err := CheckHeaderVerificationFields(obj); err != nil { - return errors.Wrap(err, "invalid header structure") + return fmt.Errorf("invalid header structure: %w", err) } if err := VerifyPayloadChecksum(obj); err != nil { - return errors.Wrap(err, "invalid payload checksum") + return fmt.Errorf("invalid payload checksum: %w", err) } return nil @@ -164,11 +165,11 @@ func CheckVerificationFields(obj *Object) error { // CheckHeaderVerificationFields checks all verification fields except payload. func CheckHeaderVerificationFields(obj *Object) error { if err := VerifyIDSignature(obj); err != nil { - return errors.Wrap(err, "invalid signature") + return fmt.Errorf("invalid signature: %w", err) } if err := VerifyID(obj); err != nil { - return errors.Wrap(err, "invalid identifier") + return fmt.Errorf("invalid identifier: %w", err) } return nil diff --git a/pkg/object/id.go b/pkg/object/id.go index 813793d..21d566e 100644 --- a/pkg/object/id.go +++ b/pkg/object/id.go @@ -3,10 +3,11 @@ package object import ( "bytes" "crypto/sha256" + "errors" + "fmt" "github.com/mr-tron/base58" "github.com/nspcc-dev/neofs-api-go/v2/refs" - "github.com/pkg/errors" ) // ID represents v2-compatible object identifier. @@ -48,7 +49,7 @@ func (id *ID) ToV2() *refs.ObjectID { func (id *ID) Parse(s string) error { data, err := base58.Decode(s) if err != nil { - return errors.Wrap(err, "could not parse object.ID from string") + return fmt.Errorf("could not parse object.ID from string: %w", err) } else if len(data) != sha256.Size { return errInvalidIDString } diff --git a/pkg/owner/id.go b/pkg/owner/id.go index 3606117..ea8f5fc 100644 --- a/pkg/owner/id.go +++ b/pkg/owner/id.go @@ -1,12 +1,12 @@ package owner import ( + "errors" "fmt" "github.com/mr-tron/base58" "github.com/nspcc-dev/neo-go/pkg/encoding/address" "github.com/nspcc-dev/neofs-api-go/v2/refs" - "github.com/pkg/errors" ) // ID represents v2-compatible owner identifier. @@ -61,7 +61,7 @@ func NewIDFromNeo3Wallet(v *NEO3Wallet) *ID { func (id *ID) Parse(s string) error { data, err := base58.Decode(s) if err != nil { - return errors.Wrap(err, "could not parse owner.ID from string") + return fmt.Errorf("could not parse owner.ID from string: %w", err) } else if len(data) != NEO3WalletSize { return errInvalidIDString } diff --git a/pkg/owner/wallet.go b/pkg/owner/wallet.go index 8777cde..afca654 100644 --- a/pkg/owner/wallet.go +++ b/pkg/owner/wallet.go @@ -2,11 +2,11 @@ package owner import ( "crypto/ecdsa" + "fmt" "github.com/mr-tron/base58" "github.com/nspcc-dev/neo-go/pkg/crypto/keys" crypto "github.com/nspcc-dev/neofs-crypto" - "github.com/pkg/errors" ) // NEO3Wallet represents NEO3 wallet address. @@ -28,7 +28,7 @@ func NEO3WalletFromPublicKey(key *ecdsa.PublicKey) (*NEO3Wallet, error) { d, err := base58.Decode(neoPublicKey.Address()) if err != nil { - return nil, errors.Wrap(err, "can't decode neo3 address from key") + return nil, fmt.Errorf("can't decode neo3 address from key: %w", err) } w := new(NEO3Wallet) diff --git a/pkg/version.go b/pkg/version.go index b469b3e..7e2e645 100644 --- a/pkg/version.go +++ b/pkg/version.go @@ -4,7 +4,6 @@ import ( "fmt" "github.com/nspcc-dev/neofs-api-go/v2/refs" - "github.com/pkg/errors" ) // Version represents v2-compatible version. @@ -72,7 +71,7 @@ func IsSupportedVersion(v *Version) error { mjr, mnr := v.Major(), v.Minor() if mjr != 2 || mnr > sdkMnr { - return errors.Errorf("unsupported version %d.%d", mjr, mnr) + return fmt.Errorf("unsupported version %d.%d", mjr, mnr) } return nil diff --git a/rpc/client/flows.go b/rpc/client/flows.go index ceb890e..c106e0a 100644 --- a/rpc/client/flows.go +++ b/rpc/client/flows.go @@ -1,12 +1,12 @@ package client import ( + "errors" "io" "sync" "github.com/nspcc-dev/neofs-api-go/rpc/common" "github.com/nspcc-dev/neofs-api-go/rpc/message" - "github.com/pkg/errors" ) // SendUnary initializes communication session by RPC info, performs unary RPC diff --git a/rpc/message/test/message.go b/rpc/message/test/message.go index 12ad8ad..1afa796 100644 --- a/rpc/message/test/message.go +++ b/rpc/message/test/message.go @@ -2,11 +2,11 @@ package messagetest import ( "encoding/json" + "errors" "fmt" "testing" "github.com/nspcc-dev/neofs-api-go/rpc/message" - "github.com/pkg/errors" "github.com/stretchr/testify/require" ) diff --git a/util/proto/marshal_test.go b/util/proto/marshal_test.go index 34b5a44..5095964 100644 --- a/util/proto/marshal_test.go +++ b/util/proto/marshal_test.go @@ -1,12 +1,12 @@ package proto_test import ( + "fmt" "math" "testing" "github.com/nspcc-dev/neofs-api-go/util/proto" "github.com/nspcc-dev/neofs-api-go/util/proto/test" - "github.com/pkg/errors" "github.com/stretchr/testify/require" goproto "google.golang.org/protobuf/proto" ) @@ -60,7 +60,7 @@ func (s *stablePrimitives) stableMarshal(buf []byte, wrongField bool) ([]byte, e } offset, err := proto.BytesMarshal(fieldNum, buf, s.FieldA) if err != nil { - return nil, errors.Wrap(err, "can't marshal field a") + return nil, fmt.Errorf("can't marshal field a: %w", err) } i += offset @@ -70,7 +70,7 @@ func (s *stablePrimitives) stableMarshal(buf []byte, wrongField bool) ([]byte, e } offset, err = proto.StringMarshal(fieldNum, buf, s.FieldB) if err != nil { - return nil, errors.Wrap(err, "can't marshal field b") + return nil, fmt.Errorf("can't marshal field b: %w", err) } i += offset @@ -80,7 +80,7 @@ func (s *stablePrimitives) stableMarshal(buf []byte, wrongField bool) ([]byte, e } offset, err = proto.BoolMarshal(fieldNum, buf, s.FieldC) if err != nil { - return nil, errors.Wrap(err, "can't marshal field c") + return nil, fmt.Errorf("can't marshal field c: %w", err) } i += offset @@ -90,7 +90,7 @@ func (s *stablePrimitives) stableMarshal(buf []byte, wrongField bool) ([]byte, e } offset, err = proto.Int32Marshal(fieldNum, buf, s.FieldD) if err != nil { - return nil, errors.Wrap(err, "can't marshal field d") + return nil, fmt.Errorf("can't marshal field d: %w", err) } i += offset @@ -100,7 +100,7 @@ func (s *stablePrimitives) stableMarshal(buf []byte, wrongField bool) ([]byte, e } offset, err = proto.UInt32Marshal(fieldNum, buf, s.FieldE) if err != nil { - return nil, errors.Wrap(err, "can't marshal field e") + return nil, fmt.Errorf("can't marshal field e: %w", err) } i += offset @@ -110,7 +110,7 @@ func (s *stablePrimitives) stableMarshal(buf []byte, wrongField bool) ([]byte, e } offset, err = proto.Int64Marshal(fieldNum, buf, s.FieldF) if err != nil { - return nil, errors.Wrap(err, "can't marshal field f") + return nil, fmt.Errorf("can't marshal field f: %w", err) } i += offset @@ -120,7 +120,7 @@ func (s *stablePrimitives) stableMarshal(buf []byte, wrongField bool) ([]byte, e } offset, err = proto.UInt64Marshal(fieldNum, buf, s.FieldG) if err != nil { - return nil, errors.Wrap(err, "can't marshal field g") + return nil, fmt.Errorf("can't marshal field g: %w", err) } i += offset @@ -130,7 +130,7 @@ func (s *stablePrimitives) stableMarshal(buf []byte, wrongField bool) ([]byte, e } offset, err = proto.Fixed64Marshal(fieldNum, buf, s.FieldI) if err != nil { - return nil, errors.Wrap(err, "can't marshal field I") + return nil, fmt.Errorf("can't marshal field I: %w", err) } i += offset @@ -140,7 +140,7 @@ func (s *stablePrimitives) stableMarshal(buf []byte, wrongField bool) ([]byte, e } offset, err = proto.Float64Marshal(fieldNum, buf, s.FieldJ) if err != nil { - return nil, errors.Wrap(err, "can't marshal field J") + return nil, fmt.Errorf("can't marshal field J: %w", err) } i += offset @@ -150,7 +150,7 @@ func (s *stablePrimitives) stableMarshal(buf []byte, wrongField bool) ([]byte, e } offset, err = proto.EnumMarshal(fieldNum, buf, int32(s.FieldH)) if err != nil { - return nil, errors.Wrap(err, "can't marshal field h") + return nil, fmt.Errorf("can't marshal field h: %w", err) } i += offset @@ -189,7 +189,7 @@ func (s *stableRepPrimitives) stableMarshal(buf []byte, wrongField bool) ([]byte } offset, err := proto.RepeatedBytesMarshal(fieldNum, buf, s.FieldA) if err != nil { - return nil, errors.Wrap(err, "can't marshal field a") + return nil, fmt.Errorf("can't marshal field a: %w", err) } i += offset @@ -199,7 +199,7 @@ func (s *stableRepPrimitives) stableMarshal(buf []byte, wrongField bool) ([]byte } offset, err = proto.RepeatedStringMarshal(fieldNum, buf, s.FieldB) if err != nil { - return nil, errors.Wrap(err, "can't marshal field b") + return nil, fmt.Errorf("can't marshal field b: %w", err) } i += offset @@ -209,7 +209,7 @@ func (s *stableRepPrimitives) stableMarshal(buf []byte, wrongField bool) ([]byte } offset, err = proto.RepeatedInt32Marshal(fieldNum, buf, s.FieldC) if err != nil { - return nil, errors.Wrap(err, "can't marshal field c") + return nil, fmt.Errorf("can't marshal field c: %w", err) } i += offset @@ -219,7 +219,7 @@ func (s *stableRepPrimitives) stableMarshal(buf []byte, wrongField bool) ([]byte } offset, err = proto.RepeatedUInt32Marshal(fieldNum, buf, s.FieldD) if err != nil { - return nil, errors.Wrap(err, "can't marshal field d") + return nil, fmt.Errorf("can't marshal field d: %w", err) } i += offset @@ -229,7 +229,7 @@ func (s *stableRepPrimitives) stableMarshal(buf []byte, wrongField bool) ([]byte } offset, err = proto.RepeatedInt64Marshal(fieldNum, buf, s.FieldE) if err != nil { - return nil, errors.Wrap(err, "can't marshal field e") + return nil, fmt.Errorf("can't marshal field e: %w", err) } i += offset @@ -239,7 +239,7 @@ func (s *stableRepPrimitives) stableMarshal(buf []byte, wrongField bool) ([]byte } offset, err = proto.RepeatedUInt64Marshal(fieldNum, buf, s.FieldF) if err != nil { - return nil, errors.Wrap(err, "can't marshal field f") + return nil, fmt.Errorf("can't marshal field f: %w", err) } i += offset diff --git a/util/signature/util.go b/util/signature/util.go index 9033eab..8278f9a 100644 --- a/util/signature/util.go +++ b/util/signature/util.go @@ -1,9 +1,8 @@ package signature import ( + "errors" "sync" - - "github.com/pkg/errors" ) var bytesPool = sync.Pool{ diff --git a/v2/object/convert.go b/v2/object/convert.go index 96b1b5b..0d2d142 100644 --- a/v2/object/convert.go +++ b/v2/object/convert.go @@ -10,7 +10,6 @@ import ( refsGRPC "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" "github.com/nspcc-dev/neofs-api-go/v2/session" sessionGRPC "github.com/nspcc-dev/neofs-api-go/v2/session/grpc" - "github.com/pkg/errors" ) func TypeToGRPCField(t Type) object.ObjectType { @@ -802,7 +801,7 @@ func (r *GetResponseBody) FromGRPCMessage(m grpc.Message) error { err = partSplit.FromGRPCMessage(pt.SplitInfo) } default: - err = errors.Errorf("unknown get object part %T", pt) + err = fmt.Errorf("unknown get object part %T", pt) } return err @@ -985,7 +984,7 @@ func (r *PutRequestBody) FromGRPCMessage(m grpc.Message) error { err = partChunk.FromGRPCMessage(pt) } default: - err = errors.Errorf("unknown put object part %T", pt) + err = fmt.Errorf("unknown put object part %T", pt) } return err @@ -1379,7 +1378,7 @@ func (r *HeadResponseBody) FromGRPCMessage(m grpc.Message) error { err = partSplit.FromGRPCMessage(pt.SplitInfo) } default: - err = errors.Errorf("unknown head part %T", pt) + err = fmt.Errorf("unknown head part %T", pt) } return err @@ -1854,7 +1853,7 @@ func (r *GetRangeResponseBody) FromGRPCMessage(m grpc.Message) error { err = partSplit.FromGRPCMessage(pt) } default: - err = errors.Errorf("unknown get range part %T", pt) + err = fmt.Errorf("unknown get range part %T", pt) } return err diff --git a/v2/object/grpc/client.go b/v2/object/grpc/client.go index 30ff3e0..35028cf 100644 --- a/v2/object/grpc/client.go +++ b/v2/object/grpc/client.go @@ -2,8 +2,8 @@ package object import ( "context" + "errors" - "github.com/pkg/errors" "google.golang.org/grpc" ) diff --git a/v2/session/convert.go b/v2/session/convert.go index 084377e..7beb6ed 100644 --- a/v2/session/convert.go +++ b/v2/session/convert.go @@ -10,7 +10,6 @@ import ( "github.com/nspcc-dev/neofs-api-go/v2/refs" refsGRPC "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" session "github.com/nspcc-dev/neofs-api-go/v2/session/grpc" - "github.com/pkg/errors" ) func (c *CreateRequestBody) ToGRPCMessage() grpc.Message { @@ -731,7 +730,7 @@ func (t *SessionTokenBody) FromGRPCMessage(m grpc.Message) error { switch val := v.GetContext().(type) { default: - err = errors.Errorf("unknown session context %T", val) + err = fmt.Errorf("unknown session context %T", val) case nil: case *session.SessionToken_Body_Object: ctx, ok := t.ctx.(*ObjectSessionContext) diff --git a/v2/session/grpc/client.go b/v2/session/grpc/client.go index acf6133..2dfe77e 100644 --- a/v2/session/grpc/client.go +++ b/v2/session/grpc/client.go @@ -2,8 +2,8 @@ package session import ( "context" + "errors" - "github.com/pkg/errors" "google.golang.org/grpc" ) diff --git a/v2/signature/sign.go b/v2/signature/sign.go index 33c7386..04abab6 100644 --- a/v2/signature/sign.go +++ b/v2/signature/sign.go @@ -2,6 +2,7 @@ package signature import ( "crypto/ecdsa" + "errors" "fmt" "github.com/nspcc-dev/neofs-api-go/util/signature" @@ -12,7 +13,6 @@ import ( "github.com/nspcc-dev/neofs-api-go/v2/refs" "github.com/nspcc-dev/neofs-api-go/v2/reputation" "github.com/nspcc-dev/neofs-api-go/v2/session" - "github.com/pkg/errors" ) type serviceRequest interface { @@ -183,18 +183,18 @@ func SignServiceMessage(key *ecdsa.PrivateKey, msg interface{}) error { if verifyOrigin == nil { // sign session message body if err := signServiceMessagePart(key, body, verifyHdr.SetBodySignature); err != nil { - return errors.Wrap(err, "could not sign body") + return fmt.Errorf("could not sign body: %w", err) } } // sign meta header if err := signServiceMessagePart(key, meta, verifyHdr.SetMetaSignature); err != nil { - return errors.Wrap(err, "could not sign meta header") + return fmt.Errorf("could not sign meta header: %w", err) } // sign verification header origin if err := signServiceMessagePart(key, verifyOrigin, verifyHdr.SetOriginSignature); err != nil { - return errors.Wrap(err, "could not sign origin of verification header") + return fmt.Errorf("could not sign origin of verification header: %w", err) } // wrap origin verification header @@ -258,18 +258,18 @@ func VerifyServiceMessage(msg interface{}) error { func verifyMatryoshkaLevel(body stableMarshaler, meta metaHeader, verify verificationHeader) error { if err := verifyServiceMessagePart(meta, verify.GetMetaSignature); err != nil { - return errors.Wrap(err, "could not verify meta header") + return fmt.Errorf("could not verify meta header: %w", err) } origin := verify.getOrigin() if err := verifyServiceMessagePart(origin, verify.GetOriginSignature); err != nil { - return errors.Wrap(err, "could not verify origin of verification header") + return fmt.Errorf("could not verify origin of verification header: %w", err) } if origin == nil { if err := verifyServiceMessagePart(body, verify.GetBodySignature); err != nil { - return errors.Wrap(err, "could not verify body") + return fmt.Errorf("could not verify body: %w", err) } return nil From 634e405e9cc5c362750de06d9db652f59a3640a9 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Wed, 19 May 2021 13:46:40 +0300 Subject: [PATCH 0737/1196] Release v1.26.1 Signed-off-by: Alex Vanin --- CHANGELOG.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b528cc9..4d61b8f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,15 @@ # Changelog +## [1.26.1] - 2021-05-19 + +### Changed + +- Updated neo-go to v0.95.0 release. + +### Removed + +- `pkg/errors` dependency (stdlib errors used instead). + ## [1.26.0] - 2021-05-07 - Daecheongdo (대청도, 大靑島) ### Added @@ -594,3 +604,4 @@ Initial public release [1.24.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.23.0...v1.24.0 [1.25.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.24.0...v1.25.0 [1.26.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.25.0...v1.26.0 +[1.26.1]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.26.0...v1.26.1 From 89aede1fb3020b5bd3e45d39984c12c5dc4e3ba9 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Thu, 20 May 2021 18:51:28 +0300 Subject: [PATCH 0738/1196] [#286] client: Add TLS options Add `WithTLSConfig` option to client. If it is not nil then client will try to open secured connection. Signed-off-by: Pavel Karpy --- pkg/client/opts.go | 10 +++++++++- rpc/client/connect.go | 12 +++++++++++- rpc/client/options.go | 15 +++++++++++++++ 3 files changed, 35 insertions(+), 2 deletions(-) diff --git a/pkg/client/opts.go b/pkg/client/opts.go index 9825d49..6c04f8d 100644 --- a/pkg/client/opts.go +++ b/pkg/client/opts.go @@ -2,6 +2,7 @@ package client import ( "crypto/ecdsa" + "crypto/tls" "time" "github.com/nspcc-dev/neofs-api-go/pkg" @@ -110,7 +111,7 @@ func v2MetaHeaderFromOpts(options *callOptions) *v2session.RequestMetaHeader { func defaultClientOptions() *clientOptions { return &clientOptions{ - rawOpts: make([]client.Option, 0, 3), + rawOpts: make([]client.Option, 0, 4), } } @@ -133,6 +134,13 @@ func WithDialTimeout(dur time.Duration) Option { } } +// WithTLSConfig returns option to set connection's TLS config to the remote node. +func WithTLSConfig(cfg *tls.Config) Option { + return func(opts *clientOptions) { + opts.rawOpts = append(opts.rawOpts, client.WithTLSCfg(cfg)) + } +} + // WithDefaultPrivateKey returns option to set default private key // used for the work. func WithDefaultPrivateKey(key *ecdsa.PrivateKey) Option { diff --git a/rpc/client/connect.go b/rpc/client/connect.go index f9cd940..9df1ddf 100644 --- a/rpc/client/connect.go +++ b/rpc/client/connect.go @@ -6,6 +6,7 @@ import ( "github.com/nspcc-dev/neofs-api-go/rpc/grpc" grpcstd "google.golang.org/grpc" + "google.golang.org/grpc/credentials" ) func (c *Client) createGRPCClient() (err error) { @@ -33,8 +34,17 @@ func (c *Client) openGRPCConn() error { var err error + var credOpt grpcstd.DialOption + + if c.tlsCfg != nil { + creds := credentials.NewTLS(c.tlsCfg) + credOpt = grpcstd.WithTransportCredentials(creds) + } else { + credOpt = grpcstd.WithInsecure() + } + dialCtx, cancel := context.WithTimeout(context.Background(), c.dialTimeout) - c.conn, err = grpcstd.DialContext(dialCtx, c.addr, grpcstd.WithInsecure()) + c.conn, err = grpcstd.DialContext(dialCtx, c.addr, credOpt) cancel() return err diff --git a/rpc/client/options.go b/rpc/client/options.go index 9f2a226..0dcabfb 100644 --- a/rpc/client/options.go +++ b/rpc/client/options.go @@ -1,6 +1,7 @@ package client import ( + "crypto/tls" "time" "google.golang.org/grpc" @@ -14,6 +15,8 @@ type cfg struct { dialTimeout time.Duration + tlsCfg *tls.Config + conn *grpc.ClientConn } @@ -49,6 +52,18 @@ func WithDialTimeout(v time.Duration) Option { } } +// WithTLSCfg returns option to specify +// TLS configuration. +// +// Ignored if WithGRPCConn is provided. +func WithTLSCfg(v *tls.Config) Option { + return func(c *cfg) { + if v != nil { + c.tlsCfg = v + } + } +} + // WithGRPCConn returns option to specify // gRPC virtual connection. func WithGRPCConn(v *grpc.ClientConn) Option { From 2ebb91cb4cedf08555cdff59a7bf16bd9624c0a4 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Mon, 24 May 2021 16:38:37 +0300 Subject: [PATCH 0739/1196] [#286] client: Delete useless raw client init Since raw client initialization is postponed until the first `Raw()` function call, there is no need to init empty( without options) raw client in constructor. Signed-off-by: Pavel Karpy --- pkg/client/client.go | 1 - 1 file changed, 1 deletion(-) diff --git a/pkg/client/client.go b/pkg/client/client.go index 20b88b3..8fe4d1e 100644 --- a/pkg/client/client.go +++ b/pkg/client/client.go @@ -35,7 +35,6 @@ func New(opts ...Option) (Client, error) { } return &clientImpl{ - raw: client.New(), opts: clientOptions, }, nil } From af2a9d0851f21433bcaced82eab66c96dd202c84 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 24 May 2021 15:46:19 +0300 Subject: [PATCH 0740/1196] [#283] v2/grpc: Compile source files with container session context Signed-off-by: Leonard Lyubich --- v2/container/grpc/service.pb.go | 321 ++++++++++-------- v2/session/grpc/types.pb.go | 561 +++++++++++++++++++++----------- 2 files changed, 554 insertions(+), 328 deletions(-) diff --git a/v2/container/grpc/service.pb.go b/v2/container/grpc/service.pb.go index b9d7b2c..e5b66c8 100644 --- a/v2/container/grpc/service.pb.go +++ b/v2/container/grpc/service.pb.go @@ -1285,6 +1285,10 @@ type GetResponse_Body struct { // Requested container structure Container *Container `protobuf:"bytes,1,opt,name=container,proto3" json:"container,omitempty"` + // Signature of a stable-marshalled container according to RFC-6979 + Signature *grpc1.Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` + // Session token if the container was created within a session + SessionToken *grpc.SessionToken `protobuf:"bytes,3,opt,name=session_token,json=sessionToken,proto3" json:"session_token,omitempty"` } func (x *GetResponse_Body) Reset() { @@ -1326,6 +1330,20 @@ func (x *GetResponse_Body) GetContainer() *Container { return nil } +func (x *GetResponse_Body) GetSignature() *grpc1.Signature { + if x != nil { + return x.Signature + } + return nil +} + +func (x *GetResponse_Body) GetSessionToken() *grpc.SessionToken { + if x != nil { + return x.SessionToken + } + return nil +} + // List containers request body. type ListRequest_Body struct { state protoimpl.MessageState @@ -1585,6 +1603,8 @@ type GetExtendedACLResponse_Body struct { Eacl *grpc2.EACLTable `protobuf:"bytes,1,opt,name=eacl,proto3" json:"eacl,omitempty"` // Signature of stable-marshalled Extended ACL according to RFC-6979 Signature *grpc1.Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` + // Session token if Extended ACL was set within a session + SessionToken *grpc.SessionToken `protobuf:"bytes,3,opt,name=session_token,json=sessionToken,proto3" json:"session_token,omitempty"` } func (x *GetExtendedACLResponse_Body) Reset() { @@ -1633,6 +1653,13 @@ func (x *GetExtendedACLResponse_Body) GetSignature() *grpc1.Signature { return nil } +func (x *GetExtendedACLResponse_Body) GetSessionToken() *grpc.SessionToken { + if x != nil { + return x.SessionToken + } + return nil +} + // Container used space announcement body. type AnnounceUsedSpaceRequest_Body struct { state protoimpl.MessageState @@ -1902,7 +1929,7 @@ var file_v2_container_grpc_service_proto_rawDesc = []byte{ 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x64, - 0x22, 0xaa, 0x02, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x22, 0xaa, 0x03, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 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, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, @@ -1916,11 +1943,19 @@ var file_v2_container_grpc_service_proto_rawDesc = []byte{ 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, 0x44, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, - 0x3c, 0x0a, 0x09, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x1e, 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, 0x52, 0x09, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x22, 0x9e, 0x02, + 0x79, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x1a, 0xc3, 0x01, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, + 0x12, 0x3c, 0x0a, 0x09, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x1e, 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, 0x52, 0x09, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x12, 0x37, + 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, + 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, + 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x44, 0x0a, 0x0d, 0x73, 0x65, 0x73, 0x73, 0x69, + 0x6f, 0x6e, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, + 0x6f, 0x6e, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, + 0x0c, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x9e, 0x02, 0x0a, 0x0b, 0x4c, 0x69, 0x73, 0x74, 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, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, @@ -2017,7 +2052,7 @@ var file_v2_container_grpc_service_proto_rawDesc = []byte{ 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x64, 0x22, - 0xe9, 0x02, 0x0a, 0x16, 0x47, 0x65, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x41, + 0xb0, 0x03, 0x0a, 0x16, 0x47, 0x65, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x41, 0x43, 0x4c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x44, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x30, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x47, @@ -2032,110 +2067,114 @@ var file_v2_container_grpc_service_proto_rawDesc = []byte{ 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, 0x6d, 0x0a, 0x04, - 0x42, 0x6f, 0x64, 0x79, 0x12, 0x2c, 0x0a, 0x04, 0x65, 0x61, 0x63, 0x6c, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, - 0x63, 0x6c, 0x2e, 0x45, 0x41, 0x43, 0x4c, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x52, 0x04, 0x65, 0x61, - 0x63, 0x6c, 0x12, 0x37, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, - 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, - 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x22, 0xf2, 0x03, 0x0a, 0x18, - 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x55, 0x73, 0x65, 0x64, 0x53, 0x70, 0x61, 0x63, - 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x46, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x32, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, + 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x1a, 0xb3, 0x01, 0x0a, + 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x2c, 0x0a, 0x04, 0x65, 0x61, 0x63, 0x6c, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, + 0x61, 0x63, 0x6c, 0x2e, 0x45, 0x41, 0x43, 0x4c, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x52, 0x04, 0x65, + 0x61, 0x63, 0x6c, 0x12, 0x37, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, + 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, + 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x44, 0x0a, 0x0d, + 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, + 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x54, + 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x0c, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x6f, 0x6b, + 0x65, 0x6e, 0x22, 0xf2, 0x03, 0x0a, 0x18, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x55, + 0x73, 0x65, 0x64, 0x53, 0x70, 0x61, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x46, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x32, 0x2e, + 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, + 0x6e, 0x65, 0x72, 0x2e, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x55, 0x73, 0x65, 0x64, + 0x53, 0x70, 0x61, 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, 0xf3, 0x01, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x65, 0x0a, 0x0d, 0x61, 0x6e, + 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x3f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, + 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, + 0x55, 0x73, 0x65, 0x64, 0x53, 0x70, 0x61, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x2e, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x6d, 0x65, + 0x6e, 0x74, 0x52, 0x0d, 0x61, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x6d, 0x65, 0x6e, 0x74, + 0x73, 0x1a, 0x83, 0x01, 0x0a, 0x0c, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x6d, 0x65, + 0x6e, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x04, 0x52, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x12, 0x3e, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, + 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, + 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x52, 0x0b, 0x63, 0x6f, 0x6e, + 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x75, 0x73, 0x65, 0x64, + 0x5f, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x75, 0x73, + 0x65, 0x64, 0x53, 0x70, 0x61, 0x63, 0x65, 0x22, 0x88, 0x02, 0x0a, 0x19, 0x41, 0x6e, 0x6e, 0x6f, + 0x75, 0x6e, 0x63, 0x65, 0x55, 0x73, 0x65, 0x64, 0x53, 0x70, 0x61, 0x63, 0x65, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x47, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x33, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, + 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, + 0x63, 0x65, 0x55, 0x73, 0x65, 0x64, 0x53, 0x70, 0x61, 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, 0x06, 0x0a, 0x04, 0x42, 0x6f, + 0x64, 0x79, 0x32, 0x90, 0x05, 0x0a, 0x10, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, + 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x48, 0x0a, 0x03, 0x50, 0x75, 0x74, 0x12, 0x1f, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, + 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, + 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x51, 0x0a, 0x06, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x12, 0x22, 0x2e, 0x6e, 0x65, + 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, + 0x72, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x23, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, + 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x48, 0x0a, 0x03, 0x47, 0x65, 0x74, 0x12, 0x1f, 0x2e, 0x6e, 0x65, + 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, + 0x72, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, + 0x65, 0x72, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4b, + 0x0a, 0x04, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, + 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x4c, 0x69, 0x73, + 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x4c, + 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x69, 0x0a, 0x0e, 0x53, + 0x65, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x41, 0x43, 0x4c, 0x12, 0x2a, 0x2e, + 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, + 0x6e, 0x65, 0x72, 0x2e, 0x53, 0x65, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x41, + 0x43, 0x4c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, + 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, + 0x53, 0x65, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x41, 0x43, 0x4c, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x69, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x45, 0x78, 0x74, + 0x65, 0x6e, 0x64, 0x65, 0x64, 0x41, 0x43, 0x4c, 0x12, 0x2a, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x47, + 0x65, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x41, 0x43, 0x4c, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x74, 0x45, 0x78, + 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x41, 0x43, 0x4c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x72, 0x0a, 0x11, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x55, 0x73, 0x65, + 0x64, 0x53, 0x70, 0x61, 0x63, 0x65, 0x12, 0x2d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x55, 0x73, 0x65, 0x64, 0x53, 0x70, 0x61, 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, 0xf3, 0x01, 0x0a, 0x04, 0x42, - 0x6f, 0x64, 0x79, 0x12, 0x65, 0x0a, 0x0d, 0x61, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x6d, - 0x65, 0x6e, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x3f, 0x2e, 0x6e, 0x65, 0x6f, - 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, - 0x2e, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x55, 0x73, 0x65, 0x64, 0x53, 0x70, 0x61, - 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x2e, 0x41, - 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x0d, 0x61, 0x6e, 0x6e, - 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x1a, 0x83, 0x01, 0x0a, 0x0c, 0x41, - 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x65, - 0x70, 0x6f, 0x63, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x65, 0x70, 0x6f, 0x63, - 0x68, 0x12, 0x3e, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, - 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, - 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, - 0x65, 0x72, 0x49, 0x44, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, - 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x75, 0x73, 0x65, 0x64, 0x5f, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x75, 0x73, 0x65, 0x64, 0x53, 0x70, 0x61, 0x63, 0x65, - 0x22, 0x88, 0x02, 0x0a, 0x19, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x55, 0x73, 0x65, - 0x64, 0x53, 0x70, 0x61, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x47, - 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x33, 0x2e, 0x6e, - 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, - 0x65, 0x72, 0x2e, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x55, 0x73, 0x65, 0x64, 0x53, - 0x70, 0x61, 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, 0x06, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x32, 0x90, 0x05, 0x0a, 0x10, - 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, - 0x12, 0x48, 0x0a, 0x03, 0x50, 0x75, 0x74, 0x12, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, - 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x75, - 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, - 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x50, - 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x51, 0x0a, 0x06, 0x44, 0x65, - 0x6c, 0x65, 0x74, 0x65, 0x12, 0x22, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, - 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, - 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, - 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x44, - 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x48, 0x0a, - 0x03, 0x47, 0x65, 0x74, 0x12, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, - 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, - 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x74, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4b, 0x0a, 0x04, 0x4c, 0x69, 0x73, 0x74, 0x12, - 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, - 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x21, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, - 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x69, 0x0a, 0x0e, 0x53, 0x65, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, - 0x64, 0x65, 0x64, 0x41, 0x43, 0x4c, 0x12, 0x2a, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, - 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x53, 0x65, 0x74, - 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x41, 0x43, 0x4c, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x2b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, - 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x53, 0x65, 0x74, 0x45, 0x78, 0x74, 0x65, - 0x6e, 0x64, 0x65, 0x64, 0x41, 0x43, 0x4c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, - 0x69, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x41, 0x43, - 0x4c, 0x12, 0x2a, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, - 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, - 0x64, 0x65, 0x64, 0x41, 0x43, 0x4c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2b, 0x2e, - 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, - 0x6e, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x41, - 0x43, 0x4c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x72, 0x0a, 0x11, 0x41, 0x6e, - 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x55, 0x73, 0x65, 0x64, 0x53, 0x70, 0x61, 0x63, 0x65, 0x12, - 0x2d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, - 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x55, 0x73, - 0x65, 0x64, 0x53, 0x70, 0x61, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2e, - 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, - 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x55, 0x73, 0x65, - 0x64, 0x53, 0x70, 0x61, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x5f, - 0x5a, 0x3d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, - 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, - 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 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, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2e, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x41, 0x6e, 0x6e, 0x6f, + 0x75, 0x6e, 0x63, 0x65, 0x55, 0x73, 0x65, 0x64, 0x53, 0x70, 0x61, 0x63, 0x65, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x5f, 0x5a, 0x3d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, + 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, + 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 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, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -2188,8 +2227,9 @@ var file_v2_container_grpc_service_proto_goTypes = []interface{}{ (*Container)(nil), // 33: neo.fs.v2.container.Container (*grpc1.Signature)(nil), // 34: neo.fs.v2.refs.Signature (*grpc1.ContainerID)(nil), // 35: neo.fs.v2.refs.ContainerID - (*grpc1.OwnerID)(nil), // 36: neo.fs.v2.refs.OwnerID - (*grpc2.EACLTable)(nil), // 37: neo.fs.v2.acl.EACLTable + (*grpc.SessionToken)(nil), // 36: neo.fs.v2.session.SessionToken + (*grpc1.OwnerID)(nil), // 37: neo.fs.v2.refs.OwnerID + (*grpc2.EACLTable)(nil), // 38: neo.fs.v2.acl.EACLTable } var file_v2_container_grpc_service_proto_depIdxs = []int32{ 14, // 0: neo.fs.v2.container.PutRequest.body:type_name -> neo.fs.v2.container.PutRequest.Body @@ -2241,34 +2281,37 @@ var file_v2_container_grpc_service_proto_depIdxs = []int32{ 34, // 46: neo.fs.v2.container.DeleteRequest.Body.signature:type_name -> neo.fs.v2.refs.Signature 35, // 47: neo.fs.v2.container.GetRequest.Body.container_id:type_name -> neo.fs.v2.refs.ContainerID 33, // 48: neo.fs.v2.container.GetResponse.Body.container:type_name -> neo.fs.v2.container.Container - 36, // 49: neo.fs.v2.container.ListRequest.Body.owner_id:type_name -> neo.fs.v2.refs.OwnerID - 35, // 50: neo.fs.v2.container.ListResponse.Body.container_ids:type_name -> neo.fs.v2.refs.ContainerID - 37, // 51: neo.fs.v2.container.SetExtendedACLRequest.Body.eacl:type_name -> neo.fs.v2.acl.EACLTable - 34, // 52: neo.fs.v2.container.SetExtendedACLRequest.Body.signature:type_name -> neo.fs.v2.refs.Signature - 35, // 53: neo.fs.v2.container.GetExtendedACLRequest.Body.container_id:type_name -> neo.fs.v2.refs.ContainerID - 37, // 54: neo.fs.v2.container.GetExtendedACLResponse.Body.eacl:type_name -> neo.fs.v2.acl.EACLTable - 34, // 55: neo.fs.v2.container.GetExtendedACLResponse.Body.signature:type_name -> neo.fs.v2.refs.Signature - 27, // 56: neo.fs.v2.container.AnnounceUsedSpaceRequest.Body.announcements:type_name -> neo.fs.v2.container.AnnounceUsedSpaceRequest.Body.Announcement - 35, // 57: neo.fs.v2.container.AnnounceUsedSpaceRequest.Body.Announcement.container_id:type_name -> neo.fs.v2.refs.ContainerID - 0, // 58: neo.fs.v2.container.ContainerService.Put:input_type -> neo.fs.v2.container.PutRequest - 2, // 59: neo.fs.v2.container.ContainerService.Delete:input_type -> neo.fs.v2.container.DeleteRequest - 4, // 60: neo.fs.v2.container.ContainerService.Get:input_type -> neo.fs.v2.container.GetRequest - 6, // 61: neo.fs.v2.container.ContainerService.List:input_type -> neo.fs.v2.container.ListRequest - 8, // 62: neo.fs.v2.container.ContainerService.SetExtendedACL:input_type -> neo.fs.v2.container.SetExtendedACLRequest - 10, // 63: neo.fs.v2.container.ContainerService.GetExtendedACL:input_type -> neo.fs.v2.container.GetExtendedACLRequest - 12, // 64: neo.fs.v2.container.ContainerService.AnnounceUsedSpace:input_type -> neo.fs.v2.container.AnnounceUsedSpaceRequest - 1, // 65: neo.fs.v2.container.ContainerService.Put:output_type -> neo.fs.v2.container.PutResponse - 3, // 66: neo.fs.v2.container.ContainerService.Delete:output_type -> neo.fs.v2.container.DeleteResponse - 5, // 67: neo.fs.v2.container.ContainerService.Get:output_type -> neo.fs.v2.container.GetResponse - 7, // 68: neo.fs.v2.container.ContainerService.List:output_type -> neo.fs.v2.container.ListResponse - 9, // 69: neo.fs.v2.container.ContainerService.SetExtendedACL:output_type -> neo.fs.v2.container.SetExtendedACLResponse - 11, // 70: neo.fs.v2.container.ContainerService.GetExtendedACL:output_type -> neo.fs.v2.container.GetExtendedACLResponse - 13, // 71: neo.fs.v2.container.ContainerService.AnnounceUsedSpace:output_type -> neo.fs.v2.container.AnnounceUsedSpaceResponse - 65, // [65:72] is the sub-list for method output_type - 58, // [58:65] is the sub-list for method input_type - 58, // [58:58] is the sub-list for extension type_name - 58, // [58:58] is the sub-list for extension extendee - 0, // [0:58] is the sub-list for field type_name + 34, // 49: neo.fs.v2.container.GetResponse.Body.signature:type_name -> neo.fs.v2.refs.Signature + 36, // 50: neo.fs.v2.container.GetResponse.Body.session_token:type_name -> neo.fs.v2.session.SessionToken + 37, // 51: neo.fs.v2.container.ListRequest.Body.owner_id:type_name -> neo.fs.v2.refs.OwnerID + 35, // 52: neo.fs.v2.container.ListResponse.Body.container_ids:type_name -> neo.fs.v2.refs.ContainerID + 38, // 53: neo.fs.v2.container.SetExtendedACLRequest.Body.eacl:type_name -> neo.fs.v2.acl.EACLTable + 34, // 54: neo.fs.v2.container.SetExtendedACLRequest.Body.signature:type_name -> neo.fs.v2.refs.Signature + 35, // 55: neo.fs.v2.container.GetExtendedACLRequest.Body.container_id:type_name -> neo.fs.v2.refs.ContainerID + 38, // 56: neo.fs.v2.container.GetExtendedACLResponse.Body.eacl:type_name -> neo.fs.v2.acl.EACLTable + 34, // 57: neo.fs.v2.container.GetExtendedACLResponse.Body.signature:type_name -> neo.fs.v2.refs.Signature + 36, // 58: neo.fs.v2.container.GetExtendedACLResponse.Body.session_token:type_name -> neo.fs.v2.session.SessionToken + 27, // 59: neo.fs.v2.container.AnnounceUsedSpaceRequest.Body.announcements:type_name -> neo.fs.v2.container.AnnounceUsedSpaceRequest.Body.Announcement + 35, // 60: neo.fs.v2.container.AnnounceUsedSpaceRequest.Body.Announcement.container_id:type_name -> neo.fs.v2.refs.ContainerID + 0, // 61: neo.fs.v2.container.ContainerService.Put:input_type -> neo.fs.v2.container.PutRequest + 2, // 62: neo.fs.v2.container.ContainerService.Delete:input_type -> neo.fs.v2.container.DeleteRequest + 4, // 63: neo.fs.v2.container.ContainerService.Get:input_type -> neo.fs.v2.container.GetRequest + 6, // 64: neo.fs.v2.container.ContainerService.List:input_type -> neo.fs.v2.container.ListRequest + 8, // 65: neo.fs.v2.container.ContainerService.SetExtendedACL:input_type -> neo.fs.v2.container.SetExtendedACLRequest + 10, // 66: neo.fs.v2.container.ContainerService.GetExtendedACL:input_type -> neo.fs.v2.container.GetExtendedACLRequest + 12, // 67: neo.fs.v2.container.ContainerService.AnnounceUsedSpace:input_type -> neo.fs.v2.container.AnnounceUsedSpaceRequest + 1, // 68: neo.fs.v2.container.ContainerService.Put:output_type -> neo.fs.v2.container.PutResponse + 3, // 69: neo.fs.v2.container.ContainerService.Delete:output_type -> neo.fs.v2.container.DeleteResponse + 5, // 70: neo.fs.v2.container.ContainerService.Get:output_type -> neo.fs.v2.container.GetResponse + 7, // 71: neo.fs.v2.container.ContainerService.List:output_type -> neo.fs.v2.container.ListResponse + 9, // 72: neo.fs.v2.container.ContainerService.SetExtendedACL:output_type -> neo.fs.v2.container.SetExtendedACLResponse + 11, // 73: neo.fs.v2.container.ContainerService.GetExtendedACL:output_type -> neo.fs.v2.container.GetExtendedACLResponse + 13, // 74: neo.fs.v2.container.ContainerService.AnnounceUsedSpace:output_type -> neo.fs.v2.container.AnnounceUsedSpaceResponse + 68, // [68:75] is the sub-list for method output_type + 61, // [61:68] is the sub-list for method input_type + 61, // [61:61] is the sub-list for extension type_name + 61, // [61:61] is the sub-list for extension extendee + 0, // [0:61] is the sub-list for field type_name } func init() { file_v2_container_grpc_service_proto_init() } diff --git a/v2/session/grpc/types.pb.go b/v2/session/grpc/types.pb.go index 3c73d23..209d413 100644 --- a/v2/session/grpc/types.pb.go +++ b/v2/session/grpc/types.pb.go @@ -100,6 +100,63 @@ func (ObjectSessionContext_Verb) EnumDescriptor() ([]byte, []int) { return file_v2_session_grpc_types_proto_rawDescGZIP(), []int{0, 0} } +// Container request verbs +type ContainerSessionContext_Verb int32 + +const ( + // Unknown verb + ContainerSessionContext_VERB_UNSPECIFIED ContainerSessionContext_Verb = 0 + // Refers to container.Put RPC call + ContainerSessionContext_PUT ContainerSessionContext_Verb = 1 + // Refers to container.Delete RPC call + ContainerSessionContext_DELETE ContainerSessionContext_Verb = 2 + // Refers to container.SetExtendedACL RPC call + ContainerSessionContext_SETEACL ContainerSessionContext_Verb = 3 +) + +// Enum value maps for ContainerSessionContext_Verb. +var ( + ContainerSessionContext_Verb_name = map[int32]string{ + 0: "VERB_UNSPECIFIED", + 1: "PUT", + 2: "DELETE", + 3: "SETEACL", + } + ContainerSessionContext_Verb_value = map[string]int32{ + "VERB_UNSPECIFIED": 0, + "PUT": 1, + "DELETE": 2, + "SETEACL": 3, + } +) + +func (x ContainerSessionContext_Verb) Enum() *ContainerSessionContext_Verb { + p := new(ContainerSessionContext_Verb) + *p = x + return p +} + +func (x ContainerSessionContext_Verb) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (ContainerSessionContext_Verb) Descriptor() protoreflect.EnumDescriptor { + return file_v2_session_grpc_types_proto_enumTypes[1].Descriptor() +} + +func (ContainerSessionContext_Verb) Type() protoreflect.EnumType { + return &file_v2_session_grpc_types_proto_enumTypes[1] +} + +func (x ContainerSessionContext_Verb) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use ContainerSessionContext_Verb.Descriptor instead. +func (ContainerSessionContext_Verb) EnumDescriptor() ([]byte, []int) { + return file_v2_session_grpc_types_proto_rawDescGZIP(), []int{1, 0} +} + // Context information for Session Tokens related to ObjectService requests type ObjectSessionContext struct { state protoimpl.MessageState @@ -158,6 +215,77 @@ func (x *ObjectSessionContext) GetAddress() *grpc.Address { return nil } +// Context information for Session Tokens related to ContainerService requests +type ContainerSessionContext struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Type of request for which the token is issued + Verb ContainerSessionContext_Verb `protobuf:"varint,1,opt,name=verb,proto3,enum=neo.fs.v2.session.ContainerSessionContext_Verb" json:"verb,omitempty"` + // Spreads the action to all owner containers. + // + // If set, container_id field is ignored. + Wildcard bool `protobuf:"varint,2,opt,name=wildcard,proto3" json:"wildcard,omitempty"` + // Particular container to which the action applies. + // + // Ignored if wildcard flag is set. + ContainerId *grpc.ContainerID `protobuf:"bytes,3,opt,name=container_id,json=containerID,proto3" json:"container_id,omitempty"` +} + +func (x *ContainerSessionContext) Reset() { + *x = ContainerSessionContext{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_session_grpc_types_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ContainerSessionContext) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ContainerSessionContext) ProtoMessage() {} + +func (x *ContainerSessionContext) ProtoReflect() protoreflect.Message { + mi := &file_v2_session_grpc_types_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ContainerSessionContext.ProtoReflect.Descriptor instead. +func (*ContainerSessionContext) Descriptor() ([]byte, []int) { + return file_v2_session_grpc_types_proto_rawDescGZIP(), []int{1} +} + +func (x *ContainerSessionContext) GetVerb() ContainerSessionContext_Verb { + if x != nil { + return x.Verb + } + return ContainerSessionContext_VERB_UNSPECIFIED +} + +func (x *ContainerSessionContext) GetWildcard() bool { + if x != nil { + return x.Wildcard + } + return false +} + +func (x *ContainerSessionContext) GetContainerId() *grpc.ContainerID { + if x != nil { + return x.ContainerId + } + return nil +} + // NeoFS Session Token. type SessionToken struct { state protoimpl.MessageState @@ -175,7 +303,7 @@ type SessionToken struct { func (x *SessionToken) Reset() { *x = SessionToken{} if protoimpl.UnsafeEnabled { - mi := &file_v2_session_grpc_types_proto_msgTypes[1] + mi := &file_v2_session_grpc_types_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -188,7 +316,7 @@ func (x *SessionToken) String() string { func (*SessionToken) ProtoMessage() {} func (x *SessionToken) ProtoReflect() protoreflect.Message { - mi := &file_v2_session_grpc_types_proto_msgTypes[1] + mi := &file_v2_session_grpc_types_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -201,7 +329,7 @@ func (x *SessionToken) ProtoReflect() protoreflect.Message { // Deprecated: Use SessionToken.ProtoReflect.Descriptor instead. func (*SessionToken) Descriptor() ([]byte, []int) { - return file_v2_session_grpc_types_proto_rawDescGZIP(), []int{1} + return file_v2_session_grpc_types_proto_rawDescGZIP(), []int{2} } func (x *SessionToken) GetBody() *SessionToken_Body { @@ -251,7 +379,7 @@ type XHeader struct { func (x *XHeader) Reset() { *x = XHeader{} if protoimpl.UnsafeEnabled { - mi := &file_v2_session_grpc_types_proto_msgTypes[2] + mi := &file_v2_session_grpc_types_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -264,7 +392,7 @@ func (x *XHeader) String() string { func (*XHeader) ProtoMessage() {} func (x *XHeader) ProtoReflect() protoreflect.Message { - mi := &file_v2_session_grpc_types_proto_msgTypes[2] + mi := &file_v2_session_grpc_types_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -277,7 +405,7 @@ func (x *XHeader) ProtoReflect() protoreflect.Message { // Deprecated: Use XHeader.ProtoReflect.Descriptor instead. func (*XHeader) Descriptor() ([]byte, []int) { - return file_v2_session_grpc_types_proto_rawDescGZIP(), []int{2} + return file_v2_session_grpc_types_proto_rawDescGZIP(), []int{3} } func (x *XHeader) GetKey() string { @@ -320,7 +448,7 @@ type RequestMetaHeader struct { func (x *RequestMetaHeader) Reset() { *x = RequestMetaHeader{} if protoimpl.UnsafeEnabled { - mi := &file_v2_session_grpc_types_proto_msgTypes[3] + mi := &file_v2_session_grpc_types_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -333,7 +461,7 @@ func (x *RequestMetaHeader) String() string { func (*RequestMetaHeader) ProtoMessage() {} func (x *RequestMetaHeader) ProtoReflect() protoreflect.Message { - mi := &file_v2_session_grpc_types_proto_msgTypes[3] + mi := &file_v2_session_grpc_types_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -346,7 +474,7 @@ func (x *RequestMetaHeader) ProtoReflect() protoreflect.Message { // Deprecated: Use RequestMetaHeader.ProtoReflect.Descriptor instead. func (*RequestMetaHeader) Descriptor() ([]byte, []int) { - return file_v2_session_grpc_types_proto_rawDescGZIP(), []int{3} + return file_v2_session_grpc_types_proto_rawDescGZIP(), []int{4} } func (x *RequestMetaHeader) GetVersion() *grpc.Version { @@ -419,7 +547,7 @@ type ResponseMetaHeader struct { func (x *ResponseMetaHeader) Reset() { *x = ResponseMetaHeader{} if protoimpl.UnsafeEnabled { - mi := &file_v2_session_grpc_types_proto_msgTypes[4] + mi := &file_v2_session_grpc_types_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -432,7 +560,7 @@ func (x *ResponseMetaHeader) String() string { func (*ResponseMetaHeader) ProtoMessage() {} func (x *ResponseMetaHeader) ProtoReflect() protoreflect.Message { - mi := &file_v2_session_grpc_types_proto_msgTypes[4] + mi := &file_v2_session_grpc_types_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -445,7 +573,7 @@ func (x *ResponseMetaHeader) ProtoReflect() protoreflect.Message { // Deprecated: Use ResponseMetaHeader.ProtoReflect.Descriptor instead. func (*ResponseMetaHeader) Descriptor() ([]byte, []int) { - return file_v2_session_grpc_types_proto_rawDescGZIP(), []int{4} + return file_v2_session_grpc_types_proto_rawDescGZIP(), []int{5} } func (x *ResponseMetaHeader) GetVersion() *grpc.Version { @@ -502,7 +630,7 @@ type RequestVerificationHeader struct { func (x *RequestVerificationHeader) Reset() { *x = RequestVerificationHeader{} if protoimpl.UnsafeEnabled { - mi := &file_v2_session_grpc_types_proto_msgTypes[5] + mi := &file_v2_session_grpc_types_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -515,7 +643,7 @@ func (x *RequestVerificationHeader) String() string { func (*RequestVerificationHeader) ProtoMessage() {} func (x *RequestVerificationHeader) ProtoReflect() protoreflect.Message { - mi := &file_v2_session_grpc_types_proto_msgTypes[5] + mi := &file_v2_session_grpc_types_proto_msgTypes[6] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -528,7 +656,7 @@ func (x *RequestVerificationHeader) ProtoReflect() protoreflect.Message { // Deprecated: Use RequestVerificationHeader.ProtoReflect.Descriptor instead. func (*RequestVerificationHeader) Descriptor() ([]byte, []int) { - return file_v2_session_grpc_types_proto_rawDescGZIP(), []int{5} + return file_v2_session_grpc_types_proto_rawDescGZIP(), []int{6} } func (x *RequestVerificationHeader) GetBodySignature() *grpc.Signature { @@ -578,7 +706,7 @@ type ResponseVerificationHeader struct { func (x *ResponseVerificationHeader) Reset() { *x = ResponseVerificationHeader{} if protoimpl.UnsafeEnabled { - mi := &file_v2_session_grpc_types_proto_msgTypes[6] + mi := &file_v2_session_grpc_types_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -591,7 +719,7 @@ func (x *ResponseVerificationHeader) String() string { func (*ResponseVerificationHeader) ProtoMessage() {} func (x *ResponseVerificationHeader) ProtoReflect() protoreflect.Message { - mi := &file_v2_session_grpc_types_proto_msgTypes[6] + mi := &file_v2_session_grpc_types_proto_msgTypes[7] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -604,7 +732,7 @@ func (x *ResponseVerificationHeader) ProtoReflect() protoreflect.Message { // Deprecated: Use ResponseVerificationHeader.ProtoReflect.Descriptor instead. func (*ResponseVerificationHeader) Descriptor() ([]byte, []int) { - return file_v2_session_grpc_types_proto_rawDescGZIP(), []int{6} + return file_v2_session_grpc_types_proto_rawDescGZIP(), []int{7} } func (x *ResponseVerificationHeader) GetBodySignature() *grpc.Signature { @@ -653,13 +781,14 @@ type SessionToken_Body struct { // // Types that are assignable to Context: // *SessionToken_Body_Object + // *SessionToken_Body_Container Context isSessionToken_Body_Context `protobuf_oneof:"context"` } func (x *SessionToken_Body) Reset() { *x = SessionToken_Body{} if protoimpl.UnsafeEnabled { - mi := &file_v2_session_grpc_types_proto_msgTypes[7] + mi := &file_v2_session_grpc_types_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -672,7 +801,7 @@ func (x *SessionToken_Body) String() string { func (*SessionToken_Body) ProtoMessage() {} func (x *SessionToken_Body) ProtoReflect() protoreflect.Message { - mi := &file_v2_session_grpc_types_proto_msgTypes[7] + mi := &file_v2_session_grpc_types_proto_msgTypes[8] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -685,7 +814,7 @@ func (x *SessionToken_Body) ProtoReflect() protoreflect.Message { // Deprecated: Use SessionToken_Body.ProtoReflect.Descriptor instead. func (*SessionToken_Body) Descriptor() ([]byte, []int) { - return file_v2_session_grpc_types_proto_rawDescGZIP(), []int{1, 0} + return file_v2_session_grpc_types_proto_rawDescGZIP(), []int{2, 0} } func (x *SessionToken_Body) GetId() []byte { @@ -730,6 +859,13 @@ func (x *SessionToken_Body) GetObject() *ObjectSessionContext { return nil } +func (x *SessionToken_Body) GetContainer() *ContainerSessionContext { + if x, ok := x.GetContext().(*SessionToken_Body_Container); ok { + return x.Container + } + return nil +} + type isSessionToken_Body_Context interface { isSessionToken_Body_Context() } @@ -739,8 +875,15 @@ type SessionToken_Body_Object struct { Object *ObjectSessionContext `protobuf:"bytes,5,opt,name=object,proto3,oneof"` } +type SessionToken_Body_Container struct { + // ContainerService session context + Container *ContainerSessionContext `protobuf:"bytes,6,opt,name=container,proto3,oneof"` +} + func (*SessionToken_Body_Object) isSessionToken_Body_Context() {} +func (*SessionToken_Body_Container) isSessionToken_Body_Context() {} + // Lifetime parameters of the token. Field names taken from rfc7519. type SessionToken_Body_TokenLifetime struct { state protoimpl.MessageState @@ -758,7 +901,7 @@ type SessionToken_Body_TokenLifetime struct { func (x *SessionToken_Body_TokenLifetime) Reset() { *x = SessionToken_Body_TokenLifetime{} if protoimpl.UnsafeEnabled { - mi := &file_v2_session_grpc_types_proto_msgTypes[8] + mi := &file_v2_session_grpc_types_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -771,7 +914,7 @@ func (x *SessionToken_Body_TokenLifetime) String() string { func (*SessionToken_Body_TokenLifetime) ProtoMessage() {} func (x *SessionToken_Body_TokenLifetime) ProtoReflect() protoreflect.Message { - mi := &file_v2_session_grpc_types_proto_msgTypes[8] + mi := &file_v2_session_grpc_types_proto_msgTypes[9] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -784,7 +927,7 @@ func (x *SessionToken_Body_TokenLifetime) ProtoReflect() protoreflect.Message { // Deprecated: Use SessionToken_Body_TokenLifetime.ProtoReflect.Descriptor instead. func (*SessionToken_Body_TokenLifetime) Descriptor() ([]byte, []int) { - return file_v2_session_grpc_types_proto_rawDescGZIP(), []int{1, 0, 0} + return file_v2_session_grpc_types_proto_rawDescGZIP(), []int{2, 0, 0} } func (x *SessionToken_Body_TokenLifetime) GetExp() uint64 { @@ -832,121 +975,142 @@ var file_v2_session_grpc_types_proto_rawDesc = []byte{ 0x02, 0x12, 0x08, 0x0a, 0x04, 0x48, 0x45, 0x41, 0x44, 0x10, 0x03, 0x12, 0x0a, 0x0a, 0x06, 0x53, 0x45, 0x41, 0x52, 0x43, 0x48, 0x10, 0x04, 0x12, 0x0a, 0x0a, 0x06, 0x44, 0x45, 0x4c, 0x45, 0x54, 0x45, 0x10, 0x05, 0x12, 0x09, 0x0a, 0x05, 0x52, 0x41, 0x4e, 0x47, 0x45, 0x10, 0x06, 0x12, 0x0d, - 0x0a, 0x09, 0x52, 0x41, 0x4e, 0x47, 0x45, 0x48, 0x41, 0x53, 0x48, 0x10, 0x07, 0x22, 0xd4, 0x03, - 0x0a, 0x0c, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x38, - 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6e, + 0x0a, 0x09, 0x52, 0x41, 0x4e, 0x47, 0x45, 0x48, 0x41, 0x53, 0x48, 0x10, 0x07, 0x22, 0xfa, 0x01, + 0x0a, 0x17, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x53, 0x65, 0x73, 0x73, 0x69, + 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x12, 0x43, 0x0a, 0x04, 0x76, 0x65, 0x72, + 0x62, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, + 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x43, 0x6f, 0x6e, 0x74, + 0x61, 0x69, 0x6e, 0x65, 0x72, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x74, + 0x65, 0x78, 0x74, 0x2e, 0x56, 0x65, 0x72, 0x62, 0x52, 0x04, 0x76, 0x65, 0x72, 0x62, 0x12, 0x1a, + 0x0a, 0x08, 0x77, 0x69, 0x6c, 0x64, 0x63, 0x61, 0x72, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, + 0x52, 0x08, 0x77, 0x69, 0x6c, 0x64, 0x63, 0x61, 0x72, 0x64, 0x12, 0x3e, 0x0a, 0x0c, 0x63, 0x6f, + 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, + 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x52, 0x0b, 0x63, + 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x22, 0x3e, 0x0a, 0x04, 0x56, 0x65, + 0x72, 0x62, 0x12, 0x14, 0x0a, 0x10, 0x56, 0x45, 0x52, 0x42, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, + 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x50, 0x55, 0x54, 0x10, + 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x44, 0x45, 0x4c, 0x45, 0x54, 0x45, 0x10, 0x02, 0x12, 0x0b, 0x0a, + 0x07, 0x53, 0x45, 0x54, 0x45, 0x41, 0x43, 0x4c, 0x10, 0x03, 0x22, 0xa0, 0x04, 0x0a, 0x0c, 0x53, + 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x38, 0x0a, 0x04, 0x62, + 0x6f, 0x64, 0x79, 0x18, 0x01, 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, 0x53, 0x65, + 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, + 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x37, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, + 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, + 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x1a, 0x9c, + 0x03, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0c, 0x52, 0x02, 0x69, 0x64, 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, 0x4e, 0x0a, 0x08, 0x6c, + 0x69, 0x66, 0x65, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x32, 0x2e, + 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, + 0x6e, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x42, + 0x6f, 0x64, 0x79, 0x2e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x4c, 0x69, 0x66, 0x65, 0x74, 0x69, 0x6d, + 0x65, 0x52, 0x08, 0x6c, 0x69, 0x66, 0x65, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x73, + 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, + 0x52, 0x0a, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x4b, 0x65, 0x79, 0x12, 0x41, 0x0a, 0x06, + 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, - 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x42, 0x6f, - 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x37, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, - 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, - 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, - 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, - 0x65, 0x1a, 0xd0, 0x02, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x02, 0x69, 0x64, 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, 0x4e, - 0x0a, 0x08, 0x6c, 0x69, 0x66, 0x65, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x32, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, - 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x6f, 0x6b, 0x65, - 0x6e, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x2e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x4c, 0x69, 0x66, 0x65, - 0x74, 0x69, 0x6d, 0x65, 0x52, 0x08, 0x6c, 0x69, 0x66, 0x65, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x1f, - 0x0a, 0x0b, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x04, 0x20, - 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x4b, 0x65, 0x79, 0x12, - 0x41, 0x0a, 0x06, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x27, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, - 0x69, 0x6f, 0x6e, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, - 0x6e, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x48, 0x00, 0x52, 0x06, 0x6f, 0x62, 0x6a, 0x65, - 0x63, 0x74, 0x1a, 0x45, 0x0a, 0x0d, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x4c, 0x69, 0x66, 0x65, 0x74, - 0x69, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x78, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, - 0x52, 0x03, 0x65, 0x78, 0x70, 0x12, 0x10, 0x0a, 0x03, 0x6e, 0x62, 0x66, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x04, 0x52, 0x03, 0x6e, 0x62, 0x66, 0x12, 0x10, 0x0a, 0x03, 0x69, 0x61, 0x74, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x69, 0x61, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x63, 0x6f, 0x6e, - 0x74, 0x65, 0x78, 0x74, 0x22, 0x31, 0x0a, 0x07, 0x58, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 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, 0x22, 0xea, 0x02, 0x0a, 0x11, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 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, 0x14, 0x0a, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, - 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x12, 0x10, 0x0a, 0x03, 0x74, 0x74, 0x6c, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x0d, 0x52, 0x03, 0x74, 0x74, 0x6c, 0x12, 0x37, 0x0a, 0x09, 0x78, 0x5f, 0x68, 0x65, - 0x61, 0x64, 0x65, 0x72, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6e, 0x65, - 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, - 0x58, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x08, 0x78, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, - 0x73, 0x12, 0x44, 0x0a, 0x0d, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x74, 0x6f, 0x6b, - 0x65, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, - 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x65, 0x73, - 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x0c, 0x73, 0x65, 0x73, 0x73, 0x69, - 0x6f, 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x3d, 0x0a, 0x0c, 0x62, 0x65, 0x61, 0x72, 0x65, - 0x72, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, - 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x42, 0x65, - 0x61, 0x72, 0x65, 0x72, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x0b, 0x62, 0x65, 0x61, 0x72, 0x65, - 0x72, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x3c, 0x0a, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, - 0x18, 0x07, 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, 0x06, 0x6f, 0x72, - 0x69, 0x67, 0x69, 0x6e, 0x22, 0xe7, 0x01, 0x0a, 0x12, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x4d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 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, 0x14, - 0x0a, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x65, - 0x70, 0x6f, 0x63, 0x68, 0x12, 0x10, 0x0a, 0x03, 0x74, 0x74, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x0d, 0x52, 0x03, 0x74, 0x74, 0x6c, 0x12, 0x37, 0x0a, 0x09, 0x78, 0x5f, 0x68, 0x65, 0x61, 0x64, - 0x65, 0x72, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, - 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x58, 0x48, - 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x08, 0x78, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x12, - 0x3d, 0x0a, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x18, 0x05, 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, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x22, 0xab, - 0x02, 0x0a, 0x19, 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, 0x12, 0x40, 0x0a, 0x0e, - 0x62, 0x6f, 0x64, 0x79, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, - 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, - 0x0d, 0x62, 0x6f, 0x64, 0x79, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x40, - 0x0a, 0x0e, 0x6d, 0x65, 0x74, 0x61, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, - 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, - 0x65, 0x52, 0x0d, 0x6d, 0x65, 0x74, 0x61, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, - 0x12, 0x44, 0x0a, 0x10, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, - 0x74, 0x75, 0x72, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, - 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, - 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x0f, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x53, 0x69, 0x67, - 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x44, 0x0a, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, - 0x18, 0x04, 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, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x22, 0xad, 0x02, 0x0a, - 0x1a, 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, 0x12, 0x40, 0x0a, 0x0e, 0x62, - 0x6f, 0x64, 0x79, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x01, 0x20, + 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, + 0x6e, 0x74, 0x65, 0x78, 0x74, 0x48, 0x00, 0x52, 0x06, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, + 0x4a, 0x0a, 0x09, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x18, 0x06, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, + 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, + 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x48, 0x00, + 0x52, 0x09, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x1a, 0x45, 0x0a, 0x0d, 0x54, + 0x6f, 0x6b, 0x65, 0x6e, 0x4c, 0x69, 0x66, 0x65, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, + 0x65, 0x78, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x65, 0x78, 0x70, 0x12, 0x10, + 0x0a, 0x03, 0x6e, 0x62, 0x66, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x6e, 0x62, 0x66, + 0x12, 0x10, 0x0a, 0x03, 0x69, 0x61, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x69, + 0x61, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x22, 0x31, 0x0a, + 0x07, 0x58, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 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, + 0x22, 0xea, 0x02, 0x0a, 0x11, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x74, 0x61, + 0x48, 0x65, 0x61, 0x64, 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, 0x14, 0x0a, 0x05, 0x65, 0x70, 0x6f, + 0x63, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x12, + 0x10, 0x0a, 0x03, 0x74, 0x74, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x03, 0x74, 0x74, + 0x6c, 0x12, 0x37, 0x0a, 0x09, 0x78, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x18, 0x04, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x58, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, + 0x52, 0x08, 0x78, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x12, 0x44, 0x0a, 0x0d, 0x73, 0x65, + 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, + 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x6f, 0x6b, + 0x65, 0x6e, 0x52, 0x0c, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, + 0x12, 0x3d, 0x0a, 0x0c, 0x62, 0x65, 0x61, 0x72, 0x65, 0x72, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, + 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, + 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x42, 0x65, 0x61, 0x72, 0x65, 0x72, 0x54, 0x6f, 0x6b, + 0x65, 0x6e, 0x52, 0x0b, 0x62, 0x65, 0x61, 0x72, 0x65, 0x72, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, + 0x3c, 0x0a, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x18, 0x07, 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, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x22, 0xe7, 0x01, + 0x0a, 0x12, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x48, 0x65, + 0x61, 0x64, 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, 0x14, 0x0a, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x12, 0x10, 0x0a, + 0x03, 0x74, 0x74, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x03, 0x74, 0x74, 0x6c, 0x12, + 0x37, 0x0a, 0x09, 0x78, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x18, 0x04, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, + 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x58, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x08, + 0x78, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x12, 0x3d, 0x0a, 0x06, 0x6f, 0x72, 0x69, 0x67, + 0x69, 0x6e, 0x18, 0x05, 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, + 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x22, 0xab, 0x02, 0x0a, 0x19, 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, 0x12, 0x40, 0x0a, 0x0e, 0x62, 0x6f, 0x64, 0x79, 0x5f, 0x73, 0x69, + 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, + 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, + 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x0d, 0x62, 0x6f, 0x64, 0x79, 0x53, 0x69, + 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x40, 0x0a, 0x0e, 0x6d, 0x65, 0x74, 0x61, 0x5f, + 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, + 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x0d, 0x6d, 0x65, 0x74, 0x61, + 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x44, 0x0a, 0x10, 0x6f, 0x72, 0x69, + 0x67, 0x69, 0x6e, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, - 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x0d, - 0x62, 0x6f, 0x64, 0x79, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x40, 0x0a, - 0x0e, 0x6d, 0x65, 0x74, 0x61, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, - 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, - 0x52, 0x0d, 0x6d, 0x65, 0x74, 0x61, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, - 0x44, 0x0a, 0x10, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, - 0x75, 0x72, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, - 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, - 0x74, 0x75, 0x72, 0x65, 0x52, 0x0f, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x53, 0x69, 0x67, 0x6e, - 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x45, 0x0a, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x18, - 0x04, 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, + 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x0f, + 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, + 0x44, 0x0a, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x18, 0x04, 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, 0x06, 0x6f, + 0x72, 0x69, 0x67, 0x69, 0x6e, 0x22, 0xad, 0x02, 0x0a, 0x1a, 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, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x42, 0x59, 0x5a, 0x39, - 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, - 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, - 0x6f, 0x2f, 0x76, 0x32, 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, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x61, 0x64, 0x65, 0x72, 0x12, 0x40, 0x0a, 0x0e, 0x62, 0x6f, 0x64, 0x79, 0x5f, 0x73, 0x69, 0x67, + 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, + 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x0d, 0x62, 0x6f, 0x64, 0x79, 0x53, 0x69, 0x67, + 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x40, 0x0a, 0x0e, 0x6d, 0x65, 0x74, 0x61, 0x5f, 0x73, + 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, + 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x0d, 0x6d, 0x65, 0x74, 0x61, 0x53, + 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x44, 0x0a, 0x10, 0x6f, 0x72, 0x69, 0x67, + 0x69, 0x6e, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, + 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x0f, 0x6f, + 0x72, 0x69, 0x67, 0x69, 0x6e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x45, + 0x0a, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x18, 0x04, 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, 0x06, 0x6f, + 0x72, 0x69, 0x67, 0x69, 0x6e, 0x42, 0x59, 0x5a, 0x39, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, + 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, + 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 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, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -961,54 +1125,60 @@ func file_v2_session_grpc_types_proto_rawDescGZIP() []byte { return file_v2_session_grpc_types_proto_rawDescData } -var file_v2_session_grpc_types_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_v2_session_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 9) +var file_v2_session_grpc_types_proto_enumTypes = make([]protoimpl.EnumInfo, 2) +var file_v2_session_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 10) var file_v2_session_grpc_types_proto_goTypes = []interface{}{ (ObjectSessionContext_Verb)(0), // 0: neo.fs.v2.session.ObjectSessionContext.Verb - (*ObjectSessionContext)(nil), // 1: neo.fs.v2.session.ObjectSessionContext - (*SessionToken)(nil), // 2: neo.fs.v2.session.SessionToken - (*XHeader)(nil), // 3: neo.fs.v2.session.XHeader - (*RequestMetaHeader)(nil), // 4: neo.fs.v2.session.RequestMetaHeader - (*ResponseMetaHeader)(nil), // 5: neo.fs.v2.session.ResponseMetaHeader - (*RequestVerificationHeader)(nil), // 6: neo.fs.v2.session.RequestVerificationHeader - (*ResponseVerificationHeader)(nil), // 7: neo.fs.v2.session.ResponseVerificationHeader - (*SessionToken_Body)(nil), // 8: neo.fs.v2.session.SessionToken.Body - (*SessionToken_Body_TokenLifetime)(nil), // 9: neo.fs.v2.session.SessionToken.Body.TokenLifetime - (*grpc.Address)(nil), // 10: neo.fs.v2.refs.Address - (*grpc.Signature)(nil), // 11: neo.fs.v2.refs.Signature - (*grpc.Version)(nil), // 12: neo.fs.v2.refs.Version - (*grpc1.BearerToken)(nil), // 13: neo.fs.v2.acl.BearerToken - (*grpc.OwnerID)(nil), // 14: neo.fs.v2.refs.OwnerID + (ContainerSessionContext_Verb)(0), // 1: neo.fs.v2.session.ContainerSessionContext.Verb + (*ObjectSessionContext)(nil), // 2: neo.fs.v2.session.ObjectSessionContext + (*ContainerSessionContext)(nil), // 3: neo.fs.v2.session.ContainerSessionContext + (*SessionToken)(nil), // 4: neo.fs.v2.session.SessionToken + (*XHeader)(nil), // 5: neo.fs.v2.session.XHeader + (*RequestMetaHeader)(nil), // 6: neo.fs.v2.session.RequestMetaHeader + (*ResponseMetaHeader)(nil), // 7: neo.fs.v2.session.ResponseMetaHeader + (*RequestVerificationHeader)(nil), // 8: neo.fs.v2.session.RequestVerificationHeader + (*ResponseVerificationHeader)(nil), // 9: neo.fs.v2.session.ResponseVerificationHeader + (*SessionToken_Body)(nil), // 10: neo.fs.v2.session.SessionToken.Body + (*SessionToken_Body_TokenLifetime)(nil), // 11: neo.fs.v2.session.SessionToken.Body.TokenLifetime + (*grpc.Address)(nil), // 12: neo.fs.v2.refs.Address + (*grpc.ContainerID)(nil), // 13: neo.fs.v2.refs.ContainerID + (*grpc.Signature)(nil), // 14: neo.fs.v2.refs.Signature + (*grpc.Version)(nil), // 15: neo.fs.v2.refs.Version + (*grpc1.BearerToken)(nil), // 16: neo.fs.v2.acl.BearerToken + (*grpc.OwnerID)(nil), // 17: neo.fs.v2.refs.OwnerID } var file_v2_session_grpc_types_proto_depIdxs = []int32{ 0, // 0: neo.fs.v2.session.ObjectSessionContext.verb:type_name -> neo.fs.v2.session.ObjectSessionContext.Verb - 10, // 1: neo.fs.v2.session.ObjectSessionContext.address:type_name -> neo.fs.v2.refs.Address - 8, // 2: neo.fs.v2.session.SessionToken.body:type_name -> neo.fs.v2.session.SessionToken.Body - 11, // 3: neo.fs.v2.session.SessionToken.signature:type_name -> neo.fs.v2.refs.Signature - 12, // 4: neo.fs.v2.session.RequestMetaHeader.version:type_name -> neo.fs.v2.refs.Version - 3, // 5: neo.fs.v2.session.RequestMetaHeader.x_headers:type_name -> neo.fs.v2.session.XHeader - 2, // 6: neo.fs.v2.session.RequestMetaHeader.session_token:type_name -> neo.fs.v2.session.SessionToken - 13, // 7: neo.fs.v2.session.RequestMetaHeader.bearer_token:type_name -> neo.fs.v2.acl.BearerToken - 4, // 8: neo.fs.v2.session.RequestMetaHeader.origin:type_name -> neo.fs.v2.session.RequestMetaHeader - 12, // 9: neo.fs.v2.session.ResponseMetaHeader.version:type_name -> neo.fs.v2.refs.Version - 3, // 10: neo.fs.v2.session.ResponseMetaHeader.x_headers:type_name -> neo.fs.v2.session.XHeader - 5, // 11: neo.fs.v2.session.ResponseMetaHeader.origin:type_name -> neo.fs.v2.session.ResponseMetaHeader - 11, // 12: neo.fs.v2.session.RequestVerificationHeader.body_signature:type_name -> neo.fs.v2.refs.Signature - 11, // 13: neo.fs.v2.session.RequestVerificationHeader.meta_signature:type_name -> neo.fs.v2.refs.Signature - 11, // 14: neo.fs.v2.session.RequestVerificationHeader.origin_signature:type_name -> neo.fs.v2.refs.Signature - 6, // 15: neo.fs.v2.session.RequestVerificationHeader.origin:type_name -> neo.fs.v2.session.RequestVerificationHeader - 11, // 16: neo.fs.v2.session.ResponseVerificationHeader.body_signature:type_name -> neo.fs.v2.refs.Signature - 11, // 17: neo.fs.v2.session.ResponseVerificationHeader.meta_signature:type_name -> neo.fs.v2.refs.Signature - 11, // 18: neo.fs.v2.session.ResponseVerificationHeader.origin_signature:type_name -> neo.fs.v2.refs.Signature - 7, // 19: neo.fs.v2.session.ResponseVerificationHeader.origin:type_name -> neo.fs.v2.session.ResponseVerificationHeader - 14, // 20: neo.fs.v2.session.SessionToken.Body.owner_id:type_name -> neo.fs.v2.refs.OwnerID - 9, // 21: neo.fs.v2.session.SessionToken.Body.lifetime:type_name -> neo.fs.v2.session.SessionToken.Body.TokenLifetime - 1, // 22: neo.fs.v2.session.SessionToken.Body.object:type_name -> neo.fs.v2.session.ObjectSessionContext - 23, // [23:23] is the sub-list for method output_type - 23, // [23:23] is the sub-list for method input_type - 23, // [23:23] is the sub-list for extension type_name - 23, // [23:23] is the sub-list for extension extendee - 0, // [0:23] is the sub-list for field type_name + 12, // 1: neo.fs.v2.session.ObjectSessionContext.address:type_name -> neo.fs.v2.refs.Address + 1, // 2: neo.fs.v2.session.ContainerSessionContext.verb:type_name -> neo.fs.v2.session.ContainerSessionContext.Verb + 13, // 3: neo.fs.v2.session.ContainerSessionContext.container_id:type_name -> neo.fs.v2.refs.ContainerID + 10, // 4: neo.fs.v2.session.SessionToken.body:type_name -> neo.fs.v2.session.SessionToken.Body + 14, // 5: neo.fs.v2.session.SessionToken.signature:type_name -> neo.fs.v2.refs.Signature + 15, // 6: neo.fs.v2.session.RequestMetaHeader.version:type_name -> neo.fs.v2.refs.Version + 5, // 7: neo.fs.v2.session.RequestMetaHeader.x_headers:type_name -> neo.fs.v2.session.XHeader + 4, // 8: neo.fs.v2.session.RequestMetaHeader.session_token:type_name -> neo.fs.v2.session.SessionToken + 16, // 9: neo.fs.v2.session.RequestMetaHeader.bearer_token:type_name -> neo.fs.v2.acl.BearerToken + 6, // 10: neo.fs.v2.session.RequestMetaHeader.origin:type_name -> neo.fs.v2.session.RequestMetaHeader + 15, // 11: neo.fs.v2.session.ResponseMetaHeader.version:type_name -> neo.fs.v2.refs.Version + 5, // 12: neo.fs.v2.session.ResponseMetaHeader.x_headers:type_name -> neo.fs.v2.session.XHeader + 7, // 13: neo.fs.v2.session.ResponseMetaHeader.origin:type_name -> neo.fs.v2.session.ResponseMetaHeader + 14, // 14: neo.fs.v2.session.RequestVerificationHeader.body_signature:type_name -> neo.fs.v2.refs.Signature + 14, // 15: neo.fs.v2.session.RequestVerificationHeader.meta_signature:type_name -> neo.fs.v2.refs.Signature + 14, // 16: neo.fs.v2.session.RequestVerificationHeader.origin_signature:type_name -> neo.fs.v2.refs.Signature + 8, // 17: neo.fs.v2.session.RequestVerificationHeader.origin:type_name -> neo.fs.v2.session.RequestVerificationHeader + 14, // 18: neo.fs.v2.session.ResponseVerificationHeader.body_signature:type_name -> neo.fs.v2.refs.Signature + 14, // 19: neo.fs.v2.session.ResponseVerificationHeader.meta_signature:type_name -> neo.fs.v2.refs.Signature + 14, // 20: neo.fs.v2.session.ResponseVerificationHeader.origin_signature:type_name -> neo.fs.v2.refs.Signature + 9, // 21: neo.fs.v2.session.ResponseVerificationHeader.origin:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 17, // 22: neo.fs.v2.session.SessionToken.Body.owner_id:type_name -> neo.fs.v2.refs.OwnerID + 11, // 23: neo.fs.v2.session.SessionToken.Body.lifetime:type_name -> neo.fs.v2.session.SessionToken.Body.TokenLifetime + 2, // 24: neo.fs.v2.session.SessionToken.Body.object:type_name -> neo.fs.v2.session.ObjectSessionContext + 3, // 25: neo.fs.v2.session.SessionToken.Body.container:type_name -> neo.fs.v2.session.ContainerSessionContext + 26, // [26:26] is the sub-list for method output_type + 26, // [26:26] is the sub-list for method input_type + 26, // [26:26] is the sub-list for extension type_name + 26, // [26:26] is the sub-list for extension extendee + 0, // [0:26] is the sub-list for field type_name } func init() { file_v2_session_grpc_types_proto_init() } @@ -1030,7 +1200,7 @@ func file_v2_session_grpc_types_proto_init() { } } file_v2_session_grpc_types_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SessionToken); i { + switch v := v.(*ContainerSessionContext); i { case 0: return &v.state case 1: @@ -1042,7 +1212,7 @@ func file_v2_session_grpc_types_proto_init() { } } file_v2_session_grpc_types_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*XHeader); i { + switch v := v.(*SessionToken); i { case 0: return &v.state case 1: @@ -1054,7 +1224,7 @@ func file_v2_session_grpc_types_proto_init() { } } file_v2_session_grpc_types_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RequestMetaHeader); i { + switch v := v.(*XHeader); i { case 0: return &v.state case 1: @@ -1066,7 +1236,7 @@ func file_v2_session_grpc_types_proto_init() { } } file_v2_session_grpc_types_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ResponseMetaHeader); i { + switch v := v.(*RequestMetaHeader); i { case 0: return &v.state case 1: @@ -1078,7 +1248,7 @@ func file_v2_session_grpc_types_proto_init() { } } file_v2_session_grpc_types_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RequestVerificationHeader); i { + switch v := v.(*ResponseMetaHeader); i { case 0: return &v.state case 1: @@ -1090,7 +1260,7 @@ func file_v2_session_grpc_types_proto_init() { } } file_v2_session_grpc_types_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ResponseVerificationHeader); i { + switch v := v.(*RequestVerificationHeader); i { case 0: return &v.state case 1: @@ -1102,7 +1272,7 @@ func file_v2_session_grpc_types_proto_init() { } } file_v2_session_grpc_types_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SessionToken_Body); i { + switch v := v.(*ResponseVerificationHeader); i { case 0: return &v.state case 1: @@ -1114,6 +1284,18 @@ func file_v2_session_grpc_types_proto_init() { } } file_v2_session_grpc_types_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SessionToken_Body); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_session_grpc_types_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*SessionToken_Body_TokenLifetime); i { case 0: return &v.state @@ -1126,16 +1308,17 @@ func file_v2_session_grpc_types_proto_init() { } } } - file_v2_session_grpc_types_proto_msgTypes[7].OneofWrappers = []interface{}{ + file_v2_session_grpc_types_proto_msgTypes[8].OneofWrappers = []interface{}{ (*SessionToken_Body_Object)(nil), + (*SessionToken_Body_Container)(nil), } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_v2_session_grpc_types_proto_rawDesc, - NumEnums: 1, - NumMessages: 9, + NumEnums: 2, + NumMessages: 10, NumExtensions: 0, NumServices: 0, }, From 8d60b2cdd5f2e11feeceee0c64422c07ea841710 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 24 May 2021 15:50:19 +0300 Subject: [PATCH 0741/1196] [#283] v2/session/grpc: Fix docs of ObjectSessionContext methods Fix docs of `SetVerb` and `SetAddress` methods of `ObjectSessionContext`. Signed-off-by: Leonard Lyubich --- v2/session/grpc/types.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/v2/session/grpc/types.go b/v2/session/grpc/types.go index 27dcd4b..a184c04 100644 --- a/v2/session/grpc/types.go +++ b/v2/session/grpc/types.go @@ -77,14 +77,14 @@ func (m *SessionToken_Body) SetObjectSessionContext(v *ObjectSessionContext) { } } -// SetObjectAddressContext sets object context of the session token. +// SetAddress sets address of the object related to the session. func (m *ObjectSessionContext) SetAddress(v *refs.Address) { if m != nil { m.Address = v } } -// SetObjectAddressContext sets object context of the session token. +// SetVerb sets type of request for which the token is issued. func (m *ObjectSessionContext) SetVerb(v ObjectSessionContext_Verb) { if m != nil { m.Verb = v From f2be7509d3fcabbd10f3619780f70bf9637aeec1 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 24 May 2021 15:54:49 +0300 Subject: [PATCH 0742/1196] [#283] v2/session/grpc: Implement setters on container session messages Implement `SessionToken_Body.SetContainerSessionContext` method. Implement field setters on `ContainerSessionContext`. Signed-off-by: Leonard Lyubich --- v2/session/grpc/types.go | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/v2/session/grpc/types.go b/v2/session/grpc/types.go index a184c04..20f9ee7 100644 --- a/v2/session/grpc/types.go +++ b/v2/session/grpc/types.go @@ -77,6 +77,15 @@ func (m *SessionToken_Body) SetObjectSessionContext(v *ObjectSessionContext) { } } +// SetContainerSessionContext sets container context of the session token. +func (m *SessionToken_Body) SetContainerSessionContext(v *ContainerSessionContext) { + if m != nil { + m.Context = &SessionToken_Body_Container{ + Container: v, + } + } +} + // SetAddress sets address of the object related to the session. func (m *ObjectSessionContext) SetAddress(v *refs.Address) { if m != nil { @@ -91,6 +100,27 @@ func (m *ObjectSessionContext) SetVerb(v ObjectSessionContext_Verb) { } } +// SetVerb sets type of request for which the token is issued. +func (x *ContainerSessionContext) SetVerb(v ContainerSessionContext_Verb) { + if x != nil { + x.Verb = v + } +} + +// SetWildcard sets wildcard flag of the container session. +func (x *ContainerSessionContext) SetWildcard(v bool) { + if x != nil { + x.Wildcard = v + } +} + +// SetContainerId sets identifier of the container related to the session. +func (x *ContainerSessionContext) SetContainerId(v *refs.ContainerID) { + if x != nil { + x.ContainerId = v + } +} + // SetBody sets session token body. func (m *SessionToken) SetBody(v *SessionToken_Body) { if m != nil { From 9eb567a53a0dd7c07fbac097826d78f346f9f09d Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 24 May 2021 17:46:39 +0300 Subject: [PATCH 0743/1196] [#283] v2/session: Support ContainerSessionContext message Define `ContainerSessionContext` structure, implement getters / setters, JSON and binary encoders, gRPC converters. Support new type of context in SessionTokenBody message. Add test message generator and cover methods with unit tests. Signed-off-by: Leonard Lyubich --- v2/session/convert.go | 94 +++++++++++++++++++++++++++++++++++++ v2/session/json.go | 8 ++++ v2/session/marshal.go | 67 ++++++++++++++++++++++++++ v2/session/message_test.go | 1 + v2/session/test/generate.go | 13 +++++ v2/session/types.go | 78 ++++++++++++++++++++++++++++++ 6 files changed, 261 insertions(+) diff --git a/v2/session/convert.go b/v2/session/convert.go index 7beb6ed..42101d3 100644 --- a/v2/session/convert.go +++ b/v2/session/convert.go @@ -707,6 +707,8 @@ func (t *SessionTokenBody) ToGRPCMessage() grpc.Message { m.Context = nil case *ObjectSessionContext: m.SetObjectSessionContext(typ.ToGRPCMessage().(*session.ObjectSessionContext)) + case *ContainerSessionContext: + m.SetContainerSessionContext(typ.ToGRPCMessage().(*session.ContainerSessionContext)) } m.SetOwnerId(t.ownerID.ToGRPCMessage().(*refsGRPC.OwnerID)) @@ -740,6 +742,14 @@ func (t *SessionTokenBody) FromGRPCMessage(m grpc.Message) error { } err = ctx.FromGRPCMessage(val.Object) + case *session.SessionToken_Body_Container: + ctx, ok := t.ctx.(*ContainerSessionContext) + if !ok { + ctx = new(ContainerSessionContext) + t.ctx = ctx + } + + err = ctx.FromGRPCMessage(val.Container) } if err != nil { @@ -779,3 +789,87 @@ func (t *SessionTokenBody) FromGRPCMessage(m grpc.Message) error { return nil } + +// ContainerSessionVerbToGRPCField converts ContainerSessionVerb +// to gRPC-generated session.ContainerSessionContext_Verb. +// +// If v is outside of the ContainerSessionVerb enum, +// session.ContainerSessionContext_VERB_UNSPECIFIED is returned. +func ContainerSessionVerbToGRPCField(v ContainerSessionVerb) session.ContainerSessionContext_Verb { + switch v { + default: + return session.ContainerSessionContext_VERB_UNSPECIFIED + case ContainerVerbPut: + return session.ContainerSessionContext_PUT + case ContainerVerbDelete: + return session.ContainerSessionContext_DELETE + case ContainerVerbSetEACL: + return session.ContainerSessionContext_SETEACL + } +} + +// ContainerSessionVerbFromGRPCField converts gRPC-generated +// session.ContainerSessionContext_Verb to ContainerSessionVerb. +// +// If v is outside of the session.ContainerSessionContext_Verb enum, +// ContainerVerbUnknown is returned. +func ContainerSessionVerbFromGRPCField(v session.ContainerSessionContext_Verb) ContainerSessionVerb { + switch v { + default: + return ContainerVerbUnknown + case session.ContainerSessionContext_PUT: + return ContainerVerbPut + case session.ContainerSessionContext_DELETE: + return ContainerVerbDelete + case session.ContainerSessionContext_SETEACL: + return ContainerVerbSetEACL + } +} + +// ToGRPCMessage converts ContainerSessionContext to gRPC-generated +// session.ContainerSessionContext message. +func (x *ContainerSessionContext) ToGRPCMessage() grpc.Message { + var m *session.ContainerSessionContext + + if x != nil { + m = new(session.ContainerSessionContext) + + m.SetVerb(ContainerSessionVerbToGRPCField(x.verb)) + m.SetWildcard(x.wildcard) + m.SetContainerId(x.cid.ToGRPCMessage().(*refsGRPC.ContainerID)) + } + + return m +} + +// FromGRPCMessage tries to restore ContainerSessionContext from grpc.Message. +// +// Returns message.ErrUnexpectedMessageType if m is not +// a gRPC-generated session.ContainerSessionContext message. +func (x *ContainerSessionContext) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*session.ContainerSessionContext) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + cid := v.GetContainerId() + if cid == nil { + x.cid = nil + } else { + if x.cid == nil { + x.cid = new(refs.ContainerID) + } + + err = x.cid.FromGRPCMessage(cid) + if err != nil { + return err + } + } + + x.verb = ContainerSessionVerbFromGRPCField(v.GetVerb()) + x.wildcard = v.GetWildcard() + + return nil +} diff --git a/v2/session/json.go b/v2/session/json.go index e296887..be7b9ac 100644 --- a/v2/session/json.go +++ b/v2/session/json.go @@ -119,3 +119,11 @@ func (r *ResponseVerificationHeader) UnmarshalJSON(data []byte) error { return r.FromGRPCMessage(msg) } + +func (x *ContainerSessionContext) MarshalJSON() ([]byte, error) { + return message.MarshalJSON(x) +} + +func (x *ContainerSessionContext) UnmarshalJSON(data []byte) error { + return message.UnmarshalJSON(x, data, new(session.ContainerSessionContext)) +} diff --git a/v2/session/marshal.go b/v2/session/marshal.go index b6ea2c0..05085d7 100644 --- a/v2/session/marshal.go +++ b/v2/session/marshal.go @@ -29,6 +29,7 @@ const ( sessionTokenBodyLifetimeField = 3 sessionTokenBodyKeyField = 4 sessionTokenBodyObjectCtxField = 5 + sessionTokenBodyCnrCtxField = 6 sessionTokenBodyField = 1 sessionTokenSignatureField = 2 @@ -301,6 +302,65 @@ func (c *ObjectSessionContext) Unmarshal(data []byte) error { return c.FromGRPCMessage(m) } +const ( + _ = iota + cnrCtxVerbFNum + cnrCtxWildcardFNum + cnrCtxCidFNum +) + +func (x *ContainerSessionContext) StableMarshal(buf []byte) ([]byte, error) { + if x == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, x.StableSize()) + } + + var ( + offset, n int + err error + ) + + n, err = proto.EnumMarshal(cnrCtxVerbFNum, buf[offset:], int32(ContainerSessionVerbToGRPCField(x.verb))) + if err != nil { + return nil, err + } + + offset += n + + n, err = proto.BoolMarshal(cnrCtxWildcardFNum, buf[offset:], x.wildcard) + if err != nil { + return nil, err + } + + offset += n + + _, err = proto.NestedStructureMarshal(cnrCtxCidFNum, buf[offset:], x.cid) + if err != nil { + return nil, err + } + + return buf, nil +} + +func (x *ContainerSessionContext) StableSize() (size int) { + if x == nil { + return 0 + } + + size += proto.EnumSize(cnrCtxVerbFNum, int32(ContainerSessionVerbToGRPCField(x.verb))) + size += proto.BoolSize(cnrCtxWildcardFNum, x.wildcard) + size += proto.NestedStructureSize(cnrCtxCidFNum, x.cid) + + return size +} + +func (x *ContainerSessionContext) Unmarshal(data []byte) error { + return message.Unmarshal(x, data, new(session.ContainerSessionContext)) +} + func (t *SessionTokenBody) StableMarshal(buf []byte) ([]byte, error) { if t == nil { return []byte{}, nil @@ -350,6 +410,11 @@ func (t *SessionTokenBody) StableMarshal(buf []byte) ([]byte, error) { if err != nil { return nil, err } + case *ContainerSessionContext: + _, err = proto.NestedStructureMarshal(sessionTokenBodyCnrCtxField, buf[offset:], v) + if err != nil { + return nil, err + } default: panic("cannot marshal unknown session token context") } @@ -372,6 +437,8 @@ func (t *SessionTokenBody) StableSize() (size int) { switch v := t.ctx.(type) { case *ObjectSessionContext: size += proto.NestedStructureSize(sessionTokenBodyObjectCtxField, v) + case *ContainerSessionContext: + size += proto.NestedStructureSize(sessionTokenBodyCnrCtxField, v) default: panic("cannot marshal unknown session token context") } diff --git a/v2/session/message_test.go b/v2/session/message_test.go index ea9f1cc..17c428e 100644 --- a/v2/session/message_test.go +++ b/v2/session/message_test.go @@ -22,5 +22,6 @@ func TestMessageConvert(t *testing.T) { func(empty bool) message.Message { return sessiontest.GenerateRequestVerificationHeader(empty) }, func(empty bool) message.Message { return sessiontest.GenerateResponseMetaHeader(empty) }, func(empty bool) message.Message { return sessiontest.GenerateResponseVerificationHeader(empty) }, + func(empty bool) message.Message { return sessiontest.GenerateContainerSessionContext(empty) }, ) } diff --git a/v2/session/test/generate.go b/v2/session/test/generate.go index d1a5b56..bad4124 100644 --- a/v2/session/test/generate.go +++ b/v2/session/test/generate.go @@ -179,6 +179,19 @@ func GenerateObjectSessionContext(empty bool) *session.ObjectSessionContext { return m } +func GenerateContainerSessionContext(empty bool) *session.ContainerSessionContext { + m := new(session.ContainerSessionContext) + + if !empty { + m.SetVerb(session.ContainerVerbDelete) + m.SetWildcard(true) + } + + m.SetContainerID(refstest.GenerateContainerID(empty)) + + return m +} + func GenerateXHeader(empty bool) *session.XHeader { m := new(session.XHeader) diff --git a/v2/session/types.go b/v2/session/types.go index 68c3a10..8d092a2 100644 --- a/v2/session/types.go +++ b/v2/session/types.go @@ -735,3 +735,81 @@ func (t *SessionToken) SetSignature(v *refs.Signature) { t.sig = v } } + +// ContainerSessionVerb represents NeoFS API v2 +// session.ContainerSessionContext.Verb enumeration. +type ContainerSessionVerb uint32 + +const ( + // ContainerVerbUnknown corresponds to VERB_UNSPECIFIED enum value. + ContainerVerbUnknown ContainerSessionVerb = iota + + // ContainerVerbPut corresponds to PUT enum value. + ContainerVerbPut + + // ContainerVerbDelete corresponds to DELETE enum value. + ContainerVerbDelete + + // ContainerVerbSetEACL corresponds to SETEACL enum value. + ContainerVerbSetEACL +) + +// ContainerSessionContext represents structure of the +// NeoFS API v2 session.ContainerSessionContext message. +type ContainerSessionContext struct { + verb ContainerSessionVerb + + wildcard bool + + cid *refs.ContainerID +} + +func (x *ContainerSessionContext) sessionTokenContext() {} + +// Verb returns type of request for which the token is issued. +func (x *ContainerSessionContext) Verb() ContainerSessionVerb { + if x != nil { + return x.verb + } + + return ContainerVerbUnknown +} + +// SetVerb sets type of request for which the token is issued. +func (x *ContainerSessionContext) SetVerb(v ContainerSessionVerb) { + if x != nil { + x.verb = v + } +} + +// Wildcard returns wildcard flag of the container session. +func (x *ContainerSessionContext) Wildcard() bool { + if x != nil { + return x.wildcard + } + + return false +} + +// SetWildcard sets wildcard flag of the container session. +func (x *ContainerSessionContext) SetWildcard(v bool) { + if x != nil { + x.wildcard = v + } +} + +// ContainerID returns identifier of the container related to the session. +func (x *ContainerSessionContext) ContainerID() *refs.ContainerID { + if x != nil { + return x.cid + } + + return nil +} + +// SetContainerID sets identifier of the container related to the session. +func (x *ContainerSessionContext) SetContainerID(v *refs.ContainerID) { + if x != nil { + x.cid = v + } +} From 7314038069ee37b03462f260b10a82833ac58dfa Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 24 May 2021 19:31:58 +0300 Subject: [PATCH 0744/1196] [#283] pkg/container: Define ID in a separate package In order to prevent potential cross imports, container ID should be defined in a separate package as a base type. A similar approach was used in the NeoFS API design. Create `pkg/container/id` package and replace container ID implementation to it. Related API in `container` package is deprecated from now. Signed-off-by: Leonard Lyubich --- pkg/client/container.go | 5 +- pkg/container/id.go | 97 +++--------------------------- pkg/container/id/id.go | 95 +++++++++++++++++++++++++++++ pkg/container/id/id_test.go | 73 ++++++++++++++++++++++ pkg/container/id/test/id.go | 26 ++++++++ pkg/container/id_test.go | 117 ------------------------------------ 6 files changed, 206 insertions(+), 207 deletions(-) create mode 100644 pkg/container/id/id.go create mode 100644 pkg/container/id/id_test.go create mode 100644 pkg/container/id/test/id.go delete mode 100644 pkg/container/id_test.go diff --git a/pkg/client/container.go b/pkg/client/container.go index e2257e3..98d9740 100644 --- a/pkg/client/container.go +++ b/pkg/client/container.go @@ -2,6 +2,7 @@ package client import ( "context" + "errors" "fmt" "github.com/nspcc-dev/neofs-api-go/pkg" @@ -170,7 +171,7 @@ func (c *clientImpl) GetContainer(ctx context.Context, id *container.ID, opts .. // GetVerifiedContainerStructure is a wrapper over Client.GetContainer method // which checks if the structure of the resulting container matches its identifier. // -// Returns container.ErrIDMismatch if container does not match the identifier. +// Returns an error if container does not match the identifier. func GetVerifiedContainerStructure(ctx context.Context, c Client, id *container.ID, opts ...CallOption) (*container.Container, error) { cnr, err := c.GetContainer(ctx, id, opts...) if err != nil { @@ -178,7 +179,7 @@ func GetVerifiedContainerStructure(ctx context.Context, c Client, id *container. } if !container.CalculateID(cnr).Equal(id) { - return nil, container.ErrIDMismatch + return nil, errors.New("container structure does not match the identifier") } return cnr, nil diff --git a/pkg/container/id.go b/pkg/container/id.go index 86bb3e3..96a6483 100644 --- a/pkg/container/id.go +++ b/pkg/container/id.go @@ -1,101 +1,22 @@ package container import ( - "bytes" - "crypto/sha256" - "errors" - "fmt" - - "github.com/mr-tron/base58" - "github.com/nspcc-dev/neofs-api-go/v2/refs" + cid "github.com/nspcc-dev/neofs-api-go/pkg/container/id" ) // ID represents v2-compatible container identifier. -type ID refs.ContainerID - -// ErrIDMismatch is returned when container structure does not match -// a specific identifier. -var ErrIDMismatch = errors.New("container structure does not match the identifier") - -var errInvalidIDString = errors.New("incorrect format of the string container ID") +// +// Deprecated: use cid.ID instead. +type ID = cid.ID // NewIDFromV2 wraps v2 ContainerID message to ID. -func NewIDFromV2(idV2 *refs.ContainerID) *ID { - return (*ID)(idV2) -} +// +// Deprecated: use cid.NewFromV2 instead. +var NewIDFromV2 = cid.NewFromV2 // NewID creates and initializes blank ID. // // Works similar to NewIDFromV2(new(ContainerID)). -func NewID() *ID { - return NewIDFromV2(new(refs.ContainerID)) -} - -// SetSHA256 sets container identifier value to SHA256 checksum. -func (id *ID) SetSHA256(v [sha256.Size]byte) { - (*refs.ContainerID)(id).SetValue(v[:]) -} - -// ToV2 returns the v2 container ID message. -func (id *ID) ToV2() *refs.ContainerID { - return (*refs.ContainerID)(id) -} - -// Equal returns true if identifiers are identical. -func (id *ID) Equal(id2 *ID) bool { - return bytes.Equal( - (*refs.ContainerID)(id).GetValue(), - (*refs.ContainerID)(id2).GetValue(), - ) -} - -// Parse converts base58 string representation into ID. -func (id *ID) Parse(s string) error { - data, err := base58.Decode(s) - if err != nil { - return fmt.Errorf("could not parse container.ID from string: %w", err) - } else if len(data) != sha256.Size { - return errInvalidIDString - } - - (*refs.ContainerID)(id).SetValue(data) - - return nil -} - -// String returns base58 string representation of ID. -func (id *ID) String() string { - return base58.Encode((*refs.ContainerID)(id).GetValue()) -} - -// Marshal marshals ID into a protobuf binary form. // -// Buffer is allocated when the argument is empty. -// Otherwise, the first buffer is used. -func (id *ID) Marshal(b ...[]byte) ([]byte, error) { - var buf []byte - if len(b) > 0 { - buf = b[0] - } - - return (*refs.ContainerID)(id). - StableMarshal(buf) -} - -// Unmarshal unmarshals protobuf binary representation of ID. -func (id *ID) Unmarshal(data []byte) error { - return (*refs.ContainerID)(id). - Unmarshal(data) -} - -// MarshalJSON encodes ID to protobuf JSON format. -func (id *ID) MarshalJSON() ([]byte, error) { - return (*refs.ContainerID)(id). - MarshalJSON() -} - -// UnmarshalJSON decodes ID from protobuf JSON format. -func (id *ID) UnmarshalJSON(data []byte) error { - return (*refs.ContainerID)(id). - UnmarshalJSON(data) -} +// Deprecated: use cid.New instead. +var NewID = cid.New diff --git a/pkg/container/id/id.go b/pkg/container/id/id.go new file mode 100644 index 0000000..46b8d37 --- /dev/null +++ b/pkg/container/id/id.go @@ -0,0 +1,95 @@ +package cid + +import ( + "bytes" + "crypto/sha256" + "errors" + + "github.com/mr-tron/base58" + "github.com/nspcc-dev/neofs-api-go/v2/refs" +) + +// ID represents v2-compatible container identifier. +type ID refs.ContainerID + +// NewFromV2 wraps v2 ContainerID message to ID. +func NewFromV2(idV2 *refs.ContainerID) *ID { + return (*ID)(idV2) +} + +// New creates and initializes blank ID. +func New() *ID { + return NewFromV2(new(refs.ContainerID)) +} + +// SetSHA256 sets container identifier value to SHA256 checksum. +func (id *ID) SetSHA256(v [sha256.Size]byte) { + (*refs.ContainerID)(id).SetValue(v[:]) +} + +// ToV2 returns the v2 container ID message. +func (id *ID) ToV2() *refs.ContainerID { + return (*refs.ContainerID)(id) +} + +// Equal returns true if identifiers are identical. +func (id *ID) Equal(id2 *ID) bool { + return bytes.Equal( + (*refs.ContainerID)(id).GetValue(), + (*refs.ContainerID)(id2).GetValue(), + ) +} + +// Parse parses string representation of ID. +// +// Returns error if s is not a base58 encoded +// ID data. +func (id *ID) Parse(s string) error { + data, err := base58.Decode(s) + if err != nil { + return err + } else if len(data) != sha256.Size { + return errors.New("incorrect format of the string container ID") + } + + (*refs.ContainerID)(id).SetValue(data) + + return nil +} + +// String returns base58 string representation of ID. +func (id *ID) String() string { + return base58.Encode((*refs.ContainerID)(id).GetValue()) +} + +// Marshal marshals ID into a protobuf binary form. +// +// Buffer is allocated when the argument is empty. +// Otherwise, the first buffer is used. +func (id *ID) Marshal(b ...[]byte) ([]byte, error) { + var buf []byte + if len(b) > 0 { + buf = b[0] + } + + return (*refs.ContainerID)(id). + StableMarshal(buf) +} + +// Unmarshal unmarshals protobuf binary representation of ID. +func (id *ID) Unmarshal(data []byte) error { + return (*refs.ContainerID)(id). + Unmarshal(data) +} + +// MarshalJSON encodes ID to protobuf JSON format. +func (id *ID) MarshalJSON() ([]byte, error) { + return (*refs.ContainerID)(id). + MarshalJSON() +} + +// UnmarshalJSON decodes ID from protobuf JSON format. +func (id *ID) UnmarshalJSON(data []byte) error { + return (*refs.ContainerID)(id). + UnmarshalJSON(data) +} diff --git a/pkg/container/id/id_test.go b/pkg/container/id/id_test.go new file mode 100644 index 0000000..3975519 --- /dev/null +++ b/pkg/container/id/id_test.go @@ -0,0 +1,73 @@ +package cid_test + +import ( + "crypto/sha256" + "math/rand" + "testing" + + cid "github.com/nspcc-dev/neofs-api-go/pkg/container/id" + cidtest "github.com/nspcc-dev/neofs-api-go/pkg/container/id/test" + "github.com/stretchr/testify/require" +) + +func randSHA256Checksum() (cs [sha256.Size]byte) { + rand.Read(cs[:]) + return +} + +func TestID_ToV2(t *testing.T) { + id := cid.New() + + checksum := randSHA256Checksum() + + id.SetSHA256(checksum) + + idV2 := id.ToV2() + + require.Equal(t, id, cid.NewFromV2(idV2)) +} + +func TestID_Equal(t *testing.T) { + cs := randSHA256Checksum() + + id1 := cidtest.GenerateWithChecksum(cs) + id2 := cidtest.GenerateWithChecksum(cs) + + require.True(t, id1.Equal(id2)) + + id3 := cidtest.Generate() + + require.False(t, id1.Equal(id3)) +} + +func TestID_String(t *testing.T) { + id := cidtest.Generate() + id2 := cid.New() + + require.NoError(t, id2.Parse(id.String())) + require.Equal(t, id, id2) +} + +func TestContainerIDEncoding(t *testing.T) { + id := cidtest.Generate() + + t.Run("binary", func(t *testing.T) { + data, err := id.Marshal() + require.NoError(t, err) + + id2 := cid.New() + require.NoError(t, id2.Unmarshal(data)) + + require.Equal(t, id, id2) + }) + + t.Run("json", func(t *testing.T) { + data, err := id.MarshalJSON() + require.NoError(t, err) + + a2 := cid.New() + require.NoError(t, a2.UnmarshalJSON(data)) + + require.Equal(t, id, a2) + }) +} diff --git a/pkg/container/id/test/id.go b/pkg/container/id/test/id.go new file mode 100644 index 0000000..58eca65 --- /dev/null +++ b/pkg/container/id/test/id.go @@ -0,0 +1,26 @@ +package cidtest + +import ( + "crypto/sha256" + "math/rand" + + cid "github.com/nspcc-dev/neofs-api-go/pkg/container/id" +) + +// Generate returns random cid.ID. +func Generate() *cid.ID { + checksum := [sha256.Size]byte{} + + rand.Read(checksum[:]) + + return GenerateWithChecksum(checksum) +} + +// GenerateWithChecksum returns cid.ID initialized +// with specified checksum. +func GenerateWithChecksum(cs [sha256.Size]byte) *cid.ID { + id := cid.New() + id.SetSHA256(cs) + + return id +} diff --git a/pkg/container/id_test.go b/pkg/container/id_test.go deleted file mode 100644 index 346a187..0000000 --- a/pkg/container/id_test.go +++ /dev/null @@ -1,117 +0,0 @@ -package container - -import ( - "crypto/rand" - "crypto/sha256" - "strconv" - "testing" - - "github.com/mr-tron/base58" - "github.com/stretchr/testify/require" -) - -func TestIDV2_0(t *testing.T) { - cid := NewID() - - checksum := [sha256.Size]byte{} - - _, err := rand.Read(checksum[:]) - require.NoError(t, err) - - cid.SetSHA256(checksum) - - cidV2 := cid.ToV2() - - require.Equal(t, checksum[:], cidV2.GetValue()) -} - -func randSHA256Checksum(t *testing.T) (cs [sha256.Size]byte) { - _, err := rand.Read(cs[:]) - require.NoError(t, err) - - return -} - -func TestID_Equal(t *testing.T) { - cs := randSHA256Checksum(t) - - id1 := NewID() - id1.SetSHA256(cs) - - id2 := NewID() - id2.SetSHA256(cs) - - id3 := NewID() - id3.SetSHA256(randSHA256Checksum(t)) - - require.True(t, id1.Equal(id2)) - require.False(t, id1.Equal(id3)) -} - -func TestID_Parse(t *testing.T) { - t.Run("should parse successful", func(t *testing.T) { - for i := 0; i < 10; i++ { - t.Run(strconv.Itoa(i), func(t *testing.T) { - cs := randSHA256Checksum(t) - str := base58.Encode(cs[:]) - cid := NewID() - - require.NoError(t, cid.Parse(str)) - require.Equal(t, cs[:], cid.ToV2().GetValue()) - }) - } - }) - - t.Run("should failure on parse", func(t *testing.T) { - for i := 0; i < 10; i++ { - j := i - t.Run(strconv.Itoa(j), func(t *testing.T) { - cs := []byte{1, 2, 3, 4, 5, byte(j)} - str := base58.Encode(cs) - cid := NewID() - - require.Error(t, cid.Parse(str)) - }) - } - }) -} - -func TestID_String(t *testing.T) { - t.Run("should be equal", func(t *testing.T) { - for i := 0; i < 10; i++ { - t.Run(strconv.Itoa(i), func(t *testing.T) { - cs := randSHA256Checksum(t) - str := base58.Encode(cs[:]) - cid := NewID() - - require.NoError(t, cid.Parse(str)) - require.Equal(t, str, cid.String()) - }) - } - }) -} - -func TestContainerIDEncoding(t *testing.T) { - id := NewID() - id.SetSHA256(randSHA256Checksum(t)) - - t.Run("binary", func(t *testing.T) { - data, err := id.Marshal() - require.NoError(t, err) - - id2 := NewID() - require.NoError(t, id2.Unmarshal(data)) - - require.Equal(t, id, id2) - }) - - t.Run("json", func(t *testing.T) { - data, err := id.MarshalJSON() - require.NoError(t, err) - - a2 := NewID() - require.NoError(t, a2.UnmarshalJSON(data)) - - require.Equal(t, id, a2) - }) -} From f60f7e0cdbaa5dca59985c6aff61332f8bd4e1f1 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 24 May 2021 19:42:36 +0300 Subject: [PATCH 0745/1196] [#283] pkg/eacl: Remove usage of deprecated container ID from src files Signed-off-by: Leonard Lyubich --- pkg/acl/eacl/record.go | 4 ++-- pkg/acl/eacl/table.go | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/pkg/acl/eacl/record.go b/pkg/acl/eacl/record.go index fec9d50..9b9e718 100644 --- a/pkg/acl/eacl/record.go +++ b/pkg/acl/eacl/record.go @@ -5,7 +5,7 @@ import ( "fmt" "github.com/nspcc-dev/neofs-api-go/pkg" - "github.com/nspcc-dev/neofs-api-go/pkg/container" + cid "github.com/nspcc-dev/neofs-api-go/pkg/container/id" "github.com/nspcc-dev/neofs-api-go/pkg/owner" v2acl "github.com/nspcc-dev/neofs-api-go/v2/acl" ) @@ -116,7 +116,7 @@ func (r *Record) AddObjectVersionFilter(m Match, v *pkg.Version) { } // AddObjectContainerIDFilter adds filter by object container ID. -func (r *Record) AddObjectContainerIDFilter(m Match, id *container.ID) { +func (r *Record) AddObjectContainerIDFilter(m Match, id *cid.ID) { r.addObjectReservedFilter(m, fKeyObjContainerID, id) } diff --git a/pkg/acl/eacl/table.go b/pkg/acl/eacl/table.go index 606d5b2..a317529 100644 --- a/pkg/acl/eacl/table.go +++ b/pkg/acl/eacl/table.go @@ -4,7 +4,7 @@ import ( "crypto/sha256" "github.com/nspcc-dev/neofs-api-go/pkg" - "github.com/nspcc-dev/neofs-api-go/pkg/container" + cid "github.com/nspcc-dev/neofs-api-go/pkg/container/id" v2acl "github.com/nspcc-dev/neofs-api-go/v2/acl" ) @@ -13,17 +13,17 @@ import ( // Table is compatible with v2 acl.EACLTable message. type Table struct { version pkg.Version - cid *container.ID + cid *cid.ID records []*Record } // CID returns identifier of the container that should use given access control rules. -func (t Table) CID() *container.ID { +func (t Table) CID() *cid.ID { return t.cid } // SetCID sets identifier of the container that should use given access control rules. -func (t *Table) SetCID(cid *container.ID) { +func (t *Table) SetCID(cid *cid.ID) { t.cid = cid } @@ -77,7 +77,7 @@ func NewTable() *Table { } // CreateTable creates, initializes with parameters and returns Table instance. -func CreateTable(cid container.ID) *Table { +func CreateTable(cid cid.ID) *Table { t := NewTable() t.SetCID(&cid) @@ -102,14 +102,14 @@ func NewTableFromV2(table *v2acl.Table) *Table { } // set container id - if cid := table.GetContainerID(); cid != nil { + if id := table.GetContainerID(); id != nil { if t.cid == nil { - t.cid = new(container.ID) + t.cid = new(cid.ID) } var h [sha256.Size]byte - copy(h[:], table.GetContainerID().GetValue()) + copy(h[:], id.GetValue()) t.cid.SetSHA256(h) } From fcbe0bbd2e31039e34be3d7b385da71f4abc20a1 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 24 May 2021 19:48:41 +0300 Subject: [PATCH 0746/1196] [#283] pkg/container: Add session token and signature to Container Container can be created within a session, and should be signed. Add `SessionToken` / `SetSessionToken` (`Signature` / `SetSignature`) methods to carry session token (signature) in `Container` structure. Signed-off-by: Leonard Lyubich --- pkg/container/container.go | 27 +++++++++++++++++++++++++++ pkg/container/container_test.go | 23 +++++++++++++++++++++++ 2 files changed, 50 insertions(+) diff --git a/pkg/container/container.go b/pkg/container/container.go index f4a52a1..f758d1c 100644 --- a/pkg/container/container.go +++ b/pkg/container/container.go @@ -7,11 +7,16 @@ import ( "github.com/nspcc-dev/neofs-api-go/pkg" "github.com/nspcc-dev/neofs-api-go/pkg/netmap" "github.com/nspcc-dev/neofs-api-go/pkg/owner" + "github.com/nspcc-dev/neofs-api-go/pkg/token" "github.com/nspcc-dev/neofs-api-go/v2/container" ) type Container struct { v2 container.Container + + token *token.SessionToken + + sig *pkg.Signature } func New(opts ...NewOption) *Container { @@ -152,6 +157,28 @@ func (c *Container) SetPlacementPolicy(v *netmap.PlacementPolicy) { c.v2.SetPlacementPolicy(v.ToV2()) } +// SessionToken returns token of the session within +// which container was created. +func (c Container) SessionToken() *token.SessionToken { + return c.token +} + +// SetSessionToken sets token of the session within +// which container was created. +func (c *Container) SetSessionToken(t *token.SessionToken) { + c.token = t +} + +// Signature returns signature of the marshaled container. +func (c Container) Signature() *pkg.Signature { + return c.sig +} + +// SetSignature sets signature of the marshaled container. +func (c *Container) SetSignature(sig *pkg.Signature) { + c.sig = sig +} + // Marshal marshals Container into a protobuf binary form. // // Buffer is allocated when the argument is empty. diff --git a/pkg/container/container_test.go b/pkg/container/container_test.go index f4739ab..d1fb7bd 100644 --- a/pkg/container/container_test.go +++ b/pkg/container/container_test.go @@ -10,6 +10,7 @@ import ( "github.com/nspcc-dev/neofs-api-go/pkg/container" "github.com/nspcc-dev/neofs-api-go/pkg/netmap" "github.com/nspcc-dev/neofs-api-go/pkg/owner" + "github.com/nspcc-dev/neofs-api-go/pkg/token" "github.com/nspcc-dev/neofs-crypto/test" "github.com/stretchr/testify/require" ) @@ -95,3 +96,25 @@ func TestContainerEncoding(t *testing.T) { require.Equal(t, c, c2) }) } + +func TestContainer_SessionToken(t *testing.T) { + tok := token.NewSessionToken() + tok.SetID([]byte{1, 2, 3}) + + cnr := container.New() + + cnr.SetSessionToken(tok) + + require.Equal(t, tok, cnr.SessionToken()) +} + +func TestContainer_Signature(t *testing.T) { + sig := pkg.NewSignature() + sig.SetKey([]byte{1, 2, 3}) + sig.SetSign([]byte{4, 5, 6}) + + cnr := container.New() + cnr.SetSignature(sig) + + require.Equal(t, sig, cnr.Signature()) +} From 37b415347d8ffa597b73b1c850ea7e34168591c3 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 24 May 2021 20:34:56 +0300 Subject: [PATCH 0747/1196] [#283] pkg/token: Replace SessionToken into a session package There is a need to add session token to `eacl.Table` structure. To do this, we need to replace `token.SessionToken` type to another package since `eacl` package imports `token` one (potential cross-import). Create `pkg/session` package and replace session token implementation to it. Related API in `container` package is deprecated from now. Additionally implement test generator of random session tokens. Signed-off-by: Leonard Lyubich --- pkg/container/container.go | 8 +-- pkg/session/session.go | 125 +++++++++++++++++++++++++++++++++++ pkg/session/session_test.go | 68 +++++++++++++++++++ pkg/session/test/token.go | 35 ++++++++++ pkg/token/session.go | 128 ++++-------------------------------- 5 files changed, 246 insertions(+), 118 deletions(-) create mode 100644 pkg/session/session.go create mode 100644 pkg/session/session_test.go create mode 100644 pkg/session/test/token.go diff --git a/pkg/container/container.go b/pkg/container/container.go index f758d1c..5b07a55 100644 --- a/pkg/container/container.go +++ b/pkg/container/container.go @@ -7,14 +7,14 @@ import ( "github.com/nspcc-dev/neofs-api-go/pkg" "github.com/nspcc-dev/neofs-api-go/pkg/netmap" "github.com/nspcc-dev/neofs-api-go/pkg/owner" - "github.com/nspcc-dev/neofs-api-go/pkg/token" + "github.com/nspcc-dev/neofs-api-go/pkg/session" "github.com/nspcc-dev/neofs-api-go/v2/container" ) type Container struct { v2 container.Container - token *token.SessionToken + token *session.Token sig *pkg.Signature } @@ -159,13 +159,13 @@ func (c *Container) SetPlacementPolicy(v *netmap.PlacementPolicy) { // SessionToken returns token of the session within // which container was created. -func (c Container) SessionToken() *token.SessionToken { +func (c Container) SessionToken() *session.Token { return c.token } // SetSessionToken sets token of the session within // which container was created. -func (c *Container) SetSessionToken(t *token.SessionToken) { +func (c *Container) SetSessionToken(t *session.Token) { c.token = t } diff --git a/pkg/session/session.go b/pkg/session/session.go new file mode 100644 index 0000000..b11a058 --- /dev/null +++ b/pkg/session/session.go @@ -0,0 +1,125 @@ +package session + +import ( + "github.com/nspcc-dev/neofs-api-go/pkg" + "github.com/nspcc-dev/neofs-api-go/pkg/owner" + "github.com/nspcc-dev/neofs-api-go/v2/session" +) + +// Token represents NeoFS API v2-compatible +// session token. +type Token session.SessionToken + +// NewTokenFromV2 wraps session.SessionToken message structure +// into Token. +func NewTokenFromV2(tV2 *session.SessionToken) *Token { + return (*Token)(tV2) +} + +// NewToken creates and returns blank Token. +func NewToken() *Token { + return NewTokenFromV2(new(session.SessionToken)) +} + +// ToV2 converts Token to session.SessionToken message structure. +func (t *Token) ToV2() *session.SessionToken { + return (*session.SessionToken)(t) +} + +func (t *Token) setBodyField(setter func(*session.SessionTokenBody)) { + token := (*session.SessionToken)(t) + body := token.GetBody() + + if body == nil { + body = new(session.SessionTokenBody) + token.SetBody(body) + } + + setter(body) +} + +// ID returns Token identifier. +func (t *Token) ID() []byte { + return (*session.SessionToken)(t). + GetBody(). + GetID() +} + +// SetID sets Token identifier. +func (t *Token) SetID(v []byte) { + t.setBodyField(func(body *session.SessionTokenBody) { + body.SetID(v) + }) +} + +// OwnerID returns Token's owner identifier. +func (t *Token) OwnerID() *owner.ID { + return owner.NewIDFromV2( + (*session.SessionToken)(t). + GetBody(). + GetOwnerID(), + ) +} + +// SetOwnerID sets Token's owner identifier. +func (t *Token) SetOwnerID(v *owner.ID) { + t.setBodyField(func(body *session.SessionTokenBody) { + body.SetOwnerID(v.ToV2()) + }) +} + +// SessionKey returns public key of the session +// in a binary format. +func (t *Token) SessionKey() []byte { + return (*session.SessionToken)(t). + GetBody(). + GetSessionKey() +} + +// SetSessionKey sets public key of the session +// // in a binary format. +func (t *Token) SetSessionKey(v []byte) { + t.setBodyField(func(body *session.SessionTokenBody) { + body.SetSessionKey(v) + }) +} + +// Signature returns Token signature. +func (t *Token) Signature() *pkg.Signature { + return pkg.NewSignatureFromV2( + (*session.SessionToken)(t). + GetSignature(), + ) +} + +// Marshal marshals Token into a protobuf binary form. +// +// Buffer is allocated when the argument is empty. +// Otherwise, the first buffer is used. +func (t *Token) Marshal(bs ...[]byte) ([]byte, error) { + var buf []byte + if len(bs) > 0 { + buf = bs[0] + } + + return (*session.SessionToken)(t). + StableMarshal(buf) +} + +// Unmarshal unmarshals protobuf binary representation of Token. +func (t *Token) Unmarshal(data []byte) error { + return (*session.SessionToken)(t). + Unmarshal(data) +} + +// MarshalJSON encodes Token to protobuf JSON format. +func (t *Token) MarshalJSON() ([]byte, error) { + return (*session.SessionToken)(t). + MarshalJSON() +} + +// UnmarshalJSON decodes Token from protobuf JSON format. +func (t *Token) UnmarshalJSON(data []byte) error { + return (*session.SessionToken)(t). + UnmarshalJSON(data) +} diff --git a/pkg/session/session_test.go b/pkg/session/session_test.go new file mode 100644 index 0000000..9105869 --- /dev/null +++ b/pkg/session/session_test.go @@ -0,0 +1,68 @@ +package session_test + +import ( + "crypto/rand" + "testing" + + "github.com/nspcc-dev/neofs-api-go/pkg/owner" + "github.com/nspcc-dev/neofs-api-go/pkg/session" + sessiontest "github.com/nspcc-dev/neofs-api-go/pkg/session/test" + "github.com/stretchr/testify/require" +) + +func TestSessionToken_SetID(t *testing.T) { + token := session.NewToken() + + id := []byte{1, 2, 3} + token.SetID(id) + + require.Equal(t, id, token.ID()) +} + +func TestSessionToken_SetOwnerID(t *testing.T) { + token := session.NewToken() + + w := new(owner.NEO3Wallet) + _, err := rand.Read(w.Bytes()) + require.NoError(t, err) + + ownerID := owner.NewID() + ownerID.SetNeo3Wallet(w) + + token.SetOwnerID(ownerID) + + require.Equal(t, ownerID, token.OwnerID()) +} + +func TestSessionToken_SetSessionKey(t *testing.T) { + token := session.NewToken() + + key := []byte{1, 2, 3} + token.SetSessionKey(key) + + require.Equal(t, key, token.SessionKey()) +} + +func TestSessionTokenEncoding(t *testing.T) { + tok := sessiontest.Generate() + + t.Run("binary", func(t *testing.T) { + data, err := tok.Marshal() + require.NoError(t, err) + + tok2 := session.NewToken() + require.NoError(t, tok2.Unmarshal(data)) + + require.Equal(t, tok, tok2) + }) + + t.Run("json", func(t *testing.T) { + data, err := tok.MarshalJSON() + require.NoError(t, err) + + tok2 := session.NewToken() + require.NoError(t, tok2.UnmarshalJSON(data)) + + require.Equal(t, tok, tok2) + }) +} diff --git a/pkg/session/test/token.go b/pkg/session/test/token.go new file mode 100644 index 0000000..3924984 --- /dev/null +++ b/pkg/session/test/token.go @@ -0,0 +1,35 @@ +package sessiontest + +import ( + "math/rand" + + "github.com/google/uuid" + "github.com/nspcc-dev/neofs-api-go/pkg/owner" + "github.com/nspcc-dev/neofs-api-go/pkg/session" + crypto "github.com/nspcc-dev/neofs-crypto" + "github.com/nspcc-dev/neofs-crypto/test" +) + +// Generate returns random session.Token. +func Generate() *session.Token { + tok := session.NewToken() + + uid, err := uuid.New().MarshalBinary() + if err != nil { + panic(err) + } + + w := new(owner.NEO3Wallet) + rand.Read(w.Bytes()) + + ownerID := owner.NewID() + ownerID.SetNeo3Wallet(w) + + keyBin := crypto.MarshalPublicKey(&test.DecodeKey(0).PublicKey) + + tok.SetID(uid) + tok.SetOwnerID(ownerID) + tok.SetSessionKey(keyBin) + + return tok +} diff --git a/pkg/token/session.go b/pkg/token/session.go index 834110b..5c8e8a7 100644 --- a/pkg/token/session.go +++ b/pkg/token/session.go @@ -1,122 +1,22 @@ package token import ( - "github.com/nspcc-dev/neofs-api-go/pkg" - "github.com/nspcc-dev/neofs-api-go/pkg/owner" - "github.com/nspcc-dev/neofs-api-go/v2/session" + "github.com/nspcc-dev/neofs-api-go/pkg/session" ) -type SessionToken session.SessionToken - -func NewSessionTokenFromV2(tV2 *session.SessionToken) *SessionToken { - return (*SessionToken)(tV2) -} - -func NewSessionToken() *SessionToken { - return NewSessionTokenFromV2(new(session.SessionToken)) -} - -func (t *SessionToken) ToV2() *session.SessionToken { - return (*session.SessionToken)(t) -} - -func (t *SessionToken) setBodyField(setter func(*session.SessionTokenBody)) { - token := (*session.SessionToken)(t) - body := token.GetBody() - - if body == nil { - body = new(session.SessionTokenBody) - token.SetBody(body) - } - - setter(body) -} - -func (t *SessionToken) ID() []byte { - return (*session.SessionToken)(t). - GetBody(). - GetID() -} - -func (t *SessionToken) SetID(v []byte) { - t.setBodyField(func(body *session.SessionTokenBody) { - body.SetID(v) - }) -} - -func (t *SessionToken) OwnerID() *owner.ID { - return owner.NewIDFromV2( - (*session.SessionToken)(t). - GetBody(). - GetOwnerID(), - ) -} - -func (t *SessionToken) SetOwnerID(v *owner.ID) { - t.setBodyField(func(body *session.SessionTokenBody) { - body.SetOwnerID(v.ToV2()) - }) -} - -func (t *SessionToken) SessionKey() []byte { - return (*session.SessionToken)(t). - GetBody(). - GetSessionKey() -} - -func (t *SessionToken) SetSessionKey(v []byte) { - t.setBodyField(func(body *session.SessionTokenBody) { - body.SetSessionKey(v) - }) -} - -func (t *SessionToken) Signature() *pkg.Signature { - return pkg.NewSignatureFromV2( - (*session.SessionToken)(t). - GetSignature(), - ) -} - -// Marshal marshals SessionToken into a protobuf binary form. +// SessionToken represents NeoFS API v2-compatible +// session token. // -// Buffer is allocated when the argument is empty. -// Otherwise, the first buffer is used. -func (t *SessionToken) Marshal(bs ...[]byte) ([]byte, error) { - var buf []byte - if len(bs) > 0 { - buf = bs[0] - } +// Deprecated: use session.Token instead +type SessionToken = session.Token - return (*session.SessionToken)(t). - StableMarshal(buf) -} +// NewSessionTokenFromV2 wraps session.SessionToken message structure +// into Token. +// +// Deprecated: use session.NewTokenFromV2 instead. +var NewSessionTokenFromV2 = session.NewTokenFromV2 -// Unmarshal unmarshals protobuf binary representation of SessionToken. -func (t *SessionToken) Unmarshal(data []byte) error { - tV2 := new(session.SessionToken) - if err := tV2.Unmarshal(data); err != nil { - return err - } - - *t = *NewSessionTokenFromV2(tV2) - - return nil -} - -// MarshalJSON encodes SessionToken to protobuf JSON format. -func (t *SessionToken) MarshalJSON() ([]byte, error) { - return (*session.SessionToken)(t). - MarshalJSON() -} - -// UnmarshalJSON decodes SessionToken from protobuf JSON format. -func (t *SessionToken) UnmarshalJSON(data []byte) error { - tV2 := new(session.SessionToken) - if err := tV2.UnmarshalJSON(data); err != nil { - return err - } - - *t = *NewSessionTokenFromV2(tV2) - - return nil -} +// NewSessionToken creates and returns blank session token. +// +// Deprecated: use session.NewToken instead. +var NewSessionToken = session.NewToken From 0719fcef59f9f7d1050e5c81ad7055d30789bbe4 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 24 May 2021 20:35:56 +0300 Subject: [PATCH 0748/1196] [#283] pkg/container: Add session token and signature to Table Extended ACL table can be set within a session, and should be signed. Add `SessionToken` / `SetSessionToken` (`Signature` / `SetSignature`) methods to carry session token (signature) in `Table` structure. Signed-off-by: Leonard Lyubich --- pkg/acl/eacl/table.go | 25 +++++++++++++++++++++++++ pkg/acl/eacl/table_test.go | 21 +++++++++++++++++++++ 2 files changed, 46 insertions(+) diff --git a/pkg/acl/eacl/table.go b/pkg/acl/eacl/table.go index a317529..99b6aad 100644 --- a/pkg/acl/eacl/table.go +++ b/pkg/acl/eacl/table.go @@ -5,6 +5,7 @@ import ( "github.com/nspcc-dev/neofs-api-go/pkg" cid "github.com/nspcc-dev/neofs-api-go/pkg/container/id" + "github.com/nspcc-dev/neofs-api-go/pkg/session" v2acl "github.com/nspcc-dev/neofs-api-go/v2/acl" ) @@ -14,6 +15,8 @@ import ( type Table struct { version pkg.Version cid *cid.ID + token *session.Token + sig *pkg.Signature records []*Record } @@ -49,6 +52,28 @@ func (t *Table) AddRecord(r *Record) { } } +// SessionToken returns token of the session +// within which Table was set. +func (t Table) SessionToken() *session.Token { + return t.token +} + +// SetSessionToken sets token of the session +// within which Table was set. +func (t *Table) SetSessionToken(tok *session.Token) { + t.token = tok +} + +// Signature returns Table signature. +func (t Table) Signature() *pkg.Signature { + return t.sig +} + +// SetSignature sets Table signature. +func (t *Table) SetSignature(sig *pkg.Signature) { + t.sig = sig +} + // ToV2 converts Table to v2 acl.EACLTable message. func (t *Table) ToV2() *v2acl.Table { v2 := new(v2acl.Table) diff --git a/pkg/acl/eacl/table_test.go b/pkg/acl/eacl/table_test.go index 7092aea..ec28efe 100644 --- a/pkg/acl/eacl/table_test.go +++ b/pkg/acl/eacl/table_test.go @@ -7,6 +7,7 @@ import ( "github.com/nspcc-dev/neofs-api-go/pkg" "github.com/nspcc-dev/neofs-api-go/pkg/acl/eacl" "github.com/nspcc-dev/neofs-api-go/pkg/container" + sessiontest "github.com/nspcc-dev/neofs-api-go/pkg/session/test" "github.com/stretchr/testify/require" ) @@ -91,3 +92,23 @@ func TestRecordEncoding(t *testing.T) { require.Equal(t, tab, r2) }) } + +func TestTable_SessionToken(t *testing.T) { + tok := sessiontest.Generate() + + table := eacl.NewTable() + table.SetSessionToken(tok) + + require.Equal(t, tok, table.SessionToken()) +} + +func TestTable_Signature(t *testing.T) { + sig := pkg.NewSignature() + sig.SetKey([]byte{1, 2, 3}) + sig.SetSign([]byte{4, 5, 6}) + + table := eacl.NewTable() + table.SetSignature(sig) + + require.Equal(t, sig, table.Signature()) +} From dac997b8c303beeff46b85bcdf9124aa2e764bcb Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 24 May 2021 21:14:35 +0300 Subject: [PATCH 0749/1196] [#283] v2/container/grpc: Implement setters of new fields Implement `SetSessionToken` / `SetSignature` setters on `GetResponse_Body`. Implement `SetSessionToken` setter on `GetExtendedACLResponse_Body`. Signed-off-by: Leonard Lyubich --- v2/container/grpc/service.go | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/v2/container/grpc/service.go b/v2/container/grpc/service.go index 644ca3a..6aa854b 100644 --- a/v2/container/grpc/service.go +++ b/v2/container/grpc/service.go @@ -158,6 +158,21 @@ func (m *GetResponse_Body) SetContainer(v *Container) { } } +// SetSessionToken sets token of the session within which requested +// container was created. +func (m *GetResponse_Body) SetSessionToken(v *session.SessionToken) { + if m != nil { + m.SessionToken = v + } +} + +// SetSignature sets signature of the requested container. +func (m *GetResponse_Body) SetSignature(v *refs.Signature) { + if m != nil { + m.Signature = v + } +} + // SetBody sets body of the response. func (m *GetResponse) SetBody(v *GetResponse_Body) { if m != nil { @@ -333,6 +348,14 @@ func (m *GetExtendedACLResponse_Body) SetSignature(v *refs.Signature) { } } +// SetSessionToken sets token of the session within which requested +// eACl table was set. +func (m *GetExtendedACLResponse_Body) SetSessionToken(v *session.SessionToken) { + if m != nil { + m.SessionToken = v + } +} + // SetBody sets body of the response. func (m *GetExtendedACLResponse) SetBody(v *GetExtendedACLResponse_Body) { if m != nil { From 92e8376f39aae298eb84cfe5d39cb312142a1ef4 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 24 May 2021 21:18:56 +0300 Subject: [PATCH 0750/1196] [#283] v2/container: Add session token and signature to response bodies Add field of type `session.SessionToken` to `GetResponseBody` and `GetExtendedACLResponseBody` messages. Add field of type `refs,Signature` to `GetResponseBody` message. Change the implementation of all related methods. Signed-off-by: Leonard Lyubich --- v2/container/convert.go | 38 +++++++++++++++++++++++++++ v2/container/marshal.go | 27 +++++++++++++++++-- v2/container/types.go | 58 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 121 insertions(+), 2 deletions(-) diff --git a/v2/container/convert.go b/v2/container/convert.go index 5ef3fed..be0bb10 100644 --- a/v2/container/convert.go +++ b/v2/container/convert.go @@ -10,6 +10,8 @@ import ( netmapGRPC "github.com/nspcc-dev/neofs-api-go/v2/netmap/grpc" "github.com/nspcc-dev/neofs-api-go/v2/refs" refsGRPC "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" + "github.com/nspcc-dev/neofs-api-go/v2/session" + sessionGRPC "github.com/nspcc-dev/neofs-api-go/v2/session/grpc" ) func (a *Attribute) ToGRPCMessage() grpc.Message { @@ -388,6 +390,8 @@ func (r *GetResponseBody) ToGRPCMessage() grpc.Message { m = new(container.GetResponse_Body) m.SetContainer(r.cnr.ToGRPCMessage().(*container.Container)) + m.SetSessionToken(r.token.ToGRPCMessage().(*sessionGRPC.SessionToken)) + m.SetSignature(r.sig.ToGRPCMessage().(*refsGRPC.Signature)) } return m @@ -412,6 +416,28 @@ func (r *GetResponseBody) FromGRPCMessage(m grpc.Message) error { err = r.cnr.FromGRPCMessage(cnr) } + sig := v.GetSignature() + if sig == nil { + r.sig = nil + } else { + if r.sig == nil { + r.sig = new(refs.Signature) + } + + err = r.sig.FromGRPCMessage(sig) + } + + token := v.GetSessionToken() + if token == nil { + r.token = nil + } else { + if r.token == nil { + r.token = new(session.SessionToken) + } + + err = r.token.FromGRPCMessage(token) + } + return err } @@ -956,6 +982,7 @@ func (r *GetExtendedACLResponseBody) ToGRPCMessage() grpc.Message { m.SetEacl(r.eacl.ToGRPCMessage().(*aclGRPC.EACLTable)) m.SetSignature(r.sig.ToGRPCMessage().(*refsGRPC.Signature)) + m.SetSessionToken(r.token.ToGRPCMessage().(*sessionGRPC.SessionToken)) } return m @@ -994,6 +1021,17 @@ func (r *GetExtendedACLResponseBody) FromGRPCMessage(m grpc.Message) error { err = r.sig.FromGRPCMessage(sig) } + token := v.GetSessionToken() + if token == nil { + r.token = nil + } else { + if r.token == nil { + r.token = new(session.SessionToken) + } + + err = r.token.FromGRPCMessage(token) + } + return err } diff --git a/v2/container/marshal.go b/v2/container/marshal.go index 3c0af3e..a53661d 100644 --- a/v2/container/marshal.go +++ b/v2/container/marshal.go @@ -28,6 +28,8 @@ const ( getReqBodyIDField = 1 getRespBodyContainerField = 1 + getRespBodySignatureField = 2 + getRespBodyTokenField = 3 listReqBodyOwnerField = 1 @@ -40,6 +42,7 @@ const ( getEACLRespBodyTableField = 1 getEACLRespBodySignatureField = 2 + getEACLRespBodyTokenField = 3 usedSpaceAnnounceEpochField = 1 usedSpaceAnnounceCIDField = 2 @@ -349,7 +352,17 @@ func (r *GetResponseBody) StableMarshal(buf []byte) ([]byte, error) { buf = make([]byte, r.StableSize()) } - _, err := protoutil.NestedStructureMarshal(getRespBodyContainerField, buf, r.cnr) + offset, err := protoutil.NestedStructureMarshal(getRespBodyContainerField, buf, r.cnr) + if err != nil { + return nil, err + } + + n, err := protoutil.NestedStructureMarshal(getRespBodySignatureField, buf[offset:], r.sig) + if err != nil { + return nil, err + } + + _, err = protoutil.NestedStructureMarshal(getRespBodyTokenField, buf[offset+n:], r.token) if err != nil { return nil, err } @@ -363,6 +376,8 @@ func (r *GetResponseBody) StableSize() (size int) { } size += protoutil.NestedStructureSize(getRespBodyContainerField, r.cnr) + size += protoutil.NestedStructureSize(getRespBodySignatureField, r.sig) + size += protoutil.NestedStructureSize(getRespBodyTokenField, r.token) return size } @@ -552,7 +567,14 @@ func (r *GetExtendedACLResponseBody) StableMarshal(buf []byte) ([]byte, error) { offset += n - _, err = protoutil.NestedStructureMarshal(getEACLRespBodySignatureField, buf[offset:], r.sig) + n, err = protoutil.NestedStructureMarshal(getEACLRespBodySignatureField, buf[offset:], r.sig) + if err != nil { + return nil, err + } + + offset += n + + _, err = protoutil.NestedStructureMarshal(getEACLRespBodyTokenField, buf[offset:], r.token) if err != nil { return nil, err } @@ -567,6 +589,7 @@ func (r *GetExtendedACLResponseBody) StableSize() (size int) { size += protoutil.NestedStructureSize(getEACLRespBodyTableField, r.eacl) size += protoutil.NestedStructureSize(getEACLRespBodySignatureField, r.sig) + size += protoutil.NestedStructureSize(getEACLRespBodyTokenField, r.token) return size } diff --git a/v2/container/types.go b/v2/container/types.go index a790f03..63449ef 100644 --- a/v2/container/types.go +++ b/v2/container/types.go @@ -58,6 +58,10 @@ type GetRequest struct { type GetResponseBody struct { cnr *Container + + token *session.SessionToken + + sig *refs.Signature } type GetResponse struct { @@ -140,6 +144,8 @@ type GetExtendedACLResponseBody struct { eacl *acl.Table sig *refs.Signature + + token *session.SessionToken } type GetExtendedACLResponse struct { @@ -398,6 +404,40 @@ func (r *GetResponseBody) SetContainer(v *Container) { } } +// GetSessionToken returns token of the session within which requested +// container was created. +func (r *GetResponseBody) GetSessionToken() *session.SessionToken { + if r != nil { + return r.token + } + + return nil +} + +// SetSessionToken sets token of the session within which requested +// container was created. +func (r *GetResponseBody) SetSessionToken(v *session.SessionToken) { + if r != nil { + r.token = v + } +} + +// GetSignature returns signature of the requested container. +func (r *GetResponseBody) GetSignature() *refs.Signature { + if r != nil { + return r.sig + } + + return nil +} + +// SetSignature sets signature of the requested container. +func (r *GetResponseBody) SetSignature(v *refs.Signature) { + if r != nil { + r.sig = v + } +} + func (r *GetResponse) GetBody() *GetResponseBody { if r != nil { return r.body @@ -636,6 +676,24 @@ func (r *GetExtendedACLResponseBody) SetSignature(v *refs.Signature) { } } +// GetSessionToken returns token of the session within which requested +// eACL table was set. +func (r *GetExtendedACLResponseBody) GetSessionToken() *session.SessionToken { + if r != nil { + return r.token + } + + return nil +} + +// SetSessionToken sets token of the session within which requested +// eACL table was set. +func (r *GetExtendedACLResponseBody) SetSessionToken(v *session.SessionToken) { + if r != nil { + r.token = v + } +} + func (r *GetExtendedACLResponse) GetBody() *GetExtendedACLResponseBody { if r != nil { return r.body From a4cf8df8295958e3a6bdc58f95681b78bd332734 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 24 May 2021 21:19:25 +0300 Subject: [PATCH 0751/1196] [#283] v2/container: Add missing testing of eACL-related messages Signed-off-by: Leonard Lyubich --- v2/container/message_test.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/v2/container/message_test.go b/v2/container/message_test.go index 592fcbe..9d2786b 100644 --- a/v2/container/message_test.go +++ b/v2/container/message_test.go @@ -34,6 +34,10 @@ func TestMessageConvert(t *testing.T) { func(empty bool) message.Message { return containertest.GenerateGetRequest(empty) }, func(empty bool) message.Message { return containertest.GenerateGetResponseBody(empty) }, func(empty bool) message.Message { return containertest.GenerateGetResponse(empty) }, + func(empty bool) message.Message { return containertest.GenerateGetExtendedACLRequestBody(empty) }, + func(empty bool) message.Message { return containertest.GenerateGetExtendedACLRequest(empty) }, + func(empty bool) message.Message { return containertest.GenerateGetExtendedACLResponseBody(empty) }, + func(empty bool) message.Message { return containertest.GenerateGetExtendedACLResponse(empty) }, func(empty bool) message.Message { return containertest.GenerateUsedSpaceAnnouncement(empty) }, func(empty bool) message.Message { return containertest.GenerateAnnounceUsedSpaceRequestBody(empty) }, func(empty bool) message.Message { return containertest.GenerateAnnounceUsedSpaceRequest(empty) }, From d8f85e80c9352c8db5de8f20db9109e921f27798 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 24 May 2021 21:20:23 +0300 Subject: [PATCH 0752/1196] [#283] v2/container/test: Add setting of new fields in generators Set signature and session token in `GenerateGetResponseBody`. Set session token in `GenerateGetExtendedACLResponseBody`. Signed-off-by: Leonard Lyubich --- v2/container/test/generate.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/v2/container/test/generate.go b/v2/container/test/generate.go index 032bde7..07098c3 100644 --- a/v2/container/test/generate.go +++ b/v2/container/test/generate.go @@ -105,6 +105,8 @@ func GenerateGetResponseBody(empty bool) *container.GetResponseBody { m := new(container.GetResponseBody) m.SetContainer(GenerateContainer(empty)) + m.SetSignature(refstest.GenerateSignature(empty)) + m.SetSessionToken(sessiontest.GenerateSessionToken(empty)) return m } @@ -248,6 +250,7 @@ func GenerateGetExtendedACLResponseBody(empty bool) *container.GetExtendedACLRes m.SetEACL(acltest.GenerateTable(empty)) m.SetSignature(refstest.GenerateSignature(empty)) + m.SetSessionToken(sessiontest.GenerateSessionToken(empty)) return m } From ddccfe00723755d65ddd18f99dc97bd9a0499b70 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 24 May 2021 21:45:51 +0300 Subject: [PATCH 0753/1196] [#283] client/container: Attach container session token to request Write session token of `container.Container` to container PUT request body during `client.PutContainer` call. Signed-off-by: Leonard Lyubich --- pkg/client/container.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/client/container.go b/pkg/client/container.go index 98d9740..369fc59 100644 --- a/pkg/client/container.go +++ b/pkg/client/container.go @@ -112,7 +112,11 @@ func (c *clientImpl) PutContainer(ctx context.Context, cnr *container.Container, req := new(v2container.PutRequest) req.SetBody(reqBody) - req.SetMetaHeader(v2MetaHeaderFromOpts(callOptions)) + + meta := v2MetaHeaderFromOpts(callOptions) + meta.SetSessionToken(cnr.SessionToken().ToV2()) + + req.SetMetaHeader(meta) err = v2signature.SignServiceMessage(callOptions.key, req) if err != nil { From 396210409d6e297203f60fee6f76104ee0e477ba Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 24 May 2021 21:48:30 +0300 Subject: [PATCH 0754/1196] [#283] client/container: Write new fields to container in GetContainer Call `SetSessionToken` and `SetSignature` methods on resulting container with items from response body. Signed-off-by: Leonard Lyubich --- pkg/client/container.go | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/pkg/client/container.go b/pkg/client/container.go index 369fc59..f0888df 100644 --- a/pkg/client/container.go +++ b/pkg/client/container.go @@ -9,6 +9,7 @@ import ( "github.com/nspcc-dev/neofs-api-go/pkg/acl/eacl" "github.com/nspcc-dev/neofs-api-go/pkg/container" "github.com/nspcc-dev/neofs-api-go/pkg/owner" + "github.com/nspcc-dev/neofs-api-go/pkg/session" "github.com/nspcc-dev/neofs-api-go/rpc/client" "github.com/nspcc-dev/neofs-api-go/util/signature" v2container "github.com/nspcc-dev/neofs-api-go/v2/container" @@ -169,7 +170,22 @@ func (c *clientImpl) GetContainer(ctx context.Context, id *container.ID, opts .. return nil, fmt.Errorf("can't verify response message: %w", err) } - return container.NewVerifiedFromV2(resp.GetBody().GetContainer()) + body := resp.GetBody() + + cnr, err := container.NewVerifiedFromV2(body.GetContainer()) + if err != nil { + return nil, err + } + + cnr.SetSessionToken( + session.NewTokenFromV2(body.GetSessionToken()), + ) + + cnr.SetSignature( + pkg.NewSignatureFromV2(body.GetSignature()), + ) + + return cnr, nil } // GetVerifiedContainerStructure is a wrapper over Client.GetContainer method From ad6b5aa8a9d3c96b5ab1696d3d468a2f122486a8 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 24 May 2021 21:49:40 +0300 Subject: [PATCH 0755/1196] [#283] client/container: Attach container session token to request Write session token of `container.Container` to container SetExtendedACL request body inside `client.SetEACL` call. Signed-off-by: Leonard Lyubich --- pkg/client/container.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/client/container.go b/pkg/client/container.go index f0888df..7e3a25e 100644 --- a/pkg/client/container.go +++ b/pkg/client/container.go @@ -365,7 +365,11 @@ func (c *clientImpl) SetEACL(ctx context.Context, eacl *eacl.Table, opts ...Call req := new(v2container.SetExtendedACLRequest) req.SetBody(reqBody) - req.SetMetaHeader(v2MetaHeaderFromOpts(callOptions)) + + meta := v2MetaHeaderFromOpts(callOptions) + meta.SetSessionToken(eacl.SessionToken().ToV2()) + + req.SetMetaHeader(meta) err = v2signature.SignServiceMessage(callOptions.key, req) if err != nil { From 25de451a2f7e32aec008d7a523673f45cb9bf9be Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 24 May 2021 21:51:22 +0300 Subject: [PATCH 0756/1196] [#283] client/container: Write new fields to eACL table in GetEACL Call `SetSessionToken` and `SetSignature` methods on resulting eACL table with items from response body. From now eACL signature can be accessed from the table itself, so `EACLWithSignature.Signature` is marked deprecated. Signed-off-by: Leonard Lyubich --- pkg/client/container.go | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/pkg/client/container.go b/pkg/client/container.go index 7e3a25e..66cf3f4 100644 --- a/pkg/client/container.go +++ b/pkg/client/container.go @@ -49,8 +49,6 @@ type delContainerSignWrapper struct { // EACLWithSignature represents eACL table/signature pair. type EACLWithSignature struct { table *eacl.Table - - sig *pkg.Signature } func (c delContainerSignWrapper) ReadSignedData(bytes []byte) ([]byte, error) { @@ -67,8 +65,10 @@ func (e EACLWithSignature) EACL() *eacl.Table { } // Signature returns table signature. +// +// Deprecated: use EACL().Signature() instead. func (e EACLWithSignature) Signature() *pkg.Signature { - return e.sig + return e.table.Signature() } func (c *clientImpl) PutContainer(ctx context.Context, cnr *container.Container, opts ...CallOption) (*container.ID, error) { @@ -333,9 +333,18 @@ func (c *clientImpl) GetEACL(ctx context.Context, id *container.ID, opts ...Call body := resp.GetBody() + table := eacl.NewTableFromV2(body.GetEACL()) + + table.SetSessionToken( + session.NewTokenFromV2(body.GetSessionToken()), + ) + + table.SetSignature( + pkg.NewSignatureFromV2(body.GetSignature()), + ) + return &EACLWithSignature{ - table: eacl.NewTableFromV2(body.GetEACL()), - sig: pkg.NewSignatureFromV2(body.GetSignature()), + table: table, }, nil } From 89cb2f6e71749aef35a59ac5d9e8f1b04d5748f5 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 27 May 2021 14:25:41 +0300 Subject: [PATCH 0757/1196] [#288] pkg/eacl: Convert nil eACL filter to nil message Make `Filter.ToV2` method to return `nil` when called on `nil`. Write corresponding unit test. Signed-off-by: Leonard Lyubich --- pkg/acl/eacl/filter.go | 6 ++++++ pkg/acl/eacl/filter_test.go | 8 ++++++++ 2 files changed, 14 insertions(+) diff --git a/pkg/acl/eacl/filter.go b/pkg/acl/eacl/filter.go index d66978b..3be0bb5 100644 --- a/pkg/acl/eacl/filter.go +++ b/pkg/acl/eacl/filter.go @@ -66,7 +66,13 @@ func (f Filter) From() FilterHeaderType { } // ToV2 converts Filter to v2 acl.EACLRecord.Filter message. +// +// Nil Filter converts to nil. func (f *Filter) ToV2() *v2acl.HeaderFilter { + if f == nil { + return nil + } + filter := new(v2acl.HeaderFilter) filter.SetValue(f.value.String()) filter.SetKey(f.key.String()) diff --git a/pkg/acl/eacl/filter_test.go b/pkg/acl/eacl/filter_test.go index 64636cc..7918042 100644 --- a/pkg/acl/eacl/filter_test.go +++ b/pkg/acl/eacl/filter_test.go @@ -59,3 +59,11 @@ func TestFilterEncoding(t *testing.T) { require.Equal(t, f, d2) }) } + +func TestFilter_ToV2(t *testing.T) { + t.Run("nil", func(t *testing.T) { + var x *Filter + + require.Nil(t, x.ToV2()) + }) +} From 8f27d857fa5d3a58c4804fe6e012e13d2ca09e77 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 27 May 2021 14:29:45 +0300 Subject: [PATCH 0758/1196] [#288] pkg/eacl: Document default values set in NewFilter Document field values of instance constructed via `NewFilter`. Assert the values in corresponding unit test. Signed-off-by: Leonard Lyubich --- pkg/acl/eacl/filter.go | 6 ++++++ pkg/acl/eacl/filter_test.go | 19 +++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/pkg/acl/eacl/filter.go b/pkg/acl/eacl/filter.go index 3be0bb5..03c093e 100644 --- a/pkg/acl/eacl/filter.go +++ b/pkg/acl/eacl/filter.go @@ -108,6 +108,12 @@ func (k filterKey) String() string { } // NewFilter creates, initializes and returns blank Filter instance. +// +// Defaults: +// - header type: HeaderTypeUnknown; +// - matcher: MatchUnknown; +// - key: ""; +// - value: "". func NewFilter() *Filter { return NewFilterFromV2(new(v2acl.HeaderFilter)) } diff --git a/pkg/acl/eacl/filter_test.go b/pkg/acl/eacl/filter_test.go index 7918042..9a471d0 100644 --- a/pkg/acl/eacl/filter_test.go +++ b/pkg/acl/eacl/filter_test.go @@ -3,6 +3,7 @@ package eacl import ( "testing" + "github.com/nspcc-dev/neofs-api-go/v2/acl" v2acl "github.com/nspcc-dev/neofs-api-go/v2/acl" "github.com/stretchr/testify/require" ) @@ -66,4 +67,22 @@ func TestFilter_ToV2(t *testing.T) { require.Nil(t, x.ToV2()) }) + + t.Run("default values", func(t *testing.T) { + filter := NewFilter() + + // check initial values + require.Empty(t, filter.Key()) + require.Empty(t, filter.Value()) + require.Equal(t, HeaderTypeUnknown, filter.From()) + require.Equal(t, MatchUnknown, filter.Matcher()) + + // convert to v2 message + filterV2 := filter.ToV2() + + require.Empty(t, filterV2.GetKey()) + require.Empty(t, filterV2.GetValue()) + require.Equal(t, acl.HeaderTypeUnknown, filterV2.GetHeaderType()) + require.Equal(t, acl.MatchTypeUnknown, filterV2.GetMatchType()) + }) } From 5844096017ffadcf52eedf1475154b7b6ef0b925 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 27 May 2021 14:31:30 +0300 Subject: [PATCH 0759/1196] [#288] pkg/eacl: Convert nil eACL target to nil API v2 message Make `Target.ToV2` method to return `nil` when called on `nil`. Write corresponding unit test. Signed-off-by: Leonard Lyubich --- pkg/acl/eacl/target.go | 6 ++++++ pkg/acl/eacl/target_test.go | 8 ++++++++ 2 files changed, 14 insertions(+) diff --git a/pkg/acl/eacl/target.go b/pkg/acl/eacl/target.go index b951082..8574e48 100644 --- a/pkg/acl/eacl/target.go +++ b/pkg/acl/eacl/target.go @@ -108,7 +108,13 @@ func (t Target) Role() Role { } // ToV2 converts Target to v2 acl.EACLRecord.Target message. +// +// Nil Target converts to nil. func (t *Target) ToV2() *v2acl.Target { + if t == nil { + return nil + } + target := new(v2acl.Target) target.SetRole(t.role.ToV2()) diff --git a/pkg/acl/eacl/target_test.go b/pkg/acl/eacl/target_test.go index 5c33ec7..6612e3a 100644 --- a/pkg/acl/eacl/target_test.go +++ b/pkg/acl/eacl/target_test.go @@ -61,3 +61,11 @@ func TestTargetEncoding(t *testing.T) { require.Equal(t, tar, tar2) }) } + +func TestTarget_ToV2(t *testing.T) { + t.Run("nil", func(t *testing.T) { + var x *Target + + require.Nil(t, x.ToV2()) + }) +} From b81f39368eda311fbb401bbbe7ceaee7bdc7f601 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 27 May 2021 14:34:22 +0300 Subject: [PATCH 0760/1196] [#288] pkg/eacl: Document default values set in NewTarget Document field values of instance constructed via `NewTarget`. Assert the values in corresponding unit test. Signed-off-by: Leonard Lyubich --- pkg/acl/eacl/target.go | 4 ++++ pkg/acl/eacl/target_test.go | 15 +++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/pkg/acl/eacl/target.go b/pkg/acl/eacl/target.go index 8574e48..22a2af6 100644 --- a/pkg/acl/eacl/target.go +++ b/pkg/acl/eacl/target.go @@ -124,6 +124,10 @@ func (t *Target) ToV2() *v2acl.Target { } // NewTarget creates, initializes and returns blank Target instance. +// +// Defaults: +// - role: RoleUnknown; +// - keys: nil. func NewTarget() *Target { return NewTargetFromV2(new(v2acl.Target)) } diff --git a/pkg/acl/eacl/target_test.go b/pkg/acl/eacl/target_test.go index 6612e3a..5fd0e70 100644 --- a/pkg/acl/eacl/target_test.go +++ b/pkg/acl/eacl/target_test.go @@ -4,6 +4,7 @@ import ( "crypto/ecdsa" "testing" + "github.com/nspcc-dev/neofs-api-go/v2/acl" v2acl "github.com/nspcc-dev/neofs-api-go/v2/acl" crypto "github.com/nspcc-dev/neofs-crypto" "github.com/nspcc-dev/neofs-crypto/test" @@ -68,4 +69,18 @@ func TestTarget_ToV2(t *testing.T) { require.Nil(t, x.ToV2()) }) + + t.Run("default values", func(t *testing.T) { + target := NewTarget() + + // check initial values + require.Equal(t, RoleUnknown, target.Role()) + require.Nil(t, target.BinaryKeys()) + + // convert to v2 message + targetV2 := target.ToV2() + + require.Equal(t, acl.RoleUnknown, targetV2.GetRole()) + require.Nil(t, targetV2.GetKeys()) + }) } From 18a3c4d54f0a8300ef4804a9e4f16722f74f800f Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 27 May 2021 14:35:49 +0300 Subject: [PATCH 0761/1196] [#288] pkg/eacl: Convert nil eACL record to nil API v2 message Make `Record.ToV2` method to return `nil` when called on `nil`. Write corresponding unit test. Signed-off-by: Leonard Lyubich --- pkg/acl/eacl/record.go | 6 ++++++ pkg/acl/eacl/record_test.go | 8 ++++++++ 2 files changed, 14 insertions(+) diff --git a/pkg/acl/eacl/record.go b/pkg/acl/eacl/record.go index 9b9e718..2e0d255 100644 --- a/pkg/acl/eacl/record.go +++ b/pkg/acl/eacl/record.go @@ -128,7 +128,13 @@ func (r *Record) AddObjectOwnerIDFilter(m Match, id *owner.ID) { // TODO: add remaining filters after neofs-api#72 // ToV2 converts Record to v2 acl.EACLRecord message. +// +// Nil Record converts to nil. func (r *Record) ToV2() *v2acl.Record { + if r == nil { + return nil + } + targets := make([]*v2acl.Target, 0, len(r.targets)) for _, target := range r.targets { targets = append(targets, target.ToV2()) diff --git a/pkg/acl/eacl/record_test.go b/pkg/acl/eacl/record_test.go index a22f223..25608be 100644 --- a/pkg/acl/eacl/record_test.go +++ b/pkg/acl/eacl/record_test.go @@ -119,3 +119,11 @@ func TestRecordEncoding(t *testing.T) { require.Equal(t, r, r2) }) } + +func TestRecord_ToV2(t *testing.T) { + t.Run("nil", func(t *testing.T) { + var x *Record + + require.Nil(t, x.ToV2()) + }) +} From 374c37983d1e06adcaa32934a5709779a9e50c1c Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 27 May 2021 14:36:45 +0300 Subject: [PATCH 0762/1196] [#288] pkg/eacl: Document default values set in NewRecord Document field values of instance constructed via `NewRecord`. Assert the values in corresponding unit test. Signed-off-by: Leonard Lyubich --- pkg/acl/eacl/record.go | 6 ++++++ pkg/acl/eacl/record_test.go | 18 ++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/pkg/acl/eacl/record.go b/pkg/acl/eacl/record.go index 2e0d255..e8430d1 100644 --- a/pkg/acl/eacl/record.go +++ b/pkg/acl/eacl/record.go @@ -156,6 +156,12 @@ func (r *Record) ToV2() *v2acl.Record { } // NewRecord creates and returns blank Record instance. +// +// Defaults: +// - action: ActionUnknown; +// - operation: OperationUnknown; +// - targets: nil, +// - filters: nil. func NewRecord() *Record { return new(Record) } diff --git a/pkg/acl/eacl/record_test.go b/pkg/acl/eacl/record_test.go index 25608be..7ed59dd 100644 --- a/pkg/acl/eacl/record_test.go +++ b/pkg/acl/eacl/record_test.go @@ -126,4 +126,22 @@ func TestRecord_ToV2(t *testing.T) { require.Nil(t, x.ToV2()) }) + + t.Run("default values", func(t *testing.T) { + record := NewRecord() + + // check initial values + require.Equal(t, OperationUnknown, record.Operation()) + require.Equal(t, ActionUnknown, record.Action()) + require.Nil(t, record.Targets()) + require.Nil(t, record.Filters()) + + // convert to v2 message + recordV2 := record.ToV2() + + require.Equal(t, v2acl.OperationUnknown, recordV2.GetOperation()) + require.Equal(t, v2acl.ActionUnknown, recordV2.GetAction()) + require.Nil(t, recordV2.GetTargets()) + require.Nil(t, recordV2.GetFilters()) + }) } From 8c70b4714e53cc03cdb6c11c8fcaaac4cab985e5 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 27 May 2021 14:42:12 +0300 Subject: [PATCH 0763/1196] [#288] pkg/eacl: Fix conversion of slices in Record.ToV2 method Nil slices of targets and filters of the `Record` should be converted to nil slices in corresponding fields of API v2 message structure. Add nil-check in `Record.ToV2` implementation. The changes fix corresponding unit test. Signed-off-by: Leonard Lyubich --- pkg/acl/eacl/record.go | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/pkg/acl/eacl/record.go b/pkg/acl/eacl/record.go index e8430d1..7ba9743 100644 --- a/pkg/acl/eacl/record.go +++ b/pkg/acl/eacl/record.go @@ -135,22 +135,28 @@ func (r *Record) ToV2() *v2acl.Record { return nil } - targets := make([]*v2acl.Target, 0, len(r.targets)) - for _, target := range r.targets { - targets = append(targets, target.ToV2()) - } - - filters := make([]*v2acl.HeaderFilter, 0, len(r.filters)) - for _, filter := range r.filters { - filters = append(filters, filter.ToV2()) - } - v2 := new(v2acl.Record) + if r.targets != nil { + targets := make([]*v2acl.Target, 0, len(r.targets)) + for _, target := range r.targets { + targets = append(targets, target.ToV2()) + } + + v2.SetTargets(targets) + } + + if r.filters != nil { + filters := make([]*v2acl.HeaderFilter, 0, len(r.filters)) + for _, filter := range r.filters { + filters = append(filters, filter.ToV2()) + } + + v2.SetFilters(filters) + } + v2.SetAction(r.action.ToV2()) v2.SetOperation(r.operation.ToV2()) - v2.SetTargets(targets) - v2.SetFilters(filters) return v2 } From 8abf78009a5ac6494195e35389793bae404fad09 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 27 May 2021 14:43:21 +0300 Subject: [PATCH 0764/1196] [#288] pkg/eacl: Convert nil eACL table to nil API v2 message Make `Table.ToV2` method to return `nil` when called on `nil`. Write corresponding unit test. Signed-off-by: Leonard Lyubich --- pkg/acl/eacl/table.go | 6 ++++++ pkg/acl/eacl/table_test.go | 8 ++++++++ 2 files changed, 14 insertions(+) diff --git a/pkg/acl/eacl/table.go b/pkg/acl/eacl/table.go index 99b6aad..c348696 100644 --- a/pkg/acl/eacl/table.go +++ b/pkg/acl/eacl/table.go @@ -75,7 +75,13 @@ func (t *Table) SetSignature(sig *pkg.Signature) { } // ToV2 converts Table to v2 acl.EACLTable message. +// +// Nil Table converts to nil. func (t *Table) ToV2() *v2acl.Table { + if t == nil { + return nil + } + v2 := new(v2acl.Table) if t.cid != nil { diff --git a/pkg/acl/eacl/table_test.go b/pkg/acl/eacl/table_test.go index ec28efe..c9fe8d5 100644 --- a/pkg/acl/eacl/table_test.go +++ b/pkg/acl/eacl/table_test.go @@ -112,3 +112,11 @@ func TestTable_Signature(t *testing.T) { require.Equal(t, sig, table.Signature()) } + +func TestTable_ToV2(t *testing.T) { + t.Run("nil", func(t *testing.T) { + var x *eacl.Table + + require.Nil(t, x.ToV2()) + }) +} From fc4f7429d5c3bcbcacbd0b218dc027e4fe4fb55a Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 27 May 2021 14:48:20 +0300 Subject: [PATCH 0765/1196] [#288] pkg/eacl: Document default values set in NewTable Document field values of instance constructed via `NewTable`. Assert the values in corresponding unit test. Signed-off-by: Leonard Lyubich --- pkg/acl/eacl/table.go | 7 +++++++ pkg/acl/eacl/table_test.go | 18 ++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/pkg/acl/eacl/table.go b/pkg/acl/eacl/table.go index c348696..d18ab0c 100644 --- a/pkg/acl/eacl/table.go +++ b/pkg/acl/eacl/table.go @@ -100,6 +100,13 @@ func (t *Table) ToV2() *v2acl.Table { } // NewTable creates, initializes and returns blank Table instance. +// +// Defaults: +// - version: pkg.SDKVersion(); +// - container ID: nil; +// - records: nil; +// - session token: nil; +// - signature: nil. func NewTable() *Table { t := new(Table) t.SetVersion(*pkg.SDKVersion()) diff --git a/pkg/acl/eacl/table_test.go b/pkg/acl/eacl/table_test.go index c9fe8d5..393527a 100644 --- a/pkg/acl/eacl/table_test.go +++ b/pkg/acl/eacl/table_test.go @@ -119,4 +119,22 @@ func TestTable_ToV2(t *testing.T) { require.Nil(t, x.ToV2()) }) + + t.Run("default values", func(t *testing.T) { + table := eacl.NewTable() + + // check initial values + require.Equal(t, *pkg.SDKVersion(), table.Version()) + require.Nil(t, table.Records()) + require.Nil(t, table.CID()) + require.Nil(t, table.SessionToken()) + require.Nil(t, table.Signature()) + + // convert to v2 message + tableV2 := table.ToV2() + + require.Equal(t, pkg.SDKVersion().ToV2(), tableV2.GetVersion()) + require.Nil(t, tableV2.GetRecords()) + require.Nil(t, tableV2.GetContainerID()) + }) } From 48837bd5da3d197c95b45f72569c1a190e79f950 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 27 May 2021 14:50:37 +0300 Subject: [PATCH 0766/1196] [#288] pkg/eacl: Fix conversion of slices in Table.ToV2 method Nil slice of records of the `Table` should be converted to nil slice in corresponding field of API v2 message structure. Add nil-check in `Table.ToV2` implementation. The changes fix corresponding unit test. Signed-off-by: Leonard Lyubich --- pkg/acl/eacl/table.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/pkg/acl/eacl/table.go b/pkg/acl/eacl/table.go index d18ab0c..81bee1a 100644 --- a/pkg/acl/eacl/table.go +++ b/pkg/acl/eacl/table.go @@ -88,13 +88,16 @@ func (t *Table) ToV2() *v2acl.Table { v2.SetContainerID(t.cid.ToV2()) } - records := make([]*v2acl.Record, 0, len(t.records)) - for _, record := range t.records { - records = append(records, record.ToV2()) + if t.records != nil { + records := make([]*v2acl.Record, 0, len(t.records)) + for _, record := range t.records { + records = append(records, record.ToV2()) + } + + v2.SetRecords(records) } v2.SetVersion(t.version.ToV2()) - v2.SetRecords(records) return v2 } From 4f286f5175d2fcb5cdb726b55caa60c593d7d4eb Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 28 May 2021 10:09:53 +0300 Subject: [PATCH 0767/1196] [#283] pkg/owner: Implement generators of ID's for testing Create `ownertest` package with functions which generate random `owner.ID` instances. These functions is going to be used for testing. Signed-off-by: Leonard Lyubich --- pkg/owner/test/id.go | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 pkg/owner/test/id.go diff --git a/pkg/owner/test/id.go b/pkg/owner/test/id.go new file mode 100644 index 0000000..f542cf1 --- /dev/null +++ b/pkg/owner/test/id.go @@ -0,0 +1,27 @@ +package ownertest + +import ( + "math/rand" + + "github.com/nspcc-dev/neofs-api-go/pkg/owner" + "github.com/nspcc-dev/neofs-api-go/v2/refs" +) + +// Generate returns owner.ID calculated +// from a random owner.NEO3Wallet. +func Generate() *owner.ID { + data := make([]byte, owner.NEO3WalletSize) + + rand.Read(data) + + return GenerateFromBytes(data) +} + +// GenerateFromBytes returns owner.ID generated +// from a passed byte slice. +func GenerateFromBytes(val []byte) *owner.ID { + idV2 := new(refs.OwnerID) + idV2.SetValue(val) + + return owner.NewIDFromV2(idV2) +} From 5fe5af5bf9700f6b9d17a5ea2044a9e5345f23cc Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 28 May 2021 10:25:30 +0300 Subject: [PATCH 0768/1196] [#283] pkg/owner: Implement Equal method of ID type Implement `owner.ID.Equal` method which defines a comparison relationship between two identifiers. Signed-off-by: Leonard Lyubich --- pkg/owner/id.go | 11 +++++++++++ pkg/owner/id_test.go | 22 +++++++++++++++++++++- 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/pkg/owner/id.go b/pkg/owner/id.go index ea8f5fc..2743b73 100644 --- a/pkg/owner/id.go +++ b/pkg/owner/id.go @@ -1,6 +1,7 @@ package owner import ( + "bytes" "errors" "fmt" @@ -40,6 +41,16 @@ func (id *ID) String() string { return base58.Encode((*refs.OwnerID)(id).GetValue()) } +// Equal defines a comparison relation on ID's. +// +// ID's are equal if they have the same binary representation. +func (id *ID) Equal(id2 *ID) bool { + return bytes.Equal( + (*refs.ObjectID)(id).GetValue(), + (*refs.ObjectID)(id2).GetValue(), + ) +} + func ScriptHashBE(id fmt.Stringer) ([]byte, error) { addr, err := address.StringToUint160(id.String()) if err != nil { diff --git a/pkg/owner/id_test.go b/pkg/owner/id_test.go index 49816bf..c6d7bc2 100644 --- a/pkg/owner/id_test.go +++ b/pkg/owner/id_test.go @@ -1,4 +1,4 @@ -package owner +package owner_test import ( "crypto/rand" @@ -6,6 +6,8 @@ import ( "testing" "github.com/mr-tron/base58" + . "github.com/nspcc-dev/neofs-api-go/pkg/owner" + ownertest "github.com/nspcc-dev/neofs-api-go/pkg/owner/test" "github.com/nspcc-dev/neofs-crypto/test" "github.com/stretchr/testify/require" ) @@ -93,3 +95,21 @@ func TestIDEncoding(t *testing.T) { require.Equal(t, id, a2) }) } + +func TestID_Equal(t *testing.T) { + var ( + data1 = []byte{1, 2, 3} + data2 = data1 + data3 = append(data1, 255) + ) + + id1 := ownertest.GenerateFromBytes(data1) + + require.True(t, id1.Equal( + ownertest.GenerateFromBytes(data2), + )) + + require.False(t, id1.Equal( + ownertest.GenerateFromBytes(data3), + )) +} From 05e74d56db04131a73895347123e3b3ec7aa78e6 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 28 May 2021 10:56:30 +0300 Subject: [PATCH 0769/1196] [#283] pkg/session: Implement Sign/Verify methods on Token Implement `Token.Sign` method which calculates signature of the data of the `Token` and writes the signature into it. Implement `Token.VerifySignature` which checks if `Token` signature is presented and valid. These methods allow to abstract the external context from the details of what kind of data is being signed and how the signature is stored. Signed-off-by: Leonard Lyubich --- pkg/session/session.go | 43 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/pkg/session/session.go b/pkg/session/session.go index b11a058..ecdb93b 100644 --- a/pkg/session/session.go +++ b/pkg/session/session.go @@ -1,9 +1,14 @@ package session import ( + "crypto/ecdsa" + "github.com/nspcc-dev/neofs-api-go/pkg" "github.com/nspcc-dev/neofs-api-go/pkg/owner" + "github.com/nspcc-dev/neofs-api-go/util/signature" + "github.com/nspcc-dev/neofs-api-go/v2/refs" "github.com/nspcc-dev/neofs-api-go/v2/session" + v2signature "github.com/nspcc-dev/neofs-api-go/v2/signature" ) // Token represents NeoFS API v2-compatible @@ -84,6 +89,44 @@ func (t *Token) SetSessionKey(v []byte) { }) } +// Sign calculates and writes signature of the Token data. +// +// Returns signature calculation errors. +func (t *Token) Sign(key *ecdsa.PrivateKey) error { + tV2 := (*session.SessionToken)(t) + + signedData := v2signature.StableMarshalerWrapper{ + SM: tV2.GetBody(), + } + + return signature.SignDataWithHandler(key, signedData, func(key, sig []byte) { + tSig := tV2.GetSignature() + if tSig == nil { + tSig = new(refs.Signature) + } + + tSig.SetKey(key) + tSig.SetSign(sig) + + tV2.SetSignature(tSig) + }) +} + +// VerifySignature checks if token signature is +// presented and valid. +func (t *Token) VerifySignature() bool { + tV2 := (*session.SessionToken)(t) + + signedData := v2signature.StableMarshalerWrapper{ + SM: tV2.GetBody(), + } + + return signature.VerifyDataWithSource(signedData, func() (key, sig []byte) { + tSig := tV2.GetSignature() + return tSig.GetKey(), tSig.GetSign() + }) == nil +} + // Signature returns Token signature. func (t *Token) Signature() *pkg.Signature { return pkg.NewSignatureFromV2( From fb0b1ea10882c6fe03b78f208f4c87bb96b210fc Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 28 May 2021 11:00:46 +0300 Subject: [PATCH 0770/1196] [#283] pkg/session: Cover Token's Sign/Verify methods with unit test Add `sessiontest.GenerateSigned` function which returns signed random token. Clarify that `sessiontest.Generate` returns an unsigned token. Use these functions to assert the correctness of `Sign` / `VerifySignature` methods. Signed-off-by: Leonard Lyubich --- pkg/session/session_test.go | 20 ++++++++++++++++++++ pkg/session/test/token.go | 16 ++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/pkg/session/session_test.go b/pkg/session/session_test.go index 9105869..9964541 100644 --- a/pkg/session/session_test.go +++ b/pkg/session/session_test.go @@ -66,3 +66,23 @@ func TestSessionTokenEncoding(t *testing.T) { require.Equal(t, tok, tok2) }) } + +func TestToken_VerifySignature(t *testing.T) { + t.Run("nil", func(t *testing.T) { + var tok *session.Token + + require.False(t, tok.VerifySignature()) + }) + + t.Run("unsigned", func(t *testing.T) { + tok := sessiontest.Generate() + + require.False(t, tok.VerifySignature()) + }) + + t.Run("signed", func(t *testing.T) { + tok := sessiontest.GenerateSigned() + + require.True(t, tok.VerifySignature()) + }) +} diff --git a/pkg/session/test/token.go b/pkg/session/test/token.go index 3924984..8d51720 100644 --- a/pkg/session/test/token.go +++ b/pkg/session/test/token.go @@ -11,6 +11,8 @@ import ( ) // Generate returns random session.Token. +// +// Resulting token is unsigned. func Generate() *session.Token { tok := session.NewToken() @@ -33,3 +35,17 @@ func Generate() *session.Token { return tok } + +// GenerateSigned returns signed random session.Token. +// +// Panics if token could not be signed (actually unexpected). +func GenerateSigned() *session.Token { + tok := Generate() + + err := tok.Sign(test.DecodeKey(0)) + if err != nil { + panic(err) + } + + return tok +} From 1d8207ae196e4db2b106cd0075671f32fa54a30c Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 28 May 2021 13:09:32 +0300 Subject: [PATCH 0771/1196] [#283] pkg/session: Implement container session context Define `ContainerContext` type for container sessions. Implement basic functionality to work with its data. Signed-off-by: Leonard Lyubich --- pkg/session/container.go | 115 ++++++++++++++++++++++++++++++++++ pkg/session/container_test.go | 87 +++++++++++++++++++++++++ 2 files changed, 202 insertions(+) create mode 100644 pkg/session/container.go create mode 100644 pkg/session/container_test.go diff --git a/pkg/session/container.go b/pkg/session/container.go new file mode 100644 index 0000000..bcf5c3d --- /dev/null +++ b/pkg/session/container.go @@ -0,0 +1,115 @@ +package session + +import ( + cid "github.com/nspcc-dev/neofs-api-go/pkg/container/id" + "github.com/nspcc-dev/neofs-api-go/v2/session" +) + +// ContainerContext represents NeoFS API v2-compatible +// context of the container session. +// +// It is a wrapper over session.ContainerSessionContext +// which allows to abstract from details of the message +// structure. +type ContainerContext session.ContainerSessionContext + +// NewContainerContext creates and returns blank ContainerSessionContext. +// +// Defaults: +// - not bound to any operation; +// - applied to all containers. +func NewContainerContext() *ContainerContext { + v2 := new(session.ContainerSessionContext) + v2.SetWildcard(true) + + return ContainerContextFromV2(v2) +} + +// ContainerContextFromV2 wraps session.ContainerSessionContext +// into ContainerContext. +func ContainerContextFromV2(v *session.ContainerSessionContext) *ContainerContext { + return (*ContainerContext)(v) +} + +// ToV2 converts ContainerContext to session.ContainerSessionContext +// message structure. +func (x *ContainerContext) ToV2() *session.ContainerSessionContext { + return (*session.ContainerSessionContext)(x) +} + +// ApplyTo specifies which container the ContainerContext applies to. +// +// If id is nil, ContainerContext is applied to all containers. +func (x *ContainerContext) ApplyTo(id *cid.ID) { + v2 := (*session.ContainerSessionContext)(x) + + v2.SetWildcard(id == nil) + v2.SetContainerID(id.ToV2()) +} + +// ActOnAllContainers is a helper function that conveniently +// applies ContainerContext to all containers. +func ApplyToAllContainers(c *ContainerContext) { + c.ApplyTo(nil) +} + +// Container returns identifier of the container +// to which the ContainerContext applies. +// +// Returns nil if ContainerContext is applied to +// all containers. +func (x *ContainerContext) Container() *cid.ID { + v2 := (*session.ContainerSessionContext)(x) + + if v2.Wildcard() { + return nil + } + + return cid.NewFromV2(v2.ContainerID()) +} + +func (x *ContainerContext) forVerb(v session.ContainerSessionVerb) { + (*session.ContainerSessionContext)(x). + SetVerb(v) +} + +func (x *ContainerContext) isForVerb(v session.ContainerSessionVerb) bool { + return (*session.ContainerSessionContext)(x). + Verb() == v +} + +// ForPut binds the ContainerContext to +// PUT operation. +func (x *ContainerContext) ForPut() { + x.forVerb(session.ContainerVerbPut) +} + +// IsForPut checks if ContainerContext is bound to +// PUT operation. +func (x *ContainerContext) IsForPut() bool { + return x.isForVerb(session.ContainerVerbPut) +} + +// ForDelete binds the ContainerContext to +// DELETE operation. +func (x *ContainerContext) ForDelete() { + x.forVerb(session.ContainerVerbDelete) +} + +// IsForDelete checks if ContainerContext is bound to +// DELETE operation. +func (x *ContainerContext) IsForDelete() bool { + return x.isForVerb(session.ContainerVerbDelete) +} + +// ForSetEACL binds the ContainerContext to +// SETEACL operation. +func (x *ContainerContext) ForSetEACL() { + x.forVerb(session.ContainerVerbSetEACL) +} + +// IsForSetEACL checks if ContainerContext is bound to +// SETEACL operation. +func (x *ContainerContext) IsForSetEACL() bool { + return x.isForVerb(session.ContainerVerbSetEACL) +} diff --git a/pkg/session/container_test.go b/pkg/session/container_test.go new file mode 100644 index 0000000..6dd2c1f --- /dev/null +++ b/pkg/session/container_test.go @@ -0,0 +1,87 @@ +package session_test + +import ( + "testing" + + cidtest "github.com/nspcc-dev/neofs-api-go/pkg/container/id/test" + "github.com/nspcc-dev/neofs-api-go/pkg/session" + v2session "github.com/nspcc-dev/neofs-api-go/v2/session" + "github.com/stretchr/testify/require" +) + +func TestContainerContextVerbs(t *testing.T) { + c := session.NewContainerContext() + + assert := func(setter func(), getter func() bool, verb v2session.ContainerSessionVerb) { + setter() + + require.True(t, getter()) + + require.Equal(t, verb, c.ToV2().Verb()) + } + + t.Run("PUT", func(t *testing.T) { + assert(c.ForPut, c.IsForPut, v2session.ContainerVerbPut) + }) + + t.Run("DELETE", func(t *testing.T) { + assert(c.ForDelete, c.IsForDelete, v2session.ContainerVerbDelete) + }) + + t.Run("SETEACL", func(t *testing.T) { + assert(c.ForSetEACL, c.IsForSetEACL, v2session.ContainerVerbSetEACL) + }) +} + +func TestContainerContext_ApplyTo(t *testing.T) { + c := session.NewContainerContext() + id := cidtest.Generate() + + t.Run("method", func(t *testing.T) { + c.ApplyTo(id) + + require.Equal(t, id, c.Container()) + + c.ApplyTo(nil) + + require.Nil(t, c.Container()) + }) + + t.Run("helper functions", func(t *testing.T) { + c.ApplyTo(id) + + session.ApplyToAllContainers(c) + + require.Nil(t, c.Container()) + }) +} + +func TestFilter_ToV2(t *testing.T) { + t.Run("nil", func(t *testing.T) { + var x *session.ContainerContext + + require.Nil(t, x.ToV2()) + }) + + t.Run("default values", func(t *testing.T) { + c := session.NewContainerContext() + + // check initial values + require.Nil(t, c.Container()) + + for _, op := range []func() bool{ + c.IsForPut, + c.IsForDelete, + c.IsForSetEACL, + } { + require.False(t, op()) + } + + // convert to v2 message + cV2 := c.ToV2() + + require.Equal(t, v2session.ContainerVerbUnknown, cV2.Verb()) + require.True(t, cV2.Wildcard()) + require.Nil(t, cV2.ContainerID()) + }) +} From 2648abb49ed9d50bf0fdc756abad740d38a96041 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 28 May 2021 13:10:34 +0300 Subject: [PATCH 0772/1196] [#283] pkg/session: Add container context generator Implement `sessiontest.ContainerContext` function for testing. Signed-off-by: Leonard Lyubich --- pkg/session/test/container.go | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 pkg/session/test/container.go diff --git a/pkg/session/test/container.go b/pkg/session/test/container.go new file mode 100644 index 0000000..070bd1b --- /dev/null +++ b/pkg/session/test/container.go @@ -0,0 +1,26 @@ +package sessiontest + +import ( + "math/rand" + + cidtest "github.com/nspcc-dev/neofs-api-go/pkg/container/id/test" + "github.com/nspcc-dev/neofs-api-go/pkg/session" +) + +// ContainerContext returns session.ContainerContext +// which applies to random operation on a random container. +func ContainerContext() *session.ContainerContext { + c := session.NewContainerContext() + + setters := []func(){ + c.ForPut, + c.ForDelete, + c.ForSetEACL, + } + + setters[rand.Uint32()%uint32(len(setters))]() + + c.ApplyTo(cidtest.Generate()) + + return c +} From 6cd349738889436eaf11e93a0cee30df5d3499a4 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 28 May 2021 13:16:05 +0300 Subject: [PATCH 0773/1196] [#283] pkg/session: Implement work with token contexts Implement `Context` / `SetContext` methods on `Token` which reads / sets token context. Support container context (`ContainerContext`). Add helper function `GetContainerContext` for easy reading of the container context. Signed-off-by: Leonard Lyubich --- pkg/session/session.go | 44 +++++++++++++++++++++++++++++++ pkg/session/session_test.go | 52 +++++++++++++++++++++++++++++++++++++ 2 files changed, 96 insertions(+) diff --git a/pkg/session/session.go b/pkg/session/session.go index ecdb93b..4d9780c 100644 --- a/pkg/session/session.go +++ b/pkg/session/session.go @@ -135,6 +135,50 @@ func (t *Token) Signature() *pkg.Signature { ) } +// SetContext sets context of the Token. +// +// Supported contexts: +// - *ContainerContext. +// +// Resets context if it is not supported. +func (t *Token) SetContext(v interface{}) { + var cV2 session.SessionTokenContext + + switch c := v.(type) { + case *ContainerContext: + cV2 = c.ToV2() + } + + t.setBodyField(func(body *session.SessionTokenBody) { + body.SetContext(cV2) + }) +} + +// Context returns context of the Token. +// +// Supports same contexts as SetContext. +// +// Returns nil if context is not supported. +func (t *Token) Context() interface{} { + switch v := (*session.SessionToken)(t). + GetBody(). + GetContext(); c := v.(type) { + default: + return nil + case *session.ContainerSessionContext: + return ContainerContextFromV2(c) + } +} + +// GetContainerContext is a helper function that casts +// Token context to ContainerContext. +// +// Returns nil if context is not a ContainerContext. +func GetContainerContext(t *Token) *ContainerContext { + c, _ := t.Context().(*ContainerContext) + return c +} + // Marshal marshals Token into a protobuf binary form. // // Buffer is allocated when the argument is empty. diff --git a/pkg/session/session_test.go b/pkg/session/session_test.go index 9964541..5476f15 100644 --- a/pkg/session/session_test.go +++ b/pkg/session/session_test.go @@ -86,3 +86,55 @@ func TestToken_VerifySignature(t *testing.T) { require.True(t, tok.VerifySignature()) }) } + +var unsupportedContexts = []interface{}{ + 123, + true, + session.NewToken(), +} + +var nonContainerContexts = unsupportedContexts + +func TestToken_Context(t *testing.T) { + tok := session.NewToken() + + for _, item := range []struct { + ctx interface{} + v2assert func(interface{}) + }{ + { + ctx: sessiontest.ContainerContext(), + v2assert: func(c interface{}) { + require.Equal(t, c.(*session.ContainerContext).ToV2(), tok.ToV2().GetBody().GetContext()) + }, + }, + } { + tok.SetContext(item.ctx) + + require.Equal(t, item.ctx, tok.Context()) + + item.v2assert(item.ctx) + } + + for _, c := range unsupportedContexts { + tok.SetContext(c) + + require.Nil(t, tok.Context()) + } +} + +func TestGetContainerContext(t *testing.T) { + tok := session.NewToken() + + c := sessiontest.ContainerContext() + + tok.SetContext(c) + + require.Equal(t, c, session.GetContainerContext(tok)) + + for _, c := range nonContainerContexts { + tok.SetContext(c) + + require.Nil(t, session.GetContainerContext(tok)) + } +} From 066a2dba74bc32e8aad60a228d14d36f8b097e10 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 31 May 2021 09:16:57 +0300 Subject: [PATCH 0774/1196] [#196] rpc/grpc: Implement Client.Conn method Implement `Client.Conn` method which returns underlying connection as `io.Closer`. Method is going to be used for forwarding the connection to superior clients. Signed-off-by: Leonard Lyubich --- rpc/grpc/conn.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 rpc/grpc/conn.go diff --git a/rpc/grpc/conn.go b/rpc/grpc/conn.go new file mode 100644 index 0000000..40968b9 --- /dev/null +++ b/rpc/grpc/conn.go @@ -0,0 +1,19 @@ +package grpc + +import ( + "io" +) + +// Conn returns underlying connection. +// +// Conn is NPE-safe: returns nil if Client is nil. +// +// Client should not be used after Close() call +// on the connection: behavior is undefined. +func (c *Client) Conn() io.Closer { + if c != nil { + return c.con + } + + return nil +} From 22ce8e13ccb6a9a72747d34fbfbfe09d8d3b61a4 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 31 May 2021 09:18:23 +0300 Subject: [PATCH 0775/1196] [#196] rpc/client: Implement Client.Conn method Implement `Client.Conn` which returns the connection of the underlying transport client. The method is going to be used for forwarding the connection to superior clients. Signed-off-by: Leonard Lyubich --- rpc/client/conn.go | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 rpc/client/conn.go diff --git a/rpc/client/conn.go b/rpc/client/conn.go new file mode 100644 index 0000000..ba53ab3 --- /dev/null +++ b/rpc/client/conn.go @@ -0,0 +1,22 @@ +package client + +import ( + "io" +) + +// Conn returns underlying connection. +// +// Returns non-nil result after the first Init() call +// completed without a connection error. +// +// Conn is NPE-safe: returns nil if Client is nil. +// +// Client should not be used after Close() call +// on the connection: behavior is undefined. +func (c *Client) Conn() io.Closer { + if c != nil { + return c.gRPCClient.Conn() + } + + return nil +} From 89be8d3f5ada752f2b728925b62f82bc5a5a0bd4 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 31 May 2021 09:22:10 +0300 Subject: [PATCH 0776/1196] [#196] pkg/client: Extend Client interface with Conn method Add `Conn` method to `Client` interface which must return the underlying connection. Implement new method on the core structure. `Conn` can be used to control the connection (e.g. for closing). Signed-off-by: Leonard Lyubich --- pkg/client/client.go | 7 +++++++ pkg/client/raw.go | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/pkg/client/client.go b/pkg/client/client.go index 8fe4d1e..4ffbd30 100644 --- a/pkg/client/client.go +++ b/pkg/client/client.go @@ -1,6 +1,7 @@ package client import ( + "io" "sync" "github.com/nspcc-dev/neofs-api-go/rpc/client" @@ -17,6 +18,12 @@ type Client interface { // Raw must return underlying raw protobuf client. Raw() *client.Client + + // Conn must return underlying connection. + // + // Must return a non-nil result after the first RPC call + // completed without a connection error. + Conn() io.Closer } type clientImpl struct { diff --git a/pkg/client/raw.go b/pkg/client/raw.go index a8fce33..aebe143 100644 --- a/pkg/client/raw.go +++ b/pkg/client/raw.go @@ -1,6 +1,8 @@ package client import ( + "io" + "github.com/nspcc-dev/neofs-api-go/rpc/client" ) @@ -12,3 +14,8 @@ func (c *clientImpl) Raw() *client.Client { return c.raw } + +// implements Client.Conn method. +func (c *clientImpl) Conn() io.Closer { + return c.raw.Conn() +} From 65080c8b69a6a66863bb9410a1b887449e28e00b Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 31 May 2021 15:09:04 +0300 Subject: [PATCH 0777/1196] [#295] pkg: Remove usage of deprecated elements Remove usage of deprecated of `container.ID` and `token.SessionToken` code elements. Replace using of custom message generators with the ones provided by packages. Replace string comparison with `Equal` method call. Signed-off-by: Leonard Lyubich --- pkg/acl/eacl/table_test.go | 16 ++++--- pkg/audit/result.go | 8 ++-- pkg/audit/result_test.go | 13 ++---- pkg/client/container.go | 29 ++++++------- pkg/client/object.go | 8 ++-- pkg/client/opts.go | 5 ++- pkg/client/session.go | 8 ++-- pkg/container/announcement.go | 7 ++-- pkg/container/announcement_test.go | 16 +++---- pkg/container/container.go | 5 ++- pkg/container/container_test.go | 5 +-- pkg/container/id/id_test.go | 4 +- pkg/object/address.go | 14 +++---- pkg/object/address_test.go | 14 +++---- pkg/object/raw.go | 8 ++-- pkg/object/raw_test.go | 29 ++++--------- pkg/object/rw.go | 16 +++---- pkg/object/search.go | 4 +- pkg/owner/id_test.go | 18 +------- pkg/session/session_test.go | 10 +---- pkg/token/bearer_test.go | 2 +- pkg/token/session_test.go | 67 ------------------------------ 22 files changed, 97 insertions(+), 209 deletions(-) delete mode 100644 pkg/token/session_test.go diff --git a/pkg/acl/eacl/table_test.go b/pkg/acl/eacl/table_test.go index 393527a..f3638ca 100644 --- a/pkg/acl/eacl/table_test.go +++ b/pkg/acl/eacl/table_test.go @@ -6,26 +6,25 @@ import ( "github.com/nspcc-dev/neofs-api-go/pkg" "github.com/nspcc-dev/neofs-api-go/pkg/acl/eacl" - "github.com/nspcc-dev/neofs-api-go/pkg/container" + cidtest "github.com/nspcc-dev/neofs-api-go/pkg/container/id/test" sessiontest "github.com/nspcc-dev/neofs-api-go/pkg/session/test" "github.com/stretchr/testify/require" ) func TestTable(t *testing.T) { var ( - v pkg.Version - cid container.ID + v pkg.Version ) sha := sha256.Sum256([]byte("container id")) - cid.SetSHA256(sha) + id := cidtest.GenerateWithChecksum(sha) v.SetMajor(3) v.SetMinor(2) table := eacl.NewTable() table.SetVersion(v) - table.SetCID(&cid) + table.SetCID(id) table.AddRecord(eacl.CreateRecord(eacl.ActionAllow, eacl.OperationPut)) v2 := table.ToV2() @@ -43,11 +42,10 @@ func TestTable(t *testing.T) { }) t.Run("create table", func(t *testing.T) { - var cid = new(container.ID) - cid.SetSHA256(sha256.Sum256([]byte("container id"))) + id := cidtest.Generate() - table := eacl.CreateTable(*cid) - require.Equal(t, cid, table.CID()) + table := eacl.CreateTable(*id) + require.Equal(t, id, table.CID()) require.Equal(t, *pkg.SDKVersion(), table.Version()) }) } diff --git a/pkg/audit/result.go b/pkg/audit/result.go index 9ebb564..047e40a 100644 --- a/pkg/audit/result.go +++ b/pkg/audit/result.go @@ -2,7 +2,7 @@ package audit import ( "github.com/nspcc-dev/neofs-api-go/pkg" - "github.com/nspcc-dev/neofs-api-go/pkg/container" + cid "github.com/nspcc-dev/neofs-api-go/pkg/container/id" "github.com/nspcc-dev/neofs-api-go/pkg/object" "github.com/nspcc-dev/neofs-api-go/v2/audit" "github.com/nspcc-dev/neofs-api-go/v2/refs" @@ -87,15 +87,15 @@ func (r *Result) SetAuditEpoch(epoch uint64) { } // ContainerID returns container under audit. -func (r *Result) ContainerID() *container.ID { - return container.NewIDFromV2( +func (r *Result) ContainerID() *cid.ID { + return cid.NewFromV2( (*audit.DataAuditResult)(r). GetContainerID(), ) } // SetContainerID sets container under audit. -func (r *Result) SetContainerID(id *container.ID) { +func (r *Result) SetContainerID(id *cid.ID) { (*audit.DataAuditResult)(r). SetContainerID(id.ToV2()) } diff --git a/pkg/audit/result_test.go b/pkg/audit/result_test.go index af4a497..56e683c 100644 --- a/pkg/audit/result_test.go +++ b/pkg/audit/result_test.go @@ -7,7 +7,7 @@ import ( "github.com/nspcc-dev/neofs-api-go/pkg" "github.com/nspcc-dev/neofs-api-go/pkg/audit" - "github.com/nspcc-dev/neofs-api-go/pkg/container" + cidtest "github.com/nspcc-dev/neofs-api-go/pkg/container/id/test" "github.com/nspcc-dev/neofs-api-go/pkg/object" "github.com/stretchr/testify/require" ) @@ -17,13 +17,6 @@ func testSHA256() (cs [sha256.Size]byte) { return } -func testCID() *container.ID { - cid := container.NewID() - cid.SetSHA256(testSHA256()) - - return cid -} - func testOID() *object.ID { id := object.NewID() id.SetSHA256(testSHA256()) @@ -39,7 +32,7 @@ func TestResult(t *testing.T) { r.SetAuditEpoch(epoch) require.Equal(t, epoch, r.AuditEpoch()) - cid := testCID() + cid := cidtest.Generate() r.SetContainerID(cid) require.Equal(t, cid, r.ContainerID()) @@ -90,7 +83,7 @@ func TestResult(t *testing.T) { func TestStorageGroupEncoding(t *testing.T) { r := audit.NewResult() r.SetAuditEpoch(13) - r.SetContainerID(testCID()) + r.SetContainerID(cidtest.Generate()) r.SetPublicKey([]byte{1, 2, 3}) r.SetPassSG([]*object.ID{testOID(), testOID()}) r.SetFailSG([]*object.ID{testOID(), testOID()}) diff --git a/pkg/client/container.go b/pkg/client/container.go index 66cf3f4..ae4ab36 100644 --- a/pkg/client/container.go +++ b/pkg/client/container.go @@ -8,6 +8,7 @@ import ( "github.com/nspcc-dev/neofs-api-go/pkg" "github.com/nspcc-dev/neofs-api-go/pkg/acl/eacl" "github.com/nspcc-dev/neofs-api-go/pkg/container" + cid "github.com/nspcc-dev/neofs-api-go/pkg/container/id" "github.com/nspcc-dev/neofs-api-go/pkg/owner" "github.com/nspcc-dev/neofs-api-go/pkg/session" "github.com/nspcc-dev/neofs-api-go/rpc/client" @@ -21,19 +22,19 @@ import ( // Container contains methods related to container and ACL. type Container interface { // PutContainer creates new container in the NeoFS network. - PutContainer(context.Context, *container.Container, ...CallOption) (*container.ID, error) + PutContainer(context.Context, *container.Container, ...CallOption) (*cid.ID, error) // GetContainer returns container by ID. - GetContainer(context.Context, *container.ID, ...CallOption) (*container.Container, error) + GetContainer(context.Context, *cid.ID, ...CallOption) (*container.Container, error) // ListContainers return container list with the provided owner. - ListContainers(context.Context, *owner.ID, ...CallOption) ([]*container.ID, error) + ListContainers(context.Context, *owner.ID, ...CallOption) ([]*cid.ID, error) // DeleteContainer removes container from NeoFS network. - DeleteContainer(context.Context, *container.ID, ...CallOption) error + DeleteContainer(context.Context, *cid.ID, ...CallOption) error // GetEACL returns extended ACL for a given container. - GetEACL(context.Context, *container.ID, ...CallOption) (*EACLWithSignature, error) + GetEACL(context.Context, *cid.ID, ...CallOption) (*EACLWithSignature, error) // SetEACL sets extended ACL. SetEACL(context.Context, *eacl.Table, ...CallOption) error @@ -71,7 +72,7 @@ func (e EACLWithSignature) Signature() *pkg.Signature { return e.table.Signature() } -func (c *clientImpl) PutContainer(ctx context.Context, cnr *container.Container, opts ...CallOption) (*container.ID, error) { +func (c *clientImpl) PutContainer(ctx context.Context, cnr *container.Container, opts ...CallOption) (*cid.ID, error) { // apply all available options callOptions := c.defaultCallOptions() @@ -134,13 +135,13 @@ func (c *clientImpl) PutContainer(ctx context.Context, cnr *container.Container, return nil, fmt.Errorf("can't verify response message: %w", err) } - return container.NewIDFromV2(resp.GetBody().GetContainerID()), nil + return cid.NewFromV2(resp.GetBody().GetContainerID()), nil } // GetContainer receives container structure through NeoFS API call. // // Returns error if container structure is received but does not meet NeoFS API specification. -func (c *clientImpl) GetContainer(ctx context.Context, id *container.ID, opts ...CallOption) (*container.Container, error) { +func (c *clientImpl) GetContainer(ctx context.Context, id *cid.ID, opts ...CallOption) (*container.Container, error) { // apply all available options callOptions := c.defaultCallOptions() @@ -192,7 +193,7 @@ func (c *clientImpl) GetContainer(ctx context.Context, id *container.ID, opts .. // which checks if the structure of the resulting container matches its identifier. // // Returns an error if container does not match the identifier. -func GetVerifiedContainerStructure(ctx context.Context, c Client, id *container.ID, opts ...CallOption) (*container.Container, error) { +func GetVerifiedContainerStructure(ctx context.Context, c Client, id *cid.ID, opts ...CallOption) (*container.Container, error) { cnr, err := c.GetContainer(ctx, id, opts...) if err != nil { return nil, err @@ -205,7 +206,7 @@ func GetVerifiedContainerStructure(ctx context.Context, c Client, id *container. return cnr, nil } -func (c *clientImpl) ListContainers(ctx context.Context, ownerID *owner.ID, opts ...CallOption) ([]*container.ID, error) { +func (c *clientImpl) ListContainers(ctx context.Context, ownerID *owner.ID, opts ...CallOption) ([]*cid.ID, error) { // apply all available options callOptions := c.defaultCallOptions() @@ -245,15 +246,15 @@ func (c *clientImpl) ListContainers(ctx context.Context, ownerID *owner.ID, opts return nil, fmt.Errorf("can't verify response message: %w", err) } - result := make([]*container.ID, 0, len(resp.GetBody().GetContainerIDs())) + result := make([]*cid.ID, 0, len(resp.GetBody().GetContainerIDs())) for _, cidV2 := range resp.GetBody().GetContainerIDs() { - result = append(result, container.NewIDFromV2(cidV2)) + result = append(result, cid.NewFromV2(cidV2)) } return result, nil } -func (c *clientImpl) DeleteContainer(ctx context.Context, id *container.ID, opts ...CallOption) error { +func (c *clientImpl) DeleteContainer(ctx context.Context, id *cid.ID, opts ...CallOption) error { // apply all available options callOptions := c.defaultCallOptions() @@ -301,7 +302,7 @@ func (c *clientImpl) DeleteContainer(ctx context.Context, id *container.ID, opts return nil } -func (c *clientImpl) GetEACL(ctx context.Context, id *container.ID, opts ...CallOption) (*EACLWithSignature, error) { +func (c *clientImpl) GetEACL(ctx context.Context, id *cid.ID, opts ...CallOption) (*EACLWithSignature, error) { // apply all available options callOptions := c.defaultCallOptions() diff --git a/pkg/client/object.go b/pkg/client/object.go index a362b32..5f178af 100644 --- a/pkg/client/object.go +++ b/pkg/client/object.go @@ -9,7 +9,7 @@ import ( "fmt" "io" - "github.com/nspcc-dev/neofs-api-go/pkg/container" + cid "github.com/nspcc-dev/neofs-api-go/pkg/container/id" "github.com/nspcc-dev/neofs-api-go/pkg/object" "github.com/nspcc-dev/neofs-api-go/rpc/client" signer "github.com/nspcc-dev/neofs-api-go/util/signature" @@ -106,7 +106,7 @@ type RangeChecksumParams struct { } type SearchObjectParams struct { - cid *container.ID + cid *cid.ID filters object.SearchFilters } @@ -1092,7 +1092,7 @@ func (c *clientImpl) objectPayloadRangeHash(ctx context.Context, p *RangeChecksu return res, nil } -func (p *SearchObjectParams) WithContainerID(v *container.ID) *SearchObjectParams { +func (p *SearchObjectParams) WithContainerID(v *cid.ID) *SearchObjectParams { if p != nil { p.cid = v } @@ -1100,7 +1100,7 @@ func (p *SearchObjectParams) WithContainerID(v *container.ID) *SearchObjectParam return p } -func (p *SearchObjectParams) ContainerID() *container.ID { +func (p *SearchObjectParams) ContainerID() *cid.ID { if p != nil { return p.cid } diff --git a/pkg/client/opts.go b/pkg/client/opts.go index 6c04f8d..97132f8 100644 --- a/pkg/client/opts.go +++ b/pkg/client/opts.go @@ -6,6 +6,7 @@ import ( "time" "github.com/nspcc-dev/neofs-api-go/pkg" + "github.com/nspcc-dev/neofs-api-go/pkg/session" "github.com/nspcc-dev/neofs-api-go/pkg/token" "github.com/nspcc-dev/neofs-api-go/rpc/client" "github.com/nspcc-dev/neofs-api-go/v2/refs" @@ -24,7 +25,7 @@ type ( ttl uint32 epoch uint64 key *ecdsa.PrivateKey - session *token.SessionToken + session *session.Token bearer *token.BearerToken } @@ -75,7 +76,7 @@ func WithEpoch(epoch uint64) CallOption { } } -func WithSession(token *token.SessionToken) CallOption { +func WithSession(token *session.Token) CallOption { return func(opts *callOptions) { opts.session = token } diff --git a/pkg/client/session.go b/pkg/client/session.go index 5e3048b..24bae6a 100644 --- a/pkg/client/session.go +++ b/pkg/client/session.go @@ -6,7 +6,7 @@ import ( "fmt" "github.com/nspcc-dev/neofs-api-go/pkg/owner" - "github.com/nspcc-dev/neofs-api-go/pkg/token" + "github.com/nspcc-dev/neofs-api-go/pkg/session" "github.com/nspcc-dev/neofs-api-go/rpc/client" rpcapi "github.com/nspcc-dev/neofs-api-go/v2/rpc" v2session "github.com/nspcc-dev/neofs-api-go/v2/session" @@ -16,12 +16,12 @@ import ( // Session contains session-related methods. type Session interface { // CreateSession creates session using provided expiration time. - CreateSession(context.Context, uint64, ...CallOption) (*token.SessionToken, error) + CreateSession(context.Context, uint64, ...CallOption) (*session.Token, error) } var errMalformedResponseBody = errors.New("malformed response body") -func (c *clientImpl) CreateSession(ctx context.Context, expiration uint64, opts ...CallOption) (*token.SessionToken, error) { +func (c *clientImpl) CreateSession(ctx context.Context, expiration uint64, opts ...CallOption) (*session.Token, error) { // apply all available options callOptions := c.defaultCallOptions() @@ -65,7 +65,7 @@ func (c *clientImpl) CreateSession(ctx context.Context, expiration uint64, opts return nil, errMalformedResponseBody } - sessionToken := token.NewSessionToken() + sessionToken := session.NewToken() sessionToken.SetID(body.GetID()) sessionToken.SetSessionKey(body.GetSessionKey()) sessionToken.SetOwnerID(ownerID) diff --git a/pkg/container/announcement.go b/pkg/container/announcement.go index 8af1950..6d82966 100644 --- a/pkg/container/announcement.go +++ b/pkg/container/announcement.go @@ -1,6 +1,7 @@ package container import ( + cid "github.com/nspcc-dev/neofs-api-go/pkg/container/id" "github.com/nspcc-dev/neofs-api-go/v2/container" ) @@ -30,14 +31,14 @@ func (a *UsedSpaceAnnouncement) SetEpoch(epoch uint64) { } // ContainerID of the announcement. -func (a *UsedSpaceAnnouncement) ContainerID() *ID { - return NewIDFromV2( +func (a *UsedSpaceAnnouncement) ContainerID() *cid.ID { + return cid.NewFromV2( (*container.UsedSpaceAnnouncement)(a).GetContainerID(), ) } // SetContainerID sets announcement container value. -func (a *UsedSpaceAnnouncement) SetContainerID(cid *ID) { +func (a *UsedSpaceAnnouncement) SetContainerID(cid *cid.ID) { (*container.UsedSpaceAnnouncement)(a).SetContainerID(cid.ToV2()) } diff --git a/pkg/container/announcement_test.go b/pkg/container/announcement_test.go index 011b297..9345c28 100644 --- a/pkg/container/announcement_test.go +++ b/pkg/container/announcement_test.go @@ -5,6 +5,8 @@ import ( "testing" "github.com/nspcc-dev/neofs-api-go/pkg/container" + cid "github.com/nspcc-dev/neofs-api-go/pkg/container/id" + cidtest "github.com/nspcc-dev/neofs-api-go/pkg/container/id/test" "github.com/nspcc-dev/neofs-api-go/v2/refs" "github.com/stretchr/testify/require" ) @@ -12,18 +14,17 @@ import ( func TestAnnouncement(t *testing.T) { const epoch, usedSpace uint64 = 10, 100 - cidValue := [32]byte{1, 2, 3} - cid := container.NewID() - cid.SetSHA256(cidValue) + cidValue := [sha256.Size]byte{1, 2, 3} + id := cidtest.GenerateWithChecksum(cidValue) a := container.NewAnnouncement() a.SetEpoch(epoch) - a.SetContainerID(cid) + a.SetContainerID(id) a.SetUsedSpace(usedSpace) require.Equal(t, epoch, a.Epoch()) require.Equal(t, usedSpace, a.UsedSpace()) - require.Equal(t, cid, a.ContainerID()) + require.Equal(t, id, a.ContainerID()) t.Run("test v2", func(t *testing.T) { const newEpoch, newUsedSpace uint64 = 20, 200 @@ -45,7 +46,7 @@ func TestAnnouncement(t *testing.T) { require.Equal(t, newEpoch, newA.Epoch()) require.Equal(t, newUsedSpace, newA.UsedSpace()) - require.Equal(t, container.NewIDFromV2(newCID), newA.ContainerID()) + require.Equal(t, cid.NewFromV2(newCID), newA.ContainerID()) }) } @@ -54,8 +55,7 @@ func TestUsedSpaceEncoding(t *testing.T) { a.SetUsedSpace(13) a.SetEpoch(666) - id := container.NewID() - id.SetSHA256([sha256.Size]byte{1, 2, 3}) + id := cidtest.Generate() a.SetContainerID(id) diff --git a/pkg/container/container.go b/pkg/container/container.go index 5b07a55..264bab0 100644 --- a/pkg/container/container.go +++ b/pkg/container/container.go @@ -5,6 +5,7 @@ import ( "github.com/google/uuid" "github.com/nspcc-dev/neofs-api-go/pkg" + cid "github.com/nspcc-dev/neofs-api-go/pkg/container/id" "github.com/nspcc-dev/neofs-api-go/pkg/netmap" "github.com/nspcc-dev/neofs-api-go/pkg/owner" "github.com/nspcc-dev/neofs-api-go/pkg/session" @@ -63,13 +64,13 @@ func NewContainerFromV2(c *container.Container) *Container { // CalculateID calculates container identifier // based on its structure. -func CalculateID(c *Container) *ID { +func CalculateID(c *Container) *cid.ID { data, err := c.ToV2().StableMarshal(nil) if err != nil { panic(err) } - id := NewID() + id := cid.New() id.SetSHA256(sha256.Sum256(data)) return id diff --git a/pkg/container/container_test.go b/pkg/container/container_test.go index d1fb7bd..4792db0 100644 --- a/pkg/container/container_test.go +++ b/pkg/container/container_test.go @@ -10,7 +10,7 @@ import ( "github.com/nspcc-dev/neofs-api-go/pkg/container" "github.com/nspcc-dev/neofs-api-go/pkg/netmap" "github.com/nspcc-dev/neofs-api-go/pkg/owner" - "github.com/nspcc-dev/neofs-api-go/pkg/token" + sessiontest "github.com/nspcc-dev/neofs-api-go/pkg/session/test" "github.com/nspcc-dev/neofs-crypto/test" "github.com/stretchr/testify/require" ) @@ -98,8 +98,7 @@ func TestContainerEncoding(t *testing.T) { } func TestContainer_SessionToken(t *testing.T) { - tok := token.NewSessionToken() - tok.SetID([]byte{1, 2, 3}) + tok := sessiontest.Generate() cnr := container.New() diff --git a/pkg/container/id/id_test.go b/pkg/container/id/id_test.go index 3975519..6aeca3c 100644 --- a/pkg/container/id/id_test.go +++ b/pkg/container/id/id_test.go @@ -16,11 +16,9 @@ func randSHA256Checksum() (cs [sha256.Size]byte) { } func TestID_ToV2(t *testing.T) { - id := cid.New() - checksum := randSHA256Checksum() - id.SetSHA256(checksum) + id := cidtest.GenerateWithChecksum(checksum) idV2 := id.ToV2() diff --git a/pkg/object/address.go b/pkg/object/address.go index a2281a7..a241e63 100644 --- a/pkg/object/address.go +++ b/pkg/object/address.go @@ -4,7 +4,7 @@ import ( "errors" "strings" - "github.com/nspcc-dev/neofs-api-go/pkg/container" + cid "github.com/nspcc-dev/neofs-api-go/pkg/container/id" "github.com/nspcc-dev/neofs-api-go/v2/refs" ) @@ -36,14 +36,14 @@ func (a *Address) ToV2() *refs.Address { } // ContainerID returns container identifier. -func (a *Address) ContainerID() *container.ID { - return container.NewIDFromV2( +func (a *Address) ContainerID() *cid.ID { + return cid.NewFromV2( (*refs.Address)(a).GetContainerID(), ) } // SetContainerID sets container identifier. -func (a *Address) SetContainerID(id *container.ID) { +func (a *Address) SetContainerID(id *cid.ID) { (*refs.Address)(a).SetContainerID(id.ToV2()) } @@ -64,20 +64,20 @@ func (a *Address) Parse(s string) error { var ( err error oid = NewID() - cid = container.NewID() + id = cid.New() parts = strings.Split(s, addressSeparator) ) if len(parts) != addressParts { return errInvalidAddressString - } else if err = cid.Parse(parts[0]); err != nil { + } else if err = id.Parse(parts[0]); err != nil { return err } else if err = oid.Parse(parts[1]); err != nil { return err } a.SetObjectID(oid) - a.SetContainerID(cid) + a.SetContainerID(id) return nil } diff --git a/pkg/object/address_test.go b/pkg/object/address_test.go index e17fc4d..652f44b 100644 --- a/pkg/object/address_test.go +++ b/pkg/object/address_test.go @@ -4,19 +4,18 @@ import ( "strings" "testing" - "github.com/nspcc-dev/neofs-api-go/pkg/container" + cidtest "github.com/nspcc-dev/neofs-api-go/pkg/container/id/test" "github.com/stretchr/testify/require" ) func TestAddress_SetContainerID(t *testing.T) { a := NewAddress() - cid := container.NewID() - cid.SetSHA256(randSHA256Checksum(t)) + id := cidtest.Generate() - a.SetContainerID(cid) + a.SetContainerID(id) - require.Equal(t, cid, a.ContainerID()) + require.Equal(t, id, a.ContainerID()) } func TestAddress_SetObjectID(t *testing.T) { @@ -30,8 +29,7 @@ func TestAddress_SetObjectID(t *testing.T) { } func TestAddress_Parse(t *testing.T) { - cid := container.NewID() - cid.SetSHA256(randSHA256Checksum(t)) + cid := cidtest.Generate() oid := NewID() oid.SetSHA256(randSHA256Checksum(t)) @@ -64,7 +62,7 @@ func TestAddress_Parse(t *testing.T) { func TestAddressEncoding(t *testing.T) { a := NewAddress() a.SetObjectID(randID(t)) - a.SetContainerID(randCID(t)) + a.SetContainerID(cidtest.Generate()) t.Run("binary", func(t *testing.T) { data, err := a.Marshal() diff --git a/pkg/object/raw.go b/pkg/object/raw.go index b7b3b17..88ac076 100644 --- a/pkg/object/raw.go +++ b/pkg/object/raw.go @@ -2,9 +2,9 @@ package object import ( "github.com/nspcc-dev/neofs-api-go/pkg" - "github.com/nspcc-dev/neofs-api-go/pkg/container" + cid "github.com/nspcc-dev/neofs-api-go/pkg/container/id" "github.com/nspcc-dev/neofs-api-go/pkg/owner" - "github.com/nspcc-dev/neofs-api-go/pkg/token" + "github.com/nspcc-dev/neofs-api-go/pkg/session" "github.com/nspcc-dev/neofs-api-go/v2/object" ) @@ -71,7 +71,7 @@ func (o *RawObject) SetPayloadSize(v uint64) { } // SetContainerID sets identifier of the related container. -func (o *RawObject) SetContainerID(v *container.ID) { +func (o *RawObject) SetContainerID(v *cid.ID) { o.setContainerID(v) } @@ -127,7 +127,7 @@ func (o *RawObject) SetParent(v *Object) { // SetSessionToken sets token of the session // within which object was created. -func (o *RawObject) SetSessionToken(v *token.SessionToken) { +func (o *RawObject) SetSessionToken(v *session.Token) { o.setSessionToken(v) } diff --git a/pkg/object/raw_test.go b/pkg/object/raw_test.go index 902e3fa..d9febfd 100644 --- a/pkg/object/raw_test.go +++ b/pkg/object/raw_test.go @@ -6,9 +6,9 @@ import ( "testing" "github.com/nspcc-dev/neofs-api-go/pkg" - "github.com/nspcc-dev/neofs-api-go/pkg/container" - "github.com/nspcc-dev/neofs-api-go/pkg/owner" - "github.com/nspcc-dev/neofs-api-go/pkg/token" + cidtest "github.com/nspcc-dev/neofs-api-go/pkg/container/id/test" + ownertest "github.com/nspcc-dev/neofs-api-go/pkg/owner/test" + sessiontest "github.com/nspcc-dev/neofs-api-go/pkg/session/test" "github.com/nspcc-dev/neofs-api-go/v2/object" "github.com/stretchr/testify/require" ) @@ -20,13 +20,6 @@ func randID(t *testing.T) *ID { return id } -func randCID(t *testing.T) *container.ID { - id := container.NewID() - id.SetSHA256(randSHA256Checksum(t)) - - return id -} - func randSHA256Checksum(t *testing.T) (cs [sha256.Size]byte) { _, err := rand.Read(cs[:]) require.NoError(t, err) @@ -98,10 +91,7 @@ func TestRawObject_SetPayloadSize(t *testing.T) { func TestRawObject_SetContainerID(t *testing.T) { obj := NewRaw() - checksum := randSHA256Checksum(t) - - cid := container.NewID() - cid.SetSHA256(checksum) + cid := cidtest.Generate() obj.SetContainerID(cid) @@ -111,11 +101,7 @@ func TestRawObject_SetContainerID(t *testing.T) { func TestRawObject_SetOwnerID(t *testing.T) { obj := NewRaw() - w := new(owner.NEO3Wallet) - _, _ = rand.Read(w.Bytes()) - - ownerID := owner.NewID() - ownerID.SetNeo3Wallet(w) + ownerID := ownertest.Generate() obj.SetOwnerID(ownerID) @@ -208,7 +194,7 @@ func TestRawObject_SetParent(t *testing.T) { par := NewRaw() par.SetID(randID(t)) - par.SetContainerID(container.NewID()) + par.SetContainerID(cidtest.Generate()) par.SetSignature(pkg.NewSignature()) parObj := par.Object() @@ -230,8 +216,7 @@ func TestRawObject_ToV2(t *testing.T) { func TestRawObject_SetSessionToken(t *testing.T) { obj := NewRaw() - tok := token.NewSessionToken() - tok.SetID([]byte{1, 2, 3}) + tok := sessiontest.Generate() obj.SetSessionToken(tok) diff --git a/pkg/object/rw.go b/pkg/object/rw.go index 35e56f1..52c24d6 100644 --- a/pkg/object/rw.go +++ b/pkg/object/rw.go @@ -2,9 +2,9 @@ package object import ( "github.com/nspcc-dev/neofs-api-go/pkg" - "github.com/nspcc-dev/neofs-api-go/pkg/container" + cid "github.com/nspcc-dev/neofs-api-go/pkg/container/id" "github.com/nspcc-dev/neofs-api-go/pkg/owner" - "github.com/nspcc-dev/neofs-api-go/pkg/token" + "github.com/nspcc-dev/neofs-api-go/pkg/session" "github.com/nspcc-dev/neofs-api-go/v2/object" "github.com/nspcc-dev/neofs-api-go/v2/refs" ) @@ -108,15 +108,15 @@ func (o *rwObject) setPayloadSize(v uint64) { } // ContainerID returns identifier of the related container. -func (o *rwObject) ContainerID() *container.ID { - return container.NewIDFromV2( +func (o *rwObject) ContainerID() *cid.ID { + return cid.NewFromV2( (*object.Object)(o). GetHeader(). GetContainerID(), ) } -func (o *rwObject) setContainerID(v *container.ID) { +func (o *rwObject) setContainerID(v *cid.ID) { o.setHeaderField(func(h *object.Header) { h.SetContainerID(v.ToV2()) }) @@ -327,15 +327,15 @@ func (o *rwObject) resetRelations() { // SessionToken returns token of the session // within which object was created. -func (o *rwObject) SessionToken() *token.SessionToken { - return token.NewSessionTokenFromV2( +func (o *rwObject) SessionToken() *session.Token { + return session.NewTokenFromV2( (*object.Object)(o). GetHeader(). GetSessionToken(), ) } -func (o *rwObject) setSessionToken(v *token.SessionToken) { +func (o *rwObject) setSessionToken(v *session.Token) { o.setHeaderField(func(h *object.Header) { h.SetSessionToken(v.ToV2()) }) diff --git a/pkg/object/search.go b/pkg/object/search.go index 84c3303..9622ec2 100644 --- a/pkg/object/search.go +++ b/pkg/object/search.go @@ -5,7 +5,7 @@ import ( "fmt" "github.com/nspcc-dev/neofs-api-go/pkg" - "github.com/nspcc-dev/neofs-api-go/pkg/container" + cid "github.com/nspcc-dev/neofs-api-go/pkg/container/id" "github.com/nspcc-dev/neofs-api-go/pkg/owner" v2object "github.com/nspcc-dev/neofs-api-go/v2/object" ) @@ -199,7 +199,7 @@ func (f *SearchFilters) AddObjectVersionFilter(op SearchMatchType, v *pkg.Versio f.addReservedFilter(op, fKeyVersion, v) } -func (f *SearchFilters) AddObjectContainerIDFilter(m SearchMatchType, id *container.ID) { +func (f *SearchFilters) AddObjectContainerIDFilter(m SearchMatchType, id *cid.ID) { f.addReservedFilter(m, fKeyContainerID, id) } diff --git a/pkg/owner/id_test.go b/pkg/owner/id_test.go index c6d7bc2..9ab2e30 100644 --- a/pkg/owner/id_test.go +++ b/pkg/owner/id_test.go @@ -1,7 +1,6 @@ package owner_test import ( - "crypto/rand" "strconv" "testing" @@ -12,21 +11,8 @@ import ( "github.com/stretchr/testify/require" ) -func randID(t *testing.T) *ID { - id := NewID() - - wallet := new(NEO3Wallet) - - _, err := rand.Read(wallet.Bytes()) - require.NoError(t, err) - - id.SetNeo3Wallet(wallet) - - return id -} - func TestIDV2(t *testing.T) { - id := randID(t) + id := ownertest.Generate() idV2 := id.ToV2() @@ -73,7 +59,7 @@ func TestID_Parse(t *testing.T) { } func TestIDEncoding(t *testing.T) { - id := randID(t) + id := ownertest.Generate() t.Run("binary", func(t *testing.T) { data, err := id.Marshal() diff --git a/pkg/session/session_test.go b/pkg/session/session_test.go index 5476f15..6358cea 100644 --- a/pkg/session/session_test.go +++ b/pkg/session/session_test.go @@ -1,10 +1,9 @@ package session_test import ( - "crypto/rand" "testing" - "github.com/nspcc-dev/neofs-api-go/pkg/owner" + ownertest "github.com/nspcc-dev/neofs-api-go/pkg/owner/test" "github.com/nspcc-dev/neofs-api-go/pkg/session" sessiontest "github.com/nspcc-dev/neofs-api-go/pkg/session/test" "github.com/stretchr/testify/require" @@ -22,12 +21,7 @@ func TestSessionToken_SetID(t *testing.T) { func TestSessionToken_SetOwnerID(t *testing.T) { token := session.NewToken() - w := new(owner.NEO3Wallet) - _, err := rand.Read(w.Bytes()) - require.NoError(t, err) - - ownerID := owner.NewID() - ownerID.SetNeo3Wallet(w) + ownerID := ownertest.Generate() token.SetOwnerID(ownerID) diff --git a/pkg/token/bearer_test.go b/pkg/token/bearer_test.go index 353a1b7..afcde5a 100644 --- a/pkg/token/bearer_test.go +++ b/pkg/token/bearer_test.go @@ -27,7 +27,7 @@ func TestBearerToken_Issuer(t *testing.T) { bearerToken.SetEACLTable(eacl.NewTable()) require.NoError(t, bearerToken.SignToken(key)) - require.Equal(t, bearerToken.Issuer().String(), ownerID.String()) + require.True(t, ownerID.Equal(bearerToken.Issuer())) }) } diff --git a/pkg/token/session_test.go b/pkg/token/session_test.go deleted file mode 100644 index 8a399ae..0000000 --- a/pkg/token/session_test.go +++ /dev/null @@ -1,67 +0,0 @@ -package token - -import ( - "crypto/rand" - "testing" - - "github.com/nspcc-dev/neofs-api-go/pkg/owner" - "github.com/stretchr/testify/require" -) - -func TestSessionToken_SetID(t *testing.T) { - token := NewSessionToken() - - id := []byte{1, 2, 3} - token.SetID(id) - - require.Equal(t, id, token.ID()) -} - -func TestSessionToken_SetOwnerID(t *testing.T) { - token := NewSessionToken() - - w := new(owner.NEO3Wallet) - _, err := rand.Read(w.Bytes()) - require.NoError(t, err) - - ownerID := owner.NewID() - ownerID.SetNeo3Wallet(w) - - token.SetOwnerID(ownerID) - - require.Equal(t, ownerID, token.OwnerID()) -} - -func TestSessionToken_SetSessionKey(t *testing.T) { - token := NewSessionToken() - - key := []byte{1, 2, 3} - token.SetSessionKey(key) - - require.Equal(t, key, token.SessionKey()) -} - -func TestSessionTokenEncoding(t *testing.T) { - tok := NewSessionToken() - tok.SetID([]byte("id")) - - t.Run("binary", func(t *testing.T) { - data, err := tok.Marshal() - require.NoError(t, err) - - tok2 := NewSessionToken() - require.NoError(t, tok2.Unmarshal(data)) - - require.Equal(t, tok, tok2) - }) - - t.Run("json", func(t *testing.T) { - data, err := tok.MarshalJSON() - require.NoError(t, err) - - tok2 := NewSessionToken() - require.NoError(t, tok2.UnmarshalJSON(data)) - - require.Equal(t, tok, tok2) - }) -} From 52c1c4c5ab90a5e6f4c93b615bc719fdeda5e890 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Thu, 27 May 2021 15:21:58 +0300 Subject: [PATCH 0778/1196] [#290] client: Add `WithURIAddress` option Add `WithURIAddress` option to client. It parses passed address with `url.ParseRequestURI` function and use(or not) TLS over grpc connection based on retrieved scheme('grpc' or 'grpcs'). Signed-off-by: Pavel Karpy --- pkg/client/opts.go | 48 +++++++-- rpc/client/options.go | 48 ++++++++- rpc/client/options_test.go | 197 +++++++++++++++++++++++++++++++++++++ 3 files changed, 284 insertions(+), 9 deletions(-) create mode 100644 rpc/client/options_test.go diff --git a/pkg/client/opts.go b/pkg/client/opts.go index 97132f8..8a998ed 100644 --- a/pkg/client/opts.go +++ b/pkg/client/opts.go @@ -116,19 +116,19 @@ func defaultClientOptions() *clientOptions { } } +// WithAddress returns option to specify +// network address of the remote server. +// +// Ignored if WithGRPCConnection is provided. func WithAddress(addr string) Option { return func(opts *clientOptions) { opts.rawOpts = append(opts.rawOpts, client.WithNetworkAddress(addr)) } } -func WithGRPCConnection(grpcConn *grpc.ClientConn) Option { - return func(opts *clientOptions) { - opts.rawOpts = append(opts.rawOpts, client.WithGRPCConn(grpcConn)) - } -} - // WithDialTimeout returns option to set connection timeout to the remote node. +// +// Ignored if WithGRPCConn is provided. func WithDialTimeout(dur time.Duration) Option { return func(opts *clientOptions) { opts.rawOpts = append(opts.rawOpts, client.WithDialTimeout(dur)) @@ -136,6 +136,8 @@ func WithDialTimeout(dur time.Duration) Option { } // WithTLSConfig returns option to set connection's TLS config to the remote node. +// +// Ignored if WithGRPCConnection is provided. func WithTLSConfig(cfg *tls.Config) Option { return func(opts *clientOptions) { opts.rawOpts = append(opts.rawOpts, client.WithTLSCfg(cfg)) @@ -149,3 +151,37 @@ func WithDefaultPrivateKey(key *ecdsa.PrivateKey) Option { opts.key = key } } + +// WithURIAddress returns option to specify +// network address of a remote server and connection +// scheme for it. +// +// Format of the URI: +// +// [scheme://]host:port +// +// Supported schemes: +// - grpc; +// - grpcs. +// +// tls.Cfg second argument is optional and is taken into +// account only in case of `grpcs` scheme. +// +// Falls back to WithNetworkAddress if address is not a valid URI. +// +// Do not use along with WithAddress and WithTLSConfig. +// +// Ignored if WithGRPCConnection is provided. +func WithURIAddress(addr string, tlsCfg *tls.Config) Option { + return func(opts *clientOptions) { + opts.rawOpts = append(opts.rawOpts, client.WithNetworkURIAddress(addr, tlsCfg)...) + } +} + +// WithGRPCConnection returns option to set GRPC connection to +// the remote node. +func WithGRPCConnection(grpcConn *grpc.ClientConn) Option { + return func(opts *clientOptions) { + opts.rawOpts = append(opts.rawOpts, client.WithGRPCConn(grpcConn)) + } +} diff --git a/rpc/client/options.go b/rpc/client/options.go index 0dcabfb..dd89f51 100644 --- a/rpc/client/options.go +++ b/rpc/client/options.go @@ -2,11 +2,17 @@ package client import ( "crypto/tls" + "net/url" "time" "google.golang.org/grpc" ) +const ( + grpcScheme = "grpc" + grpcTLSScheme = "grpcs" +) + // Option is a Client's option. type Option func(*cfg) @@ -40,6 +46,44 @@ func WithNetworkAddress(v string) Option { } } +// WithNetworkURIAddress combines WithNetworkAddress and WithTLSCfg options +// based on arguments. +// +// Do not use along with WithNetworkAddress and WithTLSCfg. +// +// Ignored if WithGRPCConn is provided. +func WithNetworkURIAddress(addr string, tlsCfg *tls.Config) []Option { + uri, err := url.ParseRequestURI(addr) + if err != nil { + return []Option{WithNetworkAddress(addr)} + } + + // check if passed string was parsed correctly + // URIs that do not start with a slash after the scheme are interpreted as: + // `scheme:opaque` => if `opaque` is not empty, then it is supposed that URI + // is in `host:port` format + if uri.Opaque != "" { + return []Option{WithNetworkAddress(addr)} + } + + switch uri.Scheme { + case grpcScheme: + tlsCfg = nil + case grpcTLSScheme: + if tlsCfg == nil { + tlsCfg = &tls.Config{} + } + default: + // not supported scheme + return nil + } + + return []Option{ + WithNetworkAddress(uri.Host), + WithTLSCfg(tlsCfg), + } +} + // WithDialTimeout returns option to specify // dial timeout of the remote server connection. // @@ -58,9 +102,7 @@ func WithDialTimeout(v time.Duration) Option { // Ignored if WithGRPCConn is provided. func WithTLSCfg(v *tls.Config) Option { return func(c *cfg) { - if v != nil { - c.tlsCfg = v - } + c.tlsCfg = v } } diff --git a/rpc/client/options_test.go b/rpc/client/options_test.go new file mode 100644 index 0000000..eeb5a13 --- /dev/null +++ b/rpc/client/options_test.go @@ -0,0 +1,197 @@ +package client + +import ( + "crypto/tls" + "testing" + + "github.com/stretchr/testify/require" +) + +func TestWithNetworkURIAddress(t *testing.T) { + hostPort := "neofs.example.com:8080" + apiPort := "127.0.0.1:8080" + serverName := "testServer" + + testCases := []struct { + uri string + tlsConfig *tls.Config + + wantHost string + wantTLS bool + }{ + { + uri: grpcScheme + "://" + hostPort, + tlsConfig: nil, + wantHost: "neofs.example.com:8080", + wantTLS: false, + }, + { + uri: grpcScheme + "://" + hostPort, + tlsConfig: &tls.Config{}, + wantHost: "neofs.example.com:8080", + wantTLS: false, + }, + { + uri: grpcTLSScheme + "://" + hostPort, + tlsConfig: nil, + wantHost: "neofs.example.com:8080", + wantTLS: true, + }, + { + uri: grpcTLSScheme + "://" + hostPort, + tlsConfig: &tls.Config{ServerName: serverName}, + wantHost: "neofs.example.com:8080", + wantTLS: true, + }, + { + uri: "wrongScheme://" + hostPort, + tlsConfig: nil, + wantHost: "", + wantTLS: false, + }, + { + uri: "impossibleToParseIt", + tlsConfig: nil, + wantHost: "impossibleToParseIt", + wantTLS: false, + }, + { + uri: hostPort, + tlsConfig: nil, + wantHost: hostPort, + wantTLS: false, + }, + { + uri: apiPort, + tlsConfig: nil, + wantHost: apiPort, + wantTLS: false, + }, + } + + for _, test := range testCases { + cfg := &cfg{} + opts := WithNetworkURIAddress(test.uri, test.tlsConfig) + + for _, opt := range opts { + opt(cfg) + } + + require.Equal(t, test.wantHost, cfg.addr, test.uri) + require.Equal(t, test.wantTLS, cfg.tlsCfg != nil, test.uri) + // check if custom tlsConfig was applied + if test.tlsConfig != nil && test.wantTLS { + require.Equal(t, test.tlsConfig.ServerName, cfg.tlsCfg.ServerName, test.uri) + } + } +} + +func Test_WithNetworkAddress_WithTLS_WithNetworkURIAddress(t *testing.T) { + addr1, addr2 := "example1.com:8080", "example2.com:8080" + + testCases := []struct { + addr string + withTLS bool + + uri string + + wantHost string + wantTLS bool + }{ + { + addr: addr1, + withTLS: true, + + uri: grpcScheme + "://" + addr2, + + wantHost: addr2, + wantTLS: false, + }, + { + addr: addr1, + withTLS: false, + + uri: grpcTLSScheme + "://" + addr2, + + wantHost: addr2, + wantTLS: true, + }, + } + + for _, test := range testCases { + // order: + // 1. WithNetworkAddress + // 2. WithTLSCfg(if test.withTLS == true) + // 3. WithNetworkURIAddress + config := &cfg{} + opts := []Option{WithNetworkAddress(test.addr)} + + if test.withTLS { + opts = append(opts, WithTLSCfg(&tls.Config{})) + } + + opts = append(opts, WithNetworkURIAddress(test.uri, nil)...) + + for _, opt := range opts { + opt(config) + } + + require.Equal(t, test.wantHost, config.addr, test.addr) + require.Equal(t, test.wantTLS, config.tlsCfg != nil, test.addr) + } +} + +func Test_WithNetworkURIAddress_WithTLS_WithNetworkAddress(t *testing.T) { + addr1, addr2 := "example1.com:8080", "example2.com:8080" + + testCases := []struct { + addr string + withTLS bool + + uri string + + wantHost string + wantTLS bool + }{ + { + uri: grpcScheme + "://" + addr1, + + addr: addr2, + withTLS: true, + + wantHost: addr2, + wantTLS: true, + }, + { + uri: grpcTLSScheme + "://" + addr1, + + addr: addr2, + withTLS: false, + + wantHost: addr2, + wantTLS: true, + }, + } + + for _, test := range testCases { + // order: + // 1. WithNetworkURIAddress + // 2. WithNetworkAddress + // 3. WithTLSCfg(if test.withTLS == true) + config := &cfg{} + opts := WithNetworkURIAddress(test.uri, nil) + + opts = append(opts, WithNetworkAddress(test.addr)) + + if test.withTLS { + opts = append(opts, WithTLSCfg(&tls.Config{})) + } + + for _, opt := range opts { + opt(config) + } + + require.Equal(t, test.wantHost, config.addr, test.uri) + require.Equal(t, test.wantTLS, config.tlsCfg != nil, test.uri) + } +} From d31053388cc103e5705f2a9b6c2a8d9345c92825 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 2 Jun 2021 17:08:12 +0300 Subject: [PATCH 0779/1196] [#296] Update NEO Go library to v0.95.1 Signed-off-by: Leonard Lyubich --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 180beae..3f824eb 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/google/uuid v1.1.1 github.com/mr-tron/base58 v1.1.2 github.com/nspcc-dev/hrw v1.0.9 - github.com/nspcc-dev/neo-go v0.95.0 + github.com/nspcc-dev/neo-go v0.95.1 github.com/nspcc-dev/neofs-crypto v0.3.0 github.com/stretchr/testify v1.6.1 google.golang.org/grpc v1.29.1 diff --git a/go.sum b/go.sum index 4cb378c..5d2dbaa 100644 --- a/go.sum +++ b/go.sum @@ -135,8 +135,8 @@ github.com/nspcc-dev/hrw v1.0.9 h1:17VcAuTtrstmFppBjfRiia4K2wA/ukXZhLFS8Y8rz5Y= github.com/nspcc-dev/hrw v1.0.9/go.mod h1:l/W2vx83vMQo6aStyx2AuZrJ+07lGv2JQGlVkPG06MU= github.com/nspcc-dev/neo-go v0.73.1-pre.0.20200303142215-f5a1b928ce09/go.mod h1:pPYwPZ2ks+uMnlRLUyXOpLieaDQSEaf4NM3zHVbRjmg= github.com/nspcc-dev/neo-go v0.91.0/go.mod h1:G6HdOWvzQ6tlvFdvFSN/PgCzLPN/X/X4d5hTjFRUDcc= -github.com/nspcc-dev/neo-go v0.95.0 h1:bttArYkIuhBJWSZsZ1xVW8MJsj5SvZwAhqVN3HZPNbo= -github.com/nspcc-dev/neo-go v0.95.0/go.mod h1:bW07ge1WFXsBgqrcPpLUr6OcyQxHqM26MZNesWMdH0c= +github.com/nspcc-dev/neo-go v0.95.1 h1:5fgLFOul1Ax/maFkgLkD5rDUwY/nB/xX/Jpcd8hLHaI= +github.com/nspcc-dev/neo-go v0.95.1/go.mod h1:bW07ge1WFXsBgqrcPpLUr6OcyQxHqM26MZNesWMdH0c= github.com/nspcc-dev/neofs-api-go v1.24.0/go.mod h1:G7dqincfdjBrAbL5nxVp82emF05fSVEqe59ICsoRDI8= github.com/nspcc-dev/neofs-crypto v0.2.0/go.mod h1:F/96fUzPM3wR+UGsPi3faVNmFlA9KAEAUQR7dMxZmNA= github.com/nspcc-dev/neofs-crypto v0.2.3/go.mod h1:8w16GEJbH6791ktVqHN9YRNH3s9BEEKYxGhlFnp0cDw= From c2ab4398d5d59b954503e3baf10848d45c9039d1 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 3 Jun 2021 16:24:13 +0300 Subject: [PATCH 0780/1196] Update *.pb.go files and changelog for v1.27.0 release Signed-off-by: Leonard Lyubich --- CHANGELOG.md | 21 +++++++++++++++++++++ v2/session/grpc/types.pb.go | 4 +--- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4d61b8f..7b729f7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,25 @@ # Changelog +## [1.27.0] - 2021-06-03 - Seongmodo (석모도, 席毛島) + +### Added + +- Message structures related to Container service sessions in `v2` and `pkg`. +- `session.Token` and `Signature` to `pkg/container.Container` and `pkg/acl/eacl.Table`. +- `Conn` method of clients to get the underlying connection. +- `WithTLSConfig` client option to specify TLS configuration. +- `WithNetworkURIAddress` client option to specify URI of the remote server. +- Generators of random container IDs, owner IDs and session tokens (for testing). + +### Replaced + +- `pkg/token.SessionToken` type to `pkg/session` package as `Token`. Old type is deprecated. +- `pkg/container.ID` type to `pkg/container/id` package. Old type is deprecated. + +### Updated + +- NEO Go library to v0.95.1. + ## [1.26.1] - 2021-05-19 ### Changed @@ -605,3 +625,4 @@ Initial public release [1.25.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.24.0...v1.25.0 [1.26.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.25.0...v1.26.0 [1.26.1]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.26.0...v1.26.1 +[1.27.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.26.1...v1.27.0 diff --git a/v2/session/grpc/types.pb.go b/v2/session/grpc/types.pb.go index 209d413..eb4e103 100644 --- a/v2/session/grpc/types.pb.go +++ b/v2/session/grpc/types.pb.go @@ -215,7 +215,7 @@ func (x *ObjectSessionContext) GetAddress() *grpc.Address { return nil } -// Context information for Session Tokens related to ContainerService requests +// Context information for Session Tokens related to ContainerService requests. type ContainerSessionContext struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -224,11 +224,9 @@ type ContainerSessionContext struct { // Type of request for which the token is issued Verb ContainerSessionContext_Verb `protobuf:"varint,1,opt,name=verb,proto3,enum=neo.fs.v2.session.ContainerSessionContext_Verb" json:"verb,omitempty"` // Spreads the action to all owner containers. - // // If set, container_id field is ignored. Wildcard bool `protobuf:"varint,2,opt,name=wildcard,proto3" json:"wildcard,omitempty"` // Particular container to which the action applies. - // // Ignored if wildcard flag is set. ContainerId *grpc.ContainerID `protobuf:"bytes,3,opt,name=container_id,json=containerID,proto3" json:"container_id,omitempty"` } From 1f7f7f548eeb5ebe4a71d4a36b87a4b4c6264352 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 3 Jun 2021 16:52:34 +0300 Subject: [PATCH 0781/1196] Update readme for v1.27.0 release Signed-off-by: Leonard Lyubich --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 300a39d..3b3ef0d 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,7 @@ versions and SDK layer working with all of them in a handy way. |v1.24.x|[v2.4.0](https://github.com/nspcc-dev/neofs-api/releases/tag/v2.4.0)| |v1.25.x|[v2.5.0](https://github.com/nspcc-dev/neofs-api/releases/tag/v2.5.0)| |v1.26.x|[v2.6.0](https://github.com/nspcc-dev/neofs-api/releases/tag/v2.6.0)| +|v1.27.x|[v2.7.0](https://github.com/nspcc-dev/neofs-api/releases/tag/v2.7.0)| ## Contributing From 7968c4994a3c1c1d9ce8ed099cd8812f5c2dd3f2 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 4 Jun 2021 14:39:24 +0300 Subject: [PATCH 0782/1196] [#298] pkg/session: Remove redundant slashes from SetSessionKey docs Signed-off-by: Leonard Lyubich --- pkg/session/session.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/session/session.go b/pkg/session/session.go index 4d9780c..e407633 100644 --- a/pkg/session/session.go +++ b/pkg/session/session.go @@ -82,7 +82,7 @@ func (t *Token) SessionKey() []byte { } // SetSessionKey sets public key of the session -// // in a binary format. +// in a binary format. func (t *Token) SetSessionKey(v []byte) { t.setBodyField(func(body *session.SessionTokenBody) { body.SetSessionKey(v) From 779a61c97d39b0f61cfa5fae6c5b613e6ad352d7 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 4 Jun 2021 16:17:47 +0300 Subject: [PATCH 0783/1196] [#298] pkg/session: Implement methods to work with Token lifetime Implement `Exp`/`SetExp`/`Nbf`/`SetNbf`/`Iat`/`SetIat` methods on `Token` type which provide access to the message fields of the same name. Signed-off-by: Leonard Lyubich --- pkg/session/session.go | 57 +++++++++++++++++++++++++++++++++++++ pkg/session/session_test.go | 30 +++++++++++++++++++ 2 files changed, 87 insertions(+) diff --git a/pkg/session/session.go b/pkg/session/session.go index e407633..99b71a1 100644 --- a/pkg/session/session.go +++ b/pkg/session/session.go @@ -89,6 +89,63 @@ func (t *Token) SetSessionKey(v []byte) { }) } +func (t *Token) setLifetimeField(f func(*session.TokenLifetime)) { + t.setBodyField(func(body *session.SessionTokenBody) { + lt := body.GetLifetime() + if lt == nil { + lt = new(session.TokenLifetime) + body.SetLifetime(lt) + } + + f(lt) + }) +} + +// Exp returns epoch number of the token expiration. +func (t *Token) Exp() uint64 { + return (*session.SessionToken)(t). + GetBody(). + GetLifetime(). + GetExp() +} + +// SetExp sets epoch number of the token expiration. +func (t *Token) SetExp(exp uint64) { + t.setLifetimeField(func(lt *session.TokenLifetime) { + lt.SetExp(exp) + }) +} + +// Nbf returns starting epoch number of the token. +func (t *Token) Nbf() uint64 { + return (*session.SessionToken)(t). + GetBody(). + GetLifetime(). + GetNbf() +} + +// SetNbf sets starting epoch number of the token. +func (t *Token) SetNbf(nbf uint64) { + t.setLifetimeField(func(lt *session.TokenLifetime) { + lt.SetNbf(nbf) + }) +} + +// Iat returns starting epoch number of the token. +func (t *Token) Iat() uint64 { + return (*session.SessionToken)(t). + GetBody(). + GetLifetime(). + GetIat() +} + +// SetIat sets the number of the epoch in which the token was issued. +func (t *Token) SetIat(iat uint64) { + t.setLifetimeField(func(lt *session.TokenLifetime) { + lt.SetIat(iat) + }) +} + // Sign calculates and writes signature of the Token data. // // Returns signature calculation errors. diff --git a/pkg/session/session_test.go b/pkg/session/session_test.go index 6358cea..88ec809 100644 --- a/pkg/session/session_test.go +++ b/pkg/session/session_test.go @@ -132,3 +132,33 @@ func TestGetContainerContext(t *testing.T) { require.Nil(t, session.GetContainerContext(tok)) } } + +func TestToken_Exp(t *testing.T) { + tok := session.NewToken() + + const exp = 11 + + tok.SetExp(exp) + + require.EqualValues(t, exp, tok.Exp()) +} + +func TestToken_Nbf(t *testing.T) { + tok := session.NewToken() + + const nbf = 22 + + tok.SetNbf(nbf) + + require.EqualValues(t, nbf, tok.Nbf()) +} + +func TestToken_Iat(t *testing.T) { + tok := session.NewToken() + + const iat = 33 + + tok.SetIat(iat) + + require.EqualValues(t, iat, tok.Iat()) +} From cc1163fd579788df4650fac4a552b0bebf543f5f Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 4 Jun 2021 16:18:21 +0300 Subject: [PATCH 0784/1196] [#298] pkg/session/test: Set lifetime fields in Generate func Signed-off-by: Leonard Lyubich --- pkg/session/test/token.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg/session/test/token.go b/pkg/session/test/token.go index 8d51720..82c405b 100644 --- a/pkg/session/test/token.go +++ b/pkg/session/test/token.go @@ -32,6 +32,9 @@ func Generate() *session.Token { tok.SetID(uid) tok.SetOwnerID(ownerID) tok.SetSessionKey(keyBin) + tok.SetExp(11) + tok.SetNbf(22) + tok.SetIat(33) return tok } From 0f478a9dc6793802695f2fee650b7c041f60d665 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Mon, 7 Jun 2021 13:43:14 +0300 Subject: [PATCH 0785/1196] [#301] pkg/object: Add `MarshalHeaderJSON` method Signed-off-by: Pavel Karpy --- pkg/object/object.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkg/object/object.go b/pkg/object/object.go index e447be5..55000dc 100644 --- a/pkg/object/object.go +++ b/pkg/object/object.go @@ -37,3 +37,9 @@ func (o *Object) ToV2() *object.Object { return nil } + +// MarshalHeaderJSON marshals object's header +// into JSON format. +func (o *Object) MarshalHeaderJSON() ([]byte, error) { + return (*object.Object)(o.rwObject).GetHeader().MarshalJSON() +} From e0ac55c52637f859c225ac07ef3c9120ee7b1c1b Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 8 Jun 2021 11:04:35 +0300 Subject: [PATCH 0786/1196] [#293] pkg/accounting: Implement and use generator of Decimal Signed-off-by: Leonard Lyubich --- pkg/accounting/decimal_test.go | 5 ++--- pkg/accounting/test/decimal.go | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 3 deletions(-) create mode 100644 pkg/accounting/test/decimal.go diff --git a/pkg/accounting/decimal_test.go b/pkg/accounting/decimal_test.go index ecab5bb..7591097 100644 --- a/pkg/accounting/decimal_test.go +++ b/pkg/accounting/decimal_test.go @@ -4,6 +4,7 @@ import ( "testing" "github.com/nspcc-dev/neofs-api-go/pkg/accounting" + accountingtest "github.com/nspcc-dev/neofs-api-go/pkg/accounting/test" "github.com/stretchr/testify/require" ) @@ -26,9 +27,7 @@ func TestDecimal_Precision(t *testing.T) { } func TestDecimalEncoding(t *testing.T) { - d := accounting.NewDecimal() - d.SetValue(1) - d.SetPrecision(2) + d := accountingtest.Generate() t.Run("binary", func(t *testing.T) { data, err := d.Marshal() diff --git a/pkg/accounting/test/decimal.go b/pkg/accounting/test/decimal.go new file mode 100644 index 0000000..80014d8 --- /dev/null +++ b/pkg/accounting/test/decimal.go @@ -0,0 +1,14 @@ +package accountingtest + +import ( + "github.com/nspcc-dev/neofs-api-go/pkg/accounting" +) + +// Generate returns random accounting.Decimal. +func Generate() *accounting.Decimal { + d := accounting.NewDecimal() + d.SetValue(1) + d.SetPrecision(2) + + return d +} From 88a3829b3917871c0bb0e6e7baa7387cc244bd24 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 8 Jun 2021 11:18:36 +0300 Subject: [PATCH 0787/1196] [#293] pkg/eacl: Implement and use generator of Target Signed-off-by: Leonard Lyubich --- pkg/acl/eacl/test/generate.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 pkg/acl/eacl/test/generate.go diff --git a/pkg/acl/eacl/test/generate.go b/pkg/acl/eacl/test/generate.go new file mode 100644 index 0000000..25697e9 --- /dev/null +++ b/pkg/acl/eacl/test/generate.go @@ -0,0 +1,18 @@ +package eacltest + +import ( + "github.com/nspcc-dev/neofs-api-go/pkg/acl/eacl" +) + +// Target returns random eacl.Target. +func Target() *eacl.Target { + x := eacl.NewTarget() + + x.SetRole(eacl.RoleSystem) + x.SetBinaryKeys([][]byte{ + {1, 2, 3}, + {4, 5, 6}, + }) + + return x +} From f406463c344118871162d322d73d3c02ddc486a6 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 8 Jun 2021 11:22:58 +0300 Subject: [PATCH 0788/1196] [#293] pkg/eacl: Implement generator of Record Signed-off-by: Leonard Lyubich --- pkg/acl/eacl/test/generate.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/pkg/acl/eacl/test/generate.go b/pkg/acl/eacl/test/generate.go index 25697e9..1f5fcbd 100644 --- a/pkg/acl/eacl/test/generate.go +++ b/pkg/acl/eacl/test/generate.go @@ -2,6 +2,8 @@ package eacltest import ( "github.com/nspcc-dev/neofs-api-go/pkg/acl/eacl" + cidtest "github.com/nspcc-dev/neofs-api-go/pkg/container/id/test" + ownertest "github.com/nspcc-dev/neofs-api-go/pkg/owner/test" ) // Target returns random eacl.Target. @@ -16,3 +18,16 @@ func Target() *eacl.Target { return x } + +// Record returns random eacl.Record. +func Record() *eacl.Record { + x := eacl.NewRecord() + + x.SetAction(eacl.ActionAllow) + x.SetOperation(eacl.OperationRangeHash) + x.SetTargets(Target(), Target()) + x.AddObjectContainerIDFilter(eacl.MatchStringEqual, cidtest.Generate()) + x.AddObjectOwnerIDFilter(eacl.MatchStringNotEqual, ownertest.Generate()) + + return x +} From 72adf5f972e3951cfd5b77a80c0e8380bda5cd51 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 8 Jun 2021 11:26:23 +0300 Subject: [PATCH 0789/1196] [#293] pkg/eacl: Implement and use generator of Table Signed-off-by: Leonard Lyubich --- pkg/acl/eacl/table_test.go | 6 ++---- pkg/acl/eacl/test/generate.go | 12 ++++++++++++ 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/pkg/acl/eacl/table_test.go b/pkg/acl/eacl/table_test.go index f3638ca..06c7c7a 100644 --- a/pkg/acl/eacl/table_test.go +++ b/pkg/acl/eacl/table_test.go @@ -6,6 +6,7 @@ import ( "github.com/nspcc-dev/neofs-api-go/pkg" "github.com/nspcc-dev/neofs-api-go/pkg/acl/eacl" + eacltest "github.com/nspcc-dev/neofs-api-go/pkg/acl/eacl/test" cidtest "github.com/nspcc-dev/neofs-api-go/pkg/container/id/test" sessiontest "github.com/nspcc-dev/neofs-api-go/pkg/session/test" "github.com/stretchr/testify/require" @@ -65,10 +66,7 @@ func TestTable_AddRecord(t *testing.T) { } func TestRecordEncoding(t *testing.T) { - tab := eacl.NewTable() - tab.AddRecord( - eacl.CreateRecord(eacl.ActionDeny, eacl.OperationHead), - ) + tab := eacltest.Table() t.Run("binary", func(t *testing.T) { data, err := tab.Marshal() diff --git a/pkg/acl/eacl/test/generate.go b/pkg/acl/eacl/test/generate.go index 1f5fcbd..456871a 100644 --- a/pkg/acl/eacl/test/generate.go +++ b/pkg/acl/eacl/test/generate.go @@ -4,6 +4,7 @@ import ( "github.com/nspcc-dev/neofs-api-go/pkg/acl/eacl" cidtest "github.com/nspcc-dev/neofs-api-go/pkg/container/id/test" ownertest "github.com/nspcc-dev/neofs-api-go/pkg/owner/test" + sessiontest "github.com/nspcc-dev/neofs-api-go/pkg/session/test" ) // Target returns random eacl.Target. @@ -31,3 +32,14 @@ func Record() *eacl.Record { return x } + +func Table() *eacl.Table { + x := eacl.NewTable() + + x.SetCID(cidtest.Generate()) + x.SetSessionToken(sessiontest.Generate()) + x.AddRecord(Record()) + x.AddRecord(Record()) + + return x +} From dd0a883637d2c02fe55ced06ba2cb234359aa484 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 8 Jun 2021 11:38:29 +0300 Subject: [PATCH 0790/1196] [#293] pkg/object: Implement and use generator of ID Signed-off-by: Leonard Lyubich --- pkg/audit/result_test.go | 23 +++++------------------ pkg/storagegroup/storagegroup_test.go | 12 +++--------- 2 files changed, 8 insertions(+), 27 deletions(-) diff --git a/pkg/audit/result_test.go b/pkg/audit/result_test.go index 56e683c..4edd5fd 100644 --- a/pkg/audit/result_test.go +++ b/pkg/audit/result_test.go @@ -1,29 +1,16 @@ package audit_test import ( - "crypto/rand" - "crypto/sha256" "testing" "github.com/nspcc-dev/neofs-api-go/pkg" "github.com/nspcc-dev/neofs-api-go/pkg/audit" cidtest "github.com/nspcc-dev/neofs-api-go/pkg/container/id/test" "github.com/nspcc-dev/neofs-api-go/pkg/object" + objecttest "github.com/nspcc-dev/neofs-api-go/pkg/object/test" "github.com/stretchr/testify/require" ) -func testSHA256() (cs [sha256.Size]byte) { - _, _ = rand.Read(cs[:]) - return -} - -func testOID() *object.ID { - id := object.NewID() - id.SetSHA256(testSHA256()) - - return id -} - func TestResult(t *testing.T) { r := audit.NewResult() require.Equal(t, pkg.SDKVersion(), r.Version()) @@ -51,11 +38,11 @@ func TestResult(t *testing.T) { r.SetRetries(retries) require.Equal(t, retries, r.Retries()) - passSG := []*object.ID{testOID(), testOID()} + passSG := []*object.ID{objecttest.GenerateID(), objecttest.GenerateID()} r.SetPassSG(passSG) require.Equal(t, passSG, r.PassSG()) - failSG := []*object.ID{testOID(), testOID()} + failSG := []*object.ID{objecttest.GenerateID(), objecttest.GenerateID()} r.SetFailSG(failSG) require.Equal(t, failSG, r.FailSG()) @@ -85,8 +72,8 @@ func TestStorageGroupEncoding(t *testing.T) { r.SetAuditEpoch(13) r.SetContainerID(cidtest.Generate()) r.SetPublicKey([]byte{1, 2, 3}) - r.SetPassSG([]*object.ID{testOID(), testOID()}) - r.SetFailSG([]*object.ID{testOID(), testOID()}) + r.SetPassSG([]*object.ID{objecttest.GenerateID(), objecttest.GenerateID()}) + r.SetFailSG([]*object.ID{objecttest.GenerateID(), objecttest.GenerateID()}) r.SetRequests(3) r.SetRetries(2) r.SetHit(1) diff --git a/pkg/storagegroup/storagegroup_test.go b/pkg/storagegroup/storagegroup_test.go index 027c0f6..8da5785 100644 --- a/pkg/storagegroup/storagegroup_test.go +++ b/pkg/storagegroup/storagegroup_test.go @@ -7,6 +7,7 @@ import ( "github.com/nspcc-dev/neofs-api-go/pkg" "github.com/nspcc-dev/neofs-api-go/pkg/object" + objecttest "github.com/nspcc-dev/neofs-api-go/pkg/object/test" "github.com/nspcc-dev/neofs-api-go/pkg/storagegroup" "github.com/stretchr/testify/require" ) @@ -23,13 +24,6 @@ func testChecksum() *pkg.Checksum { return h } -func testOID() *object.ID { - id := object.NewID() - id.SetSHA256(testSHA256()) - - return id -} - func TestStorageGroup(t *testing.T) { sg := storagegroup.New() @@ -45,7 +39,7 @@ func TestStorageGroup(t *testing.T) { sg.SetExpirationEpoch(exp) require.Equal(t, exp, sg.ExpirationEpoch()) - members := []*object.ID{testOID(), testOID()} + members := []*object.ID{objecttest.GenerateID(), objecttest.GenerateID()} sg.SetMembers(members) require.Equal(t, members, sg.Members()) } @@ -55,7 +49,7 @@ func TestStorageGroupEncoding(t *testing.T) { sg.SetValidationDataSize(13) sg.SetValidationDataHash(testChecksum()) sg.SetExpirationEpoch(33) - sg.SetMembers([]*object.ID{testOID(), testOID()}) + sg.SetMembers([]*object.ID{objecttest.GenerateID(), objecttest.GenerateID()}) t.Run("binary", func(t *testing.T) { data, err := sg.Marshal() From 075003c4f1d9198e4a89921dede1ece811a6c64b Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 8 Jun 2021 14:34:44 +0300 Subject: [PATCH 0791/1196] [#293] pkg: Implement and use generators of the messages Signed-off-by: Leonard Lyubich --- pkg/acl/eacl/test/generate.go | 3 +++ pkg/test/generate.go | 51 +++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 pkg/test/generate.go diff --git a/pkg/acl/eacl/test/generate.go b/pkg/acl/eacl/test/generate.go index 456871a..ce8c4dd 100644 --- a/pkg/acl/eacl/test/generate.go +++ b/pkg/acl/eacl/test/generate.go @@ -5,6 +5,7 @@ import ( cidtest "github.com/nspcc-dev/neofs-api-go/pkg/container/id/test" ownertest "github.com/nspcc-dev/neofs-api-go/pkg/owner/test" sessiontest "github.com/nspcc-dev/neofs-api-go/pkg/session/test" + refstest "github.com/nspcc-dev/neofs-api-go/pkg/test" ) // Target returns random eacl.Target. @@ -40,6 +41,8 @@ func Table() *eacl.Table { x.SetSessionToken(sessiontest.Generate()) x.AddRecord(Record()) x.AddRecord(Record()) + x.SetVersion(*refstest.Version()) + x.SetSignature(refstest.Signature()) return x } diff --git a/pkg/test/generate.go b/pkg/test/generate.go new file mode 100644 index 0000000..5bd0933 --- /dev/null +++ b/pkg/test/generate.go @@ -0,0 +1,51 @@ +package refstest + +import ( + "crypto/sha256" + "math/rand" + + "github.com/nspcc-dev/neofs-api-go/pkg" +) + +// Checksum returns random pkg.Checksum. +func Checksum() *pkg.Checksum { + var cs [sha256.Size]byte + + rand.Read(cs[:]) + + x := pkg.NewChecksum() + + x.SetSHA256(cs) + + return x +} + +// Signature returns random pkg.Signature. +func Signature() *pkg.Signature { + x := pkg.NewSignature() + + x.SetKey([]byte("key")) + x.SetSign([]byte("sign")) + + return x +} + +// Version returns random pkg.Version. +func Version() *pkg.Version { + x := pkg.NewVersion() + + x.SetMajor(2) + x.SetMinor(1) + + return x +} + +// XHeader returns random pkg.XHeader. +func XHeader() *pkg.XHeader { + x := pkg.NewXHeader() + + x.SetKey("key") + x.SetValue("value") + + return x +} From cb6e01a10362f9b56f1a3a2cff8ad685081af96c Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 8 Jun 2021 14:35:37 +0300 Subject: [PATCH 0792/1196] [#293] pkg/object: Implement generators of the messages Signed-off-by: Leonard Lyubich --- pkg/object/test/generate.go | 141 ++++++++++++++++++++++++++++++++++++ 1 file changed, 141 insertions(+) create mode 100644 pkg/object/test/generate.go diff --git a/pkg/object/test/generate.go b/pkg/object/test/generate.go new file mode 100644 index 0000000..bb8d0c2 --- /dev/null +++ b/pkg/object/test/generate.go @@ -0,0 +1,141 @@ +package objecttest + +import ( + "crypto/sha256" + "math/rand" + + "github.com/google/uuid" + "github.com/nspcc-dev/neofs-api-go/pkg" + cidtest "github.com/nspcc-dev/neofs-api-go/pkg/container/id/test" + "github.com/nspcc-dev/neofs-api-go/pkg/object" + ownertest "github.com/nspcc-dev/neofs-api-go/pkg/owner/test" + sessiontest "github.com/nspcc-dev/neofs-api-go/pkg/session/test" + refstest "github.com/nspcc-dev/neofs-api-go/pkg/test" +) + +// ID returns random object.ID. +func ID() *object.ID { + checksum := [sha256.Size]byte{} + + rand.Read(checksum[:]) + + return IDWithChecksum(checksum) +} + +// IDWithChecksum returns object.ID initialized +// with specified checksum. +func IDWithChecksum(cs [sha256.Size]byte) *object.ID { + id := object.NewID() + id.SetSHA256(cs) + + return id +} + +// Address returns random object.Address. +func Address() *object.Address { + x := object.NewAddress() + + x.SetContainerID(cidtest.Generate()) + x.SetObjectID(ID()) + + return x +} + +// Range returns random object.Range. +func Range() *object.Range { + x := object.NewRange() + + x.SetOffset(1024) + x.SetLength(2048) + + return x +} + +// Attribute returns random object.Attribute. +func Attribute() *object.Attribute { + x := object.NewAttribute() + + x.SetKey("key") + x.SetValue("value") + + return x +} + +// SplitID returns random object.SplitID. +func SplitID() *object.SplitID { + x := object.NewSplitID() + + x.SetUUID(uuid.New()) + + return x +} + +func generateRaw(withParent bool) *object.RawObject { + x := object.NewRaw() + + x.SetID(ID()) + x.SetSessionToken(sessiontest.Generate()) + x.SetPayload([]byte{1, 2, 3}) + x.SetOwnerID(ownertest.Generate()) + x.SetContainerID(cidtest.Generate()) + x.SetType(object.TypeTombstone) + x.SetVersion(pkg.SDKVersion()) + x.SetPayloadSize(111) + x.SetCreationEpoch(222) + x.SetPreviousID(ID()) + x.SetParentID(ID()) + x.SetChildren(ID(), ID()) + x.SetAttributes(Attribute(), Attribute()) + x.SetSplitID(SplitID()) + x.SetPayloadChecksum(refstest.Checksum()) + x.SetPayloadHomomorphicHash(refstest.Checksum()) + x.SetSignature(refstest.Signature()) + + if withParent { + x.SetParent(generateRaw(false).Object()) + } + + return x +} + +// Raw returns random object.RawObject. +func Raw() *object.RawObject { + return generateRaw(true) +} + +// Object returns random object.Object. +func Object() *object.Object { + return Raw().Object() +} + +// Tombstone returns random object.Tombstone. +func Tombstone() *object.Tombstone { + x := object.NewTombstone() + + x.SetSplitID(SplitID()) + x.SetExpirationEpoch(13) + x.SetMembers([]*object.ID{ID(), ID()}) + + return x +} + +// SplitInfo returns random object.SplitInfo. +func SplitInfo() *object.SplitInfo { + x := object.NewSplitInfo() + + x.SetSplitID(SplitID()) + x.SetLink(ID()) + x.SetLastPart(ID()) + + return x +} + +// SearchFilters returns random object.SearchFilters. +func SearchFilters() object.SearchFilters { + x := object.NewSearchFilters() + + x.AddObjectIDFilter(object.MatchStringEqual, ID()) + x.AddObjectContainerIDFilter(object.MatchStringNotEqual, cidtest.Generate()) + + return x +} From 3cf0ea022daaef8928d657d66278f240d7c55f10 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 8 Jun 2021 14:38:09 +0300 Subject: [PATCH 0793/1196] [#293] pkg/netmap: Implement generators of the messages Signed-off-by: Leonard Lyubich --- pkg/netmap/test/generate.go | 123 ++++++++++++++++++++++++++++++++++++ 1 file changed, 123 insertions(+) create mode 100644 pkg/netmap/test/generate.go diff --git a/pkg/netmap/test/generate.go b/pkg/netmap/test/generate.go new file mode 100644 index 0000000..51a43c2 --- /dev/null +++ b/pkg/netmap/test/generate.go @@ -0,0 +1,123 @@ +package netmaptest + +import ( + "github.com/nspcc-dev/neofs-api-go/pkg/netmap" +) + +func filter(withInner bool) *netmap.Filter { + x := netmap.NewFilter() + + x.SetName("name") + x.SetKey("key") + x.SetValue("value") + x.SetOperation(netmap.OpAND) + + if withInner { + x.SetInnerFilters(filter(false), filter(false)) + } + + return x +} + +// Filter returns random netmap.Filter. +func Filter() *netmap.Filter { + return filter(true) +} + +// Replica returns random netmap.Replica. +func Replica() *netmap.Replica { + x := netmap.NewReplica() + + x.SetCount(666) + x.SetSelector("selector") + + return x +} + +// Selector returns random netmap.Selector. +func Selector() *netmap.Selector { + x := netmap.NewSelector() + + x.SetCount(11) + x.SetName("name") + x.SetFilter("filter") + x.SetAttribute("attribute") + x.SetClause(netmap.ClauseDistinct) + + return x +} + +// PlacementPolicy returns random netmap.PlacementPolicy. +func PlacementPolicy() *netmap.PlacementPolicy { + x := netmap.NewPlacementPolicy() + + x.SetContainerBackupFactor(9) + x.SetFilters(Filter(), Filter()) + x.SetReplicas(Replica(), Replica()) + x.SetSelectors(Selector(), Selector()) + + return x +} + +// NetworkInfo returns random netmap.NetworkInfo. +func NetworkInfo() *netmap.NetworkInfo { + x := netmap.NewNetworkInfo() + + x.SetCurrentEpoch(21) + x.SetMagicNumber(32) + + return x +} + +// NodeAttribute returns random netmap.NodeAttribute. +func NodeAttribute() *netmap.NodeAttribute { + x := netmap.NewNodeAttribute() + + x.SetKey("key") + x.SetValue("value") + x.SetParentKeys("parent1", "parent2") + + return x +} + +// NodeInfo returns random netmap.NodeInfo. +func NodeInfo() *netmap.NodeInfo { + x := netmap.NewNodeInfo() + + x.SetAddress("address") + x.SetPublicKey([]byte("public key")) + x.SetState(netmap.NodeStateOnline) + x.SetAttributes(NodeAttribute(), NodeAttribute()) + + return x +} + +// Node returns random netmap.Node. +func Node() *netmap.Node { + return &netmap.Node{ + ID: 1, + Index: 2, + Capacity: 3, + Price: 4, + AttrMap: map[string]string{ + "key1": "value1", + "key2": "value2", + }, + NodeInfo: NodeInfo(), + } +} + +// Nodes returns random netmap.Nodes. +func Nodes() netmap.Nodes { + return netmap.Nodes{Node(), Node()} +} + +// Netmap returns random netmap.Netmap. +func Netmap() *netmap.Netmap { + nm, err := netmap.NewNetmap(Nodes()) + if err != nil { + panic(err) + } + + return nm +} From 122a31cadbdf8a21b842d48e48fa42df586541c8 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 8 Jun 2021 14:38:38 +0300 Subject: [PATCH 0794/1196] [#293] pkg/container: Implement and use generators of the messages Signed-off-by: Leonard Lyubich --- pkg/container/announcement_test.go | 9 +---- pkg/container/container_test.go | 60 +++++++++--------------------- pkg/container/test/generate.go | 48 ++++++++++++++++++++++++ 3 files changed, 67 insertions(+), 50 deletions(-) create mode 100644 pkg/container/test/generate.go diff --git a/pkg/container/announcement_test.go b/pkg/container/announcement_test.go index 9345c28..26164bb 100644 --- a/pkg/container/announcement_test.go +++ b/pkg/container/announcement_test.go @@ -7,6 +7,7 @@ import ( "github.com/nspcc-dev/neofs-api-go/pkg/container" cid "github.com/nspcc-dev/neofs-api-go/pkg/container/id" cidtest "github.com/nspcc-dev/neofs-api-go/pkg/container/id/test" + containertest "github.com/nspcc-dev/neofs-api-go/pkg/container/test" "github.com/nspcc-dev/neofs-api-go/v2/refs" "github.com/stretchr/testify/require" ) @@ -51,13 +52,7 @@ func TestAnnouncement(t *testing.T) { } func TestUsedSpaceEncoding(t *testing.T) { - a := container.NewAnnouncement() - a.SetUsedSpace(13) - a.SetEpoch(666) - - id := cidtest.Generate() - - a.SetContainerID(id) + a := containertest.UsedSpaceAnnouncement() t.Run("binary", func(t *testing.T) { data, err := a.Marshal() diff --git a/pkg/container/container_test.go b/pkg/container/container_test.go index 4792db0..1456b0e 100644 --- a/pkg/container/container_test.go +++ b/pkg/container/container_test.go @@ -1,17 +1,16 @@ package container_test import ( - "strconv" "testing" "github.com/google/uuid" - "github.com/nspcc-dev/neofs-api-go/pkg" "github.com/nspcc-dev/neofs-api-go/pkg/acl" "github.com/nspcc-dev/neofs-api-go/pkg/container" - "github.com/nspcc-dev/neofs-api-go/pkg/netmap" - "github.com/nspcc-dev/neofs-api-go/pkg/owner" + containertest "github.com/nspcc-dev/neofs-api-go/pkg/container/test" + netmaptest "github.com/nspcc-dev/neofs-api-go/pkg/netmap/test" + ownertest "github.com/nspcc-dev/neofs-api-go/pkg/owner/test" sessiontest "github.com/nspcc-dev/neofs-api-go/pkg/session/test" - "github.com/nspcc-dev/neofs-crypto/test" + refstest "github.com/nspcc-dev/neofs-api-go/pkg/test" "github.com/stretchr/testify/require" ) @@ -20,24 +19,26 @@ func TestNewContainer(t *testing.T) { nonce := uuid.New() - wallet, err := owner.NEO3WalletFromPublicKey(&test.DecodeKey(1).PublicKey) - require.NoError(t, err) - - ownerID := owner.NewIDFromNeo3Wallet(wallet) - policy := generatePlacementPolicy() + ownerID := ownertest.Generate() + policy := netmaptest.PlacementPolicy() c.SetBasicACL(acl.PublicBasicRule) - c.SetAttributes(generateAttributes(5)) + + attrs := containertest.Attributes() + c.SetAttributes(attrs) + c.SetPlacementPolicy(policy) c.SetNonceUUID(nonce) c.SetOwnerID(ownerID) - c.SetVersion(pkg.SDKVersion()) + + ver := refstest.Version() + c.SetVersion(ver) v2 := c.ToV2() newContainer := container.NewContainerFromV2(v2) require.EqualValues(t, newContainer.PlacementPolicy(), policy) - require.EqualValues(t, newContainer.Attributes(), generateAttributes(5)) + require.EqualValues(t, newContainer.Attributes(), attrs) require.EqualValues(t, newContainer.BasicACL(), acl.PublicBasicRule) newNonce, err := newContainer.NonceUUID() @@ -45,36 +46,11 @@ func TestNewContainer(t *testing.T) { require.EqualValues(t, newNonce, nonce) require.EqualValues(t, newContainer.OwnerID(), ownerID) - require.EqualValues(t, newContainer.Version(), pkg.SDKVersion()) -} - -func generateAttributes(n int) container.Attributes { - attrs := make(container.Attributes, 0, n) - - for i := 0; i < n; i++ { - strN := strconv.Itoa(n) - - attr := container.NewAttribute() - attr.SetKey("key" + strN) - attr.SetValue("val" + strN) - - attrs = append(attrs, attr) - } - - return attrs -} - -func generatePlacementPolicy() *netmap.PlacementPolicy { - p := new(netmap.PlacementPolicy) - p.SetContainerBackupFactor(10) - - return p + require.EqualValues(t, newContainer.Version(), ver) } func TestContainerEncoding(t *testing.T) { - c := container.New( - container.WithAttribute("key", "value"), - ) + c := containertest.Container() t.Run("binary", func(t *testing.T) { data, err := c.Marshal() @@ -108,9 +84,7 @@ func TestContainer_SessionToken(t *testing.T) { } func TestContainer_Signature(t *testing.T) { - sig := pkg.NewSignature() - sig.SetKey([]byte{1, 2, 3}) - sig.SetSign([]byte{4, 5, 6}) + sig := refstest.Signature() cnr := container.New() cnr.SetSignature(sig) diff --git a/pkg/container/test/generate.go b/pkg/container/test/generate.go new file mode 100644 index 0000000..0f5f9b0 --- /dev/null +++ b/pkg/container/test/generate.go @@ -0,0 +1,48 @@ +package containertest + +import ( + "github.com/nspcc-dev/neofs-api-go/pkg/container" + cidtest "github.com/nspcc-dev/neofs-api-go/pkg/container/id/test" + netmaptest "github.com/nspcc-dev/neofs-api-go/pkg/netmap/test" + ownertest "github.com/nspcc-dev/neofs-api-go/pkg/owner/test" + refstest "github.com/nspcc-dev/neofs-api-go/pkg/test" +) + +// Attribute returns random container.Attribute. +func Attribute() *container.Attribute { + x := container.NewAttribute() + + x.SetKey("key") + x.SetValue("value") + + return x +} + +// Attributes returns random container.Attributes. +func Attributes() container.Attributes { + return container.Attributes{Attribute(), Attribute()} +} + +// Container returns random container.Container. +func Container() *container.Container { + x := container.New() + + x.SetVersion(refstest.Version()) + x.SetAttributes(Attributes()) + x.SetOwnerID(ownertest.Generate()) + x.SetBasicACL(123) + x.SetPlacementPolicy(netmaptest.PlacementPolicy()) + + return x +} + +// UsedSpaceAnnouncement returns random container.UsedSpaceAnnouncement. +func UsedSpaceAnnouncement() *container.UsedSpaceAnnouncement { + x := container.NewAnnouncement() + + x.SetContainerID(cidtest.Generate()) + x.SetEpoch(55) + x.SetUsedSpace(999) + + return x +} From 00778cc9bae7f7a7e512f9de20ecea8fedc7f3ce Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 8 Jun 2021 14:39:17 +0300 Subject: [PATCH 0795/1196] [#293] pkg/token: Implement and use generator of BearerToken Signed-off-by: Leonard Lyubich --- pkg/token/bearer_test.go | 4 ++-- pkg/token/test/generate.go | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 pkg/token/test/generate.go diff --git a/pkg/token/bearer_test.go b/pkg/token/bearer_test.go index afcde5a..38bf47b 100644 --- a/pkg/token/bearer_test.go +++ b/pkg/token/bearer_test.go @@ -6,6 +6,7 @@ import ( "github.com/nspcc-dev/neofs-api-go/pkg/acl/eacl" "github.com/nspcc-dev/neofs-api-go/pkg/owner" "github.com/nspcc-dev/neofs-api-go/pkg/token" + tokentest "github.com/nspcc-dev/neofs-api-go/pkg/token/test" "github.com/nspcc-dev/neofs-crypto/test" "github.com/stretchr/testify/require" ) @@ -32,8 +33,7 @@ func TestBearerToken_Issuer(t *testing.T) { } func TestFilterEncoding(t *testing.T) { - f := token.NewBearerToken() - f.SetLifetime(1, 2, 3) + f := tokentest.Generate() t.Run("binary", func(t *testing.T) { data, err := f.Marshal() diff --git a/pkg/token/test/generate.go b/pkg/token/test/generate.go new file mode 100644 index 0000000..f7ae59d --- /dev/null +++ b/pkg/token/test/generate.go @@ -0,0 +1,35 @@ +package tokentest + +import ( + eacltest "github.com/nspcc-dev/neofs-api-go/pkg/acl/eacl/test" + ownertest "github.com/nspcc-dev/neofs-api-go/pkg/owner/test" + "github.com/nspcc-dev/neofs-api-go/pkg/token" + "github.com/nspcc-dev/neofs-crypto/test" +) + +// Generate returns random token.BearerToken. +// +// Resulting token is unsigned. +func Generate() *token.BearerToken { + x := token.NewBearerToken() + + x.SetLifetime(3, 2, 1) + x.SetOwner(ownertest.Generate()) + x.SetEACLTable(eacltest.Table()) + + return x +} + +// GenerateSigned returns signed random token.BearerToken. +// +// Panics if token could not be signed (actually unexpected). +func GenerateSigned() *token.BearerToken { + tok := Generate() + + err := tok.SignToken(test.DecodeKey(0)) + if err != nil { + panic(err) + } + + return tok +} From cd32722d25ce923e1d71fad2720793ca72e464d0 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 8 Jun 2021 14:39:41 +0300 Subject: [PATCH 0796/1196] [#293] pkg/audit: Implement and use generator of Result Signed-off-by: Leonard Lyubich --- pkg/audit/result_test.go | 19 ++++--------------- pkg/audit/test/generate.go | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 15 deletions(-) create mode 100644 pkg/audit/test/generate.go diff --git a/pkg/audit/result_test.go b/pkg/audit/result_test.go index 4edd5fd..49081ce 100644 --- a/pkg/audit/result_test.go +++ b/pkg/audit/result_test.go @@ -5,6 +5,7 @@ import ( "github.com/nspcc-dev/neofs-api-go/pkg" "github.com/nspcc-dev/neofs-api-go/pkg/audit" + audittest "github.com/nspcc-dev/neofs-api-go/pkg/audit/test" cidtest "github.com/nspcc-dev/neofs-api-go/pkg/container/id/test" "github.com/nspcc-dev/neofs-api-go/pkg/object" objecttest "github.com/nspcc-dev/neofs-api-go/pkg/object/test" @@ -38,11 +39,11 @@ func TestResult(t *testing.T) { r.SetRetries(retries) require.Equal(t, retries, r.Retries()) - passSG := []*object.ID{objecttest.GenerateID(), objecttest.GenerateID()} + passSG := []*object.ID{objecttest.ID(), objecttest.ID()} r.SetPassSG(passSG) require.Equal(t, passSG, r.PassSG()) - failSG := []*object.ID{objecttest.GenerateID(), objecttest.GenerateID()} + failSG := []*object.ID{objecttest.ID(), objecttest.ID()} r.SetFailSG(failSG) require.Equal(t, failSG, r.FailSG()) @@ -68,19 +69,7 @@ func TestResult(t *testing.T) { } func TestStorageGroupEncoding(t *testing.T) { - r := audit.NewResult() - r.SetAuditEpoch(13) - r.SetContainerID(cidtest.Generate()) - r.SetPublicKey([]byte{1, 2, 3}) - r.SetPassSG([]*object.ID{objecttest.GenerateID(), objecttest.GenerateID()}) - r.SetFailSG([]*object.ID{objecttest.GenerateID(), objecttest.GenerateID()}) - r.SetRequests(3) - r.SetRetries(2) - r.SetHit(1) - r.SetMiss(2) - r.SetFail(3) - r.SetPassNodes([][]byte{{1}, {2}}) - r.SetFailNodes([][]byte{{3}, {4}}) + r := audittest.Generate() t.Run("binary", func(t *testing.T) { data, err := r.Marshal() diff --git a/pkg/audit/test/generate.go b/pkg/audit/test/generate.go new file mode 100644 index 0000000..84b2f8f --- /dev/null +++ b/pkg/audit/test/generate.go @@ -0,0 +1,37 @@ +package audittest + +import ( + "github.com/nspcc-dev/neofs-api-go/pkg/audit" + cidtest "github.com/nspcc-dev/neofs-api-go/pkg/container/id/test" + "github.com/nspcc-dev/neofs-api-go/pkg/object" + objecttest "github.com/nspcc-dev/neofs-api-go/pkg/object/test" + refstest "github.com/nspcc-dev/neofs-api-go/pkg/test" +) + +// Generate returns random audit.Result. +func Generate() *audit.Result { + x := audit.NewResult() + + x.SetVersion(refstest.Version()) + x.SetContainerID(cidtest.Generate()) + x.SetPublicKey([]byte("key")) + x.SetComplete(true) + x.SetAuditEpoch(44) + x.SetHit(55) + x.SetMiss(66) + x.SetFail(77) + x.SetRetries(88) + x.SetRequests(99) + x.SetFailNodes([][]byte{ + []byte("node1"), + []byte("node2"), + }) + x.SetPassNodes([][]byte{ + []byte("node3"), + []byte("node4"), + }) + x.SetPassSG([]*object.ID{objecttest.ID(), objecttest.ID()}) + x.SetFailSG([]*object.ID{objecttest.ID(), objecttest.ID()}) + + return x +} From 318755e9de9587c0124f1b798fe4a3964f212bee Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 8 Jun 2021 14:40:12 +0300 Subject: [PATCH 0797/1196] [#293] pkg/storagegroup: Implement and use generator of StorageGroup Signed-off-by: Leonard Lyubich --- pkg/storagegroup/storagegroup_test.go | 27 +++++---------------------- pkg/storagegroup/test/generate.go | 20 ++++++++++++++++++++ 2 files changed, 25 insertions(+), 22 deletions(-) create mode 100644 pkg/storagegroup/test/generate.go diff --git a/pkg/storagegroup/storagegroup_test.go b/pkg/storagegroup/storagegroup_test.go index 8da5785..5118431 100644 --- a/pkg/storagegroup/storagegroup_test.go +++ b/pkg/storagegroup/storagegroup_test.go @@ -1,29 +1,16 @@ package storagegroup_test import ( - "crypto/rand" - "crypto/sha256" "testing" - "github.com/nspcc-dev/neofs-api-go/pkg" "github.com/nspcc-dev/neofs-api-go/pkg/object" objecttest "github.com/nspcc-dev/neofs-api-go/pkg/object/test" "github.com/nspcc-dev/neofs-api-go/pkg/storagegroup" + storagegrouptest "github.com/nspcc-dev/neofs-api-go/pkg/storagegroup/test" + refstest "github.com/nspcc-dev/neofs-api-go/pkg/test" "github.com/stretchr/testify/require" ) -func testSHA256() (cs [sha256.Size]byte) { - _, _ = rand.Read(cs[:]) - return -} - -func testChecksum() *pkg.Checksum { - h := pkg.NewChecksum() - h.SetSHA256(testSHA256()) - - return h -} - func TestStorageGroup(t *testing.T) { sg := storagegroup.New() @@ -31,7 +18,7 @@ func TestStorageGroup(t *testing.T) { sg.SetValidationDataSize(sz) require.Equal(t, sz, sg.ValidationDataSize()) - cs := testChecksum() + cs := refstest.Checksum() sg.SetValidationDataHash(cs) require.Equal(t, cs, sg.ValidationDataHash()) @@ -39,17 +26,13 @@ func TestStorageGroup(t *testing.T) { sg.SetExpirationEpoch(exp) require.Equal(t, exp, sg.ExpirationEpoch()) - members := []*object.ID{objecttest.GenerateID(), objecttest.GenerateID()} + members := []*object.ID{objecttest.ID(), objecttest.ID()} sg.SetMembers(members) require.Equal(t, members, sg.Members()) } func TestStorageGroupEncoding(t *testing.T) { - sg := storagegroup.New() - sg.SetValidationDataSize(13) - sg.SetValidationDataHash(testChecksum()) - sg.SetExpirationEpoch(33) - sg.SetMembers([]*object.ID{objecttest.GenerateID(), objecttest.GenerateID()}) + sg := storagegrouptest.Generate() t.Run("binary", func(t *testing.T) { data, err := sg.Marshal() diff --git a/pkg/storagegroup/test/generate.go b/pkg/storagegroup/test/generate.go new file mode 100644 index 0000000..4efe1b2 --- /dev/null +++ b/pkg/storagegroup/test/generate.go @@ -0,0 +1,20 @@ +package storagegrouptest + +import ( + "github.com/nspcc-dev/neofs-api-go/pkg/object" + objecttest "github.com/nspcc-dev/neofs-api-go/pkg/object/test" + "github.com/nspcc-dev/neofs-api-go/pkg/storagegroup" + refstest "github.com/nspcc-dev/neofs-api-go/pkg/test" +) + +// Generate returns random storagegroup.StorageGroup. +func Generate() *storagegroup.StorageGroup { + x := storagegroup.New() + + x.SetExpirationEpoch(66) + x.SetValidationDataSize(322) + x.SetValidationDataHash(refstest.Checksum()) + x.SetMembers([]*object.ID{objecttest.ID(), objecttest.ID()}) + + return x +} From f2c9584fbcc1952f9a2f83f4e3abb8b6f25e96fe Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 8 Jun 2021 15:04:49 +0300 Subject: [PATCH 0798/1196] [#293] pkg/eacl: Do not set token and signature in Table generator These fields aren't part of the message. Signed-off-by: Leonard Lyubich --- pkg/acl/eacl/test/generate.go | 3 --- 1 file changed, 3 deletions(-) diff --git a/pkg/acl/eacl/test/generate.go b/pkg/acl/eacl/test/generate.go index ce8c4dd..4eda92a 100644 --- a/pkg/acl/eacl/test/generate.go +++ b/pkg/acl/eacl/test/generate.go @@ -4,7 +4,6 @@ import ( "github.com/nspcc-dev/neofs-api-go/pkg/acl/eacl" cidtest "github.com/nspcc-dev/neofs-api-go/pkg/container/id/test" ownertest "github.com/nspcc-dev/neofs-api-go/pkg/owner/test" - sessiontest "github.com/nspcc-dev/neofs-api-go/pkg/session/test" refstest "github.com/nspcc-dev/neofs-api-go/pkg/test" ) @@ -38,11 +37,9 @@ func Table() *eacl.Table { x := eacl.NewTable() x.SetCID(cidtest.Generate()) - x.SetSessionToken(sessiontest.Generate()) x.AddRecord(Record()) x.AddRecord(Record()) x.SetVersion(*refstest.Version()) - x.SetSignature(refstest.Signature()) return x } From 4e2ef6a30a9ba037a28c7573c0c420c70ded8690 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 8 Jun 2021 15:06:53 +0300 Subject: [PATCH 0799/1196] [#293] pkg/eacl: Fix table encoding test with a temporary solution Signed-off-by: Leonard Lyubich --- pkg/acl/eacl/table_test.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/pkg/acl/eacl/table_test.go b/pkg/acl/eacl/table_test.go index 06c7c7a..6dcf062 100644 --- a/pkg/acl/eacl/table_test.go +++ b/pkg/acl/eacl/table_test.go @@ -65,7 +65,7 @@ func TestTable_AddRecord(t *testing.T) { require.Equal(t, records, table.Records()) } -func TestRecordEncoding(t *testing.T) { +func TestTableEncoding(t *testing.T) { tab := eacltest.Table() t.Run("binary", func(t *testing.T) { @@ -75,17 +75,19 @@ func TestRecordEncoding(t *testing.T) { tab2 := eacl.NewTable() require.NoError(t, tab2.Unmarshal(data)) - require.Equal(t, tab, tab2) + // FIXME: we compare v2 messages because + // Filter contains fmt.Stringer interface + require.Equal(t, tab.ToV2(), tab2.ToV2()) }) t.Run("json", func(t *testing.T) { data, err := tab.MarshalJSON() require.NoError(t, err) - r2 := eacl.NewTable() - require.NoError(t, r2.UnmarshalJSON(data)) + tab2 := eacl.NewTable() + require.NoError(t, tab2.UnmarshalJSON(data)) - require.Equal(t, tab, r2) + require.Equal(t, tab.ToV2(), tab2.ToV2()) }) } From 821e2951b6c1f7f7f472d8528b8774f4292586d7 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Tue, 8 Jun 2021 14:33:56 +0300 Subject: [PATCH 0800/1196] [#302] pkg/audit: Convert nil `Result` to nil message Document that `Result.ToV2` method returns `nil` when is called on `nil`. Document that `NewResultFromV2` method returns `nil` when is called on `nil`. Add corresponding unit test. Signed-off-by: Pavel Karpy --- pkg/audit/result.go | 4 ++++ pkg/audit/result_test.go | 17 +++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/pkg/audit/result.go b/pkg/audit/result.go index 047e40a..1ff1dc0 100644 --- a/pkg/audit/result.go +++ b/pkg/audit/result.go @@ -12,6 +12,8 @@ import ( type Result audit.DataAuditResult // NewFromV2 wraps v2 DataAuditResult message to Result. +// +// Nil audit.DataAuditResult converts to nil. func NewResultFromV2(aV2 *audit.DataAuditResult) *Result { return (*Result)(aV2) } @@ -25,6 +27,8 @@ func NewResult() *Result { } // ToV2 converts Result to v2 DataAuditResult message. +// +// Nil Result converts to nil. func (r *Result) ToV2() *audit.DataAuditResult { return (*audit.DataAuditResult)(r) } diff --git a/pkg/audit/result_test.go b/pkg/audit/result_test.go index 49081ce..fc0ce37 100644 --- a/pkg/audit/result_test.go +++ b/pkg/audit/result_test.go @@ -9,6 +9,7 @@ import ( cidtest "github.com/nspcc-dev/neofs-api-go/pkg/container/id/test" "github.com/nspcc-dev/neofs-api-go/pkg/object" objecttest "github.com/nspcc-dev/neofs-api-go/pkg/object/test" + auditv2 "github.com/nspcc-dev/neofs-api-go/v2/audit" "github.com/stretchr/testify/require" ) @@ -91,3 +92,19 @@ func TestStorageGroupEncoding(t *testing.T) { require.Equal(t, r, r2) }) } + +func TestResult_ToV2(t *testing.T) { + t.Run("nil", func(t *testing.T) { + var x *audit.Result + + require.Nil(t, x.ToV2()) + }) +} + +func TestNewResultFromV2(t *testing.T) { + t.Run("from nil", func(t *testing.T) { + var x *auditv2.DataAuditResult + + require.Nil(t, audit.NewResultFromV2(x)) + }) +} From 9fae0e4f2db9fa8395e4f824c2fdb456a2c3ae40 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Tue, 8 Jun 2021 15:00:32 +0300 Subject: [PATCH 0801/1196] [#302] pkg/audit: Document default values set in `NewResult` Document field values of instance constructed via `NewResult`. Assert the values in corresponding unit test. Signed-off-by: Pavel Karpy --- pkg/audit/result.go | 11 ++++++++++ pkg/audit/result_test.go | 44 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) diff --git a/pkg/audit/result.go b/pkg/audit/result.go index 1ff1dc0..e334e99 100644 --- a/pkg/audit/result.go +++ b/pkg/audit/result.go @@ -19,6 +19,17 @@ func NewResultFromV2(aV2 *audit.DataAuditResult) *Result { } // New creates and initializes blank Result. +// +// Defaults: +// - version: pkg.SDKVersion(); +// - complete: false; +// - cid: nil; +// - pubKey: nil; +// - passSG, failSG: nil; +// - failNodes, passNodes: nil; +// - hit, miss, fail: 0; +// - requests, retries: 0; +// - auditEpoch: 0. func NewResult() *Result { r := NewResultFromV2(new(audit.DataAuditResult)) r.SetVersion(pkg.SDKVersion()) diff --git a/pkg/audit/result_test.go b/pkg/audit/result_test.go index fc0ce37..23f8fcf 100644 --- a/pkg/audit/result_test.go +++ b/pkg/audit/result_test.go @@ -99,6 +99,50 @@ func TestResult_ToV2(t *testing.T) { require.Nil(t, x.ToV2()) }) + + t.Run("default values", func(t *testing.T) { + result := audit.NewResult() + + // check initial values + require.Equal(t, pkg.SDKVersion(), result.Version()) + + require.False(t, result.Complete()) + + require.Nil(t, result.ContainerID()) + require.Nil(t, result.PublicKey()) + require.Nil(t, result.PassSG()) + require.Nil(t, result.FailSG()) + require.Nil(t, result.PassNodes()) + require.Nil(t, result.FailNodes()) + + require.Zero(t, result.Hit()) + require.Zero(t, result.Miss()) + require.Zero(t, result.Fail()) + require.Zero(t, result.Requests()) + require.Zero(t, result.Retries()) + require.Zero(t, result.AuditEpoch()) + + // convert to v2 message + resultV2 := result.ToV2() + + require.Equal(t, pkg.SDKVersion().ToV2(), resultV2.GetVersion()) + + require.False(t, resultV2.GetComplete()) + + require.Nil(t, resultV2.GetContainerID()) + require.Nil(t, resultV2.GetPublicKey()) + require.Nil(t, resultV2.GetPassSG()) + require.Nil(t, resultV2.GetFailSG()) + require.Nil(t, resultV2.GetPassNodes()) + require.Nil(t, resultV2.GetFailNodes()) + + require.Zero(t, resultV2.GetHit()) + require.Zero(t, resultV2.GetMiss()) + require.Zero(t, resultV2.GetFail()) + require.Zero(t, resultV2.GetRequests()) + require.Zero(t, resultV2.GetRetries()) + require.Zero(t, resultV2.GetAuditEpoch()) + }) } func TestNewResultFromV2(t *testing.T) { From 6ce8844654ebf2e43681ebdb321d1ba76d88aa46 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Tue, 8 Jun 2021 15:07:00 +0300 Subject: [PATCH 0802/1196] [#302] pkg/container/id: Convert nil `ID` to nil message Document that `ID.ToV2` method returns `nil` when is called on `nil`. Document that `NewFromV2` method returns `nil` when is called on `nil`. Add corresponding unit test. Signed-off-by: Pavel Karpy --- pkg/container/id/id.go | 4 ++++ pkg/container/id/id_test.go | 26 ++++++++++++++++++++++---- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/pkg/container/id/id.go b/pkg/container/id/id.go index 46b8d37..b09c7b3 100644 --- a/pkg/container/id/id.go +++ b/pkg/container/id/id.go @@ -13,6 +13,8 @@ import ( type ID refs.ContainerID // NewFromV2 wraps v2 ContainerID message to ID. +// +// Nil refs.ContainerID converts to nil. func NewFromV2(idV2 *refs.ContainerID) *ID { return (*ID)(idV2) } @@ -28,6 +30,8 @@ func (id *ID) SetSHA256(v [sha256.Size]byte) { } // ToV2 returns the v2 container ID message. +// +// Nil Result converts to nil. func (id *ID) ToV2() *refs.ContainerID { return (*refs.ContainerID)(id) } diff --git a/pkg/container/id/id_test.go b/pkg/container/id/id_test.go index 6aeca3c..e0a266e 100644 --- a/pkg/container/id/id_test.go +++ b/pkg/container/id/id_test.go @@ -7,6 +7,7 @@ import ( cid "github.com/nspcc-dev/neofs-api-go/pkg/container/id" cidtest "github.com/nspcc-dev/neofs-api-go/pkg/container/id/test" + "github.com/nspcc-dev/neofs-api-go/v2/refs" "github.com/stretchr/testify/require" ) @@ -16,13 +17,22 @@ func randSHA256Checksum() (cs [sha256.Size]byte) { } func TestID_ToV2(t *testing.T) { - checksum := randSHA256Checksum() + t.Run("non-nil", func(t *testing.T) { + checksum := randSHA256Checksum() - id := cidtest.GenerateWithChecksum(checksum) + id := cidtest.GenerateWithChecksum(checksum) - idV2 := id.ToV2() + idV2 := id.ToV2() - require.Equal(t, id, cid.NewFromV2(idV2)) + require.Equal(t, id, cid.NewFromV2(idV2)) + require.Equal(t, checksum[:], idV2.GetValue()) + }) + + t.Run("nil", func(t *testing.T) { + var x *cid.ID + + require.Nil(t, x.ToV2()) + }) } func TestID_Equal(t *testing.T) { @@ -69,3 +79,11 @@ func TestContainerIDEncoding(t *testing.T) { require.Equal(t, id, a2) }) } + +func TestNewFromV2(t *testing.T) { + t.Run("from nil", func(t *testing.T) { + var x *refs.ContainerID + + require.Nil(t, cid.NewFromV2(x)) + }) +} From 31ca5c14d33addfd6d8bb86e2c29861bb70d3089 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Tue, 8 Jun 2021 15:15:45 +0300 Subject: [PATCH 0803/1196] [#302] pkg/container/id: Document default values set in `New` Document field values of instance constructed via `New`. Assert the values in corresponding unit test. Signed-off-by: Pavel Karpy --- pkg/container/id/id.go | 5 ++++- pkg/container/id/id_test.go | 24 ++++++++++++++++++++---- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/pkg/container/id/id.go b/pkg/container/id/id.go index b09c7b3..351c9b3 100644 --- a/pkg/container/id/id.go +++ b/pkg/container/id/id.go @@ -20,6 +20,9 @@ func NewFromV2(idV2 *refs.ContainerID) *ID { } // New creates and initializes blank ID. +// +// Defaults: +// - value: nil. func New() *ID { return NewFromV2(new(refs.ContainerID)) } @@ -31,7 +34,7 @@ func (id *ID) SetSHA256(v [sha256.Size]byte) { // ToV2 returns the v2 container ID message. // -// Nil Result converts to nil. +// Nil ID converts to nil. func (id *ID) ToV2() *refs.ContainerID { return (*refs.ContainerID)(id) } diff --git a/pkg/container/id/id_test.go b/pkg/container/id/id_test.go index e0a266e..b633cb4 100644 --- a/pkg/container/id/id_test.go +++ b/pkg/container/id/id_test.go @@ -33,6 +33,14 @@ func TestID_ToV2(t *testing.T) { require.Nil(t, x.ToV2()) }) + + t.Run("default values", func(t *testing.T) { + cid := cid.New() + + // convert to v2 message + cidV2 := cid.ToV2() + require.Nil(t, cidV2.GetValue()) + }) } func TestID_Equal(t *testing.T) { @@ -49,11 +57,19 @@ func TestID_Equal(t *testing.T) { } func TestID_String(t *testing.T) { - id := cidtest.Generate() - id2 := cid.New() + t.Run("Parse/String", func(t *testing.T) { + id := cidtest.Generate() + id2 := cid.New() - require.NoError(t, id2.Parse(id.String())) - require.Equal(t, id, id2) + require.NoError(t, id2.Parse(id.String())) + require.Equal(t, id, id2) + }) + + t.Run("nil", func(t *testing.T) { + id := cid.New() + + require.Empty(t, id.String()) + }) } func TestContainerIDEncoding(t *testing.T) { From c54dee82be899aded5579b202c3a45248cbc105a Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Tue, 8 Jun 2021 15:19:51 +0300 Subject: [PATCH 0804/1196] [#302] pkg/container: Convert nil `UsedSpaceAnnouncement` to nil message Document that `UsedSpaceAnnouncement.ToV2` method returns `nil` when is called on `nil`. Document that `NewAnnouncementFromV2` method returns `nil` when is called on `nil`. Add corresponding unit test. Signed-off-by: Pavel Karpy --- pkg/container/announcement.go | 4 ++++ pkg/container/announcement_test.go | 17 +++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/pkg/container/announcement.go b/pkg/container/announcement.go index 6d82966..20041aa 100644 --- a/pkg/container/announcement.go +++ b/pkg/container/announcement.go @@ -16,6 +16,8 @@ func NewAnnouncement() *UsedSpaceAnnouncement { // NewAnnouncementFromV2 wraps protocol dependent version of // UsedSpaceAnnouncement message. +// +// Nil container.UsedSpaceAnnouncement converts to nil. func NewAnnouncementFromV2(v *container.UsedSpaceAnnouncement) *UsedSpaceAnnouncement { return (*UsedSpaceAnnouncement)(v) } @@ -53,6 +55,8 @@ func (a *UsedSpaceAnnouncement) SetUsedSpace(value uint64) { } // ToV2 returns protocol dependent version of UsedSpaceAnnouncement message. +// +// Nil UsedSpaceAnnouncement converts to nil. func (a *UsedSpaceAnnouncement) ToV2() *container.UsedSpaceAnnouncement { return (*container.UsedSpaceAnnouncement)(a) } diff --git a/pkg/container/announcement_test.go b/pkg/container/announcement_test.go index 26164bb..3560ae6 100644 --- a/pkg/container/announcement_test.go +++ b/pkg/container/announcement_test.go @@ -8,6 +8,7 @@ import ( cid "github.com/nspcc-dev/neofs-api-go/pkg/container/id" cidtest "github.com/nspcc-dev/neofs-api-go/pkg/container/id/test" containertest "github.com/nspcc-dev/neofs-api-go/pkg/container/test" + containerv2 "github.com/nspcc-dev/neofs-api-go/v2/container" "github.com/nspcc-dev/neofs-api-go/v2/refs" "github.com/stretchr/testify/require" ) @@ -64,3 +65,19 @@ func TestUsedSpaceEncoding(t *testing.T) { require.Equal(t, a, a2) }) } + +func TestUsedSpaceAnnouncement_ToV2(t *testing.T) { + t.Run("nil", func(t *testing.T) { + var x *container.UsedSpaceAnnouncement + + require.Nil(t, x.ToV2()) + }) +} + +func TestNewAnnouncementFromV2(t *testing.T) { + t.Run("from nil", func(t *testing.T) { + var x *containerv2.UsedSpaceAnnouncement + + require.Nil(t, container.NewAnnouncementFromV2(x)) + }) +} From 1863694b9657986d2515215f7215f4987d56818e Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Tue, 8 Jun 2021 15:25:41 +0300 Subject: [PATCH 0805/1196] [#302] pkg/container: Document default values set in `NewAnnouncement` Document field values of instance constructed via `NewAnnouncement`. Assert the values in corresponding unit test. Signed-off-by: Pavel Karpy --- pkg/container/announcement.go | 5 +++++ pkg/container/announcement_test.go | 16 ++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/pkg/container/announcement.go b/pkg/container/announcement.go index 20041aa..cfa9510 100644 --- a/pkg/container/announcement.go +++ b/pkg/container/announcement.go @@ -10,6 +10,11 @@ import ( type UsedSpaceAnnouncement container.UsedSpaceAnnouncement // NewAnnouncement initialize empty UsedSpaceAnnouncement message. +// +// Defaults: +// - epoch: 0; +// - usedSpace: 0; +// - cid: nil. func NewAnnouncement() *UsedSpaceAnnouncement { return NewAnnouncementFromV2(new(container.UsedSpaceAnnouncement)) } diff --git a/pkg/container/announcement_test.go b/pkg/container/announcement_test.go index 3560ae6..dc669b8 100644 --- a/pkg/container/announcement_test.go +++ b/pkg/container/announcement_test.go @@ -72,6 +72,22 @@ func TestUsedSpaceAnnouncement_ToV2(t *testing.T) { require.Nil(t, x.ToV2()) }) + + t.Run("default values", func(t *testing.T) { + announcement := container.NewAnnouncement() + + // check initial values + require.Zero(t, announcement.Epoch()) + require.Zero(t, announcement.UsedSpace()) + require.Nil(t, announcement.ContainerID()) + + // convert to v2 message + announcementV2 := announcement.ToV2() + + require.Zero(t, announcementV2.GetEpoch()) + require.Zero(t, announcementV2.GetUsedSpace()) + require.Nil(t, announcementV2.GetContainerID()) + }) } func TestNewAnnouncementFromV2(t *testing.T) { From 8b7a43386445563e6e5f9be79849dc1f1ac6b463 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Tue, 8 Jun 2021 15:30:27 +0300 Subject: [PATCH 0806/1196] [#302] pkg/container: Convert nil `Attribute` to nil message Document that `Attribute.ToV2` method returns `nil` when is called on `nil`. Add corresponding unit test. Signed-off-by: Pavel Karpy --- pkg/container/attribute.go | 7 +++++++ pkg/container/attribute_test.go | 15 +++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/pkg/container/attribute.go b/pkg/container/attribute.go index 6f72c4c..8964a04 100644 --- a/pkg/container/attribute.go +++ b/pkg/container/attribute.go @@ -29,10 +29,17 @@ func (a *Attribute) Value() string { return (*container.Attribute)(a).GetValue() } +// NewAttributeFromV2 wraps protocol dependent version of +// Attribute message. +// +// Nil container.Attribute converts to nil. func NewAttributeFromV2(v *container.Attribute) *Attribute { return (*Attribute)(v) } +// ToV2 converts Attribute to v2 Attribute message. +// +// Nil Attribute converts to nil. func (a *Attribute) ToV2() *container.Attribute { return (*container.Attribute)(a) } diff --git a/pkg/container/attribute_test.go b/pkg/container/attribute_test.go index a7a700d..ea23286 100644 --- a/pkg/container/attribute_test.go +++ b/pkg/container/attribute_test.go @@ -4,10 +4,17 @@ import ( "testing" "github.com/nspcc-dev/neofs-api-go/pkg/container" + containerv2 "github.com/nspcc-dev/neofs-api-go/v2/container" "github.com/stretchr/testify/require" ) func TestAttribute(t *testing.T) { + t.Run("nil", func(t *testing.T) { + var x *container.Attribute + + require.Nil(t, x.ToV2()) + }) + const ( key = "key" value = "value" @@ -82,3 +89,11 @@ func TestAttributes(t *testing.T) { } }) } + +func TestNewAttributeFromV2(t *testing.T) { + t.Run("from nil", func(t *testing.T) { + var x *containerv2.Attribute + + require.Nil(t, container.NewAttributeFromV2(x)) + }) +} From 3984353d3712fd9ab5833d58b371323021c12f52 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Tue, 8 Jun 2021 15:33:42 +0300 Subject: [PATCH 0807/1196] [#302] pkg/container: Document default values set in `NewAttribute` Document field values of instance constructed via `NewAttribute`. Assert the values in corresponding unit test. Signed-off-by: Pavel Karpy --- pkg/container/attribute.go | 5 +++++ pkg/container/attribute_test.go | 13 +++++++++++++ 2 files changed, 18 insertions(+) diff --git a/pkg/container/attribute.go b/pkg/container/attribute.go index 8964a04..2e4492f 100644 --- a/pkg/container/attribute.go +++ b/pkg/container/attribute.go @@ -9,6 +9,11 @@ type ( Attributes []*Attribute ) +// NewAttribute creates and initializes blank Attribute. +// +// Defaults: +// - key: ""; +// - value: "". func NewAttribute() *Attribute { return NewAttributeFromV2(new(container.Attribute)) } diff --git a/pkg/container/attribute_test.go b/pkg/container/attribute_test.go index ea23286..e32dfda 100644 --- a/pkg/container/attribute_test.go +++ b/pkg/container/attribute_test.go @@ -15,6 +15,19 @@ func TestAttribute(t *testing.T) { require.Nil(t, x.ToV2()) }) + t.Run("default values", func(t *testing.T) { + attr := container.NewAttribute() + + // check initial values + require.Empty(t, attr.Key()) + require.Empty(t, attr.Value()) + + // convert to v2 message + attrV2 := attr.ToV2() + require.Empty(t, attrV2.GetKey()) + require.Empty(t, attrV2.GetValue()) + }) + const ( key = "key" value = "value" From c08b90dbbc9b0b6d0b01575e2e0a64a1957e6bcc Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Tue, 8 Jun 2021 15:38:53 +0300 Subject: [PATCH 0808/1196] [#302] pkg/container: Convert nil `Container` to nil message Make `Container.ToV2` method to return `nil` when called on `nil`. Write corresponding unit test. Signed-off-by: Pavel Karpy --- pkg/container/container.go | 7 +++++++ pkg/container/container_test.go | 8 ++++++++ 2 files changed, 15 insertions(+) diff --git a/pkg/container/container.go b/pkg/container/container.go index 264bab0..24ed218 100644 --- a/pkg/container/container.go +++ b/pkg/container/container.go @@ -44,7 +44,14 @@ func New(opts ...NewOption) *Container { return cnr } +// ToV2 returns the v2 Container message. +// +// Nil Container converts to nil. func (c *Container) ToV2() *container.Container { + if c == nil { + return nil + } + return &c.v2 } diff --git a/pkg/container/container_test.go b/pkg/container/container_test.go index 1456b0e..1a1bce3 100644 --- a/pkg/container/container_test.go +++ b/pkg/container/container_test.go @@ -91,3 +91,11 @@ func TestContainer_Signature(t *testing.T) { require.Equal(t, sig, cnr.Signature()) } + +func TestContainer_ToV2(t *testing.T) { + t.Run("nil", func(t *testing.T) { + var x *container.Container + + require.Nil(t, x.ToV2()) + }) +} From f92f9cd424362854ba8c1838d2fb74275e50bb65 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Tue, 8 Jun 2021 16:32:29 +0300 Subject: [PATCH 0809/1196] [#302] pkg/container: Document default values set in `New` Make `nil` as a default value for attributes. Document field values of instance constructed via `New`. Assert the values in corresponding unit test. Signed-off-by: Pavel Karpy --- pkg/container/container.go | 11 +++++++++++ pkg/container/container_test.go | 33 +++++++++++++++++++++++++++++++++ pkg/container/opts.go | 4 ++-- 3 files changed, 46 insertions(+), 2 deletions(-) diff --git a/pkg/container/container.go b/pkg/container/container.go index 24ed218..7ae7fe4 100644 --- a/pkg/container/container.go +++ b/pkg/container/container.go @@ -20,6 +20,17 @@ type Container struct { sig *pkg.Signature } +// New creates, initializes and returns blank Container instance. +// +// Defaults: +// - token: nil; +// - sig: nil; +// - basicACL: acl.PrivateBasicRule; +// - version: nil; +// - nonce: random UUID; +// - attr: nil; +// - policy: nil; +// - ownerID: nil. func New(opts ...NewOption) *Container { cnrOptions := defaultContainerOptions() diff --git a/pkg/container/container_test.go b/pkg/container/container_test.go index 1a1bce3..a5175b5 100644 --- a/pkg/container/container_test.go +++ b/pkg/container/container_test.go @@ -98,4 +98,37 @@ func TestContainer_ToV2(t *testing.T) { require.Nil(t, x.ToV2()) }) + + t.Run("default values", func(t *testing.T) { + cnt := container.New() + + // check initial values + require.Nil(t, cnt.SessionToken()) + require.Nil(t, cnt.Signature()) + require.Nil(t, cnt.Version()) + require.Nil(t, cnt.Attributes()) + require.Nil(t, cnt.PlacementPolicy()) + require.Nil(t, cnt.OwnerID()) + + require.EqualValues(t, acl.PrivateBasicRule, cnt.BasicACL()) + + nonce, err := cnt.NonceUUID() + require.NoError(t, err) + require.NotNil(t, nonce) + + // convert to v2 message + cntV2 := cnt.ToV2() + + nonceV2, err := uuid.FromBytes(cntV2.GetNonce()) + require.NoError(t, err) + + require.Equal(t, nonce.String(), nonceV2.String()) + + require.Nil(t, cntV2.GetVersion()) + require.Nil(t, cntV2.GetAttributes()) + require.Nil(t, cntV2.GetPlacementPolicy()) + require.Nil(t, cntV2.GetOwnerID()) + + require.Equal(t, uint32(acl.PrivateBasicRule), cntV2.GetBasicACL()) + }) } diff --git a/pkg/container/opts.go b/pkg/container/opts.go index 8c15ed1..d07b684 100644 --- a/pkg/container/opts.go +++ b/pkg/container/opts.go @@ -28,8 +28,8 @@ func defaultContainerOptions() containerOptions { } return containerOptions{ - acl: acl.PrivateBasicRule, - nonce: rand, + acl: acl.PrivateBasicRule, + nonce: rand, } } From 0206bd9a5d9eba68a227eb8265479c41d45558b2 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Tue, 8 Jun 2021 16:29:20 +0300 Subject: [PATCH 0810/1196] [#302] pkg/container: Convert nil `Attributes` to nil message Make `Attributes.ToV2` method to return `nil` when called on `nil`. Make `NewAttributesFromV2` function to return `nil` when called on `nil`. Write corresponding unit tests. Signed-off-by: Pavel Karpy --- pkg/container/attribute.go | 8 ++++++++ pkg/container/attribute_test.go | 8 ++++++++ pkg/container/opts.go | 4 ++-- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/pkg/container/attribute.go b/pkg/container/attribute.go index 2e4492f..ec633e8 100644 --- a/pkg/container/attribute.go +++ b/pkg/container/attribute.go @@ -50,6 +50,10 @@ func (a *Attribute) ToV2() *container.Attribute { } func NewAttributesFromV2(v []*container.Attribute) Attributes { + if v == nil { + return nil + } + attrs := make(Attributes, 0, len(v)) for i := range v { attrs = append(attrs, NewAttributeFromV2(v[i])) @@ -59,6 +63,10 @@ func NewAttributesFromV2(v []*container.Attribute) Attributes { } func (a Attributes) ToV2() []*container.Attribute { + if a == nil { + return nil + } + attrs := make([]*container.Attribute, 0, len(a)) for i := range a { attrs = append(attrs, a[i].ToV2()) diff --git a/pkg/container/attribute_test.go b/pkg/container/attribute_test.go index e32dfda..acd7bbd 100644 --- a/pkg/container/attribute_test.go +++ b/pkg/container/attribute_test.go @@ -61,6 +61,14 @@ func TestAttribute(t *testing.T) { } func TestAttributes(t *testing.T) { + t.Run("nil", func(t *testing.T) { + var x container.Attributes + + require.Nil(t, x.ToV2()) + + require.Nil(t, container.NewAttributesFromV2(nil)) + }) + var ( keys = []string{"key1", "key2", "key3"} vals = []string{"val1", "val2", "val3"} diff --git a/pkg/container/opts.go b/pkg/container/opts.go index d07b684..8c15ed1 100644 --- a/pkg/container/opts.go +++ b/pkg/container/opts.go @@ -28,8 +28,8 @@ func defaultContainerOptions() containerOptions { } return containerOptions{ - acl: acl.PrivateBasicRule, - nonce: rand, + acl: acl.PrivateBasicRule, + nonce: rand, } } From 9a7e1204856aa483c8f6a989d281688be06df91d Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Tue, 8 Jun 2021 16:41:45 +0300 Subject: [PATCH 0811/1196] [#302] pkg/netmap: Convert nil `Filter` to nil message Make `Filter.ToV2` method return `nil` when called on `nil`. Make `NewFilterFromV2` function return `nil` when called on `nil`. Write corresponding unit tests. Signed-off-by: Pavel Karpy --- pkg/netmap/filter.go | 4 ++++ pkg/netmap/filter_test.go | 12 ++++++++++++ 2 files changed, 16 insertions(+) diff --git a/pkg/netmap/filter.go b/pkg/netmap/filter.go index bc281e6..de6c939 100644 --- a/pkg/netmap/filter.go +++ b/pkg/netmap/filter.go @@ -153,11 +153,15 @@ func NewFilter() *Filter { } // NewFilterFromV2 converts v2 Filter to Filter. +// +// Nil netmap.Filter converts to nil. func NewFilterFromV2(f *netmap.Filter) *Filter { return (*Filter)(f) } // ToV2 converts Filter to v2 Filter. +// +// Nil Filter converts to nil. func (f *Filter) ToV2() *netmap.Filter { return (*netmap.Filter)(f) } diff --git a/pkg/netmap/filter_test.go b/pkg/netmap/filter_test.go index 4778432..a9eadaa 100644 --- a/pkg/netmap/filter_test.go +++ b/pkg/netmap/filter_test.go @@ -213,6 +213,18 @@ func testFilter() *Filter { } func TestFilterFromV2(t *testing.T) { + t.Run("nil from V2", func(t *testing.T) { + var x *netmap.Filter + + require.Nil(t, NewFilterFromV2(x)) + }) + + t.Run("nil to V2", func(t *testing.T) { + var x *Filter + + require.Nil(t, x.ToV2()) + }) + fV2 := new(netmap.Filter) fV2.SetOp(netmap.GE) fV2.SetName("name") From 44437bf81af3b2675ec1be6f4df6f068fa854e79 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Tue, 8 Jun 2021 16:53:21 +0300 Subject: [PATCH 0812/1196] [#302] pkg/netmap: Document default values set in `NewFilter` Make `filtersFromV2` return `nil` if passed value is `nil`. Document field values of instance constructed via `NewFilter`. Assert the values in corresponding unit test. Signed-off-by: Pavel Karpy --- pkg/netmap/filter.go | 11 +++++++++++ pkg/netmap/filter_test.go | 22 ++++++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/pkg/netmap/filter.go b/pkg/netmap/filter.go index de6c939..4beb1f5 100644 --- a/pkg/netmap/filter.go +++ b/pkg/netmap/filter.go @@ -148,6 +148,13 @@ func (c *Context) matchKeyValue(f *Filter, b *Node) bool { } // NewFilter creates and returns new Filter instance. +// +// Defaults: +// - name: ""; +// - key: ""; +// - value: ""; +// - operation: 0; +// - filters: nil. func NewFilter() *Filter { return NewFilterFromV2(new(netmap.Filter)) } @@ -217,6 +224,10 @@ func (f *Filter) SetOperation(op Operation) { } func filtersFromV2(fs []*netmap.Filter) []*Filter { + if fs == nil { + return nil + } + res := make([]*Filter, 0, len(fs)) for i := range fs { diff --git a/pkg/netmap/filter_test.go b/pkg/netmap/filter_test.go index a9eadaa..c9103e1 100644 --- a/pkg/netmap/filter_test.go +++ b/pkg/netmap/filter_test.go @@ -307,3 +307,25 @@ func TestFilterEncoding(t *testing.T) { require.Equal(t, f, f2) }) } + +func TestNewFilter(t *testing.T) { + t.Run("default values", func(t *testing.T) { + filter := NewFilter() + + // check initial values + require.Empty(t, filter.Name()) + require.Empty(t, filter.Key()) + require.Empty(t, filter.Value()) + require.Zero(t, filter.Operation()) + require.Nil(t, filter.InnerFilters()) + + // convert to v2 message + filterV2 := filter.ToV2() + + require.Empty(t, filterV2.GetName()) + require.Empty(t, filterV2.GetKey()) + require.Empty(t, filterV2.GetValue()) + require.Equal(t, netmap.UnspecifiedOperation, filterV2.GetOp()) + require.Nil(t, filterV2.GetFilters()) + }) +} From 6142a352daba9261d37dca30de8be603a9059ab7 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Tue, 8 Jun 2021 17:07:04 +0300 Subject: [PATCH 0813/1196] [#302] pkg/netmap: Convert nil `NetworkInfo` to nil message Document that `NetworkInfo.ToV2` method return `nil` when called on `nil`. Document that `NewNetworkInfoFromV2` function return `nil` when called on `nil`. Write corresponding unit tests. Signed-off-by: Pavel Karpy --- pkg/netmap/network_info.go | 4 ++++ pkg/netmap/network_info_test.go | 14 ++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/pkg/netmap/network_info.go b/pkg/netmap/network_info.go index ba3f204..d4a6bdb 100644 --- a/pkg/netmap/network_info.go +++ b/pkg/netmap/network_info.go @@ -9,6 +9,8 @@ import ( type NetworkInfo netmap.NetworkInfo // NewNetworkInfoFromV2 wraps v2 NetworkInfo message to NetworkInfo. +// +// Nil netmap.NetworkInfo converts to nil. func NewNetworkInfoFromV2(iV2 *netmap.NetworkInfo) *NetworkInfo { return (*NetworkInfo)(iV2) } @@ -19,6 +21,8 @@ func NewNetworkInfo() *NetworkInfo { } // ToV2 converts NetworkInfo to v2 NetworkInfo. +// +// Nil NetworkInfo converts to nil. func (i *NetworkInfo) ToV2() *netmap.NetworkInfo { return (*netmap.NetworkInfo)(i) } diff --git a/pkg/netmap/network_info_test.go b/pkg/netmap/network_info_test.go index bb8643f..04234e8 100644 --- a/pkg/netmap/network_info_test.go +++ b/pkg/netmap/network_info_test.go @@ -51,3 +51,17 @@ func TestNetworkInfoEncoding(t *testing.T) { require.Equal(t, i, i2) }) } + +func TestNewNetworkInfoFromV2(t *testing.T) { + t.Run("nil", func(t *testing.T) { + require.Nil(t, NewNetworkInfoFromV2(nil)) + }) +} + +func TestNetworkInfo_ToV2(t *testing.T) { + t.Run("nil", func(t *testing.T) { + var x *NetworkInfo + + require.Nil(t, x.ToV2()) + }) +} From 19cf3c2d0b0305e6725610c5eb6c6002b2ec790b Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Tue, 8 Jun 2021 17:11:11 +0300 Subject: [PATCH 0814/1196] [#302] pkg/netmap: Document default values set in `NewNetworkInfo` Document field values of instance constructed via `NewNetworkInfo`. Assert the values in corresponding unit test. Signed-off-by: Pavel Karpy --- pkg/netmap/network_info.go | 4 ++++ pkg/netmap/network_info_test.go | 14 ++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/pkg/netmap/network_info.go b/pkg/netmap/network_info.go index d4a6bdb..609c9cc 100644 --- a/pkg/netmap/network_info.go +++ b/pkg/netmap/network_info.go @@ -16,6 +16,10 @@ func NewNetworkInfoFromV2(iV2 *netmap.NetworkInfo) *NetworkInfo { } // NewNetworkInfo creates and initializes blank NetworkInfo. +// +// Defaults: +// - curEpoch: 0; +// - magicNum: 0. func NewNetworkInfo() *NetworkInfo { return NewNetworkInfoFromV2(new(netmap.NetworkInfo)) } diff --git a/pkg/netmap/network_info_test.go b/pkg/netmap/network_info_test.go index 04234e8..c5d9461 100644 --- a/pkg/netmap/network_info_test.go +++ b/pkg/netmap/network_info_test.go @@ -65,3 +65,17 @@ func TestNetworkInfo_ToV2(t *testing.T) { require.Nil(t, x.ToV2()) }) } + +func TestNewNetworkInfo(t *testing.T) { + ni := NewNetworkInfo() + + // check initial values + require.Zero(t, ni.CurrentEpoch()) + require.Zero(t, ni.MagicNumber()) + + // convert to v2 message + niV2 := ni.ToV2() + + require.Zero(t, niV2.GetCurrentEpoch()) + require.Zero(t, niV2.GetMagicNumber()) +} From 05f48d9394b0fb21c4e2418aba8eea6ead9845c4 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Tue, 8 Jun 2021 17:47:12 +0300 Subject: [PATCH 0815/1196] [#302] pkg/netmap: Convert nil `NodeInfo` and `NodeAttribute` to nil message Document that `NodeAttribute.ToV2` and `NodeInfo.ToV2` method return `nil` when called on `nil`. Document that `NodeAttributeFromV2` and `NodeInfoFromV2` functions return `nil` when called on `nil`. Write corresponding unit tests. Signed-off-by: Pavel Karpy --- pkg/netmap/node_info.go | 8 ++++++ pkg/netmap/node_info_test.go | 53 ++++++++++++++++++++++++++---------- 2 files changed, 46 insertions(+), 15 deletions(-) diff --git a/pkg/netmap/node_info.go b/pkg/netmap/node_info.go index 17aa9f4..935f9d2 100644 --- a/pkg/netmap/node_info.go +++ b/pkg/netmap/node_info.go @@ -193,11 +193,15 @@ func NewNodeAttribute() *NodeAttribute { } // NodeAttributeFromV2 converts v2 node Attribute to NodeAttribute. +// +// Nil netmap.Attribute converts to nil. func NewNodeAttributeFromV2(a *netmap.Attribute) *NodeAttribute { return (*NodeAttribute)(a) } // ToV2 converts NodeAttribute to v2 node Attribute. +// +// Nil NodeAttribute converts to nil. func (a *NodeAttribute) ToV2() *netmap.Attribute { return (*netmap.Attribute)(a) } @@ -276,11 +280,15 @@ func NewNodeInfo() *NodeInfo { } // NewNodeInfoFromV2 converts v2 NodeInfo to NodeInfo. +// +// Nil netmap.NodeInfo converts to nil. func NewNodeInfoFromV2(i *netmap.NodeInfo) *NodeInfo { return (*NodeInfo)(i) } // ToV2 converts NodeInfo to v2 NodeInfo. +// +// Nil NodeInfo converts to nil. func (i *NodeInfo) ToV2() *netmap.NodeInfo { return (*netmap.NodeInfo)(i) } diff --git a/pkg/netmap/node_info_test.go b/pkg/netmap/node_info_test.go index 9b50a9b..ea80656 100644 --- a/pkg/netmap/node_info_test.go +++ b/pkg/netmap/node_info_test.go @@ -4,6 +4,7 @@ import ( "testing" "github.com/nspcc-dev/neofs-api-go/v2/netmap" + testv2 "github.com/nspcc-dev/neofs-api-go/v2/netmap/test" "github.com/stretchr/testify/require" ) @@ -31,14 +32,27 @@ func TestNodeStateFromV2(t *testing.T) { } func TestNodeAttributeFromV2(t *testing.T) { - aV2 := new(netmap.Attribute) - aV2.SetKey("key") - aV2.SetValue("value") - aV2.SetParents([]string{"par1", "par2"}) + t.Run("from nil", func(t *testing.T) { + var x *netmap.Attribute - a := NewNodeAttributeFromV2(aV2) + require.Nil(t, NewNodeAttributeFromV2(x)) + }) - require.Equal(t, aV2, a.ToV2()) + t.Run("from non-nil", func(t *testing.T) { + aV2 := testv2.GenerateAttribute(false) + + a := NewNodeAttributeFromV2(aV2) + + require.Equal(t, aV2, a.ToV2()) + }) +} + +func TestNodeAttribute_ToV2(t *testing.T) { + t.Run("nil", func(t *testing.T) { + var x *NodeAttribute + + require.Nil(t, x.ToV2()) + }) } func TestNodeAttribute_Key(t *testing.T) { @@ -78,18 +92,27 @@ func testNodeAttribute() *NodeAttribute { } func TestNodeInfoFromV2(t *testing.T) { - iV2 := new(netmap.NodeInfo) - iV2.SetPublicKey([]byte{1, 2, 3}) - iV2.SetAddress("456") - iV2.SetState(netmap.Online) - iV2.SetAttributes([]*netmap.Attribute{ - testNodeAttribute().ToV2(), - testNodeAttribute().ToV2(), + t.Run("from nil", func(t *testing.T) { + var x *netmap.NodeInfo + + require.Nil(t, NewNodeInfoFromV2(x)) }) - i := NewNodeInfoFromV2(iV2) + t.Run("from non-nil", func(t *testing.T) { + iV2 := testv2.GenerateNodeInfo(false) - require.Equal(t, iV2, i.ToV2()) + i := NewNodeInfoFromV2(iV2) + + require.Equal(t, iV2, i.ToV2()) + }) +} + +func TestNodeInfo_ToV2(t *testing.T) { + t.Run("nil", func(t *testing.T) { + var x *NodeInfo + + require.Nil(t, x.ToV2()) + }) } func TestNodeInfo_PublicKey(t *testing.T) { From df4d610fad0b2b397d5cfeef62f952ed37bff700 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Tue, 8 Jun 2021 18:06:03 +0300 Subject: [PATCH 0816/1196] [#302] pkg/netmap: Document default values set in `NewNodeInfo` and `NewNodeAttribute` Document field values of instance constructed via `NewNodeInfo` and `NewNodeAttribute`. Assert the values in corresponding unit test. Signed-off-by: Pavel Karpy --- pkg/netmap/node_info.go | 19 ++++++++++++++++++ pkg/netmap/node_info_test.go | 38 ++++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+) diff --git a/pkg/netmap/node_info.go b/pkg/netmap/node_info.go index 935f9d2..cd81358 100644 --- a/pkg/netmap/node_info.go +++ b/pkg/netmap/node_info.go @@ -188,6 +188,11 @@ func (s NodeState) String() string { } // NewNodeAttribute creates and returns new NodeAttribute instance. +// +// Defaults: +// - key: ""; +// - value: ""; +// - parents: nil. func NewNodeAttribute() *NodeAttribute { return NewNodeAttributeFromV2(new(netmap.Attribute)) } @@ -275,6 +280,12 @@ func (a *NodeAttribute) UnmarshalJSON(data []byte) error { } // NewNodeInfo creates and returns new NodeInfo instance. +// +// Defaults: +// - publicKey: nil; +// - address: ""; +// - attributes nil; +// - state: 0. func NewNodeInfo() *NodeInfo { return NewNodeInfoFromV2(new(netmap.NodeInfo)) } @@ -319,9 +330,17 @@ func (i *NodeInfo) SetAddress(addr string) { // Attributes returns list of the node attributes. func (i *NodeInfo) Attributes() []*NodeAttribute { + if i == nil { + return nil + } + as := (*netmap.NodeInfo)(i). GetAttributes() + if as == nil { + return nil + } + res := make([]*NodeAttribute, 0, len(as)) for i := range as { diff --git a/pkg/netmap/node_info_test.go b/pkg/netmap/node_info_test.go index ea80656..e380561 100644 --- a/pkg/netmap/node_info_test.go +++ b/pkg/netmap/node_info_test.go @@ -202,3 +202,41 @@ func TestNodeInfoEncoding(t *testing.T) { require.Equal(t, i, i2) }) } + +func TestNewNodeAttribute(t *testing.T) { + t.Run("default values", func(t *testing.T) { + attr := NewNodeAttribute() + + // check initial values + require.Empty(t, attr.Key()) + require.Empty(t, attr.Value()) + require.Nil(t, attr.ParentKeys()) + + // convert to v2 message + attrV2 := attr.ToV2() + + require.Empty(t, attrV2.GetKey()) + require.Empty(t, attrV2.GetValue()) + require.Nil(t, attrV2.GetParents()) + }) +} + +func TestNewNodeInfo(t *testing.T) { + t.Run("default values", func(t *testing.T) { + ni := NewNodeInfo() + + // check initial values + require.Nil(t, ni.PublicKey()) + require.Empty(t, ni.Address()) + require.Nil(t, ni.Attributes()) + require.Zero(t, ni.State()) + + // convert to v2 message + niV2 := ni.ToV2() + + require.Nil(t, niV2.GetPublicKey()) + require.Empty(t, niV2.GetAddress()) + require.Nil(t, niV2.GetAttributes()) + require.EqualValues(t, netmap.UnspecifiedState, niV2.GetState()) + }) +} From 2176cb9f2b5ce31f2182ff84946dd8b83e8c5fa0 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Tue, 8 Jun 2021 18:13:31 +0300 Subject: [PATCH 0817/1196] [#302] pkg/netmap: Convert nil `PlacementPolicy` to nil message Document that `PlacementPolicy.ToV2` method return `nil` when called on `nil`. Document that `PlacementPolicyFromV2` function return `nil` when called on `nil`. Write corresponding unit tests. Signed-off-by: Pavel Karpy --- pkg/netmap/policy.go | 4 ++++ pkg/netmap/policy_test.go | 16 ++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/pkg/netmap/policy.go b/pkg/netmap/policy.go index ce8a978..2703553 100644 --- a/pkg/netmap/policy.go +++ b/pkg/netmap/policy.go @@ -13,11 +13,15 @@ func NewPlacementPolicy() *PlacementPolicy { } // NewPlacementPolicyFromV2 converts v2 PlacementPolicy to PlacementPolicy. +// +// Nil netmap.PlacementPolicy converts to nil. func NewPlacementPolicyFromV2(f *netmap.PlacementPolicy) *PlacementPolicy { return (*PlacementPolicy)(f) } // ToV2 converts PlacementPolicy to v2 PlacementPolicy. +// +// Nil PlacementPolicy converts to nil. func (p *PlacementPolicy) ToV2() *netmap.PlacementPolicy { return (*netmap.PlacementPolicy)(p) } diff --git a/pkg/netmap/policy_test.go b/pkg/netmap/policy_test.go index 9fca579..173317a 100644 --- a/pkg/netmap/policy_test.go +++ b/pkg/netmap/policy_test.go @@ -144,3 +144,19 @@ func TestPlacementPolicyEncoding(t *testing.T) { require.Equal(t, p, p2) }) } + +func TestNewPlacementPolicy(t *testing.T) { + t.Run("nil", func(t *testing.T) { + var x *PlacementPolicy + + require.Nil(t, x.ToV2()) + }) +} + +func TestNewPlacementPolicyFromV2(t *testing.T) { + t.Run("from nil", func(t *testing.T) { + var x *netmap.PlacementPolicy + + require.Nil(t, NewPlacementPolicyFromV2(x)) + }) +} From 6fb7c79219f10f9d6703b3e52e5342a977fc06b9 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Tue, 8 Jun 2021 18:20:48 +0300 Subject: [PATCH 0818/1196] [#302] pkg/netmap: Document default values set in `NewPlacementPolicy` Document field values of instance constructed via `NewPlacementPolicy`. Assert the values in corresponding unit test. Signed-off-by: Pavel Karpy --- pkg/netmap/policy.go | 14 ++++++++++++++ pkg/netmap/policy_test.go | 18 ++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/pkg/netmap/policy.go b/pkg/netmap/policy.go index 2703553..dc2e54e 100644 --- a/pkg/netmap/policy.go +++ b/pkg/netmap/policy.go @@ -8,6 +8,12 @@ import ( type PlacementPolicy netmap.PlacementPolicy // NewPlacementPolicy creates and returns new PlacementPolicy instance. +// +// Defaults: +// - backupFactor: 0; +// - replicas nil; +// - selectors nil; +// - filters nil. func NewPlacementPolicy() *PlacementPolicy { return NewPlacementPolicyFromV2(new(netmap.PlacementPolicy)) } @@ -31,6 +37,10 @@ func (p *PlacementPolicy) Replicas() []*Replica { rs := (*netmap.PlacementPolicy)(p). GetReplicas() + if rs == nil { + return nil + } + res := make([]*Replica, 0, len(rs)) for i := range rs { @@ -73,6 +83,10 @@ func (p *PlacementPolicy) Selectors() []*Selector { rs := (*netmap.PlacementPolicy)(p). GetSelectors() + if rs == nil { + return nil + } + res := make([]*Selector, 0, len(rs)) for i := range rs { diff --git a/pkg/netmap/policy_test.go b/pkg/netmap/policy_test.go index 173317a..43b45ed 100644 --- a/pkg/netmap/policy_test.go +++ b/pkg/netmap/policy_test.go @@ -151,6 +151,24 @@ func TestNewPlacementPolicy(t *testing.T) { require.Nil(t, x.ToV2()) }) + + t.Run("default values", func(t *testing.T) { + pp := NewPlacementPolicy() + + // check initial values + require.Nil(t, pp.Replicas()) + require.Nil(t, pp.Filters()) + require.Nil(t, pp.Selectors()) + require.Zero(t, pp.ContainerBackupFactor()) + + // convert to v2 message + ppV2 := pp.ToV2() + + require.Nil(t, ppV2.GetReplicas()) + require.Nil(t, ppV2.GetFilters()) + require.Nil(t, ppV2.GetSelectors()) + require.Zero(t, ppV2.GetContainerBackupFactor()) + }) } func TestNewPlacementPolicyFromV2(t *testing.T) { From fb591f5faca4387b4b21e2c6a27b0849dd8e9244 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Tue, 8 Jun 2021 18:26:20 +0300 Subject: [PATCH 0819/1196] [#302] pkg/netmap: Convert nil `Replica` to nil message Document that `Replica.ToV2` method return `nil` when called on `nil`. Document that `ReplicaFromV2` function return `nil` when called on `nil`. Write corresponding unit tests. Signed-off-by: Pavel Karpy --- pkg/netmap/replica.go | 4 ++++ pkg/netmap/replica_test.go | 25 ++++++++++++++++++++----- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/pkg/netmap/replica.go b/pkg/netmap/replica.go index 95349e6..b9bae5d 100644 --- a/pkg/netmap/replica.go +++ b/pkg/netmap/replica.go @@ -13,11 +13,15 @@ func NewReplica() *Replica { } // NewReplicaFromV2 converts v2 Replica to Replica. +// +// Nil netmap.Replica converts to nil. func NewReplicaFromV2(f *netmap.Replica) *Replica { return (*Replica)(f) } // ToV2 converts Replica to v2 Replica. +// +// Nil Replica converts to nil. func (r *Replica) ToV2() *netmap.Replica { return (*netmap.Replica)(r) } diff --git a/pkg/netmap/replica_test.go b/pkg/netmap/replica_test.go index e366c2e..9c6d5a9 100644 --- a/pkg/netmap/replica_test.go +++ b/pkg/netmap/replica_test.go @@ -4,6 +4,7 @@ import ( "testing" "github.com/nspcc-dev/neofs-api-go/v2/netmap" + testv2 "github.com/nspcc-dev/neofs-api-go/v2/netmap/test" "github.com/stretchr/testify/require" ) @@ -16,13 +17,19 @@ func testReplica() *Replica { } func TestReplicaFromV2(t *testing.T) { - rV2 := new(netmap.Replica) - rV2.SetCount(3) - rV2.SetSelector("selector") + t.Run("from nil", func(t *testing.T) { + var x *netmap.Replica - r := NewReplicaFromV2(rV2) + require.Nil(t, NewReplicaFromV2(x)) + }) - require.Equal(t, rV2, r.ToV2()) + t.Run("from non-nil", func(t *testing.T) { + rV2 := testv2.GenerateReplica(false) + + r := NewReplicaFromV2(rV2) + + require.Equal(t, rV2, r.ToV2()) + }) } func TestReplica_Count(t *testing.T) { @@ -66,3 +73,11 @@ func TestReplicaEncoding(t *testing.T) { require.Equal(t, r, r2) }) } + +func TestReplica_ToV2(t *testing.T) { + t.Run("nil", func(t *testing.T) { + var x *Replica + + require.Nil(t, x.ToV2()) + }) +} From af1742b48a99842193ed70a99e6a54442bf3df77 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Tue, 8 Jun 2021 18:29:16 +0300 Subject: [PATCH 0820/1196] [#302] pkg/netmap: Document default values set in `NewReplica` Document field values of instance constructed via `NewReplica`. Assert the values in corresponding unit test. Signed-off-by: Pavel Karpy --- pkg/netmap/replica.go | 4 ++++ pkg/netmap/replica_test.go | 16 ++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/pkg/netmap/replica.go b/pkg/netmap/replica.go index b9bae5d..9bceb7f 100644 --- a/pkg/netmap/replica.go +++ b/pkg/netmap/replica.go @@ -8,6 +8,10 @@ import ( type Replica netmap.Replica // NewReplica creates and returns new Replica instance. +// +// Defaults: +// - count: 0; +// - selector: "". func NewReplica() *Replica { return NewReplicaFromV2(new(netmap.Replica)) } diff --git a/pkg/netmap/replica_test.go b/pkg/netmap/replica_test.go index 9c6d5a9..c1b0dba 100644 --- a/pkg/netmap/replica_test.go +++ b/pkg/netmap/replica_test.go @@ -81,3 +81,19 @@ func TestReplica_ToV2(t *testing.T) { require.Nil(t, x.ToV2()) }) } + +func TestNewReplica(t *testing.T) { + t.Run("default values", func(t *testing.T) { + r := NewReplica() + + // check initial values + require.Zero(t, r.Count()) + require.Empty(t, r.Selector()) + + // convert to v2 message + rV2 := r.ToV2() + + require.Zero(t, rV2.GetCount()) + require.Empty(t, rV2.GetSelector()) + }) +} From c47d1fb26b479ac156c395b3a630084199cc51f7 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Tue, 8 Jun 2021 18:33:38 +0300 Subject: [PATCH 0821/1196] [#302] pkg/netmap: Convert nil `Selector` to nil message Document that `Selector.ToV2` method return `nil` when called on `nil`. Document that `NewSelectorFromV2` function return `nil` when called on `nil`. Write corresponding unit tests. Signed-off-by: Pavel Karpy --- pkg/netmap/selector.go | 4 ++++ pkg/netmap/selector_test.go | 38 ++++++++++++++++++++++++------------- 2 files changed, 29 insertions(+), 13 deletions(-) diff --git a/pkg/netmap/selector.go b/pkg/netmap/selector.go index 7a7f297..72ae857 100644 --- a/pkg/netmap/selector.go +++ b/pkg/netmap/selector.go @@ -161,11 +161,15 @@ func NewSelector() *Selector { } // NewSelectorFromV2 converts v2 Selector to Selector. +// +// Nil netmap.Selector converts to nil. func NewSelectorFromV2(f *netmap.Selector) *Selector { return (*Selector)(f) } // ToV2 converts Selector to v2 Selector. +// +// Nil Selector converts to nil. func (s *Selector) ToV2() *netmap.Selector { return (*netmap.Selector)(s) } diff --git a/pkg/netmap/selector_test.go b/pkg/netmap/selector_test.go index e8e1f32..f628d0b 100644 --- a/pkg/netmap/selector_test.go +++ b/pkg/netmap/selector_test.go @@ -6,6 +6,7 @@ import ( "testing" "github.com/nspcc-dev/neofs-api-go/v2/netmap" + testv2 "github.com/nspcc-dev/neofs-api-go/v2/netmap/test" "github.com/stretchr/testify/require" ) @@ -414,19 +415,6 @@ func testSelector() *Selector { return s } -func TestSelectorFromV2(t *testing.T) { - sV2 := new(netmap.Selector) - sV2.SetName("name") - sV2.SetCount(3) - sV2.SetClause(netmap.Distinct) - sV2.SetAttribute("attribute") - sV2.SetFilter("filter") - - s := NewSelectorFromV2(sV2) - - require.Equal(t, sV2, s.ToV2()) -} - func TestSelector_Name(t *testing.T) { s := NewSelector() name := "some name" @@ -495,3 +483,27 @@ func TestSelectorEncoding(t *testing.T) { require.Equal(t, s, s2) }) } + +func TestSelector_ToV2(t *testing.T) { + t.Run("nil", func(t *testing.T) { + var x *Selector + + require.Nil(t, x.ToV2()) + }) +} + +func TestNewSelectorFromV2(t *testing.T) { + t.Run("from nil", func(t *testing.T) { + var x *netmap.Selector + + require.Nil(t, NewSelectorFromV2(x)) + }) + + t.Run("from non-nil", func(t *testing.T) { + sV2 := testv2.GenerateSelector(false) + + s := NewSelectorFromV2(sV2) + + require.Equal(t, sV2, s.ToV2()) + }) +} From 2307c8f8f70969707f660dbaaaf3495ec331608a Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Tue, 8 Jun 2021 18:39:19 +0300 Subject: [PATCH 0822/1196] [#302] pkg/netmap: Document default values set in `NewSelector` Document field values of instance constructed via `NewSelector`. Assert the values in corresponding unit test. Signed-off-by: Pavel Karpy --- pkg/netmap/selector.go | 7 +++++++ pkg/netmap/selector_test.go | 22 ++++++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/pkg/netmap/selector.go b/pkg/netmap/selector.go index 72ae857..b4100d4 100644 --- a/pkg/netmap/selector.go +++ b/pkg/netmap/selector.go @@ -156,6 +156,13 @@ func (c *Context) getSelectionBase(s *Selector) []nodeAttrPair { } // NewSelector creates and returns new Selector instance. +// +// Defaults: +// - name: ""; +// - attribute: ""; +// - filter: ""; +// - clause: ClauseUnspecified; +// - count: 0. func NewSelector() *Selector { return NewSelectorFromV2(new(netmap.Selector)) } diff --git a/pkg/netmap/selector_test.go b/pkg/netmap/selector_test.go index f628d0b..6854288 100644 --- a/pkg/netmap/selector_test.go +++ b/pkg/netmap/selector_test.go @@ -507,3 +507,25 @@ func TestNewSelectorFromV2(t *testing.T) { require.Equal(t, sV2, s.ToV2()) }) } + +func TestNewSelector(t *testing.T) { + t.Run("default values", func(t *testing.T) { + s := NewSelector() + + // check initial values + require.Zero(t, s.Count()) + require.Equal(t, ClauseUnspecified, s.Clause()) + require.Empty(t, s.Attribute()) + require.Empty(t, s.Name()) + require.Empty(t, s.Filter()) + + // convert to v2 message + sV2 := s.ToV2() + + require.Zero(t, sV2.GetCount()) + require.Equal(t, netmap.UnspecifiedClause, sV2.GetClause()) + require.Empty(t, sV2.GetAttribute()) + require.Empty(t, sV2.GetName()) + require.Empty(t, sV2.GetFilter()) + }) +} From c978fa0e215b712aeeb73cd4322bf4ca97c7bf64 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Tue, 8 Jun 2021 18:44:47 +0300 Subject: [PATCH 0823/1196] [#302] pkg/object: Convert nil `Address` to nil message Document that `Address.ToV2` method return `nil` when called on `nil`. Document that `NewAddressFromV2` function return `nil` when called on `nil`. Write corresponding unit tests. Signed-off-by: Pavel Karpy --- pkg/object/address.go | 4 ++++ pkg/object/address_test.go | 17 +++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/pkg/object/address.go b/pkg/object/address.go index a241e63..54d550f 100644 --- a/pkg/object/address.go +++ b/pkg/object/address.go @@ -19,6 +19,8 @@ const ( ) // NewAddressFromV2 converts v2 Address message to Address. +// +// Nil refs.Address converts to nil. func NewAddressFromV2(aV2 *refs.Address) *Address { return (*Address)(aV2) } @@ -31,6 +33,8 @@ func NewAddress() *Address { } // ToV2 converts Address to v2 Address message. +// +// Nil Address converts to nil. func (a *Address) ToV2() *refs.Address { return (*refs.Address)(a) } diff --git a/pkg/object/address_test.go b/pkg/object/address_test.go index 652f44b..f3b8b35 100644 --- a/pkg/object/address_test.go +++ b/pkg/object/address_test.go @@ -5,6 +5,7 @@ import ( "testing" cidtest "github.com/nspcc-dev/neofs-api-go/pkg/container/id/test" + "github.com/nspcc-dev/neofs-api-go/v2/refs" "github.com/stretchr/testify/require" ) @@ -84,3 +85,19 @@ func TestAddressEncoding(t *testing.T) { require.Equal(t, a, a2) }) } + +func TestNewAddressFromV2(t *testing.T) { + t.Run("from nil", func(t *testing.T) { + var x *refs.Address + + require.Nil(t, NewAddressFromV2(x)) + }) +} + +func TestAddress_ToV2(t *testing.T) { + t.Run("nil", func(t *testing.T) { + var x *Address + + require.Nil(t, x.ToV2()) + }) +} From 5fda8ef796854e39a485ca596143fef1cdf6a512 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Tue, 8 Jun 2021 18:48:20 +0300 Subject: [PATCH 0824/1196] [#302] pkg/object: Document default values set in `NewAddress` Document field values of instance constructed via `NewAddress`. Assert the values in corresponding unit test. Signed-off-by: Pavel Karpy --- pkg/object/address.go | 4 ++++ pkg/object/address_test.go | 16 ++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/pkg/object/address.go b/pkg/object/address.go index 54d550f..f1072a9 100644 --- a/pkg/object/address.go +++ b/pkg/object/address.go @@ -28,6 +28,10 @@ func NewAddressFromV2(aV2 *refs.Address) *Address { // NewAddress creates and initializes blank Address. // // Works similar as NewAddressFromV2(new(Address)). +// +// Defaults: +// - cid: nil; +// - oid: nil. func NewAddress() *Address { return NewAddressFromV2(new(refs.Address)) } diff --git a/pkg/object/address_test.go b/pkg/object/address_test.go index f3b8b35..6d97cb7 100644 --- a/pkg/object/address_test.go +++ b/pkg/object/address_test.go @@ -101,3 +101,19 @@ func TestAddress_ToV2(t *testing.T) { require.Nil(t, x.ToV2()) }) } + +func TestNewAddress(t *testing.T) { + t.Run("default values", func(t *testing.T) { + a := NewAddress() + + // check initial values + require.Nil(t, a.ContainerID()) + require.Nil(t, a.ObjectID()) + + // convert to v2 message + aV2 := a.ToV2() + + require.Nil(t, aV2.GetContainerID()) + require.Nil(t, aV2.GetObjectID()) + }) +} From 941b513eb3d8b247c5a31cf96b60a71349b5904a Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Tue, 8 Jun 2021 18:50:45 +0300 Subject: [PATCH 0825/1196] [#302] pkg/object: Convert nil `Attribute` to nil message Document that `Attribute.ToV2` method return `nil` when called on `nil`. Document that `NewAttributeFromV2` function return `nil` when called on `nil`. Write corresponding unit tests. Signed-off-by: Pavel Karpy --- pkg/object/attribute.go | 4 ++++ pkg/object/attribute_test.go | 17 +++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/pkg/object/attribute.go b/pkg/object/attribute.go index cbc318d..23be55d 100644 --- a/pkg/object/attribute.go +++ b/pkg/object/attribute.go @@ -8,6 +8,8 @@ import ( type Attribute object.Attribute // NewAttributeFromV2 wraps v2 Attribute message to Attribute. +// +// Nil object.Attribute converts to nil. func NewAttributeFromV2(aV2 *object.Attribute) *Attribute { return (*Attribute)(aV2) } @@ -40,6 +42,8 @@ func (a *Attribute) SetValue(v string) { } // ToV2 converts Attribute to v2 Attribute message. +// +// Nil Attribute converts to nil. func (a *Attribute) ToV2() *object.Attribute { return (*object.Attribute)(a) } diff --git a/pkg/object/attribute_test.go b/pkg/object/attribute_test.go index a4ab8ae..05735b7 100644 --- a/pkg/object/attribute_test.go +++ b/pkg/object/attribute_test.go @@ -3,6 +3,7 @@ package object import ( "testing" + "github.com/nspcc-dev/neofs-api-go/v2/object" "github.com/stretchr/testify/require" ) @@ -47,3 +48,19 @@ func TestAttributeEncoding(t *testing.T) { require.Equal(t, a, a2) }) } + +func TestNewAttributeFromV2(t *testing.T) { + t.Run("from nil", func(t *testing.T) { + var x *object.Attribute + + require.Nil(t, NewAttributeFromV2(x)) + }) +} + +func TestAttribute_ToV2(t *testing.T) { + t.Run("nil", func(t *testing.T) { + var x *Attribute + + require.Nil(t, x.ToV2()) + }) +} From ff851215b080e43ea3a7eb10f0b8844a24782fb6 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Tue, 8 Jun 2021 18:52:49 +0300 Subject: [PATCH 0826/1196] [#302] pkg/object: Document default values set in `NewAttribute` Document field values of instance constructed via `NewAttribute`. Assert the values in corresponding unit test. Signed-off-by: Pavel Karpy --- pkg/object/attribute.go | 4 ++++ pkg/object/attribute_test.go | 16 ++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/pkg/object/attribute.go b/pkg/object/attribute.go index 23be55d..7f36686 100644 --- a/pkg/object/attribute.go +++ b/pkg/object/attribute.go @@ -17,6 +17,10 @@ func NewAttributeFromV2(aV2 *object.Attribute) *Attribute { // NewAttribute creates and initializes blank Attribute. // // Works similar as NewAttributeFromV2(new(Attribute)). +// +// Defaults: +// - key: ""; +// - value: "". func NewAttribute() *Attribute { return NewAttributeFromV2(new(object.Attribute)) } diff --git a/pkg/object/attribute_test.go b/pkg/object/attribute_test.go index 05735b7..d5f1b3f 100644 --- a/pkg/object/attribute_test.go +++ b/pkg/object/attribute_test.go @@ -64,3 +64,19 @@ func TestAttribute_ToV2(t *testing.T) { require.Nil(t, x.ToV2()) }) } + +func TestNewAttribute(t *testing.T) { + t.Run("default values", func(t *testing.T) { + a := NewAttribute() + + // check initial values + require.Empty(t, a.Key()) + require.Empty(t, a.Value()) + + // convert to v2 message + aV2 := a.ToV2() + + require.Empty(t, aV2.GetKey()) + require.Empty(t, aV2.GetValue()) + }) +} From 245a55f7152ae10d6d17534c3b6387032caef053 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Tue, 8 Jun 2021 18:58:12 +0300 Subject: [PATCH 0827/1196] [#302] pkg/object: Convert nil `ID` to nil message Document that `ID.ToV2` method return `nil` when called on `nil`. Document that `NewIDFromV2` function return `nil` when called on `nil`. Write corresponding unit tests. Signed-off-by: Pavel Karpy --- pkg/object/id.go | 4 ++++ pkg/object/id_test.go | 17 +++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/pkg/object/id.go b/pkg/object/id.go index 21d566e..e4871a9 100644 --- a/pkg/object/id.go +++ b/pkg/object/id.go @@ -16,6 +16,8 @@ type ID refs.ObjectID var errInvalidIDString = errors.New("incorrect format of the string object ID") // NewIDFromV2 wraps v2 ObjectID message to ID. +// +// Nil refs.ObjectID converts to nil. func NewIDFromV2(idV2 *refs.ObjectID) *ID { return (*ID)(idV2) } @@ -41,6 +43,8 @@ func (id *ID) Equal(id2 *ID) bool { } // ToV2 converts ID to v2 ObjectID message. +// +// Nil ID converts to nil. func (id *ID) ToV2() *refs.ObjectID { return (*refs.ObjectID)(id) } diff --git a/pkg/object/id_test.go b/pkg/object/id_test.go index a11e80b..e5e80db 100644 --- a/pkg/object/id_test.go +++ b/pkg/object/id_test.go @@ -7,6 +7,7 @@ import ( "testing" "github.com/mr-tron/base58" + "github.com/nspcc-dev/neofs-api-go/v2/refs" "github.com/stretchr/testify/require" ) @@ -107,3 +108,19 @@ func TestObjectIDEncoding(t *testing.T) { require.Equal(t, id, a2) }) } + +func TestNewIDFromV2(t *testing.T) { + t.Run("from nil", func(t *testing.T) { + var x *refs.ObjectID + + require.Nil(t, NewIDFromV2(x)) + }) +} + +func TestID_ToV2(t *testing.T) { + t.Run("nil", func(t *testing.T) { + var x *ID + + require.Nil(t, x.ToV2()) + }) +} From 6c12b4dfb6e8396e5fb79c7fc3c88869fe31aaaf Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Tue, 8 Jun 2021 19:01:00 +0300 Subject: [PATCH 0828/1196] [#302] pkg/object: Document default values set in `NewID` Document field values of instance constructed via `NewID`. Assert the values in corresponding unit test. Signed-off-by: Pavel Karpy --- pkg/object/id.go | 3 +++ pkg/object/id_test.go | 16 ++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/pkg/object/id.go b/pkg/object/id.go index e4871a9..26e70f7 100644 --- a/pkg/object/id.go +++ b/pkg/object/id.go @@ -25,6 +25,9 @@ func NewIDFromV2(idV2 *refs.ObjectID) *ID { // NewID creates and initializes blank ID. // // Works similar as NewIDFromV2(new(ObjectID)). +// +// Defaults: +// - value: nil. func NewID() *ID { return NewIDFromV2(new(refs.ObjectID)) } diff --git a/pkg/object/id_test.go b/pkg/object/id_test.go index e5e80db..e4086d8 100644 --- a/pkg/object/id_test.go +++ b/pkg/object/id_test.go @@ -71,6 +71,11 @@ func TestID_Parse(t *testing.T) { } func TestID_String(t *testing.T) { + t.Run("nil", func(t *testing.T) { + id := NewID() + require.Empty(t, id.String()) + }) + t.Run("should be equal", func(t *testing.T) { for i := 0; i < 10; i++ { t.Run(strconv.Itoa(i), func(t *testing.T) { @@ -124,3 +129,14 @@ func TestID_ToV2(t *testing.T) { require.Nil(t, x.ToV2()) }) } + +func TestNewID(t *testing.T) { + t.Run("default values", func(t *testing.T) { + id := NewID() + + // convert to v2 message + idV2 := id.ToV2() + + require.Nil(t, idV2.GetValue()) + }) +} From 4e40f195bcd0acd4a406f4ba04ed65b43f8911ea Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Tue, 8 Jun 2021 19:06:43 +0300 Subject: [PATCH 0829/1196] [#302] pkg/object: Convert nil `Range` to nil message Document that `Range.ToV2` method return `nil` when called on `nil`. Document that `NewRangeFromV2` function return `nil` when called on `nil`. Write corresponding unit tests. Signed-off-by: Pavel Karpy --- pkg/object/range.go | 4 ++++ pkg/object/range_test.go | 17 +++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/pkg/object/range.go b/pkg/object/range.go index 901bd3f..d87672e 100644 --- a/pkg/object/range.go +++ b/pkg/object/range.go @@ -8,6 +8,8 @@ import ( type Range object.Range // NewRangeFromV2 wraps v2 Range message to Range. +// +// Nil object.Range converts to nil. func NewRangeFromV2(rV2 *object.Range) *Range { return (*Range)(rV2) } @@ -18,6 +20,8 @@ func NewRange() *Range { } // ToV2 converts Range to v2 Range message. +// +// Nil Range converts to nil. func (r *Range) ToV2() *object.Range { return (*object.Range)(r) } diff --git a/pkg/object/range_test.go b/pkg/object/range_test.go index 4cce11d..099b744 100644 --- a/pkg/object/range_test.go +++ b/pkg/object/range_test.go @@ -1,6 +1,7 @@ package object import ( + "github.com/nspcc-dev/neofs-api-go/v2/object" "testing" "github.com/stretchr/testify/require" @@ -23,3 +24,19 @@ func TestRange_SetLength(t *testing.T) { require.Equal(t, ln, r.GetLength()) } + +func TestNewRangeFromV2(t *testing.T) { + t.Run("from nil", func(t *testing.T) { + var x *object.Range + + require.Nil(t, NewRangeFromV2(x)) + }) +} + +func TestRange_ToV2(t *testing.T) { + t.Run("nil", func(t *testing.T) { + var x *Range + + require.Nil(t, x.ToV2()) + }) +} From d443904e43e121257264a5cdfad4c67c4fb41119 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Tue, 8 Jun 2021 19:09:39 +0300 Subject: [PATCH 0830/1196] [#302] pkg/object: Document default values set in `NewRange` Document field values of instance constructed via `NewRange`. Assert the values in corresponding unit test. Signed-off-by: Pavel Karpy --- pkg/object/range.go | 4 ++++ pkg/object/range_test.go | 18 +++++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/pkg/object/range.go b/pkg/object/range.go index d87672e..4979aee 100644 --- a/pkg/object/range.go +++ b/pkg/object/range.go @@ -15,6 +15,10 @@ func NewRangeFromV2(rV2 *object.Range) *Range { } // NewRange creates and initializes blank Range. +// +// Defaults: +// - offset: 0; +// - length: 0. func NewRange() *Range { return NewRangeFromV2(new(object.Range)) } diff --git a/pkg/object/range_test.go b/pkg/object/range_test.go index 099b744..e14d360 100644 --- a/pkg/object/range_test.go +++ b/pkg/object/range_test.go @@ -1,9 +1,9 @@ package object import ( - "github.com/nspcc-dev/neofs-api-go/v2/object" "testing" + "github.com/nspcc-dev/neofs-api-go/v2/object" "github.com/stretchr/testify/require" ) @@ -40,3 +40,19 @@ func TestRange_ToV2(t *testing.T) { require.Nil(t, x.ToV2()) }) } + +func TestNewRange(t *testing.T) { + t.Run("default values", func(t *testing.T) { + r := NewRange() + + // check initial values + require.Zero(t, r.GetLength()) + require.Zero(t, r.GetOffset()) + + // convert to v2 message + rV2 := r.ToV2() + + require.Zero(t, rV2.GetLength()) + require.Zero(t, rV2.GetOffset()) + }) +} From 5cbdef1e467db1750f044df73013362bdff9b831 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Tue, 8 Jun 2021 19:27:53 +0300 Subject: [PATCH 0831/1196] [#302] pkg/object: Convert nil `SplitInfo` to nil message Document that `SplitInfo.ToV2` method return `nil` when called on `nil`. Document that `NewSplitInfoFromV2` function return `nil` when called on `nil`. Write corresponding unit tests. Signed-off-by: Pavel Karpy --- pkg/object/splitinfo.go | 6 ++++++ pkg/object/splitinfo_test.go | 17 +++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/pkg/object/splitinfo.go b/pkg/object/splitinfo.go index 600b87b..cbe7162 100644 --- a/pkg/object/splitinfo.go +++ b/pkg/object/splitinfo.go @@ -6,6 +6,9 @@ import ( type SplitInfo object.SplitInfo +// NewSplitInfoFromV2 wraps v2 SplitInfo message to SplitInfo. +// +// Nil object.SplitInfo converts to nil. func NewSplitInfoFromV2(v2 *object.SplitInfo) *SplitInfo { return (*SplitInfo)(v2) } @@ -14,6 +17,9 @@ func NewSplitInfo() *SplitInfo { return NewSplitInfoFromV2(new(object.SplitInfo)) } +// ToV2 converts SplitInfo to v2 SplitInfo message. +// +// Nil SplitInfo converts to nil. func (s *SplitInfo) ToV2() *object.SplitInfo { return (*object.SplitInfo)(s) } diff --git a/pkg/object/splitinfo_test.go b/pkg/object/splitinfo_test.go index 8f07313..6238710 100644 --- a/pkg/object/splitinfo_test.go +++ b/pkg/object/splitinfo_test.go @@ -5,6 +5,7 @@ import ( "testing" "github.com/nspcc-dev/neofs-api-go/pkg/object" + objv2 "github.com/nspcc-dev/neofs-api-go/v2/object" "github.com/stretchr/testify/require" ) @@ -51,3 +52,19 @@ func generateID() *object.ID { return id } + +func TestNewSplitInfoFromV2(t *testing.T) { + t.Run("from nil", func(t *testing.T) { + var x *objv2.SplitInfo + + require.Nil(t, object.NewSplitInfoFromV2(x)) + }) +} + +func TestSplitInfo_ToV2(t *testing.T) { + t.Run("nil", func(t *testing.T) { + var x *object.SplitInfo + + require.Nil(t, x.ToV2()) + }) +} From dde721ea9f19f492fe8266f382172fa748217841 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Tue, 8 Jun 2021 19:31:26 +0300 Subject: [PATCH 0832/1196] [#302] pkg/object: Document default values set in `NewSplitInfo` Document field values of instance constructed via `NewSplitInfo`. Assert the values in corresponding unit test. Signed-off-by: Pavel Karpy --- pkg/object/splitinfo.go | 6 ++++++ pkg/object/splitinfo_test.go | 18 ++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/pkg/object/splitinfo.go b/pkg/object/splitinfo.go index cbe7162..38ae308 100644 --- a/pkg/object/splitinfo.go +++ b/pkg/object/splitinfo.go @@ -13,6 +13,12 @@ func NewSplitInfoFromV2(v2 *object.SplitInfo) *SplitInfo { return (*SplitInfo)(v2) } +// NewSplitInfo creates and initializes blank SplitInfo. +// +// Defaults: +// - splitID: nil; +// - lastPart nil; +// - link: nil. func NewSplitInfo() *SplitInfo { return NewSplitInfoFromV2(new(object.SplitInfo)) } diff --git a/pkg/object/splitinfo_test.go b/pkg/object/splitinfo_test.go index 6238710..500f5ba 100644 --- a/pkg/object/splitinfo_test.go +++ b/pkg/object/splitinfo_test.go @@ -68,3 +68,21 @@ func TestSplitInfo_ToV2(t *testing.T) { require.Nil(t, x.ToV2()) }) } + +func TestNewSplitInfo(t *testing.T) { + t.Run("default values", func(t *testing.T) { + si := object.NewSplitInfo() + + // check initial values + require.Nil(t, si.SplitID()) + require.Nil(t, si.LastPart()) + require.Nil(t, si.Link()) + + // convert to v2 message + siV2 := si.ToV2() + + require.Nil(t, siV2.GetSplitID()) + require.Nil(t, siV2.GetLastPart()) + require.Nil(t, siV2.GetLink()) + }) +} From 753402c336159ce559ef9ab4e1655337e109ee11 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Tue, 8 Jun 2021 19:37:35 +0300 Subject: [PATCH 0833/1196] [#302] pkg/object: Convert nil `Tombstone` to nil message Document that `NewTombstoneFromV2` function return `nil` when called on `nil`. Write corresponding unit tests. Signed-off-by: Pavel Karpy --- pkg/object/splitid_test.go | 1 + pkg/object/tombstone.go | 2 ++ pkg/object/tombstone_test.go | 9 +++++++++ 3 files changed, 12 insertions(+) diff --git a/pkg/object/splitid_test.go b/pkg/object/splitid_test.go index 8adcc86..04b40f7 100644 --- a/pkg/object/splitid_test.go +++ b/pkg/object/splitid_test.go @@ -45,3 +45,4 @@ func TestSplitID(t *testing.T) { }) }) } + diff --git a/pkg/object/tombstone.go b/pkg/object/tombstone.go index 469e684..add7f5d 100644 --- a/pkg/object/tombstone.go +++ b/pkg/object/tombstone.go @@ -9,6 +9,8 @@ import ( type Tombstone tombstone.Tombstone // NewTombstoneFromV2 wraps v2 Tombstone message to Tombstone. +// +// Nil tombstone.Tombstone converts to nil. func NewTombstoneFromV2(tV2 *tombstone.Tombstone) *Tombstone { return (*Tombstone)(tV2) } diff --git a/pkg/object/tombstone_test.go b/pkg/object/tombstone_test.go index 21103ba..f9a0650 100644 --- a/pkg/object/tombstone_test.go +++ b/pkg/object/tombstone_test.go @@ -5,6 +5,7 @@ import ( "crypto/sha256" "testing" + "github.com/nspcc-dev/neofs-api-go/v2/tombstone" "github.com/stretchr/testify/require" ) @@ -63,3 +64,11 @@ func TestTombstoneEncoding(t *testing.T) { require.Equal(t, ts, ts2) }) } + +func TestNewTombstoneFromV2(t *testing.T) { + t.Run("from nil", func(t *testing.T) { + var x *tombstone.Tombstone + + require.Nil(t, NewTombstoneFromV2(x)) + }) +} From 2fb67d99d397e2124ef93c200c47c41906a5f57b Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Tue, 8 Jun 2021 19:43:26 +0300 Subject: [PATCH 0834/1196] [#302] pkg/object: Document default values set in `NewTombstone` Document field values of instance constructed via `NewTombstone`. Assert the values in corresponding unit test. Signed-off-by: Pavel Karpy --- pkg/object/tombstone.go | 12 ++++++++++++ pkg/object/tombstone_test.go | 18 ++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/pkg/object/tombstone.go b/pkg/object/tombstone.go index add7f5d..1d7e522 100644 --- a/pkg/object/tombstone.go +++ b/pkg/object/tombstone.go @@ -16,10 +16,22 @@ func NewTombstoneFromV2(tV2 *tombstone.Tombstone) *Tombstone { } // NewTombstone creates and initializes blank Tombstone. +// +// Defaults: +// - exp: 0; +// - splitID: nil; +// - members: nil. func NewTombstone() *Tombstone { return NewTombstoneFromV2(new(tombstone.Tombstone)) } +// ToV2 converts Tombstone to v2 Tombstone message. +// +// Nil Tombstone converts to nil. +func (ts *Tombstone) ToV2() *tombstone.Tombstone { + return (*tombstone.Tombstone)(ts) +} + // ExpirationEpoch return number of tombstone expiration epoch. func (t *Tombstone) ExpirationEpoch() uint64 { return (*tombstone.Tombstone)(t). diff --git a/pkg/object/tombstone_test.go b/pkg/object/tombstone_test.go index f9a0650..340fa2a 100644 --- a/pkg/object/tombstone_test.go +++ b/pkg/object/tombstone_test.go @@ -72,3 +72,21 @@ func TestNewTombstoneFromV2(t *testing.T) { require.Nil(t, NewTombstoneFromV2(x)) }) } + +func TestNewTombstone(t *testing.T) { + t.Run("default values", func(t *testing.T) { + ts := NewTombstone() + + // check initial values + require.Nil(t, ts.SplitID()) + require.Nil(t, ts.Members()) + require.Zero(t, ts.ExpirationEpoch()) + + // convert to v2 message + tsV2 := ts.ToV2() + + require.Nil(t, tsV2.GetSplitID()) + require.Nil(t, tsV2.GetMembers()) + require.Zero(t, tsV2.GetExpirationEpoch()) + }) +} From bbd651767e25ae557e19714baba4b429388c86df Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Wed, 9 Jun 2021 16:18:56 +0300 Subject: [PATCH 0835/1196] [#302] pkg/object: Convert nil `SplitID` to nil message Document that `SplitID.ToV2` method return `nil` when called on `nil`. Document that `NewSplitIDFromV2` function return `nil` when called on `nil`. Write corresponding unit tests. Signed-off-by: Pavel Karpy --- pkg/object/splitid.go | 8 ++++++++ pkg/object/splitid_test.go | 15 +++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/pkg/object/splitid.go b/pkg/object/splitid.go index 8e9eaa2..e495e8d 100644 --- a/pkg/object/splitid.go +++ b/pkg/object/splitid.go @@ -18,7 +18,13 @@ func NewSplitID() *SplitID { // NewSplitIDFromV2 returns parsed UUID from bytes. // If v is invalid UUIDv4 byte sequence, then function returns nil. +// +// Nil converts to nil. func NewSplitIDFromV2(v []byte) *SplitID { + if v == nil { + return nil + } + id := uuid.New() err := id.UnmarshalBinary(v) @@ -58,6 +64,8 @@ func (id *SplitID) SetUUID(v uuid.UUID) { } // ToV2 converts SplitID to a representation of SplitID in neofs-api v2. +// +// Nil SplitID converts to nil. func (id *SplitID) ToV2() []byte { if id == nil { return nil diff --git a/pkg/object/splitid_test.go b/pkg/object/splitid_test.go index 04b40f7..7371ed3 100644 --- a/pkg/object/splitid_test.go +++ b/pkg/object/splitid_test.go @@ -46,3 +46,18 @@ func TestSplitID(t *testing.T) { }) } +func TestSplitID_ToV2(t *testing.T) { + t.Run("nil", func(t *testing.T) { + var x *object.SplitID + + require.Nil(t, x.ToV2()) + }) +} + +func TestNewIDFromV2(t *testing.T) { + t.Run("from nil", func(t *testing.T) { + var x []byte + + require.Nil(t, object.NewSplitIDFromV2(x)) + }) +} From d802a994f57e9b0450204e3f7c91024fa3096d41 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Wed, 9 Jun 2021 16:25:59 +0300 Subject: [PATCH 0836/1196] [#302] pkg/object: Document default values set in `NewSplitID` Document field values of instance constructed via `NewSplitID`. Signed-off-by: Pavel Karpy --- pkg/object/splitid.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg/object/splitid.go b/pkg/object/splitid.go index e495e8d..84288f2 100644 --- a/pkg/object/splitid.go +++ b/pkg/object/splitid.go @@ -10,6 +10,9 @@ type SplitID struct { } // NewSplitID returns UUID representation of splitID attribute. +// +// Defaults: +// - id: random UUID. func NewSplitID() *SplitID { return &SplitID{ uuid: uuid.New(), From 12574469e5635a0c4766fce74403a325a8525b85 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Tue, 8 Jun 2021 19:49:25 +0300 Subject: [PATCH 0837/1196] [#302] pkg/owner: Convert nil `ID` to nil message Document that `ID.ToV2` method return `nil` when called on `nil`. Document that `NewIDFromV2` function return `nil` when called on `nil`. Write corresponding unit tests. Signed-off-by: Pavel Karpy --- pkg/owner/id.go | 4 ++++ pkg/owner/id_test.go | 17 +++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/pkg/owner/id.go b/pkg/owner/id.go index 2743b73..fadb818 100644 --- a/pkg/owner/id.go +++ b/pkg/owner/id.go @@ -16,6 +16,8 @@ type ID refs.OwnerID var errInvalidIDString = errors.New("incorrect format of the string owner ID") // NewIDFromV2 wraps v2 OwnerID message to ID. +// +// Nil refs.OwnerID converts to nil. func NewIDFromV2(idV2 *refs.OwnerID) *ID { return (*ID)(idV2) } @@ -33,6 +35,8 @@ func (id *ID) SetNeo3Wallet(v *NEO3Wallet) { } // ToV2 returns the v2 owner ID message. +// +// Nil ID converts to nil. func (id *ID) ToV2() *refs.OwnerID { return (*refs.OwnerID)(id) } diff --git a/pkg/owner/id_test.go b/pkg/owner/id_test.go index 9ab2e30..d32b895 100644 --- a/pkg/owner/id_test.go +++ b/pkg/owner/id_test.go @@ -7,6 +7,7 @@ import ( "github.com/mr-tron/base58" . "github.com/nspcc-dev/neofs-api-go/pkg/owner" ownertest "github.com/nspcc-dev/neofs-api-go/pkg/owner/test" + "github.com/nspcc-dev/neofs-api-go/v2/refs" "github.com/nspcc-dev/neofs-crypto/test" "github.com/stretchr/testify/require" ) @@ -99,3 +100,19 @@ func TestID_Equal(t *testing.T) { ownertest.GenerateFromBytes(data3), )) } + +func TestNewIDFromV2(t *testing.T) { + t.Run("from nil", func(t *testing.T) { + var x *refs.OwnerID + + require.Nil(t, NewIDFromV2(x)) + }) +} + +func TestID_ToV2(t *testing.T) { + t.Run("nil", func(t *testing.T) { + var x *ID + + require.Nil(t, x.ToV2()) + }) +} From c00cdd407d7562d00a79feb8485ac7a19b5d3403 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Tue, 8 Jun 2021 19:51:34 +0300 Subject: [PATCH 0838/1196] [#302] pkg/owner: Document default values set in `NewID` Document field values of instance constructed via `NewID`. Assert the values in corresponding unit test. Signed-off-by: Pavel Karpy --- pkg/owner/id.go | 3 +++ pkg/owner/id_test.go | 19 +++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/pkg/owner/id.go b/pkg/owner/id.go index fadb818..3ba5300 100644 --- a/pkg/owner/id.go +++ b/pkg/owner/id.go @@ -25,6 +25,9 @@ func NewIDFromV2(idV2 *refs.OwnerID) *ID { // NewID creates and initializes blank ID. // // Works similar as NewIDFromV2(new(OwnerID)). +// +// Defaults: +// - value: nil. func NewID() *ID { return NewIDFromV2(new(refs.OwnerID)) } diff --git a/pkg/owner/id_test.go b/pkg/owner/id_test.go index d32b895..f5cff06 100644 --- a/pkg/owner/id_test.go +++ b/pkg/owner/id_test.go @@ -116,3 +116,22 @@ func TestID_ToV2(t *testing.T) { require.Nil(t, x.ToV2()) }) } + +func TestID_String(t *testing.T) { + t.Run("nil", func(t *testing.T) { + id := NewID() + + require.Empty(t, id.String()) + }) +} + +func TestNewID(t *testing.T) { + t.Run("default values", func(t *testing.T) { + id := NewID() + + // convert to v2 message + idV2 := id.ToV2() + + require.Nil(t, idV2.GetValue()) + }) +} From d4327ec018ef99e46d2874db03aeca5bd551a74c Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Tue, 8 Jun 2021 19:55:32 +0300 Subject: [PATCH 0839/1196] [#302] pkg/reputation: Convert nil `PeerID` to nil message Document that `PeerID.ToV2` method return `nil` when called on `nil`. Document that `PeerIDFromV2` function return `nil` when called on `nil`. Write corresponding unit tests. Signed-off-by: Pavel Karpy --- pkg/reputation/peer.go | 4 ++++ pkg/reputation/peer_test.go | 21 +++++++++++++++++++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/pkg/reputation/peer.go b/pkg/reputation/peer.go index f35b9ea..af7bec1 100644 --- a/pkg/reputation/peer.go +++ b/pkg/reputation/peer.go @@ -17,6 +17,8 @@ func NewPeerID() *PeerID { } // PeerIDFromV2 converts NeoFS API v2 reputation.PeerID message to PeerID. +// +// Nil reputation.PeerID converts to nil. func PeerIDFromV2(id *reputation.PeerID) *PeerID { return (*PeerID)(id) } @@ -28,6 +30,8 @@ func (x *PeerID) SetPublicKey(v [crypto.PublicKeyCompressedSize]byte) { } // ToV2 converts PeerID to NeoFS API v2 reputation.PeerID message. +// +// Nil PeerID converts to nil. func (x *PeerID) ToV2() *reputation.PeerID { return (*reputation.PeerID)(x) } diff --git a/pkg/reputation/peer_test.go b/pkg/reputation/peer_test.go index 4a63546..b226cf9 100644 --- a/pkg/reputation/peer_test.go +++ b/pkg/reputation/peer_test.go @@ -5,13 +5,22 @@ import ( "github.com/nspcc-dev/neofs-api-go/pkg/reputation" reputationtest "github.com/nspcc-dev/neofs-api-go/pkg/reputation/test" + reputationV2 "github.com/nspcc-dev/neofs-api-go/v2/reputation" "github.com/stretchr/testify/require" ) func TestPeerID_ToV2(t *testing.T) { - peerID := reputationtest.GeneratePeerID() + t.Run("nil", func(t *testing.T) { + var x *reputation.PeerID - require.Equal(t, peerID, reputation.PeerIDFromV2(peerID.ToV2())) + require.Nil(t, x.ToV2()) + }) + + t.Run("nil", func(t *testing.T) { + peerID := reputationtest.GeneratePeerID() + + require.Equal(t, peerID, reputation.PeerIDFromV2(peerID.ToV2())) + }) } func TestPeerID_String(t *testing.T) { @@ -50,3 +59,11 @@ func TestPeerIDEncoding(t *testing.T) { require.Equal(t, id, id2) }) } + +func TestPeerIDFromV2(t *testing.T) { + t.Run("from nil", func(t *testing.T) { + var x *reputationV2.PeerID + + require.Nil(t, reputation.PeerIDFromV2(x)) + }) +} From cce7ecbc00423e2c58c2e013b25a5e2592b5b8bc Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Tue, 8 Jun 2021 19:57:28 +0300 Subject: [PATCH 0840/1196] [#302] pkg/reputation: Document default values set in `NewPeerID` Document field values of instance constructed via `NewPeerID`. Assert the values in corresponding unit test. Signed-off-by: Pavel Karpy --- pkg/reputation/peer.go | 3 +++ pkg/reputation/peer_test.go | 31 +++++++++++++++++++++++++------ 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/pkg/reputation/peer.go b/pkg/reputation/peer.go index af7bec1..cdbfce1 100644 --- a/pkg/reputation/peer.go +++ b/pkg/reputation/peer.go @@ -12,6 +12,9 @@ import ( type PeerID reputation.PeerID // NewPeerID creates and returns blank PeerID. +// +// Defaults: +// - publicKey: nil. func NewPeerID() *PeerID { return PeerIDFromV2(new(reputation.PeerID)) } diff --git a/pkg/reputation/peer_test.go b/pkg/reputation/peer_test.go index b226cf9..d3463a5 100644 --- a/pkg/reputation/peer_test.go +++ b/pkg/reputation/peer_test.go @@ -24,16 +24,24 @@ func TestPeerID_ToV2(t *testing.T) { } func TestPeerID_String(t *testing.T) { - id := reputationtest.GeneratePeerID() + t.Run("Parse/String", func(t *testing.T) { + id := reputationtest.GeneratePeerID() - strID := id.String() + strID := id.String() - id2 := reputation.NewPeerID() + id2 := reputation.NewPeerID() - err := id2.Parse(strID) - require.NoError(t, err) + err := id2.Parse(strID) + require.NoError(t, err) - require.Equal(t, id, id2) + require.Equal(t, id, id2) + }) + + t.Run("nil", func(t *testing.T) { + id := reputation.NewPeerID() + + require.Empty(t, id.String()) + }) } func TestPeerIDEncoding(t *testing.T) { @@ -67,3 +75,14 @@ func TestPeerIDFromV2(t *testing.T) { require.Nil(t, reputation.PeerIDFromV2(x)) }) } + +func TestNewPeerID(t *testing.T) { + t.Run("default values", func(t *testing.T) { + id := reputation.NewPeerID() + + // convert to v2 message + idV2 := id.ToV2() + + require.Nil(t, idV2.GetPublicKey()) + }) +} From 8ab3abab4b4ae2825eb3aae14ff36e36e5afee0e Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Tue, 8 Jun 2021 20:07:09 +0300 Subject: [PATCH 0841/1196] [#302] pkg/reputation: Convert nil `Trust`, `PeerToPeerTrust` and `GlobalTrust` to nil message Document that `Trust.ToV2`, `PeerToPeerTrust.ToV2` and `GlobalTrust.ToV2` methods return `nil`when called on `nil`. Document that `TrustFromV2`, `PeerToPeerTrustFromV2`and `GlobalTrustFromV2` functions return `nil` when called on `nil`. Write corresponding unit tests. Signed-off-by: Pavel Karpy --- pkg/reputation/trust.go | 12 +++++++++ pkg/reputation/trust_test.go | 49 ++++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+) diff --git a/pkg/reputation/trust.go b/pkg/reputation/trust.go index 5a25b69..c584740 100644 --- a/pkg/reputation/trust.go +++ b/pkg/reputation/trust.go @@ -20,12 +20,16 @@ func NewTrust() *Trust { // TrustFromV2 converts NeoFS API v2 // reputation.Trust message structure to Trust. +// +// Nil reputation.Trust converts to nil. func TrustFromV2(t *reputation.Trust) *Trust { return (*Trust)(t) } // ToV2 converts Trust to NeoFS API v2 // reputation.Trust message structure. +// +// Nil Trust converts to nil. func (x *Trust) ToV2() *reputation.Trust { return (*reputation.Trust)(x) } @@ -111,12 +115,16 @@ func NewPeerToPeerTrust() *PeerToPeerTrust { // PeerToPeerTrustFromV2 converts NeoFS API v2 // reputation.PeerToPeerTrust message structure to PeerToPeerTrust. +// +// Nil reputation.PeerToPeerTrust converts to nil. func PeerToPeerTrustFromV2(t *reputation.PeerToPeerTrust) *PeerToPeerTrust { return (*PeerToPeerTrust)(t) } // ToV2 converts PeerToPeerTrust to NeoFS API v2 // reputation.PeerToPeerTrust message structure. +// +// Nil PeerToPeerTrust converts to nil. func (x *PeerToPeerTrust) ToV2() *reputation.PeerToPeerTrust { return (*reputation.PeerToPeerTrust)(x) } @@ -195,12 +203,16 @@ func NewGlobalTrust() *GlobalTrust { // GlobalTrustFromV2 converts NeoFS API v2 // reputation.GlobalTrust message structure to GlobalTrust. +// +// Nil reputation.GlobalTrust converts to nil. func GlobalTrustFromV2(t *reputation.GlobalTrust) *GlobalTrust { return (*GlobalTrust)(t) } // ToV2 converts GlobalTrust to NeoFS API v2 // reputation.GlobalTrust message structure. +// +// Nil GlobalTrust converts to nil. func (x *GlobalTrust) ToV2() *reputation.GlobalTrust { return (*reputation.GlobalTrust)(x) } diff --git a/pkg/reputation/trust_test.go b/pkg/reputation/trust_test.go index 0e908ec..844997b 100644 --- a/pkg/reputation/trust_test.go +++ b/pkg/reputation/trust_test.go @@ -6,6 +6,7 @@ import ( "github.com/nspcc-dev/neofs-api-go/pkg" "github.com/nspcc-dev/neofs-api-go/pkg/reputation" reputationtest "github.com/nspcc-dev/neofs-api-go/pkg/reputation/test" + reputationV2 "github.com/nspcc-dev/neofs-api-go/v2/reputation" reputationtestV2 "github.com/nspcc-dev/neofs-api-go/v2/reputation/test" "github.com/stretchr/testify/require" ) @@ -150,3 +151,51 @@ func TestGlobalTrust(t *testing.T) { }) }) } + +func TestTrustFromV2(t *testing.T) { + t.Run("from nil", func(t *testing.T) { + var x *reputationV2.Trust + + require.Nil(t, reputation.TrustFromV2(x)) + }) +} + +func TestPeerToPeerTrustFromV2(t *testing.T) { + t.Run("from nil", func(t *testing.T) { + var x *reputationV2.PeerToPeerTrust + + require.Nil(t, reputation.PeerToPeerTrustFromV2(x)) + }) +} + +func TestGlobalTrustFromV2(t *testing.T) { + t.Run("from nil", func(t *testing.T) { + var x *reputationV2.GlobalTrust + + require.Nil(t, reputation.GlobalTrustFromV2(x)) + }) +} + +func TestTrust_ToV2(t *testing.T) { + t.Run("nil", func(t *testing.T) { + var x *reputation.Trust + + require.Nil(t, x.ToV2()) + }) +} + +func TestPeerToPeerTrust_ToV2(t *testing.T) { + t.Run("nil", func(t *testing.T) { + var x *reputation.PeerToPeerTrust + + require.Nil(t, x.ToV2()) + }) +} + +func TestGlobalTrust_ToV2(t *testing.T) { + t.Run("nil", func(t *testing.T) { + var x *reputation.GlobalTrust + + require.Nil(t, x.ToV2()) + }) +} From 2d7a6580594813df9983e174196a342ee0fac2a3 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Tue, 8 Jun 2021 20:21:03 +0300 Subject: [PATCH 0842/1196] [#302] pkg/owner: Document default values set in `NewTrust`, `NewPeerToPeerTrust` and `NewGlobalTrust` Document field values of instance constructed via `NewTrust`, `NewPeerToPeerTrust` and `NewGlobalTrust`. Assert the values in corresponding unit test. Signed-off-by: Pavel Karpy --- pkg/reputation/trust.go | 13 +++++++++- pkg/reputation/trust_test.go | 49 ++++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+), 1 deletion(-) diff --git a/pkg/reputation/trust.go b/pkg/reputation/trust.go index c584740..e3dd5e5 100644 --- a/pkg/reputation/trust.go +++ b/pkg/reputation/trust.go @@ -14,6 +14,10 @@ import ( type Trust reputation.Trust // NewTrust creates and returns blank Trust. +// +// Defaults: +// - value: 0; +// - PeerID: nil. func NewTrust() *Trust { return TrustFromV2(new(reputation.Trust)) } @@ -109,6 +113,10 @@ func (x *Trust) UnmarshalJSON(data []byte) error { type PeerToPeerTrust reputation.PeerToPeerTrust // NewPeerToPeerTrust creates and returns blank PeerToPeerTrust. +// +// Defaults: +// - trusting: nil; +// - trust: nil. func NewPeerToPeerTrust() *PeerToPeerTrust { return PeerToPeerTrustFromV2(new(reputation.PeerToPeerTrust)) } @@ -193,7 +201,10 @@ type GlobalTrust reputation.GlobalTrust // NewGlobalTrust creates and returns blank GlobalTrust. // -// Version is initialized to current library version. +// Defaults: +// - version: pkg.SDKVersion(); +// - manager: nil; +// - trust: nil. func NewGlobalTrust() *GlobalTrust { gt := GlobalTrustFromV2(new(reputation.GlobalTrust)) gt.SetVersion(pkg.SDKVersion()) diff --git a/pkg/reputation/trust_test.go b/pkg/reputation/trust_test.go index 844997b..41072e9 100644 --- a/pkg/reputation/trust_test.go +++ b/pkg/reputation/trust_test.go @@ -199,3 +199,52 @@ func TestGlobalTrust_ToV2(t *testing.T) { require.Nil(t, x.ToV2()) }) } + +func TestNewTrust(t *testing.T) { + t.Run("default values", func(t *testing.T) { + trust := reputation.NewTrust() + + // check initial values + require.Zero(t, trust.Value()) + require.Nil(t, trust.Peer()) + + // convert to v2 message + trustV2 := trust.ToV2() + + require.Zero(t, trustV2.GetValue()) + require.Nil(t, trustV2.GetPeer()) + }) +} + +func TestNewPeerToPeerTrust(t *testing.T) { + t.Run("default values", func(t *testing.T) { + trust := reputation.NewPeerToPeerTrust() + + // check initial values + require.Nil(t, trust.Trust()) + require.Nil(t, trust.TrustingPeer()) + + // convert to v2 message + trustV2 := trust.ToV2() + + require.Nil(t, trustV2.GetTrust()) + require.Nil(t, trustV2.GetTrustingPeer()) + }) +} + +func TestNewGlobalTrust(t *testing.T) { + t.Run("default values", func(t *testing.T) { + trust := reputation.NewGlobalTrust() + + // check initial values + require.Nil(t, trust.Manager()) + require.Nil(t, trust.Trust()) + + require.Equal(t, pkg.SDKVersion().String(), trust.Version().String()) + + // convert to v2 message + trustV2 := trust.ToV2() + + require.Nil(t, trustV2.GetBody()) + }) +} From 707776976abd69c0bc0b0d5b113fd93477a33958 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Tue, 8 Jun 2021 20:27:05 +0300 Subject: [PATCH 0843/1196] [#302] pkg/session: Convert nil `Token` to nil message Document that `Token.ToV2` method return `nil` when called on `nil`. Document that `NewTokenFromV2` function return `nil` when called on `nil`. Write corresponding unit tests. Signed-off-by: Pavel Karpy --- pkg/session/session.go | 4 ++++ pkg/session/session_test.go | 17 +++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/pkg/session/session.go b/pkg/session/session.go index 99b71a1..3f58bff 100644 --- a/pkg/session/session.go +++ b/pkg/session/session.go @@ -17,6 +17,8 @@ type Token session.SessionToken // NewTokenFromV2 wraps session.SessionToken message structure // into Token. +// +// Nil session.SessionToken converts to nil. func NewTokenFromV2(tV2 *session.SessionToken) *Token { return (*Token)(tV2) } @@ -27,6 +29,8 @@ func NewToken() *Token { } // ToV2 converts Token to session.SessionToken message structure. +// +// Nil Token converts to nil. func (t *Token) ToV2() *session.SessionToken { return (*session.SessionToken)(t) } diff --git a/pkg/session/session_test.go b/pkg/session/session_test.go index 88ec809..1ce07b3 100644 --- a/pkg/session/session_test.go +++ b/pkg/session/session_test.go @@ -6,6 +6,7 @@ import ( ownertest "github.com/nspcc-dev/neofs-api-go/pkg/owner/test" "github.com/nspcc-dev/neofs-api-go/pkg/session" sessiontest "github.com/nspcc-dev/neofs-api-go/pkg/session/test" + sessionv2 "github.com/nspcc-dev/neofs-api-go/v2/session" "github.com/stretchr/testify/require" ) @@ -162,3 +163,19 @@ func TestToken_Iat(t *testing.T) { require.EqualValues(t, iat, tok.Iat()) } + +func TestNewTokenFromV2(t *testing.T) { + t.Run("from nil", func(t *testing.T) { + var x *sessionv2.SessionToken + + require.Nil(t, session.NewTokenFromV2(x)) + }) +} + +func TestToken_ToV2(t *testing.T) { + t.Run("nil", func(t *testing.T) { + var x *session.Token + + require.Nil(t, x.ToV2()) + }) +} From fb77bd3511fcab886340e850ef7db7d35f9790f3 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Tue, 8 Jun 2021 20:35:03 +0300 Subject: [PATCH 0844/1196] [#302] pkg/session: Document default values set in `NewToken` Document field values of instance constructed via `NewToken`. Assert the values in corresponding unit test. Signed-off-by: Pavel Karpy --- pkg/session/session.go | 9 +++++++++ pkg/session/session_test.go | 21 +++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/pkg/session/session.go b/pkg/session/session.go index 3f58bff..6235636 100644 --- a/pkg/session/session.go +++ b/pkg/session/session.go @@ -24,6 +24,15 @@ func NewTokenFromV2(tV2 *session.SessionToken) *Token { } // NewToken creates and returns blank Token. +// +// Defaults: +// - body: nil; +// - id: nil; +// - ownerId: nil; +// - sessionKey: nil; +// - exp: 0; +// - iat: 0; +// - nbf: 0; func NewToken() *Token { return NewTokenFromV2(new(session.SessionToken)) } diff --git a/pkg/session/session_test.go b/pkg/session/session_test.go index 1ce07b3..3835f38 100644 --- a/pkg/session/session_test.go +++ b/pkg/session/session_test.go @@ -179,3 +179,24 @@ func TestToken_ToV2(t *testing.T) { require.Nil(t, x.ToV2()) }) } + +func TestNewToken(t *testing.T) { + t.Run("default values", func(t *testing.T) { + token := session.NewToken() + + // check initial values + require.Nil(t, token.Signature()) + require.Nil(t, token.OwnerID()) + require.Nil(t, token.SessionKey()) + require.Nil(t, token.ID()) + require.Zero(t, token.Exp()) + require.Zero(t, token.Iat()) + require.Zero(t, token.Nbf()) + + // convert to v2 message + tokenV2 := token.ToV2() + + require.Nil(t, tokenV2.GetSignature()) + require.Nil(t, tokenV2.GetBody()) + }) +} From 934cf8ecc88ef3763bfead42d49243159f743ac1 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Tue, 8 Jun 2021 20:39:26 +0300 Subject: [PATCH 0845/1196] [#302] pkg/storagegroup: Convert nil `StorageGroup` to nil message Document that `StorageGroup.ToV2` method return `nil` when called on `nil`. Document that `NewFromV2` function return `nil` when called on `nil`. Write corresponding unit tests. Signed-off-by: Pavel Karpy --- pkg/storagegroup/storagegroup.go | 4 ++++ pkg/storagegroup/storagegroup_test.go | 17 +++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/pkg/storagegroup/storagegroup.go b/pkg/storagegroup/storagegroup.go index 0ae52ab..c1994c3 100644 --- a/pkg/storagegroup/storagegroup.go +++ b/pkg/storagegroup/storagegroup.go @@ -11,6 +11,8 @@ import ( type StorageGroup storagegroup.StorageGroup // NewFromV2 wraps v2 StorageGroup message to StorageGroup. +// +// Nil storagegroup.StorageGroup converts to nil. func NewFromV2(aV2 *storagegroup.StorageGroup) *StorageGroup { return (*StorageGroup)(aV2) } @@ -110,6 +112,8 @@ func (sg *StorageGroup) SetMembers(members []*object.ID) { } // ToV2 converts StorageGroup to v2 StorageGroup message. +// +// Nil StorageGroup converts to nil. func (sg *StorageGroup) ToV2() *storagegroup.StorageGroup { return (*storagegroup.StorageGroup)(sg) } diff --git a/pkg/storagegroup/storagegroup_test.go b/pkg/storagegroup/storagegroup_test.go index 5118431..b89f544 100644 --- a/pkg/storagegroup/storagegroup_test.go +++ b/pkg/storagegroup/storagegroup_test.go @@ -8,6 +8,7 @@ import ( "github.com/nspcc-dev/neofs-api-go/pkg/storagegroup" storagegrouptest "github.com/nspcc-dev/neofs-api-go/pkg/storagegroup/test" refstest "github.com/nspcc-dev/neofs-api-go/pkg/test" + storagegroupV2 "github.com/nspcc-dev/neofs-api-go/v2/storagegroup" "github.com/stretchr/testify/require" ) @@ -54,3 +55,19 @@ func TestStorageGroupEncoding(t *testing.T) { require.Equal(t, sg, sg2) }) } + +func TestNewFromV2(t *testing.T) { + t.Run("from nil", func(t *testing.T) { + var x *storagegroupV2.StorageGroup + + require.Nil(t, storagegroup.NewFromV2(x)) + }) +} + +func TestStorageGroup_ToV2(t *testing.T) { + t.Run("nil", func(t *testing.T) { + var x *storagegroup.StorageGroup + + require.Nil(t, x.ToV2()) + }) +} From 3bc25f54d8c15bcef36babccfbb4d9262b0870e8 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Tue, 8 Jun 2021 20:44:26 +0300 Subject: [PATCH 0846/1196] [#302] pkg/storagegroup: Document default values set in `New` Document field values of instance constructed via `New`. Assert the values in corresponding unit test. Signed-off-by: Pavel Karpy --- pkg/storagegroup/storagegroup.go | 6 ++++++ pkg/storagegroup/storagegroup_test.go | 20 ++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/pkg/storagegroup/storagegroup.go b/pkg/storagegroup/storagegroup.go index c1994c3..1a73a5a 100644 --- a/pkg/storagegroup/storagegroup.go +++ b/pkg/storagegroup/storagegroup.go @@ -18,6 +18,12 @@ func NewFromV2(aV2 *storagegroup.StorageGroup) *StorageGroup { } // New creates and initializes blank StorageGroup. +// +// Defaults: +// - size: 0; +// - exp: 0; +// - members: nil; +// - hash: nil. func New() *StorageGroup { return NewFromV2(new(storagegroup.StorageGroup)) } diff --git a/pkg/storagegroup/storagegroup_test.go b/pkg/storagegroup/storagegroup_test.go index b89f544..ee6c6a6 100644 --- a/pkg/storagegroup/storagegroup_test.go +++ b/pkg/storagegroup/storagegroup_test.go @@ -71,3 +71,23 @@ func TestStorageGroup_ToV2(t *testing.T) { require.Nil(t, x.ToV2()) }) } + +func TestNew(t *testing.T) { + t.Run("default values", func(t *testing.T) { + sg := storagegroup.New() + + // check initial values + require.Nil(t, sg.Members()) + require.Nil(t, sg.ValidationDataHash()) + require.Zero(t, sg.ExpirationEpoch()) + require.Zero(t, sg.ValidationDataSize()) + + // convert to v2 message + sgV2 := sg.ToV2() + + require.Nil(t, sgV2.GetMembers()) + require.Nil(t, sgV2.GetValidationHash()) + require.Zero(t, sgV2.GetExpirationEpoch()) + require.Zero(t, sgV2.GetValidationDataSize()) + }) +} From 00a0ea42a81fdf4ad5ff515f090d504b2cb97c8f Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Tue, 8 Jun 2021 20:52:46 +0300 Subject: [PATCH 0847/1196] [#302] pkg/token: Convert nil `BearerToken` to nil message Document that `BearerToken.ToV2` method return `nil` when called on `nil`. Write corresponding unit tests. Signed-off-by: Pavel Karpy --- pkg/token/bearer.go | 10 +++++++++- pkg/token/bearer_test.go | 8 ++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/pkg/token/bearer.go b/pkg/token/bearer.go index 812faf2..8ac333e 100644 --- a/pkg/token/bearer.go +++ b/pkg/token/bearer.go @@ -23,7 +23,14 @@ type BearerToken struct { token acl.BearerToken } -func (b BearerToken) ToV2() *acl.BearerToken { +// ToV2 converts BearerToken to v2 BearerToken message. +// +// Nil BearerToken converts to nil. +func (b *BearerToken) ToV2() *acl.BearerToken { + if b == nil { + return nil + } + return &b.token } @@ -100,6 +107,7 @@ func NewBearerToken() *BearerToken { return b } +// ToV2 converts BearerToken to v2 BearerToken message. func NewBearerTokenFromV2(v2 *acl.BearerToken) *BearerToken { if v2 == nil { v2 = new(acl.BearerToken) diff --git a/pkg/token/bearer_test.go b/pkg/token/bearer_test.go index 38bf47b..26dca9e 100644 --- a/pkg/token/bearer_test.go +++ b/pkg/token/bearer_test.go @@ -55,3 +55,11 @@ func TestFilterEncoding(t *testing.T) { require.Equal(t, f, d2) }) } + +func TestBearerToken_ToV2(t *testing.T) { + t.Run("nil", func(t *testing.T) { + var x *token.BearerToken + + require.Nil(t, x.ToV2()) + }) +} From 245271bb6572e423b935af6e4686ca11ead2fff3 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Tue, 8 Jun 2021 20:58:10 +0300 Subject: [PATCH 0848/1196] [#302] pkg/token: Document default values set in `NewBearerToken` Signed-off-by: Pavel Karpy --- pkg/token/bearer.go | 9 +++++++++ pkg/token/bearer_test.go | 17 +++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/pkg/token/bearer.go b/pkg/token/bearer.go index 8ac333e..621052c 100644 --- a/pkg/token/bearer.go +++ b/pkg/token/bearer.go @@ -99,6 +99,15 @@ func (b *BearerToken) Issuer() *owner.ID { return owner.NewIDFromNeo3Wallet(wallet) } +// NewBearerToken creates and initializes blank BearerToken. +// +// Defaults: +// - signature: nil; +// - eacl: nil; +// - ownerID: nil; +// - exp: 0; +// - nbf: 0; +// - iat: 0. func NewBearerToken() *BearerToken { b := new(BearerToken) b.token = acl.BearerToken{} diff --git a/pkg/token/bearer_test.go b/pkg/token/bearer_test.go index 26dca9e..191398b 100644 --- a/pkg/token/bearer_test.go +++ b/pkg/token/bearer_test.go @@ -63,3 +63,20 @@ func TestBearerToken_ToV2(t *testing.T) { require.Nil(t, x.ToV2()) }) } + +func TestNewBearerToken(t *testing.T) { + t.Run("default values", func(t *testing.T) { + tkn := token.NewBearerToken() + + // convert to v2 message + tknV2 := tkn.ToV2() + + require.NotNil(t, tknV2.GetBody()) + require.Zero(t, tknV2.GetBody().GetLifetime().GetExp()) + require.Zero(t, tknV2.GetBody().GetLifetime().GetNbf()) + require.Zero(t, tknV2.GetBody().GetLifetime().GetIat()) + require.Nil(t, tknV2.GetBody().GetEACL()) + require.Nil(t, tknV2.GetBody().GetOwnerID()) + require.Nil(t, tknV2.GetSignature()) + }) +} From 35b6629e1c0aaeb1e683668044015c7790f39efb Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Tue, 8 Jun 2021 21:02:30 +0300 Subject: [PATCH 0849/1196] [#302] pkg/checksum: Convert nil `Checksum` to nil message Document that `Checksum.ToV2` method return `nil` when called on `nil`. Document that `NewChecksumFromV2` function return `nil` when called on `nil`. Write corresponding unit tests. Signed-off-by: Pavel Karpy --- pkg/checksum.go | 5 +++++ pkg/checksum_test.go | 16 ++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/pkg/checksum.go b/pkg/checksum.go index 59ece9d..d8a91b7 100644 --- a/pkg/checksum.go +++ b/pkg/checksum.go @@ -28,6 +28,8 @@ const ( ) // NewChecksumFromV2 wraps v2 Checksum message to Checksum. +// +// Nil refs.Checksum converts to nil. func NewChecksumFromV2(cV2 *refs.Checksum) *Checksum { return (*Checksum)(cV2) } @@ -72,6 +74,9 @@ func (c *Checksum) SetTillichZemor(v [64]byte) { checksum.SetSum(v[:]) } +// ToV2 converts Checksum to v2 Checksum message. +// +// Nil Checksum converts to nil. func (c *Checksum) ToV2() *refs.Checksum { return (*refs.Checksum)(c) } diff --git a/pkg/checksum_test.go b/pkg/checksum_test.go index e636f40..04343a9 100644 --- a/pkg/checksum_test.go +++ b/pkg/checksum_test.go @@ -99,3 +99,19 @@ func TestChecksumEncoding(t *testing.T) { require.Equal(t, cs, cs2) }) } + +func TestNewChecksumFromV2(t *testing.T) { + t.Run("from nil", func(t *testing.T) { + var x *refs.Checksum + + require.Nil(t, NewChecksumFromV2(x)) + }) +} + +func TestChecksum_ToV2(t *testing.T) { + t.Run("nil", func(t *testing.T) { + var x *Checksum + + require.Nil(t, x.ToV2()) + }) +} From bf0d106e546ef085aaf0d840f3f5d7eb674d8c5a Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Tue, 8 Jun 2021 21:09:06 +0300 Subject: [PATCH 0850/1196] [#302] pkg/checksum: Document default values set in `NewChecksum` Document field values of instance constructed via `NewChecksum`. Assert the values in corresponding unit test. Signed-off-by: Pavel Karpy --- pkg/checksum.go | 8 ++++++-- pkg/checksum_test.go | 16 ++++++++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/pkg/checksum.go b/pkg/checksum.go index d8a91b7..5d244b9 100644 --- a/pkg/checksum.go +++ b/pkg/checksum.go @@ -34,9 +34,13 @@ func NewChecksumFromV2(cV2 *refs.Checksum) *Checksum { return (*Checksum)(cV2) } -// NewVersion creates and initializes blank Version. +// NewChecksum creates and initializes blank Checksum. // -// Works similar as NewVersionFromV2(new(Version)). +// Works similar as NewChecksumFromV2(new(Checksum)). +// +// Defaults: +// - sum: nil; +// - type: ChecksumUnknown. func NewChecksum() *Checksum { return NewChecksumFromV2(new(refs.Checksum)) } diff --git a/pkg/checksum_test.go b/pkg/checksum_test.go index 04343a9..e0508b8 100644 --- a/pkg/checksum_test.go +++ b/pkg/checksum_test.go @@ -115,3 +115,19 @@ func TestChecksum_ToV2(t *testing.T) { require.Nil(t, x.ToV2()) }) } + +func TestNewChecksum(t *testing.T) { + t.Run("default values", func(t *testing.T) { + chs := NewChecksum() + + // check initial values + require.Equal(t, ChecksumUnknown, chs.Type()) + require.Nil(t, chs.Sum()) + + // convert to v2 message + chsV2 := chs.ToV2() + + require.Equal(t, refs.UnknownChecksum, chsV2.GetType()) + require.Nil(t, chsV2.GetSum()) + }) +} From b50697063693708f9ff37232d73cf42b39a35c5d Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Tue, 8 Jun 2021 21:12:17 +0300 Subject: [PATCH 0851/1196] [#302] pkg/signature: Convert nil `Signature` to nil message Document that `Signature.ToV2` method return `nil` when called on `nil`. Document that `NewSignatureFromV2` function return `nil` when called on `nil`. Write corresponding unit tests. Signed-off-by: Pavel Karpy --- pkg/signature.go | 5 +++++ pkg/signature_test.go | 17 +++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/pkg/signature.go b/pkg/signature.go index 7cf318d..1847dcd 100644 --- a/pkg/signature.go +++ b/pkg/signature.go @@ -8,6 +8,8 @@ import ( type Signature refs.Signature // NewSignatureFromV2 wraps v2 Signature message to Signature. +// +// Nil refs.Signature converts to nil. func NewSignatureFromV2(sV2 *refs.Signature) *Signature { return (*Signature)(sV2) } @@ -39,6 +41,9 @@ func (s *Signature) SetSign(v []byte) { (*refs.Signature)(s).SetSign(v) } +// ToV2 converts Signature to v2 Signature message. +// +// Nil Signature converts to nil. func (s *Signature) ToV2() *refs.Signature { return (*refs.Signature)(s) } diff --git a/pkg/signature_test.go b/pkg/signature_test.go index 72196c8..5b8c32f 100644 --- a/pkg/signature_test.go +++ b/pkg/signature_test.go @@ -1,6 +1,7 @@ package pkg import ( + "github.com/nspcc-dev/neofs-api-go/v2/refs" "testing" "github.com/stretchr/testify/require" @@ -31,3 +32,19 @@ func TestSignatureEncoding(t *testing.T) { require.Equal(t, s, s2) }) } + +func TestNewSignatureFromV2(t *testing.T) { + t.Run("from nil", func(t *testing.T) { + var x *refs.Signature + + require.Nil(t, NewSignatureFromV2(x)) + }) +} + +func TestSignature_ToV2(t *testing.T) { + t.Run("nil", func(t *testing.T) { + var x *Signature + + require.Nil(t, x.ToV2()) + }) +} From bb0cd8e4c05181816d08749b9a19137102e3e207 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Tue, 8 Jun 2021 21:16:46 +0300 Subject: [PATCH 0852/1196] [#302] pkg/signature: Document default values set in `NewSignature` Document field values of instance constructed via `NewSignature`. Assert the values in corresponding unit test. Signed-off-by: Pavel Karpy --- pkg/signature.go | 4 ++++ pkg/signature_test.go | 18 +++++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/pkg/signature.go b/pkg/signature.go index 1847dcd..0976946 100644 --- a/pkg/signature.go +++ b/pkg/signature.go @@ -17,6 +17,10 @@ func NewSignatureFromV2(sV2 *refs.Signature) *Signature { // NewSignature creates and initializes blank Signature. // // Works similar as NewSignatureFromV2(new(Signature)). +// +// Defaults: +// - key: nil; +// - signature: nil. func NewSignature() *Signature { return NewSignatureFromV2(new(refs.Signature)) } diff --git a/pkg/signature_test.go b/pkg/signature_test.go index 5b8c32f..45a5f14 100644 --- a/pkg/signature_test.go +++ b/pkg/signature_test.go @@ -1,9 +1,9 @@ package pkg import ( - "github.com/nspcc-dev/neofs-api-go/v2/refs" "testing" + "github.com/nspcc-dev/neofs-api-go/v2/refs" "github.com/stretchr/testify/require" ) @@ -48,3 +48,19 @@ func TestSignature_ToV2(t *testing.T) { require.Nil(t, x.ToV2()) }) } + +func TestNewSignature(t *testing.T) { + t.Run("default values", func(t *testing.T) { + sg := NewSignature() + + // check initial values + require.Nil(t, sg.Key()) + require.Nil(t, sg.Sign()) + + // convert to v2 message + sgV2 := sg.ToV2() + + require.Nil(t, sgV2.GetKey()) + require.Nil(t, sgV2.GetSign()) + }) +} From 768adfdd1592392143df59d80e1e4ce9a18d0a6d Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Tue, 8 Jun 2021 21:22:33 +0300 Subject: [PATCH 0853/1196] [#302] pkg/version: Convert nil `Version` to nil message Document that `Version.ToV2` method return `nil` when called on `nil`. Document that `NewVersionFromV2` function return `nil` when called on `nil`. Write corresponding unit tests. Signed-off-by: Pavel Karpy --- pkg/version.go | 4 ++++ pkg/version_test.go | 19 ++++++++++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/pkg/version.go b/pkg/version.go index 7e2e645..68fd8e7 100644 --- a/pkg/version.go +++ b/pkg/version.go @@ -12,6 +12,8 @@ type Version refs.Version const sdkMjr, sdkMnr = 2, 6 // NewVersionFromV2 wraps v2 Version message to Version. +// +// Nil refs.Version converts to nil. func NewVersionFromV2(v *refs.Version) *Version { return (*Version)(v) } @@ -58,6 +60,8 @@ func (v *Version) SetMinor(val uint32) { } // ToV2 converts Version to v2 Version message. +// +// Nil Version converts to nil. func (v *Version) ToV2() *refs.Version { return (*refs.Version)(v) } diff --git a/pkg/version_test.go b/pkg/version_test.go index 2f5ee28..fa75655 100644 --- a/pkg/version_test.go +++ b/pkg/version_test.go @@ -3,10 +3,11 @@ package pkg import ( "testing" + "github.com/nspcc-dev/neofs-api-go/v2/refs" "github.com/stretchr/testify/require" ) -func TestNewVersionFromV2(t *testing.T) { +func TestNewVersion(t *testing.T) { v := NewVersion() var mjr, mnr uint32 = 1, 2 @@ -88,3 +89,19 @@ func TestVersionEncoding(t *testing.T) { require.Equal(t, v, v2) }) } + +func TestNewVersionFromV2(t *testing.T) { + t.Run("from nil", func(t *testing.T) { + var x *refs.Version + + require.Nil(t, NewVersionFromV2(x)) + }) +} + +func TestVersion_ToV2(t *testing.T) { + t.Run("nil", func(t *testing.T) { + var x *Version + + require.Nil(t, x.ToV2()) + }) +} From dc99d4edce6d4b69b6b14e4cdadb3ebd5f75e1c6 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Tue, 8 Jun 2021 21:25:35 +0300 Subject: [PATCH 0854/1196] [#302] pkg/version: Document default values set in `NewVersion` Document field values of instance constructed via `NewVersion`. Assert the values in corresponding unit test. Signed-off-by: Pavel Karpy --- pkg/version.go | 4 ++++ pkg/version_test.go | 34 +++++++++++++++++++++++++--------- 2 files changed, 29 insertions(+), 9 deletions(-) diff --git a/pkg/version.go b/pkg/version.go index 68fd8e7..c38337d 100644 --- a/pkg/version.go +++ b/pkg/version.go @@ -21,6 +21,10 @@ func NewVersionFromV2(v *refs.Version) *Version { // NewVersion creates and initializes blank Version. // // Works similar as NewVersionFromV2(new(Version)). +// +// Defaults: +// - major: 0; +// - minor: 0. func NewVersion() *Version { return NewVersionFromV2(new(refs.Version)) } diff --git a/pkg/version_test.go b/pkg/version_test.go index fa75655..4586492 100644 --- a/pkg/version_test.go +++ b/pkg/version_test.go @@ -8,20 +8,36 @@ import ( ) func TestNewVersion(t *testing.T) { - v := NewVersion() + t.Run("default values", func(t *testing.T) { + v := NewVersion() - var mjr, mnr uint32 = 1, 2 + // check initial values + require.Zero(t, v.Major()) + require.Zero(t, v.Minor()) - v.SetMajor(mjr) - v.SetMinor(mnr) + // convert to v2 message + vV2 := v.ToV2() - require.Equal(t, mjr, v.Major()) - require.Equal(t, mnr, v.Minor()) + require.Empty(t, vV2.GetMajor()) + require.Empty(t, vV2.GetMinor()) + }) - ver := v.ToV2() + t.Run("setting values", func(t *testing.T) { + v := NewVersion() - require.Equal(t, mjr, ver.GetMajor()) - require.Equal(t, mnr, ver.GetMinor()) + var mjr, mnr uint32 = 1, 2 + + v.SetMajor(mjr) + v.SetMinor(mnr) + + require.Equal(t, mjr, v.Major()) + require.Equal(t, mnr, v.Minor()) + + ver := v.ToV2() + + require.Equal(t, mjr, ver.GetMajor()) + require.Equal(t, mnr, ver.GetMinor()) + }) } func TestSDKVersion(t *testing.T) { From 41307a5e00d7fc7a71240e8efce9aff299b2b494 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Tue, 8 Jun 2021 21:28:36 +0300 Subject: [PATCH 0855/1196] [#302] pkg/xheader: Convert nil `XHeader` to nil message Document that `XHeader.ToV2` method return `nil` when called on `nil`. Document that `NewXHeaderFromV2` function return `nil` when called on `nil`. Write corresponding unit tests. Signed-off-by: Pavel Karpy --- pkg/xheader.go | 4 ++++ pkg/xheader_test.go | 17 +++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/pkg/xheader.go b/pkg/xheader.go index 84d645c..7878677 100644 --- a/pkg/xheader.go +++ b/pkg/xheader.go @@ -8,6 +8,8 @@ import ( type XHeader session.XHeader // NewXHeaderFromV2 wraps v2 XHeader message to XHeader. +// +// Nil session.XHeader converts to nil. func NewXHeaderFromV2(v *session.XHeader) *XHeader { return (*XHeader)(v) } @@ -18,6 +20,8 @@ func NewXHeader() *XHeader { } // ToV2 converts XHeader to v2 XHeader message. +// +// Nil XHeader converts to nil. func (x *XHeader) ToV2() *session.XHeader { return (*session.XHeader)(x) } diff --git a/pkg/xheader_test.go b/pkg/xheader_test.go index 8f65227..66535be 100644 --- a/pkg/xheader_test.go +++ b/pkg/xheader_test.go @@ -3,6 +3,7 @@ package pkg import ( "testing" + "github.com/nspcc-dev/neofs-api-go/v2/session" "github.com/stretchr/testify/require" ) @@ -23,3 +24,19 @@ func TestXHeader(t *testing.T) { require.Equal(t, key, xV2.GetKey()) require.Equal(t, val, xV2.GetValue()) } + +func TestNewXHeaderFromV2(t *testing.T) { + t.Run("from nil", func(t *testing.T) { + var x *session.XHeader + + require.Nil(t, NewXHeaderFromV2(x)) + }) +} + +func TestXHeader_ToV2(t *testing.T) { + t.Run("nil", func(t *testing.T) { + var x *XHeader + + require.Nil(t, x.ToV2()) + }) +} From 1542162657ae1a6222d738c9044b5b7dc73f685d Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Tue, 8 Jun 2021 21:31:15 +0300 Subject: [PATCH 0856/1196] [#302] pkg/xheader: Document default values set in `NewXHeader` Document field values of instance constructed via `NewXHeader`. Assert the values in corresponding unit test. Signed-off-by: Pavel Karpy --- pkg/xheader.go | 4 ++++ pkg/xheader_test.go | 16 ++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/pkg/xheader.go b/pkg/xheader.go index 7878677..b36f1f0 100644 --- a/pkg/xheader.go +++ b/pkg/xheader.go @@ -15,6 +15,10 @@ func NewXHeaderFromV2(v *session.XHeader) *XHeader { } // NewXHeader creates, initializes and returns blank XHeader instance. +// +// Defaults: +// - key: ""; +// - value: "". func NewXHeader() *XHeader { return NewXHeaderFromV2(new(session.XHeader)) } diff --git a/pkg/xheader_test.go b/pkg/xheader_test.go index 66535be..22cbe87 100644 --- a/pkg/xheader_test.go +++ b/pkg/xheader_test.go @@ -40,3 +40,19 @@ func TestXHeader_ToV2(t *testing.T) { require.Nil(t, x.ToV2()) }) } + +func TestNewXHeader(t *testing.T) { + t.Run("default values", func(t *testing.T) { + xh := NewXHeader() + + // check initial values + require.Empty(t, xh.Value()) + require.Empty(t, xh.Key()) + + // convert to v2 message + xhV2 := xh.ToV2() + + require.Empty(t, xhV2.GetValue()) + require.Empty(t, xhV2.GetKey()) + }) +} From 5f50484cd52dcd3481f6cb8987b51c47ea13ad5e Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Tue, 8 Jun 2021 21:37:20 +0300 Subject: [PATCH 0857/1196] Bump SDK version in `pkg` Signed-off-by: Pavel Karpy --- pkg/version.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/version.go b/pkg/version.go index c38337d..12c5e33 100644 --- a/pkg/version.go +++ b/pkg/version.go @@ -9,7 +9,7 @@ import ( // Version represents v2-compatible version. type Version refs.Version -const sdkMjr, sdkMnr = 2, 6 +const sdkMjr, sdkMnr = 2, 7 // NewVersionFromV2 wraps v2 Version message to Version. // From 59179bed92020b59bb022664146ead87931de2b7 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Wed, 9 Jun 2021 21:59:52 +0300 Subject: [PATCH 0858/1196] Release v1.27.1 Signed-off-by: Pavel Karpy --- CHANGELOG.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7b729f7..0a61003 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,24 @@ # Changelog +## [1.27.1] - 2021-06-10 + +### Fixed + +- SDK version was updated (actualized) to `2.7`. + +### Changed + +- `pkg` wrappers' `ToV2` methods return `nil` if called on `nil`. +- `pkg` wrappers' `NewFromV2` functions constructs `nil` if called with `nil` argument. + +### Added + +- Getters and setters for lifetime fields of `pkg/session.Token`. +- `MarshalHeaderJSON` method to `pkg/object.Object`. +- Generators for types from `pkg` (for testing). +- Descriptions of default fields for `pkg` wrappers and unit tests for its constructors. +- Unit tests for `ToV2` methods and `NewFromV2` functions. + ## [1.27.0] - 2021-06-03 - Seongmodo (석모도, 席毛島) ### Added @@ -626,3 +645,4 @@ Initial public release [1.26.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.25.0...v1.26.0 [1.26.1]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.26.0...v1.26.1 [1.27.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.26.1...v1.27.0 +[1.27.1]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.27.0...v1.27.1 From 0e53766f2db042ae372e5fe148f69a4976321fe4 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Wed, 9 Jun 2021 22:26:09 +0300 Subject: [PATCH 0859/1196] [#305] docs: Add release instructions Signed-off-by: Pavel Karpy --- docs/release-instruction.md | 41 +++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 docs/release-instruction.md diff --git a/docs/release-instruction.md b/docs/release-instruction.md new file mode 100644 index 0000000..d6d13e5 --- /dev/null +++ b/docs/release-instruction.md @@ -0,0 +1,41 @@ +# Release instructions + +## Pre-release checks + +These should run successfully: +* `go test ./...`; +* `golangci-lint run ./...`; +* `go fmt ./...` (should not change any files); +* `go mog tidy` (should not change any files); +* `./prepare.sh /path/to/neofs-api/on/your/machine` (should not change any files). + +## Writing changelog + +Add an entry to the `CHANGELOG.md` following the style established there. Add an +optional codename(for not patch releases), version and release date in the heading. +Write a paragraph describing the most significant changes done in this release. Add +`Fixed`, `Added`, `Removed` and `Updated` sections with fixed bug, new features and +other changes. + +Open Pull Request (must receive at least one approval) and merge this changes. + +## Tag a release + +Use `vX.Y.Z` tag for releases and `vX.Y.Z-rc.N` for release candidates +following the [semantic versioning](https://semver.org/) standard. + +Update your local `master` branch after approved and merged `CHANGELOG.md` changes. +Tag a release (must be signed) and push it: + +``` +$ git tag -s vX.Y.Z[-rc.N] && git push origin vX.Y.Z[-rc.N] +``` + +## Make a Github release + +Using Github's web interface create a new release based on just created tag +with the same changes from changelog and publish it. + +## Close github milestone + +Close corresponding vX.Y.Z github milestone. From e459378b16ecc7f8c7f2e42b5a77b67e68e91cb8 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 15 Jun 2021 10:08:31 +0300 Subject: [PATCH 0860/1196] [#306] grpc: Fix the format of full method names All calling RPC's should have a leading slash according to docs of using gRPC library. Signed-off-by: Leonard Lyubich --- rpc/grpc/util.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rpc/grpc/util.go b/rpc/grpc/util.go index 61d9abb..150d57d 100644 --- a/rpc/grpc/util.go +++ b/rpc/grpc/util.go @@ -6,7 +6,7 @@ import ( "github.com/nspcc-dev/neofs-api-go/rpc/common" ) -const methodNameFmt = "%s/%s" +const methodNameFmt = "/%s/%s" func toMethodName(p common.CallMethodInfo) string { return fmt.Sprintf(methodNameFmt, p.Service, p.Name) From 176be8ead1ff05a190e07c95df53231cc9701deb Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Fri, 11 Jun 2021 14:49:52 +0300 Subject: [PATCH 0861/1196] [#307] v2/reputation/test: Do not allocate memory if `!empty` Move all memory allocation and field settings in `Generate...(empty bool)` functions behind `if !empty` check. Signed-off-by: Pavel Karpy --- v2/reputation/test/generate.go | 60 +++++++++++++++++++++------------- 1 file changed, 38 insertions(+), 22 deletions(-) diff --git a/v2/reputation/test/generate.go b/v2/reputation/test/generate.go index cd6bd0c..fb1239a 100644 --- a/v2/reputation/test/generate.go +++ b/v2/reputation/test/generate.go @@ -21,18 +21,19 @@ func GenerateTrust(empty bool) *reputation.Trust { if !empty { m.SetValue(1) + m.SetPeer(GeneratePeerID(false)) } - m.SetPeer(GeneratePeerID(empty)) - return m } func GeneratePeerToPeerTrust(empty bool) *reputation.PeerToPeerTrust { m := new(reputation.PeerToPeerTrust) - m.SetTrustingPeer(GeneratePeerID(empty)) - m.SetTrust(GenerateTrust(empty)) + if !empty { + m.SetTrustingPeer(GeneratePeerID(false)) + m.SetTrust(GenerateTrust(false)) + } return m } @@ -40,8 +41,10 @@ func GeneratePeerToPeerTrust(empty bool) *reputation.PeerToPeerTrust { func GenerateGlobalTrustBody(empty bool) *reputation.GlobalTrustBody { m := new(reputation.GlobalTrustBody) - m.SetManager(GeneratePeerID(empty)) - m.SetTrust(GenerateTrust(empty)) + if !empty { + m.SetManager(GeneratePeerID(false)) + m.SetTrust(GenerateTrust(false)) + } return m } @@ -49,14 +52,18 @@ func GenerateGlobalTrustBody(empty bool) *reputation.GlobalTrustBody { func GenerateGlobalTrust(empty bool) *reputation.GlobalTrust { m := new(reputation.GlobalTrust) - m.SetVersion(refstest.GenerateVersion(empty)) - m.SetBody(GenerateGlobalTrustBody(empty)) - m.SetSignature(refstest.GenerateSignature(empty)) + if !empty { + m.SetVersion(refstest.GenerateVersion(false)) + m.SetBody(GenerateGlobalTrustBody(false)) + m.SetSignature(refstest.GenerateSignature(empty)) + } return m } -func GenerateTrusts(empty bool) (res []*reputation.Trust) { +func GenerateTrusts(empty bool) []*reputation.Trust { + var res []*reputation.Trust + if !empty { res = append(res, GenerateTrust(false), @@ -64,7 +71,7 @@ func GenerateTrusts(empty bool) (res []*reputation.Trust) { ) } - return + return res } func GenerateAnnounceLocalTrustRequestBody(empty bool) *reputation.AnnounceLocalTrustRequestBody { @@ -72,19 +79,20 @@ func GenerateAnnounceLocalTrustRequestBody(empty bool) *reputation.AnnounceLocal if !empty { m.SetEpoch(13) + m.SetTrusts(GenerateTrusts(false)) } - m.SetTrusts(GenerateTrusts(empty)) - return m } func GenerateAnnounceLocalTrustRequest(empty bool) *reputation.AnnounceLocalTrustRequest { m := new(reputation.AnnounceLocalTrustRequest) - m.SetBody(GenerateAnnounceLocalTrustRequestBody(empty)) - m.SetMetaHeader(sessiontest.GenerateRequestMetaHeader(empty)) - m.SetVerificationHeader(sessiontest.GenerateRequestVerificationHeader(empty)) + if !empty { + m.SetBody(GenerateAnnounceLocalTrustRequestBody(false)) + m.SetMetaHeader(sessiontest.GenerateRequestMetaHeader(empty)) + m.SetVerificationHeader(sessiontest.GenerateRequestVerificationHeader(empty)) + } return m } @@ -98,9 +106,11 @@ func GenerateAnnounceLocalTrustResponseBody(empty bool) *reputation.AnnounceLoca func GenerateAnnounceLocalTrustResponse(empty bool) *reputation.AnnounceLocalTrustResponse { m := new(reputation.AnnounceLocalTrustResponse) - m.SetBody(GenerateAnnounceLocalTrustResponseBody(empty)) - m.SetMetaHeader(sessiontest.GenerateResponseMetaHeader(empty)) - m.SetVerificationHeader(sessiontest.GenerateResponseVerificationHeader(empty)) + if !empty { + m.SetBody(GenerateAnnounceLocalTrustResponseBody(false)) + m.SetMetaHeader(sessiontest.GenerateResponseMetaHeader(empty)) + m.SetVerificationHeader(sessiontest.GenerateResponseVerificationHeader(empty)) + } return m } @@ -111,7 +121,7 @@ func GenerateAnnounceIntermediateResultRequestBody(empty bool) *reputation.Annou if !empty { m.SetEpoch(123) m.SetIteration(564) - m.SetTrust(GeneratePeerToPeerTrust(empty)) + m.SetTrust(GeneratePeerToPeerTrust(false)) } return m @@ -120,7 +130,10 @@ func GenerateAnnounceIntermediateResultRequestBody(empty bool) *reputation.Annou func GenerateAnnounceIntermediateResultRequest(empty bool) *reputation.AnnounceIntermediateResultRequest { m := new(reputation.AnnounceIntermediateResultRequest) - m.SetBody(GenerateAnnounceIntermediateResultRequestBody(empty)) + if !empty { + m.SetBody(GenerateAnnounceIntermediateResultRequestBody(false)) + } + m.SetMetaHeader(sessiontest.GenerateRequestMetaHeader(empty)) m.SetVerificationHeader(sessiontest.GenerateRequestVerificationHeader(empty)) @@ -136,7 +149,10 @@ func GenerateAnnounceIntermediateResultResponseBody(empty bool) *reputation.Anno func GenerateAnnounceIntermediateResultResponse(empty bool) *reputation.AnnounceIntermediateResultResponse { m := new(reputation.AnnounceIntermediateResultResponse) - m.SetBody(GenerateAnnounceIntermediateResultResponseBody(empty)) + if !empty { + m.SetBody(GenerateAnnounceIntermediateResultResponseBody(false)) + } + m.SetMetaHeader(sessiontest.GenerateResponseMetaHeader(empty)) m.SetVerificationHeader(sessiontest.GenerateResponseVerificationHeader(empty)) From 51f20a76c509e690aea81350b1b67517ed3e2d18 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Fri, 11 Jun 2021 14:53:07 +0300 Subject: [PATCH 0862/1196] [#307] v2/accounting/test: Do not allocate memory if `!empty` Move all memory allocation and field settings in `Generate...(empty bool)` functions behind `if !empty` check. Signed-off-by: Pavel Karpy --- v2/accounting/test/generate.go | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/v2/accounting/test/generate.go b/v2/accounting/test/generate.go index b2c0d95..abd9fb8 100644 --- a/v2/accounting/test/generate.go +++ b/v2/accounting/test/generate.go @@ -9,7 +9,10 @@ import ( func GenerateBalanceRequest(empty bool) *accounting.BalanceRequest { m := new(accounting.BalanceRequest) - m.SetBody(GenerateBalanceRequestBody(empty)) + if !empty { + m.SetBody(GenerateBalanceRequestBody(false)) + } + m.SetMetaHeader(sessiontest.GenerateRequestMetaHeader(empty)) m.SetVerificationHeader(sessiontest.GenerateRequestVerificationHeader(empty)) @@ -19,7 +22,9 @@ func GenerateBalanceRequest(empty bool) *accounting.BalanceRequest { func GenerateBalanceRequestBody(empty bool) *accounting.BalanceRequestBody { m := new(accounting.BalanceRequestBody) - m.SetOwnerID(accountingtest.GenerateOwnerID(empty)) + if !empty { + m.SetOwnerID(accountingtest.GenerateOwnerID(false)) + } return m } @@ -27,7 +32,10 @@ func GenerateBalanceRequestBody(empty bool) *accounting.BalanceRequestBody { func GenerateBalanceResponse(empty bool) *accounting.BalanceResponse { m := new(accounting.BalanceResponse) - m.SetBody(GenerateBalanceResponseBody(empty)) + if !empty { + m.SetBody(GenerateBalanceResponseBody(false)) + } + m.SetMetaHeader(sessiontest.GenerateResponseMetaHeader(empty)) m.SetVerificationHeader(sessiontest.GenerateResponseVerificationHeader(empty)) @@ -37,7 +45,9 @@ func GenerateBalanceResponse(empty bool) *accounting.BalanceResponse { func GenerateBalanceResponseBody(empty bool) *accounting.BalanceResponseBody { m := new(accounting.BalanceResponseBody) - m.SetBalance(GenerateDecimal(empty)) + if !empty { + m.SetBalance(GenerateDecimal(false)) + } return m } From e15dd105fed135b8ab293cf6c65d34c3d854747f Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Fri, 11 Jun 2021 14:57:21 +0300 Subject: [PATCH 0863/1196] [#307] v2/acl/test: Do not allocate memory if `!empty` Move all memory allocation and field settings in `Generate...(empty bool)` functions behind `if !empty` check. Do not create empty slices if `empty == true`. Signed-off-by: Pavel Karpy --- v2/acl/test/generate.go | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/v2/acl/test/generate.go b/v2/acl/test/generate.go index 3b1e1a7..0f72119 100644 --- a/v2/acl/test/generate.go +++ b/v2/acl/test/generate.go @@ -8,7 +8,10 @@ import ( func GenerateBearerToken(empty bool) *acl.BearerToken { m := new(acl.BearerToken) - m.SetBody(GenerateBearerTokenBody(empty)) + if !empty { + m.SetBody(GenerateBearerTokenBody(false)) + } + m.SetSignature(accountingtest.GenerateSignature(empty)) return m @@ -17,9 +20,11 @@ func GenerateBearerToken(empty bool) *acl.BearerToken { func GenerateBearerTokenBody(empty bool) *acl.BearerTokenBody { m := new(acl.BearerTokenBody) - m.SetOwnerID(accountingtest.GenerateOwnerID(empty)) - m.SetEACL(GenerateTable(empty)) - m.SetLifetime(GenerateTokenLifetime(empty)) + if !empty { + m.SetOwnerID(accountingtest.GenerateOwnerID(false)) + m.SetEACL(GenerateTable(false)) + m.SetLifetime(GenerateTokenLifetime(false)) + } return m } @@ -27,15 +32,18 @@ func GenerateBearerTokenBody(empty bool) *acl.BearerTokenBody { func GenerateTable(empty bool) *acl.Table { m := new(acl.Table) - m.SetRecords(GenerateRecords(empty)) - m.SetContainerID(accountingtest.GenerateContainerID(empty)) + if !empty { + m.SetRecords(GenerateRecords(false)) + m.SetContainerID(accountingtest.GenerateContainerID(false)) + } + m.SetVersion(accountingtest.GenerateVersion(empty)) return m } func GenerateRecords(empty bool) []*acl.Record { - rs := make([]*acl.Record, 0) + var rs []*acl.Record if !empty { rs = append(rs, @@ -53,16 +61,15 @@ func GenerateRecord(empty bool) *acl.Record { if !empty { m.SetAction(acl.ActionAllow) m.SetOperation(acl.OperationGet) + m.SetFilters(GenerateFilters(false)) + m.SetTargets(GenerateTargets(false)) } - m.SetFilters(GenerateFilters(empty)) - m.SetTargets(GenerateTargets(empty)) - return m } func GenerateFilters(empty bool) []*acl.HeaderFilter { - fs := make([]*acl.HeaderFilter, 0) + var fs []*acl.HeaderFilter if !empty { fs = append(fs, @@ -88,7 +95,7 @@ func GenerateFilter(empty bool) *acl.HeaderFilter { } func GenerateTargets(empty bool) []*acl.Target { - ts := make([]*acl.Target, 0) + var ts []*acl.Target if !empty { ts = append(ts, From 772c8be200b6d0e6bdcfedfb8bd5cfdedd8e9848 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Fri, 11 Jun 2021 14:58:32 +0300 Subject: [PATCH 0864/1196] [#307] v2/audit/test: Do not allocate memory if `!empty` Move all memory allocation and field settings in `Generate...(empty bool)` functions behind `if !empty` check. Signed-off-by: Pavel Karpy --- v2/audit/test/generate.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/v2/audit/test/generate.go b/v2/audit/test/generate.go index 76d85a9..0d5ff01 100644 --- a/v2/audit/test/generate.go +++ b/v2/audit/test/generate.go @@ -19,12 +19,11 @@ func GenerateDataAuditResult(empty bool) *audit.DataAuditResult { m.SetFailNodes([][]byte{{3}, {4}}) m.SetRequests(666) m.SetRetries(777) + m.SetVersion(refstest.GenerateVersion(false)) + m.SetContainerID(refstest.GenerateContainerID(false)) + m.SetPassSG(refstest.GenerateObjectIDs(false)) + m.SetFailSG(refstest.GenerateObjectIDs(false)) } - m.SetVersion(refstest.GenerateVersion(empty)) - m.SetContainerID(refstest.GenerateContainerID(empty)) - m.SetPassSG(refstest.GenerateObjectIDs(empty)) - m.SetFailSG(refstest.GenerateObjectIDs(empty)) - return m } From 44dafcf0e5e4df87688732fc7c3edcee4406b0da Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Fri, 11 Jun 2021 15:17:09 +0300 Subject: [PATCH 0865/1196] [#307] v2/container/test: Do not allocate memory if `!empty` Move all memory allocation and field settings in `Generate...(empty bool)` functions behind `if !empty` check. Do not create empty slices if `empty == true`. Signed-off-by: Pavel Karpy --- v2/container/test/generate.go | 145 ++++++++++++++++++++++++++-------- 1 file changed, 110 insertions(+), 35 deletions(-) diff --git a/v2/container/test/generate.go b/v2/container/test/generate.go index 07098c3..adfe0e7 100644 --- a/v2/container/test/generate.go +++ b/v2/container/test/generate.go @@ -19,7 +19,9 @@ func GenerateAttribute(empty bool) *container.Attribute { return m } -func GenerateAttributes(empty bool) (res []*container.Attribute) { +func GenerateAttributes(empty bool) []*container.Attribute { + var res []*container.Attribute + if !empty { res = append(res, GenerateAttribute(false), @@ -27,7 +29,7 @@ func GenerateAttributes(empty bool) (res []*container.Attribute) { ) } - return + return res } func GenerateContainer(empty bool) *container.Container { @@ -36,12 +38,12 @@ func GenerateContainer(empty bool) *container.Container { if !empty { m.SetBasicACL(12) m.SetNonce([]byte{1, 2, 3}) + m.SetOwnerID(refstest.GenerateOwnerID(false)) + m.SetAttributes(GenerateAttributes(false)) + m.SetPlacementPolicy(netmaptest.GeneratePlacementPolicy(false)) } - m.SetOwnerID(refstest.GenerateOwnerID(empty)) m.SetVersion(refstest.GenerateVersion(empty)) - m.SetAttributes(GenerateAttributes(empty)) - m.SetPlacementPolicy(netmaptest.GeneratePlacementPolicy(empty)) return m } @@ -49,7 +51,10 @@ func GenerateContainer(empty bool) *container.Container { func GeneratePutRequestBody(empty bool) *container.PutRequestBody { m := new(container.PutRequestBody) - m.SetContainer(GenerateContainer(empty)) + if !empty { + m.SetContainer(GenerateContainer(false)) + } + m.SetSignature(refstest.GenerateSignature(empty)) return m @@ -58,7 +63,10 @@ func GeneratePutRequestBody(empty bool) *container.PutRequestBody { func GeneratePutRequest(empty bool) *container.PutRequest { m := new(container.PutRequest) - m.SetBody(GeneratePutRequestBody(empty)) + if !empty { + m.SetBody(GeneratePutRequestBody(false)) + } + m.SetMetaHeader(sessiontest.GenerateRequestMetaHeader(empty)) m.SetVerificationHeader(sessiontest.GenerateRequestVerificationHeader(empty)) @@ -68,7 +76,9 @@ func GeneratePutRequest(empty bool) *container.PutRequest { func GeneratePutResponseBody(empty bool) *container.PutResponseBody { m := new(container.PutResponseBody) - m.SetContainerID(refstest.GenerateContainerID(empty)) + if !empty { + m.SetContainerID(refstest.GenerateContainerID(false)) + } return m } @@ -76,7 +86,10 @@ func GeneratePutResponseBody(empty bool) *container.PutResponseBody { func GeneratePutResponse(empty bool) *container.PutResponse { m := new(container.PutResponse) - m.SetBody(GeneratePutResponseBody(empty)) + if !empty { + m.SetBody(GeneratePutResponseBody(false)) + } + m.SetMetaHeader(sessiontest.GenerateResponseMetaHeader(empty)) m.SetVerificationHeader(sessiontest.GenerateResponseVerificationHeader(empty)) @@ -86,7 +99,9 @@ func GeneratePutResponse(empty bool) *container.PutResponse { func GenerateGetRequestBody(empty bool) *container.GetRequestBody { m := new(container.GetRequestBody) - m.SetContainerID(refstest.GenerateContainerID(empty)) + if !empty { + m.SetContainerID(refstest.GenerateContainerID(false)) + } return m } @@ -94,7 +109,10 @@ func GenerateGetRequestBody(empty bool) *container.GetRequestBody { func GenerateGetRequest(empty bool) *container.GetRequest { m := new(container.GetRequest) - m.SetBody(GenerateGetRequestBody(empty)) + if !empty { + m.SetBody(GenerateGetRequestBody(false)) + } + m.SetMetaHeader(sessiontest.GenerateRequestMetaHeader(empty)) m.SetVerificationHeader(sessiontest.GenerateRequestVerificationHeader(empty)) @@ -104,7 +122,10 @@ func GenerateGetRequest(empty bool) *container.GetRequest { func GenerateGetResponseBody(empty bool) *container.GetResponseBody { m := new(container.GetResponseBody) - m.SetContainer(GenerateContainer(empty)) + if !empty { + m.SetContainer(GenerateContainer(false)) + } + m.SetSignature(refstest.GenerateSignature(empty)) m.SetSessionToken(sessiontest.GenerateSessionToken(empty)) @@ -114,7 +135,10 @@ func GenerateGetResponseBody(empty bool) *container.GetResponseBody { func GenerateGetResponse(empty bool) *container.GetResponse { m := new(container.GetResponse) - m.SetBody(GenerateGetResponseBody(empty)) + if !empty { + m.SetBody(GenerateGetResponseBody(false)) + } + m.SetMetaHeader(sessiontest.GenerateResponseMetaHeader(empty)) m.SetVerificationHeader(sessiontest.GenerateResponseVerificationHeader(empty)) @@ -124,7 +148,10 @@ func GenerateGetResponse(empty bool) *container.GetResponse { func GenerateDeleteRequestBody(empty bool) *container.DeleteRequestBody { m := new(container.DeleteRequestBody) - m.SetContainerID(refstest.GenerateContainerID(empty)) + if !empty { + m.SetContainerID(refstest.GenerateContainerID(false)) + } + m.SetSignature(refstest.GenerateSignature(empty)) return m @@ -133,7 +160,10 @@ func GenerateDeleteRequestBody(empty bool) *container.DeleteRequestBody { func GenerateDeleteRequest(empty bool) *container.DeleteRequest { m := new(container.DeleteRequest) - m.SetBody(GenerateDeleteRequestBody(empty)) + if !empty { + m.SetBody(GenerateDeleteRequestBody(false)) + } + m.SetMetaHeader(sessiontest.GenerateRequestMetaHeader(empty)) m.SetVerificationHeader(sessiontest.GenerateRequestVerificationHeader(empty)) @@ -149,7 +179,10 @@ func GenerateDeleteResponseBody(empty bool) *container.DeleteResponseBody { func GenerateDeleteResponse(empty bool) *container.DeleteResponse { m := new(container.DeleteResponse) - m.SetBody(GenerateDeleteResponseBody(empty)) + if !empty { + m.SetBody(GenerateDeleteResponseBody(false)) + } + m.SetMetaHeader(sessiontest.GenerateResponseMetaHeader(empty)) m.SetVerificationHeader(sessiontest.GenerateResponseVerificationHeader(empty)) @@ -159,7 +192,9 @@ func GenerateDeleteResponse(empty bool) *container.DeleteResponse { func GenerateListRequestBody(empty bool) *container.ListRequestBody { m := new(container.ListRequestBody) - m.SetOwnerID(refstest.GenerateOwnerID(empty)) + if !empty { + m.SetOwnerID(refstest.GenerateOwnerID(false)) + } return m } @@ -167,7 +202,10 @@ func GenerateListRequestBody(empty bool) *container.ListRequestBody { func GenerateListRequest(empty bool) *container.ListRequest { m := new(container.ListRequest) - m.SetBody(GenerateListRequestBody(empty)) + if !empty { + m.SetBody(GenerateListRequestBody(false)) + } + m.SetMetaHeader(sessiontest.GenerateRequestMetaHeader(empty)) m.SetVerificationHeader(sessiontest.GenerateRequestVerificationHeader(empty)) @@ -177,7 +215,9 @@ func GenerateListRequest(empty bool) *container.ListRequest { func GenerateListResponseBody(empty bool) *container.ListResponseBody { m := new(container.ListResponseBody) - m.SetContainerIDs(refstest.GenerateContainerIDs(empty)) + if !empty { + m.SetContainerIDs(refstest.GenerateContainerIDs(false)) + } return m } @@ -185,7 +225,10 @@ func GenerateListResponseBody(empty bool) *container.ListResponseBody { func GenerateListResponse(empty bool) *container.ListResponse { m := new(container.ListResponse) - m.SetBody(GenerateListResponseBody(empty)) + if !empty { + m.SetBody(GenerateListResponseBody(false)) + } + m.SetMetaHeader(sessiontest.GenerateResponseMetaHeader(empty)) m.SetVerificationHeader(sessiontest.GenerateResponseVerificationHeader(empty)) @@ -195,7 +238,10 @@ func GenerateListResponse(empty bool) *container.ListResponse { func GenerateSetExtendedACLRequestBody(empty bool) *container.SetExtendedACLRequestBody { m := new(container.SetExtendedACLRequestBody) - m.SetEACL(acltest.GenerateTable(empty)) + if !empty { + m.SetEACL(acltest.GenerateTable(false)) + } + m.SetSignature(refstest.GenerateSignature(empty)) return m @@ -204,7 +250,10 @@ func GenerateSetExtendedACLRequestBody(empty bool) *container.SetExtendedACLRequ func GenerateSetExtendedACLRequest(empty bool) *container.SetExtendedACLRequest { m := new(container.SetExtendedACLRequest) - m.SetBody(GenerateSetExtendedACLRequestBody(empty)) + if !empty { + m.SetBody(GenerateSetExtendedACLRequestBody(false)) + } + m.SetMetaHeader(sessiontest.GenerateRequestMetaHeader(empty)) m.SetVerificationHeader(sessiontest.GenerateRequestVerificationHeader(empty)) @@ -220,7 +269,10 @@ func GenerateSetExtendedACLResponseBody(empty bool) *container.SetExtendedACLRes func GenerateSetExtendedACLResponse(empty bool) *container.SetExtendedACLResponse { m := new(container.SetExtendedACLResponse) - m.SetBody(GenerateSetExtendedACLResponseBody(empty)) + if !empty { + m.SetBody(GenerateSetExtendedACLResponseBody(false)) + } + m.SetMetaHeader(sessiontest.GenerateResponseMetaHeader(empty)) m.SetVerificationHeader(sessiontest.GenerateResponseVerificationHeader(empty)) @@ -230,7 +282,9 @@ func GenerateSetExtendedACLResponse(empty bool) *container.SetExtendedACLRespons func GenerateGetExtendedACLRequestBody(empty bool) *container.GetExtendedACLRequestBody { m := new(container.GetExtendedACLRequestBody) - m.SetContainerID(refstest.GenerateContainerID(empty)) + if !empty { + m.SetContainerID(refstest.GenerateContainerID(false)) + } return m } @@ -238,7 +292,10 @@ func GenerateGetExtendedACLRequestBody(empty bool) *container.GetExtendedACLRequ func GenerateGetExtendedACLRequest(empty bool) *container.GetExtendedACLRequest { m := new(container.GetExtendedACLRequest) - m.SetBody(GenerateGetExtendedACLRequestBody(empty)) + if !empty { + m.SetBody(GenerateGetExtendedACLRequestBody(false)) + } + m.SetMetaHeader(sessiontest.GenerateRequestMetaHeader(empty)) m.SetVerificationHeader(sessiontest.GenerateRequestVerificationHeader(empty)) @@ -248,7 +305,10 @@ func GenerateGetExtendedACLRequest(empty bool) *container.GetExtendedACLRequest func GenerateGetExtendedACLResponseBody(empty bool) *container.GetExtendedACLResponseBody { m := new(container.GetExtendedACLResponseBody) - m.SetEACL(acltest.GenerateTable(empty)) + if !empty { + m.SetEACL(acltest.GenerateTable(false)) + } + m.SetSignature(refstest.GenerateSignature(empty)) m.SetSessionToken(sessiontest.GenerateSessionToken(empty)) @@ -258,7 +318,10 @@ func GenerateGetExtendedACLResponseBody(empty bool) *container.GetExtendedACLRes func GenerateGetExtendedACLResponse(empty bool) *container.GetExtendedACLResponse { m := new(container.GetExtendedACLResponse) - m.SetBody(GenerateGetExtendedACLResponseBody(empty)) + if !empty { + m.SetBody(GenerateGetExtendedACLResponseBody(false)) + } + m.SetMetaHeader(sessiontest.GenerateResponseMetaHeader(empty)) m.SetVerificationHeader(sessiontest.GenerateResponseVerificationHeader(empty)) @@ -268,14 +331,18 @@ func GenerateGetExtendedACLResponse(empty bool) *container.GetExtendedACLRespons func GenerateUsedSpaceAnnouncement(empty bool) *container.UsedSpaceAnnouncement { m := new(container.UsedSpaceAnnouncement) - m.SetContainerID(refstest.GenerateContainerID(empty)) - m.SetEpoch(1) - m.SetUsedSpace(2) + if !empty { + m.SetContainerID(refstest.GenerateContainerID(false)) + m.SetEpoch(1) + m.SetUsedSpace(2) + } return m } -func GenerateUsedSpaceAnnouncements(empty bool) (res []*container.UsedSpaceAnnouncement) { +func GenerateUsedSpaceAnnouncements(empty bool) []*container.UsedSpaceAnnouncement { + var res []*container.UsedSpaceAnnouncement + if !empty { res = append(res, GenerateUsedSpaceAnnouncement(false), @@ -283,13 +350,15 @@ func GenerateUsedSpaceAnnouncements(empty bool) (res []*container.UsedSpaceAnnou ) } - return + return res } func GenerateAnnounceUsedSpaceRequestBody(empty bool) *container.AnnounceUsedSpaceRequestBody { m := new(container.AnnounceUsedSpaceRequestBody) - m.SetAnnouncements(GenerateUsedSpaceAnnouncements(empty)) + if !empty { + m.SetAnnouncements(GenerateUsedSpaceAnnouncements(false)) + } return m } @@ -297,7 +366,10 @@ func GenerateAnnounceUsedSpaceRequestBody(empty bool) *container.AnnounceUsedSpa func GenerateAnnounceUsedSpaceRequest(empty bool) *container.AnnounceUsedSpaceRequest { m := new(container.AnnounceUsedSpaceRequest) - m.SetBody(GenerateAnnounceUsedSpaceRequestBody(empty)) + if !empty { + m.SetBody(GenerateAnnounceUsedSpaceRequestBody(false)) + } + m.SetMetaHeader(sessiontest.GenerateRequestMetaHeader(empty)) m.SetVerificationHeader(sessiontest.GenerateRequestVerificationHeader(empty)) @@ -313,7 +385,10 @@ func GenerateAnnounceUsedSpaceResponseBody(empty bool) *container.AnnounceUsedSp func GenerateAnnounceUsedSpaceResponse(empty bool) *container.AnnounceUsedSpaceResponse { m := new(container.AnnounceUsedSpaceResponse) - m.SetBody(GenerateAnnounceUsedSpaceResponseBody(empty)) + if !empty { + m.SetBody(GenerateAnnounceUsedSpaceResponseBody(false)) + } + m.SetMetaHeader(sessiontest.GenerateResponseMetaHeader(empty)) m.SetVerificationHeader(sessiontest.GenerateResponseVerificationHeader(empty)) From dd3cbd95e945bd7eaab9297b0233f042d3f19da8 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Fri, 11 Jun 2021 15:28:09 +0300 Subject: [PATCH 0866/1196] [#307] v2/netmap/test: Do not allocate memory if `!empty` Move all memory allocation and field settings in `Generate...(empty bool)` functions behind `if !empty` check. Do not create empty slices if `empty == true`. Signed-off-by: Pavel Karpy --- v2/netmap/test/generate.go | 63 ++++++++++++++++++++++++++------------ 1 file changed, 43 insertions(+), 20 deletions(-) diff --git a/v2/netmap/test/generate.go b/v2/netmap/test/generate.go index 3818596..ce94338 100644 --- a/v2/netmap/test/generate.go +++ b/v2/netmap/test/generate.go @@ -30,7 +30,9 @@ func generateFilter(empty, withSub bool) *netmap.Filter { return m } -func GenerateFilters(empty bool) (res []*netmap.Filter) { +func GenerateFilters(empty bool) []*netmap.Filter { + var res []*netmap.Filter + if !empty { res = append(res, GenerateFilter(false), @@ -38,7 +40,7 @@ func GenerateFilters(empty bool) (res []*netmap.Filter) { ) } - return + return res } func GenerateSelector(empty bool) *netmap.Selector { @@ -55,7 +57,9 @@ func GenerateSelector(empty bool) *netmap.Selector { return m } -func GenerateSelectors(empty bool) (res []*netmap.Selector) { +func GenerateSelectors(empty bool) []*netmap.Selector { + var res []*netmap.Selector + if !empty { res = append(res, GenerateSelector(false), @@ -63,7 +67,7 @@ func GenerateSelectors(empty bool) (res []*netmap.Selector) { ) } - return + return res } func GenerateReplica(empty bool) *netmap.Replica { @@ -77,7 +81,9 @@ func GenerateReplica(empty bool) *netmap.Replica { return m } -func GenerateReplicas(empty bool) (res []*netmap.Replica) { +func GenerateReplicas(empty bool) []*netmap.Replica { + var res []*netmap.Replica + if !empty { res = append(res, GenerateReplica(false), @@ -85,7 +91,7 @@ func GenerateReplicas(empty bool) (res []*netmap.Replica) { ) } - return + return res } func GeneratePlacementPolicy(empty bool) *netmap.PlacementPolicy { @@ -93,12 +99,11 @@ func GeneratePlacementPolicy(empty bool) *netmap.PlacementPolicy { if !empty { m.SetContainerBackupFactor(322) + m.SetFilters(GenerateFilters(false)) + m.SetSelectors(GenerateSelectors(false)) + m.SetReplicas(GenerateReplicas(false)) } - m.SetFilters(GenerateFilters(empty)) - m.SetSelectors(GenerateSelectors(empty)) - m.SetReplicas(GenerateReplicas(empty)) - return m } @@ -113,7 +118,9 @@ func GenerateAttribute(empty bool) *netmap.Attribute { return m } -func GenerateAttributes(empty bool) (res []*netmap.Attribute) { +func GenerateAttributes(empty bool) []*netmap.Attribute { + var res []*netmap.Attribute + if !empty { res = append(res, GenerateAttribute(false), @@ -121,7 +128,7 @@ func GenerateAttributes(empty bool) (res []*netmap.Attribute) { ) } - return + return res } func GenerateNodeInfo(empty bool) *netmap.NodeInfo { @@ -131,10 +138,9 @@ func GenerateNodeInfo(empty bool) *netmap.NodeInfo { m.SetAddress("node address") m.SetPublicKey([]byte{1, 2, 3}) m.SetState(33) + m.SetAttributes(GenerateAttributes(empty)) } - m.SetAttributes(GenerateAttributes(empty)) - return m } @@ -147,7 +153,10 @@ func GenerateLocalNodeInfoRequestBody(empty bool) *netmap.LocalNodeInfoRequestBo func GenerateLocalNodeInfoRequest(empty bool) *netmap.LocalNodeInfoRequest { m := new(netmap.LocalNodeInfoRequest) - m.SetBody(GenerateLocalNodeInfoRequestBody(empty)) + if !empty { + m.SetBody(GenerateLocalNodeInfoRequestBody(false)) + } + m.SetMetaHeader(sessiontest.GenerateRequestMetaHeader(empty)) m.SetVerificationHeader(sessiontest.GenerateRequestVerificationHeader(empty)) @@ -157,8 +166,11 @@ func GenerateLocalNodeInfoRequest(empty bool) *netmap.LocalNodeInfoRequest { func GenerateLocalNodeInfoResponseBody(empty bool) *netmap.LocalNodeInfoResponseBody { m := new(netmap.LocalNodeInfoResponseBody) + if !empty { + m.SetNodeInfo(GenerateNodeInfo(false)) + } + m.SetVersion(refstest.GenerateVersion(empty)) - m.SetNodeInfo(GenerateNodeInfo(empty)) return m } @@ -166,7 +178,10 @@ func GenerateLocalNodeInfoResponseBody(empty bool) *netmap.LocalNodeInfoResponse func GenerateLocalNodeInfoResponse(empty bool) *netmap.LocalNodeInfoResponse { m := new(netmap.LocalNodeInfoResponse) - m.SetBody(GenerateLocalNodeInfoResponseBody(empty)) + if !empty { + m.SetBody(GenerateLocalNodeInfoResponseBody(false)) + } + m.SetMetaHeader(sessiontest.GenerateResponseMetaHeader(empty)) m.SetVerificationHeader(sessiontest.GenerateResponseVerificationHeader(empty)) @@ -193,7 +208,10 @@ func GenerateNetworkInfoRequestBody(empty bool) *netmap.NetworkInfoRequestBody { func GenerateNetworkInfoRequest(empty bool) *netmap.NetworkInfoRequest { m := new(netmap.NetworkInfoRequest) - m.SetBody(GenerateNetworkInfoRequestBody(empty)) + if !empty { + m.SetBody(GenerateNetworkInfoRequestBody(false)) + } + m.SetMetaHeader(sessiontest.GenerateRequestMetaHeader(empty)) m.SetVerificationHeader(sessiontest.GenerateRequestVerificationHeader(empty)) @@ -203,7 +221,9 @@ func GenerateNetworkInfoRequest(empty bool) *netmap.NetworkInfoRequest { func GenerateNetworkInfoResponseBody(empty bool) *netmap.NetworkInfoResponseBody { m := new(netmap.NetworkInfoResponseBody) - m.SetNetworkInfo(GenerateNetworkInfo(empty)) + if !empty { + m.SetNetworkInfo(GenerateNetworkInfo(false)) + } return m } @@ -211,7 +231,10 @@ func GenerateNetworkInfoResponseBody(empty bool) *netmap.NetworkInfoResponseBody func GenerateNetworkInfoResponse(empty bool) *netmap.NetworkInfoResponse { m := new(netmap.NetworkInfoResponse) - m.SetBody(GenerateNetworkInfoResponseBody(empty)) + if !empty { + m.SetBody(GenerateNetworkInfoResponseBody(false)) + } + m.SetMetaHeader(sessiontest.GenerateResponseMetaHeader(empty)) m.SetVerificationHeader(sessiontest.GenerateResponseVerificationHeader(empty)) From 192382dbfcea9691973f75ce40610711fbff319c Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Fri, 11 Jun 2021 15:39:56 +0300 Subject: [PATCH 0867/1196] [#307] v2/object/test: Do not allocate memory if `!empty` Move all memory allocation and field settings in `Generate...(empty bool)` functions behind `if !empty` check. Do not create empty slices if `empty == true`. Signed-off-by: Pavel Karpy --- v2/object/test/generate.go | 169 +++++++++++++++++++++++++------------ 1 file changed, 115 insertions(+), 54 deletions(-) diff --git a/v2/object/test/generate.go b/v2/object/test/generate.go index 494645b..9070272 100644 --- a/v2/object/test/generate.go +++ b/v2/object/test/generate.go @@ -13,10 +13,10 @@ func GenerateShortHeader(empty bool) *object.ShortHeader { m.SetObjectType(13) m.SetCreationEpoch(100) m.SetPayloadLength(12321) + m.SetOwnerID(refstest.GenerateOwnerID(false)) } m.SetVersion(refstest.GenerateVersion(empty)) - m.SetOwnerID(refstest.GenerateOwnerID(empty)) m.SetHomomorphicHash(refstest.GenerateChecksum(empty)) m.SetPayloadHash(refstest.GenerateChecksum(empty)) @@ -34,7 +34,9 @@ func GenerateAttribute(empty bool) *object.Attribute { return m } -func GenerateAttributes(empty bool) (res []*object.Attribute) { +func GenerateAttributes(empty bool) []*object.Attribute { + var res []*object.Attribute + if !empty { res = append(res, GenerateAttribute(false), @@ -42,7 +44,7 @@ func GenerateAttributes(empty bool) (res []*object.Attribute) { ) } - return + return res } func GenerateSplitHeader(empty bool) *object.SplitHeader { @@ -54,12 +56,12 @@ func generateSplitHeader(empty, withPar bool) *object.SplitHeader { if !empty { m.SetSplitID([]byte{1, 3, 5}) + m.SetParent(refstest.GenerateObjectID(false)) + m.SetPrevious(refstest.GenerateObjectID(false)) + m.SetChildren(refstest.GenerateObjectIDs(false)) } - m.SetParent(refstest.GenerateObjectID(empty)) - m.SetPrevious(refstest.GenerateObjectID(empty)) m.SetParentSignature(refstest.GenerateSignature(empty)) - m.SetChildren(refstest.GenerateObjectIDs(empty)) if withPar { m.SetParentHeader(generateHeader(empty, false)) @@ -79,15 +81,15 @@ func generateHeader(empty, withSplit bool) *object.Header { m.SetPayloadLength(777) m.SetCreationEpoch(432) m.SetObjectType(111) + m.SetOwnerID(refstest.GenerateOwnerID(false)) + m.SetContainerID(refstest.GenerateContainerID(false)) + m.SetAttributes(GenerateAttributes(false)) } m.SetVersion(refstest.GenerateVersion(empty)) m.SetPayloadHash(refstest.GenerateChecksum(empty)) - m.SetOwnerID(refstest.GenerateOwnerID(empty)) m.SetHomomorphicHash(refstest.GenerateChecksum(empty)) - m.SetContainerID(refstest.GenerateContainerID(empty)) m.SetSessionToken(sessiontest.GenerateSessionToken(empty)) - m.SetAttributes(GenerateAttributes(empty)) if withSplit { m.SetSplit(generateSplitHeader(empty, false)) @@ -110,9 +112,9 @@ func GenerateObject(empty bool) *object.Object { if !empty { m.SetPayload([]byte{7, 8, 9}) + m.SetObjectID(refstest.GenerateObjectID(false)) } - m.SetObjectID(refstest.GenerateObjectID(empty)) m.SetSignature(refstest.GenerateSignature(empty)) m.SetHeader(GenerateHeader(empty)) @@ -124,11 +126,10 @@ func GenerateSplitInfo(empty bool) *object.SplitInfo { if !empty { m.SetSplitID([]byte("splitID")) + m.SetLastPart(refstest.GenerateObjectID(false)) + m.SetLink(refstest.GenerateObjectID(false)) } - m.SetLastPart(refstest.GenerateObjectID(empty)) - m.SetLink(refstest.GenerateObjectID(empty)) - return m } @@ -137,17 +138,19 @@ func GenerateGetRequestBody(empty bool) *object.GetRequestBody { if !empty { m.SetRaw(true) + m.SetAddress(refstest.GenerateAddress(false)) } - m.SetAddress(refstest.GenerateAddress(empty)) - return m } func GenerateGetRequest(empty bool) *object.GetRequest { m := new(object.GetRequest) - m.SetBody(GenerateGetRequestBody(empty)) + if !empty { + m.SetBody(GenerateGetRequestBody(false)) + } + m.SetMetaHeader(sessiontest.GenerateRequestMetaHeader(empty)) m.SetVerificationHeader(sessiontest.GenerateRequestVerificationHeader(empty)) @@ -157,7 +160,10 @@ func GenerateGetRequest(empty bool) *object.GetRequest { func GenerateGetObjectPartInit(empty bool) *object.GetObjectPartInit { m := new(object.GetObjectPartInit) - m.SetObjectID(refstest.GenerateObjectID(empty)) + if !empty { + m.SetObjectID(refstest.GenerateObjectID(false)) + } + m.SetSignature(refstest.GenerateSignature(empty)) m.SetHeader(GenerateHeader(empty)) @@ -177,7 +183,9 @@ func GenerateGetObjectPartChunk(empty bool) *object.GetObjectPartChunk { func GenerateGetResponseBody(empty bool) *object.GetResponseBody { m := new(object.GetResponseBody) - m.SetObjectPart(GenerateGetObjectPartInit(empty)) + if !empty { + m.SetObjectPart(GenerateGetObjectPartInit(false)) + } return m } @@ -185,7 +193,10 @@ func GenerateGetResponseBody(empty bool) *object.GetResponseBody { func GenerateGetResponse(empty bool) *object.GetResponse { m := new(object.GetResponse) - m.SetBody(GenerateGetResponseBody(empty)) + if !empty { + m.SetBody(GenerateGetResponseBody(false)) + } + m.SetMetaHeader(sessiontest.GenerateResponseMetaHeader(empty)) m.SetVerificationHeader(sessiontest.GenerateResponseVerificationHeader(empty)) @@ -197,9 +208,9 @@ func GeneratePutObjectPartInit(empty bool) *object.PutObjectPartInit { if !empty { m.SetCopiesNumber(234) + m.SetObjectID(refstest.GenerateObjectID(false)) } - m.SetObjectID(refstest.GenerateObjectID(empty)) m.SetSignature(refstest.GenerateSignature(empty)) m.SetHeader(GenerateHeader(empty)) @@ -219,7 +230,9 @@ func GeneratePutObjectPartChunk(empty bool) *object.PutObjectPartChunk { func GeneratePutRequestBody(empty bool) *object.PutRequestBody { m := new(object.PutRequestBody) - m.SetObjectPart(GeneratePutObjectPartInit(empty)) + if !empty { + m.SetObjectPart(GeneratePutObjectPartInit(false)) + } return m } @@ -227,7 +240,10 @@ func GeneratePutRequestBody(empty bool) *object.PutRequestBody { func GeneratePutRequest(empty bool) *object.PutRequest { m := new(object.PutRequest) - m.SetBody(GeneratePutRequestBody(empty)) + if !empty { + m.SetBody(GeneratePutRequestBody(false)) + } + m.SetMetaHeader(sessiontest.GenerateRequestMetaHeader(empty)) m.SetVerificationHeader(sessiontest.GenerateRequestVerificationHeader(empty)) @@ -237,7 +253,9 @@ func GeneratePutRequest(empty bool) *object.PutRequest { func GeneratePutResponseBody(empty bool) *object.PutResponseBody { m := new(object.PutResponseBody) - m.SetObjectID(refstest.GenerateObjectID(empty)) + if !empty { + m.SetObjectID(refstest.GenerateObjectID(false)) + } return m } @@ -245,7 +263,10 @@ func GeneratePutResponseBody(empty bool) *object.PutResponseBody { func GeneratePutResponse(empty bool) *object.PutResponse { m := new(object.PutResponse) - m.SetBody(GeneratePutResponseBody(empty)) + if !empty { + m.SetBody(GeneratePutResponseBody(false)) + } + m.SetMetaHeader(sessiontest.GenerateResponseMetaHeader(empty)) m.SetVerificationHeader(sessiontest.GenerateResponseVerificationHeader(empty)) @@ -255,7 +276,9 @@ func GeneratePutResponse(empty bool) *object.PutResponse { func GenerateDeleteRequestBody(empty bool) *object.DeleteRequestBody { m := new(object.DeleteRequestBody) - m.SetAddress(refstest.GenerateAddress(empty)) + if !empty { + m.SetAddress(refstest.GenerateAddress(false)) + } return m } @@ -263,7 +286,10 @@ func GenerateDeleteRequestBody(empty bool) *object.DeleteRequestBody { func GenerateDeleteRequest(empty bool) *object.DeleteRequest { m := new(object.DeleteRequest) - m.SetBody(GenerateDeleteRequestBody(empty)) + if !empty { + m.SetBody(GenerateDeleteRequestBody(false)) + } + m.SetMetaHeader(sessiontest.GenerateRequestMetaHeader(empty)) m.SetVerificationHeader(sessiontest.GenerateRequestVerificationHeader(empty)) @@ -273,7 +299,9 @@ func GenerateDeleteRequest(empty bool) *object.DeleteRequest { func GenerateDeleteResponseBody(empty bool) *object.DeleteResponseBody { m := new(object.DeleteResponseBody) - m.SetTombstone(refstest.GenerateAddress(empty)) + if !empty { + m.SetTombstone(refstest.GenerateAddress(false)) + } return m } @@ -281,7 +309,10 @@ func GenerateDeleteResponseBody(empty bool) *object.DeleteResponseBody { func GenerateDeleteResponse(empty bool) *object.DeleteResponse { m := new(object.DeleteResponse) - m.SetBody(GenerateDeleteResponseBody(empty)) + if !empty { + m.SetBody(GenerateDeleteResponseBody(false)) + } + m.SetMetaHeader(sessiontest.GenerateResponseMetaHeader(empty)) m.SetVerificationHeader(sessiontest.GenerateResponseVerificationHeader(empty)) @@ -294,17 +325,19 @@ func GenerateHeadRequestBody(empty bool) *object.HeadRequestBody { if !empty { m.SetRaw(true) m.SetMainOnly(true) + m.SetAddress(refstest.GenerateAddress(false)) } - m.SetAddress(refstest.GenerateAddress(empty)) - return m } func GenerateHeadRequest(empty bool) *object.HeadRequest { m := new(object.HeadRequest) - m.SetBody(GenerateHeadRequestBody(empty)) + if !empty { + m.SetBody(GenerateHeadRequestBody(false)) + } + m.SetMetaHeader(sessiontest.GenerateRequestMetaHeader(empty)) m.SetVerificationHeader(sessiontest.GenerateRequestVerificationHeader(empty)) @@ -314,7 +347,9 @@ func GenerateHeadRequest(empty bool) *object.HeadRequest { func GenerateHeadResponseBody(empty bool) *object.HeadResponseBody { m := new(object.HeadResponseBody) - m.SetHeaderPart(GenerateHeaderWithSignature(empty)) + if !empty { + m.SetHeaderPart(GenerateHeaderWithSignature(false)) + } return m } @@ -322,7 +357,10 @@ func GenerateHeadResponseBody(empty bool) *object.HeadResponseBody { func GenerateHeadResponse(empty bool) *object.HeadResponse { m := new(object.HeadResponse) - m.SetBody(GenerateHeadResponseBody(empty)) + if !empty { + m.SetBody(GenerateHeadResponseBody(false)) + } + m.SetMetaHeader(sessiontest.GenerateResponseMetaHeader(empty)) m.SetVerificationHeader(sessiontest.GenerateResponseVerificationHeader(empty)) @@ -341,7 +379,9 @@ func GenerateSearchFilter(empty bool) *object.SearchFilter { return m } -func GenerateSearchFilters(empty bool) (res []*object.SearchFilter) { +func GenerateSearchFilters(empty bool) []*object.SearchFilter { + var res []*object.SearchFilter + if !empty { res = append(res, GenerateSearchFilter(false), @@ -349,7 +389,7 @@ func GenerateSearchFilters(empty bool) (res []*object.SearchFilter) { ) } - return + return res } func GenerateSearchRequestBody(empty bool) *object.SearchRequestBody { @@ -357,18 +397,20 @@ func GenerateSearchRequestBody(empty bool) *object.SearchRequestBody { if !empty { m.SetVersion(555) + m.SetContainerID(refstest.GenerateContainerID(false)) + m.SetFilters(GenerateSearchFilters(false)) } - m.SetContainerID(refstest.GenerateContainerID(empty)) - m.SetFilters(GenerateSearchFilters(empty)) - return m } func GenerateSearchRequest(empty bool) *object.SearchRequest { m := new(object.SearchRequest) - m.SetBody(GenerateSearchRequestBody(empty)) + if !empty { + m.SetBody(GenerateSearchRequestBody(false)) + } + m.SetMetaHeader(sessiontest.GenerateRequestMetaHeader(empty)) m.SetVerificationHeader(sessiontest.GenerateRequestVerificationHeader(empty)) @@ -378,7 +420,9 @@ func GenerateSearchRequest(empty bool) *object.SearchRequest { func GenerateSearchResponseBody(empty bool) *object.SearchResponseBody { m := new(object.SearchResponseBody) - m.SetIDList(refstest.GenerateObjectIDs(empty)) + if !empty { + m.SetIDList(refstest.GenerateObjectIDs(false)) + } return m } @@ -386,7 +430,10 @@ func GenerateSearchResponseBody(empty bool) *object.SearchResponseBody { func GenerateSearchResponse(empty bool) *object.SearchResponse { m := new(object.SearchResponse) - m.SetBody(GenerateSearchResponseBody(empty)) + if !empty { + m.SetBody(GenerateSearchResponseBody(false)) + } + m.SetMetaHeader(sessiontest.GenerateResponseMetaHeader(empty)) m.SetVerificationHeader(sessiontest.GenerateResponseVerificationHeader(empty)) @@ -404,7 +451,9 @@ func GenerateRange(empty bool) *object.Range { return m } -func GenerateRanges(empty bool) (res []*object.Range) { +func GenerateRanges(empty bool) []*object.Range { + var res []*object.Range + if !empty { res = append(res, GenerateRange(false), @@ -412,7 +461,7 @@ func GenerateRanges(empty bool) (res []*object.Range) { ) } - return + return res } func GenerateGetRangeRequestBody(empty bool) *object.GetRangeRequestBody { @@ -420,18 +469,20 @@ func GenerateGetRangeRequestBody(empty bool) *object.GetRangeRequestBody { if !empty { m.SetRaw(true) + m.SetAddress(refstest.GenerateAddress(empty)) + m.SetRange(GenerateRange(empty)) } - m.SetAddress(refstest.GenerateAddress(empty)) - m.SetRange(GenerateRange(empty)) - return m } func GenerateGetRangeRequest(empty bool) *object.GetRangeRequest { m := new(object.GetRangeRequest) - m.SetBody(GenerateGetRangeRequestBody(empty)) + if !empty { + m.SetBody(GenerateGetRangeRequestBody(false)) + } + m.SetMetaHeader(sessiontest.GenerateRequestMetaHeader(empty)) m.SetVerificationHeader(sessiontest.GenerateRequestVerificationHeader(empty)) @@ -451,7 +502,9 @@ func GenerateGetRangePartChunk(empty bool) *object.GetRangePartChunk { func GenerateGetRangeResponseBody(empty bool) *object.GetRangeResponseBody { m := new(object.GetRangeResponseBody) - m.SetRangePart(GenerateGetRangePartChunk(empty)) + if !empty { + m.SetRangePart(GenerateGetRangePartChunk(false)) + } return m } @@ -459,7 +512,10 @@ func GenerateGetRangeResponseBody(empty bool) *object.GetRangeResponseBody { func GenerateGetRangeResponse(empty bool) *object.GetRangeResponse { m := new(object.GetRangeResponse) - m.SetBody(GenerateGetRangeResponseBody(empty)) + if !empty { + m.SetBody(GenerateGetRangeResponseBody(false)) + } + m.SetMetaHeader(sessiontest.GenerateResponseMetaHeader(empty)) m.SetVerificationHeader(sessiontest.GenerateResponseVerificationHeader(empty)) @@ -472,18 +528,20 @@ func GenerateGetRangeHashRequestBody(empty bool) *object.GetRangeHashRequestBody if !empty { m.SetSalt([]byte("range hash salt")) m.SetType(455) + m.SetAddress(refstest.GenerateAddress(false)) + m.SetRanges(GenerateRanges(false)) } - m.SetAddress(refstest.GenerateAddress(empty)) - m.SetRanges(GenerateRanges(empty)) - return m } func GenerateGetRangeHashRequest(empty bool) *object.GetRangeHashRequest { m := new(object.GetRangeHashRequest) - m.SetBody(GenerateGetRangeHashRequestBody(empty)) + if !empty { + m.SetBody(GenerateGetRangeHashRequestBody(false)) + } + m.SetMetaHeader(sessiontest.GenerateRequestMetaHeader(empty)) m.SetVerificationHeader(sessiontest.GenerateRequestVerificationHeader(empty)) @@ -504,7 +562,10 @@ func GenerateGetRangeHashResponseBody(empty bool) *object.GetRangeHashResponseBo func GenerateGetRangeHashResponse(empty bool) *object.GetRangeHashResponse { m := new(object.GetRangeHashResponse) - m.SetBody(GenerateGetRangeHashResponseBody(empty)) + if !empty { + m.SetBody(GenerateGetRangeHashResponseBody(false)) + } + m.SetMetaHeader(sessiontest.GenerateResponseMetaHeader(empty)) m.SetVerificationHeader(sessiontest.GenerateResponseVerificationHeader(empty)) From 704d16c6c6d630a35e2ab7d3451145f0a1134ac3 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Fri, 11 Jun 2021 15:41:36 +0300 Subject: [PATCH 0868/1196] [#307] v2/refs/test: Do not allocate memory if `!empty` Move all memory allocation and field settings in `Generate...(empty bool)` functions behind `if !empty` check. Do not create empty slices if `empty == true`. Signed-off-by: Pavel Karpy --- v2/refs/test/generate.go | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/v2/refs/test/generate.go b/v2/refs/test/generate.go index 1f90ce0..e8a5e6e 100644 --- a/v2/refs/test/generate.go +++ b/v2/refs/test/generate.go @@ -28,8 +28,10 @@ func GenerateOwnerID(empty bool) *refs.OwnerID { func GenerateAddress(empty bool) *refs.Address { m := new(refs.Address) - m.SetObjectID(GenerateObjectID(empty)) - m.SetContainerID(GenerateContainerID(empty)) + if !empty { + m.SetObjectID(GenerateObjectID(false)) + m.SetContainerID(GenerateContainerID(false)) + } return m } @@ -45,7 +47,7 @@ func GenerateObjectID(empty bool) *refs.ObjectID { } func GenerateObjectIDs(empty bool) []*refs.ObjectID { - ids := make([]*refs.ObjectID, 0) + var ids []*refs.ObjectID if !empty { ids = append(ids, @@ -67,7 +69,9 @@ func GenerateContainerID(empty bool) *refs.ContainerID { return m } -func GenerateContainerIDs(empty bool) (res []*refs.ContainerID) { +func GenerateContainerIDs(empty bool) []*refs.ContainerID { + var res []*refs.ContainerID + if !empty { res = append(res, GenerateContainerID(false), @@ -75,7 +79,7 @@ func GenerateContainerIDs(empty bool) (res []*refs.ContainerID) { ) } - return + return res } func GenerateSignature(empty bool) *refs.Signature { From 383edb1be4a4b6da75e14353d77a976480a7c403 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Fri, 11 Jun 2021 15:44:16 +0300 Subject: [PATCH 0869/1196] [#307] v2/session/test: Do not allocate memory if `!empty` Move all memory allocation and field settings in `Generate...(empty bool)` functions behind `if !empty` check. Do not create empty slices if `empty == true`. Signed-off-by: Pavel Karpy --- v2/session/test/generate.go | 43 +++++++++++++++++++++++-------------- 1 file changed, 27 insertions(+), 16 deletions(-) diff --git a/v2/session/test/generate.go b/v2/session/test/generate.go index bad4124..4aec4a4 100644 --- a/v2/session/test/generate.go +++ b/v2/session/test/generate.go @@ -11,17 +11,19 @@ func GenerateCreateRequestBody(empty bool) *session.CreateRequestBody { if !empty { m.SetExpiration(555) + m.SetOwnerID(refstest.GenerateOwnerID(false)) } - m.SetOwnerID(refstest.GenerateOwnerID(empty)) - return m } func GenerateCreateRequest(empty bool) *session.CreateRequest { m := new(session.CreateRequest) - m.SetBody(GenerateCreateRequestBody(empty)) + if !empty { + m.SetBody(GenerateCreateRequestBody(false)) + } + m.SetMetaHeader(GenerateRequestMetaHeader(empty)) m.SetVerificationHeader(GenerateRequestVerificationHeader(empty)) @@ -42,7 +44,10 @@ func GenerateCreateResponseBody(empty bool) *session.CreateResponseBody { func GenerateCreateResponse(empty bool) *session.CreateResponse { m := new(session.CreateResponse) - m.SetBody(GenerateCreateResponseBody(empty)) + if !empty { + m.SetBody(GenerateCreateResponseBody(false)) + } + m.SetMetaHeader(GenerateResponseMetaHeader(empty)) m.SetVerificationHeader(GenerateResponseVerificationHeader(empty)) @@ -56,7 +61,10 @@ func GenerateResponseVerificationHeader(empty bool) *session.ResponseVerificatio func generateResponseVerificationHeader(empty, withOrigin bool) *session.ResponseVerificationHeader { m := new(session.ResponseVerificationHeader) - m.SetBodySignature(refstest.GenerateSignature(empty)) + if !empty { + m.SetBodySignature(refstest.GenerateSignature(false)) + } + m.SetMetaSignature(refstest.GenerateSignature(empty)) m.SetOriginSignature(refstest.GenerateSignature(empty)) @@ -96,7 +104,10 @@ func GenerateRequestVerificationHeader(empty bool) *session.RequestVerificationH func generateRequestVerificationHeader(empty, withOrigin bool) *session.RequestVerificationHeader { m := new(session.RequestVerificationHeader) - m.SetBodySignature(refstest.GenerateSignature(empty)) + if !empty { + m.SetBodySignature(refstest.GenerateSignature(false)) + } + m.SetMetaSignature(refstest.GenerateSignature(empty)) m.SetOriginSignature(refstest.GenerateSignature(empty)) @@ -134,7 +145,10 @@ func generateRequestMetaHeader(empty, withOrigin bool) *session.RequestMetaHeade func GenerateSessionToken(empty bool) *session.SessionToken { m := new(session.SessionToken) - m.SetBody(GenerateSessionTokenBody(empty)) + if !empty { + m.SetBody(GenerateSessionTokenBody(false)) + } + m.SetSignature(refstest.GenerateSignature(empty)) return m @@ -146,12 +160,11 @@ func GenerateSessionTokenBody(empty bool) *session.SessionTokenBody { if !empty { m.SetID([]byte{1}) m.SetSessionKey([]byte{2}) + m.SetOwnerID(refstest.GenerateOwnerID(false)) + m.SetLifetime(GenerateTokenLifetime(false)) + m.SetContext(GenerateObjectSessionContext(false)) } - m.SetOwnerID(refstest.GenerateOwnerID(empty)) - m.SetLifetime(GenerateTokenLifetime(empty)) - m.SetContext(GenerateObjectSessionContext(empty)) - return m } @@ -172,10 +185,9 @@ func GenerateObjectSessionContext(empty bool) *session.ObjectSessionContext { if !empty { m.SetVerb(session.ObjectVerbHead) + m.SetAddress(refstest.GenerateAddress(false)) } - m.SetAddress(refstest.GenerateAddress(empty)) - return m } @@ -185,10 +197,9 @@ func GenerateContainerSessionContext(empty bool) *session.ContainerSessionContex if !empty { m.SetVerb(session.ContainerVerbDelete) m.SetWildcard(true) + m.SetContainerID(refstest.GenerateContainerID(false)) } - m.SetContainerID(refstest.GenerateContainerID(empty)) - return m } @@ -204,7 +215,7 @@ func GenerateXHeader(empty bool) *session.XHeader { } func GenerateXHeaders(empty bool) []*session.XHeader { - xs := make([]*session.XHeader, 0) + var xs []*session.XHeader if !empty { xs = append(xs, From 9dfc7e7fe9d9d11ed25648665d34f48815401d18 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Fri, 11 Jun 2021 15:45:04 +0300 Subject: [PATCH 0870/1196] [#307] v2/storagegroup/test: Do not allocate memory if `!empty` Move all memory allocation and field settings in `Generate...(empty bool)` functions behind `if !empty` check. Signed-off-by: Pavel Karpy --- v2/storagegroup/test/generate.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/v2/storagegroup/test/generate.go b/v2/storagegroup/test/generate.go index c8c67ba..048ec24 100644 --- a/v2/storagegroup/test/generate.go +++ b/v2/storagegroup/test/generate.go @@ -11,10 +11,10 @@ func GenerateStorageGroup(empty bool) *storagegroup.StorageGroup { if !empty { m.SetValidationDataSize(44) m.SetExpirationEpoch(55) + m.SetMembers(refstest.GenerateObjectIDs(false)) } m.SetValidationHash(refstest.GenerateChecksum(empty)) - m.SetMembers(refstest.GenerateObjectIDs(empty)) return m } From 86d446f54c057f5c45e0f51690fa1b26f69b1a67 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Fri, 11 Jun 2021 15:45:27 +0300 Subject: [PATCH 0871/1196] [#307] v2/tombstone/test: Do not allocate memory if `!empty` Move all memory allocation and field settings in `Generate...(empty bool)` functions behind `if !empty` check. Signed-off-by: Pavel Karpy --- v2/tombstone/test/generate.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/v2/tombstone/test/generate.go b/v2/tombstone/test/generate.go index 678323a..771f109 100644 --- a/v2/tombstone/test/generate.go +++ b/v2/tombstone/test/generate.go @@ -11,9 +11,8 @@ func GenerateTombstone(empty bool) *tombstone.Tombstone { if !empty { m.SetExpirationEpoch(89) m.SetSplitID([]byte{3, 2, 1}) + m.SetMembers(refstest.GenerateObjectIDs(false)) } - m.SetMembers(refstest.GenerateObjectIDs(empty)) - return m } From 8ea999357771723465a01607f3d88a6edafb582e Mon Sep 17 00:00:00 2001 From: Angira Kekteeva Date: Wed, 16 Jun 2021 22:04:14 +0300 Subject: [PATCH 0872/1196] [#309] pkg/session: Add marshal-unmarshal Added Marshal, Unmarshal, MarshalJSON, UnmarshalJSON methods to ContainerContext Signed-off-by: Angira Kekteeva --- pkg/session/container.go | 24 ++++++++++++++++++++++++ pkg/session/container_test.go | 25 +++++++++++++++++++++++++ 2 files changed, 49 insertions(+) diff --git a/pkg/session/container.go b/pkg/session/container.go index bcf5c3d..a3d2d91 100644 --- a/pkg/session/container.go +++ b/pkg/session/container.go @@ -113,3 +113,27 @@ func (x *ContainerContext) ForSetEACL() { func (x *ContainerContext) IsForSetEACL() bool { return x.isForVerb(session.ContainerVerbSetEACL) } + +// Marshal marshals ContainerContext into a protobuf binary form. +func (x *ContainerContext) Marshal(bs ...[]byte) ([]byte, error) { + var buf []byte + if len(bs) > 0 { + buf = bs[0] + } + return x.ToV2().StableMarshal(buf) +} + +// Unmarshal unmarshals protobuf binary representation of ContainerContext. +func (x *ContainerContext) Unmarshal(data []byte) error { + return x.ToV2().Unmarshal(data) +} + +// MarshalJSON encodes ContainerContext to protobuf JSON format. +func (x *ContainerContext) MarshalJSON() ([]byte, error) { + return x.ToV2().MarshalJSON() +} + +// UnmarshalJSON decodes ContainerContext from protobuf JSON format. +func (x *ContainerContext) UnmarshalJSON(data []byte) error { + return x.ToV2().UnmarshalJSON(data) +} diff --git a/pkg/session/container_test.go b/pkg/session/container_test.go index 6dd2c1f..38c97ee 100644 --- a/pkg/session/container_test.go +++ b/pkg/session/container_test.go @@ -5,6 +5,7 @@ import ( cidtest "github.com/nspcc-dev/neofs-api-go/pkg/container/id/test" "github.com/nspcc-dev/neofs-api-go/pkg/session" + sessiontest "github.com/nspcc-dev/neofs-api-go/pkg/session/test" v2session "github.com/nspcc-dev/neofs-api-go/v2/session" "github.com/stretchr/testify/require" ) @@ -85,3 +86,27 @@ func TestFilter_ToV2(t *testing.T) { require.Nil(t, cV2.ContainerID()) }) } + +func TestContainerContextEncoding(t *testing.T) { + c := sessiontest.ContainerContext() + + t.Run("binary", func(t *testing.T) { + data, err := c.Marshal() + require.NoError(t, err) + + c2 := session.NewContainerContext() + require.NoError(t, c2.Unmarshal(data)) + + require.Equal(t, c, c2) + }) + + t.Run("json", func(t *testing.T) { + data, err := c.MarshalJSON() + require.NoError(t, err) + + c2 := session.NewContainerContext() + require.NoError(t, c2.UnmarshalJSON(data)) + + require.Equal(t, c, c2) + }) +} From fdea892db7bcbe50e9093570b945f9b63e742c32 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 22 Jun 2021 12:43:28 +0300 Subject: [PATCH 0873/1196] [#313] client/object: Add payload-handling parameter to GetObjectParams Define `ReaderHandler` type. Add `GetObjectParams.WithPayloadReaderHandler` method which accepts `ReaderHandler`. The handler is called right after header receipt in `Client.GetObject`. After the handler is called, `GetObject` returns object header immediately. Signed-off-by: Leonard Lyubich --- pkg/client/object.go | 83 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) diff --git a/pkg/client/object.go b/pkg/client/object.go index 5f178af..2a962b8 100644 --- a/pkg/client/object.go +++ b/pkg/client/object.go @@ -75,6 +75,8 @@ type GetObjectParams struct { raw bool w io.Writer + + readerHandler ReaderHandler } type ObjectHeaderParams struct { @@ -475,6 +477,78 @@ func (p *GetObjectParams) RawFlag() bool { return false } +// ReaderHandler is a function over io.Reader. +type ReaderHandler func(io.Reader) + +// WithPayloadReaderHandler sets handler of the payload reader. +// +// If provided, payload reader is composed after receiving the header. +// In this case payload writer set via WithPayloadWriter is ignored. +// +// Handler should not be nil. +func (p *GetObjectParams) WithPayloadReaderHandler(f ReaderHandler) *GetObjectParams { + if p != nil { + p.readerHandler = f + } + + return p +} + +// wrapper over the Object Get stream that provides io.Reader. +type objectPayloadReader struct { + stream *rpcapi.GetResponseReader + + resp v2object.GetResponse + + tail []byte +} + +func (x *objectPayloadReader) Read(p []byte) (int, error) { + // read remaining tail + read := copy(p, x.tail) + + x.tail = x.tail[read:] + + if len(p)-read == 0 { + return read, nil + } + + // receive message from server stream + err := x.stream.Read(&x.resp) + if err != nil { + if errors.Is(err, io.EOF) { + return 0, io.EOF + } + + return 0, fmt.Errorf("reading the response failed: %w", err) + } + + // get chunk part message + part := x.resp.GetBody().GetObjectPart() + + chunkPart, ok := part.(*v2object.GetObjectPartChunk) + if !ok { + return 0, errWrongMessageSeq + } + + // verify response structure + if err := signature.VerifyServiceMessage(&x.resp); err != nil { + return 0, fmt.Errorf("response verification failed: %w", err) + } + + // read new chunk + chunk := chunkPart.GetChunk() + + tailOffset := copy(p[read:], chunk) + + read += tailOffset + + // save the tail + x.tail = append(x.tail, chunk[tailOffset:]...) + + return read, nil +} + var errWrongMessageSeq = errors.New("incorrect message sequence") func (c *clientImpl) GetObject(ctx context.Context, p *GetObjectParams, opts ...CallOption) (*object.Object, error) { @@ -527,6 +601,7 @@ func (c *clientImpl) GetObject(ctx context.Context, p *GetObjectParams, opts ... resp = new(v2object.GetResponse) ) +loop: for { // receive message from server stream err := stream.Read(resp) @@ -563,6 +638,14 @@ func (c *clientImpl) GetObject(ctx context.Context, p *GetObjectParams, opts ... hdr := v.GetHeader() obj.SetHeader(hdr) + if p.readerHandler != nil { + p.readerHandler(&objectPayloadReader{ + stream: stream, + }) + + break loop + } + if p.w == nil { payload = make([]byte, 0, hdr.GetPayloadLength()) } From 616b4b71a1bba475df12f11561f4e4c9cfcdee54 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 18 Jun 2021 15:27:01 +0300 Subject: [PATCH 0874/1196] [#310] *: Implement string converters for enumerations Implement `String` / `FromString` method pair in all levels of enum definitions. From now `String()` returns canonical protojson-compatible values. Signed-off-by: Leonard Lyubich --- pkg/acl/eacl/enums.go | 136 +++++++++++++++++++++++++++++++++++ pkg/acl/eacl/enums_test.go | 96 +++++++++++++++++++++++++ pkg/checksum.go | 44 ++++++++++++ pkg/checksum_test.go | 42 +++++++++++ pkg/netmap/clause.go | 31 +++++--- pkg/netmap/clause_test.go | 12 ++++ pkg/netmap/helper_test.go | 36 ++++++++++ pkg/netmap/node_info.go | 29 ++++++-- pkg/netmap/node_info_test.go | 12 ++++ pkg/netmap/operation.go | 49 +++++++------ pkg/netmap/operation_test.go | 18 +++++ pkg/object/search.go | 27 +++++++ pkg/object/search_test.go | 13 ++++ pkg/object/type.go | 33 +++++++-- pkg/object/type_test.go | 65 ++++++++++++----- v2/acl/grpc/types.go | 65 +++++++++++++++++ v2/acl/string.go | 110 ++++++++++++++++++++++++++++ v2/netmap/grpc/types.go | 39 ++++++++++ v2/netmap/string.go | 68 ++++++++++++++++++ v2/object/grpc/types.go | 26 +++++++ v2/object/string.go | 66 +++++++++++------ v2/refs/grpc/types.go | 13 ++++ v2/refs/string.go | 26 +++++++ v2/session/grpc/types.go | 26 +++++++ v2/session/string.go | 47 ++++++++++++ 25 files changed, 1053 insertions(+), 76 deletions(-) create mode 100644 v2/acl/string.go create mode 100644 v2/netmap/string.go create mode 100644 v2/refs/string.go create mode 100644 v2/session/string.go diff --git a/pkg/acl/eacl/enums.go b/pkg/acl/eacl/enums.go index 19fa5b9..39a4253 100644 --- a/pkg/acl/eacl/enums.go +++ b/pkg/acl/eacl/enums.go @@ -124,6 +124,32 @@ func ActionFromV2(action v2acl.Action) (a Action) { return a } +// String returns string representation of Action. +// +// String mapping: +// * ActionAllow: ALLOW; +// * ActionDeny: DENY; +// * ActionUnknown, default: ACTION_UNSPECIFIED. +func (a Action) String() string { + return a.ToV2().String() +} + +// FromString parses Action from a string representation. +// It is a reverse action to String(). +// +// Returns true if s was parsed successfully. +func (a *Action) FromString(s string) bool { + var g v2acl.Action + + ok := g.FromString(s) + + if ok { + *a = ActionFromV2(g) + } + + return ok +} + // ToV2 converts Operation to v2 Operation enum value. func (o Operation) ToV2() v2acl.Operation { switch o { @@ -170,6 +196,37 @@ func OperationFromV2(operation v2acl.Operation) (o Operation) { return o } +// String returns string representation of Operation. +// +// String mapping: +// * OperationGet: GET; +// * OperationHead: HEAD; +// * OperationPut: PUT; +// * OperationDelete: DELETE; +// * OperationSearch: SEARCH; +// * OperationRange: GETRANGE; +// * OperationRangeHash: GETRANGEHASH; +// * OperationUnknown, default: OPERATION_UNSPECIFIED. +func (o Operation) String() string { + return o.ToV2().String() +} + +// FromString parses Operation from a string representation. +// It is a reverse action to String(). +// +// Returns true if s was parsed successfully. +func (o *Operation) FromString(s string) bool { + var g v2acl.Operation + + ok := g.FromString(s) + + if ok { + *o = OperationFromV2(g) + } + + return ok +} + // ToV2 converts Role to v2 Role enum value. func (r Role) ToV2() v2acl.Role { switch r { @@ -200,6 +257,33 @@ func RoleFromV2(role v2acl.Role) (r Role) { return r } +// String returns string representation of Role. +// +// String mapping: +// * RoleUser: USER; +// * RoleSystem: SYSTEM; +// * RoleOthers: OTHERS; +// * RoleUnknown, default: ROLE_UNKNOWN. +func (r Role) String() string { + return r.ToV2().String() +} + +// FromString parses Role from a string representation. +// It is a reverse action to String(). +// +// Returns true if s was parsed successfully. +func (r *Role) FromString(s string) bool { + var g v2acl.Role + + ok := g.FromString(s) + + if ok { + *r = RoleFromV2(g) + } + + return ok +} + // ToV2 converts Match to v2 MatchType enum value. func (m Match) ToV2() v2acl.MatchType { switch m { @@ -226,6 +310,32 @@ func MatchFromV2(match v2acl.MatchType) (m Match) { return m } +// String returns string representation of Match. +// +// String mapping: +// * MatchStringEqual: STRING_EQUAL; +// * MatchStringNotEqual: STRING_NOT_EQUAL; +// * MatchUnknown, default: MATCH_TYPE_UNSPECIFIED. +func (m Match) String() string { + return m.ToV2().String() +} + +// FromString parses Match from a string representation. +// It is a reverse action to String(). +// +// Returns true if s was parsed successfully. +func (m *Match) FromString(s string) bool { + var g v2acl.MatchType + + ok := g.FromString(s) + + if ok { + *m = MatchFromV2(g) + } + + return ok +} + // ToV2 converts FilterHeaderType to v2 HeaderType enum value. func (h FilterHeaderType) ToV2() v2acl.HeaderType { switch h { @@ -251,3 +361,29 @@ func FilterHeaderTypeFromV2(header v2acl.HeaderType) (h FilterHeaderType) { return h } + +// String returns string representation of FilterHeaderType. +// +// String mapping: +// * HeaderFromRequest: REQUEST; +// * HeaderFromObject: OBJECT; +// * HeaderTypeUnknown, default: HEADER_UNSPECIFIED. +func (h FilterHeaderType) String() string { + return h.ToV2().String() +} + +// FromString parses FilterHeaderType from a string representation. +// It is a reverse action to String(). +// +// Returns true if s was parsed successfully. +func (h *FilterHeaderType) FromString(s string) bool { + var g v2acl.HeaderType + + ok := g.FromString(s) + + if ok { + *h = FilterHeaderTypeFromV2(g) + } + + return ok +} diff --git a/pkg/acl/eacl/enums_test.go b/pkg/acl/eacl/enums_test.go index 11f2224..5352849 100644 --- a/pkg/acl/eacl/enums_test.go +++ b/pkg/acl/eacl/enums_test.go @@ -115,3 +115,99 @@ func TestFilterHeaderType(t *testing.T) { require.Equal(t, eacl.FilterHeaderTypeFromV2(v2acl.HeaderTypeObject+1), eacl.HeaderTypeUnknown) }) } + +type enumIface interface { + FromString(string) bool + String() string +} + +type enumStringItem struct { + val enumIface + str string +} + +func testEnumStrings(t *testing.T, e enumIface, items []enumStringItem) { + for _, item := range items { + require.Equal(t, item.str, item.val.String()) + + s := item.val.String() + + require.True(t, e.FromString(s), s) + + require.EqualValues(t, item.val, e, item.val) + } + + // incorrect strings + for _, str := range []string{ + "some string", + "UNSPECIFIED", + } { + require.False(t, e.FromString(str)) + } +} + +func TestAction_String(t *testing.T) { + toPtr := func(v eacl.Action) *eacl.Action { + return &v + } + + testEnumStrings(t, new(eacl.Action), []enumStringItem{ + {val: toPtr(eacl.ActionAllow), str: "ALLOW"}, + {val: toPtr(eacl.ActionDeny), str: "DENY"}, + {val: toPtr(eacl.ActionUnknown), str: "ACTION_UNSPECIFIED"}, + }) +} + +func TestRole_String(t *testing.T) { + toPtr := func(v eacl.Role) *eacl.Role { + return &v + } + + testEnumStrings(t, new(eacl.Role), []enumStringItem{ + {val: toPtr(eacl.RoleUser), str: "USER"}, + {val: toPtr(eacl.RoleSystem), str: "SYSTEM"}, + {val: toPtr(eacl.RoleOthers), str: "OTHERS"}, + {val: toPtr(eacl.RoleUnknown), str: "ROLE_UNSPECIFIED"}, + }) +} + +func TestOperation_String(t *testing.T) { + toPtr := func(v eacl.Operation) *eacl.Operation { + return &v + } + + testEnumStrings(t, new(eacl.Operation), []enumStringItem{ + {val: toPtr(eacl.OperationGet), str: "GET"}, + {val: toPtr(eacl.OperationPut), str: "PUT"}, + {val: toPtr(eacl.OperationHead), str: "HEAD"}, + {val: toPtr(eacl.OperationDelete), str: "DELETE"}, + {val: toPtr(eacl.OperationSearch), str: "SEARCH"}, + {val: toPtr(eacl.OperationRange), str: "GETRANGE"}, + {val: toPtr(eacl.OperationRangeHash), str: "GETRANGEHASH"}, + {val: toPtr(eacl.OperationUnknown), str: "OPERATION_UNSPECIFIED"}, + }) +} + +func TestMatch_String(t *testing.T) { + toPtr := func(v eacl.Match) *eacl.Match { + return &v + } + + testEnumStrings(t, new(eacl.Match), []enumStringItem{ + {val: toPtr(eacl.MatchStringEqual), str: "STRING_EQUAL"}, + {val: toPtr(eacl.MatchStringNotEqual), str: "STRING_NOT_EQUAL"}, + {val: toPtr(eacl.MatchUnknown), str: "MATCH_TYPE_UNSPECIFIED"}, + }) +} + +func TestFilterHeaderType_String(t *testing.T) { + toPtr := func(v eacl.FilterHeaderType) *eacl.FilterHeaderType { + return &v + } + + testEnumStrings(t, new(eacl.FilterHeaderType), []enumStringItem{ + {val: toPtr(eacl.HeaderFromRequest), str: "REQUEST"}, + {val: toPtr(eacl.HeaderFromObject), str: "OBJECT"}, + {val: toPtr(eacl.HeaderTypeUnknown), str: "HEADER_UNSPECIFIED"}, + }) +} diff --git a/pkg/checksum.go b/pkg/checksum.go index 5d244b9..b02ae0d 100644 --- a/pkg/checksum.go +++ b/pkg/checksum.go @@ -152,3 +152,47 @@ func (c *Checksum) Parse(s string) error { return nil } + +// String returns string representation of ChecksumType. +// +// String mapping: +// * ChecksumTZ: TZ; +// * ChecksumSHA256: SHA256; +// * ChecksumUnknown, default: CHECKSUM_TYPE_UNSPECIFIED. +func (m ChecksumType) String() string { + var m2 refs.ChecksumType + + switch m { + default: + m2 = refs.UnknownChecksum + case ChecksumTZ: + m2 = refs.TillichZemor + case ChecksumSHA256: + m2 = refs.SHA256 + } + + return m2.String() +} + +// FromString parses ChecksumType from a string representation. +// It is a reverse action to String(). +// +// Returns true if s was parsed successfully. +func (m *ChecksumType) FromString(s string) bool { + var g refs.ChecksumType + + ok := g.FromString(s) + + if ok { + switch g { + default: + *m = ChecksumUnknown + case refs.TillichZemor: + *m = ChecksumTZ + case refs.SHA256: + *m = ChecksumSHA256 + } + } + + return ok +} diff --git a/pkg/checksum_test.go b/pkg/checksum_test.go index e0508b8..b5a0600 100644 --- a/pkg/checksum_test.go +++ b/pkg/checksum_test.go @@ -131,3 +131,45 @@ func TestNewChecksum(t *testing.T) { require.Nil(t, chsV2.GetSum()) }) } + +type enumIface interface { + FromString(string) bool + String() string +} + +type enumStringItem struct { + val enumIface + str string +} + +func testEnumStrings(t *testing.T, e enumIface, items []enumStringItem) { + for _, item := range items { + require.Equal(t, item.str, item.val.String()) + + s := item.val.String() + + require.True(t, e.FromString(s), s) + + require.EqualValues(t, item.val, e, item.val) + } + + // incorrect strings + for _, str := range []string{ + "some string", + "undefined", + } { + require.False(t, e.FromString(str)) + } +} + +func TestChecksumType_String(t *testing.T) { + toPtr := func(v ChecksumType) *ChecksumType { + return &v + } + + testEnumStrings(t, new(ChecksumType), []enumStringItem{ + {val: toPtr(ChecksumTZ), str: "TZ"}, + {val: toPtr(ChecksumSHA256), str: "SHA256"}, + {val: toPtr(ChecksumUnknown), str: "CHECKSUM_TYPE_UNSPECIFIED"}, + }) +} diff --git a/pkg/netmap/clause.go b/pkg/netmap/clause.go index 37ea3a0..d2b5c40 100644 --- a/pkg/netmap/clause.go +++ b/pkg/netmap/clause.go @@ -42,13 +42,28 @@ func (c Clause) ToV2() netmap.Clause { } } +// String returns string representation of Clause. +// +// String mapping: +// * ClauseDistinct: DISTINCT; +// * ClauseSame: SAME; +// * ClauseUnspecified, default: CLAUSE_UNSPECIFIED. func (c Clause) String() string { - switch c { - default: - return "CLAUSE_UNSPECIFIED" - case ClauseDistinct: - return "DISTINCT" - case ClauseSame: - return "SAME" - } + return c.ToV2().String() +} + +// FromString parses Clause from a string representation. +// It is a reverse action to String(). +// +// Returns true if s was parsed successfully. +func (c *Clause) FromString(s string) bool { + var g netmap.Clause + + ok := g.FromString(s) + + if ok { + *c = ClauseFromV2(g) + } + + return ok } diff --git a/pkg/netmap/clause_test.go b/pkg/netmap/clause_test.go index b30d89b..6ce5e82 100644 --- a/pkg/netmap/clause_test.go +++ b/pkg/netmap/clause_test.go @@ -29,3 +29,15 @@ func TestClauseFromV2(t *testing.T) { require.Equal(t, item.cV2, item.c.ToV2()) } } + +func TestClause_String(t *testing.T) { + toPtr := func(v Clause) *Clause { + return &v + } + + testEnumStrings(t, new(Clause), []enumStringItem{ + {val: toPtr(ClauseDistinct), str: "DISTINCT"}, + {val: toPtr(ClauseSame), str: "SAME"}, + {val: toPtr(ClauseUnspecified), str: "CLAUSE_UNSPECIFIED"}, + }) +} diff --git a/pkg/netmap/helper_test.go b/pkg/netmap/helper_test.go index 35df5b5..73b82ae 100644 --- a/pkg/netmap/helper_test.go +++ b/pkg/netmap/helper_test.go @@ -1,5 +1,11 @@ package netmap +import ( + "testing" + + "github.com/stretchr/testify/require" +) + func newFilter(name string, k, v string, op Operation, fs ...*Filter) *Filter { f := NewFilter() f.SetName(name) @@ -55,3 +61,33 @@ func getTestNode(props ...string) *Node { } return &Node{AttrMap: m} } + +type enumIface interface { + FromString(string) bool + String() string +} + +type enumStringItem struct { + val enumIface + str string +} + +func testEnumStrings(t *testing.T, e enumIface, items []enumStringItem) { + for _, item := range items { + require.Equal(t, item.str, item.val.String()) + + s := item.val.String() + + require.True(t, e.FromString(s), s) + + require.EqualValues(t, item.val, e, item.val) + } + + // incorrect strings + for _, str := range []string{ + "some string", + "undefined", + } { + require.False(t, e.FromString(str)) + } +} diff --git a/pkg/netmap/node_info.go b/pkg/netmap/node_info.go index cd81358..35f1617 100644 --- a/pkg/netmap/node_info.go +++ b/pkg/netmap/node_info.go @@ -176,15 +176,30 @@ func (s NodeState) ToV2() netmap.NodeState { } } +// String returns string representation of NodeState. +// +// String mapping: +// * NodeStateOnline: ONLINE; +// * NodeStateOffline: OFFLINE; +// * default: UNSPECIFIED. func (s NodeState) String() string { - switch s { - default: - return "STATE_UNSPECIFIED" - case NodeStateOffline: - return "OFFLINE" - case NodeStateOnline: - return "ONLINE" + return s.ToV2().String() +} + +// FromString parses NodeState from a string representation. +// It is a reverse action to String(). +// +// Returns true if s was parsed successfully. +func (s *NodeState) FromString(str string) bool { + var g netmap.NodeState + + ok := g.FromString(str) + + if ok { + *s = NodeStateFromV2(g) } + + return ok } // NewNodeAttribute creates and returns new NodeAttribute instance. diff --git a/pkg/netmap/node_info_test.go b/pkg/netmap/node_info_test.go index e380561..5d09a59 100644 --- a/pkg/netmap/node_info_test.go +++ b/pkg/netmap/node_info_test.go @@ -240,3 +240,15 @@ func TestNewNodeInfo(t *testing.T) { require.EqualValues(t, netmap.UnspecifiedState, niV2.GetState()) }) } + +func TestNodeState_String(t *testing.T) { + toPtr := func(v NodeState) *NodeState { + return &v + } + + testEnumStrings(t, new(NodeState), []enumStringItem{ + {val: toPtr(NodeStateOnline), str: "ONLINE"}, + {val: toPtr(NodeStateOffline), str: "OFFLINE"}, + {val: toPtr(0), str: "UNSPECIFIED"}, + }) +} diff --git a/pkg/netmap/operation.go b/pkg/netmap/operation.go index dd388ff..af3e042 100644 --- a/pkg/netmap/operation.go +++ b/pkg/netmap/operation.go @@ -83,25 +83,34 @@ func (op Operation) ToV2() netmap.Operation { } } +// String returns string representation of Operation. +// +// String mapping: +// * OpNE: NE; +// * OpEQ: EQ; +// * OpLT: LT; +// * OpLE: LE; +// * OpGT: GT; +// * OpGE: GE; +// * OpAND: AND; +// * OpOR: OR; +// * default: OPERATION_UNSPECIFIED. func (op Operation) String() string { - switch op { - default: - return "OPERATION_UNSPECIFIED" - case OpNE: - return "NE" - case OpEQ: - return "EQ" - case OpLT: - return "LT" - case OpLE: - return "LE" - case OpGT: - return "GT" - case OpGE: - return "GE" - case OpAND: - return "AND" - case OpOR: - return "OR" - } + return op.ToV2().String() +} + +// FromString parses Operation from a string representation. +// It is a reverse action to String(). +// +// Returns true if s was parsed successfully. +func (op *Operation) FromString(s string) bool { + var g netmap.Operation + + ok := g.FromString(s) + + if ok { + *op = OperationFromV2(g) + } + + return ok } diff --git a/pkg/netmap/operation_test.go b/pkg/netmap/operation_test.go index c60479b..e8b74e3 100644 --- a/pkg/netmap/operation_test.go +++ b/pkg/netmap/operation_test.go @@ -53,3 +53,21 @@ func TestOperationFromV2(t *testing.T) { require.Equal(t, item.opV2, item.op.ToV2()) } } + +func TestOperation_String(t *testing.T) { + toPtr := func(v Operation) *Operation { + return &v + } + + testEnumStrings(t, new(Operation), []enumStringItem{ + {val: toPtr(OpEQ), str: "EQ"}, + {val: toPtr(OpNE), str: "NE"}, + {val: toPtr(OpGT), str: "GT"}, + {val: toPtr(OpGE), str: "GE"}, + {val: toPtr(OpLT), str: "LT"}, + {val: toPtr(OpLE), str: "LE"}, + {val: toPtr(OpAND), str: "AND"}, + {val: toPtr(OpOR), str: "OR"}, + {val: toPtr(0), str: "OPERATION_UNSPECIFIED"}, + }) +} diff --git a/pkg/object/search.go b/pkg/object/search.go index 9622ec2..438d0aa 100644 --- a/pkg/object/search.go +++ b/pkg/object/search.go @@ -48,6 +48,33 @@ func SearchMatchFromV2(t v2object.MatchType) (m SearchMatchType) { return m } +// String returns string representation of SearchMatchType. +// +// String mapping: +// * MatchStringEqual: STRING_EQUAL; +// * MatchStringNotEqual: STRING_NOT_EQUAL; +// * MatchNotPresent: NOT_PRESENT; +// * MatchUnknown, default: MATCH_TYPE_UNSPECIFIED. +func (m SearchMatchType) String() string { + return m.ToV2().String() +} + +// FromString parses SearchMatchType from a string representation. +// It is a reverse action to String(). +// +// Returns true if s was parsed successfully. +func (m *SearchMatchType) FromString(s string) bool { + var g v2object.MatchType + + ok := g.FromString(s) + + if ok { + *m = SearchMatchFromV2(g) + } + + return ok +} + type SearchFilter struct { header filterKey value fmt.Stringer diff --git a/pkg/object/search_test.go b/pkg/object/search_test.go index 62cca9b..36870bb 100644 --- a/pkg/object/search_test.go +++ b/pkg/object/search_test.go @@ -192,3 +192,16 @@ func TestSearchFiltersEncoding(t *testing.T) { require.Equal(t, fs, fs2) }) } + +func TestSearchMatchType_String(t *testing.T) { + toPtr := func(v object.SearchMatchType) *object.SearchMatchType { + return &v + } + + testEnumStrings(t, new(object.SearchMatchType), []enumStringItem{ + {val: toPtr(object.MatchStringEqual), str: "STRING_EQUAL"}, + {val: toPtr(object.MatchStringNotEqual), str: "STRING_NOT_EQUAL"}, + {val: toPtr(object.MatchNotPresent), str: "NOT_PRESENT"}, + {val: toPtr(object.MatchUnknown), str: "MATCH_TYPE_UNSPECIFIED"}, + }) +} diff --git a/pkg/object/type.go b/pkg/object/type.go index fde1aaa..82d7c00 100644 --- a/pkg/object/type.go +++ b/pkg/object/type.go @@ -34,13 +34,36 @@ func TypeFromV2(t object.Type) Type { } } +// String returns string representation of Type. +// +// String mapping: +// * TypeTombstone: TOMBSTONE; +// * TypeStorageGroup: STORAGE_GROUP; +// * TypeRegular, default: REGULAR. func (t Type) String() string { return t.ToV2().String() } -// TypeFromString parses Type from its string representation. -func TypeFromString(s string) Type { - return TypeFromV2( - object.TypeFromString(s), - ) +// FromString parses Type from a string representation. +// It is a reverse action to String(). +// +// Returns true if s was parsed successfully. +func (t *Type) FromString(s string) bool { + var g object.Type + + ok := g.FromString(s) + + if ok { + *t = TypeFromV2(g) + } + + return ok +} + +// TypeFromString parses Type from its string representation. +// +// Deprecated: use FromString method. +func TypeFromString(s string) (t Type) { + t.FromString(s) + return } diff --git a/pkg/object/type_test.go b/pkg/object/type_test.go index 7ade2ef..cb8a268 100644 --- a/pkg/object/type_test.go +++ b/pkg/object/type_test.go @@ -1,28 +1,29 @@ -package object +package object_test import ( "testing" - "github.com/nspcc-dev/neofs-api-go/v2/object" + "github.com/nspcc-dev/neofs-api-go/pkg/object" + v2object "github.com/nspcc-dev/neofs-api-go/v2/object" "github.com/stretchr/testify/require" ) func TestType_ToV2(t *testing.T) { typs := []struct { - t Type - t2 object.Type + t object.Type + t2 v2object.Type }{ { - t: TypeRegular, - t2: object.TypeRegular, + t: object.TypeRegular, + t2: v2object.TypeRegular, }, { - t: TypeTombstone, - t2: object.TypeTombstone, + t: object.TypeTombstone, + t2: v2object.TypeTombstone, }, { - t: TypeStorageGroup, - t2: object.TypeStorageGroup, + t: object.TypeStorageGroup, + t2: v2object.TypeStorageGroup, }, } @@ -31,16 +32,48 @@ func TestType_ToV2(t *testing.T) { require.Equal(t, item.t2, t2) - require.Equal(t, item.t, TypeFromV2(item.t2)) + require.Equal(t, item.t, object.TypeFromV2(item.t2)) } } func TestType_String(t *testing.T) { - for _, typ := range []Type{ - TypeRegular, - TypeTombstone, - TypeStorageGroup, + toPtr := func(v object.Type) *object.Type { + return &v + } + + testEnumStrings(t, new(object.Type), []enumStringItem{ + {val: toPtr(object.TypeTombstone), str: "TOMBSTONE"}, + {val: toPtr(object.TypeStorageGroup), str: "STORAGE_GROUP"}, + {val: toPtr(object.TypeRegular), str: "REGULAR"}, + }) +} + +type enumIface interface { + FromString(string) bool + String() string +} + +type enumStringItem struct { + val enumIface + str string +} + +func testEnumStrings(t *testing.T, e enumIface, items []enumStringItem) { + for _, item := range items { + require.Equal(t, item.str, item.val.String()) + + s := item.val.String() + + require.True(t, e.FromString(s), s) + + require.EqualValues(t, item.val, e, item.val) + } + + // incorrect strings + for _, str := range []string{ + "some string", + "undefined", } { - require.Equal(t, typ, TypeFromString(typ.String())) + require.False(t, e.FromString(str)) } } diff --git a/v2/acl/grpc/types.go b/v2/acl/grpc/types.go index bfb28ed..cc9b48b 100644 --- a/v2/acl/grpc/types.go +++ b/v2/acl/grpc/types.go @@ -150,3 +150,68 @@ func (m *BearerToken_Body_TokenLifetime) SetIat(v uint64) { m.Iat = v } } + +// FromString parses Action from a string representation, +// It is a reverse action to String(). +// +// Returns true if s was parsed successfully. +func (x *Action) FromString(s string) bool { + i, ok := Action_value[s] + if ok { + *x = Action(i) + } + + return ok +} + +// FromString parses Role from a string representation, +// It is a reverse action to String(). +// +// Returns true if s was parsed successfully. +func (x *Role) FromString(s string) bool { + i, ok := Role_value[s] + if ok { + *x = Role(i) + } + + return ok +} + +// FromString parses Operation from a string representation, +// It is a reverse action to String(). +// +// Returns true if s was parsed successfully. +func (x *Operation) FromString(s string) bool { + i, ok := Operation_value[s] + if ok { + *x = Operation(i) + } + + return ok +} + +// FromString parses MatchType from a string representation, +// It is a reverse action to String(). +// +// Returns true if s was parsed successfully. +func (x *MatchType) FromString(s string) bool { + i, ok := MatchType_value[s] + if ok { + *x = MatchType(i) + } + + return ok +} + +// FromString parses HeaderType from a string representation, +// It is a reverse action to String(). +// +// Returns true if s was parsed successfully. +func (x *HeaderType) FromString(s string) bool { + i, ok := HeaderType_value[s] + if ok { + *x = HeaderType(i) + } + + return ok +} diff --git a/v2/acl/string.go b/v2/acl/string.go new file mode 100644 index 0000000..1968f5d --- /dev/null +++ b/v2/acl/string.go @@ -0,0 +1,110 @@ +package acl + +import ( + acl "github.com/nspcc-dev/neofs-api-go/v2/acl/grpc" +) + +// String returns string representation of Action. +func (x Action) String() string { + return ActionToGRPCField(x).String() +} + +// FromString parses Action from a string representation. +// It is a reverse action to String(). +// +// Returns true if s was parsed successfully. +func (x *Action) FromString(s string) bool { + var g acl.Action + + ok := g.FromString(s) + + if ok { + *x = ActionFromGRPCField(g) + } + + return ok +} + +// String returns string representation of Role. +func (x Role) String() string { + return RoleToGRPCField(x).String() +} + +// FromString parses Role from a string representation. +// It is a reverse action to String(). +// +// Returns true if s was parsed successfully. +func (x *Role) FromString(s string) bool { + var g acl.Role + + ok := g.FromString(s) + + if ok { + *x = RoleFromGRPCField(g) + } + + return ok +} + +// String returns string representation of Operation. +func (x Operation) String() string { + return OperationToGRPCField(x).String() +} + +// FromString parses Operation from a string representation. +// It is a reverse action to String(). +// +// Returns true if s was parsed successfully. +func (x *Operation) FromString(s string) bool { + var g acl.Operation + + ok := g.FromString(s) + + if ok { + *x = OperationFromGRPCField(g) + } + + return ok +} + +// String returns string representation of MatchType. +func (x MatchType) String() string { + return MatchTypeToGRPCField(x).String() +} + +// FromString parses MatchType from a string representation. +// It is a reverse action to String(). +// +// Returns true if s was parsed successfully. +func (x *MatchType) FromString(s string) bool { + var g acl.MatchType + + ok := g.FromString(s) + + if ok { + *x = MatchTypeFromGRPCField(g) + } + + return ok +} + +// String returns string representation of HeaderType. +func (x HeaderType) String() string { + return HeaderTypeToGRPCField(x).String() +} + +// FromString parses HeaderType from a string representation. +// It is a reverse action to String(). +// +// Returns true if s was parsed successfully. +func (x *HeaderType) FromString(s string) bool { + var g acl.HeaderType + + ok := g.FromString(s) + + if ok { + *x = HeaderTypeFromGRPCField(g) + } + + return ok +} diff --git a/v2/netmap/grpc/types.go b/v2/netmap/grpc/types.go index d3e2120..4340d19 100644 --- a/v2/netmap/grpc/types.go +++ b/v2/netmap/grpc/types.go @@ -174,3 +174,42 @@ func (x *NetworkInfo) SetMagicNumber(v uint64) { x.MagicNumber = v } } + +// FromString parses Clause from a string representation, +// It is a reverse action to String(). +// +// Returns true if s was parsed successfully. +func (x *Clause) FromString(s string) bool { + i, ok := Clause_value[s] + if ok { + *x = Clause(i) + } + + return ok +} + +// FromString parses Operation from a string representation, +// It is a reverse action to String(). +// +// Returns true if s was parsed successfully. +func (x *Operation) FromString(s string) bool { + i, ok := Operation_value[s] + if ok { + *x = Operation(i) + } + + return ok +} + +// FromString parses NodeInfo_State from a string representation, +// It is a reverse action to String(). +// +// Returns true if s was parsed successfully. +func (x *NodeInfo_State) FromString(s string) bool { + i, ok := NodeInfo_State_value[s] + if ok { + *x = NodeInfo_State(i) + } + + return ok +} diff --git a/v2/netmap/string.go b/v2/netmap/string.go new file mode 100644 index 0000000..11ab18c --- /dev/null +++ b/v2/netmap/string.go @@ -0,0 +1,68 @@ +package netmap + +import ( + netmap "github.com/nspcc-dev/neofs-api-go/v2/netmap/grpc" +) + +// String returns string representation of Clause. +func (x Clause) String() string { + return ClauseToGRPCMessage(x).String() +} + +// FromString parses Clause from a string representation. +// It is a reverse action to String(). +// +// Returns true if s was parsed successfully. +func (x *Clause) FromString(s string) bool { + var g netmap.Clause + + ok := g.FromString(s) + + if ok { + *x = ClauseFromGRPCMessage(g) + } + + return ok +} + +// String returns string representation of Operation. +func (x Operation) String() string { + return OperationToGRPCMessage(x).String() +} + +// FromString parses Operation from a string representation. +// It is a reverse action to String(). +// +// Returns true if s was parsed successfully. +func (x *Operation) FromString(s string) bool { + var g netmap.Operation + + ok := g.FromString(s) + + if ok { + *x = OperationFromGRPCMessage(g) + } + + return ok +} + +// String returns string representation of NodeState. +func (x NodeState) String() string { + return NodeStateToGRPCMessage(x).String() +} + +// FromString parses NodeState from a string representation. +// It is a reverse action to String(). +// +// Returns true if s was parsed successfully. +func (x *NodeState) FromString(s string) bool { + var g netmap.NodeInfo_State + + ok := g.FromString(s) + + if ok { + *x = NodeStateFromRPCMessage(g) + } + + return ok +} diff --git a/v2/object/grpc/types.go b/v2/object/grpc/types.go index 9d86393..28eafb7 100644 --- a/v2/object/grpc/types.go +++ b/v2/object/grpc/types.go @@ -235,3 +235,29 @@ func (m *SplitInfo) SetLink(v *refs.ObjectID) { m.Link = v } } + +// FromString parses ObjectType from a string representation, +// It is a reverse action to String(). +// +// Returns true if s was parsed successfully. +func (x *ObjectType) FromString(s string) bool { + i, ok := ObjectType_value[s] + if ok { + *x = ObjectType(i) + } + + return ok +} + +// FromString parses MatchType from a string representation, +// It is a reverse action to String(). +// +// Returns true if s was parsed successfully. +func (x *MatchType) FromString(s string) bool { + i, ok := MatchType_value[s] + if ok { + *x = MatchType(i) + } + + return ok +} diff --git a/v2/object/string.go b/v2/object/string.go index ad82a12..3191e31 100644 --- a/v2/object/string.go +++ b/v2/object/string.go @@ -1,29 +1,55 @@ package object -const ( - typeRegularString = "Regular" - typeTombstoneString = "Tombstone" - typeStorageGroupString = "StorageGroup" +import ( + object "github.com/nspcc-dev/neofs-api-go/v2/object/grpc" ) +// String returns string representation of Type. func (t Type) String() string { - switch t { - default: - return typeRegularString - case TypeTombstone: - return typeTombstoneString - case TypeStorageGroup: - return typeStorageGroupString - } + return TypeToGRPCField(t).String() } -func TypeFromString(s string) Type { - switch s { - default: - return TypeRegular - case typeTombstoneString: - return TypeTombstone - case typeStorageGroupString: - return TypeStorageGroup +// FromString parses Type from a string representation. +// It is a reverse action to String(). +// +// Returns true if s was parsed successfully. +func (t *Type) FromString(s string) bool { + var g object.ObjectType + + ok := g.FromString(s) + + if ok { + *t = TypeFromGRPCField(g) } + + return ok +} + +// TypeFromString converts string to Type. +// +// Deprecated: use FromString method. +func TypeFromString(s string) (t Type) { + t.FromString(s) + return +} + +// String returns string representation of MatchType. +func (t MatchType) String() string { + return MatchTypeToGRPCField(t).String() +} + +// FromString parses MatchType from a string representation. +// It is a reverse action to String(). +// +// Returns true if s was parsed successfully. +func (t *MatchType) FromString(s string) bool { + var g object.MatchType + + ok := g.FromString(s) + + if ok { + *t = MatchTypeFromGRPCField(g) + } + + return ok } diff --git a/v2/refs/grpc/types.go b/v2/refs/grpc/types.go index b071dc8..22448e5 100644 --- a/v2/refs/grpc/types.go +++ b/v2/refs/grpc/types.go @@ -76,3 +76,16 @@ func (m *Signature) SetSign(v []byte) { m.Sign = v } } + +// FromString parses ChecksumType from a string representation, +// It is a reverse action to String(). +// +// Returns true if s was parsed successfully. +func (x *ChecksumType) FromString(s string) bool { + i, ok := ChecksumType_value[s] + if ok { + *x = ChecksumType(i) + } + + return ok +} diff --git a/v2/refs/string.go b/v2/refs/string.go new file mode 100644 index 0000000..b27e07f --- /dev/null +++ b/v2/refs/string.go @@ -0,0 +1,26 @@ +package refs + +import ( + refs "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" +) + +// String returns string representation of ChecksumType. +func (t ChecksumType) String() string { + return ChecksumTypeToGRPC(t).String() +} + +// FromString parses ChecksumType from a string representation. +// It is a reverse action to String(). +// +// Returns true if s was parsed successfully. +func (t *ChecksumType) FromString(s string) bool { + var g refs.ChecksumType + + ok := g.FromString(s) + + if ok { + *t = ChecksumTypeFromGRPC(g) + } + + return ok +} diff --git a/v2/session/grpc/types.go b/v2/session/grpc/types.go index 20f9ee7..cee4638 100644 --- a/v2/session/grpc/types.go +++ b/v2/session/grpc/types.go @@ -274,3 +274,29 @@ func (m *ResponseVerificationHeader) SetOrigin(v *ResponseVerificationHeader) { m.Origin = v } } + +// FromString parses ObjectSessionContext_Verb from a string representation, +// It is a reverse action to String(). +// +// Returns true if s was parsed successfully. +func (x *ObjectSessionContext_Verb) FromString(s string) bool { + i, ok := ObjectSessionContext_Verb_value[s] + if ok { + *x = ObjectSessionContext_Verb(i) + } + + return ok +} + +// FromString parses ContainerSessionContext_Verb from a string representation, +// It is a reverse action to String(). +// +// Returns true if s was parsed successfully. +func (x *ContainerSessionContext_Verb) FromString(s string) bool { + i, ok := ContainerSessionContext_Verb_value[s] + if ok { + *x = ContainerSessionContext_Verb(i) + } + + return ok +} diff --git a/v2/session/string.go b/v2/session/string.go new file mode 100644 index 0000000..0335ed7 --- /dev/null +++ b/v2/session/string.go @@ -0,0 +1,47 @@ +package session + +import ( + session "github.com/nspcc-dev/neofs-api-go/v2/session/grpc" +) + +// String returns string representation of ObjectSessionVerb. +func (x ObjectSessionVerb) String() string { + return ObjectSessionVerbToGRPCField(x).String() +} + +// FromString parses ObjectSessionVerb from a string representation. +// It is a reverse action to String(). +// +// Returns true if s was parsed successfully. +func (x *ObjectSessionVerb) FromString(s string) bool { + var g session.ObjectSessionContext_Verb + + ok := g.FromString(s) + + if ok { + *x = ObjectSessionVerbFromGRPCField(g) + } + + return ok +} + +// String returns string representation of ContainerSessionVerb. +func (x ContainerSessionVerb) String() string { + return ContainerSessionVerbToGRPCField(x).String() +} + +// FromString parses ContainerSessionVerb from a string representation. +// It is a reverse action to String(). +// +// Returns true if s was parsed successfully. +func (x *ContainerSessionVerb) FromString(s string) bool { + var g session.ContainerSessionContext_Verb + + ok := g.FromString(s) + + if ok { + *x = ContainerSessionVerbFromGRPCField(g) + } + + return ok +} From 6d531a07a53dc19ad5ffbb4f90a550dfd8fe408f Mon Sep 17 00:00:00 2001 From: Leonard Lyubich <45413332+cthulhu-rider@users.noreply.github.com> Date: Wed, 23 Jun 2021 14:15:58 +0300 Subject: [PATCH 0875/1196] [#313] client/object: Always return number of bytes read from Get stream (#316) Fix failure to comply with a requirement of stdlib `io.Reader` docs: `When Read encounters an error or end-of-file condition after successfully reading n > 0 bytes, it returns the number of bytes read.` Prepare a platform for unit tests and test the affected case. Signed-off-by: Leonard Lyubich --- pkg/client/object.go | 28 +++++++----- pkg/client/object_test.go | 95 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 112 insertions(+), 11 deletions(-) create mode 100644 pkg/client/object_test.go diff --git a/pkg/client/object.go b/pkg/client/object.go index 2a962b8..62e895e 100644 --- a/pkg/client/object.go +++ b/pkg/client/object.go @@ -496,31 +496,35 @@ func (p *GetObjectParams) WithPayloadReaderHandler(f ReaderHandler) *GetObjectPa // wrapper over the Object Get stream that provides io.Reader. type objectPayloadReader struct { - stream *rpcapi.GetResponseReader + stream interface { + Read(*v2object.GetResponse) error + } resp v2object.GetResponse tail []byte } -func (x *objectPayloadReader) Read(p []byte) (int, error) { +func (x *objectPayloadReader) Read(p []byte) (read int, err error) { // read remaining tail - read := copy(p, x.tail) + read = copy(p, x.tail) x.tail = x.tail[read:] if len(p)-read == 0 { - return read, nil + return } // receive message from server stream - err := x.stream.Read(&x.resp) + err = x.stream.Read(&x.resp) if err != nil { if errors.Is(err, io.EOF) { - return 0, io.EOF + err = io.EOF + return } - return 0, fmt.Errorf("reading the response failed: %w", err) + err = fmt.Errorf("reading the response failed: %w", err) + return } // get chunk part message @@ -528,12 +532,14 @@ func (x *objectPayloadReader) Read(p []byte) (int, error) { chunkPart, ok := part.(*v2object.GetObjectPartChunk) if !ok { - return 0, errWrongMessageSeq + err = errWrongMessageSeq + return } // verify response structure - if err := signature.VerifyServiceMessage(&x.resp); err != nil { - return 0, fmt.Errorf("response verification failed: %w", err) + if err = signature.VerifyServiceMessage(&x.resp); err != nil { + err = fmt.Errorf("response verification failed: %w", err) + return } // read new chunk @@ -546,7 +552,7 @@ func (x *objectPayloadReader) Read(p []byte) (int, error) { // save the tail x.tail = append(x.tail, chunk[tailOffset:]...) - return read, nil + return } var errWrongMessageSeq = errors.New("incorrect message sequence") diff --git a/pkg/client/object_test.go b/pkg/client/object_test.go new file mode 100644 index 0000000..4c7d296 --- /dev/null +++ b/pkg/client/object_test.go @@ -0,0 +1,95 @@ +package client + +import ( + "io" + "testing" + + "github.com/nspcc-dev/neofs-api-go/v2/object" + "github.com/nspcc-dev/neofs-api-go/v2/signature" + "github.com/nspcc-dev/neofs-crypto/test" + "github.com/stretchr/testify/require" +) + +type singleResponseStream struct { + called bool + resp object.GetResponse +} + +func (x *singleResponseStream) Read(r *object.GetResponse) error { + if x.called { + return io.EOF + } + + x.called = true + + *r = x.resp + + return nil +} + +var key = test.DecodeKey(0) + +func chunkResponse(c []byte) (r object.GetResponse) { + chunkPart := new(object.GetObjectPartChunk) + chunkPart.SetChunk(c) + + body := new(object.GetResponseBody) + body.SetObjectPart(chunkPart) + + r.SetBody(body) + + if err := signature.SignServiceMessage(key, &r); err != nil { + panic(err) + } + + return +} + +func data(sz int) []byte { + data := make([]byte, sz) + + for i := range data { + data[i] = byte(i) % ^byte(0) + } + + return data +} + +func checkFullRead(t *testing.T, r io.Reader, buf, payload []byte) { + var ( + restored []byte + read int + ) + + for { + n, err := r.Read(buf) + + read += n + restored = append(restored, buf[:n]...) + + if err != nil { + require.Equal(t, err, io.EOF) + break + + } + } + + require.Equal(t, payload, restored) + require.EqualValues(t, len(payload), read) +} + +func TestObjectPayloadReader_Read(t *testing.T) { + t.Run("read with tail", func(t *testing.T) { + payload := data(10) + + buf := make([]byte, len(payload)-1) + + var r io.Reader = &objectPayloadReader{ + stream: &singleResponseStream{ + resp: chunkResponse(payload), + }, + } + + checkFullRead(t, r, buf, payload) + }) +} From 07fcaa4ba5ccc4b91480cbad4debcbe14da66eb0 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 18 Jun 2021 19:08:55 +0300 Subject: [PATCH 0876/1196] [#312] netmap: Support multiple addresses in NodeInfo In latest NeoFS API changes `NodeInfo` message carries list of network addresses. There is a need Add `SetAddresses` / `IterateAddresses` / `NumberOfAddresses` methods to provide the access to node's address group. Mark `Address` / `SetAddress` methods as deprecated. Signed-off-by: Leonard Lyubich --- pkg/netmap/node_info.go | 45 ++++++++++++++++-- pkg/netmap/node_info_test.go | 23 ++++++--- pkg/netmap/test/generate.go | 2 +- v2/netmap/convert.go | 4 +- v2/netmap/grpc/types.go | 9 +++- v2/netmap/grpc/types.pb.go | 90 ++++++++++++++++++------------------ v2/netmap/marshal.go | 5 +- v2/netmap/test/generate.go | 2 +- v2/netmap/types.go | 49 +++++++++++++++++--- 9 files changed, 159 insertions(+), 70 deletions(-) diff --git a/pkg/netmap/node_info.go b/pkg/netmap/node_info.go index 35f1617..3e62bbd 100644 --- a/pkg/netmap/node_info.go +++ b/pkg/netmap/node_info.go @@ -332,15 +332,52 @@ func (i *NodeInfo) SetPublicKey(key []byte) { } // Address returns network endpoint address of the node. -func (i *NodeInfo) Address() string { - return (*netmap.NodeInfo)(i). - GetAddress() +// +// Deprecated: use IterateAddresses method. +func (i *NodeInfo) Address() (addr string) { + i.IterateAddresses(func(s string) bool { + addr = s + return true + }) + + return } // SetAddress sets network endpoint address of the node. +// +// Deprecated: use SetAddresses method. func (i *NodeInfo) SetAddress(addr string) { + i.SetAddresses(addr) +} + +// NumberOfAddresses returns number of network addresses of the node. +func (i *NodeInfo) NumberOfAddresses() int { + return (*netmap.NodeInfo)(i). + NumberOfAddresses() +} + +// IterateAddresses iterates over network addresses of the node. +// Breaks iteration on f's true return. +// +// Handler should not be nil. +func (i *NodeInfo) IterateAddresses(f func(string) bool) { (*netmap.NodeInfo)(i). - SetAddress(addr) + IterateAddresses(f) +} + +// IterateAllAddresses is a helper function to unconditionally +// iterate over all node addresses. +func IterateAllAddresses(i *NodeInfo, f func(string)) { + i.IterateAddresses(func(addr string) bool { + f(addr) + return false + }) +} + +// SetAddresses sets list of network addresses of the node. +func (i *NodeInfo) SetAddresses(v ...string) { + (*netmap.NodeInfo)(i). + SetAddresses(v...) } // Attributes returns list of the node attributes. diff --git a/pkg/netmap/node_info_test.go b/pkg/netmap/node_info_test.go index 5d09a59..ebcd393 100644 --- a/pkg/netmap/node_info_test.go +++ b/pkg/netmap/node_info_test.go @@ -124,13 +124,21 @@ func TestNodeInfo_PublicKey(t *testing.T) { require.Equal(t, key, i.PublicKey()) } -func TestNodeInfo_Address(t *testing.T) { +func TestNodeInfo_IterateAddresses(t *testing.T) { i := new(NodeInfo) - a := "127.0.0.1:8080" - i.SetAddress(a) + as := []string{"127.0.0.1:8080", "127.0.0.1:8081"} - require.Equal(t, a, i.Address()) + i.SetAddresses(as...) + + as2 := make([]string, 0, i.NumberOfAddresses()) + + IterateAllAddresses(i, func(addr string) { + as2 = append(as2, addr) + }) + + require.Equal(t, as, as2) + require.EqualValues(t, len(as), i.NumberOfAddresses()) } func TestNodeInfo_State(t *testing.T) { @@ -178,7 +186,7 @@ func TestNodeAttributeEncoding(t *testing.T) { func TestNodeInfoEncoding(t *testing.T) { i := NewNodeInfo() i.SetPublicKey([]byte{1, 2, 3}) - i.SetAddress("192.168.0.1") + i.SetAddresses("192.168.0.1", "192.168.0.2") i.SetState(NodeStateOnline) i.SetAttributes(testNodeAttribute()) @@ -227,7 +235,8 @@ func TestNewNodeInfo(t *testing.T) { // check initial values require.Nil(t, ni.PublicKey()) - require.Empty(t, ni.Address()) + + require.Zero(t, ni.NumberOfAddresses()) require.Nil(t, ni.Attributes()) require.Zero(t, ni.State()) @@ -235,7 +244,7 @@ func TestNewNodeInfo(t *testing.T) { niV2 := ni.ToV2() require.Nil(t, niV2.GetPublicKey()) - require.Empty(t, niV2.GetAddress()) + require.Zero(t, niV2.NumberOfAddresses()) require.Nil(t, niV2.GetAttributes()) require.EqualValues(t, netmap.UnspecifiedState, niV2.GetState()) }) diff --git a/pkg/netmap/test/generate.go b/pkg/netmap/test/generate.go index 51a43c2..a2a1394 100644 --- a/pkg/netmap/test/generate.go +++ b/pkg/netmap/test/generate.go @@ -84,7 +84,7 @@ func NodeAttribute() *netmap.NodeAttribute { func NodeInfo() *netmap.NodeInfo { x := netmap.NewNodeInfo() - x.SetAddress("address") + x.SetAddresses("address 1", "address 2") x.SetPublicKey([]byte("public key")) x.SetState(netmap.NodeStateOnline) x.SetAttributes(NodeAttribute(), NodeAttribute()) diff --git a/v2/netmap/convert.go b/v2/netmap/convert.go index 3c64495..06bddbf 100644 --- a/v2/netmap/convert.go +++ b/v2/netmap/convert.go @@ -342,7 +342,7 @@ func (ni *NodeInfo) ToGRPCMessage() grpc.Message { m = new(netmap.NodeInfo) m.SetPublicKey(ni.publicKey) - m.SetAddress(ni.address) + m.SetAddresses(ni.addresses) m.SetState(NodeStateToGRPCMessage(ni.state)) m.SetAttributes(AttributesToGRPC(ni.attributes)) } @@ -364,7 +364,7 @@ func (ni *NodeInfo) FromGRPCMessage(m grpc.Message) error { } ni.publicKey = v.GetPublicKey() - ni.address = v.GetAddress() + ni.addresses = v.GetAddresses() ni.state = NodeStateFromRPCMessage(v.GetState()) return nil diff --git a/v2/netmap/grpc/types.go b/v2/netmap/grpc/types.go index 4340d19..9ba148e 100644 --- a/v2/netmap/grpc/types.go +++ b/v2/netmap/grpc/types.go @@ -134,9 +134,16 @@ func (m *NodeInfo_Attribute) SetParents(v []string) { } // SetAddress sets node network address. +// +// Deprecated: use SetAddresses. func (m *NodeInfo) SetAddress(v string) { + m.SetAddresses([]string{v}) +} + +// SetAddresses sets list of network addresses of the node. +func (m *NodeInfo) SetAddresses(v []string) { if m != nil { - m.Address = v + m.Addresses = v } } diff --git a/v2/netmap/grpc/types.pb.go b/v2/netmap/grpc/types.pb.go index ca9190e..caee48b 100644 --- a/v2/netmap/grpc/types.pb.go +++ b/v2/netmap/grpc/types.pb.go @@ -535,7 +535,7 @@ type NodeInfo struct { // Public key of the NeoFS node in a binary format. PublicKey []byte `protobuf:"bytes,1,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"` // Ways to connect to a node - Address string `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"` + Addresses []string `protobuf:"bytes,2,rep,name=addresses,proto3" json:"addresses,omitempty"` // Carries list of the NeoFS node attributes in a key-value form. Key name // must be a node-unique valid UTF-8 string. Value can't be empty. NodeInfo // structures with duplicated attribute names or attributes with empty values @@ -584,11 +584,11 @@ func (x *NodeInfo) GetPublicKey() []byte { return nil } -func (x *NodeInfo) GetAddress() string { +func (x *NodeInfo) GetAddresses() []string { if x != nil { - return x.Address + return x.Addresses } - return "" + return nil } func (x *NodeInfo) GetAttributes() []*NodeInfo_Attribute { @@ -830,49 +830,49 @@ var file_v2_netmap_grpc_types_proto_rawDesc = []byte{ 0x32, 0x0a, 0x07, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x07, 0x66, 0x69, 0x6c, 0x74, - 0x65, 0x72, 0x73, 0x22, 0xc3, 0x02, 0x0a, 0x08, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, + 0x65, 0x72, 0x73, 0x22, 0xc7, 0x02, 0x0a, 0x08, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x12, - 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x44, 0x0a, 0x0a, 0x61, 0x74, 0x74, - 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, - 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, - 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, - 0x75, 0x74, 0x65, 0x52, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, - 0x36, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x20, - 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, - 0x70, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x65, - 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x1a, 0x4d, 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, 0x12, 0x18, 0x0a, 0x07, - 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x70, - 0x61, 0x72, 0x65, 0x6e, 0x74, 0x73, 0x22, 0x31, 0x0a, 0x05, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, - 0x0f, 0x0a, 0x0b, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, - 0x12, 0x0a, 0x0a, 0x06, 0x4f, 0x4e, 0x4c, 0x49, 0x4e, 0x45, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, - 0x4f, 0x46, 0x46, 0x4c, 0x49, 0x4e, 0x45, 0x10, 0x02, 0x22, 0x55, 0x0a, 0x0b, 0x4e, 0x65, 0x74, - 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x23, 0x0a, 0x0d, 0x63, 0x75, 0x72, 0x72, - 0x65, 0x6e, 0x74, 0x5f, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, - 0x0c, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x45, 0x70, 0x6f, 0x63, 0x68, 0x12, 0x21, 0x0a, - 0x0c, 0x6d, 0x61, 0x67, 0x69, 0x63, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x04, 0x52, 0x0b, 0x6d, 0x61, 0x67, 0x69, 0x63, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, - 0x2a, 0x67, 0x0a, 0x09, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x19, 0x0a, - 0x15, 0x4f, 0x50, 0x45, 0x52, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, - 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x06, 0x0a, 0x02, 0x45, 0x51, 0x10, 0x01, - 0x12, 0x06, 0x0a, 0x02, 0x4e, 0x45, 0x10, 0x02, 0x12, 0x06, 0x0a, 0x02, 0x47, 0x54, 0x10, 0x03, - 0x12, 0x06, 0x0a, 0x02, 0x47, 0x45, 0x10, 0x04, 0x12, 0x06, 0x0a, 0x02, 0x4c, 0x54, 0x10, 0x05, - 0x12, 0x06, 0x0a, 0x02, 0x4c, 0x45, 0x10, 0x06, 0x12, 0x06, 0x0a, 0x02, 0x4f, 0x52, 0x10, 0x07, - 0x12, 0x07, 0x0a, 0x03, 0x41, 0x4e, 0x44, 0x10, 0x08, 0x2a, 0x38, 0x0a, 0x06, 0x43, 0x6c, 0x61, - 0x75, 0x73, 0x65, 0x12, 0x16, 0x0a, 0x12, 0x43, 0x4c, 0x41, 0x55, 0x53, 0x45, 0x5f, 0x55, 0x4e, - 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x53, - 0x41, 0x4d, 0x45, 0x10, 0x01, 0x12, 0x0c, 0x0a, 0x08, 0x44, 0x49, 0x53, 0x54, 0x49, 0x4e, 0x43, - 0x54, 0x10, 0x02, 0x42, 0x56, 0x5a, 0x37, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, - 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, - 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x6e, 0x65, 0x74, 0x6d, - 0x61, 0x70, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0xaa, 0x02, - 0x1a, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, - 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x4e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x62, 0x06, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, + 0x1c, 0x0a, 0x09, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, + 0x28, 0x09, 0x52, 0x09, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x12, 0x44, 0x0a, + 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x24, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, + 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x41, 0x74, + 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x52, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, + 0x74, 0x65, 0x73, 0x12, 0x36, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x0e, 0x32, 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, + 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x53, + 0x74, 0x61, 0x74, 0x65, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x1a, 0x4d, 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, + 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, + 0x09, 0x52, 0x07, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x73, 0x22, 0x31, 0x0a, 0x05, 0x53, 0x74, + 0x61, 0x74, 0x65, 0x12, 0x0f, 0x0a, 0x0b, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, + 0x45, 0x44, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x4f, 0x4e, 0x4c, 0x49, 0x4e, 0x45, 0x10, 0x01, + 0x12, 0x0b, 0x0a, 0x07, 0x4f, 0x46, 0x46, 0x4c, 0x49, 0x4e, 0x45, 0x10, 0x02, 0x22, 0x55, 0x0a, + 0x0b, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x23, 0x0a, 0x0d, + 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x04, 0x52, 0x0c, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x45, 0x70, 0x6f, 0x63, + 0x68, 0x12, 0x21, 0x0a, 0x0c, 0x6d, 0x61, 0x67, 0x69, 0x63, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, + 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0b, 0x6d, 0x61, 0x67, 0x69, 0x63, 0x4e, 0x75, + 0x6d, 0x62, 0x65, 0x72, 0x2a, 0x67, 0x0a, 0x09, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x12, 0x19, 0x0a, 0x15, 0x4f, 0x50, 0x45, 0x52, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x55, + 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x06, 0x0a, 0x02, + 0x45, 0x51, 0x10, 0x01, 0x12, 0x06, 0x0a, 0x02, 0x4e, 0x45, 0x10, 0x02, 0x12, 0x06, 0x0a, 0x02, + 0x47, 0x54, 0x10, 0x03, 0x12, 0x06, 0x0a, 0x02, 0x47, 0x45, 0x10, 0x04, 0x12, 0x06, 0x0a, 0x02, + 0x4c, 0x54, 0x10, 0x05, 0x12, 0x06, 0x0a, 0x02, 0x4c, 0x45, 0x10, 0x06, 0x12, 0x06, 0x0a, 0x02, + 0x4f, 0x52, 0x10, 0x07, 0x12, 0x07, 0x0a, 0x03, 0x41, 0x4e, 0x44, 0x10, 0x08, 0x2a, 0x38, 0x0a, + 0x06, 0x43, 0x6c, 0x61, 0x75, 0x73, 0x65, 0x12, 0x16, 0x0a, 0x12, 0x43, 0x4c, 0x41, 0x55, 0x53, + 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, + 0x08, 0x0a, 0x04, 0x53, 0x41, 0x4d, 0x45, 0x10, 0x01, 0x12, 0x0c, 0x0a, 0x08, 0x44, 0x49, 0x53, + 0x54, 0x49, 0x4e, 0x43, 0x54, 0x10, 0x02, 0x42, 0x56, 0x5a, 0x37, 0x67, 0x69, 0x74, 0x68, 0x75, + 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, + 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, + 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x6e, 0x65, 0x74, 0x6d, + 0x61, 0x70, 0xaa, 0x02, 0x1a, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, + 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x4e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/v2/netmap/marshal.go b/v2/netmap/marshal.go index 79da27a..abdc7df 100644 --- a/v2/netmap/marshal.go +++ b/v2/netmap/marshal.go @@ -367,7 +367,7 @@ func (ni *NodeInfo) StableMarshal(buf []byte) ([]byte, error) { offset += n - n, err = protoutil.StringMarshal(addressNodeInfoField, buf[offset:], ni.address) + n, err = protoutil.RepeatedStringMarshal(addressNodeInfoField, buf[offset:], ni.addresses) if err != nil { return nil, err } @@ -397,7 +397,8 @@ func (ni *NodeInfo) StableSize() (size int) { } size += protoutil.BytesSize(keyNodeInfoField, ni.publicKey) - size += protoutil.StringSize(addressNodeInfoField, ni.address) + size += protoutil.RepeatedStringSize(addressNodeInfoField, ni.addresses) + for i := range ni.attributes { size += protoutil.NestedStructureSize(attributesNodeInfoField, ni.attributes[i]) } diff --git a/v2/netmap/test/generate.go b/v2/netmap/test/generate.go index ce94338..f9f316f 100644 --- a/v2/netmap/test/generate.go +++ b/v2/netmap/test/generate.go @@ -135,7 +135,7 @@ func GenerateNodeInfo(empty bool) *netmap.NodeInfo { m := new(netmap.NodeInfo) if !empty { - m.SetAddress("node address") + m.SetAddresses("node address", "node address 2") m.SetPublicKey([]byte{1, 2, 3}) m.SetState(33) m.SetAttributes(GenerateAttributes(empty)) diff --git a/v2/netmap/types.go b/v2/netmap/types.go index e67e0a6..858d844 100644 --- a/v2/netmap/types.go +++ b/v2/netmap/types.go @@ -71,7 +71,7 @@ type Attribute struct { // NodeInfo of storage node. type NodeInfo struct { publicKey []byte - address string + addresses []string attributes []*Attribute state NodeState } @@ -386,17 +386,52 @@ func (ni *NodeInfo) SetPublicKey(v []byte) { } } -func (ni *NodeInfo) GetAddress() string { - if ni != nil { - return ni.address - } +// GetAddress returns node's network address. +// +// Deprecated: use IterateAddresses. +func (ni *NodeInfo) GetAddress() (addr string) { + ni.IterateAddresses(func(s string) bool { + addr = s + return true + }) - return "" + return } +// SetAddress sets node's network address. +// +// Deprecated: use SetAddresses. func (ni *NodeInfo) SetAddress(v string) { + ni.SetAddresses(v) +} + +// SetAddresses sets list of network addresses of the node. +func (ni *NodeInfo) SetAddresses(v ...string) { if ni != nil { - ni.address = v + ni.addresses = v + } +} + +// NumberOfAddresses returns number of network addresses of the node. +func (ni *NodeInfo) NumberOfAddresses() int { + if ni != nil { + return len(ni.addresses) + } + + return 0 +} + +// IterateAddresses iterates over network addresses of the node. +// Breaks iteration on f's true return. +// +// Handler should not be nil. +func (ni *NodeInfo) IterateAddresses(f func(string) bool) { + if ni != nil { + for i := range ni.addresses { + if f(ni.addresses[i]) { + break + } + } } } From af854ca08f9fa33ff0bccf4904651e1c86c36522 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 25 Jun 2021 23:55:37 +0300 Subject: [PATCH 0877/1196] Update Neo GO library to v0.95.3 Signed-off-by: Leonard Lyubich --- go.mod | 2 +- go.sum | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index 3f824eb..c74ef88 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/google/uuid v1.1.1 github.com/mr-tron/base58 v1.1.2 github.com/nspcc-dev/hrw v1.0.9 - github.com/nspcc-dev/neo-go v0.95.1 + github.com/nspcc-dev/neo-go v0.95.3 github.com/nspcc-dev/neofs-crypto v0.3.0 github.com/stretchr/testify v1.6.1 google.golang.org/grpc v1.29.1 diff --git a/go.sum b/go.sum index 5d2dbaa..c84acfd 100644 --- a/go.sum +++ b/go.sum @@ -135,9 +135,11 @@ github.com/nspcc-dev/hrw v1.0.9 h1:17VcAuTtrstmFppBjfRiia4K2wA/ukXZhLFS8Y8rz5Y= github.com/nspcc-dev/hrw v1.0.9/go.mod h1:l/W2vx83vMQo6aStyx2AuZrJ+07lGv2JQGlVkPG06MU= github.com/nspcc-dev/neo-go v0.73.1-pre.0.20200303142215-f5a1b928ce09/go.mod h1:pPYwPZ2ks+uMnlRLUyXOpLieaDQSEaf4NM3zHVbRjmg= github.com/nspcc-dev/neo-go v0.91.0/go.mod h1:G6HdOWvzQ6tlvFdvFSN/PgCzLPN/X/X4d5hTjFRUDcc= -github.com/nspcc-dev/neo-go v0.95.1 h1:5fgLFOul1Ax/maFkgLkD5rDUwY/nB/xX/Jpcd8hLHaI= github.com/nspcc-dev/neo-go v0.95.1/go.mod h1:bW07ge1WFXsBgqrcPpLUr6OcyQxHqM26MZNesWMdH0c= +github.com/nspcc-dev/neo-go v0.95.3 h1:RxBKcmmatbSM2cETGhv3ritmrkU0gUnWItNZvtrBtI0= +github.com/nspcc-dev/neo-go v0.95.3/go.mod h1:t15xRFDVhz5o/pstptdoW9N9JJBNn1hZ6APMNiC6MrY= github.com/nspcc-dev/neofs-api-go v1.24.0/go.mod h1:G7dqincfdjBrAbL5nxVp82emF05fSVEqe59ICsoRDI8= +github.com/nspcc-dev/neofs-api-go v1.27.1/go.mod h1:i0Cwgvcu9A4M4e58pydbXFisUhSxpfljmuWFPIp2btE= github.com/nspcc-dev/neofs-crypto v0.2.0/go.mod h1:F/96fUzPM3wR+UGsPi3faVNmFlA9KAEAUQR7dMxZmNA= github.com/nspcc-dev/neofs-crypto v0.2.3/go.mod h1:8w16GEJbH6791ktVqHN9YRNH3s9BEEKYxGhlFnp0cDw= github.com/nspcc-dev/neofs-crypto v0.3.0 h1:zlr3pgoxuzrmGCxc5W8dGVfA9Rro8diFvVnBg0L4ifM= From 76abe7d6cb380690c7f51b7b3c36cea5a0998964 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Sat, 26 Jun 2021 00:00:32 +0300 Subject: [PATCH 0878/1196] Update changelog for v1.28.0 release Signed-off-by: Leonard Lyubich --- CHANGELOG.md | 18 ++++++++++++++++++ README.md | 1 + pkg/version.go | 2 +- 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0a61003..dc64985 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,22 @@ # Changelog +## [1.28.0] - 2021-06-28 - Muuido (무의도, 舞衣島) + +### Added + +- `String` / `FromString` methods to work with text format of enums from `pkg`. +- `Marshal(JSON)` / `Unmarshal(JSON)` methods to `container.ContainerContext` type. +- Ability to handle the `io.Reader` of the object payload in `Client.GetObject`. +- `NumberOfAddresses` / `IterateAddresses` methods to node info types for support of multiple addresses. + +### Fixed + +- Added leading slash to format of gRPC method names. + +### Updated + +- Neo Go library to v0.95.3. + ## [1.27.1] - 2021-06-10 ### Fixed @@ -646,3 +663,4 @@ Initial public release [1.26.1]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.26.0...v1.26.1 [1.27.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.26.1...v1.27.0 [1.27.1]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.27.0...v1.27.1 +[1.28.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.27.1...v1.28.0 diff --git a/README.md b/README.md index 3b3ef0d..b7dcedb 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,7 @@ versions and SDK layer working with all of them in a handy way. |v1.25.x|[v2.5.0](https://github.com/nspcc-dev/neofs-api/releases/tag/v2.5.0)| |v1.26.x|[v2.6.0](https://github.com/nspcc-dev/neofs-api/releases/tag/v2.6.0)| |v1.27.x|[v2.7.0](https://github.com/nspcc-dev/neofs-api/releases/tag/v2.7.0)| +|v1.28.x|[v2.8.0](https://github.com/nspcc-dev/neofs-api/releases/tag/v2.8.0)| ## Contributing diff --git a/pkg/version.go b/pkg/version.go index 12c5e33..a851387 100644 --- a/pkg/version.go +++ b/pkg/version.go @@ -9,7 +9,7 @@ import ( // Version represents v2-compatible version. type Version refs.Version -const sdkMjr, sdkMnr = 2, 7 +const sdkMjr, sdkMnr = 2, 8 // NewVersionFromV2 wraps v2 Version message to Version. // From d809155efad764573a0a35c3c4305177ae4e5608 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 1 Jul 2021 15:18:31 +0300 Subject: [PATCH 0879/1196] [#321] pkg/client: Do not verify container body in GetContainer There is a problem when containers with newer versions considered invalid by Client. This does not allow receiving correct containers of new versions through the client. Fix the problem by turning off version check in `Client.GetContainer`. Signed-off-by: Leonard Lyubich --- pkg/client/container.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/pkg/client/container.go b/pkg/client/container.go index ae4ab36..b021813 100644 --- a/pkg/client/container.go +++ b/pkg/client/container.go @@ -173,10 +173,7 @@ func (c *clientImpl) GetContainer(ctx context.Context, id *cid.ID, opts ...CallO body := resp.GetBody() - cnr, err := container.NewVerifiedFromV2(body.GetContainer()) - if err != nil { - return nil, err - } + cnr := container.NewContainerFromV2(body.GetContainer()) cnr.SetSessionToken( session.NewTokenFromV2(body.GetSessionToken()), From 43316466158ca070a33e1c97f9bd542a88f079b4 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 1 Jul 2021 16:11:56 +0300 Subject: [PATCH 0880/1196] [#321] pkg/container: Remove no longer use NewVerifiedFromV2 func Also remove `pkg.IsSupportedVersion` used by `NewVerifiedFromV2` only. Signed-off-by: Leonard Lyubich --- pkg/container/fmt.go | 28 ---------------------- pkg/container/fmt_test.go | 49 --------------------------------------- pkg/version.go | 11 --------- pkg/version_test.go | 33 -------------------------- 4 files changed, 121 deletions(-) delete mode 100644 pkg/container/fmt.go delete mode 100644 pkg/container/fmt_test.go diff --git a/pkg/container/fmt.go b/pkg/container/fmt.go deleted file mode 100644 index ad1cada..0000000 --- a/pkg/container/fmt.go +++ /dev/null @@ -1,28 +0,0 @@ -package container - -import ( - "fmt" - - "github.com/nspcc-dev/neofs-api-go/pkg" - "github.com/nspcc-dev/neofs-api-go/v2/container" -) - -// NewVerifiedFromV2 constructs Container from NeoFS API V2 Container message. -// Returns error if message does not meet NeoFS API V2 specification. -// -// Additionally checks if message carries supported version. -func NewVerifiedFromV2(cnrV2 *container.Container) (*Container, error) { - cnr := NewContainerFromV2(cnrV2) - - // check version support - if err := pkg.IsSupportedVersion(cnr.Version()); err != nil { - return nil, err - } - - // check nonce format - if _, err := cnr.NonceUUID(); err != nil { - return nil, fmt.Errorf("invalid nonce: %w", err) - } - - return cnr, nil -} diff --git a/pkg/container/fmt_test.go b/pkg/container/fmt_test.go deleted file mode 100644 index c27bdde..0000000 --- a/pkg/container/fmt_test.go +++ /dev/null @@ -1,49 +0,0 @@ -package container_test - -import ( - "testing" - - "github.com/google/uuid" - "github.com/nspcc-dev/neofs-api-go/pkg" - "github.com/nspcc-dev/neofs-api-go/pkg/container" - containerV2 "github.com/nspcc-dev/neofs-api-go/v2/container" - "github.com/stretchr/testify/require" -) - -func TestNewVerifiedFromV2(t *testing.T) { - cnrV2 := new(containerV2.Container) - - errAssert := func() { - _, err := container.NewVerifiedFromV2(cnrV2) - require.Error(t, err) - } - - // set unsupported version - v := pkg.SDKVersion() - v.SetMajor(0) - require.Error(t, pkg.IsSupportedVersion(v)) - cnrV2.SetVersion(v.ToV2()) - - errAssert() - - // set supported version - v.SetMajor(2) - require.NoError(t, pkg.IsSupportedVersion(v)) - cnrV2.SetVersion(v.ToV2()) - - errAssert() - - // set invalid nonce - nonce := []byte{1, 2, 3} - cnrV2.SetNonce(nonce) - - errAssert() - - // set valid nonce - uid := uuid.New() - data, _ := uid.MarshalBinary() - cnrV2.SetNonce(data) - - _, err := container.NewVerifiedFromV2(cnrV2) - require.NoError(t, err) -} diff --git a/pkg/version.go b/pkg/version.go index a851387..928566c 100644 --- a/pkg/version.go +++ b/pkg/version.go @@ -74,17 +74,6 @@ func (v *Version) String() string { return fmt.Sprintf("v%d.%d", v.Major(), v.Minor()) } -// IsSupportedVersion returns error if v is not supported by current SDK. -func IsSupportedVersion(v *Version) error { - mjr, mnr := v.Major(), v.Minor() - - if mjr != 2 || mnr > sdkMnr { - return fmt.Errorf("unsupported version %d.%d", mjr, mnr) - } - - return nil -} - // Marshal marshals Version into a protobuf binary form. // // Buffer is allocated when the argument is empty. diff --git a/pkg/version_test.go b/pkg/version_test.go index 4586492..622e4b7 100644 --- a/pkg/version_test.go +++ b/pkg/version_test.go @@ -47,39 +47,6 @@ func TestSDKVersion(t *testing.T) { require.Equal(t, uint32(sdkMnr), v.Minor()) } -func TestIsSupportedVersion(t *testing.T) { - require.Error(t, IsSupportedVersion(nil)) - - v := NewVersion() - - v.SetMajor(1) - require.Error(t, IsSupportedVersion(v)) - - v.SetMajor(3) - require.Error(t, IsSupportedVersion(v)) - - for _, item := range []struct { - mjr, maxMnr uint32 - }{ - { - mjr: 2, - maxMnr: sdkMnr, - }, - } { - v.SetMajor(item.mjr) - - for i := uint32(0); i <= item.maxMnr; i++ { - v.SetMinor(i) - - require.NoError(t, IsSupportedVersion(v)) - } - - v.SetMinor(item.maxMnr + 1) - - require.Error(t, IsSupportedVersion(v)) - } -} - func TestVersionEncoding(t *testing.T) { v := NewVersion() v.SetMajor(1) From ab60f3685be082e87179faef5cf6fe52f57b5790 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 1 Jul 2021 18:08:30 +0300 Subject: [PATCH 0881/1196] Update changelog for v1.28.1 Signed-off-by: Leonard Lyubich --- CHANGELOG.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index dc64985..82f7928 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,16 @@ # Changelog +## [1.28.1] - 2021-07-01 + +### Fixed + +- Incorrect unsupported version error in `Client.GetContainer` of containers of newer versions. + +### Removed + +- No longer used `pkg.IsSupportedVersion` func. +- No longer used `container.NewVerifiedFromV2` func. + ## [1.28.0] - 2021-06-28 - Muuido (무의도, 舞衣島) ### Added @@ -664,3 +675,4 @@ Initial public release [1.27.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.26.1...v1.27.0 [1.27.1]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.27.0...v1.27.1 [1.28.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.27.1...v1.28.0 +[1.28.1]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.28.0...v1.28.1 From 2f783dfad7d2d8f76512b836b6fcb81e7e18b33b Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 6 Jul 2021 11:18:25 +0300 Subject: [PATCH 0882/1196] [#323] pkg/client: Prevent corruption of parameterized session token Create new `SessionTokenBody` instead of using one from the parameter in order to prevent data corruption. Signed-off-by: Leonard Lyubich --- pkg/client/object.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/client/object.go b/pkg/client/object.go index 62e895e..60d2970 100644 --- a/pkg/client/object.go +++ b/pkg/client/object.go @@ -1302,7 +1302,6 @@ func (c *clientImpl) attachV2SessionToken(opts *callOptions, hdr *v2session.Requ } token := new(v2session.SessionToken) - token.SetBody(opts.session.ToV2().GetBody()) opCtx := new(v2session.ObjectSessionContext) opCtx.SetAddress(info.addr) @@ -1313,7 +1312,9 @@ func (c *clientImpl) attachV2SessionToken(opts *callOptions, hdr *v2session.Requ lt.SetNbf(info.nbf) lt.SetExp(info.exp) - body := token.GetBody() + body := new(v2session.SessionTokenBody) + body.SetID(opts.session.ID()) + body.SetOwnerID(opts.session.OwnerID().ToV2()) body.SetSessionKey(opts.session.SessionKey()) body.SetContext(opCtx) body.SetLifetime(lt) From 03ee3e5357d56056b8e02626044c6a8e8143ef5b Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 6 Jul 2021 11:21:06 +0300 Subject: [PATCH 0883/1196] Update changelog for release v1.28.2 Signed-off-by: Leonard Lyubich --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 82f7928..3aafbb5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## [1.28.2] - 2021-07-06 + +### Fixed + +- Data corruption of parameterized session token in `pkg/client.Client` ([#323](https://github.com/nspcc-dev/neofs-api-go/issues/323)). + ## [1.28.1] - 2021-07-01 ### Fixed @@ -676,3 +682,4 @@ Initial public release [1.27.1]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.27.0...v1.27.1 [1.28.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.27.1...v1.28.0 [1.28.1]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.28.0...v1.28.1 +[1.28.2]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.28.1...v1.28.2 From f00b9ba0546b51c511f05f1fef6de2de73ea11e5 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Wed, 7 Jul 2021 13:42:09 +0300 Subject: [PATCH 0884/1196] [#326] Fix regression after #324 Signed-off-by: Alex Vanin --- pkg/client/object.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/client/object.go b/pkg/client/object.go index 60d2970..6fd25ad 100644 --- a/pkg/client/object.go +++ b/pkg/client/object.go @@ -1301,8 +1301,6 @@ func (c *clientImpl) attachV2SessionToken(opts *callOptions, hdr *v2session.Requ return nil } - token := new(v2session.SessionToken) - opCtx := new(v2session.ObjectSessionContext) opCtx.SetAddress(info.addr) opCtx.SetVerb(info.verb) @@ -1319,6 +1317,9 @@ func (c *clientImpl) attachV2SessionToken(opts *callOptions, hdr *v2session.Requ body.SetContext(opCtx) body.SetLifetime(lt) + token := new(v2session.SessionToken) + token.SetBody(body) + signWrapper := signature.StableMarshalerWrapper{SM: token.GetBody()} err := signer.SignDataWithHandler(opts.key, signWrapper, func(key []byte, sig []byte) { From 9b2e63659ca87ee959b200db482a64c9d7330c33 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Wed, 7 Jul 2021 14:19:32 +0300 Subject: [PATCH 0885/1196] Update changelog for release v1.28.3 Signed-off-by: Alex Vanin --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3aafbb5..237ad63 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## [1.28.3] - 2021-07-07 + +### Fixed + +- Regression of the session token corruption fix from v1.28.2 ([#326](https://github.com/nspcc-dev/neofs-api-go/issues/326)). + ## [1.28.2] - 2021-07-06 ### Fixed @@ -683,3 +689,4 @@ Initial public release [1.28.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.27.1...v1.28.0 [1.28.1]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.28.0...v1.28.1 [1.28.2]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.28.1...v1.28.2 +[1.28.3]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.28.2...v1.28.3 From 8c9e1504b840d37e260d0d5e6cdb75239c675fd0 Mon Sep 17 00:00:00 2001 From: Stanislav Bogatyrev Date: Thu, 5 Aug 2021 09:18:19 +0300 Subject: [PATCH 0886/1196] Fix well-known BasicACL constants to fit the spec In the well-known BasicACL constants we need to set the always toggled bits for the system group. Otherwise it may be confusing for those who read the specification and try to match it with the reference implementation or the resulting BasicACL set in the container. Signed-off-by: Stanislav Bogatyrev --- pkg/acl/types.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/acl/types.go b/pkg/acl/types.go index ab337a0..184dea3 100644 --- a/pkg/acl/types.go +++ b/pkg/acl/types.go @@ -1,12 +1,12 @@ package acl const ( - // PublicBasicRule is a basic ACL value for public container. - PublicBasicRule = 0x1FFFFFFF + // PublicBasicRule is a basic ACL value for public-read-write container. + PublicBasicRule = 0x1FBFBFFF // PrivateBasicRule is a basic ACL value for private container. - PrivateBasicRule = 0x18888888 + PrivateBasicRule = 0x1C8C8CCC - // ReadOnlyBasicRule is a basic ACL value for read-only container. - ReadOnlyBasicRule = 0x1FFF88FF + // ReadOnlyBasicRule is a basic ACL value for public-read container. + ReadOnlyBasicRule = 0x1FBFBFFF ) From a0262d58b0de5d7808b3c6fe484fb0cdb8e6660a Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Thu, 26 Aug 2021 14:14:01 +0300 Subject: [PATCH 0887/1196] [#335] linter: Sync receiver name for `Tombstone` Signed-off-by: Pavel Karpy --- pkg/object/tombstone.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/object/tombstone.go b/pkg/object/tombstone.go index 1d7e522..2d8ca65 100644 --- a/pkg/object/tombstone.go +++ b/pkg/object/tombstone.go @@ -28,8 +28,8 @@ func NewTombstone() *Tombstone { // ToV2 converts Tombstone to v2 Tombstone message. // // Nil Tombstone converts to nil. -func (ts *Tombstone) ToV2() *tombstone.Tombstone { - return (*tombstone.Tombstone)(ts) +func (t *Tombstone) ToV2() *tombstone.Tombstone { + return (*tombstone.Tombstone)(t) } // ExpirationEpoch return number of tombstone expiration epoch. From 456dc5d7e9fcf182ecd2f8a1526cff55da06ebcc Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Thu, 26 Aug 2021 14:17:04 +0300 Subject: [PATCH 0888/1196] [#335] go.mod: Update to Go 1.16 Signed-off-by: Pavel Karpy --- go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go.mod b/go.mod index c74ef88..afe1a8a 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/nspcc-dev/neofs-api-go -go 1.14 +go 1.16 require ( github.com/golang/protobuf v1.4.3 From aad43354de9ab52d44793db8e1b00f28812dea7f Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Thu, 26 Aug 2021 14:17:57 +0300 Subject: [PATCH 0889/1196] [#335] ci: Add tests for Go 1.17 Signed-off-by: Pavel Karpy --- .github/workflows/go.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 1f43e51..c86f81f 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -17,7 +17,7 @@ jobs: runs-on: ubuntu-20.04 strategy: matrix: - go: [ '1.14.x', '1.15.x', '1.16.x' ] + go: [ '1.16.x', '1.17.x' ] steps: - name: Setup go uses: actions/setup-go@v2 From 63c37709fa81eddacf7421019538c3abb915885f Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Thu, 26 Aug 2021 11:19:41 +0300 Subject: [PATCH 0890/1196] [#334] pkg/acl: Fix public-read ACL rule Signed-off-by: Pavel Karpy --- pkg/acl/types.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/acl/types.go b/pkg/acl/types.go index 184dea3..a83c8c8 100644 --- a/pkg/acl/types.go +++ b/pkg/acl/types.go @@ -8,5 +8,5 @@ const ( PrivateBasicRule = 0x1C8C8CCC // ReadOnlyBasicRule is a basic ACL value for public-read container. - ReadOnlyBasicRule = 0x1FBFBFFF + ReadOnlyBasicRule = 0x1FBF8CFF ) From 5b3860e3d9fd20e7caeba65a1ee4b2e09737450a Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Mon, 16 Aug 2021 14:40:48 +0300 Subject: [PATCH 0891/1196] [#331] v2/object: Recompile proto files Add new enum matchtype `COMMON_PREFIX` to object. Signed-off-by: Pavel Karpy --- v2/netmap/grpc/types.pb.go | 11 +++++++++++ v2/object/grpc/types.pb.go | 32 ++++++++++++++++++-------------- 2 files changed, 29 insertions(+), 14 deletions(-) diff --git a/v2/netmap/grpc/types.pb.go b/v2/netmap/grpc/types.pb.go index caee48b..5b2fb51 100644 --- a/v2/netmap/grpc/types.pb.go +++ b/v2/netmap/grpc/types.pb.go @@ -668,6 +668,17 @@ func (x *NetworkInfo) GetMagicNumber() uint64 { // `Attribute` is a Key-Value metadata pair. Key name must be a valid UTF-8 // string. Value can't be empty. // +// Attributes can be constructed into a chain of attributes: any attribute can +// have a parent attribute and a child attribute (except the first and the last +// one). A string representation of the chain of attributes in NeoFS Storage +// Node configuration uses ":" and "/" symbols, e.g.: +// +// `NEOFS_NODE_ATTRIBUTE_1=key1:val1/key2:val2` +// +// Therefore the string attribute representation in the Node configuration must +// use "\:", "\/" and "\\" escaped symbols if any of them appears in an attribute's +// key or value. +// // Node's attributes are mostly used during Storage Policy evaluation to // calculate object's placement and find a set of nodes satisfying policy // requirements. There are some "well-known" node attributes common to all the diff --git a/v2/object/grpc/types.pb.go b/v2/object/grpc/types.pb.go index 6334877..1da2414 100644 --- a/v2/object/grpc/types.pb.go +++ b/v2/object/grpc/types.pb.go @@ -28,14 +28,13 @@ const ( const _ = proto.ProtoPackageIsVersion4 // Type of the object payload content. Only `REGULAR` type objects can be split, -// hence `TOMBSTONE` and `STORAGEGROUP` payload is limited by maximal object +// hence `TOMBSTONE` and `STORAGE_GROUP` payload is limited by maximal object // size. // -// String presentation of object type is PascalCased `ObjectType` enumeration -// item name: -// * Regular -// * Tombstone -// * StorageGroup +// String presentation of object type is the same as definition: +// * REGULAR +// * TOMBSTONE +// * STORAGE_GROUP type ObjectType int32 const ( @@ -100,6 +99,8 @@ const ( MatchType_STRING_NOT_EQUAL MatchType = 2 // Lack of key MatchType_NOT_PRESENT MatchType = 3 + // String prefix match + MatchType_COMMON_PREFIX MatchType = 4 ) // Enum value maps for MatchType. @@ -109,12 +110,14 @@ var ( 1: "STRING_EQUAL", 2: "STRING_NOT_EQUAL", 3: "NOT_PRESENT", + 4: "COMMON_PREFIX", } MatchType_value = map[string]int32{ "MATCH_TYPE_UNSPECIFIED": 0, "STRING_EQUAL": 1, "STRING_NOT_EQUAL": 2, "NOT_PRESENT": 3, + "COMMON_PREFIX": 4, } ) @@ -849,19 +852,20 @@ var file_v2_object_grpc_types_proto_rawDesc = []byte{ 0x0a, 0x0a, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x52, 0x45, 0x47, 0x55, 0x4c, 0x41, 0x52, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x54, 0x4f, 0x4d, 0x42, 0x53, 0x54, 0x4f, 0x4e, 0x45, 0x10, 0x01, 0x12, 0x11, 0x0a, 0x0d, 0x53, 0x54, 0x4f, 0x52, - 0x41, 0x47, 0x45, 0x5f, 0x47, 0x52, 0x4f, 0x55, 0x50, 0x10, 0x02, 0x2a, 0x60, 0x0a, 0x09, 0x4d, + 0x41, 0x47, 0x45, 0x5f, 0x47, 0x52, 0x4f, 0x55, 0x50, 0x10, 0x02, 0x2a, 0x73, 0x0a, 0x09, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1a, 0x0a, 0x16, 0x4d, 0x41, 0x54, 0x43, 0x48, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x10, 0x0a, 0x0c, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x5f, 0x45, 0x51, 0x55, 0x41, 0x4c, 0x10, 0x01, 0x12, 0x14, 0x0a, 0x10, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x45, 0x51, 0x55, 0x41, 0x4c, 0x10, 0x02, 0x12, 0x0f, 0x0a, 0x0b, - 0x4e, 0x4f, 0x54, 0x5f, 0x50, 0x52, 0x45, 0x53, 0x45, 0x4e, 0x54, 0x10, 0x03, 0x42, 0x56, 0x5a, - 0x37, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, - 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, - 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2f, 0x67, 0x72, 0x70, - 0x63, 0x3b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0xaa, 0x02, 0x1a, 0x4e, 0x65, 0x6f, 0x2e, 0x46, - 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x4f, - 0x62, 0x6a, 0x65, 0x63, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x4e, 0x4f, 0x54, 0x5f, 0x50, 0x52, 0x45, 0x53, 0x45, 0x4e, 0x54, 0x10, 0x03, 0x12, 0x11, 0x0a, + 0x0d, 0x43, 0x4f, 0x4d, 0x4d, 0x4f, 0x4e, 0x5f, 0x50, 0x52, 0x45, 0x46, 0x49, 0x58, 0x10, 0x04, + 0x42, 0x56, 0x5a, 0x37, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, + 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, + 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2f, + 0x67, 0x72, 0x70, 0x63, 0x3b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0xaa, 0x02, 0x1a, 0x4e, 0x65, + 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, + 0x49, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( From de3242d867b8692463ee14838d091f2956a3edbe Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Mon, 16 Aug 2021 14:42:16 +0300 Subject: [PATCH 0892/1196] [#331] v2/object: Sync method name and its commentary Signed-off-by: Pavel Karpy --- v2/object/grpc/types.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/v2/object/grpc/types.go b/v2/object/grpc/types.go index 28eafb7..350056d 100644 --- a/v2/object/grpc/types.go +++ b/v2/object/grpc/types.go @@ -54,7 +54,7 @@ func (m *Header_Split) SetChildren(v []*refs.ObjectID) { } } -// SetSplitID sets split ID of the object. +// SetSplitId sets split ID of the object. func (m *Header_Split) SetSplitId(v []byte) { if m != nil { m.SplitId = v From e6cd9c48edccfe1a7ce35c5ebca50b58ca56a0fe Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Mon, 16 Aug 2021 14:58:57 +0300 Subject: [PATCH 0893/1196] [#331] v2/object: Add COMMON_PREFIX v2 matchtype enum constant Signed-off-by: Pavel Karpy --- v2/object/types.go | 1 + 1 file changed, 1 insertion(+) diff --git a/v2/object/types.go b/v2/object/types.go index 6b1dcc3..94e9ed9 100644 --- a/v2/object/types.go +++ b/v2/object/types.go @@ -312,6 +312,7 @@ const ( MatchStringEqual MatchStringNotEqual MatchNotPresent + MatchCommonPrefix ) func (h *ShortHeader) GetVersion() *refs.Version { From 4e7a966a49820ddea9e5ae8c8d28e8bf3375b0c7 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Mon, 16 Aug 2021 14:59:21 +0300 Subject: [PATCH 0894/1196] [#331] pkg/object: Add COMMON_PREFIX matchtype enum constant and test case for it Signed-off-by: Pavel Karpy --- pkg/object/search.go | 6 ++++++ pkg/object/search_test.go | 17 +++++++++-------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/pkg/object/search.go b/pkg/object/search.go index 438d0aa..cf703f5 100644 --- a/pkg/object/search.go +++ b/pkg/object/search.go @@ -18,6 +18,7 @@ const ( MatchStringEqual MatchStringNotEqual MatchNotPresent + MatchCommonPrefix ) func (m SearchMatchType) ToV2() v2object.MatchType { @@ -28,6 +29,8 @@ func (m SearchMatchType) ToV2() v2object.MatchType { return v2object.MatchStringNotEqual case MatchNotPresent: return v2object.MatchNotPresent + case MatchCommonPrefix: + return v2object.MatchCommonPrefix default: return v2object.MatchUnknown } @@ -41,6 +44,8 @@ func SearchMatchFromV2(t v2object.MatchType) (m SearchMatchType) { m = MatchStringNotEqual case v2object.MatchNotPresent: m = MatchNotPresent + case v2object.MatchCommonPrefix: + m = MatchCommonPrefix default: m = MatchUnknown } @@ -54,6 +59,7 @@ func SearchMatchFromV2(t v2object.MatchType) (m SearchMatchType) { // * MatchStringEqual: STRING_EQUAL; // * MatchStringNotEqual: STRING_NOT_EQUAL; // * MatchNotPresent: NOT_PRESENT; +// * MatchCommonPrefix: COMMON_PREFIX; // * MatchUnknown, default: MATCH_TYPE_UNSPECIFIED. func (m SearchMatchType) String() string { return m.ToV2().String() diff --git a/pkg/object/search_test.go b/pkg/object/search_test.go index 36870bb..33b52e9 100644 --- a/pkg/object/search_test.go +++ b/pkg/object/search_test.go @@ -10,14 +10,13 @@ import ( "github.com/stretchr/testify/require" ) -var ( - eqV2Matches = map[object.SearchMatchType]v2object.MatchType{ - object.MatchUnknown: v2object.MatchUnknown, - object.MatchStringEqual: v2object.MatchStringEqual, - object.MatchStringNotEqual: v2object.MatchStringNotEqual, - object.MatchNotPresent: v2object.MatchNotPresent, - } -) +var eqV2Matches = map[object.SearchMatchType]v2object.MatchType{ + object.MatchUnknown: v2object.MatchUnknown, + object.MatchStringEqual: v2object.MatchStringEqual, + object.MatchStringNotEqual: v2object.MatchStringNotEqual, + object.MatchNotPresent: v2object.MatchNotPresent, + object.MatchCommonPrefix: v2object.MatchCommonPrefix, +} func TestMatch(t *testing.T) { t.Run("known matches", func(t *testing.T) { @@ -181,6 +180,7 @@ func TestSearchFiltersEncoding(t *testing.T) { fs := object.NewSearchFilters() fs.AddFilter("key 1", "value 2", object.MatchStringEqual) fs.AddFilter("key 2", "value 2", object.MatchStringNotEqual) + fs.AddFilter("key 2", "value 2", object.MatchCommonPrefix) t.Run("json", func(t *testing.T) { data, err := fs.MarshalJSON() @@ -199,6 +199,7 @@ func TestSearchMatchType_String(t *testing.T) { } testEnumStrings(t, new(object.SearchMatchType), []enumStringItem{ + {val: toPtr(object.MatchCommonPrefix), str: "COMMON_PREFIX"}, {val: toPtr(object.MatchStringEqual), str: "STRING_EQUAL"}, {val: toPtr(object.MatchStringNotEqual), str: "STRING_NOT_EQUAL"}, {val: toPtr(object.MatchNotPresent), str: "NOT_PRESENT"}, From 86df0eac937a92daee429037fe4ef399cf475c72 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Wed, 25 Aug 2021 14:11:07 +0300 Subject: [PATCH 0895/1196] [#333] v2/acl: Remove FilterObjectParent constant According to specification, well-known object related filter keys for extended ACL do not include `$Object:split.parent`. Signed-off-by: Alex Vanin --- v2/acl/filters.go | 3 --- 1 file changed, 3 deletions(-) diff --git a/v2/acl/filters.go b/v2/acl/filters.go index 461d2b9..c1d8afe 100644 --- a/v2/acl/filters.go +++ b/v2/acl/filters.go @@ -30,7 +30,4 @@ const ( // FilterObjectHomomorphicHash is a filter key to "homomorphic_hash" field of the object header. FilterObjectHomomorphicHash = ObjectFilterPrefix + "homomorphicHash" - - // FilterObjectParent is a filter key to "split.parent" field of the object header. - FilterObjectParent = ObjectFilterPrefix + "split.parent" ) From 1ddc98dc750cb886d2c4337b68c65d6928c7bcd2 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Wed, 25 Aug 2021 14:11:35 +0300 Subject: [PATCH 0896/1196] [#333] pkg/acl: Add remaining well-known eACL filter setters Signed-off-by: Alex Vanin --- pkg/acl/eacl/filter.go | 7 +++ pkg/acl/eacl/record.go | 31 ++++++++++- pkg/acl/eacl/record_test.go | 103 ++++++++++++++++++++++++++++++++++++ 3 files changed, 140 insertions(+), 1 deletion(-) diff --git a/pkg/acl/eacl/filter.go b/pkg/acl/eacl/filter.go index 03c093e..23e7677 100644 --- a/pkg/acl/eacl/filter.go +++ b/pkg/acl/eacl/filter.go @@ -2,6 +2,7 @@ package eacl import ( "fmt" + "strconv" v2acl "github.com/nspcc-dev/neofs-api-go/v2/acl" ) @@ -19,6 +20,8 @@ type Filter struct { type staticStringer string +type u64Stringer uint64 + type filterKey struct { typ filterKeyType @@ -45,6 +48,10 @@ func (s staticStringer) String() string { return string(s) } +func (u u64Stringer) String() string { + return strconv.FormatUint(uint64(u), 10) +} + // Value returns filtered string value. func (f Filter) Value() string { return f.value.String() diff --git a/pkg/acl/eacl/record.go b/pkg/acl/eacl/record.go index 7ba9743..b12d52a 100644 --- a/pkg/acl/eacl/record.go +++ b/pkg/acl/eacl/record.go @@ -6,6 +6,7 @@ import ( "github.com/nspcc-dev/neofs-api-go/pkg" cid "github.com/nspcc-dev/neofs-api-go/pkg/container/id" + "github.com/nspcc-dev/neofs-api-go/pkg/object" "github.com/nspcc-dev/neofs-api-go/pkg/owner" v2acl "github.com/nspcc-dev/neofs-api-go/v2/acl" ) @@ -115,6 +116,11 @@ func (r *Record) AddObjectVersionFilter(m Match, v *pkg.Version) { r.addObjectReservedFilter(m, fKeyObjVersion, v) } +// AddObjectIDFilter adds filter by object ID. +func (r *Record) AddObjectIDFilter(m Match, id *object.ID) { + r.addObjectReservedFilter(m, fKeyObjID, id) +} + // AddObjectContainerIDFilter adds filter by object container ID. func (r *Record) AddObjectContainerIDFilter(m Match, id *cid.ID) { r.addObjectReservedFilter(m, fKeyObjContainerID, id) @@ -125,7 +131,30 @@ func (r *Record) AddObjectOwnerIDFilter(m Match, id *owner.ID) { r.addObjectReservedFilter(m, fKeyObjOwnerID, id) } -// TODO: add remaining filters after neofs-api#72 +// AddObjectCreationEpoch adds filter by object creation epoch. +func (r *Record) AddObjectCreationEpoch(m Match, epoch uint64) { + r.addObjectReservedFilter(m, fKeyObjCreationEpoch, u64Stringer(epoch)) +} + +// AddObjectPayloadLengthFilter adds filter by object payload length. +func (r *Record) AddObjectPayloadLengthFilter(m Match, size uint64) { + r.addObjectReservedFilter(m, fKeyObjPayloadLength, u64Stringer(size)) +} + +// AddObjectPayloadHashFilter adds filter by object payload hash value. +func (r *Record) AddObjectPayloadHashFilter(m Match, h *pkg.Checksum) { + r.addObjectReservedFilter(m, fKeyObjPayloadHash, h) +} + +// AddObjectTypeFilter adds filter by object type. +func (r *Record) AddObjectTypeFilter(m Match, t object.Type) { + r.addObjectReservedFilter(m, fKeyObjType, t) +} + +// AddObjectHomomorphicHashFilter adds filter by object payload homomorphic hash value. +func (r *Record) AddObjectHomomorphicHashFilter(m Match, h *pkg.Checksum) { + r.addObjectReservedFilter(m, fKeyObjHomomorphicHash, h) +} // ToV2 converts Record to v2 acl.EACLRecord message. // diff --git a/pkg/acl/eacl/record_test.go b/pkg/acl/eacl/record_test.go index 7ed59dd..1baaf4a 100644 --- a/pkg/acl/eacl/record_test.go +++ b/pkg/acl/eacl/record_test.go @@ -2,8 +2,14 @@ package eacl import ( "crypto/ecdsa" + "fmt" "testing" + cidtest "github.com/nspcc-dev/neofs-api-go/pkg/container/id/test" + "github.com/nspcc-dev/neofs-api-go/pkg/object" + objecttest "github.com/nspcc-dev/neofs-api-go/pkg/object/test" + ownertest "github.com/nspcc-dev/neofs-api-go/pkg/owner/test" + refstest "github.com/nspcc-dev/neofs-api-go/pkg/test" v2acl "github.com/nspcc-dev/neofs-api-go/v2/acl" "github.com/nspcc-dev/neofs-crypto/test" "github.com/stretchr/testify/require" @@ -145,3 +151,100 @@ func TestRecord_ToV2(t *testing.T) { require.Nil(t, recordV2.GetFilters()) }) } + +func TestReservedRecords(t *testing.T) { + var ( + v = refstest.Version() + oid = objecttest.ID() + cid = cidtest.Generate() + ownerid = ownertest.Generate() + h = refstest.Checksum() + typ = new(object.Type) + ) + + testSuit := []struct { + f func(r *Record) + key string + value string + }{ + { + f: func(r *Record) { r.AddObjectAttributeFilter(MatchStringEqual, "foo", "bar") }, + key: "foo", + value: "bar", + }, + { + f: func(r *Record) { r.AddObjectVersionFilter(MatchStringEqual, v) }, + key: v2acl.FilterObjectVersion, + value: v.String(), + }, + { + f: func(r *Record) { r.AddObjectIDFilter(MatchStringEqual, oid) }, + key: v2acl.FilterObjectID, + value: oid.String(), + }, + { + f: func(r *Record) { r.AddObjectContainerIDFilter(MatchStringEqual, cid) }, + key: v2acl.FilterObjectContainerID, + value: cid.String(), + }, + { + f: func(r *Record) { r.AddObjectOwnerIDFilter(MatchStringEqual, ownerid) }, + key: v2acl.FilterObjectOwnerID, + value: ownerid.String(), + }, + { + f: func(r *Record) { r.AddObjectCreationEpoch(MatchStringEqual, 100) }, + key: v2acl.FilterObjectCreationEpoch, + value: "100", + }, + { + f: func(r *Record) { r.AddObjectPayloadLengthFilter(MatchStringEqual, 5000) }, + key: v2acl.FilterObjectPayloadLength, + value: "5000", + }, + { + f: func(r *Record) { r.AddObjectPayloadHashFilter(MatchStringEqual, h) }, + key: v2acl.FilterObjectPayloadHash, + value: h.String(), + }, + { + f: func(r *Record) { r.AddObjectHomomorphicHashFilter(MatchStringEqual, h) }, + key: v2acl.FilterObjectHomomorphicHash, + value: h.String(), + }, + { + f: func(r *Record) { + require.True(t, typ.FromString("REGULAR")) + r.AddObjectTypeFilter(MatchStringEqual, *typ) + }, + key: v2acl.FilterObjectType, + value: "REGULAR", + }, + { + f: func(r *Record) { + require.True(t, typ.FromString("TOMBSTONE")) + r.AddObjectTypeFilter(MatchStringEqual, *typ) + }, + key: v2acl.FilterObjectType, + value: "TOMBSTONE", + }, + { + f: func(r *Record) { + require.True(t, typ.FromString("STORAGE_GROUP")) + r.AddObjectTypeFilter(MatchStringEqual, *typ) + }, + key: v2acl.FilterObjectType, + value: "STORAGE_GROUP", + }, + } + + for n, testCase := range testSuit { + desc := fmt.Sprintf("case #%d", n) + record := NewRecord() + testCase.f(record) + require.Len(t, record.Filters(), 1, desc) + f := record.Filters()[0] + require.Equal(t, f.Key(), testCase.key, desc) + require.Equal(t, f.Value(), testCase.value, desc) + } +} From a2dd61300a359d0744d391710ba51abe7d88a677 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Fri, 27 Aug 2021 10:44:03 +0300 Subject: [PATCH 0897/1196] Update release instruction Signed-off-by: Pavel Karpy --- docs/release-instruction.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/release-instruction.md b/docs/release-instruction.md index d6d13e5..5318755 100644 --- a/docs/release-instruction.md +++ b/docs/release-instruction.md @@ -19,6 +19,14 @@ other changes. Open Pull Request (must receive at least one approval) and merge this changes. +## Update README + +Actualize compatibility table in `README.md` with relevant information. + +## Update version + +Actualize minor/major version constants in `pkg/version.go` file. + ## Tag a release Use `vX.Y.Z` tag for releases and `vX.Y.Z-rc.N` for release candidates From 6d0b3135ff2337be338a8c5cef5449ac3a06b58e Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Thu, 26 Aug 2021 19:02:40 +0300 Subject: [PATCH 0898/1196] =?UTF-8?q?Release=20v1.29.0=20-=20Anmyeondo=20(?= =?UTF-8?q?=EC=95=88=EB=A9=B4=EB=8F=84,=20=E5=AE=89=E7=9C=A0=E5=B3=B6)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Pavel Karpy --- CHANGELOG.md | 22 ++++++++++++++++++++++ README.md | 1 + pkg/version.go | 2 +- 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 237ad63..fd0cf41 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,26 @@ # Changelog +## [1.29.0] - 2021-08-27 - Anmyeondo (안면도, 安眠島) + +### Fixed + +- Well-known BasicACL constants to fit the specification (#330, #334). +- Linter warnings (#335). + +### Added + +- Support for `COMMON_PREFIX` filter operation for object attributes (#331). +- Missing well-known eACL filter setters (#333). + +### Removed + +- `FilterObjectParent` well-known object related filter key (#333). + +### Updated + +- Go version to `1.16` (#335). +- Tests in CI to run on `1.16` and `1.17` Go versions (#335). + ## [1.28.3] - 2021-07-07 ### Fixed @@ -690,3 +711,4 @@ Initial public release [1.28.1]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.28.0...v1.28.1 [1.28.2]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.28.1...v1.28.2 [1.28.3]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.28.2...v1.28.3 +[1.29.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.28.3...v1.29.0 diff --git a/README.md b/README.md index b7dcedb..61cccb0 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,7 @@ versions and SDK layer working with all of them in a handy way. |v1.26.x|[v2.6.0](https://github.com/nspcc-dev/neofs-api/releases/tag/v2.6.0)| |v1.27.x|[v2.7.0](https://github.com/nspcc-dev/neofs-api/releases/tag/v2.7.0)| |v1.28.x|[v2.8.0](https://github.com/nspcc-dev/neofs-api/releases/tag/v2.8.0)| +|v1.29.x|[v2.9.1](https://github.com/nspcc-dev/neofs-api/releases/tag/v2.9.1)| ## Contributing diff --git a/pkg/version.go b/pkg/version.go index 928566c..85066eb 100644 --- a/pkg/version.go +++ b/pkg/version.go @@ -9,7 +9,7 @@ import ( // Version represents v2-compatible version. type Version refs.Version -const sdkMjr, sdkMnr = 2, 8 +const sdkMjr, sdkMnr = 2, 9 // NewVersionFromV2 wraps v2 Version message to Version. // From e887368be6bb86bf0df1c05b061d6177f6539bc3 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 20 Sep 2021 14:30:00 +0300 Subject: [PATCH 0899/1196] [#340] owner: Prevent potential NPE in NEO3WalletFromPublicKey Copy `Curve` field of `ecdsa.PublicKey` arg to `keys.PublicKey` instance in `NEO3WalletFromPublicKey` function. Signed-off-by: Leonard Lyubich --- pkg/owner/wallet.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/owner/wallet.go b/pkg/owner/wallet.go index afca654..83d3b47 100644 --- a/pkg/owner/wallet.go +++ b/pkg/owner/wallet.go @@ -22,8 +22,9 @@ func NEO3WalletFromPublicKey(key *ecdsa.PublicKey) (*NEO3Wallet, error) { } neoPublicKey := keys.PublicKey{ - X: key.X, - Y: key.Y, + Curve: key.Curve, + X: key.X, + Y: key.Y, } d, err := base58.Decode(neoPublicKey.Address()) From 3844a3ac741ada8e831bea2acfae96819661a13f Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 27 Sep 2021 14:31:38 +0300 Subject: [PATCH 0900/1196] [#342] v2/reputation: Fix incorrect return of AnnounceIntermediateResult Return `AnnounceIntermediateResultResponse` instead of `AnnounceIntermediateResultRequest` from `rpc.AnnounceIntermediateResult`. Signed-off-by: Leonard Lyubich --- v2/rpc/reputation.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/v2/rpc/reputation.go b/v2/rpc/reputation.go index 3706e38..ad9d2d9 100644 --- a/v2/rpc/reputation.go +++ b/v2/rpc/reputation.go @@ -34,8 +34,8 @@ func AnnounceIntermediateResult( cli *client.Client, req *reputation.AnnounceIntermediateResultRequest, opts ...client.CallOption, -) (*reputation.AnnounceIntermediateResultRequest, error) { - resp := new(reputation.AnnounceIntermediateResultRequest) +) (*reputation.AnnounceIntermediateResultResponse, error) { + resp := new(reputation.AnnounceIntermediateResultResponse) err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceReputation, rpcReputationAnnounceIntermediateResult), req, resp, opts...) if err != nil { From da89c2b71fa262cb49766f998a7b9c28a8725733 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 27 Sep 2021 14:42:16 +0300 Subject: [PATCH 0901/1196] [#337] client: Add option to specify callback of response information There is a need to analyze some response information in API client. Define `ResponseMetaInfo` structure of response information. Add `WithResponseInfoHandler` client option which allows to set the response info callback. The callback is called right after any response is received. Signed-off-by: Leonard Lyubich --- pkg/client/accounting.go | 5 +++++ pkg/client/container.go | 35 +++++++++++++++++++++++++++++++++++ pkg/client/netmap.go | 10 ++++++++++ pkg/client/object.go | 35 +++++++++++++++++++++++++++++++++++ pkg/client/opts.go | 2 ++ pkg/client/reputation.go | 10 ++++++++++ pkg/client/response.go | 37 +++++++++++++++++++++++++++++++++++++ pkg/client/session.go | 5 +++++ 8 files changed, 139 insertions(+) create mode 100644 pkg/client/response.go diff --git a/pkg/client/accounting.go b/pkg/client/accounting.go index 580b225..db1f8a4 100644 --- a/pkg/client/accounting.go +++ b/pkg/client/accounting.go @@ -43,6 +43,11 @@ func (c *clientImpl) GetBalance(ctx context.Context, owner *owner.ID, opts ...Ca return nil, fmt.Errorf("transport error: %w", err) } + // handle response meta info + if err := c.handleResponseInfoV2(callOptions, resp); err != nil { + return nil, err + } + err = v2signature.VerifyServiceMessage(resp) if err != nil { return nil, fmt.Errorf("can't verify response message: %w", err) diff --git a/pkg/client/container.go b/pkg/client/container.go index b021813..02c7993 100644 --- a/pkg/client/container.go +++ b/pkg/client/container.go @@ -130,6 +130,11 @@ func (c *clientImpl) PutContainer(ctx context.Context, cnr *container.Container, return nil, err } + // handle response meta info + if err := c.handleResponseInfoV2(callOptions, resp); err != nil { + return nil, err + } + err = v2signature.VerifyServiceMessage(resp) if err != nil { return nil, fmt.Errorf("can't verify response message: %w", err) @@ -166,6 +171,11 @@ func (c *clientImpl) GetContainer(ctx context.Context, id *cid.ID, opts ...CallO return nil, fmt.Errorf("transport error: %w", err) } + // handle response meta info + if err := c.handleResponseInfoV2(callOptions, resp); err != nil { + return nil, err + } + err = v2signature.VerifyServiceMessage(resp) if err != nil { return nil, fmt.Errorf("can't verify response message: %w", err) @@ -238,6 +248,11 @@ func (c *clientImpl) ListContainers(ctx context.Context, ownerID *owner.ID, opts return nil, fmt.Errorf("transport error: %w", err) } + // handle response meta info + if err := c.handleResponseInfoV2(callOptions, resp); err != nil { + return nil, err + } + err = v2signature.VerifyServiceMessage(resp) if err != nil { return nil, fmt.Errorf("can't verify response message: %w", err) @@ -292,6 +307,11 @@ func (c *clientImpl) DeleteContainer(ctx context.Context, id *cid.ID, opts ...Ca return fmt.Errorf("transport error: %w", err) } + // handle response meta info + if err := c.handleResponseInfoV2(callOptions, resp); err != nil { + return err + } + if err := v2signature.VerifyServiceMessage(resp); err != nil { return fmt.Errorf("can't verify response message: %w", err) } @@ -324,6 +344,11 @@ func (c *clientImpl) GetEACL(ctx context.Context, id *cid.ID, opts ...CallOption return nil, fmt.Errorf("transport error: %w", err) } + // handle response meta info + if err := c.handleResponseInfoV2(callOptions, resp); err != nil { + return nil, err + } + err = v2signature.VerifyServiceMessage(resp) if err != nil { return nil, fmt.Errorf("can't verify response message: %w", err) @@ -388,6 +413,11 @@ func (c *clientImpl) SetEACL(ctx context.Context, eacl *eacl.Table, opts ...Call return fmt.Errorf("transport error: %w", err) } + // handle response meta info + if err := c.handleResponseInfoV2(callOptions, resp); err != nil { + return err + } + err = v2signature.VerifyServiceMessage(resp) if err != nil { return fmt.Errorf("can't verify response message: %w", err) @@ -433,6 +463,11 @@ func (c *clientImpl) AnnounceContainerUsedSpace( return fmt.Errorf("transport error: %w", err) } + // handle response meta info + if err := c.handleResponseInfoV2(callOptions, resp); err != nil { + return err + } + err = v2signature.VerifyServiceMessage(resp) if err != nil { return fmt.Errorf("can't verify response message: %w", err) diff --git a/pkg/client/netmap.go b/pkg/client/netmap.go index be551f0..6f3291c 100644 --- a/pkg/client/netmap.go +++ b/pkg/client/netmap.go @@ -67,6 +67,11 @@ func (c *clientImpl) EndpointInfo(ctx context.Context, opts ...CallOption) (*End return nil, fmt.Errorf("transport error: %w", err) } + // handle response meta info + if err := c.handleResponseInfoV2(callOptions, resp); err != nil { + return nil, err + } + err = v2signature.VerifyServiceMessage(resp) if err != nil { return nil, fmt.Errorf("can't verify response message: %w", err) @@ -105,6 +110,11 @@ func (c *clientImpl) NetworkInfo(ctx context.Context, opts ...CallOption) (*netm return nil, fmt.Errorf("v2 NetworkInfo RPC failure: %w", err) } + // handle response meta info + if err := c.handleResponseInfoV2(callOptions, resp); err != nil { + return nil, err + } + err = v2signature.VerifyServiceMessage(resp) if err != nil { return nil, fmt.Errorf("response message verification failed: %w", err) diff --git a/pkg/client/object.go b/pkg/client/object.go index 6fd25ad..bc0f2e5 100644 --- a/pkg/client/object.go +++ b/pkg/client/object.go @@ -313,6 +313,11 @@ func (c *clientImpl) PutObject(ctx context.Context, p *PutObjectParams, opts ... return nil, fmt.Errorf("closing the stream failed: %w", err) } + // handle response meta info + if err := c.handleResponseInfoV2(callOpts, resp); err != nil { + return nil, err + } + // verify response structure if err := signature.VerifyServiceMessage(resp); err != nil { return nil, fmt.Errorf("response verification failed: %w", err) @@ -417,6 +422,11 @@ func (c *clientImpl) DeleteObject(ctx context.Context, p *DeleteObjectParams, op return fmt.Errorf("sending the request failed: %w", err) } + // handle response meta info + if err := c.handleResponseInfoV2(callOpts, resp); err != nil { + return err + } + // verify response structure if err := signature.VerifyServiceMessage(resp); err != nil { return fmt.Errorf("response verification failed: %w", err) @@ -623,6 +633,11 @@ loop: return nil, fmt.Errorf("reading the response failed: %w", err) } + // handle response meta info + if err := c.handleResponseInfoV2(callOpts, resp); err != nil { + return nil, err + } + // verify response structure if err := signature.VerifyServiceMessage(resp); err != nil { return nil, fmt.Errorf("response verification failed: %w", err) @@ -781,6 +796,11 @@ func (c *clientImpl) GetObjectHeader(ctx context.Context, p *ObjectHeaderParams, return nil, fmt.Errorf("sending the request failed: %w", err) } + // handle response meta info + if err := c.handleResponseInfoV2(callOpts, resp); err != nil { + return nil, err + } + // verify response structure if err := signature.VerifyServiceMessage(resp); err != nil { return nil, fmt.Errorf("response verification failed: %w", err) @@ -979,6 +999,11 @@ func (c *clientImpl) ObjectPayloadRangeData(ctx context.Context, p *RangeDataPar return nil, fmt.Errorf("reading the response failed: %w", err) } + // handle response meta info + if err := c.handleResponseInfoV2(callOpts, resp); err != nil { + return nil, err + } + // verify response structure if err := signature.VerifyServiceMessage(resp); err != nil { return nil, fmt.Errorf("could not verify %T: %w", resp, err) @@ -1128,6 +1153,11 @@ func (c *clientImpl) objectPayloadRangeHash(ctx context.Context, p *RangeChecksu return nil, fmt.Errorf("sending the request failed: %w", err) } + // handle response meta info + if err := c.handleResponseInfoV2(callOpts, resp); err != nil { + return nil, err + } + // verify response structure if err := signature.VerifyServiceMessage(resp); err != nil { return nil, fmt.Errorf("response verification failed: %w", err) @@ -1276,6 +1306,11 @@ func (c *clientImpl) SearchObject(ctx context.Context, p *SearchObjectParams, op return nil, fmt.Errorf("reading the response failed: %w", err) } + // handle response meta info + if err := c.handleResponseInfoV2(callOpts, resp); err != nil { + return nil, err + } + // verify response structure if err := signature.VerifyServiceMessage(resp); err != nil { return nil, fmt.Errorf("could not verify %T: %w", resp, err) diff --git a/pkg/client/opts.go b/pkg/client/opts.go index 8a998ed..af9cedf 100644 --- a/pkg/client/opts.go +++ b/pkg/client/opts.go @@ -33,6 +33,8 @@ type ( key *ecdsa.PrivateKey rawOpts []client.Option + + cbRespInfo func(ResponseMetaInfo) error } v2SessionReqInfo struct { diff --git a/pkg/client/reputation.go b/pkg/client/reputation.go index ec55218..ff82496 100644 --- a/pkg/client/reputation.go +++ b/pkg/client/reputation.go @@ -77,6 +77,11 @@ func (c *clientImpl) AnnounceLocalTrust(ctx context.Context, prm AnnounceLocalTr return nil, err } + // handle response meta info + if err := c.handleResponseInfoV2(callOptions, resp); err != nil { + return nil, err + } + err = v2signature.VerifyServiceMessage(resp) if err != nil { return nil, fmt.Errorf("can't verify response message: %w", err) @@ -152,6 +157,11 @@ func (c *clientImpl) AnnounceIntermediateTrust(ctx context.Context, prm Announce return nil, err } + // handle response meta info + if err := c.handleResponseInfoV2(callOptions, resp); err != nil { + return nil, err + } + err = v2signature.VerifyServiceMessage(resp) if err != nil { return nil, fmt.Errorf("can't verify response message: %w", err) diff --git a/pkg/client/response.go b/pkg/client/response.go new file mode 100644 index 0000000..6948844 --- /dev/null +++ b/pkg/client/response.go @@ -0,0 +1,37 @@ +package client + +import ( + "github.com/nspcc-dev/neofs-api-go/v2/session" +) + +// ResponseMetaInfo groups meta information about any NeoFS API response. +type ResponseMetaInfo struct { + key []byte +} + +// ResponderKey returns responder's public key in a binary format. +// +// Result must not be mutated. +func (x ResponseMetaInfo) ResponderKey() []byte { + return x.key +} + +// WithResponseInfoHandler allows to specify handler of response meta information for the all Client operations. +// The handler is called right after the response is received. Client returns handler's error immediately. +func WithResponseInfoHandler(f func(ResponseMetaInfo) error) Option { + return func(opts *clientOptions) { + opts.cbRespInfo = f + } +} + +func (c *clientImpl) handleResponseInfoV2(opts *callOptions, resp interface { + GetVerificationHeader() *session.ResponseVerificationHeader +}) error { + if c.opts.cbRespInfo == nil { + return nil + } + + return c.opts.cbRespInfo(ResponseMetaInfo{ + key: resp.GetVerificationHeader().GetBodySignature().GetKey(), + }) +} diff --git a/pkg/client/session.go b/pkg/client/session.go index 24bae6a..46ec399 100644 --- a/pkg/client/session.go +++ b/pkg/client/session.go @@ -55,6 +55,11 @@ func (c *clientImpl) CreateSession(ctx context.Context, expiration uint64, opts return nil, fmt.Errorf("transport error: %w", err) } + // handle response meta info + if err := c.handleResponseInfoV2(callOptions, resp); err != nil { + return nil, err + } + err = v2signature.VerifyServiceMessage(resp) if err != nil { return nil, fmt.Errorf("can't verify response message: %w", err) From 520a065dd2bb2a5871483481e7aaaaff996bf565 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Tue, 14 Sep 2021 13:51:20 +0300 Subject: [PATCH 0902/1196] [#338] v2/acl: add `Service` filter type Signed-off-by: Evgenii Stratonikov --- pkg/acl/eacl/enums.go | 7 ++ pkg/acl/eacl/enums_test.go | 7 +- v2/acl/convert.go | 4 + v2/acl/grpc/types.pb.go | 199 +++++++++++++++++++------------------ v2/acl/types.go | 1 + 5 files changed, 118 insertions(+), 100 deletions(-) diff --git a/pkg/acl/eacl/enums.go b/pkg/acl/eacl/enums.go index 39a4253..2e8fc1f 100644 --- a/pkg/acl/eacl/enums.go +++ b/pkg/acl/eacl/enums.go @@ -96,6 +96,9 @@ const ( // HeaderFromObject is a FilterHeaderType for object header. HeaderFromObject + + // HeaderFromService is a FilterHeaderType for service header. + HeaderFromService ) // ToV2 converts Action to v2 Action enum value. @@ -343,6 +346,8 @@ func (h FilterHeaderType) ToV2() v2acl.HeaderType { return v2acl.HeaderTypeRequest case HeaderFromObject: return v2acl.HeaderTypeObject + case HeaderFromService: + return v2acl.HeaderTypeService default: return v2acl.HeaderTypeUnknown } @@ -355,6 +360,8 @@ func FilterHeaderTypeFromV2(header v2acl.HeaderType) (h FilterHeaderType) { h = HeaderFromRequest case v2acl.HeaderTypeObject: h = HeaderFromObject + case v2acl.HeaderTypeService: + h = HeaderFromService default: h = HeaderTypeUnknown } diff --git a/pkg/acl/eacl/enums_test.go b/pkg/acl/eacl/enums_test.go index 5352849..d077a89 100644 --- a/pkg/acl/eacl/enums_test.go +++ b/pkg/acl/eacl/enums_test.go @@ -43,6 +43,7 @@ var ( eacl.HeaderTypeUnknown: v2acl.HeaderTypeUnknown, eacl.HeaderFromRequest: v2acl.HeaderTypeRequest, eacl.HeaderFromObject: v2acl.HeaderTypeObject, + eacl.HeaderFromService: v2acl.HeaderTypeService, } ) @@ -104,15 +105,15 @@ func TestMatch(t *testing.T) { func TestFilterHeaderType(t *testing.T) { t.Run("known header types", func(t *testing.T) { - for i := eacl.HeaderTypeUnknown; i <= eacl.HeaderFromObject; i++ { + for i := eacl.HeaderTypeUnknown; i <= eacl.HeaderFromService; i++ { require.Equal(t, eqV2HeaderTypes[i], i.ToV2()) require.Equal(t, eacl.FilterHeaderTypeFromV2(i.ToV2()), i) } }) t.Run("unknown header types", func(t *testing.T) { - require.Equal(t, (eacl.HeaderFromObject + 1).ToV2(), v2acl.HeaderTypeUnknown) - require.Equal(t, eacl.FilterHeaderTypeFromV2(v2acl.HeaderTypeObject+1), eacl.HeaderTypeUnknown) + require.Equal(t, (eacl.HeaderFromService + 1).ToV2(), v2acl.HeaderTypeUnknown) + require.Equal(t, eacl.FilterHeaderTypeFromV2(v2acl.HeaderTypeService+1), eacl.HeaderTypeUnknown) }) } diff --git a/v2/acl/convert.go b/v2/acl/convert.go index d4a52b8..d501b56 100644 --- a/v2/acl/convert.go +++ b/v2/acl/convert.go @@ -111,6 +111,8 @@ func HeaderTypeToGRPCField(t HeaderType) acl.HeaderType { return acl.HeaderType_REQUEST case HeaderTypeObject: return acl.HeaderType_OBJECT + case HeaderTypeService: + return acl.HeaderType_SERVICE default: return acl.HeaderType_HEADER_UNSPECIFIED } @@ -123,6 +125,8 @@ func HeaderTypeFromGRPCField(t acl.HeaderType) HeaderType { return HeaderTypeRequest case acl.HeaderType_OBJECT: return HeaderTypeObject + case acl.HeaderType_SERVICE: + return HeaderTypeService default: return HeaderTypeUnknown } diff --git a/v2/acl/grpc/types.pb.go b/v2/acl/grpc/types.pb.go index 319a472..639bdf2 100644 --- a/v2/acl/grpc/types.pb.go +++ b/v2/acl/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.23.0 -// protoc v3.14.0 +// protoc v3.17.3 // source: v2/acl/grpc/types.proto package acl @@ -275,6 +275,9 @@ const ( HeaderType_REQUEST HeaderType = 1 // Filter object headers HeaderType_OBJECT HeaderType = 2 + // Filter service headers. These are not processed by NeoFS nodes and + // exist for service use only. + HeaderType_SERVICE HeaderType = 3 ) // Enum value maps for HeaderType. @@ -283,11 +286,13 @@ var ( 0: "HEADER_UNSPECIFIED", 1: "REQUEST", 2: "OBJECT", + 3: "SERVICE", } HeaderType_value = map[string]int32{ "HEADER_UNSPECIFIED": 0, "REQUEST": 1, "OBJECT": 2, + "SERVICE": 3, } ) @@ -838,104 +843,104 @@ var File_v2_acl_grpc_types_proto protoreflect.FileDescriptor var file_v2_acl_grpc_types_proto_rawDesc = []byte{ 0x0a, 0x17, 0x76, 0x32, 0x2f, 0x61, 0x63, 0x6c, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0d, 0x6e, 0x65, 0x6f, 0x2e, 0x66, - 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x1a, 0x18, 0x76, 0x32, 0x2f, 0x72, 0x65, 0x66, - 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x22, 0xda, 0x03, 0x0a, 0x0a, 0x45, 0x41, 0x43, 0x4c, 0x52, 0x65, 0x63, 0x6f, 0x72, - 0x64, 0x12, 0x36, 0x0a, 0x09, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, - 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x09, - 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2d, 0x0a, 0x06, 0x61, 0x63, 0x74, - 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x15, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, - 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x52, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3a, 0x0a, 0x07, 0x66, 0x69, 0x6c, 0x74, - 0x65, 0x72, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, - 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x45, 0x41, 0x43, 0x4c, 0x52, 0x65, - 0x63, 0x6f, 0x72, 0x64, 0x2e, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x07, 0x66, 0x69, 0x6c, - 0x74, 0x65, 0x72, 0x73, 0x12, 0x3a, 0x0a, 0x07, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x18, - 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, - 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x45, 0x41, 0x43, 0x4c, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, - 0x2e, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x52, 0x07, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, - 0x1a, 0xa5, 0x01, 0x0a, 0x06, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x3a, 0x0a, 0x0b, 0x68, - 0x65, 0x61, 0x64, 0x65, 0x72, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, - 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, - 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x52, 0x0a, 0x68, 0x65, 0x61, - 0x64, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x12, 0x37, 0x0a, 0x0a, 0x6d, 0x61, 0x74, 0x63, 0x68, - 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x6e, 0x65, - 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x4d, 0x61, 0x74, 0x63, - 0x68, 0x54, 0x79, 0x70, 0x65, 0x52, 0x09, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x54, 0x79, 0x70, 0x65, - 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, - 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x1a, 0x45, 0x0a, 0x06, 0x54, 0x61, 0x72, 0x67, - 0x65, 0x74, 0x12, 0x27, 0x0a, 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, - 0x32, 0x13, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, - 0x2e, 0x52, 0x6f, 0x6c, 0x65, 0x52, 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6b, - 0x65, 0x79, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x04, 0x6b, 0x65, 0x79, 0x73, 0x22, - 0xb3, 0x01, 0x0a, 0x09, 0x45, 0x41, 0x43, 0x4c, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x31, 0x0a, - 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x1a, 0x10, 0x72, 0x65, 0x66, 0x73, 0x2f, 0x74, + 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xda, 0x03, 0x0a, 0x0a, 0x45, + 0x41, 0x43, 0x4c, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x12, 0x36, 0x0a, 0x09, 0x6f, 0x70, 0x65, + 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x4f, 0x70, 0x65, + 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x09, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x12, 0x2d, 0x0a, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0e, 0x32, 0x15, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, + 0x6c, 0x2e, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, + 0x12, 0x3a, 0x0a, 0x07, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, + 0x6c, 0x2e, 0x45, 0x41, 0x43, 0x4c, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x2e, 0x46, 0x69, 0x6c, + 0x74, 0x65, 0x72, 0x52, 0x07, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x73, 0x12, 0x3a, 0x0a, 0x07, + 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, + 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x45, 0x41, + 0x43, 0x4c, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x2e, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x52, + 0x07, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x1a, 0xa5, 0x01, 0x0a, 0x06, 0x46, 0x69, 0x6c, + 0x74, 0x65, 0x72, 0x12, 0x3a, 0x0a, 0x0b, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x5f, 0x74, 0x79, + 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x54, + 0x79, 0x70, 0x65, 0x52, 0x0a, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x12, + 0x37, 0x0a, 0x0a, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, + 0x61, 0x63, 0x6c, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x54, 0x79, 0x70, 0x65, 0x52, 0x09, 0x6d, + 0x61, 0x74, 0x63, 0x68, 0x54, 0x79, 0x70, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x1a, 0x45, 0x0a, 0x06, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x12, 0x27, 0x0a, 0x04, 0x72, 0x6f, + 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x13, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x52, 0x6f, 0x6c, 0x65, 0x52, 0x04, 0x72, + 0x6f, 0x6c, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6b, 0x65, 0x79, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, + 0x0c, 0x52, 0x04, 0x6b, 0x65, 0x79, 0x73, 0x22, 0xb3, 0x01, 0x0a, 0x09, 0x45, 0x41, 0x43, 0x4c, + 0x54, 0x61, 0x62, 0x6c, 0x65, 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, 0x3e, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, + 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 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, 0x3e, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, - 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, - 0x72, 0x49, 0x44, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, - 0x12, 0x33, 0x0a, 0x07, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, - 0x6c, 0x2e, 0x45, 0x41, 0x43, 0x4c, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x07, 0x72, 0x65, - 0x63, 0x6f, 0x72, 0x64, 0x73, 0x22, 0x83, 0x03, 0x0a, 0x0b, 0x42, 0x65, 0x61, 0x72, 0x65, 0x72, - 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x33, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, - 0x61, 0x63, 0x6c, 0x2e, 0x42, 0x65, 0x61, 0x72, 0x65, 0x72, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, - 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x37, 0x0a, 0x09, 0x73, 0x69, - 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, - 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, - 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, - 0x75, 0x72, 0x65, 0x1a, 0x85, 0x02, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x37, 0x0a, 0x0a, - 0x65, 0x61, 0x63, 0x6c, 0x5f, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, - 0x2e, 0x45, 0x41, 0x43, 0x4c, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x52, 0x09, 0x65, 0x61, 0x63, 0x6c, - 0x54, 0x61, 0x62, 0x6c, 0x65, 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, 0x49, 0x0a, 0x08, 0x6c, 0x69, 0x66, - 0x65, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x6e, 0x65, + 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x52, 0x0b, 0x63, 0x6f, 0x6e, + 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x12, 0x33, 0x0a, 0x07, 0x72, 0x65, 0x63, 0x6f, + 0x72, 0x64, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, + 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x45, 0x41, 0x43, 0x4c, 0x52, 0x65, + 0x63, 0x6f, 0x72, 0x64, 0x52, 0x07, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x22, 0x83, 0x03, + 0x0a, 0x0b, 0x42, 0x65, 0x61, 0x72, 0x65, 0x72, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x33, 0x0a, + 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x42, 0x65, 0x61, 0x72, - 0x65, 0x72, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x2e, 0x54, 0x6f, 0x6b, - 0x65, 0x6e, 0x4c, 0x69, 0x66, 0x65, 0x74, 0x69, 0x6d, 0x65, 0x52, 0x08, 0x6c, 0x69, 0x66, 0x65, - 0x74, 0x69, 0x6d, 0x65, 0x1a, 0x45, 0x0a, 0x0d, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x4c, 0x69, 0x66, - 0x65, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x78, 0x70, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x04, 0x52, 0x03, 0x65, 0x78, 0x70, 0x12, 0x10, 0x0a, 0x03, 0x6e, 0x62, 0x66, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x6e, 0x62, 0x66, 0x12, 0x10, 0x0a, 0x03, 0x69, 0x61, 0x74, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x69, 0x61, 0x74, 0x2a, 0x3e, 0x0a, 0x04, 0x52, - 0x6f, 0x6c, 0x65, 0x12, 0x14, 0x0a, 0x10, 0x52, 0x4f, 0x4c, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, - 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x55, 0x53, 0x45, - 0x52, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x53, 0x59, 0x53, 0x54, 0x45, 0x4d, 0x10, 0x02, 0x12, - 0x0a, 0x0a, 0x06, 0x4f, 0x54, 0x48, 0x45, 0x52, 0x53, 0x10, 0x03, 0x2a, 0x4f, 0x0a, 0x09, 0x4d, - 0x61, 0x74, 0x63, 0x68, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1a, 0x0a, 0x16, 0x4d, 0x41, 0x54, 0x43, - 0x48, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, - 0x45, 0x44, 0x10, 0x00, 0x12, 0x10, 0x0a, 0x0c, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x5f, 0x45, - 0x51, 0x55, 0x41, 0x4c, 0x10, 0x01, 0x12, 0x14, 0x0a, 0x10, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, - 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x45, 0x51, 0x55, 0x41, 0x4c, 0x10, 0x02, 0x2a, 0x7a, 0x0a, 0x09, - 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x19, 0x0a, 0x15, 0x4f, 0x50, 0x45, - 0x52, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, - 0x45, 0x44, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x47, 0x45, 0x54, 0x10, 0x01, 0x12, 0x08, 0x0a, - 0x04, 0x48, 0x45, 0x41, 0x44, 0x10, 0x02, 0x12, 0x07, 0x0a, 0x03, 0x50, 0x55, 0x54, 0x10, 0x03, - 0x12, 0x0a, 0x0a, 0x06, 0x44, 0x45, 0x4c, 0x45, 0x54, 0x45, 0x10, 0x04, 0x12, 0x0a, 0x0a, 0x06, - 0x53, 0x45, 0x41, 0x52, 0x43, 0x48, 0x10, 0x05, 0x12, 0x0c, 0x0a, 0x08, 0x47, 0x45, 0x54, 0x52, - 0x41, 0x4e, 0x47, 0x45, 0x10, 0x06, 0x12, 0x10, 0x0a, 0x0c, 0x47, 0x45, 0x54, 0x52, 0x41, 0x4e, - 0x47, 0x45, 0x48, 0x41, 0x53, 0x48, 0x10, 0x07, 0x2a, 0x35, 0x0a, 0x06, 0x41, 0x63, 0x74, 0x69, - 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x12, 0x41, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x53, - 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x41, 0x4c, - 0x4c, 0x4f, 0x57, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x44, 0x45, 0x4e, 0x59, 0x10, 0x02, 0x2a, - 0x3d, 0x0a, 0x0a, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, - 0x12, 0x48, 0x45, 0x41, 0x44, 0x45, 0x52, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, - 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x52, 0x45, 0x51, 0x55, 0x45, 0x53, 0x54, - 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x4f, 0x42, 0x4a, 0x45, 0x43, 0x54, 0x10, 0x02, 0x42, 0x4d, - 0x5a, 0x31, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, - 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, - 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x61, 0x63, 0x6c, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, - 0x61, 0x63, 0x6c, 0xaa, 0x02, 0x17, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, - 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x41, 0x63, 0x6c, 0x62, 0x06, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x65, 0x72, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, + 0x64, 0x79, 0x12, 0x37, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, + 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x1a, 0x85, 0x02, 0x0a, 0x04, + 0x42, 0x6f, 0x64, 0x79, 0x12, 0x37, 0x0a, 0x0a, 0x65, 0x61, 0x63, 0x6c, 0x5f, 0x74, 0x61, 0x62, + 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x45, 0x41, 0x43, 0x4c, 0x54, 0x61, 0x62, + 0x6c, 0x65, 0x52, 0x09, 0x65, 0x61, 0x63, 0x6c, 0x54, 0x61, 0x62, 0x6c, 0x65, 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, 0x49, 0x0a, 0x08, 0x6c, 0x69, 0x66, 0x65, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, + 0x61, 0x63, 0x6c, 0x2e, 0x42, 0x65, 0x61, 0x72, 0x65, 0x72, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, + 0x42, 0x6f, 0x64, 0x79, 0x2e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x4c, 0x69, 0x66, 0x65, 0x74, 0x69, + 0x6d, 0x65, 0x52, 0x08, 0x6c, 0x69, 0x66, 0x65, 0x74, 0x69, 0x6d, 0x65, 0x1a, 0x45, 0x0a, 0x0d, + 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x4c, 0x69, 0x66, 0x65, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x10, 0x0a, + 0x03, 0x65, 0x78, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x65, 0x78, 0x70, 0x12, + 0x10, 0x0a, 0x03, 0x6e, 0x62, 0x66, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x6e, 0x62, + 0x66, 0x12, 0x10, 0x0a, 0x03, 0x69, 0x61, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, + 0x69, 0x61, 0x74, 0x2a, 0x3e, 0x0a, 0x04, 0x52, 0x6f, 0x6c, 0x65, 0x12, 0x14, 0x0a, 0x10, 0x52, + 0x4f, 0x4c, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, + 0x00, 0x12, 0x08, 0x0a, 0x04, 0x55, 0x53, 0x45, 0x52, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x53, + 0x59, 0x53, 0x54, 0x45, 0x4d, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x4f, 0x54, 0x48, 0x45, 0x52, + 0x53, 0x10, 0x03, 0x2a, 0x4f, 0x0a, 0x09, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x54, 0x79, 0x70, 0x65, + 0x12, 0x1a, 0x0a, 0x16, 0x4d, 0x41, 0x54, 0x43, 0x48, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, + 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x10, 0x0a, 0x0c, + 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x5f, 0x45, 0x51, 0x55, 0x41, 0x4c, 0x10, 0x01, 0x12, 0x14, + 0x0a, 0x10, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x45, 0x51, 0x55, + 0x41, 0x4c, 0x10, 0x02, 0x2a, 0x7a, 0x0a, 0x09, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x12, 0x19, 0x0a, 0x15, 0x4f, 0x50, 0x45, 0x52, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x55, + 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, + 0x47, 0x45, 0x54, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x48, 0x45, 0x41, 0x44, 0x10, 0x02, 0x12, + 0x07, 0x0a, 0x03, 0x50, 0x55, 0x54, 0x10, 0x03, 0x12, 0x0a, 0x0a, 0x06, 0x44, 0x45, 0x4c, 0x45, + 0x54, 0x45, 0x10, 0x04, 0x12, 0x0a, 0x0a, 0x06, 0x53, 0x45, 0x41, 0x52, 0x43, 0x48, 0x10, 0x05, + 0x12, 0x0c, 0x0a, 0x08, 0x47, 0x45, 0x54, 0x52, 0x41, 0x4e, 0x47, 0x45, 0x10, 0x06, 0x12, 0x10, + 0x0a, 0x0c, 0x47, 0x45, 0x54, 0x52, 0x41, 0x4e, 0x47, 0x45, 0x48, 0x41, 0x53, 0x48, 0x10, 0x07, + 0x2a, 0x35, 0x0a, 0x06, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x12, 0x41, 0x43, + 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, + 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x41, 0x4c, 0x4c, 0x4f, 0x57, 0x10, 0x01, 0x12, 0x08, 0x0a, + 0x04, 0x44, 0x45, 0x4e, 0x59, 0x10, 0x02, 0x2a, 0x4a, 0x0a, 0x0a, 0x48, 0x65, 0x61, 0x64, 0x65, + 0x72, 0x54, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x12, 0x48, 0x45, 0x41, 0x44, 0x45, 0x52, 0x5f, + 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0b, 0x0a, + 0x07, 0x52, 0x45, 0x51, 0x55, 0x45, 0x53, 0x54, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x4f, 0x42, + 0x4a, 0x45, 0x43, 0x54, 0x10, 0x02, 0x12, 0x0b, 0x0a, 0x07, 0x53, 0x45, 0x52, 0x56, 0x49, 0x43, + 0x45, 0x10, 0x03, 0x42, 0x4d, 0x5a, 0x31, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, + 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, + 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x61, 0x63, 0x6c, 0x2f, + 0x67, 0x72, 0x70, 0x63, 0x3b, 0x61, 0x63, 0x6c, 0xaa, 0x02, 0x17, 0x4e, 0x65, 0x6f, 0x2e, 0x46, + 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x41, + 0x63, 0x6c, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/v2/acl/types.go b/v2/acl/types.go index f777531..58b310d 100644 --- a/v2/acl/types.go +++ b/v2/acl/types.go @@ -85,6 +85,7 @@ const ( HeaderTypeUnknown HeaderType = iota HeaderTypeRequest HeaderTypeObject + HeaderTypeService ) const ( From 010b1b011827b7b884800299927eaf4dc55160dd Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 28 Sep 2021 11:10:20 +0300 Subject: [PATCH 0903/1196] [#339] netmap: Support protocol changes related to NetworkInfo Recompile NeoFS API protobuf files. Implement `NetworkParameter` and `NetworkConfig` types. Expand `NetworkInfo` type with MillisecondsPerBlock and `NetworkConfig`. Signed-off-by: Leonard Lyubich --- pkg/netmap/network_info.go | 139 +++++++++++++++- pkg/netmap/network_info_test.go | 142 +++++++++++++++- pkg/netmap/test/generate.go | 24 +++ pkg/version.go | 2 +- v2/netmap/convert.go | 102 ++++++++++++ v2/netmap/grpc/types.go | 35 ++++ v2/netmap/grpc/types.pb.go | 277 +++++++++++++++++++++++++------- v2/netmap/marshal.go | 109 ++++++++++++- v2/netmap/message_test.go | 2 + v2/netmap/test/generate.go | 26 +++ v2/netmap/types.go | 108 +++++++++++++ 11 files changed, 905 insertions(+), 61 deletions(-) diff --git a/pkg/netmap/network_info.go b/pkg/netmap/network_info.go index 609c9cc..e8a8a94 100644 --- a/pkg/netmap/network_info.go +++ b/pkg/netmap/network_info.go @@ -19,7 +19,9 @@ func NewNetworkInfoFromV2(iV2 *netmap.NetworkInfo) *NetworkInfo { // // Defaults: // - curEpoch: 0; -// - magicNum: 0. +// - magicNum: 0; +// - msPerBlock: 0; +// - network config: nil. func NewNetworkInfo() *NetworkInfo { return NewNetworkInfoFromV2(new(netmap.NetworkInfo)) } @@ -55,6 +57,32 @@ func (i *NetworkInfo) SetMagicNumber(epoch uint64) { SetMagicNumber(epoch) } +// MsPerBlock returns MillisecondsPerBlock network parameter. +func (i *NetworkInfo) MsPerBlock() int64 { + return (*netmap.NetworkInfo)(i). + GetMsPerBlock() +} + +// SetMsPerBlock sets MillisecondsPerBlock network parameter. +func (i *NetworkInfo) SetMsPerBlock(v int64) { + (*netmap.NetworkInfo)(i). + SetMsPerBlock(v) +} + +// NetworkConfig returns NeoFS network configuration. +func (i *NetworkInfo) NetworkConfig() *NetworkConfig { + return NewNetworkConfigFromV2( + (*netmap.NetworkInfo)(i). + GetNetworkConfig(), + ) +} + +// SetNetworkConfig sets NeoFS network configuration. +func (i *NetworkInfo) SetNetworkConfig(v *NetworkConfig) { + (*netmap.NetworkInfo)(i). + SetNetworkConfig(v.ToV2()) +} + // Marshal marshals NetworkInfo into a protobuf binary form. // // Buffer is allocated when the argument is empty. @@ -86,3 +114,112 @@ func (i *NetworkInfo) UnmarshalJSON(data []byte) error { return (*netmap.NetworkInfo)(i). UnmarshalJSON(data) } + +// NetworkParameter represents v2-compatible NeoFS network parameter. +type NetworkParameter netmap.NetworkParameter + +// NewNetworkParameterFromV2 wraps v2 NetworkParameter message to NetworkParameter. +// +// Nil netmap.NetworkParameter converts to nil. +func NewNetworkParameterFromV2(pv2 *netmap.NetworkParameter) *NetworkParameter { + return (*NetworkParameter)(pv2) +} + +// NewNetworkParameter creates and initializes blank NetworkParameter. +// +// Defaults: +// - key: nil; +// - value: nil. +func NewNetworkParameter() *NetworkParameter { + return NewNetworkParameterFromV2(new(netmap.NetworkParameter)) +} + +// ToV2 converts NetworkParameter to v2 NetworkParameter. +// +// Nil NetworkParameter converts to nil. +func (x *NetworkParameter) ToV2() *netmap.NetworkParameter { + return (*netmap.NetworkParameter)(x) +} + +// Key returns key to network parameter. +func (x *NetworkParameter) Key() []byte { + return (*netmap.NetworkParameter)(x). + GetKey() +} + +// SetKey sets key to the network parameter. +func (x *NetworkParameter) SetKey(key []byte) { + (*netmap.NetworkParameter)(x). + SetKey(key) +} + +// Value returns value of the network parameter. +func (x *NetworkParameter) Value() []byte { + return (*netmap.NetworkParameter)(x). + GetValue() +} + +// SetValue sets value of the network parameter. +func (x *NetworkParameter) SetValue(val []byte) { + (*netmap.NetworkParameter)(x). + SetValue(val) +} + +// NetworkConfig represents v2-compatible NeoFS network configuration. +type NetworkConfig netmap.NetworkConfig + +// NewNetworkConfigFromV2 wraps v2 NetworkConfig message to NetworkConfig. +// +// Nil netmap.NetworkConfig converts to nil. +func NewNetworkConfigFromV2(cv2 *netmap.NetworkConfig) *NetworkConfig { + return (*NetworkConfig)(cv2) +} + +// NewNetworkConfig creates and initializes blank NetworkConfig. +// +// Defaults: +// - parameters num: 0. +func NewNetworkConfig() *NetworkConfig { + return NewNetworkConfigFromV2(new(netmap.NetworkConfig)) +} + +// ToV2 converts NetworkConfig to v2 NetworkConfig. +// +// Nil NetworkConfig converts to nil. +func (x *NetworkConfig) ToV2() *netmap.NetworkConfig { + return (*netmap.NetworkConfig)(x) +} + +// NumberOfParameters returns number of network parameters. +func (x *NetworkConfig) NumberOfParameters() int { + return (*netmap.NetworkConfig)(x).NumberOfParameters() +} + +// IterateAddresses iterates over network parameters. +// Breaks iteration on f's true return. +// +// Handler should not be nil. +func (x *NetworkConfig) IterateParameters(f func(*NetworkParameter) bool) { + (*netmap.NetworkConfig)(x). + IterateParameters(func(p *netmap.NetworkParameter) bool { + return f(NewNetworkParameterFromV2(p)) + }) +} + +// Value returns value of the network parameter. +func (x *NetworkConfig) SetParameters(ps ...*NetworkParameter) { + var psV2 []*netmap.NetworkParameter + + if ps != nil { + ln := len(ps) + + psV2 = make([]*netmap.NetworkParameter, 0, ln) + + for i := 0; i < ln; i++ { + psV2 = append(psV2, ps[i].ToV2()) + } + } + + (*netmap.NetworkConfig)(x). + SetParameters(psV2...) +} diff --git a/pkg/netmap/network_info_test.go b/pkg/netmap/network_info_test.go index c5d9461..c36b614 100644 --- a/pkg/netmap/network_info_test.go +++ b/pkg/netmap/network_info_test.go @@ -1,11 +1,124 @@ -package netmap +package netmap_test import ( "testing" + . "github.com/nspcc-dev/neofs-api-go/pkg/netmap" + netmaptest "github.com/nspcc-dev/neofs-api-go/pkg/netmap/test" "github.com/stretchr/testify/require" ) +func TestNetworkParameter_Key(t *testing.T) { + i := NewNetworkParameter() + + k := []byte("key") + + i.SetKey(k) + + require.Equal(t, k, i.Key()) + require.Equal(t, k, i.ToV2().GetKey()) +} + +func TestNetworkParameter_Value(t *testing.T) { + i := NewNetworkParameter() + + v := []byte("value") + + i.SetValue(v) + + require.Equal(t, v, i.Value()) + require.Equal(t, v, i.ToV2().GetValue()) +} + +func TestNewNetworkParameterFromV2(t *testing.T) { + t.Run("nil", func(t *testing.T) { + require.Nil(t, NewNetworkParameterFromV2(nil)) + }) +} + +func TestNetworkParameter_ToV2(t *testing.T) { + t.Run("nil", func(t *testing.T) { + var x *NetworkParameter + + require.Nil(t, x.ToV2()) + }) +} + +func TestNewNetworkParameter(t *testing.T) { + x := NewNetworkParameter() + + // check initial values + require.Nil(t, x.Key()) + require.Nil(t, x.Value()) + + // convert to v2 message + xV2 := x.ToV2() + + require.Nil(t, xV2.GetKey()) + require.Nil(t, xV2.GetValue()) +} + +func TestNetworkConfig_SetParameters(t *testing.T) { + x := NewNetworkConfig() + + require.Zero(t, x.NumberOfParameters()) + + called := 0 + + x.IterateParameters(func(p *NetworkParameter) bool { + called++ + return false + }) + + require.Zero(t, called) + + pps := []*NetworkParameter{ + netmaptest.NetworkParameter(), + netmaptest.NetworkParameter(), + } + + x.SetParameters(pps...) + + require.EqualValues(t, len(pps), x.NumberOfParameters()) + + var dst []*NetworkParameter + + x.IterateParameters(func(p *NetworkParameter) bool { + dst = append(dst, p) + called++ + return false + }) + + require.Equal(t, pps, dst) + require.Equal(t, len(pps), called) +} + +func TestNewNetworkConfigFromV2(t *testing.T) { + t.Run("nil", func(t *testing.T) { + require.Nil(t, NewNetworkConfigFromV2(nil)) + }) +} + +func TestNetworkConfig_ToV2(t *testing.T) { + t.Run("nil", func(t *testing.T) { + + var x *NetworkConfig + require.Nil(t, x.ToV2()) + }) +} + +func TestNewNetworkConfig(t *testing.T) { + x := NewNetworkConfig() + + // check initial values + require.Zero(t, x.NumberOfParameters()) + + // convert to v2 message + xV2 := x.ToV2() + + require.Zero(t, xV2.NumberOfParameters()) +} + func TestNetworkInfo_CurrentEpoch(t *testing.T) { i := NewNetworkInfo() e := uint64(13) @@ -26,10 +139,29 @@ func TestNetworkInfo_MagicNumber(t *testing.T) { require.Equal(t, m, i.ToV2().GetMagicNumber()) } -func TestNetworkInfoEncoding(t *testing.T) { +func TestNetworkInfo_MsPerBlock(t *testing.T) { i := NewNetworkInfo() - i.SetCurrentEpoch(13) - i.SetMagicNumber(666) + + const ms = 987 + + i.SetMsPerBlock(ms) + + require.EqualValues(t, ms, i.MsPerBlock()) + require.EqualValues(t, ms, i.ToV2().GetMsPerBlock()) +} + +func TestNetworkInfo_Config(t *testing.T) { + i := NewNetworkInfo() + + c := netmaptest.NetworkConfig() + + i.SetNetworkConfig(c) + + require.Equal(t, c, i.NetworkConfig()) +} + +func TestNetworkInfoEncoding(t *testing.T) { + i := netmaptest.NetworkInfo() t.Run("binary", func(t *testing.T) { data, err := i.Marshal() @@ -72,10 +204,12 @@ func TestNewNetworkInfo(t *testing.T) { // check initial values require.Zero(t, ni.CurrentEpoch()) require.Zero(t, ni.MagicNumber()) + require.Zero(t, ni.MsPerBlock()) // convert to v2 message niV2 := ni.ToV2() require.Zero(t, niV2.GetCurrentEpoch()) require.Zero(t, niV2.GetMagicNumber()) + require.Zero(t, niV2.GetMsPerBlock()) } diff --git a/pkg/netmap/test/generate.go b/pkg/netmap/test/generate.go index a2a1394..d8d431d 100644 --- a/pkg/netmap/test/generate.go +++ b/pkg/netmap/test/generate.go @@ -59,12 +59,36 @@ func PlacementPolicy() *netmap.PlacementPolicy { return x } +// NetworkParameter returns random netmap.NetworkParameter. +func NetworkParameter() *netmap.NetworkParameter { + x := netmap.NewNetworkParameter() + + x.SetKey([]byte("key")) + x.SetValue([]byte("value")) + + return x +} + +// NetworkConfig returns random netmap.NetworkConfig. +func NetworkConfig() *netmap.NetworkConfig { + x := netmap.NewNetworkConfig() + + x.SetParameters( + NetworkParameter(), + NetworkParameter(), + ) + + return x +} + // NetworkInfo returns random netmap.NetworkInfo. func NetworkInfo() *netmap.NetworkInfo { x := netmap.NewNetworkInfo() x.SetCurrentEpoch(21) x.SetMagicNumber(32) + x.SetMsPerBlock(43) + x.SetNetworkConfig(NetworkConfig()) return x } diff --git a/pkg/version.go b/pkg/version.go index 85066eb..c720af5 100644 --- a/pkg/version.go +++ b/pkg/version.go @@ -9,7 +9,7 @@ import ( // Version represents v2-compatible version. type Version refs.Version -const sdkMjr, sdkMnr = 2, 9 +const sdkMjr, sdkMnr = 2, 10 // NewVersionFromV2 wraps v2 Version message to Version. // diff --git a/v2/netmap/convert.go b/v2/netmap/convert.go index 06bddbf..59c5e60 100644 --- a/v2/netmap/convert.go +++ b/v2/netmap/convert.go @@ -514,6 +514,89 @@ func (l *LocalNodeInfoResponse) FromGRPCMessage(m grpc.Message) error { return l.ResponseHeaders.FromMessage(v) } +func (x *NetworkParameter) ToGRPCMessage() grpc.Message { + var m *netmap.NetworkConfig_Parameter + + if x != nil { + m = new(netmap.NetworkConfig_Parameter) + + m.SetKey(x.k) + m.SetValue(x.v) + } + + return m +} + +func (x *NetworkParameter) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*netmap.NetworkConfig_Parameter) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + x.k = v.GetKey() + x.v = v.GetValue() + + return nil +} + +func (x *NetworkConfig) ToGRPCMessage() grpc.Message { + var m *netmap.NetworkConfig + + if x != nil { + m = new(netmap.NetworkConfig) + + var ps []*netmap.NetworkConfig_Parameter + + if ln := len(x.ps); ln > 0 { + ps = make([]*netmap.NetworkConfig_Parameter, 0, ln) + + for i := 0; i < ln; i++ { + ps = append(ps, x.ps[i].ToGRPCMessage().(*netmap.NetworkConfig_Parameter)) + } + } + + m.SetParameters(ps) + } + + return m +} + +func (x *NetworkConfig) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*netmap.NetworkConfig) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var ( + ps []*NetworkParameter + psV2 = v.GetParameters() + ) + + if psV2 != nil { + ln := len(psV2) + + ps = make([]*NetworkParameter, 0, ln) + + for i := 0; i < ln; i++ { + var p *NetworkParameter + + if psV2[i] != nil { + p = new(NetworkParameter) + + if err := p.FromGRPCMessage(psV2[i]); err != nil { + return err + } + } + + ps = append(ps, p) + } + } + + x.ps = ps + + return nil +} + func (i *NetworkInfo) ToGRPCMessage() grpc.Message { var m *netmap.NetworkInfo @@ -522,6 +605,8 @@ func (i *NetworkInfo) ToGRPCMessage() grpc.Message { m.SetMagicNumber(i.magicNum) m.SetCurrentEpoch(i.curEpoch) + m.SetMsPerBlock(i.msPerBlock) + m.SetNetworkConfig(i.netCfg.ToGRPCMessage().(*netmap.NetworkConfig)) } return m @@ -533,8 +618,25 @@ func (i *NetworkInfo) FromGRPCMessage(m grpc.Message) error { return message.NewUnexpectedMessageType(m, v) } + var err error + + netCfg := v.GetNetworkConfig() + if netCfg == nil { + i.netCfg = nil + } else { + if i.netCfg == nil { + i.netCfg = new(NetworkConfig) + } + + err = i.netCfg.FromGRPCMessage(netCfg) + if err != nil { + return err + } + } + i.magicNum = v.GetMagicNumber() i.curEpoch = v.GetCurrentEpoch() + i.msPerBlock = v.GetMsPerBlock() return nil } diff --git a/v2/netmap/grpc/types.go b/v2/netmap/grpc/types.go index 9ba148e..e8dc687 100644 --- a/v2/netmap/grpc/types.go +++ b/v2/netmap/grpc/types.go @@ -182,6 +182,20 @@ func (x *NetworkInfo) SetMagicNumber(v uint64) { } } +// SetMsPerBlock sets MillisecondsPerBlock network parameter. +func (x *NetworkInfo) SetMsPerBlock(v int64) { + if x != nil { + x.MsPerBlock = v + } +} + +// SetNetworkConfig sets NeoFS network configuration. +func (x *NetworkInfo) SetNetworkConfig(v *NetworkConfig) { + if x != nil { + x.NetworkConfig = v + } +} + // FromString parses Clause from a string representation, // It is a reverse action to String(). // @@ -220,3 +234,24 @@ func (x *NodeInfo_State) FromString(s string) bool { return ok } + +// SetKey sets parameter key. +func (x *NetworkConfig_Parameter) SetKey(v []byte) { + if x != nil { + x.Key = v + } +} + +// SetValue sets parameter value. +func (x *NetworkConfig_Parameter) SetValue(v []byte) { + if x != nil { + x.Value = v + } +} + +// SetParameters sets NeoFS network parameters. +func (x *NetworkConfig) SetParameters(v []*NetworkConfig_Parameter) { + if x != nil { + x.Parameters = v + } +} diff --git a/v2/netmap/grpc/types.pb.go b/v2/netmap/grpc/types.pb.go index 5b2fb51..3c640d0 100644 --- a/v2/netmap/grpc/types.pb.go +++ b/v2/netmap/grpc/types.pb.go @@ -605,6 +605,55 @@ func (x *NodeInfo) GetState() NodeInfo_State { return NodeInfo_UNSPECIFIED } +// NeoFS network configuration +type NetworkConfig struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // List of parameter values. + Parameters []*NetworkConfig_Parameter `protobuf:"bytes,1,rep,name=parameters,proto3" json:"parameters,omitempty"` +} + +func (x *NetworkConfig) Reset() { + *x = NetworkConfig{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_netmap_grpc_types_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *NetworkConfig) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NetworkConfig) ProtoMessage() {} + +func (x *NetworkConfig) ProtoReflect() protoreflect.Message { + mi := &file_v2_netmap_grpc_types_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use NetworkConfig.ProtoReflect.Descriptor instead. +func (*NetworkConfig) Descriptor() ([]byte, []int) { + return file_v2_netmap_grpc_types_proto_rawDescGZIP(), []int{5} +} + +func (x *NetworkConfig) GetParameters() []*NetworkConfig_Parameter { + if x != nil { + return x.Parameters + } + return nil +} + // Information about NeoFS network type NetworkInfo struct { state protoimpl.MessageState @@ -615,12 +664,16 @@ type NetworkInfo struct { CurrentEpoch uint64 `protobuf:"varint,1,opt,name=current_epoch,json=currentEpoch,proto3" json:"current_epoch,omitempty"` // Magic number of the sidechain of the NeoFS network. MagicNumber uint64 `protobuf:"varint,2,opt,name=magic_number,json=magicNumber,proto3" json:"magic_number,omitempty"` + // MillisecondsPerBlock network parameter of the sidechain of the NeoFS network. + MsPerBlock int64 `protobuf:"varint,3,opt,name=ms_per_block,json=msPerBlock,proto3" json:"ms_per_block,omitempty"` + // NeoFS network configuration. + NetworkConfig *NetworkConfig `protobuf:"bytes,4,opt,name=network_config,json=networkConfig,proto3" json:"network_config,omitempty"` } func (x *NetworkInfo) Reset() { *x = NetworkInfo{} if protoimpl.UnsafeEnabled { - mi := &file_v2_netmap_grpc_types_proto_msgTypes[5] + mi := &file_v2_netmap_grpc_types_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -633,7 +686,7 @@ func (x *NetworkInfo) String() string { func (*NetworkInfo) ProtoMessage() {} func (x *NetworkInfo) ProtoReflect() protoreflect.Message { - mi := &file_v2_netmap_grpc_types_proto_msgTypes[5] + mi := &file_v2_netmap_grpc_types_proto_msgTypes[6] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -646,7 +699,7 @@ func (x *NetworkInfo) ProtoReflect() protoreflect.Message { // Deprecated: Use NetworkInfo.ProtoReflect.Descriptor instead. func (*NetworkInfo) Descriptor() ([]byte, []int) { - return file_v2_netmap_grpc_types_proto_rawDescGZIP(), []int{5} + return file_v2_netmap_grpc_types_proto_rawDescGZIP(), []int{6} } func (x *NetworkInfo) GetCurrentEpoch() uint64 { @@ -663,6 +716,20 @@ func (x *NetworkInfo) GetMagicNumber() uint64 { return 0 } +func (x *NetworkInfo) GetMsPerBlock() int64 { + if x != nil { + return x.MsPerBlock + } + return 0 +} + +func (x *NetworkInfo) GetNetworkConfig() *NetworkConfig { + if x != nil { + return x.NetworkConfig + } + return nil +} + // Administrator-defined Attributes of the NeoFS Storage Node. // // `Attribute` is a Key-Value metadata pair. Key name must be a valid UTF-8 @@ -746,7 +813,7 @@ type NodeInfo_Attribute struct { func (x *NodeInfo_Attribute) Reset() { *x = NodeInfo_Attribute{} if protoimpl.UnsafeEnabled { - mi := &file_v2_netmap_grpc_types_proto_msgTypes[6] + mi := &file_v2_netmap_grpc_types_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -759,7 +826,7 @@ func (x *NodeInfo_Attribute) String() string { func (*NodeInfo_Attribute) ProtoMessage() {} func (x *NodeInfo_Attribute) ProtoReflect() protoreflect.Message { - mi := &file_v2_netmap_grpc_types_proto_msgTypes[6] + mi := &file_v2_netmap_grpc_types_proto_msgTypes[7] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -796,6 +863,64 @@ func (x *NodeInfo_Attribute) GetParents() []string { return nil } +// Single configuration parameter. +type NetworkConfig_Parameter struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Parameter key. UTF-8 encoded string. + Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + // Parameter value. + Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` +} + +func (x *NetworkConfig_Parameter) Reset() { + *x = NetworkConfig_Parameter{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_netmap_grpc_types_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *NetworkConfig_Parameter) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NetworkConfig_Parameter) ProtoMessage() {} + +func (x *NetworkConfig_Parameter) ProtoReflect() protoreflect.Message { + mi := &file_v2_netmap_grpc_types_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use NetworkConfig_Parameter.ProtoReflect.Descriptor instead. +func (*NetworkConfig_Parameter) Descriptor() ([]byte, []int) { + return file_v2_netmap_grpc_types_proto_rawDescGZIP(), []int{5, 0} +} + +func (x *NetworkConfig_Parameter) GetKey() []byte { + if x != nil { + return x.Key + } + return nil +} + +func (x *NetworkConfig_Parameter) GetValue() []byte { + if x != nil { + return x.Value + } + return nil +} + var File_v2_netmap_grpc_types_proto protoreflect.FileDescriptor var file_v2_netmap_grpc_types_proto_rawDesc = []byte{ @@ -861,29 +986,45 @@ var file_v2_netmap_grpc_types_proto_rawDesc = []byte{ 0x09, 0x52, 0x07, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x73, 0x22, 0x31, 0x0a, 0x05, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x0f, 0x0a, 0x0b, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x4f, 0x4e, 0x4c, 0x49, 0x4e, 0x45, 0x10, 0x01, - 0x12, 0x0b, 0x0a, 0x07, 0x4f, 0x46, 0x46, 0x4c, 0x49, 0x4e, 0x45, 0x10, 0x02, 0x22, 0x55, 0x0a, - 0x0b, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x23, 0x0a, 0x0d, - 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x04, 0x52, 0x0c, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x45, 0x70, 0x6f, 0x63, - 0x68, 0x12, 0x21, 0x0a, 0x0c, 0x6d, 0x61, 0x67, 0x69, 0x63, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, - 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0b, 0x6d, 0x61, 0x67, 0x69, 0x63, 0x4e, 0x75, - 0x6d, 0x62, 0x65, 0x72, 0x2a, 0x67, 0x0a, 0x09, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x12, 0x19, 0x0a, 0x15, 0x4f, 0x50, 0x45, 0x52, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x55, - 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x06, 0x0a, 0x02, - 0x45, 0x51, 0x10, 0x01, 0x12, 0x06, 0x0a, 0x02, 0x4e, 0x45, 0x10, 0x02, 0x12, 0x06, 0x0a, 0x02, - 0x47, 0x54, 0x10, 0x03, 0x12, 0x06, 0x0a, 0x02, 0x47, 0x45, 0x10, 0x04, 0x12, 0x06, 0x0a, 0x02, - 0x4c, 0x54, 0x10, 0x05, 0x12, 0x06, 0x0a, 0x02, 0x4c, 0x45, 0x10, 0x06, 0x12, 0x06, 0x0a, 0x02, - 0x4f, 0x52, 0x10, 0x07, 0x12, 0x07, 0x0a, 0x03, 0x41, 0x4e, 0x44, 0x10, 0x08, 0x2a, 0x38, 0x0a, - 0x06, 0x43, 0x6c, 0x61, 0x75, 0x73, 0x65, 0x12, 0x16, 0x0a, 0x12, 0x43, 0x4c, 0x41, 0x55, 0x53, - 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, - 0x08, 0x0a, 0x04, 0x53, 0x41, 0x4d, 0x45, 0x10, 0x01, 0x12, 0x0c, 0x0a, 0x08, 0x44, 0x49, 0x53, - 0x54, 0x49, 0x4e, 0x43, 0x54, 0x10, 0x02, 0x42, 0x56, 0x5a, 0x37, 0x67, 0x69, 0x74, 0x68, 0x75, - 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, - 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, - 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x6e, 0x65, 0x74, 0x6d, - 0x61, 0x70, 0xaa, 0x02, 0x1a, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, - 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x4e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x12, 0x0b, 0x0a, 0x07, 0x4f, 0x46, 0x46, 0x4c, 0x49, 0x4e, 0x45, 0x10, 0x02, 0x22, 0x8f, 0x01, + 0x0a, 0x0d, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, + 0x49, 0x0a, 0x0a, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, + 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x43, 0x6f, + 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x52, 0x0a, + 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x1a, 0x33, 0x0a, 0x09, 0x50, 0x61, + 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0c, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, + 0xbf, 0x01, 0x0a, 0x0b, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x12, + 0x23, 0x0a, 0x0d, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x65, 0x70, 0x6f, 0x63, 0x68, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0c, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x45, + 0x70, 0x6f, 0x63, 0x68, 0x12, 0x21, 0x0a, 0x0c, 0x6d, 0x61, 0x67, 0x69, 0x63, 0x5f, 0x6e, 0x75, + 0x6d, 0x62, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0b, 0x6d, 0x61, 0x67, 0x69, + 0x63, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x20, 0x0a, 0x0c, 0x6d, 0x73, 0x5f, 0x70, 0x65, + 0x72, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x6d, + 0x73, 0x50, 0x65, 0x72, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x46, 0x0a, 0x0e, 0x6e, 0x65, 0x74, + 0x77, 0x6f, 0x72, 0x6b, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, + 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x43, 0x6f, 0x6e, 0x66, + 0x69, 0x67, 0x52, 0x0d, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x43, 0x6f, 0x6e, 0x66, 0x69, + 0x67, 0x2a, 0x67, 0x0a, 0x09, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x19, + 0x0a, 0x15, 0x4f, 0x50, 0x45, 0x52, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x53, 0x50, + 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x06, 0x0a, 0x02, 0x45, 0x51, 0x10, + 0x01, 0x12, 0x06, 0x0a, 0x02, 0x4e, 0x45, 0x10, 0x02, 0x12, 0x06, 0x0a, 0x02, 0x47, 0x54, 0x10, + 0x03, 0x12, 0x06, 0x0a, 0x02, 0x47, 0x45, 0x10, 0x04, 0x12, 0x06, 0x0a, 0x02, 0x4c, 0x54, 0x10, + 0x05, 0x12, 0x06, 0x0a, 0x02, 0x4c, 0x45, 0x10, 0x06, 0x12, 0x06, 0x0a, 0x02, 0x4f, 0x52, 0x10, + 0x07, 0x12, 0x07, 0x0a, 0x03, 0x41, 0x4e, 0x44, 0x10, 0x08, 0x2a, 0x38, 0x0a, 0x06, 0x43, 0x6c, + 0x61, 0x75, 0x73, 0x65, 0x12, 0x16, 0x0a, 0x12, 0x43, 0x4c, 0x41, 0x55, 0x53, 0x45, 0x5f, 0x55, + 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, + 0x53, 0x41, 0x4d, 0x45, 0x10, 0x01, 0x12, 0x0c, 0x0a, 0x08, 0x44, 0x49, 0x53, 0x54, 0x49, 0x4e, + 0x43, 0x54, 0x10, 0x02, 0x42, 0x56, 0x5a, 0x37, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, + 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, + 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x6e, 0x65, 0x74, + 0x6d, 0x61, 0x70, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0xaa, + 0x02, 0x1a, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, + 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x4e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -899,33 +1040,37 @@ func file_v2_netmap_grpc_types_proto_rawDescGZIP() []byte { } var file_v2_netmap_grpc_types_proto_enumTypes = make([]protoimpl.EnumInfo, 3) -var file_v2_netmap_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 7) +var file_v2_netmap_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 9) var file_v2_netmap_grpc_types_proto_goTypes = []interface{}{ - (Operation)(0), // 0: neo.fs.v2.netmap.Operation - (Clause)(0), // 1: neo.fs.v2.netmap.Clause - (NodeInfo_State)(0), // 2: neo.fs.v2.netmap.NodeInfo.State - (*Filter)(nil), // 3: neo.fs.v2.netmap.Filter - (*Selector)(nil), // 4: neo.fs.v2.netmap.Selector - (*Replica)(nil), // 5: neo.fs.v2.netmap.Replica - (*PlacementPolicy)(nil), // 6: neo.fs.v2.netmap.PlacementPolicy - (*NodeInfo)(nil), // 7: neo.fs.v2.netmap.NodeInfo - (*NetworkInfo)(nil), // 8: neo.fs.v2.netmap.NetworkInfo - (*NodeInfo_Attribute)(nil), // 9: neo.fs.v2.netmap.NodeInfo.Attribute + (Operation)(0), // 0: neo.fs.v2.netmap.Operation + (Clause)(0), // 1: neo.fs.v2.netmap.Clause + (NodeInfo_State)(0), // 2: neo.fs.v2.netmap.NodeInfo.State + (*Filter)(nil), // 3: neo.fs.v2.netmap.Filter + (*Selector)(nil), // 4: neo.fs.v2.netmap.Selector + (*Replica)(nil), // 5: neo.fs.v2.netmap.Replica + (*PlacementPolicy)(nil), // 6: neo.fs.v2.netmap.PlacementPolicy + (*NodeInfo)(nil), // 7: neo.fs.v2.netmap.NodeInfo + (*NetworkConfig)(nil), // 8: neo.fs.v2.netmap.NetworkConfig + (*NetworkInfo)(nil), // 9: neo.fs.v2.netmap.NetworkInfo + (*NodeInfo_Attribute)(nil), // 10: neo.fs.v2.netmap.NodeInfo.Attribute + (*NetworkConfig_Parameter)(nil), // 11: neo.fs.v2.netmap.NetworkConfig.Parameter } var file_v2_netmap_grpc_types_proto_depIdxs = []int32{ - 0, // 0: neo.fs.v2.netmap.Filter.op:type_name -> neo.fs.v2.netmap.Operation - 3, // 1: neo.fs.v2.netmap.Filter.filters:type_name -> neo.fs.v2.netmap.Filter - 1, // 2: neo.fs.v2.netmap.Selector.clause:type_name -> neo.fs.v2.netmap.Clause - 5, // 3: neo.fs.v2.netmap.PlacementPolicy.replicas:type_name -> neo.fs.v2.netmap.Replica - 4, // 4: neo.fs.v2.netmap.PlacementPolicy.selectors:type_name -> neo.fs.v2.netmap.Selector - 3, // 5: neo.fs.v2.netmap.PlacementPolicy.filters:type_name -> neo.fs.v2.netmap.Filter - 9, // 6: neo.fs.v2.netmap.NodeInfo.attributes:type_name -> neo.fs.v2.netmap.NodeInfo.Attribute - 2, // 7: neo.fs.v2.netmap.NodeInfo.state:type_name -> neo.fs.v2.netmap.NodeInfo.State - 8, // [8:8] is the sub-list for method output_type - 8, // [8:8] 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 + 0, // 0: neo.fs.v2.netmap.Filter.op:type_name -> neo.fs.v2.netmap.Operation + 3, // 1: neo.fs.v2.netmap.Filter.filters:type_name -> neo.fs.v2.netmap.Filter + 1, // 2: neo.fs.v2.netmap.Selector.clause:type_name -> neo.fs.v2.netmap.Clause + 5, // 3: neo.fs.v2.netmap.PlacementPolicy.replicas:type_name -> neo.fs.v2.netmap.Replica + 4, // 4: neo.fs.v2.netmap.PlacementPolicy.selectors:type_name -> neo.fs.v2.netmap.Selector + 3, // 5: neo.fs.v2.netmap.PlacementPolicy.filters:type_name -> neo.fs.v2.netmap.Filter + 10, // 6: neo.fs.v2.netmap.NodeInfo.attributes:type_name -> neo.fs.v2.netmap.NodeInfo.Attribute + 2, // 7: neo.fs.v2.netmap.NodeInfo.state:type_name -> neo.fs.v2.netmap.NodeInfo.State + 11, // 8: neo.fs.v2.netmap.NetworkConfig.parameters:type_name -> neo.fs.v2.netmap.NetworkConfig.Parameter + 8, // 9: neo.fs.v2.netmap.NetworkInfo.network_config:type_name -> neo.fs.v2.netmap.NetworkConfig + 10, // [10:10] is the sub-list for method output_type + 10, // [10:10] is the sub-list for method input_type + 10, // [10:10] is the sub-list for extension type_name + 10, // [10:10] is the sub-list for extension extendee + 0, // [0:10] is the sub-list for field type_name } func init() { file_v2_netmap_grpc_types_proto_init() } @@ -995,7 +1140,7 @@ func file_v2_netmap_grpc_types_proto_init() { } } file_v2_netmap_grpc_types_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NetworkInfo); i { + switch v := v.(*NetworkConfig); i { case 0: return &v.state case 1: @@ -1007,6 +1152,18 @@ func file_v2_netmap_grpc_types_proto_init() { } } file_v2_netmap_grpc_types_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*NetworkInfo); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_netmap_grpc_types_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*NodeInfo_Attribute); i { case 0: return &v.state @@ -1018,6 +1175,18 @@ func file_v2_netmap_grpc_types_proto_init() { return nil } } + file_v2_netmap_grpc_types_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*NetworkConfig_Parameter); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } type x struct{} out := protoimpl.TypeBuilder{ @@ -1025,7 +1194,7 @@ func file_v2_netmap_grpc_types_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_v2_netmap_grpc_types_proto_rawDesc, NumEnums: 3, - NumMessages: 7, + NumMessages: 9, NumExtensions: 0, NumServices: 0, }, diff --git a/v2/netmap/marshal.go b/v2/netmap/marshal.go index abdc7df..4f818e5 100644 --- a/v2/netmap/marshal.go +++ b/v2/netmap/marshal.go @@ -468,10 +468,101 @@ func (l *LocalNodeInfoResponseBody) Unmarshal(data []byte) error { return message.Unmarshal(l, data, new(netmap.LocalNodeInfoResponse_Body)) } +const ( + _ = iota + netPrmKeyFNum + netPrmValFNum +) + +func (x *NetworkParameter) StableMarshal(buf []byte) ([]byte, error) { + if x == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, x.StableSize()) + } + + var ( + offset, n int + err error + ) + + n, err = protoutil.BytesMarshal(netPrmKeyFNum, buf[offset:], x.k) + if err != nil { + return nil, err + } + + offset += n + + _, err = protoutil.BytesMarshal(netPrmValFNum, buf[offset:], x.v) + if err != nil { + return nil, err + } + + return buf, nil +} + +func (x *NetworkParameter) StableSize() (size int) { + if x == nil { + return 0 + } + + size += protoutil.BytesSize(netPrmKeyFNum, x.k) + size += protoutil.BytesSize(netPrmValFNum, x.v) + + return size +} + +const ( + _ = iota + netCfgPrmsFNum +) + +func (x *NetworkConfig) StableMarshal(buf []byte) ([]byte, error) { + if x == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, x.StableSize()) + } + + var ( + offset, n int + err error + ) + + for i := range x.ps { + n, err = protoutil.NestedStructureMarshal(netCfgPrmsFNum, buf[offset:], x.ps[i]) + if err != nil { + return nil, err + } + + offset += n + } + + return buf, nil +} + +func (x *NetworkConfig) StableSize() (size int) { + if x == nil { + return 0 + } + + for i := range x.ps { + size += protoutil.NestedStructureSize(netCfgPrmsFNum, x.ps[i]) + } + + return size +} + const ( _ = iota netInfoCurEpochFNum netInfoMagicNumFNum + netInfoMSPerBlockFNum + netInfoCfgFNum ) func (i *NetworkInfo) StableMarshal(buf []byte) ([]byte, error) { @@ -495,7 +586,21 @@ func (i *NetworkInfo) StableMarshal(buf []byte) ([]byte, error) { offset += n - _, err = protoutil.UInt64Marshal(netInfoMagicNumFNum, buf[offset:], i.magicNum) + n, err = protoutil.UInt64Marshal(netInfoMagicNumFNum, buf[offset:], i.magicNum) + if err != nil { + return nil, err + } + + offset += n + + n, err = protoutil.Int64Marshal(netInfoMSPerBlockFNum, buf[offset:], i.msPerBlock) + if err != nil { + return nil, err + } + + offset += n + + _, err = protoutil.NestedStructureMarshal(netInfoCfgFNum, buf[offset:], i.netCfg) if err != nil { return nil, err } @@ -510,6 +615,8 @@ func (i *NetworkInfo) StableSize() (size int) { size += protoutil.UInt64Size(netInfoCurEpochFNum, i.curEpoch) size += protoutil.UInt64Size(netInfoMagicNumFNum, i.magicNum) + size += protoutil.Int64Size(netInfoMSPerBlockFNum, i.msPerBlock) + size += protoutil.NestedStructureSize(netInfoCfgFNum, i.netCfg) return size } diff --git a/v2/netmap/message_test.go b/v2/netmap/message_test.go index 4a653bf..1c921e0 100644 --- a/v2/netmap/message_test.go +++ b/v2/netmap/message_test.go @@ -18,6 +18,8 @@ func TestMessageConvert(t *testing.T) { func(empty bool) message.Message { return netmaptest.GenerateNodeInfo(empty) }, func(empty bool) message.Message { return netmaptest.GenerateLocalNodeInfoRequest(empty) }, func(empty bool) message.Message { return netmaptest.GenerateLocalNodeInfoResponseBody(empty) }, + func(empty bool) message.Message { return netmaptest.GenerateNetworkParameter(empty) }, + func(empty bool) message.Message { return netmaptest.GenerateNetworkConfig(empty) }, func(empty bool) message.Message { return netmaptest.GenerateNetworkInfo(empty) }, func(empty bool) message.Message { return netmaptest.GenerateNetworkInfoRequest(empty) }, func(empty bool) message.Message { return netmaptest.GenerateNetworkInfoResponseBody(empty) }, diff --git a/v2/netmap/test/generate.go b/v2/netmap/test/generate.go index f9f316f..be07f12 100644 --- a/v2/netmap/test/generate.go +++ b/v2/netmap/test/generate.go @@ -188,12 +188,38 @@ func GenerateLocalNodeInfoResponse(empty bool) *netmap.LocalNodeInfoResponse { return m } +func GenerateNetworkParameter(empty bool) *netmap.NetworkParameter { + m := new(netmap.NetworkParameter) + + if !empty { + m.SetKey([]byte("key")) + m.SetValue([]byte("value")) + } + + return m +} + +func GenerateNetworkConfig(empty bool) *netmap.NetworkConfig { + m := new(netmap.NetworkConfig) + + if !empty { + m.SetParameters( + GenerateNetworkParameter(empty), + GenerateNetworkParameter(empty), + ) + } + + return m +} + func GenerateNetworkInfo(empty bool) *netmap.NetworkInfo { m := new(netmap.NetworkInfo) if !empty { m.SetMagicNumber(228) m.SetCurrentEpoch(666) + m.SetMsPerBlock(5678) + m.SetNetworkConfig(GenerateNetworkConfig(empty)) } return m diff --git a/v2/netmap/types.go b/v2/netmap/types.go index 858d844..af8fb6f 100644 --- a/v2/netmap/types.go +++ b/v2/netmap/types.go @@ -517,10 +517,86 @@ func (l *LocalNodeInfoResponse) SetBody(body *LocalNodeInfoResponseBody) { } } +// NetworkParameter represents NeoFS network parameter. +type NetworkParameter struct { + k, v []byte +} + +// GetKey returns parameter key. +func (x *NetworkParameter) GetKey() []byte { + if x != nil { + return x.k + } + + return nil +} + +// SetKey sets parameter key. +func (x *NetworkParameter) SetKey(k []byte) { + if x != nil { + x.k = k + } +} + +// GetValue returns parameter value. +func (x *NetworkParameter) GetValue() []byte { + if x != nil { + return x.v + } + + return nil +} + +// SetValue sets parameter value. +func (x *NetworkParameter) SetValue(v []byte) { + if x != nil { + x.v = v + } +} + +// NetworkConfig represents NeoFS network configuration. +type NetworkConfig struct { + ps []*NetworkParameter +} + +// NumberOfParameters returns number of network parameters. +func (x *NetworkConfig) NumberOfParameters() int { + if x != nil { + return len(x.ps) + } + + return 0 +} + +// IterateParameters iterates over network parameters. +// Breaks iteration on f's true return. +// +// Handler must not be nil. +func (x *NetworkConfig) IterateParameters(f func(*NetworkParameter) bool) { + if x != nil { + for i := range x.ps { + if f(x.ps[i]) { + break + } + } + } +} + +// SetParameters sets list of network parameters. +func (x *NetworkConfig) SetParameters(v ...*NetworkParameter) { + if x != nil { + x.ps = v + } +} + // NetworkInfo groups information about // NeoFS network. type NetworkInfo struct { curEpoch, magicNum uint64 + + msPerBlock int64 + + netCfg *NetworkConfig } // GetCurrentEpoch returns number of the current epoch. @@ -555,6 +631,38 @@ func (i *NetworkInfo) SetMagicNumber(magic uint64) { } } +// GetMsPerBlock returns MillisecondsPerBlock network parameter. +func (i *NetworkInfo) GetMsPerBlock() int64 { + if i != nil { + return i.msPerBlock + } + + return 0 +} + +// SetMsPerBlock sets MillisecondsPerBlock network parameter. +func (i *NetworkInfo) SetMsPerBlock(v int64) { + if i != nil { + i.msPerBlock = v + } +} + +// GetNetworkConfig returns NeoFS network configuration. +func (i *NetworkInfo) GetNetworkConfig() *NetworkConfig { + if i != nil { + return i.netCfg + } + + return nil +} + +// SetNetworkConfig sets NeoFS network configuration. +func (i *NetworkInfo) SetNetworkConfig(v *NetworkConfig) { + if i != nil { + i.netCfg = v + } +} + // NetworkInfoRequestBody is a structure of NetworkInfo request body. type NetworkInfoRequestBody struct{} From d71ba40b781a976137478bc369558143ff31c494 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 28 Sep 2021 18:07:31 +0300 Subject: [PATCH 0904/1196] [#176] Update google.golang.org/grpc module to v1.41.0 Signed-off-by: Leonard Lyubich --- go.mod | 14 +++++++---- go.sum | 79 +++++++++++++++++++++++++++++++++++++++++++++++++--------- 2 files changed, 76 insertions(+), 17 deletions(-) diff --git a/go.mod b/go.mod index afe1a8a..62fff1a 100644 --- a/go.mod +++ b/go.mod @@ -3,15 +3,19 @@ module github.com/nspcc-dev/neofs-api-go go 1.16 require ( - github.com/golang/protobuf v1.4.3 - github.com/google/uuid v1.1.1 + github.com/golang/protobuf v1.5.2 + github.com/google/uuid v1.1.2 github.com/mr-tron/base58 v1.1.2 github.com/nspcc-dev/hrw v1.0.9 github.com/nspcc-dev/neo-go v0.95.3 github.com/nspcc-dev/neofs-crypto v0.3.0 - github.com/stretchr/testify v1.6.1 - google.golang.org/grpc v1.29.1 - google.golang.org/protobuf v1.23.0 + github.com/stretchr/testify v1.7.0 + golang.org/x/net v0.0.0-20210928044308-7d9f5e0b762b // indirect + golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6 // indirect + golang.org/x/text v0.3.7 // indirect + google.golang.org/genproto v0.0.0-20210928142010-c7af6a1a74c9 // indirect + google.golang.org/grpc v1.41.0 + google.golang.org/protobuf v1.27.1 ) // Used for debug reasons diff --git a/go.sum b/go.sum index c84acfd..4ebb679 100644 --- a/go.sum +++ b/go.sum @@ -1,4 +1,5 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/CityOfZion/neo-go v0.62.1-pre.0.20191114145240-e740fbe708f8/go.mod h1:MJCkWUBhi9pn/CrYO1Q3P687y2KeahrOPS9BD9LDGb0= github.com/CityOfZion/neo-go v0.70.1-pre.0.20191209120015-fccb0085941e/go.mod h1:0enZl0az8xA6PVkwzEOwPWVJGqlt/GO4hA4kmQ5Xzig= @@ -16,6 +17,7 @@ github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRF github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alicebob/gopher-json v0.0.0-20180125190556-5a6b3ba71ee6/go.mod h1:SGnFV6hVsYE877CKEZ6tDNTjaSXYUk6QqoIK6PrAtcc= github.com/alicebob/miniredis v2.5.0+incompatible/go.mod h1:8HZjEj4yU0dwhYHky+DxYx+6BMjkBbe5ONFIF1MXffk= +github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= @@ -32,11 +34,15 @@ github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46f github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.0/go.mod h1:dgIUBU3pDso/gPgZ1osOZ0iQf77oPR28Tjxl5dIMyVM= +github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= +github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= +github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= @@ -50,13 +56,18 @@ github.com/dgraph-io/ristretto v0.0.2-0.20200115201040-8f368f2f2ab3/go.mod h1:KP github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= +github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= +github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/etcd-io/bbolt v1.3.3/go.mod h1:ZF2nL25h33cCyBtcyWeZ2/I3HQOfTP+0PIEvHjkjCrw= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/flynn-archive/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:rZfgFAXFS/z/lEd6LJmf9HVZ1LkgYiHx5pHhV5DR16M= github.com/frankban/quicktest v1.10.0/go.mod h1:ui7WezCLWMWxVWr1GETZY3smRy0G4KWq9vcPtJmFl7Y= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= @@ -76,20 +87,28 @@ github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:x github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.3 h1:JjCZWpVbqXDqFVmTfYWEVTMIYrL/NPdPSCHPJ0T/raM= +github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= +github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= +github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/snappy v0.0.0-20170215233205-553a64147049/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/gomodule/redigo v2.0.0+incompatible/go.mod h1:B4C85qUVwatsJoIUNIfCRsp7qO0iAmpGFZ4EELWSbC4= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.1.2 h1:EVhdT+1Kseyi1/pUmXKaFxYsDNy9RQYkMWRH68J/W7Y= +github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+lJfyTc= github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= @@ -172,6 +191,7 @@ github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt2 github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.5/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDaekg4FpcdQ= +github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= @@ -189,8 +209,10 @@ github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0= +github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/syndtr/goleveldb v0.0.0-20180307113352-169b1b37be73/go.mod h1:Z4AUp2Km+PwemOoO/VB5AOx9XSsIItzFjoJlOSiYmn0= github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= @@ -200,6 +222,7 @@ github.com/yuin/gopher-lua v0.0.0-20190514113301-1cd887cd7036/go.mod h1:gqRgreBU github.com/yuin/gopher-lua v0.0.0-20191128022950-c6266f4fe8d7/go.mod h1:gqRgreBUhTSL0GeU64rtZ3Uq3wtjOa/TB2YfrtkCbVQ= go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.etcd.io/bbolt v1.3.4/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ= +go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= @@ -207,8 +230,9 @@ golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnf golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4 h1:HuIa8hRrWRSrqYzx1qI49NNxhdi2PrY7gxVSq1JjLDc= golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnkZWQJsqcURM6tKiBApRjXI= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= @@ -217,13 +241,18 @@ golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73r golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859 h1:R/3boaszxrf1GEUWTVDzSKVwLmSJpwZ1yqXm8j0v2QI= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= +golang.org/x/net v0.0.0-20210928044308-7d9f5e0b762b h1:eB48h3HiRycXNy8E0Gf5e0hv7YT6Kt14L/D73G1fuwo= +golang.org/x/net v0.0.0-20210928044308-7d9f5e0b762b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -244,35 +273,60 @@ golang.org/x/sys v0.0.0-20191008105621-543471e840be/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20191010194322-b09406accb47/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68 h1:nxC68pudNYkKU6jWhgrqdreuFiOQWj1Fs7T3VrH4Pjw= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6 h1:foEbQz/B0Oz6YIqu/69kfXPYeFQAuuMYFkjaqXzl5Wo= +golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20201210144234-2321bbc49cbf/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/tools v0.0.0-20180318012157-96caea41033d/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55 h1:gSJIx1SDwno+2ElGhA4+qG2zF97qiUzTM+rQ0klBOcE= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= +google.golang.org/genproto v0.0.0-20210928142010-c7af6a1a74c9 h1:XTH066D35LyHehRwlYhoK3qA+Hcgvg5xREG4kFQEW1Y= +google.golang.org/genproto v0.0.0-20210928142010-c7af6a1a74c9/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= -google.golang.org/grpc v1.29.1 h1:EC2SB8S04d2r73uptxphDSUG+kTKVgjRPF+N3xpxRB4= +google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= +google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= +google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= +google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= +google.golang.org/grpc v1.41.0 h1:f+PlOh7QV4iIJkPrx5NQ7qaNGFQ3OTse67yaDHfju4E= +google.golang.org/grpc v1.41.0/go.mod h1:U3l9uK9J0sini8mHphKoXyaqDA/8VyGnDee1zzIUK6k= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.23.0 h1:4MY060fB1DLGMB/7MBTLnwQUY6+F09GEiz6SsrNqyzM= +google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= +google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.27.1 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ= +google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= gopkg.in/abiosoft/ishell.v2 v2.0.0/go.mod h1:sFp+cGtH6o4s1FtpVPTMcHq2yue+c4DGOVohJCPUzwY= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= @@ -282,6 +336,7 @@ gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMy gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= From 3c5c589e63ef4fbe7be73cf75d0fc24f9042c5f3 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 28 Sep 2021 18:10:48 +0300 Subject: [PATCH 0905/1196] [#176] Makefile: use protoc-gen-go-grpc in protoc target Signed-off-by: Leonard Lyubich --- Makefile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index c38de89..c8775ee 100644 --- a/Makefile +++ b/Makefile @@ -46,8 +46,10 @@ protoc: @for f in `find . -type f -name '*.proto' -not -path './vendor/*'`; do \ echo "⇒ Processing $$f "; \ protoc \ - --proto_path=.:./vendor:./vendor/github.com/nspcc-dev/neofs-api:/usr/local/include \ - --go_out=plugins=grpc,paths=source_relative:. $$f; \ + --proto_path=.:./vendor:/usr/local/include \ + --go_out=. --go_opt=paths=source_relative \ + --go-grpc_opt=require_unimplemented_servers=false \ + --go-grpc_out=. --go-grpc_opt=paths=source_relative $$f; \ done rm -rf vendor From 0117e90e9adb9cd920b0afefa5c62a31cc9de257 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 28 Sep 2021 18:11:33 +0300 Subject: [PATCH 0906/1196] [#176] Re-compile protobuf file from NeoFS API source Signed-off-by: Leonard Lyubich --- go.mod | 1 - util/proto/test/test.pb.go | 9 +- v2/accounting/grpc/service.pb.go | 95 +---- v2/accounting/grpc/service_grpc.pb.go | 101 ++++++ v2/accounting/grpc/types.pb.go | 9 +- v2/acl/grpc/types.pb.go | 202 ++++++----- v2/audit/grpc/types.pb.go | 9 +- v2/container/grpc/service.pb.go | 341 +----------------- v2/container/grpc/service_grpc.pb.go | 347 ++++++++++++++++++ v2/container/grpc/types.pb.go | 9 +- v2/netmap/grpc/service.pb.go | 141 +------- v2/netmap/grpc/service_grpc.pb.go | 147 ++++++++ v2/netmap/grpc/types.pb.go | 9 +- v2/object/grpc/service.pb.go | 485 +------------------------ v2/object/grpc/service_grpc.pb.go | 487 ++++++++++++++++++++++++++ v2/object/grpc/types.pb.go | 9 +- v2/refs/grpc/types.pb.go | 9 +- v2/reputation/grpc/service.pb.go | 135 +------ v2/reputation/grpc/service_grpc.pb.go | 141 ++++++++ v2/reputation/grpc/types.pb.go | 9 +- v2/session/grpc/service.pb.go | 95 +---- v2/session/grpc/service_grpc.pb.go | 101 ++++++ v2/session/grpc/types.pb.go | 9 +- v2/storagegroup/grpc/types.pb.go | 9 +- v2/tombstone/grpc/types.pb.go | 9 +- 25 files changed, 1459 insertions(+), 1459 deletions(-) create mode 100644 v2/accounting/grpc/service_grpc.pb.go create mode 100644 v2/container/grpc/service_grpc.pb.go create mode 100644 v2/netmap/grpc/service_grpc.pb.go create mode 100644 v2/object/grpc/service_grpc.pb.go create mode 100644 v2/reputation/grpc/service_grpc.pb.go create mode 100644 v2/session/grpc/service_grpc.pb.go diff --git a/go.mod b/go.mod index 62fff1a..cfcdf6e 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,6 @@ module github.com/nspcc-dev/neofs-api-go go 1.16 require ( - github.com/golang/protobuf v1.5.2 github.com/google/uuid v1.1.2 github.com/mr-tron/base58 v1.1.2 github.com/nspcc-dev/hrw v1.0.9 diff --git a/util/proto/test/test.pb.go b/util/proto/test/test.pb.go index b194e1f..7ce722a 100644 --- a/util/proto/test/test.pb.go +++ b/util/proto/test/test.pb.go @@ -1,13 +1,12 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.23.0 -// protoc v3.14.0 +// protoc-gen-go v1.27.1 +// protoc v3.18.0 // source: util/proto/test/test.proto package test import ( - proto "github.com/golang/protobuf/proto" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -21,10 +20,6 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - type Primitives_SomeEnum int32 const ( diff --git a/v2/accounting/grpc/service.pb.go b/v2/accounting/grpc/service.pb.go index cdfce8c..68485e4 100644 --- a/v2/accounting/grpc/service.pb.go +++ b/v2/accounting/grpc/service.pb.go @@ -1,19 +1,14 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.23.0 -// protoc v3.14.0 +// protoc-gen-go v1.27.1 +// protoc v3.18.0 // source: v2/accounting/grpc/service.proto package accounting import ( - context "context" - proto "github.com/golang/protobuf/proto" grpc1 "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" grpc "github.com/nspcc-dev/neofs-api-go/v2/session/grpc" - grpc2 "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -27,10 +22,6 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - // BalanceRequest message type BalanceRequest struct { state protoimpl.MessageState @@ -458,85 +449,3 @@ func file_v2_accounting_grpc_service_proto_init() { file_v2_accounting_grpc_service_proto_goTypes = nil file_v2_accounting_grpc_service_proto_depIdxs = nil } - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc2.ClientConnInterface - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc2.SupportPackageIsVersion6 - -// AccountingServiceClient is the client API for AccountingService service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type AccountingServiceClient interface { - // Returns the amount of funds in GAS token for the requested NeoFS account. - Balance(ctx context.Context, in *BalanceRequest, opts ...grpc2.CallOption) (*BalanceResponse, error) -} - -type accountingServiceClient struct { - cc grpc2.ClientConnInterface -} - -func NewAccountingServiceClient(cc grpc2.ClientConnInterface) AccountingServiceClient { - return &accountingServiceClient{cc} -} - -func (c *accountingServiceClient) Balance(ctx context.Context, in *BalanceRequest, opts ...grpc2.CallOption) (*BalanceResponse, error) { - out := new(BalanceResponse) - err := c.cc.Invoke(ctx, "/neo.fs.v2.accounting.AccountingService/Balance", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// AccountingServiceServer is the server API for AccountingService service. -type AccountingServiceServer interface { - // Returns the amount of funds in GAS token for the requested NeoFS account. - Balance(context.Context, *BalanceRequest) (*BalanceResponse, error) -} - -// UnimplementedAccountingServiceServer can 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 RegisterAccountingServiceServer(s *grpc2.Server, srv AccountingServiceServer) { - s.RegisterService(&_AccountingService_serviceDesc, srv) -} - -func _AccountingService_Balance_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc2.UnaryServerInterceptor) (interface{}, error) { - in := new(BalanceRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(AccountingServiceServer).Balance(ctx, in) - } - info := &grpc2.UnaryServerInfo{ - Server: srv, - FullMethod: "/neo.fs.v2.accounting.AccountingService/Balance", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(AccountingServiceServer).Balance(ctx, req.(*BalanceRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _AccountingService_serviceDesc = grpc2.ServiceDesc{ - ServiceName: "neo.fs.v2.accounting.AccountingService", - HandlerType: (*AccountingServiceServer)(nil), - Methods: []grpc2.MethodDesc{ - { - MethodName: "Balance", - Handler: _AccountingService_Balance_Handler, - }, - }, - Streams: []grpc2.StreamDesc{}, - Metadata: "v2/accounting/grpc/service.proto", -} diff --git a/v2/accounting/grpc/service_grpc.pb.go b/v2/accounting/grpc/service_grpc.pb.go new file mode 100644 index 0000000..b875b30 --- /dev/null +++ b/v2/accounting/grpc/service_grpc.pb.go @@ -0,0 +1,101 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. + +package accounting + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +// 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. +type AccountingServiceClient interface { + // Returns the amount of funds in GAS token for the requested NeoFS account. + Balance(ctx context.Context, in *BalanceRequest, opts ...grpc.CallOption) (*BalanceResponse, error) +} + +type accountingServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewAccountingServiceClient(cc grpc.ClientConnInterface) AccountingServiceClient { + return &accountingServiceClient{cc} +} + +func (c *accountingServiceClient) Balance(ctx context.Context, in *BalanceRequest, opts ...grpc.CallOption) (*BalanceResponse, error) { + out := new(BalanceResponse) + err := c.cc.Invoke(ctx, "/neo.fs.v2.accounting.AccountingService/Balance", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// AccountingServiceServer is the server API for AccountingService service. +// All implementations should embed UnimplementedAccountingServiceServer +// for forward compatibility +type AccountingServiceServer interface { + // Returns the amount of funds in GAS token for the requested NeoFS account. + Balance(context.Context, *BalanceRequest) (*BalanceResponse, error) +} + +// 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") +} + +// 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 +// result in compilation errors. +type UnsafeAccountingServiceServer interface { + mustEmbedUnimplementedAccountingServiceServer() +} + +func RegisterAccountingServiceServer(s grpc.ServiceRegistrar, srv AccountingServiceServer) { + s.RegisterService(&AccountingService_ServiceDesc, srv) +} + +func _AccountingService_Balance_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(BalanceRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AccountingServiceServer).Balance(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/neo.fs.v2.accounting.AccountingService/Balance", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AccountingServiceServer).Balance(ctx, req.(*BalanceRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// AccountingService_ServiceDesc is the grpc.ServiceDesc for AccountingService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var AccountingService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "neo.fs.v2.accounting.AccountingService", + HandlerType: (*AccountingServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Balance", + Handler: _AccountingService_Balance_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "v2/accounting/grpc/service.proto", +} diff --git a/v2/accounting/grpc/types.pb.go b/v2/accounting/grpc/types.pb.go index d1a9428..2028639 100644 --- a/v2/accounting/grpc/types.pb.go +++ b/v2/accounting/grpc/types.pb.go @@ -1,13 +1,12 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.23.0 -// protoc v3.14.0 +// protoc-gen-go v1.27.1 +// protoc v3.18.0 // source: v2/accounting/grpc/types.proto package accounting import ( - proto "github.com/golang/protobuf/proto" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -21,10 +20,6 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - // Standard floating point data type can't be used in NeoFS 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. diff --git a/v2/acl/grpc/types.pb.go b/v2/acl/grpc/types.pb.go index 639bdf2..8121686 100644 --- a/v2/acl/grpc/types.pb.go +++ b/v2/acl/grpc/types.pb.go @@ -1,13 +1,12 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.23.0 -// protoc v3.17.3 +// protoc-gen-go v1.27.1 +// protoc v3.18.0 // source: v2/acl/grpc/types.proto package acl import ( - proto "github.com/golang/protobuf/proto" grpc "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" @@ -22,10 +21,6 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - // Target role of the access control rule in access control list. type Role int32 @@ -843,104 +838,105 @@ var File_v2_acl_grpc_types_proto protoreflect.FileDescriptor var file_v2_acl_grpc_types_proto_rawDesc = []byte{ 0x0a, 0x17, 0x76, 0x32, 0x2f, 0x61, 0x63, 0x6c, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0d, 0x6e, 0x65, 0x6f, 0x2e, 0x66, - 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x1a, 0x10, 0x72, 0x65, 0x66, 0x73, 0x2f, 0x74, - 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xda, 0x03, 0x0a, 0x0a, 0x45, - 0x41, 0x43, 0x4c, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x12, 0x36, 0x0a, 0x09, 0x6f, 0x70, 0x65, - 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x6e, - 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x4f, 0x70, 0x65, - 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x09, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x12, 0x2d, 0x0a, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0e, 0x32, 0x15, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, - 0x6c, 0x2e, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x12, 0x3a, 0x0a, 0x07, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, - 0x6c, 0x2e, 0x45, 0x41, 0x43, 0x4c, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x2e, 0x46, 0x69, 0x6c, - 0x74, 0x65, 0x72, 0x52, 0x07, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x73, 0x12, 0x3a, 0x0a, 0x07, - 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, - 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x45, 0x41, - 0x43, 0x4c, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x2e, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x52, - 0x07, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x1a, 0xa5, 0x01, 0x0a, 0x06, 0x46, 0x69, 0x6c, - 0x74, 0x65, 0x72, 0x12, 0x3a, 0x0a, 0x0b, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x5f, 0x74, 0x79, - 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, - 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x54, - 0x79, 0x70, 0x65, 0x52, 0x0a, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x12, - 0x37, 0x0a, 0x0a, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, - 0x61, 0x63, 0x6c, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x54, 0x79, 0x70, 0x65, 0x52, 0x09, 0x6d, - 0x61, 0x74, 0x63, 0x68, 0x54, 0x79, 0x70, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x1a, 0x45, 0x0a, 0x06, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x12, 0x27, 0x0a, 0x04, 0x72, 0x6f, - 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x13, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, - 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x52, 0x6f, 0x6c, 0x65, 0x52, 0x04, 0x72, - 0x6f, 0x6c, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6b, 0x65, 0x79, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, - 0x0c, 0x52, 0x04, 0x6b, 0x65, 0x79, 0x73, 0x22, 0xb3, 0x01, 0x0a, 0x09, 0x45, 0x41, 0x43, 0x4c, - 0x54, 0x61, 0x62, 0x6c, 0x65, 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, 0x3e, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, - 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, - 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, - 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x52, 0x0b, 0x63, 0x6f, 0x6e, - 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x12, 0x33, 0x0a, 0x07, 0x72, 0x65, 0x63, 0x6f, - 0x72, 0x64, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x1a, 0x18, 0x76, 0x32, 0x2f, 0x72, 0x65, 0x66, + 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x22, 0xda, 0x03, 0x0a, 0x0a, 0x45, 0x41, 0x43, 0x4c, 0x52, 0x65, 0x63, 0x6f, 0x72, + 0x64, 0x12, 0x36, 0x0a, 0x09, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x09, + 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2d, 0x0a, 0x06, 0x61, 0x63, 0x74, + 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x15, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, + 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, + 0x52, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3a, 0x0a, 0x07, 0x66, 0x69, 0x6c, 0x74, + 0x65, 0x72, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x45, 0x41, 0x43, 0x4c, 0x52, 0x65, - 0x63, 0x6f, 0x72, 0x64, 0x52, 0x07, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x22, 0x83, 0x03, - 0x0a, 0x0b, 0x42, 0x65, 0x61, 0x72, 0x65, 0x72, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x33, 0x0a, - 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6e, 0x65, - 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x42, 0x65, 0x61, 0x72, - 0x65, 0x72, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, - 0x64, 0x79, 0x12, 0x37, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, - 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, - 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x1a, 0x85, 0x02, 0x0a, 0x04, - 0x42, 0x6f, 0x64, 0x79, 0x12, 0x37, 0x0a, 0x0a, 0x65, 0x61, 0x63, 0x6c, 0x5f, 0x74, 0x61, 0x62, - 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, - 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x45, 0x41, 0x43, 0x4c, 0x54, 0x61, 0x62, - 0x6c, 0x65, 0x52, 0x09, 0x65, 0x61, 0x63, 0x6c, 0x54, 0x61, 0x62, 0x6c, 0x65, 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, 0x49, 0x0a, 0x08, 0x6c, 0x69, 0x66, 0x65, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, + 0x63, 0x6f, 0x72, 0x64, 0x2e, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x07, 0x66, 0x69, 0x6c, + 0x74, 0x65, 0x72, 0x73, 0x12, 0x3a, 0x0a, 0x07, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x18, + 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x45, 0x41, 0x43, 0x4c, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, + 0x2e, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x52, 0x07, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, + 0x1a, 0xa5, 0x01, 0x0a, 0x06, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x3a, 0x0a, 0x0b, 0x68, + 0x65, 0x61, 0x64, 0x65, 0x72, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, + 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, + 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x52, 0x0a, 0x68, 0x65, 0x61, + 0x64, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x12, 0x37, 0x0a, 0x0a, 0x6d, 0x61, 0x74, 0x63, 0x68, + 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x6e, 0x65, + 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x4d, 0x61, 0x74, 0x63, + 0x68, 0x54, 0x79, 0x70, 0x65, 0x52, 0x09, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x54, 0x79, 0x70, 0x65, + 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, + 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x1a, 0x45, 0x0a, 0x06, 0x54, 0x61, 0x72, 0x67, + 0x65, 0x74, 0x12, 0x27, 0x0a, 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, + 0x32, 0x13, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, + 0x2e, 0x52, 0x6f, 0x6c, 0x65, 0x52, 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6b, + 0x65, 0x79, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x04, 0x6b, 0x65, 0x79, 0x73, 0x22, + 0xb3, 0x01, 0x0a, 0x09, 0x45, 0x41, 0x43, 0x4c, 0x54, 0x61, 0x62, 0x6c, 0x65, 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, 0x3e, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, + 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, + 0x72, 0x49, 0x44, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, + 0x12, 0x33, 0x0a, 0x07, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, + 0x6c, 0x2e, 0x45, 0x41, 0x43, 0x4c, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x07, 0x72, 0x65, + 0x63, 0x6f, 0x72, 0x64, 0x73, 0x22, 0x83, 0x03, 0x0a, 0x0b, 0x42, 0x65, 0x61, 0x72, 0x65, 0x72, + 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x33, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x42, 0x65, 0x61, 0x72, 0x65, 0x72, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, - 0x42, 0x6f, 0x64, 0x79, 0x2e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x4c, 0x69, 0x66, 0x65, 0x74, 0x69, - 0x6d, 0x65, 0x52, 0x08, 0x6c, 0x69, 0x66, 0x65, 0x74, 0x69, 0x6d, 0x65, 0x1a, 0x45, 0x0a, 0x0d, - 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x4c, 0x69, 0x66, 0x65, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x10, 0x0a, - 0x03, 0x65, 0x78, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x65, 0x78, 0x70, 0x12, - 0x10, 0x0a, 0x03, 0x6e, 0x62, 0x66, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x6e, 0x62, - 0x66, 0x12, 0x10, 0x0a, 0x03, 0x69, 0x61, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, - 0x69, 0x61, 0x74, 0x2a, 0x3e, 0x0a, 0x04, 0x52, 0x6f, 0x6c, 0x65, 0x12, 0x14, 0x0a, 0x10, 0x52, - 0x4f, 0x4c, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, - 0x00, 0x12, 0x08, 0x0a, 0x04, 0x55, 0x53, 0x45, 0x52, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x53, - 0x59, 0x53, 0x54, 0x45, 0x4d, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x4f, 0x54, 0x48, 0x45, 0x52, - 0x53, 0x10, 0x03, 0x2a, 0x4f, 0x0a, 0x09, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x54, 0x79, 0x70, 0x65, - 0x12, 0x1a, 0x0a, 0x16, 0x4d, 0x41, 0x54, 0x43, 0x48, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, - 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x10, 0x0a, 0x0c, - 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x5f, 0x45, 0x51, 0x55, 0x41, 0x4c, 0x10, 0x01, 0x12, 0x14, - 0x0a, 0x10, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x45, 0x51, 0x55, - 0x41, 0x4c, 0x10, 0x02, 0x2a, 0x7a, 0x0a, 0x09, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x12, 0x19, 0x0a, 0x15, 0x4f, 0x50, 0x45, 0x52, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x55, - 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, - 0x47, 0x45, 0x54, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x48, 0x45, 0x41, 0x44, 0x10, 0x02, 0x12, - 0x07, 0x0a, 0x03, 0x50, 0x55, 0x54, 0x10, 0x03, 0x12, 0x0a, 0x0a, 0x06, 0x44, 0x45, 0x4c, 0x45, - 0x54, 0x45, 0x10, 0x04, 0x12, 0x0a, 0x0a, 0x06, 0x53, 0x45, 0x41, 0x52, 0x43, 0x48, 0x10, 0x05, - 0x12, 0x0c, 0x0a, 0x08, 0x47, 0x45, 0x54, 0x52, 0x41, 0x4e, 0x47, 0x45, 0x10, 0x06, 0x12, 0x10, - 0x0a, 0x0c, 0x47, 0x45, 0x54, 0x52, 0x41, 0x4e, 0x47, 0x45, 0x48, 0x41, 0x53, 0x48, 0x10, 0x07, - 0x2a, 0x35, 0x0a, 0x06, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x12, 0x41, 0x43, - 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, - 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x41, 0x4c, 0x4c, 0x4f, 0x57, 0x10, 0x01, 0x12, 0x08, 0x0a, - 0x04, 0x44, 0x45, 0x4e, 0x59, 0x10, 0x02, 0x2a, 0x4a, 0x0a, 0x0a, 0x48, 0x65, 0x61, 0x64, 0x65, - 0x72, 0x54, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x12, 0x48, 0x45, 0x41, 0x44, 0x45, 0x52, 0x5f, - 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0b, 0x0a, - 0x07, 0x52, 0x45, 0x51, 0x55, 0x45, 0x53, 0x54, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x4f, 0x42, - 0x4a, 0x45, 0x43, 0x54, 0x10, 0x02, 0x12, 0x0b, 0x0a, 0x07, 0x53, 0x45, 0x52, 0x56, 0x49, 0x43, - 0x45, 0x10, 0x03, 0x42, 0x4d, 0x5a, 0x31, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, - 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, - 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x61, 0x63, 0x6c, 0x2f, - 0x67, 0x72, 0x70, 0x63, 0x3b, 0x61, 0x63, 0x6c, 0xaa, 0x02, 0x17, 0x4e, 0x65, 0x6f, 0x2e, 0x46, - 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x41, - 0x63, 0x6c, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x37, 0x0a, 0x09, 0x73, 0x69, + 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, + 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, + 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, + 0x75, 0x72, 0x65, 0x1a, 0x85, 0x02, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x37, 0x0a, 0x0a, + 0x65, 0x61, 0x63, 0x6c, 0x5f, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, + 0x2e, 0x45, 0x41, 0x43, 0x4c, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x52, 0x09, 0x65, 0x61, 0x63, 0x6c, + 0x54, 0x61, 0x62, 0x6c, 0x65, 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, 0x49, 0x0a, 0x08, 0x6c, 0x69, 0x66, + 0x65, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x6e, 0x65, + 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x42, 0x65, 0x61, 0x72, + 0x65, 0x72, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x2e, 0x54, 0x6f, 0x6b, + 0x65, 0x6e, 0x4c, 0x69, 0x66, 0x65, 0x74, 0x69, 0x6d, 0x65, 0x52, 0x08, 0x6c, 0x69, 0x66, 0x65, + 0x74, 0x69, 0x6d, 0x65, 0x1a, 0x45, 0x0a, 0x0d, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x4c, 0x69, 0x66, + 0x65, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x78, 0x70, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x04, 0x52, 0x03, 0x65, 0x78, 0x70, 0x12, 0x10, 0x0a, 0x03, 0x6e, 0x62, 0x66, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x6e, 0x62, 0x66, 0x12, 0x10, 0x0a, 0x03, 0x69, 0x61, 0x74, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x69, 0x61, 0x74, 0x2a, 0x3e, 0x0a, 0x04, 0x52, + 0x6f, 0x6c, 0x65, 0x12, 0x14, 0x0a, 0x10, 0x52, 0x4f, 0x4c, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, + 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x55, 0x53, 0x45, + 0x52, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x53, 0x59, 0x53, 0x54, 0x45, 0x4d, 0x10, 0x02, 0x12, + 0x0a, 0x0a, 0x06, 0x4f, 0x54, 0x48, 0x45, 0x52, 0x53, 0x10, 0x03, 0x2a, 0x4f, 0x0a, 0x09, 0x4d, + 0x61, 0x74, 0x63, 0x68, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1a, 0x0a, 0x16, 0x4d, 0x41, 0x54, 0x43, + 0x48, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, + 0x45, 0x44, 0x10, 0x00, 0x12, 0x10, 0x0a, 0x0c, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x5f, 0x45, + 0x51, 0x55, 0x41, 0x4c, 0x10, 0x01, 0x12, 0x14, 0x0a, 0x10, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, + 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x45, 0x51, 0x55, 0x41, 0x4c, 0x10, 0x02, 0x2a, 0x7a, 0x0a, 0x09, + 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x19, 0x0a, 0x15, 0x4f, 0x50, 0x45, + 0x52, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, + 0x45, 0x44, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x47, 0x45, 0x54, 0x10, 0x01, 0x12, 0x08, 0x0a, + 0x04, 0x48, 0x45, 0x41, 0x44, 0x10, 0x02, 0x12, 0x07, 0x0a, 0x03, 0x50, 0x55, 0x54, 0x10, 0x03, + 0x12, 0x0a, 0x0a, 0x06, 0x44, 0x45, 0x4c, 0x45, 0x54, 0x45, 0x10, 0x04, 0x12, 0x0a, 0x0a, 0x06, + 0x53, 0x45, 0x41, 0x52, 0x43, 0x48, 0x10, 0x05, 0x12, 0x0c, 0x0a, 0x08, 0x47, 0x45, 0x54, 0x52, + 0x41, 0x4e, 0x47, 0x45, 0x10, 0x06, 0x12, 0x10, 0x0a, 0x0c, 0x47, 0x45, 0x54, 0x52, 0x41, 0x4e, + 0x47, 0x45, 0x48, 0x41, 0x53, 0x48, 0x10, 0x07, 0x2a, 0x35, 0x0a, 0x06, 0x41, 0x63, 0x74, 0x69, + 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x12, 0x41, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x53, + 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x41, 0x4c, + 0x4c, 0x4f, 0x57, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x44, 0x45, 0x4e, 0x59, 0x10, 0x02, 0x2a, + 0x4a, 0x0a, 0x0a, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, + 0x12, 0x48, 0x45, 0x41, 0x44, 0x45, 0x52, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, + 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x52, 0x45, 0x51, 0x55, 0x45, 0x53, 0x54, + 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x4f, 0x42, 0x4a, 0x45, 0x43, 0x54, 0x10, 0x02, 0x12, 0x0b, + 0x0a, 0x07, 0x53, 0x45, 0x52, 0x56, 0x49, 0x43, 0x45, 0x10, 0x03, 0x42, 0x4d, 0x5a, 0x31, 0x67, + 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, + 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, + 0x2f, 0x76, 0x32, 0x2f, 0x61, 0x63, 0x6c, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x61, 0x63, 0x6c, + 0xaa, 0x02, 0x17, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, + 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x41, 0x63, 0x6c, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, } var ( diff --git a/v2/audit/grpc/types.pb.go b/v2/audit/grpc/types.pb.go index e50e91a..82cb4c9 100644 --- a/v2/audit/grpc/types.pb.go +++ b/v2/audit/grpc/types.pb.go @@ -1,13 +1,12 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.23.0 -// protoc v3.14.0 +// protoc-gen-go v1.27.1 +// protoc v3.18.0 // source: v2/audit/grpc/types.proto package audit import ( - proto "github.com/golang/protobuf/proto" grpc "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" @@ -22,10 +21,6 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - // DataAuditResult keeps record of conducted Data Audits. The detailed report is // generated separately. type DataAuditResult struct { diff --git a/v2/container/grpc/service.pb.go b/v2/container/grpc/service.pb.go index e5b66c8..031ac63 100644 --- a/v2/container/grpc/service.pb.go +++ b/v2/container/grpc/service.pb.go @@ -1,20 +1,15 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.23.0 -// protoc v3.14.0 +// protoc-gen-go v1.27.1 +// protoc v3.18.0 // source: v2/container/grpc/service.proto package container import ( - context "context" - proto "github.com/golang/protobuf/proto" grpc2 "github.com/nspcc-dev/neofs-api-go/v2/acl/grpc" grpc1 "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" grpc "github.com/nspcc-dev/neofs-api-go/v2/session/grpc" - grpc3 "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -28,10 +23,6 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - // New NeoFS Container creation request type PutRequest struct { state protoimpl.MessageState @@ -2689,331 +2680,3 @@ func file_v2_container_grpc_service_proto_init() { file_v2_container_grpc_service_proto_goTypes = nil file_v2_container_grpc_service_proto_depIdxs = nil } - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc3.ClientConnInterface - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc3.SupportPackageIsVersion6 - -// ContainerServiceClient is the client API for ContainerService service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -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 - // verified by Inner Ring nodes. After one more block in sidechain, container - // is added into smart contract storage. - Put(ctx context.Context, in *PutRequest, opts ...grpc3.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 - // verified by Inner Ring nodes. After one more block in sidechain, container - // is added into smart contract storage. - Delete(ctx context.Context, in *DeleteRequest, opts ...grpc3.CallOption) (*DeleteResponse, error) - // Returns container structure from `Container` smart contract storage. - Get(ctx context.Context, in *GetRequest, opts ...grpc3.CallOption) (*GetResponse, error) - // Returns all owner's containers from 'Container` smart contract' storage. - List(ctx context.Context, in *ListRequest, opts ...grpc3.CallOption) (*ListResponse, error) - // Invokes 'SetEACL' method of 'Container` smart contract and returns response - // immediately. After one more block in sidechain, Extended ACL changes are - // added into smart contract storage. - SetExtendedACL(ctx context.Context, in *SetExtendedACLRequest, opts ...grpc3.CallOption) (*SetExtendedACLResponse, error) - // Returns Extended ACL table and signature from `Container` smart contract - // storage. - GetExtendedACL(ctx context.Context, in *GetExtendedACLRequest, opts ...grpc3.CallOption) (*GetExtendedACLResponse, error) - // Announce container used space values for P2P synchronization. - AnnounceUsedSpace(ctx context.Context, in *AnnounceUsedSpaceRequest, opts ...grpc3.CallOption) (*AnnounceUsedSpaceResponse, error) -} - -type containerServiceClient struct { - cc grpc3.ClientConnInterface -} - -func NewContainerServiceClient(cc grpc3.ClientConnInterface) ContainerServiceClient { - return &containerServiceClient{cc} -} - -func (c *containerServiceClient) Put(ctx context.Context, in *PutRequest, opts ...grpc3.CallOption) (*PutResponse, error) { - out := new(PutResponse) - err := c.cc.Invoke(ctx, "/neo.fs.v2.container.ContainerService/Put", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *containerServiceClient) Delete(ctx context.Context, in *DeleteRequest, opts ...grpc3.CallOption) (*DeleteResponse, error) { - out := new(DeleteResponse) - err := c.cc.Invoke(ctx, "/neo.fs.v2.container.ContainerService/Delete", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *containerServiceClient) Get(ctx context.Context, in *GetRequest, opts ...grpc3.CallOption) (*GetResponse, error) { - out := new(GetResponse) - err := c.cc.Invoke(ctx, "/neo.fs.v2.container.ContainerService/Get", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *containerServiceClient) List(ctx context.Context, in *ListRequest, opts ...grpc3.CallOption) (*ListResponse, error) { - out := new(ListResponse) - err := c.cc.Invoke(ctx, "/neo.fs.v2.container.ContainerService/List", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *containerServiceClient) SetExtendedACL(ctx context.Context, in *SetExtendedACLRequest, opts ...grpc3.CallOption) (*SetExtendedACLResponse, error) { - out := new(SetExtendedACLResponse) - err := c.cc.Invoke(ctx, "/neo.fs.v2.container.ContainerService/SetExtendedACL", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *containerServiceClient) GetExtendedACL(ctx context.Context, in *GetExtendedACLRequest, opts ...grpc3.CallOption) (*GetExtendedACLResponse, error) { - out := new(GetExtendedACLResponse) - err := c.cc.Invoke(ctx, "/neo.fs.v2.container.ContainerService/GetExtendedACL", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *containerServiceClient) AnnounceUsedSpace(ctx context.Context, in *AnnounceUsedSpaceRequest, opts ...grpc3.CallOption) (*AnnounceUsedSpaceResponse, error) { - out := new(AnnounceUsedSpaceResponse) - err := c.cc.Invoke(ctx, "/neo.fs.v2.container.ContainerService/AnnounceUsedSpace", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// ContainerServiceServer is the server API for ContainerService service. -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 - // verified by Inner Ring nodes. After one more block in sidechain, container - // is added into smart contract storage. - 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 - // verified by Inner Ring nodes. After one more block in sidechain, container - // is added into smart contract storage. - Delete(context.Context, *DeleteRequest) (*DeleteResponse, error) - // Returns container structure from `Container` smart contract storage. - Get(context.Context, *GetRequest) (*GetResponse, error) - // Returns all owner's containers from 'Container` smart contract' storage. - List(context.Context, *ListRequest) (*ListResponse, error) - // Invokes 'SetEACL' method of 'Container` smart contract and returns response - // immediately. After one more block in sidechain, Extended ACL changes are - // added into smart contract storage. - SetExtendedACL(context.Context, *SetExtendedACLRequest) (*SetExtendedACLResponse, error) - // Returns Extended ACL table and signature from `Container` smart contract - // storage. - GetExtendedACL(context.Context, *GetExtendedACLRequest) (*GetExtendedACLResponse, error) - // Announce container used space values for P2P synchronization. - AnnounceUsedSpace(context.Context, *AnnounceUsedSpaceRequest) (*AnnounceUsedSpaceResponse, error) -} - -// UnimplementedContainerServiceServer can 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") -} -func (*UnimplementedContainerServiceServer) Delete(context.Context, *DeleteRequest) (*DeleteResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Delete not implemented") -} -func (*UnimplementedContainerServiceServer) Get(context.Context, *GetRequest) (*GetResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Get not implemented") -} -func (*UnimplementedContainerServiceServer) List(context.Context, *ListRequest) (*ListResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method List not implemented") -} -func (*UnimplementedContainerServiceServer) SetExtendedACL(context.Context, *SetExtendedACLRequest) (*SetExtendedACLResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method SetExtendedACL not implemented") -} -func (*UnimplementedContainerServiceServer) GetExtendedACL(context.Context, *GetExtendedACLRequest) (*GetExtendedACLResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetExtendedACL not implemented") -} -func (*UnimplementedContainerServiceServer) AnnounceUsedSpace(context.Context, *AnnounceUsedSpaceRequest) (*AnnounceUsedSpaceResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method AnnounceUsedSpace not implemented") -} - -func RegisterContainerServiceServer(s *grpc3.Server, srv ContainerServiceServer) { - s.RegisterService(&_ContainerService_serviceDesc, srv) -} - -func _ContainerService_Put_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc3.UnaryServerInterceptor) (interface{}, error) { - in := new(PutRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ContainerServiceServer).Put(ctx, in) - } - info := &grpc3.UnaryServerInfo{ - Server: srv, - FullMethod: "/neo.fs.v2.container.ContainerService/Put", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ContainerServiceServer).Put(ctx, req.(*PutRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _ContainerService_Delete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc3.UnaryServerInterceptor) (interface{}, error) { - in := new(DeleteRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ContainerServiceServer).Delete(ctx, in) - } - info := &grpc3.UnaryServerInfo{ - Server: srv, - FullMethod: "/neo.fs.v2.container.ContainerService/Delete", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ContainerServiceServer).Delete(ctx, req.(*DeleteRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _ContainerService_Get_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc3.UnaryServerInterceptor) (interface{}, error) { - in := new(GetRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ContainerServiceServer).Get(ctx, in) - } - info := &grpc3.UnaryServerInfo{ - Server: srv, - FullMethod: "/neo.fs.v2.container.ContainerService/Get", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ContainerServiceServer).Get(ctx, req.(*GetRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _ContainerService_List_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc3.UnaryServerInterceptor) (interface{}, error) { - in := new(ListRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ContainerServiceServer).List(ctx, in) - } - info := &grpc3.UnaryServerInfo{ - Server: srv, - FullMethod: "/neo.fs.v2.container.ContainerService/List", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ContainerServiceServer).List(ctx, req.(*ListRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _ContainerService_SetExtendedACL_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc3.UnaryServerInterceptor) (interface{}, error) { - in := new(SetExtendedACLRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ContainerServiceServer).SetExtendedACL(ctx, in) - } - info := &grpc3.UnaryServerInfo{ - Server: srv, - FullMethod: "/neo.fs.v2.container.ContainerService/SetExtendedACL", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ContainerServiceServer).SetExtendedACL(ctx, req.(*SetExtendedACLRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _ContainerService_GetExtendedACL_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc3.UnaryServerInterceptor) (interface{}, error) { - in := new(GetExtendedACLRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ContainerServiceServer).GetExtendedACL(ctx, in) - } - info := &grpc3.UnaryServerInfo{ - Server: srv, - FullMethod: "/neo.fs.v2.container.ContainerService/GetExtendedACL", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ContainerServiceServer).GetExtendedACL(ctx, req.(*GetExtendedACLRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _ContainerService_AnnounceUsedSpace_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc3.UnaryServerInterceptor) (interface{}, error) { - in := new(AnnounceUsedSpaceRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ContainerServiceServer).AnnounceUsedSpace(ctx, in) - } - info := &grpc3.UnaryServerInfo{ - Server: srv, - FullMethod: "/neo.fs.v2.container.ContainerService/AnnounceUsedSpace", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ContainerServiceServer).AnnounceUsedSpace(ctx, req.(*AnnounceUsedSpaceRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _ContainerService_serviceDesc = grpc3.ServiceDesc{ - ServiceName: "neo.fs.v2.container.ContainerService", - HandlerType: (*ContainerServiceServer)(nil), - Methods: []grpc3.MethodDesc{ - { - MethodName: "Put", - Handler: _ContainerService_Put_Handler, - }, - { - MethodName: "Delete", - Handler: _ContainerService_Delete_Handler, - }, - { - MethodName: "Get", - Handler: _ContainerService_Get_Handler, - }, - { - MethodName: "List", - Handler: _ContainerService_List_Handler, - }, - { - MethodName: "SetExtendedACL", - Handler: _ContainerService_SetExtendedACL_Handler, - }, - { - MethodName: "GetExtendedACL", - Handler: _ContainerService_GetExtendedACL_Handler, - }, - { - MethodName: "AnnounceUsedSpace", - Handler: _ContainerService_AnnounceUsedSpace_Handler, - }, - }, - Streams: []grpc3.StreamDesc{}, - Metadata: "v2/container/grpc/service.proto", -} diff --git a/v2/container/grpc/service_grpc.pb.go b/v2/container/grpc/service_grpc.pb.go new file mode 100644 index 0000000..1449f92 --- /dev/null +++ b/v2/container/grpc/service_grpc.pb.go @@ -0,0 +1,347 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. + +package container + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +// 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. +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 + // verified by Inner Ring nodes. After one more block in sidechain, container + // is added into smart contract storage. + 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 + // verified by Inner Ring nodes. After one more block in sidechain, container + // is added into smart contract storage. + Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteResponse, error) + // Returns container structure from `Container` smart contract storage. + Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*GetResponse, error) + // Returns all owner's containers from 'Container` smart contract' storage. + List(ctx context.Context, in *ListRequest, opts ...grpc.CallOption) (*ListResponse, error) + // Invokes 'SetEACL' method of 'Container` smart contract and returns response + // immediately. After one more block in sidechain, Extended ACL changes are + // added into smart contract storage. + SetExtendedACL(ctx context.Context, in *SetExtendedACLRequest, opts ...grpc.CallOption) (*SetExtendedACLResponse, error) + // Returns Extended ACL table and signature from `Container` smart contract + // storage. + GetExtendedACL(ctx context.Context, in *GetExtendedACLRequest, opts ...grpc.CallOption) (*GetExtendedACLResponse, error) + // Announce container used space values for P2P synchronization. + AnnounceUsedSpace(ctx context.Context, in *AnnounceUsedSpaceRequest, opts ...grpc.CallOption) (*AnnounceUsedSpaceResponse, error) +} + +type containerServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewContainerServiceClient(cc grpc.ClientConnInterface) ContainerServiceClient { + return &containerServiceClient{cc} +} + +func (c *containerServiceClient) Put(ctx context.Context, in *PutRequest, opts ...grpc.CallOption) (*PutResponse, error) { + out := new(PutResponse) + err := c.cc.Invoke(ctx, "/neo.fs.v2.container.ContainerService/Put", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *containerServiceClient) Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteResponse, error) { + out := new(DeleteResponse) + err := c.cc.Invoke(ctx, "/neo.fs.v2.container.ContainerService/Delete", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *containerServiceClient) Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*GetResponse, error) { + out := new(GetResponse) + err := c.cc.Invoke(ctx, "/neo.fs.v2.container.ContainerService/Get", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *containerServiceClient) List(ctx context.Context, in *ListRequest, opts ...grpc.CallOption) (*ListResponse, error) { + out := new(ListResponse) + err := c.cc.Invoke(ctx, "/neo.fs.v2.container.ContainerService/List", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *containerServiceClient) SetExtendedACL(ctx context.Context, in *SetExtendedACLRequest, opts ...grpc.CallOption) (*SetExtendedACLResponse, error) { + out := new(SetExtendedACLResponse) + err := c.cc.Invoke(ctx, "/neo.fs.v2.container.ContainerService/SetExtendedACL", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *containerServiceClient) GetExtendedACL(ctx context.Context, in *GetExtendedACLRequest, opts ...grpc.CallOption) (*GetExtendedACLResponse, error) { + out := new(GetExtendedACLResponse) + err := c.cc.Invoke(ctx, "/neo.fs.v2.container.ContainerService/GetExtendedACL", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *containerServiceClient) AnnounceUsedSpace(ctx context.Context, in *AnnounceUsedSpaceRequest, opts ...grpc.CallOption) (*AnnounceUsedSpaceResponse, error) { + out := new(AnnounceUsedSpaceResponse) + err := c.cc.Invoke(ctx, "/neo.fs.v2.container.ContainerService/AnnounceUsedSpace", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// ContainerServiceServer is the server API for ContainerService service. +// All implementations should embed UnimplementedContainerServiceServer +// 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 + // verified by Inner Ring nodes. After one more block in sidechain, container + // is added into smart contract storage. + 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 + // verified by Inner Ring nodes. After one more block in sidechain, container + // is added into smart contract storage. + Delete(context.Context, *DeleteRequest) (*DeleteResponse, error) + // Returns container structure from `Container` smart contract storage. + Get(context.Context, *GetRequest) (*GetResponse, error) + // Returns all owner's containers from 'Container` smart contract' storage. + List(context.Context, *ListRequest) (*ListResponse, error) + // Invokes 'SetEACL' method of 'Container` smart contract and returns response + // immediately. After one more block in sidechain, Extended ACL changes are + // added into smart contract storage. + SetExtendedACL(context.Context, *SetExtendedACLRequest) (*SetExtendedACLResponse, error) + // Returns Extended ACL table and signature from `Container` smart contract + // storage. + GetExtendedACL(context.Context, *GetExtendedACLRequest) (*GetExtendedACLResponse, error) + // Announce container used space values for P2P synchronization. + AnnounceUsedSpace(context.Context, *AnnounceUsedSpaceRequest) (*AnnounceUsedSpaceResponse, error) +} + +// 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") +} +func (UnimplementedContainerServiceServer) Delete(context.Context, *DeleteRequest) (*DeleteResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Delete not implemented") +} +func (UnimplementedContainerServiceServer) Get(context.Context, *GetRequest) (*GetResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Get not implemented") +} +func (UnimplementedContainerServiceServer) List(context.Context, *ListRequest) (*ListResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method List not implemented") +} +func (UnimplementedContainerServiceServer) SetExtendedACL(context.Context, *SetExtendedACLRequest) (*SetExtendedACLResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SetExtendedACL not implemented") +} +func (UnimplementedContainerServiceServer) GetExtendedACL(context.Context, *GetExtendedACLRequest) (*GetExtendedACLResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetExtendedACL not implemented") +} +func (UnimplementedContainerServiceServer) AnnounceUsedSpace(context.Context, *AnnounceUsedSpaceRequest) (*AnnounceUsedSpaceResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method AnnounceUsedSpace not implemented") +} + +// 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 +// result in compilation errors. +type UnsafeContainerServiceServer interface { + mustEmbedUnimplementedContainerServiceServer() +} + +func RegisterContainerServiceServer(s grpc.ServiceRegistrar, srv ContainerServiceServer) { + s.RegisterService(&ContainerService_ServiceDesc, srv) +} + +func _ContainerService_Put_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(PutRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ContainerServiceServer).Put(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/neo.fs.v2.container.ContainerService/Put", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ContainerServiceServer).Put(ctx, req.(*PutRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ContainerService_Delete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ContainerServiceServer).Delete(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/neo.fs.v2.container.ContainerService/Delete", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ContainerServiceServer).Delete(ctx, req.(*DeleteRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ContainerService_Get_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ContainerServiceServer).Get(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/neo.fs.v2.container.ContainerService/Get", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ContainerServiceServer).Get(ctx, req.(*GetRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ContainerService_List_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ContainerServiceServer).List(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/neo.fs.v2.container.ContainerService/List", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ContainerServiceServer).List(ctx, req.(*ListRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ContainerService_SetExtendedACL_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SetExtendedACLRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ContainerServiceServer).SetExtendedACL(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/neo.fs.v2.container.ContainerService/SetExtendedACL", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ContainerServiceServer).SetExtendedACL(ctx, req.(*SetExtendedACLRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ContainerService_GetExtendedACL_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetExtendedACLRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ContainerServiceServer).GetExtendedACL(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/neo.fs.v2.container.ContainerService/GetExtendedACL", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ContainerServiceServer).GetExtendedACL(ctx, req.(*GetExtendedACLRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ContainerService_AnnounceUsedSpace_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AnnounceUsedSpaceRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ContainerServiceServer).AnnounceUsedSpace(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/neo.fs.v2.container.ContainerService/AnnounceUsedSpace", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ContainerServiceServer).AnnounceUsedSpace(ctx, req.(*AnnounceUsedSpaceRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// 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) +var ContainerService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "neo.fs.v2.container.ContainerService", + HandlerType: (*ContainerServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Put", + Handler: _ContainerService_Put_Handler, + }, + { + MethodName: "Delete", + Handler: _ContainerService_Delete_Handler, + }, + { + MethodName: "Get", + Handler: _ContainerService_Get_Handler, + }, + { + MethodName: "List", + Handler: _ContainerService_List_Handler, + }, + { + MethodName: "SetExtendedACL", + Handler: _ContainerService_SetExtendedACL_Handler, + }, + { + MethodName: "GetExtendedACL", + Handler: _ContainerService_GetExtendedACL_Handler, + }, + { + MethodName: "AnnounceUsedSpace", + Handler: _ContainerService_AnnounceUsedSpace_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "v2/container/grpc/service.proto", +} diff --git a/v2/container/grpc/types.pb.go b/v2/container/grpc/types.pb.go index 490a529..92975ee 100644 --- a/v2/container/grpc/types.pb.go +++ b/v2/container/grpc/types.pb.go @@ -1,13 +1,12 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.23.0 -// protoc v3.14.0 +// protoc-gen-go v1.27.1 +// protoc v3.18.0 // source: v2/container/grpc/types.proto package container import ( - proto "github.com/golang/protobuf/proto" grpc1 "github.com/nspcc-dev/neofs-api-go/v2/netmap/grpc" grpc "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" protoreflect "google.golang.org/protobuf/reflect/protoreflect" @@ -23,10 +22,6 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - // 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. ID of the container is a 32 byte long SHA256 hash diff --git a/v2/netmap/grpc/service.pb.go b/v2/netmap/grpc/service.pb.go index 50a30d9..c39ec43 100644 --- a/v2/netmap/grpc/service.pb.go +++ b/v2/netmap/grpc/service.pb.go @@ -1,19 +1,14 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.23.0 -// protoc v3.14.0 +// protoc-gen-go v1.27.1 +// protoc v3.18.0 // source: v2/netmap/grpc/service.proto package netmap import ( - context "context" - proto "github.com/golang/protobuf/proto" grpc1 "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" grpc "github.com/nspcc-dev/neofs-api-go/v2/session/grpc" - grpc2 "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -27,10 +22,6 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - // Get NodeInfo structure from the particular node directly type LocalNodeInfoRequest struct { state protoimpl.MessageState @@ -784,131 +775,3 @@ func file_v2_netmap_grpc_service_proto_init() { file_v2_netmap_grpc_service_proto_goTypes = nil file_v2_netmap_grpc_service_proto_depIdxs = nil } - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc2.ClientConnInterface - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc2.SupportPackageIsVersion6 - -// NetmapServiceClient is the client API for NetmapService service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type NetmapServiceClient interface { - // Get NodeInfo structure from the particular node directly. Node information - // can be taken from `Netmap` smart contract, but in some cases the one may - // want to get recent information directly, or to talk to the node not yet - // present in `Network Map` to find out what API version can be used for - // further communication. Can also be used to check if node is up and running. - LocalNodeInfo(ctx context.Context, in *LocalNodeInfoRequest, opts ...grpc2.CallOption) (*LocalNodeInfoResponse, error) - // Read recent information about the NeoFS network. - NetworkInfo(ctx context.Context, in *NetworkInfoRequest, opts ...grpc2.CallOption) (*NetworkInfoResponse, error) -} - -type netmapServiceClient struct { - cc grpc2.ClientConnInterface -} - -func NewNetmapServiceClient(cc grpc2.ClientConnInterface) NetmapServiceClient { - return &netmapServiceClient{cc} -} - -func (c *netmapServiceClient) LocalNodeInfo(ctx context.Context, in *LocalNodeInfoRequest, opts ...grpc2.CallOption) (*LocalNodeInfoResponse, error) { - out := new(LocalNodeInfoResponse) - err := c.cc.Invoke(ctx, "/neo.fs.v2.netmap.NetmapService/LocalNodeInfo", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *netmapServiceClient) NetworkInfo(ctx context.Context, in *NetworkInfoRequest, opts ...grpc2.CallOption) (*NetworkInfoResponse, error) { - out := new(NetworkInfoResponse) - err := c.cc.Invoke(ctx, "/neo.fs.v2.netmap.NetmapService/NetworkInfo", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// NetmapServiceServer is the server API for NetmapService service. -type NetmapServiceServer interface { - // Get NodeInfo structure from the particular node directly. Node information - // can be taken from `Netmap` smart contract, but in some cases the one may - // want to get recent information directly, or to talk to the node not yet - // present in `Network Map` to find out what API version can be used for - // further communication. Can also be used to check if node is up and running. - LocalNodeInfo(context.Context, *LocalNodeInfoRequest) (*LocalNodeInfoResponse, error) - // Read recent information about the NeoFS network. - NetworkInfo(context.Context, *NetworkInfoRequest) (*NetworkInfoResponse, error) -} - -// UnimplementedNetmapServiceServer can 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") -} -func (*UnimplementedNetmapServiceServer) NetworkInfo(context.Context, *NetworkInfoRequest) (*NetworkInfoResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method NetworkInfo not implemented") -} - -func RegisterNetmapServiceServer(s *grpc2.Server, srv NetmapServiceServer) { - s.RegisterService(&_NetmapService_serviceDesc, srv) -} - -func _NetmapService_LocalNodeInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc2.UnaryServerInterceptor) (interface{}, error) { - in := new(LocalNodeInfoRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(NetmapServiceServer).LocalNodeInfo(ctx, in) - } - info := &grpc2.UnaryServerInfo{ - Server: srv, - FullMethod: "/neo.fs.v2.netmap.NetmapService/LocalNodeInfo", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(NetmapServiceServer).LocalNodeInfo(ctx, req.(*LocalNodeInfoRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _NetmapService_NetworkInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc2.UnaryServerInterceptor) (interface{}, error) { - in := new(NetworkInfoRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(NetmapServiceServer).NetworkInfo(ctx, in) - } - info := &grpc2.UnaryServerInfo{ - Server: srv, - FullMethod: "/neo.fs.v2.netmap.NetmapService/NetworkInfo", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(NetmapServiceServer).NetworkInfo(ctx, req.(*NetworkInfoRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _NetmapService_serviceDesc = grpc2.ServiceDesc{ - ServiceName: "neo.fs.v2.netmap.NetmapService", - HandlerType: (*NetmapServiceServer)(nil), - Methods: []grpc2.MethodDesc{ - { - MethodName: "LocalNodeInfo", - Handler: _NetmapService_LocalNodeInfo_Handler, - }, - { - MethodName: "NetworkInfo", - Handler: _NetmapService_NetworkInfo_Handler, - }, - }, - Streams: []grpc2.StreamDesc{}, - Metadata: "v2/netmap/grpc/service.proto", -} diff --git a/v2/netmap/grpc/service_grpc.pb.go b/v2/netmap/grpc/service_grpc.pb.go new file mode 100644 index 0000000..01252c8 --- /dev/null +++ b/v2/netmap/grpc/service_grpc.pb.go @@ -0,0 +1,147 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. + +package netmap + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +// 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. +type NetmapServiceClient interface { + // Get NodeInfo structure from the particular node directly. Node information + // can be taken from `Netmap` smart contract, but in some cases the one may + // want to get recent information directly, or to talk to the node not yet + // present in `Network Map` to find out what API version can be used for + // further communication. Can also be used to check if node is up and running. + LocalNodeInfo(ctx context.Context, in *LocalNodeInfoRequest, opts ...grpc.CallOption) (*LocalNodeInfoResponse, error) + // Read recent information about the NeoFS network. + NetworkInfo(ctx context.Context, in *NetworkInfoRequest, opts ...grpc.CallOption) (*NetworkInfoResponse, error) +} + +type netmapServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewNetmapServiceClient(cc grpc.ClientConnInterface) NetmapServiceClient { + return &netmapServiceClient{cc} +} + +func (c *netmapServiceClient) LocalNodeInfo(ctx context.Context, in *LocalNodeInfoRequest, opts ...grpc.CallOption) (*LocalNodeInfoResponse, error) { + out := new(LocalNodeInfoResponse) + err := c.cc.Invoke(ctx, "/neo.fs.v2.netmap.NetmapService/LocalNodeInfo", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *netmapServiceClient) NetworkInfo(ctx context.Context, in *NetworkInfoRequest, opts ...grpc.CallOption) (*NetworkInfoResponse, error) { + out := new(NetworkInfoResponse) + err := c.cc.Invoke(ctx, "/neo.fs.v2.netmap.NetmapService/NetworkInfo", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// NetmapServiceServer is the server API for NetmapService service. +// All implementations should embed UnimplementedNetmapServiceServer +// for forward compatibility +type NetmapServiceServer interface { + // Get NodeInfo structure from the particular node directly. Node information + // can be taken from `Netmap` smart contract, but in some cases the one may + // want to get recent information directly, or to talk to the node not yet + // present in `Network Map` to find out what API version can be used for + // further communication. Can also be used to check if node is up and running. + LocalNodeInfo(context.Context, *LocalNodeInfoRequest) (*LocalNodeInfoResponse, error) + // Read recent information about the NeoFS network. + NetworkInfo(context.Context, *NetworkInfoRequest) (*NetworkInfoResponse, error) +} + +// 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") +} +func (UnimplementedNetmapServiceServer) NetworkInfo(context.Context, *NetworkInfoRequest) (*NetworkInfoResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method NetworkInfo not implemented") +} + +// 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 +// result in compilation errors. +type UnsafeNetmapServiceServer interface { + mustEmbedUnimplementedNetmapServiceServer() +} + +func RegisterNetmapServiceServer(s grpc.ServiceRegistrar, srv NetmapServiceServer) { + s.RegisterService(&NetmapService_ServiceDesc, srv) +} + +func _NetmapService_LocalNodeInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(LocalNodeInfoRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(NetmapServiceServer).LocalNodeInfo(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/neo.fs.v2.netmap.NetmapService/LocalNodeInfo", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(NetmapServiceServer).LocalNodeInfo(ctx, req.(*LocalNodeInfoRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _NetmapService_NetworkInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(NetworkInfoRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(NetmapServiceServer).NetworkInfo(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/neo.fs.v2.netmap.NetmapService/NetworkInfo", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(NetmapServiceServer).NetworkInfo(ctx, req.(*NetworkInfoRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// NetmapService_ServiceDesc is the grpc.ServiceDesc for NetmapService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var NetmapService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "neo.fs.v2.netmap.NetmapService", + HandlerType: (*NetmapServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "LocalNodeInfo", + Handler: _NetmapService_LocalNodeInfo_Handler, + }, + { + MethodName: "NetworkInfo", + Handler: _NetmapService_NetworkInfo_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "v2/netmap/grpc/service.proto", +} diff --git a/v2/netmap/grpc/types.pb.go b/v2/netmap/grpc/types.pb.go index 3c640d0..60aa3ac 100644 --- a/v2/netmap/grpc/types.pb.go +++ b/v2/netmap/grpc/types.pb.go @@ -1,13 +1,12 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.23.0 -// protoc v3.14.0 +// protoc-gen-go v1.27.1 +// protoc v3.18.0 // source: v2/netmap/grpc/types.proto package netmap import ( - proto "github.com/golang/protobuf/proto" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -21,10 +20,6 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - // Operations on filters type Operation int32 diff --git a/v2/object/grpc/service.pb.go b/v2/object/grpc/service.pb.go index 4bcdb6d..9c61501 100644 --- a/v2/object/grpc/service.pb.go +++ b/v2/object/grpc/service.pb.go @@ -1,19 +1,14 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.23.0 -// protoc v3.14.0 +// protoc-gen-go v1.27.1 +// protoc v3.18.0 // source: v2/object/grpc/service.proto package object import ( - context "context" - proto "github.com/golang/protobuf/proto" grpc1 "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" grpc "github.com/nspcc-dev/neofs-api-go/v2/session/grpc" - grpc2 "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -27,10 +22,6 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - // GET object request type GetRequest struct { state protoimpl.MessageState @@ -2305,7 +2296,7 @@ func (x *GetRangeHashRequest_Body) GetType() grpc1.ChecksumType { if x != nil { return x.Type } - return grpc1.ChecksumType_CHECKSUM_TYPE_UNSPECIFIED + return grpc1.ChecksumType(0) } // Get hash of object's payload part response body. @@ -2356,7 +2347,7 @@ func (x *GetRangeHashResponse_Body) GetType() grpc1.ChecksumType { if x != nil { return x.Type } - return grpc1.ChecksumType_CHECKSUM_TYPE_UNSPECIFIED + return grpc1.ChecksumType(0) } func (x *GetRangeHashResponse_Body) GetHashList() [][]byte { @@ -3362,471 +3353,3 @@ func file_v2_object_grpc_service_proto_init() { file_v2_object_grpc_service_proto_goTypes = nil file_v2_object_grpc_service_proto_depIdxs = nil } - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc2.ClientConnInterface - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc2.SupportPackageIsVersion6 - -// ObjectServiceClient is the client API for ObjectService service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type ObjectServiceClient interface { - // Receive full object structure, including Headers and payload. Response uses - // gRPC stream. First response message carries object with requested address. - // Chunk messages are parts of the object's payload if it is needed. All - // messages, except the first one, carry payload chunks. Requested object can - // be restored by concatenation of object message payload and all chunks - // keeping receiving order. - Get(ctx context.Context, in *GetRequest, opts ...grpc2.CallOption) (ObjectService_GetClient, error) - // Put the object into container. Request uses gRPC stream. First message - // SHOULD be of PutHeader type. `ContainerID` and `OwnerID` of an object - // SHOULD be set. Session token SHOULD be obtained before `PUT` operation (see - // session package). Chunk messages are considered by server as a part of an - // object payload. All messages, except first one, SHOULD be payload chunks. - // Chunk messages SHOULD be sent in direct order of fragmentation. - Put(ctx context.Context, opts ...grpc2.CallOption) (ObjectService_PutClient, error) - // Delete the object from a container. There is no immediate removal - // guarantee. Object will be marked for removal and deleted eventually. - Delete(ctx context.Context, in *DeleteRequest, opts ...grpc2.CallOption) (*DeleteResponse, error) - // Returns the object Headers without data payload. By default full header is - // returned. If `main_only` request field is set, the short header with only - // the very minimal information would be returned instead. - Head(ctx context.Context, in *HeadRequest, opts ...grpc2.CallOption) (*HeadResponse, error) - // Search objects in container. Search query allows to match by Object - // Header's filed values. Please see the corresponding NeoFS Technical - // Specification section for more details. - Search(ctx context.Context, in *SearchRequest, opts ...grpc2.CallOption) (ObjectService_SearchClient, error) - // Get byte range of data payload. Range is set as an (offset, length) tuple. - // Like in `Get` method, the response uses gRPC stream. Requested range can be - // restored by concatenation of all received payload chunks keeping receiving - // order. - GetRange(ctx context.Context, in *GetRangeRequest, opts ...grpc2.CallOption) (ObjectService_GetRangeClient, error) - // Returns homomorphic or regular hash of object's payload range after - // applying XOR operation with the provided `salt`. Ranges are set of (offset, - // length) tuples. Hashes order in response corresponds to ranges order in - // request. Note that hash is calculated for XORed data. - GetRangeHash(ctx context.Context, in *GetRangeHashRequest, opts ...grpc2.CallOption) (*GetRangeHashResponse, error) -} - -type objectServiceClient struct { - cc grpc2.ClientConnInterface -} - -func NewObjectServiceClient(cc grpc2.ClientConnInterface) ObjectServiceClient { - return &objectServiceClient{cc} -} - -func (c *objectServiceClient) Get(ctx context.Context, in *GetRequest, opts ...grpc2.CallOption) (ObjectService_GetClient, error) { - stream, err := c.cc.NewStream(ctx, &_ObjectService_serviceDesc.Streams[0], "/neo.fs.v2.object.ObjectService/Get", opts...) - if err != nil { - return nil, err - } - x := &objectServiceGetClient{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 -} - -type ObjectService_GetClient interface { - Recv() (*GetResponse, error) - grpc2.ClientStream -} - -type objectServiceGetClient struct { - grpc2.ClientStream -} - -func (x *objectServiceGetClient) Recv() (*GetResponse, error) { - m := new(GetResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *objectServiceClient) Put(ctx context.Context, opts ...grpc2.CallOption) (ObjectService_PutClient, error) { - stream, err := c.cc.NewStream(ctx, &_ObjectService_serviceDesc.Streams[1], "/neo.fs.v2.object.ObjectService/Put", opts...) - if err != nil { - return nil, err - } - x := &objectServicePutClient{stream} - return x, nil -} - -type ObjectService_PutClient interface { - Send(*PutRequest) error - CloseAndRecv() (*PutResponse, error) - grpc2.ClientStream -} - -type objectServicePutClient struct { - grpc2.ClientStream -} - -func (x *objectServicePutClient) Send(m *PutRequest) error { - return x.ClientStream.SendMsg(m) -} - -func (x *objectServicePutClient) CloseAndRecv() (*PutResponse, error) { - if err := x.ClientStream.CloseSend(); err != nil { - return nil, err - } - m := new(PutResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *objectServiceClient) Delete(ctx context.Context, in *DeleteRequest, opts ...grpc2.CallOption) (*DeleteResponse, error) { - out := new(DeleteResponse) - err := c.cc.Invoke(ctx, "/neo.fs.v2.object.ObjectService/Delete", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *objectServiceClient) Head(ctx context.Context, in *HeadRequest, opts ...grpc2.CallOption) (*HeadResponse, error) { - out := new(HeadResponse) - err := c.cc.Invoke(ctx, "/neo.fs.v2.object.ObjectService/Head", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *objectServiceClient) Search(ctx context.Context, in *SearchRequest, opts ...grpc2.CallOption) (ObjectService_SearchClient, error) { - stream, err := c.cc.NewStream(ctx, &_ObjectService_serviceDesc.Streams[2], "/neo.fs.v2.object.ObjectService/Search", opts...) - if err != nil { - return nil, err - } - x := &objectServiceSearchClient{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 -} - -type ObjectService_SearchClient interface { - Recv() (*SearchResponse, error) - grpc2.ClientStream -} - -type objectServiceSearchClient struct { - grpc2.ClientStream -} - -func (x *objectServiceSearchClient) Recv() (*SearchResponse, error) { - m := new(SearchResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *objectServiceClient) GetRange(ctx context.Context, in *GetRangeRequest, opts ...grpc2.CallOption) (ObjectService_GetRangeClient, error) { - stream, err := c.cc.NewStream(ctx, &_ObjectService_serviceDesc.Streams[3], "/neo.fs.v2.object.ObjectService/GetRange", opts...) - if err != nil { - return nil, err - } - x := &objectServiceGetRangeClient{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 -} - -type ObjectService_GetRangeClient interface { - Recv() (*GetRangeResponse, error) - grpc2.ClientStream -} - -type objectServiceGetRangeClient struct { - grpc2.ClientStream -} - -func (x *objectServiceGetRangeClient) Recv() (*GetRangeResponse, error) { - m := new(GetRangeResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *objectServiceClient) GetRangeHash(ctx context.Context, in *GetRangeHashRequest, opts ...grpc2.CallOption) (*GetRangeHashResponse, error) { - out := new(GetRangeHashResponse) - err := c.cc.Invoke(ctx, "/neo.fs.v2.object.ObjectService/GetRangeHash", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// ObjectServiceServer is the server API for ObjectService service. -type ObjectServiceServer interface { - // Receive full object structure, including Headers and payload. Response uses - // gRPC stream. First response message carries object with requested address. - // Chunk messages are parts of the object's payload if it is needed. All - // messages, except the first one, carry payload chunks. Requested object can - // be restored by concatenation of object message payload and all chunks - // keeping receiving order. - Get(*GetRequest, ObjectService_GetServer) error - // Put the object into container. Request uses gRPC stream. First message - // SHOULD be of PutHeader type. `ContainerID` and `OwnerID` of an object - // SHOULD be set. Session token SHOULD be obtained before `PUT` operation (see - // session package). Chunk messages are considered by server as a part of an - // object payload. All messages, except first one, SHOULD be payload chunks. - // Chunk messages SHOULD be sent in direct order of fragmentation. - Put(ObjectService_PutServer) error - // Delete the object from a container. There is no immediate removal - // guarantee. Object will be marked for removal and deleted eventually. - Delete(context.Context, *DeleteRequest) (*DeleteResponse, error) - // Returns the object Headers without data payload. By default full header is - // returned. If `main_only` request field is set, the short header with only - // the very minimal information would be returned instead. - Head(context.Context, *HeadRequest) (*HeadResponse, error) - // Search objects in container. Search query allows to match by Object - // Header's filed values. Please see the corresponding NeoFS Technical - // Specification section for more details. - Search(*SearchRequest, ObjectService_SearchServer) error - // Get byte range of data payload. Range is set as an (offset, length) tuple. - // Like in `Get` method, the response uses gRPC stream. Requested range can be - // restored by concatenation of all received payload chunks keeping receiving - // order. - GetRange(*GetRangeRequest, ObjectService_GetRangeServer) error - // Returns homomorphic or regular hash of object's payload range after - // applying XOR operation with the provided `salt`. Ranges are set of (offset, - // length) tuples. Hashes order in response corresponds to ranges order in - // request. Note that hash is calculated for XORed data. - GetRangeHash(context.Context, *GetRangeHashRequest) (*GetRangeHashResponse, error) -} - -// UnimplementedObjectServiceServer can be embedded to have forward compatible implementations. -type UnimplementedObjectServiceServer struct { -} - -func (*UnimplementedObjectServiceServer) Get(*GetRequest, ObjectService_GetServer) error { - return status.Errorf(codes.Unimplemented, "method Get not implemented") -} -func (*UnimplementedObjectServiceServer) Put(ObjectService_PutServer) error { - return status.Errorf(codes.Unimplemented, "method Put not implemented") -} -func (*UnimplementedObjectServiceServer) Delete(context.Context, *DeleteRequest) (*DeleteResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Delete not implemented") -} -func (*UnimplementedObjectServiceServer) Head(context.Context, *HeadRequest) (*HeadResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Head not implemented") -} -func (*UnimplementedObjectServiceServer) Search(*SearchRequest, ObjectService_SearchServer) error { - return status.Errorf(codes.Unimplemented, "method Search not implemented") -} -func (*UnimplementedObjectServiceServer) GetRange(*GetRangeRequest, ObjectService_GetRangeServer) error { - return status.Errorf(codes.Unimplemented, "method GetRange not implemented") -} -func (*UnimplementedObjectServiceServer) GetRangeHash(context.Context, *GetRangeHashRequest) (*GetRangeHashResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetRangeHash not implemented") -} - -func RegisterObjectServiceServer(s *grpc2.Server, srv ObjectServiceServer) { - s.RegisterService(&_ObjectService_serviceDesc, srv) -} - -func _ObjectService_Get_Handler(srv interface{}, stream grpc2.ServerStream) error { - m := new(GetRequest) - if err := stream.RecvMsg(m); err != nil { - return err - } - return srv.(ObjectServiceServer).Get(m, &objectServiceGetServer{stream}) -} - -type ObjectService_GetServer interface { - Send(*GetResponse) error - grpc2.ServerStream -} - -type objectServiceGetServer struct { - grpc2.ServerStream -} - -func (x *objectServiceGetServer) Send(m *GetResponse) error { - return x.ServerStream.SendMsg(m) -} - -func _ObjectService_Put_Handler(srv interface{}, stream grpc2.ServerStream) error { - return srv.(ObjectServiceServer).Put(&objectServicePutServer{stream}) -} - -type ObjectService_PutServer interface { - SendAndClose(*PutResponse) error - Recv() (*PutRequest, error) - grpc2.ServerStream -} - -type objectServicePutServer struct { - grpc2.ServerStream -} - -func (x *objectServicePutServer) SendAndClose(m *PutResponse) error { - return x.ServerStream.SendMsg(m) -} - -func (x *objectServicePutServer) Recv() (*PutRequest, error) { - m := new(PutRequest) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func _ObjectService_Delete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc2.UnaryServerInterceptor) (interface{}, error) { - in := new(DeleteRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ObjectServiceServer).Delete(ctx, in) - } - info := &grpc2.UnaryServerInfo{ - Server: srv, - FullMethod: "/neo.fs.v2.object.ObjectService/Delete", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ObjectServiceServer).Delete(ctx, req.(*DeleteRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _ObjectService_Head_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc2.UnaryServerInterceptor) (interface{}, error) { - in := new(HeadRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ObjectServiceServer).Head(ctx, in) - } - info := &grpc2.UnaryServerInfo{ - Server: srv, - FullMethod: "/neo.fs.v2.object.ObjectService/Head", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ObjectServiceServer).Head(ctx, req.(*HeadRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _ObjectService_Search_Handler(srv interface{}, stream grpc2.ServerStream) error { - m := new(SearchRequest) - if err := stream.RecvMsg(m); err != nil { - return err - } - return srv.(ObjectServiceServer).Search(m, &objectServiceSearchServer{stream}) -} - -type ObjectService_SearchServer interface { - Send(*SearchResponse) error - grpc2.ServerStream -} - -type objectServiceSearchServer struct { - grpc2.ServerStream -} - -func (x *objectServiceSearchServer) Send(m *SearchResponse) error { - return x.ServerStream.SendMsg(m) -} - -func _ObjectService_GetRange_Handler(srv interface{}, stream grpc2.ServerStream) error { - m := new(GetRangeRequest) - if err := stream.RecvMsg(m); err != nil { - return err - } - return srv.(ObjectServiceServer).GetRange(m, &objectServiceGetRangeServer{stream}) -} - -type ObjectService_GetRangeServer interface { - Send(*GetRangeResponse) error - grpc2.ServerStream -} - -type objectServiceGetRangeServer struct { - grpc2.ServerStream -} - -func (x *objectServiceGetRangeServer) Send(m *GetRangeResponse) error { - return x.ServerStream.SendMsg(m) -} - -func _ObjectService_GetRangeHash_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc2.UnaryServerInterceptor) (interface{}, error) { - in := new(GetRangeHashRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ObjectServiceServer).GetRangeHash(ctx, in) - } - info := &grpc2.UnaryServerInfo{ - Server: srv, - FullMethod: "/neo.fs.v2.object.ObjectService/GetRangeHash", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ObjectServiceServer).GetRangeHash(ctx, req.(*GetRangeHashRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _ObjectService_serviceDesc = grpc2.ServiceDesc{ - ServiceName: "neo.fs.v2.object.ObjectService", - HandlerType: (*ObjectServiceServer)(nil), - Methods: []grpc2.MethodDesc{ - { - MethodName: "Delete", - Handler: _ObjectService_Delete_Handler, - }, - { - MethodName: "Head", - Handler: _ObjectService_Head_Handler, - }, - { - MethodName: "GetRangeHash", - Handler: _ObjectService_GetRangeHash_Handler, - }, - }, - Streams: []grpc2.StreamDesc{ - { - StreamName: "Get", - Handler: _ObjectService_Get_Handler, - ServerStreams: true, - }, - { - StreamName: "Put", - Handler: _ObjectService_Put_Handler, - ClientStreams: true, - }, - { - StreamName: "Search", - Handler: _ObjectService_Search_Handler, - ServerStreams: true, - }, - { - StreamName: "GetRange", - Handler: _ObjectService_GetRange_Handler, - ServerStreams: true, - }, - }, - Metadata: "v2/object/grpc/service.proto", -} diff --git a/v2/object/grpc/service_grpc.pb.go b/v2/object/grpc/service_grpc.pb.go new file mode 100644 index 0000000..f07c5d1 --- /dev/null +++ b/v2/object/grpc/service_grpc.pb.go @@ -0,0 +1,487 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. + +package object + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +// ObjectServiceClient is the client API for ObjectService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type ObjectServiceClient interface { + // Receive full object structure, including Headers and payload. Response uses + // gRPC stream. First response message carries object with requested address. + // Chunk messages are parts of the object's payload if it is needed. All + // messages, except the first one, carry payload chunks. Requested object can + // be restored by concatenation of object message payload and all chunks + // keeping receiving order. + Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (ObjectService_GetClient, error) + // Put the object into container. Request uses gRPC stream. First message + // SHOULD be of PutHeader type. `ContainerID` and `OwnerID` of an object + // SHOULD be set. Session token SHOULD be obtained before `PUT` operation (see + // session package). Chunk messages are considered by server as a part of an + // object payload. All messages, except first one, SHOULD be payload chunks. + // Chunk messages SHOULD be sent in direct order of fragmentation. + Put(ctx context.Context, opts ...grpc.CallOption) (ObjectService_PutClient, error) + // Delete the object from a container. There is no immediate removal + // guarantee. Object will be marked for removal and deleted eventually. + Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteResponse, error) + // Returns the object Headers without data payload. By default full header is + // returned. If `main_only` request field is set, the short header with only + // the very minimal information would be returned instead. + Head(ctx context.Context, in *HeadRequest, opts ...grpc.CallOption) (*HeadResponse, error) + // Search objects in container. Search query allows to match by Object + // Header's filed values. Please see the corresponding NeoFS Technical + // Specification section for more details. + Search(ctx context.Context, in *SearchRequest, opts ...grpc.CallOption) (ObjectService_SearchClient, error) + // Get byte range of data payload. Range is set as an (offset, length) tuple. + // Like in `Get` method, the response uses gRPC stream. Requested range can be + // restored by concatenation of all received payload chunks keeping receiving + // order. + GetRange(ctx context.Context, in *GetRangeRequest, opts ...grpc.CallOption) (ObjectService_GetRangeClient, error) + // Returns homomorphic or regular hash of object's payload range after + // applying XOR operation with the provided `salt`. Ranges are set of (offset, + // length) tuples. Hashes order in response corresponds to ranges order in + // request. Note that hash is calculated for XORed data. + GetRangeHash(ctx context.Context, in *GetRangeHashRequest, opts ...grpc.CallOption) (*GetRangeHashResponse, error) +} + +type objectServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewObjectServiceClient(cc grpc.ClientConnInterface) ObjectServiceClient { + return &objectServiceClient{cc} +} + +func (c *objectServiceClient) Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (ObjectService_GetClient, error) { + stream, err := c.cc.NewStream(ctx, &ObjectService_ServiceDesc.Streams[0], "/neo.fs.v2.object.ObjectService/Get", opts...) + if err != nil { + return nil, err + } + x := &objectServiceGetClient{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 +} + +type ObjectService_GetClient interface { + Recv() (*GetResponse, error) + grpc.ClientStream +} + +type objectServiceGetClient struct { + grpc.ClientStream +} + +func (x *objectServiceGetClient) Recv() (*GetResponse, error) { + m := new(GetResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *objectServiceClient) Put(ctx context.Context, opts ...grpc.CallOption) (ObjectService_PutClient, error) { + stream, err := c.cc.NewStream(ctx, &ObjectService_ServiceDesc.Streams[1], "/neo.fs.v2.object.ObjectService/Put", opts...) + if err != nil { + return nil, err + } + x := &objectServicePutClient{stream} + return x, nil +} + +type ObjectService_PutClient interface { + Send(*PutRequest) error + CloseAndRecv() (*PutResponse, error) + grpc.ClientStream +} + +type objectServicePutClient struct { + grpc.ClientStream +} + +func (x *objectServicePutClient) Send(m *PutRequest) error { + return x.ClientStream.SendMsg(m) +} + +func (x *objectServicePutClient) CloseAndRecv() (*PutResponse, error) { + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + m := new(PutResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *objectServiceClient) Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteResponse, error) { + out := new(DeleteResponse) + err := c.cc.Invoke(ctx, "/neo.fs.v2.object.ObjectService/Delete", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *objectServiceClient) Head(ctx context.Context, in *HeadRequest, opts ...grpc.CallOption) (*HeadResponse, error) { + out := new(HeadResponse) + err := c.cc.Invoke(ctx, "/neo.fs.v2.object.ObjectService/Head", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *objectServiceClient) Search(ctx context.Context, in *SearchRequest, opts ...grpc.CallOption) (ObjectService_SearchClient, error) { + stream, err := c.cc.NewStream(ctx, &ObjectService_ServiceDesc.Streams[2], "/neo.fs.v2.object.ObjectService/Search", opts...) + if err != nil { + return nil, err + } + x := &objectServiceSearchClient{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 +} + +type ObjectService_SearchClient interface { + Recv() (*SearchResponse, error) + grpc.ClientStream +} + +type objectServiceSearchClient struct { + grpc.ClientStream +} + +func (x *objectServiceSearchClient) Recv() (*SearchResponse, error) { + m := new(SearchResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *objectServiceClient) GetRange(ctx context.Context, in *GetRangeRequest, opts ...grpc.CallOption) (ObjectService_GetRangeClient, error) { + stream, err := c.cc.NewStream(ctx, &ObjectService_ServiceDesc.Streams[3], "/neo.fs.v2.object.ObjectService/GetRange", opts...) + if err != nil { + return nil, err + } + x := &objectServiceGetRangeClient{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 +} + +type ObjectService_GetRangeClient interface { + Recv() (*GetRangeResponse, error) + grpc.ClientStream +} + +type objectServiceGetRangeClient struct { + grpc.ClientStream +} + +func (x *objectServiceGetRangeClient) Recv() (*GetRangeResponse, error) { + m := new(GetRangeResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *objectServiceClient) GetRangeHash(ctx context.Context, in *GetRangeHashRequest, opts ...grpc.CallOption) (*GetRangeHashResponse, error) { + out := new(GetRangeHashResponse) + err := c.cc.Invoke(ctx, "/neo.fs.v2.object.ObjectService/GetRangeHash", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// ObjectServiceServer is the server API for ObjectService service. +// All implementations should embed UnimplementedObjectServiceServer +// for forward compatibility +type ObjectServiceServer interface { + // Receive full object structure, including Headers and payload. Response uses + // gRPC stream. First response message carries object with requested address. + // Chunk messages are parts of the object's payload if it is needed. All + // messages, except the first one, carry payload chunks. Requested object can + // be restored by concatenation of object message payload and all chunks + // keeping receiving order. + Get(*GetRequest, ObjectService_GetServer) error + // Put the object into container. Request uses gRPC stream. First message + // SHOULD be of PutHeader type. `ContainerID` and `OwnerID` of an object + // SHOULD be set. Session token SHOULD be obtained before `PUT` operation (see + // session package). Chunk messages are considered by server as a part of an + // object payload. All messages, except first one, SHOULD be payload chunks. + // Chunk messages SHOULD be sent in direct order of fragmentation. + Put(ObjectService_PutServer) error + // Delete the object from a container. There is no immediate removal + // guarantee. Object will be marked for removal and deleted eventually. + Delete(context.Context, *DeleteRequest) (*DeleteResponse, error) + // Returns the object Headers without data payload. By default full header is + // returned. If `main_only` request field is set, the short header with only + // the very minimal information would be returned instead. + Head(context.Context, *HeadRequest) (*HeadResponse, error) + // Search objects in container. Search query allows to match by Object + // Header's filed values. Please see the corresponding NeoFS Technical + // Specification section for more details. + Search(*SearchRequest, ObjectService_SearchServer) error + // Get byte range of data payload. Range is set as an (offset, length) tuple. + // Like in `Get` method, the response uses gRPC stream. Requested range can be + // restored by concatenation of all received payload chunks keeping receiving + // order. + GetRange(*GetRangeRequest, ObjectService_GetRangeServer) error + // Returns homomorphic or regular hash of object's payload range after + // applying XOR operation with the provided `salt`. Ranges are set of (offset, + // length) tuples. Hashes order in response corresponds to ranges order in + // request. Note that hash is calculated for XORed data. + GetRangeHash(context.Context, *GetRangeHashRequest) (*GetRangeHashResponse, error) +} + +// UnimplementedObjectServiceServer should be embedded to have forward compatible implementations. +type UnimplementedObjectServiceServer struct { +} + +func (UnimplementedObjectServiceServer) Get(*GetRequest, ObjectService_GetServer) error { + return status.Errorf(codes.Unimplemented, "method Get not implemented") +} +func (UnimplementedObjectServiceServer) Put(ObjectService_PutServer) error { + return status.Errorf(codes.Unimplemented, "method Put not implemented") +} +func (UnimplementedObjectServiceServer) Delete(context.Context, *DeleteRequest) (*DeleteResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Delete not implemented") +} +func (UnimplementedObjectServiceServer) Head(context.Context, *HeadRequest) (*HeadResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Head not implemented") +} +func (UnimplementedObjectServiceServer) Search(*SearchRequest, ObjectService_SearchServer) error { + return status.Errorf(codes.Unimplemented, "method Search not implemented") +} +func (UnimplementedObjectServiceServer) GetRange(*GetRangeRequest, ObjectService_GetRangeServer) error { + return status.Errorf(codes.Unimplemented, "method GetRange not implemented") +} +func (UnimplementedObjectServiceServer) GetRangeHash(context.Context, *GetRangeHashRequest) (*GetRangeHashResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetRangeHash not implemented") +} + +// UnsafeObjectServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to ObjectServiceServer will +// result in compilation errors. +type UnsafeObjectServiceServer interface { + mustEmbedUnimplementedObjectServiceServer() +} + +func RegisterObjectServiceServer(s grpc.ServiceRegistrar, srv ObjectServiceServer) { + s.RegisterService(&ObjectService_ServiceDesc, srv) +} + +func _ObjectService_Get_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(GetRequest) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(ObjectServiceServer).Get(m, &objectServiceGetServer{stream}) +} + +type ObjectService_GetServer interface { + Send(*GetResponse) error + grpc.ServerStream +} + +type objectServiceGetServer struct { + grpc.ServerStream +} + +func (x *objectServiceGetServer) Send(m *GetResponse) error { + return x.ServerStream.SendMsg(m) +} + +func _ObjectService_Put_Handler(srv interface{}, stream grpc.ServerStream) error { + return srv.(ObjectServiceServer).Put(&objectServicePutServer{stream}) +} + +type ObjectService_PutServer interface { + SendAndClose(*PutResponse) error + Recv() (*PutRequest, error) + grpc.ServerStream +} + +type objectServicePutServer struct { + grpc.ServerStream +} + +func (x *objectServicePutServer) SendAndClose(m *PutResponse) error { + return x.ServerStream.SendMsg(m) +} + +func (x *objectServicePutServer) Recv() (*PutRequest, error) { + m := new(PutRequest) + if err := x.ServerStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func _ObjectService_Delete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ObjectServiceServer).Delete(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/neo.fs.v2.object.ObjectService/Delete", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ObjectServiceServer).Delete(ctx, req.(*DeleteRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ObjectService_Head_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(HeadRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ObjectServiceServer).Head(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/neo.fs.v2.object.ObjectService/Head", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ObjectServiceServer).Head(ctx, req.(*HeadRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ObjectService_Search_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(SearchRequest) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(ObjectServiceServer).Search(m, &objectServiceSearchServer{stream}) +} + +type ObjectService_SearchServer interface { + Send(*SearchResponse) error + grpc.ServerStream +} + +type objectServiceSearchServer struct { + grpc.ServerStream +} + +func (x *objectServiceSearchServer) Send(m *SearchResponse) error { + return x.ServerStream.SendMsg(m) +} + +func _ObjectService_GetRange_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(GetRangeRequest) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(ObjectServiceServer).GetRange(m, &objectServiceGetRangeServer{stream}) +} + +type ObjectService_GetRangeServer interface { + Send(*GetRangeResponse) error + grpc.ServerStream +} + +type objectServiceGetRangeServer struct { + grpc.ServerStream +} + +func (x *objectServiceGetRangeServer) Send(m *GetRangeResponse) error { + return x.ServerStream.SendMsg(m) +} + +func _ObjectService_GetRangeHash_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetRangeHashRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ObjectServiceServer).GetRangeHash(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/neo.fs.v2.object.ObjectService/GetRangeHash", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ObjectServiceServer).GetRangeHash(ctx, req.(*GetRangeHashRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// ObjectService_ServiceDesc is the grpc.ServiceDesc for ObjectService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var ObjectService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "neo.fs.v2.object.ObjectService", + HandlerType: (*ObjectServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Delete", + Handler: _ObjectService_Delete_Handler, + }, + { + MethodName: "Head", + Handler: _ObjectService_Head_Handler, + }, + { + MethodName: "GetRangeHash", + Handler: _ObjectService_GetRangeHash_Handler, + }, + }, + Streams: []grpc.StreamDesc{ + { + StreamName: "Get", + Handler: _ObjectService_Get_Handler, + ServerStreams: true, + }, + { + StreamName: "Put", + Handler: _ObjectService_Put_Handler, + ClientStreams: true, + }, + { + StreamName: "Search", + Handler: _ObjectService_Search_Handler, + ServerStreams: true, + }, + { + StreamName: "GetRange", + Handler: _ObjectService_GetRange_Handler, + ServerStreams: true, + }, + }, + Metadata: "v2/object/grpc/service.proto", +} diff --git a/v2/object/grpc/types.pb.go b/v2/object/grpc/types.pb.go index 1da2414..6efc6dc 100644 --- a/v2/object/grpc/types.pb.go +++ b/v2/object/grpc/types.pb.go @@ -1,13 +1,12 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.23.0 -// protoc v3.14.0 +// protoc-gen-go v1.27.1 +// protoc v3.18.0 // source: v2/object/grpc/types.proto package object import ( - proto "github.com/golang/protobuf/proto" grpc "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" grpc1 "github.com/nspcc-dev/neofs-api-go/v2/session/grpc" protoreflect "google.golang.org/protobuf/reflect/protoreflect" @@ -23,10 +22,6 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - // Type of the object payload content. Only `REGULAR` type objects can be split, // hence `TOMBSTONE` and `STORAGE_GROUP` payload is limited by maximal object // size. diff --git a/v2/refs/grpc/types.pb.go b/v2/refs/grpc/types.pb.go index 16b10f6..52b1a7e 100644 --- a/v2/refs/grpc/types.pb.go +++ b/v2/refs/grpc/types.pb.go @@ -1,13 +1,12 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.23.0 -// protoc v3.14.0 +// protoc-gen-go v1.27.1 +// protoc v3.18.0 // source: v2/refs/grpc/types.proto package refs import ( - proto "github.com/golang/protobuf/proto" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -21,10 +20,6 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - // Checksum algorithm type. type ChecksumType int32 diff --git a/v2/reputation/grpc/service.pb.go b/v2/reputation/grpc/service.pb.go index 79234d6..1ef79f4 100644 --- a/v2/reputation/grpc/service.pb.go +++ b/v2/reputation/grpc/service.pb.go @@ -1,18 +1,13 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.23.0 -// protoc v3.14.0 +// protoc-gen-go v1.27.1 +// protoc v3.18.0 // source: v2/reputation/grpc/service.proto package reputation import ( - context "context" - proto "github.com/golang/protobuf/proto" grpc "github.com/nspcc-dev/neofs-api-go/v2/session/grpc" - grpc1 "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -26,10 +21,6 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - // Announce node's local trust information. type AnnounceLocalTrustRequest struct { state protoimpl.MessageState @@ -815,125 +806,3 @@ func file_v2_reputation_grpc_service_proto_init() { file_v2_reputation_grpc_service_proto_goTypes = nil file_v2_reputation_grpc_service_proto_depIdxs = nil } - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc1.ClientConnInterface - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc1.SupportPackageIsVersion6 - -// ReputationServiceClient is the client API for ReputationService service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type ReputationServiceClient interface { - // Announce local client trust information to any node in NeoFS network. - AnnounceLocalTrust(ctx context.Context, in *AnnounceLocalTrustRequest, opts ...grpc1.CallOption) (*AnnounceLocalTrustResponse, error) - // Announces the intermediate result of the iterative algorithm for - // calculating the global reputation of the node in NeoFS network. - AnnounceIntermediateResult(ctx context.Context, in *AnnounceIntermediateResultRequest, opts ...grpc1.CallOption) (*AnnounceIntermediateResultResponse, error) -} - -type reputationServiceClient struct { - cc grpc1.ClientConnInterface -} - -func NewReputationServiceClient(cc grpc1.ClientConnInterface) ReputationServiceClient { - return &reputationServiceClient{cc} -} - -func (c *reputationServiceClient) AnnounceLocalTrust(ctx context.Context, in *AnnounceLocalTrustRequest, opts ...grpc1.CallOption) (*AnnounceLocalTrustResponse, error) { - out := new(AnnounceLocalTrustResponse) - err := c.cc.Invoke(ctx, "/neo.fs.v2.reputation.ReputationService/AnnounceLocalTrust", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *reputationServiceClient) AnnounceIntermediateResult(ctx context.Context, in *AnnounceIntermediateResultRequest, opts ...grpc1.CallOption) (*AnnounceIntermediateResultResponse, error) { - out := new(AnnounceIntermediateResultResponse) - err := c.cc.Invoke(ctx, "/neo.fs.v2.reputation.ReputationService/AnnounceIntermediateResult", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// ReputationServiceServer is the server API for ReputationService service. -type ReputationServiceServer interface { - // Announce local client trust information to any node in NeoFS network. - AnnounceLocalTrust(context.Context, *AnnounceLocalTrustRequest) (*AnnounceLocalTrustResponse, error) - // Announces the intermediate result of the iterative algorithm for - // calculating the global reputation of the node in NeoFS network. - AnnounceIntermediateResult(context.Context, *AnnounceIntermediateResultRequest) (*AnnounceIntermediateResultResponse, error) -} - -// UnimplementedReputationServiceServer can be embedded to have forward compatible implementations. -type UnimplementedReputationServiceServer struct { -} - -func (*UnimplementedReputationServiceServer) AnnounceLocalTrust(context.Context, *AnnounceLocalTrustRequest) (*AnnounceLocalTrustResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method AnnounceLocalTrust not implemented") -} -func (*UnimplementedReputationServiceServer) AnnounceIntermediateResult(context.Context, *AnnounceIntermediateResultRequest) (*AnnounceIntermediateResultResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method AnnounceIntermediateResult not implemented") -} - -func RegisterReputationServiceServer(s *grpc1.Server, srv ReputationServiceServer) { - s.RegisterService(&_ReputationService_serviceDesc, srv) -} - -func _ReputationService_AnnounceLocalTrust_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc1.UnaryServerInterceptor) (interface{}, error) { - in := new(AnnounceLocalTrustRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ReputationServiceServer).AnnounceLocalTrust(ctx, in) - } - info := &grpc1.UnaryServerInfo{ - Server: srv, - FullMethod: "/neo.fs.v2.reputation.ReputationService/AnnounceLocalTrust", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ReputationServiceServer).AnnounceLocalTrust(ctx, req.(*AnnounceLocalTrustRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _ReputationService_AnnounceIntermediateResult_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc1.UnaryServerInterceptor) (interface{}, error) { - in := new(AnnounceIntermediateResultRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ReputationServiceServer).AnnounceIntermediateResult(ctx, in) - } - info := &grpc1.UnaryServerInfo{ - Server: srv, - FullMethod: "/neo.fs.v2.reputation.ReputationService/AnnounceIntermediateResult", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ReputationServiceServer).AnnounceIntermediateResult(ctx, req.(*AnnounceIntermediateResultRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _ReputationService_serviceDesc = grpc1.ServiceDesc{ - ServiceName: "neo.fs.v2.reputation.ReputationService", - HandlerType: (*ReputationServiceServer)(nil), - Methods: []grpc1.MethodDesc{ - { - MethodName: "AnnounceLocalTrust", - Handler: _ReputationService_AnnounceLocalTrust_Handler, - }, - { - MethodName: "AnnounceIntermediateResult", - Handler: _ReputationService_AnnounceIntermediateResult_Handler, - }, - }, - Streams: []grpc1.StreamDesc{}, - Metadata: "v2/reputation/grpc/service.proto", -} diff --git a/v2/reputation/grpc/service_grpc.pb.go b/v2/reputation/grpc/service_grpc.pb.go new file mode 100644 index 0000000..5b493a4 --- /dev/null +++ b/v2/reputation/grpc/service_grpc.pb.go @@ -0,0 +1,141 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. + +package reputation + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +// ReputationServiceClient is the client API for ReputationService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type ReputationServiceClient interface { + // Announce local client trust information to any node in NeoFS network. + AnnounceLocalTrust(ctx context.Context, in *AnnounceLocalTrustRequest, opts ...grpc.CallOption) (*AnnounceLocalTrustResponse, error) + // Announces the intermediate result of the iterative algorithm for + // calculating the global reputation of the node in NeoFS network. + AnnounceIntermediateResult(ctx context.Context, in *AnnounceIntermediateResultRequest, opts ...grpc.CallOption) (*AnnounceIntermediateResultResponse, error) +} + +type reputationServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewReputationServiceClient(cc grpc.ClientConnInterface) ReputationServiceClient { + return &reputationServiceClient{cc} +} + +func (c *reputationServiceClient) AnnounceLocalTrust(ctx context.Context, in *AnnounceLocalTrustRequest, opts ...grpc.CallOption) (*AnnounceLocalTrustResponse, error) { + out := new(AnnounceLocalTrustResponse) + err := c.cc.Invoke(ctx, "/neo.fs.v2.reputation.ReputationService/AnnounceLocalTrust", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *reputationServiceClient) AnnounceIntermediateResult(ctx context.Context, in *AnnounceIntermediateResultRequest, opts ...grpc.CallOption) (*AnnounceIntermediateResultResponse, error) { + out := new(AnnounceIntermediateResultResponse) + err := c.cc.Invoke(ctx, "/neo.fs.v2.reputation.ReputationService/AnnounceIntermediateResult", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// ReputationServiceServer is the server API for ReputationService service. +// All implementations should embed UnimplementedReputationServiceServer +// for forward compatibility +type ReputationServiceServer interface { + // Announce local client trust information to any node in NeoFS network. + AnnounceLocalTrust(context.Context, *AnnounceLocalTrustRequest) (*AnnounceLocalTrustResponse, error) + // Announces the intermediate result of the iterative algorithm for + // calculating the global reputation of the node in NeoFS network. + AnnounceIntermediateResult(context.Context, *AnnounceIntermediateResultRequest) (*AnnounceIntermediateResultResponse, error) +} + +// UnimplementedReputationServiceServer should be embedded to have forward compatible implementations. +type UnimplementedReputationServiceServer struct { +} + +func (UnimplementedReputationServiceServer) AnnounceLocalTrust(context.Context, *AnnounceLocalTrustRequest) (*AnnounceLocalTrustResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method AnnounceLocalTrust not implemented") +} +func (UnimplementedReputationServiceServer) AnnounceIntermediateResult(context.Context, *AnnounceIntermediateResultRequest) (*AnnounceIntermediateResultResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method AnnounceIntermediateResult not implemented") +} + +// UnsafeReputationServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to ReputationServiceServer will +// result in compilation errors. +type UnsafeReputationServiceServer interface { + mustEmbedUnimplementedReputationServiceServer() +} + +func RegisterReputationServiceServer(s grpc.ServiceRegistrar, srv ReputationServiceServer) { + s.RegisterService(&ReputationService_ServiceDesc, srv) +} + +func _ReputationService_AnnounceLocalTrust_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AnnounceLocalTrustRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ReputationServiceServer).AnnounceLocalTrust(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/neo.fs.v2.reputation.ReputationService/AnnounceLocalTrust", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ReputationServiceServer).AnnounceLocalTrust(ctx, req.(*AnnounceLocalTrustRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ReputationService_AnnounceIntermediateResult_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AnnounceIntermediateResultRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ReputationServiceServer).AnnounceIntermediateResult(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/neo.fs.v2.reputation.ReputationService/AnnounceIntermediateResult", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ReputationServiceServer).AnnounceIntermediateResult(ctx, req.(*AnnounceIntermediateResultRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// ReputationService_ServiceDesc is the grpc.ServiceDesc for ReputationService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var ReputationService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "neo.fs.v2.reputation.ReputationService", + HandlerType: (*ReputationServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "AnnounceLocalTrust", + Handler: _ReputationService_AnnounceLocalTrust_Handler, + }, + { + MethodName: "AnnounceIntermediateResult", + Handler: _ReputationService_AnnounceIntermediateResult_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "v2/reputation/grpc/service.proto", +} diff --git a/v2/reputation/grpc/types.pb.go b/v2/reputation/grpc/types.pb.go index d81fca4..009df3b 100644 --- a/v2/reputation/grpc/types.pb.go +++ b/v2/reputation/grpc/types.pb.go @@ -1,13 +1,12 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.23.0 -// protoc v3.14.0 +// protoc-gen-go v1.27.1 +// protoc v3.18.0 // source: v2/reputation/grpc/types.proto package reputation import ( - proto "github.com/golang/protobuf/proto" grpc "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" @@ -22,10 +21,6 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - // NeoFS unique peer identifier is 33 byte long compressed public key of the // node, the same as the one stored in the network map. // diff --git a/v2/session/grpc/service.pb.go b/v2/session/grpc/service.pb.go index 89e1437..6851176 100644 --- a/v2/session/grpc/service.pb.go +++ b/v2/session/grpc/service.pb.go @@ -1,18 +1,13 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.23.0 -// protoc v3.14.0 +// protoc-gen-go v1.27.1 +// protoc v3.18.0 // source: v2/session/grpc/service.proto package session import ( - context "context" - proto "github.com/golang/protobuf/proto" grpc "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" - grpc1 "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -26,10 +21,6 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - // Information necessary for opening a session. type CreateRequest struct { state protoimpl.MessageState @@ -465,85 +456,3 @@ func file_v2_session_grpc_service_proto_init() { file_v2_session_grpc_service_proto_goTypes = nil file_v2_session_grpc_service_proto_depIdxs = nil } - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc1.ClientConnInterface - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc1.SupportPackageIsVersion6 - -// SessionServiceClient is the client API for SessionService service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type SessionServiceClient interface { - // Opens a new session between two peers. - Create(ctx context.Context, in *CreateRequest, opts ...grpc1.CallOption) (*CreateResponse, error) -} - -type sessionServiceClient struct { - cc grpc1.ClientConnInterface -} - -func NewSessionServiceClient(cc grpc1.ClientConnInterface) SessionServiceClient { - return &sessionServiceClient{cc} -} - -func (c *sessionServiceClient) Create(ctx context.Context, in *CreateRequest, opts ...grpc1.CallOption) (*CreateResponse, error) { - out := new(CreateResponse) - err := c.cc.Invoke(ctx, "/neo.fs.v2.session.SessionService/Create", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// SessionServiceServer is the server API for SessionService service. -type SessionServiceServer interface { - // Opens a new session between two peers. - Create(context.Context, *CreateRequest) (*CreateResponse, error) -} - -// UnimplementedSessionServiceServer can 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 RegisterSessionServiceServer(s *grpc1.Server, srv SessionServiceServer) { - s.RegisterService(&_SessionService_serviceDesc, srv) -} - -func _SessionService_Create_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc1.UnaryServerInterceptor) (interface{}, error) { - in := new(CreateRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(SessionServiceServer).Create(ctx, in) - } - info := &grpc1.UnaryServerInfo{ - Server: srv, - FullMethod: "/neo.fs.v2.session.SessionService/Create", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(SessionServiceServer).Create(ctx, req.(*CreateRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _SessionService_serviceDesc = grpc1.ServiceDesc{ - ServiceName: "neo.fs.v2.session.SessionService", - HandlerType: (*SessionServiceServer)(nil), - Methods: []grpc1.MethodDesc{ - { - MethodName: "Create", - Handler: _SessionService_Create_Handler, - }, - }, - Streams: []grpc1.StreamDesc{}, - Metadata: "v2/session/grpc/service.proto", -} diff --git a/v2/session/grpc/service_grpc.pb.go b/v2/session/grpc/service_grpc.pb.go new file mode 100644 index 0000000..d753c51 --- /dev/null +++ b/v2/session/grpc/service_grpc.pb.go @@ -0,0 +1,101 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. + +package session + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +// 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. +type SessionServiceClient interface { + // Opens a new session between two peers. + Create(ctx context.Context, in *CreateRequest, opts ...grpc.CallOption) (*CreateResponse, error) +} + +type sessionServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewSessionServiceClient(cc grpc.ClientConnInterface) SessionServiceClient { + return &sessionServiceClient{cc} +} + +func (c *sessionServiceClient) Create(ctx context.Context, in *CreateRequest, opts ...grpc.CallOption) (*CreateResponse, error) { + out := new(CreateResponse) + err := c.cc.Invoke(ctx, "/neo.fs.v2.session.SessionService/Create", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// SessionServiceServer is the server API for SessionService service. +// All implementations should embed UnimplementedSessionServiceServer +// for forward compatibility +type SessionServiceServer interface { + // Opens a new session between two peers. + Create(context.Context, *CreateRequest) (*CreateResponse, error) +} + +// 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") +} + +// 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 +// result in compilation errors. +type UnsafeSessionServiceServer interface { + mustEmbedUnimplementedSessionServiceServer() +} + +func RegisterSessionServiceServer(s grpc.ServiceRegistrar, srv SessionServiceServer) { + s.RegisterService(&SessionService_ServiceDesc, srv) +} + +func _SessionService_Create_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SessionServiceServer).Create(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/neo.fs.v2.session.SessionService/Create", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SessionServiceServer).Create(ctx, req.(*CreateRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// SessionService_ServiceDesc is the grpc.ServiceDesc for SessionService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var SessionService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "neo.fs.v2.session.SessionService", + HandlerType: (*SessionServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Create", + Handler: _SessionService_Create_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "v2/session/grpc/service.proto", +} diff --git a/v2/session/grpc/types.pb.go b/v2/session/grpc/types.pb.go index eb4e103..f81b16c 100644 --- a/v2/session/grpc/types.pb.go +++ b/v2/session/grpc/types.pb.go @@ -1,13 +1,12 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.23.0 -// protoc v3.14.0 +// protoc-gen-go v1.27.1 +// protoc v3.18.0 // source: v2/session/grpc/types.proto package session import ( - proto "github.com/golang/protobuf/proto" grpc1 "github.com/nspcc-dev/neofs-api-go/v2/acl/grpc" grpc "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" protoreflect "google.golang.org/protobuf/reflect/protoreflect" @@ -23,10 +22,6 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - // Object request verbs type ObjectSessionContext_Verb int32 diff --git a/v2/storagegroup/grpc/types.pb.go b/v2/storagegroup/grpc/types.pb.go index 6f4c644..94f1e05 100644 --- a/v2/storagegroup/grpc/types.pb.go +++ b/v2/storagegroup/grpc/types.pb.go @@ -1,13 +1,12 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.23.0 -// protoc v3.14.0 +// protoc-gen-go v1.27.1 +// protoc v3.18.0 // source: v2/storagegroup/grpc/types.proto package storagegroup import ( - proto "github.com/golang/protobuf/proto" grpc "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" @@ -22,10 +21,6 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - // StorageGroup keeps verification information for Data Audit sessions. Objects // that require payed storage guaranties are gathered in `StorageGroups` with // additional information used for proof of storage. `StorageGroup` only diff --git a/v2/tombstone/grpc/types.pb.go b/v2/tombstone/grpc/types.pb.go index 75c0f6c..e6fc2d0 100644 --- a/v2/tombstone/grpc/types.pb.go +++ b/v2/tombstone/grpc/types.pb.go @@ -1,13 +1,12 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.23.0 -// protoc v3.14.0 +// protoc-gen-go v1.27.1 +// protoc v3.18.0 // source: v2/tombstone/grpc/types.proto package tombstone import ( - proto "github.com/golang/protobuf/proto" grpc "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" @@ -22,10 +21,6 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - // Tombstone keeps record of deleted objects for few epochs until they are // purged from the NeoFS network. type Tombstone struct { From ea91004e8a9f1b5966ebaf51cdbf1ae351283965 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 30 Sep 2021 18:39:17 +0300 Subject: [PATCH 0907/1196] [#341] acl: Define public-append rule Signed-off-by: Leonard Lyubich --- pkg/acl/types.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg/acl/types.go b/pkg/acl/types.go index a83c8c8..6a7b428 100644 --- a/pkg/acl/types.go +++ b/pkg/acl/types.go @@ -9,4 +9,7 @@ const ( // ReadOnlyBasicRule is a basic ACL value for public-read container. ReadOnlyBasicRule = 0x1FBF8CFF + + // PublicAppendRule is a basic ACL value for public-append container. + PublicAppendRule = 0x1FBF9FFF ) From a8fa0f9847dc48e5b841cecf48bb001605dd8741 Mon Sep 17 00:00:00 2001 From: Angira Kekteeva Date: Mon, 4 Oct 2021 22:53:41 +0300 Subject: [PATCH 0908/1196] [#349] ci: Update linter Update golangci version, replace golint by revive Signed-off-by: Angira Kekteeva --- .github/workflows/go.yml | 2 +- .golangci.yml | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index c86f81f..3c9eb3c 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -55,5 +55,5 @@ jobs: - name: golangci-lint uses: golangci/golangci-lint-action@v2 with: - version: v1.29 + version: v1.42.1 only-new-issues: true diff --git a/.golangci.yml b/.golangci.yml index 882a9ff..8f35944 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -9,6 +9,9 @@ run: # include test files or not, default is true tests: false + skip-files: + - (^|.*/)grpc/(.*) + # output configuration options output: # colored-line-number|line-number|json|tab|checkstyle|code-climate, default is "colored-line-number" @@ -29,7 +32,7 @@ linters: enable: # mandatory linters - govet - - golint + - revive # some default golangci-lint linters - errcheck From 7348dee623429def2db32411e135fe5409e948f3 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 11 Oct 2021 11:04:58 +0300 Subject: [PATCH 0909/1196] [#351] v2/container: Define well-known attributes for NNS integration Define const `SysAttributeName` and `SysAttributeZone` keys to NNS attributes. Signed-off-by: Leonard Lyubich --- v2/container/attributes.go | 6 ++++++ v2/container/grpc/types.pb.go | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/v2/container/attributes.go b/v2/container/attributes.go index b91dcc6..467be48 100644 --- a/v2/container/attributes.go +++ b/v2/container/attributes.go @@ -6,4 +6,10 @@ const SysAttributePrefix = "__NEOFS__" const ( // SysAttributeSubnet is a string ID of container's storage subnet. SysAttributeSubnet = SysAttributePrefix + "SUBNET" + + // SysAttributeName is a string of human-friendly container name registered as the domain in NNS contract. + SysAttributeName = SysAttributePrefix + "NAME" + + // SysAttributeZone is a string of zone for container name. + SysAttributeZone = SysAttributePrefix + "ZONE" ) diff --git a/v2/container/grpc/types.pb.go b/v2/container/grpc/types.pb.go index 92975ee..279c781 100644 --- a/v2/container/grpc/types.pb.go +++ b/v2/container/grpc/types.pb.go @@ -134,6 +134,12 @@ func (x *Container) GetPlacementPolicy() *grpc1.PlacementPolicy { // * __NEOFS__SUBNET \ // String ID of container's storage subnet. Container can be attached to // only one subnet. +// * __NEOFS__NAME \ +// String of human-friendly container name registered as the domain in +// NNS contract. +// * __NEOFS__ZONE \ +// String of zone for `__NEOFS__NAME`. Used as TLD of domain name in NNS +// contract. If zone is not specified, use default zone: `container`. // // And some well-known attributes used by applications only: // From 20b863284aff1c2de55fa3105273b437bb7019f0 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 11 Oct 2021 12:52:18 +0300 Subject: [PATCH 0910/1196] [#351] pkg/container: Implement functions to work with native names Implement `GetNativeNameWithZone` / `SetNativeNameWithZone` function which gets / sets `__NEOFS_NAME` and `__NEOFS_ZONE` container attributes. Signed-off-by: Leonard Lyubich --- pkg/container/attribute.go | 54 +++++++++++++++++++++++++++++++++ pkg/container/attribute_test.go | 22 ++++++++++++++ 2 files changed, 76 insertions(+) diff --git a/pkg/container/attribute.go b/pkg/container/attribute.go index ec633e8..0219005 100644 --- a/pkg/container/attribute.go +++ b/pkg/container/attribute.go @@ -74,3 +74,57 @@ func (a Attributes) ToV2() []*container.Attribute { return attrs } + +// sets value of the attribute by key. +func setAttribute(c *Container, key, value string) { + var a *Attribute + + iterateAttributes(c, func(a_ *Attribute) bool { + if a_.Key() == key { + a = a_ + } + + return a != nil + }) + + if a == nil { + a = NewAttribute() + a.SetKey(key) + + c.SetAttributes(append(c.Attributes(), a)) + } + + a.SetValue(value) +} + +// iterates over container attributes. Stops at f's true return. +// +// Handler must not be nil. +func iterateAttributes(c *Container, f func(*Attribute) bool) { + for _, a := range c.Attributes() { + if f(a) { + return + } + } +} + +// SetNativeNameWithZone sets container native name and its zone. +func SetNativeNameWithZone(c *Container, name, zone string) { + setAttribute(c, container.SysAttributeName, name) + setAttribute(c, container.SysAttributeZone, zone) +} + +// GetNativeNameWithZone returns container native name and its zone. +func GetNativeNameWithZone(c *Container) (name string, zone string) { + iterateAttributes(c, func(a *Attribute) bool { + if key := a.Key(); key == container.SysAttributeName { + name = a.Value() + } else if key == container.SysAttributeZone { + zone = a.Value() + } + + return name != "" && zone != "" + }) + + return +} diff --git a/pkg/container/attribute_test.go b/pkg/container/attribute_test.go index acd7bbd..65967c4 100644 --- a/pkg/container/attribute_test.go +++ b/pkg/container/attribute_test.go @@ -118,3 +118,25 @@ func TestNewAttributeFromV2(t *testing.T) { require.Nil(t, container.NewAttributeFromV2(x)) }) } + +func TestGetNameWithZone(t *testing.T) { + c := container.New() + + for _, item := range [...]struct { + name, zone string + }{ + {"name1", ""}, + {"name1", "zone1"}, + {"name2", "zone1"}, + {"name2", "zone2"}, + {"", "zone2"}, + {"", ""}, + } { + container.SetNativeNameWithZone(c, item.name, item.zone) + + name, zone := container.GetNativeNameWithZone(c) + + require.Equal(t, item.name, name, item.name) + require.Equal(t, item.zone, zone, item.zone) + } +} From db1ed764733b5c8e89b857a4c4c19c238552fb81 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 14 Oct 2021 11:50:05 +0300 Subject: [PATCH 0911/1196] [#351] container: Add default value for NNS zone Define `SysAttributeZoneDefault` constant for default zone in V2 code. Add `SetNativeName` function which sets name with default zone. Signed-off-by: Leonard Lyubich --- pkg/container/attribute.go | 7 +++++++ pkg/container/attribute_test.go | 13 +++++++++++++ v2/container/attributes.go | 3 +++ 3 files changed, 23 insertions(+) diff --git a/pkg/container/attribute.go b/pkg/container/attribute.go index 0219005..fc87062 100644 --- a/pkg/container/attribute.go +++ b/pkg/container/attribute.go @@ -109,11 +109,18 @@ func iterateAttributes(c *Container, f func(*Attribute) bool) { } // SetNativeNameWithZone sets container native name and its zone. +// +// Use SetNativeName to set default zone. func SetNativeNameWithZone(c *Container, name, zone string) { setAttribute(c, container.SysAttributeName, name) setAttribute(c, container.SysAttributeZone, zone) } +// SetNativeName sets container native name with default zone (container). +func SetNativeName(c *Container, name string) { + SetNativeNameWithZone(c, name, container.SysAttributeZoneDefault) +} + // GetNativeNameWithZone returns container native name and its zone. func GetNativeNameWithZone(c *Container) (name string, zone string) { iterateAttributes(c, func(a *Attribute) bool { diff --git a/pkg/container/attribute_test.go b/pkg/container/attribute_test.go index 65967c4..4078c64 100644 --- a/pkg/container/attribute_test.go +++ b/pkg/container/attribute_test.go @@ -140,3 +140,16 @@ func TestGetNameWithZone(t *testing.T) { require.Equal(t, item.zone, zone, item.zone) } } + +func TestSetNativeName(t *testing.T) { + c := container.New() + + const nameDefZone = "some name" + + container.SetNativeName(c, nameDefZone) + + name, zone := container.GetNativeNameWithZone(c) + + require.Equal(t, nameDefZone, name) + require.Equal(t, containerv2.SysAttributeZoneDefault, zone) +} diff --git a/v2/container/attributes.go b/v2/container/attributes.go index 467be48..9f90edb 100644 --- a/v2/container/attributes.go +++ b/v2/container/attributes.go @@ -13,3 +13,6 @@ const ( // SysAttributeZone is a string of zone for container name. SysAttributeZone = SysAttributePrefix + "ZONE" ) + +// SysAttributeZoneDefault is a default value for SysAttributeZone attribute. +const SysAttributeZoneDefault = "container" From 371dd09bf5bf53b0ec2cf2ed846e8481973b4347 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Tue, 19 Oct 2021 19:34:30 +0300 Subject: [PATCH 0912/1196] [#176] Makefile: Use google-hosted repository of protobuf GitHub-hosted version considered as deprecated Signed-off-by: Alex Vanin --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index c8775ee..e4db0f2 100644 --- a/Makefile +++ b/Makefile @@ -41,7 +41,7 @@ imports: protoc: @GOPRIVATE=github.com/nspcc-dev go mod vendor # Install specific version for protobuf lib - @go list -f '{{.Path}}/...@{{.Version}}' -m github.com/golang/protobuf | xargs go get -v + @go list -f '{{.Path}}/...@{{.Version}}' -m google.golang.org/protobuf | xargs go get -v # Protoc generate @for f in `find . -type f -name '*.proto' -not -path './vendor/*'`; do \ echo "⇒ Processing $$f "; \ From a33394cee4870455885dd249caeb5487f4fe1ad0 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Tue, 19 Oct 2021 19:47:46 +0300 Subject: [PATCH 0913/1196] =?UTF-8?q?Release=20v1.30.0=20-=20Udo=20(?= =?UTF-8?q?=EC=9A=B0=EB=8F=84,=20=E7=89=9B=E5=B3=B6)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Alex Vanin --- CHANGELOG.md | 22 ++++++++++++++++++++++ README.md | 1 + 2 files changed, 23 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index fd0cf41..cbf727f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,26 @@ # Changelog +## [1.30.0] - 2021-10-19 - Udo (우도, 牛島) + +NeoFS API v2.10 support. + +### Fixed + +- Potential NPE in NEO3Wallet related functions (#340) +- Incorrect return of reputation intermediate announcement (#342) + +### Added + +- pkg/client callback to parse internal response information (#337) +- Service filter type in extended ACL from API v2.10 (#338) +- Enhanced network info structures from API v2.10 (#339) +- Well-known public-append basic ACL constant (#341) +- Native contract names support (#351) + +### Changed + +- Updated grpc to v1.41.0 (#176) + ## [1.29.0] - 2021-08-27 - Anmyeondo (안면도, 安眠島) ### Fixed @@ -712,3 +733,4 @@ Initial public release [1.28.2]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.28.1...v1.28.2 [1.28.3]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.28.2...v1.28.3 [1.29.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.28.3...v1.29.0 +[1.30.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.29.0...v1.30.0 diff --git a/README.md b/README.md index 61cccb0..756351b 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,7 @@ versions and SDK layer working with all of them in a handy way. |v1.27.x|[v2.7.0](https://github.com/nspcc-dev/neofs-api/releases/tag/v2.7.0)| |v1.28.x|[v2.8.0](https://github.com/nspcc-dev/neofs-api/releases/tag/v2.8.0)| |v1.29.x|[v2.9.1](https://github.com/nspcc-dev/neofs-api/releases/tag/v2.9.1)| +|v1.30.x|[v2.10.0](https://github.com/nspcc-dev/neofs-api/releases/tag/v2.10.0)| ## Contributing From 133cd011f0d89beba5b465d166b229639edd47fd Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Fri, 12 Nov 2021 10:57:42 +0300 Subject: [PATCH 0914/1196] Makefile: use `go install` instead of `go get` Signed-off-by: Evgenii Stratonikov --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index e4db0f2..b89e274 100644 --- a/Makefile +++ b/Makefile @@ -41,7 +41,7 @@ imports: protoc: @GOPRIVATE=github.com/nspcc-dev go mod vendor # Install specific version for protobuf lib - @go list -f '{{.Path}}/...@{{.Version}}' -m google.golang.org/protobuf | xargs go get -v + @go list -f '{{.Path}}/...@{{.Version}}' -m google.golang.org/protobuf | xargs go install -v # Protoc generate @for f in `find . -type f -name '*.proto' -not -path './vendor/*'`; do \ echo "⇒ Processing $$f "; \ From 9798b03ba217881686215501733c40997d2372b1 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Fri, 12 Nov 2021 11:47:56 +0300 Subject: [PATCH 0915/1196] prepare.sh: fix directory handling Allow spaces in path and fail early if `cd` target doesn't exist. Signed-off-by: Evgenii Stratonikov --- prepare.sh | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/prepare.sh b/prepare.sh index c0e4a37..c7cd644 100755 --- a/prepare.sh +++ b/prepare.sh @@ -2,38 +2,38 @@ prefix=v2 -if [ -z "$1" ]; then +if [ -z "$1" ]; then echo "usage: ./prepare.sh path/to/neofs-api" exit 1 -fi +fi API_GO_PATH=$(pwd) -API_PATH=$1 -mkdir $API_GO_PATH/$prefix 2>/dev/null +API_PATH=$1 +mkdir "$API_GO_PATH/$prefix" 2>/dev/null # MOVE FILES FROM API REPO -cd $API_PATH +cd "$API_PATH" || exit 1 ARGS=$(find ./ -name '*.proto' -not -path './vendor/*') for file in $ARGS; do - dir=$(dirname $file) - mkdir -p $API_GO_PATH/$prefix/$dir/grpc - cp -r $dir/* $API_GO_PATH/$prefix/$dir/grpc + dir=$(dirname "$file") + mkdir -p "$API_GO_PATH/$prefix/$dir/grpc" + cp -r "$dir"/* "$API_GO_PATH/$prefix/$dir/grpc" done # MODIFY FILES -cd $API_GO_PATH/$prefix +cd "$API_GO_PATH/$prefix" || exit 1 ARGS2=$(find ./ -name '*.proto') for file in $ARGS2; do - echo $file - sed -i "s/import\ \"\(.*\)\/\(.*\)\.proto\";/import\ \"$prefix\/\1\/grpc\/\2\.proto\";/" $file + echo "$file" + sed -i "s/import\ \"\(.*\)\/\(.*\)\.proto\";/import\ \"$prefix\/\1\/grpc\/\2\.proto\";/" $file done -cd $API_GO_PATH +cd "$API_GO_PATH" || exit 1 # COMPILE make protoc # REMOVE PROTO DEFINITIONS ARGS=$(find ./$prefix -name '*.proto' -not -path './vendor/*') for file in $ARGS; do - rm $file + rm "$file" done From 27798eaacbd6ac2bb22e80dad9241788da80507d Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 4 Oct 2021 15:32:16 +0300 Subject: [PATCH 0916/1196] [#350] Compile protobuf files with status returns Signed-off-by: Leonard Lyubich --- v2/accounting/grpc/service_grpc.pb.go | 10 + v2/container/grpc/service_grpc.pb.go | 70 +++++ v2/netmap/grpc/service_grpc.pb.go | 20 ++ v2/object/grpc/service_grpc.pb.go | 70 +++++ v2/object/grpc/status.pb.go | 250 +++++++++++++++ v2/reputation/grpc/service_grpc.pb.go | 20 ++ v2/session/grpc/service_grpc.pb.go | 10 + v2/session/grpc/types.pb.go | 351 +++++++++++---------- v2/status/grpc/types.pb.go | 433 ++++++++++++++++++++++++++ 9 files changed, 1067 insertions(+), 167 deletions(-) create mode 100644 v2/object/grpc/status.pb.go create mode 100644 v2/status/grpc/types.pb.go diff --git a/v2/accounting/grpc/service_grpc.pb.go b/v2/accounting/grpc/service_grpc.pb.go index b875b30..44b24a8 100644 --- a/v2/accounting/grpc/service_grpc.pb.go +++ b/v2/accounting/grpc/service_grpc.pb.go @@ -19,6 +19,11 @@ const _ = grpc.SupportPackageIsVersion7 // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. type AccountingServiceClient interface { // Returns the amount of funds in GAS token for the requested NeoFS account. + // + // Statuses: + // - **OK** (0, SECTION_SUCCESS): + // balance has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON). Balance(ctx context.Context, in *BalanceRequest, opts ...grpc.CallOption) (*BalanceResponse, error) } @@ -44,6 +49,11 @@ func (c *accountingServiceClient) Balance(ctx context.Context, in *BalanceReques // for forward compatibility type AccountingServiceServer interface { // Returns the amount of funds in GAS token for the requested NeoFS account. + // + // Statuses: + // - **OK** (0, SECTION_SUCCESS): + // balance has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON). Balance(context.Context, *BalanceRequest) (*BalanceResponse, error) } diff --git a/v2/container/grpc/service_grpc.pb.go b/v2/container/grpc/service_grpc.pb.go index 1449f92..9f6af5b 100644 --- a/v2/container/grpc/service_grpc.pb.go +++ b/v2/container/grpc/service_grpc.pb.go @@ -22,24 +22,59 @@ type ContainerServiceClient interface { // response immediately. After a new block is issued in sidechain, request is // verified by Inner Ring nodes. After one more block in sidechain, 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). 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 // verified by Inner Ring nodes. After one more block in sidechain, 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). 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). Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*GetResponse, error) // 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). List(ctx context.Context, in *ListRequest, opts ...grpc.CallOption) (*ListResponse, error) // Invokes 'SetEACL' method of 'Container` smart contract and returns response // immediately. After one more block in sidechain, Extended ACL changes are // added into smart contract storage. + // + // Statuses: + // - **OK** (0, SECTION_SUCCESS): + // request to save container eACL has been sent to the sidechain; + // - Common failures (SECTION_FAILURE_COMMON). SetExtendedACL(ctx context.Context, in *SetExtendedACLRequest, opts ...grpc.CallOption) (*SetExtendedACLResponse, error) // Returns Extended ACL table and signature from `Container` smart contract // storage. + // + // Statuses: + // - **OK** (0, SECTION_SUCCESS): + // container eACL has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON). GetExtendedACL(ctx context.Context, in *GetExtendedACLRequest, opts ...grpc.CallOption) (*GetExtendedACLResponse, error) // Announce container used space values for P2P synchronization. + // + // Statuses: + // - **OK** (0, SECTION_SUCCESS): + // estimation of used space has been successfully announced; + // - Common failures (SECTION_FAILURE_COMMON). AnnounceUsedSpace(ctx context.Context, in *AnnounceUsedSpaceRequest, opts ...grpc.CallOption) (*AnnounceUsedSpaceResponse, error) } @@ -122,24 +157,59 @@ type ContainerServiceServer interface { // response immediately. After a new block is issued in sidechain, request is // verified by Inner Ring nodes. After one more block in sidechain, 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). 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 // verified by Inner Ring nodes. After one more block in sidechain, 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). 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). Get(context.Context, *GetRequest) (*GetResponse, error) // 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). List(context.Context, *ListRequest) (*ListResponse, error) // Invokes 'SetEACL' method of 'Container` smart contract and returns response // immediately. After one more block in sidechain, Extended ACL changes are // added into smart contract storage. + // + // Statuses: + // - **OK** (0, SECTION_SUCCESS): + // request to save container eACL has been sent to the sidechain; + // - Common failures (SECTION_FAILURE_COMMON). SetExtendedACL(context.Context, *SetExtendedACLRequest) (*SetExtendedACLResponse, error) // Returns Extended ACL table and signature from `Container` smart contract // storage. + // + // Statuses: + // - **OK** (0, SECTION_SUCCESS): + // container eACL has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON). GetExtendedACL(context.Context, *GetExtendedACLRequest) (*GetExtendedACLResponse, error) // Announce container used space values for P2P synchronization. + // + // Statuses: + // - **OK** (0, SECTION_SUCCESS): + // estimation of used space has been successfully announced; + // - Common failures (SECTION_FAILURE_COMMON). AnnounceUsedSpace(context.Context, *AnnounceUsedSpaceRequest) (*AnnounceUsedSpaceResponse, error) } diff --git a/v2/netmap/grpc/service_grpc.pb.go b/v2/netmap/grpc/service_grpc.pb.go index 01252c8..4500227 100644 --- a/v2/netmap/grpc/service_grpc.pb.go +++ b/v2/netmap/grpc/service_grpc.pb.go @@ -23,8 +23,18 @@ type NetmapServiceClient interface { // want to get recent information directly, or to talk to the node not yet // present in `Network Map` to find out what API version can be used for // further communication. Can also be used to check if node is up and running. + // + // Statuses: + // - **OK** (0, SECTION_SUCCESS): + // information about the server has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON). LocalNodeInfo(ctx context.Context, in *LocalNodeInfoRequest, opts ...grpc.CallOption) (*LocalNodeInfoResponse, error) // Read recent information about the NeoFS network. + // + // Statuses: + // - **OK** (0, SECTION_SUCCESS): + // information about the current network state has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON). NetworkInfo(ctx context.Context, in *NetworkInfoRequest, opts ...grpc.CallOption) (*NetworkInfoResponse, error) } @@ -63,8 +73,18 @@ type NetmapServiceServer interface { // want to get recent information directly, or to talk to the node not yet // present in `Network Map` to find out what API version can be used for // further communication. Can also be used to check if node is up and running. + // + // Statuses: + // - **OK** (0, SECTION_SUCCESS): + // information about the server has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON). LocalNodeInfo(context.Context, *LocalNodeInfoRequest) (*LocalNodeInfoResponse, error) // Read recent information about the NeoFS network. + // + // Statuses: + // - **OK** (0, SECTION_SUCCESS): + // information about the current network state has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON). NetworkInfo(context.Context, *NetworkInfoRequest) (*NetworkInfoResponse, error) } diff --git a/v2/object/grpc/service_grpc.pb.go b/v2/object/grpc/service_grpc.pb.go index f07c5d1..2586c04 100644 --- a/v2/object/grpc/service_grpc.pb.go +++ b/v2/object/grpc/service_grpc.pb.go @@ -24,6 +24,11 @@ type ObjectServiceClient interface { // messages, except the first one, carry payload chunks. Requested object can // be restored by concatenation of object message payload and all chunks // keeping receiving order. + // + // Statuses: + // - **OK** (0, SECTION_SUCCESS): + // object has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON). Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (ObjectService_GetClient, error) // Put the object into container. Request uses gRPC stream. First message // SHOULD be of PutHeader type. `ContainerID` and `OwnerID` of an object @@ -31,27 +36,57 @@ type ObjectServiceClient interface { // session package). Chunk messages are considered by server as a part of an // object payload. All messages, except first one, SHOULD be payload chunks. // Chunk messages SHOULD be sent in direct order of fragmentation. + // + // Statuses: + // - **OK** (0, SECTION_SUCCESS): + // object has been successfully saved in the container; + // - Common failures (SECTION_FAILURE_COMMON). Put(ctx context.Context, opts ...grpc.CallOption) (ObjectService_PutClient, error) // Delete the object from a container. There is no immediate removal // guarantee. Object will be marked for removal and deleted eventually. + // + // Statuses: + // - **OK** (0, SECTION_SUCCESS): + // object has been successfully marked to be removed from the container; + // - Common failures (SECTION_FAILURE_COMMON). Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteResponse, error) // Returns the object Headers without data payload. By default full header is // returned. If `main_only` request field is set, the short header with only // the very minimal information would be returned instead. + // + // Statuses: + // - **OK** (0, SECTION_SUCCESS): + // object header has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON). Head(ctx context.Context, in *HeadRequest, opts ...grpc.CallOption) (*HeadResponse, error) // Search objects in container. Search query allows to match by Object // Header's filed values. Please see the corresponding NeoFS Technical // Specification section for more details. + // + // Statuses: + // - **OK** (0, SECTION_SUCCESS): + // objects have been successfully selected; + // - Common failures (SECTION_FAILURE_COMMON). Search(ctx context.Context, in *SearchRequest, opts ...grpc.CallOption) (ObjectService_SearchClient, error) // Get byte range of data payload. Range is set as an (offset, length) tuple. // Like in `Get` method, the response uses gRPC stream. Requested range can be // restored by concatenation of all received payload chunks keeping receiving // order. + // + // Statuses: + // - **OK** (0, SECTION_SUCCESS): + // data range of the object payload has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON). GetRange(ctx context.Context, in *GetRangeRequest, opts ...grpc.CallOption) (ObjectService_GetRangeClient, error) // Returns homomorphic or regular hash of object's payload range after // applying XOR operation with the provided `salt`. Ranges are set of (offset, // length) tuples. Hashes order in response corresponds to ranges order in // request. Note that hash is calculated for XORed data. + // + // Statuses: + // - **OK** (0, SECTION_SUCCESS): + // data range of the object payload has been successfully hashed; + // - Common failures (SECTION_FAILURE_COMMON). GetRangeHash(ctx context.Context, in *GetRangeHashRequest, opts ...grpc.CallOption) (*GetRangeHashResponse, error) } @@ -230,6 +265,11 @@ type ObjectServiceServer interface { // messages, except the first one, carry payload chunks. Requested object can // be restored by concatenation of object message payload and all chunks // keeping receiving order. + // + // Statuses: + // - **OK** (0, SECTION_SUCCESS): + // object has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON). Get(*GetRequest, ObjectService_GetServer) error // Put the object into container. Request uses gRPC stream. First message // SHOULD be of PutHeader type. `ContainerID` and `OwnerID` of an object @@ -237,27 +277,57 @@ type ObjectServiceServer interface { // session package). Chunk messages are considered by server as a part of an // object payload. All messages, except first one, SHOULD be payload chunks. // Chunk messages SHOULD be sent in direct order of fragmentation. + // + // Statuses: + // - **OK** (0, SECTION_SUCCESS): + // object has been successfully saved in the container; + // - Common failures (SECTION_FAILURE_COMMON). Put(ObjectService_PutServer) error // Delete the object from a container. There is no immediate removal // guarantee. Object will be marked for removal and deleted eventually. + // + // Statuses: + // - **OK** (0, SECTION_SUCCESS): + // object has been successfully marked to be removed from the container; + // - Common failures (SECTION_FAILURE_COMMON). Delete(context.Context, *DeleteRequest) (*DeleteResponse, error) // Returns the object Headers without data payload. By default full header is // returned. If `main_only` request field is set, the short header with only // the very minimal information would be returned instead. + // + // Statuses: + // - **OK** (0, SECTION_SUCCESS): + // object header has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON). Head(context.Context, *HeadRequest) (*HeadResponse, error) // Search objects in container. Search query allows to match by Object // Header's filed values. Please see the corresponding NeoFS Technical // Specification section for more details. + // + // Statuses: + // - **OK** (0, SECTION_SUCCESS): + // objects have been successfully selected; + // - Common failures (SECTION_FAILURE_COMMON). Search(*SearchRequest, ObjectService_SearchServer) error // Get byte range of data payload. Range is set as an (offset, length) tuple. // Like in `Get` method, the response uses gRPC stream. Requested range can be // restored by concatenation of all received payload chunks keeping receiving // order. + // + // Statuses: + // - **OK** (0, SECTION_SUCCESS): + // data range of the object payload has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON). GetRange(*GetRangeRequest, ObjectService_GetRangeServer) error // Returns homomorphic or regular hash of object's payload range after // applying XOR operation with the provided `salt`. Ranges are set of (offset, // length) tuples. Hashes order in response corresponds to ranges order in // request. Note that hash is calculated for XORed data. + // + // Statuses: + // - **OK** (0, SECTION_SUCCESS): + // data range of the object payload has been successfully hashed; + // - Common failures (SECTION_FAILURE_COMMON). GetRangeHash(context.Context, *GetRangeHashRequest) (*GetRangeHashResponse, error) } diff --git a/v2/object/grpc/status.pb.go b/v2/object/grpc/status.pb.go new file mode 100644 index 0000000..08d06d1 --- /dev/null +++ b/v2/object/grpc/status.pb.go @@ -0,0 +1,250 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.1 +// protoc v3.18.0 +// source: v2/object/grpc/status.proto + +package object + +import ( + grpc "github.com/nspcc-dev/neofs-api-go/v2/status/grpc" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +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) +) + +type StatusCommon int32 + +const ( + StatusCommon_ACCESS_DENIED StatusCommon = 0 +) + +// Enum value maps for StatusCommon. +var ( + StatusCommon_name = map[int32]string{ + 0: "ACCESS_DENIED", + } + StatusCommon_value = map[string]int32{ + "ACCESS_DENIED": 0, + } +) + +func (x StatusCommon) Enum() *StatusCommon { + p := new(StatusCommon) + *p = x + return p +} + +func (x StatusCommon) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (StatusCommon) Descriptor() protoreflect.EnumDescriptor { + return file_v2_object_grpc_status_proto_enumTypes[0].Descriptor() +} + +func (StatusCommon) Type() protoreflect.EnumType { + return &file_v2_object_grpc_status_proto_enumTypes[0] +} + +func (x StatusCommon) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use StatusCommon.Descriptor instead. +func (StatusCommon) EnumDescriptor() ([]byte, []int) { + return file_v2_object_grpc_status_proto_rawDescGZIP(), []int{0} +} + +type StatusPut int32 + +const ( + StatusPut_STATUS_PUT_INCOMPLETE StatusPut = 0 +) + +// Enum value maps for StatusPut. +var ( + StatusPut_name = map[int32]string{ + 0: "STATUS_PUT_INCOMPLETE", + } + StatusPut_value = map[string]int32{ + "STATUS_PUT_INCOMPLETE": 0, + } +) + +func (x StatusPut) Enum() *StatusPut { + p := new(StatusPut) + *p = x + return p +} + +func (x StatusPut) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (StatusPut) Descriptor() protoreflect.EnumDescriptor { + return file_v2_object_grpc_status_proto_enumTypes[1].Descriptor() +} + +func (StatusPut) Type() protoreflect.EnumType { + return &file_v2_object_grpc_status_proto_enumTypes[1] +} + +func (x StatusPut) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use StatusPut.Descriptor instead. +func (StatusPut) EnumDescriptor() ([]byte, []int) { + return file_v2_object_grpc_status_proto_rawDescGZIP(), []int{1} +} + +type PutIncompleteDetail struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Statuses []*grpc.Status `protobuf:"bytes,1,rep,name=statuses,proto3" json:"statuses,omitempty"` +} + +func (x *PutIncompleteDetail) Reset() { + *x = PutIncompleteDetail{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_object_grpc_status_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PutIncompleteDetail) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PutIncompleteDetail) ProtoMessage() {} + +func (x *PutIncompleteDetail) ProtoReflect() protoreflect.Message { + mi := &file_v2_object_grpc_status_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PutIncompleteDetail.ProtoReflect.Descriptor instead. +func (*PutIncompleteDetail) Descriptor() ([]byte, []int) { + return file_v2_object_grpc_status_proto_rawDescGZIP(), []int{0} +} + +func (x *PutIncompleteDetail) GetStatuses() []*grpc.Status { + if x != nil { + return x.Statuses + } + return nil +} + +var File_v2_object_grpc_status_proto protoreflect.FileDescriptor + +var file_v2_object_grpc_status_proto_rawDesc = []byte{ + 0x0a, 0x1b, 0x76, 0x32, 0x2f, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2f, 0x67, 0x72, 0x70, 0x63, + 0x2f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x10, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x1a, + 0x1a, 0x76, 0x32, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, + 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x4b, 0x0a, 0x13, 0x50, + 0x75, 0x74, 0x49, 0x6e, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x44, 0x65, 0x74, 0x61, + 0x69, 0x6c, 0x12, 0x34, 0x0a, 0x08, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x65, 0x73, 0x18, 0x01, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x08, + 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x65, 0x73, 0x2a, 0x21, 0x0a, 0x0c, 0x53, 0x74, 0x61, 0x74, + 0x75, 0x73, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x12, 0x11, 0x0a, 0x0d, 0x41, 0x43, 0x43, 0x45, + 0x53, 0x53, 0x5f, 0x44, 0x45, 0x4e, 0x49, 0x45, 0x44, 0x10, 0x00, 0x2a, 0x26, 0x0a, 0x09, 0x53, + 0x74, 0x61, 0x74, 0x75, 0x73, 0x50, 0x75, 0x74, 0x12, 0x19, 0x0a, 0x15, 0x53, 0x54, 0x41, 0x54, + 0x55, 0x53, 0x5f, 0x50, 0x55, 0x54, 0x5f, 0x49, 0x4e, 0x43, 0x4f, 0x4d, 0x50, 0x4c, 0x45, 0x54, + 0x45, 0x10, 0x00, 0x42, 0x56, 0x5a, 0x37, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, + 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, + 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x6f, 0x62, 0x6a, 0x65, + 0x63, 0x74, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0xaa, 0x02, + 0x1a, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, + 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, +} + +var ( + file_v2_object_grpc_status_proto_rawDescOnce sync.Once + file_v2_object_grpc_status_proto_rawDescData = file_v2_object_grpc_status_proto_rawDesc +) + +func file_v2_object_grpc_status_proto_rawDescGZIP() []byte { + file_v2_object_grpc_status_proto_rawDescOnce.Do(func() { + file_v2_object_grpc_status_proto_rawDescData = protoimpl.X.CompressGZIP(file_v2_object_grpc_status_proto_rawDescData) + }) + return file_v2_object_grpc_status_proto_rawDescData +} + +var file_v2_object_grpc_status_proto_enumTypes = make([]protoimpl.EnumInfo, 2) +var file_v2_object_grpc_status_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_v2_object_grpc_status_proto_goTypes = []interface{}{ + (StatusCommon)(0), // 0: neo.fs.v2.object.StatusCommon + (StatusPut)(0), // 1: neo.fs.v2.object.StatusPut + (*PutIncompleteDetail)(nil), // 2: neo.fs.v2.object.PutIncompleteDetail + (*grpc.Status)(nil), // 3: neo.fs.v2.status.Status +} +var file_v2_object_grpc_status_proto_depIdxs = []int32{ + 3, // 0: neo.fs.v2.object.PutIncompleteDetail.statuses:type_name -> neo.fs.v2.status.Status + 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_v2_object_grpc_status_proto_init() } +func file_v2_object_grpc_status_proto_init() { + if File_v2_object_grpc_status_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_v2_object_grpc_status_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PutIncompleteDetail); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_v2_object_grpc_status_proto_rawDesc, + NumEnums: 2, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_v2_object_grpc_status_proto_goTypes, + DependencyIndexes: file_v2_object_grpc_status_proto_depIdxs, + EnumInfos: file_v2_object_grpc_status_proto_enumTypes, + MessageInfos: file_v2_object_grpc_status_proto_msgTypes, + }.Build() + File_v2_object_grpc_status_proto = out.File + file_v2_object_grpc_status_proto_rawDesc = nil + file_v2_object_grpc_status_proto_goTypes = nil + file_v2_object_grpc_status_proto_depIdxs = nil +} diff --git a/v2/reputation/grpc/service_grpc.pb.go b/v2/reputation/grpc/service_grpc.pb.go index 5b493a4..8713df7 100644 --- a/v2/reputation/grpc/service_grpc.pb.go +++ b/v2/reputation/grpc/service_grpc.pb.go @@ -19,9 +19,19 @@ const _ = grpc.SupportPackageIsVersion7 // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. type ReputationServiceClient interface { // Announce local client trust information to any node in NeoFS network. + // + // Statuses: + // - **OK** (0, SECTION_SUCCESS): + // local trust has been successfully announced; + // - Common failures (SECTION_FAILURE_COMMON). AnnounceLocalTrust(ctx context.Context, in *AnnounceLocalTrustRequest, opts ...grpc.CallOption) (*AnnounceLocalTrustResponse, error) // Announces the intermediate result of the iterative algorithm for // calculating the global reputation of the node in NeoFS network. + // + // Statuses: + // - **OK** (0, SECTION_SUCCESS): + // intermediate trust estimation has been successfully announced; + // - Common failures (SECTION_FAILURE_COMMON). AnnounceIntermediateResult(ctx context.Context, in *AnnounceIntermediateResultRequest, opts ...grpc.CallOption) (*AnnounceIntermediateResultResponse, error) } @@ -56,9 +66,19 @@ func (c *reputationServiceClient) AnnounceIntermediateResult(ctx context.Context // for forward compatibility type ReputationServiceServer interface { // Announce local client trust information to any node in NeoFS network. + // + // Statuses: + // - **OK** (0, SECTION_SUCCESS): + // local trust has been successfully announced; + // - Common failures (SECTION_FAILURE_COMMON). AnnounceLocalTrust(context.Context, *AnnounceLocalTrustRequest) (*AnnounceLocalTrustResponse, error) // Announces the intermediate result of the iterative algorithm for // calculating the global reputation of the node in NeoFS network. + // + // Statuses: + // - **OK** (0, SECTION_SUCCESS): + // intermediate trust estimation has been successfully announced; + // - Common failures (SECTION_FAILURE_COMMON). AnnounceIntermediateResult(context.Context, *AnnounceIntermediateResultRequest) (*AnnounceIntermediateResultResponse, error) } diff --git a/v2/session/grpc/service_grpc.pb.go b/v2/session/grpc/service_grpc.pb.go index d753c51..a6bc2bd 100644 --- a/v2/session/grpc/service_grpc.pb.go +++ b/v2/session/grpc/service_grpc.pb.go @@ -19,6 +19,11 @@ const _ = grpc.SupportPackageIsVersion7 // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. type SessionServiceClient interface { // Opens a new session between two peers. + // + // Statuses: + // - **OK** (0, SECTION_SUCCESS): + // session has been successfully opened; + // - Common failures (SECTION_FAILURE_COMMON). Create(ctx context.Context, in *CreateRequest, opts ...grpc.CallOption) (*CreateResponse, error) } @@ -44,6 +49,11 @@ func (c *sessionServiceClient) Create(ctx context.Context, in *CreateRequest, op // for forward compatibility type SessionServiceServer interface { // Opens a new session between two peers. + // + // Statuses: + // - **OK** (0, SECTION_SUCCESS): + // session has been successfully opened; + // - Common failures (SECTION_FAILURE_COMMON). Create(context.Context, *CreateRequest) (*CreateResponse, error) } diff --git a/v2/session/grpc/types.pb.go b/v2/session/grpc/types.pb.go index f81b16c..3977511 100644 --- a/v2/session/grpc/types.pb.go +++ b/v2/session/grpc/types.pb.go @@ -9,6 +9,7 @@ package session import ( grpc1 "github.com/nspcc-dev/neofs-api-go/v2/acl/grpc" grpc "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" + grpc2 "github.com/nspcc-dev/neofs-api-go/v2/status/grpc" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -535,6 +536,8 @@ type ResponseMetaHeader struct { XHeaders []*XHeader `protobuf:"bytes,4,rep,name=x_headers,json=xHeaders,proto3" json:"x_headers,omitempty"` // `ResponseMetaHeader` of the origin request Origin *ResponseMetaHeader `protobuf:"bytes,5,opt,name=origin,proto3" json:"origin,omitempty"` + // Status return + Status *grpc2.Status `protobuf:"bytes,6,opt,name=status,proto3" json:"status,omitempty"` } func (x *ResponseMetaHeader) Reset() { @@ -604,6 +607,13 @@ func (x *ResponseMetaHeader) GetOrigin() *ResponseMetaHeader { return nil } +func (x *ResponseMetaHeader) GetStatus() *grpc2.Status { + if x != nil { + return x.Status + } + return nil +} + // Verification info for request signed by all intermediate nodes. type RequestVerificationHeader struct { state protoimpl.MessageState @@ -953,157 +963,162 @@ var file_v2_session_grpc_types_proto_rawDesc = []byte{ 0x1a, 0x18, 0x76, 0x32, 0x2f, 0x72, 0x65, 0x66, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x76, 0x32, 0x2f, 0x61, 0x63, 0x6c, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x22, 0xf7, 0x01, 0x0a, 0x14, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x53, 0x65, - 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x12, 0x40, 0x0a, 0x04, - 0x76, 0x65, 0x72, 0x62, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2c, 0x2e, 0x6e, 0x65, 0x6f, - 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x4f, - 0x62, 0x6a, 0x65, 0x63, 0x74, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x74, - 0x65, 0x78, 0x74, 0x2e, 0x56, 0x65, 0x72, 0x62, 0x52, 0x04, 0x76, 0x65, 0x72, 0x62, 0x12, 0x31, - 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x17, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, - 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, - 0x73, 0x22, 0x6a, 0x0a, 0x04, 0x56, 0x65, 0x72, 0x62, 0x12, 0x14, 0x0a, 0x10, 0x56, 0x45, 0x52, - 0x42, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, - 0x07, 0x0a, 0x03, 0x50, 0x55, 0x54, 0x10, 0x01, 0x12, 0x07, 0x0a, 0x03, 0x47, 0x45, 0x54, 0x10, - 0x02, 0x12, 0x08, 0x0a, 0x04, 0x48, 0x45, 0x41, 0x44, 0x10, 0x03, 0x12, 0x0a, 0x0a, 0x06, 0x53, - 0x45, 0x41, 0x52, 0x43, 0x48, 0x10, 0x04, 0x12, 0x0a, 0x0a, 0x06, 0x44, 0x45, 0x4c, 0x45, 0x54, - 0x45, 0x10, 0x05, 0x12, 0x09, 0x0a, 0x05, 0x52, 0x41, 0x4e, 0x47, 0x45, 0x10, 0x06, 0x12, 0x0d, - 0x0a, 0x09, 0x52, 0x41, 0x4e, 0x47, 0x45, 0x48, 0x41, 0x53, 0x48, 0x10, 0x07, 0x22, 0xfa, 0x01, - 0x0a, 0x17, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x53, 0x65, 0x73, 0x73, 0x69, - 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x12, 0x43, 0x0a, 0x04, 0x76, 0x65, 0x72, - 0x62, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, - 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x43, 0x6f, 0x6e, 0x74, - 0x61, 0x69, 0x6e, 0x65, 0x72, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x74, - 0x65, 0x78, 0x74, 0x2e, 0x56, 0x65, 0x72, 0x62, 0x52, 0x04, 0x76, 0x65, 0x72, 0x62, 0x12, 0x1a, - 0x0a, 0x08, 0x77, 0x69, 0x6c, 0x64, 0x63, 0x61, 0x72, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, - 0x52, 0x08, 0x77, 0x69, 0x6c, 0x64, 0x63, 0x61, 0x72, 0x64, 0x12, 0x3e, 0x0a, 0x0c, 0x63, 0x6f, - 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, - 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x52, 0x0b, 0x63, - 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x22, 0x3e, 0x0a, 0x04, 0x56, 0x65, - 0x72, 0x62, 0x12, 0x14, 0x0a, 0x10, 0x56, 0x45, 0x52, 0x42, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, - 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x50, 0x55, 0x54, 0x10, - 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x44, 0x45, 0x4c, 0x45, 0x54, 0x45, 0x10, 0x02, 0x12, 0x0b, 0x0a, - 0x07, 0x53, 0x45, 0x54, 0x45, 0x41, 0x43, 0x4c, 0x10, 0x03, 0x22, 0xa0, 0x04, 0x0a, 0x0c, 0x53, - 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x38, 0x0a, 0x04, 0x62, - 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, + 0x6f, 0x74, 0x6f, 0x1a, 0x1a, 0x76, 0x32, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2f, 0x67, + 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, + 0xf7, 0x01, 0x0a, 0x14, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, + 0x6e, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x12, 0x40, 0x0a, 0x04, 0x76, 0x65, 0x72, 0x62, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, + 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, + 0x74, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x2e, + 0x56, 0x65, 0x72, 0x62, 0x52, 0x04, 0x76, 0x65, 0x72, 0x62, 0x12, 0x31, 0x0a, 0x07, 0x61, 0x64, + 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6e, 0x65, + 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x41, 0x64, 0x64, + 0x72, 0x65, 0x73, 0x73, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x6a, 0x0a, + 0x04, 0x56, 0x65, 0x72, 0x62, 0x12, 0x14, 0x0a, 0x10, 0x56, 0x45, 0x52, 0x42, 0x5f, 0x55, 0x4e, + 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x50, + 0x55, 0x54, 0x10, 0x01, 0x12, 0x07, 0x0a, 0x03, 0x47, 0x45, 0x54, 0x10, 0x02, 0x12, 0x08, 0x0a, + 0x04, 0x48, 0x45, 0x41, 0x44, 0x10, 0x03, 0x12, 0x0a, 0x0a, 0x06, 0x53, 0x45, 0x41, 0x52, 0x43, + 0x48, 0x10, 0x04, 0x12, 0x0a, 0x0a, 0x06, 0x44, 0x45, 0x4c, 0x45, 0x54, 0x45, 0x10, 0x05, 0x12, + 0x09, 0x0a, 0x05, 0x52, 0x41, 0x4e, 0x47, 0x45, 0x10, 0x06, 0x12, 0x0d, 0x0a, 0x09, 0x52, 0x41, + 0x4e, 0x47, 0x45, 0x48, 0x41, 0x53, 0x48, 0x10, 0x07, 0x22, 0xfa, 0x01, 0x0a, 0x17, 0x43, 0x6f, + 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, + 0x6e, 0x74, 0x65, 0x78, 0x74, 0x12, 0x43, 0x0a, 0x04, 0x76, 0x65, 0x72, 0x62, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0e, 0x32, 0x2f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, + 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, + 0x72, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x2e, + 0x56, 0x65, 0x72, 0x62, 0x52, 0x04, 0x76, 0x65, 0x72, 0x62, 0x12, 0x1a, 0x0a, 0x08, 0x77, 0x69, + 0x6c, 0x64, 0x63, 0x61, 0x72, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x77, 0x69, + 0x6c, 0x64, 0x63, 0x61, 0x72, 0x64, 0x12, 0x3e, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, + 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x6f, + 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x61, + 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x22, 0x3e, 0x0a, 0x04, 0x56, 0x65, 0x72, 0x62, 0x12, 0x14, + 0x0a, 0x10, 0x56, 0x45, 0x52, 0x42, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, + 0x45, 0x44, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x50, 0x55, 0x54, 0x10, 0x01, 0x12, 0x0a, 0x0a, + 0x06, 0x44, 0x45, 0x4c, 0x45, 0x54, 0x45, 0x10, 0x02, 0x12, 0x0b, 0x0a, 0x07, 0x53, 0x45, 0x54, + 0x45, 0x41, 0x43, 0x4c, 0x10, 0x03, 0x22, 0xa0, 0x04, 0x0a, 0x0c, 0x53, 0x65, 0x73, 0x73, 0x69, + 0x6f, 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x38, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, + 0x01, 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, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, + 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, + 0x79, 0x12, 0x37, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, + 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x1a, 0x9c, 0x03, 0x0a, 0x04, 0x42, + 0x6f, 0x64, 0x79, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, + 0x02, 0x69, 0x64, 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, 0x4e, 0x0a, 0x08, 0x6c, 0x69, 0x66, 0x65, 0x74, + 0x69, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x32, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x65, - 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, - 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x37, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, - 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, - 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, - 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x1a, 0x9c, - 0x03, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0c, 0x52, 0x02, 0x69, 0x64, 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, 0x4e, 0x0a, 0x08, 0x6c, - 0x69, 0x66, 0x65, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x32, 0x2e, - 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, - 0x6e, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x42, - 0x6f, 0x64, 0x79, 0x2e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x4c, 0x69, 0x66, 0x65, 0x74, 0x69, 0x6d, - 0x65, 0x52, 0x08, 0x6c, 0x69, 0x66, 0x65, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x73, - 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, - 0x52, 0x0a, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x4b, 0x65, 0x79, 0x12, 0x41, 0x0a, 0x06, - 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x6e, - 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, - 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, - 0x6e, 0x74, 0x65, 0x78, 0x74, 0x48, 0x00, 0x52, 0x06, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, - 0x4a, 0x0a, 0x09, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x18, 0x06, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, - 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, - 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x48, 0x00, - 0x52, 0x09, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x1a, 0x45, 0x0a, 0x0d, 0x54, - 0x6f, 0x6b, 0x65, 0x6e, 0x4c, 0x69, 0x66, 0x65, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, - 0x65, 0x78, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x65, 0x78, 0x70, 0x12, 0x10, - 0x0a, 0x03, 0x6e, 0x62, 0x66, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x6e, 0x62, 0x66, - 0x12, 0x10, 0x0a, 0x03, 0x69, 0x61, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x69, - 0x61, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x22, 0x31, 0x0a, - 0x07, 0x58, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 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, - 0x22, 0xea, 0x02, 0x0a, 0x11, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x74, 0x61, - 0x48, 0x65, 0x61, 0x64, 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, 0x14, 0x0a, 0x05, 0x65, 0x70, 0x6f, - 0x63, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x12, - 0x10, 0x0a, 0x03, 0x74, 0x74, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x03, 0x74, 0x74, - 0x6c, 0x12, 0x37, 0x0a, 0x09, 0x78, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x18, 0x04, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, - 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x58, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, - 0x52, 0x08, 0x78, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x12, 0x44, 0x0a, 0x0d, 0x73, 0x65, - 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, - 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x6f, 0x6b, - 0x65, 0x6e, 0x52, 0x0c, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, - 0x12, 0x3d, 0x0a, 0x0c, 0x62, 0x65, 0x61, 0x72, 0x65, 0x72, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, - 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, - 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x42, 0x65, 0x61, 0x72, 0x65, 0x72, 0x54, 0x6f, 0x6b, - 0x65, 0x6e, 0x52, 0x0b, 0x62, 0x65, 0x61, 0x72, 0x65, 0x72, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, - 0x3c, 0x0a, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x18, 0x07, 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, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x22, 0xe7, 0x01, - 0x0a, 0x12, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x48, 0x65, - 0x61, 0x64, 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, 0x14, 0x0a, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x12, 0x10, 0x0a, - 0x03, 0x74, 0x74, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x03, 0x74, 0x74, 0x6c, 0x12, - 0x37, 0x0a, 0x09, 0x78, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x18, 0x04, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, - 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x58, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x08, - 0x78, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x12, 0x3d, 0x0a, 0x06, 0x6f, 0x72, 0x69, 0x67, - 0x69, 0x6e, 0x18, 0x05, 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, - 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x22, 0xab, 0x02, 0x0a, 0x19, 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, 0x12, 0x40, 0x0a, 0x0e, 0x62, 0x6f, 0x64, 0x79, 0x5f, 0x73, 0x69, - 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, - 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, - 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x0d, 0x62, 0x6f, 0x64, 0x79, 0x53, 0x69, - 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x40, 0x0a, 0x0e, 0x6d, 0x65, 0x74, 0x61, 0x5f, - 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, - 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x0d, 0x6d, 0x65, 0x74, 0x61, - 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x44, 0x0a, 0x10, 0x6f, 0x72, 0x69, - 0x67, 0x69, 0x6e, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, - 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x0f, - 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, - 0x44, 0x0a, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x18, 0x04, 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, 0x06, 0x6f, - 0x72, 0x69, 0x67, 0x69, 0x6e, 0x22, 0xad, 0x02, 0x0a, 0x1a, 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, 0x12, 0x40, 0x0a, 0x0e, 0x62, 0x6f, 0x64, 0x79, 0x5f, 0x73, 0x69, 0x67, - 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, - 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, - 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x0d, 0x62, 0x6f, 0x64, 0x79, 0x53, 0x69, 0x67, - 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x40, 0x0a, 0x0e, 0x6d, 0x65, 0x74, 0x61, 0x5f, 0x73, - 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, - 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, - 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x0d, 0x6d, 0x65, 0x74, 0x61, 0x53, - 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x44, 0x0a, 0x10, 0x6f, 0x72, 0x69, 0x67, - 0x69, 0x6e, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, - 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x0f, 0x6f, - 0x72, 0x69, 0x67, 0x69, 0x6e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x45, - 0x0a, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, + 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x2e, + 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x4c, 0x69, 0x66, 0x65, 0x74, 0x69, 0x6d, 0x65, 0x52, 0x08, 0x6c, + 0x69, 0x66, 0x65, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x73, 0x65, 0x73, 0x73, 0x69, + 0x6f, 0x6e, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x73, 0x65, + 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x4b, 0x65, 0x79, 0x12, 0x41, 0x0a, 0x06, 0x6f, 0x62, 0x6a, 0x65, + 0x63, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x4f, 0x62, 0x6a, + 0x65, 0x63, 0x74, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, + 0x74, 0x48, 0x00, 0x52, 0x06, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x4a, 0x0a, 0x09, 0x63, + 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 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, 0x06, 0x6f, - 0x72, 0x69, 0x67, 0x69, 0x6e, 0x42, 0x59, 0x5a, 0x39, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, - 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, - 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 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, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6f, 0x6e, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x53, 0x65, 0x73, 0x73, + 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x48, 0x00, 0x52, 0x09, 0x63, 0x6f, + 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x1a, 0x45, 0x0a, 0x0d, 0x54, 0x6f, 0x6b, 0x65, 0x6e, + 0x4c, 0x69, 0x66, 0x65, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x78, 0x70, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x65, 0x78, 0x70, 0x12, 0x10, 0x0a, 0x03, 0x6e, 0x62, + 0x66, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x6e, 0x62, 0x66, 0x12, 0x10, 0x0a, 0x03, + 0x69, 0x61, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x69, 0x61, 0x74, 0x42, 0x09, + 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x22, 0x31, 0x0a, 0x07, 0x58, 0x48, 0x65, + 0x61, 0x64, 0x65, 0x72, 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, 0x22, 0xea, 0x02, 0x0a, + 0x11, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, + 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, 0x14, 0x0a, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x12, 0x10, 0x0a, 0x03, 0x74, + 0x74, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x03, 0x74, 0x74, 0x6c, 0x12, 0x37, 0x0a, + 0x09, 0x78, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x1a, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, + 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x58, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x08, 0x78, 0x48, + 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x12, 0x44, 0x0a, 0x0d, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, + 0x6e, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, + 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, + 0x6e, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x0c, + 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x3d, 0x0a, 0x0c, + 0x62, 0x65, 0x61, 0x72, 0x65, 0x72, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x06, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, + 0x63, 0x6c, 0x2e, 0x42, 0x65, 0x61, 0x72, 0x65, 0x72, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x0b, + 0x62, 0x65, 0x61, 0x72, 0x65, 0x72, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x3c, 0x0a, 0x06, 0x6f, + 0x72, 0x69, 0x67, 0x69, 0x6e, 0x18, 0x07, 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, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x22, 0x99, 0x02, 0x0a, 0x12, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 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, 0x14, 0x0a, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x04, 0x52, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x12, 0x10, 0x0a, 0x03, 0x74, 0x74, 0x6c, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x03, 0x74, 0x74, 0x6c, 0x12, 0x37, 0x0a, 0x09, 0x78, + 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, + 0x6f, 0x6e, 0x2e, 0x58, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x08, 0x78, 0x48, 0x65, 0x61, + 0x64, 0x65, 0x72, 0x73, 0x12, 0x3d, 0x0a, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x18, 0x05, + 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, 0x06, 0x6f, 0x72, 0x69, + 0x67, 0x69, 0x6e, 0x12, 0x30, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x06, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, + 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, + 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0xab, 0x02, 0x0a, 0x19, 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, 0x12, 0x40, 0x0a, 0x0e, 0x62, 0x6f, 0x64, 0x79, 0x5f, 0x73, 0x69, 0x67, 0x6e, + 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, + 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, + 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x0d, 0x62, 0x6f, 0x64, 0x79, 0x53, 0x69, 0x67, 0x6e, + 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x40, 0x0a, 0x0e, 0x6d, 0x65, 0x74, 0x61, 0x5f, 0x73, 0x69, + 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, + 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, + 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x0d, 0x6d, 0x65, 0x74, 0x61, 0x53, 0x69, + 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x44, 0x0a, 0x10, 0x6f, 0x72, 0x69, 0x67, 0x69, + 0x6e, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, + 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x0f, 0x6f, 0x72, + 0x69, 0x67, 0x69, 0x6e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x44, 0x0a, + 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x18, 0x04, 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, 0x06, 0x6f, 0x72, 0x69, + 0x67, 0x69, 0x6e, 0x22, 0xad, 0x02, 0x0a, 0x1a, 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, 0x12, 0x40, 0x0a, 0x0e, 0x62, 0x6f, 0x64, 0x79, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, + 0x74, 0x75, 0x72, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, + 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, + 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x0d, 0x62, 0x6f, 0x64, 0x79, 0x53, 0x69, 0x67, 0x6e, 0x61, + 0x74, 0x75, 0x72, 0x65, 0x12, 0x40, 0x0a, 0x0e, 0x6d, 0x65, 0x74, 0x61, 0x5f, 0x73, 0x69, 0x67, + 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, + 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x0d, 0x6d, 0x65, 0x74, 0x61, 0x53, 0x69, 0x67, + 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x44, 0x0a, 0x10, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, + 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, + 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x0f, 0x6f, 0x72, 0x69, + 0x67, 0x69, 0x6e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x45, 0x0a, 0x06, + 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x18, 0x04, 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, 0x06, 0x6f, 0x72, 0x69, + 0x67, 0x69, 0x6e, 0x42, 0x59, 0x5a, 0x39, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, + 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, + 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 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, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -1138,7 +1153,8 @@ var file_v2_session_grpc_types_proto_goTypes = []interface{}{ (*grpc.Signature)(nil), // 14: neo.fs.v2.refs.Signature (*grpc.Version)(nil), // 15: neo.fs.v2.refs.Version (*grpc1.BearerToken)(nil), // 16: neo.fs.v2.acl.BearerToken - (*grpc.OwnerID)(nil), // 17: neo.fs.v2.refs.OwnerID + (*grpc2.Status)(nil), // 17: neo.fs.v2.status.Status + (*grpc.OwnerID)(nil), // 18: neo.fs.v2.refs.OwnerID } var file_v2_session_grpc_types_proto_depIdxs = []int32{ 0, // 0: neo.fs.v2.session.ObjectSessionContext.verb:type_name -> neo.fs.v2.session.ObjectSessionContext.Verb @@ -1155,23 +1171,24 @@ var file_v2_session_grpc_types_proto_depIdxs = []int32{ 15, // 11: neo.fs.v2.session.ResponseMetaHeader.version:type_name -> neo.fs.v2.refs.Version 5, // 12: neo.fs.v2.session.ResponseMetaHeader.x_headers:type_name -> neo.fs.v2.session.XHeader 7, // 13: neo.fs.v2.session.ResponseMetaHeader.origin:type_name -> neo.fs.v2.session.ResponseMetaHeader - 14, // 14: neo.fs.v2.session.RequestVerificationHeader.body_signature:type_name -> neo.fs.v2.refs.Signature - 14, // 15: neo.fs.v2.session.RequestVerificationHeader.meta_signature:type_name -> neo.fs.v2.refs.Signature - 14, // 16: neo.fs.v2.session.RequestVerificationHeader.origin_signature:type_name -> neo.fs.v2.refs.Signature - 8, // 17: neo.fs.v2.session.RequestVerificationHeader.origin:type_name -> neo.fs.v2.session.RequestVerificationHeader - 14, // 18: neo.fs.v2.session.ResponseVerificationHeader.body_signature:type_name -> neo.fs.v2.refs.Signature - 14, // 19: neo.fs.v2.session.ResponseVerificationHeader.meta_signature:type_name -> neo.fs.v2.refs.Signature - 14, // 20: neo.fs.v2.session.ResponseVerificationHeader.origin_signature:type_name -> neo.fs.v2.refs.Signature - 9, // 21: neo.fs.v2.session.ResponseVerificationHeader.origin:type_name -> neo.fs.v2.session.ResponseVerificationHeader - 17, // 22: neo.fs.v2.session.SessionToken.Body.owner_id:type_name -> neo.fs.v2.refs.OwnerID - 11, // 23: neo.fs.v2.session.SessionToken.Body.lifetime:type_name -> neo.fs.v2.session.SessionToken.Body.TokenLifetime - 2, // 24: neo.fs.v2.session.SessionToken.Body.object:type_name -> neo.fs.v2.session.ObjectSessionContext - 3, // 25: neo.fs.v2.session.SessionToken.Body.container:type_name -> neo.fs.v2.session.ContainerSessionContext - 26, // [26:26] is the sub-list for method output_type - 26, // [26:26] is the sub-list for method input_type - 26, // [26:26] is the sub-list for extension type_name - 26, // [26:26] is the sub-list for extension extendee - 0, // [0:26] is the sub-list for field type_name + 17, // 14: neo.fs.v2.session.ResponseMetaHeader.status:type_name -> neo.fs.v2.status.Status + 14, // 15: neo.fs.v2.session.RequestVerificationHeader.body_signature:type_name -> neo.fs.v2.refs.Signature + 14, // 16: neo.fs.v2.session.RequestVerificationHeader.meta_signature:type_name -> neo.fs.v2.refs.Signature + 14, // 17: neo.fs.v2.session.RequestVerificationHeader.origin_signature:type_name -> neo.fs.v2.refs.Signature + 8, // 18: neo.fs.v2.session.RequestVerificationHeader.origin:type_name -> neo.fs.v2.session.RequestVerificationHeader + 14, // 19: neo.fs.v2.session.ResponseVerificationHeader.body_signature:type_name -> neo.fs.v2.refs.Signature + 14, // 20: neo.fs.v2.session.ResponseVerificationHeader.meta_signature:type_name -> neo.fs.v2.refs.Signature + 14, // 21: neo.fs.v2.session.ResponseVerificationHeader.origin_signature:type_name -> neo.fs.v2.refs.Signature + 9, // 22: neo.fs.v2.session.ResponseVerificationHeader.origin:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 18, // 23: neo.fs.v2.session.SessionToken.Body.owner_id:type_name -> neo.fs.v2.refs.OwnerID + 11, // 24: neo.fs.v2.session.SessionToken.Body.lifetime:type_name -> neo.fs.v2.session.SessionToken.Body.TokenLifetime + 2, // 25: neo.fs.v2.session.SessionToken.Body.object:type_name -> neo.fs.v2.session.ObjectSessionContext + 3, // 26: neo.fs.v2.session.SessionToken.Body.container:type_name -> neo.fs.v2.session.ContainerSessionContext + 27, // [27:27] is the sub-list for method output_type + 27, // [27:27] is the sub-list for method input_type + 27, // [27:27] is the sub-list for extension type_name + 27, // [27:27] is the sub-list for extension extendee + 0, // [0:27] is the sub-list for field type_name } func init() { file_v2_session_grpc_types_proto_init() } diff --git a/v2/status/grpc/types.pb.go b/v2/status/grpc/types.pb.go new file mode 100644 index 0000000..f09a093 --- /dev/null +++ b/v2/status/grpc/types.pb.go @@ -0,0 +1,433 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.1 +// protoc v3.18.0 +// source: v2/status/grpc/types.proto + +package status + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +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) +) + +// Section identifiers. +type Section int32 + +const ( + // Successful return codes. + Section_SECTION_SUCCESS Section = 0 + // Failure codes regardless of the operation. + Section_SECTION_FAILURE_COMMON Section = 1 +) + +// Enum value maps for Section. +var ( + Section_name = map[int32]string{ + 0: "SECTION_SUCCESS", + 1: "SECTION_FAILURE_COMMON", + } + Section_value = map[string]int32{ + "SECTION_SUCCESS": 0, + "SECTION_FAILURE_COMMON": 1, + } +) + +func (x Section) Enum() *Section { + p := new(Section) + *p = x + return p +} + +func (x Section) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (Section) Descriptor() protoreflect.EnumDescriptor { + return file_v2_status_grpc_types_proto_enumTypes[0].Descriptor() +} + +func (Section) Type() protoreflect.EnumType { + return &file_v2_status_grpc_types_proto_enumTypes[0] +} + +func (x Section) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use Section.Descriptor instead. +func (Section) EnumDescriptor() ([]byte, []int) { + return file_v2_status_grpc_types_proto_rawDescGZIP(), []int{0} +} + +// Section of NeoFS successful return codes. +type Success int32 + +const ( + // [**0**] Default success. Not detailed. + // If the server cannot match successful outcome to the code, it should + // use this code. + Success_OK Success = 0 +) + +// Enum value maps for Success. +var ( + Success_name = map[int32]string{ + 0: "OK", + } + Success_value = map[string]int32{ + "OK": 0, + } +) + +func (x Success) Enum() *Success { + p := new(Success) + *p = x + return p +} + +func (x Success) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (Success) Descriptor() protoreflect.EnumDescriptor { + return file_v2_status_grpc_types_proto_enumTypes[1].Descriptor() +} + +func (Success) Type() protoreflect.EnumType { + return &file_v2_status_grpc_types_proto_enumTypes[1] +} + +func (x Success) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use Success.Descriptor instead. +func (Success) EnumDescriptor() ([]byte, []int) { + return file_v2_status_grpc_types_proto_rawDescGZIP(), []int{1} +} + +// Section of failed statuses independent of the operation. +type CommonFail int32 + +const ( + // [**1024**] Internal server error, default failure. Not detailed. + // If the server cannot match failed outcome to the code, it should + // use this code. + CommonFail_INTERNAL CommonFail = 0 +) + +// Enum value maps for CommonFail. +var ( + CommonFail_name = map[int32]string{ + 0: "INTERNAL", + } + CommonFail_value = map[string]int32{ + "INTERNAL": 0, + } +) + +func (x CommonFail) Enum() *CommonFail { + p := new(CommonFail) + *p = x + return p +} + +func (x CommonFail) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (CommonFail) Descriptor() protoreflect.EnumDescriptor { + return file_v2_status_grpc_types_proto_enumTypes[2].Descriptor() +} + +func (CommonFail) Type() protoreflect.EnumType { + return &file_v2_status_grpc_types_proto_enumTypes[2] +} + +func (x CommonFail) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use CommonFail.Descriptor instead. +func (CommonFail) EnumDescriptor() ([]byte, []int) { + return file_v2_status_grpc_types_proto_rawDescGZIP(), []int{2} +} + +// Declares the general format of the status returns of the NeoFS RPC protocol. +// Status is present in all response messages. Each RPC of NeoFS protocol +// describes the possible outcomes and details of the operation. +// +// Each status is assigned a one-to-one numeric code. Any unique result of an +// operation in NeoFS is unambiguously associated with the code value. +// +// Numerical set of codes is split into 1024-element sections. An enumeration +// is defined for each section. Values can be referred to in the following ways: +// +// * numerical value ranging from 0 to 4,294,967,295 (global code); +// +// * values from enumeration (local code). The formula for the ratio of the +// local code (`L`) of a defined section (`S`) to the global one (`G`): +// `G = 1024 * S + L`. +// +// All outcomes are divided into successful and failed, which corresponds +// to the success or failure of the operation. The definition of success +// follows from the semantics of RPC and the description of its purpose. +// The server must not attach code that is the opposite of outcome type. +// +// See the set of return codes in the description for calls. +// +// Each status can carry developer-facing error message. It should be human +// readable text in English. The server should not transmit (and the client +// should not expect) useful information in the message. Field `details` +// should make the return more detailed. +type Status struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The status code + Code uint32 `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"` + // Developer-facing error message + Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` + // Data detailing the outcome of the operation. Must be unique by ID. + Details []*Status_Detail `protobuf:"bytes,3,rep,name=details,proto3" json:"details,omitempty"` +} + +func (x *Status) Reset() { + *x = Status{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_status_grpc_types_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Status) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Status) ProtoMessage() {} + +func (x *Status) ProtoReflect() protoreflect.Message { + mi := &file_v2_status_grpc_types_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Status.ProtoReflect.Descriptor instead. +func (*Status) Descriptor() ([]byte, []int) { + return file_v2_status_grpc_types_proto_rawDescGZIP(), []int{0} +} + +func (x *Status) GetCode() uint32 { + if x != nil { + return x.Code + } + return 0 +} + +func (x *Status) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *Status) GetDetails() []*Status_Detail { + if x != nil { + return x.Details + } + return nil +} + +// Return detail. It contains additional information that can be used to +// analyze the response. Each code defines a set of details that can be +// attached to a status. Client should not handle details that are not +// covered by the code. +type Status_Detail struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Detail ID. The identifier is required to determine the binary format + // of the detail and how to decode it. + Id uint32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + // Binary status detail. Must follow the format associated with ID. + // The possibility of missing a value must be explicitly allowed. + Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` +} + +func (x *Status_Detail) Reset() { + *x = Status_Detail{} + if protoimpl.UnsafeEnabled { + mi := &file_v2_status_grpc_types_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Status_Detail) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Status_Detail) ProtoMessage() {} + +func (x *Status_Detail) ProtoReflect() protoreflect.Message { + mi := &file_v2_status_grpc_types_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Status_Detail.ProtoReflect.Descriptor instead. +func (*Status_Detail) Descriptor() ([]byte, []int) { + return file_v2_status_grpc_types_proto_rawDescGZIP(), []int{0, 0} +} + +func (x *Status_Detail) GetId() uint32 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *Status_Detail) GetValue() []byte { + if x != nil { + return x.Value + } + return nil +} + +var File_v2_status_grpc_types_proto protoreflect.FileDescriptor + +var file_v2_status_grpc_types_proto_rawDesc = []byte{ + 0x0a, 0x1a, 0x76, 0x32, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, + 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x10, 0x6e, 0x65, + 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0xa1, + 0x01, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, + 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x18, 0x0a, + 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, + 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x39, 0x0a, 0x07, 0x64, 0x65, 0x74, 0x61, 0x69, + 0x6c, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x53, 0x74, 0x61, 0x74, + 0x75, 0x73, 0x2e, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x07, 0x64, 0x65, 0x74, 0x61, 0x69, + 0x6c, 0x73, 0x1a, 0x2e, 0x0a, 0x06, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x12, 0x0e, 0x0a, 0x02, + 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x02, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x2a, 0x3a, 0x0a, 0x07, 0x53, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x13, 0x0a, + 0x0f, 0x53, 0x45, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x53, 0x55, 0x43, 0x43, 0x45, 0x53, 0x53, + 0x10, 0x00, 0x12, 0x1a, 0x0a, 0x16, 0x53, 0x45, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x46, 0x41, + 0x49, 0x4c, 0x55, 0x52, 0x45, 0x5f, 0x43, 0x4f, 0x4d, 0x4d, 0x4f, 0x4e, 0x10, 0x01, 0x2a, 0x11, + 0x0a, 0x07, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x06, 0x0a, 0x02, 0x4f, 0x4b, 0x10, + 0x00, 0x2a, 0x1a, 0x0a, 0x0a, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x46, 0x61, 0x69, 0x6c, 0x12, + 0x0c, 0x0a, 0x08, 0x49, 0x4e, 0x54, 0x45, 0x52, 0x4e, 0x41, 0x4c, 0x10, 0x00, 0x42, 0x56, 0x5a, + 0x37, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, + 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, + 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2f, 0x67, 0x72, 0x70, + 0x63, 0x3b, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0xaa, 0x02, 0x1a, 0x4e, 0x65, 0x6f, 0x2e, 0x46, + 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x53, + 0x74, 0x61, 0x74, 0x75, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_v2_status_grpc_types_proto_rawDescOnce sync.Once + file_v2_status_grpc_types_proto_rawDescData = file_v2_status_grpc_types_proto_rawDesc +) + +func file_v2_status_grpc_types_proto_rawDescGZIP() []byte { + file_v2_status_grpc_types_proto_rawDescOnce.Do(func() { + file_v2_status_grpc_types_proto_rawDescData = protoimpl.X.CompressGZIP(file_v2_status_grpc_types_proto_rawDescData) + }) + return file_v2_status_grpc_types_proto_rawDescData +} + +var file_v2_status_grpc_types_proto_enumTypes = make([]protoimpl.EnumInfo, 3) +var file_v2_status_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_v2_status_grpc_types_proto_goTypes = []interface{}{ + (Section)(0), // 0: neo.fs.v2.status.Section + (Success)(0), // 1: neo.fs.v2.status.Success + (CommonFail)(0), // 2: neo.fs.v2.status.CommonFail + (*Status)(nil), // 3: neo.fs.v2.status.Status + (*Status_Detail)(nil), // 4: neo.fs.v2.status.Status.Detail +} +var file_v2_status_grpc_types_proto_depIdxs = []int32{ + 4, // 0: neo.fs.v2.status.Status.details:type_name -> neo.fs.v2.status.Status.Detail + 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_v2_status_grpc_types_proto_init() } +func file_v2_status_grpc_types_proto_init() { + if File_v2_status_grpc_types_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_v2_status_grpc_types_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Status); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v2_status_grpc_types_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Status_Detail); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_v2_status_grpc_types_proto_rawDesc, + NumEnums: 3, + NumMessages: 2, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_v2_status_grpc_types_proto_goTypes, + DependencyIndexes: file_v2_status_grpc_types_proto_depIdxs, + EnumInfos: file_v2_status_grpc_types_proto_enumTypes, + MessageInfos: file_v2_status_grpc_types_proto_msgTypes, + }.Build() + File_v2_status_grpc_types_proto = out.File + file_v2_status_grpc_types_proto_rawDesc = nil + file_v2_status_grpc_types_proto_goTypes = nil + file_v2_status_grpc_types_proto_depIdxs = nil +} From 356b58a52c8ab1f3d50e780a22b6e3c78c5b5073 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 4 Oct 2021 15:37:36 +0300 Subject: [PATCH 0917/1196] [#350] v2/status/grpc: Implement field setters Signed-off-by: Leonard Lyubich --- v2/status/grpc/types.go | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 v2/status/grpc/types.go diff --git a/v2/status/grpc/types.go b/v2/status/grpc/types.go new file mode 100644 index 0000000..eea2c82 --- /dev/null +++ b/v2/status/grpc/types.go @@ -0,0 +1,36 @@ +package status + +// SetId sets identifier of the Status_Detail. +func (x *Status_Detail) SetId(v uint32) { + if x != nil { + x.Id = v + } +} + +// SetValue sets value of the Status_Detail. +func (x *Status_Detail) SetValue(v []byte) { + if x != nil { + x.Value = v + } +} + +// SetCode sets code of the Status. +func (x *Status) SetCode(v uint32) { + if x != nil { + x.Code = v + } +} + +// SetMessage sets message about the Status. +func (x *Status) SetMessage(v string) { + if x != nil { + x.Message = v + } +} + +// SetDetails sets details of the Status. +func (x *Status) SetDetails(v []*Status_Detail) { + if x != nil { + x.Details = v + } +} From ca746f38002a6326bd166ded62b412f9ff5d1af1 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Sat, 6 Nov 2021 13:38:52 +0300 Subject: [PATCH 0918/1196] [#350] v2: Define response status messages Create `status` package. Define `status.Status` message structure. Export getters, setters and encoding methods. Signed-off-by: Leonard Lyubich --- v2/status/convert.go | 103 +++++++++++++++++++++++++++++++++ v2/status/marshal.go | 115 +++++++++++++++++++++++++++++++++++++ v2/status/message_test.go | 16 ++++++ v2/status/status.go | 80 ++++++++++++++++++++++++++ v2/status/test/generate.go | 44 ++++++++++++++ v2/status/types.go | 114 ++++++++++++++++++++++++++++++++++++ 6 files changed, 472 insertions(+) create mode 100644 v2/status/convert.go create mode 100644 v2/status/marshal.go create mode 100644 v2/status/message_test.go create mode 100644 v2/status/status.go create mode 100644 v2/status/test/generate.go create mode 100644 v2/status/types.go diff --git a/v2/status/convert.go b/v2/status/convert.go new file mode 100644 index 0000000..5c05221 --- /dev/null +++ b/v2/status/convert.go @@ -0,0 +1,103 @@ +package status + +import ( + "github.com/nspcc-dev/neofs-api-go/rpc/grpc" + "github.com/nspcc-dev/neofs-api-go/rpc/message" + status "github.com/nspcc-dev/neofs-api-go/v2/status/grpc" +) + +func (x *Detail) ToGRPCMessage() grpc.Message { + var m *status.Status_Detail + + if x != nil { + m = new(status.Status_Detail) + + m.SetId(x.id) + m.SetValue(x.val) + } + + return m +} + +func (x *Detail) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*status.Status_Detail) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + x.id = v.GetId() + x.val = v.GetValue() + + return nil +} + +func CodeFromGRPC(v uint32) Code { + return Code(v) +} + +func CodeToGRPC(v Code) uint32 { + return uint32(v) +} + +func (x *Status) ToGRPCMessage() grpc.Message { + var m *status.Status + + if x != nil { + m = new(status.Status) + + m.SetCode(CodeToGRPC(x.code)) + m.SetMessage(x.msg) + + var ds []*status.Status_Detail + + if ln := len(x.details); ln > 0 { + ds = make([]*status.Status_Detail, 0, ln) + + for i := 0; i < ln; i++ { + ds = append(ds, x.details[i].ToGRPCMessage().(*status.Status_Detail)) + } + } + + m.SetDetails(ds) + } + + return m +} + +func (x *Status) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*status.Status) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var ( + ds []*Detail + dsV2 = v.GetDetails() + ) + + if dsV2 != nil { + ln := len(dsV2) + + ds = make([]*Detail, 0, ln) + + for i := 0; i < ln; i++ { + var p *Detail + + if dsV2[i] != nil { + p = new(Detail) + + if err := p.FromGRPCMessage(dsV2[i]); err != nil { + return err + } + } + + ds = append(ds, p) + } + } + + x.details = ds + x.msg = v.GetMessage() + x.code = CodeFromGRPC(v.GetCode()) + + return nil +} diff --git a/v2/status/marshal.go b/v2/status/marshal.go new file mode 100644 index 0000000..8170325 --- /dev/null +++ b/v2/status/marshal.go @@ -0,0 +1,115 @@ +package status + +import ( + "github.com/nspcc-dev/neofs-api-go/rpc/message" + protoutil "github.com/nspcc-dev/neofs-api-go/util/proto" + status "github.com/nspcc-dev/neofs-api-go/v2/status/grpc" +) + +const ( + _ = iota + detailIDFNum + detailValueFNum +) + +func (x *Detail) StableMarshal(buf []byte) ([]byte, error) { + if x == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, x.StableSize()) + } + + var ( + offset, n int + err error + ) + + n, err = protoutil.UInt32Marshal(detailIDFNum, buf[offset:], x.id) + if err != nil { + return nil, err + } + + offset += n + + _, err = protoutil.BytesMarshal(detailValueFNum, buf[offset:], x.val) + if err != nil { + return nil, err + } + + return buf, nil +} + +func (x *Detail) StableSize() (size int) { + size += protoutil.UInt32Size(detailIDFNum, x.id) + size += protoutil.BytesSize(detailValueFNum, x.val) + + return size +} + +func (x *Detail) Unmarshal(data []byte) error { + return message.Unmarshal(x, data, new(status.Status_Detail)) +} + +const ( + _ = iota + statusCodeFNum + statusMsgFNum + statusDetailsFNum +) + +func (x *Status) StableMarshal(buf []byte) ([]byte, error) { + if x == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, x.StableSize()) + } + + var ( + offset, n int + err error + ) + + n, err = protoutil.UInt32Marshal(statusCodeFNum, buf[offset:], CodeToGRPC(x.code)) + if err != nil { + return nil, err + } + + offset += n + + n, err = protoutil.StringMarshal(statusMsgFNum, buf[offset:], x.msg) + if err != nil { + return nil, err + } + + offset += n + + for i := range x.details { + n, err = protoutil.NestedStructureMarshal(statusDetailsFNum, buf[offset:], x.details[i]) + if err != nil { + return nil, err + } + + offset += n + } + + return buf, nil +} + +func (x *Status) StableSize() (size int) { + size += protoutil.UInt32Size(statusCodeFNum, CodeToGRPC(x.code)) + size += protoutil.StringSize(statusMsgFNum, x.msg) + + for i := range x.details { + size += protoutil.NestedStructureSize(statusDetailsFNum, x.details[i]) + } + + return size +} + +func (x *Status) Unmarshal(data []byte) error { + return message.Unmarshal(x, data, new(status.Status)) +} diff --git a/v2/status/message_test.go b/v2/status/message_test.go new file mode 100644 index 0000000..c301162 --- /dev/null +++ b/v2/status/message_test.go @@ -0,0 +1,16 @@ +package status_test + +import ( + "testing" + + "github.com/nspcc-dev/neofs-api-go/rpc/message" + messagetest "github.com/nspcc-dev/neofs-api-go/rpc/message/test" + statustest "github.com/nspcc-dev/neofs-api-go/v2/status/test" +) + +func TestMessageConvert(t *testing.T) { + messagetest.TestRPCMessage(t, + func(empty bool) message.Message { return statustest.Detail(empty) }, + func(empty bool) message.Message { return statustest.Status(empty) }, + ) +} diff --git a/v2/status/status.go b/v2/status/status.go new file mode 100644 index 0000000..d24ce57 --- /dev/null +++ b/v2/status/status.go @@ -0,0 +1,80 @@ +package status + +const sectionBitSize = 10 + +// InSections checks if the Code is in [i,j] section list. +func (x Code) InSections(i, j uint32) bool { + return uint32(x) >= i< Date: Sat, 6 Nov 2021 13:40:15 +0300 Subject: [PATCH 0919/1196] [#350] v2/session: Support `status` field in `ResponseMetaHeader` Signed-off-by: Leonard Lyubich --- v2/session/convert.go | 17 +++++++++++++++++ v2/session/grpc/types.go | 8 ++++++++ v2/session/marshal.go | 11 ++++++++++- v2/session/test/generate.go | 2 ++ v2/session/types.go | 36 ++++++++++++++++++++++++++++++++++++ 5 files changed, 73 insertions(+), 1 deletion(-) diff --git a/v2/session/convert.go b/v2/session/convert.go index 42101d3..8015832 100644 --- a/v2/session/convert.go +++ b/v2/session/convert.go @@ -10,6 +10,8 @@ import ( "github.com/nspcc-dev/neofs-api-go/v2/refs" refsGRPC "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" session "github.com/nspcc-dev/neofs-api-go/v2/session/grpc" + "github.com/nspcc-dev/neofs-api-go/v2/status" + statusGRPC "github.com/nspcc-dev/neofs-api-go/v2/status/grpc" ) func (c *CreateRequestBody) ToGRPCMessage() grpc.Message { @@ -560,6 +562,7 @@ func (r *ResponseMetaHeader) ToGRPCMessage() grpc.Message { m.SetEpoch(r.epoch) m.SetTtl(r.ttl) m.SetOrigin(r.origin.ToGRPCMessage().(*session.ResponseMetaHeader)) + m.SetStatus(r.status.ToGRPCMessage().(*statusGRPC.Status)) } return m @@ -601,6 +604,20 @@ func (r *ResponseMetaHeader) FromGRPCMessage(m grpc.Message) error { } } + st := v.GetStatus() + if st == nil { + r.status = nil + } else { + if r.status == nil { + r.status = new(status.Status) + } + + err = r.status.FromGRPCMessage(st) + if err != nil { + return err + } + } + r.xHeaders, err = XHeadersFromGRPC(v.GetXHeaders()) if err != nil { return err diff --git a/v2/session/grpc/types.go b/v2/session/grpc/types.go index cee4638..07d5d13 100644 --- a/v2/session/grpc/types.go +++ b/v2/session/grpc/types.go @@ -3,6 +3,7 @@ package session import ( acl "github.com/nspcc-dev/neofs-api-go/v2/acl/grpc" refs "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" + status "github.com/nspcc-dev/neofs-api-go/v2/status/grpc" ) // SetKey sets key to the X-Header. @@ -219,6 +220,13 @@ func (m *ResponseMetaHeader) SetOrigin(v *ResponseMetaHeader) { } } +// SetStatus sets response status. +func (m *ResponseMetaHeader) SetStatus(v *status.Status) { + if m != nil { + m.Status = v + } +} + // SetBodySignature sets signature of the request body. func (m *RequestVerificationHeader) SetBodySignature(v *refs.Signature) { if m != nil { diff --git a/v2/session/marshal.go b/v2/session/marshal.go index 05085d7..7ffe5e0 100644 --- a/v2/session/marshal.go +++ b/v2/session/marshal.go @@ -52,6 +52,7 @@ const ( respMetaHeaderTTLField = 3 respMetaHeaderXHeadersField = 4 respMetaHeaderOriginField = 5 + respMetaHeaderStatusField = 6 respVerifHeaderBodySignatureField = 1 respVerifHeaderMetaSignatureField = 2 @@ -712,7 +713,14 @@ func (r *ResponseMetaHeader) StableMarshal(buf []byte) ([]byte, error) { offset += n } - _, err = proto.NestedStructureMarshal(respMetaHeaderOriginField, buf[offset:], r.origin) + n, err = proto.NestedStructureMarshal(respMetaHeaderOriginField, buf[offset:], r.origin) + if err != nil { + return nil, err + } + + offset += n + + _, err = proto.NestedStructureMarshal(respMetaHeaderStatusField, buf[offset:], r.status) if err != nil { return nil, err } @@ -737,6 +745,7 @@ func (r *ResponseMetaHeader) StableSize() (size int) { } size += proto.NestedStructureSize(respMetaHeaderOriginField, r.origin) + size += proto.NestedStructureSize(respMetaHeaderStatusField, r.status) return size } diff --git a/v2/session/test/generate.go b/v2/session/test/generate.go index 4aec4a4..8473d80 100644 --- a/v2/session/test/generate.go +++ b/v2/session/test/generate.go @@ -4,6 +4,7 @@ import ( acltest "github.com/nspcc-dev/neofs-api-go/v2/acl/test" refstest "github.com/nspcc-dev/neofs-api-go/v2/refs/test" "github.com/nspcc-dev/neofs-api-go/v2/session" + statustest "github.com/nspcc-dev/neofs-api-go/v2/status/test" ) func GenerateCreateRequestBody(empty bool) *session.CreateRequestBody { @@ -89,6 +90,7 @@ func generateResponseMetaHeader(empty, withOrigin bool) *session.ResponseMetaHea m.SetXHeaders(GenerateXHeaders(empty)) m.SetVersion(refstest.GenerateVersion(empty)) + m.SetStatus(statustest.Status(empty)) if withOrigin { m.SetOrigin(generateResponseMetaHeader(empty, false)) diff --git a/v2/session/types.go b/v2/session/types.go index 8d092a2..8a97817 100644 --- a/v2/session/types.go +++ b/v2/session/types.go @@ -3,6 +3,7 @@ package session import ( "github.com/nspcc-dev/neofs-api-go/v2/acl" "github.com/nspcc-dev/neofs-api-go/v2/refs" + "github.com/nspcc-dev/neofs-api-go/v2/status" ) type CreateRequestBody struct { @@ -105,6 +106,8 @@ type ResponseMetaHeader struct { xHeaders []*XHeader origin *ResponseMetaHeader + + status *status.Status } const ( @@ -608,6 +611,39 @@ func (r *ResponseMetaHeader) SetOrigin(v *ResponseMetaHeader) { } } +// GetStatus returns response status. +func (r *ResponseMetaHeader) GetStatus() *status.Status { + if r != nil { + return r.status + } + + return nil +} + +// SetStatus sets response status. +func (r *ResponseMetaHeader) SetStatus(v *status.Status) { + if r != nil { + r.status = v + } +} + +// SetStatus sets status of the message which can carry ResponseMetaHeader. +// +// Sets status field on the "highest" level of meta headers. +// If meta header is missing in message, it is allocated. +func SetStatus(msg interface { + GetMetaHeader() *ResponseMetaHeader + SetMetaHeader(*ResponseMetaHeader) +}, st *status.Status) { + meta := msg.GetMetaHeader() + if meta == nil { + meta = new(ResponseMetaHeader) + msg.SetMetaHeader(meta) + } + + meta.SetStatus(st) +} + func (c *ObjectSessionContext) sessionTokenContext() {} func (c *ObjectSessionContext) GetVerb() ObjectSessionVerb { From 25da5d2e13bbbff56cbf13cb8c498abd06b12bef Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 16 Nov 2021 20:30:55 +0300 Subject: [PATCH 0920/1196] Add `v2` version to go module name Replace all elements from `v2` to root directory. Signed-off-by: Leonard Lyubich --- {v2/accounting => accounting}/accounting.go | 0 {v2/accounting => accounting}/convert.go | 4 +- {v2/accounting => accounting}/grpc/service.go | 0 .../grpc/service.pb.go | 0 .../grpc/service_grpc.pb.go | 0 {v2/accounting => accounting}/grpc/types.go | 0 .../grpc/types.pb.go | 0 {v2/accounting => accounting}/json.go | 2 +- {v2/accounting => accounting}/marshal.go | 4 +- {v2/accounting => accounting}/message_test.go | 4 +- .../test/generate.go | 0 {v2/acl => acl}/convert.go | 4 +- {v2/acl => acl}/filters.go | 0 {v2/acl => acl}/grpc/types.go | 0 {v2/acl => acl}/grpc/types.pb.go | 0 {v2/acl => acl}/json.go | 2 +- {v2/acl => acl}/marshal.go | 4 +- {v2/acl => acl}/message_test.go | 4 +- {v2/acl => acl}/string.go | 0 {v2/acl => acl}/test/generate.go | 0 {v2/acl => acl}/types.go | 0 {v2/audit => audit}/convert.go | 4 +- {v2/audit => audit}/grpc/types.go | 0 {v2/audit => audit}/grpc/types.pb.go | 0 {v2/audit => audit}/json.go | 2 +- {v2/audit => audit}/marshal.go | 4 +- {v2/audit => audit}/message_test.go | 4 +- {v2/audit => audit}/test/generate.go | 0 {v2/audit => audit}/types.go | 0 {v2/container => container}/attributes.go | 0 {v2/container => container}/convert.go | 4 +- {v2/container => container}/grpc/service.go | 0 .../grpc/service.pb.go | 0 .../grpc/service_grpc.pb.go | 0 {v2/container => container}/grpc/types.go | 0 {v2/container => container}/grpc/types.pb.go | 0 {v2/container => container}/json.go | 2 +- {v2/container => container}/marshal.go | 4 +- {v2/container => container}/message_test.go | 4 +- {v2/container => container}/test/generate.go | 0 {v2/container => container}/types.go | 0 go.mod | 10 +- go.sum | 230 +-- {v2/netmap => netmap}/convert.go | 4 +- {v2/netmap => netmap}/grpc/service.go | 0 {v2/netmap => netmap}/grpc/service.pb.go | 0 {v2/netmap => netmap}/grpc/service_grpc.pb.go | 0 {v2/netmap => netmap}/grpc/types.go | 0 {v2/netmap => netmap}/grpc/types.pb.go | 0 {v2/netmap => netmap}/json.go | 2 +- {v2/netmap => netmap}/marshal.go | 4 +- {v2/netmap => netmap}/message_test.go | 4 +- {v2/netmap => netmap}/string.go | 0 {v2/netmap => netmap}/test/generate.go | 0 {v2/netmap => netmap}/types.go | 0 {v2/object => object}/attributes.go | 0 {v2/object => object}/convert.go | 4 +- {v2/object => object}/filters.go | 0 {v2/object => object}/grpc/client.go | 0 {v2/object => object}/grpc/service.go | 0 {v2/object => object}/grpc/service.pb.go | 0 {v2/object => object}/grpc/service_grpc.pb.go | 0 {v2/object => object}/grpc/types.go | 0 {v2/object => object}/grpc/types.pb.go | 0 {v2/object => object}/json.go | 2 +- {v2/object => object}/marshal.go | 4 +- {v2/object => object}/message_test.go | 4 +- {v2/object => object}/string.go | 0 {v2/object => object}/test/generate.go | 0 {v2/object => object}/types.go | 0 pkg/.gitkeep | 0 pkg/accounting/decimal.go | 74 - pkg/accounting/decimal_test.go | 51 - pkg/accounting/test/decimal.go | 14 - pkg/acl/eacl/enums.go | 396 ----- pkg/acl/eacl/enums_test.go | 214 --- pkg/acl/eacl/filter.go | 186 --- pkg/acl/eacl/filter_test.go | 88 -- pkg/acl/eacl/record.go | 284 ---- pkg/acl/eacl/record_test.go | 250 --- pkg/acl/eacl/table.go | 210 --- pkg/acl/eacl/table_test.go | 138 -- pkg/acl/eacl/target.go | 191 --- pkg/acl/eacl/target_test.go | 86 -- pkg/acl/eacl/test/generate.go | 45 - pkg/acl/types.go | 15 - pkg/audit/result.go | 330 ---- pkg/audit/result_test.go | 154 -- pkg/audit/test/generate.go | 37 - pkg/checksum.go | 198 --- pkg/checksum_test.go | 175 --- pkg/client/accounting.go | 57 - pkg/client/client.go | 47 - pkg/client/container.go | 477 ------ pkg/client/netmap.go | 124 -- pkg/client/object.go | 1373 ----------------- pkg/client/object_test.go | 95 -- pkg/client/opts.go | 189 --- pkg/client/raw.go | 21 - pkg/client/reputation.go | 171 -- pkg/client/response.go | 37 - pkg/client/session.go | 79 - pkg/container/announcement.go | 87 -- pkg/container/announcement_test.go | 99 -- pkg/container/attribute.go | 137 -- pkg/container/attribute_test.go | 155 -- pkg/container/container.go | 231 --- pkg/container/container_test.go | 134 -- pkg/container/id.go | 22 - pkg/container/id/id.go | 102 -- pkg/container/id/id_test.go | 105 -- pkg/container/id/test/id.go | 26 - pkg/container/opts.go | 104 -- pkg/container/test/generate.go | 48 - pkg/container/wellknown_attributes.go | 11 - pkg/netmap/aggregator.go | 223 --- pkg/netmap/clause.go | 69 - pkg/netmap/clause_test.go | 43 - pkg/netmap/container.go | 19 - pkg/netmap/context.go | 94 -- pkg/netmap/doc.go | 11 - pkg/netmap/filter.go | 295 ---- pkg/netmap/filter_test.go | 331 ---- pkg/netmap/helper_test.go | 93 -- pkg/netmap/netmap.go | 100 -- pkg/netmap/network_info.go | 225 --- pkg/netmap/network_info_test.go | 215 --- pkg/netmap/node_info.go | 461 ------ pkg/netmap/node_info_test.go | 263 ---- pkg/netmap/operation.go | 116 -- pkg/netmap/operation_test.go | 73 - pkg/netmap/policy.go | 159 -- pkg/netmap/policy_test.go | 180 --- pkg/netmap/replica.go | 87 -- pkg/netmap/replica_test.go | 99 -- pkg/netmap/selector.go | 275 ---- pkg/netmap/selector_test.go | 531 ------- pkg/netmap/test/generate.go | 147 -- pkg/object/address.go | 131 -- pkg/object/address_test.go | 119 -- pkg/object/attribute.go | 85 - pkg/object/attribute_test.go | 82 - pkg/object/error.go | 19 - pkg/object/error_test.go | 33 - pkg/object/fmt.go | 176 --- pkg/object/fmt_test.go | 79 - pkg/object/id.go | 104 -- pkg/object/id_test.go | 142 -- pkg/object/object.go | 45 - pkg/object/range.go | 55 - pkg/object/range_test.go | 58 - pkg/object/raw.go | 160 -- pkg/object/raw_test.go | 317 ---- pkg/object/rw.go | 403 ----- pkg/object/search.go | 309 ---- pkg/object/search_test.go | 208 --- pkg/object/splitid.go | 80 - pkg/object/splitid_test.go | 63 - pkg/object/splitinfo.go | 74 - pkg/object/splitinfo_test.go | 88 -- pkg/object/test/generate.go | 141 -- pkg/object/tombstone.go | 132 -- pkg/object/tombstone_test.go | 92 -- pkg/object/type.go | 69 - pkg/object/type_test.go | 79 - pkg/object/wellknown_attributes.go | 19 - pkg/owner/id.go | 122 -- pkg/owner/id_test.go | 137 -- pkg/owner/test/id.go | 27 - pkg/owner/wallet.go | 57 - pkg/reputation/peer.go | 100 -- pkg/reputation/peer_test.go | 88 -- pkg/reputation/test/generate.go | 53 - pkg/reputation/trust.go | 357 ----- pkg/reputation/trust_test.go | 250 --- pkg/session/container.go | 139 -- pkg/session/container_test.go | 112 -- pkg/session/session.go | 282 ---- pkg/session/session_test.go | 202 --- pkg/session/test/container.go | 26 - pkg/session/test/token.go | 54 - pkg/signature.go | 85 - pkg/signature_test.go | 66 - pkg/storagegroup/storagegroup.go | 157 -- pkg/storagegroup/storagegroup_test.go | 93 -- pkg/storagegroup/test/generate.go | 20 - pkg/test/generate.go | 51 - pkg/token/bearer.go | 188 --- pkg/token/bearer_test.go | 82 - pkg/token/session.go | 22 - pkg/token/test/generate.go | 35 - pkg/version.go | 107 -- pkg/version_test.go | 90 -- pkg/xheader.go | 55 - pkg/xheader_test.go | 58 - {v2/refs => refs}/convert.go | 4 +- {v2/refs => refs}/grpc/types.go | 0 {v2/refs => refs}/grpc/types.pb.go | 0 {v2/refs => refs}/json.go | 2 +- {v2/refs => refs}/marshal.go | 4 +- {v2/refs => refs}/message_test.go | 4 +- {v2/refs => refs}/string.go | 0 {v2/refs => refs}/test/generate.go | 0 {v2/refs => refs}/types.go | 0 {v2/reputation => reputation}/convert.go | 4 +- {v2/reputation => reputation}/grpc/service.go | 0 .../grpc/service.pb.go | 0 .../grpc/service_grpc.pb.go | 0 {v2/reputation => reputation}/grpc/types.go | 0 .../grpc/types.pb.go | 0 {v2/reputation => reputation}/json.go | 2 +- {v2/reputation => reputation}/marshal.go | 4 +- {v2/reputation => reputation}/message_test.go | 4 +- .../test/generate.go | 0 {v2/reputation => reputation}/types.go | 0 {v2/rpc => rpc}/accounting.go | 4 +- rpc/client/call_options.go | 2 +- rpc/client/client.go | 2 +- rpc/client/connect.go | 2 +- rpc/client/flows.go | 4 +- rpc/client/init.go | 6 +- {v2/rpc => rpc}/common.go | 0 rpc/common/call_test.go | 2 +- {v2/rpc => rpc}/container.go | 4 +- rpc/grpc/init.go | 2 +- rpc/grpc/util.go | 2 +- rpc/message/encoding.go | 2 +- rpc/message/message.go | 2 +- rpc/message/test/message.go | 2 +- {v2/rpc => rpc}/netmap.go | 4 +- {v2/rpc => rpc}/object.go | 6 +- {v2/rpc => rpc}/reputation.go | 4 +- {v2/rpc => rpc}/session.go | 4 +- {v2/session => session}/convert.go | 4 +- {v2/session => session}/grpc/client.go | 0 {v2/session => session}/grpc/service.go | 0 {v2/session => session}/grpc/service.pb.go | 0 .../grpc/service_grpc.pb.go | 0 {v2/session => session}/grpc/types.go | 0 {v2/session => session}/grpc/types.pb.go | 0 {v2/session => session}/json.go | 2 +- {v2/session => session}/marshal.go | 4 +- {v2/session => session}/message_test.go | 4 +- {v2/session => session}/string.go | 0 {v2/session => session}/test/generate.go | 0 {v2/session => session}/types.go | 0 {v2/session => session}/util.go | 0 {v2/session => session}/xheaders.go | 0 {v2/signature => signature}/sign.go | 2 +- {v2/signature => signature}/sign_test.go | 0 {v2/storagegroup => storagegroup}/convert.go | 4 +- .../grpc/types.go | 0 .../grpc/types.pb.go | 0 {v2/storagegroup => storagegroup}/json.go | 2 +- {v2/storagegroup => storagegroup}/marshal.go | 4 +- .../message_test.go | 4 +- .../test/generate.go | 0 {v2/storagegroup => storagegroup}/types.go | 0 {v2/tombstone => tombstone}/convert.go | 4 +- {v2/tombstone => tombstone}/grpc/types.go | 0 {v2/tombstone => tombstone}/grpc/types.pb.go | 0 {v2/tombstone => tombstone}/json.go | 2 +- {v2/tombstone => tombstone}/marshal.go | 4 +- {v2/tombstone => tombstone}/message_test.go | 4 +- {v2/tombstone => tombstone}/test/generate.go | 0 {v2/tombstone => tombstone}/types.go | 0 util/proto/marshal_test.go | 4 +- 267 files changed, 116 insertions(+), 17991 deletions(-) rename {v2/accounting => accounting}/accounting.go (100%) rename {v2/accounting => accounting}/convert.go (96%) rename {v2/accounting => accounting}/grpc/service.go (100%) rename {v2/accounting => accounting}/grpc/service.pb.go (100%) rename {v2/accounting => accounting}/grpc/service_grpc.pb.go (100%) rename {v2/accounting => accounting}/grpc/types.go (100%) rename {v2/accounting => accounting}/grpc/types.pb.go (100%) rename {v2/accounting => accounting}/json.go (85%) rename {v2/accounting => accounting}/marshal.go (95%) rename {v2/accounting => accounting}/message_test.go (84%) rename {v2/accounting => accounting}/test/generate.go (100%) rename {v2/acl => acl}/convert.go (99%) rename {v2/acl => acl}/filters.go (100%) rename {v2/acl => acl}/grpc/types.go (100%) rename {v2/acl => acl}/grpc/types.pb.go (100%) rename {v2/acl => acl}/json.go (96%) rename {v2/acl => acl}/marshal.go (98%) rename {v2/acl => acl}/message_test.go (85%) rename {v2/acl => acl}/string.go (100%) rename {v2/acl => acl}/test/generate.go (100%) rename {v2/acl => acl}/types.go (100%) rename {v2/audit => audit}/convert.go (95%) rename {v2/audit => audit}/grpc/types.go (100%) rename {v2/audit => audit}/grpc/types.pb.go (100%) rename {v2/audit => audit}/json.go (85%) rename {v2/audit => audit}/marshal.go (97%) rename {v2/audit => audit}/message_test.go (68%) rename {v2/audit => audit}/test/generate.go (100%) rename {v2/audit => audit}/types.go (100%) rename {v2/container => container}/attributes.go (100%) rename {v2/container => container}/convert.go (99%) rename {v2/container => container}/grpc/service.go (100%) rename {v2/container => container}/grpc/service.pb.go (100%) rename {v2/container => container}/grpc/service_grpc.pb.go (100%) rename {v2/container => container}/grpc/types.go (100%) rename {v2/container => container}/grpc/types.pb.go (100%) rename {v2/container => container}/json.go (90%) rename {v2/container => container}/marshal.go (99%) rename {v2/container => container}/message_test.go (96%) rename {v2/container => container}/test/generate.go (100%) rename {v2/container => container}/types.go (100%) rename {v2/netmap => netmap}/convert.go (99%) rename {v2/netmap => netmap}/grpc/service.go (100%) rename {v2/netmap => netmap}/grpc/service.pb.go (100%) rename {v2/netmap => netmap}/grpc/service_grpc.pb.go (100%) rename {v2/netmap => netmap}/grpc/types.go (100%) rename {v2/netmap => netmap}/grpc/types.pb.go (100%) rename {v2/netmap => netmap}/json.go (96%) rename {v2/netmap => netmap}/marshal.go (99%) rename {v2/netmap => netmap}/message_test.go (91%) rename {v2/netmap => netmap}/string.go (100%) rename {v2/netmap => netmap}/test/generate.go (100%) rename {v2/netmap => netmap}/types.go (100%) rename {v2/object => object}/attributes.go (100%) rename {v2/object => object}/convert.go (99%) rename {v2/object => object}/filters.go (100%) rename {v2/object => object}/grpc/client.go (100%) rename {v2/object => object}/grpc/service.go (100%) rename {v2/object => object}/grpc/service.pb.go (100%) rename {v2/object => object}/grpc/service_grpc.pb.go (100%) rename {v2/object => object}/grpc/types.go (100%) rename {v2/object => object}/grpc/types.pb.go (100%) rename {v2/object => object}/json.go (97%) rename {v2/object => object}/marshal.go (99%) rename {v2/object => object}/message_test.go (96%) rename {v2/object => object}/string.go (100%) rename {v2/object => object}/test/generate.go (100%) rename {v2/object => object}/types.go (100%) delete mode 100644 pkg/.gitkeep delete mode 100644 pkg/accounting/decimal.go delete mode 100644 pkg/accounting/decimal_test.go delete mode 100644 pkg/accounting/test/decimal.go delete mode 100644 pkg/acl/eacl/enums.go delete mode 100644 pkg/acl/eacl/enums_test.go delete mode 100644 pkg/acl/eacl/filter.go delete mode 100644 pkg/acl/eacl/filter_test.go delete mode 100644 pkg/acl/eacl/record.go delete mode 100644 pkg/acl/eacl/record_test.go delete mode 100644 pkg/acl/eacl/table.go delete mode 100644 pkg/acl/eacl/table_test.go delete mode 100644 pkg/acl/eacl/target.go delete mode 100644 pkg/acl/eacl/target_test.go delete mode 100644 pkg/acl/eacl/test/generate.go delete mode 100644 pkg/acl/types.go delete mode 100644 pkg/audit/result.go delete mode 100644 pkg/audit/result_test.go delete mode 100644 pkg/audit/test/generate.go delete mode 100644 pkg/checksum.go delete mode 100644 pkg/checksum_test.go delete mode 100644 pkg/client/accounting.go delete mode 100644 pkg/client/client.go delete mode 100644 pkg/client/container.go delete mode 100644 pkg/client/netmap.go delete mode 100644 pkg/client/object.go delete mode 100644 pkg/client/object_test.go delete mode 100644 pkg/client/opts.go delete mode 100644 pkg/client/raw.go delete mode 100644 pkg/client/reputation.go delete mode 100644 pkg/client/response.go delete mode 100644 pkg/client/session.go delete mode 100644 pkg/container/announcement.go delete mode 100644 pkg/container/announcement_test.go delete mode 100644 pkg/container/attribute.go delete mode 100644 pkg/container/attribute_test.go delete mode 100644 pkg/container/container.go delete mode 100644 pkg/container/container_test.go delete mode 100644 pkg/container/id.go delete mode 100644 pkg/container/id/id.go delete mode 100644 pkg/container/id/id_test.go delete mode 100644 pkg/container/id/test/id.go delete mode 100644 pkg/container/opts.go delete mode 100644 pkg/container/test/generate.go delete mode 100644 pkg/container/wellknown_attributes.go delete mode 100644 pkg/netmap/aggregator.go delete mode 100644 pkg/netmap/clause.go delete mode 100644 pkg/netmap/clause_test.go delete mode 100644 pkg/netmap/container.go delete mode 100644 pkg/netmap/context.go delete mode 100644 pkg/netmap/doc.go delete mode 100644 pkg/netmap/filter.go delete mode 100644 pkg/netmap/filter_test.go delete mode 100644 pkg/netmap/helper_test.go delete mode 100644 pkg/netmap/netmap.go delete mode 100644 pkg/netmap/network_info.go delete mode 100644 pkg/netmap/network_info_test.go delete mode 100644 pkg/netmap/node_info.go delete mode 100644 pkg/netmap/node_info_test.go delete mode 100644 pkg/netmap/operation.go delete mode 100644 pkg/netmap/operation_test.go delete mode 100644 pkg/netmap/policy.go delete mode 100644 pkg/netmap/policy_test.go delete mode 100644 pkg/netmap/replica.go delete mode 100644 pkg/netmap/replica_test.go delete mode 100644 pkg/netmap/selector.go delete mode 100644 pkg/netmap/selector_test.go delete mode 100644 pkg/netmap/test/generate.go delete mode 100644 pkg/object/address.go delete mode 100644 pkg/object/address_test.go delete mode 100644 pkg/object/attribute.go delete mode 100644 pkg/object/attribute_test.go delete mode 100644 pkg/object/error.go delete mode 100644 pkg/object/error_test.go delete mode 100644 pkg/object/fmt.go delete mode 100644 pkg/object/fmt_test.go delete mode 100644 pkg/object/id.go delete mode 100644 pkg/object/id_test.go delete mode 100644 pkg/object/object.go delete mode 100644 pkg/object/range.go delete mode 100644 pkg/object/range_test.go delete mode 100644 pkg/object/raw.go delete mode 100644 pkg/object/raw_test.go delete mode 100644 pkg/object/rw.go delete mode 100644 pkg/object/search.go delete mode 100644 pkg/object/search_test.go delete mode 100644 pkg/object/splitid.go delete mode 100644 pkg/object/splitid_test.go delete mode 100644 pkg/object/splitinfo.go delete mode 100644 pkg/object/splitinfo_test.go delete mode 100644 pkg/object/test/generate.go delete mode 100644 pkg/object/tombstone.go delete mode 100644 pkg/object/tombstone_test.go delete mode 100644 pkg/object/type.go delete mode 100644 pkg/object/type_test.go delete mode 100644 pkg/object/wellknown_attributes.go delete mode 100644 pkg/owner/id.go delete mode 100644 pkg/owner/id_test.go delete mode 100644 pkg/owner/test/id.go delete mode 100644 pkg/owner/wallet.go delete mode 100644 pkg/reputation/peer.go delete mode 100644 pkg/reputation/peer_test.go delete mode 100644 pkg/reputation/test/generate.go delete mode 100644 pkg/reputation/trust.go delete mode 100644 pkg/reputation/trust_test.go delete mode 100644 pkg/session/container.go delete mode 100644 pkg/session/container_test.go delete mode 100644 pkg/session/session.go delete mode 100644 pkg/session/session_test.go delete mode 100644 pkg/session/test/container.go delete mode 100644 pkg/session/test/token.go delete mode 100644 pkg/signature.go delete mode 100644 pkg/signature_test.go delete mode 100644 pkg/storagegroup/storagegroup.go delete mode 100644 pkg/storagegroup/storagegroup_test.go delete mode 100644 pkg/storagegroup/test/generate.go delete mode 100644 pkg/test/generate.go delete mode 100644 pkg/token/bearer.go delete mode 100644 pkg/token/bearer_test.go delete mode 100644 pkg/token/session.go delete mode 100644 pkg/token/test/generate.go delete mode 100644 pkg/version.go delete mode 100644 pkg/version_test.go delete mode 100644 pkg/xheader.go delete mode 100644 pkg/xheader_test.go rename {v2/refs => refs}/convert.go (97%) rename {v2/refs => refs}/grpc/types.go (100%) rename {v2/refs => refs}/grpc/types.pb.go (100%) rename {v2/refs => refs}/json.go (96%) rename {v2/refs => refs}/marshal.go (98%) rename {v2/refs => refs}/message_test.go (85%) rename {v2/refs => refs}/string.go (100%) rename {v2/refs => refs}/test/generate.go (100%) rename {v2/refs => refs}/types.go (100%) rename {v2/reputation => reputation}/convert.go (99%) rename {v2/reputation => reputation}/grpc/service.go (100%) rename {v2/reputation => reputation}/grpc/service.pb.go (100%) rename {v2/reputation => reputation}/grpc/service_grpc.pb.go (100%) rename {v2/reputation => reputation}/grpc/types.go (100%) rename {v2/reputation => reputation}/grpc/types.pb.go (100%) rename {v2/reputation => reputation}/json.go (94%) rename {v2/reputation => reputation}/marshal.go (98%) rename {v2/reputation => reputation}/message_test.go (92%) rename {v2/reputation => reputation}/test/generate.go (100%) rename {v2/reputation => reputation}/types.go (100%) rename {v2/rpc => rpc}/accounting.go (85%) rename {v2/rpc => rpc}/common.go (100%) rename {v2/rpc => rpc}/container.go (96%) rename {v2/rpc => rpc}/netmap.go (91%) rename {v2/rpc => rpc}/object.go (96%) rename {v2/rpc => rpc}/reputation.go (92%) rename {v2/rpc => rpc}/session.go (83%) rename {v2/session => session}/convert.go (99%) rename {v2/session => session}/grpc/client.go (100%) rename {v2/session => session}/grpc/service.go (100%) rename {v2/session => session}/grpc/service.pb.go (100%) rename {v2/session => session}/grpc/service_grpc.pb.go (100%) rename {v2/session => session}/grpc/types.go (100%) rename {v2/session => session}/grpc/types.pb.go (100%) rename {v2/session => session}/json.go (98%) rename {v2/session => session}/marshal.go (99%) rename {v2/session => session}/message_test.go (92%) rename {v2/session => session}/string.go (100%) rename {v2/session => session}/test/generate.go (100%) rename {v2/session => session}/types.go (100%) rename {v2/session => session}/util.go (100%) rename {v2/session => session}/xheaders.go (100%) rename {v2/signature => signature}/sign.go (99%) rename {v2/signature => signature}/sign_test.go (100%) rename {v2/storagegroup => storagegroup}/convert.go (91%) rename {v2/storagegroup => storagegroup}/grpc/types.go (100%) rename {v2/storagegroup => storagegroup}/grpc/types.pb.go (100%) rename {v2/storagegroup => storagegroup}/json.go (86%) rename {v2/storagegroup => storagegroup}/marshal.go (93%) rename {v2/storagegroup => storagegroup}/message_test.go (70%) rename {v2/storagegroup => storagegroup}/test/generate.go (100%) rename {v2/storagegroup => storagegroup}/types.go (100%) rename {v2/tombstone => tombstone}/convert.go (88%) rename {v2/tombstone => tombstone}/grpc/types.go (100%) rename {v2/tombstone => tombstone}/grpc/types.pb.go (100%) rename {v2/tombstone => tombstone}/json.go (85%) rename {v2/tombstone => tombstone}/marshal.go (93%) rename {v2/tombstone => tombstone}/message_test.go (69%) rename {v2/tombstone => tombstone}/test/generate.go (100%) rename {v2/tombstone => tombstone}/types.go (100%) diff --git a/v2/accounting/accounting.go b/accounting/accounting.go similarity index 100% rename from v2/accounting/accounting.go rename to accounting/accounting.go diff --git a/v2/accounting/convert.go b/accounting/convert.go similarity index 96% rename from v2/accounting/convert.go rename to accounting/convert.go index 2a842f8..1d32210 100644 --- a/v2/accounting/convert.go +++ b/accounting/convert.go @@ -1,11 +1,11 @@ package accounting import ( - "github.com/nspcc-dev/neofs-api-go/rpc/grpc" - "github.com/nspcc-dev/neofs-api-go/rpc/message" accounting "github.com/nspcc-dev/neofs-api-go/v2/accounting/grpc" "github.com/nspcc-dev/neofs-api-go/v2/refs" refsGRPC "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" + "github.com/nspcc-dev/neofs-api-go/v2/rpc/grpc" + "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" ) func (b *BalanceRequestBody) ToGRPCMessage() grpc.Message { diff --git a/v2/accounting/grpc/service.go b/accounting/grpc/service.go similarity index 100% rename from v2/accounting/grpc/service.go rename to accounting/grpc/service.go diff --git a/v2/accounting/grpc/service.pb.go b/accounting/grpc/service.pb.go similarity index 100% rename from v2/accounting/grpc/service.pb.go rename to accounting/grpc/service.pb.go diff --git a/v2/accounting/grpc/service_grpc.pb.go b/accounting/grpc/service_grpc.pb.go similarity index 100% rename from v2/accounting/grpc/service_grpc.pb.go rename to accounting/grpc/service_grpc.pb.go diff --git a/v2/accounting/grpc/types.go b/accounting/grpc/types.go similarity index 100% rename from v2/accounting/grpc/types.go rename to accounting/grpc/types.go diff --git a/v2/accounting/grpc/types.pb.go b/accounting/grpc/types.pb.go similarity index 100% rename from v2/accounting/grpc/types.pb.go rename to accounting/grpc/types.pb.go diff --git a/v2/accounting/json.go b/accounting/json.go similarity index 85% rename from v2/accounting/json.go rename to accounting/json.go index 6229885..5b4378e 100644 --- a/v2/accounting/json.go +++ b/accounting/json.go @@ -1,8 +1,8 @@ package accounting import ( - "github.com/nspcc-dev/neofs-api-go/rpc/message" accounting "github.com/nspcc-dev/neofs-api-go/v2/accounting/grpc" + "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" ) func (d *Decimal) MarshalJSON() ([]byte, error) { diff --git a/v2/accounting/marshal.go b/accounting/marshal.go similarity index 95% rename from v2/accounting/marshal.go rename to accounting/marshal.go index 11ae796..8c2e06f 100644 --- a/v2/accounting/marshal.go +++ b/accounting/marshal.go @@ -1,9 +1,9 @@ package accounting import ( - "github.com/nspcc-dev/neofs-api-go/rpc/message" - protoutil "github.com/nspcc-dev/neofs-api-go/util/proto" accounting "github.com/nspcc-dev/neofs-api-go/v2/accounting/grpc" + "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" + protoutil "github.com/nspcc-dev/neofs-api-go/v2/util/proto" ) const ( diff --git a/v2/accounting/message_test.go b/accounting/message_test.go similarity index 84% rename from v2/accounting/message_test.go rename to accounting/message_test.go index baf71fa..16e6d30 100644 --- a/v2/accounting/message_test.go +++ b/accounting/message_test.go @@ -3,9 +3,9 @@ package accounting_test import ( "testing" - "github.com/nspcc-dev/neofs-api-go/rpc/message" - messagetest "github.com/nspcc-dev/neofs-api-go/rpc/message/test" accountingtest "github.com/nspcc-dev/neofs-api-go/v2/accounting/test" + "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" + messagetest "github.com/nspcc-dev/neofs-api-go/v2/rpc/message/test" ) func TestMessage(t *testing.T) { diff --git a/v2/accounting/test/generate.go b/accounting/test/generate.go similarity index 100% rename from v2/accounting/test/generate.go rename to accounting/test/generate.go diff --git a/v2/acl/convert.go b/acl/convert.go similarity index 99% rename from v2/acl/convert.go rename to acl/convert.go index d501b56..55b333a 100644 --- a/v2/acl/convert.go +++ b/acl/convert.go @@ -1,11 +1,11 @@ package acl import ( - "github.com/nspcc-dev/neofs-api-go/rpc/grpc" - "github.com/nspcc-dev/neofs-api-go/rpc/message" acl "github.com/nspcc-dev/neofs-api-go/v2/acl/grpc" "github.com/nspcc-dev/neofs-api-go/v2/refs" refsGRPC "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" + "github.com/nspcc-dev/neofs-api-go/v2/rpc/grpc" + "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" ) // RoleToGRPCField converts unified role enum into grpc enum. diff --git a/v2/acl/filters.go b/acl/filters.go similarity index 100% rename from v2/acl/filters.go rename to acl/filters.go diff --git a/v2/acl/grpc/types.go b/acl/grpc/types.go similarity index 100% rename from v2/acl/grpc/types.go rename to acl/grpc/types.go diff --git a/v2/acl/grpc/types.pb.go b/acl/grpc/types.pb.go similarity index 100% rename from v2/acl/grpc/types.pb.go rename to acl/grpc/types.pb.go diff --git a/v2/acl/json.go b/acl/json.go similarity index 96% rename from v2/acl/json.go rename to acl/json.go index 1a3cacd..8144954 100644 --- a/v2/acl/json.go +++ b/acl/json.go @@ -1,8 +1,8 @@ package acl import ( - "github.com/nspcc-dev/neofs-api-go/rpc/message" acl "github.com/nspcc-dev/neofs-api-go/v2/acl/grpc" + "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" ) func (f *HeaderFilter) MarshalJSON() ([]byte, error) { diff --git a/v2/acl/marshal.go b/acl/marshal.go similarity index 98% rename from v2/acl/marshal.go rename to acl/marshal.go index 15a317d..cfa4470 100644 --- a/v2/acl/marshal.go +++ b/acl/marshal.go @@ -1,9 +1,9 @@ package acl import ( - "github.com/nspcc-dev/neofs-api-go/rpc/message" - protoutil "github.com/nspcc-dev/neofs-api-go/util/proto" acl "github.com/nspcc-dev/neofs-api-go/v2/acl/grpc" + "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" + protoutil "github.com/nspcc-dev/neofs-api-go/v2/util/proto" ) const ( diff --git a/v2/acl/message_test.go b/acl/message_test.go similarity index 85% rename from v2/acl/message_test.go rename to acl/message_test.go index bb6d991..ac1b369 100644 --- a/v2/acl/message_test.go +++ b/acl/message_test.go @@ -3,9 +3,9 @@ package acl_test import ( "testing" - "github.com/nspcc-dev/neofs-api-go/rpc/message" - messagetest "github.com/nspcc-dev/neofs-api-go/rpc/message/test" acltest "github.com/nspcc-dev/neofs-api-go/v2/acl/test" + "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" + messagetest "github.com/nspcc-dev/neofs-api-go/v2/rpc/message/test" ) func TestMessageConvert(t *testing.T) { diff --git a/v2/acl/string.go b/acl/string.go similarity index 100% rename from v2/acl/string.go rename to acl/string.go diff --git a/v2/acl/test/generate.go b/acl/test/generate.go similarity index 100% rename from v2/acl/test/generate.go rename to acl/test/generate.go diff --git a/v2/acl/types.go b/acl/types.go similarity index 100% rename from v2/acl/types.go rename to acl/types.go diff --git a/v2/audit/convert.go b/audit/convert.go similarity index 95% rename from v2/audit/convert.go rename to audit/convert.go index 1b2a998..a8b18fa 100644 --- a/v2/audit/convert.go +++ b/audit/convert.go @@ -1,11 +1,11 @@ package audit import ( - "github.com/nspcc-dev/neofs-api-go/rpc/grpc" - "github.com/nspcc-dev/neofs-api-go/rpc/message" audit "github.com/nspcc-dev/neofs-api-go/v2/audit/grpc" "github.com/nspcc-dev/neofs-api-go/v2/refs" refsGRPC "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" + "github.com/nspcc-dev/neofs-api-go/v2/rpc/grpc" + "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" ) func (a *DataAuditResult) ToGRPCMessage() grpc.Message { diff --git a/v2/audit/grpc/types.go b/audit/grpc/types.go similarity index 100% rename from v2/audit/grpc/types.go rename to audit/grpc/types.go diff --git a/v2/audit/grpc/types.pb.go b/audit/grpc/types.pb.go similarity index 100% rename from v2/audit/grpc/types.pb.go rename to audit/grpc/types.pb.go diff --git a/v2/audit/json.go b/audit/json.go similarity index 85% rename from v2/audit/json.go rename to audit/json.go index b119aa1..be46491 100644 --- a/v2/audit/json.go +++ b/audit/json.go @@ -1,8 +1,8 @@ package audit import ( - "github.com/nspcc-dev/neofs-api-go/rpc/message" audit "github.com/nspcc-dev/neofs-api-go/v2/audit/grpc" + "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" ) func (a *DataAuditResult) MarshalJSON() ([]byte, error) { diff --git a/v2/audit/marshal.go b/audit/marshal.go similarity index 97% rename from v2/audit/marshal.go rename to audit/marshal.go index e1c1b53..dc46a21 100644 --- a/v2/audit/marshal.go +++ b/audit/marshal.go @@ -1,10 +1,10 @@ package audit import ( - "github.com/nspcc-dev/neofs-api-go/rpc/message" - "github.com/nspcc-dev/neofs-api-go/util/proto" audit "github.com/nspcc-dev/neofs-api-go/v2/audit/grpc" "github.com/nspcc-dev/neofs-api-go/v2/refs" + "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" + "github.com/nspcc-dev/neofs-api-go/v2/util/proto" ) const ( diff --git a/v2/audit/message_test.go b/audit/message_test.go similarity index 68% rename from v2/audit/message_test.go rename to audit/message_test.go index dbfc7b7..1e0d485 100644 --- a/v2/audit/message_test.go +++ b/audit/message_test.go @@ -3,9 +3,9 @@ package audit_test import ( "testing" - "github.com/nspcc-dev/neofs-api-go/rpc/message" - messagetest "github.com/nspcc-dev/neofs-api-go/rpc/message/test" audittest "github.com/nspcc-dev/neofs-api-go/v2/audit/test" + "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" + messagetest "github.com/nspcc-dev/neofs-api-go/v2/rpc/message/test" ) func TestMessageConvert(t *testing.T) { diff --git a/v2/audit/test/generate.go b/audit/test/generate.go similarity index 100% rename from v2/audit/test/generate.go rename to audit/test/generate.go diff --git a/v2/audit/types.go b/audit/types.go similarity index 100% rename from v2/audit/types.go rename to audit/types.go diff --git a/v2/container/attributes.go b/container/attributes.go similarity index 100% rename from v2/container/attributes.go rename to container/attributes.go diff --git a/v2/container/convert.go b/container/convert.go similarity index 99% rename from v2/container/convert.go rename to container/convert.go index be0bb10..977ad77 100644 --- a/v2/container/convert.go +++ b/container/convert.go @@ -1,8 +1,6 @@ package container import ( - "github.com/nspcc-dev/neofs-api-go/rpc/grpc" - "github.com/nspcc-dev/neofs-api-go/rpc/message" "github.com/nspcc-dev/neofs-api-go/v2/acl" aclGRPC "github.com/nspcc-dev/neofs-api-go/v2/acl/grpc" container "github.com/nspcc-dev/neofs-api-go/v2/container/grpc" @@ -10,6 +8,8 @@ import ( netmapGRPC "github.com/nspcc-dev/neofs-api-go/v2/netmap/grpc" "github.com/nspcc-dev/neofs-api-go/v2/refs" refsGRPC "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" + "github.com/nspcc-dev/neofs-api-go/v2/rpc/grpc" + "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" "github.com/nspcc-dev/neofs-api-go/v2/session" sessionGRPC "github.com/nspcc-dev/neofs-api-go/v2/session/grpc" ) diff --git a/v2/container/grpc/service.go b/container/grpc/service.go similarity index 100% rename from v2/container/grpc/service.go rename to container/grpc/service.go diff --git a/v2/container/grpc/service.pb.go b/container/grpc/service.pb.go similarity index 100% rename from v2/container/grpc/service.pb.go rename to container/grpc/service.pb.go diff --git a/v2/container/grpc/service_grpc.pb.go b/container/grpc/service_grpc.pb.go similarity index 100% rename from v2/container/grpc/service_grpc.pb.go rename to container/grpc/service_grpc.pb.go diff --git a/v2/container/grpc/types.go b/container/grpc/types.go similarity index 100% rename from v2/container/grpc/types.go rename to container/grpc/types.go diff --git a/v2/container/grpc/types.pb.go b/container/grpc/types.pb.go similarity index 100% rename from v2/container/grpc/types.pb.go rename to container/grpc/types.pb.go diff --git a/v2/container/json.go b/container/json.go similarity index 90% rename from v2/container/json.go rename to container/json.go index c681540..b354585 100644 --- a/v2/container/json.go +++ b/container/json.go @@ -1,8 +1,8 @@ package container import ( - "github.com/nspcc-dev/neofs-api-go/rpc/message" container "github.com/nspcc-dev/neofs-api-go/v2/container/grpc" + "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" ) func (a *Attribute) MarshalJSON() ([]byte, error) { diff --git a/v2/container/marshal.go b/container/marshal.go similarity index 99% rename from v2/container/marshal.go rename to container/marshal.go index a53661d..69160ab 100644 --- a/v2/container/marshal.go +++ b/container/marshal.go @@ -1,9 +1,9 @@ package container import ( - "github.com/nspcc-dev/neofs-api-go/rpc/message" - protoutil "github.com/nspcc-dev/neofs-api-go/util/proto" container "github.com/nspcc-dev/neofs-api-go/v2/container/grpc" + "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" + protoutil "github.com/nspcc-dev/neofs-api-go/v2/util/proto" ) const ( diff --git a/v2/container/message_test.go b/container/message_test.go similarity index 96% rename from v2/container/message_test.go rename to container/message_test.go index 9d2786b..3f7b076 100644 --- a/v2/container/message_test.go +++ b/container/message_test.go @@ -3,9 +3,9 @@ package container_test import ( "testing" - "github.com/nspcc-dev/neofs-api-go/rpc/message" - messagetest "github.com/nspcc-dev/neofs-api-go/rpc/message/test" containertest "github.com/nspcc-dev/neofs-api-go/v2/container/test" + "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" + messagetest "github.com/nspcc-dev/neofs-api-go/v2/rpc/message/test" ) func TestMessageConvert(t *testing.T) { diff --git a/v2/container/test/generate.go b/container/test/generate.go similarity index 100% rename from v2/container/test/generate.go rename to container/test/generate.go diff --git a/v2/container/types.go b/container/types.go similarity index 100% rename from v2/container/types.go rename to container/types.go diff --git a/go.mod b/go.mod index cfcdf6e..27739f3 100644 --- a/go.mod +++ b/go.mod @@ -1,18 +1,10 @@ -module github.com/nspcc-dev/neofs-api-go +module github.com/nspcc-dev/neofs-api-go/v2 go 1.16 require ( - github.com/google/uuid v1.1.2 - github.com/mr-tron/base58 v1.1.2 - github.com/nspcc-dev/hrw v1.0.9 - github.com/nspcc-dev/neo-go v0.95.3 github.com/nspcc-dev/neofs-crypto v0.3.0 github.com/stretchr/testify v1.7.0 - golang.org/x/net v0.0.0-20210928044308-7d9f5e0b762b // indirect - golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6 // indirect - golang.org/x/text v0.3.7 // indirect - google.golang.org/genproto v0.0.0-20210928142010-c7af6a1a74c9 // indirect google.golang.org/grpc v1.41.0 google.golang.org/protobuf v1.27.1 ) diff --git a/go.sum b/go.sum index 4ebb679..daed05b 100644 --- a/go.sum +++ b/go.sum @@ -1,85 +1,25 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/CityOfZion/neo-go v0.62.1-pre.0.20191114145240-e740fbe708f8/go.mod h1:MJCkWUBhi9pn/CrYO1Q3P687y2KeahrOPS9BD9LDGb0= -github.com/CityOfZion/neo-go v0.70.1-pre.0.20191209120015-fccb0085941e/go.mod h1:0enZl0az8xA6PVkwzEOwPWVJGqlt/GO4hA4kmQ5Xzig= -github.com/CityOfZion/neo-go v0.70.1-pre.0.20191212173117-32ac01130d4c/go.mod h1:JtlHfeqLywZLswKIKFnAp+yzezY4Dji9qlfQKB2OD/I= -github.com/CityOfZion/neo-go v0.71.1-pre.0.20200129171427-f773ec69fb84/go.mod h1:FLI526IrRWHmcsO+mHsCbj64pJZhwQFTLJZu+A4PGOA= -github.com/DataDog/zstd v1.4.1/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo= -github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= -github.com/Workiva/go-datastructures v1.0.50/go.mod h1:Z+F2Rca0qCsVYDS8z7bAGm8f3UkzuWYS/oBZz5a7VVA= -github.com/abiosoft/ishell v2.0.0+incompatible/go.mod h1:HQR9AqF2R3P4XXpMpI0NAzgHf/aS6+zVXRj14cVk9qg= -github.com/abiosoft/readline v0.0.0-20180607040430-155bce2042db/go.mod h1:rB3B4rKii8V21ydCbIzH5hZiCQE7f5E9SzUb/ZZx530= -github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= -github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/alicebob/gopher-json v0.0.0-20180125190556-5a6b3ba71ee6/go.mod h1:SGnFV6hVsYE877CKEZ6tDNTjaSXYUk6QqoIK6PrAtcc= -github.com/alicebob/miniredis v2.5.0+incompatible/go.mod h1:8HZjEj4yU0dwhYHky+DxYx+6BMjkBbe5ONFIF1MXffk= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= -github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= -github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= -github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= -github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= -github.com/btcsuite/btcd v0.20.1-beta h1:Ik4hyJqN8Jfyv3S4AGBOmyouMsYE3EdYODkMbQjwPGw= -github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= -github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= -github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= -github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg= -github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY= -github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= -github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= -github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= -github.com/cespare/xxhash/v2 v2.1.0/go.mod h1:dgIUBU3pDso/gPgZ1osOZ0iQf77oPR28Tjxl5dIMyVM= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= -github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= -github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= -github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= -github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= -github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= -github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dgraph-io/badger/v2 v2.0.3/go.mod h1:3KY8+bsP8wI0OEnQJAKpd4wIJW/Mm32yw2j/9FUVnIM= -github.com/dgraph-io/ristretto v0.0.2-0.20200115201040-8f368f2f2ab3/go.mod h1:KPxhHT9ZxKefz+PCeOGsrHpl1qZ7i70dGTu2u+Ahh6E= -github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= -github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= -github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/etcd-io/bbolt v1.3.3/go.mod h1:ZF2nL25h33cCyBtcyWeZ2/I3HQOfTP+0PIEvHjkjCrw= -github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= -github.com/flynn-archive/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:rZfgFAXFS/z/lEd6LJmf9HVZ1LkgYiHx5pHhV5DR16M= -github.com/frankban/quicktest v1.10.0/go.mod h1:ui7WezCLWMWxVWr1GETZY3smRy0G4KWq9vcPtJmFl7Y= -github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= -github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= -github.com/go-redis/redis v6.10.2+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA= -github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= -github.com/go-yaml/yaml v2.1.0+incompatible/go.mod h1:w2MrLa16VYP0jy6N7M5kHaCkaLENm+P+Tv+MfurjSw0= -github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= @@ -90,12 +30,8 @@ github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvq github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.5.0 h1:LUVKkCeviFUMKqHa4tXIIij/lbhnMbP7Fn5wKdKkRh4= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= -github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/golang/snappy v0.0.0-20170215233205-553a64147049/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/gomodule/redigo v2.0.0+incompatible/go.mod h1:B4C85qUVwatsJoIUNIfCRsp7qO0iAmpGFZ4EELWSbC4= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= @@ -103,135 +39,27 @@ github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.1.2 h1:EVhdT+1Kseyi1/pUmXKaFxYsDNy9RQYkMWRH68J/W7Y= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= -github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+lJfyTc= -github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= -github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= -github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= -github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= -github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= -github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= -github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= -github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= -github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pretty v0.2.0 h1:s5hAObm+yFO5uHYt5dYjxi2rXrsnmRpJx4OYvIWUaQs= -github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= -github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= -github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= -github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ= -github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84= -github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= -github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= -github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/mr-tron/base58 v1.1.2 h1:ZEw4I2EgPKDJ2iEw0cNmLB3ROrEmkOtXIkaG7wZg+78= github.com/mr-tron/base58 v1.1.2/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= -github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= -github.com/nspcc-dev/dbft v0.0.0-20191205084618-dacb1a30c254/go.mod h1:w1Ln2aT+dBlPhLnuZhBV+DfPEdS2CHWWLp5JTScY3bw= -github.com/nspcc-dev/dbft v0.0.0-20191209120240-0d6b7568d9ae/go.mod h1:3FjXOoHmA51EGfb5GS/HOv7VdmngNRTssSeQ729dvGY= -github.com/nspcc-dev/dbft v0.0.0-20200117124306-478e5cfbf03a/go.mod h1:/YFK+XOxxg0Bfm6P92lY5eDSLYfp06XOdL8KAVgXjVk= -github.com/nspcc-dev/dbft v0.0.0-20200219114139-199d286ed6c1/go.mod h1:O0qtn62prQSqizzoagHmuuKoz8QMkU3SzBoKdEvm3aQ= -github.com/nspcc-dev/dbft v0.0.0-20200711144034-c526ccc6f570/go.mod h1:1FYQXSbb6/9HQIkoF8XO7W/S8N7AZRkBsgwbcXRvk0E= -github.com/nspcc-dev/dbft v0.0.0-20210302103605-cc75991b7cfb/go.mod h1:U8MSnEShH+o5hexfWJdze6uMFJteP0ko7J2frO7Yu1Y= -github.com/nspcc-dev/hrw v1.0.9 h1:17VcAuTtrstmFppBjfRiia4K2wA/ukXZhLFS8Y8rz5Y= -github.com/nspcc-dev/hrw v1.0.9/go.mod h1:l/W2vx83vMQo6aStyx2AuZrJ+07lGv2JQGlVkPG06MU= -github.com/nspcc-dev/neo-go v0.73.1-pre.0.20200303142215-f5a1b928ce09/go.mod h1:pPYwPZ2ks+uMnlRLUyXOpLieaDQSEaf4NM3zHVbRjmg= -github.com/nspcc-dev/neo-go v0.91.0/go.mod h1:G6HdOWvzQ6tlvFdvFSN/PgCzLPN/X/X4d5hTjFRUDcc= -github.com/nspcc-dev/neo-go v0.95.1/go.mod h1:bW07ge1WFXsBgqrcPpLUr6OcyQxHqM26MZNesWMdH0c= -github.com/nspcc-dev/neo-go v0.95.3 h1:RxBKcmmatbSM2cETGhv3ritmrkU0gUnWItNZvtrBtI0= -github.com/nspcc-dev/neo-go v0.95.3/go.mod h1:t15xRFDVhz5o/pstptdoW9N9JJBNn1hZ6APMNiC6MrY= -github.com/nspcc-dev/neofs-api-go v1.24.0/go.mod h1:G7dqincfdjBrAbL5nxVp82emF05fSVEqe59ICsoRDI8= -github.com/nspcc-dev/neofs-api-go v1.27.1/go.mod h1:i0Cwgvcu9A4M4e58pydbXFisUhSxpfljmuWFPIp2btE= -github.com/nspcc-dev/neofs-crypto v0.2.0/go.mod h1:F/96fUzPM3wR+UGsPi3faVNmFlA9KAEAUQR7dMxZmNA= -github.com/nspcc-dev/neofs-crypto v0.2.3/go.mod h1:8w16GEJbH6791ktVqHN9YRNH3s9BEEKYxGhlFnp0cDw= github.com/nspcc-dev/neofs-crypto v0.3.0 h1:zlr3pgoxuzrmGCxc5W8dGVfA9Rro8diFvVnBg0L4ifM= github.com/nspcc-dev/neofs-crypto v0.3.0/go.mod h1:8w16GEJbH6791ktVqHN9YRNH3s9BEEKYxGhlFnp0cDw= -github.com/nspcc-dev/rfc6979 v0.1.0/go.mod h1:exhIh1PdpDC5vQmyEsGvc4YDM/lyQp/452QxGq/UEso= github.com/nspcc-dev/rfc6979 v0.2.0 h1:3e1WNxrN60/6N0DW7+UYisLeZJyfqZTNOjeV/toYvOE= github.com/nspcc-dev/rfc6979 v0.2.0/go.mod h1:exhIh1PdpDC5vQmyEsGvc4YDM/lyQp/452QxGq/UEso= -github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.10.3/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/gomega v1.4.2/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= -github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= -github.com/pierrec/lz4 v2.5.2+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= -github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= -github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= -github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= -github.com/prometheus/client_golang v1.2.1/go.mod h1:XMU6Z2MjaRKVu/dC1qupJI9SiNkDYzz3xecMgSW/F+U= -github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= -github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= -github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt26CguLLsqA= -github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= -github.com/prometheus/procfs v0.0.5/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDaekg4FpcdQ= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= -github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= -github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= -github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= -github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= -github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= -github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= -github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= -github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= -github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= -github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/syndtr/goleveldb v0.0.0-20180307113352-169b1b37be73/go.mod h1:Z4AUp2Km+PwemOoO/VB5AOx9XSsIItzFjoJlOSiYmn0= -github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= -github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= -github.com/virtuald/go-ordered-json v0.0.0-20170621173500-b18e6e673d74/go.mod h1:RmMWU37GKR2s6pgrIEB4ixgpVCt/cf7dnJv3fuH1J1c= -github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= -github.com/yuin/gopher-lua v0.0.0-20190514113301-1cd887cd7036/go.mod h1:gqRgreBUhTSL0GeU64rtZ3Uq3wtjOa/TB2YfrtkCbVQ= -github.com/yuin/gopher-lua v0.0.0-20191128022950-c6266f4fe8d7/go.mod h1:gqRgreBUhTSL0GeU64rtZ3Uq3wtjOa/TB2YfrtkCbVQ= -go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= -go.etcd.io/bbolt v1.3.4/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= -go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= -go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= -go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= -golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnkZWQJsqcURM6tKiBApRjXI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -239,18 +67,12 @@ golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvx golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200822124328-c89045814202 h1:VvcQYSHwXgi7W+TpUR6A9g6Up98WAHf3f/ulnJ62IyA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.0.0-20210928044308-7d9f5e0b762b h1:eB48h3HiRycXNy8E0Gf5e0hv7YT6Kt14L/D73G1fuwo= -golang.org/x/net v0.0.0-20210928044308-7d9f5e0b762b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -258,37 +80,12 @@ golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190204203706-41f3e6584952/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191008105621-543471e840be/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191010194322-b09406accb47/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd h1:xhmwyvizuTgC2qz7ZlMluP20uW+C3Rm0FD/WLDX8884= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6 h1:foEbQz/B0Oz6YIqu/69kfXPYeFQAuuMYFkjaqXzl5Wo= -golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.0.0-20201210144234-2321bbc49cbf/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= -golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/tools v0.0.0-20180318012157-96caea41033d/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= @@ -301,17 +98,14 @@ google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7 google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 h1:+kGHl1aib/qcwaRi1CbqBZ1rk19r85MNUf8HaBghugY= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto v0.0.0-20210928142010-c7af6a1a74c9 h1:XTH066D35LyHehRwlYhoK3qA+Hcgvg5xREG4kFQEW1Y= -google.golang.org/genproto v0.0.0-20210928142010-c7af6a1a74c9/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.41.0 h1:f+PlOh7QV4iIJkPrx5NQ7qaNGFQ3OTse67yaDHfju4E= google.golang.org/grpc v1.41.0/go.mod h1:U3l9uK9J0sini8mHphKoXyaqDA/8VyGnDee1zzIUK6k= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= @@ -324,20 +118,12 @@ google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2 google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -gopkg.in/abiosoft/ishell.v2 v2.0.0/go.mod h1:sFp+cGtH6o4s1FtpVPTMcHq2yue+c4DGOVohJCPUzwY= -gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= -gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/v2/netmap/convert.go b/netmap/convert.go similarity index 99% rename from v2/netmap/convert.go rename to netmap/convert.go index 59c5e60..e059592 100644 --- a/v2/netmap/convert.go +++ b/netmap/convert.go @@ -1,11 +1,11 @@ package netmap import ( - "github.com/nspcc-dev/neofs-api-go/rpc/grpc" - "github.com/nspcc-dev/neofs-api-go/rpc/message" netmap "github.com/nspcc-dev/neofs-api-go/v2/netmap/grpc" "github.com/nspcc-dev/neofs-api-go/v2/refs" refsGRPC "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" + "github.com/nspcc-dev/neofs-api-go/v2/rpc/grpc" + "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" ) func (f *Filter) ToGRPCMessage() grpc.Message { diff --git a/v2/netmap/grpc/service.go b/netmap/grpc/service.go similarity index 100% rename from v2/netmap/grpc/service.go rename to netmap/grpc/service.go diff --git a/v2/netmap/grpc/service.pb.go b/netmap/grpc/service.pb.go similarity index 100% rename from v2/netmap/grpc/service.pb.go rename to netmap/grpc/service.pb.go diff --git a/v2/netmap/grpc/service_grpc.pb.go b/netmap/grpc/service_grpc.pb.go similarity index 100% rename from v2/netmap/grpc/service_grpc.pb.go rename to netmap/grpc/service_grpc.pb.go diff --git a/v2/netmap/grpc/types.go b/netmap/grpc/types.go similarity index 100% rename from v2/netmap/grpc/types.go rename to netmap/grpc/types.go diff --git a/v2/netmap/grpc/types.pb.go b/netmap/grpc/types.pb.go similarity index 100% rename from v2/netmap/grpc/types.pb.go rename to netmap/grpc/types.pb.go diff --git a/v2/netmap/json.go b/netmap/json.go similarity index 96% rename from v2/netmap/json.go rename to netmap/json.go index 64f2f6d..05979ba 100644 --- a/v2/netmap/json.go +++ b/netmap/json.go @@ -1,8 +1,8 @@ package netmap import ( - "github.com/nspcc-dev/neofs-api-go/rpc/message" netmap "github.com/nspcc-dev/neofs-api-go/v2/netmap/grpc" + "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" ) func (p *PlacementPolicy) MarshalJSON() ([]byte, error) { diff --git a/v2/netmap/marshal.go b/netmap/marshal.go similarity index 99% rename from v2/netmap/marshal.go rename to netmap/marshal.go index 4f818e5..d252111 100644 --- a/v2/netmap/marshal.go +++ b/netmap/marshal.go @@ -1,9 +1,9 @@ package netmap import ( - "github.com/nspcc-dev/neofs-api-go/rpc/message" - protoutil "github.com/nspcc-dev/neofs-api-go/util/proto" netmap "github.com/nspcc-dev/neofs-api-go/v2/netmap/grpc" + "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" + protoutil "github.com/nspcc-dev/neofs-api-go/v2/util/proto" ) const ( diff --git a/v2/netmap/message_test.go b/netmap/message_test.go similarity index 91% rename from v2/netmap/message_test.go rename to netmap/message_test.go index 1c921e0..bbe6368 100644 --- a/v2/netmap/message_test.go +++ b/netmap/message_test.go @@ -3,9 +3,9 @@ package netmap_test import ( "testing" - "github.com/nspcc-dev/neofs-api-go/rpc/message" - messagetest "github.com/nspcc-dev/neofs-api-go/rpc/message/test" netmaptest "github.com/nspcc-dev/neofs-api-go/v2/netmap/test" + "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" + messagetest "github.com/nspcc-dev/neofs-api-go/v2/rpc/message/test" ) func TestMessageConvert(t *testing.T) { diff --git a/v2/netmap/string.go b/netmap/string.go similarity index 100% rename from v2/netmap/string.go rename to netmap/string.go diff --git a/v2/netmap/test/generate.go b/netmap/test/generate.go similarity index 100% rename from v2/netmap/test/generate.go rename to netmap/test/generate.go diff --git a/v2/netmap/types.go b/netmap/types.go similarity index 100% rename from v2/netmap/types.go rename to netmap/types.go diff --git a/v2/object/attributes.go b/object/attributes.go similarity index 100% rename from v2/object/attributes.go rename to object/attributes.go diff --git a/v2/object/convert.go b/object/convert.go similarity index 99% rename from v2/object/convert.go rename to object/convert.go index 0d2d142..d7c0a28 100644 --- a/v2/object/convert.go +++ b/object/convert.go @@ -3,11 +3,11 @@ package object import ( "fmt" - "github.com/nspcc-dev/neofs-api-go/rpc/grpc" - "github.com/nspcc-dev/neofs-api-go/rpc/message" object "github.com/nspcc-dev/neofs-api-go/v2/object/grpc" "github.com/nspcc-dev/neofs-api-go/v2/refs" refsGRPC "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" + "github.com/nspcc-dev/neofs-api-go/v2/rpc/grpc" + "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" "github.com/nspcc-dev/neofs-api-go/v2/session" sessionGRPC "github.com/nspcc-dev/neofs-api-go/v2/session/grpc" ) diff --git a/v2/object/filters.go b/object/filters.go similarity index 100% rename from v2/object/filters.go rename to object/filters.go diff --git a/v2/object/grpc/client.go b/object/grpc/client.go similarity index 100% rename from v2/object/grpc/client.go rename to object/grpc/client.go diff --git a/v2/object/grpc/service.go b/object/grpc/service.go similarity index 100% rename from v2/object/grpc/service.go rename to object/grpc/service.go diff --git a/v2/object/grpc/service.pb.go b/object/grpc/service.pb.go similarity index 100% rename from v2/object/grpc/service.pb.go rename to object/grpc/service.pb.go diff --git a/v2/object/grpc/service_grpc.pb.go b/object/grpc/service_grpc.pb.go similarity index 100% rename from v2/object/grpc/service_grpc.pb.go rename to object/grpc/service_grpc.pb.go diff --git a/v2/object/grpc/types.go b/object/grpc/types.go similarity index 100% rename from v2/object/grpc/types.go rename to object/grpc/types.go diff --git a/v2/object/grpc/types.pb.go b/object/grpc/types.pb.go similarity index 100% rename from v2/object/grpc/types.pb.go rename to object/grpc/types.pb.go diff --git a/v2/object/json.go b/object/json.go similarity index 97% rename from v2/object/json.go rename to object/json.go index b80253e..1555005 100644 --- a/v2/object/json.go +++ b/object/json.go @@ -1,8 +1,8 @@ package object import ( - "github.com/nspcc-dev/neofs-api-go/rpc/message" object "github.com/nspcc-dev/neofs-api-go/v2/object/grpc" + "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" ) func (h *ShortHeader) MarshalJSON() ([]byte, error) { diff --git a/v2/object/marshal.go b/object/marshal.go similarity index 99% rename from v2/object/marshal.go rename to object/marshal.go index 9897489..44783f0 100644 --- a/v2/object/marshal.go +++ b/object/marshal.go @@ -1,10 +1,10 @@ package object import ( - "github.com/nspcc-dev/neofs-api-go/rpc/message" - "github.com/nspcc-dev/neofs-api-go/util/proto" object "github.com/nspcc-dev/neofs-api-go/v2/object/grpc" "github.com/nspcc-dev/neofs-api-go/v2/refs" + "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" + "github.com/nspcc-dev/neofs-api-go/v2/util/proto" ) const ( diff --git a/v2/object/message_test.go b/object/message_test.go similarity index 96% rename from v2/object/message_test.go rename to object/message_test.go index 1639f35..145c22c 100644 --- a/v2/object/message_test.go +++ b/object/message_test.go @@ -3,9 +3,9 @@ package object_test import ( "testing" - "github.com/nspcc-dev/neofs-api-go/rpc/message" - messagetest "github.com/nspcc-dev/neofs-api-go/rpc/message/test" objecttest "github.com/nspcc-dev/neofs-api-go/v2/object/test" + "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" + messagetest "github.com/nspcc-dev/neofs-api-go/v2/rpc/message/test" ) func TestMessageConvert(t *testing.T) { diff --git a/v2/object/string.go b/object/string.go similarity index 100% rename from v2/object/string.go rename to object/string.go diff --git a/v2/object/test/generate.go b/object/test/generate.go similarity index 100% rename from v2/object/test/generate.go rename to object/test/generate.go diff --git a/v2/object/types.go b/object/types.go similarity index 100% rename from v2/object/types.go rename to object/types.go diff --git a/pkg/.gitkeep b/pkg/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/pkg/accounting/decimal.go b/pkg/accounting/decimal.go deleted file mode 100644 index 07b11d6..0000000 --- a/pkg/accounting/decimal.go +++ /dev/null @@ -1,74 +0,0 @@ -package accounting - -import ( - "github.com/nspcc-dev/neofs-api-go/v2/accounting" -) - -// Decimal represents v2-compatible decimal number. -type Decimal accounting.Decimal - -// NewDecimal creates, initializes and returns blank Decimal instance. -func NewDecimal() *Decimal { - return NewDecimalFromV2(new(accounting.Decimal)) -} - -// NewDecimalFromV2 converts v2 Decimal to Decimal. -func NewDecimalFromV2(d *accounting.Decimal) *Decimal { - return (*Decimal)(d) -} - -// Value returns value of the decimal number. -func (d *Decimal) Value() int64 { - return (*accounting.Decimal)(d). - GetValue() -} - -// SetValue sets value of the decimal number. -func (d *Decimal) SetValue(v int64) { - (*accounting.Decimal)(d). - SetValue(v) -} - -// Precision returns precision of the decimal number. -func (d *Decimal) Precision() uint32 { - return (*accounting.Decimal)(d). - GetPrecision() -} - -// SetPrecision sets precision of the decimal number. -func (d *Decimal) SetPrecision(p uint32) { - (*accounting.Decimal)(d). - SetPrecision(p) -} - -// Marshal marshals Decimal into a protobuf binary form. -// -// Buffer is allocated when the argument is empty. -// Otherwise, the first buffer is used. -func (d *Decimal) Marshal(b ...[]byte) ([]byte, error) { - var buf []byte - if len(b) > 0 { - buf = b[0] - } - - return (*accounting.Decimal)(d). - StableMarshal(buf) -} - -// Unmarshal unmarshals protobuf binary representation of Decimal. -func (d *Decimal) Unmarshal(data []byte) error { - return (*accounting.Decimal)(d). - Unmarshal(data) -} - -// MarshalJSON encodes Decimal to protobuf JSON format. -func (d *Decimal) MarshalJSON() ([]byte, error) { - return (*accounting.Decimal)(d). - MarshalJSON() -} - -// UnmarshalJSON decodes Decimal from protobuf JSON format. -func (d *Decimal) UnmarshalJSON(data []byte) error { - return (*accounting.Decimal)(d). - UnmarshalJSON(data) -} diff --git a/pkg/accounting/decimal_test.go b/pkg/accounting/decimal_test.go deleted file mode 100644 index 7591097..0000000 --- a/pkg/accounting/decimal_test.go +++ /dev/null @@ -1,51 +0,0 @@ -package accounting_test - -import ( - "testing" - - "github.com/nspcc-dev/neofs-api-go/pkg/accounting" - accountingtest "github.com/nspcc-dev/neofs-api-go/pkg/accounting/test" - "github.com/stretchr/testify/require" -) - -func TestDecimal_Value(t *testing.T) { - d := accounting.NewDecimal() - - v := int64(3) - d.SetValue(v) - - require.Equal(t, v, d.Value()) -} - -func TestDecimal_Precision(t *testing.T) { - d := accounting.NewDecimal() - - p := uint32(3) - d.SetPrecision(p) - - require.Equal(t, p, d.Precision()) -} - -func TestDecimalEncoding(t *testing.T) { - d := accountingtest.Generate() - - t.Run("binary", func(t *testing.T) { - data, err := d.Marshal() - require.NoError(t, err) - - d2 := accounting.NewDecimal() - require.NoError(t, d2.Unmarshal(data)) - - require.Equal(t, d, d2) - }) - - t.Run("json", func(t *testing.T) { - data, err := d.MarshalJSON() - require.NoError(t, err) - - d2 := accounting.NewDecimal() - require.NoError(t, d2.UnmarshalJSON(data)) - - require.Equal(t, d, d2) - }) -} diff --git a/pkg/accounting/test/decimal.go b/pkg/accounting/test/decimal.go deleted file mode 100644 index 80014d8..0000000 --- a/pkg/accounting/test/decimal.go +++ /dev/null @@ -1,14 +0,0 @@ -package accountingtest - -import ( - "github.com/nspcc-dev/neofs-api-go/pkg/accounting" -) - -// Generate returns random accounting.Decimal. -func Generate() *accounting.Decimal { - d := accounting.NewDecimal() - d.SetValue(1) - d.SetPrecision(2) - - return d -} diff --git a/pkg/acl/eacl/enums.go b/pkg/acl/eacl/enums.go deleted file mode 100644 index 2e8fc1f..0000000 --- a/pkg/acl/eacl/enums.go +++ /dev/null @@ -1,396 +0,0 @@ -package eacl - -import ( - v2acl "github.com/nspcc-dev/neofs-api-go/v2/acl" -) - -// Action taken if EACL record matched request. -// Action is compatible with v2 acl.Action enum. -type Action uint32 - -const ( - // ActionUnknown is an Action value used to mark action as undefined. - ActionUnknown Action = iota - - // ActionAllow is an Action value that allows access to the operation from context. - ActionAllow - - // ActionDeny is an Action value that denies access to the operation from context. - ActionDeny -) - -// Operation is a object service method to match request. -// Operation is compatible with v2 acl.Operation enum. -type Operation uint32 - -const ( - // OperationUnknown is an Operation value used to mark operation as undefined. - OperationUnknown Operation = iota - - // OperationGet is an object get Operation. - OperationGet - - // OperationHead is an Operation of getting the object header. - OperationHead - - // OperationPut is an object put Operation. - OperationPut - - // OperationDelete is an object delete Operation. - OperationDelete - - // OperationSearch is an object search Operation. - OperationSearch - - // OperationRange is an object payload range retrieval Operation. - OperationRange - - // OperationRangeHash is an object payload range hashing Operation. - OperationRangeHash -) - -// Role is a group of request senders to match request. -// Role is compatible with v2 acl.Role enum. -type Role uint32 - -const ( - // RoleUnknown is a Role value used to mark role as undefined. - RoleUnknown Role = iota - - // RoleUser is a group of senders that contains only key of container owner. - RoleUser - - // RoleSystem is a group of senders that contains keys of container nodes and - // inner ring nodes. - RoleSystem - - // RoleOthers is a group of senders that contains none of above keys. - RoleOthers -) - -// Match is binary operation on filer name and value to check if request is matched. -// Match is compatible with v2 acl.MatchType enum. -type Match uint32 - -const ( - // MatchUnknown is a Match value used to mark matcher as undefined. - MatchUnknown Match = iota - - // MatchStringEqual is a Match of string equality. - MatchStringEqual - - // MatchStringNotEqual is a Match of string inequality. - MatchStringNotEqual -) - -// FilterHeaderType indicates source of headers to make matches. -// FilterHeaderType is compatible with v2 acl.HeaderType enum. -type FilterHeaderType uint32 - -const ( - // HeaderTypeUnknown is a FilterHeaderType value used to mark header type as undefined. - HeaderTypeUnknown FilterHeaderType = iota - - // HeaderFromRequest is a FilterHeaderType for request X-Header. - HeaderFromRequest - - // HeaderFromObject is a FilterHeaderType for object header. - HeaderFromObject - - // HeaderFromService is a FilterHeaderType for service header. - HeaderFromService -) - -// ToV2 converts Action to v2 Action enum value. -func (a Action) ToV2() v2acl.Action { - switch a { - case ActionAllow: - return v2acl.ActionAllow - case ActionDeny: - return v2acl.ActionDeny - default: - return v2acl.ActionUnknown - } -} - -// ActionFromV2 converts v2 Action enum value to Action. -func ActionFromV2(action v2acl.Action) (a Action) { - switch action { - case v2acl.ActionAllow: - a = ActionAllow - case v2acl.ActionDeny: - a = ActionDeny - default: - a = ActionUnknown - } - - return a -} - -// String returns string representation of Action. -// -// String mapping: -// * ActionAllow: ALLOW; -// * ActionDeny: DENY; -// * ActionUnknown, default: ACTION_UNSPECIFIED. -func (a Action) String() string { - return a.ToV2().String() -} - -// FromString parses Action from a string representation. -// It is a reverse action to String(). -// -// Returns true if s was parsed successfully. -func (a *Action) FromString(s string) bool { - var g v2acl.Action - - ok := g.FromString(s) - - if ok { - *a = ActionFromV2(g) - } - - return ok -} - -// ToV2 converts Operation to v2 Operation enum value. -func (o Operation) ToV2() v2acl.Operation { - switch o { - case OperationGet: - return v2acl.OperationGet - case OperationHead: - return v2acl.OperationHead - case OperationPut: - return v2acl.OperationPut - case OperationDelete: - return v2acl.OperationDelete - case OperationSearch: - return v2acl.OperationSearch - case OperationRange: - return v2acl.OperationRange - case OperationRangeHash: - return v2acl.OperationRangeHash - default: - return v2acl.OperationUnknown - } -} - -// OperationFromV2 converts v2 Operation enum value to Operation. -func OperationFromV2(operation v2acl.Operation) (o Operation) { - switch operation { - case v2acl.OperationGet: - o = OperationGet - case v2acl.OperationHead: - o = OperationHead - case v2acl.OperationPut: - o = OperationPut - case v2acl.OperationDelete: - o = OperationDelete - case v2acl.OperationSearch: - o = OperationSearch - case v2acl.OperationRange: - o = OperationRange - case v2acl.OperationRangeHash: - o = OperationRangeHash - default: - o = OperationUnknown - } - - return o -} - -// String returns string representation of Operation. -// -// String mapping: -// * OperationGet: GET; -// * OperationHead: HEAD; -// * OperationPut: PUT; -// * OperationDelete: DELETE; -// * OperationSearch: SEARCH; -// * OperationRange: GETRANGE; -// * OperationRangeHash: GETRANGEHASH; -// * OperationUnknown, default: OPERATION_UNSPECIFIED. -func (o Operation) String() string { - return o.ToV2().String() -} - -// FromString parses Operation from a string representation. -// It is a reverse action to String(). -// -// Returns true if s was parsed successfully. -func (o *Operation) FromString(s string) bool { - var g v2acl.Operation - - ok := g.FromString(s) - - if ok { - *o = OperationFromV2(g) - } - - return ok -} - -// ToV2 converts Role to v2 Role enum value. -func (r Role) ToV2() v2acl.Role { - switch r { - case RoleUser: - return v2acl.RoleUser - case RoleSystem: - return v2acl.RoleSystem - case RoleOthers: - return v2acl.RoleOthers - default: - return v2acl.RoleUnknown - } -} - -// RoleFromV2 converts v2 Role enum value to Role. -func RoleFromV2(role v2acl.Role) (r Role) { - switch role { - case v2acl.RoleUser: - r = RoleUser - case v2acl.RoleSystem: - r = RoleSystem - case v2acl.RoleOthers: - r = RoleOthers - default: - r = RoleUnknown - } - - return r -} - -// String returns string representation of Role. -// -// String mapping: -// * RoleUser: USER; -// * RoleSystem: SYSTEM; -// * RoleOthers: OTHERS; -// * RoleUnknown, default: ROLE_UNKNOWN. -func (r Role) String() string { - return r.ToV2().String() -} - -// FromString parses Role from a string representation. -// It is a reverse action to String(). -// -// Returns true if s was parsed successfully. -func (r *Role) FromString(s string) bool { - var g v2acl.Role - - ok := g.FromString(s) - - if ok { - *r = RoleFromV2(g) - } - - return ok -} - -// ToV2 converts Match to v2 MatchType enum value. -func (m Match) ToV2() v2acl.MatchType { - switch m { - case MatchStringEqual: - return v2acl.MatchTypeStringEqual - case MatchStringNotEqual: - return v2acl.MatchTypeStringNotEqual - default: - return v2acl.MatchTypeUnknown - } -} - -// MatchFromV2 converts v2 MatchType enum value to Match. -func MatchFromV2(match v2acl.MatchType) (m Match) { - switch match { - case v2acl.MatchTypeStringEqual: - m = MatchStringEqual - case v2acl.MatchTypeStringNotEqual: - m = MatchStringNotEqual - default: - m = MatchUnknown - } - - return m -} - -// String returns string representation of Match. -// -// String mapping: -// * MatchStringEqual: STRING_EQUAL; -// * MatchStringNotEqual: STRING_NOT_EQUAL; -// * MatchUnknown, default: MATCH_TYPE_UNSPECIFIED. -func (m Match) String() string { - return m.ToV2().String() -} - -// FromString parses Match from a string representation. -// It is a reverse action to String(). -// -// Returns true if s was parsed successfully. -func (m *Match) FromString(s string) bool { - var g v2acl.MatchType - - ok := g.FromString(s) - - if ok { - *m = MatchFromV2(g) - } - - return ok -} - -// ToV2 converts FilterHeaderType to v2 HeaderType enum value. -func (h FilterHeaderType) ToV2() v2acl.HeaderType { - switch h { - case HeaderFromRequest: - return v2acl.HeaderTypeRequest - case HeaderFromObject: - return v2acl.HeaderTypeObject - case HeaderFromService: - return v2acl.HeaderTypeService - default: - return v2acl.HeaderTypeUnknown - } -} - -// FilterHeaderTypeFromV2 converts v2 HeaderType enum value to FilterHeaderType. -func FilterHeaderTypeFromV2(header v2acl.HeaderType) (h FilterHeaderType) { - switch header { - case v2acl.HeaderTypeRequest: - h = HeaderFromRequest - case v2acl.HeaderTypeObject: - h = HeaderFromObject - case v2acl.HeaderTypeService: - h = HeaderFromService - default: - h = HeaderTypeUnknown - } - - return h -} - -// String returns string representation of FilterHeaderType. -// -// String mapping: -// * HeaderFromRequest: REQUEST; -// * HeaderFromObject: OBJECT; -// * HeaderTypeUnknown, default: HEADER_UNSPECIFIED. -func (h FilterHeaderType) String() string { - return h.ToV2().String() -} - -// FromString parses FilterHeaderType from a string representation. -// It is a reverse action to String(). -// -// Returns true if s was parsed successfully. -func (h *FilterHeaderType) FromString(s string) bool { - var g v2acl.HeaderType - - ok := g.FromString(s) - - if ok { - *h = FilterHeaderTypeFromV2(g) - } - - return ok -} diff --git a/pkg/acl/eacl/enums_test.go b/pkg/acl/eacl/enums_test.go deleted file mode 100644 index d077a89..0000000 --- a/pkg/acl/eacl/enums_test.go +++ /dev/null @@ -1,214 +0,0 @@ -package eacl_test - -import ( - "testing" - - "github.com/nspcc-dev/neofs-api-go/pkg/acl/eacl" - v2acl "github.com/nspcc-dev/neofs-api-go/v2/acl" - "github.com/stretchr/testify/require" -) - -var ( - eqV2Actions = map[eacl.Action]v2acl.Action{ - eacl.ActionUnknown: v2acl.ActionUnknown, - eacl.ActionAllow: v2acl.ActionAllow, - eacl.ActionDeny: v2acl.ActionDeny, - } - - eqV2Operations = map[eacl.Operation]v2acl.Operation{ - eacl.OperationUnknown: v2acl.OperationUnknown, - eacl.OperationGet: v2acl.OperationGet, - eacl.OperationHead: v2acl.OperationHead, - eacl.OperationPut: v2acl.OperationPut, - eacl.OperationDelete: v2acl.OperationDelete, - eacl.OperationSearch: v2acl.OperationSearch, - eacl.OperationRange: v2acl.OperationRange, - eacl.OperationRangeHash: v2acl.OperationRangeHash, - } - - eqV2Roles = map[eacl.Role]v2acl.Role{ - eacl.RoleUnknown: v2acl.RoleUnknown, - eacl.RoleUser: v2acl.RoleUser, - eacl.RoleSystem: v2acl.RoleSystem, - eacl.RoleOthers: v2acl.RoleOthers, - } - - eqV2Matches = map[eacl.Match]v2acl.MatchType{ - eacl.MatchUnknown: v2acl.MatchTypeUnknown, - eacl.MatchStringEqual: v2acl.MatchTypeStringEqual, - eacl.MatchStringNotEqual: v2acl.MatchTypeStringNotEqual, - } - - eqV2HeaderTypes = map[eacl.FilterHeaderType]v2acl.HeaderType{ - eacl.HeaderTypeUnknown: v2acl.HeaderTypeUnknown, - eacl.HeaderFromRequest: v2acl.HeaderTypeRequest, - eacl.HeaderFromObject: v2acl.HeaderTypeObject, - eacl.HeaderFromService: v2acl.HeaderTypeService, - } -) - -func TestAction(t *testing.T) { - t.Run("known actions", func(t *testing.T) { - for i := eacl.ActionUnknown; i <= eacl.ActionDeny; i++ { - require.Equal(t, eqV2Actions[i], i.ToV2()) - require.Equal(t, eacl.ActionFromV2(i.ToV2()), i) - } - }) - - t.Run("unknown actions", func(t *testing.T) { - require.Equal(t, (eacl.ActionDeny + 1).ToV2(), v2acl.ActionUnknown) - require.Equal(t, eacl.ActionFromV2(v2acl.ActionDeny+1), eacl.ActionUnknown) - }) -} - -func TestOperation(t *testing.T) { - t.Run("known operations", func(t *testing.T) { - for i := eacl.OperationUnknown; i <= eacl.OperationRangeHash; i++ { - require.Equal(t, eqV2Operations[i], i.ToV2()) - require.Equal(t, eacl.OperationFromV2(i.ToV2()), i) - } - }) - - t.Run("unknown operations", func(t *testing.T) { - require.Equal(t, (eacl.OperationRangeHash + 1).ToV2(), v2acl.OperationUnknown) - require.Equal(t, eacl.OperationFromV2(v2acl.OperationRangeHash+1), eacl.OperationUnknown) - }) -} - -func TestRole(t *testing.T) { - t.Run("known roles", func(t *testing.T) { - for i := eacl.RoleUnknown; i <= eacl.RoleOthers; i++ { - require.Equal(t, eqV2Roles[i], i.ToV2()) - require.Equal(t, eacl.RoleFromV2(i.ToV2()), i) - } - }) - - t.Run("unknown roles", func(t *testing.T) { - require.Equal(t, (eacl.RoleOthers + 1).ToV2(), v2acl.RoleUnknown) - require.Equal(t, eacl.RoleFromV2(v2acl.RoleOthers+1), eacl.RoleUnknown) - }) -} - -func TestMatch(t *testing.T) { - t.Run("known matches", func(t *testing.T) { - for i := eacl.MatchUnknown; i <= eacl.MatchStringNotEqual; i++ { - require.Equal(t, eqV2Matches[i], i.ToV2()) - require.Equal(t, eacl.MatchFromV2(i.ToV2()), i) - } - }) - - t.Run("unknown matches", func(t *testing.T) { - require.Equal(t, (eacl.MatchStringNotEqual + 1).ToV2(), v2acl.MatchTypeUnknown) - require.Equal(t, eacl.MatchFromV2(v2acl.MatchTypeStringNotEqual+1), eacl.MatchUnknown) - }) -} - -func TestFilterHeaderType(t *testing.T) { - t.Run("known header types", func(t *testing.T) { - for i := eacl.HeaderTypeUnknown; i <= eacl.HeaderFromService; i++ { - require.Equal(t, eqV2HeaderTypes[i], i.ToV2()) - require.Equal(t, eacl.FilterHeaderTypeFromV2(i.ToV2()), i) - } - }) - - t.Run("unknown header types", func(t *testing.T) { - require.Equal(t, (eacl.HeaderFromService + 1).ToV2(), v2acl.HeaderTypeUnknown) - require.Equal(t, eacl.FilterHeaderTypeFromV2(v2acl.HeaderTypeService+1), eacl.HeaderTypeUnknown) - }) -} - -type enumIface interface { - FromString(string) bool - String() string -} - -type enumStringItem struct { - val enumIface - str string -} - -func testEnumStrings(t *testing.T, e enumIface, items []enumStringItem) { - for _, item := range items { - require.Equal(t, item.str, item.val.String()) - - s := item.val.String() - - require.True(t, e.FromString(s), s) - - require.EqualValues(t, item.val, e, item.val) - } - - // incorrect strings - for _, str := range []string{ - "some string", - "UNSPECIFIED", - } { - require.False(t, e.FromString(str)) - } -} - -func TestAction_String(t *testing.T) { - toPtr := func(v eacl.Action) *eacl.Action { - return &v - } - - testEnumStrings(t, new(eacl.Action), []enumStringItem{ - {val: toPtr(eacl.ActionAllow), str: "ALLOW"}, - {val: toPtr(eacl.ActionDeny), str: "DENY"}, - {val: toPtr(eacl.ActionUnknown), str: "ACTION_UNSPECIFIED"}, - }) -} - -func TestRole_String(t *testing.T) { - toPtr := func(v eacl.Role) *eacl.Role { - return &v - } - - testEnumStrings(t, new(eacl.Role), []enumStringItem{ - {val: toPtr(eacl.RoleUser), str: "USER"}, - {val: toPtr(eacl.RoleSystem), str: "SYSTEM"}, - {val: toPtr(eacl.RoleOthers), str: "OTHERS"}, - {val: toPtr(eacl.RoleUnknown), str: "ROLE_UNSPECIFIED"}, - }) -} - -func TestOperation_String(t *testing.T) { - toPtr := func(v eacl.Operation) *eacl.Operation { - return &v - } - - testEnumStrings(t, new(eacl.Operation), []enumStringItem{ - {val: toPtr(eacl.OperationGet), str: "GET"}, - {val: toPtr(eacl.OperationPut), str: "PUT"}, - {val: toPtr(eacl.OperationHead), str: "HEAD"}, - {val: toPtr(eacl.OperationDelete), str: "DELETE"}, - {val: toPtr(eacl.OperationSearch), str: "SEARCH"}, - {val: toPtr(eacl.OperationRange), str: "GETRANGE"}, - {val: toPtr(eacl.OperationRangeHash), str: "GETRANGEHASH"}, - {val: toPtr(eacl.OperationUnknown), str: "OPERATION_UNSPECIFIED"}, - }) -} - -func TestMatch_String(t *testing.T) { - toPtr := func(v eacl.Match) *eacl.Match { - return &v - } - - testEnumStrings(t, new(eacl.Match), []enumStringItem{ - {val: toPtr(eacl.MatchStringEqual), str: "STRING_EQUAL"}, - {val: toPtr(eacl.MatchStringNotEqual), str: "STRING_NOT_EQUAL"}, - {val: toPtr(eacl.MatchUnknown), str: "MATCH_TYPE_UNSPECIFIED"}, - }) -} - -func TestFilterHeaderType_String(t *testing.T) { - toPtr := func(v eacl.FilterHeaderType) *eacl.FilterHeaderType { - return &v - } - - testEnumStrings(t, new(eacl.FilterHeaderType), []enumStringItem{ - {val: toPtr(eacl.HeaderFromRequest), str: "REQUEST"}, - {val: toPtr(eacl.HeaderFromObject), str: "OBJECT"}, - {val: toPtr(eacl.HeaderTypeUnknown), str: "HEADER_UNSPECIFIED"}, - }) -} diff --git a/pkg/acl/eacl/filter.go b/pkg/acl/eacl/filter.go deleted file mode 100644 index 23e7677..0000000 --- a/pkg/acl/eacl/filter.go +++ /dev/null @@ -1,186 +0,0 @@ -package eacl - -import ( - "fmt" - "strconv" - - v2acl "github.com/nspcc-dev/neofs-api-go/v2/acl" -) - -// Filter defines check conditions if request header is matched or not. Matched -// header means that request should be processed according to EACL action. -// -// Filter is compatible with v2 acl.EACLRecord.Filter message. -type Filter struct { - from FilterHeaderType - matcher Match - key filterKey - value fmt.Stringer -} - -type staticStringer string - -type u64Stringer uint64 - -type filterKey struct { - typ filterKeyType - - str string -} - -// enumeration of reserved filter keys. -type filterKeyType int - -const ( - _ filterKeyType = iota - fKeyObjVersion - fKeyObjID - fKeyObjContainerID - fKeyObjOwnerID - fKeyObjCreationEpoch - fKeyObjPayloadLength - fKeyObjPayloadHash - fKeyObjType - fKeyObjHomomorphicHash -) - -func (s staticStringer) String() string { - return string(s) -} - -func (u u64Stringer) String() string { - return strconv.FormatUint(uint64(u), 10) -} - -// Value returns filtered string value. -func (f Filter) Value() string { - return f.value.String() -} - -// Matcher returns filter Match type. -func (f Filter) Matcher() Match { - return f.matcher -} - -// Key returns key to the filtered header. -func (f Filter) Key() string { - return f.key.String() -} - -// From returns FilterHeaderType that defined which header will be filtered. -func (f Filter) From() FilterHeaderType { - return f.from -} - -// ToV2 converts Filter to v2 acl.EACLRecord.Filter message. -// -// Nil Filter converts to nil. -func (f *Filter) ToV2() *v2acl.HeaderFilter { - if f == nil { - return nil - } - - filter := new(v2acl.HeaderFilter) - filter.SetValue(f.value.String()) - filter.SetKey(f.key.String()) - filter.SetMatchType(f.matcher.ToV2()) - filter.SetHeaderType(f.from.ToV2()) - - return filter -} - -func (k filterKey) String() string { - switch k.typ { - default: - return k.str - case fKeyObjVersion: - return v2acl.FilterObjectVersion - case fKeyObjID: - return v2acl.FilterObjectID - case fKeyObjContainerID: - return v2acl.FilterObjectContainerID - case fKeyObjOwnerID: - return v2acl.FilterObjectOwnerID - case fKeyObjCreationEpoch: - return v2acl.FilterObjectCreationEpoch - case fKeyObjPayloadLength: - return v2acl.FilterObjectPayloadLength - case fKeyObjPayloadHash: - return v2acl.FilterObjectPayloadHash - case fKeyObjType: - return v2acl.FilterObjectType - case fKeyObjHomomorphicHash: - return v2acl.FilterObjectHomomorphicHash - } -} - -// NewFilter creates, initializes and returns blank Filter instance. -// -// Defaults: -// - header type: HeaderTypeUnknown; -// - matcher: MatchUnknown; -// - key: ""; -// - value: "". -func NewFilter() *Filter { - return NewFilterFromV2(new(v2acl.HeaderFilter)) -} - -// NewFilterFromV2 converts v2 acl.EACLRecord.Filter message to Filter. -func NewFilterFromV2(filter *v2acl.HeaderFilter) *Filter { - f := new(Filter) - - if filter == nil { - return f - } - - f.from = FilterHeaderTypeFromV2(filter.GetHeaderType()) - f.matcher = MatchFromV2(filter.GetMatchType()) - f.key.str = filter.GetKey() - f.value = staticStringer(filter.GetValue()) - - return f -} - -// Marshal marshals Filter into a protobuf binary form. -// -// Buffer is allocated when the argument is empty. -// Otherwise, the first buffer is used. -func (f *Filter) Marshal(b ...[]byte) ([]byte, error) { - var buf []byte - if len(b) > 0 { - buf = b[0] - } - - return f.ToV2(). - StableMarshal(buf) -} - -// Unmarshal unmarshals protobuf binary representation of Filter. -func (f *Filter) Unmarshal(data []byte) error { - fV2 := new(v2acl.HeaderFilter) - if err := fV2.Unmarshal(data); err != nil { - return err - } - - *f = *NewFilterFromV2(fV2) - - return nil -} - -// MarshalJSON encodes Filter to protobuf JSON format. -func (f *Filter) MarshalJSON() ([]byte, error) { - return f.ToV2(). - MarshalJSON() -} - -// UnmarshalJSON decodes Filter from protobuf JSON format. -func (f *Filter) UnmarshalJSON(data []byte) error { - fV2 := new(v2acl.HeaderFilter) - if err := fV2.UnmarshalJSON(data); err != nil { - return err - } - - *f = *NewFilterFromV2(fV2) - - return nil -} diff --git a/pkg/acl/eacl/filter_test.go b/pkg/acl/eacl/filter_test.go deleted file mode 100644 index 9a471d0..0000000 --- a/pkg/acl/eacl/filter_test.go +++ /dev/null @@ -1,88 +0,0 @@ -package eacl - -import ( - "testing" - - "github.com/nspcc-dev/neofs-api-go/v2/acl" - v2acl "github.com/nspcc-dev/neofs-api-go/v2/acl" - "github.com/stretchr/testify/require" -) - -func newObjectFilter(match Match, key, val string) *Filter { - return &Filter{ - from: HeaderFromObject, - key: filterKey{ - str: key, - }, - matcher: match, - value: staticStringer(val), - } -} - -func TestFilter(t *testing.T) { - filter := newObjectFilter(MatchStringEqual, "some name", "200") - - v2 := filter.ToV2() - require.NotNil(t, v2) - require.Equal(t, v2acl.HeaderTypeObject, v2.GetHeaderType()) - require.EqualValues(t, v2acl.MatchTypeStringEqual, v2.GetMatchType()) - require.Equal(t, filter.Key(), v2.GetKey()) - require.Equal(t, filter.Value(), v2.GetValue()) - - newFilter := NewFilterFromV2(v2) - require.Equal(t, filter, newFilter) - - t.Run("from nil v2 filter", func(t *testing.T) { - require.Equal(t, new(Filter), NewFilterFromV2(nil)) - }) -} - -func TestFilterEncoding(t *testing.T) { - f := newObjectFilter(MatchStringEqual, "key", "value") - - t.Run("binary", func(t *testing.T) { - data, err := f.Marshal() - require.NoError(t, err) - - f2 := NewFilter() - require.NoError(t, f2.Unmarshal(data)) - - require.Equal(t, f, f2) - }) - - t.Run("json", func(t *testing.T) { - data, err := f.MarshalJSON() - require.NoError(t, err) - - d2 := NewFilter() - require.NoError(t, d2.UnmarshalJSON(data)) - - require.Equal(t, f, d2) - }) -} - -func TestFilter_ToV2(t *testing.T) { - t.Run("nil", func(t *testing.T) { - var x *Filter - - require.Nil(t, x.ToV2()) - }) - - t.Run("default values", func(t *testing.T) { - filter := NewFilter() - - // check initial values - require.Empty(t, filter.Key()) - require.Empty(t, filter.Value()) - require.Equal(t, HeaderTypeUnknown, filter.From()) - require.Equal(t, MatchUnknown, filter.Matcher()) - - // convert to v2 message - filterV2 := filter.ToV2() - - require.Empty(t, filterV2.GetKey()) - require.Empty(t, filterV2.GetValue()) - require.Equal(t, acl.HeaderTypeUnknown, filterV2.GetHeaderType()) - require.Equal(t, acl.MatchTypeUnknown, filterV2.GetMatchType()) - }) -} diff --git a/pkg/acl/eacl/record.go b/pkg/acl/eacl/record.go deleted file mode 100644 index b12d52a..0000000 --- a/pkg/acl/eacl/record.go +++ /dev/null @@ -1,284 +0,0 @@ -package eacl - -import ( - "crypto/ecdsa" - "fmt" - - "github.com/nspcc-dev/neofs-api-go/pkg" - cid "github.com/nspcc-dev/neofs-api-go/pkg/container/id" - "github.com/nspcc-dev/neofs-api-go/pkg/object" - "github.com/nspcc-dev/neofs-api-go/pkg/owner" - v2acl "github.com/nspcc-dev/neofs-api-go/v2/acl" -) - -// Record of the EACL rule, that defines EACL action, targets for this action, -// object service operation and filters for request headers. -// -// Record is compatible with v2 acl.EACLRecord message. -type Record struct { - action Action - operation Operation - filters []*Filter - targets []*Target -} - -// Targets returns list of target subjects to apply ACL rule to. -func (r Record) Targets() []*Target { - return r.targets -} - -// SetTargets sets list of target subjects to apply ACL rule to. -func (r *Record) SetTargets(targets ...*Target) { - r.targets = targets -} - -// Filters returns list of filters to match and see if rule is applicable. -func (r Record) Filters() []*Filter { - return r.filters -} - -// Operation returns NeoFS request verb to match. -func (r Record) Operation() Operation { - return r.operation -} - -// SetOperation sets NeoFS request verb to match. -func (r *Record) SetOperation(operation Operation) { - r.operation = operation -} - -// Action returns rule execution result. -func (r Record) Action() Action { - return r.action -} - -// SetAction sets rule execution result. -func (r *Record) SetAction(action Action) { - r.action = action -} - -// AddTarget adds target subject with specified Role and key list. -// -// Deprecated: use AddFormedTarget instead. -func (r *Record) AddTarget(role Role, keys ...ecdsa.PublicKey) { - AddFormedTarget(r, role, keys...) -} - -// AddRecordTarget adds single Target to the Record. -func AddRecordTarget(r *Record, t *Target) { - r.SetTargets(append(r.Targets(), t)...) -} - -// AddFormedTarget forms Target with specified Role and list of -// ECDSA public keys and adds it to the Record. -func AddFormedTarget(r *Record, role Role, keys ...ecdsa.PublicKey) { - t := NewTarget() - t.SetRole(role) - SetTargetECDSAKeys(t, ecdsaKeysToPtrs(keys)...) - - AddRecordTarget(r, t) -} - -func (r *Record) addFilter(from FilterHeaderType, m Match, keyTyp filterKeyType, key string, val fmt.Stringer) { - filter := &Filter{ - from: from, - key: filterKey{ - typ: keyTyp, - str: key, - }, - matcher: m, - value: val, - } - - r.filters = append(r.filters, filter) -} - -func (r *Record) addObjectFilter(m Match, keyTyp filterKeyType, key string, val fmt.Stringer) { - r.addFilter(HeaderFromObject, m, keyTyp, key, val) -} - -func (r *Record) addObjectReservedFilter(m Match, typ filterKeyType, val fmt.Stringer) { - r.addObjectFilter(m, typ, "", val) -} - -// AddFilter adds generic filter. -func (r *Record) AddFilter(from FilterHeaderType, matcher Match, name, value string) { - r.addFilter(from, matcher, 0, name, staticStringer(value)) -} - -// AddObjectAttributeFilter adds filter by object attribute. -func (r *Record) AddObjectAttributeFilter(m Match, key, value string) { - r.addObjectFilter(m, 0, key, staticStringer(value)) -} - -// AddObjectVersionFilter adds filter by object version. -func (r *Record) AddObjectVersionFilter(m Match, v *pkg.Version) { - r.addObjectReservedFilter(m, fKeyObjVersion, v) -} - -// AddObjectIDFilter adds filter by object ID. -func (r *Record) AddObjectIDFilter(m Match, id *object.ID) { - r.addObjectReservedFilter(m, fKeyObjID, id) -} - -// AddObjectContainerIDFilter adds filter by object container ID. -func (r *Record) AddObjectContainerIDFilter(m Match, id *cid.ID) { - r.addObjectReservedFilter(m, fKeyObjContainerID, id) -} - -// AddObjectOwnerIDFilter adds filter by object owner ID. -func (r *Record) AddObjectOwnerIDFilter(m Match, id *owner.ID) { - r.addObjectReservedFilter(m, fKeyObjOwnerID, id) -} - -// AddObjectCreationEpoch adds filter by object creation epoch. -func (r *Record) AddObjectCreationEpoch(m Match, epoch uint64) { - r.addObjectReservedFilter(m, fKeyObjCreationEpoch, u64Stringer(epoch)) -} - -// AddObjectPayloadLengthFilter adds filter by object payload length. -func (r *Record) AddObjectPayloadLengthFilter(m Match, size uint64) { - r.addObjectReservedFilter(m, fKeyObjPayloadLength, u64Stringer(size)) -} - -// AddObjectPayloadHashFilter adds filter by object payload hash value. -func (r *Record) AddObjectPayloadHashFilter(m Match, h *pkg.Checksum) { - r.addObjectReservedFilter(m, fKeyObjPayloadHash, h) -} - -// AddObjectTypeFilter adds filter by object type. -func (r *Record) AddObjectTypeFilter(m Match, t object.Type) { - r.addObjectReservedFilter(m, fKeyObjType, t) -} - -// AddObjectHomomorphicHashFilter adds filter by object payload homomorphic hash value. -func (r *Record) AddObjectHomomorphicHashFilter(m Match, h *pkg.Checksum) { - r.addObjectReservedFilter(m, fKeyObjHomomorphicHash, h) -} - -// ToV2 converts Record to v2 acl.EACLRecord message. -// -// Nil Record converts to nil. -func (r *Record) ToV2() *v2acl.Record { - if r == nil { - return nil - } - - v2 := new(v2acl.Record) - - if r.targets != nil { - targets := make([]*v2acl.Target, 0, len(r.targets)) - for _, target := range r.targets { - targets = append(targets, target.ToV2()) - } - - v2.SetTargets(targets) - } - - if r.filters != nil { - filters := make([]*v2acl.HeaderFilter, 0, len(r.filters)) - for _, filter := range r.filters { - filters = append(filters, filter.ToV2()) - } - - v2.SetFilters(filters) - } - - v2.SetAction(r.action.ToV2()) - v2.SetOperation(r.operation.ToV2()) - - return v2 -} - -// NewRecord creates and returns blank Record instance. -// -// Defaults: -// - action: ActionUnknown; -// - operation: OperationUnknown; -// - targets: nil, -// - filters: nil. -func NewRecord() *Record { - return new(Record) -} - -// CreateRecord creates, initializes with parameters and returns Record instance. -func CreateRecord(action Action, operation Operation) *Record { - r := NewRecord() - r.action = action - r.operation = operation - r.targets = []*Target{} - r.filters = []*Filter{} - - return r -} - -// NewRecordFromV2 converts v2 acl.EACLRecord message to Record. -func NewRecordFromV2(record *v2acl.Record) *Record { - r := NewRecord() - - if record == nil { - return r - } - - r.action = ActionFromV2(record.GetAction()) - r.operation = OperationFromV2(record.GetOperation()) - - v2targets := record.GetTargets() - v2filters := record.GetFilters() - - r.targets = make([]*Target, 0, len(v2targets)) - for i := range v2targets { - r.targets = append(r.targets, NewTargetFromV2(v2targets[i])) - } - - r.filters = make([]*Filter, 0, len(v2filters)) - for i := range v2filters { - r.filters = append(r.filters, NewFilterFromV2(v2filters[i])) - } - - return r -} - -// Marshal marshals Record into a protobuf binary form. -// -// Buffer is allocated when the argument is empty. -// Otherwise, the first buffer is used. -func (r *Record) Marshal(b ...[]byte) ([]byte, error) { - var buf []byte - if len(b) > 0 { - buf = b[0] - } - - return r.ToV2(). - StableMarshal(buf) -} - -// Unmarshal unmarshals protobuf binary representation of Record. -func (r *Record) Unmarshal(data []byte) error { - fV2 := new(v2acl.Record) - if err := fV2.Unmarshal(data); err != nil { - return err - } - - *r = *NewRecordFromV2(fV2) - - return nil -} - -// MarshalJSON encodes Record to protobuf JSON format. -func (r *Record) MarshalJSON() ([]byte, error) { - return r.ToV2(). - MarshalJSON() -} - -// UnmarshalJSON decodes Record from protobuf JSON format. -func (r *Record) UnmarshalJSON(data []byte) error { - tV2 := new(v2acl.Record) - if err := tV2.UnmarshalJSON(data); err != nil { - return err - } - - *r = *NewRecordFromV2(tV2) - - return nil -} diff --git a/pkg/acl/eacl/record_test.go b/pkg/acl/eacl/record_test.go deleted file mode 100644 index 1baaf4a..0000000 --- a/pkg/acl/eacl/record_test.go +++ /dev/null @@ -1,250 +0,0 @@ -package eacl - -import ( - "crypto/ecdsa" - "fmt" - "testing" - - cidtest "github.com/nspcc-dev/neofs-api-go/pkg/container/id/test" - "github.com/nspcc-dev/neofs-api-go/pkg/object" - objecttest "github.com/nspcc-dev/neofs-api-go/pkg/object/test" - ownertest "github.com/nspcc-dev/neofs-api-go/pkg/owner/test" - refstest "github.com/nspcc-dev/neofs-api-go/pkg/test" - v2acl "github.com/nspcc-dev/neofs-api-go/v2/acl" - "github.com/nspcc-dev/neofs-crypto/test" - "github.com/stretchr/testify/require" -) - -func TestRecord(t *testing.T) { - record := NewRecord() - record.SetOperation(OperationRange) - record.SetAction(ActionAllow) - record.AddFilter(HeaderFromRequest, MatchStringEqual, "A", "B") - record.AddFilter(HeaderFromRequest, MatchStringNotEqual, "C", "D") - - target := NewTarget() - target.SetRole(RoleSystem) - AddRecordTarget(record, target) - - v2 := record.ToV2() - require.NotNil(t, v2) - require.Equal(t, v2acl.OperationRange, v2.GetOperation()) - require.Equal(t, v2acl.ActionAllow, v2.GetAction()) - require.Len(t, v2.GetFilters(), len(record.Filters())) - require.Len(t, v2.GetTargets(), len(record.Targets())) - - newRecord := NewRecordFromV2(v2) - require.Equal(t, record, newRecord) - - t.Run("create record", func(t *testing.T) { - record := CreateRecord(ActionAllow, OperationGet) - require.Equal(t, ActionAllow, record.Action()) - require.Equal(t, OperationGet, record.Operation()) - }) - - t.Run("new from nil v2 record", func(t *testing.T) { - require.Equal(t, new(Record), NewRecordFromV2(nil)) - }) -} - -func TestAddFormedTarget(t *testing.T) { - items := []struct { - role Role - keys []ecdsa.PublicKey - }{ - { - role: RoleUnknown, - keys: []ecdsa.PublicKey{test.DecodeKey(1).PublicKey}, - }, - { - role: RoleSystem, - keys: []ecdsa.PublicKey{}, - }, - } - - targets := make([]*Target, 0, len(items)) - - r := NewRecord() - - for _, item := range items { - tgt := NewTarget() - tgt.SetRole(item.role) - SetTargetECDSAKeys(tgt, ecdsaKeysToPtrs(item.keys)...) - - targets = append(targets, tgt) - - AddFormedTarget(r, item.role, item.keys...) - } - - tgts := r.Targets() - require.Len(t, tgts, len(targets)) - - for _, tgt := range targets { - require.Contains(t, tgts, tgt) - } -} - -func TestRecord_AddFilter(t *testing.T) { - filters := []*Filter{ - newObjectFilter(MatchStringEqual, "some name", "ContainerID"), - newObjectFilter(MatchStringNotEqual, "X-Header-Name", "X-Header-Value"), - } - - r := NewRecord() - for _, filter := range filters { - r.AddFilter(filter.From(), filter.Matcher(), filter.Key(), filter.Value()) - } - - require.Equal(t, filters, r.Filters()) -} - -func TestRecordEncoding(t *testing.T) { - r := NewRecord() - r.SetOperation(OperationHead) - r.SetAction(ActionDeny) - r.AddObjectAttributeFilter(MatchStringEqual, "key", "value") - AddFormedTarget(r, RoleSystem, test.DecodeKey(-1).PublicKey) - - t.Run("binary", func(t *testing.T) { - data, err := r.Marshal() - require.NoError(t, err) - - r2 := NewRecord() - require.NoError(t, r2.Unmarshal(data)) - - require.Equal(t, r, r2) - }) - - t.Run("json", func(t *testing.T) { - data, err := r.MarshalJSON() - require.NoError(t, err) - - r2 := NewRecord() - require.NoError(t, r2.UnmarshalJSON(data)) - - require.Equal(t, r, r2) - }) -} - -func TestRecord_ToV2(t *testing.T) { - t.Run("nil", func(t *testing.T) { - var x *Record - - require.Nil(t, x.ToV2()) - }) - - t.Run("default values", func(t *testing.T) { - record := NewRecord() - - // check initial values - require.Equal(t, OperationUnknown, record.Operation()) - require.Equal(t, ActionUnknown, record.Action()) - require.Nil(t, record.Targets()) - require.Nil(t, record.Filters()) - - // convert to v2 message - recordV2 := record.ToV2() - - require.Equal(t, v2acl.OperationUnknown, recordV2.GetOperation()) - require.Equal(t, v2acl.ActionUnknown, recordV2.GetAction()) - require.Nil(t, recordV2.GetTargets()) - require.Nil(t, recordV2.GetFilters()) - }) -} - -func TestReservedRecords(t *testing.T) { - var ( - v = refstest.Version() - oid = objecttest.ID() - cid = cidtest.Generate() - ownerid = ownertest.Generate() - h = refstest.Checksum() - typ = new(object.Type) - ) - - testSuit := []struct { - f func(r *Record) - key string - value string - }{ - { - f: func(r *Record) { r.AddObjectAttributeFilter(MatchStringEqual, "foo", "bar") }, - key: "foo", - value: "bar", - }, - { - f: func(r *Record) { r.AddObjectVersionFilter(MatchStringEqual, v) }, - key: v2acl.FilterObjectVersion, - value: v.String(), - }, - { - f: func(r *Record) { r.AddObjectIDFilter(MatchStringEqual, oid) }, - key: v2acl.FilterObjectID, - value: oid.String(), - }, - { - f: func(r *Record) { r.AddObjectContainerIDFilter(MatchStringEqual, cid) }, - key: v2acl.FilterObjectContainerID, - value: cid.String(), - }, - { - f: func(r *Record) { r.AddObjectOwnerIDFilter(MatchStringEqual, ownerid) }, - key: v2acl.FilterObjectOwnerID, - value: ownerid.String(), - }, - { - f: func(r *Record) { r.AddObjectCreationEpoch(MatchStringEqual, 100) }, - key: v2acl.FilterObjectCreationEpoch, - value: "100", - }, - { - f: func(r *Record) { r.AddObjectPayloadLengthFilter(MatchStringEqual, 5000) }, - key: v2acl.FilterObjectPayloadLength, - value: "5000", - }, - { - f: func(r *Record) { r.AddObjectPayloadHashFilter(MatchStringEqual, h) }, - key: v2acl.FilterObjectPayloadHash, - value: h.String(), - }, - { - f: func(r *Record) { r.AddObjectHomomorphicHashFilter(MatchStringEqual, h) }, - key: v2acl.FilterObjectHomomorphicHash, - value: h.String(), - }, - { - f: func(r *Record) { - require.True(t, typ.FromString("REGULAR")) - r.AddObjectTypeFilter(MatchStringEqual, *typ) - }, - key: v2acl.FilterObjectType, - value: "REGULAR", - }, - { - f: func(r *Record) { - require.True(t, typ.FromString("TOMBSTONE")) - r.AddObjectTypeFilter(MatchStringEqual, *typ) - }, - key: v2acl.FilterObjectType, - value: "TOMBSTONE", - }, - { - f: func(r *Record) { - require.True(t, typ.FromString("STORAGE_GROUP")) - r.AddObjectTypeFilter(MatchStringEqual, *typ) - }, - key: v2acl.FilterObjectType, - value: "STORAGE_GROUP", - }, - } - - for n, testCase := range testSuit { - desc := fmt.Sprintf("case #%d", n) - record := NewRecord() - testCase.f(record) - require.Len(t, record.Filters(), 1, desc) - f := record.Filters()[0] - require.Equal(t, f.Key(), testCase.key, desc) - require.Equal(t, f.Value(), testCase.value, desc) - } -} diff --git a/pkg/acl/eacl/table.go b/pkg/acl/eacl/table.go deleted file mode 100644 index 81bee1a..0000000 --- a/pkg/acl/eacl/table.go +++ /dev/null @@ -1,210 +0,0 @@ -package eacl - -import ( - "crypto/sha256" - - "github.com/nspcc-dev/neofs-api-go/pkg" - cid "github.com/nspcc-dev/neofs-api-go/pkg/container/id" - "github.com/nspcc-dev/neofs-api-go/pkg/session" - v2acl "github.com/nspcc-dev/neofs-api-go/v2/acl" -) - -// Table is a group of EACL records for single container. -// -// Table is compatible with v2 acl.EACLTable message. -type Table struct { - version pkg.Version - cid *cid.ID - token *session.Token - sig *pkg.Signature - records []*Record -} - -// CID returns identifier of the container that should use given access control rules. -func (t Table) CID() *cid.ID { - return t.cid -} - -// SetCID sets identifier of the container that should use given access control rules. -func (t *Table) SetCID(cid *cid.ID) { - t.cid = cid -} - -// Version returns version of eACL format. -func (t Table) Version() pkg.Version { - return t.version -} - -// SetVersion sets version of eACL format. -func (t *Table) SetVersion(version pkg.Version) { - t.version = version -} - -// Records returns list of extended ACL rules. -func (t Table) Records() []*Record { - return t.records -} - -// AddRecord adds single eACL rule. -func (t *Table) AddRecord(r *Record) { - if r != nil { - t.records = append(t.records, r) - } -} - -// SessionToken returns token of the session -// within which Table was set. -func (t Table) SessionToken() *session.Token { - return t.token -} - -// SetSessionToken sets token of the session -// within which Table was set. -func (t *Table) SetSessionToken(tok *session.Token) { - t.token = tok -} - -// Signature returns Table signature. -func (t Table) Signature() *pkg.Signature { - return t.sig -} - -// SetSignature sets Table signature. -func (t *Table) SetSignature(sig *pkg.Signature) { - t.sig = sig -} - -// ToV2 converts Table to v2 acl.EACLTable message. -// -// Nil Table converts to nil. -func (t *Table) ToV2() *v2acl.Table { - if t == nil { - return nil - } - - v2 := new(v2acl.Table) - - if t.cid != nil { - v2.SetContainerID(t.cid.ToV2()) - } - - if t.records != nil { - records := make([]*v2acl.Record, 0, len(t.records)) - for _, record := range t.records { - records = append(records, record.ToV2()) - } - - v2.SetRecords(records) - } - - v2.SetVersion(t.version.ToV2()) - - return v2 -} - -// NewTable creates, initializes and returns blank Table instance. -// -// Defaults: -// - version: pkg.SDKVersion(); -// - container ID: nil; -// - records: nil; -// - session token: nil; -// - signature: nil. -func NewTable() *Table { - t := new(Table) - t.SetVersion(*pkg.SDKVersion()) - - return t -} - -// CreateTable creates, initializes with parameters and returns Table instance. -func CreateTable(cid cid.ID) *Table { - t := NewTable() - t.SetCID(&cid) - - return t -} - -// NewTableFromV2 converts v2 acl.EACLTable message to Table. -func NewTableFromV2(table *v2acl.Table) *Table { - t := new(Table) - - if table == nil { - return t - } - - // set version - if v := table.GetVersion(); v != nil { - version := pkg.Version{} - version.SetMajor(v.GetMajor()) - version.SetMinor(v.GetMinor()) - - t.SetVersion(version) - } - - // set container id - if id := table.GetContainerID(); id != nil { - if t.cid == nil { - t.cid = new(cid.ID) - } - - var h [sha256.Size]byte - - copy(h[:], id.GetValue()) - t.cid.SetSHA256(h) - } - - // set eacl records - v2records := table.GetRecords() - t.records = make([]*Record, 0, len(v2records)) - - for i := range v2records { - t.records = append(t.records, NewRecordFromV2(v2records[i])) - } - - return t -} - -// Marshal marshals Table into a protobuf binary form. -// -// Buffer is allocated when the argument is empty. -// Otherwise, the first buffer is used. -func (t *Table) Marshal(b ...[]byte) ([]byte, error) { - var buf []byte - if len(b) > 0 { - buf = b[0] - } - - return t.ToV2(). - StableMarshal(buf) -} - -// Unmarshal unmarshals protobuf binary representation of Table. -func (t *Table) Unmarshal(data []byte) error { - fV2 := new(v2acl.Table) - if err := fV2.Unmarshal(data); err != nil { - return err - } - - *t = *NewTableFromV2(fV2) - - return nil -} - -// MarshalJSON encodes Table to protobuf JSON format. -func (t *Table) MarshalJSON() ([]byte, error) { - return t.ToV2(). - MarshalJSON() -} - -// UnmarshalJSON decodes Table from protobuf JSON format. -func (t *Table) UnmarshalJSON(data []byte) error { - tV2 := new(v2acl.Table) - if err := tV2.UnmarshalJSON(data); err != nil { - return err - } - - *t = *NewTableFromV2(tV2) - - return nil -} diff --git a/pkg/acl/eacl/table_test.go b/pkg/acl/eacl/table_test.go deleted file mode 100644 index 6dcf062..0000000 --- a/pkg/acl/eacl/table_test.go +++ /dev/null @@ -1,138 +0,0 @@ -package eacl_test - -import ( - "crypto/sha256" - "testing" - - "github.com/nspcc-dev/neofs-api-go/pkg" - "github.com/nspcc-dev/neofs-api-go/pkg/acl/eacl" - eacltest "github.com/nspcc-dev/neofs-api-go/pkg/acl/eacl/test" - cidtest "github.com/nspcc-dev/neofs-api-go/pkg/container/id/test" - sessiontest "github.com/nspcc-dev/neofs-api-go/pkg/session/test" - "github.com/stretchr/testify/require" -) - -func TestTable(t *testing.T) { - var ( - v pkg.Version - ) - - sha := sha256.Sum256([]byte("container id")) - id := cidtest.GenerateWithChecksum(sha) - - v.SetMajor(3) - v.SetMinor(2) - - table := eacl.NewTable() - table.SetVersion(v) - table.SetCID(id) - table.AddRecord(eacl.CreateRecord(eacl.ActionAllow, eacl.OperationPut)) - - v2 := table.ToV2() - require.NotNil(t, v2) - require.Equal(t, uint32(3), v2.GetVersion().GetMajor()) - require.Equal(t, uint32(2), v2.GetVersion().GetMinor()) - require.Equal(t, sha[:], v2.GetContainerID().GetValue()) - require.Len(t, v2.GetRecords(), 1) - - newTable := eacl.NewTableFromV2(v2) - require.Equal(t, table, newTable) - - t.Run("new from nil v2 table", func(t *testing.T) { - require.Equal(t, new(eacl.Table), eacl.NewTableFromV2(nil)) - }) - - t.Run("create table", func(t *testing.T) { - id := cidtest.Generate() - - table := eacl.CreateTable(*id) - require.Equal(t, id, table.CID()) - require.Equal(t, *pkg.SDKVersion(), table.Version()) - }) -} - -func TestTable_AddRecord(t *testing.T) { - records := []*eacl.Record{ - eacl.CreateRecord(eacl.ActionDeny, eacl.OperationDelete), - eacl.CreateRecord(eacl.ActionAllow, eacl.OperationPut), - } - - table := eacl.NewTable() - for _, record := range records { - table.AddRecord(record) - } - - require.Equal(t, records, table.Records()) -} - -func TestTableEncoding(t *testing.T) { - tab := eacltest.Table() - - t.Run("binary", func(t *testing.T) { - data, err := tab.Marshal() - require.NoError(t, err) - - tab2 := eacl.NewTable() - require.NoError(t, tab2.Unmarshal(data)) - - // FIXME: we compare v2 messages because - // Filter contains fmt.Stringer interface - require.Equal(t, tab.ToV2(), tab2.ToV2()) - }) - - t.Run("json", func(t *testing.T) { - data, err := tab.MarshalJSON() - require.NoError(t, err) - - tab2 := eacl.NewTable() - require.NoError(t, tab2.UnmarshalJSON(data)) - - require.Equal(t, tab.ToV2(), tab2.ToV2()) - }) -} - -func TestTable_SessionToken(t *testing.T) { - tok := sessiontest.Generate() - - table := eacl.NewTable() - table.SetSessionToken(tok) - - require.Equal(t, tok, table.SessionToken()) -} - -func TestTable_Signature(t *testing.T) { - sig := pkg.NewSignature() - sig.SetKey([]byte{1, 2, 3}) - sig.SetSign([]byte{4, 5, 6}) - - table := eacl.NewTable() - table.SetSignature(sig) - - require.Equal(t, sig, table.Signature()) -} - -func TestTable_ToV2(t *testing.T) { - t.Run("nil", func(t *testing.T) { - var x *eacl.Table - - require.Nil(t, x.ToV2()) - }) - - t.Run("default values", func(t *testing.T) { - table := eacl.NewTable() - - // check initial values - require.Equal(t, *pkg.SDKVersion(), table.Version()) - require.Nil(t, table.Records()) - require.Nil(t, table.CID()) - require.Nil(t, table.SessionToken()) - require.Nil(t, table.Signature()) - - // convert to v2 message - tableV2 := table.ToV2() - - require.Equal(t, pkg.SDKVersion().ToV2(), tableV2.GetVersion()) - require.Nil(t, tableV2.GetRecords()) - require.Nil(t, tableV2.GetContainerID()) - }) -} diff --git a/pkg/acl/eacl/target.go b/pkg/acl/eacl/target.go deleted file mode 100644 index 22a2af6..0000000 --- a/pkg/acl/eacl/target.go +++ /dev/null @@ -1,191 +0,0 @@ -package eacl - -import ( - "crypto/ecdsa" - - v2acl "github.com/nspcc-dev/neofs-api-go/v2/acl" - crypto "github.com/nspcc-dev/neofs-crypto" -) - -// Target is a group of request senders to match EACL. Defined by role enum -// and set of public keys. -// -// Target is compatible with v2 acl.EACLRecord.Target message. -type Target struct { - role Role - keys [][]byte -} - -func ecdsaKeysToPtrs(keys []ecdsa.PublicKey) []*ecdsa.PublicKey { - keysPtr := make([]*ecdsa.PublicKey, len(keys)) - - for i := range keys { - keysPtr[i] = &keys[i] - } - - return keysPtr -} - -// SetKeys sets list of ECDSA public keys to identify target subject. -// -// Deprecated: use SetTargetECDSAKeys instead. -func (t *Target) SetKeys(keys ...ecdsa.PublicKey) { - SetTargetECDSAKeys(t, ecdsaKeysToPtrs(keys)...) -} - -// Keys returns list of ECDSA public keys to identify target subject. -// If some key has a different format, it is ignored. -// -// Deprecated: use TargetECDSAKeys instead. -func (t *Target) Keys() []ecdsa.PublicKey { - keysPtr := TargetECDSAKeys(t) - keys := make([]ecdsa.PublicKey, 0, len(keysPtr)) - - for i := range keysPtr { - if keysPtr[i] != nil { - keys = append(keys, *keysPtr[i]) - } - } - - return keys -} - -// BinaryKeys returns list of public keys to identify -// target subject in a binary format. -func (t *Target) BinaryKeys() [][]byte { - return t.keys -} - -// SetBinaryKeys sets list of binary public keys to identify -// target subject. -func (t *Target) SetBinaryKeys(keys [][]byte) { - t.keys = keys -} - -// SetTargetECDSAKeys converts ECDSA public keys to a binary -// format and stores them in Target. -func SetTargetECDSAKeys(t *Target, keys ...*ecdsa.PublicKey) { - binKeys := t.BinaryKeys() - ln := len(keys) - - if cap(binKeys) >= ln { - binKeys = binKeys[:0] - } else { - binKeys = make([][]byte, 0, ln) - } - - for i := 0; i < ln; i++ { - binKeys = append(binKeys, crypto.MarshalPublicKey(keys[i])) - } - - t.SetBinaryKeys(binKeys) -} - -// TargetECDSAKeys interprets binary public keys of Target -// as ECDSA public keys. If any key has a different format, -// the corresponding element will be nil. -func TargetECDSAKeys(t *Target) []*ecdsa.PublicKey { - binKeys := t.BinaryKeys() - ln := len(binKeys) - - keys := make([]*ecdsa.PublicKey, ln) - - for i := 0; i < ln; i++ { - keys[i] = crypto.UnmarshalPublicKey(binKeys[i]) - } - - return keys -} - -// SetRole sets target subject's role class. -func (t *Target) SetRole(r Role) { - t.role = r -} - -// Role returns target subject's role class. -func (t Target) Role() Role { - return t.role -} - -// ToV2 converts Target to v2 acl.EACLRecord.Target message. -// -// Nil Target converts to nil. -func (t *Target) ToV2() *v2acl.Target { - if t == nil { - return nil - } - - target := new(v2acl.Target) - - target.SetRole(t.role.ToV2()) - target.SetKeys(t.keys) - - return target -} - -// NewTarget creates, initializes and returns blank Target instance. -// -// Defaults: -// - role: RoleUnknown; -// - keys: nil. -func NewTarget() *Target { - return NewTargetFromV2(new(v2acl.Target)) -} - -// NewTargetFromV2 converts v2 acl.EACLRecord.Target message to Target. -func NewTargetFromV2(target *v2acl.Target) *Target { - t := new(Target) - - if target == nil { - return t - } - - t.role = RoleFromV2(target.GetRole()) - t.keys = target.GetKeys() - - return t -} - -// Marshal marshals Target into a protobuf binary form. -// -// Buffer is allocated when the argument is empty. -// Otherwise, the first buffer is used. -func (t *Target) Marshal(b ...[]byte) ([]byte, error) { - var buf []byte - if len(b) > 0 { - buf = b[0] - } - - return t.ToV2(). - StableMarshal(buf) -} - -// Unmarshal unmarshals protobuf binary representation of Target. -func (t *Target) Unmarshal(data []byte) error { - fV2 := new(v2acl.Target) - if err := fV2.Unmarshal(data); err != nil { - return err - } - - *t = *NewTargetFromV2(fV2) - - return nil -} - -// MarshalJSON encodes Target to protobuf JSON format. -func (t *Target) MarshalJSON() ([]byte, error) { - return t.ToV2(). - MarshalJSON() -} - -// UnmarshalJSON decodes Target from protobuf JSON format. -func (t *Target) UnmarshalJSON(data []byte) error { - tV2 := new(v2acl.Target) - if err := tV2.UnmarshalJSON(data); err != nil { - return err - } - - *t = *NewTargetFromV2(tV2) - - return nil -} diff --git a/pkg/acl/eacl/target_test.go b/pkg/acl/eacl/target_test.go deleted file mode 100644 index 5fd0e70..0000000 --- a/pkg/acl/eacl/target_test.go +++ /dev/null @@ -1,86 +0,0 @@ -package eacl - -import ( - "crypto/ecdsa" - "testing" - - "github.com/nspcc-dev/neofs-api-go/v2/acl" - v2acl "github.com/nspcc-dev/neofs-api-go/v2/acl" - crypto "github.com/nspcc-dev/neofs-crypto" - "github.com/nspcc-dev/neofs-crypto/test" - "github.com/stretchr/testify/require" -) - -func TestTarget(t *testing.T) { - keys := []*ecdsa.PublicKey{ - &test.DecodeKey(1).PublicKey, - &test.DecodeKey(2).PublicKey, - } - - target := NewTarget() - target.SetRole(RoleSystem) - SetTargetECDSAKeys(target, keys...) - - v2 := target.ToV2() - require.NotNil(t, v2) - require.Equal(t, v2acl.RoleSystem, v2.GetRole()) - require.Len(t, v2.GetKeys(), len(keys)) - for i, key := range v2.GetKeys() { - require.Equal(t, key, crypto.MarshalPublicKey(keys[i])) - } - - newTarget := NewTargetFromV2(v2) - require.Equal(t, target, newTarget) - - t.Run("from nil v2 target", func(t *testing.T) { - require.Equal(t, new(Target), NewTargetFromV2(nil)) - }) -} - -func TestTargetEncoding(t *testing.T) { - tar := NewTarget() - tar.SetRole(RoleSystem) - SetTargetECDSAKeys(tar, &test.DecodeKey(-1).PublicKey) - - t.Run("binary", func(t *testing.T) { - data, err := tar.Marshal() - require.NoError(t, err) - - tar2 := NewTarget() - require.NoError(t, tar2.Unmarshal(data)) - - require.Equal(t, tar, tar2) - }) - - t.Run("json", func(t *testing.T) { - data, err := tar.MarshalJSON() - require.NoError(t, err) - - tar2 := NewTarget() - require.NoError(t, tar2.UnmarshalJSON(data)) - - require.Equal(t, tar, tar2) - }) -} - -func TestTarget_ToV2(t *testing.T) { - t.Run("nil", func(t *testing.T) { - var x *Target - - require.Nil(t, x.ToV2()) - }) - - t.Run("default values", func(t *testing.T) { - target := NewTarget() - - // check initial values - require.Equal(t, RoleUnknown, target.Role()) - require.Nil(t, target.BinaryKeys()) - - // convert to v2 message - targetV2 := target.ToV2() - - require.Equal(t, acl.RoleUnknown, targetV2.GetRole()) - require.Nil(t, targetV2.GetKeys()) - }) -} diff --git a/pkg/acl/eacl/test/generate.go b/pkg/acl/eacl/test/generate.go deleted file mode 100644 index 4eda92a..0000000 --- a/pkg/acl/eacl/test/generate.go +++ /dev/null @@ -1,45 +0,0 @@ -package eacltest - -import ( - "github.com/nspcc-dev/neofs-api-go/pkg/acl/eacl" - cidtest "github.com/nspcc-dev/neofs-api-go/pkg/container/id/test" - ownertest "github.com/nspcc-dev/neofs-api-go/pkg/owner/test" - refstest "github.com/nspcc-dev/neofs-api-go/pkg/test" -) - -// Target returns random eacl.Target. -func Target() *eacl.Target { - x := eacl.NewTarget() - - x.SetRole(eacl.RoleSystem) - x.SetBinaryKeys([][]byte{ - {1, 2, 3}, - {4, 5, 6}, - }) - - return x -} - -// Record returns random eacl.Record. -func Record() *eacl.Record { - x := eacl.NewRecord() - - x.SetAction(eacl.ActionAllow) - x.SetOperation(eacl.OperationRangeHash) - x.SetTargets(Target(), Target()) - x.AddObjectContainerIDFilter(eacl.MatchStringEqual, cidtest.Generate()) - x.AddObjectOwnerIDFilter(eacl.MatchStringNotEqual, ownertest.Generate()) - - return x -} - -func Table() *eacl.Table { - x := eacl.NewTable() - - x.SetCID(cidtest.Generate()) - x.AddRecord(Record()) - x.AddRecord(Record()) - x.SetVersion(*refstest.Version()) - - return x -} diff --git a/pkg/acl/types.go b/pkg/acl/types.go deleted file mode 100644 index 6a7b428..0000000 --- a/pkg/acl/types.go +++ /dev/null @@ -1,15 +0,0 @@ -package acl - -const ( - // PublicBasicRule is a basic ACL value for public-read-write container. - PublicBasicRule = 0x1FBFBFFF - - // PrivateBasicRule is a basic ACL value for private container. - PrivateBasicRule = 0x1C8C8CCC - - // ReadOnlyBasicRule is a basic ACL value for public-read container. - ReadOnlyBasicRule = 0x1FBF8CFF - - // PublicAppendRule is a basic ACL value for public-append container. - PublicAppendRule = 0x1FBF9FFF -) diff --git a/pkg/audit/result.go b/pkg/audit/result.go deleted file mode 100644 index e334e99..0000000 --- a/pkg/audit/result.go +++ /dev/null @@ -1,330 +0,0 @@ -package audit - -import ( - "github.com/nspcc-dev/neofs-api-go/pkg" - cid "github.com/nspcc-dev/neofs-api-go/pkg/container/id" - "github.com/nspcc-dev/neofs-api-go/pkg/object" - "github.com/nspcc-dev/neofs-api-go/v2/audit" - "github.com/nspcc-dev/neofs-api-go/v2/refs" -) - -// Result represents v2-compatible data audit result. -type Result audit.DataAuditResult - -// NewFromV2 wraps v2 DataAuditResult message to Result. -// -// Nil audit.DataAuditResult converts to nil. -func NewResultFromV2(aV2 *audit.DataAuditResult) *Result { - return (*Result)(aV2) -} - -// New creates and initializes blank Result. -// -// Defaults: -// - version: pkg.SDKVersion(); -// - complete: false; -// - cid: nil; -// - pubKey: nil; -// - passSG, failSG: nil; -// - failNodes, passNodes: nil; -// - hit, miss, fail: 0; -// - requests, retries: 0; -// - auditEpoch: 0. -func NewResult() *Result { - r := NewResultFromV2(new(audit.DataAuditResult)) - r.SetVersion(pkg.SDKVersion()) - - return r -} - -// ToV2 converts Result to v2 DataAuditResult message. -// -// Nil Result converts to nil. -func (r *Result) ToV2() *audit.DataAuditResult { - return (*audit.DataAuditResult)(r) -} - -// Marshal marshals Result into a protobuf binary form. -// -// Buffer is allocated when the argument is empty. -// Otherwise, the first buffer is used. -func (r *Result) Marshal(b ...[]byte) ([]byte, error) { - var buf []byte - if len(b) > 0 { - buf = b[0] - } - - return (*audit.DataAuditResult)(r). - StableMarshal(buf) -} - -// Unmarshal unmarshals protobuf binary representation of Result. -func (r *Result) Unmarshal(data []byte) error { - return (*audit.DataAuditResult)(r). - Unmarshal(data) -} - -// MarshalJSON encodes Result to protobuf JSON format. -func (r *Result) MarshalJSON() ([]byte, error) { - return (*audit.DataAuditResult)(r). - MarshalJSON() -} - -// UnmarshalJSON decodes Result from protobuf JSON format. -func (r *Result) UnmarshalJSON(data []byte) error { - return (*audit.DataAuditResult)(r). - UnmarshalJSON(data) -} - -// Version returns Data Audit structure version. -func (r *Result) Version() *pkg.Version { - return pkg.NewVersionFromV2( - (*audit.DataAuditResult)(r).GetVersion(), - ) -} - -// SetVersion sets Data Audit structure version. -func (r *Result) SetVersion(v *pkg.Version) { - (*audit.DataAuditResult)(r). - SetVersion(v.ToV2()) -} - -// AuditEpoch returns epoch number when the Data Audit was conducted. -func (r *Result) AuditEpoch() uint64 { - return (*audit.DataAuditResult)(r). - GetAuditEpoch() -} - -// SetAuditEpoch sets epoch number when the Data Audit was conducted. -func (r *Result) SetAuditEpoch(epoch uint64) { - (*audit.DataAuditResult)(r). - SetAuditEpoch(epoch) -} - -// ContainerID returns container under audit. -func (r *Result) ContainerID() *cid.ID { - return cid.NewFromV2( - (*audit.DataAuditResult)(r). - GetContainerID(), - ) -} - -// SetContainerID sets container under audit. -func (r *Result) SetContainerID(id *cid.ID) { - (*audit.DataAuditResult)(r). - SetContainerID(id.ToV2()) -} - -// PublicKey returns public key of the auditing InnerRing node in a binary format. -func (r *Result) PublicKey() []byte { - return (*audit.DataAuditResult)(r). - GetPublicKey() -} - -// SetPublicKey sets public key of the auditing InnerRing node in a binary format. -func (r *Result) SetPublicKey(key []byte) { - (*audit.DataAuditResult)(r). - SetPublicKey(key) -} - -// Complete returns completion state of audit result. -func (r *Result) Complete() bool { - return (*audit.DataAuditResult)(r). - GetComplete() -} - -// SetComplete sets completion state of audit result. -func (r *Result) SetComplete(v bool) { - (*audit.DataAuditResult)(r). - SetComplete(v) -} - -// Requests returns number of requests made by PoR audit check to get -// all headers of the objects inside storage groups. -func (r *Result) Requests() uint32 { - return (*audit.DataAuditResult)(r). - GetRequests() -} - -// SetRequests sets number of requests made by PoR audit check to get -// all headers of the objects inside storage groups. -func (r *Result) SetRequests(v uint32) { - (*audit.DataAuditResult)(r). - SetRequests(v) -} - -// Retries returns number of retries made by PoR audit check to get -// all headers of the objects inside storage groups. -func (r *Result) Retries() uint32 { - return (*audit.DataAuditResult)(r). - GetRetries() -} - -// SetRetries sets number of retries made by PoR audit check to get -// all headers of the objects inside storage groups. -func (r *Result) SetRetries(v uint32) { - (*audit.DataAuditResult)(r). - SetRetries(v) -} - -// PassSG returns list of Storage Groups that passed audit PoR stage. -func (r *Result) PassSG() []*object.ID { - mV2 := (*audit.DataAuditResult)(r). - GetPassSG() - - if mV2 == nil { - return nil - } - - m := make([]*object.ID, len(mV2)) - - for i := range mV2 { - m[i] = object.NewIDFromV2(mV2[i]) - } - - return m -} - -// SetPassSG sets list of Storage Groups that passed audit PoR stage. -func (r *Result) SetPassSG(list []*object.ID) { - mV2 := (*audit.DataAuditResult)(r). - GetPassSG() - - if list == nil { - mV2 = nil - } else { - ln := len(list) - - if cap(mV2) >= ln { - mV2 = mV2[:0] - } else { - mV2 = make([]*refs.ObjectID, 0, ln) - } - - for i := 0; i < ln; i++ { - mV2 = append(mV2, list[i].ToV2()) - } - } - - (*audit.DataAuditResult)(r). - SetPassSG(mV2) -} - -// FailSG returns list of Storage Groups that failed audit PoR stage. -func (r *Result) FailSG() []*object.ID { - mV2 := (*audit.DataAuditResult)(r). - GetFailSG() - - if mV2 == nil { - return nil - } - - m := make([]*object.ID, len(mV2)) - - for i := range mV2 { - m[i] = object.NewIDFromV2(mV2[i]) - } - - return m -} - -// SetFailSG sets list of Storage Groups that failed audit PoR stage. -func (r *Result) SetFailSG(list []*object.ID) { - mV2 := (*audit.DataAuditResult)(r). - GetFailSG() - - if list == nil { - mV2 = nil - } else { - ln := len(list) - - if cap(mV2) >= ln { - mV2 = mV2[:0] - } else { - mV2 = make([]*refs.ObjectID, 0, ln) - } - - for i := 0; i < ln; i++ { - mV2 = append(mV2, list[i].ToV2()) - } - } - - (*audit.DataAuditResult)(r). - SetFailSG(mV2) -} - -// Hit returns number of sampled objects under audit placed -// in an optimal way according to the containers placement policy -// when checking PoP. -func (r *Result) Hit() uint32 { - return (*audit.DataAuditResult)(r). - GetHit() -} - -// SetHit sets number of sampled objects under audit placed -// in an optimal way according to the containers placement policy -// when checking PoP. -func (r *Result) SetHit(hit uint32) { - (*audit.DataAuditResult)(r). - SetHit(hit) -} - -// Miss returns number of sampled objects under audit placed -// in suboptimal way according to the containers placement policy, -// but still at a satisfactory level when checking PoP. -func (r *Result) Miss() uint32 { - return (*audit.DataAuditResult)(r). - GetMiss() -} - -// SetMiss sets number of sampled objects under audit placed -// in suboptimal way according to the containers placement policy, -// but still at a satisfactory level when checking PoP. -func (r *Result) SetMiss(miss uint32) { - (*audit.DataAuditResult)(r). - SetMiss(miss) -} - -// Fail returns number of sampled objects under audit stored -// in a way not confirming placement policy or not found at all -// when checking PoP. -func (r *Result) Fail() uint32 { - return (*audit.DataAuditResult)(r). - GetFail() -} - -// SetFail sets number of sampled objects under audit stored -// in a way not confirming placement policy or not found at all -// when checking PoP. -func (r *Result) SetFail(fail uint32) { - (*audit.DataAuditResult)(r). - SetFail(fail) -} - -// PassNodes returns list of storage node public keys that -// passed at least one PDP. -func (r *Result) PassNodes() [][]byte { - return (*audit.DataAuditResult)(r). - GetPassNodes() -} - -// SetPassNodes sets list of storage node public keys that -// passed at least one PDP. -func (r *Result) SetPassNodes(list [][]byte) { - (*audit.DataAuditResult)(r). - SetPassNodes(list) -} - -// FailNodes returns list of storage node public keys that -// failed at least one PDP. -func (r *Result) FailNodes() [][]byte { - return (*audit.DataAuditResult)(r). - GetFailNodes() -} - -// SetFailNodes sets list of storage node public keys that -// failed at least one PDP. -func (r *Result) SetFailNodes(list [][]byte) { - (*audit.DataAuditResult)(r). - SetFailNodes(list) -} diff --git a/pkg/audit/result_test.go b/pkg/audit/result_test.go deleted file mode 100644 index 23f8fcf..0000000 --- a/pkg/audit/result_test.go +++ /dev/null @@ -1,154 +0,0 @@ -package audit_test - -import ( - "testing" - - "github.com/nspcc-dev/neofs-api-go/pkg" - "github.com/nspcc-dev/neofs-api-go/pkg/audit" - audittest "github.com/nspcc-dev/neofs-api-go/pkg/audit/test" - cidtest "github.com/nspcc-dev/neofs-api-go/pkg/container/id/test" - "github.com/nspcc-dev/neofs-api-go/pkg/object" - objecttest "github.com/nspcc-dev/neofs-api-go/pkg/object/test" - auditv2 "github.com/nspcc-dev/neofs-api-go/v2/audit" - "github.com/stretchr/testify/require" -) - -func TestResult(t *testing.T) { - r := audit.NewResult() - require.Equal(t, pkg.SDKVersion(), r.Version()) - - epoch := uint64(13) - r.SetAuditEpoch(epoch) - require.Equal(t, epoch, r.AuditEpoch()) - - cid := cidtest.Generate() - r.SetContainerID(cid) - require.Equal(t, cid, r.ContainerID()) - - key := []byte{1, 2, 3} - r.SetPublicKey(key) - require.Equal(t, key, r.PublicKey()) - - r.SetComplete(true) - require.True(t, r.Complete()) - - requests := uint32(2) - r.SetRequests(requests) - require.Equal(t, requests, r.Requests()) - - retries := uint32(1) - r.SetRetries(retries) - require.Equal(t, retries, r.Retries()) - - passSG := []*object.ID{objecttest.ID(), objecttest.ID()} - r.SetPassSG(passSG) - require.Equal(t, passSG, r.PassSG()) - - failSG := []*object.ID{objecttest.ID(), objecttest.ID()} - r.SetFailSG(failSG) - require.Equal(t, failSG, r.FailSG()) - - hit := uint32(1) - r.SetHit(hit) - require.Equal(t, hit, r.Hit()) - - miss := uint32(2) - r.SetMiss(miss) - require.Equal(t, miss, r.Miss()) - - fail := uint32(3) - r.SetFail(fail) - require.Equal(t, fail, r.Fail()) - - passNodes := [][]byte{{1}, {2}} - r.SetPassNodes(passNodes) - require.Equal(t, passNodes, r.PassNodes()) - - failNodes := [][]byte{{3}, {4}} - r.SetFailNodes(failNodes) - require.Equal(t, failNodes, r.FailNodes()) -} - -func TestStorageGroupEncoding(t *testing.T) { - r := audittest.Generate() - - t.Run("binary", func(t *testing.T) { - data, err := r.Marshal() - require.NoError(t, err) - - r2 := audit.NewResult() - require.NoError(t, r2.Unmarshal(data)) - - require.Equal(t, r, r2) - }) - - t.Run("json", func(t *testing.T) { - data, err := r.MarshalJSON() - require.NoError(t, err) - - r2 := audit.NewResult() - require.NoError(t, r2.UnmarshalJSON(data)) - - require.Equal(t, r, r2) - }) -} - -func TestResult_ToV2(t *testing.T) { - t.Run("nil", func(t *testing.T) { - var x *audit.Result - - require.Nil(t, x.ToV2()) - }) - - t.Run("default values", func(t *testing.T) { - result := audit.NewResult() - - // check initial values - require.Equal(t, pkg.SDKVersion(), result.Version()) - - require.False(t, result.Complete()) - - require.Nil(t, result.ContainerID()) - require.Nil(t, result.PublicKey()) - require.Nil(t, result.PassSG()) - require.Nil(t, result.FailSG()) - require.Nil(t, result.PassNodes()) - require.Nil(t, result.FailNodes()) - - require.Zero(t, result.Hit()) - require.Zero(t, result.Miss()) - require.Zero(t, result.Fail()) - require.Zero(t, result.Requests()) - require.Zero(t, result.Retries()) - require.Zero(t, result.AuditEpoch()) - - // convert to v2 message - resultV2 := result.ToV2() - - require.Equal(t, pkg.SDKVersion().ToV2(), resultV2.GetVersion()) - - require.False(t, resultV2.GetComplete()) - - require.Nil(t, resultV2.GetContainerID()) - require.Nil(t, resultV2.GetPublicKey()) - require.Nil(t, resultV2.GetPassSG()) - require.Nil(t, resultV2.GetFailSG()) - require.Nil(t, resultV2.GetPassNodes()) - require.Nil(t, resultV2.GetFailNodes()) - - require.Zero(t, resultV2.GetHit()) - require.Zero(t, resultV2.GetMiss()) - require.Zero(t, resultV2.GetFail()) - require.Zero(t, resultV2.GetRequests()) - require.Zero(t, resultV2.GetRetries()) - require.Zero(t, resultV2.GetAuditEpoch()) - }) -} - -func TestNewResultFromV2(t *testing.T) { - t.Run("from nil", func(t *testing.T) { - var x *auditv2.DataAuditResult - - require.Nil(t, audit.NewResultFromV2(x)) - }) -} diff --git a/pkg/audit/test/generate.go b/pkg/audit/test/generate.go deleted file mode 100644 index 84b2f8f..0000000 --- a/pkg/audit/test/generate.go +++ /dev/null @@ -1,37 +0,0 @@ -package audittest - -import ( - "github.com/nspcc-dev/neofs-api-go/pkg/audit" - cidtest "github.com/nspcc-dev/neofs-api-go/pkg/container/id/test" - "github.com/nspcc-dev/neofs-api-go/pkg/object" - objecttest "github.com/nspcc-dev/neofs-api-go/pkg/object/test" - refstest "github.com/nspcc-dev/neofs-api-go/pkg/test" -) - -// Generate returns random audit.Result. -func Generate() *audit.Result { - x := audit.NewResult() - - x.SetVersion(refstest.Version()) - x.SetContainerID(cidtest.Generate()) - x.SetPublicKey([]byte("key")) - x.SetComplete(true) - x.SetAuditEpoch(44) - x.SetHit(55) - x.SetMiss(66) - x.SetFail(77) - x.SetRetries(88) - x.SetRequests(99) - x.SetFailNodes([][]byte{ - []byte("node1"), - []byte("node2"), - }) - x.SetPassNodes([][]byte{ - []byte("node3"), - []byte("node4"), - }) - x.SetPassSG([]*object.ID{objecttest.ID(), objecttest.ID()}) - x.SetFailSG([]*object.ID{objecttest.ID(), objecttest.ID()}) - - return x -} diff --git a/pkg/checksum.go b/pkg/checksum.go deleted file mode 100644 index b02ae0d..0000000 --- a/pkg/checksum.go +++ /dev/null @@ -1,198 +0,0 @@ -package pkg - -import ( - "bytes" - "crypto/sha256" - "encoding/hex" - "fmt" - - "github.com/nspcc-dev/neofs-api-go/v2/refs" -) - -// Checksum represents v2-compatible checksum. -type Checksum refs.Checksum - -// ChecksumType represents the enumeration -// of checksum types. -type ChecksumType uint8 - -const ( - // ChecksumUnknown is an undefined checksum type. - ChecksumUnknown ChecksumType = iota - - // ChecksumSHA256 is a SHA256 checksum type. - ChecksumSHA256 - - // ChecksumTZ is a Tillich-Zemor checksum type. - ChecksumTZ -) - -// NewChecksumFromV2 wraps v2 Checksum message to Checksum. -// -// Nil refs.Checksum converts to nil. -func NewChecksumFromV2(cV2 *refs.Checksum) *Checksum { - return (*Checksum)(cV2) -} - -// NewChecksum creates and initializes blank Checksum. -// -// Works similar as NewChecksumFromV2(new(Checksum)). -// -// Defaults: -// - sum: nil; -// - type: ChecksumUnknown. -func NewChecksum() *Checksum { - return NewChecksumFromV2(new(refs.Checksum)) -} - -// Type returns checksum type. -func (c *Checksum) Type() ChecksumType { - switch (*refs.Checksum)(c).GetType() { - case refs.SHA256: - return ChecksumSHA256 - case refs.TillichZemor: - return ChecksumTZ - default: - return ChecksumUnknown - } -} - -// Sum returns checksum bytes. -func (c *Checksum) Sum() []byte { - return (*refs.Checksum)(c).GetSum() -} - -// SetSHA256 sets checksum to SHA256 hash. -func (c *Checksum) SetSHA256(v [sha256.Size]byte) { - checksum := (*refs.Checksum)(c) - - checksum.SetType(refs.SHA256) - checksum.SetSum(v[:]) -} - -// SetTillichZemor sets checksum to Tillich-Zemor hash. -func (c *Checksum) SetTillichZemor(v [64]byte) { - checksum := (*refs.Checksum)(c) - - checksum.SetType(refs.TillichZemor) - checksum.SetSum(v[:]) -} - -// ToV2 converts Checksum to v2 Checksum message. -// -// Nil Checksum converts to nil. -func (c *Checksum) ToV2() *refs.Checksum { - return (*refs.Checksum)(c) -} - -func EqualChecksums(cs1, cs2 *Checksum) bool { - return cs1.Type() == cs2.Type() && bytes.Equal(cs1.Sum(), cs2.Sum()) -} - -// Marshal marshals Checksum into a protobuf binary form. -// -// Buffer is allocated when the argument is empty. -// Otherwise, the first buffer is used. -func (c *Checksum) Marshal(b ...[]byte) ([]byte, error) { - var buf []byte - if len(b) > 0 { - buf = b[0] - } - - return (*refs.Checksum)(c). - StableMarshal(buf) -} - -// Unmarshal unmarshals protobuf binary representation of Checksum. -func (c *Checksum) Unmarshal(data []byte) error { - return (*refs.Checksum)(c). - Unmarshal(data) -} - -// MarshalJSON encodes Checksum to protobuf JSON format. -func (c *Checksum) MarshalJSON() ([]byte, error) { - return (*refs.Checksum)(c). - MarshalJSON() -} - -// UnmarshalJSON decodes Checksum from protobuf JSON format. -func (c *Checksum) UnmarshalJSON(data []byte) error { - return (*refs.Checksum)(c). - UnmarshalJSON(data) -} - -func (c *Checksum) String() string { - return hex.EncodeToString( - (*refs.Checksum)(c). - GetSum(), - ) -} - -// Parse parses Checksum from its string representation. -func (c *Checksum) Parse(s string) error { - data, err := hex.DecodeString(s) - if err != nil { - return err - } - - var typ refs.ChecksumType - - switch ln := len(data); ln { - default: - return fmt.Errorf("unsupported checksum length %d", ln) - case sha256.Size: - typ = refs.SHA256 - case 64: - typ = refs.TillichZemor - } - - cV2 := (*refs.Checksum)(c) - cV2.SetType(typ) - cV2.SetSum(data) - - return nil -} - -// String returns string representation of ChecksumType. -// -// String mapping: -// * ChecksumTZ: TZ; -// * ChecksumSHA256: SHA256; -// * ChecksumUnknown, default: CHECKSUM_TYPE_UNSPECIFIED. -func (m ChecksumType) String() string { - var m2 refs.ChecksumType - - switch m { - default: - m2 = refs.UnknownChecksum - case ChecksumTZ: - m2 = refs.TillichZemor - case ChecksumSHA256: - m2 = refs.SHA256 - } - - return m2.String() -} - -// FromString parses ChecksumType from a string representation. -// It is a reverse action to String(). -// -// Returns true if s was parsed successfully. -func (m *ChecksumType) FromString(s string) bool { - var g refs.ChecksumType - - ok := g.FromString(s) - - if ok { - switch g { - default: - *m = ChecksumUnknown - case refs.TillichZemor: - *m = ChecksumTZ - case refs.SHA256: - *m = ChecksumSHA256 - } - } - - return ok -} diff --git a/pkg/checksum_test.go b/pkg/checksum_test.go deleted file mode 100644 index b5a0600..0000000 --- a/pkg/checksum_test.go +++ /dev/null @@ -1,175 +0,0 @@ -package pkg - -import ( - "crypto/rand" - "crypto/sha256" - "testing" - - "github.com/nspcc-dev/neofs-api-go/v2/refs" - "github.com/stretchr/testify/require" -) - -func randSHA256(t *testing.T) [sha256.Size]byte { - cSHA256 := [sha256.Size]byte{} - _, err := rand.Read(cSHA256[:]) - require.NoError(t, err) - - return cSHA256 -} - -func TestChecksum(t *testing.T) { - c := NewChecksum() - - cSHA256 := [sha256.Size]byte{} - _, _ = rand.Read(cSHA256[:]) - - c.SetSHA256(cSHA256) - - require.Equal(t, ChecksumSHA256, c.Type()) - require.Equal(t, cSHA256[:], c.Sum()) - - cV2 := c.ToV2() - - require.Equal(t, refs.SHA256, cV2.GetType()) - require.Equal(t, cSHA256[:], cV2.GetSum()) - - cTZ := [64]byte{} - _, _ = rand.Read(cSHA256[:]) - - c.SetTillichZemor(cTZ) - - require.Equal(t, ChecksumTZ, c.Type()) - require.Equal(t, cTZ[:], c.Sum()) - - cV2 = c.ToV2() - - require.Equal(t, refs.TillichZemor, cV2.GetType()) - require.Equal(t, cTZ[:], cV2.GetSum()) -} - -func TestEqualChecksums(t *testing.T) { - require.True(t, EqualChecksums(nil, nil)) - - csSHA := [sha256.Size]byte{} - _, _ = rand.Read(csSHA[:]) - - cs1 := NewChecksum() - cs1.SetSHA256(csSHA) - - cs2 := NewChecksum() - cs2.SetSHA256(csSHA) - - require.True(t, EqualChecksums(cs1, cs2)) - - csSHA[0]++ - cs2.SetSHA256(csSHA) - - require.False(t, EqualChecksums(cs1, cs2)) -} - -func TestChecksumEncoding(t *testing.T) { - cs := NewChecksum() - cs.SetSHA256(randSHA256(t)) - - t.Run("binary", func(t *testing.T) { - data, err := cs.Marshal() - require.NoError(t, err) - - c2 := NewChecksum() - require.NoError(t, c2.Unmarshal(data)) - - require.Equal(t, cs, c2) - }) - - t.Run("json", func(t *testing.T) { - data, err := cs.MarshalJSON() - require.NoError(t, err) - - cs2 := NewChecksum() - require.NoError(t, cs2.UnmarshalJSON(data)) - - require.Equal(t, cs, cs2) - }) - - t.Run("string", func(t *testing.T) { - cs2 := NewChecksum() - - require.NoError(t, cs2.Parse(cs.String())) - - require.Equal(t, cs, cs2) - }) -} - -func TestNewChecksumFromV2(t *testing.T) { - t.Run("from nil", func(t *testing.T) { - var x *refs.Checksum - - require.Nil(t, NewChecksumFromV2(x)) - }) -} - -func TestChecksum_ToV2(t *testing.T) { - t.Run("nil", func(t *testing.T) { - var x *Checksum - - require.Nil(t, x.ToV2()) - }) -} - -func TestNewChecksum(t *testing.T) { - t.Run("default values", func(t *testing.T) { - chs := NewChecksum() - - // check initial values - require.Equal(t, ChecksumUnknown, chs.Type()) - require.Nil(t, chs.Sum()) - - // convert to v2 message - chsV2 := chs.ToV2() - - require.Equal(t, refs.UnknownChecksum, chsV2.GetType()) - require.Nil(t, chsV2.GetSum()) - }) -} - -type enumIface interface { - FromString(string) bool - String() string -} - -type enumStringItem struct { - val enumIface - str string -} - -func testEnumStrings(t *testing.T, e enumIface, items []enumStringItem) { - for _, item := range items { - require.Equal(t, item.str, item.val.String()) - - s := item.val.String() - - require.True(t, e.FromString(s), s) - - require.EqualValues(t, item.val, e, item.val) - } - - // incorrect strings - for _, str := range []string{ - "some string", - "undefined", - } { - require.False(t, e.FromString(str)) - } -} - -func TestChecksumType_String(t *testing.T) { - toPtr := func(v ChecksumType) *ChecksumType { - return &v - } - - testEnumStrings(t, new(ChecksumType), []enumStringItem{ - {val: toPtr(ChecksumTZ), str: "TZ"}, - {val: toPtr(ChecksumSHA256), str: "SHA256"}, - {val: toPtr(ChecksumUnknown), str: "CHECKSUM_TYPE_UNSPECIFIED"}, - }) -} diff --git a/pkg/client/accounting.go b/pkg/client/accounting.go deleted file mode 100644 index db1f8a4..0000000 --- a/pkg/client/accounting.go +++ /dev/null @@ -1,57 +0,0 @@ -package client - -import ( - "context" - "fmt" - - "github.com/nspcc-dev/neofs-api-go/pkg/accounting" - "github.com/nspcc-dev/neofs-api-go/pkg/owner" - "github.com/nspcc-dev/neofs-api-go/rpc/client" - v2accounting "github.com/nspcc-dev/neofs-api-go/v2/accounting" - rpcapi "github.com/nspcc-dev/neofs-api-go/v2/rpc" - v2signature "github.com/nspcc-dev/neofs-api-go/v2/signature" -) - -// Accounting contains methods related to balance querying. -type Accounting interface { - // GetBalance returns balance of provided account. - GetBalance(context.Context, *owner.ID, ...CallOption) (*accounting.Decimal, error) -} - -func (c *clientImpl) GetBalance(ctx context.Context, owner *owner.ID, opts ...CallOption) (*accounting.Decimal, error) { - // apply all available options - callOptions := c.defaultCallOptions() - - for i := range opts { - opts[i](callOptions) - } - - reqBody := new(v2accounting.BalanceRequestBody) - reqBody.SetOwnerID(owner.ToV2()) - - req := new(v2accounting.BalanceRequest) - req.SetBody(reqBody) - req.SetMetaHeader(v2MetaHeaderFromOpts(callOptions)) - - err := v2signature.SignServiceMessage(callOptions.key, req) - if err != nil { - return nil, err - } - - resp, err := rpcapi.Balance(c.Raw(), req, client.WithContext(ctx)) - if err != nil { - return nil, fmt.Errorf("transport error: %w", err) - } - - // handle response meta info - if err := c.handleResponseInfoV2(callOptions, resp); err != nil { - return nil, err - } - - err = v2signature.VerifyServiceMessage(resp) - if err != nil { - return nil, fmt.Errorf("can't verify response message: %w", err) - } - - return accounting.NewDecimalFromV2(resp.GetBody().GetBalance()), nil -} diff --git a/pkg/client/client.go b/pkg/client/client.go deleted file mode 100644 index 4ffbd30..0000000 --- a/pkg/client/client.go +++ /dev/null @@ -1,47 +0,0 @@ -package client - -import ( - "io" - "sync" - - "github.com/nspcc-dev/neofs-api-go/rpc/client" -) - -// Client represents NeoFS client. -type Client interface { - Accounting - Container - Netmap - Object - Session - Reputation - - // Raw must return underlying raw protobuf client. - Raw() *client.Client - - // Conn must return underlying connection. - // - // Must return a non-nil result after the first RPC call - // completed without a connection error. - Conn() io.Closer -} - -type clientImpl struct { - onceInit sync.Once - - raw *client.Client - - opts *clientOptions -} - -func New(opts ...Option) (Client, error) { - clientOptions := defaultClientOptions() - - for i := range opts { - opts[i](clientOptions) - } - - return &clientImpl{ - opts: clientOptions, - }, nil -} diff --git a/pkg/client/container.go b/pkg/client/container.go deleted file mode 100644 index 02c7993..0000000 --- a/pkg/client/container.go +++ /dev/null @@ -1,477 +0,0 @@ -package client - -import ( - "context" - "errors" - "fmt" - - "github.com/nspcc-dev/neofs-api-go/pkg" - "github.com/nspcc-dev/neofs-api-go/pkg/acl/eacl" - "github.com/nspcc-dev/neofs-api-go/pkg/container" - cid "github.com/nspcc-dev/neofs-api-go/pkg/container/id" - "github.com/nspcc-dev/neofs-api-go/pkg/owner" - "github.com/nspcc-dev/neofs-api-go/pkg/session" - "github.com/nspcc-dev/neofs-api-go/rpc/client" - "github.com/nspcc-dev/neofs-api-go/util/signature" - v2container "github.com/nspcc-dev/neofs-api-go/v2/container" - "github.com/nspcc-dev/neofs-api-go/v2/refs" - rpcapi "github.com/nspcc-dev/neofs-api-go/v2/rpc" - v2signature "github.com/nspcc-dev/neofs-api-go/v2/signature" -) - -// Container contains methods related to container and ACL. -type Container interface { - // PutContainer creates new container in the NeoFS network. - PutContainer(context.Context, *container.Container, ...CallOption) (*cid.ID, error) - - // GetContainer returns container by ID. - GetContainer(context.Context, *cid.ID, ...CallOption) (*container.Container, error) - - // ListContainers return container list with the provided owner. - ListContainers(context.Context, *owner.ID, ...CallOption) ([]*cid.ID, error) - - // DeleteContainer removes container from NeoFS network. - DeleteContainer(context.Context, *cid.ID, ...CallOption) error - - // GetEACL returns extended ACL for a given container. - GetEACL(context.Context, *cid.ID, ...CallOption) (*EACLWithSignature, error) - - // SetEACL sets extended ACL. - SetEACL(context.Context, *eacl.Table, ...CallOption) error - - // AnnounceContainerUsedSpace announces amount of space which is taken by stored objects. - AnnounceContainerUsedSpace(context.Context, []container.UsedSpaceAnnouncement, ...CallOption) error -} - -type delContainerSignWrapper struct { - body *v2container.DeleteRequestBody -} - -// EACLWithSignature represents eACL table/signature pair. -type EACLWithSignature struct { - table *eacl.Table -} - -func (c delContainerSignWrapper) ReadSignedData(bytes []byte) ([]byte, error) { - return c.body.GetContainerID().GetValue(), nil -} - -func (c delContainerSignWrapper) SignedDataSize() int { - return len(c.body.GetContainerID().GetValue()) -} - -// EACL returns eACL table. -func (e EACLWithSignature) EACL() *eacl.Table { - return e.table -} - -// Signature returns table signature. -// -// Deprecated: use EACL().Signature() instead. -func (e EACLWithSignature) Signature() *pkg.Signature { - return e.table.Signature() -} - -func (c *clientImpl) PutContainer(ctx context.Context, cnr *container.Container, opts ...CallOption) (*cid.ID, error) { - // apply all available options - callOptions := c.defaultCallOptions() - - for i := range opts { - opts[i](callOptions) - } - - // set transport version - cnr.SetVersion(pkg.SDKVersion()) - - // if container owner is not set, then use client key as owner - if cnr.OwnerID() == nil { - w, err := owner.NEO3WalletFromPublicKey(&callOptions.key.PublicKey) - if err != nil { - return nil, err - } - - ownerID := new(owner.ID) - ownerID.SetNeo3Wallet(w) - - cnr.SetOwnerID(ownerID) - } - - reqBody := new(v2container.PutRequestBody) - reqBody.SetContainer(cnr.ToV2()) - - // sign container - signWrapper := v2signature.StableMarshalerWrapper{SM: reqBody.GetContainer()} - - err := signature.SignDataWithHandler(callOptions.key, signWrapper, func(key []byte, sig []byte) { - containerSignature := new(refs.Signature) - containerSignature.SetKey(key) - containerSignature.SetSign(sig) - reqBody.SetSignature(containerSignature) - }, signature.SignWithRFC6979()) - if err != nil { - return nil, err - } - - req := new(v2container.PutRequest) - req.SetBody(reqBody) - - meta := v2MetaHeaderFromOpts(callOptions) - meta.SetSessionToken(cnr.SessionToken().ToV2()) - - req.SetMetaHeader(meta) - - err = v2signature.SignServiceMessage(callOptions.key, req) - if err != nil { - return nil, err - } - - resp, err := rpcapi.PutContainer(c.Raw(), req, client.WithContext(ctx)) - if err != nil { - return nil, err - } - - // handle response meta info - if err := c.handleResponseInfoV2(callOptions, resp); err != nil { - return nil, err - } - - err = v2signature.VerifyServiceMessage(resp) - if err != nil { - return nil, fmt.Errorf("can't verify response message: %w", err) - } - - return cid.NewFromV2(resp.GetBody().GetContainerID()), nil -} - -// GetContainer receives container structure through NeoFS API call. -// -// Returns error if container structure is received but does not meet NeoFS API specification. -func (c *clientImpl) GetContainer(ctx context.Context, id *cid.ID, opts ...CallOption) (*container.Container, error) { - // apply all available options - callOptions := c.defaultCallOptions() - - for i := range opts { - opts[i](callOptions) - } - - reqBody := new(v2container.GetRequestBody) - reqBody.SetContainerID(id.ToV2()) - - req := new(v2container.GetRequest) - req.SetBody(reqBody) - req.SetMetaHeader(v2MetaHeaderFromOpts(callOptions)) - - err := v2signature.SignServiceMessage(callOptions.key, req) - if err != nil { - return nil, err - } - - resp, err := rpcapi.GetContainer(c.Raw(), req, client.WithContext(ctx)) - if err != nil { - return nil, fmt.Errorf("transport error: %w", err) - } - - // handle response meta info - if err := c.handleResponseInfoV2(callOptions, resp); err != nil { - return nil, err - } - - err = v2signature.VerifyServiceMessage(resp) - if err != nil { - return nil, fmt.Errorf("can't verify response message: %w", err) - } - - body := resp.GetBody() - - cnr := container.NewContainerFromV2(body.GetContainer()) - - cnr.SetSessionToken( - session.NewTokenFromV2(body.GetSessionToken()), - ) - - cnr.SetSignature( - pkg.NewSignatureFromV2(body.GetSignature()), - ) - - return cnr, nil -} - -// GetVerifiedContainerStructure is a wrapper over Client.GetContainer method -// which checks if the structure of the resulting container matches its identifier. -// -// Returns an error if container does not match the identifier. -func GetVerifiedContainerStructure(ctx context.Context, c Client, id *cid.ID, opts ...CallOption) (*container.Container, error) { - cnr, err := c.GetContainer(ctx, id, opts...) - if err != nil { - return nil, err - } - - if !container.CalculateID(cnr).Equal(id) { - return nil, errors.New("container structure does not match the identifier") - } - - return cnr, nil -} - -func (c *clientImpl) ListContainers(ctx context.Context, ownerID *owner.ID, opts ...CallOption) ([]*cid.ID, error) { - // apply all available options - callOptions := c.defaultCallOptions() - - for i := range opts { - opts[i](callOptions) - } - - if ownerID == nil { - w, err := owner.NEO3WalletFromPublicKey(&callOptions.key.PublicKey) - if err != nil { - return nil, err - } - - ownerID = new(owner.ID) - ownerID.SetNeo3Wallet(w) - } - - reqBody := new(v2container.ListRequestBody) - reqBody.SetOwnerID(ownerID.ToV2()) - - req := new(v2container.ListRequest) - req.SetBody(reqBody) - req.SetMetaHeader(v2MetaHeaderFromOpts(callOptions)) - - err := v2signature.SignServiceMessage(callOptions.key, req) - if err != nil { - return nil, err - } - - resp, err := rpcapi.ListContainers(c.Raw(), req, client.WithContext(ctx)) - if err != nil { - return nil, fmt.Errorf("transport error: %w", err) - } - - // handle response meta info - if err := c.handleResponseInfoV2(callOptions, resp); err != nil { - return nil, err - } - - err = v2signature.VerifyServiceMessage(resp) - if err != nil { - return nil, fmt.Errorf("can't verify response message: %w", err) - } - - result := make([]*cid.ID, 0, len(resp.GetBody().GetContainerIDs())) - for _, cidV2 := range resp.GetBody().GetContainerIDs() { - result = append(result, cid.NewFromV2(cidV2)) - } - - return result, nil -} - -func (c *clientImpl) DeleteContainer(ctx context.Context, id *cid.ID, opts ...CallOption) error { - // apply all available options - callOptions := c.defaultCallOptions() - - for i := range opts { - opts[i](callOptions) - } - - reqBody := new(v2container.DeleteRequestBody) - reqBody.SetContainerID(id.ToV2()) - - // sign container - err := signature.SignDataWithHandler(callOptions.key, - delContainerSignWrapper{ - body: reqBody, - }, - func(key []byte, sig []byte) { - containerSignature := new(refs.Signature) - containerSignature.SetKey(key) - containerSignature.SetSign(sig) - reqBody.SetSignature(containerSignature) - }, - signature.SignWithRFC6979()) - if err != nil { - return err - } - - req := new(v2container.DeleteRequest) - req.SetBody(reqBody) - req.SetMetaHeader(v2MetaHeaderFromOpts(callOptions)) - - err = v2signature.SignServiceMessage(callOptions.key, req) - if err != nil { - return err - } - - resp, err := rpcapi.DeleteContainer(c.Raw(), req, client.WithContext(ctx)) - if err != nil { - return fmt.Errorf("transport error: %w", err) - } - - // handle response meta info - if err := c.handleResponseInfoV2(callOptions, resp); err != nil { - return err - } - - if err := v2signature.VerifyServiceMessage(resp); err != nil { - return fmt.Errorf("can't verify response message: %w", err) - } - - return nil -} - -func (c *clientImpl) GetEACL(ctx context.Context, id *cid.ID, opts ...CallOption) (*EACLWithSignature, error) { - // apply all available options - callOptions := c.defaultCallOptions() - - for i := range opts { - opts[i](callOptions) - } - - reqBody := new(v2container.GetExtendedACLRequestBody) - reqBody.SetContainerID(id.ToV2()) - - req := new(v2container.GetExtendedACLRequest) - req.SetBody(reqBody) - req.SetMetaHeader(v2MetaHeaderFromOpts(callOptions)) - - err := v2signature.SignServiceMessage(callOptions.key, req) - if err != nil { - return nil, err - } - - resp, err := rpcapi.GetEACL(c.Raw(), req, client.WithContext(ctx)) - if err != nil { - return nil, fmt.Errorf("transport error: %w", err) - } - - // handle response meta info - if err := c.handleResponseInfoV2(callOptions, resp); err != nil { - return nil, err - } - - err = v2signature.VerifyServiceMessage(resp) - if err != nil { - return nil, fmt.Errorf("can't verify response message: %w", err) - } - - body := resp.GetBody() - - table := eacl.NewTableFromV2(body.GetEACL()) - - table.SetSessionToken( - session.NewTokenFromV2(body.GetSessionToken()), - ) - - table.SetSignature( - pkg.NewSignatureFromV2(body.GetSignature()), - ) - - return &EACLWithSignature{ - table: table, - }, nil -} - -func (c *clientImpl) SetEACL(ctx context.Context, eacl *eacl.Table, opts ...CallOption) error { - // apply all available options - callOptions := c.defaultCallOptions() - - for i := range opts { - opts[i](callOptions) - } - - reqBody := new(v2container.SetExtendedACLRequestBody) - reqBody.SetEACL(eacl.ToV2()) - reqBody.GetEACL().SetVersion(pkg.SDKVersion().ToV2()) - - signWrapper := v2signature.StableMarshalerWrapper{SM: reqBody.GetEACL()} - - err := signature.SignDataWithHandler(callOptions.key, signWrapper, func(key []byte, sig []byte) { - eaclSignature := new(refs.Signature) - eaclSignature.SetKey(key) - eaclSignature.SetSign(sig) - reqBody.SetSignature(eaclSignature) - }, signature.SignWithRFC6979()) - if err != nil { - return err - } - - req := new(v2container.SetExtendedACLRequest) - req.SetBody(reqBody) - - meta := v2MetaHeaderFromOpts(callOptions) - meta.SetSessionToken(eacl.SessionToken().ToV2()) - - req.SetMetaHeader(meta) - - err = v2signature.SignServiceMessage(callOptions.key, req) - if err != nil { - return err - } - - resp, err := rpcapi.SetEACL(c.Raw(), req, client.WithContext(ctx)) - if err != nil { - return fmt.Errorf("transport error: %w", err) - } - - // handle response meta info - if err := c.handleResponseInfoV2(callOptions, resp); err != nil { - return err - } - - err = v2signature.VerifyServiceMessage(resp) - if err != nil { - return fmt.Errorf("can't verify response message: %w", err) - } - - return nil -} - -// AnnounceContainerUsedSpace used by storage nodes to estimate their container -// sizes during lifetime. Use it only in storage node applications. -func (c *clientImpl) AnnounceContainerUsedSpace( - ctx context.Context, - announce []container.UsedSpaceAnnouncement, - opts ...CallOption) error { - callOptions := c.defaultCallOptions() // apply all available options - - for i := range opts { - opts[i](callOptions) - } - - // convert list of SDK announcement structures into NeoFS-API v2 list - v2announce := make([]*v2container.UsedSpaceAnnouncement, 0, len(announce)) - for i := range announce { - v2announce = append(v2announce, announce[i].ToV2()) - } - - // prepare body of the NeoFS-API v2 request and request itself - reqBody := new(v2container.AnnounceUsedSpaceRequestBody) - reqBody.SetAnnouncements(v2announce) - - req := new(v2container.AnnounceUsedSpaceRequest) - req.SetBody(reqBody) - req.SetMetaHeader(v2MetaHeaderFromOpts(callOptions)) - - // sign the request - err := v2signature.SignServiceMessage(callOptions.key, req) - if err != nil { - return err - } - - resp, err := rpcapi.AnnounceUsedSpace(c.Raw(), req, client.WithContext(ctx)) - if err != nil { - return fmt.Errorf("transport error: %w", err) - } - - // handle response meta info - if err := c.handleResponseInfoV2(callOptions, resp); err != nil { - return err - } - - err = v2signature.VerifyServiceMessage(resp) - if err != nil { - return fmt.Errorf("can't verify response message: %w", err) - } - - return nil -} diff --git a/pkg/client/netmap.go b/pkg/client/netmap.go deleted file mode 100644 index 6f3291c..0000000 --- a/pkg/client/netmap.go +++ /dev/null @@ -1,124 +0,0 @@ -package client - -import ( - "context" - "fmt" - - "github.com/nspcc-dev/neofs-api-go/pkg" - "github.com/nspcc-dev/neofs-api-go/pkg/netmap" - "github.com/nspcc-dev/neofs-api-go/rpc/client" - v2netmap "github.com/nspcc-dev/neofs-api-go/v2/netmap" - rpcapi "github.com/nspcc-dev/neofs-api-go/v2/rpc" - v2signature "github.com/nspcc-dev/neofs-api-go/v2/signature" -) - -// Netmap contains methods related to netmap. -type Netmap interface { - // EndpointInfo returns attributes, address and public key of the node, specified - // in client constructor via address or open connection. This can be used as a - // health check to see if node is alive and responses to requests. - EndpointInfo(context.Context, ...CallOption) (*EndpointInfo, error) - - // NetworkInfo returns information about the NeoFS network of which the remote server is a part. - NetworkInfo(context.Context, ...CallOption) (*netmap.NetworkInfo, error) -} - -// EACLWithSignature represents eACL table/signature pair. -type EndpointInfo struct { - version *pkg.Version - - ni *netmap.NodeInfo -} - -// LatestVersion returns latest NeoFS API version in use. -func (e *EndpointInfo) LatestVersion() *pkg.Version { - return e.version -} - -// NodeInfo returns returns information about the NeoFS node. -func (e *EndpointInfo) NodeInfo() *netmap.NodeInfo { - return e.ni -} - -// EndpointInfo returns attributes, address and public key of the node, specified -// in client constructor via address or open connection. This can be used as a -// health check to see if node is alive and responses to requests. -func (c *clientImpl) EndpointInfo(ctx context.Context, opts ...CallOption) (*EndpointInfo, error) { - // apply all available options - callOptions := c.defaultCallOptions() - - for i := range opts { - opts[i](callOptions) - } - - reqBody := new(v2netmap.LocalNodeInfoRequestBody) - - req := new(v2netmap.LocalNodeInfoRequest) - req.SetBody(reqBody) - req.SetMetaHeader(v2MetaHeaderFromOpts(callOptions)) - - err := v2signature.SignServiceMessage(callOptions.key, req) - if err != nil { - return nil, err - } - - resp, err := rpcapi.LocalNodeInfo(c.Raw(), req) - if err != nil { - return nil, fmt.Errorf("transport error: %w", err) - } - - // handle response meta info - if err := c.handleResponseInfoV2(callOptions, resp); err != nil { - return nil, err - } - - err = v2signature.VerifyServiceMessage(resp) - if err != nil { - return nil, fmt.Errorf("can't verify response message: %w", err) - } - - body := resp.GetBody() - - return &EndpointInfo{ - version: pkg.NewVersionFromV2(body.GetVersion()), - ni: netmap.NewNodeInfoFromV2(body.GetNodeInfo()), - }, nil -} - -// NetworkInfo returns information about the NeoFS network of which the remote server is a part. -func (c *clientImpl) NetworkInfo(ctx context.Context, opts ...CallOption) (*netmap.NetworkInfo, error) { - // apply all available options - callOptions := c.defaultCallOptions() - - for i := range opts { - opts[i](callOptions) - } - - reqBody := new(v2netmap.NetworkInfoRequestBody) - - req := new(v2netmap.NetworkInfoRequest) - req.SetBody(reqBody) - req.SetMetaHeader(v2MetaHeaderFromOpts(callOptions)) - - err := v2signature.SignServiceMessage(callOptions.key, req) - if err != nil { - return nil, err - } - - resp, err := rpcapi.NetworkInfo(c.Raw(), req, client.WithContext(ctx)) - if err != nil { - return nil, fmt.Errorf("v2 NetworkInfo RPC failure: %w", err) - } - - // handle response meta info - if err := c.handleResponseInfoV2(callOptions, resp); err != nil { - return nil, err - } - - err = v2signature.VerifyServiceMessage(resp) - if err != nil { - return nil, fmt.Errorf("response message verification failed: %w", err) - } - - return netmap.NewNetworkInfoFromV2(resp.GetBody().GetNetworkInfo()), nil -} diff --git a/pkg/client/object.go b/pkg/client/object.go deleted file mode 100644 index bc0f2e5..0000000 --- a/pkg/client/object.go +++ /dev/null @@ -1,1373 +0,0 @@ -package client - -import ( - "bytes" - "context" - "crypto/ecdsa" - "crypto/sha256" - "errors" - "fmt" - "io" - - cid "github.com/nspcc-dev/neofs-api-go/pkg/container/id" - "github.com/nspcc-dev/neofs-api-go/pkg/object" - "github.com/nspcc-dev/neofs-api-go/rpc/client" - signer "github.com/nspcc-dev/neofs-api-go/util/signature" - v2object "github.com/nspcc-dev/neofs-api-go/v2/object" - v2refs "github.com/nspcc-dev/neofs-api-go/v2/refs" - rpcapi "github.com/nspcc-dev/neofs-api-go/v2/rpc" - v2session "github.com/nspcc-dev/neofs-api-go/v2/session" - "github.com/nspcc-dev/neofs-api-go/v2/signature" -) - -// Object contains methods for working with objects. -type Object interface { - // PutObject puts new object to NeoFS. - PutObject(context.Context, *PutObjectParams, ...CallOption) (*object.ID, error) - - // DeleteObject deletes object to NeoFS. - DeleteObject(context.Context, *DeleteObjectParams, ...CallOption) error - - // GetObject returns object stored in NeoFS. - GetObject(context.Context, *GetObjectParams, ...CallOption) (*object.Object, error) - - // GetObjectHeader returns object header. - GetObjectHeader(context.Context, *ObjectHeaderParams, ...CallOption) (*object.Object, error) - - // ObjectPayloadRangeData returns range of object payload. - ObjectPayloadRangeData(context.Context, *RangeDataParams, ...CallOption) ([]byte, error) - - // ObjectPayloadRangeSHA256 returns sha-256 hashes of object sub-ranges from NeoFS. - ObjectPayloadRangeSHA256(context.Context, *RangeChecksumParams, ...CallOption) ([][sha256.Size]byte, error) - - // ObjectPayloadRangeTZ returns homomorphic hashes of object sub-ranges from NeoFS. - ObjectPayloadRangeTZ(context.Context, *RangeChecksumParams, ...CallOption) ([][TZSize]byte, error) - - // SearchObject searches for objects in NeoFS using provided parameters. - SearchObject(context.Context, *SearchObjectParams, ...CallOption) ([]*object.ID, error) -} - -type PutObjectParams struct { - obj *object.Object - - r io.Reader -} - -// ObjectAddressWriter is an interface of the -// component that writes the object address. -type ObjectAddressWriter interface { - SetAddress(*object.Address) -} - -type objectAddressWriter struct { - addr *object.Address -} - -type DeleteObjectParams struct { - addr *object.Address - - tombTgt ObjectAddressWriter -} - -type GetObjectParams struct { - addr *object.Address - - raw bool - - w io.Writer - - readerHandler ReaderHandler -} - -type ObjectHeaderParams struct { - addr *object.Address - - raw bool - - short bool -} - -type RangeDataParams struct { - addr *object.Address - - raw bool - - r *object.Range - - w io.Writer -} - -type RangeChecksumParams struct { - typ checksumType - - addr *object.Address - - rs []*object.Range - - salt []byte -} - -type SearchObjectParams struct { - cid *cid.ID - - filters object.SearchFilters -} - -type putObjectV2Reader struct { - r io.Reader -} - -type putObjectV2Writer struct { - key *ecdsa.PrivateKey - - chunkPart *v2object.PutObjectPartChunk - - req *v2object.PutRequest - - stream *rpcapi.PutRequestWriter -} - -type checksumType int - -const ( - _ checksumType = iota - checksumSHA256 - checksumTZ -) - -const chunkSize = 3 * (1 << 20) - -const TZSize = 64 - -const searchQueryVersion uint32 = 1 - -var errNilObjectPart = errors.New("received nil object part") - -func (w *objectAddressWriter) SetAddress(addr *object.Address) { - w.addr = addr -} - -func rangesToV2(rs []*object.Range) []*v2object.Range { - r2 := make([]*v2object.Range, 0, len(rs)) - - for i := range rs { - r2 = append(r2, rs[i].ToV2()) - } - - return r2 -} - -func (t checksumType) toV2() v2refs.ChecksumType { - switch t { - case checksumSHA256: - return v2refs.SHA256 - case checksumTZ: - return v2refs.TillichZemor - default: - panic(fmt.Sprintf("invalid checksum type %d", t)) - } -} - -func (w *putObjectV2Reader) Read(p []byte) (int, error) { - return w.r.Read(p) -} - -func (w *putObjectV2Writer) Write(p []byte) (int, error) { - w.chunkPart.SetChunk(p) - - w.req.SetVerificationHeader(nil) - - if err := signature.SignServiceMessage(w.key, w.req); err != nil { - return 0, fmt.Errorf("could not sign chunk request message: %w", err) - } - - if err := w.stream.Write(w.req); err != nil { - return 0, fmt.Errorf("could not send chunk request message: %w", err) - } - - return len(p), nil -} - -func (p *PutObjectParams) WithObject(v *object.Object) *PutObjectParams { - if p != nil { - p.obj = v - } - - return p -} - -func (p *PutObjectParams) Object() *object.Object { - if p != nil { - return p.obj - } - - return nil -} - -func (p *PutObjectParams) WithPayloadReader(v io.Reader) *PutObjectParams { - if p != nil { - p.r = v - } - - return p -} - -func (p *PutObjectParams) PayloadReader() io.Reader { - if p != nil { - return p.r - } - - return nil -} - -func (c *clientImpl) PutObject(ctx context.Context, p *PutObjectParams, opts ...CallOption) (*object.ID, error) { - callOpts := c.defaultCallOptions() - - for i := range opts { - if opts[i] != nil { - opts[i](callOpts) - } - } - - // create request - req := new(v2object.PutRequest) - - // initialize request body - body := new(v2object.PutRequestBody) - req.SetBody(body) - - v2Addr := new(v2refs.Address) - v2Addr.SetObjectID(p.obj.ID().ToV2()) - v2Addr.SetContainerID(p.obj.ContainerID().ToV2()) - - // set meta header - meta := v2MetaHeaderFromOpts(callOpts) - - if err := c.attachV2SessionToken(callOpts, meta, v2SessionReqInfo{ - addr: v2Addr, - verb: v2session.ObjectVerbPut, - }); err != nil { - return nil, fmt.Errorf("could not attach session token: %w", err) - } - - req.SetMetaHeader(meta) - - // initialize init part - initPart := new(v2object.PutObjectPartInit) - body.SetObjectPart(initPart) - - obj := p.obj.ToV2() - - // set init part fields - initPart.SetObjectID(obj.GetObjectID()) - initPart.SetSignature(obj.GetSignature()) - initPart.SetHeader(obj.GetHeader()) - - // sign the request - if err := signature.SignServiceMessage(callOpts.key, req); err != nil { - return nil, fmt.Errorf("signing the request failed: %w", err) - } - - // open stream - resp := new(v2object.PutResponse) - - stream, err := rpcapi.PutObject(c.Raw(), resp, client.WithContext(ctx)) - if err != nil { - return nil, fmt.Errorf("stream opening failed: %w", err) - } - - // send init part - err = stream.Write(req) - if err != nil { - return nil, fmt.Errorf("sending the initial message to stream failed: %w", err) - } - - // create payload bytes reader - var rPayload io.Reader = bytes.NewReader(obj.GetPayload()) - if p.r != nil { - rPayload = io.MultiReader(rPayload, p.r) - } - - // create v2 payload stream writer - chunkPart := new(v2object.PutObjectPartChunk) - body.SetObjectPart(chunkPart) - - w := &putObjectV2Writer{ - key: callOpts.key, - chunkPart: chunkPart, - req: req, - stream: stream, - } - - r := &putObjectV2Reader{r: rPayload} - - // copy payload from reader to stream writer - _, err = io.CopyBuffer(w, r, make([]byte, chunkSize)) - if err != nil && !errors.Is(err, io.EOF) { - return nil, fmt.Errorf("payload streaming failed: %w", err) - } - - // close object stream and receive response from remote node - err = stream.Close() - if err != nil { - return nil, fmt.Errorf("closing the stream failed: %w", err) - } - - // handle response meta info - if err := c.handleResponseInfoV2(callOpts, resp); err != nil { - return nil, err - } - - // verify response structure - if err := signature.VerifyServiceMessage(resp); err != nil { - return nil, fmt.Errorf("response verification failed: %w", err) - } - - // convert object identifier - id := object.NewIDFromV2(resp.GetBody().GetObjectID()) - - return id, nil -} - -func (p *DeleteObjectParams) WithAddress(v *object.Address) *DeleteObjectParams { - if p != nil { - p.addr = v - } - - return p -} - -func (p *DeleteObjectParams) Address() *object.Address { - if p != nil { - return p.addr - } - - return nil -} - -// WithTombstoneAddressTarget sets target component to write tombstone address. -func (p *DeleteObjectParams) WithTombstoneAddressTarget(v ObjectAddressWriter) *DeleteObjectParams { - if p != nil { - p.tombTgt = v - } - - return p -} - -// TombstoneAddressTarget returns target component to write tombstone address. -func (p *DeleteObjectParams) TombstoneAddressTarget() ObjectAddressWriter { - if p != nil { - return p.tombTgt - } - - return nil -} - -// DeleteObject is a wrapper over Client.DeleteObject method -// that provides the ability to receive tombstone address -// without setting a target in the parameters. -func DeleteObject(ctx context.Context, c Client, p *DeleteObjectParams, opts ...CallOption) (*object.Address, error) { - w := new(objectAddressWriter) - - err := c.DeleteObject(ctx, p.WithTombstoneAddressTarget(w), opts...) - if err != nil { - return nil, err - } - - return w.addr, nil -} - -// DeleteObject removes object by address. -// -// If target of tombstone address is not set, the address is ignored. -func (c *clientImpl) DeleteObject(ctx context.Context, p *DeleteObjectParams, opts ...CallOption) error { - callOpts := c.defaultCallOptions() - - for i := range opts { - if opts[i] != nil { - opts[i](callOpts) - } - } - - // create request - req := new(v2object.DeleteRequest) - - // initialize request body - body := new(v2object.DeleteRequestBody) - req.SetBody(body) - - // set meta header - meta := v2MetaHeaderFromOpts(callOpts) - - if err := c.attachV2SessionToken(callOpts, meta, v2SessionReqInfo{ - addr: p.addr.ToV2(), - verb: v2session.ObjectVerbDelete, - }); err != nil { - return fmt.Errorf("could not attach session token: %w", err) - } - - req.SetMetaHeader(meta) - - // fill body fields - body.SetAddress(p.addr.ToV2()) - - // sign the request - if err := signature.SignServiceMessage(callOpts.key, req); err != nil { - return fmt.Errorf("signing the request failed: %w", err) - } - - // send request - resp, err := rpcapi.DeleteObject(c.Raw(), req, client.WithContext(ctx)) - if err != nil { - return fmt.Errorf("sending the request failed: %w", err) - } - - // handle response meta info - if err := c.handleResponseInfoV2(callOpts, resp); err != nil { - return err - } - - // verify response structure - if err := signature.VerifyServiceMessage(resp); err != nil { - return fmt.Errorf("response verification failed: %w", err) - } - - if p.tombTgt != nil { - p.tombTgt.SetAddress(object.NewAddressFromV2(resp.GetBody().GetTombstone())) - } - - return nil -} - -func (p *GetObjectParams) WithAddress(v *object.Address) *GetObjectParams { - if p != nil { - p.addr = v - } - - return p -} - -func (p *GetObjectParams) Address() *object.Address { - if p != nil { - return p.addr - } - - return nil -} - -func (p *GetObjectParams) WithPayloadWriter(w io.Writer) *GetObjectParams { - if p != nil { - p.w = w - } - - return p -} - -func (p *GetObjectParams) PayloadWriter() io.Writer { - if p != nil { - return p.w - } - - return nil -} - -func (p *GetObjectParams) WithRawFlag(v bool) *GetObjectParams { - if p != nil { - p.raw = v - } - - return p -} - -func (p *GetObjectParams) RawFlag() bool { - if p != nil { - return p.raw - } - - return false -} - -// ReaderHandler is a function over io.Reader. -type ReaderHandler func(io.Reader) - -// WithPayloadReaderHandler sets handler of the payload reader. -// -// If provided, payload reader is composed after receiving the header. -// In this case payload writer set via WithPayloadWriter is ignored. -// -// Handler should not be nil. -func (p *GetObjectParams) WithPayloadReaderHandler(f ReaderHandler) *GetObjectParams { - if p != nil { - p.readerHandler = f - } - - return p -} - -// wrapper over the Object Get stream that provides io.Reader. -type objectPayloadReader struct { - stream interface { - Read(*v2object.GetResponse) error - } - - resp v2object.GetResponse - - tail []byte -} - -func (x *objectPayloadReader) Read(p []byte) (read int, err error) { - // read remaining tail - read = copy(p, x.tail) - - x.tail = x.tail[read:] - - if len(p)-read == 0 { - return - } - - // receive message from server stream - err = x.stream.Read(&x.resp) - if err != nil { - if errors.Is(err, io.EOF) { - err = io.EOF - return - } - - err = fmt.Errorf("reading the response failed: %w", err) - return - } - - // get chunk part message - part := x.resp.GetBody().GetObjectPart() - - chunkPart, ok := part.(*v2object.GetObjectPartChunk) - if !ok { - err = errWrongMessageSeq - return - } - - // verify response structure - if err = signature.VerifyServiceMessage(&x.resp); err != nil { - err = fmt.Errorf("response verification failed: %w", err) - return - } - - // read new chunk - chunk := chunkPart.GetChunk() - - tailOffset := copy(p[read:], chunk) - - read += tailOffset - - // save the tail - x.tail = append(x.tail, chunk[tailOffset:]...) - - return -} - -var errWrongMessageSeq = errors.New("incorrect message sequence") - -func (c *clientImpl) GetObject(ctx context.Context, p *GetObjectParams, opts ...CallOption) (*object.Object, error) { - callOpts := c.defaultCallOptions() - - for i := range opts { - if opts[i] != nil { - opts[i](callOpts) - } - } - - // create request - req := new(v2object.GetRequest) - - // initialize request body - body := new(v2object.GetRequestBody) - req.SetBody(body) - - // set meta header - meta := v2MetaHeaderFromOpts(callOpts) - - if err := c.attachV2SessionToken(callOpts, meta, v2SessionReqInfo{ - addr: p.addr.ToV2(), - verb: v2session.ObjectVerbGet, - }); err != nil { - return nil, fmt.Errorf("could not attach session token: %w", err) - } - - req.SetMetaHeader(meta) - - // fill body fields - body.SetAddress(p.addr.ToV2()) - body.SetRaw(p.raw) - - // sign the request - if err := signature.SignServiceMessage(callOpts.key, req); err != nil { - return nil, fmt.Errorf("signing the request failed: %w", err) - } - - // open stream - stream, err := rpcapi.GetObject(c.Raw(), req, client.WithContext(ctx)) - if err != nil { - return nil, fmt.Errorf("stream opening failed: %w", err) - } - - var ( - headWas bool - payload []byte - obj = new(v2object.Object) - resp = new(v2object.GetResponse) - ) - -loop: - for { - // receive message from server stream - err := stream.Read(resp) - if err != nil { - if errors.Is(err, io.EOF) { - if !headWas { - return nil, io.ErrUnexpectedEOF - } - - break - } - - return nil, fmt.Errorf("reading the response failed: %w", err) - } - - // handle response meta info - if err := c.handleResponseInfoV2(callOpts, resp); err != nil { - return nil, err - } - - // verify response structure - if err := signature.VerifyServiceMessage(resp); err != nil { - return nil, fmt.Errorf("response verification failed: %w", err) - } - - switch v := resp.GetBody().GetObjectPart().(type) { - default: - return nil, fmt.Errorf("unexpected object part %T", v) - case *v2object.GetObjectPartInit: - if headWas { - return nil, errWrongMessageSeq - } - - headWas = true - - obj.SetObjectID(v.GetObjectID()) - obj.SetSignature(v.GetSignature()) - - hdr := v.GetHeader() - obj.SetHeader(hdr) - - if p.readerHandler != nil { - p.readerHandler(&objectPayloadReader{ - stream: stream, - }) - - break loop - } - - if p.w == nil { - payload = make([]byte, 0, hdr.GetPayloadLength()) - } - case *v2object.GetObjectPartChunk: - if !headWas { - return nil, errWrongMessageSeq - } - - if p.w != nil { - if _, err := p.w.Write(v.GetChunk()); err != nil { - return nil, fmt.Errorf("could not write payload chunk: %w", err) - } - } else { - payload = append(payload, v.GetChunk()...) - } - case *v2object.SplitInfo: - si := object.NewSplitInfoFromV2(v) - return nil, object.NewSplitInfoError(si) - } - } - - obj.SetPayload(payload) - - // convert the object - return object.NewFromV2(obj), nil -} - -func (p *ObjectHeaderParams) WithAddress(v *object.Address) *ObjectHeaderParams { - if p != nil { - p.addr = v - } - - return p -} - -func (p *ObjectHeaderParams) Address() *object.Address { - if p != nil { - return p.addr - } - - return nil -} - -func (p *ObjectHeaderParams) WithAllFields() *ObjectHeaderParams { - if p != nil { - p.short = false - } - - return p -} - -// AllFields return true if parameter set to return all header fields, returns -// false if parameter set to return only main fields of header. -func (p *ObjectHeaderParams) AllFields() bool { - if p != nil { - return !p.short - } - - return false -} - -func (p *ObjectHeaderParams) WithMainFields() *ObjectHeaderParams { - if p != nil { - p.short = true - } - - return p -} - -func (p *ObjectHeaderParams) WithRawFlag(v bool) *ObjectHeaderParams { - if p != nil { - p.raw = v - } - - return p -} - -func (p *ObjectHeaderParams) RawFlag() bool { - if p != nil { - return p.raw - } - - return false -} - -func (c *clientImpl) GetObjectHeader(ctx context.Context, p *ObjectHeaderParams, opts ...CallOption) (*object.Object, error) { - callOpts := c.defaultCallOptions() - - for i := range opts { - if opts[i] != nil { - opts[i](callOpts) - } - } - - // create request - req := new(v2object.HeadRequest) - - // initialize request body - body := new(v2object.HeadRequestBody) - req.SetBody(body) - - // set meta header - meta := v2MetaHeaderFromOpts(callOpts) - - if err := c.attachV2SessionToken(callOpts, meta, v2SessionReqInfo{ - addr: p.addr.ToV2(), - verb: v2session.ObjectVerbHead, - }); err != nil { - return nil, fmt.Errorf("could not attach session token: %w", err) - } - - req.SetMetaHeader(meta) - - // fill body fields - body.SetAddress(p.addr.ToV2()) - body.SetMainOnly(p.short) - body.SetRaw(p.raw) - - // sign the request - if err := signature.SignServiceMessage(callOpts.key, req); err != nil { - return nil, fmt.Errorf("signing the request failed: %w", err) - } - - // send Head request - resp, err := rpcapi.HeadObject(c.Raw(), req, client.WithContext(ctx)) - if err != nil { - return nil, fmt.Errorf("sending the request failed: %w", err) - } - - // handle response meta info - if err := c.handleResponseInfoV2(callOpts, resp); err != nil { - return nil, err - } - - // verify response structure - if err := signature.VerifyServiceMessage(resp); err != nil { - return nil, fmt.Errorf("response verification failed: %w", err) - } - - var ( - hdr *v2object.Header - idSig *v2refs.Signature - ) - - switch v := resp.GetBody().GetHeaderPart().(type) { - case nil: - return nil, fmt.Errorf("unexpected header type %T", v) - case *v2object.ShortHeader: - if !p.short { - return nil, fmt.Errorf("wrong header part type: expected %T, received %T", - (*v2object.ShortHeader)(nil), (*v2object.HeaderWithSignature)(nil), - ) - } - - h := v - - hdr = new(v2object.Header) - hdr.SetPayloadLength(h.GetPayloadLength()) - hdr.SetVersion(h.GetVersion()) - hdr.SetOwnerID(h.GetOwnerID()) - hdr.SetObjectType(h.GetObjectType()) - hdr.SetCreationEpoch(h.GetCreationEpoch()) - hdr.SetPayloadHash(h.GetPayloadHash()) - hdr.SetHomomorphicHash(h.GetHomomorphicHash()) - case *v2object.HeaderWithSignature: - if p.short { - return nil, fmt.Errorf("wrong header part type: expected %T, received %T", - (*v2object.HeaderWithSignature)(nil), (*v2object.ShortHeader)(nil), - ) - } - - hdrWithSig := v - if hdrWithSig == nil { - return nil, errNilObjectPart - } - - hdr = hdrWithSig.GetHeader() - idSig = hdrWithSig.GetSignature() - - if err := signer.VerifyDataWithSource( - signature.StableMarshalerWrapper{ - SM: p.addr.ObjectID().ToV2(), - }, - func() (key, sig []byte) { - return idSig.GetKey(), idSig.GetSign() - }, - ); err != nil { - return nil, fmt.Errorf("incorrect object header signature: %w", err) - } - case *v2object.SplitInfo: - si := object.NewSplitInfoFromV2(v) - - return nil, object.NewSplitInfoError(si) - } - - obj := new(v2object.Object) - obj.SetHeader(hdr) - obj.SetSignature(idSig) - - raw := object.NewRawFromV2(obj) - raw.SetID(p.addr.ObjectID()) - - // convert the object - return raw.Object(), nil -} - -func (p *RangeDataParams) WithAddress(v *object.Address) *RangeDataParams { - if p != nil { - p.addr = v - } - - return p -} - -func (p *RangeDataParams) Address() *object.Address { - if p != nil { - return p.addr - } - - return nil -} - -func (p *RangeDataParams) WithRaw(v bool) *RangeDataParams { - if p != nil { - p.raw = v - } - - return p -} - -func (p *RangeDataParams) Raw() bool { - if p != nil { - return p.raw - } - - return false -} - -func (p *RangeDataParams) WithRange(v *object.Range) *RangeDataParams { - if p != nil { - p.r = v - } - - return p -} - -func (p *RangeDataParams) Range() *object.Range { - if p != nil { - return p.r - } - - return nil -} - -func (p *RangeDataParams) WithDataWriter(v io.Writer) *RangeDataParams { - if p != nil { - p.w = v - } - - return p -} - -func (p *RangeDataParams) DataWriter() io.Writer { - if p != nil { - return p.w - } - - return nil -} - -func (c *clientImpl) ObjectPayloadRangeData(ctx context.Context, p *RangeDataParams, opts ...CallOption) ([]byte, error) { - callOpts := c.defaultCallOptions() - - for i := range opts { - if opts[i] != nil { - opts[i](callOpts) - } - } - - // create request - req := new(v2object.GetRangeRequest) - - // initialize request body - body := new(v2object.GetRangeRequestBody) - req.SetBody(body) - - // set meta header - meta := v2MetaHeaderFromOpts(callOpts) - - if err := c.attachV2SessionToken(callOpts, meta, v2SessionReqInfo{ - addr: p.addr.ToV2(), - verb: v2session.ObjectVerbRange, - }); err != nil { - return nil, fmt.Errorf("could not attach session token: %w", err) - } - - req.SetMetaHeader(meta) - - // fill body fields - body.SetAddress(p.addr.ToV2()) - body.SetRange(p.r.ToV2()) - body.SetRaw(p.raw) - - // sign the request - if err := signature.SignServiceMessage(callOpts.key, req); err != nil { - return nil, fmt.Errorf("signing the request failed: %w", err) - } - - // open stream - stream, err := rpcapi.GetObjectRange(c.Raw(), req, client.WithContext(ctx)) - if err != nil { - return nil, fmt.Errorf("could not create Get payload range stream: %w", err) - } - - var payload []byte - if p.w != nil { - payload = make([]byte, 0, p.r.GetLength()) - } - - resp := new(v2object.GetRangeResponse) - - for { - // receive message from server stream - err := stream.Read(resp) - if err != nil { - if errors.Is(err, io.EOF) { - break - } - - return nil, fmt.Errorf("reading the response failed: %w", err) - } - - // handle response meta info - if err := c.handleResponseInfoV2(callOpts, resp); err != nil { - return nil, err - } - - // verify response structure - if err := signature.VerifyServiceMessage(resp); err != nil { - return nil, fmt.Errorf("could not verify %T: %w", resp, err) - } - - switch v := resp.GetBody().GetRangePart().(type) { - case nil: - return nil, fmt.Errorf("unexpected range type %T", v) - case *v2object.GetRangePartChunk: - if p.w != nil { - if _, err = p.w.Write(v.GetChunk()); err != nil { - return nil, fmt.Errorf("could not write payload chunk: %w", err) - } - } else { - payload = append(payload, v.GetChunk()...) - } - case *v2object.SplitInfo: - si := object.NewSplitInfoFromV2(v) - - return nil, object.NewSplitInfoError(si) - } - } - - return payload, nil -} - -func (p *RangeChecksumParams) WithAddress(v *object.Address) *RangeChecksumParams { - if p != nil { - p.addr = v - } - - return p -} - -func (p *RangeChecksumParams) Address() *object.Address { - if p != nil { - return p.addr - } - - return nil -} - -func (p *RangeChecksumParams) WithRangeList(rs ...*object.Range) *RangeChecksumParams { - if p != nil { - p.rs = rs - } - - return p -} - -func (p *RangeChecksumParams) RangeList() []*object.Range { - if p != nil { - return p.rs - } - - return nil -} - -func (p *RangeChecksumParams) WithSalt(v []byte) *RangeChecksumParams { - if p != nil { - p.salt = v - } - - return p -} - -func (p *RangeChecksumParams) Salt() []byte { - if p != nil { - return p.salt - } - - return nil -} - -func (p *RangeChecksumParams) withChecksumType(t checksumType) *RangeChecksumParams { - if p != nil { - p.typ = t - } - - return p -} - -func (c *clientImpl) ObjectPayloadRangeSHA256(ctx context.Context, p *RangeChecksumParams, opts ...CallOption) ([][sha256.Size]byte, error) { - res, err := c.objectPayloadRangeHash(ctx, p.withChecksumType(checksumSHA256), opts...) - if err != nil { - return nil, err - } - - return res.([][sha256.Size]byte), nil -} - -func (c *clientImpl) ObjectPayloadRangeTZ(ctx context.Context, p *RangeChecksumParams, opts ...CallOption) ([][TZSize]byte, error) { - res, err := c.objectPayloadRangeHash(ctx, p.withChecksumType(checksumTZ), opts...) - if err != nil { - return nil, err - } - - return res.([][TZSize]byte), nil -} - -func (c *clientImpl) objectPayloadRangeHash(ctx context.Context, p *RangeChecksumParams, opts ...CallOption) (interface{}, error) { - callOpts := c.defaultCallOptions() - - for i := range opts { - if opts[i] != nil { - opts[i](callOpts) - } - } - - // create request - req := new(v2object.GetRangeHashRequest) - - // initialize request body - body := new(v2object.GetRangeHashRequestBody) - req.SetBody(body) - - // set meta header - meta := v2MetaHeaderFromOpts(callOpts) - - if err := c.attachV2SessionToken(callOpts, meta, v2SessionReqInfo{ - addr: p.addr.ToV2(), - verb: v2session.ObjectVerbRangeHash, - }); err != nil { - return nil, fmt.Errorf("could not attach session token: %w", err) - } - - req.SetMetaHeader(meta) - - // fill body fields - body.SetAddress(p.addr.ToV2()) - body.SetSalt(p.salt) - - typV2 := p.typ.toV2() - body.SetType(typV2) - - rsV2 := rangesToV2(p.rs) - body.SetRanges(rsV2) - - // sign the request - if err := signature.SignServiceMessage(callOpts.key, req); err != nil { - return nil, fmt.Errorf("signing the request failed: %w", err) - } - - // send request - resp, err := rpcapi.HashObjectRange(c.Raw(), req, client.WithContext(ctx)) - if err != nil { - return nil, fmt.Errorf("sending the request failed: %w", err) - } - - // handle response meta info - if err := c.handleResponseInfoV2(callOpts, resp); err != nil { - return nil, err - } - - // verify response structure - if err := signature.VerifyServiceMessage(resp); err != nil { - return nil, fmt.Errorf("response verification failed: %w", err) - } - - respBody := resp.GetBody() - respType := respBody.GetType() - respHashes := respBody.GetHashList() - - if t := p.typ.toV2(); respType != t { - return nil, fmt.Errorf("invalid checksum type: expected %v, received %v", t, respType) - } else if reqLn, respLn := len(rsV2), len(respHashes); reqLn != respLn { - return nil, fmt.Errorf("wrong checksum number: expected %d, received %d", reqLn, respLn) - } - - var res interface{} - - switch p.typ { - case checksumSHA256: - r := make([][sha256.Size]byte, 0, len(respHashes)) - - for i := range respHashes { - if ln := len(respHashes[i]); ln != sha256.Size { - return nil, fmt.Errorf("invalid checksum length: expected %d, received %d", sha256.Size, ln) - } - - cs := [sha256.Size]byte{} - copy(cs[:], respHashes[i]) - - r = append(r, cs) - } - - res = r - case checksumTZ: - r := make([][TZSize]byte, 0, len(respHashes)) - - for i := range respHashes { - if ln := len(respHashes[i]); ln != TZSize { - return nil, fmt.Errorf("invalid checksum length: expected %d, received %d", TZSize, ln) - } - - cs := [TZSize]byte{} - copy(cs[:], respHashes[i]) - - r = append(r, cs) - } - - res = r - } - - return res, nil -} - -func (p *SearchObjectParams) WithContainerID(v *cid.ID) *SearchObjectParams { - if p != nil { - p.cid = v - } - - return p -} - -func (p *SearchObjectParams) ContainerID() *cid.ID { - if p != nil { - return p.cid - } - - return nil -} - -func (p *SearchObjectParams) WithSearchFilters(v object.SearchFilters) *SearchObjectParams { - if p != nil { - p.filters = v - } - - return p -} - -func (p *SearchObjectParams) SearchFilters() object.SearchFilters { - if p != nil { - return p.filters - } - - return nil -} - -func (c *clientImpl) SearchObject(ctx context.Context, p *SearchObjectParams, opts ...CallOption) ([]*object.ID, error) { - callOpts := c.defaultCallOptions() - - for i := range opts { - if opts[i] != nil { - opts[i](callOpts) - } - } - - // create request - req := new(v2object.SearchRequest) - - // initialize request body - body := new(v2object.SearchRequestBody) - req.SetBody(body) - - v2Addr := new(v2refs.Address) - v2Addr.SetContainerID(p.cid.ToV2()) - - // set meta header - meta := v2MetaHeaderFromOpts(callOpts) - - if err := c.attachV2SessionToken(callOpts, meta, v2SessionReqInfo{ - addr: v2Addr, - verb: v2session.ObjectVerbSearch, - }); err != nil { - return nil, fmt.Errorf("could not attach session token: %w", err) - } - - req.SetMetaHeader(meta) - - // fill body fields - body.SetContainerID(v2Addr.GetContainerID()) - body.SetVersion(searchQueryVersion) - body.SetFilters(p.filters.ToV2()) - - // sign the request - if err := signature.SignServiceMessage(callOpts.key, req); err != nil { - return nil, fmt.Errorf("signing the request failed: %w", err) - } - - // create search stream - stream, err := rpcapi.SearchObjects(c.Raw(), req, client.WithContext(ctx)) - if err != nil { - return nil, fmt.Errorf("stream opening failed: %w", err) - } - - var ( - searchResult []*object.ID - resp = new(v2object.SearchResponse) - ) - - for { - // receive message from server stream - err := stream.Read(resp) - if err != nil { - if errors.Is(err, io.EOF) { - break - } - - return nil, fmt.Errorf("reading the response failed: %w", err) - } - - // handle response meta info - if err := c.handleResponseInfoV2(callOpts, resp); err != nil { - return nil, err - } - - // verify response structure - if err := signature.VerifyServiceMessage(resp); err != nil { - return nil, fmt.Errorf("could not verify %T: %w", resp, err) - } - - chunk := resp.GetBody().GetIDList() - for i := range chunk { - searchResult = append(searchResult, object.NewIDFromV2(chunk[i])) - } - } - - return searchResult, nil -} - -func (c *clientImpl) attachV2SessionToken(opts *callOptions, hdr *v2session.RequestMetaHeader, info v2SessionReqInfo) error { - if opts.session == nil { - return nil - } - - // Do not resign already prepared session token - if opts.session.Signature() != nil { - hdr.SetSessionToken(opts.session.ToV2()) - return nil - } - - opCtx := new(v2session.ObjectSessionContext) - opCtx.SetAddress(info.addr) - opCtx.SetVerb(info.verb) - - lt := new(v2session.TokenLifetime) - lt.SetIat(info.iat) - lt.SetNbf(info.nbf) - lt.SetExp(info.exp) - - body := new(v2session.SessionTokenBody) - body.SetID(opts.session.ID()) - body.SetOwnerID(opts.session.OwnerID().ToV2()) - body.SetSessionKey(opts.session.SessionKey()) - body.SetContext(opCtx) - body.SetLifetime(lt) - - token := new(v2session.SessionToken) - token.SetBody(body) - - signWrapper := signature.StableMarshalerWrapper{SM: token.GetBody()} - - err := signer.SignDataWithHandler(opts.key, signWrapper, func(key []byte, sig []byte) { - sessionTokenSignature := new(v2refs.Signature) - sessionTokenSignature.SetKey(key) - sessionTokenSignature.SetSign(sig) - token.SetSignature(sessionTokenSignature) - }) - if err != nil { - return err - } - - hdr.SetSessionToken(token) - - return nil -} diff --git a/pkg/client/object_test.go b/pkg/client/object_test.go deleted file mode 100644 index 4c7d296..0000000 --- a/pkg/client/object_test.go +++ /dev/null @@ -1,95 +0,0 @@ -package client - -import ( - "io" - "testing" - - "github.com/nspcc-dev/neofs-api-go/v2/object" - "github.com/nspcc-dev/neofs-api-go/v2/signature" - "github.com/nspcc-dev/neofs-crypto/test" - "github.com/stretchr/testify/require" -) - -type singleResponseStream struct { - called bool - resp object.GetResponse -} - -func (x *singleResponseStream) Read(r *object.GetResponse) error { - if x.called { - return io.EOF - } - - x.called = true - - *r = x.resp - - return nil -} - -var key = test.DecodeKey(0) - -func chunkResponse(c []byte) (r object.GetResponse) { - chunkPart := new(object.GetObjectPartChunk) - chunkPart.SetChunk(c) - - body := new(object.GetResponseBody) - body.SetObjectPart(chunkPart) - - r.SetBody(body) - - if err := signature.SignServiceMessage(key, &r); err != nil { - panic(err) - } - - return -} - -func data(sz int) []byte { - data := make([]byte, sz) - - for i := range data { - data[i] = byte(i) % ^byte(0) - } - - return data -} - -func checkFullRead(t *testing.T, r io.Reader, buf, payload []byte) { - var ( - restored []byte - read int - ) - - for { - n, err := r.Read(buf) - - read += n - restored = append(restored, buf[:n]...) - - if err != nil { - require.Equal(t, err, io.EOF) - break - - } - } - - require.Equal(t, payload, restored) - require.EqualValues(t, len(payload), read) -} - -func TestObjectPayloadReader_Read(t *testing.T) { - t.Run("read with tail", func(t *testing.T) { - payload := data(10) - - buf := make([]byte, len(payload)-1) - - var r io.Reader = &objectPayloadReader{ - stream: &singleResponseStream{ - resp: chunkResponse(payload), - }, - } - - checkFullRead(t, r, buf, payload) - }) -} diff --git a/pkg/client/opts.go b/pkg/client/opts.go deleted file mode 100644 index af9cedf..0000000 --- a/pkg/client/opts.go +++ /dev/null @@ -1,189 +0,0 @@ -package client - -import ( - "crypto/ecdsa" - "crypto/tls" - "time" - - "github.com/nspcc-dev/neofs-api-go/pkg" - "github.com/nspcc-dev/neofs-api-go/pkg/session" - "github.com/nspcc-dev/neofs-api-go/pkg/token" - "github.com/nspcc-dev/neofs-api-go/rpc/client" - "github.com/nspcc-dev/neofs-api-go/v2/refs" - v2session "github.com/nspcc-dev/neofs-api-go/v2/session" - "google.golang.org/grpc" -) - -type ( - CallOption func(*callOptions) - - Option func(*clientOptions) - - callOptions struct { - version *pkg.Version - xHeaders []*pkg.XHeader - ttl uint32 - epoch uint64 - key *ecdsa.PrivateKey - session *session.Token - bearer *token.BearerToken - } - - clientOptions struct { - key *ecdsa.PrivateKey - - rawOpts []client.Option - - cbRespInfo func(ResponseMetaInfo) error - } - - v2SessionReqInfo struct { - addr *refs.Address - verb v2session.ObjectSessionVerb - - exp, nbf, iat uint64 - } -) - -func (c *clientImpl) defaultCallOptions() *callOptions { - return &callOptions{ - version: pkg.SDKVersion(), - ttl: 2, - key: c.opts.key, - } -} - -func WithXHeader(x *pkg.XHeader) CallOption { - return func(opts *callOptions) { - opts.xHeaders = append(opts.xHeaders, x) - } -} - -func WithTTL(ttl uint32) CallOption { - return func(opts *callOptions) { - opts.ttl = ttl - } -} - -// WithKey sets client's key for the next request. -func WithKey(key *ecdsa.PrivateKey) CallOption { - return func(opts *callOptions) { - opts.key = key - } -} - -func WithEpoch(epoch uint64) CallOption { - return func(opts *callOptions) { - opts.epoch = epoch - } -} - -func WithSession(token *session.Token) CallOption { - return func(opts *callOptions) { - opts.session = token - } -} - -func WithBearer(token *token.BearerToken) CallOption { - return func(opts *callOptions) { - opts.bearer = token - } -} - -func v2MetaHeaderFromOpts(options *callOptions) *v2session.RequestMetaHeader { - meta := new(v2session.RequestMetaHeader) - meta.SetVersion(options.version.ToV2()) - meta.SetTTL(options.ttl) - meta.SetEpoch(options.epoch) - - xhdrs := make([]*v2session.XHeader, len(options.xHeaders)) - for i := range options.xHeaders { - xhdrs[i] = options.xHeaders[i].ToV2() - } - - meta.SetXHeaders(xhdrs) - - if options.bearer != nil { - meta.SetBearerToken(options.bearer.ToV2()) - } - - meta.SetSessionToken(options.session.ToV2()) - - return meta -} - -func defaultClientOptions() *clientOptions { - return &clientOptions{ - rawOpts: make([]client.Option, 0, 4), - } -} - -// WithAddress returns option to specify -// network address of the remote server. -// -// Ignored if WithGRPCConnection is provided. -func WithAddress(addr string) Option { - return func(opts *clientOptions) { - opts.rawOpts = append(opts.rawOpts, client.WithNetworkAddress(addr)) - } -} - -// WithDialTimeout returns option to set connection timeout to the remote node. -// -// Ignored if WithGRPCConn is provided. -func WithDialTimeout(dur time.Duration) Option { - return func(opts *clientOptions) { - opts.rawOpts = append(opts.rawOpts, client.WithDialTimeout(dur)) - } -} - -// WithTLSConfig returns option to set connection's TLS config to the remote node. -// -// Ignored if WithGRPCConnection is provided. -func WithTLSConfig(cfg *tls.Config) Option { - return func(opts *clientOptions) { - opts.rawOpts = append(opts.rawOpts, client.WithTLSCfg(cfg)) - } -} - -// WithDefaultPrivateKey returns option to set default private key -// used for the work. -func WithDefaultPrivateKey(key *ecdsa.PrivateKey) Option { - return func(opts *clientOptions) { - opts.key = key - } -} - -// WithURIAddress returns option to specify -// network address of a remote server and connection -// scheme for it. -// -// Format of the URI: -// -// [scheme://]host:port -// -// Supported schemes: -// - grpc; -// - grpcs. -// -// tls.Cfg second argument is optional and is taken into -// account only in case of `grpcs` scheme. -// -// Falls back to WithNetworkAddress if address is not a valid URI. -// -// Do not use along with WithAddress and WithTLSConfig. -// -// Ignored if WithGRPCConnection is provided. -func WithURIAddress(addr string, tlsCfg *tls.Config) Option { - return func(opts *clientOptions) { - opts.rawOpts = append(opts.rawOpts, client.WithNetworkURIAddress(addr, tlsCfg)...) - } -} - -// WithGRPCConnection returns option to set GRPC connection to -// the remote node. -func WithGRPCConnection(grpcConn *grpc.ClientConn) Option { - return func(opts *clientOptions) { - opts.rawOpts = append(opts.rawOpts, client.WithGRPCConn(grpcConn)) - } -} diff --git a/pkg/client/raw.go b/pkg/client/raw.go deleted file mode 100644 index aebe143..0000000 --- a/pkg/client/raw.go +++ /dev/null @@ -1,21 +0,0 @@ -package client - -import ( - "io" - - "github.com/nspcc-dev/neofs-api-go/rpc/client" -) - -// Raw returns underlying raw protobuf client. -func (c *clientImpl) Raw() *client.Client { - c.onceInit.Do(func() { - c.raw = client.New(c.opts.rawOpts...) - }) - - return c.raw -} - -// implements Client.Conn method. -func (c *clientImpl) Conn() io.Closer { - return c.raw.Conn() -} diff --git a/pkg/client/reputation.go b/pkg/client/reputation.go deleted file mode 100644 index ff82496..0000000 --- a/pkg/client/reputation.go +++ /dev/null @@ -1,171 +0,0 @@ -package client - -import ( - "context" - "fmt" - - "github.com/nspcc-dev/neofs-api-go/pkg/reputation" - "github.com/nspcc-dev/neofs-api-go/rpc/client" - v2reputation "github.com/nspcc-dev/neofs-api-go/v2/reputation" - rpcapi "github.com/nspcc-dev/neofs-api-go/v2/rpc" - v2signature "github.com/nspcc-dev/neofs-api-go/v2/signature" -) - -// Reputation contains methods for working with Reputation system values. -type Reputation interface { - // AnnounceLocalTrust announces local trust values of local peer. - AnnounceLocalTrust(context.Context, AnnounceLocalTrustPrm, ...CallOption) (*AnnounceLocalTrustRes, error) - - // AnnounceIntermediateTrust announces the intermediate result of the iterative algorithm for calculating - // the global reputation of the node. - AnnounceIntermediateTrust(context.Context, AnnounceIntermediateTrustPrm, ...CallOption) (*AnnounceIntermediateTrustRes, error) -} - -// AnnounceLocalTrustPrm groups parameters of AnnounceLocalTrust operation. -type AnnounceLocalTrustPrm struct { - epoch uint64 - - trusts []*reputation.Trust -} - -// Epoch returns epoch in which the trust was assessed. -func (x AnnounceLocalTrustPrm) Epoch() uint64 { - return x.epoch -} - -// SetEpoch sets epoch in which the trust was assessed. -func (x *AnnounceLocalTrustPrm) SetEpoch(epoch uint64) { - x.epoch = epoch -} - -// Trusts returns list of local trust values. -func (x AnnounceLocalTrustPrm) Trusts() []*reputation.Trust { - return x.trusts -} - -// SetTrusts sets list of local trust values. -func (x *AnnounceLocalTrustPrm) SetTrusts(trusts []*reputation.Trust) { - x.trusts = trusts -} - -// AnnounceLocalTrustRes groups results of AnnounceLocalTrust operation. -type AnnounceLocalTrustRes struct{} - -func (c *clientImpl) AnnounceLocalTrust(ctx context.Context, prm AnnounceLocalTrustPrm, opts ...CallOption) (*AnnounceLocalTrustRes, error) { - // apply all available options - callOptions := c.defaultCallOptions() - - for i := range opts { - opts[i](callOptions) - } - - reqBody := new(v2reputation.AnnounceLocalTrustRequestBody) - reqBody.SetEpoch(prm.Epoch()) - reqBody.SetTrusts(reputation.TrustsToV2(prm.Trusts())) - - req := new(v2reputation.AnnounceLocalTrustRequest) - req.SetBody(reqBody) - req.SetMetaHeader(v2MetaHeaderFromOpts(callOptions)) - - err := v2signature.SignServiceMessage(callOptions.key, req) - if err != nil { - return nil, err - } - - resp, err := rpcapi.AnnounceLocalTrust(c.Raw(), req, client.WithContext(ctx)) - if err != nil { - return nil, err - } - - // handle response meta info - if err := c.handleResponseInfoV2(callOptions, resp); err != nil { - return nil, err - } - - err = v2signature.VerifyServiceMessage(resp) - if err != nil { - return nil, fmt.Errorf("can't verify response message: %w", err) - } - - return new(AnnounceLocalTrustRes), nil -} - -// AnnounceIntermediateTrustPrm groups parameters of AnnounceIntermediateTrust operation. -type AnnounceIntermediateTrustPrm struct { - epoch uint64 - - iter uint32 - - trust *reputation.PeerToPeerTrust -} - -func (x *AnnounceIntermediateTrustPrm) Epoch() uint64 { - return x.epoch -} - -func (x *AnnounceIntermediateTrustPrm) SetEpoch(epoch uint64) { - x.epoch = epoch -} - -// Iteration returns sequence number of the iteration. -func (x AnnounceIntermediateTrustPrm) Iteration() uint32 { - return x.iter -} - -// SetIteration sets sequence number of the iteration. -func (x *AnnounceIntermediateTrustPrm) SetIteration(iter uint32) { - x.iter = iter -} - -// Trust returns current global trust value computed at the specified iteration. -func (x AnnounceIntermediateTrustPrm) Trust() *reputation.PeerToPeerTrust { - return x.trust -} - -// SetTrust sets current global trust value computed at the specified iteration. -func (x *AnnounceIntermediateTrustPrm) SetTrust(trust *reputation.PeerToPeerTrust) { - x.trust = trust -} - -// AnnounceIntermediateTrustRes groups results of AnnounceIntermediateTrust operation. -type AnnounceIntermediateTrustRes struct{} - -func (c *clientImpl) AnnounceIntermediateTrust(ctx context.Context, prm AnnounceIntermediateTrustPrm, opts ...CallOption) (*AnnounceIntermediateTrustRes, error) { - // apply all available options - callOptions := c.defaultCallOptions() - - for i := range opts { - opts[i](callOptions) - } - - reqBody := new(v2reputation.AnnounceIntermediateResultRequestBody) - reqBody.SetEpoch(prm.Epoch()) - reqBody.SetIteration(prm.Iteration()) - reqBody.SetTrust(prm.Trust().ToV2()) - - req := new(v2reputation.AnnounceIntermediateResultRequest) - req.SetBody(reqBody) - req.SetMetaHeader(v2MetaHeaderFromOpts(callOptions)) - - err := v2signature.SignServiceMessage(callOptions.key, req) - if err != nil { - return nil, err - } - - resp, err := rpcapi.AnnounceIntermediateResult(c.Raw(), req, client.WithContext(ctx)) - if err != nil { - return nil, err - } - - // handle response meta info - if err := c.handleResponseInfoV2(callOptions, resp); err != nil { - return nil, err - } - - err = v2signature.VerifyServiceMessage(resp) - if err != nil { - return nil, fmt.Errorf("can't verify response message: %w", err) - } - - return new(AnnounceIntermediateTrustRes), nil -} diff --git a/pkg/client/response.go b/pkg/client/response.go deleted file mode 100644 index 6948844..0000000 --- a/pkg/client/response.go +++ /dev/null @@ -1,37 +0,0 @@ -package client - -import ( - "github.com/nspcc-dev/neofs-api-go/v2/session" -) - -// ResponseMetaInfo groups meta information about any NeoFS API response. -type ResponseMetaInfo struct { - key []byte -} - -// ResponderKey returns responder's public key in a binary format. -// -// Result must not be mutated. -func (x ResponseMetaInfo) ResponderKey() []byte { - return x.key -} - -// WithResponseInfoHandler allows to specify handler of response meta information for the all Client operations. -// The handler is called right after the response is received. Client returns handler's error immediately. -func WithResponseInfoHandler(f func(ResponseMetaInfo) error) Option { - return func(opts *clientOptions) { - opts.cbRespInfo = f - } -} - -func (c *clientImpl) handleResponseInfoV2(opts *callOptions, resp interface { - GetVerificationHeader() *session.ResponseVerificationHeader -}) error { - if c.opts.cbRespInfo == nil { - return nil - } - - return c.opts.cbRespInfo(ResponseMetaInfo{ - key: resp.GetVerificationHeader().GetBodySignature().GetKey(), - }) -} diff --git a/pkg/client/session.go b/pkg/client/session.go deleted file mode 100644 index 46ec399..0000000 --- a/pkg/client/session.go +++ /dev/null @@ -1,79 +0,0 @@ -package client - -import ( - "context" - "errors" - "fmt" - - "github.com/nspcc-dev/neofs-api-go/pkg/owner" - "github.com/nspcc-dev/neofs-api-go/pkg/session" - "github.com/nspcc-dev/neofs-api-go/rpc/client" - rpcapi "github.com/nspcc-dev/neofs-api-go/v2/rpc" - v2session "github.com/nspcc-dev/neofs-api-go/v2/session" - v2signature "github.com/nspcc-dev/neofs-api-go/v2/signature" -) - -// Session contains session-related methods. -type Session interface { - // CreateSession creates session using provided expiration time. - CreateSession(context.Context, uint64, ...CallOption) (*session.Token, error) -} - -var errMalformedResponseBody = errors.New("malformed response body") - -func (c *clientImpl) CreateSession(ctx context.Context, expiration uint64, opts ...CallOption) (*session.Token, error) { - // apply all available options - callOptions := c.defaultCallOptions() - - for i := range opts { - opts[i](callOptions) - } - - w, err := owner.NEO3WalletFromPublicKey(&callOptions.key.PublicKey) - if err != nil { - return nil, err - } - - ownerID := new(owner.ID) - ownerID.SetNeo3Wallet(w) - - reqBody := new(v2session.CreateRequestBody) - reqBody.SetOwnerID(ownerID.ToV2()) - reqBody.SetExpiration(expiration) - - req := new(v2session.CreateRequest) - req.SetBody(reqBody) - req.SetMetaHeader(v2MetaHeaderFromOpts(callOptions)) - - err = v2signature.SignServiceMessage(callOptions.key, req) - if err != nil { - return nil, err - } - - resp, err := rpcapi.CreateSession(c.Raw(), req, client.WithContext(ctx)) - if err != nil { - return nil, fmt.Errorf("transport error: %w", err) - } - - // handle response meta info - if err := c.handleResponseInfoV2(callOptions, resp); err != nil { - return nil, err - } - - err = v2signature.VerifyServiceMessage(resp) - if err != nil { - return nil, fmt.Errorf("can't verify response message: %w", err) - } - - body := resp.GetBody() - if body == nil { - return nil, errMalformedResponseBody - } - - sessionToken := session.NewToken() - sessionToken.SetID(body.GetID()) - sessionToken.SetSessionKey(body.GetSessionKey()) - sessionToken.SetOwnerID(ownerID) - - return sessionToken, nil -} diff --git a/pkg/container/announcement.go b/pkg/container/announcement.go deleted file mode 100644 index cfa9510..0000000 --- a/pkg/container/announcement.go +++ /dev/null @@ -1,87 +0,0 @@ -package container - -import ( - cid "github.com/nspcc-dev/neofs-api-go/pkg/container/id" - "github.com/nspcc-dev/neofs-api-go/v2/container" -) - -// UsedSpaceAnnouncement is an announcement message used by storage nodes to -// estimate actual container sizes. -type UsedSpaceAnnouncement container.UsedSpaceAnnouncement - -// NewAnnouncement initialize empty UsedSpaceAnnouncement message. -// -// Defaults: -// - epoch: 0; -// - usedSpace: 0; -// - cid: nil. -func NewAnnouncement() *UsedSpaceAnnouncement { - return NewAnnouncementFromV2(new(container.UsedSpaceAnnouncement)) -} - -// NewAnnouncementFromV2 wraps protocol dependent version of -// UsedSpaceAnnouncement message. -// -// Nil container.UsedSpaceAnnouncement converts to nil. -func NewAnnouncementFromV2(v *container.UsedSpaceAnnouncement) *UsedSpaceAnnouncement { - return (*UsedSpaceAnnouncement)(v) -} - -// Epoch of the announcement. -func (a *UsedSpaceAnnouncement) Epoch() uint64 { - return (*container.UsedSpaceAnnouncement)(a).GetEpoch() -} - -// SetEpoch sets announcement epoch value. -func (a *UsedSpaceAnnouncement) SetEpoch(epoch uint64) { - (*container.UsedSpaceAnnouncement)(a).SetEpoch(epoch) -} - -// ContainerID of the announcement. -func (a *UsedSpaceAnnouncement) ContainerID() *cid.ID { - return cid.NewFromV2( - (*container.UsedSpaceAnnouncement)(a).GetContainerID(), - ) -} - -// SetContainerID sets announcement container value. -func (a *UsedSpaceAnnouncement) SetContainerID(cid *cid.ID) { - (*container.UsedSpaceAnnouncement)(a).SetContainerID(cid.ToV2()) -} - -// UsedSpace in container. -func (a *UsedSpaceAnnouncement) UsedSpace() uint64 { - return (*container.UsedSpaceAnnouncement)(a).GetUsedSpace() -} - -// SetUsedSpace sets used space value by specified container. -func (a *UsedSpaceAnnouncement) SetUsedSpace(value uint64) { - (*container.UsedSpaceAnnouncement)(a).SetUsedSpace(value) -} - -// ToV2 returns protocol dependent version of UsedSpaceAnnouncement message. -// -// Nil UsedSpaceAnnouncement converts to nil. -func (a *UsedSpaceAnnouncement) ToV2() *container.UsedSpaceAnnouncement { - return (*container.UsedSpaceAnnouncement)(a) -} - -// Marshal marshals UsedSpaceAnnouncement into a protobuf binary form. -// -// Buffer is allocated when the argument is empty. -// Otherwise, the first buffer is used. -func (a *UsedSpaceAnnouncement) Marshal(b ...[]byte) ([]byte, error) { - var buf []byte - if len(b) > 0 { - buf = b[0] - } - - return a.ToV2(). - StableMarshal(buf) -} - -// Unmarshal unmarshals protobuf binary representation of UsedSpaceAnnouncement. -func (a *UsedSpaceAnnouncement) Unmarshal(data []byte) error { - return a.ToV2(). - Unmarshal(data) -} diff --git a/pkg/container/announcement_test.go b/pkg/container/announcement_test.go deleted file mode 100644 index dc669b8..0000000 --- a/pkg/container/announcement_test.go +++ /dev/null @@ -1,99 +0,0 @@ -package container_test - -import ( - "crypto/sha256" - "testing" - - "github.com/nspcc-dev/neofs-api-go/pkg/container" - cid "github.com/nspcc-dev/neofs-api-go/pkg/container/id" - cidtest "github.com/nspcc-dev/neofs-api-go/pkg/container/id/test" - containertest "github.com/nspcc-dev/neofs-api-go/pkg/container/test" - containerv2 "github.com/nspcc-dev/neofs-api-go/v2/container" - "github.com/nspcc-dev/neofs-api-go/v2/refs" - "github.com/stretchr/testify/require" -) - -func TestAnnouncement(t *testing.T) { - const epoch, usedSpace uint64 = 10, 100 - - cidValue := [sha256.Size]byte{1, 2, 3} - id := cidtest.GenerateWithChecksum(cidValue) - - a := container.NewAnnouncement() - a.SetEpoch(epoch) - a.SetContainerID(id) - a.SetUsedSpace(usedSpace) - - require.Equal(t, epoch, a.Epoch()) - require.Equal(t, usedSpace, a.UsedSpace()) - require.Equal(t, id, a.ContainerID()) - - t.Run("test v2", func(t *testing.T) { - const newEpoch, newUsedSpace uint64 = 20, 200 - - newCidValue := [32]byte{4, 5, 6} - newCID := new(refs.ContainerID) - newCID.SetValue(newCidValue[:]) - - v2 := a.ToV2() - require.Equal(t, usedSpace, v2.GetUsedSpace()) - require.Equal(t, epoch, v2.GetEpoch()) - require.Equal(t, cidValue[:], v2.GetContainerID().GetValue()) - - v2.SetEpoch(newEpoch) - v2.SetUsedSpace(newUsedSpace) - v2.SetContainerID(newCID) - - newA := container.NewAnnouncementFromV2(v2) - - require.Equal(t, newEpoch, newA.Epoch()) - require.Equal(t, newUsedSpace, newA.UsedSpace()) - require.Equal(t, cid.NewFromV2(newCID), newA.ContainerID()) - }) -} - -func TestUsedSpaceEncoding(t *testing.T) { - a := containertest.UsedSpaceAnnouncement() - - t.Run("binary", func(t *testing.T) { - data, err := a.Marshal() - require.NoError(t, err) - - a2 := container.NewAnnouncement() - require.NoError(t, a2.Unmarshal(data)) - - require.Equal(t, a, a2) - }) -} - -func TestUsedSpaceAnnouncement_ToV2(t *testing.T) { - t.Run("nil", func(t *testing.T) { - var x *container.UsedSpaceAnnouncement - - require.Nil(t, x.ToV2()) - }) - - t.Run("default values", func(t *testing.T) { - announcement := container.NewAnnouncement() - - // check initial values - require.Zero(t, announcement.Epoch()) - require.Zero(t, announcement.UsedSpace()) - require.Nil(t, announcement.ContainerID()) - - // convert to v2 message - announcementV2 := announcement.ToV2() - - require.Zero(t, announcementV2.GetEpoch()) - require.Zero(t, announcementV2.GetUsedSpace()) - require.Nil(t, announcementV2.GetContainerID()) - }) -} - -func TestNewAnnouncementFromV2(t *testing.T) { - t.Run("from nil", func(t *testing.T) { - var x *containerv2.UsedSpaceAnnouncement - - require.Nil(t, container.NewAnnouncementFromV2(x)) - }) -} diff --git a/pkg/container/attribute.go b/pkg/container/attribute.go deleted file mode 100644 index fc87062..0000000 --- a/pkg/container/attribute.go +++ /dev/null @@ -1,137 +0,0 @@ -package container - -import ( - "github.com/nspcc-dev/neofs-api-go/v2/container" -) - -type ( - Attribute container.Attribute - Attributes []*Attribute -) - -// NewAttribute creates and initializes blank Attribute. -// -// Defaults: -// - key: ""; -// - value: "". -func NewAttribute() *Attribute { - return NewAttributeFromV2(new(container.Attribute)) -} - -func (a *Attribute) SetKey(v string) { - (*container.Attribute)(a).SetKey(v) -} - -func (a *Attribute) SetValue(v string) { - (*container.Attribute)(a).SetValue(v) -} - -func (a *Attribute) Key() string { - return (*container.Attribute)(a).GetKey() -} - -func (a *Attribute) Value() string { - return (*container.Attribute)(a).GetValue() -} - -// NewAttributeFromV2 wraps protocol dependent version of -// Attribute message. -// -// Nil container.Attribute converts to nil. -func NewAttributeFromV2(v *container.Attribute) *Attribute { - return (*Attribute)(v) -} - -// ToV2 converts Attribute to v2 Attribute message. -// -// Nil Attribute converts to nil. -func (a *Attribute) ToV2() *container.Attribute { - return (*container.Attribute)(a) -} - -func NewAttributesFromV2(v []*container.Attribute) Attributes { - if v == nil { - return nil - } - - attrs := make(Attributes, 0, len(v)) - for i := range v { - attrs = append(attrs, NewAttributeFromV2(v[i])) - } - - return attrs -} - -func (a Attributes) ToV2() []*container.Attribute { - if a == nil { - return nil - } - - attrs := make([]*container.Attribute, 0, len(a)) - for i := range a { - attrs = append(attrs, a[i].ToV2()) - } - - return attrs -} - -// sets value of the attribute by key. -func setAttribute(c *Container, key, value string) { - var a *Attribute - - iterateAttributes(c, func(a_ *Attribute) bool { - if a_.Key() == key { - a = a_ - } - - return a != nil - }) - - if a == nil { - a = NewAttribute() - a.SetKey(key) - - c.SetAttributes(append(c.Attributes(), a)) - } - - a.SetValue(value) -} - -// iterates over container attributes. Stops at f's true return. -// -// Handler must not be nil. -func iterateAttributes(c *Container, f func(*Attribute) bool) { - for _, a := range c.Attributes() { - if f(a) { - return - } - } -} - -// SetNativeNameWithZone sets container native name and its zone. -// -// Use SetNativeName to set default zone. -func SetNativeNameWithZone(c *Container, name, zone string) { - setAttribute(c, container.SysAttributeName, name) - setAttribute(c, container.SysAttributeZone, zone) -} - -// SetNativeName sets container native name with default zone (container). -func SetNativeName(c *Container, name string) { - SetNativeNameWithZone(c, name, container.SysAttributeZoneDefault) -} - -// GetNativeNameWithZone returns container native name and its zone. -func GetNativeNameWithZone(c *Container) (name string, zone string) { - iterateAttributes(c, func(a *Attribute) bool { - if key := a.Key(); key == container.SysAttributeName { - name = a.Value() - } else if key == container.SysAttributeZone { - zone = a.Value() - } - - return name != "" && zone != "" - }) - - return -} diff --git a/pkg/container/attribute_test.go b/pkg/container/attribute_test.go deleted file mode 100644 index 4078c64..0000000 --- a/pkg/container/attribute_test.go +++ /dev/null @@ -1,155 +0,0 @@ -package container_test - -import ( - "testing" - - "github.com/nspcc-dev/neofs-api-go/pkg/container" - containerv2 "github.com/nspcc-dev/neofs-api-go/v2/container" - "github.com/stretchr/testify/require" -) - -func TestAttribute(t *testing.T) { - t.Run("nil", func(t *testing.T) { - var x *container.Attribute - - require.Nil(t, x.ToV2()) - }) - - t.Run("default values", func(t *testing.T) { - attr := container.NewAttribute() - - // check initial values - require.Empty(t, attr.Key()) - require.Empty(t, attr.Value()) - - // convert to v2 message - attrV2 := attr.ToV2() - require.Empty(t, attrV2.GetKey()) - require.Empty(t, attrV2.GetValue()) - }) - - const ( - key = "key" - value = "value" - ) - - attr := container.NewAttribute() - attr.SetKey(key) - attr.SetValue(value) - - require.Equal(t, key, attr.Key()) - require.Equal(t, value, attr.Value()) - - t.Run("test v2", func(t *testing.T) { - const ( - newKey = "newKey" - newValue = "newValue" - ) - - v2 := attr.ToV2() - require.Equal(t, key, v2.GetKey()) - require.Equal(t, value, v2.GetValue()) - - v2.SetKey(newKey) - v2.SetValue(newValue) - - newAttr := container.NewAttributeFromV2(v2) - - require.Equal(t, newKey, newAttr.Key()) - require.Equal(t, newValue, newAttr.Value()) - }) -} - -func TestAttributes(t *testing.T) { - t.Run("nil", func(t *testing.T) { - var x container.Attributes - - require.Nil(t, x.ToV2()) - - require.Nil(t, container.NewAttributesFromV2(nil)) - }) - - var ( - keys = []string{"key1", "key2", "key3"} - vals = []string{"val1", "val2", "val3"} - ) - - attrs := make(container.Attributes, 0, len(keys)) - - for i := range keys { - attr := container.NewAttribute() - attr.SetKey(keys[i]) - attr.SetValue(vals[i]) - - attrs = append(attrs, attr) - } - - t.Run("test v2", func(t *testing.T) { - const postfix = "x" - - v2 := attrs.ToV2() - require.Len(t, v2, len(keys)) - - for i := range v2 { - k := v2[i].GetKey() - v := v2[i].GetValue() - - require.Equal(t, keys[i], k) - require.Equal(t, vals[i], v) - - v2[i].SetKey(k + postfix) - v2[i].SetValue(v + postfix) - } - - newAttrs := container.NewAttributesFromV2(v2) - require.Len(t, newAttrs, len(keys)) - - for i := range newAttrs { - require.Equal(t, keys[i]+postfix, newAttrs[i].Key()) - require.Equal(t, vals[i]+postfix, newAttrs[i].Value()) - } - }) -} - -func TestNewAttributeFromV2(t *testing.T) { - t.Run("from nil", func(t *testing.T) { - var x *containerv2.Attribute - - require.Nil(t, container.NewAttributeFromV2(x)) - }) -} - -func TestGetNameWithZone(t *testing.T) { - c := container.New() - - for _, item := range [...]struct { - name, zone string - }{ - {"name1", ""}, - {"name1", "zone1"}, - {"name2", "zone1"}, - {"name2", "zone2"}, - {"", "zone2"}, - {"", ""}, - } { - container.SetNativeNameWithZone(c, item.name, item.zone) - - name, zone := container.GetNativeNameWithZone(c) - - require.Equal(t, item.name, name, item.name) - require.Equal(t, item.zone, zone, item.zone) - } -} - -func TestSetNativeName(t *testing.T) { - c := container.New() - - const nameDefZone = "some name" - - container.SetNativeName(c, nameDefZone) - - name, zone := container.GetNativeNameWithZone(c) - - require.Equal(t, nameDefZone, name) - require.Equal(t, containerv2.SysAttributeZoneDefault, zone) -} diff --git a/pkg/container/container.go b/pkg/container/container.go deleted file mode 100644 index 7ae7fe4..0000000 --- a/pkg/container/container.go +++ /dev/null @@ -1,231 +0,0 @@ -package container - -import ( - "crypto/sha256" - - "github.com/google/uuid" - "github.com/nspcc-dev/neofs-api-go/pkg" - cid "github.com/nspcc-dev/neofs-api-go/pkg/container/id" - "github.com/nspcc-dev/neofs-api-go/pkg/netmap" - "github.com/nspcc-dev/neofs-api-go/pkg/owner" - "github.com/nspcc-dev/neofs-api-go/pkg/session" - "github.com/nspcc-dev/neofs-api-go/v2/container" -) - -type Container struct { - v2 container.Container - - token *session.Token - - sig *pkg.Signature -} - -// New creates, initializes and returns blank Container instance. -// -// Defaults: -// - token: nil; -// - sig: nil; -// - basicACL: acl.PrivateBasicRule; -// - version: nil; -// - nonce: random UUID; -// - attr: nil; -// - policy: nil; -// - ownerID: nil. -func New(opts ...NewOption) *Container { - cnrOptions := defaultContainerOptions() - - for i := range opts { - opts[i].apply(&cnrOptions) - } - - cnr := new(Container) - cnr.SetNonceUUID(cnrOptions.nonce) - cnr.SetBasicACL(cnrOptions.acl) - - if cnrOptions.owner != nil { - cnr.SetOwnerID(cnrOptions.owner) - } - - if cnrOptions.policy != nil { - cnr.SetPlacementPolicy(cnrOptions.policy) - } - - cnr.SetAttributes(cnrOptions.attributes) - - return cnr -} - -// ToV2 returns the v2 Container message. -// -// Nil Container converts to nil. -func (c *Container) ToV2() *container.Container { - if c == nil { - return nil - } - - return &c.v2 -} - -// NewVerifiedFromV2 constructs Container from NeoFS API V2 Container message. -// -// Does not perform if message meets NeoFS API V2 specification. To do this -// use NewVerifiedFromV2 constructor. -func NewContainerFromV2(c *container.Container) *Container { - cnr := new(Container) - - if c != nil { - cnr.v2 = *c - } - - return cnr -} - -// CalculateID calculates container identifier -// based on its structure. -func CalculateID(c *Container) *cid.ID { - data, err := c.ToV2().StableMarshal(nil) - if err != nil { - panic(err) - } - - id := cid.New() - id.SetSHA256(sha256.Sum256(data)) - - return id -} - -func (c *Container) Version() *pkg.Version { - return pkg.NewVersionFromV2(c.v2.GetVersion()) -} - -func (c *Container) SetVersion(v *pkg.Version) { - c.v2.SetVersion(v.ToV2()) -} - -func (c *Container) OwnerID() *owner.ID { - return owner.NewIDFromV2(c.v2.GetOwnerID()) -} - -func (c *Container) SetOwnerID(v *owner.ID) { - c.v2.SetOwnerID(v.ToV2()) -} - -// Nonce returns container nonce in a binary format. -// -// Returns nil if container nonce is not a valid UUID. -// -// Deprecated: use NonceUUID instead. -func (c *Container) Nonce() []byte { - uid, err := c.NonceUUID() - if err == nil { - data, _ := uid.MarshalBinary() - return data - } - - return nil -} - -// SetNonce sets container nonce in a binary format. -// -// If slice length is less than UUID size, than -// value is padded with a sequence of zeros. -// If slice length is more than UUID size, than -// value is cut. -// -// Deprecated: use SetNonceUUID instead. -func (c *Container) SetNonce(v []byte) { - u := uuid.UUID{} - copy(u[:], v) - c.v2.SetNonce(u[:]) -} - -// Returns container nonce in UUID format. -// -// Returns error if container nonce is not a valid UUID. -func (c *Container) NonceUUID() (uuid.UUID, error) { - return uuid.FromBytes(c.v2.GetNonce()) -} - -// SetNonceUUID sets container nonce as UUID. -func (c *Container) SetNonceUUID(v uuid.UUID) { - data, _ := v.MarshalBinary() - c.v2.SetNonce(data) -} - -func (c *Container) BasicACL() uint32 { - return c.v2.GetBasicACL() -} - -func (c *Container) SetBasicACL(v uint32) { - c.v2.SetBasicACL(v) -} - -func (c *Container) Attributes() Attributes { - return NewAttributesFromV2(c.v2.GetAttributes()) -} - -func (c *Container) SetAttributes(v Attributes) { - c.v2.SetAttributes(v.ToV2()) -} - -func (c *Container) PlacementPolicy() *netmap.PlacementPolicy { - return netmap.NewPlacementPolicyFromV2(c.v2.GetPlacementPolicy()) -} - -func (c *Container) SetPlacementPolicy(v *netmap.PlacementPolicy) { - c.v2.SetPlacementPolicy(v.ToV2()) -} - -// SessionToken returns token of the session within -// which container was created. -func (c Container) SessionToken() *session.Token { - return c.token -} - -// SetSessionToken sets token of the session within -// which container was created. -func (c *Container) SetSessionToken(t *session.Token) { - c.token = t -} - -// Signature returns signature of the marshaled container. -func (c Container) Signature() *pkg.Signature { - return c.sig -} - -// SetSignature sets signature of the marshaled container. -func (c *Container) SetSignature(sig *pkg.Signature) { - c.sig = sig -} - -// Marshal marshals Container into a protobuf binary form. -// -// Buffer is allocated when the argument is empty. -// Otherwise, the first buffer is used. -func (c *Container) Marshal(b ...[]byte) ([]byte, error) { - var buf []byte - if len(b) > 0 { - buf = b[0] - } - - return c.v2. - StableMarshal(buf) -} - -// Unmarshal unmarshals protobuf binary representation of Container. -func (c *Container) Unmarshal(data []byte) error { - return c.v2. - Unmarshal(data) -} - -// MarshalJSON encodes Container to protobuf JSON format. -func (c *Container) MarshalJSON() ([]byte, error) { - return c.v2. - MarshalJSON() -} - -// UnmarshalJSON decodes Container from protobuf JSON format. -func (c *Container) UnmarshalJSON(data []byte) error { - return c.v2. - UnmarshalJSON(data) -} diff --git a/pkg/container/container_test.go b/pkg/container/container_test.go deleted file mode 100644 index a5175b5..0000000 --- a/pkg/container/container_test.go +++ /dev/null @@ -1,134 +0,0 @@ -package container_test - -import ( - "testing" - - "github.com/google/uuid" - "github.com/nspcc-dev/neofs-api-go/pkg/acl" - "github.com/nspcc-dev/neofs-api-go/pkg/container" - containertest "github.com/nspcc-dev/neofs-api-go/pkg/container/test" - netmaptest "github.com/nspcc-dev/neofs-api-go/pkg/netmap/test" - ownertest "github.com/nspcc-dev/neofs-api-go/pkg/owner/test" - sessiontest "github.com/nspcc-dev/neofs-api-go/pkg/session/test" - refstest "github.com/nspcc-dev/neofs-api-go/pkg/test" - "github.com/stretchr/testify/require" -) - -func TestNewContainer(t *testing.T) { - c := container.New() - - nonce := uuid.New() - - ownerID := ownertest.Generate() - policy := netmaptest.PlacementPolicy() - - c.SetBasicACL(acl.PublicBasicRule) - - attrs := containertest.Attributes() - c.SetAttributes(attrs) - - c.SetPlacementPolicy(policy) - c.SetNonceUUID(nonce) - c.SetOwnerID(ownerID) - - ver := refstest.Version() - c.SetVersion(ver) - - v2 := c.ToV2() - newContainer := container.NewContainerFromV2(v2) - - require.EqualValues(t, newContainer.PlacementPolicy(), policy) - require.EqualValues(t, newContainer.Attributes(), attrs) - require.EqualValues(t, newContainer.BasicACL(), acl.PublicBasicRule) - - newNonce, err := newContainer.NonceUUID() - require.NoError(t, err) - - require.EqualValues(t, newNonce, nonce) - require.EqualValues(t, newContainer.OwnerID(), ownerID) - require.EqualValues(t, newContainer.Version(), ver) -} - -func TestContainerEncoding(t *testing.T) { - c := containertest.Container() - - t.Run("binary", func(t *testing.T) { - data, err := c.Marshal() - require.NoError(t, err) - - c2 := container.New() - require.NoError(t, c2.Unmarshal(data)) - - require.Equal(t, c, c2) - }) - - t.Run("json", func(t *testing.T) { - data, err := c.MarshalJSON() - require.NoError(t, err) - - c2 := container.New() - require.NoError(t, c2.UnmarshalJSON(data)) - - require.Equal(t, c, c2) - }) -} - -func TestContainer_SessionToken(t *testing.T) { - tok := sessiontest.Generate() - - cnr := container.New() - - cnr.SetSessionToken(tok) - - require.Equal(t, tok, cnr.SessionToken()) -} - -func TestContainer_Signature(t *testing.T) { - sig := refstest.Signature() - - cnr := container.New() - cnr.SetSignature(sig) - - require.Equal(t, sig, cnr.Signature()) -} - -func TestContainer_ToV2(t *testing.T) { - t.Run("nil", func(t *testing.T) { - var x *container.Container - - require.Nil(t, x.ToV2()) - }) - - t.Run("default values", func(t *testing.T) { - cnt := container.New() - - // check initial values - require.Nil(t, cnt.SessionToken()) - require.Nil(t, cnt.Signature()) - require.Nil(t, cnt.Version()) - require.Nil(t, cnt.Attributes()) - require.Nil(t, cnt.PlacementPolicy()) - require.Nil(t, cnt.OwnerID()) - - require.EqualValues(t, acl.PrivateBasicRule, cnt.BasicACL()) - - nonce, err := cnt.NonceUUID() - require.NoError(t, err) - require.NotNil(t, nonce) - - // convert to v2 message - cntV2 := cnt.ToV2() - - nonceV2, err := uuid.FromBytes(cntV2.GetNonce()) - require.NoError(t, err) - - require.Equal(t, nonce.String(), nonceV2.String()) - - require.Nil(t, cntV2.GetVersion()) - require.Nil(t, cntV2.GetAttributes()) - require.Nil(t, cntV2.GetPlacementPolicy()) - require.Nil(t, cntV2.GetOwnerID()) - - require.Equal(t, uint32(acl.PrivateBasicRule), cntV2.GetBasicACL()) - }) -} diff --git a/pkg/container/id.go b/pkg/container/id.go deleted file mode 100644 index 96a6483..0000000 --- a/pkg/container/id.go +++ /dev/null @@ -1,22 +0,0 @@ -package container - -import ( - cid "github.com/nspcc-dev/neofs-api-go/pkg/container/id" -) - -// ID represents v2-compatible container identifier. -// -// Deprecated: use cid.ID instead. -type ID = cid.ID - -// NewIDFromV2 wraps v2 ContainerID message to ID. -// -// Deprecated: use cid.NewFromV2 instead. -var NewIDFromV2 = cid.NewFromV2 - -// NewID creates and initializes blank ID. -// -// Works similar to NewIDFromV2(new(ContainerID)). -// -// Deprecated: use cid.New instead. -var NewID = cid.New diff --git a/pkg/container/id/id.go b/pkg/container/id/id.go deleted file mode 100644 index 351c9b3..0000000 --- a/pkg/container/id/id.go +++ /dev/null @@ -1,102 +0,0 @@ -package cid - -import ( - "bytes" - "crypto/sha256" - "errors" - - "github.com/mr-tron/base58" - "github.com/nspcc-dev/neofs-api-go/v2/refs" -) - -// ID represents v2-compatible container identifier. -type ID refs.ContainerID - -// NewFromV2 wraps v2 ContainerID message to ID. -// -// Nil refs.ContainerID converts to nil. -func NewFromV2(idV2 *refs.ContainerID) *ID { - return (*ID)(idV2) -} - -// New creates and initializes blank ID. -// -// Defaults: -// - value: nil. -func New() *ID { - return NewFromV2(new(refs.ContainerID)) -} - -// SetSHA256 sets container identifier value to SHA256 checksum. -func (id *ID) SetSHA256(v [sha256.Size]byte) { - (*refs.ContainerID)(id).SetValue(v[:]) -} - -// ToV2 returns the v2 container ID message. -// -// Nil ID converts to nil. -func (id *ID) ToV2() *refs.ContainerID { - return (*refs.ContainerID)(id) -} - -// Equal returns true if identifiers are identical. -func (id *ID) Equal(id2 *ID) bool { - return bytes.Equal( - (*refs.ContainerID)(id).GetValue(), - (*refs.ContainerID)(id2).GetValue(), - ) -} - -// Parse parses string representation of ID. -// -// Returns error if s is not a base58 encoded -// ID data. -func (id *ID) Parse(s string) error { - data, err := base58.Decode(s) - if err != nil { - return err - } else if len(data) != sha256.Size { - return errors.New("incorrect format of the string container ID") - } - - (*refs.ContainerID)(id).SetValue(data) - - return nil -} - -// String returns base58 string representation of ID. -func (id *ID) String() string { - return base58.Encode((*refs.ContainerID)(id).GetValue()) -} - -// Marshal marshals ID into a protobuf binary form. -// -// Buffer is allocated when the argument is empty. -// Otherwise, the first buffer is used. -func (id *ID) Marshal(b ...[]byte) ([]byte, error) { - var buf []byte - if len(b) > 0 { - buf = b[0] - } - - return (*refs.ContainerID)(id). - StableMarshal(buf) -} - -// Unmarshal unmarshals protobuf binary representation of ID. -func (id *ID) Unmarshal(data []byte) error { - return (*refs.ContainerID)(id). - Unmarshal(data) -} - -// MarshalJSON encodes ID to protobuf JSON format. -func (id *ID) MarshalJSON() ([]byte, error) { - return (*refs.ContainerID)(id). - MarshalJSON() -} - -// UnmarshalJSON decodes ID from protobuf JSON format. -func (id *ID) UnmarshalJSON(data []byte) error { - return (*refs.ContainerID)(id). - UnmarshalJSON(data) -} diff --git a/pkg/container/id/id_test.go b/pkg/container/id/id_test.go deleted file mode 100644 index b633cb4..0000000 --- a/pkg/container/id/id_test.go +++ /dev/null @@ -1,105 +0,0 @@ -package cid_test - -import ( - "crypto/sha256" - "math/rand" - "testing" - - cid "github.com/nspcc-dev/neofs-api-go/pkg/container/id" - cidtest "github.com/nspcc-dev/neofs-api-go/pkg/container/id/test" - "github.com/nspcc-dev/neofs-api-go/v2/refs" - "github.com/stretchr/testify/require" -) - -func randSHA256Checksum() (cs [sha256.Size]byte) { - rand.Read(cs[:]) - return -} - -func TestID_ToV2(t *testing.T) { - t.Run("non-nil", func(t *testing.T) { - checksum := randSHA256Checksum() - - id := cidtest.GenerateWithChecksum(checksum) - - idV2 := id.ToV2() - - require.Equal(t, id, cid.NewFromV2(idV2)) - require.Equal(t, checksum[:], idV2.GetValue()) - }) - - t.Run("nil", func(t *testing.T) { - var x *cid.ID - - require.Nil(t, x.ToV2()) - }) - - t.Run("default values", func(t *testing.T) { - cid := cid.New() - - // convert to v2 message - cidV2 := cid.ToV2() - require.Nil(t, cidV2.GetValue()) - }) -} - -func TestID_Equal(t *testing.T) { - cs := randSHA256Checksum() - - id1 := cidtest.GenerateWithChecksum(cs) - id2 := cidtest.GenerateWithChecksum(cs) - - require.True(t, id1.Equal(id2)) - - id3 := cidtest.Generate() - - require.False(t, id1.Equal(id3)) -} - -func TestID_String(t *testing.T) { - t.Run("Parse/String", func(t *testing.T) { - id := cidtest.Generate() - id2 := cid.New() - - require.NoError(t, id2.Parse(id.String())) - require.Equal(t, id, id2) - }) - - t.Run("nil", func(t *testing.T) { - id := cid.New() - - require.Empty(t, id.String()) - }) -} - -func TestContainerIDEncoding(t *testing.T) { - id := cidtest.Generate() - - t.Run("binary", func(t *testing.T) { - data, err := id.Marshal() - require.NoError(t, err) - - id2 := cid.New() - require.NoError(t, id2.Unmarshal(data)) - - require.Equal(t, id, id2) - }) - - t.Run("json", func(t *testing.T) { - data, err := id.MarshalJSON() - require.NoError(t, err) - - a2 := cid.New() - require.NoError(t, a2.UnmarshalJSON(data)) - - require.Equal(t, id, a2) - }) -} - -func TestNewFromV2(t *testing.T) { - t.Run("from nil", func(t *testing.T) { - var x *refs.ContainerID - - require.Nil(t, cid.NewFromV2(x)) - }) -} diff --git a/pkg/container/id/test/id.go b/pkg/container/id/test/id.go deleted file mode 100644 index 58eca65..0000000 --- a/pkg/container/id/test/id.go +++ /dev/null @@ -1,26 +0,0 @@ -package cidtest - -import ( - "crypto/sha256" - "math/rand" - - cid "github.com/nspcc-dev/neofs-api-go/pkg/container/id" -) - -// Generate returns random cid.ID. -func Generate() *cid.ID { - checksum := [sha256.Size]byte{} - - rand.Read(checksum[:]) - - return GenerateWithChecksum(checksum) -} - -// GenerateWithChecksum returns cid.ID initialized -// with specified checksum. -func GenerateWithChecksum(cs [sha256.Size]byte) *cid.ID { - id := cid.New() - id.SetSHA256(cs) - - return id -} diff --git a/pkg/container/opts.go b/pkg/container/opts.go deleted file mode 100644 index 8c15ed1..0000000 --- a/pkg/container/opts.go +++ /dev/null @@ -1,104 +0,0 @@ -package container - -import ( - "github.com/google/uuid" - "github.com/nspcc-dev/neofs-api-go/pkg/acl" - "github.com/nspcc-dev/neofs-api-go/pkg/netmap" - "github.com/nspcc-dev/neofs-api-go/pkg/owner" -) - -type ( - NewOption interface { - apply(*containerOptions) - } - - containerOptions struct { - acl uint32 - policy *netmap.PlacementPolicy - attributes Attributes - owner *owner.ID - nonce uuid.UUID - } -) - -func defaultContainerOptions() containerOptions { - rand, err := uuid.NewRandom() - if err != nil { - panic("can't create new random " + err.Error()) - } - - return containerOptions{ - acl: acl.PrivateBasicRule, - nonce: rand, - } -} - -type funcContainerOption struct { - f func(*containerOptions) -} - -func (fco *funcContainerOption) apply(co *containerOptions) { - fco.f(co) -} - -func newFuncContainerOption(f func(option *containerOptions)) *funcContainerOption { - return &funcContainerOption{ - f: f, - } -} - -func WithPublicBasicACL() NewOption { - return newFuncContainerOption(func(option *containerOptions) { - option.acl = acl.PublicBasicRule - }) -} - -func WithReadOnlyBasicACL() NewOption { - return newFuncContainerOption(func(option *containerOptions) { - option.acl = acl.ReadOnlyBasicRule - }) -} - -func WithCustomBasicACL(acl uint32) NewOption { - return newFuncContainerOption(func(option *containerOptions) { - option.acl = acl - }) -} - -func WithNonce(nonce uuid.UUID) NewOption { - return newFuncContainerOption(func(option *containerOptions) { - option.nonce = nonce - }) -} - -func WithOwnerID(id *owner.ID) NewOption { - return newFuncContainerOption(func(option *containerOptions) { - option.owner = id - }) -} - -func WithNEO3Wallet(w *owner.NEO3Wallet) NewOption { - return newFuncContainerOption(func(option *containerOptions) { - if option.owner == nil { - option.owner = new(owner.ID) - } - - option.owner.SetNeo3Wallet(w) - }) -} - -func WithPolicy(policy *netmap.PlacementPolicy) NewOption { - return newFuncContainerOption(func(option *containerOptions) { - option.policy = policy - }) -} - -func WithAttribute(key, value string) NewOption { - return newFuncContainerOption(func(option *containerOptions) { - attr := NewAttribute() - attr.SetKey(key) - attr.SetValue(value) - - option.attributes = append(option.attributes, attr) - }) -} diff --git a/pkg/container/test/generate.go b/pkg/container/test/generate.go deleted file mode 100644 index 0f5f9b0..0000000 --- a/pkg/container/test/generate.go +++ /dev/null @@ -1,48 +0,0 @@ -package containertest - -import ( - "github.com/nspcc-dev/neofs-api-go/pkg/container" - cidtest "github.com/nspcc-dev/neofs-api-go/pkg/container/id/test" - netmaptest "github.com/nspcc-dev/neofs-api-go/pkg/netmap/test" - ownertest "github.com/nspcc-dev/neofs-api-go/pkg/owner/test" - refstest "github.com/nspcc-dev/neofs-api-go/pkg/test" -) - -// Attribute returns random container.Attribute. -func Attribute() *container.Attribute { - x := container.NewAttribute() - - x.SetKey("key") - x.SetValue("value") - - return x -} - -// Attributes returns random container.Attributes. -func Attributes() container.Attributes { - return container.Attributes{Attribute(), Attribute()} -} - -// Container returns random container.Container. -func Container() *container.Container { - x := container.New() - - x.SetVersion(refstest.Version()) - x.SetAttributes(Attributes()) - x.SetOwnerID(ownertest.Generate()) - x.SetBasicACL(123) - x.SetPlacementPolicy(netmaptest.PlacementPolicy()) - - return x -} - -// UsedSpaceAnnouncement returns random container.UsedSpaceAnnouncement. -func UsedSpaceAnnouncement() *container.UsedSpaceAnnouncement { - x := container.NewAnnouncement() - - x.SetContainerID(cidtest.Generate()) - x.SetEpoch(55) - x.SetUsedSpace(999) - - return x -} diff --git a/pkg/container/wellknown_attributes.go b/pkg/container/wellknown_attributes.go deleted file mode 100644 index 241c745..0000000 --- a/pkg/container/wellknown_attributes.go +++ /dev/null @@ -1,11 +0,0 @@ -package container - -const ( - // AttributeName is an attribute key that is commonly used to denote - // human-friendly name. - AttributeName = "Name" - - // AttributeTimestamp is an attribute key that is commonly used to denote - // user-defined local time of container creation in Unix Timestamp format. - AttributeTimestamp = "Timestamp" -) diff --git a/pkg/netmap/aggregator.go b/pkg/netmap/aggregator.go deleted file mode 100644 index d1c6061..0000000 --- a/pkg/netmap/aggregator.go +++ /dev/null @@ -1,223 +0,0 @@ -package netmap - -import ( - "sort" -) - -type ( - // aggregator can calculate some value across all netmap - // such as median, minimum or maximum. - aggregator interface { - Add(float64) - Compute() float64 - } - - // normalizer normalizes weight. - normalizer interface { - Normalize(w float64) float64 - } - - meanSumAgg struct { - sum float64 - count int - } - - meanAgg struct { - mean float64 - count int - } - - minAgg struct { - min float64 - } - - maxAgg struct { - max float64 - } - - meanIQRAgg struct { - k float64 - arr []float64 - } - - reverseMinNorm struct { - min float64 - } - - maxNorm struct { - max float64 - } - - sigmoidNorm struct { - scale float64 - } - - constNorm struct { - value float64 - } - - // weightFunc calculates n's weight. - weightFunc = func(n *Node) float64 -) - -var ( - _ aggregator = (*meanSumAgg)(nil) - _ aggregator = (*meanAgg)(nil) - _ aggregator = (*minAgg)(nil) - _ aggregator = (*maxAgg)(nil) - _ aggregator = (*meanIQRAgg)(nil) - - _ normalizer = (*reverseMinNorm)(nil) - _ normalizer = (*maxNorm)(nil) - _ normalizer = (*sigmoidNorm)(nil) - _ normalizer = (*constNorm)(nil) -) - -// newWeightFunc returns weightFunc which multiplies normalized -// capacity and price. -func newWeightFunc(capNorm, priceNorm normalizer) weightFunc { - return func(n *Node) float64 { - return capNorm.Normalize(float64(n.Capacity)) * priceNorm.Normalize(float64(n.Price)) - } -} - -// newMeanAgg returns an aggregator which -// computes mean value by recalculating it on -// every addition. -func newMeanAgg() aggregator { - return new(meanAgg) -} - -// newMinAgg returns an aggregator which -// computes min value. -func newMinAgg() aggregator { - return new(minAgg) -} - -// newMeanIQRAgg returns an aggregator which -// computes mean value of values from IQR interval. -func newMeanIQRAgg() aggregator { - return new(meanIQRAgg) -} - -// newReverseMinNorm returns a normalizer which -// normalize values in range of 0.0 to 1.0 to a minimum value. -func newReverseMinNorm(min float64) normalizer { - return &reverseMinNorm{min: min} -} - -// newSigmoidNorm returns a normalizer which -// normalize values in range of 0.0 to 1.0 to a scaled sigmoid. -func newSigmoidNorm(scale float64) normalizer { - return &sigmoidNorm{scale: scale} -} - -func (a *meanSumAgg) Add(n float64) { - a.sum += n - a.count++ -} - -func (a *meanSumAgg) Compute() float64 { - if a.count == 0 { - return 0 - } - - return a.sum / float64(a.count) -} - -func (a *meanAgg) Add(n float64) { - c := a.count + 1 - a.mean = a.mean*(float64(a.count)/float64(c)) + n/float64(c) - a.count++ -} - -func (a *meanAgg) Compute() float64 { - return a.mean -} - -func (a *minAgg) Add(n float64) { - if a.min == 0 || n < a.min { - a.min = n - } -} - -func (a *minAgg) Compute() float64 { - return a.min -} - -func (a *maxAgg) Add(n float64) { - if n > a.max { - a.max = n - } -} - -func (a *maxAgg) Compute() float64 { - return a.max -} - -func (a *meanIQRAgg) Add(n float64) { - a.arr = append(a.arr, n) -} - -func (a *meanIQRAgg) Compute() float64 { - l := len(a.arr) - if l == 0 { - return 0 - } - - sort.Slice(a.arr, func(i, j int) bool { return a.arr[i] < a.arr[j] }) - - var min, max float64 - - const minLn = 4 - - if l < minLn { - min, max = a.arr[0], a.arr[l-1] - } else { - start, end := l/minLn, l*3/minLn-1 - iqr := a.k * (a.arr[end] - a.arr[start]) - min, max = a.arr[start]-iqr, a.arr[end]+iqr - } - - count := 0 - sum := float64(0) - - for _, e := range a.arr { - if e >= min && e <= max { - sum += e - count++ - } - } - - return sum / float64(count) -} - -func (r *reverseMinNorm) Normalize(w float64) float64 { - if w == 0 { - return 0 - } - - return r.min / w -} - -func (r *maxNorm) Normalize(w float64) float64 { - if r.max == 0 { - return 0 - } - - return w / r.max -} - -func (r *sigmoidNorm) Normalize(w float64) float64 { - if r.scale == 0 { - return 0 - } - - x := w / r.scale - - return x / (1 + x) -} - -func (r *constNorm) Normalize(_ float64) float64 { - return r.value -} diff --git a/pkg/netmap/clause.go b/pkg/netmap/clause.go deleted file mode 100644 index d2b5c40..0000000 --- a/pkg/netmap/clause.go +++ /dev/null @@ -1,69 +0,0 @@ -package netmap - -import ( - "github.com/nspcc-dev/neofs-api-go/v2/netmap" -) - -// Clause is an enumeration of selector modifiers -// that shows how the node set will be formed. -type Clause uint32 - -const ( - ClauseUnspecified Clause = iota - - // ClauseSame is a selector modifier to select only nodes having the same value of bucket attribute. - ClauseSame - - // ClauseDistinct is a selector modifier to select nodes having different values of bucket attribute. - ClauseDistinct -) - -// ClauseFromV2 converts v2 Clause to Clause. -func ClauseFromV2(c netmap.Clause) Clause { - switch c { - default: - return ClauseUnspecified - case netmap.Same: - return ClauseSame - case netmap.Distinct: - return ClauseDistinct - } -} - -// ToV2 converts Clause to v2 Clause. -func (c Clause) ToV2() netmap.Clause { - switch c { - default: - return netmap.UnspecifiedClause - case ClauseDistinct: - return netmap.Distinct - case ClauseSame: - return netmap.Same - } -} - -// String returns string representation of Clause. -// -// String mapping: -// * ClauseDistinct: DISTINCT; -// * ClauseSame: SAME; -// * ClauseUnspecified, default: CLAUSE_UNSPECIFIED. -func (c Clause) String() string { - return c.ToV2().String() -} - -// FromString parses Clause from a string representation. -// It is a reverse action to String(). -// -// Returns true if s was parsed successfully. -func (c *Clause) FromString(s string) bool { - var g netmap.Clause - - ok := g.FromString(s) - - if ok { - *c = ClauseFromV2(g) - } - - return ok -} diff --git a/pkg/netmap/clause_test.go b/pkg/netmap/clause_test.go deleted file mode 100644 index 6ce5e82..0000000 --- a/pkg/netmap/clause_test.go +++ /dev/null @@ -1,43 +0,0 @@ -package netmap - -import ( - "testing" - - "github.com/nspcc-dev/neofs-api-go/v2/netmap" - "github.com/stretchr/testify/require" -) - -func TestClauseFromV2(t *testing.T) { - for _, item := range []struct { - c Clause - cV2 netmap.Clause - }{ - { - c: ClauseUnspecified, - cV2: netmap.UnspecifiedClause, - }, - { - c: ClauseSame, - cV2: netmap.Same, - }, - { - c: ClauseDistinct, - cV2: netmap.Distinct, - }, - } { - require.Equal(t, item.c, ClauseFromV2(item.cV2)) - require.Equal(t, item.cV2, item.c.ToV2()) - } -} - -func TestClause_String(t *testing.T) { - toPtr := func(v Clause) *Clause { - return &v - } - - testEnumStrings(t, new(Clause), []enumStringItem{ - {val: toPtr(ClauseDistinct), str: "DISTINCT"}, - {val: toPtr(ClauseSame), str: "SAME"}, - {val: toPtr(ClauseUnspecified), str: "CLAUSE_UNSPECIFIED"}, - }) -} diff --git a/pkg/netmap/container.go b/pkg/netmap/container.go deleted file mode 100644 index 00875a9..0000000 --- a/pkg/netmap/container.go +++ /dev/null @@ -1,19 +0,0 @@ -package netmap - -// ContainerNodes represents nodes in the container. -type ContainerNodes interface { - Replicas() []Nodes - Flatten() Nodes -} - -type containerNodes []Nodes - -// Flatten returns list of all nodes from the container. -func (c containerNodes) Flatten() Nodes { - return flattenNodes(c) -} - -// Replicas return list of container replicas. -func (c containerNodes) Replicas() []Nodes { - return c -} diff --git a/pkg/netmap/context.go b/pkg/netmap/context.go deleted file mode 100644 index 29b8167..0000000 --- a/pkg/netmap/context.go +++ /dev/null @@ -1,94 +0,0 @@ -package netmap - -import ( - "errors" - - "github.com/nspcc-dev/hrw" -) - -// Context contains references to named filters and cached numeric values. -type Context struct { - // Netmap is a netmap structure to operate on. - Netmap *Netmap - // Filters stores processed filters. - Filters map[string]*Filter - // Selectors stores processed selectors. - Selectors map[string]*Selector - // Selections stores result of selector processing. - Selections map[string][]Nodes - - // numCache stores parsed numeric values. - numCache map[*Filter]uint64 - // pivot is a seed for HRW. - pivot []byte - // pivotHash is a saved HRW hash of pivot - pivotHash uint64 - // aggregator is returns aggregator determining bucket weight. - // By default it returns mean value from IQR interval. - aggregator func() aggregator - // weightFunc is a weighting function for determining node priority. - // By default in combines favours low price and high capacity. - weightFunc weightFunc - // container backup factor is a factor for selector counters that expand - // amount of chosen nodes. - cbf uint32 -} - -// Various validation errors. -var ( - ErrMissingField = errors.New("netmap: nil field") - ErrInvalidFilterName = errors.New("netmap: filter name is invalid") - ErrInvalidNumber = errors.New("netmap: number value expected") - ErrInvalidFilterOp = errors.New("netmap: invalid filter operation") - ErrFilterNotFound = errors.New("netmap: filter not found") - ErrNonEmptyFilters = errors.New("netmap: simple filter must no contain sub-filters") - ErrNotEnoughNodes = errors.New("netmap: not enough nodes to SELECT from") - ErrSelectorNotFound = errors.New("netmap: selector not found") - ErrUnnamedTopFilter = errors.New("netmap: all filters on top level must be named") -) - -// NewContext creates new context. It contains various caches. -// In future it may create hierarchical netmap structure to work with. -func NewContext(nm *Netmap) *Context { - return &Context{ - Netmap: nm, - Filters: make(map[string]*Filter), - Selectors: make(map[string]*Selector), - Selections: make(map[string][]Nodes), - - numCache: make(map[*Filter]uint64), - aggregator: newMeanIQRAgg, - weightFunc: GetDefaultWeightFunc(nm.Nodes), - cbf: defaultCBF, - } -} - -func (c *Context) setPivot(pivot []byte) { - if len(pivot) != 0 { - c.pivot = pivot - c.pivotHash = hrw.Hash(pivot) - } -} - -func (c *Context) setCBF(cbf uint32) { - if cbf == 0 { - c.cbf = defaultCBF - } else { - c.cbf = cbf - } -} - -// GetDefaultWeightFunc returns default weighting function. -func GetDefaultWeightFunc(ns Nodes) weightFunc { - mean := newMeanAgg() - min := newMinAgg() - - for i := range ns { - mean.Add(float64(ns[i].Capacity)) - min.Add(float64(ns[i].Price)) - } - - return newWeightFunc( - newSigmoidNorm(mean.Compute()), - newReverseMinNorm(min.Compute())) -} diff --git a/pkg/netmap/doc.go b/pkg/netmap/doc.go deleted file mode 100644 index a38e985..0000000 --- a/pkg/netmap/doc.go +++ /dev/null @@ -1,11 +0,0 @@ -/* -Package netmap provides routines for working with netmap and placement policy. -Work is done in 4 steps: -1. Create context containing results shared between steps. -2. Processing filters. -3. Processing selectors. -4. Processing replicas. - -Each step depends only on previous ones. -*/ -package netmap diff --git a/pkg/netmap/filter.go b/pkg/netmap/filter.go deleted file mode 100644 index 4beb1f5..0000000 --- a/pkg/netmap/filter.go +++ /dev/null @@ -1,295 +0,0 @@ -package netmap - -import ( - "fmt" - "strconv" - - "github.com/nspcc-dev/neofs-api-go/v2/netmap" -) - -// Filter represents v2-compatible netmap filter. -type Filter netmap.Filter - -// MainFilterName is a name of the filter -// which points to the whole netmap. -const MainFilterName = "*" - -// applyFilter applies named filter to b. -func (c *Context) applyFilter(name string, b *Node) bool { - return name == MainFilterName || c.match(c.Filters[name], b) -} - -// processFilters processes filters and returns error is any of them is invalid. -func (c *Context) processFilters(p *PlacementPolicy) error { - for _, f := range p.Filters() { - if err := c.processFilter(f, true); err != nil { - return err - } - } - - return nil -} - -func (c *Context) processFilter(f *Filter, top bool) error { - if f == nil { - return fmt.Errorf("%w: FILTER", ErrMissingField) - } - - if f.Name() == MainFilterName { - return fmt.Errorf("%w: '*' is reserved", ErrInvalidFilterName) - } - - if top && f.Name() == "" { - return ErrUnnamedTopFilter - } - - if !top && f.Name() != "" && c.Filters[f.Name()] == nil { - return fmt.Errorf("%w: '%s'", ErrFilterNotFound, f.Name()) - } - - switch f.Operation() { - case OpAND, OpOR: - for _, flt := range f.InnerFilters() { - if err := c.processFilter(flt, false); err != nil { - return err - } - } - default: - if len(f.InnerFilters()) != 0 { - return ErrNonEmptyFilters - } else if !top && f.Name() != "" { // named reference - return nil - } - - switch f.Operation() { - case OpEQ, OpNE: - case OpGT, OpGE, OpLT, OpLE: - n, err := strconv.ParseUint(f.Value(), 10, 64) - if err != nil { - return fmt.Errorf("%w: '%s'", ErrInvalidNumber, f.Value()) - } - - c.numCache[f] = n - default: - return fmt.Errorf("%w: %s", ErrInvalidFilterOp, f.Operation()) - } - } - - if top { - c.Filters[f.Name()] = f - } - - return nil -} - -// match matches f against b. It returns no errors because -// filter should have been parsed during context creation -// and missing node properties are considered as a regular fail. -func (c *Context) match(f *Filter, b *Node) bool { - switch f.Operation() { - case OpAND, OpOR: - for _, lf := range f.InnerFilters() { - if lf.Name() != "" { - lf = c.Filters[lf.Name()] - } - - ok := c.match(lf, b) - if ok == (f.Operation() == OpOR) { - return ok - } - } - - return f.Operation() == OpAND - default: - return c.matchKeyValue(f, b) - } -} - -func (c *Context) matchKeyValue(f *Filter, b *Node) bool { - switch f.Operation() { - case OpEQ: - return b.Attribute(f.Key()) == f.Value() - case OpNE: - return b.Attribute(f.Key()) != f.Value() - default: - var attr uint64 - - switch f.Key() { - case AttrPrice: - attr = b.Price - case AttrCapacity: - attr = b.Capacity - default: - var err error - - attr, err = strconv.ParseUint(b.Attribute(f.Key()), 10, 64) - if err != nil { - // Note: because filters are somewhat independent from nodes attributes, - // We don't report an error here, and fail filter instead. - return false - } - } - - switch f.Operation() { - case OpGT: - return attr > c.numCache[f] - case OpGE: - return attr >= c.numCache[f] - case OpLT: - return attr < c.numCache[f] - case OpLE: - return attr <= c.numCache[f] - default: - // do nothing and return false - } - } - // will not happen if context was created from f (maybe panic?) - return false -} - -// NewFilter creates and returns new Filter instance. -// -// Defaults: -// - name: ""; -// - key: ""; -// - value: ""; -// - operation: 0; -// - filters: nil. -func NewFilter() *Filter { - return NewFilterFromV2(new(netmap.Filter)) -} - -// NewFilterFromV2 converts v2 Filter to Filter. -// -// Nil netmap.Filter converts to nil. -func NewFilterFromV2(f *netmap.Filter) *Filter { - return (*Filter)(f) -} - -// ToV2 converts Filter to v2 Filter. -// -// Nil Filter converts to nil. -func (f *Filter) ToV2() *netmap.Filter { - return (*netmap.Filter)(f) -} - -// Key returns key to filter. -func (f *Filter) Key() string { - return (*netmap.Filter)(f). - GetKey() -} - -// SetKey sets key to filter. -func (f *Filter) SetKey(key string) { - (*netmap.Filter)(f). - SetKey(key) -} - -// Value returns value to match. -func (f *Filter) Value() string { - return (*netmap.Filter)(f). - GetValue() -} - -// SetValue sets value to match. -func (f *Filter) SetValue(val string) { - (*netmap.Filter)(f). - SetValue(val) -} - -// Name returns filter name. -func (f *Filter) Name() string { - return (*netmap.Filter)(f). - GetName() -} - -// SetName sets filter name. -func (f *Filter) SetName(name string) { - (*netmap.Filter)(f). - SetName(name) -} - -// Operation returns filtering operation. -func (f *Filter) Operation() Operation { - return OperationFromV2( - (*netmap.Filter)(f). - GetOp(), - ) -} - -// SetOperation sets filtering operation. -func (f *Filter) SetOperation(op Operation) { - (*netmap.Filter)(f). - SetOp(op.ToV2()) -} - -func filtersFromV2(fs []*netmap.Filter) []*Filter { - if fs == nil { - return nil - } - - res := make([]*Filter, 0, len(fs)) - - for i := range fs { - res = append(res, NewFilterFromV2(fs[i])) - } - - return res -} - -// InnerFilters returns list of inner filters. -func (f *Filter) InnerFilters() []*Filter { - return filtersFromV2( - (*netmap.Filter)(f). - GetFilters(), - ) -} - -func filtersToV2(fs []*Filter) (fsV2 []*netmap.Filter) { - if fs != nil { - fsV2 = make([]*netmap.Filter, 0, len(fs)) - - for i := range fs { - fsV2 = append(fsV2, fs[i].ToV2()) - } - } - - return -} - -// SetInnerFilters sets list of inner filters. -func (f *Filter) SetInnerFilters(fs ...*Filter) { - (*netmap.Filter)(f). - SetFilters(filtersToV2(fs)) -} - -// Marshal marshals Filter into a protobuf binary form. -// -// Buffer is allocated when the argument is empty. -// Otherwise, the first buffer is used. -func (f *Filter) Marshal(b ...[]byte) ([]byte, error) { - var buf []byte - if len(b) > 0 { - buf = b[0] - } - - return (*netmap.Filter)(f).StableMarshal(buf) -} - -// Unmarshal unmarshals protobuf binary representation of Filter. -func (f *Filter) Unmarshal(data []byte) error { - return (*netmap.Filter)(f). - Unmarshal(data) -} - -// MarshalJSON encodes Filter to protobuf JSON format. -func (f *Filter) MarshalJSON() ([]byte, error) { - return (*netmap.Filter)(f). - MarshalJSON() -} - -// UnmarshalJSON decodes Filter from protobuf JSON format. -func (f *Filter) UnmarshalJSON(data []byte) error { - return (*netmap.Filter)(f). - UnmarshalJSON(data) -} diff --git a/pkg/netmap/filter_test.go b/pkg/netmap/filter_test.go deleted file mode 100644 index c9103e1..0000000 --- a/pkg/netmap/filter_test.go +++ /dev/null @@ -1,331 +0,0 @@ -package netmap - -import ( - "errors" - "testing" - - "github.com/nspcc-dev/neofs-api-go/v2/netmap" - "github.com/stretchr/testify/require" -) - -func TestContext_ProcessFilters(t *testing.T) { - fs := []*Filter{ - newFilter("StorageSSD", "Storage", "SSD", OpEQ), - newFilter("GoodRating", "Rating", "4", OpGE), - newFilter("Main", "", "", OpAND, - newFilter("StorageSSD", "", "", 0), - newFilter("", "IntField", "123", OpLT), - newFilter("GoodRating", "", "", 0)), - } - nm, err := NewNetmap(nil) - require.NoError(t, err) - c := NewContext(nm) - p := newPlacementPolicy(1, nil, nil, fs) - require.NoError(t, c.processFilters(p)) - require.Equal(t, 3, len(c.Filters)) - for _, f := range fs { - require.Equal(t, f, c.Filters[f.Name()]) - } - - require.Equal(t, uint64(4), c.numCache[fs[1]]) - require.Equal(t, uint64(123), c.numCache[fs[2].InnerFilters()[1]]) -} - -func TestContext_ProcessFiltersInvalid(t *testing.T) { - errTestCases := []struct { - name string - filter *Filter - err error - }{ - { - "UnnamedTop", - newFilter("", "Storage", "SSD", OpEQ), - ErrUnnamedTopFilter, - }, - { - "InvalidReference", - newFilter("Main", "", "", OpAND, - newFilter("StorageSSD", "", "", 0)), - ErrFilterNotFound, - }, - { - "NonEmptyKeyed", - newFilter("Main", "Storage", "SSD", OpEQ, - newFilter("StorageSSD", "", "", 0)), - ErrNonEmptyFilters, - }, - { - "InvalidNumber", - newFilter("Main", "Rating", "three", OpGE), - ErrInvalidNumber, - }, - { - "InvalidOp", - newFilter("Main", "Rating", "3", 0), - ErrInvalidFilterOp, - }, - { - "InvalidName", - newFilter("*", "Rating", "3", OpGE), - ErrInvalidFilterName, - }, - { - "MissingFilter", - nil, - ErrMissingField, - }, - } - for _, tc := range errTestCases { - t.Run(tc.name, func(t *testing.T) { - c := NewContext(new(Netmap)) - p := newPlacementPolicy(1, nil, nil, []*Filter{tc.filter}) - err := c.processFilters(p) - require.True(t, errors.Is(err, tc.err), "got: %v", err) - }) - } -} - -func TestFilter_MatchSimple(t *testing.T) { - b := &Node{AttrMap: map[string]string{ - "Rating": "4", - "Country": "Germany", - }} - testCases := []struct { - name string - ok bool - f *Filter - }{ - { - "GE_true", true, - newFilter("Main", "Rating", "4", OpGE), - }, - { - "GE_false", false, - newFilter("Main", "Rating", "5", OpGE), - }, - { - "GT_true", true, - newFilter("Main", "Rating", "3", OpGT), - }, - { - "GT_false", false, - newFilter("Main", "Rating", "4", OpGT), - }, - { - "LE_true", true, - newFilter("Main", "Rating", "4", OpLE), - }, - { - "LE_false", false, - newFilter("Main", "Rating", "3", OpLE), - }, - { - "LT_true", true, - newFilter("Main", "Rating", "5", OpLT), - }, - { - "LT_false", false, - newFilter("Main", "Rating", "4", OpLT), - }, - { - "EQ_true", true, - newFilter("Main", "Country", "Germany", OpEQ), - }, - { - "EQ_false", false, - newFilter("Main", "Country", "China", OpEQ), - }, - { - "NE_true", true, - newFilter("Main", "Country", "France", OpNE), - }, - { - "NE_false", false, - newFilter("Main", "Country", "Germany", OpNE), - }, - } - for _, tc := range testCases { - c := NewContext(new(Netmap)) - p := newPlacementPolicy(1, nil, nil, []*Filter{tc.f}) - require.NoError(t, c.processFilters(p)) - require.Equal(t, tc.ok, c.match(tc.f, b)) - } - - t.Run("InvalidOp", func(t *testing.T) { - f := newFilter("Main", "Rating", "5", OpEQ) - c := NewContext(new(Netmap)) - p := newPlacementPolicy(1, nil, nil, []*Filter{f}) - require.NoError(t, c.processFilters(p)) - - // just for the coverage - f.SetOperation(0) - require.False(t, c.match(f, b)) - }) -} - -func TestFilter_Match(t *testing.T) { - fs := []*Filter{ - newFilter("StorageSSD", "Storage", "SSD", OpEQ), - newFilter("GoodRating", "Rating", "4", OpGE), - newFilter("Main", "", "", OpAND, - newFilter("StorageSSD", "", "", 0), - newFilter("", "IntField", "123", OpLT), - newFilter("GoodRating", "", "", 0), - newFilter("", "", "", OpOR, - newFilter("", "Param", "Value1", OpEQ), - newFilter("", "Param", "Value2", OpEQ), - )), - } - c := NewContext(new(Netmap)) - p := newPlacementPolicy(1, nil, nil, fs) - require.NoError(t, c.processFilters(p)) - - t.Run("Good", func(t *testing.T) { - n := getTestNode("Storage", "SSD", "Rating", "10", "IntField", "100", "Param", "Value1") - require.True(t, c.applyFilter("Main", n)) - }) - t.Run("InvalidStorage", func(t *testing.T) { - n := getTestNode("Storage", "HDD", "Rating", "10", "IntField", "100", "Param", "Value1") - require.False(t, c.applyFilter("Main", n)) - }) - t.Run("InvalidRating", func(t *testing.T) { - n := getTestNode("Storage", "SSD", "Rating", "3", "IntField", "100", "Param", "Value1") - require.False(t, c.applyFilter("Main", n)) - }) - t.Run("InvalidIntField", func(t *testing.T) { - n := getTestNode("Storage", "SSD", "Rating", "3", "IntField", "str", "Param", "Value1") - require.False(t, c.applyFilter("Main", n)) - }) - t.Run("InvalidParam", func(t *testing.T) { - n := getTestNode("Storage", "SSD", "Rating", "3", "IntField", "100", "Param", "NotValue") - require.False(t, c.applyFilter("Main", n)) - }) -} - -func testFilter() *Filter { - f := NewFilter() - f.SetOperation(OpGE) - f.SetName("name") - f.SetKey("key") - f.SetValue("value") - - return f -} - -func TestFilterFromV2(t *testing.T) { - t.Run("nil from V2", func(t *testing.T) { - var x *netmap.Filter - - require.Nil(t, NewFilterFromV2(x)) - }) - - t.Run("nil to V2", func(t *testing.T) { - var x *Filter - - require.Nil(t, x.ToV2()) - }) - - fV2 := new(netmap.Filter) - fV2.SetOp(netmap.GE) - fV2.SetName("name") - fV2.SetKey("key") - fV2.SetValue("value") - - f := NewFilterFromV2(fV2) - - require.Equal(t, fV2, f.ToV2()) -} - -func TestFilter_Key(t *testing.T) { - f := NewFilter() - key := "some key" - - f.SetKey(key) - - require.Equal(t, key, f.Key()) -} - -func TestFilter_Value(t *testing.T) { - f := NewFilter() - val := "some value" - - f.SetValue(val) - - require.Equal(t, val, f.Value()) -} - -func TestFilter_Name(t *testing.T) { - f := NewFilter() - name := "some name" - - f.SetName(name) - - require.Equal(t, name, f.Name()) -} - -func TestFilter_Operation(t *testing.T) { - f := NewFilter() - op := OpGE - - f.SetOperation(op) - - require.Equal(t, op, f.Operation()) -} - -func TestFilter_InnerFilters(t *testing.T) { - f := NewFilter() - - f1, f2 := testFilter(), testFilter() - - f.SetInnerFilters(f1, f2) - - require.Equal(t, []*Filter{f1, f2}, f.InnerFilters()) -} - -func TestFilterEncoding(t *testing.T) { - f := newFilter("name", "key", "value", OpEQ, - newFilter("name2", "key2", "value", OpOR), - ) - - t.Run("binary", func(t *testing.T) { - data, err := f.Marshal() - require.NoError(t, err) - - f2 := NewFilter() - require.NoError(t, f2.Unmarshal(data)) - - require.Equal(t, f, f2) - }) - - t.Run("json", func(t *testing.T) { - data, err := f.MarshalJSON() - require.NoError(t, err) - - f2 := NewFilter() - require.NoError(t, f2.UnmarshalJSON(data)) - - require.Equal(t, f, f2) - }) -} - -func TestNewFilter(t *testing.T) { - t.Run("default values", func(t *testing.T) { - filter := NewFilter() - - // check initial values - require.Empty(t, filter.Name()) - require.Empty(t, filter.Key()) - require.Empty(t, filter.Value()) - require.Zero(t, filter.Operation()) - require.Nil(t, filter.InnerFilters()) - - // convert to v2 message - filterV2 := filter.ToV2() - - require.Empty(t, filterV2.GetName()) - require.Empty(t, filterV2.GetKey()) - require.Empty(t, filterV2.GetValue()) - require.Equal(t, netmap.UnspecifiedOperation, filterV2.GetOp()) - require.Nil(t, filterV2.GetFilters()) - }) -} diff --git a/pkg/netmap/helper_test.go b/pkg/netmap/helper_test.go deleted file mode 100644 index 73b82ae..0000000 --- a/pkg/netmap/helper_test.go +++ /dev/null @@ -1,93 +0,0 @@ -package netmap - -import ( - "testing" - - "github.com/stretchr/testify/require" -) - -func newFilter(name string, k, v string, op Operation, fs ...*Filter) *Filter { - f := NewFilter() - f.SetName(name) - f.SetKey(k) - f.SetOperation(op) - f.SetValue(v) - f.SetInnerFilters(fs...) - return f -} - -func newSelector(name string, attr string, c Clause, count uint32, filter string) *Selector { - s := NewSelector() - s.SetName(name) - s.SetAttribute(attr) - s.SetCount(count) - s.SetClause(c) - s.SetFilter(filter) - return s -} - -func newPlacementPolicy(bf uint32, rs []*Replica, ss []*Selector, fs []*Filter) *PlacementPolicy { - p := NewPlacementPolicy() - p.SetContainerBackupFactor(bf) - p.SetReplicas(rs...) - p.SetSelectors(ss...) - p.SetFilters(fs...) - return p -} - -func newReplica(c uint32, s string) *Replica { - r := NewReplica() - r.SetCount(c) - r.SetSelector(s) - return r -} - -func nodeInfoFromAttributes(props ...string) NodeInfo { - attrs := make([]*NodeAttribute, len(props)/2) - for i := range attrs { - attrs[i] = NewNodeAttribute() - attrs[i].SetKey(props[i*2]) - attrs[i].SetValue(props[i*2+1]) - } - n := NewNodeInfo() - n.SetAttributes(attrs...) - return *n -} - -func getTestNode(props ...string) *Node { - m := make(map[string]string, len(props)/2) - for i := 0; i < len(props); i += 2 { - m[props[i]] = props[i+1] - } - return &Node{AttrMap: m} -} - -type enumIface interface { - FromString(string) bool - String() string -} - -type enumStringItem struct { - val enumIface - str string -} - -func testEnumStrings(t *testing.T, e enumIface, items []enumStringItem) { - for _, item := range items { - require.Equal(t, item.str, item.val.String()) - - s := item.val.String() - - require.True(t, e.FromString(s), s) - - require.EqualValues(t, item.val, e, item.val) - } - - // incorrect strings - for _, str := range []string{ - "some string", - "undefined", - } { - require.False(t, e.FromString(str)) - } -} diff --git a/pkg/netmap/netmap.go b/pkg/netmap/netmap.go deleted file mode 100644 index 369d9ac..0000000 --- a/pkg/netmap/netmap.go +++ /dev/null @@ -1,100 +0,0 @@ -package netmap - -import ( - "fmt" - - "github.com/nspcc-dev/hrw" -) - -const defaultCBF = 3 - -// Netmap represents netmap which contains preprocessed nodes. -type Netmap struct { - Nodes Nodes -} - -// NewNetmap constructs netmap from the list of raw nodes. -func NewNetmap(nodes Nodes) (*Netmap, error) { - return &Netmap{ - Nodes: nodes, - }, nil -} - -func flattenNodes(ns []Nodes) Nodes { - result := make(Nodes, 0, len(ns)) - for i := range ns { - result = append(result, ns[i]...) - } - - return result -} - -// GetPlacementVectors returns placement vectors for an object given containerNodes cnt. -func (m *Netmap) GetPlacementVectors(cnt ContainerNodes, pivot []byte) ([]Nodes, error) { - h := hrw.Hash(pivot) - wf := GetDefaultWeightFunc(m.Nodes) - result := make([]Nodes, len(cnt.Replicas())) - - for i, rep := range cnt.Replicas() { - result[i] = make(Nodes, len(rep)) - copy(result[i], rep) - hrw.SortSliceByWeightValue(result[i], result[i].Weights(wf), h) - } - - return result, nil -} - -// GetContainerNodes returns nodes corresponding to each replica. -// Order of returned nodes corresponds to order of replicas in p. -// pivot is a seed for HRW sorting. -func (m *Netmap) GetContainerNodes(p *PlacementPolicy, pivot []byte) (ContainerNodes, error) { - c := NewContext(m) - c.setPivot(pivot) - c.setCBF(p.ContainerBackupFactor()) - - if err := c.processFilters(p); err != nil { - return nil, err - } - - if err := c.processSelectors(p); err != nil { - return nil, err - } - - result := make([]Nodes, len(p.Replicas())) - - for i, r := range p.Replicas() { - if r == nil { - return nil, fmt.Errorf("%w: REPLICA", ErrMissingField) - } - - if r.Selector() == "" { - if len(p.Selectors()) == 0 { - s := new(Selector) - s.SetCount(r.Count()) - s.SetFilter(MainFilterName) - - nodes, err := c.getSelection(p, s) - if err != nil { - return nil, err - } - - result[i] = flattenNodes(nodes) - } - - for _, s := range p.Selectors() { - result[i] = append(result[i], flattenNodes(c.Selections[s.Name()])...) - } - - continue - } - - nodes, ok := c.Selections[r.Selector()] - if !ok { - return nil, fmt.Errorf("%w: REPLICA '%s'", ErrSelectorNotFound, r.Selector()) - } - - result[i] = append(result[i], flattenNodes(nodes)...) - } - - return containerNodes(result), nil -} diff --git a/pkg/netmap/network_info.go b/pkg/netmap/network_info.go deleted file mode 100644 index e8a8a94..0000000 --- a/pkg/netmap/network_info.go +++ /dev/null @@ -1,225 +0,0 @@ -package netmap - -import ( - "github.com/nspcc-dev/neofs-api-go/v2/netmap" -) - -// NetworkInfo represents v2-compatible structure -// with information about NeoFS network. -type NetworkInfo netmap.NetworkInfo - -// NewNetworkInfoFromV2 wraps v2 NetworkInfo message to NetworkInfo. -// -// Nil netmap.NetworkInfo converts to nil. -func NewNetworkInfoFromV2(iV2 *netmap.NetworkInfo) *NetworkInfo { - return (*NetworkInfo)(iV2) -} - -// NewNetworkInfo creates and initializes blank NetworkInfo. -// -// Defaults: -// - curEpoch: 0; -// - magicNum: 0; -// - msPerBlock: 0; -// - network config: nil. -func NewNetworkInfo() *NetworkInfo { - return NewNetworkInfoFromV2(new(netmap.NetworkInfo)) -} - -// ToV2 converts NetworkInfo to v2 NetworkInfo. -// -// Nil NetworkInfo converts to nil. -func (i *NetworkInfo) ToV2() *netmap.NetworkInfo { - return (*netmap.NetworkInfo)(i) -} - -// CurrentEpoch returns current epoch of the NeoFS network. -func (i *NetworkInfo) CurrentEpoch() uint64 { - return (*netmap.NetworkInfo)(i). - GetCurrentEpoch() -} - -// SetCurrentEpoch sets current epoch of the NeoFS network. -func (i *NetworkInfo) SetCurrentEpoch(epoch uint64) { - (*netmap.NetworkInfo)(i). - SetCurrentEpoch(epoch) -} - -// MagicNumber returns magic number of the sidechain. -func (i *NetworkInfo) MagicNumber() uint64 { - return (*netmap.NetworkInfo)(i). - GetMagicNumber() -} - -// SetMagicNumber sets magic number of the sidechain. -func (i *NetworkInfo) SetMagicNumber(epoch uint64) { - (*netmap.NetworkInfo)(i). - SetMagicNumber(epoch) -} - -// MsPerBlock returns MillisecondsPerBlock network parameter. -func (i *NetworkInfo) MsPerBlock() int64 { - return (*netmap.NetworkInfo)(i). - GetMsPerBlock() -} - -// SetMsPerBlock sets MillisecondsPerBlock network parameter. -func (i *NetworkInfo) SetMsPerBlock(v int64) { - (*netmap.NetworkInfo)(i). - SetMsPerBlock(v) -} - -// NetworkConfig returns NeoFS network configuration. -func (i *NetworkInfo) NetworkConfig() *NetworkConfig { - return NewNetworkConfigFromV2( - (*netmap.NetworkInfo)(i). - GetNetworkConfig(), - ) -} - -// SetNetworkConfig sets NeoFS network configuration. -func (i *NetworkInfo) SetNetworkConfig(v *NetworkConfig) { - (*netmap.NetworkInfo)(i). - SetNetworkConfig(v.ToV2()) -} - -// Marshal marshals NetworkInfo into a protobuf binary form. -// -// Buffer is allocated when the argument is empty. -// Otherwise, the first buffer is used. -func (i *NetworkInfo) Marshal(b ...[]byte) ([]byte, error) { - var buf []byte - if len(b) > 0 { - buf = b[0] - } - - return (*netmap.NetworkInfo)(i). - StableMarshal(buf) -} - -// Unmarshal unmarshals protobuf binary representation of NetworkInfo. -func (i *NetworkInfo) Unmarshal(data []byte) error { - return (*netmap.NetworkInfo)(i). - Unmarshal(data) -} - -// MarshalJSON encodes NetworkInfo to protobuf JSON format. -func (i *NetworkInfo) MarshalJSON() ([]byte, error) { - return (*netmap.NetworkInfo)(i). - MarshalJSON() -} - -// UnmarshalJSON decodes NetworkInfo from protobuf JSON format. -func (i *NetworkInfo) UnmarshalJSON(data []byte) error { - return (*netmap.NetworkInfo)(i). - UnmarshalJSON(data) -} - -// NetworkParameter represents v2-compatible NeoFS network parameter. -type NetworkParameter netmap.NetworkParameter - -// NewNetworkParameterFromV2 wraps v2 NetworkParameter message to NetworkParameter. -// -// Nil netmap.NetworkParameter converts to nil. -func NewNetworkParameterFromV2(pv2 *netmap.NetworkParameter) *NetworkParameter { - return (*NetworkParameter)(pv2) -} - -// NewNetworkParameter creates and initializes blank NetworkParameter. -// -// Defaults: -// - key: nil; -// - value: nil. -func NewNetworkParameter() *NetworkParameter { - return NewNetworkParameterFromV2(new(netmap.NetworkParameter)) -} - -// ToV2 converts NetworkParameter to v2 NetworkParameter. -// -// Nil NetworkParameter converts to nil. -func (x *NetworkParameter) ToV2() *netmap.NetworkParameter { - return (*netmap.NetworkParameter)(x) -} - -// Key returns key to network parameter. -func (x *NetworkParameter) Key() []byte { - return (*netmap.NetworkParameter)(x). - GetKey() -} - -// SetKey sets key to the network parameter. -func (x *NetworkParameter) SetKey(key []byte) { - (*netmap.NetworkParameter)(x). - SetKey(key) -} - -// Value returns value of the network parameter. -func (x *NetworkParameter) Value() []byte { - return (*netmap.NetworkParameter)(x). - GetValue() -} - -// SetValue sets value of the network parameter. -func (x *NetworkParameter) SetValue(val []byte) { - (*netmap.NetworkParameter)(x). - SetValue(val) -} - -// NetworkConfig represents v2-compatible NeoFS network configuration. -type NetworkConfig netmap.NetworkConfig - -// NewNetworkConfigFromV2 wraps v2 NetworkConfig message to NetworkConfig. -// -// Nil netmap.NetworkConfig converts to nil. -func NewNetworkConfigFromV2(cv2 *netmap.NetworkConfig) *NetworkConfig { - return (*NetworkConfig)(cv2) -} - -// NewNetworkConfig creates and initializes blank NetworkConfig. -// -// Defaults: -// - parameters num: 0. -func NewNetworkConfig() *NetworkConfig { - return NewNetworkConfigFromV2(new(netmap.NetworkConfig)) -} - -// ToV2 converts NetworkConfig to v2 NetworkConfig. -// -// Nil NetworkConfig converts to nil. -func (x *NetworkConfig) ToV2() *netmap.NetworkConfig { - return (*netmap.NetworkConfig)(x) -} - -// NumberOfParameters returns number of network parameters. -func (x *NetworkConfig) NumberOfParameters() int { - return (*netmap.NetworkConfig)(x).NumberOfParameters() -} - -// IterateAddresses iterates over network parameters. -// Breaks iteration on f's true return. -// -// Handler should not be nil. -func (x *NetworkConfig) IterateParameters(f func(*NetworkParameter) bool) { - (*netmap.NetworkConfig)(x). - IterateParameters(func(p *netmap.NetworkParameter) bool { - return f(NewNetworkParameterFromV2(p)) - }) -} - -// Value returns value of the network parameter. -func (x *NetworkConfig) SetParameters(ps ...*NetworkParameter) { - var psV2 []*netmap.NetworkParameter - - if ps != nil { - ln := len(ps) - - psV2 = make([]*netmap.NetworkParameter, 0, ln) - - for i := 0; i < ln; i++ { - psV2 = append(psV2, ps[i].ToV2()) - } - } - - (*netmap.NetworkConfig)(x). - SetParameters(psV2...) -} diff --git a/pkg/netmap/network_info_test.go b/pkg/netmap/network_info_test.go deleted file mode 100644 index c36b614..0000000 --- a/pkg/netmap/network_info_test.go +++ /dev/null @@ -1,215 +0,0 @@ -package netmap_test - -import ( - "testing" - - . "github.com/nspcc-dev/neofs-api-go/pkg/netmap" - netmaptest "github.com/nspcc-dev/neofs-api-go/pkg/netmap/test" - "github.com/stretchr/testify/require" -) - -func TestNetworkParameter_Key(t *testing.T) { - i := NewNetworkParameter() - - k := []byte("key") - - i.SetKey(k) - - require.Equal(t, k, i.Key()) - require.Equal(t, k, i.ToV2().GetKey()) -} - -func TestNetworkParameter_Value(t *testing.T) { - i := NewNetworkParameter() - - v := []byte("value") - - i.SetValue(v) - - require.Equal(t, v, i.Value()) - require.Equal(t, v, i.ToV2().GetValue()) -} - -func TestNewNetworkParameterFromV2(t *testing.T) { - t.Run("nil", func(t *testing.T) { - require.Nil(t, NewNetworkParameterFromV2(nil)) - }) -} - -func TestNetworkParameter_ToV2(t *testing.T) { - t.Run("nil", func(t *testing.T) { - var x *NetworkParameter - - require.Nil(t, x.ToV2()) - }) -} - -func TestNewNetworkParameter(t *testing.T) { - x := NewNetworkParameter() - - // check initial values - require.Nil(t, x.Key()) - require.Nil(t, x.Value()) - - // convert to v2 message - xV2 := x.ToV2() - - require.Nil(t, xV2.GetKey()) - require.Nil(t, xV2.GetValue()) -} - -func TestNetworkConfig_SetParameters(t *testing.T) { - x := NewNetworkConfig() - - require.Zero(t, x.NumberOfParameters()) - - called := 0 - - x.IterateParameters(func(p *NetworkParameter) bool { - called++ - return false - }) - - require.Zero(t, called) - - pps := []*NetworkParameter{ - netmaptest.NetworkParameter(), - netmaptest.NetworkParameter(), - } - - x.SetParameters(pps...) - - require.EqualValues(t, len(pps), x.NumberOfParameters()) - - var dst []*NetworkParameter - - x.IterateParameters(func(p *NetworkParameter) bool { - dst = append(dst, p) - called++ - return false - }) - - require.Equal(t, pps, dst) - require.Equal(t, len(pps), called) -} - -func TestNewNetworkConfigFromV2(t *testing.T) { - t.Run("nil", func(t *testing.T) { - require.Nil(t, NewNetworkConfigFromV2(nil)) - }) -} - -func TestNetworkConfig_ToV2(t *testing.T) { - t.Run("nil", func(t *testing.T) { - - var x *NetworkConfig - require.Nil(t, x.ToV2()) - }) -} - -func TestNewNetworkConfig(t *testing.T) { - x := NewNetworkConfig() - - // check initial values - require.Zero(t, x.NumberOfParameters()) - - // convert to v2 message - xV2 := x.ToV2() - - require.Zero(t, xV2.NumberOfParameters()) -} - -func TestNetworkInfo_CurrentEpoch(t *testing.T) { - i := NewNetworkInfo() - e := uint64(13) - - i.SetCurrentEpoch(e) - - require.Equal(t, e, i.CurrentEpoch()) - require.Equal(t, e, i.ToV2().GetCurrentEpoch()) -} - -func TestNetworkInfo_MagicNumber(t *testing.T) { - i := NewNetworkInfo() - m := uint64(666) - - i.SetMagicNumber(m) - - require.Equal(t, m, i.MagicNumber()) - require.Equal(t, m, i.ToV2().GetMagicNumber()) -} - -func TestNetworkInfo_MsPerBlock(t *testing.T) { - i := NewNetworkInfo() - - const ms = 987 - - i.SetMsPerBlock(ms) - - require.EqualValues(t, ms, i.MsPerBlock()) - require.EqualValues(t, ms, i.ToV2().GetMsPerBlock()) -} - -func TestNetworkInfo_Config(t *testing.T) { - i := NewNetworkInfo() - - c := netmaptest.NetworkConfig() - - i.SetNetworkConfig(c) - - require.Equal(t, c, i.NetworkConfig()) -} - -func TestNetworkInfoEncoding(t *testing.T) { - i := netmaptest.NetworkInfo() - - t.Run("binary", func(t *testing.T) { - data, err := i.Marshal() - require.NoError(t, err) - - i2 := NewNetworkInfo() - require.NoError(t, i2.Unmarshal(data)) - - require.Equal(t, i, i2) - }) - - t.Run("json", func(t *testing.T) { - data, err := i.MarshalJSON() - require.NoError(t, err) - - i2 := NewNetworkInfo() - require.NoError(t, i2.UnmarshalJSON(data)) - - require.Equal(t, i, i2) - }) -} - -func TestNewNetworkInfoFromV2(t *testing.T) { - t.Run("nil", func(t *testing.T) { - require.Nil(t, NewNetworkInfoFromV2(nil)) - }) -} - -func TestNetworkInfo_ToV2(t *testing.T) { - t.Run("nil", func(t *testing.T) { - var x *NetworkInfo - - require.Nil(t, x.ToV2()) - }) -} - -func TestNewNetworkInfo(t *testing.T) { - ni := NewNetworkInfo() - - // check initial values - require.Zero(t, ni.CurrentEpoch()) - require.Zero(t, ni.MagicNumber()) - require.Zero(t, ni.MsPerBlock()) - - // convert to v2 message - niV2 := ni.ToV2() - - require.Zero(t, niV2.GetCurrentEpoch()) - require.Zero(t, niV2.GetMagicNumber()) - require.Zero(t, niV2.GetMsPerBlock()) -} diff --git a/pkg/netmap/node_info.go b/pkg/netmap/node_info.go deleted file mode 100644 index 3e62bbd..0000000 --- a/pkg/netmap/node_info.go +++ /dev/null @@ -1,461 +0,0 @@ -package netmap - -import ( - "strconv" - - "github.com/nspcc-dev/hrw" - "github.com/nspcc-dev/neofs-api-go/v2/netmap" -) - -type ( - // Node is a wrapper over NodeInfo. - Node struct { - ID uint64 - Index int - Capacity uint64 - Price uint64 - AttrMap map[string]string - - *NodeInfo - } - - // Nodes represents slice of graph leafs. - Nodes []*Node -) - -// NodeState is an enumeration of various states of the NeoFS node. -type NodeState uint32 - -// NodeAttribute represents v2 compatible attribute of the NeoFS Storage Node. -type NodeAttribute netmap.Attribute - -// NodeInfo represents v2 compatible descriptor of the NeoFS node. -type NodeInfo netmap.NodeInfo - -const ( - _ NodeState = iota - - // NodeStateOffline is network unavailable state. - NodeStateOffline - - // NodeStateOnline is an active state in the network. - NodeStateOnline -) - -// Enumeration of well-known attributes. -const ( - // AttrPrice is a key to the node attribute that indicates the - // price in GAS tokens for storing one GB of data during one Epoch. - AttrPrice = "Price" - - // AttrCapacity is a key to the node attribute that indicates the - // total available disk space in Gigabytes. - AttrCapacity = "Capacity" - - // AttrSubnet is a key to the node attribute that indicates the - // string ID of node's storage subnet. - AttrSubnet = "Subnet" - - // AttrUNLOCODE is a key to the node attribute that indicates the - // node's geographic location in UN/LOCODE format. - AttrUNLOCODE = "UN-LOCODE" - - // AttrCountryCode is a key to the node attribute that indicates the - // Country code in ISO 3166-1_alpha-2 format. - AttrCountryCode = "CountryCode" - - // AttrCountry is a key to the node attribute that indicates the - // country short name in English, as defined in ISO-3166. - AttrCountry = "Country" - - // AttrLocation is a key to the node attribute that indicates the - // place name of the node location. - AttrLocation = "Location" - - // AttrSubDivCode is a key to the node attribute that indicates the - // country's administrative subdivision where node is located - // in ISO 3166-2 format. - AttrSubDivCode = "SubDivCode" - - // AttrSubDiv is a key to the node attribute that indicates the - // country's administrative subdivision name, as defined in - // ISO 3166-2. - AttrSubDiv = "SubDiv" - - // AttrContinent is a key to the node attribute that indicates the - // node's continent name according to the Seven-Continent model. - AttrContinent = "Continent" -) - -var _ hrw.Hasher = (*Node)(nil) - -// Hash is a function from hrw.Hasher interface. It is implemented -// to support weighted hrw therefore sort function sorts nodes -// based on their `N` value. -func (n Node) Hash() uint64 { - return n.ID -} - -// NodesFromInfo converts slice of NodeInfo to a generic node slice. -func NodesFromInfo(infos []NodeInfo) Nodes { - nodes := make(Nodes, len(infos)) - for i := range infos { - nodes[i] = newNodeV2(i, &infos[i]) - } - - return nodes -} - -func newNodeV2(index int, ni *NodeInfo) *Node { - n := &Node{ - ID: hrw.Hash(ni.PublicKey()), - Index: index, - AttrMap: make(map[string]string, len(ni.Attributes())), - NodeInfo: ni, - } - - for _, attr := range ni.Attributes() { - switch attr.Key() { - case AttrCapacity: - n.Capacity, _ = strconv.ParseUint(attr.Value(), 10, 64) - case AttrPrice: - n.Price, _ = strconv.ParseUint(attr.Value(), 10, 64) - } - - n.AttrMap[attr.Key()] = attr.Value() - } - - return n -} - -// Weights returns slice of nodes weights W. -func (n Nodes) Weights(wf weightFunc) []float64 { - w := make([]float64, 0, len(n)) - for i := range n { - w = append(w, wf(n[i])) - } - - return w -} - -// Attribute returns value of attribute k. -func (n *Node) Attribute(k string) string { - return n.AttrMap[k] -} - -// GetBucketWeight computes weight for a Bucket. -func GetBucketWeight(ns Nodes, a aggregator, wf weightFunc) float64 { - for i := range ns { - a.Add(wf(ns[i])) - } - - return a.Compute() -} - -// NodeStateFromV2 converts v2 NodeState to NodeState. -func NodeStateFromV2(s netmap.NodeState) NodeState { - switch s { - default: - return 0 - case netmap.Online: - return NodeStateOnline - case netmap.Offline: - return NodeStateOffline - } -} - -// ToV2 converts NodeState to v2 NodeState. -func (s NodeState) ToV2() netmap.NodeState { - switch s { - default: - return netmap.UnspecifiedState - case NodeStateOffline: - return netmap.Offline - case NodeStateOnline: - return netmap.Online - } -} - -// String returns string representation of NodeState. -// -// String mapping: -// * NodeStateOnline: ONLINE; -// * NodeStateOffline: OFFLINE; -// * default: UNSPECIFIED. -func (s NodeState) String() string { - return s.ToV2().String() -} - -// FromString parses NodeState from a string representation. -// It is a reverse action to String(). -// -// Returns true if s was parsed successfully. -func (s *NodeState) FromString(str string) bool { - var g netmap.NodeState - - ok := g.FromString(str) - - if ok { - *s = NodeStateFromV2(g) - } - - return ok -} - -// NewNodeAttribute creates and returns new NodeAttribute instance. -// -// Defaults: -// - key: ""; -// - value: ""; -// - parents: nil. -func NewNodeAttribute() *NodeAttribute { - return NewNodeAttributeFromV2(new(netmap.Attribute)) -} - -// NodeAttributeFromV2 converts v2 node Attribute to NodeAttribute. -// -// Nil netmap.Attribute converts to nil. -func NewNodeAttributeFromV2(a *netmap.Attribute) *NodeAttribute { - return (*NodeAttribute)(a) -} - -// ToV2 converts NodeAttribute to v2 node Attribute. -// -// Nil NodeAttribute converts to nil. -func (a *NodeAttribute) ToV2() *netmap.Attribute { - return (*netmap.Attribute)(a) -} - -// Key returns key to the node attribute. -func (a *NodeAttribute) Key() string { - return (*netmap.Attribute)(a). - GetKey() -} - -// SetKey sets key to the node attribute. -func (a *NodeAttribute) SetKey(key string) { - (*netmap.Attribute)(a). - SetKey(key) -} - -// Value returns value of the node attribute. -func (a *NodeAttribute) Value() string { - return (*netmap.Attribute)(a). - GetValue() -} - -// SetValue sets value of the node attribute. -func (a *NodeAttribute) SetValue(val string) { - (*netmap.Attribute)(a). - SetValue(val) -} - -// ParentKeys returns list of parent keys. -func (a *NodeAttribute) ParentKeys() []string { - return (*netmap.Attribute)(a). - GetParents() -} - -// SetParentKeys sets list of parent keys. -func (a *NodeAttribute) SetParentKeys(keys ...string) { - (*netmap.Attribute)(a). - SetParents(keys) -} - -// Marshal marshals NodeAttribute into a protobuf binary form. -// -// Buffer is allocated when the argument is empty. -// Otherwise, the first buffer is used. -func (a *NodeAttribute) Marshal(b ...[]byte) ([]byte, error) { - var buf []byte - if len(b) > 0 { - buf = b[0] - } - - return (*netmap.Attribute)(a). - StableMarshal(buf) -} - -// Unmarshal unmarshals protobuf binary representation of NodeAttribute. -func (a *NodeAttribute) Unmarshal(data []byte) error { - return (*netmap.Attribute)(a). - Unmarshal(data) -} - -// MarshalJSON encodes NodeAttribute to protobuf JSON format. -func (a *NodeAttribute) MarshalJSON() ([]byte, error) { - return (*netmap.Attribute)(a). - MarshalJSON() -} - -// UnmarshalJSON decodes NodeAttribute from protobuf JSON format. -func (a *NodeAttribute) UnmarshalJSON(data []byte) error { - return (*netmap.Attribute)(a). - UnmarshalJSON(data) -} - -// NewNodeInfo creates and returns new NodeInfo instance. -// -// Defaults: -// - publicKey: nil; -// - address: ""; -// - attributes nil; -// - state: 0. -func NewNodeInfo() *NodeInfo { - return NewNodeInfoFromV2(new(netmap.NodeInfo)) -} - -// NewNodeInfoFromV2 converts v2 NodeInfo to NodeInfo. -// -// Nil netmap.NodeInfo converts to nil. -func NewNodeInfoFromV2(i *netmap.NodeInfo) *NodeInfo { - return (*NodeInfo)(i) -} - -// ToV2 converts NodeInfo to v2 NodeInfo. -// -// Nil NodeInfo converts to nil. -func (i *NodeInfo) ToV2() *netmap.NodeInfo { - return (*netmap.NodeInfo)(i) -} - -// PublicKey returns public key of the node in a binary format. -func (i *NodeInfo) PublicKey() []byte { - return (*netmap.NodeInfo)(i). - GetPublicKey() -} - -// SetPublicKey sets public key of the node in a binary format. -func (i *NodeInfo) SetPublicKey(key []byte) { - (*netmap.NodeInfo)(i). - SetPublicKey(key) -} - -// Address returns network endpoint address of the node. -// -// Deprecated: use IterateAddresses method. -func (i *NodeInfo) Address() (addr string) { - i.IterateAddresses(func(s string) bool { - addr = s - return true - }) - - return -} - -// SetAddress sets network endpoint address of the node. -// -// Deprecated: use SetAddresses method. -func (i *NodeInfo) SetAddress(addr string) { - i.SetAddresses(addr) -} - -// NumberOfAddresses returns number of network addresses of the node. -func (i *NodeInfo) NumberOfAddresses() int { - return (*netmap.NodeInfo)(i). - NumberOfAddresses() -} - -// IterateAddresses iterates over network addresses of the node. -// Breaks iteration on f's true return. -// -// Handler should not be nil. -func (i *NodeInfo) IterateAddresses(f func(string) bool) { - (*netmap.NodeInfo)(i). - IterateAddresses(f) -} - -// IterateAllAddresses is a helper function to unconditionally -// iterate over all node addresses. -func IterateAllAddresses(i *NodeInfo, f func(string)) { - i.IterateAddresses(func(addr string) bool { - f(addr) - return false - }) -} - -// SetAddresses sets list of network addresses of the node. -func (i *NodeInfo) SetAddresses(v ...string) { - (*netmap.NodeInfo)(i). - SetAddresses(v...) -} - -// Attributes returns list of the node attributes. -func (i *NodeInfo) Attributes() []*NodeAttribute { - if i == nil { - return nil - } - - as := (*netmap.NodeInfo)(i). - GetAttributes() - - if as == nil { - return nil - } - - res := make([]*NodeAttribute, 0, len(as)) - - for i := range as { - res = append(res, NewNodeAttributeFromV2(as[i])) - } - - return res -} - -// SetAttributes sets list of the node attributes. -func (i *NodeInfo) SetAttributes(as ...*NodeAttribute) { - asV2 := make([]*netmap.Attribute, 0, len(as)) - - for i := range as { - asV2 = append(asV2, as[i].ToV2()) - } - - (*netmap.NodeInfo)(i). - SetAttributes(asV2) -} - -// State returns node state. -func (i *NodeInfo) State() NodeState { - return NodeStateFromV2( - (*netmap.NodeInfo)(i). - GetState(), - ) -} - -// SetState sets node state. -func (i *NodeInfo) SetState(s NodeState) { - (*netmap.NodeInfo)(i). - SetState(s.ToV2()) -} - -// Marshal marshals NodeInfo into a protobuf binary form. -// -// Buffer is allocated when the argument is empty. -// Otherwise, the first buffer is used. -func (i *NodeInfo) Marshal(b ...[]byte) ([]byte, error) { - var buf []byte - if len(b) > 0 { - buf = b[0] - } - - return (*netmap.NodeInfo)(i). - StableMarshal(buf) -} - -// Unmarshal unmarshals protobuf binary representation of NodeInfo. -func (i *NodeInfo) Unmarshal(data []byte) error { - return (*netmap.NodeInfo)(i). - Unmarshal(data) -} - -// MarshalJSON encodes NodeInfo to protobuf JSON format. -func (i *NodeInfo) MarshalJSON() ([]byte, error) { - return (*netmap.NodeInfo)(i). - MarshalJSON() -} - -// UnmarshalJSON decodes NodeInfo from protobuf JSON format. -func (i *NodeInfo) UnmarshalJSON(data []byte) error { - return (*netmap.NodeInfo)(i). - UnmarshalJSON(data) -} diff --git a/pkg/netmap/node_info_test.go b/pkg/netmap/node_info_test.go deleted file mode 100644 index ebcd393..0000000 --- a/pkg/netmap/node_info_test.go +++ /dev/null @@ -1,263 +0,0 @@ -package netmap - -import ( - "testing" - - "github.com/nspcc-dev/neofs-api-go/v2/netmap" - testv2 "github.com/nspcc-dev/neofs-api-go/v2/netmap/test" - "github.com/stretchr/testify/require" -) - -func TestNodeStateFromV2(t *testing.T) { - for _, item := range []struct { - s NodeState - sV2 netmap.NodeState - }{ - { - s: 0, - sV2: netmap.UnspecifiedState, - }, - { - s: NodeStateOnline, - sV2: netmap.Online, - }, - { - s: NodeStateOffline, - sV2: netmap.Offline, - }, - } { - require.Equal(t, item.s, NodeStateFromV2(item.sV2)) - require.Equal(t, item.sV2, item.s.ToV2()) - } -} - -func TestNodeAttributeFromV2(t *testing.T) { - t.Run("from nil", func(t *testing.T) { - var x *netmap.Attribute - - require.Nil(t, NewNodeAttributeFromV2(x)) - }) - - t.Run("from non-nil", func(t *testing.T) { - aV2 := testv2.GenerateAttribute(false) - - a := NewNodeAttributeFromV2(aV2) - - require.Equal(t, aV2, a.ToV2()) - }) -} - -func TestNodeAttribute_ToV2(t *testing.T) { - t.Run("nil", func(t *testing.T) { - var x *NodeAttribute - - require.Nil(t, x.ToV2()) - }) -} - -func TestNodeAttribute_Key(t *testing.T) { - a := NewNodeAttribute() - key := "some key" - - a.SetKey(key) - - require.Equal(t, key, a.Key()) -} - -func TestNodeAttribute_Value(t *testing.T) { - a := NewNodeAttribute() - val := "some value" - - a.SetValue(val) - - require.Equal(t, val, a.Value()) -} - -func TestNodeAttribute_ParentKeys(t *testing.T) { - a := NewNodeAttribute() - keys := []string{"par1", "par2"} - - a.SetParentKeys(keys...) - - require.Equal(t, keys, a.ParentKeys()) -} - -func testNodeAttribute() *NodeAttribute { - a := new(NodeAttribute) - a.SetKey("key") - a.SetValue("value") - a.SetParentKeys("par1", "par2") - - return a -} - -func TestNodeInfoFromV2(t *testing.T) { - t.Run("from nil", func(t *testing.T) { - var x *netmap.NodeInfo - - require.Nil(t, NewNodeInfoFromV2(x)) - }) - - t.Run("from non-nil", func(t *testing.T) { - iV2 := testv2.GenerateNodeInfo(false) - - i := NewNodeInfoFromV2(iV2) - - require.Equal(t, iV2, i.ToV2()) - }) -} - -func TestNodeInfo_ToV2(t *testing.T) { - t.Run("nil", func(t *testing.T) { - var x *NodeInfo - - require.Nil(t, x.ToV2()) - }) -} - -func TestNodeInfo_PublicKey(t *testing.T) { - i := new(NodeInfo) - key := []byte{1, 2, 3} - - i.SetPublicKey(key) - - require.Equal(t, key, i.PublicKey()) -} - -func TestNodeInfo_IterateAddresses(t *testing.T) { - i := new(NodeInfo) - - as := []string{"127.0.0.1:8080", "127.0.0.1:8081"} - - i.SetAddresses(as...) - - as2 := make([]string, 0, i.NumberOfAddresses()) - - IterateAllAddresses(i, func(addr string) { - as2 = append(as2, addr) - }) - - require.Equal(t, as, as2) - require.EqualValues(t, len(as), i.NumberOfAddresses()) -} - -func TestNodeInfo_State(t *testing.T) { - i := new(NodeInfo) - s := NodeStateOnline - - i.SetState(s) - - require.Equal(t, s, i.State()) -} - -func TestNodeInfo_Attributes(t *testing.T) { - i := new(NodeInfo) - as := []*NodeAttribute{testNodeAttribute(), testNodeAttribute()} - - i.SetAttributes(as...) - - require.Equal(t, as, i.Attributes()) -} - -func TestNodeAttributeEncoding(t *testing.T) { - a := testNodeAttribute() - - t.Run("binary", func(t *testing.T) { - data, err := a.Marshal() - require.NoError(t, err) - - a2 := NewNodeAttribute() - require.NoError(t, a2.Unmarshal(data)) - - require.Equal(t, a, a2) - }) - - t.Run("json", func(t *testing.T) { - data, err := a.MarshalJSON() - require.NoError(t, err) - - a2 := NewNodeAttribute() - require.NoError(t, a2.UnmarshalJSON(data)) - - require.Equal(t, a, a2) - }) -} - -func TestNodeInfoEncoding(t *testing.T) { - i := NewNodeInfo() - i.SetPublicKey([]byte{1, 2, 3}) - i.SetAddresses("192.168.0.1", "192.168.0.2") - i.SetState(NodeStateOnline) - i.SetAttributes(testNodeAttribute()) - - t.Run("binary", func(t *testing.T) { - data, err := i.Marshal() - require.NoError(t, err) - - i2 := NewNodeInfo() - require.NoError(t, i2.Unmarshal(data)) - - require.Equal(t, i, i2) - }) - - t.Run("json", func(t *testing.T) { - data, err := i.MarshalJSON() - require.NoError(t, err) - - i2 := NewNodeInfo() - require.NoError(t, i2.UnmarshalJSON(data)) - - require.Equal(t, i, i2) - }) -} - -func TestNewNodeAttribute(t *testing.T) { - t.Run("default values", func(t *testing.T) { - attr := NewNodeAttribute() - - // check initial values - require.Empty(t, attr.Key()) - require.Empty(t, attr.Value()) - require.Nil(t, attr.ParentKeys()) - - // convert to v2 message - attrV2 := attr.ToV2() - - require.Empty(t, attrV2.GetKey()) - require.Empty(t, attrV2.GetValue()) - require.Nil(t, attrV2.GetParents()) - }) -} - -func TestNewNodeInfo(t *testing.T) { - t.Run("default values", func(t *testing.T) { - ni := NewNodeInfo() - - // check initial values - require.Nil(t, ni.PublicKey()) - - require.Zero(t, ni.NumberOfAddresses()) - require.Nil(t, ni.Attributes()) - require.Zero(t, ni.State()) - - // convert to v2 message - niV2 := ni.ToV2() - - require.Nil(t, niV2.GetPublicKey()) - require.Zero(t, niV2.NumberOfAddresses()) - require.Nil(t, niV2.GetAttributes()) - require.EqualValues(t, netmap.UnspecifiedState, niV2.GetState()) - }) -} - -func TestNodeState_String(t *testing.T) { - toPtr := func(v NodeState) *NodeState { - return &v - } - - testEnumStrings(t, new(NodeState), []enumStringItem{ - {val: toPtr(NodeStateOnline), str: "ONLINE"}, - {val: toPtr(NodeStateOffline), str: "OFFLINE"}, - {val: toPtr(0), str: "UNSPECIFIED"}, - }) -} diff --git a/pkg/netmap/operation.go b/pkg/netmap/operation.go deleted file mode 100644 index af3e042..0000000 --- a/pkg/netmap/operation.go +++ /dev/null @@ -1,116 +0,0 @@ -package netmap - -import ( - "github.com/nspcc-dev/neofs-api-go/v2/netmap" -) - -// Operation is an enumeration of v2-compatible filtering operations. -type Operation uint32 - -const ( - _ Operation = iota - - // OpEQ is an "Equal" operation. - OpEQ - - // OpNE is a "Not equal" operation. - OpNE - - // OpGT is a "Greater than" operation. - OpGT - - // OpGE is a "Greater than or equal to" operation. - OpGE - - // OpLT is a "Less than" operation. - OpLT - - // OpLE is a "Less than or equal to" operation. - OpLE - - // OpOR is an "OR" operation. - OpOR - - // OpAND is an "AND" operation. - OpAND -) - -// OperationFromV2 converts v2 Operation to Operation. -func OperationFromV2(op netmap.Operation) Operation { - switch op { - default: - return 0 - case netmap.OR: - return OpOR - case netmap.AND: - return OpAND - case netmap.GE: - return OpGE - case netmap.GT: - return OpGT - case netmap.LE: - return OpLE - case netmap.LT: - return OpLT - case netmap.EQ: - return OpEQ - case netmap.NE: - return OpNE - } -} - -// ToV2 converts Operation to v2 Operation. -func (op Operation) ToV2() netmap.Operation { - switch op { - default: - return netmap.UnspecifiedOperation - case OpOR: - return netmap.OR - case OpAND: - return netmap.AND - case OpGE: - return netmap.GE - case OpGT: - return netmap.GT - case OpLE: - return netmap.LE - case OpLT: - return netmap.LT - case OpEQ: - return netmap.EQ - case OpNE: - return netmap.NE - } -} - -// String returns string representation of Operation. -// -// String mapping: -// * OpNE: NE; -// * OpEQ: EQ; -// * OpLT: LT; -// * OpLE: LE; -// * OpGT: GT; -// * OpGE: GE; -// * OpAND: AND; -// * OpOR: OR; -// * default: OPERATION_UNSPECIFIED. -func (op Operation) String() string { - return op.ToV2().String() -} - -// FromString parses Operation from a string representation. -// It is a reverse action to String(). -// -// Returns true if s was parsed successfully. -func (op *Operation) FromString(s string) bool { - var g netmap.Operation - - ok := g.FromString(s) - - if ok { - *op = OperationFromV2(g) - } - - return ok -} diff --git a/pkg/netmap/operation_test.go b/pkg/netmap/operation_test.go deleted file mode 100644 index e8b74e3..0000000 --- a/pkg/netmap/operation_test.go +++ /dev/null @@ -1,73 +0,0 @@ -package netmap - -import ( - "testing" - - "github.com/nspcc-dev/neofs-api-go/v2/netmap" - "github.com/stretchr/testify/require" -) - -func TestOperationFromV2(t *testing.T) { - for _, item := range []struct { - op Operation - opV2 netmap.Operation - }{ - { - op: 0, - opV2: netmap.UnspecifiedOperation, - }, - { - op: OpEQ, - opV2: netmap.EQ, - }, - { - op: OpNE, - opV2: netmap.NE, - }, - { - op: OpOR, - opV2: netmap.OR, - }, - { - op: OpAND, - opV2: netmap.AND, - }, - { - op: OpLE, - opV2: netmap.LE, - }, - { - op: OpLT, - opV2: netmap.LT, - }, - { - op: OpGT, - opV2: netmap.GT, - }, - { - op: OpGE, - opV2: netmap.GE, - }, - } { - require.Equal(t, item.op, OperationFromV2(item.opV2)) - require.Equal(t, item.opV2, item.op.ToV2()) - } -} - -func TestOperation_String(t *testing.T) { - toPtr := func(v Operation) *Operation { - return &v - } - - testEnumStrings(t, new(Operation), []enumStringItem{ - {val: toPtr(OpEQ), str: "EQ"}, - {val: toPtr(OpNE), str: "NE"}, - {val: toPtr(OpGT), str: "GT"}, - {val: toPtr(OpGE), str: "GE"}, - {val: toPtr(OpLT), str: "LT"}, - {val: toPtr(OpLE), str: "LE"}, - {val: toPtr(OpAND), str: "AND"}, - {val: toPtr(OpOR), str: "OR"}, - {val: toPtr(0), str: "OPERATION_UNSPECIFIED"}, - }) -} diff --git a/pkg/netmap/policy.go b/pkg/netmap/policy.go deleted file mode 100644 index dc2e54e..0000000 --- a/pkg/netmap/policy.go +++ /dev/null @@ -1,159 +0,0 @@ -package netmap - -import ( - "github.com/nspcc-dev/neofs-api-go/v2/netmap" -) - -// PlacementPolicy represents v2-compatible placement policy. -type PlacementPolicy netmap.PlacementPolicy - -// NewPlacementPolicy creates and returns new PlacementPolicy instance. -// -// Defaults: -// - backupFactor: 0; -// - replicas nil; -// - selectors nil; -// - filters nil. -func NewPlacementPolicy() *PlacementPolicy { - return NewPlacementPolicyFromV2(new(netmap.PlacementPolicy)) -} - -// NewPlacementPolicyFromV2 converts v2 PlacementPolicy to PlacementPolicy. -// -// Nil netmap.PlacementPolicy converts to nil. -func NewPlacementPolicyFromV2(f *netmap.PlacementPolicy) *PlacementPolicy { - return (*PlacementPolicy)(f) -} - -// ToV2 converts PlacementPolicy to v2 PlacementPolicy. -// -// Nil PlacementPolicy converts to nil. -func (p *PlacementPolicy) ToV2() *netmap.PlacementPolicy { - return (*netmap.PlacementPolicy)(p) -} - -// Replicas returns list of object replica descriptors. -func (p *PlacementPolicy) Replicas() []*Replica { - rs := (*netmap.PlacementPolicy)(p). - GetReplicas() - - if rs == nil { - return nil - } - - res := make([]*Replica, 0, len(rs)) - - for i := range rs { - res = append(res, NewReplicaFromV2(rs[i])) - } - - return res -} - -// SetReplicas sets list of object replica descriptors. -func (p *PlacementPolicy) SetReplicas(rs ...*Replica) { - var rsV2 []*netmap.Replica - - if rs != nil { - rsV2 = make([]*netmap.Replica, 0, len(rs)) - - for i := range rs { - rsV2 = append(rsV2, rs[i].ToV2()) - } - } - - (*netmap.PlacementPolicy)(p). - SetReplicas(rsV2) -} - -// ContainerBackupFactor returns container backup factor. -func (p *PlacementPolicy) ContainerBackupFactor() uint32 { - return (*netmap.PlacementPolicy)(p). - GetContainerBackupFactor() -} - -// SetContainerBackupFactor sets container backup factor. -func (p *PlacementPolicy) SetContainerBackupFactor(f uint32) { - (*netmap.PlacementPolicy)(p). - SetContainerBackupFactor(f) -} - -// Selector returns set of selectors to form the container's nodes subset. -func (p *PlacementPolicy) Selectors() []*Selector { - rs := (*netmap.PlacementPolicy)(p). - GetSelectors() - - if rs == nil { - return nil - } - - res := make([]*Selector, 0, len(rs)) - - for i := range rs { - res = append(res, NewSelectorFromV2(rs[i])) - } - - return res -} - -// SetSelectors sets set of selectors to form the container's nodes subset. -func (p *PlacementPolicy) SetSelectors(ss ...*Selector) { - var ssV2 []*netmap.Selector - - if ss != nil { - ssV2 = make([]*netmap.Selector, 0, len(ss)) - - for i := range ss { - ssV2 = append(ssV2, ss[i].ToV2()) - } - } - - (*netmap.PlacementPolicy)(p). - SetSelectors(ssV2) -} - -// Filters returns list of named filters to reference in selectors. -func (p *PlacementPolicy) Filters() []*Filter { - return filtersFromV2( - (*netmap.PlacementPolicy)(p). - GetFilters(), - ) -} - -// SetFilters sets list of named filters to reference in selectors. -func (p *PlacementPolicy) SetFilters(fs ...*Filter) { - (*netmap.PlacementPolicy)(p). - SetFilters(filtersToV2(fs)) -} - -// Marshal marshals PlacementPolicy into a protobuf binary form. -// -// Buffer is allocated when the argument is empty. -// Otherwise, the first buffer is used. -func (p *PlacementPolicy) Marshal(b ...[]byte) ([]byte, error) { - var buf []byte - if len(b) > 0 { - buf = b[0] - } - - return (*netmap.PlacementPolicy)(p). - StableMarshal(buf) -} - -// Unmarshal unmarshals protobuf binary representation of PlacementPolicy. -func (p *PlacementPolicy) Unmarshal(data []byte) error { - return (*netmap.PlacementPolicy)(p). - Unmarshal(data) -} - -// MarshalJSON encodes PlacementPolicy to protobuf JSON format. -func (p *PlacementPolicy) MarshalJSON() ([]byte, error) { - return (*netmap.PlacementPolicy)(p). - MarshalJSON() -} - -// UnmarshalJSON decodes PlacementPolicy from protobuf JSON format. -func (p *PlacementPolicy) UnmarshalJSON(data []byte) error { - return (*netmap.PlacementPolicy)(p). - UnmarshalJSON(data) -} diff --git a/pkg/netmap/policy_test.go b/pkg/netmap/policy_test.go deleted file mode 100644 index 43b45ed..0000000 --- a/pkg/netmap/policy_test.go +++ /dev/null @@ -1,180 +0,0 @@ -package netmap - -import ( - "testing" - - "github.com/nspcc-dev/neofs-api-go/v2/netmap" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" -) - -func TestPlacementPolicy_CBFWithEmptySelector(t *testing.T) { - nodes := []NodeInfo{ - nodeInfoFromAttributes("ID", "1", "Attr", "Same"), - nodeInfoFromAttributes("ID", "2", "Attr", "Same"), - nodeInfoFromAttributes("ID", "3", "Attr", "Same"), - nodeInfoFromAttributes("ID", "4", "Attr", "Same"), - } - - p1 := newPlacementPolicy(0, - []*Replica{newReplica(2, "")}, - nil, // selectors - nil, // filters - ) - - p2 := newPlacementPolicy(3, - []*Replica{newReplica(2, "")}, - nil, // selectors - nil, // filters - ) - - p3 := newPlacementPolicy(3, - []*Replica{newReplica(2, "X")}, - []*Selector{newSelector("X", "", ClauseDistinct, 2, "*")}, - nil, // filters - ) - - p4 := newPlacementPolicy(3, - []*Replica{newReplica(2, "X")}, - []*Selector{newSelector("X", "Attr", ClauseSame, 2, "*")}, - nil, // filters - ) - - nm, err := NewNetmap(NodesFromInfo(nodes)) - require.NoError(t, err) - - v, err := nm.GetContainerNodes(p1, nil) - require.NoError(t, err) - assert.Len(t, v.Flatten(), 4) - - v, err = nm.GetContainerNodes(p2, nil) - require.NoError(t, err) - assert.Len(t, v.Flatten(), 4) - - v, err = nm.GetContainerNodes(p3, nil) - require.NoError(t, err) - assert.Len(t, v.Flatten(), 4) - - v, err = nm.GetContainerNodes(p4, nil) - require.NoError(t, err) - assert.Len(t, v.Flatten(), 4) -} - -func TestPlacementPolicyFromV2(t *testing.T) { - pV2 := new(netmap.PlacementPolicy) - - pV2.SetReplicas([]*netmap.Replica{ - testReplica().ToV2(), - testReplica().ToV2(), - }) - - pV2.SetContainerBackupFactor(3) - - pV2.SetSelectors([]*netmap.Selector{ - testSelector().ToV2(), - testSelector().ToV2(), - }) - - pV2.SetFilters([]*netmap.Filter{ - testFilter().ToV2(), - testFilter().ToV2(), - }) - - p := NewPlacementPolicyFromV2(pV2) - - require.Equal(t, pV2, p.ToV2()) -} - -func TestPlacementPolicy_Replicas(t *testing.T) { - p := NewPlacementPolicy() - rs := []*Replica{testReplica(), testReplica()} - - p.SetReplicas(rs...) - - require.Equal(t, rs, p.Replicas()) -} - -func TestPlacementPolicy_ContainerBackupFactor(t *testing.T) { - p := NewPlacementPolicy() - f := uint32(3) - - p.SetContainerBackupFactor(f) - - require.Equal(t, f, p.ContainerBackupFactor()) -} - -func TestPlacementPolicy_Selectors(t *testing.T) { - p := NewPlacementPolicy() - ss := []*Selector{testSelector(), testSelector()} - - p.SetSelectors(ss...) - - require.Equal(t, ss, p.Selectors()) -} - -func TestPlacementPolicy_Filters(t *testing.T) { - p := NewPlacementPolicy() - fs := []*Filter{testFilter(), testFilter()} - - p.SetFilters(fs...) - - require.Equal(t, fs, p.Filters()) -} - -func TestPlacementPolicyEncoding(t *testing.T) { - p := newPlacementPolicy(3, nil, nil, nil) - - t.Run("binary", func(t *testing.T) { - data, err := p.Marshal() - require.NoError(t, err) - - p2 := NewPlacementPolicy() - require.NoError(t, p2.Unmarshal(data)) - - require.Equal(t, p, p2) - }) - - t.Run("json", func(t *testing.T) { - data, err := p.MarshalJSON() - require.NoError(t, err) - - p2 := NewPlacementPolicy() - require.NoError(t, p2.UnmarshalJSON(data)) - - require.Equal(t, p, p2) - }) -} - -func TestNewPlacementPolicy(t *testing.T) { - t.Run("nil", func(t *testing.T) { - var x *PlacementPolicy - - require.Nil(t, x.ToV2()) - }) - - t.Run("default values", func(t *testing.T) { - pp := NewPlacementPolicy() - - // check initial values - require.Nil(t, pp.Replicas()) - require.Nil(t, pp.Filters()) - require.Nil(t, pp.Selectors()) - require.Zero(t, pp.ContainerBackupFactor()) - - // convert to v2 message - ppV2 := pp.ToV2() - - require.Nil(t, ppV2.GetReplicas()) - require.Nil(t, ppV2.GetFilters()) - require.Nil(t, ppV2.GetSelectors()) - require.Zero(t, ppV2.GetContainerBackupFactor()) - }) -} - -func TestNewPlacementPolicyFromV2(t *testing.T) { - t.Run("from nil", func(t *testing.T) { - var x *netmap.PlacementPolicy - - require.Nil(t, NewPlacementPolicyFromV2(x)) - }) -} diff --git a/pkg/netmap/replica.go b/pkg/netmap/replica.go deleted file mode 100644 index 9bceb7f..0000000 --- a/pkg/netmap/replica.go +++ /dev/null @@ -1,87 +0,0 @@ -package netmap - -import ( - "github.com/nspcc-dev/neofs-api-go/v2/netmap" -) - -// Replica represents v2-compatible object replica descriptor. -type Replica netmap.Replica - -// NewReplica creates and returns new Replica instance. -// -// Defaults: -// - count: 0; -// - selector: "". -func NewReplica() *Replica { - return NewReplicaFromV2(new(netmap.Replica)) -} - -// NewReplicaFromV2 converts v2 Replica to Replica. -// -// Nil netmap.Replica converts to nil. -func NewReplicaFromV2(f *netmap.Replica) *Replica { - return (*Replica)(f) -} - -// ToV2 converts Replica to v2 Replica. -// -// Nil Replica converts to nil. -func (r *Replica) ToV2() *netmap.Replica { - return (*netmap.Replica)(r) -} - -// Count returns number of object replicas. -func (r *Replica) Count() uint32 { - return (*netmap.Replica)(r). - GetCount() -} - -// SetCount sets number of object replicas. -func (r *Replica) SetCount(c uint32) { - (*netmap.Replica)(r). - SetCount(c) -} - -// Selector returns name of selector bucket to put replicas. -func (r *Replica) Selector() string { - return (*netmap.Replica)(r). - GetSelector() -} - -// SetSelector sets name of selector bucket to put replicas. -func (r *Replica) SetSelector(s string) { - (*netmap.Replica)(r). - SetSelector(s) -} - -// Marshal marshals Replica into a protobuf binary form. -// -// Buffer is allocated when the argument is empty. -// Otherwise, the first buffer is used. -func (r *Replica) Marshal(b ...[]byte) ([]byte, error) { - var buf []byte - if len(b) > 0 { - buf = b[0] - } - - return (*netmap.Replica)(r). - StableMarshal(buf) -} - -// Unmarshal unmarshals protobuf binary representation of Replica. -func (r *Replica) Unmarshal(data []byte) error { - return (*netmap.Replica)(r). - Unmarshal(data) -} - -// MarshalJSON encodes Replica to protobuf JSON format. -func (r *Replica) MarshalJSON() ([]byte, error) { - return (*netmap.Replica)(r). - MarshalJSON() -} - -// UnmarshalJSON decodes Replica from protobuf JSON format. -func (r *Replica) UnmarshalJSON(data []byte) error { - return (*netmap.Replica)(r). - UnmarshalJSON(data) -} diff --git a/pkg/netmap/replica_test.go b/pkg/netmap/replica_test.go deleted file mode 100644 index c1b0dba..0000000 --- a/pkg/netmap/replica_test.go +++ /dev/null @@ -1,99 +0,0 @@ -package netmap - -import ( - "testing" - - "github.com/nspcc-dev/neofs-api-go/v2/netmap" - testv2 "github.com/nspcc-dev/neofs-api-go/v2/netmap/test" - "github.com/stretchr/testify/require" -) - -func testReplica() *Replica { - r := new(Replica) - r.SetCount(3) - r.SetSelector("selector") - - return r -} - -func TestReplicaFromV2(t *testing.T) { - t.Run("from nil", func(t *testing.T) { - var x *netmap.Replica - - require.Nil(t, NewReplicaFromV2(x)) - }) - - t.Run("from non-nil", func(t *testing.T) { - rV2 := testv2.GenerateReplica(false) - - r := NewReplicaFromV2(rV2) - - require.Equal(t, rV2, r.ToV2()) - }) -} - -func TestReplica_Count(t *testing.T) { - r := NewReplica() - c := uint32(3) - - r.SetCount(c) - - require.Equal(t, c, r.Count()) -} - -func TestReplica_Selector(t *testing.T) { - r := NewReplica() - s := "some selector" - - r.SetSelector(s) - - require.Equal(t, s, r.Selector()) -} - -func TestReplicaEncoding(t *testing.T) { - r := newReplica(3, "selector") - - t.Run("binary", func(t *testing.T) { - data, err := r.Marshal() - require.NoError(t, err) - - r2 := NewReplica() - require.NoError(t, r2.Unmarshal(data)) - - require.Equal(t, r, r2) - }) - - t.Run("json", func(t *testing.T) { - data, err := r.MarshalJSON() - require.NoError(t, err) - - r2 := NewReplica() - require.NoError(t, r2.UnmarshalJSON(data)) - - require.Equal(t, r, r2) - }) -} - -func TestReplica_ToV2(t *testing.T) { - t.Run("nil", func(t *testing.T) { - var x *Replica - - require.Nil(t, x.ToV2()) - }) -} - -func TestNewReplica(t *testing.T) { - t.Run("default values", func(t *testing.T) { - r := NewReplica() - - // check initial values - require.Zero(t, r.Count()) - require.Empty(t, r.Selector()) - - // convert to v2 message - rV2 := r.ToV2() - - require.Zero(t, rV2.GetCount()) - require.Empty(t, rV2.GetSelector()) - }) -} diff --git a/pkg/netmap/selector.go b/pkg/netmap/selector.go deleted file mode 100644 index b4100d4..0000000 --- a/pkg/netmap/selector.go +++ /dev/null @@ -1,275 +0,0 @@ -package netmap - -import ( - "fmt" - "sort" - - "github.com/nspcc-dev/hrw" - "github.com/nspcc-dev/neofs-api-go/v2/netmap" -) - -// Selector represents v2-compatible netmap selector. -type Selector netmap.Selector - -// processSelectors processes selectors and returns error is any of them is invalid. -func (c *Context) processSelectors(p *PlacementPolicy) error { - for _, s := range p.Selectors() { - if s == nil { - return fmt.Errorf("%w: SELECT", ErrMissingField) - } else if s.Filter() != MainFilterName { - _, ok := c.Filters[s.Filter()] - if !ok { - return fmt.Errorf("%w: SELECT FROM '%s'", ErrFilterNotFound, s.Filter()) - } - } - - c.Selectors[s.Name()] = s - - result, err := c.getSelection(p, s) - if err != nil { - return err - } - - c.Selections[s.Name()] = result - } - - return nil -} - -// GetNodesCount returns amount of buckets and minimum number of nodes in every bucket -// for the given selector. -func GetNodesCount(_ *PlacementPolicy, s *Selector) (int, int) { - switch s.Clause() { - case ClauseSame: - return 1, int(s.Count()) - default: - return int(s.Count()), 1 - } -} - -// getSelection returns nodes grouped by s.attribute. -// Last argument specifies if more buckets can be used to fullfill CBF. -func (c *Context) getSelection(p *PlacementPolicy, s *Selector) ([]Nodes, error) { - bucketCount, nodesInBucket := GetNodesCount(p, s) - buckets := c.getSelectionBase(s) - - if len(buckets) < bucketCount { - return nil, fmt.Errorf("%w: '%s'", ErrNotEnoughNodes, s.Name()) - } - - if len(c.pivot) == 0 { - // Deterministic order in case of zero seed. - if s.Attribute() == "" { - sort.Slice(buckets, func(i, j int) bool { - return buckets[i].nodes[0].ID < buckets[j].nodes[0].ID - }) - } else { - sort.Slice(buckets, func(i, j int) bool { - return buckets[i].attr < buckets[j].attr - }) - } - } - - maxNodesInBucket := nodesInBucket * int(c.cbf) - nodes := make([]Nodes, 0, len(buckets)) - fallback := make([]Nodes, 0, len(buckets)) - - for i := range buckets { - ns := buckets[i].nodes - if len(ns) >= maxNodesInBucket { - nodes = append(nodes, ns[:maxNodesInBucket]) - } else if len(ns) >= nodesInBucket { - fallback = append(fallback, ns) - } - } - - if len(nodes) < bucketCount { - // Fallback to using minimum allowed backup factor (1). - nodes = append(nodes, fallback...) - if len(nodes) < bucketCount { - return nil, fmt.Errorf("%w: '%s'", ErrNotEnoughNodes, s.Name()) - } - } - - if len(c.pivot) != 0 { - weights := make([]float64, len(nodes)) - for i := range nodes { - weights[i] = GetBucketWeight(nodes[i], c.aggregator(), c.weightFunc) - } - - hrw.SortSliceByWeightIndex(nodes, weights, c.pivotHash) - } - - if s.Attribute() == "" { - nodes, fallback = nodes[:bucketCount], nodes[bucketCount:] - for i := range fallback { - index := i % bucketCount - if len(nodes[index]) >= maxNodesInBucket { - break - } - nodes[index] = append(nodes[index], fallback[i]...) - } - } - - return nodes[:bucketCount], nil -} - -type nodeAttrPair struct { - attr string - nodes Nodes -} - -// getSelectionBase returns nodes grouped by selector attribute. -// It it guaranteed that each pair will contain at least one node. -func (c *Context) getSelectionBase(s *Selector) []nodeAttrPair { - f := c.Filters[s.Filter()] - isMain := s.Filter() == MainFilterName - result := []nodeAttrPair{} - nodeMap := map[string]Nodes{} - attr := s.Attribute() - - for i := range c.Netmap.Nodes { - if isMain || c.match(f, c.Netmap.Nodes[i]) { - if attr == "" { - // Default attribute is transparent identifier which is different for every node. - result = append(result, nodeAttrPair{attr: "", nodes: Nodes{c.Netmap.Nodes[i]}}) - } else { - v := c.Netmap.Nodes[i].Attribute(attr) - nodeMap[v] = append(nodeMap[v], c.Netmap.Nodes[i]) - } - } - } - - if attr != "" { - for k, ns := range nodeMap { - result = append(result, nodeAttrPair{attr: k, nodes: ns}) - } - } - - if len(c.pivot) != 0 { - for i := range result { - hrw.SortSliceByWeightValue(result[i].nodes, result[i].nodes.Weights(c.weightFunc), c.pivotHash) - } - } - - return result -} - -// NewSelector creates and returns new Selector instance. -// -// Defaults: -// - name: ""; -// - attribute: ""; -// - filter: ""; -// - clause: ClauseUnspecified; -// - count: 0. -func NewSelector() *Selector { - return NewSelectorFromV2(new(netmap.Selector)) -} - -// NewSelectorFromV2 converts v2 Selector to Selector. -// -// Nil netmap.Selector converts to nil. -func NewSelectorFromV2(f *netmap.Selector) *Selector { - return (*Selector)(f) -} - -// ToV2 converts Selector to v2 Selector. -// -// Nil Selector converts to nil. -func (s *Selector) ToV2() *netmap.Selector { - return (*netmap.Selector)(s) -} - -// Name returns selector name. -func (s *Selector) Name() string { - return (*netmap.Selector)(s). - GetName() -} - -// SetName sets selector name. -func (s *Selector) SetName(name string) { - (*netmap.Selector)(s). - SetName(name) -} - -// Count returns count of nodes to select from bucket. -func (s *Selector) Count() uint32 { - return (*netmap.Selector)(s). - GetCount() -} - -// SetCount sets count of nodes to select from bucket. -func (s *Selector) SetCount(c uint32) { - (*netmap.Selector)(s). - SetCount(c) -} - -// Clause returns modifier showing how to form a bucket. -func (s *Selector) Clause() Clause { - return ClauseFromV2( - (*netmap.Selector)(s). - GetClause(), - ) -} - -// SetClause sets modifier showing how to form a bucket. -func (s *Selector) SetClause(c Clause) { - (*netmap.Selector)(s). - SetClause(c.ToV2()) -} - -// Attribute returns attribute bucket to select from. -func (s *Selector) Attribute() string { - return (*netmap.Selector)(s). - GetAttribute() -} - -// SetAttribute sets attribute bucket to select from. -func (s *Selector) SetAttribute(a string) { - (*netmap.Selector)(s). - SetAttribute(a) -} - -// Filter returns filter reference to select from. -func (s *Selector) Filter() string { - return (*netmap.Selector)(s). - GetFilter() -} - -// SetFilter sets filter reference to select from. -func (s *Selector) SetFilter(f string) { - (*netmap.Selector)(s). - SetFilter(f) -} - -// Marshal marshals Selector into a protobuf binary form. -// -// Buffer is allocated when the argument is empty. -// Otherwise, the first buffer is used. -func (s *Selector) Marshal(b ...[]byte) ([]byte, error) { - var buf []byte - if len(b) > 0 { - buf = b[0] - } - - return (*netmap.Selector)(s).StableMarshal(buf) -} - -// Unmarshal unmarshals protobuf binary representation of Selector. -func (s *Selector) Unmarshal(data []byte) error { - return (*netmap.Selector)(s). - Unmarshal(data) -} - -// MarshalJSON encodes Selector to protobuf JSON format. -func (s *Selector) MarshalJSON() ([]byte, error) { - return (*netmap.Selector)(s). - MarshalJSON() -} - -// UnmarshalJSON decodes Selector from protobuf JSON format. -func (s *Selector) UnmarshalJSON(data []byte) error { - return (*netmap.Selector)(s). - UnmarshalJSON(data) -} diff --git a/pkg/netmap/selector_test.go b/pkg/netmap/selector_test.go deleted file mode 100644 index 6854288..0000000 --- a/pkg/netmap/selector_test.go +++ /dev/null @@ -1,531 +0,0 @@ -package netmap - -import ( - "errors" - "fmt" - "testing" - - "github.com/nspcc-dev/neofs-api-go/v2/netmap" - testv2 "github.com/nspcc-dev/neofs-api-go/v2/netmap/test" - "github.com/stretchr/testify/require" -) - -func TestPlacementPolicy_UnspecifiedClause(t *testing.T) { - p := newPlacementPolicy(1, - []*Replica{newReplica(1, "X")}, - []*Selector{ - newSelector("X", "", ClauseDistinct, 4, "*"), - }, - nil, - ) - nodes := []NodeInfo{ - nodeInfoFromAttributes("ID", "1", "Country", "RU", "City", "St.Petersburg", "SSD", "0"), - nodeInfoFromAttributes("ID", "2", "Country", "RU", "City", "St.Petersburg", "SSD", "1"), - nodeInfoFromAttributes("ID", "3", "Country", "RU", "City", "Moscow", "SSD", "1"), - nodeInfoFromAttributes("ID", "4", "Country", "RU", "City", "Moscow", "SSD", "1"), - } - - nm, err := NewNetmap(NodesFromInfo(nodes)) - require.NoError(t, err) - v, err := nm.GetContainerNodes(p, nil) - require.NoError(t, err) - require.Equal(t, 4, len(v.Flatten())) -} - -func TestPlacementPolicy_Minimal(t *testing.T) { - nodes := []NodeInfo{ - nodeInfoFromAttributes("City", "Saint-Petersburg"), - nodeInfoFromAttributes("City", "Moscow"), - nodeInfoFromAttributes("City", "Berlin"), - nodeInfoFromAttributes("City", "Paris"), - } - nm, err := NewNetmap(NodesFromInfo(nodes)) - require.NoError(t, err) - - runTest := func(t *testing.T, rep uint32, expectError bool) { - p := newPlacementPolicy(0, - []*Replica{newReplica(rep, "")}, - nil, nil) - - v, err := nm.GetContainerNodes(p, nil) - - if expectError { - require.Error(t, err) - return - } - - require.NoError(t, err) - count := int(rep * defaultCBF) - if count > len(nm.Nodes) { - count = len(nm.Nodes) - } - require.EqualValues(t, count, len(v.Flatten())) - } - - t.Run("REP 1", func(t *testing.T) { - runTest(t, 1, false) - }) - t.Run("REP 3", func(t *testing.T) { - runTest(t, 3, false) - }) - t.Run("REP 5", func(t *testing.T) { - runTest(t, 5, true) - }) -} - -// Issue #215. -func TestPlacementPolicy_MultipleREP(t *testing.T) { - p := newPlacementPolicy(1, - []*Replica{ - newReplica(1, "LOC_SPB_PLACE"), - newReplica(1, "LOC_MSK_PLACE"), - }, - []*Selector{ - newSelector("LOC_SPB_PLACE", "", ClauseUnspecified, 1, "LOC_SPB"), - newSelector("LOC_MSK_PLACE", "", ClauseUnspecified, 1, "LOC_MSK"), - }, - []*Filter{ - newFilter("LOC_SPB", "City", "Saint-Petersburg", OpEQ), - newFilter("LOC_MSK", "City", "Moscow", OpEQ), - }, - ) - nodes := []NodeInfo{ - nodeInfoFromAttributes("City", "Saint-Petersburg"), - nodeInfoFromAttributes("City", "Moscow"), - nodeInfoFromAttributes("City", "Berlin"), - nodeInfoFromAttributes("City", "Paris"), - } - nm, err := NewNetmap(NodesFromInfo(nodes)) - require.NoError(t, err) - - v, err := nm.GetContainerNodes(p, nil) - require.NoError(t, err) - - rs := v.Replicas() - require.Equal(t, 2, len(rs)) - require.Equal(t, 1, len(rs[0])) - require.Equal(t, "Saint-Petersburg", rs[0][0].Attribute("City")) - require.Equal(t, 1, len(rs[1])) - require.Equal(t, "Moscow", rs[1][0].Attribute("City")) -} - -func TestPlacementPolicy_DefaultCBF(t *testing.T) { - p := newPlacementPolicy(0, - []*Replica{ - newReplica(1, "EU"), - }, - []*Selector{ - newSelector("EU", "Location", ClauseSame, 1, "*"), - }, - nil) - nodes := []NodeInfo{ - nodeInfoFromAttributes("Location", "Europe", "Country", "RU", "City", "St.Petersburg"), - nodeInfoFromAttributes("Location", "Europe", "Country", "RU", "City", "Moscow"), - nodeInfoFromAttributes("Location", "Europe", "Country", "DE", "City", "Berlin"), - nodeInfoFromAttributes("Location", "Europe", "Country", "FR", "City", "Paris"), - } - - nm, err := NewNetmap(NodesFromInfo(nodes)) - require.NoError(t, err) - v, err := nm.GetContainerNodes(p, nil) - require.NoError(t, err) - require.Equal(t, defaultCBF, len(v.Flatten())) -} - -func TestPlacementPolicy_GetPlacementVectors(t *testing.T) { - p := newPlacementPolicy(2, - []*Replica{ - newReplica(1, "SPB"), - newReplica(2, "Americas"), - }, - []*Selector{ - newSelector("SPB", "City", ClauseSame, 1, "SPBSSD"), - newSelector("Americas", "City", ClauseDistinct, 2, "Americas"), - }, - []*Filter{ - newFilter("SPBSSD", "", "", OpAND, - newFilter("", "Country", "RU", OpEQ), - newFilter("", "City", "St.Petersburg", OpEQ), - newFilter("", "SSD", "1", OpEQ)), - newFilter("Americas", "", "", OpOR, - newFilter("", "Continent", "NA", OpEQ), - newFilter("", "Continent", "SA", OpEQ)), - }) - nodes := []NodeInfo{ - nodeInfoFromAttributes("ID", "1", "Country", "RU", "City", "St.Petersburg", "SSD", "0"), - nodeInfoFromAttributes("ID", "2", "Country", "RU", "City", "St.Petersburg", "SSD", "1"), - nodeInfoFromAttributes("ID", "3", "Country", "RU", "City", "Moscow", "SSD", "1"), - nodeInfoFromAttributes("ID", "4", "Country", "RU", "City", "Moscow", "SSD", "1"), - nodeInfoFromAttributes("ID", "5", "Country", "RU", "City", "St.Petersburg", "SSD", "1"), - nodeInfoFromAttributes("ID", "6", "Continent", "NA", "City", "NewYork"), - nodeInfoFromAttributes("ID", "7", "Continent", "AF", "City", "Cairo"), - nodeInfoFromAttributes("ID", "8", "Continent", "AF", "City", "Cairo"), - nodeInfoFromAttributes("ID", "9", "Continent", "SA", "City", "Lima"), - nodeInfoFromAttributes("ID", "10", "Continent", "AF", "City", "Cairo"), - nodeInfoFromAttributes("ID", "11", "Continent", "NA", "City", "NewYork"), - nodeInfoFromAttributes("ID", "12", "Continent", "NA", "City", "LosAngeles"), - nodeInfoFromAttributes("ID", "13", "Continent", "SA", "City", "Lima"), - } - - nm, err := NewNetmap(NodesFromInfo(nodes)) - require.NoError(t, err) - v, err := nm.GetContainerNodes(p, nil) - require.NoError(t, err) - require.Equal(t, 2, len(v.Replicas())) - require.Equal(t, 6, len(v.Flatten())) - - require.Equal(t, 2, len(v.Replicas()[0])) - ids := map[string]struct{}{} - for _, ni := range v.Replicas()[0] { - require.Equal(t, "RU", ni.Attribute("Country")) - require.Equal(t, "St.Petersburg", ni.Attribute("City")) - require.Equal(t, "1", ni.Attribute("SSD")) - ids[ni.Attribute("ID")] = struct{}{} - } - require.Equal(t, len(v.Replicas()[0]), len(ids), "not all nodes we distinct") - - require.Equal(t, 4, len(v.Replicas()[1])) // 2 cities * 2 HRWB - ids = map[string]struct{}{} - for _, ni := range v.Replicas()[1] { - require.Contains(t, []string{"NA", "SA"}, ni.Attribute("Continent")) - ids[ni.Attribute("ID")] = struct{}{} - } - require.Equal(t, len(v.Replicas()[1]), len(ids), "not all nodes we distinct") -} - -func TestPlacementPolicy_LowerBound(t *testing.T) { - p := newPlacementPolicy( - 2, // backup factor - []*Replica{ - newReplica(1, "X"), - }, - []*Selector{ - newSelector("X", "Country", ClauseSame, 2, "*"), - }, - nil, // filters - ) - - nodes := []NodeInfo{ - nodeInfoFromAttributes("ID", "1", "Country", "DE"), - nodeInfoFromAttributes("ID", "2", "Country", "DE"), - nodeInfoFromAttributes("ID", "3", "Country", "DE"), - } - - nm, err := NewNetmap(NodesFromInfo(nodes)) - require.NoError(t, err) - - v, err := nm.GetContainerNodes(p, nil) - require.NoError(t, err) - - require.Equal(t, 3, len(v.Flatten())) -} - -func TestIssue213(t *testing.T) { - p := newPlacementPolicy(1, - []*Replica{ - newReplica(4, ""), - }, - []*Selector{ - newSelector("", "", ClauseDistinct, 4, "LOC_EU"), - }, - []*Filter{ - newFilter("LOC_EU", "Location", "Europe", OpEQ), - }) - nodes := []NodeInfo{ - nodeInfoFromAttributes("Location", "Europe", "Country", "Russia", "City", "Moscow"), - nodeInfoFromAttributes("Location", "Europe", "Country", "Russia", "City", "Saint-Petersburg"), - nodeInfoFromAttributes("Location", "Europe", "Country", "Sweden", "City", "Stockholm"), - nodeInfoFromAttributes("Location", "Europe", "Country", "Finalnd", "City", "Helsinki"), - } - - nm, err := NewNetmap(NodesFromInfo(nodes)) - require.NoError(t, err) - - v, err := nm.GetContainerNodes(p, nil) - require.NoError(t, err) - require.Equal(t, 4, len(v.Flatten())) -} - -func TestPlacementPolicy_ProcessSelectors(t *testing.T) { - p := newPlacementPolicy(2, nil, - []*Selector{ - newSelector("SameRU", "City", ClauseSame, 2, "FromRU"), - newSelector("DistinctRU", "City", ClauseDistinct, 2, "FromRU"), - newSelector("Good", "Country", ClauseDistinct, 2, "Good"), - newSelector("Main", "Country", ClauseDistinct, 3, "*"), - }, - []*Filter{ - newFilter("FromRU", "Country", "Russia", OpEQ), - newFilter("Good", "Rating", "4", OpGE), - }) - nodes := []NodeInfo{ - nodeInfoFromAttributes("Country", "Russia", "Rating", "1", "City", "SPB"), - nodeInfoFromAttributes("Country", "Germany", "Rating", "5", "City", "Berlin"), - nodeInfoFromAttributes("Country", "Russia", "Rating", "6", "City", "Moscow"), - nodeInfoFromAttributes("Country", "France", "Rating", "4", "City", "Paris"), - nodeInfoFromAttributes("Country", "France", "Rating", "1", "City", "Lyon"), - nodeInfoFromAttributes("Country", "Russia", "Rating", "5", "City", "SPB"), - nodeInfoFromAttributes("Country", "Russia", "Rating", "7", "City", "Moscow"), - nodeInfoFromAttributes("Country", "Germany", "Rating", "3", "City", "Darmstadt"), - nodeInfoFromAttributes("Country", "Germany", "Rating", "7", "City", "Frankfurt"), - nodeInfoFromAttributes("Country", "Russia", "Rating", "9", "City", "SPB"), - nodeInfoFromAttributes("Country", "Russia", "Rating", "9", "City", "SPB"), - } - - nm, err := NewNetmap(NodesFromInfo(nodes)) - require.NoError(t, err) - c := NewContext(nm) - c.setCBF(p.ContainerBackupFactor()) - require.NoError(t, c.processFilters(p)) - require.NoError(t, c.processSelectors(p)) - - for _, s := range p.Selectors() { - sel := c.Selections[s.Name()] - s := c.Selectors[s.Name()] - bucketCount, nodesInBucket := GetNodesCount(p, s) - nodesInBucket *= int(c.cbf) - targ := fmt.Sprintf("selector '%s'", s.Name()) - require.Equal(t, bucketCount, len(sel), targ) - for _, res := range sel { - require.Equal(t, nodesInBucket, len(res), targ) - for j := range res { - require.True(t, c.applyFilter(s.Filter(), res[j]), targ) - } - } - } - -} - -func TestPlacementPolicy_ProcessSelectorsHRW(t *testing.T) { - p := newPlacementPolicy(1, nil, - []*Selector{ - newSelector("Main", "Country", ClauseDistinct, 3, "*"), - }, nil) - - // bucket weight order: RU > DE > FR - nodes := []NodeInfo{ - nodeInfoFromAttributes("Country", "Germany", AttrPrice, "2", AttrCapacity, "10000"), - nodeInfoFromAttributes("Country", "Germany", AttrPrice, "4", AttrCapacity, "1"), - nodeInfoFromAttributes("Country", "France", AttrPrice, "3", AttrCapacity, "10"), - nodeInfoFromAttributes("Country", "Russia", AttrPrice, "2", AttrCapacity, "10000"), - nodeInfoFromAttributes("Country", "Russia", AttrPrice, "1", AttrCapacity, "10000"), - nodeInfoFromAttributes("Country", "Russia", AttrCapacity, "10000"), - nodeInfoFromAttributes("Country", "France", AttrPrice, "100", AttrCapacity, "1"), - nodeInfoFromAttributes("Country", "France", AttrPrice, "7", AttrCapacity, "10000"), - nodeInfoFromAttributes("Country", "Russia", AttrPrice, "2", AttrCapacity, "1"), - } - nm, err := NewNetmap(NodesFromInfo(nodes)) - require.NoError(t, err) - c := NewContext(nm) - c.setPivot([]byte("containerID")) - c.setCBF(p.ContainerBackupFactor()) - c.weightFunc = newWeightFunc(newMaxNorm(10000), newReverseMinNorm(1)) - c.aggregator = func() aggregator { - return new(maxAgg) - } - - require.NoError(t, c.processFilters(p)) - require.NoError(t, c.processSelectors(p)) - - cnt := c.Selections["Main"] - expected := []Nodes{ - {{Index: 4, Capacity: 10000, Price: 1}}, // best RU - {{Index: 0, Capacity: 10000, Price: 2}}, // best DE - {{Index: 7, Capacity: 10000, Price: 7}}, // best FR - } - require.Equal(t, len(expected), len(cnt)) - for i := range expected { - require.Equal(t, len(expected[i]), len(cnt[i])) - require.Equal(t, expected[i][0].Index, cnt[i][0].Index) - require.Equal(t, expected[i][0].Capacity, cnt[i][0].Capacity) - require.Equal(t, expected[i][0].Price, cnt[i][0].Price) - } - - res, err := nm.GetPlacementVectors(containerNodes(cnt), []byte("objectID")) - require.NoError(t, err) - require.Equal(t, res, cnt) -} - -func newMaxNorm(max float64) normalizer { - return &maxNorm{max: max} -} - -func TestPlacementPolicy_ProcessSelectorsInvalid(t *testing.T) { - testCases := []struct { - name string - p *PlacementPolicy - err error - }{ - { - "MissingSelector", - newPlacementPolicy(2, nil, - []*Selector{nil}, - []*Filter{}), - ErrMissingField, - }, - { - "InvalidFilterReference", - newPlacementPolicy(1, nil, - []*Selector{newSelector("MyStore", "Country", ClauseDistinct, 1, "FromNL")}, - []*Filter{newFilter("FromRU", "Country", "Russia", OpEQ)}), - ErrFilterNotFound, - }, - { - "NotEnoughNodes (backup factor)", - newPlacementPolicy(2, nil, - []*Selector{newSelector("MyStore", "Country", ClauseDistinct, 2, "FromRU")}, - []*Filter{newFilter("FromRU", "Country", "Russia", OpEQ)}), - ErrNotEnoughNodes, - }, - { - "NotEnoughNodes (buckets)", - newPlacementPolicy(1, nil, - []*Selector{newSelector("MyStore", "Country", ClauseDistinct, 2, "FromRU")}, - []*Filter{newFilter("FromRU", "Country", "Russia", OpEQ)}), - ErrNotEnoughNodes, - }, - } - nodes := []NodeInfo{ - nodeInfoFromAttributes("Country", "Russia"), - nodeInfoFromAttributes("Country", "Germany"), - nodeInfoFromAttributes(), - } - for _, tc := range testCases { - t.Run(tc.name, func(t *testing.T) { - nm, err := NewNetmap(NodesFromInfo(nodes)) - require.NoError(t, err) - c := NewContext(nm) - c.setCBF(tc.p.ContainerBackupFactor()) - require.NoError(t, c.processFilters(tc.p)) - - err = c.processSelectors(tc.p) - require.True(t, errors.Is(err, tc.err), "got: %v", err) - }) - } -} - -func testSelector() *Selector { - s := new(Selector) - s.SetName("name") - s.SetCount(3) - s.SetFilter("filter") - s.SetAttribute("attribute") - s.SetClause(ClauseDistinct) - - return s -} - -func TestSelector_Name(t *testing.T) { - s := NewSelector() - name := "some name" - - s.SetName(name) - - require.Equal(t, name, s.Name()) -} - -func TestSelector_Count(t *testing.T) { - s := NewSelector() - c := uint32(3) - - s.SetCount(c) - - require.Equal(t, c, s.Count()) -} - -func TestSelector_Clause(t *testing.T) { - s := NewSelector() - c := ClauseSame - - s.SetClause(c) - - require.Equal(t, c, s.Clause()) -} - -func TestSelector_Attribute(t *testing.T) { - s := NewSelector() - a := "some attribute" - - s.SetAttribute(a) - - require.Equal(t, a, s.Attribute()) -} - -func TestSelector_Filter(t *testing.T) { - s := NewSelector() - f := "some filter" - - s.SetFilter(f) - - require.Equal(t, f, s.Filter()) -} - -func TestSelectorEncoding(t *testing.T) { - s := newSelector("name", "atte", ClauseSame, 1, "filter") - - t.Run("binary", func(t *testing.T) { - data, err := s.Marshal() - require.NoError(t, err) - - s2 := NewSelector() - require.NoError(t, s2.Unmarshal(data)) - - require.Equal(t, s, s2) - }) - - t.Run("json", func(t *testing.T) { - data, err := s.MarshalJSON() - require.NoError(t, err) - - s2 := NewSelector() - require.NoError(t, s2.UnmarshalJSON(data)) - - require.Equal(t, s, s2) - }) -} - -func TestSelector_ToV2(t *testing.T) { - t.Run("nil", func(t *testing.T) { - var x *Selector - - require.Nil(t, x.ToV2()) - }) -} - -func TestNewSelectorFromV2(t *testing.T) { - t.Run("from nil", func(t *testing.T) { - var x *netmap.Selector - - require.Nil(t, NewSelectorFromV2(x)) - }) - - t.Run("from non-nil", func(t *testing.T) { - sV2 := testv2.GenerateSelector(false) - - s := NewSelectorFromV2(sV2) - - require.Equal(t, sV2, s.ToV2()) - }) -} - -func TestNewSelector(t *testing.T) { - t.Run("default values", func(t *testing.T) { - s := NewSelector() - - // check initial values - require.Zero(t, s.Count()) - require.Equal(t, ClauseUnspecified, s.Clause()) - require.Empty(t, s.Attribute()) - require.Empty(t, s.Name()) - require.Empty(t, s.Filter()) - - // convert to v2 message - sV2 := s.ToV2() - - require.Zero(t, sV2.GetCount()) - require.Equal(t, netmap.UnspecifiedClause, sV2.GetClause()) - require.Empty(t, sV2.GetAttribute()) - require.Empty(t, sV2.GetName()) - require.Empty(t, sV2.GetFilter()) - }) -} diff --git a/pkg/netmap/test/generate.go b/pkg/netmap/test/generate.go deleted file mode 100644 index d8d431d..0000000 --- a/pkg/netmap/test/generate.go +++ /dev/null @@ -1,147 +0,0 @@ -package netmaptest - -import ( - "github.com/nspcc-dev/neofs-api-go/pkg/netmap" -) - -func filter(withInner bool) *netmap.Filter { - x := netmap.NewFilter() - - x.SetName("name") - x.SetKey("key") - x.SetValue("value") - x.SetOperation(netmap.OpAND) - - if withInner { - x.SetInnerFilters(filter(false), filter(false)) - } - - return x -} - -// Filter returns random netmap.Filter. -func Filter() *netmap.Filter { - return filter(true) -} - -// Replica returns random netmap.Replica. -func Replica() *netmap.Replica { - x := netmap.NewReplica() - - x.SetCount(666) - x.SetSelector("selector") - - return x -} - -// Selector returns random netmap.Selector. -func Selector() *netmap.Selector { - x := netmap.NewSelector() - - x.SetCount(11) - x.SetName("name") - x.SetFilter("filter") - x.SetAttribute("attribute") - x.SetClause(netmap.ClauseDistinct) - - return x -} - -// PlacementPolicy returns random netmap.PlacementPolicy. -func PlacementPolicy() *netmap.PlacementPolicy { - x := netmap.NewPlacementPolicy() - - x.SetContainerBackupFactor(9) - x.SetFilters(Filter(), Filter()) - x.SetReplicas(Replica(), Replica()) - x.SetSelectors(Selector(), Selector()) - - return x -} - -// NetworkParameter returns random netmap.NetworkParameter. -func NetworkParameter() *netmap.NetworkParameter { - x := netmap.NewNetworkParameter() - - x.SetKey([]byte("key")) - x.SetValue([]byte("value")) - - return x -} - -// NetworkConfig returns random netmap.NetworkConfig. -func NetworkConfig() *netmap.NetworkConfig { - x := netmap.NewNetworkConfig() - - x.SetParameters( - NetworkParameter(), - NetworkParameter(), - ) - - return x -} - -// NetworkInfo returns random netmap.NetworkInfo. -func NetworkInfo() *netmap.NetworkInfo { - x := netmap.NewNetworkInfo() - - x.SetCurrentEpoch(21) - x.SetMagicNumber(32) - x.SetMsPerBlock(43) - x.SetNetworkConfig(NetworkConfig()) - - return x -} - -// NodeAttribute returns random netmap.NodeAttribute. -func NodeAttribute() *netmap.NodeAttribute { - x := netmap.NewNodeAttribute() - - x.SetKey("key") - x.SetValue("value") - x.SetParentKeys("parent1", "parent2") - - return x -} - -// NodeInfo returns random netmap.NodeInfo. -func NodeInfo() *netmap.NodeInfo { - x := netmap.NewNodeInfo() - - x.SetAddresses("address 1", "address 2") - x.SetPublicKey([]byte("public key")) - x.SetState(netmap.NodeStateOnline) - x.SetAttributes(NodeAttribute(), NodeAttribute()) - - return x -} - -// Node returns random netmap.Node. -func Node() *netmap.Node { - return &netmap.Node{ - ID: 1, - Index: 2, - Capacity: 3, - Price: 4, - AttrMap: map[string]string{ - "key1": "value1", - "key2": "value2", - }, - NodeInfo: NodeInfo(), - } -} - -// Nodes returns random netmap.Nodes. -func Nodes() netmap.Nodes { - return netmap.Nodes{Node(), Node()} -} - -// Netmap returns random netmap.Netmap. -func Netmap() *netmap.Netmap { - nm, err := netmap.NewNetmap(Nodes()) - if err != nil { - panic(err) - } - - return nm -} diff --git a/pkg/object/address.go b/pkg/object/address.go deleted file mode 100644 index f1072a9..0000000 --- a/pkg/object/address.go +++ /dev/null @@ -1,131 +0,0 @@ -package object - -import ( - "errors" - "strings" - - cid "github.com/nspcc-dev/neofs-api-go/pkg/container/id" - "github.com/nspcc-dev/neofs-api-go/v2/refs" -) - -// Address represents v2-compatible object address. -type Address refs.Address - -var errInvalidAddressString = errors.New("incorrect format of the string object address") - -const ( - addressParts = 2 - addressSeparator = "/" -) - -// NewAddressFromV2 converts v2 Address message to Address. -// -// Nil refs.Address converts to nil. -func NewAddressFromV2(aV2 *refs.Address) *Address { - return (*Address)(aV2) -} - -// NewAddress creates and initializes blank Address. -// -// Works similar as NewAddressFromV2(new(Address)). -// -// Defaults: -// - cid: nil; -// - oid: nil. -func NewAddress() *Address { - return NewAddressFromV2(new(refs.Address)) -} - -// ToV2 converts Address to v2 Address message. -// -// Nil Address converts to nil. -func (a *Address) ToV2() *refs.Address { - return (*refs.Address)(a) -} - -// ContainerID returns container identifier. -func (a *Address) ContainerID() *cid.ID { - return cid.NewFromV2( - (*refs.Address)(a).GetContainerID(), - ) -} - -// SetContainerID sets container identifier. -func (a *Address) SetContainerID(id *cid.ID) { - (*refs.Address)(a).SetContainerID(id.ToV2()) -} - -// ObjectID returns object identifier. -func (a *Address) ObjectID() *ID { - return NewIDFromV2( - (*refs.Address)(a).GetObjectID(), - ) -} - -// SetObjectID sets object identifier. -func (a *Address) SetObjectID(id *ID) { - (*refs.Address)(a).SetObjectID(id.ToV2()) -} - -// Parse converts base58 string representation into Address. -func (a *Address) Parse(s string) error { - var ( - err error - oid = NewID() - id = cid.New() - parts = strings.Split(s, addressSeparator) - ) - - if len(parts) != addressParts { - return errInvalidAddressString - } else if err = id.Parse(parts[0]); err != nil { - return err - } else if err = oid.Parse(parts[1]); err != nil { - return err - } - - a.SetObjectID(oid) - a.SetContainerID(id) - - return nil -} - -// String returns string representation of Object.Address. -func (a *Address) String() string { - return strings.Join([]string{ - a.ContainerID().String(), - a.ObjectID().String(), - }, addressSeparator) -} - -// Marshal marshals Address into a protobuf binary form. -// -// Buffer is allocated when the argument is empty. -// Otherwise, the first buffer is used. -func (a *Address) Marshal(b ...[]byte) ([]byte, error) { - var buf []byte - if len(b) > 0 { - buf = b[0] - } - - return (*refs.Address)(a). - StableMarshal(buf) -} - -// Unmarshal unmarshals protobuf binary representation of Address. -func (a *Address) Unmarshal(data []byte) error { - return (*refs.Address)(a). - Unmarshal(data) -} - -// MarshalJSON encodes Address to protobuf JSON format. -func (a *Address) MarshalJSON() ([]byte, error) { - return (*refs.Address)(a). - MarshalJSON() -} - -// UnmarshalJSON decodes Address from protobuf JSON format. -func (a *Address) UnmarshalJSON(data []byte) error { - return (*refs.Address)(a). - UnmarshalJSON(data) -} diff --git a/pkg/object/address_test.go b/pkg/object/address_test.go deleted file mode 100644 index 6d97cb7..0000000 --- a/pkg/object/address_test.go +++ /dev/null @@ -1,119 +0,0 @@ -package object - -import ( - "strings" - "testing" - - cidtest "github.com/nspcc-dev/neofs-api-go/pkg/container/id/test" - "github.com/nspcc-dev/neofs-api-go/v2/refs" - "github.com/stretchr/testify/require" -) - -func TestAddress_SetContainerID(t *testing.T) { - a := NewAddress() - - id := cidtest.Generate() - - a.SetContainerID(id) - - require.Equal(t, id, a.ContainerID()) -} - -func TestAddress_SetObjectID(t *testing.T) { - a := NewAddress() - - oid := randID(t) - - a.SetObjectID(oid) - - require.Equal(t, oid, a.ObjectID()) -} - -func TestAddress_Parse(t *testing.T) { - cid := cidtest.Generate() - - oid := NewID() - oid.SetSHA256(randSHA256Checksum(t)) - - t.Run("should parse successful", func(t *testing.T) { - s := strings.Join([]string{cid.String(), oid.String()}, addressSeparator) - a := NewAddress() - - require.NoError(t, a.Parse(s)) - require.Equal(t, oid, a.ObjectID()) - require.Equal(t, cid, a.ContainerID()) - }) - - t.Run("should fail for bad address", func(t *testing.T) { - s := strings.Join([]string{cid.String()}, addressSeparator) - require.EqualError(t, NewAddress().Parse(s), errInvalidAddressString.Error()) - }) - - t.Run("should fail on container.ID", func(t *testing.T) { - s := strings.Join([]string{"1", "2"}, addressSeparator) - require.Error(t, NewAddress().Parse(s)) - }) - - t.Run("should fail on object.ID", func(t *testing.T) { - s := strings.Join([]string{cid.String(), "2"}, addressSeparator) - require.Error(t, NewAddress().Parse(s)) - }) -} - -func TestAddressEncoding(t *testing.T) { - a := NewAddress() - a.SetObjectID(randID(t)) - a.SetContainerID(cidtest.Generate()) - - t.Run("binary", func(t *testing.T) { - data, err := a.Marshal() - require.NoError(t, err) - - a2 := NewAddress() - require.NoError(t, a2.Unmarshal(data)) - - require.Equal(t, a, a2) - }) - - t.Run("json", func(t *testing.T) { - data, err := a.MarshalJSON() - require.NoError(t, err) - - a2 := NewAddress() - require.NoError(t, a2.UnmarshalJSON(data)) - - require.Equal(t, a, a2) - }) -} - -func TestNewAddressFromV2(t *testing.T) { - t.Run("from nil", func(t *testing.T) { - var x *refs.Address - - require.Nil(t, NewAddressFromV2(x)) - }) -} - -func TestAddress_ToV2(t *testing.T) { - t.Run("nil", func(t *testing.T) { - var x *Address - - require.Nil(t, x.ToV2()) - }) -} - -func TestNewAddress(t *testing.T) { - t.Run("default values", func(t *testing.T) { - a := NewAddress() - - // check initial values - require.Nil(t, a.ContainerID()) - require.Nil(t, a.ObjectID()) - - // convert to v2 message - aV2 := a.ToV2() - - require.Nil(t, aV2.GetContainerID()) - require.Nil(t, aV2.GetObjectID()) - }) -} diff --git a/pkg/object/attribute.go b/pkg/object/attribute.go deleted file mode 100644 index 7f36686..0000000 --- a/pkg/object/attribute.go +++ /dev/null @@ -1,85 +0,0 @@ -package object - -import ( - "github.com/nspcc-dev/neofs-api-go/v2/object" -) - -// Attribute represents v2-compatible object attribute. -type Attribute object.Attribute - -// NewAttributeFromV2 wraps v2 Attribute message to Attribute. -// -// Nil object.Attribute converts to nil. -func NewAttributeFromV2(aV2 *object.Attribute) *Attribute { - return (*Attribute)(aV2) -} - -// NewAttribute creates and initializes blank Attribute. -// -// Works similar as NewAttributeFromV2(new(Attribute)). -// -// Defaults: -// - key: ""; -// - value: "". -func NewAttribute() *Attribute { - return NewAttributeFromV2(new(object.Attribute)) -} - -// Key returns key to the object attribute. -func (a *Attribute) Key() string { - return (*object.Attribute)(a).GetKey() -} - -// SetKey sets key to the object attribute. -func (a *Attribute) SetKey(v string) { - (*object.Attribute)(a).SetKey(v) -} - -// Value return value of the object attribute. -func (a *Attribute) Value() string { - return (*object.Attribute)(a).GetValue() -} - -// SetValue sets value of the object attribute. -func (a *Attribute) SetValue(v string) { - (*object.Attribute)(a).SetValue(v) -} - -// ToV2 converts Attribute to v2 Attribute message. -// -// Nil Attribute converts to nil. -func (a *Attribute) ToV2() *object.Attribute { - return (*object.Attribute)(a) -} - -// Marshal marshals Attribute into a protobuf binary form. -// -// Buffer is allocated when the argument is empty. -// Otherwise, the first buffer is used. -func (a *Attribute) Marshal(b ...[]byte) ([]byte, error) { - var buf []byte - if len(b) > 0 { - buf = b[0] - } - - return (*object.Attribute)(a). - StableMarshal(buf) -} - -// Unmarshal unmarshals protobuf binary representation of Attribute. -func (a *Attribute) Unmarshal(data []byte) error { - return (*object.Attribute)(a). - Unmarshal(data) -} - -// MarshalJSON encodes Attribute to protobuf JSON format. -func (a *Attribute) MarshalJSON() ([]byte, error) { - return (*object.Attribute)(a). - MarshalJSON() -} - -// UnmarshalJSON decodes Attribute from protobuf JSON format. -func (a *Attribute) UnmarshalJSON(data []byte) error { - return (*object.Attribute)(a). - UnmarshalJSON(data) -} diff --git a/pkg/object/attribute_test.go b/pkg/object/attribute_test.go deleted file mode 100644 index d5f1b3f..0000000 --- a/pkg/object/attribute_test.go +++ /dev/null @@ -1,82 +0,0 @@ -package object - -import ( - "testing" - - "github.com/nspcc-dev/neofs-api-go/v2/object" - "github.com/stretchr/testify/require" -) - -func TestAttribute(t *testing.T) { - key, val := "some key", "some value" - - a := NewAttribute() - a.SetKey(key) - a.SetValue(val) - - require.Equal(t, key, a.Key()) - require.Equal(t, val, a.Value()) - - aV2 := a.ToV2() - - require.Equal(t, key, aV2.GetKey()) - require.Equal(t, val, aV2.GetValue()) -} - -func TestAttributeEncoding(t *testing.T) { - a := NewAttribute() - a.SetKey("key") - a.SetValue("value") - - t.Run("binary", func(t *testing.T) { - data, err := a.Marshal() - require.NoError(t, err) - - a2 := NewAttribute() - require.NoError(t, a2.Unmarshal(data)) - - require.Equal(t, a, a2) - }) - - t.Run("json", func(t *testing.T) { - data, err := a.MarshalJSON() - require.NoError(t, err) - - a2 := NewAttribute() - require.NoError(t, a2.UnmarshalJSON(data)) - - require.Equal(t, a, a2) - }) -} - -func TestNewAttributeFromV2(t *testing.T) { - t.Run("from nil", func(t *testing.T) { - var x *object.Attribute - - require.Nil(t, NewAttributeFromV2(x)) - }) -} - -func TestAttribute_ToV2(t *testing.T) { - t.Run("nil", func(t *testing.T) { - var x *Attribute - - require.Nil(t, x.ToV2()) - }) -} - -func TestNewAttribute(t *testing.T) { - t.Run("default values", func(t *testing.T) { - a := NewAttribute() - - // check initial values - require.Empty(t, a.Key()) - require.Empty(t, a.Value()) - - // convert to v2 message - aV2 := a.ToV2() - - require.Empty(t, aV2.GetKey()) - require.Empty(t, aV2.GetValue()) - }) -} diff --git a/pkg/object/error.go b/pkg/object/error.go deleted file mode 100644 index 96048c2..0000000 --- a/pkg/object/error.go +++ /dev/null @@ -1,19 +0,0 @@ -package object - -type SplitInfoError struct { - si *SplitInfo -} - -const splitInfoErrorMsg = "object not found, split info has been provided" - -func (s *SplitInfoError) Error() string { - return splitInfoErrorMsg -} - -func (s *SplitInfoError) SplitInfo() *SplitInfo { - return s.si -} - -func NewSplitInfoError(v *SplitInfo) *SplitInfoError { - return &SplitInfoError{si: v} -} diff --git a/pkg/object/error_test.go b/pkg/object/error_test.go deleted file mode 100644 index 870c2d6..0000000 --- a/pkg/object/error_test.go +++ /dev/null @@ -1,33 +0,0 @@ -package object_test - -import ( - "errors" - "testing" - - "github.com/nspcc-dev/neofs-api-go/pkg/object" - "github.com/stretchr/testify/require" -) - -func TestNewSplitInfoError(t *testing.T) { - var ( - si = generateSplitInfo() - - err error = object.NewSplitInfoError(si) - expectedErr *object.SplitInfoError - ) - - require.True(t, errors.As(err, &expectedErr)) - - siErr, ok := err.(*object.SplitInfoError) - require.True(t, ok) - require.Equal(t, si, siErr.SplitInfo()) -} - -func generateSplitInfo() *object.SplitInfo { - si := object.NewSplitInfo() - si.SetSplitID(object.NewSplitID()) - si.SetLastPart(generateID()) - si.SetLink(generateID()) - - return si -} diff --git a/pkg/object/fmt.go b/pkg/object/fmt.go deleted file mode 100644 index d99a2c6..0000000 --- a/pkg/object/fmt.go +++ /dev/null @@ -1,176 +0,0 @@ -package object - -import ( - "crypto/ecdsa" - "crypto/sha256" - "errors" - "fmt" - - "github.com/nspcc-dev/neofs-api-go/pkg" - "github.com/nspcc-dev/neofs-api-go/util/signature" - signatureV2 "github.com/nspcc-dev/neofs-api-go/v2/signature" -) - -var errCheckSumMismatch = errors.New("payload checksum mismatch") - -var errIncorrectID = errors.New("incorrect object identifier") - -// CalculatePayloadChecksum calculates and returns checksum of -// object payload bytes. -func CalculatePayloadChecksum(payload []byte) *pkg.Checksum { - res := pkg.NewChecksum() - res.SetSHA256(sha256.Sum256(payload)) - - return res -} - -// CalculateAndSetPayloadChecksum calculates checksum of current -// object payload and writes it to the object. -func CalculateAndSetPayloadChecksum(obj *RawObject) { - obj.SetPayloadChecksum( - CalculatePayloadChecksum(obj.Payload()), - ) -} - -// VerifyPayloadChecksum checks if payload checksum in the object -// corresponds to its payload. -func VerifyPayloadChecksum(obj *Object) error { - if !pkg.EqualChecksums( - obj.PayloadChecksum(), - CalculatePayloadChecksum(obj.Payload()), - ) { - return errCheckSumMismatch - } - - return nil -} - -// CalculateID calculates identifier for the object. -func CalculateID(obj *Object) (*ID, error) { - data, err := obj.ToV2().GetHeader().StableMarshal(nil) - if err != nil { - return nil, err - } - - id := NewID() - id.SetSHA256(sha256.Sum256(data)) - - return id, nil -} - -// CalculateAndSetID calculates identifier for the object -// and writes the result to it. -func CalculateAndSetID(obj *RawObject) error { - id, err := CalculateID(obj.Object()) - if err != nil { - return err - } - - obj.SetID(id) - - return nil -} - -// VerifyID checks if identifier in the object corresponds to -// its structure. -func VerifyID(obj *Object) error { - id, err := CalculateID(obj) - if err != nil { - return err - } - - if !id.Equal(obj.ID()) { - return errIncorrectID - } - - return nil -} - -func CalculateIDSignature(key *ecdsa.PrivateKey, id *ID) (*pkg.Signature, error) { - sig := pkg.NewSignature() - - if err := signature.SignDataWithHandler( - key, - signatureV2.StableMarshalerWrapper{ - SM: id.ToV2(), - }, - func(key, sign []byte) { - sig.SetKey(key) - sig.SetSign(sign) - }, - ); err != nil { - return nil, err - } - - return sig, nil -} - -func CalculateAndSetSignature(key *ecdsa.PrivateKey, obj *RawObject) error { - sig, err := CalculateIDSignature(key, obj.ID()) - if err != nil { - return err - } - - obj.SetSignature(sig) - - return nil -} - -func VerifyIDSignature(obj *Object) error { - return signature.VerifyDataWithSource( - signatureV2.StableMarshalerWrapper{ - SM: obj.ID().ToV2(), - }, - func() ([]byte, []byte) { - sig := obj.Signature() - - return sig.Key(), sig.Sign() - }, - ) -} - -// SetIDWithSignature sets object identifier and signature. -func SetIDWithSignature(key *ecdsa.PrivateKey, obj *RawObject) error { - if err := CalculateAndSetID(obj); err != nil { - return fmt.Errorf("could not set identifier: %w", err) - } - - if err := CalculateAndSetSignature(key, obj); err != nil { - return fmt.Errorf("could not set signature: %w", err) - } - - return nil -} - -// SetVerificationFields calculates and sets all verification fields of the object. -func SetVerificationFields(key *ecdsa.PrivateKey, obj *RawObject) error { - CalculateAndSetPayloadChecksum(obj) - - return SetIDWithSignature(key, obj) -} - -// CheckVerificationFields checks all verification fields of the object. -func CheckVerificationFields(obj *Object) error { - if err := CheckHeaderVerificationFields(obj); err != nil { - return fmt.Errorf("invalid header structure: %w", err) - } - - if err := VerifyPayloadChecksum(obj); err != nil { - return fmt.Errorf("invalid payload checksum: %w", err) - } - - return nil -} - -// CheckHeaderVerificationFields checks all verification fields except payload. -func CheckHeaderVerificationFields(obj *Object) error { - if err := VerifyIDSignature(obj); err != nil { - return fmt.Errorf("invalid signature: %w", err) - } - - if err := VerifyID(obj); err != nil { - return fmt.Errorf("invalid identifier: %w", err) - } - - return nil -} diff --git a/pkg/object/fmt_test.go b/pkg/object/fmt_test.go deleted file mode 100644 index b1731c9..0000000 --- a/pkg/object/fmt_test.go +++ /dev/null @@ -1,79 +0,0 @@ -package object - -import ( - "crypto/rand" - "testing" - - "github.com/nspcc-dev/neofs-crypto/test" - "github.com/stretchr/testify/require" -) - -func TestVerificationFields(t *testing.T) { - obj := NewRaw() - - payload := make([]byte, 10) - _, _ = rand.Read(payload) - - obj.SetPayload(payload) - obj.SetPayloadSize(uint64(len(payload))) - - require.NoError(t, SetVerificationFields(test.DecodeKey(-1), obj)) - - require.NoError(t, CheckVerificationFields(obj.Object())) - - items := []struct { - corrupt func() - restore func() - }{ - { - corrupt: func() { - payload[0]++ - }, - restore: func() { - payload[0]-- - }, - }, - { - corrupt: func() { - obj.SetPayloadSize(obj.PayloadSize() + 1) - }, - restore: func() { - obj.SetPayloadSize(obj.PayloadSize() - 1) - }, - }, - { - corrupt: func() { - obj.ID().ToV2().GetValue()[0]++ - }, - restore: func() { - obj.ID().ToV2().GetValue()[0]-- - }, - }, - { - corrupt: func() { - obj.Signature().Key()[0]++ - }, - restore: func() { - obj.Signature().Key()[0]-- - }, - }, - { - corrupt: func() { - obj.Signature().Sign()[0]++ - }, - restore: func() { - obj.Signature().Sign()[0]-- - }, - }, - } - - for _, item := range items { - item.corrupt() - - require.Error(t, CheckVerificationFields(obj.Object())) - - item.restore() - - require.NoError(t, CheckVerificationFields(obj.Object())) - } -} diff --git a/pkg/object/id.go b/pkg/object/id.go deleted file mode 100644 index 26e70f7..0000000 --- a/pkg/object/id.go +++ /dev/null @@ -1,104 +0,0 @@ -package object - -import ( - "bytes" - "crypto/sha256" - "errors" - "fmt" - - "github.com/mr-tron/base58" - "github.com/nspcc-dev/neofs-api-go/v2/refs" -) - -// ID represents v2-compatible object identifier. -type ID refs.ObjectID - -var errInvalidIDString = errors.New("incorrect format of the string object ID") - -// NewIDFromV2 wraps v2 ObjectID message to ID. -// -// Nil refs.ObjectID converts to nil. -func NewIDFromV2(idV2 *refs.ObjectID) *ID { - return (*ID)(idV2) -} - -// NewID creates and initializes blank ID. -// -// Works similar as NewIDFromV2(new(ObjectID)). -// -// Defaults: -// - value: nil. -func NewID() *ID { - return NewIDFromV2(new(refs.ObjectID)) -} - -// SetSHA256 sets object identifier value to SHA256 checksum. -func (id *ID) SetSHA256(v [sha256.Size]byte) { - (*refs.ObjectID)(id).SetValue(v[:]) -} - -// Equal returns true if identifiers are identical. -func (id *ID) Equal(id2 *ID) bool { - return bytes.Equal( - (*refs.ObjectID)(id).GetValue(), - (*refs.ObjectID)(id2).GetValue(), - ) -} - -// ToV2 converts ID to v2 ObjectID message. -// -// Nil ID converts to nil. -func (id *ID) ToV2() *refs.ObjectID { - return (*refs.ObjectID)(id) -} - -// Parse converts base58 string representation into ID. -func (id *ID) Parse(s string) error { - data, err := base58.Decode(s) - if err != nil { - return fmt.Errorf("could not parse object.ID from string: %w", err) - } else if len(data) != sha256.Size { - return errInvalidIDString - } - - (*refs.ObjectID)(id).SetValue(data) - - return nil -} - -// String returns base58 string representation of ID. -func (id *ID) String() string { - return base58.Encode((*refs.ObjectID)(id).GetValue()) -} - -// Marshal marshals ID into a protobuf binary form. -// -// Buffer is allocated when the argument is empty. -// Otherwise, the first buffer is used. -func (id *ID) Marshal(b ...[]byte) ([]byte, error) { - var buf []byte - if len(b) > 0 { - buf = b[0] - } - - return (*refs.ObjectID)(id). - StableMarshal(buf) -} - -// Unmarshal unmarshals protobuf binary representation of ID. -func (id *ID) Unmarshal(data []byte) error { - return (*refs.ObjectID)(id). - Unmarshal(data) -} - -// MarshalJSON encodes ID to protobuf JSON format. -func (id *ID) MarshalJSON() ([]byte, error) { - return (*refs.ObjectID)(id). - MarshalJSON() -} - -// UnmarshalJSON decodes ID from protobuf JSON format. -func (id *ID) UnmarshalJSON(data []byte) error { - return (*refs.ObjectID)(id). - UnmarshalJSON(data) -} diff --git a/pkg/object/id_test.go b/pkg/object/id_test.go deleted file mode 100644 index e4086d8..0000000 --- a/pkg/object/id_test.go +++ /dev/null @@ -1,142 +0,0 @@ -package object - -import ( - "crypto/rand" - "crypto/sha256" - "strconv" - "testing" - - "github.com/mr-tron/base58" - "github.com/nspcc-dev/neofs-api-go/v2/refs" - "github.com/stretchr/testify/require" -) - -func TestIDV2(t *testing.T) { - id := NewID() - - checksum := [sha256.Size]byte{} - - _, err := rand.Read(checksum[:]) - require.NoError(t, err) - - id.SetSHA256(checksum) - - idV2 := id.ToV2() - - require.Equal(t, checksum[:], idV2.GetValue()) -} - -func TestID_Equal(t *testing.T) { - cs := randSHA256Checksum(t) - - id1 := NewID() - id1.SetSHA256(cs) - - id2 := NewID() - id2.SetSHA256(cs) - - id3 := NewID() - id3.SetSHA256(randSHA256Checksum(t)) - - require.True(t, id1.Equal(id2)) - require.False(t, id1.Equal(id3)) -} - -func TestID_Parse(t *testing.T) { - t.Run("should parse successful", func(t *testing.T) { - for i := 0; i < 10; i++ { - t.Run(strconv.Itoa(i), func(t *testing.T) { - cs := randSHA256Checksum(t) - str := base58.Encode(cs[:]) - oid := NewID() - - require.NoError(t, oid.Parse(str)) - require.Equal(t, cs[:], oid.ToV2().GetValue()) - }) - } - }) - - t.Run("should failure on parse", func(t *testing.T) { - for i := 0; i < 10; i++ { - j := i - t.Run(strconv.Itoa(j), func(t *testing.T) { - cs := []byte{1, 2, 3, 4, 5, byte(j)} - str := base58.Encode(cs) - oid := NewID() - - require.Error(t, oid.Parse(str)) - }) - } - }) -} - -func TestID_String(t *testing.T) { - t.Run("nil", func(t *testing.T) { - id := NewID() - require.Empty(t, id.String()) - }) - - t.Run("should be equal", func(t *testing.T) { - for i := 0; i < 10; i++ { - t.Run(strconv.Itoa(i), func(t *testing.T) { - cs := randSHA256Checksum(t) - str := base58.Encode(cs[:]) - oid := NewID() - - require.NoError(t, oid.Parse(str)) - require.Equal(t, str, oid.String()) - }) - } - }) -} - -func TestObjectIDEncoding(t *testing.T) { - id := randID(t) - - t.Run("binary", func(t *testing.T) { - data, err := id.Marshal() - require.NoError(t, err) - - id2 := NewID() - require.NoError(t, id2.Unmarshal(data)) - - require.Equal(t, id, id2) - }) - - t.Run("json", func(t *testing.T) { - data, err := id.MarshalJSON() - require.NoError(t, err) - - a2 := NewID() - require.NoError(t, a2.UnmarshalJSON(data)) - - require.Equal(t, id, a2) - }) -} - -func TestNewIDFromV2(t *testing.T) { - t.Run("from nil", func(t *testing.T) { - var x *refs.ObjectID - - require.Nil(t, NewIDFromV2(x)) - }) -} - -func TestID_ToV2(t *testing.T) { - t.Run("nil", func(t *testing.T) { - var x *ID - - require.Nil(t, x.ToV2()) - }) -} - -func TestNewID(t *testing.T) { - t.Run("default values", func(t *testing.T) { - id := NewID() - - // convert to v2 message - idV2 := id.ToV2() - - require.Nil(t, idV2.GetValue()) - }) -} diff --git a/pkg/object/object.go b/pkg/object/object.go deleted file mode 100644 index 55000dc..0000000 --- a/pkg/object/object.go +++ /dev/null @@ -1,45 +0,0 @@ -package object - -import ( - "github.com/nspcc-dev/neofs-api-go/v2/object" -) - -// Object represents v2-compatible NeoFS object that provides -// a convenient interface for working in isolation -// from the internal structure of an object. -// -// Object allows to work with the object in read-only -// mode as a reflection of the immutability of objects -// in the system. -type Object struct { - *rwObject -} - -// NewFromV2 wraps v2 Object message to Object. -func NewFromV2(oV2 *object.Object) *Object { - return &Object{ - rwObject: (*rwObject)(oV2), - } -} - -// New creates and initializes blank Object. -// -// Works similar as NewFromV2(new(Object)). -func New() *Object { - return NewFromV2(new(object.Object)) -} - -// ToV2 converts Object to v2 Object message. -func (o *Object) ToV2() *object.Object { - if o != nil { - return (*object.Object)(o.rwObject) - } - - return nil -} - -// MarshalHeaderJSON marshals object's header -// into JSON format. -func (o *Object) MarshalHeaderJSON() ([]byte, error) { - return (*object.Object)(o.rwObject).GetHeader().MarshalJSON() -} diff --git a/pkg/object/range.go b/pkg/object/range.go deleted file mode 100644 index 4979aee..0000000 --- a/pkg/object/range.go +++ /dev/null @@ -1,55 +0,0 @@ -package object - -import ( - "github.com/nspcc-dev/neofs-api-go/v2/object" -) - -// Range represents v2-compatible object payload range. -type Range object.Range - -// NewRangeFromV2 wraps v2 Range message to Range. -// -// Nil object.Range converts to nil. -func NewRangeFromV2(rV2 *object.Range) *Range { - return (*Range)(rV2) -} - -// NewRange creates and initializes blank Range. -// -// Defaults: -// - offset: 0; -// - length: 0. -func NewRange() *Range { - return NewRangeFromV2(new(object.Range)) -} - -// ToV2 converts Range to v2 Range message. -// -// Nil Range converts to nil. -func (r *Range) ToV2() *object.Range { - return (*object.Range)(r) -} - -// GetLength returns payload range size. -func (r *Range) GetLength() uint64 { - return (*object.Range)(r). - GetLength() -} - -// SetLength sets payload range size. -func (r *Range) SetLength(v uint64) { - (*object.Range)(r). - SetLength(v) -} - -// GetOffset sets payload range offset from start. -func (r *Range) GetOffset() uint64 { - return (*object.Range)(r). - GetOffset() -} - -// SetOffset gets payload range offset from start. -func (r *Range) SetOffset(v uint64) { - (*object.Range)(r). - SetOffset(v) -} diff --git a/pkg/object/range_test.go b/pkg/object/range_test.go deleted file mode 100644 index e14d360..0000000 --- a/pkg/object/range_test.go +++ /dev/null @@ -1,58 +0,0 @@ -package object - -import ( - "testing" - - "github.com/nspcc-dev/neofs-api-go/v2/object" - "github.com/stretchr/testify/require" -) - -func TestRange_SetOffset(t *testing.T) { - r := NewRange() - - off := uint64(13) - r.SetOffset(off) - - require.Equal(t, off, r.GetOffset()) -} - -func TestRange_SetLength(t *testing.T) { - r := NewRange() - - ln := uint64(7) - r.SetLength(ln) - - require.Equal(t, ln, r.GetLength()) -} - -func TestNewRangeFromV2(t *testing.T) { - t.Run("from nil", func(t *testing.T) { - var x *object.Range - - require.Nil(t, NewRangeFromV2(x)) - }) -} - -func TestRange_ToV2(t *testing.T) { - t.Run("nil", func(t *testing.T) { - var x *Range - - require.Nil(t, x.ToV2()) - }) -} - -func TestNewRange(t *testing.T) { - t.Run("default values", func(t *testing.T) { - r := NewRange() - - // check initial values - require.Zero(t, r.GetLength()) - require.Zero(t, r.GetOffset()) - - // convert to v2 message - rV2 := r.ToV2() - - require.Zero(t, rV2.GetLength()) - require.Zero(t, rV2.GetOffset()) - }) -} diff --git a/pkg/object/raw.go b/pkg/object/raw.go deleted file mode 100644 index 88ac076..0000000 --- a/pkg/object/raw.go +++ /dev/null @@ -1,160 +0,0 @@ -package object - -import ( - "github.com/nspcc-dev/neofs-api-go/pkg" - cid "github.com/nspcc-dev/neofs-api-go/pkg/container/id" - "github.com/nspcc-dev/neofs-api-go/pkg/owner" - "github.com/nspcc-dev/neofs-api-go/pkg/session" - "github.com/nspcc-dev/neofs-api-go/v2/object" -) - -// RawObject represents v2-compatible NeoFS object that provides -// a convenient interface to fill in the fields of -// an object in isolation from its internal structure. -type RawObject struct { - *rwObject -} - -// NewRawFromV2 wraps v2 Object message to RawObject. -func NewRawFromV2(oV2 *object.Object) *RawObject { - return &RawObject{ - rwObject: (*rwObject)(oV2), - } -} - -// NewRawFrom wraps Object instance to RawObject. -func NewRawFrom(obj *Object) *RawObject { - return NewRawFromV2(obj.ToV2()) -} - -// NewRaw creates and initializes blank RawObject. -// -// Works similar as NewRawFromV2(new(Object)). -func NewRaw() *RawObject { - return NewRawFromV2(new(object.Object)) -} - -// Object returns read-only object instance. -func (o *RawObject) Object() *Object { - if o != nil { - return &Object{ - rwObject: o.rwObject, - } - } - - return nil -} - -// SetID sets object identifier. -func (o *RawObject) SetID(v *ID) { - o.setID(v) -} - -// SetSignature sets signature of the object identifier. -func (o *RawObject) SetSignature(v *pkg.Signature) { - o.setSignature(v) -} - -// SetPayload sets payload bytes. -func (o *RawObject) SetPayload(v []byte) { - o.setPayload(v) -} - -// SetVersion sets version of the object. -func (o *RawObject) SetVersion(v *pkg.Version) { - o.setVersion(v) -} - -// SetPayloadSize sets payload length of the object. -func (o *RawObject) SetPayloadSize(v uint64) { - o.setPayloadSize(v) -} - -// SetContainerID sets identifier of the related container. -func (o *RawObject) SetContainerID(v *cid.ID) { - o.setContainerID(v) -} - -// SetOwnerID sets identifier of the object owner. -func (o *RawObject) SetOwnerID(v *owner.ID) { - o.setOwnerID(v) -} - -// SetCreationEpoch sets epoch number in which object was created. -func (o *RawObject) SetCreationEpoch(v uint64) { - o.setCreationEpoch(v) -} - -// SetPayloadChecksum sets checksum of the object payload. -func (o *RawObject) SetPayloadChecksum(v *pkg.Checksum) { - o.setPayloadChecksum(v) -} - -// SetPayloadHomomorphicHash sets homomorphic hash of the object payload. -func (o *RawObject) SetPayloadHomomorphicHash(v *pkg.Checksum) { - o.setPayloadHomomorphicHash(v) -} - -// SetAttributes sets object attributes. -func (o *RawObject) SetAttributes(v ...*Attribute) { - o.setAttributes(v...) -} - -// SetPreviousID sets identifier of the previous sibling object. -func (o *RawObject) SetPreviousID(v *ID) { - o.setPreviousID(v) -} - -// SetChildren sets list of the identifiers of the child objects. -func (o *RawObject) SetChildren(v ...*ID) { - o.setChildren(v...) -} - -// SetSplitID sets split identifier for the split object. -func (o *RawObject) SetSplitID(id *SplitID) { - o.setSplitID(id) -} - -// SetParentID sets identifier of the parent object. -func (o *RawObject) SetParentID(v *ID) { - o.setParentID(v) -} - -// SetParent sets parent object w/o payload. -func (o *RawObject) SetParent(v *Object) { - o.setParent(v) -} - -// SetSessionToken sets token of the session -// within which object was created. -func (o *RawObject) SetSessionToken(v *session.Token) { - o.setSessionToken(v) -} - -// SetType sets type of the object. -func (o *RawObject) SetType(v Type) { - o.setType(v) -} - -// CutPayload returns RawObject w/ empty payload. -// -// Changes of non-payload fields affect source object. -func (o *RawObject) CutPayload() *RawObject { - if o != nil { - return &RawObject{ - rwObject: o.rwObject.cutPayload(), - } - } - - return nil -} - -// ResetRelations removes all fields of links with other objects. -func (o *RawObject) ResetRelations() { - o.resetRelations() -} - -// InitRelations initializes relation field. -func (o *RawObject) InitRelations() { - o.initRelations() -} diff --git a/pkg/object/raw_test.go b/pkg/object/raw_test.go deleted file mode 100644 index d9febfd..0000000 --- a/pkg/object/raw_test.go +++ /dev/null @@ -1,317 +0,0 @@ -package object - -import ( - "crypto/rand" - "crypto/sha256" - "testing" - - "github.com/nspcc-dev/neofs-api-go/pkg" - cidtest "github.com/nspcc-dev/neofs-api-go/pkg/container/id/test" - ownertest "github.com/nspcc-dev/neofs-api-go/pkg/owner/test" - sessiontest "github.com/nspcc-dev/neofs-api-go/pkg/session/test" - "github.com/nspcc-dev/neofs-api-go/v2/object" - "github.com/stretchr/testify/require" -) - -func randID(t *testing.T) *ID { - id := NewID() - id.SetSHA256(randSHA256Checksum(t)) - - return id -} - -func randSHA256Checksum(t *testing.T) (cs [sha256.Size]byte) { - _, err := rand.Read(cs[:]) - require.NoError(t, err) - - return -} - -func randTZChecksum(t *testing.T) (cs [64]byte) { - _, err := rand.Read(cs[:]) - require.NoError(t, err) - - return -} - -func TestRawObject_SetID(t *testing.T) { - obj := NewRaw() - - id := randID(t) - - obj.SetID(id) - - require.Equal(t, id, obj.ID()) -} - -func TestRawObject_SetSignature(t *testing.T) { - obj := NewRaw() - - sig := pkg.NewSignature() - sig.SetKey([]byte{1, 2, 3}) - sig.SetSign([]byte{4, 5, 6}) - - obj.SetSignature(sig) - - require.Equal(t, sig, obj.Signature()) -} - -func TestRawObject_SetPayload(t *testing.T) { - obj := NewRaw() - - payload := make([]byte, 10) - _, _ = rand.Read(payload) - - obj.SetPayload(payload) - - require.Equal(t, payload, obj.Payload()) -} - -func TestRawObject_SetVersion(t *testing.T) { - obj := NewRaw() - - ver := pkg.NewVersion() - ver.SetMajor(1) - ver.SetMinor(2) - - obj.SetVersion(ver) - - require.Equal(t, ver, obj.Version()) -} - -func TestRawObject_SetPayloadSize(t *testing.T) { - obj := NewRaw() - - sz := uint64(133) - obj.SetPayloadSize(sz) - - require.Equal(t, sz, obj.PayloadSize()) -} - -func TestRawObject_SetContainerID(t *testing.T) { - obj := NewRaw() - - cid := cidtest.Generate() - - obj.SetContainerID(cid) - - require.Equal(t, cid, obj.ContainerID()) -} - -func TestRawObject_SetOwnerID(t *testing.T) { - obj := NewRaw() - - ownerID := ownertest.Generate() - - obj.SetOwnerID(ownerID) - - require.Equal(t, ownerID, obj.OwnerID()) -} - -func TestRawObject_SetCreationEpoch(t *testing.T) { - obj := NewRaw() - - creat := uint64(228) - obj.setCreationEpoch(creat) - - require.Equal(t, creat, obj.CreationEpoch()) -} - -func TestRawObject_SetPayloadChecksum(t *testing.T) { - obj := NewRaw() - - cs := pkg.NewChecksum() - cs.SetSHA256(randSHA256Checksum(t)) - - obj.SetPayloadChecksum(cs) - - require.Equal(t, cs, obj.PayloadChecksum()) -} - -func TestRawObject_SetPayloadHomomorphicHash(t *testing.T) { - obj := NewRaw() - - cs := pkg.NewChecksum() - cs.SetTillichZemor(randTZChecksum(t)) - - obj.SetPayloadHomomorphicHash(cs) - - require.Equal(t, cs, obj.PayloadHomomorphicHash()) -} - -func TestRawObject_SetAttributes(t *testing.T) { - obj := NewRaw() - - a1 := NewAttribute() - a1.SetKey("key1") - a1.SetValue("val1") - - a2 := NewAttribute() - a2.SetKey("key2") - a2.SetValue("val2") - - obj.SetAttributes(a1, a2) - - require.Equal(t, []*Attribute{a1, a2}, obj.Attributes()) -} - -func TestRawObject_SetPreviousID(t *testing.T) { - obj := NewRaw() - - prev := randID(t) - - obj.SetPreviousID(prev) - - require.Equal(t, prev, obj.PreviousID()) -} - -func TestRawObject_SetChildren(t *testing.T) { - obj := NewRaw() - - id1 := randID(t) - id2 := randID(t) - - obj.SetChildren(id1, id2) - - require.Equal(t, []*ID{id1, id2}, obj.Children()) -} - -func TestRawObject_SetSplitID(t *testing.T) { - obj := NewRaw() - - require.Nil(t, obj.SplitID()) - - splitID := NewSplitID() - obj.SetSplitID(splitID) - - require.Equal(t, obj.SplitID(), splitID) -} - -func TestRawObject_SetParent(t *testing.T) { - obj := NewRaw() - - require.Nil(t, obj.Parent()) - - par := NewRaw() - par.SetID(randID(t)) - par.SetContainerID(cidtest.Generate()) - par.SetSignature(pkg.NewSignature()) - - parObj := par.Object() - - obj.SetParent(parObj) - - require.Equal(t, parObj, obj.Parent()) -} - -func TestRawObject_ToV2(t *testing.T) { - objV2 := new(object.Object) - objV2.SetPayload([]byte{1, 2, 3}) - - obj := NewRawFromV2(objV2) - - require.Equal(t, objV2, obj.ToV2()) -} - -func TestRawObject_SetSessionToken(t *testing.T) { - obj := NewRaw() - - tok := sessiontest.Generate() - - obj.SetSessionToken(tok) - - require.Equal(t, tok, obj.SessionToken()) -} - -func TestRawObject_SetType(t *testing.T) { - obj := NewRaw() - - typ := TypeStorageGroup - - obj.SetType(typ) - - require.Equal(t, typ, obj.Type()) -} - -func TestRawObject_CutPayload(t *testing.T) { - o1 := NewRaw() - - p1 := []byte{12, 3} - o1.SetPayload(p1) - - sz := uint64(13) - o1.SetPayloadSize(sz) - - o2 := o1.CutPayload() - - require.Equal(t, sz, o2.PayloadSize()) - require.Empty(t, o2.Payload()) - - sz++ - o1.SetPayloadSize(sz) - - require.Equal(t, sz, o1.PayloadSize()) - require.Equal(t, sz, o2.PayloadSize()) - - p2 := []byte{4, 5, 6} - o2.SetPayload(p2) - - require.Equal(t, p2, o2.Payload()) - require.Equal(t, p1, o1.Payload()) -} - -func TestRawObject_SetParentID(t *testing.T) { - obj := NewRaw() - - id := randID(t) - obj.setParentID(id) - - require.Equal(t, id, obj.ParentID()) -} - -func TestRawObject_ResetRelations(t *testing.T) { - obj := NewRaw() - - obj.SetPreviousID(randID(t)) - - obj.ResetRelations() - - require.Nil(t, obj.PreviousID()) -} - -func TestRwObject_HasParent(t *testing.T) { - obj := NewRaw() - - obj.InitRelations() - - require.True(t, obj.HasParent()) - - obj.ResetRelations() - - require.False(t, obj.HasParent()) -} - -func TestRWObjectEncoding(t *testing.T) { - o := NewRaw() - o.SetID(randID(t)) - - t.Run("binary", func(t *testing.T) { - data, err := o.Marshal() - require.NoError(t, err) - - o2 := NewRaw() - require.NoError(t, o2.Unmarshal(data)) - - require.Equal(t, o, o2) - }) - - t.Run("json", func(t *testing.T) { - data, err := o.MarshalJSON() - require.NoError(t, err) - - o2 := NewRaw() - require.NoError(t, o2.UnmarshalJSON(data)) - - require.Equal(t, o, o2) - }) -} diff --git a/pkg/object/rw.go b/pkg/object/rw.go deleted file mode 100644 index 52c24d6..0000000 --- a/pkg/object/rw.go +++ /dev/null @@ -1,403 +0,0 @@ -package object - -import ( - "github.com/nspcc-dev/neofs-api-go/pkg" - cid "github.com/nspcc-dev/neofs-api-go/pkg/container/id" - "github.com/nspcc-dev/neofs-api-go/pkg/owner" - "github.com/nspcc-dev/neofs-api-go/pkg/session" - "github.com/nspcc-dev/neofs-api-go/v2/object" - "github.com/nspcc-dev/neofs-api-go/v2/refs" -) - -// wrapper over v2 Object that provides -// public getter and private setters. -type rwObject object.Object - -// ToV2 converts Object to v2 Object message. -func (o *rwObject) ToV2() *object.Object { - return (*object.Object)(o) -} - -func (o *rwObject) setHeaderField(setter func(*object.Header)) { - obj := (*object.Object)(o) - h := obj.GetHeader() - - if h == nil { - h = new(object.Header) - obj.SetHeader(h) - } - - setter(h) -} - -func (o *rwObject) setSplitFields(setter func(*object.SplitHeader)) { - o.setHeaderField(func(h *object.Header) { - split := h.GetSplit() - if split == nil { - split = new(object.SplitHeader) - h.SetSplit(split) - } - - setter(split) - }) -} - -// ID returns object identifier. -func (o *rwObject) ID() *ID { - return NewIDFromV2( - (*object.Object)(o). - GetObjectID(), - ) -} - -func (o *rwObject) setID(v *ID) { - (*object.Object)(o). - SetObjectID(v.ToV2()) -} - -// Signature returns signature of the object identifier. -func (o *rwObject) Signature() *pkg.Signature { - return pkg.NewSignatureFromV2( - (*object.Object)(o). - GetSignature(), - ) -} - -func (o *rwObject) setSignature(v *pkg.Signature) { - (*object.Object)(o). - SetSignature(v.ToV2()) -} - -// Payload returns payload bytes. -func (o *rwObject) Payload() []byte { - return (*object.Object)(o). - GetPayload() -} - -func (o *rwObject) setPayload(v []byte) { - (*object.Object)(o). - SetPayload(v) -} - -// Version returns version of the object. -func (o *rwObject) Version() *pkg.Version { - return pkg.NewVersionFromV2( - (*object.Object)(o). - GetHeader(). - GetVersion(), - ) -} - -func (o *rwObject) setVersion(v *pkg.Version) { - o.setHeaderField(func(h *object.Header) { - h.SetVersion(v.ToV2()) - }) -} - -// PayloadSize returns payload length of the object. -func (o *rwObject) PayloadSize() uint64 { - return (*object.Object)(o). - GetHeader(). - GetPayloadLength() -} - -func (o *rwObject) setPayloadSize(v uint64) { - o.setHeaderField(func(h *object.Header) { - h.SetPayloadLength(v) - }) -} - -// ContainerID returns identifier of the related container. -func (o *rwObject) ContainerID() *cid.ID { - return cid.NewFromV2( - (*object.Object)(o). - GetHeader(). - GetContainerID(), - ) -} - -func (o *rwObject) setContainerID(v *cid.ID) { - o.setHeaderField(func(h *object.Header) { - h.SetContainerID(v.ToV2()) - }) -} - -// OwnerID returns identifier of the object owner. -func (o *rwObject) OwnerID() *owner.ID { - return owner.NewIDFromV2( - (*object.Object)(o). - GetHeader(). - GetOwnerID(), - ) -} - -func (o *rwObject) setOwnerID(v *owner.ID) { - o.setHeaderField(func(h *object.Header) { - h.SetOwnerID(v.ToV2()) - }) -} - -// CreationEpoch returns epoch number in which object was created. -func (o *rwObject) CreationEpoch() uint64 { - return (*object.Object)(o). - GetHeader(). - GetCreationEpoch() -} - -func (o *rwObject) setCreationEpoch(v uint64) { - o.setHeaderField(func(h *object.Header) { - h.SetCreationEpoch(v) - }) -} - -// PayloadChecksum returns checksum of the object payload. -func (o *rwObject) PayloadChecksum() *pkg.Checksum { - return pkg.NewChecksumFromV2( - (*object.Object)(o). - GetHeader(). - GetPayloadHash(), - ) -} - -func (o *rwObject) setPayloadChecksum(v *pkg.Checksum) { - o.setHeaderField(func(h *object.Header) { - h.SetPayloadHash(v.ToV2()) - }) -} - -// PayloadHomomorphicHash returns homomorphic hash of the object payload. -func (o *rwObject) PayloadHomomorphicHash() *pkg.Checksum { - return pkg.NewChecksumFromV2( - (*object.Object)(o). - GetHeader(). - GetHomomorphicHash(), - ) -} - -func (o *rwObject) setPayloadHomomorphicHash(v *pkg.Checksum) { - o.setHeaderField(func(h *object.Header) { - h.SetHomomorphicHash(v.ToV2()) - }) -} - -// Attributes returns object attributes. -func (o *rwObject) Attributes() []*Attribute { - attrs := (*object.Object)(o). - GetHeader(). - GetAttributes() - - res := make([]*Attribute, 0, len(attrs)) - - for i := range attrs { - res = append(res, NewAttributeFromV2(attrs[i])) - } - - return res -} - -func (o *rwObject) setAttributes(v ...*Attribute) { - attrs := make([]*object.Attribute, 0, len(v)) - - for i := range v { - attrs = append(attrs, v[i].ToV2()) - } - - o.setHeaderField(func(h *object.Header) { - h.SetAttributes(attrs) - }) -} - -// PreviousID returns identifier of the previous sibling object. -func (o *rwObject) PreviousID() *ID { - return NewIDFromV2( - (*object.Object)(o). - GetHeader(). - GetSplit(). - GetPrevious(), - ) -} - -func (o *rwObject) setPreviousID(v *ID) { - o.setSplitFields(func(split *object.SplitHeader) { - split.SetPrevious(v.ToV2()) - }) -} - -// Children return list of the identifiers of the child objects. -func (o *rwObject) Children() []*ID { - ids := (*object.Object)(o). - GetHeader(). - GetSplit(). - GetChildren() - - res := make([]*ID, 0, len(ids)) - - for i := range ids { - res = append(res, NewIDFromV2(ids[i])) - } - - return res -} - -func (o *rwObject) setChildren(v ...*ID) { - ids := make([]*refs.ObjectID, 0, len(v)) - - for i := range v { - ids = append(ids, v[i].ToV2()) - } - - o.setSplitFields(func(split *object.SplitHeader) { - split.SetChildren(ids) - }) -} - -// SplitID return split identity of split object. If object is not split -// returns nil. -func (o *rwObject) SplitID() *SplitID { - return NewSplitIDFromV2( - (*object.Object)(o). - GetHeader(). - GetSplit(). - GetSplitID(), - ) -} - -func (o *rwObject) setSplitID(id *SplitID) { - o.setSplitFields(func(split *object.SplitHeader) { - split.SetSplitID(id.ToV2()) - }) -} - -// ParentID returns identifier of the parent object. -func (o *rwObject) ParentID() *ID { - return NewIDFromV2( - (*object.Object)(o). - GetHeader(). - GetSplit(). - GetParent(), - ) -} - -func (o *rwObject) setParentID(v *ID) { - o.setSplitFields(func(split *object.SplitHeader) { - split.SetParent(v.ToV2()) - }) -} - -// Parent returns parent object w/o payload. -func (o *rwObject) Parent() *Object { - h := (*object.Object)(o). - GetHeader(). - GetSplit() - - parSig := h.GetParentSignature() - parHdr := h.GetParentHeader() - - if parSig == nil && parHdr == nil { - return nil - } - - oV2 := new(object.Object) - oV2.SetObjectID(h.GetParent()) - oV2.SetSignature(parSig) - oV2.SetHeader(parHdr) - - return NewFromV2(oV2) -} - -func (o *rwObject) setParent(v *Object) { - o.setSplitFields(func(split *object.SplitHeader) { - split.SetParent((*object.Object)(v.rwObject).GetObjectID()) - split.SetParentSignature((*object.Object)(v.rwObject).GetSignature()) - split.SetParentHeader((*object.Object)(v.rwObject).GetHeader()) - }) -} - -func (o *rwObject) initRelations() { - o.setHeaderField(func(h *object.Header) { - h.SetSplit(new(object.SplitHeader)) - }) -} - -func (o *rwObject) resetRelations() { - o.setHeaderField(func(h *object.Header) { - h.SetSplit(nil) - }) -} - -// SessionToken returns token of the session -// within which object was created. -func (o *rwObject) SessionToken() *session.Token { - return session.NewTokenFromV2( - (*object.Object)(o). - GetHeader(). - GetSessionToken(), - ) -} - -func (o *rwObject) setSessionToken(v *session.Token) { - o.setHeaderField(func(h *object.Header) { - h.SetSessionToken(v.ToV2()) - }) -} - -// Type returns type of the object. -func (o *rwObject) Type() Type { - return TypeFromV2( - (*object.Object)(o). - GetHeader(). - GetObjectType(), - ) -} - -func (o *rwObject) setType(t Type) { - o.setHeaderField(func(h *object.Header) { - h.SetObjectType(t.ToV2()) - }) -} - -func (o *rwObject) cutPayload() *rwObject { - ov2 := new(object.Object) - *ov2 = *(*object.Object)(o) - ov2.SetPayload(nil) - - return (*rwObject)(ov2) -} - -func (o *rwObject) HasParent() bool { - return (*object.Object)(o). - GetHeader(). - GetSplit() != nil -} - -// Marshal marshals object into a protobuf binary form. -// -// Buffer is allocated when the argument is empty. -// Otherwise, the first buffer is used. -func (o *rwObject) Marshal(b ...[]byte) ([]byte, error) { - var buf []byte - if len(b) > 0 { - buf = b[0] - } - - return (*object.Object)(o). - StableMarshal(buf) -} - -// Unmarshal unmarshals protobuf binary representation of object. -func (o *rwObject) Unmarshal(data []byte) error { - return (*object.Object)(o). - Unmarshal(data) -} - -// MarshalJSON encodes object to protobuf JSON format. -func (o *rwObject) MarshalJSON() ([]byte, error) { - return (*object.Object)(o). - MarshalJSON() -} - -// UnmarshalJSON decodes object from protobuf JSON format. -func (o *rwObject) UnmarshalJSON(data []byte) error { - return (*object.Object)(o). - UnmarshalJSON(data) -} diff --git a/pkg/object/search.go b/pkg/object/search.go deleted file mode 100644 index cf703f5..0000000 --- a/pkg/object/search.go +++ /dev/null @@ -1,309 +0,0 @@ -package object - -import ( - "encoding/json" - "fmt" - - "github.com/nspcc-dev/neofs-api-go/pkg" - cid "github.com/nspcc-dev/neofs-api-go/pkg/container/id" - "github.com/nspcc-dev/neofs-api-go/pkg/owner" - v2object "github.com/nspcc-dev/neofs-api-go/v2/object" -) - -// SearchMatchType indicates match operation on specified header. -type SearchMatchType uint32 - -const ( - MatchUnknown SearchMatchType = iota - MatchStringEqual - MatchStringNotEqual - MatchNotPresent - MatchCommonPrefix -) - -func (m SearchMatchType) ToV2() v2object.MatchType { - switch m { - case MatchStringEqual: - return v2object.MatchStringEqual - case MatchStringNotEqual: - return v2object.MatchStringNotEqual - case MatchNotPresent: - return v2object.MatchNotPresent - case MatchCommonPrefix: - return v2object.MatchCommonPrefix - default: - return v2object.MatchUnknown - } -} - -func SearchMatchFromV2(t v2object.MatchType) (m SearchMatchType) { - switch t { - case v2object.MatchStringEqual: - m = MatchStringEqual - case v2object.MatchStringNotEqual: - m = MatchStringNotEqual - case v2object.MatchNotPresent: - m = MatchNotPresent - case v2object.MatchCommonPrefix: - m = MatchCommonPrefix - default: - m = MatchUnknown - } - - return m -} - -// String returns string representation of SearchMatchType. -// -// String mapping: -// * MatchStringEqual: STRING_EQUAL; -// * MatchStringNotEqual: STRING_NOT_EQUAL; -// * MatchNotPresent: NOT_PRESENT; -// * MatchCommonPrefix: COMMON_PREFIX; -// * MatchUnknown, default: MATCH_TYPE_UNSPECIFIED. -func (m SearchMatchType) String() string { - return m.ToV2().String() -} - -// FromString parses SearchMatchType from a string representation. -// It is a reverse action to String(). -// -// Returns true if s was parsed successfully. -func (m *SearchMatchType) FromString(s string) bool { - var g v2object.MatchType - - ok := g.FromString(s) - - if ok { - *m = SearchMatchFromV2(g) - } - - return ok -} - -type SearchFilter struct { - header filterKey - value fmt.Stringer - op SearchMatchType -} - -type staticStringer string - -type filterKey struct { - typ filterKeyType - - str string -} - -// enumeration of reserved filter keys. -type filterKeyType int - -type boolStringer bool - -type SearchFilters []SearchFilter - -const ( - _ filterKeyType = iota - fKeyVersion - fKeyObjectID - fKeyContainerID - fKeyOwnerID - fKeyCreationEpoch - fKeyPayloadLength - fKeyPayloadHash - fKeyType - fKeyHomomorphicHash - fKeyParent - fKeySplitID - fKeyPropRoot - fKeyPropPhy -) - -func (k filterKey) String() string { - switch k.typ { - default: - return k.str - case fKeyVersion: - return v2object.FilterHeaderVersion - case fKeyObjectID: - return v2object.FilterHeaderObjectID - case fKeyContainerID: - return v2object.FilterHeaderContainerID - case fKeyOwnerID: - return v2object.FilterHeaderOwnerID - case fKeyCreationEpoch: - return v2object.FilterHeaderCreationEpoch - case fKeyPayloadLength: - return v2object.FilterHeaderPayloadLength - case fKeyPayloadHash: - return v2object.FilterHeaderPayloadHash - case fKeyType: - return v2object.FilterHeaderObjectType - case fKeyHomomorphicHash: - return v2object.FilterHeaderHomomorphicHash - case fKeyParent: - return v2object.FilterHeaderParent - case fKeySplitID: - return v2object.FilterHeaderSplitID - case fKeyPropRoot: - return v2object.FilterPropertyRoot - case fKeyPropPhy: - return v2object.FilterPropertyPhy - } -} - -func (s staticStringer) String() string { - return string(s) -} - -func (s boolStringer) String() string { - if s { - return v2object.BooleanPropertyValueTrue - } - - return v2object.BooleanPropertyValueFalse -} - -func (f *SearchFilter) Header() string { - return f.header.String() -} - -func (f *SearchFilter) Value() string { - return f.value.String() -} - -func (f *SearchFilter) Operation() SearchMatchType { - return f.op -} - -func NewSearchFilters() SearchFilters { - return SearchFilters{} -} - -func NewSearchFiltersFromV2(v2 []*v2object.SearchFilter) SearchFilters { - filters := make(SearchFilters, 0, len(v2)) - - for i := range v2 { - if v2[i] == nil { - continue - } - - filters.AddFilter( - v2[i].GetKey(), - v2[i].GetValue(), - SearchMatchFromV2(v2[i].GetMatchType()), - ) - } - - return filters -} - -func (f *SearchFilters) addFilter(op SearchMatchType, keyTyp filterKeyType, key string, val fmt.Stringer) { - if *f == nil { - *f = make(SearchFilters, 0, 1) - } - - *f = append(*f, SearchFilter{ - header: filterKey{ - typ: keyTyp, - str: key, - }, - value: val, - op: op, - }) -} - -func (f *SearchFilters) AddFilter(header, value string, op SearchMatchType) { - f.addFilter(op, 0, header, staticStringer(value)) -} - -func (f *SearchFilters) addReservedFilter(op SearchMatchType, keyTyp filterKeyType, val fmt.Stringer) { - f.addFilter(op, keyTyp, "", val) -} - -// addFlagFilters adds filters that works like flags: they don't need to have -// specific match type or value. They processed by NeoFS nodes by the fact -// of presence in search query. E.g.: PHY, ROOT. -func (f *SearchFilters) addFlagFilter(keyTyp filterKeyType) { - f.addFilter(MatchUnknown, keyTyp, "", staticStringer("")) -} - -func (f *SearchFilters) AddObjectVersionFilter(op SearchMatchType, v *pkg.Version) { - f.addReservedFilter(op, fKeyVersion, v) -} - -func (f *SearchFilters) AddObjectContainerIDFilter(m SearchMatchType, id *cid.ID) { - f.addReservedFilter(m, fKeyContainerID, id) -} - -func (f *SearchFilters) AddObjectOwnerIDFilter(m SearchMatchType, id *owner.ID) { - f.addReservedFilter(m, fKeyOwnerID, id) -} - -func (f SearchFilters) ToV2() []*v2object.SearchFilter { - result := make([]*v2object.SearchFilter, 0, len(f)) - - for i := range f { - v2 := new(v2object.SearchFilter) - v2.SetKey(f[i].header.String()) - v2.SetValue(f[i].value.String()) - v2.SetMatchType(f[i].op.ToV2()) - - result = append(result, v2) - } - - return result -} - -func (f *SearchFilters) addRootFilter() { - f.addFlagFilter(fKeyPropRoot) -} - -func (f *SearchFilters) AddRootFilter() { - f.addRootFilter() -} - -func (f *SearchFilters) addPhyFilter() { - f.addFlagFilter(fKeyPropPhy) -} - -func (f *SearchFilters) AddPhyFilter() { - f.addPhyFilter() -} - -// AddParentIDFilter adds filter by parent identifier. -func (f *SearchFilters) AddParentIDFilter(m SearchMatchType, id *ID) { - f.addReservedFilter(m, fKeyParent, id) -} - -// AddObjectIDFilter adds filter by object identifier. -func (f *SearchFilters) AddObjectIDFilter(m SearchMatchType, id *ID) { - f.addReservedFilter(m, fKeyObjectID, id) -} - -func (f *SearchFilters) AddSplitIDFilter(m SearchMatchType, id *SplitID) { - f.addReservedFilter(m, fKeySplitID, id) -} - -// AddTypeFilter adds filter by object type. -func (f *SearchFilters) AddTypeFilter(m SearchMatchType, typ Type) { - f.addReservedFilter(m, fKeyType, typ) -} - -// MarshalJSON encodes SearchFilters to protobuf JSON format. -func (f *SearchFilters) MarshalJSON() ([]byte, error) { - return json.Marshal(f.ToV2()) -} - -// UnmarshalJSON decodes SearchFilters from protobuf JSON format. -func (f *SearchFilters) UnmarshalJSON(data []byte) error { - var fsV2 []*v2object.SearchFilter - - if err := json.Unmarshal(data, &fsV2); err != nil { - return err - } - - *f = NewSearchFiltersFromV2(fsV2) - - return nil -} diff --git a/pkg/object/search_test.go b/pkg/object/search_test.go deleted file mode 100644 index 33b52e9..0000000 --- a/pkg/object/search_test.go +++ /dev/null @@ -1,208 +0,0 @@ -package object_test - -import ( - "crypto/rand" - "crypto/sha256" - "testing" - - "github.com/nspcc-dev/neofs-api-go/pkg/object" - v2object "github.com/nspcc-dev/neofs-api-go/v2/object" - "github.com/stretchr/testify/require" -) - -var eqV2Matches = map[object.SearchMatchType]v2object.MatchType{ - object.MatchUnknown: v2object.MatchUnknown, - object.MatchStringEqual: v2object.MatchStringEqual, - object.MatchStringNotEqual: v2object.MatchStringNotEqual, - object.MatchNotPresent: v2object.MatchNotPresent, - object.MatchCommonPrefix: v2object.MatchCommonPrefix, -} - -func TestMatch(t *testing.T) { - t.Run("known matches", func(t *testing.T) { - for matchType, matchTypeV2 := range eqV2Matches { - require.Equal(t, matchTypeV2, matchType.ToV2()) - require.Equal(t, object.SearchMatchFromV2(matchTypeV2), matchType) - } - }) - - t.Run("unknown matches", func(t *testing.T) { - var unknownMatchType object.SearchMatchType - - for matchType := range eqV2Matches { - unknownMatchType += matchType - } - - unknownMatchType++ - - require.Equal(t, unknownMatchType.ToV2(), v2object.MatchUnknown) - - var unknownMatchTypeV2 v2object.MatchType - - for _, matchTypeV2 := range eqV2Matches { - unknownMatchTypeV2 += matchTypeV2 - } - - unknownMatchTypeV2++ - - require.Equal(t, object.SearchMatchFromV2(unknownMatchTypeV2), object.MatchUnknown) - }) -} - -func TestFilter(t *testing.T) { - inputs := [][]string{ - {"user-header", "user-value"}, - } - - filters := object.NewSearchFilters() - for i := range inputs { - filters.AddFilter(inputs[i][0], inputs[i][1], object.MatchStringEqual) - } - - require.Len(t, filters, len(inputs)) - for i := range inputs { - require.Equal(t, inputs[i][0], filters[i].Header()) - require.Equal(t, inputs[i][1], filters[i].Value()) - require.Equal(t, object.MatchStringEqual, filters[i].Operation()) - } - - v2 := filters.ToV2() - newFilters := object.NewSearchFiltersFromV2(v2) - require.Equal(t, filters, newFilters) -} - -func TestSearchFilters_AddRootFilter(t *testing.T) { - fs := new(object.SearchFilters) - - fs.AddRootFilter() - - require.Len(t, *fs, 1) - - f := (*fs)[0] - - require.Equal(t, object.MatchUnknown, f.Operation()) - require.Equal(t, v2object.FilterPropertyRoot, f.Header()) - require.Equal(t, "", f.Value()) -} - -func TestSearchFilters_AddPhyFilter(t *testing.T) { - fs := new(object.SearchFilters) - - fs.AddPhyFilter() - - require.Len(t, *fs, 1) - - f := (*fs)[0] - - require.Equal(t, object.MatchUnknown, f.Operation()) - require.Equal(t, v2object.FilterPropertyPhy, f.Header()) - require.Equal(t, "", f.Value()) -} - -func testOID() *object.ID { - cs := [sha256.Size]byte{} - - rand.Read(cs[:]) - - id := object.NewID() - id.SetSHA256(cs) - - return id -} - -func TestSearchFilters_AddParentIDFilter(t *testing.T) { - par := testOID() - - fs := object.SearchFilters{} - fs.AddParentIDFilter(object.MatchStringEqual, par) - - fsV2 := fs.ToV2() - - require.Len(t, fsV2, 1) - - require.Equal(t, v2object.FilterHeaderParent, fsV2[0].GetKey()) - require.Equal(t, par.String(), fsV2[0].GetValue()) - require.Equal(t, v2object.MatchStringEqual, fsV2[0].GetMatchType()) -} - -func TestSearchFilters_AddObjectIDFilter(t *testing.T) { - id := testOID() - - fs := new(object.SearchFilters) - fs.AddObjectIDFilter(object.MatchStringEqual, id) - - t.Run("v2", func(t *testing.T) { - fsV2 := fs.ToV2() - - require.Len(t, fsV2, 1) - - require.Equal(t, v2object.FilterHeaderObjectID, fsV2[0].GetKey()) - require.Equal(t, id.String(), fsV2[0].GetValue()) - require.Equal(t, v2object.MatchStringEqual, fsV2[0].GetMatchType()) - }) -} - -func TestSearchFilters_AddSplitIDFilter(t *testing.T) { - id := object.NewSplitID() - - fs := new(object.SearchFilters) - fs.AddSplitIDFilter(object.MatchStringEqual, id) - - t.Run("v2", func(t *testing.T) { - fsV2 := fs.ToV2() - - require.Len(t, fsV2, 1) - - require.Equal(t, v2object.FilterHeaderSplitID, fsV2[0].GetKey()) - require.Equal(t, id.String(), fsV2[0].GetValue()) - require.Equal(t, v2object.MatchStringEqual, fsV2[0].GetMatchType()) - }) -} - -func TestSearchFilters_AddTypeFilter(t *testing.T) { - typ := object.TypeTombstone - - fs := new(object.SearchFilters) - fs.AddTypeFilter(object.MatchStringEqual, typ) - - t.Run("v2", func(t *testing.T) { - fsV2 := fs.ToV2() - - require.Len(t, fsV2, 1) - - require.Equal(t, v2object.FilterHeaderObjectType, fsV2[0].GetKey()) - require.Equal(t, typ.String(), fsV2[0].GetValue()) - require.Equal(t, v2object.MatchStringEqual, fsV2[0].GetMatchType()) - }) -} - -func TestSearchFiltersEncoding(t *testing.T) { - fs := object.NewSearchFilters() - fs.AddFilter("key 1", "value 2", object.MatchStringEqual) - fs.AddFilter("key 2", "value 2", object.MatchStringNotEqual) - fs.AddFilter("key 2", "value 2", object.MatchCommonPrefix) - - t.Run("json", func(t *testing.T) { - data, err := fs.MarshalJSON() - require.NoError(t, err) - - fs2 := object.NewSearchFilters() - require.NoError(t, fs2.UnmarshalJSON(data)) - - require.Equal(t, fs, fs2) - }) -} - -func TestSearchMatchType_String(t *testing.T) { - toPtr := func(v object.SearchMatchType) *object.SearchMatchType { - return &v - } - - testEnumStrings(t, new(object.SearchMatchType), []enumStringItem{ - {val: toPtr(object.MatchCommonPrefix), str: "COMMON_PREFIX"}, - {val: toPtr(object.MatchStringEqual), str: "STRING_EQUAL"}, - {val: toPtr(object.MatchStringNotEqual), str: "STRING_NOT_EQUAL"}, - {val: toPtr(object.MatchNotPresent), str: "NOT_PRESENT"}, - {val: toPtr(object.MatchUnknown), str: "MATCH_TYPE_UNSPECIFIED"}, - }) -} diff --git a/pkg/object/splitid.go b/pkg/object/splitid.go deleted file mode 100644 index 84288f2..0000000 --- a/pkg/object/splitid.go +++ /dev/null @@ -1,80 +0,0 @@ -package object - -import ( - "github.com/google/uuid" -) - -// SplitID is a UUIDv4 used as attribute in split objects. -type SplitID struct { - uuid uuid.UUID -} - -// NewSplitID returns UUID representation of splitID attribute. -// -// Defaults: -// - id: random UUID. -func NewSplitID() *SplitID { - return &SplitID{ - uuid: uuid.New(), - } -} - -// NewSplitIDFromV2 returns parsed UUID from bytes. -// If v is invalid UUIDv4 byte sequence, then function returns nil. -// -// Nil converts to nil. -func NewSplitIDFromV2(v []byte) *SplitID { - if v == nil { - return nil - } - - id := uuid.New() - - err := id.UnmarshalBinary(v) - if err != nil { - return nil - } - - return &SplitID{ - uuid: id, - } -} - -// Parse converts UUIDv4 string representation into SplitID. -func (id *SplitID) Parse(s string) (err error) { - id.uuid, err = uuid.Parse(s) - if err != nil { - return err - } - - return nil -} - -// String returns UUIDv4 string representation of SplitID. -func (id *SplitID) String() string { - if id == nil { - return "" - } - - return id.uuid.String() -} - -// SetUUID sets pre created UUID structure as SplitID. -func (id *SplitID) SetUUID(v uuid.UUID) { - if id != nil { - id.uuid = v - } -} - -// ToV2 converts SplitID to a representation of SplitID in neofs-api v2. -// -// Nil SplitID converts to nil. -func (id *SplitID) ToV2() []byte { - if id == nil { - return nil - } - - data, _ := id.uuid.MarshalBinary() // err is always nil - - return data -} diff --git a/pkg/object/splitid_test.go b/pkg/object/splitid_test.go deleted file mode 100644 index 7371ed3..0000000 --- a/pkg/object/splitid_test.go +++ /dev/null @@ -1,63 +0,0 @@ -package object_test - -import ( - "testing" - - "github.com/google/uuid" - "github.com/nspcc-dev/neofs-api-go/pkg/object" - "github.com/stretchr/testify/require" -) - -func TestSplitID(t *testing.T) { - id := object.NewSplitID() - - t.Run("toV2/fromV2", func(t *testing.T) { - data := id.ToV2() - - newID := object.NewSplitIDFromV2(data) - require.NotNil(t, newID) - - require.Equal(t, id, newID) - }) - - t.Run("string/parse", func(t *testing.T) { - idStr := id.String() - - newID := object.NewSplitID() - require.NoError(t, newID.Parse(idStr)) - - require.Equal(t, id, newID) - }) - - t.Run("set UUID", func(t *testing.T) { - newUUID := uuid.New() - id.SetUUID(newUUID) - - require.Equal(t, newUUID.String(), id.String()) - }) - - t.Run("nil value", func(t *testing.T) { - var newID *object.SplitID - - require.NotPanics(t, func() { - require.Nil(t, newID.ToV2()) - require.Equal(t, "", newID.String()) - }) - }) -} - -func TestSplitID_ToV2(t *testing.T) { - t.Run("nil", func(t *testing.T) { - var x *object.SplitID - - require.Nil(t, x.ToV2()) - }) -} - -func TestNewIDFromV2(t *testing.T) { - t.Run("from nil", func(t *testing.T) { - var x []byte - - require.Nil(t, object.NewSplitIDFromV2(x)) - }) -} diff --git a/pkg/object/splitinfo.go b/pkg/object/splitinfo.go deleted file mode 100644 index 38ae308..0000000 --- a/pkg/object/splitinfo.go +++ /dev/null @@ -1,74 +0,0 @@ -package object - -import ( - "github.com/nspcc-dev/neofs-api-go/v2/object" -) - -type SplitInfo object.SplitInfo - -// NewSplitInfoFromV2 wraps v2 SplitInfo message to SplitInfo. -// -// Nil object.SplitInfo converts to nil. -func NewSplitInfoFromV2(v2 *object.SplitInfo) *SplitInfo { - return (*SplitInfo)(v2) -} - -// NewSplitInfo creates and initializes blank SplitInfo. -// -// Defaults: -// - splitID: nil; -// - lastPart nil; -// - link: nil. -func NewSplitInfo() *SplitInfo { - return NewSplitInfoFromV2(new(object.SplitInfo)) -} - -// ToV2 converts SplitInfo to v2 SplitInfo message. -// -// Nil SplitInfo converts to nil. -func (s *SplitInfo) ToV2() *object.SplitInfo { - return (*object.SplitInfo)(s) -} - -func (s *SplitInfo) SplitID() *SplitID { - return NewSplitIDFromV2( - (*object.SplitInfo)(s).GetSplitID(), - ) -} - -func (s *SplitInfo) SetSplitID(v *SplitID) { - (*object.SplitInfo)(s).SetSplitID(v.ToV2()) -} - -func (s *SplitInfo) LastPart() *ID { - return NewIDFromV2( - (*object.SplitInfo)(s).GetLastPart(), - ) -} - -func (s *SplitInfo) SetLastPart(v *ID) { - (*object.SplitInfo)(s).SetLastPart(v.ToV2()) -} - -func (s *SplitInfo) Link() *ID { - return NewIDFromV2( - (*object.SplitInfo)(s).GetLink(), - ) -} - -func (s *SplitInfo) SetLink(v *ID) { - (*object.SplitInfo)(s).SetLink(v.ToV2()) -} - -func (s *SplitInfo) Marshal(b ...[]byte) ([]byte, error) { - var buf []byte - if len(b) > 0 { - buf = b[0] - } - - return (*object.SplitInfo)(s).StableMarshal(buf) -} - -func (s *SplitInfo) Unmarshal(data []byte) error { - return (*object.SplitInfo)(s).Unmarshal(data) -} diff --git a/pkg/object/splitinfo_test.go b/pkg/object/splitinfo_test.go deleted file mode 100644 index 500f5ba..0000000 --- a/pkg/object/splitinfo_test.go +++ /dev/null @@ -1,88 +0,0 @@ -package object_test - -import ( - "crypto/rand" - "testing" - - "github.com/nspcc-dev/neofs-api-go/pkg/object" - objv2 "github.com/nspcc-dev/neofs-api-go/v2/object" - "github.com/stretchr/testify/require" -) - -func TestSplitInfo(t *testing.T) { - s := object.NewSplitInfo() - splitID := object.NewSplitID() - lastPart := generateID() - link := generateID() - - s.SetSplitID(splitID) - require.Equal(t, splitID, s.SplitID()) - - s.SetLastPart(lastPart) - require.Equal(t, lastPart, s.LastPart()) - - s.SetLink(link) - require.Equal(t, link, s.Link()) - - t.Run("to and from v2", func(t *testing.T) { - v2 := s.ToV2() - newS := object.NewSplitInfoFromV2(v2) - - require.Equal(t, s, newS) - }) - - t.Run("marshal and unmarshal", func(t *testing.T) { - data, err := s.Marshal() - require.NoError(t, err) - - newS := object.NewSplitInfo() - - err = newS.Unmarshal(data) - require.NoError(t, err) - require.Equal(t, s, newS) - }) -} - -func generateID() *object.ID { - var buf [32]byte - _, _ = rand.Read(buf[:]) - - id := object.NewID() - id.SetSHA256(buf) - - return id -} - -func TestNewSplitInfoFromV2(t *testing.T) { - t.Run("from nil", func(t *testing.T) { - var x *objv2.SplitInfo - - require.Nil(t, object.NewSplitInfoFromV2(x)) - }) -} - -func TestSplitInfo_ToV2(t *testing.T) { - t.Run("nil", func(t *testing.T) { - var x *object.SplitInfo - - require.Nil(t, x.ToV2()) - }) -} - -func TestNewSplitInfo(t *testing.T) { - t.Run("default values", func(t *testing.T) { - si := object.NewSplitInfo() - - // check initial values - require.Nil(t, si.SplitID()) - require.Nil(t, si.LastPart()) - require.Nil(t, si.Link()) - - // convert to v2 message - siV2 := si.ToV2() - - require.Nil(t, siV2.GetSplitID()) - require.Nil(t, siV2.GetLastPart()) - require.Nil(t, siV2.GetLink()) - }) -} diff --git a/pkg/object/test/generate.go b/pkg/object/test/generate.go deleted file mode 100644 index bb8d0c2..0000000 --- a/pkg/object/test/generate.go +++ /dev/null @@ -1,141 +0,0 @@ -package objecttest - -import ( - "crypto/sha256" - "math/rand" - - "github.com/google/uuid" - "github.com/nspcc-dev/neofs-api-go/pkg" - cidtest "github.com/nspcc-dev/neofs-api-go/pkg/container/id/test" - "github.com/nspcc-dev/neofs-api-go/pkg/object" - ownertest "github.com/nspcc-dev/neofs-api-go/pkg/owner/test" - sessiontest "github.com/nspcc-dev/neofs-api-go/pkg/session/test" - refstest "github.com/nspcc-dev/neofs-api-go/pkg/test" -) - -// ID returns random object.ID. -func ID() *object.ID { - checksum := [sha256.Size]byte{} - - rand.Read(checksum[:]) - - return IDWithChecksum(checksum) -} - -// IDWithChecksum returns object.ID initialized -// with specified checksum. -func IDWithChecksum(cs [sha256.Size]byte) *object.ID { - id := object.NewID() - id.SetSHA256(cs) - - return id -} - -// Address returns random object.Address. -func Address() *object.Address { - x := object.NewAddress() - - x.SetContainerID(cidtest.Generate()) - x.SetObjectID(ID()) - - return x -} - -// Range returns random object.Range. -func Range() *object.Range { - x := object.NewRange() - - x.SetOffset(1024) - x.SetLength(2048) - - return x -} - -// Attribute returns random object.Attribute. -func Attribute() *object.Attribute { - x := object.NewAttribute() - - x.SetKey("key") - x.SetValue("value") - - return x -} - -// SplitID returns random object.SplitID. -func SplitID() *object.SplitID { - x := object.NewSplitID() - - x.SetUUID(uuid.New()) - - return x -} - -func generateRaw(withParent bool) *object.RawObject { - x := object.NewRaw() - - x.SetID(ID()) - x.SetSessionToken(sessiontest.Generate()) - x.SetPayload([]byte{1, 2, 3}) - x.SetOwnerID(ownertest.Generate()) - x.SetContainerID(cidtest.Generate()) - x.SetType(object.TypeTombstone) - x.SetVersion(pkg.SDKVersion()) - x.SetPayloadSize(111) - x.SetCreationEpoch(222) - x.SetPreviousID(ID()) - x.SetParentID(ID()) - x.SetChildren(ID(), ID()) - x.SetAttributes(Attribute(), Attribute()) - x.SetSplitID(SplitID()) - x.SetPayloadChecksum(refstest.Checksum()) - x.SetPayloadHomomorphicHash(refstest.Checksum()) - x.SetSignature(refstest.Signature()) - - if withParent { - x.SetParent(generateRaw(false).Object()) - } - - return x -} - -// Raw returns random object.RawObject. -func Raw() *object.RawObject { - return generateRaw(true) -} - -// Object returns random object.Object. -func Object() *object.Object { - return Raw().Object() -} - -// Tombstone returns random object.Tombstone. -func Tombstone() *object.Tombstone { - x := object.NewTombstone() - - x.SetSplitID(SplitID()) - x.SetExpirationEpoch(13) - x.SetMembers([]*object.ID{ID(), ID()}) - - return x -} - -// SplitInfo returns random object.SplitInfo. -func SplitInfo() *object.SplitInfo { - x := object.NewSplitInfo() - - x.SetSplitID(SplitID()) - x.SetLink(ID()) - x.SetLastPart(ID()) - - return x -} - -// SearchFilters returns random object.SearchFilters. -func SearchFilters() object.SearchFilters { - x := object.NewSearchFilters() - - x.AddObjectIDFilter(object.MatchStringEqual, ID()) - x.AddObjectContainerIDFilter(object.MatchStringNotEqual, cidtest.Generate()) - - return x -} diff --git a/pkg/object/tombstone.go b/pkg/object/tombstone.go deleted file mode 100644 index 2d8ca65..0000000 --- a/pkg/object/tombstone.go +++ /dev/null @@ -1,132 +0,0 @@ -package object - -import ( - "github.com/nspcc-dev/neofs-api-go/v2/refs" - "github.com/nspcc-dev/neofs-api-go/v2/tombstone" -) - -// Tombstone represents v2-compatible tombstone structure. -type Tombstone tombstone.Tombstone - -// NewTombstoneFromV2 wraps v2 Tombstone message to Tombstone. -// -// Nil tombstone.Tombstone converts to nil. -func NewTombstoneFromV2(tV2 *tombstone.Tombstone) *Tombstone { - return (*Tombstone)(tV2) -} - -// NewTombstone creates and initializes blank Tombstone. -// -// Defaults: -// - exp: 0; -// - splitID: nil; -// - members: nil. -func NewTombstone() *Tombstone { - return NewTombstoneFromV2(new(tombstone.Tombstone)) -} - -// ToV2 converts Tombstone to v2 Tombstone message. -// -// Nil Tombstone converts to nil. -func (t *Tombstone) ToV2() *tombstone.Tombstone { - return (*tombstone.Tombstone)(t) -} - -// ExpirationEpoch return number of tombstone expiration epoch. -func (t *Tombstone) ExpirationEpoch() uint64 { - return (*tombstone.Tombstone)(t). - GetExpirationEpoch() -} - -// SetExpirationEpoch sets number of tombstone expiration epoch. -func (t *Tombstone) SetExpirationEpoch(v uint64) { - (*tombstone.Tombstone)(t). - SetExpirationEpoch(v) -} - -// SplitID returns identifier of object split hierarchy. -func (t *Tombstone) SplitID() *SplitID { - return NewSplitIDFromV2( - (*tombstone.Tombstone)(t). - GetSplitID(), - ) -} - -// SetSplitID sets identifier of object split hierarchy. -func (t *Tombstone) SetSplitID(v *SplitID) { - (*tombstone.Tombstone)(t). - SetSplitID(v.ToV2()) -} - -// Members returns list of objects to be deleted. -func (t *Tombstone) Members() []*ID { - msV2 := (*tombstone.Tombstone)(t). - GetMembers() - - if msV2 == nil { - return nil - } - - ms := make([]*ID, 0, len(msV2)) - - for i := range msV2 { - ms = append(ms, NewIDFromV2(msV2[i])) - } - - return ms -} - -// SetMembers sets list of objects to be deleted. -func (t *Tombstone) SetMembers(v []*ID) { - var ms []*refs.ObjectID - - if v != nil { - ms = (*tombstone.Tombstone)(t). - GetMembers() - - if ln := len(v); cap(ms) >= ln { - ms = ms[:0] - } else { - ms = make([]*refs.ObjectID, 0, ln) - } - - for i := range v { - ms = append(ms, v[i].ToV2()) - } - } - - (*tombstone.Tombstone)(t). - SetMembers(ms) -} - -// Marshal marshals Tombstone into a protobuf binary form. -// -// Buffer is allocated when the argument is empty. -// Otherwise, the first buffer is used. -func (t *Tombstone) Marshal(b ...[]byte) ([]byte, error) { - var buf []byte - if len(b) > 0 { - buf = b[0] - } - - return (*tombstone.Tombstone)(t). - StableMarshal(buf) -} - -// Unmarshal unmarshals protobuf binary representation of Tombstone. -func (t *Tombstone) Unmarshal(data []byte) error { - return (*tombstone.Tombstone)(t). - Unmarshal(data) -} - -// MarshalJSON encodes Tombstone to protobuf JSON format. -func (t *Tombstone) MarshalJSON() ([]byte, error) { - return (*tombstone.Tombstone)(t). - MarshalJSON() -} - -// UnmarshalJSON decodes Tombstone from protobuf JSON format. -func (t *Tombstone) UnmarshalJSON(data []byte) error { - return (*tombstone.Tombstone)(t). - UnmarshalJSON(data) -} diff --git a/pkg/object/tombstone_test.go b/pkg/object/tombstone_test.go deleted file mode 100644 index 340fa2a..0000000 --- a/pkg/object/tombstone_test.go +++ /dev/null @@ -1,92 +0,0 @@ -package object - -import ( - "crypto/rand" - "crypto/sha256" - "testing" - - "github.com/nspcc-dev/neofs-api-go/v2/tombstone" - "github.com/stretchr/testify/require" -) - -func generateIDList(sz int) []*ID { - res := make([]*ID, sz) - cs := [sha256.Size]byte{} - - for i := 0; i < sz; i++ { - res[i] = NewID() - rand.Read(cs[:]) - res[i].SetSHA256(cs) - } - - return res -} - -func TestTombstone(t *testing.T) { - ts := NewTombstone() - - exp := uint64(13) - ts.SetExpirationEpoch(exp) - require.Equal(t, exp, ts.ExpirationEpoch()) - - splitID := NewSplitID() - ts.SetSplitID(splitID) - require.Equal(t, splitID, ts.SplitID()) - - members := generateIDList(3) - ts.SetMembers(members) - require.Equal(t, members, ts.Members()) -} - -func TestTombstoneEncoding(t *testing.T) { - ts := NewTombstone() - ts.SetExpirationEpoch(13) - ts.SetSplitID(NewSplitID()) - ts.SetMembers(generateIDList(5)) - - t.Run("binary", func(t *testing.T) { - data, err := ts.Marshal() - require.NoError(t, err) - - ts2 := NewTombstone() - require.NoError(t, ts2.Unmarshal(data)) - - require.Equal(t, ts, ts2) - }) - - t.Run("json", func(t *testing.T) { - data, err := ts.MarshalJSON() - require.NoError(t, err) - - ts2 := NewTombstone() - require.NoError(t, ts2.UnmarshalJSON(data)) - - require.Equal(t, ts, ts2) - }) -} - -func TestNewTombstoneFromV2(t *testing.T) { - t.Run("from nil", func(t *testing.T) { - var x *tombstone.Tombstone - - require.Nil(t, NewTombstoneFromV2(x)) - }) -} - -func TestNewTombstone(t *testing.T) { - t.Run("default values", func(t *testing.T) { - ts := NewTombstone() - - // check initial values - require.Nil(t, ts.SplitID()) - require.Nil(t, ts.Members()) - require.Zero(t, ts.ExpirationEpoch()) - - // convert to v2 message - tsV2 := ts.ToV2() - - require.Nil(t, tsV2.GetSplitID()) - require.Nil(t, tsV2.GetMembers()) - require.Zero(t, tsV2.GetExpirationEpoch()) - }) -} diff --git a/pkg/object/type.go b/pkg/object/type.go deleted file mode 100644 index 82d7c00..0000000 --- a/pkg/object/type.go +++ /dev/null @@ -1,69 +0,0 @@ -package object - -import ( - "github.com/nspcc-dev/neofs-api-go/v2/object" -) - -type Type uint8 - -const ( - TypeRegular Type = iota - TypeTombstone - TypeStorageGroup -) - -func (t Type) ToV2() object.Type { - switch t { - case TypeTombstone: - return object.TypeTombstone - case TypeStorageGroup: - return object.TypeStorageGroup - default: - return object.TypeRegular - } -} - -func TypeFromV2(t object.Type) Type { - switch t { - case object.TypeTombstone: - return TypeTombstone - case object.TypeStorageGroup: - return TypeStorageGroup - default: - return TypeRegular - } -} - -// String returns string representation of Type. -// -// String mapping: -// * TypeTombstone: TOMBSTONE; -// * TypeStorageGroup: STORAGE_GROUP; -// * TypeRegular, default: REGULAR. -func (t Type) String() string { - return t.ToV2().String() -} - -// FromString parses Type from a string representation. -// It is a reverse action to String(). -// -// Returns true if s was parsed successfully. -func (t *Type) FromString(s string) bool { - var g object.Type - - ok := g.FromString(s) - - if ok { - *t = TypeFromV2(g) - } - - return ok -} - -// TypeFromString parses Type from its string representation. -// -// Deprecated: use FromString method. -func TypeFromString(s string) (t Type) { - t.FromString(s) - return -} diff --git a/pkg/object/type_test.go b/pkg/object/type_test.go deleted file mode 100644 index cb8a268..0000000 --- a/pkg/object/type_test.go +++ /dev/null @@ -1,79 +0,0 @@ -package object_test - -import ( - "testing" - - "github.com/nspcc-dev/neofs-api-go/pkg/object" - v2object "github.com/nspcc-dev/neofs-api-go/v2/object" - "github.com/stretchr/testify/require" -) - -func TestType_ToV2(t *testing.T) { - typs := []struct { - t object.Type - t2 v2object.Type - }{ - { - t: object.TypeRegular, - t2: v2object.TypeRegular, - }, - { - t: object.TypeTombstone, - t2: v2object.TypeTombstone, - }, - { - t: object.TypeStorageGroup, - t2: v2object.TypeStorageGroup, - }, - } - - for _, item := range typs { - t2 := item.t.ToV2() - - require.Equal(t, item.t2, t2) - - require.Equal(t, item.t, object.TypeFromV2(item.t2)) - } -} - -func TestType_String(t *testing.T) { - toPtr := func(v object.Type) *object.Type { - return &v - } - - testEnumStrings(t, new(object.Type), []enumStringItem{ - {val: toPtr(object.TypeTombstone), str: "TOMBSTONE"}, - {val: toPtr(object.TypeStorageGroup), str: "STORAGE_GROUP"}, - {val: toPtr(object.TypeRegular), str: "REGULAR"}, - }) -} - -type enumIface interface { - FromString(string) bool - String() string -} - -type enumStringItem struct { - val enumIface - str string -} - -func testEnumStrings(t *testing.T, e enumIface, items []enumStringItem) { - for _, item := range items { - require.Equal(t, item.str, item.val.String()) - - s := item.val.String() - - require.True(t, e.FromString(s), s) - - require.EqualValues(t, item.val, e, item.val) - } - - // incorrect strings - for _, str := range []string{ - "some string", - "undefined", - } { - require.False(t, e.FromString(str)) - } -} diff --git a/pkg/object/wellknown_attributes.go b/pkg/object/wellknown_attributes.go deleted file mode 100644 index 9e1793e..0000000 --- a/pkg/object/wellknown_attributes.go +++ /dev/null @@ -1,19 +0,0 @@ -package object - -const ( - // AttributeName is an attribute key that is commonly used to denote - // human-friendly name. - AttributeName = "Name" - - // AttributeFileName is an attribute key that is commonly used to denote - // file name to be associated with the object on saving. - AttributeFileName = "FileName" - - // AttributeTimestamp is an attribute key that is commonly used to denote - // user-defined local time of object creation in Unix Timestamp format. - AttributeTimestamp = "Timestamp" - - // AttributeTimestamp is an attribute key that is commonly used to denote - // MIME Content Type of object's payload. - AttributeContentType = "Content-Type" -) diff --git a/pkg/owner/id.go b/pkg/owner/id.go deleted file mode 100644 index 3ba5300..0000000 --- a/pkg/owner/id.go +++ /dev/null @@ -1,122 +0,0 @@ -package owner - -import ( - "bytes" - "errors" - "fmt" - - "github.com/mr-tron/base58" - "github.com/nspcc-dev/neo-go/pkg/encoding/address" - "github.com/nspcc-dev/neofs-api-go/v2/refs" -) - -// ID represents v2-compatible owner identifier. -type ID refs.OwnerID - -var errInvalidIDString = errors.New("incorrect format of the string owner ID") - -// NewIDFromV2 wraps v2 OwnerID message to ID. -// -// Nil refs.OwnerID converts to nil. -func NewIDFromV2(idV2 *refs.OwnerID) *ID { - return (*ID)(idV2) -} - -// NewID creates and initializes blank ID. -// -// Works similar as NewIDFromV2(new(OwnerID)). -// -// Defaults: -// - value: nil. -func NewID() *ID { - return NewIDFromV2(new(refs.OwnerID)) -} - -// SetNeo3Wallet sets owner identifier value to NEO3 wallet address. -func (id *ID) SetNeo3Wallet(v *NEO3Wallet) { - (*refs.OwnerID)(id).SetValue(v.Bytes()) -} - -// ToV2 returns the v2 owner ID message. -// -// Nil ID converts to nil. -func (id *ID) ToV2() *refs.OwnerID { - return (*refs.OwnerID)(id) -} - -func (id *ID) String() string { - return base58.Encode((*refs.OwnerID)(id).GetValue()) -} - -// Equal defines a comparison relation on ID's. -// -// ID's are equal if they have the same binary representation. -func (id *ID) Equal(id2 *ID) bool { - return bytes.Equal( - (*refs.ObjectID)(id).GetValue(), - (*refs.ObjectID)(id2).GetValue(), - ) -} - -func ScriptHashBE(id fmt.Stringer) ([]byte, error) { - addr, err := address.StringToUint160(id.String()) - if err != nil { - return nil, err - } - - return addr.BytesBE(), nil -} - -// NewIDFromNeo3Wallet creates new owner identity from 25-byte neo wallet. -func NewIDFromNeo3Wallet(v *NEO3Wallet) *ID { - id := NewID() - id.SetNeo3Wallet(v) - - return id -} - -// Parse converts base58 string representation into ID. -func (id *ID) Parse(s string) error { - data, err := base58.Decode(s) - if err != nil { - return fmt.Errorf("could not parse owner.ID from string: %w", err) - } else if len(data) != NEO3WalletSize { - return errInvalidIDString - } - - (*refs.OwnerID)(id).SetValue(data) - - return nil -} - -// Marshal marshals ID into a protobuf binary form. -// -// Buffer is allocated when the argument is empty. -// Otherwise, the first buffer is used. -func (id *ID) Marshal(b ...[]byte) ([]byte, error) { - var buf []byte - if len(b) > 0 { - buf = b[0] - } - - return (*refs.OwnerID)(id). - StableMarshal(buf) -} - -// Unmarshal unmarshals protobuf binary representation of ID. -func (id *ID) Unmarshal(data []byte) error { - return (*refs.OwnerID)(id). - Unmarshal(data) -} - -// MarshalJSON encodes ID to protobuf JSON format. -func (id *ID) MarshalJSON() ([]byte, error) { - return (*refs.OwnerID)(id). - MarshalJSON() -} - -// UnmarshalJSON decodes ID from protobuf JSON format. -func (id *ID) UnmarshalJSON(data []byte) error { - return (*refs.OwnerID)(id). - UnmarshalJSON(data) -} diff --git a/pkg/owner/id_test.go b/pkg/owner/id_test.go deleted file mode 100644 index f5cff06..0000000 --- a/pkg/owner/id_test.go +++ /dev/null @@ -1,137 +0,0 @@ -package owner_test - -import ( - "strconv" - "testing" - - "github.com/mr-tron/base58" - . "github.com/nspcc-dev/neofs-api-go/pkg/owner" - ownertest "github.com/nspcc-dev/neofs-api-go/pkg/owner/test" - "github.com/nspcc-dev/neofs-api-go/v2/refs" - "github.com/nspcc-dev/neofs-crypto/test" - "github.com/stretchr/testify/require" -) - -func TestIDV2(t *testing.T) { - id := ownertest.Generate() - - idV2 := id.ToV2() - - require.Equal(t, id, NewIDFromV2(idV2)) -} - -func TestNewIDFromNeo3Wallet(t *testing.T) { - wallet, err := NEO3WalletFromPublicKey(&test.DecodeKey(1).PublicKey) - require.NoError(t, err) - - id := NewIDFromNeo3Wallet(wallet) - require.Equal(t, id.ToV2().GetValue(), wallet.Bytes()) -} - -func TestID_Parse(t *testing.T) { - t.Run("should parse successful", func(t *testing.T) { - for i := 0; i < 10; i++ { - j := i - t.Run(strconv.Itoa(j), func(t *testing.T) { - wallet, err := NEO3WalletFromPublicKey(&test.DecodeKey(j).PublicKey) - require.NoError(t, err) - - eid := NewIDFromNeo3Wallet(wallet) - aid := NewID() - - require.NoError(t, aid.Parse(eid.String())) - require.Equal(t, eid, aid) - }) - } - }) - - t.Run("should failure on parse", func(t *testing.T) { - for i := 0; i < 10; i++ { - j := i - t.Run(strconv.Itoa(j), func(t *testing.T) { - cs := []byte{1, 2, 3, 4, 5, byte(j)} - str := base58.Encode(cs) - cid := NewID() - - require.Error(t, cid.Parse(str)) - }) - } - }) -} - -func TestIDEncoding(t *testing.T) { - id := ownertest.Generate() - - t.Run("binary", func(t *testing.T) { - data, err := id.Marshal() - require.NoError(t, err) - - id2 := NewID() - require.NoError(t, id2.Unmarshal(data)) - - require.Equal(t, id, id2) - }) - - t.Run("json", func(t *testing.T) { - data, err := id.MarshalJSON() - require.NoError(t, err) - - a2 := NewID() - require.NoError(t, a2.UnmarshalJSON(data)) - - require.Equal(t, id, a2) - }) -} - -func TestID_Equal(t *testing.T) { - var ( - data1 = []byte{1, 2, 3} - data2 = data1 - data3 = append(data1, 255) - ) - - id1 := ownertest.GenerateFromBytes(data1) - - require.True(t, id1.Equal( - ownertest.GenerateFromBytes(data2), - )) - - require.False(t, id1.Equal( - ownertest.GenerateFromBytes(data3), - )) -} - -func TestNewIDFromV2(t *testing.T) { - t.Run("from nil", func(t *testing.T) { - var x *refs.OwnerID - - require.Nil(t, NewIDFromV2(x)) - }) -} - -func TestID_ToV2(t *testing.T) { - t.Run("nil", func(t *testing.T) { - var x *ID - - require.Nil(t, x.ToV2()) - }) -} - -func TestID_String(t *testing.T) { - t.Run("nil", func(t *testing.T) { - id := NewID() - - require.Empty(t, id.String()) - }) -} - -func TestNewID(t *testing.T) { - t.Run("default values", func(t *testing.T) { - id := NewID() - - // convert to v2 message - idV2 := id.ToV2() - - require.Nil(t, idV2.GetValue()) - }) -} diff --git a/pkg/owner/test/id.go b/pkg/owner/test/id.go deleted file mode 100644 index f542cf1..0000000 --- a/pkg/owner/test/id.go +++ /dev/null @@ -1,27 +0,0 @@ -package ownertest - -import ( - "math/rand" - - "github.com/nspcc-dev/neofs-api-go/pkg/owner" - "github.com/nspcc-dev/neofs-api-go/v2/refs" -) - -// Generate returns owner.ID calculated -// from a random owner.NEO3Wallet. -func Generate() *owner.ID { - data := make([]byte, owner.NEO3WalletSize) - - rand.Read(data) - - return GenerateFromBytes(data) -} - -// GenerateFromBytes returns owner.ID generated -// from a passed byte slice. -func GenerateFromBytes(val []byte) *owner.ID { - idV2 := new(refs.OwnerID) - idV2.SetValue(val) - - return owner.NewIDFromV2(idV2) -} diff --git a/pkg/owner/wallet.go b/pkg/owner/wallet.go deleted file mode 100644 index 83d3b47..0000000 --- a/pkg/owner/wallet.go +++ /dev/null @@ -1,57 +0,0 @@ -package owner - -import ( - "crypto/ecdsa" - "fmt" - - "github.com/mr-tron/base58" - "github.com/nspcc-dev/neo-go/pkg/crypto/keys" - crypto "github.com/nspcc-dev/neofs-crypto" -) - -// NEO3Wallet represents NEO3 wallet address. -type NEO3Wallet [NEO3WalletSize]byte - -// NEO3WalletSize contains size of neo3 wallet. -const NEO3WalletSize = 25 - -// NEO3WalletFromPublicKey converts public key to NEO3 wallet address. -func NEO3WalletFromPublicKey(key *ecdsa.PublicKey) (*NEO3Wallet, error) { - if key == nil { - return nil, crypto.ErrEmptyPublicKey - } - - neoPublicKey := keys.PublicKey{ - Curve: key.Curve, - X: key.X, - Y: key.Y, - } - - d, err := base58.Decode(neoPublicKey.Address()) - if err != nil { - return nil, fmt.Errorf("can't decode neo3 address from key: %w", err) - } - - w := new(NEO3Wallet) - - copy(w.Bytes(), d) - - return w, nil -} - -func (w *NEO3Wallet) String() string { - if w != nil { - return base58.Encode(w[:]) - } - - return "" -} - -// Bytes returns slice of NEO3 wallet address bytes. -func (w *NEO3Wallet) Bytes() []byte { - if w != nil { - return w[:] - } - - return nil -} diff --git a/pkg/reputation/peer.go b/pkg/reputation/peer.go deleted file mode 100644 index cdbfce1..0000000 --- a/pkg/reputation/peer.go +++ /dev/null @@ -1,100 +0,0 @@ -package reputation - -import ( - "bytes" - - "github.com/mr-tron/base58" - "github.com/nspcc-dev/neofs-api-go/v2/reputation" - crypto "github.com/nspcc-dev/neofs-crypto" -) - -// PeerID represents peer ID compatible with NeoFS API v2. -type PeerID reputation.PeerID - -// NewPeerID creates and returns blank PeerID. -// -// Defaults: -// - publicKey: nil. -func NewPeerID() *PeerID { - return PeerIDFromV2(new(reputation.PeerID)) -} - -// PeerIDFromV2 converts NeoFS API v2 reputation.PeerID message to PeerID. -// -// Nil reputation.PeerID converts to nil. -func PeerIDFromV2(id *reputation.PeerID) *PeerID { - return (*PeerID)(id) -} - -// SetPublicKey sets peer ID as a compressed public key. -func (x *PeerID) SetPublicKey(v [crypto.PublicKeyCompressedSize]byte) { - (*reputation.PeerID)(x). - SetPublicKey(v[:]) -} - -// ToV2 converts PeerID to NeoFS API v2 reputation.PeerID message. -// -// Nil PeerID converts to nil. -func (x *PeerID) ToV2() *reputation.PeerID { - return (*reputation.PeerID)(x) -} - -// Equal returns true if identifiers are identical. -func (x *PeerID) Equal(x2 *PeerID) bool { - return bytes.Equal( - (*reputation.PeerID)(x).GetPublicKey(), - (*reputation.PeerID)(x2).GetPublicKey(), - ) -} - -// Parse parses PeerID from base58 string. -func (x *PeerID) Parse(s string) error { - data, err := base58.Decode(s) - if err != nil { - return err - } - - (*reputation.PeerID)(x).SetPublicKey(data) - - return nil -} - -// String returns base58 string representation of PeerID. -func (x *PeerID) String() string { - return base58.Encode( - (*reputation.PeerID)(x). - GetPublicKey(), - ) -} - -// Marshal marshals PeerID into a protobuf binary form. -// -// Buffer is allocated when the argument is empty. -// Otherwise, the first buffer is used. -func (x *PeerID) Marshal(b ...[]byte) ([]byte, error) { - var buf []byte - if len(b) > 0 { - buf = b[0] - } - - return (*reputation.PeerID)(x). - StableMarshal(buf) -} - -// Unmarshal unmarshals protobuf binary representation of PeerID. -func (x *PeerID) Unmarshal(data []byte) error { - return (*reputation.PeerID)(x). - Unmarshal(data) -} - -// MarshalJSON encodes PeerID to protobuf JSON format. -func (x *PeerID) MarshalJSON() ([]byte, error) { - return (*reputation.PeerID)(x). - MarshalJSON() -} - -// UnmarshalJSON decodes PeerID from protobuf JSON format. -func (x *PeerID) UnmarshalJSON(data []byte) error { - return (*reputation.PeerID)(x). - UnmarshalJSON(data) -} diff --git a/pkg/reputation/peer_test.go b/pkg/reputation/peer_test.go deleted file mode 100644 index d3463a5..0000000 --- a/pkg/reputation/peer_test.go +++ /dev/null @@ -1,88 +0,0 @@ -package reputation_test - -import ( - "testing" - - "github.com/nspcc-dev/neofs-api-go/pkg/reputation" - reputationtest "github.com/nspcc-dev/neofs-api-go/pkg/reputation/test" - reputationV2 "github.com/nspcc-dev/neofs-api-go/v2/reputation" - "github.com/stretchr/testify/require" -) - -func TestPeerID_ToV2(t *testing.T) { - t.Run("nil", func(t *testing.T) { - var x *reputation.PeerID - - require.Nil(t, x.ToV2()) - }) - - t.Run("nil", func(t *testing.T) { - peerID := reputationtest.GeneratePeerID() - - require.Equal(t, peerID, reputation.PeerIDFromV2(peerID.ToV2())) - }) -} - -func TestPeerID_String(t *testing.T) { - t.Run("Parse/String", func(t *testing.T) { - id := reputationtest.GeneratePeerID() - - strID := id.String() - - id2 := reputation.NewPeerID() - - err := id2.Parse(strID) - require.NoError(t, err) - - require.Equal(t, id, id2) - }) - - t.Run("nil", func(t *testing.T) { - id := reputation.NewPeerID() - - require.Empty(t, id.String()) - }) -} - -func TestPeerIDEncoding(t *testing.T) { - id := reputationtest.GeneratePeerID() - - t.Run("binary", func(t *testing.T) { - data, err := id.Marshal() - require.NoError(t, err) - - id2 := reputation.NewPeerID() - require.NoError(t, id2.Unmarshal(data)) - - require.Equal(t, id, id2) - }) - - t.Run("json", func(t *testing.T) { - data, err := id.MarshalJSON() - require.NoError(t, err) - - id2 := reputation.NewPeerID() - require.NoError(t, id2.UnmarshalJSON(data)) - - require.Equal(t, id, id2) - }) -} - -func TestPeerIDFromV2(t *testing.T) { - t.Run("from nil", func(t *testing.T) { - var x *reputationV2.PeerID - - require.Nil(t, reputation.PeerIDFromV2(x)) - }) -} - -func TestNewPeerID(t *testing.T) { - t.Run("default values", func(t *testing.T) { - id := reputation.NewPeerID() - - // convert to v2 message - idV2 := id.ToV2() - - require.Nil(t, idV2.GetPublicKey()) - }) -} diff --git a/pkg/reputation/test/generate.go b/pkg/reputation/test/generate.go deleted file mode 100644 index c103800..0000000 --- a/pkg/reputation/test/generate.go +++ /dev/null @@ -1,53 +0,0 @@ -package reputationtest - -import ( - "testing" - - "github.com/nspcc-dev/neofs-api-go/pkg/reputation" - crypto "github.com/nspcc-dev/neofs-crypto" - "github.com/nspcc-dev/neofs-crypto/test" - "github.com/stretchr/testify/require" -) - -func GeneratePeerID() *reputation.PeerID { - v := reputation.NewPeerID() - - key := [crypto.PublicKeyCompressedSize]byte{} - copy(key[:], crypto.MarshalPublicKey(&test.DecodeKey(-1).PublicKey)) - - v.SetPublicKey(key) - - return v -} - -func GenerateTrust() *reputation.Trust { - v := reputation.NewTrust() - v.SetPeer(GeneratePeerID()) - v.SetValue(1.5) - - return v -} - -func GeneratePeerToPeerTrust() *reputation.PeerToPeerTrust { - v := reputation.NewPeerToPeerTrust() - v.SetTrustingPeer(GeneratePeerID()) - v.SetTrust(GenerateTrust()) - - return v -} - -func GenerateGlobalTrust() *reputation.GlobalTrust { - v := reputation.NewGlobalTrust() - v.SetManager(GeneratePeerID()) - v.SetTrust(GenerateTrust()) - - return v -} - -func GenerateSignedGlobalTrust(t testing.TB) *reputation.GlobalTrust { - gt := GenerateGlobalTrust() - - require.NoError(t, gt.Sign(test.DecodeKey(0))) - - return gt -} diff --git a/pkg/reputation/trust.go b/pkg/reputation/trust.go deleted file mode 100644 index e3dd5e5..0000000 --- a/pkg/reputation/trust.go +++ /dev/null @@ -1,357 +0,0 @@ -package reputation - -import ( - "crypto/ecdsa" - - "github.com/nspcc-dev/neofs-api-go/pkg" - "github.com/nspcc-dev/neofs-api-go/util/signature" - "github.com/nspcc-dev/neofs-api-go/v2/refs" - "github.com/nspcc-dev/neofs-api-go/v2/reputation" - signatureV2 "github.com/nspcc-dev/neofs-api-go/v2/signature" -) - -// Trust represents peer's trust compatible with NeoFS API v2. -type Trust reputation.Trust - -// NewTrust creates and returns blank Trust. -// -// Defaults: -// - value: 0; -// - PeerID: nil. -func NewTrust() *Trust { - return TrustFromV2(new(reputation.Trust)) -} - -// TrustFromV2 converts NeoFS API v2 -// reputation.Trust message structure to Trust. -// -// Nil reputation.Trust converts to nil. -func TrustFromV2(t *reputation.Trust) *Trust { - return (*Trust)(t) -} - -// ToV2 converts Trust to NeoFS API v2 -// reputation.Trust message structure. -// -// Nil Trust converts to nil. -func (x *Trust) ToV2() *reputation.Trust { - return (*reputation.Trust)(x) -} - -// TrustsToV2 converts slice of Trust's to slice of -// NeoFS API v2 reputation.Trust message structures. -func TrustsToV2(xs []*Trust) (res []*reputation.Trust) { - if xs != nil { - res = make([]*reputation.Trust, 0, len(xs)) - - for i := range xs { - res = append(res, xs[i].ToV2()) - } - } - - return -} - -// SetPeer sets trusted peer ID. -func (x *Trust) SetPeer(id *PeerID) { - (*reputation.Trust)(x). - SetPeer(id.ToV2()) -} - -// Peer returns trusted peer ID. -func (x *Trust) Peer() *PeerID { - return PeerIDFromV2( - (*reputation.Trust)(x).GetPeer(), - ) -} - -// SetValue sets trust value. -func (x *Trust) SetValue(val float64) { - (*reputation.Trust)(x). - SetValue(val) -} - -// Value returns trust value. -func (x *Trust) Value() float64 { - return (*reputation.Trust)(x). - GetValue() -} - -// Marshal marshals Trust into a protobuf binary form. -// -// Buffer is allocated when the argument is empty. -// Otherwise, the first buffer is used. -func (x *Trust) Marshal(b ...[]byte) ([]byte, error) { - var buf []byte - if len(b) > 0 { - buf = b[0] - } - - return (*reputation.Trust)(x).StableMarshal(buf) -} - -// Unmarshal unmarshals protobuf binary representation of Trust. -func (x *Trust) Unmarshal(data []byte) error { - return (*reputation.Trust)(x). - Unmarshal(data) -} - -// MarshalJSON encodes Trust to protobuf JSON format. -func (x *Trust) MarshalJSON() ([]byte, error) { - return (*reputation.Trust)(x). - MarshalJSON() -} - -// UnmarshalJSON decodes Trust from protobuf JSON format. -func (x *Trust) UnmarshalJSON(data []byte) error { - return (*reputation.Trust)(x). - UnmarshalJSON(data) -} - -// PeerToPeerTrust represents directed peer-to-peer trust -// compatible with NeoFS API v2. -type PeerToPeerTrust reputation.PeerToPeerTrust - -// NewPeerToPeerTrust creates and returns blank PeerToPeerTrust. -// -// Defaults: -// - trusting: nil; -// - trust: nil. -func NewPeerToPeerTrust() *PeerToPeerTrust { - return PeerToPeerTrustFromV2(new(reputation.PeerToPeerTrust)) -} - -// PeerToPeerTrustFromV2 converts NeoFS API v2 -// reputation.PeerToPeerTrust message structure to PeerToPeerTrust. -// -// Nil reputation.PeerToPeerTrust converts to nil. -func PeerToPeerTrustFromV2(t *reputation.PeerToPeerTrust) *PeerToPeerTrust { - return (*PeerToPeerTrust)(t) -} - -// ToV2 converts PeerToPeerTrust to NeoFS API v2 -// reputation.PeerToPeerTrust message structure. -// -// Nil PeerToPeerTrust converts to nil. -func (x *PeerToPeerTrust) ToV2() *reputation.PeerToPeerTrust { - return (*reputation.PeerToPeerTrust)(x) -} - -// SetTrustingPeer sets trusting peer ID. -func (x *PeerToPeerTrust) SetTrustingPeer(id *PeerID) { - (*reputation.PeerToPeerTrust)(x). - SetTrustingPeer(id.ToV2()) -} - -// TrustingPeer returns trusting peer ID. -func (x *PeerToPeerTrust) TrustingPeer() *PeerID { - return PeerIDFromV2( - (*reputation.PeerToPeerTrust)(x). - GetTrustingPeer(), - ) -} - -// SetTrust sets trust value of the trusting peer to the trusted one. -func (x *PeerToPeerTrust) SetTrust(t *Trust) { - (*reputation.PeerToPeerTrust)(x). - SetTrust(t.ToV2()) -} - -// Trust returns trust value of the trusting peer to the trusted one. -func (x *PeerToPeerTrust) Trust() *Trust { - return TrustFromV2( - (*reputation.PeerToPeerTrust)(x). - GetTrust(), - ) -} - -// Marshal marshals PeerToPeerTrust into a protobuf binary form. -// -// Buffer is allocated when the argument is empty. -// Otherwise, the first buffer is used. -func (x *PeerToPeerTrust) Marshal(b ...[]byte) ([]byte, error) { - var buf []byte - if len(b) > 0 { - buf = b[0] - } - - return (*reputation.PeerToPeerTrust)(x).StableMarshal(buf) -} - -// Unmarshal unmarshals protobuf binary representation of PeerToPeerTrust. -func (x *PeerToPeerTrust) Unmarshal(data []byte) error { - return (*reputation.PeerToPeerTrust)(x). - Unmarshal(data) -} - -// MarshalJSON encodes PeerToPeerTrust to protobuf JSON format. -func (x *PeerToPeerTrust) MarshalJSON() ([]byte, error) { - return (*reputation.PeerToPeerTrust)(x). - MarshalJSON() -} - -// UnmarshalJSON decodes PeerToPeerTrust from protobuf JSON format. -func (x *PeerToPeerTrust) UnmarshalJSON(data []byte) error { - return (*reputation.PeerToPeerTrust)(x). - UnmarshalJSON(data) -} - -// GlobalTrust represents peer's global trust compatible with NeoFS API v2. -type GlobalTrust reputation.GlobalTrust - -// NewGlobalTrust creates and returns blank GlobalTrust. -// -// Defaults: -// - version: pkg.SDKVersion(); -// - manager: nil; -// - trust: nil. -func NewGlobalTrust() *GlobalTrust { - gt := GlobalTrustFromV2(new(reputation.GlobalTrust)) - gt.SetVersion(pkg.SDKVersion()) - - return gt -} - -// GlobalTrustFromV2 converts NeoFS API v2 -// reputation.GlobalTrust message structure to GlobalTrust. -// -// Nil reputation.GlobalTrust converts to nil. -func GlobalTrustFromV2(t *reputation.GlobalTrust) *GlobalTrust { - return (*GlobalTrust)(t) -} - -// ToV2 converts GlobalTrust to NeoFS API v2 -// reputation.GlobalTrust message structure. -// -// Nil GlobalTrust converts to nil. -func (x *GlobalTrust) ToV2() *reputation.GlobalTrust { - return (*reputation.GlobalTrust)(x) -} - -// SetVersion sets GlobalTrust's protocol version. -func (x *GlobalTrust) SetVersion(version *pkg.Version) { - (*reputation.GlobalTrust)(x). - SetVersion(version.ToV2()) -} - -// Version returns GlobalTrust's protocol version. -func (x *GlobalTrust) Version() *pkg.Version { - return pkg.NewVersionFromV2( - (*reputation.GlobalTrust)(x). - GetVersion(), - ) -} - -func (x *GlobalTrust) setBodyField(setter func(*reputation.GlobalTrustBody)) { - if x != nil { - v2 := (*reputation.GlobalTrust)(x) - - body := v2.GetBody() - if body == nil { - body = new(reputation.GlobalTrustBody) - v2.SetBody(body) - } - - setter(body) - } -} - -// SetManager sets node manager ID. -func (x *GlobalTrust) SetManager(id *PeerID) { - x.setBodyField(func(body *reputation.GlobalTrustBody) { - body.SetManager(id.ToV2()) - }) -} - -// Manager returns node manager ID. -func (x *GlobalTrust) Manager() *PeerID { - return PeerIDFromV2( - (*reputation.GlobalTrust)(x). - GetBody(). - GetManager(), - ) -} - -// SetTrust sets global trust value. -func (x *GlobalTrust) SetTrust(trust *Trust) { - x.setBodyField(func(body *reputation.GlobalTrustBody) { - body.SetTrust(trust.ToV2()) - }) -} - -// Trust returns global trust value. -func (x *GlobalTrust) Trust() *Trust { - return TrustFromV2( - (*reputation.GlobalTrust)(x). - GetBody(). - GetTrust(), - ) -} - -// Sign signs global trust value with key. -func (x *GlobalTrust) Sign(key *ecdsa.PrivateKey) error { - v2 := (*reputation.GlobalTrust)(x) - - sigV2 := v2.GetSignature() - if sigV2 == nil { - sigV2 = new(refs.Signature) - v2.SetSignature(sigV2) - } - - return signature.SignDataWithHandler( - key, - signatureV2.StableMarshalerWrapper{SM: v2.GetBody()}, - func(key, sig []byte) { - sigV2.SetKey(key) - sigV2.SetSign(sig) - }, - ) -} - -// VerifySignature verifies global trust signature. -func (x *GlobalTrust) VerifySignature() error { - v2 := (*reputation.GlobalTrust)(x) - - sigV2 := v2.GetSignature() - if sigV2 == nil { - sigV2 = new(refs.Signature) - } - - return signature.VerifyDataWithSource( - signatureV2.StableMarshalerWrapper{SM: v2.GetBody()}, - func() ([]byte, []byte) { - return sigV2.GetKey(), sigV2.GetSign() - }, - ) -} - -// Marshal marshals GlobalTrust into a protobuf binary form. -// -// Buffer is allocated when the argument is empty. -// Otherwise, the first buffer is used. -func (x *GlobalTrust) Marshal(b ...[]byte) ([]byte, error) { - var buf []byte - if len(b) > 0 { - buf = b[0] - } - - return (*reputation.GlobalTrust)(x).StableMarshal(buf) -} - -// Unmarshal unmarshals protobuf binary representation of GlobalTrust. -func (x *GlobalTrust) Unmarshal(data []byte) error { - return (*reputation.GlobalTrust)(x). - Unmarshal(data) -} - -// MarshalJSON encodes GlobalTrust to protobuf JSON format. -func (x *GlobalTrust) MarshalJSON() ([]byte, error) { - return (*reputation.GlobalTrust)(x). - MarshalJSON() -} - -// UnmarshalJSON decodes GlobalTrust from protobuf JSON format. -func (x *GlobalTrust) UnmarshalJSON(data []byte) error { - return (*reputation.GlobalTrust)(x). - UnmarshalJSON(data) -} diff --git a/pkg/reputation/trust_test.go b/pkg/reputation/trust_test.go deleted file mode 100644 index 41072e9..0000000 --- a/pkg/reputation/trust_test.go +++ /dev/null @@ -1,250 +0,0 @@ -package reputation_test - -import ( - "testing" - - "github.com/nspcc-dev/neofs-api-go/pkg" - "github.com/nspcc-dev/neofs-api-go/pkg/reputation" - reputationtest "github.com/nspcc-dev/neofs-api-go/pkg/reputation/test" - reputationV2 "github.com/nspcc-dev/neofs-api-go/v2/reputation" - reputationtestV2 "github.com/nspcc-dev/neofs-api-go/v2/reputation/test" - "github.com/stretchr/testify/require" -) - -func TestTrust(t *testing.T) { - trust := reputation.NewTrust() - - id := reputationtest.GeneratePeerID() - trust.SetPeer(id) - require.Equal(t, id, trust.Peer()) - - val := 1.5 - trust.SetValue(val) - require.Equal(t, val, trust.Value()) - - t.Run("binary encoding", func(t *testing.T) { - trust := reputationtest.GenerateTrust() - data, err := trust.Marshal() - require.NoError(t, err) - - trust2 := reputation.NewTrust() - require.NoError(t, trust2.Unmarshal(data)) - require.Equal(t, trust, trust2) - }) - - t.Run("JSON encoding", func(t *testing.T) { - trust := reputationtest.GenerateTrust() - data, err := trust.MarshalJSON() - require.NoError(t, err) - - trust2 := reputation.NewTrust() - require.NoError(t, trust2.UnmarshalJSON(data)) - require.Equal(t, trust, trust2) - }) -} - -func TestPeerToPeerTrust(t *testing.T) { - t.Run("v2", func(t *testing.T) { - p2ptV2 := reputationtestV2.GeneratePeerToPeerTrust(false) - - p2pt := reputation.PeerToPeerTrustFromV2(p2ptV2) - - require.Equal(t, p2ptV2, p2pt.ToV2()) - }) - - t.Run("getters+setters", func(t *testing.T) { - p2pt := reputation.NewPeerToPeerTrust() - - require.Nil(t, p2pt.TrustingPeer()) - require.Nil(t, p2pt.Trust()) - - trusting := reputationtest.GeneratePeerID() - p2pt.SetTrustingPeer(trusting) - require.Equal(t, trusting, p2pt.TrustingPeer()) - - trust := reputationtest.GenerateTrust() - p2pt.SetTrust(trust) - require.Equal(t, trust, p2pt.Trust()) - }) - - t.Run("encoding", func(t *testing.T) { - p2pt := reputationtest.GeneratePeerToPeerTrust() - - t.Run("binary", func(t *testing.T) { - data, err := p2pt.Marshal() - require.NoError(t, err) - - p2pt2 := reputation.NewPeerToPeerTrust() - require.NoError(t, p2pt2.Unmarshal(data)) - require.Equal(t, p2pt, p2pt2) - }) - - t.Run("JSON", func(t *testing.T) { - data, err := p2pt.MarshalJSON() - require.NoError(t, err) - - p2pt2 := reputation.NewPeerToPeerTrust() - require.NoError(t, p2pt2.UnmarshalJSON(data)) - require.Equal(t, p2pt, p2pt2) - }) - }) -} - -func TestGlobalTrust(t *testing.T) { - t.Run("v2", func(t *testing.T) { - gtV2 := reputationtestV2.GenerateGlobalTrust(false) - - gt := reputation.GlobalTrustFromV2(gtV2) - - require.Equal(t, gtV2, gt.ToV2()) - }) - - t.Run("getters+setters", func(t *testing.T) { - gt := reputation.NewGlobalTrust() - - require.Equal(t, pkg.SDKVersion(), gt.Version()) - require.Nil(t, gt.Manager()) - require.Nil(t, gt.Trust()) - - version := pkg.NewVersion() - version.SetMajor(13) - version.SetMinor(31) - gt.SetVersion(version) - require.Equal(t, version, gt.Version()) - - mngr := reputationtest.GeneratePeerID() - gt.SetManager(mngr) - require.Equal(t, mngr, gt.Manager()) - - trust := reputationtest.GenerateTrust() - gt.SetTrust(trust) - require.Equal(t, trust, gt.Trust()) - }) - - t.Run("sign+verify", func(t *testing.T) { - gt := reputationtest.GenerateSignedGlobalTrust(t) - - err := gt.VerifySignature() - require.NoError(t, err) - }) - - t.Run("encoding", func(t *testing.T) { - t.Run("binary", func(t *testing.T) { - gt := reputationtest.GenerateSignedGlobalTrust(t) - - data, err := gt.Marshal() - require.NoError(t, err) - - gt2 := reputation.NewGlobalTrust() - require.NoError(t, gt2.Unmarshal(data)) - require.Equal(t, gt, gt2) - }) - - t.Run("JSON", func(t *testing.T) { - gt := reputationtest.GenerateSignedGlobalTrust(t) - data, err := gt.MarshalJSON() - require.NoError(t, err) - - gt2 := reputation.NewGlobalTrust() - require.NoError(t, gt2.UnmarshalJSON(data)) - require.Equal(t, gt, gt2) - }) - }) -} - -func TestTrustFromV2(t *testing.T) { - t.Run("from nil", func(t *testing.T) { - var x *reputationV2.Trust - - require.Nil(t, reputation.TrustFromV2(x)) - }) -} - -func TestPeerToPeerTrustFromV2(t *testing.T) { - t.Run("from nil", func(t *testing.T) { - var x *reputationV2.PeerToPeerTrust - - require.Nil(t, reputation.PeerToPeerTrustFromV2(x)) - }) -} - -func TestGlobalTrustFromV2(t *testing.T) { - t.Run("from nil", func(t *testing.T) { - var x *reputationV2.GlobalTrust - - require.Nil(t, reputation.GlobalTrustFromV2(x)) - }) -} - -func TestTrust_ToV2(t *testing.T) { - t.Run("nil", func(t *testing.T) { - var x *reputation.Trust - - require.Nil(t, x.ToV2()) - }) -} - -func TestPeerToPeerTrust_ToV2(t *testing.T) { - t.Run("nil", func(t *testing.T) { - var x *reputation.PeerToPeerTrust - - require.Nil(t, x.ToV2()) - }) -} - -func TestGlobalTrust_ToV2(t *testing.T) { - t.Run("nil", func(t *testing.T) { - var x *reputation.GlobalTrust - - require.Nil(t, x.ToV2()) - }) -} - -func TestNewTrust(t *testing.T) { - t.Run("default values", func(t *testing.T) { - trust := reputation.NewTrust() - - // check initial values - require.Zero(t, trust.Value()) - require.Nil(t, trust.Peer()) - - // convert to v2 message - trustV2 := trust.ToV2() - - require.Zero(t, trustV2.GetValue()) - require.Nil(t, trustV2.GetPeer()) - }) -} - -func TestNewPeerToPeerTrust(t *testing.T) { - t.Run("default values", func(t *testing.T) { - trust := reputation.NewPeerToPeerTrust() - - // check initial values - require.Nil(t, trust.Trust()) - require.Nil(t, trust.TrustingPeer()) - - // convert to v2 message - trustV2 := trust.ToV2() - - require.Nil(t, trustV2.GetTrust()) - require.Nil(t, trustV2.GetTrustingPeer()) - }) -} - -func TestNewGlobalTrust(t *testing.T) { - t.Run("default values", func(t *testing.T) { - trust := reputation.NewGlobalTrust() - - // check initial values - require.Nil(t, trust.Manager()) - require.Nil(t, trust.Trust()) - - require.Equal(t, pkg.SDKVersion().String(), trust.Version().String()) - - // convert to v2 message - trustV2 := trust.ToV2() - - require.Nil(t, trustV2.GetBody()) - }) -} diff --git a/pkg/session/container.go b/pkg/session/container.go deleted file mode 100644 index a3d2d91..0000000 --- a/pkg/session/container.go +++ /dev/null @@ -1,139 +0,0 @@ -package session - -import ( - cid "github.com/nspcc-dev/neofs-api-go/pkg/container/id" - "github.com/nspcc-dev/neofs-api-go/v2/session" -) - -// ContainerContext represents NeoFS API v2-compatible -// context of the container session. -// -// It is a wrapper over session.ContainerSessionContext -// which allows to abstract from details of the message -// structure. -type ContainerContext session.ContainerSessionContext - -// NewContainerContext creates and returns blank ContainerSessionContext. -// -// Defaults: -// - not bound to any operation; -// - applied to all containers. -func NewContainerContext() *ContainerContext { - v2 := new(session.ContainerSessionContext) - v2.SetWildcard(true) - - return ContainerContextFromV2(v2) -} - -// ContainerContextFromV2 wraps session.ContainerSessionContext -// into ContainerContext. -func ContainerContextFromV2(v *session.ContainerSessionContext) *ContainerContext { - return (*ContainerContext)(v) -} - -// ToV2 converts ContainerContext to session.ContainerSessionContext -// message structure. -func (x *ContainerContext) ToV2() *session.ContainerSessionContext { - return (*session.ContainerSessionContext)(x) -} - -// ApplyTo specifies which container the ContainerContext applies to. -// -// If id is nil, ContainerContext is applied to all containers. -func (x *ContainerContext) ApplyTo(id *cid.ID) { - v2 := (*session.ContainerSessionContext)(x) - - v2.SetWildcard(id == nil) - v2.SetContainerID(id.ToV2()) -} - -// ActOnAllContainers is a helper function that conveniently -// applies ContainerContext to all containers. -func ApplyToAllContainers(c *ContainerContext) { - c.ApplyTo(nil) -} - -// Container returns identifier of the container -// to which the ContainerContext applies. -// -// Returns nil if ContainerContext is applied to -// all containers. -func (x *ContainerContext) Container() *cid.ID { - v2 := (*session.ContainerSessionContext)(x) - - if v2.Wildcard() { - return nil - } - - return cid.NewFromV2(v2.ContainerID()) -} - -func (x *ContainerContext) forVerb(v session.ContainerSessionVerb) { - (*session.ContainerSessionContext)(x). - SetVerb(v) -} - -func (x *ContainerContext) isForVerb(v session.ContainerSessionVerb) bool { - return (*session.ContainerSessionContext)(x). - Verb() == v -} - -// ForPut binds the ContainerContext to -// PUT operation. -func (x *ContainerContext) ForPut() { - x.forVerb(session.ContainerVerbPut) -} - -// IsForPut checks if ContainerContext is bound to -// PUT operation. -func (x *ContainerContext) IsForPut() bool { - return x.isForVerb(session.ContainerVerbPut) -} - -// ForDelete binds the ContainerContext to -// DELETE operation. -func (x *ContainerContext) ForDelete() { - x.forVerb(session.ContainerVerbDelete) -} - -// IsForDelete checks if ContainerContext is bound to -// DELETE operation. -func (x *ContainerContext) IsForDelete() bool { - return x.isForVerb(session.ContainerVerbDelete) -} - -// ForSetEACL binds the ContainerContext to -// SETEACL operation. -func (x *ContainerContext) ForSetEACL() { - x.forVerb(session.ContainerVerbSetEACL) -} - -// IsForSetEACL checks if ContainerContext is bound to -// SETEACL operation. -func (x *ContainerContext) IsForSetEACL() bool { - return x.isForVerb(session.ContainerVerbSetEACL) -} - -// Marshal marshals ContainerContext into a protobuf binary form. -func (x *ContainerContext) Marshal(bs ...[]byte) ([]byte, error) { - var buf []byte - if len(bs) > 0 { - buf = bs[0] - } - return x.ToV2().StableMarshal(buf) -} - -// Unmarshal unmarshals protobuf binary representation of ContainerContext. -func (x *ContainerContext) Unmarshal(data []byte) error { - return x.ToV2().Unmarshal(data) -} - -// MarshalJSON encodes ContainerContext to protobuf JSON format. -func (x *ContainerContext) MarshalJSON() ([]byte, error) { - return x.ToV2().MarshalJSON() -} - -// UnmarshalJSON decodes ContainerContext from protobuf JSON format. -func (x *ContainerContext) UnmarshalJSON(data []byte) error { - return x.ToV2().UnmarshalJSON(data) -} diff --git a/pkg/session/container_test.go b/pkg/session/container_test.go deleted file mode 100644 index 38c97ee..0000000 --- a/pkg/session/container_test.go +++ /dev/null @@ -1,112 +0,0 @@ -package session_test - -import ( - "testing" - - cidtest "github.com/nspcc-dev/neofs-api-go/pkg/container/id/test" - "github.com/nspcc-dev/neofs-api-go/pkg/session" - sessiontest "github.com/nspcc-dev/neofs-api-go/pkg/session/test" - v2session "github.com/nspcc-dev/neofs-api-go/v2/session" - "github.com/stretchr/testify/require" -) - -func TestContainerContextVerbs(t *testing.T) { - c := session.NewContainerContext() - - assert := func(setter func(), getter func() bool, verb v2session.ContainerSessionVerb) { - setter() - - require.True(t, getter()) - - require.Equal(t, verb, c.ToV2().Verb()) - } - - t.Run("PUT", func(t *testing.T) { - assert(c.ForPut, c.IsForPut, v2session.ContainerVerbPut) - }) - - t.Run("DELETE", func(t *testing.T) { - assert(c.ForDelete, c.IsForDelete, v2session.ContainerVerbDelete) - }) - - t.Run("SETEACL", func(t *testing.T) { - assert(c.ForSetEACL, c.IsForSetEACL, v2session.ContainerVerbSetEACL) - }) -} - -func TestContainerContext_ApplyTo(t *testing.T) { - c := session.NewContainerContext() - id := cidtest.Generate() - - t.Run("method", func(t *testing.T) { - c.ApplyTo(id) - - require.Equal(t, id, c.Container()) - - c.ApplyTo(nil) - - require.Nil(t, c.Container()) - }) - - t.Run("helper functions", func(t *testing.T) { - c.ApplyTo(id) - - session.ApplyToAllContainers(c) - - require.Nil(t, c.Container()) - }) -} - -func TestFilter_ToV2(t *testing.T) { - t.Run("nil", func(t *testing.T) { - var x *session.ContainerContext - - require.Nil(t, x.ToV2()) - }) - - t.Run("default values", func(t *testing.T) { - c := session.NewContainerContext() - - // check initial values - require.Nil(t, c.Container()) - - for _, op := range []func() bool{ - c.IsForPut, - c.IsForDelete, - c.IsForSetEACL, - } { - require.False(t, op()) - } - - // convert to v2 message - cV2 := c.ToV2() - - require.Equal(t, v2session.ContainerVerbUnknown, cV2.Verb()) - require.True(t, cV2.Wildcard()) - require.Nil(t, cV2.ContainerID()) - }) -} - -func TestContainerContextEncoding(t *testing.T) { - c := sessiontest.ContainerContext() - - t.Run("binary", func(t *testing.T) { - data, err := c.Marshal() - require.NoError(t, err) - - c2 := session.NewContainerContext() - require.NoError(t, c2.Unmarshal(data)) - - require.Equal(t, c, c2) - }) - - t.Run("json", func(t *testing.T) { - data, err := c.MarshalJSON() - require.NoError(t, err) - - c2 := session.NewContainerContext() - require.NoError(t, c2.UnmarshalJSON(data)) - - require.Equal(t, c, c2) - }) -} diff --git a/pkg/session/session.go b/pkg/session/session.go deleted file mode 100644 index 6235636..0000000 --- a/pkg/session/session.go +++ /dev/null @@ -1,282 +0,0 @@ -package session - -import ( - "crypto/ecdsa" - - "github.com/nspcc-dev/neofs-api-go/pkg" - "github.com/nspcc-dev/neofs-api-go/pkg/owner" - "github.com/nspcc-dev/neofs-api-go/util/signature" - "github.com/nspcc-dev/neofs-api-go/v2/refs" - "github.com/nspcc-dev/neofs-api-go/v2/session" - v2signature "github.com/nspcc-dev/neofs-api-go/v2/signature" -) - -// Token represents NeoFS API v2-compatible -// session token. -type Token session.SessionToken - -// NewTokenFromV2 wraps session.SessionToken message structure -// into Token. -// -// Nil session.SessionToken converts to nil. -func NewTokenFromV2(tV2 *session.SessionToken) *Token { - return (*Token)(tV2) -} - -// NewToken creates and returns blank Token. -// -// Defaults: -// - body: nil; -// - id: nil; -// - ownerId: nil; -// - sessionKey: nil; -// - exp: 0; -// - iat: 0; -// - nbf: 0; -func NewToken() *Token { - return NewTokenFromV2(new(session.SessionToken)) -} - -// ToV2 converts Token to session.SessionToken message structure. -// -// Nil Token converts to nil. -func (t *Token) ToV2() *session.SessionToken { - return (*session.SessionToken)(t) -} - -func (t *Token) setBodyField(setter func(*session.SessionTokenBody)) { - token := (*session.SessionToken)(t) - body := token.GetBody() - - if body == nil { - body = new(session.SessionTokenBody) - token.SetBody(body) - } - - setter(body) -} - -// ID returns Token identifier. -func (t *Token) ID() []byte { - return (*session.SessionToken)(t). - GetBody(). - GetID() -} - -// SetID sets Token identifier. -func (t *Token) SetID(v []byte) { - t.setBodyField(func(body *session.SessionTokenBody) { - body.SetID(v) - }) -} - -// OwnerID returns Token's owner identifier. -func (t *Token) OwnerID() *owner.ID { - return owner.NewIDFromV2( - (*session.SessionToken)(t). - GetBody(). - GetOwnerID(), - ) -} - -// SetOwnerID sets Token's owner identifier. -func (t *Token) SetOwnerID(v *owner.ID) { - t.setBodyField(func(body *session.SessionTokenBody) { - body.SetOwnerID(v.ToV2()) - }) -} - -// SessionKey returns public key of the session -// in a binary format. -func (t *Token) SessionKey() []byte { - return (*session.SessionToken)(t). - GetBody(). - GetSessionKey() -} - -// SetSessionKey sets public key of the session -// in a binary format. -func (t *Token) SetSessionKey(v []byte) { - t.setBodyField(func(body *session.SessionTokenBody) { - body.SetSessionKey(v) - }) -} - -func (t *Token) setLifetimeField(f func(*session.TokenLifetime)) { - t.setBodyField(func(body *session.SessionTokenBody) { - lt := body.GetLifetime() - if lt == nil { - lt = new(session.TokenLifetime) - body.SetLifetime(lt) - } - - f(lt) - }) -} - -// Exp returns epoch number of the token expiration. -func (t *Token) Exp() uint64 { - return (*session.SessionToken)(t). - GetBody(). - GetLifetime(). - GetExp() -} - -// SetExp sets epoch number of the token expiration. -func (t *Token) SetExp(exp uint64) { - t.setLifetimeField(func(lt *session.TokenLifetime) { - lt.SetExp(exp) - }) -} - -// Nbf returns starting epoch number of the token. -func (t *Token) Nbf() uint64 { - return (*session.SessionToken)(t). - GetBody(). - GetLifetime(). - GetNbf() -} - -// SetNbf sets starting epoch number of the token. -func (t *Token) SetNbf(nbf uint64) { - t.setLifetimeField(func(lt *session.TokenLifetime) { - lt.SetNbf(nbf) - }) -} - -// Iat returns starting epoch number of the token. -func (t *Token) Iat() uint64 { - return (*session.SessionToken)(t). - GetBody(). - GetLifetime(). - GetIat() -} - -// SetIat sets the number of the epoch in which the token was issued. -func (t *Token) SetIat(iat uint64) { - t.setLifetimeField(func(lt *session.TokenLifetime) { - lt.SetIat(iat) - }) -} - -// Sign calculates and writes signature of the Token data. -// -// Returns signature calculation errors. -func (t *Token) Sign(key *ecdsa.PrivateKey) error { - tV2 := (*session.SessionToken)(t) - - signedData := v2signature.StableMarshalerWrapper{ - SM: tV2.GetBody(), - } - - return signature.SignDataWithHandler(key, signedData, func(key, sig []byte) { - tSig := tV2.GetSignature() - if tSig == nil { - tSig = new(refs.Signature) - } - - tSig.SetKey(key) - tSig.SetSign(sig) - - tV2.SetSignature(tSig) - }) -} - -// VerifySignature checks if token signature is -// presented and valid. -func (t *Token) VerifySignature() bool { - tV2 := (*session.SessionToken)(t) - - signedData := v2signature.StableMarshalerWrapper{ - SM: tV2.GetBody(), - } - - return signature.VerifyDataWithSource(signedData, func() (key, sig []byte) { - tSig := tV2.GetSignature() - return tSig.GetKey(), tSig.GetSign() - }) == nil -} - -// Signature returns Token signature. -func (t *Token) Signature() *pkg.Signature { - return pkg.NewSignatureFromV2( - (*session.SessionToken)(t). - GetSignature(), - ) -} - -// SetContext sets context of the Token. -// -// Supported contexts: -// - *ContainerContext. -// -// Resets context if it is not supported. -func (t *Token) SetContext(v interface{}) { - var cV2 session.SessionTokenContext - - switch c := v.(type) { - case *ContainerContext: - cV2 = c.ToV2() - } - - t.setBodyField(func(body *session.SessionTokenBody) { - body.SetContext(cV2) - }) -} - -// Context returns context of the Token. -// -// Supports same contexts as SetContext. -// -// Returns nil if context is not supported. -func (t *Token) Context() interface{} { - switch v := (*session.SessionToken)(t). - GetBody(). - GetContext(); c := v.(type) { - default: - return nil - case *session.ContainerSessionContext: - return ContainerContextFromV2(c) - } -} - -// GetContainerContext is a helper function that casts -// Token context to ContainerContext. -// -// Returns nil if context is not a ContainerContext. -func GetContainerContext(t *Token) *ContainerContext { - c, _ := t.Context().(*ContainerContext) - return c -} - -// Marshal marshals Token into a protobuf binary form. -// -// Buffer is allocated when the argument is empty. -// Otherwise, the first buffer is used. -func (t *Token) Marshal(bs ...[]byte) ([]byte, error) { - var buf []byte - if len(bs) > 0 { - buf = bs[0] - } - - return (*session.SessionToken)(t). - StableMarshal(buf) -} - -// Unmarshal unmarshals protobuf binary representation of Token. -func (t *Token) Unmarshal(data []byte) error { - return (*session.SessionToken)(t). - Unmarshal(data) -} - -// MarshalJSON encodes Token to protobuf JSON format. -func (t *Token) MarshalJSON() ([]byte, error) { - return (*session.SessionToken)(t). - MarshalJSON() -} - -// UnmarshalJSON decodes Token from protobuf JSON format. -func (t *Token) UnmarshalJSON(data []byte) error { - return (*session.SessionToken)(t). - UnmarshalJSON(data) -} diff --git a/pkg/session/session_test.go b/pkg/session/session_test.go deleted file mode 100644 index 3835f38..0000000 --- a/pkg/session/session_test.go +++ /dev/null @@ -1,202 +0,0 @@ -package session_test - -import ( - "testing" - - ownertest "github.com/nspcc-dev/neofs-api-go/pkg/owner/test" - "github.com/nspcc-dev/neofs-api-go/pkg/session" - sessiontest "github.com/nspcc-dev/neofs-api-go/pkg/session/test" - sessionv2 "github.com/nspcc-dev/neofs-api-go/v2/session" - "github.com/stretchr/testify/require" -) - -func TestSessionToken_SetID(t *testing.T) { - token := session.NewToken() - - id := []byte{1, 2, 3} - token.SetID(id) - - require.Equal(t, id, token.ID()) -} - -func TestSessionToken_SetOwnerID(t *testing.T) { - token := session.NewToken() - - ownerID := ownertest.Generate() - - token.SetOwnerID(ownerID) - - require.Equal(t, ownerID, token.OwnerID()) -} - -func TestSessionToken_SetSessionKey(t *testing.T) { - token := session.NewToken() - - key := []byte{1, 2, 3} - token.SetSessionKey(key) - - require.Equal(t, key, token.SessionKey()) -} - -func TestSessionTokenEncoding(t *testing.T) { - tok := sessiontest.Generate() - - t.Run("binary", func(t *testing.T) { - data, err := tok.Marshal() - require.NoError(t, err) - - tok2 := session.NewToken() - require.NoError(t, tok2.Unmarshal(data)) - - require.Equal(t, tok, tok2) - }) - - t.Run("json", func(t *testing.T) { - data, err := tok.MarshalJSON() - require.NoError(t, err) - - tok2 := session.NewToken() - require.NoError(t, tok2.UnmarshalJSON(data)) - - require.Equal(t, tok, tok2) - }) -} - -func TestToken_VerifySignature(t *testing.T) { - t.Run("nil", func(t *testing.T) { - var tok *session.Token - - require.False(t, tok.VerifySignature()) - }) - - t.Run("unsigned", func(t *testing.T) { - tok := sessiontest.Generate() - - require.False(t, tok.VerifySignature()) - }) - - t.Run("signed", func(t *testing.T) { - tok := sessiontest.GenerateSigned() - - require.True(t, tok.VerifySignature()) - }) -} - -var unsupportedContexts = []interface{}{ - 123, - true, - session.NewToken(), -} - -var nonContainerContexts = unsupportedContexts - -func TestToken_Context(t *testing.T) { - tok := session.NewToken() - - for _, item := range []struct { - ctx interface{} - v2assert func(interface{}) - }{ - { - ctx: sessiontest.ContainerContext(), - v2assert: func(c interface{}) { - require.Equal(t, c.(*session.ContainerContext).ToV2(), tok.ToV2().GetBody().GetContext()) - }, - }, - } { - tok.SetContext(item.ctx) - - require.Equal(t, item.ctx, tok.Context()) - - item.v2assert(item.ctx) - } - - for _, c := range unsupportedContexts { - tok.SetContext(c) - - require.Nil(t, tok.Context()) - } -} - -func TestGetContainerContext(t *testing.T) { - tok := session.NewToken() - - c := sessiontest.ContainerContext() - - tok.SetContext(c) - - require.Equal(t, c, session.GetContainerContext(tok)) - - for _, c := range nonContainerContexts { - tok.SetContext(c) - - require.Nil(t, session.GetContainerContext(tok)) - } -} - -func TestToken_Exp(t *testing.T) { - tok := session.NewToken() - - const exp = 11 - - tok.SetExp(exp) - - require.EqualValues(t, exp, tok.Exp()) -} - -func TestToken_Nbf(t *testing.T) { - tok := session.NewToken() - - const nbf = 22 - - tok.SetNbf(nbf) - - require.EqualValues(t, nbf, tok.Nbf()) -} - -func TestToken_Iat(t *testing.T) { - tok := session.NewToken() - - const iat = 33 - - tok.SetIat(iat) - - require.EqualValues(t, iat, tok.Iat()) -} - -func TestNewTokenFromV2(t *testing.T) { - t.Run("from nil", func(t *testing.T) { - var x *sessionv2.SessionToken - - require.Nil(t, session.NewTokenFromV2(x)) - }) -} - -func TestToken_ToV2(t *testing.T) { - t.Run("nil", func(t *testing.T) { - var x *session.Token - - require.Nil(t, x.ToV2()) - }) -} - -func TestNewToken(t *testing.T) { - t.Run("default values", func(t *testing.T) { - token := session.NewToken() - - // check initial values - require.Nil(t, token.Signature()) - require.Nil(t, token.OwnerID()) - require.Nil(t, token.SessionKey()) - require.Nil(t, token.ID()) - require.Zero(t, token.Exp()) - require.Zero(t, token.Iat()) - require.Zero(t, token.Nbf()) - - // convert to v2 message - tokenV2 := token.ToV2() - - require.Nil(t, tokenV2.GetSignature()) - require.Nil(t, tokenV2.GetBody()) - }) -} diff --git a/pkg/session/test/container.go b/pkg/session/test/container.go deleted file mode 100644 index 070bd1b..0000000 --- a/pkg/session/test/container.go +++ /dev/null @@ -1,26 +0,0 @@ -package sessiontest - -import ( - "math/rand" - - cidtest "github.com/nspcc-dev/neofs-api-go/pkg/container/id/test" - "github.com/nspcc-dev/neofs-api-go/pkg/session" -) - -// ContainerContext returns session.ContainerContext -// which applies to random operation on a random container. -func ContainerContext() *session.ContainerContext { - c := session.NewContainerContext() - - setters := []func(){ - c.ForPut, - c.ForDelete, - c.ForSetEACL, - } - - setters[rand.Uint32()%uint32(len(setters))]() - - c.ApplyTo(cidtest.Generate()) - - return c -} diff --git a/pkg/session/test/token.go b/pkg/session/test/token.go deleted file mode 100644 index 82c405b..0000000 --- a/pkg/session/test/token.go +++ /dev/null @@ -1,54 +0,0 @@ -package sessiontest - -import ( - "math/rand" - - "github.com/google/uuid" - "github.com/nspcc-dev/neofs-api-go/pkg/owner" - "github.com/nspcc-dev/neofs-api-go/pkg/session" - crypto "github.com/nspcc-dev/neofs-crypto" - "github.com/nspcc-dev/neofs-crypto/test" -) - -// Generate returns random session.Token. -// -// Resulting token is unsigned. -func Generate() *session.Token { - tok := session.NewToken() - - uid, err := uuid.New().MarshalBinary() - if err != nil { - panic(err) - } - - w := new(owner.NEO3Wallet) - rand.Read(w.Bytes()) - - ownerID := owner.NewID() - ownerID.SetNeo3Wallet(w) - - keyBin := crypto.MarshalPublicKey(&test.DecodeKey(0).PublicKey) - - tok.SetID(uid) - tok.SetOwnerID(ownerID) - tok.SetSessionKey(keyBin) - tok.SetExp(11) - tok.SetNbf(22) - tok.SetIat(33) - - return tok -} - -// GenerateSigned returns signed random session.Token. -// -// Panics if token could not be signed (actually unexpected). -func GenerateSigned() *session.Token { - tok := Generate() - - err := tok.Sign(test.DecodeKey(0)) - if err != nil { - panic(err) - } - - return tok -} diff --git a/pkg/signature.go b/pkg/signature.go deleted file mode 100644 index 0976946..0000000 --- a/pkg/signature.go +++ /dev/null @@ -1,85 +0,0 @@ -package pkg - -import ( - "github.com/nspcc-dev/neofs-api-go/v2/refs" -) - -// Signature represents v2-compatible signature. -type Signature refs.Signature - -// NewSignatureFromV2 wraps v2 Signature message to Signature. -// -// Nil refs.Signature converts to nil. -func NewSignatureFromV2(sV2 *refs.Signature) *Signature { - return (*Signature)(sV2) -} - -// NewSignature creates and initializes blank Signature. -// -// Works similar as NewSignatureFromV2(new(Signature)). -// -// Defaults: -// - key: nil; -// - signature: nil. -func NewSignature() *Signature { - return NewSignatureFromV2(new(refs.Signature)) -} - -// Key sets binary public key. -func (s *Signature) Key() []byte { - return (*refs.Signature)(s).GetKey() -} - -// SetKey returns binary public key. -func (s *Signature) SetKey(v []byte) { - (*refs.Signature)(s).SetKey(v) -} - -// Sign return signature value. -func (s *Signature) Sign() []byte { - return (*refs.Signature)(s).GetSign() -} - -// SetSign sets signature value. -func (s *Signature) SetSign(v []byte) { - (*refs.Signature)(s).SetSign(v) -} - -// ToV2 converts Signature to v2 Signature message. -// -// Nil Signature converts to nil. -func (s *Signature) ToV2() *refs.Signature { - return (*refs.Signature)(s) -} - -// Marshal marshals Signature into a protobuf binary form. -// -// Buffer is allocated when the argument is empty. -// Otherwise, the first buffer is used. -func (s *Signature) Marshal(b ...[]byte) ([]byte, error) { - var buf []byte - if len(b) > 0 { - buf = b[0] - } - - return (*refs.Signature)(s). - StableMarshal(buf) -} - -// Unmarshal unmarshals protobuf binary representation of Signature. -func (s *Signature) Unmarshal(data []byte) error { - return (*refs.Signature)(s). - Unmarshal(data) -} - -// MarshalJSON encodes Signature to protobuf JSON format. -func (s *Signature) MarshalJSON() ([]byte, error) { - return (*refs.Signature)(s). - MarshalJSON() -} - -// UnmarshalJSON decodes Signature from protobuf JSON format. -func (s *Signature) UnmarshalJSON(data []byte) error { - return (*refs.Signature)(s). - UnmarshalJSON(data) -} diff --git a/pkg/signature_test.go b/pkg/signature_test.go deleted file mode 100644 index 45a5f14..0000000 --- a/pkg/signature_test.go +++ /dev/null @@ -1,66 +0,0 @@ -package pkg - -import ( - "testing" - - "github.com/nspcc-dev/neofs-api-go/v2/refs" - "github.com/stretchr/testify/require" -) - -func TestSignatureEncoding(t *testing.T) { - s := NewSignature() - s.SetKey([]byte("key")) - s.SetSign([]byte("sign")) - - t.Run("binary", func(t *testing.T) { - data, err := s.Marshal() - require.NoError(t, err) - - s2 := NewSignature() - require.NoError(t, s2.Unmarshal(data)) - - require.Equal(t, s, s2) - }) - - t.Run("json", func(t *testing.T) { - data, err := s.MarshalJSON() - require.NoError(t, err) - - s2 := NewSignature() - require.NoError(t, s2.UnmarshalJSON(data)) - - require.Equal(t, s, s2) - }) -} - -func TestNewSignatureFromV2(t *testing.T) { - t.Run("from nil", func(t *testing.T) { - var x *refs.Signature - - require.Nil(t, NewSignatureFromV2(x)) - }) -} - -func TestSignature_ToV2(t *testing.T) { - t.Run("nil", func(t *testing.T) { - var x *Signature - - require.Nil(t, x.ToV2()) - }) -} - -func TestNewSignature(t *testing.T) { - t.Run("default values", func(t *testing.T) { - sg := NewSignature() - - // check initial values - require.Nil(t, sg.Key()) - require.Nil(t, sg.Sign()) - - // convert to v2 message - sgV2 := sg.ToV2() - - require.Nil(t, sgV2.GetKey()) - require.Nil(t, sgV2.GetSign()) - }) -} diff --git a/pkg/storagegroup/storagegroup.go b/pkg/storagegroup/storagegroup.go deleted file mode 100644 index 1a73a5a..0000000 --- a/pkg/storagegroup/storagegroup.go +++ /dev/null @@ -1,157 +0,0 @@ -package storagegroup - -import ( - "github.com/nspcc-dev/neofs-api-go/pkg" - "github.com/nspcc-dev/neofs-api-go/pkg/object" - "github.com/nspcc-dev/neofs-api-go/v2/refs" - "github.com/nspcc-dev/neofs-api-go/v2/storagegroup" -) - -// StorageGroup represents v2-compatible storage group. -type StorageGroup storagegroup.StorageGroup - -// NewFromV2 wraps v2 StorageGroup message to StorageGroup. -// -// Nil storagegroup.StorageGroup converts to nil. -func NewFromV2(aV2 *storagegroup.StorageGroup) *StorageGroup { - return (*StorageGroup)(aV2) -} - -// New creates and initializes blank StorageGroup. -// -// Defaults: -// - size: 0; -// - exp: 0; -// - members: nil; -// - hash: nil. -func New() *StorageGroup { - return NewFromV2(new(storagegroup.StorageGroup)) -} - -// ValidationDataSize returns total size of the payloads -// of objects in the storage group -func (sg *StorageGroup) ValidationDataSize() uint64 { - return (*storagegroup.StorageGroup)(sg). - GetValidationDataSize() -} - -// SetValidationDataSize sets total size of the payloads -// of objects in the storage group. -func (sg *StorageGroup) SetValidationDataSize(epoch uint64) { - (*storagegroup.StorageGroup)(sg). - SetValidationDataSize(epoch) -} - -// ValidationDataHash returns homomorphic hash from the -// concatenation of the payloads of the storage group members. -func (sg *StorageGroup) ValidationDataHash() *pkg.Checksum { - return pkg.NewChecksumFromV2( - (*storagegroup.StorageGroup)(sg). - GetValidationHash(), - ) -} - -// SetValidationDataHash sets homomorphic hash from the -// concatenation of the payloads of the storage group members. -func (sg *StorageGroup) SetValidationDataHash(hash *pkg.Checksum) { - (*storagegroup.StorageGroup)(sg). - SetValidationHash(hash.ToV2()) -} - -// ExpirationEpoch returns last NeoFS epoch number -// of the storage group lifetime. -func (sg *StorageGroup) ExpirationEpoch() uint64 { - return (*storagegroup.StorageGroup)(sg). - GetExpirationEpoch() -} - -// SetExpirationEpoch sets last NeoFS epoch number -// of the storage group lifetime. -func (sg *StorageGroup) SetExpirationEpoch(epoch uint64) { - (*storagegroup.StorageGroup)(sg). - SetExpirationEpoch(epoch) -} - -// Members returns strictly ordered list of -// storage group member objects. -func (sg *StorageGroup) Members() []*object.ID { - mV2 := (*storagegroup.StorageGroup)(sg). - GetMembers() - - if mV2 == nil { - return nil - } - - m := make([]*object.ID, len(mV2)) - - for i := range mV2 { - m[i] = object.NewIDFromV2(mV2[i]) - } - - return m -} - -// SetMembers sets strictly ordered list of -// storage group member objects. -func (sg *StorageGroup) SetMembers(members []*object.ID) { - mV2 := (*storagegroup.StorageGroup)(sg). - GetMembers() - - if members == nil { - mV2 = nil - } else { - ln := len(members) - - if cap(mV2) >= ln { - mV2 = mV2[:0] - } else { - mV2 = make([]*refs.ObjectID, 0, ln) - } - - for i := 0; i < ln; i++ { - mV2 = append(mV2, members[i].ToV2()) - } - } - - (*storagegroup.StorageGroup)(sg). - SetMembers(mV2) -} - -// ToV2 converts StorageGroup to v2 StorageGroup message. -// -// Nil StorageGroup converts to nil. -func (sg *StorageGroup) ToV2() *storagegroup.StorageGroup { - return (*storagegroup.StorageGroup)(sg) -} - -// Marshal marshals StorageGroup into a protobuf binary form. -// -// Buffer is allocated when the argument is empty. -// Otherwise, the first buffer is used. -func (sg *StorageGroup) Marshal(b ...[]byte) ([]byte, error) { - var buf []byte - if len(b) > 0 { - buf = b[0] - } - - return (*storagegroup.StorageGroup)(sg). - StableMarshal(buf) -} - -// Unmarshal unmarshals protobuf binary representation of StorageGroup. -func (sg *StorageGroup) Unmarshal(data []byte) error { - return (*storagegroup.StorageGroup)(sg). - Unmarshal(data) -} - -// MarshalJSON encodes StorageGroup to protobuf JSON format. -func (sg *StorageGroup) MarshalJSON() ([]byte, error) { - return (*storagegroup.StorageGroup)(sg). - MarshalJSON() -} - -// UnmarshalJSON decodes StorageGroup from protobuf JSON format. -func (sg *StorageGroup) UnmarshalJSON(data []byte) error { - return (*storagegroup.StorageGroup)(sg). - UnmarshalJSON(data) -} diff --git a/pkg/storagegroup/storagegroup_test.go b/pkg/storagegroup/storagegroup_test.go deleted file mode 100644 index ee6c6a6..0000000 --- a/pkg/storagegroup/storagegroup_test.go +++ /dev/null @@ -1,93 +0,0 @@ -package storagegroup_test - -import ( - "testing" - - "github.com/nspcc-dev/neofs-api-go/pkg/object" - objecttest "github.com/nspcc-dev/neofs-api-go/pkg/object/test" - "github.com/nspcc-dev/neofs-api-go/pkg/storagegroup" - storagegrouptest "github.com/nspcc-dev/neofs-api-go/pkg/storagegroup/test" - refstest "github.com/nspcc-dev/neofs-api-go/pkg/test" - storagegroupV2 "github.com/nspcc-dev/neofs-api-go/v2/storagegroup" - "github.com/stretchr/testify/require" -) - -func TestStorageGroup(t *testing.T) { - sg := storagegroup.New() - - sz := uint64(13) - sg.SetValidationDataSize(sz) - require.Equal(t, sz, sg.ValidationDataSize()) - - cs := refstest.Checksum() - sg.SetValidationDataHash(cs) - require.Equal(t, cs, sg.ValidationDataHash()) - - exp := uint64(33) - sg.SetExpirationEpoch(exp) - require.Equal(t, exp, sg.ExpirationEpoch()) - - members := []*object.ID{objecttest.ID(), objecttest.ID()} - sg.SetMembers(members) - require.Equal(t, members, sg.Members()) -} - -func TestStorageGroupEncoding(t *testing.T) { - sg := storagegrouptest.Generate() - - t.Run("binary", func(t *testing.T) { - data, err := sg.Marshal() - require.NoError(t, err) - - sg2 := storagegroup.New() - require.NoError(t, sg2.Unmarshal(data)) - - require.Equal(t, sg, sg2) - }) - - t.Run("json", func(t *testing.T) { - data, err := sg.MarshalJSON() - require.NoError(t, err) - - sg2 := storagegroup.New() - require.NoError(t, sg2.UnmarshalJSON(data)) - - require.Equal(t, sg, sg2) - }) -} - -func TestNewFromV2(t *testing.T) { - t.Run("from nil", func(t *testing.T) { - var x *storagegroupV2.StorageGroup - - require.Nil(t, storagegroup.NewFromV2(x)) - }) -} - -func TestStorageGroup_ToV2(t *testing.T) { - t.Run("nil", func(t *testing.T) { - var x *storagegroup.StorageGroup - - require.Nil(t, x.ToV2()) - }) -} - -func TestNew(t *testing.T) { - t.Run("default values", func(t *testing.T) { - sg := storagegroup.New() - - // check initial values - require.Nil(t, sg.Members()) - require.Nil(t, sg.ValidationDataHash()) - require.Zero(t, sg.ExpirationEpoch()) - require.Zero(t, sg.ValidationDataSize()) - - // convert to v2 message - sgV2 := sg.ToV2() - - require.Nil(t, sgV2.GetMembers()) - require.Nil(t, sgV2.GetValidationHash()) - require.Zero(t, sgV2.GetExpirationEpoch()) - require.Zero(t, sgV2.GetValidationDataSize()) - }) -} diff --git a/pkg/storagegroup/test/generate.go b/pkg/storagegroup/test/generate.go deleted file mode 100644 index 4efe1b2..0000000 --- a/pkg/storagegroup/test/generate.go +++ /dev/null @@ -1,20 +0,0 @@ -package storagegrouptest - -import ( - "github.com/nspcc-dev/neofs-api-go/pkg/object" - objecttest "github.com/nspcc-dev/neofs-api-go/pkg/object/test" - "github.com/nspcc-dev/neofs-api-go/pkg/storagegroup" - refstest "github.com/nspcc-dev/neofs-api-go/pkg/test" -) - -// Generate returns random storagegroup.StorageGroup. -func Generate() *storagegroup.StorageGroup { - x := storagegroup.New() - - x.SetExpirationEpoch(66) - x.SetValidationDataSize(322) - x.SetValidationDataHash(refstest.Checksum()) - x.SetMembers([]*object.ID{objecttest.ID(), objecttest.ID()}) - - return x -} diff --git a/pkg/test/generate.go b/pkg/test/generate.go deleted file mode 100644 index 5bd0933..0000000 --- a/pkg/test/generate.go +++ /dev/null @@ -1,51 +0,0 @@ -package refstest - -import ( - "crypto/sha256" - "math/rand" - - "github.com/nspcc-dev/neofs-api-go/pkg" -) - -// Checksum returns random pkg.Checksum. -func Checksum() *pkg.Checksum { - var cs [sha256.Size]byte - - rand.Read(cs[:]) - - x := pkg.NewChecksum() - - x.SetSHA256(cs) - - return x -} - -// Signature returns random pkg.Signature. -func Signature() *pkg.Signature { - x := pkg.NewSignature() - - x.SetKey([]byte("key")) - x.SetSign([]byte("sign")) - - return x -} - -// Version returns random pkg.Version. -func Version() *pkg.Version { - x := pkg.NewVersion() - - x.SetMajor(2) - x.SetMinor(1) - - return x -} - -// XHeader returns random pkg.XHeader. -func XHeader() *pkg.XHeader { - x := pkg.NewXHeader() - - x.SetKey("key") - x.SetValue("value") - - return x -} diff --git a/pkg/token/bearer.go b/pkg/token/bearer.go deleted file mode 100644 index 621052c..0000000 --- a/pkg/token/bearer.go +++ /dev/null @@ -1,188 +0,0 @@ -package token - -import ( - "crypto/ecdsa" - "errors" - - "github.com/nspcc-dev/neofs-api-go/pkg/acl/eacl" - "github.com/nspcc-dev/neofs-api-go/pkg/owner" - "github.com/nspcc-dev/neofs-api-go/util/signature" - "github.com/nspcc-dev/neofs-api-go/v2/acl" - "github.com/nspcc-dev/neofs-api-go/v2/refs" - v2signature "github.com/nspcc-dev/neofs-api-go/v2/signature" - crypto "github.com/nspcc-dev/neofs-crypto" -) - -var ( - errNilBearerToken = errors.New("bearer token is not set") - errNilBearerTokenBody = errors.New("bearer token body is not set") - errNilBearerTokenEACL = errors.New("bearer token EACL table is not set") -) - -type BearerToken struct { - token acl.BearerToken -} - -// ToV2 converts BearerToken to v2 BearerToken message. -// -// Nil BearerToken converts to nil. -func (b *BearerToken) ToV2() *acl.BearerToken { - if b == nil { - return nil - } - - return &b.token -} - -func (b *BearerToken) SetLifetime(exp, nbf, iat uint64) { - body := b.token.GetBody() - if body == nil { - body = new(acl.BearerTokenBody) - } - - lt := new(acl.TokenLifetime) - lt.SetExp(exp) - lt.SetNbf(nbf) - lt.SetIat(iat) - - body.SetLifetime(lt) - b.token.SetBody(body) -} - -func (b *BearerToken) SetEACLTable(table *eacl.Table) { - body := b.token.GetBody() - if body == nil { - body = new(acl.BearerTokenBody) - } - - body.SetEACL(table.ToV2()) - b.token.SetBody(body) -} - -func (b *BearerToken) SetOwner(id *owner.ID) { - body := b.token.GetBody() - if body == nil { - body = new(acl.BearerTokenBody) - } - - body.SetOwnerID(id.ToV2()) - b.token.SetBody(body) -} - -func (b *BearerToken) SignToken(key *ecdsa.PrivateKey) error { - err := sanityCheck(b) - if err != nil { - return err - } - - signWrapper := v2signature.StableMarshalerWrapper{SM: b.token.GetBody()} - - return signature.SignDataWithHandler(key, signWrapper, func(key []byte, sig []byte) { - bearerSignature := new(refs.Signature) - bearerSignature.SetKey(key) - bearerSignature.SetSign(sig) - b.token.SetSignature(bearerSignature) - }) -} - -// Issuer returns owner.ID associated with the key that signed bearer token. -// To pass node validation it should be owner of requested container. Returns -// nil if token is not signed. -func (b *BearerToken) Issuer() *owner.ID { - pubKey := crypto.UnmarshalPublicKey(b.token.GetSignature().GetKey()) - - wallet, err := owner.NEO3WalletFromPublicKey(pubKey) - if err != nil { - return nil - } - - return owner.NewIDFromNeo3Wallet(wallet) -} - -// NewBearerToken creates and initializes blank BearerToken. -// -// Defaults: -// - signature: nil; -// - eacl: nil; -// - ownerID: nil; -// - exp: 0; -// - nbf: 0; -// - iat: 0. -func NewBearerToken() *BearerToken { - b := new(BearerToken) - b.token = acl.BearerToken{} - b.token.SetBody(new(acl.BearerTokenBody)) - - return b -} - -// ToV2 converts BearerToken to v2 BearerToken message. -func NewBearerTokenFromV2(v2 *acl.BearerToken) *BearerToken { - if v2 == nil { - v2 = new(acl.BearerToken) - } - - return &BearerToken{ - token: *v2, - } -} - -// sanityCheck if bearer token is ready to be issued. -func sanityCheck(b *BearerToken) error { - switch { - case b == nil: - return errNilBearerToken - case b.token.GetBody() == nil: - return errNilBearerTokenBody - case b.token.GetBody().GetEACL() == nil: - return errNilBearerTokenEACL - } - - // consider checking EACL sanity there, lifetime correctness, etc. - - return nil -} - -// Marshal marshals BearerToken into a protobuf binary form. -// -// Buffer is allocated when the argument is empty. -// Otherwise, the first buffer is used. -func (b *BearerToken) Marshal(bs ...[]byte) ([]byte, error) { - var buf []byte - if len(bs) > 0 { - buf = bs[0] - } - - return b.ToV2(). - StableMarshal(buf) -} - -// Unmarshal unmarshals protobuf binary representation of BearerToken. -func (b *BearerToken) Unmarshal(data []byte) error { - fV2 := new(acl.BearerToken) - if err := fV2.Unmarshal(data); err != nil { - return err - } - - *b = *NewBearerTokenFromV2(fV2) - - return nil -} - -// MarshalJSON encodes BearerToken to protobuf JSON format. -func (b *BearerToken) MarshalJSON() ([]byte, error) { - return b.ToV2(). - MarshalJSON() -} - -// UnmarshalJSON decodes BearerToken from protobuf JSON format. -func (b *BearerToken) UnmarshalJSON(data []byte) error { - fV2 := new(acl.BearerToken) - if err := fV2.UnmarshalJSON(data); err != nil { - return err - } - - *b = *NewBearerTokenFromV2(fV2) - - return nil -} diff --git a/pkg/token/bearer_test.go b/pkg/token/bearer_test.go deleted file mode 100644 index 191398b..0000000 --- a/pkg/token/bearer_test.go +++ /dev/null @@ -1,82 +0,0 @@ -package token_test - -import ( - "testing" - - "github.com/nspcc-dev/neofs-api-go/pkg/acl/eacl" - "github.com/nspcc-dev/neofs-api-go/pkg/owner" - "github.com/nspcc-dev/neofs-api-go/pkg/token" - tokentest "github.com/nspcc-dev/neofs-api-go/pkg/token/test" - "github.com/nspcc-dev/neofs-crypto/test" - "github.com/stretchr/testify/require" -) - -func TestBearerToken_Issuer(t *testing.T) { - bearerToken := token.NewBearerToken() - - t.Run("non signed token", func(t *testing.T) { - require.Nil(t, bearerToken.Issuer()) - }) - - t.Run("signed token", func(t *testing.T) { - key := test.DecodeKey(1) - - wallet, err := owner.NEO3WalletFromPublicKey(&key.PublicKey) - require.NoError(t, err) - - ownerID := owner.NewIDFromNeo3Wallet(wallet) - - bearerToken.SetEACLTable(eacl.NewTable()) - require.NoError(t, bearerToken.SignToken(key)) - require.True(t, ownerID.Equal(bearerToken.Issuer())) - }) -} - -func TestFilterEncoding(t *testing.T) { - f := tokentest.Generate() - - t.Run("binary", func(t *testing.T) { - data, err := f.Marshal() - require.NoError(t, err) - - f2 := token.NewBearerToken() - require.NoError(t, f2.Unmarshal(data)) - - require.Equal(t, f, f2) - }) - - t.Run("json", func(t *testing.T) { - data, err := f.MarshalJSON() - require.NoError(t, err) - - d2 := token.NewBearerToken() - require.NoError(t, d2.UnmarshalJSON(data)) - - require.Equal(t, f, d2) - }) -} - -func TestBearerToken_ToV2(t *testing.T) { - t.Run("nil", func(t *testing.T) { - var x *token.BearerToken - - require.Nil(t, x.ToV2()) - }) -} - -func TestNewBearerToken(t *testing.T) { - t.Run("default values", func(t *testing.T) { - tkn := token.NewBearerToken() - - // convert to v2 message - tknV2 := tkn.ToV2() - - require.NotNil(t, tknV2.GetBody()) - require.Zero(t, tknV2.GetBody().GetLifetime().GetExp()) - require.Zero(t, tknV2.GetBody().GetLifetime().GetNbf()) - require.Zero(t, tknV2.GetBody().GetLifetime().GetIat()) - require.Nil(t, tknV2.GetBody().GetEACL()) - require.Nil(t, tknV2.GetBody().GetOwnerID()) - require.Nil(t, tknV2.GetSignature()) - }) -} diff --git a/pkg/token/session.go b/pkg/token/session.go deleted file mode 100644 index 5c8e8a7..0000000 --- a/pkg/token/session.go +++ /dev/null @@ -1,22 +0,0 @@ -package token - -import ( - "github.com/nspcc-dev/neofs-api-go/pkg/session" -) - -// SessionToken represents NeoFS API v2-compatible -// session token. -// -// Deprecated: use session.Token instead -type SessionToken = session.Token - -// NewSessionTokenFromV2 wraps session.SessionToken message structure -// into Token. -// -// Deprecated: use session.NewTokenFromV2 instead. -var NewSessionTokenFromV2 = session.NewTokenFromV2 - -// NewSessionToken creates and returns blank session token. -// -// Deprecated: use session.NewToken instead. -var NewSessionToken = session.NewToken diff --git a/pkg/token/test/generate.go b/pkg/token/test/generate.go deleted file mode 100644 index f7ae59d..0000000 --- a/pkg/token/test/generate.go +++ /dev/null @@ -1,35 +0,0 @@ -package tokentest - -import ( - eacltest "github.com/nspcc-dev/neofs-api-go/pkg/acl/eacl/test" - ownertest "github.com/nspcc-dev/neofs-api-go/pkg/owner/test" - "github.com/nspcc-dev/neofs-api-go/pkg/token" - "github.com/nspcc-dev/neofs-crypto/test" -) - -// Generate returns random token.BearerToken. -// -// Resulting token is unsigned. -func Generate() *token.BearerToken { - x := token.NewBearerToken() - - x.SetLifetime(3, 2, 1) - x.SetOwner(ownertest.Generate()) - x.SetEACLTable(eacltest.Table()) - - return x -} - -// GenerateSigned returns signed random token.BearerToken. -// -// Panics if token could not be signed (actually unexpected). -func GenerateSigned() *token.BearerToken { - tok := Generate() - - err := tok.SignToken(test.DecodeKey(0)) - if err != nil { - panic(err) - } - - return tok -} diff --git a/pkg/version.go b/pkg/version.go deleted file mode 100644 index c720af5..0000000 --- a/pkg/version.go +++ /dev/null @@ -1,107 +0,0 @@ -package pkg - -import ( - "fmt" - - "github.com/nspcc-dev/neofs-api-go/v2/refs" -) - -// Version represents v2-compatible version. -type Version refs.Version - -const sdkMjr, sdkMnr = 2, 10 - -// NewVersionFromV2 wraps v2 Version message to Version. -// -// Nil refs.Version converts to nil. -func NewVersionFromV2(v *refs.Version) *Version { - return (*Version)(v) -} - -// NewVersion creates and initializes blank Version. -// -// Works similar as NewVersionFromV2(new(Version)). -// -// Defaults: -// - major: 0; -// - minor: 0. -func NewVersion() *Version { - return NewVersionFromV2(new(refs.Version)) -} - -// SDKVersion returns Version instance that -// initialized to current SDK revision number. -func SDKVersion() *Version { - v := NewVersion() - v.SetMajor(sdkMjr) - v.SetMinor(sdkMnr) - - return v -} - -// Major returns major number of the revision. -func (v *Version) Major() uint32 { - return (*refs.Version)(v). - GetMajor() -} - -// SetMajor sets major number of the revision. -func (v *Version) SetMajor(val uint32) { - (*refs.Version)(v). - SetMajor(val) -} - -// Minor returns minor number of the revision. -func (v *Version) Minor() uint32 { - return (*refs.Version)(v). - GetMinor() -} - -// SetMinor sets minor number of the revision. -func (v *Version) SetMinor(val uint32) { - (*refs.Version)(v). - SetMinor(val) -} - -// ToV2 converts Version to v2 Version message. -// -// Nil Version converts to nil. -func (v *Version) ToV2() *refs.Version { - return (*refs.Version)(v) -} - -func (v *Version) String() string { - return fmt.Sprintf("v%d.%d", v.Major(), v.Minor()) -} - -// Marshal marshals Version into a protobuf binary form. -// -// Buffer is allocated when the argument is empty. -// Otherwise, the first buffer is used. -func (v *Version) Marshal(b ...[]byte) ([]byte, error) { - var buf []byte - if len(b) > 0 { - buf = b[0] - } - - return (*refs.Version)(v). - StableMarshal(buf) -} - -// Unmarshal unmarshals protobuf binary representation of Version. -func (v *Version) Unmarshal(data []byte) error { - return (*refs.Version)(v). - Unmarshal(data) -} - -// MarshalJSON encodes Version to protobuf JSON format. -func (v *Version) MarshalJSON() ([]byte, error) { - return (*refs.Version)(v). - MarshalJSON() -} - -// UnmarshalJSON decodes Version from protobuf JSON format. -func (v *Version) UnmarshalJSON(data []byte) error { - return (*refs.Version)(v). - UnmarshalJSON(data) -} diff --git a/pkg/version_test.go b/pkg/version_test.go deleted file mode 100644 index 622e4b7..0000000 --- a/pkg/version_test.go +++ /dev/null @@ -1,90 +0,0 @@ -package pkg - -import ( - "testing" - - "github.com/nspcc-dev/neofs-api-go/v2/refs" - "github.com/stretchr/testify/require" -) - -func TestNewVersion(t *testing.T) { - t.Run("default values", func(t *testing.T) { - v := NewVersion() - - // check initial values - require.Zero(t, v.Major()) - require.Zero(t, v.Minor()) - - // convert to v2 message - vV2 := v.ToV2() - - require.Empty(t, vV2.GetMajor()) - require.Empty(t, vV2.GetMinor()) - }) - - t.Run("setting values", func(t *testing.T) { - v := NewVersion() - - var mjr, mnr uint32 = 1, 2 - - v.SetMajor(mjr) - v.SetMinor(mnr) - - require.Equal(t, mjr, v.Major()) - require.Equal(t, mnr, v.Minor()) - - ver := v.ToV2() - - require.Equal(t, mjr, ver.GetMajor()) - require.Equal(t, mnr, ver.GetMinor()) - }) -} - -func TestSDKVersion(t *testing.T) { - v := SDKVersion() - - require.Equal(t, uint32(sdkMjr), v.Major()) - require.Equal(t, uint32(sdkMnr), v.Minor()) -} - -func TestVersionEncoding(t *testing.T) { - v := NewVersion() - v.SetMajor(1) - v.SetMinor(2) - - t.Run("binary", func(t *testing.T) { - data, err := v.Marshal() - require.NoError(t, err) - - v2 := NewVersion() - require.NoError(t, v2.Unmarshal(data)) - - require.Equal(t, v, v2) - }) - - t.Run("json", func(t *testing.T) { - data, err := v.MarshalJSON() - require.NoError(t, err) - - v2 := NewVersion() - require.NoError(t, v2.UnmarshalJSON(data)) - - require.Equal(t, v, v2) - }) -} - -func TestNewVersionFromV2(t *testing.T) { - t.Run("from nil", func(t *testing.T) { - var x *refs.Version - - require.Nil(t, NewVersionFromV2(x)) - }) -} - -func TestVersion_ToV2(t *testing.T) { - t.Run("nil", func(t *testing.T) { - var x *Version - - require.Nil(t, x.ToV2()) - }) -} diff --git a/pkg/xheader.go b/pkg/xheader.go deleted file mode 100644 index b36f1f0..0000000 --- a/pkg/xheader.go +++ /dev/null @@ -1,55 +0,0 @@ -package pkg - -import ( - "github.com/nspcc-dev/neofs-api-go/v2/session" -) - -// XHeader represents v2-compatible XHeader. -type XHeader session.XHeader - -// NewXHeaderFromV2 wraps v2 XHeader message to XHeader. -// -// Nil session.XHeader converts to nil. -func NewXHeaderFromV2(v *session.XHeader) *XHeader { - return (*XHeader)(v) -} - -// NewXHeader creates, initializes and returns blank XHeader instance. -// -// Defaults: -// - key: ""; -// - value: "". -func NewXHeader() *XHeader { - return NewXHeaderFromV2(new(session.XHeader)) -} - -// ToV2 converts XHeader to v2 XHeader message. -// -// Nil XHeader converts to nil. -func (x *XHeader) ToV2() *session.XHeader { - return (*session.XHeader)(x) -} - -// Key returns key to X-Header. -func (x *XHeader) Key() string { - return (*session.XHeader)(x). - GetKey() -} - -// SetKey sets key to X-Header. -func (x *XHeader) SetKey(k string) { - (*session.XHeader)(x). - SetKey(k) -} - -// Value returns value of X-Header. -func (x *XHeader) Value() string { - return (*session.XHeader)(x). - GetValue() -} - -// SetValue sets value of X-Header. -func (x *XHeader) SetValue(k string) { - (*session.XHeader)(x). - SetValue(k) -} diff --git a/pkg/xheader_test.go b/pkg/xheader_test.go deleted file mode 100644 index 22cbe87..0000000 --- a/pkg/xheader_test.go +++ /dev/null @@ -1,58 +0,0 @@ -package pkg - -import ( - "testing" - - "github.com/nspcc-dev/neofs-api-go/v2/session" - "github.com/stretchr/testify/require" -) - -func TestXHeader(t *testing.T) { - x := NewXHeader() - - key := "some key" - val := "some value" - - x.SetKey(key) - x.SetValue(val) - - require.Equal(t, key, x.Key()) - require.Equal(t, val, x.Value()) - - xV2 := x.ToV2() - - require.Equal(t, key, xV2.GetKey()) - require.Equal(t, val, xV2.GetValue()) -} - -func TestNewXHeaderFromV2(t *testing.T) { - t.Run("from nil", func(t *testing.T) { - var x *session.XHeader - - require.Nil(t, NewXHeaderFromV2(x)) - }) -} - -func TestXHeader_ToV2(t *testing.T) { - t.Run("nil", func(t *testing.T) { - var x *XHeader - - require.Nil(t, x.ToV2()) - }) -} - -func TestNewXHeader(t *testing.T) { - t.Run("default values", func(t *testing.T) { - xh := NewXHeader() - - // check initial values - require.Empty(t, xh.Value()) - require.Empty(t, xh.Key()) - - // convert to v2 message - xhV2 := xh.ToV2() - - require.Empty(t, xhV2.GetValue()) - require.Empty(t, xhV2.GetKey()) - }) -} diff --git a/v2/refs/convert.go b/refs/convert.go similarity index 97% rename from v2/refs/convert.go rename to refs/convert.go index 3cd87d2..8b89b71 100644 --- a/v2/refs/convert.go +++ b/refs/convert.go @@ -1,9 +1,9 @@ package refs import ( - "github.com/nspcc-dev/neofs-api-go/rpc/grpc" - "github.com/nspcc-dev/neofs-api-go/rpc/message" refs "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" + "github.com/nspcc-dev/neofs-api-go/v2/rpc/grpc" + "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" ) func (o *OwnerID) ToGRPCMessage() grpc.Message { diff --git a/v2/refs/grpc/types.go b/refs/grpc/types.go similarity index 100% rename from v2/refs/grpc/types.go rename to refs/grpc/types.go diff --git a/v2/refs/grpc/types.pb.go b/refs/grpc/types.pb.go similarity index 100% rename from v2/refs/grpc/types.pb.go rename to refs/grpc/types.pb.go diff --git a/v2/refs/json.go b/refs/json.go similarity index 96% rename from v2/refs/json.go rename to refs/json.go index 4197e2f..5a48cdb 100644 --- a/v2/refs/json.go +++ b/refs/json.go @@ -1,8 +1,8 @@ package refs import ( - "github.com/nspcc-dev/neofs-api-go/rpc/message" refs "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" + "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" ) func (a *Address) MarshalJSON() ([]byte, error) { diff --git a/v2/refs/marshal.go b/refs/marshal.go similarity index 98% rename from v2/refs/marshal.go rename to refs/marshal.go index 806d8e4..e8d2565 100644 --- a/v2/refs/marshal.go +++ b/refs/marshal.go @@ -1,9 +1,9 @@ package refs import ( - "github.com/nspcc-dev/neofs-api-go/rpc/message" - "github.com/nspcc-dev/neofs-api-go/util/proto" refs "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" + "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" + "github.com/nspcc-dev/neofs-api-go/v2/util/proto" ) const ( diff --git a/v2/refs/message_test.go b/refs/message_test.go similarity index 85% rename from v2/refs/message_test.go rename to refs/message_test.go index 92eb6df..d5e591f 100644 --- a/v2/refs/message_test.go +++ b/refs/message_test.go @@ -3,9 +3,9 @@ package refs_test import ( "testing" - "github.com/nspcc-dev/neofs-api-go/rpc/message" - messagetest "github.com/nspcc-dev/neofs-api-go/rpc/message/test" refstest "github.com/nspcc-dev/neofs-api-go/v2/refs/test" + "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" + messagetest "github.com/nspcc-dev/neofs-api-go/v2/rpc/message/test" ) func TestMessageConvert(t *testing.T) { diff --git a/v2/refs/string.go b/refs/string.go similarity index 100% rename from v2/refs/string.go rename to refs/string.go diff --git a/v2/refs/test/generate.go b/refs/test/generate.go similarity index 100% rename from v2/refs/test/generate.go rename to refs/test/generate.go diff --git a/v2/refs/types.go b/refs/types.go similarity index 100% rename from v2/refs/types.go rename to refs/types.go diff --git a/v2/reputation/convert.go b/reputation/convert.go similarity index 99% rename from v2/reputation/convert.go rename to reputation/convert.go index 0c49508..67f3aaf 100644 --- a/v2/reputation/convert.go +++ b/reputation/convert.go @@ -1,11 +1,11 @@ package reputation import ( - "github.com/nspcc-dev/neofs-api-go/rpc/grpc" - "github.com/nspcc-dev/neofs-api-go/rpc/message" "github.com/nspcc-dev/neofs-api-go/v2/refs" refsGRPC "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" reputation "github.com/nspcc-dev/neofs-api-go/v2/reputation/grpc" + "github.com/nspcc-dev/neofs-api-go/v2/rpc/grpc" + "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" ) // ToGRPCMessage converts PeerID to gRPC-generated diff --git a/v2/reputation/grpc/service.go b/reputation/grpc/service.go similarity index 100% rename from v2/reputation/grpc/service.go rename to reputation/grpc/service.go diff --git a/v2/reputation/grpc/service.pb.go b/reputation/grpc/service.pb.go similarity index 100% rename from v2/reputation/grpc/service.pb.go rename to reputation/grpc/service.pb.go diff --git a/v2/reputation/grpc/service_grpc.pb.go b/reputation/grpc/service_grpc.pb.go similarity index 100% rename from v2/reputation/grpc/service_grpc.pb.go rename to reputation/grpc/service_grpc.pb.go diff --git a/v2/reputation/grpc/types.go b/reputation/grpc/types.go similarity index 100% rename from v2/reputation/grpc/types.go rename to reputation/grpc/types.go diff --git a/v2/reputation/grpc/types.pb.go b/reputation/grpc/types.pb.go similarity index 100% rename from v2/reputation/grpc/types.pb.go rename to reputation/grpc/types.pb.go diff --git a/v2/reputation/json.go b/reputation/json.go similarity index 94% rename from v2/reputation/json.go rename to reputation/json.go index 5ee1cc2..17f559f 100644 --- a/v2/reputation/json.go +++ b/reputation/json.go @@ -1,8 +1,8 @@ package reputation import ( - "github.com/nspcc-dev/neofs-api-go/rpc/message" reputation "github.com/nspcc-dev/neofs-api-go/v2/reputation/grpc" + "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" ) func (x *PeerID) MarshalJSON() ([]byte, error) { diff --git a/v2/reputation/marshal.go b/reputation/marshal.go similarity index 98% rename from v2/reputation/marshal.go rename to reputation/marshal.go index 6c15062..1af68c9 100644 --- a/v2/reputation/marshal.go +++ b/reputation/marshal.go @@ -1,9 +1,9 @@ package reputation import ( - "github.com/nspcc-dev/neofs-api-go/rpc/message" - protoutil "github.com/nspcc-dev/neofs-api-go/util/proto" reputation "github.com/nspcc-dev/neofs-api-go/v2/reputation/grpc" + "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" + protoutil "github.com/nspcc-dev/neofs-api-go/v2/util/proto" ) const ( diff --git a/v2/reputation/message_test.go b/reputation/message_test.go similarity index 92% rename from v2/reputation/message_test.go rename to reputation/message_test.go index f09c636..0f948c9 100644 --- a/v2/reputation/message_test.go +++ b/reputation/message_test.go @@ -3,9 +3,9 @@ package reputation_test import ( "testing" - "github.com/nspcc-dev/neofs-api-go/rpc/message" - messagetest "github.com/nspcc-dev/neofs-api-go/rpc/message/test" reputationtest "github.com/nspcc-dev/neofs-api-go/v2/reputation/test" + "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" + messagetest "github.com/nspcc-dev/neofs-api-go/v2/rpc/message/test" ) func TestMessageConvert(t *testing.T) { diff --git a/v2/reputation/test/generate.go b/reputation/test/generate.go similarity index 100% rename from v2/reputation/test/generate.go rename to reputation/test/generate.go diff --git a/v2/reputation/types.go b/reputation/types.go similarity index 100% rename from v2/reputation/types.go rename to reputation/types.go diff --git a/v2/rpc/accounting.go b/rpc/accounting.go similarity index 85% rename from v2/rpc/accounting.go rename to rpc/accounting.go index 0e031da..0c0bd7b 100644 --- a/v2/rpc/accounting.go +++ b/rpc/accounting.go @@ -1,9 +1,9 @@ package rpc import ( - "github.com/nspcc-dev/neofs-api-go/rpc/client" - "github.com/nspcc-dev/neofs-api-go/rpc/common" "github.com/nspcc-dev/neofs-api-go/v2/accounting" + "github.com/nspcc-dev/neofs-api-go/v2/rpc/client" + "github.com/nspcc-dev/neofs-api-go/v2/rpc/common" ) const serviceAccounting = serviceNamePrefix + "accounting.AccountingService" diff --git a/rpc/client/call_options.go b/rpc/client/call_options.go index ef849f3..e443a89 100644 --- a/rpc/client/call_options.go +++ b/rpc/client/call_options.go @@ -3,7 +3,7 @@ package client import ( "context" - "github.com/nspcc-dev/neofs-api-go/rpc/grpc" + "github.com/nspcc-dev/neofs-api-go/v2/rpc/grpc" ) // CallOption is a messaging session option within Protobuf RPC. diff --git a/rpc/client/client.go b/rpc/client/client.go index e51cdcf..16b3496 100644 --- a/rpc/client/client.go +++ b/rpc/client/client.go @@ -3,7 +3,7 @@ package client import ( "sync" - "github.com/nspcc-dev/neofs-api-go/rpc/grpc" + "github.com/nspcc-dev/neofs-api-go/v2/rpc/grpc" ) // Client represents client for exchanging messages diff --git a/rpc/client/connect.go b/rpc/client/connect.go index 9df1ddf..e80e422 100644 --- a/rpc/client/connect.go +++ b/rpc/client/connect.go @@ -4,7 +4,7 @@ import ( "context" "errors" - "github.com/nspcc-dev/neofs-api-go/rpc/grpc" + "github.com/nspcc-dev/neofs-api-go/v2/rpc/grpc" grpcstd "google.golang.org/grpc" "google.golang.org/grpc/credentials" ) diff --git a/rpc/client/flows.go b/rpc/client/flows.go index c106e0a..4f4a04a 100644 --- a/rpc/client/flows.go +++ b/rpc/client/flows.go @@ -5,8 +5,8 @@ import ( "io" "sync" - "github.com/nspcc-dev/neofs-api-go/rpc/common" - "github.com/nspcc-dev/neofs-api-go/rpc/message" + "github.com/nspcc-dev/neofs-api-go/v2/rpc/common" + "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" ) // SendUnary initializes communication session by RPC info, performs unary RPC diff --git a/rpc/client/init.go b/rpc/client/init.go index aa0d420..27c6199 100644 --- a/rpc/client/init.go +++ b/rpc/client/init.go @@ -3,9 +3,9 @@ package client import ( "io" - "github.com/nspcc-dev/neofs-api-go/rpc/common" - "github.com/nspcc-dev/neofs-api-go/rpc/grpc" - "github.com/nspcc-dev/neofs-api-go/rpc/message" + "github.com/nspcc-dev/neofs-api-go/v2/rpc/common" + "github.com/nspcc-dev/neofs-api-go/v2/rpc/grpc" + "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" ) // MessageReader is an interface of the Message reader. diff --git a/v2/rpc/common.go b/rpc/common.go similarity index 100% rename from v2/rpc/common.go rename to rpc/common.go diff --git a/rpc/common/call_test.go b/rpc/common/call_test.go index e1414e3..aa4898f 100644 --- a/rpc/common/call_test.go +++ b/rpc/common/call_test.go @@ -3,7 +3,7 @@ package common_test import ( "testing" - "github.com/nspcc-dev/neofs-api-go/rpc/common" + "github.com/nspcc-dev/neofs-api-go/v2/rpc/common" "github.com/stretchr/testify/require" ) diff --git a/v2/rpc/container.go b/rpc/container.go similarity index 96% rename from v2/rpc/container.go rename to rpc/container.go index 82dbe8a..219e919 100644 --- a/v2/rpc/container.go +++ b/rpc/container.go @@ -1,9 +1,9 @@ package rpc import ( - "github.com/nspcc-dev/neofs-api-go/rpc/client" - "github.com/nspcc-dev/neofs-api-go/rpc/common" "github.com/nspcc-dev/neofs-api-go/v2/container" + "github.com/nspcc-dev/neofs-api-go/v2/rpc/client" + "github.com/nspcc-dev/neofs-api-go/v2/rpc/common" ) const serviceContainer = serviceNamePrefix + "container.ContainerService" diff --git a/rpc/grpc/init.go b/rpc/grpc/init.go index ec3bc5a..aeb4fb4 100644 --- a/rpc/grpc/init.go +++ b/rpc/grpc/init.go @@ -3,7 +3,7 @@ package grpc import ( "io" - "github.com/nspcc-dev/neofs-api-go/rpc/common" + "github.com/nspcc-dev/neofs-api-go/v2/rpc/common" "google.golang.org/grpc" ) diff --git a/rpc/grpc/util.go b/rpc/grpc/util.go index 150d57d..c7c65e2 100644 --- a/rpc/grpc/util.go +++ b/rpc/grpc/util.go @@ -3,7 +3,7 @@ package grpc import ( "fmt" - "github.com/nspcc-dev/neofs-api-go/rpc/common" + "github.com/nspcc-dev/neofs-api-go/v2/rpc/common" ) const methodNameFmt = "/%s/%s" diff --git a/rpc/message/encoding.go b/rpc/message/encoding.go index 7d9f7e9..4a53b68 100644 --- a/rpc/message/encoding.go +++ b/rpc/message/encoding.go @@ -1,7 +1,7 @@ package message import ( - "github.com/nspcc-dev/neofs-api-go/rpc/grpc" + "github.com/nspcc-dev/neofs-api-go/v2/rpc/grpc" "google.golang.org/protobuf/encoding/protojson" "google.golang.org/protobuf/proto" ) diff --git a/rpc/message/message.go b/rpc/message/message.go index 5cc3702..576559d 100644 --- a/rpc/message/message.go +++ b/rpc/message/message.go @@ -3,7 +3,7 @@ package message import ( "fmt" - "github.com/nspcc-dev/neofs-api-go/rpc/grpc" + "github.com/nspcc-dev/neofs-api-go/v2/rpc/grpc" ) // Message represents raw Protobuf message diff --git a/rpc/message/test/message.go b/rpc/message/test/message.go index 1afa796..e3ce9cd 100644 --- a/rpc/message/test/message.go +++ b/rpc/message/test/message.go @@ -6,7 +6,7 @@ import ( "fmt" "testing" - "github.com/nspcc-dev/neofs-api-go/rpc/message" + "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" "github.com/stretchr/testify/require" ) diff --git a/v2/rpc/netmap.go b/rpc/netmap.go similarity index 91% rename from v2/rpc/netmap.go rename to rpc/netmap.go index 6e68456..b28abef 100644 --- a/v2/rpc/netmap.go +++ b/rpc/netmap.go @@ -1,9 +1,9 @@ package rpc import ( - "github.com/nspcc-dev/neofs-api-go/rpc/client" - "github.com/nspcc-dev/neofs-api-go/rpc/common" "github.com/nspcc-dev/neofs-api-go/v2/netmap" + "github.com/nspcc-dev/neofs-api-go/v2/rpc/client" + "github.com/nspcc-dev/neofs-api-go/v2/rpc/common" ) const serviceNetmap = serviceNamePrefix + "netmap.NetmapService" diff --git a/v2/rpc/object.go b/rpc/object.go similarity index 96% rename from v2/rpc/object.go rename to rpc/object.go index 7e64a61..58faa9f 100644 --- a/v2/rpc/object.go +++ b/rpc/object.go @@ -1,10 +1,10 @@ package rpc import ( - "github.com/nspcc-dev/neofs-api-go/rpc/client" - "github.com/nspcc-dev/neofs-api-go/rpc/common" - "github.com/nspcc-dev/neofs-api-go/rpc/message" "github.com/nspcc-dev/neofs-api-go/v2/object" + "github.com/nspcc-dev/neofs-api-go/v2/rpc/client" + "github.com/nspcc-dev/neofs-api-go/v2/rpc/common" + "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" ) const serviceObject = serviceNamePrefix + "object.ObjectService" diff --git a/v2/rpc/reputation.go b/rpc/reputation.go similarity index 92% rename from v2/rpc/reputation.go rename to rpc/reputation.go index ad9d2d9..9332f10 100644 --- a/v2/rpc/reputation.go +++ b/rpc/reputation.go @@ -1,9 +1,9 @@ package rpc import ( - "github.com/nspcc-dev/neofs-api-go/rpc/client" - "github.com/nspcc-dev/neofs-api-go/rpc/common" "github.com/nspcc-dev/neofs-api-go/v2/reputation" + "github.com/nspcc-dev/neofs-api-go/v2/rpc/client" + "github.com/nspcc-dev/neofs-api-go/v2/rpc/common" ) const serviceReputation = serviceNamePrefix + "reputation.ReputationService" diff --git a/v2/rpc/session.go b/rpc/session.go similarity index 83% rename from v2/rpc/session.go rename to rpc/session.go index 89b5f1c..cdd43c2 100644 --- a/v2/rpc/session.go +++ b/rpc/session.go @@ -1,8 +1,8 @@ package rpc import ( - "github.com/nspcc-dev/neofs-api-go/rpc/client" - "github.com/nspcc-dev/neofs-api-go/rpc/common" + "github.com/nspcc-dev/neofs-api-go/v2/rpc/client" + "github.com/nspcc-dev/neofs-api-go/v2/rpc/common" "github.com/nspcc-dev/neofs-api-go/v2/session" ) diff --git a/v2/session/convert.go b/session/convert.go similarity index 99% rename from v2/session/convert.go rename to session/convert.go index 8015832..df78c9e 100644 --- a/v2/session/convert.go +++ b/session/convert.go @@ -3,12 +3,12 @@ package session import ( "fmt" - "github.com/nspcc-dev/neofs-api-go/rpc/grpc" - "github.com/nspcc-dev/neofs-api-go/rpc/message" "github.com/nspcc-dev/neofs-api-go/v2/acl" aclGRPC "github.com/nspcc-dev/neofs-api-go/v2/acl/grpc" "github.com/nspcc-dev/neofs-api-go/v2/refs" refsGRPC "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" + "github.com/nspcc-dev/neofs-api-go/v2/rpc/grpc" + "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" session "github.com/nspcc-dev/neofs-api-go/v2/session/grpc" "github.com/nspcc-dev/neofs-api-go/v2/status" statusGRPC "github.com/nspcc-dev/neofs-api-go/v2/status/grpc" diff --git a/v2/session/grpc/client.go b/session/grpc/client.go similarity index 100% rename from v2/session/grpc/client.go rename to session/grpc/client.go diff --git a/v2/session/grpc/service.go b/session/grpc/service.go similarity index 100% rename from v2/session/grpc/service.go rename to session/grpc/service.go diff --git a/v2/session/grpc/service.pb.go b/session/grpc/service.pb.go similarity index 100% rename from v2/session/grpc/service.pb.go rename to session/grpc/service.pb.go diff --git a/v2/session/grpc/service_grpc.pb.go b/session/grpc/service_grpc.pb.go similarity index 100% rename from v2/session/grpc/service_grpc.pb.go rename to session/grpc/service_grpc.pb.go diff --git a/v2/session/grpc/types.go b/session/grpc/types.go similarity index 100% rename from v2/session/grpc/types.go rename to session/grpc/types.go diff --git a/v2/session/grpc/types.pb.go b/session/grpc/types.pb.go similarity index 100% rename from v2/session/grpc/types.pb.go rename to session/grpc/types.pb.go diff --git a/v2/session/json.go b/session/json.go similarity index 98% rename from v2/session/json.go rename to session/json.go index be7b9ac..d8056ee 100644 --- a/v2/session/json.go +++ b/session/json.go @@ -1,7 +1,7 @@ package session import ( - "github.com/nspcc-dev/neofs-api-go/rpc/message" + "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" session "github.com/nspcc-dev/neofs-api-go/v2/session/grpc" "google.golang.org/protobuf/encoding/protojson" ) diff --git a/v2/session/marshal.go b/session/marshal.go similarity index 99% rename from v2/session/marshal.go rename to session/marshal.go index 7ffe5e0..9513d4c 100644 --- a/v2/session/marshal.go +++ b/session/marshal.go @@ -1,9 +1,9 @@ package session import ( - "github.com/nspcc-dev/neofs-api-go/rpc/message" - "github.com/nspcc-dev/neofs-api-go/util/proto" + "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" session "github.com/nspcc-dev/neofs-api-go/v2/session/grpc" + "github.com/nspcc-dev/neofs-api-go/v2/util/proto" goproto "google.golang.org/protobuf/proto" ) diff --git a/v2/session/message_test.go b/session/message_test.go similarity index 92% rename from v2/session/message_test.go rename to session/message_test.go index 17c428e..d9294c9 100644 --- a/v2/session/message_test.go +++ b/session/message_test.go @@ -3,8 +3,8 @@ package session_test import ( "testing" - "github.com/nspcc-dev/neofs-api-go/rpc/message" - rpctest "github.com/nspcc-dev/neofs-api-go/rpc/message/test" + "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" + rpctest "github.com/nspcc-dev/neofs-api-go/v2/rpc/message/test" sessiontest "github.com/nspcc-dev/neofs-api-go/v2/session/test" ) diff --git a/v2/session/string.go b/session/string.go similarity index 100% rename from v2/session/string.go rename to session/string.go diff --git a/v2/session/test/generate.go b/session/test/generate.go similarity index 100% rename from v2/session/test/generate.go rename to session/test/generate.go diff --git a/v2/session/types.go b/session/types.go similarity index 100% rename from v2/session/types.go rename to session/types.go diff --git a/v2/session/util.go b/session/util.go similarity index 100% rename from v2/session/util.go rename to session/util.go diff --git a/v2/session/xheaders.go b/session/xheaders.go similarity index 100% rename from v2/session/xheaders.go rename to session/xheaders.go diff --git a/v2/signature/sign.go b/signature/sign.go similarity index 99% rename from v2/signature/sign.go rename to signature/sign.go index 04abab6..7054416 100644 --- a/v2/signature/sign.go +++ b/signature/sign.go @@ -5,7 +5,6 @@ import ( "errors" "fmt" - "github.com/nspcc-dev/neofs-api-go/util/signature" "github.com/nspcc-dev/neofs-api-go/v2/accounting" "github.com/nspcc-dev/neofs-api-go/v2/container" "github.com/nspcc-dev/neofs-api-go/v2/netmap" @@ -13,6 +12,7 @@ import ( "github.com/nspcc-dev/neofs-api-go/v2/refs" "github.com/nspcc-dev/neofs-api-go/v2/reputation" "github.com/nspcc-dev/neofs-api-go/v2/session" + "github.com/nspcc-dev/neofs-api-go/v2/util/signature" ) type serviceRequest interface { diff --git a/v2/signature/sign_test.go b/signature/sign_test.go similarity index 100% rename from v2/signature/sign_test.go rename to signature/sign_test.go diff --git a/v2/storagegroup/convert.go b/storagegroup/convert.go similarity index 91% rename from v2/storagegroup/convert.go rename to storagegroup/convert.go index 61e49d0..489dad3 100644 --- a/v2/storagegroup/convert.go +++ b/storagegroup/convert.go @@ -1,10 +1,10 @@ package storagegroup import ( - "github.com/nspcc-dev/neofs-api-go/rpc/grpc" - "github.com/nspcc-dev/neofs-api-go/rpc/message" "github.com/nspcc-dev/neofs-api-go/v2/refs" refsGRPC "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" + "github.com/nspcc-dev/neofs-api-go/v2/rpc/grpc" + "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" sg "github.com/nspcc-dev/neofs-api-go/v2/storagegroup/grpc" ) diff --git a/v2/storagegroup/grpc/types.go b/storagegroup/grpc/types.go similarity index 100% rename from v2/storagegroup/grpc/types.go rename to storagegroup/grpc/types.go diff --git a/v2/storagegroup/grpc/types.pb.go b/storagegroup/grpc/types.pb.go similarity index 100% rename from v2/storagegroup/grpc/types.pb.go rename to storagegroup/grpc/types.pb.go diff --git a/v2/storagegroup/json.go b/storagegroup/json.go similarity index 86% rename from v2/storagegroup/json.go rename to storagegroup/json.go index 82e97e9..3224835 100644 --- a/v2/storagegroup/json.go +++ b/storagegroup/json.go @@ -1,7 +1,7 @@ package storagegroup import ( - "github.com/nspcc-dev/neofs-api-go/rpc/message" + "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" storagegroup "github.com/nspcc-dev/neofs-api-go/v2/storagegroup/grpc" ) diff --git a/v2/storagegroup/marshal.go b/storagegroup/marshal.go similarity index 93% rename from v2/storagegroup/marshal.go rename to storagegroup/marshal.go index 75b3360..534f6f7 100644 --- a/v2/storagegroup/marshal.go +++ b/storagegroup/marshal.go @@ -1,10 +1,10 @@ package storagegroup import ( - "github.com/nspcc-dev/neofs-api-go/rpc/message" - "github.com/nspcc-dev/neofs-api-go/util/proto" "github.com/nspcc-dev/neofs-api-go/v2/refs" + "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" storagegroup "github.com/nspcc-dev/neofs-api-go/v2/storagegroup/grpc" + "github.com/nspcc-dev/neofs-api-go/v2/util/proto" ) const ( diff --git a/v2/storagegroup/message_test.go b/storagegroup/message_test.go similarity index 70% rename from v2/storagegroup/message_test.go rename to storagegroup/message_test.go index 3a787d2..0eb65ef 100644 --- a/v2/storagegroup/message_test.go +++ b/storagegroup/message_test.go @@ -3,8 +3,8 @@ package storagegroup_test import ( "testing" - "github.com/nspcc-dev/neofs-api-go/rpc/message" - messagetest "github.com/nspcc-dev/neofs-api-go/rpc/message/test" + "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" + messagetest "github.com/nspcc-dev/neofs-api-go/v2/rpc/message/test" storagegrouptest "github.com/nspcc-dev/neofs-api-go/v2/storagegroup/test" ) diff --git a/v2/storagegroup/test/generate.go b/storagegroup/test/generate.go similarity index 100% rename from v2/storagegroup/test/generate.go rename to storagegroup/test/generate.go diff --git a/v2/storagegroup/types.go b/storagegroup/types.go similarity index 100% rename from v2/storagegroup/types.go rename to storagegroup/types.go diff --git a/v2/tombstone/convert.go b/tombstone/convert.go similarity index 88% rename from v2/tombstone/convert.go rename to tombstone/convert.go index 204c0a3..beb92a7 100644 --- a/v2/tombstone/convert.go +++ b/tombstone/convert.go @@ -1,9 +1,9 @@ package tombstone import ( - "github.com/nspcc-dev/neofs-api-go/rpc/grpc" - "github.com/nspcc-dev/neofs-api-go/rpc/message" "github.com/nspcc-dev/neofs-api-go/v2/refs" + "github.com/nspcc-dev/neofs-api-go/v2/rpc/grpc" + "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" tombstone "github.com/nspcc-dev/neofs-api-go/v2/tombstone/grpc" ) diff --git a/v2/tombstone/grpc/types.go b/tombstone/grpc/types.go similarity index 100% rename from v2/tombstone/grpc/types.go rename to tombstone/grpc/types.go diff --git a/v2/tombstone/grpc/types.pb.go b/tombstone/grpc/types.pb.go similarity index 100% rename from v2/tombstone/grpc/types.pb.go rename to tombstone/grpc/types.pb.go diff --git a/v2/tombstone/json.go b/tombstone/json.go similarity index 85% rename from v2/tombstone/json.go rename to tombstone/json.go index be89a1c..28ffc1b 100644 --- a/v2/tombstone/json.go +++ b/tombstone/json.go @@ -1,7 +1,7 @@ package tombstone import ( - "github.com/nspcc-dev/neofs-api-go/rpc/message" + "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" tombstone "github.com/nspcc-dev/neofs-api-go/v2/tombstone/grpc" ) diff --git a/v2/tombstone/marshal.go b/tombstone/marshal.go similarity index 93% rename from v2/tombstone/marshal.go rename to tombstone/marshal.go index eb5bb38..f39d5d9 100644 --- a/v2/tombstone/marshal.go +++ b/tombstone/marshal.go @@ -1,9 +1,9 @@ package tombstone import ( - "github.com/nspcc-dev/neofs-api-go/rpc/message" - "github.com/nspcc-dev/neofs-api-go/util/proto" + "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" tombstone "github.com/nspcc-dev/neofs-api-go/v2/tombstone/grpc" + "github.com/nspcc-dev/neofs-api-go/v2/util/proto" ) const ( diff --git a/v2/tombstone/message_test.go b/tombstone/message_test.go similarity index 69% rename from v2/tombstone/message_test.go rename to tombstone/message_test.go index 4609cdd..858cb01 100644 --- a/v2/tombstone/message_test.go +++ b/tombstone/message_test.go @@ -3,8 +3,8 @@ package tombstone_test import ( "testing" - "github.com/nspcc-dev/neofs-api-go/rpc/message" - messagetest "github.com/nspcc-dev/neofs-api-go/rpc/message/test" + "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" + messagetest "github.com/nspcc-dev/neofs-api-go/v2/rpc/message/test" tombstonetest "github.com/nspcc-dev/neofs-api-go/v2/tombstone/test" ) diff --git a/v2/tombstone/test/generate.go b/tombstone/test/generate.go similarity index 100% rename from v2/tombstone/test/generate.go rename to tombstone/test/generate.go diff --git a/v2/tombstone/types.go b/tombstone/types.go similarity index 100% rename from v2/tombstone/types.go rename to tombstone/types.go diff --git a/util/proto/marshal_test.go b/util/proto/marshal_test.go index 5095964..ba78c00 100644 --- a/util/proto/marshal_test.go +++ b/util/proto/marshal_test.go @@ -5,8 +5,8 @@ import ( "math" "testing" - "github.com/nspcc-dev/neofs-api-go/util/proto" - "github.com/nspcc-dev/neofs-api-go/util/proto/test" + "github.com/nspcc-dev/neofs-api-go/v2/util/proto" + "github.com/nspcc-dev/neofs-api-go/v2/util/proto/test" "github.com/stretchr/testify/require" goproto "google.golang.org/protobuf/proto" ) From 180da74e5c44e9491add7c3ee0d8890c4969fe55 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 17 Nov 2021 12:35:21 +0300 Subject: [PATCH 0921/1196] Place compiled proto files to root dir Remove `v2` prefix from `prepare.sh` script. Signed-off-by: Leonard Lyubich --- util/proto/test/test.proto | 33 --------------------------------- 1 file changed, 33 deletions(-) delete mode 100644 util/proto/test/test.proto diff --git a/util/proto/test/test.proto b/util/proto/test/test.proto deleted file mode 100644 index c568a31..0000000 --- a/util/proto/test/test.proto +++ /dev/null @@ -1,33 +0,0 @@ -syntax = "proto3"; - -package test; - -option go_package = "util/proto/test"; - -message Primitives { - bytes field_a = 1; - string field_b = 2; - bool field_c = 200; - int32 field_d = 201; - uint32 field_e = 202; - int64 field_f = 203; - uint64 field_g = 204; - fixed64 field_i = 205; - double field_j = 206; - - enum SomeEnum { - UNKNOWN = 0; - POSITIVE = 1; - NEGATIVE = -1; - } - SomeEnum field_h = 300; -} - -message RepPrimitives { - repeated bytes field_a = 1; - repeated string field_b = 2; - repeated int32 field_c = 3; - repeated uint32 field_d = 4; - repeated int64 field_e = 5; - repeated uint64 field_f = 6; -} \ No newline at end of file From 0f09f0dfc61037ba61c711489c87a38647619411 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 17 Nov 2021 12:35:56 +0300 Subject: [PATCH 0922/1196] Re-compile NeoFS API proto files using updated script Signed-off-by: Leonard Lyubich --- accounting/grpc/service.pb.go | 199 +++-- accounting/grpc/service_grpc.pb.go | 2 +- accounting/grpc/types.pb.go | 83 +- acl/grpc/types.pb.go | 337 ++++---- audit/grpc/types.pb.go | 138 +-- container/grpc/service.pb.go | 899 ++++++++++--------- container/grpc/service_grpc.pb.go | 2 +- container/grpc/types.pb.go | 135 ++- netmap/grpc/service.pb.go | 291 ++++--- netmap/grpc/service_grpc.pb.go | 2 +- netmap/grpc/types.pb.go | 338 ++++---- object/grpc/service.pb.go | 1043 +++++++++++------------ object/grpc/service_grpc.pb.go | 2 +- {v2/object => object}/grpc/status.pb.go | 0 object/grpc/types.pb.go | 370 ++++---- prepare.sh | 11 +- refs/grpc/types.pb.go | 191 +++-- reputation/grpc/service.pb.go | 310 +++---- reputation/grpc/service_grpc.pb.go | 2 +- reputation/grpc/types.pb.go | 180 ++-- session/grpc/service.pb.go | 191 +++-- session/grpc/service_grpc.pb.go | 2 +- session/grpc/types.pb.go | 461 +++++----- {v2/status => status}/convert.go | 4 +- {v2/status => status}/grpc/types.go | 0 {v2/status => status}/grpc/types.pb.go | 0 {v2/status => status}/marshal.go | 4 +- {v2/status => status}/message_test.go | 4 +- {v2/status => status}/status.go | 0 {v2/status => status}/test/generate.go | 0 {v2/status => status}/types.go | 0 storagegroup/grpc/types.pb.go | 106 +-- tombstone/grpc/types.pb.go | 94 +- 33 files changed, 2694 insertions(+), 2707 deletions(-) rename {v2/object => object}/grpc/status.pb.go (100%) rename {v2/status => status}/convert.go (93%) rename {v2/status => status}/grpc/types.go (100%) rename {v2/status => status}/grpc/types.pb.go (100%) rename {v2/status => status}/marshal.go (94%) rename {v2/status => status}/message_test.go (73%) rename {v2/status => status}/status.go (100%) rename {v2/status => status}/test/generate.go (100%) rename {v2/status => status}/types.go (100%) diff --git a/accounting/grpc/service.pb.go b/accounting/grpc/service.pb.go index 68485e4..bdd0925 100644 --- a/accounting/grpc/service.pb.go +++ b/accounting/grpc/service.pb.go @@ -2,7 +2,7 @@ // versions: // protoc-gen-go v1.27.1 // protoc v3.18.0 -// source: v2/accounting/grpc/service.proto +// source: accounting/grpc/service.proto package accounting @@ -42,7 +42,7 @@ type BalanceRequest struct { func (x *BalanceRequest) Reset() { *x = BalanceRequest{} if protoimpl.UnsafeEnabled { - mi := &file_v2_accounting_grpc_service_proto_msgTypes[0] + mi := &file_accounting_grpc_service_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -55,7 +55,7 @@ func (x *BalanceRequest) String() string { func (*BalanceRequest) ProtoMessage() {} func (x *BalanceRequest) ProtoReflect() protoreflect.Message { - mi := &file_v2_accounting_grpc_service_proto_msgTypes[0] + mi := &file_accounting_grpc_service_proto_msgTypes[0] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -68,7 +68,7 @@ func (x *BalanceRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use BalanceRequest.ProtoReflect.Descriptor instead. func (*BalanceRequest) Descriptor() ([]byte, []int) { - return file_v2_accounting_grpc_service_proto_rawDescGZIP(), []int{0} + return file_accounting_grpc_service_proto_rawDescGZIP(), []int{0} } func (x *BalanceRequest) GetBody() *BalanceRequest_Body { @@ -112,7 +112,7 @@ type BalanceResponse struct { func (x *BalanceResponse) Reset() { *x = BalanceResponse{} if protoimpl.UnsafeEnabled { - mi := &file_v2_accounting_grpc_service_proto_msgTypes[1] + mi := &file_accounting_grpc_service_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -125,7 +125,7 @@ func (x *BalanceResponse) String() string { func (*BalanceResponse) ProtoMessage() {} func (x *BalanceResponse) ProtoReflect() protoreflect.Message { - mi := &file_v2_accounting_grpc_service_proto_msgTypes[1] + mi := &file_accounting_grpc_service_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -138,7 +138,7 @@ func (x *BalanceResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use BalanceResponse.ProtoReflect.Descriptor instead. func (*BalanceResponse) Descriptor() ([]byte, []int) { - return file_v2_accounting_grpc_service_proto_rawDescGZIP(), []int{1} + return file_accounting_grpc_service_proto_rawDescGZIP(), []int{1} } func (x *BalanceResponse) GetBody() *BalanceResponse_Body { @@ -179,7 +179,7 @@ type BalanceRequest_Body struct { func (x *BalanceRequest_Body) Reset() { *x = BalanceRequest_Body{} if protoimpl.UnsafeEnabled { - mi := &file_v2_accounting_grpc_service_proto_msgTypes[2] + mi := &file_accounting_grpc_service_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -192,7 +192,7 @@ func (x *BalanceRequest_Body) String() string { func (*BalanceRequest_Body) ProtoMessage() {} func (x *BalanceRequest_Body) ProtoReflect() protoreflect.Message { - mi := &file_v2_accounting_grpc_service_proto_msgTypes[2] + mi := &file_accounting_grpc_service_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -205,7 +205,7 @@ func (x *BalanceRequest_Body) ProtoReflect() protoreflect.Message { // Deprecated: Use BalanceRequest_Body.ProtoReflect.Descriptor instead. func (*BalanceRequest_Body) Descriptor() ([]byte, []int) { - return file_v2_accounting_grpc_service_proto_rawDescGZIP(), []int{0, 0} + return file_accounting_grpc_service_proto_rawDescGZIP(), []int{0, 0} } func (x *BalanceRequest_Body) GetOwnerId() *grpc1.OwnerID { @@ -229,7 +229,7 @@ type BalanceResponse_Body struct { func (x *BalanceResponse_Body) Reset() { *x = BalanceResponse_Body{} if protoimpl.UnsafeEnabled { - mi := &file_v2_accounting_grpc_service_proto_msgTypes[3] + mi := &file_accounting_grpc_service_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -242,7 +242,7 @@ func (x *BalanceResponse_Body) String() string { func (*BalanceResponse_Body) ProtoMessage() {} func (x *BalanceResponse_Body) ProtoReflect() protoreflect.Message { - mi := &file_v2_accounting_grpc_service_proto_msgTypes[3] + mi := &file_accounting_grpc_service_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -255,7 +255,7 @@ func (x *BalanceResponse_Body) ProtoReflect() protoreflect.Message { // Deprecated: Use BalanceResponse_Body.ProtoReflect.Descriptor instead. func (*BalanceResponse_Body) Descriptor() ([]byte, []int) { - return file_v2_accounting_grpc_service_proto_rawDescGZIP(), []int{1, 0} + return file_accounting_grpc_service_proto_rawDescGZIP(), []int{1, 0} } func (x *BalanceResponse_Body) GetBalance() *Decimal { @@ -265,86 +265,85 @@ func (x *BalanceResponse_Body) GetBalance() *Decimal { return nil } -var File_v2_accounting_grpc_service_proto protoreflect.FileDescriptor +var File_accounting_grpc_service_proto protoreflect.FileDescriptor -var file_v2_accounting_grpc_service_proto_rawDesc = []byte{ - 0x0a, 0x20, 0x76, 0x32, 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, 0x1e, 0x76, 0x32, 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, 0x18, 0x76, 0x32, 0x2f, 0x72, 0x65, 0x66, - 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x1a, 0x1b, 0x76, 0x32, 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, +var file_accounting_grpc_service_proto_rawDesc = []byte{ + 0x0a, 0x1d, 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, 0x1b, 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, 0x15, 0x72, 0x65, 0x66, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, + 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x18, 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, 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, 0x62, 0x5a, 0x3f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, - 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, - 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 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, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x33, + 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, 0x62, 0x5a, 0x3f, 0x67, 0x69, 0x74, + 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, + 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, + 0x32, 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, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( - file_v2_accounting_grpc_service_proto_rawDescOnce sync.Once - file_v2_accounting_grpc_service_proto_rawDescData = file_v2_accounting_grpc_service_proto_rawDesc + file_accounting_grpc_service_proto_rawDescOnce sync.Once + file_accounting_grpc_service_proto_rawDescData = file_accounting_grpc_service_proto_rawDesc ) -func file_v2_accounting_grpc_service_proto_rawDescGZIP() []byte { - file_v2_accounting_grpc_service_proto_rawDescOnce.Do(func() { - file_v2_accounting_grpc_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_v2_accounting_grpc_service_proto_rawDescData) +func file_accounting_grpc_service_proto_rawDescGZIP() []byte { + file_accounting_grpc_service_proto_rawDescOnce.Do(func() { + file_accounting_grpc_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_accounting_grpc_service_proto_rawDescData) }) - return file_v2_accounting_grpc_service_proto_rawDescData + return file_accounting_grpc_service_proto_rawDescData } -var file_v2_accounting_grpc_service_proto_msgTypes = make([]protoimpl.MessageInfo, 4) -var file_v2_accounting_grpc_service_proto_goTypes = []interface{}{ +var file_accounting_grpc_service_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_accounting_grpc_service_proto_goTypes = []interface{}{ (*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 @@ -356,7 +355,7 @@ var file_v2_accounting_grpc_service_proto_goTypes = []interface{}{ (*grpc1.OwnerID)(nil), // 8: neo.fs.v2.refs.OwnerID (*Decimal)(nil), // 9: neo.fs.v2.accounting.Decimal } -var file_v2_accounting_grpc_service_proto_depIdxs = []int32{ +var file_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 @@ -374,14 +373,14 @@ var file_v2_accounting_grpc_service_proto_depIdxs = []int32{ 0, // [0:8] is the sub-list for field type_name } -func init() { file_v2_accounting_grpc_service_proto_init() } -func file_v2_accounting_grpc_service_proto_init() { - if File_v2_accounting_grpc_service_proto != nil { +func init() { file_accounting_grpc_service_proto_init() } +func file_accounting_grpc_service_proto_init() { + if File_accounting_grpc_service_proto != nil { return } - file_v2_accounting_grpc_types_proto_init() + file_accounting_grpc_types_proto_init() if !protoimpl.UnsafeEnabled { - file_v2_accounting_grpc_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_accounting_grpc_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*BalanceRequest); i { case 0: return &v.state @@ -393,7 +392,7 @@ func file_v2_accounting_grpc_service_proto_init() { return nil } } - file_v2_accounting_grpc_service_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_accounting_grpc_service_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*BalanceResponse); i { case 0: return &v.state @@ -405,7 +404,7 @@ func file_v2_accounting_grpc_service_proto_init() { return nil } } - file_v2_accounting_grpc_service_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + file_accounting_grpc_service_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*BalanceRequest_Body); i { case 0: return &v.state @@ -417,7 +416,7 @@ func file_v2_accounting_grpc_service_proto_init() { return nil } } - file_v2_accounting_grpc_service_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + file_accounting_grpc_service_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*BalanceResponse_Body); i { case 0: return &v.state @@ -434,18 +433,18 @@ func file_v2_accounting_grpc_service_proto_init() { out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_v2_accounting_grpc_service_proto_rawDesc, + RawDescriptor: file_accounting_grpc_service_proto_rawDesc, NumEnums: 0, NumMessages: 4, NumExtensions: 0, NumServices: 1, }, - GoTypes: file_v2_accounting_grpc_service_proto_goTypes, - DependencyIndexes: file_v2_accounting_grpc_service_proto_depIdxs, - MessageInfos: file_v2_accounting_grpc_service_proto_msgTypes, + GoTypes: file_accounting_grpc_service_proto_goTypes, + DependencyIndexes: file_accounting_grpc_service_proto_depIdxs, + MessageInfos: file_accounting_grpc_service_proto_msgTypes, }.Build() - File_v2_accounting_grpc_service_proto = out.File - file_v2_accounting_grpc_service_proto_rawDesc = nil - file_v2_accounting_grpc_service_proto_goTypes = nil - file_v2_accounting_grpc_service_proto_depIdxs = nil + File_accounting_grpc_service_proto = out.File + file_accounting_grpc_service_proto_rawDesc = nil + file_accounting_grpc_service_proto_goTypes = nil + file_accounting_grpc_service_proto_depIdxs = nil } diff --git a/accounting/grpc/service_grpc.pb.go b/accounting/grpc/service_grpc.pb.go index 44b24a8..7139614 100644 --- a/accounting/grpc/service_grpc.pb.go +++ b/accounting/grpc/service_grpc.pb.go @@ -107,5 +107,5 @@ var AccountingService_ServiceDesc = grpc.ServiceDesc{ }, }, Streams: []grpc.StreamDesc{}, - Metadata: "v2/accounting/grpc/service.proto", + Metadata: "accounting/grpc/service.proto", } diff --git a/accounting/grpc/types.pb.go b/accounting/grpc/types.pb.go index 2028639..5a65e84 100644 --- a/accounting/grpc/types.pb.go +++ b/accounting/grpc/types.pb.go @@ -2,7 +2,7 @@ // versions: // protoc-gen-go v1.27.1 // protoc v3.18.0 -// source: v2/accounting/grpc/types.proto +// source: accounting/grpc/types.proto package accounting @@ -42,7 +42,7 @@ type Decimal struct { func (x *Decimal) Reset() { *x = Decimal{} if protoimpl.UnsafeEnabled { - mi := &file_v2_accounting_grpc_types_proto_msgTypes[0] + mi := &file_accounting_grpc_types_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -55,7 +55,7 @@ func (x *Decimal) String() string { func (*Decimal) ProtoMessage() {} func (x *Decimal) ProtoReflect() protoreflect.Message { - mi := &file_v2_accounting_grpc_types_proto_msgTypes[0] + mi := &file_accounting_grpc_types_proto_msgTypes[0] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -68,7 +68,7 @@ func (x *Decimal) ProtoReflect() protoreflect.Message { // Deprecated: Use Decimal.ProtoReflect.Descriptor instead. func (*Decimal) Descriptor() ([]byte, []int) { - return file_v2_accounting_grpc_types_proto_rawDescGZIP(), []int{0} + return file_accounting_grpc_types_proto_rawDescGZIP(), []int{0} } func (x *Decimal) GetValue() int64 { @@ -85,43 +85,42 @@ func (x *Decimal) GetPrecision() uint32 { return 0 } -var File_v2_accounting_grpc_types_proto protoreflect.FileDescriptor +var File_accounting_grpc_types_proto protoreflect.FileDescriptor -var file_v2_accounting_grpc_types_proto_rawDesc = []byte{ - 0x0a, 0x1e, 0x76, 0x32, 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, 0x62, 0x5a, 0x3f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, - 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, - 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 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, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x33, +var file_accounting_grpc_types_proto_rawDesc = []byte{ + 0x0a, 0x1b, 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, 0x62, 0x5a, 0x3f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, + 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, + 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 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, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( - file_v2_accounting_grpc_types_proto_rawDescOnce sync.Once - file_v2_accounting_grpc_types_proto_rawDescData = file_v2_accounting_grpc_types_proto_rawDesc + file_accounting_grpc_types_proto_rawDescOnce sync.Once + file_accounting_grpc_types_proto_rawDescData = file_accounting_grpc_types_proto_rawDesc ) -func file_v2_accounting_grpc_types_proto_rawDescGZIP() []byte { - file_v2_accounting_grpc_types_proto_rawDescOnce.Do(func() { - file_v2_accounting_grpc_types_proto_rawDescData = protoimpl.X.CompressGZIP(file_v2_accounting_grpc_types_proto_rawDescData) +func file_accounting_grpc_types_proto_rawDescGZIP() []byte { + file_accounting_grpc_types_proto_rawDescOnce.Do(func() { + file_accounting_grpc_types_proto_rawDescData = protoimpl.X.CompressGZIP(file_accounting_grpc_types_proto_rawDescData) }) - return file_v2_accounting_grpc_types_proto_rawDescData + return file_accounting_grpc_types_proto_rawDescData } -var file_v2_accounting_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_v2_accounting_grpc_types_proto_goTypes = []interface{}{ +var file_accounting_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_accounting_grpc_types_proto_goTypes = []interface{}{ (*Decimal)(nil), // 0: neo.fs.v2.accounting.Decimal } -var file_v2_accounting_grpc_types_proto_depIdxs = []int32{ +var file_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 @@ -129,13 +128,13 @@ var file_v2_accounting_grpc_types_proto_depIdxs = []int32{ 0, // [0:0] is the sub-list for field type_name } -func init() { file_v2_accounting_grpc_types_proto_init() } -func file_v2_accounting_grpc_types_proto_init() { - if File_v2_accounting_grpc_types_proto != nil { +func init() { file_accounting_grpc_types_proto_init() } +func file_accounting_grpc_types_proto_init() { + if File_accounting_grpc_types_proto != nil { return } if !protoimpl.UnsafeEnabled { - file_v2_accounting_grpc_types_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_accounting_grpc_types_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Decimal); i { case 0: return &v.state @@ -152,18 +151,18 @@ func file_v2_accounting_grpc_types_proto_init() { out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_v2_accounting_grpc_types_proto_rawDesc, + RawDescriptor: file_accounting_grpc_types_proto_rawDesc, NumEnums: 0, NumMessages: 1, NumExtensions: 0, NumServices: 0, }, - GoTypes: file_v2_accounting_grpc_types_proto_goTypes, - DependencyIndexes: file_v2_accounting_grpc_types_proto_depIdxs, - MessageInfos: file_v2_accounting_grpc_types_proto_msgTypes, + GoTypes: file_accounting_grpc_types_proto_goTypes, + DependencyIndexes: file_accounting_grpc_types_proto_depIdxs, + MessageInfos: file_accounting_grpc_types_proto_msgTypes, }.Build() - File_v2_accounting_grpc_types_proto = out.File - file_v2_accounting_grpc_types_proto_rawDesc = nil - file_v2_accounting_grpc_types_proto_goTypes = nil - file_v2_accounting_grpc_types_proto_depIdxs = nil + File_accounting_grpc_types_proto = out.File + file_accounting_grpc_types_proto_rawDesc = nil + file_accounting_grpc_types_proto_goTypes = nil + file_accounting_grpc_types_proto_depIdxs = nil } diff --git a/acl/grpc/types.pb.go b/acl/grpc/types.pb.go index 8121686..4af5520 100644 --- a/acl/grpc/types.pb.go +++ b/acl/grpc/types.pb.go @@ -2,7 +2,7 @@ // versions: // protoc-gen-go v1.27.1 // protoc v3.18.0 -// source: v2/acl/grpc/types.proto +// source: acl/grpc/types.proto package acl @@ -63,11 +63,11 @@ func (x Role) String() string { } func (Role) Descriptor() protoreflect.EnumDescriptor { - return file_v2_acl_grpc_types_proto_enumTypes[0].Descriptor() + return file_acl_grpc_types_proto_enumTypes[0].Descriptor() } func (Role) Type() protoreflect.EnumType { - return &file_v2_acl_grpc_types_proto_enumTypes[0] + return &file_acl_grpc_types_proto_enumTypes[0] } func (x Role) Number() protoreflect.EnumNumber { @@ -76,7 +76,7 @@ func (x Role) Number() protoreflect.EnumNumber { // Deprecated: Use Role.Descriptor instead. func (Role) EnumDescriptor() ([]byte, []int) { - return file_v2_acl_grpc_types_proto_rawDescGZIP(), []int{0} + return file_acl_grpc_types_proto_rawDescGZIP(), []int{0} } // MatchType is an enumeration of match types. @@ -116,11 +116,11 @@ func (x MatchType) String() string { } func (MatchType) Descriptor() protoreflect.EnumDescriptor { - return file_v2_acl_grpc_types_proto_enumTypes[1].Descriptor() + return file_acl_grpc_types_proto_enumTypes[1].Descriptor() } func (MatchType) Type() protoreflect.EnumType { - return &file_v2_acl_grpc_types_proto_enumTypes[1] + return &file_acl_grpc_types_proto_enumTypes[1] } func (x MatchType) Number() protoreflect.EnumNumber { @@ -129,7 +129,7 @@ func (x MatchType) Number() protoreflect.EnumNumber { // Deprecated: Use MatchType.Descriptor instead. func (MatchType) EnumDescriptor() ([]byte, []int) { - return file_v2_acl_grpc_types_proto_rawDescGZIP(), []int{1} + return file_acl_grpc_types_proto_rawDescGZIP(), []int{1} } // Request's operation type to match if the rule is applicable to a particular @@ -190,11 +190,11 @@ func (x Operation) String() string { } func (Operation) Descriptor() protoreflect.EnumDescriptor { - return file_v2_acl_grpc_types_proto_enumTypes[2].Descriptor() + return file_acl_grpc_types_proto_enumTypes[2].Descriptor() } func (Operation) Type() protoreflect.EnumType { - return &file_v2_acl_grpc_types_proto_enumTypes[2] + return &file_acl_grpc_types_proto_enumTypes[2] } func (x Operation) Number() protoreflect.EnumNumber { @@ -203,7 +203,7 @@ func (x Operation) Number() protoreflect.EnumNumber { // Deprecated: Use Operation.Descriptor instead. func (Operation) EnumDescriptor() ([]byte, []int) { - return file_v2_acl_grpc_types_proto_rawDescGZIP(), []int{2} + return file_acl_grpc_types_proto_rawDescGZIP(), []int{2} } // Rule execution result action. Either allows or denies access if the rule's @@ -244,11 +244,11 @@ func (x Action) String() string { } func (Action) Descriptor() protoreflect.EnumDescriptor { - return file_v2_acl_grpc_types_proto_enumTypes[3].Descriptor() + return file_acl_grpc_types_proto_enumTypes[3].Descriptor() } func (Action) Type() protoreflect.EnumType { - return &file_v2_acl_grpc_types_proto_enumTypes[3] + return &file_acl_grpc_types_proto_enumTypes[3] } func (x Action) Number() protoreflect.EnumNumber { @@ -257,7 +257,7 @@ func (x Action) Number() protoreflect.EnumNumber { // Deprecated: Use Action.Descriptor instead. func (Action) EnumDescriptor() ([]byte, []int) { - return file_v2_acl_grpc_types_proto_rawDescGZIP(), []int{3} + return file_acl_grpc_types_proto_rawDescGZIP(), []int{3} } // Enumeration of possible sources of Headers to apply filters. @@ -302,11 +302,11 @@ func (x HeaderType) String() string { } func (HeaderType) Descriptor() protoreflect.EnumDescriptor { - return file_v2_acl_grpc_types_proto_enumTypes[4].Descriptor() + return file_acl_grpc_types_proto_enumTypes[4].Descriptor() } func (HeaderType) Type() protoreflect.EnumType { - return &file_v2_acl_grpc_types_proto_enumTypes[4] + return &file_acl_grpc_types_proto_enumTypes[4] } func (x HeaderType) Number() protoreflect.EnumNumber { @@ -315,7 +315,7 @@ func (x HeaderType) Number() protoreflect.EnumNumber { // Deprecated: Use HeaderType.Descriptor instead. func (HeaderType) EnumDescriptor() ([]byte, []int) { - return file_v2_acl_grpc_types_proto_rawDescGZIP(), []int{4} + return file_acl_grpc_types_proto_rawDescGZIP(), []int{4} } // Describes a single eACL rule. @@ -337,7 +337,7 @@ type EACLRecord struct { func (x *EACLRecord) Reset() { *x = EACLRecord{} if protoimpl.UnsafeEnabled { - mi := &file_v2_acl_grpc_types_proto_msgTypes[0] + mi := &file_acl_grpc_types_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -350,7 +350,7 @@ func (x *EACLRecord) String() string { func (*EACLRecord) ProtoMessage() {} func (x *EACLRecord) ProtoReflect() protoreflect.Message { - mi := &file_v2_acl_grpc_types_proto_msgTypes[0] + mi := &file_acl_grpc_types_proto_msgTypes[0] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -363,7 +363,7 @@ func (x *EACLRecord) ProtoReflect() protoreflect.Message { // Deprecated: Use EACLRecord.ProtoReflect.Descriptor instead. func (*EACLRecord) Descriptor() ([]byte, []int) { - return file_v2_acl_grpc_types_proto_rawDescGZIP(), []int{0} + return file_acl_grpc_types_proto_rawDescGZIP(), []int{0} } func (x *EACLRecord) GetOperation() Operation { @@ -415,7 +415,7 @@ type EACLTable struct { func (x *EACLTable) Reset() { *x = EACLTable{} if protoimpl.UnsafeEnabled { - mi := &file_v2_acl_grpc_types_proto_msgTypes[1] + mi := &file_acl_grpc_types_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -428,7 +428,7 @@ func (x *EACLTable) String() string { func (*EACLTable) ProtoMessage() {} func (x *EACLTable) ProtoReflect() protoreflect.Message { - mi := &file_v2_acl_grpc_types_proto_msgTypes[1] + mi := &file_acl_grpc_types_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -441,7 +441,7 @@ func (x *EACLTable) ProtoReflect() protoreflect.Message { // Deprecated: Use EACLTable.ProtoReflect.Descriptor instead. func (*EACLTable) Descriptor() ([]byte, []int) { - return file_v2_acl_grpc_types_proto_rawDescGZIP(), []int{1} + return file_acl_grpc_types_proto_rawDescGZIP(), []int{1} } func (x *EACLTable) GetVersion() *grpc.Version { @@ -488,7 +488,7 @@ type BearerToken struct { func (x *BearerToken) Reset() { *x = BearerToken{} if protoimpl.UnsafeEnabled { - mi := &file_v2_acl_grpc_types_proto_msgTypes[2] + mi := &file_acl_grpc_types_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -501,7 +501,7 @@ func (x *BearerToken) String() string { func (*BearerToken) ProtoMessage() {} func (x *BearerToken) ProtoReflect() protoreflect.Message { - mi := &file_v2_acl_grpc_types_proto_msgTypes[2] + mi := &file_acl_grpc_types_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -514,7 +514,7 @@ func (x *BearerToken) ProtoReflect() protoreflect.Message { // Deprecated: Use BearerToken.ProtoReflect.Descriptor instead. func (*BearerToken) Descriptor() ([]byte, []int) { - return file_v2_acl_grpc_types_proto_rawDescGZIP(), []int{2} + return file_acl_grpc_types_proto_rawDescGZIP(), []int{2} } func (x *BearerToken) GetBody() *BearerToken_Body { @@ -579,7 +579,7 @@ type EACLRecord_Filter struct { func (x *EACLRecord_Filter) Reset() { *x = EACLRecord_Filter{} if protoimpl.UnsafeEnabled { - mi := &file_v2_acl_grpc_types_proto_msgTypes[3] + mi := &file_acl_grpc_types_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -592,7 +592,7 @@ func (x *EACLRecord_Filter) String() string { func (*EACLRecord_Filter) ProtoMessage() {} func (x *EACLRecord_Filter) ProtoReflect() protoreflect.Message { - mi := &file_v2_acl_grpc_types_proto_msgTypes[3] + mi := &file_acl_grpc_types_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -605,7 +605,7 @@ func (x *EACLRecord_Filter) ProtoReflect() protoreflect.Message { // Deprecated: Use EACLRecord_Filter.ProtoReflect.Descriptor instead. func (*EACLRecord_Filter) Descriptor() ([]byte, []int) { - return file_v2_acl_grpc_types_proto_rawDescGZIP(), []int{0, 0} + return file_acl_grpc_types_proto_rawDescGZIP(), []int{0, 0} } func (x *EACLRecord_Filter) GetHeaderType() HeaderType { @@ -652,7 +652,7 @@ type EACLRecord_Target struct { func (x *EACLRecord_Target) Reset() { *x = EACLRecord_Target{} if protoimpl.UnsafeEnabled { - mi := &file_v2_acl_grpc_types_proto_msgTypes[4] + mi := &file_acl_grpc_types_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -665,7 +665,7 @@ func (x *EACLRecord_Target) String() string { func (*EACLRecord_Target) ProtoMessage() {} func (x *EACLRecord_Target) ProtoReflect() protoreflect.Message { - mi := &file_v2_acl_grpc_types_proto_msgTypes[4] + mi := &file_acl_grpc_types_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -678,7 +678,7 @@ func (x *EACLRecord_Target) ProtoReflect() protoreflect.Message { // Deprecated: Use EACLRecord_Target.ProtoReflect.Descriptor instead. func (*EACLRecord_Target) Descriptor() ([]byte, []int) { - return file_v2_acl_grpc_types_proto_rawDescGZIP(), []int{0, 1} + return file_acl_grpc_types_proto_rawDescGZIP(), []int{0, 1} } func (x *EACLRecord_Target) GetRole() Role { @@ -715,7 +715,7 @@ type BearerToken_Body struct { func (x *BearerToken_Body) Reset() { *x = BearerToken_Body{} if protoimpl.UnsafeEnabled { - mi := &file_v2_acl_grpc_types_proto_msgTypes[5] + mi := &file_acl_grpc_types_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -728,7 +728,7 @@ func (x *BearerToken_Body) String() string { func (*BearerToken_Body) ProtoMessage() {} func (x *BearerToken_Body) ProtoReflect() protoreflect.Message { - mi := &file_v2_acl_grpc_types_proto_msgTypes[5] + mi := &file_acl_grpc_types_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -741,7 +741,7 @@ func (x *BearerToken_Body) ProtoReflect() protoreflect.Message { // Deprecated: Use BearerToken_Body.ProtoReflect.Descriptor instead. func (*BearerToken_Body) Descriptor() ([]byte, []int) { - return file_v2_acl_grpc_types_proto_rawDescGZIP(), []int{2, 0} + return file_acl_grpc_types_proto_rawDescGZIP(), []int{2, 0} } func (x *BearerToken_Body) GetEaclTable() *EACLTable { @@ -783,7 +783,7 @@ type BearerToken_Body_TokenLifetime struct { func (x *BearerToken_Body_TokenLifetime) Reset() { *x = BearerToken_Body_TokenLifetime{} if protoimpl.UnsafeEnabled { - mi := &file_v2_acl_grpc_types_proto_msgTypes[6] + mi := &file_acl_grpc_types_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -796,7 +796,7 @@ func (x *BearerToken_Body_TokenLifetime) String() string { func (*BearerToken_Body_TokenLifetime) ProtoMessage() {} func (x *BearerToken_Body_TokenLifetime) ProtoReflect() protoreflect.Message { - mi := &file_v2_acl_grpc_types_proto_msgTypes[6] + mi := &file_acl_grpc_types_proto_msgTypes[6] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -809,7 +809,7 @@ func (x *BearerToken_Body_TokenLifetime) ProtoReflect() protoreflect.Message { // Deprecated: Use BearerToken_Body_TokenLifetime.ProtoReflect.Descriptor instead. func (*BearerToken_Body_TokenLifetime) Descriptor() ([]byte, []int) { - return file_v2_acl_grpc_types_proto_rawDescGZIP(), []int{2, 0, 0} + return file_acl_grpc_types_proto_rawDescGZIP(), []int{2, 0, 0} } func (x *BearerToken_Body_TokenLifetime) GetExp() uint64 { @@ -833,127 +833,126 @@ func (x *BearerToken_Body_TokenLifetime) GetIat() uint64 { return 0 } -var File_v2_acl_grpc_types_proto protoreflect.FileDescriptor +var File_acl_grpc_types_proto protoreflect.FileDescriptor -var file_v2_acl_grpc_types_proto_rawDesc = []byte{ - 0x0a, 0x17, 0x76, 0x32, 0x2f, 0x61, 0x63, 0x6c, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, - 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0d, 0x6e, 0x65, 0x6f, 0x2e, 0x66, - 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x1a, 0x18, 0x76, 0x32, 0x2f, 0x72, 0x65, 0x66, - 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x22, 0xda, 0x03, 0x0a, 0x0a, 0x45, 0x41, 0x43, 0x4c, 0x52, 0x65, 0x63, 0x6f, 0x72, - 0x64, 0x12, 0x36, 0x0a, 0x09, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, - 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x09, - 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2d, 0x0a, 0x06, 0x61, 0x63, 0x74, - 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x15, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, - 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x52, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3a, 0x0a, 0x07, 0x66, 0x69, 0x6c, 0x74, - 0x65, 0x72, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, - 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x45, 0x41, 0x43, 0x4c, 0x52, 0x65, - 0x63, 0x6f, 0x72, 0x64, 0x2e, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x07, 0x66, 0x69, 0x6c, - 0x74, 0x65, 0x72, 0x73, 0x12, 0x3a, 0x0a, 0x07, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x18, - 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, - 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x45, 0x41, 0x43, 0x4c, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, - 0x2e, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x52, 0x07, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, - 0x1a, 0xa5, 0x01, 0x0a, 0x06, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x3a, 0x0a, 0x0b, 0x68, - 0x65, 0x61, 0x64, 0x65, 0x72, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, - 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, - 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x52, 0x0a, 0x68, 0x65, 0x61, - 0x64, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x12, 0x37, 0x0a, 0x0a, 0x6d, 0x61, 0x74, 0x63, 0x68, - 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x6e, 0x65, - 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x4d, 0x61, 0x74, 0x63, - 0x68, 0x54, 0x79, 0x70, 0x65, 0x52, 0x09, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x54, 0x79, 0x70, 0x65, - 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, - 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x1a, 0x45, 0x0a, 0x06, 0x54, 0x61, 0x72, 0x67, - 0x65, 0x74, 0x12, 0x27, 0x0a, 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, - 0x32, 0x13, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, - 0x2e, 0x52, 0x6f, 0x6c, 0x65, 0x52, 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6b, - 0x65, 0x79, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x04, 0x6b, 0x65, 0x79, 0x73, 0x22, - 0xb3, 0x01, 0x0a, 0x09, 0x45, 0x41, 0x43, 0x4c, 0x54, 0x61, 0x62, 0x6c, 0x65, 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, 0x3e, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, - 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, - 0x72, 0x49, 0x44, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, - 0x12, 0x33, 0x0a, 0x07, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, - 0x6c, 0x2e, 0x45, 0x41, 0x43, 0x4c, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x07, 0x72, 0x65, - 0x63, 0x6f, 0x72, 0x64, 0x73, 0x22, 0x83, 0x03, 0x0a, 0x0b, 0x42, 0x65, 0x61, 0x72, 0x65, 0x72, - 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x33, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, - 0x61, 0x63, 0x6c, 0x2e, 0x42, 0x65, 0x61, 0x72, 0x65, 0x72, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, - 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x37, 0x0a, 0x09, 0x73, 0x69, - 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, - 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, - 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, - 0x75, 0x72, 0x65, 0x1a, 0x85, 0x02, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x37, 0x0a, 0x0a, - 0x65, 0x61, 0x63, 0x6c, 0x5f, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, - 0x2e, 0x45, 0x41, 0x43, 0x4c, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x52, 0x09, 0x65, 0x61, 0x63, 0x6c, - 0x54, 0x61, 0x62, 0x6c, 0x65, 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, 0x49, 0x0a, 0x08, 0x6c, 0x69, 0x66, - 0x65, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x6e, 0x65, - 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x42, 0x65, 0x61, 0x72, - 0x65, 0x72, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x2e, 0x54, 0x6f, 0x6b, - 0x65, 0x6e, 0x4c, 0x69, 0x66, 0x65, 0x74, 0x69, 0x6d, 0x65, 0x52, 0x08, 0x6c, 0x69, 0x66, 0x65, - 0x74, 0x69, 0x6d, 0x65, 0x1a, 0x45, 0x0a, 0x0d, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x4c, 0x69, 0x66, - 0x65, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x78, 0x70, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x04, 0x52, 0x03, 0x65, 0x78, 0x70, 0x12, 0x10, 0x0a, 0x03, 0x6e, 0x62, 0x66, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x6e, 0x62, 0x66, 0x12, 0x10, 0x0a, 0x03, 0x69, 0x61, 0x74, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x69, 0x61, 0x74, 0x2a, 0x3e, 0x0a, 0x04, 0x52, - 0x6f, 0x6c, 0x65, 0x12, 0x14, 0x0a, 0x10, 0x52, 0x4f, 0x4c, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, - 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x55, 0x53, 0x45, - 0x52, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x53, 0x59, 0x53, 0x54, 0x45, 0x4d, 0x10, 0x02, 0x12, - 0x0a, 0x0a, 0x06, 0x4f, 0x54, 0x48, 0x45, 0x52, 0x53, 0x10, 0x03, 0x2a, 0x4f, 0x0a, 0x09, 0x4d, - 0x61, 0x74, 0x63, 0x68, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1a, 0x0a, 0x16, 0x4d, 0x41, 0x54, 0x43, - 0x48, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, - 0x45, 0x44, 0x10, 0x00, 0x12, 0x10, 0x0a, 0x0c, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x5f, 0x45, - 0x51, 0x55, 0x41, 0x4c, 0x10, 0x01, 0x12, 0x14, 0x0a, 0x10, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, - 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x45, 0x51, 0x55, 0x41, 0x4c, 0x10, 0x02, 0x2a, 0x7a, 0x0a, 0x09, - 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x19, 0x0a, 0x15, 0x4f, 0x50, 0x45, - 0x52, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, - 0x45, 0x44, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x47, 0x45, 0x54, 0x10, 0x01, 0x12, 0x08, 0x0a, - 0x04, 0x48, 0x45, 0x41, 0x44, 0x10, 0x02, 0x12, 0x07, 0x0a, 0x03, 0x50, 0x55, 0x54, 0x10, 0x03, - 0x12, 0x0a, 0x0a, 0x06, 0x44, 0x45, 0x4c, 0x45, 0x54, 0x45, 0x10, 0x04, 0x12, 0x0a, 0x0a, 0x06, - 0x53, 0x45, 0x41, 0x52, 0x43, 0x48, 0x10, 0x05, 0x12, 0x0c, 0x0a, 0x08, 0x47, 0x45, 0x54, 0x52, - 0x41, 0x4e, 0x47, 0x45, 0x10, 0x06, 0x12, 0x10, 0x0a, 0x0c, 0x47, 0x45, 0x54, 0x52, 0x41, 0x4e, - 0x47, 0x45, 0x48, 0x41, 0x53, 0x48, 0x10, 0x07, 0x2a, 0x35, 0x0a, 0x06, 0x41, 0x63, 0x74, 0x69, - 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x12, 0x41, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x53, - 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x41, 0x4c, - 0x4c, 0x4f, 0x57, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x44, 0x45, 0x4e, 0x59, 0x10, 0x02, 0x2a, - 0x4a, 0x0a, 0x0a, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, - 0x12, 0x48, 0x45, 0x41, 0x44, 0x45, 0x52, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, - 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x52, 0x45, 0x51, 0x55, 0x45, 0x53, 0x54, - 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x4f, 0x42, 0x4a, 0x45, 0x43, 0x54, 0x10, 0x02, 0x12, 0x0b, - 0x0a, 0x07, 0x53, 0x45, 0x52, 0x56, 0x49, 0x43, 0x45, 0x10, 0x03, 0x42, 0x4d, 0x5a, 0x31, 0x67, - 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, - 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, - 0x2f, 0x76, 0x32, 0x2f, 0x61, 0x63, 0x6c, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x61, 0x63, 0x6c, - 0xaa, 0x02, 0x17, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, - 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x41, 0x63, 0x6c, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x33, +var file_acl_grpc_types_proto_rawDesc = []byte{ + 0x0a, 0x14, 0x61, 0x63, 0x6c, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0d, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x1a, 0x15, 0x72, 0x65, 0x66, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, + 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xda, 0x03, 0x0a, + 0x0a, 0x45, 0x41, 0x43, 0x4c, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x12, 0x36, 0x0a, 0x09, 0x6f, + 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x18, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x4f, + 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x09, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x12, 0x2d, 0x0a, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0e, 0x32, 0x15, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, + 0x61, 0x63, 0x6c, 0x2e, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x06, 0x61, 0x63, 0x74, 0x69, + 0x6f, 0x6e, 0x12, 0x3a, 0x0a, 0x07, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x73, 0x18, 0x03, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, + 0x61, 0x63, 0x6c, 0x2e, 0x45, 0x41, 0x43, 0x4c, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x2e, 0x46, + 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x07, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x73, 0x12, 0x3a, + 0x0a, 0x07, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, + 0x45, 0x41, 0x43, 0x4c, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x2e, 0x54, 0x61, 0x72, 0x67, 0x65, + 0x74, 0x52, 0x07, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x1a, 0xa5, 0x01, 0x0a, 0x06, 0x46, + 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x3a, 0x0a, 0x0b, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x5f, + 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, + 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, + 0x72, 0x54, 0x79, 0x70, 0x65, 0x52, 0x0a, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x54, 0x79, 0x70, + 0x65, 0x12, 0x37, 0x0a, 0x0a, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x54, 0x79, 0x70, 0x65, 0x52, + 0x09, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x54, 0x79, 0x70, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, + 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x1a, 0x45, 0x0a, 0x06, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x12, 0x27, 0x0a, 0x04, + 0x72, 0x6f, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x13, 0x2e, 0x6e, 0x65, 0x6f, + 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x52, 0x6f, 0x6c, 0x65, 0x52, + 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6b, 0x65, 0x79, 0x73, 0x18, 0x02, 0x20, + 0x03, 0x28, 0x0c, 0x52, 0x04, 0x6b, 0x65, 0x79, 0x73, 0x22, 0xb3, 0x01, 0x0a, 0x09, 0x45, 0x41, + 0x43, 0x4c, 0x54, 0x61, 0x62, 0x6c, 0x65, 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, 0x3e, 0x0a, 0x0c, 0x63, 0x6f, + 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, + 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x52, 0x0b, 0x63, + 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x12, 0x33, 0x0a, 0x07, 0x72, 0x65, + 0x63, 0x6f, 0x72, 0x64, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, + 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x45, 0x41, 0x43, 0x4c, + 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x07, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x22, + 0x83, 0x03, 0x0a, 0x0b, 0x42, 0x65, 0x61, 0x72, 0x65, 0x72, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, + 0x33, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, + 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x42, 0x65, + 0x61, 0x72, 0x65, 0x72, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, + 0x62, 0x6f, 0x64, 0x79, 0x12, 0x37, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, + 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, + 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x1a, 0x85, 0x02, + 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x37, 0x0a, 0x0a, 0x65, 0x61, 0x63, 0x6c, 0x5f, 0x74, + 0x61, 0x62, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, + 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x45, 0x41, 0x43, 0x4c, 0x54, + 0x61, 0x62, 0x6c, 0x65, 0x52, 0x09, 0x65, 0x61, 0x63, 0x6c, 0x54, 0x61, 0x62, 0x6c, 0x65, 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, 0x49, 0x0a, 0x08, 0x6c, 0x69, 0x66, 0x65, 0x74, 0x69, 0x6d, 0x65, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x42, 0x65, 0x61, 0x72, 0x65, 0x72, 0x54, 0x6f, 0x6b, 0x65, + 0x6e, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x2e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x4c, 0x69, 0x66, 0x65, + 0x74, 0x69, 0x6d, 0x65, 0x52, 0x08, 0x6c, 0x69, 0x66, 0x65, 0x74, 0x69, 0x6d, 0x65, 0x1a, 0x45, + 0x0a, 0x0d, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x4c, 0x69, 0x66, 0x65, 0x74, 0x69, 0x6d, 0x65, 0x12, + 0x10, 0x0a, 0x03, 0x65, 0x78, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x65, 0x78, + 0x70, 0x12, 0x10, 0x0a, 0x03, 0x6e, 0x62, 0x66, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, + 0x6e, 0x62, 0x66, 0x12, 0x10, 0x0a, 0x03, 0x69, 0x61, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, + 0x52, 0x03, 0x69, 0x61, 0x74, 0x2a, 0x3e, 0x0a, 0x04, 0x52, 0x6f, 0x6c, 0x65, 0x12, 0x14, 0x0a, + 0x10, 0x52, 0x4f, 0x4c, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, + 0x44, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x55, 0x53, 0x45, 0x52, 0x10, 0x01, 0x12, 0x0a, 0x0a, + 0x06, 0x53, 0x59, 0x53, 0x54, 0x45, 0x4d, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x4f, 0x54, 0x48, + 0x45, 0x52, 0x53, 0x10, 0x03, 0x2a, 0x4f, 0x0a, 0x09, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x54, 0x79, + 0x70, 0x65, 0x12, 0x1a, 0x0a, 0x16, 0x4d, 0x41, 0x54, 0x43, 0x48, 0x5f, 0x54, 0x59, 0x50, 0x45, + 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x10, + 0x0a, 0x0c, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x5f, 0x45, 0x51, 0x55, 0x41, 0x4c, 0x10, 0x01, + 0x12, 0x14, 0x0a, 0x10, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x45, + 0x51, 0x55, 0x41, 0x4c, 0x10, 0x02, 0x2a, 0x7a, 0x0a, 0x09, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x12, 0x19, 0x0a, 0x15, 0x4f, 0x50, 0x45, 0x52, 0x41, 0x54, 0x49, 0x4f, 0x4e, + 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x07, + 0x0a, 0x03, 0x47, 0x45, 0x54, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x48, 0x45, 0x41, 0x44, 0x10, + 0x02, 0x12, 0x07, 0x0a, 0x03, 0x50, 0x55, 0x54, 0x10, 0x03, 0x12, 0x0a, 0x0a, 0x06, 0x44, 0x45, + 0x4c, 0x45, 0x54, 0x45, 0x10, 0x04, 0x12, 0x0a, 0x0a, 0x06, 0x53, 0x45, 0x41, 0x52, 0x43, 0x48, + 0x10, 0x05, 0x12, 0x0c, 0x0a, 0x08, 0x47, 0x45, 0x54, 0x52, 0x41, 0x4e, 0x47, 0x45, 0x10, 0x06, + 0x12, 0x10, 0x0a, 0x0c, 0x47, 0x45, 0x54, 0x52, 0x41, 0x4e, 0x47, 0x45, 0x48, 0x41, 0x53, 0x48, + 0x10, 0x07, 0x2a, 0x35, 0x0a, 0x06, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x12, + 0x41, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, + 0x45, 0x44, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x41, 0x4c, 0x4c, 0x4f, 0x57, 0x10, 0x01, 0x12, + 0x08, 0x0a, 0x04, 0x44, 0x45, 0x4e, 0x59, 0x10, 0x02, 0x2a, 0x4a, 0x0a, 0x0a, 0x48, 0x65, 0x61, + 0x64, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x12, 0x48, 0x45, 0x41, 0x44, 0x45, + 0x52, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, + 0x0b, 0x0a, 0x07, 0x52, 0x45, 0x51, 0x55, 0x45, 0x53, 0x54, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, + 0x4f, 0x42, 0x4a, 0x45, 0x43, 0x54, 0x10, 0x02, 0x12, 0x0b, 0x0a, 0x07, 0x53, 0x45, 0x52, 0x56, + 0x49, 0x43, 0x45, 0x10, 0x03, 0x42, 0x4d, 0x5a, 0x31, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, + 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, + 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x61, 0x63, + 0x6c, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x61, 0x63, 0x6c, 0xaa, 0x02, 0x17, 0x4e, 0x65, 0x6f, + 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, + 0x2e, 0x41, 0x63, 0x6c, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( - file_v2_acl_grpc_types_proto_rawDescOnce sync.Once - file_v2_acl_grpc_types_proto_rawDescData = file_v2_acl_grpc_types_proto_rawDesc + file_acl_grpc_types_proto_rawDescOnce sync.Once + file_acl_grpc_types_proto_rawDescData = file_acl_grpc_types_proto_rawDesc ) -func file_v2_acl_grpc_types_proto_rawDescGZIP() []byte { - file_v2_acl_grpc_types_proto_rawDescOnce.Do(func() { - file_v2_acl_grpc_types_proto_rawDescData = protoimpl.X.CompressGZIP(file_v2_acl_grpc_types_proto_rawDescData) +func file_acl_grpc_types_proto_rawDescGZIP() []byte { + file_acl_grpc_types_proto_rawDescOnce.Do(func() { + file_acl_grpc_types_proto_rawDescData = protoimpl.X.CompressGZIP(file_acl_grpc_types_proto_rawDescData) }) - return file_v2_acl_grpc_types_proto_rawDescData + return file_acl_grpc_types_proto_rawDescData } -var file_v2_acl_grpc_types_proto_enumTypes = make([]protoimpl.EnumInfo, 5) -var file_v2_acl_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 7) -var file_v2_acl_grpc_types_proto_goTypes = []interface{}{ +var file_acl_grpc_types_proto_enumTypes = make([]protoimpl.EnumInfo, 5) +var file_acl_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 7) +var file_acl_grpc_types_proto_goTypes = []interface{}{ (Role)(0), // 0: neo.fs.v2.acl.Role (MatchType)(0), // 1: neo.fs.v2.acl.MatchType (Operation)(0), // 2: neo.fs.v2.acl.Operation @@ -971,7 +970,7 @@ var file_v2_acl_grpc_types_proto_goTypes = []interface{}{ (*grpc.Signature)(nil), // 14: neo.fs.v2.refs.Signature (*grpc.OwnerID)(nil), // 15: neo.fs.v2.refs.OwnerID } -var file_v2_acl_grpc_types_proto_depIdxs = []int32{ +var file_acl_grpc_types_proto_depIdxs = []int32{ 2, // 0: neo.fs.v2.acl.EACLRecord.operation:type_name -> neo.fs.v2.acl.Operation 3, // 1: neo.fs.v2.acl.EACLRecord.action:type_name -> neo.fs.v2.acl.Action 8, // 2: neo.fs.v2.acl.EACLRecord.filters:type_name -> neo.fs.v2.acl.EACLRecord.Filter @@ -994,13 +993,13 @@ var file_v2_acl_grpc_types_proto_depIdxs = []int32{ 0, // [0:15] is the sub-list for field type_name } -func init() { file_v2_acl_grpc_types_proto_init() } -func file_v2_acl_grpc_types_proto_init() { - if File_v2_acl_grpc_types_proto != nil { +func init() { file_acl_grpc_types_proto_init() } +func file_acl_grpc_types_proto_init() { + if File_acl_grpc_types_proto != nil { return } if !protoimpl.UnsafeEnabled { - file_v2_acl_grpc_types_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_acl_grpc_types_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*EACLRecord); i { case 0: return &v.state @@ -1012,7 +1011,7 @@ func file_v2_acl_grpc_types_proto_init() { return nil } } - file_v2_acl_grpc_types_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_acl_grpc_types_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*EACLTable); i { case 0: return &v.state @@ -1024,7 +1023,7 @@ func file_v2_acl_grpc_types_proto_init() { return nil } } - file_v2_acl_grpc_types_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + file_acl_grpc_types_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*BearerToken); i { case 0: return &v.state @@ -1036,7 +1035,7 @@ func file_v2_acl_grpc_types_proto_init() { return nil } } - file_v2_acl_grpc_types_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + file_acl_grpc_types_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*EACLRecord_Filter); i { case 0: return &v.state @@ -1048,7 +1047,7 @@ func file_v2_acl_grpc_types_proto_init() { return nil } } - file_v2_acl_grpc_types_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + file_acl_grpc_types_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*EACLRecord_Target); i { case 0: return &v.state @@ -1060,7 +1059,7 @@ func file_v2_acl_grpc_types_proto_init() { return nil } } - file_v2_acl_grpc_types_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + file_acl_grpc_types_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*BearerToken_Body); i { case 0: return &v.state @@ -1072,7 +1071,7 @@ func file_v2_acl_grpc_types_proto_init() { return nil } } - file_v2_acl_grpc_types_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + file_acl_grpc_types_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*BearerToken_Body_TokenLifetime); i { case 0: return &v.state @@ -1089,19 +1088,19 @@ func file_v2_acl_grpc_types_proto_init() { out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_v2_acl_grpc_types_proto_rawDesc, + RawDescriptor: file_acl_grpc_types_proto_rawDesc, NumEnums: 5, NumMessages: 7, NumExtensions: 0, NumServices: 0, }, - GoTypes: file_v2_acl_grpc_types_proto_goTypes, - DependencyIndexes: file_v2_acl_grpc_types_proto_depIdxs, - EnumInfos: file_v2_acl_grpc_types_proto_enumTypes, - MessageInfos: file_v2_acl_grpc_types_proto_msgTypes, + GoTypes: file_acl_grpc_types_proto_goTypes, + DependencyIndexes: file_acl_grpc_types_proto_depIdxs, + EnumInfos: file_acl_grpc_types_proto_enumTypes, + MessageInfos: file_acl_grpc_types_proto_msgTypes, }.Build() - File_v2_acl_grpc_types_proto = out.File - file_v2_acl_grpc_types_proto_rawDesc = nil - file_v2_acl_grpc_types_proto_goTypes = nil - file_v2_acl_grpc_types_proto_depIdxs = nil + File_acl_grpc_types_proto = out.File + file_acl_grpc_types_proto_rawDesc = nil + file_acl_grpc_types_proto_goTypes = nil + file_acl_grpc_types_proto_depIdxs = nil } diff --git a/audit/grpc/types.pb.go b/audit/grpc/types.pb.go index 82cb4c9..5353dd0 100644 --- a/audit/grpc/types.pb.go +++ b/audit/grpc/types.pb.go @@ -2,7 +2,7 @@ // versions: // protoc-gen-go v1.27.1 // protoc v3.18.0 -// source: v2/audit/grpc/types.proto +// source: audit/grpc/types.proto package audit @@ -66,7 +66,7 @@ type DataAuditResult struct { func (x *DataAuditResult) Reset() { *x = DataAuditResult{} if protoimpl.UnsafeEnabled { - mi := &file_v2_audit_grpc_types_proto_msgTypes[0] + mi := &file_audit_grpc_types_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -79,7 +79,7 @@ func (x *DataAuditResult) String() string { func (*DataAuditResult) ProtoMessage() {} func (x *DataAuditResult) ProtoReflect() protoreflect.Message { - mi := &file_v2_audit_grpc_types_proto_msgTypes[0] + mi := &file_audit_grpc_types_proto_msgTypes[0] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -92,7 +92,7 @@ func (x *DataAuditResult) ProtoReflect() protoreflect.Message { // Deprecated: Use DataAuditResult.ProtoReflect.Descriptor instead. func (*DataAuditResult) Descriptor() ([]byte, []int) { - return file_v2_audit_grpc_types_proto_rawDescGZIP(), []int{0} + return file_audit_grpc_types_proto_rawDescGZIP(), []int{0} } func (x *DataAuditResult) GetVersion() *grpc.Version { @@ -193,73 +193,73 @@ func (x *DataAuditResult) GetFailNodes() [][]byte { return nil } -var File_v2_audit_grpc_types_proto protoreflect.FileDescriptor +var File_audit_grpc_types_proto protoreflect.FileDescriptor -var file_v2_audit_grpc_types_proto_rawDesc = []byte{ - 0x0a, 0x19, 0x76, 0x32, 0x2f, 0x61, 0x75, 0x64, 0x69, 0x74, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, - 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0f, 0x6e, 0x65, 0x6f, - 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x75, 0x64, 0x69, 0x74, 0x1a, 0x18, 0x76, 0x32, - 0x2f, 0x72, 0x65, 0x66, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xf4, 0x03, 0x0a, 0x0f, 0x44, 0x61, 0x74, 0x61, 0x41, - 0x75, 0x64, 0x69, 0x74, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 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, 0x1f, 0x0a, - 0x0b, 0x61, 0x75, 0x64, 0x69, 0x74, 0x5f, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x06, 0x52, 0x0a, 0x61, 0x75, 0x64, 0x69, 0x74, 0x45, 0x70, 0x6f, 0x63, 0x68, 0x12, 0x3e, - 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, - 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, - 0x44, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x12, 0x1d, - 0x0a, 0x0a, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x04, 0x20, 0x01, - 0x28, 0x0c, 0x52, 0x09, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x12, 0x1a, 0x0a, - 0x08, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, - 0x08, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x72, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x74, 0x72, 0x69, 0x65, 0x73, - 0x18, 0x07, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x72, 0x65, 0x74, 0x72, 0x69, 0x65, 0x73, 0x12, - 0x31, 0x0a, 0x07, 0x70, 0x61, 0x73, 0x73, 0x5f, 0x73, 0x67, 0x18, 0x08, 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, 0x06, 0x70, 0x61, 0x73, 0x73, - 0x53, 0x47, 0x12, 0x31, 0x0a, 0x07, 0x66, 0x61, 0x69, 0x6c, 0x5f, 0x73, 0x67, 0x18, 0x09, 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, 0x06, 0x66, - 0x61, 0x69, 0x6c, 0x53, 0x47, 0x12, 0x10, 0x0a, 0x03, 0x68, 0x69, 0x74, 0x18, 0x0a, 0x20, 0x01, - 0x28, 0x0d, 0x52, 0x03, 0x68, 0x69, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6d, 0x69, 0x73, 0x73, 0x18, - 0x0b, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x04, 0x6d, 0x69, 0x73, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x66, - 0x61, 0x69, 0x6c, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x04, 0x66, 0x61, 0x69, 0x6c, 0x12, - 0x1d, 0x0a, 0x0a, 0x70, 0x61, 0x73, 0x73, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x0d, 0x20, - 0x03, 0x28, 0x0c, 0x52, 0x09, 0x70, 0x61, 0x73, 0x73, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x12, 0x1d, - 0x0a, 0x0a, 0x66, 0x61, 0x69, 0x6c, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x0e, 0x20, 0x03, - 0x28, 0x0c, 0x52, 0x09, 0x66, 0x61, 0x69, 0x6c, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x42, 0x53, 0x5a, - 0x35, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, - 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, - 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x61, 0x75, 0x64, 0x69, 0x74, 0x2f, 0x67, 0x72, 0x70, 0x63, - 0x3b, 0x61, 0x75, 0x64, 0x69, 0x74, 0xaa, 0x02, 0x19, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, - 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x41, 0x75, 0x64, - 0x69, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +var file_audit_grpc_types_proto_rawDesc = []byte{ + 0x0a, 0x16, 0x61, 0x75, 0x64, 0x69, 0x74, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, + 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0f, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, + 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x75, 0x64, 0x69, 0x74, 0x1a, 0x15, 0x72, 0x65, 0x66, 0x73, 0x2f, + 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x22, 0xf4, 0x03, 0x0a, 0x0f, 0x44, 0x61, 0x74, 0x61, 0x41, 0x75, 0x64, 0x69, 0x74, 0x52, 0x65, + 0x73, 0x75, 0x6c, 0x74, 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, 0x1f, 0x0a, 0x0b, 0x61, 0x75, 0x64, 0x69, 0x74, + 0x5f, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x06, 0x52, 0x0a, 0x61, 0x75, + 0x64, 0x69, 0x74, 0x45, 0x70, 0x6f, 0x63, 0x68, 0x12, 0x3e, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, + 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, + 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x52, 0x0b, 0x63, 0x6f, 0x6e, + 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x75, 0x62, 0x6c, + 0x69, 0x63, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x70, 0x75, + 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x6f, 0x6d, 0x70, 0x6c, + 0x65, 0x74, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x63, 0x6f, 0x6d, 0x70, 0x6c, + 0x65, 0x74, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x73, 0x18, + 0x06, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x73, 0x12, + 0x18, 0x0a, 0x07, 0x72, 0x65, 0x74, 0x72, 0x69, 0x65, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0d, + 0x52, 0x07, 0x72, 0x65, 0x74, 0x72, 0x69, 0x65, 0x73, 0x12, 0x31, 0x0a, 0x07, 0x70, 0x61, 0x73, + 0x73, 0x5f, 0x73, 0x67, 0x18, 0x08, 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, 0x06, 0x70, 0x61, 0x73, 0x73, 0x53, 0x47, 0x12, 0x31, 0x0a, 0x07, + 0x66, 0x61, 0x69, 0x6c, 0x5f, 0x73, 0x67, 0x18, 0x09, 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, 0x06, 0x66, 0x61, 0x69, 0x6c, 0x53, 0x47, 0x12, + 0x10, 0x0a, 0x03, 0x68, 0x69, 0x74, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x03, 0x68, 0x69, + 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6d, 0x69, 0x73, 0x73, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0d, 0x52, + 0x04, 0x6d, 0x69, 0x73, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x66, 0x61, 0x69, 0x6c, 0x18, 0x0c, 0x20, + 0x01, 0x28, 0x0d, 0x52, 0x04, 0x66, 0x61, 0x69, 0x6c, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x61, 0x73, + 0x73, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x0d, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x09, 0x70, + 0x61, 0x73, 0x73, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x66, 0x61, 0x69, 0x6c, + 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x0e, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x09, 0x66, 0x61, + 0x69, 0x6c, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x42, 0x53, 0x5a, 0x35, 0x67, 0x69, 0x74, 0x68, 0x75, + 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, + 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, + 0x61, 0x75, 0x64, 0x69, 0x74, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x61, 0x75, 0x64, 0x69, 0x74, + 0xaa, 0x02, 0x19, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, + 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x41, 0x75, 0x64, 0x69, 0x74, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, } var ( - file_v2_audit_grpc_types_proto_rawDescOnce sync.Once - file_v2_audit_grpc_types_proto_rawDescData = file_v2_audit_grpc_types_proto_rawDesc + file_audit_grpc_types_proto_rawDescOnce sync.Once + file_audit_grpc_types_proto_rawDescData = file_audit_grpc_types_proto_rawDesc ) -func file_v2_audit_grpc_types_proto_rawDescGZIP() []byte { - file_v2_audit_grpc_types_proto_rawDescOnce.Do(func() { - file_v2_audit_grpc_types_proto_rawDescData = protoimpl.X.CompressGZIP(file_v2_audit_grpc_types_proto_rawDescData) +func file_audit_grpc_types_proto_rawDescGZIP() []byte { + file_audit_grpc_types_proto_rawDescOnce.Do(func() { + file_audit_grpc_types_proto_rawDescData = protoimpl.X.CompressGZIP(file_audit_grpc_types_proto_rawDescData) }) - return file_v2_audit_grpc_types_proto_rawDescData + return file_audit_grpc_types_proto_rawDescData } -var file_v2_audit_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_v2_audit_grpc_types_proto_goTypes = []interface{}{ +var file_audit_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_audit_grpc_types_proto_goTypes = []interface{}{ (*DataAuditResult)(nil), // 0: neo.fs.v2.audit.DataAuditResult (*grpc.Version)(nil), // 1: neo.fs.v2.refs.Version (*grpc.ContainerID)(nil), // 2: neo.fs.v2.refs.ContainerID (*grpc.ObjectID)(nil), // 3: neo.fs.v2.refs.ObjectID } -var file_v2_audit_grpc_types_proto_depIdxs = []int32{ +var file_audit_grpc_types_proto_depIdxs = []int32{ 1, // 0: neo.fs.v2.audit.DataAuditResult.version:type_name -> neo.fs.v2.refs.Version 2, // 1: neo.fs.v2.audit.DataAuditResult.container_id:type_name -> neo.fs.v2.refs.ContainerID 3, // 2: neo.fs.v2.audit.DataAuditResult.pass_sg:type_name -> neo.fs.v2.refs.ObjectID @@ -271,13 +271,13 @@ var file_v2_audit_grpc_types_proto_depIdxs = []int32{ 0, // [0:4] is the sub-list for field type_name } -func init() { file_v2_audit_grpc_types_proto_init() } -func file_v2_audit_grpc_types_proto_init() { - if File_v2_audit_grpc_types_proto != nil { +func init() { file_audit_grpc_types_proto_init() } +func file_audit_grpc_types_proto_init() { + if File_audit_grpc_types_proto != nil { return } if !protoimpl.UnsafeEnabled { - file_v2_audit_grpc_types_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_audit_grpc_types_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*DataAuditResult); i { case 0: return &v.state @@ -294,18 +294,18 @@ func file_v2_audit_grpc_types_proto_init() { out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_v2_audit_grpc_types_proto_rawDesc, + RawDescriptor: file_audit_grpc_types_proto_rawDesc, NumEnums: 0, NumMessages: 1, NumExtensions: 0, NumServices: 0, }, - GoTypes: file_v2_audit_grpc_types_proto_goTypes, - DependencyIndexes: file_v2_audit_grpc_types_proto_depIdxs, - MessageInfos: file_v2_audit_grpc_types_proto_msgTypes, + GoTypes: file_audit_grpc_types_proto_goTypes, + DependencyIndexes: file_audit_grpc_types_proto_depIdxs, + MessageInfos: file_audit_grpc_types_proto_msgTypes, }.Build() - File_v2_audit_grpc_types_proto = out.File - file_v2_audit_grpc_types_proto_rawDesc = nil - file_v2_audit_grpc_types_proto_goTypes = nil - file_v2_audit_grpc_types_proto_depIdxs = nil + File_audit_grpc_types_proto = out.File + file_audit_grpc_types_proto_rawDesc = nil + file_audit_grpc_types_proto_goTypes = nil + file_audit_grpc_types_proto_depIdxs = nil } diff --git a/container/grpc/service.pb.go b/container/grpc/service.pb.go index 031ac63..251638e 100644 --- a/container/grpc/service.pb.go +++ b/container/grpc/service.pb.go @@ -2,7 +2,7 @@ // versions: // protoc-gen-go v1.27.1 // protoc v3.18.0 -// source: v2/container/grpc/service.proto +// source: container/grpc/service.proto package container @@ -43,7 +43,7 @@ type PutRequest struct { func (x *PutRequest) Reset() { *x = PutRequest{} if protoimpl.UnsafeEnabled { - mi := &file_v2_container_grpc_service_proto_msgTypes[0] + mi := &file_container_grpc_service_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -56,7 +56,7 @@ func (x *PutRequest) String() string { func (*PutRequest) ProtoMessage() {} func (x *PutRequest) ProtoReflect() protoreflect.Message { - mi := &file_v2_container_grpc_service_proto_msgTypes[0] + mi := &file_container_grpc_service_proto_msgTypes[0] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -69,7 +69,7 @@ func (x *PutRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use PutRequest.ProtoReflect.Descriptor instead. func (*PutRequest) Descriptor() ([]byte, []int) { - return file_v2_container_grpc_service_proto_rawDescGZIP(), []int{0} + return file_container_grpc_service_proto_rawDescGZIP(), []int{0} } func (x *PutRequest) GetBody() *PutRequest_Body { @@ -113,7 +113,7 @@ type PutResponse struct { func (x *PutResponse) Reset() { *x = PutResponse{} if protoimpl.UnsafeEnabled { - mi := &file_v2_container_grpc_service_proto_msgTypes[1] + mi := &file_container_grpc_service_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -126,7 +126,7 @@ func (x *PutResponse) String() string { func (*PutResponse) ProtoMessage() {} func (x *PutResponse) ProtoReflect() protoreflect.Message { - mi := &file_v2_container_grpc_service_proto_msgTypes[1] + mi := &file_container_grpc_service_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -139,7 +139,7 @@ func (x *PutResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use PutResponse.ProtoReflect.Descriptor instead. func (*PutResponse) Descriptor() ([]byte, []int) { - return file_v2_container_grpc_service_proto_rawDescGZIP(), []int{1} + return file_container_grpc_service_proto_rawDescGZIP(), []int{1} } func (x *PutResponse) GetBody() *PutResponse_Body { @@ -183,7 +183,7 @@ type DeleteRequest struct { func (x *DeleteRequest) Reset() { *x = DeleteRequest{} if protoimpl.UnsafeEnabled { - mi := &file_v2_container_grpc_service_proto_msgTypes[2] + mi := &file_container_grpc_service_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -196,7 +196,7 @@ func (x *DeleteRequest) String() string { func (*DeleteRequest) ProtoMessage() {} func (x *DeleteRequest) ProtoReflect() protoreflect.Message { - mi := &file_v2_container_grpc_service_proto_msgTypes[2] + mi := &file_container_grpc_service_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -209,7 +209,7 @@ func (x *DeleteRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use DeleteRequest.ProtoReflect.Descriptor instead. func (*DeleteRequest) Descriptor() ([]byte, []int) { - return file_v2_container_grpc_service_proto_rawDescGZIP(), []int{2} + return file_container_grpc_service_proto_rawDescGZIP(), []int{2} } func (x *DeleteRequest) GetBody() *DeleteRequest_Body { @@ -254,7 +254,7 @@ type DeleteResponse struct { func (x *DeleteResponse) Reset() { *x = DeleteResponse{} if protoimpl.UnsafeEnabled { - mi := &file_v2_container_grpc_service_proto_msgTypes[3] + mi := &file_container_grpc_service_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -267,7 +267,7 @@ func (x *DeleteResponse) String() string { func (*DeleteResponse) ProtoMessage() {} func (x *DeleteResponse) ProtoReflect() protoreflect.Message { - mi := &file_v2_container_grpc_service_proto_msgTypes[3] + mi := &file_container_grpc_service_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -280,7 +280,7 @@ func (x *DeleteResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use DeleteResponse.ProtoReflect.Descriptor instead. func (*DeleteResponse) Descriptor() ([]byte, []int) { - return file_v2_container_grpc_service_proto_rawDescGZIP(), []int{3} + return file_container_grpc_service_proto_rawDescGZIP(), []int{3} } func (x *DeleteResponse) GetBody() *DeleteResponse_Body { @@ -324,7 +324,7 @@ type GetRequest struct { func (x *GetRequest) Reset() { *x = GetRequest{} if protoimpl.UnsafeEnabled { - mi := &file_v2_container_grpc_service_proto_msgTypes[4] + mi := &file_container_grpc_service_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -337,7 +337,7 @@ func (x *GetRequest) String() string { func (*GetRequest) ProtoMessage() {} func (x *GetRequest) ProtoReflect() protoreflect.Message { - mi := &file_v2_container_grpc_service_proto_msgTypes[4] + mi := &file_container_grpc_service_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -350,7 +350,7 @@ func (x *GetRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use GetRequest.ProtoReflect.Descriptor instead. func (*GetRequest) Descriptor() ([]byte, []int) { - return file_v2_container_grpc_service_proto_rawDescGZIP(), []int{4} + return file_container_grpc_service_proto_rawDescGZIP(), []int{4} } func (x *GetRequest) GetBody() *GetRequest_Body { @@ -394,7 +394,7 @@ type GetResponse struct { func (x *GetResponse) Reset() { *x = GetResponse{} if protoimpl.UnsafeEnabled { - mi := &file_v2_container_grpc_service_proto_msgTypes[5] + mi := &file_container_grpc_service_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -407,7 +407,7 @@ func (x *GetResponse) String() string { func (*GetResponse) ProtoMessage() {} func (x *GetResponse) ProtoReflect() protoreflect.Message { - mi := &file_v2_container_grpc_service_proto_msgTypes[5] + mi := &file_container_grpc_service_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -420,7 +420,7 @@ func (x *GetResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use GetResponse.ProtoReflect.Descriptor instead. func (*GetResponse) Descriptor() ([]byte, []int) { - return file_v2_container_grpc_service_proto_rawDescGZIP(), []int{5} + return file_container_grpc_service_proto_rawDescGZIP(), []int{5} } func (x *GetResponse) GetBody() *GetResponse_Body { @@ -464,7 +464,7 @@ type ListRequest struct { func (x *ListRequest) Reset() { *x = ListRequest{} if protoimpl.UnsafeEnabled { - mi := &file_v2_container_grpc_service_proto_msgTypes[6] + mi := &file_container_grpc_service_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -477,7 +477,7 @@ func (x *ListRequest) String() string { func (*ListRequest) ProtoMessage() {} func (x *ListRequest) ProtoReflect() protoreflect.Message { - mi := &file_v2_container_grpc_service_proto_msgTypes[6] + mi := &file_container_grpc_service_proto_msgTypes[6] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -490,7 +490,7 @@ func (x *ListRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use ListRequest.ProtoReflect.Descriptor instead. func (*ListRequest) Descriptor() ([]byte, []int) { - return file_v2_container_grpc_service_proto_rawDescGZIP(), []int{6} + return file_container_grpc_service_proto_rawDescGZIP(), []int{6} } func (x *ListRequest) GetBody() *ListRequest_Body { @@ -534,7 +534,7 @@ type ListResponse struct { func (x *ListResponse) Reset() { *x = ListResponse{} if protoimpl.UnsafeEnabled { - mi := &file_v2_container_grpc_service_proto_msgTypes[7] + mi := &file_container_grpc_service_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -547,7 +547,7 @@ func (x *ListResponse) String() string { func (*ListResponse) ProtoMessage() {} func (x *ListResponse) ProtoReflect() protoreflect.Message { - mi := &file_v2_container_grpc_service_proto_msgTypes[7] + mi := &file_container_grpc_service_proto_msgTypes[7] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -560,7 +560,7 @@ func (x *ListResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use ListResponse.ProtoReflect.Descriptor instead. func (*ListResponse) Descriptor() ([]byte, []int) { - return file_v2_container_grpc_service_proto_rawDescGZIP(), []int{7} + return file_container_grpc_service_proto_rawDescGZIP(), []int{7} } func (x *ListResponse) GetBody() *ListResponse_Body { @@ -604,7 +604,7 @@ type SetExtendedACLRequest struct { func (x *SetExtendedACLRequest) Reset() { *x = SetExtendedACLRequest{} if protoimpl.UnsafeEnabled { - mi := &file_v2_container_grpc_service_proto_msgTypes[8] + mi := &file_container_grpc_service_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -617,7 +617,7 @@ func (x *SetExtendedACLRequest) String() string { func (*SetExtendedACLRequest) ProtoMessage() {} func (x *SetExtendedACLRequest) ProtoReflect() protoreflect.Message { - mi := &file_v2_container_grpc_service_proto_msgTypes[8] + mi := &file_container_grpc_service_proto_msgTypes[8] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -630,7 +630,7 @@ func (x *SetExtendedACLRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use SetExtendedACLRequest.ProtoReflect.Descriptor instead. func (*SetExtendedACLRequest) Descriptor() ([]byte, []int) { - return file_v2_container_grpc_service_proto_rawDescGZIP(), []int{8} + return file_container_grpc_service_proto_rawDescGZIP(), []int{8} } func (x *SetExtendedACLRequest) GetBody() *SetExtendedACLRequest_Body { @@ -674,7 +674,7 @@ type SetExtendedACLResponse struct { func (x *SetExtendedACLResponse) Reset() { *x = SetExtendedACLResponse{} if protoimpl.UnsafeEnabled { - mi := &file_v2_container_grpc_service_proto_msgTypes[9] + mi := &file_container_grpc_service_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -687,7 +687,7 @@ func (x *SetExtendedACLResponse) String() string { func (*SetExtendedACLResponse) ProtoMessage() {} func (x *SetExtendedACLResponse) ProtoReflect() protoreflect.Message { - mi := &file_v2_container_grpc_service_proto_msgTypes[9] + mi := &file_container_grpc_service_proto_msgTypes[9] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -700,7 +700,7 @@ func (x *SetExtendedACLResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use SetExtendedACLResponse.ProtoReflect.Descriptor instead. func (*SetExtendedACLResponse) Descriptor() ([]byte, []int) { - return file_v2_container_grpc_service_proto_rawDescGZIP(), []int{9} + return file_container_grpc_service_proto_rawDescGZIP(), []int{9} } func (x *SetExtendedACLResponse) GetBody() *SetExtendedACLResponse_Body { @@ -744,7 +744,7 @@ type GetExtendedACLRequest struct { func (x *GetExtendedACLRequest) Reset() { *x = GetExtendedACLRequest{} if protoimpl.UnsafeEnabled { - mi := &file_v2_container_grpc_service_proto_msgTypes[10] + mi := &file_container_grpc_service_proto_msgTypes[10] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -757,7 +757,7 @@ func (x *GetExtendedACLRequest) String() string { func (*GetExtendedACLRequest) ProtoMessage() {} func (x *GetExtendedACLRequest) ProtoReflect() protoreflect.Message { - mi := &file_v2_container_grpc_service_proto_msgTypes[10] + mi := &file_container_grpc_service_proto_msgTypes[10] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -770,7 +770,7 @@ func (x *GetExtendedACLRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use GetExtendedACLRequest.ProtoReflect.Descriptor instead. func (*GetExtendedACLRequest) Descriptor() ([]byte, []int) { - return file_v2_container_grpc_service_proto_rawDescGZIP(), []int{10} + return file_container_grpc_service_proto_rawDescGZIP(), []int{10} } func (x *GetExtendedACLRequest) GetBody() *GetExtendedACLRequest_Body { @@ -814,7 +814,7 @@ type GetExtendedACLResponse struct { func (x *GetExtendedACLResponse) Reset() { *x = GetExtendedACLResponse{} if protoimpl.UnsafeEnabled { - mi := &file_v2_container_grpc_service_proto_msgTypes[11] + mi := &file_container_grpc_service_proto_msgTypes[11] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -827,7 +827,7 @@ func (x *GetExtendedACLResponse) String() string { func (*GetExtendedACLResponse) ProtoMessage() {} func (x *GetExtendedACLResponse) ProtoReflect() protoreflect.Message { - mi := &file_v2_container_grpc_service_proto_msgTypes[11] + mi := &file_container_grpc_service_proto_msgTypes[11] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -840,7 +840,7 @@ func (x *GetExtendedACLResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use GetExtendedACLResponse.ProtoReflect.Descriptor instead. func (*GetExtendedACLResponse) Descriptor() ([]byte, []int) { - return file_v2_container_grpc_service_proto_rawDescGZIP(), []int{11} + return file_container_grpc_service_proto_rawDescGZIP(), []int{11} } func (x *GetExtendedACLResponse) GetBody() *GetExtendedACLResponse_Body { @@ -884,7 +884,7 @@ type AnnounceUsedSpaceRequest struct { func (x *AnnounceUsedSpaceRequest) Reset() { *x = AnnounceUsedSpaceRequest{} if protoimpl.UnsafeEnabled { - mi := &file_v2_container_grpc_service_proto_msgTypes[12] + mi := &file_container_grpc_service_proto_msgTypes[12] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -897,7 +897,7 @@ func (x *AnnounceUsedSpaceRequest) String() string { func (*AnnounceUsedSpaceRequest) ProtoMessage() {} func (x *AnnounceUsedSpaceRequest) ProtoReflect() protoreflect.Message { - mi := &file_v2_container_grpc_service_proto_msgTypes[12] + mi := &file_container_grpc_service_proto_msgTypes[12] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -910,7 +910,7 @@ func (x *AnnounceUsedSpaceRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use AnnounceUsedSpaceRequest.ProtoReflect.Descriptor instead. func (*AnnounceUsedSpaceRequest) Descriptor() ([]byte, []int) { - return file_v2_container_grpc_service_proto_rawDescGZIP(), []int{12} + return file_container_grpc_service_proto_rawDescGZIP(), []int{12} } func (x *AnnounceUsedSpaceRequest) GetBody() *AnnounceUsedSpaceRequest_Body { @@ -954,7 +954,7 @@ type AnnounceUsedSpaceResponse struct { func (x *AnnounceUsedSpaceResponse) Reset() { *x = AnnounceUsedSpaceResponse{} if protoimpl.UnsafeEnabled { - mi := &file_v2_container_grpc_service_proto_msgTypes[13] + mi := &file_container_grpc_service_proto_msgTypes[13] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -967,7 +967,7 @@ func (x *AnnounceUsedSpaceResponse) String() string { func (*AnnounceUsedSpaceResponse) ProtoMessage() {} func (x *AnnounceUsedSpaceResponse) ProtoReflect() protoreflect.Message { - mi := &file_v2_container_grpc_service_proto_msgTypes[13] + mi := &file_container_grpc_service_proto_msgTypes[13] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -980,7 +980,7 @@ func (x *AnnounceUsedSpaceResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use AnnounceUsedSpaceResponse.ProtoReflect.Descriptor instead. func (*AnnounceUsedSpaceResponse) Descriptor() ([]byte, []int) { - return file_v2_container_grpc_service_proto_rawDescGZIP(), []int{13} + return file_container_grpc_service_proto_rawDescGZIP(), []int{13} } func (x *AnnounceUsedSpaceResponse) GetBody() *AnnounceUsedSpaceResponse_Body { @@ -1023,7 +1023,7 @@ type PutRequest_Body struct { func (x *PutRequest_Body) Reset() { *x = PutRequest_Body{} if protoimpl.UnsafeEnabled { - mi := &file_v2_container_grpc_service_proto_msgTypes[14] + mi := &file_container_grpc_service_proto_msgTypes[14] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1036,7 +1036,7 @@ func (x *PutRequest_Body) String() string { func (*PutRequest_Body) ProtoMessage() {} func (x *PutRequest_Body) ProtoReflect() protoreflect.Message { - mi := &file_v2_container_grpc_service_proto_msgTypes[14] + mi := &file_container_grpc_service_proto_msgTypes[14] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1049,7 +1049,7 @@ func (x *PutRequest_Body) ProtoReflect() protoreflect.Message { // Deprecated: Use PutRequest_Body.ProtoReflect.Descriptor instead. func (*PutRequest_Body) Descriptor() ([]byte, []int) { - return file_v2_container_grpc_service_proto_rawDescGZIP(), []int{0, 0} + return file_container_grpc_service_proto_rawDescGZIP(), []int{0, 0} } func (x *PutRequest_Body) GetContainer() *Container { @@ -1082,7 +1082,7 @@ type PutResponse_Body struct { func (x *PutResponse_Body) Reset() { *x = PutResponse_Body{} if protoimpl.UnsafeEnabled { - mi := &file_v2_container_grpc_service_proto_msgTypes[15] + mi := &file_container_grpc_service_proto_msgTypes[15] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1095,7 +1095,7 @@ func (x *PutResponse_Body) String() string { func (*PutResponse_Body) ProtoMessage() {} func (x *PutResponse_Body) ProtoReflect() protoreflect.Message { - mi := &file_v2_container_grpc_service_proto_msgTypes[15] + mi := &file_container_grpc_service_proto_msgTypes[15] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1108,7 +1108,7 @@ func (x *PutResponse_Body) ProtoReflect() protoreflect.Message { // Deprecated: Use PutResponse_Body.ProtoReflect.Descriptor instead. func (*PutResponse_Body) Descriptor() ([]byte, []int) { - return file_v2_container_grpc_service_proto_rawDescGZIP(), []int{1, 0} + return file_container_grpc_service_proto_rawDescGZIP(), []int{1, 0} } func (x *PutResponse_Body) GetContainerId() *grpc1.ContainerID { @@ -1135,7 +1135,7 @@ type DeleteRequest_Body struct { func (x *DeleteRequest_Body) Reset() { *x = DeleteRequest_Body{} if protoimpl.UnsafeEnabled { - mi := &file_v2_container_grpc_service_proto_msgTypes[16] + mi := &file_container_grpc_service_proto_msgTypes[16] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1148,7 +1148,7 @@ func (x *DeleteRequest_Body) String() string { func (*DeleteRequest_Body) ProtoMessage() {} func (x *DeleteRequest_Body) ProtoReflect() protoreflect.Message { - mi := &file_v2_container_grpc_service_proto_msgTypes[16] + mi := &file_container_grpc_service_proto_msgTypes[16] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1161,7 +1161,7 @@ func (x *DeleteRequest_Body) ProtoReflect() protoreflect.Message { // Deprecated: Use DeleteRequest_Body.ProtoReflect.Descriptor instead. func (*DeleteRequest_Body) Descriptor() ([]byte, []int) { - return file_v2_container_grpc_service_proto_rawDescGZIP(), []int{2, 0} + return file_container_grpc_service_proto_rawDescGZIP(), []int{2, 0} } func (x *DeleteRequest_Body) GetContainerId() *grpc1.ContainerID { @@ -1189,7 +1189,7 @@ type DeleteResponse_Body struct { func (x *DeleteResponse_Body) Reset() { *x = DeleteResponse_Body{} if protoimpl.UnsafeEnabled { - mi := &file_v2_container_grpc_service_proto_msgTypes[17] + mi := &file_container_grpc_service_proto_msgTypes[17] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1202,7 +1202,7 @@ func (x *DeleteResponse_Body) String() string { func (*DeleteResponse_Body) ProtoMessage() {} func (x *DeleteResponse_Body) ProtoReflect() protoreflect.Message { - mi := &file_v2_container_grpc_service_proto_msgTypes[17] + mi := &file_container_grpc_service_proto_msgTypes[17] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1215,7 +1215,7 @@ func (x *DeleteResponse_Body) ProtoReflect() protoreflect.Message { // Deprecated: Use DeleteResponse_Body.ProtoReflect.Descriptor instead. func (*DeleteResponse_Body) Descriptor() ([]byte, []int) { - return file_v2_container_grpc_service_proto_rawDescGZIP(), []int{3, 0} + return file_container_grpc_service_proto_rawDescGZIP(), []int{3, 0} } // Get container structure request body. @@ -1231,7 +1231,7 @@ type GetRequest_Body struct { func (x *GetRequest_Body) Reset() { *x = GetRequest_Body{} if protoimpl.UnsafeEnabled { - mi := &file_v2_container_grpc_service_proto_msgTypes[18] + mi := &file_container_grpc_service_proto_msgTypes[18] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1244,7 +1244,7 @@ func (x *GetRequest_Body) String() string { func (*GetRequest_Body) ProtoMessage() {} func (x *GetRequest_Body) ProtoReflect() protoreflect.Message { - mi := &file_v2_container_grpc_service_proto_msgTypes[18] + mi := &file_container_grpc_service_proto_msgTypes[18] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1257,7 +1257,7 @@ func (x *GetRequest_Body) ProtoReflect() protoreflect.Message { // Deprecated: Use GetRequest_Body.ProtoReflect.Descriptor instead. func (*GetRequest_Body) Descriptor() ([]byte, []int) { - return file_v2_container_grpc_service_proto_rawDescGZIP(), []int{4, 0} + return file_container_grpc_service_proto_rawDescGZIP(), []int{4, 0} } func (x *GetRequest_Body) GetContainerId() *grpc1.ContainerID { @@ -1285,7 +1285,7 @@ type GetResponse_Body struct { func (x *GetResponse_Body) Reset() { *x = GetResponse_Body{} if protoimpl.UnsafeEnabled { - mi := &file_v2_container_grpc_service_proto_msgTypes[19] + mi := &file_container_grpc_service_proto_msgTypes[19] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1298,7 +1298,7 @@ func (x *GetResponse_Body) String() string { func (*GetResponse_Body) ProtoMessage() {} func (x *GetResponse_Body) ProtoReflect() protoreflect.Message { - mi := &file_v2_container_grpc_service_proto_msgTypes[19] + mi := &file_container_grpc_service_proto_msgTypes[19] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1311,7 +1311,7 @@ func (x *GetResponse_Body) ProtoReflect() protoreflect.Message { // Deprecated: Use GetResponse_Body.ProtoReflect.Descriptor instead. func (*GetResponse_Body) Descriptor() ([]byte, []int) { - return file_v2_container_grpc_service_proto_rawDescGZIP(), []int{5, 0} + return file_container_grpc_service_proto_rawDescGZIP(), []int{5, 0} } func (x *GetResponse_Body) GetContainer() *Container { @@ -1348,7 +1348,7 @@ type ListRequest_Body struct { func (x *ListRequest_Body) Reset() { *x = ListRequest_Body{} if protoimpl.UnsafeEnabled { - mi := &file_v2_container_grpc_service_proto_msgTypes[20] + mi := &file_container_grpc_service_proto_msgTypes[20] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1361,7 +1361,7 @@ func (x *ListRequest_Body) String() string { func (*ListRequest_Body) ProtoMessage() {} func (x *ListRequest_Body) ProtoReflect() protoreflect.Message { - mi := &file_v2_container_grpc_service_proto_msgTypes[20] + mi := &file_container_grpc_service_proto_msgTypes[20] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1374,7 +1374,7 @@ func (x *ListRequest_Body) ProtoReflect() protoreflect.Message { // Deprecated: Use ListRequest_Body.ProtoReflect.Descriptor instead. func (*ListRequest_Body) Descriptor() ([]byte, []int) { - return file_v2_container_grpc_service_proto_rawDescGZIP(), []int{6, 0} + return file_container_grpc_service_proto_rawDescGZIP(), []int{6, 0} } func (x *ListRequest_Body) GetOwnerId() *grpc1.OwnerID { @@ -1397,7 +1397,7 @@ type ListResponse_Body struct { func (x *ListResponse_Body) Reset() { *x = ListResponse_Body{} if protoimpl.UnsafeEnabled { - mi := &file_v2_container_grpc_service_proto_msgTypes[21] + mi := &file_container_grpc_service_proto_msgTypes[21] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1410,7 +1410,7 @@ func (x *ListResponse_Body) String() string { func (*ListResponse_Body) ProtoMessage() {} func (x *ListResponse_Body) ProtoReflect() protoreflect.Message { - mi := &file_v2_container_grpc_service_proto_msgTypes[21] + mi := &file_container_grpc_service_proto_msgTypes[21] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1423,7 +1423,7 @@ func (x *ListResponse_Body) ProtoReflect() protoreflect.Message { // Deprecated: Use ListResponse_Body.ProtoReflect.Descriptor instead. func (*ListResponse_Body) Descriptor() ([]byte, []int) { - return file_v2_container_grpc_service_proto_rawDescGZIP(), []int{7, 0} + return file_container_grpc_service_proto_rawDescGZIP(), []int{7, 0} } func (x *ListResponse_Body) GetContainerIds() []*grpc1.ContainerID { @@ -1449,7 +1449,7 @@ type SetExtendedACLRequest_Body struct { func (x *SetExtendedACLRequest_Body) Reset() { *x = SetExtendedACLRequest_Body{} if protoimpl.UnsafeEnabled { - mi := &file_v2_container_grpc_service_proto_msgTypes[22] + mi := &file_container_grpc_service_proto_msgTypes[22] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1462,7 +1462,7 @@ func (x *SetExtendedACLRequest_Body) String() string { func (*SetExtendedACLRequest_Body) ProtoMessage() {} func (x *SetExtendedACLRequest_Body) ProtoReflect() protoreflect.Message { - mi := &file_v2_container_grpc_service_proto_msgTypes[22] + mi := &file_container_grpc_service_proto_msgTypes[22] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1475,7 +1475,7 @@ func (x *SetExtendedACLRequest_Body) ProtoReflect() protoreflect.Message { // Deprecated: Use SetExtendedACLRequest_Body.ProtoReflect.Descriptor instead. func (*SetExtendedACLRequest_Body) Descriptor() ([]byte, []int) { - return file_v2_container_grpc_service_proto_rawDescGZIP(), []int{8, 0} + return file_container_grpc_service_proto_rawDescGZIP(), []int{8, 0} } func (x *SetExtendedACLRequest_Body) GetEacl() *grpc2.EACLTable { @@ -1504,7 +1504,7 @@ type SetExtendedACLResponse_Body struct { func (x *SetExtendedACLResponse_Body) Reset() { *x = SetExtendedACLResponse_Body{} if protoimpl.UnsafeEnabled { - mi := &file_v2_container_grpc_service_proto_msgTypes[23] + mi := &file_container_grpc_service_proto_msgTypes[23] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1517,7 +1517,7 @@ func (x *SetExtendedACLResponse_Body) String() string { func (*SetExtendedACLResponse_Body) ProtoMessage() {} func (x *SetExtendedACLResponse_Body) ProtoReflect() protoreflect.Message { - mi := &file_v2_container_grpc_service_proto_msgTypes[23] + mi := &file_container_grpc_service_proto_msgTypes[23] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1530,7 +1530,7 @@ func (x *SetExtendedACLResponse_Body) ProtoReflect() protoreflect.Message { // Deprecated: Use SetExtendedACLResponse_Body.ProtoReflect.Descriptor instead. func (*SetExtendedACLResponse_Body) Descriptor() ([]byte, []int) { - return file_v2_container_grpc_service_proto_rawDescGZIP(), []int{9, 0} + return file_container_grpc_service_proto_rawDescGZIP(), []int{9, 0} } // Get Extended ACL request body @@ -1546,7 +1546,7 @@ type GetExtendedACLRequest_Body struct { func (x *GetExtendedACLRequest_Body) Reset() { *x = GetExtendedACLRequest_Body{} if protoimpl.UnsafeEnabled { - mi := &file_v2_container_grpc_service_proto_msgTypes[24] + mi := &file_container_grpc_service_proto_msgTypes[24] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1559,7 +1559,7 @@ func (x *GetExtendedACLRequest_Body) String() string { func (*GetExtendedACLRequest_Body) ProtoMessage() {} func (x *GetExtendedACLRequest_Body) ProtoReflect() protoreflect.Message { - mi := &file_v2_container_grpc_service_proto_msgTypes[24] + mi := &file_container_grpc_service_proto_msgTypes[24] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1572,7 +1572,7 @@ func (x *GetExtendedACLRequest_Body) ProtoReflect() protoreflect.Message { // Deprecated: Use GetExtendedACLRequest_Body.ProtoReflect.Descriptor instead. func (*GetExtendedACLRequest_Body) Descriptor() ([]byte, []int) { - return file_v2_container_grpc_service_proto_rawDescGZIP(), []int{10, 0} + return file_container_grpc_service_proto_rawDescGZIP(), []int{10, 0} } func (x *GetExtendedACLRequest_Body) GetContainerId() *grpc1.ContainerID { @@ -1601,7 +1601,7 @@ type GetExtendedACLResponse_Body struct { func (x *GetExtendedACLResponse_Body) Reset() { *x = GetExtendedACLResponse_Body{} if protoimpl.UnsafeEnabled { - mi := &file_v2_container_grpc_service_proto_msgTypes[25] + mi := &file_container_grpc_service_proto_msgTypes[25] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1614,7 +1614,7 @@ func (x *GetExtendedACLResponse_Body) String() string { func (*GetExtendedACLResponse_Body) ProtoMessage() {} func (x *GetExtendedACLResponse_Body) ProtoReflect() protoreflect.Message { - mi := &file_v2_container_grpc_service_proto_msgTypes[25] + mi := &file_container_grpc_service_proto_msgTypes[25] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1627,7 +1627,7 @@ func (x *GetExtendedACLResponse_Body) ProtoReflect() protoreflect.Message { // Deprecated: Use GetExtendedACLResponse_Body.ProtoReflect.Descriptor instead. func (*GetExtendedACLResponse_Body) Descriptor() ([]byte, []int) { - return file_v2_container_grpc_service_proto_rawDescGZIP(), []int{11, 0} + return file_container_grpc_service_proto_rawDescGZIP(), []int{11, 0} } func (x *GetExtendedACLResponse_Body) GetEacl() *grpc2.EACLTable { @@ -1665,7 +1665,7 @@ type AnnounceUsedSpaceRequest_Body struct { func (x *AnnounceUsedSpaceRequest_Body) Reset() { *x = AnnounceUsedSpaceRequest_Body{} if protoimpl.UnsafeEnabled { - mi := &file_v2_container_grpc_service_proto_msgTypes[26] + mi := &file_container_grpc_service_proto_msgTypes[26] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1678,7 +1678,7 @@ func (x *AnnounceUsedSpaceRequest_Body) String() string { func (*AnnounceUsedSpaceRequest_Body) ProtoMessage() {} func (x *AnnounceUsedSpaceRequest_Body) ProtoReflect() protoreflect.Message { - mi := &file_v2_container_grpc_service_proto_msgTypes[26] + mi := &file_container_grpc_service_proto_msgTypes[26] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1691,7 +1691,7 @@ func (x *AnnounceUsedSpaceRequest_Body) ProtoReflect() protoreflect.Message { // Deprecated: Use AnnounceUsedSpaceRequest_Body.ProtoReflect.Descriptor instead. func (*AnnounceUsedSpaceRequest_Body) Descriptor() ([]byte, []int) { - return file_v2_container_grpc_service_proto_rawDescGZIP(), []int{12, 0} + return file_container_grpc_service_proto_rawDescGZIP(), []int{12, 0} } func (x *AnnounceUsedSpaceRequest_Body) GetAnnouncements() []*AnnounceUsedSpaceRequest_Body_Announcement { @@ -1719,7 +1719,7 @@ type AnnounceUsedSpaceRequest_Body_Announcement struct { func (x *AnnounceUsedSpaceRequest_Body_Announcement) Reset() { *x = AnnounceUsedSpaceRequest_Body_Announcement{} if protoimpl.UnsafeEnabled { - mi := &file_v2_container_grpc_service_proto_msgTypes[27] + mi := &file_container_grpc_service_proto_msgTypes[27] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1732,7 +1732,7 @@ func (x *AnnounceUsedSpaceRequest_Body_Announcement) String() string { func (*AnnounceUsedSpaceRequest_Body_Announcement) ProtoMessage() {} func (x *AnnounceUsedSpaceRequest_Body_Announcement) ProtoReflect() protoreflect.Message { - mi := &file_v2_container_grpc_service_proto_msgTypes[27] + mi := &file_container_grpc_service_proto_msgTypes[27] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1745,7 +1745,7 @@ func (x *AnnounceUsedSpaceRequest_Body_Announcement) ProtoReflect() protoreflect // Deprecated: Use AnnounceUsedSpaceRequest_Body_Announcement.ProtoReflect.Descriptor instead. func (*AnnounceUsedSpaceRequest_Body_Announcement) Descriptor() ([]byte, []int) { - return file_v2_container_grpc_service_proto_rawDescGZIP(), []int{12, 0, 0} + return file_container_grpc_service_proto_rawDescGZIP(), []int{12, 0, 0} } func (x *AnnounceUsedSpaceRequest_Body_Announcement) GetEpoch() uint64 { @@ -1780,7 +1780,7 @@ type AnnounceUsedSpaceResponse_Body struct { func (x *AnnounceUsedSpaceResponse_Body) Reset() { *x = AnnounceUsedSpaceResponse_Body{} if protoimpl.UnsafeEnabled { - mi := &file_v2_container_grpc_service_proto_msgTypes[28] + mi := &file_container_grpc_service_proto_msgTypes[28] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1793,7 +1793,7 @@ func (x *AnnounceUsedSpaceResponse_Body) String() string { func (*AnnounceUsedSpaceResponse_Body) ProtoMessage() {} func (x *AnnounceUsedSpaceResponse_Body) ProtoReflect() protoreflect.Message { - mi := &file_v2_container_grpc_service_proto_msgTypes[28] + mi := &file_container_grpc_service_proto_msgTypes[28] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1806,48 +1806,89 @@ func (x *AnnounceUsedSpaceResponse_Body) ProtoReflect() protoreflect.Message { // Deprecated: Use AnnounceUsedSpaceResponse_Body.ProtoReflect.Descriptor instead. func (*AnnounceUsedSpaceResponse_Body) Descriptor() ([]byte, []int) { - return file_v2_container_grpc_service_proto_rawDescGZIP(), []int{13, 0} + return file_container_grpc_service_proto_rawDescGZIP(), []int{13, 0} } -var File_v2_container_grpc_service_proto protoreflect.FileDescriptor +var File_container_grpc_service_proto protoreflect.FileDescriptor -var file_v2_container_grpc_service_proto_rawDesc = []byte{ - 0x0a, 0x1f, 0x76, 0x32, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2f, 0x67, - 0x72, 0x70, 0x63, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 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, 0x17, 0x76, 0x32, 0x2f, 0x61, 0x63, 0x6c, 0x2f, 0x67, - 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, - 0x1d, 0x76, 0x32, 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, 0x1a, 0x18, - 0x76, 0x32, 0x2f, 0x72, 0x65, 0x66, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, - 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x76, 0x32, 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, 0xdf, 0x02, 0x0a, 0x0a, 0x50, 0x75, 0x74, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x12, 0x38, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, - 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x75, 0x74, 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, +var file_container_grpc_service_proto_rawDesc = []byte{ + 0x0a, 0x1c, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2f, 0x67, 0x72, 0x70, 0x63, + 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 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, 0x14, 0x61, 0x63, 0x6c, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, + 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1a, 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, 0x1a, 0x15, 0x72, 0x65, 0x66, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, + 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x18, 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, 0xdf, 0x02, 0x0a, 0x0a, 0x50, 0x75, 0x74, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x38, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 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, 0x7d, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, - 0x12, 0x3c, 0x0a, 0x09, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x1e, 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, 0x52, 0x09, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x12, 0x37, - 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, - 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, - 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x22, 0xac, 0x02, 0x0a, 0x0b, 0x50, 0x75, 0x74, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 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, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x75, 0x74, 0x52, + 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x75, 0x74, 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, 0x7d, 0x0a, 0x04, 0x42, 0x6f, 0x64, + 0x79, 0x12, 0x3c, 0x0a, 0x09, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 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, 0x52, 0x09, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x12, + 0x37, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, + 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, + 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x22, 0xac, 0x02, 0x0a, 0x0b, 0x50, 0x75, 0x74, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 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, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x75, 0x74, + 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, + 0x46, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x3e, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x61, + 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, + 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, + 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, + 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x64, 0x22, 0xe7, 0x02, 0x0a, 0x0d, 0x44, 0x65, 0x6c, 0x65, + 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x3b, 0x0a, 0x04, 0x62, 0x6f, 0x64, + 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, + 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x44, 0x65, + 0x6c, 0x65, 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, 0x7f, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x3e, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, + 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, + 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x52, 0x0b, 0x63, 0x6f, 0x6e, + 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x64, 0x12, 0x37, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, + 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, + 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, + 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, + 0x65, 0x22, 0xf2, 0x01, 0x0a, 0x0e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3c, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, + 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, 0x44, 0x65, 0x6c, 0x65, 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, @@ -1858,53 +1899,134 @@ var file_v2_container_grpc_service_proto_rawDesc = []byte{ 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, 0x46, - 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x3e, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, - 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, - 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x6f, - 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x61, - 0x69, 0x6e, 0x65, 0x72, 0x49, 0x64, 0x22, 0xe7, 0x02, 0x0a, 0x0d, 0x44, 0x65, 0x6c, 0x65, 0x74, - 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x3b, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, - 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x44, 0x65, 0x6c, - 0x65, 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, + 0x52, 0x0c, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x1a, 0x06, + 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x22, 0xa8, 0x02, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x38, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, + 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x74, 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, 0x46, 0x0a, 0x04, 0x42, 0x6f, 0x64, + 0x79, 0x12, 0x3e, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, + 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, + 0x65, 0x72, 0x49, 0x44, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, + 0x64, 0x22, 0xaa, 0x03, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 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, 0x63, 0x6f, 0x6e, 0x74, + 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x74, 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, 0xc3, 0x01, 0x0a, 0x04, 0x42, 0x6f, 0x64, + 0x79, 0x12, 0x3c, 0x0a, 0x09, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 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, 0x52, 0x09, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x12, + 0x37, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, + 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, + 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x44, 0x0a, 0x0d, 0x73, 0x65, 0x73, 0x73, + 0x69, 0x6f, 0x6e, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, + 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, + 0x52, 0x0c, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x9e, + 0x02, 0x0a, 0x0b, 0x4c, 0x69, 0x73, 0x74, 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, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, + 0x65, 0x72, 0x2e, 0x4c, 0x69, 0x73, 0x74, 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, + 0xb0, 0x02, 0x0a, 0x0c, 0x4c, 0x69, 0x73, 0x74, 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, 0x63, 0x6f, 0x6e, 0x74, 0x61, + 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x4c, 0x69, 0x73, 0x74, 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, 0x48, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, + 0x12, 0x40, 0x0a, 0x0d, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, + 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, + 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, + 0x65, 0x72, 0x49, 0x44, 0x52, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, + 0x64, 0x73, 0x22, 0xe5, 0x02, 0x0a, 0x15, 0x53, 0x65, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, + 0x65, 0x64, 0x41, 0x43, 0x4c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x43, 0x0a, 0x04, + 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x6e, 0x65, 0x6f, + 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, + 0x2e, 0x53, 0x65, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x41, 0x43, 0x4c, 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, 0x6d, 0x0a, 0x04, 0x42, + 0x6f, 0x64, 0x79, 0x12, 0x2c, 0x0a, 0x04, 0x65, 0x61, 0x63, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, + 0x6c, 0x2e, 0x45, 0x41, 0x43, 0x4c, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x52, 0x04, 0x65, 0x61, 0x63, + 0x6c, 0x12, 0x37, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, + 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x22, 0x82, 0x02, 0x0a, 0x16, 0x53, + 0x65, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x41, 0x43, 0x4c, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x44, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x30, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, + 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x53, 0x65, 0x74, 0x45, 0x78, 0x74, + 0x65, 0x6e, 0x64, 0x65, 0x64, 0x41, 0x43, 0x4c, 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, 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, - 0x7f, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x3e, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x61, - 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, - 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, - 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, - 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x64, 0x12, 0x37, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, - 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, - 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, - 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, - 0x22, 0xf2, 0x01, 0x0a, 0x0e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x12, 0x3c, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 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, 0x44, 0x65, 0x6c, 0x65, 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, 0x06, 0x0a, - 0x04, 0x42, 0x6f, 0x64, 0x79, 0x22, 0xa8, 0x02, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x12, 0x38, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, - 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, + 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, 0x06, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x22, + 0xbe, 0x02, 0x0a, 0x15, 0x47, 0x65, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x41, + 0x43, 0x4c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x43, 0x0a, 0x04, 0x62, 0x6f, 0x64, + 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, + 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x47, 0x65, + 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x41, 0x43, 0x4c, 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, @@ -1920,37 +2042,39 @@ var file_v2_container_grpc_service_proto_rawDesc = []byte{ 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x64, - 0x22, 0xaa, 0x03, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x12, 0x39, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, + 0x22, 0xb0, 0x03, 0x0a, 0x16, 0x47, 0x65, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, + 0x41, 0x43, 0x4c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x44, 0x0a, 0x04, 0x62, + 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x30, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, + 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, + 0x47, 0x65, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x41, 0x43, 0x4c, 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, 0xb3, 0x01, + 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x2c, 0x0a, 0x04, 0x65, 0x61, 0x63, 0x6c, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x45, 0x41, 0x43, 0x4c, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x52, 0x04, + 0x65, 0x61, 0x63, 0x6c, 0x12, 0x37, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, + 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, + 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x44, 0x0a, + 0x0d, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, + 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x0c, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x6f, + 0x6b, 0x65, 0x6e, 0x22, 0xf2, 0x03, 0x0a, 0x18, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, + 0x55, 0x73, 0x65, 0x64, 0x53, 0x70, 0x61, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x46, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x32, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, - 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x74, 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, 0xc3, 0x01, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, - 0x12, 0x3c, 0x0a, 0x09, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x1e, 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, 0x52, 0x09, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x12, 0x37, - 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, - 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, - 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x44, 0x0a, 0x0d, 0x73, 0x65, 0x73, 0x73, 0x69, - 0x6f, 0x6e, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, - 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, - 0x6f, 0x6e, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, - 0x0c, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x9e, 0x02, - 0x0a, 0x0b, 0x4c, 0x69, 0x73, 0x74, 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, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, - 0x72, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x42, 0x6f, + 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x55, 0x73, 0x65, + 0x64, 0x53, 0x70, 0x61, 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, @@ -1961,227 +2085,102 @@ var file_v2_container_grpc_service_proto_rawDesc = []byte{ 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, 0xb0, - 0x02, 0x0a, 0x0c, 0x4c, 0x69, 0x73, 0x74, 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, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, - 0x6e, 0x65, 0x72, 0x2e, 0x4c, 0x69, 0x73, 0x74, 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, 0x48, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, - 0x40, 0x0a, 0x0d, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x73, - 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, - 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, - 0x72, 0x49, 0x44, 0x52, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x64, - 0x73, 0x22, 0xe5, 0x02, 0x0a, 0x15, 0x53, 0x65, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, - 0x64, 0x41, 0x43, 0x4c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x43, 0x0a, 0x04, 0x62, - 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, - 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, - 0x53, 0x65, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x41, 0x43, 0x4c, 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, + 0x65, 0x72, 0x1a, 0xf3, 0x01, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x65, 0x0a, 0x0d, 0x61, + 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x3f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, + 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, + 0x65, 0x55, 0x73, 0x65, 0x64, 0x53, 0x70, 0x61, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x2e, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x6d, + 0x65, 0x6e, 0x74, 0x52, 0x0d, 0x61, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x6d, 0x65, 0x6e, + 0x74, 0x73, 0x1a, 0x83, 0x01, 0x0a, 0x0c, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x6d, + 0x65, 0x6e, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x04, 0x52, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x12, 0x3e, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, + 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, + 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x52, 0x0b, 0x63, 0x6f, + 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x75, 0x73, 0x65, + 0x64, 0x5f, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x75, + 0x73, 0x65, 0x64, 0x53, 0x70, 0x61, 0x63, 0x65, 0x22, 0x88, 0x02, 0x0a, 0x19, 0x41, 0x6e, 0x6e, + 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x55, 0x73, 0x65, 0x64, 0x53, 0x70, 0x61, 0x63, 0x65, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x47, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x33, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x41, 0x6e, 0x6e, 0x6f, 0x75, + 0x6e, 0x63, 0x65, 0x55, 0x73, 0x65, 0x64, 0x53, 0x70, 0x61, 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, 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, 0x6d, 0x0a, 0x04, 0x42, 0x6f, - 0x64, 0x79, 0x12, 0x2c, 0x0a, 0x04, 0x65, 0x61, 0x63, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, - 0x2e, 0x45, 0x41, 0x43, 0x4c, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x52, 0x04, 0x65, 0x61, 0x63, 0x6c, - 0x12, 0x37, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, - 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, - 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x22, 0x82, 0x02, 0x0a, 0x16, 0x53, 0x65, - 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x41, 0x43, 0x4c, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x44, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x30, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, - 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x53, 0x65, 0x74, 0x45, 0x78, 0x74, 0x65, - 0x6e, 0x64, 0x65, 0x64, 0x41, 0x43, 0x4c, 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, 0x06, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x22, 0xbe, - 0x02, 0x0a, 0x15, 0x47, 0x65, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x41, 0x43, - 0x4c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x43, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, - 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x74, - 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x41, 0x43, 0x4c, 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, 0x46, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, - 0x3e, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, - 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, - 0x49, 0x44, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x64, 0x22, - 0xb0, 0x03, 0x0a, 0x16, 0x47, 0x65, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x41, - 0x43, 0x4c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x44, 0x0a, 0x04, 0x62, 0x6f, - 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x30, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, - 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x47, - 0x65, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x41, 0x43, 0x4c, 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, 0xb3, 0x01, 0x0a, - 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x2c, 0x0a, 0x04, 0x65, 0x61, 0x63, 0x6c, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, - 0x61, 0x63, 0x6c, 0x2e, 0x45, 0x41, 0x43, 0x4c, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x52, 0x04, 0x65, - 0x61, 0x63, 0x6c, 0x12, 0x37, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, - 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, - 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x44, 0x0a, 0x0d, - 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, - 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x54, - 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x0c, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x6f, 0x6b, - 0x65, 0x6e, 0x22, 0xf2, 0x03, 0x0a, 0x18, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x55, - 0x73, 0x65, 0x64, 0x53, 0x70, 0x61, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, - 0x46, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x32, 0x2e, - 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, - 0x6e, 0x65, 0x72, 0x2e, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x55, 0x73, 0x65, 0x64, - 0x53, 0x70, 0x61, 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, 0xf3, 0x01, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x65, 0x0a, 0x0d, 0x61, 0x6e, - 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x3f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, - 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, - 0x55, 0x73, 0x65, 0x64, 0x53, 0x70, 0x61, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x2e, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x6d, 0x65, - 0x6e, 0x74, 0x52, 0x0d, 0x61, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x6d, 0x65, 0x6e, 0x74, - 0x73, 0x1a, 0x83, 0x01, 0x0a, 0x0c, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x6d, 0x65, - 0x6e, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x04, 0x52, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x12, 0x3e, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, - 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, - 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, - 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x52, 0x0b, 0x63, 0x6f, 0x6e, - 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x75, 0x73, 0x65, 0x64, - 0x5f, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x75, 0x73, - 0x65, 0x64, 0x53, 0x70, 0x61, 0x63, 0x65, 0x22, 0x88, 0x02, 0x0a, 0x19, 0x41, 0x6e, 0x6e, 0x6f, - 0x75, 0x6e, 0x63, 0x65, 0x55, 0x73, 0x65, 0x64, 0x53, 0x70, 0x61, 0x63, 0x65, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x47, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x33, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, - 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, - 0x63, 0x65, 0x55, 0x73, 0x65, 0x64, 0x53, 0x70, 0x61, 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, 0x06, 0x0a, 0x04, 0x42, 0x6f, - 0x64, 0x79, 0x32, 0x90, 0x05, 0x0a, 0x10, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, - 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x48, 0x0a, 0x03, 0x50, 0x75, 0x74, 0x12, 0x1f, - 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, - 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, - 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x12, 0x51, 0x0a, 0x06, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x12, 0x22, 0x2e, 0x6e, 0x65, - 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, - 0x72, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x23, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, - 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x48, 0x0a, 0x03, 0x47, 0x65, 0x74, 0x12, 0x1f, 0x2e, 0x6e, 0x65, - 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, - 0x72, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x6e, + 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, 0x06, 0x0a, 0x04, 0x42, + 0x6f, 0x64, 0x79, 0x32, 0x90, 0x05, 0x0a, 0x10, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, + 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x48, 0x0a, 0x03, 0x50, 0x75, 0x74, 0x12, + 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, + 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, + 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x51, 0x0a, 0x06, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x12, 0x22, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, - 0x65, 0x72, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4b, - 0x0a, 0x04, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, - 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x4c, 0x69, 0x73, - 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, - 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x4c, - 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x69, 0x0a, 0x0e, 0x53, - 0x65, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x41, 0x43, 0x4c, 0x12, 0x2a, 0x2e, + 0x65, 0x72, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x23, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, + 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x48, 0x0a, 0x03, 0x47, 0x65, 0x74, 0x12, 0x1f, 0x2e, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, + 0x65, 0x72, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, - 0x6e, 0x65, 0x72, 0x2e, 0x53, 0x65, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x41, - 0x43, 0x4c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, + 0x6e, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x4b, 0x0a, 0x04, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, + 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x4c, 0x69, + 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, - 0x53, 0x65, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x41, 0x43, 0x4c, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x69, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x45, 0x78, 0x74, - 0x65, 0x6e, 0x64, 0x65, 0x64, 0x41, 0x43, 0x4c, 0x12, 0x2a, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, - 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x47, - 0x65, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x41, 0x43, 0x4c, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, - 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x74, 0x45, 0x78, - 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x41, 0x43, 0x4c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x12, 0x72, 0x0a, 0x11, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x55, 0x73, 0x65, - 0x64, 0x53, 0x70, 0x61, 0x63, 0x65, 0x12, 0x2d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, + 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x69, 0x0a, 0x0e, + 0x53, 0x65, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x41, 0x43, 0x4c, 0x12, 0x2a, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, + 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x53, 0x65, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, + 0x41, 0x43, 0x4c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2b, 0x2e, 0x6e, 0x65, 0x6f, + 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, + 0x2e, 0x53, 0x65, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x41, 0x43, 0x4c, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x69, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x45, 0x78, + 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x41, 0x43, 0x4c, 0x12, 0x2a, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, + 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, + 0x47, 0x65, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x41, 0x43, 0x4c, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x74, 0x45, + 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x41, 0x43, 0x4c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x72, 0x0a, 0x11, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x55, 0x73, + 0x65, 0x64, 0x53, 0x70, 0x61, 0x63, 0x65, 0x12, 0x2d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, + 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x41, 0x6e, + 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x55, 0x73, 0x65, 0x64, 0x53, 0x70, 0x61, 0x63, 0x65, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2e, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x55, 0x73, 0x65, 0x64, 0x53, 0x70, 0x61, 0x63, 0x65, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2e, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, - 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x41, 0x6e, 0x6e, 0x6f, - 0x75, 0x6e, 0x63, 0x65, 0x55, 0x73, 0x65, 0x64, 0x53, 0x70, 0x61, 0x63, 0x65, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x5f, 0x5a, 0x3d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, - 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, - 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 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, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x5f, 0x5a, 0x3d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, + 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, + 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 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, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( - file_v2_container_grpc_service_proto_rawDescOnce sync.Once - file_v2_container_grpc_service_proto_rawDescData = file_v2_container_grpc_service_proto_rawDesc + file_container_grpc_service_proto_rawDescOnce sync.Once + file_container_grpc_service_proto_rawDescData = file_container_grpc_service_proto_rawDesc ) -func file_v2_container_grpc_service_proto_rawDescGZIP() []byte { - file_v2_container_grpc_service_proto_rawDescOnce.Do(func() { - file_v2_container_grpc_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_v2_container_grpc_service_proto_rawDescData) +func file_container_grpc_service_proto_rawDescGZIP() []byte { + file_container_grpc_service_proto_rawDescOnce.Do(func() { + file_container_grpc_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_container_grpc_service_proto_rawDescData) }) - return file_v2_container_grpc_service_proto_rawDescData + return file_container_grpc_service_proto_rawDescData } -var file_v2_container_grpc_service_proto_msgTypes = make([]protoimpl.MessageInfo, 29) -var file_v2_container_grpc_service_proto_goTypes = []interface{}{ +var file_container_grpc_service_proto_msgTypes = make([]protoimpl.MessageInfo, 29) +var file_container_grpc_service_proto_goTypes = []interface{}{ (*PutRequest)(nil), // 0: neo.fs.v2.container.PutRequest (*PutResponse)(nil), // 1: neo.fs.v2.container.PutResponse (*DeleteRequest)(nil), // 2: neo.fs.v2.container.DeleteRequest @@ -2222,7 +2221,7 @@ var file_v2_container_grpc_service_proto_goTypes = []interface{}{ (*grpc1.OwnerID)(nil), // 37: neo.fs.v2.refs.OwnerID (*grpc2.EACLTable)(nil), // 38: neo.fs.v2.acl.EACLTable } -var file_v2_container_grpc_service_proto_depIdxs = []int32{ +var file_container_grpc_service_proto_depIdxs = []int32{ 14, // 0: neo.fs.v2.container.PutRequest.body:type_name -> neo.fs.v2.container.PutRequest.Body 29, // 1: neo.fs.v2.container.PutRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader 30, // 2: neo.fs.v2.container.PutRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader @@ -2305,14 +2304,14 @@ var file_v2_container_grpc_service_proto_depIdxs = []int32{ 0, // [0:61] is the sub-list for field type_name } -func init() { file_v2_container_grpc_service_proto_init() } -func file_v2_container_grpc_service_proto_init() { - if File_v2_container_grpc_service_proto != nil { +func init() { file_container_grpc_service_proto_init() } +func file_container_grpc_service_proto_init() { + if File_container_grpc_service_proto != nil { return } - file_v2_container_grpc_types_proto_init() + file_container_grpc_types_proto_init() if !protoimpl.UnsafeEnabled { - file_v2_container_grpc_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_container_grpc_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PutRequest); i { case 0: return &v.state @@ -2324,7 +2323,7 @@ func file_v2_container_grpc_service_proto_init() { return nil } } - file_v2_container_grpc_service_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_container_grpc_service_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PutResponse); i { case 0: return &v.state @@ -2336,7 +2335,7 @@ func file_v2_container_grpc_service_proto_init() { return nil } } - file_v2_container_grpc_service_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + file_container_grpc_service_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*DeleteRequest); i { case 0: return &v.state @@ -2348,7 +2347,7 @@ func file_v2_container_grpc_service_proto_init() { return nil } } - file_v2_container_grpc_service_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + file_container_grpc_service_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*DeleteResponse); i { case 0: return &v.state @@ -2360,7 +2359,7 @@ func file_v2_container_grpc_service_proto_init() { return nil } } - file_v2_container_grpc_service_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + file_container_grpc_service_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GetRequest); i { case 0: return &v.state @@ -2372,7 +2371,7 @@ func file_v2_container_grpc_service_proto_init() { return nil } } - file_v2_container_grpc_service_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + file_container_grpc_service_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GetResponse); i { case 0: return &v.state @@ -2384,7 +2383,7 @@ func file_v2_container_grpc_service_proto_init() { return nil } } - file_v2_container_grpc_service_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + file_container_grpc_service_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ListRequest); i { case 0: return &v.state @@ -2396,7 +2395,7 @@ func file_v2_container_grpc_service_proto_init() { return nil } } - file_v2_container_grpc_service_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + file_container_grpc_service_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ListResponse); i { case 0: return &v.state @@ -2408,7 +2407,7 @@ func file_v2_container_grpc_service_proto_init() { return nil } } - file_v2_container_grpc_service_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + file_container_grpc_service_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*SetExtendedACLRequest); i { case 0: return &v.state @@ -2420,7 +2419,7 @@ func file_v2_container_grpc_service_proto_init() { return nil } } - file_v2_container_grpc_service_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + file_container_grpc_service_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*SetExtendedACLResponse); i { case 0: return &v.state @@ -2432,7 +2431,7 @@ func file_v2_container_grpc_service_proto_init() { return nil } } - file_v2_container_grpc_service_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + file_container_grpc_service_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GetExtendedACLRequest); i { case 0: return &v.state @@ -2444,7 +2443,7 @@ func file_v2_container_grpc_service_proto_init() { return nil } } - file_v2_container_grpc_service_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + file_container_grpc_service_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GetExtendedACLResponse); i { case 0: return &v.state @@ -2456,7 +2455,7 @@ func file_v2_container_grpc_service_proto_init() { return nil } } - file_v2_container_grpc_service_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + file_container_grpc_service_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*AnnounceUsedSpaceRequest); i { case 0: return &v.state @@ -2468,7 +2467,7 @@ func file_v2_container_grpc_service_proto_init() { return nil } } - file_v2_container_grpc_service_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + file_container_grpc_service_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*AnnounceUsedSpaceResponse); i { case 0: return &v.state @@ -2480,7 +2479,7 @@ func file_v2_container_grpc_service_proto_init() { return nil } } - file_v2_container_grpc_service_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { + file_container_grpc_service_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PutRequest_Body); i { case 0: return &v.state @@ -2492,7 +2491,7 @@ func file_v2_container_grpc_service_proto_init() { return nil } } - file_v2_container_grpc_service_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { + file_container_grpc_service_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PutResponse_Body); i { case 0: return &v.state @@ -2504,7 +2503,7 @@ func file_v2_container_grpc_service_proto_init() { return nil } } - file_v2_container_grpc_service_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { + file_container_grpc_service_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*DeleteRequest_Body); i { case 0: return &v.state @@ -2516,7 +2515,7 @@ func file_v2_container_grpc_service_proto_init() { return nil } } - file_v2_container_grpc_service_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { + file_container_grpc_service_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*DeleteResponse_Body); i { case 0: return &v.state @@ -2528,7 +2527,7 @@ func file_v2_container_grpc_service_proto_init() { return nil } } - file_v2_container_grpc_service_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { + file_container_grpc_service_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GetRequest_Body); i { case 0: return &v.state @@ -2540,7 +2539,7 @@ func file_v2_container_grpc_service_proto_init() { return nil } } - file_v2_container_grpc_service_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { + file_container_grpc_service_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GetResponse_Body); i { case 0: return &v.state @@ -2552,7 +2551,7 @@ func file_v2_container_grpc_service_proto_init() { return nil } } - file_v2_container_grpc_service_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { + file_container_grpc_service_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ListRequest_Body); i { case 0: return &v.state @@ -2564,7 +2563,7 @@ func file_v2_container_grpc_service_proto_init() { return nil } } - file_v2_container_grpc_service_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { + file_container_grpc_service_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ListResponse_Body); i { case 0: return &v.state @@ -2576,7 +2575,7 @@ func file_v2_container_grpc_service_proto_init() { return nil } } - file_v2_container_grpc_service_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { + file_container_grpc_service_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*SetExtendedACLRequest_Body); i { case 0: return &v.state @@ -2588,7 +2587,7 @@ func file_v2_container_grpc_service_proto_init() { return nil } } - file_v2_container_grpc_service_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} { + file_container_grpc_service_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*SetExtendedACLResponse_Body); i { case 0: return &v.state @@ -2600,7 +2599,7 @@ func file_v2_container_grpc_service_proto_init() { return nil } } - file_v2_container_grpc_service_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} { + file_container_grpc_service_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GetExtendedACLRequest_Body); i { case 0: return &v.state @@ -2612,7 +2611,7 @@ func file_v2_container_grpc_service_proto_init() { return nil } } - file_v2_container_grpc_service_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} { + file_container_grpc_service_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GetExtendedACLResponse_Body); i { case 0: return &v.state @@ -2624,7 +2623,7 @@ func file_v2_container_grpc_service_proto_init() { return nil } } - file_v2_container_grpc_service_proto_msgTypes[26].Exporter = func(v interface{}, i int) interface{} { + file_container_grpc_service_proto_msgTypes[26].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*AnnounceUsedSpaceRequest_Body); i { case 0: return &v.state @@ -2636,7 +2635,7 @@ func file_v2_container_grpc_service_proto_init() { return nil } } - file_v2_container_grpc_service_proto_msgTypes[27].Exporter = func(v interface{}, i int) interface{} { + file_container_grpc_service_proto_msgTypes[27].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*AnnounceUsedSpaceRequest_Body_Announcement); i { case 0: return &v.state @@ -2648,7 +2647,7 @@ func file_v2_container_grpc_service_proto_init() { return nil } } - file_v2_container_grpc_service_proto_msgTypes[28].Exporter = func(v interface{}, i int) interface{} { + file_container_grpc_service_proto_msgTypes[28].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*AnnounceUsedSpaceResponse_Body); i { case 0: return &v.state @@ -2665,18 +2664,18 @@ func file_v2_container_grpc_service_proto_init() { out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_v2_container_grpc_service_proto_rawDesc, + RawDescriptor: file_container_grpc_service_proto_rawDesc, NumEnums: 0, NumMessages: 29, NumExtensions: 0, NumServices: 1, }, - GoTypes: file_v2_container_grpc_service_proto_goTypes, - DependencyIndexes: file_v2_container_grpc_service_proto_depIdxs, - MessageInfos: file_v2_container_grpc_service_proto_msgTypes, + GoTypes: file_container_grpc_service_proto_goTypes, + DependencyIndexes: file_container_grpc_service_proto_depIdxs, + MessageInfos: file_container_grpc_service_proto_msgTypes, }.Build() - File_v2_container_grpc_service_proto = out.File - file_v2_container_grpc_service_proto_rawDesc = nil - file_v2_container_grpc_service_proto_goTypes = nil - file_v2_container_grpc_service_proto_depIdxs = nil + File_container_grpc_service_proto = out.File + file_container_grpc_service_proto_rawDesc = nil + file_container_grpc_service_proto_goTypes = nil + file_container_grpc_service_proto_depIdxs = nil } diff --git a/container/grpc/service_grpc.pb.go b/container/grpc/service_grpc.pb.go index 9f6af5b..cbac355 100644 --- a/container/grpc/service_grpc.pb.go +++ b/container/grpc/service_grpc.pb.go @@ -413,5 +413,5 @@ var ContainerService_ServiceDesc = grpc.ServiceDesc{ }, }, Streams: []grpc.StreamDesc{}, - Metadata: "v2/container/grpc/service.proto", + Metadata: "container/grpc/service.proto", } diff --git a/container/grpc/types.pb.go b/container/grpc/types.pb.go index 279c781..10f3019 100644 --- a/container/grpc/types.pb.go +++ b/container/grpc/types.pb.go @@ -2,7 +2,7 @@ // versions: // protoc-gen-go v1.27.1 // protoc v3.18.0 -// source: v2/container/grpc/types.proto +// source: container/grpc/types.proto package container @@ -50,7 +50,7 @@ type Container struct { func (x *Container) Reset() { *x = Container{} if protoimpl.UnsafeEnabled { - mi := &file_v2_container_grpc_types_proto_msgTypes[0] + mi := &file_container_grpc_types_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -63,7 +63,7 @@ func (x *Container) String() string { func (*Container) ProtoMessage() {} func (x *Container) ProtoReflect() protoreflect.Message { - mi := &file_v2_container_grpc_types_proto_msgTypes[0] + mi := &file_container_grpc_types_proto_msgTypes[0] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -76,7 +76,7 @@ func (x *Container) ProtoReflect() protoreflect.Message { // Deprecated: Use Container.ProtoReflect.Descriptor instead. func (*Container) Descriptor() ([]byte, []int) { - return file_v2_container_grpc_types_proto_rawDescGZIP(), []int{0} + return file_container_grpc_types_proto_rawDescGZIP(), []int{0} } func (x *Container) GetVersion() *grpc.Version { @@ -161,7 +161,7 @@ type Container_Attribute struct { func (x *Container_Attribute) Reset() { *x = Container_Attribute{} if protoimpl.UnsafeEnabled { - mi := &file_v2_container_grpc_types_proto_msgTypes[1] + mi := &file_container_grpc_types_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -174,7 +174,7 @@ func (x *Container_Attribute) String() string { func (*Container_Attribute) ProtoMessage() {} func (x *Container_Attribute) ProtoReflect() protoreflect.Message { - mi := &file_v2_container_grpc_types_proto_msgTypes[1] + mi := &file_container_grpc_types_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -187,7 +187,7 @@ func (x *Container_Attribute) ProtoReflect() protoreflect.Message { // Deprecated: Use Container_Attribute.ProtoReflect.Descriptor instead. func (*Container_Attribute) Descriptor() ([]byte, []int) { - return file_v2_container_grpc_types_proto_rawDescGZIP(), []int{0, 0} + return file_container_grpc_types_proto_rawDescGZIP(), []int{0, 0} } func (x *Container_Attribute) GetKey() string { @@ -204,69 +204,68 @@ func (x *Container_Attribute) GetValue() string { return "" } -var File_v2_container_grpc_types_proto protoreflect.FileDescriptor +var File_container_grpc_types_proto protoreflect.FileDescriptor -var file_v2_container_grpc_types_proto_rawDesc = []byte{ - 0x0a, 0x1d, 0x76, 0x32, 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, 0x1a, 0x76, 0x32, 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, 0x18, 0x76, 0x32, 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, - 0x5f, 0x5a, 0x3d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, - 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, - 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 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, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +var file_container_grpc_types_proto_rawDesc = []byte{ + 0x0a, 0x1a, 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, 0x17, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, + 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x15, 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, 0x5f, 0x5a, 0x3d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, + 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, + 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 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, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( - file_v2_container_grpc_types_proto_rawDescOnce sync.Once - file_v2_container_grpc_types_proto_rawDescData = file_v2_container_grpc_types_proto_rawDesc + file_container_grpc_types_proto_rawDescOnce sync.Once + file_container_grpc_types_proto_rawDescData = file_container_grpc_types_proto_rawDesc ) -func file_v2_container_grpc_types_proto_rawDescGZIP() []byte { - file_v2_container_grpc_types_proto_rawDescOnce.Do(func() { - file_v2_container_grpc_types_proto_rawDescData = protoimpl.X.CompressGZIP(file_v2_container_grpc_types_proto_rawDescData) +func file_container_grpc_types_proto_rawDescGZIP() []byte { + file_container_grpc_types_proto_rawDescOnce.Do(func() { + file_container_grpc_types_proto_rawDescData = protoimpl.X.CompressGZIP(file_container_grpc_types_proto_rawDescData) }) - return file_v2_container_grpc_types_proto_rawDescData + return file_container_grpc_types_proto_rawDescData } -var file_v2_container_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_v2_container_grpc_types_proto_goTypes = []interface{}{ +var file_container_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_container_grpc_types_proto_goTypes = []interface{}{ (*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_v2_container_grpc_types_proto_depIdxs = []int32{ +var file_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 @@ -278,13 +277,13 @@ var file_v2_container_grpc_types_proto_depIdxs = []int32{ 0, // [0:4] is the sub-list for field type_name } -func init() { file_v2_container_grpc_types_proto_init() } -func file_v2_container_grpc_types_proto_init() { - if File_v2_container_grpc_types_proto != nil { +func init() { file_container_grpc_types_proto_init() } +func file_container_grpc_types_proto_init() { + if File_container_grpc_types_proto != nil { return } if !protoimpl.UnsafeEnabled { - file_v2_container_grpc_types_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_container_grpc_types_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Container); i { case 0: return &v.state @@ -296,7 +295,7 @@ func file_v2_container_grpc_types_proto_init() { return nil } } - file_v2_container_grpc_types_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_container_grpc_types_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Container_Attribute); i { case 0: return &v.state @@ -313,18 +312,18 @@ func file_v2_container_grpc_types_proto_init() { out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_v2_container_grpc_types_proto_rawDesc, + RawDescriptor: file_container_grpc_types_proto_rawDesc, NumEnums: 0, NumMessages: 2, NumExtensions: 0, NumServices: 0, }, - GoTypes: file_v2_container_grpc_types_proto_goTypes, - DependencyIndexes: file_v2_container_grpc_types_proto_depIdxs, - MessageInfos: file_v2_container_grpc_types_proto_msgTypes, + GoTypes: file_container_grpc_types_proto_goTypes, + DependencyIndexes: file_container_grpc_types_proto_depIdxs, + MessageInfos: file_container_grpc_types_proto_msgTypes, }.Build() - File_v2_container_grpc_types_proto = out.File - file_v2_container_grpc_types_proto_rawDesc = nil - file_v2_container_grpc_types_proto_goTypes = nil - file_v2_container_grpc_types_proto_depIdxs = nil + File_container_grpc_types_proto = out.File + file_container_grpc_types_proto_rawDesc = nil + file_container_grpc_types_proto_goTypes = nil + file_container_grpc_types_proto_depIdxs = nil } diff --git a/netmap/grpc/service.pb.go b/netmap/grpc/service.pb.go index c39ec43..238265a 100644 --- a/netmap/grpc/service.pb.go +++ b/netmap/grpc/service.pb.go @@ -2,7 +2,7 @@ // versions: // protoc-gen-go v1.27.1 // protoc v3.18.0 -// source: v2/netmap/grpc/service.proto +// source: netmap/grpc/service.proto package netmap @@ -42,7 +42,7 @@ type LocalNodeInfoRequest struct { func (x *LocalNodeInfoRequest) Reset() { *x = LocalNodeInfoRequest{} if protoimpl.UnsafeEnabled { - mi := &file_v2_netmap_grpc_service_proto_msgTypes[0] + mi := &file_netmap_grpc_service_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -55,7 +55,7 @@ func (x *LocalNodeInfoRequest) String() string { func (*LocalNodeInfoRequest) ProtoMessage() {} func (x *LocalNodeInfoRequest) ProtoReflect() protoreflect.Message { - mi := &file_v2_netmap_grpc_service_proto_msgTypes[0] + mi := &file_netmap_grpc_service_proto_msgTypes[0] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -68,7 +68,7 @@ func (x *LocalNodeInfoRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use LocalNodeInfoRequest.ProtoReflect.Descriptor instead. func (*LocalNodeInfoRequest) Descriptor() ([]byte, []int) { - return file_v2_netmap_grpc_service_proto_rawDescGZIP(), []int{0} + return file_netmap_grpc_service_proto_rawDescGZIP(), []int{0} } func (x *LocalNodeInfoRequest) GetBody() *LocalNodeInfoRequest_Body { @@ -112,7 +112,7 @@ type LocalNodeInfoResponse struct { func (x *LocalNodeInfoResponse) Reset() { *x = LocalNodeInfoResponse{} if protoimpl.UnsafeEnabled { - mi := &file_v2_netmap_grpc_service_proto_msgTypes[1] + mi := &file_netmap_grpc_service_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -125,7 +125,7 @@ func (x *LocalNodeInfoResponse) String() string { func (*LocalNodeInfoResponse) ProtoMessage() {} func (x *LocalNodeInfoResponse) ProtoReflect() protoreflect.Message { - mi := &file_v2_netmap_grpc_service_proto_msgTypes[1] + mi := &file_netmap_grpc_service_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -138,7 +138,7 @@ func (x *LocalNodeInfoResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use LocalNodeInfoResponse.ProtoReflect.Descriptor instead. func (*LocalNodeInfoResponse) Descriptor() ([]byte, []int) { - return file_v2_netmap_grpc_service_proto_rawDescGZIP(), []int{1} + return file_netmap_grpc_service_proto_rawDescGZIP(), []int{1} } func (x *LocalNodeInfoResponse) GetBody() *LocalNodeInfoResponse_Body { @@ -182,7 +182,7 @@ type NetworkInfoRequest struct { func (x *NetworkInfoRequest) Reset() { *x = NetworkInfoRequest{} if protoimpl.UnsafeEnabled { - mi := &file_v2_netmap_grpc_service_proto_msgTypes[2] + mi := &file_netmap_grpc_service_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -195,7 +195,7 @@ func (x *NetworkInfoRequest) String() string { func (*NetworkInfoRequest) ProtoMessage() {} func (x *NetworkInfoRequest) ProtoReflect() protoreflect.Message { - mi := &file_v2_netmap_grpc_service_proto_msgTypes[2] + mi := &file_netmap_grpc_service_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -208,7 +208,7 @@ func (x *NetworkInfoRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use NetworkInfoRequest.ProtoReflect.Descriptor instead. func (*NetworkInfoRequest) Descriptor() ([]byte, []int) { - return file_v2_netmap_grpc_service_proto_rawDescGZIP(), []int{2} + return file_netmap_grpc_service_proto_rawDescGZIP(), []int{2} } func (x *NetworkInfoRequest) GetBody() *NetworkInfoRequest_Body { @@ -253,7 +253,7 @@ type NetworkInfoResponse struct { func (x *NetworkInfoResponse) Reset() { *x = NetworkInfoResponse{} if protoimpl.UnsafeEnabled { - mi := &file_v2_netmap_grpc_service_proto_msgTypes[3] + mi := &file_netmap_grpc_service_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -266,7 +266,7 @@ func (x *NetworkInfoResponse) String() string { func (*NetworkInfoResponse) ProtoMessage() {} func (x *NetworkInfoResponse) ProtoReflect() protoreflect.Message { - mi := &file_v2_netmap_grpc_service_proto_msgTypes[3] + mi := &file_netmap_grpc_service_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -279,7 +279,7 @@ func (x *NetworkInfoResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use NetworkInfoResponse.ProtoReflect.Descriptor instead. func (*NetworkInfoResponse) Descriptor() ([]byte, []int) { - return file_v2_netmap_grpc_service_proto_rawDescGZIP(), []int{3} + return file_netmap_grpc_service_proto_rawDescGZIP(), []int{3} } func (x *NetworkInfoResponse) GetBody() *NetworkInfoResponse_Body { @@ -313,7 +313,7 @@ type LocalNodeInfoRequest_Body struct { func (x *LocalNodeInfoRequest_Body) Reset() { *x = LocalNodeInfoRequest_Body{} if protoimpl.UnsafeEnabled { - mi := &file_v2_netmap_grpc_service_proto_msgTypes[4] + mi := &file_netmap_grpc_service_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -326,7 +326,7 @@ func (x *LocalNodeInfoRequest_Body) String() string { func (*LocalNodeInfoRequest_Body) ProtoMessage() {} func (x *LocalNodeInfoRequest_Body) ProtoReflect() protoreflect.Message { - mi := &file_v2_netmap_grpc_service_proto_msgTypes[4] + mi := &file_netmap_grpc_service_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -339,7 +339,7 @@ func (x *LocalNodeInfoRequest_Body) ProtoReflect() protoreflect.Message { // Deprecated: Use LocalNodeInfoRequest_Body.ProtoReflect.Descriptor instead. func (*LocalNodeInfoRequest_Body) Descriptor() ([]byte, []int) { - return file_v2_netmap_grpc_service_proto_rawDescGZIP(), []int{0, 0} + return file_netmap_grpc_service_proto_rawDescGZIP(), []int{0, 0} } // Local Node Info, including API Version in use. @@ -357,7 +357,7 @@ type LocalNodeInfoResponse_Body struct { func (x *LocalNodeInfoResponse_Body) Reset() { *x = LocalNodeInfoResponse_Body{} if protoimpl.UnsafeEnabled { - mi := &file_v2_netmap_grpc_service_proto_msgTypes[5] + mi := &file_netmap_grpc_service_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -370,7 +370,7 @@ func (x *LocalNodeInfoResponse_Body) String() string { func (*LocalNodeInfoResponse_Body) ProtoMessage() {} func (x *LocalNodeInfoResponse_Body) ProtoReflect() protoreflect.Message { - mi := &file_v2_netmap_grpc_service_proto_msgTypes[5] + mi := &file_netmap_grpc_service_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -383,7 +383,7 @@ func (x *LocalNodeInfoResponse_Body) ProtoReflect() protoreflect.Message { // Deprecated: Use LocalNodeInfoResponse_Body.ProtoReflect.Descriptor instead. func (*LocalNodeInfoResponse_Body) Descriptor() ([]byte, []int) { - return file_v2_netmap_grpc_service_proto_rawDescGZIP(), []int{1, 0} + return file_netmap_grpc_service_proto_rawDescGZIP(), []int{1, 0} } func (x *LocalNodeInfoResponse_Body) GetVersion() *grpc1.Version { @@ -410,7 +410,7 @@ type NetworkInfoRequest_Body struct { func (x *NetworkInfoRequest_Body) Reset() { *x = NetworkInfoRequest_Body{} if protoimpl.UnsafeEnabled { - mi := &file_v2_netmap_grpc_service_proto_msgTypes[6] + mi := &file_netmap_grpc_service_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -423,7 +423,7 @@ func (x *NetworkInfoRequest_Body) String() string { func (*NetworkInfoRequest_Body) ProtoMessage() {} func (x *NetworkInfoRequest_Body) ProtoReflect() protoreflect.Message { - mi := &file_v2_netmap_grpc_service_proto_msgTypes[6] + mi := &file_netmap_grpc_service_proto_msgTypes[6] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -436,7 +436,7 @@ func (x *NetworkInfoRequest_Body) ProtoReflect() protoreflect.Message { // Deprecated: Use NetworkInfoRequest_Body.ProtoReflect.Descriptor instead. func (*NetworkInfoRequest_Body) Descriptor() ([]byte, []int) { - return file_v2_netmap_grpc_service_proto_rawDescGZIP(), []int{2, 0} + return file_netmap_grpc_service_proto_rawDescGZIP(), []int{2, 0} } // Information about the network. @@ -452,7 +452,7 @@ type NetworkInfoResponse_Body struct { func (x *NetworkInfoResponse_Body) Reset() { *x = NetworkInfoResponse_Body{} if protoimpl.UnsafeEnabled { - mi := &file_v2_netmap_grpc_service_proto_msgTypes[7] + mi := &file_netmap_grpc_service_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -465,7 +465,7 @@ func (x *NetworkInfoResponse_Body) String() string { func (*NetworkInfoResponse_Body) ProtoMessage() {} func (x *NetworkInfoResponse_Body) ProtoReflect() protoreflect.Message { - mi := &file_v2_netmap_grpc_service_proto_msgTypes[7] + mi := &file_netmap_grpc_service_proto_msgTypes[7] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -478,7 +478,7 @@ func (x *NetworkInfoResponse_Body) ProtoReflect() protoreflect.Message { // Deprecated: Use NetworkInfoResponse_Body.ProtoReflect.Descriptor instead. func (*NetworkInfoResponse_Body) Descriptor() ([]byte, []int) { - return file_v2_netmap_grpc_service_proto_rawDescGZIP(), []int{3, 0} + return file_netmap_grpc_service_proto_rawDescGZIP(), []int{3, 0} } func (x *NetworkInfoResponse_Body) GetNetworkInfo() *NetworkInfo { @@ -488,60 +488,21 @@ func (x *NetworkInfoResponse_Body) GetNetworkInfo() *NetworkInfo { return nil } -var File_v2_netmap_grpc_service_proto protoreflect.FileDescriptor +var File_netmap_grpc_service_proto protoreflect.FileDescriptor -var file_v2_netmap_grpc_service_proto_rawDesc = []byte{ - 0x0a, 0x1c, 0x76, 0x32, 0x2f, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2f, 0x67, 0x72, 0x70, 0x63, - 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x10, - 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, - 0x1a, 0x1a, 0x76, 0x32, 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, 0x18, 0x76, 0x32, - 0x2f, 0x72, 0x65, 0x66, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x76, 0x32, 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, 0xf9, 0x01, 0x0a, 0x14, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x4e, 0x6f, 0x64, - 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x3f, 0x0a, 0x04, - 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x6e, 0x65, 0x6f, - 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4c, 0x6f, - 0x63, 0x61, 0x6c, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 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, 0x06, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x22, - 0xe9, 0x02, 0x0a, 0x15, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, - 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x40, 0x0a, 0x04, 0x62, 0x6f, 0x64, - 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, - 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4c, 0x6f, 0x63, 0x61, 0x6c, - 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 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, 0x72, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 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, 0x37, 0x0a, 0x09, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, - 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, - 0x6f, 0x52, 0x08, 0x6e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x22, 0xf5, 0x01, 0x0a, 0x12, - 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 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, 0x6e, 0x65, 0x74, - 0x6d, 0x61, 0x70, 0x2e, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x52, +var file_netmap_grpc_service_proto_rawDesc = []byte{ + 0x0a, 0x19, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x73, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x10, 0x6e, 0x65, 0x6f, + 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x1a, 0x17, 0x6e, + 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x15, 0x72, 0x65, 0x66, 0x73, 0x2f, 0x67, 0x72, 0x70, + 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x18, 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, 0xf9, 0x01, 0x0a, 0x14, 0x4c, 0x6f, 0x63, 0x61, + 0x6c, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x3f, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2b, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, + 0x70, 0x2e, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 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, @@ -553,62 +514,100 @@ var file_v2_netmap_grpc_service_proto_rawDesc = []byte{ 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, 0x06, 0x0a, 0x04, 0x42, - 0x6f, 0x64, 0x79, 0x22, 0xbb, 0x02, 0x0a, 0x13, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x49, - 0x6e, 0x66, 0x6f, 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, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4e, 0x65, 0x74, - 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 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, 0x48, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, - 0x40, 0x0a, 0x0c, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, - 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, - 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x0b, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x66, - 0x6f, 0x32, 0xcd, 0x01, 0x0a, 0x0d, 0x4e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x53, 0x65, 0x72, 0x76, - 0x69, 0x63, 0x65, 0x12, 0x60, 0x0a, 0x0d, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x4e, 0x6f, 0x64, 0x65, - 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x26, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, - 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x4e, 0x6f, 0x64, - 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x27, 0x2e, 0x6e, - 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, - 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5a, 0x0a, 0x0b, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, - 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x24, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x6f, 0x64, 0x79, 0x22, 0xe9, 0x02, 0x0a, 0x15, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x4e, 0x6f, 0x64, + 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x40, 0x0a, + 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x6e, 0x65, + 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4c, + 0x6f, 0x63, 0x61, 0x6c, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 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, 0x72, 0x0a, 0x04, 0x42, + 0x6f, 0x64, 0x79, 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, 0x37, 0x0a, 0x09, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x69, + 0x6e, 0x66, 0x6f, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, + 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4e, 0x6f, 0x64, + 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x08, 0x6e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x22, + 0xf5, 0x01, 0x0a, 0x12, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 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, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x49, - 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x25, 0x2e, 0x6e, 0x65, 0x6f, - 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4e, 0x65, - 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x42, 0x56, 0x5a, 0x37, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, - 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, - 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, - 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0xaa, 0x02, 0x1a, 0x4e, - 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, - 0x50, 0x49, 0x2e, 0x4e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x33, + 0x6e, 0x66, 0x6f, 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, + 0x06, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x22, 0xbb, 0x02, 0x0a, 0x13, 0x4e, 0x65, 0x74, 0x77, + 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 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, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, + 0x2e, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 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, 0x48, 0x0a, 0x04, 0x42, + 0x6f, 0x64, 0x79, 0x12, 0x40, 0x0a, 0x0c, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x5f, 0x69, + 0x6e, 0x66, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, + 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4e, 0x65, 0x74, + 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x0b, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, + 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x32, 0xcd, 0x01, 0x0a, 0x0d, 0x4e, 0x65, 0x74, 0x6d, 0x61, 0x70, + 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x60, 0x0a, 0x0d, 0x4c, 0x6f, 0x63, 0x61, 0x6c, + 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x26, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4c, 0x6f, 0x63, 0x61, + 0x6c, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x27, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, + 0x6d, 0x61, 0x70, 0x2e, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, + 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5a, 0x0a, 0x0b, 0x4e, 0x65, 0x74, + 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x24, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4e, 0x65, 0x74, 0x77, + 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x25, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, + 0x70, 0x2e, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x56, 0x5a, 0x37, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, + 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, + 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x6e, 0x65, + 0x74, 0x6d, 0x61, 0x70, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, + 0xaa, 0x02, 0x1a, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, + 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x4e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( - file_v2_netmap_grpc_service_proto_rawDescOnce sync.Once - file_v2_netmap_grpc_service_proto_rawDescData = file_v2_netmap_grpc_service_proto_rawDesc + file_netmap_grpc_service_proto_rawDescOnce sync.Once + file_netmap_grpc_service_proto_rawDescData = file_netmap_grpc_service_proto_rawDesc ) -func file_v2_netmap_grpc_service_proto_rawDescGZIP() []byte { - file_v2_netmap_grpc_service_proto_rawDescOnce.Do(func() { - file_v2_netmap_grpc_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_v2_netmap_grpc_service_proto_rawDescData) +func file_netmap_grpc_service_proto_rawDescGZIP() []byte { + file_netmap_grpc_service_proto_rawDescOnce.Do(func() { + file_netmap_grpc_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_netmap_grpc_service_proto_rawDescData) }) - return file_v2_netmap_grpc_service_proto_rawDescData + return file_netmap_grpc_service_proto_rawDescData } -var file_v2_netmap_grpc_service_proto_msgTypes = make([]protoimpl.MessageInfo, 8) -var file_v2_netmap_grpc_service_proto_goTypes = []interface{}{ +var file_netmap_grpc_service_proto_msgTypes = make([]protoimpl.MessageInfo, 8) +var file_netmap_grpc_service_proto_goTypes = []interface{}{ (*LocalNodeInfoRequest)(nil), // 0: neo.fs.v2.netmap.LocalNodeInfoRequest (*LocalNodeInfoResponse)(nil), // 1: neo.fs.v2.netmap.LocalNodeInfoResponse (*NetworkInfoRequest)(nil), // 2: neo.fs.v2.netmap.NetworkInfoRequest @@ -625,7 +624,7 @@ var file_v2_netmap_grpc_service_proto_goTypes = []interface{}{ (*NodeInfo)(nil), // 13: neo.fs.v2.netmap.NodeInfo (*NetworkInfo)(nil), // 14: neo.fs.v2.netmap.NetworkInfo } -var file_v2_netmap_grpc_service_proto_depIdxs = []int32{ +var file_netmap_grpc_service_proto_depIdxs = []int32{ 4, // 0: neo.fs.v2.netmap.LocalNodeInfoRequest.body:type_name -> neo.fs.v2.netmap.LocalNodeInfoRequest.Body 8, // 1: neo.fs.v2.netmap.LocalNodeInfoRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader 9, // 2: neo.fs.v2.netmap.LocalNodeInfoRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader @@ -652,14 +651,14 @@ var file_v2_netmap_grpc_service_proto_depIdxs = []int32{ 0, // [0:15] is the sub-list for field type_name } -func init() { file_v2_netmap_grpc_service_proto_init() } -func file_v2_netmap_grpc_service_proto_init() { - if File_v2_netmap_grpc_service_proto != nil { +func init() { file_netmap_grpc_service_proto_init() } +func file_netmap_grpc_service_proto_init() { + if File_netmap_grpc_service_proto != nil { return } - file_v2_netmap_grpc_types_proto_init() + file_netmap_grpc_types_proto_init() if !protoimpl.UnsafeEnabled { - file_v2_netmap_grpc_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_netmap_grpc_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*LocalNodeInfoRequest); i { case 0: return &v.state @@ -671,7 +670,7 @@ func file_v2_netmap_grpc_service_proto_init() { return nil } } - file_v2_netmap_grpc_service_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_netmap_grpc_service_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*LocalNodeInfoResponse); i { case 0: return &v.state @@ -683,7 +682,7 @@ func file_v2_netmap_grpc_service_proto_init() { return nil } } - file_v2_netmap_grpc_service_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + file_netmap_grpc_service_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*NetworkInfoRequest); i { case 0: return &v.state @@ -695,7 +694,7 @@ func file_v2_netmap_grpc_service_proto_init() { return nil } } - file_v2_netmap_grpc_service_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + file_netmap_grpc_service_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*NetworkInfoResponse); i { case 0: return &v.state @@ -707,7 +706,7 @@ func file_v2_netmap_grpc_service_proto_init() { return nil } } - file_v2_netmap_grpc_service_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + file_netmap_grpc_service_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*LocalNodeInfoRequest_Body); i { case 0: return &v.state @@ -719,7 +718,7 @@ func file_v2_netmap_grpc_service_proto_init() { return nil } } - file_v2_netmap_grpc_service_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + file_netmap_grpc_service_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*LocalNodeInfoResponse_Body); i { case 0: return &v.state @@ -731,7 +730,7 @@ func file_v2_netmap_grpc_service_proto_init() { return nil } } - file_v2_netmap_grpc_service_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + file_netmap_grpc_service_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*NetworkInfoRequest_Body); i { case 0: return &v.state @@ -743,7 +742,7 @@ func file_v2_netmap_grpc_service_proto_init() { return nil } } - file_v2_netmap_grpc_service_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + file_netmap_grpc_service_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*NetworkInfoResponse_Body); i { case 0: return &v.state @@ -760,18 +759,18 @@ func file_v2_netmap_grpc_service_proto_init() { out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_v2_netmap_grpc_service_proto_rawDesc, + RawDescriptor: file_netmap_grpc_service_proto_rawDesc, NumEnums: 0, NumMessages: 8, NumExtensions: 0, NumServices: 1, }, - GoTypes: file_v2_netmap_grpc_service_proto_goTypes, - DependencyIndexes: file_v2_netmap_grpc_service_proto_depIdxs, - MessageInfos: file_v2_netmap_grpc_service_proto_msgTypes, + GoTypes: file_netmap_grpc_service_proto_goTypes, + DependencyIndexes: file_netmap_grpc_service_proto_depIdxs, + MessageInfos: file_netmap_grpc_service_proto_msgTypes, }.Build() - File_v2_netmap_grpc_service_proto = out.File - file_v2_netmap_grpc_service_proto_rawDesc = nil - file_v2_netmap_grpc_service_proto_goTypes = nil - file_v2_netmap_grpc_service_proto_depIdxs = nil + File_netmap_grpc_service_proto = out.File + file_netmap_grpc_service_proto_rawDesc = nil + file_netmap_grpc_service_proto_goTypes = nil + file_netmap_grpc_service_proto_depIdxs = nil } diff --git a/netmap/grpc/service_grpc.pb.go b/netmap/grpc/service_grpc.pb.go index 4500227..babf2e7 100644 --- a/netmap/grpc/service_grpc.pb.go +++ b/netmap/grpc/service_grpc.pb.go @@ -163,5 +163,5 @@ var NetmapService_ServiceDesc = grpc.ServiceDesc{ }, }, Streams: []grpc.StreamDesc{}, - Metadata: "v2/netmap/grpc/service.proto", + Metadata: "netmap/grpc/service.proto", } diff --git a/netmap/grpc/types.pb.go b/netmap/grpc/types.pb.go index 60aa3ac..b26eef9 100644 --- a/netmap/grpc/types.pb.go +++ b/netmap/grpc/types.pb.go @@ -2,7 +2,7 @@ // versions: // protoc-gen-go v1.27.1 // protoc v3.18.0 -// source: v2/netmap/grpc/types.proto +// source: netmap/grpc/types.proto package netmap @@ -81,11 +81,11 @@ func (x Operation) String() string { } func (Operation) Descriptor() protoreflect.EnumDescriptor { - return file_v2_netmap_grpc_types_proto_enumTypes[0].Descriptor() + return file_netmap_grpc_types_proto_enumTypes[0].Descriptor() } func (Operation) Type() protoreflect.EnumType { - return &file_v2_netmap_grpc_types_proto_enumTypes[0] + return &file_netmap_grpc_types_proto_enumTypes[0] } func (x Operation) Number() protoreflect.EnumNumber { @@ -94,7 +94,7 @@ func (x Operation) Number() protoreflect.EnumNumber { // Deprecated: Use Operation.Descriptor instead. func (Operation) EnumDescriptor() ([]byte, []int) { - return file_v2_netmap_grpc_types_proto_rawDescGZIP(), []int{0} + return file_netmap_grpc_types_proto_rawDescGZIP(), []int{0} } // Selector modifier shows how the node set will be formed. By default selector @@ -136,11 +136,11 @@ func (x Clause) String() string { } func (Clause) Descriptor() protoreflect.EnumDescriptor { - return file_v2_netmap_grpc_types_proto_enumTypes[1].Descriptor() + return file_netmap_grpc_types_proto_enumTypes[1].Descriptor() } func (Clause) Type() protoreflect.EnumType { - return &file_v2_netmap_grpc_types_proto_enumTypes[1] + return &file_netmap_grpc_types_proto_enumTypes[1] } func (x Clause) Number() protoreflect.EnumNumber { @@ -149,7 +149,7 @@ func (x Clause) Number() protoreflect.EnumNumber { // Deprecated: Use Clause.Descriptor instead. func (Clause) EnumDescriptor() ([]byte, []int) { - return file_v2_netmap_grpc_types_proto_rawDescGZIP(), []int{1} + return file_netmap_grpc_types_proto_rawDescGZIP(), []int{1} } // Represents the enumeration of various states of the NeoFS node. @@ -189,11 +189,11 @@ func (x NodeInfo_State) String() string { } func (NodeInfo_State) Descriptor() protoreflect.EnumDescriptor { - return file_v2_netmap_grpc_types_proto_enumTypes[2].Descriptor() + return file_netmap_grpc_types_proto_enumTypes[2].Descriptor() } func (NodeInfo_State) Type() protoreflect.EnumType { - return &file_v2_netmap_grpc_types_proto_enumTypes[2] + return &file_netmap_grpc_types_proto_enumTypes[2] } func (x NodeInfo_State) Number() protoreflect.EnumNumber { @@ -202,7 +202,7 @@ func (x NodeInfo_State) Number() protoreflect.EnumNumber { // Deprecated: Use NodeInfo_State.Descriptor instead. func (NodeInfo_State) EnumDescriptor() ([]byte, []int) { - return file_v2_netmap_grpc_types_proto_rawDescGZIP(), []int{4, 0} + return file_netmap_grpc_types_proto_rawDescGZIP(), []int{4, 0} } // Filter will return the subset of nodes from `NetworkMap` or another filter's @@ -231,7 +231,7 @@ type Filter struct { func (x *Filter) Reset() { *x = Filter{} if protoimpl.UnsafeEnabled { - mi := &file_v2_netmap_grpc_types_proto_msgTypes[0] + mi := &file_netmap_grpc_types_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -244,7 +244,7 @@ func (x *Filter) String() string { func (*Filter) ProtoMessage() {} func (x *Filter) ProtoReflect() protoreflect.Message { - mi := &file_v2_netmap_grpc_types_proto_msgTypes[0] + mi := &file_netmap_grpc_types_proto_msgTypes[0] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -257,7 +257,7 @@ func (x *Filter) ProtoReflect() protoreflect.Message { // Deprecated: Use Filter.ProtoReflect.Descriptor instead. func (*Filter) Descriptor() ([]byte, []int) { - return file_v2_netmap_grpc_types_proto_rawDescGZIP(), []int{0} + return file_netmap_grpc_types_proto_rawDescGZIP(), []int{0} } func (x *Filter) GetName() string { @@ -317,7 +317,7 @@ type Selector struct { func (x *Selector) Reset() { *x = Selector{} if protoimpl.UnsafeEnabled { - mi := &file_v2_netmap_grpc_types_proto_msgTypes[1] + mi := &file_netmap_grpc_types_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -330,7 +330,7 @@ func (x *Selector) String() string { func (*Selector) ProtoMessage() {} func (x *Selector) ProtoReflect() protoreflect.Message { - mi := &file_v2_netmap_grpc_types_proto_msgTypes[1] + mi := &file_netmap_grpc_types_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -343,7 +343,7 @@ func (x *Selector) ProtoReflect() protoreflect.Message { // Deprecated: Use Selector.ProtoReflect.Descriptor instead. func (*Selector) Descriptor() ([]byte, []int) { - return file_v2_netmap_grpc_types_proto_rawDescGZIP(), []int{1} + return file_netmap_grpc_types_proto_rawDescGZIP(), []int{1} } func (x *Selector) GetName() string { @@ -398,7 +398,7 @@ type Replica struct { func (x *Replica) Reset() { *x = Replica{} if protoimpl.UnsafeEnabled { - mi := &file_v2_netmap_grpc_types_proto_msgTypes[2] + mi := &file_netmap_grpc_types_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -411,7 +411,7 @@ func (x *Replica) String() string { func (*Replica) ProtoMessage() {} func (x *Replica) ProtoReflect() protoreflect.Message { - mi := &file_v2_netmap_grpc_types_proto_msgTypes[2] + mi := &file_netmap_grpc_types_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -424,7 +424,7 @@ func (x *Replica) ProtoReflect() protoreflect.Message { // Deprecated: Use Replica.ProtoReflect.Descriptor instead. func (*Replica) Descriptor() ([]byte, []int) { - return file_v2_netmap_grpc_types_proto_rawDescGZIP(), []int{2} + return file_netmap_grpc_types_proto_rawDescGZIP(), []int{2} } func (x *Replica) GetCount() uint32 { @@ -464,7 +464,7 @@ type PlacementPolicy struct { func (x *PlacementPolicy) Reset() { *x = PlacementPolicy{} if protoimpl.UnsafeEnabled { - mi := &file_v2_netmap_grpc_types_proto_msgTypes[3] + mi := &file_netmap_grpc_types_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -477,7 +477,7 @@ func (x *PlacementPolicy) String() string { func (*PlacementPolicy) ProtoMessage() {} func (x *PlacementPolicy) ProtoReflect() protoreflect.Message { - mi := &file_v2_netmap_grpc_types_proto_msgTypes[3] + mi := &file_netmap_grpc_types_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -490,7 +490,7 @@ func (x *PlacementPolicy) ProtoReflect() protoreflect.Message { // Deprecated: Use PlacementPolicy.ProtoReflect.Descriptor instead. func (*PlacementPolicy) Descriptor() ([]byte, []int) { - return file_v2_netmap_grpc_types_proto_rawDescGZIP(), []int{3} + return file_netmap_grpc_types_proto_rawDescGZIP(), []int{3} } func (x *PlacementPolicy) GetReplicas() []*Replica { @@ -543,7 +543,7 @@ type NodeInfo struct { func (x *NodeInfo) Reset() { *x = NodeInfo{} if protoimpl.UnsafeEnabled { - mi := &file_v2_netmap_grpc_types_proto_msgTypes[4] + mi := &file_netmap_grpc_types_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -556,7 +556,7 @@ func (x *NodeInfo) String() string { func (*NodeInfo) ProtoMessage() {} func (x *NodeInfo) ProtoReflect() protoreflect.Message { - mi := &file_v2_netmap_grpc_types_proto_msgTypes[4] + mi := &file_netmap_grpc_types_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -569,7 +569,7 @@ func (x *NodeInfo) ProtoReflect() protoreflect.Message { // Deprecated: Use NodeInfo.ProtoReflect.Descriptor instead. func (*NodeInfo) Descriptor() ([]byte, []int) { - return file_v2_netmap_grpc_types_proto_rawDescGZIP(), []int{4} + return file_netmap_grpc_types_proto_rawDescGZIP(), []int{4} } func (x *NodeInfo) GetPublicKey() []byte { @@ -613,7 +613,7 @@ type NetworkConfig struct { func (x *NetworkConfig) Reset() { *x = NetworkConfig{} if protoimpl.UnsafeEnabled { - mi := &file_v2_netmap_grpc_types_proto_msgTypes[5] + mi := &file_netmap_grpc_types_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -626,7 +626,7 @@ func (x *NetworkConfig) String() string { func (*NetworkConfig) ProtoMessage() {} func (x *NetworkConfig) ProtoReflect() protoreflect.Message { - mi := &file_v2_netmap_grpc_types_proto_msgTypes[5] + mi := &file_netmap_grpc_types_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -639,7 +639,7 @@ func (x *NetworkConfig) ProtoReflect() protoreflect.Message { // Deprecated: Use NetworkConfig.ProtoReflect.Descriptor instead. func (*NetworkConfig) Descriptor() ([]byte, []int) { - return file_v2_netmap_grpc_types_proto_rawDescGZIP(), []int{5} + return file_netmap_grpc_types_proto_rawDescGZIP(), []int{5} } func (x *NetworkConfig) GetParameters() []*NetworkConfig_Parameter { @@ -668,7 +668,7 @@ type NetworkInfo struct { func (x *NetworkInfo) Reset() { *x = NetworkInfo{} if protoimpl.UnsafeEnabled { - mi := &file_v2_netmap_grpc_types_proto_msgTypes[6] + mi := &file_netmap_grpc_types_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -681,7 +681,7 @@ func (x *NetworkInfo) String() string { func (*NetworkInfo) ProtoMessage() {} func (x *NetworkInfo) ProtoReflect() protoreflect.Message { - mi := &file_v2_netmap_grpc_types_proto_msgTypes[6] + mi := &file_netmap_grpc_types_proto_msgTypes[6] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -694,7 +694,7 @@ func (x *NetworkInfo) ProtoReflect() protoreflect.Message { // Deprecated: Use NetworkInfo.ProtoReflect.Descriptor instead. func (*NetworkInfo) Descriptor() ([]byte, []int) { - return file_v2_netmap_grpc_types_proto_rawDescGZIP(), []int{6} + return file_netmap_grpc_types_proto_rawDescGZIP(), []int{6} } func (x *NetworkInfo) GetCurrentEpoch() uint64 { @@ -808,7 +808,7 @@ type NodeInfo_Attribute struct { func (x *NodeInfo_Attribute) Reset() { *x = NodeInfo_Attribute{} if protoimpl.UnsafeEnabled { - mi := &file_v2_netmap_grpc_types_proto_msgTypes[7] + mi := &file_netmap_grpc_types_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -821,7 +821,7 @@ func (x *NodeInfo_Attribute) String() string { func (*NodeInfo_Attribute) ProtoMessage() {} func (x *NodeInfo_Attribute) ProtoReflect() protoreflect.Message { - mi := &file_v2_netmap_grpc_types_proto_msgTypes[7] + mi := &file_netmap_grpc_types_proto_msgTypes[7] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -834,7 +834,7 @@ func (x *NodeInfo_Attribute) ProtoReflect() protoreflect.Message { // Deprecated: Use NodeInfo_Attribute.ProtoReflect.Descriptor instead. func (*NodeInfo_Attribute) Descriptor() ([]byte, []int) { - return file_v2_netmap_grpc_types_proto_rawDescGZIP(), []int{4, 0} + return file_netmap_grpc_types_proto_rawDescGZIP(), []int{4, 0} } func (x *NodeInfo_Attribute) GetKey() string { @@ -873,7 +873,7 @@ type NetworkConfig_Parameter struct { func (x *NetworkConfig_Parameter) Reset() { *x = NetworkConfig_Parameter{} if protoimpl.UnsafeEnabled { - mi := &file_v2_netmap_grpc_types_proto_msgTypes[8] + mi := &file_netmap_grpc_types_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -886,7 +886,7 @@ func (x *NetworkConfig_Parameter) String() string { func (*NetworkConfig_Parameter) ProtoMessage() {} func (x *NetworkConfig_Parameter) ProtoReflect() protoreflect.Message { - mi := &file_v2_netmap_grpc_types_proto_msgTypes[8] + mi := &file_netmap_grpc_types_proto_msgTypes[8] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -899,7 +899,7 @@ func (x *NetworkConfig_Parameter) ProtoReflect() protoreflect.Message { // Deprecated: Use NetworkConfig_Parameter.ProtoReflect.Descriptor instead. func (*NetworkConfig_Parameter) Descriptor() ([]byte, []int) { - return file_v2_netmap_grpc_types_proto_rawDescGZIP(), []int{5, 0} + return file_netmap_grpc_types_proto_rawDescGZIP(), []int{5, 0} } func (x *NetworkConfig_Parameter) GetKey() []byte { @@ -916,127 +916,127 @@ func (x *NetworkConfig_Parameter) GetValue() []byte { return nil } -var File_v2_netmap_grpc_types_proto protoreflect.FileDescriptor +var File_netmap_grpc_types_proto protoreflect.FileDescriptor -var file_v2_netmap_grpc_types_proto_rawDesc = []byte{ - 0x0a, 0x1a, 0x76, 0x32, 0x2f, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2f, 0x67, 0x72, 0x70, 0x63, - 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x10, 0x6e, 0x65, - 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x22, 0xa5, - 0x01, 0x0a, 0x06, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, - 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x10, 0x0a, - 0x03, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, - 0x2b, 0x0a, 0x02, 0x6f, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1b, 0x2e, 0x6e, 0x65, - 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4f, - 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x02, 0x6f, 0x70, 0x12, 0x14, 0x0a, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x12, 0x32, 0x0a, 0x07, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x73, 0x18, 0x05, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, - 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x07, 0x66, - 0x69, 0x6c, 0x74, 0x65, 0x72, 0x73, 0x22, 0x9c, 0x01, 0x0a, 0x08, 0x53, 0x65, 0x6c, 0x65, 0x63, - 0x74, 0x6f, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x30, 0x0a, - 0x06, 0x63, 0x6c, 0x61, 0x75, 0x73, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x18, 0x2e, - 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, - 0x2e, 0x43, 0x6c, 0x61, 0x75, 0x73, 0x65, 0x52, 0x06, 0x63, 0x6c, 0x61, 0x75, 0x73, 0x65, 0x12, - 0x1c, 0x0a, 0x09, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x18, 0x04, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x09, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x12, 0x16, 0x0a, - 0x06, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x66, - 0x69, 0x6c, 0x74, 0x65, 0x72, 0x22, 0x3b, 0x0a, 0x07, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, - 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, - 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, - 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, - 0x6f, 0x72, 0x22, 0xee, 0x01, 0x0a, 0x0f, 0x50, 0x6c, 0x61, 0x63, 0x65, 0x6d, 0x65, 0x6e, 0x74, - 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x35, 0x0a, 0x08, 0x72, 0x65, 0x70, 0x6c, 0x69, 0x63, - 0x61, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, - 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x52, 0x65, 0x70, 0x6c, - 0x69, 0x63, 0x61, 0x52, 0x08, 0x72, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x73, 0x12, 0x36, 0x0a, - 0x17, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x62, 0x61, 0x63, 0x6b, 0x75, - 0x70, 0x5f, 0x66, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x15, - 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x42, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x46, - 0x61, 0x63, 0x74, 0x6f, 0x72, 0x12, 0x38, 0x0a, 0x09, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, - 0x72, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, - 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x53, 0x65, 0x6c, 0x65, - 0x63, 0x74, 0x6f, 0x72, 0x52, 0x09, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x73, 0x12, - 0x32, 0x0a, 0x07, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, +var file_netmap_grpc_types_proto_rawDesc = []byte{ + 0x0a, 0x17, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, + 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x10, 0x6e, 0x65, 0x6f, 0x2e, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x22, 0xa5, 0x01, 0x0a, 0x06, + 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, + 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x2b, 0x0a, 0x02, + 0x6f, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4f, 0x70, 0x65, 0x72, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x02, 0x6f, 0x70, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, + 0x32, 0x0a, 0x07, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x07, 0x66, 0x69, 0x6c, 0x74, - 0x65, 0x72, 0x73, 0x22, 0xc7, 0x02, 0x0a, 0x08, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, - 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x12, - 0x1c, 0x0a, 0x09, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, - 0x28, 0x09, 0x52, 0x09, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x12, 0x44, 0x0a, - 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x24, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, - 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x41, 0x74, - 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x52, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, - 0x74, 0x65, 0x73, 0x12, 0x36, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x04, 0x20, 0x01, - 0x28, 0x0e, 0x32, 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, - 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x53, - 0x74, 0x61, 0x74, 0x65, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x1a, 0x4d, 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, - 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, - 0x09, 0x52, 0x07, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x73, 0x22, 0x31, 0x0a, 0x05, 0x53, 0x74, - 0x61, 0x74, 0x65, 0x12, 0x0f, 0x0a, 0x0b, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, - 0x45, 0x44, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x4f, 0x4e, 0x4c, 0x49, 0x4e, 0x45, 0x10, 0x01, - 0x12, 0x0b, 0x0a, 0x07, 0x4f, 0x46, 0x46, 0x4c, 0x49, 0x4e, 0x45, 0x10, 0x02, 0x22, 0x8f, 0x01, - 0x0a, 0x0d, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, - 0x49, 0x0a, 0x0a, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, - 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x43, 0x6f, - 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x52, 0x0a, - 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x1a, 0x33, 0x0a, 0x09, 0x50, 0x61, - 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0c, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, - 0xbf, 0x01, 0x0a, 0x0b, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x12, - 0x23, 0x0a, 0x0d, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x65, 0x70, 0x6f, 0x63, 0x68, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0c, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x45, - 0x70, 0x6f, 0x63, 0x68, 0x12, 0x21, 0x0a, 0x0c, 0x6d, 0x61, 0x67, 0x69, 0x63, 0x5f, 0x6e, 0x75, - 0x6d, 0x62, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0b, 0x6d, 0x61, 0x67, 0x69, - 0x63, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x20, 0x0a, 0x0c, 0x6d, 0x73, 0x5f, 0x70, 0x65, - 0x72, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x6d, - 0x73, 0x50, 0x65, 0x72, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x46, 0x0a, 0x0e, 0x6e, 0x65, 0x74, - 0x77, 0x6f, 0x72, 0x6b, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x04, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, - 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x43, 0x6f, 0x6e, 0x66, - 0x69, 0x67, 0x52, 0x0d, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x43, 0x6f, 0x6e, 0x66, 0x69, - 0x67, 0x2a, 0x67, 0x0a, 0x09, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x19, - 0x0a, 0x15, 0x4f, 0x50, 0x45, 0x52, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x53, 0x50, - 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x06, 0x0a, 0x02, 0x45, 0x51, 0x10, - 0x01, 0x12, 0x06, 0x0a, 0x02, 0x4e, 0x45, 0x10, 0x02, 0x12, 0x06, 0x0a, 0x02, 0x47, 0x54, 0x10, - 0x03, 0x12, 0x06, 0x0a, 0x02, 0x47, 0x45, 0x10, 0x04, 0x12, 0x06, 0x0a, 0x02, 0x4c, 0x54, 0x10, - 0x05, 0x12, 0x06, 0x0a, 0x02, 0x4c, 0x45, 0x10, 0x06, 0x12, 0x06, 0x0a, 0x02, 0x4f, 0x52, 0x10, - 0x07, 0x12, 0x07, 0x0a, 0x03, 0x41, 0x4e, 0x44, 0x10, 0x08, 0x2a, 0x38, 0x0a, 0x06, 0x43, 0x6c, - 0x61, 0x75, 0x73, 0x65, 0x12, 0x16, 0x0a, 0x12, 0x43, 0x4c, 0x41, 0x55, 0x53, 0x45, 0x5f, 0x55, - 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, - 0x53, 0x41, 0x4d, 0x45, 0x10, 0x01, 0x12, 0x0c, 0x0a, 0x08, 0x44, 0x49, 0x53, 0x54, 0x49, 0x4e, - 0x43, 0x54, 0x10, 0x02, 0x42, 0x56, 0x5a, 0x37, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, - 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, - 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x6e, 0x65, 0x74, - 0x6d, 0x61, 0x70, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0xaa, - 0x02, 0x1a, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, - 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x4e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x62, 0x06, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, + 0x65, 0x72, 0x73, 0x22, 0x9c, 0x01, 0x0a, 0x08, 0x53, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, + 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, + 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0d, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x30, 0x0a, 0x06, 0x63, 0x6c, + 0x61, 0x75, 0x73, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, + 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x43, 0x6c, + 0x61, 0x75, 0x73, 0x65, 0x52, 0x06, 0x63, 0x6c, 0x61, 0x75, 0x73, 0x65, 0x12, 0x1c, 0x0a, 0x09, + 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x09, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x66, 0x69, + 0x6c, 0x74, 0x65, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x66, 0x69, 0x6c, 0x74, + 0x65, 0x72, 0x22, 0x3b, 0x0a, 0x07, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x12, 0x14, 0x0a, + 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x63, 0x6f, + 0x75, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x22, + 0xee, 0x01, 0x0a, 0x0f, 0x50, 0x6c, 0x61, 0x63, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x50, 0x6f, 0x6c, + 0x69, 0x63, 0x79, 0x12, 0x35, 0x0a, 0x08, 0x72, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x73, 0x18, + 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, + 0x52, 0x08, 0x72, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x73, 0x12, 0x36, 0x0a, 0x17, 0x63, 0x6f, + 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x62, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x5f, 0x66, + 0x61, 0x63, 0x74, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x15, 0x63, 0x6f, 0x6e, + 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x42, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x46, 0x61, 0x63, 0x74, + 0x6f, 0x72, 0x12, 0x38, 0x0a, 0x09, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x73, 0x18, + 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x53, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, + 0x72, 0x52, 0x09, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x73, 0x12, 0x32, 0x0a, 0x07, + 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, + 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, + 0x2e, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x07, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x73, + 0x22, 0xc7, 0x02, 0x0a, 0x08, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x1d, 0x0a, + 0x0a, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0c, 0x52, 0x09, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x12, 0x1c, 0x0a, 0x09, + 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, + 0x09, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x12, 0x44, 0x0a, 0x0a, 0x61, 0x74, + 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, + 0x70, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x41, 0x74, 0x74, 0x72, 0x69, + 0x62, 0x75, 0x74, 0x65, 0x52, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, + 0x12, 0x36, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, + 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, + 0x61, 0x70, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x53, 0x74, 0x61, 0x74, + 0x65, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x1a, 0x4d, 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, 0x12, 0x18, 0x0a, + 0x07, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, + 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x73, 0x22, 0x31, 0x0a, 0x05, 0x53, 0x74, 0x61, 0x74, 0x65, + 0x12, 0x0f, 0x0a, 0x0b, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, + 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x4f, 0x4e, 0x4c, 0x49, 0x4e, 0x45, 0x10, 0x01, 0x12, 0x0b, 0x0a, + 0x07, 0x4f, 0x46, 0x46, 0x4c, 0x49, 0x4e, 0x45, 0x10, 0x02, 0x22, 0x8f, 0x01, 0x0a, 0x0d, 0x4e, + 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x49, 0x0a, 0x0a, + 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x29, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, + 0x6d, 0x61, 0x70, 0x2e, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x43, 0x6f, 0x6e, 0x66, 0x69, + 0x67, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x52, 0x0a, 0x70, 0x61, 0x72, + 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x1a, 0x33, 0x0a, 0x09, 0x50, 0x61, 0x72, 0x61, 0x6d, + 0x65, 0x74, 0x65, 0x72, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0c, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xbf, 0x01, 0x0a, + 0x0b, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x23, 0x0a, 0x0d, + 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x04, 0x52, 0x0c, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x45, 0x70, 0x6f, 0x63, + 0x68, 0x12, 0x21, 0x0a, 0x0c, 0x6d, 0x61, 0x67, 0x69, 0x63, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, + 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0b, 0x6d, 0x61, 0x67, 0x69, 0x63, 0x4e, 0x75, + 0x6d, 0x62, 0x65, 0x72, 0x12, 0x20, 0x0a, 0x0c, 0x6d, 0x73, 0x5f, 0x70, 0x65, 0x72, 0x5f, 0x62, + 0x6c, 0x6f, 0x63, 0x6b, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x6d, 0x73, 0x50, 0x65, + 0x72, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x46, 0x0a, 0x0e, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, + 0x6b, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, + 0x70, 0x2e, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, + 0x0d, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2a, 0x67, + 0x0a, 0x09, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x19, 0x0a, 0x15, 0x4f, + 0x50, 0x45, 0x52, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, + 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x06, 0x0a, 0x02, 0x45, 0x51, 0x10, 0x01, 0x12, 0x06, + 0x0a, 0x02, 0x4e, 0x45, 0x10, 0x02, 0x12, 0x06, 0x0a, 0x02, 0x47, 0x54, 0x10, 0x03, 0x12, 0x06, + 0x0a, 0x02, 0x47, 0x45, 0x10, 0x04, 0x12, 0x06, 0x0a, 0x02, 0x4c, 0x54, 0x10, 0x05, 0x12, 0x06, + 0x0a, 0x02, 0x4c, 0x45, 0x10, 0x06, 0x12, 0x06, 0x0a, 0x02, 0x4f, 0x52, 0x10, 0x07, 0x12, 0x07, + 0x0a, 0x03, 0x41, 0x4e, 0x44, 0x10, 0x08, 0x2a, 0x38, 0x0a, 0x06, 0x43, 0x6c, 0x61, 0x75, 0x73, + 0x65, 0x12, 0x16, 0x0a, 0x12, 0x43, 0x4c, 0x41, 0x55, 0x53, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, + 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x53, 0x41, 0x4d, + 0x45, 0x10, 0x01, 0x12, 0x0c, 0x0a, 0x08, 0x44, 0x49, 0x53, 0x54, 0x49, 0x4e, 0x43, 0x54, 0x10, + 0x02, 0x42, 0x56, 0x5a, 0x37, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, + 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, + 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, + 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0xaa, 0x02, 0x1a, 0x4e, + 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, + 0x50, 0x49, 0x2e, 0x4e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, } var ( - file_v2_netmap_grpc_types_proto_rawDescOnce sync.Once - file_v2_netmap_grpc_types_proto_rawDescData = file_v2_netmap_grpc_types_proto_rawDesc + file_netmap_grpc_types_proto_rawDescOnce sync.Once + file_netmap_grpc_types_proto_rawDescData = file_netmap_grpc_types_proto_rawDesc ) -func file_v2_netmap_grpc_types_proto_rawDescGZIP() []byte { - file_v2_netmap_grpc_types_proto_rawDescOnce.Do(func() { - file_v2_netmap_grpc_types_proto_rawDescData = protoimpl.X.CompressGZIP(file_v2_netmap_grpc_types_proto_rawDescData) +func file_netmap_grpc_types_proto_rawDescGZIP() []byte { + file_netmap_grpc_types_proto_rawDescOnce.Do(func() { + file_netmap_grpc_types_proto_rawDescData = protoimpl.X.CompressGZIP(file_netmap_grpc_types_proto_rawDescData) }) - return file_v2_netmap_grpc_types_proto_rawDescData + return file_netmap_grpc_types_proto_rawDescData } -var file_v2_netmap_grpc_types_proto_enumTypes = make([]protoimpl.EnumInfo, 3) -var file_v2_netmap_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 9) -var file_v2_netmap_grpc_types_proto_goTypes = []interface{}{ +var file_netmap_grpc_types_proto_enumTypes = make([]protoimpl.EnumInfo, 3) +var file_netmap_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 9) +var file_netmap_grpc_types_proto_goTypes = []interface{}{ (Operation)(0), // 0: neo.fs.v2.netmap.Operation (Clause)(0), // 1: neo.fs.v2.netmap.Clause (NodeInfo_State)(0), // 2: neo.fs.v2.netmap.NodeInfo.State @@ -1050,7 +1050,7 @@ var file_v2_netmap_grpc_types_proto_goTypes = []interface{}{ (*NodeInfo_Attribute)(nil), // 10: neo.fs.v2.netmap.NodeInfo.Attribute (*NetworkConfig_Parameter)(nil), // 11: neo.fs.v2.netmap.NetworkConfig.Parameter } -var file_v2_netmap_grpc_types_proto_depIdxs = []int32{ +var file_netmap_grpc_types_proto_depIdxs = []int32{ 0, // 0: neo.fs.v2.netmap.Filter.op:type_name -> neo.fs.v2.netmap.Operation 3, // 1: neo.fs.v2.netmap.Filter.filters:type_name -> neo.fs.v2.netmap.Filter 1, // 2: neo.fs.v2.netmap.Selector.clause:type_name -> neo.fs.v2.netmap.Clause @@ -1068,13 +1068,13 @@ var file_v2_netmap_grpc_types_proto_depIdxs = []int32{ 0, // [0:10] is the sub-list for field type_name } -func init() { file_v2_netmap_grpc_types_proto_init() } -func file_v2_netmap_grpc_types_proto_init() { - if File_v2_netmap_grpc_types_proto != nil { +func init() { file_netmap_grpc_types_proto_init() } +func file_netmap_grpc_types_proto_init() { + if File_netmap_grpc_types_proto != nil { return } if !protoimpl.UnsafeEnabled { - file_v2_netmap_grpc_types_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_netmap_grpc_types_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Filter); i { case 0: return &v.state @@ -1086,7 +1086,7 @@ func file_v2_netmap_grpc_types_proto_init() { return nil } } - file_v2_netmap_grpc_types_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_netmap_grpc_types_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Selector); i { case 0: return &v.state @@ -1098,7 +1098,7 @@ func file_v2_netmap_grpc_types_proto_init() { return nil } } - file_v2_netmap_grpc_types_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + file_netmap_grpc_types_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Replica); i { case 0: return &v.state @@ -1110,7 +1110,7 @@ func file_v2_netmap_grpc_types_proto_init() { return nil } } - file_v2_netmap_grpc_types_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + file_netmap_grpc_types_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PlacementPolicy); i { case 0: return &v.state @@ -1122,7 +1122,7 @@ func file_v2_netmap_grpc_types_proto_init() { return nil } } - file_v2_netmap_grpc_types_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + file_netmap_grpc_types_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*NodeInfo); i { case 0: return &v.state @@ -1134,7 +1134,7 @@ func file_v2_netmap_grpc_types_proto_init() { return nil } } - file_v2_netmap_grpc_types_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + file_netmap_grpc_types_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*NetworkConfig); i { case 0: return &v.state @@ -1146,7 +1146,7 @@ func file_v2_netmap_grpc_types_proto_init() { return nil } } - file_v2_netmap_grpc_types_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + file_netmap_grpc_types_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*NetworkInfo); i { case 0: return &v.state @@ -1158,7 +1158,7 @@ func file_v2_netmap_grpc_types_proto_init() { return nil } } - file_v2_netmap_grpc_types_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + file_netmap_grpc_types_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*NodeInfo_Attribute); i { case 0: return &v.state @@ -1170,7 +1170,7 @@ func file_v2_netmap_grpc_types_proto_init() { return nil } } - file_v2_netmap_grpc_types_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + file_netmap_grpc_types_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*NetworkConfig_Parameter); i { case 0: return &v.state @@ -1187,19 +1187,19 @@ func file_v2_netmap_grpc_types_proto_init() { out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_v2_netmap_grpc_types_proto_rawDesc, + RawDescriptor: file_netmap_grpc_types_proto_rawDesc, NumEnums: 3, NumMessages: 9, NumExtensions: 0, NumServices: 0, }, - GoTypes: file_v2_netmap_grpc_types_proto_goTypes, - DependencyIndexes: file_v2_netmap_grpc_types_proto_depIdxs, - EnumInfos: file_v2_netmap_grpc_types_proto_enumTypes, - MessageInfos: file_v2_netmap_grpc_types_proto_msgTypes, + GoTypes: file_netmap_grpc_types_proto_goTypes, + DependencyIndexes: file_netmap_grpc_types_proto_depIdxs, + EnumInfos: file_netmap_grpc_types_proto_enumTypes, + MessageInfos: file_netmap_grpc_types_proto_msgTypes, }.Build() - File_v2_netmap_grpc_types_proto = out.File - file_v2_netmap_grpc_types_proto_rawDesc = nil - file_v2_netmap_grpc_types_proto_goTypes = nil - file_v2_netmap_grpc_types_proto_depIdxs = nil + File_netmap_grpc_types_proto = out.File + file_netmap_grpc_types_proto_rawDesc = nil + file_netmap_grpc_types_proto_goTypes = nil + file_netmap_grpc_types_proto_depIdxs = nil } diff --git a/object/grpc/service.pb.go b/object/grpc/service.pb.go index 9c61501..3e42924 100644 --- a/object/grpc/service.pb.go +++ b/object/grpc/service.pb.go @@ -2,7 +2,7 @@ // versions: // protoc-gen-go v1.27.1 // protoc v3.18.0 -// source: v2/object/grpc/service.proto +// source: object/grpc/service.proto package object @@ -42,7 +42,7 @@ type GetRequest struct { func (x *GetRequest) Reset() { *x = GetRequest{} if protoimpl.UnsafeEnabled { - mi := &file_v2_object_grpc_service_proto_msgTypes[0] + mi := &file_object_grpc_service_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -55,7 +55,7 @@ func (x *GetRequest) String() string { func (*GetRequest) ProtoMessage() {} func (x *GetRequest) ProtoReflect() protoreflect.Message { - mi := &file_v2_object_grpc_service_proto_msgTypes[0] + mi := &file_object_grpc_service_proto_msgTypes[0] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -68,7 +68,7 @@ func (x *GetRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use GetRequest.ProtoReflect.Descriptor instead. func (*GetRequest) Descriptor() ([]byte, []int) { - return file_v2_object_grpc_service_proto_rawDescGZIP(), []int{0} + return file_object_grpc_service_proto_rawDescGZIP(), []int{0} } func (x *GetRequest) GetBody() *GetRequest_Body { @@ -112,7 +112,7 @@ type GetResponse struct { func (x *GetResponse) Reset() { *x = GetResponse{} if protoimpl.UnsafeEnabled { - mi := &file_v2_object_grpc_service_proto_msgTypes[1] + mi := &file_object_grpc_service_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -125,7 +125,7 @@ func (x *GetResponse) String() string { func (*GetResponse) ProtoMessage() {} func (x *GetResponse) ProtoReflect() protoreflect.Message { - mi := &file_v2_object_grpc_service_proto_msgTypes[1] + mi := &file_object_grpc_service_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -138,7 +138,7 @@ func (x *GetResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use GetResponse.ProtoReflect.Descriptor instead. func (*GetResponse) Descriptor() ([]byte, []int) { - return file_v2_object_grpc_service_proto_rawDescGZIP(), []int{1} + return file_object_grpc_service_proto_rawDescGZIP(), []int{1} } func (x *GetResponse) GetBody() *GetResponse_Body { @@ -182,7 +182,7 @@ type PutRequest struct { func (x *PutRequest) Reset() { *x = PutRequest{} if protoimpl.UnsafeEnabled { - mi := &file_v2_object_grpc_service_proto_msgTypes[2] + mi := &file_object_grpc_service_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -195,7 +195,7 @@ func (x *PutRequest) String() string { func (*PutRequest) ProtoMessage() {} func (x *PutRequest) ProtoReflect() protoreflect.Message { - mi := &file_v2_object_grpc_service_proto_msgTypes[2] + mi := &file_object_grpc_service_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -208,7 +208,7 @@ func (x *PutRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use PutRequest.ProtoReflect.Descriptor instead. func (*PutRequest) Descriptor() ([]byte, []int) { - return file_v2_object_grpc_service_proto_rawDescGZIP(), []int{2} + return file_object_grpc_service_proto_rawDescGZIP(), []int{2} } func (x *PutRequest) GetBody() *PutRequest_Body { @@ -252,7 +252,7 @@ type PutResponse struct { func (x *PutResponse) Reset() { *x = PutResponse{} if protoimpl.UnsafeEnabled { - mi := &file_v2_object_grpc_service_proto_msgTypes[3] + mi := &file_object_grpc_service_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -265,7 +265,7 @@ func (x *PutResponse) String() string { func (*PutResponse) ProtoMessage() {} func (x *PutResponse) ProtoReflect() protoreflect.Message { - mi := &file_v2_object_grpc_service_proto_msgTypes[3] + mi := &file_object_grpc_service_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -278,7 +278,7 @@ func (x *PutResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use PutResponse.ProtoReflect.Descriptor instead. func (*PutResponse) Descriptor() ([]byte, []int) { - return file_v2_object_grpc_service_proto_rawDescGZIP(), []int{3} + return file_object_grpc_service_proto_rawDescGZIP(), []int{3} } func (x *PutResponse) GetBody() *PutResponse_Body { @@ -322,7 +322,7 @@ type DeleteRequest struct { func (x *DeleteRequest) Reset() { *x = DeleteRequest{} if protoimpl.UnsafeEnabled { - mi := &file_v2_object_grpc_service_proto_msgTypes[4] + mi := &file_object_grpc_service_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -335,7 +335,7 @@ func (x *DeleteRequest) String() string { func (*DeleteRequest) ProtoMessage() {} func (x *DeleteRequest) ProtoReflect() protoreflect.Message { - mi := &file_v2_object_grpc_service_proto_msgTypes[4] + mi := &file_object_grpc_service_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -348,7 +348,7 @@ func (x *DeleteRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use DeleteRequest.ProtoReflect.Descriptor instead. func (*DeleteRequest) Descriptor() ([]byte, []int) { - return file_v2_object_grpc_service_proto_rawDescGZIP(), []int{4} + return file_object_grpc_service_proto_rawDescGZIP(), []int{4} } func (x *DeleteRequest) GetBody() *DeleteRequest_Body { @@ -393,7 +393,7 @@ type DeleteResponse struct { func (x *DeleteResponse) Reset() { *x = DeleteResponse{} if protoimpl.UnsafeEnabled { - mi := &file_v2_object_grpc_service_proto_msgTypes[5] + mi := &file_object_grpc_service_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -406,7 +406,7 @@ func (x *DeleteResponse) String() string { func (*DeleteResponse) ProtoMessage() {} func (x *DeleteResponse) ProtoReflect() protoreflect.Message { - mi := &file_v2_object_grpc_service_proto_msgTypes[5] + mi := &file_object_grpc_service_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -419,7 +419,7 @@ func (x *DeleteResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use DeleteResponse.ProtoReflect.Descriptor instead. func (*DeleteResponse) Descriptor() ([]byte, []int) { - return file_v2_object_grpc_service_proto_rawDescGZIP(), []int{5} + return file_object_grpc_service_proto_rawDescGZIP(), []int{5} } func (x *DeleteResponse) GetBody() *DeleteResponse_Body { @@ -463,7 +463,7 @@ type HeadRequest struct { func (x *HeadRequest) Reset() { *x = HeadRequest{} if protoimpl.UnsafeEnabled { - mi := &file_v2_object_grpc_service_proto_msgTypes[6] + mi := &file_object_grpc_service_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -476,7 +476,7 @@ func (x *HeadRequest) String() string { func (*HeadRequest) ProtoMessage() {} func (x *HeadRequest) ProtoReflect() protoreflect.Message { - mi := &file_v2_object_grpc_service_proto_msgTypes[6] + mi := &file_object_grpc_service_proto_msgTypes[6] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -489,7 +489,7 @@ func (x *HeadRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use HeadRequest.ProtoReflect.Descriptor instead. func (*HeadRequest) Descriptor() ([]byte, []int) { - return file_v2_object_grpc_service_proto_rawDescGZIP(), []int{6} + return file_object_grpc_service_proto_rawDescGZIP(), []int{6} } func (x *HeadRequest) GetBody() *HeadRequest_Body { @@ -534,7 +534,7 @@ type HeaderWithSignature struct { func (x *HeaderWithSignature) Reset() { *x = HeaderWithSignature{} if protoimpl.UnsafeEnabled { - mi := &file_v2_object_grpc_service_proto_msgTypes[7] + mi := &file_object_grpc_service_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -547,7 +547,7 @@ func (x *HeaderWithSignature) String() string { func (*HeaderWithSignature) ProtoMessage() {} func (x *HeaderWithSignature) ProtoReflect() protoreflect.Message { - mi := &file_v2_object_grpc_service_proto_msgTypes[7] + mi := &file_object_grpc_service_proto_msgTypes[7] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -560,7 +560,7 @@ func (x *HeaderWithSignature) ProtoReflect() protoreflect.Message { // Deprecated: Use HeaderWithSignature.ProtoReflect.Descriptor instead. func (*HeaderWithSignature) Descriptor() ([]byte, []int) { - return file_v2_object_grpc_service_proto_rawDescGZIP(), []int{7} + return file_object_grpc_service_proto_rawDescGZIP(), []int{7} } func (x *HeaderWithSignature) GetHeader() *Header { @@ -597,7 +597,7 @@ type HeadResponse struct { func (x *HeadResponse) Reset() { *x = HeadResponse{} if protoimpl.UnsafeEnabled { - mi := &file_v2_object_grpc_service_proto_msgTypes[8] + mi := &file_object_grpc_service_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -610,7 +610,7 @@ func (x *HeadResponse) String() string { func (*HeadResponse) ProtoMessage() {} func (x *HeadResponse) ProtoReflect() protoreflect.Message { - mi := &file_v2_object_grpc_service_proto_msgTypes[8] + mi := &file_object_grpc_service_proto_msgTypes[8] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -623,7 +623,7 @@ func (x *HeadResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use HeadResponse.ProtoReflect.Descriptor instead. func (*HeadResponse) Descriptor() ([]byte, []int) { - return file_v2_object_grpc_service_proto_rawDescGZIP(), []int{8} + return file_object_grpc_service_proto_rawDescGZIP(), []int{8} } func (x *HeadResponse) GetBody() *HeadResponse_Body { @@ -667,7 +667,7 @@ type SearchRequest struct { func (x *SearchRequest) Reset() { *x = SearchRequest{} if protoimpl.UnsafeEnabled { - mi := &file_v2_object_grpc_service_proto_msgTypes[9] + mi := &file_object_grpc_service_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -680,7 +680,7 @@ func (x *SearchRequest) String() string { func (*SearchRequest) ProtoMessage() {} func (x *SearchRequest) ProtoReflect() protoreflect.Message { - mi := &file_v2_object_grpc_service_proto_msgTypes[9] + mi := &file_object_grpc_service_proto_msgTypes[9] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -693,7 +693,7 @@ func (x *SearchRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use SearchRequest.ProtoReflect.Descriptor instead. func (*SearchRequest) Descriptor() ([]byte, []int) { - return file_v2_object_grpc_service_proto_rawDescGZIP(), []int{9} + return file_object_grpc_service_proto_rawDescGZIP(), []int{9} } func (x *SearchRequest) GetBody() *SearchRequest_Body { @@ -737,7 +737,7 @@ type SearchResponse struct { func (x *SearchResponse) Reset() { *x = SearchResponse{} if protoimpl.UnsafeEnabled { - mi := &file_v2_object_grpc_service_proto_msgTypes[10] + mi := &file_object_grpc_service_proto_msgTypes[10] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -750,7 +750,7 @@ func (x *SearchResponse) String() string { func (*SearchResponse) ProtoMessage() {} func (x *SearchResponse) ProtoReflect() protoreflect.Message { - mi := &file_v2_object_grpc_service_proto_msgTypes[10] + mi := &file_object_grpc_service_proto_msgTypes[10] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -763,7 +763,7 @@ func (x *SearchResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use SearchResponse.ProtoReflect.Descriptor instead. func (*SearchResponse) Descriptor() ([]byte, []int) { - return file_v2_object_grpc_service_proto_rawDescGZIP(), []int{10} + return file_object_grpc_service_proto_rawDescGZIP(), []int{10} } func (x *SearchResponse) GetBody() *SearchResponse_Body { @@ -802,7 +802,7 @@ type Range struct { func (x *Range) Reset() { *x = Range{} if protoimpl.UnsafeEnabled { - mi := &file_v2_object_grpc_service_proto_msgTypes[11] + mi := &file_object_grpc_service_proto_msgTypes[11] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -815,7 +815,7 @@ func (x *Range) String() string { func (*Range) ProtoMessage() {} func (x *Range) ProtoReflect() protoreflect.Message { - mi := &file_v2_object_grpc_service_proto_msgTypes[11] + mi := &file_object_grpc_service_proto_msgTypes[11] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -828,7 +828,7 @@ func (x *Range) ProtoReflect() protoreflect.Message { // Deprecated: Use Range.ProtoReflect.Descriptor instead. func (*Range) Descriptor() ([]byte, []int) { - return file_v2_object_grpc_service_proto_rawDescGZIP(), []int{11} + return file_object_grpc_service_proto_rawDescGZIP(), []int{11} } func (x *Range) GetOffset() uint64 { @@ -865,7 +865,7 @@ type GetRangeRequest struct { func (x *GetRangeRequest) Reset() { *x = GetRangeRequest{} if protoimpl.UnsafeEnabled { - mi := &file_v2_object_grpc_service_proto_msgTypes[12] + mi := &file_object_grpc_service_proto_msgTypes[12] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -878,7 +878,7 @@ func (x *GetRangeRequest) String() string { func (*GetRangeRequest) ProtoMessage() {} func (x *GetRangeRequest) ProtoReflect() protoreflect.Message { - mi := &file_v2_object_grpc_service_proto_msgTypes[12] + mi := &file_object_grpc_service_proto_msgTypes[12] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -891,7 +891,7 @@ func (x *GetRangeRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use GetRangeRequest.ProtoReflect.Descriptor instead. func (*GetRangeRequest) Descriptor() ([]byte, []int) { - return file_v2_object_grpc_service_proto_rawDescGZIP(), []int{12} + return file_object_grpc_service_proto_rawDescGZIP(), []int{12} } func (x *GetRangeRequest) GetBody() *GetRangeRequest_Body { @@ -935,7 +935,7 @@ type GetRangeResponse struct { func (x *GetRangeResponse) Reset() { *x = GetRangeResponse{} if protoimpl.UnsafeEnabled { - mi := &file_v2_object_grpc_service_proto_msgTypes[13] + mi := &file_object_grpc_service_proto_msgTypes[13] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -948,7 +948,7 @@ func (x *GetRangeResponse) String() string { func (*GetRangeResponse) ProtoMessage() {} func (x *GetRangeResponse) ProtoReflect() protoreflect.Message { - mi := &file_v2_object_grpc_service_proto_msgTypes[13] + mi := &file_object_grpc_service_proto_msgTypes[13] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -961,7 +961,7 @@ func (x *GetRangeResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use GetRangeResponse.ProtoReflect.Descriptor instead. func (*GetRangeResponse) Descriptor() ([]byte, []int) { - return file_v2_object_grpc_service_proto_rawDescGZIP(), []int{13} + return file_object_grpc_service_proto_rawDescGZIP(), []int{13} } func (x *GetRangeResponse) GetBody() *GetRangeResponse_Body { @@ -1005,7 +1005,7 @@ type GetRangeHashRequest struct { func (x *GetRangeHashRequest) Reset() { *x = GetRangeHashRequest{} if protoimpl.UnsafeEnabled { - mi := &file_v2_object_grpc_service_proto_msgTypes[14] + mi := &file_object_grpc_service_proto_msgTypes[14] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1018,7 +1018,7 @@ func (x *GetRangeHashRequest) String() string { func (*GetRangeHashRequest) ProtoMessage() {} func (x *GetRangeHashRequest) ProtoReflect() protoreflect.Message { - mi := &file_v2_object_grpc_service_proto_msgTypes[14] + mi := &file_object_grpc_service_proto_msgTypes[14] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1031,7 +1031,7 @@ func (x *GetRangeHashRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use GetRangeHashRequest.ProtoReflect.Descriptor instead. func (*GetRangeHashRequest) Descriptor() ([]byte, []int) { - return file_v2_object_grpc_service_proto_rawDescGZIP(), []int{14} + return file_object_grpc_service_proto_rawDescGZIP(), []int{14} } func (x *GetRangeHashRequest) GetBody() *GetRangeHashRequest_Body { @@ -1075,7 +1075,7 @@ type GetRangeHashResponse struct { func (x *GetRangeHashResponse) Reset() { *x = GetRangeHashResponse{} if protoimpl.UnsafeEnabled { - mi := &file_v2_object_grpc_service_proto_msgTypes[15] + mi := &file_object_grpc_service_proto_msgTypes[15] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1088,7 +1088,7 @@ func (x *GetRangeHashResponse) String() string { func (*GetRangeHashResponse) ProtoMessage() {} func (x *GetRangeHashResponse) ProtoReflect() protoreflect.Message { - mi := &file_v2_object_grpc_service_proto_msgTypes[15] + mi := &file_object_grpc_service_proto_msgTypes[15] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1101,7 +1101,7 @@ func (x *GetRangeHashResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use GetRangeHashResponse.ProtoReflect.Descriptor instead. func (*GetRangeHashResponse) Descriptor() ([]byte, []int) { - return file_v2_object_grpc_service_proto_rawDescGZIP(), []int{15} + return file_object_grpc_service_proto_rawDescGZIP(), []int{15} } func (x *GetRangeHashResponse) GetBody() *GetRangeHashResponse_Body { @@ -1141,7 +1141,7 @@ type GetRequest_Body struct { func (x *GetRequest_Body) Reset() { *x = GetRequest_Body{} if protoimpl.UnsafeEnabled { - mi := &file_v2_object_grpc_service_proto_msgTypes[16] + mi := &file_object_grpc_service_proto_msgTypes[16] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1154,7 +1154,7 @@ func (x *GetRequest_Body) String() string { func (*GetRequest_Body) ProtoMessage() {} func (x *GetRequest_Body) ProtoReflect() protoreflect.Message { - mi := &file_v2_object_grpc_service_proto_msgTypes[16] + mi := &file_object_grpc_service_proto_msgTypes[16] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1167,7 +1167,7 @@ func (x *GetRequest_Body) ProtoReflect() protoreflect.Message { // Deprecated: Use GetRequest_Body.ProtoReflect.Descriptor instead. func (*GetRequest_Body) Descriptor() ([]byte, []int) { - return file_v2_object_grpc_service_proto_rawDescGZIP(), []int{0, 0} + return file_object_grpc_service_proto_rawDescGZIP(), []int{0, 0} } func (x *GetRequest_Body) GetAddress() *grpc1.Address { @@ -1202,7 +1202,7 @@ type GetResponse_Body struct { func (x *GetResponse_Body) Reset() { *x = GetResponse_Body{} if protoimpl.UnsafeEnabled { - mi := &file_v2_object_grpc_service_proto_msgTypes[17] + mi := &file_object_grpc_service_proto_msgTypes[17] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1215,7 +1215,7 @@ func (x *GetResponse_Body) String() string { func (*GetResponse_Body) ProtoMessage() {} func (x *GetResponse_Body) ProtoReflect() protoreflect.Message { - mi := &file_v2_object_grpc_service_proto_msgTypes[17] + mi := &file_object_grpc_service_proto_msgTypes[17] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1228,7 +1228,7 @@ func (x *GetResponse_Body) ProtoReflect() protoreflect.Message { // Deprecated: Use GetResponse_Body.ProtoReflect.Descriptor instead. func (*GetResponse_Body) Descriptor() ([]byte, []int) { - return file_v2_object_grpc_service_proto_rawDescGZIP(), []int{1, 0} + return file_object_grpc_service_proto_rawDescGZIP(), []int{1, 0} } func (m *GetResponse_Body) GetObjectPart() isGetResponse_Body_ObjectPart { @@ -1302,7 +1302,7 @@ type GetResponse_Body_Init struct { func (x *GetResponse_Body_Init) Reset() { *x = GetResponse_Body_Init{} if protoimpl.UnsafeEnabled { - mi := &file_v2_object_grpc_service_proto_msgTypes[18] + mi := &file_object_grpc_service_proto_msgTypes[18] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1315,7 +1315,7 @@ func (x *GetResponse_Body_Init) String() string { func (*GetResponse_Body_Init) ProtoMessage() {} func (x *GetResponse_Body_Init) ProtoReflect() protoreflect.Message { - mi := &file_v2_object_grpc_service_proto_msgTypes[18] + mi := &file_object_grpc_service_proto_msgTypes[18] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1328,7 +1328,7 @@ func (x *GetResponse_Body_Init) ProtoReflect() protoreflect.Message { // Deprecated: Use GetResponse_Body_Init.ProtoReflect.Descriptor instead. func (*GetResponse_Body_Init) Descriptor() ([]byte, []int) { - return file_v2_object_grpc_service_proto_rawDescGZIP(), []int{1, 0, 0} + return file_object_grpc_service_proto_rawDescGZIP(), []int{1, 0, 0} } func (x *GetResponse_Body_Init) GetObjectId() *grpc1.ObjectID { @@ -1369,7 +1369,7 @@ type PutRequest_Body struct { func (x *PutRequest_Body) Reset() { *x = PutRequest_Body{} if protoimpl.UnsafeEnabled { - mi := &file_v2_object_grpc_service_proto_msgTypes[19] + mi := &file_object_grpc_service_proto_msgTypes[19] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1382,7 +1382,7 @@ func (x *PutRequest_Body) String() string { func (*PutRequest_Body) ProtoMessage() {} func (x *PutRequest_Body) ProtoReflect() protoreflect.Message { - mi := &file_v2_object_grpc_service_proto_msgTypes[19] + mi := &file_object_grpc_service_proto_msgTypes[19] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1395,7 +1395,7 @@ func (x *PutRequest_Body) ProtoReflect() protoreflect.Message { // Deprecated: Use PutRequest_Body.ProtoReflect.Descriptor instead. func (*PutRequest_Body) Descriptor() ([]byte, []int) { - return file_v2_object_grpc_service_proto_rawDescGZIP(), []int{2, 0} + return file_object_grpc_service_proto_rawDescGZIP(), []int{2, 0} } func (m *PutRequest_Body) GetObjectPart() isPutRequest_Body_ObjectPart { @@ -1458,7 +1458,7 @@ type PutRequest_Body_Init struct { func (x *PutRequest_Body_Init) Reset() { *x = PutRequest_Body_Init{} if protoimpl.UnsafeEnabled { - mi := &file_v2_object_grpc_service_proto_msgTypes[20] + mi := &file_object_grpc_service_proto_msgTypes[20] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1471,7 +1471,7 @@ func (x *PutRequest_Body_Init) String() string { func (*PutRequest_Body_Init) ProtoMessage() {} func (x *PutRequest_Body_Init) ProtoReflect() protoreflect.Message { - mi := &file_v2_object_grpc_service_proto_msgTypes[20] + mi := &file_object_grpc_service_proto_msgTypes[20] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1484,7 +1484,7 @@ func (x *PutRequest_Body_Init) ProtoReflect() protoreflect.Message { // Deprecated: Use PutRequest_Body_Init.ProtoReflect.Descriptor instead. func (*PutRequest_Body_Init) Descriptor() ([]byte, []int) { - return file_v2_object_grpc_service_proto_rawDescGZIP(), []int{2, 0, 0} + return file_object_grpc_service_proto_rawDescGZIP(), []int{2, 0, 0} } func (x *PutRequest_Body_Init) GetObjectId() *grpc1.ObjectID { @@ -1528,7 +1528,7 @@ type PutResponse_Body struct { func (x *PutResponse_Body) Reset() { *x = PutResponse_Body{} if protoimpl.UnsafeEnabled { - mi := &file_v2_object_grpc_service_proto_msgTypes[21] + mi := &file_object_grpc_service_proto_msgTypes[21] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1541,7 +1541,7 @@ func (x *PutResponse_Body) String() string { func (*PutResponse_Body) ProtoMessage() {} func (x *PutResponse_Body) ProtoReflect() protoreflect.Message { - mi := &file_v2_object_grpc_service_proto_msgTypes[21] + mi := &file_object_grpc_service_proto_msgTypes[21] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1554,7 +1554,7 @@ func (x *PutResponse_Body) ProtoReflect() protoreflect.Message { // Deprecated: Use PutResponse_Body.ProtoReflect.Descriptor instead. func (*PutResponse_Body) Descriptor() ([]byte, []int) { - return file_v2_object_grpc_service_proto_rawDescGZIP(), []int{3, 0} + return file_object_grpc_service_proto_rawDescGZIP(), []int{3, 0} } func (x *PutResponse_Body) GetObjectId() *grpc1.ObjectID { @@ -1577,7 +1577,7 @@ type DeleteRequest_Body struct { func (x *DeleteRequest_Body) Reset() { *x = DeleteRequest_Body{} if protoimpl.UnsafeEnabled { - mi := &file_v2_object_grpc_service_proto_msgTypes[22] + mi := &file_object_grpc_service_proto_msgTypes[22] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1590,7 +1590,7 @@ func (x *DeleteRequest_Body) String() string { func (*DeleteRequest_Body) ProtoMessage() {} func (x *DeleteRequest_Body) ProtoReflect() protoreflect.Message { - mi := &file_v2_object_grpc_service_proto_msgTypes[22] + mi := &file_object_grpc_service_proto_msgTypes[22] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1603,7 +1603,7 @@ func (x *DeleteRequest_Body) ProtoReflect() protoreflect.Message { // Deprecated: Use DeleteRequest_Body.ProtoReflect.Descriptor instead. func (*DeleteRequest_Body) Descriptor() ([]byte, []int) { - return file_v2_object_grpc_service_proto_rawDescGZIP(), []int{4, 0} + return file_object_grpc_service_proto_rawDescGZIP(), []int{4, 0} } func (x *DeleteRequest_Body) GetAddress() *grpc1.Address { @@ -1626,7 +1626,7 @@ type DeleteResponse_Body struct { func (x *DeleteResponse_Body) Reset() { *x = DeleteResponse_Body{} if protoimpl.UnsafeEnabled { - mi := &file_v2_object_grpc_service_proto_msgTypes[23] + mi := &file_object_grpc_service_proto_msgTypes[23] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1639,7 +1639,7 @@ func (x *DeleteResponse_Body) String() string { func (*DeleteResponse_Body) ProtoMessage() {} func (x *DeleteResponse_Body) ProtoReflect() protoreflect.Message { - mi := &file_v2_object_grpc_service_proto_msgTypes[23] + mi := &file_object_grpc_service_proto_msgTypes[23] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1652,7 +1652,7 @@ func (x *DeleteResponse_Body) ProtoReflect() protoreflect.Message { // Deprecated: Use DeleteResponse_Body.ProtoReflect.Descriptor instead. func (*DeleteResponse_Body) Descriptor() ([]byte, []int) { - return file_v2_object_grpc_service_proto_rawDescGZIP(), []int{5, 0} + return file_object_grpc_service_proto_rawDescGZIP(), []int{5, 0} } func (x *DeleteResponse_Body) GetTombstone() *grpc1.Address { @@ -1680,7 +1680,7 @@ type HeadRequest_Body struct { func (x *HeadRequest_Body) Reset() { *x = HeadRequest_Body{} if protoimpl.UnsafeEnabled { - mi := &file_v2_object_grpc_service_proto_msgTypes[24] + mi := &file_object_grpc_service_proto_msgTypes[24] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1693,7 +1693,7 @@ func (x *HeadRequest_Body) String() string { func (*HeadRequest_Body) ProtoMessage() {} func (x *HeadRequest_Body) ProtoReflect() protoreflect.Message { - mi := &file_v2_object_grpc_service_proto_msgTypes[24] + mi := &file_object_grpc_service_proto_msgTypes[24] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1706,7 +1706,7 @@ func (x *HeadRequest_Body) ProtoReflect() protoreflect.Message { // Deprecated: Use HeadRequest_Body.ProtoReflect.Descriptor instead. func (*HeadRequest_Body) Descriptor() ([]byte, []int) { - return file_v2_object_grpc_service_proto_rawDescGZIP(), []int{6, 0} + return file_object_grpc_service_proto_rawDescGZIP(), []int{6, 0} } func (x *HeadRequest_Body) GetAddress() *grpc1.Address { @@ -1749,7 +1749,7 @@ type HeadResponse_Body struct { func (x *HeadResponse_Body) Reset() { *x = HeadResponse_Body{} if protoimpl.UnsafeEnabled { - mi := &file_v2_object_grpc_service_proto_msgTypes[25] + mi := &file_object_grpc_service_proto_msgTypes[25] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1762,7 +1762,7 @@ func (x *HeadResponse_Body) String() string { func (*HeadResponse_Body) ProtoMessage() {} func (x *HeadResponse_Body) ProtoReflect() protoreflect.Message { - mi := &file_v2_object_grpc_service_proto_msgTypes[25] + mi := &file_object_grpc_service_proto_msgTypes[25] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1775,7 +1775,7 @@ func (x *HeadResponse_Body) ProtoReflect() protoreflect.Message { // Deprecated: Use HeadResponse_Body.ProtoReflect.Descriptor instead. func (*HeadResponse_Body) Descriptor() ([]byte, []int) { - return file_v2_object_grpc_service_proto_rawDescGZIP(), []int{8, 0} + return file_object_grpc_service_proto_rawDescGZIP(), []int{8, 0} } func (m *HeadResponse_Body) GetHead() isHeadResponse_Body_Head { @@ -1848,7 +1848,7 @@ type SearchRequest_Body struct { func (x *SearchRequest_Body) Reset() { *x = SearchRequest_Body{} if protoimpl.UnsafeEnabled { - mi := &file_v2_object_grpc_service_proto_msgTypes[26] + mi := &file_object_grpc_service_proto_msgTypes[26] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1861,7 +1861,7 @@ func (x *SearchRequest_Body) String() string { func (*SearchRequest_Body) ProtoMessage() {} func (x *SearchRequest_Body) ProtoReflect() protoreflect.Message { - mi := &file_v2_object_grpc_service_proto_msgTypes[26] + mi := &file_object_grpc_service_proto_msgTypes[26] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1874,7 +1874,7 @@ func (x *SearchRequest_Body) ProtoReflect() protoreflect.Message { // Deprecated: Use SearchRequest_Body.ProtoReflect.Descriptor instead. func (*SearchRequest_Body) Descriptor() ([]byte, []int) { - return file_v2_object_grpc_service_proto_rawDescGZIP(), []int{9, 0} + return file_object_grpc_service_proto_rawDescGZIP(), []int{9, 0} } func (x *SearchRequest_Body) GetContainerId() *grpc1.ContainerID { @@ -1968,7 +1968,7 @@ type SearchRequest_Body_Filter struct { func (x *SearchRequest_Body_Filter) Reset() { *x = SearchRequest_Body_Filter{} if protoimpl.UnsafeEnabled { - mi := &file_v2_object_grpc_service_proto_msgTypes[27] + mi := &file_object_grpc_service_proto_msgTypes[27] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1981,7 +1981,7 @@ func (x *SearchRequest_Body_Filter) String() string { func (*SearchRequest_Body_Filter) ProtoMessage() {} func (x *SearchRequest_Body_Filter) ProtoReflect() protoreflect.Message { - mi := &file_v2_object_grpc_service_proto_msgTypes[27] + mi := &file_object_grpc_service_proto_msgTypes[27] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1994,7 +1994,7 @@ func (x *SearchRequest_Body_Filter) ProtoReflect() protoreflect.Message { // Deprecated: Use SearchRequest_Body_Filter.ProtoReflect.Descriptor instead. func (*SearchRequest_Body_Filter) Descriptor() ([]byte, []int) { - return file_v2_object_grpc_service_proto_rawDescGZIP(), []int{9, 0, 0} + return file_object_grpc_service_proto_rawDescGZIP(), []int{9, 0, 0} } func (x *SearchRequest_Body_Filter) GetMatchType() MatchType { @@ -2031,7 +2031,7 @@ type SearchResponse_Body struct { func (x *SearchResponse_Body) Reset() { *x = SearchResponse_Body{} if protoimpl.UnsafeEnabled { - mi := &file_v2_object_grpc_service_proto_msgTypes[28] + mi := &file_object_grpc_service_proto_msgTypes[28] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2044,7 +2044,7 @@ func (x *SearchResponse_Body) String() string { func (*SearchResponse_Body) ProtoMessage() {} func (x *SearchResponse_Body) ProtoReflect() protoreflect.Message { - mi := &file_v2_object_grpc_service_proto_msgTypes[28] + mi := &file_object_grpc_service_proto_msgTypes[28] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2057,7 +2057,7 @@ func (x *SearchResponse_Body) ProtoReflect() protoreflect.Message { // Deprecated: Use SearchResponse_Body.ProtoReflect.Descriptor instead. func (*SearchResponse_Body) Descriptor() ([]byte, []int) { - return file_v2_object_grpc_service_proto_rawDescGZIP(), []int{10, 0} + return file_object_grpc_service_proto_rawDescGZIP(), []int{10, 0} } func (x *SearchResponse_Body) GetIdList() []*grpc1.ObjectID { @@ -2085,7 +2085,7 @@ type GetRangeRequest_Body struct { func (x *GetRangeRequest_Body) Reset() { *x = GetRangeRequest_Body{} if protoimpl.UnsafeEnabled { - mi := &file_v2_object_grpc_service_proto_msgTypes[29] + mi := &file_object_grpc_service_proto_msgTypes[29] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2098,7 +2098,7 @@ func (x *GetRangeRequest_Body) String() string { func (*GetRangeRequest_Body) ProtoMessage() {} func (x *GetRangeRequest_Body) ProtoReflect() protoreflect.Message { - mi := &file_v2_object_grpc_service_proto_msgTypes[29] + mi := &file_object_grpc_service_proto_msgTypes[29] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2111,7 +2111,7 @@ func (x *GetRangeRequest_Body) ProtoReflect() protoreflect.Message { // Deprecated: Use GetRangeRequest_Body.ProtoReflect.Descriptor instead. func (*GetRangeRequest_Body) Descriptor() ([]byte, []int) { - return file_v2_object_grpc_service_proto_rawDescGZIP(), []int{12, 0} + return file_object_grpc_service_proto_rawDescGZIP(), []int{12, 0} } func (x *GetRangeRequest_Body) GetAddress() *grpc1.Address { @@ -2155,7 +2155,7 @@ type GetRangeResponse_Body struct { func (x *GetRangeResponse_Body) Reset() { *x = GetRangeResponse_Body{} if protoimpl.UnsafeEnabled { - mi := &file_v2_object_grpc_service_proto_msgTypes[30] + mi := &file_object_grpc_service_proto_msgTypes[30] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2168,7 +2168,7 @@ func (x *GetRangeResponse_Body) String() string { func (*GetRangeResponse_Body) ProtoMessage() {} func (x *GetRangeResponse_Body) ProtoReflect() protoreflect.Message { - mi := &file_v2_object_grpc_service_proto_msgTypes[30] + mi := &file_object_grpc_service_proto_msgTypes[30] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2181,7 +2181,7 @@ func (x *GetRangeResponse_Body) ProtoReflect() protoreflect.Message { // Deprecated: Use GetRangeResponse_Body.ProtoReflect.Descriptor instead. func (*GetRangeResponse_Body) Descriptor() ([]byte, []int) { - return file_v2_object_grpc_service_proto_rawDescGZIP(), []int{13, 0} + return file_object_grpc_service_proto_rawDescGZIP(), []int{13, 0} } func (m *GetRangeResponse_Body) GetRangePart() isGetRangeResponse_Body_RangePart { @@ -2242,7 +2242,7 @@ type GetRangeHashRequest_Body struct { func (x *GetRangeHashRequest_Body) Reset() { *x = GetRangeHashRequest_Body{} if protoimpl.UnsafeEnabled { - mi := &file_v2_object_grpc_service_proto_msgTypes[31] + mi := &file_object_grpc_service_proto_msgTypes[31] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2255,7 +2255,7 @@ func (x *GetRangeHashRequest_Body) String() string { func (*GetRangeHashRequest_Body) ProtoMessage() {} func (x *GetRangeHashRequest_Body) ProtoReflect() protoreflect.Message { - mi := &file_v2_object_grpc_service_proto_msgTypes[31] + mi := &file_object_grpc_service_proto_msgTypes[31] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2268,7 +2268,7 @@ func (x *GetRangeHashRequest_Body) ProtoReflect() protoreflect.Message { // Deprecated: Use GetRangeHashRequest_Body.ProtoReflect.Descriptor instead. func (*GetRangeHashRequest_Body) Descriptor() ([]byte, []int) { - return file_v2_object_grpc_service_proto_rawDescGZIP(), []int{14, 0} + return file_object_grpc_service_proto_rawDescGZIP(), []int{14, 0} } func (x *GetRangeHashRequest_Body) GetAddress() *grpc1.Address { @@ -2314,7 +2314,7 @@ type GetRangeHashResponse_Body struct { func (x *GetRangeHashResponse_Body) Reset() { *x = GetRangeHashResponse_Body{} if protoimpl.UnsafeEnabled { - mi := &file_v2_object_grpc_service_proto_msgTypes[32] + mi := &file_object_grpc_service_proto_msgTypes[32] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2327,7 +2327,7 @@ func (x *GetRangeHashResponse_Body) String() string { func (*GetRangeHashResponse_Body) ProtoMessage() {} func (x *GetRangeHashResponse_Body) ProtoReflect() protoreflect.Message { - mi := &file_v2_object_grpc_service_proto_msgTypes[32] + mi := &file_object_grpc_service_proto_msgTypes[32] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2340,7 +2340,7 @@ func (x *GetRangeHashResponse_Body) ProtoReflect() protoreflect.Message { // Deprecated: Use GetRangeHashResponse_Body.ProtoReflect.Descriptor instead. func (*GetRangeHashResponse_Body) Descriptor() ([]byte, []int) { - return file_v2_object_grpc_service_proto_rawDescGZIP(), []int{15, 0} + return file_object_grpc_service_proto_rawDescGZIP(), []int{15, 0} } func (x *GetRangeHashResponse_Body) GetType() grpc1.ChecksumType { @@ -2357,146 +2357,39 @@ func (x *GetRangeHashResponse_Body) GetHashList() [][]byte { return nil } -var File_v2_object_grpc_service_proto protoreflect.FileDescriptor +var File_object_grpc_service_proto protoreflect.FileDescriptor -var file_v2_object_grpc_service_proto_rawDesc = []byte{ - 0x0a, 0x1c, 0x76, 0x32, 0x2f, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2f, 0x67, 0x72, 0x70, 0x63, - 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x10, - 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, - 0x1a, 0x1a, 0x76, 0x32, 0x2f, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2f, 0x67, 0x72, 0x70, 0x63, - 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x18, 0x76, 0x32, - 0x2f, 0x72, 0x65, 0x66, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x76, 0x32, 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, 0xaa, 0x02, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x12, 0x35, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x21, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, - 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 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, 0x4b, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x31, 0x0a, 0x07, 0x61, - 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6e, - 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x41, 0x64, - 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x10, - 0x0a, 0x03, 0x72, 0x61, 0x77, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x03, 0x72, 0x61, 0x77, - 0x22, 0xb9, 0x04, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x12, 0x36, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, - 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, - 0x74, 0x2e, 0x47, 0x65, 0x74, 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, 0xd5, 0x02, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x3d, 0x0a, - 0x04, 0x69, 0x6e, 0x69, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x6e, 0x65, - 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, - 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x2e, - 0x49, 0x6e, 0x69, 0x74, 0x48, 0x00, 0x52, 0x04, 0x69, 0x6e, 0x69, 0x74, 0x12, 0x16, 0x0a, 0x05, - 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, 0x05, 0x63, - 0x68, 0x75, 0x6e, 0x6b, 0x12, 0x3c, 0x0a, 0x0a, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x5f, 0x69, 0x6e, - 0x66, 0x6f, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, - 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x53, 0x70, 0x6c, 0x69, - 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x48, 0x00, 0x52, 0x09, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x49, 0x6e, - 0x66, 0x6f, 0x1a, 0xa8, 0x01, 0x0a, 0x04, 0x49, 0x6e, 0x69, 0x74, 0x12, 0x35, 0x0a, 0x09, 0x6f, - 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 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, 0x08, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, - 0x49, 0x64, 0x12, 0x37, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, - 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, - 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x30, 0x0a, 0x06, 0x68, - 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, - 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x48, - 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x42, 0x0d, 0x0a, - 0x0b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x70, 0x61, 0x72, 0x74, 0x22, 0x9b, 0x04, 0x0a, - 0x0a, 0x50, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x35, 0x0a, 0x04, 0x62, - 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, - 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x50, 0x75, 0x74, - 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, 0xbb, 0x02, 0x0a, - 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x3c, 0x0a, 0x04, 0x69, 0x6e, 0x69, 0x74, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, - 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x50, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x2e, 0x49, 0x6e, 0x69, 0x74, 0x48, 0x00, 0x52, 0x04, 0x69, - 0x6e, 0x69, 0x74, 0x12, 0x16, 0x0a, 0x05, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0c, 0x48, 0x00, 0x52, 0x05, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x1a, 0xcd, 0x01, 0x0a, 0x04, - 0x49, 0x6e, 0x69, 0x74, 0x12, 0x35, 0x0a, 0x09, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x69, - 0x64, 0x18, 0x01, 0x20, 0x01, 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, 0x08, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x64, 0x12, 0x37, 0x0a, 0x09, 0x73, - 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, - 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, - 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, - 0x74, 0x75, 0x72, 0x65, 0x12, 0x30, 0x0a, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, - 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x06, - 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x23, 0x0a, 0x0d, 0x63, 0x6f, 0x70, 0x69, 0x65, 0x73, - 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0c, 0x63, - 0x6f, 0x70, 0x69, 0x65, 0x73, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x42, 0x0d, 0x0a, 0x0b, 0x6f, - 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x70, 0x61, 0x72, 0x74, 0x22, 0xa0, 0x02, 0x0a, 0x0b, 0x50, - 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x36, 0x0a, 0x04, 0x62, 0x6f, - 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, - 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x50, 0x75, 0x74, 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, 0x3d, - 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x35, 0x0a, 0x09, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, - 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 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, 0x08, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x64, 0x22, 0x9e, 0x02, - 0x0a, 0x0d, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, - 0x38, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, - 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, - 0x2e, 0x44, 0x65, 0x6c, 0x65, 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, 0x39, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x31, 0x0a, 0x07, 0x61, - 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6e, - 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x41, 0x64, - 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0xa6, - 0x02, 0x0a, 0x0e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 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, 0x6f, 0x62, 0x6a, 0x65, - 0x63, 0x74, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, +var file_object_grpc_service_proto_rawDesc = []byte{ + 0x0a, 0x19, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x73, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x10, 0x6e, 0x65, 0x6f, + 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x1a, 0x17, 0x6f, + 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x15, 0x72, 0x65, 0x66, 0x73, 0x2f, 0x67, 0x72, 0x70, + 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x18, 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, 0xaa, 0x02, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x35, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 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, 0x4b, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, + 0x31, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x17, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, + 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, + 0x73, 0x73, 0x12, 0x10, 0x0a, 0x03, 0x72, 0x61, 0x77, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, + 0x03, 0x72, 0x61, 0x77, 0x22, 0xb9, 0x04, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x36, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, + 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 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, @@ -2507,43 +2400,102 @@ var file_v2_object_grpc_service_proto_rawDesc = []byte{ 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, 0x3d, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, - 0x12, 0x35, 0x0a, 0x09, 0x74, 0x6f, 0x6d, 0x62, 0x73, 0x74, 0x6f, 0x6e, 0x65, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, - 0x72, 0x65, 0x66, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x09, 0x74, 0x6f, - 0x6d, 0x62, 0x73, 0x74, 0x6f, 0x6e, 0x65, 0x22, 0xc9, 0x02, 0x0a, 0x0b, 0x48, 0x65, 0x61, 0x64, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x36, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, - 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 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, + 0x66, 0x79, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x1a, 0xd5, 0x02, 0x0a, 0x04, 0x42, 0x6f, 0x64, + 0x79, 0x12, 0x3d, 0x0a, 0x04, 0x69, 0x6e, 0x69, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x27, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, + 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x42, + 0x6f, 0x64, 0x79, 0x2e, 0x49, 0x6e, 0x69, 0x74, 0x48, 0x00, 0x52, 0x04, 0x69, 0x6e, 0x69, 0x74, + 0x12, 0x16, 0x0a, 0x05, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x48, + 0x00, 0x52, 0x05, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x12, 0x3c, 0x0a, 0x0a, 0x73, 0x70, 0x6c, 0x69, + 0x74, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, + 0x53, 0x70, 0x6c, 0x69, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x48, 0x00, 0x52, 0x09, 0x73, 0x70, 0x6c, + 0x69, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x1a, 0xa8, 0x01, 0x0a, 0x04, 0x49, 0x6e, 0x69, 0x74, 0x12, + 0x35, 0x0a, 0x09, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, + 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, 0x08, 0x6f, 0x62, + 0x6a, 0x65, 0x63, 0x74, 0x49, 0x64, 0x12, 0x37, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, + 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, + 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, + 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, + 0x30, 0x0a, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, + 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, + 0x72, 0x42, 0x0d, 0x0a, 0x0b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x70, 0x61, 0x72, 0x74, + 0x22, 0x9b, 0x04, 0x0a, 0x0a, 0x50, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x35, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, + 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, + 0x2e, 0x50, 0x75, 0x74, 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, - 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, 0x68, 0x0a, 0x04, 0x42, 0x6f, 0x64, - 0x79, 0x12, 0x31, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, - 0x65, 0x66, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x07, 0x61, 0x64, 0x64, - 0x72, 0x65, 0x73, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x61, 0x69, 0x6e, 0x5f, 0x6f, 0x6e, 0x6c, - 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x6d, 0x61, 0x69, 0x6e, 0x4f, 0x6e, 0x6c, - 0x79, 0x12, 0x10, 0x0a, 0x03, 0x72, 0x61, 0x77, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x03, - 0x72, 0x61, 0x77, 0x22, 0x80, 0x01, 0x0a, 0x13, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x57, 0x69, - 0x74, 0x68, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x30, 0x0a, 0x06, 0x68, - 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, - 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x48, - 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x37, 0x0a, - 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, - 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, - 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x22, 0xb7, 0x03, 0x0a, 0x0c, 0x48, 0x65, 0x61, 0x64, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x37, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, - 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x52, 0x65, 0x73, + 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, 0xbb, 0x02, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x3c, 0x0a, 0x04, 0x69, 0x6e, 0x69, + 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, + 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x50, 0x75, 0x74, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x2e, 0x49, 0x6e, 0x69, 0x74, 0x48, + 0x00, 0x52, 0x04, 0x69, 0x6e, 0x69, 0x74, 0x12, 0x16, 0x0a, 0x05, 0x63, 0x68, 0x75, 0x6e, 0x6b, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, 0x05, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x1a, + 0xcd, 0x01, 0x0a, 0x04, 0x49, 0x6e, 0x69, 0x74, 0x12, 0x35, 0x0a, 0x09, 0x6f, 0x62, 0x6a, 0x65, + 0x63, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 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, 0x08, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x64, 0x12, + 0x37, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, + 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, + 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x30, 0x0a, 0x06, 0x68, 0x65, 0x61, 0x64, + 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, + 0x65, 0x72, 0x52, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x23, 0x0a, 0x0d, 0x63, 0x6f, + 0x70, 0x69, 0x65, 0x73, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x0d, 0x52, 0x0c, 0x63, 0x6f, 0x70, 0x69, 0x65, 0x73, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x42, + 0x0d, 0x0a, 0x0b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x70, 0x61, 0x72, 0x74, 0x22, 0xa0, + 0x02, 0x0a, 0x0b, 0x50, 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x36, + 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, + 0x50, 0x75, 0x74, 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, 0x3d, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x35, 0x0a, 0x09, 0x6f, 0x62, + 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 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, 0x08, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x49, + 0x64, 0x22, 0x9e, 0x02, 0x0a, 0x0d, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x12, 0x38, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x24, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, + 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x44, 0x65, 0x6c, 0x65, 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, 0x39, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, + 0x31, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x17, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, + 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, + 0x73, 0x73, 0x22, 0xa6, 0x02, 0x0a, 0x0e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 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, + 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x44, 0x65, 0x6c, 0x65, 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, @@ -2554,101 +2506,44 @@ var file_v2_object_grpc_service_proto_rawDesc = []byte{ 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, 0xd1, 0x01, 0x0a, - 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x3f, 0x0a, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, - 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x57, - 0x69, 0x74, 0x68, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x48, 0x00, 0x52, 0x06, - 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x42, 0x0a, 0x0c, 0x73, 0x68, 0x6f, 0x72, 0x74, 0x5f, - 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x6e, - 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, - 0x53, 0x68, 0x6f, 0x72, 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x48, 0x00, 0x52, 0x0b, 0x73, - 0x68, 0x6f, 0x72, 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x3c, 0x0a, 0x0a, 0x73, 0x70, - 0x6c, 0x69, 0x74, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, - 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, - 0x74, 0x2e, 0x53, 0x70, 0x6c, 0x69, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x48, 0x00, 0x52, 0x09, 0x73, - 0x70, 0x6c, 0x69, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x42, 0x06, 0x0a, 0x04, 0x68, 0x65, 0x61, 0x64, - 0x22, 0xfb, 0x03, 0x0a, 0x0d, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x12, 0x38, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x24, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, - 0x65, 0x63, 0x74, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 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, 0x95, 0x02, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, - 0x3e, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, - 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, - 0x49, 0x44, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x64, 0x12, - 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, - 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x45, 0x0a, 0x07, 0x66, 0x69, 0x6c, - 0x74, 0x65, 0x72, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x6e, 0x65, 0x6f, - 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x53, 0x65, - 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x42, 0x6f, 0x64, 0x79, - 0x2e, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x07, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x73, - 0x1a, 0x6c, 0x0a, 0x06, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x3a, 0x0a, 0x0a, 0x6d, 0x61, - 0x74, 0x63, 0x68, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1b, - 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, - 0x74, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x54, 0x79, 0x70, 0x65, 0x52, 0x09, 0x6d, 0x61, 0x74, - 0x63, 0x68, 0x54, 0x79, 0x70, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xa2, - 0x02, 0x0a, 0x0e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 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, 0x6f, 0x62, 0x6a, 0x65, - 0x63, 0x74, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 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, 0x39, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, - 0x12, 0x31, 0x0a, 0x07, 0x69, 0x64, 0x5f, 0x6c, 0x69, 0x73, 0x74, 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, 0x06, 0x69, 0x64, 0x4c, - 0x69, 0x73, 0x74, 0x22, 0x37, 0x0a, 0x05, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x16, 0x0a, 0x06, - 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x6f, 0x66, - 0x66, 0x73, 0x65, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xe3, 0x02, 0x0a, - 0x0f, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 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, 0x6f, 0x62, 0x6a, 0x65, 0x63, - 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 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, 0x7a, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x31, - 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x17, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, - 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, - 0x73, 0x12, 0x2d, 0x0a, 0x05, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x17, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, - 0x65, 0x63, 0x74, 0x2e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x05, 0x72, 0x61, 0x6e, 0x67, 0x65, - 0x12, 0x10, 0x0a, 0x03, 0x72, 0x61, 0x77, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x03, 0x72, - 0x61, 0x77, 0x22, 0xd7, 0x02, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3b, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, - 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, - 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, + 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x1a, 0x3d, 0x0a, 0x04, + 0x42, 0x6f, 0x64, 0x79, 0x12, 0x35, 0x0a, 0x09, 0x74, 0x6f, 0x6d, 0x62, 0x73, 0x74, 0x6f, 0x6e, + 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, + 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, + 0x52, 0x09, 0x74, 0x6f, 0x6d, 0x62, 0x73, 0x74, 0x6f, 0x6e, 0x65, 0x22, 0xc9, 0x02, 0x0a, 0x0b, + 0x48, 0x65, 0x61, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x36, 0x0a, 0x04, 0x62, + 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, + 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, + 0x64, 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, 0x68, 0x0a, + 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x31, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, + 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, + 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x61, 0x69, 0x6e, + 0x5f, 0x6f, 0x6e, 0x6c, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x6d, 0x61, 0x69, + 0x6e, 0x4f, 0x6e, 0x6c, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x72, 0x61, 0x77, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x08, 0x52, 0x03, 0x72, 0x61, 0x77, 0x22, 0x80, 0x01, 0x0a, 0x13, 0x48, 0x65, 0x61, 0x64, + 0x65, 0x72, 0x57, 0x69, 0x74, 0x68, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, + 0x30, 0x0a, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, + 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, + 0x72, 0x12, 0x37, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, + 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x22, 0xb7, 0x03, 0x0a, 0x0c, 0x48, + 0x65, 0x61, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x37, 0x0a, 0x04, 0x62, + 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, + 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, + 0x64, 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, @@ -2659,118 +2554,222 @@ var file_v2_object_grpc_service_proto_rawDesc = []byte{ 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, 0x6a, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x16, 0x0a, 0x05, 0x63, 0x68, 0x75, 0x6e, - 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, 0x05, 0x63, 0x68, 0x75, 0x6e, 0x6b, - 0x12, 0x3c, 0x0a, 0x0a, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, - 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x53, 0x70, 0x6c, 0x69, 0x74, 0x49, 0x6e, 0x66, - 0x6f, 0x48, 0x00, 0x52, 0x09, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x42, 0x0c, - 0x0a, 0x0a, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x5f, 0x70, 0x61, 0x72, 0x74, 0x22, 0xa2, 0x03, 0x0a, - 0x13, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x48, 0x61, 0x73, 0x68, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 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, 0x6f, - 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x48, 0x61, - 0x73, 0x68, 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, 0xb0, - 0x01, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x31, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, - 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, - 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, - 0x73, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x2f, 0x0a, 0x06, 0x72, 0x61, - 0x6e, 0x67, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6e, 0x65, 0x6f, - 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x52, 0x61, - 0x6e, 0x67, 0x65, 0x52, 0x06, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x73, - 0x61, 0x6c, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x73, 0x61, 0x6c, 0x74, 0x12, - 0x30, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1c, 0x2e, - 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, - 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, - 0x65, 0x22, 0xca, 0x02, 0x0a, 0x14, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x48, 0x61, - 0x73, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3f, 0x0a, 0x04, 0x62, 0x6f, - 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, - 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, - 0x61, 0x6e, 0x67, 0x65, 0x48, 0x61, 0x73, 0x68, 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, 0x55, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, - 0x30, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1c, 0x2e, - 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, - 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, - 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x68, 0x61, 0x73, 0x68, 0x5f, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x02, - 0x20, 0x03, 0x28, 0x0c, 0x52, 0x08, 0x68, 0x61, 0x73, 0x68, 0x4c, 0x69, 0x73, 0x74, 0x32, 0xb2, - 0x04, 0x0a, 0x0d, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, - 0x12, 0x44, 0x0a, 0x03, 0x47, 0x65, 0x74, 0x12, 0x1c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, - 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, - 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x30, 0x01, 0x12, 0x44, 0x0a, 0x03, 0x50, 0x75, 0x74, 0x12, 0x1c, 0x2e, - 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, - 0x2e, 0x50, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x6e, 0x65, - 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x50, - 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x28, 0x01, 0x12, 0x4b, 0x0a, 0x06, - 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x12, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, - 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, - 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, - 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x45, 0x0a, 0x04, 0x48, 0x65, 0x61, - 0x64, 0x12, 0x1d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, - 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x1e, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, - 0x65, 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x12, 0x4d, 0x0a, 0x06, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x12, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, - 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x53, 0x65, - 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x6e, 0x65, - 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x53, - 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x30, 0x01, 0x12, - 0x53, 0x0a, 0x08, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x21, 0x2e, 0x6e, 0x65, - 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, - 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x22, + 0x1a, 0xd1, 0x01, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x3f, 0x0a, 0x06, 0x68, 0x65, 0x61, + 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, + 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, + 0x64, 0x65, 0x72, 0x57, 0x69, 0x74, 0x68, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, + 0x48, 0x00, 0x52, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x42, 0x0a, 0x0c, 0x73, 0x68, + 0x6f, 0x72, 0x74, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x1d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, + 0x65, 0x63, 0x74, 0x2e, 0x53, 0x68, 0x6f, 0x72, 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x48, + 0x00, 0x52, 0x0b, 0x73, 0x68, 0x6f, 0x72, 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x3c, + 0x0a, 0x0a, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, + 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x53, 0x70, 0x6c, 0x69, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x48, + 0x00, 0x52, 0x09, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x42, 0x06, 0x0a, 0x04, + 0x68, 0x65, 0x61, 0x64, 0x22, 0xfb, 0x03, 0x0a, 0x0d, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x38, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 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, 0x95, 0x02, 0x0a, 0x04, 0x42, + 0x6f, 0x64, 0x79, 0x12, 0x3e, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, + 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, + 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, + 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, + 0x72, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x45, 0x0a, + 0x07, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, - 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x30, 0x01, 0x12, 0x5d, 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, - 0x48, 0x61, 0x73, 0x68, 0x12, 0x25, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, - 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, - 0x48, 0x61, 0x73, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x26, 0x2e, 0x6e, 0x65, + 0x74, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, + 0x42, 0x6f, 0x64, 0x79, 0x2e, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x07, 0x66, 0x69, 0x6c, + 0x74, 0x65, 0x72, 0x73, 0x1a, 0x6c, 0x0a, 0x06, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x3a, + 0x0a, 0x0a, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0e, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, + 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x54, 0x79, 0x70, 0x65, 0x52, + 0x09, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x54, 0x79, 0x70, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, + 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x22, 0xa2, 0x02, 0x0a, 0x0e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 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, + 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 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, 0x39, 0x0a, 0x04, + 0x42, 0x6f, 0x64, 0x79, 0x12, 0x31, 0x0a, 0x07, 0x69, 0x64, 0x5f, 0x6c, 0x69, 0x73, 0x74, 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, + 0x06, 0x69, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x22, 0x37, 0x0a, 0x05, 0x52, 0x61, 0x6e, 0x67, 0x65, + 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, + 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, + 0x74, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, + 0x22, 0xe3, 0x02, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 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, 0x6f, + 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 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, 0x7a, 0x0a, 0x04, 0x42, 0x6f, + 0x64, 0x79, 0x12, 0x31, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, + 0x72, 0x65, 0x66, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x07, 0x61, 0x64, + 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x2d, 0x0a, 0x05, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x05, 0x72, + 0x61, 0x6e, 0x67, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x72, 0x61, 0x77, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x08, 0x52, 0x03, 0x72, 0x61, 0x77, 0x22, 0xd7, 0x02, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x52, 0x61, + 0x6e, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3b, 0x0a, 0x04, 0x62, + 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, + 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, + 0x52, 0x61, 0x6e, 0x67, 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, 0x6a, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x16, 0x0a, 0x05, + 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, 0x05, 0x63, + 0x68, 0x75, 0x6e, 0x6b, 0x12, 0x3c, 0x0a, 0x0a, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x5f, 0x69, 0x6e, + 0x66, 0x6f, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x53, 0x70, 0x6c, 0x69, + 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x48, 0x00, 0x52, 0x09, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x49, 0x6e, + 0x66, 0x6f, 0x42, 0x0c, 0x0a, 0x0a, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x5f, 0x70, 0x61, 0x72, 0x74, + 0x22, 0xa2, 0x03, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x48, 0x61, 0x73, + 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 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, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, + 0x67, 0x65, 0x48, 0x61, 0x73, 0x68, 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, 0xb0, 0x01, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x31, 0x0a, 0x07, 0x61, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x41, 0x64, + 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x2f, + 0x0a, 0x06, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, + 0x74, 0x2e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x06, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x73, 0x12, + 0x12, 0x0a, 0x04, 0x73, 0x61, 0x6c, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x73, + 0x61, 0x6c, 0x74, 0x12, 0x30, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x0e, 0x32, 0x1c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, + 0x66, 0x73, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x52, + 0x04, 0x74, 0x79, 0x70, 0x65, 0x22, 0xca, 0x02, 0x0a, 0x14, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, + 0x67, 0x65, 0x48, 0x61, 0x73, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3f, + 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, + 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x48, 0x61, 0x73, 0x68, 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, 0x55, 0x0a, 0x04, 0x42, + 0x6f, 0x64, 0x79, 0x12, 0x30, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0e, 0x32, 0x1c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, + 0x66, 0x73, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x52, + 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x68, 0x61, 0x73, 0x68, 0x5f, 0x6c, 0x69, + 0x73, 0x74, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x08, 0x68, 0x61, 0x73, 0x68, 0x4c, 0x69, + 0x73, 0x74, 0x32, 0xb2, 0x04, 0x0a, 0x0d, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x53, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x12, 0x44, 0x0a, 0x03, 0x47, 0x65, 0x74, 0x12, 0x1c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, - 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x48, 0x61, 0x73, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x42, 0x56, 0x5a, 0x37, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, - 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, - 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x6f, 0x62, 0x6a, 0x65, - 0x63, 0x74, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0xaa, 0x02, - 0x1a, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, - 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, + 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, + 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x30, 0x01, 0x12, 0x44, 0x0a, 0x03, 0x50, 0x75, + 0x74, 0x12, 0x1c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, + 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x50, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x1d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, + 0x63, 0x74, 0x2e, 0x50, 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x28, 0x01, + 0x12, 0x4b, 0x0a, 0x06, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x12, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, + 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x44, 0x65, + 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x6e, 0x65, + 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x44, + 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x45, 0x0a, + 0x04, 0x48, 0x65, 0x61, 0x64, 0x12, 0x1d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4d, 0x0a, 0x06, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x12, 0x1f, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, + 0x74, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, + 0x63, 0x74, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x30, 0x01, 0x12, 0x53, 0x0a, 0x08, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, + 0x21, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, + 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x22, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, + 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x30, 0x01, 0x12, 0x5d, 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x52, + 0x61, 0x6e, 0x67, 0x65, 0x48, 0x61, 0x73, 0x68, 0x12, 0x25, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, + 0x61, 0x6e, 0x67, 0x65, 0x48, 0x61, 0x73, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x26, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, + 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x48, 0x61, 0x73, 0x68, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x56, 0x5a, 0x37, 0x67, 0x69, 0x74, 0x68, 0x75, + 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, + 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, + 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x6f, 0x62, 0x6a, 0x65, + 0x63, 0x74, 0xaa, 0x02, 0x1a, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, + 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( - file_v2_object_grpc_service_proto_rawDescOnce sync.Once - file_v2_object_grpc_service_proto_rawDescData = file_v2_object_grpc_service_proto_rawDesc + file_object_grpc_service_proto_rawDescOnce sync.Once + file_object_grpc_service_proto_rawDescData = file_object_grpc_service_proto_rawDesc ) -func file_v2_object_grpc_service_proto_rawDescGZIP() []byte { - file_v2_object_grpc_service_proto_rawDescOnce.Do(func() { - file_v2_object_grpc_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_v2_object_grpc_service_proto_rawDescData) +func file_object_grpc_service_proto_rawDescGZIP() []byte { + file_object_grpc_service_proto_rawDescOnce.Do(func() { + file_object_grpc_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_object_grpc_service_proto_rawDescData) }) - return file_v2_object_grpc_service_proto_rawDescData + return file_object_grpc_service_proto_rawDescData } -var file_v2_object_grpc_service_proto_msgTypes = make([]protoimpl.MessageInfo, 33) -var file_v2_object_grpc_service_proto_goTypes = []interface{}{ +var file_object_grpc_service_proto_msgTypes = make([]protoimpl.MessageInfo, 33) +var file_object_grpc_service_proto_goTypes = []interface{}{ (*GetRequest)(nil), // 0: neo.fs.v2.object.GetRequest (*GetResponse)(nil), // 1: neo.fs.v2.object.GetResponse (*PutRequest)(nil), // 2: neo.fs.v2.object.PutRequest @@ -2818,7 +2817,7 @@ var file_v2_object_grpc_service_proto_goTypes = []interface{}{ (MatchType)(0), // 44: neo.fs.v2.object.MatchType (grpc1.ChecksumType)(0), // 45: neo.fs.v2.refs.ChecksumType } -var file_v2_object_grpc_service_proto_depIdxs = []int32{ +var file_object_grpc_service_proto_depIdxs = []int32{ 16, // 0: neo.fs.v2.object.GetRequest.body:type_name -> neo.fs.v2.object.GetRequest.Body 33, // 1: neo.fs.v2.object.GetRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader 34, // 2: neo.fs.v2.object.GetRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader @@ -2912,14 +2911,14 @@ var file_v2_object_grpc_service_proto_depIdxs = []int32{ 0, // [0:72] is the sub-list for field type_name } -func init() { file_v2_object_grpc_service_proto_init() } -func file_v2_object_grpc_service_proto_init() { - if File_v2_object_grpc_service_proto != nil { +func init() { file_object_grpc_service_proto_init() } +func file_object_grpc_service_proto_init() { + if File_object_grpc_service_proto != nil { return } - file_v2_object_grpc_types_proto_init() + file_object_grpc_types_proto_init() if !protoimpl.UnsafeEnabled { - file_v2_object_grpc_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_object_grpc_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GetRequest); i { case 0: return &v.state @@ -2931,7 +2930,7 @@ func file_v2_object_grpc_service_proto_init() { return nil } } - file_v2_object_grpc_service_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_object_grpc_service_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GetResponse); i { case 0: return &v.state @@ -2943,7 +2942,7 @@ func file_v2_object_grpc_service_proto_init() { return nil } } - file_v2_object_grpc_service_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + file_object_grpc_service_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PutRequest); i { case 0: return &v.state @@ -2955,7 +2954,7 @@ func file_v2_object_grpc_service_proto_init() { return nil } } - file_v2_object_grpc_service_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + file_object_grpc_service_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PutResponse); i { case 0: return &v.state @@ -2967,7 +2966,7 @@ func file_v2_object_grpc_service_proto_init() { return nil } } - file_v2_object_grpc_service_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + file_object_grpc_service_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*DeleteRequest); i { case 0: return &v.state @@ -2979,7 +2978,7 @@ func file_v2_object_grpc_service_proto_init() { return nil } } - file_v2_object_grpc_service_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + file_object_grpc_service_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*DeleteResponse); i { case 0: return &v.state @@ -2991,7 +2990,7 @@ func file_v2_object_grpc_service_proto_init() { return nil } } - file_v2_object_grpc_service_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + file_object_grpc_service_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*HeadRequest); i { case 0: return &v.state @@ -3003,7 +3002,7 @@ func file_v2_object_grpc_service_proto_init() { return nil } } - file_v2_object_grpc_service_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + file_object_grpc_service_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*HeaderWithSignature); i { case 0: return &v.state @@ -3015,7 +3014,7 @@ func file_v2_object_grpc_service_proto_init() { return nil } } - file_v2_object_grpc_service_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + file_object_grpc_service_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*HeadResponse); i { case 0: return &v.state @@ -3027,7 +3026,7 @@ func file_v2_object_grpc_service_proto_init() { return nil } } - file_v2_object_grpc_service_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + file_object_grpc_service_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*SearchRequest); i { case 0: return &v.state @@ -3039,7 +3038,7 @@ func file_v2_object_grpc_service_proto_init() { return nil } } - file_v2_object_grpc_service_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + file_object_grpc_service_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*SearchResponse); i { case 0: return &v.state @@ -3051,7 +3050,7 @@ func file_v2_object_grpc_service_proto_init() { return nil } } - file_v2_object_grpc_service_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + file_object_grpc_service_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Range); i { case 0: return &v.state @@ -3063,7 +3062,7 @@ func file_v2_object_grpc_service_proto_init() { return nil } } - file_v2_object_grpc_service_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + file_object_grpc_service_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GetRangeRequest); i { case 0: return &v.state @@ -3075,7 +3074,7 @@ func file_v2_object_grpc_service_proto_init() { return nil } } - file_v2_object_grpc_service_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + file_object_grpc_service_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GetRangeResponse); i { case 0: return &v.state @@ -3087,7 +3086,7 @@ func file_v2_object_grpc_service_proto_init() { return nil } } - file_v2_object_grpc_service_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { + file_object_grpc_service_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GetRangeHashRequest); i { case 0: return &v.state @@ -3099,7 +3098,7 @@ func file_v2_object_grpc_service_proto_init() { return nil } } - file_v2_object_grpc_service_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { + file_object_grpc_service_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GetRangeHashResponse); i { case 0: return &v.state @@ -3111,7 +3110,7 @@ func file_v2_object_grpc_service_proto_init() { return nil } } - file_v2_object_grpc_service_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { + file_object_grpc_service_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GetRequest_Body); i { case 0: return &v.state @@ -3123,7 +3122,7 @@ func file_v2_object_grpc_service_proto_init() { return nil } } - file_v2_object_grpc_service_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { + file_object_grpc_service_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GetResponse_Body); i { case 0: return &v.state @@ -3135,7 +3134,7 @@ func file_v2_object_grpc_service_proto_init() { return nil } } - file_v2_object_grpc_service_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { + file_object_grpc_service_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GetResponse_Body_Init); i { case 0: return &v.state @@ -3147,7 +3146,7 @@ func file_v2_object_grpc_service_proto_init() { return nil } } - file_v2_object_grpc_service_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { + file_object_grpc_service_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PutRequest_Body); i { case 0: return &v.state @@ -3159,7 +3158,7 @@ func file_v2_object_grpc_service_proto_init() { return nil } } - file_v2_object_grpc_service_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { + file_object_grpc_service_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PutRequest_Body_Init); i { case 0: return &v.state @@ -3171,7 +3170,7 @@ func file_v2_object_grpc_service_proto_init() { return nil } } - file_v2_object_grpc_service_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { + file_object_grpc_service_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PutResponse_Body); i { case 0: return &v.state @@ -3183,7 +3182,7 @@ func file_v2_object_grpc_service_proto_init() { return nil } } - file_v2_object_grpc_service_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { + file_object_grpc_service_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*DeleteRequest_Body); i { case 0: return &v.state @@ -3195,7 +3194,7 @@ func file_v2_object_grpc_service_proto_init() { return nil } } - file_v2_object_grpc_service_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} { + file_object_grpc_service_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*DeleteResponse_Body); i { case 0: return &v.state @@ -3207,7 +3206,7 @@ func file_v2_object_grpc_service_proto_init() { return nil } } - file_v2_object_grpc_service_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} { + file_object_grpc_service_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*HeadRequest_Body); i { case 0: return &v.state @@ -3219,7 +3218,7 @@ func file_v2_object_grpc_service_proto_init() { return nil } } - file_v2_object_grpc_service_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} { + file_object_grpc_service_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*HeadResponse_Body); i { case 0: return &v.state @@ -3231,7 +3230,7 @@ func file_v2_object_grpc_service_proto_init() { return nil } } - file_v2_object_grpc_service_proto_msgTypes[26].Exporter = func(v interface{}, i int) interface{} { + file_object_grpc_service_proto_msgTypes[26].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*SearchRequest_Body); i { case 0: return &v.state @@ -3243,7 +3242,7 @@ func file_v2_object_grpc_service_proto_init() { return nil } } - file_v2_object_grpc_service_proto_msgTypes[27].Exporter = func(v interface{}, i int) interface{} { + file_object_grpc_service_proto_msgTypes[27].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*SearchRequest_Body_Filter); i { case 0: return &v.state @@ -3255,7 +3254,7 @@ func file_v2_object_grpc_service_proto_init() { return nil } } - file_v2_object_grpc_service_proto_msgTypes[28].Exporter = func(v interface{}, i int) interface{} { + file_object_grpc_service_proto_msgTypes[28].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*SearchResponse_Body); i { case 0: return &v.state @@ -3267,7 +3266,7 @@ func file_v2_object_grpc_service_proto_init() { return nil } } - file_v2_object_grpc_service_proto_msgTypes[29].Exporter = func(v interface{}, i int) interface{} { + file_object_grpc_service_proto_msgTypes[29].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GetRangeRequest_Body); i { case 0: return &v.state @@ -3279,7 +3278,7 @@ func file_v2_object_grpc_service_proto_init() { return nil } } - file_v2_object_grpc_service_proto_msgTypes[30].Exporter = func(v interface{}, i int) interface{} { + file_object_grpc_service_proto_msgTypes[30].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GetRangeResponse_Body); i { case 0: return &v.state @@ -3291,7 +3290,7 @@ func file_v2_object_grpc_service_proto_init() { return nil } } - file_v2_object_grpc_service_proto_msgTypes[31].Exporter = func(v interface{}, i int) interface{} { + file_object_grpc_service_proto_msgTypes[31].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GetRangeHashRequest_Body); i { case 0: return &v.state @@ -3303,7 +3302,7 @@ func file_v2_object_grpc_service_proto_init() { return nil } } - file_v2_object_grpc_service_proto_msgTypes[32].Exporter = func(v interface{}, i int) interface{} { + file_object_grpc_service_proto_msgTypes[32].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GetRangeHashResponse_Body); i { case 0: return &v.state @@ -3316,21 +3315,21 @@ func file_v2_object_grpc_service_proto_init() { } } } - file_v2_object_grpc_service_proto_msgTypes[17].OneofWrappers = []interface{}{ + file_object_grpc_service_proto_msgTypes[17].OneofWrappers = []interface{}{ (*GetResponse_Body_Init_)(nil), (*GetResponse_Body_Chunk)(nil), (*GetResponse_Body_SplitInfo)(nil), } - file_v2_object_grpc_service_proto_msgTypes[19].OneofWrappers = []interface{}{ + file_object_grpc_service_proto_msgTypes[19].OneofWrappers = []interface{}{ (*PutRequest_Body_Init_)(nil), (*PutRequest_Body_Chunk)(nil), } - file_v2_object_grpc_service_proto_msgTypes[25].OneofWrappers = []interface{}{ + file_object_grpc_service_proto_msgTypes[25].OneofWrappers = []interface{}{ (*HeadResponse_Body_Header)(nil), (*HeadResponse_Body_ShortHeader)(nil), (*HeadResponse_Body_SplitInfo)(nil), } - file_v2_object_grpc_service_proto_msgTypes[30].OneofWrappers = []interface{}{ + file_object_grpc_service_proto_msgTypes[30].OneofWrappers = []interface{}{ (*GetRangeResponse_Body_Chunk)(nil), (*GetRangeResponse_Body_SplitInfo)(nil), } @@ -3338,18 +3337,18 @@ func file_v2_object_grpc_service_proto_init() { out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_v2_object_grpc_service_proto_rawDesc, + RawDescriptor: file_object_grpc_service_proto_rawDesc, NumEnums: 0, NumMessages: 33, NumExtensions: 0, NumServices: 1, }, - GoTypes: file_v2_object_grpc_service_proto_goTypes, - DependencyIndexes: file_v2_object_grpc_service_proto_depIdxs, - MessageInfos: file_v2_object_grpc_service_proto_msgTypes, + GoTypes: file_object_grpc_service_proto_goTypes, + DependencyIndexes: file_object_grpc_service_proto_depIdxs, + MessageInfos: file_object_grpc_service_proto_msgTypes, }.Build() - File_v2_object_grpc_service_proto = out.File - file_v2_object_grpc_service_proto_rawDesc = nil - file_v2_object_grpc_service_proto_goTypes = nil - file_v2_object_grpc_service_proto_depIdxs = nil + File_object_grpc_service_proto = out.File + file_object_grpc_service_proto_rawDesc = nil + file_object_grpc_service_proto_goTypes = nil + file_object_grpc_service_proto_depIdxs = nil } diff --git a/object/grpc/service_grpc.pb.go b/object/grpc/service_grpc.pb.go index 2586c04..4a2ea28 100644 --- a/object/grpc/service_grpc.pb.go +++ b/object/grpc/service_grpc.pb.go @@ -553,5 +553,5 @@ var ObjectService_ServiceDesc = grpc.ServiceDesc{ ServerStreams: true, }, }, - Metadata: "v2/object/grpc/service.proto", + Metadata: "object/grpc/service.proto", } diff --git a/v2/object/grpc/status.pb.go b/object/grpc/status.pb.go similarity index 100% rename from v2/object/grpc/status.pb.go rename to object/grpc/status.pb.go diff --git a/object/grpc/types.pb.go b/object/grpc/types.pb.go index 6efc6dc..efc92dc 100644 --- a/object/grpc/types.pb.go +++ b/object/grpc/types.pb.go @@ -2,7 +2,7 @@ // versions: // protoc-gen-go v1.27.1 // protoc v3.18.0 -// source: v2/object/grpc/types.proto +// source: object/grpc/types.proto package object @@ -66,11 +66,11 @@ func (x ObjectType) String() string { } func (ObjectType) Descriptor() protoreflect.EnumDescriptor { - return file_v2_object_grpc_types_proto_enumTypes[0].Descriptor() + return file_object_grpc_types_proto_enumTypes[0].Descriptor() } func (ObjectType) Type() protoreflect.EnumType { - return &file_v2_object_grpc_types_proto_enumTypes[0] + return &file_object_grpc_types_proto_enumTypes[0] } func (x ObjectType) Number() protoreflect.EnumNumber { @@ -79,7 +79,7 @@ func (x ObjectType) Number() protoreflect.EnumNumber { // Deprecated: Use ObjectType.Descriptor instead. func (ObjectType) EnumDescriptor() ([]byte, []int) { - return file_v2_object_grpc_types_proto_rawDescGZIP(), []int{0} + return file_object_grpc_types_proto_rawDescGZIP(), []int{0} } // Type of match expression @@ -127,11 +127,11 @@ func (x MatchType) String() string { } func (MatchType) Descriptor() protoreflect.EnumDescriptor { - return file_v2_object_grpc_types_proto_enumTypes[1].Descriptor() + return file_object_grpc_types_proto_enumTypes[1].Descriptor() } func (MatchType) Type() protoreflect.EnumType { - return &file_v2_object_grpc_types_proto_enumTypes[1] + return &file_object_grpc_types_proto_enumTypes[1] } func (x MatchType) Number() protoreflect.EnumNumber { @@ -140,7 +140,7 @@ func (x MatchType) Number() protoreflect.EnumNumber { // Deprecated: Use MatchType.Descriptor instead. func (MatchType) EnumDescriptor() ([]byte, []int) { - return file_v2_object_grpc_types_proto_rawDescGZIP(), []int{1} + return file_object_grpc_types_proto_rawDescGZIP(), []int{1} } // Short header fields @@ -170,7 +170,7 @@ type ShortHeader struct { func (x *ShortHeader) Reset() { *x = ShortHeader{} if protoimpl.UnsafeEnabled { - mi := &file_v2_object_grpc_types_proto_msgTypes[0] + mi := &file_object_grpc_types_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -183,7 +183,7 @@ func (x *ShortHeader) String() string { func (*ShortHeader) ProtoMessage() {} func (x *ShortHeader) ProtoReflect() protoreflect.Message { - mi := &file_v2_object_grpc_types_proto_msgTypes[0] + mi := &file_object_grpc_types_proto_msgTypes[0] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -196,7 +196,7 @@ func (x *ShortHeader) ProtoReflect() protoreflect.Message { // Deprecated: Use ShortHeader.ProtoReflect.Descriptor instead. func (*ShortHeader) Descriptor() ([]byte, []int) { - return file_v2_object_grpc_types_proto_rawDescGZIP(), []int{0} + return file_object_grpc_types_proto_rawDescGZIP(), []int{0} } func (x *ShortHeader) GetVersion() *grpc.Version { @@ -284,7 +284,7 @@ type Header struct { func (x *Header) Reset() { *x = Header{} if protoimpl.UnsafeEnabled { - mi := &file_v2_object_grpc_types_proto_msgTypes[1] + mi := &file_object_grpc_types_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -297,7 +297,7 @@ func (x *Header) String() string { func (*Header) ProtoMessage() {} func (x *Header) ProtoReflect() protoreflect.Message { - mi := &file_v2_object_grpc_types_proto_msgTypes[1] + mi := &file_object_grpc_types_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -310,7 +310,7 @@ func (x *Header) ProtoReflect() protoreflect.Message { // Deprecated: Use Header.ProtoReflect.Descriptor instead. func (*Header) Descriptor() ([]byte, []int) { - return file_v2_object_grpc_types_proto_rawDescGZIP(), []int{1} + return file_object_grpc_types_proto_rawDescGZIP(), []int{1} } func (x *Header) GetVersion() *grpc.Version { @@ -411,7 +411,7 @@ type Object struct { func (x *Object) Reset() { *x = Object{} if protoimpl.UnsafeEnabled { - mi := &file_v2_object_grpc_types_proto_msgTypes[2] + mi := &file_object_grpc_types_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -424,7 +424,7 @@ func (x *Object) String() string { func (*Object) ProtoMessage() {} func (x *Object) ProtoReflect() protoreflect.Message { - mi := &file_v2_object_grpc_types_proto_msgTypes[2] + mi := &file_object_grpc_types_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -437,7 +437,7 @@ func (x *Object) ProtoReflect() protoreflect.Message { // Deprecated: Use Object.ProtoReflect.Descriptor instead. func (*Object) Descriptor() ([]byte, []int) { - return file_v2_object_grpc_types_proto_rawDescGZIP(), []int{2} + return file_object_grpc_types_proto_rawDescGZIP(), []int{2} } func (x *Object) GetObjectId() *grpc.ObjectID { @@ -491,7 +491,7 @@ type SplitInfo struct { func (x *SplitInfo) Reset() { *x = SplitInfo{} if protoimpl.UnsafeEnabled { - mi := &file_v2_object_grpc_types_proto_msgTypes[3] + mi := &file_object_grpc_types_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -504,7 +504,7 @@ func (x *SplitInfo) String() string { func (*SplitInfo) ProtoMessage() {} func (x *SplitInfo) ProtoReflect() protoreflect.Message { - mi := &file_v2_object_grpc_types_proto_msgTypes[3] + mi := &file_object_grpc_types_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -517,7 +517,7 @@ func (x *SplitInfo) ProtoReflect() protoreflect.Message { // Deprecated: Use SplitInfo.ProtoReflect.Descriptor instead. func (*SplitInfo) Descriptor() ([]byte, []int) { - return file_v2_object_grpc_types_proto_rawDescGZIP(), []int{3} + return file_object_grpc_types_proto_rawDescGZIP(), []int{3} } func (x *SplitInfo) GetSplitId() []byte { @@ -583,7 +583,7 @@ type Header_Attribute struct { func (x *Header_Attribute) Reset() { *x = Header_Attribute{} if protoimpl.UnsafeEnabled { - mi := &file_v2_object_grpc_types_proto_msgTypes[4] + mi := &file_object_grpc_types_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -596,7 +596,7 @@ func (x *Header_Attribute) String() string { func (*Header_Attribute) ProtoMessage() {} func (x *Header_Attribute) ProtoReflect() protoreflect.Message { - mi := &file_v2_object_grpc_types_proto_msgTypes[4] + mi := &file_object_grpc_types_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -609,7 +609,7 @@ func (x *Header_Attribute) ProtoReflect() protoreflect.Message { // Deprecated: Use Header_Attribute.ProtoReflect.Descriptor instead. func (*Header_Attribute) Descriptor() ([]byte, []int) { - return file_v2_object_grpc_types_proto_rawDescGZIP(), []int{1, 0} + return file_object_grpc_types_proto_rawDescGZIP(), []int{1, 0} } func (x *Header_Attribute) GetKey() string { @@ -654,7 +654,7 @@ type Header_Split struct { func (x *Header_Split) Reset() { *x = Header_Split{} if protoimpl.UnsafeEnabled { - mi := &file_v2_object_grpc_types_proto_msgTypes[5] + mi := &file_object_grpc_types_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -667,7 +667,7 @@ func (x *Header_Split) String() string { func (*Header_Split) ProtoMessage() {} func (x *Header_Split) ProtoReflect() protoreflect.Message { - mi := &file_v2_object_grpc_types_proto_msgTypes[5] + mi := &file_object_grpc_types_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -680,7 +680,7 @@ func (x *Header_Split) ProtoReflect() protoreflect.Message { // Deprecated: Use Header_Split.ProtoReflect.Descriptor instead. func (*Header_Split) Descriptor() ([]byte, []int) { - return file_v2_object_grpc_types_proto_rawDescGZIP(), []int{1, 1} + return file_object_grpc_types_proto_rawDescGZIP(), []int{1, 1} } func (x *Header_Split) GetParent() *grpc.ObjectID { @@ -725,159 +725,159 @@ func (x *Header_Split) GetSplitId() []byte { return nil } -var File_v2_object_grpc_types_proto protoreflect.FileDescriptor +var File_object_grpc_types_proto protoreflect.FileDescriptor -var file_v2_object_grpc_types_proto_rawDesc = []byte{ - 0x0a, 0x1a, 0x76, 0x32, 0x2f, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2f, 0x67, 0x72, 0x70, 0x63, - 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x10, 0x6e, 0x65, - 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x1a, 0x18, - 0x76, 0x32, 0x2f, 0x72, 0x65, 0x66, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, - 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x76, 0x32, 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, 0x83, 0x03, 0x0a, 0x0b, 0x53, 0x68, 0x6f, 0x72, 0x74, 0x48, - 0x65, 0x61, 0x64, 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, 0x25, 0x0a, 0x0e, 0x63, 0x72, 0x65, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, - 0x52, 0x0d, 0x63, 0x72, 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x70, 0x6f, 0x63, 0x68, 0x12, - 0x32, 0x0a, 0x08, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x03, 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, 0x3d, 0x0a, 0x0b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x74, 0x79, - 0x70, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, - 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x4f, 0x62, 0x6a, 0x65, - 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x52, 0x0a, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x54, 0x79, - 0x70, 0x65, 0x12, 0x25, 0x0a, 0x0e, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x5f, 0x6c, 0x65, - 0x6e, 0x67, 0x74, 0x68, 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0d, 0x70, 0x61, 0x79, 0x6c, - 0x6f, 0x61, 0x64, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x3b, 0x0a, 0x0c, 0x70, 0x61, 0x79, - 0x6c, 0x6f, 0x61, 0x64, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, - 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x52, 0x0b, 0x70, 0x61, 0x79, 0x6c, 0x6f, - 0x61, 0x64, 0x48, 0x61, 0x73, 0x68, 0x12, 0x43, 0x0a, 0x10, 0x68, 0x6f, 0x6d, 0x6f, 0x6d, 0x6f, - 0x72, 0x70, 0x68, 0x69, 0x63, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, - 0x73, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x52, 0x0f, 0x68, 0x6f, 0x6d, 0x6f, - 0x6d, 0x6f, 0x72, 0x70, 0x68, 0x69, 0x63, 0x48, 0x61, 0x73, 0x68, 0x22, 0xfb, 0x07, 0x0a, 0x06, - 0x48, 0x65, 0x61, 0x64, 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, 0x3e, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, - 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, - 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x52, 0x0b, 0x63, 0x6f, - 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x12, 0x32, 0x0a, 0x08, 0x6f, 0x77, 0x6e, - 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x03, 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, 0x25, 0x0a, - 0x0e, 0x63, 0x72, 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x18, - 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0d, 0x63, 0x72, 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, - 0x70, 0x6f, 0x63, 0x68, 0x12, 0x25, 0x0a, 0x0e, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x5f, - 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0d, 0x70, 0x61, - 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x3b, 0x0a, 0x0c, 0x70, - 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x06, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, - 0x66, 0x73, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x52, 0x0b, 0x70, 0x61, 0x79, - 0x6c, 0x6f, 0x61, 0x64, 0x48, 0x61, 0x73, 0x68, 0x12, 0x3d, 0x0a, 0x0b, 0x6f, 0x62, 0x6a, 0x65, - 0x63, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1c, 0x2e, +var file_object_grpc_types_proto_rawDesc = []byte{ + 0x0a, 0x17, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, + 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x10, 0x6e, 0x65, 0x6f, 0x2e, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x1a, 0x15, 0x72, 0x65, 0x66, + 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x1a, 0x18, 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, 0x83, 0x03, 0x0a, + 0x0b, 0x53, 0x68, 0x6f, 0x72, 0x74, 0x48, 0x65, 0x61, 0x64, 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, + 0x25, 0x0a, 0x0e, 0x63, 0x72, 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x70, 0x6f, 0x63, + 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0d, 0x63, 0x72, 0x65, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x45, 0x70, 0x6f, 0x63, 0x68, 0x12, 0x32, 0x0a, 0x08, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x5f, + 0x69, 0x64, 0x18, 0x03, 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, 0x3d, 0x0a, 0x0b, 0x6f, 0x62, + 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, + 0x1c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, + 0x63, 0x74, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x52, 0x0a, 0x6f, + 0x62, 0x6a, 0x65, 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x25, 0x0a, 0x0e, 0x70, 0x61, 0x79, + 0x6c, 0x6f, 0x61, 0x64, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x05, 0x20, 0x01, 0x28, + 0x04, 0x52, 0x0d, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, + 0x12, 0x3b, 0x0a, 0x0c, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x5f, 0x68, 0x61, 0x73, 0x68, + 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, + 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, + 0x52, 0x0b, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x48, 0x61, 0x73, 0x68, 0x12, 0x43, 0x0a, + 0x10, 0x68, 0x6f, 0x6d, 0x6f, 0x6d, 0x6f, 0x72, 0x70, 0x68, 0x69, 0x63, 0x5f, 0x68, 0x61, 0x73, + 0x68, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, + 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, + 0x6d, 0x52, 0x0f, 0x68, 0x6f, 0x6d, 0x6f, 0x6d, 0x6f, 0x72, 0x70, 0x68, 0x69, 0x63, 0x48, 0x61, + 0x73, 0x68, 0x22, 0xfb, 0x07, 0x0a, 0x06, 0x48, 0x65, 0x61, 0x64, 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, 0x3e, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, + 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, + 0x72, 0x49, 0x44, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, + 0x12, 0x32, 0x0a, 0x08, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x03, 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, 0x25, 0x0a, 0x0e, 0x63, 0x72, 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x5f, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0d, 0x63, 0x72, + 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x70, 0x6f, 0x63, 0x68, 0x12, 0x25, 0x0a, 0x0e, 0x70, + 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x05, 0x20, + 0x01, 0x28, 0x04, 0x52, 0x0d, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x4c, 0x65, 0x6e, 0x67, + 0x74, 0x68, 0x12, 0x3b, 0x0a, 0x0c, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x5f, 0x68, 0x61, + 0x73, 0x68, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, + 0x75, 0x6d, 0x52, 0x0b, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x48, 0x61, 0x73, 0x68, 0x12, + 0x3d, 0x0a, 0x0b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x07, + 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x54, 0x79, + 0x70, 0x65, 0x52, 0x0a, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x43, + 0x0a, 0x10, 0x68, 0x6f, 0x6d, 0x6f, 0x6d, 0x6f, 0x72, 0x70, 0x68, 0x69, 0x63, 0x5f, 0x68, 0x61, + 0x73, 0x68, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, + 0x75, 0x6d, 0x52, 0x0f, 0x68, 0x6f, 0x6d, 0x6f, 0x6d, 0x6f, 0x72, 0x70, 0x68, 0x69, 0x63, 0x48, + 0x61, 0x73, 0x68, 0x12, 0x44, 0x0a, 0x0d, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x74, + 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, + 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x53, + 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x0c, 0x73, 0x65, 0x73, + 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x42, 0x0a, 0x0a, 0x61, 0x74, 0x74, + 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, - 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x52, 0x0a, 0x6f, 0x62, 0x6a, - 0x65, 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x43, 0x0a, 0x10, 0x68, 0x6f, 0x6d, 0x6f, 0x6d, - 0x6f, 0x72, 0x70, 0x68, 0x69, 0x63, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x08, 0x20, 0x01, 0x28, + 0x2e, 0x48, 0x65, 0x61, 0x64, 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, 0x34, 0x0a, + 0x05, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, + 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x2e, 0x53, 0x70, 0x6c, 0x69, 0x74, 0x52, 0x05, 0x73, 0x70, + 0x6c, 0x69, 0x74, 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, 0x1a, 0xc5, 0x02, 0x0a, 0x05, 0x53, 0x70, 0x6c, + 0x69, 0x74, 0x12, 0x30, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, + 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, 0x06, 0x70, 0x61, + 0x72, 0x65, 0x6e, 0x74, 0x12, 0x34, 0x0a, 0x08, 0x70, 0x72, 0x65, 0x76, 0x69, 0x6f, 0x75, 0x73, + 0x18, 0x02, 0x20, 0x01, 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, 0x08, 0x70, 0x72, 0x65, 0x76, 0x69, 0x6f, 0x75, 0x73, 0x12, 0x44, 0x0a, 0x10, 0x70, 0x61, + 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, + 0x0f, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, + 0x12, 0x3d, 0x0a, 0x0d, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, + 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, + 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, + 0x72, 0x52, 0x0c, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, + 0x34, 0x0a, 0x08, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x72, 0x65, 0x6e, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, - 0x66, 0x73, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x52, 0x0f, 0x68, 0x6f, 0x6d, - 0x6f, 0x6d, 0x6f, 0x72, 0x70, 0x68, 0x69, 0x63, 0x48, 0x61, 0x73, 0x68, 0x12, 0x44, 0x0a, 0x0d, - 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x09, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, - 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x54, - 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x0c, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x6f, 0x6b, - 0x65, 0x6e, 0x12, 0x42, 0x0a, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, - 0x18, 0x0a, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, - 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 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, 0x34, 0x0a, 0x05, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x18, - 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, - 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x2e, - 0x53, 0x70, 0x6c, 0x69, 0x74, 0x52, 0x05, 0x73, 0x70, 0x6c, 0x69, 0x74, 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, 0x1a, 0xc5, 0x02, 0x0a, 0x05, 0x53, 0x70, 0x6c, 0x69, 0x74, 0x12, 0x30, 0x0a, 0x06, 0x70, - 0x61, 0x72, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 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, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x12, 0x34, 0x0a, - 0x08, 0x70, 0x72, 0x65, 0x76, 0x69, 0x6f, 0x75, 0x73, 0x18, 0x02, 0x20, 0x01, 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, 0x08, 0x70, 0x72, 0x65, 0x76, 0x69, - 0x6f, 0x75, 0x73, 0x12, 0x44, 0x0a, 0x10, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x73, 0x69, - 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, - 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, - 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x0f, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, - 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x3d, 0x0a, 0x0d, 0x70, 0x61, 0x72, - 0x65, 0x6e, 0x74, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, - 0x65, 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0c, 0x70, 0x61, 0x72, 0x65, - 0x6e, 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x34, 0x0a, 0x08, 0x63, 0x68, 0x69, 0x6c, - 0x64, 0x72, 0x65, 0x6e, 0x18, 0x05, 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, 0x08, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x72, 0x65, 0x6e, 0x12, 0x19, - 0x0a, 0x08, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0c, - 0x52, 0x07, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x49, 0x44, 0x22, 0xc4, 0x01, 0x0a, 0x06, 0x4f, 0x62, - 0x6a, 0x65, 0x63, 0x74, 0x12, 0x35, 0x0a, 0x09, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x69, - 0x64, 0x18, 0x01, 0x20, 0x01, 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, 0x08, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x44, 0x12, 0x37, 0x0a, 0x09, 0x73, - 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, + 0x66, 0x73, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x44, 0x52, 0x08, 0x63, 0x68, 0x69, + 0x6c, 0x64, 0x72, 0x65, 0x6e, 0x12, 0x19, 0x0a, 0x08, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x5f, 0x69, + 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x49, 0x44, + 0x22, 0xc4, 0x01, 0x0a, 0x06, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x35, 0x0a, 0x09, 0x6f, + 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, - 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, - 0x74, 0x75, 0x72, 0x65, 0x12, 0x30, 0x0a, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, - 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x06, - 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, - 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, - 0x22, 0x8b, 0x01, 0x0a, 0x09, 0x53, 0x70, 0x6c, 0x69, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x19, - 0x0a, 0x08, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, - 0x52, 0x07, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x49, 0x64, 0x12, 0x35, 0x0a, 0x09, 0x6c, 0x61, 0x73, - 0x74, 0x5f, 0x70, 0x61, 0x72, 0x74, 0x18, 0x02, 0x20, 0x01, 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, 0x08, 0x6c, 0x61, 0x73, 0x74, 0x50, 0x61, 0x72, 0x74, - 0x12, 0x2c, 0x0a, 0x04, 0x6c, 0x69, 0x6e, 0x6b, 0x18, 0x03, 0x20, 0x01, 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, 0x04, 0x6c, 0x69, 0x6e, 0x6b, 0x2a, 0x3b, - 0x0a, 0x0a, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0b, 0x0a, 0x07, - 0x52, 0x45, 0x47, 0x55, 0x4c, 0x41, 0x52, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x54, 0x4f, 0x4d, - 0x42, 0x53, 0x54, 0x4f, 0x4e, 0x45, 0x10, 0x01, 0x12, 0x11, 0x0a, 0x0d, 0x53, 0x54, 0x4f, 0x52, - 0x41, 0x47, 0x45, 0x5f, 0x47, 0x52, 0x4f, 0x55, 0x50, 0x10, 0x02, 0x2a, 0x73, 0x0a, 0x09, 0x4d, - 0x61, 0x74, 0x63, 0x68, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1a, 0x0a, 0x16, 0x4d, 0x41, 0x54, 0x43, - 0x48, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, - 0x45, 0x44, 0x10, 0x00, 0x12, 0x10, 0x0a, 0x0c, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x5f, 0x45, - 0x51, 0x55, 0x41, 0x4c, 0x10, 0x01, 0x12, 0x14, 0x0a, 0x10, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, - 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x45, 0x51, 0x55, 0x41, 0x4c, 0x10, 0x02, 0x12, 0x0f, 0x0a, 0x0b, - 0x4e, 0x4f, 0x54, 0x5f, 0x50, 0x52, 0x45, 0x53, 0x45, 0x4e, 0x54, 0x10, 0x03, 0x12, 0x11, 0x0a, - 0x0d, 0x43, 0x4f, 0x4d, 0x4d, 0x4f, 0x4e, 0x5f, 0x50, 0x52, 0x45, 0x46, 0x49, 0x58, 0x10, 0x04, - 0x42, 0x56, 0x5a, 0x37, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, - 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, - 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2f, - 0x67, 0x72, 0x70, 0x63, 0x3b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0xaa, 0x02, 0x1a, 0x4e, 0x65, - 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, - 0x49, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x44, 0x52, 0x08, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, + 0x49, 0x44, 0x12, 0x37, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, + 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x30, 0x0a, 0x06, 0x68, + 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, + 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x48, + 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x18, 0x0a, + 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, + 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x22, 0x8b, 0x01, 0x0a, 0x09, 0x53, 0x70, 0x6c, 0x69, + 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x19, 0x0a, 0x08, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x5f, 0x69, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x49, 0x64, + 0x12, 0x35, 0x0a, 0x09, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x70, 0x61, 0x72, 0x74, 0x18, 0x02, 0x20, + 0x01, 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, 0x08, 0x6c, + 0x61, 0x73, 0x74, 0x50, 0x61, 0x72, 0x74, 0x12, 0x2c, 0x0a, 0x04, 0x6c, 0x69, 0x6e, 0x6b, 0x18, + 0x03, 0x20, 0x01, 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, + 0x04, 0x6c, 0x69, 0x6e, 0x6b, 0x2a, 0x3b, 0x0a, 0x0a, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x54, + 0x79, 0x70, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x52, 0x45, 0x47, 0x55, 0x4c, 0x41, 0x52, 0x10, 0x00, + 0x12, 0x0d, 0x0a, 0x09, 0x54, 0x4f, 0x4d, 0x42, 0x53, 0x54, 0x4f, 0x4e, 0x45, 0x10, 0x01, 0x12, + 0x11, 0x0a, 0x0d, 0x53, 0x54, 0x4f, 0x52, 0x41, 0x47, 0x45, 0x5f, 0x47, 0x52, 0x4f, 0x55, 0x50, + 0x10, 0x02, 0x2a, 0x73, 0x0a, 0x09, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x54, 0x79, 0x70, 0x65, 0x12, + 0x1a, 0x0a, 0x16, 0x4d, 0x41, 0x54, 0x43, 0x48, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, + 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x10, 0x0a, 0x0c, 0x53, + 0x54, 0x52, 0x49, 0x4e, 0x47, 0x5f, 0x45, 0x51, 0x55, 0x41, 0x4c, 0x10, 0x01, 0x12, 0x14, 0x0a, + 0x10, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x45, 0x51, 0x55, 0x41, + 0x4c, 0x10, 0x02, 0x12, 0x0f, 0x0a, 0x0b, 0x4e, 0x4f, 0x54, 0x5f, 0x50, 0x52, 0x45, 0x53, 0x45, + 0x4e, 0x54, 0x10, 0x03, 0x12, 0x11, 0x0a, 0x0d, 0x43, 0x4f, 0x4d, 0x4d, 0x4f, 0x4e, 0x5f, 0x50, + 0x52, 0x45, 0x46, 0x49, 0x58, 0x10, 0x04, 0x42, 0x56, 0x5a, 0x37, 0x67, 0x69, 0x74, 0x68, 0x75, + 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, + 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, + 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x6f, 0x62, 0x6a, 0x65, + 0x63, 0x74, 0xaa, 0x02, 0x1a, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, + 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( - file_v2_object_grpc_types_proto_rawDescOnce sync.Once - file_v2_object_grpc_types_proto_rawDescData = file_v2_object_grpc_types_proto_rawDesc + file_object_grpc_types_proto_rawDescOnce sync.Once + file_object_grpc_types_proto_rawDescData = file_object_grpc_types_proto_rawDesc ) -func file_v2_object_grpc_types_proto_rawDescGZIP() []byte { - file_v2_object_grpc_types_proto_rawDescOnce.Do(func() { - file_v2_object_grpc_types_proto_rawDescData = protoimpl.X.CompressGZIP(file_v2_object_grpc_types_proto_rawDescData) +func file_object_grpc_types_proto_rawDescGZIP() []byte { + file_object_grpc_types_proto_rawDescOnce.Do(func() { + file_object_grpc_types_proto_rawDescData = protoimpl.X.CompressGZIP(file_object_grpc_types_proto_rawDescData) }) - return file_v2_object_grpc_types_proto_rawDescData + return file_object_grpc_types_proto_rawDescData } -var file_v2_object_grpc_types_proto_enumTypes = make([]protoimpl.EnumInfo, 2) -var file_v2_object_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 6) -var file_v2_object_grpc_types_proto_goTypes = []interface{}{ +var file_object_grpc_types_proto_enumTypes = make([]protoimpl.EnumInfo, 2) +var file_object_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 6) +var file_object_grpc_types_proto_goTypes = []interface{}{ (ObjectType)(0), // 0: neo.fs.v2.object.ObjectType (MatchType)(0), // 1: neo.fs.v2.object.MatchType (*ShortHeader)(nil), // 2: neo.fs.v2.object.ShortHeader @@ -894,7 +894,7 @@ var file_v2_object_grpc_types_proto_goTypes = []interface{}{ (*grpc.ObjectID)(nil), // 13: neo.fs.v2.refs.ObjectID (*grpc.Signature)(nil), // 14: neo.fs.v2.refs.Signature } -var file_v2_object_grpc_types_proto_depIdxs = []int32{ +var file_object_grpc_types_proto_depIdxs = []int32{ 8, // 0: neo.fs.v2.object.ShortHeader.version:type_name -> neo.fs.v2.refs.Version 9, // 1: neo.fs.v2.object.ShortHeader.owner_id:type_name -> neo.fs.v2.refs.OwnerID 0, // 2: neo.fs.v2.object.ShortHeader.object_type:type_name -> neo.fs.v2.object.ObjectType @@ -926,13 +926,13 @@ var file_v2_object_grpc_types_proto_depIdxs = []int32{ 0, // [0:24] is the sub-list for field type_name } -func init() { file_v2_object_grpc_types_proto_init() } -func file_v2_object_grpc_types_proto_init() { - if File_v2_object_grpc_types_proto != nil { +func init() { file_object_grpc_types_proto_init() } +func file_object_grpc_types_proto_init() { + if File_object_grpc_types_proto != nil { return } if !protoimpl.UnsafeEnabled { - file_v2_object_grpc_types_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_object_grpc_types_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ShortHeader); i { case 0: return &v.state @@ -944,7 +944,7 @@ func file_v2_object_grpc_types_proto_init() { return nil } } - file_v2_object_grpc_types_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_object_grpc_types_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Header); i { case 0: return &v.state @@ -956,7 +956,7 @@ func file_v2_object_grpc_types_proto_init() { return nil } } - file_v2_object_grpc_types_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + file_object_grpc_types_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Object); i { case 0: return &v.state @@ -968,7 +968,7 @@ func file_v2_object_grpc_types_proto_init() { return nil } } - file_v2_object_grpc_types_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + file_object_grpc_types_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*SplitInfo); i { case 0: return &v.state @@ -980,7 +980,7 @@ func file_v2_object_grpc_types_proto_init() { return nil } } - file_v2_object_grpc_types_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + file_object_grpc_types_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Header_Attribute); i { case 0: return &v.state @@ -992,7 +992,7 @@ func file_v2_object_grpc_types_proto_init() { return nil } } - file_v2_object_grpc_types_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + file_object_grpc_types_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Header_Split); i { case 0: return &v.state @@ -1009,19 +1009,19 @@ func file_v2_object_grpc_types_proto_init() { out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_v2_object_grpc_types_proto_rawDesc, + RawDescriptor: file_object_grpc_types_proto_rawDesc, NumEnums: 2, NumMessages: 6, NumExtensions: 0, NumServices: 0, }, - GoTypes: file_v2_object_grpc_types_proto_goTypes, - DependencyIndexes: file_v2_object_grpc_types_proto_depIdxs, - EnumInfos: file_v2_object_grpc_types_proto_enumTypes, - MessageInfos: file_v2_object_grpc_types_proto_msgTypes, + GoTypes: file_object_grpc_types_proto_goTypes, + DependencyIndexes: file_object_grpc_types_proto_depIdxs, + EnumInfos: file_object_grpc_types_proto_enumTypes, + MessageInfos: file_object_grpc_types_proto_msgTypes, }.Build() - File_v2_object_grpc_types_proto = out.File - file_v2_object_grpc_types_proto_rawDesc = nil - file_v2_object_grpc_types_proto_goTypes = nil - file_v2_object_grpc_types_proto_depIdxs = nil + File_object_grpc_types_proto = out.File + file_object_grpc_types_proto_rawDesc = nil + file_object_grpc_types_proto_goTypes = nil + file_object_grpc_types_proto_depIdxs = nil } diff --git a/prepare.sh b/prepare.sh index c7cd644..5899367 100755 --- a/prepare.sh +++ b/prepare.sh @@ -1,7 +1,5 @@ #!/bin/bash -prefix=v2 - if [ -z "$1" ]; then echo "usage: ./prepare.sh path/to/neofs-api" exit 1 @@ -9,23 +7,22 @@ fi API_GO_PATH=$(pwd) API_PATH=$1 -mkdir "$API_GO_PATH/$prefix" 2>/dev/null # MOVE FILES FROM API REPO cd "$API_PATH" || exit 1 ARGS=$(find ./ -name '*.proto' -not -path './vendor/*') for file in $ARGS; do dir=$(dirname "$file") - mkdir -p "$API_GO_PATH/$prefix/$dir/grpc" - cp -r "$dir"/* "$API_GO_PATH/$prefix/$dir/grpc" + mkdir -p "$API_GO_PATH/$dir/grpc" + cp -r "$dir"/* "$API_GO_PATH/$dir/grpc" done # MODIFY FILES -cd "$API_GO_PATH/$prefix" || exit 1 +cd "$API_GO_PATH" || exit 1 ARGS2=$(find ./ -name '*.proto') for file in $ARGS2; do echo "$file" - sed -i "s/import\ \"\(.*\)\/\(.*\)\.proto\";/import\ \"$prefix\/\1\/grpc\/\2\.proto\";/" $file + sed -i "s/import\ \"\(.*\)\/\(.*\)\.proto\";/import\ \"\1\/grpc\/\2\.proto\";/" $file done cd "$API_GO_PATH" || exit 1 diff --git a/refs/grpc/types.pb.go b/refs/grpc/types.pb.go index 52b1a7e..34c6186 100644 --- a/refs/grpc/types.pb.go +++ b/refs/grpc/types.pb.go @@ -2,7 +2,7 @@ // versions: // protoc-gen-go v1.27.1 // protoc v3.18.0 -// source: v2/refs/grpc/types.proto +// source: refs/grpc/types.proto package refs @@ -57,11 +57,11 @@ func (x ChecksumType) String() string { } func (ChecksumType) Descriptor() protoreflect.EnumDescriptor { - return file_v2_refs_grpc_types_proto_enumTypes[0].Descriptor() + return file_refs_grpc_types_proto_enumTypes[0].Descriptor() } func (ChecksumType) Type() protoreflect.EnumType { - return &file_v2_refs_grpc_types_proto_enumTypes[0] + return &file_refs_grpc_types_proto_enumTypes[0] } func (x ChecksumType) Number() protoreflect.EnumNumber { @@ -70,7 +70,7 @@ func (x ChecksumType) Number() protoreflect.EnumNumber { // Deprecated: Use ChecksumType.Descriptor instead. func (ChecksumType) EnumDescriptor() ([]byte, []int) { - return file_v2_refs_grpc_types_proto_rawDescGZIP(), []int{0} + return file_refs_grpc_types_proto_rawDescGZIP(), []int{0} } // Objects in NeoFS are addressed by their ContainerID and ObjectID. @@ -91,7 +91,7 @@ type Address struct { func (x *Address) Reset() { *x = Address{} if protoimpl.UnsafeEnabled { - mi := &file_v2_refs_grpc_types_proto_msgTypes[0] + mi := &file_refs_grpc_types_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -104,7 +104,7 @@ func (x *Address) String() string { func (*Address) ProtoMessage() {} func (x *Address) ProtoReflect() protoreflect.Message { - mi := &file_v2_refs_grpc_types_proto_msgTypes[0] + mi := &file_refs_grpc_types_proto_msgTypes[0] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -117,7 +117,7 @@ func (x *Address) ProtoReflect() protoreflect.Message { // Deprecated: Use Address.ProtoReflect.Descriptor instead. func (*Address) Descriptor() ([]byte, []int) { - return file_v2_refs_grpc_types_proto_rawDescGZIP(), []int{0} + return file_refs_grpc_types_proto_rawDescGZIP(), []int{0} } func (x *Address) GetContainerId() *ContainerID { @@ -162,7 +162,7 @@ type ObjectID struct { func (x *ObjectID) Reset() { *x = ObjectID{} if protoimpl.UnsafeEnabled { - mi := &file_v2_refs_grpc_types_proto_msgTypes[1] + mi := &file_refs_grpc_types_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -175,7 +175,7 @@ func (x *ObjectID) String() string { func (*ObjectID) ProtoMessage() {} func (x *ObjectID) ProtoReflect() protoreflect.Message { - mi := &file_v2_refs_grpc_types_proto_msgTypes[1] + mi := &file_refs_grpc_types_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -188,7 +188,7 @@ func (x *ObjectID) ProtoReflect() protoreflect.Message { // Deprecated: Use ObjectID.ProtoReflect.Descriptor instead. func (*ObjectID) Descriptor() ([]byte, []int) { - return file_v2_refs_grpc_types_proto_rawDescGZIP(), []int{1} + return file_refs_grpc_types_proto_rawDescGZIP(), []int{1} } func (x *ObjectID) GetValue() []byte { @@ -225,7 +225,7 @@ type ContainerID struct { func (x *ContainerID) Reset() { *x = ContainerID{} if protoimpl.UnsafeEnabled { - mi := &file_v2_refs_grpc_types_proto_msgTypes[2] + mi := &file_refs_grpc_types_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -238,7 +238,7 @@ func (x *ContainerID) String() string { func (*ContainerID) ProtoMessage() {} func (x *ContainerID) ProtoReflect() protoreflect.Message { - mi := &file_v2_refs_grpc_types_proto_msgTypes[2] + mi := &file_refs_grpc_types_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -251,7 +251,7 @@ func (x *ContainerID) ProtoReflect() protoreflect.Message { // Deprecated: Use ContainerID.ProtoReflect.Descriptor instead. func (*ContainerID) Descriptor() ([]byte, []int) { - return file_v2_refs_grpc_types_proto_rawDescGZIP(), []int{2} + return file_refs_grpc_types_proto_rawDescGZIP(), []int{2} } func (x *ContainerID) GetValue() []byte { @@ -288,7 +288,7 @@ type OwnerID struct { func (x *OwnerID) Reset() { *x = OwnerID{} if protoimpl.UnsafeEnabled { - mi := &file_v2_refs_grpc_types_proto_msgTypes[3] + mi := &file_refs_grpc_types_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -301,7 +301,7 @@ func (x *OwnerID) String() string { func (*OwnerID) ProtoMessage() {} func (x *OwnerID) ProtoReflect() protoreflect.Message { - mi := &file_v2_refs_grpc_types_proto_msgTypes[3] + mi := &file_refs_grpc_types_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -314,7 +314,7 @@ func (x *OwnerID) ProtoReflect() protoreflect.Message { // Deprecated: Use OwnerID.ProtoReflect.Descriptor instead. func (*OwnerID) Descriptor() ([]byte, []int) { - return file_v2_refs_grpc_types_proto_rawDescGZIP(), []int{3} + return file_refs_grpc_types_proto_rawDescGZIP(), []int{3} } func (x *OwnerID) GetValue() []byte { @@ -342,7 +342,7 @@ type Version struct { func (x *Version) Reset() { *x = Version{} if protoimpl.UnsafeEnabled { - mi := &file_v2_refs_grpc_types_proto_msgTypes[4] + mi := &file_refs_grpc_types_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -355,7 +355,7 @@ func (x *Version) String() string { func (*Version) ProtoMessage() {} func (x *Version) ProtoReflect() protoreflect.Message { - mi := &file_v2_refs_grpc_types_proto_msgTypes[4] + mi := &file_refs_grpc_types_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -368,7 +368,7 @@ func (x *Version) ProtoReflect() protoreflect.Message { // Deprecated: Use Version.ProtoReflect.Descriptor instead. func (*Version) Descriptor() ([]byte, []int) { - return file_v2_refs_grpc_types_proto_rawDescGZIP(), []int{4} + return file_refs_grpc_types_proto_rawDescGZIP(), []int{4} } func (x *Version) GetMajor() uint32 { @@ -400,7 +400,7 @@ type Signature struct { func (x *Signature) Reset() { *x = Signature{} if protoimpl.UnsafeEnabled { - mi := &file_v2_refs_grpc_types_proto_msgTypes[5] + mi := &file_refs_grpc_types_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -413,7 +413,7 @@ func (x *Signature) String() string { func (*Signature) ProtoMessage() {} func (x *Signature) ProtoReflect() protoreflect.Message { - mi := &file_v2_refs_grpc_types_proto_msgTypes[5] + mi := &file_refs_grpc_types_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -426,7 +426,7 @@ func (x *Signature) ProtoReflect() protoreflect.Message { // Deprecated: Use Signature.ProtoReflect.Descriptor instead. func (*Signature) Descriptor() ([]byte, []int) { - return file_v2_refs_grpc_types_proto_rawDescGZIP(), []int{5} + return file_refs_grpc_types_proto_rawDescGZIP(), []int{5} } func (x *Signature) GetKey() []byte { @@ -464,7 +464,7 @@ type Checksum struct { func (x *Checksum) Reset() { *x = Checksum{} if protoimpl.UnsafeEnabled { - mi := &file_v2_refs_grpc_types_proto_msgTypes[6] + mi := &file_refs_grpc_types_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -477,7 +477,7 @@ func (x *Checksum) String() string { func (*Checksum) ProtoMessage() {} func (x *Checksum) ProtoReflect() protoreflect.Message { - mi := &file_v2_refs_grpc_types_proto_msgTypes[6] + mi := &file_refs_grpc_types_proto_msgTypes[6] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -490,7 +490,7 @@ func (x *Checksum) ProtoReflect() protoreflect.Message { // Deprecated: Use Checksum.ProtoReflect.Descriptor instead. func (*Checksum) Descriptor() ([]byte, []int) { - return file_v2_refs_grpc_types_proto_rawDescGZIP(), []int{6} + return file_refs_grpc_types_proto_rawDescGZIP(), []int{6} } func (x *Checksum) GetType() ChecksumType { @@ -507,66 +507,65 @@ func (x *Checksum) GetSum() []byte { return nil } -var File_v2_refs_grpc_types_proto protoreflect.FileDescriptor +var File_refs_grpc_types_proto protoreflect.FileDescriptor -var file_v2_refs_grpc_types_proto_rawDesc = []byte{ - 0x0a, 0x18, 0x76, 0x32, 0x2f, 0x72, 0x65, 0x66, 0x73, 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, 0x72, 0x65, 0x66, 0x73, 0x22, 0x80, 0x01, 0x0a, 0x07, 0x41, - 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x3e, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, - 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, - 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x6f, - 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x61, - 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x12, 0x35, 0x0a, 0x09, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, - 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 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, 0x08, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x44, 0x22, 0x20, 0x0a, - 0x08, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x44, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, - 0x23, 0x0a, 0x0b, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x12, 0x14, - 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x22, 0x1f, 0x0a, 0x07, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x12, - 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x35, 0x0a, 0x07, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, - 0x12, 0x14, 0x0a, 0x05, 0x6d, 0x61, 0x6a, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, - 0x05, 0x6d, 0x61, 0x6a, 0x6f, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x6d, 0x69, 0x6e, 0x6f, 0x72, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x6d, 0x69, 0x6e, 0x6f, 0x72, 0x22, 0x36, 0x0a, 0x09, - 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x17, 0x0a, 0x04, 0x73, - 0x69, 0x67, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, - 0x74, 0x75, 0x72, 0x65, 0x22, 0x4e, 0x0a, 0x08, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, - 0x12, 0x30, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1c, - 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, - 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, - 0x70, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x75, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, - 0x03, 0x73, 0x75, 0x6d, 0x2a, 0x41, 0x0a, 0x0c, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, - 0x54, 0x79, 0x70, 0x65, 0x12, 0x1d, 0x0a, 0x19, 0x43, 0x48, 0x45, 0x43, 0x4b, 0x53, 0x55, 0x4d, - 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, - 0x44, 0x10, 0x00, 0x12, 0x06, 0x0a, 0x02, 0x54, 0x5a, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x53, - 0x48, 0x41, 0x32, 0x35, 0x36, 0x10, 0x02, 0x42, 0x50, 0x5a, 0x33, 0x67, 0x69, 0x74, 0x68, 0x75, - 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, - 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, - 0x72, 0x65, 0x66, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x72, 0x65, 0x66, 0x73, 0xaa, 0x02, - 0x18, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, - 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x52, 0x65, 0x66, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x33, +var file_refs_grpc_types_proto_rawDesc = []byte{ + 0x0a, 0x15, 0x72, 0x65, 0x66, 0x73, 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, 0x72, 0x65, 0x66, 0x73, 0x22, 0x80, 0x01, 0x0a, 0x07, 0x41, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0x12, 0x3e, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, + 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, + 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, + 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, + 0x72, 0x49, 0x44, 0x12, 0x35, 0x0a, 0x09, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x69, 0x64, + 0x18, 0x02, 0x20, 0x01, 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, 0x08, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x44, 0x22, 0x20, 0x0a, 0x08, 0x4f, 0x62, + 0x6a, 0x65, 0x63, 0x74, 0x49, 0x44, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x23, 0x0a, 0x0b, + 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x12, 0x14, 0x0a, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x22, 0x1f, 0x0a, 0x07, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x12, 0x14, 0x0a, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x22, 0x35, 0x0a, 0x07, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x14, 0x0a, + 0x05, 0x6d, 0x61, 0x6a, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x6d, 0x61, + 0x6a, 0x6f, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x6d, 0x69, 0x6e, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0d, 0x52, 0x05, 0x6d, 0x69, 0x6e, 0x6f, 0x72, 0x22, 0x36, 0x0a, 0x09, 0x53, 0x69, 0x67, + 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0c, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x69, 0x67, 0x6e, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, + 0x65, 0x22, 0x4e, 0x0a, 0x08, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x12, 0x30, 0x0a, + 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1c, 0x2e, 0x6e, 0x65, + 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x68, 0x65, + 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, + 0x10, 0x0a, 0x03, 0x73, 0x75, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x03, 0x73, 0x75, + 0x6d, 0x2a, 0x41, 0x0a, 0x0c, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x54, 0x79, 0x70, + 0x65, 0x12, 0x1d, 0x0a, 0x19, 0x43, 0x48, 0x45, 0x43, 0x4b, 0x53, 0x55, 0x4d, 0x5f, 0x54, 0x59, + 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, + 0x12, 0x06, 0x0a, 0x02, 0x54, 0x5a, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x53, 0x48, 0x41, 0x32, + 0x35, 0x36, 0x10, 0x02, 0x42, 0x50, 0x5a, 0x33, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, + 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, + 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x72, 0x65, 0x66, + 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x72, 0x65, 0x66, 0x73, 0xaa, 0x02, 0x18, 0x4e, 0x65, + 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, + 0x49, 0x2e, 0x52, 0x65, 0x66, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( - file_v2_refs_grpc_types_proto_rawDescOnce sync.Once - file_v2_refs_grpc_types_proto_rawDescData = file_v2_refs_grpc_types_proto_rawDesc + file_refs_grpc_types_proto_rawDescOnce sync.Once + file_refs_grpc_types_proto_rawDescData = file_refs_grpc_types_proto_rawDesc ) -func file_v2_refs_grpc_types_proto_rawDescGZIP() []byte { - file_v2_refs_grpc_types_proto_rawDescOnce.Do(func() { - file_v2_refs_grpc_types_proto_rawDescData = protoimpl.X.CompressGZIP(file_v2_refs_grpc_types_proto_rawDescData) +func file_refs_grpc_types_proto_rawDescGZIP() []byte { + file_refs_grpc_types_proto_rawDescOnce.Do(func() { + file_refs_grpc_types_proto_rawDescData = protoimpl.X.CompressGZIP(file_refs_grpc_types_proto_rawDescData) }) - return file_v2_refs_grpc_types_proto_rawDescData + return file_refs_grpc_types_proto_rawDescData } -var file_v2_refs_grpc_types_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_v2_refs_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 7) -var file_v2_refs_grpc_types_proto_goTypes = []interface{}{ +var file_refs_grpc_types_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_refs_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 7) +var file_refs_grpc_types_proto_goTypes = []interface{}{ (ChecksumType)(0), // 0: neo.fs.v2.refs.ChecksumType (*Address)(nil), // 1: neo.fs.v2.refs.Address (*ObjectID)(nil), // 2: neo.fs.v2.refs.ObjectID @@ -576,7 +575,7 @@ var file_v2_refs_grpc_types_proto_goTypes = []interface{}{ (*Signature)(nil), // 6: neo.fs.v2.refs.Signature (*Checksum)(nil), // 7: neo.fs.v2.refs.Checksum } -var file_v2_refs_grpc_types_proto_depIdxs = []int32{ +var file_refs_grpc_types_proto_depIdxs = []int32{ 3, // 0: neo.fs.v2.refs.Address.container_id:type_name -> neo.fs.v2.refs.ContainerID 2, // 1: neo.fs.v2.refs.Address.object_id:type_name -> neo.fs.v2.refs.ObjectID 0, // 2: neo.fs.v2.refs.Checksum.type:type_name -> neo.fs.v2.refs.ChecksumType @@ -587,13 +586,13 @@ var file_v2_refs_grpc_types_proto_depIdxs = []int32{ 0, // [0:3] is the sub-list for field type_name } -func init() { file_v2_refs_grpc_types_proto_init() } -func file_v2_refs_grpc_types_proto_init() { - if File_v2_refs_grpc_types_proto != nil { +func init() { file_refs_grpc_types_proto_init() } +func file_refs_grpc_types_proto_init() { + if File_refs_grpc_types_proto != nil { return } if !protoimpl.UnsafeEnabled { - file_v2_refs_grpc_types_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_refs_grpc_types_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Address); i { case 0: return &v.state @@ -605,7 +604,7 @@ func file_v2_refs_grpc_types_proto_init() { return nil } } - file_v2_refs_grpc_types_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_refs_grpc_types_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ObjectID); i { case 0: return &v.state @@ -617,7 +616,7 @@ func file_v2_refs_grpc_types_proto_init() { return nil } } - file_v2_refs_grpc_types_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + file_refs_grpc_types_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ContainerID); i { case 0: return &v.state @@ -629,7 +628,7 @@ func file_v2_refs_grpc_types_proto_init() { return nil } } - file_v2_refs_grpc_types_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + file_refs_grpc_types_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*OwnerID); i { case 0: return &v.state @@ -641,7 +640,7 @@ func file_v2_refs_grpc_types_proto_init() { return nil } } - file_v2_refs_grpc_types_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + file_refs_grpc_types_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Version); i { case 0: return &v.state @@ -653,7 +652,7 @@ func file_v2_refs_grpc_types_proto_init() { return nil } } - file_v2_refs_grpc_types_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + file_refs_grpc_types_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Signature); i { case 0: return &v.state @@ -665,7 +664,7 @@ func file_v2_refs_grpc_types_proto_init() { return nil } } - file_v2_refs_grpc_types_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + file_refs_grpc_types_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Checksum); i { case 0: return &v.state @@ -682,19 +681,19 @@ func file_v2_refs_grpc_types_proto_init() { out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_v2_refs_grpc_types_proto_rawDesc, + RawDescriptor: file_refs_grpc_types_proto_rawDesc, NumEnums: 1, NumMessages: 7, NumExtensions: 0, NumServices: 0, }, - GoTypes: file_v2_refs_grpc_types_proto_goTypes, - DependencyIndexes: file_v2_refs_grpc_types_proto_depIdxs, - EnumInfos: file_v2_refs_grpc_types_proto_enumTypes, - MessageInfos: file_v2_refs_grpc_types_proto_msgTypes, + GoTypes: file_refs_grpc_types_proto_goTypes, + DependencyIndexes: file_refs_grpc_types_proto_depIdxs, + EnumInfos: file_refs_grpc_types_proto_enumTypes, + MessageInfos: file_refs_grpc_types_proto_msgTypes, }.Build() - File_v2_refs_grpc_types_proto = out.File - file_v2_refs_grpc_types_proto_rawDesc = nil - file_v2_refs_grpc_types_proto_goTypes = nil - file_v2_refs_grpc_types_proto_depIdxs = nil + File_refs_grpc_types_proto = out.File + file_refs_grpc_types_proto_rawDesc = nil + file_refs_grpc_types_proto_goTypes = nil + file_refs_grpc_types_proto_depIdxs = nil } diff --git a/reputation/grpc/service.pb.go b/reputation/grpc/service.pb.go index 1ef79f4..79104b5 100644 --- a/reputation/grpc/service.pb.go +++ b/reputation/grpc/service.pb.go @@ -2,7 +2,7 @@ // versions: // protoc-gen-go v1.27.1 // protoc v3.18.0 -// source: v2/reputation/grpc/service.proto +// source: reputation/grpc/service.proto package reputation @@ -41,7 +41,7 @@ type AnnounceLocalTrustRequest struct { func (x *AnnounceLocalTrustRequest) Reset() { *x = AnnounceLocalTrustRequest{} if protoimpl.UnsafeEnabled { - mi := &file_v2_reputation_grpc_service_proto_msgTypes[0] + mi := &file_reputation_grpc_service_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -54,7 +54,7 @@ func (x *AnnounceLocalTrustRequest) String() string { func (*AnnounceLocalTrustRequest) ProtoMessage() {} func (x *AnnounceLocalTrustRequest) ProtoReflect() protoreflect.Message { - mi := &file_v2_reputation_grpc_service_proto_msgTypes[0] + mi := &file_reputation_grpc_service_proto_msgTypes[0] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -67,7 +67,7 @@ func (x *AnnounceLocalTrustRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use AnnounceLocalTrustRequest.ProtoReflect.Descriptor instead. func (*AnnounceLocalTrustRequest) Descriptor() ([]byte, []int) { - return file_v2_reputation_grpc_service_proto_rawDescGZIP(), []int{0} + return file_reputation_grpc_service_proto_rawDescGZIP(), []int{0} } func (x *AnnounceLocalTrustRequest) GetBody() *AnnounceLocalTrustRequest_Body { @@ -111,7 +111,7 @@ type AnnounceLocalTrustResponse struct { func (x *AnnounceLocalTrustResponse) Reset() { *x = AnnounceLocalTrustResponse{} if protoimpl.UnsafeEnabled { - mi := &file_v2_reputation_grpc_service_proto_msgTypes[1] + mi := &file_reputation_grpc_service_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -124,7 +124,7 @@ func (x *AnnounceLocalTrustResponse) String() string { func (*AnnounceLocalTrustResponse) ProtoMessage() {} func (x *AnnounceLocalTrustResponse) ProtoReflect() protoreflect.Message { - mi := &file_v2_reputation_grpc_service_proto_msgTypes[1] + mi := &file_reputation_grpc_service_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -137,7 +137,7 @@ func (x *AnnounceLocalTrustResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use AnnounceLocalTrustResponse.ProtoReflect.Descriptor instead. func (*AnnounceLocalTrustResponse) Descriptor() ([]byte, []int) { - return file_v2_reputation_grpc_service_proto_rawDescGZIP(), []int{1} + return file_reputation_grpc_service_proto_rawDescGZIP(), []int{1} } func (x *AnnounceLocalTrustResponse) GetBody() *AnnounceLocalTrustResponse_Body { @@ -181,7 +181,7 @@ type AnnounceIntermediateResultRequest struct { func (x *AnnounceIntermediateResultRequest) Reset() { *x = AnnounceIntermediateResultRequest{} if protoimpl.UnsafeEnabled { - mi := &file_v2_reputation_grpc_service_proto_msgTypes[2] + mi := &file_reputation_grpc_service_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -194,7 +194,7 @@ func (x *AnnounceIntermediateResultRequest) String() string { func (*AnnounceIntermediateResultRequest) ProtoMessage() {} func (x *AnnounceIntermediateResultRequest) ProtoReflect() protoreflect.Message { - mi := &file_v2_reputation_grpc_service_proto_msgTypes[2] + mi := &file_reputation_grpc_service_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -207,7 +207,7 @@ func (x *AnnounceIntermediateResultRequest) ProtoReflect() protoreflect.Message // Deprecated: Use AnnounceIntermediateResultRequest.ProtoReflect.Descriptor instead. func (*AnnounceIntermediateResultRequest) Descriptor() ([]byte, []int) { - return file_v2_reputation_grpc_service_proto_rawDescGZIP(), []int{2} + return file_reputation_grpc_service_proto_rawDescGZIP(), []int{2} } func (x *AnnounceIntermediateResultRequest) GetBody() *AnnounceIntermediateResultRequest_Body { @@ -251,7 +251,7 @@ type AnnounceIntermediateResultResponse struct { func (x *AnnounceIntermediateResultResponse) Reset() { *x = AnnounceIntermediateResultResponse{} if protoimpl.UnsafeEnabled { - mi := &file_v2_reputation_grpc_service_proto_msgTypes[3] + mi := &file_reputation_grpc_service_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -264,7 +264,7 @@ func (x *AnnounceIntermediateResultResponse) String() string { func (*AnnounceIntermediateResultResponse) ProtoMessage() {} func (x *AnnounceIntermediateResultResponse) ProtoReflect() protoreflect.Message { - mi := &file_v2_reputation_grpc_service_proto_msgTypes[3] + mi := &file_reputation_grpc_service_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -277,7 +277,7 @@ func (x *AnnounceIntermediateResultResponse) ProtoReflect() protoreflect.Message // Deprecated: Use AnnounceIntermediateResultResponse.ProtoReflect.Descriptor instead. func (*AnnounceIntermediateResultResponse) Descriptor() ([]byte, []int) { - return file_v2_reputation_grpc_service_proto_rawDescGZIP(), []int{3} + return file_reputation_grpc_service_proto_rawDescGZIP(), []int{3} } func (x *AnnounceIntermediateResultResponse) GetBody() *AnnounceIntermediateResultResponse_Body { @@ -318,7 +318,7 @@ type AnnounceLocalTrustRequest_Body struct { func (x *AnnounceLocalTrustRequest_Body) Reset() { *x = AnnounceLocalTrustRequest_Body{} if protoimpl.UnsafeEnabled { - mi := &file_v2_reputation_grpc_service_proto_msgTypes[4] + mi := &file_reputation_grpc_service_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -331,7 +331,7 @@ func (x *AnnounceLocalTrustRequest_Body) String() string { func (*AnnounceLocalTrustRequest_Body) ProtoMessage() {} func (x *AnnounceLocalTrustRequest_Body) ProtoReflect() protoreflect.Message { - mi := &file_v2_reputation_grpc_service_proto_msgTypes[4] + mi := &file_reputation_grpc_service_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -344,7 +344,7 @@ func (x *AnnounceLocalTrustRequest_Body) ProtoReflect() protoreflect.Message { // Deprecated: Use AnnounceLocalTrustRequest_Body.ProtoReflect.Descriptor instead. func (*AnnounceLocalTrustRequest_Body) Descriptor() ([]byte, []int) { - return file_v2_reputation_grpc_service_proto_rawDescGZIP(), []int{0, 0} + return file_reputation_grpc_service_proto_rawDescGZIP(), []int{0, 0} } func (x *AnnounceLocalTrustRequest_Body) GetEpoch() uint64 { @@ -373,7 +373,7 @@ type AnnounceLocalTrustResponse_Body struct { func (x *AnnounceLocalTrustResponse_Body) Reset() { *x = AnnounceLocalTrustResponse_Body{} if protoimpl.UnsafeEnabled { - mi := &file_v2_reputation_grpc_service_proto_msgTypes[5] + mi := &file_reputation_grpc_service_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -386,7 +386,7 @@ func (x *AnnounceLocalTrustResponse_Body) String() string { func (*AnnounceLocalTrustResponse_Body) ProtoMessage() {} func (x *AnnounceLocalTrustResponse_Body) ProtoReflect() protoreflect.Message { - mi := &file_v2_reputation_grpc_service_proto_msgTypes[5] + mi := &file_reputation_grpc_service_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -399,7 +399,7 @@ func (x *AnnounceLocalTrustResponse_Body) ProtoReflect() protoreflect.Message { // Deprecated: Use AnnounceLocalTrustResponse_Body.ProtoReflect.Descriptor instead. func (*AnnounceLocalTrustResponse_Body) Descriptor() ([]byte, []int) { - return file_v2_reputation_grpc_service_proto_rawDescGZIP(), []int{1, 0} + return file_reputation_grpc_service_proto_rawDescGZIP(), []int{1, 0} } // Announce intermediate global trust information. @@ -419,7 +419,7 @@ type AnnounceIntermediateResultRequest_Body struct { func (x *AnnounceIntermediateResultRequest_Body) Reset() { *x = AnnounceIntermediateResultRequest_Body{} if protoimpl.UnsafeEnabled { - mi := &file_v2_reputation_grpc_service_proto_msgTypes[6] + mi := &file_reputation_grpc_service_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -432,7 +432,7 @@ func (x *AnnounceIntermediateResultRequest_Body) String() string { func (*AnnounceIntermediateResultRequest_Body) ProtoMessage() {} func (x *AnnounceIntermediateResultRequest_Body) ProtoReflect() protoreflect.Message { - mi := &file_v2_reputation_grpc_service_proto_msgTypes[6] + mi := &file_reputation_grpc_service_proto_msgTypes[6] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -445,7 +445,7 @@ func (x *AnnounceIntermediateResultRequest_Body) ProtoReflect() protoreflect.Mes // Deprecated: Use AnnounceIntermediateResultRequest_Body.ProtoReflect.Descriptor instead. func (*AnnounceIntermediateResultRequest_Body) Descriptor() ([]byte, []int) { - return file_v2_reputation_grpc_service_proto_rawDescGZIP(), []int{2, 0} + return file_reputation_grpc_service_proto_rawDescGZIP(), []int{2, 0} } func (x *AnnounceIntermediateResultRequest_Body) GetEpoch() uint64 { @@ -481,7 +481,7 @@ type AnnounceIntermediateResultResponse_Body struct { func (x *AnnounceIntermediateResultResponse_Body) Reset() { *x = AnnounceIntermediateResultResponse_Body{} if protoimpl.UnsafeEnabled { - mi := &file_v2_reputation_grpc_service_proto_msgTypes[7] + mi := &file_reputation_grpc_service_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -494,7 +494,7 @@ func (x *AnnounceIntermediateResultResponse_Body) String() string { func (*AnnounceIntermediateResultResponse_Body) ProtoMessage() {} func (x *AnnounceIntermediateResultResponse_Body) ProtoReflect() protoreflect.Message { - mi := &file_v2_reputation_grpc_service_proto_msgTypes[7] + mi := &file_reputation_grpc_service_proto_msgTypes[7] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -507,46 +507,88 @@ func (x *AnnounceIntermediateResultResponse_Body) ProtoReflect() protoreflect.Me // Deprecated: Use AnnounceIntermediateResultResponse_Body.ProtoReflect.Descriptor instead. func (*AnnounceIntermediateResultResponse_Body) Descriptor() ([]byte, []int) { - return file_v2_reputation_grpc_service_proto_rawDescGZIP(), []int{3, 0} + return file_reputation_grpc_service_proto_rawDescGZIP(), []int{3, 0} } -var File_v2_reputation_grpc_service_proto protoreflect.FileDescriptor +var File_reputation_grpc_service_proto protoreflect.FileDescriptor -var file_v2_reputation_grpc_service_proto_rawDesc = []byte{ - 0x0a, 0x20, 0x76, 0x32, 0x2f, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 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, 0x72, 0x65, - 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0x1e, 0x76, 0x32, 0x2f, 0x72, 0x65, 0x70, - 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, - 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x76, 0x32, 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, 0xd2, 0x02, 0x0a, 0x19, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, - 0x63, 0x65, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x54, 0x72, 0x75, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x12, 0x48, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x34, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, - 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, - 0x65, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x54, 0x72, 0x75, 0x73, 0x74, 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, +var file_reputation_grpc_service_proto_rawDesc = []byte{ + 0x0a, 0x1d, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 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, 0x72, 0x65, 0x70, 0x75, 0x74, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0x1b, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x1a, 0x18, 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, 0xd2, 0x02, 0x0a, + 0x19, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x54, 0x72, + 0x75, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x48, 0x0a, 0x04, 0x62, 0x6f, + 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x34, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, + 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x54, 0x72, 0x75, + 0x73, 0x74, 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, 0x51, + 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x12, 0x33, 0x0a, 0x06, + 0x74, 0x72, 0x75, 0x73, 0x74, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x2e, 0x54, 0x72, 0x75, 0x73, 0x74, 0x52, 0x06, 0x74, 0x72, 0x75, 0x73, 0x74, + 0x73, 0x22, 0x8b, 0x02, 0x0a, 0x1a, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x4c, 0x6f, + 0x63, 0x61, 0x6c, 0x54, 0x72, 0x75, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x49, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x35, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x4c, 0x6f, + 0x63, 0x61, 0x6c, 0x54, 0x72, 0x75, 0x73, 0x74, 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, 0x51, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, - 0x14, 0x0a, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, - 0x65, 0x70, 0x6f, 0x63, 0x68, 0x12, 0x33, 0x0a, 0x06, 0x74, 0x72, 0x75, 0x73, 0x74, 0x73, 0x18, - 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, - 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x54, 0x72, 0x75, - 0x73, 0x74, 0x52, 0x06, 0x74, 0x72, 0x75, 0x73, 0x74, 0x73, 0x22, 0x8b, 0x02, 0x0a, 0x1a, 0x41, - 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x54, 0x72, 0x75, 0x73, - 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x49, 0x0a, 0x04, 0x62, 0x6f, 0x64, - 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x35, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, - 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x41, - 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x54, 0x72, 0x75, 0x73, + 0x79, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x1a, 0x06, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x22, + 0x88, 0x03, 0x0a, 0x21, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x49, 0x6e, 0x74, 0x65, + 0x72, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x50, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x3c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, + 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x41, 0x6e, 0x6e, 0x6f, 0x75, + 0x6e, 0x63, 0x65, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x74, 0x65, 0x52, + 0x65, 0x73, 0x75, 0x6c, 0x74, 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, 0x77, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x70, 0x6f, + 0x63, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x12, + 0x1c, 0x0a, 0x09, 0x69, 0x74, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0d, 0x52, 0x09, 0x69, 0x74, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3b, 0x0a, + 0x05, 0x74, 0x72, 0x75, 0x73, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x54, 0x6f, 0x50, 0x65, 0x65, 0x72, 0x54, 0x72, + 0x75, 0x73, 0x74, 0x52, 0x05, 0x74, 0x72, 0x75, 0x73, 0x74, 0x22, 0x9b, 0x02, 0x0a, 0x22, 0x41, + 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6d, 0x65, 0x64, 0x69, + 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x51, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x3d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, + 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x49, + 0x6e, 0x74, 0x65, 0x72, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 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, @@ -558,90 +600,48 @@ var file_v2_reputation_grpc_service_proto_rawDesc = []byte{ 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, 0x06, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x22, 0x88, 0x03, 0x0a, 0x21, 0x41, 0x6e, 0x6e, - 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x74, - 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x50, - 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3c, 0x2e, 0x6e, - 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x2e, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x49, 0x6e, 0x74, 0x65, - 0x72, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 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, 0x77, 0x0a, 0x04, 0x42, 0x6f, - 0x64, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x04, 0x52, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x12, 0x1c, 0x0a, 0x09, 0x69, 0x74, 0x65, 0x72, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x69, 0x74, 0x65, - 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3b, 0x0a, 0x05, 0x74, 0x72, 0x75, 0x73, 0x74, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, - 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x50, 0x65, 0x65, - 0x72, 0x54, 0x6f, 0x50, 0x65, 0x65, 0x72, 0x54, 0x72, 0x75, 0x73, 0x74, 0x52, 0x05, 0x74, 0x72, - 0x75, 0x73, 0x74, 0x22, 0x9b, 0x02, 0x0a, 0x22, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, - 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x75, - 0x6c, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x51, 0x0a, 0x04, 0x62, 0x6f, - 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, - 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, - 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6d, 0x65, 0x64, - 0x69, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 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, 0x06, 0x0a, 0x04, 0x42, 0x6f, 0x64, - 0x79, 0x32, 0x9e, 0x02, 0x0a, 0x11, 0x52, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x77, 0x0a, 0x12, 0x41, 0x6e, 0x6e, 0x6f, 0x75, - 0x6e, 0x63, 0x65, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x54, 0x72, 0x75, 0x73, 0x74, 0x12, 0x2f, 0x2e, - 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x4c, 0x6f, 0x63, - 0x61, 0x6c, 0x54, 0x72, 0x75, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x30, - 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x4c, 0x6f, - 0x63, 0x61, 0x6c, 0x54, 0x72, 0x75, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x12, 0x8f, 0x01, 0x0a, 0x1a, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x49, 0x6e, 0x74, - 0x65, 0x72, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, - 0x37, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, + 0x1a, 0x06, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x32, 0x9e, 0x02, 0x0a, 0x11, 0x52, 0x65, 0x70, + 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x77, + 0x0a, 0x12, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x54, + 0x72, 0x75, 0x73, 0x74, 0x12, 0x2f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x41, 0x6e, 0x6e, 0x6f, + 0x75, 0x6e, 0x63, 0x65, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x54, 0x72, 0x75, 0x73, 0x74, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x30, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x41, 0x6e, 0x6e, + 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x54, 0x72, 0x75, 0x73, 0x74, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x8f, 0x01, 0x0a, 0x1a, 0x41, 0x6e, 0x6e, 0x6f, + 0x75, 0x6e, 0x63, 0x65, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x74, 0x65, + 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x37, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, + 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x41, 0x6e, + 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6d, 0x65, 0x64, 0x69, 0x61, + 0x74, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x38, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, - 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x38, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, - 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, - 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6d, 0x65, 0x64, - 0x69, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x42, 0x62, 0x5a, 0x3f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, - 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, - 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x72, 0x65, 0x70, 0x75, 0x74, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x72, 0x65, 0x70, 0x75, 0x74, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xaa, 0x02, 0x1e, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, - 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x52, 0x65, 0x70, 0x75, - 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x62, 0x5a, 0x3f, 0x67, 0x69, 0x74, + 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, + 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, + 0x32, 0x2f, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x67, 0x72, 0x70, + 0x63, 0x3b, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xaa, 0x02, 0x1e, 0x4e, + 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, + 0x50, 0x49, 0x2e, 0x52, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( - file_v2_reputation_grpc_service_proto_rawDescOnce sync.Once - file_v2_reputation_grpc_service_proto_rawDescData = file_v2_reputation_grpc_service_proto_rawDesc + file_reputation_grpc_service_proto_rawDescOnce sync.Once + file_reputation_grpc_service_proto_rawDescData = file_reputation_grpc_service_proto_rawDesc ) -func file_v2_reputation_grpc_service_proto_rawDescGZIP() []byte { - file_v2_reputation_grpc_service_proto_rawDescOnce.Do(func() { - file_v2_reputation_grpc_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_v2_reputation_grpc_service_proto_rawDescData) +func file_reputation_grpc_service_proto_rawDescGZIP() []byte { + file_reputation_grpc_service_proto_rawDescOnce.Do(func() { + file_reputation_grpc_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_reputation_grpc_service_proto_rawDescData) }) - return file_v2_reputation_grpc_service_proto_rawDescData + return file_reputation_grpc_service_proto_rawDescData } -var file_v2_reputation_grpc_service_proto_msgTypes = make([]protoimpl.MessageInfo, 8) -var file_v2_reputation_grpc_service_proto_goTypes = []interface{}{ +var file_reputation_grpc_service_proto_msgTypes = make([]protoimpl.MessageInfo, 8) +var file_reputation_grpc_service_proto_goTypes = []interface{}{ (*AnnounceLocalTrustRequest)(nil), // 0: neo.fs.v2.reputation.AnnounceLocalTrustRequest (*AnnounceLocalTrustResponse)(nil), // 1: neo.fs.v2.reputation.AnnounceLocalTrustResponse (*AnnounceIntermediateResultRequest)(nil), // 2: neo.fs.v2.reputation.AnnounceIntermediateResultRequest @@ -657,7 +657,7 @@ var file_v2_reputation_grpc_service_proto_goTypes = []interface{}{ (*Trust)(nil), // 12: neo.fs.v2.reputation.Trust (*PeerToPeerTrust)(nil), // 13: neo.fs.v2.reputation.PeerToPeerTrust } -var file_v2_reputation_grpc_service_proto_depIdxs = []int32{ +var file_reputation_grpc_service_proto_depIdxs = []int32{ 4, // 0: neo.fs.v2.reputation.AnnounceLocalTrustRequest.body:type_name -> neo.fs.v2.reputation.AnnounceLocalTrustRequest.Body 8, // 1: neo.fs.v2.reputation.AnnounceLocalTrustRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader 9, // 2: neo.fs.v2.reputation.AnnounceLocalTrustRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader @@ -683,14 +683,14 @@ var file_v2_reputation_grpc_service_proto_depIdxs = []int32{ 0, // [0:14] is the sub-list for field type_name } -func init() { file_v2_reputation_grpc_service_proto_init() } -func file_v2_reputation_grpc_service_proto_init() { - if File_v2_reputation_grpc_service_proto != nil { +func init() { file_reputation_grpc_service_proto_init() } +func file_reputation_grpc_service_proto_init() { + if File_reputation_grpc_service_proto != nil { return } - file_v2_reputation_grpc_types_proto_init() + file_reputation_grpc_types_proto_init() if !protoimpl.UnsafeEnabled { - file_v2_reputation_grpc_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_reputation_grpc_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*AnnounceLocalTrustRequest); i { case 0: return &v.state @@ -702,7 +702,7 @@ func file_v2_reputation_grpc_service_proto_init() { return nil } } - file_v2_reputation_grpc_service_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_reputation_grpc_service_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*AnnounceLocalTrustResponse); i { case 0: return &v.state @@ -714,7 +714,7 @@ func file_v2_reputation_grpc_service_proto_init() { return nil } } - file_v2_reputation_grpc_service_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + file_reputation_grpc_service_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*AnnounceIntermediateResultRequest); i { case 0: return &v.state @@ -726,7 +726,7 @@ func file_v2_reputation_grpc_service_proto_init() { return nil } } - file_v2_reputation_grpc_service_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + file_reputation_grpc_service_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*AnnounceIntermediateResultResponse); i { case 0: return &v.state @@ -738,7 +738,7 @@ func file_v2_reputation_grpc_service_proto_init() { return nil } } - file_v2_reputation_grpc_service_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + file_reputation_grpc_service_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*AnnounceLocalTrustRequest_Body); i { case 0: return &v.state @@ -750,7 +750,7 @@ func file_v2_reputation_grpc_service_proto_init() { return nil } } - file_v2_reputation_grpc_service_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + file_reputation_grpc_service_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*AnnounceLocalTrustResponse_Body); i { case 0: return &v.state @@ -762,7 +762,7 @@ func file_v2_reputation_grpc_service_proto_init() { return nil } } - file_v2_reputation_grpc_service_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + file_reputation_grpc_service_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*AnnounceIntermediateResultRequest_Body); i { case 0: return &v.state @@ -774,7 +774,7 @@ func file_v2_reputation_grpc_service_proto_init() { return nil } } - file_v2_reputation_grpc_service_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + file_reputation_grpc_service_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*AnnounceIntermediateResultResponse_Body); i { case 0: return &v.state @@ -791,18 +791,18 @@ func file_v2_reputation_grpc_service_proto_init() { out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_v2_reputation_grpc_service_proto_rawDesc, + RawDescriptor: file_reputation_grpc_service_proto_rawDesc, NumEnums: 0, NumMessages: 8, NumExtensions: 0, NumServices: 1, }, - GoTypes: file_v2_reputation_grpc_service_proto_goTypes, - DependencyIndexes: file_v2_reputation_grpc_service_proto_depIdxs, - MessageInfos: file_v2_reputation_grpc_service_proto_msgTypes, + GoTypes: file_reputation_grpc_service_proto_goTypes, + DependencyIndexes: file_reputation_grpc_service_proto_depIdxs, + MessageInfos: file_reputation_grpc_service_proto_msgTypes, }.Build() - File_v2_reputation_grpc_service_proto = out.File - file_v2_reputation_grpc_service_proto_rawDesc = nil - file_v2_reputation_grpc_service_proto_goTypes = nil - file_v2_reputation_grpc_service_proto_depIdxs = nil + File_reputation_grpc_service_proto = out.File + file_reputation_grpc_service_proto_rawDesc = nil + file_reputation_grpc_service_proto_goTypes = nil + file_reputation_grpc_service_proto_depIdxs = nil } diff --git a/reputation/grpc/service_grpc.pb.go b/reputation/grpc/service_grpc.pb.go index 8713df7..b260785 100644 --- a/reputation/grpc/service_grpc.pb.go +++ b/reputation/grpc/service_grpc.pb.go @@ -157,5 +157,5 @@ var ReputationService_ServiceDesc = grpc.ServiceDesc{ }, }, Streams: []grpc.StreamDesc{}, - Metadata: "v2/reputation/grpc/service.proto", + Metadata: "reputation/grpc/service.proto", } diff --git a/reputation/grpc/types.pb.go b/reputation/grpc/types.pb.go index 009df3b..be5185e 100644 --- a/reputation/grpc/types.pb.go +++ b/reputation/grpc/types.pb.go @@ -2,7 +2,7 @@ // versions: // protoc-gen-go v1.27.1 // protoc v3.18.0 -// source: v2/reputation/grpc/types.proto +// source: reputation/grpc/types.proto package reputation @@ -44,7 +44,7 @@ type PeerID struct { func (x *PeerID) Reset() { *x = PeerID{} if protoimpl.UnsafeEnabled { - mi := &file_v2_reputation_grpc_types_proto_msgTypes[0] + mi := &file_reputation_grpc_types_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -57,7 +57,7 @@ func (x *PeerID) String() string { func (*PeerID) ProtoMessage() {} func (x *PeerID) ProtoReflect() protoreflect.Message { - mi := &file_v2_reputation_grpc_types_proto_msgTypes[0] + mi := &file_reputation_grpc_types_proto_msgTypes[0] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -70,7 +70,7 @@ func (x *PeerID) ProtoReflect() protoreflect.Message { // Deprecated: Use PeerID.ProtoReflect.Descriptor instead. func (*PeerID) Descriptor() ([]byte, []int) { - return file_v2_reputation_grpc_types_proto_rawDescGZIP(), []int{0} + return file_reputation_grpc_types_proto_rawDescGZIP(), []int{0} } func (x *PeerID) GetPublicKey() []byte { @@ -95,7 +95,7 @@ type Trust struct { func (x *Trust) Reset() { *x = Trust{} if protoimpl.UnsafeEnabled { - mi := &file_v2_reputation_grpc_types_proto_msgTypes[1] + mi := &file_reputation_grpc_types_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -108,7 +108,7 @@ func (x *Trust) String() string { func (*Trust) ProtoMessage() {} func (x *Trust) ProtoReflect() protoreflect.Message { - mi := &file_v2_reputation_grpc_types_proto_msgTypes[1] + mi := &file_reputation_grpc_types_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -121,7 +121,7 @@ func (x *Trust) ProtoReflect() protoreflect.Message { // Deprecated: Use Trust.ProtoReflect.Descriptor instead. func (*Trust) Descriptor() ([]byte, []int) { - return file_v2_reputation_grpc_types_proto_rawDescGZIP(), []int{1} + return file_reputation_grpc_types_proto_rawDescGZIP(), []int{1} } func (x *Trust) GetPeer() *PeerID { @@ -153,7 +153,7 @@ type PeerToPeerTrust struct { func (x *PeerToPeerTrust) Reset() { *x = PeerToPeerTrust{} if protoimpl.UnsafeEnabled { - mi := &file_v2_reputation_grpc_types_proto_msgTypes[2] + mi := &file_reputation_grpc_types_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -166,7 +166,7 @@ func (x *PeerToPeerTrust) String() string { func (*PeerToPeerTrust) ProtoMessage() {} func (x *PeerToPeerTrust) ProtoReflect() protoreflect.Message { - mi := &file_v2_reputation_grpc_types_proto_msgTypes[2] + mi := &file_reputation_grpc_types_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -179,7 +179,7 @@ func (x *PeerToPeerTrust) ProtoReflect() protoreflect.Message { // Deprecated: Use PeerToPeerTrust.ProtoReflect.Descriptor instead. func (*PeerToPeerTrust) Descriptor() ([]byte, []int) { - return file_v2_reputation_grpc_types_proto_rawDescGZIP(), []int{2} + return file_reputation_grpc_types_proto_rawDescGZIP(), []int{2} } func (x *PeerToPeerTrust) GetTrustingPeer() *PeerID { @@ -214,7 +214,7 @@ type GlobalTrust struct { func (x *GlobalTrust) Reset() { *x = GlobalTrust{} if protoimpl.UnsafeEnabled { - mi := &file_v2_reputation_grpc_types_proto_msgTypes[3] + mi := &file_reputation_grpc_types_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -227,7 +227,7 @@ func (x *GlobalTrust) String() string { func (*GlobalTrust) ProtoMessage() {} func (x *GlobalTrust) ProtoReflect() protoreflect.Message { - mi := &file_v2_reputation_grpc_types_proto_msgTypes[3] + mi := &file_reputation_grpc_types_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -240,7 +240,7 @@ func (x *GlobalTrust) ProtoReflect() protoreflect.Message { // Deprecated: Use GlobalTrust.ProtoReflect.Descriptor instead. func (*GlobalTrust) Descriptor() ([]byte, []int) { - return file_v2_reputation_grpc_types_proto_rawDescGZIP(), []int{3} + return file_reputation_grpc_types_proto_rawDescGZIP(), []int{3} } func (x *GlobalTrust) GetVersion() *grpc.Version { @@ -279,7 +279,7 @@ type GlobalTrust_Body struct { func (x *GlobalTrust_Body) Reset() { *x = GlobalTrust_Body{} if protoimpl.UnsafeEnabled { - mi := &file_v2_reputation_grpc_types_proto_msgTypes[4] + mi := &file_reputation_grpc_types_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -292,7 +292,7 @@ func (x *GlobalTrust_Body) String() string { func (*GlobalTrust_Body) ProtoMessage() {} func (x *GlobalTrust_Body) ProtoReflect() protoreflect.Message { - mi := &file_v2_reputation_grpc_types_proto_msgTypes[4] + mi := &file_reputation_grpc_types_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -305,7 +305,7 @@ func (x *GlobalTrust_Body) ProtoReflect() protoreflect.Message { // Deprecated: Use GlobalTrust_Body.ProtoReflect.Descriptor instead. func (*GlobalTrust_Body) Descriptor() ([]byte, []int) { - return file_v2_reputation_grpc_types_proto_rawDescGZIP(), []int{3, 0} + return file_reputation_grpc_types_proto_rawDescGZIP(), []int{3, 0} } func (x *GlobalTrust_Body) GetManager() *PeerID { @@ -322,72 +322,72 @@ func (x *GlobalTrust_Body) GetTrust() *Trust { return nil } -var File_v2_reputation_grpc_types_proto protoreflect.FileDescriptor +var File_reputation_grpc_types_proto protoreflect.FileDescriptor -var file_v2_reputation_grpc_types_proto_rawDesc = []byte{ - 0x0a, 0x1e, 0x76, 0x32, 0x2f, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 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, 0x72, 0x65, 0x70, 0x75, - 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0x18, 0x76, 0x32, 0x2f, 0x72, 0x65, 0x66, 0x73, 0x2f, - 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x22, 0x27, 0x0a, 0x06, 0x50, 0x65, 0x65, 0x72, 0x49, 0x44, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x75, - 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, - 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x22, 0x4f, 0x0a, 0x05, 0x54, 0x72, 0x75, - 0x73, 0x74, 0x12, 0x30, 0x0a, 0x04, 0x70, 0x65, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x1c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, - 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x49, 0x44, 0x52, 0x04, - 0x70, 0x65, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x87, 0x01, 0x0a, 0x0f, 0x50, - 0x65, 0x65, 0x72, 0x54, 0x6f, 0x50, 0x65, 0x65, 0x72, 0x54, 0x72, 0x75, 0x73, 0x74, 0x12, 0x41, - 0x0a, 0x0d, 0x74, 0x72, 0x75, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x5f, 0x70, 0x65, 0x65, 0x72, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, - 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x50, 0x65, 0x65, - 0x72, 0x49, 0x44, 0x52, 0x0c, 0x74, 0x72, 0x75, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x50, 0x65, 0x65, - 0x72, 0x12, 0x31, 0x0a, 0x05, 0x74, 0x72, 0x75, 0x73, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, - 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x54, 0x72, 0x75, 0x73, 0x74, 0x52, 0x05, 0x74, - 0x72, 0x75, 0x73, 0x74, 0x22, 0xa8, 0x02, 0x0a, 0x0b, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x54, - 0x72, 0x75, 0x73, 0x74, 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, 0x3a, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, - 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x47, 0x6c, 0x6f, - 0x62, 0x61, 0x6c, 0x54, 0x72, 0x75, 0x73, 0x74, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, - 0x6f, 0x64, 0x79, 0x12, 0x37, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, - 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, - 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x1a, 0x71, 0x0a, 0x04, - 0x42, 0x6f, 0x64, 0x79, 0x12, 0x36, 0x0a, 0x07, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, - 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x50, 0x65, 0x65, - 0x72, 0x49, 0x44, 0x52, 0x07, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x12, 0x31, 0x0a, 0x05, - 0x74, 0x72, 0x75, 0x73, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, - 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x2e, 0x54, 0x72, 0x75, 0x73, 0x74, 0x52, 0x05, 0x74, 0x72, 0x75, 0x73, 0x74, 0x42, - 0x62, 0x5a, 0x3f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, - 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, - 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0xaa, 0x02, 0x1e, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, - 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x52, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +var file_reputation_grpc_types_proto_rawDesc = []byte{ + 0x0a, 0x1b, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 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, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x1a, 0x15, 0x72, 0x65, 0x66, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, + 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x27, 0x0a, 0x06, 0x50, 0x65, + 0x65, 0x72, 0x49, 0x44, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, + 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, + 0x4b, 0x65, 0x79, 0x22, 0x4f, 0x0a, 0x05, 0x54, 0x72, 0x75, 0x73, 0x74, 0x12, 0x30, 0x0a, 0x04, + 0x70, 0x65, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x6e, 0x65, 0x6f, + 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x49, 0x44, 0x52, 0x04, 0x70, 0x65, 0x65, 0x72, 0x12, 0x14, + 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x01, 0x52, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x22, 0x87, 0x01, 0x0a, 0x0f, 0x50, 0x65, 0x65, 0x72, 0x54, 0x6f, 0x50, + 0x65, 0x65, 0x72, 0x54, 0x72, 0x75, 0x73, 0x74, 0x12, 0x41, 0x0a, 0x0d, 0x74, 0x72, 0x75, 0x73, + 0x74, 0x69, 0x6e, 0x67, 0x5f, 0x70, 0x65, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x1c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, + 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x49, 0x44, 0x52, 0x0c, 0x74, + 0x72, 0x75, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x50, 0x65, 0x65, 0x72, 0x12, 0x31, 0x0a, 0x05, 0x74, + 0x72, 0x75, 0x73, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, + 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x2e, 0x54, 0x72, 0x75, 0x73, 0x74, 0x52, 0x05, 0x74, 0x72, 0x75, 0x73, 0x74, 0x22, 0xa8, + 0x02, 0x0a, 0x0b, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x54, 0x72, 0x75, 0x73, 0x74, 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, 0x3a, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x26, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, + 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x54, 0x72, 0x75, + 0x73, 0x74, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x37, 0x0a, + 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, + 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, + 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x1a, 0x71, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x36, + 0x0a, 0x07, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x1c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, + 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x49, 0x44, 0x52, 0x07, 0x6d, + 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x12, 0x31, 0x0a, 0x05, 0x74, 0x72, 0x75, 0x73, 0x74, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x54, 0x72, 0x75, + 0x73, 0x74, 0x52, 0x05, 0x74, 0x72, 0x75, 0x73, 0x74, 0x42, 0x62, 0x5a, 0x3f, 0x67, 0x69, 0x74, + 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, + 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, + 0x32, 0x2f, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x67, 0x72, 0x70, + 0x63, 0x3b, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xaa, 0x02, 0x1e, 0x4e, + 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, + 0x50, 0x49, 0x2e, 0x52, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( - file_v2_reputation_grpc_types_proto_rawDescOnce sync.Once - file_v2_reputation_grpc_types_proto_rawDescData = file_v2_reputation_grpc_types_proto_rawDesc + file_reputation_grpc_types_proto_rawDescOnce sync.Once + file_reputation_grpc_types_proto_rawDescData = file_reputation_grpc_types_proto_rawDesc ) -func file_v2_reputation_grpc_types_proto_rawDescGZIP() []byte { - file_v2_reputation_grpc_types_proto_rawDescOnce.Do(func() { - file_v2_reputation_grpc_types_proto_rawDescData = protoimpl.X.CompressGZIP(file_v2_reputation_grpc_types_proto_rawDescData) +func file_reputation_grpc_types_proto_rawDescGZIP() []byte { + file_reputation_grpc_types_proto_rawDescOnce.Do(func() { + file_reputation_grpc_types_proto_rawDescData = protoimpl.X.CompressGZIP(file_reputation_grpc_types_proto_rawDescData) }) - return file_v2_reputation_grpc_types_proto_rawDescData + return file_reputation_grpc_types_proto_rawDescData } -var file_v2_reputation_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 5) -var file_v2_reputation_grpc_types_proto_goTypes = []interface{}{ +var file_reputation_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 5) +var file_reputation_grpc_types_proto_goTypes = []interface{}{ (*PeerID)(nil), // 0: neo.fs.v2.reputation.PeerID (*Trust)(nil), // 1: neo.fs.v2.reputation.Trust (*PeerToPeerTrust)(nil), // 2: neo.fs.v2.reputation.PeerToPeerTrust @@ -396,7 +396,7 @@ var file_v2_reputation_grpc_types_proto_goTypes = []interface{}{ (*grpc.Version)(nil), // 5: neo.fs.v2.refs.Version (*grpc.Signature)(nil), // 6: neo.fs.v2.refs.Signature } -var file_v2_reputation_grpc_types_proto_depIdxs = []int32{ +var file_reputation_grpc_types_proto_depIdxs = []int32{ 0, // 0: neo.fs.v2.reputation.Trust.peer:type_name -> neo.fs.v2.reputation.PeerID 0, // 1: neo.fs.v2.reputation.PeerToPeerTrust.trusting_peer:type_name -> neo.fs.v2.reputation.PeerID 1, // 2: neo.fs.v2.reputation.PeerToPeerTrust.trust:type_name -> neo.fs.v2.reputation.Trust @@ -412,13 +412,13 @@ var file_v2_reputation_grpc_types_proto_depIdxs = []int32{ 0, // [0:8] is the sub-list for field type_name } -func init() { file_v2_reputation_grpc_types_proto_init() } -func file_v2_reputation_grpc_types_proto_init() { - if File_v2_reputation_grpc_types_proto != nil { +func init() { file_reputation_grpc_types_proto_init() } +func file_reputation_grpc_types_proto_init() { + if File_reputation_grpc_types_proto != nil { return } if !protoimpl.UnsafeEnabled { - file_v2_reputation_grpc_types_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_reputation_grpc_types_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PeerID); i { case 0: return &v.state @@ -430,7 +430,7 @@ func file_v2_reputation_grpc_types_proto_init() { return nil } } - file_v2_reputation_grpc_types_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_reputation_grpc_types_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Trust); i { case 0: return &v.state @@ -442,7 +442,7 @@ func file_v2_reputation_grpc_types_proto_init() { return nil } } - file_v2_reputation_grpc_types_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + file_reputation_grpc_types_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PeerToPeerTrust); i { case 0: return &v.state @@ -454,7 +454,7 @@ func file_v2_reputation_grpc_types_proto_init() { return nil } } - file_v2_reputation_grpc_types_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + file_reputation_grpc_types_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GlobalTrust); i { case 0: return &v.state @@ -466,7 +466,7 @@ func file_v2_reputation_grpc_types_proto_init() { return nil } } - file_v2_reputation_grpc_types_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + file_reputation_grpc_types_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GlobalTrust_Body); i { case 0: return &v.state @@ -483,18 +483,18 @@ func file_v2_reputation_grpc_types_proto_init() { out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_v2_reputation_grpc_types_proto_rawDesc, + RawDescriptor: file_reputation_grpc_types_proto_rawDesc, NumEnums: 0, NumMessages: 5, NumExtensions: 0, NumServices: 0, }, - GoTypes: file_v2_reputation_grpc_types_proto_goTypes, - DependencyIndexes: file_v2_reputation_grpc_types_proto_depIdxs, - MessageInfos: file_v2_reputation_grpc_types_proto_msgTypes, + GoTypes: file_reputation_grpc_types_proto_goTypes, + DependencyIndexes: file_reputation_grpc_types_proto_depIdxs, + MessageInfos: file_reputation_grpc_types_proto_msgTypes, }.Build() - File_v2_reputation_grpc_types_proto = out.File - file_v2_reputation_grpc_types_proto_rawDesc = nil - file_v2_reputation_grpc_types_proto_goTypes = nil - file_v2_reputation_grpc_types_proto_depIdxs = nil + File_reputation_grpc_types_proto = out.File + file_reputation_grpc_types_proto_rawDesc = nil + file_reputation_grpc_types_proto_goTypes = nil + file_reputation_grpc_types_proto_depIdxs = nil } diff --git a/session/grpc/service.pb.go b/session/grpc/service.pb.go index 6851176..914f9af 100644 --- a/session/grpc/service.pb.go +++ b/session/grpc/service.pb.go @@ -2,7 +2,7 @@ // versions: // protoc-gen-go v1.27.1 // protoc v3.18.0 -// source: v2/session/grpc/service.proto +// source: session/grpc/service.proto package session @@ -41,7 +41,7 @@ type CreateRequest struct { func (x *CreateRequest) Reset() { *x = CreateRequest{} if protoimpl.UnsafeEnabled { - mi := &file_v2_session_grpc_service_proto_msgTypes[0] + mi := &file_session_grpc_service_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -54,7 +54,7 @@ func (x *CreateRequest) String() string { func (*CreateRequest) ProtoMessage() {} func (x *CreateRequest) ProtoReflect() protoreflect.Message { - mi := &file_v2_session_grpc_service_proto_msgTypes[0] + mi := &file_session_grpc_service_proto_msgTypes[0] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -67,7 +67,7 @@ func (x *CreateRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use CreateRequest.ProtoReflect.Descriptor instead. func (*CreateRequest) Descriptor() ([]byte, []int) { - return file_v2_session_grpc_service_proto_rawDescGZIP(), []int{0} + return file_session_grpc_service_proto_rawDescGZIP(), []int{0} } func (x *CreateRequest) GetBody() *CreateRequest_Body { @@ -111,7 +111,7 @@ type CreateResponse struct { func (x *CreateResponse) Reset() { *x = CreateResponse{} if protoimpl.UnsafeEnabled { - mi := &file_v2_session_grpc_service_proto_msgTypes[1] + mi := &file_session_grpc_service_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -124,7 +124,7 @@ func (x *CreateResponse) String() string { func (*CreateResponse) ProtoMessage() {} func (x *CreateResponse) ProtoReflect() protoreflect.Message { - mi := &file_v2_session_grpc_service_proto_msgTypes[1] + mi := &file_session_grpc_service_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -137,7 +137,7 @@ func (x *CreateResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use CreateResponse.ProtoReflect.Descriptor instead. func (*CreateResponse) Descriptor() ([]byte, []int) { - return file_v2_session_grpc_service_proto_rawDescGZIP(), []int{1} + return file_session_grpc_service_proto_rawDescGZIP(), []int{1} } func (x *CreateResponse) GetBody() *CreateResponse_Body { @@ -176,7 +176,7 @@ type CreateRequest_Body struct { func (x *CreateRequest_Body) Reset() { *x = CreateRequest_Body{} if protoimpl.UnsafeEnabled { - mi := &file_v2_session_grpc_service_proto_msgTypes[2] + mi := &file_session_grpc_service_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -189,7 +189,7 @@ func (x *CreateRequest_Body) String() string { func (*CreateRequest_Body) ProtoMessage() {} func (x *CreateRequest_Body) ProtoReflect() protoreflect.Message { - mi := &file_v2_session_grpc_service_proto_msgTypes[2] + mi := &file_session_grpc_service_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -202,7 +202,7 @@ func (x *CreateRequest_Body) ProtoReflect() protoreflect.Message { // Deprecated: Use CreateRequest_Body.ProtoReflect.Descriptor instead. func (*CreateRequest_Body) Descriptor() ([]byte, []int) { - return file_v2_session_grpc_service_proto_rawDescGZIP(), []int{0, 0} + return file_session_grpc_service_proto_rawDescGZIP(), []int{0, 0} } func (x *CreateRequest_Body) GetOwnerId() *grpc.OwnerID { @@ -234,7 +234,7 @@ type CreateResponse_Body struct { func (x *CreateResponse_Body) Reset() { *x = CreateResponse_Body{} if protoimpl.UnsafeEnabled { - mi := &file_v2_session_grpc_service_proto_msgTypes[3] + mi := &file_session_grpc_service_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -247,7 +247,7 @@ func (x *CreateResponse_Body) String() string { func (*CreateResponse_Body) ProtoMessage() {} func (x *CreateResponse_Body) ProtoReflect() protoreflect.Message { - mi := &file_v2_session_grpc_service_proto_msgTypes[3] + mi := &file_session_grpc_service_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -260,7 +260,7 @@ func (x *CreateResponse_Body) ProtoReflect() protoreflect.Message { // Deprecated: Use CreateResponse_Body.ProtoReflect.Descriptor instead. func (*CreateResponse_Body) Descriptor() ([]byte, []int) { - return file_v2_session_grpc_service_proto_rawDescGZIP(), []int{1, 0} + return file_session_grpc_service_proto_rawDescGZIP(), []int{1, 0} } func (x *CreateResponse_Body) GetId() []byte { @@ -277,83 +277,82 @@ func (x *CreateResponse_Body) GetSessionKey() []byte { return nil } -var File_v2_session_grpc_service_proto protoreflect.FileDescriptor +var File_session_grpc_service_proto protoreflect.FileDescriptor -var file_v2_session_grpc_service_proto_rawDesc = []byte{ - 0x0a, 0x1d, 0x76, 0x32, 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, 0x18, 0x76, 0x32, 0x2f, 0x72, 0x65, 0x66, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, - 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x76, 0x32, - 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, +var file_session_grpc_service_proto_rawDesc = []byte{ + 0x0a, 0x1a, 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, + 0x15, 0x72, 0x65, 0x66, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x18, 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, 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, + 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, 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, 0x59, 0x5a, 0x39, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, - 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, - 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 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, 0x06, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, + 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, 0x59, 0x5a, 0x39, 0x67, 0x69, 0x74, 0x68, + 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, + 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, + 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, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( - file_v2_session_grpc_service_proto_rawDescOnce sync.Once - file_v2_session_grpc_service_proto_rawDescData = file_v2_session_grpc_service_proto_rawDesc + file_session_grpc_service_proto_rawDescOnce sync.Once + file_session_grpc_service_proto_rawDescData = file_session_grpc_service_proto_rawDesc ) -func file_v2_session_grpc_service_proto_rawDescGZIP() []byte { - file_v2_session_grpc_service_proto_rawDescOnce.Do(func() { - file_v2_session_grpc_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_v2_session_grpc_service_proto_rawDescData) +func file_session_grpc_service_proto_rawDescGZIP() []byte { + file_session_grpc_service_proto_rawDescOnce.Do(func() { + file_session_grpc_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_session_grpc_service_proto_rawDescData) }) - return file_v2_session_grpc_service_proto_rawDescData + return file_session_grpc_service_proto_rawDescData } -var file_v2_session_grpc_service_proto_msgTypes = make([]protoimpl.MessageInfo, 4) -var file_v2_session_grpc_service_proto_goTypes = []interface{}{ +var file_session_grpc_service_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_session_grpc_service_proto_goTypes = []interface{}{ (*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 @@ -364,7 +363,7 @@ var file_v2_session_grpc_service_proto_goTypes = []interface{}{ (*ResponseVerificationHeader)(nil), // 7: neo.fs.v2.session.ResponseVerificationHeader (*grpc.OwnerID)(nil), // 8: neo.fs.v2.refs.OwnerID } -var file_v2_session_grpc_service_proto_depIdxs = []int32{ +var file_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 @@ -381,14 +380,14 @@ var file_v2_session_grpc_service_proto_depIdxs = []int32{ 0, // [0:7] is the sub-list for field type_name } -func init() { file_v2_session_grpc_service_proto_init() } -func file_v2_session_grpc_service_proto_init() { - if File_v2_session_grpc_service_proto != nil { +func init() { file_session_grpc_service_proto_init() } +func file_session_grpc_service_proto_init() { + if File_session_grpc_service_proto != nil { return } - file_v2_session_grpc_types_proto_init() + file_session_grpc_types_proto_init() if !protoimpl.UnsafeEnabled { - file_v2_session_grpc_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_session_grpc_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*CreateRequest); i { case 0: return &v.state @@ -400,7 +399,7 @@ func file_v2_session_grpc_service_proto_init() { return nil } } - file_v2_session_grpc_service_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_session_grpc_service_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*CreateResponse); i { case 0: return &v.state @@ -412,7 +411,7 @@ func file_v2_session_grpc_service_proto_init() { return nil } } - file_v2_session_grpc_service_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + file_session_grpc_service_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*CreateRequest_Body); i { case 0: return &v.state @@ -424,7 +423,7 @@ func file_v2_session_grpc_service_proto_init() { return nil } } - file_v2_session_grpc_service_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + file_session_grpc_service_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*CreateResponse_Body); i { case 0: return &v.state @@ -441,18 +440,18 @@ func file_v2_session_grpc_service_proto_init() { out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_v2_session_grpc_service_proto_rawDesc, + RawDescriptor: file_session_grpc_service_proto_rawDesc, NumEnums: 0, NumMessages: 4, NumExtensions: 0, NumServices: 1, }, - GoTypes: file_v2_session_grpc_service_proto_goTypes, - DependencyIndexes: file_v2_session_grpc_service_proto_depIdxs, - MessageInfos: file_v2_session_grpc_service_proto_msgTypes, + GoTypes: file_session_grpc_service_proto_goTypes, + DependencyIndexes: file_session_grpc_service_proto_depIdxs, + MessageInfos: file_session_grpc_service_proto_msgTypes, }.Build() - File_v2_session_grpc_service_proto = out.File - file_v2_session_grpc_service_proto_rawDesc = nil - file_v2_session_grpc_service_proto_goTypes = nil - file_v2_session_grpc_service_proto_depIdxs = nil + File_session_grpc_service_proto = out.File + file_session_grpc_service_proto_rawDesc = nil + file_session_grpc_service_proto_goTypes = nil + file_session_grpc_service_proto_depIdxs = nil } diff --git a/session/grpc/service_grpc.pb.go b/session/grpc/service_grpc.pb.go index a6bc2bd..cb72826 100644 --- a/session/grpc/service_grpc.pb.go +++ b/session/grpc/service_grpc.pb.go @@ -107,5 +107,5 @@ var SessionService_ServiceDesc = grpc.ServiceDesc{ }, }, Streams: []grpc.StreamDesc{}, - Metadata: "v2/session/grpc/service.proto", + Metadata: "session/grpc/service.proto", } diff --git a/session/grpc/types.pb.go b/session/grpc/types.pb.go index 3977511..eb7c25b 100644 --- a/session/grpc/types.pb.go +++ b/session/grpc/types.pb.go @@ -2,7 +2,7 @@ // versions: // protoc-gen-go v1.27.1 // protoc v3.18.0 -// source: v2/session/grpc/types.proto +// source: session/grpc/types.proto package session @@ -80,11 +80,11 @@ func (x ObjectSessionContext_Verb) String() string { } func (ObjectSessionContext_Verb) Descriptor() protoreflect.EnumDescriptor { - return file_v2_session_grpc_types_proto_enumTypes[0].Descriptor() + return file_session_grpc_types_proto_enumTypes[0].Descriptor() } func (ObjectSessionContext_Verb) Type() protoreflect.EnumType { - return &file_v2_session_grpc_types_proto_enumTypes[0] + return &file_session_grpc_types_proto_enumTypes[0] } func (x ObjectSessionContext_Verb) Number() protoreflect.EnumNumber { @@ -93,7 +93,7 @@ func (x ObjectSessionContext_Verb) Number() protoreflect.EnumNumber { // Deprecated: Use ObjectSessionContext_Verb.Descriptor instead. func (ObjectSessionContext_Verb) EnumDescriptor() ([]byte, []int) { - return file_v2_session_grpc_types_proto_rawDescGZIP(), []int{0, 0} + return file_session_grpc_types_proto_rawDescGZIP(), []int{0, 0} } // Container request verbs @@ -137,11 +137,11 @@ func (x ContainerSessionContext_Verb) String() string { } func (ContainerSessionContext_Verb) Descriptor() protoreflect.EnumDescriptor { - return file_v2_session_grpc_types_proto_enumTypes[1].Descriptor() + return file_session_grpc_types_proto_enumTypes[1].Descriptor() } func (ContainerSessionContext_Verb) Type() protoreflect.EnumType { - return &file_v2_session_grpc_types_proto_enumTypes[1] + return &file_session_grpc_types_proto_enumTypes[1] } func (x ContainerSessionContext_Verb) Number() protoreflect.EnumNumber { @@ -150,7 +150,7 @@ func (x ContainerSessionContext_Verb) Number() protoreflect.EnumNumber { // Deprecated: Use ContainerSessionContext_Verb.Descriptor instead. func (ContainerSessionContext_Verb) EnumDescriptor() ([]byte, []int) { - return file_v2_session_grpc_types_proto_rawDescGZIP(), []int{1, 0} + return file_session_grpc_types_proto_rawDescGZIP(), []int{1, 0} } // Context information for Session Tokens related to ObjectService requests @@ -168,7 +168,7 @@ type ObjectSessionContext struct { func (x *ObjectSessionContext) Reset() { *x = ObjectSessionContext{} if protoimpl.UnsafeEnabled { - mi := &file_v2_session_grpc_types_proto_msgTypes[0] + mi := &file_session_grpc_types_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -181,7 +181,7 @@ func (x *ObjectSessionContext) String() string { func (*ObjectSessionContext) ProtoMessage() {} func (x *ObjectSessionContext) ProtoReflect() protoreflect.Message { - mi := &file_v2_session_grpc_types_proto_msgTypes[0] + mi := &file_session_grpc_types_proto_msgTypes[0] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -194,7 +194,7 @@ func (x *ObjectSessionContext) ProtoReflect() protoreflect.Message { // Deprecated: Use ObjectSessionContext.ProtoReflect.Descriptor instead. func (*ObjectSessionContext) Descriptor() ([]byte, []int) { - return file_v2_session_grpc_types_proto_rawDescGZIP(), []int{0} + return file_session_grpc_types_proto_rawDescGZIP(), []int{0} } func (x *ObjectSessionContext) GetVerb() ObjectSessionContext_Verb { @@ -230,7 +230,7 @@ type ContainerSessionContext struct { func (x *ContainerSessionContext) Reset() { *x = ContainerSessionContext{} if protoimpl.UnsafeEnabled { - mi := &file_v2_session_grpc_types_proto_msgTypes[1] + mi := &file_session_grpc_types_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -243,7 +243,7 @@ func (x *ContainerSessionContext) String() string { func (*ContainerSessionContext) ProtoMessage() {} func (x *ContainerSessionContext) ProtoReflect() protoreflect.Message { - mi := &file_v2_session_grpc_types_proto_msgTypes[1] + mi := &file_session_grpc_types_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -256,7 +256,7 @@ func (x *ContainerSessionContext) ProtoReflect() protoreflect.Message { // Deprecated: Use ContainerSessionContext.ProtoReflect.Descriptor instead. func (*ContainerSessionContext) Descriptor() ([]byte, []int) { - return file_v2_session_grpc_types_proto_rawDescGZIP(), []int{1} + return file_session_grpc_types_proto_rawDescGZIP(), []int{1} } func (x *ContainerSessionContext) GetVerb() ContainerSessionContext_Verb { @@ -297,7 +297,7 @@ type SessionToken struct { func (x *SessionToken) Reset() { *x = SessionToken{} if protoimpl.UnsafeEnabled { - mi := &file_v2_session_grpc_types_proto_msgTypes[2] + mi := &file_session_grpc_types_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -310,7 +310,7 @@ func (x *SessionToken) String() string { func (*SessionToken) ProtoMessage() {} func (x *SessionToken) ProtoReflect() protoreflect.Message { - mi := &file_v2_session_grpc_types_proto_msgTypes[2] + mi := &file_session_grpc_types_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -323,7 +323,7 @@ func (x *SessionToken) ProtoReflect() protoreflect.Message { // Deprecated: Use SessionToken.ProtoReflect.Descriptor instead. func (*SessionToken) Descriptor() ([]byte, []int) { - return file_v2_session_grpc_types_proto_rawDescGZIP(), []int{2} + return file_session_grpc_types_proto_rawDescGZIP(), []int{2} } func (x *SessionToken) GetBody() *SessionToken_Body { @@ -373,7 +373,7 @@ type XHeader struct { func (x *XHeader) Reset() { *x = XHeader{} if protoimpl.UnsafeEnabled { - mi := &file_v2_session_grpc_types_proto_msgTypes[3] + mi := &file_session_grpc_types_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -386,7 +386,7 @@ func (x *XHeader) String() string { func (*XHeader) ProtoMessage() {} func (x *XHeader) ProtoReflect() protoreflect.Message { - mi := &file_v2_session_grpc_types_proto_msgTypes[3] + mi := &file_session_grpc_types_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -399,7 +399,7 @@ func (x *XHeader) ProtoReflect() protoreflect.Message { // Deprecated: Use XHeader.ProtoReflect.Descriptor instead. func (*XHeader) Descriptor() ([]byte, []int) { - return file_v2_session_grpc_types_proto_rawDescGZIP(), []int{3} + return file_session_grpc_types_proto_rawDescGZIP(), []int{3} } func (x *XHeader) GetKey() string { @@ -442,7 +442,7 @@ type RequestMetaHeader struct { func (x *RequestMetaHeader) Reset() { *x = RequestMetaHeader{} if protoimpl.UnsafeEnabled { - mi := &file_v2_session_grpc_types_proto_msgTypes[4] + mi := &file_session_grpc_types_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -455,7 +455,7 @@ func (x *RequestMetaHeader) String() string { func (*RequestMetaHeader) ProtoMessage() {} func (x *RequestMetaHeader) ProtoReflect() protoreflect.Message { - mi := &file_v2_session_grpc_types_proto_msgTypes[4] + mi := &file_session_grpc_types_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -468,7 +468,7 @@ func (x *RequestMetaHeader) ProtoReflect() protoreflect.Message { // Deprecated: Use RequestMetaHeader.ProtoReflect.Descriptor instead. func (*RequestMetaHeader) Descriptor() ([]byte, []int) { - return file_v2_session_grpc_types_proto_rawDescGZIP(), []int{4} + return file_session_grpc_types_proto_rawDescGZIP(), []int{4} } func (x *RequestMetaHeader) GetVersion() *grpc.Version { @@ -543,7 +543,7 @@ type ResponseMetaHeader struct { func (x *ResponseMetaHeader) Reset() { *x = ResponseMetaHeader{} if protoimpl.UnsafeEnabled { - mi := &file_v2_session_grpc_types_proto_msgTypes[5] + mi := &file_session_grpc_types_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -556,7 +556,7 @@ func (x *ResponseMetaHeader) String() string { func (*ResponseMetaHeader) ProtoMessage() {} func (x *ResponseMetaHeader) ProtoReflect() protoreflect.Message { - mi := &file_v2_session_grpc_types_proto_msgTypes[5] + mi := &file_session_grpc_types_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -569,7 +569,7 @@ func (x *ResponseMetaHeader) ProtoReflect() protoreflect.Message { // Deprecated: Use ResponseMetaHeader.ProtoReflect.Descriptor instead. func (*ResponseMetaHeader) Descriptor() ([]byte, []int) { - return file_v2_session_grpc_types_proto_rawDescGZIP(), []int{5} + return file_session_grpc_types_proto_rawDescGZIP(), []int{5} } func (x *ResponseMetaHeader) GetVersion() *grpc.Version { @@ -633,7 +633,7 @@ type RequestVerificationHeader struct { func (x *RequestVerificationHeader) Reset() { *x = RequestVerificationHeader{} if protoimpl.UnsafeEnabled { - mi := &file_v2_session_grpc_types_proto_msgTypes[6] + mi := &file_session_grpc_types_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -646,7 +646,7 @@ func (x *RequestVerificationHeader) String() string { func (*RequestVerificationHeader) ProtoMessage() {} func (x *RequestVerificationHeader) ProtoReflect() protoreflect.Message { - mi := &file_v2_session_grpc_types_proto_msgTypes[6] + mi := &file_session_grpc_types_proto_msgTypes[6] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -659,7 +659,7 @@ func (x *RequestVerificationHeader) ProtoReflect() protoreflect.Message { // Deprecated: Use RequestVerificationHeader.ProtoReflect.Descriptor instead. func (*RequestVerificationHeader) Descriptor() ([]byte, []int) { - return file_v2_session_grpc_types_proto_rawDescGZIP(), []int{6} + return file_session_grpc_types_proto_rawDescGZIP(), []int{6} } func (x *RequestVerificationHeader) GetBodySignature() *grpc.Signature { @@ -709,7 +709,7 @@ type ResponseVerificationHeader struct { func (x *ResponseVerificationHeader) Reset() { *x = ResponseVerificationHeader{} if protoimpl.UnsafeEnabled { - mi := &file_v2_session_grpc_types_proto_msgTypes[7] + mi := &file_session_grpc_types_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -722,7 +722,7 @@ func (x *ResponseVerificationHeader) String() string { func (*ResponseVerificationHeader) ProtoMessage() {} func (x *ResponseVerificationHeader) ProtoReflect() protoreflect.Message { - mi := &file_v2_session_grpc_types_proto_msgTypes[7] + mi := &file_session_grpc_types_proto_msgTypes[7] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -735,7 +735,7 @@ func (x *ResponseVerificationHeader) ProtoReflect() protoreflect.Message { // Deprecated: Use ResponseVerificationHeader.ProtoReflect.Descriptor instead. func (*ResponseVerificationHeader) Descriptor() ([]byte, []int) { - return file_v2_session_grpc_types_proto_rawDescGZIP(), []int{7} + return file_session_grpc_types_proto_rawDescGZIP(), []int{7} } func (x *ResponseVerificationHeader) GetBodySignature() *grpc.Signature { @@ -791,7 +791,7 @@ type SessionToken_Body struct { func (x *SessionToken_Body) Reset() { *x = SessionToken_Body{} if protoimpl.UnsafeEnabled { - mi := &file_v2_session_grpc_types_proto_msgTypes[8] + mi := &file_session_grpc_types_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -804,7 +804,7 @@ func (x *SessionToken_Body) String() string { func (*SessionToken_Body) ProtoMessage() {} func (x *SessionToken_Body) ProtoReflect() protoreflect.Message { - mi := &file_v2_session_grpc_types_proto_msgTypes[8] + mi := &file_session_grpc_types_proto_msgTypes[8] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -817,7 +817,7 @@ func (x *SessionToken_Body) ProtoReflect() protoreflect.Message { // Deprecated: Use SessionToken_Body.ProtoReflect.Descriptor instead. func (*SessionToken_Body) Descriptor() ([]byte, []int) { - return file_v2_session_grpc_types_proto_rawDescGZIP(), []int{2, 0} + return file_session_grpc_types_proto_rawDescGZIP(), []int{2, 0} } func (x *SessionToken_Body) GetId() []byte { @@ -904,7 +904,7 @@ type SessionToken_Body_TokenLifetime struct { func (x *SessionToken_Body_TokenLifetime) Reset() { *x = SessionToken_Body_TokenLifetime{} if protoimpl.UnsafeEnabled { - mi := &file_v2_session_grpc_types_proto_msgTypes[9] + mi := &file_session_grpc_types_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -917,7 +917,7 @@ func (x *SessionToken_Body_TokenLifetime) String() string { func (*SessionToken_Body_TokenLifetime) ProtoMessage() {} func (x *SessionToken_Body_TokenLifetime) ProtoReflect() protoreflect.Message { - mi := &file_v2_session_grpc_types_proto_msgTypes[9] + mi := &file_session_grpc_types_proto_msgTypes[9] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -930,7 +930,7 @@ func (x *SessionToken_Body_TokenLifetime) ProtoReflect() protoreflect.Message { // Deprecated: Use SessionToken_Body_TokenLifetime.ProtoReflect.Descriptor instead. func (*SessionToken_Body_TokenLifetime) Descriptor() ([]byte, []int) { - return file_v2_session_grpc_types_proto_rawDescGZIP(), []int{2, 0, 0} + return file_session_grpc_types_proto_rawDescGZIP(), []int{2, 0, 0} } func (x *SessionToken_Body_TokenLifetime) GetExp() uint64 { @@ -954,188 +954,187 @@ func (x *SessionToken_Body_TokenLifetime) GetIat() uint64 { return 0 } -var File_v2_session_grpc_types_proto protoreflect.FileDescriptor +var File_session_grpc_types_proto protoreflect.FileDescriptor -var file_v2_session_grpc_types_proto_rawDesc = []byte{ - 0x0a, 0x1b, 0x76, 0x32, 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, 0x12, 0x11, 0x6e, +var file_session_grpc_types_proto_rawDesc = []byte{ + 0x0a, 0x18, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, + 0x79, 0x70, 0x65, 0x73, 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, 0x15, 0x72, + 0x65, 0x66, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x14, 0x61, 0x63, 0x6c, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, + 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x73, 0x74, 0x61, 0x74, + 0x75, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x22, 0xf7, 0x01, 0x0a, 0x14, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x53, 0x65, + 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x12, 0x40, 0x0a, 0x04, + 0x76, 0x65, 0x72, 0x62, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2c, 0x2e, 0x6e, 0x65, 0x6f, + 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x4f, + 0x62, 0x6a, 0x65, 0x63, 0x74, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x74, + 0x65, 0x78, 0x74, 0x2e, 0x56, 0x65, 0x72, 0x62, 0x52, 0x04, 0x76, 0x65, 0x72, 0x62, 0x12, 0x31, + 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x17, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, + 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, + 0x73, 0x22, 0x6a, 0x0a, 0x04, 0x56, 0x65, 0x72, 0x62, 0x12, 0x14, 0x0a, 0x10, 0x56, 0x45, 0x52, + 0x42, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, + 0x07, 0x0a, 0x03, 0x50, 0x55, 0x54, 0x10, 0x01, 0x12, 0x07, 0x0a, 0x03, 0x47, 0x45, 0x54, 0x10, + 0x02, 0x12, 0x08, 0x0a, 0x04, 0x48, 0x45, 0x41, 0x44, 0x10, 0x03, 0x12, 0x0a, 0x0a, 0x06, 0x53, + 0x45, 0x41, 0x52, 0x43, 0x48, 0x10, 0x04, 0x12, 0x0a, 0x0a, 0x06, 0x44, 0x45, 0x4c, 0x45, 0x54, + 0x45, 0x10, 0x05, 0x12, 0x09, 0x0a, 0x05, 0x52, 0x41, 0x4e, 0x47, 0x45, 0x10, 0x06, 0x12, 0x0d, + 0x0a, 0x09, 0x52, 0x41, 0x4e, 0x47, 0x45, 0x48, 0x41, 0x53, 0x48, 0x10, 0x07, 0x22, 0xfa, 0x01, + 0x0a, 0x17, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x53, 0x65, 0x73, 0x73, 0x69, + 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x12, 0x43, 0x0a, 0x04, 0x76, 0x65, 0x72, + 0x62, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, + 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x43, 0x6f, 0x6e, 0x74, + 0x61, 0x69, 0x6e, 0x65, 0x72, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x74, + 0x65, 0x78, 0x74, 0x2e, 0x56, 0x65, 0x72, 0x62, 0x52, 0x04, 0x76, 0x65, 0x72, 0x62, 0x12, 0x1a, + 0x0a, 0x08, 0x77, 0x69, 0x6c, 0x64, 0x63, 0x61, 0x72, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, + 0x52, 0x08, 0x77, 0x69, 0x6c, 0x64, 0x63, 0x61, 0x72, 0x64, 0x12, 0x3e, 0x0a, 0x0c, 0x63, 0x6f, + 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, + 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x52, 0x0b, 0x63, + 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x22, 0x3e, 0x0a, 0x04, 0x56, 0x65, + 0x72, 0x62, 0x12, 0x14, 0x0a, 0x10, 0x56, 0x45, 0x52, 0x42, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, + 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x50, 0x55, 0x54, 0x10, + 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x44, 0x45, 0x4c, 0x45, 0x54, 0x45, 0x10, 0x02, 0x12, 0x0b, 0x0a, + 0x07, 0x53, 0x45, 0x54, 0x45, 0x41, 0x43, 0x4c, 0x10, 0x03, 0x22, 0xa0, 0x04, 0x0a, 0x0c, 0x53, + 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x38, 0x0a, 0x04, 0x62, + 0x6f, 0x64, 0x79, 0x18, 0x01, 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, 0x53, 0x65, + 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, + 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x37, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, + 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, + 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x1a, 0x9c, + 0x03, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0c, 0x52, 0x02, 0x69, 0x64, 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, 0x4e, 0x0a, 0x08, 0x6c, + 0x69, 0x66, 0x65, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x32, 0x2e, + 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, + 0x6e, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x42, + 0x6f, 0x64, 0x79, 0x2e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x4c, 0x69, 0x66, 0x65, 0x74, 0x69, 0x6d, + 0x65, 0x52, 0x08, 0x6c, 0x69, 0x66, 0x65, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x73, + 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, + 0x52, 0x0a, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x4b, 0x65, 0x79, 0x12, 0x41, 0x0a, 0x06, + 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, - 0x1a, 0x18, 0x76, 0x32, 0x2f, 0x72, 0x65, 0x66, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, - 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x76, 0x32, 0x2f, 0x61, - 0x63, 0x6c, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x1a, 0x1a, 0x76, 0x32, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2f, 0x67, - 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, - 0xf7, 0x01, 0x0a, 0x14, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, - 0x6e, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x12, 0x40, 0x0a, 0x04, 0x76, 0x65, 0x72, 0x62, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, - 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, - 0x74, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x2e, - 0x56, 0x65, 0x72, 0x62, 0x52, 0x04, 0x76, 0x65, 0x72, 0x62, 0x12, 0x31, 0x0a, 0x07, 0x61, 0x64, - 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6e, 0x65, - 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x41, 0x64, 0x64, - 0x72, 0x65, 0x73, 0x73, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x6a, 0x0a, - 0x04, 0x56, 0x65, 0x72, 0x62, 0x12, 0x14, 0x0a, 0x10, 0x56, 0x45, 0x52, 0x42, 0x5f, 0x55, 0x4e, - 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x50, - 0x55, 0x54, 0x10, 0x01, 0x12, 0x07, 0x0a, 0x03, 0x47, 0x45, 0x54, 0x10, 0x02, 0x12, 0x08, 0x0a, - 0x04, 0x48, 0x45, 0x41, 0x44, 0x10, 0x03, 0x12, 0x0a, 0x0a, 0x06, 0x53, 0x45, 0x41, 0x52, 0x43, - 0x48, 0x10, 0x04, 0x12, 0x0a, 0x0a, 0x06, 0x44, 0x45, 0x4c, 0x45, 0x54, 0x45, 0x10, 0x05, 0x12, - 0x09, 0x0a, 0x05, 0x52, 0x41, 0x4e, 0x47, 0x45, 0x10, 0x06, 0x12, 0x0d, 0x0a, 0x09, 0x52, 0x41, - 0x4e, 0x47, 0x45, 0x48, 0x41, 0x53, 0x48, 0x10, 0x07, 0x22, 0xfa, 0x01, 0x0a, 0x17, 0x43, 0x6f, - 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, - 0x6e, 0x74, 0x65, 0x78, 0x74, 0x12, 0x43, 0x0a, 0x04, 0x76, 0x65, 0x72, 0x62, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0e, 0x32, 0x2f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, - 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, - 0x72, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x2e, - 0x56, 0x65, 0x72, 0x62, 0x52, 0x04, 0x76, 0x65, 0x72, 0x62, 0x12, 0x1a, 0x0a, 0x08, 0x77, 0x69, - 0x6c, 0x64, 0x63, 0x61, 0x72, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x77, 0x69, - 0x6c, 0x64, 0x63, 0x61, 0x72, 0x64, 0x12, 0x3e, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, - 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, - 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x6f, - 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x61, - 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x22, 0x3e, 0x0a, 0x04, 0x56, 0x65, 0x72, 0x62, 0x12, 0x14, - 0x0a, 0x10, 0x56, 0x45, 0x52, 0x42, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, - 0x45, 0x44, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x50, 0x55, 0x54, 0x10, 0x01, 0x12, 0x0a, 0x0a, - 0x06, 0x44, 0x45, 0x4c, 0x45, 0x54, 0x45, 0x10, 0x02, 0x12, 0x0b, 0x0a, 0x07, 0x53, 0x45, 0x54, - 0x45, 0x41, 0x43, 0x4c, 0x10, 0x03, 0x22, 0xa0, 0x04, 0x0a, 0x0c, 0x53, 0x65, 0x73, 0x73, 0x69, - 0x6f, 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x38, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, - 0x01, 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, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, - 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, - 0x79, 0x12, 0x37, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, + 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, + 0x6e, 0x74, 0x65, 0x78, 0x74, 0x48, 0x00, 0x52, 0x06, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, + 0x4a, 0x0a, 0x09, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x18, 0x06, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, + 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, + 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x48, 0x00, + 0x52, 0x09, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x1a, 0x45, 0x0a, 0x0d, 0x54, + 0x6f, 0x6b, 0x65, 0x6e, 0x4c, 0x69, 0x66, 0x65, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, + 0x65, 0x78, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x65, 0x78, 0x70, 0x12, 0x10, + 0x0a, 0x03, 0x6e, 0x62, 0x66, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x6e, 0x62, 0x66, + 0x12, 0x10, 0x0a, 0x03, 0x69, 0x61, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x69, + 0x61, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x22, 0x31, 0x0a, + 0x07, 0x58, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 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, + 0x22, 0xea, 0x02, 0x0a, 0x11, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x74, 0x61, + 0x48, 0x65, 0x61, 0x64, 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, 0x14, 0x0a, 0x05, 0x65, 0x70, 0x6f, + 0x63, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x12, + 0x10, 0x0a, 0x03, 0x74, 0x74, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x03, 0x74, 0x74, + 0x6c, 0x12, 0x37, 0x0a, 0x09, 0x78, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x18, 0x04, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x58, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, + 0x52, 0x08, 0x78, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x12, 0x44, 0x0a, 0x0d, 0x73, 0x65, + 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, + 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x6f, 0x6b, + 0x65, 0x6e, 0x52, 0x0c, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, + 0x12, 0x3d, 0x0a, 0x0c, 0x62, 0x65, 0x61, 0x72, 0x65, 0x72, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, + 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, + 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x42, 0x65, 0x61, 0x72, 0x65, 0x72, 0x54, 0x6f, 0x6b, + 0x65, 0x6e, 0x52, 0x0b, 0x62, 0x65, 0x61, 0x72, 0x65, 0x72, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, + 0x3c, 0x0a, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x18, 0x07, 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, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x22, 0x99, 0x02, + 0x0a, 0x12, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x48, 0x65, + 0x61, 0x64, 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, 0x14, 0x0a, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x12, 0x10, 0x0a, + 0x03, 0x74, 0x74, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x03, 0x74, 0x74, 0x6c, 0x12, + 0x37, 0x0a, 0x09, 0x78, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x18, 0x04, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, + 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x58, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x08, + 0x78, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x12, 0x3d, 0x0a, 0x06, 0x6f, 0x72, 0x69, 0x67, + 0x69, 0x6e, 0x18, 0x05, 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, + 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x12, 0x30, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, + 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, + 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, + 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0xab, 0x02, 0x0a, 0x19, 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, 0x12, 0x40, 0x0a, 0x0e, 0x62, 0x6f, 0x64, 0x79, 0x5f, + 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, + 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x0d, 0x62, 0x6f, 0x64, 0x79, + 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x40, 0x0a, 0x0e, 0x6d, 0x65, 0x74, + 0x61, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, + 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x0d, 0x6d, 0x65, + 0x74, 0x61, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x44, 0x0a, 0x10, 0x6f, + 0x72, 0x69, 0x67, 0x69, 0x6e, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, + 0x52, 0x0f, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, + 0x65, 0x12, 0x44, 0x0a, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x18, 0x04, 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, + 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x22, 0xad, 0x02, 0x0a, 0x1a, 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, 0x12, 0x40, 0x0a, 0x0e, 0x62, 0x6f, 0x64, 0x79, 0x5f, 0x73, + 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, + 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x0d, 0x62, 0x6f, 0x64, 0x79, 0x53, + 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x40, 0x0a, 0x0e, 0x6d, 0x65, 0x74, 0x61, + 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, + 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x0d, 0x6d, 0x65, 0x74, + 0x61, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x44, 0x0a, 0x10, 0x6f, 0x72, + 0x69, 0x67, 0x69, 0x6e, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, - 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x1a, 0x9c, 0x03, 0x0a, 0x04, 0x42, - 0x6f, 0x64, 0x79, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, - 0x02, 0x69, 0x64, 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, 0x4e, 0x0a, 0x08, 0x6c, 0x69, 0x66, 0x65, 0x74, - 0x69, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x32, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, - 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x65, - 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x2e, - 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x4c, 0x69, 0x66, 0x65, 0x74, 0x69, 0x6d, 0x65, 0x52, 0x08, 0x6c, - 0x69, 0x66, 0x65, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x73, 0x65, 0x73, 0x73, 0x69, - 0x6f, 0x6e, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x73, 0x65, - 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x4b, 0x65, 0x79, 0x12, 0x41, 0x0a, 0x06, 0x6f, 0x62, 0x6a, 0x65, - 0x63, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, - 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x4f, 0x62, 0x6a, - 0x65, 0x63, 0x74, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, - 0x74, 0x48, 0x00, 0x52, 0x06, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x4a, 0x0a, 0x09, 0x63, - 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, - 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, - 0x6f, 0x6e, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x53, 0x65, 0x73, 0x73, - 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x48, 0x00, 0x52, 0x09, 0x63, 0x6f, - 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x1a, 0x45, 0x0a, 0x0d, 0x54, 0x6f, 0x6b, 0x65, 0x6e, - 0x4c, 0x69, 0x66, 0x65, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x78, 0x70, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x65, 0x78, 0x70, 0x12, 0x10, 0x0a, 0x03, 0x6e, 0x62, - 0x66, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x6e, 0x62, 0x66, 0x12, 0x10, 0x0a, 0x03, - 0x69, 0x61, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x69, 0x61, 0x74, 0x42, 0x09, - 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x22, 0x31, 0x0a, 0x07, 0x58, 0x48, 0x65, - 0x61, 0x64, 0x65, 0x72, 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, 0x22, 0xea, 0x02, 0x0a, - 0x11, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, - 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, 0x14, 0x0a, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x12, 0x10, 0x0a, 0x03, 0x74, - 0x74, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x03, 0x74, 0x74, 0x6c, 0x12, 0x37, 0x0a, - 0x09, 0x78, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x1a, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, - 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x58, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x08, 0x78, 0x48, - 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x12, 0x44, 0x0a, 0x0d, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, - 0x6e, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, - 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, - 0x6e, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x0c, - 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x3d, 0x0a, 0x0c, - 0x62, 0x65, 0x61, 0x72, 0x65, 0x72, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x06, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, - 0x63, 0x6c, 0x2e, 0x42, 0x65, 0x61, 0x72, 0x65, 0x72, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x0b, - 0x62, 0x65, 0x61, 0x72, 0x65, 0x72, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x3c, 0x0a, 0x06, 0x6f, - 0x72, 0x69, 0x67, 0x69, 0x6e, 0x18, 0x07, 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, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x22, 0x99, 0x02, 0x0a, 0x12, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 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, 0x14, 0x0a, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x04, 0x52, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x12, 0x10, 0x0a, 0x03, 0x74, 0x74, 0x6c, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x03, 0x74, 0x74, 0x6c, 0x12, 0x37, 0x0a, 0x09, 0x78, - 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, - 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, - 0x6f, 0x6e, 0x2e, 0x58, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x08, 0x78, 0x48, 0x65, 0x61, - 0x64, 0x65, 0x72, 0x73, 0x12, 0x3d, 0x0a, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x18, 0x05, - 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, 0x06, 0x6f, 0x72, 0x69, - 0x67, 0x69, 0x6e, 0x12, 0x30, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x06, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, - 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, - 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0xab, 0x02, 0x0a, 0x19, 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, 0x12, 0x40, 0x0a, 0x0e, 0x62, 0x6f, 0x64, 0x79, 0x5f, 0x73, 0x69, 0x67, 0x6e, - 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, - 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, - 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x0d, 0x62, 0x6f, 0x64, 0x79, 0x53, 0x69, 0x67, 0x6e, - 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x40, 0x0a, 0x0e, 0x6d, 0x65, 0x74, 0x61, 0x5f, 0x73, 0x69, - 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, - 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, - 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x0d, 0x6d, 0x65, 0x74, 0x61, 0x53, 0x69, - 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x44, 0x0a, 0x10, 0x6f, 0x72, 0x69, 0x67, 0x69, - 0x6e, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, - 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x0f, 0x6f, 0x72, - 0x69, 0x67, 0x69, 0x6e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x44, 0x0a, - 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x18, 0x04, 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, 0x06, 0x6f, 0x72, 0x69, - 0x67, 0x69, 0x6e, 0x22, 0xad, 0x02, 0x0a, 0x1a, 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, 0x12, 0x40, 0x0a, 0x0e, 0x62, 0x6f, 0x64, 0x79, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, - 0x74, 0x75, 0x72, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, - 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, - 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x0d, 0x62, 0x6f, 0x64, 0x79, 0x53, 0x69, 0x67, 0x6e, 0x61, - 0x74, 0x75, 0x72, 0x65, 0x12, 0x40, 0x0a, 0x0e, 0x6d, 0x65, 0x74, 0x61, 0x5f, 0x73, 0x69, 0x67, - 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, - 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, - 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x0d, 0x6d, 0x65, 0x74, 0x61, 0x53, 0x69, 0x67, - 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x44, 0x0a, 0x10, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, - 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, - 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x0f, 0x6f, 0x72, 0x69, - 0x67, 0x69, 0x6e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x45, 0x0a, 0x06, - 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x18, 0x04, 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, 0x06, 0x6f, 0x72, 0x69, - 0x67, 0x69, 0x6e, 0x42, 0x59, 0x5a, 0x39, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, - 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, - 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 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, 0x06, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x0f, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, + 0x12, 0x45, 0x0a, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x18, 0x04, 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, + 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x42, 0x59, 0x5a, 0x39, 0x67, 0x69, 0x74, 0x68, 0x75, + 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, + 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 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, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( - file_v2_session_grpc_types_proto_rawDescOnce sync.Once - file_v2_session_grpc_types_proto_rawDescData = file_v2_session_grpc_types_proto_rawDesc + file_session_grpc_types_proto_rawDescOnce sync.Once + file_session_grpc_types_proto_rawDescData = file_session_grpc_types_proto_rawDesc ) -func file_v2_session_grpc_types_proto_rawDescGZIP() []byte { - file_v2_session_grpc_types_proto_rawDescOnce.Do(func() { - file_v2_session_grpc_types_proto_rawDescData = protoimpl.X.CompressGZIP(file_v2_session_grpc_types_proto_rawDescData) +func file_session_grpc_types_proto_rawDescGZIP() []byte { + file_session_grpc_types_proto_rawDescOnce.Do(func() { + file_session_grpc_types_proto_rawDescData = protoimpl.X.CompressGZIP(file_session_grpc_types_proto_rawDescData) }) - return file_v2_session_grpc_types_proto_rawDescData + return file_session_grpc_types_proto_rawDescData } -var file_v2_session_grpc_types_proto_enumTypes = make([]protoimpl.EnumInfo, 2) -var file_v2_session_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 10) -var file_v2_session_grpc_types_proto_goTypes = []interface{}{ +var file_session_grpc_types_proto_enumTypes = make([]protoimpl.EnumInfo, 2) +var file_session_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 10) +var file_session_grpc_types_proto_goTypes = []interface{}{ (ObjectSessionContext_Verb)(0), // 0: neo.fs.v2.session.ObjectSessionContext.Verb (ContainerSessionContext_Verb)(0), // 1: neo.fs.v2.session.ContainerSessionContext.Verb (*ObjectSessionContext)(nil), // 2: neo.fs.v2.session.ObjectSessionContext @@ -1156,7 +1155,7 @@ var file_v2_session_grpc_types_proto_goTypes = []interface{}{ (*grpc2.Status)(nil), // 17: neo.fs.v2.status.Status (*grpc.OwnerID)(nil), // 18: neo.fs.v2.refs.OwnerID } -var file_v2_session_grpc_types_proto_depIdxs = []int32{ +var file_session_grpc_types_proto_depIdxs = []int32{ 0, // 0: neo.fs.v2.session.ObjectSessionContext.verb:type_name -> neo.fs.v2.session.ObjectSessionContext.Verb 12, // 1: neo.fs.v2.session.ObjectSessionContext.address:type_name -> neo.fs.v2.refs.Address 1, // 2: neo.fs.v2.session.ContainerSessionContext.verb:type_name -> neo.fs.v2.session.ContainerSessionContext.Verb @@ -1191,13 +1190,13 @@ var file_v2_session_grpc_types_proto_depIdxs = []int32{ 0, // [0:27] is the sub-list for field type_name } -func init() { file_v2_session_grpc_types_proto_init() } -func file_v2_session_grpc_types_proto_init() { - if File_v2_session_grpc_types_proto != nil { +func init() { file_session_grpc_types_proto_init() } +func file_session_grpc_types_proto_init() { + if File_session_grpc_types_proto != nil { return } if !protoimpl.UnsafeEnabled { - file_v2_session_grpc_types_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_session_grpc_types_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ObjectSessionContext); i { case 0: return &v.state @@ -1209,7 +1208,7 @@ func file_v2_session_grpc_types_proto_init() { return nil } } - file_v2_session_grpc_types_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_session_grpc_types_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ContainerSessionContext); i { case 0: return &v.state @@ -1221,7 +1220,7 @@ func file_v2_session_grpc_types_proto_init() { return nil } } - file_v2_session_grpc_types_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + file_session_grpc_types_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*SessionToken); i { case 0: return &v.state @@ -1233,7 +1232,7 @@ func file_v2_session_grpc_types_proto_init() { return nil } } - file_v2_session_grpc_types_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + file_session_grpc_types_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*XHeader); i { case 0: return &v.state @@ -1245,7 +1244,7 @@ func file_v2_session_grpc_types_proto_init() { return nil } } - file_v2_session_grpc_types_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + file_session_grpc_types_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*RequestMetaHeader); i { case 0: return &v.state @@ -1257,7 +1256,7 @@ func file_v2_session_grpc_types_proto_init() { return nil } } - file_v2_session_grpc_types_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + file_session_grpc_types_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ResponseMetaHeader); i { case 0: return &v.state @@ -1269,7 +1268,7 @@ func file_v2_session_grpc_types_proto_init() { return nil } } - file_v2_session_grpc_types_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + file_session_grpc_types_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*RequestVerificationHeader); i { case 0: return &v.state @@ -1281,7 +1280,7 @@ func file_v2_session_grpc_types_proto_init() { return nil } } - file_v2_session_grpc_types_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + file_session_grpc_types_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ResponseVerificationHeader); i { case 0: return &v.state @@ -1293,7 +1292,7 @@ func file_v2_session_grpc_types_proto_init() { return nil } } - file_v2_session_grpc_types_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + file_session_grpc_types_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*SessionToken_Body); i { case 0: return &v.state @@ -1305,7 +1304,7 @@ func file_v2_session_grpc_types_proto_init() { return nil } } - file_v2_session_grpc_types_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + file_session_grpc_types_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*SessionToken_Body_TokenLifetime); i { case 0: return &v.state @@ -1318,7 +1317,7 @@ func file_v2_session_grpc_types_proto_init() { } } } - file_v2_session_grpc_types_proto_msgTypes[8].OneofWrappers = []interface{}{ + file_session_grpc_types_proto_msgTypes[8].OneofWrappers = []interface{}{ (*SessionToken_Body_Object)(nil), (*SessionToken_Body_Container)(nil), } @@ -1326,19 +1325,19 @@ func file_v2_session_grpc_types_proto_init() { out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_v2_session_grpc_types_proto_rawDesc, + RawDescriptor: file_session_grpc_types_proto_rawDesc, NumEnums: 2, NumMessages: 10, NumExtensions: 0, NumServices: 0, }, - GoTypes: file_v2_session_grpc_types_proto_goTypes, - DependencyIndexes: file_v2_session_grpc_types_proto_depIdxs, - EnumInfos: file_v2_session_grpc_types_proto_enumTypes, - MessageInfos: file_v2_session_grpc_types_proto_msgTypes, + GoTypes: file_session_grpc_types_proto_goTypes, + DependencyIndexes: file_session_grpc_types_proto_depIdxs, + EnumInfos: file_session_grpc_types_proto_enumTypes, + MessageInfos: file_session_grpc_types_proto_msgTypes, }.Build() - File_v2_session_grpc_types_proto = out.File - file_v2_session_grpc_types_proto_rawDesc = nil - file_v2_session_grpc_types_proto_goTypes = nil - file_v2_session_grpc_types_proto_depIdxs = nil + File_session_grpc_types_proto = out.File + file_session_grpc_types_proto_rawDesc = nil + file_session_grpc_types_proto_goTypes = nil + file_session_grpc_types_proto_depIdxs = nil } diff --git a/v2/status/convert.go b/status/convert.go similarity index 93% rename from v2/status/convert.go rename to status/convert.go index 5c05221..8195096 100644 --- a/v2/status/convert.go +++ b/status/convert.go @@ -1,8 +1,8 @@ package status import ( - "github.com/nspcc-dev/neofs-api-go/rpc/grpc" - "github.com/nspcc-dev/neofs-api-go/rpc/message" + "github.com/nspcc-dev/neofs-api-go/v2/rpc/grpc" + "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" status "github.com/nspcc-dev/neofs-api-go/v2/status/grpc" ) diff --git a/v2/status/grpc/types.go b/status/grpc/types.go similarity index 100% rename from v2/status/grpc/types.go rename to status/grpc/types.go diff --git a/v2/status/grpc/types.pb.go b/status/grpc/types.pb.go similarity index 100% rename from v2/status/grpc/types.pb.go rename to status/grpc/types.pb.go diff --git a/v2/status/marshal.go b/status/marshal.go similarity index 94% rename from v2/status/marshal.go rename to status/marshal.go index 8170325..da6572e 100644 --- a/v2/status/marshal.go +++ b/status/marshal.go @@ -1,9 +1,9 @@ package status import ( - "github.com/nspcc-dev/neofs-api-go/rpc/message" - protoutil "github.com/nspcc-dev/neofs-api-go/util/proto" + "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" status "github.com/nspcc-dev/neofs-api-go/v2/status/grpc" + protoutil "github.com/nspcc-dev/neofs-api-go/v2/util/proto" ) const ( diff --git a/v2/status/message_test.go b/status/message_test.go similarity index 73% rename from v2/status/message_test.go rename to status/message_test.go index c301162..b6f8d2d 100644 --- a/v2/status/message_test.go +++ b/status/message_test.go @@ -3,8 +3,8 @@ package status_test import ( "testing" - "github.com/nspcc-dev/neofs-api-go/rpc/message" - messagetest "github.com/nspcc-dev/neofs-api-go/rpc/message/test" + "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" + messagetest "github.com/nspcc-dev/neofs-api-go/v2/rpc/message/test" statustest "github.com/nspcc-dev/neofs-api-go/v2/status/test" ) diff --git a/v2/status/status.go b/status/status.go similarity index 100% rename from v2/status/status.go rename to status/status.go diff --git a/v2/status/test/generate.go b/status/test/generate.go similarity index 100% rename from v2/status/test/generate.go rename to status/test/generate.go diff --git a/v2/status/types.go b/status/types.go similarity index 100% rename from v2/status/types.go rename to status/types.go diff --git a/storagegroup/grpc/types.pb.go b/storagegroup/grpc/types.pb.go index 94f1e05..fa5b98c 100644 --- a/storagegroup/grpc/types.pb.go +++ b/storagegroup/grpc/types.pb.go @@ -2,7 +2,7 @@ // versions: // protoc-gen-go v1.27.1 // protoc v3.18.0 -// source: v2/storagegroup/grpc/types.proto +// source: storagegroup/grpc/types.proto package storagegroup @@ -45,7 +45,7 @@ type StorageGroup struct { func (x *StorageGroup) Reset() { *x = StorageGroup{} if protoimpl.UnsafeEnabled { - mi := &file_v2_storagegroup_grpc_types_proto_msgTypes[0] + mi := &file_storagegroup_grpc_types_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -58,7 +58,7 @@ func (x *StorageGroup) String() string { func (*StorageGroup) ProtoMessage() {} func (x *StorageGroup) ProtoReflect() protoreflect.Message { - mi := &file_v2_storagegroup_grpc_types_proto_msgTypes[0] + mi := &file_storagegroup_grpc_types_proto_msgTypes[0] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -71,7 +71,7 @@ func (x *StorageGroup) ProtoReflect() protoreflect.Message { // Deprecated: Use StorageGroup.ProtoReflect.Descriptor instead. func (*StorageGroup) Descriptor() ([]byte, []int) { - return file_v2_storagegroup_grpc_types_proto_rawDescGZIP(), []int{0} + return file_storagegroup_grpc_types_proto_rawDescGZIP(), []int{0} } func (x *StorageGroup) GetValidationDataSize() uint64 { @@ -102,57 +102,57 @@ func (x *StorageGroup) GetMembers() []*grpc.ObjectID { return nil } -var File_v2_storagegroup_grpc_types_proto protoreflect.FileDescriptor +var File_storagegroup_grpc_types_proto protoreflect.FileDescriptor -var file_v2_storagegroup_grpc_types_proto_rawDesc = []byte{ - 0x0a, 0x20, 0x76, 0x32, 0x2f, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x67, 0x72, 0x6f, 0x75, - 0x70, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x12, 0x16, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x74, - 0x6f, 0x72, 0x61, 0x67, 0x65, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x1a, 0x18, 0x76, 0x32, 0x2f, 0x72, - 0x65, 0x66, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xe2, 0x01, 0x0a, 0x0c, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, - 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x30, 0x0a, 0x14, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x04, 0x52, 0x12, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x44, - 0x61, 0x74, 0x61, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x41, 0x0a, 0x0f, 0x76, 0x61, 0x6c, 0x69, 0x64, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, +var file_storagegroup_grpc_types_proto_rawDesc = []byte{ + 0x0a, 0x1d, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x2f, 0x67, + 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, + 0x16, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x61, + 0x67, 0x65, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x1a, 0x15, 0x72, 0x65, 0x66, 0x73, 0x2f, 0x67, 0x72, + 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xe2, + 0x01, 0x0a, 0x0c, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, + 0x30, 0x0a, 0x14, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x64, 0x61, + 0x74, 0x61, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x12, 0x76, + 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x61, 0x74, 0x61, 0x53, 0x69, 0x7a, + 0x65, 0x12, 0x41, 0x0a, 0x0f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, + 0x68, 0x61, 0x73, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, + 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x68, 0x65, 0x63, + 0x6b, 0x73, 0x75, 0x6d, 0x52, 0x0e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x48, 0x61, 0x73, 0x68, 0x12, 0x29, 0x0a, 0x10, 0x65, 0x78, 0x70, 0x69, 0x72, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x5f, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0f, + 0x65, 0x78, 0x70, 0x69, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x70, 0x6f, 0x63, 0x68, 0x12, + 0x32, 0x0a, 0x07, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, - 0x73, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x52, 0x0e, 0x76, 0x61, 0x6c, 0x69, - 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x61, 0x73, 0x68, 0x12, 0x29, 0x0a, 0x10, 0x65, 0x78, - 0x70, 0x69, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x04, 0x52, 0x0f, 0x65, 0x78, 0x70, 0x69, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x45, 0x70, 0x6f, 0x63, 0x68, 0x12, 0x32, 0x0a, 0x07, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, - 0x18, 0x04, 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, 0x68, 0x5a, 0x43, 0x67, 0x69, 0x74, - 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, - 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, - 0x32, 0x2f, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x2f, 0x67, - 0x72, 0x70, 0x63, 0x3b, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x67, 0x72, 0x6f, 0x75, 0x70, - 0xaa, 0x02, 0x20, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, - 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x47, 0x72, - 0x6f, 0x75, 0x70, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x73, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x44, 0x52, 0x07, 0x6d, 0x65, 0x6d, 0x62, + 0x65, 0x72, 0x73, 0x42, 0x68, 0x5a, 0x43, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, + 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, + 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x73, 0x74, 0x6f, 0x72, + 0x61, 0x67, 0x65, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x73, 0x74, + 0x6f, 0x72, 0x61, 0x67, 0x65, 0x67, 0x72, 0x6f, 0x75, 0x70, 0xaa, 0x02, 0x20, 0x4e, 0x65, 0x6f, + 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, + 0x2e, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( - file_v2_storagegroup_grpc_types_proto_rawDescOnce sync.Once - file_v2_storagegroup_grpc_types_proto_rawDescData = file_v2_storagegroup_grpc_types_proto_rawDesc + file_storagegroup_grpc_types_proto_rawDescOnce sync.Once + file_storagegroup_grpc_types_proto_rawDescData = file_storagegroup_grpc_types_proto_rawDesc ) -func file_v2_storagegroup_grpc_types_proto_rawDescGZIP() []byte { - file_v2_storagegroup_grpc_types_proto_rawDescOnce.Do(func() { - file_v2_storagegroup_grpc_types_proto_rawDescData = protoimpl.X.CompressGZIP(file_v2_storagegroup_grpc_types_proto_rawDescData) +func file_storagegroup_grpc_types_proto_rawDescGZIP() []byte { + file_storagegroup_grpc_types_proto_rawDescOnce.Do(func() { + file_storagegroup_grpc_types_proto_rawDescData = protoimpl.X.CompressGZIP(file_storagegroup_grpc_types_proto_rawDescData) }) - return file_v2_storagegroup_grpc_types_proto_rawDescData + return file_storagegroup_grpc_types_proto_rawDescData } -var file_v2_storagegroup_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_v2_storagegroup_grpc_types_proto_goTypes = []interface{}{ +var file_storagegroup_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_storagegroup_grpc_types_proto_goTypes = []interface{}{ (*StorageGroup)(nil), // 0: neo.fs.v2.storagegroup.StorageGroup (*grpc.Checksum)(nil), // 1: neo.fs.v2.refs.Checksum (*grpc.ObjectID)(nil), // 2: neo.fs.v2.refs.ObjectID } -var file_v2_storagegroup_grpc_types_proto_depIdxs = []int32{ +var file_storagegroup_grpc_types_proto_depIdxs = []int32{ 1, // 0: neo.fs.v2.storagegroup.StorageGroup.validation_hash:type_name -> neo.fs.v2.refs.Checksum 2, // 1: neo.fs.v2.storagegroup.StorageGroup.members:type_name -> neo.fs.v2.refs.ObjectID 2, // [2:2] is the sub-list for method output_type @@ -162,13 +162,13 @@ var file_v2_storagegroup_grpc_types_proto_depIdxs = []int32{ 0, // [0:2] is the sub-list for field type_name } -func init() { file_v2_storagegroup_grpc_types_proto_init() } -func file_v2_storagegroup_grpc_types_proto_init() { - if File_v2_storagegroup_grpc_types_proto != nil { +func init() { file_storagegroup_grpc_types_proto_init() } +func file_storagegroup_grpc_types_proto_init() { + if File_storagegroup_grpc_types_proto != nil { return } if !protoimpl.UnsafeEnabled { - file_v2_storagegroup_grpc_types_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_storagegroup_grpc_types_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*StorageGroup); i { case 0: return &v.state @@ -185,18 +185,18 @@ func file_v2_storagegroup_grpc_types_proto_init() { out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_v2_storagegroup_grpc_types_proto_rawDesc, + RawDescriptor: file_storagegroup_grpc_types_proto_rawDesc, NumEnums: 0, NumMessages: 1, NumExtensions: 0, NumServices: 0, }, - GoTypes: file_v2_storagegroup_grpc_types_proto_goTypes, - DependencyIndexes: file_v2_storagegroup_grpc_types_proto_depIdxs, - MessageInfos: file_v2_storagegroup_grpc_types_proto_msgTypes, + GoTypes: file_storagegroup_grpc_types_proto_goTypes, + DependencyIndexes: file_storagegroup_grpc_types_proto_depIdxs, + MessageInfos: file_storagegroup_grpc_types_proto_msgTypes, }.Build() - File_v2_storagegroup_grpc_types_proto = out.File - file_v2_storagegroup_grpc_types_proto_rawDesc = nil - file_v2_storagegroup_grpc_types_proto_goTypes = nil - file_v2_storagegroup_grpc_types_proto_depIdxs = nil + File_storagegroup_grpc_types_proto = out.File + file_storagegroup_grpc_types_proto_rawDesc = nil + file_storagegroup_grpc_types_proto_goTypes = nil + file_storagegroup_grpc_types_proto_depIdxs = nil } diff --git a/tombstone/grpc/types.pb.go b/tombstone/grpc/types.pb.go index e6fc2d0..f2f3db6 100644 --- a/tombstone/grpc/types.pb.go +++ b/tombstone/grpc/types.pb.go @@ -2,7 +2,7 @@ // versions: // protoc-gen-go v1.27.1 // protoc v3.18.0 -// source: v2/tombstone/grpc/types.proto +// source: tombstone/grpc/types.proto package tombstone @@ -44,7 +44,7 @@ type Tombstone struct { func (x *Tombstone) Reset() { *x = Tombstone{} if protoimpl.UnsafeEnabled { - mi := &file_v2_tombstone_grpc_types_proto_msgTypes[0] + mi := &file_tombstone_grpc_types_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -57,7 +57,7 @@ func (x *Tombstone) String() string { func (*Tombstone) ProtoMessage() {} func (x *Tombstone) ProtoReflect() protoreflect.Message { - mi := &file_v2_tombstone_grpc_types_proto_msgTypes[0] + mi := &file_tombstone_grpc_types_proto_msgTypes[0] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -70,7 +70,7 @@ func (x *Tombstone) ProtoReflect() protoreflect.Message { // Deprecated: Use Tombstone.ProtoReflect.Descriptor instead. func (*Tombstone) Descriptor() ([]byte, []int) { - return file_v2_tombstone_grpc_types_proto_rawDescGZIP(), []int{0} + return file_tombstone_grpc_types_proto_rawDescGZIP(), []int{0} } func (x *Tombstone) GetExpirationEpoch() uint64 { @@ -94,49 +94,49 @@ func (x *Tombstone) GetMembers() []*grpc.ObjectID { return nil } -var File_v2_tombstone_grpc_types_proto protoreflect.FileDescriptor +var File_tombstone_grpc_types_proto protoreflect.FileDescriptor -var file_v2_tombstone_grpc_types_proto_rawDesc = []byte{ - 0x0a, 0x1d, 0x76, 0x32, 0x2f, 0x74, 0x6f, 0x6d, 0x62, 0x73, 0x74, 0x6f, 0x6e, 0x65, 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, 0x74, 0x6f, 0x6d, 0x62, 0x73, - 0x74, 0x6f, 0x6e, 0x65, 0x1a, 0x18, 0x76, 0x32, 0x2f, 0x72, 0x65, 0x66, 0x73, 0x2f, 0x67, 0x72, - 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x85, - 0x01, 0x0a, 0x09, 0x54, 0x6f, 0x6d, 0x62, 0x73, 0x74, 0x6f, 0x6e, 0x65, 0x12, 0x29, 0x0a, 0x10, - 0x65, 0x78, 0x70, 0x69, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x70, 0x6f, 0x63, 0x68, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0f, 0x65, 0x78, 0x70, 0x69, 0x72, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x45, 0x70, 0x6f, 0x63, 0x68, 0x12, 0x19, 0x0a, 0x08, 0x73, 0x70, 0x6c, 0x69, 0x74, - 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x73, 0x70, 0x6c, 0x69, 0x74, - 0x49, 0x44, 0x12, 0x32, 0x0a, 0x07, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x18, 0x03, 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, 0x5f, 0x5a, 0x3d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, - 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, - 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x74, - 0x6f, 0x6d, 0x62, 0x73, 0x74, 0x6f, 0x6e, 0x65, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x74, 0x6f, - 0x6d, 0x62, 0x73, 0x74, 0x6f, 0x6e, 0x65, 0xaa, 0x02, 0x1d, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, - 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x54, 0x6f, - 0x6d, 0x62, 0x73, 0x74, 0x6f, 0x6e, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +var file_tombstone_grpc_types_proto_rawDesc = []byte{ + 0x0a, 0x1a, 0x74, 0x6f, 0x6d, 0x62, 0x73, 0x74, 0x6f, 0x6e, 0x65, 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, 0x74, 0x6f, 0x6d, 0x62, 0x73, 0x74, 0x6f, 0x6e, + 0x65, 0x1a, 0x15, 0x72, 0x65, 0x66, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, + 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x85, 0x01, 0x0a, 0x09, 0x54, 0x6f, 0x6d, + 0x62, 0x73, 0x74, 0x6f, 0x6e, 0x65, 0x12, 0x29, 0x0a, 0x10, 0x65, 0x78, 0x70, 0x69, 0x72, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, + 0x52, 0x0f, 0x65, 0x78, 0x70, 0x69, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x70, 0x6f, 0x63, + 0x68, 0x12, 0x19, 0x0a, 0x08, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0c, 0x52, 0x07, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x49, 0x44, 0x12, 0x32, 0x0a, 0x07, + 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x18, 0x03, 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, 0x5f, 0x5a, 0x3d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, + 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, + 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x74, 0x6f, 0x6d, 0x62, 0x73, 0x74, 0x6f, + 0x6e, 0x65, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x74, 0x6f, 0x6d, 0x62, 0x73, 0x74, 0x6f, 0x6e, + 0x65, 0xaa, 0x02, 0x1d, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, + 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x54, 0x6f, 0x6d, 0x62, 0x73, 0x74, 0x6f, 0x6e, + 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( - file_v2_tombstone_grpc_types_proto_rawDescOnce sync.Once - file_v2_tombstone_grpc_types_proto_rawDescData = file_v2_tombstone_grpc_types_proto_rawDesc + file_tombstone_grpc_types_proto_rawDescOnce sync.Once + file_tombstone_grpc_types_proto_rawDescData = file_tombstone_grpc_types_proto_rawDesc ) -func file_v2_tombstone_grpc_types_proto_rawDescGZIP() []byte { - file_v2_tombstone_grpc_types_proto_rawDescOnce.Do(func() { - file_v2_tombstone_grpc_types_proto_rawDescData = protoimpl.X.CompressGZIP(file_v2_tombstone_grpc_types_proto_rawDescData) +func file_tombstone_grpc_types_proto_rawDescGZIP() []byte { + file_tombstone_grpc_types_proto_rawDescOnce.Do(func() { + file_tombstone_grpc_types_proto_rawDescData = protoimpl.X.CompressGZIP(file_tombstone_grpc_types_proto_rawDescData) }) - return file_v2_tombstone_grpc_types_proto_rawDescData + return file_tombstone_grpc_types_proto_rawDescData } -var file_v2_tombstone_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_v2_tombstone_grpc_types_proto_goTypes = []interface{}{ +var file_tombstone_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_tombstone_grpc_types_proto_goTypes = []interface{}{ (*Tombstone)(nil), // 0: neo.fs.v2.tombstone.Tombstone (*grpc.ObjectID)(nil), // 1: neo.fs.v2.refs.ObjectID } -var file_v2_tombstone_grpc_types_proto_depIdxs = []int32{ +var file_tombstone_grpc_types_proto_depIdxs = []int32{ 1, // 0: neo.fs.v2.tombstone.Tombstone.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 @@ -145,13 +145,13 @@ var file_v2_tombstone_grpc_types_proto_depIdxs = []int32{ 0, // [0:1] is the sub-list for field type_name } -func init() { file_v2_tombstone_grpc_types_proto_init() } -func file_v2_tombstone_grpc_types_proto_init() { - if File_v2_tombstone_grpc_types_proto != nil { +func init() { file_tombstone_grpc_types_proto_init() } +func file_tombstone_grpc_types_proto_init() { + if File_tombstone_grpc_types_proto != nil { return } if !protoimpl.UnsafeEnabled { - file_v2_tombstone_grpc_types_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_tombstone_grpc_types_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Tombstone); i { case 0: return &v.state @@ -168,18 +168,18 @@ func file_v2_tombstone_grpc_types_proto_init() { out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_v2_tombstone_grpc_types_proto_rawDesc, + RawDescriptor: file_tombstone_grpc_types_proto_rawDesc, NumEnums: 0, NumMessages: 1, NumExtensions: 0, NumServices: 0, }, - GoTypes: file_v2_tombstone_grpc_types_proto_goTypes, - DependencyIndexes: file_v2_tombstone_grpc_types_proto_depIdxs, - MessageInfos: file_v2_tombstone_grpc_types_proto_msgTypes, + GoTypes: file_tombstone_grpc_types_proto_goTypes, + DependencyIndexes: file_tombstone_grpc_types_proto_depIdxs, + MessageInfos: file_tombstone_grpc_types_proto_msgTypes, }.Build() - File_v2_tombstone_grpc_types_proto = out.File - file_v2_tombstone_grpc_types_proto_rawDesc = nil - file_v2_tombstone_grpc_types_proto_goTypes = nil - file_v2_tombstone_grpc_types_proto_depIdxs = nil + File_tombstone_grpc_types_proto = out.File + file_tombstone_grpc_types_proto_rawDesc = nil + file_tombstone_grpc_types_proto_goTypes = nil + file_tombstone_grpc_types_proto_depIdxs = nil } From ad6a7999cd5a6b0a1909373bf0ef74af863aff99 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Wed, 17 Nov 2021 16:58:38 +0300 Subject: [PATCH 0923/1196] [#355] *: regenerate proto files Add subnetwork ID to placement policy. Signed-off-by: Evgenii Stratonikov --- netmap/grpc/types.pb.go | 229 +++++++++++++++++++++------------------- refs/grpc/types.pb.go | 144 ++++++++++++++++++------- status/grpc/types.pb.go | 136 ++++++++++++------------ 3 files changed, 297 insertions(+), 212 deletions(-) diff --git a/netmap/grpc/types.pb.go b/netmap/grpc/types.pb.go index b26eef9..56fe0ab 100644 --- a/netmap/grpc/types.pb.go +++ b/netmap/grpc/types.pb.go @@ -7,6 +7,7 @@ package netmap import ( + grpc "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -459,6 +460,9 @@ type PlacementPolicy struct { Selectors []*Selector `protobuf:"bytes,3,rep,name=selectors,proto3" json:"selectors,omitempty"` // List of named filters to reference in selectors Filters []*Filter `protobuf:"bytes,4,rep,name=filters,proto3" json:"filters,omitempty"` + // Subnetwork ID to select nodes from. Zero subnet (default) represents + // all of the nodes which didn't explicitly opt out of membership. + SubnetId *grpc.SubnetID `protobuf:"bytes,5,opt,name=subnet_id,json=subnetId,proto3" json:"subnet_id,omitempty"` } func (x *PlacementPolicy) Reset() { @@ -521,6 +525,13 @@ func (x *PlacementPolicy) GetFilters() []*Filter { return nil } +func (x *PlacementPolicy) GetSubnetId() *grpc.SubnetID { + if x != nil { + return x.SubnetId + } + return nil +} + // NeoFS node description type NodeInfo struct { state protoimpl.MessageState @@ -921,105 +932,109 @@ var File_netmap_grpc_types_proto protoreflect.FileDescriptor var file_netmap_grpc_types_proto_rawDesc = []byte{ 0x0a, 0x17, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x10, 0x6e, 0x65, 0x6f, 0x2e, 0x66, - 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x22, 0xa5, 0x01, 0x0a, 0x06, - 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, - 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x2b, 0x0a, 0x02, - 0x6f, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, - 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4f, 0x70, 0x65, 0x72, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x02, 0x6f, 0x70, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, - 0x32, 0x0a, 0x07, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, - 0x6d, 0x61, 0x70, 0x2e, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x07, 0x66, 0x69, 0x6c, 0x74, - 0x65, 0x72, 0x73, 0x22, 0x9c, 0x01, 0x0a, 0x08, 0x53, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, - 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, - 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0d, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x30, 0x0a, 0x06, 0x63, 0x6c, - 0x61, 0x75, 0x73, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, - 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x43, 0x6c, - 0x61, 0x75, 0x73, 0x65, 0x52, 0x06, 0x63, 0x6c, 0x61, 0x75, 0x73, 0x65, 0x12, 0x1c, 0x0a, 0x09, - 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x09, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x66, 0x69, - 0x6c, 0x74, 0x65, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x66, 0x69, 0x6c, 0x74, - 0x65, 0x72, 0x22, 0x3b, 0x0a, 0x07, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x12, 0x14, 0x0a, - 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x63, 0x6f, - 0x75, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x22, - 0xee, 0x01, 0x0a, 0x0f, 0x50, 0x6c, 0x61, 0x63, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x50, 0x6f, 0x6c, - 0x69, 0x63, 0x79, 0x12, 0x35, 0x0a, 0x08, 0x72, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x73, 0x18, - 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, - 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, - 0x52, 0x08, 0x72, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x73, 0x12, 0x36, 0x0a, 0x17, 0x63, 0x6f, - 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x62, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x5f, 0x66, - 0x61, 0x63, 0x74, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x15, 0x63, 0x6f, 0x6e, - 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x42, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x46, 0x61, 0x63, 0x74, - 0x6f, 0x72, 0x12, 0x38, 0x0a, 0x09, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x73, 0x18, - 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, - 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x53, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, - 0x72, 0x52, 0x09, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x73, 0x12, 0x32, 0x0a, 0x07, - 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x1a, 0x15, 0x72, 0x65, 0x66, + 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x22, 0xa5, 0x01, 0x0a, 0x06, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x12, 0x0a, + 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, + 0x6b, 0x65, 0x79, 0x12, 0x2b, 0x0a, 0x02, 0x6f, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, + 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, + 0x61, 0x70, 0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x02, 0x6f, 0x70, + 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x32, 0x0a, 0x07, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, + 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, + 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x46, 0x69, 0x6c, 0x74, 0x65, + 0x72, 0x52, 0x07, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x73, 0x22, 0x9c, 0x01, 0x0a, 0x08, 0x53, + 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x63, + 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, + 0x74, 0x12, 0x30, 0x0a, 0x06, 0x63, 0x6c, 0x61, 0x75, 0x73, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x0e, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, + 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x43, 0x6c, 0x61, 0x75, 0x73, 0x65, 0x52, 0x06, 0x63, 0x6c, 0x61, + 0x75, 0x73, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, + 0x65, 0x12, 0x16, 0x0a, 0x06, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x06, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x22, 0x3b, 0x0a, 0x07, 0x52, 0x65, 0x70, + 0x6c, 0x69, 0x63, 0x61, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0d, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x65, + 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x73, 0x65, + 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x22, 0xa5, 0x02, 0x0a, 0x0f, 0x50, 0x6c, 0x61, 0x63, 0x65, + 0x6d, 0x65, 0x6e, 0x74, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x35, 0x0a, 0x08, 0x72, 0x65, + 0x70, 0x6c, 0x69, 0x63, 0x61, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, + 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x52, 0x08, 0x72, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, + 0x73, 0x12, 0x36, 0x0a, 0x17, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x62, + 0x61, 0x63, 0x6b, 0x75, 0x70, 0x5f, 0x66, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0d, 0x52, 0x15, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x42, 0x61, 0x63, + 0x6b, 0x75, 0x70, 0x46, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x12, 0x38, 0x0a, 0x09, 0x73, 0x65, 0x6c, + 0x65, 0x63, 0x74, 0x6f, 0x72, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, + 0x53, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x52, 0x09, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, + 0x6f, 0x72, 0x73, 0x12, 0x32, 0x0a, 0x07, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x73, 0x18, 0x04, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x07, + 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x73, 0x12, 0x35, 0x0a, 0x09, 0x73, 0x75, 0x62, 0x6e, 0x65, + 0x74, 0x5f, 0x69, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, + 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x75, 0x62, 0x6e, + 0x65, 0x74, 0x49, 0x44, 0x52, 0x08, 0x73, 0x75, 0x62, 0x6e, 0x65, 0x74, 0x49, 0x64, 0x22, 0xc7, + 0x02, 0x0a, 0x08, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x1d, 0x0a, 0x0a, 0x70, + 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, + 0x09, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x12, 0x1c, 0x0a, 0x09, 0x61, 0x64, + 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x09, 0x61, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x12, 0x44, 0x0a, 0x0a, 0x61, 0x74, 0x74, 0x72, + 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, + 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, + 0x74, 0x65, 0x52, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x36, + 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, - 0x2e, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x07, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x73, - 0x22, 0xc7, 0x02, 0x0a, 0x08, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x1d, 0x0a, - 0x0a, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0c, 0x52, 0x09, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x12, 0x1c, 0x0a, 0x09, - 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, - 0x09, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x12, 0x44, 0x0a, 0x0a, 0x61, 0x74, - 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, + 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, + 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x1a, 0x4d, 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, 0x12, 0x18, 0x0a, 0x07, 0x70, + 0x61, 0x72, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x70, 0x61, + 0x72, 0x65, 0x6e, 0x74, 0x73, 0x22, 0x31, 0x0a, 0x05, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x0f, + 0x0a, 0x0b, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, + 0x0a, 0x0a, 0x06, 0x4f, 0x4e, 0x4c, 0x49, 0x4e, 0x45, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x4f, + 0x46, 0x46, 0x4c, 0x49, 0x4e, 0x45, 0x10, 0x02, 0x22, 0x8f, 0x01, 0x0a, 0x0d, 0x4e, 0x65, 0x74, + 0x77, 0x6f, 0x72, 0x6b, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x49, 0x0a, 0x0a, 0x70, 0x61, + 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, - 0x70, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x41, 0x74, 0x74, 0x72, 0x69, - 0x62, 0x75, 0x74, 0x65, 0x52, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, - 0x12, 0x36, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, - 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, - 0x61, 0x70, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x53, 0x74, 0x61, 0x74, - 0x65, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x1a, 0x4d, 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, 0x12, 0x18, 0x0a, - 0x07, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, - 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x73, 0x22, 0x31, 0x0a, 0x05, 0x53, 0x74, 0x61, 0x74, 0x65, - 0x12, 0x0f, 0x0a, 0x0b, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, - 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x4f, 0x4e, 0x4c, 0x49, 0x4e, 0x45, 0x10, 0x01, 0x12, 0x0b, 0x0a, - 0x07, 0x4f, 0x46, 0x46, 0x4c, 0x49, 0x4e, 0x45, 0x10, 0x02, 0x22, 0x8f, 0x01, 0x0a, 0x0d, 0x4e, - 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x49, 0x0a, 0x0a, - 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x29, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, - 0x6d, 0x61, 0x70, 0x2e, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x43, 0x6f, 0x6e, 0x66, 0x69, - 0x67, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x52, 0x0a, 0x70, 0x61, 0x72, - 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x1a, 0x33, 0x0a, 0x09, 0x50, 0x61, 0x72, 0x61, 0x6d, - 0x65, 0x74, 0x65, 0x72, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0c, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xbf, 0x01, 0x0a, - 0x0b, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x23, 0x0a, 0x0d, - 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x04, 0x52, 0x0c, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x45, 0x70, 0x6f, 0x63, - 0x68, 0x12, 0x21, 0x0a, 0x0c, 0x6d, 0x61, 0x67, 0x69, 0x63, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, - 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0b, 0x6d, 0x61, 0x67, 0x69, 0x63, 0x4e, 0x75, - 0x6d, 0x62, 0x65, 0x72, 0x12, 0x20, 0x0a, 0x0c, 0x6d, 0x73, 0x5f, 0x70, 0x65, 0x72, 0x5f, 0x62, - 0x6c, 0x6f, 0x63, 0x6b, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x6d, 0x73, 0x50, 0x65, - 0x72, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x46, 0x0a, 0x0e, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, - 0x6b, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, - 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, - 0x70, 0x2e, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, - 0x0d, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2a, 0x67, - 0x0a, 0x09, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x19, 0x0a, 0x15, 0x4f, - 0x50, 0x45, 0x52, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, - 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x06, 0x0a, 0x02, 0x45, 0x51, 0x10, 0x01, 0x12, 0x06, - 0x0a, 0x02, 0x4e, 0x45, 0x10, 0x02, 0x12, 0x06, 0x0a, 0x02, 0x47, 0x54, 0x10, 0x03, 0x12, 0x06, - 0x0a, 0x02, 0x47, 0x45, 0x10, 0x04, 0x12, 0x06, 0x0a, 0x02, 0x4c, 0x54, 0x10, 0x05, 0x12, 0x06, - 0x0a, 0x02, 0x4c, 0x45, 0x10, 0x06, 0x12, 0x06, 0x0a, 0x02, 0x4f, 0x52, 0x10, 0x07, 0x12, 0x07, - 0x0a, 0x03, 0x41, 0x4e, 0x44, 0x10, 0x08, 0x2a, 0x38, 0x0a, 0x06, 0x43, 0x6c, 0x61, 0x75, 0x73, - 0x65, 0x12, 0x16, 0x0a, 0x12, 0x43, 0x4c, 0x41, 0x55, 0x53, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, - 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x53, 0x41, 0x4d, - 0x45, 0x10, 0x01, 0x12, 0x0c, 0x0a, 0x08, 0x44, 0x49, 0x53, 0x54, 0x49, 0x4e, 0x43, 0x54, 0x10, - 0x02, 0x42, 0x56, 0x5a, 0x37, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, - 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, - 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, - 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0xaa, 0x02, 0x1a, 0x4e, - 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, - 0x50, 0x49, 0x2e, 0x4e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x33, + 0x70, 0x2e, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, + 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x52, 0x0a, 0x70, 0x61, 0x72, 0x61, 0x6d, + 0x65, 0x74, 0x65, 0x72, 0x73, 0x1a, 0x33, 0x0a, 0x09, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, + 0x65, 0x72, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, + 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xbf, 0x01, 0x0a, 0x0b, 0x4e, + 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x23, 0x0a, 0x0d, 0x63, 0x75, + 0x72, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x04, 0x52, 0x0c, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x45, 0x70, 0x6f, 0x63, 0x68, 0x12, + 0x21, 0x0a, 0x0c, 0x6d, 0x61, 0x67, 0x69, 0x63, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0b, 0x6d, 0x61, 0x67, 0x69, 0x63, 0x4e, 0x75, 0x6d, 0x62, + 0x65, 0x72, 0x12, 0x20, 0x0a, 0x0c, 0x6d, 0x73, 0x5f, 0x70, 0x65, 0x72, 0x5f, 0x62, 0x6c, 0x6f, + 0x63, 0x6b, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x6d, 0x73, 0x50, 0x65, 0x72, 0x42, + 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x46, 0x0a, 0x0e, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x5f, + 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, + 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x0d, 0x6e, + 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2a, 0x67, 0x0a, 0x09, + 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x19, 0x0a, 0x15, 0x4f, 0x50, 0x45, + 0x52, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, + 0x45, 0x44, 0x10, 0x00, 0x12, 0x06, 0x0a, 0x02, 0x45, 0x51, 0x10, 0x01, 0x12, 0x06, 0x0a, 0x02, + 0x4e, 0x45, 0x10, 0x02, 0x12, 0x06, 0x0a, 0x02, 0x47, 0x54, 0x10, 0x03, 0x12, 0x06, 0x0a, 0x02, + 0x47, 0x45, 0x10, 0x04, 0x12, 0x06, 0x0a, 0x02, 0x4c, 0x54, 0x10, 0x05, 0x12, 0x06, 0x0a, 0x02, + 0x4c, 0x45, 0x10, 0x06, 0x12, 0x06, 0x0a, 0x02, 0x4f, 0x52, 0x10, 0x07, 0x12, 0x07, 0x0a, 0x03, + 0x41, 0x4e, 0x44, 0x10, 0x08, 0x2a, 0x38, 0x0a, 0x06, 0x43, 0x6c, 0x61, 0x75, 0x73, 0x65, 0x12, + 0x16, 0x0a, 0x12, 0x43, 0x4c, 0x41, 0x55, 0x53, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, + 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x53, 0x41, 0x4d, 0x45, 0x10, + 0x01, 0x12, 0x0c, 0x0a, 0x08, 0x44, 0x49, 0x53, 0x54, 0x49, 0x4e, 0x43, 0x54, 0x10, 0x02, 0x42, + 0x56, 0x5a, 0x37, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, + 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, + 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2f, 0x67, + 0x72, 0x70, 0x63, 0x3b, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0xaa, 0x02, 0x1a, 0x4e, 0x65, 0x6f, + 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, + 0x2e, 0x4e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -1049,6 +1064,7 @@ var file_netmap_grpc_types_proto_goTypes = []interface{}{ (*NetworkInfo)(nil), // 9: neo.fs.v2.netmap.NetworkInfo (*NodeInfo_Attribute)(nil), // 10: neo.fs.v2.netmap.NodeInfo.Attribute (*NetworkConfig_Parameter)(nil), // 11: neo.fs.v2.netmap.NetworkConfig.Parameter + (*grpc.SubnetID)(nil), // 12: neo.fs.v2.refs.SubnetID } var file_netmap_grpc_types_proto_depIdxs = []int32{ 0, // 0: neo.fs.v2.netmap.Filter.op:type_name -> neo.fs.v2.netmap.Operation @@ -1057,15 +1073,16 @@ var file_netmap_grpc_types_proto_depIdxs = []int32{ 5, // 3: neo.fs.v2.netmap.PlacementPolicy.replicas:type_name -> neo.fs.v2.netmap.Replica 4, // 4: neo.fs.v2.netmap.PlacementPolicy.selectors:type_name -> neo.fs.v2.netmap.Selector 3, // 5: neo.fs.v2.netmap.PlacementPolicy.filters:type_name -> neo.fs.v2.netmap.Filter - 10, // 6: neo.fs.v2.netmap.NodeInfo.attributes:type_name -> neo.fs.v2.netmap.NodeInfo.Attribute - 2, // 7: neo.fs.v2.netmap.NodeInfo.state:type_name -> neo.fs.v2.netmap.NodeInfo.State - 11, // 8: neo.fs.v2.netmap.NetworkConfig.parameters:type_name -> neo.fs.v2.netmap.NetworkConfig.Parameter - 8, // 9: neo.fs.v2.netmap.NetworkInfo.network_config:type_name -> neo.fs.v2.netmap.NetworkConfig - 10, // [10:10] is the sub-list for method output_type - 10, // [10:10] is the sub-list for method input_type - 10, // [10:10] is the sub-list for extension type_name - 10, // [10:10] is the sub-list for extension extendee - 0, // [0:10] is the sub-list for field type_name + 12, // 6: neo.fs.v2.netmap.PlacementPolicy.subnet_id:type_name -> neo.fs.v2.refs.SubnetID + 10, // 7: neo.fs.v2.netmap.NodeInfo.attributes:type_name -> neo.fs.v2.netmap.NodeInfo.Attribute + 2, // 8: neo.fs.v2.netmap.NodeInfo.state:type_name -> neo.fs.v2.netmap.NodeInfo.State + 11, // 9: neo.fs.v2.netmap.NetworkConfig.parameters:type_name -> neo.fs.v2.netmap.NetworkConfig.Parameter + 8, // 10: neo.fs.v2.netmap.NetworkInfo.network_config:type_name -> neo.fs.v2.netmap.NetworkConfig + 11, // [11:11] is the sub-list for method output_type + 11, // [11:11] is the sub-list for method input_type + 11, // [11:11] is the sub-list for extension type_name + 11, // [11:11] is the sub-list for extension extendee + 0, // [0:11] is the sub-list for field type_name } func init() { file_netmap_grpc_types_proto_init() } diff --git a/refs/grpc/types.pb.go b/refs/grpc/types.pb.go index 34c6186..6fe5077 100644 --- a/refs/grpc/types.pb.go +++ b/refs/grpc/types.pb.go @@ -324,6 +324,59 @@ func (x *OwnerID) GetValue() []byte { return nil } +// NeoFS subnetwork identifier. +// +// String representation of a value is base-10 integer. +// +// JSON representation is an object containing single `value` number field. +type SubnetID struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // 4-byte integer subnetwork identifier. + Value uint32 `protobuf:"fixed32,1,opt,name=value,proto3" json:"value,omitempty"` +} + +func (x *SubnetID) Reset() { + *x = SubnetID{} + if protoimpl.UnsafeEnabled { + mi := &file_refs_grpc_types_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SubnetID) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SubnetID) ProtoMessage() {} + +func (x *SubnetID) ProtoReflect() protoreflect.Message { + mi := &file_refs_grpc_types_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SubnetID.ProtoReflect.Descriptor instead. +func (*SubnetID) Descriptor() ([]byte, []int) { + return file_refs_grpc_types_proto_rawDescGZIP(), []int{4} +} + +func (x *SubnetID) GetValue() uint32 { + if x != nil { + return x.Value + } + return 0 +} + // API version used by a node. // // String presentation is a Semantic Versioning 2.0.0 compatible version string @@ -342,7 +395,7 @@ type Version struct { func (x *Version) Reset() { *x = Version{} if protoimpl.UnsafeEnabled { - mi := &file_refs_grpc_types_proto_msgTypes[4] + mi := &file_refs_grpc_types_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -355,7 +408,7 @@ func (x *Version) String() string { func (*Version) ProtoMessage() {} func (x *Version) ProtoReflect() protoreflect.Message { - mi := &file_refs_grpc_types_proto_msgTypes[4] + mi := &file_refs_grpc_types_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -368,7 +421,7 @@ func (x *Version) ProtoReflect() protoreflect.Message { // Deprecated: Use Version.ProtoReflect.Descriptor instead. func (*Version) Descriptor() ([]byte, []int) { - return file_refs_grpc_types_proto_rawDescGZIP(), []int{4} + return file_refs_grpc_types_proto_rawDescGZIP(), []int{5} } func (x *Version) GetMajor() uint32 { @@ -400,7 +453,7 @@ type Signature struct { func (x *Signature) Reset() { *x = Signature{} if protoimpl.UnsafeEnabled { - mi := &file_refs_grpc_types_proto_msgTypes[5] + mi := &file_refs_grpc_types_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -413,7 +466,7 @@ func (x *Signature) String() string { func (*Signature) ProtoMessage() {} func (x *Signature) ProtoReflect() protoreflect.Message { - mi := &file_refs_grpc_types_proto_msgTypes[5] + mi := &file_refs_grpc_types_proto_msgTypes[6] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -426,7 +479,7 @@ func (x *Signature) ProtoReflect() protoreflect.Message { // Deprecated: Use Signature.ProtoReflect.Descriptor instead. func (*Signature) Descriptor() ([]byte, []int) { - return file_refs_grpc_types_proto_rawDescGZIP(), []int{5} + return file_refs_grpc_types_proto_rawDescGZIP(), []int{6} } func (x *Signature) GetKey() []byte { @@ -464,7 +517,7 @@ type Checksum struct { func (x *Checksum) Reset() { *x = Checksum{} if protoimpl.UnsafeEnabled { - mi := &file_refs_grpc_types_proto_msgTypes[6] + mi := &file_refs_grpc_types_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -477,7 +530,7 @@ func (x *Checksum) String() string { func (*Checksum) ProtoMessage() {} func (x *Checksum) ProtoReflect() protoreflect.Message { - mi := &file_refs_grpc_types_proto_msgTypes[6] + mi := &file_refs_grpc_types_proto_msgTypes[7] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -490,7 +543,7 @@ func (x *Checksum) ProtoReflect() protoreflect.Message { // Deprecated: Use Checksum.ProtoReflect.Descriptor instead. func (*Checksum) Descriptor() ([]byte, []int) { - return file_refs_grpc_types_proto_rawDescGZIP(), []int{6} + return file_refs_grpc_types_proto_rawDescGZIP(), []int{7} } func (x *Checksum) GetType() ChecksumType { @@ -527,28 +580,30 @@ var file_refs_grpc_types_proto_rawDesc = []byte{ 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x1f, 0x0a, 0x07, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x22, 0x35, 0x0a, 0x07, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x14, 0x0a, - 0x05, 0x6d, 0x61, 0x6a, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x6d, 0x61, - 0x6a, 0x6f, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x6d, 0x69, 0x6e, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0d, 0x52, 0x05, 0x6d, 0x69, 0x6e, 0x6f, 0x72, 0x22, 0x36, 0x0a, 0x09, 0x53, 0x69, 0x67, - 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0c, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x69, 0x67, 0x6e, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, - 0x65, 0x22, 0x4e, 0x0a, 0x08, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x12, 0x30, 0x0a, - 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1c, 0x2e, 0x6e, 0x65, - 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x68, 0x65, - 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, - 0x10, 0x0a, 0x03, 0x73, 0x75, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x03, 0x73, 0x75, - 0x6d, 0x2a, 0x41, 0x0a, 0x0c, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x54, 0x79, 0x70, - 0x65, 0x12, 0x1d, 0x0a, 0x19, 0x43, 0x48, 0x45, 0x43, 0x4b, 0x53, 0x55, 0x4d, 0x5f, 0x54, 0x59, - 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, - 0x12, 0x06, 0x0a, 0x02, 0x54, 0x5a, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x53, 0x48, 0x41, 0x32, - 0x35, 0x36, 0x10, 0x02, 0x42, 0x50, 0x5a, 0x33, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, - 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, - 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x72, 0x65, 0x66, - 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x72, 0x65, 0x66, 0x73, 0xaa, 0x02, 0x18, 0x4e, 0x65, - 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, - 0x49, 0x2e, 0x52, 0x65, 0x66, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x75, 0x65, 0x22, 0x20, 0x0a, 0x08, 0x53, 0x75, 0x62, 0x6e, 0x65, 0x74, 0x49, 0x44, 0x12, 0x14, + 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x07, 0x52, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x22, 0x35, 0x0a, 0x07, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, + 0x14, 0x0a, 0x05, 0x6d, 0x61, 0x6a, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, + 0x6d, 0x61, 0x6a, 0x6f, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x6d, 0x69, 0x6e, 0x6f, 0x72, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x6d, 0x69, 0x6e, 0x6f, 0x72, 0x22, 0x36, 0x0a, 0x09, 0x53, + 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x69, + 0x67, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, + 0x75, 0x72, 0x65, 0x22, 0x4e, 0x0a, 0x08, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x12, + 0x30, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1c, 0x2e, + 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, + 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, + 0x65, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x75, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x03, + 0x73, 0x75, 0x6d, 0x2a, 0x41, 0x0a, 0x0c, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x54, + 0x79, 0x70, 0x65, 0x12, 0x1d, 0x0a, 0x19, 0x43, 0x48, 0x45, 0x43, 0x4b, 0x53, 0x55, 0x4d, 0x5f, + 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, + 0x10, 0x00, 0x12, 0x06, 0x0a, 0x02, 0x54, 0x5a, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x53, 0x48, + 0x41, 0x32, 0x35, 0x36, 0x10, 0x02, 0x42, 0x50, 0x5a, 0x33, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, + 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, + 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x72, + 0x65, 0x66, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x72, 0x65, 0x66, 0x73, 0xaa, 0x02, 0x18, + 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, + 0x41, 0x50, 0x49, 0x2e, 0x52, 0x65, 0x66, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -564,16 +619,17 @@ func file_refs_grpc_types_proto_rawDescGZIP() []byte { } var file_refs_grpc_types_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_refs_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 7) +var file_refs_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 8) var file_refs_grpc_types_proto_goTypes = []interface{}{ (ChecksumType)(0), // 0: neo.fs.v2.refs.ChecksumType (*Address)(nil), // 1: neo.fs.v2.refs.Address (*ObjectID)(nil), // 2: neo.fs.v2.refs.ObjectID (*ContainerID)(nil), // 3: neo.fs.v2.refs.ContainerID (*OwnerID)(nil), // 4: neo.fs.v2.refs.OwnerID - (*Version)(nil), // 5: neo.fs.v2.refs.Version - (*Signature)(nil), // 6: neo.fs.v2.refs.Signature - (*Checksum)(nil), // 7: neo.fs.v2.refs.Checksum + (*SubnetID)(nil), // 5: neo.fs.v2.refs.SubnetID + (*Version)(nil), // 6: neo.fs.v2.refs.Version + (*Signature)(nil), // 7: neo.fs.v2.refs.Signature + (*Checksum)(nil), // 8: neo.fs.v2.refs.Checksum } var file_refs_grpc_types_proto_depIdxs = []int32{ 3, // 0: neo.fs.v2.refs.Address.container_id:type_name -> neo.fs.v2.refs.ContainerID @@ -641,7 +697,7 @@ func file_refs_grpc_types_proto_init() { } } file_refs_grpc_types_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Version); i { + switch v := v.(*SubnetID); i { case 0: return &v.state case 1: @@ -653,7 +709,7 @@ func file_refs_grpc_types_proto_init() { } } file_refs_grpc_types_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Signature); i { + switch v := v.(*Version); i { case 0: return &v.state case 1: @@ -665,6 +721,18 @@ func file_refs_grpc_types_proto_init() { } } file_refs_grpc_types_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Signature); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_refs_grpc_types_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Checksum); i { case 0: return &v.state @@ -683,7 +751,7 @@ func file_refs_grpc_types_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_refs_grpc_types_proto_rawDesc, NumEnums: 1, - NumMessages: 7, + NumMessages: 8, NumExtensions: 0, NumServices: 0, }, diff --git a/status/grpc/types.pb.go b/status/grpc/types.pb.go index f09a093..ed98123 100644 --- a/status/grpc/types.pb.go +++ b/status/grpc/types.pb.go @@ -2,7 +2,7 @@ // versions: // protoc-gen-go v1.27.1 // protoc v3.18.0 -// source: v2/status/grpc/types.proto +// source: status/grpc/types.proto package status @@ -53,11 +53,11 @@ func (x Section) String() string { } func (Section) Descriptor() protoreflect.EnumDescriptor { - return file_v2_status_grpc_types_proto_enumTypes[0].Descriptor() + return file_status_grpc_types_proto_enumTypes[0].Descriptor() } func (Section) Type() protoreflect.EnumType { - return &file_v2_status_grpc_types_proto_enumTypes[0] + return &file_status_grpc_types_proto_enumTypes[0] } func (x Section) Number() protoreflect.EnumNumber { @@ -66,7 +66,7 @@ func (x Section) Number() protoreflect.EnumNumber { // Deprecated: Use Section.Descriptor instead. func (Section) EnumDescriptor() ([]byte, []int) { - return file_v2_status_grpc_types_proto_rawDescGZIP(), []int{0} + return file_status_grpc_types_proto_rawDescGZIP(), []int{0} } // Section of NeoFS successful return codes. @@ -100,11 +100,11 @@ func (x Success) String() string { } func (Success) Descriptor() protoreflect.EnumDescriptor { - return file_v2_status_grpc_types_proto_enumTypes[1].Descriptor() + return file_status_grpc_types_proto_enumTypes[1].Descriptor() } func (Success) Type() protoreflect.EnumType { - return &file_v2_status_grpc_types_proto_enumTypes[1] + return &file_status_grpc_types_proto_enumTypes[1] } func (x Success) Number() protoreflect.EnumNumber { @@ -113,7 +113,7 @@ func (x Success) Number() protoreflect.EnumNumber { // Deprecated: Use Success.Descriptor instead. func (Success) EnumDescriptor() ([]byte, []int) { - return file_v2_status_grpc_types_proto_rawDescGZIP(), []int{1} + return file_status_grpc_types_proto_rawDescGZIP(), []int{1} } // Section of failed statuses independent of the operation. @@ -147,11 +147,11 @@ func (x CommonFail) String() string { } func (CommonFail) Descriptor() protoreflect.EnumDescriptor { - return file_v2_status_grpc_types_proto_enumTypes[2].Descriptor() + return file_status_grpc_types_proto_enumTypes[2].Descriptor() } func (CommonFail) Type() protoreflect.EnumType { - return &file_v2_status_grpc_types_proto_enumTypes[2] + return &file_status_grpc_types_proto_enumTypes[2] } func (x CommonFail) Number() protoreflect.EnumNumber { @@ -160,7 +160,7 @@ func (x CommonFail) Number() protoreflect.EnumNumber { // Deprecated: Use CommonFail.Descriptor instead. func (CommonFail) EnumDescriptor() ([]byte, []int) { - return file_v2_status_grpc_types_proto_rawDescGZIP(), []int{2} + return file_status_grpc_types_proto_rawDescGZIP(), []int{2} } // Declares the general format of the status returns of the NeoFS RPC protocol. @@ -206,7 +206,7 @@ type Status struct { func (x *Status) Reset() { *x = Status{} if protoimpl.UnsafeEnabled { - mi := &file_v2_status_grpc_types_proto_msgTypes[0] + mi := &file_status_grpc_types_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -219,7 +219,7 @@ func (x *Status) String() string { func (*Status) ProtoMessage() {} func (x *Status) ProtoReflect() protoreflect.Message { - mi := &file_v2_status_grpc_types_proto_msgTypes[0] + mi := &file_status_grpc_types_proto_msgTypes[0] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -232,7 +232,7 @@ func (x *Status) ProtoReflect() protoreflect.Message { // Deprecated: Use Status.ProtoReflect.Descriptor instead. func (*Status) Descriptor() ([]byte, []int) { - return file_v2_status_grpc_types_proto_rawDescGZIP(), []int{0} + return file_status_grpc_types_proto_rawDescGZIP(), []int{0} } func (x *Status) GetCode() uint32 { @@ -276,7 +276,7 @@ type Status_Detail struct { func (x *Status_Detail) Reset() { *x = Status_Detail{} if protoimpl.UnsafeEnabled { - mi := &file_v2_status_grpc_types_proto_msgTypes[1] + mi := &file_status_grpc_types_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -289,7 +289,7 @@ func (x *Status_Detail) String() string { func (*Status_Detail) ProtoMessage() {} func (x *Status_Detail) ProtoReflect() protoreflect.Message { - mi := &file_v2_status_grpc_types_proto_msgTypes[1] + mi := &file_status_grpc_types_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -302,7 +302,7 @@ func (x *Status_Detail) ProtoReflect() protoreflect.Message { // Deprecated: Use Status_Detail.ProtoReflect.Descriptor instead. func (*Status_Detail) Descriptor() ([]byte, []int) { - return file_v2_status_grpc_types_proto_rawDescGZIP(), []int{0, 0} + return file_status_grpc_types_proto_rawDescGZIP(), []int{0, 0} } func (x *Status_Detail) GetId() uint32 { @@ -319,59 +319,59 @@ func (x *Status_Detail) GetValue() []byte { return nil } -var File_v2_status_grpc_types_proto protoreflect.FileDescriptor +var File_status_grpc_types_proto protoreflect.FileDescriptor -var file_v2_status_grpc_types_proto_rawDesc = []byte{ - 0x0a, 0x1a, 0x76, 0x32, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, - 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x10, 0x6e, 0x65, - 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0xa1, - 0x01, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, - 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x18, 0x0a, - 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, - 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x39, 0x0a, 0x07, 0x64, 0x65, 0x74, 0x61, 0x69, - 0x6c, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, - 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x53, 0x74, 0x61, 0x74, - 0x75, 0x73, 0x2e, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x07, 0x64, 0x65, 0x74, 0x61, 0x69, - 0x6c, 0x73, 0x1a, 0x2e, 0x0a, 0x06, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x12, 0x0e, 0x0a, 0x02, - 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x02, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x2a, 0x3a, 0x0a, 0x07, 0x53, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x13, 0x0a, - 0x0f, 0x53, 0x45, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x53, 0x55, 0x43, 0x43, 0x45, 0x53, 0x53, - 0x10, 0x00, 0x12, 0x1a, 0x0a, 0x16, 0x53, 0x45, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x46, 0x41, - 0x49, 0x4c, 0x55, 0x52, 0x45, 0x5f, 0x43, 0x4f, 0x4d, 0x4d, 0x4f, 0x4e, 0x10, 0x01, 0x2a, 0x11, - 0x0a, 0x07, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x06, 0x0a, 0x02, 0x4f, 0x4b, 0x10, - 0x00, 0x2a, 0x1a, 0x0a, 0x0a, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x46, 0x61, 0x69, 0x6c, 0x12, - 0x0c, 0x0a, 0x08, 0x49, 0x4e, 0x54, 0x45, 0x52, 0x4e, 0x41, 0x4c, 0x10, 0x00, 0x42, 0x56, 0x5a, - 0x37, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, - 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, - 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2f, 0x67, 0x72, 0x70, - 0x63, 0x3b, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0xaa, 0x02, 0x1a, 0x4e, 0x65, 0x6f, 0x2e, 0x46, - 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x53, - 0x74, 0x61, 0x74, 0x75, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +var file_status_grpc_types_proto_rawDesc = []byte{ + 0x0a, 0x17, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, + 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x10, 0x6e, 0x65, 0x6f, 0x2e, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0xa1, 0x01, 0x0a, 0x06, + 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0d, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, + 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x12, 0x39, 0x0a, 0x07, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x18, + 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, + 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x07, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x1a, + 0x2e, 0x0a, 0x06, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x02, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x2a, + 0x3a, 0x0a, 0x07, 0x53, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x13, 0x0a, 0x0f, 0x53, 0x45, + 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x53, 0x55, 0x43, 0x43, 0x45, 0x53, 0x53, 0x10, 0x00, 0x12, + 0x1a, 0x0a, 0x16, 0x53, 0x45, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x46, 0x41, 0x49, 0x4c, 0x55, + 0x52, 0x45, 0x5f, 0x43, 0x4f, 0x4d, 0x4d, 0x4f, 0x4e, 0x10, 0x01, 0x2a, 0x11, 0x0a, 0x07, 0x53, + 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x06, 0x0a, 0x02, 0x4f, 0x4b, 0x10, 0x00, 0x2a, 0x1a, + 0x0a, 0x0a, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x46, 0x61, 0x69, 0x6c, 0x12, 0x0c, 0x0a, 0x08, + 0x49, 0x4e, 0x54, 0x45, 0x52, 0x4e, 0x41, 0x4c, 0x10, 0x00, 0x42, 0x56, 0x5a, 0x37, 0x67, 0x69, + 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, + 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, + 0x76, 0x32, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x73, + 0x74, 0x61, 0x74, 0x75, 0x73, 0xaa, 0x02, 0x1a, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, + 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x53, 0x74, 0x61, 0x74, + 0x75, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( - file_v2_status_grpc_types_proto_rawDescOnce sync.Once - file_v2_status_grpc_types_proto_rawDescData = file_v2_status_grpc_types_proto_rawDesc + file_status_grpc_types_proto_rawDescOnce sync.Once + file_status_grpc_types_proto_rawDescData = file_status_grpc_types_proto_rawDesc ) -func file_v2_status_grpc_types_proto_rawDescGZIP() []byte { - file_v2_status_grpc_types_proto_rawDescOnce.Do(func() { - file_v2_status_grpc_types_proto_rawDescData = protoimpl.X.CompressGZIP(file_v2_status_grpc_types_proto_rawDescData) +func file_status_grpc_types_proto_rawDescGZIP() []byte { + file_status_grpc_types_proto_rawDescOnce.Do(func() { + file_status_grpc_types_proto_rawDescData = protoimpl.X.CompressGZIP(file_status_grpc_types_proto_rawDescData) }) - return file_v2_status_grpc_types_proto_rawDescData + return file_status_grpc_types_proto_rawDescData } -var file_v2_status_grpc_types_proto_enumTypes = make([]protoimpl.EnumInfo, 3) -var file_v2_status_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_v2_status_grpc_types_proto_goTypes = []interface{}{ +var file_status_grpc_types_proto_enumTypes = make([]protoimpl.EnumInfo, 3) +var file_status_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_status_grpc_types_proto_goTypes = []interface{}{ (Section)(0), // 0: neo.fs.v2.status.Section (Success)(0), // 1: neo.fs.v2.status.Success (CommonFail)(0), // 2: neo.fs.v2.status.CommonFail (*Status)(nil), // 3: neo.fs.v2.status.Status (*Status_Detail)(nil), // 4: neo.fs.v2.status.Status.Detail } -var file_v2_status_grpc_types_proto_depIdxs = []int32{ +var file_status_grpc_types_proto_depIdxs = []int32{ 4, // 0: neo.fs.v2.status.Status.details:type_name -> neo.fs.v2.status.Status.Detail 1, // [1:1] is the sub-list for method output_type 1, // [1:1] is the sub-list for method input_type @@ -380,13 +380,13 @@ var file_v2_status_grpc_types_proto_depIdxs = []int32{ 0, // [0:1] is the sub-list for field type_name } -func init() { file_v2_status_grpc_types_proto_init() } -func file_v2_status_grpc_types_proto_init() { - if File_v2_status_grpc_types_proto != nil { +func init() { file_status_grpc_types_proto_init() } +func file_status_grpc_types_proto_init() { + if File_status_grpc_types_proto != nil { return } if !protoimpl.UnsafeEnabled { - file_v2_status_grpc_types_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_status_grpc_types_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Status); i { case 0: return &v.state @@ -398,7 +398,7 @@ func file_v2_status_grpc_types_proto_init() { return nil } } - file_v2_status_grpc_types_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_status_grpc_types_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Status_Detail); i { case 0: return &v.state @@ -415,19 +415,19 @@ func file_v2_status_grpc_types_proto_init() { out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_v2_status_grpc_types_proto_rawDesc, + RawDescriptor: file_status_grpc_types_proto_rawDesc, NumEnums: 3, NumMessages: 2, NumExtensions: 0, NumServices: 0, }, - GoTypes: file_v2_status_grpc_types_proto_goTypes, - DependencyIndexes: file_v2_status_grpc_types_proto_depIdxs, - EnumInfos: file_v2_status_grpc_types_proto_enumTypes, - MessageInfos: file_v2_status_grpc_types_proto_msgTypes, + GoTypes: file_status_grpc_types_proto_goTypes, + DependencyIndexes: file_status_grpc_types_proto_depIdxs, + EnumInfos: file_status_grpc_types_proto_enumTypes, + MessageInfos: file_status_grpc_types_proto_msgTypes, }.Build() - File_v2_status_grpc_types_proto = out.File - file_v2_status_grpc_types_proto_rawDesc = nil - file_v2_status_grpc_types_proto_goTypes = nil - file_v2_status_grpc_types_proto_depIdxs = nil + File_status_grpc_types_proto = out.File + file_status_grpc_types_proto_rawDesc = nil + file_status_grpc_types_proto_goTypes = nil + file_status_grpc_types_proto_depIdxs = nil } From 68f28a1918238922c47c300393f7dd2a58488ae1 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Wed, 17 Nov 2021 16:58:38 +0300 Subject: [PATCH 0924/1196] [#355] v2/refs: add subnetwork ID Signed-off-by: Evgenii Stratonikov --- netmap/types.go | 9 +++++++++ refs/types.go | 17 +++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/netmap/types.go b/netmap/types.go index af8fb6f..dc32805 100644 --- a/netmap/types.go +++ b/netmap/types.go @@ -59,6 +59,7 @@ type PlacementPolicy struct { backupFactor uint32 selectors []*Selector filters []*Filter + subnetID *refs.SubnetID } // Attribute of storage node. @@ -330,6 +331,14 @@ func (p *PlacementPolicy) SetReplicas(replicas []*Replica) { p.replicas = replicas } +func (p *PlacementPolicy) GetSubnetID() *refs.SubnetID { + return p.subnetID +} + +func (p *PlacementPolicy) SetSubnetID(id *refs.SubnetID) { + p.subnetID = id +} + func (a *Attribute) GetKey() string { if a != nil { return a.key diff --git a/refs/types.go b/refs/types.go index 0b90268..f3ce145 100644 --- a/refs/types.go +++ b/refs/types.go @@ -30,6 +30,10 @@ type Signature struct { key, sign []byte } +type SubnetID struct { + value uint32 +} + type Version struct { major, minor uint32 } @@ -166,6 +170,19 @@ func (s *Signature) SetSign(v []byte) { } } +func (s *SubnetID) SetValue(id uint32) { + if s != nil { + s.value = id + } +} + +func (s *SubnetID) GetValue() uint32 { + if s != nil { + return s.value + } + return 0 +} + func (v *Version) GetMajor() uint32 { if v != nil { return v.major From d015b1d6793d1496d816f2a47dbca95a9321a368 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 18 Nov 2021 11:55:15 +0300 Subject: [PATCH 0925/1196] [#355] Re-compile NeoFS API sources with subnet types Signed-off-by: Leonard Lyubich --- subnet/grpc/types.pb.go | 170 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 170 insertions(+) create mode 100644 subnet/grpc/types.pb.go diff --git a/subnet/grpc/types.pb.go b/subnet/grpc/types.pb.go new file mode 100644 index 0000000..fade308 --- /dev/null +++ b/subnet/grpc/types.pb.go @@ -0,0 +1,170 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.1 +// protoc v3.18.0 +// source: subnet/grpc/types.proto + +package subnet + +import ( + grpc "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +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) +) + +// NeoFS subnetwork description +type SubnetInfo struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Unique subnet identifier. Missing ID is + // equivalent to zero (default subnetwork) ID. + Id *grpc.SubnetID `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + // Identifier of the subnetwork owner + Owner *grpc.OwnerID `protobuf:"bytes,2,opt,name=owner,proto3" json:"owner,omitempty"` +} + +func (x *SubnetInfo) Reset() { + *x = SubnetInfo{} + if protoimpl.UnsafeEnabled { + mi := &file_subnet_grpc_types_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SubnetInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SubnetInfo) ProtoMessage() {} + +func (x *SubnetInfo) ProtoReflect() protoreflect.Message { + mi := &file_subnet_grpc_types_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SubnetInfo.ProtoReflect.Descriptor instead. +func (*SubnetInfo) Descriptor() ([]byte, []int) { + return file_subnet_grpc_types_proto_rawDescGZIP(), []int{0} +} + +func (x *SubnetInfo) GetId() *grpc.SubnetID { + if x != nil { + return x.Id + } + return nil +} + +func (x *SubnetInfo) GetOwner() *grpc.OwnerID { + if x != nil { + return x.Owner + } + return nil +} + +var File_subnet_grpc_types_proto protoreflect.FileDescriptor + +var file_subnet_grpc_types_proto_rawDesc = []byte{ + 0x0a, 0x17, 0x73, 0x75, 0x62, 0x6e, 0x65, 0x74, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, + 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x10, 0x6e, 0x65, 0x6f, 0x2e, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x75, 0x62, 0x6e, 0x65, 0x74, 0x1a, 0x15, 0x72, 0x65, 0x66, + 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x22, 0x65, 0x0a, 0x0a, 0x53, 0x75, 0x62, 0x6e, 0x65, 0x74, 0x49, 0x6e, 0x66, 0x6f, + 0x12, 0x28, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x75, + 0x62, 0x6e, 0x65, 0x74, 0x49, 0x44, 0x52, 0x02, 0x69, 0x64, 0x12, 0x2d, 0x0a, 0x05, 0x6f, 0x77, + 0x6e, 0x65, 0x72, 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, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x42, 0x56, 0x5a, 0x37, 0x67, 0x69, 0x74, + 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, + 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, + 0x32, 0x2f, 0x73, 0x75, 0x62, 0x6e, 0x65, 0x74, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x73, 0x75, + 0x62, 0x6e, 0x65, 0x74, 0xaa, 0x02, 0x1a, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, + 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x53, 0x75, 0x62, 0x6e, 0x65, + 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_subnet_grpc_types_proto_rawDescOnce sync.Once + file_subnet_grpc_types_proto_rawDescData = file_subnet_grpc_types_proto_rawDesc +) + +func file_subnet_grpc_types_proto_rawDescGZIP() []byte { + file_subnet_grpc_types_proto_rawDescOnce.Do(func() { + file_subnet_grpc_types_proto_rawDescData = protoimpl.X.CompressGZIP(file_subnet_grpc_types_proto_rawDescData) + }) + return file_subnet_grpc_types_proto_rawDescData +} + +var file_subnet_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_subnet_grpc_types_proto_goTypes = []interface{}{ + (*SubnetInfo)(nil), // 0: neo.fs.v2.subnet.SubnetInfo + (*grpc.SubnetID)(nil), // 1: neo.fs.v2.refs.SubnetID + (*grpc.OwnerID)(nil), // 2: neo.fs.v2.refs.OwnerID +} +var file_subnet_grpc_types_proto_depIdxs = []int32{ + 1, // 0: neo.fs.v2.subnet.SubnetInfo.id:type_name -> neo.fs.v2.refs.SubnetID + 2, // 1: neo.fs.v2.subnet.SubnetInfo.owner:type_name -> neo.fs.v2.refs.OwnerID + 2, // [2:2] is the sub-list for method output_type + 2, // [2:2] is the sub-list for method input_type + 2, // [2:2] is the sub-list for extension type_name + 2, // [2:2] is the sub-list for extension extendee + 0, // [0:2] is the sub-list for field type_name +} + +func init() { file_subnet_grpc_types_proto_init() } +func file_subnet_grpc_types_proto_init() { + if File_subnet_grpc_types_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_subnet_grpc_types_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SubnetInfo); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_subnet_grpc_types_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_subnet_grpc_types_proto_goTypes, + DependencyIndexes: file_subnet_grpc_types_proto_depIdxs, + MessageInfos: file_subnet_grpc_types_proto_msgTypes, + }.Build() + File_subnet_grpc_types_proto = out.File + file_subnet_grpc_types_proto_rawDesc = nil + file_subnet_grpc_types_proto_goTypes = nil + file_subnet_grpc_types_proto_depIdxs = nil +} From b0a2b73650d04f5f859cac10bb6a512e523ba312 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 18 Nov 2021 16:14:49 +0300 Subject: [PATCH 0926/1196] [#355] util/proto: Support fixed32 fields Implement `Fixed32Marshal` / `Fixed32Size` functions which allow to work with protobuf fixed32 fields. Signed-off-by: Leonard Lyubich --- util/proto/marshal.go | 31 +++++++++++++++++++++++ util/proto/marshal_test.go | 37 +++++++++++++++++++++++++++ util/proto/test/test.pb.go | 52 +++++++++++++++++++++++--------------- 3 files changed, 99 insertions(+), 21 deletions(-) diff --git a/util/proto/marshal.go b/util/proto/marshal.go index a602b78..21e8013 100644 --- a/util/proto/marshal.go +++ b/util/proto/marshal.go @@ -384,3 +384,34 @@ func Float64Size(fNum int, v float64) int { return VarUIntSize(uint64(prefix)) + 8 } + +// Fixed32Marshal encodes uint32 value to Protocol Buffers fixed32 field with specified number, +// and writes it to specified buffer. Returns number of bytes written. +// +// Panics if the buffer is undersized. +func Fixed32Marshal(field int, buf []byte, v uint32) int { + if v == 0 { + return 0 + } + + prefix := field<<3 | 5 + + // buf length check can prevent panic at PutUvarint, but it will make + // marshaller a bit slower. + i := binary.PutUvarint(buf, uint64(prefix)) + binary.LittleEndian.PutUint32(buf[i:], v) + + return i + 4 +} + +// Fixed32Size returns number of bytes required to encode uint32 value to Protocol Buffers fixed32 field +// with specified number. +func Fixed32Size(fNum int, v uint32) int { + if v == 0 { + return 0 + } + + prefix := fNum<<3 | 5 + + return VarUIntSize(uint64(prefix)) + 4 +} diff --git a/util/proto/marshal_test.go b/util/proto/marshal_test.go index ba78c00..a3f6882 100644 --- a/util/proto/marshal_test.go +++ b/util/proto/marshal_test.go @@ -24,6 +24,7 @@ type stablePrimitives struct { FieldH SomeEnum FieldI uint64 // fixed64 FieldJ float64 + FieldK uint32 // fixed32 } type stableRepPrimitives struct { @@ -144,6 +145,15 @@ func (s *stablePrimitives) stableMarshal(buf []byte, wrongField bool) ([]byte, e } i += offset + fieldNum = 207 + if wrongField { + fieldNum++ + } + + offset = proto.Fixed32Marshal(fieldNum, buf, s.FieldK) + + i += offset + fieldNum = 300 if wrongField { fieldNum++ @@ -167,6 +177,7 @@ func (s *stablePrimitives) stableSize() int { proto.UInt64Size(204, s.FieldG) + proto.Fixed64Size(205, s.FieldI) + proto.Float64Size(206, s.FieldJ) + + proto.Fixed32Size(207, s.FieldK) + proto.EnumSize(300, int32(s.FieldH)) } @@ -478,6 +489,17 @@ func TestFloat64Marshal(t *testing.T) { }) } +func TestFixed32Marshal(t *testing.T) { + t.Run("zero", func(t *testing.T) { + testFixed32Marshal(t, 0, false) + }) + + t.Run("non zero", func(t *testing.T) { + testFixed32Marshal(t, math.MaxUint32, false) + testFixed32Marshal(t, math.MaxUint32, true) + }) +} + func testMarshal(t *testing.T, c stablePrimitives, tr test.Primitives, wrongField bool) *test.Primitives { var ( wire []byte @@ -791,3 +813,18 @@ func testFixed64Marshal(t *testing.T, n uint64, wrongField bool) { require.EqualValues(t, 0, result.FieldI) } } + +func testFixed32Marshal(t *testing.T, n uint32, wrongField bool) { + var ( + custom = stablePrimitives{FieldK: n} + transport = test.Primitives{FieldK: n} + ) + + result := testMarshal(t, custom, transport, wrongField) + + if !wrongField { + require.Equal(t, n, result.FieldK) + } else { + require.EqualValues(t, 0, result.FieldK) + } +} diff --git a/util/proto/test/test.pb.go b/util/proto/test/test.pb.go index 7ce722a..2a433a2 100644 --- a/util/proto/test/test.pb.go +++ b/util/proto/test/test.pb.go @@ -83,6 +83,7 @@ type Primitives struct { FieldG uint64 `protobuf:"varint,204,opt,name=field_g,json=fieldG,proto3" json:"field_g,omitempty"` FieldI uint64 `protobuf:"fixed64,205,opt,name=field_i,json=fieldI,proto3" json:"field_i,omitempty"` FieldJ float64 `protobuf:"fixed64,206,opt,name=field_j,json=fieldJ,proto3" json:"field_j,omitempty"` + FieldK uint32 `protobuf:"fixed32,207,opt,name=field_k,json=fieldK,proto3" json:"field_k,omitempty"` FieldH Primitives_SomeEnum `protobuf:"varint,300,opt,name=field_h,json=fieldH,proto3,enum=test.Primitives_SomeEnum" json:"field_h,omitempty"` } @@ -181,6 +182,13 @@ func (x *Primitives) GetFieldJ() float64 { return 0 } +func (x *Primitives) GetFieldK() uint32 { + if x != nil { + return x.FieldK + } + return 0 +} + func (x *Primitives) GetFieldH() Primitives_SomeEnum { if x != nil { return x.FieldH @@ -280,7 +288,7 @@ var File_util_proto_test_test_proto protoreflect.FileDescriptor var file_util_proto_test_test_proto_rawDesc = []byte{ 0x0a, 0x1a, 0x75, 0x74, 0x69, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x04, 0x74, 0x65, - 0x73, 0x74, 0x22, 0xe7, 0x02, 0x0a, 0x0a, 0x50, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, + 0x73, 0x74, 0x22, 0x81, 0x03, 0x0a, 0x0a, 0x50, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, 0x12, 0x17, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x41, 0x12, 0x17, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x62, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x66, 0x69, 0x65, @@ -295,26 +303,28 @@ var file_util_proto_test_test_proto_rawDesc = []byte{ 0x69, 0x65, 0x6c, 0x64, 0x47, 0x12, 0x18, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x69, 0x18, 0xcd, 0x01, 0x20, 0x01, 0x28, 0x06, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x49, 0x12, 0x18, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x6a, 0x18, 0xce, 0x01, 0x20, 0x01, 0x28, - 0x01, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x4a, 0x12, 0x33, 0x0a, 0x07, 0x66, 0x69, 0x65, - 0x6c, 0x64, 0x5f, 0x68, 0x18, 0xac, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x19, 0x2e, 0x74, 0x65, - 0x73, 0x74, 0x2e, 0x50, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, 0x2e, 0x53, 0x6f, - 0x6d, 0x65, 0x45, 0x6e, 0x75, 0x6d, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x48, 0x22, 0x3c, - 0x0a, 0x08, 0x53, 0x6f, 0x6d, 0x65, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, - 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x0c, 0x0a, 0x08, 0x50, 0x4f, 0x53, 0x49, 0x54, - 0x49, 0x56, 0x45, 0x10, 0x01, 0x12, 0x15, 0x0a, 0x08, 0x4e, 0x45, 0x47, 0x41, 0x54, 0x49, 0x56, - 0x45, 0x10, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0x22, 0xa5, 0x01, 0x0a, - 0x0d, 0x52, 0x65, 0x70, 0x50, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, 0x12, 0x17, - 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x61, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0c, 0x52, - 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x41, 0x12, 0x17, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, - 0x5f, 0x62, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x42, - 0x12, 0x17, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x63, 0x18, 0x03, 0x20, 0x03, 0x28, - 0x05, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x43, 0x12, 0x17, 0x0a, 0x07, 0x66, 0x69, 0x65, - 0x6c, 0x64, 0x5f, 0x64, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, - 0x64, 0x44, 0x12, 0x17, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x65, 0x18, 0x05, 0x20, - 0x03, 0x28, 0x03, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x45, 0x12, 0x17, 0x0a, 0x07, 0x66, - 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x66, 0x18, 0x06, 0x20, 0x03, 0x28, 0x04, 0x52, 0x06, 0x66, 0x69, - 0x65, 0x6c, 0x64, 0x46, 0x42, 0x11, 0x5a, 0x0f, 0x75, 0x74, 0x69, 0x6c, 0x2f, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x01, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x4a, 0x12, 0x18, 0x0a, 0x07, 0x66, 0x69, 0x65, + 0x6c, 0x64, 0x5f, 0x6b, 0x18, 0xcf, 0x01, 0x20, 0x01, 0x28, 0x07, 0x52, 0x06, 0x66, 0x69, 0x65, + 0x6c, 0x64, 0x4b, 0x12, 0x33, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x68, 0x18, 0xac, + 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x19, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x50, 0x72, 0x69, + 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, 0x2e, 0x53, 0x6f, 0x6d, 0x65, 0x45, 0x6e, 0x75, 0x6d, + 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x48, 0x22, 0x3c, 0x0a, 0x08, 0x53, 0x6f, 0x6d, 0x65, + 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, + 0x00, 0x12, 0x0c, 0x0a, 0x08, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x49, 0x56, 0x45, 0x10, 0x01, 0x12, + 0x15, 0x0a, 0x08, 0x4e, 0x45, 0x47, 0x41, 0x54, 0x49, 0x56, 0x45, 0x10, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0x22, 0xa5, 0x01, 0x0a, 0x0d, 0x52, 0x65, 0x70, 0x50, 0x72, + 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, 0x12, 0x17, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, + 0x64, 0x5f, 0x61, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, + 0x41, 0x12, 0x17, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x62, 0x18, 0x02, 0x20, 0x03, + 0x28, 0x09, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x42, 0x12, 0x17, 0x0a, 0x07, 0x66, 0x69, + 0x65, 0x6c, 0x64, 0x5f, 0x63, 0x18, 0x03, 0x20, 0x03, 0x28, 0x05, 0x52, 0x06, 0x66, 0x69, 0x65, + 0x6c, 0x64, 0x43, 0x12, 0x17, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x64, 0x18, 0x04, + 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x44, 0x12, 0x17, 0x0a, 0x07, + 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x65, 0x18, 0x05, 0x20, 0x03, 0x28, 0x03, 0x52, 0x06, 0x66, + 0x69, 0x65, 0x6c, 0x64, 0x45, 0x12, 0x17, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x66, + 0x18, 0x06, 0x20, 0x03, 0x28, 0x04, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x46, 0x42, 0x11, + 0x5a, 0x0f, 0x75, 0x74, 0x69, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x74, 0x65, 0x73, + 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( From 580f6c5554ff201d08ac1f69a4bef765cc547320 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 18 Nov 2021 16:32:09 +0300 Subject: [PATCH 0927/1196] [#355] subnet: Implement types for the new messages Define `subnet.Info` structure of corresponding message from NeoFS API protocol. Provide field getters and setters. Implement `StableMarshal` / `StableSize` methods of binary encoding. Implement `ToGRPCMessage` / `FromGRPCMessage` method for testing and potential transport. Signed-off-by: Leonard Lyubich --- refs/convert.go | 28 ++++++++ refs/grpc/types.go | 7 ++ refs/marshal.go | 32 +++++++++ refs/message_test.go | 1 + refs/test/generate.go | 10 +++ subnet/encoding_test.go | 15 ++++ subnet/grpc/types.go | 19 +++++ subnet/info.go | 150 ++++++++++++++++++++++++++++++++++++++++ subnet/test/generate.go | 17 +++++ 9 files changed, 279 insertions(+) create mode 100644 subnet/encoding_test.go create mode 100644 subnet/grpc/types.go create mode 100644 subnet/info.go create mode 100644 subnet/test/generate.go diff --git a/refs/convert.go b/refs/convert.go index 8b89b71..80b03d2 100644 --- a/refs/convert.go +++ b/refs/convert.go @@ -276,3 +276,31 @@ func (s *Signature) FromGRPCMessage(m grpc.Message) error { return nil } + +// ToGRPCMessage forms refs.SubnetID message and returns it as grpc.Message. +func (s *SubnetID) ToGRPCMessage() grpc.Message { + var m *refs.SubnetID + + if s != nil { + m = new(refs.SubnetID) + + m.SetValue(s.value) + } + + return m +} + +// FromGRPCMessage restores Info from grpc.Message. +// +// Supported types: +// * refs.SubnetID. +func (s *SubnetID) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*refs.SubnetID) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + s.value = v.GetValue() + + return nil +} diff --git a/refs/grpc/types.go b/refs/grpc/types.go index 22448e5..6d86824 100644 --- a/refs/grpc/types.go +++ b/refs/grpc/types.go @@ -89,3 +89,10 @@ func (x *ChecksumType) FromString(s string) bool { return ok } + +// SetValue sets subnet identifier in a base-10 integer format. +func (x *SubnetID) SetValue(v uint32) { + if x != nil { + x.Value = v + } +} diff --git a/refs/marshal.go b/refs/marshal.go index e8d2565..11feb22 100644 --- a/refs/marshal.go +++ b/refs/marshal.go @@ -316,3 +316,35 @@ func (v *Version) StableSize() (size int) { func (v *Version) Unmarshal(data []byte) error { return message.Unmarshal(v, data, new(refs.Version)) } + +// SubnetID message field numbers +const ( + _ = iota + subnetIDValFNum +) + +// StableMarshal marshals SubnetID to NeoFS API V2 binary format (Protocol Buffers with direct field order). +// +// Returns a slice of recorded data. Data is written to the provided buffer if there is enough space. +func (s *SubnetID) StableMarshal(buf []byte) ([]byte, error) { + if s == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, s.StableSize()) + } + + proto.Fixed32Marshal(subnetIDValFNum, buf, s.value) + + return buf, nil +} + +// StableSize returns the number of bytes required to write SubnetID in NeoFS API V2 binary format (see StableMarshal). +func (s *SubnetID) StableSize() (size int) { + if s != nil { + size += proto.Fixed32Size(subnetIDValFNum, s.value) + } + + return +} diff --git a/refs/message_test.go b/refs/message_test.go index d5e591f..f54b2b5 100644 --- a/refs/message_test.go +++ b/refs/message_test.go @@ -17,5 +17,6 @@ func TestMessageConvert(t *testing.T) { func(empty bool) message.Message { return refstest.GenerateChecksum(empty) }, func(empty bool) message.Message { return refstest.GenerateSignature(empty) }, func(empty bool) message.Message { return refstest.GenerateVersion(empty) }, + func(empty bool) message.Message { return refstest.GenerateSubnetID(empty) }, ) } diff --git a/refs/test/generate.go b/refs/test/generate.go index e8a5e6e..835f358 100644 --- a/refs/test/generate.go +++ b/refs/test/generate.go @@ -103,3 +103,13 @@ func GenerateChecksum(empty bool) *refs.Checksum { return m } + +func GenerateSubnetID(empty bool) *refs.SubnetID { + m := new(refs.SubnetID) + + if !empty { + m.SetValue(666) + } + + return m +} diff --git a/subnet/encoding_test.go b/subnet/encoding_test.go new file mode 100644 index 0000000..e85c02b --- /dev/null +++ b/subnet/encoding_test.go @@ -0,0 +1,15 @@ +package subnet_test + +import ( + "testing" + + "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" + messagetest "github.com/nspcc-dev/neofs-api-go/v2/rpc/message/test" + subnettest "github.com/nspcc-dev/neofs-api-go/v2/subnet/test" +) + +func TestMessageConvert(t *testing.T) { + messagetest.TestRPCMessage(t, + func(empty bool) message.Message { return subnettest.GenerateSubnetInfo(empty) }, + ) +} diff --git a/subnet/grpc/types.go b/subnet/grpc/types.go new file mode 100644 index 0000000..60ccf36 --- /dev/null +++ b/subnet/grpc/types.go @@ -0,0 +1,19 @@ +package subnet + +import ( + refs "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" +) + +// SetID returns identifier of the subnet. Nil arg is equivalent to zero subnet ID. +func (x *SubnetInfo) SetID(id *refs.SubnetID) { + if x != nil { + x.Id = id + } +} + +// SetOwner sets subnet owner's ID in NeoFS system. +func (x *SubnetInfo) SetOwner(id *refs.OwnerID) { + if x != nil { + x.Owner = id + } +} diff --git a/subnet/info.go b/subnet/info.go new file mode 100644 index 0000000..0b4cd16 --- /dev/null +++ b/subnet/info.go @@ -0,0 +1,150 @@ +package subnet + +import ( + "github.com/nspcc-dev/neofs-api-go/v2/refs" + refsgrpc "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" + "github.com/nspcc-dev/neofs-api-go/v2/rpc/grpc" + "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" + subnet "github.com/nspcc-dev/neofs-api-go/v2/subnet/grpc" + protoutil "github.com/nspcc-dev/neofs-api-go/v2/util/proto" +) + +// Info represents information about NeoFS subnet. Structure is compatible with NeoFS API V2 protocol. +// +// Zero value represents zero subnet w/o an owner. +type Info struct { + id *refs.SubnetID + + owner *refs.OwnerID +} + +// ID returns identifier of the subnet. Nil return is equivalent to zero subnet ID. +func (x *Info) ID() *refs.SubnetID { + return x.id +} + +// SetID returns identifier of the subnet. Nil arg is equivalent to zero subnet ID. +func (x *Info) SetID(id *refs.SubnetID) { + x.id = id +} + +// Owner returns subnet owner's ID in NeoFS system. +func (x *Info) Owner() *refs.OwnerID { + return x.owner +} + +// SetOwner sets subnet owner's ID in NeoFS system. +func (x *Info) SetOwner(id *refs.OwnerID) { + x.owner = id +} + +// ToGRPCMessage forms subnet.SubnetInfo message and returns it as grpc.Message. +func (x *Info) ToGRPCMessage() grpc.Message { + var m *subnet.SubnetInfo + + if x != nil { + m = new(subnet.SubnetInfo) + + m.SetID(x.id.ToGRPCMessage().(*refsgrpc.SubnetID)) + m.SetOwner(x.owner.ToGRPCMessage().(*refsgrpc.OwnerID)) + } + + return m +} + +// FromGRPCMessage restores Info from grpc.Message. +// +// Supported types: +// * subnet.SubnetInfo. +func (x *Info) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*subnet.SubnetInfo) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + id := v.GetId() + if id == nil { + x.id = nil + } else { + if x.id == nil { + x.id = new(refs.SubnetID) + } + + err = x.id.FromGRPCMessage(id) + if err != nil { + return err + } + } + + ownerID := v.GetOwner() + if ownerID == nil { + x.owner = nil + } else { + if x.owner == nil { + x.owner = new(refs.OwnerID) + } + + err = x.owner.FromGRPCMessage(ownerID) + if err != nil { + return err + } + } + + return nil +} + +// SubnetInfo message field numbers +const ( + _ = iota + subnetInfoIDFNum + subnetInfoOwnerFNum +) + +// StableMarshal marshals Info to NeoFS API V2 binary format (Protocol Buffers with direct field order). +// +// Returns a slice of recorded data. Data is written to the provided buffer if there is enough space. +func (x *Info) StableMarshal(buf []byte) ([]byte, error) { + if x == nil { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, x.StableSize()) + } + + var ( + offset, n int + err error + ) + + n, err = protoutil.NestedStructureMarshal(subnetInfoIDFNum, buf[offset:], x.id) + if err != nil { + return nil, err + } + + offset += n + + _, err = protoutil.NestedStructureMarshal(subnetInfoOwnerFNum, buf[offset:], x.owner) + if err != nil { + return nil, err + } + + return buf, nil +} + +// StableSize returns the number of bytes required to write Info in NeoFS API V2 binary format (see StableMarshal). +func (x *Info) StableSize() (size int) { + if x != nil { + size += protoutil.NestedStructureSize(subnetInfoIDFNum, x.id) + size += protoutil.NestedStructureSize(subnetInfoOwnerFNum, x.owner) + } + + return +} + +// Unmarshal decodes Info from NeoFS API V2 binary format (see StableMarshal). +func (x *Info) Unmarshal(data []byte) error { + return message.Unmarshal(x, data, new(subnet.SubnetInfo)) +} diff --git a/subnet/test/generate.go b/subnet/test/generate.go new file mode 100644 index 0000000..a62482d --- /dev/null +++ b/subnet/test/generate.go @@ -0,0 +1,17 @@ +package subnettest + +import ( + refstest "github.com/nspcc-dev/neofs-api-go/v2/refs/test" + "github.com/nspcc-dev/neofs-api-go/v2/subnet" +) + +func GenerateSubnetInfo(empty bool) *subnet.Info { + m := new(subnet.Info) + + if !empty { + m.SetID(refstest.GenerateSubnetID(false)) + m.SetOwner(refstest.GenerateOwnerID(false)) + } + + return m +} From f0af5ce7590463373ecee0e21dbfa2de228692c8 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 18 Nov 2021 18:13:17 +0300 Subject: [PATCH 0928/1196] [#356] refs: Add functions to work with zero subnet Add helper functions which provide ease of use with subnet zero IDs. Signed-off-by: Leonard Lyubich --- refs/types.go | 10 ++++++++++ refs/types_test.go | 20 ++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 refs/types_test.go diff --git a/refs/types.go b/refs/types.go index f3ce145..d8ff91a 100644 --- a/refs/types.go +++ b/refs/types.go @@ -183,6 +183,16 @@ func (s *SubnetID) GetValue() uint32 { return 0 } +// IsZeroSubnet returns true iff the SubnetID refers to zero subnet. +func IsZeroSubnet(id *SubnetID) bool { + return id.GetValue() == 0 +} + +// MakeZeroSubnet makes the SubnetID to refer to zero subnet. +func MakeZeroSubnet(id *SubnetID) { + id.SetValue(0) +} + func (v *Version) GetMajor() uint32 { if v != nil { return v.major diff --git a/refs/types_test.go b/refs/types_test.go new file mode 100644 index 0000000..a1c68cd --- /dev/null +++ b/refs/types_test.go @@ -0,0 +1,20 @@ +package refs_test + +import ( + "testing" + + "github.com/nspcc-dev/neofs-api-go/v2/refs" + "github.com/stretchr/testify/require" +) + +func TestZeroSubnet(t *testing.T) { + id := new(refs.SubnetID) + + require.True(t, refs.IsZeroSubnet(id)) + + id.SetValue(1) + require.False(t, refs.IsZeroSubnet(id)) + + refs.MakeZeroSubnet(id) + require.True(t, refs.IsZeroSubnet(id)) +} From 0e6e0e4678cd8abdf0a1c761739f8437d10ede59 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 18 Nov 2021 18:16:16 +0300 Subject: [PATCH 0929/1196] [#356] refs: Implement text encoding of `SubnetID` Implement `encoding.TextMarshaler` / `encoding.TextUnmarshaler` interfaces on `SubnetID` according to NeoFS API V2 protocol. Signed-off-by: Leonard Lyubich --- refs/types.go | 32 ++++++++++++++++++++++++++++++++ refs/types_test.go | 30 ++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+) diff --git a/refs/types.go b/refs/types.go index d8ff91a..6e014b7 100644 --- a/refs/types.go +++ b/refs/types.go @@ -1,5 +1,10 @@ package refs +import ( + "fmt" + "strconv" +) + type OwnerID struct { val []byte } @@ -183,6 +188,33 @@ func (s *SubnetID) GetValue() uint32 { return 0 } +// MarshalText encodes SubnetID into text format according to NeoFS API V2 protocol: +// value in base-10 integer string format. +// +// Implements encoding.TextMarshaler. +func (s *SubnetID) MarshalText() ([]byte, error) { + num := s.GetValue() // NPE safe, returns zero on nil (zero subnet) + + return []byte(strconv.FormatUint(uint64(num), 10)), nil +} + +// UnmarshalText decodes SubnetID from the text according to NeoFS API V2 protocol: +// should be base-10 integer string format. +// +// Must not be called on nil. +// +// Implements encoding.TextUnmarshaler. +func (s *SubnetID) UnmarshalText(txt []byte) error { + num, err := strconv.ParseUint(string(txt), 10, 32) + if err != nil { + return fmt.Errorf("invalid numeric value: %w", err) + } + + s.value = uint32(num) + + return nil +} + // IsZeroSubnet returns true iff the SubnetID refers to zero subnet. func IsZeroSubnet(id *SubnetID) bool { return id.GetValue() == 0 diff --git a/refs/types_test.go b/refs/types_test.go index a1c68cd..187a843 100644 --- a/refs/types_test.go +++ b/refs/types_test.go @@ -1,6 +1,7 @@ package refs_test import ( + "strconv" "testing" "github.com/nspcc-dev/neofs-api-go/v2/refs" @@ -18,3 +19,32 @@ func TestZeroSubnet(t *testing.T) { refs.MakeZeroSubnet(id) require.True(t, refs.IsZeroSubnet(id)) } + +func TestSubnetID_MarshalText(t *testing.T) { + var id refs.SubnetID + + const val = 15 + + id.SetValue(val) + + txt, err := id.MarshalText() + require.NoError(t, err) + + res, err := strconv.ParseUint(string(txt), 10, 32) + require.NoError(t, err) + + require.EqualValues(t, val, res) +} + +func TestSubnetID_UnmarshalText(t *testing.T) { + const val = 15 + + str := strconv.FormatUint(val, 10) + + var id refs.SubnetID + + err := id.UnmarshalText([]byte(str)) + require.NoError(t, err) + + require.EqualValues(t, val, id.GetValue()) +} From 348f9498bd4819005453909ea4fb38bae0fde8fc Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 18 Nov 2021 19:33:32 +0300 Subject: [PATCH 0930/1196] [#356] netmap: Implement the functionality of working with subnets NeoFS storage node can participate in a subnet group (at least one). According to NeoFS API V2 protocol, subnets are entered and exited through the attributes of the node. We should provide functionality for conveniently setting and reading attributes based on the needs of the network. Define `NodeSubnetInfo` type which groups information about the subnet reflected in `NodeInfo`. Implement `WriteSubnetInfo` function which writes `SubnetInfo` data to `NodeInfo`. It will be used to prepare a request for registration on the NeoFS network. Implement `IterateSubnets` function which allows to iterate over all subnets of the node. Moreover, it allows you to remove a subnet from the `NodeInfo` right during iterative traversal. Signed-off-by: Leonard Lyubich --- netmap/attributes.go | 208 +++++++++++++++++++++++++++++++++++ netmap/attributes_test.go | 226 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 434 insertions(+) create mode 100644 netmap/attributes.go create mode 100644 netmap/attributes_test.go diff --git a/netmap/attributes.go b/netmap/attributes.go new file mode 100644 index 0000000..07ce268 --- /dev/null +++ b/netmap/attributes.go @@ -0,0 +1,208 @@ +package netmap + +import ( + "errors" + "fmt" + "strings" + + "github.com/nspcc-dev/neofs-api-go/v2/refs" +) + +// prefix of keys to subnet attributes. +const attrSubnetPrefix = "__NEOFS__SUBNET_" + +const ( + // subnet attribute's value denoting subnet entry + attrSubnetValEntry = "True" + + // subnet attribute's value denoting subnet exit + attrSubnetValExit = "False" +) + +// NodeSubnetInfo groups information about subnet which can be written to NodeInfo. +// +// Zero value represents entry to zero subnet. +type NodeSubnetInfo struct { + exit bool + + id *refs.SubnetID +} + +// Enters returns true iff node enters the subnet. +func (x NodeSubnetInfo) Enters() bool { + return !x.exit +} + +// SetEntryFlag sets the subnet entry flag. +func (x *NodeSubnetInfo) SetEntryFlag(enters bool) { + x.exit = !enters +} + +// ID returns identifier of the subnet. +func (x NodeSubnetInfo) ID() *refs.SubnetID { + return x.id +} + +// SetID sets identifier of the subnet. +func (x *NodeSubnetInfo) SetID(id *refs.SubnetID) { + x.id = id +} + +func subnetAttributeKey(id *refs.SubnetID) string { + txt, _ := id.MarshalText() // never returns an error + + return attrSubnetPrefix + string(txt) +} + +// WriteSubnetInfo writes NodeSubnetInfo to NodeInfo via attributes. NodeInfo must not be nil. +// +// Does not add (removes existing) attribute if node: +// * exists non-zero subnet; +// * enters zero subnet. +// +// Attribute key is calculated from ID using format `__NEOFS__SUBNET_%s`. +// Attribute Value is: +// * `True` if node enters the subnet; +// * `False`, otherwise. +func WriteSubnetInfo(node *NodeInfo, info NodeSubnetInfo) { + attrs := node.GetAttributes() + + id := info.ID() + enters := info.Enters() + + // calculate attribute key + key := subnetAttributeKey(id) + + if refs.IsZeroSubnet(id) == enters { + for i := range attrs { + if attrs[i].GetKey() == key { + attrs = append(attrs[:i], attrs[i+1:]...) + } + } + } else { + var val string + + if enters { + val = attrSubnetValEntry + } else { + val = attrSubnetValExit + } + + presented := false + + for i := range attrs { + if attrs[i].GetKey() == key { + attrs[i].SetValue(val) + presented = true + } + } + + if !presented { + var attr Attribute + + attr.SetKey(key) + attr.SetValue(val) + + attrs = append(attrs, &attr) + } + } + + node.SetAttributes(attrs) +} + +// ErrRemoveSubnet is returned when a node needs to leave the subnet. +var ErrRemoveSubnet = errors.New("remove subnet") + +// IterateSubnets iterates over all subnets the node belongs to and passes the IDs to f. +// Handler must not be nil. +// +// If f returns ErrRemoveSubnet, then removes subnet entry. Breaks on any other non-nil error and returns it. +// +// Returns an error if any subnet attribute has wrong format. +func IterateSubnets(node *NodeInfo, f func(refs.SubnetID) error) error { + attrs := node.GetAttributes() + + var ( + err error + id refs.SubnetID + metZero bool // if zero subnet's attribute was met in for-loop + ) + + for i := 0; i < len(attrs); i++ { // range must not be used because of attrs mutation in body + key := attrs[i].GetKey() + + // cut subnet ID string + idTxt := strings.TrimPrefix(key, attrSubnetPrefix) + if idTxt == key { + // not a subnet attribute + continue + } + + // check value + switch val := attrs[i].GetValue(); val { + default: + return fmt.Errorf("invalid attribute value: %s", val) + case attrSubnetValExit: + // node is outside the subnet + continue + case attrSubnetValEntry: + // required to avoid default case + } + + // decode subnet ID + if err = id.UnmarshalText([]byte(idTxt)); err != nil { + return fmt.Errorf("invalid ID text: %w", err) + } + + // pass ID to the handler + err = f(id) + + isRemoveErr := errors.Is(err, ErrRemoveSubnet) + + if err != nil && !isRemoveErr { + return err + } + + if !metZero { // in order to not reset if has been already set + metZero = refs.IsZeroSubnet(&id) + + if !isRemoveErr { + // no handler's error and non-zero subnet + continue + } else if metZero { + // removal error and zero subnet. + // we don't remove attribute of zero subnet because it means entry + attrs[i].SetValue(attrSubnetValExit) + + continue + } + } + + if isRemoveErr { + // removal error and non-zero subnet. + // we can set False or remove attribute, latter is more memory/network efficient. + attrs = append(attrs[:i], attrs[i+1:]...) + i-- + } + } + + if !metZero { + // missing attribute of zero subnet equivalent to entry + refs.MakeZeroSubnet(&id) + + err = f(id) + if errors.Is(err, ErrRemoveSubnet) { + // zero subnet should be clearly removed with False value + var attr Attribute + + attr.SetKey(subnetAttributeKey(&id)) + attr.SetValue(attrSubnetValExit) + + attrs = append(attrs, &attr) + } + } + + node.SetAttributes(attrs) + + return nil +} diff --git a/netmap/attributes_test.go b/netmap/attributes_test.go new file mode 100644 index 0000000..5cee47e --- /dev/null +++ b/netmap/attributes_test.go @@ -0,0 +1,226 @@ +package netmap_test + +import ( + "strconv" + "testing" + + "github.com/nspcc-dev/neofs-api-go/v2/netmap" + "github.com/nspcc-dev/neofs-api-go/v2/refs" + "github.com/stretchr/testify/require" +) + +func subnetAttrKey(val string) string { + return "__NEOFS__SUBNET_" + val +} + +func assertSubnetAttrKey(t *testing.T, attr *netmap.Attribute, num uint32) { + require.Equal(t, subnetAttrKey(strconv.FormatUint(uint64(num), 10)), attr.GetKey()) +} + +func TestWriteSubnetInfo(t *testing.T) { + t.Run("entry", func(t *testing.T) { + t.Run("zero subnet", func(t *testing.T) { + var ( + node netmap.NodeInfo + info netmap.NodeSubnetInfo + ) + + netmap.WriteSubnetInfo(&node, info) + + // entry to zero subnet does not require an attribute + attrs := node.GetAttributes() + require.Empty(t, attrs) + + // exit the subnet + info.SetEntryFlag(false) + + netmap.WriteSubnetInfo(&node, info) + + // exit from zero subnet should be clearly reflected in attributes + attrs = node.GetAttributes() + require.Len(t, attrs, 1) + + attr := attrs[0] + assertSubnetAttrKey(t, attr, 0) + require.Equal(t, "False", attr.GetValue()) + + // again enter to zero subnet + info.SetEntryFlag(true) + + netmap.WriteSubnetInfo(&node, info) + + // attribute should be removed + attrs = node.GetAttributes() + require.Empty(t, attrs) + }) + + t.Run("non-zero subnet", func(t *testing.T) { + var ( + node netmap.NodeInfo + info netmap.NodeSubnetInfo + id refs.SubnetID + ) + + // create non-zero subnet ID + const num = 15 + + id.SetValue(num) + + // enter to the subnet + info.SetID(&id) + info.SetEntryFlag(true) + + netmap.WriteSubnetInfo(&node, info) + + // check attribute format + attrs := node.GetAttributes() + require.Len(t, attrs, 1) + + attr := attrs[0] + assertSubnetAttrKey(t, attr, num) + require.Equal(t, "True", attr.GetValue()) + + // again exit the subnet + info.SetEntryFlag(false) + + netmap.WriteSubnetInfo(&node, info) + + // attribute should be removed + attrs = node.GetAttributes() + require.Empty(t, attrs) + }) + }) +} + +func TestSubnets(t *testing.T) { + t.Run("empty", func(t *testing.T) { + var node netmap.NodeInfo + + called := 0 + + err := netmap.IterateSubnets(&node, func(id refs.SubnetID) error { + called++ + + require.True(t, refs.IsZeroSubnet(&id)) + + return nil + }) + + require.NoError(t, err) + require.EqualValues(t, 1, called) + }) + + t.Run("with correct attribute", func(t *testing.T) { + var ( + node netmap.NodeInfo + attr netmap.Attribute + ) + + attr.SetKey(subnetAttrKey("13")) + attr.SetValue("True") + + attrs := []*netmap.Attribute{&attr} + + node.SetAttributes(attrs) + + called := 0 + + err := netmap.IterateSubnets(&node, func(id refs.SubnetID) error { + if !refs.IsZeroSubnet(&id) { + called++ + require.EqualValues(t, 13, id.GetValue()) + } + + return nil + }) + + require.NoError(t, err) + require.EqualValues(t, 1, called) + }) + + t.Run("with incorrect attribute", func(t *testing.T) { + assertErr := func(attr netmap.Attribute) { + var node netmap.NodeInfo + + node.SetAttributes([]*netmap.Attribute{&attr}) + + require.Error(t, netmap.IterateSubnets(&node, func(refs.SubnetID) error { + return nil + })) + } + + t.Run("incorrect key", func(t *testing.T) { + var attr netmap.Attribute + + attr.SetKey(subnetAttrKey("one-two-three")) + + assertErr(attr) + }) + + t.Run("incorrect value", func(t *testing.T) { + var attr netmap.Attribute + + attr.SetKey(subnetAttrKey("1")) + + for _, invalidVal := range []string{ + "", + "Troo", + "Fols", + } { + attr.SetValue(invalidVal) + assertErr(attr) + } + + assertErr(attr) + }) + }) + + t.Run("remove entry", func(t *testing.T) { + t.Run("zero", func(t *testing.T) { + var node netmap.NodeInfo + + err := netmap.IterateSubnets(&node, func(id refs.SubnetID) error { + if refs.IsZeroSubnet(&id) { + return netmap.ErrRemoveSubnet + } + + return nil + }) + + require.NoError(t, err) + + attrs := node.GetAttributes() + require.Len(t, attrs, 1) + + attr := attrs[0] + assertSubnetAttrKey(t, attr, 0) + require.Equal(t, "False", attr.GetValue()) + }) + + t.Run("non-zero", func(t *testing.T) { + var ( + node netmap.NodeInfo + attr netmap.Attribute + ) + + attr.SetKey(subnetAttrKey("99")) + attr.SetValue("True") + + attrs := []*netmap.Attribute{&attr} + node.SetAttributes(attrs) + + err := netmap.IterateSubnets(&node, func(id refs.SubnetID) error { + if !refs.IsZeroSubnet(&id) { + return netmap.ErrRemoveSubnet + } + + return nil + }) + + require.NoError(t, err) + + attrs = node.GetAttributes() + require.Empty(t, attrs) + }) + }) +} From 051b103df3a62cb457ead2e583b1a06d69b2db7d Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 18 Nov 2021 21:26:29 +0300 Subject: [PATCH 0931/1196] [#356] netmap: Return missing subnets error from `IterateSubnets` Each NeoFS storage node should be present in at least one subnet. Make `netmap.IterateSubnets` function to return an error if the node by the end of the loop does not belong to any subnet. Signed-off-by: Leonard Lyubich --- netmap/attributes.go | 17 ++++++++++++- netmap/attributes_test.go | 51 +++++++++++++++++++++++++++++++++++---- 2 files changed, 62 insertions(+), 6 deletions(-) diff --git a/netmap/attributes.go b/netmap/attributes.go index 07ce268..e1be340 100644 --- a/netmap/attributes.go +++ b/netmap/attributes.go @@ -113,12 +113,16 @@ func WriteSubnetInfo(node *NodeInfo, info NodeSubnetInfo) { // ErrRemoveSubnet is returned when a node needs to leave the subnet. var ErrRemoveSubnet = errors.New("remove subnet") +var errNoSubnets = errors.New("no subnets") + // IterateSubnets iterates over all subnets the node belongs to and passes the IDs to f. // Handler must not be nil. // -// If f returns ErrRemoveSubnet, then removes subnet entry. Breaks on any other non-nil error and returns it. +// If f returns ErrRemoveSubnet, then removes subnet entry. Note that this leads to an instant mutation of NodeInfo. +// Breaks on any other non-nil error and returns it. // // Returns an error if any subnet attribute has wrong format. +// Returns an error if the node is not included in any subnet by the end of the loop. func IterateSubnets(node *NodeInfo, f func(refs.SubnetID) error) error { attrs := node.GetAttributes() @@ -126,6 +130,7 @@ func IterateSubnets(node *NodeInfo, f func(refs.SubnetID) error) error { err error id refs.SubnetID metZero bool // if zero subnet's attribute was met in for-loop + entries uint ) for i := 0; i < len(attrs); i++ { // range must not be used because of attrs mutation in body @@ -168,6 +173,7 @@ func IterateSubnets(node *NodeInfo, f func(refs.SubnetID) error) error { if !isRemoveErr { // no handler's error and non-zero subnet + entries++ continue } else if metZero { // removal error and zero subnet. @@ -183,7 +189,10 @@ func IterateSubnets(node *NodeInfo, f func(refs.SubnetID) error) error { // we can set False or remove attribute, latter is more memory/network efficient. attrs = append(attrs[:i], attrs[i+1:]...) i-- + continue } + + entries++ } if !metZero { @@ -199,9 +208,15 @@ func IterateSubnets(node *NodeInfo, f func(refs.SubnetID) error) error { attr.SetValue(attrSubnetValExit) attrs = append(attrs, &attr) + } else { + entries++ } } + if entries <= 0 { + return errNoSubnets + } + node.SetAttributes(attrs) return nil diff --git a/netmap/attributes_test.go b/netmap/attributes_test.go index 5cee47e..7e03b8c 100644 --- a/netmap/attributes_test.go +++ b/netmap/attributes_test.go @@ -179,6 +179,15 @@ func TestSubnets(t *testing.T) { t.Run("zero", func(t *testing.T) { var node netmap.NodeInfo + // enter to some non-zero subnet so that zero is not the only one + var attr netmap.Attribute + + attr.SetKey(subnetAttrKey("321")) + attr.SetValue("True") + + attrs := []*netmap.Attribute{&attr} + node.SetAttributes(attrs) + err := netmap.IterateSubnets(&node, func(id refs.SubnetID) error { if refs.IsZeroSubnet(&id) { return netmap.ErrRemoveSubnet @@ -189,12 +198,19 @@ func TestSubnets(t *testing.T) { require.NoError(t, err) - attrs := node.GetAttributes() - require.Len(t, attrs, 1) + attrs = node.GetAttributes() + require.Len(t, attrs, 2) - attr := attrs[0] - assertSubnetAttrKey(t, attr, 0) - require.Equal(t, "False", attr.GetValue()) + found := false + + for i := range attrs { + if attrs[i].GetKey() == subnetAttrKey("0") { + require.Equal(t, "False", attrs[i].GetValue()) + found = true + } + } + + require.True(t, found) }) t.Run("non-zero", func(t *testing.T) { @@ -222,5 +238,30 @@ func TestSubnets(t *testing.T) { attrs = node.GetAttributes() require.Empty(t, attrs) }) + + t.Run("all", func(t *testing.T) { + var ( + node netmap.NodeInfo + attrs []*netmap.Attribute + ) + + // enter to some non-zero subnet so that zero is not the only one + for i := 1; i <= 5; i++ { + var attr netmap.Attribute + + attr.SetKey(subnetAttrKey(strconv.Itoa(i))) + attr.SetValue("True") + + attrs = append(attrs, &attr) + } + + node.SetAttributes(attrs) + + err := netmap.IterateSubnets(&node, func(id refs.SubnetID) error { + return netmap.ErrRemoveSubnet + }) + + require.Error(t, err) + }) }) } From 4560e447e1970ce173407583fbb430c7664e89dc Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 19 Nov 2021 19:50:29 +0300 Subject: [PATCH 0932/1196] [#356] netmap: Fix potential double-processing of zero subnet Signed-off-by: Leonard Lyubich --- netmap/attributes.go | 74 ++++++++++++++++++++++++--------------- netmap/attributes_test.go | 27 ++++++++++++++ 2 files changed, 72 insertions(+), 29 deletions(-) diff --git a/netmap/attributes.go b/netmap/attributes.go index e1be340..ff01a0d 100644 --- a/netmap/attributes.go +++ b/netmap/attributes.go @@ -126,11 +126,24 @@ var errNoSubnets = errors.New("no subnets") func IterateSubnets(node *NodeInfo, f func(refs.SubnetID) error) error { attrs := node.GetAttributes() + type zeroStatus uint8 + + const ( + _ zeroStatus = iota + // missing attribute of zero subnet + zeroNoAttr + // with `False` attribute + zeroExit + // with `True` attribute + zeroEntry + ) + var ( err error id refs.SubnetID - metZero bool // if zero subnet's attribute was met in for-loop entries uint + + stZero = zeroNoAttr ) for i := 0; i < len(attrs); i++ { // range must not be used because of attrs mutation in body @@ -144,14 +157,9 @@ func IterateSubnets(node *NodeInfo, f func(refs.SubnetID) error) error { } // check value - switch val := attrs[i].GetValue(); val { - default: + val := attrs[i].GetValue() + if val != attrSubnetValExit && val != attrSubnetValEntry { return fmt.Errorf("invalid attribute value: %s", val) - case attrSubnetValExit: - // node is outside the subnet - continue - case attrSubnetValEntry: - // required to avoid default case } // decode subnet ID @@ -159,6 +167,25 @@ func IterateSubnets(node *NodeInfo, f func(refs.SubnetID) error) error { return fmt.Errorf("invalid ID text: %w", err) } + // update status of zero subnet + isZero := refs.IsZeroSubnet(&id) + + if stZero == zeroNoAttr { // in order to not reset if has been already set + if isZero { + if val == attrSubnetValEntry { + // clear True attribute for zero subnet is also possible + stZero = zeroEntry + } else { + stZero = zeroExit + } + } + } + + // continue to process only the subnets to which the node belongs + if val == attrSubnetValExit { + continue + } + // pass ID to the handler err = f(id) @@ -168,34 +195,23 @@ func IterateSubnets(node *NodeInfo, f func(refs.SubnetID) error) error { return err } - if !metZero { // in order to not reset if has been already set - metZero = refs.IsZeroSubnet(&id) - - if !isRemoveErr { - // no handler's error and non-zero subnet - entries++ - continue - } else if metZero { - // removal error and zero subnet. - // we don't remove attribute of zero subnet because it means entry - attrs[i].SetValue(attrSubnetValExit) - - continue - } - } - if isRemoveErr { - // removal error and non-zero subnet. - // we can set False or remove attribute, latter is more memory/network efficient. - attrs = append(attrs[:i], attrs[i+1:]...) - i-- + if isZero { + // we can't remove attribute of zero subnet because it means entry + attrs[i].SetValue(attrSubnetValExit) + } else { + // we can set False or remove attribute, latter is more memory/network efficient. + attrs = append(attrs[:i], attrs[i+1:]...) + i-- + } + continue } entries++ } - if !metZero { + if stZero == zeroNoAttr { // missing attribute of zero subnet equivalent to entry refs.MakeZeroSubnet(&id) diff --git a/netmap/attributes_test.go b/netmap/attributes_test.go index 7e03b8c..f282c86 100644 --- a/netmap/attributes_test.go +++ b/netmap/attributes_test.go @@ -264,4 +264,31 @@ func TestSubnets(t *testing.T) { require.Error(t, err) }) }) + + t.Run("zero subnet removal via attribute", func(t *testing.T) { + var ( + node netmap.NodeInfo + + attrZero, attrOther netmap.Attribute + ) + + attrZero.SetKey(subnetAttrKey("0")) + attrZero.SetValue("False") + + attrOther.SetKey(subnetAttrKey("1")) + attrOther.SetValue("True") + + node.SetAttributes([]*netmap.Attribute{&attrZero, &attrOther}) + + calledCount := 0 + + err := netmap.IterateSubnets(&node, func(id refs.SubnetID) error { + require.False(t, refs.IsZeroSubnet(&id)) + calledCount++ + return nil + }) + + require.NoError(t, err) + require.EqualValues(t, 1, calledCount) + }) } From dc292864aaa0f549614bb53b0eee7d019177cc52 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 22 Nov 2021 12:34:09 +0300 Subject: [PATCH 0933/1196] [#356] refs: Handle uint32 overflow in `SubnetID` text format Clarify the bit size limit in `SubnetID.UnmarshalText` method. Cover overflow case in unit test. Signed-off-by: Leonard Lyubich --- refs/types.go | 4 +++- refs/types_test.go | 10 ++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/refs/types.go b/refs/types.go index 6e014b7..cd7ba5d 100644 --- a/refs/types.go +++ b/refs/types.go @@ -199,7 +199,9 @@ func (s *SubnetID) MarshalText() ([]byte, error) { } // UnmarshalText decodes SubnetID from the text according to NeoFS API V2 protocol: -// should be base-10 integer string format. +// should be base-10 integer string format with bitsize = 32. +// +// Returns strconv.ErrRange if integer overflows uint32. // // Must not be called on nil. // diff --git a/refs/types_test.go b/refs/types_test.go index 187a843..52c6b80 100644 --- a/refs/types_test.go +++ b/refs/types_test.go @@ -1,6 +1,7 @@ package refs_test import ( + "math" "strconv" "testing" @@ -47,4 +48,13 @@ func TestSubnetID_UnmarshalText(t *testing.T) { require.NoError(t, err) require.EqualValues(t, val, id.GetValue()) + + t.Run("uint32 overflow", func(t *testing.T) { + txt := strconv.FormatUint(math.MaxUint32+1, 10) + + var id refs.SubnetID + + err := id.UnmarshalText([]byte(txt)) + require.ErrorIs(t, err, strconv.ErrRange) + }) } From 5d99e697aab03fb552a6536710c521c83fc65234 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 22 Nov 2021 13:22:14 +0300 Subject: [PATCH 0934/1196] [#356] refs: Test text marshaling of nil SubnetID Add `(*refs.SubnetID)(nil).MarshalText()` unit test. Signed-off-by: Leonard Lyubich --- refs/types_test.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/refs/types_test.go b/refs/types_test.go index 52c6b80..e2077b2 100644 --- a/refs/types_test.go +++ b/refs/types_test.go @@ -35,6 +35,18 @@ func TestSubnetID_MarshalText(t *testing.T) { require.NoError(t, err) require.EqualValues(t, val, res) + + t.Run("nil", func(t *testing.T) { + var id *refs.SubnetID + + txt, err := id.MarshalText() + require.NoError(t, err) + + res, err := strconv.ParseUint(string(txt), 10, 32) + require.NoError(t, err) + + require.Zero(t, res) + }) } func TestSubnetID_UnmarshalText(t *testing.T) { From dfb780a2b628f7036251be7028c59cdbd47652d4 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 22 Nov 2021 13:32:36 +0300 Subject: [PATCH 0935/1196] [#356] netmap: Document `IterateSubnets` behavior with duplicate keys Node attributes must be key-unique. In current implementation `IterateSubnets` doesn't monitor the uniqueness of keys. Declare undefined behavior of `IterateSubnets` for non-unique attribute keys. Signed-off-by: Leonard Lyubich --- netmap/attributes.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/netmap/attributes.go b/netmap/attributes.go index ff01a0d..47dbc5c 100644 --- a/netmap/attributes.go +++ b/netmap/attributes.go @@ -118,6 +118,8 @@ var errNoSubnets = errors.New("no subnets") // IterateSubnets iterates over all subnets the node belongs to and passes the IDs to f. // Handler must not be nil. // +// Subnet attributes are expected to be key-unique, otherwise undefined behavior. +// // If f returns ErrRemoveSubnet, then removes subnet entry. Note that this leads to an instant mutation of NodeInfo. // Breaks on any other non-nil error and returns it. // From 896cee4bb0ae491663362dd3d3ca8180cd959a0e Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 22 Nov 2021 14:02:52 +0300 Subject: [PATCH 0936/1196] [#356] netmap: Increase test coverage of IterateSubnets Add both `False` and `True` subnet attributes. Signed-off-by: Leonard Lyubich --- netmap/attributes_test.go | 35 +++++++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/netmap/attributes_test.go b/netmap/attributes_test.go index f282c86..93586ac 100644 --- a/netmap/attributes_test.go +++ b/netmap/attributes_test.go @@ -113,29 +113,44 @@ func TestSubnets(t *testing.T) { t.Run("with correct attribute", func(t *testing.T) { var ( node netmap.NodeInfo - attr netmap.Attribute + + attrEntry, attrExit netmap.Attribute ) - attr.SetKey(subnetAttrKey("13")) - attr.SetValue("True") + const ( + numEntry = 13 + numExit = 14 + ) - attrs := []*netmap.Attribute{&attr} + attrEntry.SetKey(subnetAttrKey(strconv.FormatUint(numEntry, 10))) + attrEntry.SetValue("True") + + attrExit.SetKey(subnetAttrKey(strconv.FormatUint(numExit, 10))) + attrExit.SetValue("False") + + attrs := []*netmap.Attribute{&attrEntry, &attrEntry} node.SetAttributes(attrs) - called := 0 + mCalledNums := make(map[uint32]struct{}) err := netmap.IterateSubnets(&node, func(id refs.SubnetID) error { - if !refs.IsZeroSubnet(&id) { - called++ - require.EqualValues(t, 13, id.GetValue()) - } + mCalledNums[id.GetValue()] = struct{}{} return nil }) require.NoError(t, err) - require.EqualValues(t, 1, called) + require.Len(t, mCalledNums, 2) + + _, ok := mCalledNums[numEntry] + require.True(t, ok) + + _, ok = mCalledNums[numExit] + require.False(t, ok) + + _, ok = mCalledNums[0] + require.True(t, ok) }) t.Run("with incorrect attribute", func(t *testing.T) { From abc494b2bc3768d41296ea30722a6a8334547c82 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 22 Nov 2021 15:05:21 +0300 Subject: [PATCH 0937/1196] [#356] netmap: Simplify zero subnet processing in `IterateSubnets` For now we don't need to distinguish cases of missing zero subnet's attribute and the one with `True` value. Remove local enum `zeroStatus` of `IterateSubnets` since we need to distinguish between two statuses and use `bool` variable for this. Signed-off-by: Leonard Lyubich --- netmap/attributes.go | 27 ++++----------------------- 1 file changed, 4 insertions(+), 23 deletions(-) diff --git a/netmap/attributes.go b/netmap/attributes.go index 47dbc5c..da9f28c 100644 --- a/netmap/attributes.go +++ b/netmap/attributes.go @@ -128,24 +128,12 @@ var errNoSubnets = errors.New("no subnets") func IterateSubnets(node *NodeInfo, f func(refs.SubnetID) error) error { attrs := node.GetAttributes() - type zeroStatus uint8 - - const ( - _ zeroStatus = iota - // missing attribute of zero subnet - zeroNoAttr - // with `False` attribute - zeroExit - // with `True` attribute - zeroEntry - ) - var ( err error id refs.SubnetID entries uint - stZero = zeroNoAttr + zeroEntry = true ) for i := 0; i < len(attrs); i++ { // range must not be used because of attrs mutation in body @@ -172,15 +160,8 @@ func IterateSubnets(node *NodeInfo, f func(refs.SubnetID) error) error { // update status of zero subnet isZero := refs.IsZeroSubnet(&id) - if stZero == zeroNoAttr { // in order to not reset if has been already set - if isZero { - if val == attrSubnetValEntry { - // clear True attribute for zero subnet is also possible - stZero = zeroEntry - } else { - stZero = zeroExit - } - } + if isZero { + zeroEntry = val == attrSubnetValEntry } // continue to process only the subnets to which the node belongs @@ -213,7 +194,7 @@ func IterateSubnets(node *NodeInfo, f func(refs.SubnetID) error) error { entries++ } - if stZero == zeroNoAttr { + if zeroEntry { // missing attribute of zero subnet equivalent to entry refs.MakeZeroSubnet(&id) From 50ab22c19c1fb9aae7f6c5986d6ee2df08460b18 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 23 Nov 2021 13:48:37 +0300 Subject: [PATCH 0938/1196] [#356] netmap: Improve docs and slightly optimize the code API changes: * Rename `Enters` method of the `NodeSubnetInfo` to `Enabled`. * Declare undefined behavior of `WriteSubnetInfo` with non-unique attributes. Signed-off-by: Leonard Lyubich --- netmap/attributes.go | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/netmap/attributes.go b/netmap/attributes.go index da9f28c..8408c25 100644 --- a/netmap/attributes.go +++ b/netmap/attributes.go @@ -28,8 +28,8 @@ type NodeSubnetInfo struct { id *refs.SubnetID } -// Enters returns true iff node enters the subnet. -func (x NodeSubnetInfo) Enters() bool { +// Enabled returns true iff subnet membership is enabled for the node. +func (x NodeSubnetInfo) Enabled() bool { return !x.exit } @@ -56,9 +56,11 @@ func subnetAttributeKey(id *refs.SubnetID) string { // WriteSubnetInfo writes NodeSubnetInfo to NodeInfo via attributes. NodeInfo must not be nil. // +// Existing subnet attributes are expected to be key-unique, otherwise undefined behavior. +// // Does not add (removes existing) attribute if node: -// * exists non-zero subnet; -// * enters zero subnet. +// * disables non-zero subnet; +// * enables zero subnet. // // Attribute key is calculated from ID using format `__NEOFS__SUBNET_%s`. // Attribute Value is: @@ -68,7 +70,7 @@ func WriteSubnetInfo(node *NodeInfo, info NodeSubnetInfo) { attrs := node.GetAttributes() id := info.ID() - enters := info.Enters() + enters := info.Enabled() // calculate attribute key key := subnetAttributeKey(id) @@ -77,6 +79,7 @@ func WriteSubnetInfo(node *NodeInfo, info NodeSubnetInfo) { for i := range attrs { if attrs[i].GetKey() == key { attrs = append(attrs[:i], attrs[i+1:]...) + break // attributes are expected to be key-unique } } } else { @@ -141,7 +144,7 @@ func IterateSubnets(node *NodeInfo, f func(refs.SubnetID) error) error { // cut subnet ID string idTxt := strings.TrimPrefix(key, attrSubnetPrefix) - if idTxt == key { + if len(idTxt) == len(key) { // not a subnet attribute continue } From 5ce4b22e40322385fd290951762c69fad2128552 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 23 Nov 2021 14:23:49 +0300 Subject: [PATCH 0939/1196] [#356] refs: Implement `Unmarshal` method on `SubnetID` Signed-off-by: Leonard Lyubich --- refs/marshal.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/refs/marshal.go b/refs/marshal.go index 11feb22..148ad58 100644 --- a/refs/marshal.go +++ b/refs/marshal.go @@ -348,3 +348,11 @@ func (s *SubnetID) StableSize() (size int) { return } + +// Unmarshal unmarshals SubnetID from NeoFS API V2 binary format (see StableMarshal). +// Must not be called on nil. +// +// Note: empty data corresponds to zero ID value or nil pointer to it. +func (s *SubnetID) Unmarshal(data []byte) error { + return message.Unmarshal(s, data, new(refs.SubnetID)) +} From d93828f4651464775c002d9a102badbb6cd9e695 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 23 Nov 2021 17:11:15 +0300 Subject: [PATCH 0940/1196] [#356] netmap: Fix post-loop handling of zero subnet in IterateSubnets Return any error other than `ErrRemoveSubnet` from `IterateSubnets` during post-loop processing of zero subnet. Signed-off-by: Leonard Lyubich --- netmap/attributes.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/netmap/attributes.go b/netmap/attributes.go index 8408c25..7bfc002 100644 --- a/netmap/attributes.go +++ b/netmap/attributes.go @@ -202,7 +202,11 @@ func IterateSubnets(node *NodeInfo, f func(refs.SubnetID) error) error { refs.MakeZeroSubnet(&id) err = f(id) - if errors.Is(err, ErrRemoveSubnet) { + if err != nil { + if !errors.Is(err, ErrRemoveSubnet) { + return err + } + // zero subnet should be clearly removed with False value var attr Attribute From 3604d96f3fe1955f4129c8a884c66c220218a3c3 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Wed, 1 Dec 2021 16:42:31 +0300 Subject: [PATCH 0941/1196] [#362] netmap: Add marshaling of the subnetID field of container policy Signed-off-by: Pavel Karpy --- netmap/convert.go | 15 +++++++++++++++ netmap/grpc/types.go | 9 +++++++++ netmap/marshal.go | 8 ++++++++ netmap/test/generate.go | 1 + 4 files changed, 33 insertions(+) diff --git a/netmap/convert.go b/netmap/convert.go index e059592..8325c94 100644 --- a/netmap/convert.go +++ b/netmap/convert.go @@ -216,6 +216,7 @@ func (p *PlacementPolicy) ToGRPCMessage() grpc.Message { m.SetSelectors(SelectorsToGRPC(p.selectors)) m.SetReplicas(ReplicasToGRPC(p.replicas)) m.SetContainerBackupFactor(p.backupFactor) + m.SetSubnetID(p.subnetID.ToGRPCMessage().(*refsGRPC.SubnetID)) } return m @@ -244,6 +245,20 @@ func (p *PlacementPolicy) FromGRPCMessage(m grpc.Message) error { return err } + subnetID := v.GetSubnetId() + if subnetID == nil { + p.subnetID = nil + } else { + if p.subnetID == nil { + p.subnetID = new(refs.SubnetID) + } + + err = p.subnetID.FromGRPCMessage(subnetID) + if err != nil { + return err + } + } + p.backupFactor = v.GetContainerBackupFactor() return nil diff --git a/netmap/grpc/types.go b/netmap/grpc/types.go index e8dc687..95b0acc 100644 --- a/netmap/grpc/types.go +++ b/netmap/grpc/types.go @@ -1,5 +1,7 @@ package netmap +import refs "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" + // SetReplicas of placement policy. func (m *PlacementPolicy) SetReplicas(v []*Replica) { if m != nil { @@ -28,6 +30,13 @@ func (m *PlacementPolicy) SetFilters(v []*Filter) { } } +// SetSubnetID sets ID of subnet. +func (m *PlacementPolicy) SetSubnetID(v *refs.SubnetID) { + if m != nil { + m.SubnetId = v + } +} + // SetName of placement filter. func (m *Filter) SetName(v string) { if m != nil { diff --git a/netmap/marshal.go b/netmap/marshal.go index d252111..b29e750 100644 --- a/netmap/marshal.go +++ b/netmap/marshal.go @@ -26,6 +26,7 @@ const ( backupPolicyField = 2 selectorsPolicyField = 3 filtersPolicyField = 4 + subnetIDPolicyField = 5 keyAttributeField = 1 valueAttributeField = 2 @@ -262,6 +263,11 @@ func (p *PlacementPolicy) StableMarshal(buf []byte) ([]byte, error) { offset += n } + _, err = protoutil.NestedStructureMarshal(subnetIDPolicyField, buf[offset:], p.subnetID) + if err != nil { + return nil, err + } + return buf, nil } @@ -280,6 +286,8 @@ func (p *PlacementPolicy) StableSize() (size int) { size += protoutil.NestedStructureSize(filtersPolicyField, p.filters[i]) } + size += protoutil.NestedStructureSize(subnetIDPolicyField, p.subnetID) + return size } diff --git a/netmap/test/generate.go b/netmap/test/generate.go index be07f12..93e2ff3 100644 --- a/netmap/test/generate.go +++ b/netmap/test/generate.go @@ -102,6 +102,7 @@ func GeneratePlacementPolicy(empty bool) *netmap.PlacementPolicy { m.SetFilters(GenerateFilters(false)) m.SetSelectors(GenerateSelectors(false)) m.SetReplicas(GenerateReplicas(false)) + m.SetSubnetID(refstest.GenerateSubnetID(false)) } return m From fb33a6e08aae53a41d77dc0060ef76f3e4da2261 Mon Sep 17 00:00:00 2001 From: Angira Kekteeva Date: Thu, 2 Dec 2021 16:15:44 +0300 Subject: [PATCH 0942/1196] [#364] Makefile: Remove deprecated -i flag Signed-off-by: Angira Kekteeva --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index b89e274..32cb13e 100644 --- a/Makefile +++ b/Makefile @@ -18,7 +18,7 @@ dep: @printf "⇒ Install test requirements: " CGO_ENABLED=0 \ GO111MODULE=on \ - go test -i ./... && echo OK + go test ./... && echo OK # Run all code formatters fmts: fmt imports From c35dff758d5d13f608c730e2ee182fbc0452a6f0 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Thu, 2 Dec 2021 15:56:04 +0300 Subject: [PATCH 0943/1196] [#361] Return proto file for stable marshal tests Signed-off-by: Alex Vanin --- util/proto/test/test.proto | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 util/proto/test/test.proto diff --git a/util/proto/test/test.proto b/util/proto/test/test.proto new file mode 100644 index 0000000..65e350f --- /dev/null +++ b/util/proto/test/test.proto @@ -0,0 +1,34 @@ +syntax = "proto3"; + +package test; + +option go_package = "util/proto/test"; + +message Primitives { + bytes field_a = 1; + string field_b = 2; + bool field_c = 200; + int32 field_d = 201; + uint32 field_e = 202; + int64 field_f = 203; + uint64 field_g = 204; + fixed64 field_i = 205; + double field_j = 206; + fixed32 field_k = 207; + + enum SomeEnum { + UNKNOWN = 0; + POSITIVE = 1; + NEGATIVE = -1; + } + SomeEnum field_h = 300; +} + +message RepPrimitives { + repeated bytes field_a = 1; + repeated string field_b = 2; + repeated int32 field_c = 3; + repeated uint32 field_d = 4; + repeated int64 field_e = 5; + repeated uint64 field_f = 6; +} From 4b67b56c4bb62b4bb0ff10d79f3b575f74a82a92 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Thu, 2 Dec 2021 15:56:45 +0300 Subject: [PATCH 0944/1196] [#361] Do not remove stable marshal test file after API recompile Signed-off-by: Alex Vanin --- prepare.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/prepare.sh b/prepare.sh index 5899367..2dd7263 100755 --- a/prepare.sh +++ b/prepare.sh @@ -30,7 +30,7 @@ cd "$API_GO_PATH" || exit 1 make protoc # REMOVE PROTO DEFINITIONS -ARGS=$(find ./$prefix -name '*.proto' -not -path './vendor/*') +ARGS=$(find ./$prefix -name '*.proto' -not -path './vendor/*' -not -path './util/*') for file in $ARGS; do rm "$file" done From 8b17921f031f1d5b7a82f45dde20b084042371e9 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Thu, 2 Dec 2021 18:03:57 +0300 Subject: [PATCH 0945/1196] =?UTF-8?q?Release=20v2.11.0=20-=20Sinjido=20(?= =?UTF-8?q?=EC=8B=A0=EC=A7=80=EB=8F=84,=20=E8=96=AA=E6=99=BA=E5=B3=B6)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Alex Vanin --- CHANGELOG.md | 23 +++++++++++++++++++++++ README.md | 1 + 2 files changed, 24 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index cbf727f..d840ca1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,27 @@ # Changelog +## [2.11.0] - 2021-12-02 - Sinjido (신지도, 薪智島) + +NeoFS API v2.11 support. High level packages are moved to +[neofs-sdk-go](https://github.com/nspcc-dev/neofs-sdk-go) repository. +Repository restructured as Go module version 2 and synced with +[neofs-api](https://github.com/nspcc-dev/neofs-api) release version. + +### Fixed +- Protobuf recompile script handles path with special symbols correctly (#354) +- `make dep` command (#364) + +### Added +- Status codes in response messages (#350) +- Storage subnetwork types (#355, #356, #360, #362) + +### Changed +- neofs-api-go is now Go module version 2 (#201) + +### Removed +- All packages from `pkg` moved to + [neofs-sdk-go](https://github.com/nspcc-dev/neofs-sdk-go) (#201) + ## [1.30.0] - 2021-10-19 - Udo (우도, 牛島) NeoFS API v2.10 support. @@ -734,3 +756,4 @@ Initial public release [1.28.3]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.28.2...v1.28.3 [1.29.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.28.3...v1.29.0 [1.30.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.29.0...v1.30.0 +[2.11.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.30.0...v2.11.0 diff --git a/README.md b/README.md index 756351b..fd12e93 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,7 @@ versions and SDK layer working with all of them in a handy way. |v1.28.x|[v2.8.0](https://github.com/nspcc-dev/neofs-api/releases/tag/v2.8.0)| |v1.29.x|[v2.9.1](https://github.com/nspcc-dev/neofs-api/releases/tag/v2.9.1)| |v1.30.x|[v2.10.0](https://github.com/nspcc-dev/neofs-api/releases/tag/v2.10.0)| +|v2.11.x|[v2.11.0](https://github.com/nspcc-dev/neofs-api/releases/tag/v2.11.0)| ## Contributing From aa53fb7131cd96f3ab70729827d18d63f92917d6 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Fri, 24 Dec 2021 13:16:55 +0300 Subject: [PATCH 0946/1196] [#366] rpc/grpc: Perform read-write message operations with timeout Remote gRPC server may not return or accept data for a while. gRPC solves this issue with timeout in context. However, the context is used for entire gRPC method invocation. Unfortunately the duration of requests with streams can't be estimated easily. To solve this issue we can specify timeouts for every message read and write. Single message has size limit so timeout can be related to that. Signed-off-by: Alex Vanin --- rpc/grpc/init.go | 36 ++++++++++++++++++++++++++++++++---- rpc/grpc/options.go | 19 +++++++++++++++++-- 2 files changed, 49 insertions(+), 6 deletions(-) diff --git a/rpc/grpc/init.go b/rpc/grpc/init.go index aeb4fb4..9cf41d7 100644 --- a/rpc/grpc/init.go +++ b/rpc/grpc/init.go @@ -1,7 +1,9 @@ package grpc import ( + "context" "io" + "time" "github.com/nspcc-dev/neofs-api-go/v2/rpc/common" "google.golang.org/grpc" @@ -28,18 +30,40 @@ type MessageReadWriter interface { type streamWrapper struct { grpc.ClientStream + timeout time.Duration + cancel context.CancelFunc } func (w streamWrapper) ReadMessage(m Message) error { - return w.ClientStream.RecvMsg(m) + return w.withTimeout(func() error { + return w.ClientStream.RecvMsg(m) + }) } func (w streamWrapper) WriteMessage(m Message) error { - return w.ClientStream.SendMsg(m) + return w.withTimeout(func() error { + return w.ClientStream.SendMsg(m) + }) } func (w *streamWrapper) Close() error { - return w.ClientStream.CloseSend() + return w.withTimeout(w.ClientStream.CloseSend) +} + +func (w *streamWrapper) withTimeout(closure func() error) error { + ch := make(chan error, 1) + go func() { + ch <- closure() + close(ch) + }() + + select { + case err := <-ch: + return err + case <-time.After(w.timeout): + w.cancel() + return context.DeadlineExceeded + } } // Init initiates a messaging session within the RPC configured by options. @@ -50,16 +74,20 @@ func (c *Client) Init(info common.CallMethodInfo, opts ...CallOption) (MessageRe opt(prm) } - stream, err := c.con.NewStream(prm.ctx, &grpc.StreamDesc{ + ctx, cancel := context.WithCancel(prm.ctx) + stream, err := c.con.NewStream(ctx, &grpc.StreamDesc{ StreamName: info.Name, ServerStreams: info.ServerStream(), ClientStreams: info.ClientStream(), }, toMethodName(info)) if err != nil { + cancel() return nil, err } return &streamWrapper{ ClientStream: stream, + cancel: cancel, + timeout: c.rwTimeout, }, nil } diff --git a/rpc/grpc/options.go b/rpc/grpc/options.go index 389bd63..29b07ba 100644 --- a/rpc/grpc/options.go +++ b/rpc/grpc/options.go @@ -1,15 +1,22 @@ package grpc import ( + "time" + "google.golang.org/grpc" ) +const defaultRWTimeout = 1 * time.Minute + type cfg struct { - con *grpc.ClientConn + con *grpc.ClientConn + rwTimeout time.Duration } func defaultCfg() *cfg { - return new(cfg) + return &cfg{ + rwTimeout: defaultRWTimeout, + } } // WithClientConnection returns option to set gRPC connection @@ -19,3 +26,11 @@ func WithClientConnection(con *grpc.ClientConn) Option { c.con = con } } + +// WithRWTimeout returns option to specify rwTimeout +// for reading and writing single gRPC message. +func WithRWTimeout(t time.Duration) Option { + return func(c *cfg) { + c.rwTimeout = t + } +} From 49db0cfa030cfbce33a6b6dc2f946fad376516c3 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Fri, 24 Dec 2021 13:18:57 +0300 Subject: [PATCH 0947/1196] [#366] rpc/client: Inherit read-write gRPC timeout from client Signed-off-by: Alex Vanin --- rpc/client/connect.go | 5 ++++- rpc/client/options.go | 17 ++++++++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/rpc/client/connect.go b/rpc/client/connect.go index e80e422..1e36623 100644 --- a/rpc/client/connect.go +++ b/rpc/client/connect.go @@ -15,7 +15,10 @@ func (c *Client) createGRPCClient() (err error) { return } - c.gRPCClient = grpc.New(grpc.WithClientConnection(c.conn)) + c.gRPCClient = grpc.New( + grpc.WithClientConnection(c.conn), + grpc.WithRWTimeout(c.rwTimeout), + ) }) return diff --git a/rpc/client/options.go b/rpc/client/options.go index dd89f51..2c276dc 100644 --- a/rpc/client/options.go +++ b/rpc/client/options.go @@ -20,17 +20,22 @@ type cfg struct { addr string dialTimeout time.Duration + rwTimeout time.Duration tlsCfg *tls.Config conn *grpc.ClientConn } -const defaultDialTimeout = 5 * time.Second +const ( + defaultDialTimeout = 5 * time.Second + defaultRWTimeout = 1 * time.Minute +) func defaultCfg() *cfg { return &cfg{ dialTimeout: defaultDialTimeout, + rwTimeout: defaultRWTimeout, } } @@ -96,6 +101,16 @@ func WithDialTimeout(v time.Duration) Option { } } +// WithRWTimeout returns option to specify timeout +// for reading and writing single gRPC message. +func WithRWTimeout(v time.Duration) Option { + return func(c *cfg) { + if v > 0 { + c.rwTimeout = v + } + } +} + // WithTLSCfg returns option to specify // TLS configuration. // From c64a5c08c8b6b8c811baf7745c342c732c3e6995 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Tue, 28 Dec 2021 12:59:10 +0300 Subject: [PATCH 0948/1196] Update credits Signed-off-by: Alex Vanin --- CREDITS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CREDITS.md b/CREDITS.md index f786376..b640f64 100644 --- a/CREDITS.md +++ b/CREDITS.md @@ -19,6 +19,7 @@ In alphabetical order: In chronological order: - Pavel Korotkov - Pavel Karpy +- Angira Kekteeva # Special Thanks From f04051c96cbde3b54b2f83b3f3aced7212fca707 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Tue, 28 Dec 2021 12:59:37 +0300 Subject: [PATCH 0949/1196] Release v2.11.1 Signed-off-by: Alex Vanin --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d840ca1..096e45e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## [2.11.1] - 2021-12-28 + +### Added +- Timeout for single message transmission in `rpc/client` (#366) + ## [2.11.0] - 2021-12-02 - Sinjido (신지도, 薪智島) NeoFS API v2.11 support. High level packages are moved to @@ -757,3 +762,4 @@ Initial public release [1.29.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.28.3...v1.29.0 [1.30.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.29.0...v1.30.0 [2.11.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.30.0...v2.11.0 +[2.11.1]: https://github.com/nspcc-dev/neofs-api-go/compare/v2.11.0...v2.11.1 From e9a8451fb74609077cc917ba5808069bd81eed32 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 13 Jan 2022 14:56:02 +0300 Subject: [PATCH 0950/1196] [#367] *: Re-compile proto files of NeoFS API protocol Signed-off-by: Leonard Lyubich --- accounting/grpc/service.pb.go | 2 +- accounting/grpc/types.pb.go | 2 +- acl/grpc/types.pb.go | 2 +- audit/grpc/types.pb.go | 2 +- container/grpc/service.pb.go | 2 +- container/grpc/types.pb.go | 2 +- netmap/grpc/service.pb.go | 2 +- netmap/grpc/types.pb.go | 42 ++++++----- object/grpc/service.pb.go | 2 +- object/grpc/types.pb.go | 2 +- refs/grpc/types.pb.go | 2 +- reputation/grpc/service.pb.go | 2 +- reputation/grpc/types.pb.go | 2 +- session/grpc/service.pb.go | 2 +- session/grpc/types.pb.go | 138 ++++++++++++++++++---------------- status/grpc/types.pb.go | 26 ++++--- storagegroup/grpc/types.pb.go | 2 +- subnet/grpc/types.pb.go | 2 +- tombstone/grpc/types.pb.go | 2 +- util/proto/test/test.pb.go | 2 +- 20 files changed, 131 insertions(+), 109 deletions(-) diff --git a/accounting/grpc/service.pb.go b/accounting/grpc/service.pb.go index bdd0925..82858c6 100644 --- a/accounting/grpc/service.pb.go +++ b/accounting/grpc/service.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.1 -// protoc v3.18.0 +// protoc v3.19.1 // source: accounting/grpc/service.proto package accounting diff --git a/accounting/grpc/types.pb.go b/accounting/grpc/types.pb.go index 5a65e84..33df641 100644 --- a/accounting/grpc/types.pb.go +++ b/accounting/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.1 -// protoc v3.18.0 +// protoc v3.19.1 // source: accounting/grpc/types.proto package accounting diff --git a/acl/grpc/types.pb.go b/acl/grpc/types.pb.go index 4af5520..f7b6734 100644 --- a/acl/grpc/types.pb.go +++ b/acl/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.1 -// protoc v3.18.0 +// protoc v3.19.1 // source: acl/grpc/types.proto package acl diff --git a/audit/grpc/types.pb.go b/audit/grpc/types.pb.go index 5353dd0..3da71a8 100644 --- a/audit/grpc/types.pb.go +++ b/audit/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.1 -// protoc v3.18.0 +// protoc v3.19.1 // source: audit/grpc/types.proto package audit diff --git a/container/grpc/service.pb.go b/container/grpc/service.pb.go index 251638e..4af3298 100644 --- a/container/grpc/service.pb.go +++ b/container/grpc/service.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.1 -// protoc v3.18.0 +// protoc v3.19.1 // source: container/grpc/service.proto package container diff --git a/container/grpc/types.pb.go b/container/grpc/types.pb.go index 10f3019..7cb6be5 100644 --- a/container/grpc/types.pb.go +++ b/container/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.1 -// protoc v3.18.0 +// protoc v3.19.1 // source: container/grpc/types.proto package container diff --git a/netmap/grpc/service.pb.go b/netmap/grpc/service.pb.go index 238265a..3f407d7 100644 --- a/netmap/grpc/service.pb.go +++ b/netmap/grpc/service.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.1 -// protoc v3.18.0 +// protoc v3.19.1 // source: netmap/grpc/service.proto package netmap diff --git a/netmap/grpc/types.pb.go b/netmap/grpc/types.pb.go index 56fe0ab..7c44efd 100644 --- a/netmap/grpc/types.pb.go +++ b/netmap/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.1 -// protoc v3.18.0 +// protoc v3.19.1 // source: netmap/grpc/types.proto package netmap @@ -157,11 +157,11 @@ func (Clause) EnumDescriptor() ([]byte, []int) { type NodeInfo_State int32 const ( - // Unknown state. + // Unknown state NodeInfo_UNSPECIFIED NodeInfo_State = 0 - // Active state in the network. + // Active state in the network NodeInfo_ONLINE NodeInfo_State = 1 - // Network unavailable state. + // Network unavailable state NodeInfo_OFFLINE NodeInfo_State = 2 ) @@ -538,7 +538,7 @@ type NodeInfo struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // Public key of the NeoFS node in a binary format. + // Public key of the NeoFS node in a binary format PublicKey []byte `protobuf:"bytes,1,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"` // Ways to connect to a node Addresses []string `protobuf:"bytes,2,rep,name=addresses,proto3" json:"addresses,omitempty"` @@ -547,7 +547,7 @@ type NodeInfo struct { // structures with duplicated attribute names or attributes with empty values // will be considered invalid. Attributes []*NodeInfo_Attribute `protobuf:"bytes,3,rep,name=attributes,proto3" json:"attributes,omitempty"` - // Carries state of the NeoFS node. + // Carries state of the NeoFS node State NodeInfo_State `protobuf:"varint,4,opt,name=state,proto3,enum=neo.fs.v2.netmap.NodeInfo_State" json:"state,omitempty"` } @@ -617,7 +617,7 @@ type NetworkConfig struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // List of parameter values. + // List of parameter values Parameters []*NetworkConfig_Parameter `protobuf:"bytes,1,rep,name=parameters,proto3" json:"parameters,omitempty"` } @@ -666,13 +666,13 @@ type NetworkInfo struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // Number of the current epoch in the NeoFS network. + // Number of the current epoch in the NeoFS network CurrentEpoch uint64 `protobuf:"varint,1,opt,name=current_epoch,json=currentEpoch,proto3" json:"current_epoch,omitempty"` - // Magic number of the sidechain of the NeoFS network. + // Magic number of the sidechain of the NeoFS network MagicNumber uint64 `protobuf:"varint,2,opt,name=magic_number,json=magicNumber,proto3" json:"magic_number,omitempty"` - // MillisecondsPerBlock network parameter of the sidechain of the NeoFS network. + // MillisecondsPerBlock network parameter of the sidechain of the NeoFS network MsPerBlock int64 `protobuf:"varint,3,opt,name=ms_per_block,json=msPerBlock,proto3" json:"ms_per_block,omitempty"` - // NeoFS network configuration. + // NeoFS network configuration NetworkConfig *NetworkConfig `protobuf:"bytes,4,opt,name=network_config,json=networkConfig,proto3" json:"network_config,omitempty"` } @@ -765,9 +765,13 @@ func (x *NetworkInfo) GetNetworkConfig() *NetworkConfig { // attributes it's a string presenting floating point number with comma or // point delimiter for decimal part. In the Network Map it will be saved as // 64-bit unsigned integer representing number of minimal token fractions. -// * Subnet \ -// String ID of Node's storage subnet. There can be only one subnet served -// by the Storage Node. +// * __NEOFS__SUBNET_%s \ +// `True` or `False`. Defines if the node is included in the `%s` subnetwork +// or not. `%s` must be an existing subnetwork's ID (non-negative integer number). +// A node can be included in more than one subnetwork and, therefore, can contain +// more than one subnet attribute. A missing attribute is equivalent to the +// presence of the attribute with `False` value (except default zero subnetwork +// (with `%s` == 0) for which missing attribute means inclusion in that network). // * UN-LOCODE \ // Node's geographic location in // [UN/LOCODE](https://www.unece.org/cefact/codesfortrade/codes_index.html) @@ -807,9 +811,9 @@ type NodeInfo_Attribute struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // Key of the node attribute. + // Key of the node attribute Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - // Value of the node attribute. + // Value of the node attribute Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` // Parent keys, if any. For example for `City` it could be `Region` and // `Country`. @@ -869,15 +873,15 @@ func (x *NodeInfo_Attribute) GetParents() []string { return nil } -// Single configuration parameter. +// Single configuration parameter type NetworkConfig_Parameter struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // Parameter key. UTF-8 encoded string. + // Parameter key. UTF-8 encoded string Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - // Parameter value. + // Parameter value Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` } diff --git a/object/grpc/service.pb.go b/object/grpc/service.pb.go index 3e42924..0a34a84 100644 --- a/object/grpc/service.pb.go +++ b/object/grpc/service.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.1 -// protoc v3.18.0 +// protoc v3.19.1 // source: object/grpc/service.proto package object diff --git a/object/grpc/types.pb.go b/object/grpc/types.pb.go index efc92dc..210977c 100644 --- a/object/grpc/types.pb.go +++ b/object/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.1 -// protoc v3.18.0 +// protoc v3.19.1 // source: object/grpc/types.proto package object diff --git a/refs/grpc/types.pb.go b/refs/grpc/types.pb.go index 6fe5077..6c0345f 100644 --- a/refs/grpc/types.pb.go +++ b/refs/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.1 -// protoc v3.18.0 +// protoc v3.19.1 // source: refs/grpc/types.proto package refs diff --git a/reputation/grpc/service.pb.go b/reputation/grpc/service.pb.go index 79104b5..7893677 100644 --- a/reputation/grpc/service.pb.go +++ b/reputation/grpc/service.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.1 -// protoc v3.18.0 +// protoc v3.19.1 // source: reputation/grpc/service.proto package reputation diff --git a/reputation/grpc/types.pb.go b/reputation/grpc/types.pb.go index be5185e..b4396e8 100644 --- a/reputation/grpc/types.pb.go +++ b/reputation/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.1 -// protoc v3.18.0 +// protoc v3.19.1 // source: reputation/grpc/types.proto package reputation diff --git a/session/grpc/service.pb.go b/session/grpc/service.pb.go index 914f9af..07be942 100644 --- a/session/grpc/service.pb.go +++ b/session/grpc/service.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.1 -// protoc v3.18.0 +// protoc v3.19.1 // source: session/grpc/service.proto package session diff --git a/session/grpc/types.pb.go b/session/grpc/types.pb.go index eb7c25b..9a3dd87 100644 --- a/session/grpc/types.pb.go +++ b/session/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.1 -// protoc v3.18.0 +// protoc v3.19.1 // source: session/grpc/types.proto package session @@ -437,6 +437,9 @@ type RequestMetaHeader struct { BearerToken *grpc1.BearerToken `protobuf:"bytes,6,opt,name=bearer_token,json=bearerToken,proto3" json:"bearer_token,omitempty"` // `RequestMetaHeader` of the origin request Origin *RequestMetaHeader `protobuf:"bytes,7,opt,name=origin,proto3" json:"origin,omitempty"` + // NeoFS network magic. Must match the value for the network + // that the server belongs to. + MagicNumber uint64 `protobuf:"varint,8,opt,name=magic_number,json=magicNumber,proto3" json:"magic_number,omitempty"` } func (x *RequestMetaHeader) Reset() { @@ -520,6 +523,13 @@ func (x *RequestMetaHeader) GetOrigin() *RequestMetaHeader { return nil } +func (x *RequestMetaHeader) GetMagicNumber() uint64 { + if x != nil { + return x.MagicNumber + } + return 0 +} + // Information about the response type ResponseMetaHeader struct { state protoimpl.MessageState @@ -1033,7 +1043,7 @@ var file_session_grpc_types_proto_rawDesc = []byte{ 0x07, 0x58, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 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, - 0x22, 0xea, 0x02, 0x0a, 0x11, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x74, 0x61, + 0x22, 0x8d, 0x03, 0x0a, 0x11, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 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, @@ -1055,69 +1065,71 @@ var file_session_grpc_types_proto_rawDesc = []byte{ 0x3c, 0x0a, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x18, 0x07, 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, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x22, 0x99, 0x02, - 0x0a, 0x12, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x48, 0x65, - 0x61, 0x64, 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, 0x14, 0x0a, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x12, 0x10, 0x0a, - 0x03, 0x74, 0x74, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x03, 0x74, 0x74, 0x6c, 0x12, - 0x37, 0x0a, 0x09, 0x78, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x18, 0x04, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, - 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x58, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x08, - 0x78, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x12, 0x3d, 0x0a, 0x06, 0x6f, 0x72, 0x69, 0x67, - 0x69, 0x6e, 0x18, 0x05, 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, - 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x12, 0x30, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, - 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, - 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, - 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0xab, 0x02, 0x0a, 0x19, 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, 0x12, 0x40, 0x0a, 0x0e, 0x62, 0x6f, 0x64, 0x79, 0x5f, - 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, - 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x0d, 0x62, 0x6f, 0x64, 0x79, - 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x40, 0x0a, 0x0e, 0x6d, 0x65, 0x74, - 0x61, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, - 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x0d, 0x6d, 0x65, - 0x74, 0x61, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x44, 0x0a, 0x10, 0x6f, - 0x72, 0x69, 0x67, 0x69, 0x6e, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, - 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, - 0x52, 0x0f, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, - 0x65, 0x12, 0x44, 0x0a, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x18, 0x04, 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, - 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x22, 0xad, 0x02, 0x0a, 0x1a, 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, 0x12, 0x40, 0x0a, 0x0e, 0x62, 0x6f, 0x64, 0x79, 0x5f, 0x73, - 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, - 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, - 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x0d, 0x62, 0x6f, 0x64, 0x79, 0x53, - 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x40, 0x0a, 0x0e, 0x6d, 0x65, 0x74, 0x61, - 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, - 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x0d, 0x6d, 0x65, 0x74, - 0x61, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x44, 0x0a, 0x10, 0x6f, 0x72, - 0x69, 0x67, 0x69, 0x6e, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x03, + 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x12, 0x21, 0x0a, + 0x0c, 0x6d, 0x61, 0x67, 0x69, 0x63, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x08, 0x20, + 0x01, 0x28, 0x04, 0x52, 0x0b, 0x6d, 0x61, 0x67, 0x69, 0x63, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, + 0x22, 0x99, 0x02, 0x0a, 0x12, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4d, 0x65, 0x74, + 0x61, 0x48, 0x65, 0x61, 0x64, 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, 0x14, 0x0a, 0x05, 0x65, 0x70, + 0x6f, 0x63, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, + 0x12, 0x10, 0x0a, 0x03, 0x74, 0x74, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x03, 0x74, + 0x74, 0x6c, 0x12, 0x37, 0x0a, 0x09, 0x78, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x18, + 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x58, 0x48, 0x65, 0x61, 0x64, 0x65, + 0x72, 0x52, 0x08, 0x78, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x12, 0x3d, 0x0a, 0x06, 0x6f, + 0x72, 0x69, 0x67, 0x69, 0x6e, 0x18, 0x05, 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, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x12, 0x30, 0x0a, 0x06, 0x73, 0x74, + 0x61, 0x74, 0x75, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, + 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x53, 0x74, + 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0xab, 0x02, 0x0a, + 0x19, 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, 0x12, 0x40, 0x0a, 0x0e, 0x62, 0x6f, + 0x64, 0x79, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, + 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x0d, 0x62, + 0x6f, 0x64, 0x79, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x40, 0x0a, 0x0e, + 0x6d, 0x65, 0x74, 0x61, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, - 0x0f, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, - 0x12, 0x45, 0x0a, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x18, 0x04, 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, - 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x42, 0x59, 0x5a, 0x39, 0x67, 0x69, 0x74, 0x68, 0x75, - 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, - 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 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, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x0d, 0x6d, 0x65, 0x74, 0x61, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x44, + 0x0a, 0x10, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, + 0x72, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, + 0x75, 0x72, 0x65, 0x52, 0x0f, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x53, 0x69, 0x67, 0x6e, 0x61, + 0x74, 0x75, 0x72, 0x65, 0x12, 0x44, 0x0a, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x18, 0x04, + 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, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x22, 0xad, 0x02, 0x0a, 0x1a, 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, 0x12, 0x40, 0x0a, 0x0e, 0x62, 0x6f, 0x64, + 0x79, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, + 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x0d, 0x62, 0x6f, + 0x64, 0x79, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x40, 0x0a, 0x0e, 0x6d, + 0x65, 0x74, 0x61, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, + 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x0d, + 0x6d, 0x65, 0x74, 0x61, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x44, 0x0a, + 0x10, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, + 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, + 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, + 0x72, 0x65, 0x52, 0x0f, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, + 0x75, 0x72, 0x65, 0x12, 0x45, 0x0a, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x18, 0x04, 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, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x42, 0x59, 0x5a, 0x39, 0x67, 0x69, + 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, + 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, + 0x76, 0x32, 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, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/status/grpc/types.pb.go b/status/grpc/types.pb.go index ed98123..99f5b0e 100644 --- a/status/grpc/types.pb.go +++ b/status/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.1 -// protoc v3.18.0 +// protoc v3.19.1 // source: status/grpc/types.proto package status @@ -124,15 +124,19 @@ const ( // If the server cannot match failed outcome to the code, it should // use this code. CommonFail_INTERNAL CommonFail = 0 + // [**1025**] Wrong magic of the NeoFS network. Not detailed. + CommonFail_WRONG_MAGIC_NUMBER CommonFail = 1 ) // Enum value maps for CommonFail. var ( CommonFail_name = map[int32]string{ 0: "INTERNAL", + 1: "WRONG_MAGIC_NUMBER", } CommonFail_value = map[string]int32{ - "INTERNAL": 0, + "INTERNAL": 0, + "WRONG_MAGIC_NUMBER": 1, } ) @@ -339,15 +343,17 @@ var file_status_grpc_types_proto_rawDesc = []byte{ 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x53, 0x55, 0x43, 0x43, 0x45, 0x53, 0x53, 0x10, 0x00, 0x12, 0x1a, 0x0a, 0x16, 0x53, 0x45, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x46, 0x41, 0x49, 0x4c, 0x55, 0x52, 0x45, 0x5f, 0x43, 0x4f, 0x4d, 0x4d, 0x4f, 0x4e, 0x10, 0x01, 0x2a, 0x11, 0x0a, 0x07, 0x53, - 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x06, 0x0a, 0x02, 0x4f, 0x4b, 0x10, 0x00, 0x2a, 0x1a, + 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x06, 0x0a, 0x02, 0x4f, 0x4b, 0x10, 0x00, 0x2a, 0x32, 0x0a, 0x0a, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x46, 0x61, 0x69, 0x6c, 0x12, 0x0c, 0x0a, 0x08, - 0x49, 0x4e, 0x54, 0x45, 0x52, 0x4e, 0x41, 0x4c, 0x10, 0x00, 0x42, 0x56, 0x5a, 0x37, 0x67, 0x69, - 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, - 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, - 0x76, 0x32, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x73, - 0x74, 0x61, 0x74, 0x75, 0x73, 0xaa, 0x02, 0x1a, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, - 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x53, 0x74, 0x61, 0x74, - 0x75, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x49, 0x4e, 0x54, 0x45, 0x52, 0x4e, 0x41, 0x4c, 0x10, 0x00, 0x12, 0x16, 0x0a, 0x12, 0x57, 0x52, + 0x4f, 0x4e, 0x47, 0x5f, 0x4d, 0x41, 0x47, 0x49, 0x43, 0x5f, 0x4e, 0x55, 0x4d, 0x42, 0x45, 0x52, + 0x10, 0x01, 0x42, 0x56, 0x5a, 0x37, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, + 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, + 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x75, + 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0xaa, 0x02, 0x1a, + 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, + 0x41, 0x50, 0x49, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, } var ( diff --git a/storagegroup/grpc/types.pb.go b/storagegroup/grpc/types.pb.go index fa5b98c..d6584f5 100644 --- a/storagegroup/grpc/types.pb.go +++ b/storagegroup/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.1 -// protoc v3.18.0 +// protoc v3.19.1 // source: storagegroup/grpc/types.proto package storagegroup diff --git a/subnet/grpc/types.pb.go b/subnet/grpc/types.pb.go index fade308..bab81bf 100644 --- a/subnet/grpc/types.pb.go +++ b/subnet/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.1 -// protoc v3.18.0 +// protoc v3.19.1 // source: subnet/grpc/types.proto package subnet diff --git a/tombstone/grpc/types.pb.go b/tombstone/grpc/types.pb.go index f2f3db6..60aacc2 100644 --- a/tombstone/grpc/types.pb.go +++ b/tombstone/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.1 -// protoc v3.18.0 +// protoc v3.19.1 // source: tombstone/grpc/types.proto package tombstone diff --git a/util/proto/test/test.pb.go b/util/proto/test/test.pb.go index 2a433a2..b0ef135 100644 --- a/util/proto/test/test.pb.go +++ b/util/proto/test/test.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.1 -// protoc v3.18.0 +// protoc v3.19.1 // source: util/proto/test/test.proto package test From 227a871a04ace12f39ddb3b19db9bc892d2ed496 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 13 Jan 2022 15:25:03 +0300 Subject: [PATCH 0951/1196] [#367] session: Support `magic_number` field of `RequestMetaHeader` Signed-off-by: Leonard Lyubich --- session/convert.go | 2 ++ session/grpc/types.go | 16 ++++++++++++++++ session/marshal.go | 11 ++++++++++- session/test/generate.go | 1 + session/types.go | 18 ++++++++++++++++++ 5 files changed, 47 insertions(+), 1 deletion(-) diff --git a/session/convert.go b/session/convert.go index df78c9e..5562fff 100644 --- a/session/convert.go +++ b/session/convert.go @@ -389,6 +389,7 @@ func (r *RequestMetaHeader) ToGRPCMessage() grpc.Message { m.SetEpoch(r.epoch) m.SetTtl(r.ttl) m.SetOrigin(r.origin.ToGRPCMessage().(*session.RequestMetaHeader)) + m.SetNetworkMagic(r.netMagic) } return m @@ -465,6 +466,7 @@ func (r *RequestMetaHeader) FromGRPCMessage(m grpc.Message) error { r.epoch = v.GetEpoch() r.ttl = v.GetTtl() + r.netMagic = v.GetNetworkMagic() return nil } diff --git a/session/grpc/types.go b/session/grpc/types.go index 07d5d13..484203d 100644 --- a/session/grpc/types.go +++ b/session/grpc/types.go @@ -185,6 +185,22 @@ func (m *RequestMetaHeader) SetOrigin(v *RequestMetaHeader) { } } +// GetNetworkMagic returns NeoFS network magic. +func (m *RequestMetaHeader) GetNetworkMagic() uint64 { + if m != nil { + return m.MagicNumber + } + + return 0 +} + +// SetNetworkMagic sets NeoFS network magic. +func (m *RequestMetaHeader) SetNetworkMagic(v uint64) { + if m != nil { + m.MagicNumber = v + } +} + // SetVersion sets server protocol version. func (m *ResponseMetaHeader) SetVersion(v *refs.Version) { if m != nil { diff --git a/session/marshal.go b/session/marshal.go index 9513d4c..f28615c 100644 --- a/session/marshal.go +++ b/session/marshal.go @@ -41,6 +41,7 @@ const ( reqMetaHeaderSessionTokenField = 5 reqMetaHeaderBearerTokenField = 6 reqMetaHeaderOriginField = 7 + reqMetaHeaderNetMagicField = 8 reqVerifHeaderBodySignatureField = 1 reqVerifHeaderMetaSignatureField = 2 @@ -564,7 +565,14 @@ func (r *RequestMetaHeader) StableMarshal(buf []byte) ([]byte, error) { offset += n - _, err = proto.NestedStructureMarshal(reqMetaHeaderOriginField, buf[offset:], r.origin) + n, err = proto.NestedStructureMarshal(reqMetaHeaderOriginField, buf[offset:], r.origin) + if err != nil { + return nil, err + } + + offset += n + + _, err = proto.UInt64Marshal(reqMetaHeaderNetMagicField, buf[offset:], r.netMagic) if err != nil { return nil, err } @@ -591,6 +599,7 @@ func (r *RequestMetaHeader) StableSize() (size int) { size += proto.NestedStructureSize(reqMetaHeaderSessionTokenField, r.sessionToken) size += proto.NestedStructureSize(reqMetaHeaderBearerTokenField, r.bearerToken) size += proto.NestedStructureSize(reqMetaHeaderOriginField, r.origin) + size += proto.UInt64Size(reqMetaHeaderNetMagicField, r.netMagic) return size } diff --git a/session/test/generate.go b/session/test/generate.go index 8473d80..d809592 100644 --- a/session/test/generate.go +++ b/session/test/generate.go @@ -130,6 +130,7 @@ func generateRequestMetaHeader(empty, withOrigin bool) *session.RequestMetaHeade if !empty { m.SetEpoch(13) m.SetTTL(100) + m.SetNetworkMagic(1337) } m.SetXHeaders(GenerateXHeaders(empty)) diff --git a/session/types.go b/session/types.go index 8a97817..26fa26e 100644 --- a/session/types.go +++ b/session/types.go @@ -88,6 +88,8 @@ type RequestMetaHeader struct { bearerToken *acl.BearerToken origin *RequestMetaHeader + + netMagic uint64 } type ResponseVerificationHeader struct { @@ -443,6 +445,22 @@ func (r *RequestMetaHeader) SetOrigin(v *RequestMetaHeader) { } } +// GetNetworkMagic returns NeoFS network magic. +func (r *RequestMetaHeader) GetNetworkMagic() uint64 { + if r != nil { + return r.netMagic + } + + return 0 +} + +// SetNetworkMagic sets NeoFS network magic. +func (r *RequestMetaHeader) SetNetworkMagic(v uint64) { + if r != nil { + r.netMagic = v + } +} + func (l *TokenLifetime) GetExp() uint64 { if l != nil { return l.exp From 959d1c8c38fa16793b875f92201e77c35f44c1fd Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 24 Jan 2022 20:29:32 +0300 Subject: [PATCH 0952/1196] [#369] status: Compile sources with detailed magic number Signed-off-by: Leonard Lyubich --- status/grpc/types.pb.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/status/grpc/types.pb.go b/status/grpc/types.pb.go index 99f5b0e..e6d571f 100644 --- a/status/grpc/types.pb.go +++ b/status/grpc/types.pb.go @@ -124,7 +124,10 @@ const ( // If the server cannot match failed outcome to the code, it should // use this code. CommonFail_INTERNAL CommonFail = 0 - // [**1025**] Wrong magic of the NeoFS network. Not detailed. + // [**1025**] Wrong magic of the NeoFS network. + // Details: + // - [**0**] Magic number of the served NeoFS network (big-endian 64-bit + // unsigned integer). CommonFail_WRONG_MAGIC_NUMBER CommonFail = 1 ) From 32dd0bb3f9c5c6c444473f6a7ef0f3dd3ed6b201 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 25 Jan 2022 15:11:32 +0300 Subject: [PATCH 0953/1196] [#369] status: Support WRONG_MAGIC_NUMBER code and detail Define constant for `WrongMagicNumber` local code. Define constant `DetailIDCorrect` for correct magic detail. Add `ResetDetails` and `AppendDetails` method pair. Replace `SetDetails` method with new `SetStatusDetails` function which can be implemented using new methods. Signed-off-by: Leonard Lyubich --- status/details.go | 8 ++++++++ status/status.go | 2 ++ status/test/generate.go | 2 +- status/types.go | 19 ++++++++++++++++--- 4 files changed, 27 insertions(+), 4 deletions(-) create mode 100644 status/details.go diff --git a/status/details.go b/status/details.go new file mode 100644 index 0000000..5b8f460 --- /dev/null +++ b/status/details.go @@ -0,0 +1,8 @@ +package status + +// details for WrongMagicNumber code. +const ( + // DetailIDCorrectMagic is an identifier of details with correct network magic + // which can be attached to WrongMagicNumber code. + DetailIDCorrectMagic = iota +) diff --git a/status/status.go b/status/status.go index d24ce57..4b1f370 100644 --- a/status/status.go +++ b/status/status.go @@ -57,6 +57,8 @@ const ( const ( // Internal is a local Code value for INTERNAL failure status. Internal Code = iota + // WrongMagicNumber is a local Code value for WRONG_MAGIC_NUMBER failure status. + WrongMagicNumber ) const ( diff --git a/status/test/generate.go b/status/test/generate.go index c8b5a66..1861212 100644 --- a/status/test/generate.go +++ b/status/test/generate.go @@ -37,7 +37,7 @@ func Status(empty bool) *status.Status { if !empty { m.SetCode(765) m.SetMessage("some string") - m.SetDetails(Details(false)) + status.SetStatusDetails(m, Details(false)) } return m diff --git a/status/types.go b/status/types.go index 3e907d8..61a05d0 100644 --- a/status/types.go +++ b/status/types.go @@ -106,9 +106,22 @@ func (x *Status) IterateDetails(f func(*Detail) bool) { } } -// SetDetails sets Detail list of the Status. -func (x *Status) SetDetails(v []*Detail) { +// ResetDetails empties the detail list. +func (x *Status) ResetDetails() { if x != nil { - x.details = v + x.details = x.details[:0] } } + +// AppendDetails appends the list of details to the Status. +func (x *Status) AppendDetails(ds ...*Detail) { + if x != nil { + x.details = append(x.details, ds...) + } +} + +// SetStatusDetails sets Detail list of the Status. +func SetStatusDetails(dst *Status, ds []*Detail) { + dst.ResetDetails() + dst.AppendDetails(ds...) +} From 60473c44b9e52d61b47b739f23d38db67cdd5085 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Mon, 7 Feb 2022 15:44:22 +0300 Subject: [PATCH 0954/1196] [#368] README.md: change desctiption and link to SDK Signed-off-by: Evgenii Stratonikov --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index fd12e93..0fe20a9 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ NeoFS

- Golang SDK for NeoFS + Low-level Golang API for NeoFS

--- @@ -15,7 +15,7 @@ # Overview Go implementation of recent [NeoFS API](https://github.com/nspcc-dev/neofs-api) -versions and SDK layer working with all of them in a handy way. +versions. For a more high-level SDK see [NeoFS SDK](https://github.com/nspcc-dev/neofs-sdk-go). ## NeoFS-API compatibility From aabc2dd9275b2b5051ffd6318318df416a05d37f Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Wed, 16 Feb 2022 15:04:51 +0300 Subject: [PATCH 0955/1196] [#372] object: Fix filter comment Signed-off-by: Pavel Karpy --- object/filters.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/object/filters.go b/object/filters.go index 8340cea..5eee13b 100644 --- a/object/filters.go +++ b/object/filters.go @@ -34,7 +34,7 @@ const ( // FilterHeaderParent is a filter key to "split.parent" field of the object header. FilterHeaderParent = ReservedFilterPrefix + "split.parent" - // FilterHeaderParent is a filter key to "split.splitID" field of the object header. + // FilterHeaderSplitID is a filter key to "split.splitID" field of the object header. FilterHeaderSplitID = ReservedFilterPrefix + "split.splitID" ) From 4007aa86f426331ee768498b5e5ee461b176878f Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Wed, 16 Feb 2022 17:53:28 +0300 Subject: [PATCH 0956/1196] [#372] object: Add object notification attributes Also, add functions for parsing and setting object notifications. Signed-off-by: Pavel Karpy --- object/attributes.go | 157 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 157 insertions(+) diff --git a/object/attributes.go b/object/attributes.go index 6a9dfd2..2e701bc 100644 --- a/object/attributes.go +++ b/object/attributes.go @@ -1,5 +1,11 @@ package object +import ( + "errors" + "fmt" + "strconv" +) + // SysAttributePrefix is a prefix of key to system attribute. const SysAttributePrefix = "__NEOFS__" @@ -9,4 +15,155 @@ const ( // SysAttributeExpEpoch tells GC to delete object after that epoch. SysAttributeExpEpoch = SysAttributePrefix + "EXPIRATION_EPOCH" + + // SysAttributeTickEpoch defines what epoch must produce object + // notification. + SysAttributeTickEpoch = SysAttributePrefix + "TICK_EPOCH" + + // SysAttributeTickTopic defines what topic object notification + // must be sent to. + SysAttributeTickTopic = SysAttributePrefix + "TICK_TOPIC" ) + +// NotificationInfo groups information about object notification +// that can be written to object. +// +// Topic is an optional field. +type NotificationInfo struct { + epoch uint64 + topic string +} + +// Epoch returns object notification tick +// epoch. +func (n NotificationInfo) Epoch() uint64 { + return n.epoch +} + +// SetEpoch sets object notification tick +// epoch. +func (n *NotificationInfo) SetEpoch(epoch uint64) { + n.epoch = epoch +} + +// Topic return optional object notification +// topic. +func (n NotificationInfo) Topic() string { + return n.topic +} + +// SetTopic sets optional object notification +// topic. +func (n *NotificationInfo) SetTopic(topic string) { + n.topic = topic +} + +// WriteNotificationInfo writes NotificationInfo to the Object via attributes. Object must not be nil. +// +// Existing notification attributes are expected to be key-unique, otherwise undefined behavior. +func WriteNotificationInfo(o *Object, ni NotificationInfo) { + h := o.GetHeader() + if h == nil { + h = new(Header) + o.SetHeader(h) + } + + var ( + attrs = h.GetAttributes() + + epoch = strconv.FormatUint(ni.Epoch(), 10) + topic = ni.Topic() + + changedEpoch bool + changedTopic bool + deleteIndex = -1 + ) + + for i := range attrs { + switch attrs[i].GetKey() { + case SysAttributeTickEpoch: + attrs[i].SetValue(epoch) + changedEpoch = true + case SysAttributeTickTopic: + changedTopic = true + + if topic == "" { + deleteIndex = i + break + } + + attrs[i].SetValue(topic) + } + + if changedEpoch && changedTopic { + break + } + } + + if deleteIndex != -1 { + // approach without allocation/waste + // coping works since the attributes + // order is not important + attrs[deleteIndex] = attrs[len(attrs)-1] + attrs = attrs[:len(attrs)-1] + } + + notifyAttrs := make([]*Attribute, 0, 2) + + if !changedEpoch { + eAttr := new(Attribute) + eAttr.SetKey(SysAttributeTickEpoch) + eAttr.SetValue(epoch) + + notifyAttrs = append(notifyAttrs, eAttr) + } + + if !changedTopic && topic != "" { + tAttr := new(Attribute) + tAttr.SetKey(SysAttributeTickTopic) + tAttr.SetValue(topic) + + notifyAttrs = append(notifyAttrs, tAttr) + } + + attrs = append(attrs, notifyAttrs...) + + h.SetAttributes(attrs) +} + +// ErrNotificationNotSet means that object does not have notification. +var ErrNotificationNotSet = errors.New("notification for object is not set") + +// GetNotificationInfo looks for object notification attributes. Object must not be nil. +// Returns ErrNotificationNotSet if no corresponding attributes +// were found. +// +// Existing notification attributes are expected to be key-unique, otherwise undefined behavior. +func GetNotificationInfo(o *Object) (*NotificationInfo, error) { + var ( + foundEpoch bool + ni = new(NotificationInfo) + ) + + for _, attr := range o.GetHeader().GetAttributes() { + switch key := attr.GetKey(); key { + case SysAttributeTickEpoch: + epoch, err := strconv.ParseUint(attr.GetValue(), 10, 64) + if err != nil { + return nil, fmt.Errorf("could not parse epoch: %w", err) + } + + ni.SetEpoch(epoch) + + foundEpoch = true + case SysAttributeTickTopic: + ni.SetTopic(attr.GetValue()) + } + } + + if !foundEpoch { + return nil, ErrNotificationNotSet + } + + return ni, nil +} From 1384523f620ffb59184e9eabc382bd1a6596b24c Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Wed, 16 Feb 2022 17:53:46 +0300 Subject: [PATCH 0957/1196] [#372] object: Add object notification unit tests Signed-off-by: Pavel Karpy --- object/attributes_test.go | 89 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 object/attributes_test.go diff --git a/object/attributes_test.go b/object/attributes_test.go new file mode 100644 index 0000000..8556f13 --- /dev/null +++ b/object/attributes_test.go @@ -0,0 +1,89 @@ +package object + +import ( + "strconv" + "testing" + + "github.com/stretchr/testify/require" +) + +func TestSetNotification(t *testing.T) { + o := new(Object) + + var ni = NotificationInfo{ + epoch: 10, + topic: "test", + } + + WriteNotificationInfo(o, ni) + + var foundEpoch, foundTopic bool + + for _, attr := range o.GetHeader().GetAttributes() { + switch key := attr.GetKey(); key { + case SysAttributeTickEpoch: + require.Equal(t, false, foundEpoch) + + uEpoch, err := strconv.ParseUint(attr.GetValue(), 10, 64) + require.NoError(t, err) + + require.Equal(t, ni.Epoch(), uEpoch) + foundEpoch = true + case SysAttributeTickTopic: + require.Equal(t, false, foundTopic) + require.Equal(t, ni.Topic(), attr.GetValue()) + foundTopic = true + } + } + + require.Equal(t, true, foundEpoch && foundTopic) +} + +func TestGetNotification(t *testing.T) { + o := new(Object) + + attr := []*Attribute{ + {SysAttributeTickEpoch, "10"}, + {SysAttributeTickTopic, "test"}, + } + + h := new(Header) + h.SetAttributes(attr) + + o.SetHeader(h) + + t.Run("No error", func(t *testing.T) { + ni, err := GetNotificationInfo(o) + require.NoError(t, err) + + require.Equal(t, uint64(10), ni.Epoch()) + require.Equal(t, "test", ni.Topic()) + }) +} + +func TestIntegration(t *testing.T) { + o := new(Object) + + var ( + ni1 = NotificationInfo{ + epoch: 10, + topic: "", + } + ni2 = NotificationInfo{ + epoch: 11, + topic: "test", + } + ) + + WriteNotificationInfo(o, ni1) + WriteNotificationInfo(o, ni2) + + t.Run("double set", func(t *testing.T) { + ni, err := GetNotificationInfo(o) + require.NoError(t, err) + + require.Equal(t, ni2.epoch, ni.Epoch()) + require.Equal(t, ni2.topic, ni.Topic()) + require.Equal(t, 2, len(o.GetHeader().GetAttributes())) + }) +} From 66e1fb8c539cfab67dc1d2c53139cb09466b00ab Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Tue, 22 Feb 2022 14:14:33 +0300 Subject: [PATCH 0958/1196] [#55] refs: Fix linter warnings Signed-off-by: Evgenii Stratonikov --- refs/grpc/types.go | 68 +++++++++++++++++++++++----------------------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/refs/grpc/types.go b/refs/grpc/types.go index 6d86824..7b0a9b9 100644 --- a/refs/grpc/types.go +++ b/refs/grpc/types.go @@ -1,79 +1,79 @@ package refs // SetValue sets container identifier in a binary format. -func (m *ContainerID) SetValue(v []byte) { - if m != nil { - m.Value = v +func (x *ContainerID) SetValue(v []byte) { + if x != nil { + x.Value = v } } // SetValue sets object identifier in a binary format. -func (m *ObjectID) SetValue(v []byte) { - if m != nil { - m.Value = v +func (x *ObjectID) SetValue(v []byte) { + if x != nil { + x.Value = v } } // SetValue sets owner identifier in a binary format. -func (m *OwnerID) SetValue(v []byte) { - if m != nil { - m.Value = v +func (x *OwnerID) SetValue(v []byte) { + if x != nil { + x.Value = v } } // SetContainerId sets container identifier of the address. -func (m *Address) SetContainerId(v *ContainerID) { - if m != nil { - m.ContainerId = v +func (x *Address) SetContainerId(v *ContainerID) { + if x != nil { + x.ContainerId = v } } // SetObjectId sets object identifier of the address. -func (m *Address) SetObjectId(v *ObjectID) { - if m != nil { - m.ObjectId = v +func (x *Address) SetObjectId(v *ObjectID) { + if x != nil { + x.ObjectId = v } } // SetChecksumType in generic checksum structure. -func (m *Checksum) SetChecksumType(v ChecksumType) { - if m != nil { - m.Type = v +func (x *Checksum) SetChecksumType(v ChecksumType) { + if x != nil { + x.Type = v } } -// SetChecksumSum in generic checksum structure. -func (m *Checksum) SetSum(v []byte) { - if m != nil { - m.Sum = v +// SetSum in generic checksum structure. +func (x *Checksum) SetSum(v []byte) { + if x != nil { + x.Sum = v } } // SetMajor sets major version number. -func (m *Version) SetMajor(v uint32) { - if m != nil { - m.Major = v +func (x *Version) SetMajor(v uint32) { + if x != nil { + x.Major = v } } // SetMinor sets minor version number. -func (m *Version) SetMinor(v uint32) { - if m != nil { - m.Minor = v +func (x *Version) SetMinor(v uint32) { + if x != nil { + x.Minor = v } } // SetKey sets public key in a binary format. -func (m *Signature) SetKey(v []byte) { - if m != nil { - m.Key = v +func (x *Signature) SetKey(v []byte) { + if x != nil { + x.Key = v } } // SetSign sets signature. -func (m *Signature) SetSign(v []byte) { - if m != nil { - m.Sign = v +func (x *Signature) SetSign(v []byte) { + if x != nil { + x.Sign = v } } From a4349f6692a52a5484a84070eda52ca860db4b9e Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Tue, 22 Feb 2022 14:25:43 +0300 Subject: [PATCH 0959/1196] [#55] refs: Add Scheme field to Signature Signed-off-by: Evgenii Stratonikov --- refs/convert.go | 2 + refs/grpc/types.go | 20 +++++ refs/grpc/types.pb.go | 151 ++++++++++++++++++++++++++++---------- refs/marshal.go | 15 +++- refs/string.go | 21 ++++++ refs/test/generate.go | 3 + refs/types.go | 22 ++++++ signature/sign.go | 19 +---- util/signature/data.go | 39 +++++----- util/signature/options.go | 45 ++++++++++-- 10 files changed, 252 insertions(+), 85 deletions(-) diff --git a/refs/convert.go b/refs/convert.go index 80b03d2..bb6e988 100644 --- a/refs/convert.go +++ b/refs/convert.go @@ -260,6 +260,7 @@ func (s *Signature) ToGRPCMessage() grpc.Message { m.SetKey(s.key) m.SetSign(s.sign) + m.SetScheme(refs.SignatureScheme(s.scheme)) } return m @@ -273,6 +274,7 @@ func (s *Signature) FromGRPCMessage(m grpc.Message) error { s.key = v.GetKey() s.sign = v.GetSign() + s.scheme = SignatureScheme(v.GetScheme()) return nil } diff --git a/refs/grpc/types.go b/refs/grpc/types.go index 7b0a9b9..b1c48c1 100644 --- a/refs/grpc/types.go +++ b/refs/grpc/types.go @@ -77,6 +77,26 @@ func (x *Signature) SetSign(v []byte) { } } +// SetScheme sets signature scheme. +func (x *Signature) SetScheme(s SignatureScheme) { + if x != nil { + x.Scheme = s + } +} + +// FromString parses SignatureScheme from a string representation, +// It is a reverse action to String(). +// +// Returns true if s was parsed successfully. +func (x *SignatureScheme) FromString(s string) bool { + i, ok := SignatureScheme_value[s] + if ok { + *x = SignatureScheme(i) + } + + return ok +} + // FromString parses ChecksumType from a string representation, // It is a reverse action to String(). // diff --git a/refs/grpc/types.pb.go b/refs/grpc/types.pb.go index 6c0345f..7df2f05 100644 --- a/refs/grpc/types.pb.go +++ b/refs/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.1 -// protoc v3.19.1 +// protoc v3.19.4 // source: refs/grpc/types.proto package refs @@ -20,6 +20,59 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) +// Signature scheme describes digital signing scheme used for (key, signature) pair. +type SignatureScheme int32 + +const ( + // Unknown. The default interpretation depends on a particular structure type. + SignatureScheme_UNSPECIFIED SignatureScheme = 0 + // ECDSA with SHA-512 hashing (FIPS 186-3). + SignatureScheme_ECDSA_SHA512 SignatureScheme = 1 + // Deterministic ECDSA with SHA-256 hashing (RFC 6979) + SignatureScheme_ECDSA_RFC6979_SHA256 SignatureScheme = 2 +) + +// Enum value maps for SignatureScheme. +var ( + SignatureScheme_name = map[int32]string{ + 0: "UNSPECIFIED", + 1: "ECDSA_SHA512", + 2: "ECDSA_RFC6979_SHA256", + } + SignatureScheme_value = map[string]int32{ + "UNSPECIFIED": 0, + "ECDSA_SHA512": 1, + "ECDSA_RFC6979_SHA256": 2, + } +) + +func (x SignatureScheme) Enum() *SignatureScheme { + p := new(SignatureScheme) + *p = x + return p +} + +func (x SignatureScheme) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (SignatureScheme) Descriptor() protoreflect.EnumDescriptor { + return file_refs_grpc_types_proto_enumTypes[0].Descriptor() +} + +func (SignatureScheme) Type() protoreflect.EnumType { + return &file_refs_grpc_types_proto_enumTypes[0] +} + +func (x SignatureScheme) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use SignatureScheme.Descriptor instead. +func (SignatureScheme) EnumDescriptor() ([]byte, []int) { + return file_refs_grpc_types_proto_rawDescGZIP(), []int{0} +} + // Checksum algorithm type. type ChecksumType int32 @@ -57,11 +110,11 @@ func (x ChecksumType) String() string { } func (ChecksumType) Descriptor() protoreflect.EnumDescriptor { - return file_refs_grpc_types_proto_enumTypes[0].Descriptor() + return file_refs_grpc_types_proto_enumTypes[1].Descriptor() } func (ChecksumType) Type() protoreflect.EnumType { - return &file_refs_grpc_types_proto_enumTypes[0] + return &file_refs_grpc_types_proto_enumTypes[1] } func (x ChecksumType) Number() protoreflect.EnumNumber { @@ -70,7 +123,7 @@ func (x ChecksumType) Number() protoreflect.EnumNumber { // Deprecated: Use ChecksumType.Descriptor instead. func (ChecksumType) EnumDescriptor() ([]byte, []int) { - return file_refs_grpc_types_proto_rawDescGZIP(), []int{0} + return file_refs_grpc_types_proto_rawDescGZIP(), []int{1} } // Objects in NeoFS are addressed by their ContainerID and ObjectID. @@ -448,6 +501,8 @@ type Signature struct { Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` // Signature Sign []byte `protobuf:"bytes,2,opt,name=sign,json=signature,proto3" json:"sign,omitempty"` + // Scheme contains digital signature scheme identifier. + Scheme SignatureScheme `protobuf:"varint,3,opt,name=scheme,proto3,enum=neo.fs.v2.refs.SignatureScheme" json:"scheme,omitempty"` } func (x *Signature) Reset() { @@ -496,6 +551,13 @@ func (x *Signature) GetSign() []byte { return nil } +func (x *Signature) GetScheme() SignatureScheme { + if x != nil { + return x.Scheme + } + return SignatureScheme_UNSPECIFIED +} + // Checksum message. // Depending on checksum algorithm type the string presentation may vary: // @@ -585,25 +647,34 @@ var file_refs_grpc_types_proto_rawDesc = []byte{ 0x61, 0x6c, 0x75, 0x65, 0x22, 0x35, 0x0a, 0x07, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x6d, 0x61, 0x6a, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x6d, 0x61, 0x6a, 0x6f, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x6d, 0x69, 0x6e, 0x6f, 0x72, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x6d, 0x69, 0x6e, 0x6f, 0x72, 0x22, 0x36, 0x0a, 0x09, 0x53, + 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x6d, 0x69, 0x6e, 0x6f, 0x72, 0x22, 0x6f, 0x0a, 0x09, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x69, 0x67, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, - 0x75, 0x72, 0x65, 0x22, 0x4e, 0x0a, 0x08, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x12, - 0x30, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1c, 0x2e, - 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, - 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, - 0x65, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x75, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x03, - 0x73, 0x75, 0x6d, 0x2a, 0x41, 0x0a, 0x0c, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x54, - 0x79, 0x70, 0x65, 0x12, 0x1d, 0x0a, 0x19, 0x43, 0x48, 0x45, 0x43, 0x4b, 0x53, 0x55, 0x4d, 0x5f, - 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, - 0x10, 0x00, 0x12, 0x06, 0x0a, 0x02, 0x54, 0x5a, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x53, 0x48, - 0x41, 0x32, 0x35, 0x36, 0x10, 0x02, 0x42, 0x50, 0x5a, 0x33, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, - 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, - 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x72, - 0x65, 0x66, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x72, 0x65, 0x66, 0x73, 0xaa, 0x02, 0x18, - 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, - 0x41, 0x50, 0x49, 0x2e, 0x52, 0x65, 0x66, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x75, 0x72, 0x65, 0x12, 0x37, 0x0a, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x0e, 0x32, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, + 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x63, + 0x68, 0x65, 0x6d, 0x65, 0x52, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x22, 0x4e, 0x0a, 0x08, + 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x12, 0x30, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, + 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, + 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x75, + 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x03, 0x73, 0x75, 0x6d, 0x2a, 0x4e, 0x0a, 0x0f, + 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x12, + 0x0f, 0x0a, 0x0b, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, + 0x12, 0x10, 0x0a, 0x0c, 0x45, 0x43, 0x44, 0x53, 0x41, 0x5f, 0x53, 0x48, 0x41, 0x35, 0x31, 0x32, + 0x10, 0x01, 0x12, 0x18, 0x0a, 0x14, 0x45, 0x43, 0x44, 0x53, 0x41, 0x5f, 0x52, 0x46, 0x43, 0x36, + 0x39, 0x37, 0x39, 0x5f, 0x53, 0x48, 0x41, 0x32, 0x35, 0x36, 0x10, 0x02, 0x2a, 0x41, 0x0a, 0x0c, + 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1d, 0x0a, 0x19, + 0x43, 0x48, 0x45, 0x43, 0x4b, 0x53, 0x55, 0x4d, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, + 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x06, 0x0a, 0x02, 0x54, + 0x5a, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x53, 0x48, 0x41, 0x32, 0x35, 0x36, 0x10, 0x02, 0x42, + 0x50, 0x5a, 0x33, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, + 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, + 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x72, 0x65, 0x66, 0x73, 0x2f, 0x67, 0x72, 0x70, + 0x63, 0x3b, 0x72, 0x65, 0x66, 0x73, 0xaa, 0x02, 0x18, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, + 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x52, 0x65, 0x66, + 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -618,28 +689,30 @@ func file_refs_grpc_types_proto_rawDescGZIP() []byte { return file_refs_grpc_types_proto_rawDescData } -var file_refs_grpc_types_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_refs_grpc_types_proto_enumTypes = make([]protoimpl.EnumInfo, 2) var file_refs_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 8) var file_refs_grpc_types_proto_goTypes = []interface{}{ - (ChecksumType)(0), // 0: neo.fs.v2.refs.ChecksumType - (*Address)(nil), // 1: neo.fs.v2.refs.Address - (*ObjectID)(nil), // 2: neo.fs.v2.refs.ObjectID - (*ContainerID)(nil), // 3: neo.fs.v2.refs.ContainerID - (*OwnerID)(nil), // 4: neo.fs.v2.refs.OwnerID - (*SubnetID)(nil), // 5: neo.fs.v2.refs.SubnetID - (*Version)(nil), // 6: neo.fs.v2.refs.Version - (*Signature)(nil), // 7: neo.fs.v2.refs.Signature - (*Checksum)(nil), // 8: neo.fs.v2.refs.Checksum + (SignatureScheme)(0), // 0: neo.fs.v2.refs.SignatureScheme + (ChecksumType)(0), // 1: neo.fs.v2.refs.ChecksumType + (*Address)(nil), // 2: neo.fs.v2.refs.Address + (*ObjectID)(nil), // 3: neo.fs.v2.refs.ObjectID + (*ContainerID)(nil), // 4: neo.fs.v2.refs.ContainerID + (*OwnerID)(nil), // 5: neo.fs.v2.refs.OwnerID + (*SubnetID)(nil), // 6: neo.fs.v2.refs.SubnetID + (*Version)(nil), // 7: neo.fs.v2.refs.Version + (*Signature)(nil), // 8: neo.fs.v2.refs.Signature + (*Checksum)(nil), // 9: neo.fs.v2.refs.Checksum } var file_refs_grpc_types_proto_depIdxs = []int32{ - 3, // 0: neo.fs.v2.refs.Address.container_id:type_name -> neo.fs.v2.refs.ContainerID - 2, // 1: neo.fs.v2.refs.Address.object_id:type_name -> neo.fs.v2.refs.ObjectID - 0, // 2: neo.fs.v2.refs.Checksum.type:type_name -> neo.fs.v2.refs.ChecksumType - 3, // [3:3] is the sub-list for method output_type - 3, // [3:3] is the sub-list for method input_type - 3, // [3:3] is the sub-list for extension type_name - 3, // [3:3] is the sub-list for extension extendee - 0, // [0:3] is the sub-list for field type_name + 4, // 0: neo.fs.v2.refs.Address.container_id:type_name -> neo.fs.v2.refs.ContainerID + 3, // 1: neo.fs.v2.refs.Address.object_id:type_name -> neo.fs.v2.refs.ObjectID + 0, // 2: neo.fs.v2.refs.Signature.scheme:type_name -> neo.fs.v2.refs.SignatureScheme + 1, // 3: neo.fs.v2.refs.Checksum.type:type_name -> neo.fs.v2.refs.ChecksumType + 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_refs_grpc_types_proto_init() } @@ -750,7 +823,7 @@ func file_refs_grpc_types_proto_init() { File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_refs_grpc_types_proto_rawDesc, - NumEnums: 1, + NumEnums: 2, NumMessages: 8, NumExtensions: 0, NumServices: 0, diff --git a/refs/marshal.go b/refs/marshal.go index 148ad58..c496221 100644 --- a/refs/marshal.go +++ b/refs/marshal.go @@ -19,8 +19,9 @@ const ( checksumTypeField = 1 checksumValueField = 2 - signatureKeyField = 1 - signatureValueField = 2 + signatureKeyField = 1 + signatureValueField = 2 + signatureSchemeField = 3 versionMajorField = 1 versionMinorField = 2 @@ -250,7 +251,14 @@ func (s *Signature) StableMarshal(buf []byte) ([]byte, error) { offset += n - _, err = proto.BytesMarshal(signatureValueField, buf[offset:], s.sign) + n, err = proto.BytesMarshal(signatureValueField, buf[offset:], s.sign) + if err != nil { + return nil, err + } + + offset += n + + _, err = proto.EnumMarshal(signatureSchemeField, buf[offset:], int32(s.scheme)) if err != nil { return nil, err } @@ -265,6 +273,7 @@ func (s *Signature) StableSize() (size int) { size += proto.BytesSize(signatureKeyField, s.key) size += proto.BytesSize(signatureValueField, s.sign) + size += proto.EnumSize(signatureSchemeField, int32(s.scheme)) return size } diff --git a/refs/string.go b/refs/string.go index b27e07f..1b98600 100644 --- a/refs/string.go +++ b/refs/string.go @@ -24,3 +24,24 @@ func (t *ChecksumType) FromString(s string) bool { return ok } + +// String returns string representation of SignatureScheme. +func (t SignatureScheme) String() string { + return refs.SignatureScheme(t).String() +} + +// FromString parses SignatureScheme from a string representation. +// It is a reverse action to String(). +// +// Returns true if s was parsed successfully. +func (t *SignatureScheme) FromString(s string) bool { + var g refs.SignatureScheme + + ok := g.FromString(s) + + if ok { + *t = SignatureScheme(g) + } + + return ok +} diff --git a/refs/test/generate.go b/refs/test/generate.go index 835f358..3912ffa 100644 --- a/refs/test/generate.go +++ b/refs/test/generate.go @@ -1,6 +1,8 @@ package refstest import ( + "math/rand" + "github.com/nspcc-dev/neofs-api-go/v2/refs" ) @@ -88,6 +90,7 @@ func GenerateSignature(empty bool) *refs.Signature { if !empty { m.SetKey([]byte{1}) m.SetSign([]byte{2}) + m.SetScheme(refs.SignatureScheme(rand.Int31() % 3)) } return m diff --git a/refs/types.go b/refs/types.go index cd7ba5d..93a814a 100644 --- a/refs/types.go +++ b/refs/types.go @@ -31,8 +31,17 @@ type Checksum struct { type ChecksumType uint32 +type SignatureScheme uint32 + +const ( + UnspecifiedScheme SignatureScheme = iota + ECDSA_SHA512 + ECDSA_RFC6979_SHA256 +) + type Signature struct { key, sign []byte + scheme SignatureScheme } type SubnetID struct { @@ -175,6 +184,19 @@ func (s *Signature) SetSign(v []byte) { } } +func (s *Signature) GetScheme() SignatureScheme { + if s != nil { + return s.scheme + } + return UnspecifiedScheme +} + +func (s *Signature) SetScheme(scheme SignatureScheme) { + if s != nil { + s.scheme = scheme + } +} + func (s *SubnetID) SetValue(id uint32) { if s != nil { s.value = id diff --git a/signature/sign.go b/signature/sign.go index 7054416..c954891 100644 --- a/signature/sign.go +++ b/signature/sign.go @@ -131,19 +131,6 @@ func (s StableMarshalerWrapper) SignedDataSize() int { return 0 } -func keySignatureHandler(s *refs.Signature) signature.KeySignatureHandler { - return func(key []byte, sig []byte) { - s.SetKey(key) - s.SetSign(sig) - } -} - -func keySignatureSource(s *refs.Signature) signature.KeySignatureSource { - return func() ([]byte, []byte) { - return s.GetKey(), s.GetSign() - } -} - func SignServiceMessage(key *ecdsa.PrivateKey, msg interface{}) error { var ( body, meta, verifyOrigin stableMarshaler @@ -213,7 +200,9 @@ func signServiceMessagePart(key *ecdsa.PrivateKey, part stableMarshaler, sigWrit if err := signature.SignDataWithHandler( key, &StableMarshalerWrapper{part}, - keySignatureHandler(sig), + func(s *refs.Signature) { + *sig = *s + }, ); err != nil { return err } @@ -285,7 +274,7 @@ func verifyMatryoshkaLevel(body stableMarshaler, meta metaHeader, verify verific func verifyServiceMessagePart(part stableMarshaler, sigRdr func() *refs.Signature) error { return signature.VerifyDataWithSource( &StableMarshalerWrapper{part}, - keySignatureSource(sigRdr()), + sigRdr, ) } diff --git a/util/signature/data.go b/util/signature/data.go index 00d591e..ee2d7ad 100644 --- a/util/signature/data.go +++ b/util/signature/data.go @@ -3,6 +3,7 @@ package signature import ( "crypto/ecdsa" + "github.com/nspcc-dev/neofs-api-go/v2/refs" crypto "github.com/nspcc-dev/neofs-crypto" ) @@ -13,24 +14,24 @@ type DataSource interface { type DataWithSignature interface { DataSource - GetSignatureWithKey() (key, sig []byte) - SetSignatureWithKey(key, sig []byte) + GetSignature() *refs.Signature + SetSignature(*refs.Signature) } type SignOption func(*cfg) -type KeySignatureHandler func(key []byte, sig []byte) +type KeySignatureHandler func(*refs.Signature) -type KeySignatureSource func() (key, sig []byte) +type KeySignatureSource func() *refs.Signature -func DataSignature(key *ecdsa.PrivateKey, src DataSource, opts ...SignOption) ([]byte, error) { +func SignDataWithHandler(key *ecdsa.PrivateKey, src DataSource, handler KeySignatureHandler, opts ...SignOption) error { if key == nil { - return nil, crypto.ErrEmptyPrivateKey + return crypto.ErrEmptyPrivateKey } data, err := dataForSignature(src) if err != nil { - return nil, err + return err } defer bytesPool.Put(data) @@ -40,16 +41,16 @@ func DataSignature(key *ecdsa.PrivateKey, src DataSource, opts ...SignOption) ([ opts[i](cfg) } - return cfg.signFunc(key, data) -} - -func SignDataWithHandler(key *ecdsa.PrivateKey, src DataSource, handler KeySignatureHandler, opts ...SignOption) error { - sig, err := DataSignature(key, src, opts...) + sigData, err := sign(cfg, cfg.defaultScheme, key, data) if err != nil { return err } - handler(crypto.MarshalPublicKey(&key.PublicKey), sig) + sig := new(refs.Signature) + sig.SetScheme(cfg.defaultScheme) + sig.SetKey(crypto.MarshalPublicKey(&key.PublicKey)) + sig.SetSign(sigData) + handler(sig) return nil } @@ -67,19 +68,13 @@ func VerifyDataWithSource(dataSrc DataSource, sigSrc KeySignatureSource, opts .. opts[i](cfg) } - key, sig := sigSrc() - - return cfg.verifyFunc( - crypto.UnmarshalPublicKey(key), - data, - sig, - ) + return verify(cfg, data, sigSrc()) } func SignData(key *ecdsa.PrivateKey, v DataWithSignature, opts ...SignOption) error { - return SignDataWithHandler(key, v, v.SetSignatureWithKey, opts...) + return SignDataWithHandler(key, v, v.SetSignature, opts...) } func VerifyData(src DataWithSignature, opts ...SignOption) error { - return VerifyDataWithSource(src, src.GetSignatureWithKey, opts...) + return VerifyDataWithSource(src, src.GetSignature, opts...) } diff --git a/util/signature/options.go b/util/signature/options.go index 16d6330..c77c290 100644 --- a/util/signature/options.go +++ b/util/signature/options.go @@ -2,25 +2,58 @@ package signature import ( "crypto/ecdsa" + "fmt" + "github.com/nspcc-dev/neofs-api-go/v2/refs" crypto "github.com/nspcc-dev/neofs-crypto" ) type cfg struct { - signFunc func(key *ecdsa.PrivateKey, msg []byte) ([]byte, error) - verifyFunc func(key *ecdsa.PublicKey, msg []byte, sig []byte) error + defaultScheme refs.SignatureScheme + restrictScheme refs.SignatureScheme } func defaultCfg() *cfg { return &cfg{ - signFunc: crypto.Sign, - verifyFunc: crypto.Verify, + defaultScheme: refs.ECDSA_SHA512, + restrictScheme: refs.UnspecifiedScheme, + } +} + +func verify(cfg *cfg, data []byte, sig *refs.Signature) error { + scheme := sig.GetScheme() + if scheme == refs.UnspecifiedScheme { + scheme = cfg.defaultScheme + } + if cfg.restrictScheme != refs.UnspecifiedScheme && scheme != cfg.restrictScheme { + return fmt.Errorf("%w: unexpected signature scheme", crypto.ErrInvalidSignature) + } + + pub := crypto.UnmarshalPublicKey(sig.GetKey()) + switch scheme { + case refs.ECDSA_SHA512: + return crypto.Verify(pub, data, sig.GetSign()) + case refs.ECDSA_RFC6979_SHA256: + return crypto.VerifyRFC6979(pub, data, sig.GetSign()) + default: + return crypto.ErrInvalidSignature + } +} + +func sign(cfg *cfg, scheme refs.SignatureScheme, key *ecdsa.PrivateKey, data []byte) ([]byte, error) { + switch scheme { + case refs.ECDSA_SHA512: + return crypto.Sign(key, data) + case refs.ECDSA_RFC6979_SHA256: + return crypto.SignRFC6979(key, data) + default: + panic("unsupported scheme") } } func SignWithRFC6979() SignOption { return func(c *cfg) { - c.signFunc = crypto.SignRFC6979 - c.verifyFunc = crypto.VerifyRFC6979 + c.defaultScheme = refs.ECDSA_RFC6979_SHA256 + c.restrictScheme = refs.ECDSA_RFC6979_SHA256 } } From 99370889d1aecfabf3bebbc2d843d920e9d2500a Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 21 Feb 2022 20:57:27 +0300 Subject: [PATCH 0960/1196] [#371] Support recent changes in NeoFS API protocol Support: * new status codes (object, container, session); * object `Lock` message; * different signature schemes. Signed-off-by: Leonard Lyubich --- accounting/grpc/service.pb.go | 2 +- accounting/grpc/service_grpc.pb.go | 4 + accounting/grpc/types.pb.go | 2 +- acl/grpc/types.pb.go | 2 +- audit/grpc/types.pb.go | 2 +- container/grpc/service.pb.go | 17 ++- container/grpc/service_grpc.pb.go | 76 +++++----- container/grpc/types.pb.go | 2 +- container/status.go | 28 ++++ container/status_test.go | 14 ++ lock/grpc/types.go | 8 ++ lock/grpc/types.pb.go | 158 ++++++++++++++++++++ netmap/grpc/service.pb.go | 2 +- netmap/grpc/service_grpc.pb.go | 4 + netmap/grpc/types.pb.go | 2 +- object/grpc/service.pb.go | 2 +- object/grpc/service_grpc.pb.go | 222 +++++++++++++++++++++++------ object/grpc/types.pb.go | 52 ++++--- object/lock.go | 170 ++++++++++++++++++++++ object/lock_test.go | 26 ++++ object/message_test.go | 1 + object/status.go | 87 +++++++++++ object/status_test.go | 34 +++++ object/test/generate.go | 14 ++ object/types.go | 1 + reputation/grpc/service.pb.go | 2 +- reputation/grpc/service_grpc.pb.go | 4 + reputation/grpc/types.pb.go | 2 +- session/grpc/service.pb.go | 2 +- session/grpc/service_grpc.pb.go | 4 + session/grpc/types.pb.go | 2 +- session/status.go | 31 ++++ session/status_test.go | 15 ++ status/grpc/types.pb.go | 219 ++++++++++++++++++++++++++-- status/status.go | 14 ++ status/test/codes.go | 28 ++++ status/types.go | 5 + storagegroup/grpc/types.pb.go | 2 +- subnet/grpc/types.pb.go | 2 +- tombstone/grpc/types.pb.go | 2 +- util/proto/test/test.pb.go | 2 +- 41 files changed, 1139 insertions(+), 129 deletions(-) create mode 100644 container/status.go create mode 100644 container/status_test.go create mode 100644 lock/grpc/types.go create mode 100644 lock/grpc/types.pb.go create mode 100644 object/lock.go create mode 100644 object/lock_test.go create mode 100644 object/status.go create mode 100644 object/status_test.go create mode 100644 session/status.go create mode 100644 session/status_test.go create mode 100644 status/test/codes.go diff --git a/accounting/grpc/service.pb.go b/accounting/grpc/service.pb.go index 82858c6..dbb27b1 100644 --- a/accounting/grpc/service.pb.go +++ b/accounting/grpc/service.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.1 -// protoc v3.19.1 +// protoc v3.19.4 // source: accounting/grpc/service.proto package accounting diff --git a/accounting/grpc/service_grpc.pb.go b/accounting/grpc/service_grpc.pb.go index 7139614..8ed1956 100644 --- a/accounting/grpc/service_grpc.pb.go +++ b/accounting/grpc/service_grpc.pb.go @@ -1,4 +1,8 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.2.0 +// - protoc v3.19.4 +// source: accounting/grpc/service.proto package accounting diff --git a/accounting/grpc/types.pb.go b/accounting/grpc/types.pb.go index 33df641..a36188b 100644 --- a/accounting/grpc/types.pb.go +++ b/accounting/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.1 -// protoc v3.19.1 +// protoc v3.19.4 // source: accounting/grpc/types.proto package accounting diff --git a/acl/grpc/types.pb.go b/acl/grpc/types.pb.go index f7b6734..e71a893 100644 --- a/acl/grpc/types.pb.go +++ b/acl/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.1 -// protoc v3.19.1 +// protoc v3.19.4 // source: acl/grpc/types.proto package acl diff --git a/audit/grpc/types.pb.go b/audit/grpc/types.pb.go index 3da71a8..64d3206 100644 --- a/audit/grpc/types.pb.go +++ b/audit/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.1 -// protoc v3.19.1 +// protoc v3.19.4 // source: audit/grpc/types.proto package audit diff --git a/container/grpc/service.pb.go b/container/grpc/service.pb.go index 4af3298..d7fa78e 100644 --- a/container/grpc/service.pb.go +++ b/container/grpc/service.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.1 -// protoc v3.19.1 +// protoc v3.19.4 // source: container/grpc/service.proto package container @@ -1016,7 +1016,8 @@ type PutRequest_Body struct { // Container structure to register in NeoFS Container *Container `protobuf:"bytes,1,opt,name=container,proto3" json:"container,omitempty"` - // Signature of a stable-marshalled container according to RFC-6979 + // Signature of a stable-marshalled container according to RFC-6979. + // Signature scheme must be either UNSPECIFIED or ECDSA_RFC6979_SHA256. Signature *grpc1.Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` } @@ -1128,7 +1129,8 @@ type DeleteRequest_Body struct { // Identifier of the container to delete from NeoFS ContainerId *grpc1.ContainerID `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` - // `ContainerID` signed with the container owner's key according to RFC-6979 + // `ContainerID` signed with the container owner's key according to RFC-6979. + // Signature scheme must be either UNSPECIFIED or ECDSA_RFC6979_SHA256. Signature *grpc1.Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` } @@ -1276,7 +1278,8 @@ type GetResponse_Body struct { // Requested container structure Container *Container `protobuf:"bytes,1,opt,name=container,proto3" json:"container,omitempty"` - // Signature of a stable-marshalled container according to RFC-6979 + // Signature of a stable-marshalled container according to RFC-6979. + // Signature scheme must be either UNSPECIFIED or ECDSA_RFC6979_SHA256. Signature *grpc1.Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` // Session token if the container was created within a session SessionToken *grpc.SessionToken `protobuf:"bytes,3,opt,name=session_token,json=sessionToken,proto3" json:"session_token,omitempty"` @@ -1442,7 +1445,8 @@ type SetExtendedACLRequest_Body struct { // Extended ACL table to set for container Eacl *grpc2.EACLTable `protobuf:"bytes,1,opt,name=eacl,proto3" json:"eacl,omitempty"` - // Signature of stable-marshalled Extended ACL table according to RFC-6979 + // Signature of stable-marshalled Extended ACL table according to RFC-6979. + // Signature scheme must be either UNSPECIFIED or ECDSA_RFC6979_SHA256. Signature *grpc1.Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` } @@ -1592,7 +1596,8 @@ type GetExtendedACLResponse_Body struct { // Extended ACL requested, if available Eacl *grpc2.EACLTable `protobuf:"bytes,1,opt,name=eacl,proto3" json:"eacl,omitempty"` - // Signature of stable-marshalled Extended ACL according to RFC-6979 + // Signature of stable-marshalled Extended ACL according to RFC-6979. + // Signature scheme must be either UNSPECIFIED or ECDSA_RFC6979_SHA256. Signature *grpc1.Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` // Session token if Extended ACL was set within a session SessionToken *grpc.SessionToken `protobuf:"bytes,3,opt,name=session_token,json=sessionToken,proto3" json:"session_token,omitempty"` diff --git a/container/grpc/service_grpc.pb.go b/container/grpc/service_grpc.pb.go index cbac355..cf9c435 100644 --- a/container/grpc/service_grpc.pb.go +++ b/container/grpc/service_grpc.pb.go @@ -1,4 +1,8 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.2.0 +// - protoc v3.19.4 +// source: container/grpc/service.proto package container @@ -24,8 +28,8 @@ type ContainerServiceClient interface { // is added into smart contract storage. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): - // request to save the container has been sent to the sidechain; + // - **OK** (0, SECTION_SUCCESS): \ + // request to save the container has been sent to the sidechain; // - Common failures (SECTION_FAILURE_COMMON). Put(ctx context.Context, in *PutRequest, opts ...grpc.CallOption) (*PutResponse, error) // `Delete` invokes `Container` smart contract's `Delete` method and returns @@ -34,22 +38,24 @@ type ContainerServiceClient interface { // is added into smart contract storage. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): - // request to remove the container has been sent to the sidechain; + // - **OK** (0, SECTION_SUCCESS): \ + // request to remove the container has been sent to the sidechain; // - Common failures (SECTION_FAILURE_COMMON). 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). + // - **OK** (0, SECTION_SUCCESS): \ + // container has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON); + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // requested container not found. Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*GetResponse, error) // Returns all owner's containers from 'Container` smart contract' storage. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): - // container list has been successfully read; + // - **OK** (0, SECTION_SUCCESS): \ + // container list has been successfully read; // - Common failures (SECTION_FAILURE_COMMON). List(ctx context.Context, in *ListRequest, opts ...grpc.CallOption) (*ListResponse, error) // Invokes 'SetEACL' method of 'Container` smart contract and returns response @@ -57,23 +63,25 @@ type ContainerServiceClient interface { // added into smart contract storage. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): - // request to save container eACL has been sent to the sidechain; + // - **OK** (0, SECTION_SUCCESS): \ + // request to save container eACL has been sent to the sidechain; // - Common failures (SECTION_FAILURE_COMMON). SetExtendedACL(ctx context.Context, in *SetExtendedACLRequest, opts ...grpc.CallOption) (*SetExtendedACLResponse, error) // Returns Extended ACL table and signature from `Container` smart contract // storage. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): - // container eACL has been successfully read; - // - Common failures (SECTION_FAILURE_COMMON). + // - **OK** (0, SECTION_SUCCESS): \ + // container eACL has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON); + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // container not found. GetExtendedACL(ctx context.Context, in *GetExtendedACLRequest, opts ...grpc.CallOption) (*GetExtendedACLResponse, error) // Announce container used space values for P2P synchronization. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): - // estimation of used space has been successfully announced; + // - **OK** (0, SECTION_SUCCESS): \ + // estimation of used space has been successfully announced; // - Common failures (SECTION_FAILURE_COMMON). AnnounceUsedSpace(ctx context.Context, in *AnnounceUsedSpaceRequest, opts ...grpc.CallOption) (*AnnounceUsedSpaceResponse, error) } @@ -159,8 +167,8 @@ type ContainerServiceServer interface { // is added into smart contract storage. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): - // request to save the container has been sent to the sidechain; + // - **OK** (0, SECTION_SUCCESS): \ + // request to save the container has been sent to the sidechain; // - Common failures (SECTION_FAILURE_COMMON). Put(context.Context, *PutRequest) (*PutResponse, error) // `Delete` invokes `Container` smart contract's `Delete` method and returns @@ -169,22 +177,24 @@ type ContainerServiceServer interface { // is added into smart contract storage. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): - // request to remove the container has been sent to the sidechain; + // - **OK** (0, SECTION_SUCCESS): \ + // request to remove the container has been sent to the sidechain; // - Common failures (SECTION_FAILURE_COMMON). 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). + // - **OK** (0, SECTION_SUCCESS): \ + // container has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON); + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // requested container not found. Get(context.Context, *GetRequest) (*GetResponse, error) // Returns all owner's containers from 'Container` smart contract' storage. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): - // container list has been successfully read; + // - **OK** (0, SECTION_SUCCESS): \ + // container list has been successfully read; // - Common failures (SECTION_FAILURE_COMMON). List(context.Context, *ListRequest) (*ListResponse, error) // Invokes 'SetEACL' method of 'Container` smart contract and returns response @@ -192,23 +202,25 @@ type ContainerServiceServer interface { // added into smart contract storage. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): - // request to save container eACL has been sent to the sidechain; + // - **OK** (0, SECTION_SUCCESS): \ + // request to save container eACL has been sent to the sidechain; // - Common failures (SECTION_FAILURE_COMMON). SetExtendedACL(context.Context, *SetExtendedACLRequest) (*SetExtendedACLResponse, error) // Returns Extended ACL table and signature from `Container` smart contract // storage. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): - // container eACL has been successfully read; - // - Common failures (SECTION_FAILURE_COMMON). + // - **OK** (0, SECTION_SUCCESS): \ + // container eACL has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON); + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // container not found. GetExtendedACL(context.Context, *GetExtendedACLRequest) (*GetExtendedACLResponse, error) // Announce container used space values for P2P synchronization. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): - // estimation of used space has been successfully announced; + // - **OK** (0, SECTION_SUCCESS): \ + // estimation of used space has been successfully announced; // - Common failures (SECTION_FAILURE_COMMON). AnnounceUsedSpace(context.Context, *AnnounceUsedSpaceRequest) (*AnnounceUsedSpaceResponse, error) } diff --git a/container/grpc/types.pb.go b/container/grpc/types.pb.go index 7cb6be5..3e2ed0d 100644 --- a/container/grpc/types.pb.go +++ b/container/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.1 -// protoc v3.19.1 +// protoc v3.19.4 // source: container/grpc/types.proto package container diff --git a/container/status.go b/container/status.go new file mode 100644 index 0000000..0535716 --- /dev/null +++ b/container/status.go @@ -0,0 +1,28 @@ +package container + +import ( + "github.com/nspcc-dev/neofs-api-go/v2/status" + statusgrpc "github.com/nspcc-dev/neofs-api-go/v2/status/grpc" +) + +// LocalizeFailStatus checks if passed global status.Code is related to container failure and: +// then localizes the code and returns true, +// else leaves the code unchanged and returns false. +// +// Arg must not be nil. +func LocalizeFailStatus(c *status.Code) bool { + return status.LocalizeIfInSection(c, uint32(statusgrpc.Section_SECTION_CONTAINER)) +} + +// GlobalizeFail globalizes local code of container failure. +// +// Arg must not be nil. +func GlobalizeFail(c *status.Code) { + c.GlobalizeSection(uint32(statusgrpc.Section_SECTION_CONTAINER)) +} + +const ( + // StatusNotFound is a local status.Code value for + // CONTAINER_NOT_FOUND container failure. + StatusNotFound status.Code = iota +) diff --git a/container/status_test.go b/container/status_test.go new file mode 100644 index 0000000..0826d8a --- /dev/null +++ b/container/status_test.go @@ -0,0 +1,14 @@ +package container_test + +import ( + "testing" + + "github.com/nspcc-dev/neofs-api-go/v2/container" + statustest "github.com/nspcc-dev/neofs-api-go/v2/status/test" +) + +func TestStatusCodes(t *testing.T) { + statustest.TestCodes(t, container.LocalizeFailStatus, container.GlobalizeFail, + container.StatusNotFound, 3072, + ) +} diff --git a/lock/grpc/types.go b/lock/grpc/types.go new file mode 100644 index 0000000..f10684c --- /dev/null +++ b/lock/grpc/types.go @@ -0,0 +1,8 @@ +package lock + +import refs "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" + +// SetMembers sets `members` field. +func (x *Lock) SetMembers(ids []*refs.ObjectID) { + x.Members = ids +} diff --git a/lock/grpc/types.pb.go b/lock/grpc/types.pb.go new file mode 100644 index 0000000..046249d --- /dev/null +++ b/lock/grpc/types.pb.go @@ -0,0 +1,158 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.1 +// protoc v3.19.4 +// source: lock/grpc/types.proto + +package lock + +import ( + grpc "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +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. Lifetime of the +// lock object is limited similar to regular objects in +// `__NEOFS__EXPIRATION_EPOCH` attribute. +type Lock struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // 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,proto3" json:"members,omitempty"` +} + +func (x *Lock) Reset() { + *x = Lock{} + if protoimpl.UnsafeEnabled { + mi := &file_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_lock_grpc_types_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Lock.ProtoReflect.Descriptor instead. +func (*Lock) Descriptor() ([]byte, []int) { + return file_lock_grpc_types_proto_rawDescGZIP(), []int{0} +} + +func (x *Lock) GetMembers() []*grpc.ObjectID { + if x != nil { + return x.Members + } + return nil +} + +var File_lock_grpc_types_proto protoreflect.FileDescriptor + +var file_lock_grpc_types_proto_rawDesc = []byte{ + 0x0a, 0x15, 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, 0x15, 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, 0x50, 0x5a, 0x33, 0x67, 0x69, + 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, + 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, + 0x76, 0x32, 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, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_lock_grpc_types_proto_rawDescOnce sync.Once + file_lock_grpc_types_proto_rawDescData = file_lock_grpc_types_proto_rawDesc +) + +func file_lock_grpc_types_proto_rawDescGZIP() []byte { + file_lock_grpc_types_proto_rawDescOnce.Do(func() { + file_lock_grpc_types_proto_rawDescData = protoimpl.X.CompressGZIP(file_lock_grpc_types_proto_rawDescData) + }) + return file_lock_grpc_types_proto_rawDescData +} + +var file_lock_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_lock_grpc_types_proto_goTypes = []interface{}{ + (*Lock)(nil), // 0: neo.fs.v2.lock.Lock + (*grpc.ObjectID)(nil), // 1: neo.fs.v2.refs.ObjectID +} +var file_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_lock_grpc_types_proto_init() } +func file_lock_grpc_types_proto_init() { + if File_lock_grpc_types_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_lock_grpc_types_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Lock); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_lock_grpc_types_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_lock_grpc_types_proto_goTypes, + DependencyIndexes: file_lock_grpc_types_proto_depIdxs, + MessageInfos: file_lock_grpc_types_proto_msgTypes, + }.Build() + File_lock_grpc_types_proto = out.File + file_lock_grpc_types_proto_rawDesc = nil + file_lock_grpc_types_proto_goTypes = nil + file_lock_grpc_types_proto_depIdxs = nil +} diff --git a/netmap/grpc/service.pb.go b/netmap/grpc/service.pb.go index 3f407d7..670afc7 100644 --- a/netmap/grpc/service.pb.go +++ b/netmap/grpc/service.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.1 -// protoc v3.19.1 +// protoc v3.19.4 // source: netmap/grpc/service.proto package netmap diff --git a/netmap/grpc/service_grpc.pb.go b/netmap/grpc/service_grpc.pb.go index babf2e7..e8e5be4 100644 --- a/netmap/grpc/service_grpc.pb.go +++ b/netmap/grpc/service_grpc.pb.go @@ -1,4 +1,8 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.2.0 +// - protoc v3.19.4 +// source: netmap/grpc/service.proto package netmap diff --git a/netmap/grpc/types.pb.go b/netmap/grpc/types.pb.go index 7c44efd..4f7b976 100644 --- a/netmap/grpc/types.pb.go +++ b/netmap/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.1 -// protoc v3.19.1 +// protoc v3.19.4 // source: netmap/grpc/types.proto package netmap diff --git a/object/grpc/service.pb.go b/object/grpc/service.pb.go index 0a34a84..f75b580 100644 --- a/object/grpc/service.pb.go +++ b/object/grpc/service.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.1 -// protoc v3.19.1 +// protoc v3.19.4 // source: object/grpc/service.proto package object diff --git a/object/grpc/service_grpc.pb.go b/object/grpc/service_grpc.pb.go index 4a2ea28..376d95d 100644 --- a/object/grpc/service_grpc.pb.go +++ b/object/grpc/service_grpc.pb.go @@ -1,4 +1,8 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.2.0 +// - protoc v3.19.4 +// source: object/grpc/service.proto package object @@ -26,9 +30,19 @@ type ObjectServiceClient interface { // keeping receiving order. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): - // object has been successfully read; - // - Common failures (SECTION_FAILURE_COMMON). + // - **OK** (0, SECTION_SUCCESS): \ + // object has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON); + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // object container not found; + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // read access to the object is denied; + // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ + // object not found in container; + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired; + // - **OBJECT_ALREADY_REMOVED** (2052, SECTION_OBJECT): \ + // the requested object has been marked as deleted. Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (ObjectService_GetClient, error) // Put the object into container. Request uses gRPC stream. First message // SHOULD be of PutHeader type. `ContainerID` and `OwnerID` of an object @@ -38,35 +52,74 @@ type ObjectServiceClient interface { // Chunk messages SHOULD be sent in direct order of fragmentation. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): - // object has been successfully saved in the container; - // - Common failures (SECTION_FAILURE_COMMON). + // - **OK** (0, SECTION_SUCCESS): \ + // object has been successfully saved in the container; + // - Common failures (SECTION_FAILURE_COMMON); + // - **LOCKED** (2050, SECTION_OBJECT): \ + // placement of an object of type TOMBSTONE that includes at least one locked + // object is prohibited; + // - **LOCK_NON_REGULAR_OBJECT** (2051, SECTION_OBJECT): \ + // placement of an object of type LOCK that includes at least one object of + // type other than REGULAR is prohibited; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // object storage container not found; + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // write access to the container is denied; + // - **TOKEN_NOT_FOUND** (4096, SECTION_SESSION): \ + // (for trusted object preparation) session private key does not exist or has + // been deleted; + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. Put(ctx context.Context, opts ...grpc.CallOption) (ObjectService_PutClient, error) // Delete the object from a container. There is no immediate removal // guarantee. Object will be marked for removal and deleted eventually. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): - // object has been successfully marked to be removed from the container; - // - Common failures (SECTION_FAILURE_COMMON). + // - **OK** (0, SECTION_SUCCESS): \ + // object has been successfully marked to be removed from the container; + // - Common failures (SECTION_FAILURE_COMMON); + // - **LOCKED** (2050, SECTION_OBJECT): \ + // deleting a locked object is prohibited; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // object container not found; + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // delete access to the object is denied; + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteResponse, error) // Returns the object Headers without data payload. By default full header is // returned. If `main_only` request field is set, the short header with only // the very minimal information would be returned instead. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): - // object header has been successfully read; - // - Common failures (SECTION_FAILURE_COMMON). + // - **OK** (0, SECTION_SUCCESS): \ + // object header has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON); + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // object container not found; + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // access to operation HEAD of the object is denied; + // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ + // object not found in container; + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired; + // - **OBJECT_ALREADY_REMOVED** (2052, SECTION_OBJECT): \ + // the requested object has been marked as deleted. Head(ctx context.Context, in *HeadRequest, opts ...grpc.CallOption) (*HeadResponse, error) // Search objects in container. Search query allows to match by Object // Header's filed values. Please see the corresponding NeoFS Technical // Specification section for more details. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): - // objects have been successfully selected; - // - Common failures (SECTION_FAILURE_COMMON). + // - **OK** (0, SECTION_SUCCESS): \ + // objects have been successfully selected; + // - Common failures (SECTION_FAILURE_COMMON); + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // search container not found; + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // access to operation SEARCH of the object is denied; + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. Search(ctx context.Context, in *SearchRequest, opts ...grpc.CallOption) (ObjectService_SearchClient, error) // Get byte range of data payload. Range is set as an (offset, length) tuple. // Like in `Get` method, the response uses gRPC stream. Requested range can be @@ -74,9 +127,19 @@ type ObjectServiceClient interface { // order. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): - // data range of the object payload has been successfully read; - // - Common failures (SECTION_FAILURE_COMMON). + // - **OK** (0, SECTION_SUCCESS): \ + // data range of the object payload has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON); + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // object container not found; + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // access to operation RANGE of the object is denied; + // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ + // object not found in container; + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired; + // - **OBJECT_ALREADY_REMOVED** (2052, SECTION_OBJECT): \ + // the requested object has been marked as deleted. GetRange(ctx context.Context, in *GetRangeRequest, opts ...grpc.CallOption) (ObjectService_GetRangeClient, error) // Returns homomorphic or regular hash of object's payload range after // applying XOR operation with the provided `salt`. Ranges are set of (offset, @@ -84,9 +147,17 @@ type ObjectServiceClient interface { // request. Note that hash is calculated for XORed data. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): - // data range of the object payload has been successfully hashed; - // - Common failures (SECTION_FAILURE_COMMON). + // - **OK** (0, SECTION_SUCCESS): \ + // data range of the object payload has been successfully hashed; + // - Common failures (SECTION_FAILURE_COMMON); + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // object container not found; + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // access to operation RANGEHASH of the object is denied; + // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ + // object not found in container; + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. GetRangeHash(ctx context.Context, in *GetRangeHashRequest, opts ...grpc.CallOption) (*GetRangeHashResponse, error) } @@ -267,9 +338,19 @@ type ObjectServiceServer interface { // keeping receiving order. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): - // object has been successfully read; - // - Common failures (SECTION_FAILURE_COMMON). + // - **OK** (0, SECTION_SUCCESS): \ + // object has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON); + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // object container not found; + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // read access to the object is denied; + // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ + // object not found in container; + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired; + // - **OBJECT_ALREADY_REMOVED** (2052, SECTION_OBJECT): \ + // the requested object has been marked as deleted. Get(*GetRequest, ObjectService_GetServer) error // Put the object into container. Request uses gRPC stream. First message // SHOULD be of PutHeader type. `ContainerID` and `OwnerID` of an object @@ -279,35 +360,74 @@ type ObjectServiceServer interface { // Chunk messages SHOULD be sent in direct order of fragmentation. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): - // object has been successfully saved in the container; - // - Common failures (SECTION_FAILURE_COMMON). + // - **OK** (0, SECTION_SUCCESS): \ + // object has been successfully saved in the container; + // - Common failures (SECTION_FAILURE_COMMON); + // - **LOCKED** (2050, SECTION_OBJECT): \ + // placement of an object of type TOMBSTONE that includes at least one locked + // object is prohibited; + // - **LOCK_NON_REGULAR_OBJECT** (2051, SECTION_OBJECT): \ + // placement of an object of type LOCK that includes at least one object of + // type other than REGULAR is prohibited; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // object storage container not found; + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // write access to the container is denied; + // - **TOKEN_NOT_FOUND** (4096, SECTION_SESSION): \ + // (for trusted object preparation) session private key does not exist or has + // been deleted; + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. Put(ObjectService_PutServer) error // Delete the object from a container. There is no immediate removal // guarantee. Object will be marked for removal and deleted eventually. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): - // object has been successfully marked to be removed from the container; - // - Common failures (SECTION_FAILURE_COMMON). + // - **OK** (0, SECTION_SUCCESS): \ + // object has been successfully marked to be removed from the container; + // - Common failures (SECTION_FAILURE_COMMON); + // - **LOCKED** (2050, SECTION_OBJECT): \ + // deleting a locked object is prohibited; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // object container not found; + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // delete access to the object is denied; + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. Delete(context.Context, *DeleteRequest) (*DeleteResponse, error) // Returns the object Headers without data payload. By default full header is // returned. If `main_only` request field is set, the short header with only // the very minimal information would be returned instead. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): - // object header has been successfully read; - // - Common failures (SECTION_FAILURE_COMMON). + // - **OK** (0, SECTION_SUCCESS): \ + // object header has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON); + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // object container not found; + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // access to operation HEAD of the object is denied; + // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ + // object not found in container; + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired; + // - **OBJECT_ALREADY_REMOVED** (2052, SECTION_OBJECT): \ + // the requested object has been marked as deleted. Head(context.Context, *HeadRequest) (*HeadResponse, error) // Search objects in container. Search query allows to match by Object // Header's filed values. Please see the corresponding NeoFS Technical // Specification section for more details. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): - // objects have been successfully selected; - // - Common failures (SECTION_FAILURE_COMMON). + // - **OK** (0, SECTION_SUCCESS): \ + // objects have been successfully selected; + // - Common failures (SECTION_FAILURE_COMMON); + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // search container not found; + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // access to operation SEARCH of the object is denied; + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. Search(*SearchRequest, ObjectService_SearchServer) error // Get byte range of data payload. Range is set as an (offset, length) tuple. // Like in `Get` method, the response uses gRPC stream. Requested range can be @@ -315,9 +435,19 @@ type ObjectServiceServer interface { // order. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): - // data range of the object payload has been successfully read; - // - Common failures (SECTION_FAILURE_COMMON). + // - **OK** (0, SECTION_SUCCESS): \ + // data range of the object payload has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON); + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // object container not found; + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // access to operation RANGE of the object is denied; + // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ + // object not found in container; + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired; + // - **OBJECT_ALREADY_REMOVED** (2052, SECTION_OBJECT): \ + // the requested object has been marked as deleted. GetRange(*GetRangeRequest, ObjectService_GetRangeServer) error // Returns homomorphic or regular hash of object's payload range after // applying XOR operation with the provided `salt`. Ranges are set of (offset, @@ -325,9 +455,17 @@ type ObjectServiceServer interface { // request. Note that hash is calculated for XORed data. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): - // data range of the object payload has been successfully hashed; - // - Common failures (SECTION_FAILURE_COMMON). + // - **OK** (0, SECTION_SUCCESS): \ + // data range of the object payload has been successfully hashed; + // - Common failures (SECTION_FAILURE_COMMON); + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // object container not found; + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // access to operation RANGEHASH of the object is denied; + // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ + // object not found in container; + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. GetRangeHash(context.Context, *GetRangeHashRequest) (*GetRangeHashResponse, error) } diff --git a/object/grpc/types.pb.go b/object/grpc/types.pb.go index 210977c..6263a06 100644 --- a/object/grpc/types.pb.go +++ b/object/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.1 -// protoc v3.19.1 +// protoc v3.19.4 // source: object/grpc/types.proto package object @@ -23,13 +23,14 @@ const ( ) // Type of the object payload content. Only `REGULAR` type objects can be split, -// hence `TOMBSTONE` and `STORAGE_GROUP` payload is limited by maximal object -// size. +// hence `TOMBSTONE`, `STORAGE_GROUP` and `LOCK` payload is limited by maximal +// object size. // // String presentation of object type is the same as definition: // * REGULAR // * TOMBSTONE // * STORAGE_GROUP +// * LOCK type ObjectType int32 const ( @@ -39,6 +40,8 @@ const ( ObjectType_TOMBSTONE ObjectType = 1 // StorageGroup information ObjectType_STORAGE_GROUP ObjectType = 2 + // Object lock + ObjectType_LOCK ObjectType = 3 ) // Enum value maps for ObjectType. @@ -47,11 +50,13 @@ var ( 0: "REGULAR", 1: "TOMBSTONE", 2: "STORAGE_GROUP", + 3: "LOCK", } ObjectType_value = map[string]int32{ "REGULAR": 0, "TOMBSTONE": 1, "STORAGE_GROUP": 2, + "LOCK": 3, } ) @@ -393,6 +398,9 @@ func (x *Header) GetSplit() *Header_Split { // Object structure. Object is immutable and content-addressed. It means // `ObjectID` will change if header or payload changes. It's calculated as a // hash of header field, which contains hash of object's payload. +// +// For non-regular object types payload format depends on object type specified +// in the header. type Object struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -555,6 +563,13 @@ func (x *SplitInfo) GetLink() *grpc.ObjectID { // Marks smaller parts of a split bigger object // * __NEOFS__EXPIRATION_EPOCH \ // Tells GC to delete object after that epoch +// * __NEOFS__TICK_EPOCH \ +// Decimal number that defines what epoch must produce +// object notification with UTF-8 object address in a +// body (`0` value produces notification right after +// object put) +// * __NEOFS__TICK_TOPIC \ +// UTF-8 string topic ID that is used for object notification // // And some well-known attributes used by applications only: // @@ -843,24 +858,25 @@ var file_object_grpc_types_proto_rawDesc = []byte{ 0x61, 0x73, 0x74, 0x50, 0x61, 0x72, 0x74, 0x12, 0x2c, 0x0a, 0x04, 0x6c, 0x69, 0x6e, 0x6b, 0x18, 0x03, 0x20, 0x01, 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, - 0x04, 0x6c, 0x69, 0x6e, 0x6b, 0x2a, 0x3b, 0x0a, 0x0a, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x54, + 0x04, 0x6c, 0x69, 0x6e, 0x6b, 0x2a, 0x45, 0x0a, 0x0a, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x52, 0x45, 0x47, 0x55, 0x4c, 0x41, 0x52, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x54, 0x4f, 0x4d, 0x42, 0x53, 0x54, 0x4f, 0x4e, 0x45, 0x10, 0x01, 0x12, 0x11, 0x0a, 0x0d, 0x53, 0x54, 0x4f, 0x52, 0x41, 0x47, 0x45, 0x5f, 0x47, 0x52, 0x4f, 0x55, 0x50, - 0x10, 0x02, 0x2a, 0x73, 0x0a, 0x09, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x54, 0x79, 0x70, 0x65, 0x12, - 0x1a, 0x0a, 0x16, 0x4d, 0x41, 0x54, 0x43, 0x48, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, - 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x10, 0x0a, 0x0c, 0x53, - 0x54, 0x52, 0x49, 0x4e, 0x47, 0x5f, 0x45, 0x51, 0x55, 0x41, 0x4c, 0x10, 0x01, 0x12, 0x14, 0x0a, - 0x10, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x45, 0x51, 0x55, 0x41, - 0x4c, 0x10, 0x02, 0x12, 0x0f, 0x0a, 0x0b, 0x4e, 0x4f, 0x54, 0x5f, 0x50, 0x52, 0x45, 0x53, 0x45, - 0x4e, 0x54, 0x10, 0x03, 0x12, 0x11, 0x0a, 0x0d, 0x43, 0x4f, 0x4d, 0x4d, 0x4f, 0x4e, 0x5f, 0x50, - 0x52, 0x45, 0x46, 0x49, 0x58, 0x10, 0x04, 0x42, 0x56, 0x5a, 0x37, 0x67, 0x69, 0x74, 0x68, 0x75, - 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, - 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, - 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x6f, 0x62, 0x6a, 0x65, - 0x63, 0x74, 0xaa, 0x02, 0x1a, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, - 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x10, 0x02, 0x12, 0x08, 0x0a, 0x04, 0x4c, 0x4f, 0x43, 0x4b, 0x10, 0x03, 0x2a, 0x73, 0x0a, 0x09, + 0x4d, 0x61, 0x74, 0x63, 0x68, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1a, 0x0a, 0x16, 0x4d, 0x41, 0x54, + 0x43, 0x48, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, + 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x10, 0x0a, 0x0c, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x5f, + 0x45, 0x51, 0x55, 0x41, 0x4c, 0x10, 0x01, 0x12, 0x14, 0x0a, 0x10, 0x53, 0x54, 0x52, 0x49, 0x4e, + 0x47, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x45, 0x51, 0x55, 0x41, 0x4c, 0x10, 0x02, 0x12, 0x0f, 0x0a, + 0x0b, 0x4e, 0x4f, 0x54, 0x5f, 0x50, 0x52, 0x45, 0x53, 0x45, 0x4e, 0x54, 0x10, 0x03, 0x12, 0x11, + 0x0a, 0x0d, 0x43, 0x4f, 0x4d, 0x4d, 0x4f, 0x4e, 0x5f, 0x50, 0x52, 0x45, 0x46, 0x49, 0x58, 0x10, + 0x04, 0x42, 0x56, 0x5a, 0x37, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, + 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, + 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, + 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0xaa, 0x02, 0x1a, 0x4e, + 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, + 0x50, 0x49, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, } var ( diff --git a/object/lock.go b/object/lock.go new file mode 100644 index 0000000..660c002 --- /dev/null +++ b/object/lock.go @@ -0,0 +1,170 @@ +package object + +import ( + "errors" + "fmt" + + lock "github.com/nspcc-dev/neofs-api-go/v2/lock/grpc" + "github.com/nspcc-dev/neofs-api-go/v2/refs" + refsGRPC "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" + "github.com/nspcc-dev/neofs-api-go/v2/rpc/grpc" + "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" + "github.com/nspcc-dev/neofs-api-go/v2/util/proto" +) + +// Lock represents object Lock message from NeoFS API V2 protocol. +type Lock struct { + members []refs.ObjectID +} + +// NumberOfMembers returns length of lock list. +func (x *Lock) NumberOfMembers() int { + if x != nil { + return len(x.members) + } + + return 0 +} + +// IterateMembers passes members of the lock list to f. +func (x *Lock) IterateMembers(f func(refs.ObjectID)) { + if x != nil { + for i := range x.members { + f(x.members[i]) + } + } +} + +// SetMembers sets list of locked members. +// Arg must not be mutated for the duration of the Lock. +func (x *Lock) SetMembers(ids []refs.ObjectID) { + x.members = ids +} + +const ( + _ = iota + fNumLockMembers +) + +// StableMarshal encodes the Lock into Protocol Buffers binary format +// with direct field order. +func (x *Lock) StableMarshal(buf []byte) ([]byte, error) { + if x == nil || len(x.members) == 0 { + return []byte{}, nil + } + + if buf == nil { + buf = make([]byte, x.StableSize()) + } + + var offset, n int + var err error + + for i := range x.members { + n, err = proto.NestedStructureMarshal(fNumLockMembers, buf[offset:], &x.members[i]) + if err != nil { + return nil, err + } + + offset += n + } + + return buf, nil +} + +// StableSize size of the buffer required to write the Lock in Protocol Buffers +// binary format. +func (x *Lock) StableSize() (sz int) { + if x != nil { + for i := range x.members { + sz += proto.NestedStructureSize(fNumLockMembers, &x.members[i]) + } + } + + return +} + +// Unmarshal decodes the Lock from its Protocol Buffers binary format. +func (x *Lock) Unmarshal(data []byte) error { + return message.Unmarshal(x, data, new(lock.Lock)) +} + +func (x *Lock) ToGRPCMessage() grpc.Message { + var m *lock.Lock + + if x != nil { + m = new(lock.Lock) + + var members []*refsGRPC.ObjectID + + if x.members != nil { + members = make([]*refsGRPC.ObjectID, len(x.members)) + + for i := range x.members { + members[i] = x.members[i].ToGRPCMessage().(*refsGRPC.ObjectID) + } + } + + m.SetMembers(members) + } + + return m +} + +func (x *Lock) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*lock.Lock) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + members := v.GetMembers() + if members == nil { + x.members = nil + } else { + x.members = make([]refs.ObjectID, len(members)) + var err error + + for i := range x.members { + err = x.members[i].FromGRPCMessage(members[i]) + if err != nil { + return err + } + } + } + + return nil +} + +// WriteLock writes Lock to the Object as a payload content. +// The object must not be nil. +func WriteLock(obj *Object, lock Lock) { + hdr := obj.GetHeader() + if hdr == nil { + hdr = new(Header) + obj.SetHeader(hdr) + } + + hdr.SetObjectType(TypeLock) + + payload, err := lock.StableMarshal(nil) + if err != nil { + panic(fmt.Sprintf("encode lock content: %v", err)) + } + + obj.SetPayload(payload) +} + +// ReadLock reads Lock from the Object payload content. +func ReadLock(lock *Lock, obj Object) error { + payload := obj.GetPayload() + if len(payload) == 0 { + return errors.New("empty payload") + } + + err := lock.Unmarshal(payload) + if err != nil { + return fmt.Errorf("decode lock content from payload: %w", err) + } + + return nil +} diff --git a/object/lock_test.go b/object/lock_test.go new file mode 100644 index 0000000..17e9e46 --- /dev/null +++ b/object/lock_test.go @@ -0,0 +1,26 @@ +package object_test + +import ( + "testing" + + "github.com/nspcc-dev/neofs-api-go/v2/object" + objecttest "github.com/nspcc-dev/neofs-api-go/v2/object/test" + "github.com/stretchr/testify/require" +) + +func TestLockRW(t *testing.T) { + var l object.Lock + var obj object.Object + + require.Error(t, object.ReadLock(&l, obj)) + + l = *objecttest.GenerateLock(false) + + object.WriteLock(&obj, l) + + var l2 object.Lock + + require.NoError(t, object.ReadLock(&l2, obj)) + + require.Equal(t, l, l2) +} diff --git a/object/message_test.go b/object/message_test.go index 145c22c..98461df 100644 --- a/object/message_test.go +++ b/object/message_test.go @@ -50,5 +50,6 @@ func TestMessageConvert(t *testing.T) { func(empty bool) message.Message { return objecttest.GenerateGetRangeHashRequest(empty) }, func(empty bool) message.Message { return objecttest.GenerateGetRangeHashResponseBody(empty) }, func(empty bool) message.Message { return objecttest.GenerateGetRangeHashResponse(empty) }, + func(empty bool) message.Message { return objecttest.GenerateLock(empty) }, ) } diff --git a/object/status.go b/object/status.go new file mode 100644 index 0000000..067c372 --- /dev/null +++ b/object/status.go @@ -0,0 +1,87 @@ +package object + +import ( + "github.com/nspcc-dev/neofs-api-go/v2/status" + statusgrpc "github.com/nspcc-dev/neofs-api-go/v2/status/grpc" +) + +// LocalizeFailStatus checks if passed global status.Code is related to object failure and: +// then localizes the code and returns true, +// else leaves the code unchanged and returns false. +// +// Arg must not be nil. +func LocalizeFailStatus(c *status.Code) bool { + return status.LocalizeIfInSection(c, uint32(statusgrpc.Section_SECTION_OBJECT)) +} + +// GlobalizeFail globalizes local code of object failure. +// +// Arg must not be nil. +func GlobalizeFail(c *status.Code) { + c.GlobalizeSection(uint32(statusgrpc.Section_SECTION_OBJECT)) +} + +const ( + // StatusAccessDenied is a local status.Code value for + // ACCESS_DENIED object failure. + StatusAccessDenied status.Code = iota + // StatusNotFound is a local status.Code value for + // OBJECT_NOT_FOUND object failure. + StatusNotFound + // StatusLocked is a local status.Code value for + // LOCKED object failure. + StatusLocked + // StatusLockNonRegularObject is a local status.Code value for + // LOCK_NON_REGULAR_OBJECT object failure. + StatusLockNonRegularObject + // StatusAlreadyRemoved is a local status.Code value for + // OBJECT_ALREADY_REMOVED object failure. + StatusAlreadyRemoved +) + +const ( + // detailAccessDeniedDesc is a StatusAccessDenied detail ID for + // human-readable description. + detailAccessDeniedDesc = iota +) + +// WriteAccessDeniedDesc writes human-readable description of StatusAccessDenied +// into status.Status as a detail. The status must not be nil. +// +// Existing details are expected to be ID-unique, otherwise undefined behavior. +func WriteAccessDeniedDesc(st *status.Status, desc string) { + var found bool + + st.IterateDetails(func(d *status.Detail) bool { + if d.ID() == detailAccessDeniedDesc { + found = true + d.SetValue([]byte(desc)) + } + + return found + }) + + if !found { + var d status.Detail + + d.SetID(detailAccessDeniedDesc) + d.SetValue([]byte(desc)) + + st.AppendDetails(&d) + } +} + +// ReadAccessDeniedDesc looks up for status detail with human-readable description +// of StatusAccessDenied. Returns empty string if detail is missing. +func ReadAccessDeniedDesc(st status.Status) (desc string) { + st.IterateDetails(func(d *status.Detail) bool { + if d.ID() == detailAccessDeniedDesc { + desc = string(d.Value()) + return true + } + + return false + }) + + return +} diff --git a/object/status_test.go b/object/status_test.go new file mode 100644 index 0000000..86fcc82 --- /dev/null +++ b/object/status_test.go @@ -0,0 +1,34 @@ +package object_test + +import ( + "testing" + + "github.com/nspcc-dev/neofs-api-go/v2/object" + "github.com/nspcc-dev/neofs-api-go/v2/status" + statustest "github.com/nspcc-dev/neofs-api-go/v2/status/test" + "github.com/stretchr/testify/require" +) + +func TestStatusCodes(t *testing.T) { + statustest.TestCodes(t, object.LocalizeFailStatus, object.GlobalizeFail, + object.StatusAccessDenied, 2048, + object.StatusNotFound, 2049, + object.StatusLocked, 2050, + object.StatusLockNonRegularObject, 2051, + object.StatusAlreadyRemoved, 2052, + ) +} + +func TestAccessDeniedDesc(t *testing.T) { + var st status.Status + + require.Empty(t, object.ReadAccessDeniedDesc(st)) + + const desc = "some description" + + object.WriteAccessDeniedDesc(&st, desc) + require.Equal(t, desc, object.ReadAccessDeniedDesc(st)) + + object.WriteAccessDeniedDesc(&st, desc+"1") + require.Equal(t, desc+"1", object.ReadAccessDeniedDesc(st)) +} diff --git a/object/test/generate.go b/object/test/generate.go index 9070272..d2f80cb 100644 --- a/object/test/generate.go +++ b/object/test/generate.go @@ -2,6 +2,7 @@ package objecttest import ( "github.com/nspcc-dev/neofs-api-go/v2/object" + "github.com/nspcc-dev/neofs-api-go/v2/refs" refstest "github.com/nspcc-dev/neofs-api-go/v2/refs/test" sessiontest "github.com/nspcc-dev/neofs-api-go/v2/session/test" ) @@ -571,3 +572,16 @@ func GenerateGetRangeHashResponse(empty bool) *object.GetRangeHashResponse { return m } + +func GenerateLock(empty bool) *object.Lock { + m := new(object.Lock) + + if !empty { + m.SetMembers([]refs.ObjectID{ + *refstest.GenerateObjectID(false), + *refstest.GenerateObjectID(false), + }) + } + + return m +} diff --git a/object/types.go b/object/types.go index 94e9ed9..0c101b5 100644 --- a/object/types.go +++ b/object/types.go @@ -305,6 +305,7 @@ const ( TypeRegular Type = iota TypeTombstone TypeStorageGroup + TypeLock ) const ( diff --git a/reputation/grpc/service.pb.go b/reputation/grpc/service.pb.go index 7893677..865de18 100644 --- a/reputation/grpc/service.pb.go +++ b/reputation/grpc/service.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.1 -// protoc v3.19.1 +// protoc v3.19.4 // source: reputation/grpc/service.proto package reputation diff --git a/reputation/grpc/service_grpc.pb.go b/reputation/grpc/service_grpc.pb.go index b260785..1bd9b79 100644 --- a/reputation/grpc/service_grpc.pb.go +++ b/reputation/grpc/service_grpc.pb.go @@ -1,4 +1,8 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.2.0 +// - protoc v3.19.4 +// source: reputation/grpc/service.proto package reputation diff --git a/reputation/grpc/types.pb.go b/reputation/grpc/types.pb.go index b4396e8..b27aa42 100644 --- a/reputation/grpc/types.pb.go +++ b/reputation/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.1 -// protoc v3.19.1 +// protoc v3.19.4 // source: reputation/grpc/types.proto package reputation diff --git a/session/grpc/service.pb.go b/session/grpc/service.pb.go index 07be942..33510ad 100644 --- a/session/grpc/service.pb.go +++ b/session/grpc/service.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.1 -// protoc v3.19.1 +// protoc v3.19.4 // source: session/grpc/service.proto package session diff --git a/session/grpc/service_grpc.pb.go b/session/grpc/service_grpc.pb.go index cb72826..787a564 100644 --- a/session/grpc/service_grpc.pb.go +++ b/session/grpc/service_grpc.pb.go @@ -1,4 +1,8 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.2.0 +// - protoc v3.19.4 +// source: session/grpc/service.proto package session diff --git a/session/grpc/types.pb.go b/session/grpc/types.pb.go index 9a3dd87..eacccfa 100644 --- a/session/grpc/types.pb.go +++ b/session/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.1 -// protoc v3.19.1 +// protoc v3.19.4 // source: session/grpc/types.proto package session diff --git a/session/status.go b/session/status.go new file mode 100644 index 0000000..bbcd3e2 --- /dev/null +++ b/session/status.go @@ -0,0 +1,31 @@ +package session + +import ( + "github.com/nspcc-dev/neofs-api-go/v2/status" + statusgrpc "github.com/nspcc-dev/neofs-api-go/v2/status/grpc" +) + +// LocalizeFailStatus checks if passed global status.Code is related to session failure and: +// then localizes the code and returns true, +// else leaves the code unchanged and returns false. +// +// Arg must not be nil. +func LocalizeFailStatus(c *status.Code) bool { + return status.LocalizeIfInSection(c, uint32(statusgrpc.Section_SECTION_SESSION)) +} + +// GlobalizeFail globalizes local code of session failure. +// +// Arg must not be nil. +func GlobalizeFail(c *status.Code) { + c.GlobalizeSection(uint32(statusgrpc.Section_SECTION_SESSION)) +} + +const ( + // StatusTokenNotFound is a local status.Code value for + // TOKEN_NOT_FOUND session failure. + StatusTokenNotFound status.Code = iota + // StatusTokenExpired is a local status.Code value for + // TOKEN_EXPIRED session failure. + StatusTokenExpired +) diff --git a/session/status_test.go b/session/status_test.go new file mode 100644 index 0000000..a2847f8 --- /dev/null +++ b/session/status_test.go @@ -0,0 +1,15 @@ +package session_test + +import ( + "testing" + + "github.com/nspcc-dev/neofs-api-go/v2/session" + statustest "github.com/nspcc-dev/neofs-api-go/v2/status/test" +) + +func TestStatusCodes(t *testing.T) { + statustest.TestCodes(t, session.LocalizeFailStatus, session.GlobalizeFail, + session.StatusTokenNotFound, 4096, + session.StatusTokenExpired, 4097, + ) +} diff --git a/status/grpc/types.pb.go b/status/grpc/types.pb.go index e6d571f..168e183 100644 --- a/status/grpc/types.pb.go +++ b/status/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.1 -// protoc v3.19.1 +// protoc v3.19.4 // source: status/grpc/types.proto package status @@ -28,6 +28,12 @@ const ( Section_SECTION_SUCCESS Section = 0 // Failure codes regardless of the operation. Section_SECTION_FAILURE_COMMON Section = 1 + // Object service-specific errors. + Section_SECTION_OBJECT Section = 2 + // Container service-specific errors. + Section_SECTION_CONTAINER Section = 3 + // Session service-specific errors. + Section_SECTION_SESSION Section = 4 ) // Enum value maps for Section. @@ -35,10 +41,16 @@ var ( Section_name = map[int32]string{ 0: "SECTION_SUCCESS", 1: "SECTION_FAILURE_COMMON", + 2: "SECTION_OBJECT", + 3: "SECTION_CONTAINER", + 4: "SECTION_SESSION", } Section_value = map[string]int32{ "SECTION_SUCCESS": 0, "SECTION_FAILURE_COMMON": 1, + "SECTION_OBJECT": 2, + "SECTION_CONTAINER": 3, + "SECTION_SESSION": 4, } ) @@ -170,6 +182,163 @@ func (CommonFail) EnumDescriptor() ([]byte, []int) { return file_status_grpc_types_proto_rawDescGZIP(), []int{2} } +// Section of statuses for object-related operations. +type Object int32 + +const ( + // [**2048**] Access denied by ACL. + // Details: + // - [**0**] Human-readable description (UTF-8 encoded string). + Object_ACCESS_DENIED Object = 0 + // [**2049**] Object not found. + Object_OBJECT_NOT_FOUND Object = 1 + // [**2050**] Operation rejected by the object lock. + Object_LOCKED Object = 2 + // [**2051**] Locking an object with a non-REGULAR type rejected. + Object_LOCK_NON_REGULAR_OBJECT Object = 3 + // [**2052**] Object has been marked deleted. + Object_OBJECT_ALREADY_REMOVED Object = 4 +) + +// Enum value maps for Object. +var ( + Object_name = map[int32]string{ + 0: "ACCESS_DENIED", + 1: "OBJECT_NOT_FOUND", + 2: "LOCKED", + 3: "LOCK_NON_REGULAR_OBJECT", + 4: "OBJECT_ALREADY_REMOVED", + } + Object_value = map[string]int32{ + "ACCESS_DENIED": 0, + "OBJECT_NOT_FOUND": 1, + "LOCKED": 2, + "LOCK_NON_REGULAR_OBJECT": 3, + "OBJECT_ALREADY_REMOVED": 4, + } +) + +func (x Object) Enum() *Object { + p := new(Object) + *p = x + return p +} + +func (x Object) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (Object) Descriptor() protoreflect.EnumDescriptor { + return file_status_grpc_types_proto_enumTypes[3].Descriptor() +} + +func (Object) Type() protoreflect.EnumType { + return &file_status_grpc_types_proto_enumTypes[3] +} + +func (x Object) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use Object.Descriptor instead. +func (Object) EnumDescriptor() ([]byte, []int) { + return file_status_grpc_types_proto_rawDescGZIP(), []int{3} +} + +// Section of statuses for container-related operations. +type Container int32 + +const ( + // [**3072**] Container not found. + Container_CONTAINER_NOT_FOUND Container = 0 +) + +// Enum value maps for Container. +var ( + Container_name = map[int32]string{ + 0: "CONTAINER_NOT_FOUND", + } + Container_value = map[string]int32{ + "CONTAINER_NOT_FOUND": 0, + } +) + +func (x Container) Enum() *Container { + p := new(Container) + *p = x + return p +} + +func (x Container) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (Container) Descriptor() protoreflect.EnumDescriptor { + return file_status_grpc_types_proto_enumTypes[4].Descriptor() +} + +func (Container) Type() protoreflect.EnumType { + return &file_status_grpc_types_proto_enumTypes[4] +} + +func (x Container) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use Container.Descriptor instead. +func (Container) EnumDescriptor() ([]byte, []int) { + return file_status_grpc_types_proto_rawDescGZIP(), []int{4} +} + +// Section of statuses for session-related operations. +type Session int32 + +const ( + // [**4096**] Token not found. + Session_TOKEN_NOT_FOUND Session = 0 + // [**4097**] Token has expired. + Session_TOKEN_EXPIRED Session = 1 +) + +// Enum value maps for Session. +var ( + Session_name = map[int32]string{ + 0: "TOKEN_NOT_FOUND", + 1: "TOKEN_EXPIRED", + } + Session_value = map[string]int32{ + "TOKEN_NOT_FOUND": 0, + "TOKEN_EXPIRED": 1, + } +) + +func (x Session) Enum() *Session { + p := new(Session) + *p = x + return p +} + +func (x Session) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (Session) Descriptor() protoreflect.EnumDescriptor { + return file_status_grpc_types_proto_enumTypes[5].Descriptor() +} + +func (Session) Type() protoreflect.EnumType { + return &file_status_grpc_types_proto_enumTypes[5] +} + +func (x Session) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use Session.Descriptor instead. +func (Session) EnumDescriptor() ([]byte, []int) { + return file_status_grpc_types_proto_rawDescGZIP(), []int{5} +} + // Declares the general format of the status returns of the NeoFS RPC protocol. // Status is present in all response messages. Each RPC of NeoFS protocol // describes the possible outcomes and details of the operation. @@ -342,21 +511,38 @@ var file_status_grpc_types_proto_rawDesc = []byte{ 0x2e, 0x0a, 0x06, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x02, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x2a, - 0x3a, 0x0a, 0x07, 0x53, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x13, 0x0a, 0x0f, 0x53, 0x45, + 0x7a, 0x0a, 0x07, 0x53, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x13, 0x0a, 0x0f, 0x53, 0x45, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x53, 0x55, 0x43, 0x43, 0x45, 0x53, 0x53, 0x10, 0x00, 0x12, 0x1a, 0x0a, 0x16, 0x53, 0x45, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x46, 0x41, 0x49, 0x4c, 0x55, - 0x52, 0x45, 0x5f, 0x43, 0x4f, 0x4d, 0x4d, 0x4f, 0x4e, 0x10, 0x01, 0x2a, 0x11, 0x0a, 0x07, 0x53, + 0x52, 0x45, 0x5f, 0x43, 0x4f, 0x4d, 0x4d, 0x4f, 0x4e, 0x10, 0x01, 0x12, 0x12, 0x0a, 0x0e, 0x53, + 0x45, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x4f, 0x42, 0x4a, 0x45, 0x43, 0x54, 0x10, 0x02, 0x12, + 0x15, 0x0a, 0x11, 0x53, 0x45, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x43, 0x4f, 0x4e, 0x54, 0x41, + 0x49, 0x4e, 0x45, 0x52, 0x10, 0x03, 0x12, 0x13, 0x0a, 0x0f, 0x53, 0x45, 0x43, 0x54, 0x49, 0x4f, + 0x4e, 0x5f, 0x53, 0x45, 0x53, 0x53, 0x49, 0x4f, 0x4e, 0x10, 0x04, 0x2a, 0x11, 0x0a, 0x07, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x06, 0x0a, 0x02, 0x4f, 0x4b, 0x10, 0x00, 0x2a, 0x32, 0x0a, 0x0a, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x46, 0x61, 0x69, 0x6c, 0x12, 0x0c, 0x0a, 0x08, 0x49, 0x4e, 0x54, 0x45, 0x52, 0x4e, 0x41, 0x4c, 0x10, 0x00, 0x12, 0x16, 0x0a, 0x12, 0x57, 0x52, 0x4f, 0x4e, 0x47, 0x5f, 0x4d, 0x41, 0x47, 0x49, 0x43, 0x5f, 0x4e, 0x55, 0x4d, 0x42, 0x45, 0x52, - 0x10, 0x01, 0x42, 0x56, 0x5a, 0x37, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, - 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, - 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x75, - 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0xaa, 0x02, 0x1a, - 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, - 0x41, 0x50, 0x49, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x33, + 0x10, 0x01, 0x2a, 0x76, 0x0a, 0x06, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x11, 0x0a, 0x0d, + 0x41, 0x43, 0x43, 0x45, 0x53, 0x53, 0x5f, 0x44, 0x45, 0x4e, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, + 0x14, 0x0a, 0x10, 0x4f, 0x42, 0x4a, 0x45, 0x43, 0x54, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x46, 0x4f, + 0x55, 0x4e, 0x44, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x4c, 0x4f, 0x43, 0x4b, 0x45, 0x44, 0x10, + 0x02, 0x12, 0x1b, 0x0a, 0x17, 0x4c, 0x4f, 0x43, 0x4b, 0x5f, 0x4e, 0x4f, 0x4e, 0x5f, 0x52, 0x45, + 0x47, 0x55, 0x4c, 0x41, 0x52, 0x5f, 0x4f, 0x42, 0x4a, 0x45, 0x43, 0x54, 0x10, 0x03, 0x12, 0x1a, + 0x0a, 0x16, 0x4f, 0x42, 0x4a, 0x45, 0x43, 0x54, 0x5f, 0x41, 0x4c, 0x52, 0x45, 0x41, 0x44, 0x59, + 0x5f, 0x52, 0x45, 0x4d, 0x4f, 0x56, 0x45, 0x44, 0x10, 0x04, 0x2a, 0x24, 0x0a, 0x09, 0x43, 0x6f, + 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x12, 0x17, 0x0a, 0x13, 0x43, 0x4f, 0x4e, 0x54, 0x41, + 0x49, 0x4e, 0x45, 0x52, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x46, 0x4f, 0x55, 0x4e, 0x44, 0x10, 0x00, + 0x2a, 0x31, 0x0a, 0x07, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x13, 0x0a, 0x0f, 0x54, + 0x4f, 0x4b, 0x45, 0x4e, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x46, 0x4f, 0x55, 0x4e, 0x44, 0x10, 0x00, + 0x12, 0x11, 0x0a, 0x0d, 0x54, 0x4f, 0x4b, 0x45, 0x4e, 0x5f, 0x45, 0x58, 0x50, 0x49, 0x52, 0x45, + 0x44, 0x10, 0x01, 0x42, 0x56, 0x5a, 0x37, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, + 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, + 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x73, 0x74, 0x61, 0x74, + 0x75, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0xaa, 0x02, + 0x1a, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, + 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, } var ( @@ -371,17 +557,20 @@ func file_status_grpc_types_proto_rawDescGZIP() []byte { return file_status_grpc_types_proto_rawDescData } -var file_status_grpc_types_proto_enumTypes = make([]protoimpl.EnumInfo, 3) +var file_status_grpc_types_proto_enumTypes = make([]protoimpl.EnumInfo, 6) var file_status_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 2) var file_status_grpc_types_proto_goTypes = []interface{}{ (Section)(0), // 0: neo.fs.v2.status.Section (Success)(0), // 1: neo.fs.v2.status.Success (CommonFail)(0), // 2: neo.fs.v2.status.CommonFail - (*Status)(nil), // 3: neo.fs.v2.status.Status - (*Status_Detail)(nil), // 4: neo.fs.v2.status.Status.Detail + (Object)(0), // 3: neo.fs.v2.status.Object + (Container)(0), // 4: neo.fs.v2.status.Container + (Session)(0), // 5: neo.fs.v2.status.Session + (*Status)(nil), // 6: neo.fs.v2.status.Status + (*Status_Detail)(nil), // 7: neo.fs.v2.status.Status.Detail } var file_status_grpc_types_proto_depIdxs = []int32{ - 4, // 0: neo.fs.v2.status.Status.details:type_name -> neo.fs.v2.status.Status.Detail + 7, // 0: neo.fs.v2.status.Status.details:type_name -> neo.fs.v2.status.Status.Detail 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 @@ -425,7 +614,7 @@ func file_status_grpc_types_proto_init() { File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_status_grpc_types_proto_rawDesc, - NumEnums: 3, + NumEnums: 6, NumMessages: 2, NumExtensions: 0, NumServices: 0, diff --git a/status/status.go b/status/status.go index 4b1f370..b610b8b 100644 --- a/status/status.go +++ b/status/status.go @@ -80,3 +80,17 @@ func LocalizeCommonFail(c *Code) { func GlobalizeCommonFail(c *Code) { c.GlobalizeSection(sectionAfterSuccess(sectionCommon)) } + +// LocalizeIfInSection checks if passed global status.Code belongs to the section and: +// then localizes the code and returns true, +// else leaves the code unchanged and returns false. +// +// Arg must not be nil. +func LocalizeIfInSection(c *Code, sec uint32) bool { + if IsInSection(*c, sec) { + c.LocalizeSection(sec) + return true + } + + return false +} diff --git a/status/test/codes.go b/status/test/codes.go new file mode 100644 index 0000000..acc5a50 --- /dev/null +++ b/status/test/codes.go @@ -0,0 +1,28 @@ +package statustest + +import ( + "testing" + + "github.com/nspcc-dev/neofs-api-go/v2/status" + "github.com/stretchr/testify/require" +) + +// TestCodes checks mapping of status codes to the numbers. +// Args must be pairs (status.Code, int). +func TestCodes(t *testing.T, + localizer func(*status.Code) bool, + globalizer func(code *status.Code), + vals ...interface{}, +) { + for i := 0; i < len(vals); i += 2 { + c := vals[i].(status.Code) + cp := c + + globalizer(&cp) + require.True(t, cp.EqualNumber(uint32(vals[i+1].(int))), c) + + require.True(t, localizer(&cp), c) + + require.Equal(t, cp, c, c) + } +} diff --git a/status/types.go b/status/types.go index 61a05d0..6fe233b 100644 --- a/status/types.go +++ b/status/types.go @@ -42,6 +42,11 @@ func (x *Detail) SetValue(val []byte) { // Code represents NeoFS API V2-compatible status code. type Code uint32 +// EqualNumber checks if the numerical Code equals num. +func (x Code) EqualNumber(num uint32) bool { + return uint32(x) == num +} + // Status represents structure of NeoFS API V2-compatible status return message. type Status struct { code Code diff --git a/storagegroup/grpc/types.pb.go b/storagegroup/grpc/types.pb.go index d6584f5..e0fd05c 100644 --- a/storagegroup/grpc/types.pb.go +++ b/storagegroup/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.1 -// protoc v3.19.1 +// protoc v3.19.4 // source: storagegroup/grpc/types.proto package storagegroup diff --git a/subnet/grpc/types.pb.go b/subnet/grpc/types.pb.go index bab81bf..10e2e95 100644 --- a/subnet/grpc/types.pb.go +++ b/subnet/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.1 -// protoc v3.19.1 +// protoc v3.19.4 // source: subnet/grpc/types.proto package subnet diff --git a/tombstone/grpc/types.pb.go b/tombstone/grpc/types.pb.go index 60aacc2..421b284 100644 --- a/tombstone/grpc/types.pb.go +++ b/tombstone/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.1 -// protoc v3.19.1 +// protoc v3.19.4 // source: tombstone/grpc/types.proto package tombstone diff --git a/util/proto/test/test.pb.go b/util/proto/test/test.pb.go index b0ef135..edefcc3 100644 --- a/util/proto/test/test.pb.go +++ b/util/proto/test/test.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.1 -// protoc v3.19.1 +// protoc v3.19.4 // source: util/proto/test/test.proto package test From fd3bf4a56b9bc7132c85e280545d491a340d4489 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 25 Feb 2022 10:36:46 +0300 Subject: [PATCH 0961/1196] Fix linter remarks Signed-off-by: Leonard Lyubich --- container/convert.go | 4 +-- container/types.go | 12 ++++----- object/convert.go | 2 +- object/types.go | 6 ++--- refs/types.go | 1 + session/convert.go | 12 ++++----- session/json.go | 8 +++--- session/marshal.go | 12 ++++----- session/test/generate.go | 8 +++--- session/types.go | 56 ++++++++++++++++++++++++---------------- 10 files changed, 67 insertions(+), 54 deletions(-) diff --git a/container/convert.go b/container/convert.go index 977ad77..89e0153 100644 --- a/container/convert.go +++ b/container/convert.go @@ -432,7 +432,7 @@ func (r *GetResponseBody) FromGRPCMessage(m grpc.Message) error { r.token = nil } else { if r.token == nil { - r.token = new(session.SessionToken) + r.token = new(session.Token) } err = r.token.FromGRPCMessage(token) @@ -1026,7 +1026,7 @@ func (r *GetExtendedACLResponseBody) FromGRPCMessage(m grpc.Message) error { r.token = nil } else { if r.token == nil { - r.token = new(session.SessionToken) + r.token = new(session.Token) } err = r.token.FromGRPCMessage(token) diff --git a/container/types.go b/container/types.go index 63449ef..ea7fd9c 100644 --- a/container/types.go +++ b/container/types.go @@ -59,7 +59,7 @@ type GetRequest struct { type GetResponseBody struct { cnr *Container - token *session.SessionToken + token *session.Token sig *refs.Signature } @@ -145,7 +145,7 @@ type GetExtendedACLResponseBody struct { sig *refs.Signature - token *session.SessionToken + token *session.Token } type GetExtendedACLResponse struct { @@ -406,7 +406,7 @@ func (r *GetResponseBody) SetContainer(v *Container) { // GetSessionToken returns token of the session within which requested // container was created. -func (r *GetResponseBody) GetSessionToken() *session.SessionToken { +func (r *GetResponseBody) GetSessionToken() *session.Token { if r != nil { return r.token } @@ -416,7 +416,7 @@ func (r *GetResponseBody) GetSessionToken() *session.SessionToken { // SetSessionToken sets token of the session within which requested // container was created. -func (r *GetResponseBody) SetSessionToken(v *session.SessionToken) { +func (r *GetResponseBody) SetSessionToken(v *session.Token) { if r != nil { r.token = v } @@ -678,7 +678,7 @@ func (r *GetExtendedACLResponseBody) SetSignature(v *refs.Signature) { // GetSessionToken returns token of the session within which requested // eACL table was set. -func (r *GetExtendedACLResponseBody) GetSessionToken() *session.SessionToken { +func (r *GetExtendedACLResponseBody) GetSessionToken() *session.Token { if r != nil { return r.token } @@ -688,7 +688,7 @@ func (r *GetExtendedACLResponseBody) GetSessionToken() *session.SessionToken { // SetSessionToken sets token of the session within which requested // eACL table was set. -func (r *GetExtendedACLResponseBody) SetSessionToken(v *session.SessionToken) { +func (r *GetExtendedACLResponseBody) SetSessionToken(v *session.Token) { if r != nil { r.token = v } diff --git a/object/convert.go b/object/convert.go index d7c0a28..80213df 100644 --- a/object/convert.go +++ b/object/convert.go @@ -373,7 +373,7 @@ func (h *Header) FromGRPCMessage(m grpc.Message) error { h.sessionToken = nil } else { if h.sessionToken == nil { - h.sessionToken = new(session.SessionToken) + h.sessionToken = new(session.Token) } err = h.sessionToken.FromGRPCMessage(sessionToken) diff --git a/object/types.go b/object/types.go index 0c101b5..ed3cdff 100644 --- a/object/types.go +++ b/object/types.go @@ -54,7 +54,7 @@ type Header struct { typ Type - sessionToken *session.SessionToken + sessionToken *session.Token attr []*Attribute @@ -640,7 +640,7 @@ func (h *Header) SetHomomorphicHash(v *refs.Checksum) { } } -func (h *Header) GetSessionToken() *session.SessionToken { +func (h *Header) GetSessionToken() *session.Token { if h != nil { return h.sessionToken } @@ -648,7 +648,7 @@ func (h *Header) GetSessionToken() *session.SessionToken { return nil } -func (h *Header) SetSessionToken(v *session.SessionToken) { +func (h *Header) SetSessionToken(v *session.Token) { if h != nil { h.sessionToken = v } diff --git a/refs/types.go b/refs/types.go index 93a814a..dbe307a 100644 --- a/refs/types.go +++ b/refs/types.go @@ -33,6 +33,7 @@ type ChecksumType uint32 type SignatureScheme uint32 +//nolint:revive const ( UnspecifiedScheme SignatureScheme = iota ECDSA_SHA512 diff --git a/session/convert.go b/session/convert.go index 5562fff..200e227 100644 --- a/session/convert.go +++ b/session/convert.go @@ -242,7 +242,7 @@ func XHeadersFromGRPC(xs []*session.XHeader) (res []*XHeader, err error) { return } -func (t *SessionToken) ToGRPCMessage() grpc.Message { +func (t *Token) ToGRPCMessage() grpc.Message { var m *session.SessionToken if t != nil { @@ -255,7 +255,7 @@ func (t *SessionToken) ToGRPCMessage() grpc.Message { return m } -func (t *SessionToken) FromGRPCMessage(m grpc.Message) error { +func (t *Token) FromGRPCMessage(m grpc.Message) error { v, ok := m.(*session.SessionToken) if !ok { return message.NewUnexpectedMessageType(m, v) @@ -268,7 +268,7 @@ func (t *SessionToken) FromGRPCMessage(m grpc.Message) error { t.body = nil } else { if t.body == nil { - t.body = new(SessionTokenBody) + t.body = new(TokenBody) } err = t.body.FromGRPCMessage(body) @@ -422,7 +422,7 @@ func (r *RequestMetaHeader) FromGRPCMessage(m grpc.Message) error { r.sessionToken = nil } else { if r.sessionToken == nil { - r.sessionToken = new(SessionToken) + r.sessionToken = new(Token) } err = r.sessionToken.FromGRPCMessage(sessionToken) @@ -713,7 +713,7 @@ func (c *ObjectSessionContext) FromGRPCMessage(m grpc.Message) error { return nil } -func (t *SessionTokenBody) ToGRPCMessage() grpc.Message { +func (t *TokenBody) ToGRPCMessage() grpc.Message { var m *session.SessionToken_Body if t != nil { @@ -739,7 +739,7 @@ func (t *SessionTokenBody) ToGRPCMessage() grpc.Message { return m } -func (t *SessionTokenBody) FromGRPCMessage(m grpc.Message) error { +func (t *TokenBody) FromGRPCMessage(m grpc.Message) error { v, ok := m.(*session.SessionToken_Body) if !ok { return message.NewUnexpectedMessageType(m, v) diff --git a/session/json.go b/session/json.go index d8056ee..b423567 100644 --- a/session/json.go +++ b/session/json.go @@ -22,11 +22,11 @@ func (l *TokenLifetime) UnmarshalJSON(data []byte) error { return message.UnmarshalJSON(l, data, new(session.SessionToken_Body_TokenLifetime)) } -func (t *SessionTokenBody) MarshalJSON() ([]byte, error) { +func (t *TokenBody) MarshalJSON() ([]byte, error) { return message.MarshalJSON(t) } -func (t *SessionTokenBody) UnmarshalJSON(data []byte) error { +func (t *TokenBody) UnmarshalJSON(data []byte) error { msg := new(session.SessionToken_Body) if err := protojson.Unmarshal(data, msg); err != nil { @@ -36,11 +36,11 @@ func (t *SessionTokenBody) UnmarshalJSON(data []byte) error { return t.FromGRPCMessage(msg) } -func (t *SessionToken) MarshalJSON() ([]byte, error) { +func (t *Token) MarshalJSON() ([]byte, error) { return message.MarshalJSON(t) } -func (t *SessionToken) UnmarshalJSON(data []byte) error { +func (t *Token) UnmarshalJSON(data []byte) error { msg := new(session.SessionToken) if err := protojson.Unmarshal(data, msg); err != nil { diff --git a/session/marshal.go b/session/marshal.go index f28615c..dbaf367 100644 --- a/session/marshal.go +++ b/session/marshal.go @@ -363,7 +363,7 @@ func (x *ContainerSessionContext) Unmarshal(data []byte) error { return message.Unmarshal(x, data, new(session.ContainerSessionContext)) } -func (t *SessionTokenBody) StableMarshal(buf []byte) ([]byte, error) { +func (t *TokenBody) StableMarshal(buf []byte) ([]byte, error) { if t == nil { return []byte{}, nil } @@ -425,7 +425,7 @@ func (t *SessionTokenBody) StableMarshal(buf []byte) ([]byte, error) { return buf, nil } -func (t *SessionTokenBody) StableSize() (size int) { +func (t *TokenBody) StableSize() (size int) { if t == nil { return 0 } @@ -449,7 +449,7 @@ func (t *SessionTokenBody) StableSize() (size int) { return size } -func (t *SessionTokenBody) Unmarshal(data []byte) error { +func (t *TokenBody) Unmarshal(data []byte) error { m := new(session.SessionToken_Body) if err := goproto.Unmarshal(data, m); err != nil { return err @@ -458,7 +458,7 @@ func (t *SessionTokenBody) Unmarshal(data []byte) error { return t.FromGRPCMessage(m) } -func (t *SessionToken) StableMarshal(buf []byte) ([]byte, error) { +func (t *Token) StableMarshal(buf []byte) ([]byte, error) { if t == nil { return []byte{}, nil } @@ -487,7 +487,7 @@ func (t *SessionToken) StableMarshal(buf []byte) ([]byte, error) { return buf, nil } -func (t *SessionToken) StableSize() (size int) { +func (t *Token) StableSize() (size int) { if t == nil { return 0 } @@ -498,7 +498,7 @@ func (t *SessionToken) StableSize() (size int) { return size } -func (t *SessionToken) Unmarshal(data []byte) error { +func (t *Token) Unmarshal(data []byte) error { m := new(session.SessionToken) if err := goproto.Unmarshal(data, m); err != nil { return err diff --git a/session/test/generate.go b/session/test/generate.go index d809592..537240a 100644 --- a/session/test/generate.go +++ b/session/test/generate.go @@ -145,8 +145,8 @@ func generateRequestMetaHeader(empty, withOrigin bool) *session.RequestMetaHeade return m } -func GenerateSessionToken(empty bool) *session.SessionToken { - m := new(session.SessionToken) +func GenerateSessionToken(empty bool) *session.Token { + m := new(session.Token) if !empty { m.SetBody(GenerateSessionTokenBody(false)) @@ -157,8 +157,8 @@ func GenerateSessionToken(empty bool) *session.SessionToken { return m } -func GenerateSessionTokenBody(empty bool) *session.SessionTokenBody { - m := new(session.SessionTokenBody) +func GenerateSessionTokenBody(empty bool) *session.TokenBody { + m := new(session.TokenBody) if !empty { m.SetID([]byte{1}) diff --git a/session/types.go b/session/types.go index 26fa26e..e41b5a9 100644 --- a/session/types.go +++ b/session/types.go @@ -46,11 +46,15 @@ type ObjectSessionContext struct { addr *refs.Address } -type SessionTokenContext interface { +type TokenContext interface { sessionTokenContext() } -type SessionTokenBody struct { +// Deprecated: use TokenContext instead. +//nolint:revive +type SessionTokenContext = TokenContext + +type TokenBody struct { id []byte ownerID *refs.OwnerID @@ -59,15 +63,23 @@ type SessionTokenBody struct { sessionKey []byte - ctx SessionTokenContext + ctx TokenContext } -type SessionToken struct { - body *SessionTokenBody +// Deprecated: use TokenBody instead. +//nolint:revive +type SessionTokenBody = TokenBody + +type Token struct { + body *TokenBody sig *refs.Signature } +// Deprecated: use Token instead. +//nolint:revive +type SessionToken = Token + type RequestVerificationHeader struct { bodySig, metaSig, originSig *refs.Signature @@ -83,7 +95,7 @@ type RequestMetaHeader struct { xHeaders []*XHeader - sessionToken *SessionToken + sessionToken *Token bearerToken *acl.BearerToken @@ -403,7 +415,7 @@ func (r *RequestMetaHeader) SetXHeaders(v []*XHeader) { } } -func (r *RequestMetaHeader) GetSessionToken() *SessionToken { +func (r *RequestMetaHeader) GetSessionToken() *Token { if r != nil { return r.sessionToken } @@ -411,7 +423,7 @@ func (r *RequestMetaHeader) GetSessionToken() *SessionToken { return nil } -func (r *RequestMetaHeader) SetSessionToken(v *SessionToken) { +func (r *RequestMetaHeader) SetSessionToken(v *Token) { if r != nil { r.sessionToken = v } @@ -692,7 +704,7 @@ func (c *ObjectSessionContext) SetAddress(v *refs.Address) { } } -func (t *SessionTokenBody) GetID() []byte { +func (t *TokenBody) GetID() []byte { if t != nil { return t.id } @@ -700,13 +712,13 @@ func (t *SessionTokenBody) GetID() []byte { return nil } -func (t *SessionTokenBody) SetID(v []byte) { +func (t *TokenBody) SetID(v []byte) { if t != nil { t.id = v } } -func (t *SessionTokenBody) GetOwnerID() *refs.OwnerID { +func (t *TokenBody) GetOwnerID() *refs.OwnerID { if t != nil { return t.ownerID } @@ -714,13 +726,13 @@ func (t *SessionTokenBody) GetOwnerID() *refs.OwnerID { return nil } -func (t *SessionTokenBody) SetOwnerID(v *refs.OwnerID) { +func (t *TokenBody) SetOwnerID(v *refs.OwnerID) { if t != nil { t.ownerID = v } } -func (t *SessionTokenBody) GetLifetime() *TokenLifetime { +func (t *TokenBody) GetLifetime() *TokenLifetime { if t != nil { return t.lifetime } @@ -728,13 +740,13 @@ func (t *SessionTokenBody) GetLifetime() *TokenLifetime { return nil } -func (t *SessionTokenBody) SetLifetime(v *TokenLifetime) { +func (t *TokenBody) SetLifetime(v *TokenLifetime) { if t != nil { t.lifetime = v } } -func (t *SessionTokenBody) GetSessionKey() []byte { +func (t *TokenBody) GetSessionKey() []byte { if t != nil { return t.sessionKey } @@ -742,13 +754,13 @@ func (t *SessionTokenBody) GetSessionKey() []byte { return nil } -func (t *SessionTokenBody) SetSessionKey(v []byte) { +func (t *TokenBody) SetSessionKey(v []byte) { if t != nil { t.sessionKey = v } } -func (t *SessionTokenBody) GetContext() SessionTokenContext { +func (t *TokenBody) GetContext() TokenContext { if t != nil { return t.ctx } @@ -756,13 +768,13 @@ func (t *SessionTokenBody) GetContext() SessionTokenContext { return nil } -func (t *SessionTokenBody) SetContext(v SessionTokenContext) { +func (t *TokenBody) SetContext(v TokenContext) { if t != nil { t.ctx = v } } -func (t *SessionToken) GetBody() *SessionTokenBody { +func (t *Token) GetBody() *TokenBody { if t != nil { return t.body } @@ -770,13 +782,13 @@ func (t *SessionToken) GetBody() *SessionTokenBody { return nil } -func (t *SessionToken) SetBody(v *SessionTokenBody) { +func (t *Token) SetBody(v *TokenBody) { if t != nil { t.body = v } } -func (t *SessionToken) GetSignature() *refs.Signature { +func (t *Token) GetSignature() *refs.Signature { if t != nil { return t.sig } @@ -784,7 +796,7 @@ func (t *SessionToken) GetSignature() *refs.Signature { return nil } -func (t *SessionToken) SetSignature(v *refs.Signature) { +func (t *Token) SetSignature(v *refs.Signature) { if t != nil { t.sig = v } From e872572ba39d52c469bd38f1385f1a33d3e12c1f Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 25 Feb 2022 10:37:30 +0300 Subject: [PATCH 0962/1196] Update release instruction Remove no longer needed version section. Signed-off-by: Leonard Lyubich --- docs/release-instruction.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/docs/release-instruction.md b/docs/release-instruction.md index 5318755..74465d7 100644 --- a/docs/release-instruction.md +++ b/docs/release-instruction.md @@ -23,10 +23,6 @@ Open Pull Request (must receive at least one approval) and merge this changes. Actualize compatibility table in `README.md` with relevant information. -## Update version - -Actualize minor/major version constants in `pkg/version.go` file. - ## Tag a release Use `vX.Y.Z` tag for releases and `vX.Y.Z-rc.N` for release candidates From f4fd28e39b8010739cb59c71bc0bd9d8625ea33a Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 25 Feb 2022 10:56:05 +0300 Subject: [PATCH 0963/1196] =?UTF-8?q?Release=20v2.12.0=20-=20Heuksando=20(?= =?UTF-8?q?=ED=9D=91=EC=82=B0=EB=8F=84,=20=E9=BB=91=E5=B1=B1=E5=B3=B6)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Leonard Lyubich --- CHANGELOG.md | 18 ++++++++++++++++++ README.md | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 096e45e..a5e49e1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,22 @@ # Changelog +## [2.12.0] - 2022-02-25 - Heuksando (흑산도, 黑山島) + +NeoFS API v2.12 support + +### Added +- Network magic field (`uint64`) to `session.RequestMetaHeader` (#367) +- Constants for attributes related to object notifications (#372) +- `refs.SignatureScheme` enum and corresponding field to `session.Signature` message (#55) +- New status codes in `container`, `object` and `session` packages (#371) +- `object.TypeLock` type enum value and `object.Lock` type of its content (#371) + +### Changed +- API of `signature` package (#55) + +### Deprecated +- `SessionToken`, `SessionTokenBody` and `SessionTokenContext` types from `session` package + ## [2.11.1] - 2021-12-28 ### Added @@ -763,3 +780,4 @@ Initial public release [1.30.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.29.0...v1.30.0 [2.11.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.30.0...v2.11.0 [2.11.1]: https://github.com/nspcc-dev/neofs-api-go/compare/v2.11.0...v2.11.1 +[2.12.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v2.11.1...v2.12.0 diff --git a/README.md b/README.md index 0fe20a9..7b2ad6a 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ versions. For a more high-level SDK see [NeoFS SDK](https://github.com/nspcc-dev |v1.29.x|[v2.9.1](https://github.com/nspcc-dev/neofs-api/releases/tag/v2.9.1)| |v1.30.x|[v2.10.0](https://github.com/nspcc-dev/neofs-api/releases/tag/v2.10.0)| |v2.11.x|[v2.11.0](https://github.com/nspcc-dev/neofs-api/releases/tag/v2.11.0)| - +|v2.12.x|[v2.12.0](https://github.com/nspcc-dev/neofs-api/releases/tag/v2.12.0)| ## Contributing From d065453bd0a7a22b4efd724b11ecec6a50c275bc Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 2 Mar 2022 13:15:36 +0300 Subject: [PATCH 0964/1196] [#380] Support changes in signature schemes Support new `SignatureRFC6979` message. Make `refs.ECDSA_SHA512` to be default scheme. Signed-off-by: Leonard Lyubich --- container/convert.go | 37 ++- container/grpc/service.go | 16 +- container/grpc/service.pb.go | 552 +++++++++++++++++------------------ container/types.go | 10 + refs/grpc/types.go | 14 + refs/grpc/types.pb.go | 168 +++++++---- refs/types.go | 5 +- util/signature/data.go | 4 +- util/signature/options.go | 32 +- 9 files changed, 470 insertions(+), 368 deletions(-) diff --git a/container/convert.go b/container/convert.go index 89e0153..5e49bea 100644 --- a/container/convert.go +++ b/container/convert.go @@ -152,6 +152,18 @@ func (c *Container) FromGRPCMessage(m grpc.Message) error { return nil } +func toSignatureRFC6979(s *refs.Signature) *refsGRPC.SignatureRFC6979 { + var res *refsGRPC.SignatureRFC6979 + + if s != nil { + res = new(refsGRPC.SignatureRFC6979) + res.SetKey(s.GetKey()) + res.SetSign(s.GetSign()) + } + + return res +} + func (r *PutRequestBody) ToGRPCMessage() grpc.Message { var m *container.PutRequest_Body @@ -159,7 +171,7 @@ func (r *PutRequestBody) ToGRPCMessage() grpc.Message { m = new(container.PutRequest_Body) m.SetContainer(r.cnr.ToGRPCMessage().(*container.Container)) - m.SetSignature(r.sig.ToGRPCMessage().(*refsGRPC.Signature)) + m.SetSignature(toSignatureRFC6979(r.sig)) } return m @@ -195,7 +207,8 @@ func (r *PutRequestBody) FromGRPCMessage(m grpc.Message) error { r.sig = new(refs.Signature) } - err = r.sig.FromGRPCMessage(sig) + r.sig.SetKey(sig.GetKey()) + r.sig.SetSign(sig.GetSign()) } return err @@ -391,7 +404,7 @@ func (r *GetResponseBody) ToGRPCMessage() grpc.Message { m.SetContainer(r.cnr.ToGRPCMessage().(*container.Container)) m.SetSessionToken(r.token.ToGRPCMessage().(*sessionGRPC.SessionToken)) - m.SetSignature(r.sig.ToGRPCMessage().(*refsGRPC.Signature)) + m.SetSignature(toSignatureRFC6979(r.sig)) } return m @@ -424,7 +437,8 @@ func (r *GetResponseBody) FromGRPCMessage(m grpc.Message) error { r.sig = new(refs.Signature) } - err = r.sig.FromGRPCMessage(sig) + r.sig.SetKey(sig.GetKey()) + r.sig.SetSign(sig.GetSign()) } token := v.GetSessionToken() @@ -486,7 +500,7 @@ func (r *DeleteRequestBody) ToGRPCMessage() grpc.Message { m = new(container.DeleteRequest_Body) m.SetContainerId(r.cid.ToGRPCMessage().(*refsGRPC.ContainerID)) - m.SetSignature(r.sig.ToGRPCMessage().(*refsGRPC.Signature)) + m.SetSignature(toSignatureRFC6979(r.sig)) } return m @@ -522,7 +536,8 @@ func (r *DeleteRequestBody) FromGRPCMessage(m grpc.Message) error { r.sig = new(refs.Signature) } - err = r.sig.FromGRPCMessage(sig) + r.sig.SetKey(sig.GetKey()) + r.sig.SetSign(sig.GetSign()) } return err @@ -765,7 +780,7 @@ func (r *SetExtendedACLRequestBody) ToGRPCMessage() grpc.Message { m = new(container.SetExtendedACLRequest_Body) m.SetEacl(r.eacl.ToGRPCMessage().(*aclGRPC.EACLTable)) - m.SetSignature(r.sig.ToGRPCMessage().(*refsGRPC.Signature)) + m.SetSignature(toSignatureRFC6979(r.sig)) } return m @@ -801,7 +816,8 @@ func (r *SetExtendedACLRequestBody) FromGRPCMessage(m grpc.Message) error { r.sig = new(refs.Signature) } - err = r.sig.FromGRPCMessage(sig) + r.sig.SetKey(sig.GetKey()) + r.sig.SetSign(sig.GetSign()) } return err @@ -981,7 +997,7 @@ func (r *GetExtendedACLResponseBody) ToGRPCMessage() grpc.Message { m = new(container.GetExtendedACLResponse_Body) m.SetEacl(r.eacl.ToGRPCMessage().(*aclGRPC.EACLTable)) - m.SetSignature(r.sig.ToGRPCMessage().(*refsGRPC.Signature)) + m.SetSignature(toSignatureRFC6979(r.sig)) m.SetSessionToken(r.token.ToGRPCMessage().(*sessionGRPC.SessionToken)) } @@ -1018,7 +1034,8 @@ func (r *GetExtendedACLResponseBody) FromGRPCMessage(m grpc.Message) error { r.sig = new(refs.Signature) } - err = r.sig.FromGRPCMessage(sig) + r.sig.SetKey(sig.GetKey()) + r.sig.SetSign(sig.GetSign()) } token := v.GetSessionToken() diff --git a/container/grpc/service.go b/container/grpc/service.go index 6aa854b..09743dc 100644 --- a/container/grpc/service.go +++ b/container/grpc/service.go @@ -14,7 +14,7 @@ func (m *PutRequest_Body) SetContainer(v *Container) { } // SetSignature sets signature of the container structure. -func (m *PutRequest_Body) SetSignature(v *refs.Signature) { +func (m *PutRequest_Body) SetSignature(v *refs.SignatureRFC6979) { if m != nil { m.Signature = v } @@ -77,7 +77,7 @@ func (m *DeleteRequest_Body) SetContainerId(v *refs.ContainerID) { } // SetSignature sets signature of the container identifier. -func (m *DeleteRequest_Body) SetSignature(v *refs.Signature) { +func (m *DeleteRequest_Body) SetSignature(v *refs.SignatureRFC6979) { if m != nil { m.Signature = v } @@ -166,8 +166,8 @@ func (m *GetResponse_Body) SetSessionToken(v *session.SessionToken) { } } -// SetSignature sets signature of the requested container. -func (m *GetResponse_Body) SetSignature(v *refs.Signature) { +// SetSignature sets signature of the container structure. +func (m *GetResponse_Body) SetSignature(v *refs.SignatureRFC6979) { if m != nil { m.Signature = v } @@ -257,8 +257,8 @@ func (m *SetExtendedACLRequest_Body) SetEacl(v *acl.EACLTable) { } } -// SetSignature sets signature of the eACL table. -func (m *SetExtendedACLRequest_Body) SetSignature(v *refs.Signature) { +// SetSignature sets signature of the eACL table structure. +func (m *SetExtendedACLRequest_Body) SetSignature(v *refs.SignatureRFC6979) { if m != nil { m.Signature = v } @@ -341,8 +341,8 @@ func (m *GetExtendedACLResponse_Body) SetEacl(v *acl.EACLTable) { } } -// SetSignature sets signature of the eACL table. -func (m *GetExtendedACLResponse_Body) SetSignature(v *refs.Signature) { +// SetSignature sets signature of the eACL table structure. +func (m *GetExtendedACLResponse_Body) SetSignature(v *refs.SignatureRFC6979) { if m != nil { m.Signature = v } diff --git a/container/grpc/service.pb.go b/container/grpc/service.pb.go index d7fa78e..dd91394 100644 --- a/container/grpc/service.pb.go +++ b/container/grpc/service.pb.go @@ -1017,8 +1017,7 @@ type PutRequest_Body struct { // Container structure to register in NeoFS Container *Container `protobuf:"bytes,1,opt,name=container,proto3" json:"container,omitempty"` // Signature of a stable-marshalled container according to RFC-6979. - // Signature scheme must be either UNSPECIFIED or ECDSA_RFC6979_SHA256. - Signature *grpc1.Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` + Signature *grpc1.SignatureRFC6979 `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` } func (x *PutRequest_Body) Reset() { @@ -1060,7 +1059,7 @@ func (x *PutRequest_Body) GetContainer() *Container { return nil } -func (x *PutRequest_Body) GetSignature() *grpc1.Signature { +func (x *PutRequest_Body) GetSignature() *grpc1.SignatureRFC6979 { if x != nil { return x.Signature } @@ -1130,8 +1129,7 @@ type DeleteRequest_Body struct { // Identifier of the container to delete from NeoFS ContainerId *grpc1.ContainerID `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` // `ContainerID` signed with the container owner's key according to RFC-6979. - // Signature scheme must be either UNSPECIFIED or ECDSA_RFC6979_SHA256. - Signature *grpc1.Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` + Signature *grpc1.SignatureRFC6979 `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` } func (x *DeleteRequest_Body) Reset() { @@ -1173,7 +1171,7 @@ func (x *DeleteRequest_Body) GetContainerId() *grpc1.ContainerID { return nil } -func (x *DeleteRequest_Body) GetSignature() *grpc1.Signature { +func (x *DeleteRequest_Body) GetSignature() *grpc1.SignatureRFC6979 { if x != nil { return x.Signature } @@ -1279,8 +1277,7 @@ type GetResponse_Body struct { // Requested container structure Container *Container `protobuf:"bytes,1,opt,name=container,proto3" json:"container,omitempty"` // Signature of a stable-marshalled container according to RFC-6979. - // Signature scheme must be either UNSPECIFIED or ECDSA_RFC6979_SHA256. - Signature *grpc1.Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` + Signature *grpc1.SignatureRFC6979 `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` // Session token if the container was created within a session SessionToken *grpc.SessionToken `protobuf:"bytes,3,opt,name=session_token,json=sessionToken,proto3" json:"session_token,omitempty"` } @@ -1324,7 +1321,7 @@ func (x *GetResponse_Body) GetContainer() *Container { return nil } -func (x *GetResponse_Body) GetSignature() *grpc1.Signature { +func (x *GetResponse_Body) GetSignature() *grpc1.SignatureRFC6979 { if x != nil { return x.Signature } @@ -1446,8 +1443,7 @@ type SetExtendedACLRequest_Body struct { // Extended ACL table to set for container Eacl *grpc2.EACLTable `protobuf:"bytes,1,opt,name=eacl,proto3" json:"eacl,omitempty"` // Signature of stable-marshalled Extended ACL table according to RFC-6979. - // Signature scheme must be either UNSPECIFIED or ECDSA_RFC6979_SHA256. - Signature *grpc1.Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` + Signature *grpc1.SignatureRFC6979 `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` } func (x *SetExtendedACLRequest_Body) Reset() { @@ -1489,7 +1485,7 @@ func (x *SetExtendedACLRequest_Body) GetEacl() *grpc2.EACLTable { return nil } -func (x *SetExtendedACLRequest_Body) GetSignature() *grpc1.Signature { +func (x *SetExtendedACLRequest_Body) GetSignature() *grpc1.SignatureRFC6979 { if x != nil { return x.Signature } @@ -1597,8 +1593,7 @@ type GetExtendedACLResponse_Body struct { // Extended ACL requested, if available Eacl *grpc2.EACLTable `protobuf:"bytes,1,opt,name=eacl,proto3" json:"eacl,omitempty"` // Signature of stable-marshalled Extended ACL according to RFC-6979. - // Signature scheme must be either UNSPECIFIED or ECDSA_RFC6979_SHA256. - Signature *grpc1.Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` + Signature *grpc1.SignatureRFC6979 `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` // Session token if Extended ACL was set within a session SessionToken *grpc.SessionToken `protobuf:"bytes,3,opt,name=session_token,json=sessionToken,proto3" json:"session_token,omitempty"` } @@ -1642,7 +1637,7 @@ func (x *GetExtendedACLResponse_Body) GetEacl() *grpc2.EACLTable { return nil } -func (x *GetExtendedACLResponse_Body) GetSignature() *grpc1.Signature { +func (x *GetExtendedACLResponse_Body) GetSignature() *grpc1.SignatureRFC6979 { if x != nil { return x.Signature } @@ -1826,7 +1821,7 @@ var file_container_grpc_service_proto_rawDesc = []byte{ 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x15, 0x72, 0x65, 0x66, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x18, 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, 0xdf, 0x02, 0x0a, 0x0a, 0x50, 0x75, 0x74, 0x52, 0x65, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xe7, 0x02, 0x0a, 0x0a, 0x50, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x38, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x75, 0x74, 0x52, 0x65, 0x71, @@ -1840,56 +1835,57 @@ var file_container_grpc_service_proto_rawDesc = []byte{ 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, 0x7d, 0x0a, 0x04, 0x42, 0x6f, 0x64, - 0x79, 0x12, 0x3c, 0x0a, 0x09, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 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, 0x52, 0x09, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x12, - 0x37, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, - 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, - 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x22, 0xac, 0x02, 0x0a, 0x0b, 0x50, 0x75, 0x74, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 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, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x75, 0x74, - 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, - 0x46, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x3e, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x61, - 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, - 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, - 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, - 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x64, 0x22, 0xe7, 0x02, 0x0a, 0x0d, 0x44, 0x65, 0x6c, 0x65, - 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x3b, 0x0a, 0x04, 0x62, 0x6f, 0x64, - 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, - 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x44, 0x65, - 0x6c, 0x65, 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, 0x7f, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x3e, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, - 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, - 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, - 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x52, 0x0b, 0x63, 0x6f, 0x6e, - 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x64, 0x12, 0x37, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, - 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, - 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, - 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, + 0x69, 0x66, 0x79, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x1a, 0x84, 0x01, 0x0a, 0x04, 0x42, 0x6f, + 0x64, 0x79, 0x12, 0x3c, 0x0a, 0x09, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 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, 0x52, 0x09, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, + 0x12, 0x3e, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, + 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x46, + 0x43, 0x36, 0x39, 0x37, 0x39, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, + 0x22, 0xac, 0x02, 0x0a, 0x0b, 0x50, 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 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, 0x63, 0x6f, 0x6e, 0x74, 0x61, + 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x75, 0x74, 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, 0x46, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, + 0x3e, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, + 0x49, 0x44, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x64, 0x22, + 0xef, 0x02, 0x0a, 0x0d, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x3b, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x27, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, + 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x44, 0x65, 0x6c, 0x65, 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, 0x86, 0x01, 0x0a, 0x04, 0x42, 0x6f, 0x64, + 0x79, 0x12, 0x3e, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, + 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, + 0x65, 0x72, 0x49, 0x44, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, + 0x64, 0x12, 0x3e, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, + 0x46, 0x43, 0x36, 0x39, 0x37, 0x39, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x22, 0xf2, 0x01, 0x0a, 0x0e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3c, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, @@ -1924,7 +1920,7 @@ var file_container_grpc_service_proto_rawDesc = []byte{ 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, - 0x64, 0x22, 0xaa, 0x03, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x64, 0x22, 0xb1, 0x03, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 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, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, @@ -1938,148 +1934,62 @@ var file_container_grpc_service_proto_rawDesc = []byte{ 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, 0xc3, 0x01, 0x0a, 0x04, 0x42, 0x6f, 0x64, + 0x66, 0x79, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x1a, 0xca, 0x01, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x3c, 0x0a, 0x09, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 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, 0x52, 0x09, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x12, - 0x37, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, - 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, - 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x44, 0x0a, 0x0d, 0x73, 0x65, 0x73, 0x73, - 0x69, 0x6f, 0x6e, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, - 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, - 0x52, 0x0c, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x9e, - 0x02, 0x0a, 0x0b, 0x4c, 0x69, 0x73, 0x74, 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, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, - 0x65, 0x72, 0x2e, 0x4c, 0x69, 0x73, 0x74, 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, + 0x3e, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, + 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x46, 0x43, + 0x36, 0x39, 0x37, 0x39, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, + 0x44, 0x0a, 0x0d, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, + 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, + 0x6f, 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x0c, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, + 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x9e, 0x02, 0x0a, 0x0b, 0x4c, 0x69, 0x73, 0x74, 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, + 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x4c, 0x69, 0x73, 0x74, 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, 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, - 0xb0, 0x02, 0x0a, 0x0c, 0x4c, 0x69, 0x73, 0x74, 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, 0x63, 0x6f, 0x6e, 0x74, 0x61, - 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x4c, 0x69, 0x73, 0x74, 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, 0x48, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, - 0x12, 0x40, 0x0a, 0x0d, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, - 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, - 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, - 0x65, 0x72, 0x49, 0x44, 0x52, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, - 0x64, 0x73, 0x22, 0xe5, 0x02, 0x0a, 0x15, 0x53, 0x65, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, - 0x65, 0x64, 0x41, 0x43, 0x4c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x43, 0x0a, 0x04, - 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x6e, 0x65, 0x6f, - 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, - 0x2e, 0x53, 0x65, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x41, 0x43, 0x4c, 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, 0x6d, 0x0a, 0x04, 0x42, - 0x6f, 0x64, 0x79, 0x12, 0x2c, 0x0a, 0x04, 0x65, 0x61, 0x63, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, - 0x6c, 0x2e, 0x45, 0x41, 0x43, 0x4c, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x52, 0x04, 0x65, 0x61, 0x63, - 0x6c, 0x12, 0x37, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, - 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, - 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x22, 0x82, 0x02, 0x0a, 0x16, 0x53, - 0x65, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x41, 0x43, 0x4c, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x44, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x30, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, - 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x53, 0x65, 0x74, 0x45, 0x78, 0x74, - 0x65, 0x6e, 0x64, 0x65, 0x64, 0x41, 0x43, 0x4c, 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, 0x06, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x22, - 0xbe, 0x02, 0x0a, 0x15, 0x47, 0x65, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x41, - 0x43, 0x4c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x43, 0x0a, 0x04, 0x62, 0x6f, 0x64, - 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, - 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x47, 0x65, + 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, 0xb0, 0x02, 0x0a, 0x0c, 0x4c, 0x69, 0x73, 0x74, 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, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x4c, 0x69, 0x73, 0x74, + 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, + 0x48, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x40, 0x0a, 0x0d, 0x63, 0x6f, 0x6e, 0x74, 0x61, + 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, + 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x52, 0x0c, 0x63, 0x6f, 0x6e, + 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x64, 0x73, 0x22, 0xec, 0x02, 0x0a, 0x15, 0x53, 0x65, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x41, 0x43, 0x4c, 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, 0x46, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, - 0x12, 0x3e, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, - 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, - 0x72, 0x49, 0x44, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x64, - 0x22, 0xb0, 0x03, 0x0a, 0x16, 0x47, 0x65, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, - 0x41, 0x43, 0x4c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x44, 0x0a, 0x04, 0x62, - 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x30, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, - 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, - 0x47, 0x65, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x41, 0x43, 0x4c, 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, 0xb3, 0x01, - 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x2c, 0x0a, 0x04, 0x65, 0x61, 0x63, 0x6c, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, - 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x45, 0x41, 0x43, 0x4c, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x52, 0x04, - 0x65, 0x61, 0x63, 0x6c, 0x12, 0x37, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, - 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, - 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, - 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x44, 0x0a, - 0x0d, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, - 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, - 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x0c, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x6f, - 0x6b, 0x65, 0x6e, 0x22, 0xf2, 0x03, 0x0a, 0x18, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, - 0x55, 0x73, 0x65, 0x64, 0x53, 0x70, 0x61, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x12, 0x46, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x32, - 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, - 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x55, 0x73, 0x65, - 0x64, 0x53, 0x70, 0x61, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x42, 0x6f, + 0x65, 0x73, 0x74, 0x12, 0x43, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x2f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, + 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x53, 0x65, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, + 0x64, 0x65, 0x64, 0x41, 0x43, 0x4c, 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, @@ -2090,27 +2000,55 @@ var file_container_grpc_service_proto_rawDesc = []byte{ 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, 0xf3, 0x01, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x65, 0x0a, 0x0d, 0x61, - 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x3f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, - 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, - 0x65, 0x55, 0x73, 0x65, 0x64, 0x53, 0x70, 0x61, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x2e, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x6d, - 0x65, 0x6e, 0x74, 0x52, 0x0d, 0x61, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x6d, 0x65, 0x6e, - 0x74, 0x73, 0x1a, 0x83, 0x01, 0x0a, 0x0c, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x6d, - 0x65, 0x6e, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x04, 0x52, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x12, 0x3e, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, - 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, - 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x52, 0x0b, 0x63, 0x6f, - 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x75, 0x73, 0x65, - 0x64, 0x5f, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x75, - 0x73, 0x65, 0x64, 0x53, 0x70, 0x61, 0x63, 0x65, 0x22, 0x88, 0x02, 0x0a, 0x19, 0x41, 0x6e, 0x6e, - 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x55, 0x73, 0x65, 0x64, 0x53, 0x70, 0x61, 0x63, 0x65, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x47, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x33, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, - 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x41, 0x6e, 0x6e, 0x6f, 0x75, - 0x6e, 0x63, 0x65, 0x55, 0x73, 0x65, 0x64, 0x53, 0x70, 0x61, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, + 0x65, 0x72, 0x1a, 0x74, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x2c, 0x0a, 0x04, 0x65, 0x61, + 0x63, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x45, 0x41, 0x43, 0x4c, 0x54, 0x61, 0x62, + 0x6c, 0x65, 0x52, 0x04, 0x65, 0x61, 0x63, 0x6c, 0x12, 0x3e, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, + 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6e, 0x65, + 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, + 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x46, 0x43, 0x36, 0x39, 0x37, 0x39, 0x52, 0x09, 0x73, + 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x22, 0x82, 0x02, 0x0a, 0x16, 0x53, 0x65, 0x74, + 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x41, 0x43, 0x4c, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x44, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x30, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, + 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x53, 0x65, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, + 0x64, 0x65, 0x64, 0x41, 0x43, 0x4c, 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, 0x06, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x22, 0xbe, 0x02, + 0x0a, 0x15, 0x47, 0x65, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x41, 0x43, 0x4c, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x43, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x74, 0x45, + 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x41, 0x43, 0x4c, 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, 0x46, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x3e, + 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, + 0x44, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x64, 0x22, 0xb7, + 0x03, 0x0a, 0x16, 0x47, 0x65, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x41, 0x43, + 0x4c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x44, 0x0a, 0x04, 0x62, 0x6f, 0x64, + 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x30, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, + 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x47, 0x65, + 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x41, 0x43, 0x4c, 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, @@ -2121,55 +2059,115 @@ var file_container_grpc_service_proto_rawDesc = []byte{ 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, 0x06, 0x0a, 0x04, 0x42, - 0x6f, 0x64, 0x79, 0x32, 0x90, 0x05, 0x0a, 0x10, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, - 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x48, 0x0a, 0x03, 0x50, 0x75, 0x74, 0x12, - 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, - 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, - 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x51, 0x0a, 0x06, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x12, 0x22, 0x2e, 0x6e, - 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, - 0x65, 0x72, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x23, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, - 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x48, 0x0a, 0x03, 0x47, 0x65, 0x74, 0x12, 0x1f, 0x2e, 0x6e, - 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, - 0x65, 0x72, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, - 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, - 0x6e, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, - 0x4b, 0x0a, 0x04, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, - 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x4c, 0x69, - 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, - 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, - 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x69, 0x0a, 0x0e, - 0x53, 0x65, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x41, 0x43, 0x4c, 0x12, 0x2a, - 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, - 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x53, 0x65, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, - 0x41, 0x43, 0x4c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2b, 0x2e, 0x6e, 0x65, 0x6f, - 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, - 0x2e, 0x53, 0x65, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x41, 0x43, 0x4c, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x69, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x45, 0x78, - 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x41, 0x43, 0x4c, 0x12, 0x2a, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, - 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, - 0x47, 0x65, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x41, 0x43, 0x4c, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, - 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x74, 0x45, - 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x41, 0x43, 0x4c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x72, 0x0a, 0x11, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x55, 0x73, - 0x65, 0x64, 0x53, 0x70, 0x61, 0x63, 0x65, 0x12, 0x2d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, + 0x65, 0x72, 0x69, 0x66, 0x79, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x1a, 0xba, 0x01, 0x0a, 0x04, + 0x42, 0x6f, 0x64, 0x79, 0x12, 0x2c, 0x0a, 0x04, 0x65, 0x61, 0x63, 0x6c, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, + 0x63, 0x6c, 0x2e, 0x45, 0x41, 0x43, 0x4c, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x52, 0x04, 0x65, 0x61, + 0x63, 0x6c, 0x12, 0x3e, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, + 0x52, 0x46, 0x43, 0x36, 0x39, 0x37, 0x39, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, + 0x72, 0x65, 0x12, 0x44, 0x0a, 0x0d, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x74, 0x6f, + 0x6b, 0x65, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, + 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x65, + 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x0c, 0x73, 0x65, 0x73, 0x73, + 0x69, 0x6f, 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0xf2, 0x03, 0x0a, 0x18, 0x41, 0x6e, 0x6e, + 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x55, 0x73, 0x65, 0x64, 0x53, 0x70, 0x61, 0x63, 0x65, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x46, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x32, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, + 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, + 0x63, 0x65, 0x55, 0x73, 0x65, 0x64, 0x53, 0x70, 0x61, 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, 0xf3, 0x01, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, + 0x12, 0x65, 0x0a, 0x0d, 0x61, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x6d, 0x65, 0x6e, 0x74, + 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x3f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x55, 0x73, 0x65, 0x64, 0x53, 0x70, 0x61, 0x63, 0x65, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2e, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, - 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x41, 0x6e, 0x6e, - 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x55, 0x73, 0x65, 0x64, 0x53, 0x70, 0x61, 0x63, 0x65, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x5f, 0x5a, 0x3d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, - 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, - 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 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, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x2e, 0x41, 0x6e, 0x6e, 0x6f, + 0x75, 0x6e, 0x63, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x0d, 0x61, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, + 0x63, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x1a, 0x83, 0x01, 0x0a, 0x0c, 0x41, 0x6e, 0x6e, 0x6f, + 0x75, 0x6e, 0x63, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x70, 0x6f, 0x63, + 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x12, 0x3e, + 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, + 0x44, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1d, + 0x0a, 0x0a, 0x75, 0x73, 0x65, 0x64, 0x5f, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x04, 0x52, 0x09, 0x75, 0x73, 0x65, 0x64, 0x53, 0x70, 0x61, 0x63, 0x65, 0x22, 0x88, 0x02, + 0x0a, 0x19, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x55, 0x73, 0x65, 0x64, 0x53, 0x70, + 0x61, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x47, 0x0a, 0x04, 0x62, + 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x33, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, + 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, + 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x55, 0x73, 0x65, 0x64, 0x53, 0x70, 0x61, 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, 0x06, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x32, 0x90, 0x05, 0x0a, 0x10, 0x43, 0x6f, 0x6e, + 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x48, 0x0a, + 0x03, 0x50, 0x75, 0x74, 0x12, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x75, 0x74, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x75, 0x74, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x51, 0x0a, 0x06, 0x44, 0x65, 0x6c, 0x65, 0x74, + 0x65, 0x12, 0x22, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, + 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x44, 0x65, 0x6c, 0x65, + 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x48, 0x0a, 0x03, 0x47, 0x65, + 0x74, 0x12, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, + 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, + 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4b, 0x0a, 0x04, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x20, 0x2e, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, + 0x65, 0x72, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, + 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x69, 0x0a, 0x0e, 0x53, 0x65, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, + 0x41, 0x43, 0x4c, 0x12, 0x2a, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, + 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x53, 0x65, 0x74, 0x45, 0x78, 0x74, + 0x65, 0x6e, 0x64, 0x65, 0x64, 0x41, 0x43, 0x4c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x2b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, + 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x53, 0x65, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, + 0x64, 0x41, 0x43, 0x4c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x69, 0x0a, 0x0e, + 0x47, 0x65, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x41, 0x43, 0x4c, 0x12, 0x2a, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, + 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, + 0x41, 0x43, 0x4c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2b, 0x2e, 0x6e, 0x65, 0x6f, + 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, + 0x2e, 0x47, 0x65, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x41, 0x43, 0x4c, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x72, 0x0a, 0x11, 0x41, 0x6e, 0x6e, 0x6f, 0x75, + 0x6e, 0x63, 0x65, 0x55, 0x73, 0x65, 0x64, 0x53, 0x70, 0x61, 0x63, 0x65, 0x12, 0x2d, 0x2e, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, + 0x65, 0x72, 0x2e, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x55, 0x73, 0x65, 0x64, 0x53, + 0x70, 0x61, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2e, 0x2e, 0x6e, 0x65, + 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, + 0x72, 0x2e, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x55, 0x73, 0x65, 0x64, 0x53, 0x70, + 0x61, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x5f, 0x5a, 0x3d, 0x67, + 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, + 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, + 0x2f, 0x76, 0x32, 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, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -2220,7 +2218,7 @@ var file_container_grpc_service_proto_goTypes = []interface{}{ (*grpc.ResponseMetaHeader)(nil), // 31: neo.fs.v2.session.ResponseMetaHeader (*grpc.ResponseVerificationHeader)(nil), // 32: neo.fs.v2.session.ResponseVerificationHeader (*Container)(nil), // 33: neo.fs.v2.container.Container - (*grpc1.Signature)(nil), // 34: neo.fs.v2.refs.Signature + (*grpc1.SignatureRFC6979)(nil), // 34: neo.fs.v2.refs.SignatureRFC6979 (*grpc1.ContainerID)(nil), // 35: neo.fs.v2.refs.ContainerID (*grpc.SessionToken)(nil), // 36: neo.fs.v2.session.SessionToken (*grpc1.OwnerID)(nil), // 37: neo.fs.v2.refs.OwnerID @@ -2270,21 +2268,21 @@ var file_container_grpc_service_proto_depIdxs = []int32{ 31, // 40: neo.fs.v2.container.AnnounceUsedSpaceResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader 32, // 41: neo.fs.v2.container.AnnounceUsedSpaceResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader 33, // 42: neo.fs.v2.container.PutRequest.Body.container:type_name -> neo.fs.v2.container.Container - 34, // 43: neo.fs.v2.container.PutRequest.Body.signature:type_name -> neo.fs.v2.refs.Signature + 34, // 43: neo.fs.v2.container.PutRequest.Body.signature:type_name -> neo.fs.v2.refs.SignatureRFC6979 35, // 44: neo.fs.v2.container.PutResponse.Body.container_id:type_name -> neo.fs.v2.refs.ContainerID 35, // 45: neo.fs.v2.container.DeleteRequest.Body.container_id:type_name -> neo.fs.v2.refs.ContainerID - 34, // 46: neo.fs.v2.container.DeleteRequest.Body.signature:type_name -> neo.fs.v2.refs.Signature + 34, // 46: neo.fs.v2.container.DeleteRequest.Body.signature:type_name -> neo.fs.v2.refs.SignatureRFC6979 35, // 47: neo.fs.v2.container.GetRequest.Body.container_id:type_name -> neo.fs.v2.refs.ContainerID 33, // 48: neo.fs.v2.container.GetResponse.Body.container:type_name -> neo.fs.v2.container.Container - 34, // 49: neo.fs.v2.container.GetResponse.Body.signature:type_name -> neo.fs.v2.refs.Signature + 34, // 49: neo.fs.v2.container.GetResponse.Body.signature:type_name -> neo.fs.v2.refs.SignatureRFC6979 36, // 50: neo.fs.v2.container.GetResponse.Body.session_token:type_name -> neo.fs.v2.session.SessionToken 37, // 51: neo.fs.v2.container.ListRequest.Body.owner_id:type_name -> neo.fs.v2.refs.OwnerID 35, // 52: neo.fs.v2.container.ListResponse.Body.container_ids:type_name -> neo.fs.v2.refs.ContainerID 38, // 53: neo.fs.v2.container.SetExtendedACLRequest.Body.eacl:type_name -> neo.fs.v2.acl.EACLTable - 34, // 54: neo.fs.v2.container.SetExtendedACLRequest.Body.signature:type_name -> neo.fs.v2.refs.Signature + 34, // 54: neo.fs.v2.container.SetExtendedACLRequest.Body.signature:type_name -> neo.fs.v2.refs.SignatureRFC6979 35, // 55: neo.fs.v2.container.GetExtendedACLRequest.Body.container_id:type_name -> neo.fs.v2.refs.ContainerID 38, // 56: neo.fs.v2.container.GetExtendedACLResponse.Body.eacl:type_name -> neo.fs.v2.acl.EACLTable - 34, // 57: neo.fs.v2.container.GetExtendedACLResponse.Body.signature:type_name -> neo.fs.v2.refs.Signature + 34, // 57: neo.fs.v2.container.GetExtendedACLResponse.Body.signature:type_name -> neo.fs.v2.refs.SignatureRFC6979 36, // 58: neo.fs.v2.container.GetExtendedACLResponse.Body.session_token:type_name -> neo.fs.v2.session.SessionToken 27, // 59: neo.fs.v2.container.AnnounceUsedSpaceRequest.Body.announcements:type_name -> neo.fs.v2.container.AnnounceUsedSpaceRequest.Body.Announcement 35, // 60: neo.fs.v2.container.AnnounceUsedSpaceRequest.Body.Announcement.container_id:type_name -> neo.fs.v2.refs.ContainerID diff --git a/container/types.go b/container/types.go index ea7fd9c..4da1723 100644 --- a/container/types.go +++ b/container/types.go @@ -316,6 +316,8 @@ func (r *PutRequestBody) GetSignature() *refs.Signature { func (r *PutRequestBody) SetSignature(v *refs.Signature) { if r != nil { + // TODO: (neofs-api-go#381) avoid this hack (e.g. create refs.SignatureRFC6979 type) + v.SetScheme(0) r.sig = v } } @@ -434,6 +436,8 @@ func (r *GetResponseBody) GetSignature() *refs.Signature { // SetSignature sets signature of the requested container. func (r *GetResponseBody) SetSignature(v *refs.Signature) { if r != nil { + // TODO: (neofs-api-go#381) avoid this hack (e.g. create refs.SignatureRFC6979 type) + v.SetScheme(0) r.sig = v } } @@ -476,6 +480,8 @@ func (r *DeleteRequestBody) GetSignature() *refs.Signature { func (r *DeleteRequestBody) SetSignature(v *refs.Signature) { if r != nil { + // TODO: (neofs-api-go#381) avoid this hack (e.g. create refs.SignatureRFC6979 type) + v.SetScheme(0) r.sig = v } } @@ -588,6 +594,8 @@ func (r *SetExtendedACLRequestBody) GetSignature() *refs.Signature { func (r *SetExtendedACLRequestBody) SetSignature(v *refs.Signature) { if r != nil { + // TODO: (neofs-api-go#381) avoid this hack (e.g. create refs.SignatureRFC6979 type) + v.SetScheme(0) r.sig = v } } @@ -672,6 +680,8 @@ func (r *GetExtendedACLResponseBody) GetSignature() *refs.Signature { func (r *GetExtendedACLResponseBody) SetSignature(v *refs.Signature) { if r != nil { + // TODO: (neofs-api-go#381) avoid this hack (e.g. create refs.SignatureRFC6979 type) + v.SetScheme(0) r.sig = v } } diff --git a/refs/grpc/types.go b/refs/grpc/types.go index b1c48c1..e191656 100644 --- a/refs/grpc/types.go +++ b/refs/grpc/types.go @@ -84,6 +84,20 @@ func (x *Signature) SetScheme(s SignatureScheme) { } } +// SetKey sets public key in a binary format. +func (x *SignatureRFC6979) SetKey(v []byte) { + if x != nil { + x.Key = v + } +} + +// SetSign sets signature. +func (x *SignatureRFC6979) SetSign(v []byte) { + if x != nil { + x.Sign = v + } +} + // FromString parses SignatureScheme from a string representation, // It is a reverse action to String(). // diff --git a/refs/grpc/types.pb.go b/refs/grpc/types.pb.go index 7df2f05..96f6285 100644 --- a/refs/grpc/types.pb.go +++ b/refs/grpc/types.pb.go @@ -24,25 +24,21 @@ const ( type SignatureScheme int32 const ( - // Unknown. The default interpretation depends on a particular structure type. - SignatureScheme_UNSPECIFIED SignatureScheme = 0 - // ECDSA with SHA-512 hashing (FIPS 186-3). - SignatureScheme_ECDSA_SHA512 SignatureScheme = 1 + // ECDSA with SHA-512 hashing (FIPS 186-3) + SignatureScheme_ECDSA_SHA512 SignatureScheme = 0 // Deterministic ECDSA with SHA-256 hashing (RFC 6979) - SignatureScheme_ECDSA_RFC6979_SHA256 SignatureScheme = 2 + SignatureScheme_ECDSA_RFC6979_SHA256 SignatureScheme = 1 ) // Enum value maps for SignatureScheme. var ( SignatureScheme_name = map[int32]string{ - 0: "UNSPECIFIED", - 1: "ECDSA_SHA512", - 2: "ECDSA_RFC6979_SHA256", + 0: "ECDSA_SHA512", + 1: "ECDSA_RFC6979_SHA256", } SignatureScheme_value = map[string]int32{ - "UNSPECIFIED": 0, - "ECDSA_SHA512": 1, - "ECDSA_RFC6979_SHA256": 2, + "ECDSA_SHA512": 0, + "ECDSA_RFC6979_SHA256": 1, } ) @@ -501,7 +497,7 @@ type Signature struct { Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` // Signature Sign []byte `protobuf:"bytes,2,opt,name=sign,json=signature,proto3" json:"sign,omitempty"` - // Scheme contains digital signature scheme identifier. + // Scheme contains digital signature scheme identifier Scheme SignatureScheme `protobuf:"varint,3,opt,name=scheme,proto3,enum=neo.fs.v2.refs.SignatureScheme" json:"scheme,omitempty"` } @@ -555,7 +551,65 @@ func (x *Signature) GetScheme() SignatureScheme { if x != nil { return x.Scheme } - return SignatureScheme_UNSPECIFIED + return SignatureScheme_ECDSA_SHA512 +} + +// RFC 6979 signature. +type SignatureRFC6979 struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Public key used for signing + Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + // Deterministic ECDSA with SHA-256 hashing + Sign []byte `protobuf:"bytes,2,opt,name=sign,json=signature,proto3" json:"sign,omitempty"` +} + +func (x *SignatureRFC6979) Reset() { + *x = SignatureRFC6979{} + if protoimpl.UnsafeEnabled { + mi := &file_refs_grpc_types_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SignatureRFC6979) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SignatureRFC6979) ProtoMessage() {} + +func (x *SignatureRFC6979) ProtoReflect() protoreflect.Message { + mi := &file_refs_grpc_types_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SignatureRFC6979.ProtoReflect.Descriptor instead. +func (*SignatureRFC6979) Descriptor() ([]byte, []int) { + return file_refs_grpc_types_proto_rawDescGZIP(), []int{7} +} + +func (x *SignatureRFC6979) GetKey() []byte { + if x != nil { + return x.Key + } + return nil +} + +func (x *SignatureRFC6979) GetSign() []byte { + if x != nil { + return x.Sign + } + return nil } // Checksum message. @@ -579,7 +633,7 @@ type Checksum struct { func (x *Checksum) Reset() { *x = Checksum{} if protoimpl.UnsafeEnabled { - mi := &file_refs_grpc_types_proto_msgTypes[7] + mi := &file_refs_grpc_types_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -592,7 +646,7 @@ func (x *Checksum) String() string { func (*Checksum) ProtoMessage() {} func (x *Checksum) ProtoReflect() protoreflect.Message { - mi := &file_refs_grpc_types_proto_msgTypes[7] + mi := &file_refs_grpc_types_proto_msgTypes[8] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -605,7 +659,7 @@ func (x *Checksum) ProtoReflect() protoreflect.Message { // Deprecated: Use Checksum.ProtoReflect.Descriptor instead. func (*Checksum) Descriptor() ([]byte, []int) { - return file_refs_grpc_types_proto_rawDescGZIP(), []int{7} + return file_refs_grpc_types_proto_rawDescGZIP(), []int{8} } func (x *Checksum) GetType() ChecksumType { @@ -654,27 +708,30 @@ var file_refs_grpc_types_proto_rawDesc = []byte{ 0x75, 0x72, 0x65, 0x12, 0x37, 0x0a, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x63, - 0x68, 0x65, 0x6d, 0x65, 0x52, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x22, 0x4e, 0x0a, 0x08, - 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x12, 0x30, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, - 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, - 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x75, - 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x03, 0x73, 0x75, 0x6d, 0x2a, 0x4e, 0x0a, 0x0f, - 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x12, - 0x0f, 0x0a, 0x0b, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, - 0x12, 0x10, 0x0a, 0x0c, 0x45, 0x43, 0x44, 0x53, 0x41, 0x5f, 0x53, 0x48, 0x41, 0x35, 0x31, 0x32, - 0x10, 0x01, 0x12, 0x18, 0x0a, 0x14, 0x45, 0x43, 0x44, 0x53, 0x41, 0x5f, 0x52, 0x46, 0x43, 0x36, - 0x39, 0x37, 0x39, 0x5f, 0x53, 0x48, 0x41, 0x32, 0x35, 0x36, 0x10, 0x02, 0x2a, 0x41, 0x0a, 0x0c, - 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1d, 0x0a, 0x19, - 0x43, 0x48, 0x45, 0x43, 0x4b, 0x53, 0x55, 0x4d, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, - 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x06, 0x0a, 0x02, 0x54, - 0x5a, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x53, 0x48, 0x41, 0x32, 0x35, 0x36, 0x10, 0x02, 0x42, - 0x50, 0x5a, 0x33, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, - 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, - 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x72, 0x65, 0x66, 0x73, 0x2f, 0x67, 0x72, 0x70, - 0x63, 0x3b, 0x72, 0x65, 0x66, 0x73, 0xaa, 0x02, 0x18, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, - 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x52, 0x65, 0x66, - 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x68, 0x65, 0x6d, 0x65, 0x52, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x22, 0x3d, 0x0a, 0x10, + 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x46, 0x43, 0x36, 0x39, 0x37, 0x39, + 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x03, 0x6b, + 0x65, 0x79, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x69, 0x67, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, + 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x22, 0x4e, 0x0a, 0x08, 0x43, + 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x12, 0x30, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x54, + 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x75, 0x6d, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x03, 0x73, 0x75, 0x6d, 0x2a, 0x3d, 0x0a, 0x0f, 0x53, + 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x12, 0x10, + 0x0a, 0x0c, 0x45, 0x43, 0x44, 0x53, 0x41, 0x5f, 0x53, 0x48, 0x41, 0x35, 0x31, 0x32, 0x10, 0x00, + 0x12, 0x18, 0x0a, 0x14, 0x45, 0x43, 0x44, 0x53, 0x41, 0x5f, 0x52, 0x46, 0x43, 0x36, 0x39, 0x37, + 0x39, 0x5f, 0x53, 0x48, 0x41, 0x32, 0x35, 0x36, 0x10, 0x01, 0x2a, 0x41, 0x0a, 0x0c, 0x43, 0x68, + 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1d, 0x0a, 0x19, 0x43, 0x48, + 0x45, 0x43, 0x4b, 0x53, 0x55, 0x4d, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, + 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x06, 0x0a, 0x02, 0x54, 0x5a, 0x10, + 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x53, 0x48, 0x41, 0x32, 0x35, 0x36, 0x10, 0x02, 0x42, 0x50, 0x5a, + 0x33, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, + 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, + 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x72, 0x65, 0x66, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, + 0x72, 0x65, 0x66, 0x73, 0xaa, 0x02, 0x18, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, + 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x52, 0x65, 0x66, 0x73, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -690,18 +747,19 @@ func file_refs_grpc_types_proto_rawDescGZIP() []byte { } var file_refs_grpc_types_proto_enumTypes = make([]protoimpl.EnumInfo, 2) -var file_refs_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 8) +var file_refs_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 9) var file_refs_grpc_types_proto_goTypes = []interface{}{ - (SignatureScheme)(0), // 0: neo.fs.v2.refs.SignatureScheme - (ChecksumType)(0), // 1: neo.fs.v2.refs.ChecksumType - (*Address)(nil), // 2: neo.fs.v2.refs.Address - (*ObjectID)(nil), // 3: neo.fs.v2.refs.ObjectID - (*ContainerID)(nil), // 4: neo.fs.v2.refs.ContainerID - (*OwnerID)(nil), // 5: neo.fs.v2.refs.OwnerID - (*SubnetID)(nil), // 6: neo.fs.v2.refs.SubnetID - (*Version)(nil), // 7: neo.fs.v2.refs.Version - (*Signature)(nil), // 8: neo.fs.v2.refs.Signature - (*Checksum)(nil), // 9: neo.fs.v2.refs.Checksum + (SignatureScheme)(0), // 0: neo.fs.v2.refs.SignatureScheme + (ChecksumType)(0), // 1: neo.fs.v2.refs.ChecksumType + (*Address)(nil), // 2: neo.fs.v2.refs.Address + (*ObjectID)(nil), // 3: neo.fs.v2.refs.ObjectID + (*ContainerID)(nil), // 4: neo.fs.v2.refs.ContainerID + (*OwnerID)(nil), // 5: neo.fs.v2.refs.OwnerID + (*SubnetID)(nil), // 6: neo.fs.v2.refs.SubnetID + (*Version)(nil), // 7: neo.fs.v2.refs.Version + (*Signature)(nil), // 8: neo.fs.v2.refs.Signature + (*SignatureRFC6979)(nil), // 9: neo.fs.v2.refs.SignatureRFC6979 + (*Checksum)(nil), // 10: neo.fs.v2.refs.Checksum } var file_refs_grpc_types_proto_depIdxs = []int32{ 4, // 0: neo.fs.v2.refs.Address.container_id:type_name -> neo.fs.v2.refs.ContainerID @@ -806,6 +864,18 @@ func file_refs_grpc_types_proto_init() { } } file_refs_grpc_types_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SignatureRFC6979); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_refs_grpc_types_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Checksum); i { case 0: return &v.state @@ -824,7 +894,7 @@ func file_refs_grpc_types_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_refs_grpc_types_proto_rawDesc, NumEnums: 2, - NumMessages: 8, + NumMessages: 9, NumExtensions: 0, NumServices: 0, }, diff --git a/refs/types.go b/refs/types.go index dbe307a..7d89881 100644 --- a/refs/types.go +++ b/refs/types.go @@ -35,8 +35,7 @@ type SignatureScheme uint32 //nolint:revive const ( - UnspecifiedScheme SignatureScheme = iota - ECDSA_SHA512 + ECDSA_SHA512 SignatureScheme = iota ECDSA_RFC6979_SHA256 ) @@ -189,7 +188,7 @@ func (s *Signature) GetScheme() SignatureScheme { if s != nil { return s.scheme } - return UnspecifiedScheme + return 0 } func (s *Signature) SetScheme(scheme SignatureScheme) { diff --git a/util/signature/data.go b/util/signature/data.go index ee2d7ad..cd02d88 100644 --- a/util/signature/data.go +++ b/util/signature/data.go @@ -41,13 +41,13 @@ func SignDataWithHandler(key *ecdsa.PrivateKey, src DataSource, handler KeySigna opts[i](cfg) } - sigData, err := sign(cfg, cfg.defaultScheme, key, data) + sigData, err := sign(cfg, key, data) if err != nil { return err } sig := new(refs.Signature) - sig.SetScheme(cfg.defaultScheme) + sig.SetScheme(cfg.scheme) sig.SetKey(crypto.MarshalPublicKey(&key.PublicKey)) sig.SetSign(sigData) handler(sig) diff --git a/util/signature/options.go b/util/signature/options.go index c77c290..dd38986 100644 --- a/util/signature/options.go +++ b/util/signature/options.go @@ -9,51 +9,45 @@ import ( ) type cfg struct { - defaultScheme refs.SignatureScheme - restrictScheme refs.SignatureScheme + schemeFixed bool + scheme refs.SignatureScheme } func defaultCfg() *cfg { - return &cfg{ - defaultScheme: refs.ECDSA_SHA512, - restrictScheme: refs.UnspecifiedScheme, - } + return new(cfg) } func verify(cfg *cfg, data []byte, sig *refs.Signature) error { - scheme := sig.GetScheme() - if scheme == refs.UnspecifiedScheme { - scheme = cfg.defaultScheme - } - if cfg.restrictScheme != refs.UnspecifiedScheme && scheme != cfg.restrictScheme { - return fmt.Errorf("%w: unexpected signature scheme", crypto.ErrInvalidSignature) + if !cfg.schemeFixed { + cfg.scheme = sig.GetScheme() } pub := crypto.UnmarshalPublicKey(sig.GetKey()) - switch scheme { + + switch cfg.scheme { case refs.ECDSA_SHA512: return crypto.Verify(pub, data, sig.GetSign()) case refs.ECDSA_RFC6979_SHA256: return crypto.VerifyRFC6979(pub, data, sig.GetSign()) default: - return crypto.ErrInvalidSignature + return fmt.Errorf("unsupported signature scheme %s", cfg.scheme) } } -func sign(cfg *cfg, scheme refs.SignatureScheme, key *ecdsa.PrivateKey, data []byte) ([]byte, error) { - switch scheme { +func sign(cfg *cfg, key *ecdsa.PrivateKey, data []byte) ([]byte, error) { + switch cfg.scheme { case refs.ECDSA_SHA512: return crypto.Sign(key, data) case refs.ECDSA_RFC6979_SHA256: return crypto.SignRFC6979(key, data) default: - panic("unsupported scheme") + panic(fmt.Sprintf("unsupported scheme %s", cfg.scheme)) } } func SignWithRFC6979() SignOption { return func(c *cfg) { - c.defaultScheme = refs.ECDSA_RFC6979_SHA256 - c.restrictScheme = refs.ECDSA_RFC6979_SHA256 + c.schemeFixed = true + c.scheme = refs.ECDSA_RFC6979_SHA256 } } From 204126893e170a857474aec75bb38d21be17c9fe Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Mon, 28 Feb 2022 14:45:35 +0300 Subject: [PATCH 0965/1196] [#376] object: add benchmarks for attributes marshal/unmarshal Signed-off-by: Evgenii Stratonikov --- object/bench_test.go | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 object/bench_test.go diff --git a/object/bench_test.go b/object/bench_test.go new file mode 100644 index 0000000..417c0df --- /dev/null +++ b/object/bench_test.go @@ -0,0 +1,43 @@ +package object + +import ( + "math/rand" + "testing" +) + +func randString(n int) string { + x := make([]byte, n) + for i := range x { + x[i] = byte('a' + rand.Intn('z'-'a')) + } + return string(x) +} + +func BenchmarkAttributesMarshal(b *testing.B) { + attrs := make([]*Attribute, 50) + for i := range attrs { + attrs[i] = new(Attribute) + attrs[i].key = SysAttributePrefix + randString(10) + attrs[i].val = randString(10) + } + raw := AttributesToGRPC(attrs) + + b.Run("marshal", func(b *testing.B) { + b.ReportAllocs() + for i := 0; i < b.N; i++ { + res := AttributesToGRPC(attrs) + if len(res) != len(raw) { + b.FailNow() + } + } + }) + b.Run("unmarshal", func(b *testing.B) { + b.ReportAllocs() + for i := 0; i < b.N; i++ { + res, err := AttributesFromGRPC(raw) + if err != nil || len(res) != len(raw) { + b.FailNow() + } + } + }) +} From fadd47f4fb43b8d4f2f358b96afd78431f2f3631 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Mon, 28 Feb 2022 15:06:51 +0300 Subject: [PATCH 0966/1196] [#376] object: remove pointer from Attribute slice MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ``` name old time/op new time/op delta AttributesMarshal/marshal-8 4.44µs ± 9% 2.72µs ± 0% -38.79% (p=0.000 n=10+9) AttributesMarshal/unmarshal-8 3.16µs ±13% 0.55µs ± 4% -82.60% (p=0.000 n=10+10) name old alloc/op new alloc/op delta AttributesMarshal/marshal-8 4.42kB ± 0% 4.42kB ± 0% ~ (all equal) AttributesMarshal/unmarshal-8 2.02kB ± 0% 1.79kB ± 0% -11.11% (p=0.000 n=10+10) name old allocs/op new allocs/op delta AttributesMarshal/marshal-8 51.0 ± 0% 51.0 ± 0% ~ (all equal) AttributesMarshal/unmarshal-8 51.0 ± 0% 1.0 ± 0% -98.04% (p=0.000 n=10+10) ``` Signed-off-by: Evgenii Stratonikov --- object/attributes.go | 22 ++++++++-------------- object/attributes_test.go | 2 +- object/bench_test.go | 6 ++++-- object/convert.go | 14 ++++---------- object/marshal.go | 4 ++-- object/test/generate.go | 8 ++++---- object/types.go | 6 +++--- 7 files changed, 26 insertions(+), 36 deletions(-) diff --git a/object/attributes.go b/object/attributes.go index 2e701bc..cc82873 100644 --- a/object/attributes.go +++ b/object/attributes.go @@ -108,26 +108,20 @@ func WriteNotificationInfo(o *Object, ni NotificationInfo) { attrs = attrs[:len(attrs)-1] } - notifyAttrs := make([]*Attribute, 0, 2) - if !changedEpoch { - eAttr := new(Attribute) - eAttr.SetKey(SysAttributeTickEpoch) - eAttr.SetValue(epoch) - - notifyAttrs = append(notifyAttrs, eAttr) + index := len(attrs) + attrs = append(attrs, Attribute{}) + attrs[index].SetKey(SysAttributeTickEpoch) + attrs[index].SetValue(epoch) } if !changedTopic && topic != "" { - tAttr := new(Attribute) - tAttr.SetKey(SysAttributeTickTopic) - tAttr.SetValue(topic) - - notifyAttrs = append(notifyAttrs, tAttr) + index := len(attrs) + attrs = append(attrs, Attribute{}) + attrs[index].SetKey(SysAttributeTickTopic) + attrs[index].SetValue(topic) } - attrs = append(attrs, notifyAttrs...) - h.SetAttributes(attrs) } diff --git a/object/attributes_test.go b/object/attributes_test.go index 8556f13..5bf411a 100644 --- a/object/attributes_test.go +++ b/object/attributes_test.go @@ -42,7 +42,7 @@ func TestSetNotification(t *testing.T) { func TestGetNotification(t *testing.T) { o := new(Object) - attr := []*Attribute{ + attr := []Attribute{ {SysAttributeTickEpoch, "10"}, {SysAttributeTickTopic, "test"}, } diff --git a/object/bench_test.go b/object/bench_test.go index 417c0df..90fab73 100644 --- a/object/bench_test.go +++ b/object/bench_test.go @@ -3,6 +3,8 @@ package object import ( "math/rand" "testing" + + "github.com/stretchr/testify/require" ) func randString(n int) string { @@ -14,13 +16,13 @@ func randString(n int) string { } func BenchmarkAttributesMarshal(b *testing.B) { - attrs := make([]*Attribute, 50) + attrs := make([]Attribute, 50) for i := range attrs { - attrs[i] = new(Attribute) attrs[i].key = SysAttributePrefix + randString(10) attrs[i].val = randString(10) } raw := AttributesToGRPC(attrs) + require.Equal(b, len(raw), len(attrs)) b.Run("marshal", func(b *testing.B) { b.ReportAllocs() diff --git a/object/convert.go b/object/convert.go index 80213df..d574e79 100644 --- a/object/convert.go +++ b/object/convert.go @@ -142,7 +142,7 @@ 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)) @@ -154,23 +154,17 @@ func AttributesToGRPC(xs []*Attribute) (res []*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, 0, len(xs)) + res = make([]Attribute, len(xs)) for i := range xs { - var x *Attribute - if xs[i] != nil { - x = new(Attribute) - - err = x.FromGRPCMessage(xs[i]) + err = res[i].FromGRPCMessage(xs[i]) if err != nil { return } } - - res = append(res, x) } } diff --git a/object/marshal.go b/object/marshal.go index 44783f0..24d8d86 100644 --- a/object/marshal.go +++ b/object/marshal.go @@ -394,7 +394,7 @@ func (h *Header) StableMarshal(buf []byte) ([]byte, error) { offset += n for i := range h.attr { - n, err = proto.NestedStructureMarshal(hdrAttributesField, buf[offset:], h.attr[i]) + n, err = proto.NestedStructureMarshal(hdrAttributesField, buf[offset:], &h.attr[i]) if err != nil { return nil, err } @@ -425,7 +425,7 @@ func (h *Header) StableSize() (size int) { size += proto.NestedStructureSize(hdrHomomorphicHashField, h.homoHash) size += proto.NestedStructureSize(hdrSessionTokenField, h.sessionToken) for i := range h.attr { - size += proto.NestedStructureSize(hdrAttributesField, h.attr[i]) + size += proto.NestedStructureSize(hdrAttributesField, &h.attr[i]) } size += proto.NestedStructureSize(hdrSplitField, h.split) diff --git a/object/test/generate.go b/object/test/generate.go index d2f80cb..298bc9a 100644 --- a/object/test/generate.go +++ b/object/test/generate.go @@ -35,13 +35,13 @@ func GenerateAttribute(empty bool) *object.Attribute { return m } -func GenerateAttributes(empty bool) []*object.Attribute { - var res []*object.Attribute +func GenerateAttributes(empty bool) []object.Attribute { + var res []object.Attribute if !empty { res = append(res, - GenerateAttribute(false), - GenerateAttribute(false), + *GenerateAttribute(false), + *GenerateAttribute(false), ) } diff --git a/object/types.go b/object/types.go index ed3cdff..596ed3e 100644 --- a/object/types.go +++ b/object/types.go @@ -56,7 +56,7 @@ type Header struct { sessionToken *session.Token - attr []*Attribute + attr []Attribute split *SplitHeader } @@ -654,7 +654,7 @@ func (h *Header) SetSessionToken(v *session.Token) { } } -func (h *Header) GetAttributes() []*Attribute { +func (h *Header) GetAttributes() []Attribute { if h != nil { return h.attr } @@ -662,7 +662,7 @@ func (h *Header) GetAttributes() []*Attribute { return nil } -func (h *Header) SetAttributes(v []*Attribute) { +func (h *Header) SetAttributes(v []Attribute) { if h != nil { h.attr = v } From 50382114f40a1cc766f96dcdd03de685d5b98032 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Wed, 9 Mar 2022 12:56:02 +0300 Subject: [PATCH 0967/1196] [#383] rpc/client: Export URI-parsing function Signed-off-by: Evgenii Stratonikov --- rpc/client/connect.go | 33 +++++++++++++++++++++++++++++++++ rpc/client/options.go | 37 ++++++++++++------------------------- 2 files changed, 45 insertions(+), 25 deletions(-) diff --git a/rpc/client/connect.go b/rpc/client/connect.go index 1e36623..8b7db4f 100644 --- a/rpc/client/connect.go +++ b/rpc/client/connect.go @@ -3,6 +3,9 @@ package client import ( "context" "errors" + "fmt" + "net" + "net/url" "github.com/nspcc-dev/neofs-api-go/v2/rpc/grpc" grpcstd "google.golang.org/grpc" @@ -52,3 +55,33 @@ func (c *Client) openGRPCConn() error { return err } + +// ParseURI parses s as address and returns a host and a flag +// indicating that TLS is enabled. If multi-address is provided +// the argument is returned unchanged. +func ParseURI(s string) (string, bool, error) { + uri, err := url.ParseRequestURI(s) + if err != nil { + return s, false, nil + } + + // check if passed string was parsed correctly + // URIs that do not start with a slash after the scheme are interpreted as: + // `scheme:opaque` => if `opaque` is not empty, then it is supposed that URI + // is in `host:port` format + if uri.Host == "" { + uri.Host = uri.Scheme + uri.Scheme = grpcScheme // assume GRPC by default + if uri.Opaque != "" { + uri.Host = net.JoinHostPort(uri.Host, uri.Opaque) + } + } + + switch uri.Scheme { + case grpcTLSScheme, grpcScheme: + default: + return "", false, fmt.Errorf("unsupported scheme: %s", uri.Scheme) + } + + return uri.Host, uri.Scheme == grpcTLSScheme, nil +} diff --git a/rpc/client/options.go b/rpc/client/options.go index 2c276dc..f04fc9e 100644 --- a/rpc/client/options.go +++ b/rpc/client/options.go @@ -2,7 +2,6 @@ package client import ( "crypto/tls" - "net/url" "time" "google.golang.org/grpc" @@ -58,35 +57,23 @@ func WithNetworkAddress(v string) Option { // // Ignored if WithGRPCConn is provided. func WithNetworkURIAddress(addr string, tlsCfg *tls.Config) []Option { - uri, err := url.ParseRequestURI(addr) + host, isTLS, err := ParseURI(addr) if err != nil { - return []Option{WithNetworkAddress(addr)} - } - - // check if passed string was parsed correctly - // URIs that do not start with a slash after the scheme are interpreted as: - // `scheme:opaque` => if `opaque` is not empty, then it is supposed that URI - // is in `host:port` format - if uri.Opaque != "" { - return []Option{WithNetworkAddress(addr)} - } - - switch uri.Scheme { - case grpcScheme: - tlsCfg = nil - case grpcTLSScheme: - if tlsCfg == nil { - tlsCfg = &tls.Config{} - } - default: - // not supported scheme return nil } - return []Option{ - WithNetworkAddress(uri.Host), - WithTLSCfg(tlsCfg), + opts := make([]Option, 2) + opts[0] = WithNetworkAddress(host) + if isTLS { + if tlsCfg == nil { + tlsCfg = &tls.Config{} + } + opts[1] = WithTLSCfg(tlsCfg) + } else { + opts[1] = WithTLSCfg(nil) } + + return opts } // WithDialTimeout returns option to specify From 529d636ede63d4e6386bbf2b059f63d96d75d704 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Tue, 1 Mar 2022 15:44:34 +0300 Subject: [PATCH 0968/1196] [#376] refs: Add benchmarks for ObjectID slice conversions Signed-off-by: Evgenii Stratonikov --- refs/bench_test.go | 54 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 refs/bench_test.go diff --git a/refs/bench_test.go b/refs/bench_test.go new file mode 100644 index 0000000..dc5b393 --- /dev/null +++ b/refs/bench_test.go @@ -0,0 +1,54 @@ +package refs + +import ( + "math/rand" + "strconv" + "testing" +) + +func BenchmarkObjectIDSlice(b *testing.B) { + for _, size := range []int{0, 1, 50} { + b.Run(strconv.Itoa(size)+" elements", func(b *testing.B) { + benchmarkObjectIDSlice(b, size) + }) + } +} + +func benchmarkObjectIDSlice(b *testing.B, size int) { + ids := make([]*ObjectID, size) + for i := range ids { + ids[i] = new(ObjectID) + ids[i].val = make([]byte, 32) + rand.Read(ids[i].val) + } + raw := ObjectIDListToGRPCMessage(ids) + + b.Run("to grpc message", func(b *testing.B) { + b.ReportAllocs() + for i := 0; i < b.N; i++ { + raw := ObjectIDListToGRPCMessage(ids) + if len(raw) != len(ids) { + b.FailNow() + } + } + }) + b.Run("from grpc message", func(b *testing.B) { + b.ReportAllocs() + for i := 0; i < b.N; i++ { + ids, err := ObjectIDListFromGRPCMessage(raw) + if err != nil || len(raw) != len(ids) { + b.FailNow() + } + } + }) + b.Run("marshal", func(b *testing.B) { + b.ReportAllocs() + for i := 0; i < b.N; i++ { + buf := make([]byte, ObjectIDNestedListSize(1, ids)) + _, err := ObjectIDNestedListMarshal(1, buf, ids) + if err != nil { + b.FailNow() + } + } + }) +} From 84daaf59eff0c0eafb2fe5780989a7712fe857fb Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Tue, 1 Mar 2022 15:50:09 +0300 Subject: [PATCH 0969/1196] [#376] refs: Replace []*ObjectID with []ObjectID MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ``` ObjectIDSlice/0_elements/to_grpc_message-8 5.64ns ± 2% 5.89ns ± 4% +4.56% (p=0.000 n=10+10) ObjectIDSlice/0_elements/from_grpc_message-8 6.68ns ± 3% 6.81ns ± 8% ~ (p=0.143 n=10+10) ObjectIDSlice/0_elements/marshal-8 7.41ns ± 3% 7.91ns ± 4% +6.63% (p=0.000 n=10+10) ObjectIDSlice/1_elements/to_grpc_message-8 69.8ns ± 3% 80.5ns ± 7% +15.39% (p=0.000 n=10+10) ObjectIDSlice/1_elements/from_grpc_message-8 56.4ns ± 6% 34.7ns ± 5% -38.55% (p=0.000 n=10+9) ObjectIDSlice/1_elements/marshal-8 68.4ns ± 4% 67.6ns ± 4% ~ (p=0.404 n=10+10) ObjectIDSlice/50_elements/to_grpc_message-8 2.52µs ± 7% 2.56µs ± 4% ~ (p=0.315 n=10+9) ObjectIDSlice/50_elements/from_grpc_message-8 1.83µs ± 8% 0.44µs ± 1% -75.73% (p=0.000 n=10+8) ObjectIDSlice/50_elements/marshal-8 2.32µs ±17% 2.22µs ± 3% ~ (p=0.247 n=10+10) name old alloc/op new alloc/op delta ObjectIDSlice/0_elements/to_grpc_message-8 0.00B 0.00B ~ (all equal) ObjectIDSlice/0_elements/from_grpc_message-8 0.00B 0.00B ~ (all equal) ObjectIDSlice/0_elements/marshal-8 0.00B 0.00B ~ (all equal) ObjectIDSlice/1_elements/to_grpc_message-8 72.0B ± 0% 72.0B ± 0% ~ (all equal) ObjectIDSlice/1_elements/from_grpc_message-8 32.0B ± 0% 24.0B ± 0% -25.00% (p=0.000 n=10+10) ObjectIDSlice/1_elements/marshal-8 48.0B ± 0% 48.0B ± 0% ~ (all equal) ObjectIDSlice/50_elements/to_grpc_message-8 3.62kB ± 0% 3.62kB ± 0% ~ (all equal) ObjectIDSlice/50_elements/from_grpc_message-8 1.62kB ± 0% 1.28kB ± 0% -20.79% (p=0.000 n=10+10) ObjectIDSlice/50_elements/marshal-8 2.05kB ± 0% 2.05kB ± 0% ~ (all equal) name old allocs/op new allocs/op delta ObjectIDSlice/0_elements/to_grpc_message-8 0.00 0.00 ~ (all equal) ObjectIDSlice/0_elements/from_grpc_message-8 0.00 0.00 ~ (all equal) ObjectIDSlice/0_elements/marshal-8 0.00 0.00 ~ (all equal) ObjectIDSlice/1_elements/to_grpc_message-8 2.00 ± 0% 2.00 ± 0% ~ (all equal) ObjectIDSlice/1_elements/from_grpc_message-8 2.00 ± 0% 1.00 ± 0% -50.00% (p=0.000 n=10+10) ObjectIDSlice/1_elements/marshal-8 1.00 ± 0% 1.00 ± 0% ~ (all equal) ObjectIDSlice/50_elements/to_grpc_message-8 51.0 ± 0% 51.0 ± 0% ~ (all equal) ObjectIDSlice/50_elements/from_grpc_message-8 51.0 ± 0% 1.0 ± 0% -98.04% (p=0.000 n=10+10) ObjectIDSlice/50_elements/marshal-8 1.00 ± 0% 1.00 ± 0% ~ (all equal) ``` Signed-off-by: Evgenii Stratonikov --- audit/types.go | 10 +++++----- object/types.go | 12 ++++++------ refs/bench_test.go | 3 +-- refs/convert.go | 14 ++++---------- refs/marshal.go | 8 ++++---- refs/test/generate.go | 8 ++++---- storagegroup/types.go | 6 +++--- tombstone/marshal.go | 5 ++--- tombstone/types.go | 6 +++--- 9 files changed, 32 insertions(+), 40 deletions(-) diff --git a/audit/types.go b/audit/types.go index 35aa52a..8245b2a 100644 --- a/audit/types.go +++ b/audit/types.go @@ -19,7 +19,7 @@ type DataAuditResult struct { pubKey []byte - passSG, failSG []*refs.ObjectID + passSG, failSG []refs.ObjectID failNodes, passNodes [][]byte @@ -91,7 +91,7 @@ func (a *DataAuditResult) SetPublicKey(v []byte) { } // GetPassSG returns list of Storage Groups that passed audit PoR stage. -func (a *DataAuditResult) GetPassSG() []*refs.ObjectID { +func (a *DataAuditResult) GetPassSG() []refs.ObjectID { if a != nil { return a.passSG } @@ -100,14 +100,14 @@ func (a *DataAuditResult) GetPassSG() []*refs.ObjectID { } // SetPassSG sets list of Storage Groups that passed audit PoR stage. -func (a *DataAuditResult) SetPassSG(v []*refs.ObjectID) { +func (a *DataAuditResult) SetPassSG(v []refs.ObjectID) { if a != nil { a.passSG = v } } // GetFailSG returns list of Storage Groups that failed audit PoR stage. -func (a *DataAuditResult) GetFailSG() []*refs.ObjectID { +func (a *DataAuditResult) GetFailSG() []refs.ObjectID { if a != nil { return a.failSG } @@ -116,7 +116,7 @@ func (a *DataAuditResult) GetFailSG() []*refs.ObjectID { } // SetFailSG sets list of Storage Groups that failed audit PoR stage. -func (a *DataAuditResult) SetFailSG(v []*refs.ObjectID) { +func (a *DataAuditResult) SetFailSG(v []refs.ObjectID) { if a != nil { a.failSG = v } diff --git a/object/types.go b/object/types.go index 596ed3e..63002bc 100644 --- a/object/types.go +++ b/object/types.go @@ -34,7 +34,7 @@ type SplitHeader struct { parHdr *Header - children []*refs.ObjectID + children []refs.ObjectID splitID []byte } @@ -228,7 +228,7 @@ type SearchRequest struct { } type SearchResponseBody struct { - idList []*refs.ObjectID + idList []refs.ObjectID } type SearchResponse struct { @@ -500,7 +500,7 @@ func (h *SplitHeader) SetParentHeader(v *Header) { } } -func (h *SplitHeader) GetChildren() []*refs.ObjectID { +func (h *SplitHeader) GetChildren() []refs.ObjectID { if h != nil { return h.children } @@ -508,7 +508,7 @@ func (h *SplitHeader) GetChildren() []*refs.ObjectID { return nil } -func (h *SplitHeader) SetChildren(v []*refs.ObjectID) { +func (h *SplitHeader) SetChildren(v []refs.ObjectID) { if h != nil { h.children = v } @@ -1316,7 +1316,7 @@ func (r *SearchRequest) SetBody(v *SearchRequestBody) { } } -func (r *SearchResponseBody) GetIDList() []*refs.ObjectID { +func (r *SearchResponseBody) GetIDList() []refs.ObjectID { if r != nil { return r.idList } @@ -1324,7 +1324,7 @@ func (r *SearchResponseBody) GetIDList() []*refs.ObjectID { return nil } -func (r *SearchResponseBody) SetIDList(v []*refs.ObjectID) { +func (r *SearchResponseBody) SetIDList(v []refs.ObjectID) { if r != nil { r.idList = v } diff --git a/refs/bench_test.go b/refs/bench_test.go index dc5b393..aed5f79 100644 --- a/refs/bench_test.go +++ b/refs/bench_test.go @@ -15,9 +15,8 @@ func BenchmarkObjectIDSlice(b *testing.B) { } func benchmarkObjectIDSlice(b *testing.B, size int) { - ids := make([]*ObjectID, size) + ids := make([]ObjectID, size) for i := range ids { - ids[i] = new(ObjectID) ids[i].val = make([]byte, 32) rand.Read(ids[i].val) } diff --git a/refs/convert.go b/refs/convert.go index bb6e988..feb851f 100644 --- a/refs/convert.go +++ b/refs/convert.go @@ -110,7 +110,7 @@ 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)) @@ -122,23 +122,17 @@ func ObjectIDListToGRPCMessage(ids []*ObjectID) (res []*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, 0, len(idsV2)) + res = make([]ObjectID, len(idsV2)) for i := range idsV2 { - var id *ObjectID - if idsV2[i] != nil { - id = new(ObjectID) - - err = id.FromGRPCMessage(idsV2[i]) + err = res[i].FromGRPCMessage(idsV2[i]) if err != nil { return } } - - res = append(res, id) } } diff --git a/refs/marshal.go b/refs/marshal.go index c496221..aa04b63 100644 --- a/refs/marshal.go +++ b/refs/marshal.go @@ -104,9 +104,9 @@ func (o *ObjectID) StableMarshal(buf []byte) ([]byte, error) { // ObjectIDNestedListSize returns byte length of nested // repeated ObjectID field with fNum number. -func ObjectIDNestedListSize(fNum int64, ids []*ObjectID) (sz int) { +func ObjectIDNestedListSize(fNum int64, ids []ObjectID) (sz int) { for i := range ids { - sz += proto.NestedStructureSize(fNum, ids[i]) + sz += proto.NestedStructureSize(fNum, &ids[i]) } return @@ -122,11 +122,11 @@ func (o *ObjectID) StableSize() int { // ObjectIDNestedListMarshal writes protobuf repeated ObjectID field // with fNum number to buf. -func ObjectIDNestedListMarshal(fNum int64, buf []byte, ids []*ObjectID) (off int, err error) { +func ObjectIDNestedListMarshal(fNum int64, buf []byte, ids []ObjectID) (off int, err error) { for i := range ids { var n int - n, err = proto.NestedStructureMarshal(fNum, buf[off:], ids[i]) + n, err = proto.NestedStructureMarshal(fNum, buf[off:], &ids[i]) if err != nil { return } diff --git a/refs/test/generate.go b/refs/test/generate.go index 3912ffa..7a142e3 100644 --- a/refs/test/generate.go +++ b/refs/test/generate.go @@ -48,13 +48,13 @@ func GenerateObjectID(empty bool) *refs.ObjectID { return m } -func GenerateObjectIDs(empty bool) []*refs.ObjectID { - var ids []*refs.ObjectID +func GenerateObjectIDs(empty bool) []refs.ObjectID { + var ids []refs.ObjectID if !empty { ids = append(ids, - GenerateObjectID(false), - GenerateObjectID(false), + *GenerateObjectID(false), + *GenerateObjectID(false), ) } diff --git a/storagegroup/types.go b/storagegroup/types.go index 6c493ed..38f66f6 100644 --- a/storagegroup/types.go +++ b/storagegroup/types.go @@ -13,7 +13,7 @@ type StorageGroup struct { exp uint64 - members []*refs.ObjectID + members []refs.ObjectID } // GetValidationDataSize of unified storage group structure. @@ -66,7 +66,7 @@ func (s *StorageGroup) SetExpirationEpoch(v uint64) { // GetMembers of unified storage group structure. Members are objects of // storage group. -func (s *StorageGroup) GetMembers() []*refs.ObjectID { +func (s *StorageGroup) GetMembers() []refs.ObjectID { if s != nil { return s.members } @@ -76,7 +76,7 @@ func (s *StorageGroup) GetMembers() []*refs.ObjectID { // SetMembers into unified storage group structure. Members are objects of // storage group. -func (s *StorageGroup) SetMembers(v []*refs.ObjectID) { +func (s *StorageGroup) SetMembers(v []refs.ObjectID) { if s != nil { s.members = v } diff --git a/tombstone/marshal.go b/tombstone/marshal.go index f39d5d9..cd778b9 100644 --- a/tombstone/marshal.go +++ b/tombstone/marshal.go @@ -43,7 +43,7 @@ func (s *Tombstone) StableMarshal(buf []byte) ([]byte, error) { offset += n for i := range s.members { - n, err = proto.NestedStructureMarshal(membersFNum, buf[offset:], s.members[i]) + n, err = proto.NestedStructureMarshal(membersFNum, buf[offset:], &s.members[i]) if err != nil { return nil, err } @@ -62,9 +62,8 @@ func (s *Tombstone) StableSize() (size int) { size += proto.UInt64Size(expFNum, s.exp) size += proto.BytesSize(splitIDFNum, s.splitID) - for i := range s.members { - size += proto.NestedStructureSize(membersFNum, s.members[i]) + size += proto.NestedStructureSize(membersFNum, &s.members[i]) } return size diff --git a/tombstone/types.go b/tombstone/types.go index 2bcc19d..6cce852 100644 --- a/tombstone/types.go +++ b/tombstone/types.go @@ -11,7 +11,7 @@ type Tombstone struct { splitID []byte - members []*refs.ObjectID + members []refs.ObjectID } // GetExpirationEpoch returns number of tombstone expiration epoch. @@ -47,7 +47,7 @@ func (s *Tombstone) SetSplitID(v []byte) { } // GetMembers returns list of objects to be deleted. -func (s *Tombstone) GetMembers() []*refs.ObjectID { +func (s *Tombstone) GetMembers() []refs.ObjectID { if s != nil { return s.members } @@ -56,7 +56,7 @@ func (s *Tombstone) GetMembers() []*refs.ObjectID { } // SetMembers sets list of objects to be deleted. -func (s *Tombstone) SetMembers(v []*refs.ObjectID) { +func (s *Tombstone) SetMembers(v []refs.ObjectID) { if s != nil { s.members = v } From 4a70c4210472c98ee85b58e52876043287f526dd Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Tue, 1 Mar 2022 16:22:10 +0300 Subject: [PATCH 0970/1196] [#376] acl: Add benchmarks for `Table` conversions Signed-off-by: Evgenii Stratonikov --- acl/bench_test.go | 52 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 acl/bench_test.go diff --git a/acl/bench_test.go b/acl/bench_test.go new file mode 100644 index 0000000..54ec186 --- /dev/null +++ b/acl/bench_test.go @@ -0,0 +1,52 @@ +package acl_test + +import ( + "testing" + + "github.com/nspcc-dev/neofs-api-go/v2/acl" + aclGrpc "github.com/nspcc-dev/neofs-api-go/v2/acl/grpc" + acltest "github.com/nspcc-dev/neofs-api-go/v2/acl/test" +) + +func BenchmarkTable_ToGRPCMessage(b *testing.B) { + const size = 4 + + tb := new(acl.Table) + rs := make([]*acl.Record, size) + for i := range rs { + fs := make([]*acl.HeaderFilter, size) + for j := range fs { + fs[j] = acltest.GenerateFilter(false) + } + ts := make([]*acl.Target, size) + for j := range ts { + ts[j] = acltest.GenerateTarget(false) + } + + rs[i] = new(acl.Record) + rs[i].SetFilters(fs) + rs[i].SetTargets(ts) + } + tb.SetRecords(rs) + + raw := tb.ToGRPCMessage() + + b.Run("to grpc message", func(b *testing.B) { + b.ReportAllocs() + for i := 0; i < b.N; i++ { + raw := tb.ToGRPCMessage() + if len(tb.GetRecords()) != len(raw.(*aclGrpc.EACLTable).Records) { + b.FailNow() + } + } + }) + b.Run("from grpc message", func(b *testing.B) { + b.ReportAllocs() + for i := 0; i < b.N; i++ { + tb := new(acl.Table) + if tb.FromGRPCMessage(raw) != nil { + b.FailNow() + } + } + }) +} From ec484f2fd22a2d25e491bff351498bc369a68051 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Tue, 1 Mar 2022 16:32:54 +0300 Subject: [PATCH 0971/1196] [#376] acl: Replace slices of pointers with raw structs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ``` name old time/op new time/op delta Table_ToGRPCMessage/to_grpc_message-8 2.82µs ± 5% 2.86µs ± 5% ~ (p=0.395 n=10+8) Table_ToGRPCMessage/from_grpc_message-8 2.47µs ± 5% 1.08µs ± 6% -56.16% (p=0.000 n=9+9) name old alloc/op new alloc/op delta Table_ToGRPCMessage/to_grpc_message-8 3.31kB ± 0% 3.31kB ± 0% ~ (all equal) Table_ToGRPCMessage/from_grpc_message-8 1.82kB ± 0% 1.38kB ± 0% -24.56% (p=0.000 n=10+10) name old allocs/op new allocs/op delta Table_ToGRPCMessage/to_grpc_message-8 46.0 ± 0% 46.0 ± 0% ~ (all equal) Table_ToGRPCMessage/from_grpc_message-8 45.0 ± 0% 9.0 ± 0% -80.00% (p=0.000 n=10+10) ``` Signed-off-by: Evgenii Stratonikov --- acl/bench_test.go | 11 +++++------ acl/convert.go | 42 ++++++++++++------------------------------ acl/marshal.go | 12 ++++++------ acl/test/generate.go | 24 ++++++++++++------------ acl/types.go | 18 +++++++++--------- 5 files changed, 44 insertions(+), 63 deletions(-) diff --git a/acl/bench_test.go b/acl/bench_test.go index 54ec186..f0ddd29 100644 --- a/acl/bench_test.go +++ b/acl/bench_test.go @@ -12,18 +12,17 @@ func BenchmarkTable_ToGRPCMessage(b *testing.B) { const size = 4 tb := new(acl.Table) - rs := make([]*acl.Record, size) + rs := make([]acl.Record, size) for i := range rs { - fs := make([]*acl.HeaderFilter, size) + fs := make([]acl.HeaderFilter, size) for j := range fs { - fs[j] = acltest.GenerateFilter(false) + fs[j] = *acltest.GenerateFilter(false) } - ts := make([]*acl.Target, size) + ts := make([]acl.Target, size) for j := range ts { - ts[j] = acltest.GenerateTarget(false) + ts[j] = *acltest.GenerateTarget(false) } - rs[i] = new(acl.Record) rs[i].SetFilters(fs) rs[i].SetTargets(ts) } diff --git a/acl/convert.go b/acl/convert.go index 55b333a..a49aa6b 100644 --- a/acl/convert.go +++ b/acl/convert.go @@ -185,7 +185,7 @@ 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)) @@ -197,23 +197,17 @@ func HeaderFiltersToGRPC(fs []*HeaderFilter) (res []*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, 0, len(fs)) + res = make([]HeaderFilter, len(fs)) for i := range fs { - var x *HeaderFilter - if fs[i] != nil { - x = new(HeaderFilter) - - err = x.FromGRPCMessage(fs[i]) + err = res[i].FromGRPCMessage(fs[i]) if err != nil { return } } - - res = append(res, x) } } @@ -245,7 +239,7 @@ 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)) @@ -257,23 +251,17 @@ func TargetsToGRPC(ts []*Target) (res []*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, 0, len(fs)) + res = make([]Target, len(fs)) for i := range fs { - var x *Target - if fs[i] != nil { - x = new(Target) - - err = x.FromGRPCMessage(fs[i]) + err = res[i].FromGRPCMessage(fs[i]) if err != nil { return } } - - res = append(res, x) } } @@ -319,7 +307,7 @@ 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)) @@ -331,23 +319,17 @@ func RecordsToGRPC(ts []*Record) (res []*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, 0, len(fs)) + res = make([]Record, len(fs)) for i := range fs { - var x *Record - if fs[i] != nil { - x = new(Record) - - err = x.FromGRPCMessage(fs[i]) + err = res[i].FromGRPCMessage(fs[i]) if err != nil { return } } - - res = append(res, x) } } diff --git a/acl/marshal.go b/acl/marshal.go index cfa4470..5ef3676 100644 --- a/acl/marshal.go +++ b/acl/marshal.go @@ -67,7 +67,7 @@ func (t *Table) StableMarshal(buf []byte) ([]byte, error) { offset += n for i := range t.records { - n, err = protoutil.NestedStructureMarshal(tableRecordsField, buf[offset:], t.records[i]) + n, err = protoutil.NestedStructureMarshal(tableRecordsField, buf[offset:], &t.records[i]) if err != nil { return nil, err } @@ -88,7 +88,7 @@ func (t *Table) StableSize() (size int) { size += protoutil.NestedStructureSize(tableContainerIDField, t.cid) for i := range t.records { - size += protoutil.NestedStructureSize(tableRecordsField, t.records[i]) + size += protoutil.NestedStructureSize(tableRecordsField, &t.records[i]) } return size @@ -129,7 +129,7 @@ func (r *Record) StableMarshal(buf []byte) ([]byte, error) { offset += n for i := range r.filters { - n, err = protoutil.NestedStructureMarshal(recordFiltersField, buf[offset:], r.filters[i]) + n, err = protoutil.NestedStructureMarshal(recordFiltersField, buf[offset:], &r.filters[i]) if err != nil { return nil, err } @@ -138,7 +138,7 @@ func (r *Record) StableMarshal(buf []byte) ([]byte, error) { } for i := range r.targets { - n, err = protoutil.NestedStructureMarshal(recordTargetsField, buf[offset:], r.targets[i]) + n, err = protoutil.NestedStructureMarshal(recordTargetsField, buf[offset:], &r.targets[i]) if err != nil { return nil, err } @@ -159,11 +159,11 @@ func (r *Record) StableSize() (size int) { size += protoutil.EnumSize(recordActionField, int32(r.action)) for i := range r.filters { - size += protoutil.NestedStructureSize(recordFiltersField, r.filters[i]) + size += protoutil.NestedStructureSize(recordFiltersField, &r.filters[i]) } for i := range r.targets { - size += protoutil.NestedStructureSize(recordTargetsField, r.targets[i]) + size += protoutil.NestedStructureSize(recordTargetsField, &r.targets[i]) } return size diff --git a/acl/test/generate.go b/acl/test/generate.go index 0f72119..3d90fc9 100644 --- a/acl/test/generate.go +++ b/acl/test/generate.go @@ -42,13 +42,13 @@ func GenerateTable(empty bool) *acl.Table { return m } -func GenerateRecords(empty bool) []*acl.Record { - var rs []*acl.Record +func GenerateRecords(empty bool) []acl.Record { + var rs []acl.Record if !empty { rs = append(rs, - GenerateRecord(false), - GenerateRecord(false), + *GenerateRecord(false), + *GenerateRecord(false), ) } @@ -68,13 +68,13 @@ func GenerateRecord(empty bool) *acl.Record { return m } -func GenerateFilters(empty bool) []*acl.HeaderFilter { - var fs []*acl.HeaderFilter +func GenerateFilters(empty bool) []acl.HeaderFilter { + var fs []acl.HeaderFilter if !empty { fs = append(fs, - GenerateFilter(false), - GenerateFilter(false), + *GenerateFilter(false), + *GenerateFilter(false), ) } @@ -94,13 +94,13 @@ func GenerateFilter(empty bool) *acl.HeaderFilter { return m } -func GenerateTargets(empty bool) []*acl.Target { - var ts []*acl.Target +func GenerateTargets(empty bool) []acl.Target { + var ts []acl.Target if !empty { ts = append(ts, - GenerateTarget(false), - GenerateTarget(false), + *GenerateTarget(false), + *GenerateTarget(false), ) } diff --git a/acl/types.go b/acl/types.go index 58b310d..70994b4 100644 --- a/acl/types.go +++ b/acl/types.go @@ -27,9 +27,9 @@ type Record struct { action Action - filters []*HeaderFilter + filters []HeaderFilter - targets []*Target + targets []Target } // Table is a unified structure of EACLTable @@ -39,7 +39,7 @@ type Table struct { cid *refs.ContainerID - records []*Record + records []Record } type TokenLifetime struct { @@ -224,7 +224,7 @@ func (r *Record) SetAction(v Action) { } } -func (r *Record) GetFilters() []*HeaderFilter { +func (r *Record) GetFilters() []HeaderFilter { if r != nil { return r.filters } @@ -232,13 +232,13 @@ func (r *Record) GetFilters() []*HeaderFilter { return nil } -func (r *Record) SetFilters(v []*HeaderFilter) { +func (r *Record) SetFilters(v []HeaderFilter) { if r != nil { r.filters = v } } -func (r *Record) GetTargets() []*Target { +func (r *Record) GetTargets() []Target { if r != nil { return r.targets } @@ -246,7 +246,7 @@ func (r *Record) GetTargets() []*Target { return nil } -func (r *Record) SetTargets(v []*Target) { +func (r *Record) SetTargets(v []Target) { if r != nil { r.targets = v } @@ -280,7 +280,7 @@ func (t *Table) SetContainerID(v *refs.ContainerID) { } } -func (t *Table) GetRecords() []*Record { +func (t *Table) GetRecords() []Record { if t != nil { return t.records } @@ -288,7 +288,7 @@ func (t *Table) GetRecords() []*Record { return nil } -func (t *Table) SetRecords(v []*Record) { +func (t *Table) SetRecords(v []Record) { if t != nil { t.records = v } From 2f0eee96fcd9d092278fe3e2369115f24248dfad Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Tue, 1 Mar 2022 16:41:42 +0300 Subject: [PATCH 0972/1196] [#376] netmap: Replace slices of pointers with structs Signed-off-by: Evgenii Stratonikov --- netmap/convert.go | 54 ++++++++++++----------------------------- netmap/marshal.go | 20 +++++++-------- netmap/test/generate.go | 34 +++++++++++++------------- netmap/types.go | 30 +++++++++++------------ 4 files changed, 57 insertions(+), 81 deletions(-) diff --git a/netmap/convert.go b/netmap/convert.go index 8325c94..2f1f68b 100644 --- a/netmap/convert.go +++ b/netmap/convert.go @@ -45,7 +45,7 @@ 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)) @@ -57,23 +57,17 @@ func FiltersToGRPC(fs []*Filter) (res []*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, 0, len(fs)) + res = make([]Filter, len(fs)) for i := range fs { - var f *Filter - if fs[i] != nil { - f = new(Filter) - - err = f.FromGRPCMessage(fs[i]) + err = res[i].FromGRPCMessage(fs[i]) if err != nil { return } } - - res = append(res, f) } } @@ -111,7 +105,7 @@ 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)) @@ -123,23 +117,17 @@ func SelectorsToGRPC(ss []*Selector) (res []*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, 0, len(ss)) + res = make([]Selector, len(ss)) for i := range ss { - var s *Selector - if ss[i] != nil { - s = new(Selector) - - err = s.FromGRPCMessage(ss[i]) + err = res[i].FromGRPCMessage(ss[i]) if err != nil { return } } - - res = append(res, s) } } @@ -171,7 +159,7 @@ 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)) @@ -183,23 +171,17 @@ func ReplicasToGRPC(rs []*Replica) (res []*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, 0, len(rs)) + res = make([]Replica, len(rs)) for i := range rs { - var r *Replica - if rs[i] != nil { - r = new(Replica) - - err = r.FromGRPCMessage(rs[i]) + err = res[i].FromGRPCMessage(rs[i]) if err != nil { return } } - - res = append(res, r) } } @@ -583,27 +565,21 @@ func (x *NetworkConfig) FromGRPCMessage(m grpc.Message) error { } var ( - ps []*NetworkParameter + ps []NetworkParameter psV2 = v.GetParameters() ) if psV2 != nil { ln := len(psV2) - ps = make([]*NetworkParameter, 0, ln) + ps = make([]NetworkParameter, ln) for i := 0; i < ln; i++ { - var p *NetworkParameter - if psV2[i] != nil { - p = new(NetworkParameter) - - if err := p.FromGRPCMessage(psV2[i]); err != nil { + if err := ps[i].FromGRPCMessage(psV2[i]); err != nil { return err } } - - ps = append(ps, p) } } diff --git a/netmap/marshal.go b/netmap/marshal.go index b29e750..165af23 100644 --- a/netmap/marshal.go +++ b/netmap/marshal.go @@ -84,7 +84,7 @@ func (f *Filter) StableMarshal(buf []byte) ([]byte, error) { offset += n for i := range f.filters { - n, err = protoutil.NestedStructureMarshal(filtersFilterField, buf[offset:], f.filters[i]) + n, err = protoutil.NestedStructureMarshal(filtersFilterField, buf[offset:], &f.filters[i]) if err != nil { return nil, err } @@ -101,7 +101,7 @@ func (f *Filter) StableSize() (size int) { size += protoutil.EnumSize(opFilterField, int32(f.op)) size += protoutil.StringSize(valueFilterField, f.value) for i := range f.filters { - size += protoutil.NestedStructureSize(filtersFilterField, f.filters[i]) + size += protoutil.NestedStructureSize(filtersFilterField, &f.filters[i]) } return size @@ -230,7 +230,7 @@ func (p *PlacementPolicy) StableMarshal(buf []byte) ([]byte, error) { ) for i := range p.replicas { - n, err = protoutil.NestedStructureMarshal(replicasPolicyField, buf[offset:], p.replicas[i]) + n, err = protoutil.NestedStructureMarshal(replicasPolicyField, buf[offset:], &p.replicas[i]) if err != nil { return nil, err } @@ -246,7 +246,7 @@ func (p *PlacementPolicy) StableMarshal(buf []byte) ([]byte, error) { offset += n for i := range p.selectors { - n, err = protoutil.NestedStructureMarshal(selectorsPolicyField, buf[offset:], p.selectors[i]) + n, err = protoutil.NestedStructureMarshal(selectorsPolicyField, buf[offset:], &p.selectors[i]) if err != nil { return nil, err } @@ -255,7 +255,7 @@ func (p *PlacementPolicy) StableMarshal(buf []byte) ([]byte, error) { } for i := range p.filters { - n, err = protoutil.NestedStructureMarshal(filtersPolicyField, buf[offset:], p.filters[i]) + n, err = protoutil.NestedStructureMarshal(filtersPolicyField, buf[offset:], &p.filters[i]) if err != nil { return nil, err } @@ -273,17 +273,17 @@ func (p *PlacementPolicy) StableMarshal(buf []byte) ([]byte, error) { func (p *PlacementPolicy) StableSize() (size int) { for i := range p.replicas { - size += protoutil.NestedStructureSize(replicasPolicyField, p.replicas[i]) + size += protoutil.NestedStructureSize(replicasPolicyField, &p.replicas[i]) } size += protoutil.UInt32Size(backupPolicyField, p.backupFactor) for i := range p.selectors { - size += protoutil.NestedStructureSize(selectorsPolicyField, p.selectors[i]) + size += protoutil.NestedStructureSize(selectorsPolicyField, &p.selectors[i]) } for i := range p.filters { - size += protoutil.NestedStructureSize(filtersPolicyField, p.filters[i]) + size += protoutil.NestedStructureSize(filtersPolicyField, &p.filters[i]) } size += protoutil.NestedStructureSize(subnetIDPolicyField, p.subnetID) @@ -542,7 +542,7 @@ func (x *NetworkConfig) StableMarshal(buf []byte) ([]byte, error) { ) for i := range x.ps { - n, err = protoutil.NestedStructureMarshal(netCfgPrmsFNum, buf[offset:], x.ps[i]) + n, err = protoutil.NestedStructureMarshal(netCfgPrmsFNum, buf[offset:], &x.ps[i]) if err != nil { return nil, err } @@ -559,7 +559,7 @@ func (x *NetworkConfig) StableSize() (size int) { } for i := range x.ps { - size += protoutil.NestedStructureSize(netCfgPrmsFNum, x.ps[i]) + size += protoutil.NestedStructureSize(netCfgPrmsFNum, &x.ps[i]) } return size diff --git a/netmap/test/generate.go b/netmap/test/generate.go index 93e2ff3..0042dbb 100644 --- a/netmap/test/generate.go +++ b/netmap/test/generate.go @@ -20,9 +20,9 @@ func generateFilter(empty, withSub bool) *netmap.Filter { m.SetOp(1) if withSub { - m.SetFilters([]*netmap.Filter{ - generateFilter(empty, false), - generateFilter(empty, false), + m.SetFilters([]netmap.Filter{ + *generateFilter(empty, false), + *generateFilter(empty, false), }) } } @@ -30,13 +30,13 @@ func generateFilter(empty, withSub bool) *netmap.Filter { return m } -func GenerateFilters(empty bool) []*netmap.Filter { - var res []*netmap.Filter +func GenerateFilters(empty bool) []netmap.Filter { + var res []netmap.Filter if !empty { res = append(res, - GenerateFilter(false), - GenerateFilter(false), + *GenerateFilter(false), + *GenerateFilter(false), ) } @@ -57,13 +57,13 @@ func GenerateSelector(empty bool) *netmap.Selector { return m } -func GenerateSelectors(empty bool) []*netmap.Selector { - var res []*netmap.Selector +func GenerateSelectors(empty bool) []netmap.Selector { + var res []netmap.Selector if !empty { res = append(res, - GenerateSelector(false), - GenerateSelector(false), + *GenerateSelector(false), + *GenerateSelector(false), ) } @@ -81,13 +81,13 @@ func GenerateReplica(empty bool) *netmap.Replica { return m } -func GenerateReplicas(empty bool) []*netmap.Replica { - var res []*netmap.Replica +func GenerateReplicas(empty bool) []netmap.Replica { + var res []netmap.Replica if !empty { res = append(res, - GenerateReplica(false), - GenerateReplica(false), + *GenerateReplica(false), + *GenerateReplica(false), ) } @@ -205,8 +205,8 @@ func GenerateNetworkConfig(empty bool) *netmap.NetworkConfig { if !empty { m.SetParameters( - GenerateNetworkParameter(empty), - GenerateNetworkParameter(empty), + *GenerateNetworkParameter(empty), + *GenerateNetworkParameter(empty), ) } diff --git a/netmap/types.go b/netmap/types.go index dc32805..5282765 100644 --- a/netmap/types.go +++ b/netmap/types.go @@ -36,7 +36,7 @@ type Filter struct { key string op Operation value string - filters []*Filter + filters []Filter } type Selector struct { @@ -55,10 +55,10 @@ type Replica struct { type Operation uint32 type PlacementPolicy struct { - replicas []*Replica + replicas []Replica backupFactor uint32 - selectors []*Selector - filters []*Filter + selectors []Selector + filters []Filter subnetID *refs.SubnetID } @@ -114,7 +114,7 @@ const ( Distinct ) -func (f *Filter) GetFilters() []*Filter { +func (f *Filter) GetFilters() []Filter { if f != nil { return f.filters } @@ -122,7 +122,7 @@ func (f *Filter) GetFilters() []*Filter { return nil } -func (f *Filter) SetFilters(filters []*Filter) { +func (f *Filter) SetFilters(filters []Filter) { if f != nil { f.filters = filters } @@ -281,7 +281,7 @@ func (r *Replica) SetCount(count uint32) { } } -func (p *PlacementPolicy) GetFilters() []*Filter { +func (p *PlacementPolicy) GetFilters() []Filter { if p != nil { return p.filters } @@ -289,13 +289,13 @@ func (p *PlacementPolicy) GetFilters() []*Filter { return nil } -func (p *PlacementPolicy) SetFilters(filters []*Filter) { +func (p *PlacementPolicy) SetFilters(filters []Filter) { if p != nil { p.filters = filters } } -func (p *PlacementPolicy) GetSelectors() []*Selector { +func (p *PlacementPolicy) GetSelectors() []Selector { if p != nil { return p.selectors } @@ -303,7 +303,7 @@ func (p *PlacementPolicy) GetSelectors() []*Selector { return nil } -func (p *PlacementPolicy) SetSelectors(selectors []*Selector) { +func (p *PlacementPolicy) SetSelectors(selectors []Selector) { if p != nil { p.selectors = selectors } @@ -323,11 +323,11 @@ func (p *PlacementPolicy) SetContainerBackupFactor(backupFactor uint32) { } } -func (p *PlacementPolicy) GetReplicas() []*Replica { +func (p *PlacementPolicy) GetReplicas() []Replica { return p.replicas } -func (p *PlacementPolicy) SetReplicas(replicas []*Replica) { +func (p *PlacementPolicy) SetReplicas(replicas []Replica) { p.replicas = replicas } @@ -565,7 +565,7 @@ func (x *NetworkParameter) SetValue(v []byte) { // NetworkConfig represents NeoFS network configuration. type NetworkConfig struct { - ps []*NetworkParameter + ps []NetworkParameter } // NumberOfParameters returns number of network parameters. @@ -584,7 +584,7 @@ func (x *NetworkConfig) NumberOfParameters() int { func (x *NetworkConfig) IterateParameters(f func(*NetworkParameter) bool) { if x != nil { for i := range x.ps { - if f(x.ps[i]) { + if f(&x.ps[i]) { break } } @@ -592,7 +592,7 @@ func (x *NetworkConfig) IterateParameters(f func(*NetworkParameter) bool) { } // SetParameters sets list of network parameters. -func (x *NetworkConfig) SetParameters(v ...*NetworkParameter) { +func (x *NetworkConfig) SetParameters(v ...NetworkParameter) { if x != nil { x.ps = v } From 6f4908edc23cce4d3d63b9c17bace4b70dc8f427 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Wed, 2 Mar 2022 10:40:22 +0300 Subject: [PATCH 0973/1196] [#376] netmap: Make attributes a non-pointer slice MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The speed of copying (which is done regulary for e.g. subnet changes) is less, however it isn't on the hot path and the absolute time difference is insignificant. ``` name old time/op new time/op delta NodeAttributes-8 96.2ns ± 1% 158.3ns ± 1% +64.61% (p=0.000 n=10+10) name old alloc/op new alloc/op delta NodeAttributes-8 32.0B ± 0% 32.0B ± 0% ~ (all equal) name old allocs/op new allocs/op delta NodeAttributes-8 2.00 ± 0% 2.00 ± 0% ~ (all equal) ``` Signed-off-by: Evgenii Stratonikov --- netmap/attributes.go | 20 +++++------ netmap/attributes_test.go | 70 ++++++++++++++++++++++++++++++++++----- netmap/convert.go | 14 +++----- netmap/marshal.go | 4 +-- netmap/test/generate.go | 8 ++--- netmap/types.go | 6 ++-- 6 files changed, 82 insertions(+), 40 deletions(-) diff --git a/netmap/attributes.go b/netmap/attributes.go index 7bfc002..05f4d4a 100644 --- a/netmap/attributes.go +++ b/netmap/attributes.go @@ -101,12 +101,10 @@ func WriteSubnetInfo(node *NodeInfo, info NodeSubnetInfo) { } if !presented { - var attr Attribute - - attr.SetKey(key) - attr.SetValue(val) - - attrs = append(attrs, &attr) + index := len(attrs) + attrs = append(attrs, Attribute{}) + attrs[index].SetKey(key) + attrs[index].SetValue(val) } } @@ -208,12 +206,10 @@ func IterateSubnets(node *NodeInfo, f func(refs.SubnetID) error) error { } // zero subnet should be clearly removed with False value - var attr Attribute - - attr.SetKey(subnetAttributeKey(&id)) - attr.SetValue(attrSubnetValExit) - - attrs = append(attrs, &attr) + index := len(attrs) + attrs = append(attrs, Attribute{}) + attrs[index].SetKey(subnetAttributeKey(&id)) + attrs[index].SetValue(attrSubnetValExit) } else { entries++ } diff --git a/netmap/attributes_test.go b/netmap/attributes_test.go index 93586ac..e485dac 100644 --- a/netmap/attributes_test.go +++ b/netmap/attributes_test.go @@ -5,6 +5,7 @@ import ( "testing" "github.com/nspcc-dev/neofs-api-go/v2/netmap" + netmaptest "github.com/nspcc-dev/neofs-api-go/v2/netmap/test" "github.com/nspcc-dev/neofs-api-go/v2/refs" "github.com/stretchr/testify/require" ) @@ -17,6 +18,57 @@ func assertSubnetAttrKey(t *testing.T, attr *netmap.Attribute, num uint32) { require.Equal(t, subnetAttrKey(strconv.FormatUint(uint64(num), 10)), attr.GetKey()) } +func BenchmarkNodeAttributes(b *testing.B) { + const size = 50 + + id := new(refs.SubnetID) + id.SetValue(12) + + attrs := make([]netmap.Attribute, size) + for i := range attrs { + if i == size/2 { + attrs[i] = *netmaptest.GenerateAttribute(false) + } else { + data, err := id.MarshalText() + require.NoError(b, err) + + attrs[i].SetKey(subnetAttrKey(string(data))) + attrs[i].SetValue("True") + } + } + + var info netmap.NodeSubnetInfo + info.SetID(id) + info.SetEntryFlag(false) + + node := new(netmap.NodeInfo) + + // When using a single slice `StartTimer` overhead is comparable to the + // function execution time, so we reduce this cost by updating slices in groups. + const cacheSize = 1000 + a := make([][]netmap.Attribute, cacheSize) + for i := range a { + a[i] = make([]netmap.Attribute, size) + } + + b.ResetTimer() + b.ReportAllocs() + for i := 0; i < b.N; i++ { + if i%cacheSize == 0 { + b.StopTimer() + for j := range a { + copy(a[j], attrs) + } + b.StartTimer() + } + node.SetAttributes(a[i%cacheSize]) + netmap.WriteSubnetInfo(node, info) + if len(node.GetAttributes())+1 != len(attrs) { + b.FailNow() + } + } +} + func TestWriteSubnetInfo(t *testing.T) { t.Run("entry", func(t *testing.T) { t.Run("zero subnet", func(t *testing.T) { @@ -40,7 +92,7 @@ func TestWriteSubnetInfo(t *testing.T) { attrs = node.GetAttributes() require.Len(t, attrs, 1) - attr := attrs[0] + attr := &attrs[0] assertSubnetAttrKey(t, attr, 0) require.Equal(t, "False", attr.GetValue()) @@ -76,7 +128,7 @@ func TestWriteSubnetInfo(t *testing.T) { attrs := node.GetAttributes() require.Len(t, attrs, 1) - attr := attrs[0] + attr := &attrs[0] assertSubnetAttrKey(t, attr, num) require.Equal(t, "True", attr.GetValue()) @@ -128,7 +180,7 @@ func TestSubnets(t *testing.T) { attrExit.SetKey(subnetAttrKey(strconv.FormatUint(numExit, 10))) attrExit.SetValue("False") - attrs := []*netmap.Attribute{&attrEntry, &attrEntry} + attrs := []netmap.Attribute{attrEntry, attrEntry} node.SetAttributes(attrs) @@ -157,7 +209,7 @@ func TestSubnets(t *testing.T) { assertErr := func(attr netmap.Attribute) { var node netmap.NodeInfo - node.SetAttributes([]*netmap.Attribute{&attr}) + node.SetAttributes([]netmap.Attribute{attr}) require.Error(t, netmap.IterateSubnets(&node, func(refs.SubnetID) error { return nil @@ -200,7 +252,7 @@ func TestSubnets(t *testing.T) { attr.SetKey(subnetAttrKey("321")) attr.SetValue("True") - attrs := []*netmap.Attribute{&attr} + attrs := []netmap.Attribute{attr} node.SetAttributes(attrs) err := netmap.IterateSubnets(&node, func(id refs.SubnetID) error { @@ -237,7 +289,7 @@ func TestSubnets(t *testing.T) { attr.SetKey(subnetAttrKey("99")) attr.SetValue("True") - attrs := []*netmap.Attribute{&attr} + attrs := []netmap.Attribute{attr} node.SetAttributes(attrs) err := netmap.IterateSubnets(&node, func(id refs.SubnetID) error { @@ -257,7 +309,7 @@ func TestSubnets(t *testing.T) { t.Run("all", func(t *testing.T) { var ( node netmap.NodeInfo - attrs []*netmap.Attribute + attrs []netmap.Attribute ) // enter to some non-zero subnet so that zero is not the only one @@ -267,7 +319,7 @@ func TestSubnets(t *testing.T) { attr.SetKey(subnetAttrKey(strconv.Itoa(i))) attr.SetValue("True") - attrs = append(attrs, &attr) + attrs = append(attrs, attr) } node.SetAttributes(attrs) @@ -293,7 +345,7 @@ func TestSubnets(t *testing.T) { attrOther.SetKey(subnetAttrKey("1")) attrOther.SetValue("True") - node.SetAttributes([]*netmap.Attribute{&attrZero, &attrOther}) + node.SetAttributes([]netmap.Attribute{attrZero, attrOther}) calledCount := 0 diff --git a/netmap/convert.go b/netmap/convert.go index 2f1f68b..14c3792 100644 --- a/netmap/convert.go +++ b/netmap/convert.go @@ -297,7 +297,7 @@ 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)) @@ -309,23 +309,17 @@ func AttributesToGRPC(as []*Attribute) (res []*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, 0, len(as)) + res = make([]Attribute, len(as)) for i := range as { - var a *Attribute - if as[i] != nil { - a = new(Attribute) - - err = a.FromGRPCMessage(as[i]) + err = res[i].FromGRPCMessage(as[i]) if err != nil { return } } - - res = append(res, a) } } diff --git a/netmap/marshal.go b/netmap/marshal.go index 165af23..70a8b4c 100644 --- a/netmap/marshal.go +++ b/netmap/marshal.go @@ -383,7 +383,7 @@ func (ni *NodeInfo) StableMarshal(buf []byte) ([]byte, error) { offset += n for i := range ni.attributes { - n, err = protoutil.NestedStructureMarshal(attributesNodeInfoField, buf[offset:], ni.attributes[i]) + n, err = protoutil.NestedStructureMarshal(attributesNodeInfoField, buf[offset:], &ni.attributes[i]) if err != nil { return nil, err } @@ -408,7 +408,7 @@ func (ni *NodeInfo) StableSize() (size int) { size += protoutil.RepeatedStringSize(addressNodeInfoField, ni.addresses) for i := range ni.attributes { - size += protoutil.NestedStructureSize(attributesNodeInfoField, ni.attributes[i]) + size += protoutil.NestedStructureSize(attributesNodeInfoField, &ni.attributes[i]) } size += protoutil.EnumSize(stateNodeInfoField, int32(ni.state)) diff --git a/netmap/test/generate.go b/netmap/test/generate.go index 0042dbb..7040550 100644 --- a/netmap/test/generate.go +++ b/netmap/test/generate.go @@ -119,13 +119,13 @@ func GenerateAttribute(empty bool) *netmap.Attribute { return m } -func GenerateAttributes(empty bool) []*netmap.Attribute { - var res []*netmap.Attribute +func GenerateAttributes(empty bool) []netmap.Attribute { + var res []netmap.Attribute if !empty { res = append(res, - GenerateAttribute(false), - GenerateAttribute(false), + *GenerateAttribute(false), + *GenerateAttribute(false), ) } diff --git a/netmap/types.go b/netmap/types.go index 5282765..19ca974 100644 --- a/netmap/types.go +++ b/netmap/types.go @@ -73,7 +73,7 @@ type Attribute struct { type NodeInfo struct { publicKey []byte addresses []string - attributes []*Attribute + attributes []Attribute state NodeState } @@ -444,7 +444,7 @@ func (ni *NodeInfo) IterateAddresses(f func(string) bool) { } } -func (ni *NodeInfo) GetAttributes() []*Attribute { +func (ni *NodeInfo) GetAttributes() []Attribute { if ni != nil { return ni.attributes } @@ -452,7 +452,7 @@ func (ni *NodeInfo) GetAttributes() []*Attribute { return nil } -func (ni *NodeInfo) SetAttributes(v []*Attribute) { +func (ni *NodeInfo) SetAttributes(v []Attribute) { if ni != nil { ni.attributes = v } From e21a7823c57f68c82e64aab31a23feb1a17bcdee Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Wed, 2 Mar 2022 11:01:03 +0300 Subject: [PATCH 0974/1196] [#376] session: Make XHeader slice non-pointer Signed-off-by: Evgenii Stratonikov --- session/convert.go | 14 ++++---------- session/marshal.go | 8 ++++---- session/test/generate.go | 8 ++++---- session/types.go | 12 ++++++------ 4 files changed, 18 insertions(+), 24 deletions(-) diff --git a/session/convert.go b/session/convert.go index 200e227..d7662b4 100644 --- a/session/convert.go +++ b/session/convert.go @@ -207,7 +207,7 @@ 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)) @@ -219,23 +219,17 @@ func XHeadersToGRPC(xs []*XHeader) (res []*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, 0, len(xs)) + res = make([]XHeader, len(xs)) for i := range xs { - var x *XHeader - if xs[i] != nil { - x = new(XHeader) - - err = x.FromGRPCMessage(xs[i]) + err = res[i].FromGRPCMessage(xs[i]) if err != nil { return } } - - res = append(res, x) } } diff --git a/session/marshal.go b/session/marshal.go index dbaf367..a57d1a5 100644 --- a/session/marshal.go +++ b/session/marshal.go @@ -543,7 +543,7 @@ func (r *RequestMetaHeader) StableMarshal(buf []byte) ([]byte, error) { offset += n for i := range r.xHeaders { - n, err = proto.NestedStructureMarshal(reqMetaHeaderXHeadersField, buf[offset:], r.xHeaders[i]) + n, err = proto.NestedStructureMarshal(reqMetaHeaderXHeadersField, buf[offset:], &r.xHeaders[i]) if err != nil { return nil, err } @@ -593,7 +593,7 @@ func (r *RequestMetaHeader) StableSize() (size int) { size += proto.UInt32Size(reqMetaHeaderTTLField, r.ttl) for i := range r.xHeaders { - size += proto.NestedStructureSize(reqMetaHeaderXHeadersField, r.xHeaders[i]) + size += proto.NestedStructureSize(reqMetaHeaderXHeadersField, &r.xHeaders[i]) } size += proto.NestedStructureSize(reqMetaHeaderSessionTokenField, r.sessionToken) @@ -714,7 +714,7 @@ func (r *ResponseMetaHeader) StableMarshal(buf []byte) ([]byte, error) { offset += n for i := range r.xHeaders { - n, err = proto.NestedStructureMarshal(respMetaHeaderXHeadersField, buf[offset:], r.xHeaders[i]) + n, err = proto.NestedStructureMarshal(respMetaHeaderXHeadersField, buf[offset:], &r.xHeaders[i]) if err != nil { return nil, err } @@ -750,7 +750,7 @@ func (r *ResponseMetaHeader) StableSize() (size int) { size += proto.UInt32Size(respMetaHeaderTTLField, r.ttl) for i := range r.xHeaders { - size += proto.NestedStructureSize(respMetaHeaderXHeadersField, r.xHeaders[i]) + size += proto.NestedStructureSize(respMetaHeaderXHeadersField, &r.xHeaders[i]) } size += proto.NestedStructureSize(respMetaHeaderOriginField, r.origin) diff --git a/session/test/generate.go b/session/test/generate.go index 537240a..be7cd5f 100644 --- a/session/test/generate.go +++ b/session/test/generate.go @@ -217,13 +217,13 @@ func GenerateXHeader(empty bool) *session.XHeader { return m } -func GenerateXHeaders(empty bool) []*session.XHeader { - var xs []*session.XHeader +func GenerateXHeaders(empty bool) []session.XHeader { + var xs []session.XHeader if !empty { xs = append(xs, - GenerateXHeader(false), - GenerateXHeader(false), + *GenerateXHeader(false), + *GenerateXHeader(false), ) } diff --git a/session/types.go b/session/types.go index e41b5a9..65f4728 100644 --- a/session/types.go +++ b/session/types.go @@ -93,7 +93,7 @@ type RequestMetaHeader struct { epoch uint64 - xHeaders []*XHeader + xHeaders []XHeader sessionToken *Token @@ -117,7 +117,7 @@ type ResponseMetaHeader struct { epoch uint64 - xHeaders []*XHeader + xHeaders []XHeader origin *ResponseMetaHeader @@ -401,7 +401,7 @@ func (r *RequestMetaHeader) SetEpoch(v uint64) { } } -func (r *RequestMetaHeader) GetXHeaders() []*XHeader { +func (r *RequestMetaHeader) GetXHeaders() []XHeader { if r != nil { return r.xHeaders } @@ -409,7 +409,7 @@ func (r *RequestMetaHeader) GetXHeaders() []*XHeader { return nil } -func (r *RequestMetaHeader) SetXHeaders(v []*XHeader) { +func (r *RequestMetaHeader) SetXHeaders(v []XHeader) { if r != nil { r.xHeaders = v } @@ -613,7 +613,7 @@ func (r *ResponseMetaHeader) SetEpoch(v uint64) { } } -func (r *ResponseMetaHeader) GetXHeaders() []*XHeader { +func (r *ResponseMetaHeader) GetXHeaders() []XHeader { if r != nil { return r.xHeaders } @@ -621,7 +621,7 @@ func (r *ResponseMetaHeader) GetXHeaders() []*XHeader { return nil } -func (r *ResponseMetaHeader) SetXHeaders(v []*XHeader) { +func (r *ResponseMetaHeader) SetXHeaders(v []XHeader) { if r != nil { r.xHeaders = v } From aa1e092ca5b5463721f3a3ecf86c334349401788 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Wed, 2 Mar 2022 11:03:56 +0300 Subject: [PATCH 0975/1196] [#376] object: Remove pointer from slices Signed-off-by: Evgenii Stratonikov --- object/convert.go | 28 ++++++++-------------------- object/marshal.go | 8 ++++---- object/test/generate.go | 16 ++++++++-------- object/types.go | 12 ++++++------ 4 files changed, 26 insertions(+), 38 deletions(-) diff --git a/object/convert.go b/object/convert.go index d574e79..0db3dcd 100644 --- a/object/convert.go +++ b/object/convert.go @@ -1443,7 +1443,7 @@ 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)) @@ -1455,23 +1455,17 @@ func SearchFiltersToGRPC(fs []*SearchFilter) (res []*object.SearchRequest_Body_F 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, 0, len(fs)) + res = make([]SearchFilter, len(fs)) for i := range fs { - var x *SearchFilter - if fs[i] != nil { - x = new(SearchFilter) - - err = x.FromGRPCMessage(fs[i]) + err = res[i].FromGRPCMessage(fs[i]) if err != nil { return } } - - res = append(res, x) } } @@ -1650,7 +1644,7 @@ 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)) @@ -1662,23 +1656,17 @@ func RangesToGRPC(rs []*Range) (res []*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, 0, len(rs)) + res = make([]Range, len(rs)) for i := range rs { - var r *Range - if rs[i] != nil { - r = new(Range) - - err = r.FromGRPCMessage(rs[i]) + err = res[i].FromGRPCMessage(rs[i]) if err != nil { return } } - - res = append(res, r) } } diff --git a/object/marshal.go b/object/marshal.go index 24d8d86..a3e69b3 100644 --- a/object/marshal.go +++ b/object/marshal.go @@ -1158,7 +1158,7 @@ func (r *SearchRequestBody) StableMarshal(buf []byte) ([]byte, error) { offset += n for i := range r.filters { - n, err = proto.NestedStructureMarshal(searchReqBodyFiltersField, buf[offset:], r.filters[i]) + n, err = proto.NestedStructureMarshal(searchReqBodyFiltersField, buf[offset:], &r.filters[i]) if err != nil { return nil, err } @@ -1178,7 +1178,7 @@ func (r *SearchRequestBody) StableSize() (size int) { size += proto.UInt32Size(searchReqBodyVersionField, r.version) for i := range r.filters { - size += proto.NestedStructureSize(searchReqBodyFiltersField, r.filters[i]) + size += proto.NestedStructureSize(searchReqBodyFiltersField, &r.filters[i]) } return size @@ -1400,7 +1400,7 @@ func (r *GetRangeHashRequestBody) StableMarshal(buf []byte) ([]byte, error) { offset += n for i := range r.rngs { - n, err = proto.NestedStructureMarshal(getRangeHashReqBodyRangesField, buf[offset:], r.rngs[i]) + n, err = proto.NestedStructureMarshal(getRangeHashReqBodyRangesField, buf[offset:], &r.rngs[i]) if err != nil { return nil, err } @@ -1431,7 +1431,7 @@ func (r *GetRangeHashRequestBody) StableSize() (size int) { size += proto.NestedStructureSize(getRangeHashReqBodyAddressField, r.addr) for i := range r.rngs { - size += proto.NestedStructureSize(getRangeHashReqBodyRangesField, r.rngs[i]) + size += proto.NestedStructureSize(getRangeHashReqBodyRangesField, &r.rngs[i]) } size += proto.BytesSize(getRangeHashReqBodySaltField, r.salt) diff --git a/object/test/generate.go b/object/test/generate.go index 298bc9a..215ff78 100644 --- a/object/test/generate.go +++ b/object/test/generate.go @@ -380,13 +380,13 @@ func GenerateSearchFilter(empty bool) *object.SearchFilter { return m } -func GenerateSearchFilters(empty bool) []*object.SearchFilter { - var res []*object.SearchFilter +func GenerateSearchFilters(empty bool) []object.SearchFilter { + var res []object.SearchFilter if !empty { res = append(res, - GenerateSearchFilter(false), - GenerateSearchFilter(false), + *GenerateSearchFilter(false), + *GenerateSearchFilter(false), ) } @@ -452,13 +452,13 @@ func GenerateRange(empty bool) *object.Range { return m } -func GenerateRanges(empty bool) []*object.Range { - var res []*object.Range +func GenerateRanges(empty bool) []object.Range { + var res []object.Range if !empty { res = append(res, - GenerateRange(false), - GenerateRange(false), + *GenerateRange(false), + *GenerateRange(false), ) } diff --git a/object/types.go b/object/types.go index 63002bc..240f22c 100644 --- a/object/types.go +++ b/object/types.go @@ -218,7 +218,7 @@ type SearchRequestBody struct { version uint32 - filters []*SearchFilter + filters []SearchFilter } type SearchRequest struct { @@ -276,7 +276,7 @@ type GetRangeResponse struct { type GetRangeHashRequestBody struct { addr *refs.Address - rngs []*Range + rngs []Range salt []byte @@ -1288,7 +1288,7 @@ func (r *SearchRequestBody) SetVersion(v uint32) { } } -func (r *SearchRequestBody) GetFilters() []*SearchFilter { +func (r *SearchRequestBody) GetFilters() []SearchFilter { if r != nil { return r.filters } @@ -1296,7 +1296,7 @@ func (r *SearchRequestBody) GetFilters() []*SearchFilter { return nil } -func (r *SearchRequestBody) SetFilters(v []*SearchFilter) { +func (r *SearchRequestBody) SetFilters(v []SearchFilter) { if r != nil { r.filters = v } @@ -1486,7 +1486,7 @@ func (r *GetRangeHashRequestBody) SetAddress(v *refs.Address) { } } -func (r *GetRangeHashRequestBody) GetRanges() []*Range { +func (r *GetRangeHashRequestBody) GetRanges() []Range { if r != nil { return r.rngs } @@ -1494,7 +1494,7 @@ func (r *GetRangeHashRequestBody) GetRanges() []*Range { return nil } -func (r *GetRangeHashRequestBody) SetRanges(v []*Range) { +func (r *GetRangeHashRequestBody) SetRanges(v []Range) { if r != nil { r.rngs = v } From 30c530e83d07ce08008d03a401c9284164da4052 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Wed, 2 Mar 2022 11:18:59 +0300 Subject: [PATCH 0976/1196] [#376] container: Remove pointers from slices Signed-off-by: Evgenii Stratonikov --- container/convert.go | 28 ++++++++-------------------- container/marshal.go | 12 ++++++------ container/test/generate.go | 16 ++++++++-------- container/types.go | 18 +++++++++--------- refs/convert.go | 14 ++++---------- refs/test/generate.go | 8 ++++---- 6 files changed, 39 insertions(+), 57 deletions(-) diff --git a/container/convert.go b/container/convert.go index 5e49bea..fc174e3 100644 --- a/container/convert.go +++ b/container/convert.go @@ -39,7 +39,7 @@ 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)) @@ -51,23 +51,17 @@ func AttributesToGRPC(xs []*Attribute) (res []*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, 0, len(xs)) + res = make([]Attribute, len(xs)) for i := range xs { - var x *Attribute - if xs[i] != nil { - x = new(Attribute) - - err = x.FromGRPCMessage(xs[i]) + err = res[i].FromGRPCMessage(xs[i]) if err != nil { return } } - - res = append(res, x) } } @@ -1133,7 +1127,7 @@ func (a *UsedSpaceAnnouncement) FromGRPCMessage(m grpc.Message) error { } func UsedSpaceAnnouncementsToGRPCMessage( - ids []*UsedSpaceAnnouncement, + ids []UsedSpaceAnnouncement, ) (res []*container.AnnounceUsedSpaceRequest_Body_Announcement) { if ids != nil { res = make([]*container.AnnounceUsedSpaceRequest_Body_Announcement, 0, len(ids)) @@ -1148,23 +1142,17 @@ func UsedSpaceAnnouncementsToGRPCMessage( func UsedSpaceAnnouncementssFromGRPCMessage( asV2 []*container.AnnounceUsedSpaceRequest_Body_Announcement, -) (res []*UsedSpaceAnnouncement, err error) { +) (res []UsedSpaceAnnouncement, err error) { if asV2 != nil { - res = make([]*UsedSpaceAnnouncement, 0, len(asV2)) + res = make([]UsedSpaceAnnouncement, len(asV2)) for i := range asV2 { - var a *UsedSpaceAnnouncement - if asV2[i] != nil { - a = new(UsedSpaceAnnouncement) - - err = a.FromGRPCMessage(asV2[i]) + err = res[i].FromGRPCMessage(asV2[i]) if err != nil { return } } - - res = append(res, a) } } diff --git a/container/marshal.go b/container/marshal.go index 69160ab..f5f7c11 100644 --- a/container/marshal.go +++ b/container/marshal.go @@ -138,7 +138,7 @@ func (c *Container) StableMarshal(buf []byte) ([]byte, error) { offset += n for i := range c.attr { - n, err = protoutil.NestedStructureMarshal(containerAttributesField, buf[offset:], c.attr[i]) + n, err = protoutil.NestedStructureMarshal(containerAttributesField, buf[offset:], &c.attr[i]) if err != nil { return nil, err } @@ -165,7 +165,7 @@ func (c *Container) StableSize() (size int) { size += protoutil.UInt32Size(containerBasicACLField, c.basicACL) for i := range c.attr { - size += protoutil.NestedStructureSize(containerAttributesField, c.attr[i]) + size += protoutil.NestedStructureSize(containerAttributesField, &c.attr[i]) } size += protoutil.NestedStructureSize(containerPlacementField, c.policy) @@ -432,7 +432,7 @@ func (r *ListResponseBody) StableMarshal(buf []byte) ([]byte, error) { ) for i := range r.cidList { - n, err = protoutil.NestedStructureMarshal(listRespBodyIDsField, buf[offset:], r.cidList[i]) + n, err = protoutil.NestedStructureMarshal(listRespBodyIDsField, buf[offset:], &r.cidList[i]) if err != nil { return nil, err } @@ -449,7 +449,7 @@ func (r *ListResponseBody) StableSize() (size int) { } for i := range r.cidList { - size += protoutil.NestedStructureSize(listRespBodyIDsField, r.cidList[i]) + size += protoutil.NestedStructureSize(listRespBodyIDsField, &r.cidList[i]) } return size @@ -665,7 +665,7 @@ func (r *AnnounceUsedSpaceRequestBody) StableMarshal(buf []byte) ([]byte, error) ) for i := range r.announcements { - n, err = protoutil.NestedStructureMarshal(usedSpaceReqBodyAnnouncementsField, buf[offset:], r.announcements[i]) + n, err = protoutil.NestedStructureMarshal(usedSpaceReqBodyAnnouncementsField, buf[offset:], &r.announcements[i]) if err != nil { return nil, err } @@ -682,7 +682,7 @@ func (r *AnnounceUsedSpaceRequestBody) StableSize() (size int) { } for i := range r.announcements { - size += protoutil.NestedStructureSize(usedSpaceReqBodyAnnouncementsField, r.announcements[i]) + size += protoutil.NestedStructureSize(usedSpaceReqBodyAnnouncementsField, &r.announcements[i]) } return size diff --git a/container/test/generate.go b/container/test/generate.go index adfe0e7..dfd2098 100644 --- a/container/test/generate.go +++ b/container/test/generate.go @@ -19,13 +19,13 @@ func GenerateAttribute(empty bool) *container.Attribute { return m } -func GenerateAttributes(empty bool) []*container.Attribute { - var res []*container.Attribute +func GenerateAttributes(empty bool) []container.Attribute { + var res []container.Attribute if !empty { res = append(res, - GenerateAttribute(false), - GenerateAttribute(false), + *GenerateAttribute(false), + *GenerateAttribute(false), ) } @@ -340,13 +340,13 @@ func GenerateUsedSpaceAnnouncement(empty bool) *container.UsedSpaceAnnouncement return m } -func GenerateUsedSpaceAnnouncements(empty bool) []*container.UsedSpaceAnnouncement { - var res []*container.UsedSpaceAnnouncement +func GenerateUsedSpaceAnnouncements(empty bool) []container.UsedSpaceAnnouncement { + var res []container.UsedSpaceAnnouncement if !empty { res = append(res, - GenerateUsedSpaceAnnouncement(false), - GenerateUsedSpaceAnnouncement(false), + *GenerateUsedSpaceAnnouncement(false), + *GenerateUsedSpaceAnnouncement(false), ) } diff --git a/container/types.go b/container/types.go index 4da1723..25755a8 100644 --- a/container/types.go +++ b/container/types.go @@ -20,7 +20,7 @@ type Container struct { basicACL uint32 - attr []*Attribute + attr []Attribute policy *netmap.PlacementPolicy } @@ -101,7 +101,7 @@ type ListRequest struct { } type ListResponseBody struct { - cidList []*refs.ContainerID + cidList []refs.ContainerID } type ListResponse struct { @@ -163,7 +163,7 @@ type UsedSpaceAnnouncement struct { } type AnnounceUsedSpaceRequestBody struct { - announcements []*UsedSpaceAnnouncement + announcements []UsedSpaceAnnouncement } type AnnounceUsedSpaceRequest struct { @@ -264,7 +264,7 @@ func (c *Container) SetBasicACL(v uint32) { } } -func (c *Container) GetAttributes() []*Attribute { +func (c *Container) GetAttributes() []Attribute { if c != nil { return c.attr } @@ -272,7 +272,7 @@ func (c *Container) GetAttributes() []*Attribute { return nil } -func (c *Container) SetAttributes(v []*Attribute) { +func (c *Container) SetAttributes(v []Attribute) { if c != nil { c.attr = v } @@ -542,7 +542,7 @@ func (r *ListRequest) SetBody(v *ListRequestBody) { } } -func (r *ListResponseBody) GetContainerIDs() []*refs.ContainerID { +func (r *ListResponseBody) GetContainerIDs() []refs.ContainerID { if r != nil { return r.cidList } @@ -550,7 +550,7 @@ func (r *ListResponseBody) GetContainerIDs() []*refs.ContainerID { return nil } -func (r *ListResponseBody) SetContainerIDs(v []*refs.ContainerID) { +func (r *ListResponseBody) SetContainerIDs(v []refs.ContainerID) { if r != nil { r.cidList = v } @@ -760,7 +760,7 @@ func (a *UsedSpaceAnnouncement) SetContainerID(v *refs.ContainerID) { } } -func (r *AnnounceUsedSpaceRequestBody) GetAnnouncements() []*UsedSpaceAnnouncement { +func (r *AnnounceUsedSpaceRequestBody) GetAnnouncements() []UsedSpaceAnnouncement { if r != nil { return r.announcements } @@ -768,7 +768,7 @@ func (r *AnnounceUsedSpaceRequestBody) GetAnnouncements() []*UsedSpaceAnnounceme return nil } -func (r *AnnounceUsedSpaceRequestBody) SetAnnouncements(v []*UsedSpaceAnnouncement) { +func (r *AnnounceUsedSpaceRequestBody) SetAnnouncements(v []UsedSpaceAnnouncement) { if r != nil { r.announcements = v } diff --git a/refs/convert.go b/refs/convert.go index feb851f..b6dffe6 100644 --- a/refs/convert.go +++ b/refs/convert.go @@ -52,7 +52,7 @@ 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)) @@ -64,23 +64,17 @@ func ContainerIDsToGRPCMessage(ids []*ContainerID) (res []*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, 0, len(idsV2)) + res = make([]ContainerID, len(idsV2)) for i := range idsV2 { - var id *ContainerID - if idsV2[i] != nil { - id = new(ContainerID) - - err = id.FromGRPCMessage(idsV2[i]) + err = res[i].FromGRPCMessage(idsV2[i]) if err != nil { return } } - - res = append(res, id) } } diff --git a/refs/test/generate.go b/refs/test/generate.go index 7a142e3..13aefbd 100644 --- a/refs/test/generate.go +++ b/refs/test/generate.go @@ -71,13 +71,13 @@ func GenerateContainerID(empty bool) *refs.ContainerID { return m } -func GenerateContainerIDs(empty bool) []*refs.ContainerID { - var res []*refs.ContainerID +func GenerateContainerIDs(empty bool) []refs.ContainerID { + var res []refs.ContainerID if !empty { res = append(res, - GenerateContainerID(false), - GenerateContainerID(false), + *GenerateContainerID(false), + *GenerateContainerID(false), ) } From 0cab407378c05e69d94ec5c51e3fc6494cfa5e0f Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Wed, 2 Mar 2022 11:40:47 +0300 Subject: [PATCH 0977/1196] [#376] reputation: Remove pointers from slices Signed-off-by: Evgenii Stratonikov --- reputation/convert.go | 14 ++++---------- reputation/marshal.go | 4 ++-- reputation/test/generate.go | 8 ++++---- reputation/types.go | 6 +++--- 4 files changed, 13 insertions(+), 19 deletions(-) diff --git a/reputation/convert.go b/reputation/convert.go index 67f3aaf..924b1ed 100644 --- a/reputation/convert.go +++ b/reputation/convert.go @@ -138,7 +138,7 @@ func (x *PeerToPeerTrust) FromGRPCMessage(m grpc.Message) error { // TrustsToGRPC converts slice of Trust structures // to slice of gRPC-generated Trust messages. -func TrustsToGRPC(xs []*Trust) (res []*reputation.Trust) { +func TrustsToGRPC(xs []Trust) (res []*reputation.Trust) { if xs != nil { res = make([]*reputation.Trust, 0, len(xs)) @@ -152,23 +152,17 @@ func TrustsToGRPC(xs []*Trust) (res []*reputation.Trust) { // TrustsFromGRPC tries to restore slice of Trust structures from // slice of gRPC-generated reputation.Trust messages. -func TrustsFromGRPC(xs []*reputation.Trust) (res []*Trust, err error) { +func TrustsFromGRPC(xs []*reputation.Trust) (res []Trust, err error) { if xs != nil { - res = make([]*Trust, 0, len(xs)) + res = make([]Trust, len(xs)) for i := range xs { - var x *Trust - if xs[i] != nil { - x = new(Trust) - - err = x.FromGRPCMessage(xs[i]) + err = res[i].FromGRPCMessage(xs[i]) if err != nil { return } } - - res = append(res, x) } } diff --git a/reputation/marshal.go b/reputation/marshal.go index 1af68c9..20d1fd7 100644 --- a/reputation/marshal.go +++ b/reputation/marshal.go @@ -238,7 +238,7 @@ func (x *AnnounceLocalTrustRequestBody) StableMarshal(buf []byte) ([]byte, error offset += n for i := range x.trusts { - n, err = protoutil.NestedStructureMarshal(announceLocalTrustBodyTrustsFNum, buf[offset:], x.trusts[i]) + n, err = protoutil.NestedStructureMarshal(announceLocalTrustBodyTrustsFNum, buf[offset:], &x.trusts[i]) if err != nil { return nil, err } @@ -253,7 +253,7 @@ func (x *AnnounceLocalTrustRequestBody) StableSize() (size int) { size += protoutil.UInt64Size(announceLocalTrustBodyEpochFNum, x.epoch) for i := range x.trusts { - size += protoutil.NestedStructureSize(announceLocalTrustBodyTrustsFNum, x.trusts[i]) + size += protoutil.NestedStructureSize(announceLocalTrustBodyTrustsFNum, &x.trusts[i]) } return diff --git a/reputation/test/generate.go b/reputation/test/generate.go index fb1239a..00e6009 100644 --- a/reputation/test/generate.go +++ b/reputation/test/generate.go @@ -61,13 +61,13 @@ func GenerateGlobalTrust(empty bool) *reputation.GlobalTrust { return m } -func GenerateTrusts(empty bool) []*reputation.Trust { - var res []*reputation.Trust +func GenerateTrusts(empty bool) []reputation.Trust { + var res []reputation.Trust if !empty { res = append(res, - GenerateTrust(false), - GenerateTrust(false), + *GenerateTrust(false), + *GenerateTrust(false), ) } diff --git a/reputation/types.go b/reputation/types.go index 4ce995d..5ccb203 100644 --- a/reputation/types.go +++ b/reputation/types.go @@ -209,7 +209,7 @@ func (x *GlobalTrust) SetSignature(v *refs.Signature) { type AnnounceLocalTrustRequestBody struct { epoch uint64 - trusts []*Trust + trusts []Trust } // GetEpoch returns epoch in which the trust was assessed. @@ -229,7 +229,7 @@ func (x *AnnounceLocalTrustRequestBody) SetEpoch(v uint64) { } // GetTrusts returns list of normalized trust values. -func (x *AnnounceLocalTrustRequestBody) GetTrusts() []*Trust { +func (x *AnnounceLocalTrustRequestBody) GetTrusts() []Trust { if x != nil { return x.trusts } @@ -238,7 +238,7 @@ func (x *AnnounceLocalTrustRequestBody) GetTrusts() []*Trust { } // SetTrusts sets list of normalized trust values. -func (x *AnnounceLocalTrustRequestBody) SetTrusts(v []*Trust) { +func (x *AnnounceLocalTrustRequestBody) SetTrusts(v []Trust) { if x != nil { x.trusts = v } From 43fd3cfb4fd55eb74bf7f68b8bc66f47a82bb655 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Wed, 2 Mar 2022 11:43:54 +0300 Subject: [PATCH 0978/1196] [#376] status: Remove pointer from `Detail` slice Signed-off-by: Evgenii Stratonikov --- object/status.go | 2 +- status/convert.go | 12 +++--------- status/marshal.go | 4 ++-- status/test/generate.go | 8 ++++---- status/types.go | 8 ++++---- 5 files changed, 14 insertions(+), 20 deletions(-) diff --git a/object/status.go b/object/status.go index 067c372..dc37ad2 100644 --- a/object/status.go +++ b/object/status.go @@ -67,7 +67,7 @@ func WriteAccessDeniedDesc(st *status.Status, desc string) { d.SetID(detailAccessDeniedDesc) d.SetValue([]byte(desc)) - st.AppendDetails(&d) + st.AppendDetails(d) } } diff --git a/status/convert.go b/status/convert.go index 8195096..50145ef 100644 --- a/status/convert.go +++ b/status/convert.go @@ -71,27 +71,21 @@ func (x *Status) FromGRPCMessage(m grpc.Message) error { } var ( - ds []*Detail + ds []Detail dsV2 = v.GetDetails() ) if dsV2 != nil { ln := len(dsV2) - ds = make([]*Detail, 0, ln) + ds = make([]Detail, ln) for i := 0; i < ln; i++ { - var p *Detail - if dsV2[i] != nil { - p = new(Detail) - - if err := p.FromGRPCMessage(dsV2[i]); err != nil { + if err := ds[i].FromGRPCMessage(dsV2[i]); err != nil { return err } } - - ds = append(ds, p) } } diff --git a/status/marshal.go b/status/marshal.go index da6572e..5e04f24 100644 --- a/status/marshal.go +++ b/status/marshal.go @@ -88,7 +88,7 @@ func (x *Status) StableMarshal(buf []byte) ([]byte, error) { offset += n for i := range x.details { - n, err = protoutil.NestedStructureMarshal(statusDetailsFNum, buf[offset:], x.details[i]) + n, err = protoutil.NestedStructureMarshal(statusDetailsFNum, buf[offset:], &x.details[i]) if err != nil { return nil, err } @@ -104,7 +104,7 @@ func (x *Status) StableSize() (size int) { size += protoutil.StringSize(statusMsgFNum, x.msg) for i := range x.details { - size += protoutil.NestedStructureSize(statusDetailsFNum, x.details[i]) + size += protoutil.NestedStructureSize(statusDetailsFNum, &x.details[i]) } return size diff --git a/status/test/generate.go b/status/test/generate.go index 1861212..01df633 100644 --- a/status/test/generate.go +++ b/status/test/generate.go @@ -17,13 +17,13 @@ func Detail(empty bool) *status.Detail { } // Details returns several status.Detail messages filled with static random values. -func Details(empty bool) []*status.Detail { - var res []*status.Detail +func Details(empty bool) []status.Detail { + var res []status.Detail if !empty { res = append(res, - Detail(false), - Detail(false), + *Detail(false), + *Detail(false), ) } diff --git a/status/types.go b/status/types.go index 6fe233b..8bcb3af 100644 --- a/status/types.go +++ b/status/types.go @@ -53,7 +53,7 @@ type Status struct { msg string - details []*Detail + details []Detail } // Code returns code of the Status. @@ -104,7 +104,7 @@ func (x *Status) NumberOfDetails() int { func (x *Status) IterateDetails(f func(*Detail) bool) { if x != nil { for i := range x.details { - if f(x.details[i]) { + if f(&x.details[i]) { break } } @@ -119,14 +119,14 @@ func (x *Status) ResetDetails() { } // AppendDetails appends the list of details to the Status. -func (x *Status) AppendDetails(ds ...*Detail) { +func (x *Status) AppendDetails(ds ...Detail) { if x != nil { x.details = append(x.details, ds...) } } // SetStatusDetails sets Detail list of the Status. -func SetStatusDetails(dst *Status, ds []*Detail) { +func SetStatusDetails(dst *Status, ds []Detail) { dst.ResetDetails() dst.AppendDetails(ds...) } From 18a31bc68e57d44e29a25dc3b1fb90eb048f61f8 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Tue, 15 Mar 2022 13:38:42 +0300 Subject: [PATCH 0979/1196] Retract v2.12.0 Signed-off-by: Alex Vanin --- go.mod | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index 27739f3..830c359 100644 --- a/go.mod +++ b/go.mod @@ -9,5 +9,6 @@ require ( google.golang.org/protobuf v1.27.1 ) -// Used for debug reasons -// replace github.com/nspcc-dev/neofs-crypto => ../neofs-crypto +// This version uses broken NeoFS API with incompatible signature +// definitions. See fix in https://github.com/nspcc-dev/neofs-api/pull/203 +retract v2.12.0 From 50162741ac9b446e60f41848553c4c03f6b1bcec Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Tue, 15 Mar 2022 13:49:06 +0300 Subject: [PATCH 0980/1196] Release v2.12.1 Signed-off-by: Alex Vanin --- CHANGELOG.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a5e49e1..aea832b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,17 @@ # Changelog +## [2.12.1] - 2022-03-15 + +### Fixed +- Incompatible changes in signature scheme (#380) + +### Added +- Public URI-parsing function `client.ParseURI()` (#383) + +### Changed +- Slices with pointers `[]*T` replaced with regular structure slices `[]T` in + v2 structures (#376) + ## [2.12.0] - 2022-02-25 - Heuksando (흑산도, 黑山島) NeoFS API v2.12 support @@ -781,3 +793,4 @@ Initial public release [2.11.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.30.0...v2.11.0 [2.11.1]: https://github.com/nspcc-dev/neofs-api-go/compare/v2.11.0...v2.11.1 [2.12.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v2.11.1...v2.12.0 +[2.12.1]: https://github.com/nspcc-dev/neofs-api-go/compare/v2.12.0...v2.12.1 From 732dd51b1b38d1675396a68169777eb9f5e0ee84 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Wed, 23 Mar 2022 14:42:57 +0300 Subject: [PATCH 0981/1196] [#388] *: Remove nil check from setters I knew one day `sed` would save me an hour of manual work: ``` sed -i -n -e ' s/) Set/) Set/ p t setter b end :setter n s/nil/nil/ t hasif p b end :hasif n :loop p n s/}/}/ t end b loop :end ' $@ goimports -w $@ ``` Signed-off-by: Evgenii Stratonikov --- accounting/accounting.go | 24 +-- accounting/grpc/service.go | 32 +--- accounting/grpc/types.go | 8 +- acl/grpc/types.go | 84 +++------ acl/types.go | 84 +++------ audit/grpc/types.go | 56 ++---- audit/types.go | 56 ++---- container/grpc/service.go | 248 ++++++------------------ container/grpc/types.go | 32 +--- container/types.go | 192 ++++++------------- netmap/grpc/service.go | 60 ++---- netmap/grpc/types.go | 124 +++--------- netmap/types.go | 144 ++++---------- object/grpc/service.go | 374 ++++++++++--------------------------- object/grpc/types.go | 132 ++++--------- object/types.go | 356 +++++++++-------------------------- refs/grpc/types.go | 60 ++---- refs/types.go | 52 ++---- reputation/grpc/service.go | 68 ++----- reputation/grpc/types.go | 40 +--- reputation/types.go | 76 ++------ session/grpc/service.go | 40 +--- session/grpc/types.go | 164 +++++----------- session/types.go | 196 +++++-------------- session/util.go | 16 +- status/grpc/types.go | 20 +- status/types.go | 16 +- storagegroup/grpc/types.go | 16 +- storagegroup/types.go | 16 +- subnet/grpc/types.go | 8 +- tombstone/grpc/types.go | 12 +- tombstone/types.go | 12 +- 32 files changed, 714 insertions(+), 2104 deletions(-) diff --git a/accounting/accounting.go b/accounting/accounting.go index d2d287f..5277b1d 100644 --- a/accounting/accounting.go +++ b/accounting/accounting.go @@ -40,9 +40,7 @@ func (b *BalanceRequestBody) GetOwnerID() *refs.OwnerID { } func (b *BalanceRequestBody) SetOwnerID(v *refs.OwnerID) { - if b != nil { - b.ownerID = v - } + b.ownerID = v } func (b *BalanceRequest) GetBody() *BalanceRequestBody { @@ -54,9 +52,7 @@ func (b *BalanceRequest) GetBody() *BalanceRequestBody { } func (b *BalanceRequest) SetBody(v *BalanceRequestBody) { - if b != nil { - b.body = v - } + b.body = v } func (d *Decimal) GetValue() int64 { @@ -68,9 +64,7 @@ func (d *Decimal) GetValue() int64 { } func (d *Decimal) SetValue(v int64) { - if d != nil { - d.val = v - } + d.val = v } func (d *Decimal) GetPrecision() uint32 { @@ -82,9 +76,7 @@ func (d *Decimal) GetPrecision() uint32 { } func (d *Decimal) SetPrecision(v uint32) { - if d != nil { - d.prec = v - } + d.prec = v } func (br *BalanceResponseBody) GetBalance() *Decimal { @@ -96,9 +88,7 @@ func (br *BalanceResponseBody) GetBalance() *Decimal { } func (br *BalanceResponseBody) SetBalance(v *Decimal) { - if br != nil { - br.bal = v - } + br.bal = v } func (br *BalanceResponse) GetBody() *BalanceResponseBody { @@ -110,7 +100,5 @@ func (br *BalanceResponse) GetBody() *BalanceResponseBody { } func (br *BalanceResponse) SetBody(v *BalanceResponseBody) { - if br != nil { - br.body = v - } + br.body = v } diff --git a/accounting/grpc/service.go b/accounting/grpc/service.go index 78adedb..91f9713 100644 --- a/accounting/grpc/service.go +++ b/accounting/grpc/service.go @@ -7,56 +7,40 @@ import ( // SetOwnerId sets identifier of the account owner. func (m *BalanceRequest_Body) SetOwnerId(v *refs.OwnerID) { - if m != nil { - m.OwnerId = v - } + m.OwnerId = v } // SetBody sets body of the request. func (m *BalanceRequest) SetBody(v *BalanceRequest_Body) { - if m != nil { - m.Body = v - } + m.Body = v } // SetMetaHeader sets meta header of the request. func (m *BalanceRequest) SetMetaHeader(v *session.RequestMetaHeader) { - if m != nil { - m.MetaHeader = v - } + m.MetaHeader = v } // SetVerifyHeader sets verification header of the request. func (m *BalanceRequest) SetVerifyHeader(v *session.RequestVerificationHeader) { - if m != nil { - m.VerifyHeader = v - } + m.VerifyHeader = v } // SetBalance sets balance value of the response. func (m *BalanceResponse_Body) SetBalance(v *Decimal) { - if m != nil { - m.Balance = v - } + m.Balance = v } // SetBody sets body of the response. func (m *BalanceResponse) SetBody(v *BalanceResponse_Body) { - if m != nil { - m.Body = v - } + m.Body = v } // SetMetaHeader sets meta header of the response. func (m *BalanceResponse) SetMetaHeader(v *session.ResponseMetaHeader) { - if m != nil { - m.MetaHeader = v - } + m.MetaHeader = v } // SetVerifyHeader sets verification header of the response. func (m *BalanceResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) { - if m != nil { - m.VerifyHeader = v - } + m.VerifyHeader = v } diff --git a/accounting/grpc/types.go b/accounting/grpc/types.go index 3099f69..1c1bac9 100644 --- a/accounting/grpc/types.go +++ b/accounting/grpc/types.go @@ -2,14 +2,10 @@ package accounting // SetValue sets value of the decimal number. func (m *Decimal) SetValue(v int64) { - if m != nil { - m.Value = v - } + m.Value = v } // SetPrecision sets precision of the decimal number. func (m *Decimal) SetPrecision(v uint32) { - if m != nil { - m.Precision = v - } + m.Precision = v } diff --git a/acl/grpc/types.go b/acl/grpc/types.go index cc9b48b..032f5c9 100644 --- a/acl/grpc/types.go +++ b/acl/grpc/types.go @@ -6,149 +6,107 @@ import ( // SetVersion sets version of EACL rules in table. func (m *EACLTable) SetVersion(v *refs.Version) { - if m != nil { - m.Version = v - } + m.Version = v } // SetContainerId sets container identifier of the eACL table. func (m *EACLTable) SetContainerId(v *refs.ContainerID) { - if m != nil { - m.ContainerId = v - } + m.ContainerId = v } // SetRecords sets record list of the eACL table. func (m *EACLTable) SetRecords(v []*EACLRecord) { - if m != nil { - m.Records = v - } + m.Records = v } // SetOperation sets operation of the eACL record. func (m *EACLRecord) SetOperation(v Operation) { - if m != nil { - m.Operation = v - } + m.Operation = v } // SetAction sets action of the eACL record. func (m *EACLRecord) SetAction(v Action) { - if m != nil { - m.Action = v - } + m.Action = v } // SetFilters sets filter list of the eACL record. func (m *EACLRecord) SetFilters(v []*EACLRecord_Filter) { - if m != nil { - m.Filters = v - } + m.Filters = v } // SetTargets sets target list of the eACL record. func (m *EACLRecord) SetTargets(v []*EACLRecord_Target) { - if m != nil { - m.Targets = v - } + m.Targets = v } // SetHeader sets header type of the eACL filter. func (m *EACLRecord_Filter) SetHeader(v HeaderType) { - if m != nil { - m.HeaderType = v - } + m.HeaderType = v } // SetMatchType sets match type of the eACL filter. func (m *EACLRecord_Filter) SetMatchType(v MatchType) { - if m != nil { - m.MatchType = v - } + m.MatchType = v } // SetKey sets key of the eACL filter. func (m *EACLRecord_Filter) SetKey(v string) { - if m != nil { - m.Key = v - } + m.Key = v } // SetValue sets value of the eACL filter. func (m *EACLRecord_Filter) SetValue(v string) { - if m != nil { - m.Value = v - } + m.Value = v } // SetRole sets target group of the eACL target. func (m *EACLRecord_Target) SetRole(v Role) { - if m != nil { - m.Role = v - } + m.Role = v } // SetKeys of the eACL target. func (m *EACLRecord_Target) SetKeys(v [][]byte) { - if m != nil { - m.Keys = v - } + m.Keys = v } // SetEaclTable sets eACL table of the bearer token. func (m *BearerToken_Body) SetEaclTable(v *EACLTable) { - if m != nil { - m.EaclTable = v - } + m.EaclTable = v } // SetOwnerId sets identifier of the bearer token owner. func (m *BearerToken_Body) SetOwnerId(v *refs.OwnerID) { - if m != nil { - m.OwnerId = v - } + m.OwnerId = v } // SetLifetime sets lifetime of the bearer token. func (m *BearerToken_Body) SetLifetime(v *BearerToken_Body_TokenLifetime) { - if m != nil { - m.Lifetime = v - } + m.Lifetime = v } // SetBody sets bearer token body. func (m *BearerToken) SetBody(v *BearerToken_Body) { - if m != nil { - m.Body = v - } + m.Body = v } // SetSignature sets bearer token signature. func (m *BearerToken) SetSignature(v *refs.Signature) { - if m != nil { - m.Signature = v - } + m.Signature = v } // SetExp sets epoch number of the token expiration. func (m *BearerToken_Body_TokenLifetime) SetExp(v uint64) { - if m != nil { - m.Exp = v - } + m.Exp = v } // SetNbf sets starting epoch number of the token. func (m *BearerToken_Body_TokenLifetime) SetNbf(v uint64) { - if m != nil { - m.Nbf = v - } + m.Nbf = v } // SetIat sets the number of the epoch in which the token was issued. func (m *BearerToken_Body_TokenLifetime) SetIat(v uint64) { - if m != nil { - m.Iat = v - } + m.Iat = v } // FromString parses Action from a string representation, diff --git a/acl/types.go b/acl/types.go index 70994b4..23c994c 100644 --- a/acl/types.go +++ b/acl/types.go @@ -121,9 +121,7 @@ func (f *HeaderFilter) GetHeaderType() HeaderType { } func (f *HeaderFilter) SetHeaderType(v HeaderType) { - if f != nil { - f.hdrType = v - } + f.hdrType = v } func (f *HeaderFilter) GetMatchType() MatchType { @@ -135,9 +133,7 @@ func (f *HeaderFilter) GetMatchType() MatchType { } func (f *HeaderFilter) SetMatchType(v MatchType) { - if f != nil { - f.matchType = v - } + f.matchType = v } func (f *HeaderFilter) GetKey() string { @@ -149,9 +145,7 @@ func (f *HeaderFilter) GetKey() string { } func (f *HeaderFilter) SetKey(v string) { - if f != nil { - f.key = v - } + f.key = v } func (f *HeaderFilter) GetValue() string { @@ -163,9 +157,7 @@ func (f *HeaderFilter) GetValue() string { } func (f *HeaderFilter) SetValue(v string) { - if f != nil { - f.value = v - } + f.value = v } func (t *Target) GetRole() Role { @@ -177,9 +169,7 @@ func (t *Target) GetRole() Role { } func (t *Target) SetRole(v Role) { - if t != nil { - t.role = v - } + t.role = v } func (t *Target) GetKeys() [][]byte { @@ -191,9 +181,7 @@ func (t *Target) GetKeys() [][]byte { } func (t *Target) SetKeys(v [][]byte) { - if t != nil { - t.keys = v - } + t.keys = v } func (r *Record) GetOperation() Operation { @@ -205,9 +193,7 @@ func (r *Record) GetOperation() Operation { } func (r *Record) SetOperation(v Operation) { - if r != nil { - r.op = v - } + r.op = v } func (r *Record) GetAction() Action { @@ -219,9 +205,7 @@ func (r *Record) GetAction() Action { } func (r *Record) SetAction(v Action) { - if r != nil { - r.action = v - } + r.action = v } func (r *Record) GetFilters() []HeaderFilter { @@ -233,9 +217,7 @@ func (r *Record) GetFilters() []HeaderFilter { } func (r *Record) SetFilters(v []HeaderFilter) { - if r != nil { - r.filters = v - } + r.filters = v } func (r *Record) GetTargets() []Target { @@ -247,9 +229,7 @@ func (r *Record) GetTargets() []Target { } func (r *Record) SetTargets(v []Target) { - if r != nil { - r.targets = v - } + r.targets = v } func (t *Table) GetVersion() *refs.Version { @@ -261,9 +241,7 @@ func (t *Table) GetVersion() *refs.Version { } func (t *Table) SetVersion(v *refs.Version) { - if t != nil { - t.version = v - } + t.version = v } func (t *Table) GetContainerID() *refs.ContainerID { @@ -275,9 +253,7 @@ func (t *Table) GetContainerID() *refs.ContainerID { } func (t *Table) SetContainerID(v *refs.ContainerID) { - if t != nil { - t.cid = v - } + t.cid = v } func (t *Table) GetRecords() []Record { @@ -289,9 +265,7 @@ func (t *Table) GetRecords() []Record { } func (t *Table) SetRecords(v []Record) { - if t != nil { - t.records = v - } + t.records = v } func (l *TokenLifetime) GetExp() uint64 { @@ -303,9 +277,7 @@ func (l *TokenLifetime) GetExp() uint64 { } func (l *TokenLifetime) SetExp(v uint64) { - if l != nil { - l.exp = v - } + l.exp = v } func (l *TokenLifetime) GetNbf() uint64 { @@ -317,9 +289,7 @@ func (l *TokenLifetime) GetNbf() uint64 { } func (l *TokenLifetime) SetNbf(v uint64) { - if l != nil { - l.nbf = v - } + l.nbf = v } func (l *TokenLifetime) GetIat() uint64 { @@ -331,9 +301,7 @@ func (l *TokenLifetime) GetIat() uint64 { } func (l *TokenLifetime) SetIat(v uint64) { - if l != nil { - l.iat = v - } + l.iat = v } func (bt *BearerTokenBody) GetEACL() *Table { @@ -345,9 +313,7 @@ func (bt *BearerTokenBody) GetEACL() *Table { } func (bt *BearerTokenBody) SetEACL(v *Table) { - if bt != nil { - bt.eacl = v - } + bt.eacl = v } func (bt *BearerTokenBody) GetOwnerID() *refs.OwnerID { @@ -359,9 +325,7 @@ func (bt *BearerTokenBody) GetOwnerID() *refs.OwnerID { } func (bt *BearerTokenBody) SetOwnerID(v *refs.OwnerID) { - if bt != nil { - bt.ownerID = v - } + bt.ownerID = v } func (bt *BearerTokenBody) GetLifetime() *TokenLifetime { @@ -373,9 +337,7 @@ func (bt *BearerTokenBody) GetLifetime() *TokenLifetime { } func (bt *BearerTokenBody) SetLifetime(v *TokenLifetime) { - if bt != nil { - bt.lifetime = v - } + bt.lifetime = v } func (bt *BearerToken) GetBody() *BearerTokenBody { @@ -387,9 +349,7 @@ func (bt *BearerToken) GetBody() *BearerTokenBody { } func (bt *BearerToken) SetBody(v *BearerTokenBody) { - if bt != nil { - bt.body = v - } + bt.body = v } func (bt *BearerToken) GetSignature() *refs.Signature { @@ -401,7 +361,5 @@ func (bt *BearerToken) GetSignature() *refs.Signature { } func (bt *BearerToken) SetSignature(v *refs.Signature) { - if bt != nil { - bt.sig = v - } + bt.sig = v } diff --git a/audit/grpc/types.go b/audit/grpc/types.go index d8dd0d1..36a2267 100644 --- a/audit/grpc/types.go +++ b/audit/grpc/types.go @@ -6,98 +6,70 @@ import ( // SetVersion is a Version field setter. func (x *DataAuditResult) SetVersion(v *refs.Version) { - if x != nil { - x.Version = v - } + x.Version = v } // SetAuditEpoch is an AuditEpoch field setter. func (x *DataAuditResult) SetAuditEpoch(v uint64) { - if x != nil { - x.AuditEpoch = v - } + x.AuditEpoch = v } // SetContainerId is a ContainerId field setter. func (x *DataAuditResult) SetContainerId(v *refs.ContainerID) { - if x != nil { - x.ContainerId = v - } + x.ContainerId = v } // SetPublicKey is a PublicKey field setter. func (x *DataAuditResult) SetPublicKey(v []byte) { - if x != nil { - x.PublicKey = v - } + x.PublicKey = v } // SetComplete is a Complete field setter. func (x *DataAuditResult) SetComplete(v bool) { - if x != nil { - x.Complete = v - } + x.Complete = v } // SetRequests is a Requests field setter. func (x *DataAuditResult) SetRequests(v uint32) { - if x != nil { - x.Requests = v - } + x.Requests = v } // SetRetries is a Retries field setter. func (x *DataAuditResult) SetRetries(v uint32) { - if x != nil { - x.Retries = v - } + x.Retries = v } // SetPassSg is a PassSg field setter. func (x *DataAuditResult) SetPassSg(v []*refs.ObjectID) { - if x != nil { - x.PassSg = v - } + x.PassSg = v } // SetFailSg is a FailSg field setter. func (x *DataAuditResult) SetFailSg(v []*refs.ObjectID) { - if x != nil { - x.FailSg = v - } + x.FailSg = v } // SetHit is a Hit field setter. func (x *DataAuditResult) SetHit(v uint32) { - if x != nil { - x.Hit = v - } + x.Hit = v } // SetMiss is a Miss field setter. func (x *DataAuditResult) SetMiss(v uint32) { - if x != nil { - x.Miss = v - } + x.Miss = v } // SetFail is a Fail field setter. func (x *DataAuditResult) SetFail(v uint32) { - if x != nil { - x.Fail = v - } + x.Fail = v } // SetPassNodes is a PassNodes field setter. func (x *DataAuditResult) SetPassNodes(v [][]byte) { - if x != nil { - x.PassNodes = v - } + x.PassNodes = v } // SetFailNodes is a FailNodes field setter. func (x *DataAuditResult) SetFailNodes(v [][]byte) { - if x != nil { - x.FailNodes = v - } + x.FailNodes = v } diff --git a/audit/types.go b/audit/types.go index 8245b2a..354ef47 100644 --- a/audit/types.go +++ b/audit/types.go @@ -37,9 +37,7 @@ func (a *DataAuditResult) GetVersion() *refs.Version { // SetVersion sets version of Data Audit structure. func (a *DataAuditResult) SetVersion(v *refs.Version) { - if a != nil { - a.version = v - } + a.version = v } // GetAuditEpoch returns epoch number when the Data Audit was conducted. @@ -53,9 +51,7 @@ func (a *DataAuditResult) GetAuditEpoch() uint64 { // SetAuditEpoch sets epoch number when the Data Audit was conducted. func (a *DataAuditResult) SetAuditEpoch(v uint64) { - if a != nil { - a.auditEpoch = v - } + a.auditEpoch = v } // GetContainerID returns container under audit. @@ -69,9 +65,7 @@ func (a *DataAuditResult) GetContainerID() *refs.ContainerID { // SetContainerID sets container under audit. func (a *DataAuditResult) SetContainerID(v *refs.ContainerID) { - if a != nil { - a.cid = v - } + a.cid = v } // GetPublicKey returns public key of the auditing InnerRing node in a binary format. @@ -85,9 +79,7 @@ func (a *DataAuditResult) GetPublicKey() []byte { // SetPublicKey sets public key of the auditing InnerRing node in a binary format. func (a *DataAuditResult) SetPublicKey(v []byte) { - if a != nil { - a.pubKey = v - } + a.pubKey = v } // GetPassSG returns list of Storage Groups that passed audit PoR stage. @@ -101,9 +93,7 @@ func (a *DataAuditResult) GetPassSG() []refs.ObjectID { // SetPassSG sets list of Storage Groups that passed audit PoR stage. func (a *DataAuditResult) SetPassSG(v []refs.ObjectID) { - if a != nil { - a.passSG = v - } + a.passSG = v } // GetFailSG returns list of Storage Groups that failed audit PoR stage. @@ -117,9 +107,7 @@ func (a *DataAuditResult) GetFailSG() []refs.ObjectID { // SetFailSG sets list of Storage Groups that failed audit PoR stage. func (a *DataAuditResult) SetFailSG(v []refs.ObjectID) { - if a != nil { - a.failSG = v - } + a.failSG = v } // GetRequests returns number of requests made by PoR audit check to get @@ -135,9 +123,7 @@ func (a *DataAuditResult) GetRequests() uint32 { // SetRequests sets number of requests made by PoR audit check to get // all headers of the objects inside storage groups. func (a *DataAuditResult) SetRequests(v uint32) { - if a != nil { - a.requests = v - } + a.requests = v } // GetRetries returns number of retries made by PoR audit check to get @@ -153,9 +139,7 @@ func (a *DataAuditResult) GetRetries() uint32 { // SetRetries sets number of retries made by PoR audit check to get // all headers of the objects inside storage groups. func (a *DataAuditResult) SetRetries(v uint32) { - if a != nil { - a.retries = v - } + a.retries = v } // GetHit returns number of sampled objects under audit placed @@ -173,9 +157,7 @@ func (a *DataAuditResult) GetHit() uint32 { // in an optimal way according to the containers placement policy // when checking PoP. func (a *DataAuditResult) SetHit(v uint32) { - if a != nil { - a.hit = v - } + a.hit = v } // GetMiss returns number of sampled objects under audit placed @@ -193,9 +175,7 @@ func (a *DataAuditResult) GetMiss() uint32 { // in suboptimal way according to the containers placement policy, // but still at a satisfactory level when checking PoP. func (a *DataAuditResult) SetMiss(v uint32) { - if a != nil { - a.miss = v - } + a.miss = v } // GetFail returns number of sampled objects under audit stored @@ -213,9 +193,7 @@ func (a *DataAuditResult) GetFail() uint32 { // in a way not confirming placement policy or not found at all // when checking PoP. func (a *DataAuditResult) SetFail(v uint32) { - if a != nil { - a.fail = v - } + a.fail = v } // GetPassNodes returns list of storage node public keys that @@ -231,9 +209,7 @@ func (a *DataAuditResult) GetPassNodes() [][]byte { // SetPassNodes sets list of storage node public keys that // passed at least one PDP. func (a *DataAuditResult) SetPassNodes(v [][]byte) { - if a != nil { - a.passNodes = v - } + a.passNodes = v } // GetFailNodes returns list of storage node public keys that @@ -249,9 +225,7 @@ func (a *DataAuditResult) GetFailNodes() [][]byte { // SetFailNodes sets list of storage node public keys that // failed at least one PDP. func (a *DataAuditResult) SetFailNodes(v [][]byte) { - if a != nil { - a.failNodes = v - } + a.failNodes = v } // GetComplete returns boolean completion statement of audit result. @@ -265,7 +239,5 @@ func (a *DataAuditResult) GetComplete() bool { // SetComplete sets boolean completion statement of audit result. func (a *DataAuditResult) SetComplete(v bool) { - if a != nil { - a.complete = v - } + a.complete = v } diff --git a/container/grpc/service.go b/container/grpc/service.go index 09743dc..e8f8e72 100644 --- a/container/grpc/service.go +++ b/container/grpc/service.go @@ -8,121 +8,87 @@ import ( // SetContainer sets container of the request. func (m *PutRequest_Body) SetContainer(v *Container) { - if m != nil { - m.Container = v - } + m.Container = v } // SetSignature sets signature of the container structure. func (m *PutRequest_Body) SetSignature(v *refs.SignatureRFC6979) { - if m != nil { - m.Signature = v - } + m.Signature = v } // SetBody sets body of the request. func (m *PutRequest) SetBody(v *PutRequest_Body) { - if m != nil { - m.Body = v - } + m.Body = v } // SetMetaHeader sets meta header of the request. func (m *PutRequest) SetMetaHeader(v *session.RequestMetaHeader) { - if m != nil { - m.MetaHeader = v - } + m.MetaHeader = v } // SetVerifyHeader sets verification header of the request. func (m *PutRequest) SetVerifyHeader(v *session.RequestVerificationHeader) { - if m != nil { - m.VerifyHeader = v - } + m.VerifyHeader = v } // SetContainerId sets identifier of the container. func (m *PutResponse_Body) SetContainerId(v *refs.ContainerID) { - if m != nil { - m.ContainerId = v - } + m.ContainerId = v } // SetBody sets body of the response. func (m *PutResponse) SetBody(v *PutResponse_Body) { - if m != nil { - m.Body = v - } + m.Body = v } // SetMetaHeader sets meta header of the response. func (m *PutResponse) SetMetaHeader(v *session.ResponseMetaHeader) { - if m != nil { - m.MetaHeader = v - } + m.MetaHeader = v } // SetVerifyHeader sets verification header of the response. func (m *PutResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) { - if m != nil { - m.VerifyHeader = v - } + m.VerifyHeader = v } // SetContainerId sets identifier of the container. func (m *DeleteRequest_Body) SetContainerId(v *refs.ContainerID) { - if m != nil { - m.ContainerId = v - } + m.ContainerId = v } // SetSignature sets signature of the container identifier. func (m *DeleteRequest_Body) SetSignature(v *refs.SignatureRFC6979) { - if m != nil { - m.Signature = v - } + m.Signature = v } // SetBody sets body of the request. func (m *DeleteRequest) SetBody(v *DeleteRequest_Body) { - if m != nil { - m.Body = v - } + m.Body = v } // SetMetaHeader sets meta header of the request. func (m *DeleteRequest) SetMetaHeader(v *session.RequestMetaHeader) { - if m != nil { - m.MetaHeader = v - } + m.MetaHeader = v } // SetVerifyHeader sets verification header of the request. func (m *DeleteRequest) SetVerifyHeader(v *session.RequestVerificationHeader) { - if m != nil { - m.VerifyHeader = v - } + m.VerifyHeader = v } // SetBody sets body of the response. func (m *DeleteResponse) SetBody(v *DeleteResponse_Body) { - if m != nil { - m.Body = v - } + m.Body = v } // SetMetaHeader sets meta header of the response. func (m *DeleteResponse) SetMetaHeader(v *session.ResponseMetaHeader) { - if m != nil { - m.MetaHeader = v - } + m.MetaHeader = v } // SetVerifyHeader sets verification header of the response. func (m *DeleteResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) { - if m != nil { - m.VerifyHeader = v - } + m.VerifyHeader = v } // SetContainerId sets identifier of the container. @@ -132,317 +98,227 @@ func (m *GetRequest_Body) SetContainerId(v *refs.ContainerID) { // SetBody sets body of the request. func (m *GetRequest) SetBody(v *GetRequest_Body) { - if m != nil { - m.Body = v - } + m.Body = v } // SetMetaHeader sets meta header of the request. func (m *GetRequest) SetMetaHeader(v *session.RequestMetaHeader) { - if m != nil { - m.MetaHeader = v - } + m.MetaHeader = v } // SetVerifyHeader sets verification header of the request. func (m *GetRequest) SetVerifyHeader(v *session.RequestVerificationHeader) { - if m != nil { - m.VerifyHeader = v - } + m.VerifyHeader = v } // SetContainer sets the container structure. func (m *GetResponse_Body) SetContainer(v *Container) { - if m != nil { - m.Container = v - } + m.Container = v } // SetSessionToken sets token of the session within which requested // container was created. func (m *GetResponse_Body) SetSessionToken(v *session.SessionToken) { - if m != nil { - m.SessionToken = v - } + m.SessionToken = v } // SetSignature sets signature of the container structure. func (m *GetResponse_Body) SetSignature(v *refs.SignatureRFC6979) { - if m != nil { - m.Signature = v - } + m.Signature = v } // SetBody sets body of the response. func (m *GetResponse) SetBody(v *GetResponse_Body) { - if m != nil { - m.Body = v - } + m.Body = v } // SetMetaHeader sets meta header of the response. func (m *GetResponse) SetMetaHeader(v *session.ResponseMetaHeader) { - if m != nil { - m.MetaHeader = v - } + m.MetaHeader = v } // SetVerifyHeader sets verification header of the response. func (m *GetResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) { - if m != nil { - m.VerifyHeader = v - } + m.VerifyHeader = v } // SetOwnerId sets identifier of the container owner. func (m *ListRequest_Body) SetOwnerId(v *refs.OwnerID) { - if m != nil { - m.OwnerId = v - } + m.OwnerId = v } // SetBody sets body of the request. func (m *ListRequest) SetBody(v *ListRequest_Body) { - if m != nil { - m.Body = v - } + m.Body = v } // SetMetaHeader sets meta header of the request. func (m *ListRequest) SetMetaHeader(v *session.RequestMetaHeader) { - if m != nil { - m.MetaHeader = v - } + m.MetaHeader = v } // SetVerifyHeader sets verification header of the request. func (m *ListRequest) SetVerifyHeader(v *session.RequestVerificationHeader) { - if m != nil { - m.VerifyHeader = v - } + m.VerifyHeader = v } // SetContainerIds sets list of the container identifiers. func (m *ListResponse_Body) SetContainerIds(v []*refs.ContainerID) { - if m != nil { - m.ContainerIds = v - } + m.ContainerIds = v } // SetBody sets body of the response. func (m *ListResponse) SetBody(v *ListResponse_Body) { - if m != nil { - m.Body = v - } + m.Body = v } // SetMetaHeader sets meta header of the response. func (m *ListResponse) SetMetaHeader(v *session.ResponseMetaHeader) { - if m != nil { - m.MetaHeader = v - } + m.MetaHeader = v } // SetVerifyHeader sets verification header of the response. func (m *ListResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) { - if m != nil { - m.VerifyHeader = v - } + m.VerifyHeader = v } // SetEacl sets eACL table structure. func (m *SetExtendedACLRequest_Body) SetEacl(v *acl.EACLTable) { - if m != nil { - m.Eacl = v - } + m.Eacl = v } // SetSignature sets signature of the eACL table structure. func (m *SetExtendedACLRequest_Body) SetSignature(v *refs.SignatureRFC6979) { - if m != nil { - m.Signature = v - } + m.Signature = v } // SetBody sets body of the request. func (m *SetExtendedACLRequest) SetBody(v *SetExtendedACLRequest_Body) { - if m != nil { - m.Body = v - } + m.Body = v } // SetMetaHeader sets meta header of the request. func (m *SetExtendedACLRequest) SetMetaHeader(v *session.RequestMetaHeader) { - if m != nil { - m.MetaHeader = v - } + m.MetaHeader = v } // SetVerifyHeader sets verification header of the request. func (m *SetExtendedACLRequest) SetVerifyHeader(v *session.RequestVerificationHeader) { - if m != nil { - m.VerifyHeader = v - } + m.VerifyHeader = v } // SetBody sets body of the response. func (m *SetExtendedACLResponse) SetBody(v *SetExtendedACLResponse_Body) { - if m != nil { - m.Body = v - } + m.Body = v } // SetMetaHeader sets meta header of the response. func (m *SetExtendedACLResponse) SetMetaHeader(v *session.ResponseMetaHeader) { - if m != nil { - m.MetaHeader = v - } + m.MetaHeader = v } // SetVerifyHeader sets verification header of the response. func (m *SetExtendedACLResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) { - if m != nil { - m.VerifyHeader = v - } + m.VerifyHeader = v } // SetContainerId sets identifier of the container. func (m *GetExtendedACLRequest_Body) SetContainerId(v *refs.ContainerID) { - if m != nil { - m.ContainerId = v - } + m.ContainerId = v } // SetBody sets body of the request. func (m *GetExtendedACLRequest) SetBody(v *GetExtendedACLRequest_Body) { - if m != nil { - m.Body = v - } + m.Body = v } // SetMetaHeader sets meta header of the request. func (m *GetExtendedACLRequest) SetMetaHeader(v *session.RequestMetaHeader) { - if m != nil { - m.MetaHeader = v - } + m.MetaHeader = v } // SetVerifyHeader sets verification header of the request. func (m *GetExtendedACLRequest) SetVerifyHeader(v *session.RequestVerificationHeader) { - if m != nil { - m.VerifyHeader = v - } + m.VerifyHeader = v } // SetEacl sets eACL table structure. func (m *GetExtendedACLResponse_Body) SetEacl(v *acl.EACLTable) { - if m != nil { - m.Eacl = v - } + m.Eacl = v } // SetSignature sets signature of the eACL table structure. func (m *GetExtendedACLResponse_Body) SetSignature(v *refs.SignatureRFC6979) { - if m != nil { - m.Signature = v - } + m.Signature = v } // SetSessionToken sets token of the session within which requested // eACl table was set. func (m *GetExtendedACLResponse_Body) SetSessionToken(v *session.SessionToken) { - if m != nil { - m.SessionToken = v - } + m.SessionToken = v } // SetBody sets body of the response. func (m *GetExtendedACLResponse) SetBody(v *GetExtendedACLResponse_Body) { - if m != nil { - m.Body = v - } + m.Body = v } // SetMetaHeader sets meta header of the response. func (m *GetExtendedACLResponse) SetMetaHeader(v *session.ResponseMetaHeader) { - if m != nil { - m.MetaHeader = v - } + m.MetaHeader = v } // SetVerifyHeader sets verification header of the response. func (m *GetExtendedACLResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) { - if m != nil { - m.VerifyHeader = v - } + m.VerifyHeader = v } // SetEpoch sets epoch of the size estimation. func (m *AnnounceUsedSpaceRequest_Body_Announcement) SetEpoch(v uint64) { - if m != nil { - m.Epoch = v - } + m.Epoch = v } // SetContainerId sets identifier of the container. func (m *AnnounceUsedSpaceRequest_Body_Announcement) SetContainerId(v *refs.ContainerID) { - if m != nil { - m.ContainerId = v - } + m.ContainerId = v } // SetUsedSpace sets used space value of the container. func (m *AnnounceUsedSpaceRequest_Body_Announcement) SetUsedSpace(v uint64) { - if m != nil { - m.UsedSpace = v - } + m.UsedSpace = v } // SetAnnouncements sets list of announcement for shared containers between nodes. func (m *AnnounceUsedSpaceRequest_Body) SetAnnouncements(v []*AnnounceUsedSpaceRequest_Body_Announcement) { - if m != nil { - m.Announcements = v - } + m.Announcements = v } // SetBody sets body of the request. func (m *AnnounceUsedSpaceRequest) SetBody(v *AnnounceUsedSpaceRequest_Body) { - if m != nil { - m.Body = v - } + m.Body = v } // SetMetaHeader sets meta header of the request. func (m *AnnounceUsedSpaceRequest) SetMetaHeader(v *session.RequestMetaHeader) { - if m != nil { - m.MetaHeader = v - } + m.MetaHeader = v } // SetVerifyHeader sets verification header of the request. func (m *AnnounceUsedSpaceRequest) SetVerifyHeader(v *session.RequestVerificationHeader) { - if m != nil { - m.VerifyHeader = v - } + m.VerifyHeader = v } // SetBody sets body of the response. func (m *AnnounceUsedSpaceResponse) SetBody(v *AnnounceUsedSpaceResponse_Body) { - if m != nil { - m.Body = v - } + m.Body = v } // SetMetaHeader sets meta header of the response. func (m *AnnounceUsedSpaceResponse) SetMetaHeader(v *session.ResponseMetaHeader) { - if m != nil { - m.MetaHeader = v - } + m.MetaHeader = v } // SetVerifyHeader sets verification header of the response. func (m *AnnounceUsedSpaceResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) { - if m != nil { - m.VerifyHeader = v - } + m.VerifyHeader = v } diff --git a/container/grpc/types.go b/container/grpc/types.go index 9fed6b2..2bb9b8b 100644 --- a/container/grpc/types.go +++ b/container/grpc/types.go @@ -7,56 +7,40 @@ import ( // SetKey sets key to the container attribute. func (m *Container_Attribute) SetKey(v string) { - if m != nil { - m.Key = v - } + m.Key = v } // SetValue sets value of the container attribute. func (m *Container_Attribute) SetValue(v string) { - if m != nil { - m.Value = v - } + m.Value = v } // SetOwnerId sets identifier of the container owner, func (m *Container) SetOwnerId(v *refs.OwnerID) { - if m != nil { - m.OwnerId = v - } + m.OwnerId = v } // SetNonce sets nonce of the container structure. func (m *Container) SetNonce(v []byte) { - if m != nil { - m.Nonce = v - } + m.Nonce = v } // SetBasicAcl sets basic ACL of the container. func (m *Container) SetBasicAcl(v uint32) { - if m != nil { - m.BasicAcl = v - } + m.BasicAcl = v } // SetAttributes sets list of the container attributes. func (m *Container) SetAttributes(v []*Container_Attribute) { - if m != nil { - m.Attributes = v - } + m.Attributes = v } // SetPlacementPolicy sets placement policy of the container. func (m *Container) SetPlacementPolicy(v *netmap.PlacementPolicy) { - if m != nil { - m.PlacementPolicy = v - } + m.PlacementPolicy = v } // SetVersion sets version of the container. func (m *Container) SetVersion(v *refs.Version) { - if m != nil { - m.Version = v - } + m.Version = v } diff --git a/container/types.go b/container/types.go index 25755a8..215f830 100644 --- a/container/types.go +++ b/container/types.go @@ -189,9 +189,7 @@ func (a *Attribute) GetKey() string { } func (a *Attribute) SetKey(v string) { - if a != nil { - a.key = v - } + a.key = v } func (a *Attribute) GetValue() string { @@ -203,9 +201,7 @@ func (a *Attribute) GetValue() string { } func (a *Attribute) SetValue(v string) { - if a != nil { - a.val = v - } + a.val = v } func (c *Container) GetVersion() *refs.Version { @@ -217,9 +213,7 @@ func (c *Container) GetVersion() *refs.Version { } func (c *Container) SetVersion(v *refs.Version) { - if c != nil { - c.version = v - } + c.version = v } func (c *Container) GetOwnerID() *refs.OwnerID { @@ -231,9 +225,7 @@ func (c *Container) GetOwnerID() *refs.OwnerID { } func (c *Container) SetOwnerID(v *refs.OwnerID) { - if c != nil { - c.ownerID = v - } + c.ownerID = v } func (c *Container) GetNonce() []byte { @@ -245,9 +237,7 @@ func (c *Container) GetNonce() []byte { } func (c *Container) SetNonce(v []byte) { - if c != nil { - c.nonce = v - } + c.nonce = v } func (c *Container) GetBasicACL() uint32 { @@ -259,9 +249,7 @@ func (c *Container) GetBasicACL() uint32 { } func (c *Container) SetBasicACL(v uint32) { - if c != nil { - c.basicACL = v - } + c.basicACL = v } func (c *Container) GetAttributes() []Attribute { @@ -273,9 +261,7 @@ func (c *Container) GetAttributes() []Attribute { } func (c *Container) SetAttributes(v []Attribute) { - if c != nil { - c.attr = v - } + c.attr = v } func (c *Container) GetPlacementPolicy() *netmap.PlacementPolicy { @@ -287,9 +273,7 @@ func (c *Container) GetPlacementPolicy() *netmap.PlacementPolicy { } func (c *Container) SetPlacementPolicy(v *netmap.PlacementPolicy) { - if c != nil { - c.policy = v - } + c.policy = v } func (r *PutRequestBody) GetContainer() *Container { @@ -301,9 +285,7 @@ func (r *PutRequestBody) GetContainer() *Container { } func (r *PutRequestBody) SetContainer(v *Container) { - if r != nil { - r.cnr = v - } + r.cnr = v } func (r *PutRequestBody) GetSignature() *refs.Signature { @@ -315,11 +297,9 @@ func (r *PutRequestBody) GetSignature() *refs.Signature { } func (r *PutRequestBody) SetSignature(v *refs.Signature) { - if r != nil { - // TODO: (neofs-api-go#381) avoid this hack (e.g. create refs.SignatureRFC6979 type) - v.SetScheme(0) - r.sig = v - } + // TODO: (neofs-api-go#381) avoid this hack (e.g. create refs.SignatureRFC6979 type) + v.SetScheme(0) + r.sig = v } func (r *PutRequest) GetBody() *PutRequestBody { @@ -331,9 +311,7 @@ func (r *PutRequest) GetBody() *PutRequestBody { } func (r *PutRequest) SetBody(v *PutRequestBody) { - if r != nil { - r.body = v - } + r.body = v } func (r *PutResponseBody) GetContainerID() *refs.ContainerID { @@ -345,9 +323,7 @@ func (r *PutResponseBody) GetContainerID() *refs.ContainerID { } func (r *PutResponseBody) SetContainerID(v *refs.ContainerID) { - if r != nil { - r.cid = v - } + r.cid = v } func (r *PutResponse) GetBody() *PutResponseBody { @@ -359,9 +335,7 @@ func (r *PutResponse) GetBody() *PutResponseBody { } func (r *PutResponse) SetBody(v *PutResponseBody) { - if r != nil { - r.body = v - } + r.body = v } func (r *GetRequestBody) GetContainerID() *refs.ContainerID { @@ -373,9 +347,7 @@ func (r *GetRequestBody) GetContainerID() *refs.ContainerID { } func (r *GetRequestBody) SetContainerID(v *refs.ContainerID) { - if r != nil { - r.cid = v - } + r.cid = v } func (r *GetRequest) GetBody() *GetRequestBody { @@ -387,9 +359,7 @@ func (r *GetRequest) GetBody() *GetRequestBody { } func (r *GetRequest) SetBody(v *GetRequestBody) { - if r != nil { - r.body = v - } + r.body = v } func (r *GetResponseBody) GetContainer() *Container { @@ -401,9 +371,7 @@ func (r *GetResponseBody) GetContainer() *Container { } func (r *GetResponseBody) SetContainer(v *Container) { - if r != nil { - r.cnr = v - } + r.cnr = v } // GetSessionToken returns token of the session within which requested @@ -419,9 +387,7 @@ func (r *GetResponseBody) GetSessionToken() *session.Token { // SetSessionToken sets token of the session within which requested // container was created. func (r *GetResponseBody) SetSessionToken(v *session.Token) { - if r != nil { - r.token = v - } + r.token = v } // GetSignature returns signature of the requested container. @@ -435,11 +401,9 @@ func (r *GetResponseBody) GetSignature() *refs.Signature { // SetSignature sets signature of the requested container. func (r *GetResponseBody) SetSignature(v *refs.Signature) { - if r != nil { - // TODO: (neofs-api-go#381) avoid this hack (e.g. create refs.SignatureRFC6979 type) - v.SetScheme(0) - r.sig = v - } + // TODO: (neofs-api-go#381) avoid this hack (e.g. create refs.SignatureRFC6979 type) + v.SetScheme(0) + r.sig = v } func (r *GetResponse) GetBody() *GetResponseBody { @@ -451,9 +415,7 @@ func (r *GetResponse) GetBody() *GetResponseBody { } func (r *GetResponse) SetBody(v *GetResponseBody) { - if r != nil { - r.body = v - } + r.body = v } func (r *DeleteRequestBody) GetContainerID() *refs.ContainerID { @@ -465,9 +427,7 @@ func (r *DeleteRequestBody) GetContainerID() *refs.ContainerID { } func (r *DeleteRequestBody) SetContainerID(v *refs.ContainerID) { - if r != nil { - r.cid = v - } + r.cid = v } func (r *DeleteRequestBody) GetSignature() *refs.Signature { @@ -479,11 +439,9 @@ func (r *DeleteRequestBody) GetSignature() *refs.Signature { } func (r *DeleteRequestBody) SetSignature(v *refs.Signature) { - if r != nil { - // TODO: (neofs-api-go#381) avoid this hack (e.g. create refs.SignatureRFC6979 type) - v.SetScheme(0) - r.sig = v - } + // TODO: (neofs-api-go#381) avoid this hack (e.g. create refs.SignatureRFC6979 type) + v.SetScheme(0) + r.sig = v } func (r *DeleteRequest) GetBody() *DeleteRequestBody { @@ -495,9 +453,7 @@ func (r *DeleteRequest) GetBody() *DeleteRequestBody { } func (r *DeleteRequest) SetBody(v *DeleteRequestBody) { - if r != nil { - r.body = v - } + r.body = v } func (r *DeleteResponse) GetBody() *DeleteResponseBody { @@ -509,9 +465,7 @@ func (r *DeleteResponse) GetBody() *DeleteResponseBody { } func (r *DeleteResponse) SetBody(v *DeleteResponseBody) { - if r != nil { - r.body = v - } + r.body = v } func (r *ListRequestBody) GetOwnerID() *refs.OwnerID { @@ -523,9 +477,7 @@ func (r *ListRequestBody) GetOwnerID() *refs.OwnerID { } func (r *ListRequestBody) SetOwnerID(v *refs.OwnerID) { - if r != nil { - r.ownerID = v - } + r.ownerID = v } func (r *ListRequest) GetBody() *ListRequestBody { @@ -537,9 +489,7 @@ func (r *ListRequest) GetBody() *ListRequestBody { } func (r *ListRequest) SetBody(v *ListRequestBody) { - if r != nil { - r.body = v - } + r.body = v } func (r *ListResponseBody) GetContainerIDs() []refs.ContainerID { @@ -551,9 +501,7 @@ func (r *ListResponseBody) GetContainerIDs() []refs.ContainerID { } func (r *ListResponseBody) SetContainerIDs(v []refs.ContainerID) { - if r != nil { - r.cidList = v - } + r.cidList = v } func (r *ListResponse) GetBody() *ListResponseBody { @@ -565,9 +513,7 @@ func (r *ListResponse) GetBody() *ListResponseBody { } func (r *ListResponse) SetBody(v *ListResponseBody) { - if r != nil { - r.body = v - } + r.body = v } func (r *SetExtendedACLRequestBody) GetEACL() *acl.Table { @@ -579,9 +525,7 @@ func (r *SetExtendedACLRequestBody) GetEACL() *acl.Table { } func (r *SetExtendedACLRequestBody) SetEACL(v *acl.Table) { - if r != nil { - r.eacl = v - } + r.eacl = v } func (r *SetExtendedACLRequestBody) GetSignature() *refs.Signature { @@ -593,11 +537,9 @@ func (r *SetExtendedACLRequestBody) GetSignature() *refs.Signature { } func (r *SetExtendedACLRequestBody) SetSignature(v *refs.Signature) { - if r != nil { - // TODO: (neofs-api-go#381) avoid this hack (e.g. create refs.SignatureRFC6979 type) - v.SetScheme(0) - r.sig = v - } + // TODO: (neofs-api-go#381) avoid this hack (e.g. create refs.SignatureRFC6979 type) + v.SetScheme(0) + r.sig = v } func (r *SetExtendedACLRequest) GetBody() *SetExtendedACLRequestBody { @@ -609,9 +551,7 @@ func (r *SetExtendedACLRequest) GetBody() *SetExtendedACLRequestBody { } func (r *SetExtendedACLRequest) SetBody(v *SetExtendedACLRequestBody) { - if r != nil { - r.body = v - } + r.body = v } func (r *SetExtendedACLResponse) GetBody() *SetExtendedACLResponseBody { @@ -623,9 +563,7 @@ func (r *SetExtendedACLResponse) GetBody() *SetExtendedACLResponseBody { } func (r *SetExtendedACLResponse) SetBody(v *SetExtendedACLResponseBody) { - if r != nil { - r.body = v - } + r.body = v } func (r *GetExtendedACLRequestBody) GetContainerID() *refs.ContainerID { @@ -637,9 +575,7 @@ func (r *GetExtendedACLRequestBody) GetContainerID() *refs.ContainerID { } func (r *GetExtendedACLRequestBody) SetContainerID(v *refs.ContainerID) { - if r != nil { - r.cid = v - } + r.cid = v } func (r *GetExtendedACLRequest) GetBody() *GetExtendedACLRequestBody { @@ -651,9 +587,7 @@ func (r *GetExtendedACLRequest) GetBody() *GetExtendedACLRequestBody { } func (r *GetExtendedACLRequest) SetBody(v *GetExtendedACLRequestBody) { - if r != nil { - r.body = v - } + r.body = v } func (r *GetExtendedACLResponseBody) GetEACL() *acl.Table { @@ -665,9 +599,7 @@ func (r *GetExtendedACLResponseBody) GetEACL() *acl.Table { } func (r *GetExtendedACLResponseBody) SetEACL(v *acl.Table) { - if r != nil { - r.eacl = v - } + r.eacl = v } func (r *GetExtendedACLResponseBody) GetSignature() *refs.Signature { @@ -679,11 +611,9 @@ func (r *GetExtendedACLResponseBody) GetSignature() *refs.Signature { } func (r *GetExtendedACLResponseBody) SetSignature(v *refs.Signature) { - if r != nil { - // TODO: (neofs-api-go#381) avoid this hack (e.g. create refs.SignatureRFC6979 type) - v.SetScheme(0) - r.sig = v - } + // TODO: (neofs-api-go#381) avoid this hack (e.g. create refs.SignatureRFC6979 type) + v.SetScheme(0) + r.sig = v } // GetSessionToken returns token of the session within which requested @@ -699,9 +629,7 @@ func (r *GetExtendedACLResponseBody) GetSessionToken() *session.Token { // SetSessionToken sets token of the session within which requested // eACL table was set. func (r *GetExtendedACLResponseBody) SetSessionToken(v *session.Token) { - if r != nil { - r.token = v - } + r.token = v } func (r *GetExtendedACLResponse) GetBody() *GetExtendedACLResponseBody { @@ -713,9 +641,7 @@ func (r *GetExtendedACLResponse) GetBody() *GetExtendedACLResponseBody { } func (r *GetExtendedACLResponse) SetBody(v *GetExtendedACLResponseBody) { - if r != nil { - r.body = v - } + r.body = v } func (a *UsedSpaceAnnouncement) GetEpoch() uint64 { @@ -727,9 +653,7 @@ func (a *UsedSpaceAnnouncement) GetEpoch() uint64 { } func (a *UsedSpaceAnnouncement) SetEpoch(v uint64) { - if a != nil { - a.epoch = v - } + a.epoch = v } func (a *UsedSpaceAnnouncement) GetUsedSpace() uint64 { @@ -741,9 +665,7 @@ func (a *UsedSpaceAnnouncement) GetUsedSpace() uint64 { } func (a *UsedSpaceAnnouncement) SetUsedSpace(v uint64) { - if a != nil { - a.usedSpace = v - } + a.usedSpace = v } func (a *UsedSpaceAnnouncement) GetContainerID() *refs.ContainerID { @@ -755,9 +677,7 @@ func (a *UsedSpaceAnnouncement) GetContainerID() *refs.ContainerID { } func (a *UsedSpaceAnnouncement) SetContainerID(v *refs.ContainerID) { - if a != nil { - a.cid = v - } + a.cid = v } func (r *AnnounceUsedSpaceRequestBody) GetAnnouncements() []UsedSpaceAnnouncement { @@ -769,9 +689,7 @@ func (r *AnnounceUsedSpaceRequestBody) GetAnnouncements() []UsedSpaceAnnouncemen } func (r *AnnounceUsedSpaceRequestBody) SetAnnouncements(v []UsedSpaceAnnouncement) { - if r != nil { - r.announcements = v - } + r.announcements = v } func (r *AnnounceUsedSpaceRequest) GetBody() *AnnounceUsedSpaceRequestBody { @@ -783,9 +701,7 @@ func (r *AnnounceUsedSpaceRequest) GetBody() *AnnounceUsedSpaceRequestBody { } func (r *AnnounceUsedSpaceRequest) SetBody(v *AnnounceUsedSpaceRequestBody) { - if r != nil { - r.body = v - } + r.body = v } func (r *AnnounceUsedSpaceResponse) GetBody() *AnnounceUsedSpaceResponseBody { @@ -797,7 +713,5 @@ func (r *AnnounceUsedSpaceResponse) GetBody() *AnnounceUsedSpaceResponseBody { } func (r *AnnounceUsedSpaceResponse) SetBody(v *AnnounceUsedSpaceResponseBody) { - if r != nil { - r.body = v - } + r.body = v } diff --git a/netmap/grpc/service.go b/netmap/grpc/service.go index 36ed88d..0061631 100644 --- a/netmap/grpc/service.go +++ b/netmap/grpc/service.go @@ -7,105 +7,75 @@ import ( // SetBody sets body of the request. func (m *LocalNodeInfoRequest) SetBody(v *LocalNodeInfoRequest_Body) { - if m != nil { - m.Body = v - } + m.Body = v } // SetMetaHeader sets meta header of the request. func (m *LocalNodeInfoRequest) SetMetaHeader(v *session.RequestMetaHeader) { - if m != nil { - m.MetaHeader = v - } + m.MetaHeader = v } // SetVerifyHeader sets verification header of the request. func (m *LocalNodeInfoRequest) SetVerifyHeader(v *session.RequestVerificationHeader) { - if m != nil { - m.VerifyHeader = v - } + m.VerifyHeader = v } // SetVersion sets version of response body. func (m *LocalNodeInfoResponse_Body) SetVersion(v *refs.Version) { - if m != nil { - m.Version = v - } + m.Version = v } // SetNodeInfo sets node info of response body. func (m *LocalNodeInfoResponse_Body) SetNodeInfo(v *NodeInfo) { - if m != nil { - m.NodeInfo = v - } + m.NodeInfo = v } // SetBody sets body of the response. func (m *LocalNodeInfoResponse) SetBody(v *LocalNodeInfoResponse_Body) { - if m != nil { - m.Body = v - } + m.Body = v } // SetMetaHeader sets meta header of the response. func (m *LocalNodeInfoResponse) SetMetaHeader(v *session.ResponseMetaHeader) { - if m != nil { - m.MetaHeader = v - } + m.MetaHeader = v } // SetVerifyHeader sets verification header of the response. func (m *LocalNodeInfoResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) { - if m != nil { - m.VerifyHeader = v - } + m.VerifyHeader = v } // SetBody sets body of the request. func (x *NetworkInfoRequest) SetBody(v *NetworkInfoRequest_Body) { - if x != nil { - x.Body = v - } + x.Body = v } // SetMetaHeader sets meta header of the request. func (x *NetworkInfoRequest) SetMetaHeader(v *session.RequestMetaHeader) { - if x != nil { - x.MetaHeader = v - } + x.MetaHeader = v } // SetVerifyHeader sets verification header of the request. func (x *NetworkInfoRequest) SetVerifyHeader(v *session.RequestVerificationHeader) { - if x != nil { - x.VerifyHeader = v - } + x.VerifyHeader = v } // SetNetworkInfo sets information about the network. func (x *NetworkInfoResponse_Body) SetNetworkInfo(v *NetworkInfo) { - if x != nil { - x.NetworkInfo = v - } + x.NetworkInfo = v } // SetBody sets body of the response. func (x *NetworkInfoResponse) SetBody(v *NetworkInfoResponse_Body) { - if x != nil { - x.Body = v - } + x.Body = v } // SetMetaHeader sets meta header of the response. func (x *NetworkInfoResponse) SetMetaHeader(v *session.ResponseMetaHeader) { - if x != nil { - x.MetaHeader = v - } + x.MetaHeader = v } // SetVerifyHeader sets verification header of the response. func (x *NetworkInfoResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) { - if x != nil { - x.VerifyHeader = v - } + x.VerifyHeader = v } diff --git a/netmap/grpc/types.go b/netmap/grpc/types.go index 95b0acc..940404a 100644 --- a/netmap/grpc/types.go +++ b/netmap/grpc/types.go @@ -4,142 +4,102 @@ import refs "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" // SetReplicas of placement policy. func (m *PlacementPolicy) SetReplicas(v []*Replica) { - if m != nil { - m.Replicas = v - } + m.Replicas = v } // SetContainerBackupFactor of placement policy. func (m *PlacementPolicy) SetContainerBackupFactor(v uint32) { - if m != nil { - m.ContainerBackupFactor = v - } + m.ContainerBackupFactor = v } // SetSelectors of placement policy. func (m *PlacementPolicy) SetSelectors(v []*Selector) { - if m != nil { - m.Selectors = v - } + m.Selectors = v } // SetFilters of placement policy. func (m *PlacementPolicy) SetFilters(v []*Filter) { - if m != nil { - m.Filters = v - } + m.Filters = v } // SetSubnetID sets ID of subnet. func (m *PlacementPolicy) SetSubnetID(v *refs.SubnetID) { - if m != nil { - m.SubnetId = v - } + m.SubnetId = v } // SetName of placement filter. func (m *Filter) SetName(v string) { - if m != nil { - m.Name = v - } + m.Name = v } // SetKey of placement filter. func (m *Filter) SetKey(v string) { - if m != nil { - m.Key = v - } + m.Key = v } // SetOperation of placement filter. func (m *Filter) SetOp(v Operation) { - if m != nil { - m.Op = v - } + m.Op = v } // SetValue of placement filter. func (m *Filter) SetValue(v string) { - if m != nil { - m.Value = v - } + m.Value = v } // SetFilters sets sub-filters of placement filter. func (m *Filter) SetFilters(v []*Filter) { - if m != nil { - m.Filters = v - } + m.Filters = v } // SetName of placement selector. func (m *Selector) SetName(v string) { - if m != nil { - m.Name = v - } + m.Name = v } // SetCount of nodes of placement selector. func (m *Selector) SetCount(v uint32) { - if m != nil { - m.Count = v - } + m.Count = v } // SetAttribute of nodes of placement selector. func (m *Selector) SetAttribute(v string) { - if m != nil { - m.Attribute = v - } + m.Attribute = v } // SetFilter of placement selector. func (m *Selector) SetFilter(v string) { - if m != nil { - m.Filter = v - } + m.Filter = v } // SetClause of placement selector. func (m *Selector) SetClause(v Clause) { - if m != nil { - m.Clause = v - } + m.Clause = v } // SetCount of object replica. func (m *Replica) SetCount(v uint32) { - if m != nil { - m.Count = v - } + m.Count = v } // SetSelector of object replica. func (m *Replica) SetSelector(v string) { - if m != nil { - m.Selector = v - } + m.Selector = v } // SetKey sets key to the node attribute. func (m *NodeInfo_Attribute) SetKey(v string) { - if m != nil { - m.Key = v - } + m.Key = v } // SetValue sets value of the node attribute. func (m *NodeInfo_Attribute) SetValue(v string) { - if m != nil { - m.Value = v - } + m.Value = v } // SetParent sets value of the node parents. func (m *NodeInfo_Attribute) SetParents(v []string) { - if m != nil { - m.Parents = v - } + m.Parents = v } // SetAddress sets node network address. @@ -151,58 +111,42 @@ func (m *NodeInfo) SetAddress(v string) { // SetAddresses sets list of network addresses of the node. func (m *NodeInfo) SetAddresses(v []string) { - if m != nil { - m.Addresses = v - } + m.Addresses = v } // SetPublicKey sets node public key in a binary format. func (m *NodeInfo) SetPublicKey(v []byte) { - if m != nil { - m.PublicKey = v - } + m.PublicKey = v } // SetAttributes sets list of the node attributes. func (m *NodeInfo) SetAttributes(v []*NodeInfo_Attribute) { - if m != nil { - m.Attributes = v - } + m.Attributes = v } // SetState sets node state. func (m *NodeInfo) SetState(v NodeInfo_State) { - if m != nil { - m.State = v - } + m.State = v } // SetCurrentEpoch sets number of the current epoch. func (x *NetworkInfo) SetCurrentEpoch(v uint64) { - if x != nil { - x.CurrentEpoch = v - } + x.CurrentEpoch = v } // SetMagicNumber sets magic number of the sidechain. func (x *NetworkInfo) SetMagicNumber(v uint64) { - if x != nil { - x.MagicNumber = v - } + x.MagicNumber = v } // SetMsPerBlock sets MillisecondsPerBlock network parameter. func (x *NetworkInfo) SetMsPerBlock(v int64) { - if x != nil { - x.MsPerBlock = v - } + x.MsPerBlock = v } // SetNetworkConfig sets NeoFS network configuration. func (x *NetworkInfo) SetNetworkConfig(v *NetworkConfig) { - if x != nil { - x.NetworkConfig = v - } + x.NetworkConfig = v } // FromString parses Clause from a string representation, @@ -246,21 +190,15 @@ func (x *NodeInfo_State) FromString(s string) bool { // SetKey sets parameter key. func (x *NetworkConfig_Parameter) SetKey(v []byte) { - if x != nil { - x.Key = v - } + x.Key = v } // SetValue sets parameter value. func (x *NetworkConfig_Parameter) SetValue(v []byte) { - if x != nil { - x.Value = v - } + x.Value = v } // SetParameters sets NeoFS network parameters. func (x *NetworkConfig) SetParameters(v []*NetworkConfig_Parameter) { - if x != nil { - x.Parameters = v - } + x.Parameters = v } diff --git a/netmap/types.go b/netmap/types.go index 19ca974..cc190af 100644 --- a/netmap/types.go +++ b/netmap/types.go @@ -123,9 +123,7 @@ func (f *Filter) GetFilters() []Filter { } func (f *Filter) SetFilters(filters []Filter) { - if f != nil { - f.filters = filters - } + f.filters = filters } func (f *Filter) GetValue() string { @@ -137,9 +135,7 @@ func (f *Filter) GetValue() string { } func (f *Filter) SetValue(value string) { - if f != nil { - f.value = value - } + f.value = value } func (f *Filter) GetOp() Operation { @@ -150,9 +146,7 @@ func (f *Filter) GetOp() Operation { } func (f *Filter) SetOp(op Operation) { - if f != nil { - f.op = op - } + f.op = op } func (f *Filter) GetKey() string { @@ -164,9 +158,7 @@ func (f *Filter) GetKey() string { } func (f *Filter) SetKey(key string) { - if f != nil { - f.key = key - } + f.key = key } func (f *Filter) GetName() string { @@ -178,9 +170,7 @@ func (f *Filter) GetName() string { } func (f *Filter) SetName(name string) { - if f != nil { - f.name = name - } + f.name = name } func (s *Selector) GetFilter() string { @@ -192,9 +182,7 @@ func (s *Selector) GetFilter() string { } func (s *Selector) SetFilter(filter string) { - if s != nil { - s.filter = filter - } + s.filter = filter } func (s *Selector) GetAttribute() string { @@ -206,9 +194,7 @@ func (s *Selector) GetAttribute() string { } func (s *Selector) SetAttribute(attribute string) { - if s != nil { - s.attribute = attribute - } + s.attribute = attribute } func (s *Selector) GetClause() Clause { @@ -220,9 +206,7 @@ func (s *Selector) GetClause() Clause { } func (s *Selector) SetClause(clause Clause) { - if s != nil { - s.clause = clause - } + s.clause = clause } func (s *Selector) GetCount() uint32 { @@ -234,9 +218,7 @@ func (s *Selector) GetCount() uint32 { } func (s *Selector) SetCount(count uint32) { - if s != nil { - s.count = count - } + s.count = count } func (s *Selector) GetName() string { @@ -248,9 +230,7 @@ func (s *Selector) GetName() string { } func (s *Selector) SetName(name string) { - if s != nil { - s.name = name - } + s.name = name } func (r *Replica) GetSelector() string { @@ -262,9 +242,7 @@ func (r *Replica) GetSelector() string { } func (r *Replica) SetSelector(selector string) { - if r != nil { - r.selector = selector - } + r.selector = selector } func (r *Replica) GetCount() uint32 { @@ -276,9 +254,7 @@ func (r *Replica) GetCount() uint32 { } func (r *Replica) SetCount(count uint32) { - if r != nil { - r.count = count - } + r.count = count } func (p *PlacementPolicy) GetFilters() []Filter { @@ -290,9 +266,7 @@ func (p *PlacementPolicy) GetFilters() []Filter { } func (p *PlacementPolicy) SetFilters(filters []Filter) { - if p != nil { - p.filters = filters - } + p.filters = filters } func (p *PlacementPolicy) GetSelectors() []Selector { @@ -304,9 +278,7 @@ func (p *PlacementPolicy) GetSelectors() []Selector { } func (p *PlacementPolicy) SetSelectors(selectors []Selector) { - if p != nil { - p.selectors = selectors - } + p.selectors = selectors } func (p *PlacementPolicy) GetContainerBackupFactor() uint32 { @@ -318,9 +290,7 @@ func (p *PlacementPolicy) GetContainerBackupFactor() uint32 { } func (p *PlacementPolicy) SetContainerBackupFactor(backupFactor uint32) { - if p != nil { - p.backupFactor = backupFactor - } + p.backupFactor = backupFactor } func (p *PlacementPolicy) GetReplicas() []Replica { @@ -348,9 +318,7 @@ func (a *Attribute) GetKey() string { } func (a *Attribute) SetKey(v string) { - if a != nil { - a.key = v - } + a.key = v } func (a *Attribute) GetValue() string { @@ -362,9 +330,7 @@ func (a *Attribute) GetValue() string { } func (a *Attribute) SetValue(v string) { - if a != nil { - a.value = v - } + a.value = v } func (a *Attribute) GetParents() []string { @@ -376,9 +342,7 @@ func (a *Attribute) GetParents() []string { } func (a *Attribute) SetParents(parent []string) { - if a != nil { - a.parents = parent - } + a.parents = parent } func (ni *NodeInfo) GetPublicKey() []byte { @@ -390,9 +354,7 @@ func (ni *NodeInfo) GetPublicKey() []byte { } func (ni *NodeInfo) SetPublicKey(v []byte) { - if ni != nil { - ni.publicKey = v - } + ni.publicKey = v } // GetAddress returns node's network address. @@ -416,9 +378,7 @@ func (ni *NodeInfo) SetAddress(v string) { // SetAddresses sets list of network addresses of the node. func (ni *NodeInfo) SetAddresses(v ...string) { - if ni != nil { - ni.addresses = v - } + ni.addresses = v } // NumberOfAddresses returns number of network addresses of the node. @@ -453,9 +413,7 @@ func (ni *NodeInfo) GetAttributes() []Attribute { } func (ni *NodeInfo) SetAttributes(v []Attribute) { - if ni != nil { - ni.attributes = v - } + ni.attributes = v } func (ni *NodeInfo) GetState() NodeState { @@ -467,9 +425,7 @@ func (ni *NodeInfo) GetState() NodeState { } func (ni *NodeInfo) SetState(state NodeState) { - if ni != nil { - ni.state = state - } + ni.state = state } func (l *LocalNodeInfoResponseBody) GetVersion() *refs.Version { @@ -481,9 +437,7 @@ func (l *LocalNodeInfoResponseBody) GetVersion() *refs.Version { } func (l *LocalNodeInfoResponseBody) SetVersion(version *refs.Version) { - if l != nil { - l.version = version - } + l.version = version } func (l *LocalNodeInfoResponseBody) GetNodeInfo() *NodeInfo { @@ -495,9 +449,7 @@ func (l *LocalNodeInfoResponseBody) GetNodeInfo() *NodeInfo { } func (l *LocalNodeInfoResponseBody) SetNodeInfo(nodeInfo *NodeInfo) { - if l != nil { - l.nodeInfo = nodeInfo - } + l.nodeInfo = nodeInfo } func (l *LocalNodeInfoRequest) GetBody() *LocalNodeInfoRequestBody { @@ -508,9 +460,7 @@ func (l *LocalNodeInfoRequest) GetBody() *LocalNodeInfoRequestBody { } func (l *LocalNodeInfoRequest) SetBody(body *LocalNodeInfoRequestBody) { - if l != nil { - l.body = body - } + l.body = body } func (l *LocalNodeInfoResponse) GetBody() *LocalNodeInfoResponseBody { @@ -521,9 +471,7 @@ func (l *LocalNodeInfoResponse) GetBody() *LocalNodeInfoResponseBody { } func (l *LocalNodeInfoResponse) SetBody(body *LocalNodeInfoResponseBody) { - if l != nil { - l.body = body - } + l.body = body } // NetworkParameter represents NeoFS network parameter. @@ -542,9 +490,7 @@ func (x *NetworkParameter) GetKey() []byte { // SetKey sets parameter key. func (x *NetworkParameter) SetKey(k []byte) { - if x != nil { - x.k = k - } + x.k = k } // GetValue returns parameter value. @@ -558,9 +504,7 @@ func (x *NetworkParameter) GetValue() []byte { // SetValue sets parameter value. func (x *NetworkParameter) SetValue(v []byte) { - if x != nil { - x.v = v - } + x.v = v } // NetworkConfig represents NeoFS network configuration. @@ -593,9 +537,7 @@ func (x *NetworkConfig) IterateParameters(f func(*NetworkParameter) bool) { // SetParameters sets list of network parameters. func (x *NetworkConfig) SetParameters(v ...NetworkParameter) { - if x != nil { - x.ps = v - } + x.ps = v } // NetworkInfo groups information about @@ -619,9 +561,7 @@ func (i *NetworkInfo) GetCurrentEpoch() uint64 { // SetCurrentEpoch sets number of the current epoch. func (i *NetworkInfo) SetCurrentEpoch(epoch uint64) { - if i != nil { - i.curEpoch = epoch - } + i.curEpoch = epoch } // GetMagicNumber returns magic number of the sidechain. @@ -635,9 +575,7 @@ func (i *NetworkInfo) GetMagicNumber() uint64 { // SetMagicNumber sets magic number of the sidechain. func (i *NetworkInfo) SetMagicNumber(magic uint64) { - if i != nil { - i.magicNum = magic - } + i.magicNum = magic } // GetMsPerBlock returns MillisecondsPerBlock network parameter. @@ -651,9 +589,7 @@ func (i *NetworkInfo) GetMsPerBlock() int64 { // SetMsPerBlock sets MillisecondsPerBlock network parameter. func (i *NetworkInfo) SetMsPerBlock(v int64) { - if i != nil { - i.msPerBlock = v - } + i.msPerBlock = v } // GetNetworkConfig returns NeoFS network configuration. @@ -667,9 +603,7 @@ func (i *NetworkInfo) GetNetworkConfig() *NetworkConfig { // SetNetworkConfig sets NeoFS network configuration. func (i *NetworkInfo) SetNetworkConfig(v *NetworkConfig) { - if i != nil { - i.netCfg = v - } + i.netCfg = v } // NetworkInfoRequestBody is a structure of NetworkInfo request body. @@ -691,9 +625,7 @@ func (i *NetworkInfoResponseBody) GetNetworkInfo() *NetworkInfo { // SetNetworkInfo sets information about the NeoFS network. func (i *NetworkInfoResponseBody) SetNetworkInfo(netInfo *NetworkInfo) { - if i != nil { - i.netInfo = netInfo - } + i.netInfo = netInfo } func (l *NetworkInfoRequest) GetBody() *NetworkInfoRequestBody { @@ -704,9 +636,7 @@ func (l *NetworkInfoRequest) GetBody() *NetworkInfoRequestBody { } func (l *NetworkInfoRequest) SetBody(body *NetworkInfoRequestBody) { - if l != nil { - l.body = body - } + l.body = body } func (l *NetworkInfoResponse) GetBody() *NetworkInfoResponseBody { @@ -717,7 +647,5 @@ func (l *NetworkInfoResponse) GetBody() *NetworkInfoResponseBody { } func (l *NetworkInfoResponse) SetBody(body *NetworkInfoResponseBody) { - if l != nil { - l.body = body - } + l.body = body } diff --git a/object/grpc/service.go b/object/grpc/service.go index e9b7659..b77208f 100644 --- a/object/grpc/service.go +++ b/object/grpc/service.go @@ -7,58 +7,42 @@ import ( // SetAddress sets address of the requested object. func (m *GetRequest_Body) SetAddress(v *refs.Address) { - if m != nil { - m.Address = v - } + m.Address = v } // SetRaw sets raw flag of the request. func (m *GetRequest_Body) SetRaw(v bool) { - if m != nil { - m.Raw = v - } + m.Raw = v } // SetBody sets body of the request. func (m *GetRequest) SetBody(v *GetRequest_Body) { - if m != nil { - m.Body = v - } + m.Body = v } // SetMetaHeader sets meta header of the request. func (m *GetRequest) SetMetaHeader(v *session.RequestMetaHeader) { - if m != nil { - m.MetaHeader = v - } + m.MetaHeader = v } // SetVerifyHeader sets verification header of the request. func (m *GetRequest) SetVerifyHeader(v *session.RequestVerificationHeader) { - if m != nil { - m.VerifyHeader = v - } + m.VerifyHeader = v } // SetObjectId sets identifier of the object. func (m *GetResponse_Body_Init) SetObjectId(v *refs.ObjectID) { - if m != nil { - m.ObjectId = v - } + m.ObjectId = v } // SetSignature sets signature of the object identifier. func (m *GetResponse_Body_Init) SetSignature(v *refs.Signature) { - if m != nil { - m.Signature = v - } + m.Signature = v } // SetHeader sets header of the object. func (m *GetResponse_Body_Init) SetHeader(v *Header) { - if m != nil { - m.Header = v - } + m.Header = v } // GetChunk returns chunk of the object payload bytes. @@ -72,83 +56,61 @@ func (m *GetResponse_Body_Chunk) GetChunk() []byte { // SetChunk sets chunk of the object payload bytes. func (m *GetResponse_Body_Chunk) SetChunk(v []byte) { - if m != nil { - m.Chunk = v - } + m.Chunk = v } // SetInit sets initial part of the object. func (m *GetResponse_Body) SetInit(v *GetResponse_Body_Init) { - if m != nil { - m.ObjectPart = &GetResponse_Body_Init_{ - Init: v, - } + m.ObjectPart = &GetResponse_Body_Init_{ + Init: v, } } // SetChunk sets part of the object payload. func (m *GetResponse_Body) SetChunk(v *GetResponse_Body_Chunk) { - if m != nil { - m.ObjectPart = v - } + m.ObjectPart = v } // SetSplitInfo sets part of the object payload. func (m *GetResponse_Body) SetSplitInfo(v *SplitInfo) { - if m != nil { - m.ObjectPart = &GetResponse_Body_SplitInfo{ - SplitInfo: v, - } + m.ObjectPart = &GetResponse_Body_SplitInfo{ + SplitInfo: v, } } // SetBody sets body of the response. func (m *GetResponse) SetBody(v *GetResponse_Body) { - if m != nil { - m.Body = v - } + m.Body = v } // SetMetaHeader sets meta header of the response. func (m *GetResponse) SetMetaHeader(v *session.ResponseMetaHeader) { - if m != nil { - m.MetaHeader = v - } + m.MetaHeader = v } // SetVerifyHeader sets verification header of the response. func (m *GetResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) { - if m != nil { - m.VerifyHeader = v - } + m.VerifyHeader = v } // SetObjectId sets identifier of the object. func (m *PutRequest_Body_Init) SetObjectId(v *refs.ObjectID) { - if m != nil { - m.ObjectId = v - } + m.ObjectId = v } // SetSignature sets signature of the object identifier. func (m *PutRequest_Body_Init) SetSignature(v *refs.Signature) { - if m != nil { - m.Signature = v - } + m.Signature = v } // SetHeader sets header of the object. func (m *PutRequest_Body_Init) SetHeader(v *Header) { - if m != nil { - m.Header = v - } + m.Header = v } // SetCopiesNumber sets number of the copies to save. func (m *PutRequest_Body_Init) SetCopiesNumber(v uint32) { - if m != nil { - m.CopiesNumber = v - } + m.CopiesNumber = v } // GetChunk returns chunk of the object payload bytes. @@ -162,381 +124,275 @@ func (m *PutRequest_Body_Chunk) GetChunk() []byte { // SetChunk sets chunk of the object payload bytes. func (m *PutRequest_Body_Chunk) SetChunk(v []byte) { - if m != nil { - m.Chunk = v - } + m.Chunk = v } // SetInit sets initial part of the object. func (m *PutRequest_Body) SetInit(v *PutRequest_Body_Init) { - if m != nil { - m.ObjectPart = &PutRequest_Body_Init_{ - Init: v, - } + m.ObjectPart = &PutRequest_Body_Init_{ + Init: v, } } // SetChunk sets part of the object payload. func (m *PutRequest_Body) SetChunk(v *PutRequest_Body_Chunk) { - if m != nil { - m.ObjectPart = v - } + m.ObjectPart = v } // SetBody sets body of the request. func (m *PutRequest) SetBody(v *PutRequest_Body) { - if m != nil { - m.Body = v - } + m.Body = v } // SetMetaHeader sets meta header of the request. func (m *PutRequest) SetMetaHeader(v *session.RequestMetaHeader) { - if m != nil { - m.MetaHeader = v - } + m.MetaHeader = v } // SetVerifyHeader sets verification header of the request. func (m *PutRequest) SetVerifyHeader(v *session.RequestVerificationHeader) { - if m != nil { - m.VerifyHeader = v - } + m.VerifyHeader = v } // SetObjectId sets identifier of the saved object. func (m *PutResponse_Body) SetObjectId(v *refs.ObjectID) { - if m != nil { - m.ObjectId = v - } + m.ObjectId = v } // SetBody sets body of the response. func (m *PutResponse) SetBody(v *PutResponse_Body) { - if m != nil { - m.Body = v - } + m.Body = v } // SetMetaHeader sets meta header of the response. func (m *PutResponse) SetMetaHeader(v *session.ResponseMetaHeader) { - if m != nil { - m.MetaHeader = v - } + m.MetaHeader = v } // SetVerifyHeader sets verification header of the response. func (m *PutResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) { - if m != nil { - m.VerifyHeader = v - } + m.VerifyHeader = v } // SetAddress sets address of the object to delete. func (m *DeleteRequest_Body) SetAddress(v *refs.Address) { - if m != nil { - m.Address = v - } + m.Address = v } // SetBody sets body of the request. func (m *DeleteRequest) SetBody(v *DeleteRequest_Body) { - if m != nil { - m.Body = v - } + m.Body = v } // SetMetaHeader sets meta header of the request. func (m *DeleteRequest) SetMetaHeader(v *session.RequestMetaHeader) { - if m != nil { - m.MetaHeader = v - } + m.MetaHeader = v } // SetVerifyHeader sets verification header of the request. func (m *DeleteRequest) SetVerifyHeader(v *session.RequestVerificationHeader) { - if m != nil { - m.VerifyHeader = v - } + m.VerifyHeader = v } // SetTombstone sets tombstone address. func (x *DeleteResponse_Body) SetTombstone(v *refs.Address) { - if x != nil { - x.Tombstone = v - } + x.Tombstone = v } // SetBody sets body of the response. func (m *DeleteResponse) SetBody(v *DeleteResponse_Body) { - if m != nil { - m.Body = v - } + m.Body = v } // SetMetaHeader sets meta header of the response. func (m *DeleteResponse) SetMetaHeader(v *session.ResponseMetaHeader) { - if m != nil { - m.MetaHeader = v - } + m.MetaHeader = v } // SetVerifyHeader sets verification header of the response. func (m *DeleteResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) { - if m != nil { - m.VerifyHeader = v - } + m.VerifyHeader = v } // SetAddress sets address of the object with the requested header. func (m *HeadRequest_Body) SetAddress(v *refs.Address) { - if m != nil { - m.Address = v - } + m.Address = v } // SetMainOnly sets flag to return the minimal header subset. func (m *HeadRequest_Body) SetMainOnly(v bool) { - if m != nil { - m.MainOnly = v - } + m.MainOnly = v } // SetRaw sets raw flag of the request. func (m *HeadRequest_Body) SetRaw(v bool) { - if m != nil { - m.Raw = v - } + m.Raw = v } // SetBody sets body of the request. func (m *HeadRequest) SetBody(v *HeadRequest_Body) { - if m != nil { - m.Body = v - } + m.Body = v } // SetMetaHeader sets meta header of the request. func (m *HeadRequest) SetMetaHeader(v *session.RequestMetaHeader) { - if m != nil { - m.MetaHeader = v - } + m.MetaHeader = v } // SetVerifyHeader sets verification header of the request. func (m *HeadRequest) SetVerifyHeader(v *session.RequestVerificationHeader) { - if m != nil { - m.VerifyHeader = v - } + m.VerifyHeader = v } // SetHeader sets object header. func (m *HeaderWithSignature) SetHeader(v *Header) { - if m != nil { - m.Header = v - } + m.Header = v } // SetSignature of the header. func (m *HeaderWithSignature) SetSignature(v *refs.Signature) { - if m != nil { - m.Signature = v - } + m.Signature = v } // SetHeader sets full header of the object. func (m *HeadResponse_Body) SetHeader(v *HeaderWithSignature) { - if m != nil { - m.Head = &HeadResponse_Body_Header{ - Header: v, - } + m.Head = &HeadResponse_Body_Header{ + Header: v, } } // SetShortHeader sets short header of the object. func (m *HeadResponse_Body) SetShortHeader(v *ShortHeader) { - if m != nil { - m.Head = &HeadResponse_Body_ShortHeader{ - ShortHeader: v, - } + m.Head = &HeadResponse_Body_ShortHeader{ + ShortHeader: v, } } // SetSplitInfo sets meta info about split hierarchy of the object. func (m *HeadResponse_Body) SetSplitInfo(v *SplitInfo) { - if m != nil { - m.Head = &HeadResponse_Body_SplitInfo{ - SplitInfo: v, - } + m.Head = &HeadResponse_Body_SplitInfo{ + SplitInfo: v, } } // SetBody sets body of the response. func (m *HeadResponse) SetBody(v *HeadResponse_Body) { - if m != nil { - m.Body = v - } + m.Body = v } // SetMetaHeader sets meta header of the response. func (m *HeadResponse) SetMetaHeader(v *session.ResponseMetaHeader) { - if m != nil { - m.MetaHeader = v - } + m.MetaHeader = v } // SetVerifyHeader sets verification header of the response. func (m *HeadResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) { - if m != nil { - m.VerifyHeader = v - } + m.VerifyHeader = v } // SetMatchType sets match type of the filter. func (m *SearchRequest_Body_Filter) SetMatchType(v MatchType) { - if m != nil { - m.MatchType = v - } + m.MatchType = v } // SetKey sets key to the filtering header. func (m *SearchRequest_Body_Filter) SetKey(v string) { - if m != nil { - m.Key = v - } + m.Key = v } // SetValue sets value of the filtering header. func (m *SearchRequest_Body_Filter) SetValue(v string) { - if m != nil { - m.Value = v - } + m.Value = v } // SetVersion sets version of the search query. func (m *SearchRequest_Body) SetVersion(v uint32) { - if m != nil { - m.Version = v - } + m.Version = v } // SetFilters sets list of the query filters. func (m *SearchRequest_Body) SetFilters(v []*SearchRequest_Body_Filter) { - if m != nil { - m.Filters = v - } + m.Filters = v } // SetContainerId sets container ID of the search requets. func (m *SearchRequest_Body) SetContainerId(v *refs.ContainerID) { - if m != nil { - m.ContainerId = v - } + m.ContainerId = v } // SetBody sets body of the request. func (m *SearchRequest) SetBody(v *SearchRequest_Body) { - if m != nil { - m.Body = v - } + m.Body = v } // SetMetaHeader sets meta header of the request. func (m *SearchRequest) SetMetaHeader(v *session.RequestMetaHeader) { - if m != nil { - m.MetaHeader = v - } + m.MetaHeader = v } // SetVerifyHeader sets verification header of the request. func (m *SearchRequest) SetVerifyHeader(v *session.RequestVerificationHeader) { - if m != nil { - m.VerifyHeader = v - } + m.VerifyHeader = v } // SetIdList sets list of the identifiers of the matched objects. func (m *SearchResponse_Body) SetIdList(v []*refs.ObjectID) { - if m != nil { - m.IdList = v - } + m.IdList = v } // SetBody sets body of the response. func (m *SearchResponse) SetBody(v *SearchResponse_Body) { - if m != nil { - m.Body = v - } + m.Body = v } // SetMetaHeader sets meta header of the response. func (m *SearchResponse) SetMetaHeader(v *session.ResponseMetaHeader) { - if m != nil { - m.MetaHeader = v - } + m.MetaHeader = v } // SetVerifyHeader sets verification header of the response. func (m *SearchResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) { - if m != nil { - m.VerifyHeader = v - } + m.VerifyHeader = v } // SetOffset sets offset of the payload range. func (m *Range) SetOffset(v uint64) { - if m != nil { - m.Offset = v - } + m.Offset = v } // SetLength sets length of the payload range. func (m *Range) SetLength(v uint64) { - if m != nil { - m.Length = v - } + m.Length = v } // SetAddress sets address of the object with the request payload range. func (m *GetRangeRequest_Body) SetAddress(v *refs.Address) { - if m != nil { - m.Address = v - } + m.Address = v } // SetRange sets range of the object payload. func (m *GetRangeRequest_Body) SetRange(v *Range) { - if m != nil { - m.Range = v - } + m.Range = v } // SetRaw sets raw flag of the request. func (m *GetRangeRequest_Body) SetRaw(v bool) { - if m != nil { - m.Raw = v - } + m.Raw = v } // SetBody sets body of the request. func (m *GetRangeRequest) SetBody(v *GetRangeRequest_Body) { - if m != nil { - m.Body = v - } + m.Body = v } // SetMetaHeader sets meta header of the request. func (m *GetRangeRequest) SetMetaHeader(v *session.RequestMetaHeader) { - if m != nil { - m.MetaHeader = v - } + m.MetaHeader = v } // SetVerifyHeader sets verification header of the request. func (m *GetRangeRequest) SetVerifyHeader(v *session.RequestVerificationHeader) { - if m != nil { - m.VerifyHeader = v - } + m.VerifyHeader = v } // GetChunk returns chunk of the object payload range bytes. @@ -550,128 +406,92 @@ func (m *GetRangeResponse_Body_Chunk) GetChunk() []byte { // SetChunk sets chunk of the object payload range bytes. func (m *GetRangeResponse_Body_Chunk) SetChunk(v []byte) { - if m != nil { - m.Chunk = v - } + m.Chunk = v } // SetChunk sets chunk of the object payload. func (m *GetRangeResponse_Body) SetChunk(v *GetRangeResponse_Body_Chunk) { - if m != nil { - m.RangePart = v - } + m.RangePart = v } // SetSplitInfo sets meta info about split hierarchy of the object. func (m *GetRangeResponse_Body) SetSplitInfo(v *SplitInfo) { - if m != nil { - m.RangePart = &GetRangeResponse_Body_SplitInfo{ - SplitInfo: v, - } + m.RangePart = &GetRangeResponse_Body_SplitInfo{ + SplitInfo: v, } } // SetBody sets body of the response. func (m *GetRangeResponse) SetBody(v *GetRangeResponse_Body) { - if m != nil { - m.Body = v - } + m.Body = v } // SetMetaHeader sets meta header of the response. func (m *GetRangeResponse) SetMetaHeader(v *session.ResponseMetaHeader) { - if m != nil { - m.MetaHeader = v - } + m.MetaHeader = v } // SetVerifyHeader sets verification header of the response. func (m *GetRangeResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) { - if m != nil { - m.VerifyHeader = v - } + m.VerifyHeader = v } // SetAddress sets address of the object with the request payload range. func (m *GetRangeHashRequest_Body) SetAddress(v *refs.Address) { - if m != nil { - m.Address = v - } + m.Address = v } // SetRanges sets list of the ranges of the object payload. func (m *GetRangeHashRequest_Body) SetRanges(v []*Range) { - if m != nil { - m.Ranges = v - } + m.Ranges = v } // SetSalt sets salt for the object payload ranges. func (m *GetRangeHashRequest_Body) SetSalt(v []byte) { - if m != nil { - m.Salt = v - } + m.Salt = v } // Set sets salt for the object payload ranges. func (m *GetRangeHashRequest_Body) SetType(v refs.ChecksumType) { - if m != nil { - m.Type = v - } + m.Type = v } // SetBody sets body of the request. func (m *GetRangeHashRequest) SetBody(v *GetRangeHashRequest_Body) { - if m != nil { - m.Body = v - } + m.Body = v } // SetMetaHeader sets meta header of the request. func (m *GetRangeHashRequest) SetMetaHeader(v *session.RequestMetaHeader) { - if m != nil { - m.MetaHeader = v - } + m.MetaHeader = v } // SetVerifyHeader sets verification header of the request. func (m *GetRangeHashRequest) SetVerifyHeader(v *session.RequestVerificationHeader) { - if m != nil { - m.VerifyHeader = v - } + m.VerifyHeader = v } // SetHashList returns list of the range hashes. func (m *GetRangeHashResponse_Body) SetHashList(v [][]byte) { - if m != nil { - m.HashList = v - } + m.HashList = v } // SetHashList returns list of the range hashes. func (m *GetRangeHashResponse_Body) SetType(v refs.ChecksumType) { - if m != nil { - m.Type = v - } + m.Type = v } // SetBody sets body of the response. func (m *GetRangeHashResponse) SetBody(v *GetRangeHashResponse_Body) { - if m != nil { - m.Body = v - } + m.Body = v } // SetMetaHeader sets meta header of the response. func (m *GetRangeHashResponse) SetMetaHeader(v *session.ResponseMetaHeader) { - if m != nil { - m.MetaHeader = v - } + m.MetaHeader = v } // SetVerifyHeader sets verification header of the response. func (m *GetRangeHashResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) { - if m != nil { - m.VerifyHeader = v - } + m.VerifyHeader = v } diff --git a/object/grpc/types.go b/object/grpc/types.go index 350056d..10e063a 100644 --- a/object/grpc/types.go +++ b/object/grpc/types.go @@ -7,233 +7,167 @@ import ( // SetKey sets key to the object attribute. func (m *Header_Attribute) SetKey(v string) { - if m != nil { - m.Key = v - } + m.Key = v } // SetValue sets value of the object attribute. func (m *Header_Attribute) SetValue(v string) { - if m != nil { - m.Value = v - } + m.Value = v } // SetParent sets identifier of the parent object. func (m *Header_Split) SetParent(v *refs.ObjectID) { - if m != nil { - m.Parent = v - } + m.Parent = v } // SetPrevious sets identifier of the previous object in split-chain. func (m *Header_Split) SetPrevious(v *refs.ObjectID) { - if m != nil { - m.Previous = v - } + m.Previous = v } // SetParentSignature sets signature of the parent object header. func (m *Header_Split) SetParentSignature(v *refs.Signature) { - if m != nil { - m.ParentSignature = v - } + m.ParentSignature = v } // SetParentHeader sets parent header structure. func (m *Header_Split) SetParentHeader(v *Header) { - if m != nil { - m.ParentHeader = v - } + m.ParentHeader = v } // SetChildren sets list of the identifiers of the child objects. func (m *Header_Split) SetChildren(v []*refs.ObjectID) { - if m != nil { - m.Children = v - } + m.Children = v } // SetSplitId sets split ID of the object. func (m *Header_Split) SetSplitId(v []byte) { - if m != nil { - m.SplitId = v - } + m.SplitId = v } // SetContainerId sets identifier of the container. func (m *Header) SetContainerId(v *refs.ContainerID) { - if m != nil { - m.ContainerId = v - } + m.ContainerId = v } // SetOwnerId sets identifier of the object owner. func (m *Header) SetOwnerId(v *refs.OwnerID) { - if m != nil { - m.OwnerId = v - } + m.OwnerId = v } // SetCreationEpoch sets creation epoch number. func (m *Header) SetCreationEpoch(v uint64) { - if m != nil { - m.CreationEpoch = v - } + m.CreationEpoch = v } // SetVersion sets version of the object format. func (m *Header) SetVersion(v *refs.Version) { - if m != nil { - m.Version = v - } + m.Version = v } // SetPayloadLength sets length of the object payload. func (m *Header) SetPayloadLength(v uint64) { - if m != nil { - m.PayloadLength = v - } + m.PayloadLength = v } // SetPayloadHash sets hash of the object payload. func (m *Header) SetPayloadHash(v *refs.Checksum) { - if m != nil { - m.PayloadHash = v - } + m.PayloadHash = v } // SetObjectType sets type of the object. func (m *Header) SetObjectType(v ObjectType) { - if m != nil { - m.ObjectType = v - } + m.ObjectType = v } // SetHomomorphicHash sets homomorphic hash of the object payload. func (m *Header) SetHomomorphicHash(v *refs.Checksum) { - if m != nil { - m.HomomorphicHash = v - } + m.HomomorphicHash = v } // SetSessionToken sets session token. func (m *Header) SetSessionToken(v *session.SessionToken) { - if m != nil { - m.SessionToken = v - } + m.SessionToken = v } // SetAttributes sets list of the object attributes. func (m *Header) SetAttributes(v []*Header_Attribute) { - if m != nil { - m.Attributes = v - } + m.Attributes = v } // SetSplit sets split header. func (m *Header) SetSplit(v *Header_Split) { - if m != nil { - m.Split = v - } + m.Split = v } // SetObjectId sets identifier of the object. func (m *Object) SetObjectId(v *refs.ObjectID) { - if m != nil { - m.ObjectId = v - } + m.ObjectId = v } // SetSignature sets signature of the object identifier. func (m *Object) SetSignature(v *refs.Signature) { - if m != nil { - m.Signature = v - } + m.Signature = v } // SetHeader sets header of the object. func (m *Object) SetHeader(v *Header) { - if m != nil { - m.Header = v - } + m.Header = v } // SetPayload sets payload bytes of the object. func (m *Object) SetPayload(v []byte) { - if m != nil { - m.Payload = v - } + m.Payload = v } // SetVersion sets version of the object. func (m *ShortHeader) SetVersion(v *refs.Version) { - if m != nil { - m.Version = v - } + m.Version = v } // SetCreationEpoch sets creation epoch number. func (m *ShortHeader) SetCreationEpoch(v uint64) { - if m != nil { - m.CreationEpoch = v - } + m.CreationEpoch = v } // SetOwnerId sets identifier of the object owner. func (m *ShortHeader) SetOwnerId(v *refs.OwnerID) { - if m != nil { - m.OwnerId = v - } + m.OwnerId = v } // SetObjectType sets type of the object. func (m *ShortHeader) SetObjectType(v ObjectType) { - if m != nil { - m.ObjectType = v - } + m.ObjectType = v } // SetPayloadLength sets length of the object payload. func (m *ShortHeader) SetPayloadLength(v uint64) { - if m != nil { - m.PayloadLength = v - } + m.PayloadLength = v } // SetPayloadHash sets hash of the object payload. func (m *ShortHeader) SetPayloadHash(v *refs.Checksum) { - if m != nil { - m.PayloadHash = v - } + m.PayloadHash = v } // SetHomomorphicHash sets homomorphic hash of the object payload. func (m *ShortHeader) SetHomomorphicHash(v *refs.Checksum) { - if m != nil { - m.HomomorphicHash = v - } + m.HomomorphicHash = v } // SetSplitId sets id of split hierarchy. func (m *SplitInfo) SetSplitId(v []byte) { - if m != nil { - m.SplitId = v - } + m.SplitId = v } // SetLastPart sets id of most right child in split hierarchy. func (m *SplitInfo) SetLastPart(v *refs.ObjectID) { - if m != nil { - m.LastPart = v - } + m.LastPart = v } // SetLink sets id of linking object in split hierarchy. func (m *SplitInfo) SetLink(v *refs.ObjectID) { - if m != nil { - m.Link = v - } + m.Link = v } // FromString parses ObjectType from a string representation, diff --git a/object/types.go b/object/types.go index 240f22c..15477c1 100644 --- a/object/types.go +++ b/object/types.go @@ -325,9 +325,7 @@ func (h *ShortHeader) GetVersion() *refs.Version { } func (h *ShortHeader) SetVersion(v *refs.Version) { - if h != nil { - h.version = v - } + h.version = v } func (h *ShortHeader) GetCreationEpoch() uint64 { @@ -339,9 +337,7 @@ func (h *ShortHeader) GetCreationEpoch() uint64 { } func (h *ShortHeader) SetCreationEpoch(v uint64) { - if h != nil { - h.creatEpoch = v - } + h.creatEpoch = v } func (h *ShortHeader) GetOwnerID() *refs.OwnerID { @@ -353,9 +349,7 @@ func (h *ShortHeader) GetOwnerID() *refs.OwnerID { } func (h *ShortHeader) SetOwnerID(v *refs.OwnerID) { - if h != nil { - h.ownerID = v - } + h.ownerID = v } func (h *ShortHeader) GetObjectType() Type { @@ -367,9 +361,7 @@ func (h *ShortHeader) GetObjectType() Type { } func (h *ShortHeader) SetObjectType(v Type) { - if h != nil { - h.typ = v - } + h.typ = v } func (h *ShortHeader) GetPayloadLength() uint64 { @@ -381,9 +373,7 @@ func (h *ShortHeader) GetPayloadLength() uint64 { } func (h *ShortHeader) SetPayloadLength(v uint64) { - if h != nil { - h.payloadLen = v - } + h.payloadLen = v } func (h *ShortHeader) GetPayloadHash() *refs.Checksum { @@ -395,9 +385,7 @@ func (h *ShortHeader) GetPayloadHash() *refs.Checksum { } func (h *ShortHeader) SetPayloadHash(v *refs.Checksum) { - if h != nil { - h.payloadHash = v - } + h.payloadHash = v } func (h *ShortHeader) GetHomomorphicHash() *refs.Checksum { @@ -409,9 +397,7 @@ func (h *ShortHeader) GetHomomorphicHash() *refs.Checksum { } func (h *ShortHeader) SetHomomorphicHash(v *refs.Checksum) { - if h != nil { - h.homoHash = v - } + h.homoHash = v } func (h *ShortHeader) getHeaderPart() {} @@ -425,9 +411,7 @@ func (a *Attribute) GetKey() string { } func (a *Attribute) SetKey(v string) { - if a != nil { - a.key = v - } + a.key = v } func (a *Attribute) GetValue() string { @@ -439,9 +423,7 @@ func (a *Attribute) GetValue() string { } func (a *Attribute) SetValue(v string) { - if a != nil { - a.val = v - } + a.val = v } func (h *SplitHeader) GetParent() *refs.ObjectID { @@ -453,9 +435,7 @@ func (h *SplitHeader) GetParent() *refs.ObjectID { } func (h *SplitHeader) SetParent(v *refs.ObjectID) { - if h != nil { - h.par = v - } + h.par = v } func (h *SplitHeader) GetPrevious() *refs.ObjectID { @@ -467,9 +447,7 @@ func (h *SplitHeader) GetPrevious() *refs.ObjectID { } func (h *SplitHeader) SetPrevious(v *refs.ObjectID) { - if h != nil { - h.prev = v - } + h.prev = v } func (h *SplitHeader) GetParentSignature() *refs.Signature { @@ -481,9 +459,7 @@ func (h *SplitHeader) GetParentSignature() *refs.Signature { } func (h *SplitHeader) SetParentSignature(v *refs.Signature) { - if h != nil { - h.parSig = v - } + h.parSig = v } func (h *SplitHeader) GetParentHeader() *Header { @@ -495,9 +471,7 @@ func (h *SplitHeader) GetParentHeader() *Header { } func (h *SplitHeader) SetParentHeader(v *Header) { - if h != nil { - h.parHdr = v - } + h.parHdr = v } func (h *SplitHeader) GetChildren() []refs.ObjectID { @@ -509,9 +483,7 @@ func (h *SplitHeader) GetChildren() []refs.ObjectID { } func (h *SplitHeader) SetChildren(v []refs.ObjectID) { - if h != nil { - h.children = v - } + h.children = v } func (h *SplitHeader) GetSplitID() []byte { @@ -523,9 +495,7 @@ func (h *SplitHeader) GetSplitID() []byte { } func (h *SplitHeader) SetSplitID(v []byte) { - if h != nil { - h.splitID = v - } + h.splitID = v } func (h *Header) GetVersion() *refs.Version { @@ -537,9 +507,7 @@ func (h *Header) GetVersion() *refs.Version { } func (h *Header) SetVersion(v *refs.Version) { - if h != nil { - h.version = v - } + h.version = v } func (h *Header) GetContainerID() *refs.ContainerID { @@ -551,9 +519,7 @@ func (h *Header) GetContainerID() *refs.ContainerID { } func (h *Header) SetContainerID(v *refs.ContainerID) { - if h != nil { - h.cid = v - } + h.cid = v } func (h *Header) GetOwnerID() *refs.OwnerID { @@ -565,9 +531,7 @@ func (h *Header) GetOwnerID() *refs.OwnerID { } func (h *Header) SetOwnerID(v *refs.OwnerID) { - if h != nil { - h.ownerID = v - } + h.ownerID = v } func (h *Header) GetCreationEpoch() uint64 { @@ -579,9 +543,7 @@ func (h *Header) GetCreationEpoch() uint64 { } func (h *Header) SetCreationEpoch(v uint64) { - if h != nil { - h.creatEpoch = v - } + h.creatEpoch = v } func (h *Header) GetPayloadLength() uint64 { @@ -593,9 +555,7 @@ func (h *Header) GetPayloadLength() uint64 { } func (h *Header) SetPayloadLength(v uint64) { - if h != nil { - h.payloadLen = v - } + h.payloadLen = v } func (h *Header) GetPayloadHash() *refs.Checksum { @@ -607,9 +567,7 @@ func (h *Header) GetPayloadHash() *refs.Checksum { } func (h *Header) SetPayloadHash(v *refs.Checksum) { - if h != nil { - h.payloadHash = v - } + h.payloadHash = v } func (h *Header) GetObjectType() Type { @@ -621,9 +579,7 @@ func (h *Header) GetObjectType() Type { } func (h *Header) SetObjectType(v Type) { - if h != nil { - h.typ = v - } + h.typ = v } func (h *Header) GetHomomorphicHash() *refs.Checksum { @@ -635,9 +591,7 @@ func (h *Header) GetHomomorphicHash() *refs.Checksum { } func (h *Header) SetHomomorphicHash(v *refs.Checksum) { - if h != nil { - h.homoHash = v - } + h.homoHash = v } func (h *Header) GetSessionToken() *session.Token { @@ -649,9 +603,7 @@ func (h *Header) GetSessionToken() *session.Token { } func (h *Header) SetSessionToken(v *session.Token) { - if h != nil { - h.sessionToken = v - } + h.sessionToken = v } func (h *Header) GetAttributes() []Attribute { @@ -663,9 +615,7 @@ func (h *Header) GetAttributes() []Attribute { } func (h *Header) SetAttributes(v []Attribute) { - if h != nil { - h.attr = v - } + h.attr = v } func (h *Header) GetSplit() *SplitHeader { @@ -677,9 +627,7 @@ func (h *Header) GetSplit() *SplitHeader { } func (h *Header) SetSplit(v *SplitHeader) { - if h != nil { - h.split = v - } + h.split = v } func (h *HeaderWithSignature) GetHeader() *Header { @@ -691,9 +639,7 @@ func (h *HeaderWithSignature) GetHeader() *Header { } func (h *HeaderWithSignature) SetHeader(v *Header) { - if h != nil { - h.header = v - } + h.header = v } func (h *HeaderWithSignature) GetSignature() *refs.Signature { @@ -705,9 +651,7 @@ func (h *HeaderWithSignature) GetSignature() *refs.Signature { } func (h *HeaderWithSignature) SetSignature(v *refs.Signature) { - if h != nil { - h.signature = v - } + h.signature = v } func (h *HeaderWithSignature) getHeaderPart() {} @@ -721,9 +665,7 @@ func (o *Object) GetObjectID() *refs.ObjectID { } func (o *Object) SetObjectID(v *refs.ObjectID) { - if o != nil { - o.objectID = v - } + o.objectID = v } func (o *Object) GetSignature() *refs.Signature { @@ -735,9 +677,7 @@ func (o *Object) GetSignature() *refs.Signature { } func (o *Object) SetSignature(v *refs.Signature) { - if o != nil { - o.idSig = v - } + o.idSig = v } func (o *Object) GetHeader() *Header { @@ -749,9 +689,7 @@ func (o *Object) GetHeader() *Header { } func (o *Object) SetHeader(v *Header) { - if o != nil { - o.header = v - } + o.header = v } func (o *Object) GetPayload() []byte { @@ -763,9 +701,7 @@ func (o *Object) GetPayload() []byte { } func (o *Object) SetPayload(v []byte) { - if o != nil { - o.payload = v - } + o.payload = v } func (s *SplitInfo) GetSplitID() []byte { @@ -777,9 +713,7 @@ func (s *SplitInfo) GetSplitID() []byte { } func (s *SplitInfo) SetSplitID(v []byte) { - if s != nil { - s.splitID = v - } + s.splitID = v } func (s *SplitInfo) GetLastPart() *refs.ObjectID { @@ -791,9 +725,7 @@ func (s *SplitInfo) GetLastPart() *refs.ObjectID { } func (s *SplitInfo) SetLastPart(v *refs.ObjectID) { - if s != nil { - s.lastPart = v - } + s.lastPart = v } func (s *SplitInfo) GetLink() *refs.ObjectID { @@ -805,9 +737,7 @@ func (s *SplitInfo) GetLink() *refs.ObjectID { } func (s *SplitInfo) SetLink(v *refs.ObjectID) { - if s != nil { - s.link = v - } + s.link = v } func (s *SplitInfo) getObjectPart() {} @@ -825,9 +755,7 @@ func (r *GetRequestBody) GetAddress() *refs.Address { } func (r *GetRequestBody) SetAddress(v *refs.Address) { - if r != nil { - r.addr = v - } + r.addr = v } func (r *GetRequestBody) GetRaw() bool { @@ -839,9 +767,7 @@ func (r *GetRequestBody) GetRaw() bool { } func (r *GetRequestBody) SetRaw(v bool) { - if r != nil { - r.raw = v - } + r.raw = v } func (r *GetRequest) GetBody() *GetRequestBody { @@ -853,9 +779,7 @@ func (r *GetRequest) GetBody() *GetRequestBody { } func (r *GetRequest) SetBody(v *GetRequestBody) { - if r != nil { - r.body = v - } + r.body = v } func (r *GetObjectPartInit) GetObjectID() *refs.ObjectID { @@ -867,9 +791,7 @@ func (r *GetObjectPartInit) GetObjectID() *refs.ObjectID { } func (r *GetObjectPartInit) SetObjectID(v *refs.ObjectID) { - if r != nil { - r.id = v - } + r.id = v } func (r *GetObjectPartInit) GetSignature() *refs.Signature { @@ -881,9 +803,7 @@ func (r *GetObjectPartInit) GetSignature() *refs.Signature { } func (r *GetObjectPartInit) SetSignature(v *refs.Signature) { - if r != nil { - r.sig = v - } + r.sig = v } func (r *GetObjectPartInit) GetHeader() *Header { @@ -895,9 +815,7 @@ func (r *GetObjectPartInit) GetHeader() *Header { } func (r *GetObjectPartInit) SetHeader(v *Header) { - if r != nil { - r.hdr = v - } + r.hdr = v } func (r *GetObjectPartInit) getObjectPart() {} @@ -911,9 +829,7 @@ func (r *GetObjectPartChunk) GetChunk() []byte { } func (r *GetObjectPartChunk) SetChunk(v []byte) { - if r != nil { - r.chunk = v - } + r.chunk = v } func (r *GetObjectPartChunk) getObjectPart() {} @@ -927,9 +843,7 @@ func (r *GetResponseBody) GetObjectPart() GetObjectPart { } func (r *GetResponseBody) SetObjectPart(v GetObjectPart) { - if r != nil { - r.objPart = v - } + r.objPart = v } func (r *GetResponse) GetBody() *GetResponseBody { @@ -941,9 +855,7 @@ func (r *GetResponse) GetBody() *GetResponseBody { } func (r *GetResponse) SetBody(v *GetResponseBody) { - if r != nil { - r.body = v - } + r.body = v } func (r *PutObjectPartInit) GetObjectID() *refs.ObjectID { @@ -955,9 +867,7 @@ func (r *PutObjectPartInit) GetObjectID() *refs.ObjectID { } func (r *PutObjectPartInit) SetObjectID(v *refs.ObjectID) { - if r != nil { - r.id = v - } + r.id = v } func (r *PutObjectPartInit) GetSignature() *refs.Signature { @@ -969,9 +879,7 @@ func (r *PutObjectPartInit) GetSignature() *refs.Signature { } func (r *PutObjectPartInit) SetSignature(v *refs.Signature) { - if r != nil { - r.sig = v - } + r.sig = v } func (r *PutObjectPartInit) GetHeader() *Header { @@ -983,9 +891,7 @@ func (r *PutObjectPartInit) GetHeader() *Header { } func (r *PutObjectPartInit) SetHeader(v *Header) { - if r != nil { - r.hdr = v - } + r.hdr = v } func (r *PutObjectPartInit) GetCopiesNumber() uint32 { @@ -997,9 +903,7 @@ func (r *PutObjectPartInit) GetCopiesNumber() uint32 { } func (r *PutObjectPartInit) SetCopiesNumber(v uint32) { - if r != nil { - r.copyNum = v - } + r.copyNum = v } func (r *PutObjectPartInit) putObjectPart() {} @@ -1013,9 +917,7 @@ func (r *PutObjectPartChunk) GetChunk() []byte { } func (r *PutObjectPartChunk) SetChunk(v []byte) { - if r != nil { - r.chunk = v - } + r.chunk = v } func (r *PutObjectPartChunk) putObjectPart() {} @@ -1029,9 +931,7 @@ func (r *PutRequestBody) GetObjectPart() PutObjectPart { } func (r *PutRequestBody) SetObjectPart(v PutObjectPart) { - if r != nil { - r.objPart = v - } + r.objPart = v } func (r *PutRequest) GetBody() *PutRequestBody { @@ -1043,9 +943,7 @@ func (r *PutRequest) GetBody() *PutRequestBody { } func (r *PutRequest) SetBody(v *PutRequestBody) { - if r != nil { - r.body = v - } + r.body = v } func (r *PutResponseBody) GetObjectID() *refs.ObjectID { @@ -1057,9 +955,7 @@ func (r *PutResponseBody) GetObjectID() *refs.ObjectID { } func (r *PutResponseBody) SetObjectID(v *refs.ObjectID) { - if r != nil { - r.id = v - } + r.id = v } func (r *PutResponse) GetBody() *PutResponseBody { @@ -1071,9 +967,7 @@ func (r *PutResponse) GetBody() *PutResponseBody { } func (r *PutResponse) SetBody(v *PutResponseBody) { - if r != nil { - r.body = v - } + r.body = v } func (r *DeleteRequestBody) GetAddress() *refs.Address { @@ -1085,9 +979,7 @@ func (r *DeleteRequestBody) GetAddress() *refs.Address { } func (r *DeleteRequestBody) SetAddress(v *refs.Address) { - if r != nil { - r.addr = v - } + r.addr = v } func (r *DeleteRequest) GetBody() *DeleteRequestBody { @@ -1099,9 +991,7 @@ func (r *DeleteRequest) GetBody() *DeleteRequestBody { } func (r *DeleteRequest) SetBody(v *DeleteRequestBody) { - if r != nil { - r.body = v - } + r.body = v } // GetTombstone returns tombstone address. @@ -1115,9 +1005,7 @@ func (r *DeleteResponseBody) GetTombstone() *refs.Address { // SetTombstone sets tombstone address. func (r *DeleteResponseBody) SetTombstone(v *refs.Address) { - if r != nil { - r.tombstone = v - } + r.tombstone = v } func (r *DeleteResponse) GetBody() *DeleteResponseBody { @@ -1129,9 +1017,7 @@ func (r *DeleteResponse) GetBody() *DeleteResponseBody { } func (r *DeleteResponse) SetBody(v *DeleteResponseBody) { - if r != nil { - r.body = v - } + r.body = v } func (r *HeadRequestBody) GetAddress() *refs.Address { @@ -1143,9 +1029,7 @@ func (r *HeadRequestBody) GetAddress() *refs.Address { } func (r *HeadRequestBody) SetAddress(v *refs.Address) { - if r != nil { - r.addr = v - } + r.addr = v } func (r *HeadRequestBody) GetMainOnly() bool { @@ -1157,9 +1041,7 @@ func (r *HeadRequestBody) GetMainOnly() bool { } func (r *HeadRequestBody) SetMainOnly(v bool) { - if r != nil { - r.mainOnly = v - } + r.mainOnly = v } func (r *HeadRequestBody) GetRaw() bool { @@ -1171,9 +1053,7 @@ func (r *HeadRequestBody) GetRaw() bool { } func (r *HeadRequestBody) SetRaw(v bool) { - if r != nil { - r.raw = v - } + r.raw = v } func (r *HeadRequest) GetBody() *HeadRequestBody { @@ -1185,9 +1065,7 @@ func (r *HeadRequest) GetBody() *HeadRequestBody { } func (r *HeadRequest) SetBody(v *HeadRequestBody) { - if r != nil { - r.body = v - } + r.body = v } func (r *HeadResponseBody) GetHeaderPart() GetHeaderPart { @@ -1199,9 +1077,7 @@ func (r *HeadResponseBody) GetHeaderPart() GetHeaderPart { } func (r *HeadResponseBody) SetHeaderPart(v GetHeaderPart) { - if r != nil { - r.hdrPart = v - } + r.hdrPart = v } func (r *HeadResponse) GetBody() *HeadResponseBody { @@ -1213,9 +1089,7 @@ func (r *HeadResponse) GetBody() *HeadResponseBody { } func (r *HeadResponse) SetBody(v *HeadResponseBody) { - if r != nil { - r.body = v - } + r.body = v } func (f *SearchFilter) GetMatchType() MatchType { @@ -1227,9 +1101,7 @@ func (f *SearchFilter) GetMatchType() MatchType { } func (f *SearchFilter) SetMatchType(v MatchType) { - if f != nil { - f.matchType = v - } + f.matchType = v } func (f *SearchFilter) GetKey() string { @@ -1241,9 +1113,7 @@ func (f *SearchFilter) GetKey() string { } func (f *SearchFilter) SetKey(v string) { - if f != nil { - f.key = v - } + f.key = v } func (f *SearchFilter) GetValue() string { @@ -1255,9 +1125,7 @@ func (f *SearchFilter) GetValue() string { } func (f *SearchFilter) SetValue(v string) { - if f != nil { - f.val = v - } + f.val = v } func (r *SearchRequestBody) GetContainerID() *refs.ContainerID { @@ -1269,9 +1137,7 @@ func (r *SearchRequestBody) GetContainerID() *refs.ContainerID { } func (r *SearchRequestBody) SetContainerID(v *refs.ContainerID) { - if r != nil { - r.cid = v - } + r.cid = v } func (r *SearchRequestBody) GetVersion() uint32 { @@ -1283,9 +1149,7 @@ func (r *SearchRequestBody) GetVersion() uint32 { } func (r *SearchRequestBody) SetVersion(v uint32) { - if r != nil { - r.version = v - } + r.version = v } func (r *SearchRequestBody) GetFilters() []SearchFilter { @@ -1297,9 +1161,7 @@ func (r *SearchRequestBody) GetFilters() []SearchFilter { } func (r *SearchRequestBody) SetFilters(v []SearchFilter) { - if r != nil { - r.filters = v - } + r.filters = v } func (r *SearchRequest) GetBody() *SearchRequestBody { @@ -1311,9 +1173,7 @@ func (r *SearchRequest) GetBody() *SearchRequestBody { } func (r *SearchRequest) SetBody(v *SearchRequestBody) { - if r != nil { - r.body = v - } + r.body = v } func (r *SearchResponseBody) GetIDList() []refs.ObjectID { @@ -1325,9 +1185,7 @@ func (r *SearchResponseBody) GetIDList() []refs.ObjectID { } func (r *SearchResponseBody) SetIDList(v []refs.ObjectID) { - if r != nil { - r.idList = v - } + r.idList = v } func (r *SearchResponse) GetBody() *SearchResponseBody { @@ -1339,9 +1197,7 @@ func (r *SearchResponse) GetBody() *SearchResponseBody { } func (r *SearchResponse) SetBody(v *SearchResponseBody) { - if r != nil { - r.body = v - } + r.body = v } func (r *Range) GetOffset() uint64 { @@ -1353,9 +1209,7 @@ func (r *Range) GetOffset() uint64 { } func (r *Range) SetOffset(v uint64) { - if r != nil { - r.off = v - } + r.off = v } func (r *Range) GetLength() uint64 { @@ -1367,9 +1221,7 @@ func (r *Range) GetLength() uint64 { } func (r *Range) SetLength(v uint64) { - if r != nil { - r.len = v - } + r.len = v } func (r *GetRangeRequestBody) GetAddress() *refs.Address { @@ -1381,9 +1233,7 @@ func (r *GetRangeRequestBody) GetAddress() *refs.Address { } func (r *GetRangeRequestBody) SetAddress(v *refs.Address) { - if r != nil { - r.addr = v - } + r.addr = v } func (r *GetRangeRequestBody) GetRange() *Range { @@ -1395,9 +1245,7 @@ func (r *GetRangeRequestBody) GetRange() *Range { } func (r *GetRangeRequestBody) SetRange(v *Range) { - if r != nil { - r.rng = v - } + r.rng = v } func (r *GetRangeRequestBody) GetRaw() bool { @@ -1409,9 +1257,7 @@ func (r *GetRangeRequestBody) GetRaw() bool { } func (r *GetRangeRequestBody) SetRaw(v bool) { - if r != nil { - r.raw = v - } + r.raw = v } func (r *GetRangeRequest) GetBody() *GetRangeRequestBody { @@ -1423,9 +1269,7 @@ func (r *GetRangeRequest) GetBody() *GetRangeRequestBody { } func (r *GetRangeRequest) SetBody(v *GetRangeRequestBody) { - if r != nil { - r.body = v - } + r.body = v } func (r *GetRangePartChunk) GetChunk() []byte { @@ -1437,9 +1281,7 @@ func (r *GetRangePartChunk) GetChunk() []byte { } func (r *GetRangePartChunk) SetChunk(v []byte) { - if r != nil { - r.chunk = v - } + r.chunk = v } func (r *GetRangePartChunk) getRangePart() {} @@ -1453,9 +1295,7 @@ func (r *GetRangeResponseBody) GetRangePart() GetRangePart { } func (r *GetRangeResponseBody) SetRangePart(v GetRangePart) { - if r != nil { - r.rngPart = v - } + r.rngPart = v } func (r *GetRangeResponse) GetBody() *GetRangeResponseBody { @@ -1467,9 +1307,7 @@ func (r *GetRangeResponse) GetBody() *GetRangeResponseBody { } func (r *GetRangeResponse) SetBody(v *GetRangeResponseBody) { - if r != nil { - r.body = v - } + r.body = v } func (r *GetRangeHashRequestBody) GetAddress() *refs.Address { @@ -1481,9 +1319,7 @@ func (r *GetRangeHashRequestBody) GetAddress() *refs.Address { } func (r *GetRangeHashRequestBody) SetAddress(v *refs.Address) { - if r != nil { - r.addr = v - } + r.addr = v } func (r *GetRangeHashRequestBody) GetRanges() []Range { @@ -1495,9 +1331,7 @@ func (r *GetRangeHashRequestBody) GetRanges() []Range { } func (r *GetRangeHashRequestBody) SetRanges(v []Range) { - if r != nil { - r.rngs = v - } + r.rngs = v } func (r *GetRangeHashRequestBody) GetSalt() []byte { @@ -1509,9 +1343,7 @@ func (r *GetRangeHashRequestBody) GetSalt() []byte { } func (r *GetRangeHashRequestBody) SetSalt(v []byte) { - if r != nil { - r.salt = v - } + r.salt = v } func (r *GetRangeHashRequestBody) GetType() refs.ChecksumType { @@ -1523,9 +1355,7 @@ func (r *GetRangeHashRequestBody) GetType() refs.ChecksumType { } func (r *GetRangeHashRequestBody) SetType(v refs.ChecksumType) { - if r != nil { - r.typ = v - } + r.typ = v } func (r *GetRangeHashRequest) GetBody() *GetRangeHashRequestBody { @@ -1537,9 +1367,7 @@ func (r *GetRangeHashRequest) GetBody() *GetRangeHashRequestBody { } func (r *GetRangeHashRequest) SetBody(v *GetRangeHashRequestBody) { - if r != nil { - r.body = v - } + r.body = v } func (r *GetRangeHashResponseBody) GetType() refs.ChecksumType { @@ -1551,9 +1379,7 @@ func (r *GetRangeHashResponseBody) GetType() refs.ChecksumType { } func (r *GetRangeHashResponseBody) SetType(v refs.ChecksumType) { - if r != nil { - r.typ = v - } + r.typ = v } func (r *GetRangeHashResponseBody) GetHashList() [][]byte { @@ -1565,9 +1391,7 @@ func (r *GetRangeHashResponseBody) GetHashList() [][]byte { } func (r *GetRangeHashResponseBody) SetHashList(v [][]byte) { - if r != nil { - r.hashList = v - } + r.hashList = v } func (r *GetRangeHashResponse) GetBody() *GetRangeHashResponseBody { @@ -1579,7 +1403,5 @@ func (r *GetRangeHashResponse) GetBody() *GetRangeHashResponseBody { } func (r *GetRangeHashResponse) SetBody(v *GetRangeHashResponseBody) { - if r != nil { - r.body = v - } + r.body = v } diff --git a/refs/grpc/types.go b/refs/grpc/types.go index e191656..0cf7368 100644 --- a/refs/grpc/types.go +++ b/refs/grpc/types.go @@ -2,100 +2,72 @@ package refs // SetValue sets container identifier in a binary format. func (x *ContainerID) SetValue(v []byte) { - if x != nil { - x.Value = v - } + x.Value = v } // SetValue sets object identifier in a binary format. func (x *ObjectID) SetValue(v []byte) { - if x != nil { - x.Value = v - } + x.Value = v } // SetValue sets owner identifier in a binary format. func (x *OwnerID) SetValue(v []byte) { - if x != nil { - x.Value = v - } + x.Value = v } // SetContainerId sets container identifier of the address. func (x *Address) SetContainerId(v *ContainerID) { - if x != nil { - x.ContainerId = v - } + x.ContainerId = v } // SetObjectId sets object identifier of the address. func (x *Address) SetObjectId(v *ObjectID) { - if x != nil { - x.ObjectId = v - } + x.ObjectId = v } // SetChecksumType in generic checksum structure. func (x *Checksum) SetChecksumType(v ChecksumType) { - if x != nil { - x.Type = v - } + x.Type = v } // SetSum in generic checksum structure. func (x *Checksum) SetSum(v []byte) { - if x != nil { - x.Sum = v - } + x.Sum = v } // SetMajor sets major version number. func (x *Version) SetMajor(v uint32) { - if x != nil { - x.Major = v - } + x.Major = v } // SetMinor sets minor version number. func (x *Version) SetMinor(v uint32) { - if x != nil { - x.Minor = v - } + x.Minor = v } // SetKey sets public key in a binary format. func (x *Signature) SetKey(v []byte) { - if x != nil { - x.Key = v - } + x.Key = v } // SetSign sets signature. func (x *Signature) SetSign(v []byte) { - if x != nil { - x.Sign = v - } + x.Sign = v } // SetScheme sets signature scheme. func (x *Signature) SetScheme(s SignatureScheme) { - if x != nil { - x.Scheme = s - } + x.Scheme = s } // SetKey sets public key in a binary format. func (x *SignatureRFC6979) SetKey(v []byte) { - if x != nil { - x.Key = v - } + x.Key = v } // SetSign sets signature. func (x *SignatureRFC6979) SetSign(v []byte) { - if x != nil { - x.Sign = v - } + x.Sign = v } // FromString parses SignatureScheme from a string representation, @@ -126,7 +98,5 @@ func (x *ChecksumType) FromString(s string) bool { // SetValue sets subnet identifier in a base-10 integer format. func (x *SubnetID) SetValue(v uint32) { - if x != nil { - x.Value = v - } + x.Value = v } diff --git a/refs/types.go b/refs/types.go index 7d89881..025761d 100644 --- a/refs/types.go +++ b/refs/types.go @@ -67,9 +67,7 @@ func (o *OwnerID) GetValue() []byte { } func (o *OwnerID) SetValue(v []byte) { - if o != nil { - o.val = v - } + o.val = v } func (c *ContainerID) GetValue() []byte { @@ -81,9 +79,7 @@ func (c *ContainerID) GetValue() []byte { } func (c *ContainerID) SetValue(v []byte) { - if c != nil { - c.val = v - } + c.val = v } func (o *ObjectID) GetValue() []byte { @@ -95,9 +91,7 @@ func (o *ObjectID) GetValue() []byte { } func (o *ObjectID) SetValue(v []byte) { - if o != nil { - o.val = v - } + o.val = v } func (a *Address) GetContainerID() *ContainerID { @@ -109,9 +103,7 @@ func (a *Address) GetContainerID() *ContainerID { } func (a *Address) SetContainerID(v *ContainerID) { - if a != nil { - a.cid = v - } + a.cid = v } func (a *Address) GetObjectID() *ObjectID { @@ -123,9 +115,7 @@ func (a *Address) GetObjectID() *ObjectID { } func (a *Address) SetObjectID(v *ObjectID) { - if a != nil { - a.oid = v - } + a.oid = v } func (c *Checksum) GetType() ChecksumType { @@ -137,9 +127,7 @@ func (c *Checksum) GetType() ChecksumType { } func (c *Checksum) SetType(v ChecksumType) { - if c != nil { - c.typ = v - } + c.typ = v } func (c *Checksum) GetSum() []byte { @@ -151,9 +139,7 @@ func (c *Checksum) GetSum() []byte { } func (c *Checksum) SetSum(v []byte) { - if c != nil { - c.sum = v - } + c.sum = v } func (s *Signature) GetKey() []byte { @@ -165,9 +151,7 @@ func (s *Signature) GetKey() []byte { } func (s *Signature) SetKey(v []byte) { - if s != nil { - s.key = v - } + s.key = v } func (s *Signature) GetSign() []byte { @@ -179,9 +163,7 @@ func (s *Signature) GetSign() []byte { } func (s *Signature) SetSign(v []byte) { - if s != nil { - s.sign = v - } + s.sign = v } func (s *Signature) GetScheme() SignatureScheme { @@ -192,15 +174,11 @@ func (s *Signature) GetScheme() SignatureScheme { } func (s *Signature) SetScheme(scheme SignatureScheme) { - if s != nil { - s.scheme = scheme - } + s.scheme = scheme } func (s *SubnetID) SetValue(id uint32) { - if s != nil { - s.value = id - } + s.value = id } func (s *SubnetID) GetValue() uint32 { @@ -258,9 +236,7 @@ func (v *Version) GetMajor() uint32 { } func (v *Version) SetMajor(val uint32) { - if v != nil { - v.major = val - } + v.major = val } func (v *Version) GetMinor() uint32 { @@ -272,7 +248,5 @@ func (v *Version) GetMinor() uint32 { } func (v *Version) SetMinor(val uint32) { - if v != nil { - v.minor = val - } + v.minor = val } diff --git a/reputation/grpc/service.go b/reputation/grpc/service.go index b48a275..519c2df 100644 --- a/reputation/grpc/service.go +++ b/reputation/grpc/service.go @@ -6,119 +6,85 @@ import ( // SetEpoch sets epoch in which the trust was assessed. func (x *AnnounceLocalTrustRequest_Body) SetEpoch(v uint64) { - if x != nil { - x.Epoch = v - } + x.Epoch = v } // SetTrusts sets list of normalized trust values. func (x *AnnounceLocalTrustRequest_Body) SetTrusts(v []*Trust) { - if x != nil { - x.Trusts = v - } + x.Trusts = v } // SetBody sets body of the request. func (x *AnnounceLocalTrustRequest) SetBody(v *AnnounceLocalTrustRequest_Body) { - if x != nil { - x.Body = v - } + x.Body = v } // SetMetaHeader sets meta header of the request. func (x *AnnounceLocalTrustRequest) SetMetaHeader(v *session.RequestMetaHeader) { - if x != nil { - x.MetaHeader = v - } + x.MetaHeader = v } // SetVerifyHeader sets verification header of the request. func (x *AnnounceLocalTrustRequest) SetVerifyHeader(v *session.RequestVerificationHeader) { - if x != nil { - x.VerifyHeader = v - } + x.VerifyHeader = v } // SetBody sets body of the response. func (x *AnnounceLocalTrustResponse) SetBody(v *AnnounceLocalTrustResponse_Body) { - if x != nil { - x.Body = v - } + x.Body = v } // SetMetaHeader sets meta header of the response. func (x *AnnounceLocalTrustResponse) SetMetaHeader(v *session.ResponseMetaHeader) { - if x != nil { - x.MetaHeader = v - } + x.MetaHeader = v } // SetVerifyHeader sets verification header of the response. func (x *AnnounceLocalTrustResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) { - if x != nil { - x.VerifyHeader = v - } + x.VerifyHeader = v } // SetEpoch sets epoch in which the intermediate trust was assessed. func (x *AnnounceIntermediateResultRequest_Body) SetEpoch(v uint64) { - if x != nil { - x.Epoch = v - } + x.Epoch = v } // SetIteration sets sequence number of the iteration. func (x *AnnounceIntermediateResultRequest_Body) SetIteration(v uint32) { - if x != nil { - x.Iteration = v - } + x.Iteration = v } // SetTrust sets current global trust value. func (x *AnnounceIntermediateResultRequest_Body) SetTrust(v *PeerToPeerTrust) { - if x != nil { - x.Trust = v - } + x.Trust = v } // SetBody sets body of the request. func (x *AnnounceIntermediateResultRequest) SetBody(v *AnnounceIntermediateResultRequest_Body) { - if x != nil { - x.Body = v - } + x.Body = v } // SetMetaHeader sets meta header of the request. func (x *AnnounceIntermediateResultRequest) SetMetaHeader(v *session.RequestMetaHeader) { - if x != nil { - x.MetaHeader = v - } + x.MetaHeader = v } // SetVerifyHeader sets verification header of the request. func (x *AnnounceIntermediateResultRequest) SetVerifyHeader(v *session.RequestVerificationHeader) { - if x != nil { - x.VerifyHeader = v - } + x.VerifyHeader = v } // SetBody sets body of the response. func (x *AnnounceIntermediateResultResponse) SetBody(v *AnnounceIntermediateResultResponse_Body) { - if x != nil { - x.Body = v - } + x.Body = v } // SetMetaHeader sets meta header of the response. func (x *AnnounceIntermediateResultResponse) SetMetaHeader(v *session.ResponseMetaHeader) { - if x != nil { - x.MetaHeader = v - } + x.MetaHeader = v } // SetVerifyHeader sets verification header of the response. func (x *AnnounceIntermediateResultResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) { - if x != nil { - x.VerifyHeader = v - } + x.VerifyHeader = v } diff --git a/reputation/grpc/types.go b/reputation/grpc/types.go index 86fb05f..14848d3 100644 --- a/reputation/grpc/types.go +++ b/reputation/grpc/types.go @@ -6,70 +6,50 @@ import ( // SetPublicKey sets binary public key of ID. func (x *PeerID) SetPublicKey(v []byte) { - if x != nil { - x.PublicKey = v - } + x.PublicKey = v } // SetPeer sets trusted peer's ID. func (x *Trust) SetPeer(v *PeerID) { - if x != nil { - x.Peer = v - } + x.Peer = v } // SetValue sets trust value. func (x *Trust) SetValue(v float64) { - if x != nil { - x.Value = v - } + x.Value = v } // SetTrustingPeer sets trusting peer ID. func (x *PeerToPeerTrust) SetTrustingPeer(v *PeerID) { - if x != nil { - x.TrustingPeer = v - } + x.TrustingPeer = v } // SetTrust sets trust value of trusting peer to the trusted one. func (x *PeerToPeerTrust) SetTrust(v *Trust) { - if x != nil { - x.Trust = v - } + x.Trust = v } // SetManager sets manager ID. func (x *GlobalTrust_Body) SetManager(v *PeerID) { - if x != nil { - x.Manager = v - } + x.Manager = v } // SetTrust sets global trust value. func (x *GlobalTrust_Body) SetTrust(v *Trust) { - if x != nil { - x.Trust = v - } + x.Trust = v } // SetVersion sets message format version. func (x *GlobalTrust) SetVersion(v *refs.Version) { - if x != nil { - x.Version = v - } + x.Version = v } // SetBody sets message body. func (x *GlobalTrust) SetBody(v *GlobalTrust_Body) { - if x != nil { - x.Body = v - } + x.Body = v } // SetSignature sets body signature. func (x *GlobalTrust) SetSignature(v *refs.Signature) { - if x != nil { - x.Signature = v - } + x.Signature = v } diff --git a/reputation/types.go b/reputation/types.go index 5ccb203..f058efc 100644 --- a/reputation/types.go +++ b/reputation/types.go @@ -22,9 +22,7 @@ func (x *PeerID) GetPublicKey() []byte { // SetPublicKey sets peer's binary public key of ID. func (x *PeerID) SetPublicKey(v []byte) { - if x != nil { - x.publicKey = v - } + x.publicKey = v } // Trust represents reputation.Trust message @@ -46,9 +44,7 @@ func (x *Trust) GetPeer() *PeerID { // SetPeer sets trusted peer's ID. func (x *Trust) SetPeer(v *PeerID) { - if x != nil { - x.peer = v - } + x.peer = v } // GetValue returns trust value. @@ -62,9 +58,7 @@ func (x *Trust) GetValue() float64 { // SetValue sets trust value. func (x *Trust) SetValue(v float64) { - if x != nil { - x.val = v - } + x.val = v } // PeerToPeerTrust represents reputation.PeerToPeerTrust message @@ -86,9 +80,7 @@ func (x *PeerToPeerTrust) GetTrustingPeer() *PeerID { // SetTrustingPeer sets trusting peer ID. func (x *PeerToPeerTrust) SetTrustingPeer(v *PeerID) { - if x != nil { - x.trusting = v - } + x.trusting = v } // GetTrust returns trust value of trusting peer to the trusted one. @@ -102,9 +94,7 @@ func (x *PeerToPeerTrust) GetTrust() *Trust { // SetTrust sets trust value of trusting peer to the trusted one. func (x *PeerToPeerTrust) SetTrust(v *Trust) { - if x != nil { - x.trust = v - } + x.trust = v } // GlobalTrustBody represents reputation.GlobalTrust.Body message @@ -126,9 +116,7 @@ func (x *GlobalTrustBody) GetManager() *PeerID { // SetManager sets node manager ID. func (x *GlobalTrustBody) SetManager(v *PeerID) { - if x != nil { - x.manager = v - } + x.manager = v } // GetTrust returns global trust value. @@ -142,9 +130,7 @@ func (x *GlobalTrustBody) GetTrust() *Trust { // SetTrust sets global trust value. func (x *GlobalTrustBody) SetTrust(v *Trust) { - if x != nil { - x.trust = v - } + x.trust = v } // GlobalTrust represents reputation.GlobalTrust message @@ -168,9 +154,7 @@ func (x *GlobalTrust) GetVersion() *refs.Version { // SetVersion sets message format version. func (x *GlobalTrust) SetVersion(v *refs.Version) { - if x != nil { - x.version = v - } + x.version = v } // GetBody returns message body. @@ -184,9 +168,7 @@ func (x *GlobalTrust) GetBody() *GlobalTrustBody { // SetBody sets message body. func (x *GlobalTrust) SetBody(v *GlobalTrustBody) { - if x != nil { - x.body = v - } + x.body = v } // GetSignature returns body signature. @@ -200,9 +182,7 @@ func (x *GlobalTrust) GetSignature() *refs.Signature { // SetSignature sets body signature. func (x *GlobalTrust) SetSignature(v *refs.Signature) { - if x != nil { - x.sig = v - } + x.sig = v } // AnnounceLocalTrustRequestBody is a structure of AnnounceLocalTrust request body. @@ -223,9 +203,7 @@ func (x *AnnounceLocalTrustRequestBody) GetEpoch() uint64 { // SetEpoch sets epoch in which the trust was assessed. func (x *AnnounceLocalTrustRequestBody) SetEpoch(v uint64) { - if x != nil { - x.epoch = v - } + x.epoch = v } // GetTrusts returns list of normalized trust values. @@ -239,9 +217,7 @@ func (x *AnnounceLocalTrustRequestBody) GetTrusts() []Trust { // SetTrusts sets list of normalized trust values. func (x *AnnounceLocalTrustRequestBody) SetTrusts(v []Trust) { - if x != nil { - x.trusts = v - } + x.trusts = v } // AnnounceLocalTrustResponseBody is a structure of AnnounceLocalTrust response body. @@ -266,9 +242,7 @@ func (x *AnnounceLocalTrustRequest) GetBody() *AnnounceLocalTrustRequestBody { // SetBody sets request body. func (x *AnnounceLocalTrustRequest) SetBody(v *AnnounceLocalTrustRequestBody) { - if x != nil { - x.body = v - } + x.body = v } // AnnounceLocalTrustResponse represents reputation.AnnounceLocalTrustResponse @@ -290,9 +264,7 @@ func (x *AnnounceLocalTrustResponse) GetBody() *AnnounceLocalTrustResponseBody { // SetBody sets response body. func (x *AnnounceLocalTrustResponse) SetBody(v *AnnounceLocalTrustResponseBody) { - if x != nil { - x.body = v - } + x.body = v } // AnnounceIntermediateResultRequestBody is a structure of AnnounceIntermediateResult request body. @@ -315,9 +287,7 @@ func (x *AnnounceIntermediateResultRequestBody) GetEpoch() uint64 { // SetEpoch sets epoch number in which the intermediate trust was assessed. func (x *AnnounceIntermediateResultRequestBody) SetEpoch(v uint64) { - if x != nil { - x.epoch = v - } + x.epoch = v } // GetIteration returns sequence number of the iteration. @@ -331,9 +301,7 @@ func (x *AnnounceIntermediateResultRequestBody) GetIteration() uint32 { // SetIteration sets sequence number of the iteration. func (x *AnnounceIntermediateResultRequestBody) SetIteration(v uint32) { - if x != nil { - x.iter = v - } + x.iter = v } // GetTrust returns current global trust value. @@ -347,9 +315,7 @@ func (x *AnnounceIntermediateResultRequestBody) GetTrust() *PeerToPeerTrust { // SetTrust sets current global trust value. func (x *AnnounceIntermediateResultRequestBody) SetTrust(v *PeerToPeerTrust) { - if x != nil { - x.trust = v - } + x.trust = v } // AnnounceIntermediateResultResponseBody is a structure of AnnounceIntermediateResult response body. @@ -374,9 +340,7 @@ func (x *AnnounceIntermediateResultRequest) GetBody() *AnnounceIntermediateResul // SetBody sets request body. func (x *AnnounceIntermediateResultRequest) SetBody(v *AnnounceIntermediateResultRequestBody) { - if x != nil { - x.body = v - } + x.body = v } // AnnounceIntermediateResultResponse represents reputation.AnnounceIntermediateResultResponse @@ -398,7 +362,5 @@ func (x *AnnounceIntermediateResultResponse) GetBody() *AnnounceIntermediateResu // SetBody sets response body. func (x *AnnounceIntermediateResultResponse) SetBody(v *AnnounceIntermediateResultResponseBody) { - if x != nil { - x.body = v - } + x.body = v } diff --git a/session/grpc/service.go b/session/grpc/service.go index caaf7d9..14348e4 100644 --- a/session/grpc/service.go +++ b/session/grpc/service.go @@ -6,70 +6,50 @@ import ( // SetOwnerId sets identifier of the session initiator. func (m *CreateRequest_Body) SetOwnerId(v *refs.OwnerID) { - if m != nil { - m.OwnerId = v - } + m.OwnerId = v } // SetExpiration sets lifetime of the session. func (m *CreateRequest_Body) SetExpiration(v uint64) { - if m != nil { - m.Expiration = v - } + m.Expiration = v } // SetBody sets body of the request. func (m *CreateRequest) SetBody(v *CreateRequest_Body) { - if m != nil { - m.Body = v - } + m.Body = v } // SetMetaHeader sets meta header of the request. func (m *CreateRequest) SetMetaHeader(v *RequestMetaHeader) { - if m != nil { - m.MetaHeader = v - } + m.MetaHeader = v } // SetVerifyHeader sets verification header of the request. func (m *CreateRequest) SetVerifyHeader(v *RequestVerificationHeader) { - if m != nil { - m.VerifyHeader = v - } + m.VerifyHeader = v } // SetId sets identifier of the session token. func (m *CreateResponse_Body) SetId(v []byte) { - if m != nil { - m.Id = v - } + m.Id = v } // SetSessionKey sets session public key in a binary format. func (m *CreateResponse_Body) SetSessionKey(v []byte) { - if m != nil { - m.SessionKey = v - } + m.SessionKey = v } // SetBody sets body of the response. func (m *CreateResponse) SetBody(v *CreateResponse_Body) { - if m != nil { - m.Body = v - } + m.Body = v } // SetMetaHeader sets meta header of the response. func (m *CreateResponse) SetMetaHeader(v *ResponseMetaHeader) { - if m != nil { - m.MetaHeader = v - } + m.MetaHeader = v } // SetVerifyHeader sets verification header of the response. func (m *CreateResponse) SetVerifyHeader(v *ResponseVerificationHeader) { - if m != nil { - m.VerifyHeader = v - } + m.VerifyHeader = v } diff --git a/session/grpc/types.go b/session/grpc/types.go index 484203d..64133a8 100644 --- a/session/grpc/types.go +++ b/session/grpc/types.go @@ -8,181 +8,131 @@ import ( // SetKey sets key to the X-Header. func (m *XHeader) SetKey(v string) { - if m != nil { - m.Key = v - } + m.Key = v } // SetValue sets value of the X-Header. func (m *XHeader) SetValue(v string) { - if m != nil { - m.Value = v - } + m.Value = v } // SetExp sets epoch number of the token expiration. func (m *SessionToken_Body_TokenLifetime) SetExp(v uint64) { - if m != nil { - m.Exp = v - } + m.Exp = v } // SetNbf sets starting epoch number of the token. func (m *SessionToken_Body_TokenLifetime) SetNbf(v uint64) { - if m != nil { - m.Nbf = v - } + m.Nbf = v } // SetIat sets the number of the epoch in which the token was issued. func (m *SessionToken_Body_TokenLifetime) SetIat(v uint64) { - if m != nil { - m.Iat = v - } + m.Iat = v } // SetId sets identifier of the session token. func (m *SessionToken_Body) SetId(v []byte) { - if m != nil { - m.Id = v - } + m.Id = v } // SetOwnerId sets identifier of the session token owner. func (m *SessionToken_Body) SetOwnerId(v *refs.OwnerID) { - if m != nil { - m.OwnerId = v - } + m.OwnerId = v } // SetLifetime sets lifetime of the session token. func (m *SessionToken_Body) SetLifetime(v *SessionToken_Body_TokenLifetime) { - if m != nil { - m.Lifetime = v - } + m.Lifetime = v } // SetSessionKey sets public session key in a binary format. func (m *SessionToken_Body) SetSessionKey(v []byte) { - if m != nil { - m.SessionKey = v - } + m.SessionKey = v } // SetObjectAddressContext sets object context of the session token. func (m *SessionToken_Body) SetObjectSessionContext(v *ObjectSessionContext) { - if m != nil { - m.Context = &SessionToken_Body_Object{ - Object: v, - } + m.Context = &SessionToken_Body_Object{ + Object: v, } } // SetContainerSessionContext sets container context of the session token. func (m *SessionToken_Body) SetContainerSessionContext(v *ContainerSessionContext) { - if m != nil { - m.Context = &SessionToken_Body_Container{ - Container: v, - } + m.Context = &SessionToken_Body_Container{ + Container: v, } } // SetAddress sets address of the object related to the session. func (m *ObjectSessionContext) SetAddress(v *refs.Address) { - if m != nil { - m.Address = v - } + m.Address = v } // SetVerb sets type of request for which the token is issued. func (m *ObjectSessionContext) SetVerb(v ObjectSessionContext_Verb) { - if m != nil { - m.Verb = v - } + m.Verb = v } // SetVerb sets type of request for which the token is issued. func (x *ContainerSessionContext) SetVerb(v ContainerSessionContext_Verb) { - if x != nil { - x.Verb = v - } + x.Verb = v } // SetWildcard sets wildcard flag of the container session. func (x *ContainerSessionContext) SetWildcard(v bool) { - if x != nil { - x.Wildcard = v - } + x.Wildcard = v } // SetContainerId sets identifier of the container related to the session. func (x *ContainerSessionContext) SetContainerId(v *refs.ContainerID) { - if x != nil { - x.ContainerId = v - } + x.ContainerId = v } // SetBody sets session token body. func (m *SessionToken) SetBody(v *SessionToken_Body) { - if m != nil { - m.Body = v - } + m.Body = v } // SetSignature sets session token signature. func (m *SessionToken) SetSignature(v *refs.Signature) { - if m != nil { - m.Signature = v - } + m.Signature = v } // SetVersion sets client protocol version. func (m *RequestMetaHeader) SetVersion(v *refs.Version) { - if m != nil { - m.Version = v - } + m.Version = v } // SetEpoch sets client local epoch. func (m *RequestMetaHeader) SetEpoch(v uint64) { - if m != nil { - m.Epoch = v - } + m.Epoch = v } // SetTtl sets request TTL. func (m *RequestMetaHeader) SetTtl(v uint32) { - if m != nil { - m.Ttl = v - } + m.Ttl = v } // SetXHeaders sets request X-Headers. func (m *RequestMetaHeader) SetXHeaders(v []*XHeader) { - if m != nil { - m.XHeaders = v - } + m.XHeaders = v } // SetSessionToken sets session token of the request. func (m *RequestMetaHeader) SetSessionToken(v *SessionToken) { - if m != nil { - m.SessionToken = v - } + m.SessionToken = v } // SetBearerToken sets bearer token of the request. func (m *RequestMetaHeader) SetBearerToken(v *acl.BearerToken) { - if m != nil { - m.BearerToken = v - } + m.BearerToken = v } // SetOrigin sets origin request meta header. func (m *RequestMetaHeader) SetOrigin(v *RequestMetaHeader) { - if m != nil { - m.Origin = v - } + m.Origin = v } // GetNetworkMagic returns NeoFS network magic. @@ -196,107 +146,77 @@ func (m *RequestMetaHeader) GetNetworkMagic() uint64 { // SetNetworkMagic sets NeoFS network magic. func (m *RequestMetaHeader) SetNetworkMagic(v uint64) { - if m != nil { - m.MagicNumber = v - } + m.MagicNumber = v } // SetVersion sets server protocol version. func (m *ResponseMetaHeader) SetVersion(v *refs.Version) { - if m != nil { - m.Version = v - } + m.Version = v } // SetEpoch sets server local epoch. func (m *ResponseMetaHeader) SetEpoch(v uint64) { - if m != nil { - m.Epoch = v - } + m.Epoch = v } // SetTtl sets response TTL. func (m *ResponseMetaHeader) SetTtl(v uint32) { - if m != nil { - m.Ttl = v - } + m.Ttl = v } // SetXHeaders sets response X-Headers. func (m *ResponseMetaHeader) SetXHeaders(v []*XHeader) { - if m != nil { - m.XHeaders = v - } + m.XHeaders = v } // SetOrigin sets origin response meta header. func (m *ResponseMetaHeader) SetOrigin(v *ResponseMetaHeader) { - if m != nil { - m.Origin = v - } + m.Origin = v } // SetStatus sets response status. func (m *ResponseMetaHeader) SetStatus(v *status.Status) { - if m != nil { - m.Status = v - } + m.Status = v } // SetBodySignature sets signature of the request body. func (m *RequestVerificationHeader) SetBodySignature(v *refs.Signature) { - if m != nil { - m.BodySignature = v - } + m.BodySignature = v } // SetMetaSignature sets signature of the request meta. func (m *RequestVerificationHeader) SetMetaSignature(v *refs.Signature) { - if m != nil { - m.MetaSignature = v - } + m.MetaSignature = v } // SetOriginSignature sets signature of the origin verification header of the request. func (m *RequestVerificationHeader) SetOriginSignature(v *refs.Signature) { - if m != nil { - m.OriginSignature = v - } + m.OriginSignature = v } // SetOrigin sets origin verification header of the request. func (m *RequestVerificationHeader) SetOrigin(v *RequestVerificationHeader) { - if m != nil { - m.Origin = v - } + m.Origin = v } // SetBodySignature sets signature of the response body. func (m *ResponseVerificationHeader) SetBodySignature(v *refs.Signature) { - if m != nil { - m.BodySignature = v - } + m.BodySignature = v } // SetMetaSignature sets signature of the response meta. func (m *ResponseVerificationHeader) SetMetaSignature(v *refs.Signature) { - if m != nil { - m.MetaSignature = v - } + m.MetaSignature = v } // SetOriginSignature sets signature of the origin verification header of the response. func (m *ResponseVerificationHeader) SetOriginSignature(v *refs.Signature) { - if m != nil { - m.OriginSignature = v - } + m.OriginSignature = v } // SetOrigin sets origin verification header of the response. func (m *ResponseVerificationHeader) SetOrigin(v *ResponseVerificationHeader) { - if m != nil { - m.Origin = v - } + m.Origin = v } // FromString parses ObjectSessionContext_Verb from a string representation, diff --git a/session/types.go b/session/types.go index 65f4728..139bf57 100644 --- a/session/types.go +++ b/session/types.go @@ -144,9 +144,7 @@ func (c *CreateRequestBody) GetOwnerID() *refs.OwnerID { } func (c *CreateRequestBody) SetOwnerID(v *refs.OwnerID) { - if c != nil { - c.ownerID = v - } + c.ownerID = v } func (c *CreateRequestBody) GetExpiration() uint64 { @@ -158,9 +156,7 @@ func (c *CreateRequestBody) GetExpiration() uint64 { } func (c *CreateRequestBody) SetExpiration(v uint64) { - if c != nil { - c.expiration = v - } + c.expiration = v } func (c *CreateRequest) GetBody() *CreateRequestBody { @@ -172,9 +168,7 @@ func (c *CreateRequest) GetBody() *CreateRequestBody { } func (c *CreateRequest) SetBody(v *CreateRequestBody) { - if c != nil { - c.body = v - } + c.body = v } func (c *CreateRequest) GetMetaHeader() *RequestMetaHeader { @@ -186,9 +180,7 @@ func (c *CreateRequest) GetMetaHeader() *RequestMetaHeader { } func (c *CreateRequest) SetMetaHeader(v *RequestMetaHeader) { - if c != nil { - c.metaHeader = v - } + c.metaHeader = v } func (c *CreateRequest) GetVerificationHeader() *RequestVerificationHeader { @@ -200,9 +192,7 @@ func (c *CreateRequest) GetVerificationHeader() *RequestVerificationHeader { } func (c *CreateRequest) SetVerificationHeader(v *RequestVerificationHeader) { - if c != nil { - c.verifyHeader = v - } + c.verifyHeader = v } func (c *CreateResponseBody) GetID() []byte { @@ -214,9 +204,7 @@ func (c *CreateResponseBody) GetID() []byte { } func (c *CreateResponseBody) SetID(v []byte) { - if c != nil { - c.id = v - } + c.id = v } func (c *CreateResponseBody) GetSessionKey() []byte { @@ -228,9 +216,7 @@ func (c *CreateResponseBody) GetSessionKey() []byte { } func (c *CreateResponseBody) SetSessionKey(v []byte) { - if c != nil { - c.sessionKey = v - } + c.sessionKey = v } func (c *CreateResponse) GetBody() *CreateResponseBody { @@ -242,9 +228,7 @@ func (c *CreateResponse) GetBody() *CreateResponseBody { } func (c *CreateResponse) SetBody(v *CreateResponseBody) { - if c != nil { - c.body = v - } + c.body = v } func (c *CreateResponse) GetMetaHeader() *ResponseMetaHeader { @@ -256,9 +240,7 @@ func (c *CreateResponse) GetMetaHeader() *ResponseMetaHeader { } func (c *CreateResponse) SetMetaHeader(v *ResponseMetaHeader) { - if c != nil { - c.metaHeader = v - } + c.metaHeader = v } func (c *CreateResponse) GetVerificationHeader() *ResponseVerificationHeader { @@ -270,9 +252,7 @@ func (c *CreateResponse) GetVerificationHeader() *ResponseVerificationHeader { } func (c *CreateResponse) SetVerificationHeader(v *ResponseVerificationHeader) { - if c != nil { - c.verifyHeader = v - } + c.verifyHeader = v } func (x *XHeader) GetKey() string { @@ -284,9 +264,7 @@ func (x *XHeader) GetKey() string { } func (x *XHeader) SetKey(v string) { - if x != nil { - x.key = v - } + x.key = v } func (x *XHeader) GetValue() string { @@ -298,9 +276,7 @@ func (x *XHeader) GetValue() string { } func (x *XHeader) SetValue(v string) { - if x != nil { - x.val = v - } + x.val = v } func (r *RequestVerificationHeader) GetBodySignature() *refs.Signature { @@ -312,9 +288,7 @@ func (r *RequestVerificationHeader) GetBodySignature() *refs.Signature { } func (r *RequestVerificationHeader) SetBodySignature(v *refs.Signature) { - if r != nil { - r.bodySig = v - } + r.bodySig = v } func (r *RequestVerificationHeader) GetMetaSignature() *refs.Signature { @@ -326,9 +300,7 @@ func (r *RequestVerificationHeader) GetMetaSignature() *refs.Signature { } func (r *RequestVerificationHeader) SetMetaSignature(v *refs.Signature) { - if r != nil { - r.metaSig = v - } + r.metaSig = v } func (r *RequestVerificationHeader) GetOriginSignature() *refs.Signature { @@ -340,9 +312,7 @@ func (r *RequestVerificationHeader) GetOriginSignature() *refs.Signature { } func (r *RequestVerificationHeader) SetOriginSignature(v *refs.Signature) { - if r != nil { - r.originSig = v - } + r.originSig = v } func (r *RequestVerificationHeader) GetOrigin() *RequestVerificationHeader { @@ -354,9 +324,7 @@ func (r *RequestVerificationHeader) GetOrigin() *RequestVerificationHeader { } func (r *RequestVerificationHeader) SetOrigin(v *RequestVerificationHeader) { - if r != nil { - r.origin = v - } + r.origin = v } func (r *RequestMetaHeader) GetVersion() *refs.Version { @@ -368,9 +336,7 @@ func (r *RequestMetaHeader) GetVersion() *refs.Version { } func (r *RequestMetaHeader) SetVersion(v *refs.Version) { - if r != nil { - r.version = v - } + r.version = v } func (r *RequestMetaHeader) GetTTL() uint32 { @@ -382,9 +348,7 @@ func (r *RequestMetaHeader) GetTTL() uint32 { } func (r *RequestMetaHeader) SetTTL(v uint32) { - if r != nil { - r.ttl = v - } + r.ttl = v } func (r *RequestMetaHeader) GetEpoch() uint64 { @@ -396,9 +360,7 @@ func (r *RequestMetaHeader) GetEpoch() uint64 { } func (r *RequestMetaHeader) SetEpoch(v uint64) { - if r != nil { - r.epoch = v - } + r.epoch = v } func (r *RequestMetaHeader) GetXHeaders() []XHeader { @@ -410,9 +372,7 @@ func (r *RequestMetaHeader) GetXHeaders() []XHeader { } func (r *RequestMetaHeader) SetXHeaders(v []XHeader) { - if r != nil { - r.xHeaders = v - } + r.xHeaders = v } func (r *RequestMetaHeader) GetSessionToken() *Token { @@ -424,9 +384,7 @@ func (r *RequestMetaHeader) GetSessionToken() *Token { } func (r *RequestMetaHeader) SetSessionToken(v *Token) { - if r != nil { - r.sessionToken = v - } + r.sessionToken = v } func (r *RequestMetaHeader) GetBearerToken() *acl.BearerToken { @@ -438,9 +396,7 @@ func (r *RequestMetaHeader) GetBearerToken() *acl.BearerToken { } func (r *RequestMetaHeader) SetBearerToken(v *acl.BearerToken) { - if r != nil { - r.bearerToken = v - } + r.bearerToken = v } func (r *RequestMetaHeader) GetOrigin() *RequestMetaHeader { @@ -452,9 +408,7 @@ func (r *RequestMetaHeader) GetOrigin() *RequestMetaHeader { } func (r *RequestMetaHeader) SetOrigin(v *RequestMetaHeader) { - if r != nil { - r.origin = v - } + r.origin = v } // GetNetworkMagic returns NeoFS network magic. @@ -468,9 +422,7 @@ func (r *RequestMetaHeader) GetNetworkMagic() uint64 { // SetNetworkMagic sets NeoFS network magic. func (r *RequestMetaHeader) SetNetworkMagic(v uint64) { - if r != nil { - r.netMagic = v - } + r.netMagic = v } func (l *TokenLifetime) GetExp() uint64 { @@ -482,9 +434,7 @@ func (l *TokenLifetime) GetExp() uint64 { } func (l *TokenLifetime) SetExp(v uint64) { - if l != nil { - l.exp = v - } + l.exp = v } func (l *TokenLifetime) GetNbf() uint64 { @@ -496,9 +446,7 @@ func (l *TokenLifetime) GetNbf() uint64 { } func (l *TokenLifetime) SetNbf(v uint64) { - if l != nil { - l.nbf = v - } + l.nbf = v } func (l *TokenLifetime) GetIat() uint64 { @@ -510,9 +458,7 @@ func (l *TokenLifetime) GetIat() uint64 { } func (l *TokenLifetime) SetIat(v uint64) { - if l != nil { - l.iat = v - } + l.iat = v } func (r *ResponseVerificationHeader) GetBodySignature() *refs.Signature { @@ -524,9 +470,7 @@ func (r *ResponseVerificationHeader) GetBodySignature() *refs.Signature { } func (r *ResponseVerificationHeader) SetBodySignature(v *refs.Signature) { - if r != nil { - r.bodySig = v - } + r.bodySig = v } func (r *ResponseVerificationHeader) GetMetaSignature() *refs.Signature { @@ -538,9 +482,7 @@ func (r *ResponseVerificationHeader) GetMetaSignature() *refs.Signature { } func (r *ResponseVerificationHeader) SetMetaSignature(v *refs.Signature) { - if r != nil { - r.metaSig = v - } + r.metaSig = v } func (r *ResponseVerificationHeader) GetOriginSignature() *refs.Signature { @@ -552,9 +494,7 @@ func (r *ResponseVerificationHeader) GetOriginSignature() *refs.Signature { } func (r *ResponseVerificationHeader) SetOriginSignature(v *refs.Signature) { - if r != nil { - r.originSig = v - } + r.originSig = v } func (r *ResponseVerificationHeader) GetOrigin() *ResponseVerificationHeader { @@ -566,9 +506,7 @@ func (r *ResponseVerificationHeader) GetOrigin() *ResponseVerificationHeader { } func (r *ResponseVerificationHeader) SetOrigin(v *ResponseVerificationHeader) { - if r != nil { - r.origin = v - } + r.origin = v } func (r *ResponseMetaHeader) GetVersion() *refs.Version { @@ -580,9 +518,7 @@ func (r *ResponseMetaHeader) GetVersion() *refs.Version { } func (r *ResponseMetaHeader) SetVersion(v *refs.Version) { - if r != nil { - r.version = v - } + r.version = v } func (r *ResponseMetaHeader) GetTTL() uint32 { @@ -594,9 +530,7 @@ func (r *ResponseMetaHeader) GetTTL() uint32 { } func (r *ResponseMetaHeader) SetTTL(v uint32) { - if r != nil { - r.ttl = v - } + r.ttl = v } func (r *ResponseMetaHeader) GetEpoch() uint64 { @@ -608,9 +542,7 @@ func (r *ResponseMetaHeader) GetEpoch() uint64 { } func (r *ResponseMetaHeader) SetEpoch(v uint64) { - if r != nil { - r.epoch = v - } + r.epoch = v } func (r *ResponseMetaHeader) GetXHeaders() []XHeader { @@ -622,9 +554,7 @@ func (r *ResponseMetaHeader) GetXHeaders() []XHeader { } func (r *ResponseMetaHeader) SetXHeaders(v []XHeader) { - if r != nil { - r.xHeaders = v - } + r.xHeaders = v } func (r *ResponseMetaHeader) GetOrigin() *ResponseMetaHeader { @@ -636,9 +566,7 @@ func (r *ResponseMetaHeader) GetOrigin() *ResponseMetaHeader { } func (r *ResponseMetaHeader) SetOrigin(v *ResponseMetaHeader) { - if r != nil { - r.origin = v - } + r.origin = v } // GetStatus returns response status. @@ -652,9 +580,7 @@ func (r *ResponseMetaHeader) GetStatus() *status.Status { // SetStatus sets response status. func (r *ResponseMetaHeader) SetStatus(v *status.Status) { - if r != nil { - r.status = v - } + r.status = v } // SetStatus sets status of the message which can carry ResponseMetaHeader. @@ -685,9 +611,7 @@ func (c *ObjectSessionContext) GetVerb() ObjectSessionVerb { } func (c *ObjectSessionContext) SetVerb(v ObjectSessionVerb) { - if c != nil { - c.verb = v - } + c.verb = v } func (c *ObjectSessionContext) GetAddress() *refs.Address { @@ -699,9 +623,7 @@ func (c *ObjectSessionContext) GetAddress() *refs.Address { } func (c *ObjectSessionContext) SetAddress(v *refs.Address) { - if c != nil { - c.addr = v - } + c.addr = v } func (t *TokenBody) GetID() []byte { @@ -713,9 +635,7 @@ func (t *TokenBody) GetID() []byte { } func (t *TokenBody) SetID(v []byte) { - if t != nil { - t.id = v - } + t.id = v } func (t *TokenBody) GetOwnerID() *refs.OwnerID { @@ -727,9 +647,7 @@ func (t *TokenBody) GetOwnerID() *refs.OwnerID { } func (t *TokenBody) SetOwnerID(v *refs.OwnerID) { - if t != nil { - t.ownerID = v - } + t.ownerID = v } func (t *TokenBody) GetLifetime() *TokenLifetime { @@ -741,9 +659,7 @@ func (t *TokenBody) GetLifetime() *TokenLifetime { } func (t *TokenBody) SetLifetime(v *TokenLifetime) { - if t != nil { - t.lifetime = v - } + t.lifetime = v } func (t *TokenBody) GetSessionKey() []byte { @@ -755,9 +671,7 @@ func (t *TokenBody) GetSessionKey() []byte { } func (t *TokenBody) SetSessionKey(v []byte) { - if t != nil { - t.sessionKey = v - } + t.sessionKey = v } func (t *TokenBody) GetContext() TokenContext { @@ -769,9 +683,7 @@ func (t *TokenBody) GetContext() TokenContext { } func (t *TokenBody) SetContext(v TokenContext) { - if t != nil { - t.ctx = v - } + t.ctx = v } func (t *Token) GetBody() *TokenBody { @@ -783,9 +695,7 @@ func (t *Token) GetBody() *TokenBody { } func (t *Token) SetBody(v *TokenBody) { - if t != nil { - t.body = v - } + t.body = v } func (t *Token) GetSignature() *refs.Signature { @@ -797,9 +707,7 @@ func (t *Token) GetSignature() *refs.Signature { } func (t *Token) SetSignature(v *refs.Signature) { - if t != nil { - t.sig = v - } + t.sig = v } // ContainerSessionVerb represents NeoFS API v2 @@ -843,9 +751,7 @@ func (x *ContainerSessionContext) Verb() ContainerSessionVerb { // SetVerb sets type of request for which the token is issued. func (x *ContainerSessionContext) SetVerb(v ContainerSessionVerb) { - if x != nil { - x.verb = v - } + x.verb = v } // Wildcard returns wildcard flag of the container session. @@ -859,9 +765,7 @@ func (x *ContainerSessionContext) Wildcard() bool { // SetWildcard sets wildcard flag of the container session. func (x *ContainerSessionContext) SetWildcard(v bool) { - if x != nil { - x.wildcard = v - } + x.wildcard = v } // ContainerID returns identifier of the container related to the session. @@ -875,7 +779,5 @@ func (x *ContainerSessionContext) ContainerID() *refs.ContainerID { // SetContainerID sets identifier of the container related to the session. func (x *ContainerSessionContext) SetContainerID(v *refs.ContainerID) { - if x != nil { - x.cid = v - } + x.cid = v } diff --git a/session/util.go b/session/util.go index 5ee46d3..f39097d 100644 --- a/session/util.go +++ b/session/util.go @@ -23,9 +23,7 @@ func (c *RequestHeaders) GetMetaHeader() *RequestMetaHeader { // SetMetaHeader sets meta header of the request. func (c *RequestHeaders) SetMetaHeader(v *RequestMetaHeader) { - if c != nil { - c.metaHeader = v - } + c.metaHeader = v } // GetVerificationHeader returns verification header of the request. @@ -39,9 +37,7 @@ func (c *RequestHeaders) GetVerificationHeader() *RequestVerificationHeader { // SetVerificationHeader sets verification header of the request. func (c *RequestHeaders) SetVerificationHeader(v *RequestVerificationHeader) { - if c != nil { - c.verifyHeader = v - } + c.verifyHeader = v } func (c *RequestHeaders) ToMessage(m interface { @@ -106,9 +102,7 @@ func (c *ResponseHeaders) GetMetaHeader() *ResponseMetaHeader { // SetMetaHeader sets meta header of the response. func (c *ResponseHeaders) SetMetaHeader(v *ResponseMetaHeader) { - if c != nil { - c.metaHeader = v - } + c.metaHeader = v } // GetVerificationHeader returns verification header of the response. @@ -122,9 +116,7 @@ func (c *ResponseHeaders) GetVerificationHeader() *ResponseVerificationHeader { // SetVerificationHeader sets verification header of the response. func (c *ResponseHeaders) SetVerificationHeader(v *ResponseVerificationHeader) { - if c != nil { - c.verifyHeader = v - } + c.verifyHeader = v } func (c *ResponseHeaders) ToMessage(m interface { diff --git a/status/grpc/types.go b/status/grpc/types.go index eea2c82..993f632 100644 --- a/status/grpc/types.go +++ b/status/grpc/types.go @@ -2,35 +2,25 @@ package status // SetId sets identifier of the Status_Detail. func (x *Status_Detail) SetId(v uint32) { - if x != nil { - x.Id = v - } + x.Id = v } // SetValue sets value of the Status_Detail. func (x *Status_Detail) SetValue(v []byte) { - if x != nil { - x.Value = v - } + x.Value = v } // SetCode sets code of the Status. func (x *Status) SetCode(v uint32) { - if x != nil { - x.Code = v - } + x.Code = v } // SetMessage sets message about the Status. func (x *Status) SetMessage(v string) { - if x != nil { - x.Message = v - } + x.Message = v } // SetDetails sets details of the Status. func (x *Status) SetDetails(v []*Status_Detail) { - if x != nil { - x.Details = v - } + x.Details = v } diff --git a/status/types.go b/status/types.go index 8bcb3af..2259b3a 100644 --- a/status/types.go +++ b/status/types.go @@ -18,9 +18,7 @@ func (x *Detail) ID() uint32 { // SetID sets identifier of the Detail. func (x *Detail) SetID(id uint32) { - if x != nil { - x.id = id - } + x.id = id } // Value returns value of the Detail. @@ -34,9 +32,7 @@ func (x *Detail) Value() []byte { // SetValue sets value of the Detail. func (x *Detail) SetValue(val []byte) { - if x != nil { - x.val = val - } + x.val = val } // Code represents NeoFS API V2-compatible status code. @@ -67,9 +63,7 @@ func (x *Status) Code() Code { // SetCode sets code of the Status. func (x *Status) SetCode(code Code) { - if x != nil { - x.code = code - } + x.code = code } // Message sets message of the Status. @@ -83,9 +77,7 @@ func (x *Status) Message() string { // SetMessage sets message of the Status. func (x *Status) SetMessage(msg string) { - if x != nil { - x.msg = msg - } + x.msg = msg } // NumberOfParameters returns number of network parameters. diff --git a/storagegroup/grpc/types.go b/storagegroup/grpc/types.go index 5bba1b1..1c7a8a8 100644 --- a/storagegroup/grpc/types.go +++ b/storagegroup/grpc/types.go @@ -6,28 +6,20 @@ import ( // SetValidationDataSize sets the total size of the payloads of the storage group. func (m *StorageGroup) SetValidationDataSize(v uint64) { - if m != nil { - m.ValidationDataSize = v - } + m.ValidationDataSize = v } // SetValidationHash sets total homomorphic hash of the storage group payloads. func (m *StorageGroup) SetValidationHash(v *refs.Checksum) { - if m != nil { - m.ValidationHash = v - } + m.ValidationHash = v } // SetExpirationEpoch sets number of the last epoch of the storage group lifetime. func (m *StorageGroup) SetExpirationEpoch(v uint64) { - if m != nil { - m.ExpirationEpoch = v - } + m.ExpirationEpoch = v } // SetMembers sets list of the identifiers of the storage group members. func (m *StorageGroup) SetMembers(v []*refs.ObjectID) { - if m != nil { - m.Members = v - } + m.Members = v } diff --git a/storagegroup/types.go b/storagegroup/types.go index 38f66f6..a1926c7 100644 --- a/storagegroup/types.go +++ b/storagegroup/types.go @@ -27,9 +27,7 @@ func (s *StorageGroup) GetValidationDataSize() uint64 { // SetValidationDataSize into unified storage group structure. func (s *StorageGroup) SetValidationDataSize(v uint64) { - if s != nil { - s.size = v - } + s.size = v } // GetValidationHash of unified storage group structure. @@ -43,9 +41,7 @@ func (s *StorageGroup) GetValidationHash() *refs.Checksum { // SetValidationHash into unified storage group structure. func (s *StorageGroup) SetValidationHash(v *refs.Checksum) { - if s != nil { - s.hash = v - } + s.hash = v } // GetExpirationEpoch of unified storage group structure. @@ -59,9 +55,7 @@ func (s *StorageGroup) GetExpirationEpoch() uint64 { // SetExpirationEpoch into unified storage group structure. func (s *StorageGroup) SetExpirationEpoch(v uint64) { - if s != nil { - s.exp = v - } + s.exp = v } // GetMembers of unified storage group structure. Members are objects of @@ -77,7 +71,5 @@ func (s *StorageGroup) GetMembers() []refs.ObjectID { // SetMembers into unified storage group structure. Members are objects of // storage group. func (s *StorageGroup) SetMembers(v []refs.ObjectID) { - if s != nil { - s.members = v - } + s.members = v } diff --git a/subnet/grpc/types.go b/subnet/grpc/types.go index 60ccf36..58a7268 100644 --- a/subnet/grpc/types.go +++ b/subnet/grpc/types.go @@ -6,14 +6,10 @@ import ( // SetID returns identifier of the subnet. Nil arg is equivalent to zero subnet ID. func (x *SubnetInfo) SetID(id *refs.SubnetID) { - if x != nil { - x.Id = id - } + x.Id = id } // SetOwner sets subnet owner's ID in NeoFS system. func (x *SubnetInfo) SetOwner(id *refs.OwnerID) { - if x != nil { - x.Owner = id - } + x.Owner = id } diff --git a/tombstone/grpc/types.go b/tombstone/grpc/types.go index 17fe9db..aace76d 100644 --- a/tombstone/grpc/types.go +++ b/tombstone/grpc/types.go @@ -6,21 +6,15 @@ import ( // SetExpirationEpoch sets number of tombstone expiration epoch. func (x *Tombstone) SetExpirationEpoch(v uint64) { - if x != nil { - x.ExpirationEpoch = v - } + x.ExpirationEpoch = v } // SetSplitId sets identifier of split object hierarchy. func (x *Tombstone) SetSplitId(v []byte) { - if x != nil { - x.SplitId = v - } + x.SplitId = v } // SetMembers sets list of objects to be deleted. func (x *Tombstone) SetMembers(v []*refs.ObjectID) { - if x != nil { - x.Members = v - } + x.Members = v } diff --git a/tombstone/types.go b/tombstone/types.go index 6cce852..d04935d 100644 --- a/tombstone/types.go +++ b/tombstone/types.go @@ -25,9 +25,7 @@ func (s *Tombstone) GetExpirationEpoch() uint64 { // SetExpirationEpoch sets number of tombstone expiration epoch. func (s *Tombstone) SetExpirationEpoch(v uint64) { - if s != nil { - s.exp = v - } + s.exp = v } // GetSplitID returns identifier of split object hierarchy. @@ -41,9 +39,7 @@ func (s *Tombstone) GetSplitID() []byte { // SetSplitID sets identifier of split object hierarchy. func (s *Tombstone) SetSplitID(v []byte) { - if s != nil { - s.splitID = v - } + s.splitID = v } // GetMembers returns list of objects to be deleted. @@ -57,7 +53,5 @@ func (s *Tombstone) GetMembers() []refs.ObjectID { // SetMembers sets list of objects to be deleted. func (s *Tombstone) SetMembers(v []refs.ObjectID) { - if s != nil { - s.members = v - } + s.members = v } From 84d981e88e53ee40381ca4d3a05bec59a5af88b5 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Sat, 12 Mar 2022 15:20:19 +0300 Subject: [PATCH 0982/1196] util/proto: do not return error from primitive marshalers Signed-off-by: Evgenii Stratonikov --- accounting/marshal.go | 18 +--- acl/marshal.go | 93 +++-------------- audit/marshal.go | 75 ++------------ container/marshal.go | 45 ++------ netmap/marshal.go | 190 ++++++---------------------------- object/marshal.go | 204 ++++++------------------------------- refs/marshal.go | 77 +++----------- reputation/marshal.go | 36 ++----- session/marshal.go | 160 +++++------------------------ status/marshal.go | 26 +---- storagegroup/marshal.go | 14 +-- tombstone/marshal.go | 15 +-- util/proto/marshal.go | 80 +++++++-------- util/proto/marshal_test.go | 101 ++++-------------- 14 files changed, 202 insertions(+), 932 deletions(-) diff --git a/accounting/marshal.go b/accounting/marshal.go index 8c2e06f..0d908c0 100644 --- a/accounting/marshal.go +++ b/accounting/marshal.go @@ -24,22 +24,10 @@ func (d *Decimal) StableMarshal(buf []byte) ([]byte, error) { buf = make([]byte, d.StableSize()) } - var ( - offset, n int - err error - ) + var offset int - n, err = protoutil.Int64Marshal(decimalValueField, buf[offset:], d.val) - if err != nil { - return nil, err - } - - offset += n - - _, err = protoutil.UInt32Marshal(decimalPrecisionField, buf[offset:], d.prec) - if err != nil { - return nil, err - } + offset += protoutil.Int64Marshal(decimalValueField, buf[offset:], d.val) + protoutil.UInt32Marshal(decimalPrecisionField, buf[offset:], d.prec) return buf, nil } diff --git a/acl/marshal.go b/acl/marshal.go index 5ef3676..11c6174 100644 --- a/acl/marshal.go +++ b/acl/marshal.go @@ -114,19 +114,8 @@ func (r *Record) StableMarshal(buf []byte) ([]byte, error) { err error ) - n, err = protoutil.EnumMarshal(recordOperationField, buf[offset:], int32(r.op)) - if err != nil { - return nil, err - } - - offset += n - - n, err = protoutil.EnumMarshal(recordActionField, buf[offset:], int32(r.action)) - if err != nil { - return nil, err - } - - offset += n + offset += protoutil.EnumMarshal(recordOperationField, buf[offset:], int32(r.op)) + offset += protoutil.EnumMarshal(recordActionField, buf[offset:], int32(r.action)) for i := range r.filters { n, err = protoutil.NestedStructureMarshal(recordFiltersField, buf[offset:], &r.filters[i]) @@ -184,36 +173,12 @@ func (f *HeaderFilter) StableMarshal(buf []byte) ([]byte, error) { buf = make([]byte, f.StableSize()) } - var ( - offset, n int - err error - ) + var offset int - n, err = protoutil.EnumMarshal(filterHeaderTypeField, buf[offset:], int32(f.hdrType)) - if err != nil { - return nil, err - } - - offset += n - - n, err = protoutil.EnumMarshal(filterMatchTypeField, buf[offset:], int32(f.matchType)) - if err != nil { - return nil, err - } - - offset += n - - n, err = protoutil.StringMarshal(filterNameField, buf[offset:], f.key) - if err != nil { - return nil, err - } - - offset += n - - _, err = protoutil.StringMarshal(filterValueField, buf[offset:], f.value) - if err != nil { - return nil, err - } + offset += protoutil.EnumMarshal(filterHeaderTypeField, buf[offset:], int32(f.hdrType)) + offset += protoutil.EnumMarshal(filterMatchTypeField, buf[offset:], int32(f.matchType)) + offset += protoutil.StringMarshal(filterNameField, buf[offset:], f.key) + protoutil.StringMarshal(filterValueField, buf[offset:], f.value) return buf, nil } @@ -247,22 +212,10 @@ func (t *Target) StableMarshal(buf []byte) ([]byte, error) { buf = make([]byte, t.StableSize()) } - var ( - offset, n int - err error - ) + var offset int - n, err = protoutil.EnumMarshal(targetTypeField, buf[offset:], int32(t.role)) - if err != nil { - return nil, err - } - - offset += n - - _, err = protoutil.RepeatedBytesMarshal(targetKeysField, buf[offset:], t.keys) - if err != nil { - return nil, err - } + offset += protoutil.EnumMarshal(targetTypeField, buf[offset:], int32(t.role)) + protoutil.RepeatedBytesMarshal(targetKeysField, buf[offset:], t.keys) return buf, nil } @@ -292,29 +245,11 @@ func (l *TokenLifetime) StableMarshal(buf []byte) ([]byte, error) { buf = make([]byte, l.StableSize()) } - var ( - offset, n int - err error - ) + var offset int - n, err = protoutil.UInt64Marshal(lifetimeExpirationField, buf[offset:], l.exp) - if err != nil { - return nil, err - } - - offset += n - - n, err = protoutil.UInt64Marshal(lifetimeNotValidBeforeField, buf[offset:], l.nbf) - if err != nil { - return nil, err - } - - offset += n - - _, err = protoutil.UInt64Marshal(lifetimeIssuedAtField, buf[offset:], l.iat) - if err != nil { - return nil, err - } + offset += protoutil.UInt64Marshal(lifetimeExpirationField, buf[offset:], l.exp) + offset += protoutil.UInt64Marshal(lifetimeNotValidBeforeField, buf[offset:], l.nbf) + protoutil.UInt64Marshal(lifetimeIssuedAtField, buf[offset:], l.iat) return buf, nil } diff --git a/audit/marshal.go b/audit/marshal.go index dc46a21..02633a4 100644 --- a/audit/marshal.go +++ b/audit/marshal.go @@ -48,12 +48,7 @@ func (a *DataAuditResult) StableMarshal(buf []byte) ([]byte, error) { offset += n - n, err = proto.Fixed64Marshal(auditEpochFNum, buf[offset:], a.auditEpoch) - if err != nil { - return nil, err - } - - offset += n + offset += proto.Fixed64Marshal(auditEpochFNum, buf[offset:], a.auditEpoch) n, err = proto.NestedStructureMarshal(cidFNum, buf[offset:], a.cid) if err != nil { @@ -62,33 +57,10 @@ func (a *DataAuditResult) StableMarshal(buf []byte) ([]byte, error) { offset += n - n, err = proto.BytesMarshal(pubKeyFNum, buf[offset:], a.pubKey) - if err != nil { - return nil, err - } - - offset += n - - n, err = proto.BoolMarshal(completeFNum, buf[offset:], a.complete) - if err != nil { - return nil, err - } - - offset += n - - n, err = proto.UInt32Marshal(requestsFNum, buf[offset:], a.requests) - if err != nil { - return nil, err - } - - offset += n - - n, err = proto.UInt32Marshal(retriesFNum, buf[offset:], a.retries) - if err != nil { - return nil, err - } - - offset += n + offset += proto.BytesMarshal(pubKeyFNum, buf[offset:], a.pubKey) + offset += proto.BoolMarshal(completeFNum, buf[offset:], a.complete) + offset += proto.UInt32Marshal(requestsFNum, buf[offset:], a.requests) + offset += proto.UInt32Marshal(retriesFNum, buf[offset:], a.retries) n, err = refs.ObjectIDNestedListMarshal(passSGFNum, buf[offset:], a.passSG) if err != nil { @@ -104,38 +76,11 @@ func (a *DataAuditResult) StableMarshal(buf []byte) ([]byte, error) { offset += n - n, err = proto.UInt32Marshal(hitFNum, buf[offset:], a.hit) - if err != nil { - return nil, err - } - - offset += n - - n, err = proto.UInt32Marshal(missFNum, buf[offset:], a.miss) - if err != nil { - return nil, err - } - - offset += n - - n, err = proto.UInt32Marshal(failFNum, buf[offset:], a.fail) - if err != nil { - return nil, err - } - - offset += n - - n, err = proto.RepeatedBytesMarshal(passNodesFNum, buf[offset:], a.passNodes) - if err != nil { - return nil, err - } - - offset += n - - _, err = proto.RepeatedBytesMarshal(failNodesFNum, buf[offset:], a.failNodes) - if err != nil { - return nil, err - } + offset += proto.UInt32Marshal(hitFNum, buf[offset:], a.hit) + offset += proto.UInt32Marshal(missFNum, buf[offset:], a.miss) + offset += proto.UInt32Marshal(failFNum, buf[offset:], a.fail) + offset += proto.RepeatedBytesMarshal(passNodesFNum, buf[offset:], a.passNodes) + proto.RepeatedBytesMarshal(failNodesFNum, buf[offset:], a.failNodes) return buf, nil } diff --git a/container/marshal.go b/container/marshal.go index f5f7c11..f8a940d 100644 --- a/container/marshal.go +++ b/container/marshal.go @@ -60,22 +60,10 @@ func (a *Attribute) StableMarshal(buf []byte) ([]byte, error) { buf = make([]byte, a.StableSize()) } - var ( - offset, n int - err error - ) + var offset int - n, err = protoutil.StringMarshal(attributeKeyField, buf[offset:], a.key) - if err != nil { - return nil, err - } - - offset += n - - _, err = protoutil.StringMarshal(attributeValueField, buf[offset:], a.val) - if err != nil { - return nil, err - } + offset += protoutil.StringMarshal(attributeKeyField, buf[offset:], a.key) + protoutil.StringMarshal(attributeValueField, buf[offset:], a.val) return buf, nil } @@ -123,19 +111,8 @@ func (c *Container) StableMarshal(buf []byte) ([]byte, error) { offset += n - n, err = protoutil.BytesMarshal(containerNonceField, buf[offset:], c.nonce) - if err != nil { - return nil, err - } - - offset += n - - n, err = protoutil.UInt32Marshal(containerBasicACLField, buf[offset:], c.basicACL) - if err != nil { - return nil, err - } - - offset += n + offset += protoutil.BytesMarshal(containerNonceField, buf[offset:], c.nonce) + offset += protoutil.UInt32Marshal(containerBasicACLField, buf[offset:], c.basicACL) for i := range c.attr { n, err = protoutil.NestedStructureMarshal(containerAttributesField, buf[offset:], &c.attr[i]) @@ -612,12 +589,7 @@ func (a *UsedSpaceAnnouncement) StableMarshal(buf []byte) ([]byte, error) { err error ) - n, err = protoutil.UInt64Marshal(usedSpaceAnnounceEpochField, buf[offset:], a.epoch) - if err != nil { - return nil, err - } - - offset += n + offset += protoutil.UInt64Marshal(usedSpaceAnnounceEpochField, buf[offset:], a.epoch) n, err = protoutil.NestedStructureMarshal(usedSpaceAnnounceCIDField, buf[offset:], a.cid) if err != nil { @@ -626,10 +598,7 @@ func (a *UsedSpaceAnnouncement) StableMarshal(buf []byte) ([]byte, error) { offset += n - _, err = protoutil.UInt64Marshal(usedSpaceAnnounceUsedSpaceField, buf[offset:], a.usedSpace) - if err != nil { - return nil, err - } + protoutil.UInt64Marshal(usedSpaceAnnounceUsedSpaceField, buf[offset:], a.usedSpace) return buf, nil } diff --git a/netmap/marshal.go b/netmap/marshal.go index 70a8b4c..72a974e 100644 --- a/netmap/marshal.go +++ b/netmap/marshal.go @@ -55,33 +55,10 @@ func (f *Filter) StableMarshal(buf []byte) ([]byte, error) { err error ) - n, err = protoutil.StringMarshal(nameFilterField, buf[offset:], f.name) - if err != nil { - return nil, err - } - - offset += n - - n, err = protoutil.StringMarshal(keyFilterField, buf[offset:], f.key) - if err != nil { - return nil, err - } - - offset += n - - n, err = protoutil.EnumMarshal(opFilterField, buf[offset:], int32(f.op)) - if err != nil { - return nil, err - } - - offset += n - - n, err = protoutil.StringMarshal(valueFilterField, buf[offset:], f.value) - if err != nil { - return nil, err - } - - offset += n + offset += protoutil.StringMarshal(nameFilterField, buf[offset:], f.name) + offset += protoutil.StringMarshal(keyFilterField, buf[offset:], f.key) + offset += protoutil.EnumMarshal(opFilterField, buf[offset:], int32(f.op)) + offset += protoutil.StringMarshal(valueFilterField, buf[offset:], f.value) for i := range f.filters { n, err = protoutil.NestedStructureMarshal(filtersFilterField, buf[offset:], &f.filters[i]) @@ -120,43 +97,13 @@ func (s *Selector) StableMarshal(buf []byte) ([]byte, error) { buf = make([]byte, s.StableSize()) } - var ( - offset, n int - err error - ) + var offset int - n, err = protoutil.StringMarshal(nameSelectorField, buf[offset:], s.name) - if err != nil { - return nil, err - } - - offset += n - - n, err = protoutil.UInt32Marshal(countSelectorField, buf[offset:], s.count) - if err != nil { - return nil, err - } - - offset += n - - n, err = protoutil.EnumMarshal(clauseSelectorField, buf[offset:], int32(s.clause)) - if err != nil { - return nil, err - } - - offset += n - - n, err = protoutil.StringMarshal(attributeSelectorField, buf[offset:], s.attribute) - if err != nil { - return nil, err - } - - offset += n - - _, err = protoutil.StringMarshal(filterSelectorField, buf[offset:], s.filter) - if err != nil { - return nil, err - } + offset += protoutil.StringMarshal(nameSelectorField, buf[offset:], s.name) + offset += protoutil.UInt32Marshal(countSelectorField, buf[offset:], s.count) + offset += protoutil.EnumMarshal(clauseSelectorField, buf[offset:], int32(s.clause)) + offset += protoutil.StringMarshal(attributeSelectorField, buf[offset:], s.attribute) + protoutil.StringMarshal(filterSelectorField, buf[offset:], s.filter) return buf, nil } @@ -184,22 +131,10 @@ func (r *Replica) StableMarshal(buf []byte) ([]byte, error) { buf = make([]byte, r.StableSize()) } - var ( - offset, n int - err error - ) + var offset int - n, err = protoutil.UInt32Marshal(countReplicaField, buf[offset:], r.count) - if err != nil { - return nil, err - } - - offset += n - - _, err = protoutil.StringMarshal(selectorReplicaField, buf[offset:], r.selector) - if err != nil { - return nil, err - } + offset += protoutil.UInt32Marshal(countReplicaField, buf[offset:], r.count) + protoutil.StringMarshal(selectorReplicaField, buf[offset:], r.selector) return buf, nil } @@ -238,12 +173,7 @@ func (p *PlacementPolicy) StableMarshal(buf []byte) ([]byte, error) { offset += n } - n, err = protoutil.UInt32Marshal(backupPolicyField, buf[offset:], p.backupFactor) - if err != nil { - return nil, err - } - - offset += n + offset += protoutil.UInt32Marshal(backupPolicyField, buf[offset:], p.backupFactor) for i := range p.selectors { n, err = protoutil.NestedStructureMarshal(selectorsPolicyField, buf[offset:], &p.selectors[i]) @@ -304,32 +234,13 @@ func (a *Attribute) StableMarshal(buf []byte) ([]byte, error) { buf = make([]byte, a.StableSize()) } - var ( - offset, n int - err error - ) + var offset int - n, err = protoutil.StringMarshal(keyAttributeField, buf[offset:], a.key) - if err != nil { - return nil, err - } - - offset += n - - n, err = protoutil.StringMarshal(valueAttributeField, buf[offset:], a.value) - if err != nil { - return nil, err - } - - offset += n + offset += protoutil.StringMarshal(keyAttributeField, buf[offset:], a.key) + offset += protoutil.StringMarshal(valueAttributeField, buf[offset:], a.value) for i := range a.parents { - n, err = protoutil.StringMarshal(parentsAttributeField, buf[offset:], a.parents[i]) - if err != nil { - return nil, err - } - - offset += n + offset += protoutil.StringMarshal(parentsAttributeField, buf[offset:], a.parents[i]) } return buf, nil @@ -368,19 +279,8 @@ func (ni *NodeInfo) StableMarshal(buf []byte) ([]byte, error) { err error ) - n, err = protoutil.BytesMarshal(keyNodeInfoField, buf[offset:], ni.publicKey) - if err != nil { - return nil, err - } - - offset += n - - n, err = protoutil.RepeatedStringMarshal(addressNodeInfoField, buf[offset:], ni.addresses) - if err != nil { - return nil, err - } - - offset += n + offset += protoutil.BytesMarshal(keyNodeInfoField, buf[offset:], ni.publicKey) + offset += protoutil.RepeatedStringMarshal(addressNodeInfoField, buf[offset:], ni.addresses) for i := range ni.attributes { n, err = protoutil.NestedStructureMarshal(attributesNodeInfoField, buf[offset:], &ni.attributes[i]) @@ -391,10 +291,7 @@ func (ni *NodeInfo) StableMarshal(buf []byte) ([]byte, error) { offset += n } - _, err = protoutil.EnumMarshal(stateNodeInfoField, buf[offset:], int32(ni.state)) - if err != nil { - return nil, err - } + protoutil.EnumMarshal(stateNodeInfoField, buf[offset:], int32(ni.state)) return buf, nil } @@ -491,22 +388,10 @@ func (x *NetworkParameter) StableMarshal(buf []byte) ([]byte, error) { buf = make([]byte, x.StableSize()) } - var ( - offset, n int - err error - ) + var offset int - n, err = protoutil.BytesMarshal(netPrmKeyFNum, buf[offset:], x.k) - if err != nil { - return nil, err - } - - offset += n - - _, err = protoutil.BytesMarshal(netPrmValFNum, buf[offset:], x.v) - if err != nil { - return nil, err - } + offset += protoutil.BytesMarshal(netPrmKeyFNum, buf[offset:], x.k) + protoutil.BytesMarshal(netPrmValFNum, buf[offset:], x.v) return buf, nil } @@ -583,30 +468,13 @@ func (i *NetworkInfo) StableMarshal(buf []byte) ([]byte, error) { } var ( - offset, n int - err error + offset int + err error ) - n, err = protoutil.UInt64Marshal(netInfoCurEpochFNum, buf[offset:], i.curEpoch) - if err != nil { - return nil, err - } - - offset += n - - n, err = protoutil.UInt64Marshal(netInfoMagicNumFNum, buf[offset:], i.magicNum) - if err != nil { - return nil, err - } - - offset += n - - n, err = protoutil.Int64Marshal(netInfoMSPerBlockFNum, buf[offset:], i.msPerBlock) - if err != nil { - return nil, err - } - - offset += n + offset += protoutil.UInt64Marshal(netInfoCurEpochFNum, buf[offset:], i.curEpoch) + offset += protoutil.UInt64Marshal(netInfoMagicNumFNum, buf[offset:], i.magicNum) + offset += protoutil.Int64Marshal(netInfoMSPerBlockFNum, buf[offset:], i.msPerBlock) _, err = protoutil.NestedStructureMarshal(netInfoCfgFNum, buf[offset:], i.netCfg) if err != nil { diff --git a/object/marshal.go b/object/marshal.go index a3e69b3..79b767d 100644 --- a/object/marshal.go +++ b/object/marshal.go @@ -133,12 +133,7 @@ func (h *ShortHeader) StableMarshal(buf []byte) ([]byte, error) { offset += n - n, err = proto.UInt64Marshal(shortHdrEpochField, buf[offset:], h.creatEpoch) - if err != nil { - return nil, err - } - - offset += n + offset += proto.UInt64Marshal(shortHdrEpochField, buf[offset:], h.creatEpoch) n, err = proto.NestedStructureMarshal(shortHdrOwnerField, buf[offset:], h.ownerID) if err != nil { @@ -147,19 +142,8 @@ func (h *ShortHeader) StableMarshal(buf []byte) ([]byte, error) { offset += n - n, err = proto.EnumMarshal(shortHdrObjectTypeField, buf[offset:], int32(h.typ)) - if err != nil { - return nil, err - } - - offset += n - - n, err = proto.UInt64Marshal(shortHdrPayloadLength, buf[offset:], h.payloadLen) - if err != nil { - return nil, err - } - - offset += n + offset += proto.EnumMarshal(shortHdrObjectTypeField, buf[offset:], int32(h.typ)) + offset += proto.UInt64Marshal(shortHdrPayloadLength, buf[offset:], h.payloadLen) n, err = proto.NestedStructureMarshal(shortHdrHashField, buf[offset:], h.payloadHash) if err != nil { @@ -205,22 +189,10 @@ func (a *Attribute) StableMarshal(buf []byte) ([]byte, error) { buf = make([]byte, a.StableSize()) } - var ( - offset, n int - err error - ) + var offset int - n, err = proto.StringMarshal(attributeKeyField, buf[offset:], a.key) - if err != nil { - return nil, err - } - - offset += n - - _, err = proto.StringMarshal(attributeValueField, buf[offset:], a.val) - if err != nil { - return nil, err - } + offset += proto.StringMarshal(attributeKeyField, buf[offset:], a.key) + proto.StringMarshal(attributeValueField, buf[offset:], a.val) return buf, nil } @@ -289,10 +261,7 @@ func (h *SplitHeader) StableMarshal(buf []byte) ([]byte, error) { offset += n - _, err = proto.BytesMarshal(splitHdrSplitIDField, buf[offset:], h.splitID) - if err != nil { - return nil, err - } + proto.BytesMarshal(splitHdrSplitIDField, buf[offset:], h.splitID) return buf, nil } @@ -351,19 +320,8 @@ func (h *Header) StableMarshal(buf []byte) ([]byte, error) { offset += n - n, err = proto.UInt64Marshal(hdrEpochField, buf[offset:], h.creatEpoch) - if err != nil { - return nil, err - } - - offset += n - - n, err = proto.UInt64Marshal(hdrPayloadLengthField, buf[offset:], h.payloadLen) - if err != nil { - return nil, err - } - - offset += n + offset += proto.UInt64Marshal(hdrEpochField, buf[offset:], h.creatEpoch) + offset += proto.UInt64Marshal(hdrPayloadLengthField, buf[offset:], h.payloadLen) n, err = proto.NestedStructureMarshal(hdrPayloadHashField, buf[offset:], h.payloadHash) if err != nil { @@ -372,12 +330,7 @@ func (h *Header) StableMarshal(buf []byte) ([]byte, error) { offset += n - n, err = proto.EnumMarshal(hdrObjectTypeField, buf[offset:], int32(h.typ)) - if err != nil { - return nil, err - } - - offset += n + offset += proto.EnumMarshal(hdrObjectTypeField, buf[offset:], int32(h.typ)) n, err = proto.NestedStructureMarshal(hdrHomomorphicHashField, buf[offset:], h.homoHash) if err != nil { @@ -515,10 +468,7 @@ func (o *Object) StableMarshal(buf []byte) ([]byte, error) { offset += n - _, err = proto.BytesMarshal(objPayloadField, buf[offset:], o.payload) - if err != nil { - return nil, err - } + proto.BytesMarshal(objPayloadField, buf[offset:], o.payload) return buf, nil } @@ -554,12 +504,7 @@ func (s *SplitInfo) StableMarshal(buf []byte) ([]byte, error) { err error ) - n, err = proto.BytesMarshal(splitInfoSplitIDField, buf[offset:], s.splitID) - if err != nil { - return nil, err - } - - offset += n + offset += proto.BytesMarshal(splitInfoSplitIDField, buf[offset:], s.splitID) n, err = proto.NestedStructureMarshal(splitInfoLastPartField, buf[offset:], s.lastPart) if err != nil { @@ -613,10 +558,7 @@ func (r *GetRequestBody) StableMarshal(buf []byte) ([]byte, error) { offset += n - _, err = proto.BoolMarshal(getReqBodyRawFlagField, buf[offset:], r.raw) - if err != nil { - return nil, err - } + proto.BoolMarshal(getReqBodyRawFlagField, buf[offset:], r.raw) return buf, nil } @@ -706,10 +648,7 @@ func (r *GetResponseBody) StableMarshal(buf []byte) ([]byte, error) { } case *GetObjectPartChunk: if v != nil { - _, err := proto.BytesMarshal(getRespBodyChunkField, buf, v.chunk) - if err != nil { - return nil, err - } + proto.BytesMarshal(getRespBodyChunkField, buf, v.chunk) } case *SplitInfo: _, err := proto.NestedStructureMarshal(getRespBodySplitInfoField, buf, v) @@ -784,10 +723,7 @@ func (r *PutObjectPartInit) StableMarshal(buf []byte) ([]byte, error) { offset += n - _, err = proto.UInt32Marshal(putReqInitCopiesNumField, buf[offset:], r.copyNum) - if err != nil { - return nil, err - } + proto.UInt32Marshal(putReqInitCopiesNumField, buf[offset:], r.copyNum) return buf, nil } @@ -827,10 +763,7 @@ func (r *PutRequestBody) StableMarshal(buf []byte) ([]byte, error) { } case *PutObjectPartChunk: if v != nil { - _, err := proto.BytesMarshal(putReqBodyChunkField, buf, v.chunk) - if err != nil { - return nil, err - } + proto.BytesMarshal(putReqBodyChunkField, buf, v.chunk) } default: panic("unknown one of object put request body type") @@ -977,17 +910,8 @@ func (r *HeadRequestBody) StableMarshal(buf []byte) ([]byte, error) { offset += n - n, err = proto.BoolMarshal(headReqBodyMainFlagField, buf[offset:], r.mainOnly) - if err != nil { - return nil, err - } - - offset += n - - _, err = proto.BoolMarshal(headReqBodyRawFlagField, buf[offset:], r.raw) - if err != nil { - return nil, err - } + offset += proto.BoolMarshal(headReqBodyMainFlagField, buf[offset:], r.mainOnly) + proto.BoolMarshal(headReqBodyRawFlagField, buf[offset:], r.raw) return buf, nil } @@ -1086,29 +1010,11 @@ func (f *SearchFilter) StableMarshal(buf []byte) ([]byte, error) { buf = make([]byte, f.StableSize()) } - var ( - offset, n int - err error - ) + var offset int - n, err = proto.EnumMarshal(searchFilterMatchField, buf[offset:], int32(f.matchType)) - if err != nil { - return nil, err - } - - offset += n - - n, err = proto.StringMarshal(searchFilterNameField, buf[offset:], f.key) - if err != nil { - return nil, err - } - - offset += n - - _, err = proto.StringMarshal(searchFilterValueField, buf[offset:], f.val) - if err != nil { - return nil, err - } + offset += proto.EnumMarshal(searchFilterMatchField, buf[offset:], int32(f.matchType)) + offset += proto.StringMarshal(searchFilterNameField, buf[offset:], f.key) + proto.StringMarshal(searchFilterValueField, buf[offset:], f.val) return buf, nil } @@ -1150,12 +1056,7 @@ func (r *SearchRequestBody) StableMarshal(buf []byte) ([]byte, error) { offset += n - n, err = proto.UInt32Marshal(searchReqBodyVersionField, buf[offset:], r.version) - if err != nil { - return nil, err - } - - offset += n + offset += proto.UInt32Marshal(searchReqBodyVersionField, buf[offset:], r.version) for i := range r.filters { n, err = proto.NestedStructureMarshal(searchReqBodyFiltersField, buf[offset:], &r.filters[i]) @@ -1233,22 +1134,10 @@ func (r *Range) StableMarshal(buf []byte) ([]byte, error) { buf = make([]byte, r.StableSize()) } - var ( - offset, n int - err error - ) + var offset int - n, err = proto.UInt64Marshal(rangeOffsetField, buf[offset:], r.off) - if err != nil { - return nil, err - } - - offset += n - - _, err = proto.UInt64Marshal(rangeLengthField, buf[offset:], r.len) - if err != nil { - return nil, err - } + offset += proto.UInt64Marshal(rangeOffsetField, buf[offset:], r.off) + proto.UInt64Marshal(rangeLengthField, buf[offset:], r.len) return buf, nil } @@ -1296,10 +1185,7 @@ func (r *GetRangeRequestBody) StableMarshal(buf []byte) ([]byte, error) { offset += n - _, err = proto.BoolMarshal(getRangeReqBodyRawField, buf[offset:], r.raw) - if err != nil { - return nil, err - } + proto.BoolMarshal(getRangeReqBodyRawField, buf[offset:], r.raw) return buf, nil } @@ -1333,10 +1219,7 @@ func (r *GetRangeResponseBody) StableMarshal(buf []byte) ([]byte, error) { case nil: case *GetRangePartChunk: if v != nil { - _, err := proto.BytesMarshal(getRangeRespChunkField, buf, v.chunk) - if err != nil { - return nil, err - } + proto.BytesMarshal(getRangeRespChunkField, buf, v.chunk) } case *SplitInfo: if v != nil { @@ -1408,17 +1291,8 @@ func (r *GetRangeHashRequestBody) StableMarshal(buf []byte) ([]byte, error) { offset += n } - n, err = proto.BytesMarshal(getRangeHashReqBodySaltField, buf[offset:], r.salt) - if err != nil { - return nil, err - } - - offset += n - - _, err = proto.EnumMarshal(getRangeHashReqBodyTypeField, buf[offset:], int32(r.typ)) - if err != nil { - return nil, err - } + offset += proto.BytesMarshal(getRangeHashReqBodySaltField, buf[offset:], r.salt) + proto.EnumMarshal(getRangeHashReqBodyTypeField, buf[offset:], int32(r.typ)) return buf, nil } @@ -1453,22 +1327,10 @@ func (r *GetRangeHashResponseBody) StableMarshal(buf []byte) ([]byte, error) { buf = make([]byte, r.StableSize()) } - var ( - offset, n int - err error - ) + var offset int - n, err = proto.EnumMarshal(getRangeHashRespBodyTypeField, buf, int32(r.typ)) - if err != nil { - return nil, err - } - - offset += n - - _, err = proto.RepeatedBytesMarshal(getRangeHashRespBodyHashListField, buf[offset:], r.hashList) - if err != nil { - return nil, err - } + offset += proto.EnumMarshal(getRangeHashRespBodyTypeField, buf, int32(r.typ)) + proto.RepeatedBytesMarshal(getRangeHashRespBodyHashListField, buf[offset:], r.hashList) return buf, nil } diff --git a/refs/marshal.go b/refs/marshal.go index aa04b63..ffb1ba5 100644 --- a/refs/marshal.go +++ b/refs/marshal.go @@ -36,10 +36,7 @@ func (o *OwnerID) StableMarshal(buf []byte) ([]byte, error) { buf = make([]byte, o.StableSize()) } - _, err := proto.BytesMarshal(ownerIDValField, buf, o.val) - if err != nil { - return nil, err - } + proto.BytesMarshal(ownerIDValField, buf, o.val) return buf, nil } @@ -65,10 +62,7 @@ func (c *ContainerID) StableMarshal(buf []byte) ([]byte, error) { buf = make([]byte, c.StableSize()) } - _, err := proto.BytesMarshal(containerIDValField, buf, c.val) - if err != nil { - return nil, err - } + proto.BytesMarshal(containerIDValField, buf, c.val) return buf, nil } @@ -94,10 +88,7 @@ func (o *ObjectID) StableMarshal(buf []byte) ([]byte, error) { buf = make([]byte, o.StableSize()) } - _, err := proto.BytesMarshal(objectIDValField, buf, o.val) - if err != nil { - return nil, err - } + proto.BytesMarshal(objectIDValField, buf, o.val) return buf, nil } @@ -195,22 +186,10 @@ func (c *Checksum) StableMarshal(buf []byte) ([]byte, error) { buf = make([]byte, c.StableSize()) } - var ( - offset, n int - err error - ) + var offset int - n, err = proto.EnumMarshal(checksumTypeField, buf[offset:], int32(c.typ)) - if err != nil { - return nil, err - } - - offset += n - - _, err = proto.BytesMarshal(checksumValueField, buf[offset:], c.sum) - if err != nil { - return nil, err - } + offset += proto.EnumMarshal(checksumTypeField, buf[offset:], int32(c.typ)) + proto.BytesMarshal(checksumValueField, buf[offset:], c.sum) return buf, nil } @@ -239,29 +218,11 @@ func (s *Signature) StableMarshal(buf []byte) ([]byte, error) { buf = make([]byte, s.StableSize()) } - var ( - offset, n int - err error - ) + var offset int - n, err = proto.BytesMarshal(signatureKeyField, buf[offset:], s.key) - if err != nil { - return nil, err - } - - offset += n - - n, err = proto.BytesMarshal(signatureValueField, buf[offset:], s.sign) - if err != nil { - return nil, err - } - - offset += n - - _, err = proto.EnumMarshal(signatureSchemeField, buf[offset:], int32(s.scheme)) - if err != nil { - return nil, err - } + offset += proto.BytesMarshal(signatureKeyField, buf[offset:], s.key) + offset += proto.BytesMarshal(signatureValueField, buf[offset:], s.sign) + proto.EnumMarshal(signatureSchemeField, buf[offset:], int32(s.scheme)) return buf, nil } @@ -291,22 +252,10 @@ func (v *Version) StableMarshal(buf []byte) ([]byte, error) { buf = make([]byte, v.StableSize()) } - var ( - offset, n int - err error - ) + var offset int - n, err = proto.UInt32Marshal(versionMajorField, buf[offset:], v.major) - if err != nil { - return nil, err - } - - offset += n - - _, err = proto.UInt32Marshal(versionMinorField, buf[offset:], v.minor) - if err != nil { - return nil, err - } + offset += proto.UInt32Marshal(versionMajorField, buf[offset:], v.major) + proto.UInt32Marshal(versionMinorField, buf[offset:], v.minor) return buf, nil } diff --git a/reputation/marshal.go b/reputation/marshal.go index 20d1fd7..789cb14 100644 --- a/reputation/marshal.go +++ b/reputation/marshal.go @@ -20,10 +20,7 @@ func (x *PeerID) StableMarshal(buf []byte) ([]byte, error) { buf = make([]byte, x.StableSize()) } - _, err := protoutil.BytesMarshal(peerIDPubKeyFNum, buf, x.publicKey) - if err != nil { - return nil, err - } + protoutil.BytesMarshal(peerIDPubKeyFNum, buf, x.publicKey) return buf, nil } @@ -65,10 +62,7 @@ func (x *Trust) StableMarshal(buf []byte) ([]byte, error) { offset += n - _, err = protoutil.Float64Marshal(trustValueFNum, buf[offset:], x.val) - if err != nil { - return nil, err - } + protoutil.Float64Marshal(trustValueFNum, buf[offset:], x.val) return buf, nil } @@ -230,12 +224,7 @@ func (x *AnnounceLocalTrustRequestBody) StableMarshal(buf []byte) ([]byte, error err error ) - n, err = protoutil.UInt64Marshal(announceLocalTrustBodyEpochFNum, buf[offset:], x.epoch) - if err != nil { - return nil, err - } - - offset += n + offset += protoutil.UInt64Marshal(announceLocalTrustBodyEpochFNum, buf[offset:], x.epoch) for i := range x.trusts { n, err = protoutil.NestedStructureMarshal(announceLocalTrustBodyTrustsFNum, buf[offset:], &x.trusts[i]) @@ -292,23 +281,12 @@ func (x *AnnounceIntermediateResultRequestBody) StableMarshal(buf []byte) ([]byt } var ( - offset, n int - err error + offset int + err error ) - n, err = protoutil.UInt64Marshal(announceInterResBodyEpochFNum, buf, x.epoch) - if err != nil { - return nil, err - } - - offset += n - - n, err = protoutil.UInt32Marshal(announceInterResBodyIterFNum, buf[offset:], x.iter) - if err != nil { - return nil, err - } - - offset += n + offset += protoutil.UInt64Marshal(announceInterResBodyEpochFNum, buf, x.epoch) + offset += protoutil.UInt32Marshal(announceInterResBodyIterFNum, buf[offset:], x.iter) _, err = protoutil.NestedStructureMarshal(announceInterResBodyTrustFNum, buf[offset:], x.trust) if err != nil { diff --git a/session/marshal.go b/session/marshal.go index a57d1a5..062076d 100644 --- a/session/marshal.go +++ b/session/marshal.go @@ -82,10 +82,7 @@ func (c *CreateRequestBody) StableMarshal(buf []byte) ([]byte, error) { offset += n - _, err = proto.UInt64Marshal(createReqBodyExpirationField, buf[offset:], c.expiration) - if err != nil { - return nil, err - } + proto.UInt64Marshal(createReqBodyExpirationField, buf[offset:], c.expiration) return buf, nil } @@ -114,22 +111,10 @@ func (c *CreateResponseBody) StableMarshal(buf []byte) ([]byte, error) { buf = make([]byte, c.StableSize()) } - var ( - offset, n int - err error - ) + var offset int - n, err = proto.BytesMarshal(createRespBodyIDField, buf[offset:], c.id) - if err != nil { - return nil, err - } - - offset += n - - _, err = proto.BytesMarshal(createRespBodyKeyField, buf[offset:], c.sessionKey) - if err != nil { - return nil, err - } + offset += proto.BytesMarshal(createRespBodyIDField, buf[offset:], c.id) + proto.BytesMarshal(createRespBodyKeyField, buf[offset:], c.sessionKey) return buf, nil } @@ -158,22 +143,10 @@ func (x *XHeader) StableMarshal(buf []byte) ([]byte, error) { buf = make([]byte, x.StableSize()) } - var ( - offset, n int - err error - ) + var offset int - n, err = proto.StringMarshal(xheaderKeyField, buf[offset:], x.key) - if err != nil { - return nil, err - } - - offset += n - - _, err = proto.StringMarshal(xheaderValueField, buf[offset:], x.val) - if err != nil { - return nil, err - } + offset += proto.StringMarshal(xheaderKeyField, buf[offset:], x.key) + proto.StringMarshal(xheaderValueField, buf[offset:], x.val) return buf, nil } @@ -207,29 +180,11 @@ func (l *TokenLifetime) StableMarshal(buf []byte) ([]byte, error) { buf = make([]byte, l.StableSize()) } - var ( - offset, n int - err error - ) + var offset int - n, err = proto.UInt64Marshal(lifetimeExpirationField, buf[offset:], l.exp) - if err != nil { - return nil, err - } - - offset += n - - n, err = proto.UInt64Marshal(lifetimeNotValidBeforeField, buf[offset:], l.nbf) - if err != nil { - return nil, err - } - - offset += n - - _, err = proto.UInt64Marshal(lifetimeIssuedAtField, buf[offset:], l.iat) - if err != nil { - return nil, err - } + offset += proto.UInt64Marshal(lifetimeExpirationField, buf[offset:], l.exp) + offset += proto.UInt64Marshal(lifetimeNotValidBeforeField, buf[offset:], l.nbf) + proto.UInt64Marshal(lifetimeIssuedAtField, buf[offset:], l.iat) return buf, nil } @@ -264,22 +219,10 @@ func (c *ObjectSessionContext) StableMarshal(buf []byte) ([]byte, error) { buf = make([]byte, c.StableSize()) } - var ( - offset, n int - err error - ) + var offset int - n, err = proto.EnumMarshal(objectCtxVerbField, buf[offset:], int32(c.verb)) - if err != nil { - return nil, err - } - - offset += n - - _, err = proto.NestedStructureMarshal(objectCtxAddressField, buf[offset:], c.addr) - if err != nil { - return nil, err - } + offset += proto.EnumMarshal(objectCtxVerbField, buf[offset:], int32(c.verb)) + proto.NestedStructureMarshal(objectCtxAddressField, buf[offset:], c.addr) return buf, nil } @@ -320,29 +263,11 @@ func (x *ContainerSessionContext) StableMarshal(buf []byte) ([]byte, error) { buf = make([]byte, x.StableSize()) } - var ( - offset, n int - err error - ) + var offset int - n, err = proto.EnumMarshal(cnrCtxVerbFNum, buf[offset:], int32(ContainerSessionVerbToGRPCField(x.verb))) - if err != nil { - return nil, err - } - - offset += n - - n, err = proto.BoolMarshal(cnrCtxWildcardFNum, buf[offset:], x.wildcard) - if err != nil { - return nil, err - } - - offset += n - - _, err = proto.NestedStructureMarshal(cnrCtxCidFNum, buf[offset:], x.cid) - if err != nil { - return nil, err - } + offset += proto.EnumMarshal(cnrCtxVerbFNum, buf[offset:], int32(ContainerSessionVerbToGRPCField(x.verb))) + offset += proto.BoolMarshal(cnrCtxWildcardFNum, buf[offset:], x.wildcard) + proto.NestedStructureMarshal(cnrCtxCidFNum, buf[offset:], x.cid) return buf, nil } @@ -377,12 +302,7 @@ func (t *TokenBody) StableMarshal(buf []byte) ([]byte, error) { err error ) - n, err = proto.BytesMarshal(sessionTokenBodyIDField, buf[offset:], t.id) - if err != nil { - return nil, err - } - - offset += n + offset += proto.BytesMarshal(sessionTokenBodyIDField, buf[offset:], t.id) n, err = proto.NestedStructureMarshal(sessionTokenBodyOwnerField, buf[offset:], t.ownerID) if err != nil { @@ -398,12 +318,7 @@ func (t *TokenBody) StableMarshal(buf []byte) ([]byte, error) { offset += n - n, err = proto.BytesMarshal(sessionTokenBodyKeyField, buf[offset:], t.sessionKey) - if err != nil { - return nil, err - } - - offset += n + offset += proto.BytesMarshal(sessionTokenBodyKeyField, buf[offset:], t.sessionKey) if t.ctx != nil { switch v := t.ctx.(type) { @@ -528,19 +443,8 @@ func (r *RequestMetaHeader) StableMarshal(buf []byte) ([]byte, error) { offset += n - n, err = proto.UInt64Marshal(reqMetaHeaderEpochField, buf[offset:], r.epoch) - if err != nil { - return nil, err - } - - offset += n - - n, err = proto.UInt32Marshal(reqMetaHeaderTTLField, buf[offset:], r.ttl) - if err != nil { - return nil, err - } - - offset += n + offset += proto.UInt64Marshal(reqMetaHeaderEpochField, buf[offset:], r.epoch) + offset += proto.UInt32Marshal(reqMetaHeaderTTLField, buf[offset:], r.ttl) for i := range r.xHeaders { n, err = proto.NestedStructureMarshal(reqMetaHeaderXHeadersField, buf[offset:], &r.xHeaders[i]) @@ -572,10 +476,7 @@ func (r *RequestMetaHeader) StableMarshal(buf []byte) ([]byte, error) { offset += n - _, err = proto.UInt64Marshal(reqMetaHeaderNetMagicField, buf[offset:], r.netMagic) - if err != nil { - return nil, err - } + proto.UInt64Marshal(reqMetaHeaderNetMagicField, buf[offset:], r.netMagic) return buf, nil } @@ -699,19 +600,8 @@ func (r *ResponseMetaHeader) StableMarshal(buf []byte) ([]byte, error) { offset += n - n, err = proto.UInt64Marshal(respMetaHeaderEpochField, buf[offset:], r.epoch) - if err != nil { - return nil, err - } - - offset += n - - n, err = proto.UInt32Marshal(respMetaHeaderTTLField, buf[offset:], r.ttl) - if err != nil { - return nil, err - } - - offset += n + offset += proto.UInt64Marshal(respMetaHeaderEpochField, buf[offset:], r.epoch) + offset += proto.UInt32Marshal(respMetaHeaderTTLField, buf[offset:], r.ttl) for i := range r.xHeaders { n, err = proto.NestedStructureMarshal(respMetaHeaderXHeadersField, buf[offset:], &r.xHeaders[i]) diff --git a/status/marshal.go b/status/marshal.go index 5e04f24..1500198 100644 --- a/status/marshal.go +++ b/status/marshal.go @@ -21,22 +21,10 @@ func (x *Detail) StableMarshal(buf []byte) ([]byte, error) { buf = make([]byte, x.StableSize()) } - var ( - offset, n int - err error - ) + var offset int - n, err = protoutil.UInt32Marshal(detailIDFNum, buf[offset:], x.id) - if err != nil { - return nil, err - } - - offset += n - - _, err = protoutil.BytesMarshal(detailValueFNum, buf[offset:], x.val) - if err != nil { - return nil, err - } + offset += protoutil.UInt32Marshal(detailIDFNum, buf[offset:], x.id) + offset += protoutil.BytesMarshal(detailValueFNum, buf[offset:], x.val) return buf, nil } @@ -73,20 +61,16 @@ func (x *Status) StableMarshal(buf []byte) ([]byte, error) { err error ) - n, err = protoutil.UInt32Marshal(statusCodeFNum, buf[offset:], CodeToGRPC(x.code)) + offset += protoutil.UInt32Marshal(statusCodeFNum, buf[offset:], CodeToGRPC(x.code)) if err != nil { return nil, err } - offset += n - - n, err = protoutil.StringMarshal(statusMsgFNum, buf[offset:], x.msg) + offset += protoutil.StringMarshal(statusMsgFNum, buf[offset:], x.msg) if err != nil { return nil, err } - offset += n - for i := range x.details { n, err = protoutil.NestedStructureMarshal(statusDetailsFNum, buf[offset:], &x.details[i]) if err != nil { diff --git a/storagegroup/marshal.go b/storagegroup/marshal.go index 534f6f7..d5e60c1 100644 --- a/storagegroup/marshal.go +++ b/storagegroup/marshal.go @@ -30,12 +30,7 @@ func (s *StorageGroup) StableMarshal(buf []byte) ([]byte, error) { err error ) - n, err = proto.UInt64Marshal(sizeField, buf[offset:], s.size) - if err != nil { - return nil, err - } - - offset += n + offset += proto.UInt64Marshal(sizeField, buf[offset:], s.size) n, err = proto.NestedStructureMarshal(hashField, buf[offset:], s.hash) if err != nil { @@ -44,12 +39,7 @@ func (s *StorageGroup) StableMarshal(buf []byte) ([]byte, error) { offset += n - n, err = proto.UInt64Marshal(expirationField, buf[offset:], s.exp) - if err != nil { - return nil, err - } - - offset += n + offset += proto.UInt64Marshal(expirationField, buf[offset:], s.exp) _, err = refs.ObjectIDNestedListMarshal(objectIDsField, buf[offset:], s.members) if err != nil { diff --git a/tombstone/marshal.go b/tombstone/marshal.go index cd778b9..f2f896a 100644 --- a/tombstone/marshal.go +++ b/tombstone/marshal.go @@ -28,19 +28,8 @@ func (s *Tombstone) StableMarshal(buf []byte) ([]byte, error) { err error ) - n, err = proto.UInt64Marshal(expFNum, buf[offset:], s.exp) - if err != nil { - return nil, err - } - - offset += n - - n, err = proto.BytesMarshal(splitIDFNum, buf[offset:], s.splitID) - if err != nil { - return nil, err - } - - offset += n + offset += proto.UInt64Marshal(expFNum, buf[offset:], s.exp) + offset += proto.BytesMarshal(splitIDFNum, buf[offset:], s.splitID) for i := range s.members { n, err = proto.NestedStructureMarshal(membersFNum, buf[offset:], &s.members[i]) diff --git a/util/proto/marshal.go b/util/proto/marshal.go index 21e8013..a1bb1e9 100644 --- a/util/proto/marshal.go +++ b/util/proto/marshal.go @@ -20,9 +20,9 @@ type ( } ) -func BytesMarshal(field int, buf, v []byte) (int, error) { +func BytesMarshal(field int, buf, v []byte) int { if len(v) == 0 { - return 0, nil + return 0 } prefix := field<<3 | 0x2 @@ -33,7 +33,7 @@ func BytesMarshal(field int, buf, v []byte) (int, error) { i += binary.PutUvarint(buf[i:], uint64(len(v))) i += copy(buf[i:], v) - return i, nil + return i } func BytesSize(field int, v []byte) int { @@ -47,7 +47,7 @@ func BytesSize(field int, v []byte) int { return VarUIntSize(uint64(prefix)) + VarUIntSize(uint64(ln)) + ln } -func StringMarshal(field int, buf []byte, v string) (int, error) { +func StringMarshal(field int, buf []byte, v string) int { return BytesMarshal(field, buf, []byte(v)) } @@ -55,9 +55,9 @@ func StringSize(field int, v string) int { return BytesSize(field, []byte(v)) } -func BoolMarshal(field int, buf []byte, v bool) (int, error) { +func BoolMarshal(field int, buf []byte, v bool) int { if !v { - return 0, nil + return 0 } prefix := field << 3 @@ -67,7 +67,7 @@ func BoolMarshal(field int, buf []byte, v bool) (int, error) { i := binary.PutUvarint(buf, uint64(prefix)) buf[i] = 0x1 - return i + 1, nil + return i + 1 } func BoolSize(field int, v bool) int { @@ -80,9 +80,9 @@ func BoolSize(field int, v bool) int { return VarUIntSize(uint64(prefix)) + 1 // bool is always 1 byte long } -func UInt64Marshal(field int, buf []byte, v uint64) (int, error) { +func UInt64Marshal(field int, buf []byte, v uint64) int { if v == 0 { - return 0, nil + return 0 } prefix := field << 3 @@ -92,7 +92,7 @@ func UInt64Marshal(field int, buf []byte, v uint64) (int, error) { i := binary.PutUvarint(buf, uint64(prefix)) i += binary.PutUvarint(buf[i:], v) - return i, nil + return i } func UInt64Size(field int, v uint64) int { @@ -105,7 +105,7 @@ func UInt64Size(field int, v uint64) int { return VarUIntSize(uint64(prefix)) + VarUIntSize(v) } -func Int64Marshal(field int, buf []byte, v int64) (int, error) { +func Int64Marshal(field int, buf []byte, v int64) int { return UInt64Marshal(field, buf, uint64(v)) } @@ -113,7 +113,7 @@ func Int64Size(field int, v int64) int { return UInt64Size(field, uint64(v)) } -func UInt32Marshal(field int, buf []byte, v uint32) (int, error) { +func UInt32Marshal(field int, buf []byte, v uint32) int { return UInt64Marshal(field, buf, uint64(v)) } @@ -121,7 +121,7 @@ func UInt32Size(field int, v uint32) int { return UInt64Size(field, uint64(v)) } -func Int32Marshal(field int, buf []byte, v int32) (int, error) { +func Int32Marshal(field int, buf []byte, v int32) int { return UInt64Marshal(field, buf, uint64(v)) } @@ -129,7 +129,7 @@ func Int32Size(field int, v int32) int { return UInt64Size(field, uint64(v)) } -func EnumMarshal(field int, buf []byte, v int32) (int, error) { +func EnumMarshal(field int, buf []byte, v int32) int { return UInt64Marshal(field, buf, uint64(v)) } @@ -137,19 +137,14 @@ func EnumSize(field int, v int32) int { return UInt64Size(field, uint64(v)) } -func RepeatedBytesMarshal(field int, buf []byte, v [][]byte) (int, error) { +func RepeatedBytesMarshal(field int, buf []byte, v [][]byte) int { var offset int for i := range v { - off, err := BytesMarshal(field, buf[offset:], v[i]) - if err != nil { - return 0, err - } - - offset += off + offset += BytesMarshal(field, buf[offset:], v[i]) } - return offset, nil + return offset } func RepeatedBytesSize(field int, v [][]byte) (size int) { @@ -160,19 +155,14 @@ func RepeatedBytesSize(field int, v [][]byte) (size int) { return size } -func RepeatedStringMarshal(field int, buf []byte, v []string) (int, error) { +func RepeatedStringMarshal(field int, buf []byte, v []string) int { var offset int for i := range v { - off, err := StringMarshal(field, buf[offset:], v[i]) - if err != nil { - return 0, err - } - - offset += off + offset += StringMarshal(field, buf[offset:], v[i]) } - return offset, nil + return offset } func RepeatedStringSize(field int, v []string) (size int) { @@ -183,9 +173,9 @@ func RepeatedStringSize(field int, v []string) (size int) { return size } -func RepeatedUInt64Marshal(field int, buf []byte, v []uint64) (int, error) { +func RepeatedUInt64Marshal(field int, buf []byte, v []uint64) int { if len(v) == 0 { - return 0, nil + return 0 } prefix := field<<3 | 0x02 @@ -197,7 +187,7 @@ func RepeatedUInt64Marshal(field int, buf []byte, v []uint64) (int, error) { offset += binary.PutUvarint(buf[offset:], v[i]) } - return offset, nil + return offset } func RepeatedUInt64Size(field int, v []uint64) (size, arraySize int) { @@ -218,9 +208,9 @@ func RepeatedUInt64Size(field int, v []uint64) (size, arraySize int) { return size, arraySize } -func RepeatedInt64Marshal(field int, buf []byte, v []int64) (int, error) { +func RepeatedInt64Marshal(field int, buf []byte, v []int64) int { if len(v) == 0 { - return 0, nil + return 0 } convert := make([]uint64, len(v)) @@ -244,9 +234,9 @@ func RepeatedInt64Size(field int, v []int64) (size, arraySize int) { return RepeatedUInt64Size(field, convert) } -func RepeatedUInt32Marshal(field int, buf []byte, v []uint32) (int, error) { +func RepeatedUInt32Marshal(field int, buf []byte, v []uint32) int { if len(v) == 0 { - return 0, nil + return 0 } convert := make([]uint64, len(v)) @@ -270,9 +260,9 @@ func RepeatedUInt32Size(field int, v []uint32) (size, arraySize int) { return RepeatedUInt64Size(field, convert) } -func RepeatedInt32Marshal(field int, buf []byte, v []int32) (int, error) { +func RepeatedInt32Marshal(field int, buf []byte, v []int32) int { if len(v) == 0 { - return 0, nil + return 0 } convert := make([]uint64, len(v)) @@ -337,9 +327,9 @@ func NestedStructureSize(field int64, v stableMarshaller) (size int) { return size } -func Fixed64Marshal(field int, buf []byte, v uint64) (int, error) { +func Fixed64Marshal(field int, buf []byte, v uint64) int { if v == 0 { - return 0, nil + return 0 } prefix := field<<3 | 1 @@ -349,7 +339,7 @@ func Fixed64Marshal(field int, buf []byte, v uint64) (int, error) { i := binary.PutUvarint(buf, uint64(prefix)) binary.LittleEndian.PutUint64(buf[i:], v) - return i + 8, nil + return i + 8 } func Fixed64Size(fNum int, v uint64) int { @@ -362,9 +352,9 @@ func Fixed64Size(fNum int, v uint64) int { return VarUIntSize(uint64(prefix)) + 8 } -func Float64Marshal(field int, buf []byte, v float64) (int, error) { +func Float64Marshal(field int, buf []byte, v float64) int { if v == 0 { - return 0, nil + return 0 } prefix := field<<3 | 1 @@ -372,7 +362,7 @@ func Float64Marshal(field int, buf []byte, v float64) (int, error) { i := binary.PutUvarint(buf, uint64(prefix)) binary.LittleEndian.PutUint64(buf[i:], math.Float64bits(v)) - return i + 8, nil + return i + 8 } func Float64Size(fNum int, v float64) int { diff --git a/util/proto/marshal_test.go b/util/proto/marshal_test.go index a3f6882..e19f4ee 100644 --- a/util/proto/marshal_test.go +++ b/util/proto/marshal_test.go @@ -1,7 +1,6 @@ package proto_test import ( - "fmt" "math" "testing" @@ -59,91 +58,55 @@ func (s *stablePrimitives) stableMarshal(buf []byte, wrongField bool) ([]byte, e if wrongField { fieldNum++ } - offset, err := proto.BytesMarshal(fieldNum, buf, s.FieldA) - if err != nil { - return nil, fmt.Errorf("can't marshal field a: %w", err) - } - i += offset + i += proto.BytesMarshal(fieldNum, buf, s.FieldA) fieldNum = 2 if wrongField { fieldNum++ } - offset, err = proto.StringMarshal(fieldNum, buf, s.FieldB) - if err != nil { - return nil, fmt.Errorf("can't marshal field b: %w", err) - } - i += offset + i += proto.StringMarshal(fieldNum, buf, s.FieldB) fieldNum = 200 if wrongField { fieldNum++ } - offset, err = proto.BoolMarshal(fieldNum, buf, s.FieldC) - if err != nil { - return nil, fmt.Errorf("can't marshal field c: %w", err) - } - i += offset + i += proto.BoolMarshal(fieldNum, buf, s.FieldC) fieldNum = 201 if wrongField { fieldNum++ } - offset, err = proto.Int32Marshal(fieldNum, buf, s.FieldD) - if err != nil { - return nil, fmt.Errorf("can't marshal field d: %w", err) - } - i += offset + i += proto.Int32Marshal(fieldNum, buf, s.FieldD) fieldNum = 202 if wrongField { fieldNum++ } - offset, err = proto.UInt32Marshal(fieldNum, buf, s.FieldE) - if err != nil { - return nil, fmt.Errorf("can't marshal field e: %w", err) - } - i += offset + i += proto.UInt32Marshal(fieldNum, buf, s.FieldE) fieldNum = 203 if wrongField { fieldNum++ } - offset, err = proto.Int64Marshal(fieldNum, buf, s.FieldF) - if err != nil { - return nil, fmt.Errorf("can't marshal field f: %w", err) - } - i += offset + i += proto.Int64Marshal(fieldNum, buf, s.FieldF) fieldNum = 204 if wrongField { fieldNum++ } - offset, err = proto.UInt64Marshal(fieldNum, buf, s.FieldG) - if err != nil { - return nil, fmt.Errorf("can't marshal field g: %w", err) - } - i += offset + i += proto.UInt64Marshal(fieldNum, buf, s.FieldG) fieldNum = 205 if wrongField { fieldNum++ } - offset, err = proto.Fixed64Marshal(fieldNum, buf, s.FieldI) - if err != nil { - return nil, fmt.Errorf("can't marshal field I: %w", err) - } - i += offset + i += proto.Fixed64Marshal(fieldNum, buf, s.FieldI) fieldNum = 206 if wrongField { fieldNum++ } - offset, err = proto.Float64Marshal(fieldNum, buf, s.FieldJ) - if err != nil { - return nil, fmt.Errorf("can't marshal field J: %w", err) - } - i += offset + i += proto.Float64Marshal(fieldNum, buf, s.FieldJ) fieldNum = 207 if wrongField { @@ -158,11 +121,7 @@ func (s *stablePrimitives) stableMarshal(buf []byte, wrongField bool) ([]byte, e if wrongField { fieldNum++ } - offset, err = proto.EnumMarshal(fieldNum, buf, int32(s.FieldH)) - if err != nil { - return nil, fmt.Errorf("can't marshal field h: %w", err) - } - i += offset + i += proto.EnumMarshal(fieldNum, buf, int32(s.FieldH)) return buf, nil } @@ -190,69 +149,43 @@ func (s *stableRepPrimitives) stableMarshal(buf []byte, wrongField bool) ([]byte buf = make([]byte, s.stableSize()) } - var ( - i, offset, fieldNum int - ) + var i, fieldNum int fieldNum = 1 if wrongField { fieldNum++ } - offset, err := proto.RepeatedBytesMarshal(fieldNum, buf, s.FieldA) - if err != nil { - return nil, fmt.Errorf("can't marshal field a: %w", err) - } - i += offset + i += proto.RepeatedBytesMarshal(fieldNum, buf, s.FieldA) fieldNum = 2 if wrongField { fieldNum++ } - offset, err = proto.RepeatedStringMarshal(fieldNum, buf, s.FieldB) - if err != nil { - return nil, fmt.Errorf("can't marshal field b: %w", err) - } - i += offset + i += proto.RepeatedStringMarshal(fieldNum, buf, s.FieldB) fieldNum = 3 if wrongField { fieldNum++ } - offset, err = proto.RepeatedInt32Marshal(fieldNum, buf, s.FieldC) - if err != nil { - return nil, fmt.Errorf("can't marshal field c: %w", err) - } - i += offset + i += proto.RepeatedInt32Marshal(fieldNum, buf, s.FieldC) fieldNum = 4 if wrongField { fieldNum++ } - offset, err = proto.RepeatedUInt32Marshal(fieldNum, buf, s.FieldD) - if err != nil { - return nil, fmt.Errorf("can't marshal field d: %w", err) - } - i += offset + i += proto.RepeatedUInt32Marshal(fieldNum, buf, s.FieldD) fieldNum = 5 if wrongField { fieldNum++ } - offset, err = proto.RepeatedInt64Marshal(fieldNum, buf, s.FieldE) - if err != nil { - return nil, fmt.Errorf("can't marshal field e: %w", err) - } - i += offset + i += proto.RepeatedInt64Marshal(fieldNum, buf, s.FieldE) fieldNum = 6 if wrongField { fieldNum++ } - offset, err = proto.RepeatedUInt64Marshal(fieldNum, buf, s.FieldF) - if err != nil { - return nil, fmt.Errorf("can't marshal field f: %w", err) - } - i += offset + i += proto.RepeatedUInt64Marshal(fieldNum, buf, s.FieldF) return buf, nil } From 94f068e462fe249d1633f5913a3f84680007b721 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Tue, 5 Apr 2022 11:24:34 +0300 Subject: [PATCH 0983/1196] *: remove error from `StableMarshal` return values We marshal only in-memory structures, no error is expected. Signed-off-by: Evgenii Stratonikov --- accounting/marshal.go | 28 +- acl/marshal.go | 132 +++------- audit/marshal.go | 45 +--- container/marshal.go | 288 ++++++-------------- netmap/marshal.go | 175 ++++--------- object/lock.go | 22 +- object/marshal.go | 564 ++++++++++------------------------------ refs/bench_test.go | 4 +- refs/marshal.go | 78 +++--- reputation/marshal.go | 127 +++------ session/marshal.go | 280 +++++--------------- signature/sign.go | 4 +- status/marshal.go | 33 +-- storagegroup/marshal.go | 26 +- subnet/info.go | 24 +- tombstone/marshal.go | 18 +- util/proto/marshal.go | 14 +- 17 files changed, 504 insertions(+), 1358 deletions(-) diff --git a/accounting/marshal.go b/accounting/marshal.go index 0d908c0..f5265b1 100644 --- a/accounting/marshal.go +++ b/accounting/marshal.go @@ -15,9 +15,9 @@ const ( balanceRespBodyDecimalField = 1 ) -func (d *Decimal) StableMarshal(buf []byte) ([]byte, error) { +func (d *Decimal) StableMarshal(buf []byte) []byte { if d == nil { - return []byte{}, nil + return []byte{} } if buf == nil { @@ -29,7 +29,7 @@ func (d *Decimal) StableMarshal(buf []byte) ([]byte, error) { offset += protoutil.Int64Marshal(decimalValueField, buf[offset:], d.val) protoutil.UInt32Marshal(decimalPrecisionField, buf[offset:], d.prec) - return buf, nil + return buf } func (d *Decimal) StableSize() (size int) { @@ -47,21 +47,18 @@ func (d *Decimal) Unmarshal(data []byte) error { return message.Unmarshal(d, data, new(accounting.Decimal)) } -func (b *BalanceRequestBody) StableMarshal(buf []byte) ([]byte, error) { +func (b *BalanceRequestBody) StableMarshal(buf []byte) []byte { if b == nil { - return []byte{}, nil + return []byte{} } if buf == nil { buf = make([]byte, b.StableSize()) } - _, err := protoutil.NestedStructureMarshal(balanceReqBodyOwnerField, buf, b.ownerID) - if err != nil { - return nil, err - } + protoutil.NestedStructureMarshal(balanceReqBodyOwnerField, buf, b.ownerID) - return buf, nil + return buf } func (b *BalanceRequestBody) StableSize() (size int) { @@ -78,21 +75,18 @@ func (b *BalanceRequestBody) Unmarshal(data []byte) error { return message.Unmarshal(b, data, new(accounting.BalanceRequest_Body)) } -func (br *BalanceResponseBody) StableMarshal(buf []byte) ([]byte, error) { +func (br *BalanceResponseBody) StableMarshal(buf []byte) []byte { if br == nil { - return []byte{}, nil + return []byte{} } if buf == nil { buf = make([]byte, br.StableSize()) } - _, err := protoutil.NestedStructureMarshal(balanceRespBodyDecimalField, buf, br.bal) - if err != nil { - return nil, err - } + protoutil.NestedStructureMarshal(balanceRespBodyDecimalField, buf, br.bal) - return buf, nil + return buf } func (br *BalanceResponseBody) StableSize() (size int) { diff --git a/acl/marshal.go b/acl/marshal.go index 11c6174..87d476d 100644 --- a/acl/marshal.go +++ b/acl/marshal.go @@ -38,44 +38,25 @@ const ( // StableMarshal marshals unified acl table structure in a protobuf // compatible way without field order shuffle. -func (t *Table) StableMarshal(buf []byte) ([]byte, error) { +func (t *Table) StableMarshal(buf []byte) []byte { if t == nil { - return []byte{}, nil + return []byte{} } if buf == nil { buf = make([]byte, t.StableSize()) } - var ( - offset, n int - err error - ) + var offset int - n, err = protoutil.NestedStructureMarshal(tableVersionField, buf[offset:], t.version) - if err != nil { - return nil, err - } - - offset += n - - n, err = protoutil.NestedStructureMarshal(tableContainerIDField, buf[offset:], t.cid) - if err != nil { - return nil, err - } - - offset += n + offset += protoutil.NestedStructureMarshal(tableVersionField, buf[offset:], t.version) + offset += protoutil.NestedStructureMarshal(tableContainerIDField, buf[offset:], t.cid) for i := range t.records { - n, err = protoutil.NestedStructureMarshal(tableRecordsField, buf[offset:], &t.records[i]) - if err != nil { - return nil, err - } - - offset += n + offset += protoutil.NestedStructureMarshal(tableRecordsField, buf[offset:], &t.records[i]) } - return buf, nil + return buf } // StableSize of acl table structure marshalled by StableMarshal function. @@ -100,42 +81,29 @@ func (t *Table) Unmarshal(data []byte) error { // StableMarshal marshals unified acl record structure in a protobuf // compatible way without field order shuffle. -func (r *Record) StableMarshal(buf []byte) ([]byte, error) { +func (r *Record) StableMarshal(buf []byte) []byte { if r == nil { - return []byte{}, nil + return []byte{} } if buf == nil { buf = make([]byte, r.StableSize()) } - var ( - offset, n int - err error - ) + var offset int offset += protoutil.EnumMarshal(recordOperationField, buf[offset:], int32(r.op)) offset += protoutil.EnumMarshal(recordActionField, buf[offset:], int32(r.action)) for i := range r.filters { - n, err = protoutil.NestedStructureMarshal(recordFiltersField, buf[offset:], &r.filters[i]) - if err != nil { - return nil, err - } - - offset += n + offset += protoutil.NestedStructureMarshal(recordFiltersField, buf[offset:], &r.filters[i]) } for i := range r.targets { - n, err = protoutil.NestedStructureMarshal(recordTargetsField, buf[offset:], &r.targets[i]) - if err != nil { - return nil, err - } - - offset += n + offset += protoutil.NestedStructureMarshal(recordTargetsField, buf[offset:], &r.targets[i]) } - return buf, nil + return buf } // StableSize of acl record structure marshalled by StableMarshal function. @@ -164,9 +132,9 @@ func (r *Record) Unmarshal(data []byte) error { // StableMarshal marshals unified header filter structure in a protobuf // compatible way without field order shuffle. -func (f *HeaderFilter) StableMarshal(buf []byte) ([]byte, error) { +func (f *HeaderFilter) StableMarshal(buf []byte) []byte { if f == nil { - return []byte{}, nil + return []byte{} } if buf == nil { @@ -180,7 +148,7 @@ func (f *HeaderFilter) StableMarshal(buf []byte) ([]byte, error) { offset += protoutil.StringMarshal(filterNameField, buf[offset:], f.key) protoutil.StringMarshal(filterValueField, buf[offset:], f.value) - return buf, nil + return buf } // StableSize of header filter structure marshalled by StableMarshal function. @@ -203,9 +171,9 @@ func (f *HeaderFilter) Unmarshal(data []byte) error { // StableMarshal marshals unified role info structure in a protobuf // compatible way without field order shuffle. -func (t *Target) StableMarshal(buf []byte) ([]byte, error) { +func (t *Target) StableMarshal(buf []byte) []byte { if t == nil { - return []byte{}, nil + return []byte{} } if buf == nil { @@ -217,7 +185,7 @@ func (t *Target) StableMarshal(buf []byte) ([]byte, error) { offset += protoutil.EnumMarshal(targetTypeField, buf[offset:], int32(t.role)) protoutil.RepeatedBytesMarshal(targetKeysField, buf[offset:], t.keys) - return buf, nil + return buf } // StableSize of role info structure marshalled by StableMarshal function. @@ -236,9 +204,9 @@ func (t *Target) Unmarshal(data []byte) error { return message.Unmarshal(t, data, new(acl.EACLRecord_Target)) } -func (l *TokenLifetime) StableMarshal(buf []byte) ([]byte, error) { +func (l *TokenLifetime) StableMarshal(buf []byte) []byte { if l == nil { - return []byte{}, nil + return []byte{} } if buf == nil { @@ -251,7 +219,7 @@ func (l *TokenLifetime) StableMarshal(buf []byte) ([]byte, error) { offset += protoutil.UInt64Marshal(lifetimeNotValidBeforeField, buf[offset:], l.nbf) protoutil.UInt64Marshal(lifetimeIssuedAtField, buf[offset:], l.iat) - return buf, nil + return buf } func (l *TokenLifetime) StableSize() (size int) { @@ -270,40 +238,22 @@ func (l *TokenLifetime) Unmarshal(data []byte) error { return message.Unmarshal(l, data, new(acl.BearerToken_Body_TokenLifetime)) } -func (bt *BearerTokenBody) StableMarshal(buf []byte) ([]byte, error) { +func (bt *BearerTokenBody) StableMarshal(buf []byte) []byte { if bt == nil { - return []byte{}, nil + return []byte{} } if buf == nil { buf = make([]byte, bt.StableSize()) } - var ( - offset, n int - err error - ) + var offset int - n, err = protoutil.NestedStructureMarshal(bearerTokenBodyACLField, buf[offset:], bt.eacl) - if err != nil { - return nil, err - } + offset += protoutil.NestedStructureMarshal(bearerTokenBodyACLField, buf[offset:], bt.eacl) + offset += protoutil.NestedStructureMarshal(bearerTokenBodyOwnerField, buf[offset:], bt.ownerID) + protoutil.NestedStructureMarshal(bearerTokenBodyLifetimeField, buf[offset:], bt.lifetime) - offset += n - - n, err = protoutil.NestedStructureMarshal(bearerTokenBodyOwnerField, buf[offset:], bt.ownerID) - if err != nil { - return nil, err - } - - offset += n - - _, err = protoutil.NestedStructureMarshal(bearerTokenBodyLifetimeField, buf[offset:], bt.lifetime) - if err != nil { - return nil, err - } - - return buf, nil + return buf } func (bt *BearerTokenBody) StableSize() (size int) { @@ -322,33 +272,21 @@ func (bt *BearerTokenBody) Unmarshal(data []byte) error { return message.Unmarshal(bt, data, new(acl.BearerToken_Body)) } -func (bt *BearerToken) StableMarshal(buf []byte) ([]byte, error) { +func (bt *BearerToken) StableMarshal(buf []byte) []byte { if bt == nil { - return []byte{}, nil + return []byte{} } if buf == nil { buf = make([]byte, bt.StableSize()) } - var ( - offset, n int - err error - ) + var offset int - n, err = protoutil.NestedStructureMarshal(bearerTokenBodyField, buf[offset:], bt.body) - if err != nil { - return nil, err - } + offset += protoutil.NestedStructureMarshal(bearerTokenBodyField, buf[offset:], bt.body) + protoutil.NestedStructureMarshal(bearerTokenSignatureField, buf[offset:], bt.sig) - offset += n - - _, err = protoutil.NestedStructureMarshal(bearerTokenSignatureField, buf[offset:], bt.sig) - if err != nil { - return nil, err - } - - return buf, nil + return buf } func (bt *BearerToken) StableSize() (size int) { diff --git a/audit/marshal.go b/audit/marshal.go index 02633a4..c97fb4e 100644 --- a/audit/marshal.go +++ b/audit/marshal.go @@ -27,62 +27,33 @@ const ( // StableMarshal marshals unified DataAuditResult structure into a protobuf // binary format without field order shuffle. -func (a *DataAuditResult) StableMarshal(buf []byte) ([]byte, error) { +func (a *DataAuditResult) StableMarshal(buf []byte) []byte { if a == nil { - return []byte{}, nil + return []byte{} } if buf == nil { buf = make([]byte, a.StableSize()) } - var ( - offset, n int - err error - ) - - n, err = proto.NestedStructureMarshal(versionFNum, buf[offset:], a.version) - if err != nil { - return nil, err - } - - offset += n + var offset int + offset += proto.NestedStructureMarshal(versionFNum, buf[offset:], a.version) offset += proto.Fixed64Marshal(auditEpochFNum, buf[offset:], a.auditEpoch) - - n, err = proto.NestedStructureMarshal(cidFNum, buf[offset:], a.cid) - if err != nil { - return nil, err - } - - offset += n - + offset += proto.NestedStructureMarshal(cidFNum, buf[offset:], a.cid) offset += proto.BytesMarshal(pubKeyFNum, buf[offset:], a.pubKey) offset += proto.BoolMarshal(completeFNum, buf[offset:], a.complete) offset += proto.UInt32Marshal(requestsFNum, buf[offset:], a.requests) offset += proto.UInt32Marshal(retriesFNum, buf[offset:], a.retries) - - n, err = refs.ObjectIDNestedListMarshal(passSGFNum, buf[offset:], a.passSG) - if err != nil { - return nil, err - } - - offset += n - - n, err = refs.ObjectIDNestedListMarshal(failSGFNum, buf[offset:], a.failSG) - if err != nil { - return nil, err - } - - offset += n - + offset += refs.ObjectIDNestedListMarshal(passSGFNum, buf[offset:], a.passSG) + offset += refs.ObjectIDNestedListMarshal(failSGFNum, buf[offset:], a.failSG) offset += proto.UInt32Marshal(hitFNum, buf[offset:], a.hit) offset += proto.UInt32Marshal(missFNum, buf[offset:], a.miss) offset += proto.UInt32Marshal(failFNum, buf[offset:], a.fail) offset += proto.RepeatedBytesMarshal(passNodesFNum, buf[offset:], a.passNodes) proto.RepeatedBytesMarshal(failNodesFNum, buf[offset:], a.failNodes) - return buf, nil + return buf } // StableSize returns byte length of DataAuditResult structure diff --git a/container/marshal.go b/container/marshal.go index f8a940d..ae1ac78 100644 --- a/container/marshal.go +++ b/container/marshal.go @@ -51,9 +51,9 @@ const ( usedSpaceReqBodyAnnouncementsField = 1 ) -func (a *Attribute) StableMarshal(buf []byte) ([]byte, error) { +func (a *Attribute) StableMarshal(buf []byte) []byte { if a == nil { - return []byte{}, nil + return []byte{} } if buf == nil { @@ -65,7 +65,7 @@ func (a *Attribute) StableMarshal(buf []byte) ([]byte, error) { offset += protoutil.StringMarshal(attributeKeyField, buf[offset:], a.key) protoutil.StringMarshal(attributeValueField, buf[offset:], a.val) - return buf, nil + return buf } func (a *Attribute) StableSize() (size int) { @@ -83,52 +83,29 @@ func (a *Attribute) Unmarshal(data []byte) error { return message.Unmarshal(a, data, new(container.Container_Attribute)) } -func (c *Container) StableMarshal(buf []byte) ([]byte, error) { +func (c *Container) StableMarshal(buf []byte) []byte { if c == nil { - return []byte{}, nil + return []byte{} } if buf == nil { buf = make([]byte, c.StableSize()) } - var ( - offset, n int - err error - ) - - n, err = protoutil.NestedStructureMarshal(containerVersionField, buf[offset:], c.version) - if err != nil { - return nil, err - } - - offset += n - - n, err = protoutil.NestedStructureMarshal(containerOwnerField, buf[offset:], c.ownerID) - if err != nil { - return nil, err - } - - offset += n + var offset int + offset += protoutil.NestedStructureMarshal(containerVersionField, buf[offset:], c.version) + offset += protoutil.NestedStructureMarshal(containerOwnerField, buf[offset:], c.ownerID) offset += protoutil.BytesMarshal(containerNonceField, buf[offset:], c.nonce) offset += protoutil.UInt32Marshal(containerBasicACLField, buf[offset:], c.basicACL) for i := range c.attr { - n, err = protoutil.NestedStructureMarshal(containerAttributesField, buf[offset:], &c.attr[i]) - if err != nil { - return nil, err - } - - offset += n + offset += protoutil.NestedStructureMarshal(containerAttributesField, buf[offset:], &c.attr[i]) } - _, err = protoutil.NestedStructureMarshal(containerPlacementField, buf[offset:], c.policy) - if err != nil { - return nil, err - } + protoutil.NestedStructureMarshal(containerPlacementField, buf[offset:], c.policy) - return buf, nil + return buf } func (c *Container) StableSize() (size int) { @@ -154,33 +131,21 @@ func (c *Container) Unmarshal(data []byte) error { return message.Unmarshal(c, data, new(container.Container)) } -func (r *PutRequestBody) StableMarshal(buf []byte) ([]byte, error) { +func (r *PutRequestBody) StableMarshal(buf []byte) []byte { if r == nil { - return []byte{}, nil + return []byte{} } if buf == nil { buf = make([]byte, r.StableSize()) } - var ( - offset, n int - err error - ) + var offset int - n, err = protoutil.NestedStructureMarshal(putReqBodyContainerField, buf[offset:], r.cnr) - if err != nil { - return nil, err - } + offset += protoutil.NestedStructureMarshal(putReqBodyContainerField, buf[offset:], r.cnr) + protoutil.NestedStructureMarshal(putReqBodySignatureField, buf[offset:], r.sig) - offset += n - - _, err = protoutil.NestedStructureMarshal(putReqBodySignatureField, buf[offset:], r.sig) - if err != nil { - return nil, err - } - - return buf, nil + return buf } func (r *PutRequestBody) StableSize() (size int) { @@ -198,25 +163,18 @@ func (r *PutRequestBody) Unmarshal(data []byte) error { return message.Unmarshal(r, data, new(container.PutRequest_Body)) } -func (r *PutResponseBody) StableMarshal(buf []byte) ([]byte, error) { +func (r *PutResponseBody) StableMarshal(buf []byte) []byte { if r == nil { - return []byte{}, nil + return []byte{} } if buf == nil { buf = make([]byte, r.StableSize()) } - var ( - err error - ) + protoutil.NestedStructureMarshal(putRespBodyIDField, buf, r.cid) - _, err = protoutil.NestedStructureMarshal(putRespBodyIDField, buf, r.cid) - if err != nil { - return nil, err - } - - return buf, nil + return buf } func (r *PutResponseBody) StableSize() (size int) { @@ -233,33 +191,21 @@ func (r *PutResponseBody) Unmarshal(data []byte) error { return message.Unmarshal(r, data, new(container.PutResponse_Body)) } -func (r *DeleteRequestBody) StableMarshal(buf []byte) ([]byte, error) { +func (r *DeleteRequestBody) StableMarshal(buf []byte) []byte { if r == nil { - return []byte{}, nil + return []byte{} } if buf == nil { buf = make([]byte, r.StableSize()) } - var ( - offset, n int - err error - ) + var offset int - n, err = protoutil.NestedStructureMarshal(deleteReqBodyIDField, buf[offset:], r.cid) - if err != nil { - return nil, err - } + offset += protoutil.NestedStructureMarshal(deleteReqBodyIDField, buf[offset:], r.cid) + protoutil.NestedStructureMarshal(deleteReqBodySignatureField, buf[offset:], r.sig) - offset += n - - _, err = protoutil.NestedStructureMarshal(deleteReqBodySignatureField, buf[offset:], r.sig) - if err != nil { - return nil, err - } - - return buf, nil + return buf } func (r *DeleteRequestBody) StableSize() (size int) { @@ -277,8 +223,8 @@ func (r *DeleteRequestBody) Unmarshal(data []byte) error { return message.Unmarshal(r, data, new(container.DeleteRequest_Body)) } -func (r *DeleteResponseBody) StableMarshal(buf []byte) ([]byte, error) { - return nil, nil +func (r *DeleteResponseBody) StableMarshal(buf []byte) []byte { + return nil } func (r *DeleteResponseBody) StableSize() (size int) { @@ -289,21 +235,18 @@ func (r *DeleteResponseBody) Unmarshal([]byte) error { return nil } -func (r *GetRequestBody) StableMarshal(buf []byte) ([]byte, error) { +func (r *GetRequestBody) StableMarshal(buf []byte) []byte { if r == nil { - return []byte{}, nil + return []byte{} } if buf == nil { buf = make([]byte, r.StableSize()) } - _, err := protoutil.NestedStructureMarshal(getReqBodyIDField, buf, r.cid) - if err != nil { - return nil, err - } + protoutil.NestedStructureMarshal(getReqBodyIDField, buf, r.cid) - return buf, nil + return buf } func (r *GetRequestBody) StableSize() (size int) { @@ -320,31 +263,22 @@ func (r *GetRequestBody) Unmarshal(data []byte) error { return message.Unmarshal(r, data, new(container.GetRequest_Body)) } -func (r *GetResponseBody) StableMarshal(buf []byte) ([]byte, error) { +func (r *GetResponseBody) StableMarshal(buf []byte) []byte { if r == nil { - return []byte{}, nil + return []byte{} } if buf == nil { buf = make([]byte, r.StableSize()) } - offset, err := protoutil.NestedStructureMarshal(getRespBodyContainerField, buf, r.cnr) - if err != nil { - return nil, err - } + var offset int - n, err := protoutil.NestedStructureMarshal(getRespBodySignatureField, buf[offset:], r.sig) - if err != nil { - return nil, err - } + offset += protoutil.NestedStructureMarshal(getRespBodyContainerField, buf, r.cnr) + offset += protoutil.NestedStructureMarshal(getRespBodySignatureField, buf[offset:], r.sig) + protoutil.NestedStructureMarshal(getRespBodyTokenField, buf[offset:], r.token) - _, err = protoutil.NestedStructureMarshal(getRespBodyTokenField, buf[offset+n:], r.token) - if err != nil { - return nil, err - } - - return buf, nil + return buf } func (r *GetResponseBody) StableSize() (size int) { @@ -363,21 +297,18 @@ func (r *GetResponseBody) Unmarshal(data []byte) error { return message.Unmarshal(r, data, new(container.GetResponse_Body)) } -func (r *ListRequestBody) StableMarshal(buf []byte) ([]byte, error) { +func (r *ListRequestBody) StableMarshal(buf []byte) []byte { if r == nil { - return []byte{}, nil + return []byte{} } if buf == nil { buf = make([]byte, r.StableSize()) } - _, err := protoutil.NestedStructureMarshal(listReqBodyOwnerField, buf, r.ownerID) - if err != nil { - return nil, err - } + protoutil.NestedStructureMarshal(listReqBodyOwnerField, buf, r.ownerID) - return buf, nil + return buf } func (r *ListRequestBody) StableSize() (size int) { @@ -394,30 +325,22 @@ func (r *ListRequestBody) Unmarshal(data []byte) error { return message.Unmarshal(r, data, new(container.ListRequest_Body)) } -func (r *ListResponseBody) StableMarshal(buf []byte) ([]byte, error) { +func (r *ListResponseBody) StableMarshal(buf []byte) []byte { if r == nil { - return []byte{}, nil + return []byte{} } if buf == nil { buf = make([]byte, r.StableSize()) } - var ( - n, offset int - err error - ) + var offset int for i := range r.cidList { - n, err = protoutil.NestedStructureMarshal(listRespBodyIDsField, buf[offset:], &r.cidList[i]) - if err != nil { - return nil, err - } - - offset += n + offset += protoutil.NestedStructureMarshal(listRespBodyIDsField, buf[offset:], &r.cidList[i]) } - return buf, nil + return buf } func (r *ListResponseBody) StableSize() (size int) { @@ -436,33 +359,21 @@ func (r *ListResponseBody) Unmarshal(data []byte) error { return message.Unmarshal(r, data, new(container.ListResponse_Body)) } -func (r *SetExtendedACLRequestBody) StableMarshal(buf []byte) ([]byte, error) { +func (r *SetExtendedACLRequestBody) StableMarshal(buf []byte) []byte { if r == nil { - return []byte{}, nil + return []byte{} } if buf == nil { buf = make([]byte, r.StableSize()) } - var ( - offset, n int - err error - ) + var offset int - n, err = protoutil.NestedStructureMarshal(setEACLReqBodyTableField, buf[offset:], r.eacl) - if err != nil { - return nil, err - } + offset += protoutil.NestedStructureMarshal(setEACLReqBodyTableField, buf[offset:], r.eacl) + protoutil.NestedStructureMarshal(setEACLReqBodySignatureField, buf[offset:], r.sig) - offset += n - - _, err = protoutil.NestedStructureMarshal(setEACLReqBodySignatureField, buf[offset:], r.sig) - if err != nil { - return nil, err - } - - return buf, nil + return buf } func (r *SetExtendedACLRequestBody) StableSize() (size int) { @@ -480,8 +391,8 @@ func (r *SetExtendedACLRequestBody) Unmarshal(data []byte) error { return message.Unmarshal(r, data, new(container.SetExtendedACLRequest_Body)) } -func (r *SetExtendedACLResponseBody) StableMarshal(buf []byte) ([]byte, error) { - return nil, nil +func (r *SetExtendedACLResponseBody) StableMarshal(buf []byte) []byte { + return nil } func (r *SetExtendedACLResponseBody) StableSize() (size int) { @@ -492,21 +403,18 @@ func (r *SetExtendedACLResponseBody) Unmarshal([]byte) error { return nil } -func (r *GetExtendedACLRequestBody) StableMarshal(buf []byte) ([]byte, error) { +func (r *GetExtendedACLRequestBody) StableMarshal(buf []byte) []byte { if r == nil { - return []byte{}, nil + return []byte{} } if buf == nil { buf = make([]byte, r.StableSize()) } - _, err := protoutil.NestedStructureMarshal(getEACLReqBodyIDField, buf, r.cid) - if err != nil { - return nil, err - } + protoutil.NestedStructureMarshal(getEACLReqBodyIDField, buf, r.cid) - return buf, nil + return buf } func (r *GetExtendedACLRequestBody) StableSize() (size int) { @@ -523,40 +431,22 @@ func (r *GetExtendedACLRequestBody) Unmarshal(data []byte) error { return message.Unmarshal(r, data, new(container.GetExtendedACLRequest_Body)) } -func (r *GetExtendedACLResponseBody) StableMarshal(buf []byte) ([]byte, error) { +func (r *GetExtendedACLResponseBody) StableMarshal(buf []byte) []byte { if r == nil { - return []byte{}, nil + return []byte{} } if buf == nil { buf = make([]byte, r.StableSize()) } - var ( - offset, n int - err error - ) + var offset int - n, err = protoutil.NestedStructureMarshal(getEACLRespBodyTableField, buf[offset:], r.eacl) - if err != nil { - return nil, err - } + offset += protoutil.NestedStructureMarshal(getEACLRespBodyTableField, buf[offset:], r.eacl) + offset += protoutil.NestedStructureMarshal(getEACLRespBodySignatureField, buf[offset:], r.sig) + protoutil.NestedStructureMarshal(getEACLRespBodyTokenField, buf[offset:], r.token) - offset += n - - n, err = protoutil.NestedStructureMarshal(getEACLRespBodySignatureField, buf[offset:], r.sig) - if err != nil { - return nil, err - } - - offset += n - - _, err = protoutil.NestedStructureMarshal(getEACLRespBodyTokenField, buf[offset:], r.token) - if err != nil { - return nil, err - } - - return buf, nil + return buf } func (r *GetExtendedACLResponseBody) StableSize() (size int) { @@ -575,32 +465,22 @@ func (r *GetExtendedACLResponseBody) Unmarshal(data []byte) error { return message.Unmarshal(r, data, new(container.GetExtendedACLResponse_Body)) } -func (a *UsedSpaceAnnouncement) StableMarshal(buf []byte) ([]byte, error) { +func (a *UsedSpaceAnnouncement) StableMarshal(buf []byte) []byte { if a == nil { - return []byte{}, nil + return []byte{} } if buf == nil { buf = make([]byte, a.StableSize()) } - var ( - offset, n int - err error - ) + var offset int offset += protoutil.UInt64Marshal(usedSpaceAnnounceEpochField, buf[offset:], a.epoch) - - n, err = protoutil.NestedStructureMarshal(usedSpaceAnnounceCIDField, buf[offset:], a.cid) - if err != nil { - return nil, err - } - - offset += n - + offset += protoutil.NestedStructureMarshal(usedSpaceAnnounceCIDField, buf[offset:], a.cid) protoutil.UInt64Marshal(usedSpaceAnnounceUsedSpaceField, buf[offset:], a.usedSpace) - return buf, nil + return buf } func (a *UsedSpaceAnnouncement) StableSize() (size int) { @@ -619,30 +499,22 @@ func (a *UsedSpaceAnnouncement) Unmarshal(data []byte) error { return message.Unmarshal(a, data, new(container.AnnounceUsedSpaceRequest_Body_Announcement)) } -func (r *AnnounceUsedSpaceRequestBody) StableMarshal(buf []byte) ([]byte, error) { +func (r *AnnounceUsedSpaceRequestBody) StableMarshal(buf []byte) []byte { if r == nil { - return []byte{}, nil + return []byte{} } if buf == nil { buf = make([]byte, r.StableSize()) } - var ( - offset, n int - err error - ) + var offset int for i := range r.announcements { - n, err = protoutil.NestedStructureMarshal(usedSpaceReqBodyAnnouncementsField, buf[offset:], &r.announcements[i]) - if err != nil { - return nil, err - } - - offset += n + offset += protoutil.NestedStructureMarshal(usedSpaceReqBodyAnnouncementsField, buf[offset:], &r.announcements[i]) } - return buf, nil + return buf } func (r *AnnounceUsedSpaceRequestBody) StableSize() (size int) { @@ -661,8 +533,8 @@ func (r *AnnounceUsedSpaceRequestBody) Unmarshal(data []byte) error { return message.Unmarshal(r, data, new(container.AnnounceUsedSpaceRequest_Body)) } -func (r *AnnounceUsedSpaceResponseBody) StableMarshal(buf []byte) ([]byte, error) { - return nil, nil +func (r *AnnounceUsedSpaceResponseBody) StableMarshal(buf []byte) []byte { + return nil } func (r *AnnounceUsedSpaceResponseBody) StableSize() (size int) { diff --git a/netmap/marshal.go b/netmap/marshal.go index 72a974e..b7f6e08 100644 --- a/netmap/marshal.go +++ b/netmap/marshal.go @@ -41,19 +41,16 @@ const ( nodeInfoResponseBodyField = 2 ) -func (f *Filter) StableMarshal(buf []byte) ([]byte, error) { +func (f *Filter) StableMarshal(buf []byte) []byte { if f == nil { - return []byte{}, nil + return []byte{} } if buf == nil { buf = make([]byte, f.StableSize()) } - var ( - offset, n int - err error - ) + var offset int offset += protoutil.StringMarshal(nameFilterField, buf[offset:], f.name) offset += protoutil.StringMarshal(keyFilterField, buf[offset:], f.key) @@ -61,15 +58,10 @@ func (f *Filter) StableMarshal(buf []byte) ([]byte, error) { offset += protoutil.StringMarshal(valueFilterField, buf[offset:], f.value) for i := range f.filters { - n, err = protoutil.NestedStructureMarshal(filtersFilterField, buf[offset:], &f.filters[i]) - if err != nil { - return nil, err - } - - offset += n + offset += protoutil.NestedStructureMarshal(filtersFilterField, buf[offset:], &f.filters[i]) } - return buf, nil + return buf } func (f *Filter) StableSize() (size int) { @@ -88,9 +80,9 @@ func (f *Filter) Unmarshal(data []byte) error { return message.Unmarshal(f, data, new(netmap.Filter)) } -func (s *Selector) StableMarshal(buf []byte) ([]byte, error) { +func (s *Selector) StableMarshal(buf []byte) []byte { if s == nil { - return []byte{}, nil + return []byte{} } if buf == nil { @@ -105,7 +97,7 @@ func (s *Selector) StableMarshal(buf []byte) ([]byte, error) { offset += protoutil.StringMarshal(attributeSelectorField, buf[offset:], s.attribute) protoutil.StringMarshal(filterSelectorField, buf[offset:], s.filter) - return buf, nil + return buf } func (s *Selector) StableSize() (size int) { @@ -122,9 +114,9 @@ func (s *Selector) Unmarshal(data []byte) error { return message.Unmarshal(s, data, new(netmap.Selector)) } -func (r *Replica) StableMarshal(buf []byte) ([]byte, error) { +func (r *Replica) StableMarshal(buf []byte) []byte { if r == nil { - return []byte{}, nil + return []byte{} } if buf == nil { @@ -136,7 +128,7 @@ func (r *Replica) StableMarshal(buf []byte) ([]byte, error) { offset += protoutil.UInt32Marshal(countReplicaField, buf[offset:], r.count) protoutil.StringMarshal(selectorReplicaField, buf[offset:], r.selector) - return buf, nil + return buf } func (r *Replica) StableSize() (size int) { @@ -150,55 +142,34 @@ func (r *Replica) Unmarshal(data []byte) error { return message.Unmarshal(r, data, new(netmap.Replica)) } -func (p *PlacementPolicy) StableMarshal(buf []byte) ([]byte, error) { +func (p *PlacementPolicy) StableMarshal(buf []byte) []byte { if p == nil { - return []byte{}, nil + return []byte{} } if buf == nil { buf = make([]byte, p.StableSize()) } - var ( - offset, n int - err error - ) + var offset int for i := range p.replicas { - n, err = protoutil.NestedStructureMarshal(replicasPolicyField, buf[offset:], &p.replicas[i]) - if err != nil { - return nil, err - } - - offset += n + offset += protoutil.NestedStructureMarshal(replicasPolicyField, buf[offset:], &p.replicas[i]) } offset += protoutil.UInt32Marshal(backupPolicyField, buf[offset:], p.backupFactor) for i := range p.selectors { - n, err = protoutil.NestedStructureMarshal(selectorsPolicyField, buf[offset:], &p.selectors[i]) - if err != nil { - return nil, err - } - - offset += n + offset += protoutil.NestedStructureMarshal(selectorsPolicyField, buf[offset:], &p.selectors[i]) } for i := range p.filters { - n, err = protoutil.NestedStructureMarshal(filtersPolicyField, buf[offset:], &p.filters[i]) - if err != nil { - return nil, err - } - - offset += n + offset += protoutil.NestedStructureMarshal(filtersPolicyField, buf[offset:], &p.filters[i]) } - _, err = protoutil.NestedStructureMarshal(subnetIDPolicyField, buf[offset:], p.subnetID) - if err != nil { - return nil, err - } + protoutil.NestedStructureMarshal(subnetIDPolicyField, buf[offset:], p.subnetID) - return buf, nil + return buf } func (p *PlacementPolicy) StableSize() (size int) { @@ -225,9 +196,9 @@ func (p *PlacementPolicy) Unmarshal(data []byte) error { return message.Unmarshal(p, data, new(netmap.PlacementPolicy)) } -func (a *Attribute) StableMarshal(buf []byte) ([]byte, error) { +func (a *Attribute) StableMarshal(buf []byte) []byte { if a == nil { - return []byte{}, nil + return []byte{} } if buf == nil { @@ -243,7 +214,7 @@ func (a *Attribute) StableMarshal(buf []byte) ([]byte, error) { offset += protoutil.StringMarshal(parentsAttributeField, buf[offset:], a.parents[i]) } - return buf, nil + return buf } func (a *Attribute) StableSize() (size int) { @@ -265,35 +236,27 @@ func (a *Attribute) Unmarshal(data []byte) error { return message.Unmarshal(a, data, new(netmap.NodeInfo_Attribute)) } -func (ni *NodeInfo) StableMarshal(buf []byte) ([]byte, error) { +func (ni *NodeInfo) StableMarshal(buf []byte) []byte { if ni == nil { - return []byte{}, nil + return []byte{} } if buf == nil { buf = make([]byte, ni.StableSize()) } - var ( - offset, n int - err error - ) + var offset int offset += protoutil.BytesMarshal(keyNodeInfoField, buf[offset:], ni.publicKey) offset += protoutil.RepeatedStringMarshal(addressNodeInfoField, buf[offset:], ni.addresses) for i := range ni.attributes { - n, err = protoutil.NestedStructureMarshal(attributesNodeInfoField, buf[offset:], &ni.attributes[i]) - if err != nil { - return nil, err - } - - offset += n + offset += protoutil.NestedStructureMarshal(attributesNodeInfoField, buf[offset:], &ni.attributes[i]) } protoutil.EnumMarshal(stateNodeInfoField, buf[offset:], int32(ni.state)) - return buf, nil + return buf } func (ni *NodeInfo) StableSize() (size int) { @@ -317,8 +280,8 @@ func (ni *NodeInfo) Unmarshal(data []byte) error { return message.Unmarshal(ni, data, new(netmap.NodeInfo)) } -func (l *LocalNodeInfoRequestBody) StableMarshal(buf []byte) ([]byte, error) { - return nil, nil +func (l *LocalNodeInfoRequestBody) StableMarshal(buf []byte) []byte { + return nil } func (l *LocalNodeInfoRequestBody) StableSize() (size int) { @@ -329,33 +292,21 @@ func (l *LocalNodeInfoRequestBody) Unmarshal([]byte) error { return nil } -func (l *LocalNodeInfoResponseBody) StableMarshal(buf []byte) ([]byte, error) { +func (l *LocalNodeInfoResponseBody) StableMarshal(buf []byte) []byte { if l == nil { - return []byte{}, nil + return []byte{} } if buf == nil { buf = make([]byte, l.StableSize()) } - var ( - offset, n int - err error - ) + var offset int - n, err = protoutil.NestedStructureMarshal(versionInfoResponseBodyField, buf[offset:], l.version) - if err != nil { - return nil, err - } + offset += protoutil.NestedStructureMarshal(versionInfoResponseBodyField, buf[offset:], l.version) + protoutil.NestedStructureMarshal(nodeInfoResponseBodyField, buf[offset:], l.nodeInfo) - offset += n - - _, err = protoutil.NestedStructureMarshal(nodeInfoResponseBodyField, buf[offset:], l.nodeInfo) - if err != nil { - return nil, err - } - - return buf, nil + return buf } func (l *LocalNodeInfoResponseBody) StableSize() (size int) { @@ -379,9 +330,9 @@ const ( netPrmValFNum ) -func (x *NetworkParameter) StableMarshal(buf []byte) ([]byte, error) { +func (x *NetworkParameter) StableMarshal(buf []byte) []byte { if x == nil { - return []byte{}, nil + return []byte{} } if buf == nil { @@ -393,7 +344,7 @@ func (x *NetworkParameter) StableMarshal(buf []byte) ([]byte, error) { offset += protoutil.BytesMarshal(netPrmKeyFNum, buf[offset:], x.k) protoutil.BytesMarshal(netPrmValFNum, buf[offset:], x.v) - return buf, nil + return buf } func (x *NetworkParameter) StableSize() (size int) { @@ -412,30 +363,22 @@ const ( netCfgPrmsFNum ) -func (x *NetworkConfig) StableMarshal(buf []byte) ([]byte, error) { +func (x *NetworkConfig) StableMarshal(buf []byte) []byte { if x == nil { - return []byte{}, nil + return []byte{} } if buf == nil { buf = make([]byte, x.StableSize()) } - var ( - offset, n int - err error - ) + var offset int for i := range x.ps { - n, err = protoutil.NestedStructureMarshal(netCfgPrmsFNum, buf[offset:], &x.ps[i]) - if err != nil { - return nil, err - } - - offset += n + offset += protoutil.NestedStructureMarshal(netCfgPrmsFNum, buf[offset:], &x.ps[i]) } - return buf, nil + return buf } func (x *NetworkConfig) StableSize() (size int) { @@ -458,30 +401,23 @@ const ( netInfoCfgFNum ) -func (i *NetworkInfo) StableMarshal(buf []byte) ([]byte, error) { +func (i *NetworkInfo) StableMarshal(buf []byte) []byte { if i == nil { - return []byte{}, nil + return []byte{} } if buf == nil { buf = make([]byte, i.StableSize()) } - var ( - offset int - err error - ) + var offset int offset += protoutil.UInt64Marshal(netInfoCurEpochFNum, buf[offset:], i.curEpoch) offset += protoutil.UInt64Marshal(netInfoMagicNumFNum, buf[offset:], i.magicNum) offset += protoutil.Int64Marshal(netInfoMSPerBlockFNum, buf[offset:], i.msPerBlock) + protoutil.NestedStructureMarshal(netInfoCfgFNum, buf[offset:], i.netCfg) - _, err = protoutil.NestedStructureMarshal(netInfoCfgFNum, buf[offset:], i.netCfg) - if err != nil { - return nil, err - } - - return buf, nil + return buf } func (i *NetworkInfo) StableSize() (size int) { @@ -501,8 +437,8 @@ func (i *NetworkInfo) Unmarshal(data []byte) error { return message.Unmarshal(i, data, new(netmap.NetworkInfo)) } -func (l *NetworkInfoRequestBody) StableMarshal(buf []byte) ([]byte, error) { - return nil, nil +func (l *NetworkInfoRequestBody) StableMarshal(buf []byte) []byte { + return nil } func (l *NetworkInfoRequestBody) StableSize() (size int) { @@ -518,21 +454,18 @@ const ( netInfoRespBodyNetInfoFNum ) -func (i *NetworkInfoResponseBody) StableMarshal(buf []byte) ([]byte, error) { +func (i *NetworkInfoResponseBody) StableMarshal(buf []byte) []byte { if i == nil { - return []byte{}, nil + return []byte{} } if buf == nil { buf = make([]byte, i.StableSize()) } - _, err := protoutil.NestedStructureMarshal(netInfoRespBodyNetInfoFNum, buf, i.netInfo) - if err != nil { - return nil, err - } + protoutil.NestedStructureMarshal(netInfoRespBodyNetInfoFNum, buf, i.netInfo) - return buf, nil + return buf } func (i *NetworkInfoResponseBody) StableSize() (size int) { diff --git a/object/lock.go b/object/lock.go index 660c002..44597eb 100644 --- a/object/lock.go +++ b/object/lock.go @@ -48,28 +48,22 @@ const ( // StableMarshal encodes the Lock into Protocol Buffers binary format // with direct field order. -func (x *Lock) StableMarshal(buf []byte) ([]byte, error) { +func (x *Lock) StableMarshal(buf []byte) []byte { if x == nil || len(x.members) == 0 { - return []byte{}, nil + return []byte{} } if buf == nil { buf = make([]byte, x.StableSize()) } - var offset, n int - var err error + var offset int for i := range x.members { - n, err = proto.NestedStructureMarshal(fNumLockMembers, buf[offset:], &x.members[i]) - if err != nil { - return nil, err - } - - offset += n + offset += proto.NestedStructureMarshal(fNumLockMembers, buf[offset:], &x.members[i]) } - return buf, nil + return buf } // StableSize size of the buffer required to write the Lock in Protocol Buffers @@ -146,11 +140,7 @@ func WriteLock(obj *Object, lock Lock) { hdr.SetObjectType(TypeLock) - payload, err := lock.StableMarshal(nil) - if err != nil { - panic(fmt.Sprintf("encode lock content: %v", err)) - } - + payload := lock.StableMarshal(nil) obj.SetPayload(payload) } diff --git a/object/marshal.go b/object/marshal.go index 79b767d..03ba265 100644 --- a/object/marshal.go +++ b/object/marshal.go @@ -112,52 +112,26 @@ const ( getRangeHashRespBodyHashListField = 2 ) -func (h *ShortHeader) StableMarshal(buf []byte) ([]byte, error) { +func (h *ShortHeader) StableMarshal(buf []byte) []byte { if h == nil { - return []byte{}, nil + return []byte{} } if buf == nil { buf = make([]byte, h.StableSize()) } - var ( - offset, n int - err error - ) - - n, err = proto.NestedStructureMarshal(shortHdrVersionField, buf[offset:], h.version) - if err != nil { - return nil, err - } - - offset += n + var offset int + offset += proto.NestedStructureMarshal(shortHdrVersionField, buf[offset:], h.version) offset += proto.UInt64Marshal(shortHdrEpochField, buf[offset:], h.creatEpoch) - - n, err = proto.NestedStructureMarshal(shortHdrOwnerField, buf[offset:], h.ownerID) - if err != nil { - return nil, err - } - - offset += n - + offset += proto.NestedStructureMarshal(shortHdrOwnerField, buf[offset:], h.ownerID) offset += proto.EnumMarshal(shortHdrObjectTypeField, buf[offset:], int32(h.typ)) offset += proto.UInt64Marshal(shortHdrPayloadLength, buf[offset:], h.payloadLen) + offset += proto.NestedStructureMarshal(shortHdrHashField, buf[offset:], h.payloadHash) + proto.NestedStructureMarshal(shortHdrHomoHashField, buf[offset:], h.homoHash) - n, err = proto.NestedStructureMarshal(shortHdrHashField, buf[offset:], h.payloadHash) - if err != nil { - return nil, err - } - - offset += n - - _, err = proto.NestedStructureMarshal(shortHdrHomoHashField, buf[offset:], h.homoHash) - if err != nil { - return nil, err - } - - return buf, nil + return buf } func (h *ShortHeader) StableSize() (size int) { @@ -180,9 +154,9 @@ func (h *ShortHeader) Unmarshal(data []byte) error { return message.Unmarshal(h, data, new(object.ShortHeader)) } -func (a *Attribute) StableMarshal(buf []byte) ([]byte, error) { +func (a *Attribute) StableMarshal(buf []byte) []byte { if a == nil { - return []byte{}, nil + return []byte{} } if buf == nil { @@ -194,7 +168,7 @@ func (a *Attribute) StableMarshal(buf []byte) ([]byte, error) { offset += proto.StringMarshal(attributeKeyField, buf[offset:], a.key) proto.StringMarshal(attributeValueField, buf[offset:], a.val) - return buf, nil + return buf } func (a *Attribute) StableSize() (size int) { @@ -212,58 +186,25 @@ func (a *Attribute) Unmarshal(data []byte) error { return message.Unmarshal(a, data, new(object.Header_Attribute)) } -func (h *SplitHeader) StableMarshal(buf []byte) ([]byte, error) { +func (h *SplitHeader) StableMarshal(buf []byte) []byte { if h == nil { - return []byte{}, nil + return []byte{} } if buf == nil { buf = make([]byte, h.StableSize()) } - var ( - offset, n int - err error - ) - - n, err = proto.NestedStructureMarshal(splitHdrParentField, buf[offset:], h.par) - if err != nil { - return nil, err - } - - offset += n - - n, err = proto.NestedStructureMarshal(splitHdrPreviousField, buf[offset:], h.prev) - if err != nil { - return nil, err - } - - offset += n - - n, err = proto.NestedStructureMarshal(splitHdrParentSignatureField, buf[offset:], h.parSig) - if err != nil { - return nil, err - } - - offset += n - - n, err = proto.NestedStructureMarshal(splitHdrParentHeaderField, buf[offset:], h.parHdr) - if err != nil { - return nil, err - } - - offset += n - - n, err = refs.ObjectIDNestedListMarshal(splitHdrChildrenField, buf[offset:], h.children) - if err != nil { - return nil, err - } - - offset += n + var offset int + offset += proto.NestedStructureMarshal(splitHdrParentField, buf[offset:], h.par) + offset += proto.NestedStructureMarshal(splitHdrPreviousField, buf[offset:], h.prev) + offset += proto.NestedStructureMarshal(splitHdrParentSignatureField, buf[offset:], h.parSig) + offset += proto.NestedStructureMarshal(splitHdrParentHeaderField, buf[offset:], h.parHdr) + offset += refs.ObjectIDNestedListMarshal(splitHdrChildrenField, buf[offset:], h.children) proto.BytesMarshal(splitHdrSplitIDField, buf[offset:], h.splitID) - return buf, nil + return buf } func (h *SplitHeader) StableSize() (size int) { @@ -285,82 +226,34 @@ func (h *SplitHeader) Unmarshal(data []byte) error { return message.Unmarshal(h, data, new(object.Header_Split)) } -func (h *Header) StableMarshal(buf []byte) ([]byte, error) { +func (h *Header) StableMarshal(buf []byte) []byte { if h == nil { - return []byte{}, nil + return []byte{} } if buf == nil { buf = make([]byte, h.StableSize()) } - var ( - offset, n int - err error - ) - - n, err = proto.NestedStructureMarshal(hdrVersionField, buf[offset:], h.version) - if err != nil { - return nil, err - } - - offset += n - - n, err = proto.NestedStructureMarshal(hdrContainerIDField, buf[offset:], h.cid) - if err != nil { - return nil, err - } - - offset += n - - n, err = proto.NestedStructureMarshal(hdrOwnerIDField, buf[offset:], h.ownerID) - if err != nil { - return nil, err - } - - offset += n + var offset int + offset += proto.NestedStructureMarshal(hdrVersionField, buf[offset:], h.version) + offset += proto.NestedStructureMarshal(hdrContainerIDField, buf[offset:], h.cid) + offset += proto.NestedStructureMarshal(hdrOwnerIDField, buf[offset:], h.ownerID) offset += proto.UInt64Marshal(hdrEpochField, buf[offset:], h.creatEpoch) offset += proto.UInt64Marshal(hdrPayloadLengthField, buf[offset:], h.payloadLen) - - n, err = proto.NestedStructureMarshal(hdrPayloadHashField, buf[offset:], h.payloadHash) - if err != nil { - return nil, err - } - - offset += n - + offset += proto.NestedStructureMarshal(hdrPayloadHashField, buf[offset:], h.payloadHash) offset += proto.EnumMarshal(hdrObjectTypeField, buf[offset:], int32(h.typ)) - - n, err = proto.NestedStructureMarshal(hdrHomomorphicHashField, buf[offset:], h.homoHash) - if err != nil { - return nil, err - } - - offset += n - - n, err = proto.NestedStructureMarshal(hdrSessionTokenField, buf[offset:], h.sessionToken) - if err != nil { - return nil, err - } - - offset += n + offset += proto.NestedStructureMarshal(hdrHomomorphicHashField, buf[offset:], h.homoHash) + offset += proto.NestedStructureMarshal(hdrSessionTokenField, buf[offset:], h.sessionToken) for i := range h.attr { - n, err = proto.NestedStructureMarshal(hdrAttributesField, buf[offset:], &h.attr[i]) - if err != nil { - return nil, err - } - - offset += n + offset += proto.NestedStructureMarshal(hdrAttributesField, buf[offset:], &h.attr[i]) } - _, err = proto.NestedStructureMarshal(hdrSplitField, buf[offset:], h.split) - if err != nil { - return nil, err - } + proto.NestedStructureMarshal(hdrSplitField, buf[offset:], h.split) - return buf, nil + return buf } func (h *Header) StableSize() (size int) { @@ -389,33 +282,21 @@ func (h *Header) Unmarshal(data []byte) error { return message.Unmarshal(h, data, new(object.Header)) } -func (h *HeaderWithSignature) StableMarshal(buf []byte) ([]byte, error) { +func (h *HeaderWithSignature) StableMarshal(buf []byte) []byte { if h == nil { - return []byte{}, nil + return []byte{} } if buf == nil { buf = make([]byte, h.StableSize()) } - var ( - offset, n int - err error - ) + var offset int - n, err = proto.NestedStructureMarshal(hdrWithSigHeaderField, buf[offset:], h.header) - if err != nil { - return nil, err - } + offset += proto.NestedStructureMarshal(hdrWithSigHeaderField, buf[offset:], h.header) + proto.NestedStructureMarshal(hdrWithSigSignatureField, buf[offset:], h.signature) - offset += n - - _, err = proto.NestedStructureMarshal(hdrWithSigSignatureField, buf[offset:], h.signature) - if err != nil { - return nil, err - } - - return buf, nil + return buf } func (h *HeaderWithSignature) StableSize() (size int) { @@ -433,44 +314,23 @@ func (h *HeaderWithSignature) Unmarshal(data []byte) error { return message.Unmarshal(h, data, new(object.HeaderWithSignature)) } -func (o *Object) StableMarshal(buf []byte) ([]byte, error) { +func (o *Object) StableMarshal(buf []byte) []byte { if o == nil { - return []byte{}, nil + return []byte{} } if buf == nil { buf = make([]byte, o.StableSize()) } - var ( - offset, n int - err error - ) - - n, err = proto.NestedStructureMarshal(objIDField, buf[offset:], o.objectID) - if err != nil { - return nil, err - } - - offset += n - - n, err = proto.NestedStructureMarshal(objSignatureField, buf[offset:], o.idSig) - if err != nil { - return nil, err - } - - offset += n - - n, err = proto.NestedStructureMarshal(objHeaderField, buf[offset:], o.header) - if err != nil { - return nil, err - } - - offset += n + var offset int + offset += proto.NestedStructureMarshal(objIDField, buf[offset:], o.objectID) + offset += proto.NestedStructureMarshal(objSignatureField, buf[offset:], o.idSig) + offset += proto.NestedStructureMarshal(objHeaderField, buf[offset:], o.header) proto.BytesMarshal(objPayloadField, buf[offset:], o.payload) - return buf, nil + return buf } func (o *Object) StableSize() (size int) { @@ -490,35 +350,22 @@ func (o *Object) Unmarshal(data []byte) error { return message.Unmarshal(o, data, new(object.Object)) } -func (s *SplitInfo) StableMarshal(buf []byte) ([]byte, error) { +func (s *SplitInfo) StableMarshal(buf []byte) []byte { if s == nil { - return []byte{}, nil + return []byte{} } if buf == nil { buf = make([]byte, s.StableSize()) } - var ( - offset, n int - err error - ) + var offset int offset += proto.BytesMarshal(splitInfoSplitIDField, buf[offset:], s.splitID) + offset += proto.NestedStructureMarshal(splitInfoLastPartField, buf[offset:], s.lastPart) + proto.NestedStructureMarshal(splitInfoLinkField, buf[offset:], s.link) - n, err = proto.NestedStructureMarshal(splitInfoLastPartField, buf[offset:], s.lastPart) - if err != nil { - return nil, err - } - - offset += n - - _, err = proto.NestedStructureMarshal(splitInfoLinkField, buf[offset:], s.link) - if err != nil { - return nil, err - } - - return buf, nil + return buf } func (s *SplitInfo) StableSize() (size int) { @@ -537,30 +384,21 @@ func (s *SplitInfo) Unmarshal(data []byte) error { return message.Unmarshal(s, data, new(object.SplitInfo)) } -func (r *GetRequestBody) StableMarshal(buf []byte) ([]byte, error) { +func (r *GetRequestBody) StableMarshal(buf []byte) []byte { if r == nil { - return []byte{}, nil + return []byte{} } if buf == nil { buf = make([]byte, r.StableSize()) } - var ( - offset, n int - err error - ) - - n, err = proto.NestedStructureMarshal(getReqBodyAddressField, buf[offset:], r.addr) - if err != nil { - return nil, err - } - - offset += n + var offset int + offset += proto.NestedStructureMarshal(getReqBodyAddressField, buf[offset:], r.addr) proto.BoolMarshal(getReqBodyRawFlagField, buf[offset:], r.raw) - return buf, nil + return buf } func (r *GetRequestBody) StableSize() (size int) { @@ -578,40 +416,22 @@ func (r *GetRequestBody) Unmarshal(data []byte) error { return message.Unmarshal(r, data, new(object.GetRequest_Body)) } -func (r *GetObjectPartInit) StableMarshal(buf []byte) ([]byte, error) { +func (r *GetObjectPartInit) StableMarshal(buf []byte) []byte { if r == nil { - return []byte{}, nil + return []byte{} } if buf == nil { buf = make([]byte, r.StableSize()) } - var ( - offset, n int - err error - ) + var offset int - n, err = proto.NestedStructureMarshal(getRespInitObjectIDField, buf[offset:], r.id) - if err != nil { - return nil, err - } + offset += proto.NestedStructureMarshal(getRespInitObjectIDField, buf[offset:], r.id) + offset += proto.NestedStructureMarshal(getRespInitSignatureField, buf[offset:], r.sig) + proto.NestedStructureMarshal(getRespInitHeaderField, buf[offset:], r.hdr) - offset += n - - n, err = proto.NestedStructureMarshal(getRespInitSignatureField, buf[offset:], r.sig) - if err != nil { - return nil, err - } - - offset += n - - _, err = proto.NestedStructureMarshal(getRespInitHeaderField, buf[offset:], r.hdr) - if err != nil { - return nil, err - } - - return buf, nil + return buf } func (r *GetObjectPartInit) StableSize() (size int) { @@ -630,9 +450,9 @@ func (r *GetObjectPartInit) Unmarshal(data []byte) error { return message.Unmarshal(r, data, new(object.GetResponse_Body_Init)) } -func (r *GetResponseBody) StableMarshal(buf []byte) ([]byte, error) { +func (r *GetResponseBody) StableMarshal(buf []byte) []byte { if r == nil { - return []byte{}, nil + return []byte{} } if buf == nil { @@ -642,24 +462,18 @@ func (r *GetResponseBody) StableMarshal(buf []byte) ([]byte, error) { switch v := r.objPart.(type) { case nil: case *GetObjectPartInit: - _, err := proto.NestedStructureMarshal(getRespBodyInitField, buf, v) - if err != nil { - return nil, err - } + proto.NestedStructureMarshal(getRespBodyInitField, buf, v) case *GetObjectPartChunk: if v != nil { proto.BytesMarshal(getRespBodyChunkField, buf, v.chunk) } case *SplitInfo: - _, err := proto.NestedStructureMarshal(getRespBodySplitInfoField, buf, v) - if err != nil { - return nil, err - } + proto.NestedStructureMarshal(getRespBodySplitInfoField, buf, v) default: panic("unknown one of object get response body type") } - return buf, nil + return buf } func (r *GetResponseBody) StableSize() (size int) { @@ -688,44 +502,23 @@ func (r *GetResponseBody) Unmarshal(data []byte) error { return message.Unmarshal(r, data, new(object.GetResponse_Body)) } -func (r *PutObjectPartInit) StableMarshal(buf []byte) ([]byte, error) { +func (r *PutObjectPartInit) StableMarshal(buf []byte) []byte { if r == nil { - return []byte{}, nil + return []byte{} } if buf == nil { buf = make([]byte, r.StableSize()) } - var ( - offset, n int - err error - ) - - n, err = proto.NestedStructureMarshal(putReqInitObjectIDField, buf[offset:], r.id) - if err != nil { - return nil, err - } - - offset += n - - n, err = proto.NestedStructureMarshal(putReqInitSignatureField, buf[offset:], r.sig) - if err != nil { - return nil, err - } - - offset += n - - n, err = proto.NestedStructureMarshal(putReqInitHeaderField, buf[offset:], r.hdr) - if err != nil { - return nil, err - } - - offset += n + var offset int + offset += proto.NestedStructureMarshal(putReqInitObjectIDField, buf[offset:], r.id) + offset += proto.NestedStructureMarshal(putReqInitSignatureField, buf[offset:], r.sig) + offset += proto.NestedStructureMarshal(putReqInitHeaderField, buf[offset:], r.hdr) proto.UInt32Marshal(putReqInitCopiesNumField, buf[offset:], r.copyNum) - return buf, nil + return buf } func (r *PutObjectPartInit) StableSize() (size int) { @@ -745,9 +538,9 @@ func (r *PutObjectPartInit) Unmarshal(data []byte) error { return message.Unmarshal(r, data, new(object.PutRequest_Body_Init)) } -func (r *PutRequestBody) StableMarshal(buf []byte) ([]byte, error) { +func (r *PutRequestBody) StableMarshal(buf []byte) []byte { if r == nil { - return []byte{}, nil + return []byte{} } if buf == nil { @@ -757,10 +550,7 @@ func (r *PutRequestBody) StableMarshal(buf []byte) ([]byte, error) { switch v := r.objPart.(type) { case nil: case *PutObjectPartInit: - _, err := proto.NestedStructureMarshal(putReqBodyInitField, buf, v) - if err != nil { - return nil, err - } + proto.NestedStructureMarshal(putReqBodyInitField, buf, v) case *PutObjectPartChunk: if v != nil { proto.BytesMarshal(putReqBodyChunkField, buf, v.chunk) @@ -769,7 +559,7 @@ func (r *PutRequestBody) StableMarshal(buf []byte) ([]byte, error) { panic("unknown one of object put request body type") } - return buf, nil + return buf } func (r *PutRequestBody) StableSize() (size int) { @@ -796,21 +586,18 @@ func (r *PutRequestBody) Unmarshal(data []byte) error { return message.Unmarshal(r, data, new(object.PutRequest_Body)) } -func (r *PutResponseBody) StableMarshal(buf []byte) ([]byte, error) { +func (r *PutResponseBody) StableMarshal(buf []byte) []byte { if r == nil { - return []byte{}, nil + return []byte{} } if buf == nil { buf = make([]byte, r.StableSize()) } - _, err := proto.NestedStructureMarshal(putRespBodyObjectIDField, buf, r.id) - if err != nil { - return nil, err - } + proto.NestedStructureMarshal(putRespBodyObjectIDField, buf, r.id) - return buf, nil + return buf } func (r *PutResponseBody) StableSize() (size int) { @@ -827,21 +614,18 @@ func (r *PutResponseBody) Unmarshal(data []byte) error { return message.Unmarshal(r, data, new(object.PutResponse_Body)) } -func (r *DeleteRequestBody) StableMarshal(buf []byte) ([]byte, error) { +func (r *DeleteRequestBody) StableMarshal(buf []byte) []byte { if r == nil { - return []byte{}, nil + return []byte{} } if buf == nil { buf = make([]byte, r.StableSize()) } - _, err := proto.NestedStructureMarshal(deleteReqBodyAddressField, buf, r.addr) - if err != nil { - return nil, err - } + proto.NestedStructureMarshal(deleteReqBodyAddressField, buf, r.addr) - return buf, nil + return buf } func (r *DeleteRequestBody) StableSize() (size int) { @@ -858,21 +642,18 @@ func (r *DeleteRequestBody) Unmarshal(data []byte) error { return message.Unmarshal(r, data, new(object.DeleteRequest_Body)) } -func (r *DeleteResponseBody) StableMarshal(buf []byte) ([]byte, error) { +func (r *DeleteResponseBody) StableMarshal(buf []byte) []byte { if r == nil { - return []byte{}, nil + return []byte{} } if buf == nil { buf = make([]byte, r.StableSize()) } - _, err := proto.NestedStructureMarshal(deleteRespBodyTombstoneFNum, buf, r.tombstone) - if err != nil { - return nil, err - } + proto.NestedStructureMarshal(deleteRespBodyTombstoneFNum, buf, r.tombstone) - return buf, nil + return buf } func (r *DeleteResponseBody) StableSize() (size int) { @@ -889,31 +670,22 @@ func (r *DeleteResponseBody) Unmarshal(data []byte) error { return message.Unmarshal(r, data, new(object.DeleteResponse_Body)) } -func (r *HeadRequestBody) StableMarshal(buf []byte) ([]byte, error) { +func (r *HeadRequestBody) StableMarshal(buf []byte) []byte { if r == nil { - return []byte{}, nil + return []byte{} } if buf == nil { buf = make([]byte, r.StableSize()) } - var ( - offset, n int - err error - ) - - n, err = proto.NestedStructureMarshal(headReqBodyAddressField, buf[offset:], r.addr) - if err != nil { - return nil, err - } - - offset += n + var offset int + offset += proto.NestedStructureMarshal(headReqBodyAddressField, buf[offset:], r.addr) offset += proto.BoolMarshal(headReqBodyMainFlagField, buf[offset:], r.mainOnly) proto.BoolMarshal(headReqBodyRawFlagField, buf[offset:], r.raw) - return buf, nil + return buf } func (r *HeadRequestBody) StableSize() (size int) { @@ -932,9 +704,9 @@ func (r *HeadRequestBody) Unmarshal(data []byte) error { return message.Unmarshal(r, data, new(object.HeadRequest_Body)) } -func (r *HeadResponseBody) StableMarshal(buf []byte) ([]byte, error) { +func (r *HeadResponseBody) StableMarshal(buf []byte) []byte { if r == nil { - return []byte{}, nil + return []byte{} } if buf == nil { @@ -945,30 +717,21 @@ func (r *HeadResponseBody) StableMarshal(buf []byte) ([]byte, error) { case nil: case *HeaderWithSignature: if v != nil { - _, err := proto.NestedStructureMarshal(headRespBodyHeaderField, buf, v) - if err != nil { - return nil, err - } + proto.NestedStructureMarshal(headRespBodyHeaderField, buf, v) } case *ShortHeader: if v != nil { - _, err := proto.NestedStructureMarshal(headRespBodyShortHeaderField, buf, v) - if err != nil { - return nil, err - } + proto.NestedStructureMarshal(headRespBodyShortHeaderField, buf, v) } case *SplitInfo: if v != nil { - _, err := proto.NestedStructureMarshal(headRespBodySplitInfoField, buf, v) - if err != nil { - return nil, err - } + proto.NestedStructureMarshal(headRespBodySplitInfoField, buf, v) } default: panic("unknown one of object put request body type") } - return buf, nil + return buf } func (r *HeadResponseBody) StableSize() (size int) { @@ -1001,9 +764,9 @@ func (r *HeadResponseBody) Unmarshal(data []byte) error { return message.Unmarshal(r, data, new(object.HeadResponse_Body)) } -func (f *SearchFilter) StableMarshal(buf []byte) ([]byte, error) { +func (f *SearchFilter) StableMarshal(buf []byte) []byte { if f == nil { - return []byte{}, nil + return []byte{} } if buf == nil { @@ -1016,7 +779,7 @@ func (f *SearchFilter) StableMarshal(buf []byte) ([]byte, error) { offset += proto.StringMarshal(searchFilterNameField, buf[offset:], f.key) proto.StringMarshal(searchFilterValueField, buf[offset:], f.val) - return buf, nil + return buf } func (f *SearchFilter) StableSize() (size int) { @@ -1035,39 +798,25 @@ func (f *SearchFilter) Unmarshal(data []byte) error { return message.Unmarshal(f, data, new(object.SearchRequest_Body_Filter)) } -func (r *SearchRequestBody) StableMarshal(buf []byte) ([]byte, error) { +func (r *SearchRequestBody) StableMarshal(buf []byte) []byte { if r == nil { - return []byte{}, nil + return []byte{} } if buf == nil { buf = make([]byte, r.StableSize()) } - var ( - offset, n int - err error - ) - - n, err = proto.NestedStructureMarshal(searchReqBodyContainerIDField, buf[offset:], r.cid) - if err != nil { - return nil, err - } - - offset += n + var offset int + offset += proto.NestedStructureMarshal(searchReqBodyContainerIDField, buf[offset:], r.cid) offset += proto.UInt32Marshal(searchReqBodyVersionField, buf[offset:], r.version) for i := range r.filters { - n, err = proto.NestedStructureMarshal(searchReqBodyFiltersField, buf[offset:], &r.filters[i]) - if err != nil { - return nil, err - } - - offset += n + offset += proto.NestedStructureMarshal(searchReqBodyFiltersField, buf[offset:], &r.filters[i]) } - return buf, nil + return buf } func (r *SearchRequestBody) StableSize() (size int) { @@ -1089,26 +838,20 @@ func (r *SearchRequestBody) Unmarshal(data []byte) error { return message.Unmarshal(r, data, new(object.SearchRequest_Body)) } -func (r *SearchResponseBody) StableMarshal(buf []byte) ([]byte, error) { +func (r *SearchResponseBody) StableMarshal(buf []byte) []byte { if r == nil { - return []byte{}, nil + return []byte{} } if buf == nil { buf = make([]byte, r.StableSize()) } - var ( - offset int - err error - ) + var offset int - _, err = refs.ObjectIDNestedListMarshal(searchRespBodyObjectIDsField, buf[offset:], r.idList) - if err != nil { - return nil, err - } + refs.ObjectIDNestedListMarshal(searchRespBodyObjectIDsField, buf[offset:], r.idList) - return buf, nil + return buf } func (r *SearchResponseBody) StableSize() (size int) { @@ -1125,9 +868,9 @@ func (r *SearchResponseBody) Unmarshal(data []byte) error { return message.Unmarshal(r, data, new(object.SearchResponse_Body)) } -func (r *Range) StableMarshal(buf []byte) ([]byte, error) { +func (r *Range) StableMarshal(buf []byte) []byte { if r == nil { - return []byte{}, nil + return []byte{} } if buf == nil { @@ -1139,7 +882,7 @@ func (r *Range) StableMarshal(buf []byte) ([]byte, error) { offset += proto.UInt64Marshal(rangeOffsetField, buf[offset:], r.off) proto.UInt64Marshal(rangeLengthField, buf[offset:], r.len) - return buf, nil + return buf } func (r *Range) StableSize() (size int) { @@ -1157,37 +900,22 @@ func (r *Range) Unmarshal(data []byte) error { return message.Unmarshal(r, data, new(object.Range)) } -func (r *GetRangeRequestBody) StableMarshal(buf []byte) ([]byte, error) { +func (r *GetRangeRequestBody) StableMarshal(buf []byte) []byte { if r == nil { - return []byte{}, nil + return []byte{} } if buf == nil { buf = make([]byte, r.StableSize()) } - var ( - offset, n int - err error - ) - - n, err = proto.NestedStructureMarshal(getRangeReqBodyAddressField, buf[offset:], r.addr) - if err != nil { - return nil, err - } - - offset += n - - n, err = proto.NestedStructureMarshal(getRangeReqBodyRangeField, buf[offset:], r.rng) - if err != nil { - return nil, err - } - - offset += n + var offset int + offset += proto.NestedStructureMarshal(getRangeReqBodyAddressField, buf[offset:], r.addr) + offset += proto.NestedStructureMarshal(getRangeReqBodyRangeField, buf[offset:], r.rng) proto.BoolMarshal(getRangeReqBodyRawField, buf[offset:], r.raw) - return buf, nil + return buf } func (r *GetRangeRequestBody) StableSize() (size int) { @@ -1206,9 +934,9 @@ func (r *GetRangeRequestBody) Unmarshal(data []byte) error { return message.Unmarshal(r, data, new(object.GetRangeRequest_Body)) } -func (r *GetRangeResponseBody) StableMarshal(buf []byte) ([]byte, error) { +func (r *GetRangeResponseBody) StableMarshal(buf []byte) []byte { if r == nil { - return []byte{}, nil + return []byte{} } if buf == nil { @@ -1223,16 +951,13 @@ func (r *GetRangeResponseBody) StableMarshal(buf []byte) ([]byte, error) { } case *SplitInfo: if v != nil { - _, err := proto.NestedStructureMarshal(getRangeRespSplitInfoField, buf, v) - if err != nil { - return nil, err - } + proto.NestedStructureMarshal(getRangeRespSplitInfoField, buf, v) } default: panic("unknown one of object get range request body type") } - return buf, nil + return buf } func (r *GetRangeResponseBody) StableSize() (size int) { @@ -1261,40 +986,27 @@ func (r *GetRangeResponseBody) Unmarshal(data []byte) error { return message.Unmarshal(r, data, new(object.GetRangeResponse_Body)) } -func (r *GetRangeHashRequestBody) StableMarshal(buf []byte) ([]byte, error) { +func (r *GetRangeHashRequestBody) StableMarshal(buf []byte) []byte { if r == nil { - return []byte{}, nil + return []byte{} } if buf == nil { buf = make([]byte, r.StableSize()) } - var ( - offset, n int - err error - ) + var offset int - n, err = proto.NestedStructureMarshal(getRangeHashReqBodyAddressField, buf[offset:], r.addr) - if err != nil { - return nil, err - } - - offset += n + offset += proto.NestedStructureMarshal(getRangeHashReqBodyAddressField, buf[offset:], r.addr) for i := range r.rngs { - n, err = proto.NestedStructureMarshal(getRangeHashReqBodyRangesField, buf[offset:], &r.rngs[i]) - if err != nil { - return nil, err - } - - offset += n + offset += proto.NestedStructureMarshal(getRangeHashReqBodyRangesField, buf[offset:], &r.rngs[i]) } offset += proto.BytesMarshal(getRangeHashReqBodySaltField, buf[offset:], r.salt) proto.EnumMarshal(getRangeHashReqBodyTypeField, buf[offset:], int32(r.typ)) - return buf, nil + return buf } func (r *GetRangeHashRequestBody) StableSize() (size int) { @@ -1318,9 +1030,9 @@ func (r *GetRangeHashRequestBody) Unmarshal(data []byte) error { return message.Unmarshal(r, data, new(object.GetRangeHashRequest_Body)) } -func (r *GetRangeHashResponseBody) StableMarshal(buf []byte) ([]byte, error) { +func (r *GetRangeHashResponseBody) StableMarshal(buf []byte) []byte { if r == nil { - return []byte{}, nil + return []byte{} } if buf == nil { @@ -1332,7 +1044,7 @@ func (r *GetRangeHashResponseBody) StableMarshal(buf []byte) ([]byte, error) { offset += proto.EnumMarshal(getRangeHashRespBodyTypeField, buf, int32(r.typ)) proto.RepeatedBytesMarshal(getRangeHashRespBodyHashListField, buf[offset:], r.hashList) - return buf, nil + return buf } func (r *GetRangeHashResponseBody) StableSize() (size int) { diff --git a/refs/bench_test.go b/refs/bench_test.go index aed5f79..b24e674 100644 --- a/refs/bench_test.go +++ b/refs/bench_test.go @@ -44,8 +44,8 @@ func benchmarkObjectIDSlice(b *testing.B, size int) { b.ReportAllocs() for i := 0; i < b.N; i++ { buf := make([]byte, ObjectIDNestedListSize(1, ids)) - _, err := ObjectIDNestedListMarshal(1, buf, ids) - if err != nil { + n := ObjectIDNestedListMarshal(1, buf, ids) + if n != len(buf) { b.FailNow() } } diff --git a/refs/marshal.go b/refs/marshal.go index ffb1ba5..0a17a51 100644 --- a/refs/marshal.go +++ b/refs/marshal.go @@ -27,9 +27,9 @@ const ( versionMinorField = 2 ) -func (o *OwnerID) StableMarshal(buf []byte) ([]byte, error) { +func (o *OwnerID) StableMarshal(buf []byte) []byte { if o == nil { - return []byte{}, nil + return []byte{} } if buf == nil { @@ -38,7 +38,7 @@ func (o *OwnerID) StableMarshal(buf []byte) ([]byte, error) { proto.BytesMarshal(ownerIDValField, buf, o.val) - return buf, nil + return buf } func (o *OwnerID) StableSize() int { @@ -53,9 +53,9 @@ func (o *OwnerID) Unmarshal(data []byte) error { return message.Unmarshal(o, data, new(refs.OwnerID)) } -func (c *ContainerID) StableMarshal(buf []byte) ([]byte, error) { +func (c *ContainerID) StableMarshal(buf []byte) []byte { if c == nil { - return []byte{}, nil + return []byte{} } if buf == nil { @@ -64,7 +64,7 @@ func (c *ContainerID) StableMarshal(buf []byte) ([]byte, error) { proto.BytesMarshal(containerIDValField, buf, c.val) - return buf, nil + return buf } func (c *ContainerID) StableSize() int { @@ -79,9 +79,9 @@ func (c *ContainerID) Unmarshal(data []byte) error { return message.Unmarshal(c, data, new(refs.ContainerID)) } -func (o *ObjectID) StableMarshal(buf []byte) ([]byte, error) { +func (o *ObjectID) StableMarshal(buf []byte) []byte { if o == nil { - return []byte{}, nil + return []byte{} } if buf == nil { @@ -90,7 +90,7 @@ func (o *ObjectID) StableMarshal(buf []byte) ([]byte, error) { proto.BytesMarshal(objectIDValField, buf, o.val) - return buf, nil + return buf } // ObjectIDNestedListSize returns byte length of nested @@ -113,16 +113,9 @@ func (o *ObjectID) StableSize() int { // ObjectIDNestedListMarshal writes protobuf repeated ObjectID field // with fNum number to buf. -func ObjectIDNestedListMarshal(fNum int64, buf []byte, ids []ObjectID) (off int, err error) { +func ObjectIDNestedListMarshal(fNum int64, buf []byte, ids []ObjectID) (off int) { for i := range ids { - var n int - - n, err = proto.NestedStructureMarshal(fNum, buf[off:], &ids[i]) - if err != nil { - return - } - - off += n + off += proto.NestedStructureMarshal(fNum, buf[off:], &ids[i]) } return @@ -132,33 +125,21 @@ func (o *ObjectID) Unmarshal(data []byte) error { return message.Unmarshal(o, data, new(refs.ObjectID)) } -func (a *Address) StableMarshal(buf []byte) ([]byte, error) { +func (a *Address) StableMarshal(buf []byte) []byte { if a == nil { - return []byte{}, nil + return []byte{} } if buf == nil { buf = make([]byte, a.StableSize()) } - var ( - offset, n int - err error - ) + var offset int - n, err = proto.NestedStructureMarshal(addressContainerField, buf[offset:], a.cid) - if err != nil { - return nil, err - } + offset += proto.NestedStructureMarshal(addressContainerField, buf[offset:], a.cid) + proto.NestedStructureMarshal(addressObjectField, buf[offset:], a.oid) - offset += n - - _, err = proto.NestedStructureMarshal(addressObjectField, buf[offset:], a.oid) - if err != nil { - return nil, err - } - - return buf, nil + return buf } func (a *Address) StableSize() (size int) { @@ -167,7 +148,6 @@ func (a *Address) StableSize() (size int) { } size += proto.NestedStructureSize(addressContainerField, a.cid) - size += proto.NestedStructureSize(addressObjectField, a.oid) return size @@ -177,9 +157,9 @@ func (a *Address) Unmarshal(data []byte) error { return message.Unmarshal(a, data, new(refs.Address)) } -func (c *Checksum) StableMarshal(buf []byte) ([]byte, error) { +func (c *Checksum) StableMarshal(buf []byte) []byte { if c == nil { - return []byte{}, nil + return []byte{} } if buf == nil { @@ -191,7 +171,7 @@ func (c *Checksum) StableMarshal(buf []byte) ([]byte, error) { offset += proto.EnumMarshal(checksumTypeField, buf[offset:], int32(c.typ)) proto.BytesMarshal(checksumValueField, buf[offset:], c.sum) - return buf, nil + return buf } func (c *Checksum) StableSize() (size int) { @@ -209,9 +189,9 @@ func (c *Checksum) Unmarshal(data []byte) error { return message.Unmarshal(c, data, new(refs.Checksum)) } -func (s *Signature) StableMarshal(buf []byte) ([]byte, error) { +func (s *Signature) StableMarshal(buf []byte) []byte { if s == nil { - return []byte{}, nil + return []byte{} } if buf == nil { @@ -224,7 +204,7 @@ func (s *Signature) StableMarshal(buf []byte) ([]byte, error) { offset += proto.BytesMarshal(signatureValueField, buf[offset:], s.sign) proto.EnumMarshal(signatureSchemeField, buf[offset:], int32(s.scheme)) - return buf, nil + return buf } func (s *Signature) StableSize() (size int) { @@ -243,9 +223,9 @@ func (s *Signature) Unmarshal(data []byte) error { return message.Unmarshal(s, data, new(refs.Signature)) } -func (v *Version) StableMarshal(buf []byte) ([]byte, error) { +func (v *Version) StableMarshal(buf []byte) []byte { if v == nil { - return []byte{}, nil + return []byte{} } if buf == nil { @@ -257,7 +237,7 @@ func (v *Version) StableMarshal(buf []byte) ([]byte, error) { offset += proto.UInt32Marshal(versionMajorField, buf[offset:], v.major) proto.UInt32Marshal(versionMinorField, buf[offset:], v.minor) - return buf, nil + return buf } func (v *Version) StableSize() (size int) { @@ -284,9 +264,9 @@ const ( // StableMarshal marshals SubnetID to NeoFS API V2 binary format (Protocol Buffers with direct field order). // // Returns a slice of recorded data. Data is written to the provided buffer if there is enough space. -func (s *SubnetID) StableMarshal(buf []byte) ([]byte, error) { +func (s *SubnetID) StableMarshal(buf []byte) []byte { if s == nil { - return []byte{}, nil + return []byte{} } if buf == nil { @@ -295,7 +275,7 @@ func (s *SubnetID) StableMarshal(buf []byte) ([]byte, error) { proto.Fixed32Marshal(subnetIDValFNum, buf, s.value) - return buf, nil + return buf } // StableSize returns the number of bytes required to write SubnetID in NeoFS API V2 binary format (see StableMarshal). diff --git a/reputation/marshal.go b/reputation/marshal.go index 789cb14..83b9a5a 100644 --- a/reputation/marshal.go +++ b/reputation/marshal.go @@ -11,9 +11,9 @@ const ( peerIDPubKeyFNum ) -func (x *PeerID) StableMarshal(buf []byte) ([]byte, error) { +func (x *PeerID) StableMarshal(buf []byte) []byte { if x == nil { - return []byte{}, nil + return []byte{} } if buf == nil { @@ -22,7 +22,7 @@ func (x *PeerID) StableMarshal(buf []byte) ([]byte, error) { protoutil.BytesMarshal(peerIDPubKeyFNum, buf, x.publicKey) - return buf, nil + return buf } func (x *PeerID) StableSize() (size int) { @@ -41,30 +41,21 @@ const ( trustValueFNum ) -func (x *Trust) StableMarshal(buf []byte) ([]byte, error) { +func (x *Trust) StableMarshal(buf []byte) []byte { if x == nil { - return []byte{}, nil + return []byte{} } if buf == nil { buf = make([]byte, x.StableSize()) } - var ( - offset, n int - err error - ) - - n, err = protoutil.NestedStructureMarshal(trustPeerFNum, buf[offset:], x.peer) - if err != nil { - return nil, err - } - - offset += n + var offset int + offset += protoutil.NestedStructureMarshal(trustPeerFNum, buf[offset:], x.peer) protoutil.Float64Marshal(trustValueFNum, buf[offset:], x.val) - return buf, nil + return buf } func (x *Trust) StableSize() (size int) { @@ -84,26 +75,21 @@ const ( p2pTrustValueFNum ) -func (x *PeerToPeerTrust) StableMarshal(buf []byte) ([]byte, error) { +func (x *PeerToPeerTrust) StableMarshal(buf []byte) []byte { if x == nil { - return []byte{}, nil + return []byte{} } if buf == nil { buf = make([]byte, x.StableSize()) } - offset, err := protoutil.NestedStructureMarshal(p2pTrustTrustingFNum, buf, x.trusting) - if err != nil { - return nil, err - } + var offset int - _, err = protoutil.NestedStructureMarshal(p2pTrustValueFNum, buf[offset:], x.trust) - if err != nil { - return nil, err - } + offset += protoutil.NestedStructureMarshal(p2pTrustTrustingFNum, buf, x.trusting) + protoutil.NestedStructureMarshal(p2pTrustValueFNum, buf[offset:], x.trust) - return buf, nil + return buf } func (x *PeerToPeerTrust) StableSize() (size int) { @@ -123,26 +109,21 @@ const ( globalTrustBodyValueFNum ) -func (x *GlobalTrustBody) StableMarshal(buf []byte) ([]byte, error) { +func (x *GlobalTrustBody) StableMarshal(buf []byte) []byte { if x == nil { - return []byte{}, nil + return []byte{} } if buf == nil { buf = make([]byte, x.StableSize()) } - offset, err := protoutil.NestedStructureMarshal(globalTrustBodyManagerFNum, buf, x.manager) - if err != nil { - return nil, err - } + var offset int - _, err = protoutil.NestedStructureMarshal(globalTrustBodyValueFNum, buf[offset:], x.trust) - if err != nil { - return nil, err - } + offset += protoutil.NestedStructureMarshal(globalTrustBodyManagerFNum, buf, x.manager) + protoutil.NestedStructureMarshal(globalTrustBodyValueFNum, buf[offset:], x.trust) - return buf, nil + return buf } func (x *GlobalTrustBody) StableSize() (size int) { @@ -163,33 +144,22 @@ const ( globalTrustSigFNum ) -func (x *GlobalTrust) StableMarshal(buf []byte) ([]byte, error) { +func (x *GlobalTrust) StableMarshal(buf []byte) []byte { if x == nil { - return []byte{}, nil + return []byte{} } if buf == nil { buf = make([]byte, x.StableSize()) } - offset, err := protoutil.NestedStructureMarshal(globalTrustVersionFNum, buf, x.version) - if err != nil { - return nil, err - } + var offset int - n, err := protoutil.NestedStructureMarshal(globalTrustBodyFNum, buf[offset:], x.body) - if err != nil { - return nil, err - } + offset += protoutil.NestedStructureMarshal(globalTrustVersionFNum, buf, x.version) + offset += protoutil.NestedStructureMarshal(globalTrustBodyFNum, buf[offset:], x.body) + protoutil.NestedStructureMarshal(globalTrustSigFNum, buf[offset:], x.sig) - offset += n - - _, err = protoutil.NestedStructureMarshal(globalTrustSigFNum, buf[offset:], x.sig) - if err != nil { - return nil, err - } - - return buf, nil + return buf } func (x *GlobalTrust) StableSize() (size int) { @@ -210,32 +180,24 @@ const ( announceLocalTrustBodyTrustsFNum ) -func (x *AnnounceLocalTrustRequestBody) StableMarshal(buf []byte) ([]byte, error) { +func (x *AnnounceLocalTrustRequestBody) StableMarshal(buf []byte) []byte { if x == nil { - return []byte{}, nil + return []byte{} } if buf == nil { buf = make([]byte, x.StableSize()) } - var ( - offset, n int - err error - ) + var offset int offset += protoutil.UInt64Marshal(announceLocalTrustBodyEpochFNum, buf[offset:], x.epoch) for i := range x.trusts { - n, err = protoutil.NestedStructureMarshal(announceLocalTrustBodyTrustsFNum, buf[offset:], &x.trusts[i]) - if err != nil { - return nil, err - } - - offset += n + offset += protoutil.NestedStructureMarshal(announceLocalTrustBodyTrustsFNum, buf[offset:], &x.trusts[i]) } - return buf, nil + return buf } func (x *AnnounceLocalTrustRequestBody) StableSize() (size int) { @@ -252,8 +214,8 @@ func (x *AnnounceLocalTrustRequestBody) Unmarshal(data []byte) error { return message.Unmarshal(x, data, new(reputation.AnnounceLocalTrustRequest_Body)) } -func (x *AnnounceLocalTrustResponseBody) StableMarshal(buf []byte) ([]byte, error) { - return buf, nil +func (x *AnnounceLocalTrustResponseBody) StableMarshal(buf []byte) []byte { + return buf } func (x *AnnounceLocalTrustResponseBody) StableSize() int { @@ -271,29 +233,22 @@ const ( announceInterResBodyTrustFNum ) -func (x *AnnounceIntermediateResultRequestBody) StableMarshal(buf []byte) ([]byte, error) { +func (x *AnnounceIntermediateResultRequestBody) StableMarshal(buf []byte) []byte { if x == nil { - return []byte{}, nil + return []byte{} } if buf == nil { buf = make([]byte, x.StableSize()) } - var ( - offset int - err error - ) + var offset int offset += protoutil.UInt64Marshal(announceInterResBodyEpochFNum, buf, x.epoch) offset += protoutil.UInt32Marshal(announceInterResBodyIterFNum, buf[offset:], x.iter) + protoutil.NestedStructureMarshal(announceInterResBodyTrustFNum, buf[offset:], x.trust) - _, err = protoutil.NestedStructureMarshal(announceInterResBodyTrustFNum, buf[offset:], x.trust) - if err != nil { - return nil, err - } - - return buf, nil + return buf } func (x *AnnounceIntermediateResultRequestBody) StableSize() (size int) { @@ -308,8 +263,8 @@ func (x *AnnounceIntermediateResultRequestBody) Unmarshal(data []byte) error { return message.Unmarshal(x, data, new(reputation.AnnounceIntermediateResultRequest_Body)) } -func (x *AnnounceIntermediateResultResponseBody) StableMarshal(buf []byte) ([]byte, error) { - return buf, nil +func (x *AnnounceIntermediateResultResponseBody) StableMarshal(buf []byte) []byte { + return buf } func (x *AnnounceIntermediateResultResponseBody) StableSize() int { diff --git a/session/marshal.go b/session/marshal.go index 062076d..d7db4d2 100644 --- a/session/marshal.go +++ b/session/marshal.go @@ -61,30 +61,21 @@ const ( respVerifHeaderOriginField = 4 ) -func (c *CreateRequestBody) StableMarshal(buf []byte) ([]byte, error) { +func (c *CreateRequestBody) StableMarshal(buf []byte) []byte { if c == nil { - return []byte{}, nil + return []byte{} } if buf == nil { buf = make([]byte, c.StableSize()) } - var ( - offset, n int - err error - ) - - n, err = proto.NestedStructureMarshal(createReqBodyOwnerField, buf[offset:], c.ownerID) - if err != nil { - return nil, err - } - - offset += n + var offset int + offset += proto.NestedStructureMarshal(createReqBodyOwnerField, buf[offset:], c.ownerID) proto.UInt64Marshal(createReqBodyExpirationField, buf[offset:], c.expiration) - return buf, nil + return buf } func (c *CreateRequestBody) StableSize() (size int) { @@ -102,9 +93,9 @@ func (c *CreateRequestBody) Unmarshal(data []byte) error { return message.Unmarshal(c, data, new(session.CreateRequest_Body)) } -func (c *CreateResponseBody) StableMarshal(buf []byte) ([]byte, error) { +func (c *CreateResponseBody) StableMarshal(buf []byte) []byte { if c == nil { - return []byte{}, nil + return []byte{} } if buf == nil { @@ -116,7 +107,7 @@ func (c *CreateResponseBody) StableMarshal(buf []byte) ([]byte, error) { offset += proto.BytesMarshal(createRespBodyIDField, buf[offset:], c.id) proto.BytesMarshal(createRespBodyKeyField, buf[offset:], c.sessionKey) - return buf, nil + return buf } func (c *CreateResponseBody) StableSize() (size int) { @@ -134,9 +125,9 @@ func (c *CreateResponseBody) Unmarshal(data []byte) error { return message.Unmarshal(c, data, new(session.CreateResponse_Body)) } -func (x *XHeader) StableMarshal(buf []byte) ([]byte, error) { +func (x *XHeader) StableMarshal(buf []byte) []byte { if x == nil { - return []byte{}, nil + return []byte{} } if buf == nil { @@ -148,7 +139,7 @@ func (x *XHeader) StableMarshal(buf []byte) ([]byte, error) { offset += proto.StringMarshal(xheaderKeyField, buf[offset:], x.key) proto.StringMarshal(xheaderValueField, buf[offset:], x.val) - return buf, nil + return buf } func (x *XHeader) StableSize() (size int) { @@ -171,9 +162,9 @@ func (x *XHeader) Unmarshal(data []byte) error { return x.FromGRPCMessage(m) } -func (l *TokenLifetime) StableMarshal(buf []byte) ([]byte, error) { +func (l *TokenLifetime) StableMarshal(buf []byte) []byte { if l == nil { - return []byte{}, nil + return []byte{} } if buf == nil { @@ -186,7 +177,7 @@ func (l *TokenLifetime) StableMarshal(buf []byte) ([]byte, error) { offset += proto.UInt64Marshal(lifetimeNotValidBeforeField, buf[offset:], l.nbf) proto.UInt64Marshal(lifetimeIssuedAtField, buf[offset:], l.iat) - return buf, nil + return buf } func (l *TokenLifetime) StableSize() (size int) { @@ -210,9 +201,9 @@ func (l *TokenLifetime) Unmarshal(data []byte) error { return l.FromGRPCMessage(m) } -func (c *ObjectSessionContext) StableMarshal(buf []byte) ([]byte, error) { +func (c *ObjectSessionContext) StableMarshal(buf []byte) []byte { if c == nil { - return []byte{}, nil + return []byte{} } if buf == nil { @@ -224,7 +215,7 @@ func (c *ObjectSessionContext) StableMarshal(buf []byte) ([]byte, error) { offset += proto.EnumMarshal(objectCtxVerbField, buf[offset:], int32(c.verb)) proto.NestedStructureMarshal(objectCtxAddressField, buf[offset:], c.addr) - return buf, nil + return buf } func (c *ObjectSessionContext) StableSize() (size int) { @@ -254,9 +245,9 @@ const ( cnrCtxCidFNum ) -func (x *ContainerSessionContext) StableMarshal(buf []byte) ([]byte, error) { +func (x *ContainerSessionContext) StableMarshal(buf []byte) []byte { if x == nil { - return []byte{}, nil + return []byte{} } if buf == nil { @@ -269,7 +260,7 @@ func (x *ContainerSessionContext) StableMarshal(buf []byte) ([]byte, error) { offset += proto.BoolMarshal(cnrCtxWildcardFNum, buf[offset:], x.wildcard) proto.NestedStructureMarshal(cnrCtxCidFNum, buf[offset:], x.cid) - return buf, nil + return buf } func (x *ContainerSessionContext) StableSize() (size int) { @@ -288,56 +279,34 @@ func (x *ContainerSessionContext) Unmarshal(data []byte) error { return message.Unmarshal(x, data, new(session.ContainerSessionContext)) } -func (t *TokenBody) StableMarshal(buf []byte) ([]byte, error) { +func (t *TokenBody) StableMarshal(buf []byte) []byte { if t == nil { - return []byte{}, nil + return []byte{} } if buf == nil { buf = make([]byte, t.StableSize()) } - var ( - offset, n int - err error - ) + var offset int offset += proto.BytesMarshal(sessionTokenBodyIDField, buf[offset:], t.id) - - n, err = proto.NestedStructureMarshal(sessionTokenBodyOwnerField, buf[offset:], t.ownerID) - if err != nil { - return nil, err - } - - offset += n - - n, err = proto.NestedStructureMarshal(sessionTokenBodyLifetimeField, buf[offset:], t.lifetime) - if err != nil { - return nil, err - } - - offset += n - + offset += proto.NestedStructureMarshal(sessionTokenBodyOwnerField, buf[offset:], t.ownerID) + offset += proto.NestedStructureMarshal(sessionTokenBodyLifetimeField, buf[offset:], t.lifetime) offset += proto.BytesMarshal(sessionTokenBodyKeyField, buf[offset:], t.sessionKey) if t.ctx != nil { switch v := t.ctx.(type) { case *ObjectSessionContext: - _, err = proto.NestedStructureMarshal(sessionTokenBodyObjectCtxField, buf[offset:], v) - if err != nil { - return nil, err - } + proto.NestedStructureMarshal(sessionTokenBodyObjectCtxField, buf[offset:], v) case *ContainerSessionContext: - _, err = proto.NestedStructureMarshal(sessionTokenBodyCnrCtxField, buf[offset:], v) - if err != nil { - return nil, err - } + proto.NestedStructureMarshal(sessionTokenBodyCnrCtxField, buf[offset:], v) default: panic("cannot marshal unknown session token context") } } - return buf, nil + return buf } func (t *TokenBody) StableSize() (size int) { @@ -373,33 +342,21 @@ func (t *TokenBody) Unmarshal(data []byte) error { return t.FromGRPCMessage(m) } -func (t *Token) StableMarshal(buf []byte) ([]byte, error) { +func (t *Token) StableMarshal(buf []byte) []byte { if t == nil { - return []byte{}, nil + return []byte{} } if buf == nil { buf = make([]byte, t.StableSize()) } - var ( - offset, n int - err error - ) + var offset int - n, err = proto.NestedStructureMarshal(sessionTokenBodyField, buf[offset:], t.body) - if err != nil { - return nil, err - } + offset += proto.NestedStructureMarshal(sessionTokenBodyField, buf[offset:], t.body) + proto.NestedStructureMarshal(sessionTokenSignatureField, buf[offset:], t.sig) - offset += n - - _, err = proto.NestedStructureMarshal(sessionTokenSignatureField, buf[offset:], t.sig) - if err != nil { - return nil, err - } - - return buf, nil + return buf } func (t *Token) StableSize() (size int) { @@ -422,63 +379,31 @@ func (t *Token) Unmarshal(data []byte) error { return t.FromGRPCMessage(m) } -func (r *RequestMetaHeader) StableMarshal(buf []byte) ([]byte, error) { +func (r *RequestMetaHeader) StableMarshal(buf []byte) []byte { if r == nil { - return []byte{}, nil + return []byte{} } if buf == nil { buf = make([]byte, r.StableSize()) } - var ( - offset, n int - err error - ) - - n, err = proto.NestedStructureMarshal(reqMetaHeaderVersionField, buf[offset:], r.version) - if err != nil { - return nil, err - } - - offset += n + var offset int + offset += proto.NestedStructureMarshal(reqMetaHeaderVersionField, buf[offset:], r.version) offset += proto.UInt64Marshal(reqMetaHeaderEpochField, buf[offset:], r.epoch) offset += proto.UInt32Marshal(reqMetaHeaderTTLField, buf[offset:], r.ttl) for i := range r.xHeaders { - n, err = proto.NestedStructureMarshal(reqMetaHeaderXHeadersField, buf[offset:], &r.xHeaders[i]) - if err != nil { - return nil, err - } - - offset += n + offset += proto.NestedStructureMarshal(reqMetaHeaderXHeadersField, buf[offset:], &r.xHeaders[i]) } - n, err = proto.NestedStructureMarshal(reqMetaHeaderSessionTokenField, buf[offset:], r.sessionToken) - if err != nil { - return nil, err - } - - offset += n - - n, err = proto.NestedStructureMarshal(reqMetaHeaderBearerTokenField, buf[offset:], r.bearerToken) - if err != nil { - return nil, err - } - - offset += n - - n, err = proto.NestedStructureMarshal(reqMetaHeaderOriginField, buf[offset:], r.origin) - if err != nil { - return nil, err - } - - offset += n - + offset += proto.NestedStructureMarshal(reqMetaHeaderSessionTokenField, buf[offset:], r.sessionToken) + offset += proto.NestedStructureMarshal(reqMetaHeaderBearerTokenField, buf[offset:], r.bearerToken) + offset += proto.NestedStructureMarshal(reqMetaHeaderOriginField, buf[offset:], r.origin) proto.UInt64Marshal(reqMetaHeaderNetMagicField, buf[offset:], r.netMagic) - return buf, nil + return buf } func (r *RequestMetaHeader) StableSize() (size int) { @@ -514,47 +439,23 @@ func (r *RequestMetaHeader) Unmarshal(data []byte) error { return r.FromGRPCMessage(m) } -func (r *RequestVerificationHeader) StableMarshal(buf []byte) ([]byte, error) { +func (r *RequestVerificationHeader) StableMarshal(buf []byte) []byte { if r == nil { - return []byte{}, nil + return []byte{} } if buf == nil { buf = make([]byte, r.StableSize()) } - var ( - offset, n int - err error - ) + var offset int - n, err = proto.NestedStructureMarshal(reqVerifHeaderBodySignatureField, buf[offset:], r.bodySig) - if err != nil { - return nil, err - } + offset += proto.NestedStructureMarshal(reqVerifHeaderBodySignatureField, buf[offset:], r.bodySig) + offset += proto.NestedStructureMarshal(reqVerifHeaderMetaSignatureField, buf[offset:], r.metaSig) + offset += proto.NestedStructureMarshal(reqVerifHeaderOriginSignatureField, buf[offset:], r.originSig) + proto.NestedStructureMarshal(reqVerifHeaderOriginField, buf[offset:], r.origin) - offset += n - - n, err = proto.NestedStructureMarshal(reqVerifHeaderMetaSignatureField, buf[offset:], r.metaSig) - if err != nil { - return nil, err - } - - offset += n - - n, err = proto.NestedStructureMarshal(reqVerifHeaderOriginSignatureField, buf[offset:], r.originSig) - if err != nil { - return nil, err - } - - offset += n - - _, err = proto.NestedStructureMarshal(reqVerifHeaderOriginField, buf[offset:], r.origin) - if err != nil { - return nil, err - } - - return buf, nil + return buf } func (r *RequestVerificationHeader) StableSize() (size int) { @@ -579,52 +480,29 @@ func (r *RequestVerificationHeader) Unmarshal(data []byte) error { return r.FromGRPCMessage(m) } -func (r *ResponseMetaHeader) StableMarshal(buf []byte) ([]byte, error) { +func (r *ResponseMetaHeader) StableMarshal(buf []byte) []byte { if r == nil { - return []byte{}, nil + return []byte{} } if buf == nil { buf = make([]byte, r.StableSize()) } - var ( - offset, n int - err error - ) - - n, err = proto.NestedStructureMarshal(respMetaHeaderVersionField, buf[offset:], r.version) - if err != nil { - return nil, err - } - - offset += n + var offset int + offset += proto.NestedStructureMarshal(respMetaHeaderVersionField, buf[offset:], r.version) offset += proto.UInt64Marshal(respMetaHeaderEpochField, buf[offset:], r.epoch) offset += proto.UInt32Marshal(respMetaHeaderTTLField, buf[offset:], r.ttl) for i := range r.xHeaders { - n, err = proto.NestedStructureMarshal(respMetaHeaderXHeadersField, buf[offset:], &r.xHeaders[i]) - if err != nil { - return nil, err - } - - offset += n + offset += proto.NestedStructureMarshal(respMetaHeaderXHeadersField, buf[offset:], &r.xHeaders[i]) } - n, err = proto.NestedStructureMarshal(respMetaHeaderOriginField, buf[offset:], r.origin) - if err != nil { - return nil, err - } + offset += proto.NestedStructureMarshal(respMetaHeaderOriginField, buf[offset:], r.origin) + proto.NestedStructureMarshal(respMetaHeaderStatusField, buf[offset:], r.status) - offset += n - - _, err = proto.NestedStructureMarshal(respMetaHeaderStatusField, buf[offset:], r.status) - if err != nil { - return nil, err - } - - return buf, nil + return buf } func (r *ResponseMetaHeader) StableSize() (size int) { @@ -658,47 +536,23 @@ func (r *ResponseMetaHeader) Unmarshal(data []byte) error { return r.FromGRPCMessage(m) } -func (r *ResponseVerificationHeader) StableMarshal(buf []byte) ([]byte, error) { +func (r *ResponseVerificationHeader) StableMarshal(buf []byte) []byte { if r == nil { - return []byte{}, nil + return []byte{} } if buf == nil { buf = make([]byte, r.StableSize()) } - var ( - offset, n int - err error - ) + var offset int - n, err = proto.NestedStructureMarshal(respVerifHeaderBodySignatureField, buf[offset:], r.bodySig) - if err != nil { - return nil, err - } + offset += proto.NestedStructureMarshal(respVerifHeaderBodySignatureField, buf[offset:], r.bodySig) + offset += proto.NestedStructureMarshal(respVerifHeaderMetaSignatureField, buf[offset:], r.metaSig) + offset += proto.NestedStructureMarshal(respVerifHeaderOriginSignatureField, buf[offset:], r.originSig) + proto.NestedStructureMarshal(respVerifHeaderOriginField, buf[offset:], r.origin) - offset += n - - n, err = proto.NestedStructureMarshal(respVerifHeaderMetaSignatureField, buf[offset:], r.metaSig) - if err != nil { - return nil, err - } - - offset += n - - n, err = proto.NestedStructureMarshal(respVerifHeaderOriginSignatureField, buf[offset:], r.originSig) - if err != nil { - return nil, err - } - - offset += n - - _, err = proto.NestedStructureMarshal(respVerifHeaderOriginField, buf[offset:], r.origin) - if err != nil { - return nil, err - } - - return buf, nil + return buf } func (r *ResponseVerificationHeader) StableSize() (size int) { diff --git a/signature/sign.go b/signature/sign.go index c954891..e6bb194 100644 --- a/signature/sign.go +++ b/signature/sign.go @@ -28,7 +28,7 @@ type serviceResponse interface { } type stableMarshaler interface { - StableMarshal([]byte) ([]byte, error) + StableMarshal([]byte) []byte StableSize() int } @@ -117,7 +117,7 @@ func (r *responseVerificationHeader) setOrigin(m stableMarshaler) { func (s StableMarshalerWrapper) ReadSignedData(buf []byte) ([]byte, error) { if s.SM != nil { - return s.SM.StableMarshal(buf) + return s.SM.StableMarshal(buf), nil } return nil, nil diff --git a/status/marshal.go b/status/marshal.go index 1500198..968a6fc 100644 --- a/status/marshal.go +++ b/status/marshal.go @@ -12,9 +12,9 @@ const ( detailValueFNum ) -func (x *Detail) StableMarshal(buf []byte) ([]byte, error) { +func (x *Detail) StableMarshal(buf []byte) []byte { if x == nil { - return []byte{}, nil + return []byte{} } if buf == nil { @@ -24,9 +24,9 @@ func (x *Detail) StableMarshal(buf []byte) ([]byte, error) { var offset int offset += protoutil.UInt32Marshal(detailIDFNum, buf[offset:], x.id) - offset += protoutil.BytesMarshal(detailValueFNum, buf[offset:], x.val) + protoutil.BytesMarshal(detailValueFNum, buf[offset:], x.val) - return buf, nil + return buf } func (x *Detail) StableSize() (size int) { @@ -47,40 +47,25 @@ const ( statusDetailsFNum ) -func (x *Status) StableMarshal(buf []byte) ([]byte, error) { +func (x *Status) StableMarshal(buf []byte) []byte { if x == nil { - return []byte{}, nil + return []byte{} } if buf == nil { buf = make([]byte, x.StableSize()) } - var ( - offset, n int - err error - ) + var offset int offset += protoutil.UInt32Marshal(statusCodeFNum, buf[offset:], CodeToGRPC(x.code)) - if err != nil { - return nil, err - } - offset += protoutil.StringMarshal(statusMsgFNum, buf[offset:], x.msg) - if err != nil { - return nil, err - } for i := range x.details { - n, err = protoutil.NestedStructureMarshal(statusDetailsFNum, buf[offset:], &x.details[i]) - if err != nil { - return nil, err - } - - offset += n + offset += protoutil.NestedStructureMarshal(statusDetailsFNum, buf[offset:], &x.details[i]) } - return buf, nil + return buf } func (x *Status) StableSize() (size int) { diff --git a/storagegroup/marshal.go b/storagegroup/marshal.go index d5e60c1..22e0ca9 100644 --- a/storagegroup/marshal.go +++ b/storagegroup/marshal.go @@ -16,37 +16,23 @@ const ( // StableMarshal marshals unified storage group structure in a protobuf // compatible way without field order shuffle. -func (s *StorageGroup) StableMarshal(buf []byte) ([]byte, error) { +func (s *StorageGroup) StableMarshal(buf []byte) []byte { if s == nil { - return []byte{}, nil + return []byte{} } if buf == nil { buf = make([]byte, s.StableSize()) } - var ( - offset, n int - err error - ) + var offset int offset += proto.UInt64Marshal(sizeField, buf[offset:], s.size) - - n, err = proto.NestedStructureMarshal(hashField, buf[offset:], s.hash) - if err != nil { - return nil, err - } - - offset += n - + offset += proto.NestedStructureMarshal(hashField, buf[offset:], s.hash) offset += proto.UInt64Marshal(expirationField, buf[offset:], s.exp) + refs.ObjectIDNestedListMarshal(objectIDsField, buf[offset:], s.members) - _, err = refs.ObjectIDNestedListMarshal(objectIDsField, buf[offset:], s.members) - if err != nil { - return nil, err - } - - return buf, nil + return buf } // StableSize of storage group structure marshalled by StableMarshal function. diff --git a/subnet/info.go b/subnet/info.go index 0b4cd16..16efb98 100644 --- a/subnet/info.go +++ b/subnet/info.go @@ -105,33 +105,21 @@ const ( // StableMarshal marshals Info to NeoFS API V2 binary format (Protocol Buffers with direct field order). // // Returns a slice of recorded data. Data is written to the provided buffer if there is enough space. -func (x *Info) StableMarshal(buf []byte) ([]byte, error) { +func (x *Info) StableMarshal(buf []byte) []byte { if x == nil { - return []byte{}, nil + return []byte{} } if buf == nil { buf = make([]byte, x.StableSize()) } - var ( - offset, n int - err error - ) + var offset int - n, err = protoutil.NestedStructureMarshal(subnetInfoIDFNum, buf[offset:], x.id) - if err != nil { - return nil, err - } + offset += protoutil.NestedStructureMarshal(subnetInfoIDFNum, buf[offset:], x.id) + protoutil.NestedStructureMarshal(subnetInfoOwnerFNum, buf[offset:], x.owner) - offset += n - - _, err = protoutil.NestedStructureMarshal(subnetInfoOwnerFNum, buf[offset:], x.owner) - if err != nil { - return nil, err - } - - return buf, nil + return buf } // StableSize returns the number of bytes required to write Info in NeoFS API V2 binary format (see StableMarshal). diff --git a/tombstone/marshal.go b/tombstone/marshal.go index f2f896a..62497db 100644 --- a/tombstone/marshal.go +++ b/tombstone/marshal.go @@ -14,33 +14,25 @@ const ( // StableMarshal marshals unified tombstone message in a protobuf // compatible way without field order shuffle. -func (s *Tombstone) StableMarshal(buf []byte) ([]byte, error) { +func (s *Tombstone) StableMarshal(buf []byte) []byte { if s == nil { - return []byte{}, nil + return []byte{} } if buf == nil { buf = make([]byte, s.StableSize()) } - var ( - offset, n int - err error - ) + var offset int offset += proto.UInt64Marshal(expFNum, buf[offset:], s.exp) offset += proto.BytesMarshal(splitIDFNum, buf[offset:], s.splitID) for i := range s.members { - n, err = proto.NestedStructureMarshal(membersFNum, buf[offset:], &s.members[i]) - if err != nil { - return nil, err - } - - offset += n + offset += proto.NestedStructureMarshal(membersFNum, buf[offset:], &s.members[i]) } - return buf, nil + return buf } // StableSize returns size of tombstone message marshalled by StableMarshal function. diff --git a/util/proto/marshal.go b/util/proto/marshal.go index a1bb1e9..15c67a2 100644 --- a/util/proto/marshal.go +++ b/util/proto/marshal.go @@ -15,7 +15,7 @@ import ( type ( stableMarshaller interface { - StableMarshal([]byte) ([]byte, error) + StableMarshal([]byte) []byte StableSize() int } ) @@ -296,9 +296,9 @@ func NestedStructurePrefix(field int64) (prefix uint64, ln int) { return prefix, VarUIntSize(prefix) } -func NestedStructureMarshal(field int64, buf []byte, v stableMarshaller) (int, error) { +func NestedStructureMarshal(field int64, buf []byte, v stableMarshaller) int { if v == nil || reflect.ValueOf(v).IsNil() { - return 0, nil + return 0 } prefix, _ := NestedStructurePrefix(field) @@ -306,13 +306,9 @@ func NestedStructureMarshal(field int64, buf []byte, v stableMarshaller) (int, e n := v.StableSize() offset += binary.PutUvarint(buf[offset:], uint64(n)) + v.StableMarshal(buf[offset:]) - _, err := v.StableMarshal(buf[offset:]) - if err != nil { - return 0, err - } - - return offset + n, nil + return offset + n } func NestedStructureSize(field int64, v stableMarshaller) (size int) { From 2aacaa6aba3a74ed11443b5fd76e9982964e42a5 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Tue, 5 Apr 2022 11:33:36 +0300 Subject: [PATCH 0984/1196] refs: optimize marshalin of `[]ObjectID` Signed-off-by: Evgenii Stratonikov --- refs/marshal.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/refs/marshal.go b/refs/marshal.go index 0a17a51..dc8517f 100644 --- a/refs/marshal.go +++ b/refs/marshal.go @@ -1,6 +1,8 @@ package refs import ( + "encoding/binary" + refs "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" "github.com/nspcc-dev/neofs-api-go/v2/util/proto" @@ -114,8 +116,13 @@ func (o *ObjectID) StableSize() int { // ObjectIDNestedListMarshal writes protobuf repeated ObjectID field // with fNum number to buf. func ObjectIDNestedListMarshal(fNum int64, buf []byte, ids []ObjectID) (off int) { + prefix, _ := proto.NestedStructurePrefix(fNum) for i := range ids { - off += proto.NestedStructureMarshal(fNum, buf[off:], &ids[i]) + off += binary.PutUvarint(buf, prefix) + + n := ids[i].StableSize() + off += binary.PutUvarint(buf[off:], uint64(n)) + off += proto.BytesMarshal(objectIDValField, buf, ids[i].val) } return From e348c933b78dc493a24a8d80746241dde3b70d96 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Tue, 5 Apr 2022 11:43:02 +0300 Subject: [PATCH 0985/1196] util/proto: fix doc comment Signed-off-by: Evgenii Stratonikov --- util/proto/marshal.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/proto/marshal.go b/util/proto/marshal.go index 15c67a2..589c0be 100644 --- a/util/proto/marshal.go +++ b/util/proto/marshal.go @@ -286,7 +286,7 @@ func RepeatedInt32Size(field int, v []int32) (size, arraySize int) { return RepeatedUInt64Size(field, convert) } -// varUIntSize returns length of varint byte sequence for uint64 value 'x'. +// VarUIntSize returns length of varint byte sequence for uint64 value 'x'. func VarUIntSize(x uint64) int { return (bits.Len64(x|1) + 6) / 7 } From 23702bc51ac01f4005004820a3e9fbc06e14348c Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Fri, 8 Apr 2022 10:24:46 +0300 Subject: [PATCH 0986/1196] util/protogen: add `StableMarshal` generator command Signed-off-by: Evgenii Stratonikov --- util/protogen/main.go | 230 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 230 insertions(+) create mode 100644 util/protogen/main.go diff --git a/util/protogen/main.go b/util/protogen/main.go new file mode 100644 index 0000000..155dc75 --- /dev/null +++ b/util/protogen/main.go @@ -0,0 +1,230 @@ +package main + +import ( + "sort" + "strings" + + "google.golang.org/protobuf/compiler/protogen" + "google.golang.org/protobuf/reflect/protoreflect" +) + +func main() { + protogen.Options{}.Run(func(gen *protogen.Plugin) error { + for _, f := range gen.Files { + //if !f.Generate { + // continue + //} + if strings.HasSuffix(string(f.GoImportPath), "/control") { + generateFile(gen, f) + } + } + return nil + }) +} + +// generateFile generates a *.pb.go file enforcing field-order serialization. +func generateFile(gen *protogen.Plugin, file *protogen.File) *protogen.GeneratedFile { + filename := file.GeneratedFilenamePrefix + "_neofs.pb.go" + g := gen.NewGeneratedFile(filename, file.GoImportPath) + g.P("// Code generated by protoc-gen-go-neofs. DO NOT EDIT.") + g.P() + g.P("package ", file.GoPackageName) + g.P() + g.P(`import "github.com/nspcc-dev/neofs-api-go/v2/util/proto"`) + + //for _, e := range file.Enums { + // g.P("type " + e.GoIdent.GoName + " int32") + // g.P("const (") + // for _, ev := range e.Values { + // g.P(ev.GoIdent.GoName, " = ", ev.Desc.Number()) + // } + // g.P(")") + //} + for _, msg := range file.Messages { + emitMessage(g, msg) + } + return g +} + +func emitMessage(g *protogen.GeneratedFile, msg *protogen.Message) { + for _, inner := range msg.Messages { + emitMessage(g, inner) + } + + fs := sortFields(msg.Fields) + + // StableSize implementation. + g.P("// StableSize returns the size of x in protobuf format.") + g.P("//") + g.P("// Structures with the same field values have the same binary size.") + g.P("func (x *", msg.GoIdent.GoName, ") StableSize() (size int) {") + if len(fs) != 0 { + for _, f := range fs { + emitFieldSize(g, f) + } + } + g.P("return size") + g.P("}\n") + + // StableMarshal implementation. + g.P("// StableMarshal marshals x in protobuf binary format with stable field order.") + g.P("//") + g.P("// If buffer length is less than x.StableSize(), new buffer is allocated.") + g.P("//") + g.P("// Returns any error encountered which did not allow writing the data completely.") + g.P("// Otherwise, returns the buffer in which the data is written.") + g.P("//") + g.P("// Structures with the same field values have the same binary format.") + g.P("func (x *", msg.GoIdent.GoName, ") StableMarshal(buf []byte) ([]byte, error) {") + if len(fs) != 0 { + g.P("if x == nil { return []byte{}, nil }") + g.P("if buf == nil { buf = make([]byte, x.StableSize()) }") + g.P("var err error") + g.P("var offset, n int") + g.P("_, _, _ = err, offset, n") + for _, f := range fs { + emitFieldMarshal(g, f) + } + } + g.P("return buf, nil") + g.P("}\n") + + if strings.HasSuffix(msg.GoIdent.GoName, "Request") || strings.HasSuffix(msg.GoIdent.GoName, "Response") { + // SignedDataSize implementation (only for requests and responses). + g.P("// ReadSignedData fills buf with signed data of x.") + g.P("// If buffer length is less than x.SignedDataSize(), new buffer is allocated.") + g.P("//") + g.P("// Returns any error encountered which did not allow writing the data completely.") + g.P("// Otherwise, returns the buffer in which the data is written.") + g.P("//") + g.P("// Structures with the same field values have the same signed data.") + g.P("func (x *", msg.GoIdent.GoName, ") SignedDataSize() int {") + g.P("return x.GetBody().StableSize()") + g.P("}\n") + + // ReadSignedData implementation (only for requests and responses). + g.P("// SignedDataSize returns size of the request signed data in bytes.") + g.P("//") + g.P("// Structures with the same field values have the same signed data size.") + g.P("func (x *", msg.GoIdent.GoName, ") ReadSignedData(buf []byte) ([]byte, error) {") + g.P("return x.GetBody().StableMarshal(buf)") + g.P("}\n") + + // Signature setters and getters. + g.P("func (x *", msg.GoIdent.GoName, ") SetSignature(sig *Signature) {") + g.P("x.Signature = sig") + g.P("}\n") + } +} + +func emitFieldSize(g *protogen.GeneratedFile, f *protogen.Field) { + m := marshalers[f.Desc.Kind()] + if m.Prefix == "" { + g.P("// FIXME missing field marshaler: ", f.GoName, " of type ", f.Desc.Kind().String()) + g.P(`panic("unimplemented")`) + return + } + + name := castFieldName(f) + if f.Oneof != nil { + name = "x." + f.Oneof.GoName + g.P("if inner, ok := ", name, ".(*", f.GoIdent.GoName, "); ok {") + defer g.P("}") + name = "inner." + f.GoName + } + + switch { + case f.Desc.IsList() && f.Desc.Kind() == protoreflect.MessageKind: + g.P("for i := range ", name, "{") + g.P("size += proto.NestedStructureSize(", f.Desc.Number(), ", ", name, "[i])") + g.P("}") + case f.Desc.IsList(): + g.P("size += proto.Repeated", m.Prefix, "Size(", f.Desc.Number(), ", ", name, ")") + default: + g.P("size += proto.", m.Prefix, "Size(", f.Desc.Number(), ", ", name, ")") + } +} + +func emitFieldMarshal(g *protogen.GeneratedFile, f *protogen.Field) { + m := marshalers[f.Desc.Kind()] + if m.Prefix == "" { + g.P("// FIXME missing field marshaler: ", f.GoName, " of type ", f.Desc.Kind().String()) + g.P(`panic("unimplemented")`) + return + } + + name := castFieldName(f) + if f.Oneof != nil { + name = "x." + f.Oneof.GoName + g.P("if inner, ok := ", name, ".(*", f.GoIdent.GoName, "); ok {") + defer g.P("}") + name = "inner." + f.GoName + } + + prefix := m.Prefix + if f.Desc.IsList() { + prefix = "Repeated" + m.Prefix + } + switch { + case f.Desc.IsList() && f.Desc.Kind() == protoreflect.MessageKind: + g.P("for i := range ", name, "{") + g.P("n, err = proto.NestedStructureMarshal(", f.Desc.Number(), ", buf[offset:], ", name, "[i])") + g.P("if err != nil { return nil, err }") + g.P("offset += n") + g.P("}") + case f.Desc.IsList(): + g.P("offset += proto.Repeated", m.Prefix, "Marshal(", f.Desc.Number(), ", buf[offset:], ", name, ")") + default: + if m.CanFail { + g.P("n, err = proto.", prefix, "Marshal(", f.Desc.Number(), ", buf[offset:], ", name, ")") + g.P("if err != nil { return nil, err }") + g.P("offset += n") + } else { + g.P("offset += proto.", prefix, "Marshal(", f.Desc.Number(), ", buf[offset:], ", name, ")") + } + } +} + +func castFieldName(f *protogen.Field) string { + name := "x." + f.GoName + if f.Desc.Kind() != protoreflect.EnumKind { + return name + } + return "int32(" + name + ")" +} + +type marshalerDesc struct { + Prefix string + CanFail bool +} + +// Unused kinds are commented. +var marshalers = map[protoreflect.Kind]marshalerDesc{ + protoreflect.BoolKind: {Prefix: "Bool"}, + protoreflect.EnumKind: {Prefix: "Enum"}, + //protoreflect.Int32Kind: "", + //protoreflect.Sint32Kind: "", + protoreflect.Uint32Kind: {Prefix: "UInt32"}, + protoreflect.Int64Kind: {Prefix: "Int64"}, + //protoreflect.Sint64Kind: "", + protoreflect.Uint64Kind: {Prefix: "UInt64"}, + //protoreflect.Sfixed32Kind: "", + protoreflect.Fixed32Kind: {Prefix: "Fixed32"}, + //protoreflect.FloatKind: "", + //protoreflect.Sfixed64Kind: "", + protoreflect.Fixed64Kind: {Prefix: "Fixed64"}, + protoreflect.DoubleKind: {Prefix: "Float64"}, + protoreflect.StringKind: {Prefix: "String"}, + protoreflect.BytesKind: {Prefix: "Bytes"}, + protoreflect.MessageKind: {Prefix: "NestedStructure", CanFail: true}, + //protoreflect.GroupKind: "", +} + +func sortFields(fs []*protogen.Field) []*protogen.Field { + res := make([]*protogen.Field, len(fs)) + copy(res, fs) + sort.Slice(res, func(i, j int) bool { + return res[i].Desc.Number() < res[j].Desc.Number() + }) + return res +} From e8e09f0d0074287da122f9d4695bb06ba28132d9 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Mon, 11 Apr 2022 13:47:29 +0300 Subject: [PATCH 0987/1196] [#393] rpc/grpc: Use `NewTimer` instead of `time.After` From the docs of `time.After`: ``` The underlying Timer is not recovered by the garbage collector until the timer fires. ``` We have 1 minute default timeout, which is pretty long given that most of the time we exchange small messages. Signed-off-by: Evgenii Stratonikov --- rpc/grpc/init.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rpc/grpc/init.go b/rpc/grpc/init.go index 9cf41d7..31a2ba7 100644 --- a/rpc/grpc/init.go +++ b/rpc/grpc/init.go @@ -57,10 +57,13 @@ func (w *streamWrapper) withTimeout(closure func() error) error { close(ch) }() + tt := time.NewTimer(w.timeout) + select { case err := <-ch: + tt.Stop() return err - case <-time.After(w.timeout): + case <-tt.C: w.cancel() return context.DeadlineExceeded } From 77a3ba9197be226bf6018373e9faee3c029e3f55 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Mon, 11 Apr 2022 14:23:10 +0300 Subject: [PATCH 0988/1196] [#393] util/signature: Remove bytes pool and provide buffer explicitly Chained verification is done in a single thread there is no need to use pool to do this. Also because newly allocated items are 5 MiB in size we can run out of memory given that typical header it much less in size. Signed-off-by: Evgenii Stratonikov --- signature/sign.go | 25 ++++++++++++++++++------- util/signature/data.go | 32 ++++++++++++++++++++------------ util/signature/options.go | 8 ++++++++ util/signature/util.go | 30 ------------------------------ 4 files changed, 46 insertions(+), 49 deletions(-) delete mode 100644 util/signature/util.go diff --git a/signature/sign.go b/signature/sign.go index e6bb194..e11642e 100644 --- a/signature/sign.go +++ b/signature/sign.go @@ -242,22 +242,32 @@ func VerifyServiceMessage(msg interface{}) error { panic(fmt.Sprintf("unsupported session message %T", v)) } - return verifyMatryoshkaLevel(serviceMessageBody(msg), meta, verify) + body := serviceMessageBody(msg) + size := body.StableSize() + if sz := meta.StableSize(); sz > size { + size = sz + } + if sz := verify.StableSize(); sz > size { + size = sz + } + + buf := make([]byte, 0, size) + return verifyMatryoshkaLevel(body, meta, verify, buf) } -func verifyMatryoshkaLevel(body stableMarshaler, meta metaHeader, verify verificationHeader) error { - if err := verifyServiceMessagePart(meta, verify.GetMetaSignature); err != nil { +func verifyMatryoshkaLevel(body stableMarshaler, meta metaHeader, verify verificationHeader, buf []byte) error { + if err := verifyServiceMessagePart(meta, verify.GetMetaSignature, buf); err != nil { return fmt.Errorf("could not verify meta header: %w", err) } origin := verify.getOrigin() - if err := verifyServiceMessagePart(origin, verify.GetOriginSignature); err != nil { + if err := verifyServiceMessagePart(origin, verify.GetOriginSignature, buf); err != nil { return fmt.Errorf("could not verify origin of verification header: %w", err) } if origin == nil { - if err := verifyServiceMessagePart(body, verify.GetBodySignature); err != nil { + if err := verifyServiceMessagePart(body, verify.GetBodySignature, buf); err != nil { return fmt.Errorf("could not verify body: %w", err) } @@ -268,13 +278,14 @@ func verifyMatryoshkaLevel(body stableMarshaler, meta metaHeader, verify verific return errors.New("body signature at the matryoshka upper level") } - return verifyMatryoshkaLevel(body, meta.getOrigin(), origin) + return verifyMatryoshkaLevel(body, meta.getOrigin(), origin, buf) } -func verifyServiceMessagePart(part stableMarshaler, sigRdr func() *refs.Signature) error { +func verifyServiceMessagePart(part stableMarshaler, sigRdr func() *refs.Signature, buf []byte) error { return signature.VerifyDataWithSource( &StableMarshalerWrapper{part}, sigRdr, + signature.WithBuffer(buf), ) } diff --git a/util/signature/data.go b/util/signature/data.go index cd02d88..387be93 100644 --- a/util/signature/data.go +++ b/util/signature/data.go @@ -29,18 +29,17 @@ func SignDataWithHandler(key *ecdsa.PrivateKey, src DataSource, handler KeySigna return crypto.ErrEmptyPrivateKey } - data, err := dataForSignature(src) - if err != nil { - return err - } - defer bytesPool.Put(data) - cfg := defaultCfg() for i := range opts { opts[i](cfg) } + data, err := readSignedData(cfg, src) + if err != nil { + return err + } + sigData, err := sign(cfg, key, data) if err != nil { return err @@ -56,18 +55,17 @@ func SignDataWithHandler(key *ecdsa.PrivateKey, src DataSource, handler KeySigna } func VerifyDataWithSource(dataSrc DataSource, sigSrc KeySignatureSource, opts ...SignOption) error { - data, err := dataForSignature(dataSrc) - if err != nil { - return err - } - defer bytesPool.Put(data) - cfg := defaultCfg() for i := range opts { opts[i](cfg) } + data, err := readSignedData(cfg, dataSrc) + if err != nil { + return err + } + return verify(cfg, data, sigSrc()) } @@ -78,3 +76,13 @@ func SignData(key *ecdsa.PrivateKey, v DataWithSignature, opts ...SignOption) er func VerifyData(src DataWithSignature, opts ...SignOption) error { return VerifyDataWithSource(src, src.GetSignature, opts...) } + +func readSignedData(cfg *cfg, src DataSource) ([]byte, error) { + size := src.SignedDataSize() + if cfg.buffer == nil || cap(cfg.buffer) < size { + cfg.buffer = make([]byte, size) + } else { + cfg.buffer = cfg.buffer[:size] + } + return src.ReadSignedData(cfg.buffer) +} diff --git a/util/signature/options.go b/util/signature/options.go index dd38986..903ff66 100644 --- a/util/signature/options.go +++ b/util/signature/options.go @@ -11,6 +11,7 @@ import ( type cfg struct { schemeFixed bool scheme refs.SignatureScheme + buffer []byte } func defaultCfg() *cfg { @@ -51,3 +52,10 @@ func SignWithRFC6979() SignOption { c.scheme = refs.ECDSA_RFC6979_SHA256 } } + +// WithBuffer allows providing pre-allocated buffer for signature verification. +func WithBuffer(buf []byte) SignOption { + return func(c *cfg) { + c.buffer = buf + } +} diff --git a/util/signature/util.go b/util/signature/util.go deleted file mode 100644 index 8278f9a..0000000 --- a/util/signature/util.go +++ /dev/null @@ -1,30 +0,0 @@ -package signature - -import ( - "errors" - "sync" -) - -var bytesPool = sync.Pool{ - New: func() interface{} { - return make([]byte, 5<<20) - }, -} - -func dataForSignature(src DataSource) ([]byte, error) { - if src == nil { - return nil, errors.New("nil source") - } - - buf := bytesPool.Get().([]byte) - - if size := src.SignedDataSize(); size < 0 { - return nil, errors.New("negative length") - } else if size <= cap(buf) { - buf = buf[:size] - } else { - buf = make([]byte, size) - } - - return src.ReadSignedData(buf) -} From 3d3283411cf8b16310e5972d8658d5e9c5aedcb6 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Mon, 11 Apr 2022 14:40:00 +0300 Subject: [PATCH 0989/1196] [#393] signature: Do not allocate a signature explicitly Helpers from `util/signature` already allocates it for us. Signed-off-by: Evgenii Stratonikov --- signature/sign.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/signature/sign.go b/signature/sign.go index e11642e..44ec2c4 100644 --- a/signature/sign.go +++ b/signature/sign.go @@ -194,14 +194,14 @@ func SignServiceMessage(key *ecdsa.PrivateKey, msg interface{}) error { } func signServiceMessagePart(key *ecdsa.PrivateKey, part stableMarshaler, sigWrite func(*refs.Signature)) error { - sig := new(refs.Signature) + var sig *refs.Signature // sign part if err := signature.SignDataWithHandler( key, &StableMarshalerWrapper{part}, func(s *refs.Signature) { - *sig = *s + sig = s }, ); err != nil { return err From 870c1ffc0a9f4166ade31b293eef994a515887ab Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Mon, 25 Apr 2022 21:24:19 +0300 Subject: [PATCH 0990/1196] [#397] refs: Fix OIDs marshalling Signed-off-by: Pavel Karpy --- refs/marshal.go | 4 ++-- rpc/message/test/message.go | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/refs/marshal.go b/refs/marshal.go index dc8517f..ef85324 100644 --- a/refs/marshal.go +++ b/refs/marshal.go @@ -118,11 +118,11 @@ func (o *ObjectID) StableSize() int { func ObjectIDNestedListMarshal(fNum int64, buf []byte, ids []ObjectID) (off int) { prefix, _ := proto.NestedStructurePrefix(fNum) for i := range ids { - off += binary.PutUvarint(buf, prefix) + off += binary.PutUvarint(buf[off:], prefix) n := ids[i].StableSize() off += binary.PutUvarint(buf[off:], uint64(n)) - off += proto.BytesMarshal(objectIDValField, buf, ids[i].val) + off += proto.BytesMarshal(objectIDValField, buf[off:], ids[i].val) } return diff --git a/rpc/message/test/message.go b/rpc/message/test/message.go index e3ce9cd..7c4450f 100644 --- a/rpc/message/test/message.go +++ b/rpc/message/test/message.go @@ -16,7 +16,7 @@ type jsonMessage interface { } type binaryMessage interface { - StableMarshal([]byte) ([]byte, error) + StableMarshal([]byte) []byte Unmarshal([]byte) error } @@ -54,8 +54,7 @@ func TestRPCMessage(t *testing.T, msgGens ...func(empty bool) message.Message) { if bm, ok := msg.(binaryMessage); ok { t.Run(fmt.Sprintf("Binary_%T", msg), func(t *testing.T) { - data, err := bm.StableMarshal(nil) - require.NoError(t, err) + data := bm.StableMarshal(nil) bm2 := msgGen(true).(binaryMessage) require.NoError(t, bm2.Unmarshal(data)) From 0b8e4e475380f4fe57d4d22c44fc3723b602657b Mon Sep 17 00:00:00 2001 From: fyrchik Date: Mon, 30 May 2022 10:33:01 +0300 Subject: [PATCH 0991/1196] [#400] Support latest API in protoc plugin (#400) Signed-off-by: Evgenii Stratonikov --- util/protogen/main.go | 56 ++++++++++++++++++++++--------------------- 1 file changed, 29 insertions(+), 27 deletions(-) diff --git a/util/protogen/main.go b/util/protogen/main.go index 155dc75..41ed991 100644 --- a/util/protogen/main.go +++ b/util/protogen/main.go @@ -14,7 +14,8 @@ func main() { //if !f.Generate { // continue //} - if strings.HasSuffix(string(f.GoImportPath), "/control") { + imp := string(f.GoImportPath) + if strings.HasSuffix(imp, "/tree") { // || strings.HasSuffix(imp, "/control") { generateFile(gen, f) } } @@ -59,6 +60,12 @@ func emitMessage(g *protogen.GeneratedFile, msg *protogen.Message) { g.P("// Structures with the same field values have the same binary size.") g.P("func (x *", msg.GoIdent.GoName, ") StableSize() (size int) {") if len(fs) != 0 { + for _, f := range fs { + if f.Desc.IsList() && marshalers[f.Desc.Kind()].RepeatedDouble { + g.P("var n int") + break + } + } for _, f := range fs { emitFieldSize(g, f) } @@ -75,18 +82,16 @@ func emitMessage(g *protogen.GeneratedFile, msg *protogen.Message) { g.P("// Otherwise, returns the buffer in which the data is written.") g.P("//") g.P("// Structures with the same field values have the same binary format.") - g.P("func (x *", msg.GoIdent.GoName, ") StableMarshal(buf []byte) ([]byte, error) {") + g.P("func (x *", msg.GoIdent.GoName, ") StableMarshal(buf []byte) []byte {") if len(fs) != 0 { - g.P("if x == nil { return []byte{}, nil }") + g.P("if x == nil { return []byte{} }") g.P("if buf == nil { buf = make([]byte, x.StableSize()) }") - g.P("var err error") - g.P("var offset, n int") - g.P("_, _, _ = err, offset, n") + g.P("var offset int") for _, f := range fs { emitFieldMarshal(g, f) } } - g.P("return buf, nil") + g.P("return buf") g.P("}\n") if strings.HasSuffix(msg.GoIdent.GoName, "Request") || strings.HasSuffix(msg.GoIdent.GoName, "Response") { @@ -107,7 +112,7 @@ func emitMessage(g *protogen.GeneratedFile, msg *protogen.Message) { g.P("//") g.P("// Structures with the same field values have the same signed data size.") g.P("func (x *", msg.GoIdent.GoName, ") ReadSignedData(buf []byte) ([]byte, error) {") - g.P("return x.GetBody().StableMarshal(buf)") + g.P("return x.GetBody().StableMarshal(buf), nil") g.P("}\n") // Signature setters and getters. @@ -139,7 +144,12 @@ func emitFieldSize(g *protogen.GeneratedFile, f *protogen.Field) { g.P("size += proto.NestedStructureSize(", f.Desc.Number(), ", ", name, "[i])") g.P("}") case f.Desc.IsList(): - g.P("size += proto.Repeated", m.Prefix, "Size(", f.Desc.Number(), ", ", name, ")") + if m.RepeatedDouble { + g.P("n, _ = proto.Repeated", m.Prefix, "Size(", f.Desc.Number(), ", ", name, ")") + g.P("size += n") + } else { + g.P("size += proto.Repeated", m.Prefix, "Size(", f.Desc.Number(), ", ", name, ")") + } default: g.P("size += proto.", m.Prefix, "Size(", f.Desc.Number(), ", ", name, ")") } @@ -168,20 +178,12 @@ func emitFieldMarshal(g *protogen.GeneratedFile, f *protogen.Field) { switch { case f.Desc.IsList() && f.Desc.Kind() == protoreflect.MessageKind: g.P("for i := range ", name, "{") - g.P("n, err = proto.NestedStructureMarshal(", f.Desc.Number(), ", buf[offset:], ", name, "[i])") - g.P("if err != nil { return nil, err }") - g.P("offset += n") + g.P("offset += proto.NestedStructureMarshal(", f.Desc.Number(), ", buf[offset:], ", name, "[i])") g.P("}") case f.Desc.IsList(): g.P("offset += proto.Repeated", m.Prefix, "Marshal(", f.Desc.Number(), ", buf[offset:], ", name, ")") default: - if m.CanFail { - g.P("n, err = proto.", prefix, "Marshal(", f.Desc.Number(), ", buf[offset:], ", name, ")") - g.P("if err != nil { return nil, err }") - g.P("offset += n") - } else { - g.P("offset += proto.", prefix, "Marshal(", f.Desc.Number(), ", buf[offset:], ", name, ")") - } + g.P("offset += proto.", prefix, "Marshal(", f.Desc.Number(), ", buf[offset:], ", name, ")") } } @@ -194,8 +196,8 @@ func castFieldName(f *protogen.Field) string { } type marshalerDesc struct { - Prefix string - CanFail bool + Prefix string + RepeatedDouble bool } // Unused kinds are commented. @@ -204,19 +206,19 @@ var marshalers = map[protoreflect.Kind]marshalerDesc{ protoreflect.EnumKind: {Prefix: "Enum"}, //protoreflect.Int32Kind: "", //protoreflect.Sint32Kind: "", - protoreflect.Uint32Kind: {Prefix: "UInt32"}, - protoreflect.Int64Kind: {Prefix: "Int64"}, + protoreflect.Uint32Kind: {Prefix: "UInt32", RepeatedDouble: true}, + protoreflect.Int64Kind: {Prefix: "Int64", RepeatedDouble: true}, //protoreflect.Sint64Kind: "", - protoreflect.Uint64Kind: {Prefix: "UInt64"}, + protoreflect.Uint64Kind: {Prefix: "UInt64", RepeatedDouble: true}, //protoreflect.Sfixed32Kind: "", - protoreflect.Fixed32Kind: {Prefix: "Fixed32"}, + protoreflect.Fixed32Kind: {Prefix: "Fixed32", RepeatedDouble: true}, //protoreflect.FloatKind: "", //protoreflect.Sfixed64Kind: "", - protoreflect.Fixed64Kind: {Prefix: "Fixed64"}, + protoreflect.Fixed64Kind: {Prefix: "Fixed64", RepeatedDouble: true}, protoreflect.DoubleKind: {Prefix: "Float64"}, protoreflect.StringKind: {Prefix: "String"}, protoreflect.BytesKind: {Prefix: "Bytes"}, - protoreflect.MessageKind: {Prefix: "NestedStructure", CanFail: true}, + protoreflect.MessageKind: {Prefix: "NestedStructure"}, //protoreflect.GroupKind: "", } From d35e935a9d2dc458447377847be2f61cc6c8b688 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 30 May 2022 21:13:35 +0300 Subject: [PATCH 0992/1196] [#401] test: Randomize value for `oneof` field Signed-off-by: Leonard Lyubich --- internal/rand.go | 12 ++++++++++++ object/test/generate.go | 33 +++++++++++++++++++++++++++++---- session/test/generate.go | 9 ++++++++- 3 files changed, 49 insertions(+), 5 deletions(-) create mode 100644 internal/rand.go diff --git a/internal/rand.go b/internal/rand.go new file mode 100644 index 0000000..23ab1a7 --- /dev/null +++ b/internal/rand.go @@ -0,0 +1,12 @@ +package internal + +import ( + "math/rand" + "time" +) + +// RandUint32 returns random uint32 value [0, max). +func RandUint32(max uint32) uint32 { + rand.Seed(time.Now().UnixNano()) + return rand.Uint32() % max +} diff --git a/object/test/generate.go b/object/test/generate.go index 215ff78..22646f7 100644 --- a/object/test/generate.go +++ b/object/test/generate.go @@ -1,6 +1,7 @@ package objecttest import ( + "github.com/nspcc-dev/neofs-api-go/v2/internal" "github.com/nspcc-dev/neofs-api-go/v2/object" "github.com/nspcc-dev/neofs-api-go/v2/refs" refstest "github.com/nspcc-dev/neofs-api-go/v2/refs/test" @@ -185,7 +186,14 @@ func GenerateGetResponseBody(empty bool) *object.GetResponseBody { m := new(object.GetResponseBody) if !empty { - m.SetObjectPart(GenerateGetObjectPartInit(false)) + switch internal.RandUint32(3) { + case 0: + m.SetObjectPart(GenerateGetObjectPartInit(false)) + case 1: + m.SetObjectPart(GenerateGetObjectPartChunk(false)) + case 2: + m.SetObjectPart(GenerateSplitInfo(false)) + } } return m @@ -232,7 +240,12 @@ func GeneratePutRequestBody(empty bool) *object.PutRequestBody { m := new(object.PutRequestBody) if !empty { - m.SetObjectPart(GeneratePutObjectPartInit(false)) + switch internal.RandUint32(2) { + case 0: + m.SetObjectPart(GeneratePutObjectPartInit(false)) + case 1: + m.SetObjectPart(GeneratePutObjectPartChunk(false)) + } } return m @@ -349,7 +362,14 @@ func GenerateHeadResponseBody(empty bool) *object.HeadResponseBody { m := new(object.HeadResponseBody) if !empty { - m.SetHeaderPart(GenerateHeaderWithSignature(false)) + switch internal.RandUint32(3) { + case 0: + m.SetHeaderPart(GenerateHeaderWithSignature(false)) + case 1: + m.SetHeaderPart(GenerateShortHeader(false)) + case 2: + m.SetHeaderPart(GenerateSplitInfo(false)) + } } return m @@ -504,7 +524,12 @@ func GenerateGetRangeResponseBody(empty bool) *object.GetRangeResponseBody { m := new(object.GetRangeResponseBody) if !empty { - m.SetRangePart(GenerateGetRangePartChunk(false)) + switch internal.RandUint32(2) { + case 0: + m.SetRangePart(GenerateGetRangePartChunk(false)) + case 1: + m.SetRangePart(GenerateSplitInfo(false)) + } } return m diff --git a/session/test/generate.go b/session/test/generate.go index be7cd5f..e040b81 100644 --- a/session/test/generate.go +++ b/session/test/generate.go @@ -2,6 +2,7 @@ package sessiontest import ( acltest "github.com/nspcc-dev/neofs-api-go/v2/acl/test" + "github.com/nspcc-dev/neofs-api-go/v2/internal" refstest "github.com/nspcc-dev/neofs-api-go/v2/refs/test" "github.com/nspcc-dev/neofs-api-go/v2/session" statustest "github.com/nspcc-dev/neofs-api-go/v2/status/test" @@ -165,7 +166,13 @@ func GenerateSessionTokenBody(empty bool) *session.TokenBody { m.SetSessionKey([]byte{2}) m.SetOwnerID(refstest.GenerateOwnerID(false)) m.SetLifetime(GenerateTokenLifetime(false)) - m.SetContext(GenerateObjectSessionContext(false)) + + switch internal.RandUint32(2) { + case 0: + m.SetContext(GenerateObjectSessionContext(false)) + case 1: + m.SetContext(GenerateContainerSessionContext(false)) + } } return m From 02e962f7270ed397c39f22d3d138269b556e41b7 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 30 May 2022 21:15:50 +0300 Subject: [PATCH 0993/1196] [#401] object: Fix `GetRangeResponseBody.FromGRPCMessage` Pass `SplitInfo` field of `GetRangeResponse_Body_SplitInfo` message into `SplitInfo` decoder. Signed-off-by: Leonard Lyubich --- object/convert.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/object/convert.go b/object/convert.go index 0db3dcd..c4b0868 100644 --- a/object/convert.go +++ b/object/convert.go @@ -1832,7 +1832,7 @@ func (r *GetRangeResponseBody) FromGRPCMessage(m grpc.Message) error { if pt != nil { partSplit := new(SplitInfo) r.rngPart = partSplit - err = partSplit.FromGRPCMessage(pt) + err = partSplit.FromGRPCMessage(pt.SplitInfo) } default: err = fmt.Errorf("unknown get range part %T", pt) From c82dcf7e1610c05981146b4a7daf62b771901f9f Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 30 May 2022 21:49:30 +0300 Subject: [PATCH 0994/1196] [#401] internal: Place randomization code in random package Also replace seeding into `init` function. Signed-off-by: Leonard Lyubich --- internal/rand.go | 12 ------------ internal/random/rand.go | 15 +++++++++++++++ object/test/generate.go | 10 +++++----- session/test/generate.go | 4 ++-- 4 files changed, 22 insertions(+), 19 deletions(-) delete mode 100644 internal/rand.go create mode 100644 internal/random/rand.go diff --git a/internal/rand.go b/internal/rand.go deleted file mode 100644 index 23ab1a7..0000000 --- a/internal/rand.go +++ /dev/null @@ -1,12 +0,0 @@ -package internal - -import ( - "math/rand" - "time" -) - -// RandUint32 returns random uint32 value [0, max). -func RandUint32(max uint32) uint32 { - rand.Seed(time.Now().UnixNano()) - return rand.Uint32() % max -} diff --git a/internal/random/rand.go b/internal/random/rand.go new file mode 100644 index 0000000..db2c087 --- /dev/null +++ b/internal/random/rand.go @@ -0,0 +1,15 @@ +package random + +import ( + "math/rand" + "time" +) + +func init() { + rand.Seed(time.Now().UnixNano()) +} + +// Uint32 returns random uint32 value [0, max). +func Uint32(max uint32) uint32 { + return rand.Uint32() % max +} diff --git a/object/test/generate.go b/object/test/generate.go index 22646f7..0c6ffab 100644 --- a/object/test/generate.go +++ b/object/test/generate.go @@ -1,7 +1,7 @@ package objecttest import ( - "github.com/nspcc-dev/neofs-api-go/v2/internal" + "github.com/nspcc-dev/neofs-api-go/v2/internal/random" "github.com/nspcc-dev/neofs-api-go/v2/object" "github.com/nspcc-dev/neofs-api-go/v2/refs" refstest "github.com/nspcc-dev/neofs-api-go/v2/refs/test" @@ -186,7 +186,7 @@ func GenerateGetResponseBody(empty bool) *object.GetResponseBody { m := new(object.GetResponseBody) if !empty { - switch internal.RandUint32(3) { + switch random.Uint32(3) { case 0: m.SetObjectPart(GenerateGetObjectPartInit(false)) case 1: @@ -240,7 +240,7 @@ func GeneratePutRequestBody(empty bool) *object.PutRequestBody { m := new(object.PutRequestBody) if !empty { - switch internal.RandUint32(2) { + switch random.Uint32(2) { case 0: m.SetObjectPart(GeneratePutObjectPartInit(false)) case 1: @@ -362,7 +362,7 @@ func GenerateHeadResponseBody(empty bool) *object.HeadResponseBody { m := new(object.HeadResponseBody) if !empty { - switch internal.RandUint32(3) { + switch random.Uint32(3) { case 0: m.SetHeaderPart(GenerateHeaderWithSignature(false)) case 1: @@ -524,7 +524,7 @@ func GenerateGetRangeResponseBody(empty bool) *object.GetRangeResponseBody { m := new(object.GetRangeResponseBody) if !empty { - switch internal.RandUint32(2) { + switch random.Uint32(2) { case 0: m.SetRangePart(GenerateGetRangePartChunk(false)) case 1: diff --git a/session/test/generate.go b/session/test/generate.go index e040b81..25976bc 100644 --- a/session/test/generate.go +++ b/session/test/generate.go @@ -2,7 +2,7 @@ package sessiontest import ( acltest "github.com/nspcc-dev/neofs-api-go/v2/acl/test" - "github.com/nspcc-dev/neofs-api-go/v2/internal" + "github.com/nspcc-dev/neofs-api-go/v2/internal/random" refstest "github.com/nspcc-dev/neofs-api-go/v2/refs/test" "github.com/nspcc-dev/neofs-api-go/v2/session" statustest "github.com/nspcc-dev/neofs-api-go/v2/status/test" @@ -167,7 +167,7 @@ func GenerateSessionTokenBody(empty bool) *session.TokenBody { m.SetOwnerID(refstest.GenerateOwnerID(false)) m.SetLifetime(GenerateTokenLifetime(false)) - switch internal.RandUint32(2) { + switch random.Uint32(2) { case 0: m.SetContext(GenerateObjectSessionContext(false)) case 1: From 79902c1c6f37eb62f376c579b9945962a1a2ba82 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 3 Jun 2022 16:42:23 +0300 Subject: [PATCH 0995/1196] Release v2.12.2 Signed-off-by: Leonard Lyubich --- CHANGELOG.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index aea832b..2770a5f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,19 @@ # Changelog +## [2.12.2] - 2022-06-03 + +### Added +- `util/protogen` tool to compile Protocol Buffers with stable marshaling + +### Fixed +- `refs.ObjectIDNestedListMarshal` incorrect encoding (#401) +- incorrect conversion of `oneof` field in `GetRangeResponseBody.FromGRPCMessage` (#401) + +### Changed +- Setters don't check call on `nil` (#388) +- `StableMarshal` methods don't return `error` +- `oneof` fields are now randomly initialized in test generators (#401) + ## [2.12.1] - 2022-03-15 ### Fixed @@ -794,3 +808,4 @@ Initial public release [2.11.1]: https://github.com/nspcc-dev/neofs-api-go/compare/v2.11.0...v2.11.1 [2.12.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v2.11.1...v2.12.0 [2.12.1]: https://github.com/nspcc-dev/neofs-api-go/compare/v2.12.0...v2.12.1 +[2.12.2]: https://github.com/nspcc-dev/neofs-api-go/compare/v2.12.1...v2.12.2 From 454b5c0ed7e97784c61bb5492cabd8412e0f864a Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Mon, 20 Jun 2022 13:29:26 +0300 Subject: [PATCH 0996/1196] [#406] protogen: Uncomment control service line Signed-off-by: Evgenii Stratonikov --- util/protogen/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/protogen/main.go b/util/protogen/main.go index 41ed991..68c4da8 100644 --- a/util/protogen/main.go +++ b/util/protogen/main.go @@ -15,7 +15,7 @@ func main() { // continue //} imp := string(f.GoImportPath) - if strings.HasSuffix(imp, "/tree") { // || strings.HasSuffix(imp, "/control") { + if strings.HasSuffix(imp, "/tree") || strings.HasSuffix(imp, "/control") { generateFile(gen, f) } } From f9a91e5f33aeed00233de1f74dbeaa3d92ec78cb Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Wed, 15 Jun 2022 20:30:22 +0300 Subject: [PATCH 0997/1196] [#404] *: Regenerate code after language fixes Signed-off-by: Pavel Karpy --- accounting/grpc/service.pb.go | 4 +- accounting/grpc/service_grpc.pb.go | 4 - accounting/grpc/types.pb.go | 2 +- acl/grpc/types.pb.go | 30 +++--- audit/grpc/types.pb.go | 8 +- container/grpc/service.pb.go | 30 +++--- container/grpc/service_grpc.pb.go | 20 ++-- container/grpc/types.pb.go | 30 +++--- lock/grpc/types.pb.go | 5 +- netmap/grpc/service.pb.go | 4 +- netmap/grpc/service_grpc.pb.go | 24 ++--- netmap/grpc/types.pb.go | 14 +-- object/grpc/service.pb.go | 16 +-- object/grpc/service_grpc.pb.go | 162 +++++++++++++++++++++++++---- object/grpc/types.pb.go | 32 +++--- refs/grpc/types.pb.go | 24 ++--- reputation/grpc/service.pb.go | 14 +-- reputation/grpc/service_grpc.pb.go | 8 +- reputation/grpc/types.pb.go | 8 +- session/grpc/service.pb.go | 2 +- session/grpc/service_grpc.pb.go | 8 +- session/grpc/types.pb.go | 18 ++-- status/grpc/types.pb.go | 51 +++++---- storagegroup/grpc/types.pb.go | 47 +++++---- tombstone/grpc/types.pb.go | 10 +- 25 files changed, 350 insertions(+), 225 deletions(-) diff --git a/accounting/grpc/service.pb.go b/accounting/grpc/service.pb.go index dbb27b1..357547e 100644 --- a/accounting/grpc/service.pb.go +++ b/accounting/grpc/service.pb.go @@ -162,7 +162,7 @@ func (x *BalanceResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { return nil } -// To indicate the account for which the balance is requested, it's identifier +// To indicate the account for which the balance is requested, its identifier // is used. It can be any existing account in NeoFS sidechain `Balance` smart // contract. If omitted, client implementation MUST set it to the request's // signer `OwnerID`. @@ -216,7 +216,7 @@ func (x *BalanceRequest_Body) GetOwnerId() *grpc1.OwnerID { } // The amount of funds in GAS token for the `OwnerID`'s account requested. -// Balance is `Decimal` format to avoid precision issues with rounding. +// Balance is given in the `Decimal` format to avoid precision issues with rounding. type BalanceResponse_Body struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache diff --git a/accounting/grpc/service_grpc.pb.go b/accounting/grpc/service_grpc.pb.go index 8ed1956..7139614 100644 --- a/accounting/grpc/service_grpc.pb.go +++ b/accounting/grpc/service_grpc.pb.go @@ -1,8 +1,4 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. -// versions: -// - protoc-gen-go-grpc v1.2.0 -// - protoc v3.19.4 -// source: accounting/grpc/service.proto package accounting diff --git a/accounting/grpc/types.pb.go b/accounting/grpc/types.pb.go index a36188b..016bdc2 100644 --- a/accounting/grpc/types.pb.go +++ b/accounting/grpc/types.pb.go @@ -32,7 +32,7 @@ type Decimal struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // Number in smallest Token fractions. + // Number in the smallest Token fractions. Value int64 `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"` // Precision value indicating how many smallest fractions can be in one // integer. diff --git a/acl/grpc/types.pb.go b/acl/grpc/types.pb.go index e71a893..cf8114e 100644 --- a/acl/grpc/types.pb.go +++ b/acl/grpc/types.pb.go @@ -29,10 +29,10 @@ const ( Role_ROLE_UNSPECIFIED Role = 0 // User target rule is applied if sender is the owner of the container Role_USER Role = 1 - // System target rule is applied if sender is the storage node within the - // container or inner ring node + // System target rule is applied if sender is a storage node within the + // container or an inner ring node Role_SYSTEM Role = 2 - // Others target rule is applied if sender is not user nor system target + // Others target rule is applied if sender is neither a user nor a system target Role_OTHERS Role = 3 ) @@ -394,16 +394,16 @@ func (x *EACLRecord) GetTargets() []*EACLRecord_Target { return nil } -// Extended ACL rules table. Defined a list of ACL rules additionally to Basic -// ACL. Extended ACL rules can be attached to the container and can be updated +// Extended ACL rules table. A list of ACL rules defined additionally to Basic +// ACL. Extended ACL rules can be attached to a container and can be updated // or may be defined in `BearerToken` structure. Please see the corresponding -// NeoFS Technical Specification's section for detailed description. +// NeoFS Technical Specification section for detailed description. type EACLTable struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // eACL format version. Effectively the version of API library used to create + // eACL format version. Effectively, the version of API library used to create // eACL Table. Version *grpc.Version `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` // Identifier of the container that should use given access control rules @@ -472,8 +472,8 @@ func (x *EACLTable) GetRecords() []*EACLRecord { // used in the similar use cases, like providing authorisation to externally // authenticated party. // -// BearerToken can be issued only by container's owner and must be signed using -// the key associated with container's `OwnerID`. +// BearerToken can be issued only by the container's owner and must be signed using +// the key associated with the container's `OwnerID`. type BearerToken struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -531,7 +531,7 @@ func (x *BearerToken) GetSignature() *grpc.Signature { return nil } -// Filter to check particular properties of the request or object. +// Filter to check particular properties of the request or the object. // // By default `key` field refers to the corresponding object's `Attribute`. // Some Object's header fields can also be accessed by adding `$Object:` @@ -695,17 +695,19 @@ func (x *EACLRecord_Target) GetKeys() [][]byte { return nil } -// Bearer Token body structure contains Extended ACL table issued by container -// owner with additional information preventing token's abuse. +// Bearer Token body structure contains Extended ACL table issued by the container +// owner with additional information preventing token abuse. type BearerToken_Body struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields // Table of Extended ACL rules to use instead of the ones attached to the - // container + // container. If it contains `container_id` field, bearer token is only + // valid for this specific container. Otherwise, any container of the same owner + // is allowed. EaclTable *EACLTable `protobuf:"bytes,1,opt,name=eacl_table,json=eaclTable,proto3" json:"eacl_table,omitempty"` - // `OwnerID` to whom the token was issued. Must match the request + // `OwnerID` defines to whom the token was issued. It must match the request // originator's `OwnerID`. If empty, any token bearer will be accepted. OwnerId *grpc.OwnerID `protobuf:"bytes,2,opt,name=owner_id,json=ownerID,proto3" json:"owner_id,omitempty"` // Token expiration and valid time period parameters diff --git a/audit/grpc/types.pb.go b/audit/grpc/types.pb.go index 64d3206..e5b3773 100644 --- a/audit/grpc/types.pb.go +++ b/audit/grpc/types.pb.go @@ -28,7 +28,7 @@ type DataAuditResult struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // Data Audit Result format version. Effectively the version of API library + // Data Audit Result format version. Effectively, the version of API library // used to report DataAuditResult structure. Version *grpc.Version `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` // Epoch number when the Data Audit was conducted @@ -47,14 +47,14 @@ type DataAuditResult struct { PassSg []*grpc.ObjectID `protobuf:"bytes,8,rep,name=pass_sg,json=passSG,proto3" json:"pass_sg,omitempty"` // List of Storage Groups that failed audit PoR stage FailSg []*grpc.ObjectID `protobuf:"bytes,9,rep,name=fail_sg,json=failSG,proto3" json:"fail_sg,omitempty"` - // Number of sampled objects under audit placed in an optimal way according to + // Number of sampled objects under the audit placed in an optimal way according to // the containers placement policy when checking PoP Hit uint32 `protobuf:"varint,10,opt,name=hit,proto3" json:"hit,omitempty"` - // Number of sampled objects under audit placed in suboptimal way according to + // Number of sampled objects under the audit placed in suboptimal way according to // the containers placement policy, but still at a satisfactory level when // checking PoP Miss uint32 `protobuf:"varint,11,opt,name=miss,proto3" json:"miss,omitempty"` - // Number of sampled objects under audit stored in a way not confirming + // Number of sampled objects under the audit stored inconsistently with the // placement policy or not found at all when checking PoP Fail uint32 `protobuf:"varint,12,opt,name=fail,proto3" json:"fail,omitempty"` // List of storage node public keys that passed at least one PDP diff --git a/container/grpc/service.pb.go b/container/grpc/service.pb.go index dd91394..390261e 100644 --- a/container/grpc/service.pb.go +++ b/container/grpc/service.pb.go @@ -1069,7 +1069,7 @@ func (x *PutRequest_Body) GetSignature() *grpc1.SignatureRFC6979 { // Container put response body contains information about the newly registered // container as seen by `Container` smart contract. `ContainerID` can be // calculated beforehand from the container structure and compared to the one -// returned here to make sure everything was done as expected. +// returned here to make sure everything has been done as expected. type PutResponse_Body struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -1118,8 +1118,8 @@ func (x *PutResponse_Body) GetContainerId() *grpc1.ContainerID { return nil } -// Container removal request body has a signed `ContainerID` as a proof of -// container owner's intent. The signature will be verified by `Container` +// Container removal request body has signed `ContainerID` as a proof of +// the container owner's intent. The signature will be verified by `Container` // smart contract, so signing algorithm must be supported by NeoVM. type DeleteRequest_Body struct { state protoimpl.MessageState @@ -1268,7 +1268,7 @@ func (x *GetRequest_Body) GetContainerId() *grpc1.ContainerID { } // Get container response body does not have container structure signature. It -// was already verified on container creation. +// has been already verified upon container creation. type GetResponse_Body struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -1278,7 +1278,7 @@ type GetResponse_Body struct { Container *Container `protobuf:"bytes,1,opt,name=container,proto3" json:"container,omitempty"` // Signature of a stable-marshalled container according to RFC-6979. Signature *grpc1.SignatureRFC6979 `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` - // Session token if the container was created within a session + // Session token if the container has been created within the session SessionToken *grpc.SessionToken `protobuf:"bytes,3,opt,name=session_token,json=sessionToken,proto3" json:"session_token,omitempty"` } @@ -1440,7 +1440,7 @@ type SetExtendedACLRequest_Body struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // Extended ACL table to set for container + // Extended ACL table to set for the container Eacl *grpc2.EACLTable `protobuf:"bytes,1,opt,name=eacl,proto3" json:"eacl,omitempty"` // Signature of stable-marshalled Extended ACL table according to RFC-6979. Signature *grpc1.SignatureRFC6979 `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` @@ -1493,7 +1493,7 @@ func (x *SetExtendedACLRequest_Body) GetSignature() *grpc1.SignatureRFC6979 { } // `SetExtendedACLResponse` has an empty body because the operation is -// asynchronous and update should be reflected in `Container` smart contract's +// asynchronous and the update should be reflected in `Container` smart contract's // storage after next block is issued in sidechain. type SetExtendedACLResponse_Body struct { state protoimpl.MessageState @@ -1582,9 +1582,9 @@ func (x *GetExtendedACLRequest_Body) GetContainerId() *grpc1.ContainerID { return nil } -// Get Extended ACL Response body can be empty if the requested container did -// not have Extended ACL Table attached or Extended ACL was not allowed at -// container creation. +// Get Extended ACL Response body can be empty if the requested container does +// not have Extended ACL Table attached or Extended ACL has not been allowed at +// the time of container creation. type GetExtendedACLResponse_Body struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -1657,8 +1657,8 @@ type AnnounceUsedSpaceRequest_Body struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // List of announcements. If nodes share several containers, then - // announcements transferred in a batch. + // List of announcements. If nodes share several containers, + // announcements are transferred in a batch. Announcements []*AnnounceUsedSpaceRequest_Body_Announcement `protobuf:"bytes,1,rep,name=announcements,proto3" json:"announcements,omitempty"` } @@ -1701,17 +1701,17 @@ func (x *AnnounceUsedSpaceRequest_Body) GetAnnouncements() []*AnnounceUsedSpaceR return nil } -// Announcement contains used space information about single container. +// Announcement contains used space information for a single container. type AnnounceUsedSpaceRequest_Body_Announcement struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // Epoch number for which container size estimation was produced. + // Epoch number for which the container size estimation was produced. Epoch uint64 `protobuf:"varint,1,opt,name=epoch,proto3" json:"epoch,omitempty"` // Identifier of the container. ContainerId *grpc1.ContainerID `protobuf:"bytes,2,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` - // Used space is a sum of object payload sizes of specified + // Used space is a sum of object payload sizes of a specified // container, stored in the node. It must not include inhumed objects. UsedSpace uint64 `protobuf:"varint,3,opt,name=used_space,json=usedSpace,proto3" json:"used_space,omitempty"` } diff --git a/container/grpc/service_grpc.pb.go b/container/grpc/service_grpc.pb.go index cf9c435..ccb2a2b 100644 --- a/container/grpc/service_grpc.pb.go +++ b/container/grpc/service_grpc.pb.go @@ -1,8 +1,4 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. -// versions: -// - protoc-gen-go-grpc v1.2.0 -// - protoc v3.19.4 -// source: container/grpc/service.proto package container @@ -24,7 +20,7 @@ const _ = grpc.SupportPackageIsVersion7 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 - // verified by Inner Ring nodes. After one more block in sidechain, container + // verified by Inner Ring nodes. After one more block in sidechain, the container // is added into smart contract storage. // // Statuses: @@ -34,7 +30,7 @@ type ContainerServiceClient interface { 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 - // verified by Inner Ring nodes. After one more block in sidechain, container + // verified by Inner Ring nodes. After one more block in sidechain, the container // is added into smart contract storage. // // Statuses: @@ -59,7 +55,7 @@ type ContainerServiceClient interface { // - Common failures (SECTION_FAILURE_COMMON). List(ctx context.Context, in *ListRequest, opts ...grpc.CallOption) (*ListResponse, error) // Invokes 'SetEACL' method of 'Container` smart contract and returns response - // immediately. After one more block in sidechain, Extended ACL changes are + // immediately. After one more block in sidechain, changes in an Extended ACL are // added into smart contract storage. // // Statuses: @@ -77,7 +73,7 @@ type ContainerServiceClient interface { // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ // container not found. GetExtendedACL(ctx context.Context, in *GetExtendedACLRequest, opts ...grpc.CallOption) (*GetExtendedACLResponse, error) - // Announce container used space values for P2P synchronization. + // Announces the space values used by the container for P2P synchronization. // // Statuses: // - **OK** (0, SECTION_SUCCESS): \ @@ -163,7 +159,7 @@ func (c *containerServiceClient) AnnounceUsedSpace(ctx context.Context, in *Anno 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 - // verified by Inner Ring nodes. After one more block in sidechain, container + // verified by Inner Ring nodes. After one more block in sidechain, the container // is added into smart contract storage. // // Statuses: @@ -173,7 +169,7 @@ type ContainerServiceServer interface { 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 - // verified by Inner Ring nodes. After one more block in sidechain, container + // verified by Inner Ring nodes. After one more block in sidechain, the container // is added into smart contract storage. // // Statuses: @@ -198,7 +194,7 @@ type ContainerServiceServer interface { // - Common failures (SECTION_FAILURE_COMMON). List(context.Context, *ListRequest) (*ListResponse, error) // Invokes 'SetEACL' method of 'Container` smart contract and returns response - // immediately. After one more block in sidechain, Extended ACL changes are + // immediately. After one more block in sidechain, changes in an Extended ACL are // added into smart contract storage. // // Statuses: @@ -216,7 +212,7 @@ type ContainerServiceServer interface { // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ // container not found. GetExtendedACL(context.Context, *GetExtendedACLRequest) (*GetExtendedACLResponse, error) - // Announce container used space values for P2P synchronization. + // Announces the space values used by the container for P2P synchronization. // // Statuses: // - **OK** (0, SECTION_SUCCESS): \ diff --git a/container/grpc/types.pb.go b/container/grpc/types.pb.go index 3e2ed0d..269cfb4 100644 --- a/container/grpc/types.pb.go +++ b/container/grpc/types.pb.go @@ -24,22 +24,22 @@ const ( // 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. ID of the container is a 32 byte long SHA256 hash +// 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 sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // Container format version. Effectively the version of API library used to - // create container. + // Container format version. Effectively, the version of API library used to + // create the container. Version *grpc.Version `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` // Identifier of the container owner OwnerId *grpc.OwnerID `protobuf:"bytes,2,opt,name=owner_id,json=ownerID,proto3" 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,proto3" json:"nonce,omitempty"` - // `BasicACL` contains access control rules for owner, system, others groups - // and permission bits for `BearerToken` and `Extended ACL` + // `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,proto3" json:"basic_acl,omitempty"` // Attributes represent immutable container's meta data Attributes []*Container_Attribute `protobuf:"bytes,5,rep,name=attributes,proto3" json:"attributes,omitempty"` @@ -122,8 +122,8 @@ func (x *Container) GetPlacementPolicy() *grpc1.PlacementPolicy { } // `Attribute` is a user-defined Key-Value metadata pair attached to the -// container. Container attributes are immutable. They are set at container -// creation and can never be added or updated. +// 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 @@ -132,14 +132,20 @@ func (x *Container) GetPlacementPolicy() *grpc1.PlacementPolicy { // There are some "well-known" attributes affecting system behaviour: // // * __NEOFS__SUBNET \ -// String ID of container's storage subnet. Container can be attached to -// only one subnet. +// String ID of a container's storage subnet. Any container can be attached to +// one subnet only. // * __NEOFS__NAME \ -// String of human-friendly container name registered as the domain in +// String of a human-friendly container name registered as a domain in // NNS contract. // * __NEOFS__ZONE \ -// String of zone for `__NEOFS__NAME`. Used as TLD of domain name in NNS -// contract. If zone is not specified, use default zone: `container`. +// String of a zone for `__NEOFS__NAME`. Used as a TLD of a domain name in NNS +// contract. If no zone is specified, use default zone: `container`. +// * __NEOFS__DISABLE_HOMOMORPHIC_HASHING \ +// 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 NeoFS 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: // diff --git a/lock/grpc/types.pb.go b/lock/grpc/types.pb.go index 046249d..0a560ec 100644 --- a/lock/grpc/types.pb.go +++ b/lock/grpc/types.pb.go @@ -21,9 +21,10 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -// Lock objects protects a list of objects from being deleted. Lifetime of the +// Lock objects protects a list of objects from being deleted. The lifetime of a // lock object is limited similar to regular objects in -// `__NEOFS__EXPIRATION_EPOCH` attribute. +// `__NEOFS__EXPIRATION_EPOCH` 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 sizeCache protoimpl.SizeCache diff --git a/netmap/grpc/service.pb.go b/netmap/grpc/service.pb.go index 670afc7..93b19ba 100644 --- a/netmap/grpc/service.pb.go +++ b/netmap/grpc/service.pb.go @@ -22,7 +22,7 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -// Get NodeInfo structure from the particular node directly +// Get NodeInfo structure directly from a particular node type LocalNodeInfoRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -162,7 +162,7 @@ func (x *LocalNodeInfoResponse) GetVerifyHeader() *grpc.ResponseVerificationHead return nil } -// Get NetworkInfo structure with the network view from particular node. +// Get NetworkInfo structure with the network view from a particular node. type NetworkInfoRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache diff --git a/netmap/grpc/service_grpc.pb.go b/netmap/grpc/service_grpc.pb.go index e8e5be4..90b598c 100644 --- a/netmap/grpc/service_grpc.pb.go +++ b/netmap/grpc/service_grpc.pb.go @@ -1,8 +1,4 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. -// versions: -// - protoc-gen-go-grpc v1.2.0 -// - protoc v3.19.4 -// source: netmap/grpc/service.proto package netmap @@ -22,11 +18,11 @@ const _ = grpc.SupportPackageIsVersion7 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. type NetmapServiceClient interface { - // Get NodeInfo structure from the particular node directly. Node information - // can be taken from `Netmap` smart contract, but in some cases the one may - // want to get recent information directly, or to talk to the node not yet - // present in `Network Map` to find out what API version can be used for - // further communication. Can also be used to check if node is up and running. + // Get NodeInfo structure from the particular node directly. + // Node information can be taken from `Netmap` smart contract. In some cases, though, + // one may want to get recent information directly or to talk to the node not yet + // present in the `Network Map` to find out what API version can be used for + // further communication. This can be also used to check if a node is up and running. // // Statuses: // - **OK** (0, SECTION_SUCCESS): @@ -72,11 +68,11 @@ func (c *netmapServiceClient) NetworkInfo(ctx context.Context, in *NetworkInfoRe // All implementations should embed UnimplementedNetmapServiceServer // for forward compatibility type NetmapServiceServer interface { - // Get NodeInfo structure from the particular node directly. Node information - // can be taken from `Netmap` smart contract, but in some cases the one may - // want to get recent information directly, or to talk to the node not yet - // present in `Network Map` to find out what API version can be used for - // further communication. Can also be used to check if node is up and running. + // Get NodeInfo structure from the particular node directly. + // Node information can be taken from `Netmap` smart contract. In some cases, though, + // one may want to get recent information directly or to talk to the node not yet + // present in the `Network Map` to find out what API version can be used for + // further communication. This can be also used to check if a node is up and running. // // Statuses: // - **OK** (0, SECTION_SUCCESS): diff --git a/netmap/grpc/types.pb.go b/netmap/grpc/types.pb.go index 4f7b976..53c601d 100644 --- a/netmap/grpc/types.pb.go +++ b/netmap/grpc/types.pb.go @@ -104,7 +104,7 @@ func (Operation) EnumDescriptor() ([]byte, []int) { type Clause int32 const ( - // No modifier defined. Will select nodes from bucket randomly. + // No modifier defined. Nodes will be selected from the bucket randomly Clause_CLAUSE_UNSPECIFIED Clause = 0 // SAME will select only nodes having the same value of bucket attribute Clause_SAME Clause = 1 @@ -206,14 +206,14 @@ func (NodeInfo_State) EnumDescriptor() ([]byte, []int) { return file_netmap_grpc_types_proto_rawDescGZIP(), []int{4, 0} } -// Filter will return the subset of nodes from `NetworkMap` or another filter's -// results, that will satisfy filter's conditions. +// This filter will return the subset of nodes from `NetworkMap` or another filter's +// results that will satisfy filter's conditions. type Filter struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // Name of the filter or a reference to the named filter. '*' means + // Name of the filter or a reference to a named filter. '*' means // application to the whole unfiltered NetworkMap. At top level it's used as a // filter name. At lower levels it's considered to be a reference to another // named filter @@ -309,7 +309,7 @@ type Selector struct { Count uint32 `protobuf:"varint,2,opt,name=count,proto3" json:"count,omitempty"` // Selector modifier showing how to form a bucket Clause Clause `protobuf:"varint,3,opt,name=clause,proto3,enum=neo.fs.v2.netmap.Clause" json:"clause,omitempty"` - // Attribute bucket to select from + // Bucket attribute to select from Attribute string `protobuf:"bytes,4,opt,name=attribute,proto3" json:"attribute,omitempty"` // Filter reference to select from Filter string `protobuf:"bytes,5,opt,name=filter,proto3" json:"filter,omitempty"` @@ -383,7 +383,7 @@ func (x *Selector) GetFilter() string { } // Number of object replicas in a set of nodes from the defined selector. If no -// selector set the root bucket containing all possible nodes will be used by +// selector set, the root bucket containing all possible nodes will be used by // default. type Replica struct { state protoimpl.MessageState @@ -805,7 +805,7 @@ func (x *NetworkInfo) GetNetworkConfig() *NetworkConfig { // automatically from `UN-LOCODE` attribute. // // For detailed description of each well-known attribute please see the -// corresponding section in NeoFS Technical specification. +// corresponding section in NeoFS Technical Specification. type NodeInfo_Attribute struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache diff --git a/object/grpc/service.pb.go b/object/grpc/service.pb.go index f75b580..b282895 100644 --- a/object/grpc/service.pb.go +++ b/object/grpc/service.pb.go @@ -513,12 +513,12 @@ func (x *HeadRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { return nil } -// Tuple of full object header and signature of `ObjectID`. \ +// Tuple of a full object header and signature of an `ObjectID`. \ // Signed `ObjectID` is present to verify full header's authenticity through the // following steps: // -// 1. Calculate `SHA-256` of marshalled `Header` structure -// 2. Check if the resulting hash matched `ObjectID` +// 1. Calculate `SHA-256` of the marshalled `Header` structure +// 2. Check if the resulting hash matches `ObjectID` // 3. Check if `ObjectID` signature in `signature` field is correct type HeaderWithSignature struct { state protoimpl.MessageState @@ -1898,13 +1898,13 @@ func (x *SearchRequest_Body) GetFilters() []*SearchRequest_Body_Filter { return nil } -// Filter structure checks if object header field or attribute content +// Filter structure checks if the object header field or the attribute content // matches a value. // -// If no filters set, search request will return all objects of the +// If no filters are set, search request will return all objects of the // container, including Regular object, Tombstones and Storage Group // objects. Most human users expect to get only object they can directly -// work with. In that case the `$Object:ROOT` filter should be used. +// work with. In that case, `$Object:ROOT` filter should be used. // // By default `key` field refers to the corresponding object's `Attribute`. // Some Object's header fields can also be accessed by adding `$Object:` @@ -1937,10 +1937,10 @@ func (x *SearchRequest_Body) GetFilters() []*SearchRequest_Body_Filter { // properties: // // * $Object:ROOT \ -// Returns only `REGULAR` type objects that are not split or are the top +// Returns only `REGULAR` type objects that are not split or that are the top // level root objects in a split hierarchy. This includes objects not // present physically, like large objects split into smaller objects -// without separate top-level root object. Other type objects like +// without a separate top-level root object. Objects of other types like // StorageGroups and Tombstones will not be shown. This filter may be // useful for listing objects like `ls` command of some virtual file // system. This filter is activated if the `key` exists, disregarding the diff --git a/object/grpc/service_grpc.pb.go b/object/grpc/service_grpc.pb.go index 376d95d..ba4b958 100644 --- a/object/grpc/service_grpc.pb.go +++ b/object/grpc/service_grpc.pb.go @@ -1,8 +1,4 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. -// versions: -// - protoc-gen-go-grpc v1.2.0 -// - protoc v3.19.4 -// source: object/grpc/service.proto package object @@ -23,11 +19,22 @@ const _ = grpc.SupportPackageIsVersion7 // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. type ObjectServiceClient interface { // Receive full object structure, including Headers and payload. Response uses - // gRPC stream. First response message carries object with requested address. + // gRPC stream. First response message carries the object with the requested address. // Chunk messages are parts of the object's payload if it is needed. All - // messages, except the first one, carry payload chunks. Requested object can + // messages, except the first one, carry payload chunks. The requested object can // be restored by concatenation of object message payload and all chunks - // keeping receiving order. + // keeping the receiving order. + // + // Extended headers can change `Get` behaviour: + // * __NEOFS__NETMAP_EPOCH \ + // Will use the requsted version of Network Map for object placement + // calculation. + // * __NEOFS__NETMAP_LOOKUP_DEPTH \ + // Will try older versions (starting from `__NEOFS__NETMAP_EPOCH` if specified or + // the latest one otherwise) of Network Map to find an object until the depth + // limit is reached. + // + // Please refer to detailed `XHeader` description. // // Statuses: // - **OK** (0, SECTION_SUCCESS): \ @@ -49,7 +56,14 @@ type ObjectServiceClient interface { // SHOULD be set. Session token SHOULD be obtained before `PUT` operation (see // session package). Chunk messages are considered by server as a part of an // object payload. All messages, except first one, SHOULD be payload chunks. - // Chunk messages SHOULD be sent in direct order of fragmentation. + // Chunk messages SHOULD be sent in the direct order of fragmentation. + // + // Extended headers can change `Put` behaviour: + // * __NEOFS__NETMAP_EPOCH \ + // Will use the requsted version of Network Map for object placement + // calculation. + // + // Please refer to detailed `XHeader` description. // // Statuses: // - **OK** (0, SECTION_SUCCESS): \ @@ -74,6 +88,13 @@ type ObjectServiceClient interface { // Delete the object from a container. There is no immediate removal // guarantee. Object will be marked for removal and deleted eventually. // + // Extended headers can change `Delete` behaviour: + // * __NEOFS__NETMAP_EPOCH \ + // Will use the requsted version of Network Map for object placement + // calculation. + // + // Please refer to detailed `XHeader` description. + // // Statuses: // - **OK** (0, SECTION_SUCCESS): \ // object has been successfully marked to be removed from the container; @@ -89,7 +110,14 @@ type ObjectServiceClient interface { Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteResponse, error) // Returns the object Headers without data payload. By default full header is // returned. If `main_only` request field is set, the short header with only - // the very minimal information would be returned instead. + // the very minimal information will be returned instead. + // + // Extended headers can change `Head` behaviour: + // * __NEOFS__NETMAP_EPOCH \ + // Will use the requsted version of Network Map for object placement + // calculation. + // + // Please refer to detailed `XHeader` description. // // Statuses: // - **OK** (0, SECTION_SUCCESS): \ @@ -110,6 +138,13 @@ type ObjectServiceClient interface { // Header's filed values. Please see the corresponding NeoFS Technical // Specification section for more details. // + // Extended headers can change `Search` behaviour: + // * __NEOFS__NETMAP_EPOCH \ + // Will use the requsted version of Network Map for object placement + // calculation. + // + // Please refer to detailed `XHeader` description. + // // Statuses: // - **OK** (0, SECTION_SUCCESS): \ // objects have been successfully selected; @@ -123,9 +158,19 @@ type ObjectServiceClient interface { Search(ctx context.Context, in *SearchRequest, opts ...grpc.CallOption) (ObjectService_SearchClient, error) // Get byte range of data payload. Range is set as an (offset, length) tuple. // Like in `Get` method, the response uses gRPC stream. Requested range can be - // restored by concatenation of all received payload chunks keeping receiving + // restored by concatenation of all received payload chunks keeping the receiving // order. // + // Extended headers can change `GetRange` behaviour: + // * __NEOFS__NETMAP_EPOCH \ + // Will use the requsted version of Network Map for object placement + // calculation. + // * __NEOFS__NETMAP_LOOKUP_DEPTH \ + // Will try older versions of Network Map to find an object until the depth + // limit is reached. + // + // Please refer to detailed `XHeader` description. + // // Statuses: // - **OK** (0, SECTION_SUCCESS): \ // data range of the object payload has been successfully read; @@ -140,11 +185,23 @@ type ObjectServiceClient interface { // provided session token has expired; // - **OBJECT_ALREADY_REMOVED** (2052, SECTION_OBJECT): \ // the requested object has been marked as deleted. + // - **OUT_OF_RANGE** (2053, SECTION_OBJECT): \ + // the requested range is out of bounds. GetRange(ctx context.Context, in *GetRangeRequest, opts ...grpc.CallOption) (ObjectService_GetRangeClient, error) // Returns homomorphic or regular hash of object's payload range after // applying XOR operation with the provided `salt`. Ranges are set of (offset, - // length) tuples. Hashes order in response corresponds to ranges order in - // request. Note that hash is calculated for XORed data. + // length) tuples. Hashes order in response corresponds to the ranges order in + // the request. Note that hash is calculated for XORed data. + // + // Extended headers can change `GetRangeHash` behaviour: + // * __NEOFS__NETMAP_EPOCH \ + // Will use the requsted version of Network Map for object placement + // calculation. + // * __NEOFS__NETMAP_LOOKUP_DEPTH \ + // Will try older versions of Network Map to find an object until the depth + // limit is reached. + // + // Please refer to detailed `XHeader` description. // // Statuses: // - **OK** (0, SECTION_SUCCESS): \ @@ -156,6 +213,8 @@ type ObjectServiceClient interface { // access to operation RANGEHASH of the object is denied; // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ // object not found in container; + // - **OUT_OF_RANGE** (2053, SECTION_OBJECT): \ + // the requested range is out of bounds. // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ // provided session token has expired. GetRangeHash(ctx context.Context, in *GetRangeHashRequest, opts ...grpc.CallOption) (*GetRangeHashResponse, error) @@ -331,11 +390,22 @@ func (c *objectServiceClient) GetRangeHash(ctx context.Context, in *GetRangeHash // for forward compatibility type ObjectServiceServer interface { // Receive full object structure, including Headers and payload. Response uses - // gRPC stream. First response message carries object with requested address. + // gRPC stream. First response message carries the object with the requested address. // Chunk messages are parts of the object's payload if it is needed. All - // messages, except the first one, carry payload chunks. Requested object can + // messages, except the first one, carry payload chunks. The requested object can // be restored by concatenation of object message payload and all chunks - // keeping receiving order. + // keeping the receiving order. + // + // Extended headers can change `Get` behaviour: + // * __NEOFS__NETMAP_EPOCH \ + // Will use the requsted version of Network Map for object placement + // calculation. + // * __NEOFS__NETMAP_LOOKUP_DEPTH \ + // Will try older versions (starting from `__NEOFS__NETMAP_EPOCH` if specified or + // the latest one otherwise) of Network Map to find an object until the depth + // limit is reached. + // + // Please refer to detailed `XHeader` description. // // Statuses: // - **OK** (0, SECTION_SUCCESS): \ @@ -357,7 +427,14 @@ type ObjectServiceServer interface { // SHOULD be set. Session token SHOULD be obtained before `PUT` operation (see // session package). Chunk messages are considered by server as a part of an // object payload. All messages, except first one, SHOULD be payload chunks. - // Chunk messages SHOULD be sent in direct order of fragmentation. + // Chunk messages SHOULD be sent in the direct order of fragmentation. + // + // Extended headers can change `Put` behaviour: + // * __NEOFS__NETMAP_EPOCH \ + // Will use the requsted version of Network Map for object placement + // calculation. + // + // Please refer to detailed `XHeader` description. // // Statuses: // - **OK** (0, SECTION_SUCCESS): \ @@ -382,6 +459,13 @@ type ObjectServiceServer interface { // Delete the object from a container. There is no immediate removal // guarantee. Object will be marked for removal and deleted eventually. // + // Extended headers can change `Delete` behaviour: + // * __NEOFS__NETMAP_EPOCH \ + // Will use the requsted version of Network Map for object placement + // calculation. + // + // Please refer to detailed `XHeader` description. + // // Statuses: // - **OK** (0, SECTION_SUCCESS): \ // object has been successfully marked to be removed from the container; @@ -397,7 +481,14 @@ type ObjectServiceServer interface { Delete(context.Context, *DeleteRequest) (*DeleteResponse, error) // Returns the object Headers without data payload. By default full header is // returned. If `main_only` request field is set, the short header with only - // the very minimal information would be returned instead. + // the very minimal information will be returned instead. + // + // Extended headers can change `Head` behaviour: + // * __NEOFS__NETMAP_EPOCH \ + // Will use the requsted version of Network Map for object placement + // calculation. + // + // Please refer to detailed `XHeader` description. // // Statuses: // - **OK** (0, SECTION_SUCCESS): \ @@ -418,6 +509,13 @@ type ObjectServiceServer interface { // Header's filed values. Please see the corresponding NeoFS Technical // Specification section for more details. // + // Extended headers can change `Search` behaviour: + // * __NEOFS__NETMAP_EPOCH \ + // Will use the requsted version of Network Map for object placement + // calculation. + // + // Please refer to detailed `XHeader` description. + // // Statuses: // - **OK** (0, SECTION_SUCCESS): \ // objects have been successfully selected; @@ -431,9 +529,19 @@ type ObjectServiceServer interface { Search(*SearchRequest, ObjectService_SearchServer) error // Get byte range of data payload. Range is set as an (offset, length) tuple. // Like in `Get` method, the response uses gRPC stream. Requested range can be - // restored by concatenation of all received payload chunks keeping receiving + // restored by concatenation of all received payload chunks keeping the receiving // order. // + // Extended headers can change `GetRange` behaviour: + // * __NEOFS__NETMAP_EPOCH \ + // Will use the requsted version of Network Map for object placement + // calculation. + // * __NEOFS__NETMAP_LOOKUP_DEPTH \ + // Will try older versions of Network Map to find an object until the depth + // limit is reached. + // + // Please refer to detailed `XHeader` description. + // // Statuses: // - **OK** (0, SECTION_SUCCESS): \ // data range of the object payload has been successfully read; @@ -448,11 +556,23 @@ type ObjectServiceServer interface { // provided session token has expired; // - **OBJECT_ALREADY_REMOVED** (2052, SECTION_OBJECT): \ // the requested object has been marked as deleted. + // - **OUT_OF_RANGE** (2053, SECTION_OBJECT): \ + // the requested range is out of bounds. GetRange(*GetRangeRequest, ObjectService_GetRangeServer) error // Returns homomorphic or regular hash of object's payload range after // applying XOR operation with the provided `salt`. Ranges are set of (offset, - // length) tuples. Hashes order in response corresponds to ranges order in - // request. Note that hash is calculated for XORed data. + // length) tuples. Hashes order in response corresponds to the ranges order in + // the request. Note that hash is calculated for XORed data. + // + // Extended headers can change `GetRangeHash` behaviour: + // * __NEOFS__NETMAP_EPOCH \ + // Will use the requsted version of Network Map for object placement + // calculation. + // * __NEOFS__NETMAP_LOOKUP_DEPTH \ + // Will try older versions of Network Map to find an object until the depth + // limit is reached. + // + // Please refer to detailed `XHeader` description. // // Statuses: // - **OK** (0, SECTION_SUCCESS): \ @@ -464,6 +584,8 @@ type ObjectServiceServer interface { // access to operation RANGEHASH of the object is denied; // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ // object not found in container; + // - **OUT_OF_RANGE** (2053, SECTION_OBJECT): \ + // the requested range is out of bounds. // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ // provided session token has expired. GetRangeHash(context.Context, *GetRangeHashRequest) (*GetRangeHashResponse, error) diff --git a/object/grpc/types.pb.go b/object/grpc/types.pb.go index 6263a06..83a37ba 100644 --- a/object/grpc/types.pb.go +++ b/object/grpc/types.pb.go @@ -23,7 +23,7 @@ const ( ) // Type of the object payload content. Only `REGULAR` type objects can be split, -// hence `TOMBSTONE`, `STORAGE_GROUP` and `LOCK` payload is limited by maximal +// hence `TOMBSTONE`, `STORAGE_GROUP` and `LOCK` payload is limited by the maximum // object size. // // String presentation of object type is the same as definition: @@ -154,7 +154,7 @@ type ShortHeader struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // Object format version. Effectively the version of API library used to + // Object format version. Effectively, the version of API library used to // create particular object. Version *grpc.Version `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` // Epoch when the object was created @@ -259,7 +259,7 @@ type Header struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // Object format version. Effectively the version of API library used to + // Object format version. Effectively, the version of API library used to // create particular object Version *grpc.Version `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` // Object's container @@ -396,8 +396,8 @@ func (x *Header) GetSplit() *Header_Split { } // Object structure. Object is immutable and content-addressed. It means -// `ObjectID` will change if header or payload changes. It's calculated as a -// hash of header field, which contains hash of object's payload. +// `ObjectID` will change if the header or the payload changes. It's calculated as a +// hash of header field which contains hash of the object's payload. // // For non-regular object types payload format depends on object type specified // in the header. @@ -476,10 +476,10 @@ func (x *Object) GetPayload() []byte { return nil } -// Meta information of split hierarchy for object assembly. With last part -// one can traverse linked list of split hierarchy back to first part and -// assemble original object. With linking object one can assembly object -// straight away from the object parts. +// Meta information of split hierarchy for object assembly. With the last part +// one can traverse linked list of split hierarchy back to the first part and +// assemble the original object. With a linking object one can assemble an object +// right from the object parts. type SplitInfo struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -487,11 +487,11 @@ type SplitInfo struct { // 16 byte UUID used to identify the split object hierarchy parts. SplitId []byte `protobuf:"bytes,1,opt,name=split_id,json=splitId,proto3" json:"split_id,omitempty"` - // Identifier of the last object in split hierarchy parts. It contains - // split header with original object header. + // The identifier of the last object in split hierarchy parts. It contains + // split header with the original object header. LastPart *grpc.ObjectID `protobuf:"bytes,2,opt,name=last_part,json=lastPart,proto3" json:"last_part,omitempty"` - // Identifier of linking object for split hierarchy parts. It contains - // split header with original object header and sorted list of + // The identifier of a linking object for split hierarchy parts. It contains + // split header with the original object header and a sorted list of // object parts. Link *grpc.ObjectID `protobuf:"bytes,3,opt,name=link,proto3" json:"link,omitempty"` } @@ -549,10 +549,10 @@ func (x *SplitInfo) GetLink() *grpc.ObjectID { return nil } -// `Attribute` is a user-defined Key-Value metadata pair attached to the +// `Attribute` is a user-defined Key-Value metadata pair attached to an // object. // -// Key name must be a object-unique valid UTF-8 string. Value can't be empty. +// Key name must be an object-unique valid UTF-8 string. Value can't be empty. // Objects with duplicated attribute names or attributes with empty values // will be considered invalid. // @@ -583,7 +583,7 @@ func (x *SplitInfo) GetLink() *grpc.ObjectID { // MIME Content Type of object's payload // // For detailed description of each well-known attribute please see the -// corresponding section in NeoFS Technical specification. +// corresponding section in NeoFS Technical Specification. type Header_Attribute struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache diff --git a/refs/grpc/types.pb.go b/refs/grpc/types.pb.go index 96f6285..4c19bab 100644 --- a/refs/grpc/types.pb.go +++ b/refs/grpc/types.pb.go @@ -124,7 +124,7 @@ func (ChecksumType) EnumDescriptor() ([]byte, []int) { // Objects in NeoFS are addressed by their ContainerID and ObjectID. // -// String presentation of `Address` is the concatenation of string encoded +// String presentation of `Address` is a concatenation of string encoded // `ContainerID` and `ObjectID` delimited by '/' character. type Address struct { state protoimpl.MessageState @@ -184,17 +184,17 @@ func (x *Address) GetObjectId() *ObjectID { } // NeoFS Object unique identifier. Objects are immutable and content-addressed. -// It means `ObjectID` will change if `header` or `payload` changes. +// It means `ObjectID` will change if the `header` or the `payload` changes. // // `ObjectID` is a 32 byte long // [SHA256](https://csrc.nist.gov/publications/detail/fips/180/4/final) hash of -// object's `header` field, which, in it's turn, contains hash of object's +// the object's `header` field, which, in it's turn, contains the hash of the object's // payload. // -// String presentation is +// String presentation is a // [base58](https://tools.ietf.org/html/draft-msporny-base58-02) encoded string. // -// JSON value will be the data encoded as a string using standard base64 +// JSON value will be data encoded as a string using standard base64 // encoding with paddings. Either // [standard](https://tools.ietf.org/html/rfc4648#section-4) or // [URL-safe](https://tools.ietf.org/html/rfc4648#section-5) base64 encoding @@ -254,10 +254,10 @@ func (x *ObjectID) GetValue() []byte { // [SHA256](https://csrc.nist.gov/publications/detail/fips/180/4/final) hash of // stable-marshalled container message. // -// String presentation is +// String presentation is a // [base58](https://tools.ietf.org/html/draft-msporny-base58-02) encoded string. // -// JSON value will be the data encoded as a string using standard base64 +// JSON value will be data encoded as a string using standard base64 // encoding with paddings. Either // [standard](https://tools.ietf.org/html/rfc4648#section-4) or // [URL-safe](https://tools.ietf.org/html/rfc4648#section-5) base64 encoding @@ -317,10 +317,10 @@ func (x *ContainerID) GetValue() []byte { // `OwnerID` is a 25 bytes sequence starting with Neo version prefix byte // followed by 20 bytes of ScrptHash and 4 bytes of checksum. // -// String presentation is [Base58 +// String presentation is a [Base58 // Check](https://en.bitcoin.it/wiki/Base58Check_encoding) Encoded string. // -// JSON value will be the data encoded as a string using standard base64 +// JSON value will be data encoded as a string using standard base64 // encoding with paddings. Either // [standard](https://tools.ietf.org/html/rfc4648#section-4) or // [URL-safe](https://tools.ietf.org/html/rfc4648#section-5) base64 encoding @@ -377,7 +377,7 @@ func (x *OwnerID) GetValue() []byte { // // String representation of a value is base-10 integer. // -// JSON representation is an object containing single `value` number field. +// JSON representation is an object containing a single `value` number field. type SubnetID struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -429,7 +429,7 @@ func (x *SubnetID) GetValue() uint32 { // API version used by a node. // // String presentation is a Semantic Versioning 2.0.0 compatible version string -// with 'v' prefix. I.e. `vX.Y`, where `X` - major number, `Y` - minor number. +// with 'v' prefix. i.e. `vX.Y`, where `X` is the major number, `Y` is the minor number. type Version struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -613,7 +613,7 @@ func (x *SignatureRFC6979) GetSign() []byte { } // Checksum message. -// Depending on checksum algorithm type the string presentation may vary: +// Depending on checksum algorithm type, the string presentation may vary: // // * TZ \ // Hex encoded string without `0x` prefix diff --git a/reputation/grpc/service.pb.go b/reputation/grpc/service.pb.go index 865de18..719ad5c 100644 --- a/reputation/grpc/service.pb.go +++ b/reputation/grpc/service.pb.go @@ -91,7 +91,7 @@ func (x *AnnounceLocalTrustRequest) GetVerifyHeader() *grpc.RequestVerificationH return nil } -// Node's local trust information announce response. +// Node's local trust information announcement response. type AnnounceLocalTrustResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -231,7 +231,7 @@ func (x *AnnounceIntermediateResultRequest) GetVerifyHeader() *grpc.RequestVerif return nil } -// Intermediate global trust information announce response. +// Intermediate global trust information announcement response. type AnnounceIntermediateResultResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -311,7 +311,7 @@ type AnnounceLocalTrustRequest_Body struct { Epoch uint64 `protobuf:"varint,1,opt,name=epoch,proto3" json:"epoch,omitempty"` // List of normalized local trust values to other NeoFS nodes. The value // is calculated according to EigenTrust++ algorithm and must be a - // floating point number in the [0;1] range. + // floating point number in [0;1] range. Trusts []*Trust `protobuf:"bytes,2,rep,name=trusts,proto3" json:"trusts,omitempty"` } @@ -361,9 +361,9 @@ func (x *AnnounceLocalTrustRequest_Body) GetTrusts() []*Trust { return nil } -// Response to the node's local trust information announce has an empty body +// Response to the node's local trust information announcement has an empty body // because the trust exchange operation is asynchronous. If Trust information -// will not pass sanity checks it is silently ignored. +// does not pass sanity checks, it is silently ignored. type AnnounceLocalTrustResponse_Body struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -469,9 +469,9 @@ func (x *AnnounceIntermediateResultRequest_Body) GetTrust() *PeerToPeerTrust { return nil } -// Response to the node's intermediate global trust information announce has +// Response to the node's intermediate global trust information announcement has // an empty body because the trust exchange operation is asynchronous. If -// Trust information will not pass sanity checks it is silently ignored. +// Trust information does not pass sanity checks, it is silently ignored. type AnnounceIntermediateResultResponse_Body struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache diff --git a/reputation/grpc/service_grpc.pb.go b/reputation/grpc/service_grpc.pb.go index 1bd9b79..bf93cb9 100644 --- a/reputation/grpc/service_grpc.pb.go +++ b/reputation/grpc/service_grpc.pb.go @@ -1,8 +1,4 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. -// versions: -// - protoc-gen-go-grpc v1.2.0 -// - protoc v3.19.4 -// source: reputation/grpc/service.proto package reputation @@ -29,7 +25,7 @@ type ReputationServiceClient interface { // local trust has been successfully announced; // - Common failures (SECTION_FAILURE_COMMON). AnnounceLocalTrust(ctx context.Context, in *AnnounceLocalTrustRequest, opts ...grpc.CallOption) (*AnnounceLocalTrustResponse, error) - // Announces the intermediate result of the iterative algorithm for + // Announce the intermediate result of the iterative algorithm for // calculating the global reputation of the node in NeoFS network. // // Statuses: @@ -76,7 +72,7 @@ type ReputationServiceServer interface { // local trust has been successfully announced; // - Common failures (SECTION_FAILURE_COMMON). AnnounceLocalTrust(context.Context, *AnnounceLocalTrustRequest) (*AnnounceLocalTrustResponse, error) - // Announces the intermediate result of the iterative algorithm for + // Announce the intermediate result of the iterative algorithm for // calculating the global reputation of the node in NeoFS network. // // Statuses: diff --git a/reputation/grpc/types.pb.go b/reputation/grpc/types.pb.go index b27aa42..2c6253f 100644 --- a/reputation/grpc/types.pb.go +++ b/reputation/grpc/types.pb.go @@ -21,13 +21,13 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -// NeoFS unique peer identifier is 33 byte long compressed public key of the +// NeoFS unique peer identifier is a 33 byte long compressed public key of the // node, the same as the one stored in the network map. // -// String presentation is +// String presentation is a // [base58](https://tools.ietf.org/html/draft-msporny-base58-02) encoded string. // -// JSON value will be the data encoded as a string using standard base64 +// JSON value will be data encoded as a string using standard base64 // encoding with paddings. Either // [standard](https://tools.ietf.org/html/rfc4648#section-4) or // [URL-safe](https://tools.ietf.org/html/rfc4648#section-5) base64 encoding @@ -202,7 +202,7 @@ type GlobalTrust struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // Message format version. Effectively the version of API library used to create + // Message format version. Effectively, the version of API library used to create // the message. Version *grpc.Version `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` // Message body diff --git a/session/grpc/service.pb.go b/session/grpc/service.pb.go index 33510ad..b8a93cf 100644 --- a/session/grpc/service.pb.go +++ b/session/grpc/service.pb.go @@ -27,7 +27,7 @@ type CreateRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // Body of create session token request message. + // Body of a create session token request message. Body *CreateRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` // Carries request meta information. Header data is used only to regulate // message transport and does not affect request execution. diff --git a/session/grpc/service_grpc.pb.go b/session/grpc/service_grpc.pb.go index 787a564..d2f6894 100644 --- a/session/grpc/service_grpc.pb.go +++ b/session/grpc/service_grpc.pb.go @@ -1,8 +1,4 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. -// versions: -// - protoc-gen-go-grpc v1.2.0 -// - protoc v3.19.4 -// source: session/grpc/service.proto package session @@ -22,7 +18,7 @@ const _ = grpc.SupportPackageIsVersion7 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. type SessionServiceClient interface { - // Opens a new session between two peers. + // Open a new session between two peers. // // Statuses: // - **OK** (0, SECTION_SUCCESS): @@ -52,7 +48,7 @@ func (c *sessionServiceClient) Create(ctx context.Context, in *CreateRequest, op // All implementations should embed UnimplementedSessionServiceServer // for forward compatibility type SessionServiceServer interface { - // Opens a new session between two peers. + // Open a new session between two peers. // // Statuses: // - **OK** (0, SECTION_SUCCESS): diff --git a/session/grpc/types.pb.go b/session/grpc/types.pb.go index eacccfa..0d76bdf 100644 --- a/session/grpc/types.pb.go +++ b/session/grpc/types.pb.go @@ -340,10 +340,10 @@ func (x *SessionToken) GetSignature() *grpc.Signature { return nil } -// Extended headers for Request/Response. May contain any user-defined headers +// Extended headers for Request/Response. They may contain any user-defined headers // to be interpreted on application level. // -// Key name must be unique valid UTF-8 string. Value can't be empty. Requests or +// Key name must be a unique valid UTF-8 string. Value can't be empty. Requests or // Responses with duplicated header names or headers with empty values will be // considered invalid. // @@ -356,9 +356,9 @@ func (x *SessionToken) GetSignature() *grpc.Signature { // current epoch only will be used. // * __NEOFS__NETMAP_LOOKUP_DEPTH \ // If object can't be found using current epoch's netmap, this header limits -// how many past epochs back the node can lookup. The `value` is string -// encoded `uint64` in decimal presentation. If set to '0' or not set, the -// current epoch only will be used. +// how many past epochs the node can look up through. The `value` is string +// encoded `uint64` in decimal presentation. If set to '0' or not set, only the +// current epoch will be used. type XHeader struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -624,13 +624,13 @@ func (x *ResponseMetaHeader) GetStatus() *grpc2.Status { return nil } -// Verification info for request signed by all intermediate nodes. +// Verification info for the request signed by all intermediate nodes. type RequestVerificationHeader struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // Request Body signature. Should be generated once by request initiator. + // Request Body signature. Should be generated once by the request initiator. BodySignature *grpc.Signature `protobuf:"bytes,1,opt,name=body_signature,json=bodySignature,proto3" json:"body_signature,omitempty"` // Request Meta signature is added and signed by each intermediate node MetaSignature *grpc.Signature `protobuf:"bytes,2,opt,name=meta_signature,json=metaSignature,proto3" json:"meta_signature,omitempty"` @@ -700,13 +700,13 @@ func (x *RequestVerificationHeader) GetOrigin() *RequestVerificationHeader { return nil } -// Verification info for response signed by all intermediate nodes +// Verification info for the response signed by all intermediate nodes type ResponseVerificationHeader struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // Response Body signature. Should be generated once by answering node. + // Response Body signature. Should be generated once by an answering node. BodySignature *grpc.Signature `protobuf:"bytes,1,opt,name=body_signature,json=bodySignature,proto3" json:"body_signature,omitempty"` // Response Meta signature is added and signed by each intermediate node MetaSignature *grpc.Signature `protobuf:"bytes,2,opt,name=meta_signature,json=metaSignature,proto3" json:"meta_signature,omitempty"` diff --git a/status/grpc/types.pb.go b/status/grpc/types.pb.go index 168e183..e05fafd 100644 --- a/status/grpc/types.pb.go +++ b/status/grpc/types.pb.go @@ -198,6 +198,8 @@ const ( Object_LOCK_NON_REGULAR_OBJECT Object = 3 // [**2052**] Object has been marked deleted. Object_OBJECT_ALREADY_REMOVED Object = 4 + // [**2053**] Invalid range has been requested for an object. + Object_OUT_OF_RANGE Object = 5 ) // Enum value maps for Object. @@ -208,6 +210,7 @@ var ( 2: "LOCKED", 3: "LOCK_NON_REGULAR_OBJECT", 4: "OBJECT_ALREADY_REMOVED", + 5: "OUT_OF_RANGE", } Object_value = map[string]int32{ "ACCESS_DENIED": 0, @@ -215,6 +218,7 @@ var ( "LOCKED": 2, "LOCK_NON_REGULAR_OBJECT": 3, "OBJECT_ALREADY_REMOVED": 4, + "OUT_OF_RANGE": 5, } ) @@ -357,12 +361,12 @@ func (Session) EnumDescriptor() ([]byte, []int) { // // All outcomes are divided into successful and failed, which corresponds // to the success or failure of the operation. The definition of success -// follows from the semantics of RPC and the description of its purpose. -// The server must not attach code that is the opposite of outcome type. +// follows the semantics of RPC and the description of its purpose. +// The server must not attach code that is the opposite of the outcome type. // // See the set of return codes in the description for calls. // -// Each status can carry developer-facing error message. It should be human +// Each status can carry a developer-facing error message. It should be a human // readable text in English. The server should not transmit (and the client // should not expect) useful information in the message. Field `details` // should make the return more detailed. @@ -523,26 +527,27 @@ var file_status_grpc_types_proto_rawDesc = []byte{ 0x0a, 0x0a, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x46, 0x61, 0x69, 0x6c, 0x12, 0x0c, 0x0a, 0x08, 0x49, 0x4e, 0x54, 0x45, 0x52, 0x4e, 0x41, 0x4c, 0x10, 0x00, 0x12, 0x16, 0x0a, 0x12, 0x57, 0x52, 0x4f, 0x4e, 0x47, 0x5f, 0x4d, 0x41, 0x47, 0x49, 0x43, 0x5f, 0x4e, 0x55, 0x4d, 0x42, 0x45, 0x52, - 0x10, 0x01, 0x2a, 0x76, 0x0a, 0x06, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x11, 0x0a, 0x0d, - 0x41, 0x43, 0x43, 0x45, 0x53, 0x53, 0x5f, 0x44, 0x45, 0x4e, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, - 0x14, 0x0a, 0x10, 0x4f, 0x42, 0x4a, 0x45, 0x43, 0x54, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x46, 0x4f, - 0x55, 0x4e, 0x44, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x4c, 0x4f, 0x43, 0x4b, 0x45, 0x44, 0x10, - 0x02, 0x12, 0x1b, 0x0a, 0x17, 0x4c, 0x4f, 0x43, 0x4b, 0x5f, 0x4e, 0x4f, 0x4e, 0x5f, 0x52, 0x45, - 0x47, 0x55, 0x4c, 0x41, 0x52, 0x5f, 0x4f, 0x42, 0x4a, 0x45, 0x43, 0x54, 0x10, 0x03, 0x12, 0x1a, - 0x0a, 0x16, 0x4f, 0x42, 0x4a, 0x45, 0x43, 0x54, 0x5f, 0x41, 0x4c, 0x52, 0x45, 0x41, 0x44, 0x59, - 0x5f, 0x52, 0x45, 0x4d, 0x4f, 0x56, 0x45, 0x44, 0x10, 0x04, 0x2a, 0x24, 0x0a, 0x09, 0x43, 0x6f, - 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x12, 0x17, 0x0a, 0x13, 0x43, 0x4f, 0x4e, 0x54, 0x41, - 0x49, 0x4e, 0x45, 0x52, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x46, 0x4f, 0x55, 0x4e, 0x44, 0x10, 0x00, - 0x2a, 0x31, 0x0a, 0x07, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x13, 0x0a, 0x0f, 0x54, - 0x4f, 0x4b, 0x45, 0x4e, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x46, 0x4f, 0x55, 0x4e, 0x44, 0x10, 0x00, - 0x12, 0x11, 0x0a, 0x0d, 0x54, 0x4f, 0x4b, 0x45, 0x4e, 0x5f, 0x45, 0x58, 0x50, 0x49, 0x52, 0x45, - 0x44, 0x10, 0x01, 0x42, 0x56, 0x5a, 0x37, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, - 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, - 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x73, 0x74, 0x61, 0x74, - 0x75, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0xaa, 0x02, - 0x1a, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, - 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, + 0x10, 0x01, 0x2a, 0x88, 0x01, 0x0a, 0x06, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x11, 0x0a, + 0x0d, 0x41, 0x43, 0x43, 0x45, 0x53, 0x53, 0x5f, 0x44, 0x45, 0x4e, 0x49, 0x45, 0x44, 0x10, 0x00, + 0x12, 0x14, 0x0a, 0x10, 0x4f, 0x42, 0x4a, 0x45, 0x43, 0x54, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x46, + 0x4f, 0x55, 0x4e, 0x44, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x4c, 0x4f, 0x43, 0x4b, 0x45, 0x44, + 0x10, 0x02, 0x12, 0x1b, 0x0a, 0x17, 0x4c, 0x4f, 0x43, 0x4b, 0x5f, 0x4e, 0x4f, 0x4e, 0x5f, 0x52, + 0x45, 0x47, 0x55, 0x4c, 0x41, 0x52, 0x5f, 0x4f, 0x42, 0x4a, 0x45, 0x43, 0x54, 0x10, 0x03, 0x12, + 0x1a, 0x0a, 0x16, 0x4f, 0x42, 0x4a, 0x45, 0x43, 0x54, 0x5f, 0x41, 0x4c, 0x52, 0x45, 0x41, 0x44, + 0x59, 0x5f, 0x52, 0x45, 0x4d, 0x4f, 0x56, 0x45, 0x44, 0x10, 0x04, 0x12, 0x10, 0x0a, 0x0c, 0x4f, + 0x55, 0x54, 0x5f, 0x4f, 0x46, 0x5f, 0x52, 0x41, 0x4e, 0x47, 0x45, 0x10, 0x05, 0x2a, 0x24, 0x0a, + 0x09, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x12, 0x17, 0x0a, 0x13, 0x43, 0x4f, + 0x4e, 0x54, 0x41, 0x49, 0x4e, 0x45, 0x52, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x46, 0x4f, 0x55, 0x4e, + 0x44, 0x10, 0x00, 0x2a, 0x31, 0x0a, 0x07, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x13, + 0x0a, 0x0f, 0x54, 0x4f, 0x4b, 0x45, 0x4e, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x46, 0x4f, 0x55, 0x4e, + 0x44, 0x10, 0x00, 0x12, 0x11, 0x0a, 0x0d, 0x54, 0x4f, 0x4b, 0x45, 0x4e, 0x5f, 0x45, 0x58, 0x50, + 0x49, 0x52, 0x45, 0x44, 0x10, 0x01, 0x42, 0x56, 0x5a, 0x37, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, + 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, + 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x73, + 0x74, 0x61, 0x74, 0x75, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x73, 0x74, 0x61, 0x74, 0x75, + 0x73, 0xaa, 0x02, 0x1a, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, + 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/storagegroup/grpc/types.pb.go b/storagegroup/grpc/types.pb.go index e0fd05c..de7570a 100644 --- a/storagegroup/grpc/types.pb.go +++ b/storagegroup/grpc/types.pb.go @@ -22,9 +22,15 @@ const ( ) // StorageGroup keeps verification information for Data Audit sessions. Objects -// that require payed storage guaranties are gathered in `StorageGroups` with -// additional information used for proof of storage. `StorageGroup` only +// that require paid storage guarantees are gathered in `StorageGroups` with +// additional information used for the proof of storage. `StorageGroup` only // contains objects from the same container. +// +// Being an object payload, StorageGroup may have expiration Epoch set with +// `__NEOFS__EXPIRATION_EPOCH` well-known attribute. When expired, StorageGroup +// will be ignored by InnerRing nodes during Data Audit cycles and will be +// deleted by Storage Nodes. +// type StorageGroup struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -36,9 +42,11 @@ type StorageGroup struct { // group members. The order of concatenation is the same as the order of the // members in the `members` field. ValidationHash *grpc.Checksum `protobuf:"bytes,2,opt,name=validation_hash,json=validationHash,proto3" json:"validation_hash,omitempty"` - // Last NeoFS epoch number of the storage group lifetime + // DEPRECATED. Last NeoFS epoch number of the storage group lifetime + // + // Deprecated: Do not use. ExpirationEpoch uint64 `protobuf:"varint,3,opt,name=expiration_epoch,json=expirationEpoch,proto3" json:"expiration_epoch,omitempty"` - // Strictly ordered list of storage group member objects + // Strictly ordered list of storage group member objects. Members MUST be unique Members []*grpc.ObjectID `protobuf:"bytes,4,rep,name=members,proto3" json:"members,omitempty"` } @@ -88,6 +96,7 @@ func (x *StorageGroup) GetValidationHash() *grpc.Checksum { return nil } +// Deprecated: Do not use. func (x *StorageGroup) GetExpirationEpoch() uint64 { if x != nil { return x.ExpirationEpoch @@ -109,7 +118,7 @@ var file_storagegroup_grpc_types_proto_rawDesc = []byte{ 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x16, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x1a, 0x15, 0x72, 0x65, 0x66, 0x73, 0x2f, 0x67, 0x72, - 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xe2, + 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xe6, 0x01, 0x0a, 0x0c, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x30, 0x0a, 0x14, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x12, 0x76, @@ -118,20 +127,20 @@ var file_storagegroup_grpc_types_proto_rawDesc = []byte{ 0x68, 0x61, 0x73, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x52, 0x0e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x48, 0x61, 0x73, 0x68, 0x12, 0x29, 0x0a, 0x10, 0x65, 0x78, 0x70, 0x69, 0x72, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x5f, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0f, - 0x65, 0x78, 0x70, 0x69, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x70, 0x6f, 0x63, 0x68, 0x12, - 0x32, 0x0a, 0x07, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x18, 0x04, 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, 0x68, 0x5a, 0x43, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, - 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, - 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x73, 0x74, 0x6f, 0x72, - 0x61, 0x67, 0x65, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x73, 0x74, - 0x6f, 0x72, 0x61, 0x67, 0x65, 0x67, 0x72, 0x6f, 0x75, 0x70, 0xaa, 0x02, 0x20, 0x4e, 0x65, 0x6f, - 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, - 0x2e, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x62, 0x06, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x48, 0x61, 0x73, 0x68, 0x12, 0x2d, 0x0a, 0x10, 0x65, 0x78, 0x70, 0x69, 0x72, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x5f, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x42, 0x02, + 0x18, 0x01, 0x52, 0x0f, 0x65, 0x78, 0x70, 0x69, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x70, + 0x6f, 0x63, 0x68, 0x12, 0x32, 0x0a, 0x07, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x18, 0x04, + 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, 0x68, 0x5a, 0x43, 0x67, 0x69, 0x74, 0x68, 0x75, + 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, + 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, + 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x2f, 0x67, 0x72, 0x70, + 0x63, 0x3b, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x67, 0x72, 0x6f, 0x75, 0x70, 0xaa, 0x02, + 0x20, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, + 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x47, 0x72, 0x6f, 0x75, + 0x70, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/tombstone/grpc/types.pb.go b/tombstone/grpc/types.pb.go index 421b284..747532b 100644 --- a/tombstone/grpc/types.pb.go +++ b/tombstone/grpc/types.pb.go @@ -21,20 +21,20 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -// Tombstone keeps record of deleted objects for few epochs until they are +// Tombstone keeps record of deleted objects for a few epochs until they are // purged from the NeoFS network. type Tombstone struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // Last NeoFS epoch number of the tombstone lifetime. It's set by tombstone - // creator depending on current NeoFS network settings. Tombstone object + // Last NeoFS epoch number of the tombstone lifetime. It's set by the tombstone + // creator depending on the current NeoFS network settings. A tombstone object // must have the same expiration epoch value in `__NEOFS__EXPIRATION_EPOCH` - // attribute. Otherwise tombstone will be rejected by storage node. + // attribute. Otherwise, the tombstone will be rejected by a storage node. ExpirationEpoch uint64 `protobuf:"varint,1,opt,name=expiration_epoch,json=expirationEpoch,proto3" json:"expiration_epoch,omitempty"` // 16 byte UUID used to identify the split object hierarchy parts. Must be - // unique inside container. All objects participating in the split must + // unique inside a container. All objects participating in the split must // have the same `split_id` value. SplitId []byte `protobuf:"bytes,2,opt,name=split_id,json=splitID,proto3" json:"split_id,omitempty"` // List of objects to be deleted. From dd233c3fbc84a08eb75d22910f43a955259ae762 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Tue, 15 Mar 2022 16:54:47 +0300 Subject: [PATCH 0998/1196] [#386] util/signature: Add WalletConnect API support To avoid introducing new dependency (neo-go), crypto routines are used as in other code. Signed-off-by: Evgenii Stratonikov --- refs/grpc/types.pb.go | 36 +++--- refs/types.go | 1 + util/signature/options.go | 22 ++++ util/signature/sign_test.go | 44 +++++++ util/signature/walletconnect/sign.go | 142 ++++++++++++++++++++++ util/signature/walletconnect/sign_test.go | 113 +++++++++++++++++ 6 files changed, 344 insertions(+), 14 deletions(-) create mode 100644 util/signature/sign_test.go create mode 100644 util/signature/walletconnect/sign.go create mode 100644 util/signature/walletconnect/sign_test.go diff --git a/refs/grpc/types.pb.go b/refs/grpc/types.pb.go index 4c19bab..bc71b57 100644 --- a/refs/grpc/types.pb.go +++ b/refs/grpc/types.pb.go @@ -28,6 +28,10 @@ const ( SignatureScheme_ECDSA_SHA512 SignatureScheme = 0 // Deterministic ECDSA with SHA-256 hashing (RFC 6979) SignatureScheme_ECDSA_RFC6979_SHA256 SignatureScheme = 1 + // Deterministic ECDSA with SHA-256 hashing using WalletConnect API. + // Here the algorithm is the same, but the actual format for forming + // message and signature differs. + SignatureScheme_ECDSA_RFC6979_SHA256_WALLET_CONNECT SignatureScheme = 2 ) // Enum value maps for SignatureScheme. @@ -35,10 +39,12 @@ var ( SignatureScheme_name = map[int32]string{ 0: "ECDSA_SHA512", 1: "ECDSA_RFC6979_SHA256", + 2: "ECDSA_RFC6979_SHA256_WALLET_CONNECT", } SignatureScheme_value = map[string]int32{ - "ECDSA_SHA512": 0, - "ECDSA_RFC6979_SHA256": 1, + "ECDSA_SHA512": 0, + "ECDSA_RFC6979_SHA256": 1, + "ECDSA_RFC6979_SHA256_WALLET_CONNECT": 2, } ) @@ -717,21 +723,23 @@ var file_refs_grpc_types_proto_rawDesc = []byte{ 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x75, 0x6d, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x03, 0x73, 0x75, 0x6d, 0x2a, 0x3d, 0x0a, 0x0f, 0x53, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x03, 0x73, 0x75, 0x6d, 0x2a, 0x66, 0x0a, 0x0f, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x0c, 0x45, 0x43, 0x44, 0x53, 0x41, 0x5f, 0x53, 0x48, 0x41, 0x35, 0x31, 0x32, 0x10, 0x00, 0x12, 0x18, 0x0a, 0x14, 0x45, 0x43, 0x44, 0x53, 0x41, 0x5f, 0x52, 0x46, 0x43, 0x36, 0x39, 0x37, - 0x39, 0x5f, 0x53, 0x48, 0x41, 0x32, 0x35, 0x36, 0x10, 0x01, 0x2a, 0x41, 0x0a, 0x0c, 0x43, 0x68, - 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1d, 0x0a, 0x19, 0x43, 0x48, - 0x45, 0x43, 0x4b, 0x53, 0x55, 0x4d, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, - 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x06, 0x0a, 0x02, 0x54, 0x5a, 0x10, - 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x53, 0x48, 0x41, 0x32, 0x35, 0x36, 0x10, 0x02, 0x42, 0x50, 0x5a, - 0x33, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, - 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, - 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x72, 0x65, 0x66, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, - 0x72, 0x65, 0x66, 0x73, 0xaa, 0x02, 0x18, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, - 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x52, 0x65, 0x66, 0x73, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x39, 0x5f, 0x53, 0x48, 0x41, 0x32, 0x35, 0x36, 0x10, 0x01, 0x12, 0x27, 0x0a, 0x23, 0x45, 0x43, + 0x44, 0x53, 0x41, 0x5f, 0x52, 0x46, 0x43, 0x36, 0x39, 0x37, 0x39, 0x5f, 0x53, 0x48, 0x41, 0x32, + 0x35, 0x36, 0x5f, 0x57, 0x41, 0x4c, 0x4c, 0x45, 0x54, 0x5f, 0x43, 0x4f, 0x4e, 0x4e, 0x45, 0x43, + 0x54, 0x10, 0x02, 0x2a, 0x41, 0x0a, 0x0c, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x54, + 0x79, 0x70, 0x65, 0x12, 0x1d, 0x0a, 0x19, 0x43, 0x48, 0x45, 0x43, 0x4b, 0x53, 0x55, 0x4d, 0x5f, + 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, + 0x10, 0x00, 0x12, 0x06, 0x0a, 0x02, 0x54, 0x5a, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x53, 0x48, + 0x41, 0x32, 0x35, 0x36, 0x10, 0x02, 0x42, 0x50, 0x5a, 0x33, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, + 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, + 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x72, + 0x65, 0x66, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x72, 0x65, 0x66, 0x73, 0xaa, 0x02, 0x18, + 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, + 0x41, 0x50, 0x49, 0x2e, 0x52, 0x65, 0x66, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/refs/types.go b/refs/types.go index 025761d..2d4fec7 100644 --- a/refs/types.go +++ b/refs/types.go @@ -37,6 +37,7 @@ type SignatureScheme uint32 const ( ECDSA_SHA512 SignatureScheme = iota ECDSA_RFC6979_SHA256 + ECDSA_RFC6979_SHA256_WALLET_CONNECT ) type Signature struct { diff --git a/util/signature/options.go b/util/signature/options.go index 903ff66..615b443 100644 --- a/util/signature/options.go +++ b/util/signature/options.go @@ -2,9 +2,11 @@ package signature import ( "crypto/ecdsa" + "encoding/base64" "fmt" "github.com/nspcc-dev/neofs-api-go/v2/refs" + "github.com/nspcc-dev/neofs-api-go/v2/util/signature/walletconnect" crypto "github.com/nspcc-dev/neofs-crypto" ) @@ -24,12 +26,22 @@ func verify(cfg *cfg, data []byte, sig *refs.Signature) error { } pub := crypto.UnmarshalPublicKey(sig.GetKey()) + if pub == nil { + return crypto.ErrEmptyPublicKey + } switch cfg.scheme { case refs.ECDSA_SHA512: return crypto.Verify(pub, data, sig.GetSign()) case refs.ECDSA_RFC6979_SHA256: return crypto.VerifyRFC6979(pub, data, sig.GetSign()) + case refs.ECDSA_RFC6979_SHA256_WALLET_CONNECT: + buf := make([]byte, base64.StdEncoding.EncodedLen(len(data))) + base64.StdEncoding.Encode(buf, data) + if !walletconnect.Verify(pub, buf, sig.GetSign()) { + return crypto.ErrInvalidSignature + } + return nil default: return fmt.Errorf("unsupported signature scheme %s", cfg.scheme) } @@ -41,6 +53,10 @@ func sign(cfg *cfg, key *ecdsa.PrivateKey, data []byte) ([]byte, error) { return crypto.Sign(key, data) case refs.ECDSA_RFC6979_SHA256: return crypto.SignRFC6979(key, data) + case refs.ECDSA_RFC6979_SHA256_WALLET_CONNECT: + buf := make([]byte, base64.StdEncoding.EncodedLen(len(data))) + base64.StdEncoding.Encode(buf, data) + return walletconnect.Sign(key, buf) default: panic(fmt.Sprintf("unsupported scheme %s", cfg.scheme)) } @@ -59,3 +75,9 @@ func WithBuffer(buf []byte) SignOption { c.buffer = buf } } + +func SignWithWalletConnect() SignOption { + return func(c *cfg) { + c.scheme = refs.ECDSA_RFC6979_SHA256_WALLET_CONNECT + } +} diff --git a/util/signature/sign_test.go b/util/signature/sign_test.go new file mode 100644 index 0000000..11ed442 --- /dev/null +++ b/util/signature/sign_test.go @@ -0,0 +1,44 @@ +package signature + +import ( + "crypto/ecdsa" + "crypto/elliptic" + "crypto/rand" + "testing" + + "github.com/nspcc-dev/neofs-api-go/v2/refs" + "github.com/stretchr/testify/require" +) + +type testData struct { + data []byte + sig *refs.Signature +} + +func (t testData) SignedDataSize() int { return len(t.data) } +func (t testData) ReadSignedData(data []byte) ([]byte, error) { + n := copy(data, t.data) + return data[:n], nil +} +func (t testData) GetSignature() *refs.Signature { return t.sig } +func (t *testData) SetSignature(s *refs.Signature) { t.sig = s } + +func TestWalletConnect(t *testing.T) { + testCases := [...][]byte{ + {}, + {0}, + {1, 2}, + {3, 4, 5}, + {6, 7, 8, 9, 10, 11, 12}, + } + + pk, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader) + require.NoError(t, err) + + for _, tc := range testCases { + td := &testData{data: tc} + require.NoError(t, SignData(pk, td, SignWithWalletConnect())) + require.Equal(t, refs.ECDSA_RFC6979_SHA256_WALLET_CONNECT, td.sig.GetScheme()) + require.NoError(t, VerifyData(td)) + } +} diff --git a/util/signature/walletconnect/sign.go b/util/signature/walletconnect/sign.go new file mode 100644 index 0000000..8c49fec --- /dev/null +++ b/util/signature/walletconnect/sign.go @@ -0,0 +1,142 @@ +package walletconnect + +import ( + "crypto/ecdsa" + "crypto/elliptic" + "crypto/rand" + "encoding/binary" + "encoding/hex" + + crypto "github.com/nspcc-dev/neofs-crypto" +) + +const ( + // saltSize is the salt size added to signed message. + saltSize = 16 + // signatureLen is the length of RFC6979 signature. + signatureLen = 64 +) + +// SignedMessage contains mirrors `SignedMessage` struct from the WalletConnect API. +// https://neon.coz.io/wksdk/core/modules.html#SignedMessage +type SignedMessage struct { + Data []byte + Message []byte + PublicKey []byte + Salt []byte +} + +// Sign signs message using WalletConnect API. The returned signature +// contains RFC6979 signature and 16-byte salt. +func Sign(p *ecdsa.PrivateKey, msg []byte) ([]byte, error) { + sm, err := SignMessage(p, msg) + if err != nil { + return nil, err + } + return append(sm.Data, sm.Salt...), nil +} + +// Verify verifies message using WalletConnect API. +func Verify(p *ecdsa.PublicKey, data, sign []byte) bool { + if len(sign) != signatureLen+saltSize { + return false + } + + salt := sign[signatureLen:] + return VerifyMessage(p, SignedMessage{ + Data: sign[:signatureLen], + Message: createMessageWithSalt(data, salt), + Salt: salt, + }) +} + +// SignMessage signs message with a private key and returns structure similar to +// `signMessage` of the WalletConnect API. +// https://github.com/CityOfZion/wallet-connect-sdk/blob/89c236b/packages/wallet-connect-sdk-core/src/index.ts#L496 +// https://github.com/CityOfZion/neon-wallet/blob/1174a9388480e6bbc4f79eb13183c2a573f67ca8/app/context/WalletConnect/helpers.js#L133 +func SignMessage(p *ecdsa.PrivateKey, msg []byte) (SignedMessage, error) { + var salt [saltSize]byte + _, _ = rand.Read(salt[:]) + + msg = createMessageWithSalt(msg, salt[:]) + sign, err := crypto.SignRFC6979(p, msg) + if err != nil { + return SignedMessage{}, err + } + + return SignedMessage{ + Data: sign, + Message: msg, + PublicKey: elliptic.MarshalCompressed(p.Curve, p.X, p.Y), + Salt: salt[:], + }, nil +} + +// VerifyMessage verifies message with a private key and returns structure similar to +// `verifyMessage` of WalletConnect API. +// https://github.com/CityOfZion/wallet-connect-sdk/blob/89c236b/packages/wallet-connect-sdk-core/src/index.ts#L515 +// https://github.com/CityOfZion/neon-wallet/blob/1174a9388480e6bbc4f79eb13183c2a573f67ca8/app/context/WalletConnect/helpers.js#L147 +func VerifyMessage(p *ecdsa.PublicKey, m SignedMessage) bool { + if p == nil { + x, y := elliptic.UnmarshalCompressed(elliptic.P256(), m.PublicKey) + if x == nil || y == nil { + return false + } + p = &ecdsa.PublicKey{ + Curve: elliptic.P256(), + X: x, + Y: y, + } + } + return crypto.VerifyRFC6979(p, m.Message, m.Data) == nil +} + +func createMessageWithSalt(msg, salt []byte) []byte { + // 4 byte prefix + length of the message with salt in bytes + + // + salt + message + 2 byte postfix. + saltedLen := hex.EncodedLen(len(salt)) + len(msg) + data := make([]byte, 4+getVarIntSize(saltedLen)+saltedLen+2) + + n := copy(data, []byte{0x01, 0x00, 0x01, 0xf0}) // fixed prefix + n += putVarUint(data[n:], uint64(saltedLen)) // salt is hex encoded, double its size + n += hex.Encode(data[n:], salt[:]) // for some reason we encode salt in hex + n += copy(data[n:], msg) + copy(data[n:], []byte{0x00, 0x00}) + + return data +} + +// Following functions are copied from github.com/nspcc-dev/neo-go/pkg/io package +// to avoid having another dependency. + +// getVarIntSize returns the size in number of bytes of a variable integer. +// Reference: https://github.com/neo-project/neo/blob/26d04a642ac5a1dd1827dabf5602767e0acba25c/src/neo/IO/Helper.cs#L131 +func getVarIntSize(value int) int { + var size uintptr + + if value < 0xFD { + size = 1 // unit8 + } else if value <= 0xFFFF { + size = 3 // byte + uint16 + } else { + size = 5 // byte + uint32 + } + return int(size) +} + +// putVarUint puts val in varint form to the pre-allocated buffer. +func putVarUint(data []byte, val uint64) int { + if val < 0xfd { + data[0] = byte(val) + return 1 + } + if val <= 0xFFFF { + data[0] = byte(0xfd) + binary.LittleEndian.PutUint16(data[1:], uint16(val)) + return 3 + } + + data[0] = byte(0xfe) + binary.LittleEndian.PutUint32(data[1:], uint32(val)) + return 5 +} diff --git a/util/signature/walletconnect/sign_test.go b/util/signature/walletconnect/sign_test.go new file mode 100644 index 0000000..b83e79f --- /dev/null +++ b/util/signature/walletconnect/sign_test.go @@ -0,0 +1,113 @@ +package walletconnect + +import ( + "crypto/ecdsa" + "crypto/elliptic" + "crypto/rand" + "encoding/hex" + "testing" + + "github.com/stretchr/testify/require" +) + +func TestSignMessage(t *testing.T) { + p1, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader) + require.NoError(t, err) + + msg := []byte("NEO") + result, err := SignMessage(p1, msg) + require.NoError(t, err) + require.Equal(t, elliptic.MarshalCompressed(elliptic.P256(), p1.PublicKey.X, p1.PublicKey.Y), result.PublicKey) + require.Equal(t, saltSize, len(result.Salt)) + require.Equal(t, 64, len(result.Data)) + require.Equal(t, 4+1+16*2+3+2, len(result.Message)) + + require.True(t, VerifyMessage(&p1.PublicKey, result)) + + t.Run("invalid public key", func(t *testing.T) { + p2, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader) + require.NoError(t, err) + require.False(t, VerifyMessage(&p2.PublicKey, result)) + }) + t.Run("invalid signature", func(t *testing.T) { + result := result + result.Data[0] ^= 0xFF + require.False(t, VerifyMessage(&p1.PublicKey, result)) + }) +} + +func TestSign(t *testing.T) { + p1, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader) + require.NoError(t, err) + + msg := []byte("NEO") + sign, err := Sign(p1, msg) + require.NoError(t, err) + require.True(t, Verify(&p1.PublicKey, msg, sign)) + + t.Run("invalid public key", func(t *testing.T) { + p2, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader) + require.NoError(t, err) + require.False(t, Verify(&p2.PublicKey, msg, sign)) + }) + t.Run("invalid signature", func(t *testing.T) { + sign[0] ^= 0xFF + require.False(t, Verify(&p1.PublicKey, msg, sign)) + }) +} + +func TestVerifyNeonWallet(t *testing.T) { + testCases := [...]struct { + publicKey string + data string + salt string + messageHex string + messageOriginal string + }{ + { // Test values from this GIF https://github.com/CityOfZion/neon-wallet/pull/2390 . + publicKey: "02ce6228ba2cb2fc235be93aff9cd5fc0851702eb9791552f60db062f01e3d83f6", + data: "90ab1886ca0bece59b982d9ade8f5598065d651362fb9ce45ad66d0474b89c0b80913c8f0118a282acbdf200a429ba2d81bc52534a53ab41a2c6dfe2f0b4fb1b", + salt: "d41e348afccc2f3ee45cd9f5128b16dc", + messageHex: "010001f05c6434316533343861666363633266336565343563643966353132386231366463436172616c686f2c206d756c65712c206f2062616775697520656820697373756d65726d6f2074616978206c696761646f206e61206d697373e36f3f0000", + messageOriginal: "436172616c686f2c206d756c65712c206f2062616775697520656820697373756d65726d6f2074616978206c696761646f206e61206d697373e36f3f", + }, + { // Test value from wallet connect integration test + publicKey: "03bd9108c0b49f657e9eee50d1399022bd1e436118e5b7529a1b7cd606652f578f", + data: "510caa8cb6db5dedf04d215a064208d64be7496916d890df59aee132db8f2b07532e06f7ea664c4a99e3bcb74b43a35eb9653891b5f8701d2aef9e7526703eaa", + salt: "2c5b189569e92cce12e1c640f23e83ba", + messageHex: "010001f02632633562313839353639653932636365313265316336343066323365383362613132333435360000", + messageOriginal: "313233343536", // ascii string "123456" + }, + { // Test value from wallet connect integration test + publicKey: "03bd9108c0b49f657e9eee50d1399022bd1e436118e5b7529a1b7cd606652f578f", + data: "1e13f248962d8b3b60708b55ddf448d6d6a28c6b43887212a38b00bf6bab695e61261e54451c6e3d5f1f000e5534d166c7ca30f662a296d3a9aafa6d8c173c01", + salt: "58c86b2e74215b4f36b47d731236be3b", + messageHex: "010001f02035386338366232653734323135623466333662343764373331323336626533620000", + messageOriginal: "", // empty string + }, + } + + for _, testCase := range testCases { + rawPub, err := hex.DecodeString(testCase.publicKey) + require.NoError(t, err) + data, err := hex.DecodeString(testCase.data) + require.NoError(t, err) + salt, err := hex.DecodeString(testCase.salt) + require.NoError(t, err) + msg, err := hex.DecodeString(testCase.messageHex) + require.NoError(t, err) + orig, err := hex.DecodeString(testCase.messageOriginal) + require.NoError(t, err) + + require.Equal(t, msg, createMessageWithSalt(orig, salt)) + + sm := SignedMessage{ + Data: data, + Message: msg, + PublicKey: rawPub, + Salt: salt, + } + require.True(t, VerifyMessage(nil, sm)) + } + +} From 1cd3a43d5b326f5bbca7363a2a0d24120edfdd38 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Tue, 28 Jun 2022 16:39:17 +0300 Subject: [PATCH 0999/1196] [#407] *: Regenerate v2.13.0 API Signed-off-by: Pavel Karpy --- refs/grpc/types.pb.go | 3 +-- status/grpc/types.pb.go | 54 +++++++++++++++++++++++------------------ 2 files changed, 31 insertions(+), 26 deletions(-) diff --git a/refs/grpc/types.pb.go b/refs/grpc/types.pb.go index bc71b57..12716d1 100644 --- a/refs/grpc/types.pb.go +++ b/refs/grpc/types.pb.go @@ -29,8 +29,7 @@ const ( // Deterministic ECDSA with SHA-256 hashing (RFC 6979) SignatureScheme_ECDSA_RFC6979_SHA256 SignatureScheme = 1 // Deterministic ECDSA with SHA-256 hashing using WalletConnect API. - // Here the algorithm is the same, but the actual format for forming - // message and signature differs. + // Here the algorithm is the same, but the message format differs. SignatureScheme_ECDSA_RFC6979_SHA256_WALLET_CONNECT SignatureScheme = 2 ) diff --git a/status/grpc/types.pb.go b/status/grpc/types.pb.go index e05fafd..98af29a 100644 --- a/status/grpc/types.pb.go +++ b/status/grpc/types.pb.go @@ -141,6 +141,8 @@ const ( // - [**0**] Magic number of the served NeoFS network (big-endian 64-bit // unsigned integer). CommonFail_WRONG_MAGIC_NUMBER CommonFail = 1 + // [**1026**] Signature verification failure. + CommonFail_SIGNATURE_VERIFICATION_FAIL CommonFail = 2 ) // Enum value maps for CommonFail. @@ -148,10 +150,12 @@ var ( CommonFail_name = map[int32]string{ 0: "INTERNAL", 1: "WRONG_MAGIC_NUMBER", + 2: "SIGNATURE_VERIFICATION_FAIL", } CommonFail_value = map[string]int32{ - "INTERNAL": 0, - "WRONG_MAGIC_NUMBER": 1, + "INTERNAL": 0, + "WRONG_MAGIC_NUMBER": 1, + "SIGNATURE_VERIFICATION_FAIL": 2, } ) @@ -523,31 +527,33 @@ var file_status_grpc_types_proto_rawDesc = []byte{ 0x15, 0x0a, 0x11, 0x53, 0x45, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x43, 0x4f, 0x4e, 0x54, 0x41, 0x49, 0x4e, 0x45, 0x52, 0x10, 0x03, 0x12, 0x13, 0x0a, 0x0f, 0x53, 0x45, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x53, 0x45, 0x53, 0x53, 0x49, 0x4f, 0x4e, 0x10, 0x04, 0x2a, 0x11, 0x0a, 0x07, 0x53, - 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x06, 0x0a, 0x02, 0x4f, 0x4b, 0x10, 0x00, 0x2a, 0x32, + 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x06, 0x0a, 0x02, 0x4f, 0x4b, 0x10, 0x00, 0x2a, 0x53, 0x0a, 0x0a, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x46, 0x61, 0x69, 0x6c, 0x12, 0x0c, 0x0a, 0x08, 0x49, 0x4e, 0x54, 0x45, 0x52, 0x4e, 0x41, 0x4c, 0x10, 0x00, 0x12, 0x16, 0x0a, 0x12, 0x57, 0x52, 0x4f, 0x4e, 0x47, 0x5f, 0x4d, 0x41, 0x47, 0x49, 0x43, 0x5f, 0x4e, 0x55, 0x4d, 0x42, 0x45, 0x52, - 0x10, 0x01, 0x2a, 0x88, 0x01, 0x0a, 0x06, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x11, 0x0a, - 0x0d, 0x41, 0x43, 0x43, 0x45, 0x53, 0x53, 0x5f, 0x44, 0x45, 0x4e, 0x49, 0x45, 0x44, 0x10, 0x00, - 0x12, 0x14, 0x0a, 0x10, 0x4f, 0x42, 0x4a, 0x45, 0x43, 0x54, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x46, - 0x4f, 0x55, 0x4e, 0x44, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x4c, 0x4f, 0x43, 0x4b, 0x45, 0x44, - 0x10, 0x02, 0x12, 0x1b, 0x0a, 0x17, 0x4c, 0x4f, 0x43, 0x4b, 0x5f, 0x4e, 0x4f, 0x4e, 0x5f, 0x52, - 0x45, 0x47, 0x55, 0x4c, 0x41, 0x52, 0x5f, 0x4f, 0x42, 0x4a, 0x45, 0x43, 0x54, 0x10, 0x03, 0x12, - 0x1a, 0x0a, 0x16, 0x4f, 0x42, 0x4a, 0x45, 0x43, 0x54, 0x5f, 0x41, 0x4c, 0x52, 0x45, 0x41, 0x44, - 0x59, 0x5f, 0x52, 0x45, 0x4d, 0x4f, 0x56, 0x45, 0x44, 0x10, 0x04, 0x12, 0x10, 0x0a, 0x0c, 0x4f, - 0x55, 0x54, 0x5f, 0x4f, 0x46, 0x5f, 0x52, 0x41, 0x4e, 0x47, 0x45, 0x10, 0x05, 0x2a, 0x24, 0x0a, - 0x09, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x12, 0x17, 0x0a, 0x13, 0x43, 0x4f, - 0x4e, 0x54, 0x41, 0x49, 0x4e, 0x45, 0x52, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x46, 0x4f, 0x55, 0x4e, - 0x44, 0x10, 0x00, 0x2a, 0x31, 0x0a, 0x07, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x13, - 0x0a, 0x0f, 0x54, 0x4f, 0x4b, 0x45, 0x4e, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x46, 0x4f, 0x55, 0x4e, - 0x44, 0x10, 0x00, 0x12, 0x11, 0x0a, 0x0d, 0x54, 0x4f, 0x4b, 0x45, 0x4e, 0x5f, 0x45, 0x58, 0x50, - 0x49, 0x52, 0x45, 0x44, 0x10, 0x01, 0x42, 0x56, 0x5a, 0x37, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, - 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, - 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x73, - 0x74, 0x61, 0x74, 0x75, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x73, 0x74, 0x61, 0x74, 0x75, - 0x73, 0xaa, 0x02, 0x1a, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, - 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x62, 0x06, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x10, 0x01, 0x12, 0x1f, 0x0a, 0x1b, 0x53, 0x49, 0x47, 0x4e, 0x41, 0x54, 0x55, 0x52, 0x45, 0x5f, + 0x56, 0x45, 0x52, 0x49, 0x46, 0x49, 0x43, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x46, 0x41, 0x49, + 0x4c, 0x10, 0x02, 0x2a, 0x88, 0x01, 0x0a, 0x06, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x11, + 0x0a, 0x0d, 0x41, 0x43, 0x43, 0x45, 0x53, 0x53, 0x5f, 0x44, 0x45, 0x4e, 0x49, 0x45, 0x44, 0x10, + 0x00, 0x12, 0x14, 0x0a, 0x10, 0x4f, 0x42, 0x4a, 0x45, 0x43, 0x54, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, + 0x46, 0x4f, 0x55, 0x4e, 0x44, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x4c, 0x4f, 0x43, 0x4b, 0x45, + 0x44, 0x10, 0x02, 0x12, 0x1b, 0x0a, 0x17, 0x4c, 0x4f, 0x43, 0x4b, 0x5f, 0x4e, 0x4f, 0x4e, 0x5f, + 0x52, 0x45, 0x47, 0x55, 0x4c, 0x41, 0x52, 0x5f, 0x4f, 0x42, 0x4a, 0x45, 0x43, 0x54, 0x10, 0x03, + 0x12, 0x1a, 0x0a, 0x16, 0x4f, 0x42, 0x4a, 0x45, 0x43, 0x54, 0x5f, 0x41, 0x4c, 0x52, 0x45, 0x41, + 0x44, 0x59, 0x5f, 0x52, 0x45, 0x4d, 0x4f, 0x56, 0x45, 0x44, 0x10, 0x04, 0x12, 0x10, 0x0a, 0x0c, + 0x4f, 0x55, 0x54, 0x5f, 0x4f, 0x46, 0x5f, 0x52, 0x41, 0x4e, 0x47, 0x45, 0x10, 0x05, 0x2a, 0x24, + 0x0a, 0x09, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x12, 0x17, 0x0a, 0x13, 0x43, + 0x4f, 0x4e, 0x54, 0x41, 0x49, 0x4e, 0x45, 0x52, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x46, 0x4f, 0x55, + 0x4e, 0x44, 0x10, 0x00, 0x2a, 0x31, 0x0a, 0x07, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, + 0x13, 0x0a, 0x0f, 0x54, 0x4f, 0x4b, 0x45, 0x4e, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x46, 0x4f, 0x55, + 0x4e, 0x44, 0x10, 0x00, 0x12, 0x11, 0x0a, 0x0d, 0x54, 0x4f, 0x4b, 0x45, 0x4e, 0x5f, 0x45, 0x58, + 0x50, 0x49, 0x52, 0x45, 0x44, 0x10, 0x01, 0x42, 0x56, 0x5a, 0x37, 0x67, 0x69, 0x74, 0x68, 0x75, + 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, + 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, + 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x73, 0x74, 0x61, 0x74, + 0x75, 0x73, 0xaa, 0x02, 0x1a, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, + 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( From 417fd3a08b51a48bb30c8d7fe929c62f9c193790 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Wed, 29 Jun 2022 20:20:41 +0300 Subject: [PATCH 1000/1196] [#407] object: Add `OUT_OF_RANGE` status Signed-off-by: Pavel Karpy --- object/status.go | 3 +++ object/status_test.go | 1 + 2 files changed, 4 insertions(+) diff --git a/object/status.go b/object/status.go index dc37ad2..a9a0faa 100644 --- a/object/status.go +++ b/object/status.go @@ -37,6 +37,9 @@ const ( // StatusAlreadyRemoved is a local status.Code value for // OBJECT_ALREADY_REMOVED object failure. StatusAlreadyRemoved + // StatusOutOfRange is a local status.Code value for + // OUT_OF_RANGE object failure. + StatusOutOfRange ) const ( diff --git a/object/status_test.go b/object/status_test.go index 86fcc82..a330a9f 100644 --- a/object/status_test.go +++ b/object/status_test.go @@ -16,6 +16,7 @@ func TestStatusCodes(t *testing.T) { object.StatusLocked, 2050, object.StatusLockNonRegularObject, 2051, object.StatusAlreadyRemoved, 2052, + object.StatusOutOfRange, 2053, ) } From c6f7ab3ef1bfa1dd92913efdbd3149eb65f2be3d Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Wed, 4 May 2022 20:11:22 +0300 Subject: [PATCH 1001/1196] [#399] container: Support homomorphic hash disabling Container could now have "__NEOFS__DISABLE_HOMOMORPHIC_HASHING" well-known attribute. Setting that to "true" means disabling homomorphic hashing for objects that belong to that container, any other cases mean that homomorphic hashing is enabled. Signed-off-by: Pavel Karpy --- container/attributes.go | 57 ++++++++++++++++++++++++++++++++++ container/attributes_test.go | 59 ++++++++++++++++++++++++++++++++++++ 2 files changed, 116 insertions(+) create mode 100644 container/attributes_test.go diff --git a/container/attributes.go b/container/attributes.go index 9f90edb..062e624 100644 --- a/container/attributes.go +++ b/container/attributes.go @@ -12,7 +12,64 @@ const ( // SysAttributeZone is a string of zone for container name. SysAttributeZone = SysAttributePrefix + "ZONE" + + // SysAttributeHomomorphicHashing is a container's homomorphic hashing state. + SysAttributeHomomorphicHashing = SysAttributePrefix + "DISABLE_HOMOMORPHIC_HASHING" ) // SysAttributeZoneDefault is a default value for SysAttributeZone attribute. const SysAttributeZoneDefault = "container" + +const disabledHomomorphicHashingValue = "true" + +// HomomorphicHashingState returns container's homomorphic +// hashing state: +// * true if hashing is enabled; +// * false if hashing is disabled. +// +// All container's attributes must be unique, otherwise behavior +// is undefined. +// +// See also SetHomomorphicHashingState. +func (c Container) HomomorphicHashingState() bool { + for i := range c.attr { + if c.attr[i].GetKey() == SysAttributeHomomorphicHashing { + return c.attr[i].GetValue() != disabledHomomorphicHashingValue + } + } + + return true +} + +// SetHomomorphicHashingState sets homomorphic hashing state for +// container. +// +// All container's attributes must be unique, otherwise behavior +// is undefined. +// +// See also HomomorphicHashingState. +func (c *Container) SetHomomorphicHashingState(enable bool) { + for i := range c.attr { + if c.attr[i].GetKey() == SysAttributeHomomorphicHashing { + if enable { + // approach without allocation/waste + // coping works since the attributes + // order is not important + c.attr[i] = c.attr[len(c.attr)-1] + c.attr = c.attr[:len(c.attr)-1] + } else { + c.attr[i].SetValue(disabledHomomorphicHashingValue) + } + + return + } + } + + if !enable { + attr := Attribute{} + attr.SetKey(SysAttributeHomomorphicHashing) + attr.SetValue(disabledHomomorphicHashingValue) + + c.attr = append(c.attr, attr) + } +} diff --git a/container/attributes_test.go b/container/attributes_test.go new file mode 100644 index 0000000..823445d --- /dev/null +++ b/container/attributes_test.go @@ -0,0 +1,59 @@ +package container_test + +import ( + "testing" + + "github.com/nspcc-dev/neofs-api-go/v2/container" + containertest "github.com/nspcc-dev/neofs-api-go/v2/container/test" + "github.com/stretchr/testify/require" +) + +func TestContainer_HomomorphicHashingDisabled(t *testing.T) { + cnr := containertest.GenerateContainer(false) + + t.Run("defaults", func(t *testing.T) { + require.True(t, cnr.HomomorphicHashingState()) + }) + + t.Run("disabled", func(t *testing.T) { + attr := container.Attribute{} + attr.SetKey(container.SysAttributeHomomorphicHashing) + attr.SetValue("NOT_true") + + cnr.SetAttributes(append(cnr.GetAttributes(), attr)) + require.True(t, cnr.HomomorphicHashingState()) + + attr.SetValue("true") + + cnr.SetAttributes([]container.Attribute{attr}) + require.False(t, cnr.HomomorphicHashingState()) + }) +} + +func TestContainer_SetHomomorphicHashingState(t *testing.T) { + cnr := containertest.GenerateContainer(false) + attrs := cnr.GetAttributes() + attrLen := len(attrs) + + cnr.SetHomomorphicHashingState(true) + + // enabling hashing should not add any new attributes + require.Equal(t, attrLen, len(cnr.GetAttributes())) + require.True(t, cnr.HomomorphicHashingState()) + + cnr.SetHomomorphicHashingState(false) + + // disabling hashing should add exactly one attribute + require.Equal(t, attrLen+1, len(cnr.GetAttributes())) + require.False(t, cnr.HomomorphicHashingState()) + + cnr.SetHomomorphicHashingState(true) + + // enabling hashing should remove 1 attribute if + // hashing was disabled before + require.Equal(t, attrLen, len(cnr.GetAttributes())) + require.True(t, cnr.HomomorphicHashingState()) + + // hashing operations should not change any other attributes + require.ElementsMatch(t, attrs, cnr.GetAttributes()) +} From bb9fc5bfab1403391ad98926b419fa96079f7b45 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Fri, 17 Jun 2022 00:02:16 +0300 Subject: [PATCH 1002/1196] [#405] status: Support signature status Signed-off-by: Pavel Karpy --- status/status.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/status/status.go b/status/status.go index b610b8b..58d3b22 100644 --- a/status/status.go +++ b/status/status.go @@ -59,6 +59,8 @@ const ( Internal Code = iota // WrongMagicNumber is a local Code value for WRONG_MAGIC_NUMBER failure status. WrongMagicNumber + // SignatureVerificationFail is a local Code value for SIGNATURE_VERIFICATION_FAIL status. + SignatureVerificationFail ) const ( From cdce7edc39997c58c70ad651d560ee8f95af1d06 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 4 Jul 2022 12:07:35 +0300 Subject: [PATCH 1003/1196] =?UTF-8?q?Release=20v2.13.0=20-=20Yeonpyeongdo?= =?UTF-8?q?=20(=EC=97=B0=ED=8F=89=EB=8F=84,=20=E5=BB=B6=E5=9D=AA=E5=B3=B6)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Leonard Lyubich --- CHANGELOG.md | 11 +++++++++++ README.md | 1 + accounting/grpc/service_grpc.pb.go | 4 ++++ container/grpc/service_grpc.pb.go | 4 ++++ netmap/grpc/service_grpc.pb.go | 4 ++++ object/grpc/service_grpc.pb.go | 4 ++++ reputation/grpc/service_grpc.pb.go | 4 ++++ session/grpc/service_grpc.pb.go | 4 ++++ 8 files changed, 36 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2770a5f..498fcf6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,15 @@ # Changelog +## [2.13.0] - 2022-07-04 - Yeonpyeongdo (연평도, 延坪島) + +NeoFS API v2.13 support + +### Added +- WalletConnect signature scheme (#386) +- `object.StatusOutOfRange` enum value (#407) +- Functionality to disable homomorphic hashing in container (#399) +- `status.SignatureVerificationFail` enum value (#405) + ## [2.12.2] - 2022-06-03 ### Added @@ -809,3 +819,4 @@ Initial public release [2.12.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v2.11.1...v2.12.0 [2.12.1]: https://github.com/nspcc-dev/neofs-api-go/compare/v2.12.0...v2.12.1 [2.12.2]: https://github.com/nspcc-dev/neofs-api-go/compare/v2.12.1...v2.12.2 +[2.13.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v2.12.2...v2.13.0 diff --git a/README.md b/README.md index 7b2ad6a..5edeb84 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,7 @@ versions. For a more high-level SDK see [NeoFS SDK](https://github.com/nspcc-dev |v1.30.x|[v2.10.0](https://github.com/nspcc-dev/neofs-api/releases/tag/v2.10.0)| |v2.11.x|[v2.11.0](https://github.com/nspcc-dev/neofs-api/releases/tag/v2.11.0)| |v2.12.x|[v2.12.0](https://github.com/nspcc-dev/neofs-api/releases/tag/v2.12.0)| +|v2.13.x|[v2.13.0](https://github.com/nspcc-dev/neofs-api/releases/tag/v2.13.0)| ## Contributing diff --git a/accounting/grpc/service_grpc.pb.go b/accounting/grpc/service_grpc.pb.go index 7139614..8ed1956 100644 --- a/accounting/grpc/service_grpc.pb.go +++ b/accounting/grpc/service_grpc.pb.go @@ -1,4 +1,8 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.2.0 +// - protoc v3.19.4 +// source: accounting/grpc/service.proto package accounting diff --git a/container/grpc/service_grpc.pb.go b/container/grpc/service_grpc.pb.go index ccb2a2b..182755c 100644 --- a/container/grpc/service_grpc.pb.go +++ b/container/grpc/service_grpc.pb.go @@ -1,4 +1,8 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.2.0 +// - protoc v3.19.4 +// source: container/grpc/service.proto package container diff --git a/netmap/grpc/service_grpc.pb.go b/netmap/grpc/service_grpc.pb.go index 90b598c..1ee6b92 100644 --- a/netmap/grpc/service_grpc.pb.go +++ b/netmap/grpc/service_grpc.pb.go @@ -1,4 +1,8 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.2.0 +// - protoc v3.19.4 +// source: netmap/grpc/service.proto package netmap diff --git a/object/grpc/service_grpc.pb.go b/object/grpc/service_grpc.pb.go index ba4b958..d92e1bb 100644 --- a/object/grpc/service_grpc.pb.go +++ b/object/grpc/service_grpc.pb.go @@ -1,4 +1,8 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.2.0 +// - protoc v3.19.4 +// source: object/grpc/service.proto package object diff --git a/reputation/grpc/service_grpc.pb.go b/reputation/grpc/service_grpc.pb.go index bf93cb9..c22d4ed 100644 --- a/reputation/grpc/service_grpc.pb.go +++ b/reputation/grpc/service_grpc.pb.go @@ -1,4 +1,8 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.2.0 +// - protoc v3.19.4 +// source: reputation/grpc/service.proto package reputation diff --git a/session/grpc/service_grpc.pb.go b/session/grpc/service_grpc.pb.go index d2f6894..705c439 100644 --- a/session/grpc/service_grpc.pb.go +++ b/session/grpc/service_grpc.pb.go @@ -1,4 +1,8 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.2.0 +// - protoc v3.19.4 +// source: session/grpc/service.proto package session From 5744605fc6af783783d0bdc7150e3e6c86e1ed39 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Mon, 1 Aug 2022 17:15:59 +0300 Subject: [PATCH 1004/1196] [#409] status: Support EACL_NOT_FOUND status code Signed-off-by: Pavel Karpy --- container/grpc/service_grpc.pb.go | 8 ++++++-- container/status.go | 4 ++++ container/status_test.go | 1 + status/grpc/types.pb.go | 27 ++++++++++++++++----------- 4 files changed, 27 insertions(+), 13 deletions(-) diff --git a/container/grpc/service_grpc.pb.go b/container/grpc/service_grpc.pb.go index 182755c..c8b78d7 100644 --- a/container/grpc/service_grpc.pb.go +++ b/container/grpc/service_grpc.pb.go @@ -75,7 +75,9 @@ type ContainerServiceClient interface { // container eACL has been successfully read; // - Common failures (SECTION_FAILURE_COMMON); // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ - // container not found. + // container not found; + // - **EACL_NOT_FOUND** (3073, SECTION_CONTAINER): \ + // eACL table not found. GetExtendedACL(ctx context.Context, in *GetExtendedACLRequest, opts ...grpc.CallOption) (*GetExtendedACLResponse, error) // Announces the space values used by the container for P2P synchronization. // @@ -214,7 +216,9 @@ type ContainerServiceServer interface { // container eACL has been successfully read; // - Common failures (SECTION_FAILURE_COMMON); // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ - // container not found. + // container not found; + // - **EACL_NOT_FOUND** (3073, SECTION_CONTAINER): \ + // eACL table not found. GetExtendedACL(context.Context, *GetExtendedACLRequest) (*GetExtendedACLResponse, error) // Announces the space values used by the container for P2P synchronization. // diff --git a/container/status.go b/container/status.go index 0535716..7f0edc0 100644 --- a/container/status.go +++ b/container/status.go @@ -25,4 +25,8 @@ const ( // StatusNotFound is a local status.Code value for // CONTAINER_NOT_FOUND container failure. StatusNotFound status.Code = iota + + // StatusEACLNotFound is a local status.Code value for + // EACL_NOT_FOUND failure. + StatusEACLNotFound ) diff --git a/container/status_test.go b/container/status_test.go index 0826d8a..c7d9c91 100644 --- a/container/status_test.go +++ b/container/status_test.go @@ -10,5 +10,6 @@ import ( func TestStatusCodes(t *testing.T) { statustest.TestCodes(t, container.LocalizeFailStatus, container.GlobalizeFail, container.StatusNotFound, 3072, + container.StatusEACLNotFound, 3073, ) } diff --git a/status/grpc/types.pb.go b/status/grpc/types.pb.go index 98af29a..c18467c 100644 --- a/status/grpc/types.pb.go +++ b/status/grpc/types.pb.go @@ -259,15 +259,19 @@ type Container int32 const ( // [**3072**] Container not found. Container_CONTAINER_NOT_FOUND Container = 0 + // [**3073**] eACL table not found. + Container_EACL_NOT_FOUND Container = 1 ) // Enum value maps for Container. var ( Container_name = map[int32]string{ 0: "CONTAINER_NOT_FOUND", + 1: "EACL_NOT_FOUND", } Container_value = map[string]int32{ "CONTAINER_NOT_FOUND": 0, + "EACL_NOT_FOUND": 1, } ) @@ -541,19 +545,20 @@ var file_status_grpc_types_proto_rawDesc = []byte{ 0x52, 0x45, 0x47, 0x55, 0x4c, 0x41, 0x52, 0x5f, 0x4f, 0x42, 0x4a, 0x45, 0x43, 0x54, 0x10, 0x03, 0x12, 0x1a, 0x0a, 0x16, 0x4f, 0x42, 0x4a, 0x45, 0x43, 0x54, 0x5f, 0x41, 0x4c, 0x52, 0x45, 0x41, 0x44, 0x59, 0x5f, 0x52, 0x45, 0x4d, 0x4f, 0x56, 0x45, 0x44, 0x10, 0x04, 0x12, 0x10, 0x0a, 0x0c, - 0x4f, 0x55, 0x54, 0x5f, 0x4f, 0x46, 0x5f, 0x52, 0x41, 0x4e, 0x47, 0x45, 0x10, 0x05, 0x2a, 0x24, + 0x4f, 0x55, 0x54, 0x5f, 0x4f, 0x46, 0x5f, 0x52, 0x41, 0x4e, 0x47, 0x45, 0x10, 0x05, 0x2a, 0x38, 0x0a, 0x09, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x12, 0x17, 0x0a, 0x13, 0x43, 0x4f, 0x4e, 0x54, 0x41, 0x49, 0x4e, 0x45, 0x52, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x46, 0x4f, 0x55, - 0x4e, 0x44, 0x10, 0x00, 0x2a, 0x31, 0x0a, 0x07, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, - 0x13, 0x0a, 0x0f, 0x54, 0x4f, 0x4b, 0x45, 0x4e, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x46, 0x4f, 0x55, - 0x4e, 0x44, 0x10, 0x00, 0x12, 0x11, 0x0a, 0x0d, 0x54, 0x4f, 0x4b, 0x45, 0x4e, 0x5f, 0x45, 0x58, - 0x50, 0x49, 0x52, 0x45, 0x44, 0x10, 0x01, 0x42, 0x56, 0x5a, 0x37, 0x67, 0x69, 0x74, 0x68, 0x75, - 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, - 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, - 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x73, 0x74, 0x61, 0x74, - 0x75, 0x73, 0xaa, 0x02, 0x1a, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, - 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x4e, 0x44, 0x10, 0x00, 0x12, 0x12, 0x0a, 0x0e, 0x45, 0x41, 0x43, 0x4c, 0x5f, 0x4e, 0x4f, 0x54, + 0x5f, 0x46, 0x4f, 0x55, 0x4e, 0x44, 0x10, 0x01, 0x2a, 0x31, 0x0a, 0x07, 0x53, 0x65, 0x73, 0x73, + 0x69, 0x6f, 0x6e, 0x12, 0x13, 0x0a, 0x0f, 0x54, 0x4f, 0x4b, 0x45, 0x4e, 0x5f, 0x4e, 0x4f, 0x54, + 0x5f, 0x46, 0x4f, 0x55, 0x4e, 0x44, 0x10, 0x00, 0x12, 0x11, 0x0a, 0x0d, 0x54, 0x4f, 0x4b, 0x45, + 0x4e, 0x5f, 0x45, 0x58, 0x50, 0x49, 0x52, 0x45, 0x44, 0x10, 0x01, 0x42, 0x56, 0x5a, 0x37, 0x67, + 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, + 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, + 0x2f, 0x76, 0x32, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, + 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0xaa, 0x02, 0x1a, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, + 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x53, 0x74, 0x61, + 0x74, 0x75, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( From 882c4ab76c53d9eb8c41ca9155b25dcd99836946 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Mon, 1 Aug 2022 19:15:52 +0300 Subject: [PATCH 1005/1196] Release v2.13.1 Signed-off-by: Pavel Karpy --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 498fcf6..e40515b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## [2.13.1] - 2022-08-01 + +### Added +- `EACL_NOT_FOUND` status code support (#409) + ## [2.13.0] - 2022-07-04 - Yeonpyeongdo (연평도, 延坪島) NeoFS API v2.13 support @@ -820,3 +825,4 @@ Initial public release [2.12.1]: https://github.com/nspcc-dev/neofs-api-go/compare/v2.12.0...v2.12.1 [2.12.2]: https://github.com/nspcc-dev/neofs-api-go/compare/v2.12.1...v2.12.2 [2.13.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v2.12.2...v2.13.0 +[2.13.1]: https://github.com/nspcc-dev/neofs-api-go/compare/v2.13.0...v2.13.1 From e87a523bb26e98cd769cd77316fd75d6913557f5 Mon Sep 17 00:00:00 2001 From: anikeev-yadro Date: Thu, 11 Aug 2022 15:45:36 +0300 Subject: [PATCH 1006/1196] [#411] Filter version tags for version calculation Signed-off-by: anikeev-yadro --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 32cb13e..9cea12a 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ #!/usr/bin/make -f SHELL = bash -VERSION ?= $(shell git describe --tags --dirty --always) +VERSION ?= $(shell git describe --tags --match "v*" --dirty --always) .PHONY: dep fmts fmt imports protoc test lint version help From 146dd904dd123eab0a06b295788ae6482ff16ad5 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Mon, 15 Aug 2022 15:51:04 +0300 Subject: [PATCH 1007/1196] [#412] go.mod: Update neofs-crypto dependency Fix panic in signature marshaling. Signed-off-by: Evgenii Stratonikov --- go.mod | 2 +- go.sum | 11 ++++------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/go.mod b/go.mod index 830c359..084e639 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/nspcc-dev/neofs-api-go/v2 go 1.16 require ( - github.com/nspcc-dev/neofs-crypto v0.3.0 + github.com/nspcc-dev/neofs-crypto v0.4.0 github.com/stretchr/testify v1.7.0 google.golang.org/grpc v1.41.0 google.golang.org/protobuf v1.27.1 diff --git a/go.sum b/go.sum index daed05b..2a0ec49 100644 --- a/go.sum +++ b/go.sum @@ -41,20 +41,17 @@ github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= -github.com/mr-tron/base58 v1.1.2 h1:ZEw4I2EgPKDJ2iEw0cNmLB3ROrEmkOtXIkaG7wZg+78= -github.com/mr-tron/base58 v1.1.2/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= -github.com/nspcc-dev/neofs-crypto v0.3.0 h1:zlr3pgoxuzrmGCxc5W8dGVfA9Rro8diFvVnBg0L4ifM= -github.com/nspcc-dev/neofs-crypto v0.3.0/go.mod h1:8w16GEJbH6791ktVqHN9YRNH3s9BEEKYxGhlFnp0cDw= +github.com/mr-tron/base58 v1.2.0 h1:T/HDJBh4ZCPbU39/+c3rRvE0uKBQlU27+QI8LJ4t64o= +github.com/mr-tron/base58 v1.2.0/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= +github.com/nspcc-dev/neofs-crypto v0.4.0 h1:5LlrUAM5O0k1+sH/sktBtrgfWtq1pgpDs09fZo+KYi4= +github.com/nspcc-dev/neofs-crypto v0.4.0/go.mod h1:6XJ8kbXgOfevbI2WMruOtI+qUJXNwSGM/E9eClXxPHs= github.com/nspcc-dev/rfc6979 v0.2.0 h1:3e1WNxrN60/6N0DW7+UYisLeZJyfqZTNOjeV/toYvOE= github.com/nspcc-dev/rfc6979 v0.2.0/go.mod h1:exhIh1PdpDC5vQmyEsGvc4YDM/lyQp/452QxGq/UEso= -github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= From f0b3576146348e24d6258b68ef95e486f1c67042 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Mon, 15 Aug 2022 15:53:37 +0300 Subject: [PATCH 1008/1196] [#412] go.mod: Update minimal go version to 1.17 Also, update github actions accordingly. Signed-off-by: Evgenii Stratonikov --- .github/workflows/go.yml | 2 +- go.mod | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 3c9eb3c..6fada0f 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -17,7 +17,7 @@ jobs: runs-on: ubuntu-20.04 strategy: matrix: - go: [ '1.16.x', '1.17.x' ] + go: [ '1.17.x', '1.18.x', '1.19.x' ] steps: - name: Setup go uses: actions/setup-go@v2 diff --git a/go.mod b/go.mod index 084e639..0dbdda4 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/nspcc-dev/neofs-api-go/v2 -go 1.16 +go 1.17 require ( github.com/nspcc-dev/neofs-crypto v0.4.0 @@ -9,6 +9,19 @@ require ( google.golang.org/protobuf v1.27.1 ) +require ( + github.com/davecgh/go-spew v1.1.0 // indirect + github.com/golang/protobuf v1.5.0 // indirect + github.com/mr-tron/base58 v1.2.0 // indirect + github.com/nspcc-dev/rfc6979 v0.2.0 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + golang.org/x/net v0.0.0-20200822124328-c89045814202 // indirect + golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd // indirect + golang.org/x/text v0.3.0 // indirect + google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 // indirect + gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect +) + // This version uses broken NeoFS API with incompatible signature // definitions. See fix in https://github.com/nspcc-dev/neofs-api/pull/203 retract v2.12.0 From 9fe5c0736da4de8c307c9306dd39f271f9402566 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Mon, 15 Aug 2022 15:57:06 +0300 Subject: [PATCH 1009/1196] [#412] .github: Update actions to the latest version Signed-off-by: Evgenii Stratonikov --- .github/workflows/go.yml | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 6fada0f..48e770c 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -20,15 +20,15 @@ jobs: go: [ '1.17.x', '1.18.x', '1.19.x' ] steps: - name: Setup go - uses: actions/setup-go@v2 + uses: actions/setup-go@v3 with: go-version: ${{ matrix.go }} - name: Check out code - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Cache go mod - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: ~/go/pkg/mod key: ${{ runner.os }}-go-${{ matrix.go }}-${{ hashFiles('**/go.sum') }} @@ -49,11 +49,16 @@ jobs: lint: runs-on: ubuntu-20.04 steps: + - name: Setup go + uses: actions/setup-go@v3 + with: + go-version: 1.19 + - name: Check out code - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: golangci-lint - uses: golangci/golangci-lint-action@v2 + uses: golangci/golangci-lint-action@v3 with: - version: v1.42.1 + version: v1.48.0 only-new-issues: true From 98db3fa28419c6bc4f968ec104366f590f355ba5 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Mon, 15 Aug 2022 16:17:10 +0300 Subject: [PATCH 1010/1196] [#412] storagegroup: Remove linter warning Signed-off-by: Evgenii Stratonikov --- storagegroup/convert.go | 1 + 1 file changed, 1 insertion(+) diff --git a/storagegroup/convert.go b/storagegroup/convert.go index 489dad3..b36101f 100644 --- a/storagegroup/convert.go +++ b/storagegroup/convert.go @@ -50,6 +50,7 @@ func (s *StorageGroup) FromGRPCMessage(m grpc.Message) error { return err } + //nolint: staticcheck s.exp = v.GetExpirationEpoch() s.size = v.GetValidationDataSize() From 9e17cdfc7647935103a536521b9ad4be77237c5c Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Fri, 26 Aug 2022 14:18:07 +0300 Subject: [PATCH 1011/1196] [#413] util/proto: Marshal repeated []byte fields correctly Signed-off-by: Evgenii Stratonikov --- util/proto/marshal.go | 16 +++++++++++----- util/proto/marshal_test.go | 8 ++++++++ 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/util/proto/marshal.go b/util/proto/marshal.go index 589c0be..a82478b 100644 --- a/util/proto/marshal.go +++ b/util/proto/marshal.go @@ -24,7 +24,10 @@ func BytesMarshal(field int, buf, v []byte) int { if len(v) == 0 { return 0 } + return bytesMarshal(field, buf, v) +} +func bytesMarshal(field int, buf, v []byte) int { prefix := field<<3 | 0x2 // buf length check can prevent panic at PutUvarint, but it will make @@ -41,10 +44,13 @@ func BytesSize(field int, v []byte) int { if ln == 0 { return 0 } + return bytesSize(field, v) +} +func bytesSize(field int, v []byte) int { prefix := field<<3 | 0x2 - return VarUIntSize(uint64(prefix)) + VarUIntSize(uint64(ln)) + ln + return VarUIntSize(uint64(prefix)) + VarUIntSize(uint64(len(v))) + len(v) } func StringMarshal(field int, buf []byte, v string) int { @@ -141,7 +147,7 @@ func RepeatedBytesMarshal(field int, buf []byte, v [][]byte) int { var offset int for i := range v { - offset += BytesMarshal(field, buf[offset:], v[i]) + offset += bytesMarshal(field, buf[offset:], v[i]) } return offset @@ -149,7 +155,7 @@ func RepeatedBytesMarshal(field int, buf []byte, v [][]byte) int { func RepeatedBytesSize(field int, v [][]byte) (size int) { for i := range v { - size += BytesSize(field, v[i]) + size += bytesSize(field, v[i]) } return size @@ -159,7 +165,7 @@ func RepeatedStringMarshal(field int, buf []byte, v []string) int { var offset int for i := range v { - offset += StringMarshal(field, buf[offset:], v[i]) + offset += bytesMarshal(field, buf[offset:], []byte(v[i])) } return offset @@ -167,7 +173,7 @@ func RepeatedStringMarshal(field int, buf []byte, v []string) int { func RepeatedStringSize(field int, v []string) (size int) { for i := range v { - size += StringSize(field, v[i]) + size += bytesSize(field, []byte(v[i])) } return size diff --git a/util/proto/marshal_test.go b/util/proto/marshal_test.go index e19f4ee..cda1440 100644 --- a/util/proto/marshal_test.go +++ b/util/proto/marshal_test.go @@ -313,6 +313,10 @@ func TestRepeatedBytesMarshal(t *testing.T) { testRepeatedBytesMarshal(t, [][]byte{}, false) }) + t.Run("empty element", func(t *testing.T) { + testRepeatedBytesMarshal(t, [][]byte{{1}, {}}, false) + }) + t.Run("nil", func(t *testing.T) { testRepeatedBytesMarshal(t, nil, false) }) @@ -325,6 +329,10 @@ func TestRepeatedStringMarshal(t *testing.T) { testRepeatedStringMarshal(t, data, true) }) + t.Run("empty element", func(t *testing.T) { + testRepeatedStringMarshal(t, []string{""}, false) + }) + t.Run("empty", func(t *testing.T) { testRepeatedStringMarshal(t, []string{}, false) }) From fcf1d02afcc21f9be3ac20f710b7ca4e39b5d9bd Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Tue, 6 Sep 2022 10:50:50 +0300 Subject: [PATCH 1012/1196] [#414] make: Fix commit abbrev length in version Make it uniform across all our repos. Signed-off-by: Pavel Karpy --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 9cea12a..25324e9 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ #!/usr/bin/make -f SHELL = bash -VERSION ?= $(shell git describe --tags --match "v*" --dirty --always) +VERSION ?= $(shell git describe --tags --match "v*" --abbrev=8 --dirty --always) .PHONY: dep fmts fmt imports protoc test lint version help From 1853349f2203b4b315c19cf36887d5c81d4a7f44 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Thu, 15 Sep 2022 08:20:13 +0300 Subject: [PATCH 1013/1196] [#415] *: Go fmt -s Signed-off-by: Evgenii Stratonikov --- container/attributes.go | 4 ++-- container/status.go | 5 +++-- netmap/attributes.go | 8 ++++---- object/status.go | 5 +++-- refs/convert.go | 2 +- session/status.go | 5 +++-- session/types.go | 3 +++ status/status.go | 5 +++-- subnet/info.go | 2 +- 9 files changed, 23 insertions(+), 16 deletions(-) diff --git a/container/attributes.go b/container/attributes.go index 062e624..eb4b078 100644 --- a/container/attributes.go +++ b/container/attributes.go @@ -24,8 +24,8 @@ const disabledHomomorphicHashingValue = "true" // HomomorphicHashingState returns container's homomorphic // hashing state: -// * true if hashing is enabled; -// * false if hashing is disabled. +// - true if hashing is enabled; +// - false if hashing is disabled. // // All container's attributes must be unique, otherwise behavior // is undefined. diff --git a/container/status.go b/container/status.go index 7f0edc0..499c855 100644 --- a/container/status.go +++ b/container/status.go @@ -6,8 +6,9 @@ import ( ) // LocalizeFailStatus checks if passed global status.Code is related to container failure and: -// then localizes the code and returns true, -// else leaves the code unchanged and returns false. +// +// then localizes the code and returns true, +// else leaves the code unchanged and returns false. // // Arg must not be nil. func LocalizeFailStatus(c *status.Code) bool { diff --git a/netmap/attributes.go b/netmap/attributes.go index 05f4d4a..4f69287 100644 --- a/netmap/attributes.go +++ b/netmap/attributes.go @@ -59,13 +59,13 @@ func subnetAttributeKey(id *refs.SubnetID) string { // Existing subnet attributes are expected to be key-unique, otherwise undefined behavior. // // Does not add (removes existing) attribute if node: -// * disables non-zero subnet; -// * enables zero subnet. +// - disables non-zero subnet; +// - enables zero subnet. // // Attribute key is calculated from ID using format `__NEOFS__SUBNET_%s`. // Attribute Value is: -// * `True` if node enters the subnet; -// * `False`, otherwise. +// - `True` if node enters the subnet; +// - `False`, otherwise. func WriteSubnetInfo(node *NodeInfo, info NodeSubnetInfo) { attrs := node.GetAttributes() diff --git a/object/status.go b/object/status.go index a9a0faa..e1e96c8 100644 --- a/object/status.go +++ b/object/status.go @@ -6,8 +6,9 @@ import ( ) // LocalizeFailStatus checks if passed global status.Code is related to object failure and: -// then localizes the code and returns true, -// else leaves the code unchanged and returns false. +// +// then localizes the code and returns true, +// else leaves the code unchanged and returns false. // // Arg must not be nil. func LocalizeFailStatus(c *status.Code) bool { diff --git a/refs/convert.go b/refs/convert.go index b6dffe6..e402f50 100644 --- a/refs/convert.go +++ b/refs/convert.go @@ -283,7 +283,7 @@ func (s *SubnetID) ToGRPCMessage() grpc.Message { // FromGRPCMessage restores Info from grpc.Message. // // Supported types: -// * refs.SubnetID. +// - refs.SubnetID. func (s *SubnetID) FromGRPCMessage(m grpc.Message) error { v, ok := m.(*refs.SubnetID) if !ok { diff --git a/session/status.go b/session/status.go index bbcd3e2..a6dbfca 100644 --- a/session/status.go +++ b/session/status.go @@ -6,8 +6,9 @@ import ( ) // LocalizeFailStatus checks if passed global status.Code is related to session failure and: -// then localizes the code and returns true, -// else leaves the code unchanged and returns false. +// +// then localizes the code and returns true, +// else leaves the code unchanged and returns false. // // Arg must not be nil. func LocalizeFailStatus(c *status.Code) bool { diff --git a/session/types.go b/session/types.go index 139bf57..dfa8c5e 100644 --- a/session/types.go +++ b/session/types.go @@ -51,6 +51,7 @@ type TokenContext interface { } // Deprecated: use TokenContext instead. +// //nolint:revive type SessionTokenContext = TokenContext @@ -67,6 +68,7 @@ type TokenBody struct { } // Deprecated: use TokenBody instead. +// //nolint:revive type SessionTokenBody = TokenBody @@ -77,6 +79,7 @@ type Token struct { } // Deprecated: use Token instead. +// //nolint:revive type SessionToken = Token diff --git a/status/status.go b/status/status.go index 58d3b22..f300d5e 100644 --- a/status/status.go +++ b/status/status.go @@ -84,8 +84,9 @@ func GlobalizeCommonFail(c *Code) { } // LocalizeIfInSection checks if passed global status.Code belongs to the section and: -// then localizes the code and returns true, -// else leaves the code unchanged and returns false. +// +// then localizes the code and returns true, +// else leaves the code unchanged and returns false. // // Arg must not be nil. func LocalizeIfInSection(c *Code, sec uint32) bool { diff --git a/subnet/info.go b/subnet/info.go index 16efb98..952b7e7 100644 --- a/subnet/info.go +++ b/subnet/info.go @@ -55,7 +55,7 @@ func (x *Info) ToGRPCMessage() grpc.Message { // FromGRPCMessage restores Info from grpc.Message. // // Supported types: -// * subnet.SubnetInfo. +// - subnet.SubnetInfo. func (x *Info) FromGRPCMessage(m grpc.Message) error { v, ok := m.(*subnet.SubnetInfo) if !ok { From ea7a3811bf8277ed5bcc88f78fe9a7d41701632a Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Thu, 15 Sep 2022 08:21:44 +0300 Subject: [PATCH 1014/1196] [#415] *: Add maintenance status and node state Signed-off-by: Evgenii Stratonikov --- accounting/grpc/service.pb.go | 2 +- accounting/grpc/service_grpc.pb.go | 2 +- accounting/grpc/types.pb.go | 2 +- acl/grpc/types.pb.go | 38 +++--- audit/grpc/types.pb.go | 2 +- container/grpc/service.pb.go | 2 +- container/grpc/service_grpc.pb.go | 10 +- container/grpc/types.pb.go | 40 +++---- lock/grpc/types.pb.go | 2 +- netmap/grpc/service.pb.go | 2 +- netmap/grpc/service_grpc.pb.go | 2 +- netmap/grpc/types.pb.go | 179 +++++++++++++++-------------- netmap/types.go | 1 + object/grpc/service.pb.go | 74 ++++++------ object/grpc/service_grpc.pb.go | 2 +- object/grpc/types.pb.go | 40 +++---- refs/grpc/types.pb.go | 10 +- reputation/grpc/service.pb.go | 2 +- reputation/grpc/service_grpc.pb.go | 2 +- reputation/grpc/types.pb.go | 2 +- session/grpc/service.pb.go | 2 +- session/grpc/service_grpc.pb.go | 2 +- session/grpc/types.pb.go | 21 ++-- status/grpc/types.pb.go | 67 +++++------ status/status.go | 2 + storagegroup/grpc/types.pb.go | 3 +- subnet/grpc/types.pb.go | 2 +- tombstone/grpc/types.pb.go | 2 +- util/proto/test/test.pb.go | 2 +- 29 files changed, 264 insertions(+), 255 deletions(-) diff --git a/accounting/grpc/service.pb.go b/accounting/grpc/service.pb.go index 357547e..bbaefff 100644 --- a/accounting/grpc/service.pb.go +++ b/accounting/grpc/service.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.1 -// protoc v3.19.4 +// protoc v3.21.5 // source: accounting/grpc/service.proto package accounting diff --git a/accounting/grpc/service_grpc.pb.go b/accounting/grpc/service_grpc.pb.go index 8ed1956..0f4d18d 100644 --- a/accounting/grpc/service_grpc.pb.go +++ b/accounting/grpc/service_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.2.0 -// - protoc v3.19.4 +// - protoc v3.21.5 // source: accounting/grpc/service.proto package accounting diff --git a/accounting/grpc/types.pb.go b/accounting/grpc/types.pb.go index 016bdc2..7628708 100644 --- a/accounting/grpc/types.pb.go +++ b/accounting/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.1 -// protoc v3.19.4 +// protoc v3.21.5 // source: accounting/grpc/types.proto package accounting diff --git a/acl/grpc/types.pb.go b/acl/grpc/types.pb.go index cf8114e..9bfca6a 100644 --- a/acl/grpc/types.pb.go +++ b/acl/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.1 -// protoc v3.19.4 +// protoc v3.21.5 // source: acl/grpc/types.proto package acl @@ -537,24 +537,24 @@ func (x *BearerToken) GetSignature() *grpc.Signature { // Some Object's header fields can also be accessed by adding `$Object:` // prefix to the name. Here is the list of fields available via this prefix: // -// * $Object:version \ -// version -// * $Object:objectID \ -// object_id -// * $Object:containerID \ -// container_id -// * $Object:ownerID \ -// owner_id -// * $Object:creationEpoch \ -// creation_epoch -// * $Object:payloadLength \ -// payload_length -// * $Object:payloadHash \ -// payload_hash -// * $Object:objectType \ -// object_type -// * $Object:homomorphicHash \ -// homomorphic_hash +// - $Object:version \ +// version +// - $Object:objectID \ +// object_id +// - $Object:containerID \ +// container_id +// - $Object:ownerID \ +// owner_id +// - $Object:creationEpoch \ +// creation_epoch +// - $Object:payloadLength \ +// payload_length +// - $Object:payloadHash \ +// payload_hash +// - $Object:objectType \ +// object_type +// - $Object:homomorphicHash \ +// homomorphic_hash // // Please note, that if request or response does not have object's headers or // full object (Range, RangeHash, Search, Delete), it will not be possible to diff --git a/audit/grpc/types.pb.go b/audit/grpc/types.pb.go index e5b3773..29ef6ea 100644 --- a/audit/grpc/types.pb.go +++ b/audit/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.1 -// protoc v3.19.4 +// protoc v3.21.5 // source: audit/grpc/types.proto package audit diff --git a/container/grpc/service.pb.go b/container/grpc/service.pb.go index 390261e..78f8825 100644 --- a/container/grpc/service.pb.go +++ b/container/grpc/service.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.1 -// protoc v3.19.4 +// protoc v3.21.5 // source: container/grpc/service.proto package container diff --git a/container/grpc/service_grpc.pb.go b/container/grpc/service_grpc.pb.go index c8b78d7..ec0a971 100644 --- a/container/grpc/service_grpc.pb.go +++ b/container/grpc/service_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.2.0 -// - protoc v3.19.4 +// - protoc v3.21.5 // source: container/grpc/service.proto package container @@ -75,9 +75,7 @@ type ContainerServiceClient interface { // container eACL has been successfully read; // - Common failures (SECTION_FAILURE_COMMON); // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ - // container not found; - // - **EACL_NOT_FOUND** (3073, SECTION_CONTAINER): \ - // eACL table not found. + // container not found. GetExtendedACL(ctx context.Context, in *GetExtendedACLRequest, opts ...grpc.CallOption) (*GetExtendedACLResponse, error) // Announces the space values used by the container for P2P synchronization. // @@ -216,9 +214,7 @@ type ContainerServiceServer interface { // container eACL has been successfully read; // - Common failures (SECTION_FAILURE_COMMON); // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ - // container not found; - // - **EACL_NOT_FOUND** (3073, SECTION_CONTAINER): \ - // eACL table not found. + // container not found. GetExtendedACL(context.Context, *GetExtendedACLRequest) (*GetExtendedACLResponse, error) // Announces the space values used by the container for P2P synchronization. // diff --git a/container/grpc/types.pb.go b/container/grpc/types.pb.go index 269cfb4..d8dd62f 100644 --- a/container/grpc/types.pb.go +++ b/container/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.1 -// protoc v3.19.4 +// protoc v3.21.5 // source: container/grpc/types.proto package container @@ -131,28 +131,28 @@ func (x *Container) GetPlacementPolicy() *grpc1.PlacementPolicy { // // There are some "well-known" attributes affecting system behaviour: // -// * __NEOFS__SUBNET \ -// String ID of a container's storage subnet. Any container can be attached to -// one subnet only. -// * __NEOFS__NAME \ -// String of a human-friendly container name registered as a domain in -// NNS contract. -// * __NEOFS__ZONE \ -// String of a zone for `__NEOFS__NAME`. Used as a TLD of a domain name in NNS -// contract. If no zone is specified, use default zone: `container`. -// * __NEOFS__DISABLE_HOMOMORPHIC_HASHING \ -// 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 NeoFS network only if the global network hashing configuration -// value corresponds with that attribute's value. After container inclusion, network -// setting is ignored. +// - __NEOFS__SUBNET \ +// String ID of a container's storage subnet. Any container can be attached to +// one subnet only. +// - __NEOFS__NAME \ +// String of a human-friendly container name registered as a domain in +// NNS contract. +// - __NEOFS__ZONE \ +// String of a zone for `__NEOFS__NAME`. Used as a TLD of a domain name in NNS +// contract. If no zone is specified, use default zone: `container`. +// - __NEOFS__DISABLE_HOMOMORPHIC_HASHING \ +// 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 NeoFS 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 +// - Name \ +// Human-friendly name +// - Timestamp \ +// User-defined local time of container creation in Unix Timestamp format type Container_Attribute struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache diff --git a/lock/grpc/types.pb.go b/lock/grpc/types.pb.go index 0a560ec..d118ca8 100644 --- a/lock/grpc/types.pb.go +++ b/lock/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.1 -// protoc v3.19.4 +// protoc v3.21.5 // source: lock/grpc/types.proto package lock diff --git a/netmap/grpc/service.pb.go b/netmap/grpc/service.pb.go index 93b19ba..c200940 100644 --- a/netmap/grpc/service.pb.go +++ b/netmap/grpc/service.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.1 -// protoc v3.19.4 +// protoc v3.21.5 // source: netmap/grpc/service.proto package netmap diff --git a/netmap/grpc/service_grpc.pb.go b/netmap/grpc/service_grpc.pb.go index 1ee6b92..e27cd2c 100644 --- a/netmap/grpc/service_grpc.pb.go +++ b/netmap/grpc/service_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.2.0 -// - protoc v3.19.4 +// - protoc v3.21.5 // source: netmap/grpc/service.proto package netmap diff --git a/netmap/grpc/types.pb.go b/netmap/grpc/types.pb.go index 53c601d..a5fd6e5 100644 --- a/netmap/grpc/types.pb.go +++ b/netmap/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.1 -// protoc v3.19.4 +// protoc v3.21.5 // source: netmap/grpc/types.proto package netmap @@ -163,6 +163,8 @@ const ( NodeInfo_ONLINE NodeInfo_State = 1 // Network unavailable state NodeInfo_OFFLINE NodeInfo_State = 2 + // Maintenance state + NodeInfo_MAINTENANCE NodeInfo_State = 3 ) // Enum value maps for NodeInfo_State. @@ -171,11 +173,13 @@ var ( 0: "UNSPECIFIED", 1: "ONLINE", 2: "OFFLINE", + 3: "MAINTENANCE", } NodeInfo_State_value = map[string]int32{ "UNSPECIFIED": 0, "ONLINE": 1, "OFFLINE": 2, + "MAINTENANCE": 3, } ) @@ -746,7 +750,7 @@ func (x *NetworkInfo) GetNetworkConfig() *NetworkConfig { // one). A string representation of the chain of attributes in NeoFS Storage // Node configuration uses ":" and "/" symbols, e.g.: // -// `NEOFS_NODE_ATTRIBUTE_1=key1:val1/key2:val2` +// `NEOFS_NODE_ATTRIBUTE_1=key1:val1/key2:val2` // // Therefore the string attribute representation in the Node configuration must // use "\:", "\/" and "\\" escaped symbols if any of them appears in an attribute's @@ -758,51 +762,51 @@ func (x *NetworkInfo) GetNetworkConfig() *NetworkConfig { // Storage Nodes in the network and used implicitly with default values if not // explicitly set: // -// * Capacity \ -// Total available disk space in Gigabytes. -// * Price \ -// Price in GAS tokens for storing one GB of data during one Epoch. In node -// attributes it's a string presenting floating point number with comma or -// point delimiter for decimal part. In the Network Map it will be saved as -// 64-bit unsigned integer representing number of minimal token fractions. -// * __NEOFS__SUBNET_%s \ -// `True` or `False`. Defines if the node is included in the `%s` subnetwork -// or not. `%s` must be an existing subnetwork's ID (non-negative integer number). -// A node can be included in more than one subnetwork and, therefore, can contain -// more than one subnet attribute. A missing attribute is equivalent to the -// presence of the attribute with `False` value (except default zero subnetwork -// (with `%s` == 0) for which missing attribute means inclusion in that network). -// * UN-LOCODE \ -// Node's geographic location in -// [UN/LOCODE](https://www.unece.org/cefact/codesfortrade/codes_index.html) -// format approximated to the nearest point defined in the standard. -// * CountryCode \ -// Country code in -// [ISO 3166-1_alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) -// format. Calculated automatically from `UN-LOCODE` attribute. -// * Country \ -// Country short name in English, as defined in -// [ISO-3166](https://www.iso.org/obp/ui/#search). Calculated automatically -// from `UN-LOCODE` attribute. -// * Location \ -// Place names are given, whenever possible, in their national language -// versions as expressed in the Roman alphabet using the 26 characters of -// the character set adopted for international trade data interchange, -// written without diacritics . Calculated automatically from `UN-LOCODE` -// attribute. -// * SubDivCode \ -// Country's administrative subdivision where node is located. Calculated -// automatically from `UN-LOCODE` attribute based on `SubDiv` field. -// Presented in [ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2) -// format. -// * SubDiv \ -// Country's administrative subdivision name, as defined in -// [ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2). Calculated -// automatically from `UN-LOCODE` attribute. -// * Continent \ -// Node's continent name according to the [Seven-Continent model] -// (https://en.wikipedia.org/wiki/Continent#Number). Calculated -// automatically from `UN-LOCODE` attribute. +// - Capacity \ +// Total available disk space in Gigabytes. +// - Price \ +// Price in GAS tokens for storing one GB of data during one Epoch. In node +// attributes it's a string presenting floating point number with comma or +// point delimiter for decimal part. In the Network Map it will be saved as +// 64-bit unsigned integer representing number of minimal token fractions. +// - __NEOFS__SUBNET_%s \ +// `True` or `False`. Defines if the node is included in the `%s` subnetwork +// or not. `%s` must be an existing subnetwork's ID (non-negative integer number). +// A node can be included in more than one subnetwork and, therefore, can contain +// more than one subnet attribute. A missing attribute is equivalent to the +// presence of the attribute with `False` value (except default zero subnetwork +// (with `%s` == 0) for which missing attribute means inclusion in that network). +// - UN-LOCODE \ +// Node's geographic location in +// [UN/LOCODE](https://www.unece.org/cefact/codesfortrade/codes_index.html) +// format approximated to the nearest point defined in the standard. +// - CountryCode \ +// Country code in +// [ISO 3166-1_alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) +// format. Calculated automatically from `UN-LOCODE` attribute. +// - Country \ +// Country short name in English, as defined in +// [ISO-3166](https://www.iso.org/obp/ui/#search). Calculated automatically +// from `UN-LOCODE` attribute. +// - Location \ +// Place names are given, whenever possible, in their national language +// versions as expressed in the Roman alphabet using the 26 characters of +// the character set adopted for international trade data interchange, +// written without diacritics . Calculated automatically from `UN-LOCODE` +// attribute. +// - SubDivCode \ +// Country's administrative subdivision where node is located. Calculated +// automatically from `UN-LOCODE` attribute based on `SubDiv` field. +// Presented in [ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2) +// format. +// - SubDiv \ +// Country's administrative subdivision name, as defined in +// [ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2). Calculated +// automatically from `UN-LOCODE` attribute. +// - Continent \ +// Node's continent name according to the [Seven-Continent model] +// (https://en.wikipedia.org/wiki/Continent#Number). Calculated +// automatically from `UN-LOCODE` attribute. // // For detailed description of each well-known attribute please see the // corresponding section in NeoFS Technical Specification. @@ -980,7 +984,7 @@ var file_netmap_grpc_types_proto_rawDesc = []byte{ 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x73, 0x12, 0x35, 0x0a, 0x09, 0x73, 0x75, 0x62, 0x6e, 0x65, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x75, 0x62, 0x6e, - 0x65, 0x74, 0x49, 0x44, 0x52, 0x08, 0x73, 0x75, 0x62, 0x6e, 0x65, 0x74, 0x49, 0x64, 0x22, 0xc7, + 0x65, 0x74, 0x49, 0x44, 0x52, 0x08, 0x73, 0x75, 0x62, 0x6e, 0x65, 0x74, 0x49, 0x64, 0x22, 0xd8, 0x02, 0x0a, 0x08, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x12, 0x1c, 0x0a, 0x09, 0x61, 0x64, @@ -998,47 +1002,48 @@ var file_netmap_grpc_types_proto_rawDesc = []byte{ 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, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x70, 0x61, - 0x72, 0x65, 0x6e, 0x74, 0x73, 0x22, 0x31, 0x0a, 0x05, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x0f, + 0x72, 0x65, 0x6e, 0x74, 0x73, 0x22, 0x42, 0x0a, 0x05, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x0f, 0x0a, 0x0b, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x4f, 0x4e, 0x4c, 0x49, 0x4e, 0x45, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x4f, - 0x46, 0x46, 0x4c, 0x49, 0x4e, 0x45, 0x10, 0x02, 0x22, 0x8f, 0x01, 0x0a, 0x0d, 0x4e, 0x65, 0x74, - 0x77, 0x6f, 0x72, 0x6b, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x49, 0x0a, 0x0a, 0x70, 0x61, - 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x29, - 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, - 0x70, 0x2e, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, - 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x52, 0x0a, 0x70, 0x61, 0x72, 0x61, 0x6d, - 0x65, 0x74, 0x65, 0x72, 0x73, 0x1a, 0x33, 0x0a, 0x09, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, - 0x65, 0x72, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, - 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xbf, 0x01, 0x0a, 0x0b, 0x4e, - 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x23, 0x0a, 0x0d, 0x63, 0x75, - 0x72, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x04, 0x52, 0x0c, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x45, 0x70, 0x6f, 0x63, 0x68, 0x12, - 0x21, 0x0a, 0x0c, 0x6d, 0x61, 0x67, 0x69, 0x63, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0b, 0x6d, 0x61, 0x67, 0x69, 0x63, 0x4e, 0x75, 0x6d, 0x62, - 0x65, 0x72, 0x12, 0x20, 0x0a, 0x0c, 0x6d, 0x73, 0x5f, 0x70, 0x65, 0x72, 0x5f, 0x62, 0x6c, 0x6f, - 0x63, 0x6b, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x6d, 0x73, 0x50, 0x65, 0x72, 0x42, - 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x46, 0x0a, 0x0e, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x5f, - 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6e, - 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, - 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x0d, 0x6e, - 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2a, 0x67, 0x0a, 0x09, - 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x19, 0x0a, 0x15, 0x4f, 0x50, 0x45, - 0x52, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, - 0x45, 0x44, 0x10, 0x00, 0x12, 0x06, 0x0a, 0x02, 0x45, 0x51, 0x10, 0x01, 0x12, 0x06, 0x0a, 0x02, - 0x4e, 0x45, 0x10, 0x02, 0x12, 0x06, 0x0a, 0x02, 0x47, 0x54, 0x10, 0x03, 0x12, 0x06, 0x0a, 0x02, - 0x47, 0x45, 0x10, 0x04, 0x12, 0x06, 0x0a, 0x02, 0x4c, 0x54, 0x10, 0x05, 0x12, 0x06, 0x0a, 0x02, - 0x4c, 0x45, 0x10, 0x06, 0x12, 0x06, 0x0a, 0x02, 0x4f, 0x52, 0x10, 0x07, 0x12, 0x07, 0x0a, 0x03, - 0x41, 0x4e, 0x44, 0x10, 0x08, 0x2a, 0x38, 0x0a, 0x06, 0x43, 0x6c, 0x61, 0x75, 0x73, 0x65, 0x12, - 0x16, 0x0a, 0x12, 0x43, 0x4c, 0x41, 0x55, 0x53, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, - 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x53, 0x41, 0x4d, 0x45, 0x10, - 0x01, 0x12, 0x0c, 0x0a, 0x08, 0x44, 0x49, 0x53, 0x54, 0x49, 0x4e, 0x43, 0x54, 0x10, 0x02, 0x42, - 0x56, 0x5a, 0x37, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, - 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, - 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2f, 0x67, - 0x72, 0x70, 0x63, 0x3b, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0xaa, 0x02, 0x1a, 0x4e, 0x65, 0x6f, - 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, - 0x2e, 0x4e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x46, 0x46, 0x4c, 0x49, 0x4e, 0x45, 0x10, 0x02, 0x12, 0x0f, 0x0a, 0x0b, 0x4d, 0x41, 0x49, 0x4e, + 0x54, 0x45, 0x4e, 0x41, 0x4e, 0x43, 0x45, 0x10, 0x03, 0x22, 0x8f, 0x01, 0x0a, 0x0d, 0x4e, 0x65, + 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x49, 0x0a, 0x0a, 0x70, + 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x29, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, + 0x61, 0x70, 0x2e, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, + 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x52, 0x0a, 0x70, 0x61, 0x72, 0x61, + 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x1a, 0x33, 0x0a, 0x09, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, + 0x74, 0x65, 0x72, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, + 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xbf, 0x01, 0x0a, 0x0b, + 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x23, 0x0a, 0x0d, 0x63, + 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x04, 0x52, 0x0c, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x45, 0x70, 0x6f, 0x63, 0x68, + 0x12, 0x21, 0x0a, 0x0c, 0x6d, 0x61, 0x67, 0x69, 0x63, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0b, 0x6d, 0x61, 0x67, 0x69, 0x63, 0x4e, 0x75, 0x6d, + 0x62, 0x65, 0x72, 0x12, 0x20, 0x0a, 0x0c, 0x6d, 0x73, 0x5f, 0x70, 0x65, 0x72, 0x5f, 0x62, 0x6c, + 0x6f, 0x63, 0x6b, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x6d, 0x73, 0x50, 0x65, 0x72, + 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x46, 0x0a, 0x0e, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, + 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, + 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, + 0x2e, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x0d, + 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2a, 0x67, 0x0a, + 0x09, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x19, 0x0a, 0x15, 0x4f, 0x50, + 0x45, 0x52, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, + 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x06, 0x0a, 0x02, 0x45, 0x51, 0x10, 0x01, 0x12, 0x06, 0x0a, + 0x02, 0x4e, 0x45, 0x10, 0x02, 0x12, 0x06, 0x0a, 0x02, 0x47, 0x54, 0x10, 0x03, 0x12, 0x06, 0x0a, + 0x02, 0x47, 0x45, 0x10, 0x04, 0x12, 0x06, 0x0a, 0x02, 0x4c, 0x54, 0x10, 0x05, 0x12, 0x06, 0x0a, + 0x02, 0x4c, 0x45, 0x10, 0x06, 0x12, 0x06, 0x0a, 0x02, 0x4f, 0x52, 0x10, 0x07, 0x12, 0x07, 0x0a, + 0x03, 0x41, 0x4e, 0x44, 0x10, 0x08, 0x2a, 0x38, 0x0a, 0x06, 0x43, 0x6c, 0x61, 0x75, 0x73, 0x65, + 0x12, 0x16, 0x0a, 0x12, 0x43, 0x4c, 0x41, 0x55, 0x53, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, + 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x53, 0x41, 0x4d, 0x45, + 0x10, 0x01, 0x12, 0x0c, 0x0a, 0x08, 0x44, 0x49, 0x53, 0x54, 0x49, 0x4e, 0x43, 0x54, 0x10, 0x02, + 0x42, 0x56, 0x5a, 0x37, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, + 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, + 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2f, + 0x67, 0x72, 0x70, 0x63, 0x3b, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0xaa, 0x02, 0x1a, 0x4e, 0x65, + 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, + 0x49, 0x2e, 0x4e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/netmap/types.go b/netmap/types.go index cc190af..122dda1 100644 --- a/netmap/types.go +++ b/netmap/types.go @@ -94,6 +94,7 @@ const ( UnspecifiedState NodeState = iota Online Offline + Maintenance ) const ( diff --git a/object/grpc/service.pb.go b/object/grpc/service.pb.go index b282895..7f15f44 100644 --- a/object/grpc/service.pb.go +++ b/object/grpc/service.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.1 -// protoc v3.19.4 +// protoc v3.21.5 // source: object/grpc/service.proto package object @@ -1193,6 +1193,7 @@ type GetResponse_Body struct { // Single message in the response stream. // // Types that are assignable to ObjectPart: + // // *GetResponse_Body_Init_ // *GetResponse_Body_Chunk // *GetResponse_Body_SplitInfo @@ -1361,6 +1362,7 @@ type PutRequest_Body struct { // Single message in the request stream. // // Types that are assignable to ObjectPart: + // // *PutRequest_Body_Init_ // *PutRequest_Body_Chunk ObjectPart isPutRequest_Body_ObjectPart `protobuf_oneof:"object_part"` @@ -1740,6 +1742,7 @@ type HeadResponse_Body struct { // object. // // Types that are assignable to Head: + // // *HeadResponse_Body_Header // *HeadResponse_Body_ShortHeader // *HeadResponse_Body_SplitInfo @@ -1910,44 +1913,44 @@ func (x *SearchRequest_Body) GetFilters() []*SearchRequest_Body_Filter { // Some Object's header fields can also be accessed by adding `$Object:` // prefix to the name. Here is the list of fields available via this prefix: // -// * $Object:version \ -// version -// * $Object:objectID \ -// object_id -// * $Object:containerID \ -// container_id -// * $Object:ownerID \ -// owner_id -// * $Object:creationEpoch \ -// creation_epoch -// * $Object:payloadLength \ -// payload_length -// * $Object:payloadHash \ -// payload_hash -// * $Object:objectType \ -// object_type -// * $Object:homomorphicHash \ -// homomorphic_hash -// * $Object:split.parent \ -// object_id of parent -// * $Object:split.splitID \ -// 16 byte UUIDv4 used to identify the split object hierarchy parts +// - $Object:version \ +// version +// - $Object:objectID \ +// object_id +// - $Object:containerID \ +// container_id +// - $Object:ownerID \ +// owner_id +// - $Object:creationEpoch \ +// creation_epoch +// - $Object:payloadLength \ +// payload_length +// - $Object:payloadHash \ +// payload_hash +// - $Object:objectType \ +// object_type +// - $Object:homomorphicHash \ +// homomorphic_hash +// - $Object:split.parent \ +// object_id of parent +// - $Object:split.splitID \ +// 16 byte UUIDv4 used to identify the split object hierarchy parts // // There are some well-known filter aliases to match objects by certain // properties: // -// * $Object:ROOT \ -// Returns only `REGULAR` type objects that are not split or that are the top -// level root objects in a split hierarchy. This includes objects not -// present physically, like large objects split into smaller objects -// without a separate top-level root object. Objects of other types like -// StorageGroups and Tombstones will not be shown. This filter may be -// useful for listing objects like `ls` command of some virtual file -// system. This filter is activated if the `key` exists, disregarding the -// value and matcher type. -// * $Object:PHY \ -// Returns only objects physically stored in the system. This filter is -// activated if the `key` exists, disregarding the value and matcher type. +// - $Object:ROOT \ +// Returns only `REGULAR` type objects that are not split or that are the top +// level root objects in a split hierarchy. This includes objects not +// present physically, like large objects split into smaller objects +// without a separate top-level root object. Objects of other types like +// StorageGroups and Tombstones will not be shown. This filter may be +// useful for listing objects like `ls` command of some virtual file +// system. This filter is activated if the `key` exists, disregarding the +// value and matcher type. +// - $Object:PHY \ +// Returns only objects physically stored in the system. This filter is +// activated if the `key` exists, disregarding the value and matcher type. // // Note: using filters with a key with prefix `$Object:` and match type // `NOT_PRESENT `is not recommended since this is not a cross-version approach. @@ -2147,6 +2150,7 @@ type GetRangeResponse_Body struct { // Requested object range or meta information about split object. // // Types that are assignable to RangePart: + // // *GetRangeResponse_Body_Chunk // *GetRangeResponse_Body_SplitInfo RangePart isGetRangeResponse_Body_RangePart `protobuf_oneof:"range_part"` diff --git a/object/grpc/service_grpc.pb.go b/object/grpc/service_grpc.pb.go index d92e1bb..72d9eb4 100644 --- a/object/grpc/service_grpc.pb.go +++ b/object/grpc/service_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.2.0 -// - protoc v3.19.4 +// - protoc v3.21.5 // source: object/grpc/service.proto package object diff --git a/object/grpc/types.pb.go b/object/grpc/types.pb.go index 83a37ba..e1243b5 100644 --- a/object/grpc/types.pb.go +++ b/object/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.1 -// protoc v3.19.4 +// protoc v3.21.5 // source: object/grpc/types.proto package object @@ -559,28 +559,28 @@ func (x *SplitInfo) GetLink() *grpc.ObjectID { // There are some "well-known" attributes starting with `__NEOFS__` prefix // that affect system behaviour: // -// * __NEOFS__UPLOAD_ID \ -// Marks smaller parts of a split bigger object -// * __NEOFS__EXPIRATION_EPOCH \ -// Tells GC to delete object after that epoch -// * __NEOFS__TICK_EPOCH \ -// Decimal number that defines what epoch must produce -// object notification with UTF-8 object address in a -// body (`0` value produces notification right after -// object put) -// * __NEOFS__TICK_TOPIC \ -// UTF-8 string topic ID that is used for object notification +// - __NEOFS__UPLOAD_ID \ +// Marks smaller parts of a split bigger object +// - __NEOFS__EXPIRATION_EPOCH \ +// Tells GC to delete object after that epoch +// - __NEOFS__TICK_EPOCH \ +// Decimal number that defines what epoch must produce +// object notification with UTF-8 object address in a +// body (`0` value produces notification right after +// object put) +// - __NEOFS__TICK_TOPIC \ +// UTF-8 string topic ID that is used for object notification // // And some well-known attributes used by applications only: // -// * Name \ -// Human-friendly name -// * FileName \ -// File name to be associated with the object on saving -// * Timestamp \ -// User-defined local time of object creation in Unix Timestamp format -// * Content-Type \ -// MIME Content Type of object's payload +// - Name \ +// Human-friendly name +// - FileName \ +// File name to be associated with the object on saving +// - Timestamp \ +// User-defined local time of object creation in Unix Timestamp format +// - Content-Type \ +// MIME Content Type of object's payload // // For detailed description of each well-known attribute please see the // corresponding section in NeoFS Technical Specification. diff --git a/refs/grpc/types.pb.go b/refs/grpc/types.pb.go index 12716d1..be27e87 100644 --- a/refs/grpc/types.pb.go +++ b/refs/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.1 -// protoc v3.19.4 +// protoc v3.21.5 // source: refs/grpc/types.proto package refs @@ -620,10 +620,10 @@ func (x *SignatureRFC6979) GetSign() []byte { // Checksum message. // Depending on checksum algorithm type, the string presentation may vary: // -// * TZ \ -// Hex encoded string without `0x` prefix -// * SHA256 \ -// Hex encoded string without `0x` prefix +// - TZ \ +// Hex encoded string without `0x` prefix +// - SHA256 \ +// Hex encoded string without `0x` prefix type Checksum struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache diff --git a/reputation/grpc/service.pb.go b/reputation/grpc/service.pb.go index 719ad5c..83317ee 100644 --- a/reputation/grpc/service.pb.go +++ b/reputation/grpc/service.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.1 -// protoc v3.19.4 +// protoc v3.21.5 // source: reputation/grpc/service.proto package reputation diff --git a/reputation/grpc/service_grpc.pb.go b/reputation/grpc/service_grpc.pb.go index c22d4ed..545736b 100644 --- a/reputation/grpc/service_grpc.pb.go +++ b/reputation/grpc/service_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.2.0 -// - protoc v3.19.4 +// - protoc v3.21.5 // source: reputation/grpc/service.proto package reputation diff --git a/reputation/grpc/types.pb.go b/reputation/grpc/types.pb.go index 2c6253f..ff66869 100644 --- a/reputation/grpc/types.pb.go +++ b/reputation/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.1 -// protoc v3.19.4 +// protoc v3.21.5 // source: reputation/grpc/types.proto package reputation diff --git a/session/grpc/service.pb.go b/session/grpc/service.pb.go index b8a93cf..15b645e 100644 --- a/session/grpc/service.pb.go +++ b/session/grpc/service.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.1 -// protoc v3.19.4 +// protoc v3.21.5 // source: session/grpc/service.proto package session diff --git a/session/grpc/service_grpc.pb.go b/session/grpc/service_grpc.pb.go index 705c439..a596be4 100644 --- a/session/grpc/service_grpc.pb.go +++ b/session/grpc/service_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.2.0 -// - protoc v3.19.4 +// - protoc v3.21.5 // source: session/grpc/service.proto package session diff --git a/session/grpc/types.pb.go b/session/grpc/types.pb.go index 0d76bdf..1fa22f0 100644 --- a/session/grpc/types.pb.go +++ b/session/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.1 -// protoc v3.19.4 +// protoc v3.21.5 // source: session/grpc/types.proto package session @@ -350,15 +350,15 @@ func (x *SessionToken) GetSignature() *grpc.Signature { // There are some "well-known" headers starting with `__NEOFS__` prefix that // affect system behaviour: // -// * __NEOFS__NETMAP_EPOCH \ -// Netmap epoch to use for object placement calculation. The `value` is string -// encoded `uint64` in decimal presentation. If set to '0' or not set, the -// current epoch only will be used. -// * __NEOFS__NETMAP_LOOKUP_DEPTH \ -// If object can't be found using current epoch's netmap, this header limits -// how many past epochs the node can look up through. The `value` is string -// encoded `uint64` in decimal presentation. If set to '0' or not set, only the -// current epoch will be used. +// - __NEOFS__NETMAP_EPOCH \ +// Netmap epoch to use for object placement calculation. The `value` is string +// encoded `uint64` in decimal presentation. If set to '0' or not set, the +// current epoch only will be used. +// - __NEOFS__NETMAP_LOOKUP_DEPTH \ +// If object can't be found using current epoch's netmap, this header limits +// how many past epochs the node can look up through. The `value` is string +// encoded `uint64` in decimal presentation. If set to '0' or not set, only the +// current epoch will be used. type XHeader struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -793,6 +793,7 @@ type SessionToken_Body struct { // Session Context information // // Types that are assignable to Context: + // // *SessionToken_Body_Object // *SessionToken_Body_Container Context isSessionToken_Body_Context `protobuf_oneof:"context"` diff --git a/status/grpc/types.pb.go b/status/grpc/types.pb.go index c18467c..64b257e 100644 --- a/status/grpc/types.pb.go +++ b/status/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.1 -// protoc v3.19.4 +// protoc v3.21.5 // source: status/grpc/types.proto package status @@ -138,11 +138,13 @@ const ( CommonFail_INTERNAL CommonFail = 0 // [**1025**] Wrong magic of the NeoFS network. // Details: - // - [**0**] Magic number of the served NeoFS network (big-endian 64-bit - // unsigned integer). + // - [**0**] Magic number of the served NeoFS network (big-endian 64-bit + // unsigned integer). CommonFail_WRONG_MAGIC_NUMBER CommonFail = 1 // [**1026**] Signature verification failure. CommonFail_SIGNATURE_VERIFICATION_FAIL CommonFail = 2 + // [**1027**] Node is under maintenance. + CommonFail_NODE_UNDER_MAINTENANCE CommonFail = 3 ) // Enum value maps for CommonFail. @@ -151,11 +153,13 @@ var ( 0: "INTERNAL", 1: "WRONG_MAGIC_NUMBER", 2: "SIGNATURE_VERIFICATION_FAIL", + 3: "NODE_UNDER_MAINTENANCE", } CommonFail_value = map[string]int32{ "INTERNAL": 0, "WRONG_MAGIC_NUMBER": 1, "SIGNATURE_VERIFICATION_FAIL": 2, + "NODE_UNDER_MAINTENANCE": 3, } ) @@ -259,19 +263,15 @@ type Container int32 const ( // [**3072**] Container not found. Container_CONTAINER_NOT_FOUND Container = 0 - // [**3073**] eACL table not found. - Container_EACL_NOT_FOUND Container = 1 ) // Enum value maps for Container. var ( Container_name = map[int32]string{ 0: "CONTAINER_NOT_FOUND", - 1: "EACL_NOT_FOUND", } Container_value = map[string]int32{ "CONTAINER_NOT_FOUND": 0, - "EACL_NOT_FOUND": 1, } ) @@ -363,9 +363,9 @@ func (Session) EnumDescriptor() ([]byte, []int) { // // * numerical value ranging from 0 to 4,294,967,295 (global code); // -// * values from enumeration (local code). The formula for the ratio of the -// local code (`L`) of a defined section (`S`) to the global one (`G`): -// `G = 1024 * S + L`. +// - values from enumeration (local code). The formula for the ratio of the +// local code (`L`) of a defined section (`S`) to the global one (`G`): +// `G = 1024 * S + L`. // // All outcomes are divided into successful and failed, which corresponds // to the success or failure of the operation. The definition of success @@ -531,34 +531,35 @@ var file_status_grpc_types_proto_rawDesc = []byte{ 0x15, 0x0a, 0x11, 0x53, 0x45, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x43, 0x4f, 0x4e, 0x54, 0x41, 0x49, 0x4e, 0x45, 0x52, 0x10, 0x03, 0x12, 0x13, 0x0a, 0x0f, 0x53, 0x45, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x53, 0x45, 0x53, 0x53, 0x49, 0x4f, 0x4e, 0x10, 0x04, 0x2a, 0x11, 0x0a, 0x07, 0x53, - 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x06, 0x0a, 0x02, 0x4f, 0x4b, 0x10, 0x00, 0x2a, 0x53, + 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x06, 0x0a, 0x02, 0x4f, 0x4b, 0x10, 0x00, 0x2a, 0x6f, 0x0a, 0x0a, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x46, 0x61, 0x69, 0x6c, 0x12, 0x0c, 0x0a, 0x08, 0x49, 0x4e, 0x54, 0x45, 0x52, 0x4e, 0x41, 0x4c, 0x10, 0x00, 0x12, 0x16, 0x0a, 0x12, 0x57, 0x52, 0x4f, 0x4e, 0x47, 0x5f, 0x4d, 0x41, 0x47, 0x49, 0x43, 0x5f, 0x4e, 0x55, 0x4d, 0x42, 0x45, 0x52, 0x10, 0x01, 0x12, 0x1f, 0x0a, 0x1b, 0x53, 0x49, 0x47, 0x4e, 0x41, 0x54, 0x55, 0x52, 0x45, 0x5f, 0x56, 0x45, 0x52, 0x49, 0x46, 0x49, 0x43, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x46, 0x41, 0x49, - 0x4c, 0x10, 0x02, 0x2a, 0x88, 0x01, 0x0a, 0x06, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x11, - 0x0a, 0x0d, 0x41, 0x43, 0x43, 0x45, 0x53, 0x53, 0x5f, 0x44, 0x45, 0x4e, 0x49, 0x45, 0x44, 0x10, - 0x00, 0x12, 0x14, 0x0a, 0x10, 0x4f, 0x42, 0x4a, 0x45, 0x43, 0x54, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, - 0x46, 0x4f, 0x55, 0x4e, 0x44, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x4c, 0x4f, 0x43, 0x4b, 0x45, - 0x44, 0x10, 0x02, 0x12, 0x1b, 0x0a, 0x17, 0x4c, 0x4f, 0x43, 0x4b, 0x5f, 0x4e, 0x4f, 0x4e, 0x5f, - 0x52, 0x45, 0x47, 0x55, 0x4c, 0x41, 0x52, 0x5f, 0x4f, 0x42, 0x4a, 0x45, 0x43, 0x54, 0x10, 0x03, - 0x12, 0x1a, 0x0a, 0x16, 0x4f, 0x42, 0x4a, 0x45, 0x43, 0x54, 0x5f, 0x41, 0x4c, 0x52, 0x45, 0x41, - 0x44, 0x59, 0x5f, 0x52, 0x45, 0x4d, 0x4f, 0x56, 0x45, 0x44, 0x10, 0x04, 0x12, 0x10, 0x0a, 0x0c, - 0x4f, 0x55, 0x54, 0x5f, 0x4f, 0x46, 0x5f, 0x52, 0x41, 0x4e, 0x47, 0x45, 0x10, 0x05, 0x2a, 0x38, - 0x0a, 0x09, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x12, 0x17, 0x0a, 0x13, 0x43, - 0x4f, 0x4e, 0x54, 0x41, 0x49, 0x4e, 0x45, 0x52, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x46, 0x4f, 0x55, - 0x4e, 0x44, 0x10, 0x00, 0x12, 0x12, 0x0a, 0x0e, 0x45, 0x41, 0x43, 0x4c, 0x5f, 0x4e, 0x4f, 0x54, - 0x5f, 0x46, 0x4f, 0x55, 0x4e, 0x44, 0x10, 0x01, 0x2a, 0x31, 0x0a, 0x07, 0x53, 0x65, 0x73, 0x73, - 0x69, 0x6f, 0x6e, 0x12, 0x13, 0x0a, 0x0f, 0x54, 0x4f, 0x4b, 0x45, 0x4e, 0x5f, 0x4e, 0x4f, 0x54, - 0x5f, 0x46, 0x4f, 0x55, 0x4e, 0x44, 0x10, 0x00, 0x12, 0x11, 0x0a, 0x0d, 0x54, 0x4f, 0x4b, 0x45, - 0x4e, 0x5f, 0x45, 0x58, 0x50, 0x49, 0x52, 0x45, 0x44, 0x10, 0x01, 0x42, 0x56, 0x5a, 0x37, 0x67, - 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, - 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, - 0x2f, 0x76, 0x32, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, - 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0xaa, 0x02, 0x1a, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, - 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x53, 0x74, 0x61, - 0x74, 0x75, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x4c, 0x10, 0x02, 0x12, 0x1a, 0x0a, 0x16, 0x4e, 0x4f, 0x44, 0x45, 0x5f, 0x55, 0x4e, 0x44, 0x45, + 0x52, 0x5f, 0x4d, 0x41, 0x49, 0x4e, 0x54, 0x45, 0x4e, 0x41, 0x4e, 0x43, 0x45, 0x10, 0x03, 0x2a, + 0x88, 0x01, 0x0a, 0x06, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x11, 0x0a, 0x0d, 0x41, 0x43, + 0x43, 0x45, 0x53, 0x53, 0x5f, 0x44, 0x45, 0x4e, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x14, 0x0a, + 0x10, 0x4f, 0x42, 0x4a, 0x45, 0x43, 0x54, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x46, 0x4f, 0x55, 0x4e, + 0x44, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x4c, 0x4f, 0x43, 0x4b, 0x45, 0x44, 0x10, 0x02, 0x12, + 0x1b, 0x0a, 0x17, 0x4c, 0x4f, 0x43, 0x4b, 0x5f, 0x4e, 0x4f, 0x4e, 0x5f, 0x52, 0x45, 0x47, 0x55, + 0x4c, 0x41, 0x52, 0x5f, 0x4f, 0x42, 0x4a, 0x45, 0x43, 0x54, 0x10, 0x03, 0x12, 0x1a, 0x0a, 0x16, + 0x4f, 0x42, 0x4a, 0x45, 0x43, 0x54, 0x5f, 0x41, 0x4c, 0x52, 0x45, 0x41, 0x44, 0x59, 0x5f, 0x52, + 0x45, 0x4d, 0x4f, 0x56, 0x45, 0x44, 0x10, 0x04, 0x12, 0x10, 0x0a, 0x0c, 0x4f, 0x55, 0x54, 0x5f, + 0x4f, 0x46, 0x5f, 0x52, 0x41, 0x4e, 0x47, 0x45, 0x10, 0x05, 0x2a, 0x24, 0x0a, 0x09, 0x43, 0x6f, + 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x12, 0x17, 0x0a, 0x13, 0x43, 0x4f, 0x4e, 0x54, 0x41, + 0x49, 0x4e, 0x45, 0x52, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x46, 0x4f, 0x55, 0x4e, 0x44, 0x10, 0x00, + 0x2a, 0x31, 0x0a, 0x07, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x13, 0x0a, 0x0f, 0x54, + 0x4f, 0x4b, 0x45, 0x4e, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x46, 0x4f, 0x55, 0x4e, 0x44, 0x10, 0x00, + 0x12, 0x11, 0x0a, 0x0d, 0x54, 0x4f, 0x4b, 0x45, 0x4e, 0x5f, 0x45, 0x58, 0x50, 0x49, 0x52, 0x45, + 0x44, 0x10, 0x01, 0x42, 0x56, 0x5a, 0x37, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, + 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, + 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x73, 0x74, 0x61, 0x74, + 0x75, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0xaa, 0x02, + 0x1a, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, + 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, } var ( diff --git a/status/status.go b/status/status.go index f300d5e..c1b5272 100644 --- a/status/status.go +++ b/status/status.go @@ -61,6 +61,8 @@ const ( WrongMagicNumber // SignatureVerificationFail is a local Code value for SIGNATURE_VERIFICATION_FAIL status. SignatureVerificationFail + // NodeUnderMaintenance is a local Code value for NODE_UNDER_MAINTENANCE status. + NodeUnderMaintenance ) const ( diff --git a/storagegroup/grpc/types.pb.go b/storagegroup/grpc/types.pb.go index de7570a..1cfe99c 100644 --- a/storagegroup/grpc/types.pb.go +++ b/storagegroup/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.1 -// protoc v3.19.4 +// protoc v3.21.5 // source: storagegroup/grpc/types.proto package storagegroup @@ -30,7 +30,6 @@ const ( // `__NEOFS__EXPIRATION_EPOCH` well-known attribute. When expired, StorageGroup // will be ignored by InnerRing nodes during Data Audit cycles and will be // deleted by Storage Nodes. -// type StorageGroup struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache diff --git a/subnet/grpc/types.pb.go b/subnet/grpc/types.pb.go index 10e2e95..2bec81d 100644 --- a/subnet/grpc/types.pb.go +++ b/subnet/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.1 -// protoc v3.19.4 +// protoc v3.21.5 // source: subnet/grpc/types.proto package subnet diff --git a/tombstone/grpc/types.pb.go b/tombstone/grpc/types.pb.go index 747532b..d971da2 100644 --- a/tombstone/grpc/types.pb.go +++ b/tombstone/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.1 -// protoc v3.19.4 +// protoc v3.21.5 // source: tombstone/grpc/types.proto package tombstone diff --git a/util/proto/test/test.pb.go b/util/proto/test/test.pb.go index edefcc3..6ac0c67 100644 --- a/util/proto/test/test.pb.go +++ b/util/proto/test/test.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.1 -// protoc v3.19.4 +// protoc v3.21.5 // source: util/proto/test/test.proto package test From f3e1f8ae7ae33b1241632c3d6d3bacbccb5d88b7 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Fri, 16 Sep 2022 11:23:43 +0300 Subject: [PATCH 1015/1196] [#415] go.mod: Update grpc dependency Signed-off-by: Evgenii Stratonikov --- go.mod | 12 ++++++------ go.sum | 32 ++++++++++++++++++++++---------- 2 files changed, 28 insertions(+), 16 deletions(-) diff --git a/go.mod b/go.mod index 0dbdda4..aa93538 100644 --- a/go.mod +++ b/go.mod @@ -5,19 +5,19 @@ go 1.17 require ( github.com/nspcc-dev/neofs-crypto v0.4.0 github.com/stretchr/testify v1.7.0 - google.golang.org/grpc v1.41.0 - google.golang.org/protobuf v1.27.1 + google.golang.org/grpc v1.48.0 + google.golang.org/protobuf v1.28.0 ) require ( github.com/davecgh/go-spew v1.1.0 // indirect - github.com/golang/protobuf v1.5.0 // indirect + github.com/golang/protobuf v1.5.2 // indirect github.com/mr-tron/base58 v1.2.0 // indirect github.com/nspcc-dev/rfc6979 v0.2.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - golang.org/x/net v0.0.0-20200822124328-c89045814202 // indirect - golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd // indirect - golang.org/x/text v0.3.0 // indirect + golang.org/x/net v0.0.0-20201021035429-f5854403a974 // indirect + golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4 // indirect + golang.org/x/text v0.3.3 // indirect google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 // indirect gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect ) diff --git a/go.sum b/go.sum index 2a0ec49..4917800 100644 --- a/go.sum +++ b/go.sum @@ -7,14 +7,17 @@ github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XL github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= -github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= +github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= -github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= +github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= @@ -30,15 +33,17 @@ github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvq github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/protobuf v1.5.0 h1:LUVKkCeviFUMKqHa4tXIIij/lbhnMbP7Fn5wKdKkRh4= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= +github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= +github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/mr-tron/base58 v1.2.0 h1:T/HDJBh4ZCPbU39/+c3rRvE0uKBQlU27+QI8LJ4t64o= @@ -68,8 +73,9 @@ golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73r golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20200822124328-c89045814202 h1:VvcQYSHwXgi7W+TpUR6A9g6Up98WAHf3f/ulnJ62IyA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20201021035429-f5854403a974 h1:IX6qOQeG5uLjB/hjjwjedwfjND0hgjPMMyO1RoIXQNI= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -79,10 +85,14 @@ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd h1:xhmwyvizuTgC2qz7ZlMluP20uW+C3Rm0FD/WLDX8884= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4 h1:myAQVi0cGEoqQVR5POX+8RR2mrocKqNN1hmeMqhX27k= +golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= @@ -103,8 +113,8 @@ google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQ google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.41.0 h1:f+PlOh7QV4iIJkPrx5NQ7qaNGFQ3OTse67yaDHfju4E= -google.golang.org/grpc v1.41.0/go.mod h1:U3l9uK9J0sini8mHphKoXyaqDA/8VyGnDee1zzIUK6k= +google.golang.org/grpc v1.48.0 h1:rQOsyJ/8+ufEDJd/Gdsz7HG220Mh9HAhFHRGnIjda0w= +google.golang.org/grpc v1.48.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -115,8 +125,10 @@ google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2 google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.27.1 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ= +google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw= +google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= From cf868188ef9c7d5822310a7dc131ef8522827f65 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Sat, 17 Sep 2022 13:59:54 +0400 Subject: [PATCH 1016/1196] [#418] netmap: Support `NetmapService.NetmapSnapshot` RPC Signed-off-by: Leonard Lyubich --- accounting/grpc/service.pb.go | 4 +- accounting/grpc/service_grpc.pb.go | 2 +- accounting/grpc/types.pb.go | 4 +- acl/grpc/types.pb.go | 6 +- audit/grpc/types.pb.go | 4 +- container/grpc/service.pb.go | 4 +- container/grpc/service_grpc.pb.go | 10 +- container/grpc/types.pb.go | 4 +- lock/grpc/types.pb.go | 4 +- netmap/convert.go | 178 +++++++++++ netmap/grpc/service.go | 35 +++ netmap/grpc/service.pb.go | 471 ++++++++++++++++++++++++----- netmap/grpc/service_grpc.pb.go | 50 ++- netmap/grpc/types.go | 10 + netmap/grpc/types.pb.go | 216 ++++++++----- netmap/marshal.go | 71 +++++ netmap/message_test.go | 5 + netmap/test/generate.go | 54 ++++ netmap/types.go | 95 ++++++ object/grpc/service.pb.go | 4 +- object/grpc/service_grpc.pb.go | 2 +- object/grpc/types.pb.go | 11 +- refs/grpc/types.pb.go | 4 +- reputation/grpc/service.pb.go | 4 +- reputation/grpc/service_grpc.pb.go | 2 +- reputation/grpc/types.pb.go | 4 +- rpc/netmap.go | 17 ++ session/grpc/service.pb.go | 4 +- session/grpc/service_grpc.pb.go | 2 +- session/grpc/types.pb.go | 4 +- signature/sign.go | 4 + status/grpc/types.pb.go | 31 +- storagegroup/grpc/types.pb.go | 4 +- subnet/grpc/types.pb.go | 4 +- tombstone/grpc/types.pb.go | 4 +- util/proto/test/test.pb.go | 4 +- 36 files changed, 1139 insertions(+), 197 deletions(-) diff --git a/accounting/grpc/service.pb.go b/accounting/grpc/service.pb.go index bbaefff..7c745ac 100644 --- a/accounting/grpc/service.pb.go +++ b/accounting/grpc/service.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.27.1 -// protoc v3.21.5 +// protoc-gen-go v1.28.0 +// protoc v3.21.6 // source: accounting/grpc/service.proto package accounting diff --git a/accounting/grpc/service_grpc.pb.go b/accounting/grpc/service_grpc.pb.go index 0f4d18d..beec45e 100644 --- a/accounting/grpc/service_grpc.pb.go +++ b/accounting/grpc/service_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.2.0 -// - protoc v3.21.5 +// - protoc v3.21.6 // source: accounting/grpc/service.proto package accounting diff --git a/accounting/grpc/types.pb.go b/accounting/grpc/types.pb.go index 7628708..883a041 100644 --- a/accounting/grpc/types.pb.go +++ b/accounting/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.27.1 -// protoc v3.21.5 +// protoc-gen-go v1.28.0 +// protoc v3.21.6 // source: accounting/grpc/types.proto package accounting diff --git a/acl/grpc/types.pb.go b/acl/grpc/types.pb.go index 9bfca6a..9d5934a 100644 --- a/acl/grpc/types.pb.go +++ b/acl/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.27.1 -// protoc v3.21.5 +// protoc-gen-go v1.28.0 +// protoc v3.21.6 // source: acl/grpc/types.proto package acl @@ -556,7 +556,7 @@ func (x *BearerToken) GetSignature() *grpc.Signature { // - $Object:homomorphicHash \ // homomorphic_hash // -// Please note, that if request or response does not have object's headers or +// Please note, that if request or response does not have object's headers of // full object (Range, RangeHash, Search, Delete), it will not be possible to // filter by object header fields or user attributes. From the well-known list // only `$Object:objectID` and `$Object:containerID` will be available, as diff --git a/audit/grpc/types.pb.go b/audit/grpc/types.pb.go index 29ef6ea..bd1d59b 100644 --- a/audit/grpc/types.pb.go +++ b/audit/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.27.1 -// protoc v3.21.5 +// protoc-gen-go v1.28.0 +// protoc v3.21.6 // source: audit/grpc/types.proto package audit diff --git a/container/grpc/service.pb.go b/container/grpc/service.pb.go index 78f8825..1e83d89 100644 --- a/container/grpc/service.pb.go +++ b/container/grpc/service.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.27.1 -// protoc v3.21.5 +// protoc-gen-go v1.28.0 +// protoc v3.21.6 // source: container/grpc/service.proto package container diff --git a/container/grpc/service_grpc.pb.go b/container/grpc/service_grpc.pb.go index ec0a971..e84c9b9 100644 --- a/container/grpc/service_grpc.pb.go +++ b/container/grpc/service_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.2.0 -// - protoc v3.21.5 +// - protoc v3.21.6 // source: container/grpc/service.proto package container @@ -75,7 +75,9 @@ type ContainerServiceClient interface { // container eACL has been successfully read; // - Common failures (SECTION_FAILURE_COMMON); // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ - // container not found. + // container not found; + // - **EACL_NOT_FOUND** (3073, SECTION_CONTAINER): \ + // eACL table not found. GetExtendedACL(ctx context.Context, in *GetExtendedACLRequest, opts ...grpc.CallOption) (*GetExtendedACLResponse, error) // Announces the space values used by the container for P2P synchronization. // @@ -214,7 +216,9 @@ type ContainerServiceServer interface { // container eACL has been successfully read; // - Common failures (SECTION_FAILURE_COMMON); // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ - // container not found. + // container not found; + // - **EACL_NOT_FOUND** (3073, SECTION_CONTAINER): \ + // eACL table not found. GetExtendedACL(context.Context, *GetExtendedACLRequest) (*GetExtendedACLResponse, error) // Announces the space values used by the container for P2P synchronization. // diff --git a/container/grpc/types.pb.go b/container/grpc/types.pb.go index d8dd62f..29901f2 100644 --- a/container/grpc/types.pb.go +++ b/container/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.27.1 -// protoc v3.21.5 +// protoc-gen-go v1.28.0 +// protoc v3.21.6 // source: container/grpc/types.proto package container diff --git a/lock/grpc/types.pb.go b/lock/grpc/types.pb.go index d118ca8..d54ad2f 100644 --- a/lock/grpc/types.pb.go +++ b/lock/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.27.1 -// protoc v3.21.5 +// protoc-gen-go v1.28.0 +// protoc v3.21.6 // source: lock/grpc/types.proto package lock diff --git a/netmap/convert.go b/netmap/convert.go index 14c3792..d2121b1 100644 --- a/netmap/convert.go +++ b/netmap/convert.go @@ -754,3 +754,181 @@ func (l *NetworkInfoResponse) FromGRPCMessage(m grpc.Message) error { return l.ResponseHeaders.FromMessage(v) } + +func (x *NetMap) ToGRPCMessage() grpc.Message { + var m *netmap.Netmap + + if x != nil { + m = new(netmap.Netmap) + + m.SetEpoch(x.epoch) + + if x.nodes != nil { + nodes := make([]*netmap.NodeInfo, len(x.nodes)) + + for i := range x.nodes { + nodes[i] = x.nodes[i].ToGRPCMessage().(*netmap.NodeInfo) + } + + m.SetNodes(nodes) + } + } + + return m +} + +func (x *NetMap) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*netmap.Netmap) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + nodes := v.GetNodes() + if nodes == nil { + x.nodes = nil + } else { + x.nodes = make([]NodeInfo, len(nodes)) + + for i := range nodes { + err = x.nodes[i].FromGRPCMessage(nodes[i]) + if err != nil { + return err + } + } + } + + x.epoch = v.GetEpoch() + + return nil +} + +func (x *SnapshotRequestBody) ToGRPCMessage() grpc.Message { + var m *netmap.NetmapSnapshotRequest_Body + + if x != nil { + m = new(netmap.NetmapSnapshotRequest_Body) + } + + return m +} + +func (x *SnapshotRequestBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*netmap.NetmapSnapshotRequest_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + return nil +} + +func (x *SnapshotRequest) ToGRPCMessage() grpc.Message { + var m *netmap.NetmapSnapshotRequest + + if x != nil { + m = new(netmap.NetmapSnapshotRequest) + + m.SetBody(x.body.ToGRPCMessage().(*netmap.NetmapSnapshotRequest_Body)) + x.RequestHeaders.ToMessage(m) + } + + return m +} + +func (x *SnapshotRequest) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*netmap.NetmapSnapshotRequest) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + body := v.GetBody() + if body == nil { + x.body = nil + } else { + if x.body == nil { + x.body = new(SnapshotRequestBody) + } + + err = x.body.FromGRPCMessage(body) + if err != nil { + return err + } + } + + return x.RequestHeaders.FromMessage(v) +} + +func (x *SnapshotResponseBody) ToGRPCMessage() grpc.Message { + var m *netmap.NetmapSnapshotResponse_Body + + if x != nil { + m = new(netmap.NetmapSnapshotResponse_Body) + + m.SetNetmap(x.netMap.ToGRPCMessage().(*netmap.Netmap)) + } + + return m +} + +func (x *SnapshotResponseBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*netmap.NetmapSnapshotResponse_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + netMap := v.GetNetmap() + if netMap == nil { + x.netMap = nil + } else { + if x.netMap == nil { + x.netMap = new(NetMap) + } + + err = x.netMap.FromGRPCMessage(netMap) + } + + return err +} + +func (x *SnapshotResponse) ToGRPCMessage() grpc.Message { + var m *netmap.NetmapSnapshotResponse + + if x != nil { + m = new(netmap.NetmapSnapshotResponse) + + m.SetBody(x.body.ToGRPCMessage().(*netmap.NetmapSnapshotResponse_Body)) + x.ResponseHeaders.ToMessage(m) + } + + return m +} + +func (x *SnapshotResponse) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*netmap.NetmapSnapshotResponse) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + body := v.GetBody() + if body == nil { + x.body = nil + } else { + if x.body == nil { + x.body = new(SnapshotResponseBody) + } + + err = x.body.FromGRPCMessage(body) + if err != nil { + return err + } + } + + return x.ResponseHeaders.FromMessage(v) +} diff --git a/netmap/grpc/service.go b/netmap/grpc/service.go index 0061631..c97f8be 100644 --- a/netmap/grpc/service.go +++ b/netmap/grpc/service.go @@ -79,3 +79,38 @@ func (x *NetworkInfoResponse) SetMetaHeader(v *session.ResponseMetaHeader) { func (x *NetworkInfoResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) { x.VerifyHeader = v } + +// SetBody sets body of the request. +func (x *NetmapSnapshotRequest) SetBody(v *NetmapSnapshotRequest_Body) { + x.Body = v +} + +// SetMetaHeader sets meta header of the request. +func (x *NetmapSnapshotRequest) SetMetaHeader(v *session.RequestMetaHeader) { + x.MetaHeader = v +} + +// SetVerifyHeader sets verification header of the request. +func (x *NetmapSnapshotRequest) SetVerifyHeader(v *session.RequestVerificationHeader) { + x.VerifyHeader = v +} + +// SetNetmap sets current Netmap. +func (x *NetmapSnapshotResponse_Body) SetNetmap(v *Netmap) { + x.Netmap = v +} + +// SetBody sets body of the response. +func (x *NetmapSnapshotResponse) SetBody(v *NetmapSnapshotResponse_Body) { + x.Body = v +} + +// SetMetaHeader sets meta header of the response. +func (x *NetmapSnapshotResponse) SetMetaHeader(v *session.ResponseMetaHeader) { + x.MetaHeader = v +} + +// SetVerifyHeader sets verification header of the response. +func (x *NetmapSnapshotResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) { + x.VerifyHeader = v +} diff --git a/netmap/grpc/service.pb.go b/netmap/grpc/service.pb.go index c200940..f062929 100644 --- a/netmap/grpc/service.pb.go +++ b/netmap/grpc/service.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.27.1 -// protoc v3.21.5 +// protoc-gen-go v1.28.0 +// protoc v3.21.6 // source: netmap/grpc/service.proto package netmap @@ -303,6 +303,146 @@ func (x *NetworkInfoResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader return nil } +// Get netmap snapshot request +type NetmapSnapshotRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Body of get netmap snapshot request message. + Body *NetmapSnapshotRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" 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,proto3" json:"verify_header,omitempty"` +} + +func (x *NetmapSnapshotRequest) Reset() { + *x = NetmapSnapshotRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_netmap_grpc_service_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *NetmapSnapshotRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NetmapSnapshotRequest) ProtoMessage() {} + +func (x *NetmapSnapshotRequest) ProtoReflect() protoreflect.Message { + mi := &file_netmap_grpc_service_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use NetmapSnapshotRequest.ProtoReflect.Descriptor instead. +func (*NetmapSnapshotRequest) Descriptor() ([]byte, []int) { + return file_netmap_grpc_service_proto_rawDescGZIP(), []int{4} +} + +func (x *NetmapSnapshotRequest) GetBody() *NetmapSnapshotRequest_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *NetmapSnapshotRequest) GetMetaHeader() *grpc.RequestMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} + +func (x *NetmapSnapshotRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} + +// Response with current netmap snapshot +type NetmapSnapshotResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Body of get netmap snapshot response message. + Body *NetmapSnapshotResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` + // Carries response meta information. Header data is used only to regulate + // message transport and does not affect response execution. + MetaHeader *grpc.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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,proto3" json:"verify_header,omitempty"` +} + +func (x *NetmapSnapshotResponse) Reset() { + *x = NetmapSnapshotResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_netmap_grpc_service_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *NetmapSnapshotResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NetmapSnapshotResponse) ProtoMessage() {} + +func (x *NetmapSnapshotResponse) ProtoReflect() protoreflect.Message { + mi := &file_netmap_grpc_service_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use NetmapSnapshotResponse.ProtoReflect.Descriptor instead. +func (*NetmapSnapshotResponse) Descriptor() ([]byte, []int) { + return file_netmap_grpc_service_proto_rawDescGZIP(), []int{5} +} + +func (x *NetmapSnapshotResponse) GetBody() *NetmapSnapshotResponse_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *NetmapSnapshotResponse) GetMetaHeader() *grpc.ResponseMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} + +func (x *NetmapSnapshotResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} + // LocalNodeInfo request body is empty. type LocalNodeInfoRequest_Body struct { state protoimpl.MessageState @@ -313,7 +453,7 @@ type LocalNodeInfoRequest_Body struct { func (x *LocalNodeInfoRequest_Body) Reset() { *x = LocalNodeInfoRequest_Body{} if protoimpl.UnsafeEnabled { - mi := &file_netmap_grpc_service_proto_msgTypes[4] + mi := &file_netmap_grpc_service_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -326,7 +466,7 @@ func (x *LocalNodeInfoRequest_Body) String() string { func (*LocalNodeInfoRequest_Body) ProtoMessage() {} func (x *LocalNodeInfoRequest_Body) ProtoReflect() protoreflect.Message { - mi := &file_netmap_grpc_service_proto_msgTypes[4] + mi := &file_netmap_grpc_service_proto_msgTypes[6] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -357,7 +497,7 @@ type LocalNodeInfoResponse_Body struct { func (x *LocalNodeInfoResponse_Body) Reset() { *x = LocalNodeInfoResponse_Body{} if protoimpl.UnsafeEnabled { - mi := &file_netmap_grpc_service_proto_msgTypes[5] + mi := &file_netmap_grpc_service_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -370,7 +510,7 @@ func (x *LocalNodeInfoResponse_Body) String() string { func (*LocalNodeInfoResponse_Body) ProtoMessage() {} func (x *LocalNodeInfoResponse_Body) ProtoReflect() protoreflect.Message { - mi := &file_netmap_grpc_service_proto_msgTypes[5] + mi := &file_netmap_grpc_service_proto_msgTypes[7] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -410,7 +550,7 @@ type NetworkInfoRequest_Body struct { func (x *NetworkInfoRequest_Body) Reset() { *x = NetworkInfoRequest_Body{} if protoimpl.UnsafeEnabled { - mi := &file_netmap_grpc_service_proto_msgTypes[6] + mi := &file_netmap_grpc_service_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -423,7 +563,7 @@ func (x *NetworkInfoRequest_Body) String() string { func (*NetworkInfoRequest_Body) ProtoMessage() {} func (x *NetworkInfoRequest_Body) ProtoReflect() protoreflect.Message { - mi := &file_netmap_grpc_service_proto_msgTypes[6] + mi := &file_netmap_grpc_service_proto_msgTypes[8] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -452,7 +592,7 @@ type NetworkInfoResponse_Body struct { func (x *NetworkInfoResponse_Body) Reset() { *x = NetworkInfoResponse_Body{} if protoimpl.UnsafeEnabled { - mi := &file_netmap_grpc_service_proto_msgTypes[7] + mi := &file_netmap_grpc_service_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -465,7 +605,7 @@ func (x *NetworkInfoResponse_Body) String() string { func (*NetworkInfoResponse_Body) ProtoMessage() {} func (x *NetworkInfoResponse_Body) ProtoReflect() protoreflect.Message { - mi := &file_netmap_grpc_service_proto_msgTypes[7] + mi := &file_netmap_grpc_service_proto_msgTypes[9] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -488,6 +628,94 @@ func (x *NetworkInfoResponse_Body) GetNetworkInfo() *NetworkInfo { return nil } +// Get netmap snapshot request body. +type NetmapSnapshotRequest_Body struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *NetmapSnapshotRequest_Body) Reset() { + *x = NetmapSnapshotRequest_Body{} + if protoimpl.UnsafeEnabled { + mi := &file_netmap_grpc_service_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *NetmapSnapshotRequest_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NetmapSnapshotRequest_Body) ProtoMessage() {} + +func (x *NetmapSnapshotRequest_Body) ProtoReflect() protoreflect.Message { + mi := &file_netmap_grpc_service_proto_msgTypes[10] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use NetmapSnapshotRequest_Body.ProtoReflect.Descriptor instead. +func (*NetmapSnapshotRequest_Body) Descriptor() ([]byte, []int) { + return file_netmap_grpc_service_proto_rawDescGZIP(), []int{4, 0} +} + +// Get netmap snapshot response body +type NetmapSnapshotResponse_Body struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Structure of the requested network map. + Netmap *Netmap `protobuf:"bytes,1,opt,name=netmap,proto3" json:"netmap,omitempty"` +} + +func (x *NetmapSnapshotResponse_Body) Reset() { + *x = NetmapSnapshotResponse_Body{} + if protoimpl.UnsafeEnabled { + mi := &file_netmap_grpc_service_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *NetmapSnapshotResponse_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NetmapSnapshotResponse_Body) ProtoMessage() {} + +func (x *NetmapSnapshotResponse_Body) ProtoReflect() protoreflect.Message { + mi := &file_netmap_grpc_service_proto_msgTypes[11] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use NetmapSnapshotResponse_Body.ProtoReflect.Descriptor instead. +func (*NetmapSnapshotResponse_Body) Descriptor() ([]byte, []int) { + return file_netmap_grpc_service_proto_rawDescGZIP(), []int{5, 0} +} + +func (x *NetmapSnapshotResponse_Body) GetNetmap() *Netmap { + if x != nil { + return x.Netmap + } + return nil +} + var File_netmap_grpc_service_proto protoreflect.FileDescriptor var file_netmap_grpc_service_proto_rawDesc = []byte{ @@ -572,26 +800,67 @@ var file_netmap_grpc_service_proto_rawDesc = []byte{ 0x6e, 0x66, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x0b, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, - 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x32, 0xcd, 0x01, 0x0a, 0x0d, 0x4e, 0x65, 0x74, 0x6d, 0x61, 0x70, - 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x60, 0x0a, 0x0d, 0x4c, 0x6f, 0x63, 0x61, 0x6c, - 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x26, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, - 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4c, 0x6f, 0x63, 0x61, - 0x6c, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x27, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, - 0x6d, 0x61, 0x70, 0x2e, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, - 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5a, 0x0a, 0x0b, 0x4e, 0x65, 0x74, - 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x24, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, - 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4e, 0x65, 0x74, 0x77, - 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x25, - 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, - 0x70, 0x2e, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x56, 0x5a, 0x37, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, - 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, - 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x6e, 0x65, - 0x74, 0x6d, 0x61, 0x70, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, - 0xaa, 0x02, 0x1a, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, - 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x4e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x62, 0x06, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x22, 0xfb, 0x01, 0x0a, 0x15, 0x4e, 0x65, 0x74, 0x6d, 0x61, 0x70, + 0x53, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x40, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, + 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, + 0x2e, 0x4e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x53, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 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, 0x06, 0x0a, 0x04, 0x42, + 0x6f, 0x64, 0x79, 0x22, 0xb1, 0x02, 0x0a, 0x16, 0x4e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x53, 0x6e, + 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x41, + 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, + 0x4e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x53, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 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, 0x38, 0x0a, + 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x30, 0x0a, 0x06, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x52, + 0x06, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x32, 0xb2, 0x02, 0x0a, 0x0d, 0x4e, 0x65, 0x74, 0x6d, + 0x61, 0x70, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x60, 0x0a, 0x0d, 0x4c, 0x6f, 0x63, + 0x61, 0x6c, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x26, 0x2e, 0x6e, 0x65, 0x6f, + 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4c, 0x6f, + 0x63, 0x61, 0x6c, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x27, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, + 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x4e, 0x6f, 0x64, 0x65, 0x49, + 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5a, 0x0a, 0x0b, 0x4e, + 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x24, 0x2e, 0x6e, 0x65, 0x6f, + 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4e, 0x65, + 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x25, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, + 0x6d, 0x61, 0x70, 0x2e, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x63, 0x0a, 0x0e, 0x4e, 0x65, 0x74, 0x6d, 0x61, + 0x70, 0x53, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x12, 0x27, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, + 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4e, 0x65, 0x74, + 0x6d, 0x61, 0x70, 0x53, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x28, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, + 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x53, 0x6e, 0x61, 0x70, + 0x73, 0x68, 0x6f, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x56, 0x5a, 0x37, + 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, + 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, + 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2f, 0x67, 0x72, 0x70, 0x63, + 0x3b, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0xaa, 0x02, 0x1a, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, + 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x4e, 0x65, + 0x74, 0x6d, 0x61, 0x70, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -606,49 +875,63 @@ func file_netmap_grpc_service_proto_rawDescGZIP() []byte { return file_netmap_grpc_service_proto_rawDescData } -var file_netmap_grpc_service_proto_msgTypes = make([]protoimpl.MessageInfo, 8) +var file_netmap_grpc_service_proto_msgTypes = make([]protoimpl.MessageInfo, 12) var file_netmap_grpc_service_proto_goTypes = []interface{}{ (*LocalNodeInfoRequest)(nil), // 0: neo.fs.v2.netmap.LocalNodeInfoRequest (*LocalNodeInfoResponse)(nil), // 1: neo.fs.v2.netmap.LocalNodeInfoResponse (*NetworkInfoRequest)(nil), // 2: neo.fs.v2.netmap.NetworkInfoRequest (*NetworkInfoResponse)(nil), // 3: neo.fs.v2.netmap.NetworkInfoResponse - (*LocalNodeInfoRequest_Body)(nil), // 4: neo.fs.v2.netmap.LocalNodeInfoRequest.Body - (*LocalNodeInfoResponse_Body)(nil), // 5: neo.fs.v2.netmap.LocalNodeInfoResponse.Body - (*NetworkInfoRequest_Body)(nil), // 6: neo.fs.v2.netmap.NetworkInfoRequest.Body - (*NetworkInfoResponse_Body)(nil), // 7: neo.fs.v2.netmap.NetworkInfoResponse.Body - (*grpc.RequestMetaHeader)(nil), // 8: neo.fs.v2.session.RequestMetaHeader - (*grpc.RequestVerificationHeader)(nil), // 9: neo.fs.v2.session.RequestVerificationHeader - (*grpc.ResponseMetaHeader)(nil), // 10: neo.fs.v2.session.ResponseMetaHeader - (*grpc.ResponseVerificationHeader)(nil), // 11: neo.fs.v2.session.ResponseVerificationHeader - (*grpc1.Version)(nil), // 12: neo.fs.v2.refs.Version - (*NodeInfo)(nil), // 13: neo.fs.v2.netmap.NodeInfo - (*NetworkInfo)(nil), // 14: neo.fs.v2.netmap.NetworkInfo + (*NetmapSnapshotRequest)(nil), // 4: neo.fs.v2.netmap.NetmapSnapshotRequest + (*NetmapSnapshotResponse)(nil), // 5: neo.fs.v2.netmap.NetmapSnapshotResponse + (*LocalNodeInfoRequest_Body)(nil), // 6: neo.fs.v2.netmap.LocalNodeInfoRequest.Body + (*LocalNodeInfoResponse_Body)(nil), // 7: neo.fs.v2.netmap.LocalNodeInfoResponse.Body + (*NetworkInfoRequest_Body)(nil), // 8: neo.fs.v2.netmap.NetworkInfoRequest.Body + (*NetworkInfoResponse_Body)(nil), // 9: neo.fs.v2.netmap.NetworkInfoResponse.Body + (*NetmapSnapshotRequest_Body)(nil), // 10: neo.fs.v2.netmap.NetmapSnapshotRequest.Body + (*NetmapSnapshotResponse_Body)(nil), // 11: neo.fs.v2.netmap.NetmapSnapshotResponse.Body + (*grpc.RequestMetaHeader)(nil), // 12: neo.fs.v2.session.RequestMetaHeader + (*grpc.RequestVerificationHeader)(nil), // 13: neo.fs.v2.session.RequestVerificationHeader + (*grpc.ResponseMetaHeader)(nil), // 14: neo.fs.v2.session.ResponseMetaHeader + (*grpc.ResponseVerificationHeader)(nil), // 15: neo.fs.v2.session.ResponseVerificationHeader + (*grpc1.Version)(nil), // 16: neo.fs.v2.refs.Version + (*NodeInfo)(nil), // 17: neo.fs.v2.netmap.NodeInfo + (*NetworkInfo)(nil), // 18: neo.fs.v2.netmap.NetworkInfo + (*Netmap)(nil), // 19: neo.fs.v2.netmap.Netmap } var file_netmap_grpc_service_proto_depIdxs = []int32{ - 4, // 0: neo.fs.v2.netmap.LocalNodeInfoRequest.body:type_name -> neo.fs.v2.netmap.LocalNodeInfoRequest.Body - 8, // 1: neo.fs.v2.netmap.LocalNodeInfoRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader - 9, // 2: neo.fs.v2.netmap.LocalNodeInfoRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader - 5, // 3: neo.fs.v2.netmap.LocalNodeInfoResponse.body:type_name -> neo.fs.v2.netmap.LocalNodeInfoResponse.Body - 10, // 4: neo.fs.v2.netmap.LocalNodeInfoResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader - 11, // 5: neo.fs.v2.netmap.LocalNodeInfoResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader - 6, // 6: neo.fs.v2.netmap.NetworkInfoRequest.body:type_name -> neo.fs.v2.netmap.NetworkInfoRequest.Body - 8, // 7: neo.fs.v2.netmap.NetworkInfoRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader - 9, // 8: neo.fs.v2.netmap.NetworkInfoRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader - 7, // 9: neo.fs.v2.netmap.NetworkInfoResponse.body:type_name -> neo.fs.v2.netmap.NetworkInfoResponse.Body - 10, // 10: neo.fs.v2.netmap.NetworkInfoResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader - 11, // 11: neo.fs.v2.netmap.NetworkInfoResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader - 12, // 12: neo.fs.v2.netmap.LocalNodeInfoResponse.Body.version:type_name -> neo.fs.v2.refs.Version - 13, // 13: neo.fs.v2.netmap.LocalNodeInfoResponse.Body.node_info:type_name -> neo.fs.v2.netmap.NodeInfo - 14, // 14: neo.fs.v2.netmap.NetworkInfoResponse.Body.network_info:type_name -> neo.fs.v2.netmap.NetworkInfo - 0, // 15: neo.fs.v2.netmap.NetmapService.LocalNodeInfo:input_type -> neo.fs.v2.netmap.LocalNodeInfoRequest - 2, // 16: neo.fs.v2.netmap.NetmapService.NetworkInfo:input_type -> neo.fs.v2.netmap.NetworkInfoRequest - 1, // 17: neo.fs.v2.netmap.NetmapService.LocalNodeInfo:output_type -> neo.fs.v2.netmap.LocalNodeInfoResponse - 3, // 18: neo.fs.v2.netmap.NetmapService.NetworkInfo:output_type -> neo.fs.v2.netmap.NetworkInfoResponse - 17, // [17:19] is the sub-list for method output_type - 15, // [15:17] is the sub-list for method input_type - 15, // [15:15] is the sub-list for extension type_name - 15, // [15:15] is the sub-list for extension extendee - 0, // [0:15] is the sub-list for field type_name + 6, // 0: neo.fs.v2.netmap.LocalNodeInfoRequest.body:type_name -> neo.fs.v2.netmap.LocalNodeInfoRequest.Body + 12, // 1: neo.fs.v2.netmap.LocalNodeInfoRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader + 13, // 2: neo.fs.v2.netmap.LocalNodeInfoRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader + 7, // 3: neo.fs.v2.netmap.LocalNodeInfoResponse.body:type_name -> neo.fs.v2.netmap.LocalNodeInfoResponse.Body + 14, // 4: neo.fs.v2.netmap.LocalNodeInfoResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader + 15, // 5: neo.fs.v2.netmap.LocalNodeInfoResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 8, // 6: neo.fs.v2.netmap.NetworkInfoRequest.body:type_name -> neo.fs.v2.netmap.NetworkInfoRequest.Body + 12, // 7: neo.fs.v2.netmap.NetworkInfoRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader + 13, // 8: neo.fs.v2.netmap.NetworkInfoRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader + 9, // 9: neo.fs.v2.netmap.NetworkInfoResponse.body:type_name -> neo.fs.v2.netmap.NetworkInfoResponse.Body + 14, // 10: neo.fs.v2.netmap.NetworkInfoResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader + 15, // 11: neo.fs.v2.netmap.NetworkInfoResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 10, // 12: neo.fs.v2.netmap.NetmapSnapshotRequest.body:type_name -> neo.fs.v2.netmap.NetmapSnapshotRequest.Body + 12, // 13: neo.fs.v2.netmap.NetmapSnapshotRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader + 13, // 14: neo.fs.v2.netmap.NetmapSnapshotRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader + 11, // 15: neo.fs.v2.netmap.NetmapSnapshotResponse.body:type_name -> neo.fs.v2.netmap.NetmapSnapshotResponse.Body + 14, // 16: neo.fs.v2.netmap.NetmapSnapshotResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader + 15, // 17: neo.fs.v2.netmap.NetmapSnapshotResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 16, // 18: neo.fs.v2.netmap.LocalNodeInfoResponse.Body.version:type_name -> neo.fs.v2.refs.Version + 17, // 19: neo.fs.v2.netmap.LocalNodeInfoResponse.Body.node_info:type_name -> neo.fs.v2.netmap.NodeInfo + 18, // 20: neo.fs.v2.netmap.NetworkInfoResponse.Body.network_info:type_name -> neo.fs.v2.netmap.NetworkInfo + 19, // 21: neo.fs.v2.netmap.NetmapSnapshotResponse.Body.netmap:type_name -> neo.fs.v2.netmap.Netmap + 0, // 22: neo.fs.v2.netmap.NetmapService.LocalNodeInfo:input_type -> neo.fs.v2.netmap.LocalNodeInfoRequest + 2, // 23: neo.fs.v2.netmap.NetmapService.NetworkInfo:input_type -> neo.fs.v2.netmap.NetworkInfoRequest + 4, // 24: neo.fs.v2.netmap.NetmapService.NetmapSnapshot:input_type -> neo.fs.v2.netmap.NetmapSnapshotRequest + 1, // 25: neo.fs.v2.netmap.NetmapService.LocalNodeInfo:output_type -> neo.fs.v2.netmap.LocalNodeInfoResponse + 3, // 26: neo.fs.v2.netmap.NetmapService.NetworkInfo:output_type -> neo.fs.v2.netmap.NetworkInfoResponse + 5, // 27: neo.fs.v2.netmap.NetmapService.NetmapSnapshot:output_type -> neo.fs.v2.netmap.NetmapSnapshotResponse + 25, // [25:28] is the sub-list for method output_type + 22, // [22:25] is the sub-list for method input_type + 22, // [22:22] is the sub-list for extension type_name + 22, // [22:22] is the sub-list for extension extendee + 0, // [0:22] is the sub-list for field type_name } func init() { file_netmap_grpc_service_proto_init() } @@ -707,7 +990,7 @@ func file_netmap_grpc_service_proto_init() { } } file_netmap_grpc_service_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*LocalNodeInfoRequest_Body); i { + switch v := v.(*NetmapSnapshotRequest); i { case 0: return &v.state case 1: @@ -719,7 +1002,7 @@ func file_netmap_grpc_service_proto_init() { } } file_netmap_grpc_service_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*LocalNodeInfoResponse_Body); i { + switch v := v.(*NetmapSnapshotResponse); i { case 0: return &v.state case 1: @@ -731,7 +1014,7 @@ func file_netmap_grpc_service_proto_init() { } } file_netmap_grpc_service_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NetworkInfoRequest_Body); i { + switch v := v.(*LocalNodeInfoRequest_Body); i { case 0: return &v.state case 1: @@ -743,6 +1026,30 @@ func file_netmap_grpc_service_proto_init() { } } file_netmap_grpc_service_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*LocalNodeInfoResponse_Body); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_netmap_grpc_service_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*NetworkInfoRequest_Body); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_netmap_grpc_service_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*NetworkInfoResponse_Body); i { case 0: return &v.state @@ -754,6 +1061,30 @@ func file_netmap_grpc_service_proto_init() { return nil } } + file_netmap_grpc_service_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*NetmapSnapshotRequest_Body); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_netmap_grpc_service_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*NetmapSnapshotResponse_Body); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } type x struct{} out := protoimpl.TypeBuilder{ @@ -761,7 +1092,7 @@ func file_netmap_grpc_service_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_netmap_grpc_service_proto_rawDesc, NumEnums: 0, - NumMessages: 8, + NumMessages: 12, NumExtensions: 0, NumServices: 1, }, diff --git a/netmap/grpc/service_grpc.pb.go b/netmap/grpc/service_grpc.pb.go index e27cd2c..34c6f80 100644 --- a/netmap/grpc/service_grpc.pb.go +++ b/netmap/grpc/service_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.2.0 -// - protoc v3.21.5 +// - protoc v3.21.6 // source: netmap/grpc/service.proto package netmap @@ -40,6 +40,13 @@ type NetmapServiceClient interface { // information about the current network state has been successfully read; // - Common failures (SECTION_FAILURE_COMMON). NetworkInfo(ctx context.Context, in *NetworkInfoRequest, opts ...grpc.CallOption) (*NetworkInfoResponse, error) + // Returns network map snapshot of the current NeoFS epoch. + // + // Statuses: + // - **OK** (0, SECTION_SUCCESS): + // information about the current network map has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON). + NetmapSnapshot(ctx context.Context, in *NetmapSnapshotRequest, opts ...grpc.CallOption) (*NetmapSnapshotResponse, error) } type netmapServiceClient struct { @@ -68,6 +75,15 @@ func (c *netmapServiceClient) NetworkInfo(ctx context.Context, in *NetworkInfoRe return out, nil } +func (c *netmapServiceClient) NetmapSnapshot(ctx context.Context, in *NetmapSnapshotRequest, opts ...grpc.CallOption) (*NetmapSnapshotResponse, error) { + out := new(NetmapSnapshotResponse) + err := c.cc.Invoke(ctx, "/neo.fs.v2.netmap.NetmapService/NetmapSnapshot", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // NetmapServiceServer is the server API for NetmapService service. // All implementations should embed UnimplementedNetmapServiceServer // for forward compatibility @@ -90,6 +106,13 @@ type NetmapServiceServer interface { // information about the current network state has been successfully read; // - Common failures (SECTION_FAILURE_COMMON). NetworkInfo(context.Context, *NetworkInfoRequest) (*NetworkInfoResponse, error) + // Returns network map snapshot of the current NeoFS epoch. + // + // Statuses: + // - **OK** (0, SECTION_SUCCESS): + // information about the current network map has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON). + NetmapSnapshot(context.Context, *NetmapSnapshotRequest) (*NetmapSnapshotResponse, error) } // UnimplementedNetmapServiceServer should be embedded to have forward compatible implementations. @@ -102,6 +125,9 @@ func (UnimplementedNetmapServiceServer) LocalNodeInfo(context.Context, *LocalNod func (UnimplementedNetmapServiceServer) NetworkInfo(context.Context, *NetworkInfoRequest) (*NetworkInfoResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method NetworkInfo not implemented") } +func (UnimplementedNetmapServiceServer) NetmapSnapshot(context.Context, *NetmapSnapshotRequest) (*NetmapSnapshotResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method NetmapSnapshot not implemented") +} // 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 @@ -150,6 +176,24 @@ func _NetmapService_NetworkInfo_Handler(srv interface{}, ctx context.Context, de return interceptor(ctx, in, info, handler) } +func _NetmapService_NetmapSnapshot_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(NetmapSnapshotRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(NetmapServiceServer).NetmapSnapshot(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/neo.fs.v2.netmap.NetmapService/NetmapSnapshot", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(NetmapServiceServer).NetmapSnapshot(ctx, req.(*NetmapSnapshotRequest)) + } + return interceptor(ctx, in, info, handler) +} + // NetmapService_ServiceDesc is the grpc.ServiceDesc for NetmapService service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) @@ -165,6 +209,10 @@ var NetmapService_ServiceDesc = grpc.ServiceDesc{ MethodName: "NetworkInfo", Handler: _NetmapService_NetworkInfo_Handler, }, + { + MethodName: "NetmapSnapshot", + Handler: _NetmapService_NetmapSnapshot_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "netmap/grpc/service.proto", diff --git a/netmap/grpc/types.go b/netmap/grpc/types.go index 940404a..c555180 100644 --- a/netmap/grpc/types.go +++ b/netmap/grpc/types.go @@ -202,3 +202,13 @@ func (x *NetworkConfig_Parameter) SetValue(v []byte) { func (x *NetworkConfig) SetParameters(v []*NetworkConfig_Parameter) { x.Parameters = v } + +// SetEpoch sets revision number of the Netmap. +func (x *Netmap) SetEpoch(v uint64) { + x.Epoch = v +} + +// SetNodes sets nodes presented in the Netmap. +func (x *Netmap) SetNodes(v []*NodeInfo) { + x.Nodes = v +} diff --git a/netmap/grpc/types.pb.go b/netmap/grpc/types.pb.go index a5fd6e5..265bc24 100644 --- a/netmap/grpc/types.pb.go +++ b/netmap/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.27.1 -// protoc v3.21.5 +// protoc-gen-go v1.28.0 +// protoc v3.21.6 // source: netmap/grpc/types.proto package netmap @@ -615,6 +615,64 @@ func (x *NodeInfo) GetState() NodeInfo_State { return NodeInfo_UNSPECIFIED } +// Network map structure +type Netmap struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Network map revision number. + Epoch uint64 `protobuf:"varint,1,opt,name=epoch,proto3" json:"epoch,omitempty"` + // Nodes presented in network. + Nodes []*NodeInfo `protobuf:"bytes,2,rep,name=nodes,proto3" json:"nodes,omitempty"` +} + +func (x *Netmap) Reset() { + *x = Netmap{} + if protoimpl.UnsafeEnabled { + mi := &file_netmap_grpc_types_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Netmap) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Netmap) ProtoMessage() {} + +func (x *Netmap) ProtoReflect() protoreflect.Message { + mi := &file_netmap_grpc_types_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Netmap.ProtoReflect.Descriptor instead. +func (*Netmap) Descriptor() ([]byte, []int) { + return file_netmap_grpc_types_proto_rawDescGZIP(), []int{5} +} + +func (x *Netmap) GetEpoch() uint64 { + if x != nil { + return x.Epoch + } + return 0 +} + +func (x *Netmap) GetNodes() []*NodeInfo { + if x != nil { + return x.Nodes + } + return nil +} + // NeoFS network configuration type NetworkConfig struct { state protoimpl.MessageState @@ -628,7 +686,7 @@ type NetworkConfig struct { func (x *NetworkConfig) Reset() { *x = NetworkConfig{} if protoimpl.UnsafeEnabled { - mi := &file_netmap_grpc_types_proto_msgTypes[5] + mi := &file_netmap_grpc_types_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -641,7 +699,7 @@ func (x *NetworkConfig) String() string { func (*NetworkConfig) ProtoMessage() {} func (x *NetworkConfig) ProtoReflect() protoreflect.Message { - mi := &file_netmap_grpc_types_proto_msgTypes[5] + mi := &file_netmap_grpc_types_proto_msgTypes[6] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -654,7 +712,7 @@ func (x *NetworkConfig) ProtoReflect() protoreflect.Message { // Deprecated: Use NetworkConfig.ProtoReflect.Descriptor instead. func (*NetworkConfig) Descriptor() ([]byte, []int) { - return file_netmap_grpc_types_proto_rawDescGZIP(), []int{5} + return file_netmap_grpc_types_proto_rawDescGZIP(), []int{6} } func (x *NetworkConfig) GetParameters() []*NetworkConfig_Parameter { @@ -683,7 +741,7 @@ type NetworkInfo struct { func (x *NetworkInfo) Reset() { *x = NetworkInfo{} if protoimpl.UnsafeEnabled { - mi := &file_netmap_grpc_types_proto_msgTypes[6] + mi := &file_netmap_grpc_types_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -696,7 +754,7 @@ func (x *NetworkInfo) String() string { func (*NetworkInfo) ProtoMessage() {} func (x *NetworkInfo) ProtoReflect() protoreflect.Message { - mi := &file_netmap_grpc_types_proto_msgTypes[6] + mi := &file_netmap_grpc_types_proto_msgTypes[7] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -709,7 +767,7 @@ func (x *NetworkInfo) ProtoReflect() protoreflect.Message { // Deprecated: Use NetworkInfo.ProtoReflect.Descriptor instead. func (*NetworkInfo) Descriptor() ([]byte, []int) { - return file_netmap_grpc_types_proto_rawDescGZIP(), []int{6} + return file_netmap_grpc_types_proto_rawDescGZIP(), []int{7} } func (x *NetworkInfo) GetCurrentEpoch() uint64 { @@ -827,7 +885,7 @@ type NodeInfo_Attribute struct { func (x *NodeInfo_Attribute) Reset() { *x = NodeInfo_Attribute{} if protoimpl.UnsafeEnabled { - mi := &file_netmap_grpc_types_proto_msgTypes[7] + mi := &file_netmap_grpc_types_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -840,7 +898,7 @@ func (x *NodeInfo_Attribute) String() string { func (*NodeInfo_Attribute) ProtoMessage() {} func (x *NodeInfo_Attribute) ProtoReflect() protoreflect.Message { - mi := &file_netmap_grpc_types_proto_msgTypes[7] + mi := &file_netmap_grpc_types_proto_msgTypes[8] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -892,7 +950,7 @@ type NetworkConfig_Parameter struct { func (x *NetworkConfig_Parameter) Reset() { *x = NetworkConfig_Parameter{} if protoimpl.UnsafeEnabled { - mi := &file_netmap_grpc_types_proto_msgTypes[8] + mi := &file_netmap_grpc_types_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -905,7 +963,7 @@ func (x *NetworkConfig_Parameter) String() string { func (*NetworkConfig_Parameter) ProtoMessage() {} func (x *NetworkConfig_Parameter) ProtoReflect() protoreflect.Message { - mi := &file_netmap_grpc_types_proto_msgTypes[8] + mi := &file_netmap_grpc_types_proto_msgTypes[9] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -918,7 +976,7 @@ func (x *NetworkConfig_Parameter) ProtoReflect() protoreflect.Message { // Deprecated: Use NetworkConfig_Parameter.ProtoReflect.Descriptor instead. func (*NetworkConfig_Parameter) Descriptor() ([]byte, []int) { - return file_netmap_grpc_types_proto_rawDescGZIP(), []int{5, 0} + return file_netmap_grpc_types_proto_rawDescGZIP(), []int{6, 0} } func (x *NetworkConfig_Parameter) GetKey() []byte { @@ -1006,44 +1064,50 @@ var file_netmap_grpc_types_proto_rawDesc = []byte{ 0x0a, 0x0b, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x4f, 0x4e, 0x4c, 0x49, 0x4e, 0x45, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x4f, 0x46, 0x46, 0x4c, 0x49, 0x4e, 0x45, 0x10, 0x02, 0x12, 0x0f, 0x0a, 0x0b, 0x4d, 0x41, 0x49, 0x4e, - 0x54, 0x45, 0x4e, 0x41, 0x4e, 0x43, 0x45, 0x10, 0x03, 0x22, 0x8f, 0x01, 0x0a, 0x0d, 0x4e, 0x65, - 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x49, 0x0a, 0x0a, 0x70, - 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x29, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, + 0x54, 0x45, 0x4e, 0x41, 0x4e, 0x43, 0x45, 0x10, 0x03, 0x22, 0x50, 0x0a, 0x06, 0x4e, 0x65, 0x74, + 0x6d, 0x61, 0x70, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x04, 0x52, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x12, 0x30, 0x0a, 0x05, 0x6e, 0x6f, 0x64, + 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4e, 0x6f, 0x64, 0x65, + 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x05, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x22, 0x8f, 0x01, 0x0a, 0x0d, + 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x49, 0x0a, + 0x0a, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x29, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, + 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x43, 0x6f, 0x6e, 0x66, + 0x69, 0x67, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x52, 0x0a, 0x70, 0x61, + 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x1a, 0x33, 0x0a, 0x09, 0x50, 0x61, 0x72, 0x61, + 0x6d, 0x65, 0x74, 0x65, 0x72, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0c, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xbf, 0x01, + 0x0a, 0x0b, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x23, 0x0a, + 0x0d, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x04, 0x52, 0x0c, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x45, 0x70, 0x6f, + 0x63, 0x68, 0x12, 0x21, 0x0a, 0x0c, 0x6d, 0x61, 0x67, 0x69, 0x63, 0x5f, 0x6e, 0x75, 0x6d, 0x62, + 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0b, 0x6d, 0x61, 0x67, 0x69, 0x63, 0x4e, + 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x20, 0x0a, 0x0c, 0x6d, 0x73, 0x5f, 0x70, 0x65, 0x72, 0x5f, + 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x6d, 0x73, 0x50, + 0x65, 0x72, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x46, 0x0a, 0x0e, 0x6e, 0x65, 0x74, 0x77, 0x6f, + 0x72, 0x6b, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, - 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x52, 0x0a, 0x70, 0x61, 0x72, 0x61, - 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x1a, 0x33, 0x0a, 0x09, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, - 0x74, 0x65, 0x72, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, - 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xbf, 0x01, 0x0a, 0x0b, - 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x23, 0x0a, 0x0d, 0x63, - 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x04, 0x52, 0x0c, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x45, 0x70, 0x6f, 0x63, 0x68, - 0x12, 0x21, 0x0a, 0x0c, 0x6d, 0x61, 0x67, 0x69, 0x63, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0b, 0x6d, 0x61, 0x67, 0x69, 0x63, 0x4e, 0x75, 0x6d, - 0x62, 0x65, 0x72, 0x12, 0x20, 0x0a, 0x0c, 0x6d, 0x73, 0x5f, 0x70, 0x65, 0x72, 0x5f, 0x62, 0x6c, - 0x6f, 0x63, 0x6b, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x6d, 0x73, 0x50, 0x65, 0x72, - 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x46, 0x0a, 0x0e, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, - 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, - 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, - 0x2e, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x0d, - 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2a, 0x67, 0x0a, - 0x09, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x19, 0x0a, 0x15, 0x4f, 0x50, - 0x45, 0x52, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, - 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x06, 0x0a, 0x02, 0x45, 0x51, 0x10, 0x01, 0x12, 0x06, 0x0a, - 0x02, 0x4e, 0x45, 0x10, 0x02, 0x12, 0x06, 0x0a, 0x02, 0x47, 0x54, 0x10, 0x03, 0x12, 0x06, 0x0a, - 0x02, 0x47, 0x45, 0x10, 0x04, 0x12, 0x06, 0x0a, 0x02, 0x4c, 0x54, 0x10, 0x05, 0x12, 0x06, 0x0a, - 0x02, 0x4c, 0x45, 0x10, 0x06, 0x12, 0x06, 0x0a, 0x02, 0x4f, 0x52, 0x10, 0x07, 0x12, 0x07, 0x0a, - 0x03, 0x41, 0x4e, 0x44, 0x10, 0x08, 0x2a, 0x38, 0x0a, 0x06, 0x43, 0x6c, 0x61, 0x75, 0x73, 0x65, - 0x12, 0x16, 0x0a, 0x12, 0x43, 0x4c, 0x41, 0x55, 0x53, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, - 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x53, 0x41, 0x4d, 0x45, - 0x10, 0x01, 0x12, 0x0c, 0x0a, 0x08, 0x44, 0x49, 0x53, 0x54, 0x49, 0x4e, 0x43, 0x54, 0x10, 0x02, - 0x42, 0x56, 0x5a, 0x37, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, - 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, - 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2f, - 0x67, 0x72, 0x70, 0x63, 0x3b, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0xaa, 0x02, 0x1a, 0x4e, 0x65, - 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, - 0x49, 0x2e, 0x4e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x52, 0x0d, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2a, + 0x67, 0x0a, 0x09, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x19, 0x0a, 0x15, + 0x4f, 0x50, 0x45, 0x52, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, + 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x06, 0x0a, 0x02, 0x45, 0x51, 0x10, 0x01, 0x12, + 0x06, 0x0a, 0x02, 0x4e, 0x45, 0x10, 0x02, 0x12, 0x06, 0x0a, 0x02, 0x47, 0x54, 0x10, 0x03, 0x12, + 0x06, 0x0a, 0x02, 0x47, 0x45, 0x10, 0x04, 0x12, 0x06, 0x0a, 0x02, 0x4c, 0x54, 0x10, 0x05, 0x12, + 0x06, 0x0a, 0x02, 0x4c, 0x45, 0x10, 0x06, 0x12, 0x06, 0x0a, 0x02, 0x4f, 0x52, 0x10, 0x07, 0x12, + 0x07, 0x0a, 0x03, 0x41, 0x4e, 0x44, 0x10, 0x08, 0x2a, 0x38, 0x0a, 0x06, 0x43, 0x6c, 0x61, 0x75, + 0x73, 0x65, 0x12, 0x16, 0x0a, 0x12, 0x43, 0x4c, 0x41, 0x55, 0x53, 0x45, 0x5f, 0x55, 0x4e, 0x53, + 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x53, 0x41, + 0x4d, 0x45, 0x10, 0x01, 0x12, 0x0c, 0x0a, 0x08, 0x44, 0x49, 0x53, 0x54, 0x49, 0x4e, 0x43, 0x54, + 0x10, 0x02, 0x42, 0x56, 0x5a, 0x37, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, + 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, + 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x6e, 0x65, 0x74, 0x6d, 0x61, + 0x70, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0xaa, 0x02, 0x1a, + 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, + 0x41, 0x50, 0x49, 0x2e, 0x4e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, } var ( @@ -1059,7 +1123,7 @@ func file_netmap_grpc_types_proto_rawDescGZIP() []byte { } var file_netmap_grpc_types_proto_enumTypes = make([]protoimpl.EnumInfo, 3) -var file_netmap_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 9) +var file_netmap_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 10) var file_netmap_grpc_types_proto_goTypes = []interface{}{ (Operation)(0), // 0: neo.fs.v2.netmap.Operation (Clause)(0), // 1: neo.fs.v2.netmap.Clause @@ -1069,11 +1133,12 @@ var file_netmap_grpc_types_proto_goTypes = []interface{}{ (*Replica)(nil), // 5: neo.fs.v2.netmap.Replica (*PlacementPolicy)(nil), // 6: neo.fs.v2.netmap.PlacementPolicy (*NodeInfo)(nil), // 7: neo.fs.v2.netmap.NodeInfo - (*NetworkConfig)(nil), // 8: neo.fs.v2.netmap.NetworkConfig - (*NetworkInfo)(nil), // 9: neo.fs.v2.netmap.NetworkInfo - (*NodeInfo_Attribute)(nil), // 10: neo.fs.v2.netmap.NodeInfo.Attribute - (*NetworkConfig_Parameter)(nil), // 11: neo.fs.v2.netmap.NetworkConfig.Parameter - (*grpc.SubnetID)(nil), // 12: neo.fs.v2.refs.SubnetID + (*Netmap)(nil), // 8: neo.fs.v2.netmap.Netmap + (*NetworkConfig)(nil), // 9: neo.fs.v2.netmap.NetworkConfig + (*NetworkInfo)(nil), // 10: neo.fs.v2.netmap.NetworkInfo + (*NodeInfo_Attribute)(nil), // 11: neo.fs.v2.netmap.NodeInfo.Attribute + (*NetworkConfig_Parameter)(nil), // 12: neo.fs.v2.netmap.NetworkConfig.Parameter + (*grpc.SubnetID)(nil), // 13: neo.fs.v2.refs.SubnetID } var file_netmap_grpc_types_proto_depIdxs = []int32{ 0, // 0: neo.fs.v2.netmap.Filter.op:type_name -> neo.fs.v2.netmap.Operation @@ -1082,16 +1147,17 @@ var file_netmap_grpc_types_proto_depIdxs = []int32{ 5, // 3: neo.fs.v2.netmap.PlacementPolicy.replicas:type_name -> neo.fs.v2.netmap.Replica 4, // 4: neo.fs.v2.netmap.PlacementPolicy.selectors:type_name -> neo.fs.v2.netmap.Selector 3, // 5: neo.fs.v2.netmap.PlacementPolicy.filters:type_name -> neo.fs.v2.netmap.Filter - 12, // 6: neo.fs.v2.netmap.PlacementPolicy.subnet_id:type_name -> neo.fs.v2.refs.SubnetID - 10, // 7: neo.fs.v2.netmap.NodeInfo.attributes:type_name -> neo.fs.v2.netmap.NodeInfo.Attribute + 13, // 6: neo.fs.v2.netmap.PlacementPolicy.subnet_id:type_name -> neo.fs.v2.refs.SubnetID + 11, // 7: neo.fs.v2.netmap.NodeInfo.attributes:type_name -> neo.fs.v2.netmap.NodeInfo.Attribute 2, // 8: neo.fs.v2.netmap.NodeInfo.state:type_name -> neo.fs.v2.netmap.NodeInfo.State - 11, // 9: neo.fs.v2.netmap.NetworkConfig.parameters:type_name -> neo.fs.v2.netmap.NetworkConfig.Parameter - 8, // 10: neo.fs.v2.netmap.NetworkInfo.network_config:type_name -> neo.fs.v2.netmap.NetworkConfig - 11, // [11:11] is the sub-list for method output_type - 11, // [11:11] is the sub-list for method input_type - 11, // [11:11] is the sub-list for extension type_name - 11, // [11:11] is the sub-list for extension extendee - 0, // [0:11] is the sub-list for field type_name + 7, // 9: neo.fs.v2.netmap.Netmap.nodes:type_name -> neo.fs.v2.netmap.NodeInfo + 12, // 10: neo.fs.v2.netmap.NetworkConfig.parameters:type_name -> neo.fs.v2.netmap.NetworkConfig.Parameter + 9, // 11: neo.fs.v2.netmap.NetworkInfo.network_config:type_name -> neo.fs.v2.netmap.NetworkConfig + 12, // [12:12] is the sub-list for method output_type + 12, // [12:12] is the sub-list for method input_type + 12, // [12:12] is the sub-list for extension type_name + 12, // [12:12] is the sub-list for extension extendee + 0, // [0:12] is the sub-list for field type_name } func init() { file_netmap_grpc_types_proto_init() } @@ -1161,7 +1227,7 @@ func file_netmap_grpc_types_proto_init() { } } file_netmap_grpc_types_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NetworkConfig); i { + switch v := v.(*Netmap); i { case 0: return &v.state case 1: @@ -1173,7 +1239,7 @@ func file_netmap_grpc_types_proto_init() { } } file_netmap_grpc_types_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NetworkInfo); i { + switch v := v.(*NetworkConfig); i { case 0: return &v.state case 1: @@ -1185,7 +1251,7 @@ func file_netmap_grpc_types_proto_init() { } } file_netmap_grpc_types_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NodeInfo_Attribute); i { + switch v := v.(*NetworkInfo); i { case 0: return &v.state case 1: @@ -1197,6 +1263,18 @@ func file_netmap_grpc_types_proto_init() { } } file_netmap_grpc_types_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*NodeInfo_Attribute); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_netmap_grpc_types_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*NetworkConfig_Parameter); i { case 0: return &v.state @@ -1215,7 +1293,7 @@ func file_netmap_grpc_types_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_netmap_grpc_types_proto_rawDesc, NumEnums: 3, - NumMessages: 9, + NumMessages: 10, NumExtensions: 0, NumServices: 0, }, diff --git a/netmap/marshal.go b/netmap/marshal.go index b7f6e08..fcbf920 100644 --- a/netmap/marshal.go +++ b/netmap/marshal.go @@ -481,3 +481,74 @@ func (i *NetworkInfoResponseBody) StableSize() (size int) { func (i *NetworkInfoResponseBody) Unmarshal(data []byte) error { return message.Unmarshal(i, data, new(netmap.NetworkInfoResponse_Body)) } + +const ( + _ = iota + fNumNetMapEpoch + fNumNetMapNodes +) + +func (x *NetMap) StableMarshal(buf []byte) []byte { + if x == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, x.StableSize()) + } + + offset := protoutil.UInt64Marshal(fNumNetMapEpoch, buf, x.epoch) + + for i := range x.nodes { + offset += protoutil.NestedStructureMarshal(fNumNetMapNodes, buf[offset:], &x.nodes[i]) + } + + return buf +} + +func (x *NetMap) StableSize() (size int) { + if x != nil { + size = protoutil.UInt64Size(fNumNetMapEpoch, x.epoch) + + for i := range x.nodes { + size += protoutil.NestedStructureSize(fNumNetMapNodes, &x.nodes[i]) + } + } + + return +} + +func (x *SnapshotRequestBody) StableMarshal([]byte) []byte { + return nil +} + +func (x *SnapshotRequestBody) StableSize() int { + return 0 +} + +const ( + _ = iota + fNumSnapshotResponseBodyNetMap +) + +func (x *SnapshotResponseBody) StableMarshal(buf []byte) []byte { + if x == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, x.StableSize()) + } + + protoutil.NestedStructureMarshal(fNumSnapshotResponseBodyNetMap, buf, x.netMap) + + return buf +} + +func (x *SnapshotResponseBody) StableSize() (size int) { + if x != nil { + size = protoutil.NestedStructureSize(fNumSnapshotResponseBodyNetMap, x.netMap) + } + + return +} diff --git a/netmap/message_test.go b/netmap/message_test.go index bbe6368..92a6027 100644 --- a/netmap/message_test.go +++ b/netmap/message_test.go @@ -23,5 +23,10 @@ func TestMessageConvert(t *testing.T) { func(empty bool) message.Message { return netmaptest.GenerateNetworkInfo(empty) }, func(empty bool) message.Message { return netmaptest.GenerateNetworkInfoRequest(empty) }, func(empty bool) message.Message { return netmaptest.GenerateNetworkInfoResponseBody(empty) }, + func(empty bool) message.Message { return netmaptest.GenerateNetMap(empty) }, + func(empty bool) message.Message { return netmaptest.GenerateSnapshotRequestBody(empty) }, + func(empty bool) message.Message { return netmaptest.GenerateSnapshotRequest(empty) }, + func(empty bool) message.Message { return netmaptest.GenerateSnapshotResponseBody(empty) }, + func(empty bool) message.Message { return netmaptest.GenerateSnapshotResponse(empty) }, ) } diff --git a/netmap/test/generate.go b/netmap/test/generate.go index 7040550..87cdc50 100644 --- a/netmap/test/generate.go +++ b/netmap/test/generate.go @@ -267,3 +267,57 @@ func GenerateNetworkInfoResponse(empty bool) *netmap.NetworkInfoResponse { return m } + +func GenerateNetMap(empty bool) *netmap.NetMap { + m := new(netmap.NetMap) + + if !empty { + m.SetEpoch(987) + m.SetNodes([]netmap.NodeInfo{ + *GenerateNodeInfo(false), + *GenerateNodeInfo(false), + }) + } + + return m +} + +func GenerateSnapshotRequestBody(_ bool) *netmap.SnapshotRequestBody { + return new(netmap.SnapshotRequestBody) +} + +func GenerateSnapshotRequest(empty bool) *netmap.SnapshotRequest { + m := new(netmap.SnapshotRequest) + + if !empty { + m.SetBody(GenerateSnapshotRequestBody(false)) + } + + m.SetMetaHeader(sessiontest.GenerateRequestMetaHeader(empty)) + m.SetVerificationHeader(sessiontest.GenerateRequestVerificationHeader(empty)) + + return m +} + +func GenerateSnapshotResponseBody(empty bool) *netmap.SnapshotResponseBody { + m := new(netmap.SnapshotResponseBody) + + if !empty { + m.SetNetMap(GenerateNetMap(false)) + } + + return m +} + +func GenerateSnapshotResponse(empty bool) *netmap.SnapshotResponse { + m := new(netmap.SnapshotResponse) + + if !empty { + m.SetBody(GenerateSnapshotResponseBody(false)) + } + + m.SetMetaHeader(sessiontest.GenerateResponseMetaHeader(empty)) + m.SetVerificationHeader(sessiontest.GenerateResponseVerificationHeader(empty)) + + return m +} diff --git a/netmap/types.go b/netmap/types.go index 122dda1..b581d3e 100644 --- a/netmap/types.go +++ b/netmap/types.go @@ -650,3 +650,98 @@ func (l *NetworkInfoResponse) GetBody() *NetworkInfoResponseBody { func (l *NetworkInfoResponse) SetBody(body *NetworkInfoResponseBody) { l.body = body } + +// NetMap represents structure of NeoFS network map. +type NetMap struct { + epoch uint64 + + nodes []NodeInfo +} + +// Epoch returns revision number of the NetMap. +func (x *NetMap) Epoch() uint64 { + if x != nil { + return x.epoch + } + + return 0 +} + +// SetEpoch sets revision number of the NetMap. +func (x *NetMap) SetEpoch(v uint64) { + x.epoch = v +} + +// Nodes returns nodes presented in the NetMap. +func (x *NetMap) Nodes() []NodeInfo { + if x != nil { + return x.nodes + } + + return nil +} + +// SetNodes sets nodes presented in the NetMap. +func (x *NetMap) SetNodes(v []NodeInfo) { + x.nodes = v +} + +// SnapshotRequestBody represents structure of Snapshot request body. +type SnapshotRequestBody struct{} + +// SnapshotRequest represents structure of Snapshot request. +type SnapshotRequest struct { + body *SnapshotRequestBody + + session.RequestHeaders +} + +func (x *SnapshotRequest) GetBody() *SnapshotRequestBody { + if x != nil { + return x.body + } + + return nil +} + +func (x *SnapshotRequest) SetBody(body *SnapshotRequestBody) { + x.body = body +} + +// SnapshotResponseBody represents structure of Snapshot response body. +type SnapshotResponseBody struct { + netMap *NetMap +} + +// NetMap returns current NetMap. +func (x *SnapshotResponseBody) NetMap() *NetMap { + if x != nil { + return x.netMap + } + + return nil +} + +// SetNetMap sets current NetMap. +func (x *SnapshotResponseBody) SetNetMap(netMap *NetMap) { + x.netMap = netMap +} + +// SnapshotResponse represents structure of Snapshot response. +type SnapshotResponse struct { + body *SnapshotResponseBody + + session.ResponseHeaders +} + +func (x *SnapshotResponse) GetBody() *SnapshotResponseBody { + if x != nil { + return x.body + } + + return nil +} + +func (x *SnapshotResponse) SetBody(body *SnapshotResponseBody) { + x.body = body +} diff --git a/object/grpc/service.pb.go b/object/grpc/service.pb.go index 7f15f44..b0aa9bc 100644 --- a/object/grpc/service.pb.go +++ b/object/grpc/service.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.27.1 -// protoc v3.21.5 +// protoc-gen-go v1.28.0 +// protoc v3.21.6 // source: object/grpc/service.proto package object diff --git a/object/grpc/service_grpc.pb.go b/object/grpc/service_grpc.pb.go index 72d9eb4..93e5f22 100644 --- a/object/grpc/service_grpc.pb.go +++ b/object/grpc/service_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.2.0 -// - protoc v3.21.5 +// - protoc v3.21.6 // source: object/grpc/service.proto package object diff --git a/object/grpc/types.pb.go b/object/grpc/types.pb.go index e1243b5..4809930 100644 --- a/object/grpc/types.pb.go +++ b/object/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.27.1 -// protoc v3.21.5 +// protoc-gen-go v1.28.0 +// protoc v3.21.6 // source: object/grpc/types.proto package object @@ -577,6 +577,13 @@ func (x *SplitInfo) GetLink() *grpc.ObjectID { // Human-friendly name // - FileName \ // File name to be associated with the object on saving +// - FilePath \ +// Full path to be associated with the object on saving. Should start with a +// '/' and use '/' as a delimiting symbol. Trailing '/' should be +// interpreted as a virtual directory marker. If an object has conflicting +// FilePath and FileName, FilePath should have higher priority, because it +// is used to construct the directory tree. FilePath with trailing '/' and +// non-empty FileName attribute should not be used together. // - Timestamp \ // User-defined local time of object creation in Unix Timestamp format // - Content-Type \ diff --git a/refs/grpc/types.pb.go b/refs/grpc/types.pb.go index be27e87..2879803 100644 --- a/refs/grpc/types.pb.go +++ b/refs/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.27.1 -// protoc v3.21.5 +// protoc-gen-go v1.28.0 +// protoc v3.21.6 // source: refs/grpc/types.proto package refs diff --git a/reputation/grpc/service.pb.go b/reputation/grpc/service.pb.go index 83317ee..c5c3a2d 100644 --- a/reputation/grpc/service.pb.go +++ b/reputation/grpc/service.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.27.1 -// protoc v3.21.5 +// protoc-gen-go v1.28.0 +// protoc v3.21.6 // source: reputation/grpc/service.proto package reputation diff --git a/reputation/grpc/service_grpc.pb.go b/reputation/grpc/service_grpc.pb.go index 545736b..29de655 100644 --- a/reputation/grpc/service_grpc.pb.go +++ b/reputation/grpc/service_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.2.0 -// - protoc v3.21.5 +// - protoc v3.21.6 // source: reputation/grpc/service.proto package reputation diff --git a/reputation/grpc/types.pb.go b/reputation/grpc/types.pb.go index ff66869..873eab5 100644 --- a/reputation/grpc/types.pb.go +++ b/reputation/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.27.1 -// protoc v3.21.5 +// protoc-gen-go v1.28.0 +// protoc v3.21.6 // source: reputation/grpc/types.proto package reputation diff --git a/rpc/netmap.go b/rpc/netmap.go index b28abef..f67743c 100644 --- a/rpc/netmap.go +++ b/rpc/netmap.go @@ -11,6 +11,7 @@ const serviceNetmap = serviceNamePrefix + "netmap.NetmapService" const ( rpcNetmapNodeInfo = "LocalNodeInfo" rpcNetmapNetInfo = "NetworkInfo" + rpcNetmapSnapshot = "NetmapSnapshot" ) // LocalNodeInfo executes NetmapService.LocalNodeInfo RPC. @@ -44,3 +45,19 @@ func NetworkInfo( return resp, nil } + +// NetMapSnapshot executes NetmapService.NetmapSnapshot RPC. +func NetMapSnapshot( + cli *client.Client, + req *netmap.SnapshotRequest, + opts ...client.CallOption, +) (*netmap.SnapshotResponse, error) { + resp := new(netmap.SnapshotResponse) + + err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceNetmap, rpcNetmapSnapshot), req, resp, opts...) + if err != nil { + return nil, err + } + + return resp, nil +} diff --git a/session/grpc/service.pb.go b/session/grpc/service.pb.go index 15b645e..0c90cb6 100644 --- a/session/grpc/service.pb.go +++ b/session/grpc/service.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.27.1 -// protoc v3.21.5 +// protoc-gen-go v1.28.0 +// protoc v3.21.6 // source: session/grpc/service.proto package session diff --git a/session/grpc/service_grpc.pb.go b/session/grpc/service_grpc.pb.go index a596be4..ebda887 100644 --- a/session/grpc/service_grpc.pb.go +++ b/session/grpc/service_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.2.0 -// - protoc v3.21.5 +// - protoc v3.21.6 // source: session/grpc/service.proto package session diff --git a/session/grpc/types.pb.go b/session/grpc/types.pb.go index 1fa22f0..81b3f04 100644 --- a/session/grpc/types.pb.go +++ b/session/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.27.1 -// protoc v3.21.5 +// protoc-gen-go v1.28.0 +// protoc v3.21.6 // source: session/grpc/types.proto package session diff --git a/signature/sign.go b/signature/sign.go index 44ec2c4..ea2e1aa 100644 --- a/signature/sign.go +++ b/signature/sign.go @@ -375,6 +375,10 @@ func serviceMessageBody(req interface{}) stableMarshaler { return v.GetBody() case *netmap.NetworkInfoResponse: return v.GetBody() + case *netmap.SnapshotRequest: + return v.GetBody() + case *netmap.SnapshotResponse: + return v.GetBody() /* Reputation */ case *reputation.AnnounceLocalTrustRequest: diff --git a/status/grpc/types.pb.go b/status/grpc/types.pb.go index 64b257e..b864629 100644 --- a/status/grpc/types.pb.go +++ b/status/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.27.1 -// protoc v3.21.5 +// protoc-gen-go v1.28.0 +// protoc v3.21.6 // source: status/grpc/types.proto package status @@ -263,15 +263,19 @@ type Container int32 const ( // [**3072**] Container not found. Container_CONTAINER_NOT_FOUND Container = 0 + // [**3073**] eACL table not found. + Container_EACL_NOT_FOUND Container = 1 ) // Enum value maps for Container. var ( Container_name = map[int32]string{ 0: "CONTAINER_NOT_FOUND", + 1: "EACL_NOT_FOUND", } Container_value = map[string]int32{ "CONTAINER_NOT_FOUND": 0, + "EACL_NOT_FOUND": 1, } ) @@ -547,19 +551,20 @@ var file_status_grpc_types_proto_rawDesc = []byte{ 0x4c, 0x41, 0x52, 0x5f, 0x4f, 0x42, 0x4a, 0x45, 0x43, 0x54, 0x10, 0x03, 0x12, 0x1a, 0x0a, 0x16, 0x4f, 0x42, 0x4a, 0x45, 0x43, 0x54, 0x5f, 0x41, 0x4c, 0x52, 0x45, 0x41, 0x44, 0x59, 0x5f, 0x52, 0x45, 0x4d, 0x4f, 0x56, 0x45, 0x44, 0x10, 0x04, 0x12, 0x10, 0x0a, 0x0c, 0x4f, 0x55, 0x54, 0x5f, - 0x4f, 0x46, 0x5f, 0x52, 0x41, 0x4e, 0x47, 0x45, 0x10, 0x05, 0x2a, 0x24, 0x0a, 0x09, 0x43, 0x6f, + 0x4f, 0x46, 0x5f, 0x52, 0x41, 0x4e, 0x47, 0x45, 0x10, 0x05, 0x2a, 0x38, 0x0a, 0x09, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x12, 0x17, 0x0a, 0x13, 0x43, 0x4f, 0x4e, 0x54, 0x41, 0x49, 0x4e, 0x45, 0x52, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x46, 0x4f, 0x55, 0x4e, 0x44, 0x10, 0x00, - 0x2a, 0x31, 0x0a, 0x07, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x13, 0x0a, 0x0f, 0x54, - 0x4f, 0x4b, 0x45, 0x4e, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x46, 0x4f, 0x55, 0x4e, 0x44, 0x10, 0x00, - 0x12, 0x11, 0x0a, 0x0d, 0x54, 0x4f, 0x4b, 0x45, 0x4e, 0x5f, 0x45, 0x58, 0x50, 0x49, 0x52, 0x45, - 0x44, 0x10, 0x01, 0x42, 0x56, 0x5a, 0x37, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, - 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, - 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x73, 0x74, 0x61, 0x74, - 0x75, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0xaa, 0x02, - 0x1a, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, - 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, + 0x12, 0x12, 0x0a, 0x0e, 0x45, 0x41, 0x43, 0x4c, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x46, 0x4f, 0x55, + 0x4e, 0x44, 0x10, 0x01, 0x2a, 0x31, 0x0a, 0x07, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, + 0x13, 0x0a, 0x0f, 0x54, 0x4f, 0x4b, 0x45, 0x4e, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x46, 0x4f, 0x55, + 0x4e, 0x44, 0x10, 0x00, 0x12, 0x11, 0x0a, 0x0d, 0x54, 0x4f, 0x4b, 0x45, 0x4e, 0x5f, 0x45, 0x58, + 0x50, 0x49, 0x52, 0x45, 0x44, 0x10, 0x01, 0x42, 0x56, 0x5a, 0x37, 0x67, 0x69, 0x74, 0x68, 0x75, + 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, + 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, + 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x73, 0x74, 0x61, 0x74, + 0x75, 0x73, 0xaa, 0x02, 0x1a, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, + 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/storagegroup/grpc/types.pb.go b/storagegroup/grpc/types.pb.go index 1cfe99c..8f5100c 100644 --- a/storagegroup/grpc/types.pb.go +++ b/storagegroup/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.27.1 -// protoc v3.21.5 +// protoc-gen-go v1.28.0 +// protoc v3.21.6 // source: storagegroup/grpc/types.proto package storagegroup diff --git a/subnet/grpc/types.pb.go b/subnet/grpc/types.pb.go index 2bec81d..015e66d 100644 --- a/subnet/grpc/types.pb.go +++ b/subnet/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.27.1 -// protoc v3.21.5 +// protoc-gen-go v1.28.0 +// protoc v3.21.6 // source: subnet/grpc/types.proto package subnet diff --git a/tombstone/grpc/types.pb.go b/tombstone/grpc/types.pb.go index d971da2..84b0c3e 100644 --- a/tombstone/grpc/types.pb.go +++ b/tombstone/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.27.1 -// protoc v3.21.5 +// protoc-gen-go v1.28.0 +// protoc v3.21.6 // source: tombstone/grpc/types.proto package tombstone diff --git a/util/proto/test/test.pb.go b/util/proto/test/test.pb.go index 6ac0c67..f884c08 100644 --- a/util/proto/test/test.pb.go +++ b/util/proto/test/test.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.27.1 -// protoc v3.21.5 +// protoc-gen-go v1.28.0 +// protoc v3.21.6 // source: util/proto/test/test.proto package test From 49bf6b24b034e285ef16c5192f7ff0d291b00ddc Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Sat, 17 Sep 2022 10:39:11 +0400 Subject: [PATCH 1017/1196] [#417] storagegroup: Mark all expiration methods as deprecated `expiration_epoch` field of `StorageGroup` message has been marked as deprecated in previous NeoFS API protocol's release. Mark all method related to the field as deprecated. Leave and use them for test purposes only. Signed-off-by: Leonard Lyubich --- storagegroup/convert.go | 3 ++- storagegroup/grpc/types.go | 2 ++ storagegroup/test/generate.go | 1 + storagegroup/types.go | 4 ++++ 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/storagegroup/convert.go b/storagegroup/convert.go index b36101f..3dac399 100644 --- a/storagegroup/convert.go +++ b/storagegroup/convert.go @@ -15,6 +15,7 @@ func (s *StorageGroup) ToGRPCMessage() grpc.Message { m = new(sg.StorageGroup) m.SetMembers(refs.ObjectIDListToGRPCMessage(s.members)) + //nolint:staticcheck m.SetExpirationEpoch(s.exp) m.SetValidationDataSize(s.size) m.SetValidationHash(s.hash.ToGRPCMessage().(*refsGRPC.Checksum)) @@ -50,7 +51,7 @@ func (s *StorageGroup) FromGRPCMessage(m grpc.Message) error { return err } - //nolint: staticcheck + //nolint:staticcheck s.exp = v.GetExpirationEpoch() s.size = v.GetValidationDataSize() diff --git a/storagegroup/grpc/types.go b/storagegroup/grpc/types.go index 1c7a8a8..86280d3 100644 --- a/storagegroup/grpc/types.go +++ b/storagegroup/grpc/types.go @@ -15,6 +15,8 @@ func (m *StorageGroup) SetValidationHash(v *refs.Checksum) { } // SetExpirationEpoch sets number of the last epoch of the storage group lifetime. +// +// Deprecated: do not use, `expiration_epoch` field is deprecated in protocol. func (m *StorageGroup) SetExpirationEpoch(v uint64) { m.ExpirationEpoch = v } diff --git a/storagegroup/test/generate.go b/storagegroup/test/generate.go index 048ec24..80ba7b9 100644 --- a/storagegroup/test/generate.go +++ b/storagegroup/test/generate.go @@ -10,6 +10,7 @@ func GenerateStorageGroup(empty bool) *storagegroup.StorageGroup { if !empty { m.SetValidationDataSize(44) + //nolint:staticcheck m.SetExpirationEpoch(55) m.SetMembers(refstest.GenerateObjectIDs(false)) } diff --git a/storagegroup/types.go b/storagegroup/types.go index a1926c7..a03faf3 100644 --- a/storagegroup/types.go +++ b/storagegroup/types.go @@ -45,6 +45,8 @@ func (s *StorageGroup) SetValidationHash(v *refs.Checksum) { } // GetExpirationEpoch of unified storage group structure. +// +// Deprecated: Do not use. func (s *StorageGroup) GetExpirationEpoch() uint64 { if s != nil { return s.exp @@ -54,6 +56,8 @@ func (s *StorageGroup) GetExpirationEpoch() uint64 { } // SetExpirationEpoch into unified storage group structure. +// +// Deprecated: Do not use. func (s *StorageGroup) SetExpirationEpoch(v uint64) { s.exp = v } From 504e427c181fa55e614f4c42d1e2b933dfabddf2 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Sat, 17 Sep 2022 10:41:31 +0400 Subject: [PATCH 1018/1196] [#417] rpc/client: Do not use deprecated code elements `grpc.WithInsecure` has been marked as deprecated in earlier releases of `google.golang.org/grpc`. Use `google.golang.org/grpc/credentials/insecure` package instead as recommended. Signed-off-by: Leonard Lyubich --- rpc/client/connect.go | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/rpc/client/connect.go b/rpc/client/connect.go index 8b7db4f..18134c4 100644 --- a/rpc/client/connect.go +++ b/rpc/client/connect.go @@ -10,6 +10,7 @@ import ( "github.com/nspcc-dev/neofs-api-go/v2/rpc/grpc" grpcstd "google.golang.org/grpc" "google.golang.org/grpc/credentials" + "google.golang.org/grpc/credentials/insecure" ) func (c *Client) createGRPCClient() (err error) { @@ -38,19 +39,17 @@ func (c *Client) openGRPCConn() error { return errInvalidEndpoint } - var err error - - var credOpt grpcstd.DialOption + var creds credentials.TransportCredentials if c.tlsCfg != nil { - creds := credentials.NewTLS(c.tlsCfg) - credOpt = grpcstd.WithTransportCredentials(creds) + creds = credentials.NewTLS(c.tlsCfg) } else { - credOpt = grpcstd.WithInsecure() + creds = insecure.NewCredentials() } dialCtx, cancel := context.WithTimeout(context.Background(), c.dialTimeout) - c.conn, err = grpcstd.DialContext(dialCtx, c.addr, credOpt) + var err error + c.conn, err = grpcstd.DialContext(dialCtx, c.addr, grpcstd.WithTransportCredentials(creds)) cancel() return err From 5fc2644c680d04f8f56df3f33562764f7155e922 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 16 Sep 2022 19:09:25 +0400 Subject: [PATCH 1019/1196] [#416] session: Support new format of object session context Signed-off-by: Leonard Lyubich --- netmap/grpc/types.pb.go | 4 + object/grpc/service_grpc.pb.go | 96 +++---- session/convert.go | 19 +- session/grpc/types.go | 9 +- session/grpc/types.pb.go | 439 ++++++++++++++++++++------------- session/marshal.go | 18 +- session/test/generate.go | 2 +- session/types.go | 58 ++++- 8 files changed, 398 insertions(+), 247 deletions(-) diff --git a/netmap/grpc/types.pb.go b/netmap/grpc/types.pb.go index 265bc24..c34f6bb 100644 --- a/netmap/grpc/types.pb.go +++ b/netmap/grpc/types.pb.go @@ -865,6 +865,10 @@ func (x *NetworkInfo) GetNetworkConfig() *NetworkConfig { // Node's continent name according to the [Seven-Continent model] // (https://en.wikipedia.org/wiki/Continent#Number). Calculated // automatically from `UN-LOCODE` attribute. +// - ExternalAddr +// Node's preferred way for communications with external clients. +// Clients SHOULD use these addresses if possible. +// Must contain a comma-separated list of multi-addresses. // // For detailed description of each well-known attribute please see the // corresponding section in NeoFS Technical Specification. diff --git a/object/grpc/service_grpc.pb.go b/object/grpc/service_grpc.pb.go index 93e5f22..6371473 100644 --- a/object/grpc/service_grpc.pb.go +++ b/object/grpc/service_grpc.pb.go @@ -44,16 +44,16 @@ type ObjectServiceClient interface { // - **OK** (0, SECTION_SUCCESS): \ // object has been successfully read; // - Common failures (SECTION_FAILURE_COMMON); - // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ - // object container not found; // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ // read access to the object is denied; // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ // object not found in container; - // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ - // provided session token has expired; // - **OBJECT_ALREADY_REMOVED** (2052, SECTION_OBJECT): \ - // the requested object has been marked as deleted. + // the requested object has been marked as deleted; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // object container not found; + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (ObjectService_GetClient, error) // Put the object into container. Request uses gRPC stream. First message // SHOULD be of PutHeader type. `ContainerID` and `OwnerID` of an object @@ -73,6 +73,8 @@ type ObjectServiceClient interface { // - **OK** (0, SECTION_SUCCESS): \ // object has been successfully saved in the container; // - Common failures (SECTION_FAILURE_COMMON); + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // write access to the container is denied; // - **LOCKED** (2050, SECTION_OBJECT): \ // placement of an object of type TOMBSTONE that includes at least one locked // object is prohibited; @@ -81,8 +83,6 @@ type ObjectServiceClient interface { // type other than REGULAR is prohibited; // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ // object storage container not found; - // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ - // write access to the container is denied; // - **TOKEN_NOT_FOUND** (4096, SECTION_SESSION): \ // (for trusted object preparation) session private key does not exist or has // been deleted; @@ -103,12 +103,12 @@ type ObjectServiceClient interface { // - **OK** (0, SECTION_SUCCESS): \ // object has been successfully marked to be removed from the container; // - Common failures (SECTION_FAILURE_COMMON); + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // delete access to the object is denied; // - **LOCKED** (2050, SECTION_OBJECT): \ // deleting a locked object is prohibited; // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ // object container not found; - // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ - // delete access to the object is denied; // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ // provided session token has expired. Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteResponse, error) @@ -127,16 +127,16 @@ type ObjectServiceClient interface { // - **OK** (0, SECTION_SUCCESS): \ // object header has been successfully read; // - Common failures (SECTION_FAILURE_COMMON); - // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ - // object container not found; // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ // access to operation HEAD of the object is denied; // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ // object not found in container; - // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ - // provided session token has expired; // - **OBJECT_ALREADY_REMOVED** (2052, SECTION_OBJECT): \ - // the requested object has been marked as deleted. + // the requested object has been marked as deleted; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // object container not found; + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. Head(ctx context.Context, in *HeadRequest, opts ...grpc.CallOption) (*HeadResponse, error) // Search objects in container. Search query allows to match by Object // Header's filed values. Please see the corresponding NeoFS Technical @@ -153,10 +153,10 @@ type ObjectServiceClient interface { // - **OK** (0, SECTION_SUCCESS): \ // objects have been successfully selected; // - Common failures (SECTION_FAILURE_COMMON); - // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ - // search container not found; // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ // access to operation SEARCH of the object is denied; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // search container not found; // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ // provided session token has expired. Search(ctx context.Context, in *SearchRequest, opts ...grpc.CallOption) (ObjectService_SearchClient, error) @@ -179,18 +179,18 @@ type ObjectServiceClient interface { // - **OK** (0, SECTION_SUCCESS): \ // data range of the object payload has been successfully read; // - Common failures (SECTION_FAILURE_COMMON); - // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ - // object container not found; // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ // access to operation RANGE of the object is denied; // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ // object not found in container; - // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ - // provided session token has expired; // - **OBJECT_ALREADY_REMOVED** (2052, SECTION_OBJECT): \ // the requested object has been marked as deleted. // - **OUT_OF_RANGE** (2053, SECTION_OBJECT): \ - // the requested range is out of bounds. + // the requested range is out of bounds; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // object container not found; + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. GetRange(ctx context.Context, in *GetRangeRequest, opts ...grpc.CallOption) (ObjectService_GetRangeClient, error) // Returns homomorphic or regular hash of object's payload range after // applying XOR operation with the provided `salt`. Ranges are set of (offset, @@ -211,14 +211,14 @@ type ObjectServiceClient interface { // - **OK** (0, SECTION_SUCCESS): \ // data range of the object payload has been successfully hashed; // - Common failures (SECTION_FAILURE_COMMON); - // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ - // object container not found; // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ // access to operation RANGEHASH of the object is denied; // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ // object not found in container; // - **OUT_OF_RANGE** (2053, SECTION_OBJECT): \ - // the requested range is out of bounds. + // the requested range is out of bounds; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // object container not found; // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ // provided session token has expired. GetRangeHash(ctx context.Context, in *GetRangeHashRequest, opts ...grpc.CallOption) (*GetRangeHashResponse, error) @@ -415,16 +415,16 @@ type ObjectServiceServer interface { // - **OK** (0, SECTION_SUCCESS): \ // object has been successfully read; // - Common failures (SECTION_FAILURE_COMMON); - // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ - // object container not found; // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ // read access to the object is denied; // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ // object not found in container; - // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ - // provided session token has expired; // - **OBJECT_ALREADY_REMOVED** (2052, SECTION_OBJECT): \ - // the requested object has been marked as deleted. + // the requested object has been marked as deleted; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // object container not found; + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. Get(*GetRequest, ObjectService_GetServer) error // Put the object into container. Request uses gRPC stream. First message // SHOULD be of PutHeader type. `ContainerID` and `OwnerID` of an object @@ -444,6 +444,8 @@ type ObjectServiceServer interface { // - **OK** (0, SECTION_SUCCESS): \ // object has been successfully saved in the container; // - Common failures (SECTION_FAILURE_COMMON); + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // write access to the container is denied; // - **LOCKED** (2050, SECTION_OBJECT): \ // placement of an object of type TOMBSTONE that includes at least one locked // object is prohibited; @@ -452,8 +454,6 @@ type ObjectServiceServer interface { // type other than REGULAR is prohibited; // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ // object storage container not found; - // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ - // write access to the container is denied; // - **TOKEN_NOT_FOUND** (4096, SECTION_SESSION): \ // (for trusted object preparation) session private key does not exist or has // been deleted; @@ -474,12 +474,12 @@ type ObjectServiceServer interface { // - **OK** (0, SECTION_SUCCESS): \ // object has been successfully marked to be removed from the container; // - Common failures (SECTION_FAILURE_COMMON); + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // delete access to the object is denied; // - **LOCKED** (2050, SECTION_OBJECT): \ // deleting a locked object is prohibited; // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ // object container not found; - // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ - // delete access to the object is denied; // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ // provided session token has expired. Delete(context.Context, *DeleteRequest) (*DeleteResponse, error) @@ -498,16 +498,16 @@ type ObjectServiceServer interface { // - **OK** (0, SECTION_SUCCESS): \ // object header has been successfully read; // - Common failures (SECTION_FAILURE_COMMON); - // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ - // object container not found; // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ // access to operation HEAD of the object is denied; // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ // object not found in container; - // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ - // provided session token has expired; // - **OBJECT_ALREADY_REMOVED** (2052, SECTION_OBJECT): \ - // the requested object has been marked as deleted. + // the requested object has been marked as deleted; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // object container not found; + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. Head(context.Context, *HeadRequest) (*HeadResponse, error) // Search objects in container. Search query allows to match by Object // Header's filed values. Please see the corresponding NeoFS Technical @@ -524,10 +524,10 @@ type ObjectServiceServer interface { // - **OK** (0, SECTION_SUCCESS): \ // objects have been successfully selected; // - Common failures (SECTION_FAILURE_COMMON); - // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ - // search container not found; // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ // access to operation SEARCH of the object is denied; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // search container not found; // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ // provided session token has expired. Search(*SearchRequest, ObjectService_SearchServer) error @@ -550,18 +550,18 @@ type ObjectServiceServer interface { // - **OK** (0, SECTION_SUCCESS): \ // data range of the object payload has been successfully read; // - Common failures (SECTION_FAILURE_COMMON); - // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ - // object container not found; // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ // access to operation RANGE of the object is denied; // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ // object not found in container; - // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ - // provided session token has expired; // - **OBJECT_ALREADY_REMOVED** (2052, SECTION_OBJECT): \ // the requested object has been marked as deleted. // - **OUT_OF_RANGE** (2053, SECTION_OBJECT): \ - // the requested range is out of bounds. + // the requested range is out of bounds; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // object container not found; + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. GetRange(*GetRangeRequest, ObjectService_GetRangeServer) error // Returns homomorphic or regular hash of object's payload range after // applying XOR operation with the provided `salt`. Ranges are set of (offset, @@ -582,14 +582,14 @@ type ObjectServiceServer interface { // - **OK** (0, SECTION_SUCCESS): \ // data range of the object payload has been successfully hashed; // - Common failures (SECTION_FAILURE_COMMON); - // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ - // object container not found; // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ // access to operation RANGEHASH of the object is denied; // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ // object not found in container; // - **OUT_OF_RANGE** (2053, SECTION_OBJECT): \ - // the requested range is out of bounds. + // the requested range is out of bounds; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // object container not found; // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ // provided session token has expired. GetRangeHash(context.Context, *GetRangeHashRequest) (*GetRangeHashResponse, error) diff --git a/session/convert.go b/session/convert.go index d7662b4..b9a93e6 100644 --- a/session/convert.go +++ b/session/convert.go @@ -674,7 +674,7 @@ func (c *ObjectSessionContext) ToGRPCMessage() grpc.Message { m = new(session.ObjectSessionContext) m.SetVerb(ObjectSessionVerbToGRPCField(c.verb)) - m.SetAddress(c.addr.ToGRPCMessage().(*refsGRPC.Address)) + m.SetTarget(c.cnr.ToGRPCMessage().(*refsGRPC.ContainerID), refs.ObjectIDListToGRPCMessage(c.objs)) } return m @@ -688,20 +688,25 @@ func (c *ObjectSessionContext) FromGRPCMessage(m grpc.Message) error { var err error - addr := v.GetAddress() - if addr == nil { - c.addr = nil + cnr := v.GetTarget().GetContainer() + if cnr == nil { + c.cnr = nil } else { - if c.addr == nil { - c.addr = new(refs.Address) + if c.cnr == nil { + c.cnr = new(refs.ContainerID) } - err = c.addr.FromGRPCMessage(addr) + err = c.cnr.FromGRPCMessage(cnr) if err != nil { return err } } + c.objs, err = refs.ObjectIDListFromGRPCMessage(v.GetTarget().GetObjects()) + if err != nil { + return err + } + c.verb = ObjectSessionVerbFromGRPCField(v.GetVerb()) return nil diff --git a/session/grpc/types.go b/session/grpc/types.go index 64133a8..7cdb7d5 100644 --- a/session/grpc/types.go +++ b/session/grpc/types.go @@ -65,9 +65,12 @@ func (m *SessionToken_Body) SetContainerSessionContext(v *ContainerSessionContex } } -// SetAddress sets address of the object related to the session. -func (m *ObjectSessionContext) SetAddress(v *refs.Address) { - m.Address = v +// SetTarget specifies objects involved in the object session. +func (m *ObjectSessionContext) SetTarget(cnr *refs.ContainerID, objs []*refs.ObjectID) { + m.Target = &ObjectSessionContext_Target{ + Container: cnr, + Objects: objs, + } } // SetVerb sets type of request for which the token is issued. diff --git a/session/grpc/types.pb.go b/session/grpc/types.pb.go index 81b3f04..c964738 100644 --- a/session/grpc/types.pb.go +++ b/session/grpc/types.pb.go @@ -161,8 +161,10 @@ type ObjectSessionContext struct { // Type of request for which the token is issued Verb ObjectSessionContext_Verb `protobuf:"varint,1,opt,name=verb,proto3,enum=neo.fs.v2.session.ObjectSessionContext_Verb" json:"verb,omitempty"` - // Related Object address - Address *grpc.Address `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"` + // Object session target. MUST be correctly formed and set. If `objects` + // field is not empty, then the session applies only to these elements, + // otherwise, to all objects from the specified container. + Target *ObjectSessionContext_Target `protobuf:"bytes,2,opt,name=target,proto3" json:"target,omitempty"` } func (x *ObjectSessionContext) Reset() { @@ -204,9 +206,9 @@ func (x *ObjectSessionContext) GetVerb() ObjectSessionContext_Verb { return ObjectSessionContext_VERB_UNSPECIFIED } -func (x *ObjectSessionContext) GetAddress() *grpc.Address { +func (x *ObjectSessionContext) GetTarget() *ObjectSessionContext_Target { if x != nil { - return x.Address + return x.Target } return nil } @@ -776,6 +778,67 @@ func (x *ResponseVerificationHeader) GetOrigin() *ResponseVerificationHeader { return nil } +// Carries objects involved in the object session. +type ObjectSessionContext_Target struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Indicates which container the session is spread to. Field MUST be set + // and correct. + Container *grpc.ContainerID `protobuf:"bytes,1,opt,name=container,proto3" json:"container,omitempty"` + // Indicates which objects the session is spread to. Objects are expected + // to be stored in the NeoFS container referenced by `container` field. + // Each element MUST have correct format. + Objects []*grpc.ObjectID `protobuf:"bytes,2,rep,name=objects,proto3" json:"objects,omitempty"` +} + +func (x *ObjectSessionContext_Target) Reset() { + *x = ObjectSessionContext_Target{} + if protoimpl.UnsafeEnabled { + mi := &file_session_grpc_types_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ObjectSessionContext_Target) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ObjectSessionContext_Target) ProtoMessage() {} + +func (x *ObjectSessionContext_Target) ProtoReflect() protoreflect.Message { + mi := &file_session_grpc_types_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ObjectSessionContext_Target.ProtoReflect.Descriptor instead. +func (*ObjectSessionContext_Target) Descriptor() ([]byte, []int) { + return file_session_grpc_types_proto_rawDescGZIP(), []int{0, 0} +} + +func (x *ObjectSessionContext_Target) GetContainer() *grpc.ContainerID { + if x != nil { + return x.Container + } + return nil +} + +func (x *ObjectSessionContext_Target) GetObjects() []*grpc.ObjectID { + if x != nil { + return x.Objects + } + return nil +} + // Session Token body type SessionToken_Body struct { state protoimpl.MessageState @@ -802,7 +865,7 @@ type SessionToken_Body struct { func (x *SessionToken_Body) Reset() { *x = SessionToken_Body{} if protoimpl.UnsafeEnabled { - mi := &file_session_grpc_types_proto_msgTypes[8] + mi := &file_session_grpc_types_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -815,7 +878,7 @@ func (x *SessionToken_Body) String() string { func (*SessionToken_Body) ProtoMessage() {} func (x *SessionToken_Body) ProtoReflect() protoreflect.Message { - mi := &file_session_grpc_types_proto_msgTypes[8] + mi := &file_session_grpc_types_proto_msgTypes[9] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -915,7 +978,7 @@ type SessionToken_Body_TokenLifetime struct { func (x *SessionToken_Body_TokenLifetime) Reset() { *x = SessionToken_Body_TokenLifetime{} if protoimpl.UnsafeEnabled { - mi := &file_session_grpc_types_proto_msgTypes[9] + mi := &file_session_grpc_types_proto_msgTypes[10] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -928,7 +991,7 @@ func (x *SessionToken_Body_TokenLifetime) String() string { func (*SessionToken_Body_TokenLifetime) ProtoMessage() {} func (x *SessionToken_Body_TokenLifetime) ProtoReflect() protoreflect.Message { - mi := &file_session_grpc_types_proto_msgTypes[9] + mi := &file_session_grpc_types_proto_msgTypes[10] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -975,162 +1038,171 @@ var file_session_grpc_types_proto_rawDesc = []byte{ 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x14, 0x61, 0x63, 0x6c, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x22, 0xf7, 0x01, 0x0a, 0x14, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x53, 0x65, + 0x6f, 0x74, 0x6f, 0x22, 0x85, 0x03, 0x0a, 0x14, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x12, 0x40, 0x0a, 0x04, 0x76, 0x65, 0x72, 0x62, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x74, - 0x65, 0x78, 0x74, 0x2e, 0x56, 0x65, 0x72, 0x62, 0x52, 0x04, 0x76, 0x65, 0x72, 0x62, 0x12, 0x31, - 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x17, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, - 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, - 0x73, 0x22, 0x6a, 0x0a, 0x04, 0x56, 0x65, 0x72, 0x62, 0x12, 0x14, 0x0a, 0x10, 0x56, 0x45, 0x52, - 0x42, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, - 0x07, 0x0a, 0x03, 0x50, 0x55, 0x54, 0x10, 0x01, 0x12, 0x07, 0x0a, 0x03, 0x47, 0x45, 0x54, 0x10, - 0x02, 0x12, 0x08, 0x0a, 0x04, 0x48, 0x45, 0x41, 0x44, 0x10, 0x03, 0x12, 0x0a, 0x0a, 0x06, 0x53, - 0x45, 0x41, 0x52, 0x43, 0x48, 0x10, 0x04, 0x12, 0x0a, 0x0a, 0x06, 0x44, 0x45, 0x4c, 0x45, 0x54, - 0x45, 0x10, 0x05, 0x12, 0x09, 0x0a, 0x05, 0x52, 0x41, 0x4e, 0x47, 0x45, 0x10, 0x06, 0x12, 0x0d, - 0x0a, 0x09, 0x52, 0x41, 0x4e, 0x47, 0x45, 0x48, 0x41, 0x53, 0x48, 0x10, 0x07, 0x22, 0xfa, 0x01, - 0x0a, 0x17, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x53, 0x65, 0x73, 0x73, 0x69, - 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x12, 0x43, 0x0a, 0x04, 0x76, 0x65, 0x72, - 0x62, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, - 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x43, 0x6f, 0x6e, 0x74, - 0x61, 0x69, 0x6e, 0x65, 0x72, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x74, - 0x65, 0x78, 0x74, 0x2e, 0x56, 0x65, 0x72, 0x62, 0x52, 0x04, 0x76, 0x65, 0x72, 0x62, 0x12, 0x1a, - 0x0a, 0x08, 0x77, 0x69, 0x6c, 0x64, 0x63, 0x61, 0x72, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, - 0x52, 0x08, 0x77, 0x69, 0x6c, 0x64, 0x63, 0x61, 0x72, 0x64, 0x12, 0x3e, 0x0a, 0x0c, 0x63, 0x6f, - 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, - 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x52, 0x0b, 0x63, - 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x22, 0x3e, 0x0a, 0x04, 0x56, 0x65, - 0x72, 0x62, 0x12, 0x14, 0x0a, 0x10, 0x56, 0x45, 0x52, 0x42, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, - 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x50, 0x55, 0x54, 0x10, - 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x44, 0x45, 0x4c, 0x45, 0x54, 0x45, 0x10, 0x02, 0x12, 0x0b, 0x0a, - 0x07, 0x53, 0x45, 0x54, 0x45, 0x41, 0x43, 0x4c, 0x10, 0x03, 0x22, 0xa0, 0x04, 0x0a, 0x0c, 0x53, - 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x38, 0x0a, 0x04, 0x62, - 0x6f, 0x64, 0x79, 0x18, 0x01, 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, 0x53, 0x65, - 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, - 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x37, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, - 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, - 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, - 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x1a, 0x9c, - 0x03, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0c, 0x52, 0x02, 0x69, 0x64, 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, 0x4e, 0x0a, 0x08, 0x6c, - 0x69, 0x66, 0x65, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x32, 0x2e, - 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, - 0x6e, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x42, - 0x6f, 0x64, 0x79, 0x2e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x4c, 0x69, 0x66, 0x65, 0x74, 0x69, 0x6d, - 0x65, 0x52, 0x08, 0x6c, 0x69, 0x66, 0x65, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x73, - 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, - 0x52, 0x0a, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x4b, 0x65, 0x79, 0x12, 0x41, 0x0a, 0x06, - 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x6e, - 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, - 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, - 0x6e, 0x74, 0x65, 0x78, 0x74, 0x48, 0x00, 0x52, 0x06, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, - 0x4a, 0x0a, 0x09, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x18, 0x06, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, - 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, - 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x48, 0x00, - 0x52, 0x09, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x1a, 0x45, 0x0a, 0x0d, 0x54, - 0x6f, 0x6b, 0x65, 0x6e, 0x4c, 0x69, 0x66, 0x65, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, - 0x65, 0x78, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x65, 0x78, 0x70, 0x12, 0x10, - 0x0a, 0x03, 0x6e, 0x62, 0x66, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x6e, 0x62, 0x66, - 0x12, 0x10, 0x0a, 0x03, 0x69, 0x61, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x69, - 0x61, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x22, 0x31, 0x0a, - 0x07, 0x58, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 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, - 0x22, 0x8d, 0x03, 0x0a, 0x11, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x74, 0x61, - 0x48, 0x65, 0x61, 0x64, 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, 0x14, 0x0a, 0x05, 0x65, 0x70, 0x6f, - 0x63, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x12, - 0x10, 0x0a, 0x03, 0x74, 0x74, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x03, 0x74, 0x74, - 0x6c, 0x12, 0x37, 0x0a, 0x09, 0x78, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x18, 0x04, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, - 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x58, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, - 0x52, 0x08, 0x78, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x12, 0x44, 0x0a, 0x0d, 0x73, 0x65, - 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, - 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x6f, 0x6b, - 0x65, 0x6e, 0x52, 0x0c, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, - 0x12, 0x3d, 0x0a, 0x0c, 0x62, 0x65, 0x61, 0x72, 0x65, 0x72, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, - 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, - 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x42, 0x65, 0x61, 0x72, 0x65, 0x72, 0x54, 0x6f, 0x6b, - 0x65, 0x6e, 0x52, 0x0b, 0x62, 0x65, 0x61, 0x72, 0x65, 0x72, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, - 0x3c, 0x0a, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x18, 0x07, 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, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x12, 0x21, 0x0a, - 0x0c, 0x6d, 0x61, 0x67, 0x69, 0x63, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x08, 0x20, - 0x01, 0x28, 0x04, 0x52, 0x0b, 0x6d, 0x61, 0x67, 0x69, 0x63, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, - 0x22, 0x99, 0x02, 0x0a, 0x12, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4d, 0x65, 0x74, - 0x61, 0x48, 0x65, 0x61, 0x64, 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, 0x14, 0x0a, 0x05, 0x65, 0x70, - 0x6f, 0x63, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, - 0x12, 0x10, 0x0a, 0x03, 0x74, 0x74, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x03, 0x74, - 0x74, 0x6c, 0x12, 0x37, 0x0a, 0x09, 0x78, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x18, - 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, - 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x58, 0x48, 0x65, 0x61, 0x64, 0x65, - 0x72, 0x52, 0x08, 0x78, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x12, 0x3d, 0x0a, 0x06, 0x6f, - 0x72, 0x69, 0x67, 0x69, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6e, 0x65, + 0x65, 0x78, 0x74, 0x2e, 0x56, 0x65, 0x72, 0x62, 0x52, 0x04, 0x76, 0x65, 0x72, 0x62, 0x12, 0x46, + 0x0a, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2e, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, + 0x6f, 0x6e, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, + 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x2e, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x52, 0x06, + 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x1a, 0x77, 0x0a, 0x06, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, + 0x12, 0x39, 0x0a, 0x09, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, + 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, + 0x52, 0x09, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x12, 0x32, 0x0a, 0x07, 0x6f, + 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x18, 0x02, 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, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x22, + 0x6a, 0x0a, 0x04, 0x56, 0x65, 0x72, 0x62, 0x12, 0x14, 0x0a, 0x10, 0x56, 0x45, 0x52, 0x42, 0x5f, + 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x07, 0x0a, + 0x03, 0x50, 0x55, 0x54, 0x10, 0x01, 0x12, 0x07, 0x0a, 0x03, 0x47, 0x45, 0x54, 0x10, 0x02, 0x12, + 0x08, 0x0a, 0x04, 0x48, 0x45, 0x41, 0x44, 0x10, 0x03, 0x12, 0x0a, 0x0a, 0x06, 0x53, 0x45, 0x41, + 0x52, 0x43, 0x48, 0x10, 0x04, 0x12, 0x0a, 0x0a, 0x06, 0x44, 0x45, 0x4c, 0x45, 0x54, 0x45, 0x10, + 0x05, 0x12, 0x09, 0x0a, 0x05, 0x52, 0x41, 0x4e, 0x47, 0x45, 0x10, 0x06, 0x12, 0x0d, 0x0a, 0x09, + 0x52, 0x41, 0x4e, 0x47, 0x45, 0x48, 0x41, 0x53, 0x48, 0x10, 0x07, 0x22, 0xfa, 0x01, 0x0a, 0x17, + 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, + 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x12, 0x43, 0x0a, 0x04, 0x76, 0x65, 0x72, 0x62, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, + 0x6e, 0x65, 0x72, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, + 0x74, 0x2e, 0x56, 0x65, 0x72, 0x62, 0x52, 0x04, 0x76, 0x65, 0x72, 0x62, 0x12, 0x1a, 0x0a, 0x08, + 0x77, 0x69, 0x6c, 0x64, 0x63, 0x61, 0x72, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, + 0x77, 0x69, 0x6c, 0x64, 0x63, 0x61, 0x72, 0x64, 0x12, 0x3e, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, + 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, + 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x52, 0x0b, 0x63, 0x6f, 0x6e, + 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x22, 0x3e, 0x0a, 0x04, 0x56, 0x65, 0x72, 0x62, + 0x12, 0x14, 0x0a, 0x10, 0x56, 0x45, 0x52, 0x42, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, + 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x50, 0x55, 0x54, 0x10, 0x01, 0x12, + 0x0a, 0x0a, 0x06, 0x44, 0x45, 0x4c, 0x45, 0x54, 0x45, 0x10, 0x02, 0x12, 0x0b, 0x0a, 0x07, 0x53, + 0x45, 0x54, 0x45, 0x41, 0x43, 0x4c, 0x10, 0x03, 0x22, 0xa0, 0x04, 0x0a, 0x0c, 0x53, 0x65, 0x73, + 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x38, 0x0a, 0x04, 0x62, 0x6f, 0x64, + 0x79, 0x18, 0x01, 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, 0x53, 0x65, 0x73, 0x73, + 0x69, 0x6f, 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, + 0x6f, 0x64, 0x79, 0x12, 0x37, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, + 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, + 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x1a, 0x9c, 0x03, 0x0a, + 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0c, 0x52, 0x02, 0x69, 0x64, 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, 0x4e, 0x0a, 0x08, 0x6c, 0x69, 0x66, + 0x65, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x32, 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, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x12, 0x30, 0x0a, 0x06, 0x73, 0x74, - 0x61, 0x74, 0x75, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, - 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x53, 0x74, - 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0xab, 0x02, 0x0a, - 0x19, 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, 0x12, 0x40, 0x0a, 0x0e, 0x62, 0x6f, - 0x64, 0x79, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x42, 0x6f, 0x64, + 0x79, 0x2e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x4c, 0x69, 0x66, 0x65, 0x74, 0x69, 0x6d, 0x65, 0x52, + 0x08, 0x6c, 0x69, 0x66, 0x65, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x73, 0x65, 0x73, + 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, + 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x4b, 0x65, 0x79, 0x12, 0x41, 0x0a, 0x06, 0x6f, 0x62, + 0x6a, 0x65, 0x63, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x6e, 0x65, 0x6f, + 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x4f, + 0x62, 0x6a, 0x65, 0x63, 0x74, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x74, + 0x65, 0x78, 0x74, 0x48, 0x00, 0x52, 0x06, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x4a, 0x0a, + 0x09, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x2a, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, + 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x53, 0x65, + 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x48, 0x00, 0x52, 0x09, + 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x1a, 0x45, 0x0a, 0x0d, 0x54, 0x6f, 0x6b, + 0x65, 0x6e, 0x4c, 0x69, 0x66, 0x65, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x78, + 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x65, 0x78, 0x70, 0x12, 0x10, 0x0a, 0x03, + 0x6e, 0x62, 0x66, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x6e, 0x62, 0x66, 0x12, 0x10, + 0x0a, 0x03, 0x69, 0x61, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x69, 0x61, 0x74, + 0x42, 0x09, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x22, 0x31, 0x0a, 0x07, 0x58, + 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 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, 0x22, 0x8d, + 0x03, 0x0a, 0x11, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x48, 0x65, + 0x61, 0x64, 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, 0x14, 0x0a, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x12, 0x10, 0x0a, + 0x03, 0x74, 0x74, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x03, 0x74, 0x74, 0x6c, 0x12, + 0x37, 0x0a, 0x09, 0x78, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x18, 0x04, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, + 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x58, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x08, + 0x78, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x12, 0x44, 0x0a, 0x0d, 0x73, 0x65, 0x73, 0x73, + 0x69, 0x6f, 0x6e, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, + 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, + 0x52, 0x0c, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x3d, + 0x0a, 0x0c, 0x62, 0x65, 0x61, 0x72, 0x65, 0x72, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x06, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x42, 0x65, 0x61, 0x72, 0x65, 0x72, 0x54, 0x6f, 0x6b, 0x65, 0x6e, + 0x52, 0x0b, 0x62, 0x65, 0x61, 0x72, 0x65, 0x72, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x3c, 0x0a, + 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x18, 0x07, 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, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x12, 0x21, 0x0a, 0x0c, 0x6d, + 0x61, 0x67, 0x69, 0x63, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x08, 0x20, 0x01, 0x28, + 0x04, 0x52, 0x0b, 0x6d, 0x61, 0x67, 0x69, 0x63, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x22, 0x99, + 0x02, 0x0a, 0x12, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x48, + 0x65, 0x61, 0x64, 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, 0x14, 0x0a, 0x05, 0x65, 0x70, 0x6f, 0x63, + 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x12, 0x10, + 0x0a, 0x03, 0x74, 0x74, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x03, 0x74, 0x74, 0x6c, + 0x12, 0x37, 0x0a, 0x09, 0x78, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x18, 0x04, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, + 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x58, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, + 0x08, 0x78, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x12, 0x3d, 0x0a, 0x06, 0x6f, 0x72, 0x69, + 0x67, 0x69, 0x6e, 0x18, 0x05, 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, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x12, 0x30, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, + 0x75, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x53, 0x74, 0x61, 0x74, + 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0xab, 0x02, 0x0a, 0x19, 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, 0x12, 0x40, 0x0a, 0x0e, 0x62, 0x6f, 0x64, 0x79, + 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, + 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x0d, 0x62, 0x6f, 0x64, + 0x79, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x40, 0x0a, 0x0e, 0x6d, 0x65, + 0x74, 0x61, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, - 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x0d, 0x62, - 0x6f, 0x64, 0x79, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x40, 0x0a, 0x0e, - 0x6d, 0x65, 0x74, 0x61, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, - 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, - 0x0d, 0x6d, 0x65, 0x74, 0x61, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x44, - 0x0a, 0x10, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, - 0x72, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, - 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, - 0x75, 0x72, 0x65, 0x52, 0x0f, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x53, 0x69, 0x67, 0x6e, 0x61, - 0x74, 0x75, 0x72, 0x65, 0x12, 0x44, 0x0a, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x18, 0x04, - 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, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x22, 0xad, 0x02, 0x0a, 0x1a, 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, 0x12, 0x40, 0x0a, 0x0e, 0x62, 0x6f, 0x64, - 0x79, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x0d, 0x6d, + 0x65, 0x74, 0x61, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x44, 0x0a, 0x10, + 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, + 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, + 0x65, 0x52, 0x0f, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, + 0x72, 0x65, 0x12, 0x44, 0x0a, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x18, 0x04, 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, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x22, 0xad, 0x02, 0x0a, 0x1a, 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, 0x12, 0x40, 0x0a, 0x0e, 0x62, 0x6f, 0x64, 0x79, 0x5f, + 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, + 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x0d, 0x62, 0x6f, 0x64, 0x79, + 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x40, 0x0a, 0x0e, 0x6d, 0x65, 0x74, + 0x61, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, - 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x0d, 0x62, 0x6f, - 0x64, 0x79, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x40, 0x0a, 0x0e, 0x6d, - 0x65, 0x74, 0x61, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, - 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x0d, - 0x6d, 0x65, 0x74, 0x61, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x44, 0x0a, - 0x10, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, - 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, - 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, - 0x72, 0x65, 0x52, 0x0f, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, - 0x75, 0x72, 0x65, 0x12, 0x45, 0x0a, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x18, 0x04, 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, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x42, 0x59, 0x5a, 0x39, 0x67, 0x69, - 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, - 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, - 0x76, 0x32, 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, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x0d, 0x6d, 0x65, + 0x74, 0x61, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x44, 0x0a, 0x10, 0x6f, + 0x72, 0x69, 0x67, 0x69, 0x6e, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, + 0x52, 0x0f, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, + 0x65, 0x12, 0x45, 0x0a, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x18, 0x04, 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, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x42, 0x59, 0x5a, 0x39, 0x67, 0x69, 0x74, 0x68, + 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, + 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, + 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, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -1146,7 +1218,7 @@ func file_session_grpc_types_proto_rawDescGZIP() []byte { } var file_session_grpc_types_proto_enumTypes = make([]protoimpl.EnumInfo, 2) -var file_session_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 10) +var file_session_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 11) var file_session_grpc_types_proto_goTypes = []interface{}{ (ObjectSessionContext_Verb)(0), // 0: neo.fs.v2.session.ObjectSessionContext.Verb (ContainerSessionContext_Verb)(0), // 1: neo.fs.v2.session.ContainerSessionContext.Verb @@ -1158,22 +1230,23 @@ var file_session_grpc_types_proto_goTypes = []interface{}{ (*ResponseMetaHeader)(nil), // 7: neo.fs.v2.session.ResponseMetaHeader (*RequestVerificationHeader)(nil), // 8: neo.fs.v2.session.RequestVerificationHeader (*ResponseVerificationHeader)(nil), // 9: neo.fs.v2.session.ResponseVerificationHeader - (*SessionToken_Body)(nil), // 10: neo.fs.v2.session.SessionToken.Body - (*SessionToken_Body_TokenLifetime)(nil), // 11: neo.fs.v2.session.SessionToken.Body.TokenLifetime - (*grpc.Address)(nil), // 12: neo.fs.v2.refs.Address + (*ObjectSessionContext_Target)(nil), // 10: neo.fs.v2.session.ObjectSessionContext.Target + (*SessionToken_Body)(nil), // 11: neo.fs.v2.session.SessionToken.Body + (*SessionToken_Body_TokenLifetime)(nil), // 12: neo.fs.v2.session.SessionToken.Body.TokenLifetime (*grpc.ContainerID)(nil), // 13: neo.fs.v2.refs.ContainerID (*grpc.Signature)(nil), // 14: neo.fs.v2.refs.Signature (*grpc.Version)(nil), // 15: neo.fs.v2.refs.Version (*grpc1.BearerToken)(nil), // 16: neo.fs.v2.acl.BearerToken (*grpc2.Status)(nil), // 17: neo.fs.v2.status.Status - (*grpc.OwnerID)(nil), // 18: neo.fs.v2.refs.OwnerID + (*grpc.ObjectID)(nil), // 18: neo.fs.v2.refs.ObjectID + (*grpc.OwnerID)(nil), // 19: neo.fs.v2.refs.OwnerID } var file_session_grpc_types_proto_depIdxs = []int32{ 0, // 0: neo.fs.v2.session.ObjectSessionContext.verb:type_name -> neo.fs.v2.session.ObjectSessionContext.Verb - 12, // 1: neo.fs.v2.session.ObjectSessionContext.address:type_name -> neo.fs.v2.refs.Address + 10, // 1: neo.fs.v2.session.ObjectSessionContext.target:type_name -> neo.fs.v2.session.ObjectSessionContext.Target 1, // 2: neo.fs.v2.session.ContainerSessionContext.verb:type_name -> neo.fs.v2.session.ContainerSessionContext.Verb 13, // 3: neo.fs.v2.session.ContainerSessionContext.container_id:type_name -> neo.fs.v2.refs.ContainerID - 10, // 4: neo.fs.v2.session.SessionToken.body:type_name -> neo.fs.v2.session.SessionToken.Body + 11, // 4: neo.fs.v2.session.SessionToken.body:type_name -> neo.fs.v2.session.SessionToken.Body 14, // 5: neo.fs.v2.session.SessionToken.signature:type_name -> neo.fs.v2.refs.Signature 15, // 6: neo.fs.v2.session.RequestMetaHeader.version:type_name -> neo.fs.v2.refs.Version 5, // 7: neo.fs.v2.session.RequestMetaHeader.x_headers:type_name -> neo.fs.v2.session.XHeader @@ -1192,15 +1265,17 @@ var file_session_grpc_types_proto_depIdxs = []int32{ 14, // 20: neo.fs.v2.session.ResponseVerificationHeader.meta_signature:type_name -> neo.fs.v2.refs.Signature 14, // 21: neo.fs.v2.session.ResponseVerificationHeader.origin_signature:type_name -> neo.fs.v2.refs.Signature 9, // 22: neo.fs.v2.session.ResponseVerificationHeader.origin:type_name -> neo.fs.v2.session.ResponseVerificationHeader - 18, // 23: neo.fs.v2.session.SessionToken.Body.owner_id:type_name -> neo.fs.v2.refs.OwnerID - 11, // 24: neo.fs.v2.session.SessionToken.Body.lifetime:type_name -> neo.fs.v2.session.SessionToken.Body.TokenLifetime - 2, // 25: neo.fs.v2.session.SessionToken.Body.object:type_name -> neo.fs.v2.session.ObjectSessionContext - 3, // 26: neo.fs.v2.session.SessionToken.Body.container:type_name -> neo.fs.v2.session.ContainerSessionContext - 27, // [27:27] is the sub-list for method output_type - 27, // [27:27] is the sub-list for method input_type - 27, // [27:27] is the sub-list for extension type_name - 27, // [27:27] is the sub-list for extension extendee - 0, // [0:27] is the sub-list for field type_name + 13, // 23: neo.fs.v2.session.ObjectSessionContext.Target.container:type_name -> neo.fs.v2.refs.ContainerID + 18, // 24: neo.fs.v2.session.ObjectSessionContext.Target.objects:type_name -> neo.fs.v2.refs.ObjectID + 19, // 25: neo.fs.v2.session.SessionToken.Body.owner_id:type_name -> neo.fs.v2.refs.OwnerID + 12, // 26: neo.fs.v2.session.SessionToken.Body.lifetime:type_name -> neo.fs.v2.session.SessionToken.Body.TokenLifetime + 2, // 27: neo.fs.v2.session.SessionToken.Body.object:type_name -> neo.fs.v2.session.ObjectSessionContext + 3, // 28: neo.fs.v2.session.SessionToken.Body.container:type_name -> neo.fs.v2.session.ContainerSessionContext + 29, // [29:29] is the sub-list for method output_type + 29, // [29:29] is the sub-list for method input_type + 29, // [29:29] is the sub-list for extension type_name + 29, // [29:29] is the sub-list for extension extendee + 0, // [0:29] is the sub-list for field type_name } func init() { file_session_grpc_types_proto_init() } @@ -1306,7 +1381,7 @@ func file_session_grpc_types_proto_init() { } } file_session_grpc_types_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SessionToken_Body); i { + switch v := v.(*ObjectSessionContext_Target); i { case 0: return &v.state case 1: @@ -1318,6 +1393,18 @@ func file_session_grpc_types_proto_init() { } } file_session_grpc_types_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SessionToken_Body); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_session_grpc_types_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*SessionToken_Body_TokenLifetime); i { case 0: return &v.state @@ -1330,7 +1417,7 @@ func file_session_grpc_types_proto_init() { } } } - file_session_grpc_types_proto_msgTypes[8].OneofWrappers = []interface{}{ + file_session_grpc_types_proto_msgTypes[9].OneofWrappers = []interface{}{ (*SessionToken_Body_Object)(nil), (*SessionToken_Body_Container)(nil), } @@ -1340,7 +1427,7 @@ func file_session_grpc_types_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_session_grpc_types_proto_rawDesc, NumEnums: 2, - NumMessages: 10, + NumMessages: 11, NumExtensions: 0, NumServices: 0, }, diff --git a/session/marshal.go b/session/marshal.go index d7db4d2..2c82179 100644 --- a/session/marshal.go +++ b/session/marshal.go @@ -21,8 +21,8 @@ const ( lifetimeNotValidBeforeField = 2 lifetimeIssuedAtField = 3 - objectCtxVerbField = 1 - objectCtxAddressField = 2 + objectCtxVerbField = 1 + objectCtxTargetField = 2 sessionTokenBodyIDField = 1 sessionTokenBodyOwnerField = 2 @@ -210,10 +210,11 @@ func (c *ObjectSessionContext) StableMarshal(buf []byte) []byte { buf = make([]byte, c.StableSize()) } - var offset int - - offset += proto.EnumMarshal(objectCtxVerbField, buf[offset:], int32(c.verb)) - proto.NestedStructureMarshal(objectCtxAddressField, buf[offset:], c.addr) + offset := proto.EnumMarshal(objectCtxVerbField, buf, int32(c.verb)) + proto.NestedStructureMarshal(objectCtxTargetField, buf[offset:], &objectSessionContextTarget{ + cnr: c.cnr, + objs: c.objs, + }) return buf } @@ -224,7 +225,10 @@ func (c *ObjectSessionContext) StableSize() (size int) { } size += proto.EnumSize(objectCtxVerbField, int32(c.verb)) - size += proto.NestedStructureSize(objectCtxAddressField, c.addr) + size += proto.NestedStructureSize(objectCtxTargetField, &objectSessionContextTarget{ + cnr: c.cnr, + objs: c.objs, + }) return size } diff --git a/session/test/generate.go b/session/test/generate.go index 25976bc..8bb2c82 100644 --- a/session/test/generate.go +++ b/session/test/generate.go @@ -195,7 +195,7 @@ func GenerateObjectSessionContext(empty bool) *session.ObjectSessionContext { if !empty { m.SetVerb(session.ObjectVerbHead) - m.SetAddress(refstest.GenerateAddress(false)) + m.SetTarget(refstest.GenerateContainerID(false), refstest.GenerateObjectIDs(false)...) } return m diff --git a/session/types.go b/session/types.go index dfa8c5e..cb14825 100644 --- a/session/types.go +++ b/session/types.go @@ -4,6 +4,7 @@ import ( "github.com/nspcc-dev/neofs-api-go/v2/acl" "github.com/nspcc-dev/neofs-api-go/v2/refs" "github.com/nspcc-dev/neofs-api-go/v2/status" + "github.com/nspcc-dev/neofs-api-go/v2/util/proto" ) type CreateRequestBody struct { @@ -40,10 +41,48 @@ type TokenLifetime struct { type ObjectSessionVerb uint32 +type objectSessionContextTarget struct { + cnr *refs.ContainerID + + objs []refs.ObjectID +} + +const ( + _ = iota + fNumObjectTargetContainer + fNumObjectTargetObjects +) + +func (x objectSessionContextTarget) StableMarshal(buf []byte) []byte { + if buf == nil { + buf = make([]byte, x.StableSize()) + } + + offset := proto.NestedStructureMarshal(fNumObjectTargetContainer, buf, x.cnr) + + for i := range x.objs { + offset += proto.NestedStructureMarshal(fNumObjectTargetObjects, buf[offset:], &x.objs[i]) + } + + return buf +} + +func (x objectSessionContextTarget) StableSize() (size int) { + size += proto.NestedStructureSize(fNumObjectTargetContainer, x.cnr) + + for i := range x.objs { + size += proto.NestedStructureSize(fNumObjectTargetObjects, &x.objs[i]) + } + + return size +} + type ObjectSessionContext struct { verb ObjectSessionVerb - addr *refs.Address + cnr *refs.ContainerID + + objs []refs.ObjectID } type TokenContext interface { @@ -617,16 +656,25 @@ func (c *ObjectSessionContext) SetVerb(v ObjectSessionVerb) { c.verb = v } -func (c *ObjectSessionContext) GetAddress() *refs.Address { +func (c *ObjectSessionContext) GetContainer() *refs.ContainerID { if c != nil { - return c.addr + return c.cnr } return nil } -func (c *ObjectSessionContext) SetAddress(v *refs.Address) { - c.addr = v +func (c *ObjectSessionContext) GetObjects() []refs.ObjectID { + if c != nil { + return c.objs + } + + return nil +} + +func (c *ObjectSessionContext) SetTarget(cnr *refs.ContainerID, objs ...refs.ObjectID) { + c.cnr = cnr + c.objs = objs } func (t *TokenBody) GetID() []byte { From 2b89b7e7982cd13f61489d526c4ecf6f811beedb Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 3 Oct 2022 13:20:08 +0400 Subject: [PATCH 1020/1196] [#419] rpc/client: Block until client connection is up In previous implementation `Client` didn't block until the connection is up on dial stage. This caused the dial timeout to have no effect. Provide `WithBlock` dial option to `DialContext` call in `openGRPCConn` method. From now `Client` blocks for configured timeout until the connection is up. Signed-off-by: Leonard Lyubich --- rpc/client/connect.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/rpc/client/connect.go b/rpc/client/connect.go index 18134c4..a5403e3 100644 --- a/rpc/client/connect.go +++ b/rpc/client/connect.go @@ -49,10 +49,16 @@ func (c *Client) openGRPCConn() error { dialCtx, cancel := context.WithTimeout(context.Background(), c.dialTimeout) var err error - c.conn, err = grpcstd.DialContext(dialCtx, c.addr, grpcstd.WithTransportCredentials(creds)) + c.conn, err = grpcstd.DialContext(dialCtx, c.addr, + grpcstd.WithTransportCredentials(creds), + grpcstd.WithBlock(), + ) cancel() + if err != nil { + return fmt.Errorf("open gRPC client connection: %w", err) + } - return err + return nil } // ParseURI parses s as address and returns a host and a flag From 3a91383f24a9d40104f0ad141e89a7b643b03809 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 3 Oct 2022 13:34:22 +0400 Subject: [PATCH 1021/1196] [#419] rpc/client: Use provided context for client dial In previous implementation `Client` passed `context.Background()` to `grpc.DialContext` function. This didn't allow to abort dial stage by the given context. Base dial context on the one provided with `WithContext` option. Fall back to using `context.Background` if context is not specified. Signed-off-by: Leonard Lyubich --- rpc/client/call_options.go | 14 ++++++++------ rpc/client/connect.go | 14 +++++++++----- rpc/client/init.go | 4 ++-- 3 files changed, 19 insertions(+), 13 deletions(-) diff --git a/rpc/client/call_options.go b/rpc/client/call_options.go index e443a89..bf99c92 100644 --- a/rpc/client/call_options.go +++ b/rpc/client/call_options.go @@ -2,26 +2,28 @@ package client import ( "context" - - "github.com/nspcc-dev/neofs-api-go/v2/rpc/grpc" ) // CallOption is a messaging session option within Protobuf RPC. type CallOption func(*callParameters) type callParameters struct { - callOpts []grpc.CallOption + ctx context.Context } func defaultCallParameters() *callParameters { return &callParameters{ - callOpts: make([]grpc.CallOption, 0, 1), + ctx: context.Background(), } } -// WithContext return options to specify call context. +// WithContext returns option to specify call context. If provided, all network +// communications will be based on this context. Otherwise, context.Background() +// is used. +// +// Context SHOULD NOT be nil. func WithContext(ctx context.Context) CallOption { return func(prm *callParameters) { - prm.callOpts = append(prm.callOpts, grpc.WithContext(ctx)) + prm.ctx = ctx } } diff --git a/rpc/client/connect.go b/rpc/client/connect.go index a5403e3..cdbbbea 100644 --- a/rpc/client/connect.go +++ b/rpc/client/connect.go @@ -13,9 +13,10 @@ import ( "google.golang.org/grpc/credentials/insecure" ) -func (c *Client) createGRPCClient() (err error) { +func (c *Client) createGRPCClient(ctx context.Context) (err error) { c.gRPCClientOnce.Do(func() { - if err = c.openGRPCConn(); err != nil { + if err = c.openGRPCConn(ctx); err != nil { + err = fmt.Errorf("open gRPC connection: %w", err) return } @@ -30,7 +31,7 @@ func (c *Client) createGRPCClient() (err error) { var errInvalidEndpoint = errors.New("invalid endpoint options") -func (c *Client) openGRPCConn() error { +func (c *Client) openGRPCConn(ctx context.Context) error { if c.conn != nil { return nil } @@ -47,15 +48,18 @@ func (c *Client) openGRPCConn() error { creds = insecure.NewCredentials() } - dialCtx, cancel := context.WithTimeout(context.Background(), c.dialTimeout) + dialCtx, cancel := context.WithTimeout(ctx, c.dialTimeout) var err error + c.conn, err = grpcstd.DialContext(dialCtx, c.addr, grpcstd.WithTransportCredentials(creds), grpcstd.WithBlock(), ) + cancel() + if err != nil { - return fmt.Errorf("open gRPC client connection: %w", err) + return fmt.Errorf("gRPC dial: %w", err) } return nil diff --git a/rpc/client/init.go b/rpc/client/init.go index 27c6199..bad7ed0 100644 --- a/rpc/client/init.go +++ b/rpc/client/init.go @@ -68,11 +68,11 @@ func (g rwGRPC) WriteMessage(m message.Message) error { } func (c *Client) initGRPC(info common.CallMethodInfo, prm *callParameters) (MessageReadWriter, error) { - if err := c.createGRPCClient(); err != nil { + if err := c.createGRPCClient(prm.ctx); err != nil { return nil, err } - rw, err := c.gRPCClient.Init(info, prm.callOpts...) + rw, err := c.gRPCClient.Init(info, grpc.WithContext(prm.ctx)) if err != nil { return nil, err } From 4d4eaa29436e2b1ce9bcdddd6551133c388a1cdb Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Mon, 17 Oct 2022 18:39:06 +0300 Subject: [PATCH 1022/1196] Release v2.14.0 Signed-off-by: Evgenii Stratonikov --- CHANGELOG.md | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e40515b..c49300a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,32 @@ # Changelog +## [Unreleased] + +### Added +### Fixed +### Changed +### Updated + +## [2.14.0] - 2022-10-17 - Anmado (안마도, 鞍馬島) + +### Added +- Maintenance status and node state (#415) +- `NetmapSnapshot` RPC (#418) + +### Fixed +- Marshal repeated `[]byte` fields correctly (#413) +- Block until client connection is up (#419) + +### Changed +- Support new object session context format (#416) +- Mark all expiration methods as deprecated (#417) + +### Updated +- Minimal go version to 1.17 (#412) +- `neofs-crypto` to `v0.4.0` (#412) +- `google.golang.org/grpc` to `v1.48.0` (#415) +- `google.golang.org/protobuf` to `v1.28.0` (#415) + ## [2.13.1] - 2022-08-01 ### Added @@ -826,3 +853,4 @@ Initial public release [2.12.2]: https://github.com/nspcc-dev/neofs-api-go/compare/v2.12.1...v2.12.2 [2.13.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v2.12.2...v2.13.0 [2.13.1]: https://github.com/nspcc-dev/neofs-api-go/compare/v2.13.0...v2.13.1 +[2.14.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v2.13.1...v2.14.0 From 3b6780746167576278e404ec0d7cf3f6530342dd Mon Sep 17 00:00:00 2001 From: Stanislav Bogatyrev Date: Fri, 9 Dec 2022 13:41:35 +0300 Subject: [PATCH 1023/1196] Rebranding Signed-off-by: Stanislav Bogatyrev --- CONTRIBUTING.md | 16 ++++++++-------- CREDITS.md | 2 ++ Makefile | 2 +- README.md | 36 +++++++++++------------------------- prepare.sh | 2 +- 5 files changed, 23 insertions(+), 35 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 99dfb26..baa7725 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -3,8 +3,8 @@ First, thank you for contributing! We love and encourage pull requests from everyone. Please follow the guidelines: -- Check the open [issues](https://github.com/nspcc-dev/neofs-api-go/issues) and - [pull requests](https://github.com/nspcc-dev/neofs-api-go/pulls) for existing +- Check the open [issues](https://github.com/TrueCloudLab/frostfs-api-go/issues) and + [pull requests](https://github.com/TrueCloudLab/frostfs-api-go/pulls) for existing discussions. - Open an issue first, to discuss a new feature or enhancement. @@ -21,23 +21,23 @@ everyone. Please follow the guidelines: ## Development Workflow -Start by forking the `neofs-api-go` repository, make changes in a branch and then +Start by forking the `frostfs-api-go` repository, make changes in a branch and then send a pull request. We encourage pull requests to discuss code changes. Here are the steps in details: ### Set up your GitHub Repository -Fork [NeoFS node upstream](https://github.com/nspcc-dev/neofs-api-go/fork) source +Fork [FrostFS node upstream](https://github.com/TrueCloudLab/frostfs-api-go/fork) source repository to your own personal repository. Copy the URL of your fork (you will need it for the `git clone` command below). ```sh -$ git clone https://github.com/nspcc-dev/neofs-api-go +$ git clone https://github.com/TrueCloudLab/frostfs-api-go ``` ### Set up git remote as ``upstream`` ```sh -$ cd neofs-api-go -$ git remote add upstream https://github.com/nspcc-dev/neofs-api-go +$ cd frostfs-api-go +$ git remote add upstream https://github.com/TrueCloudLab/frostfs-api-go $ git fetch upstream $ git merge upstream/master ... @@ -103,7 +103,7 @@ contributors". To sign your work, just add a line like this at the end of your commit message: ``` -Signed-off-by: Samii Sakisaka +Signed-off-by: Samii Sakisaka ``` This can easily be done with the `--signoff` option to `git commit`. diff --git a/CREDITS.md b/CREDITS.md index b640f64..a868b21 100644 --- a/CREDITS.md +++ b/CREDITS.md @@ -1,5 +1,7 @@ # Credits +FrostFS continues the development of NeoFS. + Initial NeoFS research and development (2018-2020) was done by [NeoSPCC](https://nspcc.ru) team. diff --git a/Makefile b/Makefile index 25324e9..6ceea25 100644 --- a/Makefile +++ b/Makefile @@ -39,7 +39,7 @@ imports: # Regenerate code for proto files protoc: - @GOPRIVATE=github.com/nspcc-dev go mod vendor + @GOPRIVATE=github.com/TrueCloudLab go mod vendor # Install specific version for protobuf lib @go list -f '{{.Path}}/...@{{.Version}}' -m google.golang.org/protobuf | xargs go install -v # Protoc generate diff --git a/README.md b/README.md index 5edeb84..5dd56c2 100644 --- a/README.md +++ b/README.md @@ -2,40 +2,26 @@ NeoFS

- Low-level Golang API for NeoFS + Low-level Golang API for FrostFS

--- -![Tests](https://github.com/nspcc-dev/neofs-api-go/workflows/neofs-api-go%20tests/badge.svg) -[![codecov](https://codecov.io/gh/nspcc-dev/neofs-api-go/branch/master/graph/badge.svg)](https://codecov.io/gh/nspcc-dev/neofs-api-go) -[![Report](https://goreportcard.com/badge/github.com/nspcc-dev/neofs-api-go)](https://goreportcard.com/report/github.com/nspcc-dev/neofs-api-go) -[![GitHub release](https://img.shields.io/github/release/nspcc-dev/neofs-api-go.svg)](https://github.com/nspcc-dev/neofs-api-go) -![GitHub license](https://img.shields.io/github/license/nspcc-dev/neofs-api-go.svg?style=popout) +![Tests](https://github.com/TrueCloudLab/frostfs-api-go/workflows/frostfs-api-go%20tests/badge.svg) +[![codecov](https://codecov.io/gh/TrueCloudLab/frostfs-api-go/branch/master/graph/badge.svg)](https://codecov.io/gh/TrueCloudLab/frostfs-api-go) +[![Report](https://goreportcard.com/badge/github.com/TrueCloudLab/frostfs-api-go)](https://goreportcard.com/report/github.com/TrueCloudLab/frostfs-api-go) +[![GitHub release](https://img.shields.io/github/release/TrueCloudLab/frostfs-api-go.svg)](https://github.com/TrueCloudLab/frostfs-api-go) +![GitHub license](https://img.shields.io/github/license/TrueCloudLab/frostfs-api-go.svg?style=popout) # Overview -Go implementation of recent [NeoFS API](https://github.com/nspcc-dev/neofs-api) -versions. For a more high-level SDK see [NeoFS SDK](https://github.com/nspcc-dev/neofs-sdk-go). +Go implementation of recent [FrostFS API](https://github.com/TrueCloudLab/frostfs-api) +versions. For a more high-level SDK see [FrostFS SDK](https://github.com/TrueCloudLab/frostfs-sdk-go). -## NeoFS-API compatibility +## Frostfs-Api compatibility -|neofs-api-go version|supported NeoFS-API versions| +|frostfs-api-go version|supported frostfs-api versions| |:------------------:|:--------------------------:| -|< v1.20.0 **(unsupported)**|up to v1.2.0| -|v1.20.x|[v2.0.2](https://github.com/nspcc-dev/neofs-api/releases/tag/v2.0.2)| -|v1.21.x|[v2.1.0](https://github.com/nspcc-dev/neofs-api/releases/tag/v2.1.0)| -|v1.22.x|[v2.2.0](https://github.com/nspcc-dev/neofs-api/releases/tag/v2.2.0)| -|v1.23.x|[v2.3.0](https://github.com/nspcc-dev/neofs-api/releases/tag/v2.3.0)| -|v1.24.x|[v2.4.0](https://github.com/nspcc-dev/neofs-api/releases/tag/v2.4.0)| -|v1.25.x|[v2.5.0](https://github.com/nspcc-dev/neofs-api/releases/tag/v2.5.0)| -|v1.26.x|[v2.6.0](https://github.com/nspcc-dev/neofs-api/releases/tag/v2.6.0)| -|v1.27.x|[v2.7.0](https://github.com/nspcc-dev/neofs-api/releases/tag/v2.7.0)| -|v1.28.x|[v2.8.0](https://github.com/nspcc-dev/neofs-api/releases/tag/v2.8.0)| -|v1.29.x|[v2.9.1](https://github.com/nspcc-dev/neofs-api/releases/tag/v2.9.1)| -|v1.30.x|[v2.10.0](https://github.com/nspcc-dev/neofs-api/releases/tag/v2.10.0)| -|v2.11.x|[v2.11.0](https://github.com/nspcc-dev/neofs-api/releases/tag/v2.11.0)| -|v2.12.x|[v2.12.0](https://github.com/nspcc-dev/neofs-api/releases/tag/v2.12.0)| -|v2.13.x|[v2.13.0](https://github.com/nspcc-dev/neofs-api/releases/tag/v2.13.0)| +|v2.14.x|[v2.14.0](https://github.com/TrueCloudLab/frostfs-api/releases/tag/v2.14.0)| ## Contributing diff --git a/prepare.sh b/prepare.sh index 2dd7263..32048b3 100755 --- a/prepare.sh +++ b/prepare.sh @@ -1,7 +1,7 @@ #!/bin/bash if [ -z "$1" ]; then - echo "usage: ./prepare.sh path/to/neofs-api" + echo "usage: ./prepare.sh path/to/frostfs-api" exit 1 fi From 1351b6656d6827f788603fe4623f21964c4dce08 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Fri, 9 Dec 2022 14:16:24 +0300 Subject: [PATCH 1024/1196] Move to frostfs-api Signed-off-by: Evgenii Stratonikov --- accounting/accounting.go | 4 +- accounting/convert.go | 10 ++--- accounting/grpc/service.go | 4 +- accounting/grpc/service.pb.go | 22 +++++----- accounting/grpc/service_grpc.pb.go | 2 +- accounting/grpc/types.pb.go | 17 ++++---- accounting/json.go | 4 +- accounting/marshal.go | 6 +-- accounting/message_test.go | 6 +-- accounting/test/generate.go | 6 +-- acl/bench_test.go | 6 +-- acl/convert.go | 10 ++--- acl/grpc/types.go | 2 +- acl/grpc/types.pb.go | 17 ++++---- acl/json.go | 4 +- acl/marshal.go | 6 +-- acl/message_test.go | 6 +-- acl/string.go | 2 +- acl/test/generate.go | 4 +- acl/types.go | 2 +- audit/convert.go | 10 ++--- audit/grpc/types.go | 2 +- audit/grpc/types.pb.go | 18 ++++----- audit/json.go | 4 +- audit/marshal.go | 8 ++-- audit/message_test.go | 6 +-- audit/test/generate.go | 4 +- audit/types.go | 2 +- container/attributes_test.go | 4 +- container/convert.go | 22 +++++----- container/grpc/service.go | 6 +-- container/grpc/service.pb.go | 24 +++++------ container/grpc/service_grpc.pb.go | 2 +- container/grpc/types.go | 4 +- container/grpc/types.pb.go | 21 +++++----- container/json.go | 4 +- container/marshal.go | 6 +-- container/message_test.go | 6 +-- container/status.go | 4 +- container/status_test.go | 4 +- container/test/generate.go | 10 ++--- container/types.go | 8 ++-- docs/release-instruction.md | 2 +- go.mod | 10 ++--- go.sum | 8 ++-- lock/grpc/types.go | 2 +- lock/grpc/types.pb.go | 18 ++++----- netmap/attributes.go | 2 +- netmap/attributes_test.go | 6 +-- netmap/convert.go | 10 ++--- netmap/grpc/service.go | 4 +- netmap/grpc/service.pb.go | 21 +++++----- netmap/grpc/service_grpc.pb.go | 2 +- netmap/grpc/types.go | 2 +- netmap/grpc/types.pb.go | 60 +++++++++++++++++++++++----- netmap/json.go | 4 +- netmap/marshal.go | 6 +-- netmap/message_test.go | 6 +-- netmap/string.go | 2 +- netmap/test/generate.go | 6 +-- netmap/types.go | 4 +- object/convert.go | 14 +++---- object/grpc/service.go | 4 +- object/grpc/service.pb.go | 20 +++++----- object/grpc/service_grpc.pb.go | 2 +- object/grpc/status.pb.go | 7 ++-- object/grpc/types.go | 4 +- object/grpc/types.pb.go | 20 +++++----- object/json.go | 4 +- object/lock.go | 12 +++--- object/lock_test.go | 4 +- object/marshal.go | 8 ++-- object/message_test.go | 6 +-- object/status.go | 4 +- object/status_test.go | 6 +-- object/string.go | 2 +- object/test/generate.go | 10 ++--- object/types.go | 4 +- refs/convert.go | 6 +-- refs/grpc/types.pb.go | 15 +++---- refs/json.go | 4 +- refs/marshal.go | 6 +-- refs/message_test.go | 6 +-- refs/string.go | 2 +- refs/test/generate.go | 2 +- refs/types_test.go | 2 +- reputation/convert.go | 10 ++--- reputation/grpc/service.go | 2 +- reputation/grpc/service.pb.go | 20 +++++----- reputation/grpc/service_grpc.pb.go | 2 +- reputation/grpc/types.go | 2 +- reputation/grpc/types.pb.go | 20 +++++----- reputation/json.go | 4 +- reputation/marshal.go | 6 +-- reputation/message_test.go | 6 +-- reputation/test/generate.go | 6 +-- reputation/types.go | 4 +- rpc/accounting.go | 6 +-- rpc/client/client.go | 2 +- rpc/client/connect.go | 2 +- rpc/client/flows.go | 4 +- rpc/client/init.go | 6 +-- rpc/client/options_test.go | 10 ++--- rpc/common/call_test.go | 2 +- rpc/container.go | 6 +-- rpc/grpc/init.go | 2 +- rpc/grpc/util.go | 2 +- rpc/message/encoding.go | 2 +- rpc/message/message.go | 2 +- rpc/message/test/message.go | 2 +- rpc/netmap.go | 6 +-- rpc/object.go | 8 ++-- rpc/reputation.go | 6 +-- rpc/session.go | 6 +-- session/convert.go | 18 ++++----- session/grpc/service.go | 2 +- session/grpc/service.pb.go | 18 ++++----- session/grpc/service_grpc.pb.go | 2 +- session/grpc/types.go | 6 +-- session/grpc/types.pb.go | 22 +++++----- session/json.go | 4 +- session/marshal.go | 6 +-- session/message_test.go | 6 +-- session/status.go | 4 +- session/status_test.go | 4 +- session/string.go | 2 +- session/test/generate.go | 10 ++--- session/types.go | 8 ++-- session/util.go | 2 +- signature/sign.go | 16 ++++---- signature/sign_test.go | 6 +-- status/convert.go | 6 +-- status/grpc/types.pb.go | 16 ++++---- status/marshal.go | 6 +-- status/message_test.go | 6 +-- status/test/codes.go | 2 +- status/test/generate.go | 2 +- storagegroup/convert.go | 10 ++--- storagegroup/grpc/types.go | 2 +- storagegroup/grpc/types.pb.go | 20 +++++----- storagegroup/json.go | 4 +- storagegroup/marshal.go | 8 ++-- storagegroup/message_test.go | 6 +-- storagegroup/test/generate.go | 4 +- storagegroup/types.go | 2 +- subnet/encoding_test.go | 6 +-- subnet/grpc/types.go | 2 +- subnet/grpc/types.pb.go | 18 ++++----- subnet/info.go | 12 +++--- subnet/test/generate.go | 4 +- tombstone/convert.go | 8 ++-- tombstone/grpc/types.go | 2 +- tombstone/grpc/types.pb.go | 18 ++++----- tombstone/json.go | 4 +- tombstone/marshal.go | 6 +-- tombstone/message_test.go | 6 +-- tombstone/test/generate.go | 4 +- tombstone/types.go | 2 +- util/proto/marshal_test.go | 4 +- util/proto/test/test.pb.go | 2 +- util/protogen/main.go | 6 +-- util/signature/data.go | 4 +- util/signature/options.go | 6 +-- util/signature/sign_test.go | 2 +- util/signature/walletconnect/sign.go | 2 +- 165 files changed, 607 insertions(+), 565 deletions(-) diff --git a/accounting/accounting.go b/accounting/accounting.go index 5277b1d..25d6199 100644 --- a/accounting/accounting.go +++ b/accounting/accounting.go @@ -1,8 +1,8 @@ package accounting import ( - "github.com/nspcc-dev/neofs-api-go/v2/refs" - "github.com/nspcc-dev/neofs-api-go/v2/session" + "github.com/TrueCloudLab/frostfs-api-go/v2/refs" + "github.com/TrueCloudLab/frostfs-api-go/v2/session" ) type BalanceRequestBody struct { diff --git a/accounting/convert.go b/accounting/convert.go index 1d32210..d37fd1e 100644 --- a/accounting/convert.go +++ b/accounting/convert.go @@ -1,11 +1,11 @@ package accounting import ( - accounting "github.com/nspcc-dev/neofs-api-go/v2/accounting/grpc" - "github.com/nspcc-dev/neofs-api-go/v2/refs" - refsGRPC "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" - "github.com/nspcc-dev/neofs-api-go/v2/rpc/grpc" - "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" + accounting "github.com/TrueCloudLab/frostfs-api-go/v2/accounting/grpc" + "github.com/TrueCloudLab/frostfs-api-go/v2/refs" + refsGRPC "github.com/TrueCloudLab/frostfs-api-go/v2/refs/grpc" + "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/grpc" + "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" ) func (b *BalanceRequestBody) ToGRPCMessage() grpc.Message { diff --git a/accounting/grpc/service.go b/accounting/grpc/service.go index 91f9713..0570cd3 100644 --- a/accounting/grpc/service.go +++ b/accounting/grpc/service.go @@ -1,8 +1,8 @@ package accounting import ( - refs "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" - session "github.com/nspcc-dev/neofs-api-go/v2/session/grpc" + refs "github.com/TrueCloudLab/frostfs-api-go/v2/refs/grpc" + session "github.com/TrueCloudLab/frostfs-api-go/v2/session/grpc" ) // SetOwnerId sets identifier of the account owner. diff --git a/accounting/grpc/service.pb.go b/accounting/grpc/service.pb.go index 7c745ac..d0783f2 100644 --- a/accounting/grpc/service.pb.go +++ b/accounting/grpc/service.pb.go @@ -1,14 +1,14 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.28.0 -// protoc v3.21.6 +// protoc v3.21.9 // source: accounting/grpc/service.proto package accounting import ( - grpc1 "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" - grpc "github.com/nspcc-dev/neofs-api-go/v2/session/grpc" + grpc1 "github.com/TrueCloudLab/frostfs-api-go/v2/refs/grpc" + grpc "github.com/TrueCloudLab/frostfs-api-go/v2/session/grpc" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -320,14 +320,14 @@ var file_accounting_grpc_service_proto_rawDesc = []byte{ 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, 0x62, 0x5a, 0x3f, 0x67, 0x69, 0x74, - 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, - 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, - 0x32, 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, 0x06, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x67, 0x5a, 0x44, 0x67, 0x69, 0x74, + 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x54, 0x72, 0x75, 0x65, 0x43, 0x6c, 0x6f, 0x75, + 0x64, 0x4c, 0x61, 0x62, 0x2f, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, + 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 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, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/accounting/grpc/service_grpc.pb.go b/accounting/grpc/service_grpc.pb.go index beec45e..f1cfeb5 100644 --- a/accounting/grpc/service_grpc.pb.go +++ b/accounting/grpc/service_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.2.0 -// - protoc v3.21.6 +// - protoc v3.21.9 // source: accounting/grpc/service.proto package accounting diff --git a/accounting/grpc/types.pb.go b/accounting/grpc/types.pb.go index 883a041..89a8c76 100644 --- a/accounting/grpc/types.pb.go +++ b/accounting/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.28.0 -// protoc v3.21.6 +// protoc v3.21.9 // source: accounting/grpc/types.proto package accounting @@ -95,13 +95,14 @@ var file_accounting_grpc_types_proto_rawDesc = []byte{ 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, 0x62, 0x5a, 0x3f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, - 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, - 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 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, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6f, 0x6e, 0x42, 0x67, 0x5a, 0x44, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, + 0x2f, 0x54, 0x72, 0x75, 0x65, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x4c, 0x61, 0x62, 0x2f, 0x66, 0x72, + 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 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, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, } var ( diff --git a/accounting/json.go b/accounting/json.go index 5b4378e..b0738f6 100644 --- a/accounting/json.go +++ b/accounting/json.go @@ -1,8 +1,8 @@ package accounting import ( - accounting "github.com/nspcc-dev/neofs-api-go/v2/accounting/grpc" - "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" + accounting "github.com/TrueCloudLab/frostfs-api-go/v2/accounting/grpc" + "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" ) func (d *Decimal) MarshalJSON() ([]byte, error) { diff --git a/accounting/marshal.go b/accounting/marshal.go index f5265b1..06a1299 100644 --- a/accounting/marshal.go +++ b/accounting/marshal.go @@ -1,9 +1,9 @@ package accounting import ( - accounting "github.com/nspcc-dev/neofs-api-go/v2/accounting/grpc" - "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" - protoutil "github.com/nspcc-dev/neofs-api-go/v2/util/proto" + accounting "github.com/TrueCloudLab/frostfs-api-go/v2/accounting/grpc" + "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" + protoutil "github.com/TrueCloudLab/frostfs-api-go/v2/util/proto" ) const ( diff --git a/accounting/message_test.go b/accounting/message_test.go index 16e6d30..cdbac36 100644 --- a/accounting/message_test.go +++ b/accounting/message_test.go @@ -3,9 +3,9 @@ package accounting_test import ( "testing" - accountingtest "github.com/nspcc-dev/neofs-api-go/v2/accounting/test" - "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" - messagetest "github.com/nspcc-dev/neofs-api-go/v2/rpc/message/test" + accountingtest "github.com/TrueCloudLab/frostfs-api-go/v2/accounting/test" + "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" + messagetest "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message/test" ) func TestMessage(t *testing.T) { diff --git a/accounting/test/generate.go b/accounting/test/generate.go index abd9fb8..171693d 100644 --- a/accounting/test/generate.go +++ b/accounting/test/generate.go @@ -1,9 +1,9 @@ package accountingtest import ( - "github.com/nspcc-dev/neofs-api-go/v2/accounting" - accountingtest "github.com/nspcc-dev/neofs-api-go/v2/refs/test" - sessiontest "github.com/nspcc-dev/neofs-api-go/v2/session/test" + "github.com/TrueCloudLab/frostfs-api-go/v2/accounting" + accountingtest "github.com/TrueCloudLab/frostfs-api-go/v2/refs/test" + sessiontest "github.com/TrueCloudLab/frostfs-api-go/v2/session/test" ) func GenerateBalanceRequest(empty bool) *accounting.BalanceRequest { diff --git a/acl/bench_test.go b/acl/bench_test.go index f0ddd29..0196176 100644 --- a/acl/bench_test.go +++ b/acl/bench_test.go @@ -3,9 +3,9 @@ package acl_test import ( "testing" - "github.com/nspcc-dev/neofs-api-go/v2/acl" - aclGrpc "github.com/nspcc-dev/neofs-api-go/v2/acl/grpc" - acltest "github.com/nspcc-dev/neofs-api-go/v2/acl/test" + "github.com/TrueCloudLab/frostfs-api-go/v2/acl" + aclGrpc "github.com/TrueCloudLab/frostfs-api-go/v2/acl/grpc" + acltest "github.com/TrueCloudLab/frostfs-api-go/v2/acl/test" ) func BenchmarkTable_ToGRPCMessage(b *testing.B) { diff --git a/acl/convert.go b/acl/convert.go index a49aa6b..697f699 100644 --- a/acl/convert.go +++ b/acl/convert.go @@ -1,11 +1,11 @@ package acl import ( - acl "github.com/nspcc-dev/neofs-api-go/v2/acl/grpc" - "github.com/nspcc-dev/neofs-api-go/v2/refs" - refsGRPC "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" - "github.com/nspcc-dev/neofs-api-go/v2/rpc/grpc" - "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" + acl "github.com/TrueCloudLab/frostfs-api-go/v2/acl/grpc" + "github.com/TrueCloudLab/frostfs-api-go/v2/refs" + refsGRPC "github.com/TrueCloudLab/frostfs-api-go/v2/refs/grpc" + "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/grpc" + "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" ) // RoleToGRPCField converts unified role enum into grpc enum. diff --git a/acl/grpc/types.go b/acl/grpc/types.go index 032f5c9..436ae58 100644 --- a/acl/grpc/types.go +++ b/acl/grpc/types.go @@ -1,7 +1,7 @@ package acl import ( - refs "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" + refs "github.com/TrueCloudLab/frostfs-api-go/v2/refs/grpc" ) // SetVersion sets version of EACL rules in table. diff --git a/acl/grpc/types.pb.go b/acl/grpc/types.pb.go index 9d5934a..6e9ac46 100644 --- a/acl/grpc/types.pb.go +++ b/acl/grpc/types.pb.go @@ -1,13 +1,13 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.28.0 -// protoc v3.21.6 +// protoc v3.21.9 // source: acl/grpc/types.proto package acl import ( - grpc "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" + grpc "github.com/TrueCloudLab/frostfs-api-go/v2/refs/grpc" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -932,12 +932,13 @@ var file_acl_grpc_types_proto_rawDesc = []byte{ 0x52, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x52, 0x45, 0x51, 0x55, 0x45, 0x53, 0x54, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x4f, 0x42, 0x4a, 0x45, 0x43, 0x54, 0x10, 0x02, 0x12, 0x0b, 0x0a, 0x07, 0x53, 0x45, 0x52, 0x56, - 0x49, 0x43, 0x45, 0x10, 0x03, 0x42, 0x4d, 0x5a, 0x31, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, - 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, - 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x61, 0x63, - 0x6c, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x61, 0x63, 0x6c, 0xaa, 0x02, 0x17, 0x4e, 0x65, 0x6f, - 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, - 0x2e, 0x41, 0x63, 0x6c, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x49, 0x43, 0x45, 0x10, 0x03, 0x42, 0x52, 0x5a, 0x36, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, + 0x63, 0x6f, 0x6d, 0x2f, 0x54, 0x72, 0x75, 0x65, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x4c, 0x61, 0x62, + 0x2f, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, + 0x76, 0x32, 0x2f, 0x61, 0x63, 0x6c, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x61, 0x63, 0x6c, 0xaa, + 0x02, 0x17, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, + 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x41, 0x63, 0x6c, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, } var ( diff --git a/acl/json.go b/acl/json.go index 8144954..7a50e90 100644 --- a/acl/json.go +++ b/acl/json.go @@ -1,8 +1,8 @@ package acl import ( - acl "github.com/nspcc-dev/neofs-api-go/v2/acl/grpc" - "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" + acl "github.com/TrueCloudLab/frostfs-api-go/v2/acl/grpc" + "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" ) func (f *HeaderFilter) MarshalJSON() ([]byte, error) { diff --git a/acl/marshal.go b/acl/marshal.go index 87d476d..1ecdb70 100644 --- a/acl/marshal.go +++ b/acl/marshal.go @@ -1,9 +1,9 @@ package acl import ( - acl "github.com/nspcc-dev/neofs-api-go/v2/acl/grpc" - "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" - protoutil "github.com/nspcc-dev/neofs-api-go/v2/util/proto" + acl "github.com/TrueCloudLab/frostfs-api-go/v2/acl/grpc" + "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" + protoutil "github.com/TrueCloudLab/frostfs-api-go/v2/util/proto" ) const ( diff --git a/acl/message_test.go b/acl/message_test.go index ac1b369..d3e70cf 100644 --- a/acl/message_test.go +++ b/acl/message_test.go @@ -3,9 +3,9 @@ package acl_test import ( "testing" - acltest "github.com/nspcc-dev/neofs-api-go/v2/acl/test" - "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" - messagetest "github.com/nspcc-dev/neofs-api-go/v2/rpc/message/test" + acltest "github.com/TrueCloudLab/frostfs-api-go/v2/acl/test" + "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" + messagetest "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message/test" ) func TestMessageConvert(t *testing.T) { diff --git a/acl/string.go b/acl/string.go index 1968f5d..76c0345 100644 --- a/acl/string.go +++ b/acl/string.go @@ -1,7 +1,7 @@ package acl import ( - acl "github.com/nspcc-dev/neofs-api-go/v2/acl/grpc" + acl "github.com/TrueCloudLab/frostfs-api-go/v2/acl/grpc" ) // String returns string representation of Action. diff --git a/acl/test/generate.go b/acl/test/generate.go index 3d90fc9..67098cf 100644 --- a/acl/test/generate.go +++ b/acl/test/generate.go @@ -1,8 +1,8 @@ package acltest import ( - "github.com/nspcc-dev/neofs-api-go/v2/acl" - accountingtest "github.com/nspcc-dev/neofs-api-go/v2/refs/test" + "github.com/TrueCloudLab/frostfs-api-go/v2/acl" + accountingtest "github.com/TrueCloudLab/frostfs-api-go/v2/refs/test" ) func GenerateBearerToken(empty bool) *acl.BearerToken { diff --git a/acl/types.go b/acl/types.go index 23c994c..f360af6 100644 --- a/acl/types.go +++ b/acl/types.go @@ -1,6 +1,6 @@ package acl -import "github.com/nspcc-dev/neofs-api-go/v2/refs" +import "github.com/TrueCloudLab/frostfs-api-go/v2/refs" // HeaderFilter is a unified structure of FilterInfo // message from proto definition. diff --git a/audit/convert.go b/audit/convert.go index a8b18fa..23a5ce6 100644 --- a/audit/convert.go +++ b/audit/convert.go @@ -1,11 +1,11 @@ package audit import ( - audit "github.com/nspcc-dev/neofs-api-go/v2/audit/grpc" - "github.com/nspcc-dev/neofs-api-go/v2/refs" - refsGRPC "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" - "github.com/nspcc-dev/neofs-api-go/v2/rpc/grpc" - "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" + audit "github.com/TrueCloudLab/frostfs-api-go/v2/audit/grpc" + "github.com/TrueCloudLab/frostfs-api-go/v2/refs" + refsGRPC "github.com/TrueCloudLab/frostfs-api-go/v2/refs/grpc" + "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/grpc" + "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" ) func (a *DataAuditResult) ToGRPCMessage() grpc.Message { diff --git a/audit/grpc/types.go b/audit/grpc/types.go index 36a2267..206fc88 100644 --- a/audit/grpc/types.go +++ b/audit/grpc/types.go @@ -1,7 +1,7 @@ package audit import ( - refs "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" + refs "github.com/TrueCloudLab/frostfs-api-go/v2/refs/grpc" ) // SetVersion is a Version field setter. diff --git a/audit/grpc/types.pb.go b/audit/grpc/types.pb.go index bd1d59b..ceb0955 100644 --- a/audit/grpc/types.pb.go +++ b/audit/grpc/types.pb.go @@ -1,13 +1,13 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.28.0 -// protoc v3.21.6 +// protoc v3.21.9 // source: audit/grpc/types.proto package audit import ( - grpc "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" + grpc "github.com/TrueCloudLab/frostfs-api-go/v2/refs/grpc" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -231,13 +231,13 @@ var file_audit_grpc_types_proto_rawDesc = []byte{ 0x73, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x0d, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x09, 0x70, 0x61, 0x73, 0x73, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x66, 0x61, 0x69, 0x6c, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x0e, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x09, 0x66, 0x61, - 0x69, 0x6c, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x42, 0x53, 0x5a, 0x35, 0x67, 0x69, 0x74, 0x68, 0x75, - 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, - 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, - 0x61, 0x75, 0x64, 0x69, 0x74, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x61, 0x75, 0x64, 0x69, 0x74, - 0xaa, 0x02, 0x19, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, - 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x41, 0x75, 0x64, 0x69, 0x74, 0x62, 0x06, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, + 0x69, 0x6c, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x42, 0x58, 0x5a, 0x3a, 0x67, 0x69, 0x74, 0x68, 0x75, + 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x54, 0x72, 0x75, 0x65, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x4c, + 0x61, 0x62, 0x2f, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, + 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x61, 0x75, 0x64, 0x69, 0x74, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, + 0x61, 0x75, 0x64, 0x69, 0x74, 0xaa, 0x02, 0x19, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, + 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x41, 0x75, 0x64, 0x69, + 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/audit/json.go b/audit/json.go index be46491..550977c 100644 --- a/audit/json.go +++ b/audit/json.go @@ -1,8 +1,8 @@ package audit import ( - audit "github.com/nspcc-dev/neofs-api-go/v2/audit/grpc" - "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" + audit "github.com/TrueCloudLab/frostfs-api-go/v2/audit/grpc" + "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" ) func (a *DataAuditResult) MarshalJSON() ([]byte, error) { diff --git a/audit/marshal.go b/audit/marshal.go index c97fb4e..1560b21 100644 --- a/audit/marshal.go +++ b/audit/marshal.go @@ -1,10 +1,10 @@ package audit import ( - audit "github.com/nspcc-dev/neofs-api-go/v2/audit/grpc" - "github.com/nspcc-dev/neofs-api-go/v2/refs" - "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" - "github.com/nspcc-dev/neofs-api-go/v2/util/proto" + audit "github.com/TrueCloudLab/frostfs-api-go/v2/audit/grpc" + "github.com/TrueCloudLab/frostfs-api-go/v2/refs" + "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" + "github.com/TrueCloudLab/frostfs-api-go/v2/util/proto" ) const ( diff --git a/audit/message_test.go b/audit/message_test.go index 1e0d485..efbbca7 100644 --- a/audit/message_test.go +++ b/audit/message_test.go @@ -3,9 +3,9 @@ package audit_test import ( "testing" - audittest "github.com/nspcc-dev/neofs-api-go/v2/audit/test" - "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" - messagetest "github.com/nspcc-dev/neofs-api-go/v2/rpc/message/test" + audittest "github.com/TrueCloudLab/frostfs-api-go/v2/audit/test" + "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" + messagetest "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message/test" ) func TestMessageConvert(t *testing.T) { diff --git a/audit/test/generate.go b/audit/test/generate.go index 0d5ff01..44c6d14 100644 --- a/audit/test/generate.go +++ b/audit/test/generate.go @@ -1,8 +1,8 @@ package audittest import ( - "github.com/nspcc-dev/neofs-api-go/v2/audit" - refstest "github.com/nspcc-dev/neofs-api-go/v2/refs/test" + "github.com/TrueCloudLab/frostfs-api-go/v2/audit" + refstest "github.com/TrueCloudLab/frostfs-api-go/v2/refs/test" ) func GenerateDataAuditResult(empty bool) *audit.DataAuditResult { diff --git a/audit/types.go b/audit/types.go index 354ef47..14a0025 100644 --- a/audit/types.go +++ b/audit/types.go @@ -1,7 +1,7 @@ package audit import ( - "github.com/nspcc-dev/neofs-api-go/v2/refs" + "github.com/TrueCloudLab/frostfs-api-go/v2/refs" ) // DataAuditResult is a unified structure of diff --git a/container/attributes_test.go b/container/attributes_test.go index 823445d..aa34b2a 100644 --- a/container/attributes_test.go +++ b/container/attributes_test.go @@ -3,8 +3,8 @@ package container_test import ( "testing" - "github.com/nspcc-dev/neofs-api-go/v2/container" - containertest "github.com/nspcc-dev/neofs-api-go/v2/container/test" + "github.com/TrueCloudLab/frostfs-api-go/v2/container" + containertest "github.com/TrueCloudLab/frostfs-api-go/v2/container/test" "github.com/stretchr/testify/require" ) diff --git a/container/convert.go b/container/convert.go index fc174e3..8e35efa 100644 --- a/container/convert.go +++ b/container/convert.go @@ -1,17 +1,17 @@ package container import ( - "github.com/nspcc-dev/neofs-api-go/v2/acl" - aclGRPC "github.com/nspcc-dev/neofs-api-go/v2/acl/grpc" - container "github.com/nspcc-dev/neofs-api-go/v2/container/grpc" - "github.com/nspcc-dev/neofs-api-go/v2/netmap" - netmapGRPC "github.com/nspcc-dev/neofs-api-go/v2/netmap/grpc" - "github.com/nspcc-dev/neofs-api-go/v2/refs" - refsGRPC "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" - "github.com/nspcc-dev/neofs-api-go/v2/rpc/grpc" - "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" - "github.com/nspcc-dev/neofs-api-go/v2/session" - sessionGRPC "github.com/nspcc-dev/neofs-api-go/v2/session/grpc" + "github.com/TrueCloudLab/frostfs-api-go/v2/acl" + aclGRPC "github.com/TrueCloudLab/frostfs-api-go/v2/acl/grpc" + container "github.com/TrueCloudLab/frostfs-api-go/v2/container/grpc" + "github.com/TrueCloudLab/frostfs-api-go/v2/netmap" + netmapGRPC "github.com/TrueCloudLab/frostfs-api-go/v2/netmap/grpc" + "github.com/TrueCloudLab/frostfs-api-go/v2/refs" + refsGRPC "github.com/TrueCloudLab/frostfs-api-go/v2/refs/grpc" + "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/grpc" + "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" + "github.com/TrueCloudLab/frostfs-api-go/v2/session" + sessionGRPC "github.com/TrueCloudLab/frostfs-api-go/v2/session/grpc" ) func (a *Attribute) ToGRPCMessage() grpc.Message { diff --git a/container/grpc/service.go b/container/grpc/service.go index e8f8e72..ca5c4d9 100644 --- a/container/grpc/service.go +++ b/container/grpc/service.go @@ -1,9 +1,9 @@ package container import ( - acl "github.com/nspcc-dev/neofs-api-go/v2/acl/grpc" - refs "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" - session "github.com/nspcc-dev/neofs-api-go/v2/session/grpc" + acl "github.com/TrueCloudLab/frostfs-api-go/v2/acl/grpc" + refs "github.com/TrueCloudLab/frostfs-api-go/v2/refs/grpc" + session "github.com/TrueCloudLab/frostfs-api-go/v2/session/grpc" ) // SetContainer sets container of the request. diff --git a/container/grpc/service.pb.go b/container/grpc/service.pb.go index 1e83d89..ed607e2 100644 --- a/container/grpc/service.pb.go +++ b/container/grpc/service.pb.go @@ -1,15 +1,15 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.28.0 -// protoc v3.21.6 +// protoc v3.21.9 // source: container/grpc/service.proto package container import ( - grpc2 "github.com/nspcc-dev/neofs-api-go/v2/acl/grpc" - grpc1 "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" - grpc "github.com/nspcc-dev/neofs-api-go/v2/session/grpc" + grpc2 "github.com/TrueCloudLab/frostfs-api-go/v2/acl/grpc" + grpc1 "github.com/TrueCloudLab/frostfs-api-go/v2/refs/grpc" + grpc "github.com/TrueCloudLab/frostfs-api-go/v2/session/grpc" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -2160,14 +2160,14 @@ var file_container_grpc_service_proto_rawDesc = []byte{ 0x70, 0x61, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2e, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x55, 0x73, 0x65, 0x64, 0x53, 0x70, - 0x61, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x5f, 0x5a, 0x3d, 0x67, - 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, - 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, - 0x2f, 0x76, 0x32, 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, 0x06, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, + 0x61, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x64, 0x5a, 0x42, 0x67, + 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x54, 0x72, 0x75, 0x65, 0x43, 0x6c, + 0x6f, 0x75, 0x64, 0x4c, 0x61, 0x62, 0x2f, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2d, 0x61, + 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 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, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/container/grpc/service_grpc.pb.go b/container/grpc/service_grpc.pb.go index e84c9b9..1de8b5f 100644 --- a/container/grpc/service_grpc.pb.go +++ b/container/grpc/service_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.2.0 -// - protoc v3.21.6 +// - protoc v3.21.9 // source: container/grpc/service.proto package container diff --git a/container/grpc/types.go b/container/grpc/types.go index 2bb9b8b..91e9470 100644 --- a/container/grpc/types.go +++ b/container/grpc/types.go @@ -1,8 +1,8 @@ package container import ( - netmap "github.com/nspcc-dev/neofs-api-go/v2/netmap/grpc" - refs "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" + netmap "github.com/TrueCloudLab/frostfs-api-go/v2/netmap/grpc" + refs "github.com/TrueCloudLab/frostfs-api-go/v2/refs/grpc" ) // SetKey sets key to the container attribute. diff --git a/container/grpc/types.pb.go b/container/grpc/types.pb.go index 29901f2..0b78b3f 100644 --- a/container/grpc/types.pb.go +++ b/container/grpc/types.pb.go @@ -1,14 +1,14 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.28.0 -// protoc v3.21.6 +// protoc v3.21.9 // source: container/grpc/types.proto package container import ( - grpc1 "github.com/nspcc-dev/neofs-api-go/v2/netmap/grpc" - grpc "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" + grpc1 "github.com/TrueCloudLab/frostfs-api-go/v2/netmap/grpc" + grpc "github.com/TrueCloudLab/frostfs-api-go/v2/refs/grpc" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -242,13 +242,14 @@ var file_container_grpc_types_proto_rawDesc = []byte{ 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, 0x5f, 0x5a, 0x3d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, - 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, - 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 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, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x64, 0x5a, 0x42, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, + 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x54, 0x72, 0x75, 0x65, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x4c, 0x61, + 0x62, 0x2f, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, + 0x2f, 0x76, 0x32, 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, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/container/json.go b/container/json.go index b354585..ac8bdf3 100644 --- a/container/json.go +++ b/container/json.go @@ -1,8 +1,8 @@ package container import ( - container "github.com/nspcc-dev/neofs-api-go/v2/container/grpc" - "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" + container "github.com/TrueCloudLab/frostfs-api-go/v2/container/grpc" + "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" ) func (a *Attribute) MarshalJSON() ([]byte, error) { diff --git a/container/marshal.go b/container/marshal.go index ae1ac78..a7f77ab 100644 --- a/container/marshal.go +++ b/container/marshal.go @@ -1,9 +1,9 @@ package container import ( - container "github.com/nspcc-dev/neofs-api-go/v2/container/grpc" - "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" - protoutil "github.com/nspcc-dev/neofs-api-go/v2/util/proto" + container "github.com/TrueCloudLab/frostfs-api-go/v2/container/grpc" + "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" + protoutil "github.com/TrueCloudLab/frostfs-api-go/v2/util/proto" ) const ( diff --git a/container/message_test.go b/container/message_test.go index 3f7b076..62e1914 100644 --- a/container/message_test.go +++ b/container/message_test.go @@ -3,9 +3,9 @@ package container_test import ( "testing" - containertest "github.com/nspcc-dev/neofs-api-go/v2/container/test" - "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" - messagetest "github.com/nspcc-dev/neofs-api-go/v2/rpc/message/test" + containertest "github.com/TrueCloudLab/frostfs-api-go/v2/container/test" + "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" + messagetest "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message/test" ) func TestMessageConvert(t *testing.T) { diff --git a/container/status.go b/container/status.go index 499c855..d5aa147 100644 --- a/container/status.go +++ b/container/status.go @@ -1,8 +1,8 @@ package container import ( - "github.com/nspcc-dev/neofs-api-go/v2/status" - statusgrpc "github.com/nspcc-dev/neofs-api-go/v2/status/grpc" + "github.com/TrueCloudLab/frostfs-api-go/v2/status" + statusgrpc "github.com/TrueCloudLab/frostfs-api-go/v2/status/grpc" ) // LocalizeFailStatus checks if passed global status.Code is related to container failure and: diff --git a/container/status_test.go b/container/status_test.go index c7d9c91..adbfd2f 100644 --- a/container/status_test.go +++ b/container/status_test.go @@ -3,8 +3,8 @@ package container_test import ( "testing" - "github.com/nspcc-dev/neofs-api-go/v2/container" - statustest "github.com/nspcc-dev/neofs-api-go/v2/status/test" + "github.com/TrueCloudLab/frostfs-api-go/v2/container" + statustest "github.com/TrueCloudLab/frostfs-api-go/v2/status/test" ) func TestStatusCodes(t *testing.T) { diff --git a/container/test/generate.go b/container/test/generate.go index dfd2098..82f378a 100644 --- a/container/test/generate.go +++ b/container/test/generate.go @@ -1,11 +1,11 @@ package containertest import ( - acltest "github.com/nspcc-dev/neofs-api-go/v2/acl/test" - "github.com/nspcc-dev/neofs-api-go/v2/container" - netmaptest "github.com/nspcc-dev/neofs-api-go/v2/netmap/test" - refstest "github.com/nspcc-dev/neofs-api-go/v2/refs/test" - sessiontest "github.com/nspcc-dev/neofs-api-go/v2/session/test" + acltest "github.com/TrueCloudLab/frostfs-api-go/v2/acl/test" + "github.com/TrueCloudLab/frostfs-api-go/v2/container" + netmaptest "github.com/TrueCloudLab/frostfs-api-go/v2/netmap/test" + refstest "github.com/TrueCloudLab/frostfs-api-go/v2/refs/test" + sessiontest "github.com/TrueCloudLab/frostfs-api-go/v2/session/test" ) func GenerateAttribute(empty bool) *container.Attribute { diff --git a/container/types.go b/container/types.go index 215f830..fdb35f8 100644 --- a/container/types.go +++ b/container/types.go @@ -1,10 +1,10 @@ package container import ( - "github.com/nspcc-dev/neofs-api-go/v2/acl" - "github.com/nspcc-dev/neofs-api-go/v2/netmap" - "github.com/nspcc-dev/neofs-api-go/v2/refs" - "github.com/nspcc-dev/neofs-api-go/v2/session" + "github.com/TrueCloudLab/frostfs-api-go/v2/acl" + "github.com/TrueCloudLab/frostfs-api-go/v2/netmap" + "github.com/TrueCloudLab/frostfs-api-go/v2/refs" + "github.com/TrueCloudLab/frostfs-api-go/v2/session" ) type Attribute struct { diff --git a/docs/release-instruction.md b/docs/release-instruction.md index 74465d7..4134f1c 100644 --- a/docs/release-instruction.md +++ b/docs/release-instruction.md @@ -7,7 +7,7 @@ These should run successfully: * `golangci-lint run ./...`; * `go fmt ./...` (should not change any files); * `go mog tidy` (should not change any files); -* `./prepare.sh /path/to/neofs-api/on/your/machine` (should not change any files). +* `./prepare.sh /path/to/frostfs-api/on/your/machine` (should not change any files). ## Writing changelog diff --git a/go.mod b/go.mod index aa93538..4eddb9e 100644 --- a/go.mod +++ b/go.mod @@ -1,19 +1,19 @@ -module github.com/nspcc-dev/neofs-api-go/v2 +module github.com/TrueCloudLab/frostfs-api-go/v2 go 1.17 require ( - github.com/nspcc-dev/neofs-crypto v0.4.0 + github.com/TrueCloudLab/frostfs-crypto v0.5.0 github.com/stretchr/testify v1.7.0 google.golang.org/grpc v1.48.0 google.golang.org/protobuf v1.28.0 ) require ( + github.com/TrueCloudLab/rfc6979 v0.3.0 // indirect github.com/davecgh/go-spew v1.1.0 // indirect github.com/golang/protobuf v1.5.2 // indirect github.com/mr-tron/base58 v1.2.0 // indirect - github.com/nspcc-dev/rfc6979 v0.2.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect golang.org/x/net v0.0.0-20201021035429-f5854403a974 // indirect golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4 // indirect @@ -21,7 +21,3 @@ require ( google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 // indirect gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect ) - -// This version uses broken NeoFS API with incompatible signature -// definitions. See fix in https://github.com/nspcc-dev/neofs-api/pull/203 -retract v2.12.0 diff --git a/go.sum b/go.sum index 4917800..68f8351 100644 --- a/go.sum +++ b/go.sum @@ -1,6 +1,10 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/TrueCloudLab/frostfs-crypto v0.5.0 h1:ZoLjixSkQv3j1EwZ1WJzMEJY2NR+9nO4Pd8WSyM/RRI= +github.com/TrueCloudLab/frostfs-crypto v0.5.0/go.mod h1:775MUewpH8AWpXrimAG2NYWOXB6lpKOI5kqgu+eI5zs= +github.com/TrueCloudLab/rfc6979 v0.3.0 h1:0SYMAfQWh/TjnofqYQHy+s3rmQ5gi0fvOaDbqd60/Ic= +github.com/TrueCloudLab/rfc6979 v0.3.0/go.mod h1:qylxFXFQ/sMvpZC/8JyWp+mfzk5Zj/KDT5FAbekhobc= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= @@ -48,10 +52,6 @@ github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+ github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/mr-tron/base58 v1.2.0 h1:T/HDJBh4ZCPbU39/+c3rRvE0uKBQlU27+QI8LJ4t64o= github.com/mr-tron/base58 v1.2.0/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= -github.com/nspcc-dev/neofs-crypto v0.4.0 h1:5LlrUAM5O0k1+sH/sktBtrgfWtq1pgpDs09fZo+KYi4= -github.com/nspcc-dev/neofs-crypto v0.4.0/go.mod h1:6XJ8kbXgOfevbI2WMruOtI+qUJXNwSGM/E9eClXxPHs= -github.com/nspcc-dev/rfc6979 v0.2.0 h1:3e1WNxrN60/6N0DW7+UYisLeZJyfqZTNOjeV/toYvOE= -github.com/nspcc-dev/rfc6979 v0.2.0/go.mod h1:exhIh1PdpDC5vQmyEsGvc4YDM/lyQp/452QxGq/UEso= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= diff --git a/lock/grpc/types.go b/lock/grpc/types.go index f10684c..d39c134 100644 --- a/lock/grpc/types.go +++ b/lock/grpc/types.go @@ -1,6 +1,6 @@ package lock -import refs "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" +import refs "github.com/TrueCloudLab/frostfs-api-go/v2/refs/grpc" // SetMembers sets `members` field. func (x *Lock) SetMembers(ids []*refs.ObjectID) { diff --git a/lock/grpc/types.pb.go b/lock/grpc/types.pb.go index d54ad2f..35bef9e 100644 --- a/lock/grpc/types.pb.go +++ b/lock/grpc/types.pb.go @@ -1,13 +1,13 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.28.0 -// protoc v3.21.6 +// protoc v3.21.9 // source: lock/grpc/types.proto package lock import ( - grpc "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" + grpc "github.com/TrueCloudLab/frostfs-api-go/v2/refs/grpc" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -84,13 +84,13 @@ var file_lock_grpc_types_proto_rawDesc = []byte{ 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, 0x50, 0x5a, 0x33, 0x67, 0x69, - 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, - 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, - 0x76, 0x32, 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, 0x06, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, + 0x44, 0x52, 0x07, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x42, 0x55, 0x5a, 0x38, 0x67, 0x69, + 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x54, 0x72, 0x75, 0x65, 0x43, 0x6c, 0x6f, + 0x75, 0x64, 0x4c, 0x61, 0x62, 0x2f, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2d, 0x61, 0x70, + 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 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, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/netmap/attributes.go b/netmap/attributes.go index 4f69287..6901da5 100644 --- a/netmap/attributes.go +++ b/netmap/attributes.go @@ -5,7 +5,7 @@ import ( "fmt" "strings" - "github.com/nspcc-dev/neofs-api-go/v2/refs" + "github.com/TrueCloudLab/frostfs-api-go/v2/refs" ) // prefix of keys to subnet attributes. diff --git a/netmap/attributes_test.go b/netmap/attributes_test.go index e485dac..0385f42 100644 --- a/netmap/attributes_test.go +++ b/netmap/attributes_test.go @@ -4,9 +4,9 @@ import ( "strconv" "testing" - "github.com/nspcc-dev/neofs-api-go/v2/netmap" - netmaptest "github.com/nspcc-dev/neofs-api-go/v2/netmap/test" - "github.com/nspcc-dev/neofs-api-go/v2/refs" + "github.com/TrueCloudLab/frostfs-api-go/v2/netmap" + netmaptest "github.com/TrueCloudLab/frostfs-api-go/v2/netmap/test" + "github.com/TrueCloudLab/frostfs-api-go/v2/refs" "github.com/stretchr/testify/require" ) diff --git a/netmap/convert.go b/netmap/convert.go index d2121b1..36af646 100644 --- a/netmap/convert.go +++ b/netmap/convert.go @@ -1,11 +1,11 @@ package netmap import ( - netmap "github.com/nspcc-dev/neofs-api-go/v2/netmap/grpc" - "github.com/nspcc-dev/neofs-api-go/v2/refs" - refsGRPC "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" - "github.com/nspcc-dev/neofs-api-go/v2/rpc/grpc" - "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" + netmap "github.com/TrueCloudLab/frostfs-api-go/v2/netmap/grpc" + "github.com/TrueCloudLab/frostfs-api-go/v2/refs" + refsGRPC "github.com/TrueCloudLab/frostfs-api-go/v2/refs/grpc" + "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/grpc" + "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" ) func (f *Filter) ToGRPCMessage() grpc.Message { diff --git a/netmap/grpc/service.go b/netmap/grpc/service.go index c97f8be..ad72ced 100644 --- a/netmap/grpc/service.go +++ b/netmap/grpc/service.go @@ -1,8 +1,8 @@ package netmap import ( - refs "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" - session "github.com/nspcc-dev/neofs-api-go/v2/session/grpc" + refs "github.com/TrueCloudLab/frostfs-api-go/v2/refs/grpc" + session "github.com/TrueCloudLab/frostfs-api-go/v2/session/grpc" ) // SetBody sets body of the request. diff --git a/netmap/grpc/service.pb.go b/netmap/grpc/service.pb.go index f062929..64859ae 100644 --- a/netmap/grpc/service.pb.go +++ b/netmap/grpc/service.pb.go @@ -1,14 +1,14 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.28.0 -// protoc v3.21.6 +// protoc v3.21.9 // source: netmap/grpc/service.proto package netmap import ( - grpc1 "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" - grpc "github.com/nspcc-dev/neofs-api-go/v2/session/grpc" + grpc1 "github.com/TrueCloudLab/frostfs-api-go/v2/refs/grpc" + grpc "github.com/TrueCloudLab/frostfs-api-go/v2/session/grpc" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -854,13 +854,14 @@ var file_netmap_grpc_service_proto_rawDesc = []byte{ 0x6d, 0x61, 0x70, 0x53, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x28, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x53, 0x6e, 0x61, 0x70, - 0x73, 0x68, 0x6f, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x56, 0x5a, 0x37, - 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, - 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, - 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2f, 0x67, 0x72, 0x70, 0x63, - 0x3b, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0xaa, 0x02, 0x1a, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, - 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x4e, 0x65, - 0x74, 0x6d, 0x61, 0x70, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x73, 0x68, 0x6f, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x5b, 0x5a, 0x3c, + 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x54, 0x72, 0x75, 0x65, 0x43, + 0x6c, 0x6f, 0x75, 0x64, 0x4c, 0x61, 0x62, 0x2f, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2d, + 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, + 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0xaa, 0x02, 0x1a, 0x4e, + 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, + 0x50, 0x49, 0x2e, 0x4e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, } var ( diff --git a/netmap/grpc/service_grpc.pb.go b/netmap/grpc/service_grpc.pb.go index 34c6f80..9ac25db 100644 --- a/netmap/grpc/service_grpc.pb.go +++ b/netmap/grpc/service_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.2.0 -// - protoc v3.21.6 +// - protoc v3.21.9 // source: netmap/grpc/service.proto package netmap diff --git a/netmap/grpc/types.go b/netmap/grpc/types.go index c555180..b97a0c8 100644 --- a/netmap/grpc/types.go +++ b/netmap/grpc/types.go @@ -1,6 +1,6 @@ package netmap -import refs "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" +import refs "github.com/TrueCloudLab/frostfs-api-go/v2/refs/grpc" // SetReplicas of placement policy. func (m *PlacementPolicy) SetReplicas(v []*Replica) { diff --git a/netmap/grpc/types.pb.go b/netmap/grpc/types.pb.go index c34f6bb..5d2237b 100644 --- a/netmap/grpc/types.pb.go +++ b/netmap/grpc/types.pb.go @@ -1,13 +1,13 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.28.0 -// protoc v3.21.6 +// protoc v3.21.9 // source: netmap/grpc/types.proto package netmap import ( - grpc "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" + grpc "github.com/TrueCloudLab/frostfs-api-go/v2/refs/grpc" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -939,7 +939,47 @@ func (x *NodeInfo_Attribute) GetParents() []string { return nil } -// Single configuration parameter +// Single configuration parameter. Key MUST be network-unique. +// +// System parameters: +// - **AuditFee** \ +// Fee paid by the storage group owner to the Inner Ring member. +// Value: little-endian integer. Default: 0. +// - **BasicIncomeRate** \ +// Cost of storing one gigabyte of data for a period of one epoch. Paid by +// container owner to container nodes. +// Value: little-endian integer. Default: 0. +// - **ContainerAliasFee** \ +// Fee paid for named container's creation by the container owner. +// Value: little-endian integer. Default: 0. +// - **ContainerFee** \ +// Fee paid for container creation by the container owner. +// Value: little-endian integer. Default: 0. +// - **EigenTrustAlpha** \ +// Alpha parameter of EigenTrust algorithm used in the Reputation system. +// Value: decimal floating-point number in UTF-8 string representation. +// Default: 0. +// - **EigenTrustIterations** \ +// Number of EigenTrust algorithm iterations to pass in the Reputation system. +// Value: little-endian integer. Default: 0. +// - **EpochDuration** \ +// NeoFS epoch duration measured in Sidechain blocks. +// Value: little-endian integer. Default: 0. +// - **HomomorphicHashingDisabled** \ +// Flag of disabling the homomorphic hashing of objects' payload. +// Value: true if any byte != 0. Default: false. +// - **InnerRingCandidateFee** \ +// Fee for entrance to the Inner Ring paid by the candidate. +// Value: little-endian integer. Default: 0. +// - **MaintenanceModeAllowed** \ +// Flag allowing setting the MAINTENANCE state to storage nodes. +// Value: true if any byte != 0. Default: false. +// - **MaxObjectSize** \ +// Maximum size of physically stored NeoFS object measured in bytes. +// Value: little-endian integer. Default: 0. +// - **WithdrawFee** \ +// Fee paid for withdrawal of funds paid by the account owner. +// Value: little-endian integer. Default: 0. type NetworkConfig_Parameter struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -1105,13 +1145,13 @@ var file_netmap_grpc_types_proto_rawDesc = []byte{ 0x73, 0x65, 0x12, 0x16, 0x0a, 0x12, 0x43, 0x4c, 0x41, 0x55, 0x53, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x53, 0x41, 0x4d, 0x45, 0x10, 0x01, 0x12, 0x0c, 0x0a, 0x08, 0x44, 0x49, 0x53, 0x54, 0x49, 0x4e, 0x43, 0x54, - 0x10, 0x02, 0x42, 0x56, 0x5a, 0x37, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, - 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, - 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x6e, 0x65, 0x74, 0x6d, 0x61, - 0x70, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0xaa, 0x02, 0x1a, - 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, - 0x41, 0x50, 0x49, 0x2e, 0x4e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x33, + 0x10, 0x02, 0x42, 0x5b, 0x5a, 0x3c, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, + 0x2f, 0x54, 0x72, 0x75, 0x65, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x4c, 0x61, 0x62, 0x2f, 0x66, 0x72, + 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, + 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x6e, 0x65, 0x74, 0x6d, + 0x61, 0x70, 0xaa, 0x02, 0x1a, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, + 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x4e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/netmap/json.go b/netmap/json.go index 05979ba..aed469c 100644 --- a/netmap/json.go +++ b/netmap/json.go @@ -1,8 +1,8 @@ package netmap import ( - netmap "github.com/nspcc-dev/neofs-api-go/v2/netmap/grpc" - "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" + netmap "github.com/TrueCloudLab/frostfs-api-go/v2/netmap/grpc" + "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" ) func (p *PlacementPolicy) MarshalJSON() ([]byte, error) { diff --git a/netmap/marshal.go b/netmap/marshal.go index fcbf920..d006f92 100644 --- a/netmap/marshal.go +++ b/netmap/marshal.go @@ -1,9 +1,9 @@ package netmap import ( - netmap "github.com/nspcc-dev/neofs-api-go/v2/netmap/grpc" - "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" - protoutil "github.com/nspcc-dev/neofs-api-go/v2/util/proto" + netmap "github.com/TrueCloudLab/frostfs-api-go/v2/netmap/grpc" + "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" + protoutil "github.com/TrueCloudLab/frostfs-api-go/v2/util/proto" ) const ( diff --git a/netmap/message_test.go b/netmap/message_test.go index 92a6027..2ebec3c 100644 --- a/netmap/message_test.go +++ b/netmap/message_test.go @@ -3,9 +3,9 @@ package netmap_test import ( "testing" - netmaptest "github.com/nspcc-dev/neofs-api-go/v2/netmap/test" - "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" - messagetest "github.com/nspcc-dev/neofs-api-go/v2/rpc/message/test" + netmaptest "github.com/TrueCloudLab/frostfs-api-go/v2/netmap/test" + "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" + messagetest "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message/test" ) func TestMessageConvert(t *testing.T) { diff --git a/netmap/string.go b/netmap/string.go index 11ab18c..0c2a491 100644 --- a/netmap/string.go +++ b/netmap/string.go @@ -1,7 +1,7 @@ package netmap import ( - netmap "github.com/nspcc-dev/neofs-api-go/v2/netmap/grpc" + netmap "github.com/TrueCloudLab/frostfs-api-go/v2/netmap/grpc" ) // String returns string representation of Clause. diff --git a/netmap/test/generate.go b/netmap/test/generate.go index 87cdc50..835e7f1 100644 --- a/netmap/test/generate.go +++ b/netmap/test/generate.go @@ -1,9 +1,9 @@ package netmaptest import ( - "github.com/nspcc-dev/neofs-api-go/v2/netmap" - refstest "github.com/nspcc-dev/neofs-api-go/v2/refs/test" - sessiontest "github.com/nspcc-dev/neofs-api-go/v2/session/test" + "github.com/TrueCloudLab/frostfs-api-go/v2/netmap" + refstest "github.com/TrueCloudLab/frostfs-api-go/v2/refs/test" + sessiontest "github.com/TrueCloudLab/frostfs-api-go/v2/session/test" ) func GenerateFilter(empty bool) *netmap.Filter { diff --git a/netmap/types.go b/netmap/types.go index b581d3e..dc76f80 100644 --- a/netmap/types.go +++ b/netmap/types.go @@ -1,8 +1,8 @@ package netmap import ( - "github.com/nspcc-dev/neofs-api-go/v2/refs" - "github.com/nspcc-dev/neofs-api-go/v2/session" + "github.com/TrueCloudLab/frostfs-api-go/v2/refs" + "github.com/TrueCloudLab/frostfs-api-go/v2/session" ) type LocalNodeInfoRequest struct { diff --git a/object/convert.go b/object/convert.go index c4b0868..82eba35 100644 --- a/object/convert.go +++ b/object/convert.go @@ -3,13 +3,13 @@ package object import ( "fmt" - object "github.com/nspcc-dev/neofs-api-go/v2/object/grpc" - "github.com/nspcc-dev/neofs-api-go/v2/refs" - refsGRPC "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" - "github.com/nspcc-dev/neofs-api-go/v2/rpc/grpc" - "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" - "github.com/nspcc-dev/neofs-api-go/v2/session" - sessionGRPC "github.com/nspcc-dev/neofs-api-go/v2/session/grpc" + object "github.com/TrueCloudLab/frostfs-api-go/v2/object/grpc" + "github.com/TrueCloudLab/frostfs-api-go/v2/refs" + refsGRPC "github.com/TrueCloudLab/frostfs-api-go/v2/refs/grpc" + "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/grpc" + "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" + "github.com/TrueCloudLab/frostfs-api-go/v2/session" + sessionGRPC "github.com/TrueCloudLab/frostfs-api-go/v2/session/grpc" ) func TypeToGRPCField(t Type) object.ObjectType { diff --git a/object/grpc/service.go b/object/grpc/service.go index b77208f..d85d44b 100644 --- a/object/grpc/service.go +++ b/object/grpc/service.go @@ -1,8 +1,8 @@ package object import ( - refs "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" - session "github.com/nspcc-dev/neofs-api-go/v2/session/grpc" + refs "github.com/TrueCloudLab/frostfs-api-go/v2/refs/grpc" + session "github.com/TrueCloudLab/frostfs-api-go/v2/session/grpc" ) // SetAddress sets address of the requested object. diff --git a/object/grpc/service.pb.go b/object/grpc/service.pb.go index b0aa9bc..5821b77 100644 --- a/object/grpc/service.pb.go +++ b/object/grpc/service.pb.go @@ -1,14 +1,14 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.28.0 -// protoc v3.21.6 +// protoc v3.21.9 // source: object/grpc/service.proto package object import ( - grpc1 "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" - grpc "github.com/nspcc-dev/neofs-api-go/v2/session/grpc" + grpc1 "github.com/TrueCloudLab/frostfs-api-go/v2/refs/grpc" + grpc "github.com/TrueCloudLab/frostfs-api-go/v2/session/grpc" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -2751,13 +2751,13 @@ var file_object_grpc_service_proto_rawDesc = []byte{ 0x61, 0x6e, 0x67, 0x65, 0x48, 0x61, 0x73, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x26, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x48, 0x61, 0x73, 0x68, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x56, 0x5a, 0x37, 0x67, 0x69, 0x74, 0x68, 0x75, - 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, - 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, - 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x6f, 0x62, 0x6a, 0x65, - 0x63, 0x74, 0xaa, 0x02, 0x1a, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, - 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x5b, 0x5a, 0x3c, 0x67, 0x69, 0x74, 0x68, 0x75, + 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x54, 0x72, 0x75, 0x65, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x4c, + 0x61, 0x62, 0x2f, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, + 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2f, 0x67, 0x72, 0x70, 0x63, + 0x3b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0xaa, 0x02, 0x1a, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, + 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x4f, 0x62, + 0x6a, 0x65, 0x63, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/object/grpc/service_grpc.pb.go b/object/grpc/service_grpc.pb.go index 6371473..8864e00 100644 --- a/object/grpc/service_grpc.pb.go +++ b/object/grpc/service_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.2.0 -// - protoc v3.21.6 +// - protoc v3.21.9 // source: object/grpc/service.proto package object diff --git a/object/grpc/status.pb.go b/object/grpc/status.pb.go index 08d06d1..17ad8de 100644 --- a/object/grpc/status.pb.go +++ b/object/grpc/status.pb.go @@ -7,11 +7,12 @@ package object import ( - grpc "github.com/nspcc-dev/neofs-api-go/v2/status/grpc" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" sync "sync" + + grpc "github.com/TrueCloudLab/frostfs-api-go/v2/status/grpc" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" ) const ( diff --git a/object/grpc/types.go b/object/grpc/types.go index 10e063a..9801037 100644 --- a/object/grpc/types.go +++ b/object/grpc/types.go @@ -1,8 +1,8 @@ package object import ( - refs "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" - session "github.com/nspcc-dev/neofs-api-go/v2/session/grpc" + refs "github.com/TrueCloudLab/frostfs-api-go/v2/refs/grpc" + session "github.com/TrueCloudLab/frostfs-api-go/v2/session/grpc" ) // SetKey sets key to the object attribute. diff --git a/object/grpc/types.pb.go b/object/grpc/types.pb.go index 4809930..19a888b 100644 --- a/object/grpc/types.pb.go +++ b/object/grpc/types.pb.go @@ -1,14 +1,14 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.28.0 -// protoc v3.21.6 +// protoc v3.21.9 // source: object/grpc/types.proto package object import ( - grpc "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" - grpc1 "github.com/nspcc-dev/neofs-api-go/v2/session/grpc" + grpc "github.com/TrueCloudLab/frostfs-api-go/v2/refs/grpc" + grpc1 "github.com/TrueCloudLab/frostfs-api-go/v2/session/grpc" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -877,13 +877,13 @@ var file_object_grpc_types_proto_rawDesc = []byte{ 0x47, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x45, 0x51, 0x55, 0x41, 0x4c, 0x10, 0x02, 0x12, 0x0f, 0x0a, 0x0b, 0x4e, 0x4f, 0x54, 0x5f, 0x50, 0x52, 0x45, 0x53, 0x45, 0x4e, 0x54, 0x10, 0x03, 0x12, 0x11, 0x0a, 0x0d, 0x43, 0x4f, 0x4d, 0x4d, 0x4f, 0x4e, 0x5f, 0x50, 0x52, 0x45, 0x46, 0x49, 0x58, 0x10, - 0x04, 0x42, 0x56, 0x5a, 0x37, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, - 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, - 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, - 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0xaa, 0x02, 0x1a, 0x4e, - 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, - 0x50, 0x49, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x33, + 0x04, 0x42, 0x5b, 0x5a, 0x3c, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, + 0x54, 0x72, 0x75, 0x65, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x4c, 0x61, 0x62, 0x2f, 0x66, 0x72, 0x6f, + 0x73, 0x74, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x6f, + 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x6f, 0x62, 0x6a, 0x65, 0x63, + 0x74, 0xaa, 0x02, 0x1a, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, + 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/object/json.go b/object/json.go index 1555005..6999cc9 100644 --- a/object/json.go +++ b/object/json.go @@ -1,8 +1,8 @@ package object import ( - object "github.com/nspcc-dev/neofs-api-go/v2/object/grpc" - "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" + object "github.com/TrueCloudLab/frostfs-api-go/v2/object/grpc" + "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" ) func (h *ShortHeader) MarshalJSON() ([]byte, error) { diff --git a/object/lock.go b/object/lock.go index 44597eb..e9704a8 100644 --- a/object/lock.go +++ b/object/lock.go @@ -4,12 +4,12 @@ import ( "errors" "fmt" - lock "github.com/nspcc-dev/neofs-api-go/v2/lock/grpc" - "github.com/nspcc-dev/neofs-api-go/v2/refs" - refsGRPC "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" - "github.com/nspcc-dev/neofs-api-go/v2/rpc/grpc" - "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" - "github.com/nspcc-dev/neofs-api-go/v2/util/proto" + lock "github.com/TrueCloudLab/frostfs-api-go/v2/lock/grpc" + "github.com/TrueCloudLab/frostfs-api-go/v2/refs" + refsGRPC "github.com/TrueCloudLab/frostfs-api-go/v2/refs/grpc" + "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/grpc" + "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" + "github.com/TrueCloudLab/frostfs-api-go/v2/util/proto" ) // Lock represents object Lock message from NeoFS API V2 protocol. diff --git a/object/lock_test.go b/object/lock_test.go index 17e9e46..90c7e7f 100644 --- a/object/lock_test.go +++ b/object/lock_test.go @@ -3,8 +3,8 @@ package object_test import ( "testing" - "github.com/nspcc-dev/neofs-api-go/v2/object" - objecttest "github.com/nspcc-dev/neofs-api-go/v2/object/test" + "github.com/TrueCloudLab/frostfs-api-go/v2/object" + objecttest "github.com/TrueCloudLab/frostfs-api-go/v2/object/test" "github.com/stretchr/testify/require" ) diff --git a/object/marshal.go b/object/marshal.go index 03ba265..e286578 100644 --- a/object/marshal.go +++ b/object/marshal.go @@ -1,10 +1,10 @@ package object import ( - object "github.com/nspcc-dev/neofs-api-go/v2/object/grpc" - "github.com/nspcc-dev/neofs-api-go/v2/refs" - "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" - "github.com/nspcc-dev/neofs-api-go/v2/util/proto" + object "github.com/TrueCloudLab/frostfs-api-go/v2/object/grpc" + "github.com/TrueCloudLab/frostfs-api-go/v2/refs" + "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" + "github.com/TrueCloudLab/frostfs-api-go/v2/util/proto" ) const ( diff --git a/object/message_test.go b/object/message_test.go index 98461df..94b1c1d 100644 --- a/object/message_test.go +++ b/object/message_test.go @@ -3,9 +3,9 @@ package object_test import ( "testing" - objecttest "github.com/nspcc-dev/neofs-api-go/v2/object/test" - "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" - messagetest "github.com/nspcc-dev/neofs-api-go/v2/rpc/message/test" + objecttest "github.com/TrueCloudLab/frostfs-api-go/v2/object/test" + "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" + messagetest "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message/test" ) func TestMessageConvert(t *testing.T) { diff --git a/object/status.go b/object/status.go index e1e96c8..bbdeb3f 100644 --- a/object/status.go +++ b/object/status.go @@ -1,8 +1,8 @@ package object import ( - "github.com/nspcc-dev/neofs-api-go/v2/status" - statusgrpc "github.com/nspcc-dev/neofs-api-go/v2/status/grpc" + "github.com/TrueCloudLab/frostfs-api-go/v2/status" + statusgrpc "github.com/TrueCloudLab/frostfs-api-go/v2/status/grpc" ) // LocalizeFailStatus checks if passed global status.Code is related to object failure and: diff --git a/object/status_test.go b/object/status_test.go index a330a9f..af7dcf9 100644 --- a/object/status_test.go +++ b/object/status_test.go @@ -3,9 +3,9 @@ package object_test import ( "testing" - "github.com/nspcc-dev/neofs-api-go/v2/object" - "github.com/nspcc-dev/neofs-api-go/v2/status" - statustest "github.com/nspcc-dev/neofs-api-go/v2/status/test" + "github.com/TrueCloudLab/frostfs-api-go/v2/object" + "github.com/TrueCloudLab/frostfs-api-go/v2/status" + statustest "github.com/TrueCloudLab/frostfs-api-go/v2/status/test" "github.com/stretchr/testify/require" ) diff --git a/object/string.go b/object/string.go index 3191e31..ef22f8b 100644 --- a/object/string.go +++ b/object/string.go @@ -1,7 +1,7 @@ package object import ( - object "github.com/nspcc-dev/neofs-api-go/v2/object/grpc" + object "github.com/TrueCloudLab/frostfs-api-go/v2/object/grpc" ) // String returns string representation of Type. diff --git a/object/test/generate.go b/object/test/generate.go index 0c6ffab..1c74576 100644 --- a/object/test/generate.go +++ b/object/test/generate.go @@ -1,11 +1,11 @@ package objecttest import ( - "github.com/nspcc-dev/neofs-api-go/v2/internal/random" - "github.com/nspcc-dev/neofs-api-go/v2/object" - "github.com/nspcc-dev/neofs-api-go/v2/refs" - refstest "github.com/nspcc-dev/neofs-api-go/v2/refs/test" - sessiontest "github.com/nspcc-dev/neofs-api-go/v2/session/test" + "github.com/TrueCloudLab/frostfs-api-go/v2/internal/random" + "github.com/TrueCloudLab/frostfs-api-go/v2/object" + "github.com/TrueCloudLab/frostfs-api-go/v2/refs" + refstest "github.com/TrueCloudLab/frostfs-api-go/v2/refs/test" + sessiontest "github.com/TrueCloudLab/frostfs-api-go/v2/session/test" ) func GenerateShortHeader(empty bool) *object.ShortHeader { diff --git a/object/types.go b/object/types.go index 15477c1..33eb48e 100644 --- a/object/types.go +++ b/object/types.go @@ -1,8 +1,8 @@ package object import ( - "github.com/nspcc-dev/neofs-api-go/v2/refs" - "github.com/nspcc-dev/neofs-api-go/v2/session" + "github.com/TrueCloudLab/frostfs-api-go/v2/refs" + "github.com/TrueCloudLab/frostfs-api-go/v2/session" ) type Type uint32 diff --git a/refs/convert.go b/refs/convert.go index e402f50..dade588 100644 --- a/refs/convert.go +++ b/refs/convert.go @@ -1,9 +1,9 @@ package refs import ( - refs "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" - "github.com/nspcc-dev/neofs-api-go/v2/rpc/grpc" - "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" + refs "github.com/TrueCloudLab/frostfs-api-go/v2/refs/grpc" + "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/grpc" + "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" ) func (o *OwnerID) ToGRPCMessage() grpc.Message { diff --git a/refs/grpc/types.pb.go b/refs/grpc/types.pb.go index 2879803..7fcf89d 100644 --- a/refs/grpc/types.pb.go +++ b/refs/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.28.0 -// protoc v3.21.6 +// protoc v3.21.9 // source: refs/grpc/types.proto package refs @@ -733,12 +733,13 @@ var file_refs_grpc_types_proto_rawDesc = []byte{ 0x79, 0x70, 0x65, 0x12, 0x1d, 0x0a, 0x19, 0x43, 0x48, 0x45, 0x43, 0x4b, 0x53, 0x55, 0x4d, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x06, 0x0a, 0x02, 0x54, 0x5a, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x53, 0x48, - 0x41, 0x32, 0x35, 0x36, 0x10, 0x02, 0x42, 0x50, 0x5a, 0x33, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, - 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, - 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x72, - 0x65, 0x66, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x72, 0x65, 0x66, 0x73, 0xaa, 0x02, 0x18, - 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, - 0x41, 0x50, 0x49, 0x2e, 0x52, 0x65, 0x66, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x41, 0x32, 0x35, 0x36, 0x10, 0x02, 0x42, 0x55, 0x5a, 0x38, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, + 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x54, 0x72, 0x75, 0x65, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x4c, 0x61, + 0x62, 0x2f, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, + 0x2f, 0x76, 0x32, 0x2f, 0x72, 0x65, 0x66, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x72, 0x65, + 0x66, 0x73, 0xaa, 0x02, 0x18, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, + 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x52, 0x65, 0x66, 0x73, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/refs/json.go b/refs/json.go index 5a48cdb..44198ae 100644 --- a/refs/json.go +++ b/refs/json.go @@ -1,8 +1,8 @@ package refs import ( - refs "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" - "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" + refs "github.com/TrueCloudLab/frostfs-api-go/v2/refs/grpc" + "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" ) func (a *Address) MarshalJSON() ([]byte, error) { diff --git a/refs/marshal.go b/refs/marshal.go index ef85324..50c3501 100644 --- a/refs/marshal.go +++ b/refs/marshal.go @@ -3,9 +3,9 @@ package refs import ( "encoding/binary" - refs "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" - "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" - "github.com/nspcc-dev/neofs-api-go/v2/util/proto" + refs "github.com/TrueCloudLab/frostfs-api-go/v2/refs/grpc" + "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" + "github.com/TrueCloudLab/frostfs-api-go/v2/util/proto" ) const ( diff --git a/refs/message_test.go b/refs/message_test.go index f54b2b5..8d8a69d 100644 --- a/refs/message_test.go +++ b/refs/message_test.go @@ -3,9 +3,9 @@ package refs_test import ( "testing" - refstest "github.com/nspcc-dev/neofs-api-go/v2/refs/test" - "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" - messagetest "github.com/nspcc-dev/neofs-api-go/v2/rpc/message/test" + refstest "github.com/TrueCloudLab/frostfs-api-go/v2/refs/test" + "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" + messagetest "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message/test" ) func TestMessageConvert(t *testing.T) { diff --git a/refs/string.go b/refs/string.go index 1b98600..2dac54a 100644 --- a/refs/string.go +++ b/refs/string.go @@ -1,7 +1,7 @@ package refs import ( - refs "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" + refs "github.com/TrueCloudLab/frostfs-api-go/v2/refs/grpc" ) // String returns string representation of ChecksumType. diff --git a/refs/test/generate.go b/refs/test/generate.go index 13aefbd..b11b1a0 100644 --- a/refs/test/generate.go +++ b/refs/test/generate.go @@ -3,7 +3,7 @@ package refstest import ( "math/rand" - "github.com/nspcc-dev/neofs-api-go/v2/refs" + "github.com/TrueCloudLab/frostfs-api-go/v2/refs" ) func GenerateVersion(empty bool) *refs.Version { diff --git a/refs/types_test.go b/refs/types_test.go index e2077b2..11ad628 100644 --- a/refs/types_test.go +++ b/refs/types_test.go @@ -5,7 +5,7 @@ import ( "strconv" "testing" - "github.com/nspcc-dev/neofs-api-go/v2/refs" + "github.com/TrueCloudLab/frostfs-api-go/v2/refs" "github.com/stretchr/testify/require" ) diff --git a/reputation/convert.go b/reputation/convert.go index 924b1ed..25e887d 100644 --- a/reputation/convert.go +++ b/reputation/convert.go @@ -1,11 +1,11 @@ package reputation import ( - "github.com/nspcc-dev/neofs-api-go/v2/refs" - refsGRPC "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" - reputation "github.com/nspcc-dev/neofs-api-go/v2/reputation/grpc" - "github.com/nspcc-dev/neofs-api-go/v2/rpc/grpc" - "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" + "github.com/TrueCloudLab/frostfs-api-go/v2/refs" + refsGRPC "github.com/TrueCloudLab/frostfs-api-go/v2/refs/grpc" + reputation "github.com/TrueCloudLab/frostfs-api-go/v2/reputation/grpc" + "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/grpc" + "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" ) // ToGRPCMessage converts PeerID to gRPC-generated diff --git a/reputation/grpc/service.go b/reputation/grpc/service.go index 519c2df..b737d6d 100644 --- a/reputation/grpc/service.go +++ b/reputation/grpc/service.go @@ -1,7 +1,7 @@ package reputation import ( - session "github.com/nspcc-dev/neofs-api-go/v2/session/grpc" + session "github.com/TrueCloudLab/frostfs-api-go/v2/session/grpc" ) // SetEpoch sets epoch in which the trust was assessed. diff --git a/reputation/grpc/service.pb.go b/reputation/grpc/service.pb.go index c5c3a2d..2abb8d7 100644 --- a/reputation/grpc/service.pb.go +++ b/reputation/grpc/service.pb.go @@ -1,13 +1,13 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.28.0 -// protoc v3.21.6 +// protoc v3.21.9 // source: reputation/grpc/service.proto package reputation import ( - grpc "github.com/nspcc-dev/neofs-api-go/v2/session/grpc" + grpc "github.com/TrueCloudLab/frostfs-api-go/v2/session/grpc" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -618,14 +618,14 @@ var file_reputation_grpc_service_proto_rawDesc = []byte{ 0x38, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, - 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x62, 0x5a, 0x3f, 0x67, 0x69, 0x74, - 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, - 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, - 0x32, 0x2f, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x67, 0x72, 0x70, - 0x63, 0x3b, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xaa, 0x02, 0x1e, 0x4e, - 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, - 0x50, 0x49, 0x2e, 0x52, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x62, 0x06, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x67, 0x5a, 0x44, 0x67, 0x69, 0x74, + 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x54, 0x72, 0x75, 0x65, 0x43, 0x6c, 0x6f, 0x75, + 0x64, 0x4c, 0x61, 0x62, 0x2f, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, + 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0xaa, 0x02, 0x1e, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, + 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x52, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/reputation/grpc/service_grpc.pb.go b/reputation/grpc/service_grpc.pb.go index 29de655..582a8cd 100644 --- a/reputation/grpc/service_grpc.pb.go +++ b/reputation/grpc/service_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.2.0 -// - protoc v3.21.6 +// - protoc v3.21.9 // source: reputation/grpc/service.proto package reputation diff --git a/reputation/grpc/types.go b/reputation/grpc/types.go index 14848d3..01766f8 100644 --- a/reputation/grpc/types.go +++ b/reputation/grpc/types.go @@ -1,7 +1,7 @@ package reputation import ( - refs "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" + refs "github.com/TrueCloudLab/frostfs-api-go/v2/refs/grpc" ) // SetPublicKey sets binary public key of ID. diff --git a/reputation/grpc/types.pb.go b/reputation/grpc/types.pb.go index 873eab5..9699284 100644 --- a/reputation/grpc/types.pb.go +++ b/reputation/grpc/types.pb.go @@ -1,13 +1,13 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.28.0 -// protoc v3.21.6 +// protoc v3.21.9 // source: reputation/grpc/types.proto package reputation import ( - grpc "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" + grpc "github.com/TrueCloudLab/frostfs-api-go/v2/refs/grpc" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -364,14 +364,14 @@ var file_reputation_grpc_types_proto_rawDesc = []byte{ 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x12, 0x31, 0x0a, 0x05, 0x74, 0x72, 0x75, 0x73, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x54, 0x72, 0x75, - 0x73, 0x74, 0x52, 0x05, 0x74, 0x72, 0x75, 0x73, 0x74, 0x42, 0x62, 0x5a, 0x3f, 0x67, 0x69, 0x74, - 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, - 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, - 0x32, 0x2f, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x67, 0x72, 0x70, - 0x63, 0x3b, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xaa, 0x02, 0x1e, 0x4e, - 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, - 0x50, 0x49, 0x2e, 0x52, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x62, 0x06, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x73, 0x74, 0x52, 0x05, 0x74, 0x72, 0x75, 0x73, 0x74, 0x42, 0x67, 0x5a, 0x44, 0x67, 0x69, 0x74, + 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x54, 0x72, 0x75, 0x65, 0x43, 0x6c, 0x6f, 0x75, + 0x64, 0x4c, 0x61, 0x62, 0x2f, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, + 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0xaa, 0x02, 0x1e, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, + 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x52, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/reputation/json.go b/reputation/json.go index 17f559f..d1b4d4d 100644 --- a/reputation/json.go +++ b/reputation/json.go @@ -1,8 +1,8 @@ package reputation import ( - reputation "github.com/nspcc-dev/neofs-api-go/v2/reputation/grpc" - "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" + reputation "github.com/TrueCloudLab/frostfs-api-go/v2/reputation/grpc" + "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" ) func (x *PeerID) MarshalJSON() ([]byte, error) { diff --git a/reputation/marshal.go b/reputation/marshal.go index 83b9a5a..138e0e8 100644 --- a/reputation/marshal.go +++ b/reputation/marshal.go @@ -1,9 +1,9 @@ package reputation import ( - reputation "github.com/nspcc-dev/neofs-api-go/v2/reputation/grpc" - "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" - protoutil "github.com/nspcc-dev/neofs-api-go/v2/util/proto" + reputation "github.com/TrueCloudLab/frostfs-api-go/v2/reputation/grpc" + "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" + protoutil "github.com/TrueCloudLab/frostfs-api-go/v2/util/proto" ) const ( diff --git a/reputation/message_test.go b/reputation/message_test.go index 0f948c9..8f308b0 100644 --- a/reputation/message_test.go +++ b/reputation/message_test.go @@ -3,9 +3,9 @@ package reputation_test import ( "testing" - reputationtest "github.com/nspcc-dev/neofs-api-go/v2/reputation/test" - "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" - messagetest "github.com/nspcc-dev/neofs-api-go/v2/rpc/message/test" + reputationtest "github.com/TrueCloudLab/frostfs-api-go/v2/reputation/test" + "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" + messagetest "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message/test" ) func TestMessageConvert(t *testing.T) { diff --git a/reputation/test/generate.go b/reputation/test/generate.go index 00e6009..09d61d2 100644 --- a/reputation/test/generate.go +++ b/reputation/test/generate.go @@ -1,9 +1,9 @@ package reputationtest import ( - refstest "github.com/nspcc-dev/neofs-api-go/v2/refs/test" - "github.com/nspcc-dev/neofs-api-go/v2/reputation" - sessiontest "github.com/nspcc-dev/neofs-api-go/v2/session/test" + refstest "github.com/TrueCloudLab/frostfs-api-go/v2/refs/test" + "github.com/TrueCloudLab/frostfs-api-go/v2/reputation" + sessiontest "github.com/TrueCloudLab/frostfs-api-go/v2/session/test" ) func GeneratePeerID(empty bool) *reputation.PeerID { diff --git a/reputation/types.go b/reputation/types.go index f058efc..3876f1a 100644 --- a/reputation/types.go +++ b/reputation/types.go @@ -1,8 +1,8 @@ package reputation import ( - "github.com/nspcc-dev/neofs-api-go/v2/refs" - "github.com/nspcc-dev/neofs-api-go/v2/session" + "github.com/TrueCloudLab/frostfs-api-go/v2/refs" + "github.com/TrueCloudLab/frostfs-api-go/v2/session" ) // PeerID represents reputation.PeerID message diff --git a/rpc/accounting.go b/rpc/accounting.go index 0c0bd7b..21c7a7f 100644 --- a/rpc/accounting.go +++ b/rpc/accounting.go @@ -1,9 +1,9 @@ package rpc import ( - "github.com/nspcc-dev/neofs-api-go/v2/accounting" - "github.com/nspcc-dev/neofs-api-go/v2/rpc/client" - "github.com/nspcc-dev/neofs-api-go/v2/rpc/common" + "github.com/TrueCloudLab/frostfs-api-go/v2/accounting" + "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/client" + "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/common" ) const serviceAccounting = serviceNamePrefix + "accounting.AccountingService" diff --git a/rpc/client/client.go b/rpc/client/client.go index 16b3496..40b5d1a 100644 --- a/rpc/client/client.go +++ b/rpc/client/client.go @@ -3,7 +3,7 @@ package client import ( "sync" - "github.com/nspcc-dev/neofs-api-go/v2/rpc/grpc" + "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/grpc" ) // Client represents client for exchanging messages diff --git a/rpc/client/connect.go b/rpc/client/connect.go index cdbbbea..2fe77d5 100644 --- a/rpc/client/connect.go +++ b/rpc/client/connect.go @@ -7,7 +7,7 @@ import ( "net" "net/url" - "github.com/nspcc-dev/neofs-api-go/v2/rpc/grpc" + "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/grpc" grpcstd "google.golang.org/grpc" "google.golang.org/grpc/credentials" "google.golang.org/grpc/credentials/insecure" diff --git a/rpc/client/flows.go b/rpc/client/flows.go index 4f4a04a..e741ca3 100644 --- a/rpc/client/flows.go +++ b/rpc/client/flows.go @@ -5,8 +5,8 @@ import ( "io" "sync" - "github.com/nspcc-dev/neofs-api-go/v2/rpc/common" - "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" + "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/common" + "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" ) // SendUnary initializes communication session by RPC info, performs unary RPC diff --git a/rpc/client/init.go b/rpc/client/init.go index bad7ed0..b45871b 100644 --- a/rpc/client/init.go +++ b/rpc/client/init.go @@ -3,9 +3,9 @@ package client import ( "io" - "github.com/nspcc-dev/neofs-api-go/v2/rpc/common" - "github.com/nspcc-dev/neofs-api-go/v2/rpc/grpc" - "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" + "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/common" + "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/grpc" + "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" ) // MessageReader is an interface of the Message reader. diff --git a/rpc/client/options_test.go b/rpc/client/options_test.go index eeb5a13..56704b6 100644 --- a/rpc/client/options_test.go +++ b/rpc/client/options_test.go @@ -8,7 +8,7 @@ import ( ) func TestWithNetworkURIAddress(t *testing.T) { - hostPort := "neofs.example.com:8080" + hostPort := "frostfs.example.com:8080" apiPort := "127.0.0.1:8080" serverName := "testServer" @@ -22,25 +22,25 @@ func TestWithNetworkURIAddress(t *testing.T) { { uri: grpcScheme + "://" + hostPort, tlsConfig: nil, - wantHost: "neofs.example.com:8080", + wantHost: "frostfs.example.com:8080", wantTLS: false, }, { uri: grpcScheme + "://" + hostPort, tlsConfig: &tls.Config{}, - wantHost: "neofs.example.com:8080", + wantHost: "frostfs.example.com:8080", wantTLS: false, }, { uri: grpcTLSScheme + "://" + hostPort, tlsConfig: nil, - wantHost: "neofs.example.com:8080", + wantHost: "frostfs.example.com:8080", wantTLS: true, }, { uri: grpcTLSScheme + "://" + hostPort, tlsConfig: &tls.Config{ServerName: serverName}, - wantHost: "neofs.example.com:8080", + wantHost: "frostfs.example.com:8080", wantTLS: true, }, { diff --git a/rpc/common/call_test.go b/rpc/common/call_test.go index aa4898f..f3acd08 100644 --- a/rpc/common/call_test.go +++ b/rpc/common/call_test.go @@ -3,7 +3,7 @@ package common_test import ( "testing" - "github.com/nspcc-dev/neofs-api-go/v2/rpc/common" + "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/common" "github.com/stretchr/testify/require" ) diff --git a/rpc/container.go b/rpc/container.go index 219e919..a33afe1 100644 --- a/rpc/container.go +++ b/rpc/container.go @@ -1,9 +1,9 @@ package rpc import ( - "github.com/nspcc-dev/neofs-api-go/v2/container" - "github.com/nspcc-dev/neofs-api-go/v2/rpc/client" - "github.com/nspcc-dev/neofs-api-go/v2/rpc/common" + "github.com/TrueCloudLab/frostfs-api-go/v2/container" + "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/client" + "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/common" ) const serviceContainer = serviceNamePrefix + "container.ContainerService" diff --git a/rpc/grpc/init.go b/rpc/grpc/init.go index 31a2ba7..bc9aa9c 100644 --- a/rpc/grpc/init.go +++ b/rpc/grpc/init.go @@ -5,7 +5,7 @@ import ( "io" "time" - "github.com/nspcc-dev/neofs-api-go/v2/rpc/common" + "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/common" "google.golang.org/grpc" ) diff --git a/rpc/grpc/util.go b/rpc/grpc/util.go index c7c65e2..220c656 100644 --- a/rpc/grpc/util.go +++ b/rpc/grpc/util.go @@ -3,7 +3,7 @@ package grpc import ( "fmt" - "github.com/nspcc-dev/neofs-api-go/v2/rpc/common" + "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/common" ) const methodNameFmt = "/%s/%s" diff --git a/rpc/message/encoding.go b/rpc/message/encoding.go index 4a53b68..b28cde3 100644 --- a/rpc/message/encoding.go +++ b/rpc/message/encoding.go @@ -1,7 +1,7 @@ package message import ( - "github.com/nspcc-dev/neofs-api-go/v2/rpc/grpc" + "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/grpc" "google.golang.org/protobuf/encoding/protojson" "google.golang.org/protobuf/proto" ) diff --git a/rpc/message/message.go b/rpc/message/message.go index 576559d..4f6acaf 100644 --- a/rpc/message/message.go +++ b/rpc/message/message.go @@ -3,7 +3,7 @@ package message import ( "fmt" - "github.com/nspcc-dev/neofs-api-go/v2/rpc/grpc" + "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/grpc" ) // Message represents raw Protobuf message diff --git a/rpc/message/test/message.go b/rpc/message/test/message.go index 7c4450f..138b758 100644 --- a/rpc/message/test/message.go +++ b/rpc/message/test/message.go @@ -6,7 +6,7 @@ import ( "fmt" "testing" - "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" + "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" "github.com/stretchr/testify/require" ) diff --git a/rpc/netmap.go b/rpc/netmap.go index f67743c..bfe2ef4 100644 --- a/rpc/netmap.go +++ b/rpc/netmap.go @@ -1,9 +1,9 @@ package rpc import ( - "github.com/nspcc-dev/neofs-api-go/v2/netmap" - "github.com/nspcc-dev/neofs-api-go/v2/rpc/client" - "github.com/nspcc-dev/neofs-api-go/v2/rpc/common" + "github.com/TrueCloudLab/frostfs-api-go/v2/netmap" + "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/client" + "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/common" ) const serviceNetmap = serviceNamePrefix + "netmap.NetmapService" diff --git a/rpc/object.go b/rpc/object.go index 58faa9f..b2d0c95 100644 --- a/rpc/object.go +++ b/rpc/object.go @@ -1,10 +1,10 @@ package rpc import ( - "github.com/nspcc-dev/neofs-api-go/v2/object" - "github.com/nspcc-dev/neofs-api-go/v2/rpc/client" - "github.com/nspcc-dev/neofs-api-go/v2/rpc/common" - "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" + "github.com/TrueCloudLab/frostfs-api-go/v2/object" + "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/client" + "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/common" + "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" ) const serviceObject = serviceNamePrefix + "object.ObjectService" diff --git a/rpc/reputation.go b/rpc/reputation.go index 9332f10..413868d 100644 --- a/rpc/reputation.go +++ b/rpc/reputation.go @@ -1,9 +1,9 @@ package rpc import ( - "github.com/nspcc-dev/neofs-api-go/v2/reputation" - "github.com/nspcc-dev/neofs-api-go/v2/rpc/client" - "github.com/nspcc-dev/neofs-api-go/v2/rpc/common" + "github.com/TrueCloudLab/frostfs-api-go/v2/reputation" + "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/client" + "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/common" ) const serviceReputation = serviceNamePrefix + "reputation.ReputationService" diff --git a/rpc/session.go b/rpc/session.go index cdd43c2..f180780 100644 --- a/rpc/session.go +++ b/rpc/session.go @@ -1,9 +1,9 @@ package rpc import ( - "github.com/nspcc-dev/neofs-api-go/v2/rpc/client" - "github.com/nspcc-dev/neofs-api-go/v2/rpc/common" - "github.com/nspcc-dev/neofs-api-go/v2/session" + "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/client" + "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/common" + "github.com/TrueCloudLab/frostfs-api-go/v2/session" ) const serviceSession = serviceNamePrefix + "session.SessionService" diff --git a/session/convert.go b/session/convert.go index b9a93e6..a6bc6d6 100644 --- a/session/convert.go +++ b/session/convert.go @@ -3,15 +3,15 @@ package session import ( "fmt" - "github.com/nspcc-dev/neofs-api-go/v2/acl" - aclGRPC "github.com/nspcc-dev/neofs-api-go/v2/acl/grpc" - "github.com/nspcc-dev/neofs-api-go/v2/refs" - refsGRPC "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" - "github.com/nspcc-dev/neofs-api-go/v2/rpc/grpc" - "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" - session "github.com/nspcc-dev/neofs-api-go/v2/session/grpc" - "github.com/nspcc-dev/neofs-api-go/v2/status" - statusGRPC "github.com/nspcc-dev/neofs-api-go/v2/status/grpc" + "github.com/TrueCloudLab/frostfs-api-go/v2/acl" + aclGRPC "github.com/TrueCloudLab/frostfs-api-go/v2/acl/grpc" + "github.com/TrueCloudLab/frostfs-api-go/v2/refs" + refsGRPC "github.com/TrueCloudLab/frostfs-api-go/v2/refs/grpc" + "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/grpc" + "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" + session "github.com/TrueCloudLab/frostfs-api-go/v2/session/grpc" + "github.com/TrueCloudLab/frostfs-api-go/v2/status" + statusGRPC "github.com/TrueCloudLab/frostfs-api-go/v2/status/grpc" ) func (c *CreateRequestBody) ToGRPCMessage() grpc.Message { diff --git a/session/grpc/service.go b/session/grpc/service.go index 14348e4..a9e5282 100644 --- a/session/grpc/service.go +++ b/session/grpc/service.go @@ -1,7 +1,7 @@ package session import ( - refs "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" + refs "github.com/TrueCloudLab/frostfs-api-go/v2/refs/grpc" ) // SetOwnerId sets identifier of the session initiator. diff --git a/session/grpc/service.pb.go b/session/grpc/service.pb.go index 0c90cb6..5bf1677 100644 --- a/session/grpc/service.pb.go +++ b/session/grpc/service.pb.go @@ -1,13 +1,13 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.28.0 -// protoc v3.21.6 +// protoc v3.21.9 // source: session/grpc/service.proto package session import ( - grpc "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" + grpc "github.com/TrueCloudLab/frostfs-api-go/v2/refs/grpc" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -330,13 +330,13 @@ var file_session_grpc_service_proto_rawDesc = []byte{ 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, 0x59, 0x5a, 0x39, 0x67, 0x69, 0x74, 0x68, - 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, - 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, - 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, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x5e, 0x5a, 0x3e, 0x67, 0x69, 0x74, 0x68, + 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x54, 0x72, 0x75, 0x65, 0x43, 0x6c, 0x6f, 0x75, 0x64, + 0x4c, 0x61, 0x62, 0x2f, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, + 0x67, 0x6f, 0x2f, 0x76, 0x32, 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, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/session/grpc/service_grpc.pb.go b/session/grpc/service_grpc.pb.go index ebda887..a056280 100644 --- a/session/grpc/service_grpc.pb.go +++ b/session/grpc/service_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.2.0 -// - protoc v3.21.6 +// - protoc v3.21.9 // source: session/grpc/service.proto package session diff --git a/session/grpc/types.go b/session/grpc/types.go index 7cdb7d5..e3ee8d6 100644 --- a/session/grpc/types.go +++ b/session/grpc/types.go @@ -1,9 +1,9 @@ package session import ( - acl "github.com/nspcc-dev/neofs-api-go/v2/acl/grpc" - refs "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" - status "github.com/nspcc-dev/neofs-api-go/v2/status/grpc" + acl "github.com/TrueCloudLab/frostfs-api-go/v2/acl/grpc" + refs "github.com/TrueCloudLab/frostfs-api-go/v2/refs/grpc" + status "github.com/TrueCloudLab/frostfs-api-go/v2/status/grpc" ) // SetKey sets key to the X-Header. diff --git a/session/grpc/types.pb.go b/session/grpc/types.pb.go index c964738..b96f954 100644 --- a/session/grpc/types.pb.go +++ b/session/grpc/types.pb.go @@ -1,15 +1,15 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.28.0 -// protoc v3.21.6 +// protoc v3.21.9 // source: session/grpc/types.proto package session import ( - grpc1 "github.com/nspcc-dev/neofs-api-go/v2/acl/grpc" - grpc "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" - grpc2 "github.com/nspcc-dev/neofs-api-go/v2/status/grpc" + grpc1 "github.com/TrueCloudLab/frostfs-api-go/v2/acl/grpc" + grpc "github.com/TrueCloudLab/frostfs-api-go/v2/refs/grpc" + grpc2 "github.com/TrueCloudLab/frostfs-api-go/v2/status/grpc" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -1196,13 +1196,13 @@ var file_session_grpc_types_proto_rawDesc = []byte{ 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, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x42, 0x59, 0x5a, 0x39, 0x67, 0x69, 0x74, 0x68, - 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, - 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, - 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, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x52, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x42, 0x5e, 0x5a, 0x3e, 0x67, 0x69, 0x74, 0x68, + 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x54, 0x72, 0x75, 0x65, 0x43, 0x6c, 0x6f, 0x75, 0x64, + 0x4c, 0x61, 0x62, 0x2f, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, + 0x67, 0x6f, 0x2f, 0x76, 0x32, 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, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/session/json.go b/session/json.go index b423567..d44325f 100644 --- a/session/json.go +++ b/session/json.go @@ -1,8 +1,8 @@ package session import ( - "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" - session "github.com/nspcc-dev/neofs-api-go/v2/session/grpc" + "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" + session "github.com/TrueCloudLab/frostfs-api-go/v2/session/grpc" "google.golang.org/protobuf/encoding/protojson" ) diff --git a/session/marshal.go b/session/marshal.go index 2c82179..f4b1bc9 100644 --- a/session/marshal.go +++ b/session/marshal.go @@ -1,9 +1,9 @@ package session import ( - "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" - session "github.com/nspcc-dev/neofs-api-go/v2/session/grpc" - "github.com/nspcc-dev/neofs-api-go/v2/util/proto" + "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" + session "github.com/TrueCloudLab/frostfs-api-go/v2/session/grpc" + "github.com/TrueCloudLab/frostfs-api-go/v2/util/proto" goproto "google.golang.org/protobuf/proto" ) diff --git a/session/message_test.go b/session/message_test.go index d9294c9..33489de 100644 --- a/session/message_test.go +++ b/session/message_test.go @@ -3,9 +3,9 @@ package session_test import ( "testing" - "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" - rpctest "github.com/nspcc-dev/neofs-api-go/v2/rpc/message/test" - sessiontest "github.com/nspcc-dev/neofs-api-go/v2/session/test" + "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" + rpctest "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message/test" + sessiontest "github.com/TrueCloudLab/frostfs-api-go/v2/session/test" ) func TestMessageConvert(t *testing.T) { diff --git a/session/status.go b/session/status.go index a6dbfca..04aa450 100644 --- a/session/status.go +++ b/session/status.go @@ -1,8 +1,8 @@ package session import ( - "github.com/nspcc-dev/neofs-api-go/v2/status" - statusgrpc "github.com/nspcc-dev/neofs-api-go/v2/status/grpc" + "github.com/TrueCloudLab/frostfs-api-go/v2/status" + statusgrpc "github.com/TrueCloudLab/frostfs-api-go/v2/status/grpc" ) // LocalizeFailStatus checks if passed global status.Code is related to session failure and: diff --git a/session/status_test.go b/session/status_test.go index a2847f8..2a7ff6d 100644 --- a/session/status_test.go +++ b/session/status_test.go @@ -3,8 +3,8 @@ package session_test import ( "testing" - "github.com/nspcc-dev/neofs-api-go/v2/session" - statustest "github.com/nspcc-dev/neofs-api-go/v2/status/test" + "github.com/TrueCloudLab/frostfs-api-go/v2/session" + statustest "github.com/TrueCloudLab/frostfs-api-go/v2/status/test" ) func TestStatusCodes(t *testing.T) { diff --git a/session/string.go b/session/string.go index 0335ed7..24e7d09 100644 --- a/session/string.go +++ b/session/string.go @@ -1,7 +1,7 @@ package session import ( - session "github.com/nspcc-dev/neofs-api-go/v2/session/grpc" + session "github.com/TrueCloudLab/frostfs-api-go/v2/session/grpc" ) // String returns string representation of ObjectSessionVerb. diff --git a/session/test/generate.go b/session/test/generate.go index 8bb2c82..dc06aed 100644 --- a/session/test/generate.go +++ b/session/test/generate.go @@ -1,11 +1,11 @@ package sessiontest import ( - acltest "github.com/nspcc-dev/neofs-api-go/v2/acl/test" - "github.com/nspcc-dev/neofs-api-go/v2/internal/random" - refstest "github.com/nspcc-dev/neofs-api-go/v2/refs/test" - "github.com/nspcc-dev/neofs-api-go/v2/session" - statustest "github.com/nspcc-dev/neofs-api-go/v2/status/test" + acltest "github.com/TrueCloudLab/frostfs-api-go/v2/acl/test" + "github.com/TrueCloudLab/frostfs-api-go/v2/internal/random" + refstest "github.com/TrueCloudLab/frostfs-api-go/v2/refs/test" + "github.com/TrueCloudLab/frostfs-api-go/v2/session" + statustest "github.com/TrueCloudLab/frostfs-api-go/v2/status/test" ) func GenerateCreateRequestBody(empty bool) *session.CreateRequestBody { diff --git a/session/types.go b/session/types.go index cb14825..d00d76f 100644 --- a/session/types.go +++ b/session/types.go @@ -1,10 +1,10 @@ package session import ( - "github.com/nspcc-dev/neofs-api-go/v2/acl" - "github.com/nspcc-dev/neofs-api-go/v2/refs" - "github.com/nspcc-dev/neofs-api-go/v2/status" - "github.com/nspcc-dev/neofs-api-go/v2/util/proto" + "github.com/TrueCloudLab/frostfs-api-go/v2/acl" + "github.com/TrueCloudLab/frostfs-api-go/v2/refs" + "github.com/TrueCloudLab/frostfs-api-go/v2/status" + "github.com/TrueCloudLab/frostfs-api-go/v2/util/proto" ) type CreateRequestBody struct { diff --git a/session/util.go b/session/util.go index f39097d..59ee076 100644 --- a/session/util.go +++ b/session/util.go @@ -1,7 +1,7 @@ package session import ( - session "github.com/nspcc-dev/neofs-api-go/v2/session/grpc" + session "github.com/TrueCloudLab/frostfs-api-go/v2/session/grpc" ) // RequestHeaders represents common part of diff --git a/signature/sign.go b/signature/sign.go index ea2e1aa..f1d4cf6 100644 --- a/signature/sign.go +++ b/signature/sign.go @@ -5,14 +5,14 @@ import ( "errors" "fmt" - "github.com/nspcc-dev/neofs-api-go/v2/accounting" - "github.com/nspcc-dev/neofs-api-go/v2/container" - "github.com/nspcc-dev/neofs-api-go/v2/netmap" - "github.com/nspcc-dev/neofs-api-go/v2/object" - "github.com/nspcc-dev/neofs-api-go/v2/refs" - "github.com/nspcc-dev/neofs-api-go/v2/reputation" - "github.com/nspcc-dev/neofs-api-go/v2/session" - "github.com/nspcc-dev/neofs-api-go/v2/util/signature" + "github.com/TrueCloudLab/frostfs-api-go/v2/accounting" + "github.com/TrueCloudLab/frostfs-api-go/v2/container" + "github.com/TrueCloudLab/frostfs-api-go/v2/netmap" + "github.com/TrueCloudLab/frostfs-api-go/v2/object" + "github.com/TrueCloudLab/frostfs-api-go/v2/refs" + "github.com/TrueCloudLab/frostfs-api-go/v2/reputation" + "github.com/TrueCloudLab/frostfs-api-go/v2/session" + "github.com/TrueCloudLab/frostfs-api-go/v2/util/signature" ) type serviceRequest interface { diff --git a/signature/sign_test.go b/signature/sign_test.go index cd3aee8..fb508a3 100644 --- a/signature/sign_test.go +++ b/signature/sign_test.go @@ -3,9 +3,9 @@ package signature import ( "testing" - "github.com/nspcc-dev/neofs-api-go/v2/accounting" - "github.com/nspcc-dev/neofs-api-go/v2/session" - crypto "github.com/nspcc-dev/neofs-crypto" + "github.com/TrueCloudLab/frostfs-api-go/v2/accounting" + "github.com/TrueCloudLab/frostfs-api-go/v2/session" + crypto "github.com/TrueCloudLab/frostfs-crypto" "github.com/stretchr/testify/require" ) diff --git a/status/convert.go b/status/convert.go index 50145ef..e13e567 100644 --- a/status/convert.go +++ b/status/convert.go @@ -1,9 +1,9 @@ package status import ( - "github.com/nspcc-dev/neofs-api-go/v2/rpc/grpc" - "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" - status "github.com/nspcc-dev/neofs-api-go/v2/status/grpc" + "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/grpc" + "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" + status "github.com/TrueCloudLab/frostfs-api-go/v2/status/grpc" ) func (x *Detail) ToGRPCMessage() grpc.Message { diff --git a/status/grpc/types.pb.go b/status/grpc/types.pb.go index b864629..d4960fb 100644 --- a/status/grpc/types.pb.go +++ b/status/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.28.0 -// protoc v3.21.6 +// protoc v3.21.9 // source: status/grpc/types.proto package status @@ -558,13 +558,13 @@ var file_status_grpc_types_proto_rawDesc = []byte{ 0x4e, 0x44, 0x10, 0x01, 0x2a, 0x31, 0x0a, 0x07, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x13, 0x0a, 0x0f, 0x54, 0x4f, 0x4b, 0x45, 0x4e, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x46, 0x4f, 0x55, 0x4e, 0x44, 0x10, 0x00, 0x12, 0x11, 0x0a, 0x0d, 0x54, 0x4f, 0x4b, 0x45, 0x4e, 0x5f, 0x45, 0x58, - 0x50, 0x49, 0x52, 0x45, 0x44, 0x10, 0x01, 0x42, 0x56, 0x5a, 0x37, 0x67, 0x69, 0x74, 0x68, 0x75, - 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, - 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, - 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x73, 0x74, 0x61, 0x74, - 0x75, 0x73, 0xaa, 0x02, 0x1a, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, - 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x50, 0x49, 0x52, 0x45, 0x44, 0x10, 0x01, 0x42, 0x5b, 0x5a, 0x3c, 0x67, 0x69, 0x74, 0x68, 0x75, + 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x54, 0x72, 0x75, 0x65, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x4c, + 0x61, 0x62, 0x2f, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, + 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, + 0x3b, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0xaa, 0x02, 0x1a, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, + 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x53, 0x74, + 0x61, 0x74, 0x75, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/status/marshal.go b/status/marshal.go index 968a6fc..553b7d7 100644 --- a/status/marshal.go +++ b/status/marshal.go @@ -1,9 +1,9 @@ package status import ( - "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" - status "github.com/nspcc-dev/neofs-api-go/v2/status/grpc" - protoutil "github.com/nspcc-dev/neofs-api-go/v2/util/proto" + "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" + status "github.com/TrueCloudLab/frostfs-api-go/v2/status/grpc" + protoutil "github.com/TrueCloudLab/frostfs-api-go/v2/util/proto" ) const ( diff --git a/status/message_test.go b/status/message_test.go index b6f8d2d..47355f1 100644 --- a/status/message_test.go +++ b/status/message_test.go @@ -3,9 +3,9 @@ package status_test import ( "testing" - "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" - messagetest "github.com/nspcc-dev/neofs-api-go/v2/rpc/message/test" - statustest "github.com/nspcc-dev/neofs-api-go/v2/status/test" + "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" + messagetest "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message/test" + statustest "github.com/TrueCloudLab/frostfs-api-go/v2/status/test" ) func TestMessageConvert(t *testing.T) { diff --git a/status/test/codes.go b/status/test/codes.go index acc5a50..4df7da5 100644 --- a/status/test/codes.go +++ b/status/test/codes.go @@ -3,7 +3,7 @@ package statustest import ( "testing" - "github.com/nspcc-dev/neofs-api-go/v2/status" + "github.com/TrueCloudLab/frostfs-api-go/v2/status" "github.com/stretchr/testify/require" ) diff --git a/status/test/generate.go b/status/test/generate.go index 01df633..8812814 100644 --- a/status/test/generate.go +++ b/status/test/generate.go @@ -1,7 +1,7 @@ package statustest import ( - "github.com/nspcc-dev/neofs-api-go/v2/status" + "github.com/TrueCloudLab/frostfs-api-go/v2/status" ) // Detail returns status.Detail filled with static random values. diff --git a/storagegroup/convert.go b/storagegroup/convert.go index 3dac399..dddd8b4 100644 --- a/storagegroup/convert.go +++ b/storagegroup/convert.go @@ -1,11 +1,11 @@ package storagegroup import ( - "github.com/nspcc-dev/neofs-api-go/v2/refs" - refsGRPC "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" - "github.com/nspcc-dev/neofs-api-go/v2/rpc/grpc" - "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" - sg "github.com/nspcc-dev/neofs-api-go/v2/storagegroup/grpc" + "github.com/TrueCloudLab/frostfs-api-go/v2/refs" + refsGRPC "github.com/TrueCloudLab/frostfs-api-go/v2/refs/grpc" + "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/grpc" + "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" + sg "github.com/TrueCloudLab/frostfs-api-go/v2/storagegroup/grpc" ) func (s *StorageGroup) ToGRPCMessage() grpc.Message { diff --git a/storagegroup/grpc/types.go b/storagegroup/grpc/types.go index 86280d3..f1151c4 100644 --- a/storagegroup/grpc/types.go +++ b/storagegroup/grpc/types.go @@ -1,7 +1,7 @@ package storagegroup import ( - refs "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" + refs "github.com/TrueCloudLab/frostfs-api-go/v2/refs/grpc" ) // SetValidationDataSize sets the total size of the payloads of the storage group. diff --git a/storagegroup/grpc/types.pb.go b/storagegroup/grpc/types.pb.go index 8f5100c..98e2bcd 100644 --- a/storagegroup/grpc/types.pb.go +++ b/storagegroup/grpc/types.pb.go @@ -1,13 +1,13 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.28.0 -// protoc v3.21.6 +// protoc v3.21.9 // source: storagegroup/grpc/types.proto package storagegroup import ( - grpc "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" + grpc "github.com/TrueCloudLab/frostfs-api-go/v2/refs/grpc" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -132,14 +132,14 @@ var file_storagegroup_grpc_types_proto_rawDesc = []byte{ 0x6f, 0x63, 0x68, 0x12, 0x32, 0x0a, 0x07, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x18, 0x04, 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, 0x68, 0x5a, 0x43, 0x67, 0x69, 0x74, 0x68, 0x75, - 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, - 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, - 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x2f, 0x67, 0x72, 0x70, - 0x63, 0x3b, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x67, 0x72, 0x6f, 0x75, 0x70, 0xaa, 0x02, - 0x20, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, - 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x47, 0x72, 0x6f, 0x75, - 0x70, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x42, 0x6d, 0x5a, 0x48, 0x67, 0x69, 0x74, 0x68, 0x75, + 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x54, 0x72, 0x75, 0x65, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x4c, + 0x61, 0x62, 0x2f, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, + 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x67, 0x72, 0x6f, 0x75, + 0x70, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x67, 0x72, + 0x6f, 0x75, 0x70, 0xaa, 0x02, 0x20, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, + 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, + 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/storagegroup/json.go b/storagegroup/json.go index 3224835..6136068 100644 --- a/storagegroup/json.go +++ b/storagegroup/json.go @@ -1,8 +1,8 @@ package storagegroup import ( - "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" - storagegroup "github.com/nspcc-dev/neofs-api-go/v2/storagegroup/grpc" + "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" + storagegroup "github.com/TrueCloudLab/frostfs-api-go/v2/storagegroup/grpc" ) func (s *StorageGroup) MarshalJSON() ([]byte, error) { diff --git a/storagegroup/marshal.go b/storagegroup/marshal.go index 22e0ca9..f7a94f7 100644 --- a/storagegroup/marshal.go +++ b/storagegroup/marshal.go @@ -1,10 +1,10 @@ package storagegroup import ( - "github.com/nspcc-dev/neofs-api-go/v2/refs" - "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" - storagegroup "github.com/nspcc-dev/neofs-api-go/v2/storagegroup/grpc" - "github.com/nspcc-dev/neofs-api-go/v2/util/proto" + "github.com/TrueCloudLab/frostfs-api-go/v2/refs" + "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" + storagegroup "github.com/TrueCloudLab/frostfs-api-go/v2/storagegroup/grpc" + "github.com/TrueCloudLab/frostfs-api-go/v2/util/proto" ) const ( diff --git a/storagegroup/message_test.go b/storagegroup/message_test.go index 0eb65ef..ccc214c 100644 --- a/storagegroup/message_test.go +++ b/storagegroup/message_test.go @@ -3,9 +3,9 @@ package storagegroup_test import ( "testing" - "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" - messagetest "github.com/nspcc-dev/neofs-api-go/v2/rpc/message/test" - storagegrouptest "github.com/nspcc-dev/neofs-api-go/v2/storagegroup/test" + "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" + messagetest "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message/test" + storagegrouptest "github.com/TrueCloudLab/frostfs-api-go/v2/storagegroup/test" ) func TestMessageConvert(t *testing.T) { diff --git a/storagegroup/test/generate.go b/storagegroup/test/generate.go index 80ba7b9..fb338e4 100644 --- a/storagegroup/test/generate.go +++ b/storagegroup/test/generate.go @@ -1,8 +1,8 @@ package storagegrouptest import ( - refstest "github.com/nspcc-dev/neofs-api-go/v2/refs/test" - "github.com/nspcc-dev/neofs-api-go/v2/storagegroup" + refstest "github.com/TrueCloudLab/frostfs-api-go/v2/refs/test" + "github.com/TrueCloudLab/frostfs-api-go/v2/storagegroup" ) func GenerateStorageGroup(empty bool) *storagegroup.StorageGroup { diff --git a/storagegroup/types.go b/storagegroup/types.go index a03faf3..179705e 100644 --- a/storagegroup/types.go +++ b/storagegroup/types.go @@ -1,7 +1,7 @@ package storagegroup import ( - "github.com/nspcc-dev/neofs-api-go/v2/refs" + "github.com/TrueCloudLab/frostfs-api-go/v2/refs" ) // StorageGroup is a unified structure of StorageGroup diff --git a/subnet/encoding_test.go b/subnet/encoding_test.go index e85c02b..3e41b23 100644 --- a/subnet/encoding_test.go +++ b/subnet/encoding_test.go @@ -3,9 +3,9 @@ package subnet_test import ( "testing" - "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" - messagetest "github.com/nspcc-dev/neofs-api-go/v2/rpc/message/test" - subnettest "github.com/nspcc-dev/neofs-api-go/v2/subnet/test" + "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" + messagetest "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message/test" + subnettest "github.com/TrueCloudLab/frostfs-api-go/v2/subnet/test" ) func TestMessageConvert(t *testing.T) { diff --git a/subnet/grpc/types.go b/subnet/grpc/types.go index 58a7268..548e656 100644 --- a/subnet/grpc/types.go +++ b/subnet/grpc/types.go @@ -1,7 +1,7 @@ package subnet import ( - refs "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" + refs "github.com/TrueCloudLab/frostfs-api-go/v2/refs/grpc" ) // SetID returns identifier of the subnet. Nil arg is equivalent to zero subnet ID. diff --git a/subnet/grpc/types.pb.go b/subnet/grpc/types.pb.go index 015e66d..2de1bc8 100644 --- a/subnet/grpc/types.pb.go +++ b/subnet/grpc/types.pb.go @@ -1,13 +1,13 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.28.0 -// protoc v3.21.6 +// protoc v3.21.9 // source: subnet/grpc/types.proto package subnet import ( - grpc "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" + grpc "github.com/TrueCloudLab/frostfs-api-go/v2/refs/grpc" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -93,13 +93,13 @@ var file_subnet_grpc_types_proto_rawDesc = []byte{ 0x62, 0x6e, 0x65, 0x74, 0x49, 0x44, 0x52, 0x02, 0x69, 0x64, 0x12, 0x2d, 0x0a, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 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, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x42, 0x56, 0x5a, 0x37, 0x67, 0x69, 0x74, - 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, - 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, - 0x32, 0x2f, 0x73, 0x75, 0x62, 0x6e, 0x65, 0x74, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x73, 0x75, - 0x62, 0x6e, 0x65, 0x74, 0xaa, 0x02, 0x1a, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, - 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x53, 0x75, 0x62, 0x6e, 0x65, - 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x49, 0x44, 0x52, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x42, 0x5b, 0x5a, 0x3c, 0x67, 0x69, 0x74, + 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x54, 0x72, 0x75, 0x65, 0x43, 0x6c, 0x6f, 0x75, + 0x64, 0x4c, 0x61, 0x62, 0x2f, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, + 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x73, 0x75, 0x62, 0x6e, 0x65, 0x74, 0x2f, 0x67, 0x72, + 0x70, 0x63, 0x3b, 0x73, 0x75, 0x62, 0x6e, 0x65, 0x74, 0xaa, 0x02, 0x1a, 0x4e, 0x65, 0x6f, 0x2e, + 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, + 0x53, 0x75, 0x62, 0x6e, 0x65, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/subnet/info.go b/subnet/info.go index 952b7e7..37ecfe2 100644 --- a/subnet/info.go +++ b/subnet/info.go @@ -1,12 +1,12 @@ package subnet import ( - "github.com/nspcc-dev/neofs-api-go/v2/refs" - refsgrpc "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" - "github.com/nspcc-dev/neofs-api-go/v2/rpc/grpc" - "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" - subnet "github.com/nspcc-dev/neofs-api-go/v2/subnet/grpc" - protoutil "github.com/nspcc-dev/neofs-api-go/v2/util/proto" + "github.com/TrueCloudLab/frostfs-api-go/v2/refs" + refsgrpc "github.com/TrueCloudLab/frostfs-api-go/v2/refs/grpc" + "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/grpc" + "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" + subnet "github.com/TrueCloudLab/frostfs-api-go/v2/subnet/grpc" + protoutil "github.com/TrueCloudLab/frostfs-api-go/v2/util/proto" ) // Info represents information about NeoFS subnet. Structure is compatible with NeoFS API V2 protocol. diff --git a/subnet/test/generate.go b/subnet/test/generate.go index a62482d..d5eab77 100644 --- a/subnet/test/generate.go +++ b/subnet/test/generate.go @@ -1,8 +1,8 @@ package subnettest import ( - refstest "github.com/nspcc-dev/neofs-api-go/v2/refs/test" - "github.com/nspcc-dev/neofs-api-go/v2/subnet" + refstest "github.com/TrueCloudLab/frostfs-api-go/v2/refs/test" + "github.com/TrueCloudLab/frostfs-api-go/v2/subnet" ) func GenerateSubnetInfo(empty bool) *subnet.Info { diff --git a/tombstone/convert.go b/tombstone/convert.go index beb92a7..48e64a6 100644 --- a/tombstone/convert.go +++ b/tombstone/convert.go @@ -1,10 +1,10 @@ package tombstone import ( - "github.com/nspcc-dev/neofs-api-go/v2/refs" - "github.com/nspcc-dev/neofs-api-go/v2/rpc/grpc" - "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" - tombstone "github.com/nspcc-dev/neofs-api-go/v2/tombstone/grpc" + "github.com/TrueCloudLab/frostfs-api-go/v2/refs" + "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/grpc" + "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" + tombstone "github.com/TrueCloudLab/frostfs-api-go/v2/tombstone/grpc" ) func (s *Tombstone) ToGRPCMessage() grpc.Message { diff --git a/tombstone/grpc/types.go b/tombstone/grpc/types.go index aace76d..6793635 100644 --- a/tombstone/grpc/types.go +++ b/tombstone/grpc/types.go @@ -1,7 +1,7 @@ package tombstone import ( - refs "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" + refs "github.com/TrueCloudLab/frostfs-api-go/v2/refs/grpc" ) // SetExpirationEpoch sets number of tombstone expiration epoch. diff --git a/tombstone/grpc/types.pb.go b/tombstone/grpc/types.pb.go index 84b0c3e..b8ea61a 100644 --- a/tombstone/grpc/types.pb.go +++ b/tombstone/grpc/types.pb.go @@ -1,13 +1,13 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.28.0 -// protoc v3.21.6 +// protoc v3.21.9 // source: tombstone/grpc/types.proto package tombstone import ( - grpc "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" + grpc "github.com/TrueCloudLab/frostfs-api-go/v2/refs/grpc" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -110,13 +110,13 @@ var file_tombstone_grpc_types_proto_rawDesc = []byte{ 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x18, 0x03, 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, 0x5f, 0x5a, 0x3d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, - 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, - 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x74, 0x6f, 0x6d, 0x62, 0x73, 0x74, 0x6f, - 0x6e, 0x65, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x74, 0x6f, 0x6d, 0x62, 0x73, 0x74, 0x6f, 0x6e, - 0x65, 0xaa, 0x02, 0x1d, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, - 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x54, 0x6f, 0x6d, 0x62, 0x73, 0x74, 0x6f, 0x6e, - 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x42, 0x64, 0x5a, 0x42, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x54, + 0x72, 0x75, 0x65, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x4c, 0x61, 0x62, 0x2f, 0x66, 0x72, 0x6f, 0x73, + 0x74, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x74, 0x6f, + 0x6d, 0x62, 0x73, 0x74, 0x6f, 0x6e, 0x65, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x74, 0x6f, 0x6d, + 0x62, 0x73, 0x74, 0x6f, 0x6e, 0x65, 0xaa, 0x02, 0x1d, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, + 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x54, 0x6f, 0x6d, + 0x62, 0x73, 0x74, 0x6f, 0x6e, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/tombstone/json.go b/tombstone/json.go index 28ffc1b..1059910 100644 --- a/tombstone/json.go +++ b/tombstone/json.go @@ -1,8 +1,8 @@ package tombstone import ( - "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" - tombstone "github.com/nspcc-dev/neofs-api-go/v2/tombstone/grpc" + "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" + tombstone "github.com/TrueCloudLab/frostfs-api-go/v2/tombstone/grpc" ) func (s *Tombstone) MarshalJSON() ([]byte, error) { diff --git a/tombstone/marshal.go b/tombstone/marshal.go index 62497db..706d9c1 100644 --- a/tombstone/marshal.go +++ b/tombstone/marshal.go @@ -1,9 +1,9 @@ package tombstone import ( - "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" - tombstone "github.com/nspcc-dev/neofs-api-go/v2/tombstone/grpc" - "github.com/nspcc-dev/neofs-api-go/v2/util/proto" + "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" + tombstone "github.com/TrueCloudLab/frostfs-api-go/v2/tombstone/grpc" + "github.com/TrueCloudLab/frostfs-api-go/v2/util/proto" ) const ( diff --git a/tombstone/message_test.go b/tombstone/message_test.go index 858cb01..ae0ad00 100644 --- a/tombstone/message_test.go +++ b/tombstone/message_test.go @@ -3,9 +3,9 @@ package tombstone_test import ( "testing" - "github.com/nspcc-dev/neofs-api-go/v2/rpc/message" - messagetest "github.com/nspcc-dev/neofs-api-go/v2/rpc/message/test" - tombstonetest "github.com/nspcc-dev/neofs-api-go/v2/tombstone/test" + "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" + messagetest "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message/test" + tombstonetest "github.com/TrueCloudLab/frostfs-api-go/v2/tombstone/test" ) func TestMessageConvert(t *testing.T) { diff --git a/tombstone/test/generate.go b/tombstone/test/generate.go index 771f109..00ffa92 100644 --- a/tombstone/test/generate.go +++ b/tombstone/test/generate.go @@ -1,8 +1,8 @@ package tombstonetest import ( - refstest "github.com/nspcc-dev/neofs-api-go/v2/refs/test" - "github.com/nspcc-dev/neofs-api-go/v2/tombstone" + refstest "github.com/TrueCloudLab/frostfs-api-go/v2/refs/test" + "github.com/TrueCloudLab/frostfs-api-go/v2/tombstone" ) func GenerateTombstone(empty bool) *tombstone.Tombstone { diff --git a/tombstone/types.go b/tombstone/types.go index d04935d..4f2ffb4 100644 --- a/tombstone/types.go +++ b/tombstone/types.go @@ -1,7 +1,7 @@ package tombstone import ( - "github.com/nspcc-dev/neofs-api-go/v2/refs" + "github.com/TrueCloudLab/frostfs-api-go/v2/refs" ) // Tombstone is a unified structure of Tombstone diff --git a/util/proto/marshal_test.go b/util/proto/marshal_test.go index cda1440..b34e9d0 100644 --- a/util/proto/marshal_test.go +++ b/util/proto/marshal_test.go @@ -4,8 +4,8 @@ import ( "math" "testing" - "github.com/nspcc-dev/neofs-api-go/v2/util/proto" - "github.com/nspcc-dev/neofs-api-go/v2/util/proto/test" + "github.com/TrueCloudLab/frostfs-api-go/v2/util/proto" + "github.com/TrueCloudLab/frostfs-api-go/v2/util/proto/test" "github.com/stretchr/testify/require" goproto "google.golang.org/protobuf/proto" ) diff --git a/util/proto/test/test.pb.go b/util/proto/test/test.pb.go index f884c08..de6f380 100644 --- a/util/proto/test/test.pb.go +++ b/util/proto/test/test.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.28.0 -// protoc v3.21.6 +// protoc v3.21.9 // source: util/proto/test/test.proto package test diff --git a/util/protogen/main.go b/util/protogen/main.go index 68c4da8..b5a1931 100644 --- a/util/protogen/main.go +++ b/util/protogen/main.go @@ -25,13 +25,13 @@ func main() { // generateFile generates a *.pb.go file enforcing field-order serialization. func generateFile(gen *protogen.Plugin, file *protogen.File) *protogen.GeneratedFile { - filename := file.GeneratedFilenamePrefix + "_neofs.pb.go" + filename := file.GeneratedFilenamePrefix + "_frostfs.pb.go" g := gen.NewGeneratedFile(filename, file.GoImportPath) - g.P("// Code generated by protoc-gen-go-neofs. DO NOT EDIT.") + g.P("// Code generated by protoc-gen-go-frostfs. DO NOT EDIT.") g.P() g.P("package ", file.GoPackageName) g.P() - g.P(`import "github.com/nspcc-dev/neofs-api-go/v2/util/proto"`) + g.P(`import "github.com/TrueCloudLab/frostfs-api-go/v2/util/proto"`) //for _, e := range file.Enums { // g.P("type " + e.GoIdent.GoName + " int32") diff --git a/util/signature/data.go b/util/signature/data.go index 387be93..efe543d 100644 --- a/util/signature/data.go +++ b/util/signature/data.go @@ -3,8 +3,8 @@ package signature import ( "crypto/ecdsa" - "github.com/nspcc-dev/neofs-api-go/v2/refs" - crypto "github.com/nspcc-dev/neofs-crypto" + "github.com/TrueCloudLab/frostfs-api-go/v2/refs" + crypto "github.com/TrueCloudLab/frostfs-crypto" ) type DataSource interface { diff --git a/util/signature/options.go b/util/signature/options.go index 615b443..cb25034 100644 --- a/util/signature/options.go +++ b/util/signature/options.go @@ -5,9 +5,9 @@ import ( "encoding/base64" "fmt" - "github.com/nspcc-dev/neofs-api-go/v2/refs" - "github.com/nspcc-dev/neofs-api-go/v2/util/signature/walletconnect" - crypto "github.com/nspcc-dev/neofs-crypto" + "github.com/TrueCloudLab/frostfs-api-go/v2/refs" + "github.com/TrueCloudLab/frostfs-api-go/v2/util/signature/walletconnect" + crypto "github.com/TrueCloudLab/frostfs-crypto" ) type cfg struct { diff --git a/util/signature/sign_test.go b/util/signature/sign_test.go index 11ed442..c819068 100644 --- a/util/signature/sign_test.go +++ b/util/signature/sign_test.go @@ -6,7 +6,7 @@ import ( "crypto/rand" "testing" - "github.com/nspcc-dev/neofs-api-go/v2/refs" + "github.com/TrueCloudLab/frostfs-api-go/v2/refs" "github.com/stretchr/testify/require" ) diff --git a/util/signature/walletconnect/sign.go b/util/signature/walletconnect/sign.go index 8c49fec..bd24a89 100644 --- a/util/signature/walletconnect/sign.go +++ b/util/signature/walletconnect/sign.go @@ -7,7 +7,7 @@ import ( "encoding/binary" "encoding/hex" - crypto "github.com/nspcc-dev/neofs-crypto" + crypto "github.com/TrueCloudLab/frostfs-crypto" ) const ( From 513e3e137d8717689ca2bcf038ae4687009797dc Mon Sep 17 00:00:00 2001 From: Stanislav Bogatyrev Date: Sun, 8 Jan 2023 00:00:59 +0300 Subject: [PATCH 1025/1196] Change logo Signed-off-by: Stanislav Bogatyrev --- .github/logo.svg | 197 +++++++++++++++++------------------------------ README.md | 2 +- 2 files changed, 70 insertions(+), 129 deletions(-) diff --git a/.github/logo.svg b/.github/logo.svg index b4da076..148c359 100644 --- a/.github/logo.svg +++ b/.github/logo.svg @@ -1,129 +1,70 @@ - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/README.md b/README.md index 5dd56c2..73f06e3 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@

-NeoFS +FrostFS

Low-level Golang API for FrostFS From cc8da15242d364c058bdd02482e2310acb4b0c3c Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Fri, 3 Feb 2023 15:22:00 +0300 Subject: [PATCH 1026/1196] [#2] rpc/client: Remove additional wrapper Signed-off-by: Evgenii Stratonikov --- rpc/client/client.go | 20 ++------ rpc/client/conn.go | 8 +--- rpc/client/connect.go | 17 ------- rpc/client/init.go | 42 ++++++---------- rpc/client/options.go | 8 ++-- rpc/client/stream_wrapper.go | 58 +++++++++++++++++++++++ rpc/{grpc => client}/util.go | 2 +- rpc/grpc/call_options.go | 25 ---------- rpc/grpc/client.go | 23 --------- rpc/grpc/conn.go | 19 -------- rpc/grpc/init.go | 92 ------------------------------------ rpc/grpc/options.go | 36 -------------- 12 files changed, 82 insertions(+), 268 deletions(-) create mode 100644 rpc/client/stream_wrapper.go rename rpc/{grpc => client}/util.go (93%) delete mode 100644 rpc/grpc/call_options.go delete mode 100644 rpc/grpc/client.go delete mode 100644 rpc/grpc/conn.go delete mode 100644 rpc/grpc/options.go diff --git a/rpc/client/client.go b/rpc/client/client.go index 40b5d1a..e184d33 100644 --- a/rpc/client/client.go +++ b/rpc/client/client.go @@ -1,29 +1,19 @@ package client -import ( - "sync" - - "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/grpc" -) - // Client represents client for exchanging messages // with a remote server using Protobuf RPC. type Client struct { - *cfg - - gRPCClientOnce sync.Once - gRPCClient *grpc.Client + cfg } // New creates, configures via options and returns new Client instance. func New(opts ...Option) *Client { - c := defaultCfg() + var c Client + c.initDefault() for _, opt := range opts { - opt(c) + opt(&c.cfg) } - return &Client{ - cfg: c, - } + return &c } diff --git a/rpc/client/conn.go b/rpc/client/conn.go index ba53ab3..9fc7a51 100644 --- a/rpc/client/conn.go +++ b/rpc/client/conn.go @@ -9,14 +9,8 @@ import ( // Returns non-nil result after the first Init() call // completed without a connection error. // -// Conn is NPE-safe: returns nil if Client is nil. -// // Client should not be used after Close() call // on the connection: behavior is undefined. func (c *Client) Conn() io.Closer { - if c != nil { - return c.gRPCClient.Conn() - } - - return nil + return c.conn } diff --git a/rpc/client/connect.go b/rpc/client/connect.go index 2fe77d5..2f62130 100644 --- a/rpc/client/connect.go +++ b/rpc/client/connect.go @@ -7,28 +7,11 @@ import ( "net" "net/url" - "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/grpc" grpcstd "google.golang.org/grpc" "google.golang.org/grpc/credentials" "google.golang.org/grpc/credentials/insecure" ) -func (c *Client) createGRPCClient(ctx context.Context) (err error) { - c.gRPCClientOnce.Do(func() { - if err = c.openGRPCConn(ctx); err != nil { - err = fmt.Errorf("open gRPC connection: %w", err) - return - } - - c.gRPCClient = grpc.New( - grpc.WithClientConnection(c.conn), - grpc.WithRWTimeout(c.rwTimeout), - ) - }) - - return -} - var errInvalidEndpoint = errors.New("invalid endpoint options") func (c *Client) openGRPCConn(ctx context.Context) error { diff --git a/rpc/client/init.go b/rpc/client/init.go index b45871b..7706c7a 100644 --- a/rpc/client/init.go +++ b/rpc/client/init.go @@ -1,11 +1,12 @@ package client import ( + "context" "io" "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/common" - "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/grpc" "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" + "google.golang.org/grpc" ) // MessageReader is an interface of the Message reader. @@ -45,39 +46,24 @@ func (c *Client) Init(info common.CallMethodInfo, opts ...CallOption) (MessageRe opt(prm) } - return c.initGRPC(info, prm) -} - -type rwGRPC struct { - grpc.MessageReadWriter -} - -func (g rwGRPC) ReadMessage(m message.Message) error { - // Can be optimized: we can create blank message here. - gm := m.ToGRPCMessage() - - if err := g.MessageReadWriter.ReadMessage(gm); err != nil { - return err - } - - return m.FromGRPCMessage(gm) -} - -func (g rwGRPC) WriteMessage(m message.Message) error { - return g.MessageReadWriter.WriteMessage(m.ToGRPCMessage()) -} - -func (c *Client) initGRPC(info common.CallMethodInfo, prm *callParameters) (MessageReadWriter, error) { - if err := c.createGRPCClient(prm.ctx); err != nil { + if err := c.openGRPCConn(prm.ctx); err != nil { return nil, err } - rw, err := c.gRPCClient.Init(info, grpc.WithContext(prm.ctx)) + ctx, cancel := context.WithCancel(prm.ctx) + stream, err := c.conn.NewStream(ctx, &grpc.StreamDesc{ + StreamName: info.Name, + ServerStreams: info.ServerStream(), + ClientStreams: info.ClientStream(), + }, toMethodName(info)) if err != nil { + cancel() return nil, err } - return &rwGRPC{ - MessageReadWriter: rw, + return &streamWrapper{ + ClientStream: stream, + cancel: cancel, + timeout: c.rwTimeout, }, nil } diff --git a/rpc/client/options.go b/rpc/client/options.go index f04fc9e..0e2455c 100644 --- a/rpc/client/options.go +++ b/rpc/client/options.go @@ -31,11 +31,9 @@ const ( defaultRWTimeout = 1 * time.Minute ) -func defaultCfg() *cfg { - return &cfg{ - dialTimeout: defaultDialTimeout, - rwTimeout: defaultRWTimeout, - } +func (c *cfg) initDefault() { + c.dialTimeout = defaultDialTimeout + c.rwTimeout = defaultRWTimeout } // WithNetworkAddress returns option to specify diff --git a/rpc/client/stream_wrapper.go b/rpc/client/stream_wrapper.go new file mode 100644 index 0000000..7f60db2 --- /dev/null +++ b/rpc/client/stream_wrapper.go @@ -0,0 +1,58 @@ +package client + +import ( + "context" + "time" + + "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" + "google.golang.org/grpc" +) + +type streamWrapper struct { + grpc.ClientStream + timeout time.Duration + cancel context.CancelFunc +} + +func (w streamWrapper) ReadMessage(m message.Message) error { + // Can be optimized: we can create blank message here. + gm := m.ToGRPCMessage() + + err := w.withTimeout(func() error { + return w.ClientStream.RecvMsg(gm) + }) + if err != nil { + return err + } + + return m.FromGRPCMessage(gm) +} + +func (w streamWrapper) WriteMessage(m message.Message) error { + return w.withTimeout(func() error { + return w.ClientStream.SendMsg(m.ToGRPCMessage()) + }) +} + +func (w *streamWrapper) Close() error { + return w.withTimeout(w.ClientStream.CloseSend) +} + +func (w *streamWrapper) withTimeout(closure func() error) error { + ch := make(chan error, 1) + go func() { + ch <- closure() + close(ch) + }() + + tt := time.NewTimer(w.timeout) + + select { + case err := <-ch: + tt.Stop() + return err + case <-tt.C: + w.cancel() + return context.DeadlineExceeded + } +} diff --git a/rpc/grpc/util.go b/rpc/client/util.go similarity index 93% rename from rpc/grpc/util.go rename to rpc/client/util.go index 220c656..291ebac 100644 --- a/rpc/grpc/util.go +++ b/rpc/client/util.go @@ -1,4 +1,4 @@ -package grpc +package client import ( "fmt" diff --git a/rpc/grpc/call_options.go b/rpc/grpc/call_options.go deleted file mode 100644 index 6faf019..0000000 --- a/rpc/grpc/call_options.go +++ /dev/null @@ -1,25 +0,0 @@ -package grpc - -import ( - "context" -) - -// CallOption is a messaging session option within RPC. -type CallOption func(*callParameters) - -type callParameters struct { - ctx context.Context -} - -func defaultCallParameters() *callParameters { - return &callParameters{ - ctx: context.Background(), - } -} - -// WithContext returns option to set RPC context. -func WithContext(ctx context.Context) CallOption { - return func(prm *callParameters) { - prm.ctx = ctx - } -} diff --git a/rpc/grpc/client.go b/rpc/grpc/client.go deleted file mode 100644 index 82df2ce..0000000 --- a/rpc/grpc/client.go +++ /dev/null @@ -1,23 +0,0 @@ -package grpc - -// Client represents client for exchanging messages -// with a remote server using gRPC protocol. -type Client struct { - *cfg -} - -// Option is a Client's constructor option. -type Option func(*cfg) - -// New creates, configures via options and returns new Client instance. -func New(opts ...Option) *Client { - c := defaultCfg() - - for _, opt := range opts { - opt(c) - } - - return &Client{ - cfg: c, - } -} diff --git a/rpc/grpc/conn.go b/rpc/grpc/conn.go deleted file mode 100644 index 40968b9..0000000 --- a/rpc/grpc/conn.go +++ /dev/null @@ -1,19 +0,0 @@ -package grpc - -import ( - "io" -) - -// Conn returns underlying connection. -// -// Conn is NPE-safe: returns nil if Client is nil. -// -// Client should not be used after Close() call -// on the connection: behavior is undefined. -func (c *Client) Conn() io.Closer { - if c != nil { - return c.con - } - - return nil -} diff --git a/rpc/grpc/init.go b/rpc/grpc/init.go index bc9aa9c..79f08c9 100644 --- a/rpc/grpc/init.go +++ b/rpc/grpc/init.go @@ -1,96 +1,4 @@ package grpc -import ( - "context" - "io" - "time" - - "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/common" - "google.golang.org/grpc" -) - // Message represents raw gRPC message. type Message interface{} - -// MessageReadWriter is a component interface -// for transmitting raw messages over gRPC protocol. -type MessageReadWriter interface { - // ReadMessage reads the next message from the remote server, - // and writes it to the argument. - ReadMessage(Message) error - - // WriteMessage sends message from argument to remote server. - WriteMessage(Message) error - - // Closes the communication session with the remote server. - // - // All calls to send/receive messages must be done before closing. - io.Closer -} - -type streamWrapper struct { - grpc.ClientStream - timeout time.Duration - cancel context.CancelFunc -} - -func (w streamWrapper) ReadMessage(m Message) error { - return w.withTimeout(func() error { - return w.ClientStream.RecvMsg(m) - }) -} - -func (w streamWrapper) WriteMessage(m Message) error { - return w.withTimeout(func() error { - return w.ClientStream.SendMsg(m) - }) -} - -func (w *streamWrapper) Close() error { - return w.withTimeout(w.ClientStream.CloseSend) -} - -func (w *streamWrapper) withTimeout(closure func() error) error { - ch := make(chan error, 1) - go func() { - ch <- closure() - close(ch) - }() - - tt := time.NewTimer(w.timeout) - - select { - case err := <-ch: - tt.Stop() - return err - case <-tt.C: - w.cancel() - return context.DeadlineExceeded - } -} - -// Init initiates a messaging session within the RPC configured by options. -func (c *Client) Init(info common.CallMethodInfo, opts ...CallOption) (MessageReadWriter, error) { - prm := defaultCallParameters() - - for _, opt := range opts { - opt(prm) - } - - ctx, cancel := context.WithCancel(prm.ctx) - stream, err := c.con.NewStream(ctx, &grpc.StreamDesc{ - StreamName: info.Name, - ServerStreams: info.ServerStream(), - ClientStreams: info.ClientStream(), - }, toMethodName(info)) - if err != nil { - cancel() - return nil, err - } - - return &streamWrapper{ - ClientStream: stream, - cancel: cancel, - timeout: c.rwTimeout, - }, nil -} diff --git a/rpc/grpc/options.go b/rpc/grpc/options.go deleted file mode 100644 index 29b07ba..0000000 --- a/rpc/grpc/options.go +++ /dev/null @@ -1,36 +0,0 @@ -package grpc - -import ( - "time" - - "google.golang.org/grpc" -) - -const defaultRWTimeout = 1 * time.Minute - -type cfg struct { - con *grpc.ClientConn - rwTimeout time.Duration -} - -func defaultCfg() *cfg { - return &cfg{ - rwTimeout: defaultRWTimeout, - } -} - -// WithClientConnection returns option to set gRPC connection -// to the remote server. -func WithClientConnection(con *grpc.ClientConn) Option { - return func(c *cfg) { - c.con = con - } -} - -// WithRWTimeout returns option to specify rwTimeout -// for reading and writing single gRPC message. -func WithRWTimeout(t time.Duration) Option { - return func(c *cfg) { - c.rwTimeout = t - } -} From 45358d4551be7366329766291f45f232f64d3312 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Fri, 3 Feb 2023 16:43:09 +0300 Subject: [PATCH 1027/1196] [#2] rpc/client: Allow to override low-level gRPC options Signed-off-by: Evgenii Stratonikov --- rpc/client/client.go | 9 +++++++++ rpc/client/connect.go | 15 +-------------- rpc/client/options.go | 24 +++++++++++++++++++++--- 3 files changed, 31 insertions(+), 17 deletions(-) diff --git a/rpc/client/client.go b/rpc/client/client.go index e184d33..7e914db 100644 --- a/rpc/client/client.go +++ b/rpc/client/client.go @@ -1,5 +1,10 @@ package client +import ( + "google.golang.org/grpc" + "google.golang.org/grpc/credentials" +) + // Client represents client for exchanging messages // with a remote server using Protobuf RPC. type Client struct { @@ -15,5 +20,9 @@ func New(opts ...Option) *Client { opt(&c.cfg) } + if c.tlsCfg != nil { + c.grpcDialOpts = append(c.grpcDialOpts, grpc.WithTransportCredentials(credentials.NewTLS(c.tlsCfg))) + } + return &c } diff --git a/rpc/client/connect.go b/rpc/client/connect.go index 2f62130..29f4189 100644 --- a/rpc/client/connect.go +++ b/rpc/client/connect.go @@ -8,8 +8,6 @@ import ( "net/url" grpcstd "google.golang.org/grpc" - "google.golang.org/grpc/credentials" - "google.golang.org/grpc/credentials/insecure" ) var errInvalidEndpoint = errors.New("invalid endpoint options") @@ -23,21 +21,10 @@ func (c *Client) openGRPCConn(ctx context.Context) error { return errInvalidEndpoint } - var creds credentials.TransportCredentials - - if c.tlsCfg != nil { - creds = credentials.NewTLS(c.tlsCfg) - } else { - creds = insecure.NewCredentials() - } - dialCtx, cancel := context.WithTimeout(ctx, c.dialTimeout) var err error - c.conn, err = grpcstd.DialContext(dialCtx, c.addr, - grpcstd.WithTransportCredentials(creds), - grpcstd.WithBlock(), - ) + c.conn, err = grpcstd.DialContext(dialCtx, c.addr, c.grpcDialOpts...) cancel() diff --git a/rpc/client/options.go b/rpc/client/options.go index 0e2455c..005594c 100644 --- a/rpc/client/options.go +++ b/rpc/client/options.go @@ -5,6 +5,8 @@ import ( "time" "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" + "google.golang.org/grpc/keepalive" ) const ( @@ -21,19 +23,28 @@ type cfg struct { dialTimeout time.Duration rwTimeout time.Duration - tlsCfg *tls.Config + tlsCfg *tls.Config + grpcDialOpts []grpc.DialOption conn *grpc.ClientConn } const ( - defaultDialTimeout = 5 * time.Second - defaultRWTimeout = 1 * time.Minute + defaultDialTimeout = 5 * time.Second + defaultKeepAliveTimeout = 5 * time.Second + defaultRWTimeout = 1 * time.Minute ) func (c *cfg) initDefault() { c.dialTimeout = defaultDialTimeout c.rwTimeout = defaultRWTimeout + c.grpcDialOpts = []grpc.DialOption{ + grpc.WithBlock(), + grpc.WithTransportCredentials(insecure.NewCredentials()), + grpc.WithKeepaliveParams(keepalive.ClientParameters{ + Timeout: defaultKeepAliveTimeout, + }), + } } // WithNetworkAddress returns option to specify @@ -115,3 +126,10 @@ func WithGRPCConn(v *grpc.ClientConn) Option { } } } + +// WithGRPCDialOptions returns an option to specify grpc.DialOption. +func WithGRPCDialOptions(opts []grpc.DialOption) Option { + return func(c *cfg) { + c.grpcDialOpts = append(c.grpcDialOpts, opts...) + } +} From 196241c4e79a823249282a3ee42b4b87a4ab7aa9 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Tue, 28 Feb 2023 16:20:59 +0300 Subject: [PATCH 1028/1196] [TrueCloudLab#5] .github: Fix CODEOWNERS Signed-off-by: Evgenii Stratonikov --- .github/CODEOWNERS | 1 + 1 file changed, 1 insertion(+) create mode 100644 .github/CODEOWNERS diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..b3c6cfa --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1 @@ +* @TrueCloudLab/storage-core @TrueCloudLab/storage-services @TrueCloudLab/committers From f69d2ad83c517f13d26ca3cb96bbb115601c675a Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Tue, 7 Mar 2023 13:38:56 +0300 Subject: [PATCH 1029/1196] Rename package name Due to source code relocation from GitHub. Signed-off-by: Alex Vanin --- accounting/accounting.go | 4 +- accounting/convert.go | 10 +- accounting/grpc/service.go | 4 +- accounting/grpc/service.pb.go | 20 +- accounting/grpc/types.pb.go | 16 +- accounting/json.go | 4 +- accounting/marshal.go | 6 +- accounting/message_test.go | 6 +- accounting/test/generate.go | 6 +- acl/bench_test.go | 6 +- acl/convert.go | 10 +- acl/grpc/types.go | 2 +- acl/grpc/types.pb.go | 16 +- acl/json.go | 4 +- acl/marshal.go | 6 +- acl/message_test.go | 6 +- acl/string.go | 2 +- acl/test/generate.go | 4 +- acl/types.go | 2 +- audit/convert.go | 10 +- audit/grpc/types.go | 2 +- audit/grpc/types.pb.go | 16 +- audit/json.go | 4 +- audit/marshal.go | 8 +- audit/message_test.go | 6 +- audit/test/generate.go | 4 +- audit/types.go | 2 +- container/attributes_test.go | 4 +- container/convert.go | 22 +- container/grpc/service.go | 6 +- container/grpc/service.pb.go | 22 +- container/grpc/service_grpc.pb.go | 108 +++--- container/grpc/types.go | 4 +- container/grpc/types.pb.go | 20 +- container/json.go | 4 +- container/marshal.go | 6 +- container/message_test.go | 6 +- container/status.go | 4 +- container/status_test.go | 4 +- container/test/generate.go | 10 +- container/types.go | 8 +- go.mod | 6 +- go.sum | 8 +- lock/grpc/types.go | 2 +- lock/grpc/types.pb.go | 16 +- netmap/attributes.go | 2 +- netmap/attributes_test.go | 6 +- netmap/convert.go | 10 +- netmap/grpc/service.go | 4 +- netmap/grpc/service.pb.go | 20 +- netmap/grpc/types.go | 2 +- netmap/grpc/types.pb.go | 16 +- netmap/json.go | 4 +- netmap/marshal.go | 6 +- netmap/message_test.go | 6 +- netmap/string.go | 2 +- netmap/test/generate.go | 6 +- netmap/types.go | 4 +- object/convert.go | 14 +- object/grpc/service.go | 4 +- object/grpc/service.pb.go | 19 +- object/grpc/service_grpc.pb.go | 490 ++++++++++++++------------- object/grpc/status.pb.go | 2 +- object/grpc/types.go | 4 +- object/grpc/types.pb.go | 18 +- object/json.go | 4 +- object/lock.go | 12 +- object/lock_test.go | 4 +- object/marshal.go | 8 +- object/message_test.go | 6 +- object/status.go | 4 +- object/status_test.go | 6 +- object/string.go | 2 +- object/test/generate.go | 10 +- object/types.go | 4 +- refs/convert.go | 6 +- refs/grpc/types.pb.go | 14 +- refs/json.go | 4 +- refs/marshal.go | 6 +- refs/message_test.go | 6 +- refs/string.go | 2 +- refs/test/generate.go | 2 +- refs/types_test.go | 2 +- reputation/convert.go | 10 +- reputation/grpc/service.go | 2 +- reputation/grpc/service.pb.go | 18 +- reputation/grpc/types.go | 2 +- reputation/grpc/types.pb.go | 18 +- reputation/json.go | 4 +- reputation/marshal.go | 6 +- reputation/message_test.go | 6 +- reputation/test/generate.go | 6 +- reputation/types.go | 4 +- rpc/accounting.go | 6 +- rpc/client/flows.go | 4 +- rpc/client/init.go | 4 +- rpc/client/stream_wrapper.go | 2 +- rpc/client/util.go | 2 +- rpc/common/call_test.go | 2 +- rpc/container.go | 6 +- rpc/message/encoding.go | 2 +- rpc/message/message.go | 2 +- rpc/message/test/message.go | 2 +- rpc/netmap.go | 6 +- rpc/object.go | 8 +- rpc/reputation.go | 6 +- rpc/session.go | 6 +- session/convert.go | 18 +- session/grpc/service.go | 2 +- session/grpc/service.pb.go | 17 +- session/grpc/types.go | 6 +- session/grpc/types.pb.go | 21 +- session/json.go | 4 +- session/marshal.go | 6 +- session/message_test.go | 6 +- session/status.go | 4 +- session/status_test.go | 4 +- session/string.go | 2 +- session/test/generate.go | 10 +- session/types.go | 8 +- session/util.go | 2 +- signature/sign.go | 16 +- signature/sign_test.go | 6 +- status/convert.go | 6 +- status/grpc/types.pb.go | 15 +- status/marshal.go | 6 +- status/message_test.go | 6 +- status/test/codes.go | 2 +- status/test/generate.go | 2 +- storagegroup/convert.go | 10 +- storagegroup/grpc/types.go | 2 +- storagegroup/grpc/types.pb.go | 19 +- storagegroup/json.go | 4 +- storagegroup/marshal.go | 8 +- storagegroup/message_test.go | 6 +- storagegroup/test/generate.go | 4 +- storagegroup/types.go | 2 +- subnet/encoding_test.go | 6 +- subnet/grpc/types.go | 2 +- subnet/grpc/types.pb.go | 17 +- subnet/info.go | 12 +- subnet/test/generate.go | 4 +- tombstone/convert.go | 8 +- tombstone/grpc/types.go | 2 +- tombstone/grpc/types.pb.go | 17 +- tombstone/json.go | 4 +- tombstone/marshal.go | 6 +- tombstone/message_test.go | 6 +- tombstone/test/generate.go | 4 +- tombstone/types.go | 2 +- util/proto/marshal_test.go | 4 +- util/protogen/main.go | 2 +- util/signature/data.go | 4 +- util/signature/options.go | 6 +- util/signature/sign_test.go | 2 +- util/signature/walletconnect/sign.go | 2 +- 156 files changed, 832 insertions(+), 823 deletions(-) diff --git a/accounting/accounting.go b/accounting/accounting.go index 25d6199..af14a1a 100644 --- a/accounting/accounting.go +++ b/accounting/accounting.go @@ -1,8 +1,8 @@ package accounting import ( - "github.com/TrueCloudLab/frostfs-api-go/v2/refs" - "github.com/TrueCloudLab/frostfs-api-go/v2/session" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session" ) type BalanceRequestBody struct { diff --git a/accounting/convert.go b/accounting/convert.go index d37fd1e..7a7f250 100644 --- a/accounting/convert.go +++ b/accounting/convert.go @@ -1,11 +1,11 @@ package accounting import ( - accounting "github.com/TrueCloudLab/frostfs-api-go/v2/accounting/grpc" - "github.com/TrueCloudLab/frostfs-api-go/v2/refs" - refsGRPC "github.com/TrueCloudLab/frostfs-api-go/v2/refs/grpc" - "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/grpc" - "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" + accounting "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/accounting/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" + refsGRPC "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message" ) func (b *BalanceRequestBody) ToGRPCMessage() grpc.Message { diff --git a/accounting/grpc/service.go b/accounting/grpc/service.go index 0570cd3..fa292bf 100644 --- a/accounting/grpc/service.go +++ b/accounting/grpc/service.go @@ -1,8 +1,8 @@ package accounting import ( - refs "github.com/TrueCloudLab/frostfs-api-go/v2/refs/grpc" - session "github.com/TrueCloudLab/frostfs-api-go/v2/session/grpc" + refs "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc" + session "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session/grpc" ) // SetOwnerId sets identifier of the account owner. diff --git a/accounting/grpc/service.pb.go b/accounting/grpc/service.pb.go index d0783f2..196c7ab 100644 --- a/accounting/grpc/service.pb.go +++ b/accounting/grpc/service.pb.go @@ -7,8 +7,8 @@ package accounting import ( - grpc1 "github.com/TrueCloudLab/frostfs-api-go/v2/refs/grpc" - grpc "github.com/TrueCloudLab/frostfs-api-go/v2/session/grpc" + grpc1 "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc" + grpc "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session/grpc" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -320,14 +320,14 @@ var file_accounting_grpc_service_proto_rawDesc = []byte{ 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, 0x67, 0x5a, 0x44, 0x67, 0x69, 0x74, - 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x54, 0x72, 0x75, 0x65, 0x43, 0x6c, 0x6f, 0x75, - 0x64, 0x4c, 0x61, 0x62, 0x2f, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, - 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 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, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x6d, 0x5a, 0x4a, 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, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 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, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/accounting/grpc/types.pb.go b/accounting/grpc/types.pb.go index 89a8c76..322a56c 100644 --- a/accounting/grpc/types.pb.go +++ b/accounting/grpc/types.pb.go @@ -95,14 +95,14 @@ var file_accounting_grpc_types_proto_rawDesc = []byte{ 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, 0x67, 0x5a, 0x44, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, - 0x2f, 0x54, 0x72, 0x75, 0x65, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x4c, 0x61, 0x62, 0x2f, 0x66, 0x72, - 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 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, 0x06, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, + 0x6f, 0x6e, 0x42, 0x6d, 0x5a, 0x4a, 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, 0x61, 0x70, 0x69, 0x2d, + 0x67, 0x6f, 0x2f, 0x76, 0x32, 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, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/accounting/json.go b/accounting/json.go index b0738f6..9ed5620 100644 --- a/accounting/json.go +++ b/accounting/json.go @@ -1,8 +1,8 @@ package accounting import ( - accounting "github.com/TrueCloudLab/frostfs-api-go/v2/accounting/grpc" - "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" + accounting "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/accounting/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message" ) func (d *Decimal) MarshalJSON() ([]byte, error) { diff --git a/accounting/marshal.go b/accounting/marshal.go index 06a1299..6961b3e 100644 --- a/accounting/marshal.go +++ b/accounting/marshal.go @@ -1,9 +1,9 @@ package accounting import ( - accounting "github.com/TrueCloudLab/frostfs-api-go/v2/accounting/grpc" - "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" - protoutil "github.com/TrueCloudLab/frostfs-api-go/v2/util/proto" + accounting "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/accounting/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message" + protoutil "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/proto" ) const ( diff --git a/accounting/message_test.go b/accounting/message_test.go index cdbac36..d193558 100644 --- a/accounting/message_test.go +++ b/accounting/message_test.go @@ -3,9 +3,9 @@ package accounting_test import ( "testing" - accountingtest "github.com/TrueCloudLab/frostfs-api-go/v2/accounting/test" - "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" - messagetest "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message/test" + accountingtest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/accounting/test" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message" + messagetest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message/test" ) func TestMessage(t *testing.T) { diff --git a/accounting/test/generate.go b/accounting/test/generate.go index 171693d..1eaf9f4 100644 --- a/accounting/test/generate.go +++ b/accounting/test/generate.go @@ -1,9 +1,9 @@ package accountingtest import ( - "github.com/TrueCloudLab/frostfs-api-go/v2/accounting" - accountingtest "github.com/TrueCloudLab/frostfs-api-go/v2/refs/test" - sessiontest "github.com/TrueCloudLab/frostfs-api-go/v2/session/test" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/accounting" + accountingtest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/test" + sessiontest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session/test" ) func GenerateBalanceRequest(empty bool) *accounting.BalanceRequest { diff --git a/acl/bench_test.go b/acl/bench_test.go index 0196176..8d6352b 100644 --- a/acl/bench_test.go +++ b/acl/bench_test.go @@ -3,9 +3,9 @@ package acl_test import ( "testing" - "github.com/TrueCloudLab/frostfs-api-go/v2/acl" - aclGrpc "github.com/TrueCloudLab/frostfs-api-go/v2/acl/grpc" - acltest "github.com/TrueCloudLab/frostfs-api-go/v2/acl/test" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/acl" + aclGrpc "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/acl/grpc" + acltest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/acl/test" ) func BenchmarkTable_ToGRPCMessage(b *testing.B) { diff --git a/acl/convert.go b/acl/convert.go index 697f699..d42aebd 100644 --- a/acl/convert.go +++ b/acl/convert.go @@ -1,11 +1,11 @@ package acl import ( - acl "github.com/TrueCloudLab/frostfs-api-go/v2/acl/grpc" - "github.com/TrueCloudLab/frostfs-api-go/v2/refs" - refsGRPC "github.com/TrueCloudLab/frostfs-api-go/v2/refs/grpc" - "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/grpc" - "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" + acl "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/acl/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" + refsGRPC "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message" ) // RoleToGRPCField converts unified role enum into grpc enum. diff --git a/acl/grpc/types.go b/acl/grpc/types.go index 436ae58..e1e5336 100644 --- a/acl/grpc/types.go +++ b/acl/grpc/types.go @@ -1,7 +1,7 @@ package acl import ( - refs "github.com/TrueCloudLab/frostfs-api-go/v2/refs/grpc" + refs "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc" ) // SetVersion sets version of EACL rules in table. diff --git a/acl/grpc/types.pb.go b/acl/grpc/types.pb.go index 6e9ac46..3581b88 100644 --- a/acl/grpc/types.pb.go +++ b/acl/grpc/types.pb.go @@ -7,7 +7,7 @@ package acl import ( - grpc "github.com/TrueCloudLab/frostfs-api-go/v2/refs/grpc" + grpc "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -932,13 +932,13 @@ var file_acl_grpc_types_proto_rawDesc = []byte{ 0x52, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x52, 0x45, 0x51, 0x55, 0x45, 0x53, 0x54, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x4f, 0x42, 0x4a, 0x45, 0x43, 0x54, 0x10, 0x02, 0x12, 0x0b, 0x0a, 0x07, 0x53, 0x45, 0x52, 0x56, - 0x49, 0x43, 0x45, 0x10, 0x03, 0x42, 0x52, 0x5a, 0x36, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, - 0x63, 0x6f, 0x6d, 0x2f, 0x54, 0x72, 0x75, 0x65, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x4c, 0x61, 0x62, - 0x2f, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, - 0x76, 0x32, 0x2f, 0x61, 0x63, 0x6c, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x61, 0x63, 0x6c, 0xaa, - 0x02, 0x17, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, - 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x41, 0x63, 0x6c, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x33, + 0x49, 0x43, 0x45, 0x10, 0x03, 0x42, 0x58, 0x5a, 0x3c, 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, 0x61, + 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x61, 0x63, 0x6c, 0x2f, 0x67, 0x72, 0x70, + 0x63, 0x3b, 0x61, 0x63, 0x6c, 0xaa, 0x02, 0x17, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, + 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x41, 0x63, 0x6c, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/acl/json.go b/acl/json.go index 7a50e90..0e2078b 100644 --- a/acl/json.go +++ b/acl/json.go @@ -1,8 +1,8 @@ package acl import ( - acl "github.com/TrueCloudLab/frostfs-api-go/v2/acl/grpc" - "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" + acl "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/acl/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message" ) func (f *HeaderFilter) MarshalJSON() ([]byte, error) { diff --git a/acl/marshal.go b/acl/marshal.go index 1ecdb70..c56b90f 100644 --- a/acl/marshal.go +++ b/acl/marshal.go @@ -1,9 +1,9 @@ package acl import ( - acl "github.com/TrueCloudLab/frostfs-api-go/v2/acl/grpc" - "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" - protoutil "github.com/TrueCloudLab/frostfs-api-go/v2/util/proto" + acl "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/acl/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message" + protoutil "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/proto" ) const ( diff --git a/acl/message_test.go b/acl/message_test.go index d3e70cf..8f340f1 100644 --- a/acl/message_test.go +++ b/acl/message_test.go @@ -3,9 +3,9 @@ package acl_test import ( "testing" - acltest "github.com/TrueCloudLab/frostfs-api-go/v2/acl/test" - "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" - messagetest "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message/test" + acltest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/acl/test" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message" + messagetest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message/test" ) func TestMessageConvert(t *testing.T) { diff --git a/acl/string.go b/acl/string.go index 76c0345..6dab037 100644 --- a/acl/string.go +++ b/acl/string.go @@ -1,7 +1,7 @@ package acl import ( - acl "github.com/TrueCloudLab/frostfs-api-go/v2/acl/grpc" + acl "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/acl/grpc" ) // String returns string representation of Action. diff --git a/acl/test/generate.go b/acl/test/generate.go index 67098cf..3151c52 100644 --- a/acl/test/generate.go +++ b/acl/test/generate.go @@ -1,8 +1,8 @@ package acltest import ( - "github.com/TrueCloudLab/frostfs-api-go/v2/acl" - accountingtest "github.com/TrueCloudLab/frostfs-api-go/v2/refs/test" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/acl" + accountingtest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/test" ) func GenerateBearerToken(empty bool) *acl.BearerToken { diff --git a/acl/types.go b/acl/types.go index f360af6..71d83ce 100644 --- a/acl/types.go +++ b/acl/types.go @@ -1,6 +1,6 @@ package acl -import "github.com/TrueCloudLab/frostfs-api-go/v2/refs" +import "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" // HeaderFilter is a unified structure of FilterInfo // message from proto definition. diff --git a/audit/convert.go b/audit/convert.go index 23a5ce6..a841928 100644 --- a/audit/convert.go +++ b/audit/convert.go @@ -1,11 +1,11 @@ package audit import ( - audit "github.com/TrueCloudLab/frostfs-api-go/v2/audit/grpc" - "github.com/TrueCloudLab/frostfs-api-go/v2/refs" - refsGRPC "github.com/TrueCloudLab/frostfs-api-go/v2/refs/grpc" - "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/grpc" - "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" + audit "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/audit/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" + refsGRPC "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message" ) func (a *DataAuditResult) ToGRPCMessage() grpc.Message { diff --git a/audit/grpc/types.go b/audit/grpc/types.go index 206fc88..59bb184 100644 --- a/audit/grpc/types.go +++ b/audit/grpc/types.go @@ -1,7 +1,7 @@ package audit import ( - refs "github.com/TrueCloudLab/frostfs-api-go/v2/refs/grpc" + refs "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc" ) // SetVersion is a Version field setter. diff --git a/audit/grpc/types.pb.go b/audit/grpc/types.pb.go index ceb0955..b542ec2 100644 --- a/audit/grpc/types.pb.go +++ b/audit/grpc/types.pb.go @@ -7,7 +7,7 @@ package audit import ( - grpc "github.com/TrueCloudLab/frostfs-api-go/v2/refs/grpc" + grpc "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -231,13 +231,13 @@ var file_audit_grpc_types_proto_rawDesc = []byte{ 0x73, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x0d, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x09, 0x70, 0x61, 0x73, 0x73, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x66, 0x61, 0x69, 0x6c, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x0e, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x09, 0x66, 0x61, - 0x69, 0x6c, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x42, 0x58, 0x5a, 0x3a, 0x67, 0x69, 0x74, 0x68, 0x75, - 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x54, 0x72, 0x75, 0x65, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x4c, - 0x61, 0x62, 0x2f, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, - 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x61, 0x75, 0x64, 0x69, 0x74, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, - 0x61, 0x75, 0x64, 0x69, 0x74, 0xaa, 0x02, 0x19, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, - 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x41, 0x75, 0x64, 0x69, - 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x69, 0x6c, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x42, 0x5e, 0x5a, 0x40, 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, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x61, 0x75, 0x64, 0x69, 0x74, + 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x61, 0x75, 0x64, 0x69, 0x74, 0xaa, 0x02, 0x19, 0x4e, 0x65, + 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, + 0x49, 0x2e, 0x41, 0x75, 0x64, 0x69, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/audit/json.go b/audit/json.go index 550977c..cbcf41f 100644 --- a/audit/json.go +++ b/audit/json.go @@ -1,8 +1,8 @@ package audit import ( - audit "github.com/TrueCloudLab/frostfs-api-go/v2/audit/grpc" - "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" + audit "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/audit/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message" ) func (a *DataAuditResult) MarshalJSON() ([]byte, error) { diff --git a/audit/marshal.go b/audit/marshal.go index 1560b21..a039baf 100644 --- a/audit/marshal.go +++ b/audit/marshal.go @@ -1,10 +1,10 @@ package audit import ( - audit "github.com/TrueCloudLab/frostfs-api-go/v2/audit/grpc" - "github.com/TrueCloudLab/frostfs-api-go/v2/refs" - "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" - "github.com/TrueCloudLab/frostfs-api-go/v2/util/proto" + audit "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/audit/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/proto" ) const ( diff --git a/audit/message_test.go b/audit/message_test.go index efbbca7..02c7f78 100644 --- a/audit/message_test.go +++ b/audit/message_test.go @@ -3,9 +3,9 @@ package audit_test import ( "testing" - audittest "github.com/TrueCloudLab/frostfs-api-go/v2/audit/test" - "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" - messagetest "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message/test" + audittest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/audit/test" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message" + messagetest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message/test" ) func TestMessageConvert(t *testing.T) { diff --git a/audit/test/generate.go b/audit/test/generate.go index 44c6d14..093cbfe 100644 --- a/audit/test/generate.go +++ b/audit/test/generate.go @@ -1,8 +1,8 @@ package audittest import ( - "github.com/TrueCloudLab/frostfs-api-go/v2/audit" - refstest "github.com/TrueCloudLab/frostfs-api-go/v2/refs/test" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/audit" + refstest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/test" ) func GenerateDataAuditResult(empty bool) *audit.DataAuditResult { diff --git a/audit/types.go b/audit/types.go index 14a0025..6f856f0 100644 --- a/audit/types.go +++ b/audit/types.go @@ -1,7 +1,7 @@ package audit import ( - "github.com/TrueCloudLab/frostfs-api-go/v2/refs" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" ) // DataAuditResult is a unified structure of diff --git a/container/attributes_test.go b/container/attributes_test.go index aa34b2a..fc5678c 100644 --- a/container/attributes_test.go +++ b/container/attributes_test.go @@ -3,8 +3,8 @@ package container_test import ( "testing" - "github.com/TrueCloudLab/frostfs-api-go/v2/container" - containertest "github.com/TrueCloudLab/frostfs-api-go/v2/container/test" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/container" + containertest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/container/test" "github.com/stretchr/testify/require" ) diff --git a/container/convert.go b/container/convert.go index 8e35efa..0753755 100644 --- a/container/convert.go +++ b/container/convert.go @@ -1,17 +1,17 @@ package container import ( - "github.com/TrueCloudLab/frostfs-api-go/v2/acl" - aclGRPC "github.com/TrueCloudLab/frostfs-api-go/v2/acl/grpc" - container "github.com/TrueCloudLab/frostfs-api-go/v2/container/grpc" - "github.com/TrueCloudLab/frostfs-api-go/v2/netmap" - netmapGRPC "github.com/TrueCloudLab/frostfs-api-go/v2/netmap/grpc" - "github.com/TrueCloudLab/frostfs-api-go/v2/refs" - refsGRPC "github.com/TrueCloudLab/frostfs-api-go/v2/refs/grpc" - "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/grpc" - "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" - "github.com/TrueCloudLab/frostfs-api-go/v2/session" - sessionGRPC "github.com/TrueCloudLab/frostfs-api-go/v2/session/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/acl" + aclGRPC "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/acl/grpc" + container "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/container/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/netmap" + netmapGRPC "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/netmap/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" + refsGRPC "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session" + sessionGRPC "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session/grpc" ) func (a *Attribute) ToGRPCMessage() grpc.Message { diff --git a/container/grpc/service.go b/container/grpc/service.go index ca5c4d9..050cf0b 100644 --- a/container/grpc/service.go +++ b/container/grpc/service.go @@ -1,9 +1,9 @@ package container import ( - acl "github.com/TrueCloudLab/frostfs-api-go/v2/acl/grpc" - refs "github.com/TrueCloudLab/frostfs-api-go/v2/refs/grpc" - session "github.com/TrueCloudLab/frostfs-api-go/v2/session/grpc" + acl "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/acl/grpc" + refs "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc" + session "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session/grpc" ) // SetContainer sets container of the request. diff --git a/container/grpc/service.pb.go b/container/grpc/service.pb.go index ed607e2..6786337 100644 --- a/container/grpc/service.pb.go +++ b/container/grpc/service.pb.go @@ -7,9 +7,9 @@ package container import ( - grpc2 "github.com/TrueCloudLab/frostfs-api-go/v2/acl/grpc" - grpc1 "github.com/TrueCloudLab/frostfs-api-go/v2/refs/grpc" - grpc "github.com/TrueCloudLab/frostfs-api-go/v2/session/grpc" + grpc2 "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/acl/grpc" + grpc1 "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc" + grpc "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session/grpc" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -2160,14 +2160,14 @@ var file_container_grpc_service_proto_rawDesc = []byte{ 0x70, 0x61, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2e, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x55, 0x73, 0x65, 0x64, 0x53, 0x70, - 0x61, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x64, 0x5a, 0x42, 0x67, - 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x54, 0x72, 0x75, 0x65, 0x43, 0x6c, - 0x6f, 0x75, 0x64, 0x4c, 0x61, 0x62, 0x2f, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2d, 0x61, - 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 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, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x61, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x6a, 0x5a, 0x48, 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, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 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, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/container/grpc/service_grpc.pb.go b/container/grpc/service_grpc.pb.go index 1de8b5f..3af498b 100644 --- a/container/grpc/service_grpc.pb.go +++ b/container/grpc/service_grpc.pb.go @@ -28,9 +28,9 @@ type ContainerServiceClient interface { // 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). + // - **OK** (0, SECTION_SUCCESS): \ + // request to save the container has been sent to the sidechain; + // - Common failures (SECTION_FAILURE_COMMON). 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 @@ -38,53 +38,53 @@ type ContainerServiceClient interface { // 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). + // - **OK** (0, SECTION_SUCCESS): \ + // request to remove the container has been sent to the sidechain; + // - Common failures (SECTION_FAILURE_COMMON). 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. + // - **OK** (0, SECTION_SUCCESS): \ + // container has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON); + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // requested container not found. Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*GetResponse, error) // 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). + // - **OK** (0, SECTION_SUCCESS): \ + // container list has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON). List(ctx context.Context, in *ListRequest, opts ...grpc.CallOption) (*ListResponse, error) // Invokes 'SetEACL' method of 'Container` smart contract and returns response // immediately. After one more block in sidechain, changes in an Extended ACL are // added into smart contract storage. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // request to save container eACL has been sent to the sidechain; - // - Common failures (SECTION_FAILURE_COMMON). + // - **OK** (0, SECTION_SUCCESS): \ + // request to save container eACL has been sent to the sidechain; + // - Common failures (SECTION_FAILURE_COMMON). SetExtendedACL(ctx context.Context, in *SetExtendedACLRequest, opts ...grpc.CallOption) (*SetExtendedACLResponse, error) // Returns Extended ACL table and signature from `Container` smart contract // storage. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // container eACL has been successfully read; - // - Common failures (SECTION_FAILURE_COMMON); - // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ - // container not found; - // - **EACL_NOT_FOUND** (3073, SECTION_CONTAINER): \ - // eACL table not found. + // - **OK** (0, SECTION_SUCCESS): \ + // container eACL has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON); + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // container not found; + // - **EACL_NOT_FOUND** (3073, SECTION_CONTAINER): \ + // eACL table not found. GetExtendedACL(ctx context.Context, in *GetExtendedACLRequest, opts ...grpc.CallOption) (*GetExtendedACLResponse, error) // Announces the space values used by the container for P2P synchronization. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // estimation of used space has been successfully announced; - // - Common failures (SECTION_FAILURE_COMMON). + // - **OK** (0, SECTION_SUCCESS): \ + // estimation of used space has been successfully announced; + // - Common failures (SECTION_FAILURE_COMMON). AnnounceUsedSpace(ctx context.Context, in *AnnounceUsedSpaceRequest, opts ...grpc.CallOption) (*AnnounceUsedSpaceResponse, error) } @@ -169,9 +169,9 @@ type ContainerServiceServer interface { // 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). + // - **OK** (0, SECTION_SUCCESS): \ + // request to save the container has been sent to the sidechain; + // - Common failures (SECTION_FAILURE_COMMON). 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 @@ -179,53 +179,53 @@ type ContainerServiceServer interface { // 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). + // - **OK** (0, SECTION_SUCCESS): \ + // request to remove the container has been sent to the sidechain; + // - Common failures (SECTION_FAILURE_COMMON). 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. + // - **OK** (0, SECTION_SUCCESS): \ + // container has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON); + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // requested container not found. Get(context.Context, *GetRequest) (*GetResponse, error) // 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). + // - **OK** (0, SECTION_SUCCESS): \ + // container list has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON). List(context.Context, *ListRequest) (*ListResponse, error) // Invokes 'SetEACL' method of 'Container` smart contract and returns response // immediately. After one more block in sidechain, changes in an Extended ACL are // added into smart contract storage. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // request to save container eACL has been sent to the sidechain; - // - Common failures (SECTION_FAILURE_COMMON). + // - **OK** (0, SECTION_SUCCESS): \ + // request to save container eACL has been sent to the sidechain; + // - Common failures (SECTION_FAILURE_COMMON). SetExtendedACL(context.Context, *SetExtendedACLRequest) (*SetExtendedACLResponse, error) // Returns Extended ACL table and signature from `Container` smart contract // storage. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // container eACL has been successfully read; - // - Common failures (SECTION_FAILURE_COMMON); - // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ - // container not found; - // - **EACL_NOT_FOUND** (3073, SECTION_CONTAINER): \ - // eACL table not found. + // - **OK** (0, SECTION_SUCCESS): \ + // container eACL has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON); + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // container not found; + // - **EACL_NOT_FOUND** (3073, SECTION_CONTAINER): \ + // eACL table not found. GetExtendedACL(context.Context, *GetExtendedACLRequest) (*GetExtendedACLResponse, error) // Announces the space values used by the container for P2P synchronization. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // estimation of used space has been successfully announced; - // - Common failures (SECTION_FAILURE_COMMON). + // - **OK** (0, SECTION_SUCCESS): \ + // estimation of used space has been successfully announced; + // - Common failures (SECTION_FAILURE_COMMON). AnnounceUsedSpace(context.Context, *AnnounceUsedSpaceRequest) (*AnnounceUsedSpaceResponse, error) } diff --git a/container/grpc/types.go b/container/grpc/types.go index 91e9470..7308f9e 100644 --- a/container/grpc/types.go +++ b/container/grpc/types.go @@ -1,8 +1,8 @@ package container import ( - netmap "github.com/TrueCloudLab/frostfs-api-go/v2/netmap/grpc" - refs "github.com/TrueCloudLab/frostfs-api-go/v2/refs/grpc" + netmap "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/netmap/grpc" + refs "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc" ) // SetKey sets key to the container attribute. diff --git a/container/grpc/types.pb.go b/container/grpc/types.pb.go index 0b78b3f..75796c2 100644 --- a/container/grpc/types.pb.go +++ b/container/grpc/types.pb.go @@ -7,8 +7,8 @@ package container import ( - grpc1 "github.com/TrueCloudLab/frostfs-api-go/v2/netmap/grpc" - grpc "github.com/TrueCloudLab/frostfs-api-go/v2/refs/grpc" + grpc1 "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/netmap/grpc" + grpc "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -242,14 +242,14 @@ var file_container_grpc_types_proto_rawDesc = []byte{ 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, 0x64, 0x5a, 0x42, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, - 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x54, 0x72, 0x75, 0x65, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x4c, 0x61, - 0x62, 0x2f, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, - 0x2f, 0x76, 0x32, 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, 0x06, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x6a, 0x5a, 0x48, 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, + 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 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, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/container/json.go b/container/json.go index ac8bdf3..d9fc4f6 100644 --- a/container/json.go +++ b/container/json.go @@ -1,8 +1,8 @@ package container import ( - container "github.com/TrueCloudLab/frostfs-api-go/v2/container/grpc" - "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" + container "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/container/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message" ) func (a *Attribute) MarshalJSON() ([]byte, error) { diff --git a/container/marshal.go b/container/marshal.go index a7f77ab..98b32b4 100644 --- a/container/marshal.go +++ b/container/marshal.go @@ -1,9 +1,9 @@ package container import ( - container "github.com/TrueCloudLab/frostfs-api-go/v2/container/grpc" - "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" - protoutil "github.com/TrueCloudLab/frostfs-api-go/v2/util/proto" + container "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/container/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message" + protoutil "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/proto" ) const ( diff --git a/container/message_test.go b/container/message_test.go index 62e1914..869ccb2 100644 --- a/container/message_test.go +++ b/container/message_test.go @@ -3,9 +3,9 @@ package container_test import ( "testing" - containertest "github.com/TrueCloudLab/frostfs-api-go/v2/container/test" - "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" - messagetest "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message/test" + containertest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/container/test" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message" + messagetest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message/test" ) func TestMessageConvert(t *testing.T) { diff --git a/container/status.go b/container/status.go index d5aa147..f44fce9 100644 --- a/container/status.go +++ b/container/status.go @@ -1,8 +1,8 @@ package container import ( - "github.com/TrueCloudLab/frostfs-api-go/v2/status" - statusgrpc "github.com/TrueCloudLab/frostfs-api-go/v2/status/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/status" + statusgrpc "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/status/grpc" ) // LocalizeFailStatus checks if passed global status.Code is related to container failure and: diff --git a/container/status_test.go b/container/status_test.go index adbfd2f..57787b1 100644 --- a/container/status_test.go +++ b/container/status_test.go @@ -3,8 +3,8 @@ package container_test import ( "testing" - "github.com/TrueCloudLab/frostfs-api-go/v2/container" - statustest "github.com/TrueCloudLab/frostfs-api-go/v2/status/test" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/container" + statustest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/status/test" ) func TestStatusCodes(t *testing.T) { diff --git a/container/test/generate.go b/container/test/generate.go index 82f378a..00a0955 100644 --- a/container/test/generate.go +++ b/container/test/generate.go @@ -1,11 +1,11 @@ package containertest import ( - acltest "github.com/TrueCloudLab/frostfs-api-go/v2/acl/test" - "github.com/TrueCloudLab/frostfs-api-go/v2/container" - netmaptest "github.com/TrueCloudLab/frostfs-api-go/v2/netmap/test" - refstest "github.com/TrueCloudLab/frostfs-api-go/v2/refs/test" - sessiontest "github.com/TrueCloudLab/frostfs-api-go/v2/session/test" + acltest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/acl/test" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/container" + netmaptest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/netmap/test" + refstest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/test" + sessiontest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session/test" ) func GenerateAttribute(empty bool) *container.Attribute { diff --git a/container/types.go b/container/types.go index fdb35f8..948580d 100644 --- a/container/types.go +++ b/container/types.go @@ -1,10 +1,10 @@ package container import ( - "github.com/TrueCloudLab/frostfs-api-go/v2/acl" - "github.com/TrueCloudLab/frostfs-api-go/v2/netmap" - "github.com/TrueCloudLab/frostfs-api-go/v2/refs" - "github.com/TrueCloudLab/frostfs-api-go/v2/session" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/acl" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/netmap" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session" ) type Attribute struct { diff --git a/go.mod b/go.mod index 4eddb9e..25445da 100644 --- a/go.mod +++ b/go.mod @@ -1,16 +1,16 @@ -module github.com/TrueCloudLab/frostfs-api-go/v2 +module git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 go 1.17 require ( - github.com/TrueCloudLab/frostfs-crypto v0.5.0 + git.frostfs.info/TrueCloudLab/frostfs-crypto v0.6.0 github.com/stretchr/testify v1.7.0 google.golang.org/grpc v1.48.0 google.golang.org/protobuf v1.28.0 ) require ( - github.com/TrueCloudLab/rfc6979 v0.3.0 // indirect + git.frostfs.info/TrueCloudLab/rfc6979 v0.4.0 // indirect github.com/davecgh/go-spew v1.1.0 // indirect github.com/golang/protobuf v1.5.2 // indirect github.com/mr-tron/base58 v1.2.0 // indirect diff --git a/go.sum b/go.sum index 68f8351..34f4d44 100644 --- a/go.sum +++ b/go.sum @@ -1,10 +1,10 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +git.frostfs.info/TrueCloudLab/frostfs-crypto v0.6.0 h1:FxqFDhQYYgpe41qsIHVOcdzSVCB8JNSfPG7Uk4r2oSk= +git.frostfs.info/TrueCloudLab/frostfs-crypto v0.6.0/go.mod h1:RUIKZATQLJ+TaYQa60X2fTDwfuhMfm8Ar60bQ5fr+vU= +git.frostfs.info/TrueCloudLab/rfc6979 v0.4.0 h1:M2KR3iBj7WpY3hP10IevfIB9MURr4O9mwVfJ+SjT3HA= +git.frostfs.info/TrueCloudLab/rfc6979 v0.4.0/go.mod h1:okpbKfVYf/BpejtfFTfhZqFP+sZ8rsHrP8Rr/jYPNRc= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/TrueCloudLab/frostfs-crypto v0.5.0 h1:ZoLjixSkQv3j1EwZ1WJzMEJY2NR+9nO4Pd8WSyM/RRI= -github.com/TrueCloudLab/frostfs-crypto v0.5.0/go.mod h1:775MUewpH8AWpXrimAG2NYWOXB6lpKOI5kqgu+eI5zs= -github.com/TrueCloudLab/rfc6979 v0.3.0 h1:0SYMAfQWh/TjnofqYQHy+s3rmQ5gi0fvOaDbqd60/Ic= -github.com/TrueCloudLab/rfc6979 v0.3.0/go.mod h1:qylxFXFQ/sMvpZC/8JyWp+mfzk5Zj/KDT5FAbekhobc= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= diff --git a/lock/grpc/types.go b/lock/grpc/types.go index d39c134..9d5719f 100644 --- a/lock/grpc/types.go +++ b/lock/grpc/types.go @@ -1,6 +1,6 @@ package lock -import refs "github.com/TrueCloudLab/frostfs-api-go/v2/refs/grpc" +import refs "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc" // SetMembers sets `members` field. func (x *Lock) SetMembers(ids []*refs.ObjectID) { diff --git a/lock/grpc/types.pb.go b/lock/grpc/types.pb.go index 35bef9e..01e263a 100644 --- a/lock/grpc/types.pb.go +++ b/lock/grpc/types.pb.go @@ -7,7 +7,7 @@ package lock import ( - grpc "github.com/TrueCloudLab/frostfs-api-go/v2/refs/grpc" + grpc "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -84,13 +84,13 @@ var file_lock_grpc_types_proto_rawDesc = []byte{ 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, 0x55, 0x5a, 0x38, 0x67, 0x69, - 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x54, 0x72, 0x75, 0x65, 0x43, 0x6c, 0x6f, - 0x75, 0x64, 0x4c, 0x61, 0x62, 0x2f, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2d, 0x61, 0x70, - 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 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, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x44, 0x52, 0x07, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x42, 0x5b, 0x5a, 0x3e, 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, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 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, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/netmap/attributes.go b/netmap/attributes.go index 6901da5..719d882 100644 --- a/netmap/attributes.go +++ b/netmap/attributes.go @@ -5,7 +5,7 @@ import ( "fmt" "strings" - "github.com/TrueCloudLab/frostfs-api-go/v2/refs" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" ) // prefix of keys to subnet attributes. diff --git a/netmap/attributes_test.go b/netmap/attributes_test.go index 0385f42..6d5b9ea 100644 --- a/netmap/attributes_test.go +++ b/netmap/attributes_test.go @@ -4,9 +4,9 @@ import ( "strconv" "testing" - "github.com/TrueCloudLab/frostfs-api-go/v2/netmap" - netmaptest "github.com/TrueCloudLab/frostfs-api-go/v2/netmap/test" - "github.com/TrueCloudLab/frostfs-api-go/v2/refs" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/netmap" + netmaptest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/netmap/test" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" "github.com/stretchr/testify/require" ) diff --git a/netmap/convert.go b/netmap/convert.go index 36af646..cc20d36 100644 --- a/netmap/convert.go +++ b/netmap/convert.go @@ -1,11 +1,11 @@ package netmap import ( - netmap "github.com/TrueCloudLab/frostfs-api-go/v2/netmap/grpc" - "github.com/TrueCloudLab/frostfs-api-go/v2/refs" - refsGRPC "github.com/TrueCloudLab/frostfs-api-go/v2/refs/grpc" - "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/grpc" - "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" + netmap "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/netmap/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" + refsGRPC "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message" ) func (f *Filter) ToGRPCMessage() grpc.Message { diff --git a/netmap/grpc/service.go b/netmap/grpc/service.go index ad72ced..882db6b 100644 --- a/netmap/grpc/service.go +++ b/netmap/grpc/service.go @@ -1,8 +1,8 @@ package netmap import ( - refs "github.com/TrueCloudLab/frostfs-api-go/v2/refs/grpc" - session "github.com/TrueCloudLab/frostfs-api-go/v2/session/grpc" + refs "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc" + session "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session/grpc" ) // SetBody sets body of the request. diff --git a/netmap/grpc/service.pb.go b/netmap/grpc/service.pb.go index 64859ae..d74d7c3 100644 --- a/netmap/grpc/service.pb.go +++ b/netmap/grpc/service.pb.go @@ -7,8 +7,8 @@ package netmap import ( - grpc1 "github.com/TrueCloudLab/frostfs-api-go/v2/refs/grpc" - grpc "github.com/TrueCloudLab/frostfs-api-go/v2/session/grpc" + grpc1 "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc" + grpc "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session/grpc" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -854,14 +854,14 @@ var file_netmap_grpc_service_proto_rawDesc = []byte{ 0x6d, 0x61, 0x70, 0x53, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x28, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x53, 0x6e, 0x61, 0x70, - 0x73, 0x68, 0x6f, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x5b, 0x5a, 0x3c, - 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x54, 0x72, 0x75, 0x65, 0x43, - 0x6c, 0x6f, 0x75, 0x64, 0x4c, 0x61, 0x62, 0x2f, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2d, - 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, - 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0xaa, 0x02, 0x1a, 0x4e, - 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, - 0x50, 0x49, 0x2e, 0x4e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x33, + 0x73, 0x68, 0x6f, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x61, 0x5a, 0x42, + 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, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, + 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x6e, 0x65, 0x74, 0x6d, + 0x61, 0x70, 0xaa, 0x02, 0x1a, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, + 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x4e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/netmap/grpc/types.go b/netmap/grpc/types.go index b97a0c8..d0bf41a 100644 --- a/netmap/grpc/types.go +++ b/netmap/grpc/types.go @@ -1,6 +1,6 @@ package netmap -import refs "github.com/TrueCloudLab/frostfs-api-go/v2/refs/grpc" +import refs "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc" // SetReplicas of placement policy. func (m *PlacementPolicy) SetReplicas(v []*Replica) { diff --git a/netmap/grpc/types.pb.go b/netmap/grpc/types.pb.go index 5d2237b..92fea20 100644 --- a/netmap/grpc/types.pb.go +++ b/netmap/grpc/types.pb.go @@ -7,7 +7,7 @@ package netmap import ( - grpc "github.com/TrueCloudLab/frostfs-api-go/v2/refs/grpc" + grpc "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -1145,13 +1145,13 @@ var file_netmap_grpc_types_proto_rawDesc = []byte{ 0x73, 0x65, 0x12, 0x16, 0x0a, 0x12, 0x43, 0x4c, 0x41, 0x55, 0x53, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x53, 0x41, 0x4d, 0x45, 0x10, 0x01, 0x12, 0x0c, 0x0a, 0x08, 0x44, 0x49, 0x53, 0x54, 0x49, 0x4e, 0x43, 0x54, - 0x10, 0x02, 0x42, 0x5b, 0x5a, 0x3c, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, - 0x2f, 0x54, 0x72, 0x75, 0x65, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x4c, 0x61, 0x62, 0x2f, 0x66, 0x72, - 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, - 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x6e, 0x65, 0x74, 0x6d, - 0x61, 0x70, 0xaa, 0x02, 0x1a, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, - 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x4e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x10, 0x02, 0x42, 0x61, 0x5a, 0x42, 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, 0x61, 0x70, 0x69, 0x2d, + 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2f, 0x67, 0x72, 0x70, + 0x63, 0x3b, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0xaa, 0x02, 0x1a, 0x4e, 0x65, 0x6f, 0x2e, 0x46, + 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x4e, + 0x65, 0x74, 0x6d, 0x61, 0x70, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/netmap/json.go b/netmap/json.go index aed469c..6eacb96 100644 --- a/netmap/json.go +++ b/netmap/json.go @@ -1,8 +1,8 @@ package netmap import ( - netmap "github.com/TrueCloudLab/frostfs-api-go/v2/netmap/grpc" - "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" + netmap "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/netmap/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message" ) func (p *PlacementPolicy) MarshalJSON() ([]byte, error) { diff --git a/netmap/marshal.go b/netmap/marshal.go index d006f92..e08d6f0 100644 --- a/netmap/marshal.go +++ b/netmap/marshal.go @@ -1,9 +1,9 @@ package netmap import ( - netmap "github.com/TrueCloudLab/frostfs-api-go/v2/netmap/grpc" - "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" - protoutil "github.com/TrueCloudLab/frostfs-api-go/v2/util/proto" + netmap "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/netmap/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message" + protoutil "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/proto" ) const ( diff --git a/netmap/message_test.go b/netmap/message_test.go index 2ebec3c..fe78ffe 100644 --- a/netmap/message_test.go +++ b/netmap/message_test.go @@ -3,9 +3,9 @@ package netmap_test import ( "testing" - netmaptest "github.com/TrueCloudLab/frostfs-api-go/v2/netmap/test" - "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" - messagetest "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message/test" + netmaptest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/netmap/test" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message" + messagetest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message/test" ) func TestMessageConvert(t *testing.T) { diff --git a/netmap/string.go b/netmap/string.go index 0c2a491..1f00a55 100644 --- a/netmap/string.go +++ b/netmap/string.go @@ -1,7 +1,7 @@ package netmap import ( - netmap "github.com/TrueCloudLab/frostfs-api-go/v2/netmap/grpc" + netmap "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/netmap/grpc" ) // String returns string representation of Clause. diff --git a/netmap/test/generate.go b/netmap/test/generate.go index 835e7f1..30e200e 100644 --- a/netmap/test/generate.go +++ b/netmap/test/generate.go @@ -1,9 +1,9 @@ package netmaptest import ( - "github.com/TrueCloudLab/frostfs-api-go/v2/netmap" - refstest "github.com/TrueCloudLab/frostfs-api-go/v2/refs/test" - sessiontest "github.com/TrueCloudLab/frostfs-api-go/v2/session/test" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/netmap" + refstest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/test" + sessiontest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session/test" ) func GenerateFilter(empty bool) *netmap.Filter { diff --git a/netmap/types.go b/netmap/types.go index dc76f80..c878184 100644 --- a/netmap/types.go +++ b/netmap/types.go @@ -1,8 +1,8 @@ package netmap import ( - "github.com/TrueCloudLab/frostfs-api-go/v2/refs" - "github.com/TrueCloudLab/frostfs-api-go/v2/session" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session" ) type LocalNodeInfoRequest struct { diff --git a/object/convert.go b/object/convert.go index 82eba35..95fde3c 100644 --- a/object/convert.go +++ b/object/convert.go @@ -3,13 +3,13 @@ package object import ( "fmt" - object "github.com/TrueCloudLab/frostfs-api-go/v2/object/grpc" - "github.com/TrueCloudLab/frostfs-api-go/v2/refs" - refsGRPC "github.com/TrueCloudLab/frostfs-api-go/v2/refs/grpc" - "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/grpc" - "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" - "github.com/TrueCloudLab/frostfs-api-go/v2/session" - sessionGRPC "github.com/TrueCloudLab/frostfs-api-go/v2/session/grpc" + object "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/object/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" + refsGRPC "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session" + sessionGRPC "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session/grpc" ) func TypeToGRPCField(t Type) object.ObjectType { diff --git a/object/grpc/service.go b/object/grpc/service.go index d85d44b..44b5f4a 100644 --- a/object/grpc/service.go +++ b/object/grpc/service.go @@ -1,8 +1,8 @@ package object import ( - refs "github.com/TrueCloudLab/frostfs-api-go/v2/refs/grpc" - session "github.com/TrueCloudLab/frostfs-api-go/v2/session/grpc" + refs "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc" + session "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session/grpc" ) // SetAddress sets address of the requested object. diff --git a/object/grpc/service.pb.go b/object/grpc/service.pb.go index 5821b77..207b0b0 100644 --- a/object/grpc/service.pb.go +++ b/object/grpc/service.pb.go @@ -7,8 +7,8 @@ package object import ( - grpc1 "github.com/TrueCloudLab/frostfs-api-go/v2/refs/grpc" - grpc "github.com/TrueCloudLab/frostfs-api-go/v2/session/grpc" + grpc1 "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc" + grpc "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session/grpc" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -2751,13 +2751,14 @@ var file_object_grpc_service_proto_rawDesc = []byte{ 0x61, 0x6e, 0x67, 0x65, 0x48, 0x61, 0x73, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x26, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x48, 0x61, 0x73, 0x68, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x5b, 0x5a, 0x3c, 0x67, 0x69, 0x74, 0x68, 0x75, - 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x54, 0x72, 0x75, 0x65, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x4c, - 0x61, 0x62, 0x2f, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, - 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2f, 0x67, 0x72, 0x70, 0x63, - 0x3b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0xaa, 0x02, 0x1a, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, - 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x4f, 0x62, - 0x6a, 0x65, 0x63, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x61, 0x5a, 0x42, 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, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x6f, 0x62, 0x6a, 0x65, 0x63, + 0x74, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0xaa, 0x02, 0x1a, + 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, + 0x41, 0x50, 0x49, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, } var ( diff --git a/object/grpc/service_grpc.pb.go b/object/grpc/service_grpc.pb.go index 8864e00..172998c 100644 --- a/object/grpc/service_grpc.pb.go +++ b/object/grpc/service_grpc.pb.go @@ -30,30 +30,30 @@ type ObjectServiceClient interface { // keeping the receiving order. // // Extended headers can change `Get` behaviour: - // * __NEOFS__NETMAP_EPOCH \ - // Will use the requsted version of Network Map for object placement - // calculation. - // * __NEOFS__NETMAP_LOOKUP_DEPTH \ - // Will try older versions (starting from `__NEOFS__NETMAP_EPOCH` if specified or - // the latest one otherwise) of Network Map to find an object until the depth - // limit is reached. + // - __NEOFS__NETMAP_EPOCH \ + // Will use the requsted version of Network Map for object placement + // calculation. + // - __NEOFS__NETMAP_LOOKUP_DEPTH \ + // Will try older versions (starting from `__NEOFS__NETMAP_EPOCH` if specified or + // the latest one otherwise) of Network Map to find an object until the depth + // limit is reached. // // Please refer to detailed `XHeader` description. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // object has been successfully read; - // - Common failures (SECTION_FAILURE_COMMON); - // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ - // read access to the object is denied; - // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ - // object not found in container; - // - **OBJECT_ALREADY_REMOVED** (2052, SECTION_OBJECT): \ - // the requested object has been marked as deleted; - // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ - // object container not found; - // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ - // provided session token has expired. + // - **OK** (0, SECTION_SUCCESS): \ + // object has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON); + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // read access to the object is denied; + // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ + // object not found in container; + // - **OBJECT_ALREADY_REMOVED** (2052, SECTION_OBJECT): \ + // the requested object has been marked as deleted; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // object container not found; + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (ObjectService_GetClient, error) // Put the object into container. Request uses gRPC stream. First message // SHOULD be of PutHeader type. `ContainerID` and `OwnerID` of an object @@ -63,102 +63,103 @@ type ObjectServiceClient interface { // Chunk messages SHOULD be sent in the direct order of fragmentation. // // Extended headers can change `Put` behaviour: - // * __NEOFS__NETMAP_EPOCH \ - // Will use the requsted version of Network Map for object placement - // calculation. + // - __NEOFS__NETMAP_EPOCH \ + // Will use the requsted version of Network Map for object placement + // calculation. // // Please refer to detailed `XHeader` description. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // object has been successfully saved in the container; - // - Common failures (SECTION_FAILURE_COMMON); - // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ - // write access to the container is denied; - // - **LOCKED** (2050, SECTION_OBJECT): \ - // placement of an object of type TOMBSTONE that includes at least one locked - // object is prohibited; - // - **LOCK_NON_REGULAR_OBJECT** (2051, SECTION_OBJECT): \ - // placement of an object of type LOCK that includes at least one object of - // type other than REGULAR is prohibited; - // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ - // object storage container not found; - // - **TOKEN_NOT_FOUND** (4096, SECTION_SESSION): \ - // (for trusted object preparation) session private key does not exist or has + // - **OK** (0, SECTION_SUCCESS): \ + // object has been successfully saved in the container; + // - Common failures (SECTION_FAILURE_COMMON); + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // write access to the container is denied; + // - **LOCKED** (2050, SECTION_OBJECT): \ + // placement of an object of type TOMBSTONE that includes at least one locked + // object is prohibited; + // - **LOCK_NON_REGULAR_OBJECT** (2051, SECTION_OBJECT): \ + // placement of an object of type LOCK that includes at least one object of + // type other than REGULAR is prohibited; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // object storage container not found; + // - **TOKEN_NOT_FOUND** (4096, SECTION_SESSION): \ + // (for trusted object preparation) session private key does not exist or has + // // been deleted; - // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ - // provided session token has expired. + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. Put(ctx context.Context, opts ...grpc.CallOption) (ObjectService_PutClient, error) // Delete the object from a container. There is no immediate removal // guarantee. Object will be marked for removal and deleted eventually. // // Extended headers can change `Delete` behaviour: - // * __NEOFS__NETMAP_EPOCH \ - // Will use the requsted version of Network Map for object placement - // calculation. + // - __NEOFS__NETMAP_EPOCH \ + // Will use the requsted version of Network Map for object placement + // calculation. // // Please refer to detailed `XHeader` description. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // object has been successfully marked to be removed from the container; - // - Common failures (SECTION_FAILURE_COMMON); - // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ - // delete access to the object is denied; - // - **LOCKED** (2050, SECTION_OBJECT): \ - // deleting a locked object is prohibited; - // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ - // object container not found; - // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ - // provided session token has expired. + // - **OK** (0, SECTION_SUCCESS): \ + // object has been successfully marked to be removed from the container; + // - Common failures (SECTION_FAILURE_COMMON); + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // delete access to the object is denied; + // - **LOCKED** (2050, SECTION_OBJECT): \ + // deleting a locked object is prohibited; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // object container not found; + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteResponse, error) // Returns the object Headers without data payload. By default full header is // returned. If `main_only` request field is set, the short header with only // the very minimal information will be returned instead. // // Extended headers can change `Head` behaviour: - // * __NEOFS__NETMAP_EPOCH \ - // Will use the requsted version of Network Map for object placement - // calculation. + // - __NEOFS__NETMAP_EPOCH \ + // Will use the requsted version of Network Map for object placement + // calculation. // // Please refer to detailed `XHeader` description. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // object header has been successfully read; - // - Common failures (SECTION_FAILURE_COMMON); - // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ - // access to operation HEAD of the object is denied; - // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ - // object not found in container; - // - **OBJECT_ALREADY_REMOVED** (2052, SECTION_OBJECT): \ - // the requested object has been marked as deleted; - // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ - // object container not found; - // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ - // provided session token has expired. + // - **OK** (0, SECTION_SUCCESS): \ + // object header has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON); + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // access to operation HEAD of the object is denied; + // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ + // object not found in container; + // - **OBJECT_ALREADY_REMOVED** (2052, SECTION_OBJECT): \ + // the requested object has been marked as deleted; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // object container not found; + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. Head(ctx context.Context, in *HeadRequest, opts ...grpc.CallOption) (*HeadResponse, error) // Search objects in container. Search query allows to match by Object // Header's filed values. Please see the corresponding NeoFS Technical // Specification section for more details. // // Extended headers can change `Search` behaviour: - // * __NEOFS__NETMAP_EPOCH \ - // Will use the requsted version of Network Map for object placement - // calculation. + // - __NEOFS__NETMAP_EPOCH \ + // Will use the requsted version of Network Map for object placement + // calculation. // // Please refer to detailed `XHeader` description. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // objects have been successfully selected; - // - Common failures (SECTION_FAILURE_COMMON); - // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ - // access to operation SEARCH of the object is denied; - // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ - // search container not found; - // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ - // provided session token has expired. + // - **OK** (0, SECTION_SUCCESS): \ + // objects have been successfully selected; + // - Common failures (SECTION_FAILURE_COMMON); + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // access to operation SEARCH of the object is denied; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // search container not found; + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. Search(ctx context.Context, in *SearchRequest, opts ...grpc.CallOption) (ObjectService_SearchClient, error) // Get byte range of data payload. Range is set as an (offset, length) tuple. // Like in `Get` method, the response uses gRPC stream. Requested range can be @@ -166,31 +167,31 @@ type ObjectServiceClient interface { // order. // // Extended headers can change `GetRange` behaviour: - // * __NEOFS__NETMAP_EPOCH \ - // Will use the requsted version of Network Map for object placement - // calculation. - // * __NEOFS__NETMAP_LOOKUP_DEPTH \ - // Will try older versions of Network Map to find an object until the depth - // limit is reached. + // - __NEOFS__NETMAP_EPOCH \ + // Will use the requsted version of Network Map for object placement + // calculation. + // - __NEOFS__NETMAP_LOOKUP_DEPTH \ + // Will try older versions of Network Map to find an object until the depth + // limit is reached. // // Please refer to detailed `XHeader` description. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // data range of the object payload has been successfully read; - // - Common failures (SECTION_FAILURE_COMMON); - // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ - // access to operation RANGE of the object is denied; - // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ - // object not found in container; - // - **OBJECT_ALREADY_REMOVED** (2052, SECTION_OBJECT): \ - // the requested object has been marked as deleted. - // - **OUT_OF_RANGE** (2053, SECTION_OBJECT): \ - // the requested range is out of bounds; - // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ - // object container not found; - // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ - // provided session token has expired. + // - **OK** (0, SECTION_SUCCESS): \ + // data range of the object payload has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON); + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // access to operation RANGE of the object is denied; + // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ + // object not found in container; + // - **OBJECT_ALREADY_REMOVED** (2052, SECTION_OBJECT): \ + // the requested object has been marked as deleted. + // - **OUT_OF_RANGE** (2053, SECTION_OBJECT): \ + // the requested range is out of bounds; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // object container not found; + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. GetRange(ctx context.Context, in *GetRangeRequest, opts ...grpc.CallOption) (ObjectService_GetRangeClient, error) // Returns homomorphic or regular hash of object's payload range after // applying XOR operation with the provided `salt`. Ranges are set of (offset, @@ -198,29 +199,29 @@ type ObjectServiceClient interface { // the request. Note that hash is calculated for XORed data. // // Extended headers can change `GetRangeHash` behaviour: - // * __NEOFS__NETMAP_EPOCH \ - // Will use the requsted version of Network Map for object placement - // calculation. - // * __NEOFS__NETMAP_LOOKUP_DEPTH \ - // Will try older versions of Network Map to find an object until the depth - // limit is reached. + // - __NEOFS__NETMAP_EPOCH \ + // Will use the requsted version of Network Map for object placement + // calculation. + // - __NEOFS__NETMAP_LOOKUP_DEPTH \ + // Will try older versions of Network Map to find an object until the depth + // limit is reached. // // Please refer to detailed `XHeader` description. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // data range of the object payload has been successfully hashed; - // - Common failures (SECTION_FAILURE_COMMON); - // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ - // access to operation RANGEHASH of the object is denied; - // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ - // object not found in container; - // - **OUT_OF_RANGE** (2053, SECTION_OBJECT): \ - // the requested range is out of bounds; - // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ - // object container not found; - // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ - // provided session token has expired. + // - **OK** (0, SECTION_SUCCESS): \ + // data range of the object payload has been successfully hashed; + // - Common failures (SECTION_FAILURE_COMMON); + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // access to operation RANGEHASH of the object is denied; + // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ + // object not found in container; + // - **OUT_OF_RANGE** (2053, SECTION_OBJECT): \ + // the requested range is out of bounds; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // object container not found; + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. GetRangeHash(ctx context.Context, in *GetRangeHashRequest, opts ...grpc.CallOption) (*GetRangeHashResponse, error) } @@ -401,30 +402,30 @@ type ObjectServiceServer interface { // keeping the receiving order. // // Extended headers can change `Get` behaviour: - // * __NEOFS__NETMAP_EPOCH \ - // Will use the requsted version of Network Map for object placement - // calculation. - // * __NEOFS__NETMAP_LOOKUP_DEPTH \ - // Will try older versions (starting from `__NEOFS__NETMAP_EPOCH` if specified or - // the latest one otherwise) of Network Map to find an object until the depth - // limit is reached. + // - __NEOFS__NETMAP_EPOCH \ + // Will use the requsted version of Network Map for object placement + // calculation. + // - __NEOFS__NETMAP_LOOKUP_DEPTH \ + // Will try older versions (starting from `__NEOFS__NETMAP_EPOCH` if specified or + // the latest one otherwise) of Network Map to find an object until the depth + // limit is reached. // // Please refer to detailed `XHeader` description. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // object has been successfully read; - // - Common failures (SECTION_FAILURE_COMMON); - // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ - // read access to the object is denied; - // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ - // object not found in container; - // - **OBJECT_ALREADY_REMOVED** (2052, SECTION_OBJECT): \ - // the requested object has been marked as deleted; - // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ - // object container not found; - // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ - // provided session token has expired. + // - **OK** (0, SECTION_SUCCESS): \ + // object has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON); + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // read access to the object is denied; + // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ + // object not found in container; + // - **OBJECT_ALREADY_REMOVED** (2052, SECTION_OBJECT): \ + // the requested object has been marked as deleted; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // object container not found; + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. Get(*GetRequest, ObjectService_GetServer) error // Put the object into container. Request uses gRPC stream. First message // SHOULD be of PutHeader type. `ContainerID` and `OwnerID` of an object @@ -434,102 +435,103 @@ type ObjectServiceServer interface { // Chunk messages SHOULD be sent in the direct order of fragmentation. // // Extended headers can change `Put` behaviour: - // * __NEOFS__NETMAP_EPOCH \ - // Will use the requsted version of Network Map for object placement - // calculation. + // - __NEOFS__NETMAP_EPOCH \ + // Will use the requsted version of Network Map for object placement + // calculation. // // Please refer to detailed `XHeader` description. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // object has been successfully saved in the container; - // - Common failures (SECTION_FAILURE_COMMON); - // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ - // write access to the container is denied; - // - **LOCKED** (2050, SECTION_OBJECT): \ - // placement of an object of type TOMBSTONE that includes at least one locked - // object is prohibited; - // - **LOCK_NON_REGULAR_OBJECT** (2051, SECTION_OBJECT): \ - // placement of an object of type LOCK that includes at least one object of - // type other than REGULAR is prohibited; - // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ - // object storage container not found; - // - **TOKEN_NOT_FOUND** (4096, SECTION_SESSION): \ - // (for trusted object preparation) session private key does not exist or has + // - **OK** (0, SECTION_SUCCESS): \ + // object has been successfully saved in the container; + // - Common failures (SECTION_FAILURE_COMMON); + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // write access to the container is denied; + // - **LOCKED** (2050, SECTION_OBJECT): \ + // placement of an object of type TOMBSTONE that includes at least one locked + // object is prohibited; + // - **LOCK_NON_REGULAR_OBJECT** (2051, SECTION_OBJECT): \ + // placement of an object of type LOCK that includes at least one object of + // type other than REGULAR is prohibited; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // object storage container not found; + // - **TOKEN_NOT_FOUND** (4096, SECTION_SESSION): \ + // (for trusted object preparation) session private key does not exist or has + // // been deleted; - // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ - // provided session token has expired. + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. Put(ObjectService_PutServer) error // Delete the object from a container. There is no immediate removal // guarantee. Object will be marked for removal and deleted eventually. // // Extended headers can change `Delete` behaviour: - // * __NEOFS__NETMAP_EPOCH \ - // Will use the requsted version of Network Map for object placement - // calculation. + // - __NEOFS__NETMAP_EPOCH \ + // Will use the requsted version of Network Map for object placement + // calculation. // // Please refer to detailed `XHeader` description. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // object has been successfully marked to be removed from the container; - // - Common failures (SECTION_FAILURE_COMMON); - // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ - // delete access to the object is denied; - // - **LOCKED** (2050, SECTION_OBJECT): \ - // deleting a locked object is prohibited; - // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ - // object container not found; - // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ - // provided session token has expired. + // - **OK** (0, SECTION_SUCCESS): \ + // object has been successfully marked to be removed from the container; + // - Common failures (SECTION_FAILURE_COMMON); + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // delete access to the object is denied; + // - **LOCKED** (2050, SECTION_OBJECT): \ + // deleting a locked object is prohibited; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // object container not found; + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. Delete(context.Context, *DeleteRequest) (*DeleteResponse, error) // Returns the object Headers without data payload. By default full header is // returned. If `main_only` request field is set, the short header with only // the very minimal information will be returned instead. // // Extended headers can change `Head` behaviour: - // * __NEOFS__NETMAP_EPOCH \ - // Will use the requsted version of Network Map for object placement - // calculation. + // - __NEOFS__NETMAP_EPOCH \ + // Will use the requsted version of Network Map for object placement + // calculation. // // Please refer to detailed `XHeader` description. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // object header has been successfully read; - // - Common failures (SECTION_FAILURE_COMMON); - // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ - // access to operation HEAD of the object is denied; - // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ - // object not found in container; - // - **OBJECT_ALREADY_REMOVED** (2052, SECTION_OBJECT): \ - // the requested object has been marked as deleted; - // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ - // object container not found; - // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ - // provided session token has expired. + // - **OK** (0, SECTION_SUCCESS): \ + // object header has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON); + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // access to operation HEAD of the object is denied; + // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ + // object not found in container; + // - **OBJECT_ALREADY_REMOVED** (2052, SECTION_OBJECT): \ + // the requested object has been marked as deleted; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // object container not found; + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. Head(context.Context, *HeadRequest) (*HeadResponse, error) // Search objects in container. Search query allows to match by Object // Header's filed values. Please see the corresponding NeoFS Technical // Specification section for more details. // // Extended headers can change `Search` behaviour: - // * __NEOFS__NETMAP_EPOCH \ - // Will use the requsted version of Network Map for object placement - // calculation. + // - __NEOFS__NETMAP_EPOCH \ + // Will use the requsted version of Network Map for object placement + // calculation. // // Please refer to detailed `XHeader` description. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // objects have been successfully selected; - // - Common failures (SECTION_FAILURE_COMMON); - // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ - // access to operation SEARCH of the object is denied; - // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ - // search container not found; - // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ - // provided session token has expired. + // - **OK** (0, SECTION_SUCCESS): \ + // objects have been successfully selected; + // - Common failures (SECTION_FAILURE_COMMON); + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // access to operation SEARCH of the object is denied; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // search container not found; + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. Search(*SearchRequest, ObjectService_SearchServer) error // Get byte range of data payload. Range is set as an (offset, length) tuple. // Like in `Get` method, the response uses gRPC stream. Requested range can be @@ -537,31 +539,31 @@ type ObjectServiceServer interface { // order. // // Extended headers can change `GetRange` behaviour: - // * __NEOFS__NETMAP_EPOCH \ - // Will use the requsted version of Network Map for object placement - // calculation. - // * __NEOFS__NETMAP_LOOKUP_DEPTH \ - // Will try older versions of Network Map to find an object until the depth - // limit is reached. + // - __NEOFS__NETMAP_EPOCH \ + // Will use the requsted version of Network Map for object placement + // calculation. + // - __NEOFS__NETMAP_LOOKUP_DEPTH \ + // Will try older versions of Network Map to find an object until the depth + // limit is reached. // // Please refer to detailed `XHeader` description. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // data range of the object payload has been successfully read; - // - Common failures (SECTION_FAILURE_COMMON); - // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ - // access to operation RANGE of the object is denied; - // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ - // object not found in container; - // - **OBJECT_ALREADY_REMOVED** (2052, SECTION_OBJECT): \ - // the requested object has been marked as deleted. - // - **OUT_OF_RANGE** (2053, SECTION_OBJECT): \ - // the requested range is out of bounds; - // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ - // object container not found; - // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ - // provided session token has expired. + // - **OK** (0, SECTION_SUCCESS): \ + // data range of the object payload has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON); + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // access to operation RANGE of the object is denied; + // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ + // object not found in container; + // - **OBJECT_ALREADY_REMOVED** (2052, SECTION_OBJECT): \ + // the requested object has been marked as deleted. + // - **OUT_OF_RANGE** (2053, SECTION_OBJECT): \ + // the requested range is out of bounds; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // object container not found; + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. GetRange(*GetRangeRequest, ObjectService_GetRangeServer) error // Returns homomorphic or regular hash of object's payload range after // applying XOR operation with the provided `salt`. Ranges are set of (offset, @@ -569,29 +571,29 @@ type ObjectServiceServer interface { // the request. Note that hash is calculated for XORed data. // // Extended headers can change `GetRangeHash` behaviour: - // * __NEOFS__NETMAP_EPOCH \ - // Will use the requsted version of Network Map for object placement - // calculation. - // * __NEOFS__NETMAP_LOOKUP_DEPTH \ - // Will try older versions of Network Map to find an object until the depth - // limit is reached. + // - __NEOFS__NETMAP_EPOCH \ + // Will use the requsted version of Network Map for object placement + // calculation. + // - __NEOFS__NETMAP_LOOKUP_DEPTH \ + // Will try older versions of Network Map to find an object until the depth + // limit is reached. // // Please refer to detailed `XHeader` description. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // data range of the object payload has been successfully hashed; - // - Common failures (SECTION_FAILURE_COMMON); - // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ - // access to operation RANGEHASH of the object is denied; - // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ - // object not found in container; - // - **OUT_OF_RANGE** (2053, SECTION_OBJECT): \ - // the requested range is out of bounds; - // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ - // object container not found; - // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ - // provided session token has expired. + // - **OK** (0, SECTION_SUCCESS): \ + // data range of the object payload has been successfully hashed; + // - Common failures (SECTION_FAILURE_COMMON); + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // access to operation RANGEHASH of the object is denied; + // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ + // object not found in container; + // - **OUT_OF_RANGE** (2053, SECTION_OBJECT): \ + // the requested range is out of bounds; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // object container not found; + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. GetRangeHash(context.Context, *GetRangeHashRequest) (*GetRangeHashResponse, error) } diff --git a/object/grpc/status.pb.go b/object/grpc/status.pb.go index 17ad8de..034fa1b 100644 --- a/object/grpc/status.pb.go +++ b/object/grpc/status.pb.go @@ -10,7 +10,7 @@ import ( reflect "reflect" sync "sync" - grpc "github.com/TrueCloudLab/frostfs-api-go/v2/status/grpc" + grpc "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/status/grpc" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" ) diff --git a/object/grpc/types.go b/object/grpc/types.go index 9801037..9a2cdea 100644 --- a/object/grpc/types.go +++ b/object/grpc/types.go @@ -1,8 +1,8 @@ package object import ( - refs "github.com/TrueCloudLab/frostfs-api-go/v2/refs/grpc" - session "github.com/TrueCloudLab/frostfs-api-go/v2/session/grpc" + refs "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc" + session "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session/grpc" ) // SetKey sets key to the object attribute. diff --git a/object/grpc/types.pb.go b/object/grpc/types.pb.go index 19a888b..818bc5e 100644 --- a/object/grpc/types.pb.go +++ b/object/grpc/types.pb.go @@ -7,8 +7,8 @@ package object import ( - grpc "github.com/TrueCloudLab/frostfs-api-go/v2/refs/grpc" - grpc1 "github.com/TrueCloudLab/frostfs-api-go/v2/session/grpc" + grpc "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc" + grpc1 "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session/grpc" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -877,13 +877,13 @@ var file_object_grpc_types_proto_rawDesc = []byte{ 0x47, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x45, 0x51, 0x55, 0x41, 0x4c, 0x10, 0x02, 0x12, 0x0f, 0x0a, 0x0b, 0x4e, 0x4f, 0x54, 0x5f, 0x50, 0x52, 0x45, 0x53, 0x45, 0x4e, 0x54, 0x10, 0x03, 0x12, 0x11, 0x0a, 0x0d, 0x43, 0x4f, 0x4d, 0x4d, 0x4f, 0x4e, 0x5f, 0x50, 0x52, 0x45, 0x46, 0x49, 0x58, 0x10, - 0x04, 0x42, 0x5b, 0x5a, 0x3c, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, - 0x54, 0x72, 0x75, 0x65, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x4c, 0x61, 0x62, 0x2f, 0x66, 0x72, 0x6f, - 0x73, 0x74, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x6f, - 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x6f, 0x62, 0x6a, 0x65, 0x63, - 0x74, 0xaa, 0x02, 0x1a, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, - 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x62, 0x06, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x04, 0x42, 0x61, 0x5a, 0x42, 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, 0x61, 0x70, 0x69, 0x2d, 0x67, + 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2f, 0x67, 0x72, 0x70, 0x63, + 0x3b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0xaa, 0x02, 0x1a, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, + 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x4f, 0x62, + 0x6a, 0x65, 0x63, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/object/json.go b/object/json.go index 6999cc9..1a04031 100644 --- a/object/json.go +++ b/object/json.go @@ -1,8 +1,8 @@ package object import ( - object "github.com/TrueCloudLab/frostfs-api-go/v2/object/grpc" - "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" + object "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/object/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message" ) func (h *ShortHeader) MarshalJSON() ([]byte, error) { diff --git a/object/lock.go b/object/lock.go index e9704a8..62ba4a9 100644 --- a/object/lock.go +++ b/object/lock.go @@ -4,12 +4,12 @@ import ( "errors" "fmt" - lock "github.com/TrueCloudLab/frostfs-api-go/v2/lock/grpc" - "github.com/TrueCloudLab/frostfs-api-go/v2/refs" - refsGRPC "github.com/TrueCloudLab/frostfs-api-go/v2/refs/grpc" - "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/grpc" - "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" - "github.com/TrueCloudLab/frostfs-api-go/v2/util/proto" + lock "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/lock/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" + refsGRPC "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/proto" ) // Lock represents object Lock message from NeoFS API V2 protocol. diff --git a/object/lock_test.go b/object/lock_test.go index 90c7e7f..41b159d 100644 --- a/object/lock_test.go +++ b/object/lock_test.go @@ -3,8 +3,8 @@ package object_test import ( "testing" - "github.com/TrueCloudLab/frostfs-api-go/v2/object" - objecttest "github.com/TrueCloudLab/frostfs-api-go/v2/object/test" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/object" + objecttest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/object/test" "github.com/stretchr/testify/require" ) diff --git a/object/marshal.go b/object/marshal.go index e286578..b918e69 100644 --- a/object/marshal.go +++ b/object/marshal.go @@ -1,10 +1,10 @@ package object import ( - object "github.com/TrueCloudLab/frostfs-api-go/v2/object/grpc" - "github.com/TrueCloudLab/frostfs-api-go/v2/refs" - "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" - "github.com/TrueCloudLab/frostfs-api-go/v2/util/proto" + object "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/object/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/proto" ) const ( diff --git a/object/message_test.go b/object/message_test.go index 94b1c1d..c690e66 100644 --- a/object/message_test.go +++ b/object/message_test.go @@ -3,9 +3,9 @@ package object_test import ( "testing" - objecttest "github.com/TrueCloudLab/frostfs-api-go/v2/object/test" - "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" - messagetest "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message/test" + objecttest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/object/test" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message" + messagetest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message/test" ) func TestMessageConvert(t *testing.T) { diff --git a/object/status.go b/object/status.go index bbdeb3f..cff8275 100644 --- a/object/status.go +++ b/object/status.go @@ -1,8 +1,8 @@ package object import ( - "github.com/TrueCloudLab/frostfs-api-go/v2/status" - statusgrpc "github.com/TrueCloudLab/frostfs-api-go/v2/status/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/status" + statusgrpc "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/status/grpc" ) // LocalizeFailStatus checks if passed global status.Code is related to object failure and: diff --git a/object/status_test.go b/object/status_test.go index af7dcf9..7a9ac13 100644 --- a/object/status_test.go +++ b/object/status_test.go @@ -3,9 +3,9 @@ package object_test import ( "testing" - "github.com/TrueCloudLab/frostfs-api-go/v2/object" - "github.com/TrueCloudLab/frostfs-api-go/v2/status" - statustest "github.com/TrueCloudLab/frostfs-api-go/v2/status/test" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/object" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/status" + statustest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/status/test" "github.com/stretchr/testify/require" ) diff --git a/object/string.go b/object/string.go index ef22f8b..6e42c81 100644 --- a/object/string.go +++ b/object/string.go @@ -1,7 +1,7 @@ package object import ( - object "github.com/TrueCloudLab/frostfs-api-go/v2/object/grpc" + object "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/object/grpc" ) // String returns string representation of Type. diff --git a/object/test/generate.go b/object/test/generate.go index 1c74576..0816ffc 100644 --- a/object/test/generate.go +++ b/object/test/generate.go @@ -1,11 +1,11 @@ package objecttest import ( - "github.com/TrueCloudLab/frostfs-api-go/v2/internal/random" - "github.com/TrueCloudLab/frostfs-api-go/v2/object" - "github.com/TrueCloudLab/frostfs-api-go/v2/refs" - refstest "github.com/TrueCloudLab/frostfs-api-go/v2/refs/test" - sessiontest "github.com/TrueCloudLab/frostfs-api-go/v2/session/test" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/internal/random" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/object" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" + refstest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/test" + sessiontest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session/test" ) func GenerateShortHeader(empty bool) *object.ShortHeader { diff --git a/object/types.go b/object/types.go index 33eb48e..f076b74 100644 --- a/object/types.go +++ b/object/types.go @@ -1,8 +1,8 @@ package object import ( - "github.com/TrueCloudLab/frostfs-api-go/v2/refs" - "github.com/TrueCloudLab/frostfs-api-go/v2/session" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session" ) type Type uint32 diff --git a/refs/convert.go b/refs/convert.go index dade588..028bd6a 100644 --- a/refs/convert.go +++ b/refs/convert.go @@ -1,9 +1,9 @@ package refs import ( - refs "github.com/TrueCloudLab/frostfs-api-go/v2/refs/grpc" - "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/grpc" - "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" + refs "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message" ) func (o *OwnerID) ToGRPCMessage() grpc.Message { diff --git a/refs/grpc/types.pb.go b/refs/grpc/types.pb.go index 7fcf89d..5e9bfb5 100644 --- a/refs/grpc/types.pb.go +++ b/refs/grpc/types.pb.go @@ -733,13 +733,13 @@ var file_refs_grpc_types_proto_rawDesc = []byte{ 0x79, 0x70, 0x65, 0x12, 0x1d, 0x0a, 0x19, 0x43, 0x48, 0x45, 0x43, 0x4b, 0x53, 0x55, 0x4d, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x06, 0x0a, 0x02, 0x54, 0x5a, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x53, 0x48, - 0x41, 0x32, 0x35, 0x36, 0x10, 0x02, 0x42, 0x55, 0x5a, 0x38, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, - 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x54, 0x72, 0x75, 0x65, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x4c, 0x61, - 0x62, 0x2f, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, - 0x2f, 0x76, 0x32, 0x2f, 0x72, 0x65, 0x66, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x72, 0x65, - 0x66, 0x73, 0xaa, 0x02, 0x18, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, - 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x52, 0x65, 0x66, 0x73, 0x62, 0x06, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x41, 0x32, 0x35, 0x36, 0x10, 0x02, 0x42, 0x5b, 0x5a, 0x3e, 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, + 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x72, 0x65, 0x66, 0x73, 0x2f, 0x67, + 0x72, 0x70, 0x63, 0x3b, 0x72, 0x65, 0x66, 0x73, 0xaa, 0x02, 0x18, 0x4e, 0x65, 0x6f, 0x2e, 0x46, + 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x52, + 0x65, 0x66, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/refs/json.go b/refs/json.go index 44198ae..529723a 100644 --- a/refs/json.go +++ b/refs/json.go @@ -1,8 +1,8 @@ package refs import ( - refs "github.com/TrueCloudLab/frostfs-api-go/v2/refs/grpc" - "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" + refs "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message" ) func (a *Address) MarshalJSON() ([]byte, error) { diff --git a/refs/marshal.go b/refs/marshal.go index 50c3501..14b0f8c 100644 --- a/refs/marshal.go +++ b/refs/marshal.go @@ -3,9 +3,9 @@ package refs import ( "encoding/binary" - refs "github.com/TrueCloudLab/frostfs-api-go/v2/refs/grpc" - "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" - "github.com/TrueCloudLab/frostfs-api-go/v2/util/proto" + refs "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/proto" ) const ( diff --git a/refs/message_test.go b/refs/message_test.go index 8d8a69d..ba36434 100644 --- a/refs/message_test.go +++ b/refs/message_test.go @@ -3,9 +3,9 @@ package refs_test import ( "testing" - refstest "github.com/TrueCloudLab/frostfs-api-go/v2/refs/test" - "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" - messagetest "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message/test" + refstest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/test" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message" + messagetest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message/test" ) func TestMessageConvert(t *testing.T) { diff --git a/refs/string.go b/refs/string.go index 2dac54a..5389aa3 100644 --- a/refs/string.go +++ b/refs/string.go @@ -1,7 +1,7 @@ package refs import ( - refs "github.com/TrueCloudLab/frostfs-api-go/v2/refs/grpc" + refs "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc" ) // String returns string representation of ChecksumType. diff --git a/refs/test/generate.go b/refs/test/generate.go index b11b1a0..cce64a8 100644 --- a/refs/test/generate.go +++ b/refs/test/generate.go @@ -3,7 +3,7 @@ package refstest import ( "math/rand" - "github.com/TrueCloudLab/frostfs-api-go/v2/refs" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" ) func GenerateVersion(empty bool) *refs.Version { diff --git a/refs/types_test.go b/refs/types_test.go index 11ad628..68d8fd7 100644 --- a/refs/types_test.go +++ b/refs/types_test.go @@ -5,7 +5,7 @@ import ( "strconv" "testing" - "github.com/TrueCloudLab/frostfs-api-go/v2/refs" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" "github.com/stretchr/testify/require" ) diff --git a/reputation/convert.go b/reputation/convert.go index 25e887d..ca54261 100644 --- a/reputation/convert.go +++ b/reputation/convert.go @@ -1,11 +1,11 @@ package reputation import ( - "github.com/TrueCloudLab/frostfs-api-go/v2/refs" - refsGRPC "github.com/TrueCloudLab/frostfs-api-go/v2/refs/grpc" - reputation "github.com/TrueCloudLab/frostfs-api-go/v2/reputation/grpc" - "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/grpc" - "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" + refsGRPC "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc" + reputation "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/reputation/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message" ) // ToGRPCMessage converts PeerID to gRPC-generated diff --git a/reputation/grpc/service.go b/reputation/grpc/service.go index b737d6d..81ed890 100644 --- a/reputation/grpc/service.go +++ b/reputation/grpc/service.go @@ -1,7 +1,7 @@ package reputation import ( - session "github.com/TrueCloudLab/frostfs-api-go/v2/session/grpc" + session "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session/grpc" ) // SetEpoch sets epoch in which the trust was assessed. diff --git a/reputation/grpc/service.pb.go b/reputation/grpc/service.pb.go index 2abb8d7..2d0f61f 100644 --- a/reputation/grpc/service.pb.go +++ b/reputation/grpc/service.pb.go @@ -7,7 +7,7 @@ package reputation import ( - grpc "github.com/TrueCloudLab/frostfs-api-go/v2/session/grpc" + grpc "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session/grpc" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -618,14 +618,14 @@ var file_reputation_grpc_service_proto_rawDesc = []byte{ 0x38, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, - 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x67, 0x5a, 0x44, 0x67, 0x69, 0x74, - 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x54, 0x72, 0x75, 0x65, 0x43, 0x6c, 0x6f, 0x75, - 0x64, 0x4c, 0x61, 0x62, 0x2f, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, - 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0xaa, 0x02, 0x1e, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, - 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x52, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x6d, 0x5a, 0x4a, 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, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x72, 0x65, 0x70, + 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x72, 0x65, 0x70, + 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xaa, 0x02, 0x1e, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, + 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x52, 0x65, + 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/reputation/grpc/types.go b/reputation/grpc/types.go index 01766f8..63f2d34 100644 --- a/reputation/grpc/types.go +++ b/reputation/grpc/types.go @@ -1,7 +1,7 @@ package reputation import ( - refs "github.com/TrueCloudLab/frostfs-api-go/v2/refs/grpc" + refs "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc" ) // SetPublicKey sets binary public key of ID. diff --git a/reputation/grpc/types.pb.go b/reputation/grpc/types.pb.go index 9699284..b95b240 100644 --- a/reputation/grpc/types.pb.go +++ b/reputation/grpc/types.pb.go @@ -7,7 +7,7 @@ package reputation import ( - grpc "github.com/TrueCloudLab/frostfs-api-go/v2/refs/grpc" + grpc "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -364,14 +364,14 @@ var file_reputation_grpc_types_proto_rawDesc = []byte{ 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x12, 0x31, 0x0a, 0x05, 0x74, 0x72, 0x75, 0x73, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x54, 0x72, 0x75, - 0x73, 0x74, 0x52, 0x05, 0x74, 0x72, 0x75, 0x73, 0x74, 0x42, 0x67, 0x5a, 0x44, 0x67, 0x69, 0x74, - 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x54, 0x72, 0x75, 0x65, 0x43, 0x6c, 0x6f, 0x75, - 0x64, 0x4c, 0x61, 0x62, 0x2f, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, - 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0xaa, 0x02, 0x1e, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, - 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x52, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x73, 0x74, 0x52, 0x05, 0x74, 0x72, 0x75, 0x73, 0x74, 0x42, 0x6d, 0x5a, 0x4a, 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, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x72, 0x65, 0x70, + 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x72, 0x65, 0x70, + 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xaa, 0x02, 0x1e, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, + 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x52, 0x65, + 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/reputation/json.go b/reputation/json.go index d1b4d4d..3976462 100644 --- a/reputation/json.go +++ b/reputation/json.go @@ -1,8 +1,8 @@ package reputation import ( - reputation "github.com/TrueCloudLab/frostfs-api-go/v2/reputation/grpc" - "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" + reputation "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/reputation/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message" ) func (x *PeerID) MarshalJSON() ([]byte, error) { diff --git a/reputation/marshal.go b/reputation/marshal.go index 138e0e8..a64e822 100644 --- a/reputation/marshal.go +++ b/reputation/marshal.go @@ -1,9 +1,9 @@ package reputation import ( - reputation "github.com/TrueCloudLab/frostfs-api-go/v2/reputation/grpc" - "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" - protoutil "github.com/TrueCloudLab/frostfs-api-go/v2/util/proto" + reputation "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/reputation/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message" + protoutil "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/proto" ) const ( diff --git a/reputation/message_test.go b/reputation/message_test.go index 8f308b0..891c2e4 100644 --- a/reputation/message_test.go +++ b/reputation/message_test.go @@ -3,9 +3,9 @@ package reputation_test import ( "testing" - reputationtest "github.com/TrueCloudLab/frostfs-api-go/v2/reputation/test" - "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" - messagetest "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message/test" + reputationtest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/reputation/test" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message" + messagetest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message/test" ) func TestMessageConvert(t *testing.T) { diff --git a/reputation/test/generate.go b/reputation/test/generate.go index 09d61d2..7731ad9 100644 --- a/reputation/test/generate.go +++ b/reputation/test/generate.go @@ -1,9 +1,9 @@ package reputationtest import ( - refstest "github.com/TrueCloudLab/frostfs-api-go/v2/refs/test" - "github.com/TrueCloudLab/frostfs-api-go/v2/reputation" - sessiontest "github.com/TrueCloudLab/frostfs-api-go/v2/session/test" + refstest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/test" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/reputation" + sessiontest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session/test" ) func GeneratePeerID(empty bool) *reputation.PeerID { diff --git a/reputation/types.go b/reputation/types.go index 3876f1a..a339183 100644 --- a/reputation/types.go +++ b/reputation/types.go @@ -1,8 +1,8 @@ package reputation import ( - "github.com/TrueCloudLab/frostfs-api-go/v2/refs" - "github.com/TrueCloudLab/frostfs-api-go/v2/session" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session" ) // PeerID represents reputation.PeerID message diff --git a/rpc/accounting.go b/rpc/accounting.go index 21c7a7f..4f324c9 100644 --- a/rpc/accounting.go +++ b/rpc/accounting.go @@ -1,9 +1,9 @@ package rpc import ( - "github.com/TrueCloudLab/frostfs-api-go/v2/accounting" - "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/client" - "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/common" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/accounting" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/client" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/common" ) const serviceAccounting = serviceNamePrefix + "accounting.AccountingService" diff --git a/rpc/client/flows.go b/rpc/client/flows.go index e741ca3..a3da1e2 100644 --- a/rpc/client/flows.go +++ b/rpc/client/flows.go @@ -5,8 +5,8 @@ import ( "io" "sync" - "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/common" - "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/common" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message" ) // SendUnary initializes communication session by RPC info, performs unary RPC diff --git a/rpc/client/init.go b/rpc/client/init.go index 7706c7a..60ccda9 100644 --- a/rpc/client/init.go +++ b/rpc/client/init.go @@ -4,8 +4,8 @@ import ( "context" "io" - "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/common" - "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/common" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message" "google.golang.org/grpc" ) diff --git a/rpc/client/stream_wrapper.go b/rpc/client/stream_wrapper.go index 7f60db2..22033dd 100644 --- a/rpc/client/stream_wrapper.go +++ b/rpc/client/stream_wrapper.go @@ -4,7 +4,7 @@ import ( "context" "time" - "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message" "google.golang.org/grpc" ) diff --git a/rpc/client/util.go b/rpc/client/util.go index 291ebac..95dc2b0 100644 --- a/rpc/client/util.go +++ b/rpc/client/util.go @@ -3,7 +3,7 @@ package client import ( "fmt" - "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/common" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/common" ) const methodNameFmt = "/%s/%s" diff --git a/rpc/common/call_test.go b/rpc/common/call_test.go index f3acd08..942ee02 100644 --- a/rpc/common/call_test.go +++ b/rpc/common/call_test.go @@ -3,7 +3,7 @@ package common_test import ( "testing" - "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/common" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/common" "github.com/stretchr/testify/require" ) diff --git a/rpc/container.go b/rpc/container.go index a33afe1..1292c22 100644 --- a/rpc/container.go +++ b/rpc/container.go @@ -1,9 +1,9 @@ package rpc import ( - "github.com/TrueCloudLab/frostfs-api-go/v2/container" - "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/client" - "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/common" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/container" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/client" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/common" ) const serviceContainer = serviceNamePrefix + "container.ContainerService" diff --git a/rpc/message/encoding.go b/rpc/message/encoding.go index b28cde3..715f015 100644 --- a/rpc/message/encoding.go +++ b/rpc/message/encoding.go @@ -1,7 +1,7 @@ package message import ( - "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/grpc" "google.golang.org/protobuf/encoding/protojson" "google.golang.org/protobuf/proto" ) diff --git a/rpc/message/message.go b/rpc/message/message.go index 4f6acaf..c9b87f0 100644 --- a/rpc/message/message.go +++ b/rpc/message/message.go @@ -3,7 +3,7 @@ package message import ( "fmt" - "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/grpc" ) // Message represents raw Protobuf message diff --git a/rpc/message/test/message.go b/rpc/message/test/message.go index 138b758..df769d2 100644 --- a/rpc/message/test/message.go +++ b/rpc/message/test/message.go @@ -6,7 +6,7 @@ import ( "fmt" "testing" - "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message" "github.com/stretchr/testify/require" ) diff --git a/rpc/netmap.go b/rpc/netmap.go index bfe2ef4..38bdd6d 100644 --- a/rpc/netmap.go +++ b/rpc/netmap.go @@ -1,9 +1,9 @@ package rpc import ( - "github.com/TrueCloudLab/frostfs-api-go/v2/netmap" - "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/client" - "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/common" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/netmap" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/client" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/common" ) const serviceNetmap = serviceNamePrefix + "netmap.NetmapService" diff --git a/rpc/object.go b/rpc/object.go index b2d0c95..1cac1c7 100644 --- a/rpc/object.go +++ b/rpc/object.go @@ -1,10 +1,10 @@ package rpc import ( - "github.com/TrueCloudLab/frostfs-api-go/v2/object" - "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/client" - "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/common" - "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/object" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/client" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/common" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message" ) const serviceObject = serviceNamePrefix + "object.ObjectService" diff --git a/rpc/reputation.go b/rpc/reputation.go index 413868d..3d036b2 100644 --- a/rpc/reputation.go +++ b/rpc/reputation.go @@ -1,9 +1,9 @@ package rpc import ( - "github.com/TrueCloudLab/frostfs-api-go/v2/reputation" - "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/client" - "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/common" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/reputation" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/client" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/common" ) const serviceReputation = serviceNamePrefix + "reputation.ReputationService" diff --git a/rpc/session.go b/rpc/session.go index f180780..f786734 100644 --- a/rpc/session.go +++ b/rpc/session.go @@ -1,9 +1,9 @@ package rpc import ( - "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/client" - "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/common" - "github.com/TrueCloudLab/frostfs-api-go/v2/session" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/client" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/common" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session" ) const serviceSession = serviceNamePrefix + "session.SessionService" diff --git a/session/convert.go b/session/convert.go index a6bc6d6..870e208 100644 --- a/session/convert.go +++ b/session/convert.go @@ -3,15 +3,15 @@ package session import ( "fmt" - "github.com/TrueCloudLab/frostfs-api-go/v2/acl" - aclGRPC "github.com/TrueCloudLab/frostfs-api-go/v2/acl/grpc" - "github.com/TrueCloudLab/frostfs-api-go/v2/refs" - refsGRPC "github.com/TrueCloudLab/frostfs-api-go/v2/refs/grpc" - "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/grpc" - "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" - session "github.com/TrueCloudLab/frostfs-api-go/v2/session/grpc" - "github.com/TrueCloudLab/frostfs-api-go/v2/status" - statusGRPC "github.com/TrueCloudLab/frostfs-api-go/v2/status/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/acl" + aclGRPC "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/acl/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" + refsGRPC "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message" + session "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/status" + statusGRPC "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/status/grpc" ) func (c *CreateRequestBody) ToGRPCMessage() grpc.Message { diff --git a/session/grpc/service.go b/session/grpc/service.go index a9e5282..6e02328 100644 --- a/session/grpc/service.go +++ b/session/grpc/service.go @@ -1,7 +1,7 @@ package session import ( - refs "github.com/TrueCloudLab/frostfs-api-go/v2/refs/grpc" + refs "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc" ) // SetOwnerId sets identifier of the session initiator. diff --git a/session/grpc/service.pb.go b/session/grpc/service.pb.go index 5bf1677..23d6913 100644 --- a/session/grpc/service.pb.go +++ b/session/grpc/service.pb.go @@ -7,7 +7,7 @@ package session import ( - grpc "github.com/TrueCloudLab/frostfs-api-go/v2/refs/grpc" + grpc "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -330,13 +330,14 @@ var file_session_grpc_service_proto_rawDesc = []byte{ 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, 0x5e, 0x5a, 0x3e, 0x67, 0x69, 0x74, 0x68, - 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x54, 0x72, 0x75, 0x65, 0x43, 0x6c, 0x6f, 0x75, 0x64, - 0x4c, 0x61, 0x62, 0x2f, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, - 0x67, 0x6f, 0x2f, 0x76, 0x32, 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, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x64, 0x5a, 0x44, 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, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 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, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/session/grpc/types.go b/session/grpc/types.go index e3ee8d6..bcc92d1 100644 --- a/session/grpc/types.go +++ b/session/grpc/types.go @@ -1,9 +1,9 @@ package session import ( - acl "github.com/TrueCloudLab/frostfs-api-go/v2/acl/grpc" - refs "github.com/TrueCloudLab/frostfs-api-go/v2/refs/grpc" - status "github.com/TrueCloudLab/frostfs-api-go/v2/status/grpc" + acl "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/acl/grpc" + refs "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc" + status "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/status/grpc" ) // SetKey sets key to the X-Header. diff --git a/session/grpc/types.pb.go b/session/grpc/types.pb.go index b96f954..3ca6001 100644 --- a/session/grpc/types.pb.go +++ b/session/grpc/types.pb.go @@ -7,9 +7,9 @@ package session import ( - grpc1 "github.com/TrueCloudLab/frostfs-api-go/v2/acl/grpc" - grpc "github.com/TrueCloudLab/frostfs-api-go/v2/refs/grpc" - grpc2 "github.com/TrueCloudLab/frostfs-api-go/v2/status/grpc" + grpc1 "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/acl/grpc" + grpc "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc" + grpc2 "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/status/grpc" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -1196,13 +1196,14 @@ var file_session_grpc_types_proto_rawDesc = []byte{ 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, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x42, 0x5e, 0x5a, 0x3e, 0x67, 0x69, 0x74, 0x68, - 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x54, 0x72, 0x75, 0x65, 0x43, 0x6c, 0x6f, 0x75, 0x64, - 0x4c, 0x61, 0x62, 0x2f, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, - 0x67, 0x6f, 0x2f, 0x76, 0x32, 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, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x52, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x42, 0x64, 0x5a, 0x44, 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, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 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, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/session/json.go b/session/json.go index d44325f..77cbe10 100644 --- a/session/json.go +++ b/session/json.go @@ -1,8 +1,8 @@ package session import ( - "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" - session "github.com/TrueCloudLab/frostfs-api-go/v2/session/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message" + session "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session/grpc" "google.golang.org/protobuf/encoding/protojson" ) diff --git a/session/marshal.go b/session/marshal.go index f4b1bc9..3c56cd4 100644 --- a/session/marshal.go +++ b/session/marshal.go @@ -1,9 +1,9 @@ package session import ( - "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" - session "github.com/TrueCloudLab/frostfs-api-go/v2/session/grpc" - "github.com/TrueCloudLab/frostfs-api-go/v2/util/proto" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message" + session "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/proto" goproto "google.golang.org/protobuf/proto" ) diff --git a/session/message_test.go b/session/message_test.go index 33489de..39dd336 100644 --- a/session/message_test.go +++ b/session/message_test.go @@ -3,9 +3,9 @@ package session_test import ( "testing" - "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" - rpctest "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message/test" - sessiontest "github.com/TrueCloudLab/frostfs-api-go/v2/session/test" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message" + rpctest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message/test" + sessiontest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session/test" ) func TestMessageConvert(t *testing.T) { diff --git a/session/status.go b/session/status.go index 04aa450..8b3b381 100644 --- a/session/status.go +++ b/session/status.go @@ -1,8 +1,8 @@ package session import ( - "github.com/TrueCloudLab/frostfs-api-go/v2/status" - statusgrpc "github.com/TrueCloudLab/frostfs-api-go/v2/status/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/status" + statusgrpc "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/status/grpc" ) // LocalizeFailStatus checks if passed global status.Code is related to session failure and: diff --git a/session/status_test.go b/session/status_test.go index 2a7ff6d..57ce4bd 100644 --- a/session/status_test.go +++ b/session/status_test.go @@ -3,8 +3,8 @@ package session_test import ( "testing" - "github.com/TrueCloudLab/frostfs-api-go/v2/session" - statustest "github.com/TrueCloudLab/frostfs-api-go/v2/status/test" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session" + statustest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/status/test" ) func TestStatusCodes(t *testing.T) { diff --git a/session/string.go b/session/string.go index 24e7d09..0e7c48a 100644 --- a/session/string.go +++ b/session/string.go @@ -1,7 +1,7 @@ package session import ( - session "github.com/TrueCloudLab/frostfs-api-go/v2/session/grpc" + session "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session/grpc" ) // String returns string representation of ObjectSessionVerb. diff --git a/session/test/generate.go b/session/test/generate.go index dc06aed..cfce6cd 100644 --- a/session/test/generate.go +++ b/session/test/generate.go @@ -1,11 +1,11 @@ package sessiontest import ( - acltest "github.com/TrueCloudLab/frostfs-api-go/v2/acl/test" - "github.com/TrueCloudLab/frostfs-api-go/v2/internal/random" - refstest "github.com/TrueCloudLab/frostfs-api-go/v2/refs/test" - "github.com/TrueCloudLab/frostfs-api-go/v2/session" - statustest "github.com/TrueCloudLab/frostfs-api-go/v2/status/test" + acltest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/acl/test" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/internal/random" + refstest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/test" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session" + statustest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/status/test" ) func GenerateCreateRequestBody(empty bool) *session.CreateRequestBody { diff --git a/session/types.go b/session/types.go index d00d76f..19cfecc 100644 --- a/session/types.go +++ b/session/types.go @@ -1,10 +1,10 @@ package session import ( - "github.com/TrueCloudLab/frostfs-api-go/v2/acl" - "github.com/TrueCloudLab/frostfs-api-go/v2/refs" - "github.com/TrueCloudLab/frostfs-api-go/v2/status" - "github.com/TrueCloudLab/frostfs-api-go/v2/util/proto" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/acl" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/status" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/proto" ) type CreateRequestBody struct { diff --git a/session/util.go b/session/util.go index 59ee076..7edca29 100644 --- a/session/util.go +++ b/session/util.go @@ -1,7 +1,7 @@ package session import ( - session "github.com/TrueCloudLab/frostfs-api-go/v2/session/grpc" + session "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session/grpc" ) // RequestHeaders represents common part of diff --git a/signature/sign.go b/signature/sign.go index f1d4cf6..f4dad90 100644 --- a/signature/sign.go +++ b/signature/sign.go @@ -5,14 +5,14 @@ import ( "errors" "fmt" - "github.com/TrueCloudLab/frostfs-api-go/v2/accounting" - "github.com/TrueCloudLab/frostfs-api-go/v2/container" - "github.com/TrueCloudLab/frostfs-api-go/v2/netmap" - "github.com/TrueCloudLab/frostfs-api-go/v2/object" - "github.com/TrueCloudLab/frostfs-api-go/v2/refs" - "github.com/TrueCloudLab/frostfs-api-go/v2/reputation" - "github.com/TrueCloudLab/frostfs-api-go/v2/session" - "github.com/TrueCloudLab/frostfs-api-go/v2/util/signature" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/accounting" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/container" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/netmap" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/object" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/reputation" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/signature" ) type serviceRequest interface { diff --git a/signature/sign_test.go b/signature/sign_test.go index fb508a3..ff31954 100644 --- a/signature/sign_test.go +++ b/signature/sign_test.go @@ -3,9 +3,9 @@ package signature import ( "testing" - "github.com/TrueCloudLab/frostfs-api-go/v2/accounting" - "github.com/TrueCloudLab/frostfs-api-go/v2/session" - crypto "github.com/TrueCloudLab/frostfs-crypto" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/accounting" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session" + crypto "git.frostfs.info/TrueCloudLab/frostfs-crypto" "github.com/stretchr/testify/require" ) diff --git a/status/convert.go b/status/convert.go index e13e567..0743952 100644 --- a/status/convert.go +++ b/status/convert.go @@ -1,9 +1,9 @@ package status import ( - "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/grpc" - "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" - status "github.com/TrueCloudLab/frostfs-api-go/v2/status/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message" + status "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/status/grpc" ) func (x *Detail) ToGRPCMessage() grpc.Message { diff --git a/status/grpc/types.pb.go b/status/grpc/types.pb.go index d4960fb..f6fd81c 100644 --- a/status/grpc/types.pb.go +++ b/status/grpc/types.pb.go @@ -558,13 +558,14 @@ var file_status_grpc_types_proto_rawDesc = []byte{ 0x4e, 0x44, 0x10, 0x01, 0x2a, 0x31, 0x0a, 0x07, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x13, 0x0a, 0x0f, 0x54, 0x4f, 0x4b, 0x45, 0x4e, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x46, 0x4f, 0x55, 0x4e, 0x44, 0x10, 0x00, 0x12, 0x11, 0x0a, 0x0d, 0x54, 0x4f, 0x4b, 0x45, 0x4e, 0x5f, 0x45, 0x58, - 0x50, 0x49, 0x52, 0x45, 0x44, 0x10, 0x01, 0x42, 0x5b, 0x5a, 0x3c, 0x67, 0x69, 0x74, 0x68, 0x75, - 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x54, 0x72, 0x75, 0x65, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x4c, - 0x61, 0x62, 0x2f, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, - 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, - 0x3b, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0xaa, 0x02, 0x1a, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, - 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x53, 0x74, - 0x61, 0x74, 0x75, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x50, 0x49, 0x52, 0x45, 0x44, 0x10, 0x01, 0x42, 0x61, 0x5a, 0x42, 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, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x75, + 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0xaa, 0x02, 0x1a, + 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, + 0x41, 0x50, 0x49, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, } var ( diff --git a/status/marshal.go b/status/marshal.go index 553b7d7..78064c1 100644 --- a/status/marshal.go +++ b/status/marshal.go @@ -1,9 +1,9 @@ package status import ( - "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" - status "github.com/TrueCloudLab/frostfs-api-go/v2/status/grpc" - protoutil "github.com/TrueCloudLab/frostfs-api-go/v2/util/proto" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message" + status "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/status/grpc" + protoutil "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/proto" ) const ( diff --git a/status/message_test.go b/status/message_test.go index 47355f1..f16f152 100644 --- a/status/message_test.go +++ b/status/message_test.go @@ -3,9 +3,9 @@ package status_test import ( "testing" - "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" - messagetest "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message/test" - statustest "github.com/TrueCloudLab/frostfs-api-go/v2/status/test" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message" + messagetest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message/test" + statustest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/status/test" ) func TestMessageConvert(t *testing.T) { diff --git a/status/test/codes.go b/status/test/codes.go index 4df7da5..3a2e001 100644 --- a/status/test/codes.go +++ b/status/test/codes.go @@ -3,7 +3,7 @@ package statustest import ( "testing" - "github.com/TrueCloudLab/frostfs-api-go/v2/status" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/status" "github.com/stretchr/testify/require" ) diff --git a/status/test/generate.go b/status/test/generate.go index 8812814..8537b39 100644 --- a/status/test/generate.go +++ b/status/test/generate.go @@ -1,7 +1,7 @@ package statustest import ( - "github.com/TrueCloudLab/frostfs-api-go/v2/status" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/status" ) // Detail returns status.Detail filled with static random values. diff --git a/storagegroup/convert.go b/storagegroup/convert.go index dddd8b4..898d493 100644 --- a/storagegroup/convert.go +++ b/storagegroup/convert.go @@ -1,11 +1,11 @@ package storagegroup import ( - "github.com/TrueCloudLab/frostfs-api-go/v2/refs" - refsGRPC "github.com/TrueCloudLab/frostfs-api-go/v2/refs/grpc" - "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/grpc" - "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" - sg "github.com/TrueCloudLab/frostfs-api-go/v2/storagegroup/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" + refsGRPC "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message" + sg "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/storagegroup/grpc" ) func (s *StorageGroup) ToGRPCMessage() grpc.Message { diff --git a/storagegroup/grpc/types.go b/storagegroup/grpc/types.go index f1151c4..9be5c24 100644 --- a/storagegroup/grpc/types.go +++ b/storagegroup/grpc/types.go @@ -1,7 +1,7 @@ package storagegroup import ( - refs "github.com/TrueCloudLab/frostfs-api-go/v2/refs/grpc" + refs "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc" ) // SetValidationDataSize sets the total size of the payloads of the storage group. diff --git a/storagegroup/grpc/types.pb.go b/storagegroup/grpc/types.pb.go index 98e2bcd..37f88ea 100644 --- a/storagegroup/grpc/types.pb.go +++ b/storagegroup/grpc/types.pb.go @@ -7,7 +7,7 @@ package storagegroup import ( - grpc "github.com/TrueCloudLab/frostfs-api-go/v2/refs/grpc" + grpc "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -132,14 +132,15 @@ var file_storagegroup_grpc_types_proto_rawDesc = []byte{ 0x6f, 0x63, 0x68, 0x12, 0x32, 0x0a, 0x07, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x18, 0x04, 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, 0x6d, 0x5a, 0x48, 0x67, 0x69, 0x74, 0x68, 0x75, - 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x54, 0x72, 0x75, 0x65, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x4c, - 0x61, 0x62, 0x2f, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, - 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x67, 0x72, 0x6f, 0x75, - 0x70, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x67, 0x72, - 0x6f, 0x75, 0x70, 0xaa, 0x02, 0x20, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, - 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, - 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x42, 0x73, 0x5a, 0x4e, 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, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x73, 0x74, 0x6f, 0x72, 0x61, + 0x67, 0x65, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x73, 0x74, 0x6f, + 0x72, 0x61, 0x67, 0x65, 0x67, 0x72, 0x6f, 0x75, 0x70, 0xaa, 0x02, 0x20, 0x4e, 0x65, 0x6f, 0x2e, + 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, + 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/storagegroup/json.go b/storagegroup/json.go index 6136068..b122893 100644 --- a/storagegroup/json.go +++ b/storagegroup/json.go @@ -1,8 +1,8 @@ package storagegroup import ( - "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" - storagegroup "github.com/TrueCloudLab/frostfs-api-go/v2/storagegroup/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message" + storagegroup "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/storagegroup/grpc" ) func (s *StorageGroup) MarshalJSON() ([]byte, error) { diff --git a/storagegroup/marshal.go b/storagegroup/marshal.go index f7a94f7..3f8171a 100644 --- a/storagegroup/marshal.go +++ b/storagegroup/marshal.go @@ -1,10 +1,10 @@ package storagegroup import ( - "github.com/TrueCloudLab/frostfs-api-go/v2/refs" - "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" - storagegroup "github.com/TrueCloudLab/frostfs-api-go/v2/storagegroup/grpc" - "github.com/TrueCloudLab/frostfs-api-go/v2/util/proto" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message" + storagegroup "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/storagegroup/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/proto" ) const ( diff --git a/storagegroup/message_test.go b/storagegroup/message_test.go index ccc214c..e4ed367 100644 --- a/storagegroup/message_test.go +++ b/storagegroup/message_test.go @@ -3,9 +3,9 @@ package storagegroup_test import ( "testing" - "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" - messagetest "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message/test" - storagegrouptest "github.com/TrueCloudLab/frostfs-api-go/v2/storagegroup/test" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message" + messagetest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message/test" + storagegrouptest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/storagegroup/test" ) func TestMessageConvert(t *testing.T) { diff --git a/storagegroup/test/generate.go b/storagegroup/test/generate.go index fb338e4..b53f199 100644 --- a/storagegroup/test/generate.go +++ b/storagegroup/test/generate.go @@ -1,8 +1,8 @@ package storagegrouptest import ( - refstest "github.com/TrueCloudLab/frostfs-api-go/v2/refs/test" - "github.com/TrueCloudLab/frostfs-api-go/v2/storagegroup" + refstest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/test" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/storagegroup" ) func GenerateStorageGroup(empty bool) *storagegroup.StorageGroup { diff --git a/storagegroup/types.go b/storagegroup/types.go index 179705e..b5a3a5b 100644 --- a/storagegroup/types.go +++ b/storagegroup/types.go @@ -1,7 +1,7 @@ package storagegroup import ( - "github.com/TrueCloudLab/frostfs-api-go/v2/refs" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" ) // StorageGroup is a unified structure of StorageGroup diff --git a/subnet/encoding_test.go b/subnet/encoding_test.go index 3e41b23..0a1fea1 100644 --- a/subnet/encoding_test.go +++ b/subnet/encoding_test.go @@ -3,9 +3,9 @@ package subnet_test import ( "testing" - "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" - messagetest "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message/test" - subnettest "github.com/TrueCloudLab/frostfs-api-go/v2/subnet/test" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message" + messagetest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message/test" + subnettest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/subnet/test" ) func TestMessageConvert(t *testing.T) { diff --git a/subnet/grpc/types.go b/subnet/grpc/types.go index 548e656..3196c5a 100644 --- a/subnet/grpc/types.go +++ b/subnet/grpc/types.go @@ -1,7 +1,7 @@ package subnet import ( - refs "github.com/TrueCloudLab/frostfs-api-go/v2/refs/grpc" + refs "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc" ) // SetID returns identifier of the subnet. Nil arg is equivalent to zero subnet ID. diff --git a/subnet/grpc/types.pb.go b/subnet/grpc/types.pb.go index 2de1bc8..c2d7529 100644 --- a/subnet/grpc/types.pb.go +++ b/subnet/grpc/types.pb.go @@ -7,7 +7,7 @@ package subnet import ( - grpc "github.com/TrueCloudLab/frostfs-api-go/v2/refs/grpc" + grpc "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -93,13 +93,14 @@ var file_subnet_grpc_types_proto_rawDesc = []byte{ 0x62, 0x6e, 0x65, 0x74, 0x49, 0x44, 0x52, 0x02, 0x69, 0x64, 0x12, 0x2d, 0x0a, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 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, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x42, 0x5b, 0x5a, 0x3c, 0x67, 0x69, 0x74, - 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x54, 0x72, 0x75, 0x65, 0x43, 0x6c, 0x6f, 0x75, - 0x64, 0x4c, 0x61, 0x62, 0x2f, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, - 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x73, 0x75, 0x62, 0x6e, 0x65, 0x74, 0x2f, 0x67, 0x72, - 0x70, 0x63, 0x3b, 0x73, 0x75, 0x62, 0x6e, 0x65, 0x74, 0xaa, 0x02, 0x1a, 0x4e, 0x65, 0x6f, 0x2e, - 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, - 0x53, 0x75, 0x62, 0x6e, 0x65, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x49, 0x44, 0x52, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x42, 0x61, 0x5a, 0x42, 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, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x73, 0x75, 0x62, + 0x6e, 0x65, 0x74, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x73, 0x75, 0x62, 0x6e, 0x65, 0x74, 0xaa, + 0x02, 0x1a, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, + 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x53, 0x75, 0x62, 0x6e, 0x65, 0x74, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/subnet/info.go b/subnet/info.go index 37ecfe2..2e1e94c 100644 --- a/subnet/info.go +++ b/subnet/info.go @@ -1,12 +1,12 @@ package subnet import ( - "github.com/TrueCloudLab/frostfs-api-go/v2/refs" - refsgrpc "github.com/TrueCloudLab/frostfs-api-go/v2/refs/grpc" - "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/grpc" - "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" - subnet "github.com/TrueCloudLab/frostfs-api-go/v2/subnet/grpc" - protoutil "github.com/TrueCloudLab/frostfs-api-go/v2/util/proto" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" + refsgrpc "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message" + subnet "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/subnet/grpc" + protoutil "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/proto" ) // Info represents information about NeoFS subnet. Structure is compatible with NeoFS API V2 protocol. diff --git a/subnet/test/generate.go b/subnet/test/generate.go index d5eab77..214ac7b 100644 --- a/subnet/test/generate.go +++ b/subnet/test/generate.go @@ -1,8 +1,8 @@ package subnettest import ( - refstest "github.com/TrueCloudLab/frostfs-api-go/v2/refs/test" - "github.com/TrueCloudLab/frostfs-api-go/v2/subnet" + refstest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/test" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/subnet" ) func GenerateSubnetInfo(empty bool) *subnet.Info { diff --git a/tombstone/convert.go b/tombstone/convert.go index 48e64a6..62febc5 100644 --- a/tombstone/convert.go +++ b/tombstone/convert.go @@ -1,10 +1,10 @@ package tombstone import ( - "github.com/TrueCloudLab/frostfs-api-go/v2/refs" - "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/grpc" - "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" - tombstone "github.com/TrueCloudLab/frostfs-api-go/v2/tombstone/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message" + tombstone "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/tombstone/grpc" ) func (s *Tombstone) ToGRPCMessage() grpc.Message { diff --git a/tombstone/grpc/types.go b/tombstone/grpc/types.go index 6793635..9b4b744 100644 --- a/tombstone/grpc/types.go +++ b/tombstone/grpc/types.go @@ -1,7 +1,7 @@ package tombstone import ( - refs "github.com/TrueCloudLab/frostfs-api-go/v2/refs/grpc" + refs "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc" ) // SetExpirationEpoch sets number of tombstone expiration epoch. diff --git a/tombstone/grpc/types.pb.go b/tombstone/grpc/types.pb.go index b8ea61a..11405ac 100644 --- a/tombstone/grpc/types.pb.go +++ b/tombstone/grpc/types.pb.go @@ -7,7 +7,7 @@ package tombstone import ( - grpc "github.com/TrueCloudLab/frostfs-api-go/v2/refs/grpc" + grpc "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -110,13 +110,14 @@ var file_tombstone_grpc_types_proto_rawDesc = []byte{ 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x18, 0x03, 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, 0x64, 0x5a, 0x42, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x54, - 0x72, 0x75, 0x65, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x4c, 0x61, 0x62, 0x2f, 0x66, 0x72, 0x6f, 0x73, - 0x74, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x74, 0x6f, - 0x6d, 0x62, 0x73, 0x74, 0x6f, 0x6e, 0x65, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x74, 0x6f, 0x6d, - 0x62, 0x73, 0x74, 0x6f, 0x6e, 0x65, 0xaa, 0x02, 0x1d, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, - 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x54, 0x6f, 0x6d, - 0x62, 0x73, 0x74, 0x6f, 0x6e, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x42, 0x6a, 0x5a, 0x48, 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, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, + 0x2f, 0x76, 0x32, 0x2f, 0x74, 0x6f, 0x6d, 0x62, 0x73, 0x74, 0x6f, 0x6e, 0x65, 0x2f, 0x67, 0x72, + 0x70, 0x63, 0x3b, 0x74, 0x6f, 0x6d, 0x62, 0x73, 0x74, 0x6f, 0x6e, 0x65, 0xaa, 0x02, 0x1d, 0x4e, + 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, + 0x50, 0x49, 0x2e, 0x54, 0x6f, 0x6d, 0x62, 0x73, 0x74, 0x6f, 0x6e, 0x65, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/tombstone/json.go b/tombstone/json.go index 1059910..05d959e 100644 --- a/tombstone/json.go +++ b/tombstone/json.go @@ -1,8 +1,8 @@ package tombstone import ( - "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" - tombstone "github.com/TrueCloudLab/frostfs-api-go/v2/tombstone/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message" + tombstone "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/tombstone/grpc" ) func (s *Tombstone) MarshalJSON() ([]byte, error) { diff --git a/tombstone/marshal.go b/tombstone/marshal.go index 706d9c1..ae4405c 100644 --- a/tombstone/marshal.go +++ b/tombstone/marshal.go @@ -1,9 +1,9 @@ package tombstone import ( - "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" - tombstone "github.com/TrueCloudLab/frostfs-api-go/v2/tombstone/grpc" - "github.com/TrueCloudLab/frostfs-api-go/v2/util/proto" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message" + tombstone "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/tombstone/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/proto" ) const ( diff --git a/tombstone/message_test.go b/tombstone/message_test.go index ae0ad00..7528c73 100644 --- a/tombstone/message_test.go +++ b/tombstone/message_test.go @@ -3,9 +3,9 @@ package tombstone_test import ( "testing" - "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message" - messagetest "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message/test" - tombstonetest "github.com/TrueCloudLab/frostfs-api-go/v2/tombstone/test" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message" + messagetest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message/test" + tombstonetest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/tombstone/test" ) func TestMessageConvert(t *testing.T) { diff --git a/tombstone/test/generate.go b/tombstone/test/generate.go index 00ffa92..3caf528 100644 --- a/tombstone/test/generate.go +++ b/tombstone/test/generate.go @@ -1,8 +1,8 @@ package tombstonetest import ( - refstest "github.com/TrueCloudLab/frostfs-api-go/v2/refs/test" - "github.com/TrueCloudLab/frostfs-api-go/v2/tombstone" + refstest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/test" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/tombstone" ) func GenerateTombstone(empty bool) *tombstone.Tombstone { diff --git a/tombstone/types.go b/tombstone/types.go index 4f2ffb4..edcd934 100644 --- a/tombstone/types.go +++ b/tombstone/types.go @@ -1,7 +1,7 @@ package tombstone import ( - "github.com/TrueCloudLab/frostfs-api-go/v2/refs" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" ) // Tombstone is a unified structure of Tombstone diff --git a/util/proto/marshal_test.go b/util/proto/marshal_test.go index b34e9d0..de2b72f 100644 --- a/util/proto/marshal_test.go +++ b/util/proto/marshal_test.go @@ -4,8 +4,8 @@ import ( "math" "testing" - "github.com/TrueCloudLab/frostfs-api-go/v2/util/proto" - "github.com/TrueCloudLab/frostfs-api-go/v2/util/proto/test" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/proto" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/proto/test" "github.com/stretchr/testify/require" goproto "google.golang.org/protobuf/proto" ) diff --git a/util/protogen/main.go b/util/protogen/main.go index b5a1931..99f5b7b 100644 --- a/util/protogen/main.go +++ b/util/protogen/main.go @@ -31,7 +31,7 @@ func generateFile(gen *protogen.Plugin, file *protogen.File) *protogen.Generated g.P() g.P("package ", file.GoPackageName) g.P() - g.P(`import "github.com/TrueCloudLab/frostfs-api-go/v2/util/proto"`) + g.P(`import "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/proto"`) //for _, e := range file.Enums { // g.P("type " + e.GoIdent.GoName + " int32") diff --git a/util/signature/data.go b/util/signature/data.go index efe543d..6de9466 100644 --- a/util/signature/data.go +++ b/util/signature/data.go @@ -3,8 +3,8 @@ package signature import ( "crypto/ecdsa" - "github.com/TrueCloudLab/frostfs-api-go/v2/refs" - crypto "github.com/TrueCloudLab/frostfs-crypto" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" + crypto "git.frostfs.info/TrueCloudLab/frostfs-crypto" ) type DataSource interface { diff --git a/util/signature/options.go b/util/signature/options.go index cb25034..28728dc 100644 --- a/util/signature/options.go +++ b/util/signature/options.go @@ -5,9 +5,9 @@ import ( "encoding/base64" "fmt" - "github.com/TrueCloudLab/frostfs-api-go/v2/refs" - "github.com/TrueCloudLab/frostfs-api-go/v2/util/signature/walletconnect" - crypto "github.com/TrueCloudLab/frostfs-crypto" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/signature/walletconnect" + crypto "git.frostfs.info/TrueCloudLab/frostfs-crypto" ) type cfg struct { diff --git a/util/signature/sign_test.go b/util/signature/sign_test.go index c819068..1fe2a4a 100644 --- a/util/signature/sign_test.go +++ b/util/signature/sign_test.go @@ -6,7 +6,7 @@ import ( "crypto/rand" "testing" - "github.com/TrueCloudLab/frostfs-api-go/v2/refs" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" "github.com/stretchr/testify/require" ) diff --git a/util/signature/walletconnect/sign.go b/util/signature/walletconnect/sign.go index bd24a89..b96a842 100644 --- a/util/signature/walletconnect/sign.go +++ b/util/signature/walletconnect/sign.go @@ -7,7 +7,7 @@ import ( "encoding/binary" "encoding/hex" - crypto "github.com/TrueCloudLab/frostfs-crypto" + crypto "git.frostfs.info/TrueCloudLab/frostfs-crypto" ) const ( From 5faee63f60d15cdc9fb47ff57c81554100d97b9d Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Fri, 3 Mar 2023 12:51:08 +0300 Subject: [PATCH 1030/1196] [#7] pre-commit: Add initial configuration Signed-off-by: Evgenii Stratonikov --- .golangci.yml | 4 ++-- .pre-commit-config.yaml | 19 +++++++++++++++++++ CHANGELOG.md | 34 +++++++++++++++++----------------- Makefile | 0 4 files changed, 38 insertions(+), 19 deletions(-) create mode 100644 .pre-commit-config.yaml mode change 100644 => 100755 Makefile diff --git a/.golangci.yml b/.golangci.yml index 8f35944..5abd044 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -11,7 +11,7 @@ run: skip-files: - (^|.*/)grpc/(.*) - + # output configuration options output: # colored-line-number|line-number|json|tab|checkstyle|code-climate, default is "colored-line-number" @@ -64,4 +64,4 @@ issues: - linters: # ignore SA6002 since we use pool of []byte, however we can switch to *bytes.Buffer - staticcheck - text: "SA6002:" \ No newline at end of file + text: "SA6002:" diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..9c6f604 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,19 @@ +ci: + autofix_prs: false + +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.4.0 + hooks: + - id: check-added-large-files + - id: check-case-conflict + - id: check-executables-have-shebangs + - id: check-shebang-scripts-are-executable + - id: check-merge-conflict + - id: check-json + - id: check-xml + - id: check-yaml + - id: trailing-whitespace + args: [--markdown-linebreak-ext=md] + - id: end-of-file-fixer + exclude: ".key$" diff --git a/CHANGELOG.md b/CHANGELOG.md index c49300a..3b31e83 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,7 +22,7 @@ - Mark all expiration methods as deprecated (#417) ### Updated -- Minimal go version to 1.17 (#412) +- Minimal go version to 1.17 (#412) - `neofs-crypto` to `v0.4.0` (#412) - `google.golang.org/grpc` to `v1.48.0` (#415) - `google.golang.org/protobuf` to `v1.28.0` (#415) @@ -60,7 +60,7 @@ NeoFS API v2.13 support ### Fixed - Incompatible changes in signature scheme (#380) - + ### Added - Public URI-parsing function `client.ParseURI()` (#383) @@ -92,9 +92,9 @@ NeoFS API v2.12 support ## [2.11.0] - 2021-12-02 - Sinjido (신지도, 薪智島) -NeoFS API v2.11 support. High level packages are moved to -[neofs-sdk-go](https://github.com/nspcc-dev/neofs-sdk-go) repository. -Repository restructured as Go module version 2 and synced with +NeoFS API v2.11 support. High level packages are moved to +[neofs-sdk-go](https://github.com/nspcc-dev/neofs-sdk-go) repository. +Repository restructured as Go module version 2 and synced with [neofs-api](https://github.com/nspcc-dev/neofs-api) release version. ### Fixed @@ -109,7 +109,7 @@ Repository restructured as Go module version 2 and synced with - neofs-api-go is now Go module version 2 (#201) ### Removed -- All packages from `pkg` moved to +- All packages from `pkg` moved to [neofs-sdk-go](https://github.com/nspcc-dev/neofs-sdk-go) (#201) ## [1.30.0] - 2021-10-19 - Udo (우도, 牛島) @@ -126,7 +126,7 @@ NeoFS API v2.10 support. - pkg/client callback to parse internal response information (#337) - Service filter type in extended ACL from API v2.10 (#338) - Enhanced network info structures from API v2.10 (#339) -- Well-known public-append basic ACL constant (#341) +- Well-known public-append basic ACL constant (#341) - Native contract names support (#351) ### Changed @@ -258,7 +258,7 @@ Raw client and support of NeoFS API v2.5.0 "Jebudo" release. ### Added - Raw client for peer to peer communication. -- `client.WithKey` option to sign messages with different keys within single +- `client.WithKey` option to sign messages with different keys within single client. - `Content-Type` well-known object attribute constant. @@ -271,7 +271,7 @@ Raw client and support of NeoFS API v2.5.0 "Jebudo" release. Support changes from NeoFS API v2.4.0 "Ganghwado" release. -### Added +### Added - `netmap.NetworkInfo` definitions in `v2` and `pkg/netmap`. - `netmap.NetworkInfo` RPC support in `pkg/client`. @@ -322,7 +322,7 @@ Support changes from NeoFS API v2.2.1 release. ### Fixed -- Remarks of the updated linter. +- Remarks of the updated linter. ## [1.22.0] - 2020-12-30 - Yeouido (여의도, 汝矣島) @@ -335,7 +335,7 @@ Support changes from NeoFS API v2.2.0 "Yeouido" release. - Support of `StorageGroup` message. - Support of `DataAuditResult` message. - Stringer and string parser for `Checksum` type of client library. -- Stringer and string parser for `Type` message. +- Stringer and string parser for `Type` message. - Stringer and string parser for `Type` type of client library. - `AddTypeFilter` method on `SearchFilters` type of client library that adds filter by object type. @@ -350,7 +350,7 @@ Support changes from NeoFS API v2.2.0 "Yeouido" release. - `Container.SetNonceUUID` setter of container nonce in UUID format. - `NewVerifiedContainerFromV2` container constructor that preliminary checks if container message argument meets NeoFS API V2 specification. - + ### Changed - `Container.Nonce`/`Container.SetNonce` marked as deprecated. @@ -368,7 +368,7 @@ Support neofs-api v2.1.1. ### Added -- `client.GetVerifiedContainerStructure` function to check +- `client.GetVerifiedContainerStructure` function to check that the container structure matches the requested identifier. ## [1.21.0] - 2020-12-11 - Modo (모도, 茅島) @@ -391,7 +391,7 @@ Support neofs-api v2.1.1. ### Renamed -- `AddLeafFilter` to `AddPhyFilter` +- `AddLeafFilter` to `AddPhyFilter` ### Fixed @@ -425,9 +425,9 @@ Support neofs-api v2.1.1. ## [1.20.0] - 2020-11-16 - Jindo (진도, 珍島) -Major API refactoring and simplification. From now on this library will have -backward compatibility and support of major versions of NeoFS-API by having -**version specific** files in `vN` dirs and **version independent** SDK +Major API refactoring and simplification. From now on this library will have +backward compatibility and support of major versions of NeoFS-API by having +**version specific** files in `vN` dirs and **version independent** SDK structures and client in `pkg`. This version supports NeoFS-API v2.0.X diff --git a/Makefile b/Makefile old mode 100644 new mode 100755 From 3af7645abf6ce59e3aab8a6ee6e76b8acbf83924 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Fri, 3 Mar 2023 12:55:17 +0300 Subject: [PATCH 1031/1196] [#7] pre-commit: Add golangci-lint hook Signed-off-by: Evgenii Stratonikov --- .pre-commit-config.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 9c6f604..46c9c89 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -17,3 +17,8 @@ repos: args: [--markdown-linebreak-ext=md] - id: end-of-file-fixer exclude: ".key$" + + - repo: https://github.com/golangci/golangci-lint + rev: v1.51.2 + hooks: + - id: golangci-lint From bd67469f43f9addad55ee7a256b73b5f02b70597 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Fri, 3 Mar 2023 12:55:38 +0300 Subject: [PATCH 1032/1196] [#7] pre-commit: Add gitlint hook Signed-off-by: Evgenii Stratonikov --- .gitlint | 10 ++++++++++ .pre-commit-config.yaml | 6 ++++++ 2 files changed, 16 insertions(+) create mode 100644 .gitlint diff --git a/.gitlint b/.gitlint new file mode 100644 index 0000000..9ce883f --- /dev/null +++ b/.gitlint @@ -0,0 +1,10 @@ +[general] +fail-without-commits=true +contrib=CC1 + +[title-match-regex] +regex=^\[\#[0-9]+\]\s + +[ignore-by-title] +regex=^Release(.*) +ignore=title-match-regex diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 46c9c89..3050af4 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -22,3 +22,9 @@ repos: rev: v1.51.2 hooks: - id: golangci-lint + + - repo: https://github.com/jorisroovers/gitlint + rev: v0.18.0 + hooks: + - id: gitlint + stages: [commit-msg] From 3f7cb1b5ef2dddd2a7f118983df8bdb11dcd7cc6 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Tue, 7 Mar 2023 09:56:34 +0300 Subject: [PATCH 1033/1196] [#7] .github: Remove directory Signed-off-by: Evgenii Stratonikov --- .github/logo.svg | 70 --------------------------------------- .github/workflows/dco.yml | 21 ------------ .github/workflows/go.yml | 64 ----------------------------------- 3 files changed, 155 deletions(-) delete mode 100644 .github/logo.svg delete mode 100644 .github/workflows/dco.yml delete mode 100644 .github/workflows/go.yml diff --git a/.github/logo.svg b/.github/logo.svg deleted file mode 100644 index 148c359..0000000 --- a/.github/logo.svg +++ /dev/null @@ -1,70 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/.github/workflows/dco.yml b/.github/workflows/dco.yml deleted file mode 100644 index 40ed8fc..0000000 --- a/.github/workflows/dco.yml +++ /dev/null @@ -1,21 +0,0 @@ -name: DCO check - -on: - pull_request: - branches: - - master - -jobs: - commits_check_job: - runs-on: ubuntu-latest - name: Commits Check - steps: - - name: Get PR Commits - id: 'get-pr-commits' - uses: tim-actions/get-pr-commits@master - with: - token: ${{ secrets.GITHUB_TOKEN }} - - name: DCO Check - uses: tim-actions/dco@master - with: - commits: ${{ steps.get-pr-commits.outputs.commits }} diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml deleted file mode 100644 index 48e770c..0000000 --- a/.github/workflows/go.yml +++ /dev/null @@ -1,64 +0,0 @@ -name: neofs-api-go tests - -on: - push: - branches: - - master - paths-ignore: - - '*.md' - pull_request: - branches: - - master - paths-ignore: - - '*.md' - -jobs: - test: - runs-on: ubuntu-20.04 - strategy: - matrix: - go: [ '1.17.x', '1.18.x', '1.19.x' ] - steps: - - name: Setup go - uses: actions/setup-go@v3 - with: - go-version: ${{ matrix.go }} - - - name: Check out code - uses: actions/checkout@v3 - - - name: Cache go mod - uses: actions/cache@v3 - with: - path: ~/go/pkg/mod - key: ${{ runner.os }}-go-${{ matrix.go }}-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-go-${{ matrix.go }}- - - - name: Get dependencies - run: make dep - - - name: Run go test - run: go test -coverprofile=coverage.txt -covermode=atomic ./... - - - name: Codecov - env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - run: bash <(curl -s https://codecov.io/bash) - - lint: - runs-on: ubuntu-20.04 - steps: - - name: Setup go - uses: actions/setup-go@v3 - with: - go-version: 1.19 - - - name: Check out code - uses: actions/checkout@v3 - - - name: golangci-lint - uses: golangci/golangci-lint-action@v3 - with: - version: v1.48.0 - only-new-issues: true From 63eb4dc3eabffb2fcbd548180f3f8a9f2cdaee02 Mon Sep 17 00:00:00 2001 From: Dmitrii Stepanov Date: Tue, 28 Feb 2023 12:11:05 +0300 Subject: [PATCH 1034/1196] [#3] api-go: Go version up Update go version 1.17 -> 1.18 Signed-off-by: Dmitrii Stepanov --- go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 25445da..a30ccb8 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 -go 1.17 +go 1.18 require ( git.frostfs.info/TrueCloudLab/frostfs-crypto v0.6.0 From d005bf0393c6f282fc3f070e736c0f693203d97d Mon Sep 17 00:00:00 2001 From: Dmitrii Stepanov Date: Tue, 28 Feb 2023 13:01:18 +0300 Subject: [PATCH 1035/1196] [#3] signature: Refactor sign and verify Split methods to separate files, drop redundant intefaces Signed-off-by: Dmitrii Stepanov --- go.mod | 3 +- go.sum | 8 +- signature/body.go | 115 +++++++++++++ signature/marshaller.go | 26 +++ signature/sign.go | 357 ++++----------------------------------- signature/verify.go | 111 ++++++++++++ util/collection/slice.go | 17 ++ 7 files changed, 312 insertions(+), 325 deletions(-) create mode 100644 signature/body.go create mode 100644 signature/marshaller.go create mode 100644 signature/verify.go create mode 100644 util/collection/slice.go diff --git a/go.mod b/go.mod index a30ccb8..1c60a27 100644 --- a/go.mod +++ b/go.mod @@ -5,6 +5,7 @@ go 1.18 require ( git.frostfs.info/TrueCloudLab/frostfs-crypto v0.6.0 github.com/stretchr/testify v1.7.0 + golang.org/x/exp v0.0.0-20230224173230-c95f2b4c22f2 google.golang.org/grpc v1.48.0 google.golang.org/protobuf v1.28.0 ) @@ -16,7 +17,7 @@ require ( github.com/mr-tron/base58 v1.2.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect golang.org/x/net v0.0.0-20201021035429-f5854403a974 // indirect - golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4 // indirect + golang.org/x/sys v0.1.0 // indirect golang.org/x/text v0.3.3 // indirect google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 // indirect gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect diff --git a/go.sum b/go.sum index 34f4d44..c33a4c1 100644 --- a/go.sum +++ b/go.sum @@ -46,8 +46,8 @@ github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/mr-tron/base58 v1.2.0 h1:T/HDJBh4ZCPbU39/+c3rRvE0uKBQlU27+QI8LJ4t64o= @@ -64,6 +64,8 @@ go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqe golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20230224173230-c95f2b4c22f2 h1:Jvc7gsqn21cJHCmAWx0LiimpP18LZmUxkT5Mp7EZ1mI= +golang.org/x/exp v0.0.0-20230224173230-c95f2b4c22f2/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= @@ -87,8 +89,9 @@ golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4 h1:myAQVi0cGEoqQVR5POX+8RR2mrocKqNN1hmeMqhX27k= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.1.0 h1:kunALQeHf1/185U1i0GOB/fy1IPRDDpuoOOqRReG57U= +golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= @@ -98,7 +101,6 @@ golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3 golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= diff --git a/signature/body.go b/signature/body.go new file mode 100644 index 0000000..bf3ab6c --- /dev/null +++ b/signature/body.go @@ -0,0 +1,115 @@ +package signature + +import ( + "fmt" + + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/accounting" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/container" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/netmap" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/object" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/reputation" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session" +) + +func serviceMessageBody(req interface{}) stableMarshaler { + switch v := req.(type) { + default: + panic(fmt.Sprintf("unsupported session message %T", req)) + + /* Accounting */ + case *accounting.BalanceRequest: + return v.GetBody() + case *accounting.BalanceResponse: + return v.GetBody() + + /* Session */ + case *session.CreateRequest: + return v.GetBody() + case *session.CreateResponse: + return v.GetBody() + + /* Container */ + case *container.PutRequest: + return v.GetBody() + case *container.PutResponse: + return v.GetBody() + case *container.DeleteRequest: + return v.GetBody() + case *container.DeleteResponse: + return v.GetBody() + case *container.GetRequest: + return v.GetBody() + case *container.GetResponse: + return v.GetBody() + case *container.ListRequest: + return v.GetBody() + case *container.ListResponse: + return v.GetBody() + case *container.SetExtendedACLRequest: + return v.GetBody() + case *container.SetExtendedACLResponse: + return v.GetBody() + case *container.GetExtendedACLRequest: + return v.GetBody() + case *container.GetExtendedACLResponse: + return v.GetBody() + case *container.AnnounceUsedSpaceRequest: + return v.GetBody() + case *container.AnnounceUsedSpaceResponse: + return v.GetBody() + + /* Object */ + case *object.PutRequest: + return v.GetBody() + case *object.PutResponse: + return v.GetBody() + case *object.GetRequest: + return v.GetBody() + case *object.GetResponse: + return v.GetBody() + case *object.HeadRequest: + return v.GetBody() + case *object.HeadResponse: + return v.GetBody() + case *object.SearchRequest: + return v.GetBody() + case *object.SearchResponse: + return v.GetBody() + case *object.DeleteRequest: + return v.GetBody() + case *object.DeleteResponse: + return v.GetBody() + case *object.GetRangeRequest: + return v.GetBody() + case *object.GetRangeResponse: + return v.GetBody() + case *object.GetRangeHashRequest: + return v.GetBody() + case *object.GetRangeHashResponse: + return v.GetBody() + + /* Netmap */ + case *netmap.LocalNodeInfoRequest: + return v.GetBody() + case *netmap.LocalNodeInfoResponse: + return v.GetBody() + case *netmap.NetworkInfoRequest: + return v.GetBody() + case *netmap.NetworkInfoResponse: + return v.GetBody() + case *netmap.SnapshotRequest: + return v.GetBody() + case *netmap.SnapshotResponse: + return v.GetBody() + + /* Reputation */ + case *reputation.AnnounceLocalTrustRequest: + return v.GetBody() + case *reputation.AnnounceLocalTrustResponse: + return v.GetBody() + case *reputation.AnnounceIntermediateResultRequest: + return v.GetBody() + case *reputation.AnnounceIntermediateResultResponse: + return v.GetBody() + } +} diff --git a/signature/marshaller.go b/signature/marshaller.go new file mode 100644 index 0000000..ff9beb3 --- /dev/null +++ b/signature/marshaller.go @@ -0,0 +1,26 @@ +package signature + +type stableMarshaler interface { + StableMarshal([]byte) []byte + StableSize() int +} + +type StableMarshalerWrapper struct { + SM stableMarshaler +} + +func (s StableMarshalerWrapper) ReadSignedData(buf []byte) ([]byte, error) { + if s.SM != nil { + return s.SM.StableMarshal(buf), nil + } + + return nil, nil +} + +func (s StableMarshalerWrapper) SignedDataSize() int { + if s.SM != nil { + return s.SM.StableSize() + } + + return 0 +} diff --git a/signature/sign.go b/signature/sign.go index f4dad90..bd53d94 100644 --- a/signature/sign.go +++ b/signature/sign.go @@ -2,15 +2,9 @@ package signature import ( "crypto/ecdsa" - "errors" "fmt" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/accounting" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/container" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/netmap" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/object" "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/reputation" "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session" "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/signature" ) @@ -27,169 +21,69 @@ type serviceResponse interface { SetVerificationHeader(*session.ResponseVerificationHeader) } -type stableMarshaler interface { - StableMarshal([]byte) []byte - StableSize() int -} - -type StableMarshalerWrapper struct { - SM stableMarshaler -} - -type metaHeader interface { - stableMarshaler - getOrigin() metaHeader -} - -type verificationHeader interface { - stableMarshaler - - GetBodySignature() *refs.Signature +type signatureReceiver interface { SetBodySignature(*refs.Signature) - GetMetaSignature() *refs.Signature SetMetaSignature(*refs.Signature) - GetOriginSignature() *refs.Signature SetOriginSignature(*refs.Signature) - - setOrigin(stableMarshaler) - getOrigin() verificationHeader -} - -type requestMetaHeader struct { - *session.RequestMetaHeader -} - -type responseMetaHeader struct { - *session.ResponseMetaHeader -} - -type requestVerificationHeader struct { - *session.RequestVerificationHeader -} - -type responseVerificationHeader struct { - *session.ResponseVerificationHeader -} - -func (h *requestMetaHeader) getOrigin() metaHeader { - return &requestMetaHeader{ - RequestMetaHeader: h.GetOrigin(), - } -} - -func (h *responseMetaHeader) getOrigin() metaHeader { - return &responseMetaHeader{ - ResponseMetaHeader: h.GetOrigin(), - } -} - -func (h *requestVerificationHeader) getOrigin() verificationHeader { - if origin := h.GetOrigin(); origin != nil { - return &requestVerificationHeader{ - RequestVerificationHeader: origin, - } - } - - return nil -} - -func (h *requestVerificationHeader) setOrigin(m stableMarshaler) { - if m != nil { - h.SetOrigin(m.(*session.RequestVerificationHeader)) - } -} - -func (r *responseVerificationHeader) getOrigin() verificationHeader { - if origin := r.GetOrigin(); origin != nil { - return &responseVerificationHeader{ - ResponseVerificationHeader: origin, - } - } - - return nil -} - -func (r *responseVerificationHeader) setOrigin(m stableMarshaler) { - if m != nil { - r.SetOrigin(m.(*session.ResponseVerificationHeader)) - } -} - -func (s StableMarshalerWrapper) ReadSignedData(buf []byte) ([]byte, error) { - if s.SM != nil { - return s.SM.StableMarshal(buf), nil - } - - return nil, nil -} - -func (s StableMarshalerWrapper) SignedDataSize() int { - if s.SM != nil { - return s.SM.StableSize() - } - - return 0 } +// SignServiceMessage signes service message with key. func SignServiceMessage(key *ecdsa.PrivateKey, msg interface{}) error { - var ( - body, meta, verifyOrigin stableMarshaler - verifyHdr verificationHeader - verifyHdrSetter func(verificationHeader) - ) - switch v := msg.(type) { case nil: return nil case serviceRequest: - body = serviceMessageBody(v) - meta = v.GetMetaHeader() - verifyHdr = &requestVerificationHeader{new(session.RequestVerificationHeader)} - verifyHdrSetter = func(h verificationHeader) { - v.SetVerificationHeader(h.(*requestVerificationHeader).RequestVerificationHeader) - } - - if h := v.GetVerificationHeader(); h != nil { - verifyOrigin = h - } + return signServiceRequest(key, v) case serviceResponse: - body = serviceMessageBody(v) - meta = v.GetMetaHeader() - verifyHdr = &responseVerificationHeader{new(session.ResponseVerificationHeader)} - verifyHdrSetter = func(h verificationHeader) { - v.SetVerificationHeader(h.(*responseVerificationHeader).ResponseVerificationHeader) - } - - if h := v.GetVerificationHeader(); h != nil { - verifyOrigin = h - } + return signServiceResponse(key, v) default: panic(fmt.Sprintf("unsupported session message %T", v)) } +} - if verifyOrigin == nil { +func signServiceRequest(key *ecdsa.PrivateKey, v serviceRequest) error { + result := &session.RequestVerificationHeader{} + body := serviceMessageBody(v) + meta := v.GetMetaHeader() + header := v.GetVerificationHeader() + if err := signMessageParts(key, body, meta, header, header != nil, result); err != nil { + return err + } + result.SetOrigin(header) + v.SetVerificationHeader(result) + return nil +} + +func signServiceResponse(key *ecdsa.PrivateKey, v serviceResponse) error { + result := &session.ResponseVerificationHeader{} + body := serviceMessageBody(v) + meta := v.GetMetaHeader() + header := v.GetVerificationHeader() + if err := signMessageParts(key, body, meta, header, header != nil, result); err != nil { + return err + } + result.SetOrigin(header) + v.SetVerificationHeader(result) + return nil +} + +func signMessageParts(key *ecdsa.PrivateKey, body, meta, header stableMarshaler, hasHeader bool, result signatureReceiver) error { + if !hasHeader { // sign session message body - if err := signServiceMessagePart(key, body, verifyHdr.SetBodySignature); err != nil { + if err := signServiceMessagePart(key, body, result.SetBodySignature); err != nil { return fmt.Errorf("could not sign body: %w", err) } } // sign meta header - if err := signServiceMessagePart(key, meta, verifyHdr.SetMetaSignature); err != nil { + if err := signServiceMessagePart(key, meta, result.SetMetaSignature); err != nil { return fmt.Errorf("could not sign meta header: %w", err) } // sign verification header origin - if err := signServiceMessagePart(key, verifyOrigin, verifyHdr.SetOriginSignature); err != nil { + if err := signServiceMessagePart(key, header, result.SetOriginSignature); err != nil { return fmt.Errorf("could not sign origin of verification header: %w", err) } - - // wrap origin verification header - verifyHdr.setOrigin(verifyOrigin) - - // update matryoshka verification header - verifyHdrSetter(verifyHdr) - return nil } @@ -212,182 +106,3 @@ func signServiceMessagePart(key *ecdsa.PrivateKey, part stableMarshaler, sigWrit return nil } - -func VerifyServiceMessage(msg interface{}) error { - var ( - meta metaHeader - verify verificationHeader - ) - - switch v := msg.(type) { - case nil: - return nil - case serviceRequest: - meta = &requestMetaHeader{ - RequestMetaHeader: v.GetMetaHeader(), - } - - verify = &requestVerificationHeader{ - RequestVerificationHeader: v.GetVerificationHeader(), - } - case serviceResponse: - meta = &responseMetaHeader{ - ResponseMetaHeader: v.GetMetaHeader(), - } - - verify = &responseVerificationHeader{ - ResponseVerificationHeader: v.GetVerificationHeader(), - } - default: - panic(fmt.Sprintf("unsupported session message %T", v)) - } - - body := serviceMessageBody(msg) - size := body.StableSize() - if sz := meta.StableSize(); sz > size { - size = sz - } - if sz := verify.StableSize(); sz > size { - size = sz - } - - buf := make([]byte, 0, size) - return verifyMatryoshkaLevel(body, meta, verify, buf) -} - -func verifyMatryoshkaLevel(body stableMarshaler, meta metaHeader, verify verificationHeader, buf []byte) error { - if err := verifyServiceMessagePart(meta, verify.GetMetaSignature, buf); err != nil { - return fmt.Errorf("could not verify meta header: %w", err) - } - - origin := verify.getOrigin() - - if err := verifyServiceMessagePart(origin, verify.GetOriginSignature, buf); err != nil { - return fmt.Errorf("could not verify origin of verification header: %w", err) - } - - if origin == nil { - if err := verifyServiceMessagePart(body, verify.GetBodySignature, buf); err != nil { - return fmt.Errorf("could not verify body: %w", err) - } - - return nil - } - - if verify.GetBodySignature() != nil { - return errors.New("body signature at the matryoshka upper level") - } - - return verifyMatryoshkaLevel(body, meta.getOrigin(), origin, buf) -} - -func verifyServiceMessagePart(part stableMarshaler, sigRdr func() *refs.Signature, buf []byte) error { - return signature.VerifyDataWithSource( - &StableMarshalerWrapper{part}, - sigRdr, - signature.WithBuffer(buf), - ) -} - -func serviceMessageBody(req interface{}) stableMarshaler { - switch v := req.(type) { - default: - panic(fmt.Sprintf("unsupported session message %T", req)) - - /* Accounting */ - case *accounting.BalanceRequest: - return v.GetBody() - case *accounting.BalanceResponse: - return v.GetBody() - - /* Session */ - case *session.CreateRequest: - return v.GetBody() - case *session.CreateResponse: - return v.GetBody() - - /* Container */ - case *container.PutRequest: - return v.GetBody() - case *container.PutResponse: - return v.GetBody() - case *container.DeleteRequest: - return v.GetBody() - case *container.DeleteResponse: - return v.GetBody() - case *container.GetRequest: - return v.GetBody() - case *container.GetResponse: - return v.GetBody() - case *container.ListRequest: - return v.GetBody() - case *container.ListResponse: - return v.GetBody() - case *container.SetExtendedACLRequest: - return v.GetBody() - case *container.SetExtendedACLResponse: - return v.GetBody() - case *container.GetExtendedACLRequest: - return v.GetBody() - case *container.GetExtendedACLResponse: - return v.GetBody() - case *container.AnnounceUsedSpaceRequest: - return v.GetBody() - case *container.AnnounceUsedSpaceResponse: - return v.GetBody() - - /* Object */ - case *object.PutRequest: - return v.GetBody() - case *object.PutResponse: - return v.GetBody() - case *object.GetRequest: - return v.GetBody() - case *object.GetResponse: - return v.GetBody() - case *object.HeadRequest: - return v.GetBody() - case *object.HeadResponse: - return v.GetBody() - case *object.SearchRequest: - return v.GetBody() - case *object.SearchResponse: - return v.GetBody() - case *object.DeleteRequest: - return v.GetBody() - case *object.DeleteResponse: - return v.GetBody() - case *object.GetRangeRequest: - return v.GetBody() - case *object.GetRangeResponse: - return v.GetBody() - case *object.GetRangeHashRequest: - return v.GetBody() - case *object.GetRangeHashResponse: - return v.GetBody() - - /* Netmap */ - case *netmap.LocalNodeInfoRequest: - return v.GetBody() - case *netmap.LocalNodeInfoResponse: - return v.GetBody() - case *netmap.NetworkInfoRequest: - return v.GetBody() - case *netmap.NetworkInfoResponse: - return v.GetBody() - case *netmap.SnapshotRequest: - return v.GetBody() - case *netmap.SnapshotResponse: - return v.GetBody() - - /* Reputation */ - case *reputation.AnnounceLocalTrustRequest: - return v.GetBody() - case *reputation.AnnounceLocalTrustResponse: - return v.GetBody() - case *reputation.AnnounceIntermediateResultRequest: - return v.GetBody() - case *reputation.AnnounceIntermediateResultResponse: - return v.GetBody() - } -} diff --git a/signature/verify.go b/signature/verify.go new file mode 100644 index 0000000..fe76844 --- /dev/null +++ b/signature/verify.go @@ -0,0 +1,111 @@ +package signature + +import ( + "errors" + "fmt" + + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/collection" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/signature" +) + +type signatureProvider interface { + GetBodySignature() *refs.Signature + GetMetaSignature() *refs.Signature + GetOriginSignature() *refs.Signature +} + +// VerifyServiceMessage verifies service message. +func VerifyServiceMessage(msg interface{}) error { + switch v := msg.(type) { + case nil: + return nil + case serviceRequest: + return verifyServiceRequest(v) + case serviceResponse: + return verifyServiceResponse(v) + default: + panic(fmt.Sprintf("unsupported session message %T", v)) + } +} + +func verifyServiceRequest(v serviceRequest) error { + meta := v.GetMetaHeader() + verificationHeader := v.GetVerificationHeader() + body := serviceMessageBody(v) + size := collection.Max(body.StableSize(), meta.StableSize(), verificationHeader.StableSize()) + buf := make([]byte, 0, size) + return verifyServiceRequestRecursive(body, meta, verificationHeader, buf) +} + +func verifyServiceRequestRecursive(body stableMarshaler, meta *session.RequestMetaHeader, verify *session.RequestVerificationHeader, buf []byte) error { + verificationHeaderOrigin := verify.GetOrigin() + metaOrigin := meta.GetOrigin() + + stop, err := verifyMessageParts(body, meta, verificationHeaderOrigin, verificationHeaderOrigin != nil, verify, buf) + if err != nil { + return err + } + if stop { + return nil + } + + return verifyServiceRequestRecursive(body, metaOrigin, verificationHeaderOrigin, buf) +} + +func verifyMessageParts(body, meta, originHeader stableMarshaler, hasOriginHeader bool, sigProvider signatureProvider, buf []byte) (stop bool, err error) { + if err := verifyServiceMessagePart(meta, sigProvider.GetMetaSignature, buf); err != nil { + return false, fmt.Errorf("could not verify meta header: %w", err) + } + + if err := verifyServiceMessagePart(originHeader, sigProvider.GetOriginSignature, buf); err != nil { + return false, fmt.Errorf("could not verify origin of verification header: %w", err) + } + + if !hasOriginHeader { + if err := verifyServiceMessagePart(body, sigProvider.GetBodySignature, buf); err != nil { + return false, fmt.Errorf("could not verify body: %w", err) + } + + return true, nil + } + + if sigProvider.GetBodySignature() != nil { + return false, errors.New("body signature misses at the matryoshka upper level") + } + + return false, nil +} + +func verifyServiceResponse(v serviceResponse) error { + meta := v.GetMetaHeader() + verificationHeader := v.GetVerificationHeader() + body := serviceMessageBody(v) + size := collection.Max(body.StableSize(), meta.StableSize(), verificationHeader.StableSize()) + buf := make([]byte, 0, size) + return verifyServiceResponseRecursive(body, meta, verificationHeader, buf) +} + +func verifyServiceResponseRecursive(body stableMarshaler, meta *session.ResponseMetaHeader, verify *session.ResponseVerificationHeader, buf []byte) error { + verificationHeaderOrigin := verify.GetOrigin() + metaOrigin := meta.GetOrigin() + + stop, err := verifyMessageParts(body, meta, verificationHeaderOrigin, verificationHeaderOrigin != nil, verify, buf) + if err != nil { + return err + } + if stop { + return nil + } + + return verifyServiceResponseRecursive(body, metaOrigin, verificationHeaderOrigin, buf) +} + +func verifyServiceMessagePart(part stableMarshaler, sigRdr func() *refs.Signature, buf []byte) error { + return signature.VerifyDataWithSource( + &StableMarshalerWrapper{part}, + sigRdr, + signature.WithBuffer(buf), + ) +} diff --git a/util/collection/slice.go b/util/collection/slice.go new file mode 100644 index 0000000..436f28c --- /dev/null +++ b/util/collection/slice.go @@ -0,0 +1,17 @@ +package collection + +import "golang.org/x/exp/constraints" + +// Max finds maximum value of items. +func Max[T constraints.Ordered](items ...T) T { + if len(items) == 0 { + panic("failed to get max value: empty slice") + } + result := items[0] + for i := 1; i < len(items); i++ { + if items[i] > result { + result = items[i] + } + } + return result +} From e073c996fc9869c4bd11796b17cfc6b49c1eacd9 Mon Sep 17 00:00:00 2001 From: Dmitrii Stepanov Date: Tue, 28 Feb 2023 14:43:13 +0300 Subject: [PATCH 1036/1196] [#3] signature: Add benchmarks Add benchmarks for sign and verify methods Signed-off-by: Dmitrii Stepanov --- signature/sign_test.go | 53 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/signature/sign_test.go b/signature/sign_test.go index ff31954..c013525 100644 --- a/signature/sign_test.go +++ b/signature/sign_test.go @@ -70,3 +70,56 @@ func TestBalanceResponse(t *testing.T) { // verification must fail require.Error(t, VerifyServiceMessage(req)) } + +func BenchmarkSignRequest(b *testing.B) { + key, _ := crypto.LoadPrivateKey("Kwk6k2eC3L3QuPvD8aiaNyoSXgQ2YL1bwS5CP1oKoA9waeAze97s") + + b.ResetTimer() + b.ReportAllocs() + + for i := 0; i < b.N; i++ { + b.StopTimer() + dec := new(accounting.Decimal) + dec.SetValue(100) + + body := new(accounting.BalanceResponseBody) + body.SetBalance(dec) + + meta := new(session.ResponseMetaHeader) + meta.SetTTL(1) + + resp := new(accounting.BalanceResponse) + resp.SetBody(body) + resp.SetMetaHeader(meta) + + b.StartTimer() + SignServiceMessage(key, resp) + } +} + +func BenchmarkVerifyRequest(b *testing.B) { + key, _ := crypto.LoadPrivateKey("Kwk6k2eC3L3QuPvD8aiaNyoSXgQ2YL1bwS5CP1oKoA9waeAze97s") + + b.ResetTimer() + b.ReportAllocs() + + for i := 0; i < b.N; i++ { + b.StopTimer() + dec := new(accounting.Decimal) + dec.SetValue(100) + + body := new(accounting.BalanceResponseBody) + body.SetBalance(dec) + + meta := new(session.ResponseMetaHeader) + meta.SetTTL(1) + + resp := new(accounting.BalanceResponse) + resp.SetBody(body) + resp.SetMetaHeader(meta) + SignServiceMessage(key, resp) + b.StartTimer() + + VerifyServiceMessage(resp) + } +} From 611f73ad0fbf9b33c7fb9d69a3b9791ead0f321e Mon Sep 17 00:00:00 2001 From: Dmitrii Stepanov Date: Tue, 28 Feb 2023 17:47:12 +0300 Subject: [PATCH 1037/1196] [#3] signature: Sign parts in parallel Sign request/response parts in parallel Signed-off-by: Dmitrii Stepanov --- go.mod | 1 + go.sum | 2 ++ signature/sign.go | 31 +++++++++++++++++++++---------- 3 files changed, 24 insertions(+), 10 deletions(-) diff --git a/go.mod b/go.mod index 1c60a27..fd9049e 100644 --- a/go.mod +++ b/go.mod @@ -17,6 +17,7 @@ require ( github.com/mr-tron/base58 v1.2.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect golang.org/x/net v0.0.0-20201021035429-f5854403a974 // indirect + golang.org/x/sync v0.1.0 // indirect golang.org/x/sys v0.1.0 // indirect golang.org/x/text v0.3.3 // indirect google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 // indirect diff --git a/go.sum b/go.sum index c33a4c1..4224bda 100644 --- a/go.sum +++ b/go.sum @@ -84,6 +84,8 @@ golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o= +golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= diff --git a/signature/sign.go b/signature/sign.go index bd53d94..5ed7870 100644 --- a/signature/sign.go +++ b/signature/sign.go @@ -7,6 +7,7 @@ import ( "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session" "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/signature" + "golang.org/x/sync/errgroup" ) type serviceRequest interface { @@ -68,23 +69,33 @@ func signServiceResponse(key *ecdsa.PrivateKey, v serviceResponse) error { } func signMessageParts(key *ecdsa.PrivateKey, body, meta, header stableMarshaler, hasHeader bool, result signatureReceiver) error { + eg := &errgroup.Group{} if !hasHeader { // sign session message body - if err := signServiceMessagePart(key, body, result.SetBodySignature); err != nil { - return fmt.Errorf("could not sign body: %w", err) - } + eg.Go(func() error { + if err := signServiceMessagePart(key, body, result.SetBodySignature); err != nil { + return fmt.Errorf("could not sign body: %w", err) + } + return nil + }) } // sign meta header - if err := signServiceMessagePart(key, meta, result.SetMetaSignature); err != nil { - return fmt.Errorf("could not sign meta header: %w", err) - } + eg.Go(func() error { + if err := signServiceMessagePart(key, meta, result.SetMetaSignature); err != nil { + return fmt.Errorf("could not sign meta header: %w", err) + } + return nil + }) // sign verification header origin - if err := signServiceMessagePart(key, header, result.SetOriginSignature); err != nil { - return fmt.Errorf("could not sign origin of verification header: %w", err) - } - return nil + eg.Go(func() error { + if err := signServiceMessagePart(key, header, result.SetOriginSignature); err != nil { + return fmt.Errorf("could not sign origin of verification header: %w", err) + } + return nil + }) + return eg.Wait() } func signServiceMessagePart(key *ecdsa.PrivateKey, part stableMarshaler, sigWrite func(*refs.Signature)) error { From 73fde0e37cdd264bbd3244464d02c1f247ead14b Mon Sep 17 00:00:00 2001 From: Dmitrii Stepanov Date: Tue, 28 Feb 2023 18:52:50 +0300 Subject: [PATCH 1038/1196] [#3] signature: Verify parts in parallel Verify request/response parts in parallel Signed-off-by: Dmitrii Stepanov --- go.mod | 4 +-- go.sum | 3 +- signature/verify.go | 73 ++++++++++++++++++++++++++++------------ util/collection/slice.go | 17 ---------- 4 files changed, 54 insertions(+), 43 deletions(-) delete mode 100644 util/collection/slice.go diff --git a/go.mod b/go.mod index fd9049e..6fce011 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.18 require ( git.frostfs.info/TrueCloudLab/frostfs-crypto v0.6.0 github.com/stretchr/testify v1.7.0 - golang.org/x/exp v0.0.0-20230224173230-c95f2b4c22f2 + golang.org/x/sync v0.1.0 google.golang.org/grpc v1.48.0 google.golang.org/protobuf v1.28.0 ) @@ -14,10 +14,10 @@ require ( git.frostfs.info/TrueCloudLab/rfc6979 v0.4.0 // indirect github.com/davecgh/go-spew v1.1.0 // indirect github.com/golang/protobuf v1.5.2 // indirect + github.com/google/go-cmp v0.5.8 // indirect github.com/mr-tron/base58 v1.2.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect golang.org/x/net v0.0.0-20201021035429-f5854403a974 // indirect - golang.org/x/sync v0.1.0 // indirect golang.org/x/sys v0.1.0 // indirect golang.org/x/text v0.3.3 // indirect google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 // indirect diff --git a/go.sum b/go.sum index 4224bda..e81a6ec 100644 --- a/go.sum +++ b/go.sum @@ -48,6 +48,7 @@ github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= +github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/mr-tron/base58 v1.2.0 h1:T/HDJBh4ZCPbU39/+c3rRvE0uKBQlU27+QI8LJ4t64o= @@ -64,8 +65,6 @@ go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqe golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20230224173230-c95f2b4c22f2 h1:Jvc7gsqn21cJHCmAWx0LiimpP18LZmUxkT5Mp7EZ1mI= -golang.org/x/exp v0.0.0-20230224173230-c95f2b4c22f2/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= diff --git a/signature/verify.go b/signature/verify.go index fe76844..08f91d9 100644 --- a/signature/verify.go +++ b/signature/verify.go @@ -6,8 +6,8 @@ import ( "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/collection" "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/signature" + "golang.org/x/sync/errgroup" ) type signatureProvider interface { @@ -16,6 +16,12 @@ type signatureProvider interface { GetOriginSignature() *refs.Signature } +type buffers struct { + Body []byte + Meta []byte + Header []byte +} + // VerifyServiceMessage verifies service message. func VerifyServiceMessage(msg interface{}) error { switch v := msg.(type) { @@ -34,16 +40,23 @@ func verifyServiceRequest(v serviceRequest) error { meta := v.GetMetaHeader() verificationHeader := v.GetVerificationHeader() body := serviceMessageBody(v) - size := collection.Max(body.StableSize(), meta.StableSize(), verificationHeader.StableSize()) - buf := make([]byte, 0, size) - return verifyServiceRequestRecursive(body, meta, verificationHeader, buf) + buffers := createBuffers(body.StableSize(), meta.StableSize(), verificationHeader.StableSize()) + return verifyServiceRequestRecursive(body, meta, verificationHeader, buffers) } -func verifyServiceRequestRecursive(body stableMarshaler, meta *session.RequestMetaHeader, verify *session.RequestVerificationHeader, buf []byte) error { +func createBuffers(bodySize, metaSize, headerSize int) *buffers { + return &buffers{ + Body: make([]byte, 0, bodySize), + Meta: make([]byte, 0, metaSize), + Header: make([]byte, 0, headerSize), + } +} + +func verifyServiceRequestRecursive(body stableMarshaler, meta *session.RequestMetaHeader, verify *session.RequestVerificationHeader, buffers *buffers) error { verificationHeaderOrigin := verify.GetOrigin() metaOrigin := meta.GetOrigin() - stop, err := verifyMessageParts(body, meta, verificationHeaderOrigin, verificationHeaderOrigin != nil, verify, buf) + stop, err := verifyMessageParts(body, meta, verificationHeaderOrigin, verificationHeaderOrigin != nil, verify, buffers) if err != nil { return err } @@ -51,23 +64,40 @@ func verifyServiceRequestRecursive(body stableMarshaler, meta *session.RequestMe return nil } - return verifyServiceRequestRecursive(body, metaOrigin, verificationHeaderOrigin, buf) + return verifyServiceRequestRecursive(body, metaOrigin, verificationHeaderOrigin, buffers) } -func verifyMessageParts(body, meta, originHeader stableMarshaler, hasOriginHeader bool, sigProvider signatureProvider, buf []byte) (stop bool, err error) { - if err := verifyServiceMessagePart(meta, sigProvider.GetMetaSignature, buf); err != nil { - return false, fmt.Errorf("could not verify meta header: %w", err) +func verifyMessageParts(body, meta, originHeader stableMarshaler, hasOriginHeader bool, sigProvider signatureProvider, buffers *buffers) (stop bool, err error) { + eg := &errgroup.Group{} + + eg.Go(func() error { + if err := verifyServiceMessagePart(meta, sigProvider.GetMetaSignature, buffers.Meta); err != nil { + return fmt.Errorf("could not verify meta header: %w", err) + } + return nil + }) + + eg.Go(func() error { + if err := verifyServiceMessagePart(originHeader, sigProvider.GetOriginSignature, buffers.Header); err != nil { + return fmt.Errorf("could not verify origin of verification header: %w", err) + } + return nil + }) + + if !hasOriginHeader { + eg.Go(func() error { + if err := verifyServiceMessagePart(body, sigProvider.GetBodySignature, buffers.Body); err != nil { + return fmt.Errorf("could not verify body: %w", err) + } + return nil + }) } - if err := verifyServiceMessagePart(originHeader, sigProvider.GetOriginSignature, buf); err != nil { - return false, fmt.Errorf("could not verify origin of verification header: %w", err) + if err := eg.Wait(); err != nil { + return false, err } if !hasOriginHeader { - if err := verifyServiceMessagePart(body, sigProvider.GetBodySignature, buf); err != nil { - return false, fmt.Errorf("could not verify body: %w", err) - } - return true, nil } @@ -82,16 +112,15 @@ func verifyServiceResponse(v serviceResponse) error { meta := v.GetMetaHeader() verificationHeader := v.GetVerificationHeader() body := serviceMessageBody(v) - size := collection.Max(body.StableSize(), meta.StableSize(), verificationHeader.StableSize()) - buf := make([]byte, 0, size) - return verifyServiceResponseRecursive(body, meta, verificationHeader, buf) + buffers := createBuffers(body.StableSize(), meta.StableSize(), verificationHeader.StableSize()) + return verifyServiceResponseRecursive(body, meta, verificationHeader, buffers) } -func verifyServiceResponseRecursive(body stableMarshaler, meta *session.ResponseMetaHeader, verify *session.ResponseVerificationHeader, buf []byte) error { +func verifyServiceResponseRecursive(body stableMarshaler, meta *session.ResponseMetaHeader, verify *session.ResponseVerificationHeader, buffers *buffers) error { verificationHeaderOrigin := verify.GetOrigin() metaOrigin := meta.GetOrigin() - stop, err := verifyMessageParts(body, meta, verificationHeaderOrigin, verificationHeaderOrigin != nil, verify, buf) + stop, err := verifyMessageParts(body, meta, verificationHeaderOrigin, verificationHeaderOrigin != nil, verify, buffers) if err != nil { return err } @@ -99,7 +128,7 @@ func verifyServiceResponseRecursive(body stableMarshaler, meta *session.Response return nil } - return verifyServiceResponseRecursive(body, metaOrigin, verificationHeaderOrigin, buf) + return verifyServiceResponseRecursive(body, metaOrigin, verificationHeaderOrigin, buffers) } func verifyServiceMessagePart(part stableMarshaler, sigRdr func() *refs.Signature, buf []byte) error { diff --git a/util/collection/slice.go b/util/collection/slice.go deleted file mode 100644 index 436f28c..0000000 --- a/util/collection/slice.go +++ /dev/null @@ -1,17 +0,0 @@ -package collection - -import "golang.org/x/exp/constraints" - -// Max finds maximum value of items. -func Max[T constraints.Ordered](items ...T) T { - if len(items) == 0 { - panic("failed to get max value: empty slice") - } - result := items[0] - for i := 1; i < len(items); i++ { - if items[i] > result { - result = items[i] - } - } - return result -} From ec0d0274fa936de70b407b3a50c4a32d24261570 Mon Sep 17 00:00:00 2001 From: Dmitrii Stepanov Date: Thu, 9 Mar 2023 11:33:21 +0300 Subject: [PATCH 1039/1196] [#3] signature: Add buffer pool Signed-off-by: Dmitrii Stepanov --- signature/sign.go | 5 +++- signature/verify.go | 49 ++++++++++++++------------------------- util/signature/buffer.go | 29 +++++++++++++++++++++++ util/signature/data.go | 20 +++++++--------- util/signature/options.go | 22 +++++++----------- 5 files changed, 67 insertions(+), 58 deletions(-) create mode 100644 util/signature/buffer.go diff --git a/signature/sign.go b/signature/sign.go index 5ed7870..49343bd 100644 --- a/signature/sign.go +++ b/signature/sign.go @@ -101,10 +101,13 @@ func signMessageParts(key *ecdsa.PrivateKey, body, meta, header stableMarshaler, func signServiceMessagePart(key *ecdsa.PrivateKey, part stableMarshaler, sigWrite func(*refs.Signature)) error { var sig *refs.Signature + wrapper := StableMarshalerWrapper{ + SM: part, + } // sign part if err := signature.SignDataWithHandler( key, - &StableMarshalerWrapper{part}, + wrapper, func(s *refs.Signature) { sig = s }, diff --git a/signature/verify.go b/signature/verify.go index 08f91d9..67e4a82 100644 --- a/signature/verify.go +++ b/signature/verify.go @@ -16,12 +16,6 @@ type signatureProvider interface { GetOriginSignature() *refs.Signature } -type buffers struct { - Body []byte - Meta []byte - Header []byte -} - // VerifyServiceMessage verifies service message. func VerifyServiceMessage(msg interface{}) error { switch v := msg.(type) { @@ -40,23 +34,14 @@ func verifyServiceRequest(v serviceRequest) error { meta := v.GetMetaHeader() verificationHeader := v.GetVerificationHeader() body := serviceMessageBody(v) - buffers := createBuffers(body.StableSize(), meta.StableSize(), verificationHeader.StableSize()) - return verifyServiceRequestRecursive(body, meta, verificationHeader, buffers) + return verifyServiceRequestRecursive(body, meta, verificationHeader) } -func createBuffers(bodySize, metaSize, headerSize int) *buffers { - return &buffers{ - Body: make([]byte, 0, bodySize), - Meta: make([]byte, 0, metaSize), - Header: make([]byte, 0, headerSize), - } -} - -func verifyServiceRequestRecursive(body stableMarshaler, meta *session.RequestMetaHeader, verify *session.RequestVerificationHeader, buffers *buffers) error { +func verifyServiceRequestRecursive(body stableMarshaler, meta *session.RequestMetaHeader, verify *session.RequestVerificationHeader) error { verificationHeaderOrigin := verify.GetOrigin() metaOrigin := meta.GetOrigin() - stop, err := verifyMessageParts(body, meta, verificationHeaderOrigin, verificationHeaderOrigin != nil, verify, buffers) + stop, err := verifyMessageParts(body, meta, verificationHeaderOrigin, verificationHeaderOrigin != nil, verify) if err != nil { return err } @@ -64,21 +49,21 @@ func verifyServiceRequestRecursive(body stableMarshaler, meta *session.RequestMe return nil } - return verifyServiceRequestRecursive(body, metaOrigin, verificationHeaderOrigin, buffers) + return verifyServiceRequestRecursive(body, metaOrigin, verificationHeaderOrigin) } -func verifyMessageParts(body, meta, originHeader stableMarshaler, hasOriginHeader bool, sigProvider signatureProvider, buffers *buffers) (stop bool, err error) { +func verifyMessageParts(body, meta, originHeader stableMarshaler, hasOriginHeader bool, sigProvider signatureProvider) (stop bool, err error) { eg := &errgroup.Group{} eg.Go(func() error { - if err := verifyServiceMessagePart(meta, sigProvider.GetMetaSignature, buffers.Meta); err != nil { + if err := verifyServiceMessagePart(meta, sigProvider.GetMetaSignature); err != nil { return fmt.Errorf("could not verify meta header: %w", err) } return nil }) eg.Go(func() error { - if err := verifyServiceMessagePart(originHeader, sigProvider.GetOriginSignature, buffers.Header); err != nil { + if err := verifyServiceMessagePart(originHeader, sigProvider.GetOriginSignature); err != nil { return fmt.Errorf("could not verify origin of verification header: %w", err) } return nil @@ -86,7 +71,7 @@ func verifyMessageParts(body, meta, originHeader stableMarshaler, hasOriginHeade if !hasOriginHeader { eg.Go(func() error { - if err := verifyServiceMessagePart(body, sigProvider.GetBodySignature, buffers.Body); err != nil { + if err := verifyServiceMessagePart(body, sigProvider.GetBodySignature); err != nil { return fmt.Errorf("could not verify body: %w", err) } return nil @@ -112,15 +97,14 @@ func verifyServiceResponse(v serviceResponse) error { meta := v.GetMetaHeader() verificationHeader := v.GetVerificationHeader() body := serviceMessageBody(v) - buffers := createBuffers(body.StableSize(), meta.StableSize(), verificationHeader.StableSize()) - return verifyServiceResponseRecursive(body, meta, verificationHeader, buffers) + return verifyServiceResponseRecursive(body, meta, verificationHeader) } -func verifyServiceResponseRecursive(body stableMarshaler, meta *session.ResponseMetaHeader, verify *session.ResponseVerificationHeader, buffers *buffers) error { +func verifyServiceResponseRecursive(body stableMarshaler, meta *session.ResponseMetaHeader, verify *session.ResponseVerificationHeader) error { verificationHeaderOrigin := verify.GetOrigin() metaOrigin := meta.GetOrigin() - stop, err := verifyMessageParts(body, meta, verificationHeaderOrigin, verificationHeaderOrigin != nil, verify, buffers) + stop, err := verifyMessageParts(body, meta, verificationHeaderOrigin, verificationHeaderOrigin != nil, verify) if err != nil { return err } @@ -128,13 +112,16 @@ func verifyServiceResponseRecursive(body stableMarshaler, meta *session.Response return nil } - return verifyServiceResponseRecursive(body, metaOrigin, verificationHeaderOrigin, buffers) + return verifyServiceResponseRecursive(body, metaOrigin, verificationHeaderOrigin) } -func verifyServiceMessagePart(part stableMarshaler, sigRdr func() *refs.Signature, buf []byte) error { +func verifyServiceMessagePart(part stableMarshaler, sigRdr func() *refs.Signature) error { + wrapper := StableMarshalerWrapper{ + SM: part, + } + return signature.VerifyDataWithSource( - &StableMarshalerWrapper{part}, + wrapper, sigRdr, - signature.WithBuffer(buf), ) } diff --git a/util/signature/buffer.go b/util/signature/buffer.go new file mode 100644 index 0000000..2a7f1e0 --- /dev/null +++ b/util/signature/buffer.go @@ -0,0 +1,29 @@ +package signature + +import "sync" + +const poolSliceMaxSize = 64 * 1024 + +var buffersPool = sync.Pool{ + New: func() any { + return make([]byte, 0) + }, +} + +func newBufferFromPool(size int) []byte { + result := buffersPool.Get().([]byte) + if cap(result) < size { + result = make([]byte, size) + } else { + result = result[:size] + } + return result +} + +func returnBufferToPool(buf []byte) { + if cap(buf) > poolSliceMaxSize { + return + } + buf = buf[:0] + buffersPool.Put(buf) +} diff --git a/util/signature/data.go b/util/signature/data.go index 6de9466..d2bf1dc 100644 --- a/util/signature/data.go +++ b/util/signature/data.go @@ -35,7 +35,10 @@ func SignDataWithHandler(key *ecdsa.PrivateKey, src DataSource, handler KeySigna opts[i](cfg) } - data, err := readSignedData(cfg, src) + buffer := newBufferFromPool(src.SignedDataSize()) + defer returnBufferToPool(buffer) + + data, err := src.ReadSignedData(buffer) if err != nil { return err } @@ -61,7 +64,10 @@ func VerifyDataWithSource(dataSrc DataSource, sigSrc KeySignatureSource, opts .. opts[i](cfg) } - data, err := readSignedData(cfg, dataSrc) + buffer := newBufferFromPool(dataSrc.SignedDataSize()) + defer returnBufferToPool(buffer) + + data, err := dataSrc.ReadSignedData(buffer) if err != nil { return err } @@ -76,13 +82,3 @@ func SignData(key *ecdsa.PrivateKey, v DataWithSignature, opts ...SignOption) er func VerifyData(src DataWithSignature, opts ...SignOption) error { return VerifyDataWithSource(src, src.GetSignature, opts...) } - -func readSignedData(cfg *cfg, src DataSource) ([]byte, error) { - size := src.SignedDataSize() - if cfg.buffer == nil || cap(cfg.buffer) < size { - cfg.buffer = make([]byte, size) - } else { - cfg.buffer = cfg.buffer[:size] - } - return src.ReadSignedData(cfg.buffer) -} diff --git a/util/signature/options.go b/util/signature/options.go index 28728dc..a8a3522 100644 --- a/util/signature/options.go +++ b/util/signature/options.go @@ -13,7 +13,6 @@ import ( type cfg struct { schemeFixed bool scheme refs.SignatureScheme - buffer []byte } func defaultCfg() *cfg { @@ -36,9 +35,10 @@ func verify(cfg *cfg, data []byte, sig *refs.Signature) error { case refs.ECDSA_RFC6979_SHA256: return crypto.VerifyRFC6979(pub, data, sig.GetSign()) case refs.ECDSA_RFC6979_SHA256_WALLET_CONNECT: - buf := make([]byte, base64.StdEncoding.EncodedLen(len(data))) - base64.StdEncoding.Encode(buf, data) - if !walletconnect.Verify(pub, buf, sig.GetSign()) { + buffer := newBufferFromPool(base64.StdEncoding.EncodedLen(len(data))) + defer returnBufferToPool(buffer) + base64.StdEncoding.Encode(buffer, data) + if !walletconnect.Verify(pub, buffer, sig.GetSign()) { return crypto.ErrInvalidSignature } return nil @@ -54,9 +54,10 @@ func sign(cfg *cfg, key *ecdsa.PrivateKey, data []byte) ([]byte, error) { case refs.ECDSA_RFC6979_SHA256: return crypto.SignRFC6979(key, data) case refs.ECDSA_RFC6979_SHA256_WALLET_CONNECT: - buf := make([]byte, base64.StdEncoding.EncodedLen(len(data))) - base64.StdEncoding.Encode(buf, data) - return walletconnect.Sign(key, buf) + buffer := newBufferFromPool(base64.StdEncoding.EncodedLen(len(data))) + defer returnBufferToPool(buffer) + base64.StdEncoding.Encode(buffer, data) + return walletconnect.Sign(key, buffer) default: panic(fmt.Sprintf("unsupported scheme %s", cfg.scheme)) } @@ -69,13 +70,6 @@ func SignWithRFC6979() SignOption { } } -// WithBuffer allows providing pre-allocated buffer for signature verification. -func WithBuffer(buf []byte) SignOption { - return func(c *cfg) { - c.buffer = buf - } -} - func SignWithWalletConnect() SignOption { return func(c *cfg) { c.scheme = refs.ECDSA_RFC6979_SHA256_WALLET_CONNECT From c46cd37f7115730366b3e32176947f495ded5165 Mon Sep 17 00:00:00 2001 From: Denis Kirillov Date: Mon, 6 Mar 2023 14:59:51 +0300 Subject: [PATCH 1040/1196] [#10] Generate api Signed-off-by: Denis Kirillov --- container/grpc/types.pb.go | 10 ++++---- lock/grpc/types.pb.go | 2 +- netmap/grpc/types.pb.go | 2 +- object/grpc/service_grpc.pb.go | 44 +++++++++++++++++----------------- object/grpc/types.pb.go | 10 ++++---- session/grpc/types.pb.go | 6 ++--- storagegroup/grpc/types.pb.go | 2 +- tombstone/grpc/types.pb.go | 2 +- 8 files changed, 39 insertions(+), 39 deletions(-) diff --git a/container/grpc/types.pb.go b/container/grpc/types.pb.go index 75796c2..9c6b2db 100644 --- a/container/grpc/types.pb.go +++ b/container/grpc/types.pb.go @@ -131,16 +131,16 @@ func (x *Container) GetPlacementPolicy() *grpc1.PlacementPolicy { // // There are some "well-known" attributes affecting system behaviour: // -// - __NEOFS__SUBNET \ +// - [ __NEOFS__SUBNET | __FROSTFS__SUBNET ] \ // String ID of a container's storage subnet. Any container can be attached to // one subnet only. -// - __NEOFS__NAME \ +// - [ __NEOFS__NAME | __FROSTFS__NAME ] \ // String of a human-friendly container name registered as a domain in // NNS contract. -// - __NEOFS__ZONE \ -// String of a zone for `__NEOFS__NAME`. Used as a TLD of a domain name in NNS +// - [ __NEOFS__ZONE | __FROSTFS__ZONE ] \ +// String of a zone for `__NEOFS__NAME`/`__FROSTFS__NAME`. Used as a TLD of a domain name in NNS // contract. If no zone is specified, use default zone: `container`. -// - __NEOFS__DISABLE_HOMOMORPHIC_HASHING \ +// - [ __NEOFS__DISABLE_HOMOMORPHIC_HASHING | __FROSTFS__DISABLE_HOMOMORPHIC_HASHING ] \ // 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 NeoFS network only if the global network hashing configuration diff --git a/lock/grpc/types.pb.go b/lock/grpc/types.pb.go index 01e263a..476b9ab 100644 --- a/lock/grpc/types.pb.go +++ b/lock/grpc/types.pb.go @@ -23,7 +23,7 @@ const ( // Lock objects protects a list of objects from being deleted. The lifetime of a // lock object is limited similar to regular objects in -// `__NEOFS__EXPIRATION_EPOCH` attribute. Lock object MUST have expiration epoch. +// `__NEOFS__EXPIRATION_EPOCH`/`__FROSTFS__EXPIRATION_EPOCH` 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 diff --git a/netmap/grpc/types.pb.go b/netmap/grpc/types.pb.go index 92fea20..ab9cc16 100644 --- a/netmap/grpc/types.pb.go +++ b/netmap/grpc/types.pb.go @@ -827,7 +827,7 @@ func (x *NetworkInfo) GetNetworkConfig() *NetworkConfig { // attributes it's a string presenting floating point number with comma or // point delimiter for decimal part. In the Network Map it will be saved as // 64-bit unsigned integer representing number of minimal token fractions. -// - __NEOFS__SUBNET_%s \ +// - [ __NEOFS__SUBNET_%s | __FROSTFS__SUBNET_%s ] \ // `True` or `False`. Defines if the node is included in the `%s` subnetwork // or not. `%s` must be an existing subnetwork's ID (non-negative integer number). // A node can be included in more than one subnetwork and, therefore, can contain diff --git a/object/grpc/service_grpc.pb.go b/object/grpc/service_grpc.pb.go index 172998c..d3b9314 100644 --- a/object/grpc/service_grpc.pb.go +++ b/object/grpc/service_grpc.pb.go @@ -30,11 +30,11 @@ type ObjectServiceClient interface { // keeping the receiving order. // // Extended headers can change `Get` behaviour: - // - __NEOFS__NETMAP_EPOCH \ + // - [ __NEOFS__NETMAP_EPOCH | __FROSTFS__NETMAP_EPOCH ] \ // Will use the requsted version of Network Map for object placement // calculation. - // - __NEOFS__NETMAP_LOOKUP_DEPTH \ - // Will try older versions (starting from `__NEOFS__NETMAP_EPOCH` if specified or + // - [ __NEOFS__NETMAP_LOOKUP_DEPTH | __FROSTFS__NETMAP_LOOKUP_DEPTH ] \ + // Will try older versions (starting from `__NEOFS__NETMAP_EPOCH`/`__FROSTFS__NETMAP_EPOCH` if specified or // the latest one otherwise) of Network Map to find an object until the depth // limit is reached. // @@ -63,7 +63,7 @@ type ObjectServiceClient interface { // Chunk messages SHOULD be sent in the direct order of fragmentation. // // Extended headers can change `Put` behaviour: - // - __NEOFS__NETMAP_EPOCH \ + // - [ __NEOFS__NETMAP_EPOCH | __FROSTFS__NETMAP_EPOCH \ // Will use the requsted version of Network Map for object placement // calculation. // @@ -94,7 +94,7 @@ type ObjectServiceClient interface { // guarantee. Object will be marked for removal and deleted eventually. // // Extended headers can change `Delete` behaviour: - // - __NEOFS__NETMAP_EPOCH \ + // - [ __NEOFS__NETMAP_EPOCH | __FROSTFS__NETMAP_EPOCH ] \ // Will use the requsted version of Network Map for object placement // calculation. // @@ -118,7 +118,7 @@ type ObjectServiceClient interface { // the very minimal information will be returned instead. // // Extended headers can change `Head` behaviour: - // - __NEOFS__NETMAP_EPOCH \ + // - [ __NEOFS__NETMAP_EPOCH | __FROSTFS__NETMAP_EPOCH ] \ // Will use the requsted version of Network Map for object placement // calculation. // @@ -144,7 +144,7 @@ type ObjectServiceClient interface { // Specification section for more details. // // Extended headers can change `Search` behaviour: - // - __NEOFS__NETMAP_EPOCH \ + // - [ __NEOFS__NETMAP_EPOCH | __FROSTFS__NETMAP_EPOCH ] \ // Will use the requsted version of Network Map for object placement // calculation. // @@ -167,10 +167,10 @@ type ObjectServiceClient interface { // order. // // Extended headers can change `GetRange` behaviour: - // - __NEOFS__NETMAP_EPOCH \ + // - [ __NEOFS__NETMAP_EPOCH | __FROSTFS__NETMAP_EPOCH ] \ // Will use the requsted version of Network Map for object placement // calculation. - // - __NEOFS__NETMAP_LOOKUP_DEPTH \ + // - [ __NEOFS__NETMAP_LOOKUP_DEPTH | __FROSTFS__NETMAP_LOOKUP_DEPTH ] \ // Will try older versions of Network Map to find an object until the depth // limit is reached. // @@ -199,10 +199,10 @@ type ObjectServiceClient interface { // the request. Note that hash is calculated for XORed data. // // Extended headers can change `GetRangeHash` behaviour: - // - __NEOFS__NETMAP_EPOCH \ + // - [ __NEOFS__NETMAP_EPOCH | __FROSTFS__NETMAP_EPOCH ] \ // Will use the requsted version of Network Map for object placement // calculation. - // - __NEOFS__NETMAP_LOOKUP_DEPTH \ + // - [ __NEOFS__NETMAP_LOOKUP_DEPTH | __FROSTFS__NETMAP_LOOKUP_DEPTH ] \ // Will try older versions of Network Map to find an object until the depth // limit is reached. // @@ -402,11 +402,11 @@ type ObjectServiceServer interface { // keeping the receiving order. // // Extended headers can change `Get` behaviour: - // - __NEOFS__NETMAP_EPOCH \ + // - [ __NEOFS__NETMAP_EPOCH | __FROSTFS__NETMAP_EPOCH ] \ // Will use the requsted version of Network Map for object placement // calculation. - // - __NEOFS__NETMAP_LOOKUP_DEPTH \ - // Will try older versions (starting from `__NEOFS__NETMAP_EPOCH` if specified or + // - [ __NEOFS__NETMAP_LOOKUP_DEPTH | __FROSTFS__NETMAP_LOOKUP_DEPTH ] \ + // Will try older versions (starting from `__NEOFS__NETMAP_EPOCH`/`__FROSTFS__NETMAP_EPOCH` if specified or // the latest one otherwise) of Network Map to find an object until the depth // limit is reached. // @@ -435,7 +435,7 @@ type ObjectServiceServer interface { // Chunk messages SHOULD be sent in the direct order of fragmentation. // // Extended headers can change `Put` behaviour: - // - __NEOFS__NETMAP_EPOCH \ + // - [ __NEOFS__NETMAP_EPOCH | __FROSTFS__NETMAP_EPOCH \ // Will use the requsted version of Network Map for object placement // calculation. // @@ -466,7 +466,7 @@ type ObjectServiceServer interface { // guarantee. Object will be marked for removal and deleted eventually. // // Extended headers can change `Delete` behaviour: - // - __NEOFS__NETMAP_EPOCH \ + // - [ __NEOFS__NETMAP_EPOCH | __FROSTFS__NETMAP_EPOCH ] \ // Will use the requsted version of Network Map for object placement // calculation. // @@ -490,7 +490,7 @@ type ObjectServiceServer interface { // the very minimal information will be returned instead. // // Extended headers can change `Head` behaviour: - // - __NEOFS__NETMAP_EPOCH \ + // - [ __NEOFS__NETMAP_EPOCH | __FROSTFS__NETMAP_EPOCH ] \ // Will use the requsted version of Network Map for object placement // calculation. // @@ -516,7 +516,7 @@ type ObjectServiceServer interface { // Specification section for more details. // // Extended headers can change `Search` behaviour: - // - __NEOFS__NETMAP_EPOCH \ + // - [ __NEOFS__NETMAP_EPOCH | __FROSTFS__NETMAP_EPOCH ] \ // Will use the requsted version of Network Map for object placement // calculation. // @@ -539,10 +539,10 @@ type ObjectServiceServer interface { // order. // // Extended headers can change `GetRange` behaviour: - // - __NEOFS__NETMAP_EPOCH \ + // - [ __NEOFS__NETMAP_EPOCH | __FROSTFS__NETMAP_EPOCH ] \ // Will use the requsted version of Network Map for object placement // calculation. - // - __NEOFS__NETMAP_LOOKUP_DEPTH \ + // - [ __NEOFS__NETMAP_LOOKUP_DEPTH | __FROSTFS__NETMAP_LOOKUP_DEPTH ] \ // Will try older versions of Network Map to find an object until the depth // limit is reached. // @@ -571,10 +571,10 @@ type ObjectServiceServer interface { // the request. Note that hash is calculated for XORed data. // // Extended headers can change `GetRangeHash` behaviour: - // - __NEOFS__NETMAP_EPOCH \ + // - [ __NEOFS__NETMAP_EPOCH | __FROSTFS__NETMAP_EPOCH ] \ // Will use the requsted version of Network Map for object placement // calculation. - // - __NEOFS__NETMAP_LOOKUP_DEPTH \ + // - [ __NEOFS__NETMAP_LOOKUP_DEPTH | __FROSTFS__NETMAP_LOOKUP_DEPTH ] \ // Will try older versions of Network Map to find an object until the depth // limit is reached. // diff --git a/object/grpc/types.pb.go b/object/grpc/types.pb.go index 818bc5e..6622359 100644 --- a/object/grpc/types.pb.go +++ b/object/grpc/types.pb.go @@ -556,19 +556,19 @@ func (x *SplitInfo) GetLink() *grpc.ObjectID { // Objects with duplicated attribute names or attributes with empty values // will be considered invalid. // -// There are some "well-known" attributes starting with `__NEOFS__` prefix +// There are some "well-known" attributes starting with `__NEOFS__`/`__FROSTFS__` prefix // that affect system behaviour: // -// - __NEOFS__UPLOAD_ID \ +// - [ __NEOFS__UPLOAD_ID | __FROSTFS__UPLOAD_ID ] \ // Marks smaller parts of a split bigger object -// - __NEOFS__EXPIRATION_EPOCH \ +// - [ __NEOFS__EXPIRATION_EPOCH | __FROSTFS__EXPIRATION_EPOCH ] \ // Tells GC to delete object after that epoch -// - __NEOFS__TICK_EPOCH \ +// - [ __NEOFS__TICK_EPOCH | __FROSTFS__TICK_EPOCH ] \ // Decimal number that defines what epoch must produce // object notification with UTF-8 object address in a // body (`0` value produces notification right after // object put) -// - __NEOFS__TICK_TOPIC \ +// - [ __NEOFS__TICK_TOPIC | __FROSTFS__TICK_TOPIC ] \ // UTF-8 string topic ID that is used for object notification // // And some well-known attributes used by applications only: diff --git a/session/grpc/types.pb.go b/session/grpc/types.pb.go index 3ca6001..de89a80 100644 --- a/session/grpc/types.pb.go +++ b/session/grpc/types.pb.go @@ -349,14 +349,14 @@ func (x *SessionToken) GetSignature() *grpc.Signature { // Responses with duplicated header names or headers with empty values will be // considered invalid. // -// There are some "well-known" headers starting with `__NEOFS__` prefix that +// There are some "well-known" headers starting with `__NEOFS__` or `__FROSTFS__` prefix that // affect system behaviour: // -// - __NEOFS__NETMAP_EPOCH \ +// - [ __NEOFS__NETMAP_EPOCH | __FROSTFS__NETMAP_EPOCH ] \ // Netmap epoch to use for object placement calculation. The `value` is string // encoded `uint64` in decimal presentation. If set to '0' or not set, the // current epoch only will be used. -// - __NEOFS__NETMAP_LOOKUP_DEPTH \ +// - [ __NEOFS__NETMAP_LOOKUP_DEPTH | __FROSTFS__NETMAP_LOOKUP_DEPTH ] \ // If object can't be found using current epoch's netmap, this header limits // how many past epochs the node can look up through. The `value` is string // encoded `uint64` in decimal presentation. If set to '0' or not set, only the diff --git a/storagegroup/grpc/types.pb.go b/storagegroup/grpc/types.pb.go index 37f88ea..2513f9c 100644 --- a/storagegroup/grpc/types.pb.go +++ b/storagegroup/grpc/types.pb.go @@ -27,7 +27,7 @@ const ( // contains objects from the same container. // // Being an object payload, StorageGroup may have expiration Epoch set with -// `__NEOFS__EXPIRATION_EPOCH` well-known attribute. When expired, StorageGroup +// `__NEOFS__EXPIRATION_EPOCH`/`__FROSTFS__EXPIRATION_EPOCH` well-known attribute. When expired, StorageGroup // will be ignored by InnerRing nodes during Data Audit cycles and will be // deleted by Storage Nodes. type StorageGroup struct { diff --git a/tombstone/grpc/types.pb.go b/tombstone/grpc/types.pb.go index 11405ac..86ed356 100644 --- a/tombstone/grpc/types.pb.go +++ b/tombstone/grpc/types.pb.go @@ -30,7 +30,7 @@ type Tombstone struct { // Last NeoFS epoch number of the tombstone lifetime. It's set by the tombstone // creator depending on the current NeoFS network settings. A tombstone object - // must have the same expiration epoch value in `__NEOFS__EXPIRATION_EPOCH` + // must have the same expiration epoch value in `__NEOFS__EXPIRATION_EPOCH`/`__FROSTFS__EXPIRATION_EPOCH` // attribute. Otherwise, the tombstone will be rejected by a storage node. ExpirationEpoch uint64 `protobuf:"varint,1,opt,name=expiration_epoch,json=expirationEpoch,proto3" json:"expiration_epoch,omitempty"` // 16 byte UUID used to identify the split object hierarchy parts. Must be From cd2e46a17cd739a99a39ff14ab9e036d5e48fee7 Mon Sep 17 00:00:00 2001 From: Denis Kirillov Date: Mon, 6 Mar 2023 15:24:58 +0300 Subject: [PATCH 1041/1196] [#10] Add __FROSTFS__ system attributes Signed-off-by: Denis Kirillov --- container/attributes.go | 23 ++++++++++++++++++++--- netmap/attributes.go | 14 ++++++++++---- netmap/attributes_test.go | 2 +- object/attributes.go | 29 ++++++++++++++++++++++++----- session/xheaders.go | 17 ++++++++++++++++- 5 files changed, 71 insertions(+), 14 deletions(-) diff --git a/container/attributes.go b/container/attributes.go index eb4b078..356a6b9 100644 --- a/container/attributes.go +++ b/container/attributes.go @@ -1,7 +1,7 @@ package container // SysAttributePrefix is a prefix of key to system attribute. -const SysAttributePrefix = "__NEOFS__" +const SysAttributePrefix = "__FROSTFS__" const ( // SysAttributeSubnet is a string ID of container's storage subnet. @@ -17,6 +17,23 @@ const ( SysAttributeHomomorphicHashing = SysAttributePrefix + "DISABLE_HOMOMORPHIC_HASHING" ) +// SysAttributePrefixNeoFS is a prefix of key to system attribute. +const SysAttributePrefixNeoFS = "__NEOFS__" + +const ( + // SysAttributeSubnetNeoFS is a string ID of container's storage subnet. + SysAttributeSubnetNeoFS = SysAttributePrefixNeoFS + "SUBNET" + + // SysAttributeNameNeoFS is a string of human-friendly container name registered as the domain in NNS contract. + SysAttributeNameNeoFS = SysAttributePrefixNeoFS + "NAME" + + // SysAttributeZoneNeoFS is a string of zone for container name. + SysAttributeZoneNeoFS = SysAttributePrefixNeoFS + "ZONE" + + // SysAttributeHomomorphicHashingNeoFS is a container's homomorphic hashing state. + SysAttributeHomomorphicHashingNeoFS = SysAttributePrefixNeoFS + "DISABLE_HOMOMORPHIC_HASHING" +) + // SysAttributeZoneDefault is a default value for SysAttributeZone attribute. const SysAttributeZoneDefault = "container" @@ -33,7 +50,7 @@ const disabledHomomorphicHashingValue = "true" // See also SetHomomorphicHashingState. func (c Container) HomomorphicHashingState() bool { for i := range c.attr { - if c.attr[i].GetKey() == SysAttributeHomomorphicHashing { + if c.attr[i].GetKey() == SysAttributeHomomorphicHashing || c.attr[i].GetKey() == SysAttributeHomomorphicHashingNeoFS { return c.attr[i].GetValue() != disabledHomomorphicHashingValue } } @@ -50,7 +67,7 @@ func (c Container) HomomorphicHashingState() bool { // See also HomomorphicHashingState. func (c *Container) SetHomomorphicHashingState(enable bool) { for i := range c.attr { - if c.attr[i].GetKey() == SysAttributeHomomorphicHashing { + if c.attr[i].GetKey() == SysAttributeHomomorphicHashing || c.attr[i].GetKey() == SysAttributeHomomorphicHashingNeoFS { if enable { // approach without allocation/waste // coping works since the attributes diff --git a/netmap/attributes.go b/netmap/attributes.go index 719d882..3ebec57 100644 --- a/netmap/attributes.go +++ b/netmap/attributes.go @@ -9,7 +9,10 @@ import ( ) // prefix of keys to subnet attributes. -const attrSubnetPrefix = "__NEOFS__SUBNET_" +const attrSubnetPrefix = "__FROSTFS__SUBNET_" + +// prefix of keys to subnet attributes. +const attrSubnetPrefixNeoFS = "__NEOFS__SUBNET_" const ( // subnet attribute's value denoting subnet entry @@ -62,7 +65,7 @@ func subnetAttributeKey(id *refs.SubnetID) string { // - disables non-zero subnet; // - enables zero subnet. // -// Attribute key is calculated from ID using format `__NEOFS__SUBNET_%s`. +// Attribute key is calculated from ID using format `__FROSTFS__SUBNET_%s`. // Attribute Value is: // - `True` if node enters the subnet; // - `False`, otherwise. @@ -143,8 +146,11 @@ func IterateSubnets(node *NodeInfo, f func(refs.SubnetID) error) error { // cut subnet ID string idTxt := strings.TrimPrefix(key, attrSubnetPrefix) if len(idTxt) == len(key) { - // not a subnet attribute - continue + idTxt = strings.TrimPrefix(key, attrSubnetPrefixNeoFS) + if len(idTxt) == len(key) { + // not a subnet attribute + continue + } } // check value diff --git a/netmap/attributes_test.go b/netmap/attributes_test.go index 6d5b9ea..a2b3be9 100644 --- a/netmap/attributes_test.go +++ b/netmap/attributes_test.go @@ -11,7 +11,7 @@ import ( ) func subnetAttrKey(val string) string { - return "__NEOFS__SUBNET_" + val + return "__FROSTFS__SUBNET_" + val } func assertSubnetAttrKey(t *testing.T, attr *netmap.Attribute, num uint32) { diff --git a/object/attributes.go b/object/attributes.go index cc82873..3293682 100644 --- a/object/attributes.go +++ b/object/attributes.go @@ -7,7 +7,7 @@ import ( ) // SysAttributePrefix is a prefix of key to system attribute. -const SysAttributePrefix = "__NEOFS__" +const SysAttributePrefix = "__FROSTFS__" const ( // SysAttributeUploadID marks smaller parts of a split bigger object. @@ -25,6 +25,25 @@ const ( SysAttributeTickTopic = SysAttributePrefix + "TICK_TOPIC" ) +// SysAttributePrefixNeoFS is a prefix of key to system attribute. +const SysAttributePrefixNeoFS = "__NEOFS__" + +const ( + // SysAttributeUploadIDNeoFS marks smaller parts of a split bigger object. + SysAttributeUploadIDNeoFS = SysAttributePrefixNeoFS + "UPLOAD_ID" + + // SysAttributeExpEpochNeoFS tells GC to delete object after that epoch. + SysAttributeExpEpochNeoFS = SysAttributePrefixNeoFS + "EXPIRATION_EPOCH" + + // SysAttributeTickEpochNeoFS defines what epoch must produce object + // notification. + SysAttributeTickEpochNeoFS = SysAttributePrefixNeoFS + "TICK_EPOCH" + + // SysAttributeTickTopicNeoFS defines what topic object notification + // must be sent to. + SysAttributeTickTopicNeoFS = SysAttributePrefixNeoFS + "TICK_TOPIC" +) + // NotificationInfo groups information about object notification // that can be written to object. // @@ -81,10 +100,10 @@ func WriteNotificationInfo(o *Object, ni NotificationInfo) { for i := range attrs { switch attrs[i].GetKey() { - case SysAttributeTickEpoch: + case SysAttributeTickEpoch, SysAttributeTickEpochNeoFS: attrs[i].SetValue(epoch) changedEpoch = true - case SysAttributeTickTopic: + case SysAttributeTickTopic, SysAttributeTickTopicNeoFS: changedTopic = true if topic == "" { @@ -141,7 +160,7 @@ func GetNotificationInfo(o *Object) (*NotificationInfo, error) { for _, attr := range o.GetHeader().GetAttributes() { switch key := attr.GetKey(); key { - case SysAttributeTickEpoch: + case SysAttributeTickEpoch, SysAttributeTickEpochNeoFS: epoch, err := strconv.ParseUint(attr.GetValue(), 10, 64) if err != nil { return nil, fmt.Errorf("could not parse epoch: %w", err) @@ -150,7 +169,7 @@ func GetNotificationInfo(o *Object) (*NotificationInfo, error) { ni.SetEpoch(epoch) foundEpoch = true - case SysAttributeTickTopic: + case SysAttributeTickTopic, SysAttributeTickTopicNeoFS: ni.SetTopic(attr.GetValue()) } } diff --git a/session/xheaders.go b/session/xheaders.go index 64b16de..ba3ac8d 100644 --- a/session/xheaders.go +++ b/session/xheaders.go @@ -1,7 +1,7 @@ package session // ReservedXHeaderPrefix is a prefix of keys to "well-known" X-headers. -const ReservedXHeaderPrefix = "__NEOFS__" +const ReservedXHeaderPrefix = "__FROSTFS__" const ( // XHeaderNetmapEpoch is a key to the reserved X-header that specifies netmap epoch @@ -14,3 +14,18 @@ const ( // set, the current epoch only will be used. XHeaderNetmapLookupDepth = ReservedXHeaderPrefix + "NETMAP_LOOKUP_DEPTH" ) + +// ReservedXHeaderPrefixNeoFS is a prefix of keys to "well-known" X-headers. +const ReservedXHeaderPrefixNeoFS = "__NEOFS__" + +const ( + // XHeaderNetmapEpochNeoFS is a key to the reserved X-header that specifies netmap epoch + // to use for object placement calculation. If set to '0' or not set, the current + // epoch only will be used. + XHeaderNetmapEpochNeoFS = ReservedXHeaderPrefixNeoFS + "NETMAP_EPOCH" + + // XHeaderNetmapLookupDepthNeoFS is a key to the reserved X-header that limits + // how many past epochs back the node will can lookup. If set to '0' or not + // set, the current epoch only will be used. + XHeaderNetmapLookupDepthNeoFS = ReservedXHeaderPrefixNeoFS + "NETMAP_LOOKUP_DEPTH" +) From 8009022a20aa08c3a0e46e0d956301d1db0385f2 Mon Sep 17 00:00:00 2001 From: Denis Kirillov Date: Wed, 15 Mar 2023 12:23:01 +0300 Subject: [PATCH 1042/1196] [#13] *: Regenerate api Signed-off-by: Denis Kirillov --- container/grpc/types.pb.go | 14 ++++-- lock/grpc/types.pb.go | 2 +- netmap/grpc/types.pb.go | 3 +- object/grpc/service_grpc.pb.go | 84 +++++++++++++++++++++------------- object/grpc/types.pb.go | 14 ++++-- session/grpc/types.pb.go | 8 ++-- storagegroup/grpc/types.pb.go | 2 +- tombstone/grpc/types.pb.go | 2 +- 8 files changed, 80 insertions(+), 49 deletions(-) diff --git a/container/grpc/types.pb.go b/container/grpc/types.pb.go index 9c6b2db..1044617 100644 --- a/container/grpc/types.pb.go +++ b/container/grpc/types.pb.go @@ -131,16 +131,20 @@ func (x *Container) GetPlacementPolicy() *grpc1.PlacementPolicy { // // There are some "well-known" attributes affecting system behaviour: // -// - [ __NEOFS__SUBNET | __FROSTFS__SUBNET ] \ +// - [ __SYSTEM__SUBNET ] \ +// (`__NEOFS__SUBNET` is deprecated) \ // String ID of a container's storage subnet. Any container can be attached to // one subnet only. -// - [ __NEOFS__NAME | __FROSTFS__NAME ] \ +// - [ __SYSTEM__NAME ] \ +// (`__NEOFS__NAME` is deprecated) \ // String of a human-friendly container name registered as a domain in // NNS contract. -// - [ __NEOFS__ZONE | __FROSTFS__ZONE ] \ -// String of a zone for `__NEOFS__NAME`/`__FROSTFS__NAME`. Used as a TLD of a domain name in NNS +// - [ __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`. -// - [ __NEOFS__DISABLE_HOMOMORPHIC_HASHING | __FROSTFS__DISABLE_HOMOMORPHIC_HASHING ] \ +// - [ __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 NeoFS network only if the global network hashing configuration diff --git a/lock/grpc/types.pb.go b/lock/grpc/types.pb.go index 476b9ab..22758c1 100644 --- a/lock/grpc/types.pb.go +++ b/lock/grpc/types.pb.go @@ -23,7 +23,7 @@ const ( // Lock objects protects a list of objects from being deleted. The lifetime of a // lock object is limited similar to regular objects in -// `__NEOFS__EXPIRATION_EPOCH`/`__FROSTFS__EXPIRATION_EPOCH` attribute. Lock object MUST have expiration epoch. +// `__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 diff --git a/netmap/grpc/types.pb.go b/netmap/grpc/types.pb.go index ab9cc16..0f017da 100644 --- a/netmap/grpc/types.pb.go +++ b/netmap/grpc/types.pb.go @@ -827,7 +827,8 @@ func (x *NetworkInfo) GetNetworkConfig() *NetworkConfig { // attributes it's a string presenting floating point number with comma or // point delimiter for decimal part. In the Network Map it will be saved as // 64-bit unsigned integer representing number of minimal token fractions. -// - [ __NEOFS__SUBNET_%s | __FROSTFS__SUBNET_%s ] \ +// - [ __SYSTEM__SUBNET_%s ] \ +// (`__NEOFS__SUBNET_%s` is deprecated) \ // `True` or `False`. Defines if the node is included in the `%s` subnetwork // or not. `%s` must be an existing subnetwork's ID (non-negative integer number). // A node can be included in more than one subnetwork and, therefore, can contain diff --git a/object/grpc/service_grpc.pb.go b/object/grpc/service_grpc.pb.go index d3b9314..23906d6 100644 --- a/object/grpc/service_grpc.pb.go +++ b/object/grpc/service_grpc.pb.go @@ -30,11 +30,13 @@ type ObjectServiceClient interface { // keeping the receiving order. // // Extended headers can change `Get` behaviour: - // - [ __NEOFS__NETMAP_EPOCH | __FROSTFS__NETMAP_EPOCH ] \ + // - [ __SYSTEM__NETMAP_EPOCH ] \ + // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ // Will use the requsted version of Network Map for object placement // calculation. - // - [ __NEOFS__NETMAP_LOOKUP_DEPTH | __FROSTFS__NETMAP_LOOKUP_DEPTH ] \ - // Will try older versions (starting from `__NEOFS__NETMAP_EPOCH`/`__FROSTFS__NETMAP_EPOCH` if specified or + // - [ __SYSTEM__NETMAP_LOOKUP_DEPTH ] \ + // (`__NEOFS__NETMAP_LOOKUP_DEPTH` is deprecated) \ + // Will try older versions (starting from `__SYSTEM__NETMAP_EPOCH` (`__NEOFS__NETMAP_EPOCH` is deprecated) if specified or // the latest one otherwise) of Network Map to find an object until the depth // limit is reached. // @@ -63,7 +65,8 @@ type ObjectServiceClient interface { // Chunk messages SHOULD be sent in the direct order of fragmentation. // // Extended headers can change `Put` behaviour: - // - [ __NEOFS__NETMAP_EPOCH | __FROSTFS__NETMAP_EPOCH \ + // - [ __SYSTEM__NETMAP_EPOCH \ + // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ // Will use the requsted version of Network Map for object placement // calculation. // @@ -94,8 +97,9 @@ type ObjectServiceClient interface { // guarantee. Object will be marked for removal and deleted eventually. // // Extended headers can change `Delete` behaviour: - // - [ __NEOFS__NETMAP_EPOCH | __FROSTFS__NETMAP_EPOCH ] \ - // Will use the requsted version of Network Map for object placement + // - [ __SYSTEM__NETMAP_EPOCH ] \ + // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ + // Will use the requested version of Network Map for object placement // calculation. // // Please refer to detailed `XHeader` description. @@ -118,8 +122,9 @@ type ObjectServiceClient interface { // the very minimal information will be returned instead. // // Extended headers can change `Head` behaviour: - // - [ __NEOFS__NETMAP_EPOCH | __FROSTFS__NETMAP_EPOCH ] \ - // Will use the requsted version of Network Map for object placement + // - [ __SYSTEM__NETMAP_EPOCH ] \ + // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ + // Will use the requested version of Network Map for object placement // calculation. // // Please refer to detailed `XHeader` description. @@ -144,8 +149,9 @@ type ObjectServiceClient interface { // Specification section for more details. // // Extended headers can change `Search` behaviour: - // - [ __NEOFS__NETMAP_EPOCH | __FROSTFS__NETMAP_EPOCH ] \ - // Will use the requsted version of Network Map for object placement + // - [ __SYSTEM__NETMAP_EPOCH ] \ + // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ + // Will use the requested version of Network Map for object placement // calculation. // // Please refer to detailed `XHeader` description. @@ -167,10 +173,12 @@ type ObjectServiceClient interface { // order. // // Extended headers can change `GetRange` behaviour: - // - [ __NEOFS__NETMAP_EPOCH | __FROSTFS__NETMAP_EPOCH ] \ - // Will use the requsted version of Network Map for object placement + // - [ __SYSTEM__NETMAP_EPOCH ] \ + // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ + // Will use the requested version of Network Map for object placement // calculation. - // - [ __NEOFS__NETMAP_LOOKUP_DEPTH | __FROSTFS__NETMAP_LOOKUP_DEPTH ] \ + // - [ __SYSTEM__NETMAP_LOOKUP_DEPTH ] \ + // (`__NEOFS__NETMAP_LOOKUP_DEPTH` is deprecated) \ // Will try older versions of Network Map to find an object until the depth // limit is reached. // @@ -199,10 +207,12 @@ type ObjectServiceClient interface { // the request. Note that hash is calculated for XORed data. // // Extended headers can change `GetRangeHash` behaviour: - // - [ __NEOFS__NETMAP_EPOCH | __FROSTFS__NETMAP_EPOCH ] \ - // Will use the requsted version of Network Map for object placement + // - [ __SYSTEM__NETMAP_EPOCH ] \ + // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ + // Will use the requested version of Network Map for object placement // calculation. - // - [ __NEOFS__NETMAP_LOOKUP_DEPTH | __FROSTFS__NETMAP_LOOKUP_DEPTH ] \ + // - [ __SYSTEM__NETMAP_LOOKUP_DEPTH ] \ + // (`__NEOFS__NETMAP_LOOKUP_DEPTH` is deprecated) \ // Will try older versions of Network Map to find an object until the depth // limit is reached. // @@ -402,11 +412,13 @@ type ObjectServiceServer interface { // keeping the receiving order. // // Extended headers can change `Get` behaviour: - // - [ __NEOFS__NETMAP_EPOCH | __FROSTFS__NETMAP_EPOCH ] \ + // - [ __SYSTEM__NETMAP_EPOCH ] \ + // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ // Will use the requsted version of Network Map for object placement // calculation. - // - [ __NEOFS__NETMAP_LOOKUP_DEPTH | __FROSTFS__NETMAP_LOOKUP_DEPTH ] \ - // Will try older versions (starting from `__NEOFS__NETMAP_EPOCH`/`__FROSTFS__NETMAP_EPOCH` if specified or + // - [ __SYSTEM__NETMAP_LOOKUP_DEPTH ] \ + // (`__NEOFS__NETMAP_LOOKUP_DEPTH` is deprecated) \ + // Will try older versions (starting from `__SYSTEM__NETMAP_EPOCH` (`__NEOFS__NETMAP_EPOCH` is deprecated) if specified or // the latest one otherwise) of Network Map to find an object until the depth // limit is reached. // @@ -435,7 +447,8 @@ type ObjectServiceServer interface { // Chunk messages SHOULD be sent in the direct order of fragmentation. // // Extended headers can change `Put` behaviour: - // - [ __NEOFS__NETMAP_EPOCH | __FROSTFS__NETMAP_EPOCH \ + // - [ __SYSTEM__NETMAP_EPOCH \ + // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ // Will use the requsted version of Network Map for object placement // calculation. // @@ -466,8 +479,9 @@ type ObjectServiceServer interface { // guarantee. Object will be marked for removal and deleted eventually. // // Extended headers can change `Delete` behaviour: - // - [ __NEOFS__NETMAP_EPOCH | __FROSTFS__NETMAP_EPOCH ] \ - // Will use the requsted version of Network Map for object placement + // - [ __SYSTEM__NETMAP_EPOCH ] \ + // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ + // Will use the requested version of Network Map for object placement // calculation. // // Please refer to detailed `XHeader` description. @@ -490,8 +504,9 @@ type ObjectServiceServer interface { // the very minimal information will be returned instead. // // Extended headers can change `Head` behaviour: - // - [ __NEOFS__NETMAP_EPOCH | __FROSTFS__NETMAP_EPOCH ] \ - // Will use the requsted version of Network Map for object placement + // - [ __SYSTEM__NETMAP_EPOCH ] \ + // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ + // Will use the requested version of Network Map for object placement // calculation. // // Please refer to detailed `XHeader` description. @@ -516,8 +531,9 @@ type ObjectServiceServer interface { // Specification section for more details. // // Extended headers can change `Search` behaviour: - // - [ __NEOFS__NETMAP_EPOCH | __FROSTFS__NETMAP_EPOCH ] \ - // Will use the requsted version of Network Map for object placement + // - [ __SYSTEM__NETMAP_EPOCH ] \ + // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ + // Will use the requested version of Network Map for object placement // calculation. // // Please refer to detailed `XHeader` description. @@ -539,10 +555,12 @@ type ObjectServiceServer interface { // order. // // Extended headers can change `GetRange` behaviour: - // - [ __NEOFS__NETMAP_EPOCH | __FROSTFS__NETMAP_EPOCH ] \ - // Will use the requsted version of Network Map for object placement + // - [ __SYSTEM__NETMAP_EPOCH ] \ + // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ + // Will use the requested version of Network Map for object placement // calculation. - // - [ __NEOFS__NETMAP_LOOKUP_DEPTH | __FROSTFS__NETMAP_LOOKUP_DEPTH ] \ + // - [ __SYSTEM__NETMAP_LOOKUP_DEPTH ] \ + // (`__NEOFS__NETMAP_LOOKUP_DEPTH` is deprecated) \ // Will try older versions of Network Map to find an object until the depth // limit is reached. // @@ -571,10 +589,12 @@ type ObjectServiceServer interface { // the request. Note that hash is calculated for XORed data. // // Extended headers can change `GetRangeHash` behaviour: - // - [ __NEOFS__NETMAP_EPOCH | __FROSTFS__NETMAP_EPOCH ] \ - // Will use the requsted version of Network Map for object placement + // - [ __SYSTEM__NETMAP_EPOCH ] \ + // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ + // Will use the requested version of Network Map for object placement // calculation. - // - [ __NEOFS__NETMAP_LOOKUP_DEPTH | __FROSTFS__NETMAP_LOOKUP_DEPTH ] \ + // - [ __SYSTEM__NETMAP_LOOKUP_DEPTH ] \ + // (`__NEOFS__NETMAP_LOOKUP_DEPTH` is deprecated) \ // Will try older versions of Network Map to find an object until the depth // limit is reached. // diff --git a/object/grpc/types.pb.go b/object/grpc/types.pb.go index 6622359..506adda 100644 --- a/object/grpc/types.pb.go +++ b/object/grpc/types.pb.go @@ -556,19 +556,23 @@ func (x *SplitInfo) GetLink() *grpc.ObjectID { // Objects with duplicated attribute names or attributes with empty values // will be considered invalid. // -// There are some "well-known" attributes starting with `__NEOFS__`/`__FROSTFS__` prefix +// There are some "well-known" attributes starting with `__SYSTEM__` (`__NEOFS__` is deprecated) prefix // that affect system behaviour: // -// - [ __NEOFS__UPLOAD_ID | __FROSTFS__UPLOAD_ID ] \ +// - [ __SYSTEM__UPLOAD_ID ] \ +// (`__NEOFS__UPLOAD_ID` is deprecated) \ // Marks smaller parts of a split bigger object -// - [ __NEOFS__EXPIRATION_EPOCH | __FROSTFS__EXPIRATION_EPOCH ] \ +// - [ __SYSTEM__EXPIRATION_EPOCH ] \ +// (`__NEOFS__EXPIRATION_EPOCH` is deprecated) \ // Tells GC to delete object after that epoch -// - [ __NEOFS__TICK_EPOCH | __FROSTFS__TICK_EPOCH ] \ +// - [ __SYSTEM__TICK_EPOCH ] \ +// (`__NEOFS__TICK_EPOCH` is deprecated) \ // Decimal number that defines what epoch must produce // object notification with UTF-8 object address in a // body (`0` value produces notification right after // object put) -// - [ __NEOFS__TICK_TOPIC | __FROSTFS__TICK_TOPIC ] \ +// - [ __SYSTEM__TICK_TOPIC ] \ +// (`__NEOFS__TICK_TOPIC` is deprecated) \ // UTF-8 string topic ID that is used for object notification // // And some well-known attributes used by applications only: diff --git a/session/grpc/types.pb.go b/session/grpc/types.pb.go index de89a80..ed76725 100644 --- a/session/grpc/types.pb.go +++ b/session/grpc/types.pb.go @@ -349,14 +349,16 @@ func (x *SessionToken) GetSignature() *grpc.Signature { // Responses with duplicated header names or headers with empty values will be // considered invalid. // -// There are some "well-known" headers starting with `__NEOFS__` or `__FROSTFS__` prefix that +// There are some "well-known" headers starting with `__SYSTEM__` (`__NEOFS__` is deprecated) prefix that // affect system behaviour: // -// - [ __NEOFS__NETMAP_EPOCH | __FROSTFS__NETMAP_EPOCH ] \ +// - [ __SYSTEM__NETMAP_EPOCH ] \ +// (`__NEOFS__NETMAP_EPOCH` is deprecated) \ // Netmap epoch to use for object placement calculation. The `value` is string // encoded `uint64` in decimal presentation. If set to '0' or not set, the // current epoch only will be used. -// - [ __NEOFS__NETMAP_LOOKUP_DEPTH | __FROSTFS__NETMAP_LOOKUP_DEPTH ] \ +// - [ __SYSTEM__NETMAP_LOOKUP_DEPTH ] \ +// (`__NEOFS__NETMAP_LOOKUP_DEPTH` is deprecated) \ // If object can't be found using current epoch's netmap, this header limits // how many past epochs the node can look up through. The `value` is string // encoded `uint64` in decimal presentation. If set to '0' or not set, only the diff --git a/storagegroup/grpc/types.pb.go b/storagegroup/grpc/types.pb.go index 2513f9c..6629364 100644 --- a/storagegroup/grpc/types.pb.go +++ b/storagegroup/grpc/types.pb.go @@ -27,7 +27,7 @@ const ( // contains objects from the same container. // // Being an object payload, StorageGroup may have expiration Epoch set with -// `__NEOFS__EXPIRATION_EPOCH`/`__FROSTFS__EXPIRATION_EPOCH` well-known attribute. When expired, StorageGroup +// `__SYSTEM__EXPIRATION_EPOCH` (`__NEOFS__EXPIRATION_EPOCH` is deprecated) well-known attribute. When expired, StorageGroup // will be ignored by InnerRing nodes during Data Audit cycles and will be // deleted by Storage Nodes. type StorageGroup struct { diff --git a/tombstone/grpc/types.pb.go b/tombstone/grpc/types.pb.go index 86ed356..3365912 100644 --- a/tombstone/grpc/types.pb.go +++ b/tombstone/grpc/types.pb.go @@ -30,7 +30,7 @@ type Tombstone struct { // Last NeoFS epoch number of the tombstone lifetime. It's set by the tombstone // creator depending on the current NeoFS network settings. A tombstone object - // must have the same expiration epoch value in `__NEOFS__EXPIRATION_EPOCH`/`__FROSTFS__EXPIRATION_EPOCH` + // must have the same expiration epoch value in `__SYSTEM__EXPIRATION_EPOCH` (`__NEOFS__EXPIRATION_EPOCH` is deprecated) // attribute. Otherwise, the tombstone will be rejected by a storage node. ExpirationEpoch uint64 `protobuf:"varint,1,opt,name=expiration_epoch,json=expirationEpoch,proto3" json:"expiration_epoch,omitempty"` // 16 byte UUID used to identify the split object hierarchy parts. Must be From 9dc375346703cdcceadf3e3835d80bc4fea32ab4 Mon Sep 17 00:00:00 2001 From: Denis Kirillov Date: Wed, 15 Mar 2023 12:50:43 +0300 Subject: [PATCH 1043/1196] [#13] *: Rename __FROSTFS__ prefix to __SYSTEM__ Signed-off-by: Denis Kirillov --- container/attributes.go | 7 ++++++- netmap/attributes.go | 5 +++-- netmap/attributes_test.go | 2 +- object/attributes.go | 7 ++++++- session/xheaders.go | 5 ++++- 5 files changed, 20 insertions(+), 6 deletions(-) diff --git a/container/attributes.go b/container/attributes.go index 356a6b9..1d7c94a 100644 --- a/container/attributes.go +++ b/container/attributes.go @@ -1,7 +1,7 @@ package container // SysAttributePrefix is a prefix of key to system attribute. -const SysAttributePrefix = "__FROSTFS__" +const SysAttributePrefix = "__SYSTEM__" const ( // SysAttributeSubnet is a string ID of container's storage subnet. @@ -18,19 +18,24 @@ const ( ) // SysAttributePrefixNeoFS is a prefix of key to system attribute. +// Deprecated: use SysAttributePrefix const SysAttributePrefixNeoFS = "__NEOFS__" const ( // SysAttributeSubnetNeoFS is a string ID of container's storage subnet. + // Deprecated: use SysAttributeSubnet SysAttributeSubnetNeoFS = SysAttributePrefixNeoFS + "SUBNET" // SysAttributeNameNeoFS is a string of human-friendly container name registered as the domain in NNS contract. + // Deprecated: use SysAttributeName SysAttributeNameNeoFS = SysAttributePrefixNeoFS + "NAME" // SysAttributeZoneNeoFS is a string of zone for container name. + // Deprecated: use SysAttributeZone SysAttributeZoneNeoFS = SysAttributePrefixNeoFS + "ZONE" // SysAttributeHomomorphicHashingNeoFS is a container's homomorphic hashing state. + // Deprecated: use SysAttributeHomomorphicHashing SysAttributeHomomorphicHashingNeoFS = SysAttributePrefixNeoFS + "DISABLE_HOMOMORPHIC_HASHING" ) diff --git a/netmap/attributes.go b/netmap/attributes.go index 3ebec57..205376b 100644 --- a/netmap/attributes.go +++ b/netmap/attributes.go @@ -9,9 +9,10 @@ import ( ) // prefix of keys to subnet attributes. -const attrSubnetPrefix = "__FROSTFS__SUBNET_" +const attrSubnetPrefix = "__SYSTEM__SUBNET_" // prefix of keys to subnet attributes. +// Deprecated: use attrSubnetPrefix const attrSubnetPrefixNeoFS = "__NEOFS__SUBNET_" const ( @@ -65,7 +66,7 @@ func subnetAttributeKey(id *refs.SubnetID) string { // - disables non-zero subnet; // - enables zero subnet. // -// Attribute key is calculated from ID using format `__FROSTFS__SUBNET_%s`. +// Attribute key is calculated from ID using format `__SYSTEM__SUBNET_%s`. // Attribute Value is: // - `True` if node enters the subnet; // - `False`, otherwise. diff --git a/netmap/attributes_test.go b/netmap/attributes_test.go index a2b3be9..1a340bd 100644 --- a/netmap/attributes_test.go +++ b/netmap/attributes_test.go @@ -11,7 +11,7 @@ import ( ) func subnetAttrKey(val string) string { - return "__FROSTFS__SUBNET_" + val + return "__SYSTEM__SUBNET_" + val } func assertSubnetAttrKey(t *testing.T, attr *netmap.Attribute, num uint32) { diff --git a/object/attributes.go b/object/attributes.go index 3293682..9aa592f 100644 --- a/object/attributes.go +++ b/object/attributes.go @@ -7,7 +7,7 @@ import ( ) // SysAttributePrefix is a prefix of key to system attribute. -const SysAttributePrefix = "__FROSTFS__" +const SysAttributePrefix = "__SYSTEM__" const ( // SysAttributeUploadID marks smaller parts of a split bigger object. @@ -26,21 +26,26 @@ const ( ) // SysAttributePrefixNeoFS is a prefix of key to system attribute. +// Deprecated: use SysAttributePrefix const SysAttributePrefixNeoFS = "__NEOFS__" const ( // SysAttributeUploadIDNeoFS marks smaller parts of a split bigger object. + // Deprecated: use SysAttributeUploadID SysAttributeUploadIDNeoFS = SysAttributePrefixNeoFS + "UPLOAD_ID" // SysAttributeExpEpochNeoFS tells GC to delete object after that epoch. + // Deprecated: use SysAttributeExpEpoch SysAttributeExpEpochNeoFS = SysAttributePrefixNeoFS + "EXPIRATION_EPOCH" // SysAttributeTickEpochNeoFS defines what epoch must produce object // notification. + // Deprecated: use SysAttributeTickEpoch SysAttributeTickEpochNeoFS = SysAttributePrefixNeoFS + "TICK_EPOCH" // SysAttributeTickTopicNeoFS defines what topic object notification // must be sent to. + // Deprecated: use SysAttributeTickTopic SysAttributeTickTopicNeoFS = SysAttributePrefixNeoFS + "TICK_TOPIC" ) diff --git a/session/xheaders.go b/session/xheaders.go index ba3ac8d..0e02093 100644 --- a/session/xheaders.go +++ b/session/xheaders.go @@ -1,7 +1,7 @@ package session // ReservedXHeaderPrefix is a prefix of keys to "well-known" X-headers. -const ReservedXHeaderPrefix = "__FROSTFS__" +const ReservedXHeaderPrefix = "__SYSTEM__" const ( // XHeaderNetmapEpoch is a key to the reserved X-header that specifies netmap epoch @@ -16,16 +16,19 @@ const ( ) // ReservedXHeaderPrefixNeoFS is a prefix of keys to "well-known" X-headers. +// Deprecated: use ReservedXHeaderPrefix const ReservedXHeaderPrefixNeoFS = "__NEOFS__" const ( // XHeaderNetmapEpochNeoFS is a key to the reserved X-header that specifies netmap epoch // to use for object placement calculation. If set to '0' or not set, the current // epoch only will be used. + // Deprecated: use XHeaderNetmapEpoch XHeaderNetmapEpochNeoFS = ReservedXHeaderPrefixNeoFS + "NETMAP_EPOCH" // XHeaderNetmapLookupDepthNeoFS is a key to the reserved X-header that limits // how many past epochs back the node will can lookup. If set to '0' or not // set, the current epoch only will be used. + // Deprecated: use XHeaderNetmapLookupDepth XHeaderNetmapLookupDepthNeoFS = ReservedXHeaderPrefixNeoFS + "NETMAP_LOOKUP_DEPTH" ) From ee64c0cd51e9896356b0e3893ccb1698f76f5855 Mon Sep 17 00:00:00 2001 From: Liza Date: Wed, 22 Mar 2023 20:54:40 +0300 Subject: [PATCH 1044/1196] [#14] Add Issue Template Add bug reposrt and feature request templates Signed-off-by: Liza --- .github/ISSUE_TEMPLATE/bug_report.md | 45 +++++++++++++++++++++++ .github/ISSUE_TEMPLATE/config.yml | 1 + .github/ISSUE_TEMPLATE/feature_request.md | 20 ++++++++++ 3 files changed, 66 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md create mode 100644 .github/ISSUE_TEMPLATE/config.yml create mode 100644 .github/ISSUE_TEMPLATE/feature_request.md diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..7e778d2 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,45 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: community, triage, bug +assignees: '' + +--- + + + +## Expected Behavior + + + +## Current Behavior + + + +## Possible Solution + + + + + + +## Steps to Reproduce (for bugs) + + + +1. + +## Context + + + +## Regression + + + +## Your Environment + +* Version used: +* Server setup and configuration: +* Operating System and version (`uname -a`): diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000..3ba13e0 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1 @@ +blank_issues_enabled: false diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..d6d1162 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,20 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: '' +labels: community, triage +assignees: '' + +--- + +## Is your feature request related to a problem? Please describe. + + +## Describe the solution you'd like + + +## Describe alternatives you've considered + + +## Additional context + From 29a562da0ee076a8e4ec9540d63a2f9ed7e1ae35 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Fri, 24 Mar 2023 22:06:52 +0300 Subject: [PATCH 1045/1196] [#15] .gitlint: Synchronize settings across FrostFS repos This change allows to use `[#xx]` placeholders for issue number. Signed-off-by: Evgenii Stratonikov --- .gitlint | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlint b/.gitlint index 9ce883f..a1bb93d 100644 --- a/.gitlint +++ b/.gitlint @@ -3,7 +3,7 @@ fail-without-commits=true contrib=CC1 [title-match-regex] -regex=^\[\#[0-9]+\]\s +regex=^\[\#[0-9Xx]+\]\s [ignore-by-title] regex=^Release(.*) From e022a2b831f6f6149609ecf507531ae8061629c9 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Thu, 6 Apr 2023 00:43:56 +0300 Subject: [PATCH 1046/1196] [#16] object: Allow set `copy_number` for every placement vector Signed-off-by: Pavel Karpy --- object/grpc/service.go | 2 +- object/grpc/service.pb.go | 18 +++++++++++++----- object/marshal.go | 6 ++++-- object/test/generate.go | 2 +- object/types.go | 8 ++++---- 5 files changed, 23 insertions(+), 13 deletions(-) diff --git a/object/grpc/service.go b/object/grpc/service.go index 44b5f4a..74dc168 100644 --- a/object/grpc/service.go +++ b/object/grpc/service.go @@ -109,7 +109,7 @@ func (m *PutRequest_Body_Init) SetHeader(v *Header) { } // SetCopiesNumber sets number of the copies to save. -func (m *PutRequest_Body_Init) SetCopiesNumber(v uint32) { +func (m *PutRequest_Body_Init) SetCopiesNumber(v []uint32) { m.CopiesNumber = v } diff --git a/object/grpc/service.pb.go b/object/grpc/service.pb.go index 207b0b0..6ba4090 100644 --- a/object/grpc/service.pb.go +++ b/object/grpc/service.pb.go @@ -1452,9 +1452,17 @@ type PutRequest_Body_Init struct { Signature *grpc1.Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` // Object's Header Header *Header `protobuf:"bytes,3,opt,name=header,proto3" json:"header,omitempty"` - // Number of the object copies to store within the RPC call. By default + // Number of copies of the object to store within the RPC call. By default, // object is processed according to the container's placement policy. - CopiesNumber uint32 `protobuf:"varint,4,opt,name=copies_number,json=copiesNumber,proto3" json:"copies_number,omitempty"` + // Can be one of: + // 1. A single number; applied to the whole request and is treated as + // a minimal number of nodes that must store an object to complete the + // request successfully. + // 2. An ordered array; every number is treated as a minimal number of + // nodes in a corresponding placement vector that must store an object + // to complete the request successfully. The length MUST equal the placement + // vectors number, otherwise request is considered malformed. + CopiesNumber []uint32 `protobuf:"varint,4,rep,packed,name=copies_number,json=copiesNumber,proto3" json:"copies_number,omitempty"` } func (x *PutRequest_Body_Init) Reset() { @@ -1510,11 +1518,11 @@ func (x *PutRequest_Body_Init) GetHeader() *Header { return nil } -func (x *PutRequest_Body_Init) GetCopiesNumber() uint32 { +func (x *PutRequest_Body_Init) GetCopiesNumber() []uint32 { if x != nil { return x.CopiesNumber } - return 0 + return nil } // PUT Object response body @@ -2457,7 +2465,7 @@ var file_object_grpc_service_proto_rawDesc = []byte{ 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x23, 0x0a, 0x0d, 0x63, 0x6f, - 0x70, 0x69, 0x65, 0x73, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x70, 0x69, 0x65, 0x73, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x0c, 0x63, 0x6f, 0x70, 0x69, 0x65, 0x73, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x42, 0x0d, 0x0a, 0x0b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x70, 0x61, 0x72, 0x74, 0x22, 0xa0, 0x02, 0x0a, 0x0b, 0x50, 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x36, diff --git a/object/marshal.go b/object/marshal.go index b918e69..7a89b97 100644 --- a/object/marshal.go +++ b/object/marshal.go @@ -516,7 +516,7 @@ func (r *PutObjectPartInit) StableMarshal(buf []byte) []byte { offset += proto.NestedStructureMarshal(putReqInitObjectIDField, buf[offset:], r.id) offset += proto.NestedStructureMarshal(putReqInitSignatureField, buf[offset:], r.sig) offset += proto.NestedStructureMarshal(putReqInitHeaderField, buf[offset:], r.hdr) - proto.UInt32Marshal(putReqInitCopiesNumField, buf[offset:], r.copyNum) + proto.RepeatedUInt32Marshal(putReqInitCopiesNumField, buf[offset:], r.copyNum) return buf } @@ -529,7 +529,9 @@ func (r *PutObjectPartInit) StableSize() (size int) { size += proto.NestedStructureSize(putReqInitObjectIDField, r.id) size += proto.NestedStructureSize(putReqInitSignatureField, r.sig) size += proto.NestedStructureSize(putReqInitHeaderField, r.hdr) - size += proto.UInt32Size(putReqInitCopiesNumField, r.copyNum) + + arrSize, _ := proto.RepeatedUInt32Size(putReqInitCopiesNumField, r.copyNum) + size += arrSize return size } diff --git a/object/test/generate.go b/object/test/generate.go index 0816ffc..32d7a3c 100644 --- a/object/test/generate.go +++ b/object/test/generate.go @@ -216,7 +216,7 @@ func GeneratePutObjectPartInit(empty bool) *object.PutObjectPartInit { m := new(object.PutObjectPartInit) if !empty { - m.SetCopiesNumber(234) + m.SetCopiesNumber([]uint32{234}) m.SetObjectID(refstest.GenerateObjectID(false)) } diff --git a/object/types.go b/object/types.go index f076b74..a40de57 100644 --- a/object/types.go +++ b/object/types.go @@ -128,7 +128,7 @@ type PutObjectPartInit struct { hdr *Header - copyNum uint32 + copyNum []uint32 } type PutObjectPartChunk struct { @@ -894,15 +894,15 @@ func (r *PutObjectPartInit) SetHeader(v *Header) { r.hdr = v } -func (r *PutObjectPartInit) GetCopiesNumber() uint32 { +func (r *PutObjectPartInit) GetCopiesNumber() []uint32 { if r != nil { return r.copyNum } - return 0 + return nil } -func (r *PutObjectPartInit) SetCopiesNumber(v uint32) { +func (r *PutObjectPartInit) SetCopiesNumber(v []uint32) { r.copyNum = v } From e6522d62a8795766bf1a8526df190a1e86fd6309 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Fri, 7 Apr 2023 15:32:05 +0300 Subject: [PATCH 1047/1196] [#16] container, object: Regenerate service comments Signed-off-by: Pavel Karpy --- container/grpc/service_grpc.pb.go | 108 +++--- object/grpc/service_grpc.pb.go | 530 +++++++++++++++--------------- 2 files changed, 318 insertions(+), 320 deletions(-) diff --git a/container/grpc/service_grpc.pb.go b/container/grpc/service_grpc.pb.go index 3af498b..1de8b5f 100644 --- a/container/grpc/service_grpc.pb.go +++ b/container/grpc/service_grpc.pb.go @@ -28,9 +28,9 @@ type ContainerServiceClient interface { // 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). + // - **OK** (0, SECTION_SUCCESS): \ + // request to save the container has been sent to the sidechain; + // - Common failures (SECTION_FAILURE_COMMON). 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 @@ -38,53 +38,53 @@ type ContainerServiceClient interface { // 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). + // - **OK** (0, SECTION_SUCCESS): \ + // request to remove the container has been sent to the sidechain; + // - Common failures (SECTION_FAILURE_COMMON). 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. + // - **OK** (0, SECTION_SUCCESS): \ + // container has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON); + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // requested container not found. Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*GetResponse, error) // 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). + // - **OK** (0, SECTION_SUCCESS): \ + // container list has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON). List(ctx context.Context, in *ListRequest, opts ...grpc.CallOption) (*ListResponse, error) // Invokes 'SetEACL' method of 'Container` smart contract and returns response // immediately. After one more block in sidechain, changes in an Extended ACL are // added into smart contract storage. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // request to save container eACL has been sent to the sidechain; - // - Common failures (SECTION_FAILURE_COMMON). + // - **OK** (0, SECTION_SUCCESS): \ + // request to save container eACL has been sent to the sidechain; + // - Common failures (SECTION_FAILURE_COMMON). SetExtendedACL(ctx context.Context, in *SetExtendedACLRequest, opts ...grpc.CallOption) (*SetExtendedACLResponse, error) // Returns Extended ACL table and signature from `Container` smart contract // storage. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // container eACL has been successfully read; - // - Common failures (SECTION_FAILURE_COMMON); - // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ - // container not found; - // - **EACL_NOT_FOUND** (3073, SECTION_CONTAINER): \ - // eACL table not found. + // - **OK** (0, SECTION_SUCCESS): \ + // container eACL has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON); + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // container not found; + // - **EACL_NOT_FOUND** (3073, SECTION_CONTAINER): \ + // eACL table not found. GetExtendedACL(ctx context.Context, in *GetExtendedACLRequest, opts ...grpc.CallOption) (*GetExtendedACLResponse, error) // Announces the space values used by the container for P2P synchronization. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // estimation of used space has been successfully announced; - // - Common failures (SECTION_FAILURE_COMMON). + // - **OK** (0, SECTION_SUCCESS): \ + // estimation of used space has been successfully announced; + // - Common failures (SECTION_FAILURE_COMMON). AnnounceUsedSpace(ctx context.Context, in *AnnounceUsedSpaceRequest, opts ...grpc.CallOption) (*AnnounceUsedSpaceResponse, error) } @@ -169,9 +169,9 @@ type ContainerServiceServer interface { // 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). + // - **OK** (0, SECTION_SUCCESS): \ + // request to save the container has been sent to the sidechain; + // - Common failures (SECTION_FAILURE_COMMON). 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 @@ -179,53 +179,53 @@ type ContainerServiceServer interface { // 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). + // - **OK** (0, SECTION_SUCCESS): \ + // request to remove the container has been sent to the sidechain; + // - Common failures (SECTION_FAILURE_COMMON). 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. + // - **OK** (0, SECTION_SUCCESS): \ + // container has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON); + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // requested container not found. Get(context.Context, *GetRequest) (*GetResponse, error) // 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). + // - **OK** (0, SECTION_SUCCESS): \ + // container list has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON). List(context.Context, *ListRequest) (*ListResponse, error) // Invokes 'SetEACL' method of 'Container` smart contract and returns response // immediately. After one more block in sidechain, changes in an Extended ACL are // added into smart contract storage. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // request to save container eACL has been sent to the sidechain; - // - Common failures (SECTION_FAILURE_COMMON). + // - **OK** (0, SECTION_SUCCESS): \ + // request to save container eACL has been sent to the sidechain; + // - Common failures (SECTION_FAILURE_COMMON). SetExtendedACL(context.Context, *SetExtendedACLRequest) (*SetExtendedACLResponse, error) // Returns Extended ACL table and signature from `Container` smart contract // storage. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // container eACL has been successfully read; - // - Common failures (SECTION_FAILURE_COMMON); - // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ - // container not found; - // - **EACL_NOT_FOUND** (3073, SECTION_CONTAINER): \ - // eACL table not found. + // - **OK** (0, SECTION_SUCCESS): \ + // container eACL has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON); + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // container not found; + // - **EACL_NOT_FOUND** (3073, SECTION_CONTAINER): \ + // eACL table not found. GetExtendedACL(context.Context, *GetExtendedACLRequest) (*GetExtendedACLResponse, error) // Announces the space values used by the container for P2P synchronization. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // estimation of used space has been successfully announced; - // - Common failures (SECTION_FAILURE_COMMON). + // - **OK** (0, SECTION_SUCCESS): \ + // estimation of used space has been successfully announced; + // - Common failures (SECTION_FAILURE_COMMON). AnnounceUsedSpace(context.Context, *AnnounceUsedSpaceRequest) (*AnnounceUsedSpaceResponse, error) } diff --git a/object/grpc/service_grpc.pb.go b/object/grpc/service_grpc.pb.go index 23906d6..6b1c32a 100644 --- a/object/grpc/service_grpc.pb.go +++ b/object/grpc/service_grpc.pb.go @@ -30,32 +30,32 @@ type ObjectServiceClient interface { // keeping the receiving order. // // Extended headers can change `Get` behaviour: - // - [ __SYSTEM__NETMAP_EPOCH ] \ - // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ - // Will use the requsted version of Network Map for object placement - // calculation. - // - [ __SYSTEM__NETMAP_LOOKUP_DEPTH ] \ - // (`__NEOFS__NETMAP_LOOKUP_DEPTH` is deprecated) \ - // Will try older versions (starting from `__SYSTEM__NETMAP_EPOCH` (`__NEOFS__NETMAP_EPOCH` is deprecated) if specified or - // the latest one otherwise) of Network Map to find an object until the depth - // limit is reached. + // * [ __SYSTEM__NETMAP_EPOCH ] \ + // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ + // Will use the requsted version of Network Map for object placement + // calculation. + // * [ __SYSTEM__NETMAP_LOOKUP_DEPTH ] \ + // (`__NEOFS__NETMAP_LOOKUP_DEPTH` is deprecated) \ + // Will try older versions (starting from `__SYSTEM__NETMAP_EPOCH` (`__NEOFS__NETMAP_EPOCH` is deprecated) if specified or + // the latest one otherwise) of Network Map to find an object until the depth + // limit is reached. // // Please refer to detailed `XHeader` description. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // object has been successfully read; - // - Common failures (SECTION_FAILURE_COMMON); - // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ - // read access to the object is denied; - // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ - // object not found in container; - // - **OBJECT_ALREADY_REMOVED** (2052, SECTION_OBJECT): \ - // the requested object has been marked as deleted; - // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ - // object container not found; - // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ - // provided session token has expired. + // - **OK** (0, SECTION_SUCCESS): \ + // object has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON); + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // read access to the object is denied; + // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ + // object not found in container; + // - **OBJECT_ALREADY_REMOVED** (2052, SECTION_OBJECT): \ + // the requested object has been marked as deleted; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // object container not found; + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (ObjectService_GetClient, error) // Put the object into container. Request uses gRPC stream. First message // SHOULD be of PutHeader type. `ContainerID` and `OwnerID` of an object @@ -65,107 +65,106 @@ type ObjectServiceClient interface { // Chunk messages SHOULD be sent in the direct order of fragmentation. // // Extended headers can change `Put` behaviour: - // - [ __SYSTEM__NETMAP_EPOCH \ - // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ - // Will use the requsted version of Network Map for object placement - // calculation. + // * [ __SYSTEM__NETMAP_EPOCH \ + // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ + // Will use the requsted version of Network Map for object placement + // calculation. // // Please refer to detailed `XHeader` description. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // object has been successfully saved in the container; - // - Common failures (SECTION_FAILURE_COMMON); - // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ - // write access to the container is denied; - // - **LOCKED** (2050, SECTION_OBJECT): \ - // placement of an object of type TOMBSTONE that includes at least one locked - // object is prohibited; - // - **LOCK_NON_REGULAR_OBJECT** (2051, SECTION_OBJECT): \ - // placement of an object of type LOCK that includes at least one object of - // type other than REGULAR is prohibited; - // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ - // object storage container not found; - // - **TOKEN_NOT_FOUND** (4096, SECTION_SESSION): \ - // (for trusted object preparation) session private key does not exist or has - // + // - **OK** (0, SECTION_SUCCESS): \ + // object has been successfully saved in the container; + // - Common failures (SECTION_FAILURE_COMMON); + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // write access to the container is denied; + // - **LOCKED** (2050, SECTION_OBJECT): \ + // placement of an object of type TOMBSTONE that includes at least one locked + // object is prohibited; + // - **LOCK_NON_REGULAR_OBJECT** (2051, SECTION_OBJECT): \ + // placement of an object of type LOCK that includes at least one object of + // type other than REGULAR is prohibited; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // object storage container not found; + // - **TOKEN_NOT_FOUND** (4096, SECTION_SESSION): \ + // (for trusted object preparation) session private key does not exist or has // been deleted; - // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ - // provided session token has expired. + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. Put(ctx context.Context, opts ...grpc.CallOption) (ObjectService_PutClient, error) // Delete the object from a container. There is no immediate removal // guarantee. Object will be marked for removal and deleted eventually. // // Extended headers can change `Delete` behaviour: - // - [ __SYSTEM__NETMAP_EPOCH ] \ - // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ - // Will use the requested version of Network Map for object placement - // calculation. + // * [ __SYSTEM__NETMAP_EPOCH ] \ + // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ + // Will use the requested version of Network Map for object placement + // calculation. // // Please refer to detailed `XHeader` description. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // object has been successfully marked to be removed from the container; - // - Common failures (SECTION_FAILURE_COMMON); - // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ - // delete access to the object is denied; - // - **LOCKED** (2050, SECTION_OBJECT): \ - // deleting a locked object is prohibited; - // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ - // object container not found; - // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ - // provided session token has expired. + // - **OK** (0, SECTION_SUCCESS): \ + // object has been successfully marked to be removed from the container; + // - Common failures (SECTION_FAILURE_COMMON); + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // delete access to the object is denied; + // - **LOCKED** (2050, SECTION_OBJECT): \ + // deleting a locked object is prohibited; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // object container not found; + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteResponse, error) // Returns the object Headers without data payload. By default full header is // returned. If `main_only` request field is set, the short header with only // the very minimal information will be returned instead. // // Extended headers can change `Head` behaviour: - // - [ __SYSTEM__NETMAP_EPOCH ] \ - // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ - // Will use the requested version of Network Map for object placement - // calculation. + // * [ __SYSTEM__NETMAP_EPOCH ] \ + // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ + // Will use the requested version of Network Map for object placement + // calculation. // // Please refer to detailed `XHeader` description. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // object header has been successfully read; - // - Common failures (SECTION_FAILURE_COMMON); - // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ - // access to operation HEAD of the object is denied; - // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ - // object not found in container; - // - **OBJECT_ALREADY_REMOVED** (2052, SECTION_OBJECT): \ - // the requested object has been marked as deleted; - // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ - // object container not found; - // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ - // provided session token has expired. + // - **OK** (0, SECTION_SUCCESS): \ + // object header has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON); + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // access to operation HEAD of the object is denied; + // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ + // object not found in container; + // - **OBJECT_ALREADY_REMOVED** (2052, SECTION_OBJECT): \ + // the requested object has been marked as deleted; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // object container not found; + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. Head(ctx context.Context, in *HeadRequest, opts ...grpc.CallOption) (*HeadResponse, error) // Search objects in container. Search query allows to match by Object // Header's filed values. Please see the corresponding NeoFS Technical // Specification section for more details. // // Extended headers can change `Search` behaviour: - // - [ __SYSTEM__NETMAP_EPOCH ] \ - // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ - // Will use the requested version of Network Map for object placement - // calculation. + // * [ __SYSTEM__NETMAP_EPOCH ] \ + // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ + // Will use the requested version of Network Map for object placement + // calculation. // // Please refer to detailed `XHeader` description. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // objects have been successfully selected; - // - Common failures (SECTION_FAILURE_COMMON); - // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ - // access to operation SEARCH of the object is denied; - // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ - // search container not found; - // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ - // provided session token has expired. + // - **OK** (0, SECTION_SUCCESS): \ + // objects have been successfully selected; + // - Common failures (SECTION_FAILURE_COMMON); + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // access to operation SEARCH of the object is denied; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // search container not found; + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. Search(ctx context.Context, in *SearchRequest, opts ...grpc.CallOption) (ObjectService_SearchClient, error) // Get byte range of data payload. Range is set as an (offset, length) tuple. // Like in `Get` method, the response uses gRPC stream. Requested range can be @@ -173,33 +172,33 @@ type ObjectServiceClient interface { // order. // // Extended headers can change `GetRange` behaviour: - // - [ __SYSTEM__NETMAP_EPOCH ] \ - // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ - // Will use the requested version of Network Map for object placement - // calculation. - // - [ __SYSTEM__NETMAP_LOOKUP_DEPTH ] \ - // (`__NEOFS__NETMAP_LOOKUP_DEPTH` is deprecated) \ - // Will try older versions of Network Map to find an object until the depth - // limit is reached. + // * [ __SYSTEM__NETMAP_EPOCH ] \ + // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ + // Will use the requested version of Network Map for object placement + // calculation. + // * [ __SYSTEM__NETMAP_LOOKUP_DEPTH ] \ + // (`__NEOFS__NETMAP_LOOKUP_DEPTH` is deprecated) \ + // Will try older versions of Network Map to find an object until the depth + // limit is reached. // // Please refer to detailed `XHeader` description. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // data range of the object payload has been successfully read; - // - Common failures (SECTION_FAILURE_COMMON); - // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ - // access to operation RANGE of the object is denied; - // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ - // object not found in container; - // - **OBJECT_ALREADY_REMOVED** (2052, SECTION_OBJECT): \ - // the requested object has been marked as deleted. - // - **OUT_OF_RANGE** (2053, SECTION_OBJECT): \ - // the requested range is out of bounds; - // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ - // object container not found; - // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ - // provided session token has expired. + // - **OK** (0, SECTION_SUCCESS): \ + // data range of the object payload has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON); + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // access to operation RANGE of the object is denied; + // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ + // object not found in container; + // - **OBJECT_ALREADY_REMOVED** (2052, SECTION_OBJECT): \ + // the requested object has been marked as deleted. + // - **OUT_OF_RANGE** (2053, SECTION_OBJECT): \ + // the requested range is out of bounds; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // object container not found; + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. GetRange(ctx context.Context, in *GetRangeRequest, opts ...grpc.CallOption) (ObjectService_GetRangeClient, error) // Returns homomorphic or regular hash of object's payload range after // applying XOR operation with the provided `salt`. Ranges are set of (offset, @@ -207,31 +206,31 @@ type ObjectServiceClient interface { // the request. Note that hash is calculated for XORed data. // // Extended headers can change `GetRangeHash` behaviour: - // - [ __SYSTEM__NETMAP_EPOCH ] \ - // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ - // Will use the requested version of Network Map for object placement - // calculation. - // - [ __SYSTEM__NETMAP_LOOKUP_DEPTH ] \ - // (`__NEOFS__NETMAP_LOOKUP_DEPTH` is deprecated) \ - // Will try older versions of Network Map to find an object until the depth - // limit is reached. + // * [ __SYSTEM__NETMAP_EPOCH ] \ + // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ + // Will use the requested version of Network Map for object placement + // calculation. + // * [ __SYSTEM__NETMAP_LOOKUP_DEPTH ] \ + // (`__NEOFS__NETMAP_LOOKUP_DEPTH` is deprecated) \ + // Will try older versions of Network Map to find an object until the depth + // limit is reached. // // Please refer to detailed `XHeader` description. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // data range of the object payload has been successfully hashed; - // - Common failures (SECTION_FAILURE_COMMON); - // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ - // access to operation RANGEHASH of the object is denied; - // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ - // object not found in container; - // - **OUT_OF_RANGE** (2053, SECTION_OBJECT): \ - // the requested range is out of bounds; - // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ - // object container not found; - // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ - // provided session token has expired. + // - **OK** (0, SECTION_SUCCESS): \ + // data range of the object payload has been successfully hashed; + // - Common failures (SECTION_FAILURE_COMMON); + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // access to operation RANGEHASH of the object is denied; + // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ + // object not found in container; + // - **OUT_OF_RANGE** (2053, SECTION_OBJECT): \ + // the requested range is out of bounds; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // object container not found; + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. GetRangeHash(ctx context.Context, in *GetRangeHashRequest, opts ...grpc.CallOption) (*GetRangeHashResponse, error) } @@ -412,32 +411,32 @@ type ObjectServiceServer interface { // keeping the receiving order. // // Extended headers can change `Get` behaviour: - // - [ __SYSTEM__NETMAP_EPOCH ] \ - // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ - // Will use the requsted version of Network Map for object placement - // calculation. - // - [ __SYSTEM__NETMAP_LOOKUP_DEPTH ] \ - // (`__NEOFS__NETMAP_LOOKUP_DEPTH` is deprecated) \ - // Will try older versions (starting from `__SYSTEM__NETMAP_EPOCH` (`__NEOFS__NETMAP_EPOCH` is deprecated) if specified or - // the latest one otherwise) of Network Map to find an object until the depth - // limit is reached. + // * [ __SYSTEM__NETMAP_EPOCH ] \ + // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ + // Will use the requsted version of Network Map for object placement + // calculation. + // * [ __SYSTEM__NETMAP_LOOKUP_DEPTH ] \ + // (`__NEOFS__NETMAP_LOOKUP_DEPTH` is deprecated) \ + // Will try older versions (starting from `__SYSTEM__NETMAP_EPOCH` (`__NEOFS__NETMAP_EPOCH` is deprecated) if specified or + // the latest one otherwise) of Network Map to find an object until the depth + // limit is reached. // // Please refer to detailed `XHeader` description. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // object has been successfully read; - // - Common failures (SECTION_FAILURE_COMMON); - // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ - // read access to the object is denied; - // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ - // object not found in container; - // - **OBJECT_ALREADY_REMOVED** (2052, SECTION_OBJECT): \ - // the requested object has been marked as deleted; - // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ - // object container not found; - // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ - // provided session token has expired. + // - **OK** (0, SECTION_SUCCESS): \ + // object has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON); + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // read access to the object is denied; + // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ + // object not found in container; + // - **OBJECT_ALREADY_REMOVED** (2052, SECTION_OBJECT): \ + // the requested object has been marked as deleted; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // object container not found; + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. Get(*GetRequest, ObjectService_GetServer) error // Put the object into container. Request uses gRPC stream. First message // SHOULD be of PutHeader type. `ContainerID` and `OwnerID` of an object @@ -447,107 +446,106 @@ type ObjectServiceServer interface { // Chunk messages SHOULD be sent in the direct order of fragmentation. // // Extended headers can change `Put` behaviour: - // - [ __SYSTEM__NETMAP_EPOCH \ - // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ - // Will use the requsted version of Network Map for object placement - // calculation. + // * [ __SYSTEM__NETMAP_EPOCH \ + // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ + // Will use the requsted version of Network Map for object placement + // calculation. // // Please refer to detailed `XHeader` description. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // object has been successfully saved in the container; - // - Common failures (SECTION_FAILURE_COMMON); - // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ - // write access to the container is denied; - // - **LOCKED** (2050, SECTION_OBJECT): \ - // placement of an object of type TOMBSTONE that includes at least one locked - // object is prohibited; - // - **LOCK_NON_REGULAR_OBJECT** (2051, SECTION_OBJECT): \ - // placement of an object of type LOCK that includes at least one object of - // type other than REGULAR is prohibited; - // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ - // object storage container not found; - // - **TOKEN_NOT_FOUND** (4096, SECTION_SESSION): \ - // (for trusted object preparation) session private key does not exist or has - // + // - **OK** (0, SECTION_SUCCESS): \ + // object has been successfully saved in the container; + // - Common failures (SECTION_FAILURE_COMMON); + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // write access to the container is denied; + // - **LOCKED** (2050, SECTION_OBJECT): \ + // placement of an object of type TOMBSTONE that includes at least one locked + // object is prohibited; + // - **LOCK_NON_REGULAR_OBJECT** (2051, SECTION_OBJECT): \ + // placement of an object of type LOCK that includes at least one object of + // type other than REGULAR is prohibited; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // object storage container not found; + // - **TOKEN_NOT_FOUND** (4096, SECTION_SESSION): \ + // (for trusted object preparation) session private key does not exist or has // been deleted; - // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ - // provided session token has expired. + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. Put(ObjectService_PutServer) error // Delete the object from a container. There is no immediate removal // guarantee. Object will be marked for removal and deleted eventually. // // Extended headers can change `Delete` behaviour: - // - [ __SYSTEM__NETMAP_EPOCH ] \ - // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ - // Will use the requested version of Network Map for object placement - // calculation. + // * [ __SYSTEM__NETMAP_EPOCH ] \ + // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ + // Will use the requested version of Network Map for object placement + // calculation. // // Please refer to detailed `XHeader` description. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // object has been successfully marked to be removed from the container; - // - Common failures (SECTION_FAILURE_COMMON); - // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ - // delete access to the object is denied; - // - **LOCKED** (2050, SECTION_OBJECT): \ - // deleting a locked object is prohibited; - // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ - // object container not found; - // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ - // provided session token has expired. + // - **OK** (0, SECTION_SUCCESS): \ + // object has been successfully marked to be removed from the container; + // - Common failures (SECTION_FAILURE_COMMON); + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // delete access to the object is denied; + // - **LOCKED** (2050, SECTION_OBJECT): \ + // deleting a locked object is prohibited; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // object container not found; + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. Delete(context.Context, *DeleteRequest) (*DeleteResponse, error) // Returns the object Headers without data payload. By default full header is // returned. If `main_only` request field is set, the short header with only // the very minimal information will be returned instead. // // Extended headers can change `Head` behaviour: - // - [ __SYSTEM__NETMAP_EPOCH ] \ - // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ - // Will use the requested version of Network Map for object placement - // calculation. + // * [ __SYSTEM__NETMAP_EPOCH ] \ + // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ + // Will use the requested version of Network Map for object placement + // calculation. // // Please refer to detailed `XHeader` description. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // object header has been successfully read; - // - Common failures (SECTION_FAILURE_COMMON); - // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ - // access to operation HEAD of the object is denied; - // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ - // object not found in container; - // - **OBJECT_ALREADY_REMOVED** (2052, SECTION_OBJECT): \ - // the requested object has been marked as deleted; - // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ - // object container not found; - // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ - // provided session token has expired. + // - **OK** (0, SECTION_SUCCESS): \ + // object header has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON); + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // access to operation HEAD of the object is denied; + // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ + // object not found in container; + // - **OBJECT_ALREADY_REMOVED** (2052, SECTION_OBJECT): \ + // the requested object has been marked as deleted; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // object container not found; + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. Head(context.Context, *HeadRequest) (*HeadResponse, error) // Search objects in container. Search query allows to match by Object // Header's filed values. Please see the corresponding NeoFS Technical // Specification section for more details. // // Extended headers can change `Search` behaviour: - // - [ __SYSTEM__NETMAP_EPOCH ] \ - // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ - // Will use the requested version of Network Map for object placement - // calculation. + // * [ __SYSTEM__NETMAP_EPOCH ] \ + // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ + // Will use the requested version of Network Map for object placement + // calculation. // // Please refer to detailed `XHeader` description. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // objects have been successfully selected; - // - Common failures (SECTION_FAILURE_COMMON); - // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ - // access to operation SEARCH of the object is denied; - // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ - // search container not found; - // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ - // provided session token has expired. + // - **OK** (0, SECTION_SUCCESS): \ + // objects have been successfully selected; + // - Common failures (SECTION_FAILURE_COMMON); + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // access to operation SEARCH of the object is denied; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // search container not found; + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. Search(*SearchRequest, ObjectService_SearchServer) error // Get byte range of data payload. Range is set as an (offset, length) tuple. // Like in `Get` method, the response uses gRPC stream. Requested range can be @@ -555,33 +553,33 @@ type ObjectServiceServer interface { // order. // // Extended headers can change `GetRange` behaviour: - // - [ __SYSTEM__NETMAP_EPOCH ] \ - // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ - // Will use the requested version of Network Map for object placement - // calculation. - // - [ __SYSTEM__NETMAP_LOOKUP_DEPTH ] \ - // (`__NEOFS__NETMAP_LOOKUP_DEPTH` is deprecated) \ - // Will try older versions of Network Map to find an object until the depth - // limit is reached. + // * [ __SYSTEM__NETMAP_EPOCH ] \ + // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ + // Will use the requested version of Network Map for object placement + // calculation. + // * [ __SYSTEM__NETMAP_LOOKUP_DEPTH ] \ + // (`__NEOFS__NETMAP_LOOKUP_DEPTH` is deprecated) \ + // Will try older versions of Network Map to find an object until the depth + // limit is reached. // // Please refer to detailed `XHeader` description. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // data range of the object payload has been successfully read; - // - Common failures (SECTION_FAILURE_COMMON); - // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ - // access to operation RANGE of the object is denied; - // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ - // object not found in container; - // - **OBJECT_ALREADY_REMOVED** (2052, SECTION_OBJECT): \ - // the requested object has been marked as deleted. - // - **OUT_OF_RANGE** (2053, SECTION_OBJECT): \ - // the requested range is out of bounds; - // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ - // object container not found; - // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ - // provided session token has expired. + // - **OK** (0, SECTION_SUCCESS): \ + // data range of the object payload has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON); + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // access to operation RANGE of the object is denied; + // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ + // object not found in container; + // - **OBJECT_ALREADY_REMOVED** (2052, SECTION_OBJECT): \ + // the requested object has been marked as deleted. + // - **OUT_OF_RANGE** (2053, SECTION_OBJECT): \ + // the requested range is out of bounds; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // object container not found; + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. GetRange(*GetRangeRequest, ObjectService_GetRangeServer) error // Returns homomorphic or regular hash of object's payload range after // applying XOR operation with the provided `salt`. Ranges are set of (offset, @@ -589,31 +587,31 @@ type ObjectServiceServer interface { // the request. Note that hash is calculated for XORed data. // // Extended headers can change `GetRangeHash` behaviour: - // - [ __SYSTEM__NETMAP_EPOCH ] \ - // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ - // Will use the requested version of Network Map for object placement - // calculation. - // - [ __SYSTEM__NETMAP_LOOKUP_DEPTH ] \ - // (`__NEOFS__NETMAP_LOOKUP_DEPTH` is deprecated) \ - // Will try older versions of Network Map to find an object until the depth - // limit is reached. + // * [ __SYSTEM__NETMAP_EPOCH ] \ + // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ + // Will use the requested version of Network Map for object placement + // calculation. + // * [ __SYSTEM__NETMAP_LOOKUP_DEPTH ] \ + // (`__NEOFS__NETMAP_LOOKUP_DEPTH` is deprecated) \ + // Will try older versions of Network Map to find an object until the depth + // limit is reached. // // Please refer to detailed `XHeader` description. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // data range of the object payload has been successfully hashed; - // - Common failures (SECTION_FAILURE_COMMON); - // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ - // access to operation RANGEHASH of the object is denied; - // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ - // object not found in container; - // - **OUT_OF_RANGE** (2053, SECTION_OBJECT): \ - // the requested range is out of bounds; - // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ - // object container not found; - // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ - // provided session token has expired. + // - **OK** (0, SECTION_SUCCESS): \ + // data range of the object payload has been successfully hashed; + // - Common failures (SECTION_FAILURE_COMMON); + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // access to operation RANGEHASH of the object is denied; + // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ + // object not found in container; + // - **OUT_OF_RANGE** (2053, SECTION_OBJECT): \ + // the requested range is out of bounds; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // object container not found; + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. GetRangeHash(context.Context, *GetRangeHashRequest) (*GetRangeHashResponse, error) } From 3a7280968b28e55a775aabfc54e50271a44a7ee7 Mon Sep 17 00:00:00 2001 From: Dmitrii Stepanov Date: Tue, 21 Mar 2023 11:46:56 +0300 Subject: [PATCH 1048/1196] [#12] tracing: Add tracing dependencies Signed-off-by: Dmitrii Stepanov --- go.mod | 31 +++-- go.sum | 360 +++++++++++++++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 361 insertions(+), 30 deletions(-) diff --git a/go.mod b/go.mod index 6fce011..7a6dc32 100644 --- a/go.mod +++ b/go.mod @@ -4,22 +4,33 @@ go 1.18 require ( git.frostfs.info/TrueCloudLab/frostfs-crypto v0.6.0 - github.com/stretchr/testify v1.7.0 + github.com/stretchr/testify v1.8.2 + go.opentelemetry.io/otel v1.14.0 + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.14.0 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.14.0 + go.opentelemetry.io/otel/sdk v1.14.0 + go.opentelemetry.io/otel/trace v1.14.0 golang.org/x/sync v0.1.0 - google.golang.org/grpc v1.48.0 - google.golang.org/protobuf v1.28.0 + google.golang.org/grpc v1.53.0 + google.golang.org/protobuf v1.28.1 ) require ( git.frostfs.info/TrueCloudLab/rfc6979 v0.4.0 // indirect - github.com/davecgh/go-spew v1.1.0 // indirect + github.com/cenkalti/backoff/v4 v4.2.0 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect + github.com/go-logr/logr v1.2.3 // indirect + github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.2 // indirect - github.com/google/go-cmp v0.5.8 // indirect + github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/mr-tron/base58 v1.2.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - golang.org/x/net v0.0.0-20201021035429-f5854403a974 // indirect - golang.org/x/sys v0.1.0 // indirect - golang.org/x/text v0.3.3 // indirect - google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 // indirect - gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.14.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.14.0 // indirect + go.opentelemetry.io/proto/otlp v0.19.0 // indirect + golang.org/x/net v0.7.0 // indirect + golang.org/x/sys v0.5.0 // indirect + golang.org/x/text v0.7.0 // indirect + google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index e81a6ec..0664c0e 100644 --- a/go.sum +++ b/go.sum @@ -1,34 +1,98 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= +cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= +cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= +cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= +cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= +cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= +cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4= +cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M= +cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc= +cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk= +cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs= +cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc= +cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY= +cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= +cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= +cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= +cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= +cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= +cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= +cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= +cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= +cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= +cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= +cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= +cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU= +cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= +cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= +cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= +cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= +cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= +dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= git.frostfs.info/TrueCloudLab/frostfs-crypto v0.6.0 h1:FxqFDhQYYgpe41qsIHVOcdzSVCB8JNSfPG7Uk4r2oSk= git.frostfs.info/TrueCloudLab/frostfs-crypto v0.6.0/go.mod h1:RUIKZATQLJ+TaYQa60X2fTDwfuhMfm8Ar60bQ5fr+vU= git.frostfs.info/TrueCloudLab/rfc6979 v0.4.0 h1:M2KR3iBj7WpY3hP10IevfIB9MURr4O9mwVfJ+SjT3HA= git.frostfs.info/TrueCloudLab/rfc6979 v0.4.0/go.mod h1:okpbKfVYf/BpejtfFTfhZqFP+sZ8rsHrP8Rr/jYPNRc= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= +github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= +github.com/cenkalti/backoff/v4 v4.2.0 h1:HN5dHm3WBOgndBH6E8V0q2jIYIR3s9yglV8k/+MN3u4= +github.com/cenkalti/backoff/v4 v4.2.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= +github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= +github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= +github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= -github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE= +github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= +github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= +github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/glog v1.0.0 h1:nfP3RFugxnNRyKgeWd4oI1nYvXpxrx8ck8ZrcizshdQ= +github.com/golang/glog v1.0.0/go.mod h1:EWib/APOK0SL3dFbYqvxE3UYd8E6s1ouQ7iEp/0LWV4= +github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= +github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= @@ -40,84 +104,328 @@ github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= -github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= +github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= +github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= +github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 h1:BZHcxBETFHIdVyhyEfOvn/RdU/QGdLI4y34qQGjGWO0= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0/go.mod h1:hgWBS7lorOAVIJEQMi4ZsPv9hVvWI6+ch50m39Pf2Ks= +github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= +github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= +github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/mr-tron/base58 v1.2.0 h1:T/HDJBh4ZCPbU39/+c3rRvE0uKBQlU27+QI8LJ4t64o= github.com/mr-tron/base58 v1.2.0/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= +github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= +github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= +go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= +go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opentelemetry.io/otel v1.14.0 h1:/79Huy8wbf5DnIPhemGB+zEPVwnN6fuQybr/SRXa6hM= +go.opentelemetry.io/otel v1.14.0/go.mod h1:o4buv+dJzx8rohcUeRmWUZhqupFvzWis188WlggnNeU= +go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.14.0 h1:/fXHZHGvro6MVqV34fJzDhi7sHGpX3Ej/Qjmfn003ho= +go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.14.0/go.mod h1:UFG7EBMRdXyFstOwH028U0sVf+AvukSGhF0g8+dmNG8= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.14.0 h1:TKf2uAs2ueguzLaxOCBXNpHxfO/aC7PAdDsSH0IbeRQ= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.14.0/go.mod h1:HrbCVv40OOLTABmOn1ZWty6CHXkU8DK/Urc43tHug70= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.14.0 h1:ap+y8RXX3Mu9apKVtOkM6WSFESLM8K3wNQyOU8sWHcc= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.14.0/go.mod h1:5w41DY6S9gZrbjuq6Y+753e96WfPha5IcsOSZTtullM= +go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.14.0 h1:sEL90JjOO/4yhquXl5zTAkLLsZ5+MycAgX99SDsxGc8= +go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.14.0/go.mod h1:oCslUcizYdpKYyS9e8srZEqM6BB8fq41VJBjLAE6z1w= +go.opentelemetry.io/otel/sdk v1.14.0 h1:PDCppFRDq8A1jL9v6KMI6dYesaq+DFcDZvjsoGvxGzY= +go.opentelemetry.io/otel/sdk v1.14.0/go.mod h1:bwIC5TjrNG6QDCHNWvW4HLHtUQ4I+VQDsnjhvyZCALM= +go.opentelemetry.io/otel/trace v1.14.0 h1:wp2Mmvj41tDsyAJXiWDWpfNsOiIyd38fy85pyKcFq/M= +go.opentelemetry.io/otel/trace v1.14.0/go.mod h1:8avnQLK+CG77yNLUae4ea2JDQ6iT+gozhnZjy/rw9G8= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= +go.opentelemetry.io/proto/otlp v0.19.0 h1:IVN6GR+mhC4s5yfcTbmzHYODqvWAp3ZedA2SJPI1Nnw= +go.opentelemetry.io/proto/otlp v0.19.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= +go.uber.org/goleak v1.2.1 h1:NBol2c7O1ZokfZ0LEU9K6Whx/KnwvepVetCUhtKja4A= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= +golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= +golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= +golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= +golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= +golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= +golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= +golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= +golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= +golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= +golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= +golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20201021035429-f5854403a974 h1:IX6qOQeG5uLjB/hjjwjedwfjND0hgjPMMyO1RoIXQNI= -golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= +golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g= +golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.1.0 h1:kunALQeHf1/185U1i0GOB/fy1IPRDDpuoOOqRReG57U= -golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k= +golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= +golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= +golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= +golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= +google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= +google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.19.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= +google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= +google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM= +google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= +google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= +google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA= +google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 h1:+kGHl1aib/qcwaRi1CbqBZ1rk19r85MNUf8HaBghugY= +google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= +google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= +google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f h1:BWUVssLB0HVOSY78gIdvk1dTVYtT1y8SBWtPYuTJ/6w= +google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= +google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= +google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= +google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= +google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.48.0 h1:rQOsyJ/8+ufEDJd/Gdsz7HG220Mh9HAhFHRGnIjda0w= -google.golang.org/grpc v1.48.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= +google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= +google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= +google.golang.org/grpc v1.53.0 h1:LAv2ds7cmFV/XTS3XG1NneeENYrXGmorPxsBbptIjNc= +google.golang.org/grpc v1.53.0/go.mod h1:OnIrk0ipVdj4N5d9IUoFUx72/VlD7+jUsHwZgwSMQpw= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -126,17 +434,29 @@ google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzi google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw= -google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= +google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w= +google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= +honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= +honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= +rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= +rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= +rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= From 816628d37db53bd8dfb307a2a0e2c752304939aa Mon Sep 17 00:00:00 2001 From: Dmitrii Stepanov Date: Tue, 21 Mar 2023 11:47:38 +0300 Subject: [PATCH 1049/1196] [#12] tracing: Add tracing package Add tracing config, implementation and setup Signed-off-by: Dmitrii Stepanov --- pkg/tracing/config.go | 74 ++++++++++ pkg/tracing/config_test.go | 212 +++++++++++++++++++++++++++ pkg/tracing/propagator.go | 96 ++++++++++++ pkg/tracing/propagator_test.go | 257 +++++++++++++++++++++++++++++++++ pkg/tracing/setup.go | 156 ++++++++++++++++++++ pkg/tracing/span.go | 12 ++ 6 files changed, 807 insertions(+) create mode 100644 pkg/tracing/config.go create mode 100644 pkg/tracing/config_test.go create mode 100644 pkg/tracing/propagator.go create mode 100644 pkg/tracing/propagator_test.go create mode 100644 pkg/tracing/setup.go create mode 100644 pkg/tracing/span.go diff --git a/pkg/tracing/config.go b/pkg/tracing/config.go new file mode 100644 index 0000000..001953a --- /dev/null +++ b/pkg/tracing/config.go @@ -0,0 +1,74 @@ +package tracing + +import "fmt" + +// Exporter is type of tracing target. +type Exporter string + +const ( + Stdout Exporter = "stdout" + OTLPgRPC Exporter = "otlp_grpc" +) + +type Config struct { + // Enabled is true, if tracing enabled. + Enabled bool + // Exporter is collector type. + Exporter Exporter + // Endpoint is collector endpoint for OTLP exporters. + Endpoint string + + // Service is service name that will be used in tracing. + // Mandatory. + Service string + // InstanceID is identity of service instance. + // Optional. + InstanceID string + // Version is version of service instance. + // Optional. + Version string +} + +func (c *Config) validate() error { + if !c.Enabled { + return nil + } + + if c.Exporter != Stdout && c.Exporter != OTLPgRPC { + return fmt.Errorf("tracing config error: unknown exporter '%s', valid values are %v", + c.Exporter, []string{string(Stdout), string(OTLPgRPC)}) + } + + if len(c.Service) == 0 { + return fmt.Errorf("tracing config error: service name must be specified") + } + + if c.Exporter == OTLPgRPC && len(c.Endpoint) == 0 { + return fmt.Errorf("tracing config error: exporter '%s' requires endpoint", c.Exporter) + } + + return nil +} + +func (c *Config) hasChange(other *Config) bool { + if !c.Enabled && !other.Enabled { + return false + } + if c.Enabled != other.Enabled { + return true + } + + if c.Exporter == Stdout && other.Exporter == Stdout { + return !c.serviceInfoEqual(other) + } + + return c.Exporter != other.Exporter || + c.Endpoint != other.Endpoint || + !c.serviceInfoEqual(other) +} + +func (c *Config) serviceInfoEqual(other *Config) bool { + return c.Service == other.Service && + c.InstanceID == other.InstanceID && + c.Version == other.Version +} diff --git a/pkg/tracing/config_test.go b/pkg/tracing/config_test.go new file mode 100644 index 0000000..031dd3b --- /dev/null +++ b/pkg/tracing/config_test.go @@ -0,0 +1,212 @@ +package tracing + +import ( + "testing" +) + +func TestConfig_validate(t *testing.T) { + tests := []struct { + name string + config Config + wantErr bool + }{ + { + name: "disabled", + wantErr: false, + config: Config{ + Enabled: false, + }, + }, + { + name: "stdout", + wantErr: false, + config: Config{ + Enabled: true, + Exporter: Stdout, + Service: "test", + InstanceID: "s01", + Version: "v0.0.1", + }, + }, + { + name: "OTLP gRPC", + wantErr: false, + config: Config{ + Enabled: true, + Exporter: OTLPgRPC, + Service: "test", + Endpoint: "localhost:4717", + InstanceID: "s01", + Version: "v0.0.1", + }, + }, + { + name: "unknown exporter", + wantErr: true, + config: Config{ + Enabled: true, + Exporter: "unknown", + Service: "test", + Endpoint: "localhost:4717", + InstanceID: "s01", + Version: "v0.0.1", + }, + }, + { + name: "no exporter", + wantErr: true, + config: Config{ + Enabled: true, + Service: "test", + Endpoint: "localhost:4717", + InstanceID: "s01", + Version: "v0.0.1", + }, + }, + { + name: "no service", + wantErr: true, + config: Config{ + Enabled: true, + Exporter: OTLPgRPC, + Endpoint: "localhost:4717", + InstanceID: "s01", + Version: "v0.0.1", + }, + }, + { + name: "no endpoint for grpc", + wantErr: true, + config: Config{ + Enabled: true, + Exporter: OTLPgRPC, + Service: "test", + InstanceID: "s01", + Version: "v0.0.1", + }, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if err := tt.config.validate(); (err != nil) != tt.wantErr { + t.Errorf("Config.validate() error = %v, wantErr %v", err, tt.wantErr) + } + }) + } +} + +func TestConfig_hasChange(t *testing.T) { + tests := []struct { + name string + config Config + other Config + want bool + }{ + { + name: "disabled configs always equal", + want: false, + config: Config{ + Enabled: false, + Exporter: Stdout, + Service: "test", + InstanceID: "s01", + Version: "v1.0.0", + }, + other: Config{ + Enabled: false, + Exporter: OTLPgRPC, + Endpoint: "localhost:4717", + Service: "test", + InstanceID: "s01", + Version: "v1.0.0", + }, + }, + { + name: "enabled", + want: true, + config: Config{ + Enabled: false, + Exporter: OTLPgRPC, + Endpoint: "localhost:4717", + Service: "test", + InstanceID: "s01", + Version: "v1.0.0", + }, + other: Config{ + Enabled: true, + Exporter: OTLPgRPC, + Endpoint: "localhost:4717", + Service: "test", + InstanceID: "s01", + Version: "v1.0.0", + }, + }, + { + name: "disabled", + want: true, + config: Config{ + Enabled: true, + Exporter: OTLPgRPC, + Endpoint: "localhost:4717", + Service: "test", + InstanceID: "s01", + Version: "v1.0.0", + }, + other: Config{ + Enabled: false, + Exporter: OTLPgRPC, + Endpoint: "localhost:4717", + Service: "test", + InstanceID: "s01", + Version: "v1.0.0", + }, + }, + { + name: "do not use endpoint for stdout", + want: false, + config: Config{ + Enabled: true, + Exporter: Stdout, + Endpoint: "localhost:4717", + Service: "test", + InstanceID: "s01", + Version: "v1.0.0", + }, + other: Config{ + Enabled: true, + Exporter: Stdout, + Endpoint: "otherhost:4717", + Service: "test", + InstanceID: "s01", + Version: "v1.0.0", + }, + }, + { + name: "use endpoint for grpc", + want: true, + config: Config{ + Enabled: true, + Exporter: OTLPgRPC, + Endpoint: "localhost:4717", + Service: "test", + InstanceID: "s01", + Version: "v1.0.0", + }, + other: Config{ + Enabled: true, + Exporter: OTLPgRPC, + Endpoint: "otherhost:4717", + Service: "test", + InstanceID: "s01", + Version: "v1.0.0", + }, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if got := tt.config.hasChange(&tt.other); got != tt.want { + t.Errorf("Config.equal() = %v, want %v", got, tt.want) + } + }) + } +} diff --git a/pkg/tracing/propagator.go b/pkg/tracing/propagator.go new file mode 100644 index 0000000..3dabfdc --- /dev/null +++ b/pkg/tracing/propagator.go @@ -0,0 +1,96 @@ +package tracing + +import ( + "context" + "fmt" + "strconv" + + "go.opentelemetry.io/otel/propagation" + "go.opentelemetry.io/otel/trace" +) + +const ( + traceIDHeader = "x-frostfs-trace-id" + spanIDHeader = "x-frostfs-span-id" + flagsHeader = "x-frostfs-trace-flags" +) + +const ( + flagsSampled = 1 << iota +) + +// propagator serializes SpanContext to/from headers. +// x-frostfs-trace-id - TraceID, 16 bytes, hex-string (32 bytes). +// x-frostfs-span-id - SpanID, 8 bytes, hexstring (16 bytes). +// x-frostfs-trace-flags - trace flags (now sampled only). +type propagator struct{} + +// Propagator is propagation.TextMapPropagator instance, used to extract/inject trace info from/to remote context. +var Propagator propagation.TextMapPropagator = &propagator{} + +// Inject injects tracing info to carrier. +func (p *propagator) Inject(ctx context.Context, carrier propagation.TextMapCarrier) { + sc := trace.SpanFromContext(ctx).SpanContext() + if !sc.TraceID().IsValid() || !sc.SpanID().IsValid() { + return + } + + var flags int + if sc.IsSampled() { + flags = flags | flagsSampled + } + + carrier.Set(traceIDHeader, sc.TraceID().String()) + carrier.Set(spanIDHeader, sc.SpanID().String()) + carrier.Set(flagsHeader, fmt.Sprintf("%x", flags)) +} + +// Extract extracts tracing info from carrier and returns context with tracing info. +// In case of error returns ctx. +func (p *propagator) Extract(ctx context.Context, carrier propagation.TextMapCarrier) context.Context { + spanConfig := trace.SpanContextConfig{} + var err error + + traceIDStr := carrier.Get(traceIDHeader) + traceIDDefined := false + if traceIDStr != "" { + traceIDDefined = true + spanConfig.TraceID, err = trace.TraceIDFromHex(traceIDStr) + if err != nil { + return ctx + } + } + + spanIDstr := carrier.Get(spanIDHeader) + spanIDDefined := false + if spanIDstr != "" { + spanIDDefined = true + spanConfig.SpanID, err = trace.SpanIDFromHex(spanIDstr) + if err != nil { + return ctx + } + } + + if traceIDDefined != spanIDDefined { + return ctx //traceID + spanID must be defined OR no traceID and no spanID + } + + flagsStr := carrier.Get(flagsHeader) + if flagsStr != "" { + var v int64 + v, err = strconv.ParseInt(flagsStr, 16, 32) + if err != nil { + return ctx + } + if v&flagsSampled == flagsSampled { + spanConfig.TraceFlags = trace.FlagsSampled + } + } + + return trace.ContextWithRemoteSpanContext(ctx, trace.NewSpanContext(spanConfig)) +} + +// Fields returns the keys whose values are set with Inject. +func (p *propagator) Fields() []string { + return []string{traceIDHeader, spanIDHeader, flagsHeader} +} diff --git a/pkg/tracing/propagator_test.go b/pkg/tracing/propagator_test.go new file mode 100644 index 0000000..fc81e48 --- /dev/null +++ b/pkg/tracing/propagator_test.go @@ -0,0 +1,257 @@ +package tracing + +import ( + "context" + "encoding/hex" + "math/rand" + "testing" + + "github.com/stretchr/testify/require" + "go.opentelemetry.io/otel/trace" +) + +type testCarrier struct { + Values map[string]string +} + +func (c *testCarrier) Get(key string) string { + return c.Values[key] +} + +func (c *testCarrier) Set(key string, value string) { + c.Values[key] = value +} + +func (c *testCarrier) Keys() []string { + res := make([]string, 0, len(c.Values)) + for k := range c.Values { + res = append(res, k) + } + return res +} + +var p = &propagator{} + +func TestPropagator_Inject(t *testing.T) { + t.Run("injects trace_id and span_id if valid", func(t *testing.T) { + traceIDBytes := make([]byte, 16) + rand.Read(traceIDBytes) + traceIDHex := hex.EncodeToString(traceIDBytes) + + spanIDBytes := make([]byte, 8) + rand.Read(spanIDBytes) + spanIDHex := hex.EncodeToString(spanIDBytes) + + spanConfig := trace.SpanContextConfig{} + spanConfig.TraceID, _ = trace.TraceIDFromHex(traceIDHex) + spanConfig.SpanID, _ = trace.SpanIDFromHex(spanIDHex) + spanConfig.TraceFlags = trace.FlagsSampled + + ctx := trace.ContextWithRemoteSpanContext(context.Background(), trace.NewSpanContext(spanConfig)) + c := &testCarrier{ + Values: make(map[string]string), + } + p.Inject(ctx, c) + + require.Equal(t, 3, len(c.Values), "not all headers were saved") + require.Equal(t, traceIDHex, c.Values[traceIDHeader], "unexpected trace id") + require.Equal(t, spanIDHex, c.Values[spanIDHeader], "unexpected span id") + require.Equal(t, "1", c.Values[flagsHeader], "unexpected flags") + }) + t.Run("doesn't injects if trace_id is invalid", func(t *testing.T) { + traceIDBytes := make([]byte, 16) + traceIDHex := hex.EncodeToString(traceIDBytes) + + spanIDBytes := make([]byte, 8) + rand.Read(spanIDBytes) + spanIDHex := hex.EncodeToString(spanIDBytes) + + spanConfig := trace.SpanContextConfig{} + spanConfig.TraceID, _ = trace.TraceIDFromHex(traceIDHex) + spanConfig.SpanID, _ = trace.SpanIDFromHex(spanIDHex) + spanConfig.TraceFlags = trace.FlagsSampled + + ctx := trace.ContextWithRemoteSpanContext(context.Background(), trace.NewSpanContext(spanConfig)) + c := &testCarrier{ + Values: make(map[string]string), + } + p.Inject(ctx, c) + + require.Equal(t, 0, len(c.Values), "some headers were saved") + }) + t.Run("doesn't injects if span_id is invalid", func(t *testing.T) { + traceIDBytes := make([]byte, 16) + rand.Read(traceIDBytes) + traceIDHex := hex.EncodeToString(traceIDBytes) + + spanIDBytes := make([]byte, 8) + spanIDHex := hex.EncodeToString(spanIDBytes) + + spanConfig := trace.SpanContextConfig{} + spanConfig.TraceID, _ = trace.TraceIDFromHex(traceIDHex) + spanConfig.SpanID, _ = trace.SpanIDFromHex(spanIDHex) + spanConfig.TraceFlags = trace.FlagsSampled + + ctx := trace.ContextWithRemoteSpanContext(context.Background(), trace.NewSpanContext(spanConfig)) + c := &testCarrier{ + Values: make(map[string]string), + } + p.Inject(ctx, c) + + require.Equal(t, 0, len(c.Values), "some headers were saved") + }) + t.Run("injects flags if no flags specified", func(t *testing.T) { + traceIDBytes := make([]byte, 16) + rand.Read(traceIDBytes) + traceIDHex := hex.EncodeToString(traceIDBytes) + + spanIDBytes := make([]byte, 8) + rand.Read(spanIDBytes) + spanIDHex := hex.EncodeToString(spanIDBytes) + + spanConfig := trace.SpanContextConfig{} + spanConfig.TraceID, _ = trace.TraceIDFromHex(traceIDHex) + spanConfig.SpanID, _ = trace.SpanIDFromHex(spanIDHex) + + ctx := trace.ContextWithRemoteSpanContext(context.Background(), trace.NewSpanContext(spanConfig)) + c := &testCarrier{ + Values: make(map[string]string), + } + p.Inject(ctx, c) + + require.Equal(t, 3, len(c.Values), "not all headers were saved") + require.Equal(t, traceIDHex, c.Values[traceIDHeader], "unexpected trace id") + require.Equal(t, spanIDHex, c.Values[spanIDHeader], "unexpected span id") + require.Equal(t, "0", c.Values[flagsHeader], "unexpected flags") + }) + +} + +func TestPropagator_Extract(t *testing.T) { + t.Run("extracts if set", func(t *testing.T) { + c := &testCarrier{ + Values: make(map[string]string), + } + + traceIDBytes := make([]byte, 16) + rand.Read(traceIDBytes) + traceIDHex := hex.EncodeToString(traceIDBytes) + c.Values[traceIDHeader] = traceIDHex + + spanIDBytes := make([]byte, 8) + rand.Read(spanIDBytes) + spanIDHex := hex.EncodeToString(spanIDBytes) + c.Values[spanIDHeader] = spanIDHex + + c.Values[flagsHeader] = "1" + + ctx := p.Extract(context.Background(), c) + + sc := trace.SpanFromContext(ctx).SpanContext() + require.True(t, sc.HasTraceID(), "trace_id was not set") + require.Equal(t, traceIDHex, sc.TraceID().String(), "trace_id doesn't match") + require.True(t, sc.HasSpanID(), "span_id was not set") + require.Equal(t, spanIDHex, sc.SpanID().String(), "span_id doesn't match") + require.True(t, sc.IsSampled(), "sampled was not set") + }) + t.Run("not extracts if only trace_id defined", func(t *testing.T) { + c := &testCarrier{ + Values: make(map[string]string), + } + + traceIDBytes := make([]byte, 16) + rand.Read(traceIDBytes) + traceIDHex := hex.EncodeToString(traceIDBytes) + c.Values[traceIDHeader] = traceIDHex + c.Values[flagsHeader] = "1" + + ctx := p.Extract(context.Background(), c) + + sc := trace.SpanFromContext(ctx).SpanContext() + require.False(t, sc.HasTraceID(), "trace_id was set") + require.False(t, sc.HasSpanID(), "span_id was set") + require.False(t, sc.IsSampled(), "sampled was set") + }) + t.Run("not extracts if only span_id defined", func(t *testing.T) { + c := &testCarrier{ + Values: make(map[string]string), + } + + spanIDBytes := make([]byte, 8) + rand.Read(spanIDBytes) + spanIDHex := hex.EncodeToString(spanIDBytes) + c.Values[spanIDHeader] = spanIDHex + c.Values[flagsHeader] = "1" + + ctx := p.Extract(context.Background(), c) + + sc := trace.SpanFromContext(ctx).SpanContext() + require.False(t, sc.HasTraceID(), "trace_id was set") + require.False(t, sc.HasSpanID(), "span_id was set") + require.False(t, sc.IsSampled(), "sampled was set") + }) + t.Run("not extracts if trace_id is in invalid", func(t *testing.T) { + c := &testCarrier{ + Values: make(map[string]string), + } + + c.Values[traceIDHeader] = "loren ipsum" + + spanIDBytes := make([]byte, 8) + rand.Read(spanIDBytes) + spanIDHex := hex.EncodeToString(spanIDBytes) + c.Values[spanIDHeader] = spanIDHex + c.Values[flagsHeader] = "1" + + ctx := p.Extract(context.Background(), c) + + sc := trace.SpanFromContext(ctx).SpanContext() + require.False(t, sc.HasTraceID(), "trace_id was set") + require.False(t, sc.HasSpanID(), "span_id was set") + require.False(t, sc.IsSampled(), "sampled was set") + }) + t.Run("not extracts if span_id is invalid", func(t *testing.T) { + c := &testCarrier{ + Values: make(map[string]string), + } + + c.Values[spanIDHeader] = "loren ipsum" + + traceIDBytes := make([]byte, 16) + rand.Read(traceIDBytes) + traceIDHex := hex.EncodeToString(traceIDBytes) + c.Values[traceIDHeader] = traceIDHex + c.Values[flagsHeader] = "1" + + ctx := p.Extract(context.Background(), c) + + sc := trace.SpanFromContext(ctx).SpanContext() + require.False(t, sc.HasTraceID(), "trace_id was set") + require.False(t, sc.HasSpanID(), "span_id was set") + require.False(t, sc.IsSampled(), "sampled was set") + }) + t.Run("not extracts if flags is invalid", func(t *testing.T) { + c := &testCarrier{ + Values: make(map[string]string), + } + + traceIDBytes := make([]byte, 16) + rand.Read(traceIDBytes) + traceIDHex := hex.EncodeToString(traceIDBytes) + c.Values[traceIDHeader] = traceIDHex + + spanIDBytes := make([]byte, 8) + rand.Read(spanIDBytes) + spanIDHex := hex.EncodeToString(spanIDBytes) + c.Values[spanIDHeader] = spanIDHex + + c.Values[flagsHeader] = "loren ipsum" + + ctx := p.Extract(context.Background(), c) + + sc := trace.SpanFromContext(ctx).SpanContext() + require.False(t, sc.HasTraceID(), "trace_id was set") + require.False(t, sc.HasSpanID(), "span_id was set") + require.False(t, sc.IsSampled(), "sampled was set") + }) +} diff --git a/pkg/tracing/setup.go b/pkg/tracing/setup.go new file mode 100644 index 0000000..3df069e --- /dev/null +++ b/pkg/tracing/setup.go @@ -0,0 +1,156 @@ +package tracing + +import ( + "context" + "fmt" + "sync" + "sync/atomic" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc" + "go.opentelemetry.io/otel/exporters/stdout/stdouttrace" + "go.opentelemetry.io/otel/sdk/resource" + sdktrace "go.opentelemetry.io/otel/sdk/trace" + semconv "go.opentelemetry.io/otel/semconv/v1.17.0" + "go.opentelemetry.io/otel/trace" +) + +var ( + // tracingLock protects provider, done, config and tracer from concurrent update. + // These fields change when the config is updated or the application is shutdown. + tracingLock = &sync.Mutex{} + + provider *sdktrace.TracerProvider + done bool + + config = Config{} + tracer = getDefaultTracer() +) + +// Setup initializes global tracer. +// Returns true if global tracer was updated. +// Shutdown method must be called for graceful shutdown. +func Setup(ctx context.Context, cfg Config) (bool, error) { + if err := cfg.validate(); err != nil { + return false, err + } + + tracingLock.Lock() + defer tracingLock.Unlock() + + if done { + return false, fmt.Errorf("failed to setup tracing: already shutdown") + } + + if !config.hasChange(&cfg) { + return false, nil + } + + if !cfg.Enabled { + config = cfg + tracer.Store(&tracerHolder{Tracer: trace.NewNoopTracerProvider().Tracer("")}) + return true, flushAndShutdown(ctx) + } + + exp, err := getExporter(ctx, &cfg) + if err != nil { + return false, err + } + + prevProvider := provider + + provider = sdktrace.NewTracerProvider( + sdktrace.WithBatcher(exp), + sdktrace.WithResource(newResource(&cfg)), + ) + + config = cfg + tracer.Store(&tracerHolder{Tracer: provider.Tracer(cfg.Service)}) + + var retErr error + if prevProvider != nil { + retErr = prevProvider.ForceFlush(ctx) + if err := prevProvider.Shutdown(ctx); err != nil { + if retErr == nil { + retErr = err + } else { + retErr = fmt.Errorf("%v ; %v", retErr, err) + } + } + } + + return true, retErr +} + +// Shutdown shutdowns tracing. +func Shutdown(ctx context.Context) error { + tracingLock.Lock() + defer tracingLock.Unlock() + + if done { + return nil + } + + done = true + + config = Config{} + tracer.Store(&tracerHolder{Tracer: trace.NewNoopTracerProvider().Tracer("")}) + + return flushAndShutdown(ctx) +} + +func getDefaultTracer() *atomic.Value { + v := &atomic.Value{} + v.Store(&tracerHolder{Tracer: trace.NewNoopTracerProvider().Tracer("")}) + return v +} + +func flushAndShutdown(ctx context.Context) error { + if provider == nil { + return nil + } + + tmp := provider + provider = nil + var retErr error + retErr = tmp.ForceFlush(ctx) + if err := tmp.Shutdown(ctx); err != nil { + if retErr == nil { + retErr = err + } else { + retErr = fmt.Errorf("%v ; %v", retErr, err) + } + } + return retErr +} + +func getExporter(ctx context.Context, cfg *Config) (sdktrace.SpanExporter, error) { + switch cfg.Exporter { + default: + return nil, fmt.Errorf("failed to setup tracing: unknown tracing exporter (%s)", cfg.Exporter) + case Stdout: + return stdouttrace.New() + case OTLPgRPC: + return otlptracegrpc.New(ctx, otlptracegrpc.WithEndpoint(cfg.Endpoint), otlptracegrpc.WithInsecure()) + } +} + +func newResource(cfg *Config) *resource.Resource { + attrs := []attribute.KeyValue{ + semconv.ServiceName(cfg.Service), + } + if len(cfg.Version) > 0 { + attrs = append(attrs, semconv.ServiceVersion(cfg.Version)) + } + if len(cfg.InstanceID) > 0 { + attrs = append(attrs, semconv.ServiceInstanceID(cfg.InstanceID)) + } + return resource.NewWithAttributes( + semconv.SchemaURL, + attrs..., + ) +} + +type tracerHolder struct { + Tracer trace.Tracer +} diff --git a/pkg/tracing/span.go b/pkg/tracing/span.go new file mode 100644 index 0000000..5e28c75 --- /dev/null +++ b/pkg/tracing/span.go @@ -0,0 +1,12 @@ +package tracing + +import ( + "context" + + "go.opentelemetry.io/otel/trace" +) + +// StartSpanFromContext creates a span and a context.Context containing the newly-created span. +func StartSpanFromContext(ctx context.Context, operationName string, opts ...trace.SpanStartOption) (context.Context, trace.Span) { + return tracer.Load().(*tracerHolder).Tracer.Start(ctx, operationName, opts...) +} From 488ee50f9e6968aa7e23a195de1a89492857a66c Mon Sep 17 00:00:00 2001 From: Dmitrii Stepanov Date: Fri, 17 Mar 2023 15:54:33 +0300 Subject: [PATCH 1050/1196] [#12] tracing: Add gRPC middleware Signed-off-by: Dmitrii Stepanov --- pkg/tracing/grpc.go | 136 ++++++++++++++++++++++++++++++ pkg/tracing/grpc_internal.go | 159 +++++++++++++++++++++++++++++++++++ rpc/client/client.go | 10 +++ 3 files changed, 305 insertions(+) create mode 100644 pkg/tracing/grpc.go create mode 100644 pkg/tracing/grpc_internal.go diff --git a/pkg/tracing/grpc.go b/pkg/tracing/grpc.go new file mode 100644 index 0000000..cea59b0 --- /dev/null +++ b/pkg/tracing/grpc.go @@ -0,0 +1,136 @@ +package tracing + +import ( + "context" + "io" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/codes" + semconv "go.opentelemetry.io/otel/semconv/v1.17.0" + "go.opentelemetry.io/otel/trace" + "google.golang.org/grpc" + grpc_codes "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +// NewGRPCUnaryClientInteceptor creates new gRPC unary interceptor to save gRPC client traces. +func NewGRPCUnaryClientInteceptor() grpc.UnaryClientInterceptor { + return func(ctx context.Context, method string, req, reply interface{}, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error { + ctx, span := startClientSpan(ctx, cc, method) + defer span.End() + + err := invoker(ctx, method, req, reply, cc, opts...) + if err != nil { + grpcStatus, _ := status.FromError(err) + span.SetStatus(codes.Error, grpcStatus.Message()) + span.SetAttributes(semconv.RPCGRPCStatusCodeKey.Int64(int64(grpcStatus.Code()))) + } else { + span.SetStatus(codes.Ok, "") + span.SetAttributes(semconv.RPCGRPCStatusCodeKey.Int64(int64(grpc_codes.OK))) + } + + return err + } +} + +// NewGRPCStreamClientInterceptor creates new gRPC stream interceptor to save gRPC client traces. +func NewGRPCStreamClientInterceptor() grpc.StreamClientInterceptor { + return func(ctx context.Context, desc *grpc.StreamDesc, cc *grpc.ClientConn, method string, streamer grpc.Streamer, opts ...grpc.CallOption) (grpc.ClientStream, error) { + ctx, span := startClientSpan(ctx, cc, method) + str, err := streamer(ctx, desc, cc, method, opts...) + if err != nil { + grpcStatus, _ := status.FromError(err) + span.SetStatus(codes.Error, grpcStatus.Message()) + span.SetAttributes(semconv.RPCGRPCStatusCodeKey.Int64(int64(grpcStatus.Code()))) + span.End() + return str, err + } + + finished := make(chan error) + done := make(chan struct{}) + strWrp := newgRPCClientStream(str, desc, finished, done) + + go func() { + defer close(finished) + defer close(done) + defer span.End() + + select { + case err := <-finished: + if err == nil || err == io.EOF { + setGRPCSpanStatus(span, nil) + } else { + setGRPCSpanStatus(span, err) + } + return + case <-ctx.Done(): + setGRPCSpanStatus(span, ctx.Err()) + return + } + }() + + return strWrp, nil + } +} + +// NewGRPCUnaryServerInterceptor creates new gRPC unary interceptor to save gRPC server traces. +func NewGRPCUnaryServerInterceptor() grpc.UnaryServerInterceptor { + return func(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (resp interface{}, err error) { + ctx = extractGRPCTraceInfo(ctx) + var span trace.Span + ctx, span = StartSpanFromContext(ctx, info.FullMethod, + trace.WithAttributes( + semconv.RPCSystemGRPC, + semconv.RPCMethod(info.FullMethod), + ), + trace.WithSpanKind(trace.SpanKindServer)) + defer span.End() + + resp, err = handler(ctx, req) + + setGRPCSpanStatus(span, err) + return + } +} + +// NewGRPCStreamServerInterceptor creates new gRPC stream interceptor to save gRPC server traces. +func NewGRPCStreamServerInterceptor() grpc.StreamServerInterceptor { + return func(srv interface{}, ss grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error { + ctx := extractGRPCTraceInfo(ss.Context()) + var span trace.Span + ctx, span = StartSpanFromContext(ctx, info.FullMethod, + trace.WithAttributes( + semconv.RPCSystemGRPC, + semconv.RPCMethod(info.FullMethod), + ), + trace.WithSpanKind(trace.SpanKindServer)) + defer span.End() + + err := handler(srv, newgRPCServerStream(ctx, ss)) + + setGRPCSpanStatus(span, err) + return err + } +} + +func startClientSpan(ctx context.Context, cc *grpc.ClientConn, method string) (context.Context, trace.Span) { + ctx, span := StartSpanFromContext(ctx, method, trace.WithAttributes( + semconv.RPCSystemGRPC, + semconv.RPCMethod(method), + attribute.String("rpc.grpc.target", cc.Target())), + trace.WithSpanKind(trace.SpanKindClient), + ) + ctx = setGRPCTraceInfo(ctx) + return ctx, span +} + +func setGRPCSpanStatus(span trace.Span, err error) { + if err != nil { + grpcStatus, _ := status.FromError(err) + span.SetStatus(codes.Error, grpcStatus.Message()) + span.SetAttributes(semconv.RPCGRPCStatusCodeKey.Int64(int64(grpcStatus.Code()))) + } else { + span.SetStatus(codes.Ok, "") + span.SetAttributes(semconv.RPCGRPCStatusCodeKey.Int64(int64(grpc_codes.OK))) + } +} diff --git a/pkg/tracing/grpc_internal.go b/pkg/tracing/grpc_internal.go new file mode 100644 index 0000000..25cf026 --- /dev/null +++ b/pkg/tracing/grpc_internal.go @@ -0,0 +1,159 @@ +package tracing + +import ( + "context" + + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" +) + +type grpcMetadataCarrier struct { + md *metadata.MD +} + +func (c *grpcMetadataCarrier) Get(key string) string { + values := c.md.Get(key) + if len(values) > 0 { + return values[0] + } + return "" +} + +func (c *grpcMetadataCarrier) Set(key string, value string) { + c.md.Set(key, value) +} + +func (c *grpcMetadataCarrier) Keys() []string { + result := make([]string, 0, c.md.Len()) + for key := range *c.md { + result = append(result, key) + } + return result +} + +func extractGRPCTraceInfo(ctx context.Context) context.Context { + md, ok := metadata.FromIncomingContext(ctx) + if !ok { + return ctx + } + carrier := &grpcMetadataCarrier{ + md: &md, + } + return Propagator.Extract(ctx, carrier) +} + +func setGRPCTraceInfo(ctx context.Context) context.Context { + md, ok := metadata.FromOutgoingContext(ctx) + if !ok { + md = metadata.MD{} + } + carrier := &grpcMetadataCarrier{ + md: &md, + } + Propagator.Inject(ctx, carrier) + return metadata.NewOutgoingContext(ctx, md) +} + +type clientStream struct { + originalStream grpc.ClientStream + desc *grpc.StreamDesc + finished chan<- error + done <-chan struct{} +} + +func newgRPCClientStream(originalStream grpc.ClientStream, desc *grpc.StreamDesc, finished chan<- error, done <-chan struct{}) grpc.ClientStream { + return &clientStream{ + originalStream: originalStream, + desc: desc, + finished: finished, + done: done, + } +} + +func (cs *clientStream) Header() (metadata.MD, error) { + md, err := cs.originalStream.Header() + if err != nil { + select { + case <-cs.done: + case cs.finished <- err: + } + } + return md, err +} + +func (cs *clientStream) Trailer() metadata.MD { + return cs.originalStream.Trailer() +} + +func (cs *clientStream) CloseSend() error { + err := cs.originalStream.CloseSend() + if err != nil { + select { + case <-cs.done: + case cs.finished <- err: + } + } + return err +} + +func (cs *clientStream) Context() context.Context { + return cs.originalStream.Context() +} + +func (cs *clientStream) SendMsg(m interface{}) error { + err := cs.originalStream.SendMsg(m) + if err != nil { + select { + case <-cs.done: + case cs.finished <- err: + } + } + return err +} + +func (cs *clientStream) RecvMsg(m interface{}) error { + err := cs.originalStream.RecvMsg(m) + if err != nil || !cs.desc.ServerStreams { + select { + case <-cs.done: + case cs.finished <- err: + } + } + return err +} + +type serverStream struct { + originalStream grpc.ServerStream + ctx context.Context +} + +func newgRPCServerStream(ctx context.Context, originalStream grpc.ServerStream) grpc.ServerStream { + return &serverStream{ + originalStream: originalStream, + ctx: ctx, + } +} + +func (ss *serverStream) SetHeader(md metadata.MD) error { + return ss.originalStream.SendHeader(md) +} + +func (ss *serverStream) SendHeader(md metadata.MD) error { + return ss.originalStream.SendHeader(md) +} + +func (ss *serverStream) SetTrailer(md metadata.MD) { + ss.originalStream.SetTrailer(md) +} + +func (ss *serverStream) Context() context.Context { + return ss.ctx +} + +func (ss *serverStream) SendMsg(m interface{}) error { + return ss.originalStream.SendMsg(m) +} + +func (ss *serverStream) RecvMsg(m interface{}) error { + return ss.originalStream.RecvMsg(m) +} diff --git a/rpc/client/client.go b/rpc/client/client.go index 7e914db..4d12849 100644 --- a/rpc/client/client.go +++ b/rpc/client/client.go @@ -1,6 +1,7 @@ package client import ( + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/pkg/tracing" "google.golang.org/grpc" "google.golang.org/grpc/credentials" ) @@ -24,5 +25,14 @@ func New(opts ...Option) *Client { c.grpcDialOpts = append(c.grpcDialOpts, grpc.WithTransportCredentials(credentials.NewTLS(c.tlsCfg))) } + c.grpcDialOpts = append(c.grpcDialOpts, + grpc.WithChainUnaryInterceptor( + tracing.NewGRPCUnaryClientInteceptor(), + ), + grpc.WithChainStreamInterceptor( + tracing.NewGRPCStreamClientInterceptor(), + ), + ) + return &c } From a4e361a2e68ccbb8fbd523dacbaafad83f2ddea1 Mon Sep 17 00:00:00 2001 From: Dmitrii Stepanov Date: Fri, 17 Mar 2023 15:55:12 +0300 Subject: [PATCH 1051/1196] [#12] changelog: Add info about tracing Signed-off-by: Dmitrii Stepanov --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3b31e83..da58198 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## [Unreleased] ### Added +- Basic tracing support (#12) ### Fixed ### Changed ### Updated From d9c5b9c90ee2676fbde9a0dbc065561e14669629 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Tue, 11 Apr 2023 10:35:10 +0300 Subject: [PATCH 1052/1196] Revert "[#16] container, object: Regenerate service comments" This reverts commit e6522d62a8795766bf1a8526df190a1e86fd6309. --- container/grpc/service_grpc.pb.go | 108 +++--- object/grpc/service_grpc.pb.go | 530 +++++++++++++++--------------- 2 files changed, 320 insertions(+), 318 deletions(-) diff --git a/container/grpc/service_grpc.pb.go b/container/grpc/service_grpc.pb.go index 1de8b5f..3af498b 100644 --- a/container/grpc/service_grpc.pb.go +++ b/container/grpc/service_grpc.pb.go @@ -28,9 +28,9 @@ type ContainerServiceClient interface { // 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). + // - **OK** (0, SECTION_SUCCESS): \ + // request to save the container has been sent to the sidechain; + // - Common failures (SECTION_FAILURE_COMMON). 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 @@ -38,53 +38,53 @@ type ContainerServiceClient interface { // 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). + // - **OK** (0, SECTION_SUCCESS): \ + // request to remove the container has been sent to the sidechain; + // - Common failures (SECTION_FAILURE_COMMON). 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. + // - **OK** (0, SECTION_SUCCESS): \ + // container has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON); + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // requested container not found. Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*GetResponse, error) // 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). + // - **OK** (0, SECTION_SUCCESS): \ + // container list has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON). List(ctx context.Context, in *ListRequest, opts ...grpc.CallOption) (*ListResponse, error) // Invokes 'SetEACL' method of 'Container` smart contract and returns response // immediately. After one more block in sidechain, changes in an Extended ACL are // added into smart contract storage. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // request to save container eACL has been sent to the sidechain; - // - Common failures (SECTION_FAILURE_COMMON). + // - **OK** (0, SECTION_SUCCESS): \ + // request to save container eACL has been sent to the sidechain; + // - Common failures (SECTION_FAILURE_COMMON). SetExtendedACL(ctx context.Context, in *SetExtendedACLRequest, opts ...grpc.CallOption) (*SetExtendedACLResponse, error) // Returns Extended ACL table and signature from `Container` smart contract // storage. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // container eACL has been successfully read; - // - Common failures (SECTION_FAILURE_COMMON); - // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ - // container not found; - // - **EACL_NOT_FOUND** (3073, SECTION_CONTAINER): \ - // eACL table not found. + // - **OK** (0, SECTION_SUCCESS): \ + // container eACL has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON); + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // container not found; + // - **EACL_NOT_FOUND** (3073, SECTION_CONTAINER): \ + // eACL table not found. GetExtendedACL(ctx context.Context, in *GetExtendedACLRequest, opts ...grpc.CallOption) (*GetExtendedACLResponse, error) // Announces the space values used by the container for P2P synchronization. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // estimation of used space has been successfully announced; - // - Common failures (SECTION_FAILURE_COMMON). + // - **OK** (0, SECTION_SUCCESS): \ + // estimation of used space has been successfully announced; + // - Common failures (SECTION_FAILURE_COMMON). AnnounceUsedSpace(ctx context.Context, in *AnnounceUsedSpaceRequest, opts ...grpc.CallOption) (*AnnounceUsedSpaceResponse, error) } @@ -169,9 +169,9 @@ type ContainerServiceServer interface { // 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). + // - **OK** (0, SECTION_SUCCESS): \ + // request to save the container has been sent to the sidechain; + // - Common failures (SECTION_FAILURE_COMMON). 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 @@ -179,53 +179,53 @@ type ContainerServiceServer interface { // 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). + // - **OK** (0, SECTION_SUCCESS): \ + // request to remove the container has been sent to the sidechain; + // - Common failures (SECTION_FAILURE_COMMON). 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. + // - **OK** (0, SECTION_SUCCESS): \ + // container has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON); + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // requested container not found. Get(context.Context, *GetRequest) (*GetResponse, error) // 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). + // - **OK** (0, SECTION_SUCCESS): \ + // container list has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON). List(context.Context, *ListRequest) (*ListResponse, error) // Invokes 'SetEACL' method of 'Container` smart contract and returns response // immediately. After one more block in sidechain, changes in an Extended ACL are // added into smart contract storage. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // request to save container eACL has been sent to the sidechain; - // - Common failures (SECTION_FAILURE_COMMON). + // - **OK** (0, SECTION_SUCCESS): \ + // request to save container eACL has been sent to the sidechain; + // - Common failures (SECTION_FAILURE_COMMON). SetExtendedACL(context.Context, *SetExtendedACLRequest) (*SetExtendedACLResponse, error) // Returns Extended ACL table and signature from `Container` smart contract // storage. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // container eACL has been successfully read; - // - Common failures (SECTION_FAILURE_COMMON); - // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ - // container not found; - // - **EACL_NOT_FOUND** (3073, SECTION_CONTAINER): \ - // eACL table not found. + // - **OK** (0, SECTION_SUCCESS): \ + // container eACL has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON); + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // container not found; + // - **EACL_NOT_FOUND** (3073, SECTION_CONTAINER): \ + // eACL table not found. GetExtendedACL(context.Context, *GetExtendedACLRequest) (*GetExtendedACLResponse, error) // Announces the space values used by the container for P2P synchronization. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // estimation of used space has been successfully announced; - // - Common failures (SECTION_FAILURE_COMMON). + // - **OK** (0, SECTION_SUCCESS): \ + // estimation of used space has been successfully announced; + // - Common failures (SECTION_FAILURE_COMMON). AnnounceUsedSpace(context.Context, *AnnounceUsedSpaceRequest) (*AnnounceUsedSpaceResponse, error) } diff --git a/object/grpc/service_grpc.pb.go b/object/grpc/service_grpc.pb.go index 6b1c32a..23906d6 100644 --- a/object/grpc/service_grpc.pb.go +++ b/object/grpc/service_grpc.pb.go @@ -30,32 +30,32 @@ type ObjectServiceClient interface { // keeping the receiving order. // // Extended headers can change `Get` behaviour: - // * [ __SYSTEM__NETMAP_EPOCH ] \ - // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ - // Will use the requsted version of Network Map for object placement - // calculation. - // * [ __SYSTEM__NETMAP_LOOKUP_DEPTH ] \ - // (`__NEOFS__NETMAP_LOOKUP_DEPTH` is deprecated) \ - // Will try older versions (starting from `__SYSTEM__NETMAP_EPOCH` (`__NEOFS__NETMAP_EPOCH` is deprecated) if specified or - // the latest one otherwise) of Network Map to find an object until the depth - // limit is reached. + // - [ __SYSTEM__NETMAP_EPOCH ] \ + // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ + // Will use the requsted version of Network Map for object placement + // calculation. + // - [ __SYSTEM__NETMAP_LOOKUP_DEPTH ] \ + // (`__NEOFS__NETMAP_LOOKUP_DEPTH` is deprecated) \ + // Will try older versions (starting from `__SYSTEM__NETMAP_EPOCH` (`__NEOFS__NETMAP_EPOCH` is deprecated) if specified or + // the latest one otherwise) of Network Map to find an object until the depth + // limit is reached. // // Please refer to detailed `XHeader` description. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // object has been successfully read; - // - Common failures (SECTION_FAILURE_COMMON); - // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ - // read access to the object is denied; - // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ - // object not found in container; - // - **OBJECT_ALREADY_REMOVED** (2052, SECTION_OBJECT): \ - // the requested object has been marked as deleted; - // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ - // object container not found; - // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ - // provided session token has expired. + // - **OK** (0, SECTION_SUCCESS): \ + // object has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON); + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // read access to the object is denied; + // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ + // object not found in container; + // - **OBJECT_ALREADY_REMOVED** (2052, SECTION_OBJECT): \ + // the requested object has been marked as deleted; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // object container not found; + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (ObjectService_GetClient, error) // Put the object into container. Request uses gRPC stream. First message // SHOULD be of PutHeader type. `ContainerID` and `OwnerID` of an object @@ -65,106 +65,107 @@ type ObjectServiceClient interface { // Chunk messages SHOULD be sent in the direct order of fragmentation. // // Extended headers can change `Put` behaviour: - // * [ __SYSTEM__NETMAP_EPOCH \ - // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ - // Will use the requsted version of Network Map for object placement - // calculation. + // - [ __SYSTEM__NETMAP_EPOCH \ + // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ + // Will use the requsted version of Network Map for object placement + // calculation. // // Please refer to detailed `XHeader` description. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // object has been successfully saved in the container; - // - Common failures (SECTION_FAILURE_COMMON); - // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ - // write access to the container is denied; - // - **LOCKED** (2050, SECTION_OBJECT): \ - // placement of an object of type TOMBSTONE that includes at least one locked - // object is prohibited; - // - **LOCK_NON_REGULAR_OBJECT** (2051, SECTION_OBJECT): \ - // placement of an object of type LOCK that includes at least one object of - // type other than REGULAR is prohibited; - // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ - // object storage container not found; - // - **TOKEN_NOT_FOUND** (4096, SECTION_SESSION): \ - // (for trusted object preparation) session private key does not exist or has + // - **OK** (0, SECTION_SUCCESS): \ + // object has been successfully saved in the container; + // - Common failures (SECTION_FAILURE_COMMON); + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // write access to the container is denied; + // - **LOCKED** (2050, SECTION_OBJECT): \ + // placement of an object of type TOMBSTONE that includes at least one locked + // object is prohibited; + // - **LOCK_NON_REGULAR_OBJECT** (2051, SECTION_OBJECT): \ + // placement of an object of type LOCK that includes at least one object of + // type other than REGULAR is prohibited; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // object storage container not found; + // - **TOKEN_NOT_FOUND** (4096, SECTION_SESSION): \ + // (for trusted object preparation) session private key does not exist or has + // // been deleted; - // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ - // provided session token has expired. + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. Put(ctx context.Context, opts ...grpc.CallOption) (ObjectService_PutClient, error) // Delete the object from a container. There is no immediate removal // guarantee. Object will be marked for removal and deleted eventually. // // Extended headers can change `Delete` behaviour: - // * [ __SYSTEM__NETMAP_EPOCH ] \ - // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ - // Will use the requested version of Network Map for object placement - // calculation. + // - [ __SYSTEM__NETMAP_EPOCH ] \ + // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ + // Will use the requested version of Network Map for object placement + // calculation. // // Please refer to detailed `XHeader` description. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // object has been successfully marked to be removed from the container; - // - Common failures (SECTION_FAILURE_COMMON); - // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ - // delete access to the object is denied; - // - **LOCKED** (2050, SECTION_OBJECT): \ - // deleting a locked object is prohibited; - // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ - // object container not found; - // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ - // provided session token has expired. + // - **OK** (0, SECTION_SUCCESS): \ + // object has been successfully marked to be removed from the container; + // - Common failures (SECTION_FAILURE_COMMON); + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // delete access to the object is denied; + // - **LOCKED** (2050, SECTION_OBJECT): \ + // deleting a locked object is prohibited; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // object container not found; + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteResponse, error) // Returns the object Headers without data payload. By default full header is // returned. If `main_only` request field is set, the short header with only // the very minimal information will be returned instead. // // Extended headers can change `Head` behaviour: - // * [ __SYSTEM__NETMAP_EPOCH ] \ - // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ - // Will use the requested version of Network Map for object placement - // calculation. + // - [ __SYSTEM__NETMAP_EPOCH ] \ + // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ + // Will use the requested version of Network Map for object placement + // calculation. // // Please refer to detailed `XHeader` description. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // object header has been successfully read; - // - Common failures (SECTION_FAILURE_COMMON); - // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ - // access to operation HEAD of the object is denied; - // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ - // object not found in container; - // - **OBJECT_ALREADY_REMOVED** (2052, SECTION_OBJECT): \ - // the requested object has been marked as deleted; - // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ - // object container not found; - // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ - // provided session token has expired. + // - **OK** (0, SECTION_SUCCESS): \ + // object header has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON); + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // access to operation HEAD of the object is denied; + // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ + // object not found in container; + // - **OBJECT_ALREADY_REMOVED** (2052, SECTION_OBJECT): \ + // the requested object has been marked as deleted; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // object container not found; + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. Head(ctx context.Context, in *HeadRequest, opts ...grpc.CallOption) (*HeadResponse, error) // Search objects in container. Search query allows to match by Object // Header's filed values. Please see the corresponding NeoFS Technical // Specification section for more details. // // Extended headers can change `Search` behaviour: - // * [ __SYSTEM__NETMAP_EPOCH ] \ - // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ - // Will use the requested version of Network Map for object placement - // calculation. + // - [ __SYSTEM__NETMAP_EPOCH ] \ + // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ + // Will use the requested version of Network Map for object placement + // calculation. // // Please refer to detailed `XHeader` description. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // objects have been successfully selected; - // - Common failures (SECTION_FAILURE_COMMON); - // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ - // access to operation SEARCH of the object is denied; - // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ - // search container not found; - // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ - // provided session token has expired. + // - **OK** (0, SECTION_SUCCESS): \ + // objects have been successfully selected; + // - Common failures (SECTION_FAILURE_COMMON); + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // access to operation SEARCH of the object is denied; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // search container not found; + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. Search(ctx context.Context, in *SearchRequest, opts ...grpc.CallOption) (ObjectService_SearchClient, error) // Get byte range of data payload. Range is set as an (offset, length) tuple. // Like in `Get` method, the response uses gRPC stream. Requested range can be @@ -172,33 +173,33 @@ type ObjectServiceClient interface { // order. // // Extended headers can change `GetRange` behaviour: - // * [ __SYSTEM__NETMAP_EPOCH ] \ - // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ - // Will use the requested version of Network Map for object placement - // calculation. - // * [ __SYSTEM__NETMAP_LOOKUP_DEPTH ] \ - // (`__NEOFS__NETMAP_LOOKUP_DEPTH` is deprecated) \ - // Will try older versions of Network Map to find an object until the depth - // limit is reached. + // - [ __SYSTEM__NETMAP_EPOCH ] \ + // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ + // Will use the requested version of Network Map for object placement + // calculation. + // - [ __SYSTEM__NETMAP_LOOKUP_DEPTH ] \ + // (`__NEOFS__NETMAP_LOOKUP_DEPTH` is deprecated) \ + // Will try older versions of Network Map to find an object until the depth + // limit is reached. // // Please refer to detailed `XHeader` description. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // data range of the object payload has been successfully read; - // - Common failures (SECTION_FAILURE_COMMON); - // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ - // access to operation RANGE of the object is denied; - // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ - // object not found in container; - // - **OBJECT_ALREADY_REMOVED** (2052, SECTION_OBJECT): \ - // the requested object has been marked as deleted. - // - **OUT_OF_RANGE** (2053, SECTION_OBJECT): \ - // the requested range is out of bounds; - // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ - // object container not found; - // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ - // provided session token has expired. + // - **OK** (0, SECTION_SUCCESS): \ + // data range of the object payload has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON); + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // access to operation RANGE of the object is denied; + // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ + // object not found in container; + // - **OBJECT_ALREADY_REMOVED** (2052, SECTION_OBJECT): \ + // the requested object has been marked as deleted. + // - **OUT_OF_RANGE** (2053, SECTION_OBJECT): \ + // the requested range is out of bounds; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // object container not found; + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. GetRange(ctx context.Context, in *GetRangeRequest, opts ...grpc.CallOption) (ObjectService_GetRangeClient, error) // Returns homomorphic or regular hash of object's payload range after // applying XOR operation with the provided `salt`. Ranges are set of (offset, @@ -206,31 +207,31 @@ type ObjectServiceClient interface { // the request. Note that hash is calculated for XORed data. // // Extended headers can change `GetRangeHash` behaviour: - // * [ __SYSTEM__NETMAP_EPOCH ] \ - // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ - // Will use the requested version of Network Map for object placement - // calculation. - // * [ __SYSTEM__NETMAP_LOOKUP_DEPTH ] \ - // (`__NEOFS__NETMAP_LOOKUP_DEPTH` is deprecated) \ - // Will try older versions of Network Map to find an object until the depth - // limit is reached. + // - [ __SYSTEM__NETMAP_EPOCH ] \ + // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ + // Will use the requested version of Network Map for object placement + // calculation. + // - [ __SYSTEM__NETMAP_LOOKUP_DEPTH ] \ + // (`__NEOFS__NETMAP_LOOKUP_DEPTH` is deprecated) \ + // Will try older versions of Network Map to find an object until the depth + // limit is reached. // // Please refer to detailed `XHeader` description. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // data range of the object payload has been successfully hashed; - // - Common failures (SECTION_FAILURE_COMMON); - // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ - // access to operation RANGEHASH of the object is denied; - // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ - // object not found in container; - // - **OUT_OF_RANGE** (2053, SECTION_OBJECT): \ - // the requested range is out of bounds; - // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ - // object container not found; - // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ - // provided session token has expired. + // - **OK** (0, SECTION_SUCCESS): \ + // data range of the object payload has been successfully hashed; + // - Common failures (SECTION_FAILURE_COMMON); + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // access to operation RANGEHASH of the object is denied; + // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ + // object not found in container; + // - **OUT_OF_RANGE** (2053, SECTION_OBJECT): \ + // the requested range is out of bounds; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // object container not found; + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. GetRangeHash(ctx context.Context, in *GetRangeHashRequest, opts ...grpc.CallOption) (*GetRangeHashResponse, error) } @@ -411,32 +412,32 @@ type ObjectServiceServer interface { // keeping the receiving order. // // Extended headers can change `Get` behaviour: - // * [ __SYSTEM__NETMAP_EPOCH ] \ - // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ - // Will use the requsted version of Network Map for object placement - // calculation. - // * [ __SYSTEM__NETMAP_LOOKUP_DEPTH ] \ - // (`__NEOFS__NETMAP_LOOKUP_DEPTH` is deprecated) \ - // Will try older versions (starting from `__SYSTEM__NETMAP_EPOCH` (`__NEOFS__NETMAP_EPOCH` is deprecated) if specified or - // the latest one otherwise) of Network Map to find an object until the depth - // limit is reached. + // - [ __SYSTEM__NETMAP_EPOCH ] \ + // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ + // Will use the requsted version of Network Map for object placement + // calculation. + // - [ __SYSTEM__NETMAP_LOOKUP_DEPTH ] \ + // (`__NEOFS__NETMAP_LOOKUP_DEPTH` is deprecated) \ + // Will try older versions (starting from `__SYSTEM__NETMAP_EPOCH` (`__NEOFS__NETMAP_EPOCH` is deprecated) if specified or + // the latest one otherwise) of Network Map to find an object until the depth + // limit is reached. // // Please refer to detailed `XHeader` description. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // object has been successfully read; - // - Common failures (SECTION_FAILURE_COMMON); - // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ - // read access to the object is denied; - // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ - // object not found in container; - // - **OBJECT_ALREADY_REMOVED** (2052, SECTION_OBJECT): \ - // the requested object has been marked as deleted; - // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ - // object container not found; - // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ - // provided session token has expired. + // - **OK** (0, SECTION_SUCCESS): \ + // object has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON); + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // read access to the object is denied; + // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ + // object not found in container; + // - **OBJECT_ALREADY_REMOVED** (2052, SECTION_OBJECT): \ + // the requested object has been marked as deleted; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // object container not found; + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. Get(*GetRequest, ObjectService_GetServer) error // Put the object into container. Request uses gRPC stream. First message // SHOULD be of PutHeader type. `ContainerID` and `OwnerID` of an object @@ -446,106 +447,107 @@ type ObjectServiceServer interface { // Chunk messages SHOULD be sent in the direct order of fragmentation. // // Extended headers can change `Put` behaviour: - // * [ __SYSTEM__NETMAP_EPOCH \ - // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ - // Will use the requsted version of Network Map for object placement - // calculation. + // - [ __SYSTEM__NETMAP_EPOCH \ + // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ + // Will use the requsted version of Network Map for object placement + // calculation. // // Please refer to detailed `XHeader` description. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // object has been successfully saved in the container; - // - Common failures (SECTION_FAILURE_COMMON); - // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ - // write access to the container is denied; - // - **LOCKED** (2050, SECTION_OBJECT): \ - // placement of an object of type TOMBSTONE that includes at least one locked - // object is prohibited; - // - **LOCK_NON_REGULAR_OBJECT** (2051, SECTION_OBJECT): \ - // placement of an object of type LOCK that includes at least one object of - // type other than REGULAR is prohibited; - // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ - // object storage container not found; - // - **TOKEN_NOT_FOUND** (4096, SECTION_SESSION): \ - // (for trusted object preparation) session private key does not exist or has + // - **OK** (0, SECTION_SUCCESS): \ + // object has been successfully saved in the container; + // - Common failures (SECTION_FAILURE_COMMON); + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // write access to the container is denied; + // - **LOCKED** (2050, SECTION_OBJECT): \ + // placement of an object of type TOMBSTONE that includes at least one locked + // object is prohibited; + // - **LOCK_NON_REGULAR_OBJECT** (2051, SECTION_OBJECT): \ + // placement of an object of type LOCK that includes at least one object of + // type other than REGULAR is prohibited; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // object storage container not found; + // - **TOKEN_NOT_FOUND** (4096, SECTION_SESSION): \ + // (for trusted object preparation) session private key does not exist or has + // // been deleted; - // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ - // provided session token has expired. + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. Put(ObjectService_PutServer) error // Delete the object from a container. There is no immediate removal // guarantee. Object will be marked for removal and deleted eventually. // // Extended headers can change `Delete` behaviour: - // * [ __SYSTEM__NETMAP_EPOCH ] \ - // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ - // Will use the requested version of Network Map for object placement - // calculation. + // - [ __SYSTEM__NETMAP_EPOCH ] \ + // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ + // Will use the requested version of Network Map for object placement + // calculation. // // Please refer to detailed `XHeader` description. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // object has been successfully marked to be removed from the container; - // - Common failures (SECTION_FAILURE_COMMON); - // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ - // delete access to the object is denied; - // - **LOCKED** (2050, SECTION_OBJECT): \ - // deleting a locked object is prohibited; - // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ - // object container not found; - // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ - // provided session token has expired. + // - **OK** (0, SECTION_SUCCESS): \ + // object has been successfully marked to be removed from the container; + // - Common failures (SECTION_FAILURE_COMMON); + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // delete access to the object is denied; + // - **LOCKED** (2050, SECTION_OBJECT): \ + // deleting a locked object is prohibited; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // object container not found; + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. Delete(context.Context, *DeleteRequest) (*DeleteResponse, error) // Returns the object Headers without data payload. By default full header is // returned. If `main_only` request field is set, the short header with only // the very minimal information will be returned instead. // // Extended headers can change `Head` behaviour: - // * [ __SYSTEM__NETMAP_EPOCH ] \ - // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ - // Will use the requested version of Network Map for object placement - // calculation. + // - [ __SYSTEM__NETMAP_EPOCH ] \ + // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ + // Will use the requested version of Network Map for object placement + // calculation. // // Please refer to detailed `XHeader` description. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // object header has been successfully read; - // - Common failures (SECTION_FAILURE_COMMON); - // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ - // access to operation HEAD of the object is denied; - // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ - // object not found in container; - // - **OBJECT_ALREADY_REMOVED** (2052, SECTION_OBJECT): \ - // the requested object has been marked as deleted; - // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ - // object container not found; - // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ - // provided session token has expired. + // - **OK** (0, SECTION_SUCCESS): \ + // object header has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON); + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // access to operation HEAD of the object is denied; + // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ + // object not found in container; + // - **OBJECT_ALREADY_REMOVED** (2052, SECTION_OBJECT): \ + // the requested object has been marked as deleted; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // object container not found; + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. Head(context.Context, *HeadRequest) (*HeadResponse, error) // Search objects in container. Search query allows to match by Object // Header's filed values. Please see the corresponding NeoFS Technical // Specification section for more details. // // Extended headers can change `Search` behaviour: - // * [ __SYSTEM__NETMAP_EPOCH ] \ - // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ - // Will use the requested version of Network Map for object placement - // calculation. + // - [ __SYSTEM__NETMAP_EPOCH ] \ + // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ + // Will use the requested version of Network Map for object placement + // calculation. // // Please refer to detailed `XHeader` description. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // objects have been successfully selected; - // - Common failures (SECTION_FAILURE_COMMON); - // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ - // access to operation SEARCH of the object is denied; - // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ - // search container not found; - // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ - // provided session token has expired. + // - **OK** (0, SECTION_SUCCESS): \ + // objects have been successfully selected; + // - Common failures (SECTION_FAILURE_COMMON); + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // access to operation SEARCH of the object is denied; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // search container not found; + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. Search(*SearchRequest, ObjectService_SearchServer) error // Get byte range of data payload. Range is set as an (offset, length) tuple. // Like in `Get` method, the response uses gRPC stream. Requested range can be @@ -553,33 +555,33 @@ type ObjectServiceServer interface { // order. // // Extended headers can change `GetRange` behaviour: - // * [ __SYSTEM__NETMAP_EPOCH ] \ - // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ - // Will use the requested version of Network Map for object placement - // calculation. - // * [ __SYSTEM__NETMAP_LOOKUP_DEPTH ] \ - // (`__NEOFS__NETMAP_LOOKUP_DEPTH` is deprecated) \ - // Will try older versions of Network Map to find an object until the depth - // limit is reached. + // - [ __SYSTEM__NETMAP_EPOCH ] \ + // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ + // Will use the requested version of Network Map for object placement + // calculation. + // - [ __SYSTEM__NETMAP_LOOKUP_DEPTH ] \ + // (`__NEOFS__NETMAP_LOOKUP_DEPTH` is deprecated) \ + // Will try older versions of Network Map to find an object until the depth + // limit is reached. // // Please refer to detailed `XHeader` description. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // data range of the object payload has been successfully read; - // - Common failures (SECTION_FAILURE_COMMON); - // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ - // access to operation RANGE of the object is denied; - // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ - // object not found in container; - // - **OBJECT_ALREADY_REMOVED** (2052, SECTION_OBJECT): \ - // the requested object has been marked as deleted. - // - **OUT_OF_RANGE** (2053, SECTION_OBJECT): \ - // the requested range is out of bounds; - // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ - // object container not found; - // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ - // provided session token has expired. + // - **OK** (0, SECTION_SUCCESS): \ + // data range of the object payload has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON); + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // access to operation RANGE of the object is denied; + // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ + // object not found in container; + // - **OBJECT_ALREADY_REMOVED** (2052, SECTION_OBJECT): \ + // the requested object has been marked as deleted. + // - **OUT_OF_RANGE** (2053, SECTION_OBJECT): \ + // the requested range is out of bounds; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // object container not found; + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. GetRange(*GetRangeRequest, ObjectService_GetRangeServer) error // Returns homomorphic or regular hash of object's payload range after // applying XOR operation with the provided `salt`. Ranges are set of (offset, @@ -587,31 +589,31 @@ type ObjectServiceServer interface { // the request. Note that hash is calculated for XORed data. // // Extended headers can change `GetRangeHash` behaviour: - // * [ __SYSTEM__NETMAP_EPOCH ] \ - // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ - // Will use the requested version of Network Map for object placement - // calculation. - // * [ __SYSTEM__NETMAP_LOOKUP_DEPTH ] \ - // (`__NEOFS__NETMAP_LOOKUP_DEPTH` is deprecated) \ - // Will try older versions of Network Map to find an object until the depth - // limit is reached. + // - [ __SYSTEM__NETMAP_EPOCH ] \ + // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ + // Will use the requested version of Network Map for object placement + // calculation. + // - [ __SYSTEM__NETMAP_LOOKUP_DEPTH ] \ + // (`__NEOFS__NETMAP_LOOKUP_DEPTH` is deprecated) \ + // Will try older versions of Network Map to find an object until the depth + // limit is reached. // // Please refer to detailed `XHeader` description. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // data range of the object payload has been successfully hashed; - // - Common failures (SECTION_FAILURE_COMMON); - // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ - // access to operation RANGEHASH of the object is denied; - // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ - // object not found in container; - // - **OUT_OF_RANGE** (2053, SECTION_OBJECT): \ - // the requested range is out of bounds; - // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ - // object container not found; - // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ - // provided session token has expired. + // - **OK** (0, SECTION_SUCCESS): \ + // data range of the object payload has been successfully hashed; + // - Common failures (SECTION_FAILURE_COMMON); + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // access to operation RANGEHASH of the object is denied; + // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ + // object not found in container; + // - **OUT_OF_RANGE** (2053, SECTION_OBJECT): \ + // the requested range is out of bounds; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // object container not found; + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. GetRangeHash(context.Context, *GetRangeHashRequest) (*GetRangeHashResponse, error) } From dbcd51474873ea6c49de081fff35aa74a13b30b8 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Tue, 11 Apr 2023 10:35:11 +0300 Subject: [PATCH 1053/1196] Revert "[#16] object: Allow set `copy_number` for every placement vector" This reverts commit e022a2b831f6f6149609ecf507531ae8061629c9. --- object/grpc/service.go | 2 +- object/grpc/service.pb.go | 18 +++++------------- object/marshal.go | 6 ++---- object/test/generate.go | 2 +- object/types.go | 8 ++++---- 5 files changed, 13 insertions(+), 23 deletions(-) diff --git a/object/grpc/service.go b/object/grpc/service.go index 74dc168..44b5f4a 100644 --- a/object/grpc/service.go +++ b/object/grpc/service.go @@ -109,7 +109,7 @@ func (m *PutRequest_Body_Init) SetHeader(v *Header) { } // SetCopiesNumber sets number of the copies to save. -func (m *PutRequest_Body_Init) SetCopiesNumber(v []uint32) { +func (m *PutRequest_Body_Init) SetCopiesNumber(v uint32) { m.CopiesNumber = v } diff --git a/object/grpc/service.pb.go b/object/grpc/service.pb.go index 6ba4090..207b0b0 100644 --- a/object/grpc/service.pb.go +++ b/object/grpc/service.pb.go @@ -1452,17 +1452,9 @@ type PutRequest_Body_Init struct { Signature *grpc1.Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` // Object's Header Header *Header `protobuf:"bytes,3,opt,name=header,proto3" json:"header,omitempty"` - // Number of copies of the object to store within the RPC call. By default, + // Number of the object copies to store within the RPC call. By default // object is processed according to the container's placement policy. - // Can be one of: - // 1. A single number; applied to the whole request and is treated as - // a minimal number of nodes that must store an object to complete the - // request successfully. - // 2. An ordered array; every number is treated as a minimal number of - // nodes in a corresponding placement vector that must store an object - // to complete the request successfully. The length MUST equal the placement - // vectors number, otherwise request is considered malformed. - CopiesNumber []uint32 `protobuf:"varint,4,rep,packed,name=copies_number,json=copiesNumber,proto3" json:"copies_number,omitempty"` + CopiesNumber uint32 `protobuf:"varint,4,opt,name=copies_number,json=copiesNumber,proto3" json:"copies_number,omitempty"` } func (x *PutRequest_Body_Init) Reset() { @@ -1518,11 +1510,11 @@ func (x *PutRequest_Body_Init) GetHeader() *Header { return nil } -func (x *PutRequest_Body_Init) GetCopiesNumber() []uint32 { +func (x *PutRequest_Body_Init) GetCopiesNumber() uint32 { if x != nil { return x.CopiesNumber } - return nil + return 0 } // PUT Object response body @@ -2465,7 +2457,7 @@ var file_object_grpc_service_proto_rawDesc = []byte{ 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x23, 0x0a, 0x0d, 0x63, 0x6f, - 0x70, 0x69, 0x65, 0x73, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x04, 0x20, 0x03, 0x28, + 0x70, 0x69, 0x65, 0x73, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0c, 0x63, 0x6f, 0x70, 0x69, 0x65, 0x73, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x42, 0x0d, 0x0a, 0x0b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x70, 0x61, 0x72, 0x74, 0x22, 0xa0, 0x02, 0x0a, 0x0b, 0x50, 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x36, diff --git a/object/marshal.go b/object/marshal.go index 7a89b97..b918e69 100644 --- a/object/marshal.go +++ b/object/marshal.go @@ -516,7 +516,7 @@ func (r *PutObjectPartInit) StableMarshal(buf []byte) []byte { offset += proto.NestedStructureMarshal(putReqInitObjectIDField, buf[offset:], r.id) offset += proto.NestedStructureMarshal(putReqInitSignatureField, buf[offset:], r.sig) offset += proto.NestedStructureMarshal(putReqInitHeaderField, buf[offset:], r.hdr) - proto.RepeatedUInt32Marshal(putReqInitCopiesNumField, buf[offset:], r.copyNum) + proto.UInt32Marshal(putReqInitCopiesNumField, buf[offset:], r.copyNum) return buf } @@ -529,9 +529,7 @@ func (r *PutObjectPartInit) StableSize() (size int) { size += proto.NestedStructureSize(putReqInitObjectIDField, r.id) size += proto.NestedStructureSize(putReqInitSignatureField, r.sig) size += proto.NestedStructureSize(putReqInitHeaderField, r.hdr) - - arrSize, _ := proto.RepeatedUInt32Size(putReqInitCopiesNumField, r.copyNum) - size += arrSize + size += proto.UInt32Size(putReqInitCopiesNumField, r.copyNum) return size } diff --git a/object/test/generate.go b/object/test/generate.go index 32d7a3c..0816ffc 100644 --- a/object/test/generate.go +++ b/object/test/generate.go @@ -216,7 +216,7 @@ func GeneratePutObjectPartInit(empty bool) *object.PutObjectPartInit { m := new(object.PutObjectPartInit) if !empty { - m.SetCopiesNumber([]uint32{234}) + m.SetCopiesNumber(234) m.SetObjectID(refstest.GenerateObjectID(false)) } diff --git a/object/types.go b/object/types.go index a40de57..f076b74 100644 --- a/object/types.go +++ b/object/types.go @@ -128,7 +128,7 @@ type PutObjectPartInit struct { hdr *Header - copyNum []uint32 + copyNum uint32 } type PutObjectPartChunk struct { @@ -894,15 +894,15 @@ func (r *PutObjectPartInit) SetHeader(v *Header) { r.hdr = v } -func (r *PutObjectPartInit) GetCopiesNumber() []uint32 { +func (r *PutObjectPartInit) GetCopiesNumber() uint32 { if r != nil { return r.copyNum } - return nil + return 0 } -func (r *PutObjectPartInit) SetCopiesNumber(v []uint32) { +func (r *PutObjectPartInit) SetCopiesNumber(v uint32) { r.copyNum = v } From 84dc99a0456566c7ba28d0a072b3a7954db98118 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Tue, 11 Apr 2023 10:35:21 +0300 Subject: [PATCH 1054/1196] Release v2.15.0 Signed-off-by: Evgenii Stratonikov --- CHANGELOG.md | 860 +-------------------------------------------------- 1 file changed, 13 insertions(+), 847 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index da58198..7ab694e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,856 +2,22 @@ ## [Unreleased] +### Added +### Fixed +### Changed +### Updated + +## 2.15.0 - 2023-04-11 + ### Added - Basic tracing support (#12) -### Fixed -### Changed -### Updated +- Optimize signature checking (#3) -## [2.14.0] - 2022-10-17 - Anmado (안마도, 鞍馬島) +Initial public release. -### Added -- Maintenance status and node state (#415) -- `NetmapSnapshot` RPC (#418) +## Older versions -### Fixed -- Marshal repeated `[]byte` fields correctly (#413) -- Block until client connection is up (#419) +This project is a fork of [NeoFS](https://github.com/nspcc-dev/neofs-api-go) from version v2.14.0. +To see CHANGELOG for older versions, refer to https://github.com/nspcc-dev/neofs-api-go/blob/master/CHANGELOG.md. -### Changed -- Support new object session context format (#416) -- Mark all expiration methods as deprecated (#417) - -### Updated -- Minimal go version to 1.17 (#412) -- `neofs-crypto` to `v0.4.0` (#412) -- `google.golang.org/grpc` to `v1.48.0` (#415) -- `google.golang.org/protobuf` to `v1.28.0` (#415) - -## [2.13.1] - 2022-08-01 - -### Added -- `EACL_NOT_FOUND` status code support (#409) - -## [2.13.0] - 2022-07-04 - Yeonpyeongdo (연평도, 延坪島) - -NeoFS API v2.13 support - -### Added -- WalletConnect signature scheme (#386) -- `object.StatusOutOfRange` enum value (#407) -- Functionality to disable homomorphic hashing in container (#399) -- `status.SignatureVerificationFail` enum value (#405) - -## [2.12.2] - 2022-06-03 - -### Added -- `util/protogen` tool to compile Protocol Buffers with stable marshaling - -### Fixed -- `refs.ObjectIDNestedListMarshal` incorrect encoding (#401) -- incorrect conversion of `oneof` field in `GetRangeResponseBody.FromGRPCMessage` (#401) - -### Changed -- Setters don't check call on `nil` (#388) -- `StableMarshal` methods don't return `error` -- `oneof` fields are now randomly initialized in test generators (#401) - -## [2.12.1] - 2022-03-15 - -### Fixed -- Incompatible changes in signature scheme (#380) - -### Added -- Public URI-parsing function `client.ParseURI()` (#383) - -### Changed -- Slices with pointers `[]*T` replaced with regular structure slices `[]T` in - v2 structures (#376) - -## [2.12.0] - 2022-02-25 - Heuksando (흑산도, 黑山島) - -NeoFS API v2.12 support - -### Added -- Network magic field (`uint64`) to `session.RequestMetaHeader` (#367) -- Constants for attributes related to object notifications (#372) -- `refs.SignatureScheme` enum and corresponding field to `session.Signature` message (#55) -- New status codes in `container`, `object` and `session` packages (#371) -- `object.TypeLock` type enum value and `object.Lock` type of its content (#371) - -### Changed -- API of `signature` package (#55) - -### Deprecated -- `SessionToken`, `SessionTokenBody` and `SessionTokenContext` types from `session` package - -## [2.11.1] - 2021-12-28 - -### Added -- Timeout for single message transmission in `rpc/client` (#366) - -## [2.11.0] - 2021-12-02 - Sinjido (신지도, 薪智島) - -NeoFS API v2.11 support. High level packages are moved to -[neofs-sdk-go](https://github.com/nspcc-dev/neofs-sdk-go) repository. -Repository restructured as Go module version 2 and synced with -[neofs-api](https://github.com/nspcc-dev/neofs-api) release version. - -### Fixed -- Protobuf recompile script handles path with special symbols correctly (#354) -- `make dep` command (#364) - -### Added -- Status codes in response messages (#350) -- Storage subnetwork types (#355, #356, #360, #362) - -### Changed -- neofs-api-go is now Go module version 2 (#201) - -### Removed -- All packages from `pkg` moved to - [neofs-sdk-go](https://github.com/nspcc-dev/neofs-sdk-go) (#201) - -## [1.30.0] - 2021-10-19 - Udo (우도, 牛島) - -NeoFS API v2.10 support. - -### Fixed - -- Potential NPE in NEO3Wallet related functions (#340) -- Incorrect return of reputation intermediate announcement (#342) - -### Added - -- pkg/client callback to parse internal response information (#337) -- Service filter type in extended ACL from API v2.10 (#338) -- Enhanced network info structures from API v2.10 (#339) -- Well-known public-append basic ACL constant (#341) -- Native contract names support (#351) - -### Changed - -- Updated grpc to v1.41.0 (#176) - -## [1.29.0] - 2021-08-27 - Anmyeondo (안면도, 安眠島) - -### Fixed - -- Well-known BasicACL constants to fit the specification (#330, #334). -- Linter warnings (#335). - -### Added - -- Support for `COMMON_PREFIX` filter operation for object attributes (#331). -- Missing well-known eACL filter setters (#333). - -### Removed - -- `FilterObjectParent` well-known object related filter key (#333). - -### Updated - -- Go version to `1.16` (#335). -- Tests in CI to run on `1.16` and `1.17` Go versions (#335). - -## [1.28.3] - 2021-07-07 - -### Fixed - -- Regression of the session token corruption fix from v1.28.2 ([#326](https://github.com/nspcc-dev/neofs-api-go/issues/326)). - -## [1.28.2] - 2021-07-06 - -### Fixed - -- Data corruption of parameterized session token in `pkg/client.Client` ([#323](https://github.com/nspcc-dev/neofs-api-go/issues/323)). - -## [1.28.1] - 2021-07-01 - -### Fixed - -- Incorrect unsupported version error in `Client.GetContainer` of containers of newer versions. - -### Removed - -- No longer used `pkg.IsSupportedVersion` func. -- No longer used `container.NewVerifiedFromV2` func. - -## [1.28.0] - 2021-06-28 - Muuido (무의도, 舞衣島) - -### Added - -- `String` / `FromString` methods to work with text format of enums from `pkg`. -- `Marshal(JSON)` / `Unmarshal(JSON)` methods to `container.ContainerContext` type. -- Ability to handle the `io.Reader` of the object payload in `Client.GetObject`. -- `NumberOfAddresses` / `IterateAddresses` methods to node info types for support of multiple addresses. - -### Fixed - -- Added leading slash to format of gRPC method names. - -### Updated - -- Neo Go library to v0.95.3. - -## [1.27.1] - 2021-06-10 - -### Fixed - -- SDK version was updated (actualized) to `2.7`. - -### Changed - -- `pkg` wrappers' `ToV2` methods return `nil` if called on `nil`. -- `pkg` wrappers' `NewFromV2` functions constructs `nil` if called with `nil` argument. - -### Added - -- Getters and setters for lifetime fields of `pkg/session.Token`. -- `MarshalHeaderJSON` method to `pkg/object.Object`. -- Generators for types from `pkg` (for testing). -- Descriptions of default fields for `pkg` wrappers and unit tests for its constructors. -- Unit tests for `ToV2` methods and `NewFromV2` functions. - -## [1.27.0] - 2021-06-03 - Seongmodo (석모도, 席毛島) - -### Added - -- Message structures related to Container service sessions in `v2` and `pkg`. -- `session.Token` and `Signature` to `pkg/container.Container` and `pkg/acl/eacl.Table`. -- `Conn` method of clients to get the underlying connection. -- `WithTLSConfig` client option to specify TLS configuration. -- `WithNetworkURIAddress` client option to specify URI of the remote server. -- Generators of random container IDs, owner IDs and session tokens (for testing). - -### Replaced - -- `pkg/token.SessionToken` type to `pkg/session` package as `Token`. Old type is deprecated. -- `pkg/container.ID` type to `pkg/container/id` package. Old type is deprecated. - -### Updated - -- NEO Go library to v0.95.1. - -## [1.26.1] - 2021-05-19 - -### Changed - -- Updated neo-go to v0.95.0 release. - -### Removed - -- `pkg/errors` dependency (stdlib errors used instead). - -## [1.26.0] - 2021-05-07 - Daecheongdo (대청도, 大靑島) - -### Added - -- Implementation of `v2/reputation` package. -- Implementation of reputation methods in `pkg/client`. -- Float64 stable marshaling wrappers in `util/proto`. - -## [1.25.0] - 2021-03-22 - Jebudo (제부도, 濟扶島) - -Raw client and support of NeoFS API v2.5.0 "Jebudo" release. - -### Added - -- Raw client for peer to peer communication. -- `client.WithKey` option to sign messages with different keys within single - client. -- `Content-Type` well-known object attribute constant. - -### Changed - -- Refactored `v2` sub-packages to support single raw client in all RPC methods. -- Client constructor returns `Client` interface instead of structure. - -## [1.24.0] - 2021-02-26 - Ganghwado (강화도, 江華島) - -Support changes from NeoFS API v2.4.0 "Ganghwado" release. - -### Added - -- `netmap.NetworkInfo` definitions in `v2` and `pkg/netmap`. -- `netmap.NetworkInfo` RPC support in `pkg/client`. - -### Changed - -- Updated in-line docs from NeoFS API "Ganghwado" release. - -## [1.23.0] - 2021-02-11 - Seonyudo (선유도, 仙遊島) - -Support changes from NeoFS API v2.3.0 "Seonyudo" release. - -### Added - -- Fulfill backup factor for default attribute in placement. -- Support of `Container.AnnounceUsedSpace` RPC from NeoFS API. -- New `pkg/client.Client.AnnounceContainerUsedSpace` method. -- Support of `STRING_NOT_EQUAL` and `NOT_PRESENT` object search filters. -- Implementation of `json.Marshaler`/`json.Unmarshaler` on `v2/object/SearchFilter`. -- Implementation of `json.Marshaler`/`json.Unmarshaler` on `pkg/object/SearchFilters`. -- Named constants of well-known node attributes in `pkg/netmap`. - -### Renamed - -- `pkg/netmap/PriceAttr` to `pkg/netmap/AttrPrice`. -- `pkg/netmap/CapacityAttr` to `pkg/netmap/AttrCapacity`. - -## [1.22.2] - 2021-01-27 - -### Fixed - -- Fix size limit for grpc messages in object.Put operation. -- Fix `GetContainerNode()` function, so that it does not modify placement policy. - -## [1.22.1] - 2021-01-15 - -Support changes from NeoFS API v2.2.1 release. - -### Added - -- Constant prefix of the reserved keys to X-headers (`__NEOFS__`). -- Constant string key to netmap epoch X-header (`__NEOFS__NETMAP_EPOCH`). -- Constant string key to netmap lookup depth X-header (`__NEOFS__NETMAP_LOOKUP_DEPTH`). - -### Changed - -- Linter's configuration in `.golangci.yml`. - -### Fixed - -- Remarks of the updated linter. - -## [1.22.0] - 2020-12-30 - Yeouido (여의도, 汝矣島) - -Support changes from NeoFS API v2.2.0 "Yeouido" release. - -### Added - -- Payload hash field to `ShortHeader` message. -- Payload homomorphic hash field to `ShortHeader` message. -- Support of `StorageGroup` message. -- Support of `DataAuditResult` message. -- Stringer and string parser for `Checksum` type of client library. -- Stringer and string parser for `Type` message. -- Stringer and string parser for `Type` type of client library. -- `AddTypeFilter` method on `SearchFilters` type of client library - that adds filter by object type. -- Utility functions for working with `fixed64` protobuf type to `proto` library. -- Converters for `repeated` object ID messages in `v2` library. - -## [1.21.2] - 2020-12-24 - -### Added - -- `Container.NonceUUID` getter of container nonce in UUID format. -- `Container.SetNonceUUID` setter of container nonce in UUID format. -- `NewVerifiedContainerFromV2` container constructor that preliminary - checks if container message argument meets NeoFS API V2 specification. - -### Changed - -- `Container.Nonce`/`Container.SetNonce` marked as deprecated. -- `Client.GetContainer` method returns an error if received - container does not meet NeoFS API specification. - -### Fixed - -- `pkg.SDKVersion` to return version with minor `1`. -- `pkg.IsSupportedVersion` to consider `2.1` as supported. - -## [1.21.1] - 2020-12-18 - -Support neofs-api v2.1.1. - -### Added - -- `client.GetVerifiedContainerStructure` function to check - that the container structure matches the requested identifier. - -## [1.21.0] - 2020-12-11 - Modo (모도, 茅島) - -### Added - -- `SplitID` message support -- Search filter by `SplitID` field -- `SplitInfo` message support and related error -- `Raw` flag support in `Client.GetObject(Header)` -- Getters for parameter structures in `pkg/client` package -- `Tombstone` message support -- Tombstone address target parameter of `Client.DeleteObject` method -- `client.DeleteObject` helpful function -- Usage of default value for backup factor in placement builder - -### Removed - -- Object search filter by `CHILDFREE` property - -### Renamed - -- `AddLeafFilter` to `AddPhyFilter` - -### Fixed - -- NPE in `eacl.NewTargetFromV2` function -- Processing `REP X` policies in placement builder - - -## [1.20.3] - 2020-11-25 - -### Added - -- `AddObjectIDFilter` method of `SearchFilters` type -- `WithDialTimeout` option of v2 and SDK `Client`'s -- `GetEACLWithSignature` method of SDK `Client` type - -### Fixed - -- incorrect signature verification algorithm in `GetEACL` method of SDK `Client` - -## [1.20.2] - 2020-11-17 - -### Fixed - -- Readme badges - -## [1.20.1] - 2020-11-17 - -### Fixed - -- Signature check of head response in `pkg/client` (#202) - -## [1.20.0] - 2020-11-16 - Jindo (진도, 珍島) - -Major API refactoring and simplification. From now on this library will have -backward compatibility and support of major versions of NeoFS-API by having -**version specific** files in `vN` dirs and **version independent** SDK -structures and client in `pkg`. This version supports NeoFS-API v2.0.X - - -### Added -- cross-protocol ```v2``` message types -- utility functions for message signing/verification -- ```v2```/ ```gRPC``` back and forth conversions -- primary SDK - -### Removed -- v0 and v1 NeoFS API is not supported anymore - -## [1.3.0] - 2020-07-23 - -### Changed - -- Format of ```refs.OwnerID``` based on NEO3. -- Binary format of extended ACL table. -- ```acl``` package structure. - -## [1.2.0] - 2020-07-08 - -### Added - -- Extended ACL types. -- Getters and setters of ```EACLTable``` and its internal messages. -- Wrappers over ```EACLTable``` and its internal messages. -- Getters, setters and marshaling methods of wrappers. - -### Changed - -- Mechanism for signing requests on the principle of Matryoshka. - -### Updated - -- NeoFS API v1.1.0 => 1.2.0 - -## [1.1.0] - 2020-06-18 - -### Added - -- `container.SetExtendedACL` rpc. -- `container.GetExtendedACL` rpc. -- Bearer token to all request messages. -- X-headers to all request messages. - -### Changed - -- Implementation and signatures of Sign/Verify request functions. - -### Updated - -- NeoFS API v1.0.0 => 1.1.0 - -## [1.0.0] - 2020-05-26 - -- Bump major release - -### Updated - -- NeoFS API v0.7.5 => v1.0.0 -- github.com/golang/protobuf v1.4.0 => v1.4.2 -- github.com/prometheus/client_golang v1.5.1 => v1.6.0 -- github.com/spf13/viper v1.6.2 => v1.7.0 -- google.golang.org/grpc v1.28.1 => v1.29.1 - -## [0.7.6] - 2020-05-19 - -### Added - -- `session.PublicSessionToken` function for session public key bytes receiving. -- The implementation of `service.DataWithSignKeyAccumulator` methods on `object.IntegrityHeader`. - -### Changed - -- The implementation of `AddSignKey` method on `service.signedSessionToken` structure. -- `session.PrivateTOken` interface methods group. - -### Removed - -- `OwnerKey` from `service.SessionToken` signed payload. - -### Fixed - -- Incorrect `object.HeadRequest.ReadSignedData` method implementation. - -## [0.7.5] - 2020-05-16 - -### Added - -- Owner key to the `SessionToken` signed payload. - -### Changed - -- `OwnerKeyContainer` interface embedded to `SessionTokenInfo` interface. - -### Updated - -- NeoFS API v0.7.5 - -## [0.7.4] - 2020-05-12 - -### Added - -- Stringify for `object.Object`. - -### Changed - -- Mechanism for creating and verifying request message signatures. -- Implementation and interface of private token storage. -- File structure of packages. - -### Updated - -- NeoFS API v0.7.4 - -## [0.7.1] - 2020-04-20 - -### Added - -- Method to change current node state. (`state.ChangeState`) - -### Updated - -- NeoFS API v0.7.1 - -## [0.7.0] - 2020-04-16 - -### Updated -- NeoFS API v0.7.0 - -## [0.6.2] - 2020-04-16 - -### Updated -- NeoFS API v0.6.1 -- Protobuf v1.4.0 -- Netmap v1.7.0 -- Prometheus Client v1.5.1 -- Testify v1.5.1 -- gRPC v1.28.1 - -### Fixed -- formatting -- test coverage for Object.PutRequest.CID method - -## [0.6.1] - 2020-04-10 - -### Changed - -- License changed to Apache 2.0 - -### Fixed - -- NPE in PutRequest.CID() - - -## [0.6.0] - 2020-04-03 - -### Added - -- `RequestType` for object service requests -- `Type()` function in `Request` interface - -### Changed - -- Synced proto files with `neofs-api v0.6.0` - -## [0.5.0] - 2020-03-31 - -### Changed -- Rename repo to `neofs-api-go` -- Used public proto files - -## [0.4.2] - 2020-03-16 - -### Fixed -- NPE bug with CID method of object.PutRequest - -## [0.4.1] - 2020-03-02 - -### Changed -- Updated neofs-crypto library to v0.3.0 - -## [0.4.0] - 2020-02-18 - -### Added -- Meta header for all gRPC responses. It contains epoch stamp and version number. -### Changed -- Endianness in accounting cheque. Now it uses little endian for cheaper -decoding in neofs smart-contract. - -## [0.3.2] - 2020-02-10 - -### Added -- gRPC method DumpVars to State service -- add method `EncodeVariables` to encode debug variables to JSON (slice of bytes) -- increase test coverage for state package - -### Updated -- state proto file -- documentation for state service and messages - -## [0.3.1] - 2020-02-07 -### Fixed -- bug with `tz.Concat` - -### Updated -- dependencies: - - github.com/nspcc-dev/tzhash `v1.3.0 => v1.4.0` - - github.com/prometheus/client_golang `v1.4.0 => v1.4.1` - - google.golang.org/grpc `v1.27.0 => v1.27.1` - -## [0.3.0] - 2020-02-05 - -### Updated -- proto files -- dependencies - - github.com/golang/protobuf `v1.3.2 => v1.3.3` - - github.com/pkg/errors `v0.8.1 => v0.9.1` - - github.com/prometheus/client_golang `v1.2.1 => v1.4.0` - - github.com/prometheus/client_model `v0.0.0-20190812154241-14fe0d1b01d4 => v0.2.0` - - github.com/spf13/viper `v1.6.1 => v1.6.2` - - google.golang.org/grpc `v1.24.0 => v1.27.0` - -### Changed -- make object.GetRange to be server-side streaming RPC -- GetRange response struct - -### Added -- badges to readme - -## [0.2.14] - 2020-02-04 - -### Fixed -- Readme - -### Added -- Filename header - -### Updated -- Object.Search now uses streams - -## [0.2.13] - 2020-02-03 - -### Fixed -- Code format - -### Changed -- Use separated proto repository -- Rename neofs-proto to neofs-api - -## [0.2.12] - 2020-01-27 - -### Fixed -- Bug with ByteSize (0 bytes returns NaN) - -## [0.2.11] - 2020-01-21 - -### Added -- Raw flag in object head and get queries with docs - -## [0.2.10] - 2020-01-17 - -### Changed -- Private token contructor now takes public keys as an argument - -## [0.2.9] - 2020-01-17 - -### Added -- Docs for container ACL field -- Public key header in the object with docs -- Public key field in the session token with docs - -### Changed -- Routine to verify correct object checks if integrity header is last and -may use public key header if verification header is not present -- Routine to verify correct session token checks if keys in the token -associated with owner id -- Updated neofs-crypto to v0.2.3 - -### Removed -- Timestamp in object tombstone header - -## [0.2.8] - 2019-12-21 - -### Added -- Container access control type definitions - -### Changed -- Used sync.Pool for Sign/VerifyRequestHeader -- VerifiableRequest.Marshal method replace with MarshalTo and Size - -## [0.2.7] - 2019-12-17 - -### Fixed -- Bug with DecodeMetrics (empty metrics returns) - -## [0.2.6] - 2019-12-17 - -### Added -- Request to dump node config - -## [0.2.5] - 2019-12-05 - -### Removed -- proto.Message in Maintainable/Verifiable requests - -## [0.2.4] - 2019-12-03 - -### Added -- StorageGroup library - -### Changed -- Storage group part of object library moved into separate package -- Updated proto documentation - -## [0.2.3] - 2019-11-28 - -### Removed -- service: SignRequest / VerifyRequest and accompanying code -- proto: Signature field from requests -- object: bytefmt package not used anymore - -### Changed -- service: rename EpochRequest to EpochHeader and merge with MetaHeader -- service: get status error even if it is wrapped - -### Added -- service: RequestVerificationHeader's method to validate owner -- service: test coverage for CheckOwner -- service: test coverage for wrapped status errors - -## [0.2.2] - 2019-11-22 - -### Changed -- ProcessRequestTTL don't changes status errors from TTLCondition - -## [0.2.1] - 2019-11-22 - -### Changed -- Removed SendPutRequest -- MakePutRequestHeader sets only object and token - -## [0.2.0] - 2019-11-21 - -### Added -- Container not found error -- GitHub Actions as CI and Codecov -- Auto-generated proto documentation -- RequestMetaHeader to all RPC requests -- RequestVerificationHeader to all RPC requests - -### Changed -- Moved TTL and Epoch fields to RequestMetaHeader -- Renamed Version in object.SearchRequest to QueryVersion -- Removed SetTTL, GetTTL, SetEpoch, GetEpoch from all RPC requests - -## 0.1.0 - 2019-11-18 - -Initial public release - -[0.2.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v0.1.0...v0.2.0 -[0.2.1]: https://github.com/nspcc-dev/neofs-api-go/compare/v0.2.0...v0.2.1 -[0.2.2]: https://github.com/nspcc-dev/neofs-api-go/compare/v0.2.1...v0.2.2 -[0.2.3]: https://github.com/nspcc-dev/neofs-api-go/compare/v0.2.2...v0.2.3 -[0.2.4]: https://github.com/nspcc-dev/neofs-api-go/compare/v0.2.3...v0.2.4 -[0.2.5]: https://github.com/nspcc-dev/neofs-api-go/compare/v0.2.4...v0.2.5 -[0.2.6]: https://github.com/nspcc-dev/neofs-api-go/compare/v0.2.5...v0.2.6 -[0.2.7]: https://github.com/nspcc-dev/neofs-api-go/compare/v0.2.6...v0.2.7 -[0.2.8]: https://github.com/nspcc-dev/neofs-api-go/compare/v0.2.7...v0.2.8 -[0.2.9]: https://github.com/nspcc-dev/neofs-api-go/compare/v0.2.8...v0.2.9 -[0.2.10]: https://github.com/nspcc-dev/neofs-api-go/compare/v0.2.9...v0.2.10 -[0.2.11]: https://github.com/nspcc-dev/neofs-api-go/compare/v0.2.10...v0.2.11 -[0.2.12]: https://github.com/nspcc-dev/neofs-api-go/compare/v0.2.11...v0.2.12 -[0.2.13]: https://github.com/nspcc-dev/neofs-api-go/compare/v0.2.12...v0.2.13 -[0.2.14]: https://github.com/nspcc-dev/neofs-api-go/compare/v0.2.13...v0.2.14 -[0.3.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v0.2.14...v0.3.0 -[0.3.1]: https://github.com/nspcc-dev/neofs-api-go/compare/v0.3.0...v0.3.1 -[0.3.2]: https://github.com/nspcc-dev/neofs-api-go/compare/v0.3.1...v0.3.2 -[0.4.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v0.3.2...v0.4.0 -[0.4.1]: https://github.com/nspcc-dev/neofs-api-go/compare/v0.4.0...v0.4.1 -[0.4.2]: https://github.com/nspcc-dev/neofs-api-go/compare/v0.4.1...v0.4.2 -[0.5.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v0.4.2...v0.5.0 -[0.6.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v0.5.0...v0.6.0 -[0.6.1]: https://github.com/nspcc-dev/neofs-api-go/compare/v0.6.0...v0.6.1 -[0.6.2]: https://github.com/nspcc-dev/neofs-api-go/compare/v0.6.1...v0.6.2 -[0.7.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v0.6.2...v0.7.0 -[0.7.1]: https://github.com/nspcc-dev/neofs-api-go/compare/v0.7.0...v0.7.1 -[0.7.4]: https://github.com/nspcc-dev/neofs-api-go/compare/v0.7.1...v0.7.4 -[0.7.5]: https://github.com/nspcc-dev/neofs-api-go/compare/v0.7.4...v0.7.5 -[0.7.6]: https://github.com/nspcc-dev/neofs-api-go/compare/v0.7.5...v0.7.6 -[1.0.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v0.7.6...v1.0.0 -[1.1.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.0.0...v1.1.0 -[1.2.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.1.0...v1.2.0 -[1.3.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.2.0...v1.3.0 -[1.20.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.3.0...v1.20.0 -[1.20.1]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.20.0...v1.20.1 -[1.20.2]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.20.1...v1.20.2 -[1.20.3]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.20.2...v1.20.3 -[1.21.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.20.3...v1.21.0 -[1.21.1]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.21.0...v1.21.1 -[1.21.2]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.21.1...v1.21.2 -[1.22.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.21.2...v1.22.0 -[1.22.1]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.22.0...v1.22.1 -[1.22.2]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.22.1...v1.22.2 -[1.23.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.22.2...v1.23.0 -[1.24.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.23.0...v1.24.0 -[1.25.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.24.0...v1.25.0 -[1.26.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.25.0...v1.26.0 -[1.26.1]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.26.0...v1.26.1 -[1.27.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.26.1...v1.27.0 -[1.27.1]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.27.0...v1.27.1 -[1.28.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.27.1...v1.28.0 -[1.28.1]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.28.0...v1.28.1 -[1.28.2]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.28.1...v1.28.2 -[1.28.3]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.28.2...v1.28.3 -[1.29.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.28.3...v1.29.0 -[1.30.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.29.0...v1.30.0 -[2.11.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v1.30.0...v2.11.0 -[2.11.1]: https://github.com/nspcc-dev/neofs-api-go/compare/v2.11.0...v2.11.1 -[2.12.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v2.11.1...v2.12.0 -[2.12.1]: https://github.com/nspcc-dev/neofs-api-go/compare/v2.12.0...v2.12.1 -[2.12.2]: https://github.com/nspcc-dev/neofs-api-go/compare/v2.12.1...v2.12.2 -[2.13.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v2.12.2...v2.13.0 -[2.13.1]: https://github.com/nspcc-dev/neofs-api-go/compare/v2.13.0...v2.13.1 -[2.14.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v2.13.1...v2.14.0 +[Unreleased]: https://github.com/TrueCloudLab/compare/v2.15.0...master From 3b938873cc1de440d6e4152331081889d8e25ead Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Tue, 11 Apr 2023 10:37:11 +0300 Subject: [PATCH 1055/1196] Revert "Revert "[#16] object: Allow set `copy_number` for every placement vector"" This reverts commit 4a34188c9ef4b7404e1abaac5f72d1c302d322e7. --- object/grpc/service.go | 2 +- object/grpc/service.pb.go | 18 +++++++++++++----- object/marshal.go | 6 ++++-- object/test/generate.go | 2 +- object/types.go | 8 ++++---- 5 files changed, 23 insertions(+), 13 deletions(-) diff --git a/object/grpc/service.go b/object/grpc/service.go index 44b5f4a..74dc168 100644 --- a/object/grpc/service.go +++ b/object/grpc/service.go @@ -109,7 +109,7 @@ func (m *PutRequest_Body_Init) SetHeader(v *Header) { } // SetCopiesNumber sets number of the copies to save. -func (m *PutRequest_Body_Init) SetCopiesNumber(v uint32) { +func (m *PutRequest_Body_Init) SetCopiesNumber(v []uint32) { m.CopiesNumber = v } diff --git a/object/grpc/service.pb.go b/object/grpc/service.pb.go index 207b0b0..6ba4090 100644 --- a/object/grpc/service.pb.go +++ b/object/grpc/service.pb.go @@ -1452,9 +1452,17 @@ type PutRequest_Body_Init struct { Signature *grpc1.Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` // Object's Header Header *Header `protobuf:"bytes,3,opt,name=header,proto3" json:"header,omitempty"` - // Number of the object copies to store within the RPC call. By default + // Number of copies of the object to store within the RPC call. By default, // object is processed according to the container's placement policy. - CopiesNumber uint32 `protobuf:"varint,4,opt,name=copies_number,json=copiesNumber,proto3" json:"copies_number,omitempty"` + // Can be one of: + // 1. A single number; applied to the whole request and is treated as + // a minimal number of nodes that must store an object to complete the + // request successfully. + // 2. An ordered array; every number is treated as a minimal number of + // nodes in a corresponding placement vector that must store an object + // to complete the request successfully. The length MUST equal the placement + // vectors number, otherwise request is considered malformed. + CopiesNumber []uint32 `protobuf:"varint,4,rep,packed,name=copies_number,json=copiesNumber,proto3" json:"copies_number,omitempty"` } func (x *PutRequest_Body_Init) Reset() { @@ -1510,11 +1518,11 @@ func (x *PutRequest_Body_Init) GetHeader() *Header { return nil } -func (x *PutRequest_Body_Init) GetCopiesNumber() uint32 { +func (x *PutRequest_Body_Init) GetCopiesNumber() []uint32 { if x != nil { return x.CopiesNumber } - return 0 + return nil } // PUT Object response body @@ -2457,7 +2465,7 @@ var file_object_grpc_service_proto_rawDesc = []byte{ 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x23, 0x0a, 0x0d, 0x63, 0x6f, - 0x70, 0x69, 0x65, 0x73, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x70, 0x69, 0x65, 0x73, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x0c, 0x63, 0x6f, 0x70, 0x69, 0x65, 0x73, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x42, 0x0d, 0x0a, 0x0b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x70, 0x61, 0x72, 0x74, 0x22, 0xa0, 0x02, 0x0a, 0x0b, 0x50, 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x36, diff --git a/object/marshal.go b/object/marshal.go index b918e69..7a89b97 100644 --- a/object/marshal.go +++ b/object/marshal.go @@ -516,7 +516,7 @@ func (r *PutObjectPartInit) StableMarshal(buf []byte) []byte { offset += proto.NestedStructureMarshal(putReqInitObjectIDField, buf[offset:], r.id) offset += proto.NestedStructureMarshal(putReqInitSignatureField, buf[offset:], r.sig) offset += proto.NestedStructureMarshal(putReqInitHeaderField, buf[offset:], r.hdr) - proto.UInt32Marshal(putReqInitCopiesNumField, buf[offset:], r.copyNum) + proto.RepeatedUInt32Marshal(putReqInitCopiesNumField, buf[offset:], r.copyNum) return buf } @@ -529,7 +529,9 @@ func (r *PutObjectPartInit) StableSize() (size int) { size += proto.NestedStructureSize(putReqInitObjectIDField, r.id) size += proto.NestedStructureSize(putReqInitSignatureField, r.sig) size += proto.NestedStructureSize(putReqInitHeaderField, r.hdr) - size += proto.UInt32Size(putReqInitCopiesNumField, r.copyNum) + + arrSize, _ := proto.RepeatedUInt32Size(putReqInitCopiesNumField, r.copyNum) + size += arrSize return size } diff --git a/object/test/generate.go b/object/test/generate.go index 0816ffc..32d7a3c 100644 --- a/object/test/generate.go +++ b/object/test/generate.go @@ -216,7 +216,7 @@ func GeneratePutObjectPartInit(empty bool) *object.PutObjectPartInit { m := new(object.PutObjectPartInit) if !empty { - m.SetCopiesNumber(234) + m.SetCopiesNumber([]uint32{234}) m.SetObjectID(refstest.GenerateObjectID(false)) } diff --git a/object/types.go b/object/types.go index f076b74..a40de57 100644 --- a/object/types.go +++ b/object/types.go @@ -128,7 +128,7 @@ type PutObjectPartInit struct { hdr *Header - copyNum uint32 + copyNum []uint32 } type PutObjectPartChunk struct { @@ -894,15 +894,15 @@ func (r *PutObjectPartInit) SetHeader(v *Header) { r.hdr = v } -func (r *PutObjectPartInit) GetCopiesNumber() uint32 { +func (r *PutObjectPartInit) GetCopiesNumber() []uint32 { if r != nil { return r.copyNum } - return 0 + return nil } -func (r *PutObjectPartInit) SetCopiesNumber(v uint32) { +func (r *PutObjectPartInit) SetCopiesNumber(v []uint32) { r.copyNum = v } From 5f318f0b75f640cfcd9a3308a76a37f340771214 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Tue, 11 Apr 2023 10:37:12 +0300 Subject: [PATCH 1056/1196] Revert "Revert "[#16] container, object: Regenerate service comments"" This reverts commit b02ec516e72fbc9030d6dc71f956e23ac93c54da. --- container/grpc/service_grpc.pb.go | 108 +++--- object/grpc/service_grpc.pb.go | 530 +++++++++++++++--------------- 2 files changed, 318 insertions(+), 320 deletions(-) diff --git a/container/grpc/service_grpc.pb.go b/container/grpc/service_grpc.pb.go index 3af498b..1de8b5f 100644 --- a/container/grpc/service_grpc.pb.go +++ b/container/grpc/service_grpc.pb.go @@ -28,9 +28,9 @@ type ContainerServiceClient interface { // 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). + // - **OK** (0, SECTION_SUCCESS): \ + // request to save the container has been sent to the sidechain; + // - Common failures (SECTION_FAILURE_COMMON). 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 @@ -38,53 +38,53 @@ type ContainerServiceClient interface { // 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). + // - **OK** (0, SECTION_SUCCESS): \ + // request to remove the container has been sent to the sidechain; + // - Common failures (SECTION_FAILURE_COMMON). 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. + // - **OK** (0, SECTION_SUCCESS): \ + // container has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON); + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // requested container not found. Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*GetResponse, error) // 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). + // - **OK** (0, SECTION_SUCCESS): \ + // container list has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON). List(ctx context.Context, in *ListRequest, opts ...grpc.CallOption) (*ListResponse, error) // Invokes 'SetEACL' method of 'Container` smart contract and returns response // immediately. After one more block in sidechain, changes in an Extended ACL are // added into smart contract storage. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // request to save container eACL has been sent to the sidechain; - // - Common failures (SECTION_FAILURE_COMMON). + // - **OK** (0, SECTION_SUCCESS): \ + // request to save container eACL has been sent to the sidechain; + // - Common failures (SECTION_FAILURE_COMMON). SetExtendedACL(ctx context.Context, in *SetExtendedACLRequest, opts ...grpc.CallOption) (*SetExtendedACLResponse, error) // Returns Extended ACL table and signature from `Container` smart contract // storage. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // container eACL has been successfully read; - // - Common failures (SECTION_FAILURE_COMMON); - // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ - // container not found; - // - **EACL_NOT_FOUND** (3073, SECTION_CONTAINER): \ - // eACL table not found. + // - **OK** (0, SECTION_SUCCESS): \ + // container eACL has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON); + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // container not found; + // - **EACL_NOT_FOUND** (3073, SECTION_CONTAINER): \ + // eACL table not found. GetExtendedACL(ctx context.Context, in *GetExtendedACLRequest, opts ...grpc.CallOption) (*GetExtendedACLResponse, error) // Announces the space values used by the container for P2P synchronization. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // estimation of used space has been successfully announced; - // - Common failures (SECTION_FAILURE_COMMON). + // - **OK** (0, SECTION_SUCCESS): \ + // estimation of used space has been successfully announced; + // - Common failures (SECTION_FAILURE_COMMON). AnnounceUsedSpace(ctx context.Context, in *AnnounceUsedSpaceRequest, opts ...grpc.CallOption) (*AnnounceUsedSpaceResponse, error) } @@ -169,9 +169,9 @@ type ContainerServiceServer interface { // 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). + // - **OK** (0, SECTION_SUCCESS): \ + // request to save the container has been sent to the sidechain; + // - Common failures (SECTION_FAILURE_COMMON). 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 @@ -179,53 +179,53 @@ type ContainerServiceServer interface { // 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). + // - **OK** (0, SECTION_SUCCESS): \ + // request to remove the container has been sent to the sidechain; + // - Common failures (SECTION_FAILURE_COMMON). 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. + // - **OK** (0, SECTION_SUCCESS): \ + // container has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON); + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // requested container not found. Get(context.Context, *GetRequest) (*GetResponse, error) // 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). + // - **OK** (0, SECTION_SUCCESS): \ + // container list has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON). List(context.Context, *ListRequest) (*ListResponse, error) // Invokes 'SetEACL' method of 'Container` smart contract and returns response // immediately. After one more block in sidechain, changes in an Extended ACL are // added into smart contract storage. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // request to save container eACL has been sent to the sidechain; - // - Common failures (SECTION_FAILURE_COMMON). + // - **OK** (0, SECTION_SUCCESS): \ + // request to save container eACL has been sent to the sidechain; + // - Common failures (SECTION_FAILURE_COMMON). SetExtendedACL(context.Context, *SetExtendedACLRequest) (*SetExtendedACLResponse, error) // Returns Extended ACL table and signature from `Container` smart contract // storage. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // container eACL has been successfully read; - // - Common failures (SECTION_FAILURE_COMMON); - // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ - // container not found; - // - **EACL_NOT_FOUND** (3073, SECTION_CONTAINER): \ - // eACL table not found. + // - **OK** (0, SECTION_SUCCESS): \ + // container eACL has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON); + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // container not found; + // - **EACL_NOT_FOUND** (3073, SECTION_CONTAINER): \ + // eACL table not found. GetExtendedACL(context.Context, *GetExtendedACLRequest) (*GetExtendedACLResponse, error) // Announces the space values used by the container for P2P synchronization. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // estimation of used space has been successfully announced; - // - Common failures (SECTION_FAILURE_COMMON). + // - **OK** (0, SECTION_SUCCESS): \ + // estimation of used space has been successfully announced; + // - Common failures (SECTION_FAILURE_COMMON). AnnounceUsedSpace(context.Context, *AnnounceUsedSpaceRequest) (*AnnounceUsedSpaceResponse, error) } diff --git a/object/grpc/service_grpc.pb.go b/object/grpc/service_grpc.pb.go index 23906d6..6b1c32a 100644 --- a/object/grpc/service_grpc.pb.go +++ b/object/grpc/service_grpc.pb.go @@ -30,32 +30,32 @@ type ObjectServiceClient interface { // keeping the receiving order. // // Extended headers can change `Get` behaviour: - // - [ __SYSTEM__NETMAP_EPOCH ] \ - // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ - // Will use the requsted version of Network Map for object placement - // calculation. - // - [ __SYSTEM__NETMAP_LOOKUP_DEPTH ] \ - // (`__NEOFS__NETMAP_LOOKUP_DEPTH` is deprecated) \ - // Will try older versions (starting from `__SYSTEM__NETMAP_EPOCH` (`__NEOFS__NETMAP_EPOCH` is deprecated) if specified or - // the latest one otherwise) of Network Map to find an object until the depth - // limit is reached. + // * [ __SYSTEM__NETMAP_EPOCH ] \ + // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ + // Will use the requsted version of Network Map for object placement + // calculation. + // * [ __SYSTEM__NETMAP_LOOKUP_DEPTH ] \ + // (`__NEOFS__NETMAP_LOOKUP_DEPTH` is deprecated) \ + // Will try older versions (starting from `__SYSTEM__NETMAP_EPOCH` (`__NEOFS__NETMAP_EPOCH` is deprecated) if specified or + // the latest one otherwise) of Network Map to find an object until the depth + // limit is reached. // // Please refer to detailed `XHeader` description. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // object has been successfully read; - // - Common failures (SECTION_FAILURE_COMMON); - // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ - // read access to the object is denied; - // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ - // object not found in container; - // - **OBJECT_ALREADY_REMOVED** (2052, SECTION_OBJECT): \ - // the requested object has been marked as deleted; - // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ - // object container not found; - // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ - // provided session token has expired. + // - **OK** (0, SECTION_SUCCESS): \ + // object has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON); + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // read access to the object is denied; + // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ + // object not found in container; + // - **OBJECT_ALREADY_REMOVED** (2052, SECTION_OBJECT): \ + // the requested object has been marked as deleted; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // object container not found; + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (ObjectService_GetClient, error) // Put the object into container. Request uses gRPC stream. First message // SHOULD be of PutHeader type. `ContainerID` and `OwnerID` of an object @@ -65,107 +65,106 @@ type ObjectServiceClient interface { // Chunk messages SHOULD be sent in the direct order of fragmentation. // // Extended headers can change `Put` behaviour: - // - [ __SYSTEM__NETMAP_EPOCH \ - // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ - // Will use the requsted version of Network Map for object placement - // calculation. + // * [ __SYSTEM__NETMAP_EPOCH \ + // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ + // Will use the requsted version of Network Map for object placement + // calculation. // // Please refer to detailed `XHeader` description. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // object has been successfully saved in the container; - // - Common failures (SECTION_FAILURE_COMMON); - // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ - // write access to the container is denied; - // - **LOCKED** (2050, SECTION_OBJECT): \ - // placement of an object of type TOMBSTONE that includes at least one locked - // object is prohibited; - // - **LOCK_NON_REGULAR_OBJECT** (2051, SECTION_OBJECT): \ - // placement of an object of type LOCK that includes at least one object of - // type other than REGULAR is prohibited; - // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ - // object storage container not found; - // - **TOKEN_NOT_FOUND** (4096, SECTION_SESSION): \ - // (for trusted object preparation) session private key does not exist or has - // + // - **OK** (0, SECTION_SUCCESS): \ + // object has been successfully saved in the container; + // - Common failures (SECTION_FAILURE_COMMON); + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // write access to the container is denied; + // - **LOCKED** (2050, SECTION_OBJECT): \ + // placement of an object of type TOMBSTONE that includes at least one locked + // object is prohibited; + // - **LOCK_NON_REGULAR_OBJECT** (2051, SECTION_OBJECT): \ + // placement of an object of type LOCK that includes at least one object of + // type other than REGULAR is prohibited; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // object storage container not found; + // - **TOKEN_NOT_FOUND** (4096, SECTION_SESSION): \ + // (for trusted object preparation) session private key does not exist or has // been deleted; - // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ - // provided session token has expired. + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. Put(ctx context.Context, opts ...grpc.CallOption) (ObjectService_PutClient, error) // Delete the object from a container. There is no immediate removal // guarantee. Object will be marked for removal and deleted eventually. // // Extended headers can change `Delete` behaviour: - // - [ __SYSTEM__NETMAP_EPOCH ] \ - // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ - // Will use the requested version of Network Map for object placement - // calculation. + // * [ __SYSTEM__NETMAP_EPOCH ] \ + // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ + // Will use the requested version of Network Map for object placement + // calculation. // // Please refer to detailed `XHeader` description. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // object has been successfully marked to be removed from the container; - // - Common failures (SECTION_FAILURE_COMMON); - // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ - // delete access to the object is denied; - // - **LOCKED** (2050, SECTION_OBJECT): \ - // deleting a locked object is prohibited; - // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ - // object container not found; - // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ - // provided session token has expired. + // - **OK** (0, SECTION_SUCCESS): \ + // object has been successfully marked to be removed from the container; + // - Common failures (SECTION_FAILURE_COMMON); + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // delete access to the object is denied; + // - **LOCKED** (2050, SECTION_OBJECT): \ + // deleting a locked object is prohibited; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // object container not found; + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteResponse, error) // Returns the object Headers without data payload. By default full header is // returned. If `main_only` request field is set, the short header with only // the very minimal information will be returned instead. // // Extended headers can change `Head` behaviour: - // - [ __SYSTEM__NETMAP_EPOCH ] \ - // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ - // Will use the requested version of Network Map for object placement - // calculation. + // * [ __SYSTEM__NETMAP_EPOCH ] \ + // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ + // Will use the requested version of Network Map for object placement + // calculation. // // Please refer to detailed `XHeader` description. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // object header has been successfully read; - // - Common failures (SECTION_FAILURE_COMMON); - // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ - // access to operation HEAD of the object is denied; - // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ - // object not found in container; - // - **OBJECT_ALREADY_REMOVED** (2052, SECTION_OBJECT): \ - // the requested object has been marked as deleted; - // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ - // object container not found; - // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ - // provided session token has expired. + // - **OK** (0, SECTION_SUCCESS): \ + // object header has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON); + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // access to operation HEAD of the object is denied; + // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ + // object not found in container; + // - **OBJECT_ALREADY_REMOVED** (2052, SECTION_OBJECT): \ + // the requested object has been marked as deleted; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // object container not found; + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. Head(ctx context.Context, in *HeadRequest, opts ...grpc.CallOption) (*HeadResponse, error) // Search objects in container. Search query allows to match by Object // Header's filed values. Please see the corresponding NeoFS Technical // Specification section for more details. // // Extended headers can change `Search` behaviour: - // - [ __SYSTEM__NETMAP_EPOCH ] \ - // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ - // Will use the requested version of Network Map for object placement - // calculation. + // * [ __SYSTEM__NETMAP_EPOCH ] \ + // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ + // Will use the requested version of Network Map for object placement + // calculation. // // Please refer to detailed `XHeader` description. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // objects have been successfully selected; - // - Common failures (SECTION_FAILURE_COMMON); - // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ - // access to operation SEARCH of the object is denied; - // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ - // search container not found; - // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ - // provided session token has expired. + // - **OK** (0, SECTION_SUCCESS): \ + // objects have been successfully selected; + // - Common failures (SECTION_FAILURE_COMMON); + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // access to operation SEARCH of the object is denied; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // search container not found; + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. Search(ctx context.Context, in *SearchRequest, opts ...grpc.CallOption) (ObjectService_SearchClient, error) // Get byte range of data payload. Range is set as an (offset, length) tuple. // Like in `Get` method, the response uses gRPC stream. Requested range can be @@ -173,33 +172,33 @@ type ObjectServiceClient interface { // order. // // Extended headers can change `GetRange` behaviour: - // - [ __SYSTEM__NETMAP_EPOCH ] \ - // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ - // Will use the requested version of Network Map for object placement - // calculation. - // - [ __SYSTEM__NETMAP_LOOKUP_DEPTH ] \ - // (`__NEOFS__NETMAP_LOOKUP_DEPTH` is deprecated) \ - // Will try older versions of Network Map to find an object until the depth - // limit is reached. + // * [ __SYSTEM__NETMAP_EPOCH ] \ + // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ + // Will use the requested version of Network Map for object placement + // calculation. + // * [ __SYSTEM__NETMAP_LOOKUP_DEPTH ] \ + // (`__NEOFS__NETMAP_LOOKUP_DEPTH` is deprecated) \ + // Will try older versions of Network Map to find an object until the depth + // limit is reached. // // Please refer to detailed `XHeader` description. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // data range of the object payload has been successfully read; - // - Common failures (SECTION_FAILURE_COMMON); - // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ - // access to operation RANGE of the object is denied; - // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ - // object not found in container; - // - **OBJECT_ALREADY_REMOVED** (2052, SECTION_OBJECT): \ - // the requested object has been marked as deleted. - // - **OUT_OF_RANGE** (2053, SECTION_OBJECT): \ - // the requested range is out of bounds; - // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ - // object container not found; - // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ - // provided session token has expired. + // - **OK** (0, SECTION_SUCCESS): \ + // data range of the object payload has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON); + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // access to operation RANGE of the object is denied; + // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ + // object not found in container; + // - **OBJECT_ALREADY_REMOVED** (2052, SECTION_OBJECT): \ + // the requested object has been marked as deleted. + // - **OUT_OF_RANGE** (2053, SECTION_OBJECT): \ + // the requested range is out of bounds; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // object container not found; + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. GetRange(ctx context.Context, in *GetRangeRequest, opts ...grpc.CallOption) (ObjectService_GetRangeClient, error) // Returns homomorphic or regular hash of object's payload range after // applying XOR operation with the provided `salt`. Ranges are set of (offset, @@ -207,31 +206,31 @@ type ObjectServiceClient interface { // the request. Note that hash is calculated for XORed data. // // Extended headers can change `GetRangeHash` behaviour: - // - [ __SYSTEM__NETMAP_EPOCH ] \ - // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ - // Will use the requested version of Network Map for object placement - // calculation. - // - [ __SYSTEM__NETMAP_LOOKUP_DEPTH ] \ - // (`__NEOFS__NETMAP_LOOKUP_DEPTH` is deprecated) \ - // Will try older versions of Network Map to find an object until the depth - // limit is reached. + // * [ __SYSTEM__NETMAP_EPOCH ] \ + // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ + // Will use the requested version of Network Map for object placement + // calculation. + // * [ __SYSTEM__NETMAP_LOOKUP_DEPTH ] \ + // (`__NEOFS__NETMAP_LOOKUP_DEPTH` is deprecated) \ + // Will try older versions of Network Map to find an object until the depth + // limit is reached. // // Please refer to detailed `XHeader` description. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // data range of the object payload has been successfully hashed; - // - Common failures (SECTION_FAILURE_COMMON); - // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ - // access to operation RANGEHASH of the object is denied; - // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ - // object not found in container; - // - **OUT_OF_RANGE** (2053, SECTION_OBJECT): \ - // the requested range is out of bounds; - // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ - // object container not found; - // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ - // provided session token has expired. + // - **OK** (0, SECTION_SUCCESS): \ + // data range of the object payload has been successfully hashed; + // - Common failures (SECTION_FAILURE_COMMON); + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // access to operation RANGEHASH of the object is denied; + // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ + // object not found in container; + // - **OUT_OF_RANGE** (2053, SECTION_OBJECT): \ + // the requested range is out of bounds; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // object container not found; + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. GetRangeHash(ctx context.Context, in *GetRangeHashRequest, opts ...grpc.CallOption) (*GetRangeHashResponse, error) } @@ -412,32 +411,32 @@ type ObjectServiceServer interface { // keeping the receiving order. // // Extended headers can change `Get` behaviour: - // - [ __SYSTEM__NETMAP_EPOCH ] \ - // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ - // Will use the requsted version of Network Map for object placement - // calculation. - // - [ __SYSTEM__NETMAP_LOOKUP_DEPTH ] \ - // (`__NEOFS__NETMAP_LOOKUP_DEPTH` is deprecated) \ - // Will try older versions (starting from `__SYSTEM__NETMAP_EPOCH` (`__NEOFS__NETMAP_EPOCH` is deprecated) if specified or - // the latest one otherwise) of Network Map to find an object until the depth - // limit is reached. + // * [ __SYSTEM__NETMAP_EPOCH ] \ + // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ + // Will use the requsted version of Network Map for object placement + // calculation. + // * [ __SYSTEM__NETMAP_LOOKUP_DEPTH ] \ + // (`__NEOFS__NETMAP_LOOKUP_DEPTH` is deprecated) \ + // Will try older versions (starting from `__SYSTEM__NETMAP_EPOCH` (`__NEOFS__NETMAP_EPOCH` is deprecated) if specified or + // the latest one otherwise) of Network Map to find an object until the depth + // limit is reached. // // Please refer to detailed `XHeader` description. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // object has been successfully read; - // - Common failures (SECTION_FAILURE_COMMON); - // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ - // read access to the object is denied; - // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ - // object not found in container; - // - **OBJECT_ALREADY_REMOVED** (2052, SECTION_OBJECT): \ - // the requested object has been marked as deleted; - // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ - // object container not found; - // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ - // provided session token has expired. + // - **OK** (0, SECTION_SUCCESS): \ + // object has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON); + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // read access to the object is denied; + // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ + // object not found in container; + // - **OBJECT_ALREADY_REMOVED** (2052, SECTION_OBJECT): \ + // the requested object has been marked as deleted; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // object container not found; + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. Get(*GetRequest, ObjectService_GetServer) error // Put the object into container. Request uses gRPC stream. First message // SHOULD be of PutHeader type. `ContainerID` and `OwnerID` of an object @@ -447,107 +446,106 @@ type ObjectServiceServer interface { // Chunk messages SHOULD be sent in the direct order of fragmentation. // // Extended headers can change `Put` behaviour: - // - [ __SYSTEM__NETMAP_EPOCH \ - // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ - // Will use the requsted version of Network Map for object placement - // calculation. + // * [ __SYSTEM__NETMAP_EPOCH \ + // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ + // Will use the requsted version of Network Map for object placement + // calculation. // // Please refer to detailed `XHeader` description. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // object has been successfully saved in the container; - // - Common failures (SECTION_FAILURE_COMMON); - // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ - // write access to the container is denied; - // - **LOCKED** (2050, SECTION_OBJECT): \ - // placement of an object of type TOMBSTONE that includes at least one locked - // object is prohibited; - // - **LOCK_NON_REGULAR_OBJECT** (2051, SECTION_OBJECT): \ - // placement of an object of type LOCK that includes at least one object of - // type other than REGULAR is prohibited; - // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ - // object storage container not found; - // - **TOKEN_NOT_FOUND** (4096, SECTION_SESSION): \ - // (for trusted object preparation) session private key does not exist or has - // + // - **OK** (0, SECTION_SUCCESS): \ + // object has been successfully saved in the container; + // - Common failures (SECTION_FAILURE_COMMON); + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // write access to the container is denied; + // - **LOCKED** (2050, SECTION_OBJECT): \ + // placement of an object of type TOMBSTONE that includes at least one locked + // object is prohibited; + // - **LOCK_NON_REGULAR_OBJECT** (2051, SECTION_OBJECT): \ + // placement of an object of type LOCK that includes at least one object of + // type other than REGULAR is prohibited; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // object storage container not found; + // - **TOKEN_NOT_FOUND** (4096, SECTION_SESSION): \ + // (for trusted object preparation) session private key does not exist or has // been deleted; - // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ - // provided session token has expired. + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. Put(ObjectService_PutServer) error // Delete the object from a container. There is no immediate removal // guarantee. Object will be marked for removal and deleted eventually. // // Extended headers can change `Delete` behaviour: - // - [ __SYSTEM__NETMAP_EPOCH ] \ - // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ - // Will use the requested version of Network Map for object placement - // calculation. + // * [ __SYSTEM__NETMAP_EPOCH ] \ + // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ + // Will use the requested version of Network Map for object placement + // calculation. // // Please refer to detailed `XHeader` description. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // object has been successfully marked to be removed from the container; - // - Common failures (SECTION_FAILURE_COMMON); - // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ - // delete access to the object is denied; - // - **LOCKED** (2050, SECTION_OBJECT): \ - // deleting a locked object is prohibited; - // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ - // object container not found; - // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ - // provided session token has expired. + // - **OK** (0, SECTION_SUCCESS): \ + // object has been successfully marked to be removed from the container; + // - Common failures (SECTION_FAILURE_COMMON); + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // delete access to the object is denied; + // - **LOCKED** (2050, SECTION_OBJECT): \ + // deleting a locked object is prohibited; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // object container not found; + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. Delete(context.Context, *DeleteRequest) (*DeleteResponse, error) // Returns the object Headers without data payload. By default full header is // returned. If `main_only` request field is set, the short header with only // the very minimal information will be returned instead. // // Extended headers can change `Head` behaviour: - // - [ __SYSTEM__NETMAP_EPOCH ] \ - // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ - // Will use the requested version of Network Map for object placement - // calculation. + // * [ __SYSTEM__NETMAP_EPOCH ] \ + // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ + // Will use the requested version of Network Map for object placement + // calculation. // // Please refer to detailed `XHeader` description. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // object header has been successfully read; - // - Common failures (SECTION_FAILURE_COMMON); - // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ - // access to operation HEAD of the object is denied; - // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ - // object not found in container; - // - **OBJECT_ALREADY_REMOVED** (2052, SECTION_OBJECT): \ - // the requested object has been marked as deleted; - // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ - // object container not found; - // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ - // provided session token has expired. + // - **OK** (0, SECTION_SUCCESS): \ + // object header has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON); + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // access to operation HEAD of the object is denied; + // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ + // object not found in container; + // - **OBJECT_ALREADY_REMOVED** (2052, SECTION_OBJECT): \ + // the requested object has been marked as deleted; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // object container not found; + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. Head(context.Context, *HeadRequest) (*HeadResponse, error) // Search objects in container. Search query allows to match by Object // Header's filed values. Please see the corresponding NeoFS Technical // Specification section for more details. // // Extended headers can change `Search` behaviour: - // - [ __SYSTEM__NETMAP_EPOCH ] \ - // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ - // Will use the requested version of Network Map for object placement - // calculation. + // * [ __SYSTEM__NETMAP_EPOCH ] \ + // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ + // Will use the requested version of Network Map for object placement + // calculation. // // Please refer to detailed `XHeader` description. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // objects have been successfully selected; - // - Common failures (SECTION_FAILURE_COMMON); - // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ - // access to operation SEARCH of the object is denied; - // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ - // search container not found; - // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ - // provided session token has expired. + // - **OK** (0, SECTION_SUCCESS): \ + // objects have been successfully selected; + // - Common failures (SECTION_FAILURE_COMMON); + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // access to operation SEARCH of the object is denied; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // search container not found; + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. Search(*SearchRequest, ObjectService_SearchServer) error // Get byte range of data payload. Range is set as an (offset, length) tuple. // Like in `Get` method, the response uses gRPC stream. Requested range can be @@ -555,33 +553,33 @@ type ObjectServiceServer interface { // order. // // Extended headers can change `GetRange` behaviour: - // - [ __SYSTEM__NETMAP_EPOCH ] \ - // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ - // Will use the requested version of Network Map for object placement - // calculation. - // - [ __SYSTEM__NETMAP_LOOKUP_DEPTH ] \ - // (`__NEOFS__NETMAP_LOOKUP_DEPTH` is deprecated) \ - // Will try older versions of Network Map to find an object until the depth - // limit is reached. + // * [ __SYSTEM__NETMAP_EPOCH ] \ + // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ + // Will use the requested version of Network Map for object placement + // calculation. + // * [ __SYSTEM__NETMAP_LOOKUP_DEPTH ] \ + // (`__NEOFS__NETMAP_LOOKUP_DEPTH` is deprecated) \ + // Will try older versions of Network Map to find an object until the depth + // limit is reached. // // Please refer to detailed `XHeader` description. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // data range of the object payload has been successfully read; - // - Common failures (SECTION_FAILURE_COMMON); - // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ - // access to operation RANGE of the object is denied; - // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ - // object not found in container; - // - **OBJECT_ALREADY_REMOVED** (2052, SECTION_OBJECT): \ - // the requested object has been marked as deleted. - // - **OUT_OF_RANGE** (2053, SECTION_OBJECT): \ - // the requested range is out of bounds; - // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ - // object container not found; - // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ - // provided session token has expired. + // - **OK** (0, SECTION_SUCCESS): \ + // data range of the object payload has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON); + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // access to operation RANGE of the object is denied; + // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ + // object not found in container; + // - **OBJECT_ALREADY_REMOVED** (2052, SECTION_OBJECT): \ + // the requested object has been marked as deleted. + // - **OUT_OF_RANGE** (2053, SECTION_OBJECT): \ + // the requested range is out of bounds; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // object container not found; + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. GetRange(*GetRangeRequest, ObjectService_GetRangeServer) error // Returns homomorphic or regular hash of object's payload range after // applying XOR operation with the provided `salt`. Ranges are set of (offset, @@ -589,31 +587,31 @@ type ObjectServiceServer interface { // the request. Note that hash is calculated for XORed data. // // Extended headers can change `GetRangeHash` behaviour: - // - [ __SYSTEM__NETMAP_EPOCH ] \ - // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ - // Will use the requested version of Network Map for object placement - // calculation. - // - [ __SYSTEM__NETMAP_LOOKUP_DEPTH ] \ - // (`__NEOFS__NETMAP_LOOKUP_DEPTH` is deprecated) \ - // Will try older versions of Network Map to find an object until the depth - // limit is reached. + // * [ __SYSTEM__NETMAP_EPOCH ] \ + // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ + // Will use the requested version of Network Map for object placement + // calculation. + // * [ __SYSTEM__NETMAP_LOOKUP_DEPTH ] \ + // (`__NEOFS__NETMAP_LOOKUP_DEPTH` is deprecated) \ + // Will try older versions of Network Map to find an object until the depth + // limit is reached. // // Please refer to detailed `XHeader` description. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // data range of the object payload has been successfully hashed; - // - Common failures (SECTION_FAILURE_COMMON); - // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ - // access to operation RANGEHASH of the object is denied; - // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ - // object not found in container; - // - **OUT_OF_RANGE** (2053, SECTION_OBJECT): \ - // the requested range is out of bounds; - // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ - // object container not found; - // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ - // provided session token has expired. + // - **OK** (0, SECTION_SUCCESS): \ + // data range of the object payload has been successfully hashed; + // - Common failures (SECTION_FAILURE_COMMON); + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // access to operation RANGEHASH of the object is denied; + // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ + // object not found in container; + // - **OUT_OF_RANGE** (2053, SECTION_OBJECT): \ + // the requested range is out of bounds; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // object container not found; + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. GetRangeHash(context.Context, *GetRangeHashRequest) (*GetRangeHashResponse, error) } From b3ccd0166f503cb7dad13cef6fa2ae18d61f3218 Mon Sep 17 00:00:00 2001 From: Denis Kirillov Date: Tue, 21 Feb 2023 11:23:08 +0300 Subject: [PATCH 1057/1196] [#17] acl: Add impersonate flag to bearer token Signed-off-by: Denis Kirillov --- CHANGELOG.md | 2 + acl/convert.go | 3 ++ acl/grpc/types.go | 5 +++ acl/grpc/types.pb.go | 91 +++++++++++++++++++++++++------------------- acl/marshal.go | 5 ++- acl/types.go | 14 +++++++ 6 files changed, 80 insertions(+), 40 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7ab694e..8f7a84e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,8 @@ ## [Unreleased] ### Added +- Add impersonate flag to bearer token (#17) + ### Fixed ### Changed ### Updated diff --git a/acl/convert.go b/acl/convert.go index d42aebd..3020f4d 100644 --- a/acl/convert.go +++ b/acl/convert.go @@ -427,6 +427,7 @@ func (bt *BearerTokenBody) ToGRPCMessage() grpc.Message { m.SetOwnerId(bt.ownerID.ToGRPCMessage().(*refsGRPC.OwnerID)) m.SetLifetime(bt.lifetime.ToGRPCMessage().(*acl.BearerToken_Body_TokenLifetime)) m.SetEaclTable(bt.eacl.ToGRPCMessage().(*acl.EACLTable)) + m.SetImpersonate(bt.impersonate) } return m @@ -479,6 +480,8 @@ func (bt *BearerTokenBody) FromGRPCMessage(m grpc.Message) error { err = bt.eacl.FromGRPCMessage(eacl) } + bt.impersonate = v.GetAllowImpersonate() + return err } diff --git a/acl/grpc/types.go b/acl/grpc/types.go index e1e5336..b07f893 100644 --- a/acl/grpc/types.go +++ b/acl/grpc/types.go @@ -84,6 +84,11 @@ func (m *BearerToken_Body) SetLifetime(v *BearerToken_Body_TokenLifetime) { m.Lifetime = v } +// SetImpersonate allows impersonate. +func (m *BearerToken_Body) SetImpersonate(v bool) { + m.AllowImpersonate = v +} + // SetBody sets bearer token body. func (m *BearerToken) SetBody(v *BearerToken_Body) { m.Body = v diff --git a/acl/grpc/types.pb.go b/acl/grpc/types.pb.go index 3581b88..583f89a 100644 --- a/acl/grpc/types.pb.go +++ b/acl/grpc/types.pb.go @@ -712,6 +712,9 @@ type BearerToken_Body struct { OwnerId *grpc.OwnerID `protobuf:"bytes,2,opt,name=owner_id,json=ownerID,proto3" json:"owner_id,omitempty"` // Token expiration and valid time period parameters Lifetime *BearerToken_Body_TokenLifetime `protobuf:"bytes,3,opt,name=lifetime,proto3" json:"lifetime,omitempty"` + // AllowImpersonate flag to consider token signer as request owner. + // If this field is true extended ACL table in token body isn't processed. + AllowImpersonate bool `protobuf:"varint,4,opt,name=allow_impersonate,json=allowImpersonate,proto3" json:"allow_impersonate,omitempty"` } func (x *BearerToken_Body) Reset() { @@ -767,6 +770,13 @@ func (x *BearerToken_Body) GetLifetime() *BearerToken_Body_TokenLifetime { return nil } +func (x *BearerToken_Body) GetAllowImpersonate() bool { + if x != nil { + return x.AllowImpersonate + } + return false +} + // Lifetime parameters of the token. Field names taken from // [rfc7519](https://tools.ietf.org/html/rfc7519). type BearerToken_Body_TokenLifetime struct { @@ -883,14 +893,14 @@ var file_acl_grpc_types_proto_rawDesc = []byte{ 0x63, 0x6f, 0x72, 0x64, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x45, 0x41, 0x43, 0x4c, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x07, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x22, - 0x83, 0x03, 0x0a, 0x0b, 0x42, 0x65, 0x61, 0x72, 0x65, 0x72, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, + 0xb0, 0x03, 0x0a, 0x0b, 0x42, 0x65, 0x61, 0x72, 0x65, 0x72, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x33, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x42, 0x65, 0x61, 0x72, 0x65, 0x72, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x37, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, - 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x1a, 0x85, 0x02, + 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x1a, 0xb2, 0x02, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x37, 0x0a, 0x0a, 0x65, 0x61, 0x63, 0x6c, 0x5f, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x45, 0x41, 0x43, 0x4c, 0x54, @@ -902,43 +912,46 @@ var file_acl_grpc_types_proto_rawDesc = []byte{ 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x42, 0x65, 0x61, 0x72, 0x65, 0x72, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x2e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x4c, 0x69, 0x66, 0x65, - 0x74, 0x69, 0x6d, 0x65, 0x52, 0x08, 0x6c, 0x69, 0x66, 0x65, 0x74, 0x69, 0x6d, 0x65, 0x1a, 0x45, - 0x0a, 0x0d, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x4c, 0x69, 0x66, 0x65, 0x74, 0x69, 0x6d, 0x65, 0x12, - 0x10, 0x0a, 0x03, 0x65, 0x78, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x65, 0x78, - 0x70, 0x12, 0x10, 0x0a, 0x03, 0x6e, 0x62, 0x66, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, - 0x6e, 0x62, 0x66, 0x12, 0x10, 0x0a, 0x03, 0x69, 0x61, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, - 0x52, 0x03, 0x69, 0x61, 0x74, 0x2a, 0x3e, 0x0a, 0x04, 0x52, 0x6f, 0x6c, 0x65, 0x12, 0x14, 0x0a, - 0x10, 0x52, 0x4f, 0x4c, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, - 0x44, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x55, 0x53, 0x45, 0x52, 0x10, 0x01, 0x12, 0x0a, 0x0a, - 0x06, 0x53, 0x59, 0x53, 0x54, 0x45, 0x4d, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x4f, 0x54, 0x48, - 0x45, 0x52, 0x53, 0x10, 0x03, 0x2a, 0x4f, 0x0a, 0x09, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x54, 0x79, - 0x70, 0x65, 0x12, 0x1a, 0x0a, 0x16, 0x4d, 0x41, 0x54, 0x43, 0x48, 0x5f, 0x54, 0x59, 0x50, 0x45, - 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x10, - 0x0a, 0x0c, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x5f, 0x45, 0x51, 0x55, 0x41, 0x4c, 0x10, 0x01, - 0x12, 0x14, 0x0a, 0x10, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x45, - 0x51, 0x55, 0x41, 0x4c, 0x10, 0x02, 0x2a, 0x7a, 0x0a, 0x09, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x12, 0x19, 0x0a, 0x15, 0x4f, 0x50, 0x45, 0x52, 0x41, 0x54, 0x49, 0x4f, 0x4e, - 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x07, - 0x0a, 0x03, 0x47, 0x45, 0x54, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x48, 0x45, 0x41, 0x44, 0x10, - 0x02, 0x12, 0x07, 0x0a, 0x03, 0x50, 0x55, 0x54, 0x10, 0x03, 0x12, 0x0a, 0x0a, 0x06, 0x44, 0x45, - 0x4c, 0x45, 0x54, 0x45, 0x10, 0x04, 0x12, 0x0a, 0x0a, 0x06, 0x53, 0x45, 0x41, 0x52, 0x43, 0x48, - 0x10, 0x05, 0x12, 0x0c, 0x0a, 0x08, 0x47, 0x45, 0x54, 0x52, 0x41, 0x4e, 0x47, 0x45, 0x10, 0x06, - 0x12, 0x10, 0x0a, 0x0c, 0x47, 0x45, 0x54, 0x52, 0x41, 0x4e, 0x47, 0x45, 0x48, 0x41, 0x53, 0x48, - 0x10, 0x07, 0x2a, 0x35, 0x0a, 0x06, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x12, - 0x41, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, - 0x45, 0x44, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x41, 0x4c, 0x4c, 0x4f, 0x57, 0x10, 0x01, 0x12, - 0x08, 0x0a, 0x04, 0x44, 0x45, 0x4e, 0x59, 0x10, 0x02, 0x2a, 0x4a, 0x0a, 0x0a, 0x48, 0x65, 0x61, - 0x64, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x12, 0x48, 0x45, 0x41, 0x44, 0x45, - 0x52, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, - 0x0b, 0x0a, 0x07, 0x52, 0x45, 0x51, 0x55, 0x45, 0x53, 0x54, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, - 0x4f, 0x42, 0x4a, 0x45, 0x43, 0x54, 0x10, 0x02, 0x12, 0x0b, 0x0a, 0x07, 0x53, 0x45, 0x52, 0x56, - 0x49, 0x43, 0x45, 0x10, 0x03, 0x42, 0x58, 0x5a, 0x3c, 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, 0x61, - 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x61, 0x63, 0x6c, 0x2f, 0x67, 0x72, 0x70, - 0x63, 0x3b, 0x61, 0x63, 0x6c, 0xaa, 0x02, 0x17, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, - 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x41, 0x63, 0x6c, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x74, 0x69, 0x6d, 0x65, 0x52, 0x08, 0x6c, 0x69, 0x66, 0x65, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x2b, + 0x0a, 0x11, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x5f, 0x69, 0x6d, 0x70, 0x65, 0x72, 0x73, 0x6f, 0x6e, + 0x61, 0x74, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x61, 0x6c, 0x6c, 0x6f, 0x77, + 0x49, 0x6d, 0x70, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x61, 0x74, 0x65, 0x1a, 0x45, 0x0a, 0x0d, 0x54, + 0x6f, 0x6b, 0x65, 0x6e, 0x4c, 0x69, 0x66, 0x65, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, + 0x65, 0x78, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x65, 0x78, 0x70, 0x12, 0x10, + 0x0a, 0x03, 0x6e, 0x62, 0x66, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x6e, 0x62, 0x66, + 0x12, 0x10, 0x0a, 0x03, 0x69, 0x61, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x69, + 0x61, 0x74, 0x2a, 0x3e, 0x0a, 0x04, 0x52, 0x6f, 0x6c, 0x65, 0x12, 0x14, 0x0a, 0x10, 0x52, 0x4f, + 0x4c, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, + 0x12, 0x08, 0x0a, 0x04, 0x55, 0x53, 0x45, 0x52, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x53, 0x59, + 0x53, 0x54, 0x45, 0x4d, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x4f, 0x54, 0x48, 0x45, 0x52, 0x53, + 0x10, 0x03, 0x2a, 0x4f, 0x0a, 0x09, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x54, 0x79, 0x70, 0x65, 0x12, + 0x1a, 0x0a, 0x16, 0x4d, 0x41, 0x54, 0x43, 0x48, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, + 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x10, 0x0a, 0x0c, 0x53, + 0x54, 0x52, 0x49, 0x4e, 0x47, 0x5f, 0x45, 0x51, 0x55, 0x41, 0x4c, 0x10, 0x01, 0x12, 0x14, 0x0a, + 0x10, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x45, 0x51, 0x55, 0x41, + 0x4c, 0x10, 0x02, 0x2a, 0x7a, 0x0a, 0x09, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x12, 0x19, 0x0a, 0x15, 0x4f, 0x50, 0x45, 0x52, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, + 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x47, + 0x45, 0x54, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x48, 0x45, 0x41, 0x44, 0x10, 0x02, 0x12, 0x07, + 0x0a, 0x03, 0x50, 0x55, 0x54, 0x10, 0x03, 0x12, 0x0a, 0x0a, 0x06, 0x44, 0x45, 0x4c, 0x45, 0x54, + 0x45, 0x10, 0x04, 0x12, 0x0a, 0x0a, 0x06, 0x53, 0x45, 0x41, 0x52, 0x43, 0x48, 0x10, 0x05, 0x12, + 0x0c, 0x0a, 0x08, 0x47, 0x45, 0x54, 0x52, 0x41, 0x4e, 0x47, 0x45, 0x10, 0x06, 0x12, 0x10, 0x0a, + 0x0c, 0x47, 0x45, 0x54, 0x52, 0x41, 0x4e, 0x47, 0x45, 0x48, 0x41, 0x53, 0x48, 0x10, 0x07, 0x2a, + 0x35, 0x0a, 0x06, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x12, 0x41, 0x43, 0x54, + 0x49, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, + 0x00, 0x12, 0x09, 0x0a, 0x05, 0x41, 0x4c, 0x4c, 0x4f, 0x57, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, + 0x44, 0x45, 0x4e, 0x59, 0x10, 0x02, 0x2a, 0x4a, 0x0a, 0x0a, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, + 0x54, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x12, 0x48, 0x45, 0x41, 0x44, 0x45, 0x52, 0x5f, 0x55, + 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, + 0x52, 0x45, 0x51, 0x55, 0x45, 0x53, 0x54, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x4f, 0x42, 0x4a, + 0x45, 0x43, 0x54, 0x10, 0x02, 0x12, 0x0b, 0x0a, 0x07, 0x53, 0x45, 0x52, 0x56, 0x49, 0x43, 0x45, + 0x10, 0x03, 0x42, 0x58, 0x5a, 0x3c, 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, 0x61, 0x70, 0x69, 0x2d, + 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x61, 0x63, 0x6c, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x61, + 0x63, 0x6c, 0xaa, 0x02, 0x17, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, + 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x41, 0x63, 0x6c, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/acl/marshal.go b/acl/marshal.go index c56b90f..cd6c6dd 100644 --- a/acl/marshal.go +++ b/acl/marshal.go @@ -31,6 +31,7 @@ const ( bearerTokenBodyACLField = 1 bearerTokenBodyOwnerField = 2 bearerTokenBodyLifetimeField = 3 + bearerTokenBodyImpersonate = 4 bearerTokenBodyField = 1 bearerTokenSignatureField = 2 @@ -251,7 +252,8 @@ func (bt *BearerTokenBody) StableMarshal(buf []byte) []byte { offset += protoutil.NestedStructureMarshal(bearerTokenBodyACLField, buf[offset:], bt.eacl) offset += protoutil.NestedStructureMarshal(bearerTokenBodyOwnerField, buf[offset:], bt.ownerID) - protoutil.NestedStructureMarshal(bearerTokenBodyLifetimeField, buf[offset:], bt.lifetime) + offset += protoutil.NestedStructureMarshal(bearerTokenBodyLifetimeField, buf[offset:], bt.lifetime) + protoutil.BoolMarshal(bearerTokenBodyImpersonate, buf[offset:], bt.impersonate) return buf } @@ -264,6 +266,7 @@ func (bt *BearerTokenBody) StableSize() (size int) { size += protoutil.NestedStructureSize(bearerTokenBodyACLField, bt.eacl) size += protoutil.NestedStructureSize(bearerTokenBodyOwnerField, bt.ownerID) size += protoutil.NestedStructureSize(bearerTokenBodyLifetimeField, bt.lifetime) + size += protoutil.BoolSize(bearerTokenBodyImpersonate, bt.impersonate) return size } diff --git a/acl/types.go b/acl/types.go index 71d83ce..1524e7b 100644 --- a/acl/types.go +++ b/acl/types.go @@ -52,6 +52,8 @@ type BearerTokenBody struct { ownerID *refs.OwnerID lifetime *TokenLifetime + + impersonate bool } type BearerToken struct { @@ -340,6 +342,18 @@ func (bt *BearerTokenBody) SetLifetime(v *TokenLifetime) { bt.lifetime = v } +func (bt *BearerTokenBody) GetImpersonate() bool { + if bt != nil { + return bt.impersonate + } + + return false +} + +func (bt *BearerTokenBody) SetImpersonate(v bool) { + bt.impersonate = v +} + func (bt *BearerToken) GetBody() *BearerTokenBody { if bt != nil { return bt.body From d9347a05f027d337b214e80c4dfa9f3b11220cfb Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Mon, 17 Apr 2023 15:44:35 +0300 Subject: [PATCH 1058/1196] [#21] *: Drop reputation system Signed-off-by: Pavel Karpy --- CHANGELOG.md | 3 + accounting/grpc/service.pb.go | 2 +- accounting/grpc/service_grpc.pb.go | 10 +- accounting/grpc/types.pb.go | 2 +- acl/grpc/types.pb.go | 2 +- audit/grpc/types.pb.go | 2 +- container/grpc/service.pb.go | 2 +- container/grpc/service_grpc.pb.go | 148 +++--- container/grpc/types.pb.go | 2 +- lock/grpc/types.pb.go | 2 +- netmap/grpc/service.pb.go | 2 +- netmap/grpc/service_grpc.pb.go | 20 +- netmap/grpc/types.pb.go | 2 +- object/grpc/service.pb.go | 2 +- object/grpc/service_grpc.pb.go | 562 ++++++++++---------- object/grpc/types.pb.go | 2 +- refs/grpc/types.pb.go | 2 +- reputation/convert.go | 604 --------------------- reputation/grpc/service.go | 90 ---- reputation/grpc/service.pb.go | 808 ----------------------------- reputation/grpc/service_grpc.pb.go | 165 ------ reputation/grpc/types.go | 55 -- reputation/grpc/types.pb.go | 500 ------------------ reputation/json.go | 38 -- reputation/marshal.go | 276 ---------- reputation/message_test.go | 34 -- reputation/test/generate.go | 160 ------ reputation/types.go | 366 ------------- rpc/reputation.go | 46 -- session/grpc/service.pb.go | 2 +- session/grpc/service_grpc.pb.go | 10 +- session/grpc/types.pb.go | 2 +- signature/body.go | 11 - status/grpc/types.pb.go | 2 +- storagegroup/grpc/types.pb.go | 2 +- subnet/grpc/types.pb.go | 2 +- tombstone/grpc/types.pb.go | 2 +- util/proto/test/test.pb.go | 2 +- 38 files changed, 415 insertions(+), 3529 deletions(-) delete mode 100644 reputation/convert.go delete mode 100644 reputation/grpc/service.go delete mode 100644 reputation/grpc/service.pb.go delete mode 100644 reputation/grpc/service_grpc.pb.go delete mode 100644 reputation/grpc/types.go delete mode 100644 reputation/grpc/types.pb.go delete mode 100644 reputation/json.go delete mode 100644 reputation/marshal.go delete mode 100644 reputation/message_test.go delete mode 100644 reputation/test/generate.go delete mode 100644 reputation/types.go delete mode 100644 rpc/reputation.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f7a84e..27506b4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,9 @@ ### Fixed ### Changed +### Removed +- Reputation system (#21) + ### Updated ## 2.15.0 - 2023-04-11 diff --git a/accounting/grpc/service.pb.go b/accounting/grpc/service.pb.go index 196c7ab..9699622 100644 --- a/accounting/grpc/service.pb.go +++ b/accounting/grpc/service.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.0 +// protoc-gen-go v1.28.1 // protoc v3.21.9 // source: accounting/grpc/service.proto diff --git a/accounting/grpc/service_grpc.pb.go b/accounting/grpc/service_grpc.pb.go index f1cfeb5..1e1b17e 100644 --- a/accounting/grpc/service_grpc.pb.go +++ b/accounting/grpc/service_grpc.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.2.0 +// - protoc-gen-go-grpc v1.3.0 // - protoc v3.21.9 // source: accounting/grpc/service.proto @@ -18,6 +18,10 @@ import ( // Requires gRPC-Go v1.32.0 or later. const _ = grpc.SupportPackageIsVersion7 +const ( + AccountingService_Balance_FullMethodName = "/neo.fs.v2.accounting.AccountingService/Balance" +) + // 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. @@ -41,7 +45,7 @@ func NewAccountingServiceClient(cc grpc.ClientConnInterface) AccountingServiceCl func (c *accountingServiceClient) Balance(ctx context.Context, in *BalanceRequest, opts ...grpc.CallOption) (*BalanceResponse, error) { out := new(BalanceResponse) - err := c.cc.Invoke(ctx, "/neo.fs.v2.accounting.AccountingService/Balance", in, out, opts...) + err := c.cc.Invoke(ctx, AccountingService_Balance_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -90,7 +94,7 @@ func _AccountingService_Balance_Handler(srv interface{}, ctx context.Context, de } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/neo.fs.v2.accounting.AccountingService/Balance", + FullMethod: AccountingService_Balance_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(AccountingServiceServer).Balance(ctx, req.(*BalanceRequest)) diff --git a/accounting/grpc/types.pb.go b/accounting/grpc/types.pb.go index 322a56c..b8dff21 100644 --- a/accounting/grpc/types.pb.go +++ b/accounting/grpc/types.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.0 +// protoc-gen-go v1.28.1 // protoc v3.21.9 // source: accounting/grpc/types.proto diff --git a/acl/grpc/types.pb.go b/acl/grpc/types.pb.go index 583f89a..94a8e47 100644 --- a/acl/grpc/types.pb.go +++ b/acl/grpc/types.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.0 +// protoc-gen-go v1.28.1 // protoc v3.21.9 // source: acl/grpc/types.proto diff --git a/audit/grpc/types.pb.go b/audit/grpc/types.pb.go index b542ec2..a2cac43 100644 --- a/audit/grpc/types.pb.go +++ b/audit/grpc/types.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.0 +// protoc-gen-go v1.28.1 // protoc v3.21.9 // source: audit/grpc/types.proto diff --git a/container/grpc/service.pb.go b/container/grpc/service.pb.go index 6786337..e3bdaf0 100644 --- a/container/grpc/service.pb.go +++ b/container/grpc/service.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.0 +// protoc-gen-go v1.28.1 // protoc v3.21.9 // source: container/grpc/service.proto diff --git a/container/grpc/service_grpc.pb.go b/container/grpc/service_grpc.pb.go index 1de8b5f..c70bce7 100644 --- a/container/grpc/service_grpc.pb.go +++ b/container/grpc/service_grpc.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.2.0 +// - protoc-gen-go-grpc v1.3.0 // - protoc v3.21.9 // source: container/grpc/service.proto @@ -18,6 +18,16 @@ import ( // 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_SetExtendedACL_FullMethodName = "/neo.fs.v2.container.ContainerService/SetExtendedACL" + ContainerService_GetExtendedACL_FullMethodName = "/neo.fs.v2.container.ContainerService/GetExtendedACL" + ContainerService_AnnounceUsedSpace_FullMethodName = "/neo.fs.v2.container.ContainerService/AnnounceUsedSpace" +) + // 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. @@ -28,9 +38,9 @@ type ContainerServiceClient interface { // 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). + // - **OK** (0, SECTION_SUCCESS): \ + // request to save the container has been sent to the sidechain; + // - Common failures (SECTION_FAILURE_COMMON). 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 @@ -38,53 +48,53 @@ type ContainerServiceClient interface { // 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). + // - **OK** (0, SECTION_SUCCESS): \ + // request to remove the container has been sent to the sidechain; + // - Common failures (SECTION_FAILURE_COMMON). 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. + // - **OK** (0, SECTION_SUCCESS): \ + // container has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON); + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // requested container not found. Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*GetResponse, error) // 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). + // - **OK** (0, SECTION_SUCCESS): \ + // container list has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON). List(ctx context.Context, in *ListRequest, opts ...grpc.CallOption) (*ListResponse, error) // Invokes 'SetEACL' method of 'Container` smart contract and returns response // immediately. After one more block in sidechain, changes in an Extended ACL are // added into smart contract storage. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // request to save container eACL has been sent to the sidechain; - // - Common failures (SECTION_FAILURE_COMMON). + // - **OK** (0, SECTION_SUCCESS): \ + // request to save container eACL has been sent to the sidechain; + // - Common failures (SECTION_FAILURE_COMMON). SetExtendedACL(ctx context.Context, in *SetExtendedACLRequest, opts ...grpc.CallOption) (*SetExtendedACLResponse, error) // Returns Extended ACL table and signature from `Container` smart contract // storage. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // container eACL has been successfully read; - // - Common failures (SECTION_FAILURE_COMMON); - // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ - // container not found; - // - **EACL_NOT_FOUND** (3073, SECTION_CONTAINER): \ - // eACL table not found. + // - **OK** (0, SECTION_SUCCESS): \ + // container eACL has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON); + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // container not found; + // - **EACL_NOT_FOUND** (3073, SECTION_CONTAINER): \ + // eACL table not found. GetExtendedACL(ctx context.Context, in *GetExtendedACLRequest, opts ...grpc.CallOption) (*GetExtendedACLResponse, error) // Announces the space values used by the container for P2P synchronization. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // estimation of used space has been successfully announced; - // - Common failures (SECTION_FAILURE_COMMON). + // - **OK** (0, SECTION_SUCCESS): \ + // estimation of used space has been successfully announced; + // - Common failures (SECTION_FAILURE_COMMON). AnnounceUsedSpace(ctx context.Context, in *AnnounceUsedSpaceRequest, opts ...grpc.CallOption) (*AnnounceUsedSpaceResponse, error) } @@ -98,7 +108,7 @@ func NewContainerServiceClient(cc grpc.ClientConnInterface) ContainerServiceClie func (c *containerServiceClient) Put(ctx context.Context, in *PutRequest, opts ...grpc.CallOption) (*PutResponse, error) { out := new(PutResponse) - err := c.cc.Invoke(ctx, "/neo.fs.v2.container.ContainerService/Put", in, out, opts...) + err := c.cc.Invoke(ctx, ContainerService_Put_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -107,7 +117,7 @@ func (c *containerServiceClient) Put(ctx context.Context, in *PutRequest, opts . func (c *containerServiceClient) Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteResponse, error) { out := new(DeleteResponse) - err := c.cc.Invoke(ctx, "/neo.fs.v2.container.ContainerService/Delete", in, out, opts...) + err := c.cc.Invoke(ctx, ContainerService_Delete_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -116,7 +126,7 @@ func (c *containerServiceClient) Delete(ctx context.Context, in *DeleteRequest, func (c *containerServiceClient) Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*GetResponse, error) { out := new(GetResponse) - err := c.cc.Invoke(ctx, "/neo.fs.v2.container.ContainerService/Get", in, out, opts...) + err := c.cc.Invoke(ctx, ContainerService_Get_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -125,7 +135,7 @@ func (c *containerServiceClient) Get(ctx context.Context, in *GetRequest, opts . func (c *containerServiceClient) List(ctx context.Context, in *ListRequest, opts ...grpc.CallOption) (*ListResponse, error) { out := new(ListResponse) - err := c.cc.Invoke(ctx, "/neo.fs.v2.container.ContainerService/List", in, out, opts...) + err := c.cc.Invoke(ctx, ContainerService_List_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -134,7 +144,7 @@ func (c *containerServiceClient) List(ctx context.Context, in *ListRequest, opts func (c *containerServiceClient) SetExtendedACL(ctx context.Context, in *SetExtendedACLRequest, opts ...grpc.CallOption) (*SetExtendedACLResponse, error) { out := new(SetExtendedACLResponse) - err := c.cc.Invoke(ctx, "/neo.fs.v2.container.ContainerService/SetExtendedACL", in, out, opts...) + err := c.cc.Invoke(ctx, ContainerService_SetExtendedACL_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -143,7 +153,7 @@ func (c *containerServiceClient) SetExtendedACL(ctx context.Context, in *SetExte func (c *containerServiceClient) GetExtendedACL(ctx context.Context, in *GetExtendedACLRequest, opts ...grpc.CallOption) (*GetExtendedACLResponse, error) { out := new(GetExtendedACLResponse) - err := c.cc.Invoke(ctx, "/neo.fs.v2.container.ContainerService/GetExtendedACL", in, out, opts...) + err := c.cc.Invoke(ctx, ContainerService_GetExtendedACL_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -152,7 +162,7 @@ func (c *containerServiceClient) GetExtendedACL(ctx context.Context, in *GetExte func (c *containerServiceClient) AnnounceUsedSpace(ctx context.Context, in *AnnounceUsedSpaceRequest, opts ...grpc.CallOption) (*AnnounceUsedSpaceResponse, error) { out := new(AnnounceUsedSpaceResponse) - err := c.cc.Invoke(ctx, "/neo.fs.v2.container.ContainerService/AnnounceUsedSpace", in, out, opts...) + err := c.cc.Invoke(ctx, ContainerService_AnnounceUsedSpace_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -169,9 +179,9 @@ type ContainerServiceServer interface { // 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). + // - **OK** (0, SECTION_SUCCESS): \ + // request to save the container has been sent to the sidechain; + // - Common failures (SECTION_FAILURE_COMMON). 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 @@ -179,53 +189,53 @@ type ContainerServiceServer interface { // 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). + // - **OK** (0, SECTION_SUCCESS): \ + // request to remove the container has been sent to the sidechain; + // - Common failures (SECTION_FAILURE_COMMON). 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. + // - **OK** (0, SECTION_SUCCESS): \ + // container has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON); + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // requested container not found. Get(context.Context, *GetRequest) (*GetResponse, error) // 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). + // - **OK** (0, SECTION_SUCCESS): \ + // container list has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON). List(context.Context, *ListRequest) (*ListResponse, error) // Invokes 'SetEACL' method of 'Container` smart contract and returns response // immediately. After one more block in sidechain, changes in an Extended ACL are // added into smart contract storage. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // request to save container eACL has been sent to the sidechain; - // - Common failures (SECTION_FAILURE_COMMON). + // - **OK** (0, SECTION_SUCCESS): \ + // request to save container eACL has been sent to the sidechain; + // - Common failures (SECTION_FAILURE_COMMON). SetExtendedACL(context.Context, *SetExtendedACLRequest) (*SetExtendedACLResponse, error) // Returns Extended ACL table and signature from `Container` smart contract // storage. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // container eACL has been successfully read; - // - Common failures (SECTION_FAILURE_COMMON); - // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ - // container not found; - // - **EACL_NOT_FOUND** (3073, SECTION_CONTAINER): \ - // eACL table not found. + // - **OK** (0, SECTION_SUCCESS): \ + // container eACL has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON); + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // container not found; + // - **EACL_NOT_FOUND** (3073, SECTION_CONTAINER): \ + // eACL table not found. GetExtendedACL(context.Context, *GetExtendedACLRequest) (*GetExtendedACLResponse, error) // Announces the space values used by the container for P2P synchronization. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // estimation of used space has been successfully announced; - // - Common failures (SECTION_FAILURE_COMMON). + // - **OK** (0, SECTION_SUCCESS): \ + // estimation of used space has been successfully announced; + // - Common failures (SECTION_FAILURE_COMMON). AnnounceUsedSpace(context.Context, *AnnounceUsedSpaceRequest) (*AnnounceUsedSpaceResponse, error) } @@ -276,7 +286,7 @@ func _ContainerService_Put_Handler(srv interface{}, ctx context.Context, dec fun } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/neo.fs.v2.container.ContainerService/Put", + FullMethod: ContainerService_Put_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ContainerServiceServer).Put(ctx, req.(*PutRequest)) @@ -294,7 +304,7 @@ func _ContainerService_Delete_Handler(srv interface{}, ctx context.Context, dec } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/neo.fs.v2.container.ContainerService/Delete", + FullMethod: ContainerService_Delete_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ContainerServiceServer).Delete(ctx, req.(*DeleteRequest)) @@ -312,7 +322,7 @@ func _ContainerService_Get_Handler(srv interface{}, ctx context.Context, dec fun } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/neo.fs.v2.container.ContainerService/Get", + FullMethod: ContainerService_Get_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ContainerServiceServer).Get(ctx, req.(*GetRequest)) @@ -330,7 +340,7 @@ func _ContainerService_List_Handler(srv interface{}, ctx context.Context, dec fu } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/neo.fs.v2.container.ContainerService/List", + FullMethod: ContainerService_List_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ContainerServiceServer).List(ctx, req.(*ListRequest)) @@ -348,7 +358,7 @@ func _ContainerService_SetExtendedACL_Handler(srv interface{}, ctx context.Conte } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/neo.fs.v2.container.ContainerService/SetExtendedACL", + FullMethod: ContainerService_SetExtendedACL_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ContainerServiceServer).SetExtendedACL(ctx, req.(*SetExtendedACLRequest)) @@ -366,7 +376,7 @@ func _ContainerService_GetExtendedACL_Handler(srv interface{}, ctx context.Conte } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/neo.fs.v2.container.ContainerService/GetExtendedACL", + FullMethod: ContainerService_GetExtendedACL_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ContainerServiceServer).GetExtendedACL(ctx, req.(*GetExtendedACLRequest)) @@ -384,7 +394,7 @@ func _ContainerService_AnnounceUsedSpace_Handler(srv interface{}, ctx context.Co } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/neo.fs.v2.container.ContainerService/AnnounceUsedSpace", + FullMethod: ContainerService_AnnounceUsedSpace_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ContainerServiceServer).AnnounceUsedSpace(ctx, req.(*AnnounceUsedSpaceRequest)) diff --git a/container/grpc/types.pb.go b/container/grpc/types.pb.go index 1044617..7f0cc1b 100644 --- a/container/grpc/types.pb.go +++ b/container/grpc/types.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.0 +// protoc-gen-go v1.28.1 // protoc v3.21.9 // source: container/grpc/types.proto diff --git a/lock/grpc/types.pb.go b/lock/grpc/types.pb.go index 22758c1..958476c 100644 --- a/lock/grpc/types.pb.go +++ b/lock/grpc/types.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.0 +// protoc-gen-go v1.28.1 // protoc v3.21.9 // source: lock/grpc/types.proto diff --git a/netmap/grpc/service.pb.go b/netmap/grpc/service.pb.go index d74d7c3..acfe43c 100644 --- a/netmap/grpc/service.pb.go +++ b/netmap/grpc/service.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.0 +// protoc-gen-go v1.28.1 // protoc v3.21.9 // source: netmap/grpc/service.proto diff --git a/netmap/grpc/service_grpc.pb.go b/netmap/grpc/service_grpc.pb.go index 9ac25db..3834c3d 100644 --- a/netmap/grpc/service_grpc.pb.go +++ b/netmap/grpc/service_grpc.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.2.0 +// - protoc-gen-go-grpc v1.3.0 // - protoc v3.21.9 // source: netmap/grpc/service.proto @@ -18,6 +18,12 @@ import ( // Requires gRPC-Go v1.32.0 or later. const _ = grpc.SupportPackageIsVersion7 +const ( + NetmapService_LocalNodeInfo_FullMethodName = "/neo.fs.v2.netmap.NetmapService/LocalNodeInfo" + NetmapService_NetworkInfo_FullMethodName = "/neo.fs.v2.netmap.NetmapService/NetworkInfo" + NetmapService_NetmapSnapshot_FullMethodName = "/neo.fs.v2.netmap.NetmapService/NetmapSnapshot" +) + // 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. @@ -59,7 +65,7 @@ func NewNetmapServiceClient(cc grpc.ClientConnInterface) NetmapServiceClient { func (c *netmapServiceClient) LocalNodeInfo(ctx context.Context, in *LocalNodeInfoRequest, opts ...grpc.CallOption) (*LocalNodeInfoResponse, error) { out := new(LocalNodeInfoResponse) - err := c.cc.Invoke(ctx, "/neo.fs.v2.netmap.NetmapService/LocalNodeInfo", in, out, opts...) + err := c.cc.Invoke(ctx, NetmapService_LocalNodeInfo_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -68,7 +74,7 @@ func (c *netmapServiceClient) LocalNodeInfo(ctx context.Context, in *LocalNodeIn func (c *netmapServiceClient) NetworkInfo(ctx context.Context, in *NetworkInfoRequest, opts ...grpc.CallOption) (*NetworkInfoResponse, error) { out := new(NetworkInfoResponse) - err := c.cc.Invoke(ctx, "/neo.fs.v2.netmap.NetmapService/NetworkInfo", in, out, opts...) + err := c.cc.Invoke(ctx, NetmapService_NetworkInfo_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -77,7 +83,7 @@ func (c *netmapServiceClient) NetworkInfo(ctx context.Context, in *NetworkInfoRe func (c *netmapServiceClient) NetmapSnapshot(ctx context.Context, in *NetmapSnapshotRequest, opts ...grpc.CallOption) (*NetmapSnapshotResponse, error) { out := new(NetmapSnapshotResponse) - err := c.cc.Invoke(ctx, "/neo.fs.v2.netmap.NetmapService/NetmapSnapshot", in, out, opts...) + err := c.cc.Invoke(ctx, NetmapService_NetmapSnapshot_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -150,7 +156,7 @@ func _NetmapService_LocalNodeInfo_Handler(srv interface{}, ctx context.Context, } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/neo.fs.v2.netmap.NetmapService/LocalNodeInfo", + FullMethod: NetmapService_LocalNodeInfo_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(NetmapServiceServer).LocalNodeInfo(ctx, req.(*LocalNodeInfoRequest)) @@ -168,7 +174,7 @@ func _NetmapService_NetworkInfo_Handler(srv interface{}, ctx context.Context, de } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/neo.fs.v2.netmap.NetmapService/NetworkInfo", + FullMethod: NetmapService_NetworkInfo_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(NetmapServiceServer).NetworkInfo(ctx, req.(*NetworkInfoRequest)) @@ -186,7 +192,7 @@ func _NetmapService_NetmapSnapshot_Handler(srv interface{}, ctx context.Context, } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/neo.fs.v2.netmap.NetmapService/NetmapSnapshot", + FullMethod: NetmapService_NetmapSnapshot_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(NetmapServiceServer).NetmapSnapshot(ctx, req.(*NetmapSnapshotRequest)) diff --git a/netmap/grpc/types.pb.go b/netmap/grpc/types.pb.go index 0f017da..276e648 100644 --- a/netmap/grpc/types.pb.go +++ b/netmap/grpc/types.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.0 +// protoc-gen-go v1.28.1 // protoc v3.21.9 // source: netmap/grpc/types.proto diff --git a/object/grpc/service.pb.go b/object/grpc/service.pb.go index 6ba4090..ddda473 100644 --- a/object/grpc/service.pb.go +++ b/object/grpc/service.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.0 +// protoc-gen-go v1.28.1 // protoc v3.21.9 // source: object/grpc/service.proto diff --git a/object/grpc/service_grpc.pb.go b/object/grpc/service_grpc.pb.go index 6b1c32a..10f33b8 100644 --- a/object/grpc/service_grpc.pb.go +++ b/object/grpc/service_grpc.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.2.0 +// - protoc-gen-go-grpc v1.3.0 // - protoc v3.21.9 // source: object/grpc/service.proto @@ -18,6 +18,16 @@ import ( // Requires gRPC-Go v1.32.0 or later. const _ = grpc.SupportPackageIsVersion7 +const ( + ObjectService_Get_FullMethodName = "/neo.fs.v2.object.ObjectService/Get" + ObjectService_Put_FullMethodName = "/neo.fs.v2.object.ObjectService/Put" + ObjectService_Delete_FullMethodName = "/neo.fs.v2.object.ObjectService/Delete" + ObjectService_Head_FullMethodName = "/neo.fs.v2.object.ObjectService/Head" + ObjectService_Search_FullMethodName = "/neo.fs.v2.object.ObjectService/Search" + ObjectService_GetRange_FullMethodName = "/neo.fs.v2.object.ObjectService/GetRange" + ObjectService_GetRangeHash_FullMethodName = "/neo.fs.v2.object.ObjectService/GetRangeHash" +) + // ObjectServiceClient is the client API for ObjectService 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. @@ -30,32 +40,32 @@ type ObjectServiceClient interface { // keeping the receiving order. // // Extended headers can change `Get` behaviour: - // * [ __SYSTEM__NETMAP_EPOCH ] \ - // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ - // Will use the requsted version of Network Map for object placement - // calculation. - // * [ __SYSTEM__NETMAP_LOOKUP_DEPTH ] \ - // (`__NEOFS__NETMAP_LOOKUP_DEPTH` is deprecated) \ - // Will try older versions (starting from `__SYSTEM__NETMAP_EPOCH` (`__NEOFS__NETMAP_EPOCH` is deprecated) if specified or - // the latest one otherwise) of Network Map to find an object until the depth - // limit is reached. + // - [ __SYSTEM__NETMAP_EPOCH ] \ + // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ + // Will use the requsted version of Network Map for object placement + // calculation. + // - [ __SYSTEM__NETMAP_LOOKUP_DEPTH ] \ + // (`__NEOFS__NETMAP_LOOKUP_DEPTH` is deprecated) \ + // Will try older versions (starting from `__SYSTEM__NETMAP_EPOCH` (`__NEOFS__NETMAP_EPOCH` is deprecated) if specified or + // the latest one otherwise) of Network Map to find an object until the depth + // limit is reached. // // Please refer to detailed `XHeader` description. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // object has been successfully read; - // - Common failures (SECTION_FAILURE_COMMON); - // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ - // read access to the object is denied; - // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ - // object not found in container; - // - **OBJECT_ALREADY_REMOVED** (2052, SECTION_OBJECT): \ - // the requested object has been marked as deleted; - // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ - // object container not found; - // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ - // provided session token has expired. + // - **OK** (0, SECTION_SUCCESS): \ + // object has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON); + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // read access to the object is denied; + // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ + // object not found in container; + // - **OBJECT_ALREADY_REMOVED** (2052, SECTION_OBJECT): \ + // the requested object has been marked as deleted; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // object container not found; + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (ObjectService_GetClient, error) // Put the object into container. Request uses gRPC stream. First message // SHOULD be of PutHeader type. `ContainerID` and `OwnerID` of an object @@ -65,106 +75,107 @@ type ObjectServiceClient interface { // Chunk messages SHOULD be sent in the direct order of fragmentation. // // Extended headers can change `Put` behaviour: - // * [ __SYSTEM__NETMAP_EPOCH \ - // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ - // Will use the requsted version of Network Map for object placement - // calculation. + // - [ __SYSTEM__NETMAP_EPOCH \ + // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ + // Will use the requsted version of Network Map for object placement + // calculation. // // Please refer to detailed `XHeader` description. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // object has been successfully saved in the container; - // - Common failures (SECTION_FAILURE_COMMON); - // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ - // write access to the container is denied; - // - **LOCKED** (2050, SECTION_OBJECT): \ - // placement of an object of type TOMBSTONE that includes at least one locked - // object is prohibited; - // - **LOCK_NON_REGULAR_OBJECT** (2051, SECTION_OBJECT): \ - // placement of an object of type LOCK that includes at least one object of - // type other than REGULAR is prohibited; - // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ - // object storage container not found; - // - **TOKEN_NOT_FOUND** (4096, SECTION_SESSION): \ - // (for trusted object preparation) session private key does not exist or has + // - **OK** (0, SECTION_SUCCESS): \ + // object has been successfully saved in the container; + // - Common failures (SECTION_FAILURE_COMMON); + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // write access to the container is denied; + // - **LOCKED** (2050, SECTION_OBJECT): \ + // placement of an object of type TOMBSTONE that includes at least one locked + // object is prohibited; + // - **LOCK_NON_REGULAR_OBJECT** (2051, SECTION_OBJECT): \ + // placement of an object of type LOCK that includes at least one object of + // type other than REGULAR is prohibited; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // object storage container not found; + // - **TOKEN_NOT_FOUND** (4096, SECTION_SESSION): \ + // (for trusted object preparation) session private key does not exist or has + // // been deleted; - // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ - // provided session token has expired. + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. Put(ctx context.Context, opts ...grpc.CallOption) (ObjectService_PutClient, error) // Delete the object from a container. There is no immediate removal // guarantee. Object will be marked for removal and deleted eventually. // // Extended headers can change `Delete` behaviour: - // * [ __SYSTEM__NETMAP_EPOCH ] \ - // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ - // Will use the requested version of Network Map for object placement - // calculation. + // - [ __SYSTEM__NETMAP_EPOCH ] \ + // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ + // Will use the requested version of Network Map for object placement + // calculation. // // Please refer to detailed `XHeader` description. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // object has been successfully marked to be removed from the container; - // - Common failures (SECTION_FAILURE_COMMON); - // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ - // delete access to the object is denied; - // - **LOCKED** (2050, SECTION_OBJECT): \ - // deleting a locked object is prohibited; - // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ - // object container not found; - // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ - // provided session token has expired. + // - **OK** (0, SECTION_SUCCESS): \ + // object has been successfully marked to be removed from the container; + // - Common failures (SECTION_FAILURE_COMMON); + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // delete access to the object is denied; + // - **LOCKED** (2050, SECTION_OBJECT): \ + // deleting a locked object is prohibited; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // object container not found; + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteResponse, error) // Returns the object Headers without data payload. By default full header is // returned. If `main_only` request field is set, the short header with only // the very minimal information will be returned instead. // // Extended headers can change `Head` behaviour: - // * [ __SYSTEM__NETMAP_EPOCH ] \ - // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ - // Will use the requested version of Network Map for object placement - // calculation. + // - [ __SYSTEM__NETMAP_EPOCH ] \ + // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ + // Will use the requested version of Network Map for object placement + // calculation. // // Please refer to detailed `XHeader` description. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // object header has been successfully read; - // - Common failures (SECTION_FAILURE_COMMON); - // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ - // access to operation HEAD of the object is denied; - // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ - // object not found in container; - // - **OBJECT_ALREADY_REMOVED** (2052, SECTION_OBJECT): \ - // the requested object has been marked as deleted; - // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ - // object container not found; - // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ - // provided session token has expired. + // - **OK** (0, SECTION_SUCCESS): \ + // object header has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON); + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // access to operation HEAD of the object is denied; + // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ + // object not found in container; + // - **OBJECT_ALREADY_REMOVED** (2052, SECTION_OBJECT): \ + // the requested object has been marked as deleted; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // object container not found; + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. Head(ctx context.Context, in *HeadRequest, opts ...grpc.CallOption) (*HeadResponse, error) // Search objects in container. Search query allows to match by Object // Header's filed values. Please see the corresponding NeoFS Technical // Specification section for more details. // // Extended headers can change `Search` behaviour: - // * [ __SYSTEM__NETMAP_EPOCH ] \ - // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ - // Will use the requested version of Network Map for object placement - // calculation. + // - [ __SYSTEM__NETMAP_EPOCH ] \ + // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ + // Will use the requested version of Network Map for object placement + // calculation. // // Please refer to detailed `XHeader` description. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // objects have been successfully selected; - // - Common failures (SECTION_FAILURE_COMMON); - // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ - // access to operation SEARCH of the object is denied; - // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ - // search container not found; - // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ - // provided session token has expired. + // - **OK** (0, SECTION_SUCCESS): \ + // objects have been successfully selected; + // - Common failures (SECTION_FAILURE_COMMON); + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // access to operation SEARCH of the object is denied; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // search container not found; + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. Search(ctx context.Context, in *SearchRequest, opts ...grpc.CallOption) (ObjectService_SearchClient, error) // Get byte range of data payload. Range is set as an (offset, length) tuple. // Like in `Get` method, the response uses gRPC stream. Requested range can be @@ -172,33 +183,33 @@ type ObjectServiceClient interface { // order. // // Extended headers can change `GetRange` behaviour: - // * [ __SYSTEM__NETMAP_EPOCH ] \ - // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ - // Will use the requested version of Network Map for object placement - // calculation. - // * [ __SYSTEM__NETMAP_LOOKUP_DEPTH ] \ - // (`__NEOFS__NETMAP_LOOKUP_DEPTH` is deprecated) \ - // Will try older versions of Network Map to find an object until the depth - // limit is reached. + // - [ __SYSTEM__NETMAP_EPOCH ] \ + // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ + // Will use the requested version of Network Map for object placement + // calculation. + // - [ __SYSTEM__NETMAP_LOOKUP_DEPTH ] \ + // (`__NEOFS__NETMAP_LOOKUP_DEPTH` is deprecated) \ + // Will try older versions of Network Map to find an object until the depth + // limit is reached. // // Please refer to detailed `XHeader` description. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // data range of the object payload has been successfully read; - // - Common failures (SECTION_FAILURE_COMMON); - // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ - // access to operation RANGE of the object is denied; - // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ - // object not found in container; - // - **OBJECT_ALREADY_REMOVED** (2052, SECTION_OBJECT): \ - // the requested object has been marked as deleted. - // - **OUT_OF_RANGE** (2053, SECTION_OBJECT): \ - // the requested range is out of bounds; - // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ - // object container not found; - // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ - // provided session token has expired. + // - **OK** (0, SECTION_SUCCESS): \ + // data range of the object payload has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON); + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // access to operation RANGE of the object is denied; + // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ + // object not found in container; + // - **OBJECT_ALREADY_REMOVED** (2052, SECTION_OBJECT): \ + // the requested object has been marked as deleted. + // - **OUT_OF_RANGE** (2053, SECTION_OBJECT): \ + // the requested range is out of bounds; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // object container not found; + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. GetRange(ctx context.Context, in *GetRangeRequest, opts ...grpc.CallOption) (ObjectService_GetRangeClient, error) // Returns homomorphic or regular hash of object's payload range after // applying XOR operation with the provided `salt`. Ranges are set of (offset, @@ -206,31 +217,31 @@ type ObjectServiceClient interface { // the request. Note that hash is calculated for XORed data. // // Extended headers can change `GetRangeHash` behaviour: - // * [ __SYSTEM__NETMAP_EPOCH ] \ - // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ - // Will use the requested version of Network Map for object placement - // calculation. - // * [ __SYSTEM__NETMAP_LOOKUP_DEPTH ] \ - // (`__NEOFS__NETMAP_LOOKUP_DEPTH` is deprecated) \ - // Will try older versions of Network Map to find an object until the depth - // limit is reached. + // - [ __SYSTEM__NETMAP_EPOCH ] \ + // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ + // Will use the requested version of Network Map for object placement + // calculation. + // - [ __SYSTEM__NETMAP_LOOKUP_DEPTH ] \ + // (`__NEOFS__NETMAP_LOOKUP_DEPTH` is deprecated) \ + // Will try older versions of Network Map to find an object until the depth + // limit is reached. // // Please refer to detailed `XHeader` description. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // data range of the object payload has been successfully hashed; - // - Common failures (SECTION_FAILURE_COMMON); - // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ - // access to operation RANGEHASH of the object is denied; - // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ - // object not found in container; - // - **OUT_OF_RANGE** (2053, SECTION_OBJECT): \ - // the requested range is out of bounds; - // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ - // object container not found; - // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ - // provided session token has expired. + // - **OK** (0, SECTION_SUCCESS): \ + // data range of the object payload has been successfully hashed; + // - Common failures (SECTION_FAILURE_COMMON); + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // access to operation RANGEHASH of the object is denied; + // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ + // object not found in container; + // - **OUT_OF_RANGE** (2053, SECTION_OBJECT): \ + // the requested range is out of bounds; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // object container not found; + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. GetRangeHash(ctx context.Context, in *GetRangeHashRequest, opts ...grpc.CallOption) (*GetRangeHashResponse, error) } @@ -243,7 +254,7 @@ func NewObjectServiceClient(cc grpc.ClientConnInterface) ObjectServiceClient { } func (c *objectServiceClient) Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (ObjectService_GetClient, error) { - stream, err := c.cc.NewStream(ctx, &ObjectService_ServiceDesc.Streams[0], "/neo.fs.v2.object.ObjectService/Get", opts...) + stream, err := c.cc.NewStream(ctx, &ObjectService_ServiceDesc.Streams[0], ObjectService_Get_FullMethodName, opts...) if err != nil { return nil, err } @@ -275,7 +286,7 @@ func (x *objectServiceGetClient) Recv() (*GetResponse, error) { } func (c *objectServiceClient) Put(ctx context.Context, opts ...grpc.CallOption) (ObjectService_PutClient, error) { - stream, err := c.cc.NewStream(ctx, &ObjectService_ServiceDesc.Streams[1], "/neo.fs.v2.object.ObjectService/Put", opts...) + stream, err := c.cc.NewStream(ctx, &ObjectService_ServiceDesc.Streams[1], ObjectService_Put_FullMethodName, opts...) if err != nil { return nil, err } @@ -310,7 +321,7 @@ func (x *objectServicePutClient) CloseAndRecv() (*PutResponse, error) { func (c *objectServiceClient) Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteResponse, error) { out := new(DeleteResponse) - err := c.cc.Invoke(ctx, "/neo.fs.v2.object.ObjectService/Delete", in, out, opts...) + err := c.cc.Invoke(ctx, ObjectService_Delete_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -319,7 +330,7 @@ func (c *objectServiceClient) Delete(ctx context.Context, in *DeleteRequest, opt func (c *objectServiceClient) Head(ctx context.Context, in *HeadRequest, opts ...grpc.CallOption) (*HeadResponse, error) { out := new(HeadResponse) - err := c.cc.Invoke(ctx, "/neo.fs.v2.object.ObjectService/Head", in, out, opts...) + err := c.cc.Invoke(ctx, ObjectService_Head_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -327,7 +338,7 @@ func (c *objectServiceClient) Head(ctx context.Context, in *HeadRequest, opts .. } func (c *objectServiceClient) Search(ctx context.Context, in *SearchRequest, opts ...grpc.CallOption) (ObjectService_SearchClient, error) { - stream, err := c.cc.NewStream(ctx, &ObjectService_ServiceDesc.Streams[2], "/neo.fs.v2.object.ObjectService/Search", opts...) + stream, err := c.cc.NewStream(ctx, &ObjectService_ServiceDesc.Streams[2], ObjectService_Search_FullMethodName, opts...) if err != nil { return nil, err } @@ -359,7 +370,7 @@ func (x *objectServiceSearchClient) Recv() (*SearchResponse, error) { } func (c *objectServiceClient) GetRange(ctx context.Context, in *GetRangeRequest, opts ...grpc.CallOption) (ObjectService_GetRangeClient, error) { - stream, err := c.cc.NewStream(ctx, &ObjectService_ServiceDesc.Streams[3], "/neo.fs.v2.object.ObjectService/GetRange", opts...) + stream, err := c.cc.NewStream(ctx, &ObjectService_ServiceDesc.Streams[3], ObjectService_GetRange_FullMethodName, opts...) if err != nil { return nil, err } @@ -392,7 +403,7 @@ func (x *objectServiceGetRangeClient) Recv() (*GetRangeResponse, error) { func (c *objectServiceClient) GetRangeHash(ctx context.Context, in *GetRangeHashRequest, opts ...grpc.CallOption) (*GetRangeHashResponse, error) { out := new(GetRangeHashResponse) - err := c.cc.Invoke(ctx, "/neo.fs.v2.object.ObjectService/GetRangeHash", in, out, opts...) + err := c.cc.Invoke(ctx, ObjectService_GetRangeHash_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -411,32 +422,32 @@ type ObjectServiceServer interface { // keeping the receiving order. // // Extended headers can change `Get` behaviour: - // * [ __SYSTEM__NETMAP_EPOCH ] \ - // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ - // Will use the requsted version of Network Map for object placement - // calculation. - // * [ __SYSTEM__NETMAP_LOOKUP_DEPTH ] \ - // (`__NEOFS__NETMAP_LOOKUP_DEPTH` is deprecated) \ - // Will try older versions (starting from `__SYSTEM__NETMAP_EPOCH` (`__NEOFS__NETMAP_EPOCH` is deprecated) if specified or - // the latest one otherwise) of Network Map to find an object until the depth - // limit is reached. + // - [ __SYSTEM__NETMAP_EPOCH ] \ + // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ + // Will use the requsted version of Network Map for object placement + // calculation. + // - [ __SYSTEM__NETMAP_LOOKUP_DEPTH ] \ + // (`__NEOFS__NETMAP_LOOKUP_DEPTH` is deprecated) \ + // Will try older versions (starting from `__SYSTEM__NETMAP_EPOCH` (`__NEOFS__NETMAP_EPOCH` is deprecated) if specified or + // the latest one otherwise) of Network Map to find an object until the depth + // limit is reached. // // Please refer to detailed `XHeader` description. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // object has been successfully read; - // - Common failures (SECTION_FAILURE_COMMON); - // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ - // read access to the object is denied; - // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ - // object not found in container; - // - **OBJECT_ALREADY_REMOVED** (2052, SECTION_OBJECT): \ - // the requested object has been marked as deleted; - // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ - // object container not found; - // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ - // provided session token has expired. + // - **OK** (0, SECTION_SUCCESS): \ + // object has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON); + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // read access to the object is denied; + // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ + // object not found in container; + // - **OBJECT_ALREADY_REMOVED** (2052, SECTION_OBJECT): \ + // the requested object has been marked as deleted; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // object container not found; + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. Get(*GetRequest, ObjectService_GetServer) error // Put the object into container. Request uses gRPC stream. First message // SHOULD be of PutHeader type. `ContainerID` and `OwnerID` of an object @@ -446,106 +457,107 @@ type ObjectServiceServer interface { // Chunk messages SHOULD be sent in the direct order of fragmentation. // // Extended headers can change `Put` behaviour: - // * [ __SYSTEM__NETMAP_EPOCH \ - // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ - // Will use the requsted version of Network Map for object placement - // calculation. + // - [ __SYSTEM__NETMAP_EPOCH \ + // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ + // Will use the requsted version of Network Map for object placement + // calculation. // // Please refer to detailed `XHeader` description. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // object has been successfully saved in the container; - // - Common failures (SECTION_FAILURE_COMMON); - // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ - // write access to the container is denied; - // - **LOCKED** (2050, SECTION_OBJECT): \ - // placement of an object of type TOMBSTONE that includes at least one locked - // object is prohibited; - // - **LOCK_NON_REGULAR_OBJECT** (2051, SECTION_OBJECT): \ - // placement of an object of type LOCK that includes at least one object of - // type other than REGULAR is prohibited; - // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ - // object storage container not found; - // - **TOKEN_NOT_FOUND** (4096, SECTION_SESSION): \ - // (for trusted object preparation) session private key does not exist or has + // - **OK** (0, SECTION_SUCCESS): \ + // object has been successfully saved in the container; + // - Common failures (SECTION_FAILURE_COMMON); + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // write access to the container is denied; + // - **LOCKED** (2050, SECTION_OBJECT): \ + // placement of an object of type TOMBSTONE that includes at least one locked + // object is prohibited; + // - **LOCK_NON_REGULAR_OBJECT** (2051, SECTION_OBJECT): \ + // placement of an object of type LOCK that includes at least one object of + // type other than REGULAR is prohibited; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // object storage container not found; + // - **TOKEN_NOT_FOUND** (4096, SECTION_SESSION): \ + // (for trusted object preparation) session private key does not exist or has + // // been deleted; - // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ - // provided session token has expired. + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. Put(ObjectService_PutServer) error // Delete the object from a container. There is no immediate removal // guarantee. Object will be marked for removal and deleted eventually. // // Extended headers can change `Delete` behaviour: - // * [ __SYSTEM__NETMAP_EPOCH ] \ - // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ - // Will use the requested version of Network Map for object placement - // calculation. + // - [ __SYSTEM__NETMAP_EPOCH ] \ + // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ + // Will use the requested version of Network Map for object placement + // calculation. // // Please refer to detailed `XHeader` description. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // object has been successfully marked to be removed from the container; - // - Common failures (SECTION_FAILURE_COMMON); - // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ - // delete access to the object is denied; - // - **LOCKED** (2050, SECTION_OBJECT): \ - // deleting a locked object is prohibited; - // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ - // object container not found; - // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ - // provided session token has expired. + // - **OK** (0, SECTION_SUCCESS): \ + // object has been successfully marked to be removed from the container; + // - Common failures (SECTION_FAILURE_COMMON); + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // delete access to the object is denied; + // - **LOCKED** (2050, SECTION_OBJECT): \ + // deleting a locked object is prohibited; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // object container not found; + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. Delete(context.Context, *DeleteRequest) (*DeleteResponse, error) // Returns the object Headers without data payload. By default full header is // returned. If `main_only` request field is set, the short header with only // the very minimal information will be returned instead. // // Extended headers can change `Head` behaviour: - // * [ __SYSTEM__NETMAP_EPOCH ] \ - // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ - // Will use the requested version of Network Map for object placement - // calculation. + // - [ __SYSTEM__NETMAP_EPOCH ] \ + // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ + // Will use the requested version of Network Map for object placement + // calculation. // // Please refer to detailed `XHeader` description. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // object header has been successfully read; - // - Common failures (SECTION_FAILURE_COMMON); - // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ - // access to operation HEAD of the object is denied; - // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ - // object not found in container; - // - **OBJECT_ALREADY_REMOVED** (2052, SECTION_OBJECT): \ - // the requested object has been marked as deleted; - // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ - // object container not found; - // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ - // provided session token has expired. + // - **OK** (0, SECTION_SUCCESS): \ + // object header has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON); + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // access to operation HEAD of the object is denied; + // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ + // object not found in container; + // - **OBJECT_ALREADY_REMOVED** (2052, SECTION_OBJECT): \ + // the requested object has been marked as deleted; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // object container not found; + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. Head(context.Context, *HeadRequest) (*HeadResponse, error) // Search objects in container. Search query allows to match by Object // Header's filed values. Please see the corresponding NeoFS Technical // Specification section for more details. // // Extended headers can change `Search` behaviour: - // * [ __SYSTEM__NETMAP_EPOCH ] \ - // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ - // Will use the requested version of Network Map for object placement - // calculation. + // - [ __SYSTEM__NETMAP_EPOCH ] \ + // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ + // Will use the requested version of Network Map for object placement + // calculation. // // Please refer to detailed `XHeader` description. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // objects have been successfully selected; - // - Common failures (SECTION_FAILURE_COMMON); - // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ - // access to operation SEARCH of the object is denied; - // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ - // search container not found; - // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ - // provided session token has expired. + // - **OK** (0, SECTION_SUCCESS): \ + // objects have been successfully selected; + // - Common failures (SECTION_FAILURE_COMMON); + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // access to operation SEARCH of the object is denied; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // search container not found; + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. Search(*SearchRequest, ObjectService_SearchServer) error // Get byte range of data payload. Range is set as an (offset, length) tuple. // Like in `Get` method, the response uses gRPC stream. Requested range can be @@ -553,33 +565,33 @@ type ObjectServiceServer interface { // order. // // Extended headers can change `GetRange` behaviour: - // * [ __SYSTEM__NETMAP_EPOCH ] \ - // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ - // Will use the requested version of Network Map for object placement - // calculation. - // * [ __SYSTEM__NETMAP_LOOKUP_DEPTH ] \ - // (`__NEOFS__NETMAP_LOOKUP_DEPTH` is deprecated) \ - // Will try older versions of Network Map to find an object until the depth - // limit is reached. + // - [ __SYSTEM__NETMAP_EPOCH ] \ + // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ + // Will use the requested version of Network Map for object placement + // calculation. + // - [ __SYSTEM__NETMAP_LOOKUP_DEPTH ] \ + // (`__NEOFS__NETMAP_LOOKUP_DEPTH` is deprecated) \ + // Will try older versions of Network Map to find an object until the depth + // limit is reached. // // Please refer to detailed `XHeader` description. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // data range of the object payload has been successfully read; - // - Common failures (SECTION_FAILURE_COMMON); - // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ - // access to operation RANGE of the object is denied; - // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ - // object not found in container; - // - **OBJECT_ALREADY_REMOVED** (2052, SECTION_OBJECT): \ - // the requested object has been marked as deleted. - // - **OUT_OF_RANGE** (2053, SECTION_OBJECT): \ - // the requested range is out of bounds; - // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ - // object container not found; - // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ - // provided session token has expired. + // - **OK** (0, SECTION_SUCCESS): \ + // data range of the object payload has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON); + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // access to operation RANGE of the object is denied; + // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ + // object not found in container; + // - **OBJECT_ALREADY_REMOVED** (2052, SECTION_OBJECT): \ + // the requested object has been marked as deleted. + // - **OUT_OF_RANGE** (2053, SECTION_OBJECT): \ + // the requested range is out of bounds; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // object container not found; + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. GetRange(*GetRangeRequest, ObjectService_GetRangeServer) error // Returns homomorphic or regular hash of object's payload range after // applying XOR operation with the provided `salt`. Ranges are set of (offset, @@ -587,31 +599,31 @@ type ObjectServiceServer interface { // the request. Note that hash is calculated for XORed data. // // Extended headers can change `GetRangeHash` behaviour: - // * [ __SYSTEM__NETMAP_EPOCH ] \ - // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ - // Will use the requested version of Network Map for object placement - // calculation. - // * [ __SYSTEM__NETMAP_LOOKUP_DEPTH ] \ - // (`__NEOFS__NETMAP_LOOKUP_DEPTH` is deprecated) \ - // Will try older versions of Network Map to find an object until the depth - // limit is reached. + // - [ __SYSTEM__NETMAP_EPOCH ] \ + // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ + // Will use the requested version of Network Map for object placement + // calculation. + // - [ __SYSTEM__NETMAP_LOOKUP_DEPTH ] \ + // (`__NEOFS__NETMAP_LOOKUP_DEPTH` is deprecated) \ + // Will try older versions of Network Map to find an object until the depth + // limit is reached. // // Please refer to detailed `XHeader` description. // // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // data range of the object payload has been successfully hashed; - // - Common failures (SECTION_FAILURE_COMMON); - // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ - // access to operation RANGEHASH of the object is denied; - // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ - // object not found in container; - // - **OUT_OF_RANGE** (2053, SECTION_OBJECT): \ - // the requested range is out of bounds; - // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ - // object container not found; - // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ - // provided session token has expired. + // - **OK** (0, SECTION_SUCCESS): \ + // data range of the object payload has been successfully hashed; + // - Common failures (SECTION_FAILURE_COMMON); + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // access to operation RANGEHASH of the object is denied; + // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ + // object not found in container; + // - **OUT_OF_RANGE** (2053, SECTION_OBJECT): \ + // the requested range is out of bounds; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // object container not found; + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. GetRangeHash(context.Context, *GetRangeHashRequest) (*GetRangeHashResponse, error) } @@ -709,7 +721,7 @@ func _ObjectService_Delete_Handler(srv interface{}, ctx context.Context, dec fun } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/neo.fs.v2.object.ObjectService/Delete", + FullMethod: ObjectService_Delete_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ObjectServiceServer).Delete(ctx, req.(*DeleteRequest)) @@ -727,7 +739,7 @@ func _ObjectService_Head_Handler(srv interface{}, ctx context.Context, dec func( } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/neo.fs.v2.object.ObjectService/Head", + FullMethod: ObjectService_Head_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ObjectServiceServer).Head(ctx, req.(*HeadRequest)) @@ -787,7 +799,7 @@ func _ObjectService_GetRangeHash_Handler(srv interface{}, ctx context.Context, d } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/neo.fs.v2.object.ObjectService/GetRangeHash", + FullMethod: ObjectService_GetRangeHash_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ObjectServiceServer).GetRangeHash(ctx, req.(*GetRangeHashRequest)) diff --git a/object/grpc/types.pb.go b/object/grpc/types.pb.go index 506adda..11cb63e 100644 --- a/object/grpc/types.pb.go +++ b/object/grpc/types.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.0 +// protoc-gen-go v1.28.1 // protoc v3.21.9 // source: object/grpc/types.proto diff --git a/refs/grpc/types.pb.go b/refs/grpc/types.pb.go index 5e9bfb5..0d6b671 100644 --- a/refs/grpc/types.pb.go +++ b/refs/grpc/types.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.0 +// protoc-gen-go v1.28.1 // protoc v3.21.9 // source: refs/grpc/types.proto diff --git a/reputation/convert.go b/reputation/convert.go deleted file mode 100644 index ca54261..0000000 --- a/reputation/convert.go +++ /dev/null @@ -1,604 +0,0 @@ -package reputation - -import ( - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" - refsGRPC "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc" - reputation "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/reputation/grpc" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/grpc" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message" -) - -// ToGRPCMessage converts PeerID to gRPC-generated -// reputation.PeerID message. -func (x *PeerID) ToGRPCMessage() grpc.Message { - var m *reputation.PeerID - - if x != nil { - m = new(reputation.PeerID) - - m.SetPublicKey(x.publicKey) - } - - return m -} - -// FromGRPCMessage tries to restore PeerID from grpc.Message. -// -// Returns message.ErrUnexpectedMessageType if m is not -// a gRPC-generated reputation.PeerID message. -func (x *PeerID) FromGRPCMessage(m grpc.Message) error { - v, ok := m.(*reputation.PeerID) - if !ok { - return message.NewUnexpectedMessageType(m, v) - } - - x.publicKey = v.GetPublicKey() - - return nil -} - -// ToGRPCMessage converts Trust to gRPC-generated -// reputation.Trust message. -func (x *Trust) ToGRPCMessage() grpc.Message { - var m *reputation.Trust - - if x != nil { - m = new(reputation.Trust) - - m.SetValue(x.val) - m.SetPeer(x.peer.ToGRPCMessage().(*reputation.PeerID)) - } - - return m -} - -// FromGRPCMessage tries to restore Trust from grpc.Message. -// -// Returns message.ErrUnexpectedMessageType if m is not -// a gRPC-generated reputation.Trust message. -func (x *Trust) FromGRPCMessage(m grpc.Message) error { - v, ok := m.(*reputation.Trust) - if !ok { - return message.NewUnexpectedMessageType(m, v) - } - - peer := v.GetPeer() - if peer == nil { - x.peer = nil - } else { - if x.peer == nil { - x.peer = new(PeerID) - } - - err := x.peer.FromGRPCMessage(peer) - if err != nil { - return err - } - } - - x.val = v.GetValue() - - return nil -} - -// ToGRPCMessage converts PeerToPeerTrust to gRPC-generated -// reputation.PeerToPeerTrust message. -func (x *PeerToPeerTrust) ToGRPCMessage() grpc.Message { - var m *reputation.PeerToPeerTrust - - if x != nil { - m = new(reputation.PeerToPeerTrust) - - m.SetTrustingPeer(x.trusting.ToGRPCMessage().(*reputation.PeerID)) - m.SetTrust(x.trust.ToGRPCMessage().(*reputation.Trust)) - } - - return m -} - -// FromGRPCMessage tries to restore PeerToPeerTrust from grpc.Message. -// -// Returns message.ErrUnexpectedMessageType if m is not -// a gRPC-generated reputation.PeerToPeerTrust message. -func (x *PeerToPeerTrust) FromGRPCMessage(m grpc.Message) error { - v, ok := m.(*reputation.PeerToPeerTrust) - if !ok { - return message.NewUnexpectedMessageType(m, v) - } - - var err error - - trusting := v.GetTrustingPeer() - if trusting == nil { - x.trusting = nil - } else { - if x.trusting == nil { - x.trusting = new(PeerID) - } - - err = x.trusting.FromGRPCMessage(trusting) - if err != nil { - return err - } - } - - trust := v.GetTrust() - if trust == nil { - x.trust = nil - } else { - if x.trust == nil { - x.trust = new(Trust) - } - - err = x.trust.FromGRPCMessage(trust) - } - - return err -} - -// TrustsToGRPC converts slice of Trust structures -// to slice of gRPC-generated Trust messages. -func TrustsToGRPC(xs []Trust) (res []*reputation.Trust) { - if xs != nil { - res = make([]*reputation.Trust, 0, len(xs)) - - for i := range xs { - res = append(res, xs[i].ToGRPCMessage().(*reputation.Trust)) - } - } - - return -} - -// TrustsFromGRPC tries to restore slice of Trust structures from -// slice of gRPC-generated reputation.Trust messages. -func TrustsFromGRPC(xs []*reputation.Trust) (res []Trust, err error) { - if xs != nil { - res = make([]Trust, len(xs)) - - for i := range xs { - if xs[i] != nil { - err = res[i].FromGRPCMessage(xs[i]) - if err != nil { - return - } - } - } - } - - return -} - -// ToGRPCMessage converts GlobalTrustBody to gRPC-generated -// reputation.GlobalTrust_Body message. -func (x *GlobalTrustBody) ToGRPCMessage() grpc.Message { - var m *reputation.GlobalTrust_Body - - if x != nil { - m = new(reputation.GlobalTrust_Body) - - m.SetManager(x.manager.ToGRPCMessage().(*reputation.PeerID)) - m.SetTrust(x.trust.ToGRPCMessage().(*reputation.Trust)) - } - - return m -} - -// FromGRPCMessage tries to restore GlobalTrustBody from grpc.Message. -// -// Returns message.ErrUnexpectedMessageType if m is not -// a gRPC-generated reputation.GlobalTrust_Body message. -func (x *GlobalTrustBody) FromGRPCMessage(m grpc.Message) error { - v, ok := m.(*reputation.GlobalTrust_Body) - if !ok { - return message.NewUnexpectedMessageType(m, v) - } - - var err error - - manager := v.GetManager() - if manager == nil { - x.manager = nil - } else { - if x.manager == nil { - x.manager = new(PeerID) - } - - err = x.manager.FromGRPCMessage(manager) - if err != nil { - return err - } - } - - trust := v.GetTrust() - if trust == nil { - x.trust = nil - } else { - if x.trust == nil { - x.trust = new(Trust) - } - - err = x.trust.FromGRPCMessage(trust) - } - - return err -} - -// ToGRPCMessage converts GlobalTrust to gRPC-generated -// reputation.GlobalTrust message. -func (x *GlobalTrust) ToGRPCMessage() grpc.Message { - var m *reputation.GlobalTrust - - if x != nil { - m = new(reputation.GlobalTrust) - - m.SetVersion(x.version.ToGRPCMessage().(*refsGRPC.Version)) - m.SetBody(x.body.ToGRPCMessage().(*reputation.GlobalTrust_Body)) - m.SetSignature(x.sig.ToGRPCMessage().(*refsGRPC.Signature)) - } - - return m -} - -// FromGRPCMessage tries to restore GlobalTrust from grpc.Message. -// -// Returns message.ErrUnexpectedMessageType if m is not -// a gRPC-generated reputation.GlobalTrust message. -func (x *GlobalTrust) FromGRPCMessage(m grpc.Message) error { - v, ok := m.(*reputation.GlobalTrust) - if !ok { - return message.NewUnexpectedMessageType(m, v) - } - - var err error - - version := v.GetVersion() - if version == nil { - x.version = nil - } else { - if x.version == nil { - x.version = new(refs.Version) - } - - err = x.version.FromGRPCMessage(version) - if err != nil { - return err - } - } - - body := v.GetBody() - if body == nil { - x.body = nil - } else { - if x.body == nil { - x.body = new(GlobalTrustBody) - } - - err = x.body.FromGRPCMessage(body) - if err != nil { - return err - } - } - - sig := v.GetSignature() - if sig == nil { - x.sig = nil - } else { - if x.sig == nil { - x.sig = new(refs.Signature) - } - - err = x.sig.FromGRPCMessage(sig) - } - - return err -} - -// ToGRPCMessage converts AnnounceLocalTrustRequestBody to gRPC-generated -// reputation.AnnounceLocalTrustRequest_Body message. -func (x *AnnounceLocalTrustRequestBody) ToGRPCMessage() grpc.Message { - var m *reputation.AnnounceLocalTrustRequest_Body - - if x != nil { - m = new(reputation.AnnounceLocalTrustRequest_Body) - - m.SetEpoch(x.epoch) - m.SetTrusts(TrustsToGRPC(x.trusts)) - } - - return m -} - -// FromGRPCMessage tries to restore AnnounceLocalTrustRequestBody from grpc.Message. -// -// Returns message.ErrUnexpectedMessageType if m is not -// a gRPC-generated reputation.AnnounceLocalTrustRequest_Body message. -func (x *AnnounceLocalTrustRequestBody) FromGRPCMessage(m grpc.Message) error { - v, ok := m.(*reputation.AnnounceLocalTrustRequest_Body) - if !ok { - return message.NewUnexpectedMessageType(m, v) - } - - var err error - - x.trusts, err = TrustsFromGRPC(v.GetTrusts()) - if err != nil { - return err - } - - x.epoch = v.GetEpoch() - - return nil -} - -// ToGRPCMessage converts AnnounceLocalTrustRequest to gRPC-generated -// reputation.AnnounceLocalTrustRequest message. -func (x *AnnounceLocalTrustRequest) ToGRPCMessage() grpc.Message { - var m *reputation.AnnounceLocalTrustRequest - - if x != nil { - m = new(reputation.AnnounceLocalTrustRequest) - - m.SetBody(x.body.ToGRPCMessage().(*reputation.AnnounceLocalTrustRequest_Body)) - x.RequestHeaders.ToMessage(m) - } - - return m -} - -// FromGRPCMessage tries to restore AnnounceLocalTrustRequest from grpc.Message. -// -// Returns message.ErrUnexpectedMessageType if m is not -// a gRPC-generated reputation.AnnounceLocalTrustRequest message. -func (x *AnnounceLocalTrustRequest) FromGRPCMessage(m grpc.Message) error { - v, ok := m.(*reputation.AnnounceLocalTrustRequest) - if !ok { - return message.NewUnexpectedMessageType(m, v) - } - - var err error - - body := v.GetBody() - if body == nil { - x.body = nil - } else { - if x.body == nil { - x.body = new(AnnounceLocalTrustRequestBody) - } - - err = x.body.FromGRPCMessage(body) - if err != nil { - return err - } - } - - return x.RequestHeaders.FromMessage(v) -} - -// ToGRPCMessage converts AnnounceLocalTrustResponseBody to gRPC-generated -// reputation.AnnounceLocalTrustResponse_Body message. -func (x *AnnounceLocalTrustResponseBody) ToGRPCMessage() grpc.Message { - var m *reputation.AnnounceLocalTrustResponse_Body - - if x != nil { - m = new(reputation.AnnounceLocalTrustResponse_Body) - } - - return m -} - -// FromGRPCMessage tries to restore AnnounceLocalTrustResponseBody from grpc.Message. -// -// Returns message.ErrUnexpectedMessageType if m is not -// a gRPC-generated reputation.AnnounceLocalTrustResponse_Body message. -func (x *AnnounceLocalTrustResponseBody) FromGRPCMessage(m grpc.Message) error { - v, ok := m.(*reputation.AnnounceLocalTrustResponse_Body) - if !ok { - return message.NewUnexpectedMessageType(m, v) - } - - return nil -} - -// ToGRPCMessage converts AnnounceLocalTrustResponse to gRPC-generated -// reputation.AnnounceLocalTrustResponse message. -func (x *AnnounceLocalTrustResponse) ToGRPCMessage() grpc.Message { - var m *reputation.AnnounceLocalTrustResponse - - if x != nil { - m = new(reputation.AnnounceLocalTrustResponse) - - m.SetBody(x.body.ToGRPCMessage().(*reputation.AnnounceLocalTrustResponse_Body)) - x.ResponseHeaders.ToMessage(m) - } - - return m -} - -// FromGRPCMessage tries to restore AnnounceLocalTrustResponse from grpc.Message. -// -// Returns message.ErrUnexpectedMessageType if m is not -// a gRPC-generated reputation.AnnounceLocalTrustResponse message. -func (x *AnnounceLocalTrustResponse) FromGRPCMessage(m grpc.Message) error { - v, ok := m.(*reputation.AnnounceLocalTrustResponse) - if !ok { - return message.NewUnexpectedMessageType(m, v) - } - - var err error - - body := v.GetBody() - if body == nil { - x.body = nil - } else { - if x.body == nil { - x.body = new(AnnounceLocalTrustResponseBody) - } - - err = x.body.FromGRPCMessage(body) - if err != nil { - return err - } - } - - return x.ResponseHeaders.FromMessage(v) -} - -// ToGRPCMessage converts AnnounceIntermediateResultRequestBody to gRPC-generated -// reputation.AnnounceIntermediateResultRequest_Body message. -func (x *AnnounceIntermediateResultRequestBody) ToGRPCMessage() grpc.Message { - var m *reputation.AnnounceIntermediateResultRequest_Body - - if x != nil { - m = new(reputation.AnnounceIntermediateResultRequest_Body) - - m.SetEpoch(x.epoch) - m.SetIteration(x.iter) - m.SetTrust(x.trust.ToGRPCMessage().(*reputation.PeerToPeerTrust)) - } - - return m -} - -// FromGRPCMessage tries to restore AnnounceIntermediateResultRequestBody from grpc.Message. -// -// Returns message.ErrUnexpectedMessageType if m is not -// a gRPC-generated reputation.AnnounceIntermediateResultRequest_Body message. -func (x *AnnounceIntermediateResultRequestBody) FromGRPCMessage(m grpc.Message) error { - v, ok := m.(*reputation.AnnounceIntermediateResultRequest_Body) - if !ok { - return message.NewUnexpectedMessageType(m, v) - } - - trust := v.GetTrust() - if trust == nil { - x.trust = nil - } else { - if x.trust == nil { - x.trust = new(PeerToPeerTrust) - } - - err := x.trust.FromGRPCMessage(trust) - if err != nil { - return err - } - } - - x.epoch = v.GetEpoch() - x.iter = v.GetIteration() - - return nil -} - -// ToGRPCMessage converts AnnounceIntermediateResultRequest to gRPC-generated -// reputation.AnnounceIntermediateResultRequest message. -func (x *AnnounceIntermediateResultRequest) ToGRPCMessage() grpc.Message { - var m *reputation.AnnounceIntermediateResultRequest - - if x != nil { - m = new(reputation.AnnounceIntermediateResultRequest) - - m.SetBody(x.body.ToGRPCMessage().(*reputation.AnnounceIntermediateResultRequest_Body)) - x.RequestHeaders.ToMessage(m) - } - - return m -} - -// FromGRPCMessage tries to restore AnnounceIntermediateResultRequest from grpc.Message. -// -// Returns message.ErrUnexpectedMessageType if m is not -// a gRPC-generated reputation.AnnounceIntermediateResultRequest message. -func (x *AnnounceIntermediateResultRequest) FromGRPCMessage(m grpc.Message) error { - v, ok := m.(*reputation.AnnounceIntermediateResultRequest) - if !ok { - return message.NewUnexpectedMessageType(m, v) - } - - var err error - - body := v.GetBody() - if body == nil { - x.body = nil - } else { - if x.body == nil { - x.body = new(AnnounceIntermediateResultRequestBody) - } - - err = x.body.FromGRPCMessage(body) - if err != nil { - return err - } - } - - return x.RequestHeaders.FromMessage(v) -} - -// ToGRPCMessage converts AnnounceIntermediateResultResponseBody to gRPC-generated -// reputation.AnnounceIntermediateResultResponse_Body message. -func (x *AnnounceIntermediateResultResponseBody) ToGRPCMessage() grpc.Message { - var m *reputation.AnnounceIntermediateResultResponse_Body - - if x != nil { - m = new(reputation.AnnounceIntermediateResultResponse_Body) - } - - return m -} - -// FromGRPCMessage tries to restore AnnounceIntermediateResultResponseBody from grpc.Message. -// -// Returns message.ErrUnexpectedMessageType if m is not -// a gRPC-generated reputation.AnnounceIntermediateResultResponse_Body message. -func (x *AnnounceIntermediateResultResponseBody) FromGRPCMessage(m grpc.Message) error { - v, ok := m.(*reputation.AnnounceIntermediateResultResponse_Body) - if !ok { - return message.NewUnexpectedMessageType(m, v) - } - - return nil -} - -// ToGRPCMessage converts AnnounceIntermediateResultResponse to gRPC-generated -// reputation.AnnounceIntermediateResultResponse message. -func (x *AnnounceIntermediateResultResponse) ToGRPCMessage() grpc.Message { - var m *reputation.AnnounceIntermediateResultResponse - - if x != nil { - m = new(reputation.AnnounceIntermediateResultResponse) - - m.SetBody(x.body.ToGRPCMessage().(*reputation.AnnounceIntermediateResultResponse_Body)) - x.ResponseHeaders.ToMessage(m) - } - - return m -} - -// FromGRPCMessage tries to restore AnnounceIntermediateResultResponse from grpc.Message. -// -// Returns message.ErrUnexpectedMessageType if m is not -// a gRPC-generated reputation.AnnounceIntermediateResultResponse message. -func (x *AnnounceIntermediateResultResponse) FromGRPCMessage(m grpc.Message) error { - v, ok := m.(*reputation.AnnounceIntermediateResultResponse) - if !ok { - return message.NewUnexpectedMessageType(m, v) - } - - var err error - - body := v.GetBody() - if body == nil { - x.body = nil - } else { - if x.body == nil { - x.body = new(AnnounceIntermediateResultResponseBody) - } - - err = x.body.FromGRPCMessage(body) - if err != nil { - return err - } - } - - return x.ResponseHeaders.FromMessage(v) -} diff --git a/reputation/grpc/service.go b/reputation/grpc/service.go deleted file mode 100644 index 81ed890..0000000 --- a/reputation/grpc/service.go +++ /dev/null @@ -1,90 +0,0 @@ -package reputation - -import ( - session "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session/grpc" -) - -// SetEpoch sets epoch in which the trust was assessed. -func (x *AnnounceLocalTrustRequest_Body) SetEpoch(v uint64) { - x.Epoch = v -} - -// SetTrusts sets list of normalized trust values. -func (x *AnnounceLocalTrustRequest_Body) SetTrusts(v []*Trust) { - x.Trusts = v -} - -// SetBody sets body of the request. -func (x *AnnounceLocalTrustRequest) SetBody(v *AnnounceLocalTrustRequest_Body) { - x.Body = v -} - -// SetMetaHeader sets meta header of the request. -func (x *AnnounceLocalTrustRequest) SetMetaHeader(v *session.RequestMetaHeader) { - x.MetaHeader = v -} - -// SetVerifyHeader sets verification header of the request. -func (x *AnnounceLocalTrustRequest) SetVerifyHeader(v *session.RequestVerificationHeader) { - x.VerifyHeader = v -} - -// SetBody sets body of the response. -func (x *AnnounceLocalTrustResponse) SetBody(v *AnnounceLocalTrustResponse_Body) { - x.Body = v -} - -// SetMetaHeader sets meta header of the response. -func (x *AnnounceLocalTrustResponse) SetMetaHeader(v *session.ResponseMetaHeader) { - x.MetaHeader = v -} - -// SetVerifyHeader sets verification header of the response. -func (x *AnnounceLocalTrustResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) { - x.VerifyHeader = v -} - -// SetEpoch sets epoch in which the intermediate trust was assessed. -func (x *AnnounceIntermediateResultRequest_Body) SetEpoch(v uint64) { - x.Epoch = v -} - -// SetIteration sets sequence number of the iteration. -func (x *AnnounceIntermediateResultRequest_Body) SetIteration(v uint32) { - x.Iteration = v -} - -// SetTrust sets current global trust value. -func (x *AnnounceIntermediateResultRequest_Body) SetTrust(v *PeerToPeerTrust) { - x.Trust = v -} - -// SetBody sets body of the request. -func (x *AnnounceIntermediateResultRequest) SetBody(v *AnnounceIntermediateResultRequest_Body) { - x.Body = v -} - -// SetMetaHeader sets meta header of the request. -func (x *AnnounceIntermediateResultRequest) SetMetaHeader(v *session.RequestMetaHeader) { - x.MetaHeader = v -} - -// SetVerifyHeader sets verification header of the request. -func (x *AnnounceIntermediateResultRequest) SetVerifyHeader(v *session.RequestVerificationHeader) { - x.VerifyHeader = v -} - -// SetBody sets body of the response. -func (x *AnnounceIntermediateResultResponse) SetBody(v *AnnounceIntermediateResultResponse_Body) { - x.Body = v -} - -// SetMetaHeader sets meta header of the response. -func (x *AnnounceIntermediateResultResponse) SetMetaHeader(v *session.ResponseMetaHeader) { - x.MetaHeader = v -} - -// SetVerifyHeader sets verification header of the response. -func (x *AnnounceIntermediateResultResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) { - x.VerifyHeader = v -} diff --git a/reputation/grpc/service.pb.go b/reputation/grpc/service.pb.go deleted file mode 100644 index 2d0f61f..0000000 --- a/reputation/grpc/service.pb.go +++ /dev/null @@ -1,808 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.28.0 -// protoc v3.21.9 -// source: reputation/grpc/service.proto - -package reputation - -import ( - grpc "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session/grpc" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -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) -) - -// Announce node's local trust information. -type AnnounceLocalTrustRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Body of the request message. - Body *AnnounceLocalTrustRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" 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,proto3" json:"verify_header,omitempty"` -} - -func (x *AnnounceLocalTrustRequest) Reset() { - *x = AnnounceLocalTrustRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_reputation_grpc_service_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AnnounceLocalTrustRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AnnounceLocalTrustRequest) ProtoMessage() {} - -func (x *AnnounceLocalTrustRequest) ProtoReflect() protoreflect.Message { - mi := &file_reputation_grpc_service_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AnnounceLocalTrustRequest.ProtoReflect.Descriptor instead. -func (*AnnounceLocalTrustRequest) Descriptor() ([]byte, []int) { - return file_reputation_grpc_service_proto_rawDescGZIP(), []int{0} -} - -func (x *AnnounceLocalTrustRequest) GetBody() *AnnounceLocalTrustRequest_Body { - if x != nil { - return x.Body - } - return nil -} - -func (x *AnnounceLocalTrustRequest) GetMetaHeader() *grpc.RequestMetaHeader { - if x != nil { - return x.MetaHeader - } - return nil -} - -func (x *AnnounceLocalTrustRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { - if x != nil { - return x.VerifyHeader - } - return nil -} - -// Node's local trust information announcement response. -type AnnounceLocalTrustResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Body of the response message. - Body *AnnounceLocalTrustResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" 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,proto3" json:"verify_header,omitempty"` -} - -func (x *AnnounceLocalTrustResponse) Reset() { - *x = AnnounceLocalTrustResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_reputation_grpc_service_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AnnounceLocalTrustResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AnnounceLocalTrustResponse) ProtoMessage() {} - -func (x *AnnounceLocalTrustResponse) ProtoReflect() protoreflect.Message { - mi := &file_reputation_grpc_service_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AnnounceLocalTrustResponse.ProtoReflect.Descriptor instead. -func (*AnnounceLocalTrustResponse) Descriptor() ([]byte, []int) { - return file_reputation_grpc_service_proto_rawDescGZIP(), []int{1} -} - -func (x *AnnounceLocalTrustResponse) GetBody() *AnnounceLocalTrustResponse_Body { - if x != nil { - return x.Body - } - return nil -} - -func (x *AnnounceLocalTrustResponse) GetMetaHeader() *grpc.ResponseMetaHeader { - if x != nil { - return x.MetaHeader - } - return nil -} - -func (x *AnnounceLocalTrustResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { - if x != nil { - return x.VerifyHeader - } - return nil -} - -// Announce intermediate global trust information. -type AnnounceIntermediateResultRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Body of the request message. - Body *AnnounceIntermediateResultRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" 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,proto3" json:"verify_header,omitempty"` -} - -func (x *AnnounceIntermediateResultRequest) Reset() { - *x = AnnounceIntermediateResultRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_reputation_grpc_service_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AnnounceIntermediateResultRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AnnounceIntermediateResultRequest) ProtoMessage() {} - -func (x *AnnounceIntermediateResultRequest) ProtoReflect() protoreflect.Message { - mi := &file_reputation_grpc_service_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AnnounceIntermediateResultRequest.ProtoReflect.Descriptor instead. -func (*AnnounceIntermediateResultRequest) Descriptor() ([]byte, []int) { - return file_reputation_grpc_service_proto_rawDescGZIP(), []int{2} -} - -func (x *AnnounceIntermediateResultRequest) GetBody() *AnnounceIntermediateResultRequest_Body { - if x != nil { - return x.Body - } - return nil -} - -func (x *AnnounceIntermediateResultRequest) GetMetaHeader() *grpc.RequestMetaHeader { - if x != nil { - return x.MetaHeader - } - return nil -} - -func (x *AnnounceIntermediateResultRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { - if x != nil { - return x.VerifyHeader - } - return nil -} - -// Intermediate global trust information announcement response. -type AnnounceIntermediateResultResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Body of the response message. - Body *AnnounceIntermediateResultResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" 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,proto3" json:"verify_header,omitempty"` -} - -func (x *AnnounceIntermediateResultResponse) Reset() { - *x = AnnounceIntermediateResultResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_reputation_grpc_service_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AnnounceIntermediateResultResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AnnounceIntermediateResultResponse) ProtoMessage() {} - -func (x *AnnounceIntermediateResultResponse) ProtoReflect() protoreflect.Message { - mi := &file_reputation_grpc_service_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AnnounceIntermediateResultResponse.ProtoReflect.Descriptor instead. -func (*AnnounceIntermediateResultResponse) Descriptor() ([]byte, []int) { - return file_reputation_grpc_service_proto_rawDescGZIP(), []int{3} -} - -func (x *AnnounceIntermediateResultResponse) GetBody() *AnnounceIntermediateResultResponse_Body { - if x != nil { - return x.Body - } - return nil -} - -func (x *AnnounceIntermediateResultResponse) GetMetaHeader() *grpc.ResponseMetaHeader { - if x != nil { - return x.MetaHeader - } - return nil -} - -func (x *AnnounceIntermediateResultResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { - if x != nil { - return x.VerifyHeader - } - return nil -} - -// Announce node's local trust information. -type AnnounceLocalTrustRequest_Body struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Trust assessment Epoch number - Epoch uint64 `protobuf:"varint,1,opt,name=epoch,proto3" json:"epoch,omitempty"` - // List of normalized local trust values to other NeoFS nodes. The value - // is calculated according to EigenTrust++ algorithm and must be a - // floating point number in [0;1] range. - Trusts []*Trust `protobuf:"bytes,2,rep,name=trusts,proto3" json:"trusts,omitempty"` -} - -func (x *AnnounceLocalTrustRequest_Body) Reset() { - *x = AnnounceLocalTrustRequest_Body{} - if protoimpl.UnsafeEnabled { - mi := &file_reputation_grpc_service_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AnnounceLocalTrustRequest_Body) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AnnounceLocalTrustRequest_Body) ProtoMessage() {} - -func (x *AnnounceLocalTrustRequest_Body) ProtoReflect() protoreflect.Message { - mi := &file_reputation_grpc_service_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AnnounceLocalTrustRequest_Body.ProtoReflect.Descriptor instead. -func (*AnnounceLocalTrustRequest_Body) Descriptor() ([]byte, []int) { - return file_reputation_grpc_service_proto_rawDescGZIP(), []int{0, 0} -} - -func (x *AnnounceLocalTrustRequest_Body) GetEpoch() uint64 { - if x != nil { - return x.Epoch - } - return 0 -} - -func (x *AnnounceLocalTrustRequest_Body) GetTrusts() []*Trust { - if x != nil { - return x.Trusts - } - return nil -} - -// Response to the node's local trust information announcement has an empty body -// because the trust exchange operation is asynchronous. If Trust information -// does not pass sanity checks, it is silently ignored. -type AnnounceLocalTrustResponse_Body struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *AnnounceLocalTrustResponse_Body) Reset() { - *x = AnnounceLocalTrustResponse_Body{} - if protoimpl.UnsafeEnabled { - mi := &file_reputation_grpc_service_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AnnounceLocalTrustResponse_Body) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AnnounceLocalTrustResponse_Body) ProtoMessage() {} - -func (x *AnnounceLocalTrustResponse_Body) ProtoReflect() protoreflect.Message { - mi := &file_reputation_grpc_service_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AnnounceLocalTrustResponse_Body.ProtoReflect.Descriptor instead. -func (*AnnounceLocalTrustResponse_Body) Descriptor() ([]byte, []int) { - return file_reputation_grpc_service_proto_rawDescGZIP(), []int{1, 0} -} - -// Announce intermediate global trust information. -type AnnounceIntermediateResultRequest_Body struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Iteration execution Epoch number - Epoch uint64 `protobuf:"varint,1,opt,name=epoch,proto3" json:"epoch,omitempty"` - // Iteration sequence number - Iteration uint32 `protobuf:"varint,2,opt,name=iteration,proto3" json:"iteration,omitempty"` - // Current global trust value calculated at the specified iteration - Trust *PeerToPeerTrust `protobuf:"bytes,3,opt,name=trust,proto3" json:"trust,omitempty"` -} - -func (x *AnnounceIntermediateResultRequest_Body) Reset() { - *x = AnnounceIntermediateResultRequest_Body{} - if protoimpl.UnsafeEnabled { - mi := &file_reputation_grpc_service_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AnnounceIntermediateResultRequest_Body) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AnnounceIntermediateResultRequest_Body) ProtoMessage() {} - -func (x *AnnounceIntermediateResultRequest_Body) ProtoReflect() protoreflect.Message { - mi := &file_reputation_grpc_service_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AnnounceIntermediateResultRequest_Body.ProtoReflect.Descriptor instead. -func (*AnnounceIntermediateResultRequest_Body) Descriptor() ([]byte, []int) { - return file_reputation_grpc_service_proto_rawDescGZIP(), []int{2, 0} -} - -func (x *AnnounceIntermediateResultRequest_Body) GetEpoch() uint64 { - if x != nil { - return x.Epoch - } - return 0 -} - -func (x *AnnounceIntermediateResultRequest_Body) GetIteration() uint32 { - if x != nil { - return x.Iteration - } - return 0 -} - -func (x *AnnounceIntermediateResultRequest_Body) GetTrust() *PeerToPeerTrust { - if x != nil { - return x.Trust - } - return nil -} - -// Response to the node's intermediate global trust information announcement has -// an empty body because the trust exchange operation is asynchronous. If -// Trust information does not pass sanity checks, it is silently ignored. -type AnnounceIntermediateResultResponse_Body struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *AnnounceIntermediateResultResponse_Body) Reset() { - *x = AnnounceIntermediateResultResponse_Body{} - if protoimpl.UnsafeEnabled { - mi := &file_reputation_grpc_service_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AnnounceIntermediateResultResponse_Body) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AnnounceIntermediateResultResponse_Body) ProtoMessage() {} - -func (x *AnnounceIntermediateResultResponse_Body) ProtoReflect() protoreflect.Message { - mi := &file_reputation_grpc_service_proto_msgTypes[7] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AnnounceIntermediateResultResponse_Body.ProtoReflect.Descriptor instead. -func (*AnnounceIntermediateResultResponse_Body) Descriptor() ([]byte, []int) { - return file_reputation_grpc_service_proto_rawDescGZIP(), []int{3, 0} -} - -var File_reputation_grpc_service_proto protoreflect.FileDescriptor - -var file_reputation_grpc_service_proto_rawDesc = []byte{ - 0x0a, 0x1d, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 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, 0x72, 0x65, 0x70, 0x75, 0x74, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0x1b, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x1a, 0x18, 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, 0xd2, 0x02, 0x0a, - 0x19, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x54, 0x72, - 0x75, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x48, 0x0a, 0x04, 0x62, 0x6f, - 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x34, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, - 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, - 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x54, 0x72, 0x75, - 0x73, 0x74, 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, 0x51, - 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x12, 0x33, 0x0a, 0x06, - 0x74, 0x72, 0x75, 0x73, 0x74, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, - 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x2e, 0x54, 0x72, 0x75, 0x73, 0x74, 0x52, 0x06, 0x74, 0x72, 0x75, 0x73, 0x74, - 0x73, 0x22, 0x8b, 0x02, 0x0a, 0x1a, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x4c, 0x6f, - 0x63, 0x61, 0x6c, 0x54, 0x72, 0x75, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x12, 0x49, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x35, - 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x4c, 0x6f, - 0x63, 0x61, 0x6c, 0x54, 0x72, 0x75, 0x73, 0x74, 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, 0x06, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x22, - 0x88, 0x03, 0x0a, 0x21, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x49, 0x6e, 0x74, 0x65, - 0x72, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x50, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x3c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, - 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x41, 0x6e, 0x6e, 0x6f, 0x75, - 0x6e, 0x63, 0x65, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x74, 0x65, 0x52, - 0x65, 0x73, 0x75, 0x6c, 0x74, 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, 0x77, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x70, 0x6f, - 0x63, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x12, - 0x1c, 0x0a, 0x09, 0x69, 0x74, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0d, 0x52, 0x09, 0x69, 0x74, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3b, 0x0a, - 0x05, 0x74, 0x72, 0x75, 0x73, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6e, - 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x54, 0x6f, 0x50, 0x65, 0x65, 0x72, 0x54, 0x72, - 0x75, 0x73, 0x74, 0x52, 0x05, 0x74, 0x72, 0x75, 0x73, 0x74, 0x22, 0x9b, 0x02, 0x0a, 0x22, 0x41, - 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6d, 0x65, 0x64, 0x69, - 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x12, 0x51, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x3d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, - 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x49, - 0x6e, 0x74, 0x65, 0x72, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, - 0x74, 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, 0x06, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x32, 0x9e, 0x02, 0x0a, 0x11, 0x52, 0x65, 0x70, - 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x77, - 0x0a, 0x12, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x54, - 0x72, 0x75, 0x73, 0x74, 0x12, 0x2f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, - 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x41, 0x6e, 0x6e, 0x6f, - 0x75, 0x6e, 0x63, 0x65, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x54, 0x72, 0x75, 0x73, 0x74, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x30, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, - 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x41, 0x6e, 0x6e, - 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x54, 0x72, 0x75, 0x73, 0x74, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x8f, 0x01, 0x0a, 0x1a, 0x41, 0x6e, 0x6e, 0x6f, - 0x75, 0x6e, 0x63, 0x65, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x74, 0x65, - 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x37, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, - 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x41, 0x6e, - 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6d, 0x65, 0x64, 0x69, 0x61, - 0x74, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x38, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, - 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x49, - 0x6e, 0x74, 0x65, 0x72, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, - 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x6d, 0x5a, 0x4a, 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, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x72, 0x65, 0x70, - 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x72, 0x65, 0x70, - 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xaa, 0x02, 0x1e, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, - 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x52, 0x65, - 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_reputation_grpc_service_proto_rawDescOnce sync.Once - file_reputation_grpc_service_proto_rawDescData = file_reputation_grpc_service_proto_rawDesc -) - -func file_reputation_grpc_service_proto_rawDescGZIP() []byte { - file_reputation_grpc_service_proto_rawDescOnce.Do(func() { - file_reputation_grpc_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_reputation_grpc_service_proto_rawDescData) - }) - return file_reputation_grpc_service_proto_rawDescData -} - -var file_reputation_grpc_service_proto_msgTypes = make([]protoimpl.MessageInfo, 8) -var file_reputation_grpc_service_proto_goTypes = []interface{}{ - (*AnnounceLocalTrustRequest)(nil), // 0: neo.fs.v2.reputation.AnnounceLocalTrustRequest - (*AnnounceLocalTrustResponse)(nil), // 1: neo.fs.v2.reputation.AnnounceLocalTrustResponse - (*AnnounceIntermediateResultRequest)(nil), // 2: neo.fs.v2.reputation.AnnounceIntermediateResultRequest - (*AnnounceIntermediateResultResponse)(nil), // 3: neo.fs.v2.reputation.AnnounceIntermediateResultResponse - (*AnnounceLocalTrustRequest_Body)(nil), // 4: neo.fs.v2.reputation.AnnounceLocalTrustRequest.Body - (*AnnounceLocalTrustResponse_Body)(nil), // 5: neo.fs.v2.reputation.AnnounceLocalTrustResponse.Body - (*AnnounceIntermediateResultRequest_Body)(nil), // 6: neo.fs.v2.reputation.AnnounceIntermediateResultRequest.Body - (*AnnounceIntermediateResultResponse_Body)(nil), // 7: neo.fs.v2.reputation.AnnounceIntermediateResultResponse.Body - (*grpc.RequestMetaHeader)(nil), // 8: neo.fs.v2.session.RequestMetaHeader - (*grpc.RequestVerificationHeader)(nil), // 9: neo.fs.v2.session.RequestVerificationHeader - (*grpc.ResponseMetaHeader)(nil), // 10: neo.fs.v2.session.ResponseMetaHeader - (*grpc.ResponseVerificationHeader)(nil), // 11: neo.fs.v2.session.ResponseVerificationHeader - (*Trust)(nil), // 12: neo.fs.v2.reputation.Trust - (*PeerToPeerTrust)(nil), // 13: neo.fs.v2.reputation.PeerToPeerTrust -} -var file_reputation_grpc_service_proto_depIdxs = []int32{ - 4, // 0: neo.fs.v2.reputation.AnnounceLocalTrustRequest.body:type_name -> neo.fs.v2.reputation.AnnounceLocalTrustRequest.Body - 8, // 1: neo.fs.v2.reputation.AnnounceLocalTrustRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader - 9, // 2: neo.fs.v2.reputation.AnnounceLocalTrustRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader - 5, // 3: neo.fs.v2.reputation.AnnounceLocalTrustResponse.body:type_name -> neo.fs.v2.reputation.AnnounceLocalTrustResponse.Body - 10, // 4: neo.fs.v2.reputation.AnnounceLocalTrustResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader - 11, // 5: neo.fs.v2.reputation.AnnounceLocalTrustResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader - 6, // 6: neo.fs.v2.reputation.AnnounceIntermediateResultRequest.body:type_name -> neo.fs.v2.reputation.AnnounceIntermediateResultRequest.Body - 8, // 7: neo.fs.v2.reputation.AnnounceIntermediateResultRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader - 9, // 8: neo.fs.v2.reputation.AnnounceIntermediateResultRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader - 7, // 9: neo.fs.v2.reputation.AnnounceIntermediateResultResponse.body:type_name -> neo.fs.v2.reputation.AnnounceIntermediateResultResponse.Body - 10, // 10: neo.fs.v2.reputation.AnnounceIntermediateResultResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader - 11, // 11: neo.fs.v2.reputation.AnnounceIntermediateResultResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader - 12, // 12: neo.fs.v2.reputation.AnnounceLocalTrustRequest.Body.trusts:type_name -> neo.fs.v2.reputation.Trust - 13, // 13: neo.fs.v2.reputation.AnnounceIntermediateResultRequest.Body.trust:type_name -> neo.fs.v2.reputation.PeerToPeerTrust - 0, // 14: neo.fs.v2.reputation.ReputationService.AnnounceLocalTrust:input_type -> neo.fs.v2.reputation.AnnounceLocalTrustRequest - 2, // 15: neo.fs.v2.reputation.ReputationService.AnnounceIntermediateResult:input_type -> neo.fs.v2.reputation.AnnounceIntermediateResultRequest - 1, // 16: neo.fs.v2.reputation.ReputationService.AnnounceLocalTrust:output_type -> neo.fs.v2.reputation.AnnounceLocalTrustResponse - 3, // 17: neo.fs.v2.reputation.ReputationService.AnnounceIntermediateResult:output_type -> neo.fs.v2.reputation.AnnounceIntermediateResultResponse - 16, // [16:18] is the sub-list for method output_type - 14, // [14:16] is the sub-list for method input_type - 14, // [14:14] is the sub-list for extension type_name - 14, // [14:14] is the sub-list for extension extendee - 0, // [0:14] is the sub-list for field type_name -} - -func init() { file_reputation_grpc_service_proto_init() } -func file_reputation_grpc_service_proto_init() { - if File_reputation_grpc_service_proto != nil { - return - } - file_reputation_grpc_types_proto_init() - if !protoimpl.UnsafeEnabled { - file_reputation_grpc_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AnnounceLocalTrustRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_reputation_grpc_service_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AnnounceLocalTrustResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_reputation_grpc_service_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AnnounceIntermediateResultRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_reputation_grpc_service_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AnnounceIntermediateResultResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_reputation_grpc_service_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AnnounceLocalTrustRequest_Body); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_reputation_grpc_service_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AnnounceLocalTrustResponse_Body); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_reputation_grpc_service_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AnnounceIntermediateResultRequest_Body); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_reputation_grpc_service_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AnnounceIntermediateResultResponse_Body); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_reputation_grpc_service_proto_rawDesc, - NumEnums: 0, - NumMessages: 8, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_reputation_grpc_service_proto_goTypes, - DependencyIndexes: file_reputation_grpc_service_proto_depIdxs, - MessageInfos: file_reputation_grpc_service_proto_msgTypes, - }.Build() - File_reputation_grpc_service_proto = out.File - file_reputation_grpc_service_proto_rawDesc = nil - file_reputation_grpc_service_proto_goTypes = nil - file_reputation_grpc_service_proto_depIdxs = nil -} diff --git a/reputation/grpc/service_grpc.pb.go b/reputation/grpc/service_grpc.pb.go deleted file mode 100644 index 582a8cd..0000000 --- a/reputation/grpc/service_grpc.pb.go +++ /dev/null @@ -1,165 +0,0 @@ -// Code generated by protoc-gen-go-grpc. DO NOT EDIT. -// versions: -// - protoc-gen-go-grpc v1.2.0 -// - protoc v3.21.9 -// source: reputation/grpc/service.proto - -package reputation - -import ( - context "context" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.32.0 or later. -const _ = grpc.SupportPackageIsVersion7 - -// ReputationServiceClient is the client API for ReputationService service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. -type ReputationServiceClient interface { - // Announce local client trust information to any node in NeoFS network. - // - // Statuses: - // - **OK** (0, SECTION_SUCCESS): - // local trust has been successfully announced; - // - Common failures (SECTION_FAILURE_COMMON). - AnnounceLocalTrust(ctx context.Context, in *AnnounceLocalTrustRequest, opts ...grpc.CallOption) (*AnnounceLocalTrustResponse, error) - // Announce the intermediate result of the iterative algorithm for - // calculating the global reputation of the node in NeoFS network. - // - // Statuses: - // - **OK** (0, SECTION_SUCCESS): - // intermediate trust estimation has been successfully announced; - // - Common failures (SECTION_FAILURE_COMMON). - AnnounceIntermediateResult(ctx context.Context, in *AnnounceIntermediateResultRequest, opts ...grpc.CallOption) (*AnnounceIntermediateResultResponse, error) -} - -type reputationServiceClient struct { - cc grpc.ClientConnInterface -} - -func NewReputationServiceClient(cc grpc.ClientConnInterface) ReputationServiceClient { - return &reputationServiceClient{cc} -} - -func (c *reputationServiceClient) AnnounceLocalTrust(ctx context.Context, in *AnnounceLocalTrustRequest, opts ...grpc.CallOption) (*AnnounceLocalTrustResponse, error) { - out := new(AnnounceLocalTrustResponse) - err := c.cc.Invoke(ctx, "/neo.fs.v2.reputation.ReputationService/AnnounceLocalTrust", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *reputationServiceClient) AnnounceIntermediateResult(ctx context.Context, in *AnnounceIntermediateResultRequest, opts ...grpc.CallOption) (*AnnounceIntermediateResultResponse, error) { - out := new(AnnounceIntermediateResultResponse) - err := c.cc.Invoke(ctx, "/neo.fs.v2.reputation.ReputationService/AnnounceIntermediateResult", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// ReputationServiceServer is the server API for ReputationService service. -// All implementations should embed UnimplementedReputationServiceServer -// for forward compatibility -type ReputationServiceServer interface { - // Announce local client trust information to any node in NeoFS network. - // - // Statuses: - // - **OK** (0, SECTION_SUCCESS): - // local trust has been successfully announced; - // - Common failures (SECTION_FAILURE_COMMON). - AnnounceLocalTrust(context.Context, *AnnounceLocalTrustRequest) (*AnnounceLocalTrustResponse, error) - // Announce the intermediate result of the iterative algorithm for - // calculating the global reputation of the node in NeoFS network. - // - // Statuses: - // - **OK** (0, SECTION_SUCCESS): - // intermediate trust estimation has been successfully announced; - // - Common failures (SECTION_FAILURE_COMMON). - AnnounceIntermediateResult(context.Context, *AnnounceIntermediateResultRequest) (*AnnounceIntermediateResultResponse, error) -} - -// UnimplementedReputationServiceServer should be embedded to have forward compatible implementations. -type UnimplementedReputationServiceServer struct { -} - -func (UnimplementedReputationServiceServer) AnnounceLocalTrust(context.Context, *AnnounceLocalTrustRequest) (*AnnounceLocalTrustResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method AnnounceLocalTrust not implemented") -} -func (UnimplementedReputationServiceServer) AnnounceIntermediateResult(context.Context, *AnnounceIntermediateResultRequest) (*AnnounceIntermediateResultResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method AnnounceIntermediateResult not implemented") -} - -// UnsafeReputationServiceServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to ReputationServiceServer will -// result in compilation errors. -type UnsafeReputationServiceServer interface { - mustEmbedUnimplementedReputationServiceServer() -} - -func RegisterReputationServiceServer(s grpc.ServiceRegistrar, srv ReputationServiceServer) { - s.RegisterService(&ReputationService_ServiceDesc, srv) -} - -func _ReputationService_AnnounceLocalTrust_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(AnnounceLocalTrustRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ReputationServiceServer).AnnounceLocalTrust(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/neo.fs.v2.reputation.ReputationService/AnnounceLocalTrust", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ReputationServiceServer).AnnounceLocalTrust(ctx, req.(*AnnounceLocalTrustRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _ReputationService_AnnounceIntermediateResult_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(AnnounceIntermediateResultRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ReputationServiceServer).AnnounceIntermediateResult(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/neo.fs.v2.reputation.ReputationService/AnnounceIntermediateResult", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ReputationServiceServer).AnnounceIntermediateResult(ctx, req.(*AnnounceIntermediateResultRequest)) - } - return interceptor(ctx, in, info, handler) -} - -// ReputationService_ServiceDesc is the grpc.ServiceDesc for ReputationService service. -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var ReputationService_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "neo.fs.v2.reputation.ReputationService", - HandlerType: (*ReputationServiceServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "AnnounceLocalTrust", - Handler: _ReputationService_AnnounceLocalTrust_Handler, - }, - { - MethodName: "AnnounceIntermediateResult", - Handler: _ReputationService_AnnounceIntermediateResult_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "reputation/grpc/service.proto", -} diff --git a/reputation/grpc/types.go b/reputation/grpc/types.go deleted file mode 100644 index 63f2d34..0000000 --- a/reputation/grpc/types.go +++ /dev/null @@ -1,55 +0,0 @@ -package reputation - -import ( - refs "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc" -) - -// SetPublicKey sets binary public key of ID. -func (x *PeerID) SetPublicKey(v []byte) { - x.PublicKey = v -} - -// SetPeer sets trusted peer's ID. -func (x *Trust) SetPeer(v *PeerID) { - x.Peer = v -} - -// SetValue sets trust value. -func (x *Trust) SetValue(v float64) { - x.Value = v -} - -// SetTrustingPeer sets trusting peer ID. -func (x *PeerToPeerTrust) SetTrustingPeer(v *PeerID) { - x.TrustingPeer = v -} - -// SetTrust sets trust value of trusting peer to the trusted one. -func (x *PeerToPeerTrust) SetTrust(v *Trust) { - x.Trust = v -} - -// SetManager sets manager ID. -func (x *GlobalTrust_Body) SetManager(v *PeerID) { - x.Manager = v -} - -// SetTrust sets global trust value. -func (x *GlobalTrust_Body) SetTrust(v *Trust) { - x.Trust = v -} - -// SetVersion sets message format version. -func (x *GlobalTrust) SetVersion(v *refs.Version) { - x.Version = v -} - -// SetBody sets message body. -func (x *GlobalTrust) SetBody(v *GlobalTrust_Body) { - x.Body = v -} - -// SetSignature sets body signature. -func (x *GlobalTrust) SetSignature(v *refs.Signature) { - x.Signature = v -} diff --git a/reputation/grpc/types.pb.go b/reputation/grpc/types.pb.go deleted file mode 100644 index b95b240..0000000 --- a/reputation/grpc/types.pb.go +++ /dev/null @@ -1,500 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.28.0 -// protoc v3.21.9 -// source: reputation/grpc/types.proto - -package reputation - -import ( - grpc "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -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) -) - -// NeoFS unique peer identifier is a 33 byte long compressed public key of the -// node, the same as the one stored in the network map. -// -// String presentation is a -// [base58](https://tools.ietf.org/html/draft-msporny-base58-02) encoded string. -// -// JSON value will be data encoded as a string using standard base64 -// encoding with paddings. Either -// [standard](https://tools.ietf.org/html/rfc4648#section-4) or -// [URL-safe](https://tools.ietf.org/html/rfc4648#section-5) base64 encoding -// with/without paddings are accepted. -type PeerID struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Peer node's public key - PublicKey []byte `protobuf:"bytes,1,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"` -} - -func (x *PeerID) Reset() { - *x = PeerID{} - if protoimpl.UnsafeEnabled { - mi := &file_reputation_grpc_types_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PeerID) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PeerID) ProtoMessage() {} - -func (x *PeerID) ProtoReflect() protoreflect.Message { - mi := &file_reputation_grpc_types_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PeerID.ProtoReflect.Descriptor instead. -func (*PeerID) Descriptor() ([]byte, []int) { - return file_reputation_grpc_types_proto_rawDescGZIP(), []int{0} -} - -func (x *PeerID) GetPublicKey() []byte { - if x != nil { - return x.PublicKey - } - return nil -} - -// Trust level to a NeoFS network peer. -type Trust struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Identifier of the trusted peer - Peer *PeerID `protobuf:"bytes,1,opt,name=peer,proto3" json:"peer,omitempty"` - // Trust level in [0:1] range - Value float64 `protobuf:"fixed64,2,opt,name=value,proto3" json:"value,omitempty"` -} - -func (x *Trust) Reset() { - *x = Trust{} - if protoimpl.UnsafeEnabled { - mi := &file_reputation_grpc_types_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Trust) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Trust) ProtoMessage() {} - -func (x *Trust) ProtoReflect() protoreflect.Message { - mi := &file_reputation_grpc_types_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Trust.ProtoReflect.Descriptor instead. -func (*Trust) Descriptor() ([]byte, []int) { - return file_reputation_grpc_types_proto_rawDescGZIP(), []int{1} -} - -func (x *Trust) GetPeer() *PeerID { - if x != nil { - return x.Peer - } - return nil -} - -func (x *Trust) GetValue() float64 { - if x != nil { - return x.Value - } - return 0 -} - -// Trust level of a peer to a peer. -type PeerToPeerTrust struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Identifier of the trusting peer - TrustingPeer *PeerID `protobuf:"bytes,1,opt,name=trusting_peer,json=trustingPeer,proto3" json:"trusting_peer,omitempty"` - // Trust level - Trust *Trust `protobuf:"bytes,2,opt,name=trust,proto3" json:"trust,omitempty"` -} - -func (x *PeerToPeerTrust) Reset() { - *x = PeerToPeerTrust{} - if protoimpl.UnsafeEnabled { - mi := &file_reputation_grpc_types_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PeerToPeerTrust) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PeerToPeerTrust) ProtoMessage() {} - -func (x *PeerToPeerTrust) ProtoReflect() protoreflect.Message { - mi := &file_reputation_grpc_types_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PeerToPeerTrust.ProtoReflect.Descriptor instead. -func (*PeerToPeerTrust) Descriptor() ([]byte, []int) { - return file_reputation_grpc_types_proto_rawDescGZIP(), []int{2} -} - -func (x *PeerToPeerTrust) GetTrustingPeer() *PeerID { - if x != nil { - return x.TrustingPeer - } - return nil -} - -func (x *PeerToPeerTrust) GetTrust() *Trust { - if x != nil { - return x.Trust - } - return nil -} - -// Global trust level to NeoFS node. -type GlobalTrust struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Message format version. Effectively, the version of API library used to create - // the message. - Version *grpc.Version `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` - // Message body - Body *GlobalTrust_Body `protobuf:"bytes,2,opt,name=body,proto3" json:"body,omitempty"` - // Signature of the binary `body` field by the manager. - Signature *grpc.Signature `protobuf:"bytes,3,opt,name=signature,proto3" json:"signature,omitempty"` -} - -func (x *GlobalTrust) Reset() { - *x = GlobalTrust{} - if protoimpl.UnsafeEnabled { - mi := &file_reputation_grpc_types_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GlobalTrust) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GlobalTrust) ProtoMessage() {} - -func (x *GlobalTrust) ProtoReflect() protoreflect.Message { - mi := &file_reputation_grpc_types_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GlobalTrust.ProtoReflect.Descriptor instead. -func (*GlobalTrust) Descriptor() ([]byte, []int) { - return file_reputation_grpc_types_proto_rawDescGZIP(), []int{3} -} - -func (x *GlobalTrust) GetVersion() *grpc.Version { - if x != nil { - return x.Version - } - return nil -} - -func (x *GlobalTrust) GetBody() *GlobalTrust_Body { - if x != nil { - return x.Body - } - return nil -} - -func (x *GlobalTrust) GetSignature() *grpc.Signature { - if x != nil { - return x.Signature - } - return nil -} - -// Message body structure. -type GlobalTrust_Body struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Node manager ID - Manager *PeerID `protobuf:"bytes,1,opt,name=manager,proto3" json:"manager,omitempty"` - // Global trust level - Trust *Trust `protobuf:"bytes,2,opt,name=trust,proto3" json:"trust,omitempty"` -} - -func (x *GlobalTrust_Body) Reset() { - *x = GlobalTrust_Body{} - if protoimpl.UnsafeEnabled { - mi := &file_reputation_grpc_types_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GlobalTrust_Body) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GlobalTrust_Body) ProtoMessage() {} - -func (x *GlobalTrust_Body) ProtoReflect() protoreflect.Message { - mi := &file_reputation_grpc_types_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GlobalTrust_Body.ProtoReflect.Descriptor instead. -func (*GlobalTrust_Body) Descriptor() ([]byte, []int) { - return file_reputation_grpc_types_proto_rawDescGZIP(), []int{3, 0} -} - -func (x *GlobalTrust_Body) GetManager() *PeerID { - if x != nil { - return x.Manager - } - return nil -} - -func (x *GlobalTrust_Body) GetTrust() *Trust { - if x != nil { - return x.Trust - } - return nil -} - -var File_reputation_grpc_types_proto protoreflect.FileDescriptor - -var file_reputation_grpc_types_proto_rawDesc = []byte{ - 0x0a, 0x1b, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 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, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x1a, 0x15, 0x72, 0x65, 0x66, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, - 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x27, 0x0a, 0x06, 0x50, 0x65, - 0x65, 0x72, 0x49, 0x44, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, - 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, - 0x4b, 0x65, 0x79, 0x22, 0x4f, 0x0a, 0x05, 0x54, 0x72, 0x75, 0x73, 0x74, 0x12, 0x30, 0x0a, 0x04, - 0x70, 0x65, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x6e, 0x65, 0x6f, - 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x49, 0x44, 0x52, 0x04, 0x70, 0x65, 0x65, 0x72, 0x12, 0x14, - 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x01, 0x52, 0x05, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x22, 0x87, 0x01, 0x0a, 0x0f, 0x50, 0x65, 0x65, 0x72, 0x54, 0x6f, 0x50, - 0x65, 0x65, 0x72, 0x54, 0x72, 0x75, 0x73, 0x74, 0x12, 0x41, 0x0a, 0x0d, 0x74, 0x72, 0x75, 0x73, - 0x74, 0x69, 0x6e, 0x67, 0x5f, 0x70, 0x65, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x1c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, - 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x49, 0x44, 0x52, 0x0c, 0x74, - 0x72, 0x75, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x50, 0x65, 0x65, 0x72, 0x12, 0x31, 0x0a, 0x05, 0x74, - 0x72, 0x75, 0x73, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, - 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x2e, 0x54, 0x72, 0x75, 0x73, 0x74, 0x52, 0x05, 0x74, 0x72, 0x75, 0x73, 0x74, 0x22, 0xa8, - 0x02, 0x0a, 0x0b, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x54, 0x72, 0x75, 0x73, 0x74, 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, 0x3a, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x26, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, - 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x54, 0x72, 0x75, - 0x73, 0x74, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x37, 0x0a, - 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, - 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, - 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x1a, 0x71, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x36, - 0x0a, 0x07, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x1c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, - 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x49, 0x44, 0x52, 0x07, 0x6d, - 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x12, 0x31, 0x0a, 0x05, 0x74, 0x72, 0x75, 0x73, 0x74, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, - 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x54, 0x72, 0x75, - 0x73, 0x74, 0x52, 0x05, 0x74, 0x72, 0x75, 0x73, 0x74, 0x42, 0x6d, 0x5a, 0x4a, 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, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x72, 0x65, 0x70, - 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x72, 0x65, 0x70, - 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xaa, 0x02, 0x1e, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, - 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x52, 0x65, - 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_reputation_grpc_types_proto_rawDescOnce sync.Once - file_reputation_grpc_types_proto_rawDescData = file_reputation_grpc_types_proto_rawDesc -) - -func file_reputation_grpc_types_proto_rawDescGZIP() []byte { - file_reputation_grpc_types_proto_rawDescOnce.Do(func() { - file_reputation_grpc_types_proto_rawDescData = protoimpl.X.CompressGZIP(file_reputation_grpc_types_proto_rawDescData) - }) - return file_reputation_grpc_types_proto_rawDescData -} - -var file_reputation_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 5) -var file_reputation_grpc_types_proto_goTypes = []interface{}{ - (*PeerID)(nil), // 0: neo.fs.v2.reputation.PeerID - (*Trust)(nil), // 1: neo.fs.v2.reputation.Trust - (*PeerToPeerTrust)(nil), // 2: neo.fs.v2.reputation.PeerToPeerTrust - (*GlobalTrust)(nil), // 3: neo.fs.v2.reputation.GlobalTrust - (*GlobalTrust_Body)(nil), // 4: neo.fs.v2.reputation.GlobalTrust.Body - (*grpc.Version)(nil), // 5: neo.fs.v2.refs.Version - (*grpc.Signature)(nil), // 6: neo.fs.v2.refs.Signature -} -var file_reputation_grpc_types_proto_depIdxs = []int32{ - 0, // 0: neo.fs.v2.reputation.Trust.peer:type_name -> neo.fs.v2.reputation.PeerID - 0, // 1: neo.fs.v2.reputation.PeerToPeerTrust.trusting_peer:type_name -> neo.fs.v2.reputation.PeerID - 1, // 2: neo.fs.v2.reputation.PeerToPeerTrust.trust:type_name -> neo.fs.v2.reputation.Trust - 5, // 3: neo.fs.v2.reputation.GlobalTrust.version:type_name -> neo.fs.v2.refs.Version - 4, // 4: neo.fs.v2.reputation.GlobalTrust.body:type_name -> neo.fs.v2.reputation.GlobalTrust.Body - 6, // 5: neo.fs.v2.reputation.GlobalTrust.signature:type_name -> neo.fs.v2.refs.Signature - 0, // 6: neo.fs.v2.reputation.GlobalTrust.Body.manager:type_name -> neo.fs.v2.reputation.PeerID - 1, // 7: neo.fs.v2.reputation.GlobalTrust.Body.trust:type_name -> neo.fs.v2.reputation.Trust - 8, // [8:8] is the sub-list for method output_type - 8, // [8:8] 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_reputation_grpc_types_proto_init() } -func file_reputation_grpc_types_proto_init() { - if File_reputation_grpc_types_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_reputation_grpc_types_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PeerID); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_reputation_grpc_types_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Trust); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_reputation_grpc_types_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PeerToPeerTrust); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_reputation_grpc_types_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GlobalTrust); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_reputation_grpc_types_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GlobalTrust_Body); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_reputation_grpc_types_proto_rawDesc, - NumEnums: 0, - NumMessages: 5, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_reputation_grpc_types_proto_goTypes, - DependencyIndexes: file_reputation_grpc_types_proto_depIdxs, - MessageInfos: file_reputation_grpc_types_proto_msgTypes, - }.Build() - File_reputation_grpc_types_proto = out.File - file_reputation_grpc_types_proto_rawDesc = nil - file_reputation_grpc_types_proto_goTypes = nil - file_reputation_grpc_types_proto_depIdxs = nil -} diff --git a/reputation/json.go b/reputation/json.go deleted file mode 100644 index 3976462..0000000 --- a/reputation/json.go +++ /dev/null @@ -1,38 +0,0 @@ -package reputation - -import ( - reputation "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/reputation/grpc" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message" -) - -func (x *PeerID) MarshalJSON() ([]byte, error) { - return message.MarshalJSON(x) -} - -func (x *PeerID) UnmarshalJSON(data []byte) error { - return message.UnmarshalJSON(x, data, new(reputation.PeerID)) -} - -func (x *Trust) MarshalJSON() ([]byte, error) { - return message.MarshalJSON(x) -} - -func (x *Trust) UnmarshalJSON(data []byte) error { - return message.UnmarshalJSON(x, data, new(reputation.Trust)) -} - -func (x *PeerToPeerTrust) MarshalJSON() ([]byte, error) { - return message.MarshalJSON(x) -} - -func (x *PeerToPeerTrust) UnmarshalJSON(data []byte) error { - return message.UnmarshalJSON(x, data, new(reputation.PeerToPeerTrust)) -} - -func (x *GlobalTrust) MarshalJSON() ([]byte, error) { - return message.MarshalJSON(x) -} - -func (x *GlobalTrust) UnmarshalJSON(data []byte) error { - return message.UnmarshalJSON(x, data, new(reputation.GlobalTrust)) -} diff --git a/reputation/marshal.go b/reputation/marshal.go deleted file mode 100644 index a64e822..0000000 --- a/reputation/marshal.go +++ /dev/null @@ -1,276 +0,0 @@ -package reputation - -import ( - reputation "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/reputation/grpc" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message" - protoutil "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/proto" -) - -const ( - _ = iota - peerIDPubKeyFNum -) - -func (x *PeerID) StableMarshal(buf []byte) []byte { - if x == nil { - return []byte{} - } - - if buf == nil { - buf = make([]byte, x.StableSize()) - } - - protoutil.BytesMarshal(peerIDPubKeyFNum, buf, x.publicKey) - - return buf -} - -func (x *PeerID) StableSize() (size int) { - size += protoutil.BytesSize(peerIDPubKeyFNum, x.publicKey) - - return -} - -func (x *PeerID) Unmarshal(data []byte) error { - return message.Unmarshal(x, data, new(reputation.PeerID)) -} - -const ( - _ = iota - trustPeerFNum - trustValueFNum -) - -func (x *Trust) StableMarshal(buf []byte) []byte { - if x == nil { - return []byte{} - } - - if buf == nil { - buf = make([]byte, x.StableSize()) - } - - var offset int - - offset += protoutil.NestedStructureMarshal(trustPeerFNum, buf[offset:], x.peer) - protoutil.Float64Marshal(trustValueFNum, buf[offset:], x.val) - - return buf -} - -func (x *Trust) StableSize() (size int) { - size += protoutil.NestedStructureSize(trustPeerFNum, x.peer) - size += protoutil.Float64Size(trustValueFNum, x.val) - - return -} - -func (x *Trust) Unmarshal(data []byte) error { - return message.Unmarshal(x, data, new(reputation.Trust)) -} - -const ( - _ = iota - p2pTrustTrustingFNum - p2pTrustValueFNum -) - -func (x *PeerToPeerTrust) StableMarshal(buf []byte) []byte { - if x == nil { - return []byte{} - } - - if buf == nil { - buf = make([]byte, x.StableSize()) - } - - var offset int - - offset += protoutil.NestedStructureMarshal(p2pTrustTrustingFNum, buf, x.trusting) - protoutil.NestedStructureMarshal(p2pTrustValueFNum, buf[offset:], x.trust) - - return buf -} - -func (x *PeerToPeerTrust) StableSize() (size int) { - size += protoutil.NestedStructureSize(p2pTrustTrustingFNum, x.trusting) - size += protoutil.NestedStructureSize(p2pTrustValueFNum, x.trust) - - return -} - -func (x *PeerToPeerTrust) Unmarshal(data []byte) error { - return message.Unmarshal(x, data, new(reputation.PeerToPeerTrust)) -} - -const ( - _ = iota - globalTrustBodyManagerFNum - globalTrustBodyValueFNum -) - -func (x *GlobalTrustBody) StableMarshal(buf []byte) []byte { - if x == nil { - return []byte{} - } - - if buf == nil { - buf = make([]byte, x.StableSize()) - } - - var offset int - - offset += protoutil.NestedStructureMarshal(globalTrustBodyManagerFNum, buf, x.manager) - protoutil.NestedStructureMarshal(globalTrustBodyValueFNum, buf[offset:], x.trust) - - return buf -} - -func (x *GlobalTrustBody) StableSize() (size int) { - size += protoutil.NestedStructureSize(globalTrustBodyManagerFNum, x.manager) - size += protoutil.NestedStructureSize(globalTrustBodyValueFNum, x.trust) - - return -} - -func (x *GlobalTrustBody) Unmarshal(data []byte) error { - return message.Unmarshal(x, data, new(reputation.GlobalTrust_Body)) -} - -const ( - _ = iota - globalTrustVersionFNum - globalTrustBodyFNum - globalTrustSigFNum -) - -func (x *GlobalTrust) StableMarshal(buf []byte) []byte { - if x == nil { - return []byte{} - } - - if buf == nil { - buf = make([]byte, x.StableSize()) - } - - var offset int - - offset += protoutil.NestedStructureMarshal(globalTrustVersionFNum, buf, x.version) - offset += protoutil.NestedStructureMarshal(globalTrustBodyFNum, buf[offset:], x.body) - protoutil.NestedStructureMarshal(globalTrustSigFNum, buf[offset:], x.sig) - - return buf -} - -func (x *GlobalTrust) StableSize() (size int) { - size += protoutil.NestedStructureSize(globalTrustVersionFNum, x.version) - size += protoutil.NestedStructureSize(globalTrustBodyFNum, x.body) - size += protoutil.NestedStructureSize(globalTrustSigFNum, x.sig) - - return -} - -func (x *GlobalTrust) Unmarshal(data []byte) error { - return message.Unmarshal(x, data, new(reputation.GlobalTrust)) -} - -const ( - _ = iota - announceLocalTrustBodyEpochFNum - announceLocalTrustBodyTrustsFNum -) - -func (x *AnnounceLocalTrustRequestBody) StableMarshal(buf []byte) []byte { - if x == nil { - return []byte{} - } - - if buf == nil { - buf = make([]byte, x.StableSize()) - } - - var offset int - - offset += protoutil.UInt64Marshal(announceLocalTrustBodyEpochFNum, buf[offset:], x.epoch) - - for i := range x.trusts { - offset += protoutil.NestedStructureMarshal(announceLocalTrustBodyTrustsFNum, buf[offset:], &x.trusts[i]) - } - - return buf -} - -func (x *AnnounceLocalTrustRequestBody) StableSize() (size int) { - size += protoutil.UInt64Size(announceLocalTrustBodyEpochFNum, x.epoch) - - for i := range x.trusts { - size += protoutil.NestedStructureSize(announceLocalTrustBodyTrustsFNum, &x.trusts[i]) - } - - return -} - -func (x *AnnounceLocalTrustRequestBody) Unmarshal(data []byte) error { - return message.Unmarshal(x, data, new(reputation.AnnounceLocalTrustRequest_Body)) -} - -func (x *AnnounceLocalTrustResponseBody) StableMarshal(buf []byte) []byte { - return buf -} - -func (x *AnnounceLocalTrustResponseBody) StableSize() int { - return 0 -} - -func (x *AnnounceLocalTrustResponseBody) Unmarshal(data []byte) error { - return message.Unmarshal(x, data, new(reputation.AnnounceLocalTrustResponse_Body)) -} - -const ( - _ = iota - announceInterResBodyEpochFNum - announceInterResBodyIterFNum - announceInterResBodyTrustFNum -) - -func (x *AnnounceIntermediateResultRequestBody) StableMarshal(buf []byte) []byte { - if x == nil { - return []byte{} - } - - if buf == nil { - buf = make([]byte, x.StableSize()) - } - - var offset int - - offset += protoutil.UInt64Marshal(announceInterResBodyEpochFNum, buf, x.epoch) - offset += protoutil.UInt32Marshal(announceInterResBodyIterFNum, buf[offset:], x.iter) - protoutil.NestedStructureMarshal(announceInterResBodyTrustFNum, buf[offset:], x.trust) - - return buf -} - -func (x *AnnounceIntermediateResultRequestBody) StableSize() (size int) { - size += protoutil.UInt64Size(announceInterResBodyEpochFNum, x.epoch) - size += protoutil.UInt32Size(announceInterResBodyIterFNum, x.iter) - size += protoutil.NestedStructureSize(announceInterResBodyTrustFNum, x.trust) - - return -} - -func (x *AnnounceIntermediateResultRequestBody) Unmarshal(data []byte) error { - return message.Unmarshal(x, data, new(reputation.AnnounceIntermediateResultRequest_Body)) -} - -func (x *AnnounceIntermediateResultResponseBody) StableMarshal(buf []byte) []byte { - return buf -} - -func (x *AnnounceIntermediateResultResponseBody) StableSize() int { - return 0 -} - -func (x *AnnounceIntermediateResultResponseBody) Unmarshal(data []byte) error { - return message.Unmarshal(x, data, new(reputation.AnnounceIntermediateResultResponse_Body)) -} diff --git a/reputation/message_test.go b/reputation/message_test.go deleted file mode 100644 index 891c2e4..0000000 --- a/reputation/message_test.go +++ /dev/null @@ -1,34 +0,0 @@ -package reputation_test - -import ( - "testing" - - reputationtest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/reputation/test" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message" - messagetest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message/test" -) - -func TestMessageConvert(t *testing.T) { - messagetest.TestRPCMessage(t, - func(empty bool) message.Message { return reputationtest.GenerateTrust(empty) }, - func(empty bool) message.Message { return reputationtest.GenerateAnnounceLocalTrustRequestBody(empty) }, - func(empty bool) message.Message { return reputationtest.GenerateAnnounceLocalTrustRequest(empty) }, - func(empty bool) message.Message { return reputationtest.GenerateAnnounceLocalTrustResponseBody(empty) }, - func(empty bool) message.Message { return reputationtest.GenerateAnnounceLocalTrustResponse(empty) }, - func(empty bool) message.Message { - return reputationtest.GenerateAnnounceIntermediateResultRequestBody(empty) - }, - func(empty bool) message.Message { - return reputationtest.GenerateAnnounceIntermediateResultRequest(empty) - }, - func(empty bool) message.Message { - return reputationtest.GenerateAnnounceIntermediateResultResponseBody(empty) - }, - func(empty bool) message.Message { - return reputationtest.GenerateAnnounceIntermediateResultResponse(empty) - }, - func(empty bool) message.Message { return reputationtest.GenerateGlobalTrustBody(empty) }, - func(empty bool) message.Message { return reputationtest.GenerateGlobalTrust(empty) }, - func(empty bool) message.Message { return reputationtest.GeneratePeerToPeerTrust(empty) }, - ) -} diff --git a/reputation/test/generate.go b/reputation/test/generate.go deleted file mode 100644 index 7731ad9..0000000 --- a/reputation/test/generate.go +++ /dev/null @@ -1,160 +0,0 @@ -package reputationtest - -import ( - refstest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/test" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/reputation" - sessiontest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session/test" -) - -func GeneratePeerID(empty bool) *reputation.PeerID { - m := new(reputation.PeerID) - - if !empty { - m.SetPublicKey([]byte{1, 2, 3}) - } - - return m -} - -func GenerateTrust(empty bool) *reputation.Trust { - m := new(reputation.Trust) - - if !empty { - m.SetValue(1) - m.SetPeer(GeneratePeerID(false)) - } - - return m -} - -func GeneratePeerToPeerTrust(empty bool) *reputation.PeerToPeerTrust { - m := new(reputation.PeerToPeerTrust) - - if !empty { - m.SetTrustingPeer(GeneratePeerID(false)) - m.SetTrust(GenerateTrust(false)) - } - - return m -} - -func GenerateGlobalTrustBody(empty bool) *reputation.GlobalTrustBody { - m := new(reputation.GlobalTrustBody) - - if !empty { - m.SetManager(GeneratePeerID(false)) - m.SetTrust(GenerateTrust(false)) - } - - return m -} - -func GenerateGlobalTrust(empty bool) *reputation.GlobalTrust { - m := new(reputation.GlobalTrust) - - if !empty { - m.SetVersion(refstest.GenerateVersion(false)) - m.SetBody(GenerateGlobalTrustBody(false)) - m.SetSignature(refstest.GenerateSignature(empty)) - } - - return m -} - -func GenerateTrusts(empty bool) []reputation.Trust { - var res []reputation.Trust - - if !empty { - res = append(res, - *GenerateTrust(false), - *GenerateTrust(false), - ) - } - - return res -} - -func GenerateAnnounceLocalTrustRequestBody(empty bool) *reputation.AnnounceLocalTrustRequestBody { - m := new(reputation.AnnounceLocalTrustRequestBody) - - if !empty { - m.SetEpoch(13) - m.SetTrusts(GenerateTrusts(false)) - } - - return m -} - -func GenerateAnnounceLocalTrustRequest(empty bool) *reputation.AnnounceLocalTrustRequest { - m := new(reputation.AnnounceLocalTrustRequest) - - if !empty { - m.SetBody(GenerateAnnounceLocalTrustRequestBody(false)) - m.SetMetaHeader(sessiontest.GenerateRequestMetaHeader(empty)) - m.SetVerificationHeader(sessiontest.GenerateRequestVerificationHeader(empty)) - } - - return m -} - -func GenerateAnnounceLocalTrustResponseBody(empty bool) *reputation.AnnounceLocalTrustResponseBody { - m := new(reputation.AnnounceLocalTrustResponseBody) - - return m -} - -func GenerateAnnounceLocalTrustResponse(empty bool) *reputation.AnnounceLocalTrustResponse { - m := new(reputation.AnnounceLocalTrustResponse) - - if !empty { - m.SetBody(GenerateAnnounceLocalTrustResponseBody(false)) - m.SetMetaHeader(sessiontest.GenerateResponseMetaHeader(empty)) - m.SetVerificationHeader(sessiontest.GenerateResponseVerificationHeader(empty)) - } - - return m -} - -func GenerateAnnounceIntermediateResultRequestBody(empty bool) *reputation.AnnounceIntermediateResultRequestBody { - m := new(reputation.AnnounceIntermediateResultRequestBody) - - if !empty { - m.SetEpoch(123) - m.SetIteration(564) - m.SetTrust(GeneratePeerToPeerTrust(false)) - } - - return m -} - -func GenerateAnnounceIntermediateResultRequest(empty bool) *reputation.AnnounceIntermediateResultRequest { - m := new(reputation.AnnounceIntermediateResultRequest) - - if !empty { - m.SetBody(GenerateAnnounceIntermediateResultRequestBody(false)) - } - - m.SetMetaHeader(sessiontest.GenerateRequestMetaHeader(empty)) - m.SetVerificationHeader(sessiontest.GenerateRequestVerificationHeader(empty)) - - return m -} - -func GenerateAnnounceIntermediateResultResponseBody(empty bool) *reputation.AnnounceIntermediateResultResponseBody { - m := new(reputation.AnnounceIntermediateResultResponseBody) - - return m -} - -func GenerateAnnounceIntermediateResultResponse(empty bool) *reputation.AnnounceIntermediateResultResponse { - m := new(reputation.AnnounceIntermediateResultResponse) - - if !empty { - m.SetBody(GenerateAnnounceIntermediateResultResponseBody(false)) - } - - m.SetMetaHeader(sessiontest.GenerateResponseMetaHeader(empty)) - m.SetVerificationHeader(sessiontest.GenerateResponseVerificationHeader(empty)) - - return m -} diff --git a/reputation/types.go b/reputation/types.go deleted file mode 100644 index a339183..0000000 --- a/reputation/types.go +++ /dev/null @@ -1,366 +0,0 @@ -package reputation - -import ( - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session" -) - -// PeerID represents reputation.PeerID message -// from NeoFS API v2. -type PeerID struct { - publicKey []byte -} - -// GetPublicKey returns peer's binary public key of ID. -func (x *PeerID) GetPublicKey() []byte { - if x != nil { - return x.publicKey - } - - return nil -} - -// SetPublicKey sets peer's binary public key of ID. -func (x *PeerID) SetPublicKey(v []byte) { - x.publicKey = v -} - -// Trust represents reputation.Trust message -// from NeoFS API v2. -type Trust struct { - val float64 - - peer *PeerID -} - -// GetPeer returns trusted peer's ID. -func (x *Trust) GetPeer() *PeerID { - if x != nil { - return x.peer - } - - return nil -} - -// SetPeer sets trusted peer's ID. -func (x *Trust) SetPeer(v *PeerID) { - x.peer = v -} - -// GetValue returns trust value. -func (x *Trust) GetValue() float64 { - if x != nil { - return x.val - } - - return 0 -} - -// SetValue sets trust value. -func (x *Trust) SetValue(v float64) { - x.val = v -} - -// PeerToPeerTrust represents reputation.PeerToPeerTrust message -// from NeoFS API v2. -type PeerToPeerTrust struct { - trusting *PeerID - - trust *Trust -} - -// GetTrustingPeer returns trusting peer ID. -func (x *PeerToPeerTrust) GetTrustingPeer() *PeerID { - if x != nil { - return x.trusting - } - - return nil -} - -// SetTrustingPeer sets trusting peer ID. -func (x *PeerToPeerTrust) SetTrustingPeer(v *PeerID) { - x.trusting = v -} - -// GetTrust returns trust value of trusting peer to the trusted one. -func (x *PeerToPeerTrust) GetTrust() *Trust { - if x != nil { - return x.trust - } - - return nil -} - -// SetTrust sets trust value of trusting peer to the trusted one. -func (x *PeerToPeerTrust) SetTrust(v *Trust) { - x.trust = v -} - -// GlobalTrustBody represents reputation.GlobalTrust.Body message -// from NeoFS API v2. -type GlobalTrustBody struct { - manager *PeerID - - trust *Trust -} - -// GetManager returns node manager ID. -func (x *GlobalTrustBody) GetManager() *PeerID { - if x != nil { - return x.manager - } - - return nil -} - -// SetManager sets node manager ID. -func (x *GlobalTrustBody) SetManager(v *PeerID) { - x.manager = v -} - -// GetTrust returns global trust value. -func (x *GlobalTrustBody) GetTrust() *Trust { - if x != nil { - return x.trust - } - - return nil -} - -// SetTrust sets global trust value. -func (x *GlobalTrustBody) SetTrust(v *Trust) { - x.trust = v -} - -// GlobalTrust represents reputation.GlobalTrust message -// from NeoFS API v2. -type GlobalTrust struct { - version *refs.Version - - body *GlobalTrustBody - - sig *refs.Signature -} - -// GetVersion returns message format version. -func (x *GlobalTrust) GetVersion() *refs.Version { - if x != nil { - return x.version - } - - return nil -} - -// SetVersion sets message format version. -func (x *GlobalTrust) SetVersion(v *refs.Version) { - x.version = v -} - -// GetBody returns message body. -func (x *GlobalTrust) GetBody() *GlobalTrustBody { - if x != nil { - return x.body - } - - return nil -} - -// SetBody sets message body. -func (x *GlobalTrust) SetBody(v *GlobalTrustBody) { - x.body = v -} - -// GetSignature returns body signature. -func (x *GlobalTrust) GetSignature() *refs.Signature { - if x != nil { - return x.sig - } - - return nil -} - -// SetSignature sets body signature. -func (x *GlobalTrust) SetSignature(v *refs.Signature) { - x.sig = v -} - -// AnnounceLocalTrustRequestBody is a structure of AnnounceLocalTrust request body. -type AnnounceLocalTrustRequestBody struct { - epoch uint64 - - trusts []Trust -} - -// GetEpoch returns epoch in which the trust was assessed. -func (x *AnnounceLocalTrustRequestBody) GetEpoch() uint64 { - if x != nil { - return x.epoch - } - - return 0 -} - -// SetEpoch sets epoch in which the trust was assessed. -func (x *AnnounceLocalTrustRequestBody) SetEpoch(v uint64) { - x.epoch = v -} - -// GetTrusts returns list of normalized trust values. -func (x *AnnounceLocalTrustRequestBody) GetTrusts() []Trust { - if x != nil { - return x.trusts - } - - return nil -} - -// SetTrusts sets list of normalized trust values. -func (x *AnnounceLocalTrustRequestBody) SetTrusts(v []Trust) { - x.trusts = v -} - -// AnnounceLocalTrustResponseBody is a structure of AnnounceLocalTrust response body. -type AnnounceLocalTrustResponseBody struct{} - -// AnnounceLocalTrustRequest represents reputation.AnnounceLocalTrustRequest -// message from NeoFS API v2. -type AnnounceLocalTrustRequest struct { - body *AnnounceLocalTrustRequestBody - - session.RequestHeaders -} - -// GetBody returns request body. -func (x *AnnounceLocalTrustRequest) GetBody() *AnnounceLocalTrustRequestBody { - if x != nil { - return x.body - } - - return nil -} - -// SetBody sets request body. -func (x *AnnounceLocalTrustRequest) SetBody(v *AnnounceLocalTrustRequestBody) { - x.body = v -} - -// AnnounceLocalTrustResponse represents reputation.AnnounceLocalTrustResponse -// message from NeoFS API v2. -type AnnounceLocalTrustResponse struct { - body *AnnounceLocalTrustResponseBody - - session.ResponseHeaders -} - -// GetBody returns response body. -func (x *AnnounceLocalTrustResponse) GetBody() *AnnounceLocalTrustResponseBody { - if x != nil { - return x.body - } - - return nil -} - -// SetBody sets response body. -func (x *AnnounceLocalTrustResponse) SetBody(v *AnnounceLocalTrustResponseBody) { - x.body = v -} - -// AnnounceIntermediateResultRequestBody is a structure of AnnounceIntermediateResult request body. -type AnnounceIntermediateResultRequestBody struct { - epoch uint64 - - iter uint32 - - trust *PeerToPeerTrust -} - -// GetEpoch returns epoch number in which the intermediate trust was assessed. -func (x *AnnounceIntermediateResultRequestBody) GetEpoch() uint64 { - if x != nil { - return x.epoch - } - - return 0 -} - -// SetEpoch sets epoch number in which the intermediate trust was assessed. -func (x *AnnounceIntermediateResultRequestBody) SetEpoch(v uint64) { - x.epoch = v -} - -// GetIteration returns sequence number of the iteration. -func (x *AnnounceIntermediateResultRequestBody) GetIteration() uint32 { - if x != nil { - return x.iter - } - - return 0 -} - -// SetIteration sets sequence number of the iteration. -func (x *AnnounceIntermediateResultRequestBody) SetIteration(v uint32) { - x.iter = v -} - -// GetTrust returns current global trust value. -func (x *AnnounceIntermediateResultRequestBody) GetTrust() *PeerToPeerTrust { - if x != nil { - return x.trust - } - - return nil -} - -// SetTrust sets current global trust value. -func (x *AnnounceIntermediateResultRequestBody) SetTrust(v *PeerToPeerTrust) { - x.trust = v -} - -// AnnounceIntermediateResultResponseBody is a structure of AnnounceIntermediateResult response body. -type AnnounceIntermediateResultResponseBody struct{} - -// AnnounceIntermediateResultRequest represents reputation.AnnounceIntermediateResult -// message from NeoFS API v2. -type AnnounceIntermediateResultRequest struct { - body *AnnounceIntermediateResultRequestBody - - session.RequestHeaders -} - -// GetBody returns request body. -func (x *AnnounceIntermediateResultRequest) GetBody() *AnnounceIntermediateResultRequestBody { - if x != nil { - return x.body - } - - return nil -} - -// SetBody sets request body. -func (x *AnnounceIntermediateResultRequest) SetBody(v *AnnounceIntermediateResultRequestBody) { - x.body = v -} - -// AnnounceIntermediateResultResponse represents reputation.AnnounceIntermediateResultResponse -// message from NeoFS API v2. -type AnnounceIntermediateResultResponse struct { - body *AnnounceIntermediateResultResponseBody - - session.ResponseHeaders -} - -// GetBody returns response body. -func (x *AnnounceIntermediateResultResponse) GetBody() *AnnounceIntermediateResultResponseBody { - if x != nil { - return x.body - } - - return nil -} - -// SetBody sets response body. -func (x *AnnounceIntermediateResultResponse) SetBody(v *AnnounceIntermediateResultResponseBody) { - x.body = v -} diff --git a/rpc/reputation.go b/rpc/reputation.go deleted file mode 100644 index 3d036b2..0000000 --- a/rpc/reputation.go +++ /dev/null @@ -1,46 +0,0 @@ -package rpc - -import ( - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/reputation" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/client" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/common" -) - -const serviceReputation = serviceNamePrefix + "reputation.ReputationService" - -const ( - rpcReputationAnnounceLocalTrust = "AnnounceLocalTrust" - rpcReputationAnnounceIntermediateResult = "AnnounceIntermediateResult" -) - -// AnnounceLocalTrust executes ReputationService.AnnounceLocalTrust RPC. -func AnnounceLocalTrust( - cli *client.Client, - req *reputation.AnnounceLocalTrustRequest, - opts ...client.CallOption, -) (*reputation.AnnounceLocalTrustResponse, error) { - resp := new(reputation.AnnounceLocalTrustResponse) - - err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceReputation, rpcReputationAnnounceLocalTrust), req, resp, opts...) - if err != nil { - return nil, err - } - - return resp, nil -} - -// AnnounceIntermediateResult executes ReputationService.AnnounceIntermediateResult RPC. -func AnnounceIntermediateResult( - cli *client.Client, - req *reputation.AnnounceIntermediateResultRequest, - opts ...client.CallOption, -) (*reputation.AnnounceIntermediateResultResponse, error) { - resp := new(reputation.AnnounceIntermediateResultResponse) - - err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceReputation, rpcReputationAnnounceIntermediateResult), req, resp, opts...) - if err != nil { - return nil, err - } - - return resp, nil -} diff --git a/session/grpc/service.pb.go b/session/grpc/service.pb.go index 23d6913..5ba114d 100644 --- a/session/grpc/service.pb.go +++ b/session/grpc/service.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.0 +// protoc-gen-go v1.28.1 // protoc v3.21.9 // source: session/grpc/service.proto diff --git a/session/grpc/service_grpc.pb.go b/session/grpc/service_grpc.pb.go index a056280..32793fe 100644 --- a/session/grpc/service_grpc.pb.go +++ b/session/grpc/service_grpc.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.2.0 +// - protoc-gen-go-grpc v1.3.0 // - protoc v3.21.9 // source: session/grpc/service.proto @@ -18,6 +18,10 @@ import ( // Requires gRPC-Go v1.32.0 or later. const _ = grpc.SupportPackageIsVersion7 +const ( + SessionService_Create_FullMethodName = "/neo.fs.v2.session.SessionService/Create" +) + // 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. @@ -41,7 +45,7 @@ func NewSessionServiceClient(cc grpc.ClientConnInterface) SessionServiceClient { func (c *sessionServiceClient) Create(ctx context.Context, in *CreateRequest, opts ...grpc.CallOption) (*CreateResponse, error) { out := new(CreateResponse) - err := c.cc.Invoke(ctx, "/neo.fs.v2.session.SessionService/Create", in, out, opts...) + err := c.cc.Invoke(ctx, SessionService_Create_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -90,7 +94,7 @@ func _SessionService_Create_Handler(srv interface{}, ctx context.Context, dec fu } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/neo.fs.v2.session.SessionService/Create", + FullMethod: SessionService_Create_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(SessionServiceServer).Create(ctx, req.(*CreateRequest)) diff --git a/session/grpc/types.pb.go b/session/grpc/types.pb.go index ed76725..25e0715 100644 --- a/session/grpc/types.pb.go +++ b/session/grpc/types.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.0 +// protoc-gen-go v1.28.1 // protoc v3.21.9 // source: session/grpc/types.proto diff --git a/signature/body.go b/signature/body.go index bf3ab6c..a160ed3 100644 --- a/signature/body.go +++ b/signature/body.go @@ -7,7 +7,6 @@ import ( "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/container" "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/netmap" "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/object" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/reputation" "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session" ) @@ -101,15 +100,5 @@ func serviceMessageBody(req interface{}) stableMarshaler { return v.GetBody() case *netmap.SnapshotResponse: return v.GetBody() - - /* Reputation */ - case *reputation.AnnounceLocalTrustRequest: - return v.GetBody() - case *reputation.AnnounceLocalTrustResponse: - return v.GetBody() - case *reputation.AnnounceIntermediateResultRequest: - return v.GetBody() - case *reputation.AnnounceIntermediateResultResponse: - return v.GetBody() } } diff --git a/status/grpc/types.pb.go b/status/grpc/types.pb.go index f6fd81c..a30533f 100644 --- a/status/grpc/types.pb.go +++ b/status/grpc/types.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.0 +// protoc-gen-go v1.28.1 // protoc v3.21.9 // source: status/grpc/types.proto diff --git a/storagegroup/grpc/types.pb.go b/storagegroup/grpc/types.pb.go index 6629364..75f5b46 100644 --- a/storagegroup/grpc/types.pb.go +++ b/storagegroup/grpc/types.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.0 +// protoc-gen-go v1.28.1 // protoc v3.21.9 // source: storagegroup/grpc/types.proto diff --git a/subnet/grpc/types.pb.go b/subnet/grpc/types.pb.go index c2d7529..032ba6c 100644 --- a/subnet/grpc/types.pb.go +++ b/subnet/grpc/types.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.0 +// protoc-gen-go v1.28.1 // protoc v3.21.9 // source: subnet/grpc/types.proto diff --git a/tombstone/grpc/types.pb.go b/tombstone/grpc/types.pb.go index 3365912..d1065ba 100644 --- a/tombstone/grpc/types.pb.go +++ b/tombstone/grpc/types.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.0 +// protoc-gen-go v1.28.1 // protoc v3.21.9 // source: tombstone/grpc/types.proto diff --git a/util/proto/test/test.pb.go b/util/proto/test/test.pb.go index de6f380..0dfa4dc 100644 --- a/util/proto/test/test.pb.go +++ b/util/proto/test/test.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.0 +// protoc-gen-go v1.28.1 // protoc v3.21.9 // source: util/proto/test/test.proto From bd44a3f47b85117d73ae283ace45e71ec3ddafaa Mon Sep 17 00:00:00 2001 From: Dmitrii Stepanov Date: Tue, 18 Apr 2023 10:43:11 +0300 Subject: [PATCH 1059/1196] [#24] tracing: Fix panic on closed channel Closed channel is also ready for communication, so select statement can write to it. Signed-off-by: Dmitrii Stepanov --- pkg/tracing/grpc.go | 1 - 1 file changed, 1 deletion(-) diff --git a/pkg/tracing/grpc.go b/pkg/tracing/grpc.go index cea59b0..884ecb2 100644 --- a/pkg/tracing/grpc.go +++ b/pkg/tracing/grpc.go @@ -51,7 +51,6 @@ func NewGRPCStreamClientInterceptor() grpc.StreamClientInterceptor { strWrp := newgRPCClientStream(str, desc, finished, done) go func() { - defer close(finished) defer close(done) defer span.End() From ff6d8db7410b4d69cc8bacc7d5ad97681717c91e Mon Sep 17 00:00:00 2001 From: Dmitrii Stepanov Date: Tue, 18 Apr 2023 08:40:42 +0300 Subject: [PATCH 1060/1196] [#19] subnet: Drop related types and fields Signed-off-by: Dmitrii Stepanov --- container/attributes.go | 7 - container/grpc/types.pb.go | 4 - netmap/attributes.go | 232 ------------------------ netmap/attributes_test.go | 361 ------------------------------------- netmap/convert.go | 15 -- netmap/grpc/types.go | 7 - netmap/grpc/types.pb.go | 259 ++++++++++++-------------- netmap/marshal.go | 5 - netmap/test/generate.go | 1 - netmap/types.go | 9 - refs/convert.go | 28 --- refs/grpc/types.go | 5 - refs/grpc/types.pb.go | 184 ++++++------------- refs/marshal.go | 40 ---- refs/message_test.go | 1 - refs/test/generate.go | 10 - refs/types.go | 59 ------ refs/types_test.go | 72 -------- subnet/encoding_test.go | 15 -- subnet/grpc/types.go | 15 -- subnet/grpc/types.pb.go | 171 ------------------ subnet/info.go | 138 -------------- subnet/test/generate.go | 17 -- 23 files changed, 171 insertions(+), 1484 deletions(-) delete mode 100644 netmap/attributes.go delete mode 100644 netmap/attributes_test.go delete mode 100644 refs/types_test.go delete mode 100644 subnet/encoding_test.go delete mode 100644 subnet/grpc/types.go delete mode 100644 subnet/grpc/types.pb.go delete mode 100644 subnet/info.go delete mode 100644 subnet/test/generate.go diff --git a/container/attributes.go b/container/attributes.go index 1d7c94a..12277ed 100644 --- a/container/attributes.go +++ b/container/attributes.go @@ -4,9 +4,6 @@ package container const SysAttributePrefix = "__SYSTEM__" const ( - // SysAttributeSubnet is a string ID of container's storage subnet. - SysAttributeSubnet = SysAttributePrefix + "SUBNET" - // SysAttributeName is a string of human-friendly container name registered as the domain in NNS contract. SysAttributeName = SysAttributePrefix + "NAME" @@ -22,10 +19,6 @@ const ( const SysAttributePrefixNeoFS = "__NEOFS__" const ( - // SysAttributeSubnetNeoFS is a string ID of container's storage subnet. - // Deprecated: use SysAttributeSubnet - SysAttributeSubnetNeoFS = SysAttributePrefixNeoFS + "SUBNET" - // SysAttributeNameNeoFS is a string of human-friendly container name registered as the domain in NNS contract. // Deprecated: use SysAttributeName SysAttributeNameNeoFS = SysAttributePrefixNeoFS + "NAME" diff --git a/container/grpc/types.pb.go b/container/grpc/types.pb.go index 7f0cc1b..0cd53eb 100644 --- a/container/grpc/types.pb.go +++ b/container/grpc/types.pb.go @@ -131,10 +131,6 @@ func (x *Container) GetPlacementPolicy() *grpc1.PlacementPolicy { // // There are some "well-known" attributes affecting system behaviour: // -// - [ __SYSTEM__SUBNET ] \ -// (`__NEOFS__SUBNET` is deprecated) \ -// String ID of a container's storage subnet. Any container can be attached to -// one subnet only. // - [ __SYSTEM__NAME ] \ // (`__NEOFS__NAME` is deprecated) \ // String of a human-friendly container name registered as a domain in diff --git a/netmap/attributes.go b/netmap/attributes.go deleted file mode 100644 index 205376b..0000000 --- a/netmap/attributes.go +++ /dev/null @@ -1,232 +0,0 @@ -package netmap - -import ( - "errors" - "fmt" - "strings" - - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" -) - -// prefix of keys to subnet attributes. -const attrSubnetPrefix = "__SYSTEM__SUBNET_" - -// prefix of keys to subnet attributes. -// Deprecated: use attrSubnetPrefix -const attrSubnetPrefixNeoFS = "__NEOFS__SUBNET_" - -const ( - // subnet attribute's value denoting subnet entry - attrSubnetValEntry = "True" - - // subnet attribute's value denoting subnet exit - attrSubnetValExit = "False" -) - -// NodeSubnetInfo groups information about subnet which can be written to NodeInfo. -// -// Zero value represents entry to zero subnet. -type NodeSubnetInfo struct { - exit bool - - id *refs.SubnetID -} - -// Enabled returns true iff subnet membership is enabled for the node. -func (x NodeSubnetInfo) Enabled() bool { - return !x.exit -} - -// SetEntryFlag sets the subnet entry flag. -func (x *NodeSubnetInfo) SetEntryFlag(enters bool) { - x.exit = !enters -} - -// ID returns identifier of the subnet. -func (x NodeSubnetInfo) ID() *refs.SubnetID { - return x.id -} - -// SetID sets identifier of the subnet. -func (x *NodeSubnetInfo) SetID(id *refs.SubnetID) { - x.id = id -} - -func subnetAttributeKey(id *refs.SubnetID) string { - txt, _ := id.MarshalText() // never returns an error - - return attrSubnetPrefix + string(txt) -} - -// WriteSubnetInfo writes NodeSubnetInfo to NodeInfo via attributes. NodeInfo must not be nil. -// -// Existing subnet attributes are expected to be key-unique, otherwise undefined behavior. -// -// Does not add (removes existing) attribute if node: -// - disables non-zero subnet; -// - enables zero subnet. -// -// Attribute key is calculated from ID using format `__SYSTEM__SUBNET_%s`. -// Attribute Value is: -// - `True` if node enters the subnet; -// - `False`, otherwise. -func WriteSubnetInfo(node *NodeInfo, info NodeSubnetInfo) { - attrs := node.GetAttributes() - - id := info.ID() - enters := info.Enabled() - - // calculate attribute key - key := subnetAttributeKey(id) - - if refs.IsZeroSubnet(id) == enters { - for i := range attrs { - if attrs[i].GetKey() == key { - attrs = append(attrs[:i], attrs[i+1:]...) - break // attributes are expected to be key-unique - } - } - } else { - var val string - - if enters { - val = attrSubnetValEntry - } else { - val = attrSubnetValExit - } - - presented := false - - for i := range attrs { - if attrs[i].GetKey() == key { - attrs[i].SetValue(val) - presented = true - } - } - - if !presented { - index := len(attrs) - attrs = append(attrs, Attribute{}) - attrs[index].SetKey(key) - attrs[index].SetValue(val) - } - } - - node.SetAttributes(attrs) -} - -// ErrRemoveSubnet is returned when a node needs to leave the subnet. -var ErrRemoveSubnet = errors.New("remove subnet") - -var errNoSubnets = errors.New("no subnets") - -// IterateSubnets iterates over all subnets the node belongs to and passes the IDs to f. -// Handler must not be nil. -// -// Subnet attributes are expected to be key-unique, otherwise undefined behavior. -// -// If f returns ErrRemoveSubnet, then removes subnet entry. Note that this leads to an instant mutation of NodeInfo. -// Breaks on any other non-nil error and returns it. -// -// Returns an error if any subnet attribute has wrong format. -// Returns an error if the node is not included in any subnet by the end of the loop. -func IterateSubnets(node *NodeInfo, f func(refs.SubnetID) error) error { - attrs := node.GetAttributes() - - var ( - err error - id refs.SubnetID - entries uint - - zeroEntry = true - ) - - for i := 0; i < len(attrs); i++ { // range must not be used because of attrs mutation in body - key := attrs[i].GetKey() - - // cut subnet ID string - idTxt := strings.TrimPrefix(key, attrSubnetPrefix) - if len(idTxt) == len(key) { - idTxt = strings.TrimPrefix(key, attrSubnetPrefixNeoFS) - if len(idTxt) == len(key) { - // not a subnet attribute - continue - } - } - - // check value - val := attrs[i].GetValue() - if val != attrSubnetValExit && val != attrSubnetValEntry { - return fmt.Errorf("invalid attribute value: %s", val) - } - - // decode subnet ID - if err = id.UnmarshalText([]byte(idTxt)); err != nil { - return fmt.Errorf("invalid ID text: %w", err) - } - - // update status of zero subnet - isZero := refs.IsZeroSubnet(&id) - - if isZero { - zeroEntry = val == attrSubnetValEntry - } - - // continue to process only the subnets to which the node belongs - if val == attrSubnetValExit { - continue - } - - // pass ID to the handler - err = f(id) - - isRemoveErr := errors.Is(err, ErrRemoveSubnet) - - if err != nil && !isRemoveErr { - return err - } - - if isRemoveErr { - if isZero { - // we can't remove attribute of zero subnet because it means entry - attrs[i].SetValue(attrSubnetValExit) - } else { - // we can set False or remove attribute, latter is more memory/network efficient. - attrs = append(attrs[:i], attrs[i+1:]...) - i-- - } - - continue - } - - entries++ - } - - if zeroEntry { - // missing attribute of zero subnet equivalent to entry - refs.MakeZeroSubnet(&id) - - err = f(id) - if err != nil { - if !errors.Is(err, ErrRemoveSubnet) { - return err - } - - // zero subnet should be clearly removed with False value - index := len(attrs) - attrs = append(attrs, Attribute{}) - attrs[index].SetKey(subnetAttributeKey(&id)) - attrs[index].SetValue(attrSubnetValExit) - } else { - entries++ - } - } - - if entries <= 0 { - return errNoSubnets - } - - node.SetAttributes(attrs) - - return nil -} diff --git a/netmap/attributes_test.go b/netmap/attributes_test.go deleted file mode 100644 index 1a340bd..0000000 --- a/netmap/attributes_test.go +++ /dev/null @@ -1,361 +0,0 @@ -package netmap_test - -import ( - "strconv" - "testing" - - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/netmap" - netmaptest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/netmap/test" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" - "github.com/stretchr/testify/require" -) - -func subnetAttrKey(val string) string { - return "__SYSTEM__SUBNET_" + val -} - -func assertSubnetAttrKey(t *testing.T, attr *netmap.Attribute, num uint32) { - require.Equal(t, subnetAttrKey(strconv.FormatUint(uint64(num), 10)), attr.GetKey()) -} - -func BenchmarkNodeAttributes(b *testing.B) { - const size = 50 - - id := new(refs.SubnetID) - id.SetValue(12) - - attrs := make([]netmap.Attribute, size) - for i := range attrs { - if i == size/2 { - attrs[i] = *netmaptest.GenerateAttribute(false) - } else { - data, err := id.MarshalText() - require.NoError(b, err) - - attrs[i].SetKey(subnetAttrKey(string(data))) - attrs[i].SetValue("True") - } - } - - var info netmap.NodeSubnetInfo - info.SetID(id) - info.SetEntryFlag(false) - - node := new(netmap.NodeInfo) - - // When using a single slice `StartTimer` overhead is comparable to the - // function execution time, so we reduce this cost by updating slices in groups. - const cacheSize = 1000 - a := make([][]netmap.Attribute, cacheSize) - for i := range a { - a[i] = make([]netmap.Attribute, size) - } - - b.ResetTimer() - b.ReportAllocs() - for i := 0; i < b.N; i++ { - if i%cacheSize == 0 { - b.StopTimer() - for j := range a { - copy(a[j], attrs) - } - b.StartTimer() - } - node.SetAttributes(a[i%cacheSize]) - netmap.WriteSubnetInfo(node, info) - if len(node.GetAttributes())+1 != len(attrs) { - b.FailNow() - } - } -} - -func TestWriteSubnetInfo(t *testing.T) { - t.Run("entry", func(t *testing.T) { - t.Run("zero subnet", func(t *testing.T) { - var ( - node netmap.NodeInfo - info netmap.NodeSubnetInfo - ) - - netmap.WriteSubnetInfo(&node, info) - - // entry to zero subnet does not require an attribute - attrs := node.GetAttributes() - require.Empty(t, attrs) - - // exit the subnet - info.SetEntryFlag(false) - - netmap.WriteSubnetInfo(&node, info) - - // exit from zero subnet should be clearly reflected in attributes - attrs = node.GetAttributes() - require.Len(t, attrs, 1) - - attr := &attrs[0] - assertSubnetAttrKey(t, attr, 0) - require.Equal(t, "False", attr.GetValue()) - - // again enter to zero subnet - info.SetEntryFlag(true) - - netmap.WriteSubnetInfo(&node, info) - - // attribute should be removed - attrs = node.GetAttributes() - require.Empty(t, attrs) - }) - - t.Run("non-zero subnet", func(t *testing.T) { - var ( - node netmap.NodeInfo - info netmap.NodeSubnetInfo - id refs.SubnetID - ) - - // create non-zero subnet ID - const num = 15 - - id.SetValue(num) - - // enter to the subnet - info.SetID(&id) - info.SetEntryFlag(true) - - netmap.WriteSubnetInfo(&node, info) - - // check attribute format - attrs := node.GetAttributes() - require.Len(t, attrs, 1) - - attr := &attrs[0] - assertSubnetAttrKey(t, attr, num) - require.Equal(t, "True", attr.GetValue()) - - // again exit the subnet - info.SetEntryFlag(false) - - netmap.WriteSubnetInfo(&node, info) - - // attribute should be removed - attrs = node.GetAttributes() - require.Empty(t, attrs) - }) - }) -} - -func TestSubnets(t *testing.T) { - t.Run("empty", func(t *testing.T) { - var node netmap.NodeInfo - - called := 0 - - err := netmap.IterateSubnets(&node, func(id refs.SubnetID) error { - called++ - - require.True(t, refs.IsZeroSubnet(&id)) - - return nil - }) - - require.NoError(t, err) - require.EqualValues(t, 1, called) - }) - - t.Run("with correct attribute", func(t *testing.T) { - var ( - node netmap.NodeInfo - - attrEntry, attrExit netmap.Attribute - ) - - const ( - numEntry = 13 - numExit = 14 - ) - - attrEntry.SetKey(subnetAttrKey(strconv.FormatUint(numEntry, 10))) - attrEntry.SetValue("True") - - attrExit.SetKey(subnetAttrKey(strconv.FormatUint(numExit, 10))) - attrExit.SetValue("False") - - attrs := []netmap.Attribute{attrEntry, attrEntry} - - node.SetAttributes(attrs) - - mCalledNums := make(map[uint32]struct{}) - - err := netmap.IterateSubnets(&node, func(id refs.SubnetID) error { - mCalledNums[id.GetValue()] = struct{}{} - - return nil - }) - - require.NoError(t, err) - require.Len(t, mCalledNums, 2) - - _, ok := mCalledNums[numEntry] - require.True(t, ok) - - _, ok = mCalledNums[numExit] - require.False(t, ok) - - _, ok = mCalledNums[0] - require.True(t, ok) - }) - - t.Run("with incorrect attribute", func(t *testing.T) { - assertErr := func(attr netmap.Attribute) { - var node netmap.NodeInfo - - node.SetAttributes([]netmap.Attribute{attr}) - - require.Error(t, netmap.IterateSubnets(&node, func(refs.SubnetID) error { - return nil - })) - } - - t.Run("incorrect key", func(t *testing.T) { - var attr netmap.Attribute - - attr.SetKey(subnetAttrKey("one-two-three")) - - assertErr(attr) - }) - - t.Run("incorrect value", func(t *testing.T) { - var attr netmap.Attribute - - attr.SetKey(subnetAttrKey("1")) - - for _, invalidVal := range []string{ - "", - "Troo", - "Fols", - } { - attr.SetValue(invalidVal) - assertErr(attr) - } - - assertErr(attr) - }) - }) - - t.Run("remove entry", func(t *testing.T) { - t.Run("zero", func(t *testing.T) { - var node netmap.NodeInfo - - // enter to some non-zero subnet so that zero is not the only one - var attr netmap.Attribute - - attr.SetKey(subnetAttrKey("321")) - attr.SetValue("True") - - attrs := []netmap.Attribute{attr} - node.SetAttributes(attrs) - - err := netmap.IterateSubnets(&node, func(id refs.SubnetID) error { - if refs.IsZeroSubnet(&id) { - return netmap.ErrRemoveSubnet - } - - return nil - }) - - require.NoError(t, err) - - attrs = node.GetAttributes() - require.Len(t, attrs, 2) - - found := false - - for i := range attrs { - if attrs[i].GetKey() == subnetAttrKey("0") { - require.Equal(t, "False", attrs[i].GetValue()) - found = true - } - } - - require.True(t, found) - }) - - t.Run("non-zero", func(t *testing.T) { - var ( - node netmap.NodeInfo - attr netmap.Attribute - ) - - attr.SetKey(subnetAttrKey("99")) - attr.SetValue("True") - - attrs := []netmap.Attribute{attr} - node.SetAttributes(attrs) - - err := netmap.IterateSubnets(&node, func(id refs.SubnetID) error { - if !refs.IsZeroSubnet(&id) { - return netmap.ErrRemoveSubnet - } - - return nil - }) - - require.NoError(t, err) - - attrs = node.GetAttributes() - require.Empty(t, attrs) - }) - - t.Run("all", func(t *testing.T) { - var ( - node netmap.NodeInfo - attrs []netmap.Attribute - ) - - // enter to some non-zero subnet so that zero is not the only one - for i := 1; i <= 5; i++ { - var attr netmap.Attribute - - attr.SetKey(subnetAttrKey(strconv.Itoa(i))) - attr.SetValue("True") - - attrs = append(attrs, attr) - } - - node.SetAttributes(attrs) - - err := netmap.IterateSubnets(&node, func(id refs.SubnetID) error { - return netmap.ErrRemoveSubnet - }) - - require.Error(t, err) - }) - }) - - t.Run("zero subnet removal via attribute", func(t *testing.T) { - var ( - node netmap.NodeInfo - - attrZero, attrOther netmap.Attribute - ) - - attrZero.SetKey(subnetAttrKey("0")) - attrZero.SetValue("False") - - attrOther.SetKey(subnetAttrKey("1")) - attrOther.SetValue("True") - - node.SetAttributes([]netmap.Attribute{attrZero, attrOther}) - - calledCount := 0 - - err := netmap.IterateSubnets(&node, func(id refs.SubnetID) error { - require.False(t, refs.IsZeroSubnet(&id)) - calledCount++ - return nil - }) - - require.NoError(t, err) - require.EqualValues(t, 1, calledCount) - }) -} diff --git a/netmap/convert.go b/netmap/convert.go index cc20d36..6bb1525 100644 --- a/netmap/convert.go +++ b/netmap/convert.go @@ -198,7 +198,6 @@ func (p *PlacementPolicy) ToGRPCMessage() grpc.Message { m.SetSelectors(SelectorsToGRPC(p.selectors)) m.SetReplicas(ReplicasToGRPC(p.replicas)) m.SetContainerBackupFactor(p.backupFactor) - m.SetSubnetID(p.subnetID.ToGRPCMessage().(*refsGRPC.SubnetID)) } return m @@ -227,20 +226,6 @@ func (p *PlacementPolicy) FromGRPCMessage(m grpc.Message) error { return err } - subnetID := v.GetSubnetId() - if subnetID == nil { - p.subnetID = nil - } else { - if p.subnetID == nil { - p.subnetID = new(refs.SubnetID) - } - - err = p.subnetID.FromGRPCMessage(subnetID) - if err != nil { - return err - } - } - p.backupFactor = v.GetContainerBackupFactor() return nil diff --git a/netmap/grpc/types.go b/netmap/grpc/types.go index d0bf41a..f312bbb 100644 --- a/netmap/grpc/types.go +++ b/netmap/grpc/types.go @@ -1,7 +1,5 @@ package netmap -import refs "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc" - // SetReplicas of placement policy. func (m *PlacementPolicy) SetReplicas(v []*Replica) { m.Replicas = v @@ -22,11 +20,6 @@ func (m *PlacementPolicy) SetFilters(v []*Filter) { m.Filters = v } -// SetSubnetID sets ID of subnet. -func (m *PlacementPolicy) SetSubnetID(v *refs.SubnetID) { - m.SubnetId = v -} - // SetName of placement filter. func (m *Filter) SetName(v string) { m.Name = v diff --git a/netmap/grpc/types.pb.go b/netmap/grpc/types.pb.go index 276e648..f1d5ef0 100644 --- a/netmap/grpc/types.pb.go +++ b/netmap/grpc/types.pb.go @@ -7,7 +7,6 @@ package netmap import ( - grpc "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -464,9 +463,6 @@ type PlacementPolicy struct { Selectors []*Selector `protobuf:"bytes,3,rep,name=selectors,proto3" json:"selectors,omitempty"` // List of named filters to reference in selectors Filters []*Filter `protobuf:"bytes,4,rep,name=filters,proto3" json:"filters,omitempty"` - // Subnetwork ID to select nodes from. Zero subnet (default) represents - // all of the nodes which didn't explicitly opt out of membership. - SubnetId *grpc.SubnetID `protobuf:"bytes,5,opt,name=subnet_id,json=subnetId,proto3" json:"subnet_id,omitempty"` } func (x *PlacementPolicy) Reset() { @@ -529,13 +525,6 @@ func (x *PlacementPolicy) GetFilters() []*Filter { return nil } -func (x *PlacementPolicy) GetSubnetId() *grpc.SubnetID { - if x != nil { - return x.SubnetId - } - return nil -} - // NeoFS node description type NodeInfo struct { state protoimpl.MessageState @@ -827,14 +816,6 @@ func (x *NetworkInfo) GetNetworkConfig() *NetworkConfig { // attributes it's a string presenting floating point number with comma or // point delimiter for decimal part. In the Network Map it will be saved as // 64-bit unsigned integer representing number of minimal token fractions. -// - [ __SYSTEM__SUBNET_%s ] \ -// (`__NEOFS__SUBNET_%s` is deprecated) \ -// `True` or `False`. Defines if the node is included in the `%s` subnetwork -// or not. `%s` must be an existing subnetwork's ID (non-negative integer number). -// A node can be included in more than one subnetwork and, therefore, can contain -// more than one subnet attribute. A missing attribute is equivalent to the -// presence of the attribute with `False` value (except default zero subnetwork -// (with `%s` == 0) for which missing attribute means inclusion in that network). // - UN-LOCODE \ // Node's geographic location in // [UN/LOCODE](https://www.unece.org/cefact/codesfortrade/codes_index.html) @@ -956,13 +937,6 @@ func (x *NodeInfo_Attribute) GetParents() []string { // - **ContainerFee** \ // Fee paid for container creation by the container owner. // Value: little-endian integer. Default: 0. -// - **EigenTrustAlpha** \ -// Alpha parameter of EigenTrust algorithm used in the Reputation system. -// Value: decimal floating-point number in UTF-8 string representation. -// Default: 0. -// - **EigenTrustIterations** \ -// Number of EigenTrust algorithm iterations to pass in the Reputation system. -// Value: little-endian integer. Default: 0. // - **EpochDuration** \ // NeoFS epoch duration measured in Sidechain blocks. // Value: little-endian integer. Default: 0. @@ -1043,116 +1017,111 @@ var File_netmap_grpc_types_proto protoreflect.FileDescriptor var file_netmap_grpc_types_proto_rawDesc = []byte{ 0x0a, 0x17, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x10, 0x6e, 0x65, 0x6f, 0x2e, 0x66, - 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x1a, 0x15, 0x72, 0x65, 0x66, - 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x22, 0xa5, 0x01, 0x0a, 0x06, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x12, 0x0a, - 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, - 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, - 0x6b, 0x65, 0x79, 0x12, 0x2b, 0x0a, 0x02, 0x6f, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, - 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, - 0x61, 0x70, 0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x02, 0x6f, 0x70, - 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x32, 0x0a, 0x07, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, - 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, - 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x46, 0x69, 0x6c, 0x74, 0x65, - 0x72, 0x52, 0x07, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x73, 0x22, 0x9c, 0x01, 0x0a, 0x08, 0x53, - 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x63, - 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, - 0x74, 0x12, 0x30, 0x0a, 0x06, 0x63, 0x6c, 0x61, 0x75, 0x73, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x0e, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, - 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x43, 0x6c, 0x61, 0x75, 0x73, 0x65, 0x52, 0x06, 0x63, 0x6c, 0x61, - 0x75, 0x73, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, - 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, - 0x65, 0x12, 0x16, 0x0a, 0x06, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x06, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x22, 0x3b, 0x0a, 0x07, 0x52, 0x65, 0x70, - 0x6c, 0x69, 0x63, 0x61, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0d, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x65, - 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x73, 0x65, - 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x22, 0xa5, 0x02, 0x0a, 0x0f, 0x50, 0x6c, 0x61, 0x63, 0x65, - 0x6d, 0x65, 0x6e, 0x74, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x35, 0x0a, 0x08, 0x72, 0x65, - 0x70, 0x6c, 0x69, 0x63, 0x61, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, - 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, - 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x52, 0x08, 0x72, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, - 0x73, 0x12, 0x36, 0x0a, 0x17, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x62, - 0x61, 0x63, 0x6b, 0x75, 0x70, 0x5f, 0x66, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0d, 0x52, 0x15, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x42, 0x61, 0x63, - 0x6b, 0x75, 0x70, 0x46, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x12, 0x38, 0x0a, 0x09, 0x73, 0x65, 0x6c, - 0x65, 0x63, 0x74, 0x6f, 0x72, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6e, - 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, - 0x53, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x52, 0x09, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, - 0x6f, 0x72, 0x73, 0x12, 0x32, 0x0a, 0x07, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x73, 0x18, 0x04, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, - 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x07, - 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x73, 0x12, 0x35, 0x0a, 0x09, 0x73, 0x75, 0x62, 0x6e, 0x65, - 0x74, 0x5f, 0x69, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, - 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x75, 0x62, 0x6e, - 0x65, 0x74, 0x49, 0x44, 0x52, 0x08, 0x73, 0x75, 0x62, 0x6e, 0x65, 0x74, 0x49, 0x64, 0x22, 0xd8, - 0x02, 0x0a, 0x08, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x1d, 0x0a, 0x0a, 0x70, - 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, - 0x09, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x12, 0x1c, 0x0a, 0x09, 0x61, 0x64, - 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x09, 0x61, - 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x12, 0x44, 0x0a, 0x0a, 0x61, 0x74, 0x74, 0x72, - 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6e, - 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, - 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, - 0x74, 0x65, 0x52, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x36, - 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x20, 0x2e, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x22, 0xa5, 0x01, 0x0a, 0x06, + 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, + 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x2b, 0x0a, 0x02, + 0x6f, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4f, 0x70, 0x65, 0x72, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x02, 0x6f, 0x70, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, + 0x32, 0x0a, 0x07, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, + 0x6d, 0x61, 0x70, 0x2e, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x07, 0x66, 0x69, 0x6c, 0x74, + 0x65, 0x72, 0x73, 0x22, 0x9c, 0x01, 0x0a, 0x08, 0x53, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, + 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, + 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0d, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x30, 0x0a, 0x06, 0x63, 0x6c, + 0x61, 0x75, 0x73, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, + 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x43, 0x6c, + 0x61, 0x75, 0x73, 0x65, 0x52, 0x06, 0x63, 0x6c, 0x61, 0x75, 0x73, 0x65, 0x12, 0x1c, 0x0a, 0x09, + 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x09, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x66, 0x69, + 0x6c, 0x74, 0x65, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x66, 0x69, 0x6c, 0x74, + 0x65, 0x72, 0x22, 0x3b, 0x0a, 0x07, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x12, 0x14, 0x0a, + 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x63, 0x6f, + 0x75, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x22, + 0xee, 0x01, 0x0a, 0x0f, 0x50, 0x6c, 0x61, 0x63, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x50, 0x6f, 0x6c, + 0x69, 0x63, 0x79, 0x12, 0x35, 0x0a, 0x08, 0x72, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x73, 0x18, + 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, + 0x52, 0x08, 0x72, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x73, 0x12, 0x36, 0x0a, 0x17, 0x63, 0x6f, + 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x62, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x5f, 0x66, + 0x61, 0x63, 0x74, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x15, 0x63, 0x6f, 0x6e, + 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x42, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x46, 0x61, 0x63, 0x74, + 0x6f, 0x72, 0x12, 0x38, 0x0a, 0x09, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x73, 0x18, + 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x53, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, + 0x72, 0x52, 0x09, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x73, 0x12, 0x32, 0x0a, 0x07, + 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, - 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, - 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x1a, 0x4d, 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, 0x12, 0x18, 0x0a, 0x07, 0x70, - 0x61, 0x72, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x70, 0x61, - 0x72, 0x65, 0x6e, 0x74, 0x73, 0x22, 0x42, 0x0a, 0x05, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x0f, - 0x0a, 0x0b, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, - 0x0a, 0x0a, 0x06, 0x4f, 0x4e, 0x4c, 0x49, 0x4e, 0x45, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x4f, - 0x46, 0x46, 0x4c, 0x49, 0x4e, 0x45, 0x10, 0x02, 0x12, 0x0f, 0x0a, 0x0b, 0x4d, 0x41, 0x49, 0x4e, - 0x54, 0x45, 0x4e, 0x41, 0x4e, 0x43, 0x45, 0x10, 0x03, 0x22, 0x50, 0x0a, 0x06, 0x4e, 0x65, 0x74, - 0x6d, 0x61, 0x70, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x04, 0x52, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x12, 0x30, 0x0a, 0x05, 0x6e, 0x6f, 0x64, - 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, - 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4e, 0x6f, 0x64, 0x65, - 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x05, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x22, 0x8f, 0x01, 0x0a, 0x0d, - 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x49, 0x0a, - 0x0a, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x29, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, + 0x2e, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x07, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x73, + 0x22, 0xd8, 0x02, 0x0a, 0x08, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x1d, 0x0a, + 0x0a, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0c, 0x52, 0x09, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x12, 0x1c, 0x0a, 0x09, + 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, + 0x09, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x12, 0x44, 0x0a, 0x0a, 0x61, 0x74, + 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, + 0x70, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x41, 0x74, 0x74, 0x72, 0x69, + 0x62, 0x75, 0x74, 0x65, 0x52, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, + 0x12, 0x36, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, + 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, + 0x61, 0x70, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x53, 0x74, 0x61, 0x74, + 0x65, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x1a, 0x4d, 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, 0x12, 0x18, 0x0a, + 0x07, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, + 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x73, 0x22, 0x42, 0x0a, 0x05, 0x53, 0x74, 0x61, 0x74, 0x65, + 0x12, 0x0f, 0x0a, 0x0b, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, + 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x4f, 0x4e, 0x4c, 0x49, 0x4e, 0x45, 0x10, 0x01, 0x12, 0x0b, 0x0a, + 0x07, 0x4f, 0x46, 0x46, 0x4c, 0x49, 0x4e, 0x45, 0x10, 0x02, 0x12, 0x0f, 0x0a, 0x0b, 0x4d, 0x41, + 0x49, 0x4e, 0x54, 0x45, 0x4e, 0x41, 0x4e, 0x43, 0x45, 0x10, 0x03, 0x22, 0x50, 0x0a, 0x06, 0x4e, + 0x65, 0x74, 0x6d, 0x61, 0x70, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x12, 0x30, 0x0a, 0x05, 0x6e, + 0x6f, 0x64, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6e, 0x65, 0x6f, + 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4e, 0x6f, + 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x05, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x22, 0x8f, 0x01, + 0x0a, 0x0d, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, + 0x49, 0x0a, 0x0a, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, + 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x43, 0x6f, + 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x52, 0x0a, + 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x1a, 0x33, 0x0a, 0x09, 0x50, 0x61, + 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0c, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, + 0xbf, 0x01, 0x0a, 0x0b, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x12, + 0x23, 0x0a, 0x0d, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x65, 0x70, 0x6f, 0x63, 0x68, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0c, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x45, + 0x70, 0x6f, 0x63, 0x68, 0x12, 0x21, 0x0a, 0x0c, 0x6d, 0x61, 0x67, 0x69, 0x63, 0x5f, 0x6e, 0x75, + 0x6d, 0x62, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0b, 0x6d, 0x61, 0x67, 0x69, + 0x63, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x20, 0x0a, 0x0c, 0x6d, 0x73, 0x5f, 0x70, 0x65, + 0x72, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x6d, + 0x73, 0x50, 0x65, 0x72, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x46, 0x0a, 0x0e, 0x6e, 0x65, 0x74, + 0x77, 0x6f, 0x72, 0x6b, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x43, 0x6f, 0x6e, 0x66, - 0x69, 0x67, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x52, 0x0a, 0x70, 0x61, - 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x1a, 0x33, 0x0a, 0x09, 0x50, 0x61, 0x72, 0x61, - 0x6d, 0x65, 0x74, 0x65, 0x72, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0c, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xbf, 0x01, - 0x0a, 0x0b, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x23, 0x0a, - 0x0d, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x04, 0x52, 0x0c, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x45, 0x70, 0x6f, - 0x63, 0x68, 0x12, 0x21, 0x0a, 0x0c, 0x6d, 0x61, 0x67, 0x69, 0x63, 0x5f, 0x6e, 0x75, 0x6d, 0x62, - 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0b, 0x6d, 0x61, 0x67, 0x69, 0x63, 0x4e, - 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x20, 0x0a, 0x0c, 0x6d, 0x73, 0x5f, 0x70, 0x65, 0x72, 0x5f, - 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x6d, 0x73, 0x50, - 0x65, 0x72, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x46, 0x0a, 0x0e, 0x6e, 0x65, 0x74, 0x77, 0x6f, - 0x72, 0x6b, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, - 0x61, 0x70, 0x2e, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, - 0x52, 0x0d, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2a, - 0x67, 0x0a, 0x09, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x19, 0x0a, 0x15, - 0x4f, 0x50, 0x45, 0x52, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, - 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x06, 0x0a, 0x02, 0x45, 0x51, 0x10, 0x01, 0x12, - 0x06, 0x0a, 0x02, 0x4e, 0x45, 0x10, 0x02, 0x12, 0x06, 0x0a, 0x02, 0x47, 0x54, 0x10, 0x03, 0x12, - 0x06, 0x0a, 0x02, 0x47, 0x45, 0x10, 0x04, 0x12, 0x06, 0x0a, 0x02, 0x4c, 0x54, 0x10, 0x05, 0x12, - 0x06, 0x0a, 0x02, 0x4c, 0x45, 0x10, 0x06, 0x12, 0x06, 0x0a, 0x02, 0x4f, 0x52, 0x10, 0x07, 0x12, - 0x07, 0x0a, 0x03, 0x41, 0x4e, 0x44, 0x10, 0x08, 0x2a, 0x38, 0x0a, 0x06, 0x43, 0x6c, 0x61, 0x75, - 0x73, 0x65, 0x12, 0x16, 0x0a, 0x12, 0x43, 0x4c, 0x41, 0x55, 0x53, 0x45, 0x5f, 0x55, 0x4e, 0x53, - 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x53, 0x41, - 0x4d, 0x45, 0x10, 0x01, 0x12, 0x0c, 0x0a, 0x08, 0x44, 0x49, 0x53, 0x54, 0x49, 0x4e, 0x43, 0x54, - 0x10, 0x02, 0x42, 0x61, 0x5a, 0x42, 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, 0x61, 0x70, 0x69, 0x2d, - 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2f, 0x67, 0x72, 0x70, - 0x63, 0x3b, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0xaa, 0x02, 0x1a, 0x4e, 0x65, 0x6f, 0x2e, 0x46, - 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x4e, - 0x65, 0x74, 0x6d, 0x61, 0x70, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x69, 0x67, 0x52, 0x0d, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x43, 0x6f, 0x6e, 0x66, 0x69, + 0x67, 0x2a, 0x67, 0x0a, 0x09, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x19, + 0x0a, 0x15, 0x4f, 0x50, 0x45, 0x52, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x53, 0x50, + 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x06, 0x0a, 0x02, 0x45, 0x51, 0x10, + 0x01, 0x12, 0x06, 0x0a, 0x02, 0x4e, 0x45, 0x10, 0x02, 0x12, 0x06, 0x0a, 0x02, 0x47, 0x54, 0x10, + 0x03, 0x12, 0x06, 0x0a, 0x02, 0x47, 0x45, 0x10, 0x04, 0x12, 0x06, 0x0a, 0x02, 0x4c, 0x54, 0x10, + 0x05, 0x12, 0x06, 0x0a, 0x02, 0x4c, 0x45, 0x10, 0x06, 0x12, 0x06, 0x0a, 0x02, 0x4f, 0x52, 0x10, + 0x07, 0x12, 0x07, 0x0a, 0x03, 0x41, 0x4e, 0x44, 0x10, 0x08, 0x2a, 0x38, 0x0a, 0x06, 0x43, 0x6c, + 0x61, 0x75, 0x73, 0x65, 0x12, 0x16, 0x0a, 0x12, 0x43, 0x4c, 0x41, 0x55, 0x53, 0x45, 0x5f, 0x55, + 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, + 0x53, 0x41, 0x4d, 0x45, 0x10, 0x01, 0x12, 0x0c, 0x0a, 0x08, 0x44, 0x49, 0x53, 0x54, 0x49, 0x4e, + 0x43, 0x54, 0x10, 0x02, 0x42, 0x61, 0x5a, 0x42, 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, 0x61, 0x70, + 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2f, 0x67, + 0x72, 0x70, 0x63, 0x3b, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0xaa, 0x02, 0x1a, 0x4e, 0x65, 0x6f, + 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, + 0x2e, 0x4e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -1183,7 +1152,6 @@ var file_netmap_grpc_types_proto_goTypes = []interface{}{ (*NetworkInfo)(nil), // 10: neo.fs.v2.netmap.NetworkInfo (*NodeInfo_Attribute)(nil), // 11: neo.fs.v2.netmap.NodeInfo.Attribute (*NetworkConfig_Parameter)(nil), // 12: neo.fs.v2.netmap.NetworkConfig.Parameter - (*grpc.SubnetID)(nil), // 13: neo.fs.v2.refs.SubnetID } var file_netmap_grpc_types_proto_depIdxs = []int32{ 0, // 0: neo.fs.v2.netmap.Filter.op:type_name -> neo.fs.v2.netmap.Operation @@ -1192,17 +1160,16 @@ var file_netmap_grpc_types_proto_depIdxs = []int32{ 5, // 3: neo.fs.v2.netmap.PlacementPolicy.replicas:type_name -> neo.fs.v2.netmap.Replica 4, // 4: neo.fs.v2.netmap.PlacementPolicy.selectors:type_name -> neo.fs.v2.netmap.Selector 3, // 5: neo.fs.v2.netmap.PlacementPolicy.filters:type_name -> neo.fs.v2.netmap.Filter - 13, // 6: neo.fs.v2.netmap.PlacementPolicy.subnet_id:type_name -> neo.fs.v2.refs.SubnetID - 11, // 7: neo.fs.v2.netmap.NodeInfo.attributes:type_name -> neo.fs.v2.netmap.NodeInfo.Attribute - 2, // 8: neo.fs.v2.netmap.NodeInfo.state:type_name -> neo.fs.v2.netmap.NodeInfo.State - 7, // 9: neo.fs.v2.netmap.Netmap.nodes:type_name -> neo.fs.v2.netmap.NodeInfo - 12, // 10: neo.fs.v2.netmap.NetworkConfig.parameters:type_name -> neo.fs.v2.netmap.NetworkConfig.Parameter - 9, // 11: neo.fs.v2.netmap.NetworkInfo.network_config:type_name -> neo.fs.v2.netmap.NetworkConfig - 12, // [12:12] is the sub-list for method output_type - 12, // [12:12] is the sub-list for method input_type - 12, // [12:12] is the sub-list for extension type_name - 12, // [12:12] is the sub-list for extension extendee - 0, // [0:12] is the sub-list for field type_name + 11, // 6: neo.fs.v2.netmap.NodeInfo.attributes:type_name -> neo.fs.v2.netmap.NodeInfo.Attribute + 2, // 7: neo.fs.v2.netmap.NodeInfo.state:type_name -> neo.fs.v2.netmap.NodeInfo.State + 7, // 8: neo.fs.v2.netmap.Netmap.nodes:type_name -> neo.fs.v2.netmap.NodeInfo + 12, // 9: neo.fs.v2.netmap.NetworkConfig.parameters:type_name -> neo.fs.v2.netmap.NetworkConfig.Parameter + 9, // 10: neo.fs.v2.netmap.NetworkInfo.network_config:type_name -> neo.fs.v2.netmap.NetworkConfig + 11, // [11:11] is the sub-list for method output_type + 11, // [11:11] is the sub-list for method input_type + 11, // [11:11] is the sub-list for extension type_name + 11, // [11:11] is the sub-list for extension extendee + 0, // [0:11] is the sub-list for field type_name } func init() { file_netmap_grpc_types_proto_init() } diff --git a/netmap/marshal.go b/netmap/marshal.go index e08d6f0..5c8cf35 100644 --- a/netmap/marshal.go +++ b/netmap/marshal.go @@ -26,7 +26,6 @@ const ( backupPolicyField = 2 selectorsPolicyField = 3 filtersPolicyField = 4 - subnetIDPolicyField = 5 keyAttributeField = 1 valueAttributeField = 2 @@ -167,8 +166,6 @@ func (p *PlacementPolicy) StableMarshal(buf []byte) []byte { offset += protoutil.NestedStructureMarshal(filtersPolicyField, buf[offset:], &p.filters[i]) } - protoutil.NestedStructureMarshal(subnetIDPolicyField, buf[offset:], p.subnetID) - return buf } @@ -187,8 +184,6 @@ func (p *PlacementPolicy) StableSize() (size int) { size += protoutil.NestedStructureSize(filtersPolicyField, &p.filters[i]) } - size += protoutil.NestedStructureSize(subnetIDPolicyField, p.subnetID) - return size } diff --git a/netmap/test/generate.go b/netmap/test/generate.go index 30e200e..8889bab 100644 --- a/netmap/test/generate.go +++ b/netmap/test/generate.go @@ -102,7 +102,6 @@ func GeneratePlacementPolicy(empty bool) *netmap.PlacementPolicy { m.SetFilters(GenerateFilters(false)) m.SetSelectors(GenerateSelectors(false)) m.SetReplicas(GenerateReplicas(false)) - m.SetSubnetID(refstest.GenerateSubnetID(false)) } return m diff --git a/netmap/types.go b/netmap/types.go index c878184..27fc2ff 100644 --- a/netmap/types.go +++ b/netmap/types.go @@ -59,7 +59,6 @@ type PlacementPolicy struct { backupFactor uint32 selectors []Selector filters []Filter - subnetID *refs.SubnetID } // Attribute of storage node. @@ -302,14 +301,6 @@ func (p *PlacementPolicy) SetReplicas(replicas []Replica) { p.replicas = replicas } -func (p *PlacementPolicy) GetSubnetID() *refs.SubnetID { - return p.subnetID -} - -func (p *PlacementPolicy) SetSubnetID(id *refs.SubnetID) { - p.subnetID = id -} - func (a *Attribute) GetKey() string { if a != nil { return a.key diff --git a/refs/convert.go b/refs/convert.go index 028bd6a..b2c353c 100644 --- a/refs/convert.go +++ b/refs/convert.go @@ -266,31 +266,3 @@ func (s *Signature) FromGRPCMessage(m grpc.Message) error { return nil } - -// ToGRPCMessage forms refs.SubnetID message and returns it as grpc.Message. -func (s *SubnetID) ToGRPCMessage() grpc.Message { - var m *refs.SubnetID - - if s != nil { - m = new(refs.SubnetID) - - m.SetValue(s.value) - } - - return m -} - -// FromGRPCMessage restores Info from grpc.Message. -// -// Supported types: -// - refs.SubnetID. -func (s *SubnetID) FromGRPCMessage(m grpc.Message) error { - v, ok := m.(*refs.SubnetID) - if !ok { - return message.NewUnexpectedMessageType(m, v) - } - - s.value = v.GetValue() - - return nil -} diff --git a/refs/grpc/types.go b/refs/grpc/types.go index 0cf7368..843a2ee 100644 --- a/refs/grpc/types.go +++ b/refs/grpc/types.go @@ -95,8 +95,3 @@ func (x *ChecksumType) FromString(s string) bool { return ok } - -// SetValue sets subnet identifier in a base-10 integer format. -func (x *SubnetID) SetValue(v uint32) { - x.Value = v -} diff --git a/refs/grpc/types.pb.go b/refs/grpc/types.pb.go index 0d6b671..f16583b 100644 --- a/refs/grpc/types.pb.go +++ b/refs/grpc/types.pb.go @@ -378,59 +378,6 @@ func (x *OwnerID) GetValue() []byte { return nil } -// NeoFS subnetwork identifier. -// -// String representation of a value is base-10 integer. -// -// JSON representation is an object containing a single `value` number field. -type SubnetID struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // 4-byte integer subnetwork identifier. - Value uint32 `protobuf:"fixed32,1,opt,name=value,proto3" json:"value,omitempty"` -} - -func (x *SubnetID) Reset() { - *x = SubnetID{} - if protoimpl.UnsafeEnabled { - mi := &file_refs_grpc_types_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SubnetID) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SubnetID) ProtoMessage() {} - -func (x *SubnetID) ProtoReflect() protoreflect.Message { - mi := &file_refs_grpc_types_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SubnetID.ProtoReflect.Descriptor instead. -func (*SubnetID) Descriptor() ([]byte, []int) { - return file_refs_grpc_types_proto_rawDescGZIP(), []int{4} -} - -func (x *SubnetID) GetValue() uint32 { - if x != nil { - return x.Value - } - return 0 -} - // API version used by a node. // // String presentation is a Semantic Versioning 2.0.0 compatible version string @@ -449,7 +396,7 @@ type Version struct { func (x *Version) Reset() { *x = Version{} if protoimpl.UnsafeEnabled { - mi := &file_refs_grpc_types_proto_msgTypes[5] + mi := &file_refs_grpc_types_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -462,7 +409,7 @@ func (x *Version) String() string { func (*Version) ProtoMessage() {} func (x *Version) ProtoReflect() protoreflect.Message { - mi := &file_refs_grpc_types_proto_msgTypes[5] + mi := &file_refs_grpc_types_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -475,7 +422,7 @@ func (x *Version) ProtoReflect() protoreflect.Message { // Deprecated: Use Version.ProtoReflect.Descriptor instead. func (*Version) Descriptor() ([]byte, []int) { - return file_refs_grpc_types_proto_rawDescGZIP(), []int{5} + return file_refs_grpc_types_proto_rawDescGZIP(), []int{4} } func (x *Version) GetMajor() uint32 { @@ -509,7 +456,7 @@ type Signature struct { func (x *Signature) Reset() { *x = Signature{} if protoimpl.UnsafeEnabled { - mi := &file_refs_grpc_types_proto_msgTypes[6] + mi := &file_refs_grpc_types_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -522,7 +469,7 @@ func (x *Signature) String() string { func (*Signature) ProtoMessage() {} func (x *Signature) ProtoReflect() protoreflect.Message { - mi := &file_refs_grpc_types_proto_msgTypes[6] + mi := &file_refs_grpc_types_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -535,7 +482,7 @@ func (x *Signature) ProtoReflect() protoreflect.Message { // Deprecated: Use Signature.ProtoReflect.Descriptor instead. func (*Signature) Descriptor() ([]byte, []int) { - return file_refs_grpc_types_proto_rawDescGZIP(), []int{6} + return file_refs_grpc_types_proto_rawDescGZIP(), []int{5} } func (x *Signature) GetKey() []byte { @@ -574,7 +521,7 @@ type SignatureRFC6979 struct { func (x *SignatureRFC6979) Reset() { *x = SignatureRFC6979{} if protoimpl.UnsafeEnabled { - mi := &file_refs_grpc_types_proto_msgTypes[7] + mi := &file_refs_grpc_types_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -587,7 +534,7 @@ func (x *SignatureRFC6979) String() string { func (*SignatureRFC6979) ProtoMessage() {} func (x *SignatureRFC6979) ProtoReflect() protoreflect.Message { - mi := &file_refs_grpc_types_proto_msgTypes[7] + mi := &file_refs_grpc_types_proto_msgTypes[6] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -600,7 +547,7 @@ func (x *SignatureRFC6979) ProtoReflect() protoreflect.Message { // Deprecated: Use SignatureRFC6979.ProtoReflect.Descriptor instead. func (*SignatureRFC6979) Descriptor() ([]byte, []int) { - return file_refs_grpc_types_proto_rawDescGZIP(), []int{7} + return file_refs_grpc_types_proto_rawDescGZIP(), []int{6} } func (x *SignatureRFC6979) GetKey() []byte { @@ -638,7 +585,7 @@ type Checksum struct { func (x *Checksum) Reset() { *x = Checksum{} if protoimpl.UnsafeEnabled { - mi := &file_refs_grpc_types_proto_msgTypes[8] + mi := &file_refs_grpc_types_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -651,7 +598,7 @@ func (x *Checksum) String() string { func (*Checksum) ProtoMessage() {} func (x *Checksum) ProtoReflect() protoreflect.Message { - mi := &file_refs_grpc_types_proto_msgTypes[8] + mi := &file_refs_grpc_types_proto_msgTypes[7] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -664,7 +611,7 @@ func (x *Checksum) ProtoReflect() protoreflect.Message { // Deprecated: Use Checksum.ProtoReflect.Descriptor instead. func (*Checksum) Descriptor() ([]byte, []int) { - return file_refs_grpc_types_proto_rawDescGZIP(), []int{8} + return file_refs_grpc_types_proto_rawDescGZIP(), []int{7} } func (x *Checksum) GetType() ChecksumType { @@ -701,45 +648,43 @@ var file_refs_grpc_types_proto_rawDesc = []byte{ 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x1f, 0x0a, 0x07, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x22, 0x20, 0x0a, 0x08, 0x53, 0x75, 0x62, 0x6e, 0x65, 0x74, 0x49, 0x44, 0x12, 0x14, - 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x07, 0x52, 0x05, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x22, 0x35, 0x0a, 0x07, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, - 0x14, 0x0a, 0x05, 0x6d, 0x61, 0x6a, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, - 0x6d, 0x61, 0x6a, 0x6f, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x6d, 0x69, 0x6e, 0x6f, 0x72, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x6d, 0x69, 0x6e, 0x6f, 0x72, 0x22, 0x6f, 0x0a, 0x09, 0x53, - 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x69, - 0x67, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, - 0x75, 0x72, 0x65, 0x12, 0x37, 0x0a, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x0e, 0x32, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, - 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x63, - 0x68, 0x65, 0x6d, 0x65, 0x52, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x22, 0x3d, 0x0a, 0x10, - 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x46, 0x43, 0x36, 0x39, 0x37, 0x39, - 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x03, 0x6b, - 0x65, 0x79, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x69, 0x67, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, - 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x22, 0x4e, 0x0a, 0x08, 0x43, - 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x12, 0x30, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, - 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x54, - 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x75, 0x6d, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x03, 0x73, 0x75, 0x6d, 0x2a, 0x66, 0x0a, 0x0f, 0x53, - 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x12, 0x10, - 0x0a, 0x0c, 0x45, 0x43, 0x44, 0x53, 0x41, 0x5f, 0x53, 0x48, 0x41, 0x35, 0x31, 0x32, 0x10, 0x00, - 0x12, 0x18, 0x0a, 0x14, 0x45, 0x43, 0x44, 0x53, 0x41, 0x5f, 0x52, 0x46, 0x43, 0x36, 0x39, 0x37, - 0x39, 0x5f, 0x53, 0x48, 0x41, 0x32, 0x35, 0x36, 0x10, 0x01, 0x12, 0x27, 0x0a, 0x23, 0x45, 0x43, - 0x44, 0x53, 0x41, 0x5f, 0x52, 0x46, 0x43, 0x36, 0x39, 0x37, 0x39, 0x5f, 0x53, 0x48, 0x41, 0x32, - 0x35, 0x36, 0x5f, 0x57, 0x41, 0x4c, 0x4c, 0x45, 0x54, 0x5f, 0x43, 0x4f, 0x4e, 0x4e, 0x45, 0x43, - 0x54, 0x10, 0x02, 0x2a, 0x41, 0x0a, 0x0c, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x54, - 0x79, 0x70, 0x65, 0x12, 0x1d, 0x0a, 0x19, 0x43, 0x48, 0x45, 0x43, 0x4b, 0x53, 0x55, 0x4d, 0x5f, - 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, - 0x10, 0x00, 0x12, 0x06, 0x0a, 0x02, 0x54, 0x5a, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x53, 0x48, - 0x41, 0x32, 0x35, 0x36, 0x10, 0x02, 0x42, 0x5b, 0x5a, 0x3e, 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, - 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x72, 0x65, 0x66, 0x73, 0x2f, 0x67, - 0x72, 0x70, 0x63, 0x3b, 0x72, 0x65, 0x66, 0x73, 0xaa, 0x02, 0x18, 0x4e, 0x65, 0x6f, 0x2e, 0x46, - 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x52, - 0x65, 0x66, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x75, 0x65, 0x22, 0x35, 0x0a, 0x07, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x14, 0x0a, + 0x05, 0x6d, 0x61, 0x6a, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x6d, 0x61, + 0x6a, 0x6f, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x6d, 0x69, 0x6e, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0d, 0x52, 0x05, 0x6d, 0x69, 0x6e, 0x6f, 0x72, 0x22, 0x6f, 0x0a, 0x09, 0x53, 0x69, 0x67, + 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0c, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x69, 0x67, 0x6e, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, + 0x65, 0x12, 0x37, 0x0a, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x0e, 0x32, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, + 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x63, 0x68, 0x65, + 0x6d, 0x65, 0x52, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x22, 0x3d, 0x0a, 0x10, 0x53, 0x69, + 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x46, 0x43, 0x36, 0x39, 0x37, 0x39, 0x12, 0x10, + 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x03, 0x6b, 0x65, 0x79, + 0x12, 0x17, 0x0a, 0x04, 0x73, 0x69, 0x67, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, + 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x22, 0x4e, 0x0a, 0x08, 0x43, 0x68, 0x65, + 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x12, 0x30, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0e, 0x32, 0x1c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, + 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x54, 0x79, 0x70, + 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x75, 0x6d, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0c, 0x52, 0x03, 0x73, 0x75, 0x6d, 0x2a, 0x66, 0x0a, 0x0f, 0x53, 0x69, 0x67, + 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x0c, + 0x45, 0x43, 0x44, 0x53, 0x41, 0x5f, 0x53, 0x48, 0x41, 0x35, 0x31, 0x32, 0x10, 0x00, 0x12, 0x18, + 0x0a, 0x14, 0x45, 0x43, 0x44, 0x53, 0x41, 0x5f, 0x52, 0x46, 0x43, 0x36, 0x39, 0x37, 0x39, 0x5f, + 0x53, 0x48, 0x41, 0x32, 0x35, 0x36, 0x10, 0x01, 0x12, 0x27, 0x0a, 0x23, 0x45, 0x43, 0x44, 0x53, + 0x41, 0x5f, 0x52, 0x46, 0x43, 0x36, 0x39, 0x37, 0x39, 0x5f, 0x53, 0x48, 0x41, 0x32, 0x35, 0x36, + 0x5f, 0x57, 0x41, 0x4c, 0x4c, 0x45, 0x54, 0x5f, 0x43, 0x4f, 0x4e, 0x4e, 0x45, 0x43, 0x54, 0x10, + 0x02, 0x2a, 0x41, 0x0a, 0x0c, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x54, 0x79, 0x70, + 0x65, 0x12, 0x1d, 0x0a, 0x19, 0x43, 0x48, 0x45, 0x43, 0x4b, 0x53, 0x55, 0x4d, 0x5f, 0x54, 0x59, + 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, + 0x12, 0x06, 0x0a, 0x02, 0x54, 0x5a, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x53, 0x48, 0x41, 0x32, + 0x35, 0x36, 0x10, 0x02, 0x42, 0x5b, 0x5a, 0x3e, 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, 0x61, 0x70, + 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x72, 0x65, 0x66, 0x73, 0x2f, 0x67, 0x72, 0x70, + 0x63, 0x3b, 0x72, 0x65, 0x66, 0x73, 0xaa, 0x02, 0x18, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, + 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x52, 0x65, 0x66, + 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -755,7 +700,7 @@ func file_refs_grpc_types_proto_rawDescGZIP() []byte { } var file_refs_grpc_types_proto_enumTypes = make([]protoimpl.EnumInfo, 2) -var file_refs_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 9) +var file_refs_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 8) var file_refs_grpc_types_proto_goTypes = []interface{}{ (SignatureScheme)(0), // 0: neo.fs.v2.refs.SignatureScheme (ChecksumType)(0), // 1: neo.fs.v2.refs.ChecksumType @@ -763,11 +708,10 @@ var file_refs_grpc_types_proto_goTypes = []interface{}{ (*ObjectID)(nil), // 3: neo.fs.v2.refs.ObjectID (*ContainerID)(nil), // 4: neo.fs.v2.refs.ContainerID (*OwnerID)(nil), // 5: neo.fs.v2.refs.OwnerID - (*SubnetID)(nil), // 6: neo.fs.v2.refs.SubnetID - (*Version)(nil), // 7: neo.fs.v2.refs.Version - (*Signature)(nil), // 8: neo.fs.v2.refs.Signature - (*SignatureRFC6979)(nil), // 9: neo.fs.v2.refs.SignatureRFC6979 - (*Checksum)(nil), // 10: neo.fs.v2.refs.Checksum + (*Version)(nil), // 6: neo.fs.v2.refs.Version + (*Signature)(nil), // 7: neo.fs.v2.refs.Signature + (*SignatureRFC6979)(nil), // 8: neo.fs.v2.refs.SignatureRFC6979 + (*Checksum)(nil), // 9: neo.fs.v2.refs.Checksum } var file_refs_grpc_types_proto_depIdxs = []int32{ 4, // 0: neo.fs.v2.refs.Address.container_id:type_name -> neo.fs.v2.refs.ContainerID @@ -836,18 +780,6 @@ func file_refs_grpc_types_proto_init() { } } file_refs_grpc_types_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SubnetID); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_refs_grpc_types_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Version); i { case 0: return &v.state @@ -859,7 +791,7 @@ func file_refs_grpc_types_proto_init() { return nil } } - file_refs_grpc_types_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + file_refs_grpc_types_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Signature); i { case 0: return &v.state @@ -871,7 +803,7 @@ func file_refs_grpc_types_proto_init() { return nil } } - file_refs_grpc_types_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + file_refs_grpc_types_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*SignatureRFC6979); i { case 0: return &v.state @@ -883,7 +815,7 @@ func file_refs_grpc_types_proto_init() { return nil } } - file_refs_grpc_types_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + file_refs_grpc_types_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Checksum); i { case 0: return &v.state @@ -902,7 +834,7 @@ func file_refs_grpc_types_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_refs_grpc_types_proto_rawDesc, NumEnums: 2, - NumMessages: 9, + NumMessages: 8, NumExtensions: 0, NumServices: 0, }, diff --git a/refs/marshal.go b/refs/marshal.go index 14b0f8c..0382190 100644 --- a/refs/marshal.go +++ b/refs/marshal.go @@ -261,43 +261,3 @@ func (v *Version) StableSize() (size int) { func (v *Version) Unmarshal(data []byte) error { return message.Unmarshal(v, data, new(refs.Version)) } - -// SubnetID message field numbers -const ( - _ = iota - subnetIDValFNum -) - -// StableMarshal marshals SubnetID to NeoFS API V2 binary format (Protocol Buffers with direct field order). -// -// Returns a slice of recorded data. Data is written to the provided buffer if there is enough space. -func (s *SubnetID) StableMarshal(buf []byte) []byte { - if s == nil { - return []byte{} - } - - if buf == nil { - buf = make([]byte, s.StableSize()) - } - - proto.Fixed32Marshal(subnetIDValFNum, buf, s.value) - - return buf -} - -// StableSize returns the number of bytes required to write SubnetID in NeoFS API V2 binary format (see StableMarshal). -func (s *SubnetID) StableSize() (size int) { - if s != nil { - size += proto.Fixed32Size(subnetIDValFNum, s.value) - } - - return -} - -// Unmarshal unmarshals SubnetID from NeoFS API V2 binary format (see StableMarshal). -// Must not be called on nil. -// -// Note: empty data corresponds to zero ID value or nil pointer to it. -func (s *SubnetID) Unmarshal(data []byte) error { - return message.Unmarshal(s, data, new(refs.SubnetID)) -} diff --git a/refs/message_test.go b/refs/message_test.go index ba36434..69f2242 100644 --- a/refs/message_test.go +++ b/refs/message_test.go @@ -17,6 +17,5 @@ func TestMessageConvert(t *testing.T) { func(empty bool) message.Message { return refstest.GenerateChecksum(empty) }, func(empty bool) message.Message { return refstest.GenerateSignature(empty) }, func(empty bool) message.Message { return refstest.GenerateVersion(empty) }, - func(empty bool) message.Message { return refstest.GenerateSubnetID(empty) }, ) } diff --git a/refs/test/generate.go b/refs/test/generate.go index cce64a8..6217a96 100644 --- a/refs/test/generate.go +++ b/refs/test/generate.go @@ -106,13 +106,3 @@ func GenerateChecksum(empty bool) *refs.Checksum { return m } - -func GenerateSubnetID(empty bool) *refs.SubnetID { - m := new(refs.SubnetID) - - if !empty { - m.SetValue(666) - } - - return m -} diff --git a/refs/types.go b/refs/types.go index 2d4fec7..d8f0d9b 100644 --- a/refs/types.go +++ b/refs/types.go @@ -1,10 +1,5 @@ package refs -import ( - "fmt" - "strconv" -) - type OwnerID struct { val []byte } @@ -45,10 +40,6 @@ type Signature struct { scheme SignatureScheme } -type SubnetID struct { - value uint32 -} - type Version struct { major, minor uint32 } @@ -178,56 +169,6 @@ func (s *Signature) SetScheme(scheme SignatureScheme) { s.scheme = scheme } -func (s *SubnetID) SetValue(id uint32) { - s.value = id -} - -func (s *SubnetID) GetValue() uint32 { - if s != nil { - return s.value - } - return 0 -} - -// MarshalText encodes SubnetID into text format according to NeoFS API V2 protocol: -// value in base-10 integer string format. -// -// Implements encoding.TextMarshaler. -func (s *SubnetID) MarshalText() ([]byte, error) { - num := s.GetValue() // NPE safe, returns zero on nil (zero subnet) - - return []byte(strconv.FormatUint(uint64(num), 10)), nil -} - -// UnmarshalText decodes SubnetID from the text according to NeoFS API V2 protocol: -// should be base-10 integer string format with bitsize = 32. -// -// Returns strconv.ErrRange if integer overflows uint32. -// -// Must not be called on nil. -// -// Implements encoding.TextUnmarshaler. -func (s *SubnetID) UnmarshalText(txt []byte) error { - num, err := strconv.ParseUint(string(txt), 10, 32) - if err != nil { - return fmt.Errorf("invalid numeric value: %w", err) - } - - s.value = uint32(num) - - return nil -} - -// IsZeroSubnet returns true iff the SubnetID refers to zero subnet. -func IsZeroSubnet(id *SubnetID) bool { - return id.GetValue() == 0 -} - -// MakeZeroSubnet makes the SubnetID to refer to zero subnet. -func MakeZeroSubnet(id *SubnetID) { - id.SetValue(0) -} - func (v *Version) GetMajor() uint32 { if v != nil { return v.major diff --git a/refs/types_test.go b/refs/types_test.go deleted file mode 100644 index 68d8fd7..0000000 --- a/refs/types_test.go +++ /dev/null @@ -1,72 +0,0 @@ -package refs_test - -import ( - "math" - "strconv" - "testing" - - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" - "github.com/stretchr/testify/require" -) - -func TestZeroSubnet(t *testing.T) { - id := new(refs.SubnetID) - - require.True(t, refs.IsZeroSubnet(id)) - - id.SetValue(1) - require.False(t, refs.IsZeroSubnet(id)) - - refs.MakeZeroSubnet(id) - require.True(t, refs.IsZeroSubnet(id)) -} - -func TestSubnetID_MarshalText(t *testing.T) { - var id refs.SubnetID - - const val = 15 - - id.SetValue(val) - - txt, err := id.MarshalText() - require.NoError(t, err) - - res, err := strconv.ParseUint(string(txt), 10, 32) - require.NoError(t, err) - - require.EqualValues(t, val, res) - - t.Run("nil", func(t *testing.T) { - var id *refs.SubnetID - - txt, err := id.MarshalText() - require.NoError(t, err) - - res, err := strconv.ParseUint(string(txt), 10, 32) - require.NoError(t, err) - - require.Zero(t, res) - }) -} - -func TestSubnetID_UnmarshalText(t *testing.T) { - const val = 15 - - str := strconv.FormatUint(val, 10) - - var id refs.SubnetID - - err := id.UnmarshalText([]byte(str)) - require.NoError(t, err) - - require.EqualValues(t, val, id.GetValue()) - - t.Run("uint32 overflow", func(t *testing.T) { - txt := strconv.FormatUint(math.MaxUint32+1, 10) - - var id refs.SubnetID - - err := id.UnmarshalText([]byte(txt)) - require.ErrorIs(t, err, strconv.ErrRange) - }) -} diff --git a/subnet/encoding_test.go b/subnet/encoding_test.go deleted file mode 100644 index 0a1fea1..0000000 --- a/subnet/encoding_test.go +++ /dev/null @@ -1,15 +0,0 @@ -package subnet_test - -import ( - "testing" - - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message" - messagetest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message/test" - subnettest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/subnet/test" -) - -func TestMessageConvert(t *testing.T) { - messagetest.TestRPCMessage(t, - func(empty bool) message.Message { return subnettest.GenerateSubnetInfo(empty) }, - ) -} diff --git a/subnet/grpc/types.go b/subnet/grpc/types.go deleted file mode 100644 index 3196c5a..0000000 --- a/subnet/grpc/types.go +++ /dev/null @@ -1,15 +0,0 @@ -package subnet - -import ( - refs "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc" -) - -// SetID returns identifier of the subnet. Nil arg is equivalent to zero subnet ID. -func (x *SubnetInfo) SetID(id *refs.SubnetID) { - x.Id = id -} - -// SetOwner sets subnet owner's ID in NeoFS system. -func (x *SubnetInfo) SetOwner(id *refs.OwnerID) { - x.Owner = id -} diff --git a/subnet/grpc/types.pb.go b/subnet/grpc/types.pb.go deleted file mode 100644 index 032ba6c..0000000 --- a/subnet/grpc/types.pb.go +++ /dev/null @@ -1,171 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.9 -// source: subnet/grpc/types.proto - -package subnet - -import ( - grpc "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -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) -) - -// NeoFS subnetwork description -type SubnetInfo struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Unique subnet identifier. Missing ID is - // equivalent to zero (default subnetwork) ID. - Id *grpc.SubnetID `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - // Identifier of the subnetwork owner - Owner *grpc.OwnerID `protobuf:"bytes,2,opt,name=owner,proto3" json:"owner,omitempty"` -} - -func (x *SubnetInfo) Reset() { - *x = SubnetInfo{} - if protoimpl.UnsafeEnabled { - mi := &file_subnet_grpc_types_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SubnetInfo) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SubnetInfo) ProtoMessage() {} - -func (x *SubnetInfo) ProtoReflect() protoreflect.Message { - mi := &file_subnet_grpc_types_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SubnetInfo.ProtoReflect.Descriptor instead. -func (*SubnetInfo) Descriptor() ([]byte, []int) { - return file_subnet_grpc_types_proto_rawDescGZIP(), []int{0} -} - -func (x *SubnetInfo) GetId() *grpc.SubnetID { - if x != nil { - return x.Id - } - return nil -} - -func (x *SubnetInfo) GetOwner() *grpc.OwnerID { - if x != nil { - return x.Owner - } - return nil -} - -var File_subnet_grpc_types_proto protoreflect.FileDescriptor - -var file_subnet_grpc_types_proto_rawDesc = []byte{ - 0x0a, 0x17, 0x73, 0x75, 0x62, 0x6e, 0x65, 0x74, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, - 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x10, 0x6e, 0x65, 0x6f, 0x2e, 0x66, - 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x75, 0x62, 0x6e, 0x65, 0x74, 0x1a, 0x15, 0x72, 0x65, 0x66, - 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x22, 0x65, 0x0a, 0x0a, 0x53, 0x75, 0x62, 0x6e, 0x65, 0x74, 0x49, 0x6e, 0x66, 0x6f, - 0x12, 0x28, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, - 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x75, - 0x62, 0x6e, 0x65, 0x74, 0x49, 0x44, 0x52, 0x02, 0x69, 0x64, 0x12, 0x2d, 0x0a, 0x05, 0x6f, 0x77, - 0x6e, 0x65, 0x72, 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, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x42, 0x61, 0x5a, 0x42, 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, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x73, 0x75, 0x62, - 0x6e, 0x65, 0x74, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x73, 0x75, 0x62, 0x6e, 0x65, 0x74, 0xaa, - 0x02, 0x1a, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, - 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x53, 0x75, 0x62, 0x6e, 0x65, 0x74, 0x62, 0x06, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_subnet_grpc_types_proto_rawDescOnce sync.Once - file_subnet_grpc_types_proto_rawDescData = file_subnet_grpc_types_proto_rawDesc -) - -func file_subnet_grpc_types_proto_rawDescGZIP() []byte { - file_subnet_grpc_types_proto_rawDescOnce.Do(func() { - file_subnet_grpc_types_proto_rawDescData = protoimpl.X.CompressGZIP(file_subnet_grpc_types_proto_rawDescData) - }) - return file_subnet_grpc_types_proto_rawDescData -} - -var file_subnet_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_subnet_grpc_types_proto_goTypes = []interface{}{ - (*SubnetInfo)(nil), // 0: neo.fs.v2.subnet.SubnetInfo - (*grpc.SubnetID)(nil), // 1: neo.fs.v2.refs.SubnetID - (*grpc.OwnerID)(nil), // 2: neo.fs.v2.refs.OwnerID -} -var file_subnet_grpc_types_proto_depIdxs = []int32{ - 1, // 0: neo.fs.v2.subnet.SubnetInfo.id:type_name -> neo.fs.v2.refs.SubnetID - 2, // 1: neo.fs.v2.subnet.SubnetInfo.owner:type_name -> neo.fs.v2.refs.OwnerID - 2, // [2:2] is the sub-list for method output_type - 2, // [2:2] is the sub-list for method input_type - 2, // [2:2] is the sub-list for extension type_name - 2, // [2:2] is the sub-list for extension extendee - 0, // [0:2] is the sub-list for field type_name -} - -func init() { file_subnet_grpc_types_proto_init() } -func file_subnet_grpc_types_proto_init() { - if File_subnet_grpc_types_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_subnet_grpc_types_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SubnetInfo); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_subnet_grpc_types_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_subnet_grpc_types_proto_goTypes, - DependencyIndexes: file_subnet_grpc_types_proto_depIdxs, - MessageInfos: file_subnet_grpc_types_proto_msgTypes, - }.Build() - File_subnet_grpc_types_proto = out.File - file_subnet_grpc_types_proto_rawDesc = nil - file_subnet_grpc_types_proto_goTypes = nil - file_subnet_grpc_types_proto_depIdxs = nil -} diff --git a/subnet/info.go b/subnet/info.go deleted file mode 100644 index 2e1e94c..0000000 --- a/subnet/info.go +++ /dev/null @@ -1,138 +0,0 @@ -package subnet - -import ( - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" - refsgrpc "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/grpc" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message" - subnet "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/subnet/grpc" - protoutil "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/proto" -) - -// Info represents information about NeoFS subnet. Structure is compatible with NeoFS API V2 protocol. -// -// Zero value represents zero subnet w/o an owner. -type Info struct { - id *refs.SubnetID - - owner *refs.OwnerID -} - -// ID returns identifier of the subnet. Nil return is equivalent to zero subnet ID. -func (x *Info) ID() *refs.SubnetID { - return x.id -} - -// SetID returns identifier of the subnet. Nil arg is equivalent to zero subnet ID. -func (x *Info) SetID(id *refs.SubnetID) { - x.id = id -} - -// Owner returns subnet owner's ID in NeoFS system. -func (x *Info) Owner() *refs.OwnerID { - return x.owner -} - -// SetOwner sets subnet owner's ID in NeoFS system. -func (x *Info) SetOwner(id *refs.OwnerID) { - x.owner = id -} - -// ToGRPCMessage forms subnet.SubnetInfo message and returns it as grpc.Message. -func (x *Info) ToGRPCMessage() grpc.Message { - var m *subnet.SubnetInfo - - if x != nil { - m = new(subnet.SubnetInfo) - - m.SetID(x.id.ToGRPCMessage().(*refsgrpc.SubnetID)) - m.SetOwner(x.owner.ToGRPCMessage().(*refsgrpc.OwnerID)) - } - - return m -} - -// FromGRPCMessage restores Info from grpc.Message. -// -// Supported types: -// - subnet.SubnetInfo. -func (x *Info) FromGRPCMessage(m grpc.Message) error { - v, ok := m.(*subnet.SubnetInfo) - if !ok { - return message.NewUnexpectedMessageType(m, v) - } - - var err error - - id := v.GetId() - if id == nil { - x.id = nil - } else { - if x.id == nil { - x.id = new(refs.SubnetID) - } - - err = x.id.FromGRPCMessage(id) - if err != nil { - return err - } - } - - ownerID := v.GetOwner() - if ownerID == nil { - x.owner = nil - } else { - if x.owner == nil { - x.owner = new(refs.OwnerID) - } - - err = x.owner.FromGRPCMessage(ownerID) - if err != nil { - return err - } - } - - return nil -} - -// SubnetInfo message field numbers -const ( - _ = iota - subnetInfoIDFNum - subnetInfoOwnerFNum -) - -// StableMarshal marshals Info to NeoFS API V2 binary format (Protocol Buffers with direct field order). -// -// Returns a slice of recorded data. Data is written to the provided buffer if there is enough space. -func (x *Info) StableMarshal(buf []byte) []byte { - if x == nil { - return []byte{} - } - - if buf == nil { - buf = make([]byte, x.StableSize()) - } - - var offset int - - offset += protoutil.NestedStructureMarshal(subnetInfoIDFNum, buf[offset:], x.id) - protoutil.NestedStructureMarshal(subnetInfoOwnerFNum, buf[offset:], x.owner) - - return buf -} - -// StableSize returns the number of bytes required to write Info in NeoFS API V2 binary format (see StableMarshal). -func (x *Info) StableSize() (size int) { - if x != nil { - size += protoutil.NestedStructureSize(subnetInfoIDFNum, x.id) - size += protoutil.NestedStructureSize(subnetInfoOwnerFNum, x.owner) - } - - return -} - -// Unmarshal decodes Info from NeoFS API V2 binary format (see StableMarshal). -func (x *Info) Unmarshal(data []byte) error { - return message.Unmarshal(x, data, new(subnet.SubnetInfo)) -} diff --git a/subnet/test/generate.go b/subnet/test/generate.go deleted file mode 100644 index 214ac7b..0000000 --- a/subnet/test/generate.go +++ /dev/null @@ -1,17 +0,0 @@ -package subnettest - -import ( - refstest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/test" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/subnet" -) - -func GenerateSubnetInfo(empty bool) *subnet.Info { - m := new(subnet.Info) - - if !empty { - m.SetID(refstest.GenerateSubnetID(false)) - m.SetOwner(refstest.GenerateOwnerID(false)) - } - - return m -} From e297616a483a19e7062338186f16bb00d023e709 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Wed, 3 May 2023 13:41:27 +0300 Subject: [PATCH 1061/1196] [#27] *: Resolve unused linter warnings Signed-off-by: Evgenii Stratonikov --- container/marshal.go | 6 +++--- container/test/generate.go | 6 +++--- netmap/marshal.go | 4 ++-- netmap/test/generate.go | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/container/marshal.go b/container/marshal.go index 98b32b4..a7c57aa 100644 --- a/container/marshal.go +++ b/container/marshal.go @@ -223,7 +223,7 @@ func (r *DeleteRequestBody) Unmarshal(data []byte) error { return message.Unmarshal(r, data, new(container.DeleteRequest_Body)) } -func (r *DeleteResponseBody) StableMarshal(buf []byte) []byte { +func (r *DeleteResponseBody) StableMarshal(_ []byte) []byte { return nil } @@ -391,7 +391,7 @@ func (r *SetExtendedACLRequestBody) Unmarshal(data []byte) error { return message.Unmarshal(r, data, new(container.SetExtendedACLRequest_Body)) } -func (r *SetExtendedACLResponseBody) StableMarshal(buf []byte) []byte { +func (r *SetExtendedACLResponseBody) StableMarshal(_ []byte) []byte { return nil } @@ -533,7 +533,7 @@ func (r *AnnounceUsedSpaceRequestBody) Unmarshal(data []byte) error { return message.Unmarshal(r, data, new(container.AnnounceUsedSpaceRequest_Body)) } -func (r *AnnounceUsedSpaceResponseBody) StableMarshal(buf []byte) []byte { +func (r *AnnounceUsedSpaceResponseBody) StableMarshal(_ []byte) []byte { return nil } diff --git a/container/test/generate.go b/container/test/generate.go index 00a0955..2b2afdf 100644 --- a/container/test/generate.go +++ b/container/test/generate.go @@ -170,7 +170,7 @@ func GenerateDeleteRequest(empty bool) *container.DeleteRequest { return m } -func GenerateDeleteResponseBody(empty bool) *container.DeleteResponseBody { +func GenerateDeleteResponseBody(_ bool) *container.DeleteResponseBody { m := new(container.DeleteResponseBody) return m @@ -260,7 +260,7 @@ func GenerateSetExtendedACLRequest(empty bool) *container.SetExtendedACLRequest return m } -func GenerateSetExtendedACLResponseBody(empty bool) *container.SetExtendedACLResponseBody { +func GenerateSetExtendedACLResponseBody(_ bool) *container.SetExtendedACLResponseBody { m := new(container.SetExtendedACLResponseBody) return m @@ -376,7 +376,7 @@ func GenerateAnnounceUsedSpaceRequest(empty bool) *container.AnnounceUsedSpaceRe return m } -func GenerateAnnounceUsedSpaceResponseBody(empty bool) *container.AnnounceUsedSpaceResponseBody { +func GenerateAnnounceUsedSpaceResponseBody(_ bool) *container.AnnounceUsedSpaceResponseBody { m := new(container.AnnounceUsedSpaceResponseBody) return m diff --git a/netmap/marshal.go b/netmap/marshal.go index 5c8cf35..f707665 100644 --- a/netmap/marshal.go +++ b/netmap/marshal.go @@ -275,7 +275,7 @@ func (ni *NodeInfo) Unmarshal(data []byte) error { return message.Unmarshal(ni, data, new(netmap.NodeInfo)) } -func (l *LocalNodeInfoRequestBody) StableMarshal(buf []byte) []byte { +func (l *LocalNodeInfoRequestBody) StableMarshal(_ []byte) []byte { return nil } @@ -432,7 +432,7 @@ func (i *NetworkInfo) Unmarshal(data []byte) error { return message.Unmarshal(i, data, new(netmap.NetworkInfo)) } -func (l *NetworkInfoRequestBody) StableMarshal(buf []byte) []byte { +func (l *NetworkInfoRequestBody) StableMarshal(_ []byte) []byte { return nil } diff --git a/netmap/test/generate.go b/netmap/test/generate.go index 8889bab..400d24c 100644 --- a/netmap/test/generate.go +++ b/netmap/test/generate.go @@ -144,7 +144,7 @@ func GenerateNodeInfo(empty bool) *netmap.NodeInfo { return m } -func GenerateLocalNodeInfoRequestBody(empty bool) *netmap.LocalNodeInfoRequestBody { +func GenerateLocalNodeInfoRequestBody(_ bool) *netmap.LocalNodeInfoRequestBody { m := new(netmap.LocalNodeInfoRequestBody) return m @@ -225,7 +225,7 @@ func GenerateNetworkInfo(empty bool) *netmap.NetworkInfo { return m } -func GenerateNetworkInfoRequestBody(empty bool) *netmap.NetworkInfoRequestBody { +func GenerateNetworkInfoRequestBody(_ bool) *netmap.NetworkInfoRequestBody { m := new(netmap.NetworkInfoRequestBody) return m From d2b7fd3682657358dd4933329c8787a2c3f9211b Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Wed, 3 May 2023 13:44:04 +0300 Subject: [PATCH 1062/1196] [#27] .golanci.yml: Unify with other repos Leave specific excepcions in place. Signed-off-by: Evgenii Stratonikov --- .golangci.yml | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 5abd044..db94146 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -4,7 +4,7 @@ # options for analysis running run: # timeout for analysis, e.g. 30s, 5m, default is 1m - timeout: 2m + timeout: 10m # include test files or not, default is true tests: false @@ -27,6 +27,11 @@ linters-settings: govet: # report about shadowed variables check-shadowing: false + funlen: + lines: 80 # default 60 + statements: 60 # default 40 + gocognit: + min-complexity: 40 # default 30 linters: enable: @@ -37,15 +42,27 @@ linters: # some default golangci-lint linters - errcheck - gosimple + - godot - ineffassign - staticcheck - typecheck + - unused # extra linters + - bidichk + - durationcheck - exhaustive + - exportloopref - gofmt - - whitespace - goimports + - misspell + - predeclared + - reassign + - whitespace + - containedctx + - funlen + - gocognit + - contextcheck disable-all: true fast: false From 63915bb7a579af58777073a1cea037469d2f37cc Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Wed, 3 May 2023 13:46:07 +0300 Subject: [PATCH 1063/1196] [#27] *: Resolve godot linter warnings Signed-off-by: Evgenii Stratonikov --- container/attributes.go | 8 ++++---- object/attributes.go | 10 +++++----- session/xheaders.go | 6 +++--- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/container/attributes.go b/container/attributes.go index 12277ed..288d048 100644 --- a/container/attributes.go +++ b/container/attributes.go @@ -15,20 +15,20 @@ const ( ) // SysAttributePrefixNeoFS is a prefix of key to system attribute. -// Deprecated: use SysAttributePrefix +// Deprecated: use SysAttributePrefix. const SysAttributePrefixNeoFS = "__NEOFS__" const ( // SysAttributeNameNeoFS is a string of human-friendly container name registered as the domain in NNS contract. - // Deprecated: use SysAttributeName + // Deprecated: use SysAttributeName. SysAttributeNameNeoFS = SysAttributePrefixNeoFS + "NAME" // SysAttributeZoneNeoFS is a string of zone for container name. - // Deprecated: use SysAttributeZone + // Deprecated: use SysAttributeZone. SysAttributeZoneNeoFS = SysAttributePrefixNeoFS + "ZONE" // SysAttributeHomomorphicHashingNeoFS is a container's homomorphic hashing state. - // Deprecated: use SysAttributeHomomorphicHashing + // Deprecated: use SysAttributeHomomorphicHashing. SysAttributeHomomorphicHashingNeoFS = SysAttributePrefixNeoFS + "DISABLE_HOMOMORPHIC_HASHING" ) diff --git a/object/attributes.go b/object/attributes.go index 9aa592f..7f4fca0 100644 --- a/object/attributes.go +++ b/object/attributes.go @@ -26,26 +26,26 @@ const ( ) // SysAttributePrefixNeoFS is a prefix of key to system attribute. -// Deprecated: use SysAttributePrefix +// Deprecated: use SysAttributePrefix. const SysAttributePrefixNeoFS = "__NEOFS__" const ( // SysAttributeUploadIDNeoFS marks smaller parts of a split bigger object. - // Deprecated: use SysAttributeUploadID + // Deprecated: use SysAttributeUploadID. SysAttributeUploadIDNeoFS = SysAttributePrefixNeoFS + "UPLOAD_ID" // SysAttributeExpEpochNeoFS tells GC to delete object after that epoch. - // Deprecated: use SysAttributeExpEpoch + // Deprecated: use SysAttributeExpEpoch. SysAttributeExpEpochNeoFS = SysAttributePrefixNeoFS + "EXPIRATION_EPOCH" // SysAttributeTickEpochNeoFS defines what epoch must produce object // notification. - // Deprecated: use SysAttributeTickEpoch + // Deprecated: use SysAttributeTickEpoch. SysAttributeTickEpochNeoFS = SysAttributePrefixNeoFS + "TICK_EPOCH" // SysAttributeTickTopicNeoFS defines what topic object notification // must be sent to. - // Deprecated: use SysAttributeTickTopic + // Deprecated: use SysAttributeTickTopic. SysAttributeTickTopicNeoFS = SysAttributePrefixNeoFS + "TICK_TOPIC" ) diff --git a/session/xheaders.go b/session/xheaders.go index 0e02093..c575d5f 100644 --- a/session/xheaders.go +++ b/session/xheaders.go @@ -16,19 +16,19 @@ const ( ) // ReservedXHeaderPrefixNeoFS is a prefix of keys to "well-known" X-headers. -// Deprecated: use ReservedXHeaderPrefix +// Deprecated: use ReservedXHeaderPrefix. const ReservedXHeaderPrefixNeoFS = "__NEOFS__" const ( // XHeaderNetmapEpochNeoFS is a key to the reserved X-header that specifies netmap epoch // to use for object placement calculation. If set to '0' or not set, the current // epoch only will be used. - // Deprecated: use XHeaderNetmapEpoch + // Deprecated: use XHeaderNetmapEpoch. XHeaderNetmapEpochNeoFS = ReservedXHeaderPrefixNeoFS + "NETMAP_EPOCH" // XHeaderNetmapLookupDepthNeoFS is a key to the reserved X-header that limits // how many past epochs back the node will can lookup. If set to '0' or not // set, the current epoch only will be used. - // Deprecated: use XHeaderNetmapLookupDepth + // Deprecated: use XHeaderNetmapLookupDepth. XHeaderNetmapLookupDepthNeoFS = ReservedXHeaderPrefixNeoFS + "NETMAP_LOOKUP_DEPTH" ) From 1cab39337e40117378141f582aefaa7634338609 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Wed, 3 May 2023 13:58:42 +0300 Subject: [PATCH 1064/1196] [#27] object: Resolve funlen linter warnings Signed-off-by: Evgenii Stratonikov --- object/convert.go | 195 +++++++++++++++++++++++++--------------------- 1 file changed, 105 insertions(+), 90 deletions(-) diff --git a/object/convert.go b/object/convert.go index 95fde3c..7099b4c 100644 --- a/object/convert.go +++ b/object/convert.go @@ -292,102 +292,26 @@ func (h *Header) FromGRPCMessage(m grpc.Message) error { var err error - version := v.GetVersion() - if version == nil { - h.version = nil - } else { - if h.version == nil { - h.version = new(refs.Version) - } - - err = h.version.FromGRPCMessage(version) - if err != nil { - return err - } + if err := h.fillVersion(v); err != nil { + return err } - - payloadHash := v.GetPayloadHash() - if payloadHash == nil { - h.payloadHash = nil - } else { - if h.payloadHash == nil { - h.payloadHash = new(refs.Checksum) - } - - err = h.payloadHash.FromGRPCMessage(payloadHash) - if err != nil { - return err - } + if err := h.fillPayloadHash(v); err != nil { + return err } - - ownerID := v.GetOwnerId() - if ownerID == nil { - h.ownerID = nil - } else { - if h.ownerID == nil { - h.ownerID = new(refs.OwnerID) - } - - err = h.ownerID.FromGRPCMessage(ownerID) - if err != nil { - return err - } + if err := h.fillOwnerID(v); err != nil { + return err } - - homoHash := v.GetHomomorphicHash() - if homoHash == nil { - h.homoHash = nil - } else { - if h.homoHash == nil { - h.homoHash = new(refs.Checksum) - } - - err = h.homoHash.FromGRPCMessage(homoHash) - if err != nil { - return err - } + if err := h.fillHomomorphicHash(v); err != nil { + return err } - - cid := v.GetContainerId() - if cid == nil { - h.cid = nil - } else { - if h.cid == nil { - h.cid = new(refs.ContainerID) - } - - err = h.cid.FromGRPCMessage(cid) - if err != nil { - return err - } + if err := h.fillContainerID(v); err != nil { + return err } - - sessionToken := v.GetSessionToken() - if sessionToken == nil { - h.sessionToken = nil - } else { - if h.sessionToken == nil { - h.sessionToken = new(session.Token) - } - - err = h.sessionToken.FromGRPCMessage(sessionToken) - if err != nil { - return err - } + if err := h.fillSessionToken(v); err != nil { + return err } - - split := v.GetSplit() - if split == nil { - h.split = nil - } else { - if h.split == nil { - h.split = new(SplitHeader) - } - - err = h.split.FromGRPCMessage(split) - if err != nil { - return err - } + if err := h.fillSplitHeader(v); err != nil { + return err } h.attr, err = AttributesFromGRPC(v.GetAttributes()) @@ -402,6 +326,97 @@ func (h *Header) FromGRPCMessage(m grpc.Message) error { return nil } +func (h *Header) fillVersion(v *object.Header) error { + version := v.GetVersion() + if version == nil { + h.version = nil + return nil + } + + if h.version == nil { + h.version = new(refs.Version) + } + return h.version.FromGRPCMessage(version) +} + +func (h *Header) fillPayloadHash(v *object.Header) error { + payloadHash := v.GetPayloadHash() + if payloadHash == nil { + h.payloadHash = nil + return nil + } + + if h.payloadHash == nil { + h.payloadHash = new(refs.Checksum) + } + return h.payloadHash.FromGRPCMessage(payloadHash) +} + +func (h *Header) fillOwnerID(v *object.Header) error { + ownerID := v.GetOwnerId() + if ownerID == nil { + h.ownerID = nil + return nil + } + + if h.ownerID == nil { + h.ownerID = new(refs.OwnerID) + } + return h.ownerID.FromGRPCMessage(ownerID) +} + +func (h *Header) fillHomomorphicHash(v *object.Header) error { + homoHash := v.GetHomomorphicHash() + if homoHash == nil { + h.homoHash = nil + return nil + } + + if h.homoHash == nil { + h.homoHash = new(refs.Checksum) + } + return h.homoHash.FromGRPCMessage(homoHash) +} + +func (h *Header) fillContainerID(v *object.Header) error { + cid := v.GetContainerId() + if cid == nil { + h.cid = nil + return nil + } + + if h.cid == nil { + h.cid = new(refs.ContainerID) + } + return h.cid.FromGRPCMessage(cid) +} + +func (h *Header) fillSessionToken(v *object.Header) error { + sessionToken := v.GetSessionToken() + if sessionToken == nil { + h.sessionToken = nil + return nil + } + + if h.sessionToken == nil { + h.sessionToken = new(session.Token) + } + return h.sessionToken.FromGRPCMessage(sessionToken) +} + +func (h *Header) fillSplitHeader(v *object.Header) error { + split := v.GetSplit() + if split == nil { + h.split = nil + return nil + } + + if h.split == nil { + h.split = new(SplitHeader) + } + return h.split.FromGRPCMessage(split) +} + func (h *HeaderWithSignature) ToGRPCMessage() grpc.Message { var m *object.HeaderWithSignature From a6e2ab384582fb1182a9dd50d40efebb244023cd Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Wed, 3 May 2023 14:04:03 +0300 Subject: [PATCH 1065/1196] [#27] *: Add linter exceptions Each of these is not easy to do, so add an exeption for now. Signed-off-by: Evgenii Stratonikov --- pkg/tracing/grpc_internal.go | 2 +- rpc/client/call_options.go | 2 +- signature/body.go | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/tracing/grpc_internal.go b/pkg/tracing/grpc_internal.go index 25cf026..847c7ca 100644 --- a/pkg/tracing/grpc_internal.go +++ b/pkg/tracing/grpc_internal.go @@ -124,7 +124,7 @@ func (cs *clientStream) RecvMsg(m interface{}) error { type serverStream struct { originalStream grpc.ServerStream - ctx context.Context + ctx context.Context // nolint:containedctx } func newgRPCServerStream(ctx context.Context, originalStream grpc.ServerStream) grpc.ServerStream { diff --git a/rpc/client/call_options.go b/rpc/client/call_options.go index bf99c92..8134e46 100644 --- a/rpc/client/call_options.go +++ b/rpc/client/call_options.go @@ -8,7 +8,7 @@ import ( type CallOption func(*callParameters) type callParameters struct { - ctx context.Context + ctx context.Context // nolint:containedctx } func defaultCallParameters() *callParameters { diff --git a/signature/body.go b/signature/body.go index a160ed3..f537359 100644 --- a/signature/body.go +++ b/signature/body.go @@ -10,6 +10,7 @@ import ( "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session" ) +// nolint:funlen func serviceMessageBody(req interface{}) stableMarshaler { switch v := req.(type) { default: From 2aa3ee46e7ccc55868b9fb06de968cf753719471 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Wed, 3 May 2023 14:09:17 +0300 Subject: [PATCH 1066/1196] [#27] util/signature: Fix staticcheck warning Signed-off-by: Evgenii Stratonikov --- util/signature/buffer.go | 22 +++++++++++++--------- util/signature/data.go | 4 ++-- util/signature/options.go | 8 ++++---- 3 files changed, 19 insertions(+), 15 deletions(-) diff --git a/util/signature/buffer.go b/util/signature/buffer.go index 2a7f1e0..c2fa855 100644 --- a/util/signature/buffer.go +++ b/util/signature/buffer.go @@ -4,26 +4,30 @@ import "sync" const poolSliceMaxSize = 64 * 1024 +type buffer struct { + data []byte +} + var buffersPool = sync.Pool{ New: func() any { - return make([]byte, 0) + return new(buffer) }, } -func newBufferFromPool(size int) []byte { - result := buffersPool.Get().([]byte) - if cap(result) < size { - result = make([]byte, size) +func newBufferFromPool(size int) *buffer { + result := buffersPool.Get().(*buffer) + if cap(result.data) < size { + result.data = make([]byte, size) } else { - result = result[:size] + result.data = result.data[:size] } return result } -func returnBufferToPool(buf []byte) { - if cap(buf) > poolSliceMaxSize { +func returnBufferToPool(buf *buffer) { + if cap(buf.data) > poolSliceMaxSize { return } - buf = buf[:0] + buf.data = buf.data[:0] buffersPool.Put(buf) } diff --git a/util/signature/data.go b/util/signature/data.go index d2bf1dc..1db46dc 100644 --- a/util/signature/data.go +++ b/util/signature/data.go @@ -38,7 +38,7 @@ func SignDataWithHandler(key *ecdsa.PrivateKey, src DataSource, handler KeySigna buffer := newBufferFromPool(src.SignedDataSize()) defer returnBufferToPool(buffer) - data, err := src.ReadSignedData(buffer) + data, err := src.ReadSignedData(buffer.data) if err != nil { return err } @@ -67,7 +67,7 @@ func VerifyDataWithSource(dataSrc DataSource, sigSrc KeySignatureSource, opts .. buffer := newBufferFromPool(dataSrc.SignedDataSize()) defer returnBufferToPool(buffer) - data, err := dataSrc.ReadSignedData(buffer) + data, err := dataSrc.ReadSignedData(buffer.data) if err != nil { return err } diff --git a/util/signature/options.go b/util/signature/options.go index a8a3522..b9bf68d 100644 --- a/util/signature/options.go +++ b/util/signature/options.go @@ -37,8 +37,8 @@ func verify(cfg *cfg, data []byte, sig *refs.Signature) error { case refs.ECDSA_RFC6979_SHA256_WALLET_CONNECT: buffer := newBufferFromPool(base64.StdEncoding.EncodedLen(len(data))) defer returnBufferToPool(buffer) - base64.StdEncoding.Encode(buffer, data) - if !walletconnect.Verify(pub, buffer, sig.GetSign()) { + base64.StdEncoding.Encode(buffer.data, data) + if !walletconnect.Verify(pub, buffer.data, sig.GetSign()) { return crypto.ErrInvalidSignature } return nil @@ -56,8 +56,8 @@ func sign(cfg *cfg, key *ecdsa.PrivateKey, data []byte) ([]byte, error) { case refs.ECDSA_RFC6979_SHA256_WALLET_CONNECT: buffer := newBufferFromPool(base64.StdEncoding.EncodedLen(len(data))) defer returnBufferToPool(buffer) - base64.StdEncoding.Encode(buffer, data) - return walletconnect.Sign(key, buffer) + base64.StdEncoding.Encode(buffer.data, data) + return walletconnect.Sign(key, buffer.data) default: panic(fmt.Sprintf("unsupported scheme %s", cfg.scheme)) } From e9e7901f67f99998c6082bc46c95f1e652fe19b9 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Wed, 3 May 2023 14:09:59 +0300 Subject: [PATCH 1067/1196] [#27] util/proto: Fix staticcheck warning Signed-off-by: Evgenii Stratonikov --- util/proto/marshal_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/util/proto/marshal_test.go b/util/proto/marshal_test.go index de2b72f..11a4d8f 100644 --- a/util/proto/marshal_test.go +++ b/util/proto/marshal_test.go @@ -37,8 +37,8 @@ type stableRepPrimitives struct { const ( ENUM_UNKNOWN SomeEnum = 0 - ENUM_POSITIVE = 1 - ENUM_NEGATIVE = -1 + ENUM_POSITIVE SomeEnum = 1 + ENUM_NEGATIVE SomeEnum = -1 ) func (s *stablePrimitives) stableMarshal(buf []byte, wrongField bool) ([]byte, error) { From a3a5046ecc8925150a1cbc7943d58630ff61d9b6 Mon Sep 17 00:00:00 2001 From: Anton Nikiforov Date: Mon, 15 May 2023 17:25:04 +0300 Subject: [PATCH 1068/1196] [#28] Replace interface{} with any Signed-off-by: Anton Nikiforov --- pkg/tracing/grpc.go | 6 +++--- pkg/tracing/grpc_internal.go | 8 ++++---- rpc/grpc/init.go | 2 +- rpc/message/message.go | 4 ++-- signature/body.go | 2 +- signature/sign.go | 2 +- signature/verify.go | 2 +- status/test/codes.go | 2 +- 8 files changed, 14 insertions(+), 14 deletions(-) diff --git a/pkg/tracing/grpc.go b/pkg/tracing/grpc.go index 884ecb2..f0a3473 100644 --- a/pkg/tracing/grpc.go +++ b/pkg/tracing/grpc.go @@ -15,7 +15,7 @@ import ( // NewGRPCUnaryClientInteceptor creates new gRPC unary interceptor to save gRPC client traces. func NewGRPCUnaryClientInteceptor() grpc.UnaryClientInterceptor { - return func(ctx context.Context, method string, req, reply interface{}, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error { + return func(ctx context.Context, method string, req, reply any, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error { ctx, span := startClientSpan(ctx, cc, method) defer span.End() @@ -74,7 +74,7 @@ func NewGRPCStreamClientInterceptor() grpc.StreamClientInterceptor { // NewGRPCUnaryServerInterceptor creates new gRPC unary interceptor to save gRPC server traces. func NewGRPCUnaryServerInterceptor() grpc.UnaryServerInterceptor { - return func(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (resp interface{}, err error) { + return func(ctx context.Context, req any, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (resp interface{}, err error) { ctx = extractGRPCTraceInfo(ctx) var span trace.Span ctx, span = StartSpanFromContext(ctx, info.FullMethod, @@ -94,7 +94,7 @@ func NewGRPCUnaryServerInterceptor() grpc.UnaryServerInterceptor { // NewGRPCStreamServerInterceptor creates new gRPC stream interceptor to save gRPC server traces. func NewGRPCStreamServerInterceptor() grpc.StreamServerInterceptor { - return func(srv interface{}, ss grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error { + return func(srv any, ss grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error { ctx := extractGRPCTraceInfo(ss.Context()) var span trace.Span ctx, span = StartSpanFromContext(ctx, info.FullMethod, diff --git a/pkg/tracing/grpc_internal.go b/pkg/tracing/grpc_internal.go index 847c7ca..7c1bfab 100644 --- a/pkg/tracing/grpc_internal.go +++ b/pkg/tracing/grpc_internal.go @@ -100,7 +100,7 @@ func (cs *clientStream) Context() context.Context { return cs.originalStream.Context() } -func (cs *clientStream) SendMsg(m interface{}) error { +func (cs *clientStream) SendMsg(m any) error { err := cs.originalStream.SendMsg(m) if err != nil { select { @@ -111,7 +111,7 @@ func (cs *clientStream) SendMsg(m interface{}) error { return err } -func (cs *clientStream) RecvMsg(m interface{}) error { +func (cs *clientStream) RecvMsg(m any) error { err := cs.originalStream.RecvMsg(m) if err != nil || !cs.desc.ServerStreams { select { @@ -150,10 +150,10 @@ func (ss *serverStream) Context() context.Context { return ss.ctx } -func (ss *serverStream) SendMsg(m interface{}) error { +func (ss *serverStream) SendMsg(m any) error { return ss.originalStream.SendMsg(m) } -func (ss *serverStream) RecvMsg(m interface{}) error { +func (ss *serverStream) RecvMsg(m any) error { return ss.originalStream.RecvMsg(m) } diff --git a/rpc/grpc/init.go b/rpc/grpc/init.go index 79f08c9..0092d39 100644 --- a/rpc/grpc/init.go +++ b/rpc/grpc/init.go @@ -1,4 +1,4 @@ package grpc // Message represents raw gRPC message. -type Message interface{} +type Message any diff --git a/rpc/message/message.go b/rpc/message/message.go index c9b87f0..705270e 100644 --- a/rpc/message/message.go +++ b/rpc/message/message.go @@ -26,12 +26,12 @@ type Message interface { // ErrUnexpectedMessageType is an error that // is used to indicate message mismatch. type ErrUnexpectedMessageType struct { - exp, act interface{} + exp, act any } // NewUnexpectedMessageType initializes an error about message mismatch // between act and exp. -func NewUnexpectedMessageType(act, exp interface{}) ErrUnexpectedMessageType { +func NewUnexpectedMessageType(act, exp any) ErrUnexpectedMessageType { return ErrUnexpectedMessageType{ exp: exp, act: act, diff --git a/signature/body.go b/signature/body.go index f537359..6d43249 100644 --- a/signature/body.go +++ b/signature/body.go @@ -11,7 +11,7 @@ import ( ) // nolint:funlen -func serviceMessageBody(req interface{}) stableMarshaler { +func serviceMessageBody(req any) stableMarshaler { switch v := req.(type) { default: panic(fmt.Sprintf("unsupported session message %T", req)) diff --git a/signature/sign.go b/signature/sign.go index 49343bd..f50d83f 100644 --- a/signature/sign.go +++ b/signature/sign.go @@ -29,7 +29,7 @@ type signatureReceiver interface { } // SignServiceMessage signes service message with key. -func SignServiceMessage(key *ecdsa.PrivateKey, msg interface{}) error { +func SignServiceMessage(key *ecdsa.PrivateKey, msg any) error { switch v := msg.(type) { case nil: return nil diff --git a/signature/verify.go b/signature/verify.go index 67e4a82..7a8ed82 100644 --- a/signature/verify.go +++ b/signature/verify.go @@ -17,7 +17,7 @@ type signatureProvider interface { } // VerifyServiceMessage verifies service message. -func VerifyServiceMessage(msg interface{}) error { +func VerifyServiceMessage(msg any) error { switch v := msg.(type) { case nil: return nil diff --git a/status/test/codes.go b/status/test/codes.go index 3a2e001..b832c87 100644 --- a/status/test/codes.go +++ b/status/test/codes.go @@ -12,7 +12,7 @@ import ( func TestCodes(t *testing.T, localizer func(*status.Code) bool, globalizer func(code *status.Code), - vals ...interface{}, + vals ...any, ) { for i := 0; i < len(vals); i += 2 { c := vals[i].(status.Code) From a3e8e0c00c204e2e33aa1a7717cef1384843b0cf Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Tue, 16 May 2023 15:48:40 +0300 Subject: [PATCH 1069/1196] [#32] client: drop keepalive options Node doesn't use any specific settings, these setting should be provided by the caller. Signed-off-by: Evgenii Stratonikov --- rpc/client/options.go | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/rpc/client/options.go b/rpc/client/options.go index 005594c..0575dfc 100644 --- a/rpc/client/options.go +++ b/rpc/client/options.go @@ -6,7 +6,6 @@ import ( "google.golang.org/grpc" "google.golang.org/grpc/credentials/insecure" - "google.golang.org/grpc/keepalive" ) const ( @@ -30,9 +29,8 @@ type cfg struct { } const ( - defaultDialTimeout = 5 * time.Second - defaultKeepAliveTimeout = 5 * time.Second - defaultRWTimeout = 1 * time.Minute + defaultDialTimeout = 5 * time.Second + defaultRWTimeout = 1 * time.Minute ) func (c *cfg) initDefault() { @@ -41,9 +39,6 @@ func (c *cfg) initDefault() { c.grpcDialOpts = []grpc.DialOption{ grpc.WithBlock(), grpc.WithTransportCredentials(insecure.NewCredentials()), - grpc.WithKeepaliveParams(keepalive.ClientParameters{ - Timeout: defaultKeepAliveTimeout, - }), } } From eba07dee0ce3509204393fadef2098f4b5c072d5 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Fri, 19 May 2023 11:10:54 +0300 Subject: [PATCH 1070/1196] [#33] go.mod: Update dependencies Signed-off-by: Evgenii Stratonikov --- CHANGELOG.md | 10 +++++++ go.mod | 38 ++++++++++++------------- go.sum | 80 +++++++++++++++++++++++++--------------------------- 3 files changed, 68 insertions(+), 60 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 27506b4..887bce5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,16 @@ - Reputation system (#21) ### Updated +- `github.com/stretchr/testify` to `v1.8.3` +- `go.opentelemetry.io/otel` to `v1.15.1` +- `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc` to `v1.15.1` +- `go.opentelemetry.io/otel/exporters/stdout/stdouttrace` to `v1.15.1` +- `go.opentelemetry.io/otel/sdk` to `v1.15.1` +- `go.opentelemetry.io/otel/trace` to `v1.15.1` +- `golang.org/x/sync` to `v0.2.0` +- `google.golang.org/grpc` to `v1.55.0` +- `google.golang.org/protobuf` to `v1.30.0` + ## 2.15.0 - 2023-04-11 diff --git a/go.mod b/go.mod index 7a6dc32..45fbfe4 100644 --- a/go.mod +++ b/go.mod @@ -4,33 +4,33 @@ go 1.18 require ( git.frostfs.info/TrueCloudLab/frostfs-crypto v0.6.0 - github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel v1.14.0 - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.14.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.14.0 - go.opentelemetry.io/otel/sdk v1.14.0 - go.opentelemetry.io/otel/trace v1.14.0 - golang.org/x/sync v0.1.0 - google.golang.org/grpc v1.53.0 - google.golang.org/protobuf v1.28.1 + github.com/stretchr/testify v1.8.3 + go.opentelemetry.io/otel v1.15.1 + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.15.1 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.15.1 + go.opentelemetry.io/otel/sdk v1.15.1 + go.opentelemetry.io/otel/trace v1.15.1 + golang.org/x/sync v0.2.0 + google.golang.org/grpc v1.55.0 + google.golang.org/protobuf v1.30.0 ) require ( git.frostfs.info/TrueCloudLab/rfc6979 v0.4.0 // indirect - github.com/cenkalti/backoff/v4 v4.2.0 // indirect + github.com/cenkalti/backoff/v4 v4.2.1 // indirect github.com/davecgh/go-spew v1.1.1 // indirect - github.com/go-logr/logr v1.2.3 // indirect + github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect - github.com/golang/protobuf v1.5.2 // indirect - github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect + github.com/golang/protobuf v1.5.3 // indirect + github.com/grpc-ecosystem/grpc-gateway/v2 v2.15.2 // indirect github.com/mr-tron/base58 v1.2.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.14.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.14.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.15.1 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.15.1 // indirect go.opentelemetry.io/proto/otlp v0.19.0 // indirect - golang.org/x/net v0.7.0 // indirect - golang.org/x/sys v0.5.0 // indirect - golang.org/x/text v0.7.0 // indirect - google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect + golang.org/x/net v0.10.0 // indirect + golang.org/x/sys v0.8.0 // indirect + golang.org/x/text v0.9.0 // indirect + google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 0664c0e..5fa3cbc 100644 --- a/go.sum +++ b/go.sum @@ -39,8 +39,8 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03 github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= -github.com/cenkalti/backoff/v4 v4.2.0 h1:HN5dHm3WBOgndBH6E8V0q2jIYIR3s9yglV8k/+MN3u4= -github.com/cenkalti/backoff/v4 v4.2.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= +github.com/cenkalti/backoff/v4 v4.2.1 h1:y4OZtCnogmCPw98Zjyt5a6+QwPLGkiQsYW5oUqylYbM= +github.com/cenkalti/backoff/v4 v4.2.1/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= @@ -70,13 +70,13 @@ github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9 github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= -github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= +github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/glog v1.0.0 h1:nfP3RFugxnNRyKgeWd4oI1nYvXpxrx8ck8ZrcizshdQ= github.com/golang/glog v1.0.0/go.mod h1:EWib/APOK0SL3dFbYqvxE3UYd8E6s1ouQ7iEp/0LWV4= +github.com/golang/glog v1.1.0 h1:/d3pCKDPWNnvIWe0vVUpNP32qc8U3PDVxySP/y360qE= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= @@ -102,8 +102,9 @@ github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QD github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= +github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= @@ -130,8 +131,9 @@ github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+ github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 h1:BZHcxBETFHIdVyhyEfOvn/RdU/QGdLI4y34qQGjGWO0= github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0/go.mod h1:hgWBS7lorOAVIJEQMi4ZsPv9hVvWI6+ch50m39Pf2Ks= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.15.2 h1:gDLXvp5S9izjldquuoAhDzccbskOL6tDC5jMSyx3zxE= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.15.2/go.mod h1:7pdNwVWBBHGiCxa9lAszqCJMbfTISJ7oMftp8+UGV08= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= @@ -152,15 +154,11 @@ github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6L github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= -github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= +github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= @@ -169,20 +167,20 @@ go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opentelemetry.io/otel v1.14.0 h1:/79Huy8wbf5DnIPhemGB+zEPVwnN6fuQybr/SRXa6hM= -go.opentelemetry.io/otel v1.14.0/go.mod h1:o4buv+dJzx8rohcUeRmWUZhqupFvzWis188WlggnNeU= -go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.14.0 h1:/fXHZHGvro6MVqV34fJzDhi7sHGpX3Ej/Qjmfn003ho= -go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.14.0/go.mod h1:UFG7EBMRdXyFstOwH028U0sVf+AvukSGhF0g8+dmNG8= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.14.0 h1:TKf2uAs2ueguzLaxOCBXNpHxfO/aC7PAdDsSH0IbeRQ= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.14.0/go.mod h1:HrbCVv40OOLTABmOn1ZWty6CHXkU8DK/Urc43tHug70= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.14.0 h1:ap+y8RXX3Mu9apKVtOkM6WSFESLM8K3wNQyOU8sWHcc= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.14.0/go.mod h1:5w41DY6S9gZrbjuq6Y+753e96WfPha5IcsOSZTtullM= -go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.14.0 h1:sEL90JjOO/4yhquXl5zTAkLLsZ5+MycAgX99SDsxGc8= -go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.14.0/go.mod h1:oCslUcizYdpKYyS9e8srZEqM6BB8fq41VJBjLAE6z1w= -go.opentelemetry.io/otel/sdk v1.14.0 h1:PDCppFRDq8A1jL9v6KMI6dYesaq+DFcDZvjsoGvxGzY= -go.opentelemetry.io/otel/sdk v1.14.0/go.mod h1:bwIC5TjrNG6QDCHNWvW4HLHtUQ4I+VQDsnjhvyZCALM= -go.opentelemetry.io/otel/trace v1.14.0 h1:wp2Mmvj41tDsyAJXiWDWpfNsOiIyd38fy85pyKcFq/M= -go.opentelemetry.io/otel/trace v1.14.0/go.mod h1:8avnQLK+CG77yNLUae4ea2JDQ6iT+gozhnZjy/rw9G8= +go.opentelemetry.io/otel v1.15.1 h1:3Iwq3lfRByPaws0f6bU3naAqOR1n5IeDWd9390kWHa8= +go.opentelemetry.io/otel v1.15.1/go.mod h1:mHHGEHVDLal6YrKMmk9LqC4a3sF5g+fHfrttQIB1NTc= +go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.15.1 h1:XYDQtNzdb2T4uM1pku2m76eSMDJgqhJ+6KzkqgQBALc= +go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.15.1/go.mod h1:uOTV75+LOzV+ODmL8ahRLWkFA3eQcSC2aAsbxIu4duk= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.15.1 h1:tyoeaUh8REKay72DVYsSEBYV18+fGONe+YYPaOxgLoE= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.15.1/go.mod h1:HUSnrjQQ19KX9ECjpQxufsF+3ioD3zISPMlauTPZu2g= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.15.1 h1:pIfoG5IAZFzp9EUlJzdSkpUwpaUAAnD+Ru1nBLTACIQ= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.15.1/go.mod h1:poNKBqF5+nR/6ke2oGTDjHfksrsHDOHXAl2g4+9ONsY= +go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.15.1 h1:2PunuO5SbkN5MhCbuHCd3tC6qrcaj+uDAkX/qBU5BAs= +go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.15.1/go.mod h1:q8+Tha+5LThjeSU8BW93uUC5w5/+DnYHMKBMpRCsui0= +go.opentelemetry.io/otel/sdk v1.15.1 h1:5FKR+skgpzvhPQHIEfcwMYjCBr14LWzs3uSqKiQzETI= +go.opentelemetry.io/otel/sdk v1.15.1/go.mod h1:8rVtxQfrbmbHKfqzpQkT5EzZMcbMBwTzNAggbEAM0KA= +go.opentelemetry.io/otel/trace v1.15.1 h1:uXLo6iHJEzDfrNC0L0mNjItIp06SyaBQxu5t3xMlngY= +go.opentelemetry.io/otel/trace v1.15.1/go.mod h1:IWdQG/5N1x7f6YUlmdLeJvH9yxtuJAfc4VW5Agv9r/8= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.opentelemetry.io/proto/otlp v0.19.0 h1:IVN6GR+mhC4s5yfcTbmzHYODqvWAp3ZedA2SJPI1Nnw= go.opentelemetry.io/proto/otlp v0.19.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= @@ -249,8 +247,8 @@ golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81R golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g= -golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= +golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -265,8 +263,8 @@ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o= -golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.2.0 h1:PUR+T4wwASmuSTYdKjYHI5TD22Wy5ogLU5qZCOLxBrI= +golang.org/x/sync v0.2.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -295,8 +293,8 @@ golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= +golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -304,8 +302,8 @@ golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3 golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= -golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= +golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -406,8 +404,8 @@ google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f h1:BWUVssLB0HVOSY78gIdvk1dTVYtT1y8SBWtPYuTJ/6w= -google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM= +google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 h1:KpwkzHKEF7B9Zxg18WzOa7djJ+Ha5DzthMyZYQfEn2A= +google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1/go.mod h1:nKE/iIaLqn2bQwXBg8f1g2Ylh6r5MN5CmZvuzZCgsCU= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= @@ -424,8 +422,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.53.0 h1:LAv2ds7cmFV/XTS3XG1NneeENYrXGmorPxsBbptIjNc= -google.golang.org/grpc v1.53.0/go.mod h1:OnIrk0ipVdj4N5d9IUoFUx72/VlD7+jUsHwZgwSMQpw= +google.golang.org/grpc v1.55.0 h1:3Oj82/tFSCeUrRTg/5E/7d/W5A1tj6Ky1ABAuZuv5ag= +google.golang.org/grpc v1.55.0/go.mod h1:iYEXKGkEBhg1PjZQvoYEVPTDkHo1/bjTnfwTeGONTY8= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -439,8 +437,8 @@ google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlba google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w= -google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= +google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= From 33445c6810347c785a82a4e48ed6621193e3b926 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Fri, 19 May 2023 14:26:02 +0300 Subject: [PATCH 1071/1196] [#33] go.mod: move to go1.19 Signed-off-by: Evgenii Stratonikov --- go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 45fbfe4..8111530 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 -go 1.18 +go 1.19 require ( git.frostfs.info/TrueCloudLab/frostfs-crypto v0.6.0 From 0c67b8fefa41581f5948f19ad27319b2429afa32 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Fri, 19 May 2023 14:40:17 +0300 Subject: [PATCH 1072/1196] [#34] tracing: use atomic.Pointer Signed-off-by: Evgenii Stratonikov --- pkg/tracing/setup.go | 4 ++-- pkg/tracing/span.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/tracing/setup.go b/pkg/tracing/setup.go index 3df069e..067dfda 100644 --- a/pkg/tracing/setup.go +++ b/pkg/tracing/setup.go @@ -99,8 +99,8 @@ func Shutdown(ctx context.Context) error { return flushAndShutdown(ctx) } -func getDefaultTracer() *atomic.Value { - v := &atomic.Value{} +func getDefaultTracer() *atomic.Pointer[tracerHolder] { + v := new(atomic.Pointer[tracerHolder]) v.Store(&tracerHolder{Tracer: trace.NewNoopTracerProvider().Tracer("")}) return v } diff --git a/pkg/tracing/span.go b/pkg/tracing/span.go index 5e28c75..1071f47 100644 --- a/pkg/tracing/span.go +++ b/pkg/tracing/span.go @@ -8,5 +8,5 @@ import ( // StartSpanFromContext creates a span and a context.Context containing the newly-created span. func StartSpanFromContext(ctx context.Context, operationName string, opts ...trace.SpanStartOption) (context.Context, trace.Span) { - return tracer.Load().(*tracerHolder).Tracer.Start(ctx, operationName, opts...) + return tracer.Load().Tracer.Start(ctx, operationName, opts...) } From 8266b310929fdb3a2aa5ac114092fe4e3269f340 Mon Sep 17 00:00:00 2001 From: Airat Arifullin Date: Tue, 23 May 2023 18:52:57 +0300 Subject: [PATCH 1073/1196] [#26] netmap: Add NOT and UNIQUE keywords * Regenerate types.pb.go for netmap grpc * Add unique flag to PlacementPolicy struct Signed-off-by: Airat Arifullin a.arifullin@yadro.com --- netmap/grpc/types.pb.go | 151 ++++++++++++++++++++++------------------ netmap/types.go | 13 ++++ 2 files changed, 96 insertions(+), 68 deletions(-) diff --git a/netmap/grpc/types.pb.go b/netmap/grpc/types.pb.go index f1d5ef0..9c6c489 100644 --- a/netmap/grpc/types.pb.go +++ b/netmap/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.9 +// protoc-gen-go v1.30.0 +// protoc v3.12.4 // source: netmap/grpc/types.proto package netmap @@ -42,6 +42,8 @@ const ( Operation_OR Operation = 7 // Logical AND Operation_AND Operation = 8 + // Logical negation + Operation_NOT Operation = 9 ) // Enum value maps for Operation. @@ -56,6 +58,7 @@ var ( 6: "LE", 7: "OR", 8: "AND", + 9: "NOT", } Operation_value = map[string]int32{ "OPERATION_UNSPECIFIED": 0, @@ -67,6 +70,7 @@ var ( "LE": 6, "OR": 7, "AND": 8, + "NOT": 9, } ) @@ -463,6 +467,8 @@ type PlacementPolicy struct { Selectors []*Selector `protobuf:"bytes,3,rep,name=selectors,proto3" json:"selectors,omitempty"` // List of named filters to reference in selectors Filters []*Filter `protobuf:"bytes,4,rep,name=filters,proto3" json:"filters,omitempty"` + // Unique flag defines non-overlapping application for replicas + Unique bool `protobuf:"varint,5,opt,name=unique,proto3" json:"unique,omitempty"` } func (x *PlacementPolicy) Reset() { @@ -525,6 +531,13 @@ func (x *PlacementPolicy) GetFilters() []*Filter { return nil } +func (x *PlacementPolicy) GetUnique() bool { + if x != nil { + return x.Unique + } + return false +} + // NeoFS node description type NodeInfo struct { state protoimpl.MessageState @@ -1042,7 +1055,7 @@ var file_netmap_grpc_types_proto_rawDesc = []byte{ 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x22, - 0xee, 0x01, 0x0a, 0x0f, 0x50, 0x6c, 0x61, 0x63, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x50, 0x6f, 0x6c, + 0x86, 0x02, 0x0a, 0x0f, 0x50, 0x6c, 0x61, 0x63, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x35, 0x0a, 0x08, 0x72, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, @@ -1057,71 +1070,73 @@ var file_netmap_grpc_types_proto_rawDesc = []byte{ 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x07, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x73, - 0x22, 0xd8, 0x02, 0x0a, 0x08, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x1d, 0x0a, - 0x0a, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0c, 0x52, 0x09, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x12, 0x1c, 0x0a, 0x09, - 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, - 0x09, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x12, 0x44, 0x0a, 0x0a, 0x61, 0x74, - 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, - 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, - 0x70, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x41, 0x74, 0x74, 0x72, 0x69, - 0x62, 0x75, 0x74, 0x65, 0x52, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, - 0x12, 0x36, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, - 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, - 0x61, 0x70, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x53, 0x74, 0x61, 0x74, - 0x65, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x1a, 0x4d, 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, 0x12, 0x18, 0x0a, - 0x07, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, - 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x73, 0x22, 0x42, 0x0a, 0x05, 0x53, 0x74, 0x61, 0x74, 0x65, - 0x12, 0x0f, 0x0a, 0x0b, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, - 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x4f, 0x4e, 0x4c, 0x49, 0x4e, 0x45, 0x10, 0x01, 0x12, 0x0b, 0x0a, - 0x07, 0x4f, 0x46, 0x46, 0x4c, 0x49, 0x4e, 0x45, 0x10, 0x02, 0x12, 0x0f, 0x0a, 0x0b, 0x4d, 0x41, - 0x49, 0x4e, 0x54, 0x45, 0x4e, 0x41, 0x4e, 0x43, 0x45, 0x10, 0x03, 0x22, 0x50, 0x0a, 0x06, 0x4e, - 0x65, 0x74, 0x6d, 0x61, 0x70, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x12, 0x30, 0x0a, 0x05, 0x6e, - 0x6f, 0x64, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6e, 0x65, 0x6f, - 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4e, 0x6f, - 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x05, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x22, 0x8f, 0x01, - 0x0a, 0x0d, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, - 0x49, 0x0a, 0x0a, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, - 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x43, 0x6f, - 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x52, 0x0a, - 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x1a, 0x33, 0x0a, 0x09, 0x50, 0x61, - 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0c, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, - 0xbf, 0x01, 0x0a, 0x0b, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x12, - 0x23, 0x0a, 0x0d, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x65, 0x70, 0x6f, 0x63, 0x68, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0c, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x45, - 0x70, 0x6f, 0x63, 0x68, 0x12, 0x21, 0x0a, 0x0c, 0x6d, 0x61, 0x67, 0x69, 0x63, 0x5f, 0x6e, 0x75, - 0x6d, 0x62, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0b, 0x6d, 0x61, 0x67, 0x69, - 0x63, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x20, 0x0a, 0x0c, 0x6d, 0x73, 0x5f, 0x70, 0x65, - 0x72, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x6d, - 0x73, 0x50, 0x65, 0x72, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x46, 0x0a, 0x0e, 0x6e, 0x65, 0x74, - 0x77, 0x6f, 0x72, 0x6b, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x04, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, - 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x43, 0x6f, 0x6e, 0x66, - 0x69, 0x67, 0x52, 0x0d, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x43, 0x6f, 0x6e, 0x66, 0x69, - 0x67, 0x2a, 0x67, 0x0a, 0x09, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x19, - 0x0a, 0x15, 0x4f, 0x50, 0x45, 0x52, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x53, 0x50, - 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x06, 0x0a, 0x02, 0x45, 0x51, 0x10, - 0x01, 0x12, 0x06, 0x0a, 0x02, 0x4e, 0x45, 0x10, 0x02, 0x12, 0x06, 0x0a, 0x02, 0x47, 0x54, 0x10, - 0x03, 0x12, 0x06, 0x0a, 0x02, 0x47, 0x45, 0x10, 0x04, 0x12, 0x06, 0x0a, 0x02, 0x4c, 0x54, 0x10, - 0x05, 0x12, 0x06, 0x0a, 0x02, 0x4c, 0x45, 0x10, 0x06, 0x12, 0x06, 0x0a, 0x02, 0x4f, 0x52, 0x10, - 0x07, 0x12, 0x07, 0x0a, 0x03, 0x41, 0x4e, 0x44, 0x10, 0x08, 0x2a, 0x38, 0x0a, 0x06, 0x43, 0x6c, - 0x61, 0x75, 0x73, 0x65, 0x12, 0x16, 0x0a, 0x12, 0x43, 0x4c, 0x41, 0x55, 0x53, 0x45, 0x5f, 0x55, - 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, - 0x53, 0x41, 0x4d, 0x45, 0x10, 0x01, 0x12, 0x0c, 0x0a, 0x08, 0x44, 0x49, 0x53, 0x54, 0x49, 0x4e, - 0x43, 0x54, 0x10, 0x02, 0x42, 0x61, 0x5a, 0x42, 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, 0x61, 0x70, - 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2f, 0x67, - 0x72, 0x70, 0x63, 0x3b, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0xaa, 0x02, 0x1a, 0x4e, 0x65, 0x6f, - 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, - 0x2e, 0x4e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x12, 0x16, 0x0a, 0x06, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, + 0x52, 0x06, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x22, 0xd8, 0x02, 0x0a, 0x08, 0x4e, 0x6f, 0x64, + 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, + 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x70, 0x75, 0x62, 0x6c, 0x69, + 0x63, 0x4b, 0x65, 0x79, 0x12, 0x1c, 0x0a, 0x09, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, + 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x09, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, + 0x65, 0x73, 0x12, 0x44, 0x0a, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, + 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, + 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, + 0x66, 0x6f, 0x2e, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x52, 0x0a, 0x61, 0x74, + 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x36, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, + 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, + 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x49, + 0x6e, 0x66, 0x6f, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, + 0x1a, 0x4d, 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, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x73, + 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x73, 0x22, + 0x42, 0x0a, 0x05, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x0f, 0x0a, 0x0b, 0x55, 0x4e, 0x53, 0x50, + 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x4f, 0x4e, 0x4c, + 0x49, 0x4e, 0x45, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x4f, 0x46, 0x46, 0x4c, 0x49, 0x4e, 0x45, + 0x10, 0x02, 0x12, 0x0f, 0x0a, 0x0b, 0x4d, 0x41, 0x49, 0x4e, 0x54, 0x45, 0x4e, 0x41, 0x4e, 0x43, + 0x45, 0x10, 0x03, 0x22, 0x50, 0x0a, 0x06, 0x4e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x12, 0x14, 0x0a, + 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x65, 0x70, + 0x6f, 0x63, 0x68, 0x12, 0x30, 0x0a, 0x05, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, + 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x05, + 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x22, 0x8f, 0x01, 0x0a, 0x0d, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, + 0x6b, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x49, 0x0a, 0x0a, 0x70, 0x61, 0x72, 0x61, 0x6d, + 0x65, 0x74, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x6e, 0x65, + 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4e, + 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x50, 0x61, 0x72, + 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x52, 0x0a, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, + 0x72, 0x73, 0x1a, 0x33, 0x0a, 0x09, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x12, + 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x03, 0x6b, 0x65, + 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, + 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xbf, 0x01, 0x0a, 0x0b, 0x4e, 0x65, 0x74, 0x77, + 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x23, 0x0a, 0x0d, 0x63, 0x75, 0x72, 0x72, 0x65, + 0x6e, 0x74, 0x5f, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0c, + 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x45, 0x70, 0x6f, 0x63, 0x68, 0x12, 0x21, 0x0a, 0x0c, + 0x6d, 0x61, 0x67, 0x69, 0x63, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x04, 0x52, 0x0b, 0x6d, 0x61, 0x67, 0x69, 0x63, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, + 0x20, 0x0a, 0x0c, 0x6d, 0x73, 0x5f, 0x70, 0x65, 0x72, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x6d, 0x73, 0x50, 0x65, 0x72, 0x42, 0x6c, 0x6f, 0x63, + 0x6b, 0x12, 0x46, 0x0a, 0x0e, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x5f, 0x63, 0x6f, 0x6e, + 0x66, 0x69, 0x67, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, + 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4e, 0x65, 0x74, + 0x77, 0x6f, 0x72, 0x6b, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x0d, 0x6e, 0x65, 0x74, 0x77, + 0x6f, 0x72, 0x6b, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2a, 0x70, 0x0a, 0x09, 0x4f, 0x70, 0x65, + 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x19, 0x0a, 0x15, 0x4f, 0x50, 0x45, 0x52, 0x41, 0x54, + 0x49, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, + 0x00, 0x12, 0x06, 0x0a, 0x02, 0x45, 0x51, 0x10, 0x01, 0x12, 0x06, 0x0a, 0x02, 0x4e, 0x45, 0x10, + 0x02, 0x12, 0x06, 0x0a, 0x02, 0x47, 0x54, 0x10, 0x03, 0x12, 0x06, 0x0a, 0x02, 0x47, 0x45, 0x10, + 0x04, 0x12, 0x06, 0x0a, 0x02, 0x4c, 0x54, 0x10, 0x05, 0x12, 0x06, 0x0a, 0x02, 0x4c, 0x45, 0x10, + 0x06, 0x12, 0x06, 0x0a, 0x02, 0x4f, 0x52, 0x10, 0x07, 0x12, 0x07, 0x0a, 0x03, 0x41, 0x4e, 0x44, + 0x10, 0x08, 0x12, 0x07, 0x0a, 0x03, 0x4e, 0x4f, 0x54, 0x10, 0x09, 0x2a, 0x38, 0x0a, 0x06, 0x43, + 0x6c, 0x61, 0x75, 0x73, 0x65, 0x12, 0x16, 0x0a, 0x12, 0x43, 0x4c, 0x41, 0x55, 0x53, 0x45, 0x5f, + 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x08, 0x0a, + 0x04, 0x53, 0x41, 0x4d, 0x45, 0x10, 0x01, 0x12, 0x0c, 0x0a, 0x08, 0x44, 0x49, 0x53, 0x54, 0x49, + 0x4e, 0x43, 0x54, 0x10, 0x02, 0x42, 0x61, 0x5a, 0x42, 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, 0x61, + 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2f, + 0x67, 0x72, 0x70, 0x63, 0x3b, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0xaa, 0x02, 0x1a, 0x4e, 0x65, + 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, + 0x49, 0x2e, 0x4e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/netmap/types.go b/netmap/types.go index 27fc2ff..aece7cf 100644 --- a/netmap/types.go +++ b/netmap/types.go @@ -55,6 +55,7 @@ type Replica struct { type Operation uint32 type PlacementPolicy struct { + unique bool replicas []Replica backupFactor uint32 selectors []Selector @@ -106,6 +107,7 @@ const ( LE OR AND + NOT ) const ( @@ -257,6 +259,17 @@ func (r *Replica) SetCount(count uint32) { r.count = count } +func (p *PlacementPolicy) GetUnique() bool { + if p != nil { + return p.unique + } + return false +} + +func (p *PlacementPolicy) SetUnique(unique bool) { + p.unique = unique +} + func (p *PlacementPolicy) GetFilters() []Filter { if p != nil { return p.filters From 62edd68f47ac909bbc198a6efbd6c1b885c7ad3d Mon Sep 17 00:00:00 2001 From: Dmitrii Stepanov Date: Tue, 30 May 2023 15:46:58 +0300 Subject: [PATCH 1074/1196] [#36] tracing: Drop tracing pkg Tracing will be moved to frostfs-observability repo. Signed-off-by: Dmitrii Stepanov --- go.mod | 14 +- go.sum | 416 +-------------------------------- pkg/tracing/config.go | 74 ------ pkg/tracing/config_test.go | 212 ----------------- pkg/tracing/grpc.go | 135 ----------- pkg/tracing/grpc_internal.go | 159 ------------- pkg/tracing/propagator.go | 96 -------- pkg/tracing/propagator_test.go | 257 -------------------- pkg/tracing/setup.go | 156 ------------- pkg/tracing/span.go | 12 - rpc/client/client.go | 10 - 11 files changed, 4 insertions(+), 1537 deletions(-) delete mode 100644 pkg/tracing/config.go delete mode 100644 pkg/tracing/config_test.go delete mode 100644 pkg/tracing/grpc.go delete mode 100644 pkg/tracing/grpc_internal.go delete mode 100644 pkg/tracing/propagator.go delete mode 100644 pkg/tracing/propagator_test.go delete mode 100644 pkg/tracing/setup.go delete mode 100644 pkg/tracing/span.go diff --git a/go.mod b/go.mod index 8111530..f7eedf6 100644 --- a/go.mod +++ b/go.mod @@ -5,11 +5,6 @@ go 1.19 require ( git.frostfs.info/TrueCloudLab/frostfs-crypto v0.6.0 github.com/stretchr/testify v1.8.3 - go.opentelemetry.io/otel v1.15.1 - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.15.1 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.15.1 - go.opentelemetry.io/otel/sdk v1.15.1 - go.opentelemetry.io/otel/trace v1.15.1 golang.org/x/sync v0.2.0 google.golang.org/grpc v1.55.0 google.golang.org/protobuf v1.30.0 @@ -17,20 +12,15 @@ require ( require ( git.frostfs.info/TrueCloudLab/rfc6979 v0.4.0 // indirect - github.com/cenkalti/backoff/v4 v4.2.1 // indirect github.com/davecgh/go-spew v1.1.1 // indirect - github.com/go-logr/logr v1.2.4 // indirect - github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.3 // indirect - github.com/grpc-ecosystem/grpc-gateway/v2 v2.15.2 // indirect + github.com/kr/pretty v0.1.0 // indirect github.com/mr-tron/base58 v1.2.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.15.1 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.15.1 // indirect - go.opentelemetry.io/proto/otlp v0.19.0 // indirect golang.org/x/net v0.10.0 // indirect golang.org/x/sys v0.8.0 // indirect golang.org/x/text v0.9.0 // indirect google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect + gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 5fa3cbc..bb23dce 100644 --- a/go.sum +++ b/go.sum @@ -1,145 +1,15 @@ -cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= -cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= -cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= -cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= -cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= -cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= -cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4= -cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M= -cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc= -cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk= -cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs= -cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc= -cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY= -cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= -cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= -cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= -cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= -cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= -cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= -cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= -cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= -cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= -cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= -cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= -cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU= -cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= -cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= -cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= -cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= -cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= -dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= git.frostfs.info/TrueCloudLab/frostfs-crypto v0.6.0 h1:FxqFDhQYYgpe41qsIHVOcdzSVCB8JNSfPG7Uk4r2oSk= git.frostfs.info/TrueCloudLab/frostfs-crypto v0.6.0/go.mod h1:RUIKZATQLJ+TaYQa60X2fTDwfuhMfm8Ar60bQ5fr+vU= git.frostfs.info/TrueCloudLab/rfc6979 v0.4.0 h1:M2KR3iBj7WpY3hP10IevfIB9MURr4O9mwVfJ+SjT3HA= git.frostfs.info/TrueCloudLab/rfc6979 v0.4.0/go.mod h1:okpbKfVYf/BpejtfFTfhZqFP+sZ8rsHrP8Rr/jYPNRc= -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= -github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= -github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= -github.com/cenkalti/backoff/v4 v4.2.1 h1:y4OZtCnogmCPw98Zjyt5a6+QwPLGkiQsYW5oUqylYbM= -github.com/cenkalti/backoff/v4 v4.2.1/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= -github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= -github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= -github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= -github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= -github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= -github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= -github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= -github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= -github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= -github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= -github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= -github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= -github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= -github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= -github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= -github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= -github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/glog v1.0.0/go.mod h1:EWib/APOK0SL3dFbYqvxE3UYd8E6s1ouQ7iEp/0LWV4= -github.com/golang/glog v1.1.0 h1:/d3pCKDPWNnvIWe0vVUpNP32qc8U3PDVxySP/y360qE= -github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= -github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= -github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= -github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= -github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= -github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= -github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= -github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= -github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= -github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= -github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= -github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= -github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= -github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= -github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= -github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= -github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= -github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0/go.mod h1:hgWBS7lorOAVIJEQMi4ZsPv9hVvWI6+ch50m39Pf2Ks= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.15.2 h1:gDLXvp5S9izjldquuoAhDzccbskOL6tDC5jMSyx3zxE= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.15.2/go.mod h1:7pdNwVWBBHGiCxa9lAszqCJMbfTISJ7oMftp8+UGV08= -github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= -github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= -github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= @@ -149,312 +19,30 @@ github.com/mr-tron/base58 v1.2.0 h1:T/HDJBh4ZCPbU39/+c3rRvE0uKBQlU27+QI8LJ4t64o= github.com/mr-tron/base58 v1.2.0/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= -github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= -go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= -go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opentelemetry.io/otel v1.15.1 h1:3Iwq3lfRByPaws0f6bU3naAqOR1n5IeDWd9390kWHa8= -go.opentelemetry.io/otel v1.15.1/go.mod h1:mHHGEHVDLal6YrKMmk9LqC4a3sF5g+fHfrttQIB1NTc= -go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.15.1 h1:XYDQtNzdb2T4uM1pku2m76eSMDJgqhJ+6KzkqgQBALc= -go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.15.1/go.mod h1:uOTV75+LOzV+ODmL8ahRLWkFA3eQcSC2aAsbxIu4duk= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.15.1 h1:tyoeaUh8REKay72DVYsSEBYV18+fGONe+YYPaOxgLoE= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.15.1/go.mod h1:HUSnrjQQ19KX9ECjpQxufsF+3ioD3zISPMlauTPZu2g= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.15.1 h1:pIfoG5IAZFzp9EUlJzdSkpUwpaUAAnD+Ru1nBLTACIQ= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.15.1/go.mod h1:poNKBqF5+nR/6ke2oGTDjHfksrsHDOHXAl2g4+9ONsY= -go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.15.1 h1:2PunuO5SbkN5MhCbuHCd3tC6qrcaj+uDAkX/qBU5BAs= -go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.15.1/go.mod h1:q8+Tha+5LThjeSU8BW93uUC5w5/+DnYHMKBMpRCsui0= -go.opentelemetry.io/otel/sdk v1.15.1 h1:5FKR+skgpzvhPQHIEfcwMYjCBr14LWzs3uSqKiQzETI= -go.opentelemetry.io/otel/sdk v1.15.1/go.mod h1:8rVtxQfrbmbHKfqzpQkT5EzZMcbMBwTzNAggbEAM0KA= -go.opentelemetry.io/otel/trace v1.15.1 h1:uXLo6iHJEzDfrNC0L0mNjItIp06SyaBQxu5t3xMlngY= -go.opentelemetry.io/otel/trace v1.15.1/go.mod h1:IWdQG/5N1x7f6YUlmdLeJvH9yxtuJAfc4VW5Agv9r/8= -go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= -go.opentelemetry.io/proto/otlp v0.19.0 h1:IVN6GR+mhC4s5yfcTbmzHYODqvWAp3ZedA2SJPI1Nnw= -go.opentelemetry.io/proto/otlp v0.19.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= -go.uber.org/goleak v1.2.1 h1:NBol2c7O1ZokfZ0LEU9K6Whx/KnwvepVetCUhtKja4A= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= -golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= -golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= -golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= -golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= -golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= -golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= -golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= -golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= -golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= -golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= -golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= -golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= -golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= -golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.2.0 h1:PUR+T4wwASmuSTYdKjYHI5TD22Wy5ogLU5qZCOLxBrI= golang.org/x/sync v0.2.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= -golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= -golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= -golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= -golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= -google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= -google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= -google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= -google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.19.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= -google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= -google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM= -google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc= -google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= -google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= -google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA= -google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U= -google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= -google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 h1:KpwkzHKEF7B9Zxg18WzOa7djJ+Ha5DzthMyZYQfEn2A= google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1/go.mod h1:nKE/iIaLqn2bQwXBg8f1g2Ylh6r5MN5CmZvuzZCgsCU= -google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= -google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= -google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= -google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= -google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= -google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= -google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= -google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= google.golang.org/grpc v1.55.0 h1:3Oj82/tFSCeUrRTg/5E/7d/W5A1tj6Ky1ABAuZuv5ag= google.golang.org/grpc v1.55.0/go.mod h1:iYEXKGkEBhg1PjZQvoYEVPTDkHo1/bjTnfwTeGONTY8= -google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= -google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= -google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= -google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= -google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= -google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= -honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= -rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= -rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= diff --git a/pkg/tracing/config.go b/pkg/tracing/config.go deleted file mode 100644 index 001953a..0000000 --- a/pkg/tracing/config.go +++ /dev/null @@ -1,74 +0,0 @@ -package tracing - -import "fmt" - -// Exporter is type of tracing target. -type Exporter string - -const ( - Stdout Exporter = "stdout" - OTLPgRPC Exporter = "otlp_grpc" -) - -type Config struct { - // Enabled is true, if tracing enabled. - Enabled bool - // Exporter is collector type. - Exporter Exporter - // Endpoint is collector endpoint for OTLP exporters. - Endpoint string - - // Service is service name that will be used in tracing. - // Mandatory. - Service string - // InstanceID is identity of service instance. - // Optional. - InstanceID string - // Version is version of service instance. - // Optional. - Version string -} - -func (c *Config) validate() error { - if !c.Enabled { - return nil - } - - if c.Exporter != Stdout && c.Exporter != OTLPgRPC { - return fmt.Errorf("tracing config error: unknown exporter '%s', valid values are %v", - c.Exporter, []string{string(Stdout), string(OTLPgRPC)}) - } - - if len(c.Service) == 0 { - return fmt.Errorf("tracing config error: service name must be specified") - } - - if c.Exporter == OTLPgRPC && len(c.Endpoint) == 0 { - return fmt.Errorf("tracing config error: exporter '%s' requires endpoint", c.Exporter) - } - - return nil -} - -func (c *Config) hasChange(other *Config) bool { - if !c.Enabled && !other.Enabled { - return false - } - if c.Enabled != other.Enabled { - return true - } - - if c.Exporter == Stdout && other.Exporter == Stdout { - return !c.serviceInfoEqual(other) - } - - return c.Exporter != other.Exporter || - c.Endpoint != other.Endpoint || - !c.serviceInfoEqual(other) -} - -func (c *Config) serviceInfoEqual(other *Config) bool { - return c.Service == other.Service && - c.InstanceID == other.InstanceID && - c.Version == other.Version -} diff --git a/pkg/tracing/config_test.go b/pkg/tracing/config_test.go deleted file mode 100644 index 031dd3b..0000000 --- a/pkg/tracing/config_test.go +++ /dev/null @@ -1,212 +0,0 @@ -package tracing - -import ( - "testing" -) - -func TestConfig_validate(t *testing.T) { - tests := []struct { - name string - config Config - wantErr bool - }{ - { - name: "disabled", - wantErr: false, - config: Config{ - Enabled: false, - }, - }, - { - name: "stdout", - wantErr: false, - config: Config{ - Enabled: true, - Exporter: Stdout, - Service: "test", - InstanceID: "s01", - Version: "v0.0.1", - }, - }, - { - name: "OTLP gRPC", - wantErr: false, - config: Config{ - Enabled: true, - Exporter: OTLPgRPC, - Service: "test", - Endpoint: "localhost:4717", - InstanceID: "s01", - Version: "v0.0.1", - }, - }, - { - name: "unknown exporter", - wantErr: true, - config: Config{ - Enabled: true, - Exporter: "unknown", - Service: "test", - Endpoint: "localhost:4717", - InstanceID: "s01", - Version: "v0.0.1", - }, - }, - { - name: "no exporter", - wantErr: true, - config: Config{ - Enabled: true, - Service: "test", - Endpoint: "localhost:4717", - InstanceID: "s01", - Version: "v0.0.1", - }, - }, - { - name: "no service", - wantErr: true, - config: Config{ - Enabled: true, - Exporter: OTLPgRPC, - Endpoint: "localhost:4717", - InstanceID: "s01", - Version: "v0.0.1", - }, - }, - { - name: "no endpoint for grpc", - wantErr: true, - config: Config{ - Enabled: true, - Exporter: OTLPgRPC, - Service: "test", - InstanceID: "s01", - Version: "v0.0.1", - }, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - if err := tt.config.validate(); (err != nil) != tt.wantErr { - t.Errorf("Config.validate() error = %v, wantErr %v", err, tt.wantErr) - } - }) - } -} - -func TestConfig_hasChange(t *testing.T) { - tests := []struct { - name string - config Config - other Config - want bool - }{ - { - name: "disabled configs always equal", - want: false, - config: Config{ - Enabled: false, - Exporter: Stdout, - Service: "test", - InstanceID: "s01", - Version: "v1.0.0", - }, - other: Config{ - Enabled: false, - Exporter: OTLPgRPC, - Endpoint: "localhost:4717", - Service: "test", - InstanceID: "s01", - Version: "v1.0.0", - }, - }, - { - name: "enabled", - want: true, - config: Config{ - Enabled: false, - Exporter: OTLPgRPC, - Endpoint: "localhost:4717", - Service: "test", - InstanceID: "s01", - Version: "v1.0.0", - }, - other: Config{ - Enabled: true, - Exporter: OTLPgRPC, - Endpoint: "localhost:4717", - Service: "test", - InstanceID: "s01", - Version: "v1.0.0", - }, - }, - { - name: "disabled", - want: true, - config: Config{ - Enabled: true, - Exporter: OTLPgRPC, - Endpoint: "localhost:4717", - Service: "test", - InstanceID: "s01", - Version: "v1.0.0", - }, - other: Config{ - Enabled: false, - Exporter: OTLPgRPC, - Endpoint: "localhost:4717", - Service: "test", - InstanceID: "s01", - Version: "v1.0.0", - }, - }, - { - name: "do not use endpoint for stdout", - want: false, - config: Config{ - Enabled: true, - Exporter: Stdout, - Endpoint: "localhost:4717", - Service: "test", - InstanceID: "s01", - Version: "v1.0.0", - }, - other: Config{ - Enabled: true, - Exporter: Stdout, - Endpoint: "otherhost:4717", - Service: "test", - InstanceID: "s01", - Version: "v1.0.0", - }, - }, - { - name: "use endpoint for grpc", - want: true, - config: Config{ - Enabled: true, - Exporter: OTLPgRPC, - Endpoint: "localhost:4717", - Service: "test", - InstanceID: "s01", - Version: "v1.0.0", - }, - other: Config{ - Enabled: true, - Exporter: OTLPgRPC, - Endpoint: "otherhost:4717", - Service: "test", - InstanceID: "s01", - Version: "v1.0.0", - }, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - if got := tt.config.hasChange(&tt.other); got != tt.want { - t.Errorf("Config.equal() = %v, want %v", got, tt.want) - } - }) - } -} diff --git a/pkg/tracing/grpc.go b/pkg/tracing/grpc.go deleted file mode 100644 index f0a3473..0000000 --- a/pkg/tracing/grpc.go +++ /dev/null @@ -1,135 +0,0 @@ -package tracing - -import ( - "context" - "io" - - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/codes" - semconv "go.opentelemetry.io/otel/semconv/v1.17.0" - "go.opentelemetry.io/otel/trace" - "google.golang.org/grpc" - grpc_codes "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" -) - -// NewGRPCUnaryClientInteceptor creates new gRPC unary interceptor to save gRPC client traces. -func NewGRPCUnaryClientInteceptor() grpc.UnaryClientInterceptor { - return func(ctx context.Context, method string, req, reply any, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error { - ctx, span := startClientSpan(ctx, cc, method) - defer span.End() - - err := invoker(ctx, method, req, reply, cc, opts...) - if err != nil { - grpcStatus, _ := status.FromError(err) - span.SetStatus(codes.Error, grpcStatus.Message()) - span.SetAttributes(semconv.RPCGRPCStatusCodeKey.Int64(int64(grpcStatus.Code()))) - } else { - span.SetStatus(codes.Ok, "") - span.SetAttributes(semconv.RPCGRPCStatusCodeKey.Int64(int64(grpc_codes.OK))) - } - - return err - } -} - -// NewGRPCStreamClientInterceptor creates new gRPC stream interceptor to save gRPC client traces. -func NewGRPCStreamClientInterceptor() grpc.StreamClientInterceptor { - return func(ctx context.Context, desc *grpc.StreamDesc, cc *grpc.ClientConn, method string, streamer grpc.Streamer, opts ...grpc.CallOption) (grpc.ClientStream, error) { - ctx, span := startClientSpan(ctx, cc, method) - str, err := streamer(ctx, desc, cc, method, opts...) - if err != nil { - grpcStatus, _ := status.FromError(err) - span.SetStatus(codes.Error, grpcStatus.Message()) - span.SetAttributes(semconv.RPCGRPCStatusCodeKey.Int64(int64(grpcStatus.Code()))) - span.End() - return str, err - } - - finished := make(chan error) - done := make(chan struct{}) - strWrp := newgRPCClientStream(str, desc, finished, done) - - go func() { - defer close(done) - defer span.End() - - select { - case err := <-finished: - if err == nil || err == io.EOF { - setGRPCSpanStatus(span, nil) - } else { - setGRPCSpanStatus(span, err) - } - return - case <-ctx.Done(): - setGRPCSpanStatus(span, ctx.Err()) - return - } - }() - - return strWrp, nil - } -} - -// NewGRPCUnaryServerInterceptor creates new gRPC unary interceptor to save gRPC server traces. -func NewGRPCUnaryServerInterceptor() grpc.UnaryServerInterceptor { - return func(ctx context.Context, req any, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (resp interface{}, err error) { - ctx = extractGRPCTraceInfo(ctx) - var span trace.Span - ctx, span = StartSpanFromContext(ctx, info.FullMethod, - trace.WithAttributes( - semconv.RPCSystemGRPC, - semconv.RPCMethod(info.FullMethod), - ), - trace.WithSpanKind(trace.SpanKindServer)) - defer span.End() - - resp, err = handler(ctx, req) - - setGRPCSpanStatus(span, err) - return - } -} - -// NewGRPCStreamServerInterceptor creates new gRPC stream interceptor to save gRPC server traces. -func NewGRPCStreamServerInterceptor() grpc.StreamServerInterceptor { - return func(srv any, ss grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error { - ctx := extractGRPCTraceInfo(ss.Context()) - var span trace.Span - ctx, span = StartSpanFromContext(ctx, info.FullMethod, - trace.WithAttributes( - semconv.RPCSystemGRPC, - semconv.RPCMethod(info.FullMethod), - ), - trace.WithSpanKind(trace.SpanKindServer)) - defer span.End() - - err := handler(srv, newgRPCServerStream(ctx, ss)) - - setGRPCSpanStatus(span, err) - return err - } -} - -func startClientSpan(ctx context.Context, cc *grpc.ClientConn, method string) (context.Context, trace.Span) { - ctx, span := StartSpanFromContext(ctx, method, trace.WithAttributes( - semconv.RPCSystemGRPC, - semconv.RPCMethod(method), - attribute.String("rpc.grpc.target", cc.Target())), - trace.WithSpanKind(trace.SpanKindClient), - ) - ctx = setGRPCTraceInfo(ctx) - return ctx, span -} - -func setGRPCSpanStatus(span trace.Span, err error) { - if err != nil { - grpcStatus, _ := status.FromError(err) - span.SetStatus(codes.Error, grpcStatus.Message()) - span.SetAttributes(semconv.RPCGRPCStatusCodeKey.Int64(int64(grpcStatus.Code()))) - } else { - span.SetStatus(codes.Ok, "") - span.SetAttributes(semconv.RPCGRPCStatusCodeKey.Int64(int64(grpc_codes.OK))) - } -} diff --git a/pkg/tracing/grpc_internal.go b/pkg/tracing/grpc_internal.go deleted file mode 100644 index 7c1bfab..0000000 --- a/pkg/tracing/grpc_internal.go +++ /dev/null @@ -1,159 +0,0 @@ -package tracing - -import ( - "context" - - "google.golang.org/grpc" - "google.golang.org/grpc/metadata" -) - -type grpcMetadataCarrier struct { - md *metadata.MD -} - -func (c *grpcMetadataCarrier) Get(key string) string { - values := c.md.Get(key) - if len(values) > 0 { - return values[0] - } - return "" -} - -func (c *grpcMetadataCarrier) Set(key string, value string) { - c.md.Set(key, value) -} - -func (c *grpcMetadataCarrier) Keys() []string { - result := make([]string, 0, c.md.Len()) - for key := range *c.md { - result = append(result, key) - } - return result -} - -func extractGRPCTraceInfo(ctx context.Context) context.Context { - md, ok := metadata.FromIncomingContext(ctx) - if !ok { - return ctx - } - carrier := &grpcMetadataCarrier{ - md: &md, - } - return Propagator.Extract(ctx, carrier) -} - -func setGRPCTraceInfo(ctx context.Context) context.Context { - md, ok := metadata.FromOutgoingContext(ctx) - if !ok { - md = metadata.MD{} - } - carrier := &grpcMetadataCarrier{ - md: &md, - } - Propagator.Inject(ctx, carrier) - return metadata.NewOutgoingContext(ctx, md) -} - -type clientStream struct { - originalStream grpc.ClientStream - desc *grpc.StreamDesc - finished chan<- error - done <-chan struct{} -} - -func newgRPCClientStream(originalStream grpc.ClientStream, desc *grpc.StreamDesc, finished chan<- error, done <-chan struct{}) grpc.ClientStream { - return &clientStream{ - originalStream: originalStream, - desc: desc, - finished: finished, - done: done, - } -} - -func (cs *clientStream) Header() (metadata.MD, error) { - md, err := cs.originalStream.Header() - if err != nil { - select { - case <-cs.done: - case cs.finished <- err: - } - } - return md, err -} - -func (cs *clientStream) Trailer() metadata.MD { - return cs.originalStream.Trailer() -} - -func (cs *clientStream) CloseSend() error { - err := cs.originalStream.CloseSend() - if err != nil { - select { - case <-cs.done: - case cs.finished <- err: - } - } - return err -} - -func (cs *clientStream) Context() context.Context { - return cs.originalStream.Context() -} - -func (cs *clientStream) SendMsg(m any) error { - err := cs.originalStream.SendMsg(m) - if err != nil { - select { - case <-cs.done: - case cs.finished <- err: - } - } - return err -} - -func (cs *clientStream) RecvMsg(m any) error { - err := cs.originalStream.RecvMsg(m) - if err != nil || !cs.desc.ServerStreams { - select { - case <-cs.done: - case cs.finished <- err: - } - } - return err -} - -type serverStream struct { - originalStream grpc.ServerStream - ctx context.Context // nolint:containedctx -} - -func newgRPCServerStream(ctx context.Context, originalStream grpc.ServerStream) grpc.ServerStream { - return &serverStream{ - originalStream: originalStream, - ctx: ctx, - } -} - -func (ss *serverStream) SetHeader(md metadata.MD) error { - return ss.originalStream.SendHeader(md) -} - -func (ss *serverStream) SendHeader(md metadata.MD) error { - return ss.originalStream.SendHeader(md) -} - -func (ss *serverStream) SetTrailer(md metadata.MD) { - ss.originalStream.SetTrailer(md) -} - -func (ss *serverStream) Context() context.Context { - return ss.ctx -} - -func (ss *serverStream) SendMsg(m any) error { - return ss.originalStream.SendMsg(m) -} - -func (ss *serverStream) RecvMsg(m any) error { - return ss.originalStream.RecvMsg(m) -} diff --git a/pkg/tracing/propagator.go b/pkg/tracing/propagator.go deleted file mode 100644 index 3dabfdc..0000000 --- a/pkg/tracing/propagator.go +++ /dev/null @@ -1,96 +0,0 @@ -package tracing - -import ( - "context" - "fmt" - "strconv" - - "go.opentelemetry.io/otel/propagation" - "go.opentelemetry.io/otel/trace" -) - -const ( - traceIDHeader = "x-frostfs-trace-id" - spanIDHeader = "x-frostfs-span-id" - flagsHeader = "x-frostfs-trace-flags" -) - -const ( - flagsSampled = 1 << iota -) - -// propagator serializes SpanContext to/from headers. -// x-frostfs-trace-id - TraceID, 16 bytes, hex-string (32 bytes). -// x-frostfs-span-id - SpanID, 8 bytes, hexstring (16 bytes). -// x-frostfs-trace-flags - trace flags (now sampled only). -type propagator struct{} - -// Propagator is propagation.TextMapPropagator instance, used to extract/inject trace info from/to remote context. -var Propagator propagation.TextMapPropagator = &propagator{} - -// Inject injects tracing info to carrier. -func (p *propagator) Inject(ctx context.Context, carrier propagation.TextMapCarrier) { - sc := trace.SpanFromContext(ctx).SpanContext() - if !sc.TraceID().IsValid() || !sc.SpanID().IsValid() { - return - } - - var flags int - if sc.IsSampled() { - flags = flags | flagsSampled - } - - carrier.Set(traceIDHeader, sc.TraceID().String()) - carrier.Set(spanIDHeader, sc.SpanID().String()) - carrier.Set(flagsHeader, fmt.Sprintf("%x", flags)) -} - -// Extract extracts tracing info from carrier and returns context with tracing info. -// In case of error returns ctx. -func (p *propagator) Extract(ctx context.Context, carrier propagation.TextMapCarrier) context.Context { - spanConfig := trace.SpanContextConfig{} - var err error - - traceIDStr := carrier.Get(traceIDHeader) - traceIDDefined := false - if traceIDStr != "" { - traceIDDefined = true - spanConfig.TraceID, err = trace.TraceIDFromHex(traceIDStr) - if err != nil { - return ctx - } - } - - spanIDstr := carrier.Get(spanIDHeader) - spanIDDefined := false - if spanIDstr != "" { - spanIDDefined = true - spanConfig.SpanID, err = trace.SpanIDFromHex(spanIDstr) - if err != nil { - return ctx - } - } - - if traceIDDefined != spanIDDefined { - return ctx //traceID + spanID must be defined OR no traceID and no spanID - } - - flagsStr := carrier.Get(flagsHeader) - if flagsStr != "" { - var v int64 - v, err = strconv.ParseInt(flagsStr, 16, 32) - if err != nil { - return ctx - } - if v&flagsSampled == flagsSampled { - spanConfig.TraceFlags = trace.FlagsSampled - } - } - - return trace.ContextWithRemoteSpanContext(ctx, trace.NewSpanContext(spanConfig)) -} - -// Fields returns the keys whose values are set with Inject. -func (p *propagator) Fields() []string { - return []string{traceIDHeader, spanIDHeader, flagsHeader} -} diff --git a/pkg/tracing/propagator_test.go b/pkg/tracing/propagator_test.go deleted file mode 100644 index fc81e48..0000000 --- a/pkg/tracing/propagator_test.go +++ /dev/null @@ -1,257 +0,0 @@ -package tracing - -import ( - "context" - "encoding/hex" - "math/rand" - "testing" - - "github.com/stretchr/testify/require" - "go.opentelemetry.io/otel/trace" -) - -type testCarrier struct { - Values map[string]string -} - -func (c *testCarrier) Get(key string) string { - return c.Values[key] -} - -func (c *testCarrier) Set(key string, value string) { - c.Values[key] = value -} - -func (c *testCarrier) Keys() []string { - res := make([]string, 0, len(c.Values)) - for k := range c.Values { - res = append(res, k) - } - return res -} - -var p = &propagator{} - -func TestPropagator_Inject(t *testing.T) { - t.Run("injects trace_id and span_id if valid", func(t *testing.T) { - traceIDBytes := make([]byte, 16) - rand.Read(traceIDBytes) - traceIDHex := hex.EncodeToString(traceIDBytes) - - spanIDBytes := make([]byte, 8) - rand.Read(spanIDBytes) - spanIDHex := hex.EncodeToString(spanIDBytes) - - spanConfig := trace.SpanContextConfig{} - spanConfig.TraceID, _ = trace.TraceIDFromHex(traceIDHex) - spanConfig.SpanID, _ = trace.SpanIDFromHex(spanIDHex) - spanConfig.TraceFlags = trace.FlagsSampled - - ctx := trace.ContextWithRemoteSpanContext(context.Background(), trace.NewSpanContext(spanConfig)) - c := &testCarrier{ - Values: make(map[string]string), - } - p.Inject(ctx, c) - - require.Equal(t, 3, len(c.Values), "not all headers were saved") - require.Equal(t, traceIDHex, c.Values[traceIDHeader], "unexpected trace id") - require.Equal(t, spanIDHex, c.Values[spanIDHeader], "unexpected span id") - require.Equal(t, "1", c.Values[flagsHeader], "unexpected flags") - }) - t.Run("doesn't injects if trace_id is invalid", func(t *testing.T) { - traceIDBytes := make([]byte, 16) - traceIDHex := hex.EncodeToString(traceIDBytes) - - spanIDBytes := make([]byte, 8) - rand.Read(spanIDBytes) - spanIDHex := hex.EncodeToString(spanIDBytes) - - spanConfig := trace.SpanContextConfig{} - spanConfig.TraceID, _ = trace.TraceIDFromHex(traceIDHex) - spanConfig.SpanID, _ = trace.SpanIDFromHex(spanIDHex) - spanConfig.TraceFlags = trace.FlagsSampled - - ctx := trace.ContextWithRemoteSpanContext(context.Background(), trace.NewSpanContext(spanConfig)) - c := &testCarrier{ - Values: make(map[string]string), - } - p.Inject(ctx, c) - - require.Equal(t, 0, len(c.Values), "some headers were saved") - }) - t.Run("doesn't injects if span_id is invalid", func(t *testing.T) { - traceIDBytes := make([]byte, 16) - rand.Read(traceIDBytes) - traceIDHex := hex.EncodeToString(traceIDBytes) - - spanIDBytes := make([]byte, 8) - spanIDHex := hex.EncodeToString(spanIDBytes) - - spanConfig := trace.SpanContextConfig{} - spanConfig.TraceID, _ = trace.TraceIDFromHex(traceIDHex) - spanConfig.SpanID, _ = trace.SpanIDFromHex(spanIDHex) - spanConfig.TraceFlags = trace.FlagsSampled - - ctx := trace.ContextWithRemoteSpanContext(context.Background(), trace.NewSpanContext(spanConfig)) - c := &testCarrier{ - Values: make(map[string]string), - } - p.Inject(ctx, c) - - require.Equal(t, 0, len(c.Values), "some headers were saved") - }) - t.Run("injects flags if no flags specified", func(t *testing.T) { - traceIDBytes := make([]byte, 16) - rand.Read(traceIDBytes) - traceIDHex := hex.EncodeToString(traceIDBytes) - - spanIDBytes := make([]byte, 8) - rand.Read(spanIDBytes) - spanIDHex := hex.EncodeToString(spanIDBytes) - - spanConfig := trace.SpanContextConfig{} - spanConfig.TraceID, _ = trace.TraceIDFromHex(traceIDHex) - spanConfig.SpanID, _ = trace.SpanIDFromHex(spanIDHex) - - ctx := trace.ContextWithRemoteSpanContext(context.Background(), trace.NewSpanContext(spanConfig)) - c := &testCarrier{ - Values: make(map[string]string), - } - p.Inject(ctx, c) - - require.Equal(t, 3, len(c.Values), "not all headers were saved") - require.Equal(t, traceIDHex, c.Values[traceIDHeader], "unexpected trace id") - require.Equal(t, spanIDHex, c.Values[spanIDHeader], "unexpected span id") - require.Equal(t, "0", c.Values[flagsHeader], "unexpected flags") - }) - -} - -func TestPropagator_Extract(t *testing.T) { - t.Run("extracts if set", func(t *testing.T) { - c := &testCarrier{ - Values: make(map[string]string), - } - - traceIDBytes := make([]byte, 16) - rand.Read(traceIDBytes) - traceIDHex := hex.EncodeToString(traceIDBytes) - c.Values[traceIDHeader] = traceIDHex - - spanIDBytes := make([]byte, 8) - rand.Read(spanIDBytes) - spanIDHex := hex.EncodeToString(spanIDBytes) - c.Values[spanIDHeader] = spanIDHex - - c.Values[flagsHeader] = "1" - - ctx := p.Extract(context.Background(), c) - - sc := trace.SpanFromContext(ctx).SpanContext() - require.True(t, sc.HasTraceID(), "trace_id was not set") - require.Equal(t, traceIDHex, sc.TraceID().String(), "trace_id doesn't match") - require.True(t, sc.HasSpanID(), "span_id was not set") - require.Equal(t, spanIDHex, sc.SpanID().String(), "span_id doesn't match") - require.True(t, sc.IsSampled(), "sampled was not set") - }) - t.Run("not extracts if only trace_id defined", func(t *testing.T) { - c := &testCarrier{ - Values: make(map[string]string), - } - - traceIDBytes := make([]byte, 16) - rand.Read(traceIDBytes) - traceIDHex := hex.EncodeToString(traceIDBytes) - c.Values[traceIDHeader] = traceIDHex - c.Values[flagsHeader] = "1" - - ctx := p.Extract(context.Background(), c) - - sc := trace.SpanFromContext(ctx).SpanContext() - require.False(t, sc.HasTraceID(), "trace_id was set") - require.False(t, sc.HasSpanID(), "span_id was set") - require.False(t, sc.IsSampled(), "sampled was set") - }) - t.Run("not extracts if only span_id defined", func(t *testing.T) { - c := &testCarrier{ - Values: make(map[string]string), - } - - spanIDBytes := make([]byte, 8) - rand.Read(spanIDBytes) - spanIDHex := hex.EncodeToString(spanIDBytes) - c.Values[spanIDHeader] = spanIDHex - c.Values[flagsHeader] = "1" - - ctx := p.Extract(context.Background(), c) - - sc := trace.SpanFromContext(ctx).SpanContext() - require.False(t, sc.HasTraceID(), "trace_id was set") - require.False(t, sc.HasSpanID(), "span_id was set") - require.False(t, sc.IsSampled(), "sampled was set") - }) - t.Run("not extracts if trace_id is in invalid", func(t *testing.T) { - c := &testCarrier{ - Values: make(map[string]string), - } - - c.Values[traceIDHeader] = "loren ipsum" - - spanIDBytes := make([]byte, 8) - rand.Read(spanIDBytes) - spanIDHex := hex.EncodeToString(spanIDBytes) - c.Values[spanIDHeader] = spanIDHex - c.Values[flagsHeader] = "1" - - ctx := p.Extract(context.Background(), c) - - sc := trace.SpanFromContext(ctx).SpanContext() - require.False(t, sc.HasTraceID(), "trace_id was set") - require.False(t, sc.HasSpanID(), "span_id was set") - require.False(t, sc.IsSampled(), "sampled was set") - }) - t.Run("not extracts if span_id is invalid", func(t *testing.T) { - c := &testCarrier{ - Values: make(map[string]string), - } - - c.Values[spanIDHeader] = "loren ipsum" - - traceIDBytes := make([]byte, 16) - rand.Read(traceIDBytes) - traceIDHex := hex.EncodeToString(traceIDBytes) - c.Values[traceIDHeader] = traceIDHex - c.Values[flagsHeader] = "1" - - ctx := p.Extract(context.Background(), c) - - sc := trace.SpanFromContext(ctx).SpanContext() - require.False(t, sc.HasTraceID(), "trace_id was set") - require.False(t, sc.HasSpanID(), "span_id was set") - require.False(t, sc.IsSampled(), "sampled was set") - }) - t.Run("not extracts if flags is invalid", func(t *testing.T) { - c := &testCarrier{ - Values: make(map[string]string), - } - - traceIDBytes := make([]byte, 16) - rand.Read(traceIDBytes) - traceIDHex := hex.EncodeToString(traceIDBytes) - c.Values[traceIDHeader] = traceIDHex - - spanIDBytes := make([]byte, 8) - rand.Read(spanIDBytes) - spanIDHex := hex.EncodeToString(spanIDBytes) - c.Values[spanIDHeader] = spanIDHex - - c.Values[flagsHeader] = "loren ipsum" - - ctx := p.Extract(context.Background(), c) - - sc := trace.SpanFromContext(ctx).SpanContext() - require.False(t, sc.HasTraceID(), "trace_id was set") - require.False(t, sc.HasSpanID(), "span_id was set") - require.False(t, sc.IsSampled(), "sampled was set") - }) -} diff --git a/pkg/tracing/setup.go b/pkg/tracing/setup.go deleted file mode 100644 index 067dfda..0000000 --- a/pkg/tracing/setup.go +++ /dev/null @@ -1,156 +0,0 @@ -package tracing - -import ( - "context" - "fmt" - "sync" - "sync/atomic" - - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc" - "go.opentelemetry.io/otel/exporters/stdout/stdouttrace" - "go.opentelemetry.io/otel/sdk/resource" - sdktrace "go.opentelemetry.io/otel/sdk/trace" - semconv "go.opentelemetry.io/otel/semconv/v1.17.0" - "go.opentelemetry.io/otel/trace" -) - -var ( - // tracingLock protects provider, done, config and tracer from concurrent update. - // These fields change when the config is updated or the application is shutdown. - tracingLock = &sync.Mutex{} - - provider *sdktrace.TracerProvider - done bool - - config = Config{} - tracer = getDefaultTracer() -) - -// Setup initializes global tracer. -// Returns true if global tracer was updated. -// Shutdown method must be called for graceful shutdown. -func Setup(ctx context.Context, cfg Config) (bool, error) { - if err := cfg.validate(); err != nil { - return false, err - } - - tracingLock.Lock() - defer tracingLock.Unlock() - - if done { - return false, fmt.Errorf("failed to setup tracing: already shutdown") - } - - if !config.hasChange(&cfg) { - return false, nil - } - - if !cfg.Enabled { - config = cfg - tracer.Store(&tracerHolder{Tracer: trace.NewNoopTracerProvider().Tracer("")}) - return true, flushAndShutdown(ctx) - } - - exp, err := getExporter(ctx, &cfg) - if err != nil { - return false, err - } - - prevProvider := provider - - provider = sdktrace.NewTracerProvider( - sdktrace.WithBatcher(exp), - sdktrace.WithResource(newResource(&cfg)), - ) - - config = cfg - tracer.Store(&tracerHolder{Tracer: provider.Tracer(cfg.Service)}) - - var retErr error - if prevProvider != nil { - retErr = prevProvider.ForceFlush(ctx) - if err := prevProvider.Shutdown(ctx); err != nil { - if retErr == nil { - retErr = err - } else { - retErr = fmt.Errorf("%v ; %v", retErr, err) - } - } - } - - return true, retErr -} - -// Shutdown shutdowns tracing. -func Shutdown(ctx context.Context) error { - tracingLock.Lock() - defer tracingLock.Unlock() - - if done { - return nil - } - - done = true - - config = Config{} - tracer.Store(&tracerHolder{Tracer: trace.NewNoopTracerProvider().Tracer("")}) - - return flushAndShutdown(ctx) -} - -func getDefaultTracer() *atomic.Pointer[tracerHolder] { - v := new(atomic.Pointer[tracerHolder]) - v.Store(&tracerHolder{Tracer: trace.NewNoopTracerProvider().Tracer("")}) - return v -} - -func flushAndShutdown(ctx context.Context) error { - if provider == nil { - return nil - } - - tmp := provider - provider = nil - var retErr error - retErr = tmp.ForceFlush(ctx) - if err := tmp.Shutdown(ctx); err != nil { - if retErr == nil { - retErr = err - } else { - retErr = fmt.Errorf("%v ; %v", retErr, err) - } - } - return retErr -} - -func getExporter(ctx context.Context, cfg *Config) (sdktrace.SpanExporter, error) { - switch cfg.Exporter { - default: - return nil, fmt.Errorf("failed to setup tracing: unknown tracing exporter (%s)", cfg.Exporter) - case Stdout: - return stdouttrace.New() - case OTLPgRPC: - return otlptracegrpc.New(ctx, otlptracegrpc.WithEndpoint(cfg.Endpoint), otlptracegrpc.WithInsecure()) - } -} - -func newResource(cfg *Config) *resource.Resource { - attrs := []attribute.KeyValue{ - semconv.ServiceName(cfg.Service), - } - if len(cfg.Version) > 0 { - attrs = append(attrs, semconv.ServiceVersion(cfg.Version)) - } - if len(cfg.InstanceID) > 0 { - attrs = append(attrs, semconv.ServiceInstanceID(cfg.InstanceID)) - } - return resource.NewWithAttributes( - semconv.SchemaURL, - attrs..., - ) -} - -type tracerHolder struct { - Tracer trace.Tracer -} diff --git a/pkg/tracing/span.go b/pkg/tracing/span.go deleted file mode 100644 index 1071f47..0000000 --- a/pkg/tracing/span.go +++ /dev/null @@ -1,12 +0,0 @@ -package tracing - -import ( - "context" - - "go.opentelemetry.io/otel/trace" -) - -// StartSpanFromContext creates a span and a context.Context containing the newly-created span. -func StartSpanFromContext(ctx context.Context, operationName string, opts ...trace.SpanStartOption) (context.Context, trace.Span) { - return tracer.Load().Tracer.Start(ctx, operationName, opts...) -} diff --git a/rpc/client/client.go b/rpc/client/client.go index 4d12849..7e914db 100644 --- a/rpc/client/client.go +++ b/rpc/client/client.go @@ -1,7 +1,6 @@ package client import ( - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/pkg/tracing" "google.golang.org/grpc" "google.golang.org/grpc/credentials" ) @@ -25,14 +24,5 @@ func New(opts ...Option) *Client { c.grpcDialOpts = append(c.grpcDialOpts, grpc.WithTransportCredentials(credentials.NewTLS(c.tlsCfg))) } - c.grpcDialOpts = append(c.grpcDialOpts, - grpc.WithChainUnaryInterceptor( - tracing.NewGRPCUnaryClientInteceptor(), - ), - grpc.WithChainStreamInterceptor( - tracing.NewGRPCStreamClientInterceptor(), - ), - ) - return &c } From 68021b910acb53d6dad9779153a18aff352078ac Mon Sep 17 00:00:00 2001 From: Dmitrii Stepanov Date: Fri, 2 Jun 2023 17:25:15 +0300 Subject: [PATCH 1075/1196] [#38] signature: Increase pool max object size According to the results of profiling, objects with a size of 72KB are mainly allocated. Signed-off-by: Dmitrii Stepanov --- util/signature/buffer.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/signature/buffer.go b/util/signature/buffer.go index c2fa855..f9b003d 100644 --- a/util/signature/buffer.go +++ b/util/signature/buffer.go @@ -2,7 +2,7 @@ package signature import "sync" -const poolSliceMaxSize = 64 * 1024 +const poolSliceMaxSize = 128 * 1024 type buffer struct { data []byte From e9d67aa1b27496e7e17434e48477937b33b59c53 Mon Sep 17 00:00:00 2001 From: Airat Arifullin Date: Wed, 14 Jun 2023 14:21:58 +0300 Subject: [PATCH 1076/1196] [#31] netmap: Add unique field marshaling for PlacementPolicy Signed-off-by: Airat Arifullin a.arifullin@yadro.com --- netmap/marshal.go | 5 +++++ netmap/types.go | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/netmap/marshal.go b/netmap/marshal.go index f707665..51de050 100644 --- a/netmap/marshal.go +++ b/netmap/marshal.go @@ -26,6 +26,7 @@ const ( backupPolicyField = 2 selectorsPolicyField = 3 filtersPolicyField = 4 + uniquePolicyField = 5 keyAttributeField = 1 valueAttributeField = 2 @@ -166,6 +167,8 @@ func (p *PlacementPolicy) StableMarshal(buf []byte) []byte { offset += protoutil.NestedStructureMarshal(filtersPolicyField, buf[offset:], &p.filters[i]) } + offset += protoutil.BoolMarshal(uniquePolicyField, buf[offset:], p.unique) + return buf } @@ -184,6 +187,8 @@ func (p *PlacementPolicy) StableSize() (size int) { size += protoutil.NestedStructureSize(filtersPolicyField, &p.filters[i]) } + size += protoutil.BoolSize(uniquePolicyField, p.unique) + return size } diff --git a/netmap/types.go b/netmap/types.go index aece7cf..bda9ec6 100644 --- a/netmap/types.go +++ b/netmap/types.go @@ -55,11 +55,11 @@ type Replica struct { type Operation uint32 type PlacementPolicy struct { - unique bool replicas []Replica backupFactor uint32 selectors []Selector filters []Filter + unique bool } // Attribute of storage node. From 29b2078245a59984b44db29055ee145b319c2e5b Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Thu, 29 Jun 2023 11:05:41 +0300 Subject: [PATCH 1077/1196] [#44] .forgejo: Add build/test workflows Signed-off-by: Evgenii Stratonikov --- .forgejo/workflows/tests.yml | 54 ++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 .forgejo/workflows/tests.yml diff --git a/.forgejo/workflows/tests.yml b/.forgejo/workflows/tests.yml new file mode 100644 index 0000000..2d44d34 --- /dev/null +++ b/.forgejo/workflows/tests.yml @@ -0,0 +1,54 @@ +name: Tests and linters +on: [pull_request] + +jobs: + lint: + name: Lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Set up Go + uses: actions/setup-go@v3 + with: + go-version: '1.20' + cache: true + + - name: golangci-lint + uses: https://github.com/golangci/golangci-lint-action@v3 + with: + version: latest + + tests: + name: Tests + runs-on: ubuntu-latest + strategy: + matrix: + go_versions: [ '1.19', '1.20' ] + fail-fast: false + steps: + - uses: actions/checkout@v3 + + - name: Set up Go + uses: actions/setup-go@v3 + with: + go-version: '${{ matrix.go_versions }}' + cache: true + + - name: Run tests + run: make test + + tests-race: + name: Tests with -race + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Set up Go + uses: actions/setup-go@v3 + with: + go-version: '1.20' + cache: true + + - name: Run tests + run: go test ./... -count=1 -race From 3add88d4356bcebc8e77cb23b040cb3f6bf9e76f Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Thu, 29 Jun 2023 11:26:49 +0300 Subject: [PATCH 1078/1196] [#44] netmap: Fix ineffassign linter warning Signed-off-by: Evgenii Stratonikov --- netmap/marshal.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/netmap/marshal.go b/netmap/marshal.go index 51de050..bf559ce 100644 --- a/netmap/marshal.go +++ b/netmap/marshal.go @@ -167,7 +167,7 @@ func (p *PlacementPolicy) StableMarshal(buf []byte) []byte { offset += protoutil.NestedStructureMarshal(filtersPolicyField, buf[offset:], &p.filters[i]) } - offset += protoutil.BoolMarshal(uniquePolicyField, buf[offset:], p.unique) + protoutil.BoolMarshal(uniquePolicyField, buf[offset:], p.unique) return buf } From b17995a238b4a8bfcf6cbc279a05d6ade53c38ca Mon Sep 17 00:00:00 2001 From: Dmitrii Stepanov Date: Fri, 30 Jun 2023 13:25:01 +0300 Subject: [PATCH 1079/1196] [#45] api-go: Add Object.PutSingle implementation Signed-off-by: Dmitrii Stepanov --- object/grpc/service.pb.go | 783 ++++++++++++++++++++++++--------- object/grpc/service_grpc.pb.go | 103 +++++ object/grpc/types.pb.go | 2 +- object/types.go | 45 ++ 4 files changed, 713 insertions(+), 220 deletions(-) diff --git a/object/grpc/service.pb.go b/object/grpc/service.pb.go index ddda473..c6ffb20 100644 --- a/object/grpc/service.pb.go +++ b/object/grpc/service.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 +// protoc-gen-go v1.30.0 // protoc v3.21.9 // source: object/grpc/service.proto @@ -1125,6 +1125,146 @@ func (x *GetRangeHashResponse) GetVerifyHeader() *grpc.ResponseVerificationHeade return nil } +// Object PUT Single request +type PutSingleRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Body of put single object request message. + Body *PutSingleRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" 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,proto3" json:"verify_header,omitempty"` +} + +func (x *PutSingleRequest) Reset() { + *x = PutSingleRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_object_grpc_service_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PutSingleRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PutSingleRequest) ProtoMessage() {} + +func (x *PutSingleRequest) ProtoReflect() protoreflect.Message { + mi := &file_object_grpc_service_proto_msgTypes[16] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PutSingleRequest.ProtoReflect.Descriptor instead. +func (*PutSingleRequest) Descriptor() ([]byte, []int) { + return file_object_grpc_service_proto_rawDescGZIP(), []int{16} +} + +func (x *PutSingleRequest) GetBody() *PutSingleRequest_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *PutSingleRequest) GetMetaHeader() *grpc.RequestMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} + +func (x *PutSingleRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} + +// Object PUT Single response +type PutSingleResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Body of put single object response message. + Body *PutSingleResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" 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,proto3" json:"verify_header,omitempty"` +} + +func (x *PutSingleResponse) Reset() { + *x = PutSingleResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_object_grpc_service_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PutSingleResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PutSingleResponse) ProtoMessage() {} + +func (x *PutSingleResponse) ProtoReflect() protoreflect.Message { + mi := &file_object_grpc_service_proto_msgTypes[17] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PutSingleResponse.ProtoReflect.Descriptor instead. +func (*PutSingleResponse) Descriptor() ([]byte, []int) { + return file_object_grpc_service_proto_rawDescGZIP(), []int{17} +} + +func (x *PutSingleResponse) GetBody() *PutSingleResponse_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *PutSingleResponse) GetMetaHeader() *grpc.ResponseMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} + +func (x *PutSingleResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} + // GET Object request body type GetRequest_Body struct { state protoimpl.MessageState @@ -1141,7 +1281,7 @@ type GetRequest_Body struct { func (x *GetRequest_Body) Reset() { *x = GetRequest_Body{} if protoimpl.UnsafeEnabled { - mi := &file_object_grpc_service_proto_msgTypes[16] + mi := &file_object_grpc_service_proto_msgTypes[18] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1154,7 +1294,7 @@ func (x *GetRequest_Body) String() string { func (*GetRequest_Body) ProtoMessage() {} func (x *GetRequest_Body) ProtoReflect() protoreflect.Message { - mi := &file_object_grpc_service_proto_msgTypes[16] + mi := &file_object_grpc_service_proto_msgTypes[18] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1203,7 +1343,7 @@ type GetResponse_Body struct { func (x *GetResponse_Body) Reset() { *x = GetResponse_Body{} if protoimpl.UnsafeEnabled { - mi := &file_object_grpc_service_proto_msgTypes[17] + mi := &file_object_grpc_service_proto_msgTypes[19] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1216,7 +1356,7 @@ func (x *GetResponse_Body) String() string { func (*GetResponse_Body) ProtoMessage() {} func (x *GetResponse_Body) ProtoReflect() protoreflect.Message { - mi := &file_object_grpc_service_proto_msgTypes[17] + mi := &file_object_grpc_service_proto_msgTypes[19] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1303,7 +1443,7 @@ type GetResponse_Body_Init struct { func (x *GetResponse_Body_Init) Reset() { *x = GetResponse_Body_Init{} if protoimpl.UnsafeEnabled { - mi := &file_object_grpc_service_proto_msgTypes[18] + mi := &file_object_grpc_service_proto_msgTypes[20] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1316,7 +1456,7 @@ func (x *GetResponse_Body_Init) String() string { func (*GetResponse_Body_Init) ProtoMessage() {} func (x *GetResponse_Body_Init) ProtoReflect() protoreflect.Message { - mi := &file_object_grpc_service_proto_msgTypes[18] + mi := &file_object_grpc_service_proto_msgTypes[20] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1371,7 +1511,7 @@ type PutRequest_Body struct { func (x *PutRequest_Body) Reset() { *x = PutRequest_Body{} if protoimpl.UnsafeEnabled { - mi := &file_object_grpc_service_proto_msgTypes[19] + mi := &file_object_grpc_service_proto_msgTypes[21] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1384,7 +1524,7 @@ func (x *PutRequest_Body) String() string { func (*PutRequest_Body) ProtoMessage() {} func (x *PutRequest_Body) ProtoReflect() protoreflect.Message { - mi := &file_object_grpc_service_proto_msgTypes[19] + mi := &file_object_grpc_service_proto_msgTypes[21] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1468,7 +1608,7 @@ type PutRequest_Body_Init struct { func (x *PutRequest_Body_Init) Reset() { *x = PutRequest_Body_Init{} if protoimpl.UnsafeEnabled { - mi := &file_object_grpc_service_proto_msgTypes[20] + mi := &file_object_grpc_service_proto_msgTypes[22] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1481,7 +1621,7 @@ func (x *PutRequest_Body_Init) String() string { func (*PutRequest_Body_Init) ProtoMessage() {} func (x *PutRequest_Body_Init) ProtoReflect() protoreflect.Message { - mi := &file_object_grpc_service_proto_msgTypes[20] + mi := &file_object_grpc_service_proto_msgTypes[22] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1538,7 +1678,7 @@ type PutResponse_Body struct { func (x *PutResponse_Body) Reset() { *x = PutResponse_Body{} if protoimpl.UnsafeEnabled { - mi := &file_object_grpc_service_proto_msgTypes[21] + mi := &file_object_grpc_service_proto_msgTypes[23] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1551,7 +1691,7 @@ func (x *PutResponse_Body) String() string { func (*PutResponse_Body) ProtoMessage() {} func (x *PutResponse_Body) ProtoReflect() protoreflect.Message { - mi := &file_object_grpc_service_proto_msgTypes[21] + mi := &file_object_grpc_service_proto_msgTypes[23] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1587,7 +1727,7 @@ type DeleteRequest_Body struct { func (x *DeleteRequest_Body) Reset() { *x = DeleteRequest_Body{} if protoimpl.UnsafeEnabled { - mi := &file_object_grpc_service_proto_msgTypes[22] + mi := &file_object_grpc_service_proto_msgTypes[24] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1600,7 +1740,7 @@ func (x *DeleteRequest_Body) String() string { func (*DeleteRequest_Body) ProtoMessage() {} func (x *DeleteRequest_Body) ProtoReflect() protoreflect.Message { - mi := &file_object_grpc_service_proto_msgTypes[22] + mi := &file_object_grpc_service_proto_msgTypes[24] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1636,7 +1776,7 @@ type DeleteResponse_Body struct { func (x *DeleteResponse_Body) Reset() { *x = DeleteResponse_Body{} if protoimpl.UnsafeEnabled { - mi := &file_object_grpc_service_proto_msgTypes[23] + mi := &file_object_grpc_service_proto_msgTypes[25] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1649,7 +1789,7 @@ func (x *DeleteResponse_Body) String() string { func (*DeleteResponse_Body) ProtoMessage() {} func (x *DeleteResponse_Body) ProtoReflect() protoreflect.Message { - mi := &file_object_grpc_service_proto_msgTypes[23] + mi := &file_object_grpc_service_proto_msgTypes[25] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1690,7 +1830,7 @@ type HeadRequest_Body struct { func (x *HeadRequest_Body) Reset() { *x = HeadRequest_Body{} if protoimpl.UnsafeEnabled { - mi := &file_object_grpc_service_proto_msgTypes[24] + mi := &file_object_grpc_service_proto_msgTypes[26] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1703,7 +1843,7 @@ func (x *HeadRequest_Body) String() string { func (*HeadRequest_Body) ProtoMessage() {} func (x *HeadRequest_Body) ProtoReflect() protoreflect.Message { - mi := &file_object_grpc_service_proto_msgTypes[24] + mi := &file_object_grpc_service_proto_msgTypes[26] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1760,7 +1900,7 @@ type HeadResponse_Body struct { func (x *HeadResponse_Body) Reset() { *x = HeadResponse_Body{} if protoimpl.UnsafeEnabled { - mi := &file_object_grpc_service_proto_msgTypes[25] + mi := &file_object_grpc_service_proto_msgTypes[27] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1773,7 +1913,7 @@ func (x *HeadResponse_Body) String() string { func (*HeadResponse_Body) ProtoMessage() {} func (x *HeadResponse_Body) ProtoReflect() protoreflect.Message { - mi := &file_object_grpc_service_proto_msgTypes[25] + mi := &file_object_grpc_service_proto_msgTypes[27] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1859,7 +1999,7 @@ type SearchRequest_Body struct { func (x *SearchRequest_Body) Reset() { *x = SearchRequest_Body{} if protoimpl.UnsafeEnabled { - mi := &file_object_grpc_service_proto_msgTypes[26] + mi := &file_object_grpc_service_proto_msgTypes[28] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1872,7 +2012,7 @@ func (x *SearchRequest_Body) String() string { func (*SearchRequest_Body) ProtoMessage() {} func (x *SearchRequest_Body) ProtoReflect() protoreflect.Message { - mi := &file_object_grpc_service_proto_msgTypes[26] + mi := &file_object_grpc_service_proto_msgTypes[28] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1979,7 +2119,7 @@ type SearchRequest_Body_Filter struct { func (x *SearchRequest_Body_Filter) Reset() { *x = SearchRequest_Body_Filter{} if protoimpl.UnsafeEnabled { - mi := &file_object_grpc_service_proto_msgTypes[27] + mi := &file_object_grpc_service_proto_msgTypes[29] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1992,7 +2132,7 @@ func (x *SearchRequest_Body_Filter) String() string { func (*SearchRequest_Body_Filter) ProtoMessage() {} func (x *SearchRequest_Body_Filter) ProtoReflect() protoreflect.Message { - mi := &file_object_grpc_service_proto_msgTypes[27] + mi := &file_object_grpc_service_proto_msgTypes[29] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2042,7 +2182,7 @@ type SearchResponse_Body struct { func (x *SearchResponse_Body) Reset() { *x = SearchResponse_Body{} if protoimpl.UnsafeEnabled { - mi := &file_object_grpc_service_proto_msgTypes[28] + mi := &file_object_grpc_service_proto_msgTypes[30] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2055,7 +2195,7 @@ func (x *SearchResponse_Body) String() string { func (*SearchResponse_Body) ProtoMessage() {} func (x *SearchResponse_Body) ProtoReflect() protoreflect.Message { - mi := &file_object_grpc_service_proto_msgTypes[28] + mi := &file_object_grpc_service_proto_msgTypes[30] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2096,7 +2236,7 @@ type GetRangeRequest_Body struct { func (x *GetRangeRequest_Body) Reset() { *x = GetRangeRequest_Body{} if protoimpl.UnsafeEnabled { - mi := &file_object_grpc_service_proto_msgTypes[29] + mi := &file_object_grpc_service_proto_msgTypes[31] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2109,7 +2249,7 @@ func (x *GetRangeRequest_Body) String() string { func (*GetRangeRequest_Body) ProtoMessage() {} func (x *GetRangeRequest_Body) ProtoReflect() protoreflect.Message { - mi := &file_object_grpc_service_proto_msgTypes[29] + mi := &file_object_grpc_service_proto_msgTypes[31] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2167,7 +2307,7 @@ type GetRangeResponse_Body struct { func (x *GetRangeResponse_Body) Reset() { *x = GetRangeResponse_Body{} if protoimpl.UnsafeEnabled { - mi := &file_object_grpc_service_proto_msgTypes[30] + mi := &file_object_grpc_service_proto_msgTypes[32] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2180,7 +2320,7 @@ func (x *GetRangeResponse_Body) String() string { func (*GetRangeResponse_Body) ProtoMessage() {} func (x *GetRangeResponse_Body) ProtoReflect() protoreflect.Message { - mi := &file_object_grpc_service_proto_msgTypes[30] + mi := &file_object_grpc_service_proto_msgTypes[32] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2254,7 +2394,7 @@ type GetRangeHashRequest_Body struct { func (x *GetRangeHashRequest_Body) Reset() { *x = GetRangeHashRequest_Body{} if protoimpl.UnsafeEnabled { - mi := &file_object_grpc_service_proto_msgTypes[31] + mi := &file_object_grpc_service_proto_msgTypes[33] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2267,7 +2407,7 @@ func (x *GetRangeHashRequest_Body) String() string { func (*GetRangeHashRequest_Body) ProtoMessage() {} func (x *GetRangeHashRequest_Body) ProtoReflect() protoreflect.Message { - mi := &file_object_grpc_service_proto_msgTypes[31] + mi := &file_object_grpc_service_proto_msgTypes[33] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2326,7 +2466,7 @@ type GetRangeHashResponse_Body struct { func (x *GetRangeHashResponse_Body) Reset() { *x = GetRangeHashResponse_Body{} if protoimpl.UnsafeEnabled { - mi := &file_object_grpc_service_proto_msgTypes[32] + mi := &file_object_grpc_service_proto_msgTypes[34] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2339,7 +2479,7 @@ func (x *GetRangeHashResponse_Body) String() string { func (*GetRangeHashResponse_Body) ProtoMessage() {} func (x *GetRangeHashResponse_Body) ProtoReflect() protoreflect.Message { - mi := &file_object_grpc_service_proto_msgTypes[32] + mi := &file_object_grpc_service_proto_msgTypes[34] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2369,6 +2509,108 @@ func (x *GetRangeHashResponse_Body) GetHashList() [][]byte { return nil } +// PUT Single request body +type PutSingleRequest_Body struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Prepared object with payload. + Object *Object `protobuf:"bytes,1,opt,name=object,proto3" json:"object,omitempty"` + // Number of copies of the object to store within the RPC call. By default, + // object is processed according to the container's placement policy. + // Every number is treated as a minimal number of + // nodes in a corresponding placement vector that must store an object + // to complete the request successfully. The length MUST equal the placement + // vectors number, otherwise request is considered malformed. + CopiesNumber []uint32 `protobuf:"varint,2,rep,packed,name=copies_number,json=copiesNumber,proto3" json:"copies_number,omitempty"` +} + +func (x *PutSingleRequest_Body) Reset() { + *x = PutSingleRequest_Body{} + if protoimpl.UnsafeEnabled { + mi := &file_object_grpc_service_proto_msgTypes[35] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PutSingleRequest_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PutSingleRequest_Body) ProtoMessage() {} + +func (x *PutSingleRequest_Body) ProtoReflect() protoreflect.Message { + mi := &file_object_grpc_service_proto_msgTypes[35] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PutSingleRequest_Body.ProtoReflect.Descriptor instead. +func (*PutSingleRequest_Body) Descriptor() ([]byte, []int) { + return file_object_grpc_service_proto_rawDescGZIP(), []int{16, 0} +} + +func (x *PutSingleRequest_Body) GetObject() *Object { + if x != nil { + return x.Object + } + return nil +} + +func (x *PutSingleRequest_Body) GetCopiesNumber() []uint32 { + if x != nil { + return x.CopiesNumber + } + return nil +} + +// PUT Single Object response body +type PutSingleResponse_Body struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *PutSingleResponse_Body) Reset() { + *x = PutSingleResponse_Body{} + if protoimpl.UnsafeEnabled { + mi := &file_object_grpc_service_proto_msgTypes[36] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PutSingleResponse_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PutSingleResponse_Body) ProtoMessage() {} + +func (x *PutSingleResponse_Body) ProtoReflect() protoreflect.Message { + mi := &file_object_grpc_service_proto_msgTypes[36] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PutSingleResponse_Body.ProtoReflect.Descriptor instead. +func (*PutSingleResponse_Body) Descriptor() ([]byte, []int) { + return file_object_grpc_service_proto_rawDescGZIP(), []int{17, 0} +} + var File_object_grpc_service_proto protoreflect.FileDescriptor var file_object_grpc_service_proto_rawDesc = []byte{ @@ -2724,49 +2966,90 @@ var file_object_grpc_service_proto_rawDesc = []byte{ 0x66, 0x73, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x68, 0x61, 0x73, 0x68, 0x5f, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x08, 0x68, 0x61, 0x73, 0x68, 0x4c, 0x69, - 0x73, 0x74, 0x32, 0xb2, 0x04, 0x0a, 0x0d, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x53, 0x65, 0x72, - 0x76, 0x69, 0x63, 0x65, 0x12, 0x44, 0x0a, 0x03, 0x47, 0x65, 0x74, 0x12, 0x1c, 0x2e, 0x6e, 0x65, - 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, - 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, - 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x30, 0x01, 0x12, 0x44, 0x0a, 0x03, 0x50, 0x75, - 0x74, 0x12, 0x1c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, - 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x50, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x1d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, - 0x63, 0x74, 0x2e, 0x50, 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x28, 0x01, - 0x12, 0x4b, 0x0a, 0x06, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x12, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, - 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x44, 0x65, - 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x6e, 0x65, - 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x44, - 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x45, 0x0a, - 0x04, 0x48, 0x65, 0x61, 0x64, 0x12, 0x1d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, - 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, - 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4d, 0x0a, 0x06, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x12, 0x1f, + 0x73, 0x74, 0x22, 0xc8, 0x02, 0x0a, 0x10, 0x50, 0x75, 0x74, 0x53, 0x69, 0x6e, 0x67, 0x6c, 0x65, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x3b, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x50, 0x75, 0x74, 0x53, 0x69, 0x6e, 0x67, + 0x6c, 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, 0x5d, + 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x30, 0x0a, 0x06, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, + 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, + 0x52, 0x06, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x23, 0x0a, 0x0d, 0x63, 0x6f, 0x70, 0x69, + 0x65, 0x73, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0d, 0x52, + 0x0c, 0x63, 0x6f, 0x70, 0x69, 0x65, 0x73, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x22, 0xf5, 0x01, + 0x0a, 0x11, 0x50, 0x75, 0x74, 0x53, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x3c, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x28, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, + 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x50, 0x75, 0x74, 0x53, 0x69, 0x6e, 0x67, 0x6c, 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, 0x06, 0x0a, + 0x04, 0x42, 0x6f, 0x64, 0x79, 0x32, 0x88, 0x05, 0x0a, 0x0d, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, + 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x44, 0x0a, 0x03, 0x47, 0x65, 0x74, 0x12, 0x1c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, - 0x74, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, - 0x63, 0x74, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x30, 0x01, 0x12, 0x53, 0x0a, 0x08, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, - 0x21, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, - 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x22, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, + 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, + 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x30, 0x01, 0x12, 0x44, 0x0a, + 0x03, 0x50, 0x75, 0x74, 0x12, 0x1c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x50, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, + 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x50, 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x28, 0x01, 0x12, 0x4b, 0x0a, 0x06, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x12, 0x1f, 0x2e, + 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, + 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, + 0x74, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x45, 0x0a, 0x04, 0x48, 0x65, 0x61, 0x64, 0x12, 0x1d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, + 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4d, 0x0a, 0x06, 0x53, 0x65, 0x61, 0x72, 0x63, + 0x68, 0x12, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, + 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, + 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x30, 0x01, 0x12, 0x53, 0x0a, 0x08, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, + 0x67, 0x65, 0x12, 0x21, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x30, 0x01, 0x12, 0x5d, 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x52, - 0x61, 0x6e, 0x67, 0x65, 0x48, 0x61, 0x73, 0x68, 0x12, 0x25, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, - 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, - 0x61, 0x6e, 0x67, 0x65, 0x48, 0x61, 0x73, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x26, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, - 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x48, 0x61, 0x73, 0x68, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x61, 0x5a, 0x42, 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, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x6f, 0x62, 0x6a, 0x65, 0x63, - 0x74, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0xaa, 0x02, 0x1a, - 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, - 0x41, 0x50, 0x49, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x33, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x22, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, + 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x30, 0x01, 0x12, 0x5d, 0x0a, 0x0c, 0x47, + 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x48, 0x61, 0x73, 0x68, 0x12, 0x25, 0x2e, 0x6e, 0x65, + 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, + 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x48, 0x61, 0x73, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x26, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, + 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x48, 0x61, + 0x73, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x54, 0x0a, 0x09, 0x50, 0x75, + 0x74, 0x53, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x12, 0x22, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, + 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x50, 0x75, 0x74, 0x53, 0x69, + 0x6e, 0x67, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x6e, 0x65, + 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x50, + 0x75, 0x74, 0x53, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x42, 0x61, 0x5a, 0x42, 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, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, + 0x2f, 0x76, 0x32, 0x2f, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, + 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0xaa, 0x02, 0x1a, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, + 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x4f, 0x62, 0x6a, + 0x65, 0x63, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -2781,7 +3064,7 @@ func file_object_grpc_service_proto_rawDescGZIP() []byte { return file_object_grpc_service_proto_rawDescData } -var file_object_grpc_service_proto_msgTypes = make([]protoimpl.MessageInfo, 33) +var file_object_grpc_service_proto_msgTypes = make([]protoimpl.MessageInfo, 37) var file_object_grpc_service_proto_goTypes = []interface{}{ (*GetRequest)(nil), // 0: neo.fs.v2.object.GetRequest (*GetResponse)(nil), // 1: neo.fs.v2.object.GetResponse @@ -2799,129 +3082,143 @@ var file_object_grpc_service_proto_goTypes = []interface{}{ (*GetRangeResponse)(nil), // 13: neo.fs.v2.object.GetRangeResponse (*GetRangeHashRequest)(nil), // 14: neo.fs.v2.object.GetRangeHashRequest (*GetRangeHashResponse)(nil), // 15: neo.fs.v2.object.GetRangeHashResponse - (*GetRequest_Body)(nil), // 16: neo.fs.v2.object.GetRequest.Body - (*GetResponse_Body)(nil), // 17: neo.fs.v2.object.GetResponse.Body - (*GetResponse_Body_Init)(nil), // 18: neo.fs.v2.object.GetResponse.Body.Init - (*PutRequest_Body)(nil), // 19: neo.fs.v2.object.PutRequest.Body - (*PutRequest_Body_Init)(nil), // 20: neo.fs.v2.object.PutRequest.Body.Init - (*PutResponse_Body)(nil), // 21: neo.fs.v2.object.PutResponse.Body - (*DeleteRequest_Body)(nil), // 22: neo.fs.v2.object.DeleteRequest.Body - (*DeleteResponse_Body)(nil), // 23: neo.fs.v2.object.DeleteResponse.Body - (*HeadRequest_Body)(nil), // 24: neo.fs.v2.object.HeadRequest.Body - (*HeadResponse_Body)(nil), // 25: neo.fs.v2.object.HeadResponse.Body - (*SearchRequest_Body)(nil), // 26: neo.fs.v2.object.SearchRequest.Body - (*SearchRequest_Body_Filter)(nil), // 27: neo.fs.v2.object.SearchRequest.Body.Filter - (*SearchResponse_Body)(nil), // 28: neo.fs.v2.object.SearchResponse.Body - (*GetRangeRequest_Body)(nil), // 29: neo.fs.v2.object.GetRangeRequest.Body - (*GetRangeResponse_Body)(nil), // 30: neo.fs.v2.object.GetRangeResponse.Body - (*GetRangeHashRequest_Body)(nil), // 31: neo.fs.v2.object.GetRangeHashRequest.Body - (*GetRangeHashResponse_Body)(nil), // 32: neo.fs.v2.object.GetRangeHashResponse.Body - (*grpc.RequestMetaHeader)(nil), // 33: neo.fs.v2.session.RequestMetaHeader - (*grpc.RequestVerificationHeader)(nil), // 34: neo.fs.v2.session.RequestVerificationHeader - (*grpc.ResponseMetaHeader)(nil), // 35: neo.fs.v2.session.ResponseMetaHeader - (*grpc.ResponseVerificationHeader)(nil), // 36: neo.fs.v2.session.ResponseVerificationHeader - (*Header)(nil), // 37: neo.fs.v2.object.Header - (*grpc1.Signature)(nil), // 38: neo.fs.v2.refs.Signature - (*grpc1.Address)(nil), // 39: neo.fs.v2.refs.Address - (*SplitInfo)(nil), // 40: neo.fs.v2.object.SplitInfo - (*grpc1.ObjectID)(nil), // 41: neo.fs.v2.refs.ObjectID - (*ShortHeader)(nil), // 42: neo.fs.v2.object.ShortHeader - (*grpc1.ContainerID)(nil), // 43: neo.fs.v2.refs.ContainerID - (MatchType)(0), // 44: neo.fs.v2.object.MatchType - (grpc1.ChecksumType)(0), // 45: neo.fs.v2.refs.ChecksumType + (*PutSingleRequest)(nil), // 16: neo.fs.v2.object.PutSingleRequest + (*PutSingleResponse)(nil), // 17: neo.fs.v2.object.PutSingleResponse + (*GetRequest_Body)(nil), // 18: neo.fs.v2.object.GetRequest.Body + (*GetResponse_Body)(nil), // 19: neo.fs.v2.object.GetResponse.Body + (*GetResponse_Body_Init)(nil), // 20: neo.fs.v2.object.GetResponse.Body.Init + (*PutRequest_Body)(nil), // 21: neo.fs.v2.object.PutRequest.Body + (*PutRequest_Body_Init)(nil), // 22: neo.fs.v2.object.PutRequest.Body.Init + (*PutResponse_Body)(nil), // 23: neo.fs.v2.object.PutResponse.Body + (*DeleteRequest_Body)(nil), // 24: neo.fs.v2.object.DeleteRequest.Body + (*DeleteResponse_Body)(nil), // 25: neo.fs.v2.object.DeleteResponse.Body + (*HeadRequest_Body)(nil), // 26: neo.fs.v2.object.HeadRequest.Body + (*HeadResponse_Body)(nil), // 27: neo.fs.v2.object.HeadResponse.Body + (*SearchRequest_Body)(nil), // 28: neo.fs.v2.object.SearchRequest.Body + (*SearchRequest_Body_Filter)(nil), // 29: neo.fs.v2.object.SearchRequest.Body.Filter + (*SearchResponse_Body)(nil), // 30: neo.fs.v2.object.SearchResponse.Body + (*GetRangeRequest_Body)(nil), // 31: neo.fs.v2.object.GetRangeRequest.Body + (*GetRangeResponse_Body)(nil), // 32: neo.fs.v2.object.GetRangeResponse.Body + (*GetRangeHashRequest_Body)(nil), // 33: neo.fs.v2.object.GetRangeHashRequest.Body + (*GetRangeHashResponse_Body)(nil), // 34: neo.fs.v2.object.GetRangeHashResponse.Body + (*PutSingleRequest_Body)(nil), // 35: neo.fs.v2.object.PutSingleRequest.Body + (*PutSingleResponse_Body)(nil), // 36: neo.fs.v2.object.PutSingleResponse.Body + (*grpc.RequestMetaHeader)(nil), // 37: neo.fs.v2.session.RequestMetaHeader + (*grpc.RequestVerificationHeader)(nil), // 38: neo.fs.v2.session.RequestVerificationHeader + (*grpc.ResponseMetaHeader)(nil), // 39: neo.fs.v2.session.ResponseMetaHeader + (*grpc.ResponseVerificationHeader)(nil), // 40: neo.fs.v2.session.ResponseVerificationHeader + (*Header)(nil), // 41: neo.fs.v2.object.Header + (*grpc1.Signature)(nil), // 42: neo.fs.v2.refs.Signature + (*grpc1.Address)(nil), // 43: neo.fs.v2.refs.Address + (*SplitInfo)(nil), // 44: neo.fs.v2.object.SplitInfo + (*grpc1.ObjectID)(nil), // 45: neo.fs.v2.refs.ObjectID + (*ShortHeader)(nil), // 46: neo.fs.v2.object.ShortHeader + (*grpc1.ContainerID)(nil), // 47: neo.fs.v2.refs.ContainerID + (MatchType)(0), // 48: neo.fs.v2.object.MatchType + (grpc1.ChecksumType)(0), // 49: neo.fs.v2.refs.ChecksumType + (*Object)(nil), // 50: neo.fs.v2.object.Object } var file_object_grpc_service_proto_depIdxs = []int32{ - 16, // 0: neo.fs.v2.object.GetRequest.body:type_name -> neo.fs.v2.object.GetRequest.Body - 33, // 1: neo.fs.v2.object.GetRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader - 34, // 2: neo.fs.v2.object.GetRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader - 17, // 3: neo.fs.v2.object.GetResponse.body:type_name -> neo.fs.v2.object.GetResponse.Body - 35, // 4: neo.fs.v2.object.GetResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader - 36, // 5: neo.fs.v2.object.GetResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader - 19, // 6: neo.fs.v2.object.PutRequest.body:type_name -> neo.fs.v2.object.PutRequest.Body - 33, // 7: neo.fs.v2.object.PutRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader - 34, // 8: neo.fs.v2.object.PutRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader - 21, // 9: neo.fs.v2.object.PutResponse.body:type_name -> neo.fs.v2.object.PutResponse.Body - 35, // 10: neo.fs.v2.object.PutResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader - 36, // 11: neo.fs.v2.object.PutResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader - 22, // 12: neo.fs.v2.object.DeleteRequest.body:type_name -> neo.fs.v2.object.DeleteRequest.Body - 33, // 13: neo.fs.v2.object.DeleteRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader - 34, // 14: neo.fs.v2.object.DeleteRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader - 23, // 15: neo.fs.v2.object.DeleteResponse.body:type_name -> neo.fs.v2.object.DeleteResponse.Body - 35, // 16: neo.fs.v2.object.DeleteResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader - 36, // 17: neo.fs.v2.object.DeleteResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader - 24, // 18: neo.fs.v2.object.HeadRequest.body:type_name -> neo.fs.v2.object.HeadRequest.Body - 33, // 19: neo.fs.v2.object.HeadRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader - 34, // 20: neo.fs.v2.object.HeadRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader - 37, // 21: neo.fs.v2.object.HeaderWithSignature.header:type_name -> neo.fs.v2.object.Header - 38, // 22: neo.fs.v2.object.HeaderWithSignature.signature:type_name -> neo.fs.v2.refs.Signature - 25, // 23: neo.fs.v2.object.HeadResponse.body:type_name -> neo.fs.v2.object.HeadResponse.Body - 35, // 24: neo.fs.v2.object.HeadResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader - 36, // 25: neo.fs.v2.object.HeadResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader - 26, // 26: neo.fs.v2.object.SearchRequest.body:type_name -> neo.fs.v2.object.SearchRequest.Body - 33, // 27: neo.fs.v2.object.SearchRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader - 34, // 28: neo.fs.v2.object.SearchRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader - 28, // 29: neo.fs.v2.object.SearchResponse.body:type_name -> neo.fs.v2.object.SearchResponse.Body - 35, // 30: neo.fs.v2.object.SearchResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader - 36, // 31: neo.fs.v2.object.SearchResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader - 29, // 32: neo.fs.v2.object.GetRangeRequest.body:type_name -> neo.fs.v2.object.GetRangeRequest.Body - 33, // 33: neo.fs.v2.object.GetRangeRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader - 34, // 34: neo.fs.v2.object.GetRangeRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader - 30, // 35: neo.fs.v2.object.GetRangeResponse.body:type_name -> neo.fs.v2.object.GetRangeResponse.Body - 35, // 36: neo.fs.v2.object.GetRangeResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader - 36, // 37: neo.fs.v2.object.GetRangeResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader - 31, // 38: neo.fs.v2.object.GetRangeHashRequest.body:type_name -> neo.fs.v2.object.GetRangeHashRequest.Body - 33, // 39: neo.fs.v2.object.GetRangeHashRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader - 34, // 40: neo.fs.v2.object.GetRangeHashRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader - 32, // 41: neo.fs.v2.object.GetRangeHashResponse.body:type_name -> neo.fs.v2.object.GetRangeHashResponse.Body - 35, // 42: neo.fs.v2.object.GetRangeHashResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader - 36, // 43: neo.fs.v2.object.GetRangeHashResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader - 39, // 44: neo.fs.v2.object.GetRequest.Body.address:type_name -> neo.fs.v2.refs.Address - 18, // 45: neo.fs.v2.object.GetResponse.Body.init:type_name -> neo.fs.v2.object.GetResponse.Body.Init - 40, // 46: neo.fs.v2.object.GetResponse.Body.split_info:type_name -> neo.fs.v2.object.SplitInfo - 41, // 47: neo.fs.v2.object.GetResponse.Body.Init.object_id:type_name -> neo.fs.v2.refs.ObjectID - 38, // 48: neo.fs.v2.object.GetResponse.Body.Init.signature:type_name -> neo.fs.v2.refs.Signature - 37, // 49: neo.fs.v2.object.GetResponse.Body.Init.header:type_name -> neo.fs.v2.object.Header - 20, // 50: neo.fs.v2.object.PutRequest.Body.init:type_name -> neo.fs.v2.object.PutRequest.Body.Init - 41, // 51: neo.fs.v2.object.PutRequest.Body.Init.object_id:type_name -> neo.fs.v2.refs.ObjectID - 38, // 52: neo.fs.v2.object.PutRequest.Body.Init.signature:type_name -> neo.fs.v2.refs.Signature - 37, // 53: neo.fs.v2.object.PutRequest.Body.Init.header:type_name -> neo.fs.v2.object.Header - 41, // 54: neo.fs.v2.object.PutResponse.Body.object_id:type_name -> neo.fs.v2.refs.ObjectID - 39, // 55: neo.fs.v2.object.DeleteRequest.Body.address:type_name -> neo.fs.v2.refs.Address - 39, // 56: neo.fs.v2.object.DeleteResponse.Body.tombstone:type_name -> neo.fs.v2.refs.Address - 39, // 57: neo.fs.v2.object.HeadRequest.Body.address:type_name -> neo.fs.v2.refs.Address - 7, // 58: neo.fs.v2.object.HeadResponse.Body.header:type_name -> neo.fs.v2.object.HeaderWithSignature - 42, // 59: neo.fs.v2.object.HeadResponse.Body.short_header:type_name -> neo.fs.v2.object.ShortHeader - 40, // 60: neo.fs.v2.object.HeadResponse.Body.split_info:type_name -> neo.fs.v2.object.SplitInfo - 43, // 61: neo.fs.v2.object.SearchRequest.Body.container_id:type_name -> neo.fs.v2.refs.ContainerID - 27, // 62: neo.fs.v2.object.SearchRequest.Body.filters:type_name -> neo.fs.v2.object.SearchRequest.Body.Filter - 44, // 63: neo.fs.v2.object.SearchRequest.Body.Filter.match_type:type_name -> neo.fs.v2.object.MatchType - 41, // 64: neo.fs.v2.object.SearchResponse.Body.id_list:type_name -> neo.fs.v2.refs.ObjectID - 39, // 65: neo.fs.v2.object.GetRangeRequest.Body.address:type_name -> neo.fs.v2.refs.Address - 11, // 66: neo.fs.v2.object.GetRangeRequest.Body.range:type_name -> neo.fs.v2.object.Range - 40, // 67: neo.fs.v2.object.GetRangeResponse.Body.split_info:type_name -> neo.fs.v2.object.SplitInfo - 39, // 68: neo.fs.v2.object.GetRangeHashRequest.Body.address:type_name -> neo.fs.v2.refs.Address - 11, // 69: neo.fs.v2.object.GetRangeHashRequest.Body.ranges:type_name -> neo.fs.v2.object.Range - 45, // 70: neo.fs.v2.object.GetRangeHashRequest.Body.type:type_name -> neo.fs.v2.refs.ChecksumType - 45, // 71: neo.fs.v2.object.GetRangeHashResponse.Body.type:type_name -> neo.fs.v2.refs.ChecksumType - 0, // 72: neo.fs.v2.object.ObjectService.Get:input_type -> neo.fs.v2.object.GetRequest - 2, // 73: neo.fs.v2.object.ObjectService.Put:input_type -> neo.fs.v2.object.PutRequest - 4, // 74: neo.fs.v2.object.ObjectService.Delete:input_type -> neo.fs.v2.object.DeleteRequest - 6, // 75: neo.fs.v2.object.ObjectService.Head:input_type -> neo.fs.v2.object.HeadRequest - 9, // 76: neo.fs.v2.object.ObjectService.Search:input_type -> neo.fs.v2.object.SearchRequest - 12, // 77: neo.fs.v2.object.ObjectService.GetRange:input_type -> neo.fs.v2.object.GetRangeRequest - 14, // 78: neo.fs.v2.object.ObjectService.GetRangeHash:input_type -> neo.fs.v2.object.GetRangeHashRequest - 1, // 79: neo.fs.v2.object.ObjectService.Get:output_type -> neo.fs.v2.object.GetResponse - 3, // 80: neo.fs.v2.object.ObjectService.Put:output_type -> neo.fs.v2.object.PutResponse - 5, // 81: neo.fs.v2.object.ObjectService.Delete:output_type -> neo.fs.v2.object.DeleteResponse - 8, // 82: neo.fs.v2.object.ObjectService.Head:output_type -> neo.fs.v2.object.HeadResponse - 10, // 83: neo.fs.v2.object.ObjectService.Search:output_type -> neo.fs.v2.object.SearchResponse - 13, // 84: neo.fs.v2.object.ObjectService.GetRange:output_type -> neo.fs.v2.object.GetRangeResponse - 15, // 85: neo.fs.v2.object.ObjectService.GetRangeHash:output_type -> neo.fs.v2.object.GetRangeHashResponse - 79, // [79:86] is the sub-list for method output_type - 72, // [72:79] is the sub-list for method input_type - 72, // [72:72] is the sub-list for extension type_name - 72, // [72:72] is the sub-list for extension extendee - 0, // [0:72] is the sub-list for field type_name + 18, // 0: neo.fs.v2.object.GetRequest.body:type_name -> neo.fs.v2.object.GetRequest.Body + 37, // 1: neo.fs.v2.object.GetRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader + 38, // 2: neo.fs.v2.object.GetRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader + 19, // 3: neo.fs.v2.object.GetResponse.body:type_name -> neo.fs.v2.object.GetResponse.Body + 39, // 4: neo.fs.v2.object.GetResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader + 40, // 5: neo.fs.v2.object.GetResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 21, // 6: neo.fs.v2.object.PutRequest.body:type_name -> neo.fs.v2.object.PutRequest.Body + 37, // 7: neo.fs.v2.object.PutRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader + 38, // 8: neo.fs.v2.object.PutRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader + 23, // 9: neo.fs.v2.object.PutResponse.body:type_name -> neo.fs.v2.object.PutResponse.Body + 39, // 10: neo.fs.v2.object.PutResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader + 40, // 11: neo.fs.v2.object.PutResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 24, // 12: neo.fs.v2.object.DeleteRequest.body:type_name -> neo.fs.v2.object.DeleteRequest.Body + 37, // 13: neo.fs.v2.object.DeleteRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader + 38, // 14: neo.fs.v2.object.DeleteRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader + 25, // 15: neo.fs.v2.object.DeleteResponse.body:type_name -> neo.fs.v2.object.DeleteResponse.Body + 39, // 16: neo.fs.v2.object.DeleteResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader + 40, // 17: neo.fs.v2.object.DeleteResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 26, // 18: neo.fs.v2.object.HeadRequest.body:type_name -> neo.fs.v2.object.HeadRequest.Body + 37, // 19: neo.fs.v2.object.HeadRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader + 38, // 20: neo.fs.v2.object.HeadRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader + 41, // 21: neo.fs.v2.object.HeaderWithSignature.header:type_name -> neo.fs.v2.object.Header + 42, // 22: neo.fs.v2.object.HeaderWithSignature.signature:type_name -> neo.fs.v2.refs.Signature + 27, // 23: neo.fs.v2.object.HeadResponse.body:type_name -> neo.fs.v2.object.HeadResponse.Body + 39, // 24: neo.fs.v2.object.HeadResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader + 40, // 25: neo.fs.v2.object.HeadResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 28, // 26: neo.fs.v2.object.SearchRequest.body:type_name -> neo.fs.v2.object.SearchRequest.Body + 37, // 27: neo.fs.v2.object.SearchRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader + 38, // 28: neo.fs.v2.object.SearchRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader + 30, // 29: neo.fs.v2.object.SearchResponse.body:type_name -> neo.fs.v2.object.SearchResponse.Body + 39, // 30: neo.fs.v2.object.SearchResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader + 40, // 31: neo.fs.v2.object.SearchResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 31, // 32: neo.fs.v2.object.GetRangeRequest.body:type_name -> neo.fs.v2.object.GetRangeRequest.Body + 37, // 33: neo.fs.v2.object.GetRangeRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader + 38, // 34: neo.fs.v2.object.GetRangeRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader + 32, // 35: neo.fs.v2.object.GetRangeResponse.body:type_name -> neo.fs.v2.object.GetRangeResponse.Body + 39, // 36: neo.fs.v2.object.GetRangeResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader + 40, // 37: neo.fs.v2.object.GetRangeResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 33, // 38: neo.fs.v2.object.GetRangeHashRequest.body:type_name -> neo.fs.v2.object.GetRangeHashRequest.Body + 37, // 39: neo.fs.v2.object.GetRangeHashRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader + 38, // 40: neo.fs.v2.object.GetRangeHashRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader + 34, // 41: neo.fs.v2.object.GetRangeHashResponse.body:type_name -> neo.fs.v2.object.GetRangeHashResponse.Body + 39, // 42: neo.fs.v2.object.GetRangeHashResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader + 40, // 43: neo.fs.v2.object.GetRangeHashResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 35, // 44: neo.fs.v2.object.PutSingleRequest.body:type_name -> neo.fs.v2.object.PutSingleRequest.Body + 37, // 45: neo.fs.v2.object.PutSingleRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader + 38, // 46: neo.fs.v2.object.PutSingleRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader + 36, // 47: neo.fs.v2.object.PutSingleResponse.body:type_name -> neo.fs.v2.object.PutSingleResponse.Body + 39, // 48: neo.fs.v2.object.PutSingleResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader + 40, // 49: neo.fs.v2.object.PutSingleResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 43, // 50: neo.fs.v2.object.GetRequest.Body.address:type_name -> neo.fs.v2.refs.Address + 20, // 51: neo.fs.v2.object.GetResponse.Body.init:type_name -> neo.fs.v2.object.GetResponse.Body.Init + 44, // 52: neo.fs.v2.object.GetResponse.Body.split_info:type_name -> neo.fs.v2.object.SplitInfo + 45, // 53: neo.fs.v2.object.GetResponse.Body.Init.object_id:type_name -> neo.fs.v2.refs.ObjectID + 42, // 54: neo.fs.v2.object.GetResponse.Body.Init.signature:type_name -> neo.fs.v2.refs.Signature + 41, // 55: neo.fs.v2.object.GetResponse.Body.Init.header:type_name -> neo.fs.v2.object.Header + 22, // 56: neo.fs.v2.object.PutRequest.Body.init:type_name -> neo.fs.v2.object.PutRequest.Body.Init + 45, // 57: neo.fs.v2.object.PutRequest.Body.Init.object_id:type_name -> neo.fs.v2.refs.ObjectID + 42, // 58: neo.fs.v2.object.PutRequest.Body.Init.signature:type_name -> neo.fs.v2.refs.Signature + 41, // 59: neo.fs.v2.object.PutRequest.Body.Init.header:type_name -> neo.fs.v2.object.Header + 45, // 60: neo.fs.v2.object.PutResponse.Body.object_id:type_name -> neo.fs.v2.refs.ObjectID + 43, // 61: neo.fs.v2.object.DeleteRequest.Body.address:type_name -> neo.fs.v2.refs.Address + 43, // 62: neo.fs.v2.object.DeleteResponse.Body.tombstone:type_name -> neo.fs.v2.refs.Address + 43, // 63: neo.fs.v2.object.HeadRequest.Body.address:type_name -> neo.fs.v2.refs.Address + 7, // 64: neo.fs.v2.object.HeadResponse.Body.header:type_name -> neo.fs.v2.object.HeaderWithSignature + 46, // 65: neo.fs.v2.object.HeadResponse.Body.short_header:type_name -> neo.fs.v2.object.ShortHeader + 44, // 66: neo.fs.v2.object.HeadResponse.Body.split_info:type_name -> neo.fs.v2.object.SplitInfo + 47, // 67: neo.fs.v2.object.SearchRequest.Body.container_id:type_name -> neo.fs.v2.refs.ContainerID + 29, // 68: neo.fs.v2.object.SearchRequest.Body.filters:type_name -> neo.fs.v2.object.SearchRequest.Body.Filter + 48, // 69: neo.fs.v2.object.SearchRequest.Body.Filter.match_type:type_name -> neo.fs.v2.object.MatchType + 45, // 70: neo.fs.v2.object.SearchResponse.Body.id_list:type_name -> neo.fs.v2.refs.ObjectID + 43, // 71: neo.fs.v2.object.GetRangeRequest.Body.address:type_name -> neo.fs.v2.refs.Address + 11, // 72: neo.fs.v2.object.GetRangeRequest.Body.range:type_name -> neo.fs.v2.object.Range + 44, // 73: neo.fs.v2.object.GetRangeResponse.Body.split_info:type_name -> neo.fs.v2.object.SplitInfo + 43, // 74: neo.fs.v2.object.GetRangeHashRequest.Body.address:type_name -> neo.fs.v2.refs.Address + 11, // 75: neo.fs.v2.object.GetRangeHashRequest.Body.ranges:type_name -> neo.fs.v2.object.Range + 49, // 76: neo.fs.v2.object.GetRangeHashRequest.Body.type:type_name -> neo.fs.v2.refs.ChecksumType + 49, // 77: neo.fs.v2.object.GetRangeHashResponse.Body.type:type_name -> neo.fs.v2.refs.ChecksumType + 50, // 78: neo.fs.v2.object.PutSingleRequest.Body.object:type_name -> neo.fs.v2.object.Object + 0, // 79: neo.fs.v2.object.ObjectService.Get:input_type -> neo.fs.v2.object.GetRequest + 2, // 80: neo.fs.v2.object.ObjectService.Put:input_type -> neo.fs.v2.object.PutRequest + 4, // 81: neo.fs.v2.object.ObjectService.Delete:input_type -> neo.fs.v2.object.DeleteRequest + 6, // 82: neo.fs.v2.object.ObjectService.Head:input_type -> neo.fs.v2.object.HeadRequest + 9, // 83: neo.fs.v2.object.ObjectService.Search:input_type -> neo.fs.v2.object.SearchRequest + 12, // 84: neo.fs.v2.object.ObjectService.GetRange:input_type -> neo.fs.v2.object.GetRangeRequest + 14, // 85: neo.fs.v2.object.ObjectService.GetRangeHash:input_type -> neo.fs.v2.object.GetRangeHashRequest + 16, // 86: neo.fs.v2.object.ObjectService.PutSingle:input_type -> neo.fs.v2.object.PutSingleRequest + 1, // 87: neo.fs.v2.object.ObjectService.Get:output_type -> neo.fs.v2.object.GetResponse + 3, // 88: neo.fs.v2.object.ObjectService.Put:output_type -> neo.fs.v2.object.PutResponse + 5, // 89: neo.fs.v2.object.ObjectService.Delete:output_type -> neo.fs.v2.object.DeleteResponse + 8, // 90: neo.fs.v2.object.ObjectService.Head:output_type -> neo.fs.v2.object.HeadResponse + 10, // 91: neo.fs.v2.object.ObjectService.Search:output_type -> neo.fs.v2.object.SearchResponse + 13, // 92: neo.fs.v2.object.ObjectService.GetRange:output_type -> neo.fs.v2.object.GetRangeResponse + 15, // 93: neo.fs.v2.object.ObjectService.GetRangeHash:output_type -> neo.fs.v2.object.GetRangeHashResponse + 17, // 94: neo.fs.v2.object.ObjectService.PutSingle:output_type -> neo.fs.v2.object.PutSingleResponse + 87, // [87:95] is the sub-list for method output_type + 79, // [79:87] is the sub-list for method input_type + 79, // [79:79] is the sub-list for extension type_name + 79, // [79:79] is the sub-list for extension extendee + 0, // [0:79] is the sub-list for field type_name } func init() { file_object_grpc_service_proto_init() } @@ -3124,7 +3421,7 @@ func file_object_grpc_service_proto_init() { } } file_object_grpc_service_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetRequest_Body); i { + switch v := v.(*PutSingleRequest); i { case 0: return &v.state case 1: @@ -3136,7 +3433,7 @@ func file_object_grpc_service_proto_init() { } } file_object_grpc_service_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetResponse_Body); i { + switch v := v.(*PutSingleResponse); i { case 0: return &v.state case 1: @@ -3148,7 +3445,7 @@ func file_object_grpc_service_proto_init() { } } file_object_grpc_service_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetResponse_Body_Init); i { + switch v := v.(*GetRequest_Body); i { case 0: return &v.state case 1: @@ -3160,7 +3457,7 @@ func file_object_grpc_service_proto_init() { } } file_object_grpc_service_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PutRequest_Body); i { + switch v := v.(*GetResponse_Body); i { case 0: return &v.state case 1: @@ -3172,7 +3469,7 @@ func file_object_grpc_service_proto_init() { } } file_object_grpc_service_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PutRequest_Body_Init); i { + switch v := v.(*GetResponse_Body_Init); i { case 0: return &v.state case 1: @@ -3184,7 +3481,7 @@ func file_object_grpc_service_proto_init() { } } file_object_grpc_service_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PutResponse_Body); i { + switch v := v.(*PutRequest_Body); i { case 0: return &v.state case 1: @@ -3196,7 +3493,7 @@ func file_object_grpc_service_proto_init() { } } file_object_grpc_service_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DeleteRequest_Body); i { + switch v := v.(*PutRequest_Body_Init); i { case 0: return &v.state case 1: @@ -3208,7 +3505,7 @@ func file_object_grpc_service_proto_init() { } } file_object_grpc_service_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DeleteResponse_Body); i { + switch v := v.(*PutResponse_Body); i { case 0: return &v.state case 1: @@ -3220,7 +3517,7 @@ func file_object_grpc_service_proto_init() { } } file_object_grpc_service_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*HeadRequest_Body); i { + switch v := v.(*DeleteRequest_Body); i { case 0: return &v.state case 1: @@ -3232,7 +3529,7 @@ func file_object_grpc_service_proto_init() { } } file_object_grpc_service_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*HeadResponse_Body); i { + switch v := v.(*DeleteResponse_Body); i { case 0: return &v.state case 1: @@ -3244,7 +3541,7 @@ func file_object_grpc_service_proto_init() { } } file_object_grpc_service_proto_msgTypes[26].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SearchRequest_Body); i { + switch v := v.(*HeadRequest_Body); i { case 0: return &v.state case 1: @@ -3256,7 +3553,7 @@ func file_object_grpc_service_proto_init() { } } file_object_grpc_service_proto_msgTypes[27].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SearchRequest_Body_Filter); i { + switch v := v.(*HeadResponse_Body); i { case 0: return &v.state case 1: @@ -3268,7 +3565,7 @@ func file_object_grpc_service_proto_init() { } } file_object_grpc_service_proto_msgTypes[28].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SearchResponse_Body); i { + switch v := v.(*SearchRequest_Body); i { case 0: return &v.state case 1: @@ -3280,7 +3577,7 @@ func file_object_grpc_service_proto_init() { } } file_object_grpc_service_proto_msgTypes[29].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetRangeRequest_Body); i { + switch v := v.(*SearchRequest_Body_Filter); i { case 0: return &v.state case 1: @@ -3292,7 +3589,7 @@ func file_object_grpc_service_proto_init() { } } file_object_grpc_service_proto_msgTypes[30].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetRangeResponse_Body); i { + switch v := v.(*SearchResponse_Body); i { case 0: return &v.state case 1: @@ -3304,7 +3601,7 @@ func file_object_grpc_service_proto_init() { } } file_object_grpc_service_proto_msgTypes[31].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetRangeHashRequest_Body); i { + switch v := v.(*GetRangeRequest_Body); i { case 0: return &v.state case 1: @@ -3316,6 +3613,30 @@ func file_object_grpc_service_proto_init() { } } file_object_grpc_service_proto_msgTypes[32].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetRangeResponse_Body); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_object_grpc_service_proto_msgTypes[33].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetRangeHashRequest_Body); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_object_grpc_service_proto_msgTypes[34].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GetRangeHashResponse_Body); i { case 0: return &v.state @@ -3327,22 +3648,46 @@ func file_object_grpc_service_proto_init() { return nil } } + file_object_grpc_service_proto_msgTypes[35].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PutSingleRequest_Body); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_object_grpc_service_proto_msgTypes[36].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PutSingleResponse_Body); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } - file_object_grpc_service_proto_msgTypes[17].OneofWrappers = []interface{}{ + file_object_grpc_service_proto_msgTypes[19].OneofWrappers = []interface{}{ (*GetResponse_Body_Init_)(nil), (*GetResponse_Body_Chunk)(nil), (*GetResponse_Body_SplitInfo)(nil), } - file_object_grpc_service_proto_msgTypes[19].OneofWrappers = []interface{}{ + file_object_grpc_service_proto_msgTypes[21].OneofWrappers = []interface{}{ (*PutRequest_Body_Init_)(nil), (*PutRequest_Body_Chunk)(nil), } - file_object_grpc_service_proto_msgTypes[25].OneofWrappers = []interface{}{ + file_object_grpc_service_proto_msgTypes[27].OneofWrappers = []interface{}{ (*HeadResponse_Body_Header)(nil), (*HeadResponse_Body_ShortHeader)(nil), (*HeadResponse_Body_SplitInfo)(nil), } - file_object_grpc_service_proto_msgTypes[30].OneofWrappers = []interface{}{ + file_object_grpc_service_proto_msgTypes[32].OneofWrappers = []interface{}{ (*GetRangeResponse_Body_Chunk)(nil), (*GetRangeResponse_Body_SplitInfo)(nil), } @@ -3352,7 +3697,7 @@ func file_object_grpc_service_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_object_grpc_service_proto_rawDesc, NumEnums: 0, - NumMessages: 33, + NumMessages: 37, NumExtensions: 0, NumServices: 1, }, diff --git a/object/grpc/service_grpc.pb.go b/object/grpc/service_grpc.pb.go index 10f33b8..3c71ec8 100644 --- a/object/grpc/service_grpc.pb.go +++ b/object/grpc/service_grpc.pb.go @@ -26,6 +26,7 @@ const ( ObjectService_Search_FullMethodName = "/neo.fs.v2.object.ObjectService/Search" ObjectService_GetRange_FullMethodName = "/neo.fs.v2.object.ObjectService/GetRange" ObjectService_GetRangeHash_FullMethodName = "/neo.fs.v2.object.ObjectService/GetRangeHash" + ObjectService_PutSingle_FullMethodName = "/neo.fs.v2.object.ObjectService/PutSingle" ) // ObjectServiceClient is the client API for ObjectService service. @@ -243,6 +244,40 @@ type ObjectServiceClient interface { // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ // provided session token has expired. GetRangeHash(ctx context.Context, in *GetRangeHashRequest, opts ...grpc.CallOption) (*GetRangeHashResponse, error) + // Put the prepared object into container. + // `ContainerID`, `ObjectID` and `OwnerID` of an object + // MUST be set. Session token MUST be obtained before `PUT SINGLE` operation (see + // session package). + // + // Extended headers can change `Put` behaviour: + // - [ __SYSTEM__NETMAP_EPOCH \ + // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ + // Will use the requested version of Network Map for object placement + // calculation. + // + // Please refer to detailed `XHeader` description. + // + // Statuses: + // - **OK** (0, SECTION_SUCCESS): \ + // object has been successfully saved in the container; + // - Common failures (SECTION_FAILURE_COMMON); + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // write access to the container is denied; + // - **LOCKED** (2050, SECTION_OBJECT): \ + // placement of an object of type TOMBSTONE that includes at least one locked + // object is prohibited; + // - **LOCK_NON_REGULAR_OBJECT** (2051, SECTION_OBJECT): \ + // placement of an object of type LOCK that includes at least one object of + // type other than REGULAR is prohibited; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // object storage container not found; + // - **TOKEN_NOT_FOUND** (4096, SECTION_SESSION): \ + // (for trusted object preparation) session private key does not exist or has + // + // been deleted; + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. + PutSingle(ctx context.Context, in *PutSingleRequest, opts ...grpc.CallOption) (*PutSingleResponse, error) } type objectServiceClient struct { @@ -410,6 +445,15 @@ func (c *objectServiceClient) GetRangeHash(ctx context.Context, in *GetRangeHash return out, nil } +func (c *objectServiceClient) PutSingle(ctx context.Context, in *PutSingleRequest, opts ...grpc.CallOption) (*PutSingleResponse, error) { + out := new(PutSingleResponse) + err := c.cc.Invoke(ctx, ObjectService_PutSingle_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // ObjectServiceServer is the server API for ObjectService service. // All implementations should embed UnimplementedObjectServiceServer // for forward compatibility @@ -625,6 +669,40 @@ type ObjectServiceServer interface { // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ // provided session token has expired. GetRangeHash(context.Context, *GetRangeHashRequest) (*GetRangeHashResponse, error) + // Put the prepared object into container. + // `ContainerID`, `ObjectID` and `OwnerID` of an object + // MUST be set. Session token MUST be obtained before `PUT SINGLE` operation (see + // session package). + // + // Extended headers can change `Put` behaviour: + // - [ __SYSTEM__NETMAP_EPOCH \ + // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ + // Will use the requested version of Network Map for object placement + // calculation. + // + // Please refer to detailed `XHeader` description. + // + // Statuses: + // - **OK** (0, SECTION_SUCCESS): \ + // object has been successfully saved in the container; + // - Common failures (SECTION_FAILURE_COMMON); + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // write access to the container is denied; + // - **LOCKED** (2050, SECTION_OBJECT): \ + // placement of an object of type TOMBSTONE that includes at least one locked + // object is prohibited; + // - **LOCK_NON_REGULAR_OBJECT** (2051, SECTION_OBJECT): \ + // placement of an object of type LOCK that includes at least one object of + // type other than REGULAR is prohibited; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // object storage container not found; + // - **TOKEN_NOT_FOUND** (4096, SECTION_SESSION): \ + // (for trusted object preparation) session private key does not exist or has + // + // been deleted; + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. + PutSingle(context.Context, *PutSingleRequest) (*PutSingleResponse, error) } // UnimplementedObjectServiceServer should be embedded to have forward compatible implementations. @@ -652,6 +730,9 @@ func (UnimplementedObjectServiceServer) GetRange(*GetRangeRequest, ObjectService func (UnimplementedObjectServiceServer) GetRangeHash(context.Context, *GetRangeHashRequest) (*GetRangeHashResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method GetRangeHash not implemented") } +func (UnimplementedObjectServiceServer) PutSingle(context.Context, *PutSingleRequest) (*PutSingleResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method PutSingle not implemented") +} // UnsafeObjectServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to ObjectServiceServer will @@ -807,6 +888,24 @@ func _ObjectService_GetRangeHash_Handler(srv interface{}, ctx context.Context, d return interceptor(ctx, in, info, handler) } +func _ObjectService_PutSingle_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(PutSingleRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ObjectServiceServer).PutSingle(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: ObjectService_PutSingle_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ObjectServiceServer).PutSingle(ctx, req.(*PutSingleRequest)) + } + return interceptor(ctx, in, info, handler) +} + // ObjectService_ServiceDesc is the grpc.ServiceDesc for ObjectService service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) @@ -826,6 +925,10 @@ var ObjectService_ServiceDesc = grpc.ServiceDesc{ MethodName: "GetRangeHash", Handler: _ObjectService_GetRangeHash_Handler, }, + { + MethodName: "PutSingle", + Handler: _ObjectService_PutSingle_Handler, + }, }, Streams: []grpc.StreamDesc{ { diff --git a/object/grpc/types.pb.go b/object/grpc/types.pb.go index 11cb63e..5c79080 100644 --- a/object/grpc/types.pb.go +++ b/object/grpc/types.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 +// protoc-gen-go v1.30.0 // protoc v3.21.9 // source: object/grpc/types.proto diff --git a/object/types.go b/object/types.go index a40de57..625c1ce 100644 --- a/object/types.go +++ b/object/types.go @@ -301,6 +301,17 @@ type GetRangeHashResponse struct { session.ResponseHeaders } +type PutSingleRequestBody struct { + object *Object + copyNum []uint32 +} + +type PutSingleRequest struct { + body *PutSingleRequestBody + + session.RequestHeaders +} + const ( TypeRegular Type = iota TypeTombstone @@ -1405,3 +1416,37 @@ func (r *GetRangeHashResponse) GetBody() *GetRangeHashResponseBody { func (r *GetRangeHashResponse) SetBody(v *GetRangeHashResponseBody) { r.body = v } + +func (r *PutSingleRequest) GetBody() *PutSingleRequestBody { + if r != nil { + return r.body + } + + return nil +} + +func (r *PutSingleRequest) SetBody(v *PutSingleRequestBody) { + r.body = v +} + +func (b *PutSingleRequestBody) GetObject() *Object { + if b == nil { + return nil + } + return b.object +} + +func (b *PutSingleRequestBody) SetObject(o *Object) { + b.object = o +} + +func (b *PutSingleRequestBody) GetCopiesNumber() []uint32 { + if b == nil { + return nil + } + return b.copyNum +} + +func (b *PutSingleRequestBody) SetCopiesNumber(v []uint32) { + b.copyNum = v +} From 2cb57a8835671cf3e87f6e6026352c48ac9f2765 Mon Sep 17 00:00:00 2001 From: Dmitrii Stepanov Date: Fri, 30 Jun 2023 15:00:51 +0300 Subject: [PATCH 1080/1196] [#45] api-go: Add PutSingle request wrappers Signed-off-by: Dmitrii Stepanov --- object/convert.go | 72 +++++++++++++++++++++++++++++++++++++++++ object/grpc/service.go | 25 ++++++++++++++ object/marshal.go | 35 ++++++++++++++++++++ object/message_test.go | 1 + object/test/generate.go | 22 +++++++++++++ signature/body.go | 2 ++ 6 files changed, 157 insertions(+) diff --git a/object/convert.go b/object/convert.go index 7099b4c..63f8def 100644 --- a/object/convert.go +++ b/object/convert.go @@ -2042,3 +2042,75 @@ func (r *GetRangeHashResponse) FromGRPCMessage(m grpc.Message) error { return r.ResponseHeaders.FromMessage(v) } + +func (r *PutSingleRequestBody) ToGRPCMessage() grpc.Message { + var m *object.PutSingleRequest_Body + + if r != nil { + m = new(object.PutSingleRequest_Body) + m.SetObject(r.GetObject().ToGRPCMessage().(*object.Object)) + m.SetCopiesNumber(r.GetCopiesNumber()) + } + + return m +} + +func (r *PutSingleRequestBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.PutSingleRequest_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + if v.GetObject() == nil { + r.object = nil + } else { + if r.object == nil { + r.object = new(Object) + } + + err := r.object.FromGRPCMessage(v.GetObject()) + if err != nil { + return err + } + } + + r.copyNum = v.GetCopiesNumber() + + return nil +} + +func (r *PutSingleRequest) ToGRPCMessage() grpc.Message { + var m *object.PutSingleRequest + + if r != nil { + m = new(object.PutSingleRequest) + + m.SetBody(r.body.ToGRPCMessage().(*object.PutSingleRequest_Body)) + r.RequestHeaders.ToMessage(m) + } + + return m +} + +func (r *PutSingleRequest) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.PutSingleRequest) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + body := v.GetBody() + if body == nil { + r.body = nil + } else { + if r.body == nil { + r.body = new(PutSingleRequestBody) + } + + err := r.body.FromGRPCMessage(body) + if err != nil { + return err + } + } + + return r.RequestHeaders.FromMessage(v) +} diff --git a/object/grpc/service.go b/object/grpc/service.go index 74dc168..7e870a1 100644 --- a/object/grpc/service.go +++ b/object/grpc/service.go @@ -495,3 +495,28 @@ func (m *GetRangeHashResponse) SetMetaHeader(v *session.ResponseMetaHeader) { func (m *GetRangeHashResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) { m.VerifyHeader = v } + +// SetObject set object of the body. +func (m *PutSingleRequest_Body) SetObject(o *Object) { + m.Object = o +} + +// SetCopiesNumber sets copies number of the body. +func (m *PutSingleRequest_Body) SetCopiesNumber(v []uint32) { + m.CopiesNumber = v +} + +// SetBody sets body of the request. +func (m *PutSingleRequest) SetBody(b *PutSingleRequest_Body) { + m.Body = b +} + +// SetMetaHeader sets meta header of the request. +func (m *PutSingleRequest) SetMetaHeader(v *session.RequestMetaHeader) { + m.MetaHeader = v +} + +// SetVerifyHeader sets verification header of the request. +func (m *PutSingleRequest) SetVerifyHeader(v *session.RequestVerificationHeader) { + m.VerifyHeader = v +} diff --git a/object/marshal.go b/object/marshal.go index 7a89b97..f210f44 100644 --- a/object/marshal.go +++ b/object/marshal.go @@ -110,6 +110,9 @@ const ( getRangeHashRespBodyTypeField = 1 getRangeHashRespBodyHashListField = 2 + + putSingleReqObjectField = 1 + putSingleReqCopiesNumberField = 2 ) func (h *ShortHeader) StableMarshal(buf []byte) []byte { @@ -1063,3 +1066,35 @@ func (r *GetRangeHashResponseBody) StableSize() (size int) { func (r *GetRangeHashResponseBody) Unmarshal(data []byte) error { return message.Unmarshal(r, data, new(object.GetRangeHashResponse_Body)) } + +func (r *PutSingleRequestBody) StableMarshal(buf []byte) []byte { + if r == nil { + return []byte{} + } + if buf == nil { + buf = make([]byte, r.StableSize()) + } + + var offset int + offset += proto.NestedStructureMarshal(putSingleReqObjectField, buf[offset:], r.object) + proto.RepeatedUInt32Marshal(putSingleReqCopiesNumberField, buf[offset:], r.copyNum) + + return buf +} + +func (r *PutSingleRequestBody) StableSize() int { + if r == nil { + return 0 + } + + var size int + size += proto.NestedStructureSize(putSingleReqObjectField, r.object) + arrSize, _ := proto.RepeatedUInt32Size(putSingleReqCopiesNumberField, r.copyNum) + size += arrSize + + return size +} + +func (r *PutSingleRequestBody) Unmarshal(data []byte) error { + return message.Unmarshal(r, data, new(object.PutSingleRequest_Body)) +} diff --git a/object/message_test.go b/object/message_test.go index c690e66..ecf0425 100644 --- a/object/message_test.go +++ b/object/message_test.go @@ -51,5 +51,6 @@ func TestMessageConvert(t *testing.T) { func(empty bool) message.Message { return objecttest.GenerateGetRangeHashResponseBody(empty) }, func(empty bool) message.Message { return objecttest.GenerateGetRangeHashResponse(empty) }, func(empty bool) message.Message { return objecttest.GenerateLock(empty) }, + func(empty bool) message.Message { return objecttest.GeneratePutSingleRequest(empty) }, ) } diff --git a/object/test/generate.go b/object/test/generate.go index 32d7a3c..4f163d2 100644 --- a/object/test/generate.go +++ b/object/test/generate.go @@ -610,3 +610,25 @@ func GenerateLock(empty bool) *object.Lock { return m } + +func GeneratePutSingleRequest(empty bool) *object.PutSingleRequest { + m := new(object.PutSingleRequest) + + if !empty { + m.SetBody(GeneratePutSingleRequestBody(false)) + } + + m.SetMetaHeader(sessiontest.GenerateRequestMetaHeader(empty)) + m.SetVerificationHeader(sessiontest.GenerateRequestVerificationHeader(empty)) + + return m +} + +func GeneratePutSingleRequestBody(empty bool) *object.PutSingleRequestBody { + b := new(object.PutSingleRequestBody) + if !empty { + b.SetObject(GenerateObject(empty)) + b.SetCopiesNumber([]uint32{12345}) + } + return b +} diff --git a/signature/body.go b/signature/body.go index 6d43249..68c361d 100644 --- a/signature/body.go +++ b/signature/body.go @@ -87,6 +87,8 @@ func serviceMessageBody(req any) stableMarshaler { return v.GetBody() case *object.GetRangeHashResponse: return v.GetBody() + case *object.PutSingleRequest: + return v.GetBody() /* Netmap */ case *netmap.LocalNodeInfoRequest: From d5b55d092692e71f5065f75d75456af2d2222167 Mon Sep 17 00:00:00 2001 From: Dmitrii Stepanov Date: Fri, 30 Jun 2023 16:05:37 +0300 Subject: [PATCH 1081/1196] [#45] api-go: Add PutSingle response wrappers Signed-off-by: Dmitrii Stepanov --- object/convert.go | 55 +++++++++++++++++++++++++++++++++++++++++ object/grpc/service.go | 15 +++++++++++ object/marshal.go | 20 +++++++++++++++ object/message_test.go | 1 + object/test/generate.go | 10 ++++++++ object/types.go | 21 ++++++++++++++++ signature/body.go | 2 ++ 7 files changed, 124 insertions(+) diff --git a/object/convert.go b/object/convert.go index 63f8def..07bf89c 100644 --- a/object/convert.go +++ b/object/convert.go @@ -2114,3 +2114,58 @@ func (r *PutSingleRequest) FromGRPCMessage(m grpc.Message) error { return r.RequestHeaders.FromMessage(v) } + +func (r *PutSingleResponseBody) ToGRPCMessage() grpc.Message { + var b *object.PutSingleResponse_Body + if r != nil { + b = new(object.PutSingleResponse_Body) + } + return b +} + +func (r *PutSingleResponseBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.PutSingleResponse_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + return nil +} + +func (r *PutSingleResponse) ToGRPCMessage() grpc.Message { + var m *object.PutSingleResponse + + if r != nil { + m = new(object.PutSingleResponse) + + m.SetBody(r.body.ToGRPCMessage().(*object.PutSingleResponse_Body)) + r.ResponseHeaders.ToMessage(m) + } + + return m +} + +func (r *PutSingleResponse) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.PutSingleResponse) + 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(PutSingleResponseBody) + } + + err = r.body.FromGRPCMessage(body) + if err != nil { + return err + } + } + + return r.ResponseHeaders.FromMessage(v) +} diff --git a/object/grpc/service.go b/object/grpc/service.go index 7e870a1..27645dd 100644 --- a/object/grpc/service.go +++ b/object/grpc/service.go @@ -520,3 +520,18 @@ func (m *PutSingleRequest) SetMetaHeader(v *session.RequestMetaHeader) { func (m *PutSingleRequest) SetVerifyHeader(v *session.RequestVerificationHeader) { m.VerifyHeader = v } + +// SetBody sets body of the response. +func (m *PutSingleResponse) SetBody(b *PutSingleResponse_Body) { + m.Body = b +} + +// SetMetaHeader sets meta header of the response. +func (m *PutSingleResponse) SetMetaHeader(v *session.ResponseMetaHeader) { + m.MetaHeader = v +} + +// SetVerifyHeader sets verification header of the response. +func (m *PutSingleResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) { + m.VerifyHeader = v +} diff --git a/object/marshal.go b/object/marshal.go index f210f44..fe0e232 100644 --- a/object/marshal.go +++ b/object/marshal.go @@ -1098,3 +1098,23 @@ func (r *PutSingleRequestBody) StableSize() int { func (r *PutSingleRequestBody) Unmarshal(data []byte) error { return message.Unmarshal(r, data, new(object.PutSingleRequest_Body)) } + +func (r *PutSingleResponseBody) StableMarshal(buf []byte) []byte { + if r == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, r.StableSize()) + } + + return buf +} + +func (r *PutSingleResponseBody) StableSize() int { + return 0 +} + +func (r *PutSingleResponseBody) Unmarshal(data []byte) error { + return message.Unmarshal(r, data, new(object.PutSingleResponse_Body)) +} diff --git a/object/message_test.go b/object/message_test.go index ecf0425..a111c60 100644 --- a/object/message_test.go +++ b/object/message_test.go @@ -52,5 +52,6 @@ func TestMessageConvert(t *testing.T) { func(empty bool) message.Message { return objecttest.GenerateGetRangeHashResponse(empty) }, func(empty bool) message.Message { return objecttest.GenerateLock(empty) }, func(empty bool) message.Message { return objecttest.GeneratePutSingleRequest(empty) }, + func(empty bool) message.Message { return objecttest.GeneratePutSingleResponse(empty) }, ) } diff --git a/object/test/generate.go b/object/test/generate.go index 4f163d2..fca772c 100644 --- a/object/test/generate.go +++ b/object/test/generate.go @@ -632,3 +632,13 @@ func GeneratePutSingleRequestBody(empty bool) *object.PutSingleRequestBody { } return b } + +func GeneratePutSingleResponse(empty bool) *object.PutSingleResponse { + m := new(object.PutSingleResponse) + if !empty { + m.SetBody(new(object.PutSingleResponseBody)) + } + m.SetMetaHeader(sessiontest.GenerateResponseMetaHeader(empty)) + m.SetVerificationHeader(sessiontest.GenerateResponseVerificationHeader(empty)) + return m +} diff --git a/object/types.go b/object/types.go index 625c1ce..d22b428 100644 --- a/object/types.go +++ b/object/types.go @@ -312,6 +312,15 @@ type PutSingleRequest struct { session.RequestHeaders } +type PutSingleResponseBody struct { +} + +type PutSingleResponse struct { + body *PutSingleResponseBody + + session.ResponseHeaders +} + const ( TypeRegular Type = iota TypeTombstone @@ -1450,3 +1459,15 @@ func (b *PutSingleRequestBody) GetCopiesNumber() []uint32 { func (b *PutSingleRequestBody) SetCopiesNumber(v []uint32) { b.copyNum = v } + +func (r *PutSingleResponse) GetBody() *PutSingleResponseBody { + if r != nil { + return r.body + } + + return nil +} + +func (r *PutSingleResponse) SetBody(v *PutSingleResponseBody) { + r.body = v +} diff --git a/signature/body.go b/signature/body.go index 68c361d..b7bb6b4 100644 --- a/signature/body.go +++ b/signature/body.go @@ -89,6 +89,8 @@ func serviceMessageBody(req any) stableMarshaler { return v.GetBody() case *object.PutSingleRequest: return v.GetBody() + case *object.PutSingleResponse: + return v.GetBody() /* Netmap */ case *netmap.LocalNodeInfoRequest: From 285516a94ebe4c4f1116c01ecd2c73e106e832fd Mon Sep 17 00:00:00 2001 From: Dmitrii Stepanov Date: Fri, 30 Jun 2023 16:07:57 +0300 Subject: [PATCH 1082/1196] [#45] api-go: Add PutSingle RPC call Signed-off-by: Dmitrii Stepanov --- rpc/object.go | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/rpc/object.go b/rpc/object.go index 1cac1c7..1eca922 100644 --- a/rpc/object.go +++ b/rpc/object.go @@ -10,13 +10,14 @@ import ( const serviceObject = serviceNamePrefix + "object.ObjectService" const ( - rpcObjectPut = "Put" - rpcObjectGet = "Get" - rpcObjectSearch = "Search" - rpcObjectRange = "GetRange" - rpcObjectHash = "GetRangeHash" - rpcObjectHead = "Head" - rpcObjectDelete = "Delete" + rpcObjectPut = "Put" + rpcObjectGet = "Get" + rpcObjectSearch = "Search" + rpcObjectRange = "GetRange" + rpcObjectHash = "GetRangeHash" + rpcObjectHead = "Head" + rpcObjectDelete = "Delete" + rpcObjectPutSingle = "PutSingle" ) // PutRequestWriter is an object.PutRequest @@ -188,3 +189,19 @@ func HashObjectRange( return resp, nil } + +// PutSingleObject executes ObjectService.PutSingle RPC. +func PutSingleObject( + cli *client.Client, + req *object.PutSingleRequest, + opts ...client.CallOption, +) (*object.PutSingleResponse, error) { + resp := new(object.PutSingleResponse) + + err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceObject, rpcObjectPutSingle), req, resp, opts...) + if err != nil { + return nil, err + } + + return resp, nil +} From 582d94c81c74cff8b0338603a50a296bee34871e Mon Sep 17 00:00:00 2001 From: Airat Arifullin Date: Wed, 19 Jul 2023 13:00:26 +0300 Subject: [PATCH 1083/1196] [#47] types: Fix unique flag conversion Signed-off-by: Airat Arifullin a.arifullin@yadro.com --- netmap/convert.go | 3 +++ netmap/grpc/types.go | 5 +++++ netmap/test/generate.go | 1 + 3 files changed, 9 insertions(+) diff --git a/netmap/convert.go b/netmap/convert.go index 6bb1525..0e25949 100644 --- a/netmap/convert.go +++ b/netmap/convert.go @@ -198,6 +198,7 @@ func (p *PlacementPolicy) ToGRPCMessage() grpc.Message { m.SetSelectors(SelectorsToGRPC(p.selectors)) m.SetReplicas(ReplicasToGRPC(p.replicas)) m.SetContainerBackupFactor(p.backupFactor) + m.SetUnique(p.unique) } return m @@ -228,6 +229,8 @@ func (p *PlacementPolicy) FromGRPCMessage(m grpc.Message) error { p.backupFactor = v.GetContainerBackupFactor() + p.unique = v.GetUnique() + return nil } diff --git a/netmap/grpc/types.go b/netmap/grpc/types.go index f312bbb..f4e90f8 100644 --- a/netmap/grpc/types.go +++ b/netmap/grpc/types.go @@ -20,6 +20,11 @@ func (m *PlacementPolicy) SetFilters(v []*Filter) { m.Filters = v } +// SetUnique of placement policy. +func (m *PlacementPolicy) SetUnique(unique bool) { + m.Unique = unique +} + // SetName of placement filter. func (m *Filter) SetName(v string) { m.Name = v diff --git a/netmap/test/generate.go b/netmap/test/generate.go index 400d24c..260a024 100644 --- a/netmap/test/generate.go +++ b/netmap/test/generate.go @@ -102,6 +102,7 @@ func GeneratePlacementPolicy(empty bool) *netmap.PlacementPolicy { m.SetFilters(GenerateFilters(false)) m.SetSelectors(GenerateSelectors(false)) m.SetReplicas(GenerateReplicas(false)) + m.SetUnique(true) } return m From 59c8421597854a99840027e73b962d48e601292b Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Wed, 26 Jul 2023 16:53:20 +0300 Subject: [PATCH 1084/1196] [#49] util/proto: Use StableSize() to determine if the struct is empty `reflect` is not necessary here, and checking `StableSize` is what we _want_ anyway. Signed-off-by: Evgenii Stratonikov --- status/marshal.go | 4 ++++ util/proto/marshal.go | 10 ++++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/status/marshal.go b/status/marshal.go index 78064c1..1868a43 100644 --- a/status/marshal.go +++ b/status/marshal.go @@ -69,6 +69,10 @@ func (x *Status) StableMarshal(buf []byte) []byte { } func (x *Status) StableSize() (size int) { + if x == nil { + return 0 + } + size += protoutil.UInt32Size(statusCodeFNum, CodeToGRPC(x.code)) size += protoutil.StringSize(statusMsgFNum, x.msg) diff --git a/util/proto/marshal.go b/util/proto/marshal.go index a82478b..ff0d30b 100644 --- a/util/proto/marshal.go +++ b/util/proto/marshal.go @@ -10,7 +10,6 @@ import ( "encoding/binary" "math" "math/bits" - "reflect" ) type ( @@ -303,14 +302,13 @@ func NestedStructurePrefix(field int64) (prefix uint64, ln int) { } func NestedStructureMarshal(field int64, buf []byte, v stableMarshaller) int { - if v == nil || reflect.ValueOf(v).IsNil() { + n := v.StableSize() + if n == 0 { return 0 } prefix, _ := NestedStructurePrefix(field) offset := binary.PutUvarint(buf, prefix) - - n := v.StableSize() offset += binary.PutUvarint(buf[offset:], uint64(n)) v.StableMarshal(buf[offset:]) @@ -318,12 +316,12 @@ func NestedStructureMarshal(field int64, buf []byte, v stableMarshaller) int { } func NestedStructureSize(field int64, v stableMarshaller) (size int) { - if v == nil || reflect.ValueOf(v).IsNil() { + n := v.StableSize() + if n == 0 { return 0 } _, ln := NestedStructurePrefix(field) - n := v.StableSize() size = ln + VarUIntSize(uint64(n)) + n return size From 849de02bc3968ec69fda328d6a7c673bbbbd0928 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Wed, 26 Jul 2023 17:52:54 +0300 Subject: [PATCH 1085/1196] [#49] util/proto: Calculate repeated field size without allocations Signed-off-by: Evgenii Stratonikov --- util/proto/marshal.go | 100 ++++++++++++------------------------------ 1 file changed, 27 insertions(+), 73 deletions(-) diff --git a/util/proto/marshal.go b/util/proto/marshal.go index ff0d30b..7bc8162 100644 --- a/util/proto/marshal.go +++ b/util/proto/marshal.go @@ -178,30 +178,13 @@ func RepeatedStringSize(field int, v []string) (size int) { return size } -func RepeatedUInt64Marshal(field int, buf []byte, v []uint64) int { - if len(v) == 0 { - return 0 - } - - prefix := field<<3 | 0x02 - offset := binary.PutUvarint(buf, uint64(prefix)) - - _, arrSize := RepeatedUInt64Size(field, v) - offset += binary.PutUvarint(buf[offset:], uint64(arrSize)) - for i := range v { - offset += binary.PutUvarint(buf[offset:], v[i]) - } - - return offset -} - -func RepeatedUInt64Size(field int, v []uint64) (size, arraySize int) { +func repeatedUIntSize[T ~uint64 | ~int64 | ~uint32 | ~int32](field int, v []T) (size, arraySize int) { if len(v) == 0 { return 0, 0 } for i := range v { - size += VarUIntSize(v[i]) + size += VarUIntSize(uint64(v[i])) } arraySize = size @@ -213,82 +196,53 @@ func RepeatedUInt64Size(field int, v []uint64) (size, arraySize int) { return size, arraySize } -func RepeatedInt64Marshal(field int, buf []byte, v []int64) int { +func repeatedUIntMarshal[T ~uint64 | ~int64 | ~uint32 | ~int32](field int, buf []byte, v []T) int { if len(v) == 0 { return 0 } - convert := make([]uint64, len(v)) + prefix := field<<3 | 0x02 + offset := binary.PutUvarint(buf, uint64(prefix)) + + _, arrSize := repeatedUIntSize(field, v) + offset += binary.PutUvarint(buf[offset:], uint64(arrSize)) for i := range v { - convert[i] = uint64(v[i]) + offset += binary.PutUvarint(buf[offset:], uint64(v[i])) } - return RepeatedUInt64Marshal(field, buf, convert) + return offset +} + +func RepeatedUInt64Marshal(field int, buf []byte, v []uint64) int { + return repeatedUIntMarshal(field, buf, v) +} + +func RepeatedUInt64Size(field int, v []uint64) (size, arraySize int) { + return repeatedUIntSize(field, v) +} + +func RepeatedInt64Marshal(field int, buf []byte, v []int64) int { + return repeatedUIntMarshal(field, buf, v) } func RepeatedInt64Size(field int, v []int64) (size, arraySize int) { - if len(v) == 0 { - return 0, 0 - } - - convert := make([]uint64, len(v)) - for i := range v { - convert[i] = uint64(v[i]) - } - - return RepeatedUInt64Size(field, convert) + return repeatedUIntSize(field, v) } func RepeatedUInt32Marshal(field int, buf []byte, v []uint32) int { - if len(v) == 0 { - return 0 - } - - convert := make([]uint64, len(v)) - for i := range v { - convert[i] = uint64(v[i]) - } - - return RepeatedUInt64Marshal(field, buf, convert) + return repeatedUIntMarshal(field, buf, v) } func RepeatedUInt32Size(field int, v []uint32) (size, arraySize int) { - if len(v) == 0 { - return 0, 0 - } - - convert := make([]uint64, len(v)) - for i := range v { - convert[i] = uint64(v[i]) - } - - return RepeatedUInt64Size(field, convert) + return repeatedUIntSize(field, v) } func RepeatedInt32Marshal(field int, buf []byte, v []int32) int { - if len(v) == 0 { - return 0 - } - - convert := make([]uint64, len(v)) - for i := range v { - convert[i] = uint64(v[i]) - } - - return RepeatedUInt64Marshal(field, buf, convert) + return repeatedUIntMarshal(field, buf, v) } func RepeatedInt32Size(field int, v []int32) (size, arraySize int) { - if len(v) == 0 { - return 0, 0 - } - - convert := make([]uint64, len(v)) - for i := range v { - convert[i] = uint64(v[i]) - } - - return RepeatedUInt64Size(field, convert) + return repeatedUIntSize(field, v) } // VarUIntSize returns length of varint byte sequence for uint64 value 'x'. From 6e92d7d5de6ba6b346b0c8d27c1801b5a0c73580 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Wed, 26 Jul 2023 18:12:27 +0300 Subject: [PATCH 1086/1196] [#49] util/proto: Make `NestedStructure*` generic Signed-off-by: Evgenii Stratonikov --- util/proto/marshal.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/util/proto/marshal.go b/util/proto/marshal.go index 7bc8162..e345492 100644 --- a/util/proto/marshal.go +++ b/util/proto/marshal.go @@ -255,7 +255,7 @@ func NestedStructurePrefix(field int64) (prefix uint64, ln int) { return prefix, VarUIntSize(prefix) } -func NestedStructureMarshal(field int64, buf []byte, v stableMarshaller) int { +func NestedStructureMarshal[T stableMarshaller](field int64, buf []byte, v T) int { n := v.StableSize() if n == 0 { return 0 @@ -269,7 +269,7 @@ func NestedStructureMarshal(field int64, buf []byte, v stableMarshaller) int { return offset + n } -func NestedStructureSize(field int64, v stableMarshaller) (size int) { +func NestedStructureSize[T stableMarshaller](field int64, v T) (size int) { n := v.StableSize() if n == 0 { return 0 From 43ad0f114cf5ce5bd516b933ed08f721d27741a8 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Wed, 26 Jul 2023 18:12:48 +0300 Subject: [PATCH 1087/1196] [#49] session: Make StableSize() zero-alloc For this to work, it is necessary that `NestedStructureSize` is a generic function. Otherwise, we would allocate to put it in the interface. Signed-off-by: Evgenii Stratonikov --- session/marshal.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/session/marshal.go b/session/marshal.go index 3c56cd4..cda9579 100644 --- a/session/marshal.go +++ b/session/marshal.go @@ -211,7 +211,7 @@ func (c *ObjectSessionContext) StableMarshal(buf []byte) []byte { } offset := proto.EnumMarshal(objectCtxVerbField, buf, int32(c.verb)) - proto.NestedStructureMarshal(objectCtxTargetField, buf[offset:], &objectSessionContextTarget{ + proto.NestedStructureMarshal(objectCtxTargetField, buf[offset:], objectSessionContextTarget{ cnr: c.cnr, objs: c.objs, }) @@ -225,7 +225,7 @@ func (c *ObjectSessionContext) StableSize() (size int) { } size += proto.EnumSize(objectCtxVerbField, int32(c.verb)) - size += proto.NestedStructureSize(objectCtxTargetField, &objectSessionContextTarget{ + size += proto.NestedStructureSize(objectCtxTargetField, objectSessionContextTarget{ cnr: c.cnr, objs: c.objs, }) From 7133a01ccf50844b39414e804d18a10b6c890a90 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Wed, 26 Jul 2023 18:13:05 +0300 Subject: [PATCH 1088/1196] [#49] message/test: Add test for zero-alloc StableSize() Signed-off-by: Evgenii Stratonikov --- rpc/message/test/message.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/rpc/message/test/message.go b/rpc/message/test/message.go index df769d2..435f20a 100644 --- a/rpc/message/test/message.go +++ b/rpc/message/test/message.go @@ -17,6 +17,7 @@ type jsonMessage interface { type binaryMessage interface { StableMarshal([]byte) []byte + StableSize() int Unmarshal([]byte) error } @@ -53,6 +54,11 @@ func TestRPCMessage(t *testing.T, msgGens ...func(empty bool) message.Message) { } if bm, ok := msg.(binaryMessage); ok { + t.Run(fmt.Sprintf("%T.StableSize() does no allocations", bm), func(t *testing.T) { + require.Zero(t, testing.AllocsPerRun(1000, func() { + _ = bm.StableSize() + })) + }) t.Run(fmt.Sprintf("Binary_%T", msg), func(t *testing.T) { data := bm.StableMarshal(nil) From 7a5ee927c8a272ff97f26cd8b7aa65a4c9d6d161 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Wed, 26 Jul 2023 18:51:37 +0300 Subject: [PATCH 1089/1196] [#49] util/proto: Do not allocate in StringSize() It was not catched by the test because most of the time the function is inlined. However, I've seen it allocating with pprof in one of the earlier builds. Signed-off-by: Evgenii Stratonikov --- util/proto/marshal.go | 37 ++++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/util/proto/marshal.go b/util/proto/marshal.go index e345492..b1f55a3 100644 --- a/util/proto/marshal.go +++ b/util/proto/marshal.go @@ -20,13 +20,21 @@ type ( ) func BytesMarshal(field int, buf, v []byte) int { - if len(v) == 0 { - return 0 - } return bytesMarshal(field, buf, v) } -func bytesMarshal(field int, buf, v []byte) int { +func BytesSize(field int, v []byte) int { + return bytesSize(field, v) +} + +func bytesMarshal[T ~[]byte | ~string](field int, buf []byte, v T) int { + if len(v) == 0 { + return 0 + } + return bytesMarshalNoCheck(field, buf, v) +} + +func bytesMarshalNoCheck[T ~[]byte | ~string](field int, buf []byte, v T) int { prefix := field<<3 | 0x2 // buf length check can prevent panic at PutUvarint, but it will make @@ -38,26 +46,25 @@ func bytesMarshal(field int, buf, v []byte) int { return i } -func BytesSize(field int, v []byte) int { - ln := len(v) - if ln == 0 { +func bytesSize[T ~[]byte | ~string](field int, v T) int { + if len(v) == 0 { return 0 } - return bytesSize(field, v) + return bytesSizeNoCheck(field, v) } -func bytesSize(field int, v []byte) int { +func bytesSizeNoCheck[T ~[]byte | ~string](field int, v T) int { prefix := field<<3 | 0x2 return VarUIntSize(uint64(prefix)) + VarUIntSize(uint64(len(v))) + len(v) } func StringMarshal(field int, buf []byte, v string) int { - return BytesMarshal(field, buf, []byte(v)) + return bytesMarshal(field, buf, v) } func StringSize(field int, v string) int { - return BytesSize(field, []byte(v)) + return bytesSize(field, v) } func BoolMarshal(field int, buf []byte, v bool) int { @@ -146,7 +153,7 @@ func RepeatedBytesMarshal(field int, buf []byte, v [][]byte) int { var offset int for i := range v { - offset += bytesMarshal(field, buf[offset:], v[i]) + offset += bytesMarshalNoCheck(field, buf[offset:], v[i]) } return offset @@ -154,7 +161,7 @@ func RepeatedBytesMarshal(field int, buf []byte, v [][]byte) int { func RepeatedBytesSize(field int, v [][]byte) (size int) { for i := range v { - size += bytesSize(field, v[i]) + size += bytesSizeNoCheck(field, v[i]) } return size @@ -164,7 +171,7 @@ func RepeatedStringMarshal(field int, buf []byte, v []string) int { var offset int for i := range v { - offset += bytesMarshal(field, buf[offset:], []byte(v[i])) + offset += bytesMarshalNoCheck(field, buf[offset:], v[i]) } return offset @@ -172,7 +179,7 @@ func RepeatedStringMarshal(field int, buf []byte, v []string) int { func RepeatedStringSize(field int, v []string) (size int) { for i := range v { - size += bytesSize(field, []byte(v[i])) + size += bytesSizeNoCheck(field, v[i]) } return size From 3072090c7729dd3c2727593ff099b05989f9b265 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Wed, 2 Aug 2023 10:46:01 +0300 Subject: [PATCH 1090/1196] [#51] protogen: Do not panic in StableSize() Refs https://git.frostfs.info/TrueCloudLab/frostfs-node/issues/554 . Signed-off-by: Evgenii Stratonikov --- util/protogen/main.go | 1 + 1 file changed, 1 insertion(+) diff --git a/util/protogen/main.go b/util/protogen/main.go index 99f5b7b..fe89fbf 100644 --- a/util/protogen/main.go +++ b/util/protogen/main.go @@ -59,6 +59,7 @@ func emitMessage(g *protogen.GeneratedFile, msg *protogen.Message) { g.P("//") g.P("// Structures with the same field values have the same binary size.") g.P("func (x *", msg.GoIdent.GoName, ") StableSize() (size int) {") + g.P("if x == nil { return 0 }") if len(fs) != 0 { for _, f := range fs { if f.Desc.IsList() && marshalers[f.Desc.Kind()].RepeatedDouble { From 964c3edb3f44306378cdb40adffbc0b68318d1d8 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Wed, 2 Aug 2023 10:55:05 +0300 Subject: [PATCH 1091/1196] [#51] *: Do not panic in StableSize() After #49 it can be called on nil structures. Signed-off-by: Evgenii Stratonikov --- netmap/marshal.go | 16 ++++++++++++++++ status/marshal.go | 4 ++++ 2 files changed, 20 insertions(+) diff --git a/netmap/marshal.go b/netmap/marshal.go index bf559ce..4f2c1ce 100644 --- a/netmap/marshal.go +++ b/netmap/marshal.go @@ -65,6 +65,10 @@ func (f *Filter) StableMarshal(buf []byte) []byte { } func (f *Filter) StableSize() (size int) { + if f == nil { + return 0 + } + size += protoutil.StringSize(nameFilterField, f.name) size += protoutil.StringSize(keyFilterField, f.key) size += protoutil.EnumSize(opFilterField, int32(f.op)) @@ -101,6 +105,10 @@ func (s *Selector) StableMarshal(buf []byte) []byte { } func (s *Selector) StableSize() (size int) { + if s == nil { + return 0 + } + size += protoutil.StringSize(nameSelectorField, s.name) size += protoutil.UInt32Size(countSelectorField, s.count) size += protoutil.EnumSize(countSelectorField, int32(s.clause)) @@ -132,6 +140,10 @@ func (r *Replica) StableMarshal(buf []byte) []byte { } func (r *Replica) StableSize() (size int) { + if r == nil { + return 0 + } + size += protoutil.UInt32Size(countReplicaField, r.count) size += protoutil.StringSize(selectorReplicaField, r.selector) @@ -173,6 +185,10 @@ func (p *PlacementPolicy) StableMarshal(buf []byte) []byte { } func (p *PlacementPolicy) StableSize() (size int) { + if p == nil { + return 0 + } + for i := range p.replicas { size += protoutil.NestedStructureSize(replicasPolicyField, &p.replicas[i]) } diff --git a/status/marshal.go b/status/marshal.go index 1868a43..2908e0d 100644 --- a/status/marshal.go +++ b/status/marshal.go @@ -30,6 +30,10 @@ func (x *Detail) StableMarshal(buf []byte) []byte { } func (x *Detail) StableSize() (size int) { + if x == nil { + return 0 + } + size += protoutil.UInt32Size(detailIDFNum, x.id) size += protoutil.BytesSize(detailValueFNum, x.val) From 67b18d3550471d63e8e6ab416dea6a2a8a77287d Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Wed, 9 Aug 2023 09:54:56 +0300 Subject: [PATCH 1092/1196] [#53] Bump min go version to go1.20 Signed-off-by: Evgenii Stratonikov --- go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go.mod b/go.mod index f7eedf6..78c1bdb 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 -go 1.19 +go 1.20 require ( git.frostfs.info/TrueCloudLab/frostfs-crypto v0.6.0 From 9a7b47d769c5087a46d6785aa0ac6696027e9d95 Mon Sep 17 00:00:00 2001 From: Airat Arifullin Date: Wed, 2 Aug 2023 16:53:47 +0300 Subject: [PATCH 1093/1196] [#50] util: Use protowire for util/proto helpers * Use methods to calculate size Signed-off-by: Airat Arifullin a.arifullin@yadro.com --- refs/marshal.go | 3 +- util/proto/marshal.go | 73 ++++++++++++++----------------------------- 2 files changed, 26 insertions(+), 50 deletions(-) diff --git a/refs/marshal.go b/refs/marshal.go index 0382190..ef197b3 100644 --- a/refs/marshal.go +++ b/refs/marshal.go @@ -6,6 +6,7 @@ import ( refs "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc" "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message" "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/proto" + "google.golang.org/protobuf/encoding/protowire" ) const ( @@ -116,7 +117,7 @@ func (o *ObjectID) StableSize() int { // ObjectIDNestedListMarshal writes protobuf repeated ObjectID field // with fNum number to buf. func ObjectIDNestedListMarshal(fNum int64, buf []byte, ids []ObjectID) (off int) { - prefix, _ := proto.NestedStructurePrefix(fNum) + prefix := protowire.EncodeTag(protowire.Number(fNum), protowire.BytesType) for i := range ids { off += binary.PutUvarint(buf[off:], prefix) diff --git a/util/proto/marshal.go b/util/proto/marshal.go index b1f55a3..606086a 100644 --- a/util/proto/marshal.go +++ b/util/proto/marshal.go @@ -10,6 +10,8 @@ import ( "encoding/binary" "math" "math/bits" + + "google.golang.org/protobuf/encoding/protowire" ) type ( @@ -35,7 +37,7 @@ func bytesMarshal[T ~[]byte | ~string](field int, buf []byte, v T) int { } func bytesMarshalNoCheck[T ~[]byte | ~string](field int, buf []byte, v T) int { - prefix := field<<3 | 0x2 + prefix := protowire.EncodeTag(protowire.Number(field), protowire.BytesType) // buf length check can prevent panic at PutUvarint, but it will make // marshaller a bit slower. @@ -54,9 +56,7 @@ func bytesSize[T ~[]byte | ~string](field int, v T) int { } func bytesSizeNoCheck[T ~[]byte | ~string](field int, v T) int { - prefix := field<<3 | 0x2 - - return VarUIntSize(uint64(prefix)) + VarUIntSize(uint64(len(v))) + len(v) + return protowire.SizeGroup(protowire.Number(field), protowire.SizeBytes(len(v))) } func StringMarshal(field int, buf []byte, v string) int { @@ -72,12 +72,13 @@ func BoolMarshal(field int, buf []byte, v bool) int { return 0 } - prefix := field << 3 + prefix := protowire.EncodeTag(protowire.Number(field), protowire.VarintType) // buf length check can prevent panic at PutUvarint, but it will make // marshaller a bit slower. i := binary.PutUvarint(buf, uint64(prefix)) - buf[i] = 0x1 + const boolTrueValue = 0x1 + buf[i] = boolTrueValue return i + 1 } @@ -86,10 +87,8 @@ func BoolSize(field int, v bool) int { if !v { return 0 } - - prefix := field << 3 - - return VarUIntSize(uint64(prefix)) + 1 // bool is always 1 byte long + const boolLength = 1 + return protowire.SizeGroup(protowire.Number(field), boolLength) } func UInt64Marshal(field int, buf []byte, v uint64) int { @@ -97,7 +96,7 @@ func UInt64Marshal(field int, buf []byte, v uint64) int { return 0 } - prefix := field << 3 + prefix := protowire.EncodeTag(protowire.Number(field), protowire.VarintType) // buf length check can prevent panic at PutUvarint, but it will make // marshaller a bit slower. @@ -111,10 +110,7 @@ func UInt64Size(field int, v uint64) int { if v == 0 { return 0 } - - prefix := field << 3 - - return VarUIntSize(uint64(prefix)) + VarUIntSize(v) + return protowire.SizeGroup(protowire.Number(field), protowire.SizeVarint(v)) } func Int64Marshal(field int, buf []byte, v int64) int { @@ -191,16 +187,12 @@ func repeatedUIntSize[T ~uint64 | ~int64 | ~uint32 | ~int32](field int, v []T) ( } for i := range v { - size += VarUIntSize(uint64(v[i])) + arraySize += protowire.SizeVarint(uint64(v[i])) } - arraySize = size - size += VarUIntSize(uint64(size)) + size = protowire.SizeGroup(protowire.Number(field), protowire.SizeBytes(arraySize)) - prefix := field<<3 | 0x2 - size += VarUIntSize(uint64(prefix)) - - return size, arraySize + return } func repeatedUIntMarshal[T ~uint64 | ~int64 | ~uint32 | ~int32](field int, buf []byte, v []T) int { @@ -208,7 +200,7 @@ func repeatedUIntMarshal[T ~uint64 | ~int64 | ~uint32 | ~int32](field int, buf [ return 0 } - prefix := field<<3 | 0x02 + prefix := protowire.EncodeTag(protowire.Number(field), protowire.BytesType) offset := binary.PutUvarint(buf, uint64(prefix)) _, arrSize := repeatedUIntSize(field, v) @@ -257,18 +249,13 @@ func VarUIntSize(x uint64) int { return (bits.Len64(x|1) + 6) / 7 } -func NestedStructurePrefix(field int64) (prefix uint64, ln int) { - prefix = uint64(field<<3 | 0x02) - return prefix, VarUIntSize(prefix) -} - func NestedStructureMarshal[T stableMarshaller](field int64, buf []byte, v T) int { n := v.StableSize() if n == 0 { return 0 } - prefix, _ := NestedStructurePrefix(field) + prefix := protowire.EncodeTag(protowire.Number(field), protowire.BytesType) offset := binary.PutUvarint(buf, prefix) offset += binary.PutUvarint(buf[offset:], uint64(n)) v.StableMarshal(buf[offset:]) @@ -281,11 +268,8 @@ func NestedStructureSize[T stableMarshaller](field int64, v T) (size int) { if n == 0 { return 0 } - - _, ln := NestedStructurePrefix(field) - size = ln + VarUIntSize(uint64(n)) + n - - return size + size = protowire.SizeGroup(protowire.Number(field), protowire.SizeBytes(n)) + return } func Fixed64Marshal(field int, buf []byte, v uint64) int { @@ -293,7 +277,7 @@ func Fixed64Marshal(field int, buf []byte, v uint64) int { return 0 } - prefix := field<<3 | 1 + prefix := protowire.EncodeTag(protowire.Number(field), protowire.Fixed64Type) // buf length check can prevent panic at PutUvarint, but it will make // marshaller a bit slower. @@ -307,10 +291,7 @@ func Fixed64Size(fNum int, v uint64) int { if v == 0 { return 0 } - - prefix := fNum<<3 | 1 - - return VarUIntSize(uint64(prefix)) + 8 + return protowire.SizeGroup(protowire.Number(fNum), protowire.SizeFixed64()) } func Float64Marshal(field int, buf []byte, v float64) int { @@ -318,7 +299,7 @@ func Float64Marshal(field int, buf []byte, v float64) int { return 0 } - prefix := field<<3 | 1 + prefix := protowire.EncodeTag(protowire.Number(field), protowire.Fixed64Type) i := binary.PutUvarint(buf, uint64(prefix)) binary.LittleEndian.PutUint64(buf[i:], math.Float64bits(v)) @@ -330,10 +311,7 @@ func Float64Size(fNum int, v float64) int { if v == 0 { return 0 } - - prefix := fNum<<3 | 1 - - return VarUIntSize(uint64(prefix)) + 8 + return protowire.SizeGroup(protowire.Number(fNum), protowire.SizeFixed64()) } // Fixed32Marshal encodes uint32 value to Protocol Buffers fixed32 field with specified number, @@ -345,7 +323,7 @@ func Fixed32Marshal(field int, buf []byte, v uint32) int { return 0 } - prefix := field<<3 | 5 + prefix := protowire.EncodeTag(protowire.Number(field), protowire.Fixed32Type) // buf length check can prevent panic at PutUvarint, but it will make // marshaller a bit slower. @@ -361,8 +339,5 @@ func Fixed32Size(fNum int, v uint32) int { if v == 0 { return 0 } - - prefix := fNum<<3 | 5 - - return VarUIntSize(uint64(prefix)) + 4 + return protowire.SizeGroup(protowire.Number(fNum), protowire.SizeFixed32()) } From 0671f42ee185d0a80d276c9d30aabf720cf43ecc Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Fri, 11 Aug 2023 12:26:59 +0300 Subject: [PATCH 1094/1196] [#54] .forgejo: Add DCO action Signed-off-by: Evgenii Stratonikov --- .forgejo/workflows/dco.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 .forgejo/workflows/dco.yml diff --git a/.forgejo/workflows/dco.yml b/.forgejo/workflows/dco.yml new file mode 100644 index 0000000..6746408 --- /dev/null +++ b/.forgejo/workflows/dco.yml @@ -0,0 +1,21 @@ +name: DCO action +on: [pull_request] + +jobs: + dco: + name: DCO + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Setup Go + uses: actions/setup-go@v3 + with: + go-version: '1.21' + + - name: Run commit format checker + uses: https://git.frostfs.info/TrueCloudLab/dco-go@v2 + with: + from: 'origin/${{ github.event.pull_request.base.ref }}' From d989c8d2a34983264bf38954bec19e7d7e3ab076 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Fri, 11 Aug 2023 15:21:17 +0300 Subject: [PATCH 1095/1196] [#54] *: Fix linter warnings Signed-off-by: Evgenii Stratonikov --- internal/random/rand.go | 15 --------------- object/test/generate.go | 16 +++++++++++----- session/test/generate.go | 10 ++++++++-- 3 files changed, 19 insertions(+), 22 deletions(-) delete mode 100644 internal/random/rand.go diff --git a/internal/random/rand.go b/internal/random/rand.go deleted file mode 100644 index db2c087..0000000 --- a/internal/random/rand.go +++ /dev/null @@ -1,15 +0,0 @@ -package random - -import ( - "math/rand" - "time" -) - -func init() { - rand.Seed(time.Now().UnixNano()) -} - -// Uint32 returns random uint32 value [0, max). -func Uint32(max uint32) uint32 { - return rand.Uint32() % max -} diff --git a/object/test/generate.go b/object/test/generate.go index fca772c..085880c 100644 --- a/object/test/generate.go +++ b/object/test/generate.go @@ -1,7 +1,9 @@ package objecttest import ( - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/internal/random" + "math/rand" + "time" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/object" "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" refstest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/test" @@ -186,7 +188,7 @@ func GenerateGetResponseBody(empty bool) *object.GetResponseBody { m := new(object.GetResponseBody) if !empty { - switch random.Uint32(3) { + switch randomInt(3) { case 0: m.SetObjectPart(GenerateGetObjectPartInit(false)) case 1: @@ -240,7 +242,7 @@ func GeneratePutRequestBody(empty bool) *object.PutRequestBody { m := new(object.PutRequestBody) if !empty { - switch random.Uint32(2) { + switch randomInt(2) { case 0: m.SetObjectPart(GeneratePutObjectPartInit(false)) case 1: @@ -362,7 +364,7 @@ func GenerateHeadResponseBody(empty bool) *object.HeadResponseBody { m := new(object.HeadResponseBody) if !empty { - switch random.Uint32(3) { + switch randomInt(3) { case 0: m.SetHeaderPart(GenerateHeaderWithSignature(false)) case 1: @@ -524,7 +526,7 @@ func GenerateGetRangeResponseBody(empty bool) *object.GetRangeResponseBody { m := new(object.GetRangeResponseBody) if !empty { - switch random.Uint32(2) { + switch randomInt(2) { case 0: m.SetRangePart(GenerateGetRangePartChunk(false)) case 1: @@ -642,3 +644,7 @@ func GeneratePutSingleResponse(empty bool) *object.PutSingleResponse { m.SetVerificationHeader(sessiontest.GenerateResponseVerificationHeader(empty)) return m } + +func randomInt(n int) int { + return rand.New(rand.NewSource(time.Now().UnixNano())).Intn(n) +} diff --git a/session/test/generate.go b/session/test/generate.go index cfce6cd..561ec01 100644 --- a/session/test/generate.go +++ b/session/test/generate.go @@ -1,8 +1,10 @@ package sessiontest import ( + "math/rand" + "time" + acltest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/acl/test" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/internal/random" refstest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/test" "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session" statustest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/status/test" @@ -167,7 +169,7 @@ func GenerateSessionTokenBody(empty bool) *session.TokenBody { m.SetOwnerID(refstest.GenerateOwnerID(false)) m.SetLifetime(GenerateTokenLifetime(false)) - switch random.Uint32(2) { + switch randomInt(2) { case 0: m.SetContext(GenerateObjectSessionContext(false)) case 1: @@ -236,3 +238,7 @@ func GenerateXHeaders(empty bool) []session.XHeader { return xs } + +func randomInt(n int) int { + return rand.New(rand.NewSource(time.Now().UnixNano())).Intn(n) +} From 022f818735a7b3e44a9e74b21a8c8f7bffc57c6e Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Thu, 17 Aug 2023 11:06:43 +0300 Subject: [PATCH 1096/1196] [#20] Remove storage groups Signed-off-by: Evgenii Stratonikov --- storagegroup/convert.go | 59 ---------- storagegroup/grpc/types.go | 27 ----- storagegroup/grpc/types.pb.go | 211 ---------------------------------- storagegroup/json.go | 14 --- storagegroup/marshal.go | 54 --------- storagegroup/message_test.go | 15 --- storagegroup/test/generate.go | 21 ---- storagegroup/types.go | 79 ------------- 8 files changed, 480 deletions(-) delete mode 100644 storagegroup/convert.go delete mode 100644 storagegroup/grpc/types.go delete mode 100644 storagegroup/grpc/types.pb.go delete mode 100644 storagegroup/json.go delete mode 100644 storagegroup/marshal.go delete mode 100644 storagegroup/message_test.go delete mode 100644 storagegroup/test/generate.go delete mode 100644 storagegroup/types.go diff --git a/storagegroup/convert.go b/storagegroup/convert.go deleted file mode 100644 index 898d493..0000000 --- a/storagegroup/convert.go +++ /dev/null @@ -1,59 +0,0 @@ -package storagegroup - -import ( - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" - refsGRPC "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/grpc" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message" - sg "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/storagegroup/grpc" -) - -func (s *StorageGroup) ToGRPCMessage() grpc.Message { - m := new(sg.StorageGroup) - - if s != nil { - m = new(sg.StorageGroup) - - m.SetMembers(refs.ObjectIDListToGRPCMessage(s.members)) - //nolint:staticcheck - m.SetExpirationEpoch(s.exp) - m.SetValidationDataSize(s.size) - m.SetValidationHash(s.hash.ToGRPCMessage().(*refsGRPC.Checksum)) - } - - return m -} - -func (s *StorageGroup) FromGRPCMessage(m grpc.Message) error { - v, ok := m.(*sg.StorageGroup) - if !ok { - return message.NewUnexpectedMessageType(m, v) - } - - var err error - - hash := v.GetValidationHash() - if hash == nil { - s.hash = nil - } else { - if s.hash == nil { - s.hash = new(refs.Checksum) - } - - err = s.hash.FromGRPCMessage(hash) - if err != nil { - return err - } - } - - s.members, err = refs.ObjectIDListFromGRPCMessage(v.GetMembers()) - if err != nil { - return err - } - - //nolint:staticcheck - s.exp = v.GetExpirationEpoch() - s.size = v.GetValidationDataSize() - - return nil -} diff --git a/storagegroup/grpc/types.go b/storagegroup/grpc/types.go deleted file mode 100644 index 9be5c24..0000000 --- a/storagegroup/grpc/types.go +++ /dev/null @@ -1,27 +0,0 @@ -package storagegroup - -import ( - refs "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc" -) - -// SetValidationDataSize sets the total size of the payloads of the storage group. -func (m *StorageGroup) SetValidationDataSize(v uint64) { - m.ValidationDataSize = v -} - -// SetValidationHash sets total homomorphic hash of the storage group payloads. -func (m *StorageGroup) SetValidationHash(v *refs.Checksum) { - m.ValidationHash = v -} - -// SetExpirationEpoch sets number of the last epoch of the storage group lifetime. -// -// Deprecated: do not use, `expiration_epoch` field is deprecated in protocol. -func (m *StorageGroup) SetExpirationEpoch(v uint64) { - m.ExpirationEpoch = v -} - -// SetMembers sets list of the identifiers of the storage group members. -func (m *StorageGroup) SetMembers(v []*refs.ObjectID) { - m.Members = v -} diff --git a/storagegroup/grpc/types.pb.go b/storagegroup/grpc/types.pb.go deleted file mode 100644 index 75f5b46..0000000 --- a/storagegroup/grpc/types.pb.go +++ /dev/null @@ -1,211 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.9 -// source: storagegroup/grpc/types.proto - -package storagegroup - -import ( - grpc "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -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) -) - -// StorageGroup keeps verification information for Data Audit sessions. Objects -// that require paid storage guarantees are gathered in `StorageGroups` with -// additional information used for the proof of storage. `StorageGroup` only -// contains objects from the same container. -// -// Being an object payload, StorageGroup may have expiration Epoch set with -// `__SYSTEM__EXPIRATION_EPOCH` (`__NEOFS__EXPIRATION_EPOCH` is deprecated) well-known attribute. When expired, StorageGroup -// will be ignored by InnerRing nodes during Data Audit cycles and will be -// deleted by Storage Nodes. -type StorageGroup struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Total size of the payloads of objects in the storage group - ValidationDataSize uint64 `protobuf:"varint,1,opt,name=validation_data_size,json=validationDataSize,proto3" json:"validation_data_size,omitempty"` - // Homomorphic hash from the concatenation of the payloads of the storage - // group members. The order of concatenation is the same as the order of the - // members in the `members` field. - ValidationHash *grpc.Checksum `protobuf:"bytes,2,opt,name=validation_hash,json=validationHash,proto3" json:"validation_hash,omitempty"` - // DEPRECATED. Last NeoFS epoch number of the storage group lifetime - // - // Deprecated: Do not use. - ExpirationEpoch uint64 `protobuf:"varint,3,opt,name=expiration_epoch,json=expirationEpoch,proto3" json:"expiration_epoch,omitempty"` - // Strictly ordered list of storage group member objects. Members MUST be unique - Members []*grpc.ObjectID `protobuf:"bytes,4,rep,name=members,proto3" json:"members,omitempty"` -} - -func (x *StorageGroup) Reset() { - *x = StorageGroup{} - if protoimpl.UnsafeEnabled { - mi := &file_storagegroup_grpc_types_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *StorageGroup) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*StorageGroup) ProtoMessage() {} - -func (x *StorageGroup) ProtoReflect() protoreflect.Message { - mi := &file_storagegroup_grpc_types_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use StorageGroup.ProtoReflect.Descriptor instead. -func (*StorageGroup) Descriptor() ([]byte, []int) { - return file_storagegroup_grpc_types_proto_rawDescGZIP(), []int{0} -} - -func (x *StorageGroup) GetValidationDataSize() uint64 { - if x != nil { - return x.ValidationDataSize - } - return 0 -} - -func (x *StorageGroup) GetValidationHash() *grpc.Checksum { - if x != nil { - return x.ValidationHash - } - return nil -} - -// Deprecated: Do not use. -func (x *StorageGroup) GetExpirationEpoch() uint64 { - if x != nil { - return x.ExpirationEpoch - } - return 0 -} - -func (x *StorageGroup) GetMembers() []*grpc.ObjectID { - if x != nil { - return x.Members - } - return nil -} - -var File_storagegroup_grpc_types_proto protoreflect.FileDescriptor - -var file_storagegroup_grpc_types_proto_rawDesc = []byte{ - 0x0a, 0x1d, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x2f, 0x67, - 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, - 0x16, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x61, - 0x67, 0x65, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x1a, 0x15, 0x72, 0x65, 0x66, 0x73, 0x2f, 0x67, 0x72, - 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xe6, - 0x01, 0x0a, 0x0c, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, - 0x30, 0x0a, 0x14, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x64, 0x61, - 0x74, 0x61, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x12, 0x76, - 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x61, 0x74, 0x61, 0x53, 0x69, 0x7a, - 0x65, 0x12, 0x41, 0x0a, 0x0f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, - 0x68, 0x61, 0x73, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, - 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x68, 0x65, 0x63, - 0x6b, 0x73, 0x75, 0x6d, 0x52, 0x0e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x48, 0x61, 0x73, 0x68, 0x12, 0x2d, 0x0a, 0x10, 0x65, 0x78, 0x70, 0x69, 0x72, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x5f, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x42, 0x02, - 0x18, 0x01, 0x52, 0x0f, 0x65, 0x78, 0x70, 0x69, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x70, - 0x6f, 0x63, 0x68, 0x12, 0x32, 0x0a, 0x07, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x18, 0x04, - 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, 0x73, 0x5a, 0x4e, 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, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x73, 0x74, 0x6f, 0x72, 0x61, - 0x67, 0x65, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x73, 0x74, 0x6f, - 0x72, 0x61, 0x67, 0x65, 0x67, 0x72, 0x6f, 0x75, 0x70, 0xaa, 0x02, 0x20, 0x4e, 0x65, 0x6f, 0x2e, - 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, - 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x62, 0x06, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_storagegroup_grpc_types_proto_rawDescOnce sync.Once - file_storagegroup_grpc_types_proto_rawDescData = file_storagegroup_grpc_types_proto_rawDesc -) - -func file_storagegroup_grpc_types_proto_rawDescGZIP() []byte { - file_storagegroup_grpc_types_proto_rawDescOnce.Do(func() { - file_storagegroup_grpc_types_proto_rawDescData = protoimpl.X.CompressGZIP(file_storagegroup_grpc_types_proto_rawDescData) - }) - return file_storagegroup_grpc_types_proto_rawDescData -} - -var file_storagegroup_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_storagegroup_grpc_types_proto_goTypes = []interface{}{ - (*StorageGroup)(nil), // 0: neo.fs.v2.storagegroup.StorageGroup - (*grpc.Checksum)(nil), // 1: neo.fs.v2.refs.Checksum - (*grpc.ObjectID)(nil), // 2: neo.fs.v2.refs.ObjectID -} -var file_storagegroup_grpc_types_proto_depIdxs = []int32{ - 1, // 0: neo.fs.v2.storagegroup.StorageGroup.validation_hash:type_name -> neo.fs.v2.refs.Checksum - 2, // 1: neo.fs.v2.storagegroup.StorageGroup.members:type_name -> neo.fs.v2.refs.ObjectID - 2, // [2:2] is the sub-list for method output_type - 2, // [2:2] is the sub-list for method input_type - 2, // [2:2] is the sub-list for extension type_name - 2, // [2:2] is the sub-list for extension extendee - 0, // [0:2] is the sub-list for field type_name -} - -func init() { file_storagegroup_grpc_types_proto_init() } -func file_storagegroup_grpc_types_proto_init() { - if File_storagegroup_grpc_types_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_storagegroup_grpc_types_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*StorageGroup); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_storagegroup_grpc_types_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_storagegroup_grpc_types_proto_goTypes, - DependencyIndexes: file_storagegroup_grpc_types_proto_depIdxs, - MessageInfos: file_storagegroup_grpc_types_proto_msgTypes, - }.Build() - File_storagegroup_grpc_types_proto = out.File - file_storagegroup_grpc_types_proto_rawDesc = nil - file_storagegroup_grpc_types_proto_goTypes = nil - file_storagegroup_grpc_types_proto_depIdxs = nil -} diff --git a/storagegroup/json.go b/storagegroup/json.go deleted file mode 100644 index b122893..0000000 --- a/storagegroup/json.go +++ /dev/null @@ -1,14 +0,0 @@ -package storagegroup - -import ( - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message" - storagegroup "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/storagegroup/grpc" -) - -func (s *StorageGroup) MarshalJSON() ([]byte, error) { - return message.MarshalJSON(s) -} - -func (s *StorageGroup) UnmarshalJSON(data []byte) error { - return message.UnmarshalJSON(s, data, new(storagegroup.StorageGroup)) -} diff --git a/storagegroup/marshal.go b/storagegroup/marshal.go deleted file mode 100644 index 3f8171a..0000000 --- a/storagegroup/marshal.go +++ /dev/null @@ -1,54 +0,0 @@ -package storagegroup - -import ( - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message" - storagegroup "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/storagegroup/grpc" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/proto" -) - -const ( - sizeField = 1 - hashField = 2 - expirationField = 3 - objectIDsField = 4 -) - -// StableMarshal marshals unified storage group structure in a protobuf -// compatible way without field order shuffle. -func (s *StorageGroup) StableMarshal(buf []byte) []byte { - if s == nil { - return []byte{} - } - - if buf == nil { - buf = make([]byte, s.StableSize()) - } - - var offset int - - offset += proto.UInt64Marshal(sizeField, buf[offset:], s.size) - offset += proto.NestedStructureMarshal(hashField, buf[offset:], s.hash) - offset += proto.UInt64Marshal(expirationField, buf[offset:], s.exp) - refs.ObjectIDNestedListMarshal(objectIDsField, buf[offset:], s.members) - - return buf -} - -// StableSize of storage group structure marshalled by StableMarshal function. -func (s *StorageGroup) StableSize() (size int) { - if s == nil { - return 0 - } - - size += proto.UInt64Size(sizeField, s.size) - size += proto.NestedStructureSize(hashField, s.hash) - size += proto.UInt64Size(expirationField, s.exp) - size += refs.ObjectIDNestedListSize(objectIDsField, s.members) - - return size -} - -func (s *StorageGroup) Unmarshal(data []byte) error { - return message.Unmarshal(s, data, new(storagegroup.StorageGroup)) -} diff --git a/storagegroup/message_test.go b/storagegroup/message_test.go deleted file mode 100644 index e4ed367..0000000 --- a/storagegroup/message_test.go +++ /dev/null @@ -1,15 +0,0 @@ -package storagegroup_test - -import ( - "testing" - - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message" - messagetest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message/test" - storagegrouptest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/storagegroup/test" -) - -func TestMessageConvert(t *testing.T) { - messagetest.TestRPCMessage(t, - func(empty bool) message.Message { return storagegrouptest.GenerateStorageGroup(empty) }, - ) -} diff --git a/storagegroup/test/generate.go b/storagegroup/test/generate.go deleted file mode 100644 index b53f199..0000000 --- a/storagegroup/test/generate.go +++ /dev/null @@ -1,21 +0,0 @@ -package storagegrouptest - -import ( - refstest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/test" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/storagegroup" -) - -func GenerateStorageGroup(empty bool) *storagegroup.StorageGroup { - m := new(storagegroup.StorageGroup) - - if !empty { - m.SetValidationDataSize(44) - //nolint:staticcheck - m.SetExpirationEpoch(55) - m.SetMembers(refstest.GenerateObjectIDs(false)) - } - - m.SetValidationHash(refstest.GenerateChecksum(empty)) - - return m -} diff --git a/storagegroup/types.go b/storagegroup/types.go deleted file mode 100644 index b5a3a5b..0000000 --- a/storagegroup/types.go +++ /dev/null @@ -1,79 +0,0 @@ -package storagegroup - -import ( - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" -) - -// StorageGroup is a unified structure of StorageGroup -// message from proto definition. -type StorageGroup struct { - size uint64 - - hash *refs.Checksum - - exp uint64 - - members []refs.ObjectID -} - -// GetValidationDataSize of unified storage group structure. -func (s *StorageGroup) GetValidationDataSize() uint64 { - if s != nil { - return s.size - } - - return 0 -} - -// SetValidationDataSize into unified storage group structure. -func (s *StorageGroup) SetValidationDataSize(v uint64) { - s.size = v -} - -// GetValidationHash of unified storage group structure. -func (s *StorageGroup) GetValidationHash() *refs.Checksum { - if s != nil { - return s.hash - } - - return nil -} - -// SetValidationHash into unified storage group structure. -func (s *StorageGroup) SetValidationHash(v *refs.Checksum) { - s.hash = v -} - -// GetExpirationEpoch of unified storage group structure. -// -// Deprecated: Do not use. -func (s *StorageGroup) GetExpirationEpoch() uint64 { - if s != nil { - return s.exp - } - - return 0 -} - -// SetExpirationEpoch into unified storage group structure. -// -// Deprecated: Do not use. -func (s *StorageGroup) SetExpirationEpoch(v uint64) { - s.exp = v -} - -// GetMembers of unified storage group structure. Members are objects of -// storage group. -func (s *StorageGroup) GetMembers() []refs.ObjectID { - if s != nil { - return s.members - } - - return nil -} - -// SetMembers into unified storage group structure. Members are objects of -// storage group. -func (s *StorageGroup) SetMembers(v []refs.ObjectID) { - s.members = v -} From 17bed735a171b8173531dd39edb4f264c8ac7a45 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Thu, 17 Aug 2023 11:08:14 +0300 Subject: [PATCH 1097/1196] [#20] Update api version Signed-off-by: Evgenii Stratonikov --- accounting/grpc/service.pb.go | 4 +- accounting/grpc/service_grpc.pb.go | 2 +- accounting/grpc/types.pb.go | 4 +- acl/grpc/types.pb.go | 4 +- audit/grpc/types.pb.go | 4 +- container/grpc/service.pb.go | 4 +- container/grpc/service_grpc.pb.go | 2 +- container/grpc/types.pb.go | 4 +- lock/grpc/types.pb.go | 4 +- netmap/grpc/service.pb.go | 4 +- netmap/grpc/service_grpc.pb.go | 2 +- netmap/grpc/types.pb.go | 2 +- object/grpc/service.pb.go | 28 +++++----- object/grpc/service_grpc.pb.go | 88 +++++++++++++++++------------- object/grpc/types.pb.go | 62 ++++++++++----------- object/types.go | 2 +- refs/grpc/types.pb.go | 4 +- session/grpc/service.pb.go | 4 +- session/grpc/service_grpc.pb.go | 2 +- session/grpc/types.pb.go | 4 +- status/grpc/types.pb.go | 4 +- tombstone/grpc/types.pb.go | 4 +- util/proto/test/test.pb.go | 4 +- 23 files changed, 125 insertions(+), 121 deletions(-) diff --git a/accounting/grpc/service.pb.go b/accounting/grpc/service.pb.go index 9699622..51b9fe3 100644 --- a/accounting/grpc/service.pb.go +++ b/accounting/grpc/service.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.9 +// protoc-gen-go v1.30.0 +// protoc v4.23.4 // source: accounting/grpc/service.proto package accounting diff --git a/accounting/grpc/service_grpc.pb.go b/accounting/grpc/service_grpc.pb.go index 1e1b17e..1aadfc0 100644 --- a/accounting/grpc/service_grpc.pb.go +++ b/accounting/grpc/service_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.3.0 -// - protoc v3.21.9 +// - protoc v4.23.4 // source: accounting/grpc/service.proto package accounting diff --git a/accounting/grpc/types.pb.go b/accounting/grpc/types.pb.go index b8dff21..ae09338 100644 --- a/accounting/grpc/types.pb.go +++ b/accounting/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.9 +// protoc-gen-go v1.30.0 +// protoc v4.23.4 // source: accounting/grpc/types.proto package accounting diff --git a/acl/grpc/types.pb.go b/acl/grpc/types.pb.go index 94a8e47..e245169 100644 --- a/acl/grpc/types.pb.go +++ b/acl/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.9 +// protoc-gen-go v1.30.0 +// protoc v4.23.4 // source: acl/grpc/types.proto package acl diff --git a/audit/grpc/types.pb.go b/audit/grpc/types.pb.go index a2cac43..8f437da 100644 --- a/audit/grpc/types.pb.go +++ b/audit/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.9 +// protoc-gen-go v1.30.0 +// protoc v4.23.4 // source: audit/grpc/types.proto package audit diff --git a/container/grpc/service.pb.go b/container/grpc/service.pb.go index e3bdaf0..8363e81 100644 --- a/container/grpc/service.pb.go +++ b/container/grpc/service.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.9 +// protoc-gen-go v1.30.0 +// protoc v4.23.4 // source: container/grpc/service.proto package container diff --git a/container/grpc/service_grpc.pb.go b/container/grpc/service_grpc.pb.go index c70bce7..754665f 100644 --- a/container/grpc/service_grpc.pb.go +++ b/container/grpc/service_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.3.0 -// - protoc v3.21.9 +// - protoc v4.23.4 // source: container/grpc/service.proto package container diff --git a/container/grpc/types.pb.go b/container/grpc/types.pb.go index 0cd53eb..59780d5 100644 --- a/container/grpc/types.pb.go +++ b/container/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.9 +// protoc-gen-go v1.30.0 +// protoc v4.23.4 // source: container/grpc/types.proto package container diff --git a/lock/grpc/types.pb.go b/lock/grpc/types.pb.go index 958476c..100d648 100644 --- a/lock/grpc/types.pb.go +++ b/lock/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.9 +// protoc-gen-go v1.30.0 +// protoc v4.23.4 // source: lock/grpc/types.proto package lock diff --git a/netmap/grpc/service.pb.go b/netmap/grpc/service.pb.go index acfe43c..711a3c9 100644 --- a/netmap/grpc/service.pb.go +++ b/netmap/grpc/service.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.9 +// protoc-gen-go v1.30.0 +// protoc v4.23.4 // source: netmap/grpc/service.proto package netmap diff --git a/netmap/grpc/service_grpc.pb.go b/netmap/grpc/service_grpc.pb.go index 3834c3d..dec7d7f 100644 --- a/netmap/grpc/service_grpc.pb.go +++ b/netmap/grpc/service_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.3.0 -// - protoc v3.21.9 +// - protoc v4.23.4 // source: netmap/grpc/service.proto package netmap diff --git a/netmap/grpc/types.pb.go b/netmap/grpc/types.pb.go index 9c6c489..f4991a9 100644 --- a/netmap/grpc/types.pb.go +++ b/netmap/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.30.0 -// protoc v3.12.4 +// protoc v4.23.4 // source: netmap/grpc/types.proto package netmap diff --git a/object/grpc/service.pb.go b/object/grpc/service.pb.go index c6ffb20..d339aef 100644 --- a/object/grpc/service.pb.go +++ b/object/grpc/service.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.30.0 -// protoc v3.21.9 +// protoc v4.23.4 // source: object/grpc/service.proto package object @@ -1592,16 +1592,16 @@ type PutRequest_Body_Init struct { Signature *grpc1.Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` // Object's Header Header *Header `protobuf:"bytes,3,opt,name=header,proto3" json:"header,omitempty"` - // Number of copies of the object to store within the RPC call. By default, - // object is processed according to the container's placement policy. - // Can be one of: + // Number of copies of the object to store within the RPC call. By + // default, object is processed according to the container's placement + // policy. Can be one of: // 1. A single number; applied to the whole request and is treated as // a minimal number of nodes that must store an object to complete the // request successfully. // 2. An ordered array; every number is treated as a minimal number of // nodes in a corresponding placement vector that must store an object - // to complete the request successfully. The length MUST equal the placement - // vectors number, otherwise request is considered malformed. + // to complete the request successfully. The length MUST equal the + // placement vectors number, otherwise request is considered malformed. CopiesNumber []uint32 `protobuf:"varint,4,rep,packed,name=copies_number,json=copiesNumber,proto3" json:"copies_number,omitempty"` } @@ -2049,11 +2049,11 @@ func (x *SearchRequest_Body) GetFilters() []*SearchRequest_Body_Filter { return nil } -// Filter structure checks if the object header field or the attribute content -// matches a value. +// Filter structure checks if the object header field or the attribute +// content matches a value. // // If no filters are set, search request will return all objects of the -// container, including Regular object, Tombstones and Storage Group +// container, including Regular object and Tombstone // objects. Most human users expect to get only object they can directly // work with. In that case, `$Object:ROOT` filter should be used. // @@ -2088,11 +2088,11 @@ func (x *SearchRequest_Body) GetFilters() []*SearchRequest_Body_Filter { // properties: // // - $Object:ROOT \ -// Returns only `REGULAR` type objects that are not split or that are the top -// level root objects in a split hierarchy. This includes objects not +// Returns only `REGULAR` type objects that are not split or that are the +// top level root objects in a split hierarchy. This includes objects not // present physically, like large objects split into smaller objects // without a separate top-level root object. Objects of other types like -// StorageGroups and Tombstones will not be shown. This filter may be +// Locks and Tombstones will not be shown. This filter may be // useful for listing objects like `ls` command of some virtual file // system. This filter is activated if the `key` exists, disregarding the // value and matcher type. @@ -2101,8 +2101,8 @@ func (x *SearchRequest_Body) GetFilters() []*SearchRequest_Body_Filter { // activated if the `key` exists, disregarding the value and matcher type. // // Note: using filters with a key with prefix `$Object:` and match type -// `NOT_PRESENT `is not recommended since this is not a cross-version approach. -// Behavior when processing this kind of filters is undefined. +// `NOT_PRESENT `is not recommended since this is not a cross-version +// approach. Behavior when processing this kind of filters is undefined. type SearchRequest_Body_Filter struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache diff --git a/object/grpc/service_grpc.pb.go b/object/grpc/service_grpc.pb.go index 3c71ec8..985b991 100644 --- a/object/grpc/service_grpc.pb.go +++ b/object/grpc/service_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.3.0 -// - protoc v3.21.9 +// - protoc v4.23.4 // source: object/grpc/service.proto package object @@ -34,11 +34,11 @@ const ( // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. type ObjectServiceClient interface { // Receive full object structure, including Headers and payload. Response uses - // gRPC stream. First response message carries the object with the requested address. - // Chunk messages are parts of the object's payload if it is needed. All - // messages, except the first one, carry payload chunks. The requested object can - // be restored by concatenation of object message payload and all chunks - // keeping the receiving order. + // gRPC stream. First response message carries the object with the requested + // address. Chunk messages are parts of the object's payload if it is needed. + // All messages, except the first one, carry payload chunks. The requested + // object can be restored by concatenation of object message payload and all + // chunks keeping the receiving order. // // Extended headers can change `Get` behaviour: // - [ __SYSTEM__NETMAP_EPOCH ] \ @@ -47,9 +47,10 @@ type ObjectServiceClient interface { // calculation. // - [ __SYSTEM__NETMAP_LOOKUP_DEPTH ] \ // (`__NEOFS__NETMAP_LOOKUP_DEPTH` is deprecated) \ - // Will try older versions (starting from `__SYSTEM__NETMAP_EPOCH` (`__NEOFS__NETMAP_EPOCH` is deprecated) if specified or - // the latest one otherwise) of Network Map to find an object until the depth - // limit is reached. + // Will try older versions (starting from `__SYSTEM__NETMAP_EPOCH` + // (`__NEOFS__NETMAP_EPOCH` is deprecated) if specified or the latest one + // otherwise) of Network Map to find an object until the depth limit is + // reached. // // Please refer to detailed `XHeader` description. // @@ -90,15 +91,16 @@ type ObjectServiceClient interface { // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ // write access to the container is denied; // - **LOCKED** (2050, SECTION_OBJECT): \ - // placement of an object of type TOMBSTONE that includes at least one locked - // object is prohibited; + // placement of an object of type TOMBSTONE that includes at least one + // locked object is prohibited; // - **LOCK_NON_REGULAR_OBJECT** (2051, SECTION_OBJECT): \ // placement of an object of type LOCK that includes at least one object of // type other than REGULAR is prohibited; // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ // object storage container not found; // - **TOKEN_NOT_FOUND** (4096, SECTION_SESSION): \ - // (for trusted object preparation) session private key does not exist or has + // (for trusted object preparation) session private key does not exist or + // has // // been deleted; // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ @@ -121,6 +123,9 @@ type ObjectServiceClient interface { // - Common failures (SECTION_FAILURE_COMMON); // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ // delete access to the object is denied; + // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ + // the object could not be deleted because it has not been \ + // found within the container; // - **LOCKED** (2050, SECTION_OBJECT): \ // deleting a locked object is prohibited; // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ @@ -180,8 +185,8 @@ type ObjectServiceClient interface { Search(ctx context.Context, in *SearchRequest, opts ...grpc.CallOption) (ObjectService_SearchClient, error) // Get byte range of data payload. Range is set as an (offset, length) tuple. // Like in `Get` method, the response uses gRPC stream. Requested range can be - // restored by concatenation of all received payload chunks keeping the receiving - // order. + // restored by concatenation of all received payload chunks keeping the + // receiving order. // // Extended headers can change `GetRange` behaviour: // - [ __SYSTEM__NETMAP_EPOCH ] \ @@ -245,9 +250,8 @@ type ObjectServiceClient interface { // provided session token has expired. GetRangeHash(ctx context.Context, in *GetRangeHashRequest, opts ...grpc.CallOption) (*GetRangeHashResponse, error) // Put the prepared object into container. - // `ContainerID`, `ObjectID` and `OwnerID` of an object - // MUST be set. Session token MUST be obtained before `PUT SINGLE` operation (see - // session package). + // `ContainerID`, `ObjectID`, `OwnerID`, `PayloadHash` and `PayloadLength` of + // an object MUST be set. // // Extended headers can change `Put` behaviour: // - [ __SYSTEM__NETMAP_EPOCH \ @@ -264,15 +268,16 @@ type ObjectServiceClient interface { // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ // write access to the container is denied; // - **LOCKED** (2050, SECTION_OBJECT): \ - // placement of an object of type TOMBSTONE that includes at least one locked - // object is prohibited; + // placement of an object of type TOMBSTONE that includes at least one + // locked object is prohibited; // - **LOCK_NON_REGULAR_OBJECT** (2051, SECTION_OBJECT): \ // placement of an object of type LOCK that includes at least one object of // type other than REGULAR is prohibited; // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ // object storage container not found; // - **TOKEN_NOT_FOUND** (4096, SECTION_SESSION): \ - // (for trusted object preparation) session private key does not exist or has + // (for trusted object preparation) session private key does not exist or + // has // // been deleted; // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ @@ -459,11 +464,11 @@ func (c *objectServiceClient) PutSingle(ctx context.Context, in *PutSingleReques // for forward compatibility type ObjectServiceServer interface { // Receive full object structure, including Headers and payload. Response uses - // gRPC stream. First response message carries the object with the requested address. - // Chunk messages are parts of the object's payload if it is needed. All - // messages, except the first one, carry payload chunks. The requested object can - // be restored by concatenation of object message payload and all chunks - // keeping the receiving order. + // gRPC stream. First response message carries the object with the requested + // address. Chunk messages are parts of the object's payload if it is needed. + // All messages, except the first one, carry payload chunks. The requested + // object can be restored by concatenation of object message payload and all + // chunks keeping the receiving order. // // Extended headers can change `Get` behaviour: // - [ __SYSTEM__NETMAP_EPOCH ] \ @@ -472,9 +477,10 @@ type ObjectServiceServer interface { // calculation. // - [ __SYSTEM__NETMAP_LOOKUP_DEPTH ] \ // (`__NEOFS__NETMAP_LOOKUP_DEPTH` is deprecated) \ - // Will try older versions (starting from `__SYSTEM__NETMAP_EPOCH` (`__NEOFS__NETMAP_EPOCH` is deprecated) if specified or - // the latest one otherwise) of Network Map to find an object until the depth - // limit is reached. + // Will try older versions (starting from `__SYSTEM__NETMAP_EPOCH` + // (`__NEOFS__NETMAP_EPOCH` is deprecated) if specified or the latest one + // otherwise) of Network Map to find an object until the depth limit is + // reached. // // Please refer to detailed `XHeader` description. // @@ -515,15 +521,16 @@ type ObjectServiceServer interface { // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ // write access to the container is denied; // - **LOCKED** (2050, SECTION_OBJECT): \ - // placement of an object of type TOMBSTONE that includes at least one locked - // object is prohibited; + // placement of an object of type TOMBSTONE that includes at least one + // locked object is prohibited; // - **LOCK_NON_REGULAR_OBJECT** (2051, SECTION_OBJECT): \ // placement of an object of type LOCK that includes at least one object of // type other than REGULAR is prohibited; // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ // object storage container not found; // - **TOKEN_NOT_FOUND** (4096, SECTION_SESSION): \ - // (for trusted object preparation) session private key does not exist or has + // (for trusted object preparation) session private key does not exist or + // has // // been deleted; // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ @@ -546,6 +553,9 @@ type ObjectServiceServer interface { // - Common failures (SECTION_FAILURE_COMMON); // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ // delete access to the object is denied; + // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ + // the object could not be deleted because it has not been \ + // found within the container; // - **LOCKED** (2050, SECTION_OBJECT): \ // deleting a locked object is prohibited; // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ @@ -605,8 +615,8 @@ type ObjectServiceServer interface { Search(*SearchRequest, ObjectService_SearchServer) error // Get byte range of data payload. Range is set as an (offset, length) tuple. // Like in `Get` method, the response uses gRPC stream. Requested range can be - // restored by concatenation of all received payload chunks keeping the receiving - // order. + // restored by concatenation of all received payload chunks keeping the + // receiving order. // // Extended headers can change `GetRange` behaviour: // - [ __SYSTEM__NETMAP_EPOCH ] \ @@ -670,9 +680,8 @@ type ObjectServiceServer interface { // provided session token has expired. GetRangeHash(context.Context, *GetRangeHashRequest) (*GetRangeHashResponse, error) // Put the prepared object into container. - // `ContainerID`, `ObjectID` and `OwnerID` of an object - // MUST be set. Session token MUST be obtained before `PUT SINGLE` operation (see - // session package). + // `ContainerID`, `ObjectID`, `OwnerID`, `PayloadHash` and `PayloadLength` of + // an object MUST be set. // // Extended headers can change `Put` behaviour: // - [ __SYSTEM__NETMAP_EPOCH \ @@ -689,15 +698,16 @@ type ObjectServiceServer interface { // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ // write access to the container is denied; // - **LOCKED** (2050, SECTION_OBJECT): \ - // placement of an object of type TOMBSTONE that includes at least one locked - // object is prohibited; + // placement of an object of type TOMBSTONE that includes at least one + // locked object is prohibited; // - **LOCK_NON_REGULAR_OBJECT** (2051, SECTION_OBJECT): \ // placement of an object of type LOCK that includes at least one object of // type other than REGULAR is prohibited; // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ // object storage container not found; // - **TOKEN_NOT_FOUND** (4096, SECTION_SESSION): \ - // (for trusted object preparation) session private key does not exist or has + // (for trusted object preparation) session private key does not exist or + // has // // been deleted; // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ diff --git a/object/grpc/types.pb.go b/object/grpc/types.pb.go index 5c79080..c6f2c7a 100644 --- a/object/grpc/types.pb.go +++ b/object/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.30.0 -// protoc v3.21.9 +// protoc v4.23.4 // source: object/grpc/types.proto package object @@ -23,13 +23,12 @@ const ( ) // Type of the object payload content. Only `REGULAR` type objects can be split, -// hence `TOMBSTONE`, `STORAGE_GROUP` and `LOCK` payload is limited by the maximum -// object size. +// hence `TOMBSTONE` and `LOCK` payload is limited by the +// maximum object size. // // String presentation of object type is the same as definition: // * REGULAR // * TOMBSTONE -// * STORAGE_GROUP // * LOCK type ObjectType int32 @@ -38,8 +37,6 @@ const ( ObjectType_REGULAR ObjectType = 0 // Used internally to identify deleted objects ObjectType_TOMBSTONE ObjectType = 1 - // StorageGroup information - ObjectType_STORAGE_GROUP ObjectType = 2 // Object lock ObjectType_LOCK ObjectType = 3 ) @@ -49,14 +46,12 @@ var ( ObjectType_name = map[int32]string{ 0: "REGULAR", 1: "TOMBSTONE", - 2: "STORAGE_GROUP", 3: "LOCK", } ObjectType_value = map[string]int32{ - "REGULAR": 0, - "TOMBSTONE": 1, - "STORAGE_GROUP": 2, - "LOCK": 3, + "REGULAR": 0, + "TOMBSTONE": 1, + "LOCK": 3, } ) @@ -396,8 +391,8 @@ func (x *Header) GetSplit() *Header_Split { } // Object structure. Object is immutable and content-addressed. It means -// `ObjectID` will change if the header or the payload changes. It's calculated as a -// hash of header field which contains hash of the object's payload. +// `ObjectID` will change if the header or the payload changes. It's calculated +// as a hash of header field which contains hash of the object's payload. // // For non-regular object types payload format depends on object type specified // in the header. @@ -478,8 +473,8 @@ func (x *Object) GetPayload() []byte { // Meta information of split hierarchy for object assembly. With the last part // one can traverse linked list of split hierarchy back to the first part and -// assemble the original object. With a linking object one can assemble an object -// right from the object parts. +// assemble the original object. With a linking object one can assemble an +// object right from the object parts. type SplitInfo struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -556,8 +551,8 @@ func (x *SplitInfo) GetLink() *grpc.ObjectID { // Objects with duplicated attribute names or attributes with empty values // will be considered invalid. // -// There are some "well-known" attributes starting with `__SYSTEM__` (`__NEOFS__` is deprecated) prefix -// that affect system behaviour: +// There are some "well-known" attributes starting with `__SYSTEM__` +// (`__NEOFS__` is deprecated) prefix that affect system behaviour: // // - [ __SYSTEM__UPLOAD_ID ] \ // (`__NEOFS__UPLOAD_ID` is deprecated) \ @@ -869,25 +864,24 @@ var file_object_grpc_types_proto_rawDesc = []byte{ 0x61, 0x73, 0x74, 0x50, 0x61, 0x72, 0x74, 0x12, 0x2c, 0x0a, 0x04, 0x6c, 0x69, 0x6e, 0x6b, 0x18, 0x03, 0x20, 0x01, 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, - 0x04, 0x6c, 0x69, 0x6e, 0x6b, 0x2a, 0x45, 0x0a, 0x0a, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x54, + 0x04, 0x6c, 0x69, 0x6e, 0x6b, 0x2a, 0x32, 0x0a, 0x0a, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x52, 0x45, 0x47, 0x55, 0x4c, 0x41, 0x52, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x54, 0x4f, 0x4d, 0x42, 0x53, 0x54, 0x4f, 0x4e, 0x45, 0x10, 0x01, 0x12, - 0x11, 0x0a, 0x0d, 0x53, 0x54, 0x4f, 0x52, 0x41, 0x47, 0x45, 0x5f, 0x47, 0x52, 0x4f, 0x55, 0x50, - 0x10, 0x02, 0x12, 0x08, 0x0a, 0x04, 0x4c, 0x4f, 0x43, 0x4b, 0x10, 0x03, 0x2a, 0x73, 0x0a, 0x09, - 0x4d, 0x61, 0x74, 0x63, 0x68, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1a, 0x0a, 0x16, 0x4d, 0x41, 0x54, - 0x43, 0x48, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, - 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x10, 0x0a, 0x0c, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x5f, - 0x45, 0x51, 0x55, 0x41, 0x4c, 0x10, 0x01, 0x12, 0x14, 0x0a, 0x10, 0x53, 0x54, 0x52, 0x49, 0x4e, - 0x47, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x45, 0x51, 0x55, 0x41, 0x4c, 0x10, 0x02, 0x12, 0x0f, 0x0a, - 0x0b, 0x4e, 0x4f, 0x54, 0x5f, 0x50, 0x52, 0x45, 0x53, 0x45, 0x4e, 0x54, 0x10, 0x03, 0x12, 0x11, - 0x0a, 0x0d, 0x43, 0x4f, 0x4d, 0x4d, 0x4f, 0x4e, 0x5f, 0x50, 0x52, 0x45, 0x46, 0x49, 0x58, 0x10, - 0x04, 0x42, 0x61, 0x5a, 0x42, 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, 0x61, 0x70, 0x69, 0x2d, 0x67, - 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2f, 0x67, 0x72, 0x70, 0x63, - 0x3b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0xaa, 0x02, 0x1a, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, - 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x4f, 0x62, - 0x6a, 0x65, 0x63, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x08, 0x0a, 0x04, 0x4c, 0x4f, 0x43, 0x4b, 0x10, 0x03, 0x2a, 0x73, 0x0a, 0x09, 0x4d, 0x61, 0x74, + 0x63, 0x68, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1a, 0x0a, 0x16, 0x4d, 0x41, 0x54, 0x43, 0x48, 0x5f, + 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, + 0x10, 0x00, 0x12, 0x10, 0x0a, 0x0c, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x5f, 0x45, 0x51, 0x55, + 0x41, 0x4c, 0x10, 0x01, 0x12, 0x14, 0x0a, 0x10, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x5f, 0x4e, + 0x4f, 0x54, 0x5f, 0x45, 0x51, 0x55, 0x41, 0x4c, 0x10, 0x02, 0x12, 0x0f, 0x0a, 0x0b, 0x4e, 0x4f, + 0x54, 0x5f, 0x50, 0x52, 0x45, 0x53, 0x45, 0x4e, 0x54, 0x10, 0x03, 0x12, 0x11, 0x0a, 0x0d, 0x43, + 0x4f, 0x4d, 0x4d, 0x4f, 0x4e, 0x5f, 0x50, 0x52, 0x45, 0x46, 0x49, 0x58, 0x10, 0x04, 0x42, 0x61, + 0x5a, 0x42, 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, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, + 0x32, 0x2f, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x6f, 0x62, + 0x6a, 0x65, 0x63, 0x74, 0xaa, 0x02, 0x1a, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, + 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, + 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/object/types.go b/object/types.go index d22b428..c28bf35 100644 --- a/object/types.go +++ b/object/types.go @@ -324,7 +324,7 @@ type PutSingleResponse struct { const ( TypeRegular Type = iota TypeTombstone - TypeStorageGroup + _ TypeLock ) diff --git a/refs/grpc/types.pb.go b/refs/grpc/types.pb.go index f16583b..cfb51ea 100644 --- a/refs/grpc/types.pb.go +++ b/refs/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.9 +// protoc-gen-go v1.30.0 +// protoc v4.23.4 // source: refs/grpc/types.proto package refs diff --git a/session/grpc/service.pb.go b/session/grpc/service.pb.go index 5ba114d..c01bfa8 100644 --- a/session/grpc/service.pb.go +++ b/session/grpc/service.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.9 +// protoc-gen-go v1.30.0 +// protoc v4.23.4 // source: session/grpc/service.proto package session diff --git a/session/grpc/service_grpc.pb.go b/session/grpc/service_grpc.pb.go index 32793fe..a67c47a 100644 --- a/session/grpc/service_grpc.pb.go +++ b/session/grpc/service_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.3.0 -// - protoc v3.21.9 +// - protoc v4.23.4 // source: session/grpc/service.proto package session diff --git a/session/grpc/types.pb.go b/session/grpc/types.pb.go index 25e0715..23e46c7 100644 --- a/session/grpc/types.pb.go +++ b/session/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.9 +// protoc-gen-go v1.30.0 +// protoc v4.23.4 // source: session/grpc/types.proto package session diff --git a/status/grpc/types.pb.go b/status/grpc/types.pb.go index a30533f..ddbaa6c 100644 --- a/status/grpc/types.pb.go +++ b/status/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.9 +// protoc-gen-go v1.30.0 +// protoc v4.23.4 // source: status/grpc/types.proto package status diff --git a/tombstone/grpc/types.pb.go b/tombstone/grpc/types.pb.go index d1065ba..109a131 100644 --- a/tombstone/grpc/types.pb.go +++ b/tombstone/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.9 +// protoc-gen-go v1.30.0 +// protoc v4.23.4 // source: tombstone/grpc/types.proto package tombstone diff --git a/util/proto/test/test.pb.go b/util/proto/test/test.pb.go index 0dfa4dc..2fa2d4e 100644 --- a/util/proto/test/test.pb.go +++ b/util/proto/test/test.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.9 +// protoc-gen-go v1.30.0 +// protoc v4.23.4 // source: util/proto/test/test.proto package test From 309aa4ac787a1707e1eb082463f17a1684d5a19e Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Thu, 14 Sep 2023 13:20:05 +0300 Subject: [PATCH 1098/1196] Release v2.16.0 Signed-off-by: Evgenii Stratonikov --- CHANGELOG.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 887bce5..77bf5a2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,11 +2,23 @@ ## [Unreleased] +### Added +### Fixed +### Changed +### Removed +### Updated + +## [2.16.0] - 2023-09-14 - Academy of Sciences Glacier + ### Added - Add impersonate flag to bearer token (#17) +- `NOT` and `UNIQUE` keywords to the placement policy (#26) +- `PutSingle` RPC (#45) ### Fixed ### Changed +- `StableSize()` is optimized and no does no allocations (#49) +- Marshaling code now uses `protowire` package (#50) ### Removed - Reputation system (#21) From f50872f1bcf2592c31d3de2fb1cf0b18120adab3 Mon Sep 17 00:00:00 2001 From: Dmitrii Stepanov Date: Fri, 6 Oct 2023 15:05:30 +0300 Subject: [PATCH 1099/1196] [#58] object: Allow to set marshal data Now it is possible set marshaled data to reduce memory allocations. Signed-off-by: Dmitrii Stepanov --- object/marshal.go | 48 ++++++++++++++++++++++++++++++++++++++++ object/types.go | 6 +++++ util/proto/marshal.go | 25 +++++++++++++++++++++ util/signature/buffer.go | 7 ++++++ util/signature/data.go | 12 ++++++---- 5 files changed, 94 insertions(+), 4 deletions(-) diff --git a/object/marshal.go b/object/marshal.go index fe0e232..18172e6 100644 --- a/object/marshal.go +++ b/object/marshal.go @@ -322,6 +322,14 @@ func (o *Object) StableMarshal(buf []byte) []byte { return []byte{} } + if o.marshalData != nil { + if buf == nil { + return o.marshalData + } + copy(buf, o.marshalData) + return buf + } + if buf == nil { buf = make([]byte, o.StableSize()) } @@ -336,6 +344,20 @@ func (o *Object) StableMarshal(buf []byte) []byte { return buf } +// SetMarshalData sets marshal data to reduce memory allocations. +// +// It is unsafe to modify object data after setting marshal data. +func (o *Object) SetMarshalData(data []byte) { + if o == nil { + return + } + if data == nil { + o.marshalData = o.StableMarshal(nil) + } else { + o.marshalData = data + } +} + func (o *Object) StableSize() (size int) { if o == nil { return 0 @@ -1071,6 +1093,15 @@ func (r *PutSingleRequestBody) StableMarshal(buf []byte) []byte { if r == nil { return []byte{} } + + if r.marshalData != nil { + if buf == nil { + return r.marshalData + } + copy(buf, r.marshalData) + return buf + } + if buf == nil { buf = make([]byte, r.StableSize()) } @@ -1082,6 +1113,23 @@ func (r *PutSingleRequestBody) StableMarshal(buf []byte) []byte { return buf } +// SetMarshalData sets marshal data to reduce memory allocations. +// +// It is unsafe to modify request data after setting marshal data. +func (r *PutSingleRequestBody) SetMarshalData(data []byte) { + if r == nil { + return + } + + if data == nil { + r.marshalData = r.StableMarshal(nil) + } else { + r.marshalData = data + } + + proto.NestedStructureSetMarshalData(putSingleReqObjectField, r.marshalData, r.object) +} + func (r *PutSingleRequestBody) StableSize() int { if r == nil { return 0 diff --git a/object/types.go b/object/types.go index c28bf35..895afb0 100644 --- a/object/types.go +++ b/object/types.go @@ -75,6 +75,9 @@ type Object struct { header *Header payload []byte + + // marshalData holds marshaled data, must not be marshaled by StableMarshal + marshalData []byte } type SplitInfo struct { @@ -304,6 +307,9 @@ type GetRangeHashResponse struct { type PutSingleRequestBody struct { object *Object copyNum []uint32 + + // marshalData holds marshaled data, must not be marshaled by StableMarshal + marshalData []byte } type PutSingleRequest struct { diff --git a/util/proto/marshal.go b/util/proto/marshal.go index 606086a..b16375a 100644 --- a/util/proto/marshal.go +++ b/util/proto/marshal.go @@ -19,6 +19,11 @@ type ( StableMarshal([]byte) []byte StableSize() int } + + setMarshalData interface { + SetMarshalData([]byte) + StableSize() int + } ) func BytesMarshal(field int, buf, v []byte) int { @@ -263,6 +268,26 @@ func NestedStructureMarshal[T stableMarshaller](field int64, buf []byte, v T) in return offset + n } +// NestedStructureSetMarshalData calculates offset for field in parentData +// and calls SetMarshalData for nested structure. +// +// Returns marshalled data length of nested structure. +func NestedStructureSetMarshalData(field int64, parentData []byte, v setMarshalData) int { + n := v.StableSize() + if n == 0 { + return 0 + } + + buf := make([]byte, binary.MaxVarintLen64) + prefix := protowire.EncodeTag(protowire.Number(field), protowire.BytesType) + offset := binary.PutUvarint(buf, prefix) + offset += binary.PutUvarint(buf, uint64(n)) + + v.SetMarshalData(parentData[offset : offset+n]) + + return offset + n +} + func NestedStructureSize[T stableMarshaller](field int64, v T) (size int) { n := v.StableSize() if n == 0 { diff --git a/util/signature/buffer.go b/util/signature/buffer.go index f9b003d..8102495 100644 --- a/util/signature/buffer.go +++ b/util/signature/buffer.go @@ -14,6 +14,13 @@ var buffersPool = sync.Pool{ }, } +func tryGetNewBufferFromPool(size int) (*buffer, bool) { + if size > poolSliceMaxSize { + return &buffer{}, false + } + return newBufferFromPool(size), true +} + func newBufferFromPool(size int) *buffer { result := buffersPool.Get().(*buffer) if cap(result.data) < size { diff --git a/util/signature/data.go b/util/signature/data.go index 1db46dc..4170e6c 100644 --- a/util/signature/data.go +++ b/util/signature/data.go @@ -35,8 +35,10 @@ func SignDataWithHandler(key *ecdsa.PrivateKey, src DataSource, handler KeySigna opts[i](cfg) } - buffer := newBufferFromPool(src.SignedDataSize()) - defer returnBufferToPool(buffer) + buffer, ok := tryGetNewBufferFromPool(src.SignedDataSize()) + if ok { + defer returnBufferToPool(buffer) + } data, err := src.ReadSignedData(buffer.data) if err != nil { @@ -64,8 +66,10 @@ func VerifyDataWithSource(dataSrc DataSource, sigSrc KeySignatureSource, opts .. opts[i](cfg) } - buffer := newBufferFromPool(dataSrc.SignedDataSize()) - defer returnBufferToPool(buffer) + buffer, ok := tryGetNewBufferFromPool(dataSrc.SignedDataSize()) + if ok { + defer returnBufferToPool(buffer) + } data, err := dataSrc.ReadSignedData(buffer.data) if err != nil { From 498877e378fd7ac579da24fb6eac642e0f225eca Mon Sep 17 00:00:00 2001 From: Dmitrii Stepanov Date: Fri, 6 Oct 2023 15:06:36 +0300 Subject: [PATCH 1100/1196] [#58] makefile: Disable test results caching Signed-off-by: Dmitrii Stepanov --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 6ceea25..e421213 100755 --- a/Makefile +++ b/Makefile @@ -56,7 +56,7 @@ protoc: # Run Unit Test with go test test: @echo "⇒ Running go test" - @GO111MODULE=on go test ./... + @GO111MODULE=on go test ./... -count=1 # Run linters lint: From 9cc209544683772a46bb0d47f7d132ad5572ff53 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Tue, 21 Nov 2023 10:59:15 +0300 Subject: [PATCH 1101/1196] [#59] util: Restore backwards compatibility in NestedStructureMarshal() Signed-off-by: Evgenii Stratonikov --- session/marshal.go | 4 ++-- util/proto/marshal.go | 38 ++++++++++++++++++++++++++------------ 2 files changed, 28 insertions(+), 14 deletions(-) diff --git a/session/marshal.go b/session/marshal.go index cda9579..8632398 100644 --- a/session/marshal.go +++ b/session/marshal.go @@ -211,7 +211,7 @@ func (c *ObjectSessionContext) StableMarshal(buf []byte) []byte { } offset := proto.EnumMarshal(objectCtxVerbField, buf, int32(c.verb)) - proto.NestedStructureMarshal(objectCtxTargetField, buf[offset:], objectSessionContextTarget{ + proto.NestedStructureMarshalUnchecked(objectCtxTargetField, buf[offset:], objectSessionContextTarget{ cnr: c.cnr, objs: c.objs, }) @@ -225,7 +225,7 @@ func (c *ObjectSessionContext) StableSize() (size int) { } size += proto.EnumSize(objectCtxVerbField, int32(c.verb)) - size += proto.NestedStructureSize(objectCtxTargetField, objectSessionContextTarget{ + size += proto.NestedStructureSizeUnchecked(objectCtxTargetField, objectSessionContextTarget{ cnr: c.cnr, objs: c.objs, }) diff --git a/util/proto/marshal.go b/util/proto/marshal.go index b16375a..2704960 100644 --- a/util/proto/marshal.go +++ b/util/proto/marshal.go @@ -20,9 +20,10 @@ type ( StableSize() int } - setMarshalData interface { + setMarshalData[T any] interface { SetMarshalData([]byte) StableSize() int + ~*T } ) @@ -254,12 +255,21 @@ func VarUIntSize(x uint64) int { return (bits.Len64(x|1) + 6) / 7 } -func NestedStructureMarshal[T stableMarshaller](field int64, buf []byte, v T) int { - n := v.StableSize() - if n == 0 { +type ptrStableMarshaler[T any] interface { + stableMarshaller + ~*T +} + +func NestedStructureMarshal[T any, M ptrStableMarshaler[T]](field int64, buf []byte, v M) int { + if v == nil { return 0 } + return NestedStructureMarshalUnchecked(field, buf, v) +} + +func NestedStructureMarshalUnchecked[T stableMarshaller](field int64, buf []byte, v T) int { + n := v.StableSize() prefix := protowire.EncodeTag(protowire.Number(field), protowire.BytesType) offset := binary.PutUvarint(buf, prefix) offset += binary.PutUvarint(buf[offset:], uint64(n)) @@ -272,12 +282,12 @@ func NestedStructureMarshal[T stableMarshaller](field int64, buf []byte, v T) in // and calls SetMarshalData for nested structure. // // Returns marshalled data length of nested structure. -func NestedStructureSetMarshalData(field int64, parentData []byte, v setMarshalData) int { - n := v.StableSize() - if n == 0 { +func NestedStructureSetMarshalData[T any, M setMarshalData[T]](field int64, parentData []byte, v M) int { + if v == nil { return 0 } + n := v.StableSize() buf := make([]byte, binary.MaxVarintLen64) prefix := protowire.EncodeTag(protowire.Number(field), protowire.BytesType) offset := binary.PutUvarint(buf, prefix) @@ -288,13 +298,17 @@ func NestedStructureSetMarshalData(field int64, parentData []byte, v setMarshalD return offset + n } -func NestedStructureSize[T stableMarshaller](field int64, v T) (size int) { - n := v.StableSize() - if n == 0 { +func NestedStructureSize[T any, M ptrStableMarshaler[T]](field int64, v M) (size int) { + if v == nil { return 0 } - size = protowire.SizeGroup(protowire.Number(field), protowire.SizeBytes(n)) - return + + return NestedStructureSizeUnchecked(field, v) +} + +func NestedStructureSizeUnchecked[T stableMarshaller](field int64, v T) int { + n := v.StableSize() + return protowire.SizeGroup(protowire.Number(field), protowire.SizeBytes(n)) } func Fixed64Marshal(field int, buf []byte, v uint64) int { From b46e8cfbda9976d6f144001e395f81ac0c65329a Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Tue, 21 Nov 2023 11:21:05 +0300 Subject: [PATCH 1102/1196] [#59] util: Rename stableMarshaler It should be with a single `l`, see `json.Marshaler`. Signed-off-by: Evgenii Stratonikov --- util/proto/marshal.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/util/proto/marshal.go b/util/proto/marshal.go index 2704960..768cb2b 100644 --- a/util/proto/marshal.go +++ b/util/proto/marshal.go @@ -15,7 +15,7 @@ import ( ) type ( - stableMarshaller interface { + stableMarshaler interface { StableMarshal([]byte) []byte StableSize() int } @@ -256,7 +256,7 @@ func VarUIntSize(x uint64) int { } type ptrStableMarshaler[T any] interface { - stableMarshaller + stableMarshaler ~*T } @@ -268,7 +268,7 @@ func NestedStructureMarshal[T any, M ptrStableMarshaler[T]](field int64, buf []b return NestedStructureMarshalUnchecked(field, buf, v) } -func NestedStructureMarshalUnchecked[T stableMarshaller](field int64, buf []byte, v T) int { +func NestedStructureMarshalUnchecked[T stableMarshaler](field int64, buf []byte, v T) int { n := v.StableSize() prefix := protowire.EncodeTag(protowire.Number(field), protowire.BytesType) offset := binary.PutUvarint(buf, prefix) @@ -306,7 +306,7 @@ func NestedStructureSize[T any, M ptrStableMarshaler[T]](field int64, v M) (size return NestedStructureSizeUnchecked(field, v) } -func NestedStructureSizeUnchecked[T stableMarshaller](field int64, v T) int { +func NestedStructureSizeUnchecked[T stableMarshaler](field int64, v T) int { n := v.StableSize() return protowire.SizeGroup(protowire.Number(field), protowire.SizeBytes(n)) } From 72885aae835cf962286d3a87f88209f18177617b Mon Sep 17 00:00:00 2001 From: Alexander Chuprov Date: Fri, 12 Jan 2024 18:09:28 +0300 Subject: [PATCH 1103/1196] [#62] signature: Refactor BufferPool Signed-off-by: Alexander Chuprov --- util/pool/buffer.go | 54 +++++++++++++++++++++++++++++++++++++++ util/signature/buffer.go | 40 ----------------------------- util/signature/data.go | 21 +++++++-------- util/signature/options.go | 16 ++++++------ 4 files changed, 73 insertions(+), 58 deletions(-) create mode 100644 util/pool/buffer.go delete mode 100644 util/signature/buffer.go diff --git a/util/pool/buffer.go b/util/pool/buffer.go new file mode 100644 index 0000000..e0a7185 --- /dev/null +++ b/util/pool/buffer.go @@ -0,0 +1,54 @@ +package pool + +import ( + "sync" +) + +// Buffer contains a byte slice. +type Buffer struct { + Data []byte +} + +// BufferPool manages a pool of Buffers. +type BufferPool struct { + poolSliceSize uint32 // Size for the buffer slices in the pool. + buffersPool *sync.Pool +} + +// NewBufferPool creates a BufferPool with a specified size. +func NewBufferPool(poolSliceSize uint32) BufferPool { + pool := sync.Pool{ + New: func() any { + return new(Buffer) + }, + } + return BufferPool{poolSliceSize: poolSliceSize, buffersPool: &pool} +} + +// Get retrieves a Buffer from the pool or creates a new one if necessary. +// It ensures the buffer's capacity is at least the specified size. +func (pool BufferPool) Get(size uint32) *Buffer { + result := pool.buffersPool.Get().(*Buffer) + + if cap(result.Data) < int(size) { + result.Data = make([]byte, size) + } else { + result.Data = result.Data[:size] + } + return result +} + +// Put returns a Buffer to the pool if its capacity does not exceed poolSliceSize. +func (pool BufferPool) Put(buf *Buffer) { + if cap(buf.Data) > int(pool.poolSliceSize) { + return + } + + buf.Data = buf.Data[:0] + pool.buffersPool.Put(buf) +} + +// PoolSliceSize returns the size for buffer slices in the pool. +func (pool BufferPool) PoolSliceSize() uint32 { + return uint32(pool.poolSliceSize) +} diff --git a/util/signature/buffer.go b/util/signature/buffer.go deleted file mode 100644 index 8102495..0000000 --- a/util/signature/buffer.go +++ /dev/null @@ -1,40 +0,0 @@ -package signature - -import "sync" - -const poolSliceMaxSize = 128 * 1024 - -type buffer struct { - data []byte -} - -var buffersPool = sync.Pool{ - New: func() any { - return new(buffer) - }, -} - -func tryGetNewBufferFromPool(size int) (*buffer, bool) { - if size > poolSliceMaxSize { - return &buffer{}, false - } - return newBufferFromPool(size), true -} - -func newBufferFromPool(size int) *buffer { - result := buffersPool.Get().(*buffer) - if cap(result.data) < size { - result.data = make([]byte, size) - } else { - result.data = result.data[:size] - } - return result -} - -func returnBufferToPool(buf *buffer) { - if cap(buf.data) > poolSliceMaxSize { - return - } - buf.data = buf.data[:0] - buffersPool.Put(buf) -} diff --git a/util/signature/data.go b/util/signature/data.go index 4170e6c..5e7c310 100644 --- a/util/signature/data.go +++ b/util/signature/data.go @@ -4,9 +4,14 @@ import ( "crypto/ecdsa" "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/pool" crypto "git.frostfs.info/TrueCloudLab/frostfs-crypto" ) +const poolSliceMaxSize = 128 * 1024 + +var buffersPool = pool.NewBufferPool(poolSliceMaxSize) + type DataSource interface { ReadSignedData([]byte) ([]byte, error) SignedDataSize() int @@ -35,12 +40,10 @@ func SignDataWithHandler(key *ecdsa.PrivateKey, src DataSource, handler KeySigna opts[i](cfg) } - buffer, ok := tryGetNewBufferFromPool(src.SignedDataSize()) - if ok { - defer returnBufferToPool(buffer) - } + buffer := buffersPool.Get(uint32(src.SignedDataSize())) + defer buffersPool.Put(buffer) - data, err := src.ReadSignedData(buffer.data) + data, err := src.ReadSignedData(buffer.Data) if err != nil { return err } @@ -66,12 +69,10 @@ func VerifyDataWithSource(dataSrc DataSource, sigSrc KeySignatureSource, opts .. opts[i](cfg) } - buffer, ok := tryGetNewBufferFromPool(dataSrc.SignedDataSize()) - if ok { - defer returnBufferToPool(buffer) - } + buffer := buffersPool.Get(uint32(dataSrc.SignedDataSize())) + defer buffersPool.Put(buffer) - data, err := dataSrc.ReadSignedData(buffer.data) + data, err := dataSrc.ReadSignedData(buffer.Data) if err != nil { return err } diff --git a/util/signature/options.go b/util/signature/options.go index b9bf68d..ca2a5e9 100644 --- a/util/signature/options.go +++ b/util/signature/options.go @@ -35,10 +35,10 @@ func verify(cfg *cfg, data []byte, sig *refs.Signature) error { case refs.ECDSA_RFC6979_SHA256: return crypto.VerifyRFC6979(pub, data, sig.GetSign()) case refs.ECDSA_RFC6979_SHA256_WALLET_CONNECT: - buffer := newBufferFromPool(base64.StdEncoding.EncodedLen(len(data))) - defer returnBufferToPool(buffer) - base64.StdEncoding.Encode(buffer.data, data) - if !walletconnect.Verify(pub, buffer.data, sig.GetSign()) { + buffer := buffersPool.Get(uint32(base64.StdEncoding.EncodedLen(len(data)))) + defer buffersPool.Put(buffer) + base64.StdEncoding.Encode(buffer.Data, data) + if !walletconnect.Verify(pub, buffer.Data, sig.GetSign()) { return crypto.ErrInvalidSignature } return nil @@ -54,10 +54,10 @@ func sign(cfg *cfg, key *ecdsa.PrivateKey, data []byte) ([]byte, error) { case refs.ECDSA_RFC6979_SHA256: return crypto.SignRFC6979(key, data) case refs.ECDSA_RFC6979_SHA256_WALLET_CONNECT: - buffer := newBufferFromPool(base64.StdEncoding.EncodedLen(len(data))) - defer returnBufferToPool(buffer) - base64.StdEncoding.Encode(buffer.data, data) - return walletconnect.Sign(key, buffer.data) + buffer := buffersPool.Get(uint32(base64.StdEncoding.EncodedLen(len(data)))) + defer buffersPool.Put(buffer) + base64.StdEncoding.Encode(buffer.Data, data) + return walletconnect.Sign(key, buffer.Data) default: panic(fmt.Sprintf("unsupported scheme %s", cfg.scheme)) } From d60ce83e4271747cb4ee89e55cdaa698f17011e9 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Fri, 26 Jan 2024 12:18:58 +0300 Subject: [PATCH 1104/1196] [#63] .forgejo: Update dco-go to v3 Signed-off-by: Evgenii Stratonikov --- .forgejo/workflows/dco.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.forgejo/workflows/dco.yml b/.forgejo/workflows/dco.yml index 6746408..9aa0d31 100644 --- a/.forgejo/workflows/dco.yml +++ b/.forgejo/workflows/dco.yml @@ -16,6 +16,6 @@ jobs: go-version: '1.21' - name: Run commit format checker - uses: https://git.frostfs.info/TrueCloudLab/dco-go@v2 + uses: https://git.frostfs.info/TrueCloudLab/dco-go@v3 with: from: 'origin/${{ github.event.pull_request.base.ref }}' From 2a124b95bc02c8a14f0d4d0dd3988efe331a6233 Mon Sep 17 00:00:00 2001 From: Dmitrii Stepanov Date: Thu, 15 Feb 2024 14:41:33 +0300 Subject: [PATCH 1105/1196] [#64] object: Allow to reset marshal data Signed-off-by: Dmitrii Stepanov --- object/marshal.go | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/object/marshal.go b/object/marshal.go index 18172e6..7f47d65 100644 --- a/object/marshal.go +++ b/object/marshal.go @@ -346,16 +346,12 @@ func (o *Object) StableMarshal(buf []byte) []byte { // SetMarshalData sets marshal data to reduce memory allocations. // -// It is unsafe to modify object data after setting marshal data. +// It is unsafe to modify/copy object data after setting marshal data. func (o *Object) SetMarshalData(data []byte) { if o == nil { return } - if data == nil { - o.marshalData = o.StableMarshal(nil) - } else { - o.marshalData = data - } + o.marshalData = data } func (o *Object) StableSize() (size int) { From 634e24aba71564e432c20a7fca787b23a19f5bf2 Mon Sep 17 00:00:00 2001 From: Dmitrii Stepanov Date: Thu, 15 Feb 2024 15:38:48 +0300 Subject: [PATCH 1106/1196] [#65] object: Fix SetMarshalData for PutSingle request Allow to reset marshal data Signed-off-by: Dmitrii Stepanov --- object/marshal.go | 8 ++------ util/proto/marshal.go | 5 +++++ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/object/marshal.go b/object/marshal.go index 7f47d65..ddd5746 100644 --- a/object/marshal.go +++ b/object/marshal.go @@ -1111,17 +1111,13 @@ func (r *PutSingleRequestBody) StableMarshal(buf []byte) []byte { // SetMarshalData sets marshal data to reduce memory allocations. // -// It is unsafe to modify request data after setting marshal data. +// It is unsafe to modify/copy request data after setting marshal data. func (r *PutSingleRequestBody) SetMarshalData(data []byte) { if r == nil { return } - if data == nil { - r.marshalData = r.StableMarshal(nil) - } else { - r.marshalData = data - } + r.marshalData = data proto.NestedStructureSetMarshalData(putSingleReqObjectField, r.marshalData, r.object) } diff --git a/util/proto/marshal.go b/util/proto/marshal.go index 768cb2b..26b3eb0 100644 --- a/util/proto/marshal.go +++ b/util/proto/marshal.go @@ -287,6 +287,11 @@ func NestedStructureSetMarshalData[T any, M setMarshalData[T]](field int64, pare return 0 } + if parentData == nil { + v.SetMarshalData(nil) + return 0 + } + n := v.StableSize() buf := make([]byte, binary.MaxVarintLen64) prefix := protowire.EncodeTag(protowire.Number(field), protowire.BytesType) From c1c7b344b9c058c587a01f045e2a81f1f8e6575f Mon Sep 17 00:00:00 2001 From: Dmitrii Stepanov Date: Wed, 6 Mar 2024 13:14:49 +0300 Subject: [PATCH 1107/1196] [#67] go.mod: Bump protobuf version Found by vulncheck: Vulnerability #1: GO-2024-2611 Infinite loop in JSON unmarshaling in google.golang.org/protobuf More info: https://pkg.go.dev/vuln/GO-2024-2611 Module: google.golang.org/protobuf Found in: google.golang.org/protobuf@v1.32.0 Fixed in: google.golang.org/protobuf@v1.33.0 Signed-off-by: Dmitrii Stepanov --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 78c1bdb..0315850 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/stretchr/testify v1.8.3 golang.org/x/sync v0.2.0 google.golang.org/grpc v1.55.0 - google.golang.org/protobuf v1.30.0 + google.golang.org/protobuf v1.33.0 ) require ( diff --git a/go.sum b/go.sum index bb23dce..56fc5d0 100644 --- a/go.sum +++ b/go.sum @@ -38,8 +38,8 @@ google.golang.org/grpc v1.55.0 h1:3Oj82/tFSCeUrRTg/5E/7d/W5A1tj6Ky1ABAuZuv5ag= google.golang.org/grpc v1.55.0/go.mod h1:iYEXKGkEBhg1PjZQvoYEVPTDkHo1/bjTnfwTeGONTY8= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= -google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= +google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= From f69ad7ade00fdbeb4fc9783122daba2580ebb722 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Thu, 14 Mar 2024 10:20:04 +0300 Subject: [PATCH 1108/1196] [#68] pre-commit: Remove gitlint Signed-off-by: Evgenii Stratonikov --- .gitlint | 10 ---------- .pre-commit-config.yaml | 6 ------ 2 files changed, 16 deletions(-) delete mode 100644 .gitlint diff --git a/.gitlint b/.gitlint deleted file mode 100644 index a1bb93d..0000000 --- a/.gitlint +++ /dev/null @@ -1,10 +0,0 @@ -[general] -fail-without-commits=true -contrib=CC1 - -[title-match-regex] -regex=^\[\#[0-9Xx]+\]\s - -[ignore-by-title] -regex=^Release(.*) -ignore=title-match-regex diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 3050af4..46c9c89 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -22,9 +22,3 @@ repos: rev: v1.51.2 hooks: - id: golangci-lint - - - repo: https://github.com/jorisroovers/gitlint - rev: v0.18.0 - hooks: - - id: gitlint - stages: [commit-msg] From 6fb9cae4793427b84b123430aca3477da6b837cc Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Thu, 14 Mar 2024 10:22:56 +0300 Subject: [PATCH 1109/1196] [#68] pre-commit: Update golangci-lint to 1.56.2 Signed-off-by: Evgenii Stratonikov --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 46c9c89..0e51210 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -19,6 +19,6 @@ repos: exclude: ".key$" - repo: https://github.com/golangci/golangci-lint - rev: v1.51.2 + rev: v1.56.2 hooks: - id: golangci-lint From a7bcad6aa9093b7edde5a1b2b5f7247b8e720af0 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Thu, 14 Mar 2024 10:25:23 +0300 Subject: [PATCH 1110/1196] [#68] Makefile: Drop GO111MODULE usages It is ignored since go1.17. Signed-off-by: Evgenii Stratonikov --- Makefile | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index e421213..cd5e84d 100755 --- a/Makefile +++ b/Makefile @@ -9,15 +9,12 @@ VERSION ?= $(shell git describe --tags --match "v*" --abbrev=8 --dirty --always) dep: @printf "⇒ Tidy requirements : " CGO_ENABLED=0 \ - GO111MODULE=on \ go mod tidy -v && echo OK @printf "⇒ Download requirements: " CGO_ENABLED=0 \ - GO111MODULE=on \ go mod download && echo OK @printf "⇒ Install test requirements: " CGO_ENABLED=0 \ - GO111MODULE=on \ go test ./... && echo OK # Run all code formatters @@ -27,14 +24,14 @@ fmts: fmt imports fmt: @echo "⇒ Processing gofmt check" @for f in `find . -type f -name '*.go' -not -path './vendor/*' -not -name '*.pb.go' -prune`; do \ - GO111MODULE=on gofmt -s -w $$f; \ + gofmt -s -w $$f; \ done # Reformat imports imports: @echo "⇒ Processing goimports check" @for f in `find . -type f -name '*.go' -not -path './vendor/*' -not -name '*.pb.go' -prune`; do \ - GO111MODULE=on goimports -w $$f; \ + goimports -w $$f; \ done # Regenerate code for proto files @@ -56,7 +53,7 @@ protoc: # Run Unit Test with go test test: @echo "⇒ Running go test" - @GO111MODULE=on go test ./... -count=1 + @go test ./... -count=1 # Run linters lint: From 4d35da7c775c9fccba8f98e963cd505d6dc9c47c Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Thu, 14 Mar 2024 10:24:04 +0300 Subject: [PATCH 1111/1196] [#68] Makefile: Allow to override testflags Signed-off-by: Evgenii Stratonikov --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index cd5e84d..888fd20 100755 --- a/Makefile +++ b/Makefile @@ -51,9 +51,10 @@ protoc: rm -rf vendor # Run Unit Test with go test +test: GOFLAGS ?= "-count=1" test: @echo "⇒ Running go test" - @go test ./... -count=1 + @GOFLAGS="$(GOFLAGS)" go test ./... # Run linters lint: From ea6e390c7b4d3336d66d88ef7d4fda69f8ea0cf6 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Thu, 14 Mar 2024 10:27:36 +0300 Subject: [PATCH 1112/1196] [#68] pre-commit: Add unit test hook Signed-off-by: Evgenii Stratonikov --- .pre-commit-config.yaml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0e51210..35769c1 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -18,6 +18,15 @@ repos: - id: end-of-file-fixer exclude: ".key$" + - repo: local + hooks: + - id: go-unit-tests + name: go unit tests + entry: make test GOFLAGS='' + pass_filenames: false + types: [go] + language: system + - repo: https://github.com/golangci/golangci-lint rev: v1.56.2 hooks: From a85146250b312fcdd6da9a71285527fed544234f Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Thu, 14 Mar 2024 10:31:18 +0300 Subject: [PATCH 1113/1196] [#68] Makefile: Use gofumpt for formatting Signed-off-by: Evgenii Stratonikov --- .pre-commit-config.yaml | 9 +++++++++ Makefile | 16 +++++++--------- object/attributes_test.go | 2 +- object/types.go | 3 +-- session/types.go | 3 ++- session/util.go | 12 ++++++++---- util/proto/marshal_test.go | 4 +--- util/protogen/main.go | 14 +++++++------- util/signature/walletconnect/sign_test.go | 1 - 9 files changed, 36 insertions(+), 28 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 35769c1..a64cbaa 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -18,6 +18,15 @@ repos: - id: end-of-file-fixer exclude: ".key$" + - repo: local + hooks: + - id: gofumpt + name: gofumpt + entry: make fumpt + pass_filenames: false + types: [go] + language: system + - repo: local hooks: - id: go-unit-tests diff --git a/Makefile b/Makefile index 888fd20..239565b 100755 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ SHELL = bash VERSION ?= $(shell git describe --tags --match "v*" --abbrev=8 --dirty --always) -.PHONY: dep fmts fmt imports protoc test lint version help +.PHONY: dep fmts fumpt imports protoc test lint version help # Pull go dependencies dep: @@ -18,14 +18,7 @@ dep: go test ./... && echo OK # Run all code formatters -fmts: fmt imports - -# Reformat code -fmt: - @echo "⇒ Processing gofmt check" - @for f in `find . -type f -name '*.go' -not -path './vendor/*' -not -name '*.pb.go' -prune`; do \ - gofmt -s -w $$f; \ - done +fmts: fumpt imports # Reformat imports imports: @@ -34,6 +27,11 @@ imports: goimports -w $$f; \ done +# Run gofumpt +fumpt: + @echo "⇒ Processing gofumpt check" + @gofumpt -l -w . + # Regenerate code for proto files protoc: @GOPRIVATE=github.com/TrueCloudLab go mod vendor diff --git a/object/attributes_test.go b/object/attributes_test.go index 5bf411a..85635da 100644 --- a/object/attributes_test.go +++ b/object/attributes_test.go @@ -10,7 +10,7 @@ import ( func TestSetNotification(t *testing.T) { o := new(Object) - var ni = NotificationInfo{ + ni := NotificationInfo{ epoch: 10, topic: "test", } diff --git a/object/types.go b/object/types.go index 895afb0..f9e2ed6 100644 --- a/object/types.go +++ b/object/types.go @@ -318,8 +318,7 @@ type PutSingleRequest struct { session.RequestHeaders } -type PutSingleResponseBody struct { -} +type PutSingleResponseBody struct{} type PutSingleResponse struct { body *PutSingleResponseBody diff --git a/session/types.go b/session/types.go index 19cfecc..5732b29 100644 --- a/session/types.go +++ b/session/types.go @@ -632,7 +632,8 @@ func (r *ResponseMetaHeader) SetStatus(v *status.Status) { func SetStatus(msg interface { GetMetaHeader() *ResponseMetaHeader SetMetaHeader(*ResponseMetaHeader) -}, st *status.Status) { +}, st *status.Status, +) { meta := msg.GetMetaHeader() if meta == nil { meta = new(ResponseMetaHeader) diff --git a/session/util.go b/session/util.go index 7edca29..ff19deb 100644 --- a/session/util.go +++ b/session/util.go @@ -43,7 +43,8 @@ func (c *RequestHeaders) SetVerificationHeader(v *RequestVerificationHeader) { func (c *RequestHeaders) ToMessage(m interface { SetMetaHeader(*session.RequestMetaHeader) SetVerifyHeader(*session.RequestVerificationHeader) -}) { +}, +) { m.SetMetaHeader(c.metaHeader.ToGRPCMessage().(*session.RequestMetaHeader)) m.SetVerifyHeader(c.verifyHeader.ToGRPCMessage().(*session.RequestVerificationHeader)) } @@ -51,7 +52,8 @@ func (c *RequestHeaders) ToMessage(m interface { func (c *RequestHeaders) FromMessage(m interface { GetMetaHeader() *session.RequestMetaHeader GetVerifyHeader() *session.RequestVerificationHeader -}) error { +}, +) error { metaHdr := m.GetMetaHeader() if metaHdr == nil { c.metaHeader = nil @@ -122,7 +124,8 @@ func (c *ResponseHeaders) SetVerificationHeader(v *ResponseVerificationHeader) { func (c *ResponseHeaders) ToMessage(m interface { SetMetaHeader(*session.ResponseMetaHeader) SetVerifyHeader(*session.ResponseVerificationHeader) -}) { +}, +) { m.SetMetaHeader(c.metaHeader.ToGRPCMessage().(*session.ResponseMetaHeader)) m.SetVerifyHeader(c.verifyHeader.ToGRPCMessage().(*session.ResponseVerificationHeader)) } @@ -130,7 +133,8 @@ func (c *ResponseHeaders) ToMessage(m interface { func (c *ResponseHeaders) FromMessage(m interface { GetMetaHeader() *session.ResponseMetaHeader GetVerifyHeader() *session.ResponseVerificationHeader -}) error { +}, +) error { metaHdr := m.GetMetaHeader() if metaHdr == nil { c.metaHeader = nil diff --git a/util/proto/marshal_test.go b/util/proto/marshal_test.go index 11a4d8f..7119c8f 100644 --- a/util/proto/marshal_test.go +++ b/util/proto/marshal_test.go @@ -50,9 +50,7 @@ func (s *stablePrimitives) stableMarshal(buf []byte, wrongField bool) ([]byte, e buf = make([]byte, s.stableSize()) } - var ( - i, offset, fieldNum int - ) + var i, offset, fieldNum int fieldNum = 1 if wrongField { diff --git a/util/protogen/main.go b/util/protogen/main.go index fe89fbf..a295a28 100644 --- a/util/protogen/main.go +++ b/util/protogen/main.go @@ -205,22 +205,22 @@ type marshalerDesc struct { var marshalers = map[protoreflect.Kind]marshalerDesc{ protoreflect.BoolKind: {Prefix: "Bool"}, protoreflect.EnumKind: {Prefix: "Enum"}, - //protoreflect.Int32Kind: "", - //protoreflect.Sint32Kind: "", + // protoreflect.Int32Kind: "", + // protoreflect.Sint32Kind: "", protoreflect.Uint32Kind: {Prefix: "UInt32", RepeatedDouble: true}, protoreflect.Int64Kind: {Prefix: "Int64", RepeatedDouble: true}, - //protoreflect.Sint64Kind: "", + // protoreflect.Sint64Kind: "", protoreflect.Uint64Kind: {Prefix: "UInt64", RepeatedDouble: true}, - //protoreflect.Sfixed32Kind: "", + // protoreflect.Sfixed32Kind: "", protoreflect.Fixed32Kind: {Prefix: "Fixed32", RepeatedDouble: true}, - //protoreflect.FloatKind: "", - //protoreflect.Sfixed64Kind: "", + // protoreflect.FloatKind: "", + // protoreflect.Sfixed64Kind: "", protoreflect.Fixed64Kind: {Prefix: "Fixed64", RepeatedDouble: true}, protoreflect.DoubleKind: {Prefix: "Float64"}, protoreflect.StringKind: {Prefix: "String"}, protoreflect.BytesKind: {Prefix: "Bytes"}, protoreflect.MessageKind: {Prefix: "NestedStructure"}, - //protoreflect.GroupKind: "", + // protoreflect.GroupKind: "", } func sortFields(fs []*protogen.Field) []*protogen.Field { diff --git a/util/signature/walletconnect/sign_test.go b/util/signature/walletconnect/sign_test.go index b83e79f..1b4fe18 100644 --- a/util/signature/walletconnect/sign_test.go +++ b/util/signature/walletconnect/sign_test.go @@ -109,5 +109,4 @@ func TestVerifyNeonWallet(t *testing.T) { } require.True(t, VerifyMessage(nil, sm)) } - } From 1772b921826b876ca0b26cd137d52fbd73d1e613 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Tue, 19 Mar 2024 09:55:23 +0300 Subject: [PATCH 1114/1196] [#69] object: Initial EC implementation Signed-off-by: Evgenii Stratonikov --- accounting/grpc/service.pb.go | 7 +- accounting/grpc/service_grpc.pb.go | 2 +- accounting/grpc/types.pb.go | 4 +- acl/grpc/types.pb.go | 19 +- audit/grpc/types.pb.go | 14 +- container/grpc/service.pb.go | 15 +- container/grpc/service_grpc.pb.go | 26 +- container/grpc/types.pb.go | 31 +- lock/grpc/types.pb.go | 9 +- netmap/convert.go | 4 + netmap/grpc/service.pb.go | 4 +- netmap/grpc/service_grpc.pb.go | 20 +- netmap/grpc/types.pb.go | 222 +++++----- netmap/marshal.go | 12 +- netmap/types.go | 27 ++ object/convert.go | 106 +++++ object/grpc/service.pb.go | 670 ++++++++++++++++------------- object/grpc/service_grpc.pb.go | 2 +- object/grpc/types.pb.go | 494 ++++++++++++++++----- object/marshal.go | 46 ++ object/message_test.go | 1 + object/test/generate.go | 25 ++ object/types.go | 32 ++ refs/grpc/types.pb.go | 14 +- session/grpc/service.pb.go | 4 +- session/grpc/service_grpc.pb.go | 2 +- session/grpc/types.pb.go | 22 +- status/grpc/types.pb.go | 4 +- tombstone/grpc/types.pb.go | 11 +- util/proto/test/test.pb.go | 4 +- 30 files changed, 1240 insertions(+), 613 deletions(-) diff --git a/accounting/grpc/service.pb.go b/accounting/grpc/service.pb.go index 51b9fe3..fe193cd 100644 --- a/accounting/grpc/service.pb.go +++ b/accounting/grpc/service.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.30.0 -// protoc v4.23.4 +// protoc-gen-go v1.33.0 +// protoc v4.25.3 // source: accounting/grpc/service.proto package accounting @@ -216,7 +216,8 @@ func (x *BalanceRequest_Body) GetOwnerId() *grpc1.OwnerID { } // 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. +// Balance is given in the `Decimal` format to avoid precision issues with +// rounding. type BalanceResponse_Body struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache diff --git a/accounting/grpc/service_grpc.pb.go b/accounting/grpc/service_grpc.pb.go index 1aadfc0..cd1b2e9 100644 --- a/accounting/grpc/service_grpc.pb.go +++ b/accounting/grpc/service_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.3.0 -// - protoc v4.23.4 +// - protoc v4.25.3 // source: accounting/grpc/service.proto package accounting diff --git a/accounting/grpc/types.pb.go b/accounting/grpc/types.pb.go index ae09338..592aa8b 100644 --- a/accounting/grpc/types.pb.go +++ b/accounting/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.30.0 -// protoc v4.23.4 +// protoc-gen-go v1.33.0 +// protoc v4.25.3 // source: accounting/grpc/types.proto package accounting diff --git a/acl/grpc/types.pb.go b/acl/grpc/types.pb.go index e245169..1b57b1a 100644 --- a/acl/grpc/types.pb.go +++ b/acl/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.30.0 -// protoc v4.23.4 +// protoc-gen-go v1.33.0 +// protoc v4.25.3 // source: acl/grpc/types.proto package acl @@ -32,7 +32,8 @@ const ( // System target rule is applied if sender is a storage node within the // container or an inner ring node Role_SYSTEM Role = 2 - // Others target rule is applied if sender is neither a user nor a system target + // Others target rule is applied if sender is neither a user nor a system + // target Role_OTHERS Role = 3 ) @@ -472,8 +473,8 @@ func (x *EACLTable) GetRecords() []*EACLRecord { // used in the similar use cases, like providing authorisation to externally // authenticated party. // -// BearerToken can be issued only by the container's owner and must be signed using -// the key associated with the container's `OwnerID`. +// BearerToken can be issued only by the container's owner and must be signed +// using the key associated with the container's `OwnerID`. type BearerToken struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -695,8 +696,8 @@ func (x *EACLRecord_Target) GetKeys() [][]byte { return nil } -// Bearer Token body structure contains Extended ACL table issued by the container -// owner with additional information preventing token abuse. +// Bearer Token body structure contains Extended ACL table issued by the +// container owner with additional information preventing token abuse. type BearerToken_Body struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -704,8 +705,8 @@ type BearerToken_Body struct { // Table of Extended ACL rules to use instead of the ones attached to the // container. If it contains `container_id` field, bearer token is only - // valid for this specific container. Otherwise, any container of the same owner - // is allowed. + // valid for this specific container. Otherwise, any container of the same + // owner is allowed. EaclTable *EACLTable `protobuf:"bytes,1,opt,name=eacl_table,json=eaclTable,proto3" json:"eacl_table,omitempty"` // `OwnerID` defines to whom the token was issued. It must match the request // originator's `OwnerID`. If empty, any token bearer will be accepted. diff --git a/audit/grpc/types.pb.go b/audit/grpc/types.pb.go index 8f437da..57243ef 100644 --- a/audit/grpc/types.pb.go +++ b/audit/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.30.0 -// protoc v4.23.4 +// protoc-gen-go v1.33.0 +// protoc v4.25.3 // source: audit/grpc/types.proto package audit @@ -47,12 +47,12 @@ type DataAuditResult struct { PassSg []*grpc.ObjectID `protobuf:"bytes,8,rep,name=pass_sg,json=passSG,proto3" json:"pass_sg,omitempty"` // List of Storage Groups that failed audit PoR stage FailSg []*grpc.ObjectID `protobuf:"bytes,9,rep,name=fail_sg,json=failSG,proto3" json:"fail_sg,omitempty"` - // Number of sampled objects under the audit placed in an optimal way according to - // the containers placement policy when checking PoP + // Number of sampled objects under the audit placed in an optimal way + // according to the containers placement policy when checking PoP Hit uint32 `protobuf:"varint,10,opt,name=hit,proto3" json:"hit,omitempty"` - // Number of sampled objects under the audit placed in suboptimal way according to - // the containers placement policy, but still at a satisfactory level when - // checking PoP + // Number of sampled objects under the audit placed in suboptimal way + // according to the containers placement policy, but still at a satisfactory + // level when checking PoP Miss uint32 `protobuf:"varint,11,opt,name=miss,proto3" json:"miss,omitempty"` // Number of sampled objects under the audit stored inconsistently with the // placement policy or not found at all when checking PoP diff --git a/container/grpc/service.pb.go b/container/grpc/service.pb.go index 8363e81..672e29f 100644 --- a/container/grpc/service.pb.go +++ b/container/grpc/service.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.30.0 -// protoc v4.23.4 +// protoc-gen-go v1.33.0 +// protoc v4.25.3 // source: container/grpc/service.proto package container @@ -1128,7 +1128,8 @@ type DeleteRequest_Body struct { // Identifier of the container to delete from NeoFS ContainerId *grpc1.ContainerID `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` - // `ContainerID` signed with the container owner's key according to RFC-6979. + // `ContainerID` signed with the container owner's key according to + // RFC-6979. Signature *grpc1.SignatureRFC6979 `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` } @@ -1493,8 +1494,8 @@ func (x *SetExtendedACLRequest_Body) GetSignature() *grpc1.SignatureRFC6979 { } // `SetExtendedACLResponse` has an empty body because the operation is -// asynchronous and the update should be reflected in `Container` smart contract's -// storage after next block is issued in sidechain. +// asynchronous and the update should be reflected in `Container` smart +// contract's storage after next block is issued in sidechain. type SetExtendedACLResponse_Body struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -1583,8 +1584,8 @@ func (x *GetExtendedACLRequest_Body) GetContainerId() *grpc1.ContainerID { } // Get Extended ACL Response body can be empty if the requested container does -// not have Extended ACL Table attached or Extended ACL has not been allowed at -// the time of container creation. +// not have Extended ACL Table attached or Extended ACL has not been allowed +// at the time of container creation. type GetExtendedACLResponse_Body struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache diff --git a/container/grpc/service_grpc.pb.go b/container/grpc/service_grpc.pb.go index 754665f..79b0533 100644 --- a/container/grpc/service_grpc.pb.go +++ b/container/grpc/service_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.3.0 -// - protoc v4.23.4 +// - protoc v4.25.3 // source: container/grpc/service.proto package container @@ -34,8 +34,8 @@ const ( 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 - // verified by Inner Ring nodes. After one more block in sidechain, the container - // is added into smart contract storage. + // verified by Inner Ring nodes. After one more block in sidechain, the + // container is added into smart contract storage. // // Statuses: // - **OK** (0, SECTION_SUCCESS): \ @@ -44,8 +44,8 @@ type ContainerServiceClient interface { 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 - // verified by Inner Ring nodes. After one more block in sidechain, the container - // is added into smart contract storage. + // verified by Inner Ring nodes. After one more block in sidechain, the + // container is added into smart contract storage. // // Statuses: // - **OK** (0, SECTION_SUCCESS): \ @@ -69,8 +69,8 @@ type ContainerServiceClient interface { // - Common failures (SECTION_FAILURE_COMMON). List(ctx context.Context, in *ListRequest, opts ...grpc.CallOption) (*ListResponse, error) // Invokes 'SetEACL' method of 'Container` smart contract and returns response - // immediately. After one more block in sidechain, changes in an Extended ACL are - // added into smart contract storage. + // immediately. After one more block in sidechain, changes in an Extended ACL + // are added into smart contract storage. // // Statuses: // - **OK** (0, SECTION_SUCCESS): \ @@ -175,8 +175,8 @@ func (c *containerServiceClient) AnnounceUsedSpace(ctx context.Context, in *Anno 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 - // verified by Inner Ring nodes. After one more block in sidechain, the container - // is added into smart contract storage. + // verified by Inner Ring nodes. After one more block in sidechain, the + // container is added into smart contract storage. // // Statuses: // - **OK** (0, SECTION_SUCCESS): \ @@ -185,8 +185,8 @@ type ContainerServiceServer interface { 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 - // verified by Inner Ring nodes. After one more block in sidechain, the container - // is added into smart contract storage. + // verified by Inner Ring nodes. After one more block in sidechain, the + // container is added into smart contract storage. // // Statuses: // - **OK** (0, SECTION_SUCCESS): \ @@ -210,8 +210,8 @@ type ContainerServiceServer interface { // - Common failures (SECTION_FAILURE_COMMON). List(context.Context, *ListRequest) (*ListResponse, error) // Invokes 'SetEACL' method of 'Container` smart contract and returns response - // immediately. After one more block in sidechain, changes in an Extended ACL are - // added into smart contract storage. + // immediately. After one more block in sidechain, changes in an Extended ACL + // are added into smart contract storage. // // Statuses: // - **OK** (0, SECTION_SUCCESS): \ diff --git a/container/grpc/types.pb.go b/container/grpc/types.pb.go index 59780d5..c484a0d 100644 --- a/container/grpc/types.pb.go +++ b/container/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.30.0 -// protoc v4.23.4 +// protoc-gen-go v1.33.0 +// protoc v4.25.3 // source: container/grpc/types.proto package container @@ -24,8 +24,8 @@ const ( // 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. +// 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 sizeCache protoimpl.SizeCache @@ -38,8 +38,8 @@ type Container struct { OwnerId *grpc.OwnerID `protobuf:"bytes,2,opt,name=owner_id,json=ownerID,proto3" 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,proto3" 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` 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,proto3" json:"basic_acl,omitempty"` // Attributes represent immutable container's meta data Attributes []*Container_Attribute `protobuf:"bytes,5,rep,name=attributes,proto3" json:"attributes,omitempty"` @@ -122,8 +122,8 @@ func (x *Container) GetPlacementPolicy() *grpc1.PlacementPolicy { } // `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. +// 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 @@ -137,15 +137,16 @@ func (x *Container) GetPlacementPolicy() *grpc1.PlacementPolicy { // 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`. +// 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 NeoFS network only if the global network hashing configuration -// value corresponds with that attribute's value. After container inclusion, network -// setting is ignored. +// 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 NeoFS 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: // diff --git a/lock/grpc/types.pb.go b/lock/grpc/types.pb.go index 100d648..c2d66f1 100644 --- a/lock/grpc/types.pb.go +++ b/lock/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.30.0 -// protoc v4.23.4 +// protoc-gen-go v1.33.0 +// protoc v4.25.3 // source: lock/grpc/types.proto package lock @@ -23,8 +23,9 @@ const ( // 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. +// `__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 sizeCache protoimpl.SizeCache diff --git a/netmap/convert.go b/netmap/convert.go index 0e25949..fad7380 100644 --- a/netmap/convert.go +++ b/netmap/convert.go @@ -142,6 +142,8 @@ func (r *Replica) ToGRPCMessage() grpc.Message { m.SetSelector(r.selector) m.SetCount(r.count) + m.EcDataCount = r.ecDataCount + m.EcParityCount = r.ecParityCount } return m @@ -155,6 +157,8 @@ func (r *Replica) FromGRPCMessage(m grpc.Message) error { r.selector = v.GetSelector() r.count = v.GetCount() + r.ecDataCount = v.GetEcDataCount() + r.ecParityCount = v.GetEcParityCount() return nil } diff --git a/netmap/grpc/service.pb.go b/netmap/grpc/service.pb.go index 711a3c9..7694f3f 100644 --- a/netmap/grpc/service.pb.go +++ b/netmap/grpc/service.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.30.0 -// protoc v4.23.4 +// protoc-gen-go v1.33.0 +// protoc v4.25.3 // source: netmap/grpc/service.proto package netmap diff --git a/netmap/grpc/service_grpc.pb.go b/netmap/grpc/service_grpc.pb.go index dec7d7f..00cb8de 100644 --- a/netmap/grpc/service_grpc.pb.go +++ b/netmap/grpc/service_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.3.0 -// - protoc v4.23.4 +// - protoc v4.25.3 // source: netmap/grpc/service.proto package netmap @@ -29,10 +29,11 @@ const ( // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. type NetmapServiceClient interface { // Get NodeInfo structure from the particular node directly. - // Node information can be taken from `Netmap` smart contract. In some cases, though, - // one may want to get recent information directly or to talk to the node not yet - // present in the `Network Map` to find out what API version can be used for - // further communication. This can be also used to check if a node is up and running. + // Node information can be taken from `Netmap` smart contract. In some cases, + // though, one may want to get recent information directly or to talk to the + // node not yet present in the `Network Map` to find out what API version can + // be used for further communication. This can be also used to check if a node + // is up and running. // // Statuses: // - **OK** (0, SECTION_SUCCESS): @@ -95,10 +96,11 @@ func (c *netmapServiceClient) NetmapSnapshot(ctx context.Context, in *NetmapSnap // 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, though, - // one may want to get recent information directly or to talk to the node not yet - // present in the `Network Map` to find out what API version can be used for - // further communication. This can be also used to check if a node is up and running. + // Node information can be taken from `Netmap` smart contract. In some cases, + // though, one may want to get recent information directly or to talk to the + // node not yet present in the `Network Map` to find out what API version can + // be used for further communication. This can be also used to check if a node + // is up and running. // // Statuses: // - **OK** (0, SECTION_SUCCESS): diff --git a/netmap/grpc/types.pb.go b/netmap/grpc/types.pb.go index f4991a9..385713d 100644 --- a/netmap/grpc/types.pb.go +++ b/netmap/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.30.0 -// protoc v4.23.4 +// protoc-gen-go v1.33.0 +// protoc v4.25.3 // source: netmap/grpc/types.proto package netmap @@ -213,8 +213,8 @@ func (NodeInfo_State) EnumDescriptor() ([]byte, []int) { return file_netmap_grpc_types_proto_rawDescGZIP(), []int{4, 0} } -// This filter will return the subset of nodes from `NetworkMap` or another filter's -// results that will satisfy filter's conditions. +// This filter will return the subset of nodes from `NetworkMap` or another +// filter's results that will satisfy filter's conditions. type Filter struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -401,6 +401,10 @@ type Replica struct { Count uint32 `protobuf:"varint,1,opt,name=count,proto3" json:"count,omitempty"` // Named selector bucket to put replicas Selector string `protobuf:"bytes,2,opt,name=selector,proto3" json:"selector,omitempty"` + // Data shards count + EcDataCount uint32 `protobuf:"varint,6,opt,name=ec_data_count,json=ecDataCount,proto3" json:"ec_data_count,omitempty"` + // Parity shards count + EcParityCount uint32 `protobuf:"varint,7,opt,name=ec_parity_count,json=ecParityCount,proto3" json:"ec_parity_count,omitempty"` } func (x *Replica) Reset() { @@ -449,6 +453,20 @@ func (x *Replica) GetSelector() string { return "" } +func (x *Replica) GetEcDataCount() uint32 { + if x != nil { + return x.EcDataCount + } + return 0 +} + +func (x *Replica) GetEcParityCount() uint32 { + if x != nil { + return x.EcParityCount + } + return 0 +} + // Set of rules to select a subset of nodes from `NetworkMap` able to store // container's objects. The format is simple enough to transpile from different // storage policy definition languages. @@ -734,7 +752,8 @@ type NetworkInfo struct { CurrentEpoch uint64 `protobuf:"varint,1,opt,name=current_epoch,json=currentEpoch,proto3" json:"current_epoch,omitempty"` // Magic number of the sidechain of the NeoFS network MagicNumber uint64 `protobuf:"varint,2,opt,name=magic_number,json=magicNumber,proto3" json:"magic_number,omitempty"` - // MillisecondsPerBlock network parameter of the sidechain of the NeoFS network + // MillisecondsPerBlock network parameter of the sidechain of the NeoFS + // network MsPerBlock int64 `protobuf:"varint,3,opt,name=ms_per_block,json=msPerBlock,proto3" json:"ms_per_block,omitempty"` // NeoFS network configuration NetworkConfig *NetworkConfig `protobuf:"bytes,4,opt,name=network_config,json=networkConfig,proto3" json:"network_config,omitempty"` @@ -806,15 +825,15 @@ func (x *NetworkInfo) GetNetworkConfig() *NetworkConfig { // string. Value can't be empty. // // Attributes can be constructed into a chain of attributes: any attribute can -// have a parent attribute and a child attribute (except the first and the last -// one). A string representation of the chain of attributes in NeoFS Storage -// Node configuration uses ":" and "/" symbols, e.g.: +// have a parent attribute and a child attribute (except the first and the +// last one). A string representation of the chain of attributes in NeoFS +// Storage Node configuration uses ":" and "/" symbols, e.g.: // // `NEOFS_NODE_ATTRIBUTE_1=key1:val1/key2:val2` // -// Therefore the string attribute representation in the Node configuration must -// use "\:", "\/" and "\\" escaped symbols if any of them appears in an attribute's -// key or value. +// Therefore the string attribute representation in the Node configuration +// must use "\:", "\/" and "\\" escaped symbols if any of them appears in an +// attribute's key or value. // // Node's attributes are mostly used during Storage Policy evaluation to // calculate object's placement and find a set of nodes satisfying policy @@ -968,6 +987,12 @@ func (x *NodeInfo_Attribute) GetParents() []string { // - **WithdrawFee** \ // Fee paid for withdrawal of funds paid by the account owner. // Value: little-endian integer. Default: 0. +// - **MaxECDataCount** \ +// Maximum number of data shards for EC placement policy. +// Value: little-endian integer. Default: 0. +// - **MaxECParityCount** \ +// Maximum number of parity shards for EC placement policy. +// Value: little-endian integer. Default: 0. type NetworkConfig_Parameter struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -1051,92 +1076,97 @@ var file_netmap_grpc_types_proto_rawDesc = []byte{ 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x66, 0x69, 0x6c, 0x74, - 0x65, 0x72, 0x22, 0x3b, 0x0a, 0x07, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x12, 0x14, 0x0a, - 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x63, 0x6f, - 0x75, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x22, - 0x86, 0x02, 0x0a, 0x0f, 0x50, 0x6c, 0x61, 0x63, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x50, 0x6f, 0x6c, - 0x69, 0x63, 0x79, 0x12, 0x35, 0x0a, 0x08, 0x72, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x73, 0x18, - 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, - 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, - 0x52, 0x08, 0x72, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x73, 0x12, 0x36, 0x0a, 0x17, 0x63, 0x6f, - 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x62, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x5f, 0x66, - 0x61, 0x63, 0x74, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x15, 0x63, 0x6f, 0x6e, - 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x42, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x46, 0x61, 0x63, 0x74, - 0x6f, 0x72, 0x12, 0x38, 0x0a, 0x09, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x73, 0x18, - 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, - 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x53, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, - 0x72, 0x52, 0x09, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x73, 0x12, 0x32, 0x0a, 0x07, - 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, - 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, - 0x2e, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x07, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x73, - 0x12, 0x16, 0x0a, 0x06, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, - 0x52, 0x06, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x22, 0xd8, 0x02, 0x0a, 0x08, 0x4e, 0x6f, 0x64, - 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, - 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x70, 0x75, 0x62, 0x6c, 0x69, - 0x63, 0x4b, 0x65, 0x79, 0x12, 0x1c, 0x0a, 0x09, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, - 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x09, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, - 0x65, 0x73, 0x12, 0x44, 0x0a, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, - 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, - 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, - 0x66, 0x6f, 0x2e, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x52, 0x0a, 0x61, 0x74, - 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x36, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, - 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, - 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x49, - 0x6e, 0x66, 0x6f, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, - 0x1a, 0x4d, 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, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x73, - 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x73, 0x22, - 0x42, 0x0a, 0x05, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x0f, 0x0a, 0x0b, 0x55, 0x4e, 0x53, 0x50, - 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x4f, 0x4e, 0x4c, - 0x49, 0x4e, 0x45, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x4f, 0x46, 0x46, 0x4c, 0x49, 0x4e, 0x45, - 0x10, 0x02, 0x12, 0x0f, 0x0a, 0x0b, 0x4d, 0x41, 0x49, 0x4e, 0x54, 0x45, 0x4e, 0x41, 0x4e, 0x43, - 0x45, 0x10, 0x03, 0x22, 0x50, 0x0a, 0x06, 0x4e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x12, 0x14, 0x0a, - 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x65, 0x70, - 0x6f, 0x63, 0x68, 0x12, 0x30, 0x0a, 0x05, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, + 0x65, 0x72, 0x22, 0x87, 0x01, 0x0a, 0x07, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x12, 0x14, + 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x63, + 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, + 0x12, 0x22, 0x0a, 0x0d, 0x65, 0x63, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x63, 0x6f, 0x75, 0x6e, + 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0b, 0x65, 0x63, 0x44, 0x61, 0x74, 0x61, 0x43, + 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x26, 0x0a, 0x0f, 0x65, 0x63, 0x5f, 0x70, 0x61, 0x72, 0x69, 0x74, + 0x79, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0d, 0x65, + 0x63, 0x50, 0x61, 0x72, 0x69, 0x74, 0x79, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x86, 0x02, 0x0a, + 0x0f, 0x50, 0x6c, 0x61, 0x63, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, + 0x12, 0x35, 0x0a, 0x08, 0x72, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x73, 0x18, 0x01, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, + 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x52, 0x08, 0x72, + 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x73, 0x12, 0x36, 0x0a, 0x17, 0x63, 0x6f, 0x6e, 0x74, 0x61, + 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x62, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x5f, 0x66, 0x61, 0x63, 0x74, + 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x15, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, + 0x6e, 0x65, 0x72, 0x42, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x46, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x12, + 0x38, 0x0a, 0x09, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, - 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x05, - 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x22, 0x8f, 0x01, 0x0a, 0x0d, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, - 0x6b, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x49, 0x0a, 0x0a, 0x70, 0x61, 0x72, 0x61, 0x6d, - 0x65, 0x74, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x6e, 0x65, - 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4e, - 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x50, 0x61, 0x72, - 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x52, 0x0a, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, - 0x72, 0x73, 0x1a, 0x33, 0x0a, 0x09, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x12, - 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x03, 0x6b, 0x65, - 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, - 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xbf, 0x01, 0x0a, 0x0b, 0x4e, 0x65, 0x74, 0x77, - 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x23, 0x0a, 0x0d, 0x63, 0x75, 0x72, 0x72, 0x65, - 0x6e, 0x74, 0x5f, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0c, - 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x45, 0x70, 0x6f, 0x63, 0x68, 0x12, 0x21, 0x0a, 0x0c, - 0x6d, 0x61, 0x67, 0x69, 0x63, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x04, 0x52, 0x0b, 0x6d, 0x61, 0x67, 0x69, 0x63, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, - 0x20, 0x0a, 0x0c, 0x6d, 0x73, 0x5f, 0x70, 0x65, 0x72, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x6d, 0x73, 0x50, 0x65, 0x72, 0x42, 0x6c, 0x6f, 0x63, - 0x6b, 0x12, 0x46, 0x0a, 0x0e, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x5f, 0x63, 0x6f, 0x6e, - 0x66, 0x69, 0x67, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, - 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4e, 0x65, 0x74, - 0x77, 0x6f, 0x72, 0x6b, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x0d, 0x6e, 0x65, 0x74, 0x77, - 0x6f, 0x72, 0x6b, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2a, 0x70, 0x0a, 0x09, 0x4f, 0x70, 0x65, - 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x19, 0x0a, 0x15, 0x4f, 0x50, 0x45, 0x52, 0x41, 0x54, - 0x49, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, - 0x00, 0x12, 0x06, 0x0a, 0x02, 0x45, 0x51, 0x10, 0x01, 0x12, 0x06, 0x0a, 0x02, 0x4e, 0x45, 0x10, - 0x02, 0x12, 0x06, 0x0a, 0x02, 0x47, 0x54, 0x10, 0x03, 0x12, 0x06, 0x0a, 0x02, 0x47, 0x45, 0x10, - 0x04, 0x12, 0x06, 0x0a, 0x02, 0x4c, 0x54, 0x10, 0x05, 0x12, 0x06, 0x0a, 0x02, 0x4c, 0x45, 0x10, - 0x06, 0x12, 0x06, 0x0a, 0x02, 0x4f, 0x52, 0x10, 0x07, 0x12, 0x07, 0x0a, 0x03, 0x41, 0x4e, 0x44, - 0x10, 0x08, 0x12, 0x07, 0x0a, 0x03, 0x4e, 0x4f, 0x54, 0x10, 0x09, 0x2a, 0x38, 0x0a, 0x06, 0x43, - 0x6c, 0x61, 0x75, 0x73, 0x65, 0x12, 0x16, 0x0a, 0x12, 0x43, 0x4c, 0x41, 0x55, 0x53, 0x45, 0x5f, - 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x08, 0x0a, - 0x04, 0x53, 0x41, 0x4d, 0x45, 0x10, 0x01, 0x12, 0x0c, 0x0a, 0x08, 0x44, 0x49, 0x53, 0x54, 0x49, - 0x4e, 0x43, 0x54, 0x10, 0x02, 0x42, 0x61, 0x5a, 0x42, 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, 0x61, - 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2f, - 0x67, 0x72, 0x70, 0x63, 0x3b, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0xaa, 0x02, 0x1a, 0x4e, 0x65, - 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, - 0x49, 0x2e, 0x4e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x53, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x52, 0x09, + 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x73, 0x12, 0x32, 0x0a, 0x07, 0x66, 0x69, 0x6c, + 0x74, 0x65, 0x72, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, + 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x46, 0x69, + 0x6c, 0x74, 0x65, 0x72, 0x52, 0x07, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x73, 0x12, 0x16, 0x0a, + 0x06, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x75, + 0x6e, 0x69, 0x71, 0x75, 0x65, 0x22, 0xd8, 0x02, 0x0a, 0x08, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, + 0x66, 0x6f, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65, 0x79, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, + 0x79, 0x12, 0x1c, 0x0a, 0x09, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x18, 0x02, + 0x20, 0x03, 0x28, 0x09, 0x52, 0x09, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x12, + 0x44, 0x0a, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x03, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, + 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x2e, + 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x52, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, + 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x36, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x0e, 0x32, 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, + 0x2e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x1a, 0x4d, 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, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x03, 0x20, + 0x03, 0x28, 0x09, 0x52, 0x07, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x73, 0x22, 0x42, 0x0a, 0x05, + 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x0f, 0x0a, 0x0b, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, + 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x4f, 0x4e, 0x4c, 0x49, 0x4e, 0x45, + 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x4f, 0x46, 0x46, 0x4c, 0x49, 0x4e, 0x45, 0x10, 0x02, 0x12, + 0x0f, 0x0a, 0x0b, 0x4d, 0x41, 0x49, 0x4e, 0x54, 0x45, 0x4e, 0x41, 0x4e, 0x43, 0x45, 0x10, 0x03, + 0x22, 0x50, 0x0a, 0x06, 0x4e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x70, + 0x6f, 0x63, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, + 0x12, 0x30, 0x0a, 0x05, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x1a, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, + 0x61, 0x70, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x05, 0x6e, 0x6f, 0x64, + 0x65, 0x73, 0x22, 0x8f, 0x01, 0x0a, 0x0d, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x43, 0x6f, + 0x6e, 0x66, 0x69, 0x67, 0x12, 0x49, 0x0a, 0x0a, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, + 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4e, 0x65, 0x74, 0x77, + 0x6f, 0x72, 0x6b, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, + 0x74, 0x65, 0x72, 0x52, 0x0a, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x1a, + 0x33, 0x0a, 0x09, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x12, 0x10, 0x0a, 0x03, + 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, + 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x22, 0xbf, 0x01, 0x0a, 0x0b, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, + 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x23, 0x0a, 0x0d, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x5f, + 0x65, 0x70, 0x6f, 0x63, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0c, 0x63, 0x75, 0x72, + 0x72, 0x65, 0x6e, 0x74, 0x45, 0x70, 0x6f, 0x63, 0x68, 0x12, 0x21, 0x0a, 0x0c, 0x6d, 0x61, 0x67, + 0x69, 0x63, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, + 0x0b, 0x6d, 0x61, 0x67, 0x69, 0x63, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x20, 0x0a, 0x0c, + 0x6d, 0x73, 0x5f, 0x70, 0x65, 0x72, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x03, 0x52, 0x0a, 0x6d, 0x73, 0x50, 0x65, 0x72, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x46, + 0x0a, 0x0e, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, + 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, + 0x6b, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x0d, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, + 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2a, 0x70, 0x0a, 0x09, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x12, 0x19, 0x0a, 0x15, 0x4f, 0x50, 0x45, 0x52, 0x41, 0x54, 0x49, 0x4f, 0x4e, + 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x06, + 0x0a, 0x02, 0x45, 0x51, 0x10, 0x01, 0x12, 0x06, 0x0a, 0x02, 0x4e, 0x45, 0x10, 0x02, 0x12, 0x06, + 0x0a, 0x02, 0x47, 0x54, 0x10, 0x03, 0x12, 0x06, 0x0a, 0x02, 0x47, 0x45, 0x10, 0x04, 0x12, 0x06, + 0x0a, 0x02, 0x4c, 0x54, 0x10, 0x05, 0x12, 0x06, 0x0a, 0x02, 0x4c, 0x45, 0x10, 0x06, 0x12, 0x06, + 0x0a, 0x02, 0x4f, 0x52, 0x10, 0x07, 0x12, 0x07, 0x0a, 0x03, 0x41, 0x4e, 0x44, 0x10, 0x08, 0x12, + 0x07, 0x0a, 0x03, 0x4e, 0x4f, 0x54, 0x10, 0x09, 0x2a, 0x38, 0x0a, 0x06, 0x43, 0x6c, 0x61, 0x75, + 0x73, 0x65, 0x12, 0x16, 0x0a, 0x12, 0x43, 0x4c, 0x41, 0x55, 0x53, 0x45, 0x5f, 0x55, 0x4e, 0x53, + 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x53, 0x41, + 0x4d, 0x45, 0x10, 0x01, 0x12, 0x0c, 0x0a, 0x08, 0x44, 0x49, 0x53, 0x54, 0x49, 0x4e, 0x43, 0x54, + 0x10, 0x02, 0x42, 0x61, 0x5a, 0x42, 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, 0x61, 0x70, 0x69, 0x2d, + 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2f, 0x67, 0x72, 0x70, + 0x63, 0x3b, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0xaa, 0x02, 0x1a, 0x4e, 0x65, 0x6f, 0x2e, 0x46, + 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x4e, + 0x65, 0x74, 0x6d, 0x61, 0x70, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/netmap/marshal.go b/netmap/marshal.go index 4f2c1ce..95430da 100644 --- a/netmap/marshal.go +++ b/netmap/marshal.go @@ -19,8 +19,10 @@ const ( attributeSelectorField = 4 filterSelectorField = 5 - countReplicaField = 1 - selectorReplicaField = 2 + countReplicaField = 1 + selectorReplicaField = 2 + ecDataCountReplicaField = 3 + ecParityCountReplicaField = 4 replicasPolicyField = 1 backupPolicyField = 2 @@ -134,7 +136,9 @@ func (r *Replica) StableMarshal(buf []byte) []byte { var offset int offset += protoutil.UInt32Marshal(countReplicaField, buf[offset:], r.count) - protoutil.StringMarshal(selectorReplicaField, buf[offset:], r.selector) + offset += protoutil.StringMarshal(selectorReplicaField, buf[offset:], r.selector) + offset += protoutil.UInt32Marshal(ecDataCountReplicaField, buf[offset:], r.ecDataCount) + protoutil.UInt32Marshal(ecParityCountReplicaField, buf[offset:], r.ecParityCount) return buf } @@ -146,6 +150,8 @@ func (r *Replica) StableSize() (size int) { size += protoutil.UInt32Size(countReplicaField, r.count) size += protoutil.StringSize(selectorReplicaField, r.selector) + size += protoutil.UInt32Size(ecDataCountReplicaField, r.ecDataCount) + size += protoutil.UInt32Size(ecParityCountReplicaField, r.ecParityCount) return size } diff --git a/netmap/types.go b/netmap/types.go index bda9ec6..dd5db68 100644 --- a/netmap/types.go +++ b/netmap/types.go @@ -50,6 +50,9 @@ type Selector struct { type Replica struct { count uint32 selector string + + ecDataCount uint32 + ecParityCount uint32 } type Operation uint32 @@ -259,6 +262,30 @@ func (r *Replica) SetCount(count uint32) { r.count = count } +func (r *Replica) GetECDataCount() uint32 { + if r != nil { + return r.ecDataCount + } + + return 0 +} + +func (r *Replica) SetECDataCount(count uint32) { + r.ecDataCount = count +} + +func (r *Replica) GetECParityCount() uint32 { + if r != nil { + return r.ecParityCount + } + + return 0 +} + +func (r *Replica) SetECParityCount(count uint32) { + r.ecParityCount = count +} + func (p *PlacementPolicy) GetUnique() bool { if p != nil { return p.unique diff --git a/object/convert.go b/object/convert.go index 07bf89c..8d6c73f 100644 --- a/object/convert.go +++ b/object/convert.go @@ -262,6 +262,51 @@ func (h *SplitHeader) FromGRPCMessage(m grpc.Message) error { return nil } +func (h *ECHeader) ToGRPCMessage() grpc.Message { + var m *object.Header_EC + + if h != nil { + m = new(object.Header_EC) + + m.Parent = h.Parent.ToGRPCMessage().(*refsGRPC.ObjectID) + m.Index = h.Index + m.Total = h.Total + m.Header = h.Header + m.HeaderLength = h.HeaderLength + } + + return m +} + +func (h *ECHeader) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.Header_EC) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + par := v.GetParent() + if par == nil { + h.Parent = nil + } else { + if h.Parent == nil { + h.Parent = new(refs.ObjectID) + } + + err = h.Parent.FromGRPCMessage(par) + if err != nil { + return err + } + } + + h.Index = v.GetIndex() + h.Total = v.GetTotal() + h.Header = v.GetHeader() + h.HeaderLength = v.GetHeaderLength() + return nil +} + func (h *Header) ToGRPCMessage() grpc.Message { var m *object.Header @@ -275,6 +320,7 @@ func (h *Header) ToGRPCMessage() grpc.Message { m.SetContainerId(h.cid.ToGRPCMessage().(*refsGRPC.ContainerID)) m.SetSessionToken(h.sessionToken.ToGRPCMessage().(*sessionGRPC.SessionToken)) m.SetSplit(h.split.ToGRPCMessage().(*object.Header_Split)) + m.Ec = h.ec.ToGRPCMessage().(*object.Header_EC) m.SetAttributes(AttributesToGRPC(h.attr)) m.SetPayloadLength(h.payloadLen) m.SetCreationEpoch(h.creatEpoch) @@ -313,6 +359,9 @@ func (h *Header) FromGRPCMessage(m grpc.Message) error { if err := h.fillSplitHeader(v); err != nil { return err } + if err := h.fillECHeader(v); err != nil { + return err + } h.attr, err = AttributesFromGRPC(v.GetAttributes()) if err != nil { @@ -417,6 +466,19 @@ func (h *Header) fillSplitHeader(v *object.Header) error { return h.split.FromGRPCMessage(split) } +func (h *Header) fillECHeader(v *object.Header) error { + ec := v.GetEc() + if ec == nil { + h.ec = nil + return nil + } + + if h.ec == nil { + h.ec = new(ECHeader) + } + return h.ec.FromGRPCMessage(ec) +} + func (h *HeaderWithSignature) ToGRPCMessage() grpc.Message { var m *object.HeaderWithSignature @@ -591,6 +653,50 @@ func (s *SplitInfo) FromGRPCMessage(m grpc.Message) error { return nil } +func (s *ECInfo) ToGRPCMessage() grpc.Message { + var m *object.ECInfo + + if s != nil { + m = new(object.ECInfo) + + if s.Chunks != nil { + chunks := make([]*object.ECInfo_Chunk, len(s.Chunks)) + for i := range chunks { + chunks[i] = &object.ECInfo_Chunk{ + Id: s.Chunks[i].ID.ToGRPCMessage().(*refsGRPC.ObjectID), + Index: s.Chunks[i].Index, + Total: s.Chunks[i].Total, + } + } + m.Chunks = chunks + } + } + + return m +} + +func (s *ECInfo) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.ECInfo) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + chunks := v.GetChunks() + if chunks == nil { + s.Chunks = nil + } else { + s.Chunks = make([]ECChunk, len(chunks)) + for i := range chunks { + if err := s.Chunks[i].ID.FromGRPCMessage(chunks[i].Id); err != nil { + return err + } + s.Chunks[i].Index = chunks[i].Index + s.Chunks[i].Total = chunks[i].Total + } + } + return nil +} + func (r *GetRequestBody) ToGRPCMessage() grpc.Message { var m *object.GetRequest_Body diff --git a/object/grpc/service.pb.go b/object/grpc/service.pb.go index d339aef..2bfb50b 100644 --- a/object/grpc/service.pb.go +++ b/object/grpc/service.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.30.0 -// protoc v4.23.4 +// protoc-gen-go v1.33.0 +// protoc v4.25.3 // source: object/grpc/service.proto package object @@ -1337,6 +1337,7 @@ type GetResponse_Body struct { // *GetResponse_Body_Init_ // *GetResponse_Body_Chunk // *GetResponse_Body_SplitInfo + // *GetResponse_Body_EcInfo ObjectPart isGetResponse_Body_ObjectPart `protobuf_oneof:"object_part"` } @@ -1400,6 +1401,13 @@ func (x *GetResponse_Body) GetSplitInfo() *SplitInfo { return nil } +func (x *GetResponse_Body) GetEcInfo() *ECInfo { + if x, ok := x.GetObjectPart().(*GetResponse_Body_EcInfo); ok { + return x.EcInfo + } + return nil +} + type isGetResponse_Body_ObjectPart interface { isGetResponse_Body_ObjectPart() } @@ -1419,12 +1427,19 @@ type GetResponse_Body_SplitInfo struct { SplitInfo *SplitInfo `protobuf:"bytes,3,opt,name=split_info,json=splitInfo,proto3,oneof"` } +type GetResponse_Body_EcInfo struct { + // Meta information for EC object assembly. + EcInfo *ECInfo `protobuf:"bytes,4,opt,name=ec_info,json=ecInfo,proto3,oneof"` +} + func (*GetResponse_Body_Init_) isGetResponse_Body_ObjectPart() {} func (*GetResponse_Body_Chunk) isGetResponse_Body_ObjectPart() {} func (*GetResponse_Body_SplitInfo) isGetResponse_Body_ObjectPart() {} +func (*GetResponse_Body_EcInfo) isGetResponse_Body_ObjectPart() {} + // Initial part of the `Object` structure stream. Technically it's a // set of all `Object` structure's fields except `payload`. type GetResponse_Body_Init struct { @@ -1894,6 +1909,7 @@ type HeadResponse_Body struct { // *HeadResponse_Body_Header // *HeadResponse_Body_ShortHeader // *HeadResponse_Body_SplitInfo + // *HeadResponse_Body_EcInfo Head isHeadResponse_Body_Head `protobuf_oneof:"head"` } @@ -1957,6 +1973,13 @@ func (x *HeadResponse_Body) GetSplitInfo() *SplitInfo { return nil } +func (x *HeadResponse_Body) GetEcInfo() *ECInfo { + if x, ok := x.GetHead().(*HeadResponse_Body_EcInfo); ok { + return x.EcInfo + } + return nil +} + type isHeadResponse_Body_Head interface { isHeadResponse_Body_Head() } @@ -1976,12 +1999,19 @@ type HeadResponse_Body_SplitInfo struct { SplitInfo *SplitInfo `protobuf:"bytes,3,opt,name=split_info,json=splitInfo,proto3,oneof"` } +type HeadResponse_Body_EcInfo struct { + // Meta information for EC object assembly. + EcInfo *ECInfo `protobuf:"bytes,4,opt,name=ec_info,json=ecInfo,proto3,oneof"` +} + func (*HeadResponse_Body_Header) isHeadResponse_Body_Head() {} func (*HeadResponse_Body_ShortHeader) isHeadResponse_Body_Head() {} func (*HeadResponse_Body_SplitInfo) isHeadResponse_Body_Head() {} +func (*HeadResponse_Body_EcInfo) isHeadResponse_Body_Head() {} + // Object Search request body type SearchRequest_Body struct { state protoimpl.MessageState @@ -2301,6 +2331,7 @@ type GetRangeResponse_Body struct { // // *GetRangeResponse_Body_Chunk // *GetRangeResponse_Body_SplitInfo + // *GetRangeResponse_Body_EcInfo RangePart isGetRangeResponse_Body_RangePart `protobuf_oneof:"range_part"` } @@ -2357,6 +2388,13 @@ func (x *GetRangeResponse_Body) GetSplitInfo() *SplitInfo { return nil } +func (x *GetRangeResponse_Body) GetEcInfo() *ECInfo { + if x, ok := x.GetRangePart().(*GetRangeResponse_Body_EcInfo); ok { + return x.EcInfo + } + return nil +} + type isGetRangeResponse_Body_RangePart interface { isGetRangeResponse_Body_RangePart() } @@ -2371,10 +2409,17 @@ type GetRangeResponse_Body_SplitInfo struct { SplitInfo *SplitInfo `protobuf:"bytes,2,opt,name=split_info,json=splitInfo,proto3,oneof"` } +type GetRangeResponse_Body_EcInfo struct { + // Meta information for EC object assembly. + EcInfo *ECInfo `protobuf:"bytes,3,opt,name=ec_info,json=ecInfo,proto3,oneof"` +} + func (*GetRangeResponse_Body_Chunk) isGetRangeResponse_Body_RangePart() {} func (*GetRangeResponse_Body_SplitInfo) isGetRangeResponse_Body_RangePart() {} +func (*GetRangeResponse_Body_EcInfo) isGetRangeResponse_Body_RangePart() {} + // Get hash of object's payload part request body. type GetRangeHashRequest_Body struct { state protoimpl.MessageState @@ -2640,7 +2685,7 @@ var file_object_grpc_service_proto_rawDesc = []byte{ 0x32, 0x17, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x10, 0x0a, 0x03, 0x72, 0x61, 0x77, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, - 0x03, 0x72, 0x61, 0x77, 0x22, 0xb9, 0x04, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, + 0x03, 0x72, 0x61, 0x77, 0x22, 0xee, 0x04, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x36, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, @@ -2654,7 +2699,7 @@ var file_object_grpc_service_proto_rawDesc = []byte{ 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, 0xd5, 0x02, 0x0a, 0x04, 0x42, 0x6f, 0x64, + 0x66, 0x79, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x1a, 0x8a, 0x03, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x3d, 0x0a, 0x04, 0x69, 0x6e, 0x69, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x42, @@ -2664,260 +2709,270 @@ var file_object_grpc_service_proto_rawDesc = []byte{ 0x74, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x53, 0x70, 0x6c, 0x69, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x48, 0x00, 0x52, 0x09, 0x73, 0x70, 0x6c, - 0x69, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x1a, 0xa8, 0x01, 0x0a, 0x04, 0x49, 0x6e, 0x69, 0x74, 0x12, + 0x69, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x33, 0x0a, 0x07, 0x65, 0x63, 0x5f, 0x69, 0x6e, 0x66, + 0x6f, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, + 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x45, 0x43, 0x49, 0x6e, 0x66, + 0x6f, 0x48, 0x00, 0x52, 0x06, 0x65, 0x63, 0x49, 0x6e, 0x66, 0x6f, 0x1a, 0xa8, 0x01, 0x0a, 0x04, + 0x49, 0x6e, 0x69, 0x74, 0x12, 0x35, 0x0a, 0x09, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x69, + 0x64, 0x18, 0x01, 0x20, 0x01, 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, 0x08, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x64, 0x12, 0x37, 0x0a, 0x09, 0x73, + 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, + 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, + 0x74, 0x75, 0x72, 0x65, 0x12, 0x30, 0x0a, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x06, + 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x42, 0x0d, 0x0a, 0x0b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, + 0x5f, 0x70, 0x61, 0x72, 0x74, 0x22, 0x9b, 0x04, 0x0a, 0x0a, 0x50, 0x75, 0x74, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x35, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, + 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x50, 0x75, 0x74, 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, 0xbb, 0x02, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x3c, + 0x0a, 0x04, 0x69, 0x6e, 0x69, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, + 0x50, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x2e, + 0x49, 0x6e, 0x69, 0x74, 0x48, 0x00, 0x52, 0x04, 0x69, 0x6e, 0x69, 0x74, 0x12, 0x16, 0x0a, 0x05, + 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, 0x05, 0x63, + 0x68, 0x75, 0x6e, 0x6b, 0x1a, 0xcd, 0x01, 0x0a, 0x04, 0x49, 0x6e, 0x69, 0x74, 0x12, 0x35, 0x0a, + 0x09, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 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, 0x08, 0x6f, 0x62, 0x6a, 0x65, + 0x63, 0x74, 0x49, 0x64, 0x12, 0x37, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, + 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, + 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x30, 0x0a, + 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, + 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, + 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, + 0x23, 0x0a, 0x0d, 0x63, 0x6f, 0x70, 0x69, 0x65, 0x73, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, + 0x18, 0x04, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x0c, 0x63, 0x6f, 0x70, 0x69, 0x65, 0x73, 0x4e, 0x75, + 0x6d, 0x62, 0x65, 0x72, 0x42, 0x0d, 0x0a, 0x0b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x70, + 0x61, 0x72, 0x74, 0x22, 0xa0, 0x02, 0x0a, 0x0b, 0x50, 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x36, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x22, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, + 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x50, 0x75, 0x74, 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, 0x3d, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x35, 0x0a, 0x09, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 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, 0x08, 0x6f, 0x62, - 0x6a, 0x65, 0x63, 0x74, 0x49, 0x64, 0x12, 0x37, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, - 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, - 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, - 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, - 0x30, 0x0a, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, - 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, - 0x72, 0x42, 0x0d, 0x0a, 0x0b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x70, 0x61, 0x72, 0x74, - 0x22, 0x9b, 0x04, 0x0a, 0x0a, 0x50, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, - 0x35, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, - 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, - 0x2e, 0x50, 0x75, 0x74, 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, 0xbb, 0x02, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x3c, 0x0a, 0x04, 0x69, 0x6e, 0x69, - 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, - 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x50, 0x75, 0x74, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x2e, 0x49, 0x6e, 0x69, 0x74, 0x48, - 0x00, 0x52, 0x04, 0x69, 0x6e, 0x69, 0x74, 0x12, 0x16, 0x0a, 0x05, 0x63, 0x68, 0x75, 0x6e, 0x6b, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, 0x05, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x1a, - 0xcd, 0x01, 0x0a, 0x04, 0x49, 0x6e, 0x69, 0x74, 0x12, 0x35, 0x0a, 0x09, 0x6f, 0x62, 0x6a, 0x65, - 0x63, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 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, 0x08, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x64, 0x12, - 0x37, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, - 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, - 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x30, 0x0a, 0x06, 0x68, 0x65, 0x61, 0x64, - 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, - 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, - 0x65, 0x72, 0x52, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x23, 0x0a, 0x0d, 0x63, 0x6f, - 0x70, 0x69, 0x65, 0x73, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x04, 0x20, 0x03, 0x28, - 0x0d, 0x52, 0x0c, 0x63, 0x6f, 0x70, 0x69, 0x65, 0x73, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x42, - 0x0d, 0x0a, 0x0b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x70, 0x61, 0x72, 0x74, 0x22, 0xa0, - 0x02, 0x0a, 0x0b, 0x50, 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x36, - 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6e, - 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, - 0x50, 0x75, 0x74, 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, 0x3d, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x35, 0x0a, 0x09, 0x6f, 0x62, - 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 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, 0x08, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x49, - 0x64, 0x22, 0x9e, 0x02, 0x0a, 0x0d, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x12, 0x38, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x24, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, - 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x44, 0x65, 0x6c, 0x65, 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, 0x39, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, - 0x31, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x17, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, - 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, - 0x73, 0x73, 0x22, 0xa6, 0x02, 0x0a, 0x0e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 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, - 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x44, 0x65, 0x6c, 0x65, 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, 0x3d, 0x0a, 0x04, - 0x42, 0x6f, 0x64, 0x79, 0x12, 0x35, 0x0a, 0x09, 0x74, 0x6f, 0x6d, 0x62, 0x73, 0x74, 0x6f, 0x6e, - 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, - 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, - 0x52, 0x09, 0x74, 0x6f, 0x6d, 0x62, 0x73, 0x74, 0x6f, 0x6e, 0x65, 0x22, 0xc9, 0x02, 0x0a, 0x0b, - 0x48, 0x65, 0x61, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x36, 0x0a, 0x04, 0x62, - 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, - 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, - 0x64, 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, 0x68, 0x0a, - 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x31, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, - 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, - 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x61, 0x69, 0x6e, - 0x5f, 0x6f, 0x6e, 0x6c, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x6d, 0x61, 0x69, - 0x6e, 0x4f, 0x6e, 0x6c, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x72, 0x61, 0x77, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x08, 0x52, 0x03, 0x72, 0x61, 0x77, 0x22, 0x80, 0x01, 0x0a, 0x13, 0x48, 0x65, 0x61, 0x64, - 0x65, 0x72, 0x57, 0x69, 0x74, 0x68, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, - 0x30, 0x0a, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, - 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, - 0x72, 0x12, 0x37, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, - 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, - 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x22, 0xb7, 0x03, 0x0a, 0x0c, 0x48, - 0x65, 0x61, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x37, 0x0a, 0x04, 0x62, - 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, - 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, - 0x64, 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, 0xd1, 0x01, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x3f, 0x0a, 0x06, 0x68, 0x65, 0x61, - 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, - 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, - 0x64, 0x65, 0x72, 0x57, 0x69, 0x74, 0x68, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, - 0x48, 0x00, 0x52, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x42, 0x0a, 0x0c, 0x73, 0x68, - 0x6f, 0x72, 0x74, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x1d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, - 0x65, 0x63, 0x74, 0x2e, 0x53, 0x68, 0x6f, 0x72, 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x48, - 0x00, 0x52, 0x0b, 0x73, 0x68, 0x6f, 0x72, 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x3c, - 0x0a, 0x0a, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, - 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x53, 0x70, 0x6c, 0x69, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x48, - 0x00, 0x52, 0x09, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x42, 0x06, 0x0a, 0x04, - 0x68, 0x65, 0x61, 0x64, 0x22, 0xfb, 0x03, 0x0a, 0x0d, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x38, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, - 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 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, 0x95, 0x02, 0x0a, 0x04, 0x42, - 0x6f, 0x64, 0x79, 0x12, 0x3e, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, - 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, - 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, - 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, - 0x72, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x45, 0x0a, - 0x07, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2b, - 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, - 0x74, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, - 0x42, 0x6f, 0x64, 0x79, 0x2e, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x07, 0x66, 0x69, 0x6c, - 0x74, 0x65, 0x72, 0x73, 0x1a, 0x6c, 0x0a, 0x06, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x3a, - 0x0a, 0x0a, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0e, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, - 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x54, 0x79, 0x70, 0x65, 0x52, - 0x09, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x54, 0x79, 0x70, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, - 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x22, 0xa2, 0x02, 0x0a, 0x0e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 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, - 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 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, + 0x6a, 0x65, 0x63, 0x74, 0x49, 0x64, 0x22, 0x9e, 0x02, 0x0a, 0x0d, 0x44, 0x65, 0x6c, 0x65, 0x74, + 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x38, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, + 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x44, 0x65, 0x6c, 0x65, 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, 0x39, 0x0a, 0x04, - 0x42, 0x6f, 0x64, 0x79, 0x12, 0x31, 0x0a, 0x07, 0x69, 0x64, 0x5f, 0x6c, 0x69, 0x73, 0x74, 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, - 0x06, 0x69, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x22, 0x37, 0x0a, 0x05, 0x52, 0x61, 0x6e, 0x67, 0x65, - 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, - 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, - 0x74, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, - 0x22, 0xe3, 0x02, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 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, 0x6f, - 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 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, 0x7a, 0x0a, 0x04, 0x42, 0x6f, - 0x64, 0x79, 0x12, 0x31, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, - 0x72, 0x65, 0x66, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x07, 0x61, 0x64, - 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x2d, 0x0a, 0x05, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, - 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x05, 0x72, - 0x61, 0x6e, 0x67, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x72, 0x61, 0x77, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x08, 0x52, 0x03, 0x72, 0x61, 0x77, 0x22, 0xd7, 0x02, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x52, 0x61, - 0x6e, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3b, 0x0a, 0x04, 0x62, - 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, - 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, - 0x52, 0x61, 0x6e, 0x67, 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, + 0x42, 0x6f, 0x64, 0x79, 0x12, 0x31, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x07, + 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0xa6, 0x02, 0x0a, 0x0e, 0x44, 0x65, 0x6c, 0x65, + 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 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, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x44, 0x65, 0x6c, 0x65, + 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, 0x3d, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x35, 0x0a, 0x09, 0x74, 0x6f, 0x6d, + 0x62, 0x73, 0x74, 0x6f, 0x6e, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x41, 0x64, + 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x09, 0x74, 0x6f, 0x6d, 0x62, 0x73, 0x74, 0x6f, 0x6e, 0x65, + 0x22, 0xc9, 0x02, 0x0a, 0x0b, 0x48, 0x65, 0x61, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x36, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, + 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 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, 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, + 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, 0x68, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x31, 0x0a, 0x07, 0x61, 0x64, + 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6e, 0x65, + 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x41, 0x64, 0x64, + 0x72, 0x65, 0x73, 0x73, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x1b, 0x0a, + 0x09, 0x6d, 0x61, 0x69, 0x6e, 0x5f, 0x6f, 0x6e, 0x6c, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, + 0x52, 0x08, 0x6d, 0x61, 0x69, 0x6e, 0x4f, 0x6e, 0x6c, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x72, 0x61, + 0x77, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x03, 0x72, 0x61, 0x77, 0x22, 0x80, 0x01, 0x0a, + 0x13, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x57, 0x69, 0x74, 0x68, 0x53, 0x69, 0x67, 0x6e, 0x61, + 0x74, 0x75, 0x72, 0x65, 0x12, 0x30, 0x0a, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x06, + 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x37, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, + 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, + 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, + 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x22, + 0xec, 0x03, 0x0a, 0x0c, 0x48, 0x65, 0x61, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x37, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, + 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 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, 0x86, 0x02, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x3f, + 0x0a, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, + 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x57, 0x69, 0x74, 0x68, 0x53, 0x69, 0x67, 0x6e, + 0x61, 0x74, 0x75, 0x72, 0x65, 0x48, 0x00, 0x52, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, + 0x42, 0x0a, 0x0c, 0x73, 0x68, 0x6f, 0x72, 0x74, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x53, 0x68, 0x6f, 0x72, 0x74, 0x48, 0x65, + 0x61, 0x64, 0x65, 0x72, 0x48, 0x00, 0x52, 0x0b, 0x73, 0x68, 0x6f, 0x72, 0x74, 0x48, 0x65, 0x61, + 0x64, 0x65, 0x72, 0x12, 0x3c, 0x0a, 0x0a, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x5f, 0x69, 0x6e, 0x66, + 0x6f, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, + 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x53, 0x70, 0x6c, 0x69, 0x74, + 0x49, 0x6e, 0x66, 0x6f, 0x48, 0x00, 0x52, 0x09, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x49, 0x6e, 0x66, + 0x6f, 0x12, 0x33, 0x0a, 0x07, 0x65, 0x63, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, + 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x45, 0x43, 0x49, 0x6e, 0x66, 0x6f, 0x48, 0x00, 0x52, 0x06, + 0x65, 0x63, 0x49, 0x6e, 0x66, 0x6f, 0x42, 0x06, 0x0a, 0x04, 0x68, 0x65, 0x61, 0x64, 0x22, 0xfb, + 0x03, 0x0a, 0x0d, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x38, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, + 0x74, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 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, 0x6a, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x16, 0x0a, 0x05, - 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, 0x05, 0x63, - 0x68, 0x75, 0x6e, 0x6b, 0x12, 0x3c, 0x0a, 0x0a, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x5f, 0x69, 0x6e, - 0x66, 0x6f, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, - 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x53, 0x70, 0x6c, 0x69, - 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x48, 0x00, 0x52, 0x09, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x49, 0x6e, + 0x61, 0x64, 0x65, 0x72, 0x1a, 0x95, 0x02, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x3e, 0x0a, + 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, + 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, + 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x64, 0x12, 0x18, 0x0a, + 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, + 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x45, 0x0a, 0x07, 0x66, 0x69, 0x6c, 0x74, 0x65, + 0x72, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x53, 0x65, 0x61, 0x72, + 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x2e, 0x46, + 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x07, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x73, 0x1a, 0x6c, + 0x0a, 0x06, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x3a, 0x0a, 0x0a, 0x6d, 0x61, 0x74, 0x63, + 0x68, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1b, 0x2e, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, + 0x4d, 0x61, 0x74, 0x63, 0x68, 0x54, 0x79, 0x70, 0x65, 0x52, 0x09, 0x6d, 0x61, 0x74, 0x63, 0x68, + 0x54, 0x79, 0x70, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xa2, 0x02, 0x0a, + 0x0e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 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, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, + 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 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, 0x39, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x31, + 0x0a, 0x07, 0x69, 0x64, 0x5f, 0x6c, 0x69, 0x73, 0x74, 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, 0x06, 0x69, 0x64, 0x4c, 0x69, 0x73, + 0x74, 0x22, 0x37, 0x0a, 0x05, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x66, + 0x66, 0x73, 0x65, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, + 0x65, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x04, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xe3, 0x02, 0x0a, 0x0f, 0x47, + 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 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, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, + 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 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, 0x7a, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x31, 0x0a, 0x07, + 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, + 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x41, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, + 0x2d, 0x0a, 0x05, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, + 0x74, 0x2e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x05, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x10, + 0x0a, 0x03, 0x72, 0x61, 0x77, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x03, 0x72, 0x61, 0x77, + 0x22, 0x8d, 0x03, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3b, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, + 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 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, 0x9f, + 0x01, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x16, 0x0a, 0x05, 0x63, 0x68, 0x75, 0x6e, 0x6b, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, 0x05, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x12, + 0x3c, 0x0a, 0x0a, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, + 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x53, 0x70, 0x6c, 0x69, 0x74, 0x49, 0x6e, 0x66, 0x6f, + 0x48, 0x00, 0x52, 0x09, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x33, 0x0a, + 0x07, 0x65, 0x63, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, + 0x74, 0x2e, 0x45, 0x43, 0x49, 0x6e, 0x66, 0x6f, 0x48, 0x00, 0x52, 0x06, 0x65, 0x63, 0x49, 0x6e, 0x66, 0x6f, 0x42, 0x0c, 0x0a, 0x0a, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x5f, 0x70, 0x61, 0x72, 0x74, 0x22, 0xa2, 0x03, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x48, 0x61, 0x73, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x3e, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, @@ -3111,12 +3166,13 @@ var file_object_grpc_service_proto_goTypes = []interface{}{ (*grpc1.Signature)(nil), // 42: neo.fs.v2.refs.Signature (*grpc1.Address)(nil), // 43: neo.fs.v2.refs.Address (*SplitInfo)(nil), // 44: neo.fs.v2.object.SplitInfo - (*grpc1.ObjectID)(nil), // 45: neo.fs.v2.refs.ObjectID - (*ShortHeader)(nil), // 46: neo.fs.v2.object.ShortHeader - (*grpc1.ContainerID)(nil), // 47: neo.fs.v2.refs.ContainerID - (MatchType)(0), // 48: neo.fs.v2.object.MatchType - (grpc1.ChecksumType)(0), // 49: neo.fs.v2.refs.ChecksumType - (*Object)(nil), // 50: neo.fs.v2.object.Object + (*ECInfo)(nil), // 45: neo.fs.v2.object.ECInfo + (*grpc1.ObjectID)(nil), // 46: neo.fs.v2.refs.ObjectID + (*ShortHeader)(nil), // 47: neo.fs.v2.object.ShortHeader + (*grpc1.ContainerID)(nil), // 48: neo.fs.v2.refs.ContainerID + (MatchType)(0), // 49: neo.fs.v2.object.MatchType + (grpc1.ChecksumType)(0), // 50: neo.fs.v2.refs.ChecksumType + (*Object)(nil), // 51: neo.fs.v2.object.Object } var file_object_grpc_service_proto_depIdxs = []int32{ 18, // 0: neo.fs.v2.object.GetRequest.body:type_name -> neo.fs.v2.object.GetRequest.Body @@ -3172,53 +3228,56 @@ var file_object_grpc_service_proto_depIdxs = []int32{ 43, // 50: neo.fs.v2.object.GetRequest.Body.address:type_name -> neo.fs.v2.refs.Address 20, // 51: neo.fs.v2.object.GetResponse.Body.init:type_name -> neo.fs.v2.object.GetResponse.Body.Init 44, // 52: neo.fs.v2.object.GetResponse.Body.split_info:type_name -> neo.fs.v2.object.SplitInfo - 45, // 53: neo.fs.v2.object.GetResponse.Body.Init.object_id:type_name -> neo.fs.v2.refs.ObjectID - 42, // 54: neo.fs.v2.object.GetResponse.Body.Init.signature:type_name -> neo.fs.v2.refs.Signature - 41, // 55: neo.fs.v2.object.GetResponse.Body.Init.header:type_name -> neo.fs.v2.object.Header - 22, // 56: neo.fs.v2.object.PutRequest.Body.init:type_name -> neo.fs.v2.object.PutRequest.Body.Init - 45, // 57: neo.fs.v2.object.PutRequest.Body.Init.object_id:type_name -> neo.fs.v2.refs.ObjectID - 42, // 58: neo.fs.v2.object.PutRequest.Body.Init.signature:type_name -> neo.fs.v2.refs.Signature - 41, // 59: neo.fs.v2.object.PutRequest.Body.Init.header:type_name -> neo.fs.v2.object.Header - 45, // 60: neo.fs.v2.object.PutResponse.Body.object_id:type_name -> neo.fs.v2.refs.ObjectID - 43, // 61: neo.fs.v2.object.DeleteRequest.Body.address:type_name -> neo.fs.v2.refs.Address - 43, // 62: neo.fs.v2.object.DeleteResponse.Body.tombstone:type_name -> neo.fs.v2.refs.Address - 43, // 63: neo.fs.v2.object.HeadRequest.Body.address:type_name -> neo.fs.v2.refs.Address - 7, // 64: neo.fs.v2.object.HeadResponse.Body.header:type_name -> neo.fs.v2.object.HeaderWithSignature - 46, // 65: neo.fs.v2.object.HeadResponse.Body.short_header:type_name -> neo.fs.v2.object.ShortHeader - 44, // 66: neo.fs.v2.object.HeadResponse.Body.split_info:type_name -> neo.fs.v2.object.SplitInfo - 47, // 67: neo.fs.v2.object.SearchRequest.Body.container_id:type_name -> neo.fs.v2.refs.ContainerID - 29, // 68: neo.fs.v2.object.SearchRequest.Body.filters:type_name -> neo.fs.v2.object.SearchRequest.Body.Filter - 48, // 69: neo.fs.v2.object.SearchRequest.Body.Filter.match_type:type_name -> neo.fs.v2.object.MatchType - 45, // 70: neo.fs.v2.object.SearchResponse.Body.id_list:type_name -> neo.fs.v2.refs.ObjectID - 43, // 71: neo.fs.v2.object.GetRangeRequest.Body.address:type_name -> neo.fs.v2.refs.Address - 11, // 72: neo.fs.v2.object.GetRangeRequest.Body.range:type_name -> neo.fs.v2.object.Range - 44, // 73: neo.fs.v2.object.GetRangeResponse.Body.split_info:type_name -> neo.fs.v2.object.SplitInfo - 43, // 74: neo.fs.v2.object.GetRangeHashRequest.Body.address:type_name -> neo.fs.v2.refs.Address - 11, // 75: neo.fs.v2.object.GetRangeHashRequest.Body.ranges:type_name -> neo.fs.v2.object.Range - 49, // 76: neo.fs.v2.object.GetRangeHashRequest.Body.type:type_name -> neo.fs.v2.refs.ChecksumType - 49, // 77: neo.fs.v2.object.GetRangeHashResponse.Body.type:type_name -> neo.fs.v2.refs.ChecksumType - 50, // 78: neo.fs.v2.object.PutSingleRequest.Body.object:type_name -> neo.fs.v2.object.Object - 0, // 79: neo.fs.v2.object.ObjectService.Get:input_type -> neo.fs.v2.object.GetRequest - 2, // 80: neo.fs.v2.object.ObjectService.Put:input_type -> neo.fs.v2.object.PutRequest - 4, // 81: neo.fs.v2.object.ObjectService.Delete:input_type -> neo.fs.v2.object.DeleteRequest - 6, // 82: neo.fs.v2.object.ObjectService.Head:input_type -> neo.fs.v2.object.HeadRequest - 9, // 83: neo.fs.v2.object.ObjectService.Search:input_type -> neo.fs.v2.object.SearchRequest - 12, // 84: neo.fs.v2.object.ObjectService.GetRange:input_type -> neo.fs.v2.object.GetRangeRequest - 14, // 85: neo.fs.v2.object.ObjectService.GetRangeHash:input_type -> neo.fs.v2.object.GetRangeHashRequest - 16, // 86: neo.fs.v2.object.ObjectService.PutSingle:input_type -> neo.fs.v2.object.PutSingleRequest - 1, // 87: neo.fs.v2.object.ObjectService.Get:output_type -> neo.fs.v2.object.GetResponse - 3, // 88: neo.fs.v2.object.ObjectService.Put:output_type -> neo.fs.v2.object.PutResponse - 5, // 89: neo.fs.v2.object.ObjectService.Delete:output_type -> neo.fs.v2.object.DeleteResponse - 8, // 90: neo.fs.v2.object.ObjectService.Head:output_type -> neo.fs.v2.object.HeadResponse - 10, // 91: neo.fs.v2.object.ObjectService.Search:output_type -> neo.fs.v2.object.SearchResponse - 13, // 92: neo.fs.v2.object.ObjectService.GetRange:output_type -> neo.fs.v2.object.GetRangeResponse - 15, // 93: neo.fs.v2.object.ObjectService.GetRangeHash:output_type -> neo.fs.v2.object.GetRangeHashResponse - 17, // 94: neo.fs.v2.object.ObjectService.PutSingle:output_type -> neo.fs.v2.object.PutSingleResponse - 87, // [87:95] is the sub-list for method output_type - 79, // [79:87] is the sub-list for method input_type - 79, // [79:79] is the sub-list for extension type_name - 79, // [79:79] is the sub-list for extension extendee - 0, // [0:79] is the sub-list for field type_name + 45, // 53: neo.fs.v2.object.GetResponse.Body.ec_info:type_name -> neo.fs.v2.object.ECInfo + 46, // 54: neo.fs.v2.object.GetResponse.Body.Init.object_id:type_name -> neo.fs.v2.refs.ObjectID + 42, // 55: neo.fs.v2.object.GetResponse.Body.Init.signature:type_name -> neo.fs.v2.refs.Signature + 41, // 56: neo.fs.v2.object.GetResponse.Body.Init.header:type_name -> neo.fs.v2.object.Header + 22, // 57: neo.fs.v2.object.PutRequest.Body.init:type_name -> neo.fs.v2.object.PutRequest.Body.Init + 46, // 58: neo.fs.v2.object.PutRequest.Body.Init.object_id:type_name -> neo.fs.v2.refs.ObjectID + 42, // 59: neo.fs.v2.object.PutRequest.Body.Init.signature:type_name -> neo.fs.v2.refs.Signature + 41, // 60: neo.fs.v2.object.PutRequest.Body.Init.header:type_name -> neo.fs.v2.object.Header + 46, // 61: neo.fs.v2.object.PutResponse.Body.object_id:type_name -> neo.fs.v2.refs.ObjectID + 43, // 62: neo.fs.v2.object.DeleteRequest.Body.address:type_name -> neo.fs.v2.refs.Address + 43, // 63: neo.fs.v2.object.DeleteResponse.Body.tombstone:type_name -> neo.fs.v2.refs.Address + 43, // 64: neo.fs.v2.object.HeadRequest.Body.address:type_name -> neo.fs.v2.refs.Address + 7, // 65: neo.fs.v2.object.HeadResponse.Body.header:type_name -> neo.fs.v2.object.HeaderWithSignature + 47, // 66: neo.fs.v2.object.HeadResponse.Body.short_header:type_name -> neo.fs.v2.object.ShortHeader + 44, // 67: neo.fs.v2.object.HeadResponse.Body.split_info:type_name -> neo.fs.v2.object.SplitInfo + 45, // 68: neo.fs.v2.object.HeadResponse.Body.ec_info:type_name -> neo.fs.v2.object.ECInfo + 48, // 69: neo.fs.v2.object.SearchRequest.Body.container_id:type_name -> neo.fs.v2.refs.ContainerID + 29, // 70: neo.fs.v2.object.SearchRequest.Body.filters:type_name -> neo.fs.v2.object.SearchRequest.Body.Filter + 49, // 71: neo.fs.v2.object.SearchRequest.Body.Filter.match_type:type_name -> neo.fs.v2.object.MatchType + 46, // 72: neo.fs.v2.object.SearchResponse.Body.id_list:type_name -> neo.fs.v2.refs.ObjectID + 43, // 73: neo.fs.v2.object.GetRangeRequest.Body.address:type_name -> neo.fs.v2.refs.Address + 11, // 74: neo.fs.v2.object.GetRangeRequest.Body.range:type_name -> neo.fs.v2.object.Range + 44, // 75: neo.fs.v2.object.GetRangeResponse.Body.split_info:type_name -> neo.fs.v2.object.SplitInfo + 45, // 76: neo.fs.v2.object.GetRangeResponse.Body.ec_info:type_name -> neo.fs.v2.object.ECInfo + 43, // 77: neo.fs.v2.object.GetRangeHashRequest.Body.address:type_name -> neo.fs.v2.refs.Address + 11, // 78: neo.fs.v2.object.GetRangeHashRequest.Body.ranges:type_name -> neo.fs.v2.object.Range + 50, // 79: neo.fs.v2.object.GetRangeHashRequest.Body.type:type_name -> neo.fs.v2.refs.ChecksumType + 50, // 80: neo.fs.v2.object.GetRangeHashResponse.Body.type:type_name -> neo.fs.v2.refs.ChecksumType + 51, // 81: neo.fs.v2.object.PutSingleRequest.Body.object:type_name -> neo.fs.v2.object.Object + 0, // 82: neo.fs.v2.object.ObjectService.Get:input_type -> neo.fs.v2.object.GetRequest + 2, // 83: neo.fs.v2.object.ObjectService.Put:input_type -> neo.fs.v2.object.PutRequest + 4, // 84: neo.fs.v2.object.ObjectService.Delete:input_type -> neo.fs.v2.object.DeleteRequest + 6, // 85: neo.fs.v2.object.ObjectService.Head:input_type -> neo.fs.v2.object.HeadRequest + 9, // 86: neo.fs.v2.object.ObjectService.Search:input_type -> neo.fs.v2.object.SearchRequest + 12, // 87: neo.fs.v2.object.ObjectService.GetRange:input_type -> neo.fs.v2.object.GetRangeRequest + 14, // 88: neo.fs.v2.object.ObjectService.GetRangeHash:input_type -> neo.fs.v2.object.GetRangeHashRequest + 16, // 89: neo.fs.v2.object.ObjectService.PutSingle:input_type -> neo.fs.v2.object.PutSingleRequest + 1, // 90: neo.fs.v2.object.ObjectService.Get:output_type -> neo.fs.v2.object.GetResponse + 3, // 91: neo.fs.v2.object.ObjectService.Put:output_type -> neo.fs.v2.object.PutResponse + 5, // 92: neo.fs.v2.object.ObjectService.Delete:output_type -> neo.fs.v2.object.DeleteResponse + 8, // 93: neo.fs.v2.object.ObjectService.Head:output_type -> neo.fs.v2.object.HeadResponse + 10, // 94: neo.fs.v2.object.ObjectService.Search:output_type -> neo.fs.v2.object.SearchResponse + 13, // 95: neo.fs.v2.object.ObjectService.GetRange:output_type -> neo.fs.v2.object.GetRangeResponse + 15, // 96: neo.fs.v2.object.ObjectService.GetRangeHash:output_type -> neo.fs.v2.object.GetRangeHashResponse + 17, // 97: neo.fs.v2.object.ObjectService.PutSingle:output_type -> neo.fs.v2.object.PutSingleResponse + 90, // [90:98] is the sub-list for method output_type + 82, // [82:90] is the sub-list for method input_type + 82, // [82:82] is the sub-list for extension type_name + 82, // [82:82] is the sub-list for extension extendee + 0, // [0:82] is the sub-list for field type_name } func init() { file_object_grpc_service_proto_init() } @@ -3677,6 +3736,7 @@ func file_object_grpc_service_proto_init() { (*GetResponse_Body_Init_)(nil), (*GetResponse_Body_Chunk)(nil), (*GetResponse_Body_SplitInfo)(nil), + (*GetResponse_Body_EcInfo)(nil), } file_object_grpc_service_proto_msgTypes[21].OneofWrappers = []interface{}{ (*PutRequest_Body_Init_)(nil), @@ -3686,10 +3746,12 @@ func file_object_grpc_service_proto_init() { (*HeadResponse_Body_Header)(nil), (*HeadResponse_Body_ShortHeader)(nil), (*HeadResponse_Body_SplitInfo)(nil), + (*HeadResponse_Body_EcInfo)(nil), } file_object_grpc_service_proto_msgTypes[32].OneofWrappers = []interface{}{ (*GetRangeResponse_Body_Chunk)(nil), (*GetRangeResponse_Body_SplitInfo)(nil), + (*GetRangeResponse_Body_EcInfo)(nil), } type x struct{} out := protoimpl.TypeBuilder{ diff --git a/object/grpc/service_grpc.pb.go b/object/grpc/service_grpc.pb.go index 985b991..1edf647 100644 --- a/object/grpc/service_grpc.pb.go +++ b/object/grpc/service_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.3.0 -// - protoc v4.23.4 +// - protoc v4.25.3 // source: object/grpc/service.proto package object diff --git a/object/grpc/types.pb.go b/object/grpc/types.pb.go index c6f2c7a..8f4f383 100644 --- a/object/grpc/types.pb.go +++ b/object/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.30.0 -// protoc v4.23.4 +// protoc-gen-go v1.33.0 +// protoc v4.25.3 // source: object/grpc/types.proto package object @@ -279,6 +279,8 @@ type Header struct { Attributes []*Header_Attribute `protobuf:"bytes,10,rep,name=attributes,proto3" json:"attributes,omitempty"` // Position of the object in the split hierarchy Split *Header_Split `protobuf:"bytes,11,opt,name=split,proto3" json:"split,omitempty"` + // Erasure code chunk information. + Ec *Header_EC `protobuf:"bytes,12,opt,name=ec,proto3" json:"ec,omitempty"` } func (x *Header) Reset() { @@ -390,6 +392,13 @@ func (x *Header) GetSplit() *Header_Split { return nil } +func (x *Header) GetEc() *Header_EC { + if x != nil { + return x.Ec + } + return nil +} + // Object structure. Object is immutable and content-addressed. It means // `ObjectID` will change if the header or the payload changes. It's calculated // as a hash of header field which contains hash of the object's payload. @@ -544,6 +553,55 @@ func (x *SplitInfo) GetLink() *grpc.ObjectID { return nil } +// Meta information for the erasure-encoded object. +type ECInfo struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Chunk stored on the node. + Chunks []*ECInfo_Chunk `protobuf:"bytes,1,rep,name=chunks,proto3" json:"chunks,omitempty"` +} + +func (x *ECInfo) Reset() { + *x = ECInfo{} + if protoimpl.UnsafeEnabled { + mi := &file_object_grpc_types_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ECInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ECInfo) ProtoMessage() {} + +func (x *ECInfo) ProtoReflect() protoreflect.Message { + mi := &file_object_grpc_types_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ECInfo.ProtoReflect.Descriptor instead. +func (*ECInfo) Descriptor() ([]byte, []int) { + return file_object_grpc_types_proto_rawDescGZIP(), []int{4} +} + +func (x *ECInfo) GetChunks() []*ECInfo_Chunk { + if x != nil { + return x.Chunks + } + return nil +} + // `Attribute` is a user-defined Key-Value metadata pair attached to an // object. // @@ -559,7 +617,8 @@ func (x *SplitInfo) GetLink() *grpc.ObjectID { // Marks smaller parts of a split bigger object // - [ __SYSTEM__EXPIRATION_EPOCH ] \ // (`__NEOFS__EXPIRATION_EPOCH` is deprecated) \ -// Tells GC to delete object after that epoch +// The epoch after which object with no LOCKs on it becomes unavailable. +// Locked object continues to be available until each of the LOCKs expire. // - [ __SYSTEM__TICK_EPOCH ] \ // (`__NEOFS__TICK_EPOCH` is deprecated) \ // Decimal number that defines what epoch must produce @@ -604,7 +663,7 @@ type Header_Attribute struct { func (x *Header_Attribute) Reset() { *x = Header_Attribute{} if protoimpl.UnsafeEnabled { - mi := &file_object_grpc_types_proto_msgTypes[4] + mi := &file_object_grpc_types_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -617,7 +676,7 @@ func (x *Header_Attribute) String() string { func (*Header_Attribute) ProtoMessage() {} func (x *Header_Attribute) ProtoReflect() protoreflect.Message { - mi := &file_object_grpc_types_proto_msgTypes[4] + mi := &file_object_grpc_types_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -675,7 +734,7 @@ type Header_Split struct { func (x *Header_Split) Reset() { *x = Header_Split{} if protoimpl.UnsafeEnabled { - mi := &file_object_grpc_types_proto_msgTypes[5] + mi := &file_object_grpc_types_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -688,7 +747,7 @@ func (x *Header_Split) String() string { func (*Header_Split) ProtoMessage() {} func (x *Header_Split) ProtoReflect() protoreflect.Message { - mi := &file_object_grpc_types_proto_msgTypes[5] + mi := &file_object_grpc_types_proto_msgTypes[6] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -746,6 +805,159 @@ func (x *Header_Split) GetSplitId() []byte { return nil } +// Erasure code can be applied to any object. +// Information about encoded object structure is stored in `EC` header. +// All objects belonging to a single EC group have the same `parent` field. +type Header_EC struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Identifier of the origin object. Known to all chunks. + Parent *grpc.ObjectID `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"` + // Index of this chunk. + Index uint32 `protobuf:"varint,2,opt,name=index,proto3" json:"index,omitempty"` + // Total number of chunks in this split. + Total uint32 `protobuf:"varint,3,opt,name=total,proto3" json:"total,omitempty"` + // Total length of a parent header. Used to trim padding zeroes. + HeaderLength uint32 `protobuf:"varint,4,opt,name=header_length,json=headerLength,proto3" json:"header_length,omitempty"` + // Chunk of a parent header. + Header []byte `protobuf:"bytes,5,opt,name=header,proto3" json:"header,omitempty"` +} + +func (x *Header_EC) Reset() { + *x = Header_EC{} + if protoimpl.UnsafeEnabled { + mi := &file_object_grpc_types_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Header_EC) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Header_EC) ProtoMessage() {} + +func (x *Header_EC) ProtoReflect() protoreflect.Message { + mi := &file_object_grpc_types_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Header_EC.ProtoReflect.Descriptor instead. +func (*Header_EC) Descriptor() ([]byte, []int) { + return file_object_grpc_types_proto_rawDescGZIP(), []int{1, 2} +} + +func (x *Header_EC) GetParent() *grpc.ObjectID { + if x != nil { + return x.Parent + } + return nil +} + +func (x *Header_EC) GetIndex() uint32 { + if x != nil { + return x.Index + } + return 0 +} + +func (x *Header_EC) GetTotal() uint32 { + if x != nil { + return x.Total + } + return 0 +} + +func (x *Header_EC) GetHeaderLength() uint32 { + if x != nil { + return x.HeaderLength + } + return 0 +} + +func (x *Header_EC) GetHeader() []byte { + if x != nil { + return x.Header + } + return nil +} + +type ECInfo_Chunk struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Object ID of the chunk. + Id *grpc.ObjectID `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + // Index of the chunk. + Index uint32 `protobuf:"varint,2,opt,name=index,proto3" json:"index,omitempty"` + // Total number of chunks in this split. + Total uint32 `protobuf:"varint,3,opt,name=total,proto3" json:"total,omitempty"` +} + +func (x *ECInfo_Chunk) Reset() { + *x = ECInfo_Chunk{} + if protoimpl.UnsafeEnabled { + mi := &file_object_grpc_types_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ECInfo_Chunk) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ECInfo_Chunk) ProtoMessage() {} + +func (x *ECInfo_Chunk) ProtoReflect() protoreflect.Message { + mi := &file_object_grpc_types_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ECInfo_Chunk.ProtoReflect.Descriptor instead. +func (*ECInfo_Chunk) Descriptor() ([]byte, []int) { + return file_object_grpc_types_proto_rawDescGZIP(), []int{4, 0} +} + +func (x *ECInfo_Chunk) GetId() *grpc.ObjectID { + if x != nil { + return x.Id + } + return nil +} + +func (x *ECInfo_Chunk) GetIndex() uint32 { + if x != nil { + return x.Index + } + return 0 +} + +func (x *ECInfo_Chunk) GetTotal() uint32 { + if x != nil { + return x.Total + } + return 0 +} + var File_object_grpc_types_proto protoreflect.FileDescriptor var file_object_grpc_types_proto_rawDesc = []byte{ @@ -779,7 +991,7 @@ var file_object_grpc_types_proto_rawDesc = []byte{ 0x68, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x52, 0x0f, 0x68, 0x6f, 0x6d, 0x6f, 0x6d, 0x6f, 0x72, 0x70, 0x68, 0x69, 0x63, 0x48, 0x61, - 0x73, 0x68, 0x22, 0xfb, 0x07, 0x0a, 0x06, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x31, 0x0a, + 0x73, 0x68, 0x22, 0xca, 0x09, 0x0a, 0x06, 0x48, 0x65, 0x61, 0x64, 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, @@ -819,69 +1031,92 @@ var file_object_grpc_types_proto_rawDesc = []byte{ 0x05, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x2e, 0x53, 0x70, 0x6c, 0x69, 0x74, 0x52, 0x05, 0x73, 0x70, - 0x6c, 0x69, 0x74, 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, 0x1a, 0xc5, 0x02, 0x0a, 0x05, 0x53, 0x70, 0x6c, - 0x69, 0x74, 0x12, 0x30, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, - 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, 0x06, 0x70, 0x61, - 0x72, 0x65, 0x6e, 0x74, 0x12, 0x34, 0x0a, 0x08, 0x70, 0x72, 0x65, 0x76, 0x69, 0x6f, 0x75, 0x73, - 0x18, 0x02, 0x20, 0x01, 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, 0x08, 0x70, 0x72, 0x65, 0x76, 0x69, 0x6f, 0x75, 0x73, 0x12, 0x44, 0x0a, 0x10, 0x70, 0x61, - 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x03, + 0x6c, 0x69, 0x74, 0x12, 0x2b, 0x0a, 0x02, 0x65, 0x63, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, + 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x2e, 0x45, 0x43, 0x52, 0x02, 0x65, 0x63, + 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, 0x1a, 0xc5, 0x02, 0x0a, 0x05, 0x53, 0x70, 0x6c, 0x69, 0x74, 0x12, + 0x30, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 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, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, + 0x74, 0x12, 0x34, 0x0a, 0x08, 0x70, 0x72, 0x65, 0x76, 0x69, 0x6f, 0x75, 0x73, 0x18, 0x02, 0x20, + 0x01, 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, 0x08, 0x70, + 0x72, 0x65, 0x76, 0x69, 0x6f, 0x75, 0x73, 0x12, 0x44, 0x0a, 0x10, 0x70, 0x61, 0x72, 0x65, 0x6e, + 0x74, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, + 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x0f, 0x70, 0x61, + 0x72, 0x65, 0x6e, 0x74, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x3d, 0x0a, + 0x0d, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0c, + 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x34, 0x0a, 0x08, + 0x63, 0x68, 0x69, 0x6c, 0x64, 0x72, 0x65, 0x6e, 0x18, 0x05, 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, 0x08, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x72, + 0x65, 0x6e, 0x12, 0x19, 0x0a, 0x08, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x06, + 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x49, 0x44, 0x1a, 0x9f, 0x01, + 0x0a, 0x02, 0x45, 0x43, 0x12, 0x30, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x18, 0x01, + 0x20, 0x01, 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, 0x06, + 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x14, 0x0a, 0x05, + 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x74, 0x6f, 0x74, + 0x61, 0x6c, 0x12, 0x23, 0x0a, 0x0d, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x5f, 0x6c, 0x65, 0x6e, + 0x67, 0x74, 0x68, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0c, 0x68, 0x65, 0x61, 0x64, 0x65, + 0x72, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x16, 0x0a, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, + 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x22, + 0xc4, 0x01, 0x0a, 0x06, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x35, 0x0a, 0x09, 0x6f, 0x62, + 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 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, 0x08, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x49, + 0x44, 0x12, 0x37, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, - 0x0f, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, - 0x12, 0x3d, 0x0a, 0x0d, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, - 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, - 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, - 0x72, 0x52, 0x0c, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, - 0x34, 0x0a, 0x08, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x72, 0x65, 0x6e, 0x18, 0x05, 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, 0x08, 0x63, 0x68, 0x69, - 0x6c, 0x64, 0x72, 0x65, 0x6e, 0x12, 0x19, 0x0a, 0x08, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x5f, 0x69, - 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x49, 0x44, - 0x22, 0xc4, 0x01, 0x0a, 0x06, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x35, 0x0a, 0x09, 0x6f, - 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 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, 0x08, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, - 0x49, 0x44, 0x12, 0x37, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, - 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, - 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x30, 0x0a, 0x06, 0x68, - 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, - 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x48, - 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x18, 0x0a, - 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, - 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x22, 0x8b, 0x01, 0x0a, 0x09, 0x53, 0x70, 0x6c, 0x69, - 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x19, 0x0a, 0x08, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x5f, 0x69, - 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x49, 0x64, - 0x12, 0x35, 0x0a, 0x09, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x70, 0x61, 0x72, 0x74, 0x18, 0x02, 0x20, - 0x01, 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, 0x08, 0x6c, - 0x61, 0x73, 0x74, 0x50, 0x61, 0x72, 0x74, 0x12, 0x2c, 0x0a, 0x04, 0x6c, 0x69, 0x6e, 0x6b, 0x18, - 0x03, 0x20, 0x01, 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, - 0x04, 0x6c, 0x69, 0x6e, 0x6b, 0x2a, 0x32, 0x0a, 0x0a, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x54, - 0x79, 0x70, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x52, 0x45, 0x47, 0x55, 0x4c, 0x41, 0x52, 0x10, 0x00, - 0x12, 0x0d, 0x0a, 0x09, 0x54, 0x4f, 0x4d, 0x42, 0x53, 0x54, 0x4f, 0x4e, 0x45, 0x10, 0x01, 0x12, - 0x08, 0x0a, 0x04, 0x4c, 0x4f, 0x43, 0x4b, 0x10, 0x03, 0x2a, 0x73, 0x0a, 0x09, 0x4d, 0x61, 0x74, - 0x63, 0x68, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1a, 0x0a, 0x16, 0x4d, 0x41, 0x54, 0x43, 0x48, 0x5f, - 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, - 0x10, 0x00, 0x12, 0x10, 0x0a, 0x0c, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x5f, 0x45, 0x51, 0x55, - 0x41, 0x4c, 0x10, 0x01, 0x12, 0x14, 0x0a, 0x10, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x5f, 0x4e, - 0x4f, 0x54, 0x5f, 0x45, 0x51, 0x55, 0x41, 0x4c, 0x10, 0x02, 0x12, 0x0f, 0x0a, 0x0b, 0x4e, 0x4f, - 0x54, 0x5f, 0x50, 0x52, 0x45, 0x53, 0x45, 0x4e, 0x54, 0x10, 0x03, 0x12, 0x11, 0x0a, 0x0d, 0x43, - 0x4f, 0x4d, 0x4d, 0x4f, 0x4e, 0x5f, 0x50, 0x52, 0x45, 0x46, 0x49, 0x58, 0x10, 0x04, 0x42, 0x61, - 0x5a, 0x42, 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, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, - 0x32, 0x2f, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x6f, 0x62, - 0x6a, 0x65, 0x63, 0x74, 0xaa, 0x02, 0x1a, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, - 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, - 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x30, 0x0a, 0x06, 0x68, 0x65, + 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, + 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x48, 0x65, + 0x61, 0x64, 0x65, 0x72, 0x52, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x18, 0x0a, 0x07, + 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x70, + 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x22, 0x8b, 0x01, 0x0a, 0x09, 0x53, 0x70, 0x6c, 0x69, 0x74, + 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x19, 0x0a, 0x08, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x5f, 0x69, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x49, 0x64, 0x12, + 0x35, 0x0a, 0x09, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x70, 0x61, 0x72, 0x74, 0x18, 0x02, 0x20, 0x01, + 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, 0x08, 0x6c, 0x61, + 0x73, 0x74, 0x50, 0x61, 0x72, 0x74, 0x12, 0x2c, 0x0a, 0x04, 0x6c, 0x69, 0x6e, 0x6b, 0x18, 0x03, + 0x20, 0x01, 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, 0x04, + 0x6c, 0x69, 0x6e, 0x6b, 0x22, 0x9f, 0x01, 0x0a, 0x06, 0x45, 0x43, 0x49, 0x6e, 0x66, 0x6f, 0x12, + 0x36, 0x0a, 0x06, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x1e, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, + 0x63, 0x74, 0x2e, 0x45, 0x43, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x43, 0x68, 0x75, 0x6e, 0x6b, 0x52, + 0x06, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x73, 0x1a, 0x5d, 0x0a, 0x05, 0x43, 0x68, 0x75, 0x6e, 0x6b, + 0x12, 0x28, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 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, 0x02, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x6e, + 0x64, 0x65, 0x78, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, + 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, + 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x2a, 0x32, 0x0a, 0x0a, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, + 0x54, 0x79, 0x70, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x52, 0x45, 0x47, 0x55, 0x4c, 0x41, 0x52, 0x10, + 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x54, 0x4f, 0x4d, 0x42, 0x53, 0x54, 0x4f, 0x4e, 0x45, 0x10, 0x01, + 0x12, 0x08, 0x0a, 0x04, 0x4c, 0x4f, 0x43, 0x4b, 0x10, 0x03, 0x2a, 0x73, 0x0a, 0x09, 0x4d, 0x61, + 0x74, 0x63, 0x68, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1a, 0x0a, 0x16, 0x4d, 0x41, 0x54, 0x43, 0x48, + 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, + 0x44, 0x10, 0x00, 0x12, 0x10, 0x0a, 0x0c, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x5f, 0x45, 0x51, + 0x55, 0x41, 0x4c, 0x10, 0x01, 0x12, 0x14, 0x0a, 0x10, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x5f, + 0x4e, 0x4f, 0x54, 0x5f, 0x45, 0x51, 0x55, 0x41, 0x4c, 0x10, 0x02, 0x12, 0x0f, 0x0a, 0x0b, 0x4e, + 0x4f, 0x54, 0x5f, 0x50, 0x52, 0x45, 0x53, 0x45, 0x4e, 0x54, 0x10, 0x03, 0x12, 0x11, 0x0a, 0x0d, + 0x43, 0x4f, 0x4d, 0x4d, 0x4f, 0x4e, 0x5f, 0x50, 0x52, 0x45, 0x46, 0x49, 0x58, 0x10, 0x04, 0x42, + 0x61, 0x5a, 0x42, 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, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, + 0x76, 0x32, 0x2f, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x6f, + 0x62, 0x6a, 0x65, 0x63, 0x74, 0xaa, 0x02, 0x1a, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, + 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x4f, 0x62, 0x6a, 0x65, + 0x63, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -897,7 +1132,7 @@ func file_object_grpc_types_proto_rawDescGZIP() []byte { } var file_object_grpc_types_proto_enumTypes = make([]protoimpl.EnumInfo, 2) -var file_object_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 6) +var file_object_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 9) var file_object_grpc_types_proto_goTypes = []interface{}{ (ObjectType)(0), // 0: neo.fs.v2.object.ObjectType (MatchType)(0), // 1: neo.fs.v2.object.MatchType @@ -905,46 +1140,53 @@ var file_object_grpc_types_proto_goTypes = []interface{}{ (*Header)(nil), // 3: neo.fs.v2.object.Header (*Object)(nil), // 4: neo.fs.v2.object.Object (*SplitInfo)(nil), // 5: neo.fs.v2.object.SplitInfo - (*Header_Attribute)(nil), // 6: neo.fs.v2.object.Header.Attribute - (*Header_Split)(nil), // 7: neo.fs.v2.object.Header.Split - (*grpc.Version)(nil), // 8: neo.fs.v2.refs.Version - (*grpc.OwnerID)(nil), // 9: neo.fs.v2.refs.OwnerID - (*grpc.Checksum)(nil), // 10: neo.fs.v2.refs.Checksum - (*grpc.ContainerID)(nil), // 11: neo.fs.v2.refs.ContainerID - (*grpc1.SessionToken)(nil), // 12: neo.fs.v2.session.SessionToken - (*grpc.ObjectID)(nil), // 13: neo.fs.v2.refs.ObjectID - (*grpc.Signature)(nil), // 14: neo.fs.v2.refs.Signature + (*ECInfo)(nil), // 6: neo.fs.v2.object.ECInfo + (*Header_Attribute)(nil), // 7: neo.fs.v2.object.Header.Attribute + (*Header_Split)(nil), // 8: neo.fs.v2.object.Header.Split + (*Header_EC)(nil), // 9: neo.fs.v2.object.Header.EC + (*ECInfo_Chunk)(nil), // 10: neo.fs.v2.object.ECInfo.Chunk + (*grpc.Version)(nil), // 11: neo.fs.v2.refs.Version + (*grpc.OwnerID)(nil), // 12: neo.fs.v2.refs.OwnerID + (*grpc.Checksum)(nil), // 13: neo.fs.v2.refs.Checksum + (*grpc.ContainerID)(nil), // 14: neo.fs.v2.refs.ContainerID + (*grpc1.SessionToken)(nil), // 15: neo.fs.v2.session.SessionToken + (*grpc.ObjectID)(nil), // 16: neo.fs.v2.refs.ObjectID + (*grpc.Signature)(nil), // 17: neo.fs.v2.refs.Signature } var file_object_grpc_types_proto_depIdxs = []int32{ - 8, // 0: neo.fs.v2.object.ShortHeader.version:type_name -> neo.fs.v2.refs.Version - 9, // 1: neo.fs.v2.object.ShortHeader.owner_id:type_name -> neo.fs.v2.refs.OwnerID + 11, // 0: neo.fs.v2.object.ShortHeader.version:type_name -> neo.fs.v2.refs.Version + 12, // 1: neo.fs.v2.object.ShortHeader.owner_id:type_name -> neo.fs.v2.refs.OwnerID 0, // 2: neo.fs.v2.object.ShortHeader.object_type:type_name -> neo.fs.v2.object.ObjectType - 10, // 3: neo.fs.v2.object.ShortHeader.payload_hash:type_name -> neo.fs.v2.refs.Checksum - 10, // 4: neo.fs.v2.object.ShortHeader.homomorphic_hash:type_name -> neo.fs.v2.refs.Checksum - 8, // 5: neo.fs.v2.object.Header.version:type_name -> neo.fs.v2.refs.Version - 11, // 6: neo.fs.v2.object.Header.container_id:type_name -> neo.fs.v2.refs.ContainerID - 9, // 7: neo.fs.v2.object.Header.owner_id:type_name -> neo.fs.v2.refs.OwnerID - 10, // 8: neo.fs.v2.object.Header.payload_hash:type_name -> neo.fs.v2.refs.Checksum + 13, // 3: neo.fs.v2.object.ShortHeader.payload_hash:type_name -> neo.fs.v2.refs.Checksum + 13, // 4: neo.fs.v2.object.ShortHeader.homomorphic_hash:type_name -> neo.fs.v2.refs.Checksum + 11, // 5: neo.fs.v2.object.Header.version:type_name -> neo.fs.v2.refs.Version + 14, // 6: neo.fs.v2.object.Header.container_id:type_name -> neo.fs.v2.refs.ContainerID + 12, // 7: neo.fs.v2.object.Header.owner_id:type_name -> neo.fs.v2.refs.OwnerID + 13, // 8: neo.fs.v2.object.Header.payload_hash:type_name -> neo.fs.v2.refs.Checksum 0, // 9: neo.fs.v2.object.Header.object_type:type_name -> neo.fs.v2.object.ObjectType - 10, // 10: neo.fs.v2.object.Header.homomorphic_hash:type_name -> neo.fs.v2.refs.Checksum - 12, // 11: neo.fs.v2.object.Header.session_token:type_name -> neo.fs.v2.session.SessionToken - 6, // 12: neo.fs.v2.object.Header.attributes:type_name -> neo.fs.v2.object.Header.Attribute - 7, // 13: neo.fs.v2.object.Header.split:type_name -> neo.fs.v2.object.Header.Split - 13, // 14: neo.fs.v2.object.Object.object_id:type_name -> neo.fs.v2.refs.ObjectID - 14, // 15: neo.fs.v2.object.Object.signature:type_name -> neo.fs.v2.refs.Signature - 3, // 16: neo.fs.v2.object.Object.header:type_name -> neo.fs.v2.object.Header - 13, // 17: neo.fs.v2.object.SplitInfo.last_part:type_name -> neo.fs.v2.refs.ObjectID - 13, // 18: neo.fs.v2.object.SplitInfo.link:type_name -> neo.fs.v2.refs.ObjectID - 13, // 19: neo.fs.v2.object.Header.Split.parent:type_name -> neo.fs.v2.refs.ObjectID - 13, // 20: neo.fs.v2.object.Header.Split.previous:type_name -> neo.fs.v2.refs.ObjectID - 14, // 21: neo.fs.v2.object.Header.Split.parent_signature:type_name -> neo.fs.v2.refs.Signature - 3, // 22: neo.fs.v2.object.Header.Split.parent_header:type_name -> neo.fs.v2.object.Header - 13, // 23: neo.fs.v2.object.Header.Split.children:type_name -> neo.fs.v2.refs.ObjectID - 24, // [24:24] is the sub-list for method output_type - 24, // [24:24] is the sub-list for method input_type - 24, // [24:24] is the sub-list for extension type_name - 24, // [24:24] is the sub-list for extension extendee - 0, // [0:24] is the sub-list for field type_name + 13, // 10: neo.fs.v2.object.Header.homomorphic_hash:type_name -> neo.fs.v2.refs.Checksum + 15, // 11: neo.fs.v2.object.Header.session_token:type_name -> neo.fs.v2.session.SessionToken + 7, // 12: neo.fs.v2.object.Header.attributes:type_name -> neo.fs.v2.object.Header.Attribute + 8, // 13: neo.fs.v2.object.Header.split:type_name -> neo.fs.v2.object.Header.Split + 9, // 14: neo.fs.v2.object.Header.ec:type_name -> neo.fs.v2.object.Header.EC + 16, // 15: neo.fs.v2.object.Object.object_id:type_name -> neo.fs.v2.refs.ObjectID + 17, // 16: neo.fs.v2.object.Object.signature:type_name -> neo.fs.v2.refs.Signature + 3, // 17: neo.fs.v2.object.Object.header:type_name -> neo.fs.v2.object.Header + 16, // 18: neo.fs.v2.object.SplitInfo.last_part:type_name -> neo.fs.v2.refs.ObjectID + 16, // 19: neo.fs.v2.object.SplitInfo.link:type_name -> neo.fs.v2.refs.ObjectID + 10, // 20: neo.fs.v2.object.ECInfo.chunks:type_name -> neo.fs.v2.object.ECInfo.Chunk + 16, // 21: neo.fs.v2.object.Header.Split.parent:type_name -> neo.fs.v2.refs.ObjectID + 16, // 22: neo.fs.v2.object.Header.Split.previous:type_name -> neo.fs.v2.refs.ObjectID + 17, // 23: neo.fs.v2.object.Header.Split.parent_signature:type_name -> neo.fs.v2.refs.Signature + 3, // 24: neo.fs.v2.object.Header.Split.parent_header:type_name -> neo.fs.v2.object.Header + 16, // 25: neo.fs.v2.object.Header.Split.children:type_name -> neo.fs.v2.refs.ObjectID + 16, // 26: neo.fs.v2.object.Header.EC.parent:type_name -> neo.fs.v2.refs.ObjectID + 16, // 27: neo.fs.v2.object.ECInfo.Chunk.id:type_name -> neo.fs.v2.refs.ObjectID + 28, // [28:28] is the sub-list for method output_type + 28, // [28:28] is the sub-list for method input_type + 28, // [28:28] is the sub-list for extension type_name + 28, // [28:28] is the sub-list for extension extendee + 0, // [0:28] is the sub-list for field type_name } func init() { file_object_grpc_types_proto_init() } @@ -1002,7 +1244,7 @@ func file_object_grpc_types_proto_init() { } } file_object_grpc_types_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Header_Attribute); i { + switch v := v.(*ECInfo); i { case 0: return &v.state case 1: @@ -1014,6 +1256,18 @@ func file_object_grpc_types_proto_init() { } } file_object_grpc_types_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Header_Attribute); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_object_grpc_types_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Header_Split); i { case 0: return &v.state @@ -1025,6 +1279,30 @@ func file_object_grpc_types_proto_init() { return nil } } + file_object_grpc_types_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Header_EC); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_object_grpc_types_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ECInfo_Chunk); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } type x struct{} out := protoimpl.TypeBuilder{ @@ -1032,7 +1310,7 @@ func file_object_grpc_types_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_object_grpc_types_proto_rawDesc, NumEnums: 2, - NumMessages: 6, + NumMessages: 9, NumExtensions: 0, NumServices: 0, }, diff --git a/object/marshal.go b/object/marshal.go index ddd5746..989dd43 100644 --- a/object/marshal.go +++ b/object/marshal.go @@ -26,6 +26,12 @@ const ( splitHdrChildrenField = 5 splitHdrSplitIDField = 6 + ecHdrParentField = 1 + ecHdrIndexField = 2 + ecHdrTotalField = 3 + ecHdrHeaderLengthField = 4 + ecHdrHeaderField = 5 + hdrVersionField = 1 hdrContainerIDField = 2 hdrOwnerIDField = 3 @@ -37,6 +43,7 @@ const ( hdrSessionTokenField = 9 hdrAttributesField = 10 hdrSplitField = 11 + hdrECField = 12 hdrWithSigHeaderField = 1 hdrWithSigSignatureField = 2 @@ -229,6 +236,43 @@ func (h *SplitHeader) Unmarshal(data []byte) error { return message.Unmarshal(h, data, new(object.Header_Split)) } +func (h *ECHeader) StableMarshal(buf []byte) []byte { + if h == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, h.StableSize()) + } + + var offset int + + offset += proto.NestedStructureMarshal(ecHdrParentField, buf[offset:], h.Parent) + offset += proto.UInt32Marshal(ecHdrIndexField, buf[offset:], h.Index) + offset += proto.UInt32Marshal(ecHdrTotalField, buf[offset:], h.Total) + offset += proto.UInt32Marshal(ecHdrHeaderLengthField, buf[offset:], h.HeaderLength) + proto.BytesMarshal(ecHdrHeaderField, buf[offset:], h.Header) + return buf +} + +func (h *ECHeader) StableSize() (size int) { + if h == nil { + return 0 + } + + size += proto.NestedStructureSize(ecHdrParentField, h.Parent) + size += proto.UInt32Size(ecHdrIndexField, h.Index) + size += proto.UInt32Size(ecHdrTotalField, h.Total) + size += proto.UInt32Size(ecHdrHeaderLengthField, h.HeaderLength) + size += proto.BytesSize(ecHdrHeaderField, h.Header) + + return size +} + +func (h *ECHeader) Unmarshal(data []byte) error { + return message.Unmarshal(h, data, new(object.Header_EC)) +} + func (h *Header) StableMarshal(buf []byte) []byte { if h == nil { return []byte{} @@ -255,6 +299,7 @@ func (h *Header) StableMarshal(buf []byte) []byte { } proto.NestedStructureMarshal(hdrSplitField, buf[offset:], h.split) + proto.NestedStructureMarshal(hdrECField, buf[offset:], h.ec) return buf } @@ -277,6 +322,7 @@ func (h *Header) StableSize() (size int) { size += proto.NestedStructureSize(hdrAttributesField, &h.attr[i]) } size += proto.NestedStructureSize(hdrSplitField, h.split) + size += proto.NestedStructureSize(hdrECField, h.ec) return size } diff --git a/object/message_test.go b/object/message_test.go index a111c60..e675f49 100644 --- a/object/message_test.go +++ b/object/message_test.go @@ -16,6 +16,7 @@ func TestMessageConvert(t *testing.T) { func(empty bool) message.Message { return objecttest.GenerateHeader(empty) }, func(empty bool) message.Message { return objecttest.GenerateObject(empty) }, func(empty bool) message.Message { return objecttest.GenerateSplitInfo(empty) }, + func(empty bool) message.Message { return objecttest.GenerateECInfo(empty) }, func(empty bool) message.Message { return objecttest.GenerateGetRequestBody(empty) }, func(empty bool) message.Message { return objecttest.GenerateGetRequest(empty) }, func(empty bool) message.Message { return objecttest.GenerateGetObjectPartInit(empty) }, diff --git a/object/test/generate.go b/object/test/generate.go index 085880c..b107023 100644 --- a/object/test/generate.go +++ b/object/test/generate.go @@ -137,6 +137,31 @@ func GenerateSplitInfo(empty bool) *object.SplitInfo { return m } +func GenerateECInfo(empty bool) *object.ECInfo { + m := new(object.ECInfo) + + if !empty { + m.Chunks = make([]object.ECChunk, 2) + for i := range m.Chunks { + m.Chunks[i] = *GenerateECChunk(false) + } + } + + return m +} + +func GenerateECChunk(empty bool) *object.ECChunk { + m := new(object.ECChunk) + + if !empty { + m.ID = *refstest.GenerateObjectID(false) + m.Index = 4 + m.Total = 7 + } + + return m +} + func GenerateGetRequestBody(empty bool) *object.GetRequestBody { m := new(object.GetRequestBody) diff --git a/object/types.go b/object/types.go index f9e2ed6..3af08b6 100644 --- a/object/types.go +++ b/object/types.go @@ -39,6 +39,15 @@ type SplitHeader struct { splitID []byte } +type ECHeader struct { + Parent *refs.ObjectID + Index uint32 + Total uint32 + Header []byte + HeaderLength uint32 + Signature []byte +} + type Header struct { version *refs.Version @@ -59,6 +68,8 @@ type Header struct { attr []Attribute split *SplitHeader + + ec *ECHeader } type HeaderWithSignature struct { @@ -88,6 +99,16 @@ type SplitInfo struct { link *refs.ObjectID } +type ECChunk struct { + ID refs.ObjectID + Index uint32 + Total uint32 +} + +type ECInfo struct { + Chunks []ECChunk +} + type GetRequestBody struct { addr *refs.Address @@ -655,6 +676,17 @@ func (h *Header) SetSplit(v *SplitHeader) { h.split = v } +func (h *Header) GetEC() *ECHeader { + if h != nil { + return h.ec + } + return nil +} + +func (h *Header) SetEC(v *ECHeader) { + h.ec = v +} + func (h *HeaderWithSignature) GetHeader() *Header { if h != nil { return h.header diff --git a/refs/grpc/types.pb.go b/refs/grpc/types.pb.go index cfb51ea..681bb0d 100644 --- a/refs/grpc/types.pb.go +++ b/refs/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.30.0 -// protoc v4.23.4 +// protoc-gen-go v1.33.0 +// protoc v4.25.3 // source: refs/grpc/types.proto package refs @@ -20,7 +20,8 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -// Signature scheme describes digital signing scheme used for (key, signature) pair. +// Signature scheme describes digital signing scheme used for (key, signature) +// pair. type SignatureScheme int32 const ( @@ -193,8 +194,8 @@ func (x *Address) GetObjectId() *ObjectID { // // `ObjectID` is a 32 byte long // [SHA256](https://csrc.nist.gov/publications/detail/fips/180/4/final) hash of -// the object's `header` field, which, in it's turn, contains the hash of the object's -// payload. +// the object's `header` field, which, in it's turn, contains the hash of the +// object's payload. // // String presentation is a // [base58](https://tools.ietf.org/html/draft-msporny-base58-02) encoded string. @@ -381,7 +382,8 @@ func (x *OwnerID) GetValue() []byte { // API version used by a node. // // String presentation is a Semantic Versioning 2.0.0 compatible version string -// with 'v' prefix. i.e. `vX.Y`, where `X` is the major number, `Y` is the minor number. +// with 'v' prefix. i.e. `vX.Y`, where `X` is the major number, `Y` is the minor +// number. type Version struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache diff --git a/session/grpc/service.pb.go b/session/grpc/service.pb.go index c01bfa8..a6fa504 100644 --- a/session/grpc/service.pb.go +++ b/session/grpc/service.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.30.0 -// protoc v4.23.4 +// protoc-gen-go v1.33.0 +// protoc v4.25.3 // source: session/grpc/service.proto package session diff --git a/session/grpc/service_grpc.pb.go b/session/grpc/service_grpc.pb.go index a67c47a..bdcc3ba 100644 --- a/session/grpc/service_grpc.pb.go +++ b/session/grpc/service_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.3.0 -// - protoc v4.23.4 +// - protoc v4.25.3 // source: session/grpc/service.proto package session diff --git a/session/grpc/types.pb.go b/session/grpc/types.pb.go index 23e46c7..e16a7c6 100644 --- a/session/grpc/types.pb.go +++ b/session/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.30.0 -// protoc v4.23.4 +// protoc-gen-go v1.33.0 +// protoc v4.25.3 // source: session/grpc/types.proto package session @@ -342,15 +342,15 @@ func (x *SessionToken) GetSignature() *grpc.Signature { return nil } -// Extended headers for Request/Response. They may contain any user-defined headers -// to be interpreted on application level. +// Extended headers for Request/Response. They may contain any user-defined +// headers to be interpreted on application level. // -// Key name must be a unique valid UTF-8 string. Value can't be empty. Requests or -// Responses with duplicated header names or headers with empty values will be -// considered invalid. +// Key name must be a unique valid UTF-8 string. Value can't be empty. Requests +// or Responses with duplicated header names or headers with empty values will +// be considered invalid. // -// There are some "well-known" headers starting with `__SYSTEM__` (`__NEOFS__` is deprecated) prefix that -// affect system behaviour: +// There are some "well-known" headers starting with `__SYSTEM__` (`__NEOFS__` +// is deprecated) prefix that affect system behaviour: // // - [ __SYSTEM__NETMAP_EPOCH ] \ // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ @@ -361,8 +361,8 @@ func (x *SessionToken) GetSignature() *grpc.Signature { // (`__NEOFS__NETMAP_LOOKUP_DEPTH` is deprecated) \ // If object can't be found using current epoch's netmap, this header limits // how many past epochs the node can look up through. The `value` is string -// encoded `uint64` in decimal presentation. If set to '0' or not set, only the -// current epoch will be used. +// encoded `uint64` in decimal presentation. If set to '0' or not set, only +// the current epoch will be used. type XHeader struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache diff --git a/status/grpc/types.pb.go b/status/grpc/types.pb.go index ddbaa6c..0972805 100644 --- a/status/grpc/types.pb.go +++ b/status/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.30.0 -// protoc v4.23.4 +// protoc-gen-go v1.33.0 +// protoc v4.25.3 // source: status/grpc/types.proto package status diff --git a/tombstone/grpc/types.pb.go b/tombstone/grpc/types.pb.go index 109a131..6a064dc 100644 --- a/tombstone/grpc/types.pb.go +++ b/tombstone/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.30.0 -// protoc v4.23.4 +// protoc-gen-go v1.33.0 +// protoc v4.25.3 // source: tombstone/grpc/types.proto package tombstone @@ -28,9 +28,10 @@ type Tombstone struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // Last NeoFS epoch number of the tombstone lifetime. It's set by the tombstone - // creator depending on the current NeoFS network settings. A tombstone object - // must have the same expiration epoch value in `__SYSTEM__EXPIRATION_EPOCH` (`__NEOFS__EXPIRATION_EPOCH` is deprecated) + // Last NeoFS epoch number of the tombstone lifetime. It's set by the + // tombstone creator depending on the current NeoFS network settings. A + // tombstone object must have the same expiration epoch value in + // `__SYSTEM__EXPIRATION_EPOCH` (`__NEOFS__EXPIRATION_EPOCH` is deprecated) // attribute. Otherwise, the tombstone will be rejected by a storage node. ExpirationEpoch uint64 `protobuf:"varint,1,opt,name=expiration_epoch,json=expirationEpoch,proto3" json:"expiration_epoch,omitempty"` // 16 byte UUID used to identify the split object hierarchy parts. Must be diff --git a/util/proto/test/test.pb.go b/util/proto/test/test.pb.go index 2fa2d4e..0b9f43d 100644 --- a/util/proto/test/test.pb.go +++ b/util/proto/test/test.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.30.0 -// protoc v4.23.4 +// protoc-gen-go v1.33.0 +// protoc v4.25.3 // source: util/proto/test/test.proto package test From 6e9d385f3c72e4eeabd5b30cf89308a4cafd9425 Mon Sep 17 00:00:00 2001 From: Airat Arifullin Date: Tue, 26 Mar 2024 18:52:20 +0300 Subject: [PATCH 1115/1196] [#71] container: Introduce CONTAINER_ACCESS_DENIED status * Regenerate protobufs for object and container service to use a new frostfs-api status CONTAINER_ACCESS_DENIED. Signed-off-by: Airat Arifullin --- container/grpc/service_grpc.pb.go | 48 +++++++++++++++++++++++-------- object/grpc/service_grpc.pb.go | 32 +++++++++++++++++++++ status/grpc/types.pb.go | 33 ++++++++++++--------- 3 files changed, 87 insertions(+), 26 deletions(-) diff --git a/container/grpc/service_grpc.pb.go b/container/grpc/service_grpc.pb.go index 79b0533..6ae8ade 100644 --- a/container/grpc/service_grpc.pb.go +++ b/container/grpc/service_grpc.pb.go @@ -40,7 +40,9 @@ type ContainerServiceClient interface { // Statuses: // - **OK** (0, SECTION_SUCCESS): \ // request to save the container has been sent to the sidechain; - // - Common failures (SECTION_FAILURE_COMMON). + // - 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 @@ -50,7 +52,9 @@ type ContainerServiceClient interface { // Statuses: // - **OK** (0, SECTION_SUCCESS): \ // request to remove the container has been sent to the sidechain; - // - Common failures (SECTION_FAILURE_COMMON). + // - 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. // @@ -59,14 +63,18 @@ type ContainerServiceClient interface { // container has been successfully read; // - Common failures (SECTION_FAILURE_COMMON); // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ - // requested container not found. + // 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. // // Statuses: // - **OK** (0, SECTION_SUCCESS): \ // container list has been successfully read; - // - Common failures (SECTION_FAILURE_COMMON). + // - 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) // Invokes 'SetEACL' method of 'Container` smart contract and returns response // immediately. After one more block in sidechain, changes in an Extended ACL @@ -75,7 +83,9 @@ type ContainerServiceClient interface { // Statuses: // - **OK** (0, SECTION_SUCCESS): \ // request to save container eACL has been sent to the sidechain; - // - Common failures (SECTION_FAILURE_COMMON). + // - Common failures (SECTION_FAILURE_COMMON); + // - **CONTAINER_ACCESS_DENIED** (3074, SECTION_CONTAINER): \ + // set container eACL access denied. SetExtendedACL(ctx context.Context, in *SetExtendedACLRequest, opts ...grpc.CallOption) (*SetExtendedACLResponse, error) // Returns Extended ACL table and signature from `Container` smart contract // storage. @@ -87,7 +97,9 @@ type ContainerServiceClient interface { // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ // container not found; // - **EACL_NOT_FOUND** (3073, SECTION_CONTAINER): \ - // eACL table not found. + // eACL table not found; + // - **CONTAINER_ACCESS_DENIED** (3074, SECTION_CONTAINER): \ + // access to container eACL is denied. GetExtendedACL(ctx context.Context, in *GetExtendedACLRequest, opts ...grpc.CallOption) (*GetExtendedACLResponse, error) // Announces the space values used by the container for P2P synchronization. // @@ -181,7 +193,9 @@ type ContainerServiceServer interface { // Statuses: // - **OK** (0, SECTION_SUCCESS): \ // request to save the container has been sent to the sidechain; - // - Common failures (SECTION_FAILURE_COMMON). + // - 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 @@ -191,7 +205,9 @@ type ContainerServiceServer interface { // Statuses: // - **OK** (0, SECTION_SUCCESS): \ // request to remove the container has been sent to the sidechain; - // - Common failures (SECTION_FAILURE_COMMON). + // - 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. // @@ -200,14 +216,18 @@ type ContainerServiceServer interface { // container has been successfully read; // - Common failures (SECTION_FAILURE_COMMON); // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ - // requested container not found. + // 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. // // Statuses: // - **OK** (0, SECTION_SUCCESS): \ // container list has been successfully read; - // - Common failures (SECTION_FAILURE_COMMON). + // - Common failures (SECTION_FAILURE_COMMON); + // - **CONTAINER_ACCESS_DENIED** (3074, SECTION_CONTAINER): \ + // container list access denied. List(context.Context, *ListRequest) (*ListResponse, error) // Invokes 'SetEACL' method of 'Container` smart contract and returns response // immediately. After one more block in sidechain, changes in an Extended ACL @@ -216,7 +236,9 @@ type ContainerServiceServer interface { // Statuses: // - **OK** (0, SECTION_SUCCESS): \ // request to save container eACL has been sent to the sidechain; - // - Common failures (SECTION_FAILURE_COMMON). + // - Common failures (SECTION_FAILURE_COMMON); + // - **CONTAINER_ACCESS_DENIED** (3074, SECTION_CONTAINER): \ + // set container eACL access denied. SetExtendedACL(context.Context, *SetExtendedACLRequest) (*SetExtendedACLResponse, error) // Returns Extended ACL table and signature from `Container` smart contract // storage. @@ -228,7 +250,9 @@ type ContainerServiceServer interface { // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ // container not found; // - **EACL_NOT_FOUND** (3073, SECTION_CONTAINER): \ - // eACL table not found. + // eACL table not found; + // - **CONTAINER_ACCESS_DENIED** (3074, SECTION_CONTAINER): \ + // access to container eACL is denied. GetExtendedACL(context.Context, *GetExtendedACLRequest) (*GetExtendedACLResponse, error) // Announces the space values used by the container for P2P synchronization. // diff --git a/object/grpc/service_grpc.pb.go b/object/grpc/service_grpc.pb.go index 1edf647..16af44a 100644 --- a/object/grpc/service_grpc.pb.go +++ b/object/grpc/service_grpc.pb.go @@ -66,6 +66,8 @@ type ObjectServiceClient interface { // the requested object has been marked as deleted; // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ // object container not found; + // - **CONTAINER_ACCESS_DENIED** (3074, SECTION_CONTAINER): \ + // access to container is denied; // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ // provided session token has expired. Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (ObjectService_GetClient, error) @@ -98,6 +100,8 @@ type ObjectServiceClient interface { // type other than REGULAR is prohibited; // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ // object storage container not found; + // - **CONTAINER_ACCESS_DENIED** (3074, SECTION_CONTAINER): \ + // access to container is denied; // - **TOKEN_NOT_FOUND** (4096, SECTION_SESSION): \ // (for trusted object preparation) session private key does not exist or // has @@ -130,6 +134,8 @@ type ObjectServiceClient interface { // deleting a locked object is prohibited; // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ // object container not found; + // - **CONTAINER_ACCESS_DENIED** (3074, SECTION_CONTAINER): \ + // access to container is denied; // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ // provided session token has expired. Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteResponse, error) @@ -157,6 +163,8 @@ type ObjectServiceClient interface { // the requested object has been marked as deleted; // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ // object container not found; + // - **CONTAINER_ACCESS_DENIED** (3074, SECTION_CONTAINER): \ + // access to container is denied; // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ // provided session token has expired. Head(ctx context.Context, in *HeadRequest, opts ...grpc.CallOption) (*HeadResponse, error) @@ -180,6 +188,8 @@ type ObjectServiceClient interface { // access to operation SEARCH of the object is denied; // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ // search container not found; + // - **CONTAINER_ACCESS_DENIED** (3074, SECTION_CONTAINER): \ + // access to container is denied; // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ // provided session token has expired. Search(ctx context.Context, in *SearchRequest, opts ...grpc.CallOption) (ObjectService_SearchClient, error) @@ -214,6 +224,8 @@ type ObjectServiceClient interface { // the requested range is out of bounds; // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ // object container not found; + // - **CONTAINER_ACCESS_DENIED** (3074, SECTION_CONTAINER): \ + // access to container is denied; // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ // provided session token has expired. GetRange(ctx context.Context, in *GetRangeRequest, opts ...grpc.CallOption) (ObjectService_GetRangeClient, error) @@ -246,6 +258,8 @@ type ObjectServiceClient interface { // the requested range is out of bounds; // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ // object container not found; + // - **CONTAINER_ACCESS_DENIED** (3074, SECTION_CONTAINER): \ + // access to container is denied; // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ // provided session token has expired. GetRangeHash(ctx context.Context, in *GetRangeHashRequest, opts ...grpc.CallOption) (*GetRangeHashResponse, error) @@ -275,6 +289,8 @@ type ObjectServiceClient interface { // type other than REGULAR is prohibited; // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ // object storage container not found; + // - **CONTAINER_ACCESS_DENIED** (3074, SECTION_CONTAINER): \ + // access to container is denied; // - **TOKEN_NOT_FOUND** (4096, SECTION_SESSION): \ // (for trusted object preparation) session private key does not exist or // has @@ -496,6 +512,8 @@ type ObjectServiceServer interface { // the requested object has been marked as deleted; // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ // object container not found; + // - **CONTAINER_ACCESS_DENIED** (3074, SECTION_CONTAINER): \ + // access to container is denied; // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ // provided session token has expired. Get(*GetRequest, ObjectService_GetServer) error @@ -528,6 +546,8 @@ type ObjectServiceServer interface { // type other than REGULAR is prohibited; // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ // object storage container not found; + // - **CONTAINER_ACCESS_DENIED** (3074, SECTION_CONTAINER): \ + // access to container is denied; // - **TOKEN_NOT_FOUND** (4096, SECTION_SESSION): \ // (for trusted object preparation) session private key does not exist or // has @@ -560,6 +580,8 @@ type ObjectServiceServer interface { // deleting a locked object is prohibited; // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ // object container not found; + // - **CONTAINER_ACCESS_DENIED** (3074, SECTION_CONTAINER): \ + // access to container is denied; // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ // provided session token has expired. Delete(context.Context, *DeleteRequest) (*DeleteResponse, error) @@ -587,6 +609,8 @@ type ObjectServiceServer interface { // the requested object has been marked as deleted; // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ // object container not found; + // - **CONTAINER_ACCESS_DENIED** (3074, SECTION_CONTAINER): \ + // access to container is denied; // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ // provided session token has expired. Head(context.Context, *HeadRequest) (*HeadResponse, error) @@ -610,6 +634,8 @@ type ObjectServiceServer interface { // access to operation SEARCH of the object is denied; // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ // search container not found; + // - **CONTAINER_ACCESS_DENIED** (3074, SECTION_CONTAINER): \ + // access to container is denied; // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ // provided session token has expired. Search(*SearchRequest, ObjectService_SearchServer) error @@ -644,6 +670,8 @@ type ObjectServiceServer interface { // the requested range is out of bounds; // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ // object container not found; + // - **CONTAINER_ACCESS_DENIED** (3074, SECTION_CONTAINER): \ + // access to container is denied; // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ // provided session token has expired. GetRange(*GetRangeRequest, ObjectService_GetRangeServer) error @@ -676,6 +704,8 @@ type ObjectServiceServer interface { // the requested range is out of bounds; // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ // object container not found; + // - **CONTAINER_ACCESS_DENIED** (3074, SECTION_CONTAINER): \ + // access to container is denied; // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ // provided session token has expired. GetRangeHash(context.Context, *GetRangeHashRequest) (*GetRangeHashResponse, error) @@ -705,6 +735,8 @@ type ObjectServiceServer interface { // type other than REGULAR is prohibited; // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ // object storage container not found; + // - **CONTAINER_ACCESS_DENIED** (3074, SECTION_CONTAINER): \ + // access to container is denied; // - **TOKEN_NOT_FOUND** (4096, SECTION_SESSION): \ // (for trusted object preparation) session private key does not exist or // has diff --git a/status/grpc/types.pb.go b/status/grpc/types.pb.go index 0972805..9637294 100644 --- a/status/grpc/types.pb.go +++ b/status/grpc/types.pb.go @@ -265,6 +265,8 @@ const ( Container_CONTAINER_NOT_FOUND Container = 0 // [**3073**] eACL table not found. Container_EACL_NOT_FOUND Container = 1 + // [**3074**] Container access denied. + Container_CONTAINER_ACCESS_DENIED Container = 2 ) // Enum value maps for Container. @@ -272,10 +274,12 @@ var ( Container_name = map[int32]string{ 0: "CONTAINER_NOT_FOUND", 1: "EACL_NOT_FOUND", + 2: "CONTAINER_ACCESS_DENIED", } Container_value = map[string]int32{ - "CONTAINER_NOT_FOUND": 0, - "EACL_NOT_FOUND": 1, + "CONTAINER_NOT_FOUND": 0, + "EACL_NOT_FOUND": 1, + "CONTAINER_ACCESS_DENIED": 2, } ) @@ -551,21 +555,22 @@ var file_status_grpc_types_proto_rawDesc = []byte{ 0x4c, 0x41, 0x52, 0x5f, 0x4f, 0x42, 0x4a, 0x45, 0x43, 0x54, 0x10, 0x03, 0x12, 0x1a, 0x0a, 0x16, 0x4f, 0x42, 0x4a, 0x45, 0x43, 0x54, 0x5f, 0x41, 0x4c, 0x52, 0x45, 0x41, 0x44, 0x59, 0x5f, 0x52, 0x45, 0x4d, 0x4f, 0x56, 0x45, 0x44, 0x10, 0x04, 0x12, 0x10, 0x0a, 0x0c, 0x4f, 0x55, 0x54, 0x5f, - 0x4f, 0x46, 0x5f, 0x52, 0x41, 0x4e, 0x47, 0x45, 0x10, 0x05, 0x2a, 0x38, 0x0a, 0x09, 0x43, 0x6f, + 0x4f, 0x46, 0x5f, 0x52, 0x41, 0x4e, 0x47, 0x45, 0x10, 0x05, 0x2a, 0x55, 0x0a, 0x09, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x12, 0x17, 0x0a, 0x13, 0x43, 0x4f, 0x4e, 0x54, 0x41, 0x49, 0x4e, 0x45, 0x52, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x46, 0x4f, 0x55, 0x4e, 0x44, 0x10, 0x00, 0x12, 0x12, 0x0a, 0x0e, 0x45, 0x41, 0x43, 0x4c, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x46, 0x4f, 0x55, - 0x4e, 0x44, 0x10, 0x01, 0x2a, 0x31, 0x0a, 0x07, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, - 0x13, 0x0a, 0x0f, 0x54, 0x4f, 0x4b, 0x45, 0x4e, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x46, 0x4f, 0x55, - 0x4e, 0x44, 0x10, 0x00, 0x12, 0x11, 0x0a, 0x0d, 0x54, 0x4f, 0x4b, 0x45, 0x4e, 0x5f, 0x45, 0x58, - 0x50, 0x49, 0x52, 0x45, 0x44, 0x10, 0x01, 0x42, 0x61, 0x5a, 0x42, 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, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x75, - 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0xaa, 0x02, 0x1a, - 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, - 0x41, 0x50, 0x49, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x33, + 0x4e, 0x44, 0x10, 0x01, 0x12, 0x1b, 0x0a, 0x17, 0x43, 0x4f, 0x4e, 0x54, 0x41, 0x49, 0x4e, 0x45, + 0x52, 0x5f, 0x41, 0x43, 0x43, 0x45, 0x53, 0x53, 0x5f, 0x44, 0x45, 0x4e, 0x49, 0x45, 0x44, 0x10, + 0x02, 0x2a, 0x31, 0x0a, 0x07, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x13, 0x0a, 0x0f, + 0x54, 0x4f, 0x4b, 0x45, 0x4e, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x46, 0x4f, 0x55, 0x4e, 0x44, 0x10, + 0x00, 0x12, 0x11, 0x0a, 0x0d, 0x54, 0x4f, 0x4b, 0x45, 0x4e, 0x5f, 0x45, 0x58, 0x50, 0x49, 0x52, + 0x45, 0x44, 0x10, 0x01, 0x42, 0x61, 0x5a, 0x42, 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, 0x61, 0x70, + 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2f, 0x67, + 0x72, 0x70, 0x63, 0x3b, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0xaa, 0x02, 0x1a, 0x4e, 0x65, 0x6f, + 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, + 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( From 491a47e7fe2474554581c7fa1d19e943642a1c94 Mon Sep 17 00:00:00 2001 From: Airat Arifullin Date: Wed, 27 Mar 2024 12:56:03 +0300 Subject: [PATCH 1116/1196] [#70] netmap: Regenerate protobuf for Replica * Since EC field tags are renumerated, it is required to regenerate netmap grpc. * Add a generator with EC replica to check it with unit-test. Signed-off-by: Airat Arifullin --- netmap/grpc/types.pb.go | 8 ++++---- netmap/test/generate.go | 12 ++++++++++++ 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/netmap/grpc/types.pb.go b/netmap/grpc/types.pb.go index 385713d..59f8612 100644 --- a/netmap/grpc/types.pb.go +++ b/netmap/grpc/types.pb.go @@ -402,9 +402,9 @@ type Replica struct { // Named selector bucket to put replicas Selector string `protobuf:"bytes,2,opt,name=selector,proto3" json:"selector,omitempty"` // Data shards count - EcDataCount uint32 `protobuf:"varint,6,opt,name=ec_data_count,json=ecDataCount,proto3" json:"ec_data_count,omitempty"` + EcDataCount uint32 `protobuf:"varint,3,opt,name=ec_data_count,json=ecDataCount,proto3" json:"ec_data_count,omitempty"` // Parity shards count - EcParityCount uint32 `protobuf:"varint,7,opt,name=ec_parity_count,json=ecParityCount,proto3" json:"ec_parity_count,omitempty"` + EcParityCount uint32 `protobuf:"varint,4,opt,name=ec_parity_count,json=ecParityCount,proto3" json:"ec_parity_count,omitempty"` } func (x *Replica) Reset() { @@ -1081,9 +1081,9 @@ var file_netmap_grpc_types_proto_rawDesc = []byte{ 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x12, 0x22, 0x0a, 0x0d, 0x65, 0x63, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x63, 0x6f, 0x75, 0x6e, - 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0b, 0x65, 0x63, 0x44, 0x61, 0x74, 0x61, 0x43, + 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0b, 0x65, 0x63, 0x44, 0x61, 0x74, 0x61, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x26, 0x0a, 0x0f, 0x65, 0x63, 0x5f, 0x70, 0x61, 0x72, 0x69, 0x74, - 0x79, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0d, 0x65, + 0x79, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0d, 0x65, 0x63, 0x50, 0x61, 0x72, 0x69, 0x74, 0x79, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x86, 0x02, 0x0a, 0x0f, 0x50, 0x6c, 0x61, 0x63, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x35, 0x0a, 0x08, 0x72, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x73, 0x18, 0x01, 0x20, 0x03, diff --git a/netmap/test/generate.go b/netmap/test/generate.go index 260a024..2b713c5 100644 --- a/netmap/test/generate.go +++ b/netmap/test/generate.go @@ -81,6 +81,17 @@ func GenerateReplica(empty bool) *netmap.Replica { return m } +func GenerateEC(empty bool) *netmap.Replica { + m := new(netmap.Replica) + + if !empty { + m.SetECDataCount(4) + m.SetECParityCount(2) + } + + return m +} + func GenerateReplicas(empty bool) []netmap.Replica { var res []netmap.Replica @@ -88,6 +99,7 @@ func GenerateReplicas(empty bool) []netmap.Replica { res = append(res, *GenerateReplica(false), *GenerateReplica(false), + *GenerateEC(false), ) } From 4a330a5706124b63f4c9a76af49bd0d1b94c608c Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Sat, 20 Apr 2024 13:58:44 +0300 Subject: [PATCH 1117/1196] [#72] session: Unify unmarshaling code gopatch: ``` @@ var err, msg, data, t, protojson identifier var obj expression @@ +import "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message" -import protojson "google.golang.org/protobuf/encoding/protojson" -msg := obj -if err := protojson.Unmarshal(data, msg); err != nil { -return err -} -return t.FromGRPCMessage(msg) +return message.UnmarshalJSON(t, data, obj) @@ var err, msg, data, t, goproto identifier var obj expression @@ +import "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message" -import goproto "google.golang.org/protobuf/proto" -msg := obj -if err := goproto.Unmarshal(data, msg); err != nil { -return err -} -return t.FromGRPCMessage(msg) +return message.Unmarshal(t, data, obj) ``` Signed-off-by: Evgenii Stratonikov --- session/json.go | 57 +++++------------------------------------ session/marshal.go | 64 +++++++--------------------------------------- 2 files changed, 16 insertions(+), 105 deletions(-) diff --git a/session/json.go b/session/json.go index 77cbe10..e157fc3 100644 --- a/session/json.go +++ b/session/json.go @@ -3,7 +3,6 @@ package session import ( "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message" session "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session/grpc" - "google.golang.org/protobuf/encoding/protojson" ) func (c *ObjectSessionContext) MarshalJSON() ([]byte, error) { @@ -27,13 +26,7 @@ func (t *TokenBody) MarshalJSON() ([]byte, error) { } func (t *TokenBody) UnmarshalJSON(data []byte) error { - msg := new(session.SessionToken_Body) - - if err := protojson.Unmarshal(data, msg); err != nil { - return err - } - - return t.FromGRPCMessage(msg) + return message.UnmarshalJSON(t, data, new(session.SessionToken_Body)) } func (t *Token) MarshalJSON() ([]byte, error) { @@ -41,13 +34,7 @@ func (t *Token) MarshalJSON() ([]byte, error) { } func (t *Token) UnmarshalJSON(data []byte) error { - msg := new(session.SessionToken) - - if err := protojson.Unmarshal(data, msg); err != nil { - return err - } - - return t.FromGRPCMessage(msg) + return message.UnmarshalJSON(t, data, new(session.SessionToken)) } func (x *XHeader) MarshalJSON() ([]byte, error) { @@ -55,13 +42,7 @@ func (x *XHeader) MarshalJSON() ([]byte, error) { } func (x *XHeader) UnmarshalJSON(data []byte) error { - msg := new(session.XHeader) - - if err := protojson.Unmarshal(data, msg); err != nil { - return err - } - - return x.FromGRPCMessage(msg) + return message.UnmarshalJSON(x, data, new(session.XHeader)) } func (r *RequestMetaHeader) MarshalJSON() ([]byte, error) { @@ -69,13 +50,7 @@ func (r *RequestMetaHeader) MarshalJSON() ([]byte, error) { } func (r *RequestMetaHeader) UnmarshalJSON(data []byte) error { - msg := new(session.RequestMetaHeader) - - if err := protojson.Unmarshal(data, msg); err != nil { - return err - } - - return r.FromGRPCMessage(msg) + return message.UnmarshalJSON(r, data, new(session.RequestMetaHeader)) } func (r *RequestVerificationHeader) MarshalJSON() ([]byte, error) { @@ -83,13 +58,7 @@ func (r *RequestVerificationHeader) MarshalJSON() ([]byte, error) { } func (r *RequestVerificationHeader) UnmarshalJSON(data []byte) error { - msg := new(session.RequestVerificationHeader) - - if err := protojson.Unmarshal(data, msg); err != nil { - return err - } - - return r.FromGRPCMessage(msg) + return message.UnmarshalJSON(r, data, new(session.RequestVerificationHeader)) } func (r *ResponseMetaHeader) MarshalJSON() ([]byte, error) { @@ -97,13 +66,7 @@ func (r *ResponseMetaHeader) MarshalJSON() ([]byte, error) { } func (r *ResponseMetaHeader) UnmarshalJSON(data []byte) error { - msg := new(session.ResponseMetaHeader) - - if err := protojson.Unmarshal(data, msg); err != nil { - return err - } - - return r.FromGRPCMessage(msg) + return message.UnmarshalJSON(r, data, new(session.ResponseMetaHeader)) } func (r *ResponseVerificationHeader) MarshalJSON() ([]byte, error) { @@ -111,13 +74,7 @@ func (r *ResponseVerificationHeader) MarshalJSON() ([]byte, error) { } func (r *ResponseVerificationHeader) UnmarshalJSON(data []byte) error { - msg := new(session.ResponseVerificationHeader) - - if err := protojson.Unmarshal(data, msg); err != nil { - return err - } - - return r.FromGRPCMessage(msg) + return message.UnmarshalJSON(r, data, new(session.ResponseVerificationHeader)) } func (x *ContainerSessionContext) MarshalJSON() ([]byte, error) { diff --git a/session/marshal.go b/session/marshal.go index 8632398..c9ca34b 100644 --- a/session/marshal.go +++ b/session/marshal.go @@ -4,7 +4,6 @@ import ( "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message" session "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session/grpc" "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/proto" - goproto "google.golang.org/protobuf/proto" ) const ( @@ -154,12 +153,7 @@ func (x *XHeader) StableSize() (size int) { } func (x *XHeader) Unmarshal(data []byte) error { - m := new(session.XHeader) - if err := goproto.Unmarshal(data, m); err != nil { - return err - } - - return x.FromGRPCMessage(m) + return message.Unmarshal(x, data, new(session.XHeader)) } func (l *TokenLifetime) StableMarshal(buf []byte) []byte { @@ -193,12 +187,7 @@ func (l *TokenLifetime) StableSize() (size int) { } func (l *TokenLifetime) Unmarshal(data []byte) error { - m := new(session.SessionToken_Body_TokenLifetime) - if err := goproto.Unmarshal(data, m); err != nil { - return err - } - - return l.FromGRPCMessage(m) + return message.Unmarshal(l, data, new(session.SessionToken_Body_TokenLifetime)) } func (c *ObjectSessionContext) StableMarshal(buf []byte) []byte { @@ -234,12 +223,7 @@ func (c *ObjectSessionContext) StableSize() (size int) { } func (c *ObjectSessionContext) Unmarshal(data []byte) error { - m := new(session.ObjectSessionContext) - if err := goproto.Unmarshal(data, m); err != nil { - return err - } - - return c.FromGRPCMessage(m) + return message.Unmarshal(c, data, new(session.ObjectSessionContext)) } const ( @@ -338,12 +322,7 @@ func (t *TokenBody) StableSize() (size int) { } func (t *TokenBody) Unmarshal(data []byte) error { - m := new(session.SessionToken_Body) - if err := goproto.Unmarshal(data, m); err != nil { - return err - } - - return t.FromGRPCMessage(m) + return message.Unmarshal(t, data, new(session.SessionToken_Body)) } func (t *Token) StableMarshal(buf []byte) []byte { @@ -375,12 +354,7 @@ func (t *Token) StableSize() (size int) { } func (t *Token) Unmarshal(data []byte) error { - m := new(session.SessionToken) - if err := goproto.Unmarshal(data, m); err != nil { - return err - } - - return t.FromGRPCMessage(m) + return message.Unmarshal(t, data, new(session.SessionToken)) } func (r *RequestMetaHeader) StableMarshal(buf []byte) []byte { @@ -435,12 +409,7 @@ func (r *RequestMetaHeader) StableSize() (size int) { } func (r *RequestMetaHeader) Unmarshal(data []byte) error { - m := new(session.RequestMetaHeader) - if err := goproto.Unmarshal(data, m); err != nil { - return err - } - - return r.FromGRPCMessage(m) + return message.Unmarshal(r, data, new(session.RequestMetaHeader)) } func (r *RequestVerificationHeader) StableMarshal(buf []byte) []byte { @@ -476,12 +445,7 @@ func (r *RequestVerificationHeader) StableSize() (size int) { } func (r *RequestVerificationHeader) Unmarshal(data []byte) error { - m := new(session.RequestVerificationHeader) - if err := goproto.Unmarshal(data, m); err != nil { - return err - } - - return r.FromGRPCMessage(m) + return message.Unmarshal(r, data, new(session.RequestVerificationHeader)) } func (r *ResponseMetaHeader) StableMarshal(buf []byte) []byte { @@ -532,12 +496,7 @@ func (r *ResponseMetaHeader) StableSize() (size int) { } func (r *ResponseMetaHeader) Unmarshal(data []byte) error { - m := new(session.ResponseMetaHeader) - if err := goproto.Unmarshal(data, m); err != nil { - return err - } - - return r.FromGRPCMessage(m) + return message.Unmarshal(r, data, new(session.ResponseMetaHeader)) } func (r *ResponseVerificationHeader) StableMarshal(buf []byte) []byte { @@ -573,10 +532,5 @@ func (r *ResponseVerificationHeader) StableSize() (size int) { } func (r *ResponseVerificationHeader) Unmarshal(data []byte) error { - m := new(session.ResponseVerificationHeader) - if err := goproto.Unmarshal(data, m); err != nil { - return err - } - - return r.FromGRPCMessage(m) + return message.Unmarshal(r, data, new(session.ResponseVerificationHeader)) } From df9b65324a4cb49ef14d005942fedf6663999661 Mon Sep 17 00:00:00 2001 From: Anton Nikiforov Date: Mon, 22 Apr 2024 13:25:29 +0300 Subject: [PATCH 1118/1196] [#73] object: Implement `Get\Head` requests for EC object Signed-off-by: Anton Nikiforov --- object/convert.go | 55 ++++++++++++++++++++++---- object/grpc/service.go | 14 +++++++ object/json.go | 16 ++++++++ object/marshal.go | 88 ++++++++++++++++++++++++++++++++++++++++++ object/types.go | 6 +++ 5 files changed, 171 insertions(+), 8 deletions(-) diff --git a/object/convert.go b/object/convert.go index 8d6c73f..3a680ac 100644 --- a/object/convert.go +++ b/object/convert.go @@ -662,11 +662,7 @@ func (s *ECInfo) ToGRPCMessage() grpc.Message { if s.Chunks != nil { chunks := make([]*object.ECInfo_Chunk, len(s.Chunks)) for i := range chunks { - chunks[i] = &object.ECInfo_Chunk{ - Id: s.Chunks[i].ID.ToGRPCMessage().(*refsGRPC.ObjectID), - Index: s.Chunks[i].Index, - Total: s.Chunks[i].Total, - } + chunks[i] = s.Chunks[i].ToGRPCMessage().(*object.ECInfo_Chunk) } m.Chunks = chunks } @@ -687,16 +683,43 @@ func (s *ECInfo) FromGRPCMessage(m grpc.Message) error { } else { s.Chunks = make([]ECChunk, len(chunks)) for i := range chunks { - if err := s.Chunks[i].ID.FromGRPCMessage(chunks[i].Id); err != nil { + if err := s.Chunks[i].FromGRPCMessage(chunks[i]); err != nil { return err } - s.Chunks[i].Index = chunks[i].Index - s.Chunks[i].Total = chunks[i].Total } } return nil } +func (c *ECChunk) ToGRPCMessage() grpc.Message { + var m *object.ECInfo_Chunk + + if c != nil { + m = new(object.ECInfo_Chunk) + + m.Total = c.Total + m.Index = c.Index + m.Id = c.ID.ToGRPCMessage().(*refsGRPC.ObjectID) + } + + return m +} + +func (c *ECChunk) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.ECInfo_Chunk) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + if err := c.ID.FromGRPCMessage(v.GetId()); err != nil { + return err + } + c.Index = v.Index + c.Total = v.Total + + return nil +} + func (r *GetRequestBody) ToGRPCMessage() grpc.Message { var m *object.GetRequest_Body @@ -877,6 +900,8 @@ func (r *GetResponseBody) ToGRPCMessage() grpc.Message { m.SetChunk(t.ToGRPCMessage().(*object.GetResponse_Body_Chunk)) case *SplitInfo: m.SetSplitInfo(t.ToGRPCMessage().(*object.SplitInfo)) + case *ECInfo: + m.SetECInfo(t.ToGRPCMessage().(*object.ECInfo)) default: panic(fmt.Sprintf("unknown get object part %T", t)) } @@ -915,6 +940,12 @@ func (r *GetResponseBody) FromGRPCMessage(m grpc.Message) error { r.objPart = partSplit err = partSplit.FromGRPCMessage(pt.SplitInfo) } + case *object.GetResponse_Body_EcInfo: + if pt != nil { + partEC := new(ECInfo) + r.objPart = partEC + err = partEC.FromGRPCMessage(pt.EcInfo) + } default: err = fmt.Errorf("unknown get object part %T", pt) } @@ -1454,6 +1485,8 @@ func (r *HeadResponseBody) ToGRPCMessage() grpc.Message { m.SetShortHeader(v.ToGRPCMessage().(*object.ShortHeader)) case *SplitInfo: m.SetSplitInfo(v.ToGRPCMessage().(*object.SplitInfo)) + case *ECInfo: + m.SetECInfo(v.ToGRPCMessage().(*object.ECInfo)) default: panic(fmt.Sprintf("unknown head part %T", v)) } @@ -1492,6 +1525,12 @@ func (r *HeadResponseBody) FromGRPCMessage(m grpc.Message) error { r.hdrPart = partSplit err = partSplit.FromGRPCMessage(pt.SplitInfo) } + case *object.HeadResponse_Body_EcInfo: + if pt != nil { + partEC := new(ECInfo) + r.hdrPart = partEC + err = partEC.FromGRPCMessage(pt.EcInfo) + } default: err = fmt.Errorf("unknown head part %T", pt) } diff --git a/object/grpc/service.go b/object/grpc/service.go index 27645dd..fa7cf45 100644 --- a/object/grpc/service.go +++ b/object/grpc/service.go @@ -78,6 +78,13 @@ func (m *GetResponse_Body) SetSplitInfo(v *SplitInfo) { } } +// SetECInfo sets part of the object payload. +func (m *GetResponse_Body) SetECInfo(v *ECInfo) { + m.ObjectPart = &GetResponse_Body_EcInfo{ + EcInfo: v, + } +} + // SetBody sets body of the response. func (m *GetResponse) SetBody(v *GetResponse_Body) { m.Body = v @@ -275,6 +282,13 @@ func (m *HeadResponse_Body) SetSplitInfo(v *SplitInfo) { } } +// SetECInfo sets meta info about the erasure coded object. +func (m *HeadResponse_Body) SetECInfo(v *ECInfo) { + m.Head = &HeadResponse_Body_EcInfo{ + EcInfo: v, + } +} + // SetBody sets body of the response. func (m *HeadResponse) SetBody(v *HeadResponse_Body) { m.Body = v diff --git a/object/json.go b/object/json.go index 1a04031..98030bb 100644 --- a/object/json.go +++ b/object/json.go @@ -61,6 +61,22 @@ func (s *SplitInfo) UnmarshalJSON(data []byte) error { return message.UnmarshalJSON(s, data, new(object.SplitInfo)) } +func (e *ECInfo) MarshalJSON() ([]byte, error) { + return message.MarshalJSON(e) +} + +func (e *ECInfo) UnmarshalJSON(data []byte) error { + return message.UnmarshalJSON(e, data, new(object.ECInfo)) +} + +func (e *ECChunk) MarshalJSON() ([]byte, error) { + return message.MarshalJSON(e) +} + +func (e *ECChunk) UnmarshalJSON(data []byte) error { + return message.UnmarshalJSON(e, data, new(object.ECInfo_Chunk)) +} + func (f *SearchFilter) MarshalJSON() ([]byte, error) { return message.MarshalJSON(f) } diff --git a/object/marshal.go b/object/marshal.go index 989dd43..c02ae83 100644 --- a/object/marshal.go +++ b/object/marshal.go @@ -57,6 +57,12 @@ const ( splitInfoLastPartField = 2 splitInfoLinkField = 3 + ecInfoChunksField = 1 + + ecChunkIDField = 1 + ecChunkIndexField = 2 + ecChunkTotalField = 3 + getReqBodyAddressField = 1 getReqBodyRawFlagField = 2 @@ -67,6 +73,7 @@ const ( getRespBodyInitField = 1 getRespBodyChunkField = 2 getRespBodySplitInfoField = 3 + getRespBodyECInfoField = 4 putReqInitObjectIDField = 1 putReqInitSignatureField = 2 @@ -89,6 +96,7 @@ const ( headRespBodyHeaderField = 1 headRespBodyShortHeaderField = 2 headRespBodySplitInfoField = 3 + headRespBodyECInfoField = 4 searchFilterMatchField = 1 searchFilterNameField = 2 @@ -451,6 +459,74 @@ func (s *SplitInfo) Unmarshal(data []byte) error { return message.Unmarshal(s, data, new(object.SplitInfo)) } +func (e *ECInfo) StableMarshal(buf []byte) []byte { + if e == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, e.StableSize()) + } + + var offset int + + for i := range e.Chunks { + offset += proto.NestedStructureMarshal(ecInfoChunksField, buf[offset:], &e.Chunks[i]) + } + + return buf +} + +func (e *ECInfo) StableSize() (size int) { + if e == nil { + return 0 + } + + for i := range e.Chunks { + size += proto.NestedStructureSize(ecInfoChunksField, &e.Chunks[i]) + } + + return size +} + +func (e *ECInfo) Unmarshal(data []byte) error { + return message.Unmarshal(e, data, new(object.ECInfo)) +} + +func (c *ECChunk) StableMarshal(buf []byte) []byte { + if c == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, c.StableSize()) + } + + var offset int + + offset += proto.NestedStructureMarshal(ecChunkIDField, buf[offset:], &c.ID) + offset += proto.UInt32Marshal(ecChunkIndexField, buf[offset:], c.Index) + proto.UInt32Marshal(ecChunkTotalField, buf[offset:], c.Total) + + return buf +} + +func (c *ECChunk) StableSize() (size int) { + if c == nil { + return 0 + } + + size += proto.NestedStructureSize(ecChunkIDField, &c.ID) + size += proto.UInt32Size(ecChunkIndexField, c.Index) + size += proto.UInt32Size(ecChunkTotalField, c.Total) + + return size +} + +func (c *ECChunk) Unmarshal(data []byte) error { + return message.Unmarshal(c, data, new(object.ECInfo_Chunk)) +} + func (r *GetRequestBody) StableMarshal(buf []byte) []byte { if r == nil { return []byte{} @@ -536,6 +612,8 @@ func (r *GetResponseBody) StableMarshal(buf []byte) []byte { } case *SplitInfo: proto.NestedStructureMarshal(getRespBodySplitInfoField, buf, v) + case *ECInfo: + proto.NestedStructureMarshal(getRespBodyECInfoField, buf, v) default: panic("unknown one of object get response body type") } @@ -558,6 +636,8 @@ func (r *GetResponseBody) StableSize() (size int) { } case *SplitInfo: size += proto.NestedStructureSize(getRespBodySplitInfoField, v) + case *ECInfo: + size += proto.NestedStructureSize(getRespBodyECInfoField, v) default: panic("unknown one of object get response body type") } @@ -796,6 +876,10 @@ func (r *HeadResponseBody) StableMarshal(buf []byte) []byte { if v != nil { proto.NestedStructureMarshal(headRespBodySplitInfoField, buf, v) } + case *ECInfo: + if v != nil { + proto.NestedStructureMarshal(headRespBodyECInfoField, buf, v) + } default: panic("unknown one of object put request body type") } @@ -822,6 +906,10 @@ func (r *HeadResponseBody) StableSize() (size int) { if v != nil { size += proto.NestedStructureSize(headRespBodySplitInfoField, v) } + case *ECInfo: + if v != nil { + size += proto.NestedStructureSize(headRespBodyECInfoField, v) + } default: panic("unknown one of object put request body type") } diff --git a/object/types.go b/object/types.go index 3af08b6..4588f13 100644 --- a/object/types.go +++ b/object/types.go @@ -1508,3 +1508,9 @@ func (r *PutSingleResponse) GetBody() *PutSingleResponseBody { func (r *PutSingleResponse) SetBody(v *PutSingleResponseBody) { r.body = v } + +func (s *ECInfo) getObjectPart() {} + +func (s *ECInfo) getHeaderPart() {} + +func (s *ECInfo) getRangePart() {} From 67c6f305b21fbe68ed0815563514fd597f6d2ae7 Mon Sep 17 00:00:00 2001 From: Anton Nikiforov Date: Sat, 27 Apr 2024 23:03:26 +0300 Subject: [PATCH 1119/1196] [#79] object: Implement `Range\RangeHash` requests for EC object Signed-off-by: Anton Nikiforov --- object/convert.go | 8 ++++++++ object/grpc/service.go | 7 +++++++ object/marshal.go | 9 +++++++++ 3 files changed, 24 insertions(+) diff --git a/object/convert.go b/object/convert.go index 3a680ac..9b266ac 100644 --- a/object/convert.go +++ b/object/convert.go @@ -1962,6 +1962,8 @@ func (r *GetRangeResponseBody) ToGRPCMessage() grpc.Message { m.SetChunk(v.ToGRPCMessage().(*object.GetRangeResponse_Body_Chunk)) case *SplitInfo: m.SetSplitInfo(v.ToGRPCMessage().(*object.SplitInfo)) + case *ECInfo: + m.SetECInfo(v.ToGRPCMessage().(*object.ECInfo)) default: panic(fmt.Sprintf("unknown get range part %T", v)) } @@ -1994,6 +1996,12 @@ func (r *GetRangeResponseBody) FromGRPCMessage(m grpc.Message) error { r.rngPart = partSplit err = partSplit.FromGRPCMessage(pt.SplitInfo) } + case *object.GetRangeResponse_Body_EcInfo: + if pt != nil { + partEC := new(ECInfo) + r.rngPart = partEC + err = partEC.FromGRPCMessage(pt.EcInfo) + } default: err = fmt.Errorf("unknown get range part %T", pt) } diff --git a/object/grpc/service.go b/object/grpc/service.go index fa7cf45..49f160b 100644 --- a/object/grpc/service.go +++ b/object/grpc/service.go @@ -435,6 +435,13 @@ func (m *GetRangeResponse_Body) SetSplitInfo(v *SplitInfo) { } } +// SetECInfo sets meta info about the erasure-coded object. +func (m *GetRangeResponse_Body) SetECInfo(v *ECInfo) { + m.RangePart = &GetRangeResponse_Body_EcInfo{ + EcInfo: v, + } +} + // SetBody sets body of the response. func (m *GetRangeResponse) SetBody(v *GetRangeResponse_Body) { m.Body = v diff --git a/object/marshal.go b/object/marshal.go index c02ae83..a8d399c 100644 --- a/object/marshal.go +++ b/object/marshal.go @@ -117,6 +117,7 @@ const ( getRangeRespChunkField = 1 getRangeRespSplitInfoField = 2 + getRangeRespECInfoField = 3 getRangeHashReqBodyAddressField = 1 getRangeHashReqBodyRangesField = 2 @@ -1110,6 +1111,10 @@ func (r *GetRangeResponseBody) StableMarshal(buf []byte) []byte { if v != nil { proto.NestedStructureMarshal(getRangeRespSplitInfoField, buf, v) } + case *ECInfo: + if v != nil { + proto.NestedStructureMarshal(getRangeRespECInfoField, buf, v) + } default: panic("unknown one of object get range request body type") } @@ -1132,6 +1137,10 @@ func (r *GetRangeResponseBody) StableSize() (size int) { if v != nil { size = proto.NestedStructureSize(getRangeRespSplitInfoField, v) } + case *ECInfo: + if v != nil { + size = proto.NestedStructureSize(getRangeRespECInfoField, v) + } default: panic("unknown one of object get range request body type") } From 387b850e5ef667ca99e5d4f883f52442fc82514b Mon Sep 17 00:00:00 2001 From: Airat Arifullin Date: Wed, 24 Apr 2024 16:00:37 +0300 Subject: [PATCH 1120/1196] [#74] apemanager: Generate protobufs for apemanager service * Generate protobufs. * Make marshallers, unmarshallers, json-encoders etc. * Create message encoding/decoding unit-tests. Signed-off-by: Airat Arifullin --- apemanager/convert.go | 481 ++++++++++++ apemanager/grpc/service.go | 105 +++ apemanager/grpc/service.pb.go | 1131 ++++++++++++++++++++++++++++ apemanager/grpc/service_grpc.pb.go | 245 ++++++ apemanager/grpc/types.go | 21 + apemanager/grpc/types.pb.go | 312 ++++++++ apemanager/json.go | 14 + apemanager/marshal.go | 288 +++++++ apemanager/message_test.go | 27 + apemanager/status.go | 76 ++ apemanager/status_test.go | 30 + apemanager/string.go | 18 + apemanager/test/generate.go | 208 +++++ apemanager/types.go | 244 ++++++ rpc/apemanager.go | 60 ++ signature/body.go | 15 + status/grpc/types.pb.go | 145 ++-- 17 files changed, 3375 insertions(+), 45 deletions(-) create mode 100644 apemanager/convert.go create mode 100644 apemanager/grpc/service.go create mode 100644 apemanager/grpc/service.pb.go create mode 100644 apemanager/grpc/service_grpc.pb.go create mode 100644 apemanager/grpc/types.go create mode 100644 apemanager/grpc/types.pb.go create mode 100644 apemanager/json.go create mode 100644 apemanager/marshal.go create mode 100644 apemanager/message_test.go create mode 100644 apemanager/status.go create mode 100644 apemanager/status_test.go create mode 100644 apemanager/string.go create mode 100644 apemanager/test/generate.go create mode 100644 apemanager/types.go create mode 100644 rpc/apemanager.go diff --git a/apemanager/convert.go b/apemanager/convert.go new file mode 100644 index 0000000..12b087c --- /dev/null +++ b/apemanager/convert.go @@ -0,0 +1,481 @@ +package apemanager + +import ( + "fmt" + + apemanager "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/apemanager/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message" +) + +func TargetTypeToGRPCField(typ TargetType) apemanager.TargetType { + switch typ { + case TargetTypeNamespace: + return apemanager.TargetType_NAMESPACE + case TargetTypeContainer: + return apemanager.TargetType_CONTAINER + case TargetTypeUser: + return apemanager.TargetType_USER + case TargetTypeGroup: + return apemanager.TargetType_GROUP + default: + return apemanager.TargetType_UNDEFINED + } +} + +func TargetTypeFromGRPCField(typ apemanager.TargetType) TargetType { + switch typ { + case apemanager.TargetType_NAMESPACE: + return TargetTypeNamespace + case apemanager.TargetType_CONTAINER: + return TargetTypeContainer + case apemanager.TargetType_USER: + return TargetTypeUser + case apemanager.TargetType_GROUP: + return TargetTypeGroup + default: + return TargetTypeUndefined + } +} + +func TargetTypeToGRPC(typ TargetType) apemanager.TargetType { + return apemanager.TargetType(typ) +} + +func TargetTypeFromGRPC(typ apemanager.TargetType) TargetType { + return TargetType(typ) +} + +func (v2 *ChainTarget) ToGRPCMessage() grpc.Message { + var mgrpc *apemanager.ChainTarget + + if v2 != nil { + mgrpc = new(apemanager.ChainTarget) + + mgrpc.SetType(TargetTypeToGRPC(v2.GetTargetType())) + mgrpc.SetName(v2.GetName()) + } + + return mgrpc +} + +func (v2 *ChainTarget) FromGRPCMessage(m grpc.Message) error { + mgrpc, ok := m.(*apemanager.ChainTarget) + if !ok { + return message.NewUnexpectedMessageType(m, mgrpc) + } + + v2.SetTargetType(TargetTypeFromGRPC(mgrpc.GetType())) + v2.SetName(mgrpc.GetName()) + + return nil +} + +func (v2 *ChainRaw) ToGRPCMessage() grpc.Message { + var mgrpc *apemanager.Chain_Raw + + if v2 != nil { + mgrpc = new(apemanager.Chain_Raw) + + mgrpc.SetRaw(v2.GetRaw()) + } + + return mgrpc +} + +func (v2 *ChainRaw) FromGRPCMessage(m grpc.Message) error { + mgrpc, ok := m.(*apemanager.Chain_Raw) + if !ok { + return message.NewUnexpectedMessageType(m, mgrpc) + } + + v2.SetRaw(mgrpc.GetRaw()) + + return nil +} + +func (v2 *Chain) ToGRPCMessage() grpc.Message { + var mgrpc *apemanager.Chain + + if v2 != nil { + mgrpc = new(apemanager.Chain) + + switch chainKind := v2.GetKind().(type) { + default: + panic(fmt.Sprintf("unsupported chain kind: %T", chainKind)) + case *ChainRaw: + mgrpc.SetKind(chainKind.ToGRPCMessage().(*apemanager.Chain_Raw)) + } + } + + return mgrpc +} + +func (v2 *Chain) FromGRPCMessage(m grpc.Message) error { + mgrpc, ok := m.(*apemanager.Chain) + if !ok { + return message.NewUnexpectedMessageType(m, mgrpc) + } + + switch chainKind := mgrpc.GetKind().(type) { + default: + return fmt.Errorf("unsupported chain kind: %T", chainKind) + case *apemanager.Chain_Raw: + chainRaw := new(ChainRaw) + if err := chainRaw.FromGRPCMessage(chainKind); err != nil { + return err + } + v2.SetKind(chainRaw) + } + + return nil +} + +func (reqBody *AddChainRequestBody) ToGRPCMessage() grpc.Message { + var reqBodygrpc *apemanager.AddChainRequest_Body + + if reqBody != nil { + reqBodygrpc = new(apemanager.AddChainRequest_Body) + + reqBodygrpc.SetTarget(reqBody.GetTarget().ToGRPCMessage().(*apemanager.ChainTarget)) + reqBodygrpc.SetChain(reqBody.GetChain().ToGRPCMessage().(*apemanager.Chain)) + } + + return reqBodygrpc +} + +func (reqBody *AddChainRequestBody) FromGRPCMessage(m grpc.Message) error { + reqBodygrpc, ok := m.(*apemanager.AddChainRequest_Body) + if !ok { + return message.NewUnexpectedMessageType(m, reqBodygrpc) + } + + if targetgrpc := reqBodygrpc.GetTarget(); targetgrpc != nil { + reqBody.target = new(ChainTarget) + if err := reqBody.target.FromGRPCMessage(targetgrpc); err != nil { + return err + } + } + + if chaingrpc := reqBodygrpc.GetChain(); chaingrpc != nil { + reqBody.chain = new(Chain) + if err := reqBody.GetChain().FromGRPCMessage(chaingrpc); err != nil { + return err + } + } + + return nil +} + +func (req *AddChainRequest) ToGRPCMessage() grpc.Message { + var reqgrpc *apemanager.AddChainRequest + + if req != nil { + reqgrpc = new(apemanager.AddChainRequest) + + reqgrpc.SetBody(req.GetBody().ToGRPCMessage().(*apemanager.AddChainRequest_Body)) + req.RequestHeaders.ToMessage(reqgrpc) + } + + return reqgrpc +} + +func (req *AddChainRequest) FromGRPCMessage(m grpc.Message) error { + reqgrpc, ok := m.(*apemanager.AddChainRequest) + if !ok { + return message.NewUnexpectedMessageType(m, reqgrpc) + } + + if reqBodygrpc := reqgrpc.GetBody(); reqBodygrpc != nil { + req.body = new(AddChainRequestBody) + if err := req.body.FromGRPCMessage(reqBodygrpc); err != nil { + return err + } + } + + return req.RequestHeaders.FromMessage(reqgrpc) +} + +func (respBody *AddChainResponseBody) ToGRPCMessage() grpc.Message { + var respBodygrpc *apemanager.AddChainResponse_Body + + if respBody != nil { + respBodygrpc = new(apemanager.AddChainResponse_Body) + + respBodygrpc.SetChainID(respBody.GetChainID()) + } + + return respBodygrpc +} + +func (respBody *AddChainResponseBody) FromGRPCMessage(m grpc.Message) error { + respBodygrpc, ok := m.(*apemanager.AddChainResponse_Body) + if !ok { + return message.NewUnexpectedMessageType(m, respBodygrpc) + } + + respBody.SetChainID(respBodygrpc.GetChainId()) + + return nil +} + +func (resp *AddChainResponse) ToGRPCMessage() grpc.Message { + var respgrpc *apemanager.AddChainResponse + + if resp != nil { + respgrpc = new(apemanager.AddChainResponse) + + respgrpc.SetBody(resp.body.ToGRPCMessage().(*apemanager.AddChainResponse_Body)) + resp.ResponseHeaders.ToMessage(respgrpc) + } + + return respgrpc +} + +func (resp *AddChainResponse) FromGRPCMessage(m grpc.Message) error { + respgrpc, ok := m.(*apemanager.AddChainResponse) + if !ok { + return message.NewUnexpectedMessageType(m, respgrpc) + } + + if respBodygrpc := respgrpc.GetBody(); respBodygrpc != nil { + resp.body = new(AddChainResponseBody) + if err := resp.body.FromGRPCMessage(respBodygrpc); err != nil { + return err + } + } + + return resp.ResponseHeaders.FromMessage(respgrpc) +} + +func (reqBody *RemoveChainRequestBody) ToGRPCMessage() grpc.Message { + var reqBodygrpc *apemanager.RemoveChainRequest_Body + + if reqBody != nil { + reqBodygrpc = new(apemanager.RemoveChainRequest_Body) + + reqBodygrpc.SetTarget(reqBody.target.ToGRPCMessage().(*apemanager.ChainTarget)) + reqBodygrpc.SetChainID(reqBody.GetChainID()) + } + + return reqBodygrpc +} + +func (reqBody *RemoveChainRequestBody) FromGRPCMessage(m grpc.Message) error { + reqBodygrpc, ok := m.(*apemanager.RemoveChainRequest_Body) + if !ok { + return message.NewUnexpectedMessageType(m, reqBodygrpc) + } + + if targetgrpc := reqBodygrpc.GetTarget(); targetgrpc != nil { + reqBody.target = new(ChainTarget) + if err := reqBody.target.FromGRPCMessage(targetgrpc); err != nil { + return err + } + } + + reqBody.SetChainID(reqBodygrpc.GetChainId()) + + return nil +} + +func (req *RemoveChainRequest) ToGRPCMessage() grpc.Message { + var reqgrpc *apemanager.RemoveChainRequest + + if req != nil { + reqgrpc = new(apemanager.RemoveChainRequest) + + reqgrpc.SetBody(req.body.ToGRPCMessage().(*apemanager.RemoveChainRequest_Body)) + req.RequestHeaders.ToMessage(reqgrpc) + } + + return reqgrpc +} + +func (req *RemoveChainRequest) FromGRPCMessage(m grpc.Message) error { + reqgrpc, ok := m.(*apemanager.RemoveChainRequest) + if !ok { + return message.NewUnexpectedMessageType(m, reqgrpc) + } + + if reqBodygrpc := reqgrpc.GetBody(); reqBodygrpc != nil { + req.body = new(RemoveChainRequestBody) + if err := req.body.FromGRPCMessage(reqBodygrpc); err != nil { + return err + } + } + + return req.RequestHeaders.FromMessage(reqgrpc) +} + +func (respBody *RemoveChainResponseBody) ToGRPCMessage() grpc.Message { + var respBodygrpc *apemanager.RemoveChainResponse_Body + + if respBody != nil { + respBodygrpc = new(apemanager.RemoveChainResponse_Body) + } + + return respBodygrpc +} + +func (respBody *RemoveChainResponseBody) FromGRPCMessage(m grpc.Message) error { + respBodygrpc, ok := m.(*apemanager.RemoveChainResponse_Body) + if !ok { + return message.NewUnexpectedMessageType(m, respBodygrpc) + } + + return nil +} + +func (resp *RemoveChainResponse) ToGRPCMessage() grpc.Message { + var respgrpc *apemanager.RemoveChainResponse + + if resp != nil { + respgrpc = new(apemanager.RemoveChainResponse) + + respgrpc.SetBody(resp.body.ToGRPCMessage().(*apemanager.RemoveChainResponse_Body)) + resp.ResponseHeaders.ToMessage(respgrpc) + } + + return respgrpc +} + +func (resp *RemoveChainResponse) FromGRPCMessage(m grpc.Message) error { + respgrpc, ok := m.(*apemanager.RemoveChainResponse) + if !ok { + return message.NewUnexpectedMessageType(m, respgrpc) + } + + if respBodygrpc := respgrpc.GetBody(); respBodygrpc != nil { + resp.body = new(RemoveChainResponseBody) + if err := resp.body.FromGRPCMessage(respBodygrpc); err != nil { + return err + } + } + + return resp.ResponseHeaders.FromMessage(respgrpc) +} + +func (reqBody *ListChainsRequestBody) ToGRPCMessage() grpc.Message { + var reqBodygrpc *apemanager.ListChainsRequest_Body + + if reqBody != nil { + reqBodygrpc = new(apemanager.ListChainsRequest_Body) + + reqBodygrpc.SetTarget(reqBody.target.ToGRPCMessage().(*apemanager.ChainTarget)) + } + + return reqBodygrpc +} + +func (reqBody *ListChainsRequestBody) FromGRPCMessage(m grpc.Message) error { + reqBodygrpc, ok := m.(*apemanager.ListChainsRequest_Body) + if !ok { + return message.NewUnexpectedMessageType(m, reqBodygrpc) + } + + if targetgrpc := reqBodygrpc.GetTarget(); targetgrpc != nil { + reqBody.target = new(ChainTarget) + if err := reqBody.target.FromGRPCMessage(targetgrpc); err != nil { + return err + } + } + + return nil +} + +func (req *ListChainsRequest) ToGRPCMessage() grpc.Message { + var reqgrpc *apemanager.ListChainsRequest + + if req != nil { + reqgrpc = new(apemanager.ListChainsRequest) + + reqgrpc.SetBody(req.body.ToGRPCMessage().(*apemanager.ListChainsRequest_Body)) + req.RequestHeaders.ToMessage(reqgrpc) + } + + return reqgrpc +} + +func (req *ListChainsRequest) FromGRPCMessage(m grpc.Message) error { + reqgrpc, ok := m.(*apemanager.ListChainsRequest) + if !ok { + return message.NewUnexpectedMessageType(m, reqgrpc) + } + + if reqBodygrpc := reqgrpc.GetBody(); reqBodygrpc != nil { + req.body = new(ListChainsRequestBody) + if err := req.body.FromGRPCMessage(reqBodygrpc); err != nil { + return err + } + } + + return req.RequestHeaders.FromMessage(reqgrpc) +} + +func (respBody *ListChainsResponseBody) ToGRPCMessage() grpc.Message { + var respBodygrpc *apemanager.ListChainsResponse_Body + + if respBody != nil { + respBodygrpc = new(apemanager.ListChainsResponse_Body) + + chainsgrpc := make([]*apemanager.Chain, 0, len(respBody.GetChains())) + for _, chain := range respBody.GetChains() { + chainsgrpc = append(chainsgrpc, chain.ToGRPCMessage().(*apemanager.Chain)) + } + + respBodygrpc.SetChains(chainsgrpc) + } + + return respBodygrpc +} + +func (respBody *ListChainsResponseBody) FromGRPCMessage(m grpc.Message) error { + respBodygrpc, ok := m.(*apemanager.ListChainsResponse_Body) + if !ok { + return message.NewUnexpectedMessageType(m, respBodygrpc) + } + + chains := make([]*Chain, 0, len(respBodygrpc.GetChains())) + + for _, chaingrpc := range respBodygrpc.GetChains() { + chain := new(Chain) + if err := chain.FromGRPCMessage(chaingrpc); err != nil { + return err + } + chains = append(chains, chain) + } + + respBody.SetChains(chains) + + return nil +} + +func (resp *ListChainsResponse) ToGRPCMessage() grpc.Message { + var respgrpc *apemanager.ListChainsResponse + + if resp != nil { + respgrpc = new(apemanager.ListChainsResponse) + + respgrpc.SetBody(resp.body.ToGRPCMessage().(*apemanager.ListChainsResponse_Body)) + resp.ResponseHeaders.ToMessage(respgrpc) + } + + return respgrpc +} + +func (resp *ListChainsResponse) FromGRPCMessage(m grpc.Message) error { + respgrpc, ok := m.(*apemanager.ListChainsResponse) + if !ok { + return message.NewUnexpectedMessageType(m, respgrpc) + } + + if respBodygrpc := respgrpc.GetBody(); respBodygrpc != nil { + resp.body = new(ListChainsResponseBody) + if err := resp.body.FromGRPCMessage(respBodygrpc); err != nil { + return err + } + } + + return resp.ResponseHeaders.FromMessage(respgrpc) +} diff --git a/apemanager/grpc/service.go b/apemanager/grpc/service.go new file mode 100644 index 0000000..89ffa71 --- /dev/null +++ b/apemanager/grpc/service.go @@ -0,0 +1,105 @@ +package apemanager + +import ( + session_grpc "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session/grpc" +) + +func (rb *AddChainRequest_Body) SetTarget(t *ChainTarget) { + rb.Target = t +} + +func (rb *AddChainRequest_Body) SetChain(chain *Chain) { + rb.Chain = chain +} + +func (r *AddChainRequest) SetBody(rb *AddChainRequest_Body) { + r.Body = rb +} + +func (r *AddChainRequest) SetMetaHeader(mh *session_grpc.RequestMetaHeader) { + r.MetaHeader = mh +} + +func (r *AddChainRequest) SetVerifyHeader(vh *session_grpc.RequestVerificationHeader) { + r.VerifyHeader = vh +} + +func (rb *AddChainResponse_Body) SetChainID(chainID []byte) { + rb.ChainId = chainID +} + +func (r *AddChainResponse) SetBody(rb *AddChainResponse_Body) { + r.Body = rb +} + +func (r *AddChainResponse) SetMetaHeader(mh *session_grpc.ResponseMetaHeader) { + r.MetaHeader = mh +} + +func (r *AddChainResponse) SetVerifyHeader(vh *session_grpc.ResponseVerificationHeader) { + r.VerifyHeader = vh +} + +func (rb *RemoveChainRequest_Body) SetTarget(t *ChainTarget) { + rb.Target = t +} + +func (rb *RemoveChainRequest_Body) SetChainID(chainID []byte) { + rb.ChainId = chainID +} + +func (r *RemoveChainRequest) SetBody(rb *RemoveChainRequest_Body) { + r.Body = rb +} + +func (r *RemoveChainRequest) SetMetaHeader(mh *session_grpc.RequestMetaHeader) { + r.MetaHeader = mh +} + +func (r *RemoveChainRequest) SetVerifyHeader(vh *session_grpc.RequestVerificationHeader) { + r.VerifyHeader = vh +} + +func (r *RemoveChainResponse) SetBody(rb *RemoveChainResponse_Body) { + r.Body = rb +} + +func (r *RemoveChainResponse) SetMetaHeader(mh *session_grpc.ResponseMetaHeader) { + r.MetaHeader = mh +} + +func (r *RemoveChainResponse) SetVerifyHeader(vh *session_grpc.ResponseVerificationHeader) { + r.VerifyHeader = vh +} + +func (r *ListChainsRequest_Body) SetTarget(t *ChainTarget) { + r.Target = t +} + +func (r *ListChainsRequest) SetBody(rb *ListChainsRequest_Body) { + r.Body = rb +} + +func (r *ListChainsRequest) SetMetaHeader(mh *session_grpc.RequestMetaHeader) { + r.MetaHeader = mh +} + +func (r *ListChainsRequest) SetVerifyHeader(vh *session_grpc.RequestVerificationHeader) { + r.VerifyHeader = vh +} + +func (rb *ListChainsResponse_Body) SetChains(chains []*Chain) { + rb.Chains = chains +} + +func (r *ListChainsResponse) SetBody(rb *ListChainsResponse_Body) { + r.Body = rb +} + +func (r *ListChainsResponse) SetMetaHeader(mh *session_grpc.ResponseMetaHeader) { + r.MetaHeader = mh +} + +func (r *ListChainsResponse) SetVerifyHeader(vh *session_grpc.ResponseVerificationHeader) { + r.VerifyHeader = vh +} diff --git a/apemanager/grpc/service.pb.go b/apemanager/grpc/service.pb.go new file mode 100644 index 0000000..157da44 --- /dev/null +++ b/apemanager/grpc/service.pb.go @@ -0,0 +1,1131 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.33.0 +// protoc v4.25.3 +// source: apemanager/grpc/service.proto + +package apemanager + +import ( + grpc "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session/grpc" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +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) +) + +type AddChainRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The request's body. + Body *AddChainRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" 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,proto3" json:"verify_header,omitempty"` +} + +func (x *AddChainRequest) Reset() { + *x = AddChainRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_apemanager_grpc_service_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AddChainRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AddChainRequest) ProtoMessage() {} + +func (x *AddChainRequest) ProtoReflect() protoreflect.Message { + mi := &file_apemanager_grpc_service_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AddChainRequest.ProtoReflect.Descriptor instead. +func (*AddChainRequest) Descriptor() ([]byte, []int) { + return file_apemanager_grpc_service_proto_rawDescGZIP(), []int{0} +} + +func (x *AddChainRequest) GetBody() *AddChainRequest_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *AddChainRequest) GetMetaHeader() *grpc.RequestMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} + +func (x *AddChainRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} + +type AddChainResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The response's body. + Body *AddChainResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" 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,proto3" json:"verify_header,omitempty"` +} + +func (x *AddChainResponse) Reset() { + *x = AddChainResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_apemanager_grpc_service_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AddChainResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AddChainResponse) ProtoMessage() {} + +func (x *AddChainResponse) ProtoReflect() protoreflect.Message { + mi := &file_apemanager_grpc_service_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AddChainResponse.ProtoReflect.Descriptor instead. +func (*AddChainResponse) Descriptor() ([]byte, []int) { + return file_apemanager_grpc_service_proto_rawDescGZIP(), []int{1} +} + +func (x *AddChainResponse) GetBody() *AddChainResponse_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *AddChainResponse) GetMetaHeader() *grpc.ResponseMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} + +func (x *AddChainResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} + +type RemoveChainRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The request's body. + Body *RemoveChainRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" 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,proto3" json:"verify_header,omitempty"` +} + +func (x *RemoveChainRequest) Reset() { + *x = RemoveChainRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_apemanager_grpc_service_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RemoveChainRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RemoveChainRequest) ProtoMessage() {} + +func (x *RemoveChainRequest) ProtoReflect() protoreflect.Message { + mi := &file_apemanager_grpc_service_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RemoveChainRequest.ProtoReflect.Descriptor instead. +func (*RemoveChainRequest) Descriptor() ([]byte, []int) { + return file_apemanager_grpc_service_proto_rawDescGZIP(), []int{2} +} + +func (x *RemoveChainRequest) GetBody() *RemoveChainRequest_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *RemoveChainRequest) GetMetaHeader() *grpc.RequestMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} + +func (x *RemoveChainRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} + +type RemoveChainResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The response's body. + Body *RemoveChainResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" 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,proto3" json:"verify_header,omitempty"` +} + +func (x *RemoveChainResponse) Reset() { + *x = RemoveChainResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_apemanager_grpc_service_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RemoveChainResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RemoveChainResponse) ProtoMessage() {} + +func (x *RemoveChainResponse) ProtoReflect() protoreflect.Message { + mi := &file_apemanager_grpc_service_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RemoveChainResponse.ProtoReflect.Descriptor instead. +func (*RemoveChainResponse) Descriptor() ([]byte, []int) { + return file_apemanager_grpc_service_proto_rawDescGZIP(), []int{3} +} + +func (x *RemoveChainResponse) GetBody() *RemoveChainResponse_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *RemoveChainResponse) GetMetaHeader() *grpc.ResponseMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} + +func (x *RemoveChainResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} + +type ListChainsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The request's body. + Body *ListChainsRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" 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,proto3" json:"verify_header,omitempty"` +} + +func (x *ListChainsRequest) Reset() { + *x = ListChainsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_apemanager_grpc_service_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListChainsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListChainsRequest) ProtoMessage() {} + +func (x *ListChainsRequest) ProtoReflect() protoreflect.Message { + mi := &file_apemanager_grpc_service_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListChainsRequest.ProtoReflect.Descriptor instead. +func (*ListChainsRequest) Descriptor() ([]byte, []int) { + return file_apemanager_grpc_service_proto_rawDescGZIP(), []int{4} +} + +func (x *ListChainsRequest) GetBody() *ListChainsRequest_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *ListChainsRequest) GetMetaHeader() *grpc.RequestMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} + +func (x *ListChainsRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} + +type ListChainsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The response's body. + Body *ListChainsResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" 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,proto3" json:"verify_header,omitempty"` +} + +func (x *ListChainsResponse) Reset() { + *x = ListChainsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_apemanager_grpc_service_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListChainsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListChainsResponse) ProtoMessage() {} + +func (x *ListChainsResponse) ProtoReflect() protoreflect.Message { + mi := &file_apemanager_grpc_service_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListChainsResponse.ProtoReflect.Descriptor instead. +func (*ListChainsResponse) Descriptor() ([]byte, []int) { + return file_apemanager_grpc_service_proto_rawDescGZIP(), []int{5} +} + +func (x *ListChainsResponse) GetBody() *ListChainsResponse_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *ListChainsResponse) GetMetaHeader() *grpc.ResponseMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} + +func (x *ListChainsResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} + +type AddChainRequest_Body struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // A target for which a rule chain is added. + Target *ChainTarget `protobuf:"bytes,1,opt,name=target,proto3" json:"target,omitempty"` + // The chain to set for the target. + Chain *Chain `protobuf:"bytes,2,opt,name=chain,proto3" json:"chain,omitempty"` +} + +func (x *AddChainRequest_Body) Reset() { + *x = AddChainRequest_Body{} + if protoimpl.UnsafeEnabled { + mi := &file_apemanager_grpc_service_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AddChainRequest_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AddChainRequest_Body) ProtoMessage() {} + +func (x *AddChainRequest_Body) ProtoReflect() protoreflect.Message { + mi := &file_apemanager_grpc_service_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AddChainRequest_Body.ProtoReflect.Descriptor instead. +func (*AddChainRequest_Body) Descriptor() ([]byte, []int) { + return file_apemanager_grpc_service_proto_rawDescGZIP(), []int{0, 0} +} + +func (x *AddChainRequest_Body) GetTarget() *ChainTarget { + if x != nil { + return x.Target + } + return nil +} + +func (x *AddChainRequest_Body) GetChain() *Chain { + if x != nil { + return x.Chain + } + return nil +} + +type AddChainResponse_Body struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Chain ID assigned for the added rule chain. + // If chain ID is left empty in the request, then + // it will be generated. + ChainId []byte `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` +} + +func (x *AddChainResponse_Body) Reset() { + *x = AddChainResponse_Body{} + if protoimpl.UnsafeEnabled { + mi := &file_apemanager_grpc_service_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AddChainResponse_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AddChainResponse_Body) ProtoMessage() {} + +func (x *AddChainResponse_Body) ProtoReflect() protoreflect.Message { + mi := &file_apemanager_grpc_service_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AddChainResponse_Body.ProtoReflect.Descriptor instead. +func (*AddChainResponse_Body) Descriptor() ([]byte, []int) { + return file_apemanager_grpc_service_proto_rawDescGZIP(), []int{1, 0} +} + +func (x *AddChainResponse_Body) GetChainId() []byte { + if x != nil { + return x.ChainId + } + return nil +} + +type RemoveChainRequest_Body struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Target for which a rule chain is removed. + Target *ChainTarget `protobuf:"bytes,1,opt,name=target,proto3" json:"target,omitempty"` + // Chain ID assigned for the rule chain. + ChainId []byte `protobuf:"bytes,2,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` +} + +func (x *RemoveChainRequest_Body) Reset() { + *x = RemoveChainRequest_Body{} + if protoimpl.UnsafeEnabled { + mi := &file_apemanager_grpc_service_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RemoveChainRequest_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RemoveChainRequest_Body) ProtoMessage() {} + +func (x *RemoveChainRequest_Body) ProtoReflect() protoreflect.Message { + mi := &file_apemanager_grpc_service_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RemoveChainRequest_Body.ProtoReflect.Descriptor instead. +func (*RemoveChainRequest_Body) Descriptor() ([]byte, []int) { + return file_apemanager_grpc_service_proto_rawDescGZIP(), []int{2, 0} +} + +func (x *RemoveChainRequest_Body) GetTarget() *ChainTarget { + if x != nil { + return x.Target + } + return nil +} + +func (x *RemoveChainRequest_Body) GetChainId() []byte { + if x != nil { + return x.ChainId + } + return nil +} + +// Since RemoveChain is an idempotent operation, then the only indicator that +// operation could not be performed is an error returning to a client. +type RemoveChainResponse_Body struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *RemoveChainResponse_Body) Reset() { + *x = RemoveChainResponse_Body{} + if protoimpl.UnsafeEnabled { + mi := &file_apemanager_grpc_service_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RemoveChainResponse_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RemoveChainResponse_Body) ProtoMessage() {} + +func (x *RemoveChainResponse_Body) ProtoReflect() protoreflect.Message { + mi := &file_apemanager_grpc_service_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RemoveChainResponse_Body.ProtoReflect.Descriptor instead. +func (*RemoveChainResponse_Body) Descriptor() ([]byte, []int) { + return file_apemanager_grpc_service_proto_rawDescGZIP(), []int{3, 0} +} + +type ListChainsRequest_Body struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Target for which rule chains are listed. + Target *ChainTarget `protobuf:"bytes,1,opt,name=target,proto3" json:"target,omitempty"` +} + +func (x *ListChainsRequest_Body) Reset() { + *x = ListChainsRequest_Body{} + if protoimpl.UnsafeEnabled { + mi := &file_apemanager_grpc_service_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListChainsRequest_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListChainsRequest_Body) ProtoMessage() {} + +func (x *ListChainsRequest_Body) ProtoReflect() protoreflect.Message { + mi := &file_apemanager_grpc_service_proto_msgTypes[10] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListChainsRequest_Body.ProtoReflect.Descriptor instead. +func (*ListChainsRequest_Body) Descriptor() ([]byte, []int) { + return file_apemanager_grpc_service_proto_rawDescGZIP(), []int{4, 0} +} + +func (x *ListChainsRequest_Body) GetTarget() *ChainTarget { + if x != nil { + return x.Target + } + return nil +} + +type ListChainsResponse_Body struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The list of chains defined for the reqeusted target. + Chains []*Chain `protobuf:"bytes,1,rep,name=chains,proto3" json:"chains,omitempty"` +} + +func (x *ListChainsResponse_Body) Reset() { + *x = ListChainsResponse_Body{} + if protoimpl.UnsafeEnabled { + mi := &file_apemanager_grpc_service_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListChainsResponse_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListChainsResponse_Body) ProtoMessage() {} + +func (x *ListChainsResponse_Body) ProtoReflect() protoreflect.Message { + mi := &file_apemanager_grpc_service_proto_msgTypes[11] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListChainsResponse_Body.ProtoReflect.Descriptor instead. +func (*ListChainsResponse_Body) Descriptor() ([]byte, []int) { + return file_apemanager_grpc_service_proto_rawDescGZIP(), []int{5, 0} +} + +func (x *ListChainsResponse_Body) GetChains() []*Chain { + if x != nil { + return x.Chains + } + return nil +} + +var File_apemanager_grpc_service_proto protoreflect.FileDescriptor + +var file_apemanager_grpc_service_proto_rawDesc = []byte{ + 0x0a, 0x1d, 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2f, 0x67, 0x72, 0x70, + 0x63, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, + 0x15, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, 0x6d, + 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x1a, 0x1b, 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, + 0x65, 0x72, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x1a, 0x18, 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, 0xe4, 0x02, + 0x0a, 0x0f, 0x41, 0x64, 0x64, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x3f, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x2b, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, + 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x41, 0x64, 0x64, 0x43, 0x68, 0x61, 0x69, 0x6e, + 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, 0x76, 0x0a, 0x04, + 0x42, 0x6f, 0x64, 0x79, 0x12, 0x3a, 0x0a, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x43, 0x68, 0x61, + 0x69, 0x6e, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x52, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, + 0x12, 0x32, 0x0a, 0x05, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x1c, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, + 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x52, 0x05, 0x63, + 0x68, 0x61, 0x69, 0x6e, 0x22, 0x93, 0x02, 0x0a, 0x10, 0x41, 0x64, 0x64, 0x43, 0x68, 0x61, 0x69, + 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x40, 0x0a, 0x04, 0x62, 0x6f, 0x64, + 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, + 0x41, 0x64, 0x64, 0x43, 0x68, 0x61, 0x69, 0x6e, 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, 0x21, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, + 0x19, 0x0a, 0x08, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0c, 0x52, 0x07, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x49, 0x64, 0x22, 0xd1, 0x02, 0x0a, 0x12, 0x52, + 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x42, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x2e, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, + 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x43, 0x68, + 0x61, 0x69, 0x6e, 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, + 0x5d, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x3a, 0x0a, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, + 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, + 0x43, 0x68, 0x61, 0x69, 0x6e, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x52, 0x06, 0x74, 0x61, 0x72, + 0x67, 0x65, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x5f, 0x69, 0x64, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x49, 0x64, 0x22, 0xfe, + 0x01, 0x0a, 0x13, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x43, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x6d, + 0x6f, 0x76, 0x65, 0x43, 0x68, 0x61, 0x69, 0x6e, 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, 0x06, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x22, + 0xb4, 0x02, 0x0a, 0x11, 0x4c, 0x69, 0x73, 0x74, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x73, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x41, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x4c, 0x69, 0x73, 0x74, + 0x43, 0x68, 0x61, 0x69, 0x6e, 0x73, 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, 0x42, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x3a, 0x0a, 0x06, 0x74, 0x61, + 0x72, 0x67, 0x65, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x66, 0x72, 0x6f, + 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, + 0x65, 0x72, 0x2e, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x52, 0x06, + 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x22, 0xb2, 0x02, 0x0a, 0x12, 0x4c, 0x69, 0x73, 0x74, 0x43, + 0x68, 0x61, 0x69, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x42, 0x0a, + 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2e, 0x2e, 0x66, 0x72, + 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61, + 0x67, 0x65, 0x72, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x73, 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, 0x3c, 0x0a, + 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x34, 0x0a, 0x06, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x73, 0x18, + 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, + 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x43, 0x68, + 0x61, 0x69, 0x6e, 0x52, 0x06, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x73, 0x32, 0xb9, 0x02, 0x0a, 0x11, + 0x41, 0x50, 0x45, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x12, 0x5b, 0x0a, 0x08, 0x41, 0x64, 0x64, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x12, 0x26, 0x2e, + 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, 0x6d, 0x61, + 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x41, 0x64, 0x64, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x27, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, + 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x41, 0x64, + 0x64, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x64, + 0x0a, 0x0b, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x12, 0x29, 0x2e, + 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, 0x6d, 0x61, + 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x43, 0x68, 0x61, 0x69, + 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2a, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, + 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, + 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x61, 0x0a, 0x0a, 0x4c, 0x69, 0x73, 0x74, 0x43, 0x68, 0x61, 0x69, + 0x6e, 0x73, 0x12, 0x28, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, + 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x43, + 0x68, 0x61, 0x69, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x29, 0x2e, 0x66, + 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, + 0x61, 0x67, 0x65, 0x72, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x73, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x4c, 0x5a, 0x4a, 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, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x61, 0x70, 0x65, 0x6d, 0x61, + 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x61, 0x70, 0x65, 0x6d, 0x61, + 0x6e, 0x61, 0x67, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_apemanager_grpc_service_proto_rawDescOnce sync.Once + file_apemanager_grpc_service_proto_rawDescData = file_apemanager_grpc_service_proto_rawDesc +) + +func file_apemanager_grpc_service_proto_rawDescGZIP() []byte { + file_apemanager_grpc_service_proto_rawDescOnce.Do(func() { + file_apemanager_grpc_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_apemanager_grpc_service_proto_rawDescData) + }) + return file_apemanager_grpc_service_proto_rawDescData +} + +var file_apemanager_grpc_service_proto_msgTypes = make([]protoimpl.MessageInfo, 12) +var file_apemanager_grpc_service_proto_goTypes = []interface{}{ + (*AddChainRequest)(nil), // 0: frostfs.v2.apemanager.AddChainRequest + (*AddChainResponse)(nil), // 1: frostfs.v2.apemanager.AddChainResponse + (*RemoveChainRequest)(nil), // 2: frostfs.v2.apemanager.RemoveChainRequest + (*RemoveChainResponse)(nil), // 3: frostfs.v2.apemanager.RemoveChainResponse + (*ListChainsRequest)(nil), // 4: frostfs.v2.apemanager.ListChainsRequest + (*ListChainsResponse)(nil), // 5: frostfs.v2.apemanager.ListChainsResponse + (*AddChainRequest_Body)(nil), // 6: frostfs.v2.apemanager.AddChainRequest.Body + (*AddChainResponse_Body)(nil), // 7: frostfs.v2.apemanager.AddChainResponse.Body + (*RemoveChainRequest_Body)(nil), // 8: frostfs.v2.apemanager.RemoveChainRequest.Body + (*RemoveChainResponse_Body)(nil), // 9: frostfs.v2.apemanager.RemoveChainResponse.Body + (*ListChainsRequest_Body)(nil), // 10: frostfs.v2.apemanager.ListChainsRequest.Body + (*ListChainsResponse_Body)(nil), // 11: frostfs.v2.apemanager.ListChainsResponse.Body + (*grpc.RequestMetaHeader)(nil), // 12: neo.fs.v2.session.RequestMetaHeader + (*grpc.RequestVerificationHeader)(nil), // 13: neo.fs.v2.session.RequestVerificationHeader + (*grpc.ResponseMetaHeader)(nil), // 14: neo.fs.v2.session.ResponseMetaHeader + (*grpc.ResponseVerificationHeader)(nil), // 15: neo.fs.v2.session.ResponseVerificationHeader + (*ChainTarget)(nil), // 16: frostfs.v2.apemanager.ChainTarget + (*Chain)(nil), // 17: frostfs.v2.apemanager.Chain +} +var file_apemanager_grpc_service_proto_depIdxs = []int32{ + 6, // 0: frostfs.v2.apemanager.AddChainRequest.body:type_name -> frostfs.v2.apemanager.AddChainRequest.Body + 12, // 1: frostfs.v2.apemanager.AddChainRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader + 13, // 2: frostfs.v2.apemanager.AddChainRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader + 7, // 3: frostfs.v2.apemanager.AddChainResponse.body:type_name -> frostfs.v2.apemanager.AddChainResponse.Body + 14, // 4: frostfs.v2.apemanager.AddChainResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader + 15, // 5: frostfs.v2.apemanager.AddChainResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 8, // 6: frostfs.v2.apemanager.RemoveChainRequest.body:type_name -> frostfs.v2.apemanager.RemoveChainRequest.Body + 12, // 7: frostfs.v2.apemanager.RemoveChainRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader + 13, // 8: frostfs.v2.apemanager.RemoveChainRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader + 9, // 9: frostfs.v2.apemanager.RemoveChainResponse.body:type_name -> frostfs.v2.apemanager.RemoveChainResponse.Body + 14, // 10: frostfs.v2.apemanager.RemoveChainResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader + 15, // 11: frostfs.v2.apemanager.RemoveChainResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 10, // 12: frostfs.v2.apemanager.ListChainsRequest.body:type_name -> frostfs.v2.apemanager.ListChainsRequest.Body + 12, // 13: frostfs.v2.apemanager.ListChainsRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader + 13, // 14: frostfs.v2.apemanager.ListChainsRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader + 11, // 15: frostfs.v2.apemanager.ListChainsResponse.body:type_name -> frostfs.v2.apemanager.ListChainsResponse.Body + 14, // 16: frostfs.v2.apemanager.ListChainsResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader + 15, // 17: frostfs.v2.apemanager.ListChainsResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 16, // 18: frostfs.v2.apemanager.AddChainRequest.Body.target:type_name -> frostfs.v2.apemanager.ChainTarget + 17, // 19: frostfs.v2.apemanager.AddChainRequest.Body.chain:type_name -> frostfs.v2.apemanager.Chain + 16, // 20: frostfs.v2.apemanager.RemoveChainRequest.Body.target:type_name -> frostfs.v2.apemanager.ChainTarget + 16, // 21: frostfs.v2.apemanager.ListChainsRequest.Body.target:type_name -> frostfs.v2.apemanager.ChainTarget + 17, // 22: frostfs.v2.apemanager.ListChainsResponse.Body.chains:type_name -> frostfs.v2.apemanager.Chain + 0, // 23: frostfs.v2.apemanager.APEManagerService.AddChain:input_type -> frostfs.v2.apemanager.AddChainRequest + 2, // 24: frostfs.v2.apemanager.APEManagerService.RemoveChain:input_type -> frostfs.v2.apemanager.RemoveChainRequest + 4, // 25: frostfs.v2.apemanager.APEManagerService.ListChains:input_type -> frostfs.v2.apemanager.ListChainsRequest + 1, // 26: frostfs.v2.apemanager.APEManagerService.AddChain:output_type -> frostfs.v2.apemanager.AddChainResponse + 3, // 27: frostfs.v2.apemanager.APEManagerService.RemoveChain:output_type -> frostfs.v2.apemanager.RemoveChainResponse + 5, // 28: frostfs.v2.apemanager.APEManagerService.ListChains:output_type -> frostfs.v2.apemanager.ListChainsResponse + 26, // [26:29] is the sub-list for method output_type + 23, // [23:26] is the sub-list for method input_type + 23, // [23:23] is the sub-list for extension type_name + 23, // [23:23] is the sub-list for extension extendee + 0, // [0:23] is the sub-list for field type_name +} + +func init() { file_apemanager_grpc_service_proto_init() } +func file_apemanager_grpc_service_proto_init() { + if File_apemanager_grpc_service_proto != nil { + return + } + file_apemanager_grpc_types_proto_init() + if !protoimpl.UnsafeEnabled { + file_apemanager_grpc_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AddChainRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_apemanager_grpc_service_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AddChainResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_apemanager_grpc_service_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RemoveChainRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_apemanager_grpc_service_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RemoveChainResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_apemanager_grpc_service_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListChainsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_apemanager_grpc_service_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListChainsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_apemanager_grpc_service_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AddChainRequest_Body); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_apemanager_grpc_service_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AddChainResponse_Body); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_apemanager_grpc_service_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RemoveChainRequest_Body); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_apemanager_grpc_service_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RemoveChainResponse_Body); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_apemanager_grpc_service_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListChainsRequest_Body); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_apemanager_grpc_service_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListChainsResponse_Body); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_apemanager_grpc_service_proto_rawDesc, + NumEnums: 0, + NumMessages: 12, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_apemanager_grpc_service_proto_goTypes, + DependencyIndexes: file_apemanager_grpc_service_proto_depIdxs, + MessageInfos: file_apemanager_grpc_service_proto_msgTypes, + }.Build() + File_apemanager_grpc_service_proto = out.File + file_apemanager_grpc_service_proto_rawDesc = nil + file_apemanager_grpc_service_proto_goTypes = nil + file_apemanager_grpc_service_proto_depIdxs = nil +} diff --git a/apemanager/grpc/service_grpc.pb.go b/apemanager/grpc/service_grpc.pb.go new file mode 100644 index 0000000..484fec5 --- /dev/null +++ b/apemanager/grpc/service_grpc.pb.go @@ -0,0 +1,245 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc v4.25.3 +// source: apemanager/grpc/service.proto + +package apemanager + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +const ( + APEManagerService_AddChain_FullMethodName = "/frostfs.v2.apemanager.APEManagerService/AddChain" + APEManagerService_RemoveChain_FullMethodName = "/frostfs.v2.apemanager.APEManagerService/RemoveChain" + APEManagerService_ListChains_FullMethodName = "/frostfs.v2.apemanager.APEManagerService/ListChains" +) + +// 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. +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. + 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. + 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. + ListChains(ctx context.Context, in *ListChainsRequest, opts ...grpc.CallOption) (*ListChainsResponse, error) +} + +type aPEManagerServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewAPEManagerServiceClient(cc grpc.ClientConnInterface) APEManagerServiceClient { + return &aPEManagerServiceClient{cc} +} + +func (c *aPEManagerServiceClient) AddChain(ctx context.Context, in *AddChainRequest, opts ...grpc.CallOption) (*AddChainResponse, error) { + out := new(AddChainResponse) + err := c.cc.Invoke(ctx, APEManagerService_AddChain_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *aPEManagerServiceClient) RemoveChain(ctx context.Context, in *RemoveChainRequest, opts ...grpc.CallOption) (*RemoveChainResponse, error) { + out := new(RemoveChainResponse) + err := c.cc.Invoke(ctx, APEManagerService_RemoveChain_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *aPEManagerServiceClient) ListChains(ctx context.Context, in *ListChainsRequest, opts ...grpc.CallOption) (*ListChainsResponse, error) { + out := new(ListChainsResponse) + err := c.cc.Invoke(ctx, APEManagerService_ListChains_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// APEManagerServiceServer is the server API for APEManagerService service. +// All implementations should embed UnimplementedAPEManagerServiceServer +// 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. + 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. + 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. + ListChains(context.Context, *ListChainsRequest) (*ListChainsResponse, error) +} + +// 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") +} +func (UnimplementedAPEManagerServiceServer) RemoveChain(context.Context, *RemoveChainRequest) (*RemoveChainResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RemoveChain not implemented") +} +func (UnimplementedAPEManagerServiceServer) ListChains(context.Context, *ListChainsRequest) (*ListChainsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListChains not implemented") +} + +// 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 +// result in compilation errors. +type UnsafeAPEManagerServiceServer interface { + mustEmbedUnimplementedAPEManagerServiceServer() +} + +func RegisterAPEManagerServiceServer(s grpc.ServiceRegistrar, srv APEManagerServiceServer) { + s.RegisterService(&APEManagerService_ServiceDesc, srv) +} + +func _APEManagerService_AddChain_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AddChainRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(APEManagerServiceServer).AddChain(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: APEManagerService_AddChain_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(APEManagerServiceServer).AddChain(ctx, req.(*AddChainRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _APEManagerService_RemoveChain_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(RemoveChainRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(APEManagerServiceServer).RemoveChain(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: APEManagerService_RemoveChain_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(APEManagerServiceServer).RemoveChain(ctx, req.(*RemoveChainRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _APEManagerService_ListChains_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListChainsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(APEManagerServiceServer).ListChains(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: APEManagerService_ListChains_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(APEManagerServiceServer).ListChains(ctx, req.(*ListChainsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// APEManagerService_ServiceDesc is the grpc.ServiceDesc for APEManagerService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var APEManagerService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "frostfs.v2.apemanager.APEManagerService", + HandlerType: (*APEManagerServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "AddChain", + Handler: _APEManagerService_AddChain_Handler, + }, + { + MethodName: "RemoveChain", + Handler: _APEManagerService_RemoveChain_Handler, + }, + { + MethodName: "ListChains", + Handler: _APEManagerService_ListChains_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "apemanager/grpc/service.proto", +} diff --git a/apemanager/grpc/types.go b/apemanager/grpc/types.go new file mode 100644 index 0000000..0f2ebb2 --- /dev/null +++ b/apemanager/grpc/types.go @@ -0,0 +1,21 @@ +package apemanager + +func (t *ChainTarget) SetType(typ TargetType) { + t.Type = typ +} + +func (t *ChainTarget) SetName(name string) { + t.Name = name +} + +func (c *Chain) SetKind(kind isChain_Kind) { + c.Kind = kind +} + +func (cr *Chain_Raw) SetRaw(raw []byte) { + cr.Raw = raw +} + +func (cr *Chain_Raw) GetRaw() []byte { + return cr.Raw +} diff --git a/apemanager/grpc/types.pb.go b/apemanager/grpc/types.pb.go new file mode 100644 index 0000000..395857a --- /dev/null +++ b/apemanager/grpc/types.pb.go @@ -0,0 +1,312 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.33.0 +// protoc v4.25.3 +// source: apemanager/grpc/types.proto + +package apemanager + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +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_apemanager_grpc_types_proto_enumTypes[0].Descriptor() +} + +func (TargetType) Type() protoreflect.EnumType { + return &file_apemanager_grpc_types_proto_enumTypes[0] +} + +func (x TargetType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use TargetType.Descriptor instead. +func (TargetType) EnumDescriptor() ([]byte, []int) { + return file_apemanager_grpc_types_proto_rawDescGZIP(), []int{0} +} + +// ChainTarget is an object to which a rule chain is defined. +type ChainTarget struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Type TargetType `protobuf:"varint,1,opt,name=type,proto3,enum=frostfs.v2.apemanager.TargetType" json:"type,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` +} + +func (x *ChainTarget) Reset() { + *x = ChainTarget{} + if protoimpl.UnsafeEnabled { + mi := &file_apemanager_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_apemanager_grpc_types_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ChainTarget.ProtoReflect.Descriptor instead. +func (*ChainTarget) Descriptor() ([]byte, []int) { + return file_apemanager_grpc_types_proto_rawDescGZIP(), []int{0} +} + +func (x *ChainTarget) GetType() TargetType { + if x != nil { + return x.Type + } + return TargetType_UNDEFINED +} + +func (x *ChainTarget) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +// Chain is a chain of rules defined for a specific target. +type Chain struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Types that are assignable to Kind: + // + // *Chain_Raw + Kind isChain_Kind `protobuf_oneof:"kind"` +} + +func (x *Chain) Reset() { + *x = Chain{} + if protoimpl.UnsafeEnabled { + mi := &file_apemanager_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_apemanager_grpc_types_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Chain.ProtoReflect.Descriptor instead. +func (*Chain) Descriptor() ([]byte, []int) { + return file_apemanager_grpc_types_proto_rawDescGZIP(), []int{1} +} + +func (m *Chain) GetKind() isChain_Kind { + if m != nil { + return m.Kind + } + return nil +} + +func (x *Chain) GetRaw() []byte { + if x, ok := x.GetKind().(*Chain_Raw); ok { + return x.Raw + } + return nil +} + +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,proto3,oneof"` +} + +func (*Chain_Raw) isChain_Kind() {} + +var File_apemanager_grpc_types_proto protoreflect.FileDescriptor + +var file_apemanager_grpc_types_proto_rawDesc = []byte{ + 0x0a, 0x1b, 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2f, 0x67, 0x72, 0x70, + 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x15, 0x66, + 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, + 0x61, 0x67, 0x65, 0x72, 0x22, 0x58, 0x0a, 0x0b, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x54, 0x61, 0x72, + 0x67, 0x65, 0x74, 0x12, 0x35, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0e, 0x32, 0x21, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, + 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 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, 0x4c, 0x5a, 0x4a, 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, 0x61, 0x70, 0x69, + 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, + 0x72, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, + 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_apemanager_grpc_types_proto_rawDescOnce sync.Once + file_apemanager_grpc_types_proto_rawDescData = file_apemanager_grpc_types_proto_rawDesc +) + +func file_apemanager_grpc_types_proto_rawDescGZIP() []byte { + file_apemanager_grpc_types_proto_rawDescOnce.Do(func() { + file_apemanager_grpc_types_proto_rawDescData = protoimpl.X.CompressGZIP(file_apemanager_grpc_types_proto_rawDescData) + }) + return file_apemanager_grpc_types_proto_rawDescData +} + +var file_apemanager_grpc_types_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_apemanager_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_apemanager_grpc_types_proto_goTypes = []interface{}{ + (TargetType)(0), // 0: frostfs.v2.apemanager.TargetType + (*ChainTarget)(nil), // 1: frostfs.v2.apemanager.ChainTarget + (*Chain)(nil), // 2: frostfs.v2.apemanager.Chain +} +var file_apemanager_grpc_types_proto_depIdxs = []int32{ + 0, // 0: frostfs.v2.apemanager.ChainTarget.type:type_name -> frostfs.v2.apemanager.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_apemanager_grpc_types_proto_init() } +func file_apemanager_grpc_types_proto_init() { + if File_apemanager_grpc_types_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_apemanager_grpc_types_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ChainTarget); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_apemanager_grpc_types_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Chain); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_apemanager_grpc_types_proto_msgTypes[1].OneofWrappers = []interface{}{ + (*Chain_Raw)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_apemanager_grpc_types_proto_rawDesc, + NumEnums: 1, + NumMessages: 2, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_apemanager_grpc_types_proto_goTypes, + DependencyIndexes: file_apemanager_grpc_types_proto_depIdxs, + EnumInfos: file_apemanager_grpc_types_proto_enumTypes, + MessageInfos: file_apemanager_grpc_types_proto_msgTypes, + }.Build() + File_apemanager_grpc_types_proto = out.File + file_apemanager_grpc_types_proto_rawDesc = nil + file_apemanager_grpc_types_proto_goTypes = nil + file_apemanager_grpc_types_proto_depIdxs = nil +} diff --git a/apemanager/json.go b/apemanager/json.go new file mode 100644 index 0000000..4f44d5e --- /dev/null +++ b/apemanager/json.go @@ -0,0 +1,14 @@ +package apemanager + +import ( + apemanager_grpc "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/apemanager/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message" +) + +func (t *ChainTarget) MarshalJSON() ([]byte, error) { + return message.MarshalJSON(t) +} + +func (t *ChainTarget) UnmarshalJSON(data []byte) error { + return message.UnmarshalJSON(t, data, new(apemanager_grpc.ChainTarget)) +} diff --git a/apemanager/marshal.go b/apemanager/marshal.go new file mode 100644 index 0000000..22e092e --- /dev/null +++ b/apemanager/marshal.go @@ -0,0 +1,288 @@ +package apemanager + +import ( + "fmt" + + apemanager "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/apemanager/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/proto" +) + +const ( + chainTargetTargetTypeField = 1 + chainTargetNameField = 2 + + chainRawField = 1 + + addChainReqBodyTargetField = 1 + addChainReqBodyChainField = 2 + + addChainRespBodyChainIDField = 1 + + removeChainReqBodyTargetField = 1 + removeChainReqBodyChainField = 2 + + /* + Fields for RemoveResponseBody are missed since RemoveResponseBody is empty. + */ + + listChainsReqBodyTargetField = 1 + + listChainsRespBodyChainsField = 1 +) + +func (t *ChainTarget) StableSize() (size int) { + if t == nil { + return 0 + } + + size += proto.EnumSize(chainTargetTargetTypeField, int32(t.targeType)) + size += proto.StringSize(chainTargetNameField, t.name) + + return size +} + +func (t *ChainTarget) StableMarshal(buf []byte) []byte { + if t == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, t.StableSize()) + } + + var offset int + + offset += proto.EnumMarshal(chainTargetTargetTypeField, buf[offset:], int32(t.targeType)) + proto.StringMarshal(chainTargetNameField, buf[offset:], t.name) + + return buf +} + +func (t *ChainTarget) Unmarshal(data []byte) error { + return message.Unmarshal(t, data, new(apemanager.ChainTarget)) +} + +func (c *Chain) StableSize() (size int) { + if c == nil { + return 0 + } + + switch v := c.GetKind().(type) { + case *ChainRaw: + if v != nil { + size += proto.BytesSize(chainRawField, v.GetRaw()) + } + default: + panic(fmt.Sprintf("unsupported chain kind: %T", v)) + } + + return size +} + +func (c *Chain) StableMarshal(buf []byte) []byte { + if c == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, c.StableSize()) + } + + var offset int + + switch v := c.GetKind().(type) { + case *ChainRaw: + if v != nil { + proto.BytesMarshal(chainRawField, buf[offset:], v.GetRaw()) + } + default: + panic(fmt.Sprintf("unsupported chain kind: %T", v)) + } + + return buf +} + +func (c *Chain) Unmarshal(data []byte) error { + return message.Unmarshal(c, data, new(apemanager.Chain)) +} + +func (rb *AddChainRequestBody) StableSize() (size int) { + if rb == nil { + return 0 + } + + size += proto.NestedStructureSize(addChainReqBodyTargetField, rb.target) + size += proto.NestedStructureSize(addChainReqBodyChainField, rb.chain) + + return size +} + +func (rb *AddChainRequestBody) StableMarshal(buf []byte) []byte { + if rb == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, rb.StableSize()) + } + + var offset int + + offset += proto.NestedStructureMarshal(addChainReqBodyTargetField, buf[offset:], rb.target) + proto.NestedStructureMarshal(addChainReqBodyChainField, buf[offset:], rb.chain) + + return buf +} + +func (rb *AddChainRequestBody) Unmarshal(data []byte) error { + return message.Unmarshal(rb, data, new(apemanager.AddChainRequest_Body)) +} + +func (rb *AddChainResponseBody) StableSize() (size int) { + if rb == nil { + return 0 + } + + size += proto.BytesSize(addChainRespBodyChainIDField, rb.chainID) + + return size +} + +func (rb *AddChainResponseBody) StableMarshal(buf []byte) []byte { + if rb == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, rb.StableSize()) + } + + var offset int + + proto.BytesMarshal(addChainRespBodyChainIDField, buf[offset:], rb.chainID) + + return buf +} + +func (rb *AddChainResponseBody) Unmarshal(data []byte) error { + return message.Unmarshal(rb, data, new(apemanager.AddChainResponse_Body)) +} + +func (rb *RemoveChainRequestBody) StableSize() (size int) { + if rb == nil { + return 0 + } + + size += proto.NestedStructureSize(addChainReqBodyTargetField, rb.target) + size += proto.BytesSize(addChainReqBodyChainField, rb.chainID) + + return size +} + +func (rb *RemoveChainRequestBody) StableMarshal(buf []byte) []byte { + if rb == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, rb.StableSize()) + } + + var offset int + + offset += proto.NestedStructureMarshal(removeChainReqBodyTargetField, buf[offset:], rb.target) + proto.BytesMarshal(removeChainReqBodyChainField, buf[offset:], rb.chainID) + + return buf +} + +func (rb *RemoveChainRequestBody) Unmarshal(data []byte) error { + return message.Unmarshal(rb, data, new(apemanager.RemoveChainRequest_Body)) +} + +func (rb *RemoveChainResponseBody) StableSize() (size int) { + if rb == nil { + return 0 + } + + return size +} + +func (rb *RemoveChainResponseBody) StableMarshal(buf []byte) []byte { + if rb == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, rb.StableSize()) + } + + return buf +} + +func (rb *RemoveChainResponseBody) Unmarshal(data []byte) error { + return message.Unmarshal(rb, data, new(apemanager.RemoveChainResponse_Body)) +} + +func (rb *ListChainsRequestBody) StableSize() (size int) { + if rb == nil { + return 0 + } + + size += proto.NestedStructureSize(listChainsReqBodyTargetField, rb.target) + + return size +} + +func (rb *ListChainsRequestBody) StableMarshal(buf []byte) []byte { + if rb == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, rb.StableSize()) + } + + var offset int + proto.NestedStructureMarshal(addChainReqBodyTargetField, buf[offset:], rb.target) + + return buf +} + +func (rb *ListChainsRequestBody) Unmarshal(data []byte) error { + return message.Unmarshal(rb, data, new(apemanager.ListChainsRequest_Body)) +} + +func (rb *ListChainsResponseBody) StableSize() (size int) { + if rb == nil { + return 0 + } + + for _, chain := range rb.GetChains() { + size += proto.NestedStructureSize(listChainsRespBodyChainsField, chain) + } + + return size +} + +func (rb *ListChainsResponseBody) StableMarshal(buf []byte) []byte { + if rb == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, rb.StableSize()) + } + + var offset int + for _, chain := range rb.GetChains() { + offset += proto.NestedStructureMarshal(listChainsRespBodyChainsField, buf[offset:], chain) + } + + return buf +} + +func (rb *ListChainsResponseBody) Unmarshal(data []byte) error { + return message.Unmarshal(rb, data, new(apemanager.ListChainsResponse_Body)) +} diff --git a/apemanager/message_test.go b/apemanager/message_test.go new file mode 100644 index 0000000..2d623d5 --- /dev/null +++ b/apemanager/message_test.go @@ -0,0 +1,27 @@ +package apemanager_test + +import ( + "testing" + + apemanagertest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/apemanager/test" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message" + messagetest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message/test" +) + +func TestMessageConvert(t *testing.T) { + messagetest.TestRPCMessage(t, + func(empty bool) message.Message { return apemanagertest.GenerateChainTarget(empty) }, + func(empty bool) message.Message { return apemanagertest.GenerateAddChainRequestBody(empty) }, + func(empty bool) message.Message { return apemanagertest.GenerateAddChainRequest(empty) }, + func(empty bool) message.Message { return apemanagertest.GenerateAddChainResponseBody(empty) }, + func(empty bool) message.Message { return apemanagertest.GenerateAddChainResponse(empty) }, + func(empty bool) message.Message { return apemanagertest.GenerateRemoveChainRequestBody(empty) }, + func(empty bool) message.Message { return apemanagertest.GenerateRemoveChainRequest(empty) }, + func(empty bool) message.Message { return apemanagertest.GenerateRemoveChainResponseBody(empty) }, + func(empty bool) message.Message { return apemanagertest.GenerateRemoveChainResponse(empty) }, + func(empty bool) message.Message { return apemanagertest.GenerateListChainsRequestBody(empty) }, + func(empty bool) message.Message { return apemanagertest.GenerateListChainsRequest(empty) }, + func(empty bool) message.Message { return apemanagertest.GenerateListChainsResponseBody(empty) }, + func(empty bool) message.Message { return apemanagertest.GenerateListChainsResponse(empty) }, + ) +} diff --git a/apemanager/status.go b/apemanager/status.go new file mode 100644 index 0000000..932fa6b --- /dev/null +++ b/apemanager/status.go @@ -0,0 +1,76 @@ +package apemanager + +import ( + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/status" + statusgrpc "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/status/grpc" +) + +// LocalizeFailStatus checks if passed global status.Code is related to ape manager failure and: +// +// then localizes the code and returns true, +// else leaves the code unchanged and returns false. +// +// Arg must be non-nil. +func LocalizeFailStatus(c *status.Code) bool { + return status.LocalizeIfInSection(c, uint32(statusgrpc.Section_SECTION_APE_MANAGER)) +} + +// GlobalizeFail globalizes local code of ape manager failure. +// +// Arg must be non-nil. +func GlobalizeFail(c *status.Code) { + c.GlobalizeSection(uint32(statusgrpc.Section_SECTION_APE_MANAGER)) +} + +const ( + // StatusAPEManagerAccessDenied is a local status.Code value for + // ACCESS_DENIED ape manager failure. + StatusAPEManagerAccessDenied status.Code = iota +) + +const ( + // detailAccessDeniedDesc is a StatusAccessDenied detail ID for + // human-readable description. + detailAccessDeniedDesc = iota +) + +// WriteAccessDeniedDesc writes human-readable description of StatusAccessDenied +// into status.Status as a detail. The status must not be nil. +// +// Existing details are expected to be ID-unique, otherwise undefined behavior. +func WriteAccessDeniedDesc(st *status.Status, desc string) { + var found bool + + st.IterateDetails(func(d *status.Detail) bool { + if d.ID() == detailAccessDeniedDesc { + found = true + d.SetValue([]byte(desc)) + } + + return found + }) + + if !found { + var d status.Detail + + d.SetID(detailAccessDeniedDesc) + d.SetValue([]byte(desc)) + + st.AppendDetails(d) + } +} + +// ReadAccessDeniedDesc looks up for status detail with human-readable description +// of StatusAccessDenied. Returns empty string if detail is missing. +func ReadAccessDeniedDesc(st status.Status) (desc string) { + st.IterateDetails(func(d *status.Detail) bool { + if d.ID() == detailAccessDeniedDesc { + desc = string(d.Value()) + return true + } + + return false + }) + + return +} diff --git a/apemanager/status_test.go b/apemanager/status_test.go new file mode 100644 index 0000000..c150ac7 --- /dev/null +++ b/apemanager/status_test.go @@ -0,0 +1,30 @@ +package apemanager_test + +import ( + "testing" + + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/apemanager" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/status" + statustest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/status/test" + "github.com/stretchr/testify/require" +) + +func TestStatusCodes(t *testing.T) { + statustest.TestCodes(t, apemanager.LocalizeFailStatus, apemanager.GlobalizeFail, + apemanager.StatusAPEManagerAccessDenied, 5120, + ) +} + +func TestAccessDeniedDesc(t *testing.T) { + var st status.Status + + require.Empty(t, apemanager.ReadAccessDeniedDesc(st)) + + const desc = "some description" + + apemanager.WriteAccessDeniedDesc(&st, desc) + require.Equal(t, desc, apemanager.ReadAccessDeniedDesc(st)) + + apemanager.WriteAccessDeniedDesc(&st, desc+"1") + require.Equal(t, desc+"1", apemanager.ReadAccessDeniedDesc(st)) +} diff --git a/apemanager/string.go b/apemanager/string.go new file mode 100644 index 0000000..dddeede --- /dev/null +++ b/apemanager/string.go @@ -0,0 +1,18 @@ +package apemanager + +import ( + apemanager_grpc "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/apemanager/grpc" +) + +func (tt TargetType) String() string { + return TargetTypeToGRPCField(tt).String() +} + +func (tt *TargetType) FromString(s string) bool { + i, ok := apemanager_grpc.TargetType_value[s] + if ok { + *tt = TargetType(i) + } + + return ok +} diff --git a/apemanager/test/generate.go b/apemanager/test/generate.go new file mode 100644 index 0000000..00dd236 --- /dev/null +++ b/apemanager/test/generate.go @@ -0,0 +1,208 @@ +package apemanagertest + +import ( + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/apemanager" + sessiontest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session/test" +) + +func generateChainID(empty bool) []byte { + if empty { + return []byte{} + } + + return []byte("616c6c6f774f626a476574436e72") +} + +func generateRawChains(empty bool, n int) []*apemanager.Chain { + if empty { + return []*apemanager.Chain{} + } + + res := make([]*apemanager.Chain, n) + for i := range res { + res[i] = generateRawChain(empty) + } + return res +} + +func generateRawChain(empty bool) *apemanager.Chain { + chRaw := new(apemanager.ChainRaw) + + if empty { + chRaw.SetRaw([]byte("{}")) + } else { + chRaw.SetRaw([]byte(`{ + "ID": "", + "Rules": [ + { + "Status": "Allow", + "Actions": { + "Inverted": false, + "Names": [ + "GetObject" + ] + }, + "Resources": { + "Inverted": false, + "Names": [ + "native:object/*" + ] + }, + "Any": false, + "Condition": [ + { + "Op": "StringEquals", + "Object": "Resource", + "Key": "Department", + "Value": "HR" + } + ] + } + ], + "MatchType": "DenyPriority" + }`)) + } + + ch := new(apemanager.Chain) + ch.SetKind(chRaw) + return ch +} + +func GenerateChainTarget(empty bool) *apemanager.ChainTarget { + m := new(apemanager.ChainTarget) + + if !empty { + m.SetTargetType(apemanager.TargetTypeContainer) + m.SetName("BzQw5HH3feoxFDD5tCT87Y1726qzgLfxEE7wgtoRzB3R") + } + + return m +} + +func GenerateAddChainRequestBody(empty bool) *apemanager.AddChainRequestBody { + m := new(apemanager.AddChainRequestBody) + + if !empty { + m.SetTarget(GenerateChainTarget(empty)) + m.SetChain(generateRawChain(empty)) + } + + return m +} + +func GenerateAddChainRequest(empty bool) *apemanager.AddChainRequest { + m := new(apemanager.AddChainRequest) + + if !empty { + m.SetBody(GenerateAddChainRequestBody(empty)) + m.SetMetaHeader(sessiontest.GenerateRequestMetaHeader(empty)) + m.SetVerificationHeader(sessiontest.GenerateRequestVerificationHeader(empty)) + } + + return m +} + +func GenerateAddChainResponseBody(empty bool) *apemanager.AddChainResponseBody { + m := new(apemanager.AddChainResponseBody) + + if !empty { + m.SetChainID(generateChainID(empty)) + } + + return m +} + +func GenerateAddChainResponse(empty bool) *apemanager.AddChainResponse { + m := new(apemanager.AddChainResponse) + + if !empty { + m.SetBody(GenerateAddChainResponseBody(empty)) + m.SetMetaHeader(sessiontest.GenerateResponseMetaHeader(empty)) + m.SetVerificationHeader(sessiontest.GenerateResponseVerificationHeader(empty)) + } + + return m +} + +func GenerateRemoveChainRequestBody(empty bool) *apemanager.RemoveChainRequestBody { + m := new(apemanager.RemoveChainRequestBody) + + if !empty { + m.SetChainID(generateChainID(empty)) + m.SetTarget(GenerateChainTarget(empty)) + } + + return m +} + +func GenerateRemoveChainRequest(empty bool) *apemanager.RemoveChainRequest { + m := new(apemanager.RemoveChainRequest) + + if !empty { + m.SetBody(GenerateRemoveChainRequestBody(empty)) + m.SetMetaHeader(sessiontest.GenerateRequestMetaHeader(empty)) + m.SetVerificationHeader(sessiontest.GenerateRequestVerificationHeader(empty)) + } + + return m +} + +func GenerateRemoveChainResponseBody(_ bool) *apemanager.RemoveChainResponseBody { + return new(apemanager.RemoveChainResponseBody) +} + +func GenerateRemoveChainResponse(empty bool) *apemanager.RemoveChainResponse { + m := new(apemanager.RemoveChainResponse) + + if !empty { + m.SetBody(GenerateRemoveChainResponseBody(empty)) + m.SetMetaHeader(sessiontest.GenerateResponseMetaHeader(empty)) + m.SetVerificationHeader(sessiontest.GenerateResponseVerificationHeader(empty)) + } + + return m +} + +func GenerateListChainsRequestBody(empty bool) *apemanager.ListChainsRequestBody { + m := new(apemanager.ListChainsRequestBody) + + if !empty { + m.SetTarget(GenerateChainTarget(empty)) + } + + return m +} + +func GenerateListChainsRequest(empty bool) *apemanager.ListChainsRequest { + m := new(apemanager.ListChainsRequest) + + if !empty { + m.SetBody(GenerateListChainsRequestBody(empty)) + m.SetMetaHeader(sessiontest.GenerateRequestMetaHeader(empty)) + m.SetVerificationHeader(sessiontest.GenerateRequestVerificationHeader(empty)) + } + + return m +} + +func GenerateListChainsResponseBody(empty bool) *apemanager.ListChainsResponseBody { + m := new(apemanager.ListChainsResponseBody) + + if !empty { + m.SetChains(generateRawChains(empty, 10)) + } + + return m +} + +func GenerateListChainsResponse(empty bool) *apemanager.ListChainsResponse { + m := new(apemanager.ListChainsResponse) + + if !empty { + m.SetBody(GenerateListChainsResponseBody(empty)) + m.SetMetaHeader(sessiontest.GenerateResponseMetaHeader(empty)) + m.SetVerificationHeader(sessiontest.GenerateResponseVerificationHeader(empty)) + } + + return m +} diff --git a/apemanager/types.go b/apemanager/types.go new file mode 100644 index 0000000..1fcca29 --- /dev/null +++ b/apemanager/types.go @@ -0,0 +1,244 @@ +package apemanager + +import ( + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session" +) + +type TargetType uint32 + +const ( + TargetTypeUndefined TargetType = iota + TargetTypeNamespace + TargetTypeContainer + TargetTypeUser + TargetTypeGroup +) + +type ChainTarget struct { + targeType TargetType + + name string +} + +func (ct *ChainTarget) SetTargetType(targeType TargetType) { + ct.targeType = targeType +} + +func (ct *ChainTarget) SetName(name string) { + ct.name = name +} + +func (ct *ChainTarget) GetTargetType() TargetType { + if ct != nil { + return ct.targeType + } + + return 0 +} + +func (ct *ChainTarget) GetName() string { + if ct != nil { + return ct.name + } + + return "" +} + +type AddChainRequest struct { + body *AddChainRequestBody + + session.RequestHeaders +} + +func (r *AddChainRequest) SetBody(body *AddChainRequestBody) { + r.body = body +} + +func (r *AddChainRequest) GetBody() *AddChainRequestBody { + return r.body +} + +type chainKind interface { + isChainKind() +} + +type Chain struct { + kind chainKind +} + +func (c *Chain) SetKind(kind chainKind) { + c.kind = kind +} + +func (c *Chain) GetKind() chainKind { + return c.kind +} + +type ChainRaw struct { + Raw []byte +} + +func (*ChainRaw) isChainKind() {} + +func (c *ChainRaw) SetRaw(raw []byte) { + c.Raw = raw +} + +func (c *ChainRaw) GetRaw() []byte { + return c.Raw +} + +type AddChainRequestBody struct { + target *ChainTarget + + chain *Chain +} + +func (rb *AddChainRequestBody) SetTarget(target *ChainTarget) { + rb.target = target +} + +func (rb *AddChainRequestBody) GetTarget() *ChainTarget { + return rb.target +} + +func (rb *AddChainRequestBody) SetChain(chain *Chain) { + rb.chain = chain +} + +func (rb *AddChainRequestBody) GetChain() *Chain { + return rb.chain +} + +type AddChainResponse struct { + body *AddChainResponseBody + + session.ResponseHeaders +} + +func (r *AddChainResponse) SetBody(body *AddChainResponseBody) { + r.body = body +} + +func (r *AddChainResponse) GetBody() *AddChainResponseBody { + return r.body +} + +type AddChainResponseBody struct { + chainID []byte +} + +func (rb *AddChainResponseBody) SetChainID(chainID []byte) { + rb.chainID = chainID +} + +func (rb *AddChainResponseBody) GetChainID() []byte { + return rb.chainID +} + +type RemoveChainRequest struct { + body *RemoveChainRequestBody + + session.RequestHeaders +} + +func (r *RemoveChainRequest) SetBody(body *RemoveChainRequestBody) { + r.body = body +} + +func (r *RemoveChainRequest) GetBody() *RemoveChainRequestBody { + return r.body +} + +type RemoveChainRequestBody struct { + target *ChainTarget + + chainID []byte +} + +func (rb *RemoveChainRequestBody) SetTarget(target *ChainTarget) { + rb.target = target +} + +func (rb *RemoveChainRequestBody) GetTarget() *ChainTarget { + return rb.target +} + +func (rb *RemoveChainRequestBody) SetChainID(chainID []byte) { + rb.chainID = chainID +} + +func (rb *RemoveChainRequestBody) GetChainID() []byte { + return rb.chainID +} + +type RemoveChainResponse struct { + body *RemoveChainResponseBody + + session.ResponseHeaders +} + +type RemoveChainResponseBody struct { +} + +func (r *RemoveChainResponse) SetBody(body *RemoveChainResponseBody) { + r.body = body +} + +func (r *RemoveChainResponse) GetBody() *RemoveChainResponseBody { + return r.body +} + +type ListChainsRequest struct { + body *ListChainsRequestBody + + session.RequestHeaders +} + +func (r *ListChainsRequest) SetBody(body *ListChainsRequestBody) { + r.body = body +} + +func (r *ListChainsRequest) GetBody() *ListChainsRequestBody { + return r.body +} + +type ListChainsRequestBody struct { + target *ChainTarget +} + +func (rb *ListChainsRequestBody) SetTarget(target *ChainTarget) { + rb.target = target +} + +func (rb *ListChainsRequestBody) GetTarget() *ChainTarget { + return rb.target +} + +type ListChainsResponse struct { + body *ListChainsResponseBody + + session.ResponseHeaders +} + +func (r *ListChainsResponse) SetBody(body *ListChainsResponseBody) { + r.body = body +} + +func (r *ListChainsResponse) GetBody() *ListChainsResponseBody { + return r.body +} + +type ListChainsResponseBody struct { + chains []*Chain + + session.RequestHeaders +} + +func (r *ListChainsResponseBody) SetChains(chains []*Chain) { + r.chains = chains +} + +func (r *ListChainsResponseBody) GetChains() []*Chain { + return r.chains +} diff --git a/rpc/apemanager.go b/rpc/apemanager.go new file mode 100644 index 0000000..3f3d6cd --- /dev/null +++ b/rpc/apemanager.go @@ -0,0 +1,60 @@ +package rpc + +import ( + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/apemanager" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/client" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/common" +) + +const serviceAPEManager = serviceNamePrefix + "apemanager.APEManagerService" + +const ( + rpcAPEManagerAddChain = "AddChain" + rpcAPEManagerRemoveChain = "RemoveChain" + rpcAPEManagerListChains = "ListChains" +) + +func AddChain( + cli *client.Client, + req *apemanager.AddChainRequest, + opts ...client.CallOption, +) (*apemanager.AddChainResponse, error) { + resp := new(apemanager.AddChainResponse) + + err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceAPEManager, rpcAPEManagerAddChain), req, resp, opts...) + if err != nil { + return nil, err + } + + return resp, nil +} + +func RemoveChain( + cli *client.Client, + req *apemanager.RemoveChainRequest, + opts ...client.CallOption, +) (*apemanager.RemoveChainResponse, error) { + resp := new(apemanager.RemoveChainResponse) + + err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceAPEManager, rpcAPEManagerRemoveChain), req, resp, opts...) + if err != nil { + return nil, err + } + + return resp, nil +} + +func ListChains( + cli *client.Client, + req *apemanager.ListChainsRequest, + opts ...client.CallOption, +) (*apemanager.ListChainsResponse, error) { + resp := new(apemanager.ListChainsResponse) + + err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceAPEManager, rpcAPEManagerListChains), req, resp, opts...) + if err != nil { + return nil, err + } + + return resp, nil +} diff --git a/signature/body.go b/signature/body.go index b7bb6b4..3362e95 100644 --- a/signature/body.go +++ b/signature/body.go @@ -4,6 +4,7 @@ import ( "fmt" "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/accounting" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/apemanager" "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/container" "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/netmap" "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/object" @@ -105,5 +106,19 @@ func serviceMessageBody(req any) stableMarshaler { return v.GetBody() case *netmap.SnapshotResponse: return v.GetBody() + + /* APEManager */ + case *apemanager.AddChainRequest: + return v.GetBody() + case *apemanager.AddChainResponse: + return v.GetBody() + case *apemanager.RemoveChainRequest: + return v.GetBody() + case *apemanager.RemoveChainResponse: + return v.GetBody() + case *apemanager.ListChainsRequest: + return v.GetBody() + case *apemanager.ListChainsResponse: + return v.GetBody() } } diff --git a/status/grpc/types.pb.go b/status/grpc/types.pb.go index 9637294..64a0835 100644 --- a/status/grpc/types.pb.go +++ b/status/grpc/types.pb.go @@ -34,6 +34,8 @@ const ( Section_SECTION_CONTAINER Section = 3 // Session service-specific errors. Section_SECTION_SESSION Section = 4 + // Session service-specific errors. + Section_SECTION_APE_MANAGER Section = 5 ) // Enum value maps for Section. @@ -44,6 +46,7 @@ var ( 2: "SECTION_OBJECT", 3: "SECTION_CONTAINER", 4: "SECTION_SESSION", + 5: "SECTION_APE_MANAGER", } Section_value = map[string]int32{ "SECTION_SUCCESS": 0, @@ -51,6 +54,7 @@ var ( "SECTION_OBJECT": 2, "SECTION_CONTAINER": 3, "SECTION_SESSION": 4, + "SECTION_APE_MANAGER": 5, } ) @@ -359,6 +363,51 @@ func (Session) EnumDescriptor() ([]byte, []int) { return file_status_grpc_types_proto_rawDescGZIP(), []int{5} } +// Section of status for APE manager related operations. +type APEManager int32 + +const ( + // [**5120**] The operation is denied by APE manager. + APEManager_APE_MANAGER_ACCESS_DENIED APEManager = 0 +) + +// Enum value maps for APEManager. +var ( + APEManager_name = map[int32]string{ + 0: "APE_MANAGER_ACCESS_DENIED", + } + APEManager_value = map[string]int32{ + "APE_MANAGER_ACCESS_DENIED": 0, + } +) + +func (x APEManager) Enum() *APEManager { + p := new(APEManager) + *p = x + return p +} + +func (x APEManager) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (APEManager) Descriptor() protoreflect.EnumDescriptor { + return file_status_grpc_types_proto_enumTypes[6].Descriptor() +} + +func (APEManager) Type() protoreflect.EnumType { + return &file_status_grpc_types_proto_enumTypes[6] +} + +func (x APEManager) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use APEManager.Descriptor instead. +func (APEManager) EnumDescriptor() ([]byte, []int) { + return file_status_grpc_types_proto_rawDescGZIP(), []int{6} +} + // Declares the general format of the status returns of the NeoFS RPC protocol. // Status is present in all response messages. Each RPC of NeoFS protocol // describes the possible outcomes and details of the operation. @@ -531,46 +580,51 @@ var file_status_grpc_types_proto_rawDesc = []byte{ 0x2e, 0x0a, 0x06, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x02, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x2a, - 0x7a, 0x0a, 0x07, 0x53, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x13, 0x0a, 0x0f, 0x53, 0x45, - 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x53, 0x55, 0x43, 0x43, 0x45, 0x53, 0x53, 0x10, 0x00, 0x12, - 0x1a, 0x0a, 0x16, 0x53, 0x45, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x46, 0x41, 0x49, 0x4c, 0x55, - 0x52, 0x45, 0x5f, 0x43, 0x4f, 0x4d, 0x4d, 0x4f, 0x4e, 0x10, 0x01, 0x12, 0x12, 0x0a, 0x0e, 0x53, - 0x45, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x4f, 0x42, 0x4a, 0x45, 0x43, 0x54, 0x10, 0x02, 0x12, - 0x15, 0x0a, 0x11, 0x53, 0x45, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x43, 0x4f, 0x4e, 0x54, 0x41, - 0x49, 0x4e, 0x45, 0x52, 0x10, 0x03, 0x12, 0x13, 0x0a, 0x0f, 0x53, 0x45, 0x43, 0x54, 0x49, 0x4f, - 0x4e, 0x5f, 0x53, 0x45, 0x53, 0x53, 0x49, 0x4f, 0x4e, 0x10, 0x04, 0x2a, 0x11, 0x0a, 0x07, 0x53, - 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x06, 0x0a, 0x02, 0x4f, 0x4b, 0x10, 0x00, 0x2a, 0x6f, - 0x0a, 0x0a, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x46, 0x61, 0x69, 0x6c, 0x12, 0x0c, 0x0a, 0x08, - 0x49, 0x4e, 0x54, 0x45, 0x52, 0x4e, 0x41, 0x4c, 0x10, 0x00, 0x12, 0x16, 0x0a, 0x12, 0x57, 0x52, - 0x4f, 0x4e, 0x47, 0x5f, 0x4d, 0x41, 0x47, 0x49, 0x43, 0x5f, 0x4e, 0x55, 0x4d, 0x42, 0x45, 0x52, - 0x10, 0x01, 0x12, 0x1f, 0x0a, 0x1b, 0x53, 0x49, 0x47, 0x4e, 0x41, 0x54, 0x55, 0x52, 0x45, 0x5f, - 0x56, 0x45, 0x52, 0x49, 0x46, 0x49, 0x43, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x46, 0x41, 0x49, - 0x4c, 0x10, 0x02, 0x12, 0x1a, 0x0a, 0x16, 0x4e, 0x4f, 0x44, 0x45, 0x5f, 0x55, 0x4e, 0x44, 0x45, - 0x52, 0x5f, 0x4d, 0x41, 0x49, 0x4e, 0x54, 0x45, 0x4e, 0x41, 0x4e, 0x43, 0x45, 0x10, 0x03, 0x2a, - 0x88, 0x01, 0x0a, 0x06, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x11, 0x0a, 0x0d, 0x41, 0x43, - 0x43, 0x45, 0x53, 0x53, 0x5f, 0x44, 0x45, 0x4e, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x14, 0x0a, - 0x10, 0x4f, 0x42, 0x4a, 0x45, 0x43, 0x54, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x46, 0x4f, 0x55, 0x4e, - 0x44, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x4c, 0x4f, 0x43, 0x4b, 0x45, 0x44, 0x10, 0x02, 0x12, - 0x1b, 0x0a, 0x17, 0x4c, 0x4f, 0x43, 0x4b, 0x5f, 0x4e, 0x4f, 0x4e, 0x5f, 0x52, 0x45, 0x47, 0x55, - 0x4c, 0x41, 0x52, 0x5f, 0x4f, 0x42, 0x4a, 0x45, 0x43, 0x54, 0x10, 0x03, 0x12, 0x1a, 0x0a, 0x16, - 0x4f, 0x42, 0x4a, 0x45, 0x43, 0x54, 0x5f, 0x41, 0x4c, 0x52, 0x45, 0x41, 0x44, 0x59, 0x5f, 0x52, - 0x45, 0x4d, 0x4f, 0x56, 0x45, 0x44, 0x10, 0x04, 0x12, 0x10, 0x0a, 0x0c, 0x4f, 0x55, 0x54, 0x5f, - 0x4f, 0x46, 0x5f, 0x52, 0x41, 0x4e, 0x47, 0x45, 0x10, 0x05, 0x2a, 0x55, 0x0a, 0x09, 0x43, 0x6f, - 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x12, 0x17, 0x0a, 0x13, 0x43, 0x4f, 0x4e, 0x54, 0x41, - 0x49, 0x4e, 0x45, 0x52, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x46, 0x4f, 0x55, 0x4e, 0x44, 0x10, 0x00, - 0x12, 0x12, 0x0a, 0x0e, 0x45, 0x41, 0x43, 0x4c, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x46, 0x4f, 0x55, - 0x4e, 0x44, 0x10, 0x01, 0x12, 0x1b, 0x0a, 0x17, 0x43, 0x4f, 0x4e, 0x54, 0x41, 0x49, 0x4e, 0x45, - 0x52, 0x5f, 0x41, 0x43, 0x43, 0x45, 0x53, 0x53, 0x5f, 0x44, 0x45, 0x4e, 0x49, 0x45, 0x44, 0x10, - 0x02, 0x2a, 0x31, 0x0a, 0x07, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x13, 0x0a, 0x0f, - 0x54, 0x4f, 0x4b, 0x45, 0x4e, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x46, 0x4f, 0x55, 0x4e, 0x44, 0x10, - 0x00, 0x12, 0x11, 0x0a, 0x0d, 0x54, 0x4f, 0x4b, 0x45, 0x4e, 0x5f, 0x45, 0x58, 0x50, 0x49, 0x52, - 0x45, 0x44, 0x10, 0x01, 0x42, 0x61, 0x5a, 0x42, 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, 0x61, 0x70, - 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2f, 0x67, - 0x72, 0x70, 0x63, 0x3b, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0xaa, 0x02, 0x1a, 0x4e, 0x65, 0x6f, - 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, - 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x93, 0x01, 0x0a, 0x07, 0x53, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x13, 0x0a, 0x0f, 0x53, + 0x45, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x53, 0x55, 0x43, 0x43, 0x45, 0x53, 0x53, 0x10, 0x00, + 0x12, 0x1a, 0x0a, 0x16, 0x53, 0x45, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x46, 0x41, 0x49, 0x4c, + 0x55, 0x52, 0x45, 0x5f, 0x43, 0x4f, 0x4d, 0x4d, 0x4f, 0x4e, 0x10, 0x01, 0x12, 0x12, 0x0a, 0x0e, + 0x53, 0x45, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x4f, 0x42, 0x4a, 0x45, 0x43, 0x54, 0x10, 0x02, + 0x12, 0x15, 0x0a, 0x11, 0x53, 0x45, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x43, 0x4f, 0x4e, 0x54, + 0x41, 0x49, 0x4e, 0x45, 0x52, 0x10, 0x03, 0x12, 0x13, 0x0a, 0x0f, 0x53, 0x45, 0x43, 0x54, 0x49, + 0x4f, 0x4e, 0x5f, 0x53, 0x45, 0x53, 0x53, 0x49, 0x4f, 0x4e, 0x10, 0x04, 0x12, 0x17, 0x0a, 0x13, + 0x53, 0x45, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x41, 0x50, 0x45, 0x5f, 0x4d, 0x41, 0x4e, 0x41, + 0x47, 0x45, 0x52, 0x10, 0x05, 0x2a, 0x11, 0x0a, 0x07, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, + 0x12, 0x06, 0x0a, 0x02, 0x4f, 0x4b, 0x10, 0x00, 0x2a, 0x6f, 0x0a, 0x0a, 0x43, 0x6f, 0x6d, 0x6d, + 0x6f, 0x6e, 0x46, 0x61, 0x69, 0x6c, 0x12, 0x0c, 0x0a, 0x08, 0x49, 0x4e, 0x54, 0x45, 0x52, 0x4e, + 0x41, 0x4c, 0x10, 0x00, 0x12, 0x16, 0x0a, 0x12, 0x57, 0x52, 0x4f, 0x4e, 0x47, 0x5f, 0x4d, 0x41, + 0x47, 0x49, 0x43, 0x5f, 0x4e, 0x55, 0x4d, 0x42, 0x45, 0x52, 0x10, 0x01, 0x12, 0x1f, 0x0a, 0x1b, + 0x53, 0x49, 0x47, 0x4e, 0x41, 0x54, 0x55, 0x52, 0x45, 0x5f, 0x56, 0x45, 0x52, 0x49, 0x46, 0x49, + 0x43, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x46, 0x41, 0x49, 0x4c, 0x10, 0x02, 0x12, 0x1a, 0x0a, + 0x16, 0x4e, 0x4f, 0x44, 0x45, 0x5f, 0x55, 0x4e, 0x44, 0x45, 0x52, 0x5f, 0x4d, 0x41, 0x49, 0x4e, + 0x54, 0x45, 0x4e, 0x41, 0x4e, 0x43, 0x45, 0x10, 0x03, 0x2a, 0x88, 0x01, 0x0a, 0x06, 0x4f, 0x62, + 0x6a, 0x65, 0x63, 0x74, 0x12, 0x11, 0x0a, 0x0d, 0x41, 0x43, 0x43, 0x45, 0x53, 0x53, 0x5f, 0x44, + 0x45, 0x4e, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x14, 0x0a, 0x10, 0x4f, 0x42, 0x4a, 0x45, 0x43, + 0x54, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x46, 0x4f, 0x55, 0x4e, 0x44, 0x10, 0x01, 0x12, 0x0a, 0x0a, + 0x06, 0x4c, 0x4f, 0x43, 0x4b, 0x45, 0x44, 0x10, 0x02, 0x12, 0x1b, 0x0a, 0x17, 0x4c, 0x4f, 0x43, + 0x4b, 0x5f, 0x4e, 0x4f, 0x4e, 0x5f, 0x52, 0x45, 0x47, 0x55, 0x4c, 0x41, 0x52, 0x5f, 0x4f, 0x42, + 0x4a, 0x45, 0x43, 0x54, 0x10, 0x03, 0x12, 0x1a, 0x0a, 0x16, 0x4f, 0x42, 0x4a, 0x45, 0x43, 0x54, + 0x5f, 0x41, 0x4c, 0x52, 0x45, 0x41, 0x44, 0x59, 0x5f, 0x52, 0x45, 0x4d, 0x4f, 0x56, 0x45, 0x44, + 0x10, 0x04, 0x12, 0x10, 0x0a, 0x0c, 0x4f, 0x55, 0x54, 0x5f, 0x4f, 0x46, 0x5f, 0x52, 0x41, 0x4e, + 0x47, 0x45, 0x10, 0x05, 0x2a, 0x55, 0x0a, 0x09, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, + 0x72, 0x12, 0x17, 0x0a, 0x13, 0x43, 0x4f, 0x4e, 0x54, 0x41, 0x49, 0x4e, 0x45, 0x52, 0x5f, 0x4e, + 0x4f, 0x54, 0x5f, 0x46, 0x4f, 0x55, 0x4e, 0x44, 0x10, 0x00, 0x12, 0x12, 0x0a, 0x0e, 0x45, 0x41, + 0x43, 0x4c, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x46, 0x4f, 0x55, 0x4e, 0x44, 0x10, 0x01, 0x12, 0x1b, + 0x0a, 0x17, 0x43, 0x4f, 0x4e, 0x54, 0x41, 0x49, 0x4e, 0x45, 0x52, 0x5f, 0x41, 0x43, 0x43, 0x45, + 0x53, 0x53, 0x5f, 0x44, 0x45, 0x4e, 0x49, 0x45, 0x44, 0x10, 0x02, 0x2a, 0x31, 0x0a, 0x07, 0x53, + 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x13, 0x0a, 0x0f, 0x54, 0x4f, 0x4b, 0x45, 0x4e, 0x5f, + 0x4e, 0x4f, 0x54, 0x5f, 0x46, 0x4f, 0x55, 0x4e, 0x44, 0x10, 0x00, 0x12, 0x11, 0x0a, 0x0d, 0x54, + 0x4f, 0x4b, 0x45, 0x4e, 0x5f, 0x45, 0x58, 0x50, 0x49, 0x52, 0x45, 0x44, 0x10, 0x01, 0x2a, 0x2b, + 0x0a, 0x0a, 0x41, 0x50, 0x45, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x12, 0x1d, 0x0a, 0x19, + 0x41, 0x50, 0x45, 0x5f, 0x4d, 0x41, 0x4e, 0x41, 0x47, 0x45, 0x52, 0x5f, 0x41, 0x43, 0x43, 0x45, + 0x53, 0x53, 0x5f, 0x44, 0x45, 0x4e, 0x49, 0x45, 0x44, 0x10, 0x00, 0x42, 0x61, 0x5a, 0x42, 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, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x73, + 0x74, 0x61, 0x74, 0x75, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x73, 0x74, 0x61, 0x74, 0x75, + 0x73, 0xaa, 0x02, 0x1a, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, + 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -585,7 +639,7 @@ func file_status_grpc_types_proto_rawDescGZIP() []byte { return file_status_grpc_types_proto_rawDescData } -var file_status_grpc_types_proto_enumTypes = make([]protoimpl.EnumInfo, 6) +var file_status_grpc_types_proto_enumTypes = make([]protoimpl.EnumInfo, 7) var file_status_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 2) var file_status_grpc_types_proto_goTypes = []interface{}{ (Section)(0), // 0: neo.fs.v2.status.Section @@ -594,11 +648,12 @@ var file_status_grpc_types_proto_goTypes = []interface{}{ (Object)(0), // 3: neo.fs.v2.status.Object (Container)(0), // 4: neo.fs.v2.status.Container (Session)(0), // 5: neo.fs.v2.status.Session - (*Status)(nil), // 6: neo.fs.v2.status.Status - (*Status_Detail)(nil), // 7: neo.fs.v2.status.Status.Detail + (APEManager)(0), // 6: neo.fs.v2.status.APEManager + (*Status)(nil), // 7: neo.fs.v2.status.Status + (*Status_Detail)(nil), // 8: neo.fs.v2.status.Status.Detail } var file_status_grpc_types_proto_depIdxs = []int32{ - 7, // 0: neo.fs.v2.status.Status.details:type_name -> neo.fs.v2.status.Status.Detail + 8, // 0: neo.fs.v2.status.Status.details:type_name -> neo.fs.v2.status.Status.Detail 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 @@ -642,7 +697,7 @@ func file_status_grpc_types_proto_init() { File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_status_grpc_types_proto_rawDesc, - NumEnums: 6, + NumEnums: 7, NumMessages: 2, NumExtensions: 0, NumServices: 0, From fa8f92d6621faa76b027c451f1dbef7de637d170 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Thu, 25 Apr 2024 15:12:32 +0300 Subject: [PATCH 1121/1196] [#75] audit: Remove deprecated service Signed-off-by: Evgenii Stratonikov --- audit/convert.go | 94 ------------- audit/grpc/types.go | 75 ---------- audit/grpc/types.pb.go | 311 ----------------------------------------- audit/json.go | 14 -- audit/marshal.go | 88 ------------ audit/message_test.go | 15 -- audit/test/generate.go | 29 ---- audit/types.go | 243 -------------------------------- 8 files changed, 869 deletions(-) delete mode 100644 audit/convert.go delete mode 100644 audit/grpc/types.go delete mode 100644 audit/grpc/types.pb.go delete mode 100644 audit/json.go delete mode 100644 audit/marshal.go delete mode 100644 audit/message_test.go delete mode 100644 audit/test/generate.go delete mode 100644 audit/types.go diff --git a/audit/convert.go b/audit/convert.go deleted file mode 100644 index a841928..0000000 --- a/audit/convert.go +++ /dev/null @@ -1,94 +0,0 @@ -package audit - -import ( - audit "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/audit/grpc" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" - refsGRPC "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/grpc" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message" -) - -func (a *DataAuditResult) ToGRPCMessage() grpc.Message { - var m *audit.DataAuditResult - - if a != nil { - m = new(audit.DataAuditResult) - - m.SetAuditEpoch(a.auditEpoch) - m.SetPublicKey(a.pubKey) - m.SetContainerId(a.cid.ToGRPCMessage().(*refsGRPC.ContainerID)) - m.SetComplete(a.complete) - m.SetVersion(a.version.ToGRPCMessage().(*refsGRPC.Version)) - m.SetPassNodes(a.passNodes) - m.SetFailNodes(a.failNodes) - m.SetRetries(a.retries) - m.SetRequests(a.requests) - m.SetHit(a.hit) - m.SetMiss(a.miss) - m.SetFail(a.fail) - m.SetPassSg(refs.ObjectIDListToGRPCMessage(a.passSG)) - m.SetFailSg(refs.ObjectIDListToGRPCMessage(a.failSG)) - } - - return m -} - -func (a *DataAuditResult) FromGRPCMessage(m grpc.Message) error { - v, ok := m.(*audit.DataAuditResult) - if !ok { - return message.NewUnexpectedMessageType(m, v) - } - - var err error - - cid := v.GetContainerId() - if cid == nil { - a.cid = nil - } else { - if a.cid == nil { - a.cid = new(refs.ContainerID) - } - - err = a.cid.FromGRPCMessage(cid) - if err != nil { - return err - } - } - - version := v.GetVersion() - if version == nil { - a.version = nil - } else { - if a.version == nil { - a.version = new(refs.Version) - } - - err = a.version.FromGRPCMessage(version) - if err != nil { - return err - } - } - - a.passSG, err = refs.ObjectIDListFromGRPCMessage(v.GetPassSg()) - if err != nil { - return err - } - - a.failSG, err = refs.ObjectIDListFromGRPCMessage(v.GetFailSg()) - if err != nil { - return err - } - - a.auditEpoch = v.GetAuditEpoch() - a.pubKey = v.GetPublicKey() - a.complete = v.GetComplete() - a.passNodes = v.GetPassNodes() - a.failNodes = v.GetFailNodes() - a.retries = v.GetRetries() - a.requests = v.GetRequests() - a.hit = v.GetHit() - a.miss = v.GetMiss() - a.fail = v.GetFail() - - return err -} diff --git a/audit/grpc/types.go b/audit/grpc/types.go deleted file mode 100644 index 59bb184..0000000 --- a/audit/grpc/types.go +++ /dev/null @@ -1,75 +0,0 @@ -package audit - -import ( - refs "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc" -) - -// SetVersion is a Version field setter. -func (x *DataAuditResult) SetVersion(v *refs.Version) { - x.Version = v -} - -// SetAuditEpoch is an AuditEpoch field setter. -func (x *DataAuditResult) SetAuditEpoch(v uint64) { - x.AuditEpoch = v -} - -// SetContainerId is a ContainerId field setter. -func (x *DataAuditResult) SetContainerId(v *refs.ContainerID) { - x.ContainerId = v -} - -// SetPublicKey is a PublicKey field setter. -func (x *DataAuditResult) SetPublicKey(v []byte) { - x.PublicKey = v -} - -// SetComplete is a Complete field setter. -func (x *DataAuditResult) SetComplete(v bool) { - x.Complete = v -} - -// SetRequests is a Requests field setter. -func (x *DataAuditResult) SetRequests(v uint32) { - x.Requests = v -} - -// SetRetries is a Retries field setter. -func (x *DataAuditResult) SetRetries(v uint32) { - x.Retries = v -} - -// SetPassSg is a PassSg field setter. -func (x *DataAuditResult) SetPassSg(v []*refs.ObjectID) { - x.PassSg = v -} - -// SetFailSg is a FailSg field setter. -func (x *DataAuditResult) SetFailSg(v []*refs.ObjectID) { - x.FailSg = v -} - -// SetHit is a Hit field setter. -func (x *DataAuditResult) SetHit(v uint32) { - x.Hit = v -} - -// SetMiss is a Miss field setter. -func (x *DataAuditResult) SetMiss(v uint32) { - x.Miss = v -} - -// SetFail is a Fail field setter. -func (x *DataAuditResult) SetFail(v uint32) { - x.Fail = v -} - -// SetPassNodes is a PassNodes field setter. -func (x *DataAuditResult) SetPassNodes(v [][]byte) { - x.PassNodes = v -} - -// SetFailNodes is a FailNodes field setter. -func (x *DataAuditResult) SetFailNodes(v [][]byte) { - x.FailNodes = v -} diff --git a/audit/grpc/types.pb.go b/audit/grpc/types.pb.go deleted file mode 100644 index 57243ef..0000000 --- a/audit/grpc/types.pb.go +++ /dev/null @@ -1,311 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.33.0 -// protoc v4.25.3 -// source: audit/grpc/types.proto - -package audit - -import ( - grpc "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -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) -) - -// DataAuditResult keeps record of conducted Data Audits. The detailed report is -// generated separately. -type DataAuditResult struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Data Audit Result format version. Effectively, the version of API library - // used to report DataAuditResult structure. - Version *grpc.Version `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` - // Epoch number when the Data Audit was conducted - AuditEpoch uint64 `protobuf:"fixed64,2,opt,name=audit_epoch,json=auditEpoch,proto3" json:"audit_epoch,omitempty"` - // Container under audit - ContainerId *grpc.ContainerID `protobuf:"bytes,3,opt,name=container_id,json=containerID,proto3" json:"container_id,omitempty"` - // Public key of the auditing InnerRing node in a binary format - PublicKey []byte `protobuf:"bytes,4,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"` - // Shows if Data Audit process was complete in time or if it was cancelled - Complete bool `protobuf:"varint,5,opt,name=complete,proto3" json:"complete,omitempty"` - // Number of request done at PoR stage - Requests uint32 `protobuf:"varint,6,opt,name=requests,proto3" json:"requests,omitempty"` - // Number of retries done at PoR stage - Retries uint32 `protobuf:"varint,7,opt,name=retries,proto3" json:"retries,omitempty"` - // List of Storage Groups that passed audit PoR stage - PassSg []*grpc.ObjectID `protobuf:"bytes,8,rep,name=pass_sg,json=passSG,proto3" json:"pass_sg,omitempty"` - // List of Storage Groups that failed audit PoR stage - FailSg []*grpc.ObjectID `protobuf:"bytes,9,rep,name=fail_sg,json=failSG,proto3" json:"fail_sg,omitempty"` - // Number of sampled objects under the audit placed in an optimal way - // according to the containers placement policy when checking PoP - Hit uint32 `protobuf:"varint,10,opt,name=hit,proto3" json:"hit,omitempty"` - // Number of sampled objects under the audit placed in suboptimal way - // according to the containers placement policy, but still at a satisfactory - // level when checking PoP - Miss uint32 `protobuf:"varint,11,opt,name=miss,proto3" json:"miss,omitempty"` - // Number of sampled objects under the audit stored inconsistently with the - // placement policy or not found at all when checking PoP - Fail uint32 `protobuf:"varint,12,opt,name=fail,proto3" json:"fail,omitempty"` - // List of storage node public keys that passed at least one PDP - PassNodes [][]byte `protobuf:"bytes,13,rep,name=pass_nodes,json=passNodes,proto3" json:"pass_nodes,omitempty"` - // List of storage node public keys that failed at least one PDP - FailNodes [][]byte `protobuf:"bytes,14,rep,name=fail_nodes,json=failNodes,proto3" json:"fail_nodes,omitempty"` -} - -func (x *DataAuditResult) Reset() { - *x = DataAuditResult{} - if protoimpl.UnsafeEnabled { - mi := &file_audit_grpc_types_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *DataAuditResult) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DataAuditResult) ProtoMessage() {} - -func (x *DataAuditResult) ProtoReflect() protoreflect.Message { - mi := &file_audit_grpc_types_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use DataAuditResult.ProtoReflect.Descriptor instead. -func (*DataAuditResult) Descriptor() ([]byte, []int) { - return file_audit_grpc_types_proto_rawDescGZIP(), []int{0} -} - -func (x *DataAuditResult) GetVersion() *grpc.Version { - if x != nil { - return x.Version - } - return nil -} - -func (x *DataAuditResult) GetAuditEpoch() uint64 { - if x != nil { - return x.AuditEpoch - } - return 0 -} - -func (x *DataAuditResult) GetContainerId() *grpc.ContainerID { - if x != nil { - return x.ContainerId - } - return nil -} - -func (x *DataAuditResult) GetPublicKey() []byte { - if x != nil { - return x.PublicKey - } - return nil -} - -func (x *DataAuditResult) GetComplete() bool { - if x != nil { - return x.Complete - } - return false -} - -func (x *DataAuditResult) GetRequests() uint32 { - if x != nil { - return x.Requests - } - return 0 -} - -func (x *DataAuditResult) GetRetries() uint32 { - if x != nil { - return x.Retries - } - return 0 -} - -func (x *DataAuditResult) GetPassSg() []*grpc.ObjectID { - if x != nil { - return x.PassSg - } - return nil -} - -func (x *DataAuditResult) GetFailSg() []*grpc.ObjectID { - if x != nil { - return x.FailSg - } - return nil -} - -func (x *DataAuditResult) GetHit() uint32 { - if x != nil { - return x.Hit - } - return 0 -} - -func (x *DataAuditResult) GetMiss() uint32 { - if x != nil { - return x.Miss - } - return 0 -} - -func (x *DataAuditResult) GetFail() uint32 { - if x != nil { - return x.Fail - } - return 0 -} - -func (x *DataAuditResult) GetPassNodes() [][]byte { - if x != nil { - return x.PassNodes - } - return nil -} - -func (x *DataAuditResult) GetFailNodes() [][]byte { - if x != nil { - return x.FailNodes - } - return nil -} - -var File_audit_grpc_types_proto protoreflect.FileDescriptor - -var file_audit_grpc_types_proto_rawDesc = []byte{ - 0x0a, 0x16, 0x61, 0x75, 0x64, 0x69, 0x74, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, - 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0f, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, - 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x75, 0x64, 0x69, 0x74, 0x1a, 0x15, 0x72, 0x65, 0x66, 0x73, 0x2f, - 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x22, 0xf4, 0x03, 0x0a, 0x0f, 0x44, 0x61, 0x74, 0x61, 0x41, 0x75, 0x64, 0x69, 0x74, 0x52, 0x65, - 0x73, 0x75, 0x6c, 0x74, 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, 0x1f, 0x0a, 0x0b, 0x61, 0x75, 0x64, 0x69, 0x74, - 0x5f, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x06, 0x52, 0x0a, 0x61, 0x75, - 0x64, 0x69, 0x74, 0x45, 0x70, 0x6f, 0x63, 0x68, 0x12, 0x3e, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, - 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, - 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, - 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x52, 0x0b, 0x63, 0x6f, 0x6e, - 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x75, 0x62, 0x6c, - 0x69, 0x63, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x70, 0x75, - 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x6f, 0x6d, 0x70, 0x6c, - 0x65, 0x74, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x63, 0x6f, 0x6d, 0x70, 0x6c, - 0x65, 0x74, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x73, 0x18, - 0x06, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x73, 0x12, - 0x18, 0x0a, 0x07, 0x72, 0x65, 0x74, 0x72, 0x69, 0x65, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0d, - 0x52, 0x07, 0x72, 0x65, 0x74, 0x72, 0x69, 0x65, 0x73, 0x12, 0x31, 0x0a, 0x07, 0x70, 0x61, 0x73, - 0x73, 0x5f, 0x73, 0x67, 0x18, 0x08, 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, 0x06, 0x70, 0x61, 0x73, 0x73, 0x53, 0x47, 0x12, 0x31, 0x0a, 0x07, - 0x66, 0x61, 0x69, 0x6c, 0x5f, 0x73, 0x67, 0x18, 0x09, 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, 0x06, 0x66, 0x61, 0x69, 0x6c, 0x53, 0x47, 0x12, - 0x10, 0x0a, 0x03, 0x68, 0x69, 0x74, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x03, 0x68, 0x69, - 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6d, 0x69, 0x73, 0x73, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0d, 0x52, - 0x04, 0x6d, 0x69, 0x73, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x66, 0x61, 0x69, 0x6c, 0x18, 0x0c, 0x20, - 0x01, 0x28, 0x0d, 0x52, 0x04, 0x66, 0x61, 0x69, 0x6c, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x61, 0x73, - 0x73, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x0d, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x09, 0x70, - 0x61, 0x73, 0x73, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x66, 0x61, 0x69, 0x6c, - 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x0e, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x09, 0x66, 0x61, - 0x69, 0x6c, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x42, 0x5e, 0x5a, 0x40, 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, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x61, 0x75, 0x64, 0x69, 0x74, - 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x61, 0x75, 0x64, 0x69, 0x74, 0xaa, 0x02, 0x19, 0x4e, 0x65, - 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, - 0x49, 0x2e, 0x41, 0x75, 0x64, 0x69, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_audit_grpc_types_proto_rawDescOnce sync.Once - file_audit_grpc_types_proto_rawDescData = file_audit_grpc_types_proto_rawDesc -) - -func file_audit_grpc_types_proto_rawDescGZIP() []byte { - file_audit_grpc_types_proto_rawDescOnce.Do(func() { - file_audit_grpc_types_proto_rawDescData = protoimpl.X.CompressGZIP(file_audit_grpc_types_proto_rawDescData) - }) - return file_audit_grpc_types_proto_rawDescData -} - -var file_audit_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_audit_grpc_types_proto_goTypes = []interface{}{ - (*DataAuditResult)(nil), // 0: neo.fs.v2.audit.DataAuditResult - (*grpc.Version)(nil), // 1: neo.fs.v2.refs.Version - (*grpc.ContainerID)(nil), // 2: neo.fs.v2.refs.ContainerID - (*grpc.ObjectID)(nil), // 3: neo.fs.v2.refs.ObjectID -} -var file_audit_grpc_types_proto_depIdxs = []int32{ - 1, // 0: neo.fs.v2.audit.DataAuditResult.version:type_name -> neo.fs.v2.refs.Version - 2, // 1: neo.fs.v2.audit.DataAuditResult.container_id:type_name -> neo.fs.v2.refs.ContainerID - 3, // 2: neo.fs.v2.audit.DataAuditResult.pass_sg:type_name -> neo.fs.v2.refs.ObjectID - 3, // 3: neo.fs.v2.audit.DataAuditResult.fail_sg:type_name -> neo.fs.v2.refs.ObjectID - 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_audit_grpc_types_proto_init() } -func file_audit_grpc_types_proto_init() { - if File_audit_grpc_types_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_audit_grpc_types_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DataAuditResult); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_audit_grpc_types_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_audit_grpc_types_proto_goTypes, - DependencyIndexes: file_audit_grpc_types_proto_depIdxs, - MessageInfos: file_audit_grpc_types_proto_msgTypes, - }.Build() - File_audit_grpc_types_proto = out.File - file_audit_grpc_types_proto_rawDesc = nil - file_audit_grpc_types_proto_goTypes = nil - file_audit_grpc_types_proto_depIdxs = nil -} diff --git a/audit/json.go b/audit/json.go deleted file mode 100644 index cbcf41f..0000000 --- a/audit/json.go +++ /dev/null @@ -1,14 +0,0 @@ -package audit - -import ( - audit "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/audit/grpc" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message" -) - -func (a *DataAuditResult) MarshalJSON() ([]byte, error) { - return message.MarshalJSON(a) -} - -func (a *DataAuditResult) UnmarshalJSON(data []byte) error { - return message.UnmarshalJSON(a, data, new(audit.DataAuditResult)) -} diff --git a/audit/marshal.go b/audit/marshal.go deleted file mode 100644 index a039baf..0000000 --- a/audit/marshal.go +++ /dev/null @@ -1,88 +0,0 @@ -package audit - -import ( - audit "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/audit/grpc" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/proto" -) - -const ( - _ = iota - versionFNum - auditEpochFNum - cidFNum - pubKeyFNum - completeFNum - requestsFNum - retriesFNum - passSGFNum - failSGFNum - hitFNum - missFNum - failFNum - passNodesFNum - failNodesFNum -) - -// StableMarshal marshals unified DataAuditResult structure into a protobuf -// binary format without field order shuffle. -func (a *DataAuditResult) StableMarshal(buf []byte) []byte { - if a == nil { - return []byte{} - } - - if buf == nil { - buf = make([]byte, a.StableSize()) - } - - var offset int - - offset += proto.NestedStructureMarshal(versionFNum, buf[offset:], a.version) - offset += proto.Fixed64Marshal(auditEpochFNum, buf[offset:], a.auditEpoch) - offset += proto.NestedStructureMarshal(cidFNum, buf[offset:], a.cid) - offset += proto.BytesMarshal(pubKeyFNum, buf[offset:], a.pubKey) - offset += proto.BoolMarshal(completeFNum, buf[offset:], a.complete) - offset += proto.UInt32Marshal(requestsFNum, buf[offset:], a.requests) - offset += proto.UInt32Marshal(retriesFNum, buf[offset:], a.retries) - offset += refs.ObjectIDNestedListMarshal(passSGFNum, buf[offset:], a.passSG) - offset += refs.ObjectIDNestedListMarshal(failSGFNum, buf[offset:], a.failSG) - offset += proto.UInt32Marshal(hitFNum, buf[offset:], a.hit) - offset += proto.UInt32Marshal(missFNum, buf[offset:], a.miss) - offset += proto.UInt32Marshal(failFNum, buf[offset:], a.fail) - offset += proto.RepeatedBytesMarshal(passNodesFNum, buf[offset:], a.passNodes) - proto.RepeatedBytesMarshal(failNodesFNum, buf[offset:], a.failNodes) - - return buf -} - -// StableSize returns byte length of DataAuditResult structure -// marshaled by StableMarshal function. -func (a *DataAuditResult) StableSize() (size int) { - if a == nil { - return 0 - } - - size += proto.NestedStructureSize(versionFNum, a.version) - size += proto.Fixed64Size(auditEpochFNum, a.auditEpoch) - size += proto.NestedStructureSize(cidFNum, a.cid) - size += proto.BytesSize(pubKeyFNum, a.pubKey) - size += proto.BoolSize(completeFNum, a.complete) - size += proto.UInt32Size(requestsFNum, a.requests) - size += proto.UInt32Size(retriesFNum, a.retries) - size += refs.ObjectIDNestedListSize(passSGFNum, a.passSG) - size += refs.ObjectIDNestedListSize(failSGFNum, a.failSG) - size += proto.UInt32Size(hitFNum, a.hit) - size += proto.UInt32Size(missFNum, a.miss) - size += proto.UInt32Size(failFNum, a.fail) - size += proto.RepeatedBytesSize(passNodesFNum, a.passNodes) - size += proto.RepeatedBytesSize(failNodesFNum, a.failNodes) - - return size -} - -// Unmarshal unmarshals DataAuditResult structure from its protobuf -// binary representation. -func (a *DataAuditResult) Unmarshal(data []byte) error { - return message.Unmarshal(a, data, new(audit.DataAuditResult)) -} diff --git a/audit/message_test.go b/audit/message_test.go deleted file mode 100644 index 02c7f78..0000000 --- a/audit/message_test.go +++ /dev/null @@ -1,15 +0,0 @@ -package audit_test - -import ( - "testing" - - audittest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/audit/test" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message" - messagetest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message/test" -) - -func TestMessageConvert(t *testing.T) { - messagetest.TestRPCMessage(t, - func(empty bool) message.Message { return audittest.GenerateDataAuditResult(empty) }, - ) -} diff --git a/audit/test/generate.go b/audit/test/generate.go deleted file mode 100644 index 093cbfe..0000000 --- a/audit/test/generate.go +++ /dev/null @@ -1,29 +0,0 @@ -package audittest - -import ( - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/audit" - refstest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/test" -) - -func GenerateDataAuditResult(empty bool) *audit.DataAuditResult { - m := new(audit.DataAuditResult) - - if !empty { - m.SetPublicKey([]byte{1, 2, 3}) - m.SetAuditEpoch(13) - m.SetHit(100) - m.SetMiss(200) - m.SetFail(300) - m.SetComplete(true) - m.SetPassNodes([][]byte{{1}, {2}}) - m.SetFailNodes([][]byte{{3}, {4}}) - m.SetRequests(666) - m.SetRetries(777) - m.SetVersion(refstest.GenerateVersion(false)) - m.SetContainerID(refstest.GenerateContainerID(false)) - m.SetPassSG(refstest.GenerateObjectIDs(false)) - m.SetFailSG(refstest.GenerateObjectIDs(false)) - } - - return m -} diff --git a/audit/types.go b/audit/types.go deleted file mode 100644 index 6f856f0..0000000 --- a/audit/types.go +++ /dev/null @@ -1,243 +0,0 @@ -package audit - -import ( - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" -) - -// DataAuditResult is a unified structure of -// DataAuditResult message from proto definition. -type DataAuditResult struct { - version *refs.Version - - auditEpoch uint64 - - requests, retries uint32 - - hit, miss, fail uint32 - - cid *refs.ContainerID - - pubKey []byte - - passSG, failSG []refs.ObjectID - - failNodes, passNodes [][]byte - - complete bool -} - -// GetVersion returns version of Data Audit structure. -func (a *DataAuditResult) GetVersion() *refs.Version { - if a != nil { - return a.version - } - - return nil -} - -// SetVersion sets version of Data Audit structure. -func (a *DataAuditResult) SetVersion(v *refs.Version) { - a.version = v -} - -// GetAuditEpoch returns epoch number when the Data Audit was conducted. -func (a *DataAuditResult) GetAuditEpoch() uint64 { - if a != nil { - return a.auditEpoch - } - - return 0 -} - -// SetAuditEpoch sets epoch number when the Data Audit was conducted. -func (a *DataAuditResult) SetAuditEpoch(v uint64) { - a.auditEpoch = v -} - -// GetContainerID returns container under audit. -func (a *DataAuditResult) GetContainerID() *refs.ContainerID { - if a != nil { - return a.cid - } - - return nil -} - -// SetContainerID sets container under audit. -func (a *DataAuditResult) SetContainerID(v *refs.ContainerID) { - a.cid = v -} - -// GetPublicKey returns public key of the auditing InnerRing node in a binary format. -func (a *DataAuditResult) GetPublicKey() []byte { - if a != nil { - return a.pubKey - } - - return nil -} - -// SetPublicKey sets public key of the auditing InnerRing node in a binary format. -func (a *DataAuditResult) SetPublicKey(v []byte) { - a.pubKey = v -} - -// GetPassSG returns list of Storage Groups that passed audit PoR stage. -func (a *DataAuditResult) GetPassSG() []refs.ObjectID { - if a != nil { - return a.passSG - } - - return nil -} - -// SetPassSG sets list of Storage Groups that passed audit PoR stage. -func (a *DataAuditResult) SetPassSG(v []refs.ObjectID) { - a.passSG = v -} - -// GetFailSG returns list of Storage Groups that failed audit PoR stage. -func (a *DataAuditResult) GetFailSG() []refs.ObjectID { - if a != nil { - return a.failSG - } - - return nil -} - -// SetFailSG sets list of Storage Groups that failed audit PoR stage. -func (a *DataAuditResult) SetFailSG(v []refs.ObjectID) { - a.failSG = v -} - -// GetRequests returns number of requests made by PoR audit check to get -// all headers of the objects inside storage groups. -func (a *DataAuditResult) GetRequests() uint32 { - if a != nil { - return a.requests - } - - return 0 -} - -// SetRequests sets number of requests made by PoR audit check to get -// all headers of the objects inside storage groups. -func (a *DataAuditResult) SetRequests(v uint32) { - a.requests = v -} - -// GetRetries returns number of retries made by PoR audit check to get -// all headers of the objects inside storage groups. -func (a *DataAuditResult) GetRetries() uint32 { - if a != nil { - return a.retries - } - - return 0 -} - -// SetRetries sets number of retries made by PoR audit check to get -// all headers of the objects inside storage groups. -func (a *DataAuditResult) SetRetries(v uint32) { - a.retries = v -} - -// GetHit returns number of sampled objects under audit placed -// in an optimal way according to the containers placement policy -// when checking PoP. -func (a *DataAuditResult) GetHit() uint32 { - if a != nil { - return a.hit - } - - return 0 -} - -// SetHit sets number of sampled objects under audit placed -// in an optimal way according to the containers placement policy -// when checking PoP. -func (a *DataAuditResult) SetHit(v uint32) { - a.hit = v -} - -// GetMiss returns number of sampled objects under audit placed -// in suboptimal way according to the containers placement policy, -// but still at a satisfactory level when checking PoP. -func (a *DataAuditResult) GetMiss() uint32 { - if a != nil { - return a.miss - } - - return 0 -} - -// SetMiss sets number of sampled objects under audit placed -// in suboptimal way according to the containers placement policy, -// but still at a satisfactory level when checking PoP. -func (a *DataAuditResult) SetMiss(v uint32) { - a.miss = v -} - -// GetFail returns number of sampled objects under audit stored -// in a way not confirming placement policy or not found at all -// when checking PoP. -func (a *DataAuditResult) GetFail() uint32 { - if a != nil { - return a.fail - } - - return 0 -} - -// SetFail sets number of sampled objects under audit stored -// in a way not confirming placement policy or not found at all -// when checking PoP. -func (a *DataAuditResult) SetFail(v uint32) { - a.fail = v -} - -// GetPassNodes returns list of storage node public keys that -// passed at least one PDP. -func (a *DataAuditResult) GetPassNodes() [][]byte { - if a != nil { - return a.passNodes - } - - return nil -} - -// SetPassNodes sets list of storage node public keys that -// passed at least one PDP. -func (a *DataAuditResult) SetPassNodes(v [][]byte) { - a.passNodes = v -} - -// GetFailNodes returns list of storage node public keys that -// failed at least one PDP. -func (a *DataAuditResult) GetFailNodes() [][]byte { - if a != nil { - return a.failNodes - } - - return nil -} - -// SetFailNodes sets list of storage node public keys that -// failed at least one PDP. -func (a *DataAuditResult) SetFailNodes(v [][]byte) { - a.failNodes = v -} - -// GetComplete returns boolean completion statement of audit result. -func (a *DataAuditResult) GetComplete() bool { - if a != nil { - return a.complete - } - - return false // bool default -} - -// SetComplete sets boolean completion statement of audit result. -func (a *DataAuditResult) SetComplete(v bool) { - a.complete = v -} From 0fe6b9adbb721353b27148853a48bce476d2b8cb Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Fri, 26 Apr 2024 11:54:35 +0300 Subject: [PATCH 1122/1196] [#76] Make setter names more consistent This will make the transition to a new codegen more seamless. 1. Setter should be named as the field itself. 2. Setter should accept 1 parameter. Signed-off-by: Evgenii Stratonikov --- acl/convert.go | 4 ++-- acl/grpc/types.go | 8 ++++---- apemanager/convert.go | 4 ++-- apemanager/grpc/service.go | 4 ++-- object/convert.go | 6 +++--- object/grpc/service.go | 12 ++++++------ refs/convert.go | 2 +- refs/grpc/types.go | 4 ++-- session/convert.go | 11 +++++++---- session/grpc/types.go | 17 +++++++---------- 10 files changed, 36 insertions(+), 36 deletions(-) diff --git a/acl/convert.go b/acl/convert.go index 3020f4d..342c110 100644 --- a/acl/convert.go +++ b/acl/convert.go @@ -164,7 +164,7 @@ func (f *HeaderFilter) ToGRPCMessage() grpc.Message { m.SetKey(f.key) m.SetValue(f.value) - m.SetHeader(HeaderTypeToGRPCField(f.hdrType)) + m.SetHeaderType(HeaderTypeToGRPCField(f.hdrType)) m.SetMatchType(MatchTypeToGRPCField(f.matchType)) } @@ -427,7 +427,7 @@ func (bt *BearerTokenBody) ToGRPCMessage() grpc.Message { m.SetOwnerId(bt.ownerID.ToGRPCMessage().(*refsGRPC.OwnerID)) m.SetLifetime(bt.lifetime.ToGRPCMessage().(*acl.BearerToken_Body_TokenLifetime)) m.SetEaclTable(bt.eacl.ToGRPCMessage().(*acl.EACLTable)) - m.SetImpersonate(bt.impersonate) + m.SetAllowImpersonate(bt.impersonate) } return m diff --git a/acl/grpc/types.go b/acl/grpc/types.go index b07f893..ce50e2f 100644 --- a/acl/grpc/types.go +++ b/acl/grpc/types.go @@ -39,8 +39,8 @@ func (m *EACLRecord) SetTargets(v []*EACLRecord_Target) { m.Targets = v } -// SetHeader sets header type of the eACL filter. -func (m *EACLRecord_Filter) SetHeader(v HeaderType) { +// SetHeaderType sets header type of the eACL filter. +func (m *EACLRecord_Filter) SetHeaderType(v HeaderType) { m.HeaderType = v } @@ -84,8 +84,8 @@ func (m *BearerToken_Body) SetLifetime(v *BearerToken_Body_TokenLifetime) { m.Lifetime = v } -// SetImpersonate allows impersonate. -func (m *BearerToken_Body) SetImpersonate(v bool) { +// SetAllowImpersonate allows impersonate. +func (m *BearerToken_Body) SetAllowImpersonate(v bool) { m.AllowImpersonate = v } diff --git a/apemanager/convert.go b/apemanager/convert.go index 12b087c..f1cbcda 100644 --- a/apemanager/convert.go +++ b/apemanager/convert.go @@ -202,7 +202,7 @@ func (respBody *AddChainResponseBody) ToGRPCMessage() grpc.Message { if respBody != nil { respBodygrpc = new(apemanager.AddChainResponse_Body) - respBodygrpc.SetChainID(respBody.GetChainID()) + respBodygrpc.SetChainId(respBody.GetChainID()) } return respBodygrpc @@ -255,7 +255,7 @@ func (reqBody *RemoveChainRequestBody) ToGRPCMessage() grpc.Message { reqBodygrpc = new(apemanager.RemoveChainRequest_Body) reqBodygrpc.SetTarget(reqBody.target.ToGRPCMessage().(*apemanager.ChainTarget)) - reqBodygrpc.SetChainID(reqBody.GetChainID()) + reqBodygrpc.SetChainId(reqBody.GetChainID()) } return reqBodygrpc diff --git a/apemanager/grpc/service.go b/apemanager/grpc/service.go index 89ffa71..c07bceb 100644 --- a/apemanager/grpc/service.go +++ b/apemanager/grpc/service.go @@ -24,7 +24,7 @@ func (r *AddChainRequest) SetVerifyHeader(vh *session_grpc.RequestVerificationHe r.VerifyHeader = vh } -func (rb *AddChainResponse_Body) SetChainID(chainID []byte) { +func (rb *AddChainResponse_Body) SetChainId(chainID []byte) { rb.ChainId = chainID } @@ -44,7 +44,7 @@ func (rb *RemoveChainRequest_Body) SetTarget(t *ChainTarget) { rb.Target = t } -func (rb *RemoveChainRequest_Body) SetChainID(chainID []byte) { +func (rb *RemoveChainRequest_Body) SetChainId(chainID []byte) { rb.ChainId = chainID } diff --git a/object/convert.go b/object/convert.go index 9b266ac..f19cc09 100644 --- a/object/convert.go +++ b/object/convert.go @@ -901,7 +901,7 @@ func (r *GetResponseBody) ToGRPCMessage() grpc.Message { case *SplitInfo: m.SetSplitInfo(t.ToGRPCMessage().(*object.SplitInfo)) case *ECInfo: - m.SetECInfo(t.ToGRPCMessage().(*object.ECInfo)) + m.SetEcInfo(t.ToGRPCMessage().(*object.ECInfo)) default: panic(fmt.Sprintf("unknown get object part %T", t)) } @@ -1486,7 +1486,7 @@ func (r *HeadResponseBody) ToGRPCMessage() grpc.Message { case *SplitInfo: m.SetSplitInfo(v.ToGRPCMessage().(*object.SplitInfo)) case *ECInfo: - m.SetECInfo(v.ToGRPCMessage().(*object.ECInfo)) + m.SetEcInfo(v.ToGRPCMessage().(*object.ECInfo)) default: panic(fmt.Sprintf("unknown head part %T", v)) } @@ -1963,7 +1963,7 @@ func (r *GetRangeResponseBody) ToGRPCMessage() grpc.Message { case *SplitInfo: m.SetSplitInfo(v.ToGRPCMessage().(*object.SplitInfo)) case *ECInfo: - m.SetECInfo(v.ToGRPCMessage().(*object.ECInfo)) + m.SetEcInfo(v.ToGRPCMessage().(*object.ECInfo)) default: panic(fmt.Sprintf("unknown get range part %T", v)) } diff --git a/object/grpc/service.go b/object/grpc/service.go index 49f160b..3ff1f3a 100644 --- a/object/grpc/service.go +++ b/object/grpc/service.go @@ -78,8 +78,8 @@ func (m *GetResponse_Body) SetSplitInfo(v *SplitInfo) { } } -// SetECInfo sets part of the object payload. -func (m *GetResponse_Body) SetECInfo(v *ECInfo) { +// SetEcInfo sets part of the object payload. +func (m *GetResponse_Body) SetEcInfo(v *ECInfo) { m.ObjectPart = &GetResponse_Body_EcInfo{ EcInfo: v, } @@ -282,8 +282,8 @@ func (m *HeadResponse_Body) SetSplitInfo(v *SplitInfo) { } } -// SetECInfo sets meta info about the erasure coded object. -func (m *HeadResponse_Body) SetECInfo(v *ECInfo) { +// SetEcInfo sets meta info about the erasure coded object. +func (m *HeadResponse_Body) SetEcInfo(v *ECInfo) { m.Head = &HeadResponse_Body_EcInfo{ EcInfo: v, } @@ -435,8 +435,8 @@ func (m *GetRangeResponse_Body) SetSplitInfo(v *SplitInfo) { } } -// SetECInfo sets meta info about the erasure-coded object. -func (m *GetRangeResponse_Body) SetECInfo(v *ECInfo) { +// SetEcInfo sets meta info about the erasure-coded object. +func (m *GetRangeResponse_Body) SetEcInfo(v *ECInfo) { m.RangePart = &GetRangeResponse_Body_EcInfo{ EcInfo: v, } diff --git a/refs/convert.go b/refs/convert.go index b2c353c..6f06783 100644 --- a/refs/convert.go +++ b/refs/convert.go @@ -196,7 +196,7 @@ func (c *Checksum) ToGRPCMessage() grpc.Message { if c != nil { m = new(refs.Checksum) - m.SetChecksumType(ChecksumTypeToGRPC(c.typ)) + m.SetType(ChecksumTypeToGRPC(c.typ)) m.SetSum(c.sum) } diff --git a/refs/grpc/types.go b/refs/grpc/types.go index 843a2ee..cdb69aa 100644 --- a/refs/grpc/types.go +++ b/refs/grpc/types.go @@ -25,8 +25,8 @@ func (x *Address) SetObjectId(v *ObjectID) { x.ObjectId = v } -// SetChecksumType in generic checksum structure. -func (x *Checksum) SetChecksumType(v ChecksumType) { +// SetType in generic checksum structure. +func (x *Checksum) SetType(v ChecksumType) { x.Type = v } diff --git a/session/convert.go b/session/convert.go index 870e208..bbfe070 100644 --- a/session/convert.go +++ b/session/convert.go @@ -383,7 +383,7 @@ func (r *RequestMetaHeader) ToGRPCMessage() grpc.Message { m.SetEpoch(r.epoch) m.SetTtl(r.ttl) m.SetOrigin(r.origin.ToGRPCMessage().(*session.RequestMetaHeader)) - m.SetNetworkMagic(r.netMagic) + m.SetMagicNumber(r.netMagic) } return m @@ -674,7 +674,10 @@ func (c *ObjectSessionContext) ToGRPCMessage() grpc.Message { m = new(session.ObjectSessionContext) m.SetVerb(ObjectSessionVerbToGRPCField(c.verb)) - m.SetTarget(c.cnr.ToGRPCMessage().(*refsGRPC.ContainerID), refs.ObjectIDListToGRPCMessage(c.objs)) + m.SetTarget(&session.ObjectSessionContext_Target{ + Container: c.cnr.ToGRPCMessage().(*refsGRPC.ContainerID), + Objects: refs.ObjectIDListToGRPCMessage(c.objs), + }) } return m @@ -724,9 +727,9 @@ func (t *TokenBody) ToGRPCMessage() grpc.Message { case nil: m.Context = nil case *ObjectSessionContext: - m.SetObjectSessionContext(typ.ToGRPCMessage().(*session.ObjectSessionContext)) + m.SetObject(typ.ToGRPCMessage().(*session.ObjectSessionContext)) case *ContainerSessionContext: - m.SetContainerSessionContext(typ.ToGRPCMessage().(*session.ContainerSessionContext)) + m.SetContainer(typ.ToGRPCMessage().(*session.ContainerSessionContext)) } m.SetOwnerId(t.ownerID.ToGRPCMessage().(*refsGRPC.OwnerID)) diff --git a/session/grpc/types.go b/session/grpc/types.go index bcc92d1..857c45e 100644 --- a/session/grpc/types.go +++ b/session/grpc/types.go @@ -52,25 +52,22 @@ func (m *SessionToken_Body) SetSessionKey(v []byte) { } // SetObjectAddressContext sets object context of the session token. -func (m *SessionToken_Body) SetObjectSessionContext(v *ObjectSessionContext) { +func (m *SessionToken_Body) SetObject(v *ObjectSessionContext) { m.Context = &SessionToken_Body_Object{ Object: v, } } -// SetContainerSessionContext sets container context of the session token. -func (m *SessionToken_Body) SetContainerSessionContext(v *ContainerSessionContext) { +// SetContainer sets container context of the session token. +func (m *SessionToken_Body) SetContainer(v *ContainerSessionContext) { m.Context = &SessionToken_Body_Container{ Container: v, } } // SetTarget specifies objects involved in the object session. -func (m *ObjectSessionContext) SetTarget(cnr *refs.ContainerID, objs []*refs.ObjectID) { - m.Target = &ObjectSessionContext_Target{ - Container: cnr, - Objects: objs, - } +func (m *ObjectSessionContext) SetTarget(tgt *ObjectSessionContext_Target) { + m.Target = tgt } // SetVerb sets type of request for which the token is issued. @@ -147,8 +144,8 @@ func (m *RequestMetaHeader) GetNetworkMagic() uint64 { return 0 } -// SetNetworkMagic sets NeoFS network magic. -func (m *RequestMetaHeader) SetNetworkMagic(v uint64) { +// SetMagicNumber sets NeoFS network magic. +func (m *RequestMetaHeader) SetMagicNumber(v uint64) { m.MagicNumber = v } From b171364079c3dc85db4a4e737232419055f20404 Mon Sep 17 00:00:00 2001 From: Airat Arifullin Date: Mon, 6 May 2024 14:28:49 +0300 Subject: [PATCH 1123/1196] [#81] rpc: Fix apemanager rpc service name * Introduce `frostfsServiceNamePrefix` for rpc interface since `apemanager` uses `frostfs` root instead `neo.fs`. Signed-off-by: Airat Arifullin --- rpc/apemanager.go | 2 +- rpc/common.go | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/rpc/apemanager.go b/rpc/apemanager.go index 3f3d6cd..2a89c85 100644 --- a/rpc/apemanager.go +++ b/rpc/apemanager.go @@ -6,7 +6,7 @@ import ( "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/common" ) -const serviceAPEManager = serviceNamePrefix + "apemanager.APEManagerService" +const serviceAPEManager = frostfsServiceNamePrefix + "apemanager.APEManagerService" const ( rpcAPEManagerAddChain = "AddChain" diff --git a/rpc/common.go b/rpc/common.go index 7d0bf56..8177694 100644 --- a/rpc/common.go +++ b/rpc/common.go @@ -1,3 +1,10 @@ package rpc -const serviceNamePrefix = "neo.fs.v2." +const ( + // serviceNamePrefix is still used in "old" services but should be + // considered as deprecated. Since new services use "frostfs" root, + // `frostfsServiceNamePrefix` must be used for their rpc interface. + serviceNamePrefix = "neo.fs.v2." + + frostfsServiceNamePrefix = "frostfs.v2." +) From bc7b49eed23af4b5147745374bc1d9c94630440e Mon Sep 17 00:00:00 2001 From: Airat Arifullin Date: Wed, 8 May 2024 15:03:29 +0300 Subject: [PATCH 1124/1196] [#82] object: Introduce new fields for EC header * Regenerate protobufs as frostfs-api introduced `parent_split_id` and `parent_split_index` fields. * Fix marshaller and converter for EC header. * Extend v2 type `ECHeader` with `ParentSplitID` and `ParentSplitIndex` fields. * Fix message_test for `Object`. Also generate EC headers and check it. Signed-off-by: Airat Arifullin --- object/convert.go | 4 ++ object/grpc/service.pb.go | 3 + object/grpc/types.pb.go | 127 +++++++++++++++++++++++--------------- object/marshal.go | 8 ++- object/message_test.go | 4 +- object/test/generate.go | 44 +++++++++---- object/types.go | 14 +++-- 7 files changed, 133 insertions(+), 71 deletions(-) diff --git a/object/convert.go b/object/convert.go index f19cc09..5b4acda 100644 --- a/object/convert.go +++ b/object/convert.go @@ -269,6 +269,8 @@ func (h *ECHeader) ToGRPCMessage() grpc.Message { m = new(object.Header_EC) m.Parent = h.Parent.ToGRPCMessage().(*refsGRPC.ObjectID) + m.ParentSplitId = h.ParentSplitID + m.ParentSplitIndex = h.ParentSplitIndex m.Index = h.Index m.Total = h.Total m.Header = h.Header @@ -300,6 +302,8 @@ func (h *ECHeader) FromGRPCMessage(m grpc.Message) error { } } + h.ParentSplitID = v.GetParentSplitId() + h.ParentSplitIndex = v.GetParentSplitIndex() h.Index = v.GetIndex() h.Total = v.GetTotal() h.Header = v.GetHeader() diff --git a/object/grpc/service.pb.go b/object/grpc/service.pb.go index 2bfb50b..75d359e 100644 --- a/object/grpc/service.pb.go +++ b/object/grpc/service.pb.go @@ -2113,6 +2113,9 @@ func (x *SearchRequest_Body) GetFilters() []*SearchRequest_Body_Filter { // object_id of parent // - $Object:split.splitID \ // 16 byte UUIDv4 used to identify the split object hierarchy parts +// - $Object:ec.parent \ +// If the object is stored according to EC policy, then ec_parent attribute +// is set to return an id list of all related EC chunks. // // There are some well-known filter aliases to match objects by certain // properties: diff --git a/object/grpc/types.pb.go b/object/grpc/types.pb.go index 8f4f383..254e76d 100644 --- a/object/grpc/types.pb.go +++ b/object/grpc/types.pb.go @@ -823,6 +823,12 @@ type Header_EC struct { HeaderLength uint32 `protobuf:"varint,4,opt,name=header_length,json=headerLength,proto3" json:"header_length,omitempty"` // Chunk of a parent header. Header []byte `protobuf:"bytes,5,opt,name=header,proto3" json:"header,omitempty"` + // As the origin object is EC-splitted its identifier is known to all + // chunks as parent. But parent itself can be a part of Split (does not relate to EC-split). + // In this case parent_split_id should be set. + ParentSplitId []byte `protobuf:"bytes,6,opt,name=parent_split_id,json=parentSplitID,proto3" json:"parent_split_id,omitempty"` + // Parent's index in Split. + ParentSplitIndex uint32 `protobuf:"varint,7,opt,name=parent_split_index,json=parentSplitIndex,proto3" json:"parent_split_index,omitempty"` } func (x *Header_EC) Reset() { @@ -892,6 +898,20 @@ func (x *Header_EC) GetHeader() []byte { return nil } +func (x *Header_EC) GetParentSplitId() []byte { + if x != nil { + return x.ParentSplitId + } + return nil +} + +func (x *Header_EC) GetParentSplitIndex() uint32 { + if x != nil { + return x.ParentSplitIndex + } + return 0 +} + type ECInfo_Chunk struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -991,7 +1011,7 @@ var file_object_grpc_types_proto_rawDesc = []byte{ 0x68, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x52, 0x0f, 0x68, 0x6f, 0x6d, 0x6f, 0x6d, 0x6f, 0x72, 0x70, 0x68, 0x69, 0x63, 0x48, 0x61, - 0x73, 0x68, 0x22, 0xca, 0x09, 0x0a, 0x06, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x31, 0x0a, + 0x73, 0x68, 0x22, 0xa0, 0x0a, 0x0a, 0x06, 0x48, 0x65, 0x61, 0x64, 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, @@ -1057,7 +1077,7 @@ var file_object_grpc_types_proto_rawDesc = []byte{ 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, 0x08, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x72, 0x65, 0x6e, 0x12, 0x19, 0x0a, 0x08, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x06, - 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x49, 0x44, 0x1a, 0x9f, 0x01, + 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x49, 0x44, 0x1a, 0xf5, 0x01, 0x0a, 0x02, 0x45, 0x43, 0x12, 0x30, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 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, 0x06, @@ -1067,56 +1087,61 @@ var file_object_grpc_types_proto_rawDesc = []byte{ 0x61, 0x6c, 0x12, 0x23, 0x0a, 0x0d, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0c, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x16, 0x0a, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, - 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x22, - 0xc4, 0x01, 0x0a, 0x06, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x35, 0x0a, 0x09, 0x6f, 0x62, - 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 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, 0x08, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x49, - 0x44, 0x12, 0x37, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, - 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, - 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x30, 0x0a, 0x06, 0x68, 0x65, - 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, - 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x48, 0x65, - 0x61, 0x64, 0x65, 0x72, 0x52, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x18, 0x0a, 0x07, - 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x70, - 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x22, 0x8b, 0x01, 0x0a, 0x09, 0x53, 0x70, 0x6c, 0x69, 0x74, - 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x19, 0x0a, 0x08, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x5f, 0x69, 0x64, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x49, 0x64, 0x12, - 0x35, 0x0a, 0x09, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x70, 0x61, 0x72, 0x74, 0x18, 0x02, 0x20, 0x01, + 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, + 0x26, 0x0a, 0x0f, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x5f, + 0x69, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0d, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, + 0x53, 0x70, 0x6c, 0x69, 0x74, 0x49, 0x44, 0x12, 0x2c, 0x0a, 0x12, 0x70, 0x61, 0x72, 0x65, 0x6e, + 0x74, 0x5f, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x07, 0x20, + 0x01, 0x28, 0x0d, 0x52, 0x10, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x53, 0x70, 0x6c, 0x69, 0x74, + 0x49, 0x6e, 0x64, 0x65, 0x78, 0x22, 0xc4, 0x01, 0x0a, 0x06, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, + 0x12, 0x35, 0x0a, 0x09, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, + 0x01, 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, 0x08, 0x6f, + 0x62, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x44, 0x12, 0x37, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, + 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, + 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, + 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, + 0x12, 0x30, 0x0a, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, + 0x65, 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x06, 0x68, 0x65, 0x61, 0x64, + 0x65, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x04, 0x20, + 0x01, 0x28, 0x0c, 0x52, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x22, 0x8b, 0x01, 0x0a, + 0x09, 0x53, 0x70, 0x6c, 0x69, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x19, 0x0a, 0x08, 0x73, 0x70, + 0x6c, 0x69, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x73, 0x70, + 0x6c, 0x69, 0x74, 0x49, 0x64, 0x12, 0x35, 0x0a, 0x09, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x70, 0x61, + 0x72, 0x74, 0x18, 0x02, 0x20, 0x01, 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, 0x08, 0x6c, 0x61, 0x73, 0x74, 0x50, 0x61, 0x72, 0x74, 0x12, 0x2c, 0x0a, 0x04, + 0x6c, 0x69, 0x6e, 0x6b, 0x18, 0x03, 0x20, 0x01, 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, 0x04, 0x6c, 0x69, 0x6e, 0x6b, 0x22, 0x9f, 0x01, 0x0a, 0x06, 0x45, + 0x43, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x36, 0x0a, 0x06, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x73, 0x18, + 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x45, 0x43, 0x49, 0x6e, 0x66, 0x6f, 0x2e, + 0x43, 0x68, 0x75, 0x6e, 0x6b, 0x52, 0x06, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x73, 0x1a, 0x5d, 0x0a, + 0x05, 0x43, 0x68, 0x75, 0x6e, 0x6b, 0x12, 0x28, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 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, 0x08, 0x6c, 0x61, - 0x73, 0x74, 0x50, 0x61, 0x72, 0x74, 0x12, 0x2c, 0x0a, 0x04, 0x6c, 0x69, 0x6e, 0x6b, 0x18, 0x03, - 0x20, 0x01, 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, 0x04, - 0x6c, 0x69, 0x6e, 0x6b, 0x22, 0x9f, 0x01, 0x0a, 0x06, 0x45, 0x43, 0x49, 0x6e, 0x66, 0x6f, 0x12, - 0x36, 0x0a, 0x06, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x1e, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, - 0x63, 0x74, 0x2e, 0x45, 0x43, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x43, 0x68, 0x75, 0x6e, 0x6b, 0x52, - 0x06, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x73, 0x1a, 0x5d, 0x0a, 0x05, 0x43, 0x68, 0x75, 0x6e, 0x6b, - 0x12, 0x28, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 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, 0x02, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x6e, - 0x64, 0x65, 0x78, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, - 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, - 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x2a, 0x32, 0x0a, 0x0a, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, - 0x54, 0x79, 0x70, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x52, 0x45, 0x47, 0x55, 0x4c, 0x41, 0x52, 0x10, - 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x54, 0x4f, 0x4d, 0x42, 0x53, 0x54, 0x4f, 0x4e, 0x45, 0x10, 0x01, - 0x12, 0x08, 0x0a, 0x04, 0x4c, 0x4f, 0x43, 0x4b, 0x10, 0x03, 0x2a, 0x73, 0x0a, 0x09, 0x4d, 0x61, - 0x74, 0x63, 0x68, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1a, 0x0a, 0x16, 0x4d, 0x41, 0x54, 0x43, 0x48, - 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, - 0x44, 0x10, 0x00, 0x12, 0x10, 0x0a, 0x0c, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x5f, 0x45, 0x51, - 0x55, 0x41, 0x4c, 0x10, 0x01, 0x12, 0x14, 0x0a, 0x10, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x5f, - 0x4e, 0x4f, 0x54, 0x5f, 0x45, 0x51, 0x55, 0x41, 0x4c, 0x10, 0x02, 0x12, 0x0f, 0x0a, 0x0b, 0x4e, - 0x4f, 0x54, 0x5f, 0x50, 0x52, 0x45, 0x53, 0x45, 0x4e, 0x54, 0x10, 0x03, 0x12, 0x11, 0x0a, 0x0d, - 0x43, 0x4f, 0x4d, 0x4d, 0x4f, 0x4e, 0x5f, 0x50, 0x52, 0x45, 0x46, 0x49, 0x58, 0x10, 0x04, 0x42, - 0x61, 0x5a, 0x42, 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, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, - 0x76, 0x32, 0x2f, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x6f, - 0x62, 0x6a, 0x65, 0x63, 0x74, 0xaa, 0x02, 0x1a, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, - 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x4f, 0x62, 0x6a, 0x65, - 0x63, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x65, 0x66, 0x73, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x44, 0x52, 0x02, 0x69, 0x64, + 0x12, 0x14, 0x0a, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, + 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x2a, 0x32, 0x0a, 0x0a, + 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x52, 0x45, + 0x47, 0x55, 0x4c, 0x41, 0x52, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x54, 0x4f, 0x4d, 0x42, 0x53, + 0x54, 0x4f, 0x4e, 0x45, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x4c, 0x4f, 0x43, 0x4b, 0x10, 0x03, + 0x2a, 0x73, 0x0a, 0x09, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1a, 0x0a, + 0x16, 0x4d, 0x41, 0x54, 0x43, 0x48, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, + 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x10, 0x0a, 0x0c, 0x53, 0x54, 0x52, + 0x49, 0x4e, 0x47, 0x5f, 0x45, 0x51, 0x55, 0x41, 0x4c, 0x10, 0x01, 0x12, 0x14, 0x0a, 0x10, 0x53, + 0x54, 0x52, 0x49, 0x4e, 0x47, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x45, 0x51, 0x55, 0x41, 0x4c, 0x10, + 0x02, 0x12, 0x0f, 0x0a, 0x0b, 0x4e, 0x4f, 0x54, 0x5f, 0x50, 0x52, 0x45, 0x53, 0x45, 0x4e, 0x54, + 0x10, 0x03, 0x12, 0x11, 0x0a, 0x0d, 0x43, 0x4f, 0x4d, 0x4d, 0x4f, 0x4e, 0x5f, 0x50, 0x52, 0x45, + 0x46, 0x49, 0x58, 0x10, 0x04, 0x42, 0x61, 0x5a, 0x42, 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, 0x61, + 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2f, + 0x67, 0x72, 0x70, 0x63, 0x3b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0xaa, 0x02, 0x1a, 0x4e, 0x65, + 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, + 0x49, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/object/marshal.go b/object/marshal.go index a8d399c..fa2de95 100644 --- a/object/marshal.go +++ b/object/marshal.go @@ -31,6 +31,8 @@ const ( ecHdrTotalField = 3 ecHdrHeaderLengthField = 4 ecHdrHeaderField = 5 + ecHdrParentSplitID = 6 + ecHdrParentSplitIndex = 7 hdrVersionField = 1 hdrContainerIDField = 2 @@ -260,7 +262,9 @@ func (h *ECHeader) StableMarshal(buf []byte) []byte { offset += proto.UInt32Marshal(ecHdrIndexField, buf[offset:], h.Index) offset += proto.UInt32Marshal(ecHdrTotalField, buf[offset:], h.Total) offset += proto.UInt32Marshal(ecHdrHeaderLengthField, buf[offset:], h.HeaderLength) - proto.BytesMarshal(ecHdrHeaderField, buf[offset:], h.Header) + offset += proto.BytesMarshal(ecHdrHeaderField, buf[offset:], h.Header) + offset += proto.BytesMarshal(ecHdrParentSplitID, buf[offset:], h.ParentSplitID) + proto.UInt32Marshal(ecHdrParentSplitIndex, buf[offset:], h.ParentSplitIndex) return buf } @@ -274,6 +278,8 @@ func (h *ECHeader) StableSize() (size int) { size += proto.UInt32Size(ecHdrTotalField, h.Total) size += proto.UInt32Size(ecHdrHeaderLengthField, h.HeaderLength) size += proto.BytesSize(ecHdrHeaderField, h.Header) + size += proto.BytesSize(ecHdrParentSplitID, h.ParentSplitID) + size += proto.UInt32Size(ecHdrParentSplitIndex, h.ParentSplitIndex) return size } diff --git a/object/message_test.go b/object/message_test.go index e675f49..749c373 100644 --- a/object/message_test.go +++ b/object/message_test.go @@ -13,7 +13,9 @@ func TestMessageConvert(t *testing.T) { func(empty bool) message.Message { return objecttest.GenerateShortHeader(empty) }, func(empty bool) message.Message { return objecttest.GenerateAttribute(empty) }, func(empty bool) message.Message { return objecttest.GenerateSplitHeader(empty) }, - func(empty bool) message.Message { return objecttest.GenerateHeader(empty) }, + func(empty bool) message.Message { return objecttest.GenerateHeaderWithSplitHeader(empty) }, + func(empty bool) message.Message { return objecttest.GenerateHeaderWithECHeader(empty) }, + func(empty bool) message.Message { return objecttest.GenerateECHeader(empty) }, func(empty bool) message.Message { return objecttest.GenerateObject(empty) }, func(empty bool) message.Message { return objecttest.GenerateSplitInfo(empty) }, func(empty bool) message.Message { return objecttest.GenerateECInfo(empty) }, diff --git a/object/test/generate.go b/object/test/generate.go index b107023..bb774cc 100644 --- a/object/test/generate.go +++ b/object/test/generate.go @@ -68,17 +68,41 @@ func generateSplitHeader(empty, withPar bool) *object.SplitHeader { m.SetParentSignature(refstest.GenerateSignature(empty)) if withPar { - m.SetParentHeader(generateHeader(empty, false)) + m.SetParentHeader(GenerateHeaderWithSplitHeader(empty)) } return m } -func GenerateHeader(empty bool) *object.Header { - return generateHeader(empty, true) +func GenerateHeaderWithSplitHeader(empty bool) *object.Header { + m := generateHeader(empty) + m.SetSplit(generateSplitHeader(empty, false)) + return m } -func generateHeader(empty, withSplit bool) *object.Header { +func GenerateHeaderWithECHeader(empty bool) *object.Header { + m := generateHeader(empty) + m.SetEC(GenerateECHeader(empty)) + return m +} + +func GenerateECHeader(empty bool) *object.ECHeader { + ech := new(object.ECHeader) + + if !empty { + ech.Parent = refstest.GenerateObjectID(empty) + ech.ParentSplitID = []byte{1, 2, 3} + ech.ParentSplitIndex = 1 + ech.Index = 0 + ech.Total = 2 + ech.Header = []byte("chunk of ec-encoded parent header") + ech.HeaderLength = uint32(2 * len(ech.Header)) + } + + return ech +} + +func generateHeader(empty bool) *object.Header { m := new(object.Header) if !empty { @@ -95,10 +119,6 @@ func generateHeader(empty, withSplit bool) *object.Header { m.SetHomomorphicHash(refstest.GenerateChecksum(empty)) m.SetSessionToken(sessiontest.GenerateSessionToken(empty)) - if withSplit { - m.SetSplit(generateSplitHeader(empty, false)) - } - return m } @@ -106,7 +126,7 @@ func GenerateHeaderWithSignature(empty bool) *object.HeaderWithSignature { m := new(object.HeaderWithSignature) m.SetSignature(refstest.GenerateSignature(empty)) - m.SetHeader(GenerateHeader(empty)) + m.SetHeader(GenerateHeaderWithSplitHeader(empty)) return m } @@ -120,7 +140,7 @@ func GenerateObject(empty bool) *object.Object { } m.SetSignature(refstest.GenerateSignature(empty)) - m.SetHeader(GenerateHeader(empty)) + m.SetHeader(GenerateHeaderWithSplitHeader(empty)) return m } @@ -194,7 +214,7 @@ func GenerateGetObjectPartInit(empty bool) *object.GetObjectPartInit { } m.SetSignature(refstest.GenerateSignature(empty)) - m.SetHeader(GenerateHeader(empty)) + m.SetHeader(GenerateHeaderWithSplitHeader(empty)) return m } @@ -248,7 +268,7 @@ func GeneratePutObjectPartInit(empty bool) *object.PutObjectPartInit { } m.SetSignature(refstest.GenerateSignature(empty)) - m.SetHeader(GenerateHeader(empty)) + m.SetHeader(GenerateHeaderWithSplitHeader(empty)) return m } diff --git a/object/types.go b/object/types.go index 4588f13..78c8d43 100644 --- a/object/types.go +++ b/object/types.go @@ -40,12 +40,14 @@ type SplitHeader struct { } type ECHeader struct { - Parent *refs.ObjectID - Index uint32 - Total uint32 - Header []byte - HeaderLength uint32 - Signature []byte + Parent *refs.ObjectID + ParentSplitID []byte + ParentSplitIndex uint32 + Index uint32 + Total uint32 + Header []byte + HeaderLength uint32 + Signature []byte } type Header struct { From 063ce11c243636d1a8a5d8803c3dd7e9568ce3d7 Mon Sep 17 00:00:00 2001 From: Airat Arifullin Date: Wed, 8 May 2024 15:07:13 +0300 Subject: [PATCH 1125/1196] [#82] object: Erase field `Signature` from `ECHeader` v2 type * The field `Signature` is not used and should be factored out. Signed-off-by: Airat Arifullin --- object/types.go | 1 - 1 file changed, 1 deletion(-) diff --git a/object/types.go b/object/types.go index 78c8d43..c9a0519 100644 --- a/object/types.go +++ b/object/types.go @@ -47,7 +47,6 @@ type ECHeader struct { Total uint32 Header []byte HeaderLength uint32 - Signature []byte } type Header struct { From 4fe42ac4add113eb1c634fe7668a1f3c1a5d9137 Mon Sep 17 00:00:00 2001 From: Airat Arifullin Date: Mon, 13 May 2024 17:03:55 +0300 Subject: [PATCH 1126/1196] [#82] object: Add `FilterHeaderECParent` filter for v2 * `FilterHeaderECParent` is used by `Object.Search` Signed-off-by: Airat Arifullin --- object/filters.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/object/filters.go b/object/filters.go index 5eee13b..9fe024d 100644 --- a/object/filters.go +++ b/object/filters.go @@ -36,6 +36,9 @@ const ( // FilterHeaderSplitID is a filter key to "split.splitID" field of the object header. FilterHeaderSplitID = ReservedFilterPrefix + "split.splitID" + + // FilterHeaderECParent is a filter key to "ec.parent" field of the object header. + FilterHeaderECParent = ReservedFilterPrefix + "ec.parent" ) const ( From 0803bc6ded0097443d626c20a4d399cea7ef8868 Mon Sep 17 00:00:00 2001 From: Airat Arifullin Date: Thu, 16 May 2024 12:03:42 +0300 Subject: [PATCH 1127/1196] [#83] object: Regenerate protobufs for `ECHeader` * Fix marshalers and converters; * Fix unit-tests. Signed-off-by: Airat Arifullin --- object/convert.go | 18 +++++- object/grpc/types.pb.go | 134 +++++++++++++++++++++------------------- object/marshal.go | 18 +++--- object/test/generate.go | 2 +- object/types.go | 14 ++--- 5 files changed, 103 insertions(+), 83 deletions(-) diff --git a/object/convert.go b/object/convert.go index 5b4acda..99047dc 100644 --- a/object/convert.go +++ b/object/convert.go @@ -270,7 +270,7 @@ func (h *ECHeader) ToGRPCMessage() grpc.Message { m.Parent = h.Parent.ToGRPCMessage().(*refsGRPC.ObjectID) m.ParentSplitId = h.ParentSplitID - m.ParentSplitIndex = h.ParentSplitIndex + m.ParentSplitParentId = h.ParentSplitParentID.ToGRPCMessage().(*refsGRPC.ObjectID) m.Index = h.Index m.Total = h.Total m.Header = h.Header @@ -303,7 +303,21 @@ func (h *ECHeader) FromGRPCMessage(m grpc.Message) error { } h.ParentSplitID = v.GetParentSplitId() - h.ParentSplitIndex = v.GetParentSplitIndex() + + parSplitParentID := v.GetParentSplitParentId() + if parSplitParentID == nil { + h.ParentSplitParentID = nil + } else { + if h.ParentSplitParentID == nil { + h.ParentSplitParentID = new(refs.ObjectID) + } + + err = h.ParentSplitParentID.FromGRPCMessage(parSplitParentID) + if err != nil { + return err + } + } + h.Index = v.GetIndex() h.Total = v.GetTotal() h.Header = v.GetHeader() diff --git a/object/grpc/types.pb.go b/object/grpc/types.pb.go index 254e76d..3cb44a3 100644 --- a/object/grpc/types.pb.go +++ b/object/grpc/types.pb.go @@ -827,8 +827,10 @@ type Header_EC struct { // chunks as parent. But parent itself can be a part of Split (does not relate to EC-split). // In this case parent_split_id should be set. ParentSplitId []byte `protobuf:"bytes,6,opt,name=parent_split_id,json=parentSplitID,proto3" json:"parent_split_id,omitempty"` - // Parent's index in Split. - ParentSplitIndex uint32 `protobuf:"varint,7,opt,name=parent_split_index,json=parentSplitIndex,proto3" json:"parent_split_index,omitempty"` + // EC-parent's parent ID. parent_split_parent_id is set if EC-parent, itself, is a part of Split and + // if an object ID of its parent is presented. The field allows to determine how EC-chunk is placed + // in Split hierarchy. + ParentSplitParentId *grpc.ObjectID `protobuf:"bytes,7,opt,name=parent_split_parent_id,json=parentSplitParentID,proto3" json:"parent_split_parent_id,omitempty"` } func (x *Header_EC) Reset() { @@ -905,11 +907,11 @@ func (x *Header_EC) GetParentSplitId() []byte { return nil } -func (x *Header_EC) GetParentSplitIndex() uint32 { +func (x *Header_EC) GetParentSplitParentId() *grpc.ObjectID { if x != nil { - return x.ParentSplitIndex + return x.ParentSplitParentId } - return 0 + return nil } type ECInfo_Chunk struct { @@ -1011,7 +1013,7 @@ var file_object_grpc_types_proto_rawDesc = []byte{ 0x68, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x52, 0x0f, 0x68, 0x6f, 0x6d, 0x6f, 0x6d, 0x6f, 0x72, 0x70, 0x68, 0x69, 0x63, 0x48, 0x61, - 0x73, 0x68, 0x22, 0xa0, 0x0a, 0x0a, 0x06, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x31, 0x0a, + 0x73, 0x68, 0x22, 0xc1, 0x0a, 0x0a, 0x06, 0x48, 0x65, 0x61, 0x64, 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, @@ -1077,7 +1079,7 @@ var file_object_grpc_types_proto_rawDesc = []byte{ 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, 0x08, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x72, 0x65, 0x6e, 0x12, 0x19, 0x0a, 0x08, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x06, - 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x49, 0x44, 0x1a, 0xf5, 0x01, + 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x49, 0x44, 0x1a, 0x96, 0x02, 0x0a, 0x02, 0x45, 0x43, 0x12, 0x30, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 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, 0x06, @@ -1090,58 +1092,61 @@ var file_object_grpc_types_proto_rawDesc = []byte{ 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x26, 0x0a, 0x0f, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0d, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, - 0x53, 0x70, 0x6c, 0x69, 0x74, 0x49, 0x44, 0x12, 0x2c, 0x0a, 0x12, 0x70, 0x61, 0x72, 0x65, 0x6e, - 0x74, 0x5f, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x07, 0x20, - 0x01, 0x28, 0x0d, 0x52, 0x10, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x53, 0x70, 0x6c, 0x69, 0x74, - 0x49, 0x6e, 0x64, 0x65, 0x78, 0x22, 0xc4, 0x01, 0x0a, 0x06, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, - 0x12, 0x35, 0x0a, 0x09, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, + 0x53, 0x70, 0x6c, 0x69, 0x74, 0x49, 0x44, 0x12, 0x4d, 0x0a, 0x16, 0x70, 0x61, 0x72, 0x65, 0x6e, + 0x74, 0x5f, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x5f, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x69, + 0x64, 0x18, 0x07, 0x20, 0x01, 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, 0x13, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x53, 0x70, 0x6c, 0x69, 0x74, 0x50, 0x61, + 0x72, 0x65, 0x6e, 0x74, 0x49, 0x44, 0x22, 0xc4, 0x01, 0x0a, 0x06, 0x4f, 0x62, 0x6a, 0x65, 0x63, + 0x74, 0x12, 0x35, 0x0a, 0x09, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, + 0x20, 0x01, 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, 0x08, + 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x44, 0x12, 0x37, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, + 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, + 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, + 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, + 0x65, 0x12, 0x30, 0x0a, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, + 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x06, 0x68, 0x65, 0x61, + 0x64, 0x65, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x22, 0x8b, 0x01, + 0x0a, 0x09, 0x53, 0x70, 0x6c, 0x69, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x19, 0x0a, 0x08, 0x73, + 0x70, 0x6c, 0x69, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x73, + 0x70, 0x6c, 0x69, 0x74, 0x49, 0x64, 0x12, 0x35, 0x0a, 0x09, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x70, + 0x61, 0x72, 0x74, 0x18, 0x02, 0x20, 0x01, 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, 0x08, 0x6c, 0x61, 0x73, 0x74, 0x50, 0x61, 0x72, 0x74, 0x12, 0x2c, 0x0a, + 0x04, 0x6c, 0x69, 0x6e, 0x6b, 0x18, 0x03, 0x20, 0x01, 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, 0x04, 0x6c, 0x69, 0x6e, 0x6b, 0x22, 0x9f, 0x01, 0x0a, 0x06, + 0x45, 0x43, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x36, 0x0a, 0x06, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x73, + 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, + 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x45, 0x43, 0x49, 0x6e, 0x66, 0x6f, + 0x2e, 0x43, 0x68, 0x75, 0x6e, 0x6b, 0x52, 0x06, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x73, 0x1a, 0x5d, + 0x0a, 0x05, 0x43, 0x68, 0x75, 0x6e, 0x6b, 0x12, 0x28, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 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, 0x08, 0x6f, - 0x62, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x44, 0x12, 0x37, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, - 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, - 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, - 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, - 0x12, 0x30, 0x0a, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, - 0x65, 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x06, 0x68, 0x65, 0x61, 0x64, - 0x65, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x04, 0x20, - 0x01, 0x28, 0x0c, 0x52, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x22, 0x8b, 0x01, 0x0a, - 0x09, 0x53, 0x70, 0x6c, 0x69, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x19, 0x0a, 0x08, 0x73, 0x70, - 0x6c, 0x69, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x73, 0x70, - 0x6c, 0x69, 0x74, 0x49, 0x64, 0x12, 0x35, 0x0a, 0x09, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x70, 0x61, - 0x72, 0x74, 0x18, 0x02, 0x20, 0x01, 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, 0x08, 0x6c, 0x61, 0x73, 0x74, 0x50, 0x61, 0x72, 0x74, 0x12, 0x2c, 0x0a, 0x04, - 0x6c, 0x69, 0x6e, 0x6b, 0x18, 0x03, 0x20, 0x01, 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, 0x04, 0x6c, 0x69, 0x6e, 0x6b, 0x22, 0x9f, 0x01, 0x0a, 0x06, 0x45, - 0x43, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x36, 0x0a, 0x06, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x73, 0x18, - 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, - 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x45, 0x43, 0x49, 0x6e, 0x66, 0x6f, 0x2e, - 0x43, 0x68, 0x75, 0x6e, 0x6b, 0x52, 0x06, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x73, 0x1a, 0x5d, 0x0a, - 0x05, 0x43, 0x68, 0x75, 0x6e, 0x6b, 0x12, 0x28, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, - 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, 0x02, 0x69, 0x64, - 0x12, 0x14, 0x0a, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, - 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x2a, 0x32, 0x0a, 0x0a, - 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x52, 0x45, - 0x47, 0x55, 0x4c, 0x41, 0x52, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x54, 0x4f, 0x4d, 0x42, 0x53, - 0x54, 0x4f, 0x4e, 0x45, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x4c, 0x4f, 0x43, 0x4b, 0x10, 0x03, - 0x2a, 0x73, 0x0a, 0x09, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1a, 0x0a, - 0x16, 0x4d, 0x41, 0x54, 0x43, 0x48, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, - 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x10, 0x0a, 0x0c, 0x53, 0x54, 0x52, - 0x49, 0x4e, 0x47, 0x5f, 0x45, 0x51, 0x55, 0x41, 0x4c, 0x10, 0x01, 0x12, 0x14, 0x0a, 0x10, 0x53, - 0x54, 0x52, 0x49, 0x4e, 0x47, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x45, 0x51, 0x55, 0x41, 0x4c, 0x10, - 0x02, 0x12, 0x0f, 0x0a, 0x0b, 0x4e, 0x4f, 0x54, 0x5f, 0x50, 0x52, 0x45, 0x53, 0x45, 0x4e, 0x54, - 0x10, 0x03, 0x12, 0x11, 0x0a, 0x0d, 0x43, 0x4f, 0x4d, 0x4d, 0x4f, 0x4e, 0x5f, 0x50, 0x52, 0x45, - 0x46, 0x49, 0x58, 0x10, 0x04, 0x42, 0x61, 0x5a, 0x42, 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, 0x61, - 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2f, - 0x67, 0x72, 0x70, 0x63, 0x3b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0xaa, 0x02, 0x1a, 0x4e, 0x65, - 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, - 0x49, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x72, 0x65, 0x66, 0x73, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x44, 0x52, 0x02, 0x69, + 0x64, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, + 0x52, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x2a, 0x32, 0x0a, + 0x0a, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x52, + 0x45, 0x47, 0x55, 0x4c, 0x41, 0x52, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x54, 0x4f, 0x4d, 0x42, + 0x53, 0x54, 0x4f, 0x4e, 0x45, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x4c, 0x4f, 0x43, 0x4b, 0x10, + 0x03, 0x2a, 0x73, 0x0a, 0x09, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1a, + 0x0a, 0x16, 0x4d, 0x41, 0x54, 0x43, 0x48, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, + 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x10, 0x0a, 0x0c, 0x53, 0x54, + 0x52, 0x49, 0x4e, 0x47, 0x5f, 0x45, 0x51, 0x55, 0x41, 0x4c, 0x10, 0x01, 0x12, 0x14, 0x0a, 0x10, + 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x45, 0x51, 0x55, 0x41, 0x4c, + 0x10, 0x02, 0x12, 0x0f, 0x0a, 0x0b, 0x4e, 0x4f, 0x54, 0x5f, 0x50, 0x52, 0x45, 0x53, 0x45, 0x4e, + 0x54, 0x10, 0x03, 0x12, 0x11, 0x0a, 0x0d, 0x43, 0x4f, 0x4d, 0x4d, 0x4f, 0x4e, 0x5f, 0x50, 0x52, + 0x45, 0x46, 0x49, 0x58, 0x10, 0x04, 0x42, 0x61, 0x5a, 0x42, 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, + 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, + 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0xaa, 0x02, 0x1a, 0x4e, + 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, + 0x50, 0x49, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, } var ( @@ -1206,12 +1211,13 @@ var file_object_grpc_types_proto_depIdxs = []int32{ 3, // 24: neo.fs.v2.object.Header.Split.parent_header:type_name -> neo.fs.v2.object.Header 16, // 25: neo.fs.v2.object.Header.Split.children:type_name -> neo.fs.v2.refs.ObjectID 16, // 26: neo.fs.v2.object.Header.EC.parent:type_name -> neo.fs.v2.refs.ObjectID - 16, // 27: neo.fs.v2.object.ECInfo.Chunk.id:type_name -> neo.fs.v2.refs.ObjectID - 28, // [28:28] is the sub-list for method output_type - 28, // [28:28] is the sub-list for method input_type - 28, // [28:28] is the sub-list for extension type_name - 28, // [28:28] is the sub-list for extension extendee - 0, // [0:28] is the sub-list for field type_name + 16, // 27: neo.fs.v2.object.Header.EC.parent_split_parent_id:type_name -> neo.fs.v2.refs.ObjectID + 16, // 28: neo.fs.v2.object.ECInfo.Chunk.id:type_name -> neo.fs.v2.refs.ObjectID + 29, // [29:29] is the sub-list for method output_type + 29, // [29:29] is the sub-list for method input_type + 29, // [29:29] is the sub-list for extension type_name + 29, // [29:29] is the sub-list for extension extendee + 0, // [0:29] is the sub-list for field type_name } func init() { file_object_grpc_types_proto_init() } diff --git a/object/marshal.go b/object/marshal.go index fa2de95..bf8fcb9 100644 --- a/object/marshal.go +++ b/object/marshal.go @@ -26,13 +26,13 @@ const ( splitHdrChildrenField = 5 splitHdrSplitIDField = 6 - ecHdrParentField = 1 - ecHdrIndexField = 2 - ecHdrTotalField = 3 - ecHdrHeaderLengthField = 4 - ecHdrHeaderField = 5 - ecHdrParentSplitID = 6 - ecHdrParentSplitIndex = 7 + ecHdrParentField = 1 + ecHdrIndexField = 2 + ecHdrTotalField = 3 + ecHdrHeaderLengthField = 4 + ecHdrHeaderField = 5 + ecHdrParentSplitID = 6 + ecHdrParentSplitParentID = 7 hdrVersionField = 1 hdrContainerIDField = 2 @@ -264,7 +264,7 @@ func (h *ECHeader) StableMarshal(buf []byte) []byte { offset += proto.UInt32Marshal(ecHdrHeaderLengthField, buf[offset:], h.HeaderLength) offset += proto.BytesMarshal(ecHdrHeaderField, buf[offset:], h.Header) offset += proto.BytesMarshal(ecHdrParentSplitID, buf[offset:], h.ParentSplitID) - proto.UInt32Marshal(ecHdrParentSplitIndex, buf[offset:], h.ParentSplitIndex) + proto.NestedStructureMarshal(ecHdrParentSplitParentID, buf[offset:], h.ParentSplitParentID) return buf } @@ -279,7 +279,7 @@ func (h *ECHeader) StableSize() (size int) { size += proto.UInt32Size(ecHdrHeaderLengthField, h.HeaderLength) size += proto.BytesSize(ecHdrHeaderField, h.Header) size += proto.BytesSize(ecHdrParentSplitID, h.ParentSplitID) - size += proto.UInt32Size(ecHdrParentSplitIndex, h.ParentSplitIndex) + size += proto.NestedStructureSize(ecHdrParentSplitParentID, h.ParentSplitParentID) return size } diff --git a/object/test/generate.go b/object/test/generate.go index bb774cc..95c76e5 100644 --- a/object/test/generate.go +++ b/object/test/generate.go @@ -92,7 +92,7 @@ func GenerateECHeader(empty bool) *object.ECHeader { if !empty { ech.Parent = refstest.GenerateObjectID(empty) ech.ParentSplitID = []byte{1, 2, 3} - ech.ParentSplitIndex = 1 + ech.ParentSplitParentID = refstest.GenerateObjectID(empty) ech.Index = 0 ech.Total = 2 ech.Header = []byte("chunk of ec-encoded parent header") diff --git a/object/types.go b/object/types.go index c9a0519..7916b1e 100644 --- a/object/types.go +++ b/object/types.go @@ -40,13 +40,13 @@ type SplitHeader struct { } type ECHeader struct { - Parent *refs.ObjectID - ParentSplitID []byte - ParentSplitIndex uint32 - Index uint32 - Total uint32 - Header []byte - HeaderLength uint32 + Parent *refs.ObjectID + ParentSplitID []byte + ParentSplitParentID *refs.ObjectID + Index uint32 + Total uint32 + Header []byte + HeaderLength uint32 } type Header struct { From 9789b79b1d779d478586cb722955e61bc08b705d Mon Sep 17 00:00:00 2001 From: Airat Arifullin Date: Tue, 28 May 2024 11:04:07 +0300 Subject: [PATCH 1128/1196] [#85] apemanager: Generate protobufs for `ape` package * Regenerate protobufs as APE specific type are defined as separate package; * Move `ape` package related utils methods from `apemanager`. Signed-off-by: Airat Arifullin --- ape/convert.go | 132 ++++++++++++ {apemanager => ape}/grpc/types.go | 2 +- {apemanager => ape}/grpc/types.pb.go | 128 ++++++----- {apemanager => ape}/json.go | 6 +- ape/marshal.go | 92 ++++++++ ape/message_test.go | 15 ++ {apemanager => ape}/string.go | 6 +- ape/test/generate.go | 71 ++++++ ape/types.go | 71 ++++++ apemanager/convert.go | 151 ++----------- apemanager/grpc/service.go | 37 ++-- apemanager/grpc/service.pb.go | 312 +++++++++++++-------------- apemanager/marshal.go | 83 ------- apemanager/message_test.go | 1 - apemanager/test/generate.go | 77 +------ apemanager/types.go | 101 ++------- 16 files changed, 661 insertions(+), 624 deletions(-) create mode 100644 ape/convert.go rename {apemanager => ape}/grpc/types.go (94%) rename {apemanager => ape}/grpc/types.pb.go (51%) rename {apemanager => ape}/json.go (56%) create mode 100644 ape/marshal.go create mode 100644 ape/message_test.go rename {apemanager => ape}/string.go (56%) create mode 100644 ape/test/generate.go create mode 100644 ape/types.go diff --git a/ape/convert.go b/ape/convert.go new file mode 100644 index 0000000..c1dadd5 --- /dev/null +++ b/ape/convert.go @@ -0,0 +1,132 @@ +package ape + +import ( + "fmt" + + ape "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/ape/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message" +) + +func TargetTypeToGRPCField(typ TargetType) ape.TargetType { + switch typ { + case TargetTypeNamespace: + return ape.TargetType_NAMESPACE + case TargetTypeContainer: + return ape.TargetType_CONTAINER + case TargetTypeUser: + return ape.TargetType_USER + case TargetTypeGroup: + return ape.TargetType_GROUP + default: + return ape.TargetType_UNDEFINED + } +} + +func TargetTypeFromGRPCField(typ ape.TargetType) TargetType { + switch typ { + case ape.TargetType_NAMESPACE: + return TargetTypeNamespace + case ape.TargetType_CONTAINER: + return TargetTypeContainer + case ape.TargetType_USER: + return TargetTypeUser + case ape.TargetType_GROUP: + return TargetTypeGroup + default: + return TargetTypeUndefined + } +} + +func TargetTypeToGRPC(typ TargetType) ape.TargetType { + return ape.TargetType(typ) +} + +func TargetTypeFromGRPC(typ ape.TargetType) TargetType { + return TargetType(typ) +} + +func (v2 *ChainTarget) ToGRPCMessage() grpc.Message { + var mgrpc *ape.ChainTarget + + if v2 != nil { + mgrpc = new(ape.ChainTarget) + + mgrpc.SetType(TargetTypeToGRPC(v2.GetTargetType())) + mgrpc.SetName(v2.GetName()) + } + + return mgrpc +} + +func (v2 *ChainTarget) FromGRPCMessage(m grpc.Message) error { + mgrpc, ok := m.(*ape.ChainTarget) + if !ok { + return message.NewUnexpectedMessageType(m, mgrpc) + } + + v2.SetTargetType(TargetTypeFromGRPC(mgrpc.GetType())) + v2.SetName(mgrpc.GetName()) + + return nil +} + +func (v2 *ChainRaw) ToGRPCMessage() grpc.Message { + var mgrpc *ape.Chain_Raw + + if v2 != nil { + mgrpc = new(ape.Chain_Raw) + + mgrpc.SetRaw(v2.GetRaw()) + } + + return mgrpc +} + +func (v2 *ChainRaw) FromGRPCMessage(m grpc.Message) error { + mgrpc, ok := m.(*ape.Chain_Raw) + if !ok { + return message.NewUnexpectedMessageType(m, mgrpc) + } + + v2.SetRaw(mgrpc.GetRaw()) + + return nil +} + +func (v2 *Chain) ToGRPCMessage() grpc.Message { + var mgrpc *ape.Chain + + if v2 != nil { + mgrpc = new(ape.Chain) + + switch chainKind := v2.GetKind().(type) { + default: + panic(fmt.Sprintf("unsupported chain kind: %T", chainKind)) + case *ChainRaw: + mgrpc.SetKind(chainKind.ToGRPCMessage().(*ape.Chain_Raw)) + } + } + + return mgrpc +} + +func (v2 *Chain) FromGRPCMessage(m grpc.Message) error { + mgrpc, ok := m.(*ape.Chain) + if !ok { + return message.NewUnexpectedMessageType(m, mgrpc) + } + + switch chainKind := mgrpc.GetKind().(type) { + default: + return fmt.Errorf("unsupported chain kind: %T", chainKind) + case *ape.Chain_Raw: + chainRaw := new(ChainRaw) + if err := chainRaw.FromGRPCMessage(chainKind); err != nil { + return err + } + v2.SetKind(chainRaw) + } + + return nil +} diff --git a/apemanager/grpc/types.go b/ape/grpc/types.go similarity index 94% rename from apemanager/grpc/types.go rename to ape/grpc/types.go index 0f2ebb2..931b6a3 100644 --- a/apemanager/grpc/types.go +++ b/ape/grpc/types.go @@ -1,4 +1,4 @@ -package apemanager +package ape func (t *ChainTarget) SetType(typ TargetType) { t.Type = typ diff --git a/apemanager/grpc/types.pb.go b/ape/grpc/types.pb.go similarity index 51% rename from apemanager/grpc/types.pb.go rename to ape/grpc/types.pb.go index 395857a..1da2110 100644 --- a/apemanager/grpc/types.pb.go +++ b/ape/grpc/types.pb.go @@ -2,9 +2,9 @@ // versions: // protoc-gen-go v1.33.0 // protoc v4.25.3 -// source: apemanager/grpc/types.proto +// source: ape/grpc/types.proto -package apemanager +package ape import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" @@ -60,11 +60,11 @@ func (x TargetType) String() string { } func (TargetType) Descriptor() protoreflect.EnumDescriptor { - return file_apemanager_grpc_types_proto_enumTypes[0].Descriptor() + return file_ape_grpc_types_proto_enumTypes[0].Descriptor() } func (TargetType) Type() protoreflect.EnumType { - return &file_apemanager_grpc_types_proto_enumTypes[0] + return &file_ape_grpc_types_proto_enumTypes[0] } func (x TargetType) Number() protoreflect.EnumNumber { @@ -73,7 +73,7 @@ func (x TargetType) Number() protoreflect.EnumNumber { // Deprecated: Use TargetType.Descriptor instead. func (TargetType) EnumDescriptor() ([]byte, []int) { - return file_apemanager_grpc_types_proto_rawDescGZIP(), []int{0} + return file_ape_grpc_types_proto_rawDescGZIP(), []int{0} } // ChainTarget is an object to which a rule chain is defined. @@ -82,14 +82,14 @@ type ChainTarget struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Type TargetType `protobuf:"varint,1,opt,name=type,proto3,enum=frostfs.v2.apemanager.TargetType" json:"type,omitempty"` + Type TargetType `protobuf:"varint,1,opt,name=type,proto3,enum=frostfs.v2.ape.TargetType" json:"type,omitempty"` Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` } func (x *ChainTarget) Reset() { *x = ChainTarget{} if protoimpl.UnsafeEnabled { - mi := &file_apemanager_grpc_types_proto_msgTypes[0] + mi := &file_ape_grpc_types_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -102,7 +102,7 @@ func (x *ChainTarget) String() string { func (*ChainTarget) ProtoMessage() {} func (x *ChainTarget) ProtoReflect() protoreflect.Message { - mi := &file_apemanager_grpc_types_proto_msgTypes[0] + mi := &file_ape_grpc_types_proto_msgTypes[0] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -115,7 +115,7 @@ func (x *ChainTarget) ProtoReflect() protoreflect.Message { // Deprecated: Use ChainTarget.ProtoReflect.Descriptor instead. func (*ChainTarget) Descriptor() ([]byte, []int) { - return file_apemanager_grpc_types_proto_rawDescGZIP(), []int{0} + return file_ape_grpc_types_proto_rawDescGZIP(), []int{0} } func (x *ChainTarget) GetType() TargetType { @@ -147,7 +147,7 @@ type Chain struct { func (x *Chain) Reset() { *x = Chain{} if protoimpl.UnsafeEnabled { - mi := &file_apemanager_grpc_types_proto_msgTypes[1] + mi := &file_ape_grpc_types_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -160,7 +160,7 @@ func (x *Chain) String() string { func (*Chain) ProtoMessage() {} func (x *Chain) ProtoReflect() protoreflect.Message { - mi := &file_apemanager_grpc_types_proto_msgTypes[1] + mi := &file_ape_grpc_types_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -173,7 +173,7 @@ func (x *Chain) ProtoReflect() protoreflect.Message { // Deprecated: Use Chain.ProtoReflect.Descriptor instead. func (*Chain) Descriptor() ([]byte, []int) { - return file_apemanager_grpc_types_proto_rawDescGZIP(), []int{1} + return file_ape_grpc_types_proto_rawDescGZIP(), []int{1} } func (m *Chain) GetKind() isChain_Kind { @@ -201,54 +201,52 @@ type Chain_Raw struct { func (*Chain_Raw) isChain_Kind() {} -var File_apemanager_grpc_types_proto protoreflect.FileDescriptor +var File_ape_grpc_types_proto protoreflect.FileDescriptor -var file_apemanager_grpc_types_proto_rawDesc = []byte{ - 0x0a, 0x1b, 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2f, 0x67, 0x72, 0x70, - 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x15, 0x66, - 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, - 0x61, 0x67, 0x65, 0x72, 0x22, 0x58, 0x0a, 0x0b, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x54, 0x61, 0x72, - 0x67, 0x65, 0x74, 0x12, 0x35, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0e, 0x32, 0x21, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, - 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 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, 0x4c, 0x5a, 0x4a, 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, 0x61, 0x70, 0x69, - 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, - 0x72, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, - 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +var file_ape_grpc_types_proto_rawDesc = []byte{ + 0x0a, 0x14, 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, 0x3e, + 0x5a, 0x3c, 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, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, + 0x32, 0x2f, 0x61, 0x70, 0x65, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x61, 0x70, 0x65, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( - file_apemanager_grpc_types_proto_rawDescOnce sync.Once - file_apemanager_grpc_types_proto_rawDescData = file_apemanager_grpc_types_proto_rawDesc + file_ape_grpc_types_proto_rawDescOnce sync.Once + file_ape_grpc_types_proto_rawDescData = file_ape_grpc_types_proto_rawDesc ) -func file_apemanager_grpc_types_proto_rawDescGZIP() []byte { - file_apemanager_grpc_types_proto_rawDescOnce.Do(func() { - file_apemanager_grpc_types_proto_rawDescData = protoimpl.X.CompressGZIP(file_apemanager_grpc_types_proto_rawDescData) +func file_ape_grpc_types_proto_rawDescGZIP() []byte { + file_ape_grpc_types_proto_rawDescOnce.Do(func() { + file_ape_grpc_types_proto_rawDescData = protoimpl.X.CompressGZIP(file_ape_grpc_types_proto_rawDescData) }) - return file_apemanager_grpc_types_proto_rawDescData + return file_ape_grpc_types_proto_rawDescData } -var file_apemanager_grpc_types_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_apemanager_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_apemanager_grpc_types_proto_goTypes = []interface{}{ - (TargetType)(0), // 0: frostfs.v2.apemanager.TargetType - (*ChainTarget)(nil), // 1: frostfs.v2.apemanager.ChainTarget - (*Chain)(nil), // 2: frostfs.v2.apemanager.Chain +var file_ape_grpc_types_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_ape_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_ape_grpc_types_proto_goTypes = []interface{}{ + (TargetType)(0), // 0: frostfs.v2.ape.TargetType + (*ChainTarget)(nil), // 1: frostfs.v2.ape.ChainTarget + (*Chain)(nil), // 2: frostfs.v2.ape.Chain } -var file_apemanager_grpc_types_proto_depIdxs = []int32{ - 0, // 0: frostfs.v2.apemanager.ChainTarget.type:type_name -> frostfs.v2.apemanager.TargetType +var file_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 @@ -256,13 +254,13 @@ var file_apemanager_grpc_types_proto_depIdxs = []int32{ 0, // [0:1] is the sub-list for field type_name } -func init() { file_apemanager_grpc_types_proto_init() } -func file_apemanager_grpc_types_proto_init() { - if File_apemanager_grpc_types_proto != nil { +func init() { file_ape_grpc_types_proto_init() } +func file_ape_grpc_types_proto_init() { + if File_ape_grpc_types_proto != nil { return } if !protoimpl.UnsafeEnabled { - file_apemanager_grpc_types_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_ape_grpc_types_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ChainTarget); i { case 0: return &v.state @@ -274,7 +272,7 @@ func file_apemanager_grpc_types_proto_init() { return nil } } - file_apemanager_grpc_types_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_ape_grpc_types_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Chain); i { case 0: return &v.state @@ -287,26 +285,26 @@ func file_apemanager_grpc_types_proto_init() { } } } - file_apemanager_grpc_types_proto_msgTypes[1].OneofWrappers = []interface{}{ + file_ape_grpc_types_proto_msgTypes[1].OneofWrappers = []interface{}{ (*Chain_Raw)(nil), } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_apemanager_grpc_types_proto_rawDesc, + RawDescriptor: file_ape_grpc_types_proto_rawDesc, NumEnums: 1, NumMessages: 2, NumExtensions: 0, NumServices: 0, }, - GoTypes: file_apemanager_grpc_types_proto_goTypes, - DependencyIndexes: file_apemanager_grpc_types_proto_depIdxs, - EnumInfos: file_apemanager_grpc_types_proto_enumTypes, - MessageInfos: file_apemanager_grpc_types_proto_msgTypes, + GoTypes: file_ape_grpc_types_proto_goTypes, + DependencyIndexes: file_ape_grpc_types_proto_depIdxs, + EnumInfos: file_ape_grpc_types_proto_enumTypes, + MessageInfos: file_ape_grpc_types_proto_msgTypes, }.Build() - File_apemanager_grpc_types_proto = out.File - file_apemanager_grpc_types_proto_rawDesc = nil - file_apemanager_grpc_types_proto_goTypes = nil - file_apemanager_grpc_types_proto_depIdxs = nil + File_ape_grpc_types_proto = out.File + file_ape_grpc_types_proto_rawDesc = nil + file_ape_grpc_types_proto_goTypes = nil + file_ape_grpc_types_proto_depIdxs = nil } diff --git a/apemanager/json.go b/ape/json.go similarity index 56% rename from apemanager/json.go rename to ape/json.go index 4f44d5e..9760f4e 100644 --- a/apemanager/json.go +++ b/ape/json.go @@ -1,7 +1,7 @@ -package apemanager +package ape import ( - apemanager_grpc "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/apemanager/grpc" + ape "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/ape/grpc" "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message" ) @@ -10,5 +10,5 @@ func (t *ChainTarget) MarshalJSON() ([]byte, error) { } func (t *ChainTarget) UnmarshalJSON(data []byte) error { - return message.UnmarshalJSON(t, data, new(apemanager_grpc.ChainTarget)) + return message.UnmarshalJSON(t, data, new(ape.ChainTarget)) } diff --git a/ape/marshal.go b/ape/marshal.go new file mode 100644 index 0000000..9889261 --- /dev/null +++ b/ape/marshal.go @@ -0,0 +1,92 @@ +package ape + +import ( + "fmt" + + ape "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/ape/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/proto" +) + +const ( + chainTargetTargetTypeField = 1 + chainTargetNameField = 2 + + chainRawField = 1 +) + +func (t *ChainTarget) StableSize() (size int) { + if t == nil { + return 0 + } + + size += proto.EnumSize(chainTargetTargetTypeField, int32(t.targeType)) + size += proto.StringSize(chainTargetNameField, t.name) + + return size +} + +func (t *ChainTarget) StableMarshal(buf []byte) []byte { + if t == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, t.StableSize()) + } + + var offset int + + offset += proto.EnumMarshal(chainTargetTargetTypeField, buf[offset:], int32(t.targeType)) + proto.StringMarshal(chainTargetNameField, buf[offset:], t.name) + + return buf +} + +func (t *ChainTarget) Unmarshal(data []byte) error { + return message.Unmarshal(t, data, new(ape.ChainTarget)) +} + +func (c *Chain) StableSize() (size int) { + if c == nil { + return 0 + } + + switch v := c.GetKind().(type) { + case *ChainRaw: + if v != nil { + size += proto.BytesSize(chainRawField, v.GetRaw()) + } + default: + panic(fmt.Sprintf("unsupported chain kind: %T", v)) + } + + return size +} + +func (c *Chain) StableMarshal(buf []byte) []byte { + if c == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, c.StableSize()) + } + + var offset int + + switch v := c.GetKind().(type) { + case *ChainRaw: + if v != nil { + proto.BytesMarshal(chainRawField, buf[offset:], v.GetRaw()) + } + default: + panic(fmt.Sprintf("unsupported chain kind: %T", v)) + } + + return buf +} + +func (c *Chain) Unmarshal(data []byte) error { + return message.Unmarshal(c, data, new(ape.Chain)) +} diff --git a/ape/message_test.go b/ape/message_test.go new file mode 100644 index 0000000..636a521 --- /dev/null +++ b/ape/message_test.go @@ -0,0 +1,15 @@ +package ape_test + +import ( + "testing" + + apetest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/ape/test" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message" + messagetest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message/test" +) + +func TestMessageConvert(t *testing.T) { + messagetest.TestRPCMessage(t, + func(empty bool) message.Message { return apetest.GenerateChainTarget(empty) }, + ) +} diff --git a/apemanager/string.go b/ape/string.go similarity index 56% rename from apemanager/string.go rename to ape/string.go index dddeede..2e2507e 100644 --- a/apemanager/string.go +++ b/ape/string.go @@ -1,7 +1,7 @@ -package apemanager +package ape import ( - apemanager_grpc "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/apemanager/grpc" + apegrpc "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/ape/grpc" ) func (tt TargetType) String() string { @@ -9,7 +9,7 @@ func (tt TargetType) String() string { } func (tt *TargetType) FromString(s string) bool { - i, ok := apemanager_grpc.TargetType_value[s] + i, ok := apegrpc.TargetType_value[s] if ok { *tt = TargetType(i) } diff --git a/ape/test/generate.go b/ape/test/generate.go new file mode 100644 index 0000000..9caf9de --- /dev/null +++ b/ape/test/generate.go @@ -0,0 +1,71 @@ +package test + +import ( + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/ape" +) + +func GenerateRawChains(empty bool, n int) []*ape.Chain { + if empty { + return []*ape.Chain{} + } + + res := make([]*ape.Chain, n) + for i := range res { + res[i] = GenerateRawChain(empty) + } + return res +} + +func GenerateRawChain(empty bool) *ape.Chain { + chRaw := new(ape.ChainRaw) + + if empty { + chRaw.SetRaw([]byte("{}")) + } else { + chRaw.SetRaw([]byte(`{ + "ID": "", + "Rules": [ + { + "Status": "Allow", + "Actions": { + "Inverted": false, + "Names": [ + "GetObject" + ] + }, + "Resources": { + "Inverted": false, + "Names": [ + "native:object/*" + ] + }, + "Any": false, + "Condition": [ + { + "Op": "StringEquals", + "Object": "Resource", + "Key": "Department", + "Value": "HR" + } + ] + } + ], + "MatchType": "DenyPriority" + }`)) + } + + ch := new(ape.Chain) + ch.SetKind(chRaw) + return ch +} + +func GenerateChainTarget(empty bool) *ape.ChainTarget { + m := new(ape.ChainTarget) + + if !empty { + m.SetTargetType(ape.TargetTypeContainer) + m.SetName("BzQw5HH3feoxFDD5tCT87Y1726qzgLfxEE7wgtoRzB3R") + } + + return m +} diff --git a/ape/types.go b/ape/types.go new file mode 100644 index 0000000..935a5ea --- /dev/null +++ b/ape/types.go @@ -0,0 +1,71 @@ +package ape + +type TargetType uint32 + +const ( + TargetTypeUndefined TargetType = iota + TargetTypeNamespace + TargetTypeContainer + TargetTypeUser + TargetTypeGroup +) + +type ChainTarget struct { + targeType TargetType + + name string +} + +func (ct *ChainTarget) SetTargetType(targeType TargetType) { + ct.targeType = targeType +} + +func (ct *ChainTarget) SetName(name string) { + ct.name = name +} + +func (ct *ChainTarget) GetTargetType() TargetType { + if ct != nil { + return ct.targeType + } + + return 0 +} + +func (ct *ChainTarget) GetName() string { + if ct != nil { + return ct.name + } + + return "" +} + +type chainKind interface { + isChainKind() +} + +type Chain struct { + kind chainKind +} + +func (c *Chain) SetKind(kind chainKind) { + c.kind = kind +} + +func (c *Chain) GetKind() chainKind { + return c.kind +} + +type ChainRaw struct { + Raw []byte +} + +func (*ChainRaw) isChainKind() {} + +func (c *ChainRaw) SetRaw(raw []byte) { + c.Raw = raw +} + +func (c *ChainRaw) GetRaw() []byte { + return c.Raw +} diff --git a/apemanager/convert.go b/apemanager/convert.go index f1cbcda..fdc5132 100644 --- a/apemanager/convert.go +++ b/apemanager/convert.go @@ -1,144 +1,21 @@ package apemanager import ( - "fmt" - + ape "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/ape" + apeGRPC "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/ape/grpc" apemanager "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/apemanager/grpc" "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/grpc" "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message" ) -func TargetTypeToGRPCField(typ TargetType) apemanager.TargetType { - switch typ { - case TargetTypeNamespace: - return apemanager.TargetType_NAMESPACE - case TargetTypeContainer: - return apemanager.TargetType_CONTAINER - case TargetTypeUser: - return apemanager.TargetType_USER - case TargetTypeGroup: - return apemanager.TargetType_GROUP - default: - return apemanager.TargetType_UNDEFINED - } -} - -func TargetTypeFromGRPCField(typ apemanager.TargetType) TargetType { - switch typ { - case apemanager.TargetType_NAMESPACE: - return TargetTypeNamespace - case apemanager.TargetType_CONTAINER: - return TargetTypeContainer - case apemanager.TargetType_USER: - return TargetTypeUser - case apemanager.TargetType_GROUP: - return TargetTypeGroup - default: - return TargetTypeUndefined - } -} - -func TargetTypeToGRPC(typ TargetType) apemanager.TargetType { - return apemanager.TargetType(typ) -} - -func TargetTypeFromGRPC(typ apemanager.TargetType) TargetType { - return TargetType(typ) -} - -func (v2 *ChainTarget) ToGRPCMessage() grpc.Message { - var mgrpc *apemanager.ChainTarget - - if v2 != nil { - mgrpc = new(apemanager.ChainTarget) - - mgrpc.SetType(TargetTypeToGRPC(v2.GetTargetType())) - mgrpc.SetName(v2.GetName()) - } - - return mgrpc -} - -func (v2 *ChainTarget) FromGRPCMessage(m grpc.Message) error { - mgrpc, ok := m.(*apemanager.ChainTarget) - if !ok { - return message.NewUnexpectedMessageType(m, mgrpc) - } - - v2.SetTargetType(TargetTypeFromGRPC(mgrpc.GetType())) - v2.SetName(mgrpc.GetName()) - - return nil -} - -func (v2 *ChainRaw) ToGRPCMessage() grpc.Message { - var mgrpc *apemanager.Chain_Raw - - if v2 != nil { - mgrpc = new(apemanager.Chain_Raw) - - mgrpc.SetRaw(v2.GetRaw()) - } - - return mgrpc -} - -func (v2 *ChainRaw) FromGRPCMessage(m grpc.Message) error { - mgrpc, ok := m.(*apemanager.Chain_Raw) - if !ok { - return message.NewUnexpectedMessageType(m, mgrpc) - } - - v2.SetRaw(mgrpc.GetRaw()) - - return nil -} - -func (v2 *Chain) ToGRPCMessage() grpc.Message { - var mgrpc *apemanager.Chain - - if v2 != nil { - mgrpc = new(apemanager.Chain) - - switch chainKind := v2.GetKind().(type) { - default: - panic(fmt.Sprintf("unsupported chain kind: %T", chainKind)) - case *ChainRaw: - mgrpc.SetKind(chainKind.ToGRPCMessage().(*apemanager.Chain_Raw)) - } - } - - return mgrpc -} - -func (v2 *Chain) FromGRPCMessage(m grpc.Message) error { - mgrpc, ok := m.(*apemanager.Chain) - if !ok { - return message.NewUnexpectedMessageType(m, mgrpc) - } - - switch chainKind := mgrpc.GetKind().(type) { - default: - return fmt.Errorf("unsupported chain kind: %T", chainKind) - case *apemanager.Chain_Raw: - chainRaw := new(ChainRaw) - if err := chainRaw.FromGRPCMessage(chainKind); err != nil { - return err - } - v2.SetKind(chainRaw) - } - - return nil -} - func (reqBody *AddChainRequestBody) ToGRPCMessage() grpc.Message { var reqBodygrpc *apemanager.AddChainRequest_Body if reqBody != nil { reqBodygrpc = new(apemanager.AddChainRequest_Body) - reqBodygrpc.SetTarget(reqBody.GetTarget().ToGRPCMessage().(*apemanager.ChainTarget)) - reqBodygrpc.SetChain(reqBody.GetChain().ToGRPCMessage().(*apemanager.Chain)) + reqBodygrpc.SetTarget(reqBody.GetTarget().ToGRPCMessage().(*apeGRPC.ChainTarget)) + reqBodygrpc.SetChain(reqBody.GetChain().ToGRPCMessage().(*apeGRPC.Chain)) } return reqBodygrpc @@ -151,14 +28,14 @@ func (reqBody *AddChainRequestBody) FromGRPCMessage(m grpc.Message) error { } if targetgrpc := reqBodygrpc.GetTarget(); targetgrpc != nil { - reqBody.target = new(ChainTarget) + reqBody.target = new(ape.ChainTarget) if err := reqBody.target.FromGRPCMessage(targetgrpc); err != nil { return err } } if chaingrpc := reqBodygrpc.GetChain(); chaingrpc != nil { - reqBody.chain = new(Chain) + reqBody.chain = new(ape.Chain) if err := reqBody.GetChain().FromGRPCMessage(chaingrpc); err != nil { return err } @@ -254,7 +131,7 @@ func (reqBody *RemoveChainRequestBody) ToGRPCMessage() grpc.Message { if reqBody != nil { reqBodygrpc = new(apemanager.RemoveChainRequest_Body) - reqBodygrpc.SetTarget(reqBody.target.ToGRPCMessage().(*apemanager.ChainTarget)) + reqBodygrpc.SetTarget(reqBody.target.ToGRPCMessage().(*apeGRPC.ChainTarget)) reqBodygrpc.SetChainId(reqBody.GetChainID()) } @@ -268,7 +145,7 @@ func (reqBody *RemoveChainRequestBody) FromGRPCMessage(m grpc.Message) error { } if targetgrpc := reqBodygrpc.GetTarget(); targetgrpc != nil { - reqBody.target = new(ChainTarget) + reqBody.target = new(ape.ChainTarget) if err := reqBody.target.FromGRPCMessage(targetgrpc); err != nil { return err } @@ -362,7 +239,7 @@ func (reqBody *ListChainsRequestBody) ToGRPCMessage() grpc.Message { if reqBody != nil { reqBodygrpc = new(apemanager.ListChainsRequest_Body) - reqBodygrpc.SetTarget(reqBody.target.ToGRPCMessage().(*apemanager.ChainTarget)) + reqBodygrpc.SetTarget(reqBody.target.ToGRPCMessage().(*apeGRPC.ChainTarget)) } return reqBodygrpc @@ -375,7 +252,7 @@ func (reqBody *ListChainsRequestBody) FromGRPCMessage(m grpc.Message) error { } if targetgrpc := reqBodygrpc.GetTarget(); targetgrpc != nil { - reqBody.target = new(ChainTarget) + reqBody.target = new(ape.ChainTarget) if err := reqBody.target.FromGRPCMessage(targetgrpc); err != nil { return err } @@ -419,9 +296,9 @@ func (respBody *ListChainsResponseBody) ToGRPCMessage() grpc.Message { if respBody != nil { respBodygrpc = new(apemanager.ListChainsResponse_Body) - chainsgrpc := make([]*apemanager.Chain, 0, len(respBody.GetChains())) + chainsgrpc := make([]*apeGRPC.Chain, 0, len(respBody.GetChains())) for _, chain := range respBody.GetChains() { - chainsgrpc = append(chainsgrpc, chain.ToGRPCMessage().(*apemanager.Chain)) + chainsgrpc = append(chainsgrpc, chain.ToGRPCMessage().(*apeGRPC.Chain)) } respBodygrpc.SetChains(chainsgrpc) @@ -436,10 +313,10 @@ func (respBody *ListChainsResponseBody) FromGRPCMessage(m grpc.Message) error { return message.NewUnexpectedMessageType(m, respBodygrpc) } - chains := make([]*Chain, 0, len(respBodygrpc.GetChains())) + chains := make([]*ape.Chain, 0, len(respBodygrpc.GetChains())) for _, chaingrpc := range respBodygrpc.GetChains() { - chain := new(Chain) + chain := new(ape.Chain) if err := chain.FromGRPCMessage(chaingrpc); err != nil { return err } diff --git a/apemanager/grpc/service.go b/apemanager/grpc/service.go index c07bceb..bd77db0 100644 --- a/apemanager/grpc/service.go +++ b/apemanager/grpc/service.go @@ -1,14 +1,15 @@ package apemanager import ( - session_grpc "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session/grpc" + ape "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/ape/grpc" + session "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session/grpc" ) -func (rb *AddChainRequest_Body) SetTarget(t *ChainTarget) { +func (rb *AddChainRequest_Body) SetTarget(t *ape.ChainTarget) { rb.Target = t } -func (rb *AddChainRequest_Body) SetChain(chain *Chain) { +func (rb *AddChainRequest_Body) SetChain(chain *ape.Chain) { rb.Chain = chain } @@ -16,11 +17,11 @@ func (r *AddChainRequest) SetBody(rb *AddChainRequest_Body) { r.Body = rb } -func (r *AddChainRequest) SetMetaHeader(mh *session_grpc.RequestMetaHeader) { +func (r *AddChainRequest) SetMetaHeader(mh *session.RequestMetaHeader) { r.MetaHeader = mh } -func (r *AddChainRequest) SetVerifyHeader(vh *session_grpc.RequestVerificationHeader) { +func (r *AddChainRequest) SetVerifyHeader(vh *session.RequestVerificationHeader) { r.VerifyHeader = vh } @@ -32,15 +33,15 @@ func (r *AddChainResponse) SetBody(rb *AddChainResponse_Body) { r.Body = rb } -func (r *AddChainResponse) SetMetaHeader(mh *session_grpc.ResponseMetaHeader) { +func (r *AddChainResponse) SetMetaHeader(mh *session.ResponseMetaHeader) { r.MetaHeader = mh } -func (r *AddChainResponse) SetVerifyHeader(vh *session_grpc.ResponseVerificationHeader) { +func (r *AddChainResponse) SetVerifyHeader(vh *session.ResponseVerificationHeader) { r.VerifyHeader = vh } -func (rb *RemoveChainRequest_Body) SetTarget(t *ChainTarget) { +func (rb *RemoveChainRequest_Body) SetTarget(t *ape.ChainTarget) { rb.Target = t } @@ -52,11 +53,11 @@ func (r *RemoveChainRequest) SetBody(rb *RemoveChainRequest_Body) { r.Body = rb } -func (r *RemoveChainRequest) SetMetaHeader(mh *session_grpc.RequestMetaHeader) { +func (r *RemoveChainRequest) SetMetaHeader(mh *session.RequestMetaHeader) { r.MetaHeader = mh } -func (r *RemoveChainRequest) SetVerifyHeader(vh *session_grpc.RequestVerificationHeader) { +func (r *RemoveChainRequest) SetVerifyHeader(vh *session.RequestVerificationHeader) { r.VerifyHeader = vh } @@ -64,15 +65,15 @@ func (r *RemoveChainResponse) SetBody(rb *RemoveChainResponse_Body) { r.Body = rb } -func (r *RemoveChainResponse) SetMetaHeader(mh *session_grpc.ResponseMetaHeader) { +func (r *RemoveChainResponse) SetMetaHeader(mh *session.ResponseMetaHeader) { r.MetaHeader = mh } -func (r *RemoveChainResponse) SetVerifyHeader(vh *session_grpc.ResponseVerificationHeader) { +func (r *RemoveChainResponse) SetVerifyHeader(vh *session.ResponseVerificationHeader) { r.VerifyHeader = vh } -func (r *ListChainsRequest_Body) SetTarget(t *ChainTarget) { +func (r *ListChainsRequest_Body) SetTarget(t *ape.ChainTarget) { r.Target = t } @@ -80,15 +81,15 @@ func (r *ListChainsRequest) SetBody(rb *ListChainsRequest_Body) { r.Body = rb } -func (r *ListChainsRequest) SetMetaHeader(mh *session_grpc.RequestMetaHeader) { +func (r *ListChainsRequest) SetMetaHeader(mh *session.RequestMetaHeader) { r.MetaHeader = mh } -func (r *ListChainsRequest) SetVerifyHeader(vh *session_grpc.RequestVerificationHeader) { +func (r *ListChainsRequest) SetVerifyHeader(vh *session.RequestVerificationHeader) { r.VerifyHeader = vh } -func (rb *ListChainsResponse_Body) SetChains(chains []*Chain) { +func (rb *ListChainsResponse_Body) SetChains(chains []*ape.Chain) { rb.Chains = chains } @@ -96,10 +97,10 @@ func (r *ListChainsResponse) SetBody(rb *ListChainsResponse_Body) { r.Body = rb } -func (r *ListChainsResponse) SetMetaHeader(mh *session_grpc.ResponseMetaHeader) { +func (r *ListChainsResponse) SetMetaHeader(mh *session.ResponseMetaHeader) { r.MetaHeader = mh } -func (r *ListChainsResponse) SetVerifyHeader(vh *session_grpc.ResponseVerificationHeader) { +func (r *ListChainsResponse) SetVerifyHeader(vh *session.ResponseVerificationHeader) { r.VerifyHeader = vh } diff --git a/apemanager/grpc/service.pb.go b/apemanager/grpc/service.pb.go index 157da44..7757aad 100644 --- a/apemanager/grpc/service.pb.go +++ b/apemanager/grpc/service.pb.go @@ -7,6 +7,7 @@ package apemanager import ( + grpc1 "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/ape/grpc" grpc "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session/grpc" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" @@ -441,9 +442,9 @@ type AddChainRequest_Body struct { unknownFields protoimpl.UnknownFields // A target for which a rule chain is added. - Target *ChainTarget `protobuf:"bytes,1,opt,name=target,proto3" json:"target,omitempty"` + Target *grpc1.ChainTarget `protobuf:"bytes,1,opt,name=target,proto3" json:"target,omitempty"` // The chain to set for the target. - Chain *Chain `protobuf:"bytes,2,opt,name=chain,proto3" json:"chain,omitempty"` + Chain *grpc1.Chain `protobuf:"bytes,2,opt,name=chain,proto3" json:"chain,omitempty"` } func (x *AddChainRequest_Body) Reset() { @@ -478,14 +479,14 @@ func (*AddChainRequest_Body) Descriptor() ([]byte, []int) { return file_apemanager_grpc_service_proto_rawDescGZIP(), []int{0, 0} } -func (x *AddChainRequest_Body) GetTarget() *ChainTarget { +func (x *AddChainRequest_Body) GetTarget() *grpc1.ChainTarget { if x != nil { return x.Target } return nil } -func (x *AddChainRequest_Body) GetChain() *Chain { +func (x *AddChainRequest_Body) GetChain() *grpc1.Chain { if x != nil { return x.Chain } @@ -548,7 +549,7 @@ type RemoveChainRequest_Body struct { unknownFields protoimpl.UnknownFields // Target for which a rule chain is removed. - Target *ChainTarget `protobuf:"bytes,1,opt,name=target,proto3" json:"target,omitempty"` + Target *grpc1.ChainTarget `protobuf:"bytes,1,opt,name=target,proto3" json:"target,omitempty"` // Chain ID assigned for the rule chain. ChainId []byte `protobuf:"bytes,2,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` } @@ -585,7 +586,7 @@ func (*RemoveChainRequest_Body) Descriptor() ([]byte, []int) { return file_apemanager_grpc_service_proto_rawDescGZIP(), []int{2, 0} } -func (x *RemoveChainRequest_Body) GetTarget() *ChainTarget { +func (x *RemoveChainRequest_Body) GetTarget() *grpc1.ChainTarget { if x != nil { return x.Target } @@ -645,7 +646,7 @@ type ListChainsRequest_Body struct { unknownFields protoimpl.UnknownFields // Target for which rule chains are listed. - Target *ChainTarget `protobuf:"bytes,1,opt,name=target,proto3" json:"target,omitempty"` + Target *grpc1.ChainTarget `protobuf:"bytes,1,opt,name=target,proto3" json:"target,omitempty"` } func (x *ListChainsRequest_Body) Reset() { @@ -680,7 +681,7 @@ func (*ListChainsRequest_Body) Descriptor() ([]byte, []int) { return file_apemanager_grpc_service_proto_rawDescGZIP(), []int{4, 0} } -func (x *ListChainsRequest_Body) GetTarget() *ChainTarget { +func (x *ListChainsRequest_Body) GetTarget() *grpc1.ChainTarget { if x != nil { return x.Target } @@ -693,7 +694,7 @@ type ListChainsResponse_Body struct { unknownFields protoimpl.UnknownFields // The list of chains defined for the reqeusted target. - Chains []*Chain `protobuf:"bytes,1,rep,name=chains,proto3" json:"chains,omitempty"` + Chains []*grpc1.Chain `protobuf:"bytes,1,rep,name=chains,proto3" json:"chains,omitempty"` } func (x *ListChainsResponse_Body) Reset() { @@ -728,7 +729,7 @@ func (*ListChainsResponse_Body) Descriptor() ([]byte, []int) { return file_apemanager_grpc_service_proto_rawDescGZIP(), []int{5, 0} } -func (x *ListChainsResponse_Body) GetChains() []*Chain { +func (x *ListChainsResponse_Body) GetChains() []*grpc1.Chain { if x != nil { return x.Chains } @@ -741,151 +742,149 @@ var file_apemanager_grpc_service_proto_rawDesc = []byte{ 0x0a, 0x1d, 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x15, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, 0x6d, - 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x1a, 0x1b, 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, - 0x65, 0x72, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x1a, 0x18, 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, 0xe4, 0x02, - 0x0a, 0x0f, 0x41, 0x64, 0x64, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x12, 0x3f, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x2b, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, - 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x41, 0x64, 0x64, 0x43, 0x68, 0x61, 0x69, 0x6e, - 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, 0x76, 0x0a, 0x04, - 0x42, 0x6f, 0x64, 0x79, 0x12, 0x3a, 0x0a, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, - 0x32, 0x2e, 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x43, 0x68, 0x61, - 0x69, 0x6e, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x52, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, - 0x12, 0x32, 0x0a, 0x05, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x1c, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, - 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x52, 0x05, 0x63, - 0x68, 0x61, 0x69, 0x6e, 0x22, 0x93, 0x02, 0x0a, 0x10, 0x41, 0x64, 0x64, 0x43, 0x68, 0x61, 0x69, - 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x40, 0x0a, 0x04, 0x62, 0x6f, 0x64, - 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, - 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, - 0x41, 0x64, 0x64, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x46, 0x0a, 0x0b, 0x6d, + 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x1a, 0x14, 0x61, 0x70, 0x65, 0x2f, 0x67, 0x72, 0x70, 0x63, + 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x18, 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, 0xd6, 0x02, 0x0a, 0x0f, 0x41, 0x64, 0x64, 0x43, 0x68, + 0x61, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x3f, 0x0a, 0x04, 0x62, 0x6f, + 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, + 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, + 0x2e, 0x41, 0x64, 0x64, 0x43, 0x68, 0x61, 0x69, 0x6e, 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, 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, 0x21, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, - 0x19, 0x0a, 0x08, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0c, 0x52, 0x07, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x49, 0x64, 0x22, 0xd1, 0x02, 0x0a, 0x12, 0x52, - 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x12, 0x42, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x2e, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, - 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x43, 0x68, - 0x61, 0x69, 0x6e, 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, - 0x5d, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x3a, 0x0a, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, - 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, - 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, - 0x43, 0x68, 0x61, 0x69, 0x6e, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x52, 0x06, 0x74, 0x61, 0x72, - 0x67, 0x65, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x5f, 0x69, 0x64, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x49, 0x64, 0x22, 0xfe, - 0x01, 0x0a, 0x13, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x43, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, - 0x32, 0x2e, 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x6d, - 0x6f, 0x76, 0x65, 0x43, 0x68, 0x61, 0x69, 0x6e, 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, 0x06, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x22, - 0xb4, 0x02, 0x0a, 0x11, 0x4c, 0x69, 0x73, 0x74, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x73, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x41, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, - 0x2e, 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x4c, 0x69, 0x73, 0x74, - 0x43, 0x68, 0x61, 0x69, 0x6e, 0x73, 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, + 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, 0x68, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x33, 0x0a, + 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, + 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, 0x2e, 0x43, + 0x68, 0x61, 0x69, 0x6e, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x52, 0x06, 0x74, 0x61, 0x72, 0x67, + 0x65, 0x74, 0x12, 0x2b, 0x0a, 0x05, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x15, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, + 0x70, 0x65, 0x2e, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x52, 0x05, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x22, + 0x93, 0x02, 0x0a, 0x10, 0x41, 0x64, 0x64, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x40, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, + 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x41, 0x64, 0x64, 0x43, 0x68, + 0x61, 0x69, 0x6e, 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, 0x42, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x3a, 0x0a, 0x06, 0x74, 0x61, - 0x72, 0x67, 0x65, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x66, 0x72, 0x6f, + 0x65, 0x72, 0x1a, 0x21, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x19, 0x0a, 0x08, 0x63, 0x68, + 0x61, 0x69, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x63, 0x68, + 0x61, 0x69, 0x6e, 0x49, 0x64, 0x22, 0xca, 0x02, 0x0a, 0x12, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, + 0x43, 0x68, 0x61, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x42, 0x0a, 0x04, + 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2e, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, - 0x65, 0x72, 0x2e, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x52, 0x06, - 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x22, 0xb2, 0x02, 0x0a, 0x12, 0x4c, 0x69, 0x73, 0x74, 0x43, - 0x68, 0x61, 0x69, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x42, 0x0a, - 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2e, 0x2e, 0x66, 0x72, - 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61, - 0x67, 0x65, 0x72, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x73, 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, 0x3c, 0x0a, - 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x34, 0x0a, 0x06, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x73, 0x18, - 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, - 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x43, 0x68, - 0x61, 0x69, 0x6e, 0x52, 0x06, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x73, 0x32, 0xb9, 0x02, 0x0a, 0x11, - 0x41, 0x50, 0x45, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, - 0x65, 0x12, 0x5b, 0x0a, 0x08, 0x41, 0x64, 0x64, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x12, 0x26, 0x2e, - 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, 0x6d, 0x61, - 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x41, 0x64, 0x64, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x27, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, - 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x41, 0x64, - 0x64, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x64, - 0x0a, 0x0b, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x12, 0x29, 0x2e, - 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, 0x6d, 0x61, - 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x43, 0x68, 0x61, 0x69, - 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2a, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, + 0x65, 0x72, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x43, 0x68, 0x61, 0x69, 0x6e, 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, 0x56, 0x0a, 0x04, 0x42, 0x6f, + 0x64, 0x79, 0x12, 0x33, 0x0a, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, + 0x61, 0x70, 0x65, 0x2e, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x52, + 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x63, 0x68, 0x61, 0x69, 0x6e, + 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x63, 0x68, 0x61, 0x69, 0x6e, + 0x49, 0x64, 0x22, 0xfe, 0x01, 0x0a, 0x13, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x43, 0x68, 0x61, + 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x43, 0x0a, 0x04, 0x62, 0x6f, + 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x61, 0x0a, 0x0a, 0x4c, 0x69, 0x73, 0x74, 0x43, 0x68, 0x61, 0x69, - 0x6e, 0x73, 0x12, 0x28, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, + 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, 0x06, 0x0a, 0x04, 0x42, + 0x6f, 0x64, 0x79, 0x22, 0xad, 0x02, 0x0a, 0x11, 0x4c, 0x69, 0x73, 0x74, 0x43, 0x68, 0x61, 0x69, + 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x41, 0x0a, 0x04, 0x62, 0x6f, 0x64, + 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, + 0x4c, 0x69, 0x73, 0x74, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x73, 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, 0x3b, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x33, + 0x0a, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, + 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, 0x2e, + 0x43, 0x68, 0x61, 0x69, 0x6e, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x52, 0x06, 0x74, 0x61, 0x72, + 0x67, 0x65, 0x74, 0x22, 0xab, 0x02, 0x0a, 0x12, 0x4c, 0x69, 0x73, 0x74, 0x43, 0x68, 0x61, 0x69, + 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x42, 0x0a, 0x04, 0x62, 0x6f, + 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2e, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, + 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, + 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x73, 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, 0x35, 0x0a, 0x04, 0x42, 0x6f, + 0x64, 0x79, 0x12, 0x2d, 0x0a, 0x06, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, + 0x61, 0x70, 0x65, 0x2e, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x52, 0x06, 0x63, 0x68, 0x61, 0x69, 0x6e, + 0x73, 0x32, 0xb9, 0x02, 0x0a, 0x11, 0x41, 0x50, 0x45, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, + 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x5b, 0x0a, 0x08, 0x41, 0x64, 0x64, 0x43, 0x68, + 0x61, 0x69, 0x6e, 0x12, 0x26, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x41, 0x64, 0x64, 0x43, + 0x68, 0x61, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x27, 0x2e, 0x66, 0x72, + 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61, + 0x67, 0x65, 0x72, 0x2e, 0x41, 0x64, 0x64, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x64, 0x0a, 0x0b, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x43, 0x68, + 0x61, 0x69, 0x6e, 0x12, 0x29, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x6d, 0x6f, + 0x76, 0x65, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2a, + 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, 0x6d, + 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x43, 0x68, 0x61, + 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x61, 0x0a, 0x0a, 0x4c, 0x69, + 0x73, 0x74, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x73, 0x12, 0x28, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, + 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, + 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x29, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x43, - 0x68, 0x61, 0x69, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x29, 0x2e, 0x66, - 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, - 0x61, 0x67, 0x65, 0x72, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x73, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x4c, 0x5a, 0x4a, 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, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x61, 0x70, 0x65, 0x6d, 0x61, - 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x61, 0x70, 0x65, 0x6d, 0x61, - 0x6e, 0x61, 0x67, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x68, 0x61, 0x69, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x4c, 0x5a, + 0x4a, 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, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, + 0x2f, 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2f, 0x67, 0x72, 0x70, 0x63, + 0x3b, 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, } var ( @@ -918,8 +917,8 @@ var file_apemanager_grpc_service_proto_goTypes = []interface{}{ (*grpc.RequestVerificationHeader)(nil), // 13: neo.fs.v2.session.RequestVerificationHeader (*grpc.ResponseMetaHeader)(nil), // 14: neo.fs.v2.session.ResponseMetaHeader (*grpc.ResponseVerificationHeader)(nil), // 15: neo.fs.v2.session.ResponseVerificationHeader - (*ChainTarget)(nil), // 16: frostfs.v2.apemanager.ChainTarget - (*Chain)(nil), // 17: frostfs.v2.apemanager.Chain + (*grpc1.ChainTarget)(nil), // 16: frostfs.v2.ape.ChainTarget + (*grpc1.Chain)(nil), // 17: frostfs.v2.ape.Chain } var file_apemanager_grpc_service_proto_depIdxs = []int32{ 6, // 0: frostfs.v2.apemanager.AddChainRequest.body:type_name -> frostfs.v2.apemanager.AddChainRequest.Body @@ -940,11 +939,11 @@ var file_apemanager_grpc_service_proto_depIdxs = []int32{ 11, // 15: frostfs.v2.apemanager.ListChainsResponse.body:type_name -> frostfs.v2.apemanager.ListChainsResponse.Body 14, // 16: frostfs.v2.apemanager.ListChainsResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader 15, // 17: frostfs.v2.apemanager.ListChainsResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader - 16, // 18: frostfs.v2.apemanager.AddChainRequest.Body.target:type_name -> frostfs.v2.apemanager.ChainTarget - 17, // 19: frostfs.v2.apemanager.AddChainRequest.Body.chain:type_name -> frostfs.v2.apemanager.Chain - 16, // 20: frostfs.v2.apemanager.RemoveChainRequest.Body.target:type_name -> frostfs.v2.apemanager.ChainTarget - 16, // 21: frostfs.v2.apemanager.ListChainsRequest.Body.target:type_name -> frostfs.v2.apemanager.ChainTarget - 17, // 22: frostfs.v2.apemanager.ListChainsResponse.Body.chains:type_name -> frostfs.v2.apemanager.Chain + 16, // 18: frostfs.v2.apemanager.AddChainRequest.Body.target:type_name -> frostfs.v2.ape.ChainTarget + 17, // 19: frostfs.v2.apemanager.AddChainRequest.Body.chain:type_name -> frostfs.v2.ape.Chain + 16, // 20: frostfs.v2.apemanager.RemoveChainRequest.Body.target:type_name -> frostfs.v2.ape.ChainTarget + 16, // 21: frostfs.v2.apemanager.ListChainsRequest.Body.target:type_name -> frostfs.v2.ape.ChainTarget + 17, // 22: frostfs.v2.apemanager.ListChainsResponse.Body.chains:type_name -> frostfs.v2.ape.Chain 0, // 23: frostfs.v2.apemanager.APEManagerService.AddChain:input_type -> frostfs.v2.apemanager.AddChainRequest 2, // 24: frostfs.v2.apemanager.APEManagerService.RemoveChain:input_type -> frostfs.v2.apemanager.RemoveChainRequest 4, // 25: frostfs.v2.apemanager.APEManagerService.ListChains:input_type -> frostfs.v2.apemanager.ListChainsRequest @@ -963,7 +962,6 @@ func file_apemanager_grpc_service_proto_init() { if File_apemanager_grpc_service_proto != nil { return } - file_apemanager_grpc_types_proto_init() if !protoimpl.UnsafeEnabled { file_apemanager_grpc_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*AddChainRequest); i { diff --git a/apemanager/marshal.go b/apemanager/marshal.go index 22e092e..7217709 100644 --- a/apemanager/marshal.go +++ b/apemanager/marshal.go @@ -1,19 +1,12 @@ package apemanager import ( - "fmt" - apemanager "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/apemanager/grpc" "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message" "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/proto" ) const ( - chainTargetTargetTypeField = 1 - chainTargetNameField = 2 - - chainRawField = 1 - addChainReqBodyTargetField = 1 addChainReqBodyChainField = 2 @@ -31,82 +24,6 @@ const ( listChainsRespBodyChainsField = 1 ) -func (t *ChainTarget) StableSize() (size int) { - if t == nil { - return 0 - } - - size += proto.EnumSize(chainTargetTargetTypeField, int32(t.targeType)) - size += proto.StringSize(chainTargetNameField, t.name) - - return size -} - -func (t *ChainTarget) StableMarshal(buf []byte) []byte { - if t == nil { - return []byte{} - } - - if buf == nil { - buf = make([]byte, t.StableSize()) - } - - var offset int - - offset += proto.EnumMarshal(chainTargetTargetTypeField, buf[offset:], int32(t.targeType)) - proto.StringMarshal(chainTargetNameField, buf[offset:], t.name) - - return buf -} - -func (t *ChainTarget) Unmarshal(data []byte) error { - return message.Unmarshal(t, data, new(apemanager.ChainTarget)) -} - -func (c *Chain) StableSize() (size int) { - if c == nil { - return 0 - } - - switch v := c.GetKind().(type) { - case *ChainRaw: - if v != nil { - size += proto.BytesSize(chainRawField, v.GetRaw()) - } - default: - panic(fmt.Sprintf("unsupported chain kind: %T", v)) - } - - return size -} - -func (c *Chain) StableMarshal(buf []byte) []byte { - if c == nil { - return []byte{} - } - - if buf == nil { - buf = make([]byte, c.StableSize()) - } - - var offset int - - switch v := c.GetKind().(type) { - case *ChainRaw: - if v != nil { - proto.BytesMarshal(chainRawField, buf[offset:], v.GetRaw()) - } - default: - panic(fmt.Sprintf("unsupported chain kind: %T", v)) - } - - return buf -} - -func (c *Chain) Unmarshal(data []byte) error { - return message.Unmarshal(c, data, new(apemanager.Chain)) -} - func (rb *AddChainRequestBody) StableSize() (size int) { if rb == nil { return 0 diff --git a/apemanager/message_test.go b/apemanager/message_test.go index 2d623d5..fc4d905 100644 --- a/apemanager/message_test.go +++ b/apemanager/message_test.go @@ -10,7 +10,6 @@ import ( func TestMessageConvert(t *testing.T) { messagetest.TestRPCMessage(t, - func(empty bool) message.Message { return apemanagertest.GenerateChainTarget(empty) }, func(empty bool) message.Message { return apemanagertest.GenerateAddChainRequestBody(empty) }, func(empty bool) message.Message { return apemanagertest.GenerateAddChainRequest(empty) }, func(empty bool) message.Message { return apemanagertest.GenerateAddChainResponseBody(empty) }, diff --git a/apemanager/test/generate.go b/apemanager/test/generate.go index 00dd236..192f7ad 100644 --- a/apemanager/test/generate.go +++ b/apemanager/test/generate.go @@ -1,6 +1,7 @@ package apemanagertest import ( + apetest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/ape/test" "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/apemanager" sessiontest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session/test" ) @@ -13,78 +14,12 @@ func generateChainID(empty bool) []byte { return []byte("616c6c6f774f626a476574436e72") } -func generateRawChains(empty bool, n int) []*apemanager.Chain { - if empty { - return []*apemanager.Chain{} - } - - res := make([]*apemanager.Chain, n) - for i := range res { - res[i] = generateRawChain(empty) - } - return res -} - -func generateRawChain(empty bool) *apemanager.Chain { - chRaw := new(apemanager.ChainRaw) - - if empty { - chRaw.SetRaw([]byte("{}")) - } else { - chRaw.SetRaw([]byte(`{ - "ID": "", - "Rules": [ - { - "Status": "Allow", - "Actions": { - "Inverted": false, - "Names": [ - "GetObject" - ] - }, - "Resources": { - "Inverted": false, - "Names": [ - "native:object/*" - ] - }, - "Any": false, - "Condition": [ - { - "Op": "StringEquals", - "Object": "Resource", - "Key": "Department", - "Value": "HR" - } - ] - } - ], - "MatchType": "DenyPriority" - }`)) - } - - ch := new(apemanager.Chain) - ch.SetKind(chRaw) - return ch -} - -func GenerateChainTarget(empty bool) *apemanager.ChainTarget { - m := new(apemanager.ChainTarget) - - if !empty { - m.SetTargetType(apemanager.TargetTypeContainer) - m.SetName("BzQw5HH3feoxFDD5tCT87Y1726qzgLfxEE7wgtoRzB3R") - } - - return m -} - func GenerateAddChainRequestBody(empty bool) *apemanager.AddChainRequestBody { m := new(apemanager.AddChainRequestBody) if !empty { - m.SetTarget(GenerateChainTarget(empty)) - m.SetChain(generateRawChain(empty)) + m.SetTarget(apetest.GenerateChainTarget(empty)) + m.SetChain(apetest.GenerateRawChain(empty)) } return m @@ -129,7 +64,7 @@ func GenerateRemoveChainRequestBody(empty bool) *apemanager.RemoveChainRequestBo if !empty { m.SetChainID(generateChainID(empty)) - m.SetTarget(GenerateChainTarget(empty)) + m.SetTarget(apetest.GenerateChainTarget(empty)) } return m @@ -167,7 +102,7 @@ func GenerateListChainsRequestBody(empty bool) *apemanager.ListChainsRequestBody m := new(apemanager.ListChainsRequestBody) if !empty { - m.SetTarget(GenerateChainTarget(empty)) + m.SetTarget(apetest.GenerateChainTarget(empty)) } return m @@ -189,7 +124,7 @@ func GenerateListChainsResponseBody(empty bool) *apemanager.ListChainsResponseBo m := new(apemanager.ListChainsResponseBody) if !empty { - m.SetChains(generateRawChains(empty, 10)) + m.SetChains(apetest.GenerateRawChains(empty, 10)) } return m diff --git a/apemanager/types.go b/apemanager/types.go index 1fcca29..6896bf1 100644 --- a/apemanager/types.go +++ b/apemanager/types.go @@ -1,49 +1,10 @@ package apemanager import ( + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/ape" "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session" ) -type TargetType uint32 - -const ( - TargetTypeUndefined TargetType = iota - TargetTypeNamespace - TargetTypeContainer - TargetTypeUser - TargetTypeGroup -) - -type ChainTarget struct { - targeType TargetType - - name string -} - -func (ct *ChainTarget) SetTargetType(targeType TargetType) { - ct.targeType = targeType -} - -func (ct *ChainTarget) SetName(name string) { - ct.name = name -} - -func (ct *ChainTarget) GetTargetType() TargetType { - if ct != nil { - return ct.targeType - } - - return 0 -} - -func (ct *ChainTarget) GetName() string { - if ct != nil { - return ct.name - } - - return "" -} - type AddChainRequest struct { body *AddChainRequestBody @@ -58,55 +19,25 @@ func (r *AddChainRequest) GetBody() *AddChainRequestBody { return r.body } -type chainKind interface { - isChainKind() -} - -type Chain struct { - kind chainKind -} - -func (c *Chain) SetKind(kind chainKind) { - c.kind = kind -} - -func (c *Chain) GetKind() chainKind { - return c.kind -} - -type ChainRaw struct { - Raw []byte -} - -func (*ChainRaw) isChainKind() {} - -func (c *ChainRaw) SetRaw(raw []byte) { - c.Raw = raw -} - -func (c *ChainRaw) GetRaw() []byte { - return c.Raw -} - type AddChainRequestBody struct { - target *ChainTarget + target *ape.ChainTarget - chain *Chain + chain *ape.Chain } -func (rb *AddChainRequestBody) SetTarget(target *ChainTarget) { +func (rb *AddChainRequestBody) SetTarget(target *ape.ChainTarget) { rb.target = target } -func (rb *AddChainRequestBody) GetTarget() *ChainTarget { +func (rb *AddChainRequestBody) GetTarget() *ape.ChainTarget { return rb.target } -func (rb *AddChainRequestBody) SetChain(chain *Chain) { +func (rb *AddChainRequestBody) SetChain(chain *ape.Chain) { rb.chain = chain } -func (rb *AddChainRequestBody) GetChain() *Chain { +func (rb *AddChainRequestBody) GetChain() *ape.Chain { return rb.chain } @@ -151,16 +82,16 @@ func (r *RemoveChainRequest) GetBody() *RemoveChainRequestBody { } type RemoveChainRequestBody struct { - target *ChainTarget + target *ape.ChainTarget chainID []byte } -func (rb *RemoveChainRequestBody) SetTarget(target *ChainTarget) { +func (rb *RemoveChainRequestBody) SetTarget(target *ape.ChainTarget) { rb.target = target } -func (rb *RemoveChainRequestBody) GetTarget() *ChainTarget { +func (rb *RemoveChainRequestBody) GetTarget() *ape.ChainTarget { return rb.target } @@ -204,14 +135,14 @@ func (r *ListChainsRequest) GetBody() *ListChainsRequestBody { } type ListChainsRequestBody struct { - target *ChainTarget + target *ape.ChainTarget } -func (rb *ListChainsRequestBody) SetTarget(target *ChainTarget) { +func (rb *ListChainsRequestBody) SetTarget(target *ape.ChainTarget) { rb.target = target } -func (rb *ListChainsRequestBody) GetTarget() *ChainTarget { +func (rb *ListChainsRequestBody) GetTarget() *ape.ChainTarget { return rb.target } @@ -230,15 +161,15 @@ func (r *ListChainsResponse) GetBody() *ListChainsResponseBody { } type ListChainsResponseBody struct { - chains []*Chain + chains []*ape.Chain session.RequestHeaders } -func (r *ListChainsResponseBody) SetChains(chains []*Chain) { +func (r *ListChainsResponseBody) SetChains(chains []*ape.Chain) { r.chains = chains } -func (r *ListChainsResponseBody) GetChains() []*Chain { +func (r *ListChainsResponseBody) GetChains() []*ape.Chain { return r.chains } From 9e825239ac5f57c27cef2ca5291a17ea7f1e4202 Mon Sep 17 00:00:00 2001 From: Airat Arifullin Date: Tue, 28 May 2024 11:54:38 +0300 Subject: [PATCH 1129/1196] [#85] acl: Regenerate protobufs for Bearer token Signed-off-by: Airat Arifullin --- acl/convert.go | 65 ++++++++- acl/grpc/types.go | 13 ++ acl/grpc/types.pb.go | 338 ++++++++++++++++++++++++++++--------------- acl/json.go | 8 + acl/marshal.go | 52 ++++++- acl/test/generate.go | 15 +- acl/types.go | 41 +++++- 7 files changed, 408 insertions(+), 124 deletions(-) diff --git a/acl/convert.go b/acl/convert.go index 342c110..0cf455c 100644 --- a/acl/convert.go +++ b/acl/convert.go @@ -2,6 +2,8 @@ package acl import ( acl "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/acl/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/ape" + apeGRPC "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/ape/grpc" "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" refsGRPC "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc" "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/grpc" @@ -418,6 +420,54 @@ func (l *TokenLifetime) FromGRPCMessage(m grpc.Message) error { return nil } +func (c *APEOverride) ToGRPCMessage() grpc.Message { + var m *acl.BearerToken_Body_APEOverride + + if c != nil { + m = new(acl.BearerToken_Body_APEOverride) + + m.SetTarget(c.target.ToGRPCMessage().(*apeGRPC.ChainTarget)) + + if len(c.chains) > 0 { + apeChains := make([]*apeGRPC.Chain, len(c.chains)) + for i := range c.chains { + apeChains[i] = c.chains[i].ToGRPCMessage().(*apeGRPC.Chain) + } + m.SetChains(apeChains) + } + } + + return m +} + +func (c *APEOverride) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*acl.BearerToken_Body_APEOverride) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + if targetGRPC := v.GetTarget(); targetGRPC != nil { + if c.target == nil { + c.target = new(ape.ChainTarget) + } + if err := c.target.FromGRPCMessage(v.GetTarget()); err != nil { + return err + } + } + + if apeChains := v.GetChains(); len(apeChains) > 0 { + 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 { + return err + } + } + } + + return nil +} + func (bt *BearerTokenBody) ToGRPCMessage() grpc.Message { var m *acl.BearerToken_Body @@ -428,6 +478,7 @@ func (bt *BearerTokenBody) ToGRPCMessage() grpc.Message { m.SetLifetime(bt.lifetime.ToGRPCMessage().(*acl.BearerToken_Body_TokenLifetime)) m.SetEaclTable(bt.eacl.ToGRPCMessage().(*acl.EACLTable)) m.SetAllowImpersonate(bt.impersonate) + m.SetAPEOverride(bt.apeOverride.ToGRPCMessage().(*acl.BearerToken_Body_APEOverride)) } return m @@ -477,7 +528,19 @@ func (bt *BearerTokenBody) FromGRPCMessage(m grpc.Message) error { bt.eacl = new(Table) } - err = bt.eacl.FromGRPCMessage(eacl) + if err = bt.eacl.FromGRPCMessage(eacl); err != nil { + return err + } + } + + if apeOverrideGRPC := v.GetApeOverride(); apeOverrideGRPC != nil { + if bt.apeOverride == nil { + bt.apeOverride = new(APEOverride) + } + err = bt.apeOverride.FromGRPCMessage(apeOverrideGRPC) + if err != nil { + return err + } } bt.impersonate = v.GetAllowImpersonate() diff --git a/acl/grpc/types.go b/acl/grpc/types.go index ce50e2f..fbcbb91 100644 --- a/acl/grpc/types.go +++ b/acl/grpc/types.go @@ -1,6 +1,7 @@ package acl import ( + ape "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/ape/grpc" refs "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc" ) @@ -74,6 +75,18 @@ func (m *BearerToken_Body) SetEaclTable(v *EACLTable) { m.EaclTable = v } +func (m *BearerToken_Body) SetAPEOverride(v *BearerToken_Body_APEOverride) { + m.ApeOverride = v +} + +func (m *BearerToken_Body_APEOverride) SetChains(v []*ape.Chain) { + m.Chains = v +} + +func (m *BearerToken_Body_APEOverride) SetTarget(v *ape.ChainTarget) { + m.Target = v +} + // SetOwnerId sets identifier of the bearer token owner. func (m *BearerToken_Body) SetOwnerId(v *refs.OwnerID) { m.OwnerId = v diff --git a/acl/grpc/types.pb.go b/acl/grpc/types.pb.go index 1b57b1a..aec449c 100644 --- a/acl/grpc/types.pb.go +++ b/acl/grpc/types.pb.go @@ -7,6 +7,7 @@ package acl import ( + grpc1 "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/ape/grpc" grpc "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" @@ -707,6 +708,8 @@ type BearerToken_Body struct { // container. If it contains `container_id` field, bearer token is only // valid for this specific container. Otherwise, any container of the same // owner is allowed. + // + // Deprecated: eACL tables are no longer relevant - `APEOverrides` should be used instead. EaclTable *EACLTable `protobuf:"bytes,1,opt,name=eacl_table,json=eaclTable,proto3" json:"eacl_table,omitempty"` // `OwnerID` defines to whom the token was issued. It must match the request // originator's `OwnerID`. If empty, any token bearer will be accepted. @@ -716,6 +719,8 @@ type BearerToken_Body struct { // AllowImpersonate flag to consider token signer as request owner. // If this field is true extended ACL table in token body isn't processed. AllowImpersonate bool `protobuf:"varint,4,opt,name=allow_impersonate,json=allowImpersonate,proto3" json:"allow_impersonate,omitempty"` + // APE override for the target. + ApeOverride *BearerToken_Body_APEOverride `protobuf:"bytes,5,opt,name=ape_override,json=apeOverride,proto3" json:"ape_override,omitempty"` } func (x *BearerToken_Body) Reset() { @@ -778,6 +783,13 @@ func (x *BearerToken_Body) GetAllowImpersonate() bool { return false } +func (x *BearerToken_Body) GetApeOverride() *BearerToken_Body_APEOverride { + if x != nil { + return x.ApeOverride + } + return nil +} + // Lifetime parameters of the token. Field names taken from // [rfc7519](https://tools.ietf.org/html/rfc7519). type BearerToken_Body_TokenLifetime struct { @@ -846,113 +858,189 @@ func (x *BearerToken_Body_TokenLifetime) GetIat() uint64 { return 0 } +// APEOverride is the list of APE chains defined for a target. +// These chains are meant to serve as overrides to the already defined (or even undefined) +// APE chains for the target (see contract `Policy`). +// +// The server-side processing of the bearer token with set APE overrides must verify if a client is permitted +// to override chains for the target, preventing unauthorized access through the APE mechanism. +type BearerToken_Body_APEOverride struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Target for which chains are applied. + Target *grpc1.ChainTarget `protobuf:"bytes,1,opt,name=target,proto3" json:"target,omitempty"` + // The list of APE chains. + Chains []*grpc1.Chain `protobuf:"bytes,2,rep,name=chains,proto3" json:"chains,omitempty"` +} + +func (x *BearerToken_Body_APEOverride) Reset() { + *x = BearerToken_Body_APEOverride{} + if protoimpl.UnsafeEnabled { + mi := &file_acl_grpc_types_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *BearerToken_Body_APEOverride) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BearerToken_Body_APEOverride) ProtoMessage() {} + +func (x *BearerToken_Body_APEOverride) ProtoReflect() protoreflect.Message { + mi := &file_acl_grpc_types_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use BearerToken_Body_APEOverride.ProtoReflect.Descriptor instead. +func (*BearerToken_Body_APEOverride) Descriptor() ([]byte, []int) { + return file_acl_grpc_types_proto_rawDescGZIP(), []int{2, 0, 1} +} + +func (x *BearerToken_Body_APEOverride) GetTarget() *grpc1.ChainTarget { + if x != nil { + return x.Target + } + return nil +} + +func (x *BearerToken_Body_APEOverride) GetChains() []*grpc1.Chain { + if x != nil { + return x.Chains + } + return nil +} + var File_acl_grpc_types_proto protoreflect.FileDescriptor var file_acl_grpc_types_proto_rawDesc = []byte{ 0x0a, 0x14, 0x61, 0x63, 0x6c, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0d, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x1a, 0x15, 0x72, 0x65, 0x66, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, - 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xda, 0x03, 0x0a, - 0x0a, 0x45, 0x41, 0x43, 0x4c, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x12, 0x36, 0x0a, 0x09, 0x6f, - 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x18, - 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x4f, - 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x09, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x12, 0x2d, 0x0a, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0e, 0x32, 0x15, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, - 0x61, 0x63, 0x6c, 0x2e, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x06, 0x61, 0x63, 0x74, 0x69, - 0x6f, 0x6e, 0x12, 0x3a, 0x0a, 0x07, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x73, 0x18, 0x03, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, - 0x61, 0x63, 0x6c, 0x2e, 0x45, 0x41, 0x43, 0x4c, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x2e, 0x46, - 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x07, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x73, 0x12, 0x3a, - 0x0a, 0x07, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, - 0x45, 0x41, 0x43, 0x4c, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x2e, 0x54, 0x61, 0x72, 0x67, 0x65, - 0x74, 0x52, 0x07, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x1a, 0xa5, 0x01, 0x0a, 0x06, 0x46, - 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x3a, 0x0a, 0x0b, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x5f, - 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, - 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, - 0x72, 0x54, 0x79, 0x70, 0x65, 0x52, 0x0a, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x54, 0x79, 0x70, - 0x65, 0x12, 0x37, 0x0a, 0x0a, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, - 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x54, 0x79, 0x70, 0x65, 0x52, - 0x09, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x54, 0x79, 0x70, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, - 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x1a, 0x45, 0x0a, 0x06, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x12, 0x27, 0x0a, 0x04, - 0x72, 0x6f, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x13, 0x2e, 0x6e, 0x65, 0x6f, - 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x52, 0x6f, 0x6c, 0x65, 0x52, - 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6b, 0x65, 0x79, 0x73, 0x18, 0x02, 0x20, - 0x03, 0x28, 0x0c, 0x52, 0x04, 0x6b, 0x65, 0x79, 0x73, 0x22, 0xb3, 0x01, 0x0a, 0x09, 0x45, 0x41, - 0x43, 0x4c, 0x54, 0x61, 0x62, 0x6c, 0x65, 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, 0x3e, 0x0a, 0x0c, 0x63, 0x6f, - 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, - 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x52, 0x0b, 0x63, - 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x12, 0x33, 0x0a, 0x07, 0x72, 0x65, - 0x63, 0x6f, 0x72, 0x64, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, - 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x45, 0x41, 0x43, 0x4c, - 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x07, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x22, - 0xb0, 0x03, 0x0a, 0x0b, 0x42, 0x65, 0x61, 0x72, 0x65, 0x72, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, - 0x33, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, - 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x42, 0x65, - 0x61, 0x72, 0x65, 0x72, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, - 0x62, 0x6f, 0x64, 0x79, 0x12, 0x37, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, - 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, - 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, - 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x1a, 0xb2, 0x02, - 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x37, 0x0a, 0x0a, 0x65, 0x61, 0x63, 0x6c, 0x5f, 0x74, - 0x61, 0x62, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, - 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x45, 0x41, 0x43, 0x4c, 0x54, - 0x61, 0x62, 0x6c, 0x65, 0x52, 0x09, 0x65, 0x61, 0x63, 0x6c, 0x54, 0x61, 0x62, 0x6c, 0x65, 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, 0x49, 0x0a, 0x08, 0x6c, 0x69, 0x66, 0x65, 0x74, 0x69, 0x6d, 0x65, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, - 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x42, 0x65, 0x61, 0x72, 0x65, 0x72, 0x54, 0x6f, 0x6b, 0x65, - 0x6e, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x2e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x4c, 0x69, 0x66, 0x65, - 0x74, 0x69, 0x6d, 0x65, 0x52, 0x08, 0x6c, 0x69, 0x66, 0x65, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x2b, - 0x0a, 0x11, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x5f, 0x69, 0x6d, 0x70, 0x65, 0x72, 0x73, 0x6f, 0x6e, - 0x61, 0x74, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x61, 0x6c, 0x6c, 0x6f, 0x77, - 0x49, 0x6d, 0x70, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x61, 0x74, 0x65, 0x1a, 0x45, 0x0a, 0x0d, 0x54, - 0x6f, 0x6b, 0x65, 0x6e, 0x4c, 0x69, 0x66, 0x65, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, - 0x65, 0x78, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x65, 0x78, 0x70, 0x12, 0x10, - 0x0a, 0x03, 0x6e, 0x62, 0x66, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x6e, 0x62, 0x66, - 0x12, 0x10, 0x0a, 0x03, 0x69, 0x61, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x69, - 0x61, 0x74, 0x2a, 0x3e, 0x0a, 0x04, 0x52, 0x6f, 0x6c, 0x65, 0x12, 0x14, 0x0a, 0x10, 0x52, 0x4f, - 0x4c, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, - 0x12, 0x08, 0x0a, 0x04, 0x55, 0x53, 0x45, 0x52, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x53, 0x59, - 0x53, 0x54, 0x45, 0x4d, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x4f, 0x54, 0x48, 0x45, 0x52, 0x53, - 0x10, 0x03, 0x2a, 0x4f, 0x0a, 0x09, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x54, 0x79, 0x70, 0x65, 0x12, - 0x1a, 0x0a, 0x16, 0x4d, 0x41, 0x54, 0x43, 0x48, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, - 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x10, 0x0a, 0x0c, 0x53, - 0x54, 0x52, 0x49, 0x4e, 0x47, 0x5f, 0x45, 0x51, 0x55, 0x41, 0x4c, 0x10, 0x01, 0x12, 0x14, 0x0a, - 0x10, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x45, 0x51, 0x55, 0x41, - 0x4c, 0x10, 0x02, 0x2a, 0x7a, 0x0a, 0x09, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x12, 0x19, 0x0a, 0x15, 0x4f, 0x50, 0x45, 0x52, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, - 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x47, - 0x45, 0x54, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x48, 0x45, 0x41, 0x44, 0x10, 0x02, 0x12, 0x07, - 0x0a, 0x03, 0x50, 0x55, 0x54, 0x10, 0x03, 0x12, 0x0a, 0x0a, 0x06, 0x44, 0x45, 0x4c, 0x45, 0x54, - 0x45, 0x10, 0x04, 0x12, 0x0a, 0x0a, 0x06, 0x53, 0x45, 0x41, 0x52, 0x43, 0x48, 0x10, 0x05, 0x12, - 0x0c, 0x0a, 0x08, 0x47, 0x45, 0x54, 0x52, 0x41, 0x4e, 0x47, 0x45, 0x10, 0x06, 0x12, 0x10, 0x0a, - 0x0c, 0x47, 0x45, 0x54, 0x52, 0x41, 0x4e, 0x47, 0x45, 0x48, 0x41, 0x53, 0x48, 0x10, 0x07, 0x2a, - 0x35, 0x0a, 0x06, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x12, 0x41, 0x43, 0x54, - 0x49, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, - 0x00, 0x12, 0x09, 0x0a, 0x05, 0x41, 0x4c, 0x4c, 0x4f, 0x57, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, - 0x44, 0x45, 0x4e, 0x59, 0x10, 0x02, 0x2a, 0x4a, 0x0a, 0x0a, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, - 0x54, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x12, 0x48, 0x45, 0x41, 0x44, 0x45, 0x52, 0x5f, 0x55, - 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, - 0x52, 0x45, 0x51, 0x55, 0x45, 0x53, 0x54, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x4f, 0x42, 0x4a, - 0x45, 0x43, 0x54, 0x10, 0x02, 0x12, 0x0b, 0x0a, 0x07, 0x53, 0x45, 0x52, 0x56, 0x49, 0x43, 0x45, - 0x10, 0x03, 0x42, 0x58, 0x5a, 0x3c, 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, 0x61, 0x70, 0x69, 0x2d, - 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x61, 0x63, 0x6c, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x61, - 0x63, 0x6c, 0xaa, 0x02, 0x17, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, - 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x41, 0x63, 0x6c, 0x62, 0x06, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, + 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x14, 0x61, 0x70, + 0x65, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x22, 0xda, 0x03, 0x0a, 0x0a, 0x45, 0x41, 0x43, 0x4c, 0x52, 0x65, 0x63, 0x6f, 0x72, + 0x64, 0x12, 0x36, 0x0a, 0x09, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x09, + 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2d, 0x0a, 0x06, 0x61, 0x63, 0x74, + 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x15, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, + 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, + 0x52, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3a, 0x0a, 0x07, 0x66, 0x69, 0x6c, 0x74, + 0x65, 0x72, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, + 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x45, 0x41, 0x43, 0x4c, 0x52, 0x65, + 0x63, 0x6f, 0x72, 0x64, 0x2e, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x07, 0x66, 0x69, 0x6c, + 0x74, 0x65, 0x72, 0x73, 0x12, 0x3a, 0x0a, 0x07, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x18, + 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x45, 0x41, 0x43, 0x4c, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, + 0x2e, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x52, 0x07, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, + 0x1a, 0xa5, 0x01, 0x0a, 0x06, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x3a, 0x0a, 0x0b, 0x68, + 0x65, 0x61, 0x64, 0x65, 0x72, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, + 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, + 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x52, 0x0a, 0x68, 0x65, 0x61, + 0x64, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x12, 0x37, 0x0a, 0x0a, 0x6d, 0x61, 0x74, 0x63, 0x68, + 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x6e, 0x65, + 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x4d, 0x61, 0x74, 0x63, + 0x68, 0x54, 0x79, 0x70, 0x65, 0x52, 0x09, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x54, 0x79, 0x70, 0x65, + 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, + 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x1a, 0x45, 0x0a, 0x06, 0x54, 0x61, 0x72, 0x67, + 0x65, 0x74, 0x12, 0x27, 0x0a, 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, + 0x32, 0x13, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, + 0x2e, 0x52, 0x6f, 0x6c, 0x65, 0x52, 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6b, + 0x65, 0x79, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x04, 0x6b, 0x65, 0x79, 0x73, 0x22, + 0xb3, 0x01, 0x0a, 0x09, 0x45, 0x41, 0x43, 0x4c, 0x54, 0x61, 0x62, 0x6c, 0x65, 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, 0x3e, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, + 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, + 0x72, 0x49, 0x44, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, + 0x12, 0x33, 0x0a, 0x07, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, + 0x6c, 0x2e, 0x45, 0x41, 0x43, 0x4c, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x07, 0x72, 0x65, + 0x63, 0x6f, 0x72, 0x64, 0x73, 0x22, 0xf3, 0x04, 0x0a, 0x0b, 0x42, 0x65, 0x61, 0x72, 0x65, 0x72, + 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x33, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, + 0x61, 0x63, 0x6c, 0x2e, 0x42, 0x65, 0x61, 0x72, 0x65, 0x72, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, + 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x37, 0x0a, 0x09, 0x73, 0x69, + 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, + 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, + 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, + 0x75, 0x72, 0x65, 0x1a, 0xf5, 0x03, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x37, 0x0a, 0x0a, + 0x65, 0x61, 0x63, 0x6c, 0x5f, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, + 0x2e, 0x45, 0x41, 0x43, 0x4c, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x52, 0x09, 0x65, 0x61, 0x63, 0x6c, + 0x54, 0x61, 0x62, 0x6c, 0x65, 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, 0x49, 0x0a, 0x08, 0x6c, 0x69, 0x66, + 0x65, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x6e, 0x65, + 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x42, 0x65, 0x61, 0x72, + 0x65, 0x72, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x2e, 0x54, 0x6f, 0x6b, + 0x65, 0x6e, 0x4c, 0x69, 0x66, 0x65, 0x74, 0x69, 0x6d, 0x65, 0x52, 0x08, 0x6c, 0x69, 0x66, 0x65, + 0x74, 0x69, 0x6d, 0x65, 0x12, 0x2b, 0x0a, 0x11, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x5f, 0x69, 0x6d, + 0x70, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x61, 0x74, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, + 0x10, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x49, 0x6d, 0x70, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x61, 0x74, + 0x65, 0x12, 0x4e, 0x0a, 0x0c, 0x61, 0x70, 0x65, 0x5f, 0x6f, 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, + 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, + 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x42, 0x65, 0x61, 0x72, 0x65, 0x72, 0x54, 0x6f, + 0x6b, 0x65, 0x6e, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x2e, 0x41, 0x50, 0x45, 0x4f, 0x76, 0x65, 0x72, + 0x72, 0x69, 0x64, 0x65, 0x52, 0x0b, 0x61, 0x70, 0x65, 0x4f, 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, + 0x65, 0x1a, 0x45, 0x0a, 0x0d, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x4c, 0x69, 0x66, 0x65, 0x74, 0x69, + 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x78, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, + 0x03, 0x65, 0x78, 0x70, 0x12, 0x10, 0x0a, 0x03, 0x6e, 0x62, 0x66, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x04, 0x52, 0x03, 0x6e, 0x62, 0x66, 0x12, 0x10, 0x0a, 0x03, 0x69, 0x61, 0x74, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x04, 0x52, 0x03, 0x69, 0x61, 0x74, 0x1a, 0x71, 0x0a, 0x0b, 0x41, 0x50, 0x45, 0x4f, + 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, 0x65, 0x12, 0x33, 0x0a, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, + 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, 0x2e, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x54, 0x61, + 0x72, 0x67, 0x65, 0x74, 0x52, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x12, 0x2d, 0x0a, 0x06, + 0x63, 0x68, 0x61, 0x69, 0x6e, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x66, + 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, 0x2e, 0x43, 0x68, + 0x61, 0x69, 0x6e, 0x52, 0x06, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x73, 0x2a, 0x3e, 0x0a, 0x04, 0x52, + 0x6f, 0x6c, 0x65, 0x12, 0x14, 0x0a, 0x10, 0x52, 0x4f, 0x4c, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, + 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x55, 0x53, 0x45, + 0x52, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x53, 0x59, 0x53, 0x54, 0x45, 0x4d, 0x10, 0x02, 0x12, + 0x0a, 0x0a, 0x06, 0x4f, 0x54, 0x48, 0x45, 0x52, 0x53, 0x10, 0x03, 0x2a, 0x4f, 0x0a, 0x09, 0x4d, + 0x61, 0x74, 0x63, 0x68, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1a, 0x0a, 0x16, 0x4d, 0x41, 0x54, 0x43, + 0x48, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, + 0x45, 0x44, 0x10, 0x00, 0x12, 0x10, 0x0a, 0x0c, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x5f, 0x45, + 0x51, 0x55, 0x41, 0x4c, 0x10, 0x01, 0x12, 0x14, 0x0a, 0x10, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, + 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x45, 0x51, 0x55, 0x41, 0x4c, 0x10, 0x02, 0x2a, 0x7a, 0x0a, 0x09, + 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x19, 0x0a, 0x15, 0x4f, 0x50, 0x45, + 0x52, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, + 0x45, 0x44, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x47, 0x45, 0x54, 0x10, 0x01, 0x12, 0x08, 0x0a, + 0x04, 0x48, 0x45, 0x41, 0x44, 0x10, 0x02, 0x12, 0x07, 0x0a, 0x03, 0x50, 0x55, 0x54, 0x10, 0x03, + 0x12, 0x0a, 0x0a, 0x06, 0x44, 0x45, 0x4c, 0x45, 0x54, 0x45, 0x10, 0x04, 0x12, 0x0a, 0x0a, 0x06, + 0x53, 0x45, 0x41, 0x52, 0x43, 0x48, 0x10, 0x05, 0x12, 0x0c, 0x0a, 0x08, 0x47, 0x45, 0x54, 0x52, + 0x41, 0x4e, 0x47, 0x45, 0x10, 0x06, 0x12, 0x10, 0x0a, 0x0c, 0x47, 0x45, 0x54, 0x52, 0x41, 0x4e, + 0x47, 0x45, 0x48, 0x41, 0x53, 0x48, 0x10, 0x07, 0x2a, 0x35, 0x0a, 0x06, 0x41, 0x63, 0x74, 0x69, + 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x12, 0x41, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x53, + 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x41, 0x4c, + 0x4c, 0x4f, 0x57, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x44, 0x45, 0x4e, 0x59, 0x10, 0x02, 0x2a, + 0x4a, 0x0a, 0x0a, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, + 0x12, 0x48, 0x45, 0x41, 0x44, 0x45, 0x52, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, + 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x52, 0x45, 0x51, 0x55, 0x45, 0x53, 0x54, + 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x4f, 0x42, 0x4a, 0x45, 0x43, 0x54, 0x10, 0x02, 0x12, 0x0b, + 0x0a, 0x07, 0x53, 0x45, 0x52, 0x56, 0x49, 0x43, 0x45, 0x10, 0x03, 0x42, 0x58, 0x5a, 0x3c, 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, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x61, + 0x63, 0x6c, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x61, 0x63, 0x6c, 0xaa, 0x02, 0x17, 0x4e, 0x65, + 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, + 0x49, 0x2e, 0x41, 0x63, 0x6c, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -968,7 +1056,7 @@ func file_acl_grpc_types_proto_rawDescGZIP() []byte { } var file_acl_grpc_types_proto_enumTypes = make([]protoimpl.EnumInfo, 5) -var file_acl_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 7) +var file_acl_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 8) var file_acl_grpc_types_proto_goTypes = []interface{}{ (Role)(0), // 0: neo.fs.v2.acl.Role (MatchType)(0), // 1: neo.fs.v2.acl.MatchType @@ -982,32 +1070,38 @@ var file_acl_grpc_types_proto_goTypes = []interface{}{ (*EACLRecord_Target)(nil), // 9: neo.fs.v2.acl.EACLRecord.Target (*BearerToken_Body)(nil), // 10: neo.fs.v2.acl.BearerToken.Body (*BearerToken_Body_TokenLifetime)(nil), // 11: neo.fs.v2.acl.BearerToken.Body.TokenLifetime - (*grpc.Version)(nil), // 12: neo.fs.v2.refs.Version - (*grpc.ContainerID)(nil), // 13: neo.fs.v2.refs.ContainerID - (*grpc.Signature)(nil), // 14: neo.fs.v2.refs.Signature - (*grpc.OwnerID)(nil), // 15: neo.fs.v2.refs.OwnerID + (*BearerToken_Body_APEOverride)(nil), // 12: neo.fs.v2.acl.BearerToken.Body.APEOverride + (*grpc.Version)(nil), // 13: neo.fs.v2.refs.Version + (*grpc.ContainerID)(nil), // 14: neo.fs.v2.refs.ContainerID + (*grpc.Signature)(nil), // 15: neo.fs.v2.refs.Signature + (*grpc.OwnerID)(nil), // 16: neo.fs.v2.refs.OwnerID + (*grpc1.ChainTarget)(nil), // 17: frostfs.v2.ape.ChainTarget + (*grpc1.Chain)(nil), // 18: frostfs.v2.ape.Chain } var file_acl_grpc_types_proto_depIdxs = []int32{ 2, // 0: neo.fs.v2.acl.EACLRecord.operation:type_name -> neo.fs.v2.acl.Operation 3, // 1: neo.fs.v2.acl.EACLRecord.action:type_name -> neo.fs.v2.acl.Action 8, // 2: neo.fs.v2.acl.EACLRecord.filters:type_name -> neo.fs.v2.acl.EACLRecord.Filter 9, // 3: neo.fs.v2.acl.EACLRecord.targets:type_name -> neo.fs.v2.acl.EACLRecord.Target - 12, // 4: neo.fs.v2.acl.EACLTable.version:type_name -> neo.fs.v2.refs.Version - 13, // 5: neo.fs.v2.acl.EACLTable.container_id:type_name -> neo.fs.v2.refs.ContainerID + 13, // 4: neo.fs.v2.acl.EACLTable.version:type_name -> neo.fs.v2.refs.Version + 14, // 5: neo.fs.v2.acl.EACLTable.container_id:type_name -> neo.fs.v2.refs.ContainerID 5, // 6: neo.fs.v2.acl.EACLTable.records:type_name -> neo.fs.v2.acl.EACLRecord 10, // 7: neo.fs.v2.acl.BearerToken.body:type_name -> neo.fs.v2.acl.BearerToken.Body - 14, // 8: neo.fs.v2.acl.BearerToken.signature:type_name -> neo.fs.v2.refs.Signature + 15, // 8: neo.fs.v2.acl.BearerToken.signature:type_name -> neo.fs.v2.refs.Signature 4, // 9: neo.fs.v2.acl.EACLRecord.Filter.header_type:type_name -> neo.fs.v2.acl.HeaderType 1, // 10: neo.fs.v2.acl.EACLRecord.Filter.match_type:type_name -> neo.fs.v2.acl.MatchType 0, // 11: neo.fs.v2.acl.EACLRecord.Target.role:type_name -> neo.fs.v2.acl.Role 6, // 12: neo.fs.v2.acl.BearerToken.Body.eacl_table:type_name -> neo.fs.v2.acl.EACLTable - 15, // 13: neo.fs.v2.acl.BearerToken.Body.owner_id:type_name -> neo.fs.v2.refs.OwnerID + 16, // 13: neo.fs.v2.acl.BearerToken.Body.owner_id:type_name -> neo.fs.v2.refs.OwnerID 11, // 14: neo.fs.v2.acl.BearerToken.Body.lifetime:type_name -> neo.fs.v2.acl.BearerToken.Body.TokenLifetime - 15, // [15:15] is the sub-list for method output_type - 15, // [15:15] is the sub-list for method input_type - 15, // [15:15] is the sub-list for extension type_name - 15, // [15:15] is the sub-list for extension extendee - 0, // [0:15] is the sub-list for field type_name + 12, // 15: neo.fs.v2.acl.BearerToken.Body.ape_override:type_name -> neo.fs.v2.acl.BearerToken.Body.APEOverride + 17, // 16: neo.fs.v2.acl.BearerToken.Body.APEOverride.target:type_name -> frostfs.v2.ape.ChainTarget + 18, // 17: neo.fs.v2.acl.BearerToken.Body.APEOverride.chains:type_name -> frostfs.v2.ape.Chain + 18, // [18:18] is the sub-list for method output_type + 18, // [18:18] is the sub-list for method input_type + 18, // [18:18] is the sub-list for extension type_name + 18, // [18:18] is the sub-list for extension extendee + 0, // [0:18] is the sub-list for field type_name } func init() { file_acl_grpc_types_proto_init() } @@ -1100,6 +1194,18 @@ func file_acl_grpc_types_proto_init() { return nil } } + file_acl_grpc_types_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*BearerToken_Body_APEOverride); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } type x struct{} out := protoimpl.TypeBuilder{ @@ -1107,7 +1213,7 @@ func file_acl_grpc_types_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_acl_grpc_types_proto_rawDesc, NumEnums: 5, - NumMessages: 7, + NumMessages: 8, NumExtensions: 0, NumServices: 0, }, diff --git a/acl/json.go b/acl/json.go index 0e2078b..9046555 100644 --- a/acl/json.go +++ b/acl/json.go @@ -21,6 +21,14 @@ func (t *Target) UnmarshalJSON(data []byte) error { return message.UnmarshalJSON(t, data, new(acl.EACLRecord_Target)) } +func (a *APEOverride) MarshalJSON() ([]byte, error) { + return message.MarshalJSON(a) +} + +func (a *APEOverride) UnmarshalJSON(data []byte) error { + return message.UnmarshalJSON(a, data, new(acl.BearerToken_Body_APEOverride)) +} + func (r *Record) MarshalJSON() ([]byte, error) { return message.MarshalJSON(r) } diff --git a/acl/marshal.go b/acl/marshal.go index cd6c6dd..2e59304 100644 --- a/acl/marshal.go +++ b/acl/marshal.go @@ -28,10 +28,14 @@ const ( lifetimeNotValidBeforeField = 2 lifetimeIssuedAtField = 3 - bearerTokenBodyACLField = 1 - bearerTokenBodyOwnerField = 2 - bearerTokenBodyLifetimeField = 3 - bearerTokenBodyImpersonate = 4 + tokenAPEChainsTargetField = 1 + tokenAPEChainsChainsField = 2 + + bearerTokenBodyACLField = 1 + bearerTokenBodyOwnerField = 2 + bearerTokenBodyLifetimeField = 3 + bearerTokenBodyImpersonate = 4 + bearerTokenTokenAPEChainsField = 5 bearerTokenBodyField = 1 bearerTokenSignatureField = 2 @@ -239,6 +243,42 @@ func (l *TokenLifetime) Unmarshal(data []byte) error { return message.Unmarshal(l, data, new(acl.BearerToken_Body_TokenLifetime)) } +func (c *APEOverride) StableMarshal(buf []byte) []byte { + if c == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, c.StableSize()) + } + + var offset int + + offset += protoutil.NestedStructureMarshal(tokenAPEChainsTargetField, buf[offset:], c.target) + for i := range c.chains { + offset += protoutil.NestedStructureMarshal(tokenAPEChainsChainsField, buf[offset:], c.chains[i]) + } + + return buf +} + +func (c *APEOverride) StableSize() (size int) { + if c == nil { + return 0 + } + + size += protoutil.NestedStructureSize(tokenAPEChainsTargetField, c.target) + for i := range c.chains { + size += protoutil.NestedStructureSize(tokenAPEChainsChainsField, c.chains[i]) + } + + return size +} + +func (c *APEOverride) Unmarshal(data []byte) error { + return message.Unmarshal(c, data, new(acl.BearerToken_Body_APEOverride)) +} + func (bt *BearerTokenBody) StableMarshal(buf []byte) []byte { if bt == nil { return []byte{} @@ -253,7 +293,8 @@ func (bt *BearerTokenBody) StableMarshal(buf []byte) []byte { offset += protoutil.NestedStructureMarshal(bearerTokenBodyACLField, buf[offset:], bt.eacl) offset += protoutil.NestedStructureMarshal(bearerTokenBodyOwnerField, buf[offset:], bt.ownerID) offset += protoutil.NestedStructureMarshal(bearerTokenBodyLifetimeField, buf[offset:], bt.lifetime) - protoutil.BoolMarshal(bearerTokenBodyImpersonate, buf[offset:], bt.impersonate) + offset += protoutil.BoolMarshal(bearerTokenBodyImpersonate, buf[offset:], bt.impersonate) + protoutil.NestedStructureMarshal(bearerTokenTokenAPEChainsField, buf[offset:], bt.apeOverride) return buf } @@ -267,6 +308,7 @@ func (bt *BearerTokenBody) StableSize() (size int) { size += protoutil.NestedStructureSize(bearerTokenBodyOwnerField, bt.ownerID) size += protoutil.NestedStructureSize(bearerTokenBodyLifetimeField, bt.lifetime) size += protoutil.BoolSize(bearerTokenBodyImpersonate, bt.impersonate) + size += protoutil.NestedStructureSize(bearerTokenTokenAPEChainsField, bt.apeOverride) return size } diff --git a/acl/test/generate.go b/acl/test/generate.go index 3151c52..30a960a 100644 --- a/acl/test/generate.go +++ b/acl/test/generate.go @@ -2,6 +2,7 @@ package acltest import ( "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/acl" + apetest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/ape/test" accountingtest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/test" ) @@ -22,8 +23,20 @@ func GenerateBearerTokenBody(empty bool) *acl.BearerTokenBody { if !empty { m.SetOwnerID(accountingtest.GenerateOwnerID(false)) - m.SetEACL(GenerateTable(false)) m.SetLifetime(GenerateTokenLifetime(false)) + m.SetAPEOverride(GenerateAPEOverride(empty)) + } + + return m +} + +func GenerateAPEOverride(empty bool) *acl.APEOverride { + var m *acl.APEOverride + + if !empty { + m = new(acl.APEOverride) + m.SetTarget(apetest.GenerateChainTarget(empty)) + m.SetChains(apetest.GenerateRawChains(false, 3)) } return m diff --git a/acl/types.go b/acl/types.go index 1524e7b..b42528b 100644 --- a/acl/types.go +++ b/acl/types.go @@ -1,6 +1,9 @@ package acl -import "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" +import ( + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/ape" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" +) // HeaderFilter is a unified structure of FilterInfo // message from proto definition. @@ -46,6 +49,12 @@ type TokenLifetime struct { exp, nbf, iat uint64 } +type APEOverride struct { + target *ape.ChainTarget + + chains []*ape.Chain +} + type BearerTokenBody struct { eacl *Table @@ -53,6 +62,8 @@ type BearerTokenBody struct { lifetime *TokenLifetime + apeOverride *APEOverride + impersonate bool } @@ -318,6 +329,34 @@ func (bt *BearerTokenBody) SetEACL(v *Table) { bt.eacl = v } +func (t *APEOverride) GetTarget() *ape.ChainTarget { + return t.target +} + +func (t *APEOverride) GetChains() []*ape.Chain { + return t.chains +} + +func (t *APEOverride) SetTarget(v *ape.ChainTarget) { + t.target = v +} + +func (t *APEOverride) SetChains(v []*ape.Chain) { + t.chains = v +} + +func (bt *BearerTokenBody) GetAPEOverride() *APEOverride { + if bt != nil { + return bt.apeOverride + } + + return nil +} + +func (bt *BearerTokenBody) SetAPEOverride(v *APEOverride) { + bt.apeOverride = v +} + func (bt *BearerTokenBody) GetOwnerID() *refs.OwnerID { if bt != nil { return bt.ownerID From 2f6d3209e1d3087b480f85a252ea5c9970e68e8e Mon Sep 17 00:00:00 2001 From: Airat Arifullin Date: Mon, 27 May 2024 12:13:49 +0300 Subject: [PATCH 1130/1196] [#84] object: Regenerate EC-header type Signed-off-by: Airat Arifullin --- object/convert.go | 5 ++ object/grpc/types.pb.go | 129 ++++++++++++++++++++++------------------ object/marshal.go | 9 ++- object/test/generate.go | 1 + object/types.go | 1 + 5 files changed, 87 insertions(+), 58 deletions(-) diff --git a/object/convert.go b/object/convert.go index 99047dc..6e8ecff 100644 --- a/object/convert.go +++ b/object/convert.go @@ -271,6 +271,7 @@ func (h *ECHeader) ToGRPCMessage() grpc.Message { 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 @@ -318,6 +319,10 @@ func (h *ECHeader) FromGRPCMessage(m grpc.Message) error { } } + if h.ParentAttributes, err = AttributesFromGRPC(v.GetParentAttributes()); err != nil { + return err + } + h.Index = v.GetIndex() h.Total = v.GetTotal() h.Header = v.GetHeader() diff --git a/object/grpc/types.pb.go b/object/grpc/types.pb.go index 3cb44a3..16736e9 100644 --- a/object/grpc/types.pb.go +++ b/object/grpc/types.pb.go @@ -831,6 +831,8 @@ type Header_EC struct { // if an object ID of its parent is presented. The field allows to determine how EC-chunk is placed // in Split hierarchy. ParentSplitParentId *grpc.ObjectID `protobuf:"bytes,7,opt,name=parent_split_parent_id,json=parentSplitParentID,proto3" json:"parent_split_parent_id,omitempty"` + // EC parent's attributes. + ParentAttributes []*Header_Attribute `protobuf:"bytes,8,rep,name=parent_attributes,json=parentAttributes,proto3" json:"parent_attributes,omitempty"` } func (x *Header_EC) Reset() { @@ -914,6 +916,13 @@ func (x *Header_EC) GetParentSplitParentId() *grpc.ObjectID { return nil } +func (x *Header_EC) GetParentAttributes() []*Header_Attribute { + if x != nil { + return x.ParentAttributes + } + return nil +} + type ECInfo_Chunk struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -1013,7 +1022,7 @@ var file_object_grpc_types_proto_rawDesc = []byte{ 0x68, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x52, 0x0f, 0x68, 0x6f, 0x6d, 0x6f, 0x6d, 0x6f, 0x72, 0x70, 0x68, 0x69, 0x63, 0x48, 0x61, - 0x73, 0x68, 0x22, 0xc1, 0x0a, 0x0a, 0x06, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x31, 0x0a, + 0x73, 0x68, 0x22, 0x92, 0x0b, 0x0a, 0x06, 0x48, 0x65, 0x61, 0x64, 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, @@ -1079,7 +1088,7 @@ var file_object_grpc_types_proto_rawDesc = []byte{ 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, 0x08, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x72, 0x65, 0x6e, 0x12, 0x19, 0x0a, 0x08, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x06, - 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x49, 0x44, 0x1a, 0x96, 0x02, + 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x49, 0x44, 0x1a, 0xe7, 0x02, 0x0a, 0x02, 0x45, 0x43, 0x12, 0x30, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 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, 0x06, @@ -1097,56 +1106,61 @@ var file_object_grpc_types_proto_rawDesc = []byte{ 0x64, 0x18, 0x07, 0x20, 0x01, 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, 0x13, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x53, 0x70, 0x6c, 0x69, 0x74, 0x50, 0x61, - 0x72, 0x65, 0x6e, 0x74, 0x49, 0x44, 0x22, 0xc4, 0x01, 0x0a, 0x06, 0x4f, 0x62, 0x6a, 0x65, 0x63, - 0x74, 0x12, 0x35, 0x0a, 0x09, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, + 0x72, 0x65, 0x6e, 0x74, 0x49, 0x44, 0x12, 0x4f, 0x0a, 0x11, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, + 0x5f, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x08, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x22, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, + 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x2e, 0x41, 0x74, 0x74, 0x72, + 0x69, 0x62, 0x75, 0x74, 0x65, 0x52, 0x10, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x41, 0x74, 0x74, + 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x22, 0xc4, 0x01, 0x0a, 0x06, 0x4f, 0x62, 0x6a, 0x65, + 0x63, 0x74, 0x12, 0x35, 0x0a, 0x09, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x69, 0x64, 0x18, + 0x01, 0x20, 0x01, 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, + 0x08, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x44, 0x12, 0x37, 0x0a, 0x09, 0x73, 0x69, 0x67, + 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, + 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, + 0x72, 0x65, 0x12, 0x30, 0x0a, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, + 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x06, 0x68, 0x65, + 0x61, 0x64, 0x65, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x22, 0x8b, + 0x01, 0x0a, 0x09, 0x53, 0x70, 0x6c, 0x69, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x19, 0x0a, 0x08, + 0x73, 0x70, 0x6c, 0x69, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, + 0x73, 0x70, 0x6c, 0x69, 0x74, 0x49, 0x64, 0x12, 0x35, 0x0a, 0x09, 0x6c, 0x61, 0x73, 0x74, 0x5f, + 0x70, 0x61, 0x72, 0x74, 0x18, 0x02, 0x20, 0x01, 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, 0x08, 0x6c, 0x61, 0x73, 0x74, 0x50, 0x61, 0x72, 0x74, 0x12, 0x2c, + 0x0a, 0x04, 0x6c, 0x69, 0x6e, 0x6b, 0x18, 0x03, 0x20, 0x01, 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, 0x04, 0x6c, 0x69, 0x6e, 0x6b, 0x22, 0x9f, 0x01, 0x0a, + 0x06, 0x45, 0x43, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x36, 0x0a, 0x06, 0x63, 0x68, 0x75, 0x6e, 0x6b, + 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, + 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x45, 0x43, 0x49, 0x6e, 0x66, + 0x6f, 0x2e, 0x43, 0x68, 0x75, 0x6e, 0x6b, 0x52, 0x06, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x73, 0x1a, + 0x5d, 0x0a, 0x05, 0x43, 0x68, 0x75, 0x6e, 0x6b, 0x12, 0x28, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 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, 0x08, - 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x44, 0x12, 0x37, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, - 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, - 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, - 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, - 0x65, 0x12, 0x30, 0x0a, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, - 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x06, 0x68, 0x65, 0x61, - 0x64, 0x65, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x04, - 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x22, 0x8b, 0x01, - 0x0a, 0x09, 0x53, 0x70, 0x6c, 0x69, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x19, 0x0a, 0x08, 0x73, - 0x70, 0x6c, 0x69, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x73, - 0x70, 0x6c, 0x69, 0x74, 0x49, 0x64, 0x12, 0x35, 0x0a, 0x09, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x70, - 0x61, 0x72, 0x74, 0x18, 0x02, 0x20, 0x01, 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, 0x08, 0x6c, 0x61, 0x73, 0x74, 0x50, 0x61, 0x72, 0x74, 0x12, 0x2c, 0x0a, - 0x04, 0x6c, 0x69, 0x6e, 0x6b, 0x18, 0x03, 0x20, 0x01, 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, 0x04, 0x6c, 0x69, 0x6e, 0x6b, 0x22, 0x9f, 0x01, 0x0a, 0x06, - 0x45, 0x43, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x36, 0x0a, 0x06, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x73, - 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, - 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x45, 0x43, 0x49, 0x6e, 0x66, 0x6f, - 0x2e, 0x43, 0x68, 0x75, 0x6e, 0x6b, 0x52, 0x06, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x73, 0x1a, 0x5d, - 0x0a, 0x05, 0x43, 0x68, 0x75, 0x6e, 0x6b, 0x12, 0x28, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, - 0x01, 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, 0x02, 0x69, - 0x64, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, - 0x52, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x2a, 0x32, 0x0a, - 0x0a, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x52, - 0x45, 0x47, 0x55, 0x4c, 0x41, 0x52, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x54, 0x4f, 0x4d, 0x42, - 0x53, 0x54, 0x4f, 0x4e, 0x45, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x4c, 0x4f, 0x43, 0x4b, 0x10, - 0x03, 0x2a, 0x73, 0x0a, 0x09, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1a, - 0x0a, 0x16, 0x4d, 0x41, 0x54, 0x43, 0x48, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, - 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x10, 0x0a, 0x0c, 0x53, 0x54, - 0x52, 0x49, 0x4e, 0x47, 0x5f, 0x45, 0x51, 0x55, 0x41, 0x4c, 0x10, 0x01, 0x12, 0x14, 0x0a, 0x10, - 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x45, 0x51, 0x55, 0x41, 0x4c, - 0x10, 0x02, 0x12, 0x0f, 0x0a, 0x0b, 0x4e, 0x4f, 0x54, 0x5f, 0x50, 0x52, 0x45, 0x53, 0x45, 0x4e, - 0x54, 0x10, 0x03, 0x12, 0x11, 0x0a, 0x0d, 0x43, 0x4f, 0x4d, 0x4d, 0x4f, 0x4e, 0x5f, 0x50, 0x52, - 0x45, 0x46, 0x49, 0x58, 0x10, 0x04, 0x42, 0x61, 0x5a, 0x42, 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, - 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, - 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0xaa, 0x02, 0x1a, 0x4e, - 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, - 0x50, 0x49, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x33, + 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x44, 0x52, 0x02, + 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0d, 0x52, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x74, 0x61, + 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x2a, 0x32, + 0x0a, 0x0a, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0b, 0x0a, 0x07, + 0x52, 0x45, 0x47, 0x55, 0x4c, 0x41, 0x52, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x54, 0x4f, 0x4d, + 0x42, 0x53, 0x54, 0x4f, 0x4e, 0x45, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x4c, 0x4f, 0x43, 0x4b, + 0x10, 0x03, 0x2a, 0x73, 0x0a, 0x09, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x54, 0x79, 0x70, 0x65, 0x12, + 0x1a, 0x0a, 0x16, 0x4d, 0x41, 0x54, 0x43, 0x48, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, + 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x10, 0x0a, 0x0c, 0x53, + 0x54, 0x52, 0x49, 0x4e, 0x47, 0x5f, 0x45, 0x51, 0x55, 0x41, 0x4c, 0x10, 0x01, 0x12, 0x14, 0x0a, + 0x10, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x45, 0x51, 0x55, 0x41, + 0x4c, 0x10, 0x02, 0x12, 0x0f, 0x0a, 0x0b, 0x4e, 0x4f, 0x54, 0x5f, 0x50, 0x52, 0x45, 0x53, 0x45, + 0x4e, 0x54, 0x10, 0x03, 0x12, 0x11, 0x0a, 0x0d, 0x43, 0x4f, 0x4d, 0x4d, 0x4f, 0x4e, 0x5f, 0x50, + 0x52, 0x45, 0x46, 0x49, 0x58, 0x10, 0x04, 0x42, 0x61, 0x5a, 0x42, 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, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x6f, 0x62, 0x6a, 0x65, 0x63, + 0x74, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0xaa, 0x02, 0x1a, + 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, + 0x41, 0x50, 0x49, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, } var ( @@ -1212,12 +1226,13 @@ var file_object_grpc_types_proto_depIdxs = []int32{ 16, // 25: neo.fs.v2.object.Header.Split.children:type_name -> neo.fs.v2.refs.ObjectID 16, // 26: neo.fs.v2.object.Header.EC.parent:type_name -> neo.fs.v2.refs.ObjectID 16, // 27: neo.fs.v2.object.Header.EC.parent_split_parent_id:type_name -> neo.fs.v2.refs.ObjectID - 16, // 28: neo.fs.v2.object.ECInfo.Chunk.id:type_name -> neo.fs.v2.refs.ObjectID - 29, // [29:29] is the sub-list for method output_type - 29, // [29:29] is the sub-list for method input_type - 29, // [29:29] is the sub-list for extension type_name - 29, // [29:29] is the sub-list for extension extendee - 0, // [0:29] is the sub-list for field type_name + 7, // 28: neo.fs.v2.object.Header.EC.parent_attributes:type_name -> neo.fs.v2.object.Header.Attribute + 16, // 29: neo.fs.v2.object.ECInfo.Chunk.id:type_name -> neo.fs.v2.refs.ObjectID + 30, // [30:30] is the sub-list for method output_type + 30, // [30:30] is the sub-list for method input_type + 30, // [30:30] is the sub-list for extension type_name + 30, // [30:30] is the sub-list for extension extendee + 0, // [0:30] is the sub-list for field type_name } func init() { file_object_grpc_types_proto_init() } diff --git a/object/marshal.go b/object/marshal.go index bf8fcb9..f96b098 100644 --- a/object/marshal.go +++ b/object/marshal.go @@ -33,6 +33,7 @@ const ( ecHdrHeaderField = 5 ecHdrParentSplitID = 6 ecHdrParentSplitParentID = 7 + ecHdrParentAttributes = 8 hdrVersionField = 1 hdrContainerIDField = 2 @@ -264,7 +265,10 @@ func (h *ECHeader) StableMarshal(buf []byte) []byte { offset += proto.UInt32Marshal(ecHdrHeaderLengthField, buf[offset:], h.HeaderLength) offset += proto.BytesMarshal(ecHdrHeaderField, buf[offset:], h.Header) offset += proto.BytesMarshal(ecHdrParentSplitID, buf[offset:], h.ParentSplitID) - proto.NestedStructureMarshal(ecHdrParentSplitParentID, buf[offset:], h.ParentSplitParentID) + offset += proto.NestedStructureMarshal(ecHdrParentSplitParentID, buf[offset:], h.ParentSplitParentID) + for i := range h.ParentAttributes { + offset += proto.NestedStructureMarshal(ecHdrParentAttributes, buf[offset:], &h.ParentAttributes[i]) + } return buf } @@ -280,6 +284,9 @@ func (h *ECHeader) StableSize() (size int) { size += proto.BytesSize(ecHdrHeaderField, h.Header) size += proto.BytesSize(ecHdrParentSplitID, h.ParentSplitID) size += proto.NestedStructureSize(ecHdrParentSplitParentID, h.ParentSplitParentID) + for i := range h.ParentAttributes { + size += proto.NestedStructureSize(ecHdrParentAttributes, &h.ParentAttributes[i]) + } return size } diff --git a/object/test/generate.go b/object/test/generate.go index 95c76e5..b1931fc 100644 --- a/object/test/generate.go +++ b/object/test/generate.go @@ -93,6 +93,7 @@ func GenerateECHeader(empty bool) *object.ECHeader { ech.Parent = refstest.GenerateObjectID(empty) ech.ParentSplitID = []byte{1, 2, 3} ech.ParentSplitParentID = refstest.GenerateObjectID(empty) + ech.ParentAttributes = GenerateAttributes(empty) ech.Index = 0 ech.Total = 2 ech.Header = []byte("chunk of ec-encoded parent header") diff --git a/object/types.go b/object/types.go index 7916b1e..43caf80 100644 --- a/object/types.go +++ b/object/types.go @@ -43,6 +43,7 @@ type ECHeader struct { Parent *refs.ObjectID ParentSplitID []byte ParentSplitParentID *refs.ObjectID + ParentAttributes []Attribute Index uint32 Total uint32 Header []byte From dafc9e5476babcb0026b702161987114c25e94c3 Mon Sep 17 00:00:00 2001 From: Airat Arifullin Date: Mon, 24 Jun 2024 11:53:26 +0300 Subject: [PATCH 1131/1196] [#86] status: Regenerate common status * INVALID_ARGUMENT is a new common status constant. Signed-off-by: Airat Arifullin --- status/grpc/types.pb.go | 76 ++++++++++++++++++++++------------------- 1 file changed, 41 insertions(+), 35 deletions(-) diff --git a/status/grpc/types.pb.go b/status/grpc/types.pb.go index 64a0835..31f6373 100644 --- a/status/grpc/types.pb.go +++ b/status/grpc/types.pb.go @@ -149,6 +149,9 @@ const ( CommonFail_SIGNATURE_VERIFICATION_FAIL CommonFail = 2 // [**1027**] Node is under maintenance. CommonFail_NODE_UNDER_MAINTENANCE CommonFail = 3 + // [**1028**] Invalid argument error. If the server fails on validation of a + // request parameter as the client sent it incorrectly, then this code should be used. + CommonFail_INVALID_ARGUMENT CommonFail = 4 ) // Enum value maps for CommonFail. @@ -158,12 +161,14 @@ var ( 1: "WRONG_MAGIC_NUMBER", 2: "SIGNATURE_VERIFICATION_FAIL", 3: "NODE_UNDER_MAINTENANCE", + 4: "INVALID_ARGUMENT", } CommonFail_value = map[string]int32{ "INTERNAL": 0, "WRONG_MAGIC_NUMBER": 1, "SIGNATURE_VERIFICATION_FAIL": 2, "NODE_UNDER_MAINTENANCE": 3, + "INVALID_ARGUMENT": 4, } ) @@ -590,41 +595,42 @@ var file_status_grpc_types_proto_rawDesc = []byte{ 0x4f, 0x4e, 0x5f, 0x53, 0x45, 0x53, 0x53, 0x49, 0x4f, 0x4e, 0x10, 0x04, 0x12, 0x17, 0x0a, 0x13, 0x53, 0x45, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x41, 0x50, 0x45, 0x5f, 0x4d, 0x41, 0x4e, 0x41, 0x47, 0x45, 0x52, 0x10, 0x05, 0x2a, 0x11, 0x0a, 0x07, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, - 0x12, 0x06, 0x0a, 0x02, 0x4f, 0x4b, 0x10, 0x00, 0x2a, 0x6f, 0x0a, 0x0a, 0x43, 0x6f, 0x6d, 0x6d, - 0x6f, 0x6e, 0x46, 0x61, 0x69, 0x6c, 0x12, 0x0c, 0x0a, 0x08, 0x49, 0x4e, 0x54, 0x45, 0x52, 0x4e, - 0x41, 0x4c, 0x10, 0x00, 0x12, 0x16, 0x0a, 0x12, 0x57, 0x52, 0x4f, 0x4e, 0x47, 0x5f, 0x4d, 0x41, - 0x47, 0x49, 0x43, 0x5f, 0x4e, 0x55, 0x4d, 0x42, 0x45, 0x52, 0x10, 0x01, 0x12, 0x1f, 0x0a, 0x1b, - 0x53, 0x49, 0x47, 0x4e, 0x41, 0x54, 0x55, 0x52, 0x45, 0x5f, 0x56, 0x45, 0x52, 0x49, 0x46, 0x49, - 0x43, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x46, 0x41, 0x49, 0x4c, 0x10, 0x02, 0x12, 0x1a, 0x0a, - 0x16, 0x4e, 0x4f, 0x44, 0x45, 0x5f, 0x55, 0x4e, 0x44, 0x45, 0x52, 0x5f, 0x4d, 0x41, 0x49, 0x4e, - 0x54, 0x45, 0x4e, 0x41, 0x4e, 0x43, 0x45, 0x10, 0x03, 0x2a, 0x88, 0x01, 0x0a, 0x06, 0x4f, 0x62, - 0x6a, 0x65, 0x63, 0x74, 0x12, 0x11, 0x0a, 0x0d, 0x41, 0x43, 0x43, 0x45, 0x53, 0x53, 0x5f, 0x44, - 0x45, 0x4e, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x14, 0x0a, 0x10, 0x4f, 0x42, 0x4a, 0x45, 0x43, - 0x54, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x46, 0x4f, 0x55, 0x4e, 0x44, 0x10, 0x01, 0x12, 0x0a, 0x0a, - 0x06, 0x4c, 0x4f, 0x43, 0x4b, 0x45, 0x44, 0x10, 0x02, 0x12, 0x1b, 0x0a, 0x17, 0x4c, 0x4f, 0x43, - 0x4b, 0x5f, 0x4e, 0x4f, 0x4e, 0x5f, 0x52, 0x45, 0x47, 0x55, 0x4c, 0x41, 0x52, 0x5f, 0x4f, 0x42, - 0x4a, 0x45, 0x43, 0x54, 0x10, 0x03, 0x12, 0x1a, 0x0a, 0x16, 0x4f, 0x42, 0x4a, 0x45, 0x43, 0x54, - 0x5f, 0x41, 0x4c, 0x52, 0x45, 0x41, 0x44, 0x59, 0x5f, 0x52, 0x45, 0x4d, 0x4f, 0x56, 0x45, 0x44, - 0x10, 0x04, 0x12, 0x10, 0x0a, 0x0c, 0x4f, 0x55, 0x54, 0x5f, 0x4f, 0x46, 0x5f, 0x52, 0x41, 0x4e, - 0x47, 0x45, 0x10, 0x05, 0x2a, 0x55, 0x0a, 0x09, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, - 0x72, 0x12, 0x17, 0x0a, 0x13, 0x43, 0x4f, 0x4e, 0x54, 0x41, 0x49, 0x4e, 0x45, 0x52, 0x5f, 0x4e, - 0x4f, 0x54, 0x5f, 0x46, 0x4f, 0x55, 0x4e, 0x44, 0x10, 0x00, 0x12, 0x12, 0x0a, 0x0e, 0x45, 0x41, - 0x43, 0x4c, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x46, 0x4f, 0x55, 0x4e, 0x44, 0x10, 0x01, 0x12, 0x1b, - 0x0a, 0x17, 0x43, 0x4f, 0x4e, 0x54, 0x41, 0x49, 0x4e, 0x45, 0x52, 0x5f, 0x41, 0x43, 0x43, 0x45, - 0x53, 0x53, 0x5f, 0x44, 0x45, 0x4e, 0x49, 0x45, 0x44, 0x10, 0x02, 0x2a, 0x31, 0x0a, 0x07, 0x53, - 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x13, 0x0a, 0x0f, 0x54, 0x4f, 0x4b, 0x45, 0x4e, 0x5f, - 0x4e, 0x4f, 0x54, 0x5f, 0x46, 0x4f, 0x55, 0x4e, 0x44, 0x10, 0x00, 0x12, 0x11, 0x0a, 0x0d, 0x54, - 0x4f, 0x4b, 0x45, 0x4e, 0x5f, 0x45, 0x58, 0x50, 0x49, 0x52, 0x45, 0x44, 0x10, 0x01, 0x2a, 0x2b, - 0x0a, 0x0a, 0x41, 0x50, 0x45, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x12, 0x1d, 0x0a, 0x19, - 0x41, 0x50, 0x45, 0x5f, 0x4d, 0x41, 0x4e, 0x41, 0x47, 0x45, 0x52, 0x5f, 0x41, 0x43, 0x43, 0x45, - 0x53, 0x53, 0x5f, 0x44, 0x45, 0x4e, 0x49, 0x45, 0x44, 0x10, 0x00, 0x42, 0x61, 0x5a, 0x42, 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, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x73, - 0x74, 0x61, 0x74, 0x75, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x73, 0x74, 0x61, 0x74, 0x75, - 0x73, 0xaa, 0x02, 0x1a, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, - 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x62, 0x06, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x12, 0x06, 0x0a, 0x02, 0x4f, 0x4b, 0x10, 0x00, 0x2a, 0x85, 0x01, 0x0a, 0x0a, 0x43, 0x6f, 0x6d, + 0x6d, 0x6f, 0x6e, 0x46, 0x61, 0x69, 0x6c, 0x12, 0x0c, 0x0a, 0x08, 0x49, 0x4e, 0x54, 0x45, 0x52, + 0x4e, 0x41, 0x4c, 0x10, 0x00, 0x12, 0x16, 0x0a, 0x12, 0x57, 0x52, 0x4f, 0x4e, 0x47, 0x5f, 0x4d, + 0x41, 0x47, 0x49, 0x43, 0x5f, 0x4e, 0x55, 0x4d, 0x42, 0x45, 0x52, 0x10, 0x01, 0x12, 0x1f, 0x0a, + 0x1b, 0x53, 0x49, 0x47, 0x4e, 0x41, 0x54, 0x55, 0x52, 0x45, 0x5f, 0x56, 0x45, 0x52, 0x49, 0x46, + 0x49, 0x43, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x46, 0x41, 0x49, 0x4c, 0x10, 0x02, 0x12, 0x1a, + 0x0a, 0x16, 0x4e, 0x4f, 0x44, 0x45, 0x5f, 0x55, 0x4e, 0x44, 0x45, 0x52, 0x5f, 0x4d, 0x41, 0x49, + 0x4e, 0x54, 0x45, 0x4e, 0x41, 0x4e, 0x43, 0x45, 0x10, 0x03, 0x12, 0x14, 0x0a, 0x10, 0x49, 0x4e, + 0x56, 0x41, 0x4c, 0x49, 0x44, 0x5f, 0x41, 0x52, 0x47, 0x55, 0x4d, 0x45, 0x4e, 0x54, 0x10, 0x04, + 0x2a, 0x88, 0x01, 0x0a, 0x06, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x11, 0x0a, 0x0d, 0x41, + 0x43, 0x43, 0x45, 0x53, 0x53, 0x5f, 0x44, 0x45, 0x4e, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x14, + 0x0a, 0x10, 0x4f, 0x42, 0x4a, 0x45, 0x43, 0x54, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x46, 0x4f, 0x55, + 0x4e, 0x44, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x4c, 0x4f, 0x43, 0x4b, 0x45, 0x44, 0x10, 0x02, + 0x12, 0x1b, 0x0a, 0x17, 0x4c, 0x4f, 0x43, 0x4b, 0x5f, 0x4e, 0x4f, 0x4e, 0x5f, 0x52, 0x45, 0x47, + 0x55, 0x4c, 0x41, 0x52, 0x5f, 0x4f, 0x42, 0x4a, 0x45, 0x43, 0x54, 0x10, 0x03, 0x12, 0x1a, 0x0a, + 0x16, 0x4f, 0x42, 0x4a, 0x45, 0x43, 0x54, 0x5f, 0x41, 0x4c, 0x52, 0x45, 0x41, 0x44, 0x59, 0x5f, + 0x52, 0x45, 0x4d, 0x4f, 0x56, 0x45, 0x44, 0x10, 0x04, 0x12, 0x10, 0x0a, 0x0c, 0x4f, 0x55, 0x54, + 0x5f, 0x4f, 0x46, 0x5f, 0x52, 0x41, 0x4e, 0x47, 0x45, 0x10, 0x05, 0x2a, 0x55, 0x0a, 0x09, 0x43, + 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x12, 0x17, 0x0a, 0x13, 0x43, 0x4f, 0x4e, 0x54, + 0x41, 0x49, 0x4e, 0x45, 0x52, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x46, 0x4f, 0x55, 0x4e, 0x44, 0x10, + 0x00, 0x12, 0x12, 0x0a, 0x0e, 0x45, 0x41, 0x43, 0x4c, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x46, 0x4f, + 0x55, 0x4e, 0x44, 0x10, 0x01, 0x12, 0x1b, 0x0a, 0x17, 0x43, 0x4f, 0x4e, 0x54, 0x41, 0x49, 0x4e, + 0x45, 0x52, 0x5f, 0x41, 0x43, 0x43, 0x45, 0x53, 0x53, 0x5f, 0x44, 0x45, 0x4e, 0x49, 0x45, 0x44, + 0x10, 0x02, 0x2a, 0x31, 0x0a, 0x07, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x13, 0x0a, + 0x0f, 0x54, 0x4f, 0x4b, 0x45, 0x4e, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x46, 0x4f, 0x55, 0x4e, 0x44, + 0x10, 0x00, 0x12, 0x11, 0x0a, 0x0d, 0x54, 0x4f, 0x4b, 0x45, 0x4e, 0x5f, 0x45, 0x58, 0x50, 0x49, + 0x52, 0x45, 0x44, 0x10, 0x01, 0x2a, 0x2b, 0x0a, 0x0a, 0x41, 0x50, 0x45, 0x4d, 0x61, 0x6e, 0x61, + 0x67, 0x65, 0x72, 0x12, 0x1d, 0x0a, 0x19, 0x41, 0x50, 0x45, 0x5f, 0x4d, 0x41, 0x4e, 0x41, 0x47, + 0x45, 0x52, 0x5f, 0x41, 0x43, 0x43, 0x45, 0x53, 0x53, 0x5f, 0x44, 0x45, 0x4e, 0x49, 0x45, 0x44, + 0x10, 0x00, 0x42, 0x61, 0x5a, 0x42, 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, 0x61, 0x70, 0x69, 0x2d, + 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2f, 0x67, 0x72, 0x70, + 0x63, 0x3b, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0xaa, 0x02, 0x1a, 0x4e, 0x65, 0x6f, 0x2e, 0x46, + 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x53, + 0x74, 0x61, 0x74, 0x75, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( From 3f92d7bfb05805216262e720651ec3bb40e532b5 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Fri, 12 Jul 2024 17:36:40 +0300 Subject: [PATCH 1132/1196] [#90] proto/test: Fix proto file formatting Signed-off-by: Evgenii Stratonikov --- util/proto/test/test.proto | 44 +++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/util/proto/test/test.proto b/util/proto/test/test.proto index 65e350f..aa980e9 100644 --- a/util/proto/test/test.proto +++ b/util/proto/test/test.proto @@ -5,30 +5,30 @@ package test; option go_package = "util/proto/test"; message Primitives { - bytes field_a = 1; - string field_b = 2; - bool field_c = 200; - int32 field_d = 201; - uint32 field_e = 202; - int64 field_f = 203; - uint64 field_g = 204; - fixed64 field_i = 205; - double field_j = 206; - fixed32 field_k = 207; + bytes field_a = 1; + string field_b = 2; + bool field_c = 200; + int32 field_d = 201; + uint32 field_e = 202; + int64 field_f = 203; + uint64 field_g = 204; + fixed64 field_i = 205; + double field_j = 206; + fixed32 field_k = 207; - enum SomeEnum { - UNKNOWN = 0; - POSITIVE = 1; - NEGATIVE = -1; - } - SomeEnum field_h = 300; + enum SomeEnum { + UNKNOWN = 0; + POSITIVE = 1; + NEGATIVE = -1; + } + SomeEnum field_h = 300; } message RepPrimitives { - repeated bytes field_a = 1; - repeated string field_b = 2; - repeated int32 field_c = 3; - repeated uint32 field_d = 4; - repeated int64 field_e = 5; - repeated uint64 field_f = 6; + repeated bytes field_a = 1; + repeated string field_b = 2; + repeated int32 field_c = 3; + repeated uint32 field_d = 4; + repeated int64 field_e = 5; + repeated uint64 field_f = 6; } From 610c450a655e812a81ee57ccc2c1f0751b273a2f Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Fri, 12 Jul 2024 17:45:29 +0300 Subject: [PATCH 1133/1196] [#90] proto/test: Fix go vet warnings Signed-off-by: Evgenii Stratonikov --- util/proto/marshal_test.go | 42 +++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/util/proto/marshal_test.go b/util/proto/marshal_test.go index 7119c8f..f23641d 100644 --- a/util/proto/marshal_test.go +++ b/util/proto/marshal_test.go @@ -439,7 +439,7 @@ func TestFixed32Marshal(t *testing.T) { }) } -func testMarshal(t *testing.T, c stablePrimitives, tr test.Primitives, wrongField bool) *test.Primitives { +func testMarshal(t *testing.T, c stablePrimitives, tr *test.Primitives, wrongField bool) *test.Primitives { var ( wire []byte err error @@ -447,7 +447,7 @@ func testMarshal(t *testing.T, c stablePrimitives, tr test.Primitives, wrongFiel wire, err = c.stableMarshal(nil, wrongField) require.NoError(t, err) - wireGen, err := goproto.Marshal(&tr) + wireGen, err := goproto.Marshal(tr) require.NoError(t, err) if !wrongField { @@ -470,7 +470,7 @@ func testBytesMarshal(t *testing.T, data []byte, wrongField bool) { transport = test.Primitives{FieldA: data} ) - result := testMarshal(t, custom, transport, wrongField) + result := testMarshal(t, custom, &transport, wrongField) if !wrongField { require.Len(t, result.FieldA, len(data)) @@ -488,7 +488,7 @@ func testStringMarshal(t *testing.T, s string, wrongField bool) { transport = test.Primitives{FieldB: s} ) - result := testMarshal(t, custom, transport, wrongField) + result := testMarshal(t, custom, &transport, wrongField) if !wrongField { require.Len(t, result.FieldB, len(s)) @@ -506,7 +506,7 @@ func testBoolMarshal(t *testing.T, b bool, wrongField bool) { transport = test.Primitives{FieldC: b} ) - result := testMarshal(t, custom, transport, wrongField) + result := testMarshal(t, custom, &transport, wrongField) if !wrongField { require.Equal(t, b, result.FieldC) @@ -521,7 +521,7 @@ func testInt32Marshal(t *testing.T, n int32, wrongField bool) { transport = test.Primitives{FieldD: n} ) - result := testMarshal(t, custom, transport, wrongField) + result := testMarshal(t, custom, &transport, wrongField) if !wrongField { require.Equal(t, n, result.FieldD) @@ -536,7 +536,7 @@ func testUInt32Marshal(t *testing.T, n uint32, wrongField bool) { transport = test.Primitives{FieldE: n} ) - result := testMarshal(t, custom, transport, wrongField) + result := testMarshal(t, custom, &transport, wrongField) if !wrongField { require.Equal(t, n, result.FieldE) @@ -551,7 +551,7 @@ func testInt64Marshal(t *testing.T, n int64, wrongField bool) { transport = test.Primitives{FieldF: n} ) - result := testMarshal(t, custom, transport, wrongField) + result := testMarshal(t, custom, &transport, wrongField) if !wrongField { require.Equal(t, n, result.FieldF) @@ -566,7 +566,7 @@ func testUInt64Marshal(t *testing.T, n uint64, wrongField bool) { transport = test.Primitives{FieldG: n} ) - result := testMarshal(t, custom, transport, wrongField) + result := testMarshal(t, custom, &transport, wrongField) if !wrongField { require.Equal(t, n, result.FieldG) @@ -581,7 +581,7 @@ func testFloat64Marshal(t *testing.T, n float64, wrongField bool) { transport = test.Primitives{FieldJ: n} ) - result := testMarshal(t, custom, transport, wrongField) + result := testMarshal(t, custom, &transport, wrongField) if !wrongField { require.Equal(t, n, result.FieldJ) @@ -596,7 +596,7 @@ func testEnumMarshal(t *testing.T, e SomeEnum, wrongField bool) { transport = test.Primitives{FieldH: test.Primitives_SomeEnum(e)} ) - result := testMarshal(t, custom, transport, wrongField) + result := testMarshal(t, custom, &transport, wrongField) if !wrongField { require.EqualValues(t, custom.FieldH, result.FieldH) @@ -605,7 +605,7 @@ func testEnumMarshal(t *testing.T, e SomeEnum, wrongField bool) { } } -func testRepMarshal(t *testing.T, c stableRepPrimitives, tr test.RepPrimitives, wrongField bool) *test.RepPrimitives { +func testRepMarshal(t *testing.T, c stableRepPrimitives, tr *test.RepPrimitives, wrongField bool) *test.RepPrimitives { var ( wire []byte err error @@ -613,7 +613,7 @@ func testRepMarshal(t *testing.T, c stableRepPrimitives, tr test.RepPrimitives, wire, err = c.stableMarshal(nil, wrongField) require.NoError(t, err) - wireGen, err := goproto.Marshal(&tr) + wireGen, err := goproto.Marshal(tr) require.NoError(t, err) if !wrongField { @@ -636,7 +636,7 @@ func testRepeatedBytesMarshal(t *testing.T, data [][]byte, wrongField bool) { transport = test.RepPrimitives{FieldA: data} ) - result := testRepMarshal(t, custom, transport, wrongField) + result := testRepMarshal(t, custom, &transport, wrongField) if !wrongField { require.Len(t, result.FieldA, len(data)) @@ -654,7 +654,7 @@ func testRepeatedStringMarshal(t *testing.T, s []string, wrongField bool) { transport = test.RepPrimitives{FieldB: s} ) - result := testRepMarshal(t, custom, transport, wrongField) + result := testRepMarshal(t, custom, &transport, wrongField) if !wrongField { require.Len(t, result.FieldB, len(s)) @@ -672,7 +672,7 @@ func testRepeatedInt32Marshal(t *testing.T, n []int32, wrongField bool) { transport = test.RepPrimitives{FieldC: n} ) - result := testRepMarshal(t, custom, transport, wrongField) + result := testRepMarshal(t, custom, &transport, wrongField) if !wrongField { require.Len(t, result.FieldC, len(n)) @@ -690,7 +690,7 @@ func testRepeatedUInt32Marshal(t *testing.T, n []uint32, wrongField bool) { transport = test.RepPrimitives{FieldD: n} ) - result := testRepMarshal(t, custom, transport, wrongField) + result := testRepMarshal(t, custom, &transport, wrongField) if !wrongField { require.Len(t, result.FieldD, len(n)) @@ -708,7 +708,7 @@ func testRepeatedInt64Marshal(t *testing.T, n []int64, wrongField bool) { transport = test.RepPrimitives{FieldE: n} ) - result := testRepMarshal(t, custom, transport, wrongField) + result := testRepMarshal(t, custom, &transport, wrongField) if !wrongField { require.Len(t, result.FieldE, len(n)) @@ -726,7 +726,7 @@ func testRepeatedUInt64Marshal(t *testing.T, n []uint64, wrongField bool) { transport = test.RepPrimitives{FieldF: n} ) - result := testRepMarshal(t, custom, transport, wrongField) + result := testRepMarshal(t, custom, &transport, wrongField) if !wrongField { require.Len(t, result.FieldF, len(n)) @@ -744,7 +744,7 @@ func testFixed64Marshal(t *testing.T, n uint64, wrongField bool) { transport = test.Primitives{FieldI: n} ) - result := testMarshal(t, custom, transport, wrongField) + result := testMarshal(t, custom, &transport, wrongField) if !wrongField { require.Equal(t, n, result.FieldI) @@ -759,7 +759,7 @@ func testFixed32Marshal(t *testing.T, n uint32, wrongField bool) { transport = test.Primitives{FieldK: n} ) - result := testMarshal(t, custom, transport, wrongField) + result := testMarshal(t, custom, &transport, wrongField) if !wrongField { require.Equal(t, n, result.FieldK) From 3639563d80684a158189e10a0522555001073240 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Fri, 12 Jul 2024 17:46:06 +0300 Subject: [PATCH 1134/1196] [#90] apemanager: Run gofumpt Signed-off-by: Evgenii Stratonikov --- apemanager/types.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/apemanager/types.go b/apemanager/types.go index 6896bf1..21edf85 100644 --- a/apemanager/types.go +++ b/apemanager/types.go @@ -109,8 +109,7 @@ type RemoveChainResponse struct { session.ResponseHeaders } -type RemoveChainResponseBody struct { -} +type RemoveChainResponseBody struct{} func (r *RemoveChainResponse) SetBody(body *RemoveChainResponseBody) { r.body = body From f517e3949164d072b456c8f561b9c67012114a69 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Mon, 15 Jul 2024 11:16:29 +0300 Subject: [PATCH 1135/1196] [#91] protogen: Support unpacked repeated uint64 fields Signed-off-by: Evgenii Stratonikov --- util/proto/marshal_test.go | 59 +++++++++++++++++++++++++++++++++++++- util/proto/test/test.pb.go | 32 ++++++++++++++------- util/proto/test/test.proto | 1 + util/protogen/main.go | 38 ++++++++++++++++++++---- 4 files changed, 113 insertions(+), 17 deletions(-) diff --git a/util/proto/marshal_test.go b/util/proto/marshal_test.go index f23641d..c2a0f8e 100644 --- a/util/proto/marshal_test.go +++ b/util/proto/marshal_test.go @@ -1,12 +1,14 @@ package proto_test import ( + "encoding/binary" "math" "testing" "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/proto" "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/proto/test" "github.com/stretchr/testify/require" + "google.golang.org/protobuf/encoding/protowire" goproto "google.golang.org/protobuf/proto" ) @@ -33,6 +35,8 @@ type stableRepPrimitives struct { FieldD []uint32 FieldE []int64 FieldF []uint64 + + FieldFu []uint64 } const ( @@ -185,6 +189,20 @@ func (s *stableRepPrimitives) stableMarshal(buf []byte, wrongField bool) ([]byte } i += proto.RepeatedUInt64Marshal(fieldNum, buf, s.FieldF) + fieldNum = 7 + if wrongField { + fieldNum++ + } + for j := range s.FieldFu { + { + prefix := protowire.EncodeTag( + protowire.Number(fieldNum), + protowire.VarintType) + i += binary.PutUvarint(buf[i:], uint64(prefix)) + i += binary.PutUvarint(buf[i:], s.FieldFu[j]) + } + } + return buf, nil } @@ -196,7 +214,12 @@ func (s *stableRepPrimitives) stableSize() int { f5, _ := proto.RepeatedInt64Size(5, s.FieldE) f6, _ := proto.RepeatedUInt64Size(6, s.FieldF) - return f1 + f2 + f3 + f4 + f5 + f6 + var f7 int + for i := range s.FieldFu { + f7 += protowire.SizeGroup(protowire.Number(7), protowire.SizeVarint(s.FieldFu[i])) + } + + return f1 + f2 + f3 + f4 + f5 + f6 + f7 } func TestBytesMarshal(t *testing.T) { @@ -404,6 +427,22 @@ func TestRepeatedUInt64Marshal(t *testing.T) { }) } +func TestRepeatedUInt64MarshalUnpacked(t *testing.T) { + t.Run("not empty", func(t *testing.T) { + data := []uint64{0, 1, 2, 3, 4, 5} + testRepeatedUInt64MarshalUnpacked(t, data, false) + testRepeatedUInt64MarshalUnpacked(t, data, true) + }) + + t.Run("empty", func(t *testing.T) { + testRepeatedUInt64MarshalUnpacked(t, []uint64{}, false) + }) + + t.Run("nil", func(t *testing.T) { + testRepeatedUInt64MarshalUnpacked(t, nil, false) + }) +} + func TestFixed64Marshal(t *testing.T) { t.Run("zero", func(t *testing.T) { testFixed64Marshal(t, 0, false) @@ -738,6 +777,24 @@ func testRepeatedUInt64Marshal(t *testing.T, n []uint64, wrongField bool) { } } +func testRepeatedUInt64MarshalUnpacked(t *testing.T, n []uint64, wrongField bool) { + var ( + custom = stableRepPrimitives{FieldFu: n} + transport = test.RepPrimitives{FieldFu: n} + ) + + result := testRepMarshal(t, custom, &transport, wrongField) + + if !wrongField { + require.Len(t, result.FieldFu, len(n)) + if len(n) > 0 { + require.Equal(t, n, result.FieldFu) + } + } else { + require.Len(t, result.FieldFu, 0) + } +} + func testFixed64Marshal(t *testing.T, n uint64, wrongField bool) { var ( custom = stablePrimitives{FieldI: n} diff --git a/util/proto/test/test.pb.go b/util/proto/test/test.pb.go index 0b9f43d..57f7fb0 100644 --- a/util/proto/test/test.pb.go +++ b/util/proto/test/test.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.33.0 -// protoc v4.25.3 +// protoc v5.27.2 // source: util/proto/test/test.proto package test @@ -201,12 +201,13 @@ type RepPrimitives struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - FieldA [][]byte `protobuf:"bytes,1,rep,name=field_a,json=fieldA,proto3" json:"field_a,omitempty"` - FieldB []string `protobuf:"bytes,2,rep,name=field_b,json=fieldB,proto3" json:"field_b,omitempty"` - FieldC []int32 `protobuf:"varint,3,rep,packed,name=field_c,json=fieldC,proto3" json:"field_c,omitempty"` - FieldD []uint32 `protobuf:"varint,4,rep,packed,name=field_d,json=fieldD,proto3" json:"field_d,omitempty"` - FieldE []int64 `protobuf:"varint,5,rep,packed,name=field_e,json=fieldE,proto3" json:"field_e,omitempty"` - FieldF []uint64 `protobuf:"varint,6,rep,packed,name=field_f,json=fieldF,proto3" json:"field_f,omitempty"` + FieldA [][]byte `protobuf:"bytes,1,rep,name=field_a,json=fieldA,proto3" json:"field_a,omitempty"` + FieldB []string `protobuf:"bytes,2,rep,name=field_b,json=fieldB,proto3" json:"field_b,omitempty"` + FieldC []int32 `protobuf:"varint,3,rep,packed,name=field_c,json=fieldC,proto3" json:"field_c,omitempty"` + FieldD []uint32 `protobuf:"varint,4,rep,packed,name=field_d,json=fieldD,proto3" json:"field_d,omitempty"` + FieldE []int64 `protobuf:"varint,5,rep,packed,name=field_e,json=fieldE,proto3" json:"field_e,omitempty"` + FieldF []uint64 `protobuf:"varint,6,rep,packed,name=field_f,json=fieldF,proto3" json:"field_f,omitempty"` + FieldFu []uint64 `protobuf:"varint,7,rep,name=field_fu,json=fieldFu,proto3" json:"field_fu,omitempty"` } func (x *RepPrimitives) Reset() { @@ -283,6 +284,13 @@ func (x *RepPrimitives) GetFieldF() []uint64 { return nil } +func (x *RepPrimitives) GetFieldFu() []uint64 { + if x != nil { + return x.FieldFu + } + return nil +} + var File_util_proto_test_test_proto protoreflect.FileDescriptor var file_util_proto_test_test_proto_rawDesc = []byte{ @@ -312,7 +320,7 @@ var file_util_proto_test_test_proto_rawDesc = []byte{ 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x0c, 0x0a, 0x08, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x49, 0x56, 0x45, 0x10, 0x01, 0x12, 0x15, 0x0a, 0x08, 0x4e, 0x45, 0x47, 0x41, 0x54, 0x49, 0x56, 0x45, 0x10, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0x22, 0xa5, 0x01, 0x0a, 0x0d, 0x52, 0x65, 0x70, 0x50, 0x72, + 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0x22, 0xc4, 0x01, 0x0a, 0x0d, 0x52, 0x65, 0x70, 0x50, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, 0x12, 0x17, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x61, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x41, 0x12, 0x17, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x62, 0x18, 0x02, 0x20, 0x03, @@ -322,9 +330,11 @@ var file_util_proto_test_test_proto_rawDesc = []byte{ 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x44, 0x12, 0x17, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x65, 0x18, 0x05, 0x20, 0x03, 0x28, 0x03, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x45, 0x12, 0x17, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x66, - 0x18, 0x06, 0x20, 0x03, 0x28, 0x04, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x46, 0x42, 0x11, - 0x5a, 0x0f, 0x75, 0x74, 0x69, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x74, 0x65, 0x73, - 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x18, 0x06, 0x20, 0x03, 0x28, 0x04, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x46, 0x12, 0x1d, + 0x0a, 0x08, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x66, 0x75, 0x18, 0x07, 0x20, 0x03, 0x28, 0x04, + 0x42, 0x02, 0x10, 0x00, 0x52, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x46, 0x75, 0x42, 0x11, 0x5a, + 0x0f, 0x75, 0x74, 0x69, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x74, 0x65, 0x73, 0x74, + 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/util/proto/test/test.proto b/util/proto/test/test.proto index aa980e9..14f6ac2 100644 --- a/util/proto/test/test.proto +++ b/util/proto/test/test.proto @@ -31,4 +31,5 @@ message RepPrimitives { repeated uint32 field_d = 4; repeated int64 field_e = 5; repeated uint64 field_f = 6; + repeated uint64 field_fu = 7 [ packed = false ]; } diff --git a/util/protogen/main.go b/util/protogen/main.go index a295a28..85c6ded 100644 --- a/util/protogen/main.go +++ b/util/protogen/main.go @@ -8,6 +8,11 @@ import ( "google.golang.org/protobuf/reflect/protoreflect" ) +var ( + protowirePackage = protogen.GoImportPath("google.golang.org/protobuf/encoding/protowire") + binaryPackage = protogen.GoImportPath("encoding/binary") +) + func main() { protogen.Options{}.Run(func(gen *protogen.Plugin) error { for _, f := range gen.Files { @@ -62,7 +67,7 @@ func emitMessage(g *protogen.GeneratedFile, msg *protogen.Message) { g.P("if x == nil { return 0 }") if len(fs) != 0 { for _, f := range fs { - if f.Desc.IsList() && marshalers[f.Desc.Kind()].RepeatedDouble { + if f.Desc.IsList() && marshalers[f.Desc.Kind()].RepeatedDouble && !(f.Desc.Kind() == protoreflect.Uint64Kind && !f.Desc.IsPacked()) { g.P("var n int") break } @@ -140,9 +145,19 @@ func emitFieldSize(g *protogen.GeneratedFile, f *protogen.Field) { } switch { - case f.Desc.IsList() && f.Desc.Kind() == protoreflect.MessageKind: + case f.Desc.IsList() && (f.Desc.Kind() == protoreflect.MessageKind || f.Desc.Kind() == protoreflect.Uint64Kind && !f.Desc.IsPacked()): g.P("for i := range ", name, "{") - g.P("size += proto.NestedStructureSize(", f.Desc.Number(), ", ", name, "[i])") + if f.Desc.Kind() == protoreflect.MessageKind { + g.P("size += proto.NestedStructureSize(", f.Desc.Number(), ", ", name, "[i])") + } else { + if f.Desc.Kind() != protoreflect.Uint64Kind { + panic("only uint64 unpacked primitive is supported") + } + + g.P("size += ", protowirePackage.Ident("SizeGroup"), "(", + protowirePackage.Ident("Number"), "(", f.Desc.Number(), "), ", + protowirePackage.Ident("SizeVarint"), "(", name, "[i]))") + } g.P("}") case f.Desc.IsList(): if m.RepeatedDouble { @@ -177,9 +192,22 @@ func emitFieldMarshal(g *protogen.GeneratedFile, f *protogen.Field) { prefix = "Repeated" + m.Prefix } switch { - case f.Desc.IsList() && f.Desc.Kind() == protoreflect.MessageKind: + case f.Desc.IsList() && (f.Desc.Kind() == protoreflect.MessageKind || f.Desc.Kind() == protoreflect.Uint64Kind && !f.Desc.IsPacked()): g.P("for i := range ", name, "{") - g.P("offset += proto.NestedStructureMarshal(", f.Desc.Number(), ", buf[offset:], ", name, "[i])") + if f.Desc.Kind() == protoreflect.MessageKind { + g.P("offset += proto.NestedStructureMarshal(", f.Desc.Number(), ", buf[offset:], ", name, "[i])") + } else { + if f.Desc.Kind() != protoreflect.Uint64Kind { + panic("only uint64 unpacked primitive is supported") + } + g.P("{") + g.P("prefix := ", protowirePackage.Ident("EncodeTag"), "(", + protowirePackage.Ident("Number"), "(", f.Desc.Number(), "), ", + protowirePackage.Ident("VarintType"), ")") + g.P("offset += ", binaryPackage.Ident("PutUvarint"), "(buf[offset:], uint64(prefix))") + g.P("offset += ", binaryPackage.Ident("PutUvarint"), "(buf[offset:], ", name, "[i])") + g.P("}") + } g.P("}") case f.Desc.IsList(): g.P("offset += proto.Repeated", m.Prefix, "Marshal(", f.Desc.Number(), ", buf[offset:], ", name, ")") From 3dfa2f4fd65ed386611f06e31d16f5f755e963bc Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Fri, 26 Jul 2024 10:15:06 +0300 Subject: [PATCH 1136/1196] [#95] *: Regenerate proto files Remove SetExtendedEACL and AnnounceUsedSpace methods from the container package. Signed-off-by: Evgenii Stratonikov --- accounting/grpc/service.pb.go | 2 +- accounting/grpc/service_grpc.pb.go | 2 +- accounting/grpc/types.pb.go | 2 +- acl/grpc/types.pb.go | 14 +- ape/grpc/types.pb.go | 2 +- apemanager/grpc/service.pb.go | 2 +- apemanager/grpc/service_grpc.pb.go | 2 +- container/convert.go | 340 -------- container/grpc/service.go | 90 --- container/grpc/service.pb.go | 1164 +++++----------------------- container/grpc/service_grpc.pb.go | 118 +-- container/grpc/types.pb.go | 2 +- container/marshal.go | 133 ---- container/message_test.go | 7 - container/test/generate.go | 111 --- container/types.go | 168 ---- lock/grpc/types.pb.go | 2 +- netmap/grpc/service.pb.go | 2 +- netmap/grpc/service_grpc.pb.go | 2 +- netmap/grpc/types.pb.go | 2 +- object/grpc/service.pb.go | 6 +- object/grpc/service_grpc.pb.go | 2 +- object/grpc/types.pb.go | 13 +- refs/grpc/types.pb.go | 2 +- rpc/container.go | 33 - session/grpc/service.pb.go | 2 +- session/grpc/service_grpc.pb.go | 2 +- session/grpc/types.pb.go | 2 +- signature/body.go | 8 - status/grpc/types.pb.go | 5 +- tombstone/grpc/types.pb.go | 2 +- 31 files changed, 238 insertions(+), 2006 deletions(-) diff --git a/accounting/grpc/service.pb.go b/accounting/grpc/service.pb.go index fe193cd..b66bb7a 100644 --- a/accounting/grpc/service.pb.go +++ b/accounting/grpc/service.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.33.0 -// protoc v4.25.3 +// protoc v5.27.2 // source: accounting/grpc/service.proto package accounting diff --git a/accounting/grpc/service_grpc.pb.go b/accounting/grpc/service_grpc.pb.go index cd1b2e9..63207fe 100644 --- a/accounting/grpc/service_grpc.pb.go +++ b/accounting/grpc/service_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.3.0 -// - protoc v4.25.3 +// - protoc v5.27.2 // source: accounting/grpc/service.proto package accounting diff --git a/accounting/grpc/types.pb.go b/accounting/grpc/types.pb.go index 592aa8b..8be14bc 100644 --- a/accounting/grpc/types.pb.go +++ b/accounting/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.33.0 -// protoc v4.25.3 +// protoc v5.27.2 // source: accounting/grpc/types.proto package accounting diff --git a/acl/grpc/types.pb.go b/acl/grpc/types.pb.go index aec449c..39ab1e1 100644 --- a/acl/grpc/types.pb.go +++ b/acl/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.33.0 -// protoc v4.25.3 +// protoc v5.27.2 // source: acl/grpc/types.proto package acl @@ -709,7 +709,8 @@ type BearerToken_Body struct { // valid for this specific container. Otherwise, any container of the same // owner is allowed. // - // Deprecated: eACL tables are no longer relevant - `APEOverrides` should be used instead. + // Deprecated: eACL tables are no longer relevant - `APEOverrides` should be + // used instead. EaclTable *EACLTable `protobuf:"bytes,1,opt,name=eacl_table,json=eaclTable,proto3" json:"eacl_table,omitempty"` // `OwnerID` defines to whom the token was issued. It must match the request // originator's `OwnerID`. If empty, any token bearer will be accepted. @@ -859,11 +860,12 @@ func (x *BearerToken_Body_TokenLifetime) GetIat() uint64 { } // APEOverride is the list of APE chains defined for a target. -// These chains are meant to serve as overrides to the already defined (or even undefined) -// APE chains for the target (see contract `Policy`). +// These chains are meant to serve as overrides to the already defined (or +// even undefined) APE chains for the target (see contract `Policy`). // -// The server-side processing of the bearer token with set APE overrides must verify if a client is permitted -// to override chains for the target, preventing unauthorized access through the APE mechanism. +// The server-side processing of the bearer token with set APE overrides +// must verify if a client is permitted to override chains for the target, +// preventing unauthorized access through the APE mechanism. type BearerToken_Body_APEOverride struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache diff --git a/ape/grpc/types.pb.go b/ape/grpc/types.pb.go index 1da2110..ee8e0a7 100644 --- a/ape/grpc/types.pb.go +++ b/ape/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.33.0 -// protoc v4.25.3 +// protoc v5.27.2 // source: ape/grpc/types.proto package ape diff --git a/apemanager/grpc/service.pb.go b/apemanager/grpc/service.pb.go index 7757aad..3baf193 100644 --- a/apemanager/grpc/service.pb.go +++ b/apemanager/grpc/service.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.33.0 -// protoc v4.25.3 +// protoc v5.27.2 // source: apemanager/grpc/service.proto package apemanager diff --git a/apemanager/grpc/service_grpc.pb.go b/apemanager/grpc/service_grpc.pb.go index 484fec5..4781427 100644 --- a/apemanager/grpc/service_grpc.pb.go +++ b/apemanager/grpc/service_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.3.0 -// - protoc v4.25.3 +// - protoc v5.27.2 // source: apemanager/grpc/service.proto package apemanager diff --git a/container/convert.go b/container/convert.go index 0753755..c5f9cd7 100644 --- a/container/convert.go +++ b/container/convert.go @@ -767,151 +767,6 @@ func (r *ListResponse) FromGRPCMessage(m grpc.Message) error { return r.ResponseHeaders.FromMessage(v) } -func (r *SetExtendedACLRequestBody) ToGRPCMessage() grpc.Message { - var m *container.SetExtendedACLRequest_Body - - if r != nil { - m = new(container.SetExtendedACLRequest_Body) - - m.SetEacl(r.eacl.ToGRPCMessage().(*aclGRPC.EACLTable)) - m.SetSignature(toSignatureRFC6979(r.sig)) - } - - return m -} - -func (r *SetExtendedACLRequestBody) FromGRPCMessage(m grpc.Message) error { - v, ok := m.(*container.SetExtendedACLRequest_Body) - if !ok { - return message.NewUnexpectedMessageType(m, v) - } - - var err error - - eacl := v.GetEacl() - if eacl == nil { - r.eacl = nil - } else { - if r.eacl == nil { - r.eacl = new(acl.Table) - } - - err = r.eacl.FromGRPCMessage(eacl) - if err != nil { - return err - } - } - - sig := v.GetSignature() - if sig == nil { - r.sig = nil - } else { - if r.sig == nil { - r.sig = new(refs.Signature) - } - - r.sig.SetKey(sig.GetKey()) - r.sig.SetSign(sig.GetSign()) - } - - return err -} - -func (r *SetExtendedACLRequest) ToGRPCMessage() grpc.Message { - var m *container.SetExtendedACLRequest - - if r != nil { - m = new(container.SetExtendedACLRequest) - - m.SetBody(r.body.ToGRPCMessage().(*container.SetExtendedACLRequest_Body)) - r.RequestHeaders.ToMessage(m) - } - - return m -} - -func (r *SetExtendedACLRequest) FromGRPCMessage(m grpc.Message) error { - v, ok := m.(*container.SetExtendedACLRequest) - 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(SetExtendedACLRequestBody) - } - - err = r.body.FromGRPCMessage(body) - if err != nil { - return err - } - } - - return r.RequestHeaders.FromMessage(v) -} - -func (r *SetExtendedACLResponseBody) ToGRPCMessage() grpc.Message { - var m *container.SetExtendedACLResponse_Body - - if r != nil { - m = new(container.SetExtendedACLResponse_Body) - } - - return m -} - -func (r *SetExtendedACLResponseBody) FromGRPCMessage(m grpc.Message) error { - v, ok := m.(*container.SetExtendedACLResponse_Body) - if !ok { - return message.NewUnexpectedMessageType(m, v) - } - - return nil -} - -func (r *SetExtendedACLResponse) ToGRPCMessage() grpc.Message { - var m *container.SetExtendedACLResponse - - if r != nil { - m = new(container.SetExtendedACLResponse) - - m.SetBody(r.body.ToGRPCMessage().(*container.SetExtendedACLResponse_Body)) - r.ResponseHeaders.ToMessage(m) - } - - return m -} - -func (r *SetExtendedACLResponse) FromGRPCMessage(m grpc.Message) error { - v, ok := m.(*container.SetExtendedACLResponse) - 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(SetExtendedACLResponseBody) - } - - err = r.body.FromGRPCMessage(body) - if err != nil { - return err - } - } - - return r.ResponseHeaders.FromMessage(v) -} - func (r *GetExtendedACLRequestBody) ToGRPCMessage() grpc.Message { var m *container.GetExtendedACLRequest_Body @@ -1083,198 +938,3 @@ func (r *GetExtendedACLResponse) FromGRPCMessage(m grpc.Message) error { return r.ResponseHeaders.FromMessage(v) } - -func (a *UsedSpaceAnnouncement) ToGRPCMessage() grpc.Message { - var m *container.AnnounceUsedSpaceRequest_Body_Announcement - - if a != nil { - m = new(container.AnnounceUsedSpaceRequest_Body_Announcement) - - m.SetContainerId(a.cid.ToGRPCMessage().(*refsGRPC.ContainerID)) - m.SetEpoch(a.epoch) - m.SetUsedSpace(a.usedSpace) - } - - return m -} - -func (a *UsedSpaceAnnouncement) FromGRPCMessage(m grpc.Message) error { - v, ok := m.(*container.AnnounceUsedSpaceRequest_Body_Announcement) - if !ok { - return message.NewUnexpectedMessageType(m, v) - } - - var err error - - cid := v.GetContainerId() - if cid == nil { - a.cid = nil - } else { - if a.cid == nil { - a.cid = new(refs.ContainerID) - } - - err = a.cid.FromGRPCMessage(cid) - if err != nil { - return err - } - } - - a.epoch = v.GetEpoch() - a.usedSpace = v.GetUsedSpace() - - return nil -} - -func UsedSpaceAnnouncementsToGRPCMessage( - ids []UsedSpaceAnnouncement, -) (res []*container.AnnounceUsedSpaceRequest_Body_Announcement) { - if ids != nil { - res = make([]*container.AnnounceUsedSpaceRequest_Body_Announcement, 0, len(ids)) - - for i := range ids { - res = append(res, ids[i].ToGRPCMessage().(*container.AnnounceUsedSpaceRequest_Body_Announcement)) - } - } - - return -} - -func UsedSpaceAnnouncementssFromGRPCMessage( - asV2 []*container.AnnounceUsedSpaceRequest_Body_Announcement, -) (res []UsedSpaceAnnouncement, err error) { - if asV2 != nil { - res = make([]UsedSpaceAnnouncement, len(asV2)) - - for i := range asV2 { - if asV2[i] != nil { - err = res[i].FromGRPCMessage(asV2[i]) - if err != nil { - return - } - } - } - } - - return -} - -func (r *AnnounceUsedSpaceRequestBody) ToGRPCMessage() grpc.Message { - var m *container.AnnounceUsedSpaceRequest_Body - - if r != nil { - m = new(container.AnnounceUsedSpaceRequest_Body) - - m.SetAnnouncements(UsedSpaceAnnouncementsToGRPCMessage(r.announcements)) - } - - return m -} - -func (r *AnnounceUsedSpaceRequestBody) FromGRPCMessage(m grpc.Message) error { - v, ok := m.(*container.AnnounceUsedSpaceRequest_Body) - if !ok { - return message.NewUnexpectedMessageType(m, v) - } - - var err error - - r.announcements, err = UsedSpaceAnnouncementssFromGRPCMessage(v.GetAnnouncements()) - - return err -} - -func (r *AnnounceUsedSpaceRequest) ToGRPCMessage() grpc.Message { - var m *container.AnnounceUsedSpaceRequest - - if r != nil { - m = new(container.AnnounceUsedSpaceRequest) - - m.SetBody(r.body.ToGRPCMessage().(*container.AnnounceUsedSpaceRequest_Body)) - r.RequestHeaders.ToMessage(m) - } - - return m -} - -func (r *AnnounceUsedSpaceRequest) FromGRPCMessage(m grpc.Message) error { - v, ok := m.(*container.AnnounceUsedSpaceRequest) - 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(AnnounceUsedSpaceRequestBody) - } - - err = r.body.FromGRPCMessage(body) - if err != nil { - return err - } - } - - return r.RequestHeaders.FromMessage(v) -} - -func (r *AnnounceUsedSpaceResponseBody) ToGRPCMessage() grpc.Message { - var m *container.AnnounceUsedSpaceResponse_Body - - if r != nil { - m = new(container.AnnounceUsedSpaceResponse_Body) - } - - return m -} - -func (r *AnnounceUsedSpaceResponseBody) FromGRPCMessage(m grpc.Message) error { - v, ok := m.(*container.AnnounceUsedSpaceResponse_Body) - if !ok { - return message.NewUnexpectedMessageType(m, v) - } - - return nil -} - -func (r *AnnounceUsedSpaceResponse) ToGRPCMessage() grpc.Message { - var m *container.AnnounceUsedSpaceResponse - - if r != nil { - m = new(container.AnnounceUsedSpaceResponse) - - m.SetBody(r.body.ToGRPCMessage().(*container.AnnounceUsedSpaceResponse_Body)) - r.ResponseHeaders.ToMessage(m) - } - - return m -} - -func (r *AnnounceUsedSpaceResponse) FromGRPCMessage(m grpc.Message) error { - v, ok := m.(*container.AnnounceUsedSpaceResponse) - 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(AnnounceUsedSpaceResponseBody) - } - - err = r.body.FromGRPCMessage(body) - if err != nil { - return err - } - } - - return r.ResponseHeaders.FromMessage(v) -} diff --git a/container/grpc/service.go b/container/grpc/service.go index 050cf0b..d19add1 100644 --- a/container/grpc/service.go +++ b/container/grpc/service.go @@ -182,46 +182,6 @@ func (m *ListResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) { m.VerifyHeader = v } -// SetEacl sets eACL table structure. -func (m *SetExtendedACLRequest_Body) SetEacl(v *acl.EACLTable) { - m.Eacl = v -} - -// SetSignature sets signature of the eACL table structure. -func (m *SetExtendedACLRequest_Body) SetSignature(v *refs.SignatureRFC6979) { - m.Signature = v -} - -// SetBody sets body of the request. -func (m *SetExtendedACLRequest) SetBody(v *SetExtendedACLRequest_Body) { - m.Body = v -} - -// SetMetaHeader sets meta header of the request. -func (m *SetExtendedACLRequest) SetMetaHeader(v *session.RequestMetaHeader) { - m.MetaHeader = v -} - -// SetVerifyHeader sets verification header of the request. -func (m *SetExtendedACLRequest) SetVerifyHeader(v *session.RequestVerificationHeader) { - m.VerifyHeader = v -} - -// SetBody sets body of the response. -func (m *SetExtendedACLResponse) SetBody(v *SetExtendedACLResponse_Body) { - m.Body = v -} - -// SetMetaHeader sets meta header of the response. -func (m *SetExtendedACLResponse) SetMetaHeader(v *session.ResponseMetaHeader) { - m.MetaHeader = v -} - -// SetVerifyHeader sets verification header of the response. -func (m *SetExtendedACLResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) { - m.VerifyHeader = v -} - // SetContainerId sets identifier of the container. func (m *GetExtendedACLRequest_Body) SetContainerId(v *refs.ContainerID) { m.ContainerId = v @@ -272,53 +232,3 @@ func (m *GetExtendedACLResponse) SetMetaHeader(v *session.ResponseMetaHeader) { func (m *GetExtendedACLResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) { m.VerifyHeader = v } - -// SetEpoch sets epoch of the size estimation. -func (m *AnnounceUsedSpaceRequest_Body_Announcement) SetEpoch(v uint64) { - m.Epoch = v -} - -// SetContainerId sets identifier of the container. -func (m *AnnounceUsedSpaceRequest_Body_Announcement) SetContainerId(v *refs.ContainerID) { - m.ContainerId = v -} - -// SetUsedSpace sets used space value of the container. -func (m *AnnounceUsedSpaceRequest_Body_Announcement) SetUsedSpace(v uint64) { - m.UsedSpace = v -} - -// SetAnnouncements sets list of announcement for shared containers between nodes. -func (m *AnnounceUsedSpaceRequest_Body) SetAnnouncements(v []*AnnounceUsedSpaceRequest_Body_Announcement) { - m.Announcements = v -} - -// SetBody sets body of the request. -func (m *AnnounceUsedSpaceRequest) SetBody(v *AnnounceUsedSpaceRequest_Body) { - m.Body = v -} - -// SetMetaHeader sets meta header of the request. -func (m *AnnounceUsedSpaceRequest) SetMetaHeader(v *session.RequestMetaHeader) { - m.MetaHeader = v -} - -// SetVerifyHeader sets verification header of the request. -func (m *AnnounceUsedSpaceRequest) SetVerifyHeader(v *session.RequestVerificationHeader) { - m.VerifyHeader = v -} - -// SetBody sets body of the response. -func (m *AnnounceUsedSpaceResponse) SetBody(v *AnnounceUsedSpaceResponse_Body) { - m.Body = v -} - -// SetMetaHeader sets meta header of the response. -func (m *AnnounceUsedSpaceResponse) SetMetaHeader(v *session.ResponseMetaHeader) { - m.MetaHeader = v -} - -// SetVerifyHeader sets verification header of the response. -func (m *AnnounceUsedSpaceResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) { - m.VerifyHeader = v -} diff --git a/container/grpc/service.pb.go b/container/grpc/service.pb.go index 672e29f..3bf1e14 100644 --- a/container/grpc/service.pb.go +++ b/container/grpc/service.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.33.0 -// protoc v4.25.3 +// protoc v5.27.2 // source: container/grpc/service.proto package container @@ -584,146 +584,6 @@ func (x *ListResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { return nil } -// Set Extended ACL -type SetExtendedACLRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Body of set extended acl request message. - Body *SetExtendedACLRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" 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,proto3" json:"verify_header,omitempty"` -} - -func (x *SetExtendedACLRequest) Reset() { - *x = SetExtendedACLRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_container_grpc_service_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SetExtendedACLRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SetExtendedACLRequest) ProtoMessage() {} - -func (x *SetExtendedACLRequest) ProtoReflect() protoreflect.Message { - mi := &file_container_grpc_service_proto_msgTypes[8] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SetExtendedACLRequest.ProtoReflect.Descriptor instead. -func (*SetExtendedACLRequest) Descriptor() ([]byte, []int) { - return file_container_grpc_service_proto_rawDescGZIP(), []int{8} -} - -func (x *SetExtendedACLRequest) GetBody() *SetExtendedACLRequest_Body { - if x != nil { - return x.Body - } - return nil -} - -func (x *SetExtendedACLRequest) GetMetaHeader() *grpc.RequestMetaHeader { - if x != nil { - return x.MetaHeader - } - return nil -} - -func (x *SetExtendedACLRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { - if x != nil { - return x.VerifyHeader - } - return nil -} - -// Set Extended ACL -type SetExtendedACLResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Body of set extended acl response message. - Body *SetExtendedACLResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" 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,proto3" json:"verify_header,omitempty"` -} - -func (x *SetExtendedACLResponse) Reset() { - *x = SetExtendedACLResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_container_grpc_service_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SetExtendedACLResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SetExtendedACLResponse) ProtoMessage() {} - -func (x *SetExtendedACLResponse) ProtoReflect() protoreflect.Message { - mi := &file_container_grpc_service_proto_msgTypes[9] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SetExtendedACLResponse.ProtoReflect.Descriptor instead. -func (*SetExtendedACLResponse) Descriptor() ([]byte, []int) { - return file_container_grpc_service_proto_rawDescGZIP(), []int{9} -} - -func (x *SetExtendedACLResponse) GetBody() *SetExtendedACLResponse_Body { - if x != nil { - return x.Body - } - return nil -} - -func (x *SetExtendedACLResponse) GetMetaHeader() *grpc.ResponseMetaHeader { - if x != nil { - return x.MetaHeader - } - return nil -} - -func (x *SetExtendedACLResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { - if x != nil { - return x.VerifyHeader - } - return nil -} - // Get Extended ACL type GetExtendedACLRequest struct { state protoimpl.MessageState @@ -744,7 +604,7 @@ type GetExtendedACLRequest struct { func (x *GetExtendedACLRequest) Reset() { *x = GetExtendedACLRequest{} if protoimpl.UnsafeEnabled { - mi := &file_container_grpc_service_proto_msgTypes[10] + mi := &file_container_grpc_service_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -757,7 +617,7 @@ func (x *GetExtendedACLRequest) String() string { func (*GetExtendedACLRequest) ProtoMessage() {} func (x *GetExtendedACLRequest) ProtoReflect() protoreflect.Message { - mi := &file_container_grpc_service_proto_msgTypes[10] + mi := &file_container_grpc_service_proto_msgTypes[8] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -770,7 +630,7 @@ func (x *GetExtendedACLRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use GetExtendedACLRequest.ProtoReflect.Descriptor instead. func (*GetExtendedACLRequest) Descriptor() ([]byte, []int) { - return file_container_grpc_service_proto_rawDescGZIP(), []int{10} + return file_container_grpc_service_proto_rawDescGZIP(), []int{8} } func (x *GetExtendedACLRequest) GetBody() *GetExtendedACLRequest_Body { @@ -814,7 +674,7 @@ type GetExtendedACLResponse struct { func (x *GetExtendedACLResponse) Reset() { *x = GetExtendedACLResponse{} if protoimpl.UnsafeEnabled { - mi := &file_container_grpc_service_proto_msgTypes[11] + mi := &file_container_grpc_service_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -827,7 +687,7 @@ func (x *GetExtendedACLResponse) String() string { func (*GetExtendedACLResponse) ProtoMessage() {} func (x *GetExtendedACLResponse) ProtoReflect() protoreflect.Message { - mi := &file_container_grpc_service_proto_msgTypes[11] + mi := &file_container_grpc_service_proto_msgTypes[9] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -840,7 +700,7 @@ func (x *GetExtendedACLResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use GetExtendedACLResponse.ProtoReflect.Descriptor instead. func (*GetExtendedACLResponse) Descriptor() ([]byte, []int) { - return file_container_grpc_service_proto_rawDescGZIP(), []int{11} + return file_container_grpc_service_proto_rawDescGZIP(), []int{9} } func (x *GetExtendedACLResponse) GetBody() *GetExtendedACLResponse_Body { @@ -864,146 +724,6 @@ func (x *GetExtendedACLResponse) GetVerifyHeader() *grpc.ResponseVerificationHea return nil } -// Announce container used space -type AnnounceUsedSpaceRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Body of announce used space request message. - Body *AnnounceUsedSpaceRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" 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,proto3" json:"verify_header,omitempty"` -} - -func (x *AnnounceUsedSpaceRequest) Reset() { - *x = AnnounceUsedSpaceRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_container_grpc_service_proto_msgTypes[12] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AnnounceUsedSpaceRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AnnounceUsedSpaceRequest) ProtoMessage() {} - -func (x *AnnounceUsedSpaceRequest) ProtoReflect() protoreflect.Message { - mi := &file_container_grpc_service_proto_msgTypes[12] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AnnounceUsedSpaceRequest.ProtoReflect.Descriptor instead. -func (*AnnounceUsedSpaceRequest) Descriptor() ([]byte, []int) { - return file_container_grpc_service_proto_rawDescGZIP(), []int{12} -} - -func (x *AnnounceUsedSpaceRequest) GetBody() *AnnounceUsedSpaceRequest_Body { - if x != nil { - return x.Body - } - return nil -} - -func (x *AnnounceUsedSpaceRequest) GetMetaHeader() *grpc.RequestMetaHeader { - if x != nil { - return x.MetaHeader - } - return nil -} - -func (x *AnnounceUsedSpaceRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { - if x != nil { - return x.VerifyHeader - } - return nil -} - -// Announce container used space -type AnnounceUsedSpaceResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Body of announce used space response message. - Body *AnnounceUsedSpaceResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" 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,proto3" json:"verify_header,omitempty"` -} - -func (x *AnnounceUsedSpaceResponse) Reset() { - *x = AnnounceUsedSpaceResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_container_grpc_service_proto_msgTypes[13] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AnnounceUsedSpaceResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AnnounceUsedSpaceResponse) ProtoMessage() {} - -func (x *AnnounceUsedSpaceResponse) ProtoReflect() protoreflect.Message { - mi := &file_container_grpc_service_proto_msgTypes[13] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AnnounceUsedSpaceResponse.ProtoReflect.Descriptor instead. -func (*AnnounceUsedSpaceResponse) Descriptor() ([]byte, []int) { - return file_container_grpc_service_proto_rawDescGZIP(), []int{13} -} - -func (x *AnnounceUsedSpaceResponse) GetBody() *AnnounceUsedSpaceResponse_Body { - if x != nil { - return x.Body - } - return nil -} - -func (x *AnnounceUsedSpaceResponse) GetMetaHeader() *grpc.ResponseMetaHeader { - if x != nil { - return x.MetaHeader - } - return nil -} - -func (x *AnnounceUsedSpaceResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { - if x != nil { - return x.VerifyHeader - } - return nil -} - // Container creation request has container structure's signature as a // separate field. It's not stored in sidechain, just verified on container // creation by `Container` smart contract. `ContainerID` is a SHA256 hash of @@ -1023,7 +743,7 @@ type PutRequest_Body struct { func (x *PutRequest_Body) Reset() { *x = PutRequest_Body{} if protoimpl.UnsafeEnabled { - mi := &file_container_grpc_service_proto_msgTypes[14] + mi := &file_container_grpc_service_proto_msgTypes[10] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1036,7 +756,7 @@ func (x *PutRequest_Body) String() string { func (*PutRequest_Body) ProtoMessage() {} func (x *PutRequest_Body) ProtoReflect() protoreflect.Message { - mi := &file_container_grpc_service_proto_msgTypes[14] + mi := &file_container_grpc_service_proto_msgTypes[10] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1082,7 +802,7 @@ type PutResponse_Body struct { func (x *PutResponse_Body) Reset() { *x = PutResponse_Body{} if protoimpl.UnsafeEnabled { - mi := &file_container_grpc_service_proto_msgTypes[15] + mi := &file_container_grpc_service_proto_msgTypes[11] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1095,7 +815,7 @@ func (x *PutResponse_Body) String() string { func (*PutResponse_Body) ProtoMessage() {} func (x *PutResponse_Body) ProtoReflect() protoreflect.Message { - mi := &file_container_grpc_service_proto_msgTypes[15] + mi := &file_container_grpc_service_proto_msgTypes[11] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1136,7 +856,7 @@ type DeleteRequest_Body struct { func (x *DeleteRequest_Body) Reset() { *x = DeleteRequest_Body{} if protoimpl.UnsafeEnabled { - mi := &file_container_grpc_service_proto_msgTypes[16] + mi := &file_container_grpc_service_proto_msgTypes[12] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1149,7 +869,7 @@ func (x *DeleteRequest_Body) String() string { func (*DeleteRequest_Body) ProtoMessage() {} func (x *DeleteRequest_Body) ProtoReflect() protoreflect.Message { - mi := &file_container_grpc_service_proto_msgTypes[16] + mi := &file_container_grpc_service_proto_msgTypes[12] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1190,7 +910,7 @@ type DeleteResponse_Body struct { func (x *DeleteResponse_Body) Reset() { *x = DeleteResponse_Body{} if protoimpl.UnsafeEnabled { - mi := &file_container_grpc_service_proto_msgTypes[17] + mi := &file_container_grpc_service_proto_msgTypes[13] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1203,7 +923,7 @@ func (x *DeleteResponse_Body) String() string { func (*DeleteResponse_Body) ProtoMessage() {} func (x *DeleteResponse_Body) ProtoReflect() protoreflect.Message { - mi := &file_container_grpc_service_proto_msgTypes[17] + mi := &file_container_grpc_service_proto_msgTypes[13] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1232,7 +952,7 @@ type GetRequest_Body struct { func (x *GetRequest_Body) Reset() { *x = GetRequest_Body{} if protoimpl.UnsafeEnabled { - mi := &file_container_grpc_service_proto_msgTypes[18] + mi := &file_container_grpc_service_proto_msgTypes[14] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1245,7 +965,7 @@ func (x *GetRequest_Body) String() string { func (*GetRequest_Body) ProtoMessage() {} func (x *GetRequest_Body) ProtoReflect() protoreflect.Message { - mi := &file_container_grpc_service_proto_msgTypes[18] + mi := &file_container_grpc_service_proto_msgTypes[14] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1286,7 +1006,7 @@ type GetResponse_Body struct { func (x *GetResponse_Body) Reset() { *x = GetResponse_Body{} if protoimpl.UnsafeEnabled { - mi := &file_container_grpc_service_proto_msgTypes[19] + mi := &file_container_grpc_service_proto_msgTypes[15] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1299,7 +1019,7 @@ func (x *GetResponse_Body) String() string { func (*GetResponse_Body) ProtoMessage() {} func (x *GetResponse_Body) ProtoReflect() protoreflect.Message { - mi := &file_container_grpc_service_proto_msgTypes[19] + mi := &file_container_grpc_service_proto_msgTypes[15] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1349,7 +1069,7 @@ type ListRequest_Body struct { func (x *ListRequest_Body) Reset() { *x = ListRequest_Body{} if protoimpl.UnsafeEnabled { - mi := &file_container_grpc_service_proto_msgTypes[20] + mi := &file_container_grpc_service_proto_msgTypes[16] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1362,7 +1082,7 @@ func (x *ListRequest_Body) String() string { func (*ListRequest_Body) ProtoMessage() {} func (x *ListRequest_Body) ProtoReflect() protoreflect.Message { - mi := &file_container_grpc_service_proto_msgTypes[20] + mi := &file_container_grpc_service_proto_msgTypes[16] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1398,7 +1118,7 @@ type ListResponse_Body struct { func (x *ListResponse_Body) Reset() { *x = ListResponse_Body{} if protoimpl.UnsafeEnabled { - mi := &file_container_grpc_service_proto_msgTypes[21] + mi := &file_container_grpc_service_proto_msgTypes[17] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1411,7 +1131,7 @@ func (x *ListResponse_Body) String() string { func (*ListResponse_Body) ProtoMessage() {} func (x *ListResponse_Body) ProtoReflect() protoreflect.Message { - mi := &file_container_grpc_service_proto_msgTypes[21] + mi := &file_container_grpc_service_proto_msgTypes[17] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1434,106 +1154,6 @@ func (x *ListResponse_Body) GetContainerIds() []*grpc1.ContainerID { return nil } -// Set Extended ACL request body does not have separate `ContainerID` -// reference. It will be taken from `EACLTable.container_id` field. -type SetExtendedACLRequest_Body struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Extended ACL table to set for the container - Eacl *grpc2.EACLTable `protobuf:"bytes,1,opt,name=eacl,proto3" json:"eacl,omitempty"` - // Signature of stable-marshalled Extended ACL table according to RFC-6979. - Signature *grpc1.SignatureRFC6979 `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` -} - -func (x *SetExtendedACLRequest_Body) Reset() { - *x = SetExtendedACLRequest_Body{} - if protoimpl.UnsafeEnabled { - mi := &file_container_grpc_service_proto_msgTypes[22] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SetExtendedACLRequest_Body) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SetExtendedACLRequest_Body) ProtoMessage() {} - -func (x *SetExtendedACLRequest_Body) ProtoReflect() protoreflect.Message { - mi := &file_container_grpc_service_proto_msgTypes[22] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SetExtendedACLRequest_Body.ProtoReflect.Descriptor instead. -func (*SetExtendedACLRequest_Body) Descriptor() ([]byte, []int) { - return file_container_grpc_service_proto_rawDescGZIP(), []int{8, 0} -} - -func (x *SetExtendedACLRequest_Body) GetEacl() *grpc2.EACLTable { - if x != nil { - return x.Eacl - } - return nil -} - -func (x *SetExtendedACLRequest_Body) GetSignature() *grpc1.SignatureRFC6979 { - if x != nil { - return x.Signature - } - return nil -} - -// `SetExtendedACLResponse` has an empty body because the operation is -// asynchronous and the update should be reflected in `Container` smart -// contract's storage after next block is issued in sidechain. -type SetExtendedACLResponse_Body struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *SetExtendedACLResponse_Body) Reset() { - *x = SetExtendedACLResponse_Body{} - if protoimpl.UnsafeEnabled { - mi := &file_container_grpc_service_proto_msgTypes[23] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SetExtendedACLResponse_Body) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SetExtendedACLResponse_Body) ProtoMessage() {} - -func (x *SetExtendedACLResponse_Body) ProtoReflect() protoreflect.Message { - mi := &file_container_grpc_service_proto_msgTypes[23] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SetExtendedACLResponse_Body.ProtoReflect.Descriptor instead. -func (*SetExtendedACLResponse_Body) Descriptor() ([]byte, []int) { - return file_container_grpc_service_proto_rawDescGZIP(), []int{9, 0} -} - // Get Extended ACL request body type GetExtendedACLRequest_Body struct { state protoimpl.MessageState @@ -1547,7 +1167,7 @@ type GetExtendedACLRequest_Body struct { func (x *GetExtendedACLRequest_Body) Reset() { *x = GetExtendedACLRequest_Body{} if protoimpl.UnsafeEnabled { - mi := &file_container_grpc_service_proto_msgTypes[24] + mi := &file_container_grpc_service_proto_msgTypes[18] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1560,7 +1180,7 @@ func (x *GetExtendedACLRequest_Body) String() string { func (*GetExtendedACLRequest_Body) ProtoMessage() {} func (x *GetExtendedACLRequest_Body) ProtoReflect() protoreflect.Message { - mi := &file_container_grpc_service_proto_msgTypes[24] + mi := &file_container_grpc_service_proto_msgTypes[18] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1573,7 +1193,7 @@ func (x *GetExtendedACLRequest_Body) ProtoReflect() protoreflect.Message { // Deprecated: Use GetExtendedACLRequest_Body.ProtoReflect.Descriptor instead. func (*GetExtendedACLRequest_Body) Descriptor() ([]byte, []int) { - return file_container_grpc_service_proto_rawDescGZIP(), []int{10, 0} + return file_container_grpc_service_proto_rawDescGZIP(), []int{8, 0} } func (x *GetExtendedACLRequest_Body) GetContainerId() *grpc1.ContainerID { @@ -1602,7 +1222,7 @@ type GetExtendedACLResponse_Body struct { func (x *GetExtendedACLResponse_Body) Reset() { *x = GetExtendedACLResponse_Body{} if protoimpl.UnsafeEnabled { - mi := &file_container_grpc_service_proto_msgTypes[25] + mi := &file_container_grpc_service_proto_msgTypes[19] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1615,7 +1235,7 @@ func (x *GetExtendedACLResponse_Body) String() string { func (*GetExtendedACLResponse_Body) ProtoMessage() {} func (x *GetExtendedACLResponse_Body) ProtoReflect() protoreflect.Message { - mi := &file_container_grpc_service_proto_msgTypes[25] + mi := &file_container_grpc_service_proto_msgTypes[19] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1628,7 +1248,7 @@ func (x *GetExtendedACLResponse_Body) ProtoReflect() protoreflect.Message { // Deprecated: Use GetExtendedACLResponse_Body.ProtoReflect.Descriptor instead. func (*GetExtendedACLResponse_Body) Descriptor() ([]byte, []int) { - return file_container_grpc_service_proto_rawDescGZIP(), []int{11, 0} + return file_container_grpc_service_proto_rawDescGZIP(), []int{9, 0} } func (x *GetExtendedACLResponse_Body) GetEacl() *grpc2.EACLTable { @@ -1652,164 +1272,6 @@ func (x *GetExtendedACLResponse_Body) GetSessionToken() *grpc.SessionToken { return nil } -// Container used space announcement body. -type AnnounceUsedSpaceRequest_Body struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // List of announcements. If nodes share several containers, - // announcements are transferred in a batch. - Announcements []*AnnounceUsedSpaceRequest_Body_Announcement `protobuf:"bytes,1,rep,name=announcements,proto3" json:"announcements,omitempty"` -} - -func (x *AnnounceUsedSpaceRequest_Body) Reset() { - *x = AnnounceUsedSpaceRequest_Body{} - if protoimpl.UnsafeEnabled { - mi := &file_container_grpc_service_proto_msgTypes[26] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AnnounceUsedSpaceRequest_Body) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AnnounceUsedSpaceRequest_Body) ProtoMessage() {} - -func (x *AnnounceUsedSpaceRequest_Body) ProtoReflect() protoreflect.Message { - mi := &file_container_grpc_service_proto_msgTypes[26] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AnnounceUsedSpaceRequest_Body.ProtoReflect.Descriptor instead. -func (*AnnounceUsedSpaceRequest_Body) Descriptor() ([]byte, []int) { - return file_container_grpc_service_proto_rawDescGZIP(), []int{12, 0} -} - -func (x *AnnounceUsedSpaceRequest_Body) GetAnnouncements() []*AnnounceUsedSpaceRequest_Body_Announcement { - if x != nil { - return x.Announcements - } - return nil -} - -// Announcement contains used space information for a single container. -type AnnounceUsedSpaceRequest_Body_Announcement struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Epoch number for which the container size estimation was produced. - Epoch uint64 `protobuf:"varint,1,opt,name=epoch,proto3" json:"epoch,omitempty"` - // Identifier of the container. - ContainerId *grpc1.ContainerID `protobuf:"bytes,2,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` - // Used space is a sum of object payload sizes of a specified - // container, stored in the node. It must not include inhumed objects. - UsedSpace uint64 `protobuf:"varint,3,opt,name=used_space,json=usedSpace,proto3" json:"used_space,omitempty"` -} - -func (x *AnnounceUsedSpaceRequest_Body_Announcement) Reset() { - *x = AnnounceUsedSpaceRequest_Body_Announcement{} - if protoimpl.UnsafeEnabled { - mi := &file_container_grpc_service_proto_msgTypes[27] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AnnounceUsedSpaceRequest_Body_Announcement) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AnnounceUsedSpaceRequest_Body_Announcement) ProtoMessage() {} - -func (x *AnnounceUsedSpaceRequest_Body_Announcement) ProtoReflect() protoreflect.Message { - mi := &file_container_grpc_service_proto_msgTypes[27] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AnnounceUsedSpaceRequest_Body_Announcement.ProtoReflect.Descriptor instead. -func (*AnnounceUsedSpaceRequest_Body_Announcement) Descriptor() ([]byte, []int) { - return file_container_grpc_service_proto_rawDescGZIP(), []int{12, 0, 0} -} - -func (x *AnnounceUsedSpaceRequest_Body_Announcement) GetEpoch() uint64 { - if x != nil { - return x.Epoch - } - return 0 -} - -func (x *AnnounceUsedSpaceRequest_Body_Announcement) GetContainerId() *grpc1.ContainerID { - if x != nil { - return x.ContainerId - } - return nil -} - -func (x *AnnounceUsedSpaceRequest_Body_Announcement) GetUsedSpace() uint64 { - if x != nil { - return x.UsedSpace - } - return 0 -} - -// `AnnounceUsedSpaceResponse` has an empty body because announcements are -// one way communication. -type AnnounceUsedSpaceResponse_Body struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *AnnounceUsedSpaceResponse_Body) Reset() { - *x = AnnounceUsedSpaceResponse_Body{} - if protoimpl.UnsafeEnabled { - mi := &file_container_grpc_service_proto_msgTypes[28] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AnnounceUsedSpaceResponse_Body) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AnnounceUsedSpaceResponse_Body) ProtoMessage() {} - -func (x *AnnounceUsedSpaceResponse_Body) ProtoReflect() protoreflect.Message { - mi := &file_container_grpc_service_proto_msgTypes[28] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AnnounceUsedSpaceResponse_Body.ProtoReflect.Descriptor instead. -func (*AnnounceUsedSpaceResponse_Body) Descriptor() ([]byte, []int) { - return file_container_grpc_service_proto_rawDescGZIP(), []int{13, 0} -} - var File_container_grpc_service_proto protoreflect.FileDescriptor var file_container_grpc_service_proto_rawDesc = []byte{ @@ -1985,11 +1447,11 @@ var file_container_grpc_service_proto_rawDesc = []byte{ 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x52, 0x0c, 0x63, 0x6f, 0x6e, - 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x64, 0x73, 0x22, 0xec, 0x02, 0x0a, 0x15, 0x53, 0x65, + 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x64, 0x73, 0x22, 0xbe, 0x02, 0x0a, 0x15, 0x47, 0x65, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x41, 0x43, 0x4c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x43, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, - 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x53, 0x65, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, + 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x41, 0x43, 0x4c, 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, @@ -2001,174 +1463,73 @@ var file_container_grpc_service_proto_rawDesc = []byte{ 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, 0x74, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x2c, 0x0a, 0x04, 0x65, 0x61, - 0x63, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, - 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x45, 0x41, 0x43, 0x4c, 0x54, 0x61, 0x62, - 0x6c, 0x65, 0x52, 0x04, 0x65, 0x61, 0x63, 0x6c, 0x12, 0x3e, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, - 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6e, 0x65, - 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, - 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x46, 0x43, 0x36, 0x39, 0x37, 0x39, 0x52, 0x09, 0x73, - 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x22, 0x82, 0x02, 0x0a, 0x16, 0x53, 0x65, 0x74, - 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x41, 0x43, 0x4c, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x12, 0x44, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x30, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, - 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x53, 0x65, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, - 0x64, 0x65, 0x64, 0x41, 0x43, 0x4c, 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, 0x06, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x22, 0xbe, 0x02, - 0x0a, 0x15, 0x47, 0x65, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x41, 0x43, 0x4c, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x43, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, - 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x74, 0x45, - 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x41, 0x43, 0x4c, 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, + 0x65, 0x72, 0x1a, 0x46, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x3e, 0x0a, 0x0c, 0x63, 0x6f, + 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, + 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x52, 0x0b, 0x63, + 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x64, 0x22, 0xb7, 0x03, 0x0a, 0x16, 0x47, + 0x65, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x41, 0x43, 0x4c, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x44, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x30, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, + 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x74, 0x45, 0x78, 0x74, + 0x65, 0x6e, 0x64, 0x65, 0x64, 0x41, 0x43, 0x4c, 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, 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, + 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, 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, 0x46, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x3e, - 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, - 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, - 0x44, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x64, 0x22, 0xb7, - 0x03, 0x0a, 0x16, 0x47, 0x65, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x41, 0x43, - 0x4c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x44, 0x0a, 0x04, 0x62, 0x6f, 0x64, - 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x30, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, - 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x47, 0x65, - 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x41, 0x43, 0x4c, 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, 0xba, 0x01, 0x0a, 0x04, - 0x42, 0x6f, 0x64, 0x79, 0x12, 0x2c, 0x0a, 0x04, 0x65, 0x61, 0x63, 0x6c, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, - 0x63, 0x6c, 0x2e, 0x45, 0x41, 0x43, 0x4c, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x52, 0x04, 0x65, 0x61, - 0x63, 0x6c, 0x12, 0x3e, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, - 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, - 0x52, 0x46, 0x43, 0x36, 0x39, 0x37, 0x39, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, - 0x72, 0x65, 0x12, 0x44, 0x0a, 0x0d, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x74, 0x6f, - 0x6b, 0x65, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, - 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x65, - 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x0c, 0x73, 0x65, 0x73, 0x73, - 0x69, 0x6f, 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0xf2, 0x03, 0x0a, 0x18, 0x41, 0x6e, 0x6e, - 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x55, 0x73, 0x65, 0x64, 0x53, 0x70, 0x61, 0x63, 0x65, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x46, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x32, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, - 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, - 0x63, 0x65, 0x55, 0x73, 0x65, 0x64, 0x53, 0x70, 0x61, 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, + 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, 0xf3, 0x01, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, - 0x12, 0x65, 0x0a, 0x0d, 0x61, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x6d, 0x65, 0x6e, 0x74, - 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x3f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, - 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x41, 0x6e, - 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x55, 0x73, 0x65, 0x64, 0x53, 0x70, 0x61, 0x63, 0x65, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x2e, 0x41, 0x6e, 0x6e, 0x6f, - 0x75, 0x6e, 0x63, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x0d, 0x61, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, - 0x63, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x1a, 0x83, 0x01, 0x0a, 0x0c, 0x41, 0x6e, 0x6e, 0x6f, - 0x75, 0x6e, 0x63, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x70, 0x6f, 0x63, - 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x12, 0x3e, - 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, - 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, - 0x44, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1d, - 0x0a, 0x0a, 0x75, 0x73, 0x65, 0x64, 0x5f, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x04, 0x52, 0x09, 0x75, 0x73, 0x65, 0x64, 0x53, 0x70, 0x61, 0x63, 0x65, 0x22, 0x88, 0x02, - 0x0a, 0x19, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x55, 0x73, 0x65, 0x64, 0x53, 0x70, - 0x61, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x47, 0x0a, 0x04, 0x62, - 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x33, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, - 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, - 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x55, 0x73, 0x65, 0x64, 0x53, 0x70, 0x61, 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, 0x06, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x32, 0x90, 0x05, 0x0a, 0x10, 0x43, 0x6f, 0x6e, - 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x48, 0x0a, - 0x03, 0x50, 0x75, 0x74, 0x12, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, - 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x75, 0x74, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, - 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x75, 0x74, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x51, 0x0a, 0x06, 0x44, 0x65, 0x6c, 0x65, 0x74, - 0x65, 0x12, 0x22, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, + 0x79, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x1a, 0xba, 0x01, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, + 0x12, 0x2c, 0x0a, 0x04, 0x65, 0x61, 0x63, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x45, + 0x41, 0x43, 0x4c, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x52, 0x04, 0x65, 0x61, 0x63, 0x6c, 0x12, 0x3e, + 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, + 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x46, 0x43, 0x36, + 0x39, 0x37, 0x39, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x44, + 0x0a, 0x0d, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, + 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x0c, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x54, + 0x6f, 0x6b, 0x65, 0x6e, 0x32, 0xb1, 0x03, 0x0a, 0x10, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, + 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x48, 0x0a, 0x03, 0x50, 0x75, 0x74, + 0x12, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, + 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, + 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x51, 0x0a, 0x06, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x12, 0x22, 0x2e, + 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, + 0x6e, 0x65, 0x72, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x23, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, - 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x44, 0x65, 0x6c, 0x65, - 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x48, 0x0a, 0x03, 0x47, 0x65, - 0x74, 0x12, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, - 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, - 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4b, 0x0a, 0x04, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x20, 0x2e, 0x6e, - 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, - 0x65, 0x72, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x48, 0x0a, 0x03, 0x47, 0x65, 0x74, 0x12, 0x1f, 0x2e, + 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, + 0x6e, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, - 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x12, 0x69, 0x0a, 0x0e, 0x53, 0x65, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, - 0x41, 0x43, 0x4c, 0x12, 0x2a, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, - 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x53, 0x65, 0x74, 0x45, 0x78, 0x74, - 0x65, 0x6e, 0x64, 0x65, 0x64, 0x41, 0x43, 0x4c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x2b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, - 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x53, 0x65, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, - 0x64, 0x41, 0x43, 0x4c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x69, 0x0a, 0x0e, - 0x47, 0x65, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x41, 0x43, 0x4c, 0x12, 0x2a, - 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, - 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, - 0x41, 0x43, 0x4c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2b, 0x2e, 0x6e, 0x65, 0x6f, + 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x4b, 0x0a, 0x04, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x4c, + 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, - 0x2e, 0x47, 0x65, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x41, 0x43, 0x4c, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x72, 0x0a, 0x11, 0x41, 0x6e, 0x6e, 0x6f, 0x75, - 0x6e, 0x63, 0x65, 0x55, 0x73, 0x65, 0x64, 0x53, 0x70, 0x61, 0x63, 0x65, 0x12, 0x2d, 0x2e, 0x6e, - 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, - 0x65, 0x72, 0x2e, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x55, 0x73, 0x65, 0x64, 0x53, - 0x70, 0x61, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2e, 0x2e, 0x6e, 0x65, + 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x69, 0x0a, + 0x0e, 0x47, 0x65, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x41, 0x43, 0x4c, 0x12, + 0x2a, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, + 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, + 0x64, 0x41, 0x43, 0x4c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, - 0x72, 0x2e, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x55, 0x73, 0x65, 0x64, 0x53, 0x70, - 0x61, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x6a, 0x5a, 0x48, 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, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 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, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x72, 0x2e, 0x47, 0x65, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x41, 0x43, 0x4c, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x6a, 0x5a, 0x48, 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, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 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, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -2183,129 +1544,100 @@ func file_container_grpc_service_proto_rawDescGZIP() []byte { return file_container_grpc_service_proto_rawDescData } -var file_container_grpc_service_proto_msgTypes = make([]protoimpl.MessageInfo, 29) +var file_container_grpc_service_proto_msgTypes = make([]protoimpl.MessageInfo, 20) var file_container_grpc_service_proto_goTypes = []interface{}{ - (*PutRequest)(nil), // 0: neo.fs.v2.container.PutRequest - (*PutResponse)(nil), // 1: neo.fs.v2.container.PutResponse - (*DeleteRequest)(nil), // 2: neo.fs.v2.container.DeleteRequest - (*DeleteResponse)(nil), // 3: neo.fs.v2.container.DeleteResponse - (*GetRequest)(nil), // 4: neo.fs.v2.container.GetRequest - (*GetResponse)(nil), // 5: neo.fs.v2.container.GetResponse - (*ListRequest)(nil), // 6: neo.fs.v2.container.ListRequest - (*ListResponse)(nil), // 7: neo.fs.v2.container.ListResponse - (*SetExtendedACLRequest)(nil), // 8: neo.fs.v2.container.SetExtendedACLRequest - (*SetExtendedACLResponse)(nil), // 9: neo.fs.v2.container.SetExtendedACLResponse - (*GetExtendedACLRequest)(nil), // 10: neo.fs.v2.container.GetExtendedACLRequest - (*GetExtendedACLResponse)(nil), // 11: neo.fs.v2.container.GetExtendedACLResponse - (*AnnounceUsedSpaceRequest)(nil), // 12: neo.fs.v2.container.AnnounceUsedSpaceRequest - (*AnnounceUsedSpaceResponse)(nil), // 13: neo.fs.v2.container.AnnounceUsedSpaceResponse - (*PutRequest_Body)(nil), // 14: neo.fs.v2.container.PutRequest.Body - (*PutResponse_Body)(nil), // 15: neo.fs.v2.container.PutResponse.Body - (*DeleteRequest_Body)(nil), // 16: neo.fs.v2.container.DeleteRequest.Body - (*DeleteResponse_Body)(nil), // 17: neo.fs.v2.container.DeleteResponse.Body - (*GetRequest_Body)(nil), // 18: neo.fs.v2.container.GetRequest.Body - (*GetResponse_Body)(nil), // 19: neo.fs.v2.container.GetResponse.Body - (*ListRequest_Body)(nil), // 20: neo.fs.v2.container.ListRequest.Body - (*ListResponse_Body)(nil), // 21: neo.fs.v2.container.ListResponse.Body - (*SetExtendedACLRequest_Body)(nil), // 22: neo.fs.v2.container.SetExtendedACLRequest.Body - (*SetExtendedACLResponse_Body)(nil), // 23: neo.fs.v2.container.SetExtendedACLResponse.Body - (*GetExtendedACLRequest_Body)(nil), // 24: neo.fs.v2.container.GetExtendedACLRequest.Body - (*GetExtendedACLResponse_Body)(nil), // 25: neo.fs.v2.container.GetExtendedACLResponse.Body - (*AnnounceUsedSpaceRequest_Body)(nil), // 26: neo.fs.v2.container.AnnounceUsedSpaceRequest.Body - (*AnnounceUsedSpaceRequest_Body_Announcement)(nil), // 27: neo.fs.v2.container.AnnounceUsedSpaceRequest.Body.Announcement - (*AnnounceUsedSpaceResponse_Body)(nil), // 28: neo.fs.v2.container.AnnounceUsedSpaceResponse.Body - (*grpc.RequestMetaHeader)(nil), // 29: neo.fs.v2.session.RequestMetaHeader - (*grpc.RequestVerificationHeader)(nil), // 30: neo.fs.v2.session.RequestVerificationHeader - (*grpc.ResponseMetaHeader)(nil), // 31: neo.fs.v2.session.ResponseMetaHeader - (*grpc.ResponseVerificationHeader)(nil), // 32: neo.fs.v2.session.ResponseVerificationHeader - (*Container)(nil), // 33: neo.fs.v2.container.Container - (*grpc1.SignatureRFC6979)(nil), // 34: neo.fs.v2.refs.SignatureRFC6979 - (*grpc1.ContainerID)(nil), // 35: neo.fs.v2.refs.ContainerID - (*grpc.SessionToken)(nil), // 36: neo.fs.v2.session.SessionToken - (*grpc1.OwnerID)(nil), // 37: neo.fs.v2.refs.OwnerID - (*grpc2.EACLTable)(nil), // 38: neo.fs.v2.acl.EACLTable + (*PutRequest)(nil), // 0: neo.fs.v2.container.PutRequest + (*PutResponse)(nil), // 1: neo.fs.v2.container.PutResponse + (*DeleteRequest)(nil), // 2: neo.fs.v2.container.DeleteRequest + (*DeleteResponse)(nil), // 3: neo.fs.v2.container.DeleteResponse + (*GetRequest)(nil), // 4: neo.fs.v2.container.GetRequest + (*GetResponse)(nil), // 5: neo.fs.v2.container.GetResponse + (*ListRequest)(nil), // 6: neo.fs.v2.container.ListRequest + (*ListResponse)(nil), // 7: neo.fs.v2.container.ListResponse + (*GetExtendedACLRequest)(nil), // 8: neo.fs.v2.container.GetExtendedACLRequest + (*GetExtendedACLResponse)(nil), // 9: neo.fs.v2.container.GetExtendedACLResponse + (*PutRequest_Body)(nil), // 10: neo.fs.v2.container.PutRequest.Body + (*PutResponse_Body)(nil), // 11: neo.fs.v2.container.PutResponse.Body + (*DeleteRequest_Body)(nil), // 12: neo.fs.v2.container.DeleteRequest.Body + (*DeleteResponse_Body)(nil), // 13: neo.fs.v2.container.DeleteResponse.Body + (*GetRequest_Body)(nil), // 14: neo.fs.v2.container.GetRequest.Body + (*GetResponse_Body)(nil), // 15: neo.fs.v2.container.GetResponse.Body + (*ListRequest_Body)(nil), // 16: neo.fs.v2.container.ListRequest.Body + (*ListResponse_Body)(nil), // 17: neo.fs.v2.container.ListResponse.Body + (*GetExtendedACLRequest_Body)(nil), // 18: neo.fs.v2.container.GetExtendedACLRequest.Body + (*GetExtendedACLResponse_Body)(nil), // 19: neo.fs.v2.container.GetExtendedACLResponse.Body + (*grpc.RequestMetaHeader)(nil), // 20: neo.fs.v2.session.RequestMetaHeader + (*grpc.RequestVerificationHeader)(nil), // 21: neo.fs.v2.session.RequestVerificationHeader + (*grpc.ResponseMetaHeader)(nil), // 22: neo.fs.v2.session.ResponseMetaHeader + (*grpc.ResponseVerificationHeader)(nil), // 23: neo.fs.v2.session.ResponseVerificationHeader + (*Container)(nil), // 24: neo.fs.v2.container.Container + (*grpc1.SignatureRFC6979)(nil), // 25: neo.fs.v2.refs.SignatureRFC6979 + (*grpc1.ContainerID)(nil), // 26: neo.fs.v2.refs.ContainerID + (*grpc.SessionToken)(nil), // 27: neo.fs.v2.session.SessionToken + (*grpc1.OwnerID)(nil), // 28: neo.fs.v2.refs.OwnerID + (*grpc2.EACLTable)(nil), // 29: neo.fs.v2.acl.EACLTable } var file_container_grpc_service_proto_depIdxs = []int32{ - 14, // 0: neo.fs.v2.container.PutRequest.body:type_name -> neo.fs.v2.container.PutRequest.Body - 29, // 1: neo.fs.v2.container.PutRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader - 30, // 2: neo.fs.v2.container.PutRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader - 15, // 3: neo.fs.v2.container.PutResponse.body:type_name -> neo.fs.v2.container.PutResponse.Body - 31, // 4: neo.fs.v2.container.PutResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader - 32, // 5: neo.fs.v2.container.PutResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader - 16, // 6: neo.fs.v2.container.DeleteRequest.body:type_name -> neo.fs.v2.container.DeleteRequest.Body - 29, // 7: neo.fs.v2.container.DeleteRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader - 30, // 8: neo.fs.v2.container.DeleteRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader - 17, // 9: neo.fs.v2.container.DeleteResponse.body:type_name -> neo.fs.v2.container.DeleteResponse.Body - 31, // 10: neo.fs.v2.container.DeleteResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader - 32, // 11: neo.fs.v2.container.DeleteResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader - 18, // 12: neo.fs.v2.container.GetRequest.body:type_name -> neo.fs.v2.container.GetRequest.Body - 29, // 13: neo.fs.v2.container.GetRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader - 30, // 14: neo.fs.v2.container.GetRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader - 19, // 15: neo.fs.v2.container.GetResponse.body:type_name -> neo.fs.v2.container.GetResponse.Body - 31, // 16: neo.fs.v2.container.GetResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader - 32, // 17: neo.fs.v2.container.GetResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader - 20, // 18: neo.fs.v2.container.ListRequest.body:type_name -> neo.fs.v2.container.ListRequest.Body - 29, // 19: neo.fs.v2.container.ListRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader - 30, // 20: neo.fs.v2.container.ListRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader - 21, // 21: neo.fs.v2.container.ListResponse.body:type_name -> neo.fs.v2.container.ListResponse.Body - 31, // 22: neo.fs.v2.container.ListResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader - 32, // 23: neo.fs.v2.container.ListResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader - 22, // 24: neo.fs.v2.container.SetExtendedACLRequest.body:type_name -> neo.fs.v2.container.SetExtendedACLRequest.Body - 29, // 25: neo.fs.v2.container.SetExtendedACLRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader - 30, // 26: neo.fs.v2.container.SetExtendedACLRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader - 23, // 27: neo.fs.v2.container.SetExtendedACLResponse.body:type_name -> neo.fs.v2.container.SetExtendedACLResponse.Body - 31, // 28: neo.fs.v2.container.SetExtendedACLResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader - 32, // 29: neo.fs.v2.container.SetExtendedACLResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader - 24, // 30: neo.fs.v2.container.GetExtendedACLRequest.body:type_name -> neo.fs.v2.container.GetExtendedACLRequest.Body - 29, // 31: neo.fs.v2.container.GetExtendedACLRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader - 30, // 32: neo.fs.v2.container.GetExtendedACLRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader - 25, // 33: neo.fs.v2.container.GetExtendedACLResponse.body:type_name -> neo.fs.v2.container.GetExtendedACLResponse.Body - 31, // 34: neo.fs.v2.container.GetExtendedACLResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader - 32, // 35: neo.fs.v2.container.GetExtendedACLResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader - 26, // 36: neo.fs.v2.container.AnnounceUsedSpaceRequest.body:type_name -> neo.fs.v2.container.AnnounceUsedSpaceRequest.Body - 29, // 37: neo.fs.v2.container.AnnounceUsedSpaceRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader - 30, // 38: neo.fs.v2.container.AnnounceUsedSpaceRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader - 28, // 39: neo.fs.v2.container.AnnounceUsedSpaceResponse.body:type_name -> neo.fs.v2.container.AnnounceUsedSpaceResponse.Body - 31, // 40: neo.fs.v2.container.AnnounceUsedSpaceResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader - 32, // 41: neo.fs.v2.container.AnnounceUsedSpaceResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader - 33, // 42: neo.fs.v2.container.PutRequest.Body.container:type_name -> neo.fs.v2.container.Container - 34, // 43: neo.fs.v2.container.PutRequest.Body.signature:type_name -> neo.fs.v2.refs.SignatureRFC6979 - 35, // 44: neo.fs.v2.container.PutResponse.Body.container_id:type_name -> neo.fs.v2.refs.ContainerID - 35, // 45: neo.fs.v2.container.DeleteRequest.Body.container_id:type_name -> neo.fs.v2.refs.ContainerID - 34, // 46: neo.fs.v2.container.DeleteRequest.Body.signature:type_name -> neo.fs.v2.refs.SignatureRFC6979 - 35, // 47: neo.fs.v2.container.GetRequest.Body.container_id:type_name -> neo.fs.v2.refs.ContainerID - 33, // 48: neo.fs.v2.container.GetResponse.Body.container:type_name -> neo.fs.v2.container.Container - 34, // 49: neo.fs.v2.container.GetResponse.Body.signature:type_name -> neo.fs.v2.refs.SignatureRFC6979 - 36, // 50: neo.fs.v2.container.GetResponse.Body.session_token:type_name -> neo.fs.v2.session.SessionToken - 37, // 51: neo.fs.v2.container.ListRequest.Body.owner_id:type_name -> neo.fs.v2.refs.OwnerID - 35, // 52: neo.fs.v2.container.ListResponse.Body.container_ids:type_name -> neo.fs.v2.refs.ContainerID - 38, // 53: neo.fs.v2.container.SetExtendedACLRequest.Body.eacl:type_name -> neo.fs.v2.acl.EACLTable - 34, // 54: neo.fs.v2.container.SetExtendedACLRequest.Body.signature:type_name -> neo.fs.v2.refs.SignatureRFC6979 - 35, // 55: neo.fs.v2.container.GetExtendedACLRequest.Body.container_id:type_name -> neo.fs.v2.refs.ContainerID - 38, // 56: neo.fs.v2.container.GetExtendedACLResponse.Body.eacl:type_name -> neo.fs.v2.acl.EACLTable - 34, // 57: neo.fs.v2.container.GetExtendedACLResponse.Body.signature:type_name -> neo.fs.v2.refs.SignatureRFC6979 - 36, // 58: neo.fs.v2.container.GetExtendedACLResponse.Body.session_token:type_name -> neo.fs.v2.session.SessionToken - 27, // 59: neo.fs.v2.container.AnnounceUsedSpaceRequest.Body.announcements:type_name -> neo.fs.v2.container.AnnounceUsedSpaceRequest.Body.Announcement - 35, // 60: neo.fs.v2.container.AnnounceUsedSpaceRequest.Body.Announcement.container_id:type_name -> neo.fs.v2.refs.ContainerID - 0, // 61: neo.fs.v2.container.ContainerService.Put:input_type -> neo.fs.v2.container.PutRequest - 2, // 62: neo.fs.v2.container.ContainerService.Delete:input_type -> neo.fs.v2.container.DeleteRequest - 4, // 63: neo.fs.v2.container.ContainerService.Get:input_type -> neo.fs.v2.container.GetRequest - 6, // 64: neo.fs.v2.container.ContainerService.List:input_type -> neo.fs.v2.container.ListRequest - 8, // 65: neo.fs.v2.container.ContainerService.SetExtendedACL:input_type -> neo.fs.v2.container.SetExtendedACLRequest - 10, // 66: neo.fs.v2.container.ContainerService.GetExtendedACL:input_type -> neo.fs.v2.container.GetExtendedACLRequest - 12, // 67: neo.fs.v2.container.ContainerService.AnnounceUsedSpace:input_type -> neo.fs.v2.container.AnnounceUsedSpaceRequest - 1, // 68: neo.fs.v2.container.ContainerService.Put:output_type -> neo.fs.v2.container.PutResponse - 3, // 69: neo.fs.v2.container.ContainerService.Delete:output_type -> neo.fs.v2.container.DeleteResponse - 5, // 70: neo.fs.v2.container.ContainerService.Get:output_type -> neo.fs.v2.container.GetResponse - 7, // 71: neo.fs.v2.container.ContainerService.List:output_type -> neo.fs.v2.container.ListResponse - 9, // 72: neo.fs.v2.container.ContainerService.SetExtendedACL:output_type -> neo.fs.v2.container.SetExtendedACLResponse - 11, // 73: neo.fs.v2.container.ContainerService.GetExtendedACL:output_type -> neo.fs.v2.container.GetExtendedACLResponse - 13, // 74: neo.fs.v2.container.ContainerService.AnnounceUsedSpace:output_type -> neo.fs.v2.container.AnnounceUsedSpaceResponse - 68, // [68:75] is the sub-list for method output_type - 61, // [61:68] is the sub-list for method input_type - 61, // [61:61] is the sub-list for extension type_name - 61, // [61:61] is the sub-list for extension extendee - 0, // [0:61] is the sub-list for field type_name + 10, // 0: neo.fs.v2.container.PutRequest.body:type_name -> neo.fs.v2.container.PutRequest.Body + 20, // 1: neo.fs.v2.container.PutRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader + 21, // 2: neo.fs.v2.container.PutRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader + 11, // 3: neo.fs.v2.container.PutResponse.body:type_name -> neo.fs.v2.container.PutResponse.Body + 22, // 4: neo.fs.v2.container.PutResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader + 23, // 5: neo.fs.v2.container.PutResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 12, // 6: neo.fs.v2.container.DeleteRequest.body:type_name -> neo.fs.v2.container.DeleteRequest.Body + 20, // 7: neo.fs.v2.container.DeleteRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader + 21, // 8: neo.fs.v2.container.DeleteRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader + 13, // 9: neo.fs.v2.container.DeleteResponse.body:type_name -> neo.fs.v2.container.DeleteResponse.Body + 22, // 10: neo.fs.v2.container.DeleteResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader + 23, // 11: neo.fs.v2.container.DeleteResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 14, // 12: neo.fs.v2.container.GetRequest.body:type_name -> neo.fs.v2.container.GetRequest.Body + 20, // 13: neo.fs.v2.container.GetRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader + 21, // 14: neo.fs.v2.container.GetRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader + 15, // 15: neo.fs.v2.container.GetResponse.body:type_name -> neo.fs.v2.container.GetResponse.Body + 22, // 16: neo.fs.v2.container.GetResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader + 23, // 17: neo.fs.v2.container.GetResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 16, // 18: neo.fs.v2.container.ListRequest.body:type_name -> neo.fs.v2.container.ListRequest.Body + 20, // 19: neo.fs.v2.container.ListRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader + 21, // 20: neo.fs.v2.container.ListRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader + 17, // 21: neo.fs.v2.container.ListResponse.body:type_name -> neo.fs.v2.container.ListResponse.Body + 22, // 22: neo.fs.v2.container.ListResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader + 23, // 23: neo.fs.v2.container.ListResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 18, // 24: neo.fs.v2.container.GetExtendedACLRequest.body:type_name -> neo.fs.v2.container.GetExtendedACLRequest.Body + 20, // 25: neo.fs.v2.container.GetExtendedACLRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader + 21, // 26: neo.fs.v2.container.GetExtendedACLRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader + 19, // 27: neo.fs.v2.container.GetExtendedACLResponse.body:type_name -> neo.fs.v2.container.GetExtendedACLResponse.Body + 22, // 28: neo.fs.v2.container.GetExtendedACLResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader + 23, // 29: neo.fs.v2.container.GetExtendedACLResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 24, // 30: neo.fs.v2.container.PutRequest.Body.container:type_name -> neo.fs.v2.container.Container + 25, // 31: neo.fs.v2.container.PutRequest.Body.signature:type_name -> neo.fs.v2.refs.SignatureRFC6979 + 26, // 32: neo.fs.v2.container.PutResponse.Body.container_id:type_name -> neo.fs.v2.refs.ContainerID + 26, // 33: neo.fs.v2.container.DeleteRequest.Body.container_id:type_name -> neo.fs.v2.refs.ContainerID + 25, // 34: neo.fs.v2.container.DeleteRequest.Body.signature:type_name -> neo.fs.v2.refs.SignatureRFC6979 + 26, // 35: neo.fs.v2.container.GetRequest.Body.container_id:type_name -> neo.fs.v2.refs.ContainerID + 24, // 36: neo.fs.v2.container.GetResponse.Body.container:type_name -> neo.fs.v2.container.Container + 25, // 37: neo.fs.v2.container.GetResponse.Body.signature:type_name -> neo.fs.v2.refs.SignatureRFC6979 + 27, // 38: neo.fs.v2.container.GetResponse.Body.session_token:type_name -> neo.fs.v2.session.SessionToken + 28, // 39: neo.fs.v2.container.ListRequest.Body.owner_id:type_name -> neo.fs.v2.refs.OwnerID + 26, // 40: neo.fs.v2.container.ListResponse.Body.container_ids:type_name -> neo.fs.v2.refs.ContainerID + 26, // 41: neo.fs.v2.container.GetExtendedACLRequest.Body.container_id:type_name -> neo.fs.v2.refs.ContainerID + 29, // 42: neo.fs.v2.container.GetExtendedACLResponse.Body.eacl:type_name -> neo.fs.v2.acl.EACLTable + 25, // 43: neo.fs.v2.container.GetExtendedACLResponse.Body.signature:type_name -> neo.fs.v2.refs.SignatureRFC6979 + 27, // 44: neo.fs.v2.container.GetExtendedACLResponse.Body.session_token:type_name -> neo.fs.v2.session.SessionToken + 0, // 45: neo.fs.v2.container.ContainerService.Put:input_type -> neo.fs.v2.container.PutRequest + 2, // 46: neo.fs.v2.container.ContainerService.Delete:input_type -> neo.fs.v2.container.DeleteRequest + 4, // 47: neo.fs.v2.container.ContainerService.Get:input_type -> neo.fs.v2.container.GetRequest + 6, // 48: neo.fs.v2.container.ContainerService.List:input_type -> neo.fs.v2.container.ListRequest + 8, // 49: neo.fs.v2.container.ContainerService.GetExtendedACL:input_type -> neo.fs.v2.container.GetExtendedACLRequest + 1, // 50: neo.fs.v2.container.ContainerService.Put:output_type -> neo.fs.v2.container.PutResponse + 3, // 51: neo.fs.v2.container.ContainerService.Delete:output_type -> neo.fs.v2.container.DeleteResponse + 5, // 52: neo.fs.v2.container.ContainerService.Get:output_type -> neo.fs.v2.container.GetResponse + 7, // 53: neo.fs.v2.container.ContainerService.List:output_type -> neo.fs.v2.container.ListResponse + 9, // 54: neo.fs.v2.container.ContainerService.GetExtendedACL:output_type -> neo.fs.v2.container.GetExtendedACLResponse + 50, // [50:55] is the sub-list for method output_type + 45, // [45:50] is the sub-list for method input_type + 45, // [45:45] is the sub-list for extension type_name + 45, // [45:45] is the sub-list for extension extendee + 0, // [0:45] is the sub-list for field type_name } func init() { file_container_grpc_service_proto_init() } @@ -2412,30 +1744,6 @@ func file_container_grpc_service_proto_init() { } } file_container_grpc_service_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SetExtendedACLRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_container_grpc_service_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SetExtendedACLResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_container_grpc_service_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GetExtendedACLRequest); i { case 0: return &v.state @@ -2447,7 +1755,7 @@ func file_container_grpc_service_proto_init() { return nil } } - file_container_grpc_service_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + file_container_grpc_service_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GetExtendedACLResponse); i { case 0: return &v.state @@ -2459,31 +1767,7 @@ func file_container_grpc_service_proto_init() { return nil } } - file_container_grpc_service_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AnnounceUsedSpaceRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_container_grpc_service_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AnnounceUsedSpaceResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_container_grpc_service_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { + file_container_grpc_service_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PutRequest_Body); i { case 0: return &v.state @@ -2495,7 +1779,7 @@ func file_container_grpc_service_proto_init() { return nil } } - file_container_grpc_service_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { + file_container_grpc_service_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PutResponse_Body); i { case 0: return &v.state @@ -2507,7 +1791,7 @@ func file_container_grpc_service_proto_init() { return nil } } - file_container_grpc_service_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { + file_container_grpc_service_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*DeleteRequest_Body); i { case 0: return &v.state @@ -2519,7 +1803,7 @@ func file_container_grpc_service_proto_init() { return nil } } - file_container_grpc_service_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { + file_container_grpc_service_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*DeleteResponse_Body); i { case 0: return &v.state @@ -2531,7 +1815,7 @@ func file_container_grpc_service_proto_init() { return nil } } - file_container_grpc_service_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { + file_container_grpc_service_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GetRequest_Body); i { case 0: return &v.state @@ -2543,7 +1827,7 @@ func file_container_grpc_service_proto_init() { return nil } } - file_container_grpc_service_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { + file_container_grpc_service_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GetResponse_Body); i { case 0: return &v.state @@ -2555,7 +1839,7 @@ func file_container_grpc_service_proto_init() { return nil } } - file_container_grpc_service_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { + file_container_grpc_service_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ListRequest_Body); i { case 0: return &v.state @@ -2567,7 +1851,7 @@ func file_container_grpc_service_proto_init() { return nil } } - file_container_grpc_service_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { + file_container_grpc_service_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ListResponse_Body); i { case 0: return &v.state @@ -2579,31 +1863,7 @@ func file_container_grpc_service_proto_init() { return nil } } - file_container_grpc_service_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SetExtendedACLRequest_Body); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_container_grpc_service_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SetExtendedACLResponse_Body); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_container_grpc_service_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} { + file_container_grpc_service_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GetExtendedACLRequest_Body); i { case 0: return &v.state @@ -2615,7 +1875,7 @@ func file_container_grpc_service_proto_init() { return nil } } - file_container_grpc_service_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} { + file_container_grpc_service_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GetExtendedACLResponse_Body); i { case 0: return &v.state @@ -2627,42 +1887,6 @@ func file_container_grpc_service_proto_init() { return nil } } - file_container_grpc_service_proto_msgTypes[26].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AnnounceUsedSpaceRequest_Body); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_container_grpc_service_proto_msgTypes[27].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AnnounceUsedSpaceRequest_Body_Announcement); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_container_grpc_service_proto_msgTypes[28].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AnnounceUsedSpaceResponse_Body); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } } type x struct{} out := protoimpl.TypeBuilder{ @@ -2670,7 +1894,7 @@ func file_container_grpc_service_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_container_grpc_service_proto_rawDesc, NumEnums: 0, - NumMessages: 29, + NumMessages: 20, NumExtensions: 0, NumServices: 1, }, diff --git a/container/grpc/service_grpc.pb.go b/container/grpc/service_grpc.pb.go index 6ae8ade..939a978 100644 --- a/container/grpc/service_grpc.pb.go +++ b/container/grpc/service_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.3.0 -// - protoc v4.25.3 +// - protoc v5.27.2 // source: container/grpc/service.proto package container @@ -19,13 +19,11 @@ import ( 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_SetExtendedACL_FullMethodName = "/neo.fs.v2.container.ContainerService/SetExtendedACL" - ContainerService_GetExtendedACL_FullMethodName = "/neo.fs.v2.container.ContainerService/GetExtendedACL" - ContainerService_AnnounceUsedSpace_FullMethodName = "/neo.fs.v2.container.ContainerService/AnnounceUsedSpace" + 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_GetExtendedACL_FullMethodName = "/neo.fs.v2.container.ContainerService/GetExtendedACL" ) // ContainerServiceClient is the client API for ContainerService service. @@ -76,17 +74,6 @@ type ContainerServiceClient interface { // - **CONTAINER_ACCESS_DENIED** (3074, SECTION_CONTAINER): \ // container list access denied. List(ctx context.Context, in *ListRequest, opts ...grpc.CallOption) (*ListResponse, error) - // Invokes 'SetEACL' method of 'Container` smart contract and returns response - // immediately. After one more block in sidechain, changes in an Extended ACL - // are added into smart contract storage. - // - // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // request to save container eACL has been sent to the sidechain; - // - Common failures (SECTION_FAILURE_COMMON); - // - **CONTAINER_ACCESS_DENIED** (3074, SECTION_CONTAINER): \ - // set container eACL access denied. - SetExtendedACL(ctx context.Context, in *SetExtendedACLRequest, opts ...grpc.CallOption) (*SetExtendedACLResponse, error) // Returns Extended ACL table and signature from `Container` smart contract // storage. // @@ -101,13 +88,6 @@ type ContainerServiceClient interface { // - **CONTAINER_ACCESS_DENIED** (3074, SECTION_CONTAINER): \ // access to container eACL is denied. GetExtendedACL(ctx context.Context, in *GetExtendedACLRequest, opts ...grpc.CallOption) (*GetExtendedACLResponse, error) - // Announces the space values used by the container for P2P synchronization. - // - // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // estimation of used space has been successfully announced; - // - Common failures (SECTION_FAILURE_COMMON). - AnnounceUsedSpace(ctx context.Context, in *AnnounceUsedSpaceRequest, opts ...grpc.CallOption) (*AnnounceUsedSpaceResponse, error) } type containerServiceClient struct { @@ -154,15 +134,6 @@ func (c *containerServiceClient) List(ctx context.Context, in *ListRequest, opts return out, nil } -func (c *containerServiceClient) SetExtendedACL(ctx context.Context, in *SetExtendedACLRequest, opts ...grpc.CallOption) (*SetExtendedACLResponse, error) { - out := new(SetExtendedACLResponse) - err := c.cc.Invoke(ctx, ContainerService_SetExtendedACL_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - func (c *containerServiceClient) GetExtendedACL(ctx context.Context, in *GetExtendedACLRequest, opts ...grpc.CallOption) (*GetExtendedACLResponse, error) { out := new(GetExtendedACLResponse) err := c.cc.Invoke(ctx, ContainerService_GetExtendedACL_FullMethodName, in, out, opts...) @@ -172,15 +143,6 @@ func (c *containerServiceClient) GetExtendedACL(ctx context.Context, in *GetExte return out, nil } -func (c *containerServiceClient) AnnounceUsedSpace(ctx context.Context, in *AnnounceUsedSpaceRequest, opts ...grpc.CallOption) (*AnnounceUsedSpaceResponse, error) { - out := new(AnnounceUsedSpaceResponse) - err := c.cc.Invoke(ctx, ContainerService_AnnounceUsedSpace_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - // ContainerServiceServer is the server API for ContainerService service. // All implementations should embed UnimplementedContainerServiceServer // for forward compatibility @@ -229,17 +191,6 @@ type ContainerServiceServer interface { // - **CONTAINER_ACCESS_DENIED** (3074, SECTION_CONTAINER): \ // container list access denied. List(context.Context, *ListRequest) (*ListResponse, error) - // Invokes 'SetEACL' method of 'Container` smart contract and returns response - // immediately. After one more block in sidechain, changes in an Extended ACL - // are added into smart contract storage. - // - // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // request to save container eACL has been sent to the sidechain; - // - Common failures (SECTION_FAILURE_COMMON); - // - **CONTAINER_ACCESS_DENIED** (3074, SECTION_CONTAINER): \ - // set container eACL access denied. - SetExtendedACL(context.Context, *SetExtendedACLRequest) (*SetExtendedACLResponse, error) // Returns Extended ACL table and signature from `Container` smart contract // storage. // @@ -254,13 +205,6 @@ type ContainerServiceServer interface { // - **CONTAINER_ACCESS_DENIED** (3074, SECTION_CONTAINER): \ // access to container eACL is denied. GetExtendedACL(context.Context, *GetExtendedACLRequest) (*GetExtendedACLResponse, error) - // Announces the space values used by the container for P2P synchronization. - // - // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // estimation of used space has been successfully announced; - // - Common failures (SECTION_FAILURE_COMMON). - AnnounceUsedSpace(context.Context, *AnnounceUsedSpaceRequest) (*AnnounceUsedSpaceResponse, error) } // UnimplementedContainerServiceServer should be embedded to have forward compatible implementations. @@ -279,15 +223,9 @@ 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) SetExtendedACL(context.Context, *SetExtendedACLRequest) (*SetExtendedACLResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method SetExtendedACL not implemented") -} func (UnimplementedContainerServiceServer) GetExtendedACL(context.Context, *GetExtendedACLRequest) (*GetExtendedACLResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method GetExtendedACL not implemented") } -func (UnimplementedContainerServiceServer) AnnounceUsedSpace(context.Context, *AnnounceUsedSpaceRequest) (*AnnounceUsedSpaceResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method AnnounceUsedSpace not implemented") -} // 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 @@ -372,24 +310,6 @@ func _ContainerService_List_Handler(srv interface{}, ctx context.Context, dec fu return interceptor(ctx, in, info, handler) } -func _ContainerService_SetExtendedACL_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(SetExtendedACLRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ContainerServiceServer).SetExtendedACL(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: ContainerService_SetExtendedACL_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ContainerServiceServer).SetExtendedACL(ctx, req.(*SetExtendedACLRequest)) - } - return interceptor(ctx, in, info, handler) -} - func _ContainerService_GetExtendedACL_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(GetExtendedACLRequest) if err := dec(in); err != nil { @@ -408,24 +328,6 @@ func _ContainerService_GetExtendedACL_Handler(srv interface{}, ctx context.Conte return interceptor(ctx, in, info, handler) } -func _ContainerService_AnnounceUsedSpace_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(AnnounceUsedSpaceRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ContainerServiceServer).AnnounceUsedSpace(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: ContainerService_AnnounceUsedSpace_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ContainerServiceServer).AnnounceUsedSpace(ctx, req.(*AnnounceUsedSpaceRequest)) - } - return interceptor(ctx, in, info, handler) -} - // 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) @@ -449,18 +351,10 @@ var ContainerService_ServiceDesc = grpc.ServiceDesc{ MethodName: "List", Handler: _ContainerService_List_Handler, }, - { - MethodName: "SetExtendedACL", - Handler: _ContainerService_SetExtendedACL_Handler, - }, { MethodName: "GetExtendedACL", Handler: _ContainerService_GetExtendedACL_Handler, }, - { - MethodName: "AnnounceUsedSpace", - Handler: _ContainerService_AnnounceUsedSpace_Handler, - }, }, Streams: []grpc.StreamDesc{}, Metadata: "container/grpc/service.proto", diff --git a/container/grpc/types.pb.go b/container/grpc/types.pb.go index c484a0d..d0e19ec 100644 --- a/container/grpc/types.pb.go +++ b/container/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.33.0 -// protoc v4.25.3 +// protoc v5.27.2 // source: container/grpc/types.proto package container diff --git a/container/marshal.go b/container/marshal.go index a7c57aa..ff17150 100644 --- a/container/marshal.go +++ b/container/marshal.go @@ -35,20 +35,11 @@ const ( listRespBodyIDsField = 1 - setEACLReqBodyTableField = 1 - setEACLReqBodySignatureField = 2 - getEACLReqBodyIDField = 1 getEACLRespBodyTableField = 1 getEACLRespBodySignatureField = 2 getEACLRespBodyTokenField = 3 - - usedSpaceAnnounceEpochField = 1 - usedSpaceAnnounceCIDField = 2 - usedSpaceAnnounceUsedSpaceField = 3 - - usedSpaceReqBodyAnnouncementsField = 1 ) func (a *Attribute) StableMarshal(buf []byte) []byte { @@ -359,50 +350,6 @@ func (r *ListResponseBody) Unmarshal(data []byte) error { return message.Unmarshal(r, data, new(container.ListResponse_Body)) } -func (r *SetExtendedACLRequestBody) StableMarshal(buf []byte) []byte { - if r == nil { - return []byte{} - } - - if buf == nil { - buf = make([]byte, r.StableSize()) - } - - var offset int - - offset += protoutil.NestedStructureMarshal(setEACLReqBodyTableField, buf[offset:], r.eacl) - protoutil.NestedStructureMarshal(setEACLReqBodySignatureField, buf[offset:], r.sig) - - return buf -} - -func (r *SetExtendedACLRequestBody) StableSize() (size int) { - if r == nil { - return 0 - } - - size += protoutil.NestedStructureSize(setEACLReqBodyTableField, r.eacl) - size += protoutil.NestedStructureSize(setEACLReqBodySignatureField, r.sig) - - return size -} - -func (r *SetExtendedACLRequestBody) Unmarshal(data []byte) error { - return message.Unmarshal(r, data, new(container.SetExtendedACLRequest_Body)) -} - -func (r *SetExtendedACLResponseBody) StableMarshal(_ []byte) []byte { - return nil -} - -func (r *SetExtendedACLResponseBody) StableSize() (size int) { - return 0 -} - -func (r *SetExtendedACLResponseBody) Unmarshal([]byte) error { - return nil -} - func (r *GetExtendedACLRequestBody) StableMarshal(buf []byte) []byte { if r == nil { return []byte{} @@ -464,83 +411,3 @@ func (r *GetExtendedACLResponseBody) StableSize() (size int) { func (r *GetExtendedACLResponseBody) Unmarshal(data []byte) error { return message.Unmarshal(r, data, new(container.GetExtendedACLResponse_Body)) } - -func (a *UsedSpaceAnnouncement) StableMarshal(buf []byte) []byte { - if a == nil { - return []byte{} - } - - if buf == nil { - buf = make([]byte, a.StableSize()) - } - - var offset int - - offset += protoutil.UInt64Marshal(usedSpaceAnnounceEpochField, buf[offset:], a.epoch) - offset += protoutil.NestedStructureMarshal(usedSpaceAnnounceCIDField, buf[offset:], a.cid) - protoutil.UInt64Marshal(usedSpaceAnnounceUsedSpaceField, buf[offset:], a.usedSpace) - - return buf -} - -func (a *UsedSpaceAnnouncement) StableSize() (size int) { - if a == nil { - return 0 - } - - size += protoutil.UInt64Size(usedSpaceAnnounceEpochField, a.epoch) - size += protoutil.NestedStructureSize(usedSpaceAnnounceCIDField, a.cid) - size += protoutil.UInt64Size(usedSpaceAnnounceUsedSpaceField, a.usedSpace) - - return size -} - -func (a *UsedSpaceAnnouncement) Unmarshal(data []byte) error { - return message.Unmarshal(a, data, new(container.AnnounceUsedSpaceRequest_Body_Announcement)) -} - -func (r *AnnounceUsedSpaceRequestBody) StableMarshal(buf []byte) []byte { - if r == nil { - return []byte{} - } - - if buf == nil { - buf = make([]byte, r.StableSize()) - } - - var offset int - - for i := range r.announcements { - offset += protoutil.NestedStructureMarshal(usedSpaceReqBodyAnnouncementsField, buf[offset:], &r.announcements[i]) - } - - return buf -} - -func (r *AnnounceUsedSpaceRequestBody) StableSize() (size int) { - if r == nil { - return 0 - } - - for i := range r.announcements { - size += protoutil.NestedStructureSize(usedSpaceReqBodyAnnouncementsField, &r.announcements[i]) - } - - return size -} - -func (r *AnnounceUsedSpaceRequestBody) Unmarshal(data []byte) error { - return message.Unmarshal(r, data, new(container.AnnounceUsedSpaceRequest_Body)) -} - -func (r *AnnounceUsedSpaceResponseBody) StableMarshal(_ []byte) []byte { - return nil -} - -func (r *AnnounceUsedSpaceResponseBody) StableSize() (size int) { - return 0 -} - -func (r *AnnounceUsedSpaceResponseBody) Unmarshal([]byte) error { - return nil -} diff --git a/container/message_test.go b/container/message_test.go index 869ccb2..6558e25 100644 --- a/container/message_test.go +++ b/container/message_test.go @@ -28,8 +28,6 @@ func TestMessageConvert(t *testing.T) { func(empty bool) message.Message { return containertest.GenerateListRequest(empty) }, func(empty bool) message.Message { return containertest.GenerateListResponseBody(empty) }, func(empty bool) message.Message { return containertest.GenerateListResponse(empty) }, - func(empty bool) message.Message { return containertest.GenerateSetExtendedACLRequestBody(empty) }, - func(empty bool) message.Message { return containertest.GenerateSetExtendedACLRequest(empty) }, func(empty bool) message.Message { return containertest.GenerateGetRequestBody(empty) }, func(empty bool) message.Message { return containertest.GenerateGetRequest(empty) }, func(empty bool) message.Message { return containertest.GenerateGetResponseBody(empty) }, @@ -38,10 +36,5 @@ func TestMessageConvert(t *testing.T) { func(empty bool) message.Message { return containertest.GenerateGetExtendedACLRequest(empty) }, func(empty bool) message.Message { return containertest.GenerateGetExtendedACLResponseBody(empty) }, func(empty bool) message.Message { return containertest.GenerateGetExtendedACLResponse(empty) }, - func(empty bool) message.Message { return containertest.GenerateUsedSpaceAnnouncement(empty) }, - func(empty bool) message.Message { return containertest.GenerateAnnounceUsedSpaceRequestBody(empty) }, - func(empty bool) message.Message { return containertest.GenerateAnnounceUsedSpaceRequest(empty) }, - func(empty bool) message.Message { return containertest.GenerateAnnounceUsedSpaceResponseBody(empty) }, - func(empty bool) message.Message { return containertest.GenerateAnnounceUsedSpaceResponse(empty) }, ) } diff --git a/container/test/generate.go b/container/test/generate.go index 2b2afdf..b94347b 100644 --- a/container/test/generate.go +++ b/container/test/generate.go @@ -235,50 +235,6 @@ func GenerateListResponse(empty bool) *container.ListResponse { return m } -func GenerateSetExtendedACLRequestBody(empty bool) *container.SetExtendedACLRequestBody { - m := new(container.SetExtendedACLRequestBody) - - if !empty { - m.SetEACL(acltest.GenerateTable(false)) - } - - m.SetSignature(refstest.GenerateSignature(empty)) - - return m -} - -func GenerateSetExtendedACLRequest(empty bool) *container.SetExtendedACLRequest { - m := new(container.SetExtendedACLRequest) - - if !empty { - m.SetBody(GenerateSetExtendedACLRequestBody(false)) - } - - m.SetMetaHeader(sessiontest.GenerateRequestMetaHeader(empty)) - m.SetVerificationHeader(sessiontest.GenerateRequestVerificationHeader(empty)) - - return m -} - -func GenerateSetExtendedACLResponseBody(_ bool) *container.SetExtendedACLResponseBody { - m := new(container.SetExtendedACLResponseBody) - - return m -} - -func GenerateSetExtendedACLResponse(empty bool) *container.SetExtendedACLResponse { - m := new(container.SetExtendedACLResponse) - - if !empty { - m.SetBody(GenerateSetExtendedACLResponseBody(false)) - } - - m.SetMetaHeader(sessiontest.GenerateResponseMetaHeader(empty)) - m.SetVerificationHeader(sessiontest.GenerateResponseVerificationHeader(empty)) - - return m -} - func GenerateGetExtendedACLRequestBody(empty bool) *container.GetExtendedACLRequestBody { m := new(container.GetExtendedACLRequestBody) @@ -327,70 +283,3 @@ func GenerateGetExtendedACLResponse(empty bool) *container.GetExtendedACLRespons return m } - -func GenerateUsedSpaceAnnouncement(empty bool) *container.UsedSpaceAnnouncement { - m := new(container.UsedSpaceAnnouncement) - - if !empty { - m.SetContainerID(refstest.GenerateContainerID(false)) - m.SetEpoch(1) - m.SetUsedSpace(2) - } - - return m -} - -func GenerateUsedSpaceAnnouncements(empty bool) []container.UsedSpaceAnnouncement { - var res []container.UsedSpaceAnnouncement - - if !empty { - res = append(res, - *GenerateUsedSpaceAnnouncement(false), - *GenerateUsedSpaceAnnouncement(false), - ) - } - - return res -} - -func GenerateAnnounceUsedSpaceRequestBody(empty bool) *container.AnnounceUsedSpaceRequestBody { - m := new(container.AnnounceUsedSpaceRequestBody) - - if !empty { - m.SetAnnouncements(GenerateUsedSpaceAnnouncements(false)) - } - - return m -} - -func GenerateAnnounceUsedSpaceRequest(empty bool) *container.AnnounceUsedSpaceRequest { - m := new(container.AnnounceUsedSpaceRequest) - - if !empty { - m.SetBody(GenerateAnnounceUsedSpaceRequestBody(false)) - } - - m.SetMetaHeader(sessiontest.GenerateRequestMetaHeader(empty)) - m.SetVerificationHeader(sessiontest.GenerateRequestVerificationHeader(empty)) - - return m -} - -func GenerateAnnounceUsedSpaceResponseBody(_ bool) *container.AnnounceUsedSpaceResponseBody { - m := new(container.AnnounceUsedSpaceResponseBody) - - return m -} - -func GenerateAnnounceUsedSpaceResponse(empty bool) *container.AnnounceUsedSpaceResponse { - m := new(container.AnnounceUsedSpaceResponse) - - if !empty { - m.SetBody(GenerateAnnounceUsedSpaceResponseBody(false)) - } - - m.SetMetaHeader(sessiontest.GenerateResponseMetaHeader(empty)) - m.SetVerificationHeader(sessiontest.GenerateResponseVerificationHeader(empty)) - - return m -} diff --git a/container/types.go b/container/types.go index 948580d..3a9e915 100644 --- a/container/types.go +++ b/container/types.go @@ -110,26 +110,6 @@ type ListResponse struct { session.ResponseHeaders } -type SetExtendedACLRequestBody struct { - eacl *acl.Table - - sig *refs.Signature -} - -type SetExtendedACLRequest struct { - body *SetExtendedACLRequestBody - - session.RequestHeaders -} - -type SetExtendedACLResponseBody struct{} - -type SetExtendedACLResponse struct { - body *SetExtendedACLResponseBody - - session.ResponseHeaders -} - type GetExtendedACLRequestBody struct { cid *refs.ContainerID } @@ -154,32 +134,6 @@ type GetExtendedACLResponse struct { session.ResponseHeaders } -type UsedSpaceAnnouncement struct { - epoch uint64 - - cid *refs.ContainerID - - usedSpace uint64 -} - -type AnnounceUsedSpaceRequestBody struct { - announcements []UsedSpaceAnnouncement -} - -type AnnounceUsedSpaceRequest struct { - body *AnnounceUsedSpaceRequestBody - - session.RequestHeaders -} - -type AnnounceUsedSpaceResponseBody struct{} - -type AnnounceUsedSpaceResponse struct { - body *AnnounceUsedSpaceResponseBody - - session.ResponseHeaders -} - func (a *Attribute) GetKey() string { if a != nil { return a.key @@ -516,56 +470,6 @@ func (r *ListResponse) SetBody(v *ListResponseBody) { r.body = v } -func (r *SetExtendedACLRequestBody) GetEACL() *acl.Table { - if r != nil { - return r.eacl - } - - return nil -} - -func (r *SetExtendedACLRequestBody) SetEACL(v *acl.Table) { - r.eacl = v -} - -func (r *SetExtendedACLRequestBody) GetSignature() *refs.Signature { - if r != nil { - return r.sig - } - - return nil -} - -func (r *SetExtendedACLRequestBody) SetSignature(v *refs.Signature) { - // TODO: (neofs-api-go#381) avoid this hack (e.g. create refs.SignatureRFC6979 type) - v.SetScheme(0) - r.sig = v -} - -func (r *SetExtendedACLRequest) GetBody() *SetExtendedACLRequestBody { - if r != nil { - return r.body - } - - return nil -} - -func (r *SetExtendedACLRequest) SetBody(v *SetExtendedACLRequestBody) { - r.body = v -} - -func (r *SetExtendedACLResponse) GetBody() *SetExtendedACLResponseBody { - if r != nil { - return r.body - } - - return nil -} - -func (r *SetExtendedACLResponse) SetBody(v *SetExtendedACLResponseBody) { - r.body = v -} - func (r *GetExtendedACLRequestBody) GetContainerID() *refs.ContainerID { if r != nil { return r.cid @@ -643,75 +547,3 @@ func (r *GetExtendedACLResponse) GetBody() *GetExtendedACLResponseBody { func (r *GetExtendedACLResponse) SetBody(v *GetExtendedACLResponseBody) { r.body = v } - -func (a *UsedSpaceAnnouncement) GetEpoch() uint64 { - if a != nil { - return a.epoch - } - - return 0 -} - -func (a *UsedSpaceAnnouncement) SetEpoch(v uint64) { - a.epoch = v -} - -func (a *UsedSpaceAnnouncement) GetUsedSpace() uint64 { - if a != nil { - return a.usedSpace - } - - return 0 -} - -func (a *UsedSpaceAnnouncement) SetUsedSpace(v uint64) { - a.usedSpace = v -} - -func (a *UsedSpaceAnnouncement) GetContainerID() *refs.ContainerID { - if a != nil { - return a.cid - } - - return nil -} - -func (a *UsedSpaceAnnouncement) SetContainerID(v *refs.ContainerID) { - a.cid = v -} - -func (r *AnnounceUsedSpaceRequestBody) GetAnnouncements() []UsedSpaceAnnouncement { - if r != nil { - return r.announcements - } - - return nil -} - -func (r *AnnounceUsedSpaceRequestBody) SetAnnouncements(v []UsedSpaceAnnouncement) { - r.announcements = v -} - -func (r *AnnounceUsedSpaceRequest) GetBody() *AnnounceUsedSpaceRequestBody { - if r != nil { - return r.body - } - - return nil -} - -func (r *AnnounceUsedSpaceRequest) SetBody(v *AnnounceUsedSpaceRequestBody) { - r.body = v -} - -func (r *AnnounceUsedSpaceResponse) GetBody() *AnnounceUsedSpaceResponseBody { - if r != nil { - return r.body - } - - return nil -} - -func (r *AnnounceUsedSpaceResponse) SetBody(v *AnnounceUsedSpaceResponseBody) { - r.body = v -} diff --git a/lock/grpc/types.pb.go b/lock/grpc/types.pb.go index c2d66f1..38b62fe 100644 --- a/lock/grpc/types.pb.go +++ b/lock/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.33.0 -// protoc v4.25.3 +// protoc v5.27.2 // source: lock/grpc/types.proto package lock diff --git a/netmap/grpc/service.pb.go b/netmap/grpc/service.pb.go index 7694f3f..eb91862 100644 --- a/netmap/grpc/service.pb.go +++ b/netmap/grpc/service.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.33.0 -// protoc v4.25.3 +// protoc v5.27.2 // source: netmap/grpc/service.proto package netmap diff --git a/netmap/grpc/service_grpc.pb.go b/netmap/grpc/service_grpc.pb.go index 00cb8de..7881cd6 100644 --- a/netmap/grpc/service_grpc.pb.go +++ b/netmap/grpc/service_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.3.0 -// - protoc v4.25.3 +// - protoc v5.27.2 // source: netmap/grpc/service.proto package netmap diff --git a/netmap/grpc/types.pb.go b/netmap/grpc/types.pb.go index 59f8612..8924213 100644 --- a/netmap/grpc/types.pb.go +++ b/netmap/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.33.0 -// protoc v4.25.3 +// protoc v5.27.2 // source: netmap/grpc/types.proto package netmap diff --git a/object/grpc/service.pb.go b/object/grpc/service.pb.go index 75d359e..01ba86f 100644 --- a/object/grpc/service.pb.go +++ b/object/grpc/service.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.33.0 -// protoc v4.25.3 +// protoc v5.27.2 // source: object/grpc/service.proto package object @@ -2114,8 +2114,8 @@ func (x *SearchRequest_Body) GetFilters() []*SearchRequest_Body_Filter { // - $Object:split.splitID \ // 16 byte UUIDv4 used to identify the split object hierarchy parts // - $Object:ec.parent \ -// If the object is stored according to EC policy, then ec_parent attribute -// is set to return an id list of all related EC chunks. +// If the object is stored according to EC policy, then ec_parent +// attribute is set to return an id list of all related EC chunks. // // There are some well-known filter aliases to match objects by certain // properties: diff --git a/object/grpc/service_grpc.pb.go b/object/grpc/service_grpc.pb.go index 16af44a..11d132f 100644 --- a/object/grpc/service_grpc.pb.go +++ b/object/grpc/service_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.3.0 -// - protoc v4.25.3 +// - protoc v5.27.2 // source: object/grpc/service.proto package object diff --git a/object/grpc/types.pb.go b/object/grpc/types.pb.go index 16736e9..2a5a2f9 100644 --- a/object/grpc/types.pb.go +++ b/object/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.33.0 -// protoc v4.25.3 +// protoc v5.27.2 // source: object/grpc/types.proto package object @@ -824,12 +824,13 @@ type Header_EC struct { // Chunk of a parent header. Header []byte `protobuf:"bytes,5,opt,name=header,proto3" json:"header,omitempty"` // As the origin object is EC-splitted its identifier is known to all - // chunks as parent. But parent itself can be a part of Split (does not relate to EC-split). - // In this case parent_split_id should be set. + // chunks as parent. But parent itself can be a part of Split (does not + // relate to EC-split). In this case parent_split_id should be set. ParentSplitId []byte `protobuf:"bytes,6,opt,name=parent_split_id,json=parentSplitID,proto3" json:"parent_split_id,omitempty"` - // EC-parent's parent ID. parent_split_parent_id is set if EC-parent, itself, is a part of Split and - // if an object ID of its parent is presented. The field allows to determine how EC-chunk is placed - // in Split hierarchy. + // EC-parent's parent ID. parent_split_parent_id is set if EC-parent, + // itself, is a part of Split and if an object ID of its parent is + // presented. The field allows to determine how EC-chunk is placed in Split + // hierarchy. ParentSplitParentId *grpc.ObjectID `protobuf:"bytes,7,opt,name=parent_split_parent_id,json=parentSplitParentID,proto3" json:"parent_split_parent_id,omitempty"` // EC parent's attributes. ParentAttributes []*Header_Attribute `protobuf:"bytes,8,rep,name=parent_attributes,json=parentAttributes,proto3" json:"parent_attributes,omitempty"` diff --git a/refs/grpc/types.pb.go b/refs/grpc/types.pb.go index 681bb0d..ab3ae42 100644 --- a/refs/grpc/types.pb.go +++ b/refs/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.33.0 -// protoc v4.25.3 +// protoc v5.27.2 // source: refs/grpc/types.proto package refs diff --git a/rpc/container.go b/rpc/container.go index 1292c22..39213f6 100644 --- a/rpc/container.go +++ b/rpc/container.go @@ -13,7 +13,6 @@ const ( rpcContainerGet = "Get" rpcContainerDel = "Delete" rpcContainerList = "List" - rpcContainerSetEACL = "SetExtendedACL" rpcContainerGetEACL = "GetExtendedACL" rpcContainerUsedSpace = "AnnounceUsedSpace" ) @@ -82,22 +81,6 @@ func ListContainers( return resp, nil } -// SetEACL executes ContainerService.SetExtendedACL RPC. -func SetEACL( - cli *client.Client, - req *container.SetExtendedACLRequest, - opts ...client.CallOption, -) (*container.PutResponse, error) { - resp := new(container.PutResponse) - - err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceContainer, rpcContainerSetEACL), req, resp, opts...) - if err != nil { - return nil, err - } - - return resp, nil -} - // GetEACL executes ContainerService.GetExtendedACL RPC. func GetEACL( cli *client.Client, @@ -113,19 +96,3 @@ func GetEACL( return resp, nil } - -// AnnounceUsedSpace executes ContainerService.AnnounceUsedSpace RPC. -func AnnounceUsedSpace( - cli *client.Client, - req *container.AnnounceUsedSpaceRequest, - opts ...client.CallOption, -) (*container.PutResponse, error) { - resp := new(container.PutResponse) - - err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceContainer, rpcContainerUsedSpace), req, resp, opts...) - if err != nil { - return nil, err - } - - return resp, nil -} diff --git a/session/grpc/service.pb.go b/session/grpc/service.pb.go index a6fa504..b5e999f 100644 --- a/session/grpc/service.pb.go +++ b/session/grpc/service.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.33.0 -// protoc v4.25.3 +// protoc v5.27.2 // source: session/grpc/service.proto package session diff --git a/session/grpc/service_grpc.pb.go b/session/grpc/service_grpc.pb.go index bdcc3ba..adf6fc1 100644 --- a/session/grpc/service_grpc.pb.go +++ b/session/grpc/service_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.3.0 -// - protoc v4.25.3 +// - protoc v5.27.2 // source: session/grpc/service.proto package session diff --git a/session/grpc/types.pb.go b/session/grpc/types.pb.go index e16a7c6..924df45 100644 --- a/session/grpc/types.pb.go +++ b/session/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.33.0 -// protoc v4.25.3 +// protoc v5.27.2 // source: session/grpc/types.proto package session diff --git a/signature/body.go b/signature/body.go index 3362e95..53b5d6b 100644 --- a/signature/body.go +++ b/signature/body.go @@ -46,18 +46,10 @@ func serviceMessageBody(req any) stableMarshaler { return v.GetBody() case *container.ListResponse: return v.GetBody() - case *container.SetExtendedACLRequest: - return v.GetBody() - case *container.SetExtendedACLResponse: - return v.GetBody() case *container.GetExtendedACLRequest: return v.GetBody() case *container.GetExtendedACLResponse: return v.GetBody() - case *container.AnnounceUsedSpaceRequest: - return v.GetBody() - case *container.AnnounceUsedSpaceResponse: - return v.GetBody() /* Object */ case *object.PutRequest: diff --git a/status/grpc/types.pb.go b/status/grpc/types.pb.go index 31f6373..b6b081b 100644 --- a/status/grpc/types.pb.go +++ b/status/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.33.0 -// protoc v4.25.3 +// protoc v5.27.2 // source: status/grpc/types.proto package status @@ -150,7 +150,8 @@ const ( // [**1027**] Node is under maintenance. CommonFail_NODE_UNDER_MAINTENANCE CommonFail = 3 // [**1028**] Invalid argument error. If the server fails on validation of a - // request parameter as the client sent it incorrectly, then this code should be used. + // request parameter as the client sent it incorrectly, then this code should + // be used. CommonFail_INVALID_ARGUMENT CommonFail = 4 ) diff --git a/tombstone/grpc/types.pb.go b/tombstone/grpc/types.pb.go index 6a064dc..7d416fe 100644 --- a/tombstone/grpc/types.pb.go +++ b/tombstone/grpc/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.33.0 -// protoc v4.25.3 +// protoc v5.27.2 // source: tombstone/grpc/types.proto package tombstone From 9b90d139c5f030d7c7f0be1bddb00f31cab5f404 Mon Sep 17 00:00:00 2001 From: Airat Arifullin Date: Wed, 24 Jul 2024 17:40:47 +0300 Subject: [PATCH 1137/1196] [#94] object: Generate protobufs for `Patch` method * Generate protobufs for patch method; * Create marshalers, unmarshalers, converters for gererated types; * Add unit-tests. Signed-off-by: Airat Arifullin --- object/convert.go | 214 ++++++++ object/grpc/service.go | 52 ++ object/grpc/service.pb.go | 955 ++++++++++++++++++++++++--------- object/grpc/service_grpc.pb.go | 157 ++++++ object/marshal.go | 112 ++++ object/message_test.go | 5 + object/test/generate.go | 57 ++ object/types.go | 32 ++ util/proto/test/test.pb.go | 2 +- 9 files changed, 1341 insertions(+), 245 deletions(-) diff --git a/object/convert.go b/object/convert.go index 6e8ecff..1abfb5e 100644 --- a/object/convert.go +++ b/object/convert.go @@ -2345,3 +2345,217 @@ func (r *PutSingleResponse) FromGRPCMessage(m grpc.Message) error { return r.ResponseHeaders.FromMessage(v) } + +func (r *PatchRequestBodyPatch) ToGRPCMessage() grpc.Message { + var m *object.PatchRequest_Body_Patch + + if r != nil { + m = new(object.PatchRequest_Body_Patch) + + m.SetSourceRange(r.Range.ToGRPCMessage().(*object.Range)) + m.SetChunk(r.Chunk) + } + + return m +} + +func (r *PatchRequestBodyPatch) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.PatchRequest_Body_Patch) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + srcRange := v.GetSourceRange() + if srcRange == nil { + r.Range = nil + } else { + if r.Range == nil { + r.Range = new(Range) + } + + err = r.Range.FromGRPCMessage(srcRange) + if err != nil { + return err + } + } + + r.Chunk = v.GetChunk() + + return nil +} + +func (r *PatchRequestBody) ToGRPCMessage() grpc.Message { + var m *object.PatchRequest_Body + + if r != nil { + m = new(object.PatchRequest_Body) + + m.SetAddress(r.Address.ToGRPCMessage().(*refsGRPC.Address)) + m.SetNewAttributes(AttributesToGRPC(r.NewAttributes)) + m.SetReplaceAttributes(r.ReplaceAttributes) + m.SetPatch(r.Patch.ToGRPCMessage().(*object.PatchRequest_Body_Patch)) + } + + return m +} + +func (r *PatchRequestBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.PatchRequest_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + addr := v.GetAddress() + if addr == nil { + r.Address = nil + } else { + if r.Address == nil { + r.Address = new(refs.Address) + } + + err = r.Address.FromGRPCMessage(addr) + if err != nil { + return err + } + } + + r.NewAttributes, err = AttributesFromGRPC(v.GetNewAttributes()) + if err != nil { + return err + } + + r.ReplaceAttributes = v.GetReplaceAttributes() + + patch := v.GetPatch() + if patch == nil { + r.Patch = nil + } else { + if r.Patch == nil { + r.Patch = new(PatchRequestBodyPatch) + } + + err = r.Patch.FromGRPCMessage(patch) + if err != nil { + return err + } + } + + return nil +} + +func (r *PatchRequest) ToGRPCMessage() grpc.Message { + var m *object.PatchRequest + + if r != nil { + m = new(object.PatchRequest) + + m.SetBody(r.Body.ToGRPCMessage().(*object.PatchRequest_Body)) + r.RequestHeaders.ToMessage(m) + } + + return m +} + +func (r *PatchRequest) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.PatchRequest) + 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(PatchRequestBody) + } + + err = r.Body.FromGRPCMessage(body) + if err != nil { + return err + } + } + + return r.RequestHeaders.FromMessage(v) +} + +func (r *PatchResponseBody) ToGRPCMessage() grpc.Message { + var m *object.PatchResponse_Body + + if r != nil { + m = new(object.PatchResponse_Body) + + m.SetObjectID(r.ObjectID.ToGRPCMessage().(*refsGRPC.ObjectID)) + } + + return m +} + +func (r *PatchResponseBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.PatchResponse_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + objID := v.GetObjectId() + if objID == nil { + r.ObjectID = nil + } else { + if r.ObjectID == nil { + r.ObjectID = new(refs.ObjectID) + } + + err = r.ObjectID.FromGRPCMessage(objID) + if err != nil { + return err + } + } + + return nil +} + +func (r *PatchResponse) ToGRPCMessage() grpc.Message { + var m *object.PatchResponse + + if r != nil { + m = new(object.PatchResponse) + + m.SetBody(r.Body.ToGRPCMessage().(*object.PatchResponse_Body)) + r.ResponseHeaders.ToMessage(m) + } + + return m +} + +func (r *PatchResponse) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.PatchResponse) + 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(PatchResponseBody) + } + + err = r.Body.FromGRPCMessage(body) + if err != nil { + return err + } + } + + return r.ResponseHeaders.FromMessage(v) +} diff --git a/object/grpc/service.go b/object/grpc/service.go index 3ff1f3a..ef6422e 100644 --- a/object/grpc/service.go +++ b/object/grpc/service.go @@ -556,3 +556,55 @@ func (m *PutSingleResponse) SetMetaHeader(v *session.ResponseMetaHeader) { func (m *PutSingleResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) { m.VerifyHeader = v } + +func (m *PatchRequest_Body) SetAddress(addr *refs.Address) { + m.Address = addr +} + +func (m *PatchRequest_Body) SetNewAttributes(attrs []*Header_Attribute) { + m.NewAttributes = attrs +} + +func (m *PatchRequest_Body) SetReplaceAttributes(replaceAttributes bool) { + m.ReplaceAttributes = replaceAttributes +} + +func (m *PatchRequest_Body) SetPatch(patch *PatchRequest_Body_Patch) { + m.Patch = patch +} + +func (m *PatchRequest_Body_Patch) SetSourceRange(r *Range) { + m.SourceRange = r +} + +func (m *PatchRequest_Body_Patch) SetChunk(chunk []byte) { + m.Chunk = chunk +} + +func (m *PatchRequest) SetBody(b *PatchRequest_Body) { + m.Body = b +} + +func (m *PatchRequest) SetMetaHeader(v *session.RequestMetaHeader) { + m.MetaHeader = v +} + +func (m *PatchRequest) SetVerifyHeader(v *session.RequestVerificationHeader) { + m.VerifyHeader = v +} + +func (m *PatchResponse_Body) SetObjectID(objectID *refs.ObjectID) { + m.ObjectId = objectID +} + +func (m *PatchResponse) SetBody(b *PatchResponse_Body) { + m.Body = b +} + +func (m *PatchResponse) SetMetaHeader(v *session.ResponseMetaHeader) { + m.MetaHeader = v +} + +func (m *PatchResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) { + m.VerifyHeader = v +} diff --git a/object/grpc/service.pb.go b/object/grpc/service.pb.go index 01ba86f..979c932 100644 --- a/object/grpc/service.pb.go +++ b/object/grpc/service.pb.go @@ -1265,6 +1265,145 @@ func (x *PutSingleResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { return nil } +// Object PATCH request +type PatchRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Body for patch request message. + Body *PatchRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" 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,proto3" json:"verify_header,omitempty"` +} + +func (x *PatchRequest) Reset() { + *x = PatchRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_object_grpc_service_proto_msgTypes[18] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PatchRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PatchRequest) ProtoMessage() {} + +func (x *PatchRequest) ProtoReflect() protoreflect.Message { + mi := &file_object_grpc_service_proto_msgTypes[18] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PatchRequest.ProtoReflect.Descriptor instead. +func (*PatchRequest) Descriptor() ([]byte, []int) { + return file_object_grpc_service_proto_rawDescGZIP(), []int{18} +} + +func (x *PatchRequest) GetBody() *PatchRequest_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *PatchRequest) GetMetaHeader() *grpc.RequestMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} + +func (x *PatchRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} + +// Object PATCH response +type PatchResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Body for patch response message. + Body *PatchResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" 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,proto3" json:"verify_header,omitempty"` +} + +func (x *PatchResponse) Reset() { + *x = PatchResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_object_grpc_service_proto_msgTypes[19] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PatchResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PatchResponse) ProtoMessage() {} + +func (x *PatchResponse) ProtoReflect() protoreflect.Message { + mi := &file_object_grpc_service_proto_msgTypes[19] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PatchResponse.ProtoReflect.Descriptor instead. +func (*PatchResponse) Descriptor() ([]byte, []int) { + return file_object_grpc_service_proto_rawDescGZIP(), []int{19} +} + +func (x *PatchResponse) GetBody() *PatchResponse_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *PatchResponse) GetMetaHeader() *grpc.ResponseMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} + +func (x *PatchResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} + // GET Object request body type GetRequest_Body struct { state protoimpl.MessageState @@ -1281,7 +1420,7 @@ type GetRequest_Body struct { func (x *GetRequest_Body) Reset() { *x = GetRequest_Body{} if protoimpl.UnsafeEnabled { - mi := &file_object_grpc_service_proto_msgTypes[18] + mi := &file_object_grpc_service_proto_msgTypes[20] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1294,7 +1433,7 @@ func (x *GetRequest_Body) String() string { func (*GetRequest_Body) ProtoMessage() {} func (x *GetRequest_Body) ProtoReflect() protoreflect.Message { - mi := &file_object_grpc_service_proto_msgTypes[18] + mi := &file_object_grpc_service_proto_msgTypes[20] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1344,7 +1483,7 @@ type GetResponse_Body struct { func (x *GetResponse_Body) Reset() { *x = GetResponse_Body{} if protoimpl.UnsafeEnabled { - mi := &file_object_grpc_service_proto_msgTypes[19] + mi := &file_object_grpc_service_proto_msgTypes[21] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1357,7 +1496,7 @@ func (x *GetResponse_Body) String() string { func (*GetResponse_Body) ProtoMessage() {} func (x *GetResponse_Body) ProtoReflect() protoreflect.Message { - mi := &file_object_grpc_service_proto_msgTypes[19] + mi := &file_object_grpc_service_proto_msgTypes[21] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1458,7 +1597,7 @@ type GetResponse_Body_Init struct { func (x *GetResponse_Body_Init) Reset() { *x = GetResponse_Body_Init{} if protoimpl.UnsafeEnabled { - mi := &file_object_grpc_service_proto_msgTypes[20] + mi := &file_object_grpc_service_proto_msgTypes[22] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1471,7 +1610,7 @@ func (x *GetResponse_Body_Init) String() string { func (*GetResponse_Body_Init) ProtoMessage() {} func (x *GetResponse_Body_Init) ProtoReflect() protoreflect.Message { - mi := &file_object_grpc_service_proto_msgTypes[20] + mi := &file_object_grpc_service_proto_msgTypes[22] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1526,7 +1665,7 @@ type PutRequest_Body struct { func (x *PutRequest_Body) Reset() { *x = PutRequest_Body{} if protoimpl.UnsafeEnabled { - mi := &file_object_grpc_service_proto_msgTypes[21] + mi := &file_object_grpc_service_proto_msgTypes[23] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1539,7 +1678,7 @@ func (x *PutRequest_Body) String() string { func (*PutRequest_Body) ProtoMessage() {} func (x *PutRequest_Body) ProtoReflect() protoreflect.Message { - mi := &file_object_grpc_service_proto_msgTypes[21] + mi := &file_object_grpc_service_proto_msgTypes[23] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1623,7 +1762,7 @@ type PutRequest_Body_Init struct { func (x *PutRequest_Body_Init) Reset() { *x = PutRequest_Body_Init{} if protoimpl.UnsafeEnabled { - mi := &file_object_grpc_service_proto_msgTypes[22] + mi := &file_object_grpc_service_proto_msgTypes[24] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1636,7 +1775,7 @@ func (x *PutRequest_Body_Init) String() string { func (*PutRequest_Body_Init) ProtoMessage() {} func (x *PutRequest_Body_Init) ProtoReflect() protoreflect.Message { - mi := &file_object_grpc_service_proto_msgTypes[22] + mi := &file_object_grpc_service_proto_msgTypes[24] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1693,7 +1832,7 @@ type PutResponse_Body struct { func (x *PutResponse_Body) Reset() { *x = PutResponse_Body{} if protoimpl.UnsafeEnabled { - mi := &file_object_grpc_service_proto_msgTypes[23] + mi := &file_object_grpc_service_proto_msgTypes[25] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1706,7 +1845,7 @@ func (x *PutResponse_Body) String() string { func (*PutResponse_Body) ProtoMessage() {} func (x *PutResponse_Body) ProtoReflect() protoreflect.Message { - mi := &file_object_grpc_service_proto_msgTypes[23] + mi := &file_object_grpc_service_proto_msgTypes[25] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1742,7 +1881,7 @@ type DeleteRequest_Body struct { func (x *DeleteRequest_Body) Reset() { *x = DeleteRequest_Body{} if protoimpl.UnsafeEnabled { - mi := &file_object_grpc_service_proto_msgTypes[24] + mi := &file_object_grpc_service_proto_msgTypes[26] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1755,7 +1894,7 @@ func (x *DeleteRequest_Body) String() string { func (*DeleteRequest_Body) ProtoMessage() {} func (x *DeleteRequest_Body) ProtoReflect() protoreflect.Message { - mi := &file_object_grpc_service_proto_msgTypes[24] + mi := &file_object_grpc_service_proto_msgTypes[26] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1791,7 +1930,7 @@ type DeleteResponse_Body struct { func (x *DeleteResponse_Body) Reset() { *x = DeleteResponse_Body{} if protoimpl.UnsafeEnabled { - mi := &file_object_grpc_service_proto_msgTypes[25] + mi := &file_object_grpc_service_proto_msgTypes[27] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1804,7 +1943,7 @@ func (x *DeleteResponse_Body) String() string { func (*DeleteResponse_Body) ProtoMessage() {} func (x *DeleteResponse_Body) ProtoReflect() protoreflect.Message { - mi := &file_object_grpc_service_proto_msgTypes[25] + mi := &file_object_grpc_service_proto_msgTypes[27] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1845,7 +1984,7 @@ type HeadRequest_Body struct { func (x *HeadRequest_Body) Reset() { *x = HeadRequest_Body{} if protoimpl.UnsafeEnabled { - mi := &file_object_grpc_service_proto_msgTypes[26] + mi := &file_object_grpc_service_proto_msgTypes[28] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1858,7 +1997,7 @@ func (x *HeadRequest_Body) String() string { func (*HeadRequest_Body) ProtoMessage() {} func (x *HeadRequest_Body) ProtoReflect() protoreflect.Message { - mi := &file_object_grpc_service_proto_msgTypes[26] + mi := &file_object_grpc_service_proto_msgTypes[28] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1916,7 +2055,7 @@ type HeadResponse_Body struct { func (x *HeadResponse_Body) Reset() { *x = HeadResponse_Body{} if protoimpl.UnsafeEnabled { - mi := &file_object_grpc_service_proto_msgTypes[27] + mi := &file_object_grpc_service_proto_msgTypes[29] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1929,7 +2068,7 @@ func (x *HeadResponse_Body) String() string { func (*HeadResponse_Body) ProtoMessage() {} func (x *HeadResponse_Body) ProtoReflect() protoreflect.Message { - mi := &file_object_grpc_service_proto_msgTypes[27] + mi := &file_object_grpc_service_proto_msgTypes[29] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2029,7 +2168,7 @@ type SearchRequest_Body struct { func (x *SearchRequest_Body) Reset() { *x = SearchRequest_Body{} if protoimpl.UnsafeEnabled { - mi := &file_object_grpc_service_proto_msgTypes[28] + mi := &file_object_grpc_service_proto_msgTypes[30] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2042,7 +2181,7 @@ func (x *SearchRequest_Body) String() string { func (*SearchRequest_Body) ProtoMessage() {} func (x *SearchRequest_Body) ProtoReflect() protoreflect.Message { - mi := &file_object_grpc_service_proto_msgTypes[28] + mi := &file_object_grpc_service_proto_msgTypes[30] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2152,7 +2291,7 @@ type SearchRequest_Body_Filter struct { func (x *SearchRequest_Body_Filter) Reset() { *x = SearchRequest_Body_Filter{} if protoimpl.UnsafeEnabled { - mi := &file_object_grpc_service_proto_msgTypes[29] + mi := &file_object_grpc_service_proto_msgTypes[31] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2165,7 +2304,7 @@ func (x *SearchRequest_Body_Filter) String() string { func (*SearchRequest_Body_Filter) ProtoMessage() {} func (x *SearchRequest_Body_Filter) ProtoReflect() protoreflect.Message { - mi := &file_object_grpc_service_proto_msgTypes[29] + mi := &file_object_grpc_service_proto_msgTypes[31] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2215,7 +2354,7 @@ type SearchResponse_Body struct { func (x *SearchResponse_Body) Reset() { *x = SearchResponse_Body{} if protoimpl.UnsafeEnabled { - mi := &file_object_grpc_service_proto_msgTypes[30] + mi := &file_object_grpc_service_proto_msgTypes[32] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2228,7 +2367,7 @@ func (x *SearchResponse_Body) String() string { func (*SearchResponse_Body) ProtoMessage() {} func (x *SearchResponse_Body) ProtoReflect() protoreflect.Message { - mi := &file_object_grpc_service_proto_msgTypes[30] + mi := &file_object_grpc_service_proto_msgTypes[32] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2269,7 +2408,7 @@ type GetRangeRequest_Body struct { func (x *GetRangeRequest_Body) Reset() { *x = GetRangeRequest_Body{} if protoimpl.UnsafeEnabled { - mi := &file_object_grpc_service_proto_msgTypes[31] + mi := &file_object_grpc_service_proto_msgTypes[33] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2282,7 +2421,7 @@ func (x *GetRangeRequest_Body) String() string { func (*GetRangeRequest_Body) ProtoMessage() {} func (x *GetRangeRequest_Body) ProtoReflect() protoreflect.Message { - mi := &file_object_grpc_service_proto_msgTypes[31] + mi := &file_object_grpc_service_proto_msgTypes[33] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2341,7 +2480,7 @@ type GetRangeResponse_Body struct { func (x *GetRangeResponse_Body) Reset() { *x = GetRangeResponse_Body{} if protoimpl.UnsafeEnabled { - mi := &file_object_grpc_service_proto_msgTypes[32] + mi := &file_object_grpc_service_proto_msgTypes[34] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2354,7 +2493,7 @@ func (x *GetRangeResponse_Body) String() string { func (*GetRangeResponse_Body) ProtoMessage() {} func (x *GetRangeResponse_Body) ProtoReflect() protoreflect.Message { - mi := &file_object_grpc_service_proto_msgTypes[32] + mi := &file_object_grpc_service_proto_msgTypes[34] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2442,7 +2581,7 @@ type GetRangeHashRequest_Body struct { func (x *GetRangeHashRequest_Body) Reset() { *x = GetRangeHashRequest_Body{} if protoimpl.UnsafeEnabled { - mi := &file_object_grpc_service_proto_msgTypes[33] + mi := &file_object_grpc_service_proto_msgTypes[35] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2455,7 +2594,7 @@ func (x *GetRangeHashRequest_Body) String() string { func (*GetRangeHashRequest_Body) ProtoMessage() {} func (x *GetRangeHashRequest_Body) ProtoReflect() protoreflect.Message { - mi := &file_object_grpc_service_proto_msgTypes[33] + mi := &file_object_grpc_service_proto_msgTypes[35] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2514,7 +2653,7 @@ type GetRangeHashResponse_Body struct { func (x *GetRangeHashResponse_Body) Reset() { *x = GetRangeHashResponse_Body{} if protoimpl.UnsafeEnabled { - mi := &file_object_grpc_service_proto_msgTypes[34] + mi := &file_object_grpc_service_proto_msgTypes[36] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2527,7 +2666,7 @@ func (x *GetRangeHashResponse_Body) String() string { func (*GetRangeHashResponse_Body) ProtoMessage() {} func (x *GetRangeHashResponse_Body) ProtoReflect() protoreflect.Message { - mi := &file_object_grpc_service_proto_msgTypes[34] + mi := &file_object_grpc_service_proto_msgTypes[36] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2577,7 +2716,7 @@ type PutSingleRequest_Body struct { func (x *PutSingleRequest_Body) Reset() { *x = PutSingleRequest_Body{} if protoimpl.UnsafeEnabled { - mi := &file_object_grpc_service_proto_msgTypes[35] + mi := &file_object_grpc_service_proto_msgTypes[37] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2590,7 +2729,7 @@ func (x *PutSingleRequest_Body) String() string { func (*PutSingleRequest_Body) ProtoMessage() {} func (x *PutSingleRequest_Body) ProtoReflect() protoreflect.Message { - mi := &file_object_grpc_service_proto_msgTypes[35] + mi := &file_object_grpc_service_proto_msgTypes[37] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2630,7 +2769,7 @@ type PutSingleResponse_Body struct { func (x *PutSingleResponse_Body) Reset() { *x = PutSingleResponse_Body{} if protoimpl.UnsafeEnabled { - mi := &file_object_grpc_service_proto_msgTypes[36] + mi := &file_object_grpc_service_proto_msgTypes[38] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2643,7 +2782,7 @@ func (x *PutSingleResponse_Body) String() string { func (*PutSingleResponse_Body) ProtoMessage() {} func (x *PutSingleResponse_Body) ProtoReflect() protoreflect.Message { - mi := &file_object_grpc_service_proto_msgTypes[36] + mi := &file_object_grpc_service_proto_msgTypes[38] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2659,6 +2798,196 @@ func (*PutSingleResponse_Body) Descriptor() ([]byte, []int) { return file_object_grpc_service_proto_rawDescGZIP(), []int{17, 0} } +// PATCH request body +type PatchRequest_Body struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The address of the object that is requested to get patched. + Address *grpc1.Address `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + // New attributes for the object. See `replace_attributes` flag usage to define how + // new attributes should be set. + NewAttributes []*Header_Attribute `protobuf:"bytes,2,rep,name=new_attributes,json=newAttributes,proto3" json:"new_attributes,omitempty"` + // If this flag is set, then the object's attributes will be entirely replaced by `new_attributes` list. + // The empty `new_attributes` list with `replace_attributes = true` just resets attributes list for the object. + // + // Default `false` value for this flag means the attributes will be just merged. If the incoming `new_attributes` + // list contains already existing key, then it just replaces it while merging the lists. + ReplaceAttributes bool `protobuf:"varint,3,opt,name=replace_attributes,json=replaceAttributes,proto3" json:"replace_attributes,omitempty"` + // The patch that is applied for the object. + Patch *PatchRequest_Body_Patch `protobuf:"bytes,4,opt,name=patch,proto3" json:"patch,omitempty"` +} + +func (x *PatchRequest_Body) Reset() { + *x = PatchRequest_Body{} + if protoimpl.UnsafeEnabled { + mi := &file_object_grpc_service_proto_msgTypes[39] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PatchRequest_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PatchRequest_Body) ProtoMessage() {} + +func (x *PatchRequest_Body) ProtoReflect() protoreflect.Message { + mi := &file_object_grpc_service_proto_msgTypes[39] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PatchRequest_Body.ProtoReflect.Descriptor instead. +func (*PatchRequest_Body) Descriptor() ([]byte, []int) { + return file_object_grpc_service_proto_rawDescGZIP(), []int{18, 0} +} + +func (x *PatchRequest_Body) GetAddress() *grpc1.Address { + if x != nil { + return x.Address + } + return nil +} + +func (x *PatchRequest_Body) GetNewAttributes() []*Header_Attribute { + if x != nil { + return x.NewAttributes + } + return nil +} + +func (x *PatchRequest_Body) GetReplaceAttributes() bool { + if x != nil { + return x.ReplaceAttributes + } + return false +} + +func (x *PatchRequest_Body) GetPatch() *PatchRequest_Body_Patch { + if x != nil { + return x.Patch + } + return nil +} + +// The patch for the object's payload. +type PatchRequest_Body_Patch struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The range of the source object for which the payload is replaced by the patch's chunk. + // If the range's `length = 0`, then the patch's chunk is just appended to the original payload + // starting from the `offest` without any replace. + SourceRange *Range `protobuf:"bytes,1,opt,name=source_range,json=sourceRange,proto3" json:"source_range,omitempty"` + // The chunk that is being appended to or that replaces the original payload on the given range. + Chunk []byte `protobuf:"bytes,2,opt,name=chunk,proto3" json:"chunk,omitempty"` +} + +func (x *PatchRequest_Body_Patch) Reset() { + *x = PatchRequest_Body_Patch{} + if protoimpl.UnsafeEnabled { + mi := &file_object_grpc_service_proto_msgTypes[40] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PatchRequest_Body_Patch) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PatchRequest_Body_Patch) ProtoMessage() {} + +func (x *PatchRequest_Body_Patch) ProtoReflect() protoreflect.Message { + mi := &file_object_grpc_service_proto_msgTypes[40] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PatchRequest_Body_Patch.ProtoReflect.Descriptor instead. +func (*PatchRequest_Body_Patch) Descriptor() ([]byte, []int) { + return file_object_grpc_service_proto_rawDescGZIP(), []int{18, 0, 0} +} + +func (x *PatchRequest_Body_Patch) GetSourceRange() *Range { + if x != nil { + return x.SourceRange + } + return nil +} + +func (x *PatchRequest_Body_Patch) GetChunk() []byte { + if x != nil { + return x.Chunk + } + return nil +} + +// PATCH response body +type PatchResponse_Body struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The object ID of the saved patched object. + ObjectId *grpc1.ObjectID `protobuf:"bytes,1,opt,name=object_id,json=objectId,proto3" json:"object_id,omitempty"` +} + +func (x *PatchResponse_Body) Reset() { + *x = PatchResponse_Body{} + if protoimpl.UnsafeEnabled { + mi := &file_object_grpc_service_proto_msgTypes[41] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PatchResponse_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PatchResponse_Body) ProtoMessage() {} + +func (x *PatchResponse_Body) ProtoReflect() protoreflect.Message { + mi := &file_object_grpc_service_proto_msgTypes[41] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PatchResponse_Body.ProtoReflect.Descriptor instead. +func (*PatchResponse_Body) Descriptor() ([]byte, []int) { + return file_object_grpc_service_proto_rawDescGZIP(), []int{19, 0} +} + +func (x *PatchResponse_Body) GetObjectId() *grpc1.ObjectID { + if x != nil { + return x.ObjectId + } + return nil +} + var File_object_grpc_service_proto protoreflect.FileDescriptor var file_object_grpc_service_proto_rawDesc = []byte{ @@ -3060,54 +3389,113 @@ var file_object_grpc_service_proto_rawDesc = []byte{ 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, 0x06, 0x0a, - 0x04, 0x42, 0x6f, 0x64, 0x79, 0x32, 0x88, 0x05, 0x0a, 0x0d, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, - 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x44, 0x0a, 0x03, 0x47, 0x65, 0x74, 0x12, 0x1c, - 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, - 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x6e, - 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, - 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x30, 0x01, 0x12, 0x44, 0x0a, - 0x03, 0x50, 0x75, 0x74, 0x12, 0x1c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, - 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x50, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, - 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x50, 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x28, 0x01, 0x12, 0x4b, 0x0a, 0x06, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x12, 0x1f, 0x2e, + 0x04, 0x42, 0x6f, 0x64, 0x79, 0x22, 0xb3, 0x04, 0x0a, 0x0c, 0x50, 0x61, 0x74, 0x63, 0x68, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x37, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x50, 0x61, 0x74, 0x63, 0x68, 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, 0xcf, 0x02, 0x0a, 0x04, 0x42, 0x6f, + 0x64, 0x79, 0x12, 0x31, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, + 0x72, 0x65, 0x66, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x07, 0x61, 0x64, + 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x49, 0x0a, 0x0e, 0x6e, 0x65, 0x77, 0x5f, 0x61, 0x74, 0x74, + 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, - 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, + 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x2e, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, + 0x65, 0x52, 0x0d, 0x6e, 0x65, 0x77, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, + 0x12, 0x2d, 0x0a, 0x12, 0x72, 0x65, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x5f, 0x61, 0x74, 0x74, 0x72, + 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x11, 0x72, 0x65, + 0x70, 0x6c, 0x61, 0x63, 0x65, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, + 0x3f, 0x0a, 0x05, 0x70, 0x61, 0x74, 0x63, 0x68, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, - 0x74, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x12, 0x45, 0x0a, 0x04, 0x48, 0x65, 0x61, 0x64, 0x12, 0x1d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, - 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, - 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4d, 0x0a, 0x06, 0x53, 0x65, 0x61, 0x72, 0x63, - 0x68, 0x12, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, - 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, - 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x30, 0x01, 0x12, 0x53, 0x0a, 0x08, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, - 0x67, 0x65, 0x12, 0x21, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, - 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x22, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, - 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, - 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x30, 0x01, 0x12, 0x5d, 0x0a, 0x0c, 0x47, - 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x48, 0x61, 0x73, 0x68, 0x12, 0x25, 0x2e, 0x6e, 0x65, - 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, - 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x48, 0x61, 0x73, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x26, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, - 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x48, 0x61, - 0x73, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x54, 0x0a, 0x09, 0x50, 0x75, - 0x74, 0x53, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x12, 0x22, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, - 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x50, 0x75, 0x74, 0x53, 0x69, - 0x6e, 0x67, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x6e, 0x65, + 0x74, 0x2e, 0x50, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x42, + 0x6f, 0x64, 0x79, 0x2e, 0x50, 0x61, 0x74, 0x63, 0x68, 0x52, 0x05, 0x70, 0x61, 0x74, 0x63, 0x68, + 0x1a, 0x59, 0x0a, 0x05, 0x50, 0x61, 0x74, 0x63, 0x68, 0x12, 0x3a, 0x0a, 0x0c, 0x73, 0x6f, 0x75, + 0x72, 0x63, 0x65, 0x5f, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x17, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, + 0x63, 0x74, 0x2e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x0b, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, + 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x22, 0xa4, 0x02, 0x0a, 0x0d, + 0x50, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x38, 0x0a, + 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x50, - 0x75, 0x74, 0x53, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x42, 0x61, 0x5a, 0x42, 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, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, - 0x2f, 0x76, 0x32, 0x2f, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, - 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0xaa, 0x02, 0x1a, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, - 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x4f, 0x62, 0x6a, - 0x65, 0x63, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x61, 0x74, 0x63, 0x68, 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, 0x3d, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x35, 0x0a, 0x09, 0x6f, + 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 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, 0x08, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, + 0x49, 0x64, 0x32, 0xd4, 0x05, 0x0a, 0x0d, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x53, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x12, 0x44, 0x0a, 0x03, 0x47, 0x65, 0x74, 0x12, 0x1c, 0x2e, 0x6e, 0x65, + 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, + 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, + 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x30, 0x01, 0x12, 0x44, 0x0a, 0x03, 0x50, 0x75, + 0x74, 0x12, 0x1c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, + 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x50, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x1d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, + 0x63, 0x74, 0x2e, 0x50, 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x28, 0x01, + 0x12, 0x4b, 0x0a, 0x06, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x12, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, + 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x44, 0x65, + 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x6e, 0x65, + 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x44, + 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x45, 0x0a, + 0x04, 0x48, 0x65, 0x61, 0x64, 0x12, 0x1d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4d, 0x0a, 0x06, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x12, 0x1f, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, + 0x74, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, + 0x63, 0x74, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x30, 0x01, 0x12, 0x53, 0x0a, 0x08, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, + 0x21, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, + 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x22, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, + 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x30, 0x01, 0x12, 0x5d, 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x52, + 0x61, 0x6e, 0x67, 0x65, 0x48, 0x61, 0x73, 0x68, 0x12, 0x25, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, + 0x61, 0x6e, 0x67, 0x65, 0x48, 0x61, 0x73, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x26, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, + 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x48, 0x61, 0x73, 0x68, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x54, 0x0a, 0x09, 0x50, 0x75, 0x74, 0x53, 0x69, + 0x6e, 0x67, 0x6c, 0x65, 0x12, 0x22, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x50, 0x75, 0x74, 0x53, 0x69, 0x6e, 0x67, 0x6c, + 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x50, 0x75, 0x74, 0x53, + 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4a, 0x0a, + 0x05, 0x50, 0x61, 0x74, 0x63, 0x68, 0x12, 0x1e, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, + 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x50, 0x61, 0x74, 0x63, 0x68, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, + 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x50, 0x61, 0x74, 0x63, 0x68, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x28, 0x01, 0x42, 0x61, 0x5a, 0x42, 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, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x6f, 0x62, 0x6a, + 0x65, 0x63, 0x74, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0xaa, + 0x02, 0x1a, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, + 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -3122,7 +3510,7 @@ func file_object_grpc_service_proto_rawDescGZIP() []byte { return file_object_grpc_service_proto_rawDescData } -var file_object_grpc_service_proto_msgTypes = make([]protoimpl.MessageInfo, 37) +var file_object_grpc_service_proto_msgTypes = make([]protoimpl.MessageInfo, 42) var file_object_grpc_service_proto_goTypes = []interface{}{ (*GetRequest)(nil), // 0: neo.fs.v2.object.GetRequest (*GetResponse)(nil), // 1: neo.fs.v2.object.GetResponse @@ -3142,145 +3530,164 @@ var file_object_grpc_service_proto_goTypes = []interface{}{ (*GetRangeHashResponse)(nil), // 15: neo.fs.v2.object.GetRangeHashResponse (*PutSingleRequest)(nil), // 16: neo.fs.v2.object.PutSingleRequest (*PutSingleResponse)(nil), // 17: neo.fs.v2.object.PutSingleResponse - (*GetRequest_Body)(nil), // 18: neo.fs.v2.object.GetRequest.Body - (*GetResponse_Body)(nil), // 19: neo.fs.v2.object.GetResponse.Body - (*GetResponse_Body_Init)(nil), // 20: neo.fs.v2.object.GetResponse.Body.Init - (*PutRequest_Body)(nil), // 21: neo.fs.v2.object.PutRequest.Body - (*PutRequest_Body_Init)(nil), // 22: neo.fs.v2.object.PutRequest.Body.Init - (*PutResponse_Body)(nil), // 23: neo.fs.v2.object.PutResponse.Body - (*DeleteRequest_Body)(nil), // 24: neo.fs.v2.object.DeleteRequest.Body - (*DeleteResponse_Body)(nil), // 25: neo.fs.v2.object.DeleteResponse.Body - (*HeadRequest_Body)(nil), // 26: neo.fs.v2.object.HeadRequest.Body - (*HeadResponse_Body)(nil), // 27: neo.fs.v2.object.HeadResponse.Body - (*SearchRequest_Body)(nil), // 28: neo.fs.v2.object.SearchRequest.Body - (*SearchRequest_Body_Filter)(nil), // 29: neo.fs.v2.object.SearchRequest.Body.Filter - (*SearchResponse_Body)(nil), // 30: neo.fs.v2.object.SearchResponse.Body - (*GetRangeRequest_Body)(nil), // 31: neo.fs.v2.object.GetRangeRequest.Body - (*GetRangeResponse_Body)(nil), // 32: neo.fs.v2.object.GetRangeResponse.Body - (*GetRangeHashRequest_Body)(nil), // 33: neo.fs.v2.object.GetRangeHashRequest.Body - (*GetRangeHashResponse_Body)(nil), // 34: neo.fs.v2.object.GetRangeHashResponse.Body - (*PutSingleRequest_Body)(nil), // 35: neo.fs.v2.object.PutSingleRequest.Body - (*PutSingleResponse_Body)(nil), // 36: neo.fs.v2.object.PutSingleResponse.Body - (*grpc.RequestMetaHeader)(nil), // 37: neo.fs.v2.session.RequestMetaHeader - (*grpc.RequestVerificationHeader)(nil), // 38: neo.fs.v2.session.RequestVerificationHeader - (*grpc.ResponseMetaHeader)(nil), // 39: neo.fs.v2.session.ResponseMetaHeader - (*grpc.ResponseVerificationHeader)(nil), // 40: neo.fs.v2.session.ResponseVerificationHeader - (*Header)(nil), // 41: neo.fs.v2.object.Header - (*grpc1.Signature)(nil), // 42: neo.fs.v2.refs.Signature - (*grpc1.Address)(nil), // 43: neo.fs.v2.refs.Address - (*SplitInfo)(nil), // 44: neo.fs.v2.object.SplitInfo - (*ECInfo)(nil), // 45: neo.fs.v2.object.ECInfo - (*grpc1.ObjectID)(nil), // 46: neo.fs.v2.refs.ObjectID - (*ShortHeader)(nil), // 47: neo.fs.v2.object.ShortHeader - (*grpc1.ContainerID)(nil), // 48: neo.fs.v2.refs.ContainerID - (MatchType)(0), // 49: neo.fs.v2.object.MatchType - (grpc1.ChecksumType)(0), // 50: neo.fs.v2.refs.ChecksumType - (*Object)(nil), // 51: neo.fs.v2.object.Object + (*PatchRequest)(nil), // 18: neo.fs.v2.object.PatchRequest + (*PatchResponse)(nil), // 19: neo.fs.v2.object.PatchResponse + (*GetRequest_Body)(nil), // 20: neo.fs.v2.object.GetRequest.Body + (*GetResponse_Body)(nil), // 21: neo.fs.v2.object.GetResponse.Body + (*GetResponse_Body_Init)(nil), // 22: neo.fs.v2.object.GetResponse.Body.Init + (*PutRequest_Body)(nil), // 23: neo.fs.v2.object.PutRequest.Body + (*PutRequest_Body_Init)(nil), // 24: neo.fs.v2.object.PutRequest.Body.Init + (*PutResponse_Body)(nil), // 25: neo.fs.v2.object.PutResponse.Body + (*DeleteRequest_Body)(nil), // 26: neo.fs.v2.object.DeleteRequest.Body + (*DeleteResponse_Body)(nil), // 27: neo.fs.v2.object.DeleteResponse.Body + (*HeadRequest_Body)(nil), // 28: neo.fs.v2.object.HeadRequest.Body + (*HeadResponse_Body)(nil), // 29: neo.fs.v2.object.HeadResponse.Body + (*SearchRequest_Body)(nil), // 30: neo.fs.v2.object.SearchRequest.Body + (*SearchRequest_Body_Filter)(nil), // 31: neo.fs.v2.object.SearchRequest.Body.Filter + (*SearchResponse_Body)(nil), // 32: neo.fs.v2.object.SearchResponse.Body + (*GetRangeRequest_Body)(nil), // 33: neo.fs.v2.object.GetRangeRequest.Body + (*GetRangeResponse_Body)(nil), // 34: neo.fs.v2.object.GetRangeResponse.Body + (*GetRangeHashRequest_Body)(nil), // 35: neo.fs.v2.object.GetRangeHashRequest.Body + (*GetRangeHashResponse_Body)(nil), // 36: neo.fs.v2.object.GetRangeHashResponse.Body + (*PutSingleRequest_Body)(nil), // 37: neo.fs.v2.object.PutSingleRequest.Body + (*PutSingleResponse_Body)(nil), // 38: neo.fs.v2.object.PutSingleResponse.Body + (*PatchRequest_Body)(nil), // 39: neo.fs.v2.object.PatchRequest.Body + (*PatchRequest_Body_Patch)(nil), // 40: neo.fs.v2.object.PatchRequest.Body.Patch + (*PatchResponse_Body)(nil), // 41: neo.fs.v2.object.PatchResponse.Body + (*grpc.RequestMetaHeader)(nil), // 42: neo.fs.v2.session.RequestMetaHeader + (*grpc.RequestVerificationHeader)(nil), // 43: neo.fs.v2.session.RequestVerificationHeader + (*grpc.ResponseMetaHeader)(nil), // 44: neo.fs.v2.session.ResponseMetaHeader + (*grpc.ResponseVerificationHeader)(nil), // 45: neo.fs.v2.session.ResponseVerificationHeader + (*Header)(nil), // 46: neo.fs.v2.object.Header + (*grpc1.Signature)(nil), // 47: neo.fs.v2.refs.Signature + (*grpc1.Address)(nil), // 48: neo.fs.v2.refs.Address + (*SplitInfo)(nil), // 49: neo.fs.v2.object.SplitInfo + (*ECInfo)(nil), // 50: neo.fs.v2.object.ECInfo + (*grpc1.ObjectID)(nil), // 51: neo.fs.v2.refs.ObjectID + (*ShortHeader)(nil), // 52: neo.fs.v2.object.ShortHeader + (*grpc1.ContainerID)(nil), // 53: neo.fs.v2.refs.ContainerID + (MatchType)(0), // 54: neo.fs.v2.object.MatchType + (grpc1.ChecksumType)(0), // 55: neo.fs.v2.refs.ChecksumType + (*Object)(nil), // 56: neo.fs.v2.object.Object + (*Header_Attribute)(nil), // 57: neo.fs.v2.object.Header.Attribute } var file_object_grpc_service_proto_depIdxs = []int32{ - 18, // 0: neo.fs.v2.object.GetRequest.body:type_name -> neo.fs.v2.object.GetRequest.Body - 37, // 1: neo.fs.v2.object.GetRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader - 38, // 2: neo.fs.v2.object.GetRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader - 19, // 3: neo.fs.v2.object.GetResponse.body:type_name -> neo.fs.v2.object.GetResponse.Body - 39, // 4: neo.fs.v2.object.GetResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader - 40, // 5: neo.fs.v2.object.GetResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader - 21, // 6: neo.fs.v2.object.PutRequest.body:type_name -> neo.fs.v2.object.PutRequest.Body - 37, // 7: neo.fs.v2.object.PutRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader - 38, // 8: neo.fs.v2.object.PutRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader - 23, // 9: neo.fs.v2.object.PutResponse.body:type_name -> neo.fs.v2.object.PutResponse.Body - 39, // 10: neo.fs.v2.object.PutResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader - 40, // 11: neo.fs.v2.object.PutResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader - 24, // 12: neo.fs.v2.object.DeleteRequest.body:type_name -> neo.fs.v2.object.DeleteRequest.Body - 37, // 13: neo.fs.v2.object.DeleteRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader - 38, // 14: neo.fs.v2.object.DeleteRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader - 25, // 15: neo.fs.v2.object.DeleteResponse.body:type_name -> neo.fs.v2.object.DeleteResponse.Body - 39, // 16: neo.fs.v2.object.DeleteResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader - 40, // 17: neo.fs.v2.object.DeleteResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader - 26, // 18: neo.fs.v2.object.HeadRequest.body:type_name -> neo.fs.v2.object.HeadRequest.Body - 37, // 19: neo.fs.v2.object.HeadRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader - 38, // 20: neo.fs.v2.object.HeadRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader - 41, // 21: neo.fs.v2.object.HeaderWithSignature.header:type_name -> neo.fs.v2.object.Header - 42, // 22: neo.fs.v2.object.HeaderWithSignature.signature:type_name -> neo.fs.v2.refs.Signature - 27, // 23: neo.fs.v2.object.HeadResponse.body:type_name -> neo.fs.v2.object.HeadResponse.Body - 39, // 24: neo.fs.v2.object.HeadResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader - 40, // 25: neo.fs.v2.object.HeadResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader - 28, // 26: neo.fs.v2.object.SearchRequest.body:type_name -> neo.fs.v2.object.SearchRequest.Body - 37, // 27: neo.fs.v2.object.SearchRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader - 38, // 28: neo.fs.v2.object.SearchRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader - 30, // 29: neo.fs.v2.object.SearchResponse.body:type_name -> neo.fs.v2.object.SearchResponse.Body - 39, // 30: neo.fs.v2.object.SearchResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader - 40, // 31: neo.fs.v2.object.SearchResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader - 31, // 32: neo.fs.v2.object.GetRangeRequest.body:type_name -> neo.fs.v2.object.GetRangeRequest.Body - 37, // 33: neo.fs.v2.object.GetRangeRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader - 38, // 34: neo.fs.v2.object.GetRangeRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader - 32, // 35: neo.fs.v2.object.GetRangeResponse.body:type_name -> neo.fs.v2.object.GetRangeResponse.Body - 39, // 36: neo.fs.v2.object.GetRangeResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader - 40, // 37: neo.fs.v2.object.GetRangeResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader - 33, // 38: neo.fs.v2.object.GetRangeHashRequest.body:type_name -> neo.fs.v2.object.GetRangeHashRequest.Body - 37, // 39: neo.fs.v2.object.GetRangeHashRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader - 38, // 40: neo.fs.v2.object.GetRangeHashRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader - 34, // 41: neo.fs.v2.object.GetRangeHashResponse.body:type_name -> neo.fs.v2.object.GetRangeHashResponse.Body - 39, // 42: neo.fs.v2.object.GetRangeHashResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader - 40, // 43: neo.fs.v2.object.GetRangeHashResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader - 35, // 44: neo.fs.v2.object.PutSingleRequest.body:type_name -> neo.fs.v2.object.PutSingleRequest.Body - 37, // 45: neo.fs.v2.object.PutSingleRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader - 38, // 46: neo.fs.v2.object.PutSingleRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader - 36, // 47: neo.fs.v2.object.PutSingleResponse.body:type_name -> neo.fs.v2.object.PutSingleResponse.Body - 39, // 48: neo.fs.v2.object.PutSingleResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader - 40, // 49: neo.fs.v2.object.PutSingleResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader - 43, // 50: neo.fs.v2.object.GetRequest.Body.address:type_name -> neo.fs.v2.refs.Address - 20, // 51: neo.fs.v2.object.GetResponse.Body.init:type_name -> neo.fs.v2.object.GetResponse.Body.Init - 44, // 52: neo.fs.v2.object.GetResponse.Body.split_info:type_name -> neo.fs.v2.object.SplitInfo - 45, // 53: neo.fs.v2.object.GetResponse.Body.ec_info:type_name -> neo.fs.v2.object.ECInfo - 46, // 54: neo.fs.v2.object.GetResponse.Body.Init.object_id:type_name -> neo.fs.v2.refs.ObjectID - 42, // 55: neo.fs.v2.object.GetResponse.Body.Init.signature:type_name -> neo.fs.v2.refs.Signature - 41, // 56: neo.fs.v2.object.GetResponse.Body.Init.header:type_name -> neo.fs.v2.object.Header - 22, // 57: neo.fs.v2.object.PutRequest.Body.init:type_name -> neo.fs.v2.object.PutRequest.Body.Init - 46, // 58: neo.fs.v2.object.PutRequest.Body.Init.object_id:type_name -> neo.fs.v2.refs.ObjectID - 42, // 59: neo.fs.v2.object.PutRequest.Body.Init.signature:type_name -> neo.fs.v2.refs.Signature - 41, // 60: neo.fs.v2.object.PutRequest.Body.Init.header:type_name -> neo.fs.v2.object.Header - 46, // 61: neo.fs.v2.object.PutResponse.Body.object_id:type_name -> neo.fs.v2.refs.ObjectID - 43, // 62: neo.fs.v2.object.DeleteRequest.Body.address:type_name -> neo.fs.v2.refs.Address - 43, // 63: neo.fs.v2.object.DeleteResponse.Body.tombstone:type_name -> neo.fs.v2.refs.Address - 43, // 64: neo.fs.v2.object.HeadRequest.Body.address:type_name -> neo.fs.v2.refs.Address - 7, // 65: neo.fs.v2.object.HeadResponse.Body.header:type_name -> neo.fs.v2.object.HeaderWithSignature - 47, // 66: neo.fs.v2.object.HeadResponse.Body.short_header:type_name -> neo.fs.v2.object.ShortHeader - 44, // 67: neo.fs.v2.object.HeadResponse.Body.split_info:type_name -> neo.fs.v2.object.SplitInfo - 45, // 68: neo.fs.v2.object.HeadResponse.Body.ec_info:type_name -> neo.fs.v2.object.ECInfo - 48, // 69: neo.fs.v2.object.SearchRequest.Body.container_id:type_name -> neo.fs.v2.refs.ContainerID - 29, // 70: neo.fs.v2.object.SearchRequest.Body.filters:type_name -> neo.fs.v2.object.SearchRequest.Body.Filter - 49, // 71: neo.fs.v2.object.SearchRequest.Body.Filter.match_type:type_name -> neo.fs.v2.object.MatchType - 46, // 72: neo.fs.v2.object.SearchResponse.Body.id_list:type_name -> neo.fs.v2.refs.ObjectID - 43, // 73: neo.fs.v2.object.GetRangeRequest.Body.address:type_name -> neo.fs.v2.refs.Address - 11, // 74: neo.fs.v2.object.GetRangeRequest.Body.range:type_name -> neo.fs.v2.object.Range - 44, // 75: neo.fs.v2.object.GetRangeResponse.Body.split_info:type_name -> neo.fs.v2.object.SplitInfo - 45, // 76: neo.fs.v2.object.GetRangeResponse.Body.ec_info:type_name -> neo.fs.v2.object.ECInfo - 43, // 77: neo.fs.v2.object.GetRangeHashRequest.Body.address:type_name -> neo.fs.v2.refs.Address - 11, // 78: neo.fs.v2.object.GetRangeHashRequest.Body.ranges:type_name -> neo.fs.v2.object.Range - 50, // 79: neo.fs.v2.object.GetRangeHashRequest.Body.type:type_name -> neo.fs.v2.refs.ChecksumType - 50, // 80: neo.fs.v2.object.GetRangeHashResponse.Body.type:type_name -> neo.fs.v2.refs.ChecksumType - 51, // 81: neo.fs.v2.object.PutSingleRequest.Body.object:type_name -> neo.fs.v2.object.Object - 0, // 82: neo.fs.v2.object.ObjectService.Get:input_type -> neo.fs.v2.object.GetRequest - 2, // 83: neo.fs.v2.object.ObjectService.Put:input_type -> neo.fs.v2.object.PutRequest - 4, // 84: neo.fs.v2.object.ObjectService.Delete:input_type -> neo.fs.v2.object.DeleteRequest - 6, // 85: neo.fs.v2.object.ObjectService.Head:input_type -> neo.fs.v2.object.HeadRequest - 9, // 86: neo.fs.v2.object.ObjectService.Search:input_type -> neo.fs.v2.object.SearchRequest - 12, // 87: neo.fs.v2.object.ObjectService.GetRange:input_type -> neo.fs.v2.object.GetRangeRequest - 14, // 88: neo.fs.v2.object.ObjectService.GetRangeHash:input_type -> neo.fs.v2.object.GetRangeHashRequest - 16, // 89: neo.fs.v2.object.ObjectService.PutSingle:input_type -> neo.fs.v2.object.PutSingleRequest - 1, // 90: neo.fs.v2.object.ObjectService.Get:output_type -> neo.fs.v2.object.GetResponse - 3, // 91: neo.fs.v2.object.ObjectService.Put:output_type -> neo.fs.v2.object.PutResponse - 5, // 92: neo.fs.v2.object.ObjectService.Delete:output_type -> neo.fs.v2.object.DeleteResponse - 8, // 93: neo.fs.v2.object.ObjectService.Head:output_type -> neo.fs.v2.object.HeadResponse - 10, // 94: neo.fs.v2.object.ObjectService.Search:output_type -> neo.fs.v2.object.SearchResponse - 13, // 95: neo.fs.v2.object.ObjectService.GetRange:output_type -> neo.fs.v2.object.GetRangeResponse - 15, // 96: neo.fs.v2.object.ObjectService.GetRangeHash:output_type -> neo.fs.v2.object.GetRangeHashResponse - 17, // 97: neo.fs.v2.object.ObjectService.PutSingle:output_type -> neo.fs.v2.object.PutSingleResponse - 90, // [90:98] is the sub-list for method output_type - 82, // [82:90] is the sub-list for method input_type - 82, // [82:82] is the sub-list for extension type_name - 82, // [82:82] is the sub-list for extension extendee - 0, // [0:82] is the sub-list for field type_name + 20, // 0: neo.fs.v2.object.GetRequest.body:type_name -> neo.fs.v2.object.GetRequest.Body + 42, // 1: neo.fs.v2.object.GetRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader + 43, // 2: neo.fs.v2.object.GetRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader + 21, // 3: neo.fs.v2.object.GetResponse.body:type_name -> neo.fs.v2.object.GetResponse.Body + 44, // 4: neo.fs.v2.object.GetResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader + 45, // 5: neo.fs.v2.object.GetResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 23, // 6: neo.fs.v2.object.PutRequest.body:type_name -> neo.fs.v2.object.PutRequest.Body + 42, // 7: neo.fs.v2.object.PutRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader + 43, // 8: neo.fs.v2.object.PutRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader + 25, // 9: neo.fs.v2.object.PutResponse.body:type_name -> neo.fs.v2.object.PutResponse.Body + 44, // 10: neo.fs.v2.object.PutResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader + 45, // 11: neo.fs.v2.object.PutResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 26, // 12: neo.fs.v2.object.DeleteRequest.body:type_name -> neo.fs.v2.object.DeleteRequest.Body + 42, // 13: neo.fs.v2.object.DeleteRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader + 43, // 14: neo.fs.v2.object.DeleteRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader + 27, // 15: neo.fs.v2.object.DeleteResponse.body:type_name -> neo.fs.v2.object.DeleteResponse.Body + 44, // 16: neo.fs.v2.object.DeleteResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader + 45, // 17: neo.fs.v2.object.DeleteResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 28, // 18: neo.fs.v2.object.HeadRequest.body:type_name -> neo.fs.v2.object.HeadRequest.Body + 42, // 19: neo.fs.v2.object.HeadRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader + 43, // 20: neo.fs.v2.object.HeadRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader + 46, // 21: neo.fs.v2.object.HeaderWithSignature.header:type_name -> neo.fs.v2.object.Header + 47, // 22: neo.fs.v2.object.HeaderWithSignature.signature:type_name -> neo.fs.v2.refs.Signature + 29, // 23: neo.fs.v2.object.HeadResponse.body:type_name -> neo.fs.v2.object.HeadResponse.Body + 44, // 24: neo.fs.v2.object.HeadResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader + 45, // 25: neo.fs.v2.object.HeadResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 30, // 26: neo.fs.v2.object.SearchRequest.body:type_name -> neo.fs.v2.object.SearchRequest.Body + 42, // 27: neo.fs.v2.object.SearchRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader + 43, // 28: neo.fs.v2.object.SearchRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader + 32, // 29: neo.fs.v2.object.SearchResponse.body:type_name -> neo.fs.v2.object.SearchResponse.Body + 44, // 30: neo.fs.v2.object.SearchResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader + 45, // 31: neo.fs.v2.object.SearchResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 33, // 32: neo.fs.v2.object.GetRangeRequest.body:type_name -> neo.fs.v2.object.GetRangeRequest.Body + 42, // 33: neo.fs.v2.object.GetRangeRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader + 43, // 34: neo.fs.v2.object.GetRangeRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader + 34, // 35: neo.fs.v2.object.GetRangeResponse.body:type_name -> neo.fs.v2.object.GetRangeResponse.Body + 44, // 36: neo.fs.v2.object.GetRangeResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader + 45, // 37: neo.fs.v2.object.GetRangeResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 35, // 38: neo.fs.v2.object.GetRangeHashRequest.body:type_name -> neo.fs.v2.object.GetRangeHashRequest.Body + 42, // 39: neo.fs.v2.object.GetRangeHashRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader + 43, // 40: neo.fs.v2.object.GetRangeHashRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader + 36, // 41: neo.fs.v2.object.GetRangeHashResponse.body:type_name -> neo.fs.v2.object.GetRangeHashResponse.Body + 44, // 42: neo.fs.v2.object.GetRangeHashResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader + 45, // 43: neo.fs.v2.object.GetRangeHashResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 37, // 44: neo.fs.v2.object.PutSingleRequest.body:type_name -> neo.fs.v2.object.PutSingleRequest.Body + 42, // 45: neo.fs.v2.object.PutSingleRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader + 43, // 46: neo.fs.v2.object.PutSingleRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader + 38, // 47: neo.fs.v2.object.PutSingleResponse.body:type_name -> neo.fs.v2.object.PutSingleResponse.Body + 44, // 48: neo.fs.v2.object.PutSingleResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader + 45, // 49: neo.fs.v2.object.PutSingleResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 39, // 50: neo.fs.v2.object.PatchRequest.body:type_name -> neo.fs.v2.object.PatchRequest.Body + 42, // 51: neo.fs.v2.object.PatchRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader + 43, // 52: neo.fs.v2.object.PatchRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader + 41, // 53: neo.fs.v2.object.PatchResponse.body:type_name -> neo.fs.v2.object.PatchResponse.Body + 44, // 54: neo.fs.v2.object.PatchResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader + 45, // 55: neo.fs.v2.object.PatchResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 48, // 56: neo.fs.v2.object.GetRequest.Body.address:type_name -> neo.fs.v2.refs.Address + 22, // 57: neo.fs.v2.object.GetResponse.Body.init:type_name -> neo.fs.v2.object.GetResponse.Body.Init + 49, // 58: neo.fs.v2.object.GetResponse.Body.split_info:type_name -> neo.fs.v2.object.SplitInfo + 50, // 59: neo.fs.v2.object.GetResponse.Body.ec_info:type_name -> neo.fs.v2.object.ECInfo + 51, // 60: neo.fs.v2.object.GetResponse.Body.Init.object_id:type_name -> neo.fs.v2.refs.ObjectID + 47, // 61: neo.fs.v2.object.GetResponse.Body.Init.signature:type_name -> neo.fs.v2.refs.Signature + 46, // 62: neo.fs.v2.object.GetResponse.Body.Init.header:type_name -> neo.fs.v2.object.Header + 24, // 63: neo.fs.v2.object.PutRequest.Body.init:type_name -> neo.fs.v2.object.PutRequest.Body.Init + 51, // 64: neo.fs.v2.object.PutRequest.Body.Init.object_id:type_name -> neo.fs.v2.refs.ObjectID + 47, // 65: neo.fs.v2.object.PutRequest.Body.Init.signature:type_name -> neo.fs.v2.refs.Signature + 46, // 66: neo.fs.v2.object.PutRequest.Body.Init.header:type_name -> neo.fs.v2.object.Header + 51, // 67: neo.fs.v2.object.PutResponse.Body.object_id:type_name -> neo.fs.v2.refs.ObjectID + 48, // 68: neo.fs.v2.object.DeleteRequest.Body.address:type_name -> neo.fs.v2.refs.Address + 48, // 69: neo.fs.v2.object.DeleteResponse.Body.tombstone:type_name -> neo.fs.v2.refs.Address + 48, // 70: neo.fs.v2.object.HeadRequest.Body.address:type_name -> neo.fs.v2.refs.Address + 7, // 71: neo.fs.v2.object.HeadResponse.Body.header:type_name -> neo.fs.v2.object.HeaderWithSignature + 52, // 72: neo.fs.v2.object.HeadResponse.Body.short_header:type_name -> neo.fs.v2.object.ShortHeader + 49, // 73: neo.fs.v2.object.HeadResponse.Body.split_info:type_name -> neo.fs.v2.object.SplitInfo + 50, // 74: neo.fs.v2.object.HeadResponse.Body.ec_info:type_name -> neo.fs.v2.object.ECInfo + 53, // 75: neo.fs.v2.object.SearchRequest.Body.container_id:type_name -> neo.fs.v2.refs.ContainerID + 31, // 76: neo.fs.v2.object.SearchRequest.Body.filters:type_name -> neo.fs.v2.object.SearchRequest.Body.Filter + 54, // 77: neo.fs.v2.object.SearchRequest.Body.Filter.match_type:type_name -> neo.fs.v2.object.MatchType + 51, // 78: neo.fs.v2.object.SearchResponse.Body.id_list:type_name -> neo.fs.v2.refs.ObjectID + 48, // 79: neo.fs.v2.object.GetRangeRequest.Body.address:type_name -> neo.fs.v2.refs.Address + 11, // 80: neo.fs.v2.object.GetRangeRequest.Body.range:type_name -> neo.fs.v2.object.Range + 49, // 81: neo.fs.v2.object.GetRangeResponse.Body.split_info:type_name -> neo.fs.v2.object.SplitInfo + 50, // 82: neo.fs.v2.object.GetRangeResponse.Body.ec_info:type_name -> neo.fs.v2.object.ECInfo + 48, // 83: neo.fs.v2.object.GetRangeHashRequest.Body.address:type_name -> neo.fs.v2.refs.Address + 11, // 84: neo.fs.v2.object.GetRangeHashRequest.Body.ranges:type_name -> neo.fs.v2.object.Range + 55, // 85: neo.fs.v2.object.GetRangeHashRequest.Body.type:type_name -> neo.fs.v2.refs.ChecksumType + 55, // 86: neo.fs.v2.object.GetRangeHashResponse.Body.type:type_name -> neo.fs.v2.refs.ChecksumType + 56, // 87: neo.fs.v2.object.PutSingleRequest.Body.object:type_name -> neo.fs.v2.object.Object + 48, // 88: neo.fs.v2.object.PatchRequest.Body.address:type_name -> neo.fs.v2.refs.Address + 57, // 89: neo.fs.v2.object.PatchRequest.Body.new_attributes:type_name -> neo.fs.v2.object.Header.Attribute + 40, // 90: neo.fs.v2.object.PatchRequest.Body.patch:type_name -> neo.fs.v2.object.PatchRequest.Body.Patch + 11, // 91: neo.fs.v2.object.PatchRequest.Body.Patch.source_range:type_name -> neo.fs.v2.object.Range + 51, // 92: neo.fs.v2.object.PatchResponse.Body.object_id:type_name -> neo.fs.v2.refs.ObjectID + 0, // 93: neo.fs.v2.object.ObjectService.Get:input_type -> neo.fs.v2.object.GetRequest + 2, // 94: neo.fs.v2.object.ObjectService.Put:input_type -> neo.fs.v2.object.PutRequest + 4, // 95: neo.fs.v2.object.ObjectService.Delete:input_type -> neo.fs.v2.object.DeleteRequest + 6, // 96: neo.fs.v2.object.ObjectService.Head:input_type -> neo.fs.v2.object.HeadRequest + 9, // 97: neo.fs.v2.object.ObjectService.Search:input_type -> neo.fs.v2.object.SearchRequest + 12, // 98: neo.fs.v2.object.ObjectService.GetRange:input_type -> neo.fs.v2.object.GetRangeRequest + 14, // 99: neo.fs.v2.object.ObjectService.GetRangeHash:input_type -> neo.fs.v2.object.GetRangeHashRequest + 16, // 100: neo.fs.v2.object.ObjectService.PutSingle:input_type -> neo.fs.v2.object.PutSingleRequest + 18, // 101: neo.fs.v2.object.ObjectService.Patch:input_type -> neo.fs.v2.object.PatchRequest + 1, // 102: neo.fs.v2.object.ObjectService.Get:output_type -> neo.fs.v2.object.GetResponse + 3, // 103: neo.fs.v2.object.ObjectService.Put:output_type -> neo.fs.v2.object.PutResponse + 5, // 104: neo.fs.v2.object.ObjectService.Delete:output_type -> neo.fs.v2.object.DeleteResponse + 8, // 105: neo.fs.v2.object.ObjectService.Head:output_type -> neo.fs.v2.object.HeadResponse + 10, // 106: neo.fs.v2.object.ObjectService.Search:output_type -> neo.fs.v2.object.SearchResponse + 13, // 107: neo.fs.v2.object.ObjectService.GetRange:output_type -> neo.fs.v2.object.GetRangeResponse + 15, // 108: neo.fs.v2.object.ObjectService.GetRangeHash:output_type -> neo.fs.v2.object.GetRangeHashResponse + 17, // 109: neo.fs.v2.object.ObjectService.PutSingle:output_type -> neo.fs.v2.object.PutSingleResponse + 19, // 110: neo.fs.v2.object.ObjectService.Patch:output_type -> neo.fs.v2.object.PatchResponse + 102, // [102:111] is the sub-list for method output_type + 93, // [93:102] is the sub-list for method input_type + 93, // [93:93] is the sub-list for extension type_name + 93, // [93:93] is the sub-list for extension extendee + 0, // [0:93] is the sub-list for field type_name } func init() { file_object_grpc_service_proto_init() } @@ -3507,7 +3914,7 @@ func file_object_grpc_service_proto_init() { } } file_object_grpc_service_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetRequest_Body); i { + switch v := v.(*PatchRequest); i { case 0: return &v.state case 1: @@ -3519,7 +3926,7 @@ func file_object_grpc_service_proto_init() { } } file_object_grpc_service_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetResponse_Body); i { + switch v := v.(*PatchResponse); i { case 0: return &v.state case 1: @@ -3531,7 +3938,7 @@ func file_object_grpc_service_proto_init() { } } file_object_grpc_service_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetResponse_Body_Init); i { + switch v := v.(*GetRequest_Body); i { case 0: return &v.state case 1: @@ -3543,7 +3950,7 @@ func file_object_grpc_service_proto_init() { } } file_object_grpc_service_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PutRequest_Body); i { + switch v := v.(*GetResponse_Body); i { case 0: return &v.state case 1: @@ -3555,7 +3962,7 @@ func file_object_grpc_service_proto_init() { } } file_object_grpc_service_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PutRequest_Body_Init); i { + switch v := v.(*GetResponse_Body_Init); i { case 0: return &v.state case 1: @@ -3567,7 +3974,7 @@ func file_object_grpc_service_proto_init() { } } file_object_grpc_service_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PutResponse_Body); i { + switch v := v.(*PutRequest_Body); i { case 0: return &v.state case 1: @@ -3579,7 +3986,7 @@ func file_object_grpc_service_proto_init() { } } file_object_grpc_service_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DeleteRequest_Body); i { + switch v := v.(*PutRequest_Body_Init); i { case 0: return &v.state case 1: @@ -3591,7 +3998,7 @@ func file_object_grpc_service_proto_init() { } } file_object_grpc_service_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DeleteResponse_Body); i { + switch v := v.(*PutResponse_Body); i { case 0: return &v.state case 1: @@ -3603,7 +4010,7 @@ func file_object_grpc_service_proto_init() { } } file_object_grpc_service_proto_msgTypes[26].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*HeadRequest_Body); i { + switch v := v.(*DeleteRequest_Body); i { case 0: return &v.state case 1: @@ -3615,7 +4022,7 @@ func file_object_grpc_service_proto_init() { } } file_object_grpc_service_proto_msgTypes[27].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*HeadResponse_Body); i { + switch v := v.(*DeleteResponse_Body); i { case 0: return &v.state case 1: @@ -3627,7 +4034,7 @@ func file_object_grpc_service_proto_init() { } } file_object_grpc_service_proto_msgTypes[28].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SearchRequest_Body); i { + switch v := v.(*HeadRequest_Body); i { case 0: return &v.state case 1: @@ -3639,7 +4046,7 @@ func file_object_grpc_service_proto_init() { } } file_object_grpc_service_proto_msgTypes[29].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SearchRequest_Body_Filter); i { + switch v := v.(*HeadResponse_Body); i { case 0: return &v.state case 1: @@ -3651,7 +4058,7 @@ func file_object_grpc_service_proto_init() { } } file_object_grpc_service_proto_msgTypes[30].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SearchResponse_Body); i { + switch v := v.(*SearchRequest_Body); i { case 0: return &v.state case 1: @@ -3663,7 +4070,7 @@ func file_object_grpc_service_proto_init() { } } file_object_grpc_service_proto_msgTypes[31].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetRangeRequest_Body); i { + switch v := v.(*SearchRequest_Body_Filter); i { case 0: return &v.state case 1: @@ -3675,7 +4082,7 @@ func file_object_grpc_service_proto_init() { } } file_object_grpc_service_proto_msgTypes[32].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetRangeResponse_Body); i { + switch v := v.(*SearchResponse_Body); i { case 0: return &v.state case 1: @@ -3687,7 +4094,7 @@ func file_object_grpc_service_proto_init() { } } file_object_grpc_service_proto_msgTypes[33].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetRangeHashRequest_Body); i { + switch v := v.(*GetRangeRequest_Body); i { case 0: return &v.state case 1: @@ -3699,7 +4106,7 @@ func file_object_grpc_service_proto_init() { } } file_object_grpc_service_proto_msgTypes[34].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetRangeHashResponse_Body); i { + switch v := v.(*GetRangeResponse_Body); i { case 0: return &v.state case 1: @@ -3711,7 +4118,7 @@ func file_object_grpc_service_proto_init() { } } file_object_grpc_service_proto_msgTypes[35].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PutSingleRequest_Body); i { + switch v := v.(*GetRangeHashRequest_Body); i { case 0: return &v.state case 1: @@ -3723,6 +4130,30 @@ func file_object_grpc_service_proto_init() { } } file_object_grpc_service_proto_msgTypes[36].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetRangeHashResponse_Body); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_object_grpc_service_proto_msgTypes[37].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PutSingleRequest_Body); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_object_grpc_service_proto_msgTypes[38].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PutSingleResponse_Body); i { case 0: return &v.state @@ -3734,24 +4165,60 @@ func file_object_grpc_service_proto_init() { return nil } } + file_object_grpc_service_proto_msgTypes[39].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PatchRequest_Body); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_object_grpc_service_proto_msgTypes[40].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PatchRequest_Body_Patch); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_object_grpc_service_proto_msgTypes[41].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PatchResponse_Body); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } - file_object_grpc_service_proto_msgTypes[19].OneofWrappers = []interface{}{ + file_object_grpc_service_proto_msgTypes[21].OneofWrappers = []interface{}{ (*GetResponse_Body_Init_)(nil), (*GetResponse_Body_Chunk)(nil), (*GetResponse_Body_SplitInfo)(nil), (*GetResponse_Body_EcInfo)(nil), } - file_object_grpc_service_proto_msgTypes[21].OneofWrappers = []interface{}{ + file_object_grpc_service_proto_msgTypes[23].OneofWrappers = []interface{}{ (*PutRequest_Body_Init_)(nil), (*PutRequest_Body_Chunk)(nil), } - file_object_grpc_service_proto_msgTypes[27].OneofWrappers = []interface{}{ + file_object_grpc_service_proto_msgTypes[29].OneofWrappers = []interface{}{ (*HeadResponse_Body_Header)(nil), (*HeadResponse_Body_ShortHeader)(nil), (*HeadResponse_Body_SplitInfo)(nil), (*HeadResponse_Body_EcInfo)(nil), } - file_object_grpc_service_proto_msgTypes[32].OneofWrappers = []interface{}{ + file_object_grpc_service_proto_msgTypes[34].OneofWrappers = []interface{}{ (*GetRangeResponse_Body_Chunk)(nil), (*GetRangeResponse_Body_SplitInfo)(nil), (*GetRangeResponse_Body_EcInfo)(nil), @@ -3762,7 +4229,7 @@ func file_object_grpc_service_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_object_grpc_service_proto_rawDesc, NumEnums: 0, - NumMessages: 37, + NumMessages: 42, NumExtensions: 0, NumServices: 1, }, diff --git a/object/grpc/service_grpc.pb.go b/object/grpc/service_grpc.pb.go index 11d132f..2494be9 100644 --- a/object/grpc/service_grpc.pb.go +++ b/object/grpc/service_grpc.pb.go @@ -27,6 +27,7 @@ const ( ObjectService_GetRange_FullMethodName = "/neo.fs.v2.object.ObjectService/GetRange" ObjectService_GetRangeHash_FullMethodName = "/neo.fs.v2.object.ObjectService/GetRangeHash" ObjectService_PutSingle_FullMethodName = "/neo.fs.v2.object.ObjectService/PutSingle" + ObjectService_Patch_FullMethodName = "/neo.fs.v2.object.ObjectService/Patch" ) // ObjectServiceClient is the client API for ObjectService service. @@ -299,6 +300,50 @@ type ObjectServiceClient interface { // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ // provided session token has expired. PutSingle(ctx context.Context, in *PutSingleRequest, opts ...grpc.CallOption) (*PutSingleResponse, error) + // Patch the object. Request uses gRPC stream. First message must set + // the address of the object that is going to get patched. If the object's attributes + // are patched, then these attrubutes must be set only within the first stream message. + // + // If the patch request is performed by NOT the object's owner but if the actor has the permission + // to perform the patch, then `OwnerID` of the object is changed. In this case the object's owner + // loses the object's ownership after the patch request is successfully done. + // + // As objects are content-addressable the patching causes new object ID generation for the patched object. + // This object id is set witihn `PatchResponse`. But the object id may remain unchanged in such cases: + // 1. The chunk of the applying patch contains the same value as the object's payload within the same range; + // 2. The patch that reverts the changes applied by preceding patch; + // 3. The application of the same patches for the object a few times. + // + // Extended headers can change `Patch` behaviour: + // - [ __SYSTEM__NETMAP_EPOCH \ + // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ + // Will use the requsted version of Network Map for object placement + // calculation. + // + // Please refer to detailed `XHeader` description. + // + // Statuses: + // - **OK** (0, SECTION_SUCCESS): \ + // object has been successfully patched and saved in the container; + // - Common failures (SECTION_FAILURE_COMMON); + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // write access to the container is denied; + // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ + // object not found in container; + // - **OBJECT_ALREADY_REMOVED** (2052, SECTION_OBJECT): \ + // the requested object has been marked as deleted; + // - **OUT_OF_RANGE** (2053, SECTION_OBJECT): \ + // the requested range is out of bounds; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // object storage container not found; + // - **CONTAINER_ACCESS_DENIED** (3074, SECTION_CONTAINER): \ + // access to container is denied; + // - **TOKEN_NOT_FOUND** (4096, SECTION_SESSION): \ + // (for trusted object preparation) session private key does not exist or + // has been deleted; + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. + Patch(ctx context.Context, opts ...grpc.CallOption) (ObjectService_PatchClient, error) } type objectServiceClient struct { @@ -475,6 +520,40 @@ func (c *objectServiceClient) PutSingle(ctx context.Context, in *PutSingleReques return out, nil } +func (c *objectServiceClient) Patch(ctx context.Context, opts ...grpc.CallOption) (ObjectService_PatchClient, error) { + stream, err := c.cc.NewStream(ctx, &ObjectService_ServiceDesc.Streams[4], ObjectService_Patch_FullMethodName, opts...) + if err != nil { + return nil, err + } + x := &objectServicePatchClient{stream} + return x, nil +} + +type ObjectService_PatchClient interface { + Send(*PatchRequest) error + CloseAndRecv() (*PatchResponse, error) + grpc.ClientStream +} + +type objectServicePatchClient struct { + grpc.ClientStream +} + +func (x *objectServicePatchClient) Send(m *PatchRequest) error { + return x.ClientStream.SendMsg(m) +} + +func (x *objectServicePatchClient) CloseAndRecv() (*PatchResponse, error) { + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + m := new(PatchResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + // ObjectServiceServer is the server API for ObjectService service. // All implementations should embed UnimplementedObjectServiceServer // for forward compatibility @@ -745,6 +824,50 @@ type ObjectServiceServer interface { // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ // provided session token has expired. PutSingle(context.Context, *PutSingleRequest) (*PutSingleResponse, error) + // Patch the object. Request uses gRPC stream. First message must set + // the address of the object that is going to get patched. If the object's attributes + // are patched, then these attrubutes must be set only within the first stream message. + // + // If the patch request is performed by NOT the object's owner but if the actor has the permission + // to perform the patch, then `OwnerID` of the object is changed. In this case the object's owner + // loses the object's ownership after the patch request is successfully done. + // + // As objects are content-addressable the patching causes new object ID generation for the patched object. + // This object id is set witihn `PatchResponse`. But the object id may remain unchanged in such cases: + // 1. The chunk of the applying patch contains the same value as the object's payload within the same range; + // 2. The patch that reverts the changes applied by preceding patch; + // 3. The application of the same patches for the object a few times. + // + // Extended headers can change `Patch` behaviour: + // - [ __SYSTEM__NETMAP_EPOCH \ + // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ + // Will use the requsted version of Network Map for object placement + // calculation. + // + // Please refer to detailed `XHeader` description. + // + // Statuses: + // - **OK** (0, SECTION_SUCCESS): \ + // object has been successfully patched and saved in the container; + // - Common failures (SECTION_FAILURE_COMMON); + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // write access to the container is denied; + // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ + // object not found in container; + // - **OBJECT_ALREADY_REMOVED** (2052, SECTION_OBJECT): \ + // the requested object has been marked as deleted; + // - **OUT_OF_RANGE** (2053, SECTION_OBJECT): \ + // the requested range is out of bounds; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // object storage container not found; + // - **CONTAINER_ACCESS_DENIED** (3074, SECTION_CONTAINER): \ + // access to container is denied; + // - **TOKEN_NOT_FOUND** (4096, SECTION_SESSION): \ + // (for trusted object preparation) session private key does not exist or + // has been deleted; + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. + Patch(ObjectService_PatchServer) error } // UnimplementedObjectServiceServer should be embedded to have forward compatible implementations. @@ -775,6 +898,9 @@ func (UnimplementedObjectServiceServer) GetRangeHash(context.Context, *GetRangeH func (UnimplementedObjectServiceServer) PutSingle(context.Context, *PutSingleRequest) (*PutSingleResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method PutSingle not implemented") } +func (UnimplementedObjectServiceServer) Patch(ObjectService_PatchServer) error { + return status.Errorf(codes.Unimplemented, "method Patch not implemented") +} // UnsafeObjectServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to ObjectServiceServer will @@ -948,6 +1074,32 @@ func _ObjectService_PutSingle_Handler(srv interface{}, ctx context.Context, dec return interceptor(ctx, in, info, handler) } +func _ObjectService_Patch_Handler(srv interface{}, stream grpc.ServerStream) error { + return srv.(ObjectServiceServer).Patch(&objectServicePatchServer{stream}) +} + +type ObjectService_PatchServer interface { + SendAndClose(*PatchResponse) error + Recv() (*PatchRequest, error) + grpc.ServerStream +} + +type objectServicePatchServer struct { + grpc.ServerStream +} + +func (x *objectServicePatchServer) SendAndClose(m *PatchResponse) error { + return x.ServerStream.SendMsg(m) +} + +func (x *objectServicePatchServer) Recv() (*PatchRequest, error) { + m := new(PatchRequest) + if err := x.ServerStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + // ObjectService_ServiceDesc is the grpc.ServiceDesc for ObjectService service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) @@ -993,6 +1145,11 @@ var ObjectService_ServiceDesc = grpc.ServiceDesc{ Handler: _ObjectService_GetRange_Handler, ServerStreams: true, }, + { + StreamName: "Patch", + Handler: _ObjectService_Patch_Handler, + ClientStreams: true, + }, }, Metadata: "object/grpc/service.proto", } diff --git a/object/marshal.go b/object/marshal.go index f96b098..a0b82df 100644 --- a/object/marshal.go +++ b/object/marshal.go @@ -132,6 +132,16 @@ const ( putSingleReqObjectField = 1 putSingleReqCopiesNumberField = 2 + + patchRequestBodyPatchRangeField = 1 + patchRequestBodyPatchChunkField = 2 + + patchRequestBodyAddrField = 1 + patchRequestBodyNewAttrsField = 2 + patchRequestBodyReplaceAttrField = 3 + patchRequestBodyPatchField = 4 + + patchResponseBodyObjectIDField = 1 ) func (h *ShortHeader) StableMarshal(buf []byte) []byte { @@ -1314,3 +1324,105 @@ func (r *PutSingleResponseBody) StableSize() int { func (r *PutSingleResponseBody) Unmarshal(data []byte) error { return message.Unmarshal(r, data, new(object.PutSingleResponse_Body)) } + +func (r *PatchRequestBodyPatch) StableMarshal(buf []byte) []byte { + if r == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, r.StableSize()) + } + + var offset int + offset += proto.NestedStructureMarshal(patchRequestBodyPatchRangeField, buf[offset:], r.Range) + offset += proto.BytesMarshal(patchRequestBodyPatchChunkField, buf[offset:], r.Chunk) + + return buf +} + +func (r *PatchRequestBodyPatch) StableSize() int { + if r == nil { + return 0 + } + + var size int + size += proto.NestedStructureSize(patchRequestBodyPatchRangeField, r.Range) + size += proto.BytesSize(patchRequestBodyPatchChunkField, r.Chunk) + + return size +} + +func (r *PatchRequestBodyPatch) Unmarshal(data []byte) error { + return message.Unmarshal(r, data, new(object.PatchRequest_Body_Patch)) +} + +func (r *PatchRequestBody) StableMarshal(buf []byte) []byte { + if r == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, r.StableSize()) + } + + var offset int + offset += proto.NestedStructureMarshal(patchRequestBodyAddrField, buf[offset:], r.Address) + for i := range r.NewAttributes { + offset += proto.NestedStructureMarshal(patchRequestBodyNewAttrsField, buf[offset:], &r.NewAttributes[i]) + } + offset += proto.BoolMarshal(patchRequestBodyReplaceAttrField, buf[offset:], r.ReplaceAttributes) + offset += proto.NestedStructureMarshal(patchRequestBodyPatchField, buf[offset:], r.Patch) + + return buf +} + +func (r *PatchRequestBody) StableSize() int { + if r == nil { + return 0 + } + + var size int + size += proto.NestedStructureSize(patchRequestBodyAddrField, r.Address) + for i := range r.NewAttributes { + size += proto.NestedStructureSize(patchRequestBodyNewAttrsField, &r.NewAttributes[i]) + } + size += proto.BoolSize(patchRequestBodyReplaceAttrField, r.ReplaceAttributes) + size += proto.NestedStructureSize(patchRequestBodyPatchField, r.Patch) + + return size +} + +func (r *PatchRequestBody) Unmarshal(data []byte) error { + return message.Unmarshal(r, data, new(object.PatchRequest_Body)) +} + +func (r *PatchResponseBody) StableSize() int { + if r == nil { + return 0 + } + + var size int + size += proto.NestedStructureSize(patchResponseBodyObjectIDField, r.ObjectID) + + return size +} + +func (r *PatchResponseBody) StableMarshal(buf []byte) []byte { + if r == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, r.StableSize()) + } + + var offset int + offset += proto.NestedStructureMarshal(patchResponseBodyObjectIDField, buf[offset:], r.ObjectID) + + return buf +} + +func (r *PatchResponseBody) Unmarshal(data []byte) error { + return message.Unmarshal(r, data, new(object.PatchResponse_Body)) +} diff --git a/object/message_test.go b/object/message_test.go index 749c373..d4e95b3 100644 --- a/object/message_test.go +++ b/object/message_test.go @@ -56,5 +56,10 @@ func TestMessageConvert(t *testing.T) { func(empty bool) message.Message { return objecttest.GenerateLock(empty) }, func(empty bool) message.Message { return objecttest.GeneratePutSingleRequest(empty) }, func(empty bool) message.Message { return objecttest.GeneratePutSingleResponse(empty) }, + func(empty bool) message.Message { return objecttest.GeneratePatchRequestBodyPatch(empty) }, + func(empty bool) message.Message { return objecttest.GeneratePatchRequestBody(empty) }, + func(empty bool) message.Message { return objecttest.GeneratePatchRequest(empty) }, + func(empty bool) message.Message { return objecttest.GeneratePatchResponseBody(empty) }, + func(empty bool) message.Message { return objecttest.GeneratePatchResponse(empty) }, ) } diff --git a/object/test/generate.go b/object/test/generate.go index b1931fc..f45941f 100644 --- a/object/test/generate.go +++ b/object/test/generate.go @@ -691,6 +691,63 @@ func GeneratePutSingleResponse(empty bool) *object.PutSingleResponse { return m } +func GeneratePatchRequestBodyPatch(empty bool) *object.PatchRequestBodyPatch { + m := new(object.PatchRequestBodyPatch) + + if !empty { + m.Range = GenerateRange(false) + m.Chunk = []byte("GeneratePatchRequestBodyPatch") + } + + return m +} + +func GeneratePatchRequestBody(empty bool) *object.PatchRequestBody { + m := new(object.PatchRequestBody) + + if !empty { + m.Address = refstest.GenerateAddress(empty) + m.NewAttributes = GenerateAttributes(empty) + m.ReplaceAttributes = false + m.Patch = GeneratePatchRequestBodyPatch(empty) + } + + return m +} + +func GeneratePatchRequest(empty bool) *object.PatchRequest { + m := new(object.PatchRequest) + + if !empty { + m.Body = GeneratePatchRequestBody(empty) + } + + m.SetMetaHeader(sessiontest.GenerateRequestMetaHeader(empty)) + m.SetVerificationHeader(sessiontest.GenerateRequestVerificationHeader(empty)) + + return m +} + +func GeneratePatchResponseBody(empty bool) *object.PatchResponseBody { + m := new(object.PatchResponseBody) + + if !empty { + m.ObjectID = refstest.GenerateObjectID(empty) + } + + return m +} + +func GeneratePatchResponse(empty bool) *object.PatchResponse { + m := new(object.PatchResponse) + + if !empty { + m.Body = GeneratePatchResponseBody(empty) + } + + return m +} + func randomInt(n int) int { return rand.New(rand.NewSource(time.Now().UnixNano())).Intn(n) } diff --git a/object/types.go b/object/types.go index 43caf80..d0cac37 100644 --- a/object/types.go +++ b/object/types.go @@ -349,6 +349,38 @@ type PutSingleResponse struct { session.ResponseHeaders } +type PatchRequestBodyPatch struct { + Range *Range + + Chunk []byte +} + +type PatchRequestBody struct { + Address *refs.Address + + NewAttributes []Attribute + + ReplaceAttributes bool + + Patch *PatchRequestBodyPatch +} + +type PatchRequest struct { + Body *PatchRequestBody + + session.RequestHeaders +} + +type PatchResponseBody struct { + ObjectID *refs.ObjectID +} + +type PatchResponse struct { + Body *PatchResponseBody + + session.ResponseHeaders +} + const ( TypeRegular Type = iota TypeTombstone diff --git a/util/proto/test/test.pb.go b/util/proto/test/test.pb.go index 57f7fb0..199fe2f 100644 --- a/util/proto/test/test.pb.go +++ b/util/proto/test/test.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.33.0 -// protoc v5.27.2 +// protoc v4.25.3 // source: util/proto/test/test.proto package test From 8580b49c8d65a78126444ef49df1bbb18a849a42 Mon Sep 17 00:00:00 2001 From: Airat Arifullin Date: Wed, 24 Jul 2024 17:45:30 +0300 Subject: [PATCH 1138/1196] [#94] rpc: Introduce `ObjectService.Patch` method Signed-off-by: Airat Arifullin --- object/marshal.go | 6 +++--- rpc/object.go | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 3 deletions(-) diff --git a/object/marshal.go b/object/marshal.go index a0b82df..00bafc9 100644 --- a/object/marshal.go +++ b/object/marshal.go @@ -1336,7 +1336,7 @@ func (r *PatchRequestBodyPatch) StableMarshal(buf []byte) []byte { var offset int offset += proto.NestedStructureMarshal(patchRequestBodyPatchRangeField, buf[offset:], r.Range) - offset += proto.BytesMarshal(patchRequestBodyPatchChunkField, buf[offset:], r.Chunk) + proto.BytesMarshal(patchRequestBodyPatchChunkField, buf[offset:], r.Chunk) return buf } @@ -1372,7 +1372,7 @@ func (r *PatchRequestBody) StableMarshal(buf []byte) []byte { offset += proto.NestedStructureMarshal(patchRequestBodyNewAttrsField, buf[offset:], &r.NewAttributes[i]) } offset += proto.BoolMarshal(patchRequestBodyReplaceAttrField, buf[offset:], r.ReplaceAttributes) - offset += proto.NestedStructureMarshal(patchRequestBodyPatchField, buf[offset:], r.Patch) + proto.NestedStructureMarshal(patchRequestBodyPatchField, buf[offset:], r.Patch) return buf } @@ -1418,7 +1418,7 @@ func (r *PatchResponseBody) StableMarshal(buf []byte) []byte { } var offset int - offset += proto.NestedStructureMarshal(patchResponseBodyObjectIDField, buf[offset:], r.ObjectID) + proto.NestedStructureMarshal(patchResponseBodyObjectIDField, buf[offset:], r.ObjectID) return buf } diff --git a/rpc/object.go b/rpc/object.go index 1eca922..6d7af31 100644 --- a/rpc/object.go +++ b/rpc/object.go @@ -18,6 +18,7 @@ const ( rpcObjectHead = "Head" rpcObjectDelete = "Delete" rpcObjectPutSingle = "PutSingle" + rpcObjectPatch = "Patch" ) // PutRequestWriter is an object.PutRequest @@ -205,3 +206,38 @@ func PutSingleObject( return resp, nil } + +// PatchRequestWriter is an object.PatchRequest +// message streaming component. +type PatchRequestWriter struct { + wc client.MessageWriterCloser + + resp message.Message +} + +// Write writes req to the stream. +func (w *PatchRequestWriter) Write(req *object.PatchRequest) error { + return w.wc.WriteMessage(req) +} + +// Close closes the stream. +func (w *PatchRequestWriter) Close() error { + return w.wc.Close() +} + +// Patch executes ObjectService.Patch RPC. +func Patch( + cli *client.Client, + resp *object.PatchResponse, + opts ...client.CallOption, +) (*PatchRequestWriter, error) { + wc, err := client.OpenClientStream(cli, common.CallMethodInfoClientStream(serviceObject, rpcObjectPatch), resp, opts...) + if err != nil { + return nil, err + } + + return &PatchRequestWriter{ + wc: wc, + resp: resp, + }, nil +} From 8ce8cd6ec272d947a29c8d180d8d6feabfb934ad Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Mon, 29 Jul 2024 15:40:43 +0300 Subject: [PATCH 1139/1196] [#96] .golangci.yml: Fix deprecated config options ``` WARN [config_reader] The configuration option `run.skip-files` is deprecated, please use `issues.exclude-files`. WARN [config_reader] The configuration option `output.format` is deprecated, please use `output.formats` ``` Signed-off-by: Evgenii Stratonikov --- .golangci.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index db94146..c6f4308 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -9,13 +9,11 @@ run: # include test files or not, default is true tests: false - skip-files: - - (^|.*/)grpc/(.*) - # output configuration options output: # colored-line-number|line-number|json|tab|checkstyle|code-climate, default is "colored-line-number" - format: tab + formats: + - format: tab # all available settings of specific linters linters-settings: @@ -67,6 +65,9 @@ linters: fast: false issues: + exclude-files: + - (^|.*/)grpc/(.*) + # Excluding configuration per-path, per-linter, per-text and per-source exclude-rules: - path: v2 # ignore stutters in universal structures due to protobuf compatibility From 8609f29a6019d2a09722b2bde69bcf30b772f426 Mon Sep 17 00:00:00 2001 From: Airat Arifullin Date: Tue, 30 Jul 2024 17:49:45 +0300 Subject: [PATCH 1140/1196] [#97] object: Refactor Patch related structs * Add getters and setters for related types; * Fix unit-tests. Signed-off-by: Airat Arifullin --- object/convert.go | 38 +++++++++---------- object/marshal.go | 20 +++++----- object/test/generate.go | 10 ++--- object/types.go | 82 ++++++++++++++++++++++++++++++++++++++--- 4 files changed, 111 insertions(+), 39 deletions(-) diff --git a/object/convert.go b/object/convert.go index 1abfb5e..5c9e20a 100644 --- a/object/convert.go +++ b/object/convert.go @@ -2392,10 +2392,10 @@ func (r *PatchRequestBody) ToGRPCMessage() grpc.Message { if r != nil { m = new(object.PatchRequest_Body) - m.SetAddress(r.Address.ToGRPCMessage().(*refsGRPC.Address)) - m.SetNewAttributes(AttributesToGRPC(r.NewAttributes)) - m.SetReplaceAttributes(r.ReplaceAttributes) - m.SetPatch(r.Patch.ToGRPCMessage().(*object.PatchRequest_Body_Patch)) + m.SetAddress(r.address.ToGRPCMessage().(*refsGRPC.Address)) + m.SetNewAttributes(AttributesToGRPC(r.newAttributes)) + m.SetReplaceAttributes(r.replaceAttributes) + m.SetPatch(r.patch.ToGRPCMessage().(*object.PatchRequest_Body_Patch)) } return m @@ -2411,34 +2411,34 @@ func (r *PatchRequestBody) FromGRPCMessage(m grpc.Message) error { addr := v.GetAddress() if addr == nil { - r.Address = nil + r.address = nil } else { - if r.Address == nil { - r.Address = new(refs.Address) + if r.address == nil { + r.address = new(refs.Address) } - err = r.Address.FromGRPCMessage(addr) + err = r.address.FromGRPCMessage(addr) if err != nil { return err } } - r.NewAttributes, err = AttributesFromGRPC(v.GetNewAttributes()) + r.newAttributes, err = AttributesFromGRPC(v.GetNewAttributes()) if err != nil { return err } - r.ReplaceAttributes = v.GetReplaceAttributes() + r.replaceAttributes = v.GetReplaceAttributes() patch := v.GetPatch() if patch == nil { - r.Patch = nil + r.patch = nil } else { - if r.Patch == nil { - r.Patch = new(PatchRequestBodyPatch) + if r.patch == nil { + r.patch = new(PatchRequestBodyPatch) } - err = r.Patch.FromGRPCMessage(patch) + err = r.patch.FromGRPCMessage(patch) if err != nil { return err } @@ -2453,7 +2453,7 @@ func (r *PatchRequest) ToGRPCMessage() grpc.Message { if r != nil { m = new(object.PatchRequest) - m.SetBody(r.Body.ToGRPCMessage().(*object.PatchRequest_Body)) + m.SetBody(r.body.ToGRPCMessage().(*object.PatchRequest_Body)) r.RequestHeaders.ToMessage(m) } @@ -2470,13 +2470,13 @@ func (r *PatchRequest) FromGRPCMessage(m grpc.Message) error { body := v.GetBody() if body == nil { - r.Body = nil + r.body = nil } else { - if r.Body == nil { - r.Body = new(PatchRequestBody) + if r.body == nil { + r.body = new(PatchRequestBody) } - err = r.Body.FromGRPCMessage(body) + err = r.body.FromGRPCMessage(body) if err != nil { return err } diff --git a/object/marshal.go b/object/marshal.go index 00bafc9..f337502 100644 --- a/object/marshal.go +++ b/object/marshal.go @@ -1367,12 +1367,12 @@ func (r *PatchRequestBody) StableMarshal(buf []byte) []byte { } var offset int - offset += proto.NestedStructureMarshal(patchRequestBodyAddrField, buf[offset:], r.Address) - for i := range r.NewAttributes { - offset += proto.NestedStructureMarshal(patchRequestBodyNewAttrsField, buf[offset:], &r.NewAttributes[i]) + offset += proto.NestedStructureMarshal(patchRequestBodyAddrField, buf[offset:], r.address) + for i := range r.newAttributes { + offset += proto.NestedStructureMarshal(patchRequestBodyNewAttrsField, buf[offset:], &r.newAttributes[i]) } - offset += proto.BoolMarshal(patchRequestBodyReplaceAttrField, buf[offset:], r.ReplaceAttributes) - proto.NestedStructureMarshal(patchRequestBodyPatchField, buf[offset:], r.Patch) + offset += proto.BoolMarshal(patchRequestBodyReplaceAttrField, buf[offset:], r.replaceAttributes) + proto.NestedStructureMarshal(patchRequestBodyPatchField, buf[offset:], r.patch) return buf } @@ -1383,12 +1383,12 @@ func (r *PatchRequestBody) StableSize() int { } var size int - size += proto.NestedStructureSize(patchRequestBodyAddrField, r.Address) - for i := range r.NewAttributes { - size += proto.NestedStructureSize(patchRequestBodyNewAttrsField, &r.NewAttributes[i]) + size += proto.NestedStructureSize(patchRequestBodyAddrField, r.address) + for i := range r.newAttributes { + size += proto.NestedStructureSize(patchRequestBodyNewAttrsField, &r.newAttributes[i]) } - size += proto.BoolSize(patchRequestBodyReplaceAttrField, r.ReplaceAttributes) - size += proto.NestedStructureSize(patchRequestBodyPatchField, r.Patch) + size += proto.BoolSize(patchRequestBodyReplaceAttrField, r.replaceAttributes) + size += proto.NestedStructureSize(patchRequestBodyPatchField, r.patch) return size } diff --git a/object/test/generate.go b/object/test/generate.go index f45941f..87ad64e 100644 --- a/object/test/generate.go +++ b/object/test/generate.go @@ -706,10 +706,10 @@ func GeneratePatchRequestBody(empty bool) *object.PatchRequestBody { m := new(object.PatchRequestBody) if !empty { - m.Address = refstest.GenerateAddress(empty) - m.NewAttributes = GenerateAttributes(empty) - m.ReplaceAttributes = false - m.Patch = GeneratePatchRequestBodyPatch(empty) + m.SetAddress(refstest.GenerateAddress(empty)) + m.SetNewAttributes(GenerateAttributes(empty)) + m.SetReplaceAttributes(false) + m.SetPatch(GeneratePatchRequestBodyPatch(empty)) } return m @@ -719,7 +719,7 @@ func GeneratePatchRequest(empty bool) *object.PatchRequest { m := new(object.PatchRequest) if !empty { - m.Body = GeneratePatchRequestBody(empty) + m.SetBody(GeneratePatchRequestBody(empty)) } m.SetMetaHeader(sessiontest.GenerateRequestMetaHeader(empty)) diff --git a/object/types.go b/object/types.go index d0cac37..c1a8b87 100644 --- a/object/types.go +++ b/object/types.go @@ -356,17 +356,17 @@ type PatchRequestBodyPatch struct { } type PatchRequestBody struct { - Address *refs.Address + address *refs.Address - NewAttributes []Attribute + newAttributes []Attribute - ReplaceAttributes bool + replaceAttributes bool - Patch *PatchRequestBodyPatch + patch *PatchRequestBodyPatch } type PatchRequest struct { - Body *PatchRequestBody + body *PatchRequestBody session.RequestHeaders } @@ -1543,6 +1543,78 @@ func (r *PutSingleResponse) SetBody(v *PutSingleResponseBody) { r.body = v } +func (r *PatchRequest) GetBody() *PatchRequestBody { + if r != nil { + return r.body + } + + return nil +} + +func (r *PatchRequest) SetBody(v *PatchRequestBody) { + r.body = v +} + +func (r *PatchRequestBody) GetAddress() *refs.Address { + if r != nil { + return r.address + } + + return nil +} + +func (r *PatchRequestBody) SetAddress(addr *refs.Address) { + r.address = addr +} + +func (r *PatchRequestBody) GetNewAttributes() []Attribute { + if r != nil { + return r.newAttributes + } + + return nil +} + +func (r *PatchRequestBody) SetNewAttributes(attrs []Attribute) { + r.newAttributes = attrs +} + +func (r *PatchRequestBody) GetReplaceAttributes() bool { + if r != nil { + return r.replaceAttributes + } + + return false +} + +func (r *PatchRequestBody) SetReplaceAttributes(replace bool) { + r.replaceAttributes = replace +} + +func (r *PatchRequestBody) GetPatch() *PatchRequestBodyPatch { + if r != nil { + return r.patch + } + + return nil +} + +func (r *PatchRequestBody) SetPatch(patch *PatchRequestBodyPatch) { + r.patch = patch +} + +func (r *PatchResponse) GetBody() *PatchResponseBody { + if r != nil { + return r.Body + } + + return nil +} + +func (r *PatchResponse) SetBody(v *PatchResponseBody) { + r.Body = v +} + func (s *ECInfo) getObjectPart() {} func (s *ECInfo) getHeaderPart() {} From c27b978770a334a964ce682888b7d08dd2a4a627 Mon Sep 17 00:00:00 2001 From: Airat Arifullin Date: Tue, 30 Jul 2024 17:50:26 +0300 Subject: [PATCH 1141/1196] [#97] signature: Add Patch messages to `serviceMessageBody` Signed-off-by: Airat Arifullin --- signature/body.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/signature/body.go b/signature/body.go index 53b5d6b..4b43b84 100644 --- a/signature/body.go +++ b/signature/body.go @@ -84,6 +84,10 @@ func serviceMessageBody(req any) stableMarshaler { return v.GetBody() case *object.PutSingleResponse: return v.GetBody() + case *object.PatchRequest: + return v.GetBody() + case *object.PatchResponse: + return v.GetBody() /* Netmap */ case *netmap.LocalNodeInfoRequest: From 1473fa588f8a0bab0806c2fae380ee2512174652 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Wed, 31 Jul 2024 15:34:44 +0300 Subject: [PATCH 1142/1196] [#98] rpc: Accept interface in place of ClientConn gRPC client load-balancing API is ugly as f: 1. It is configured by pre-registering a balancer and the providing JSON configuration. 2. It doesn't allow different credentials for different endpoints (consider using "insecure" localhost and external endpoint). 3. To support frostfs usecase we also need to implement a resolver, which has its own difficulties. 4. https://github.com/grpc/grpc-go/issues/239#issuecomment-264548415 Using interface in place of grpc.ClientConn allows us to provide custom implentation for it (load-balancing, circuit breaker etc.). Refs TrueCloudLab/frostfs-node#1268 Signed-off-by: Evgenii Stratonikov --- rpc/client/conn.go | 8 ++++++++ rpc/client/options.go | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/rpc/client/conn.go b/rpc/client/conn.go index 9fc7a51..f208413 100644 --- a/rpc/client/conn.go +++ b/rpc/client/conn.go @@ -2,8 +2,16 @@ package client import ( "io" + + "google.golang.org/grpc" ) +// Conn is an interface for grpc client connection. +type Conn interface { + grpc.ClientConnInterface + io.Closer +} + // Conn returns underlying connection. // // Returns non-nil result after the first Init() call diff --git a/rpc/client/options.go b/rpc/client/options.go index 0575dfc..22358a3 100644 --- a/rpc/client/options.go +++ b/rpc/client/options.go @@ -25,7 +25,7 @@ type cfg struct { tlsCfg *tls.Config grpcDialOpts []grpc.DialOption - conn *grpc.ClientConn + conn Conn } const ( @@ -114,7 +114,7 @@ func WithTLSCfg(v *tls.Config) Option { // WithGRPCConn returns option to specify // gRPC virtual connection. -func WithGRPCConn(v *grpc.ClientConn) Option { +func WithGRPCConn(v Conn) Option { return func(c *cfg) { if v != nil { c.conn = v From ebaf78c8faab21031b50ba546d25052b84d7d482 Mon Sep 17 00:00:00 2001 From: Airat Arifullin Date: Mon, 5 Aug 2024 20:52:47 +0300 Subject: [PATCH 1143/1196] [#100] session: Introduce `ObjectPatch` verb Signed-off-by: Airat Arifullin --- session/convert.go | 4 + session/grpc/types.pb.go | 289 ++++++++++++++++++++------------------- session/types.go | 1 + 3 files changed, 152 insertions(+), 142 deletions(-) diff --git a/session/convert.go b/session/convert.go index bbfe070..4197935 100644 --- a/session/convert.go +++ b/session/convert.go @@ -641,6 +641,8 @@ func ObjectSessionVerbToGRPCField(v ObjectSessionVerb) session.ObjectSessionCont return session.ObjectSessionContext_RANGE case ObjectVerbRangeHash: return session.ObjectSessionContext_RANGEHASH + case ObjectVerbPatch: + return session.ObjectSessionContext_PATCH default: return session.ObjectSessionContext_VERB_UNSPECIFIED } @@ -662,6 +664,8 @@ func ObjectSessionVerbFromGRPCField(v session.ObjectSessionContext_Verb) ObjectS return ObjectVerbRange case session.ObjectSessionContext_RANGEHASH: return ObjectVerbRangeHash + case session.ObjectSessionContext_PATCH: + return ObjectVerbPatch default: return ObjectVerbUnknown } diff --git a/session/grpc/types.pb.go b/session/grpc/types.pb.go index 924df45..9f51743 100644 --- a/session/grpc/types.pb.go +++ b/session/grpc/types.pb.go @@ -43,6 +43,8 @@ const ( ObjectSessionContext_RANGE ObjectSessionContext_Verb = 6 // Refers to object.GetRangeHash RPC call ObjectSessionContext_RANGEHASH ObjectSessionContext_Verb = 7 + // Refers to object.Patch RPC call + ObjectSessionContext_PATCH ObjectSessionContext_Verb = 8 ) // Enum value maps for ObjectSessionContext_Verb. @@ -56,6 +58,7 @@ var ( 5: "DELETE", 6: "RANGE", 7: "RANGEHASH", + 8: "PATCH", } ObjectSessionContext_Verb_value = map[string]int32{ "VERB_UNSPECIFIED": 0, @@ -66,6 +69,7 @@ var ( "DELETE": 5, "RANGE": 6, "RANGEHASH": 7, + "PATCH": 8, } ) @@ -1040,7 +1044,7 @@ var file_session_grpc_types_proto_rawDesc = []byte{ 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x14, 0x61, 0x63, 0x6c, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x22, 0x85, 0x03, 0x0a, 0x14, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x53, 0x65, + 0x6f, 0x74, 0x6f, 0x22, 0x90, 0x03, 0x0a, 0x14, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x12, 0x40, 0x0a, 0x04, 0x76, 0x65, 0x72, 0x62, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x4f, @@ -1058,154 +1062,155 @@ var file_session_grpc_types_proto_rawDesc = []byte{ 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x18, 0x02, 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, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x22, - 0x6a, 0x0a, 0x04, 0x56, 0x65, 0x72, 0x62, 0x12, 0x14, 0x0a, 0x10, 0x56, 0x45, 0x52, 0x42, 0x5f, + 0x75, 0x0a, 0x04, 0x56, 0x65, 0x72, 0x62, 0x12, 0x14, 0x0a, 0x10, 0x56, 0x45, 0x52, 0x42, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x50, 0x55, 0x54, 0x10, 0x01, 0x12, 0x07, 0x0a, 0x03, 0x47, 0x45, 0x54, 0x10, 0x02, 0x12, 0x08, 0x0a, 0x04, 0x48, 0x45, 0x41, 0x44, 0x10, 0x03, 0x12, 0x0a, 0x0a, 0x06, 0x53, 0x45, 0x41, 0x52, 0x43, 0x48, 0x10, 0x04, 0x12, 0x0a, 0x0a, 0x06, 0x44, 0x45, 0x4c, 0x45, 0x54, 0x45, 0x10, 0x05, 0x12, 0x09, 0x0a, 0x05, 0x52, 0x41, 0x4e, 0x47, 0x45, 0x10, 0x06, 0x12, 0x0d, 0x0a, 0x09, - 0x52, 0x41, 0x4e, 0x47, 0x45, 0x48, 0x41, 0x53, 0x48, 0x10, 0x07, 0x22, 0xfa, 0x01, 0x0a, 0x17, - 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, - 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x12, 0x43, 0x0a, 0x04, 0x76, 0x65, 0x72, 0x62, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, - 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, - 0x6e, 0x65, 0x72, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, - 0x74, 0x2e, 0x56, 0x65, 0x72, 0x62, 0x52, 0x04, 0x76, 0x65, 0x72, 0x62, 0x12, 0x1a, 0x0a, 0x08, - 0x77, 0x69, 0x6c, 0x64, 0x63, 0x61, 0x72, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, - 0x77, 0x69, 0x6c, 0x64, 0x63, 0x61, 0x72, 0x64, 0x12, 0x3e, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, - 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, - 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, - 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x52, 0x0b, 0x63, 0x6f, 0x6e, - 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x22, 0x3e, 0x0a, 0x04, 0x56, 0x65, 0x72, 0x62, - 0x12, 0x14, 0x0a, 0x10, 0x56, 0x45, 0x52, 0x42, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, - 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x50, 0x55, 0x54, 0x10, 0x01, 0x12, - 0x0a, 0x0a, 0x06, 0x44, 0x45, 0x4c, 0x45, 0x54, 0x45, 0x10, 0x02, 0x12, 0x0b, 0x0a, 0x07, 0x53, - 0x45, 0x54, 0x45, 0x41, 0x43, 0x4c, 0x10, 0x03, 0x22, 0xa0, 0x04, 0x0a, 0x0c, 0x53, 0x65, 0x73, - 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x38, 0x0a, 0x04, 0x62, 0x6f, 0x64, - 0x79, 0x18, 0x01, 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, 0x53, 0x65, 0x73, 0x73, - 0x69, 0x6f, 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, - 0x6f, 0x64, 0x79, 0x12, 0x37, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, - 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, - 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x1a, 0x9c, 0x03, 0x0a, - 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0c, 0x52, 0x02, 0x69, 0x64, 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, 0x4e, 0x0a, 0x08, 0x6c, 0x69, 0x66, - 0x65, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x32, 0x2e, 0x6e, 0x65, - 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, - 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x42, 0x6f, 0x64, - 0x79, 0x2e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x4c, 0x69, 0x66, 0x65, 0x74, 0x69, 0x6d, 0x65, 0x52, - 0x08, 0x6c, 0x69, 0x66, 0x65, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x73, 0x65, 0x73, - 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, - 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x4b, 0x65, 0x79, 0x12, 0x41, 0x0a, 0x06, 0x6f, 0x62, - 0x6a, 0x65, 0x63, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x6e, 0x65, 0x6f, - 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x4f, - 0x62, 0x6a, 0x65, 0x63, 0x74, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x74, - 0x65, 0x78, 0x74, 0x48, 0x00, 0x52, 0x06, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x4a, 0x0a, - 0x09, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x2a, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, + 0x52, 0x41, 0x4e, 0x47, 0x45, 0x48, 0x41, 0x53, 0x48, 0x10, 0x07, 0x12, 0x09, 0x0a, 0x05, 0x50, + 0x41, 0x54, 0x43, 0x48, 0x10, 0x08, 0x22, 0xfa, 0x01, 0x0a, 0x17, 0x43, 0x6f, 0x6e, 0x74, 0x61, + 0x69, 0x6e, 0x65, 0x72, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x74, 0x65, + 0x78, 0x74, 0x12, 0x43, 0x0a, 0x04, 0x76, 0x65, 0x72, 0x62, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, + 0x32, 0x2f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x53, 0x65, - 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x48, 0x00, 0x52, 0x09, - 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x1a, 0x45, 0x0a, 0x0d, 0x54, 0x6f, 0x6b, - 0x65, 0x6e, 0x4c, 0x69, 0x66, 0x65, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x78, - 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x65, 0x78, 0x70, 0x12, 0x10, 0x0a, 0x03, - 0x6e, 0x62, 0x66, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x6e, 0x62, 0x66, 0x12, 0x10, - 0x0a, 0x03, 0x69, 0x61, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x69, 0x61, 0x74, - 0x42, 0x09, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x22, 0x31, 0x0a, 0x07, 0x58, - 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 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, 0x22, 0x8d, - 0x03, 0x0a, 0x11, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x48, 0x65, - 0x61, 0x64, 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, 0x14, 0x0a, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x12, 0x10, 0x0a, - 0x03, 0x74, 0x74, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x03, 0x74, 0x74, 0x6c, 0x12, - 0x37, 0x0a, 0x09, 0x78, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x18, 0x04, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, - 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x58, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x08, - 0x78, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x12, 0x44, 0x0a, 0x0d, 0x73, 0x65, 0x73, 0x73, - 0x69, 0x6f, 0x6e, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, - 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, - 0x52, 0x0c, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x3d, - 0x0a, 0x0c, 0x62, 0x65, 0x61, 0x72, 0x65, 0x72, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x06, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, - 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x42, 0x65, 0x61, 0x72, 0x65, 0x72, 0x54, 0x6f, 0x6b, 0x65, 0x6e, - 0x52, 0x0b, 0x62, 0x65, 0x61, 0x72, 0x65, 0x72, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x3c, 0x0a, - 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x18, 0x07, 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, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x12, 0x21, 0x0a, 0x0c, 0x6d, - 0x61, 0x67, 0x69, 0x63, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x08, 0x20, 0x01, 0x28, - 0x04, 0x52, 0x0b, 0x6d, 0x61, 0x67, 0x69, 0x63, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x22, 0x99, - 0x02, 0x0a, 0x12, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x48, - 0x65, 0x61, 0x64, 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, 0x14, 0x0a, 0x05, 0x65, 0x70, 0x6f, 0x63, - 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x12, 0x10, - 0x0a, 0x03, 0x74, 0x74, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x03, 0x74, 0x74, 0x6c, - 0x12, 0x37, 0x0a, 0x09, 0x78, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x18, 0x04, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, - 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x58, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, - 0x08, 0x78, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x12, 0x3d, 0x0a, 0x06, 0x6f, 0x72, 0x69, - 0x67, 0x69, 0x6e, 0x18, 0x05, 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, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x12, 0x30, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, - 0x75, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, - 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x53, 0x74, 0x61, 0x74, - 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0xab, 0x02, 0x0a, 0x19, 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, 0x12, 0x40, 0x0a, 0x0e, 0x62, 0x6f, 0x64, 0x79, - 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, - 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x0d, 0x62, 0x6f, 0x64, - 0x79, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x40, 0x0a, 0x0e, 0x6d, 0x65, - 0x74, 0x61, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, - 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x0d, 0x6d, - 0x65, 0x74, 0x61, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x44, 0x0a, 0x10, - 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, - 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, - 0x65, 0x52, 0x0f, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, - 0x72, 0x65, 0x12, 0x44, 0x0a, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x18, 0x04, 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, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x22, 0xad, 0x02, 0x0a, 0x1a, 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, 0x12, 0x40, 0x0a, 0x0e, 0x62, 0x6f, 0x64, 0x79, 0x5f, - 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, - 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x0d, 0x62, 0x6f, 0x64, 0x79, - 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x40, 0x0a, 0x0e, 0x6d, 0x65, 0x74, - 0x61, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x2e, 0x56, 0x65, 0x72, + 0x62, 0x52, 0x04, 0x76, 0x65, 0x72, 0x62, 0x12, 0x1a, 0x0a, 0x08, 0x77, 0x69, 0x6c, 0x64, 0x63, + 0x61, 0x72, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x77, 0x69, 0x6c, 0x64, 0x63, + 0x61, 0x72, 0x64, 0x12, 0x3e, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, + 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, + 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, + 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, + 0x72, 0x49, 0x44, 0x22, 0x3e, 0x0a, 0x04, 0x56, 0x65, 0x72, 0x62, 0x12, 0x14, 0x0a, 0x10, 0x56, + 0x45, 0x52, 0x42, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, + 0x00, 0x12, 0x07, 0x0a, 0x03, 0x50, 0x55, 0x54, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x44, 0x45, + 0x4c, 0x45, 0x54, 0x45, 0x10, 0x02, 0x12, 0x0b, 0x0a, 0x07, 0x53, 0x45, 0x54, 0x45, 0x41, 0x43, + 0x4c, 0x10, 0x03, 0x22, 0xa0, 0x04, 0x0a, 0x0c, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x54, + 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x38, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 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, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x6f, + 0x6b, 0x65, 0x6e, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x37, + 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, - 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x0d, 0x6d, 0x65, - 0x74, 0x61, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x44, 0x0a, 0x10, 0x6f, - 0x72, 0x69, 0x67, 0x69, 0x6e, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, - 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, - 0x52, 0x0f, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, - 0x65, 0x12, 0x45, 0x0a, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x18, 0x04, 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, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x42, 0x64, 0x5a, 0x44, 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, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 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, 0x06, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, + 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x1a, 0x9c, 0x03, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, + 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x02, 0x69, 0x64, + 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, 0x4e, 0x0a, 0x08, 0x6c, 0x69, 0x66, 0x65, 0x74, 0x69, 0x6d, 0x65, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x32, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, + 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, + 0x6f, 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x2e, 0x54, 0x6f, 0x6b, + 0x65, 0x6e, 0x4c, 0x69, 0x66, 0x65, 0x74, 0x69, 0x6d, 0x65, 0x52, 0x08, 0x6c, 0x69, 0x66, 0x65, + 0x74, 0x69, 0x6d, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, + 0x6b, 0x65, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x73, 0x65, 0x73, 0x73, 0x69, + 0x6f, 0x6e, 0x4b, 0x65, 0x79, 0x12, 0x41, 0x0a, 0x06, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x18, + 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, + 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x48, 0x00, + 0x52, 0x06, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x4a, 0x0a, 0x09, 0x63, 0x6f, 0x6e, 0x74, + 0x61, 0x69, 0x6e, 0x65, 0x72, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x6e, 0x65, + 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, + 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, + 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x48, 0x00, 0x52, 0x09, 0x63, 0x6f, 0x6e, 0x74, 0x61, + 0x69, 0x6e, 0x65, 0x72, 0x1a, 0x45, 0x0a, 0x0d, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x4c, 0x69, 0x66, + 0x65, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x78, 0x70, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x04, 0x52, 0x03, 0x65, 0x78, 0x70, 0x12, 0x10, 0x0a, 0x03, 0x6e, 0x62, 0x66, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x6e, 0x62, 0x66, 0x12, 0x10, 0x0a, 0x03, 0x69, 0x61, 0x74, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x69, 0x61, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x63, + 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x22, 0x31, 0x0a, 0x07, 0x58, 0x48, 0x65, 0x61, 0x64, 0x65, + 0x72, 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, 0x22, 0x8d, 0x03, 0x0a, 0x11, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 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, 0x14, 0x0a, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x04, 0x52, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x12, 0x10, 0x0a, 0x03, 0x74, 0x74, 0x6c, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x03, 0x74, 0x74, 0x6c, 0x12, 0x37, 0x0a, 0x09, 0x78, 0x5f, + 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, + 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, + 0x6e, 0x2e, 0x58, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x08, 0x78, 0x48, 0x65, 0x61, 0x64, + 0x65, 0x72, 0x73, 0x12, 0x44, 0x0a, 0x0d, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x74, + 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, + 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x53, + 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x0c, 0x73, 0x65, 0x73, + 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x3d, 0x0a, 0x0c, 0x62, 0x65, 0x61, + 0x72, 0x65, 0x72, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x1a, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, + 0x42, 0x65, 0x61, 0x72, 0x65, 0x72, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x0b, 0x62, 0x65, 0x61, + 0x72, 0x65, 0x72, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x3c, 0x0a, 0x06, 0x6f, 0x72, 0x69, 0x67, + 0x69, 0x6e, 0x18, 0x07, 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, 0x06, + 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x12, 0x21, 0x0a, 0x0c, 0x6d, 0x61, 0x67, 0x69, 0x63, 0x5f, + 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x08, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0b, 0x6d, 0x61, + 0x67, 0x69, 0x63, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x22, 0x99, 0x02, 0x0a, 0x12, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 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, 0x14, 0x0a, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x04, 0x52, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x12, 0x10, 0x0a, 0x03, 0x74, 0x74, 0x6c, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x03, 0x74, 0x74, 0x6c, 0x12, 0x37, 0x0a, 0x09, 0x78, + 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, + 0x6f, 0x6e, 0x2e, 0x58, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x08, 0x78, 0x48, 0x65, 0x61, + 0x64, 0x65, 0x72, 0x73, 0x12, 0x3d, 0x0a, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x18, 0x05, + 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, 0x06, 0x6f, 0x72, 0x69, + 0x67, 0x69, 0x6e, 0x12, 0x30, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x06, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, + 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, + 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0xab, 0x02, 0x0a, 0x19, 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, 0x12, 0x40, 0x0a, 0x0e, 0x62, 0x6f, 0x64, 0x79, 0x5f, 0x73, 0x69, 0x67, 0x6e, + 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, + 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, + 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x0d, 0x62, 0x6f, 0x64, 0x79, 0x53, 0x69, 0x67, 0x6e, + 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x40, 0x0a, 0x0e, 0x6d, 0x65, 0x74, 0x61, 0x5f, 0x73, 0x69, + 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, + 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, + 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x0d, 0x6d, 0x65, 0x74, 0x61, 0x53, 0x69, + 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x44, 0x0a, 0x10, 0x6f, 0x72, 0x69, 0x67, 0x69, + 0x6e, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, + 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x0f, 0x6f, 0x72, + 0x69, 0x67, 0x69, 0x6e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x44, 0x0a, + 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x18, 0x04, 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, 0x06, 0x6f, 0x72, 0x69, + 0x67, 0x69, 0x6e, 0x22, 0xad, 0x02, 0x0a, 0x1a, 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, 0x12, 0x40, 0x0a, 0x0e, 0x62, 0x6f, 0x64, 0x79, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, + 0x74, 0x75, 0x72, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, + 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, + 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x0d, 0x62, 0x6f, 0x64, 0x79, 0x53, 0x69, 0x67, 0x6e, 0x61, + 0x74, 0x75, 0x72, 0x65, 0x12, 0x40, 0x0a, 0x0e, 0x6d, 0x65, 0x74, 0x61, 0x5f, 0x73, 0x69, 0x67, + 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, + 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x0d, 0x6d, 0x65, 0x74, 0x61, 0x53, 0x69, 0x67, + 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x44, 0x0a, 0x10, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, + 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, + 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x0f, 0x6f, 0x72, 0x69, + 0x67, 0x69, 0x6e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x45, 0x0a, 0x06, + 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x18, 0x04, 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, 0x06, 0x6f, 0x72, 0x69, + 0x67, 0x69, 0x6e, 0x42, 0x64, 0x5a, 0x44, 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, 0x61, 0x70, 0x69, + 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 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, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, } var ( diff --git a/session/types.go b/session/types.go index 5732b29..d2df9c5 100644 --- a/session/types.go +++ b/session/types.go @@ -175,6 +175,7 @@ const ( ObjectVerbDelete ObjectVerbRange ObjectVerbRangeHash + ObjectVerbPatch ) func (c *CreateRequestBody) GetOwnerID() *refs.OwnerID { From 611355510cfafeba0d604be2022b75b74cc9661e Mon Sep 17 00:00:00 2001 From: Anton Nikiforov Date: Mon, 24 Jun 2024 11:22:49 +0300 Subject: [PATCH 1144/1196] [#87] go.mod: Update `google.golang.org/grpc` to `v1.63.2` Signed-off-by: Anton Nikiforov --- go.mod | 13 ++++++------- go.sum | 33 +++++++++++++-------------------- 2 files changed, 19 insertions(+), 27 deletions(-) diff --git a/go.mod b/go.mod index 0315850..e00f012 100644 --- a/go.mod +++ b/go.mod @@ -5,22 +5,21 @@ go 1.20 require ( git.frostfs.info/TrueCloudLab/frostfs-crypto v0.6.0 github.com/stretchr/testify v1.8.3 - golang.org/x/sync v0.2.0 - google.golang.org/grpc v1.55.0 + golang.org/x/sync v0.6.0 + google.golang.org/grpc v1.63.2 google.golang.org/protobuf v1.33.0 ) require ( git.frostfs.info/TrueCloudLab/rfc6979 v0.4.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect - github.com/golang/protobuf v1.5.3 // indirect github.com/kr/pretty v0.1.0 // indirect github.com/mr-tron/base58 v1.2.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - golang.org/x/net v0.10.0 // indirect - golang.org/x/sys v0.8.0 // indirect - golang.org/x/text v0.9.0 // indirect - google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect + golang.org/x/net v0.21.0 // indirect + golang.org/x/sys v0.17.0 // indirect + golang.org/x/text v0.14.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de // indirect gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 56fc5d0..6ce46f7 100644 --- a/go.sum +++ b/go.sum @@ -5,11 +5,7 @@ git.frostfs.info/TrueCloudLab/rfc6979 v0.4.0/go.mod h1:okpbKfVYf/BpejtfFTfhZqFP+ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= -github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= @@ -23,21 +19,18 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= -golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= -golang.org/x/sync v0.2.0 h1:PUR+T4wwASmuSTYdKjYHI5TD22Wy5ogLU5qZCOLxBrI= -golang.org/x/sync v0.2.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= -golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= -golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 h1:KpwkzHKEF7B9Zxg18WzOa7djJ+Ha5DzthMyZYQfEn2A= -google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1/go.mod h1:nKE/iIaLqn2bQwXBg8f1g2Ylh6r5MN5CmZvuzZCgsCU= -google.golang.org/grpc v1.55.0 h1:3Oj82/tFSCeUrRTg/5E/7d/W5A1tj6Ky1ABAuZuv5ag= -google.golang.org/grpc v1.55.0/go.mod h1:iYEXKGkEBhg1PjZQvoYEVPTDkHo1/bjTnfwTeGONTY8= -google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4= +golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= +golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ= +golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= +golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de h1:cZGRis4/ot9uVm639a+rHCUaG0JJHEsdyzSQTMX+suY= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de/go.mod h1:H4O17MA/PE9BsGx3w+a+W2VOLLD1Qf7oJneAoU6WktY= +google.golang.org/grpc v1.63.2 h1:MUeiw1B2maTVZthpU5xvASfTh3LDbxHd6IJ6QQVU+xM= +google.golang.org/grpc v1.63.2/go.mod h1:WAX/8DgncnokcFUldAxq7GeB5DXHDbMF+lLvDomNkRA= google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= From 42e50c963327afecad227f90a1fff787340121af Mon Sep 17 00:00:00 2001 From: Anton Nikiforov Date: Mon, 24 Jun 2024 12:58:37 +0300 Subject: [PATCH 1145/1196] [#87] Makefile: Add target `protoc-install` Signed-off-by: Anton Nikiforov --- Makefile | 34 +++++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 239565b..7789692 100755 --- a/Makefile +++ b/Makefile @@ -2,6 +2,17 @@ SHELL = bash VERSION ?= $(shell git describe --tags --match "v*" --abbrev=8 --dirty --always) +PROTOC_VERSION ?= 27.2 +PROTOC_GEN_GO_VERSION ?= $(shell go list -f '{{.Version}}' -m google.golang.org/protobuf) +PROTOC_OS_VERSION=osx-x86_64 +ifeq ($(shell uname), Linux) + PROTOC_OS_VERSION=linux-x86_64 +endif + +BIN = bin +PROTOBUF_DIR ?= $(abspath $(BIN))/protobuf +PROTOC_DIR ?= $(PROTOBUF_DIR)/protoc-v$(PROTOC_VERSION) +PROTOC_GEN_GO_DIR ?= $(PROTOBUF_DIR)/protoc-gen-go-$(PROTOC_GEN_GO_VERSION) .PHONY: dep fmts fumpt imports protoc test lint version help @@ -32,16 +43,29 @@ fumpt: @echo "⇒ Processing gofumpt check" @gofumpt -l -w . +# Install protoc +protoc-install: + @rm -rf $(PROTOBUF_DIR) + @mkdir -p $(PROTOBUF_DIR) + @echo "⇒ Installing protoc... " + @wget -q -O $(PROTOBUF_DIR)/protoc-$(PROTOC_VERSION).zip 'https://github.com/protocolbuffers/protobuf/releases/download/v$(PROTOC_VERSION)/protoc-$(PROTOC_VERSION)-$(PROTOC_OS_VERSION).zip' + @unzip -q -o $(PROTOBUF_DIR)/protoc-$(PROTOC_VERSION).zip -d $(PROTOC_DIR) + @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) + + # Regenerate code for proto files protoc: - @GOPRIVATE=github.com/TrueCloudLab go mod vendor - # Install specific version for protobuf lib - @go list -f '{{.Path}}/...@{{.Version}}' -m google.golang.org/protobuf | xargs go install -v + @if [ ! -d "$(PROTOC_DIR)" ] || [ ! -d "$(PROTOC_GEN_GO_DIR)" ]; then \ + make protoc-install; \ + fi # Protoc generate - @for f in `find . -type f -name '*.proto' -not -path './vendor/*'`; do \ + @for f in `find . -type f -name '*.proto'`; do \ echo "⇒ Processing $$f "; \ - protoc \ + $(PROTOC_DIR)/bin/protoc \ --proto_path=.:./vendor:/usr/local/include \ + --plugin=protoc-gen-go=$(PROTOC_GEN_GO_DIR)/protoc-gen-go \ --go_out=. --go_opt=paths=source_relative \ --go-grpc_opt=require_unimplemented_servers=false \ --go-grpc_out=. --go-grpc_opt=paths=source_relative $$f; \ From b72aa14bab97f3fd6c12705391b70d0ea03e84b6 Mon Sep 17 00:00:00 2001 From: Anton Nikiforov Date: Mon, 24 Jun 2024 13:50:21 +0300 Subject: [PATCH 1146/1196] [#87] proto: Process files with `protoc` version `27.2` Signed-off-by: Anton Nikiforov --- util/proto/test/test.pb.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/proto/test/test.pb.go b/util/proto/test/test.pb.go index 199fe2f..57f7fb0 100644 --- a/util/proto/test/test.pb.go +++ b/util/proto/test/test.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.33.0 -// protoc v4.25.3 +// protoc v5.27.2 // source: util/proto/test/test.proto package test From 174773454ec41756199666be94b6886bc075cbad Mon Sep 17 00:00:00 2001 From: Anton Nikiforov Date: Mon, 24 Jun 2024 13:53:27 +0300 Subject: [PATCH 1147/1196] [#87] netmap: Regenerate to add `LIKE` operation for `filter` Signed-off-by: Anton Nikiforov --- netmap/grpc/types.pb.go | 49 +++++++++++++++++++++++------------------ 1 file changed, 27 insertions(+), 22 deletions(-) diff --git a/netmap/grpc/types.pb.go b/netmap/grpc/types.pb.go index 8924213..ae1f55f 100644 --- a/netmap/grpc/types.pb.go +++ b/netmap/grpc/types.pb.go @@ -44,21 +44,24 @@ const ( Operation_AND Operation = 8 // Logical negation Operation_NOT Operation = 9 + // Matches pattern + Operation_LIKE Operation = 10 ) // Enum value maps for Operation. var ( Operation_name = map[int32]string{ - 0: "OPERATION_UNSPECIFIED", - 1: "EQ", - 2: "NE", - 3: "GT", - 4: "GE", - 5: "LT", - 6: "LE", - 7: "OR", - 8: "AND", - 9: "NOT", + 0: "OPERATION_UNSPECIFIED", + 1: "EQ", + 2: "NE", + 3: "GT", + 4: "GE", + 5: "LT", + 6: "LE", + 7: "OR", + 8: "AND", + 9: "NOT", + 10: "LIKE", } Operation_value = map[string]int32{ "OPERATION_UNSPECIFIED": 0, @@ -71,6 +74,7 @@ var ( "OR": 7, "AND": 8, "NOT": 9, + "LIKE": 10, } ) @@ -1149,24 +1153,25 @@ var file_netmap_grpc_types_proto_rawDesc = []byte{ 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x0d, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, - 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2a, 0x70, 0x0a, 0x09, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, + 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2a, 0x7a, 0x0a, 0x09, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x19, 0x0a, 0x15, 0x4f, 0x50, 0x45, 0x52, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x06, 0x0a, 0x02, 0x45, 0x51, 0x10, 0x01, 0x12, 0x06, 0x0a, 0x02, 0x4e, 0x45, 0x10, 0x02, 0x12, 0x06, 0x0a, 0x02, 0x47, 0x54, 0x10, 0x03, 0x12, 0x06, 0x0a, 0x02, 0x47, 0x45, 0x10, 0x04, 0x12, 0x06, 0x0a, 0x02, 0x4c, 0x54, 0x10, 0x05, 0x12, 0x06, 0x0a, 0x02, 0x4c, 0x45, 0x10, 0x06, 0x12, 0x06, 0x0a, 0x02, 0x4f, 0x52, 0x10, 0x07, 0x12, 0x07, 0x0a, 0x03, 0x41, 0x4e, 0x44, 0x10, 0x08, 0x12, - 0x07, 0x0a, 0x03, 0x4e, 0x4f, 0x54, 0x10, 0x09, 0x2a, 0x38, 0x0a, 0x06, 0x43, 0x6c, 0x61, 0x75, - 0x73, 0x65, 0x12, 0x16, 0x0a, 0x12, 0x43, 0x4c, 0x41, 0x55, 0x53, 0x45, 0x5f, 0x55, 0x4e, 0x53, - 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x53, 0x41, - 0x4d, 0x45, 0x10, 0x01, 0x12, 0x0c, 0x0a, 0x08, 0x44, 0x49, 0x53, 0x54, 0x49, 0x4e, 0x43, 0x54, - 0x10, 0x02, 0x42, 0x61, 0x5a, 0x42, 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, 0x61, 0x70, 0x69, 0x2d, - 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2f, 0x67, 0x72, 0x70, - 0x63, 0x3b, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0xaa, 0x02, 0x1a, 0x4e, 0x65, 0x6f, 0x2e, 0x46, - 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x4e, - 0x65, 0x74, 0x6d, 0x61, 0x70, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x07, 0x0a, 0x03, 0x4e, 0x4f, 0x54, 0x10, 0x09, 0x12, 0x08, 0x0a, 0x04, 0x4c, 0x49, 0x4b, 0x45, + 0x10, 0x0a, 0x2a, 0x38, 0x0a, 0x06, 0x43, 0x6c, 0x61, 0x75, 0x73, 0x65, 0x12, 0x16, 0x0a, 0x12, + 0x43, 0x4c, 0x41, 0x55, 0x53, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, + 0x45, 0x44, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x53, 0x41, 0x4d, 0x45, 0x10, 0x01, 0x12, 0x0c, + 0x0a, 0x08, 0x44, 0x49, 0x53, 0x54, 0x49, 0x4e, 0x43, 0x54, 0x10, 0x02, 0x42, 0x61, 0x5a, 0x42, + 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, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, + 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x6e, 0x65, 0x74, 0x6d, + 0x61, 0x70, 0xaa, 0x02, 0x1a, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, + 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x4e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( From 35e7397d48d77423a7c53662b3446a3fd1a2e348 Mon Sep 17 00:00:00 2001 From: Anton Nikiforov Date: Mon, 24 Jun 2024 13:55:23 +0300 Subject: [PATCH 1148/1196] [#87] netmap: Extend enum `Operation` Signed-off-by: Anton Nikiforov --- netmap/types.go | 1 + 1 file changed, 1 insertion(+) diff --git a/netmap/types.go b/netmap/types.go index dd5db68..1fcdc6e 100644 --- a/netmap/types.go +++ b/netmap/types.go @@ -111,6 +111,7 @@ const ( OR AND NOT + LIKE ) const ( From 280d052cefa0bb00134fff80fb1c6aed31e7e934 Mon Sep 17 00:00:00 2001 From: Anton Nikiforov Date: Thu, 8 Aug 2024 17:31:58 +0300 Subject: [PATCH 1149/1196] [#101] Remove usage of folder `vendor` Signed-off-by: Anton Nikiforov --- .gitignore | 1 - Makefile | 5 ++--- prepare.sh | 4 ++-- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 354a562..30476bd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,3 @@ .idea bin temp -/vendor/ diff --git a/Makefile b/Makefile index 7789692..30d599d 100755 --- a/Makefile +++ b/Makefile @@ -34,7 +34,7 @@ fmts: fumpt imports # Reformat imports imports: @echo "⇒ Processing goimports check" - @for f in `find . -type f -name '*.go' -not -path './vendor/*' -not -name '*.pb.go' -prune`; do \ + @for f in `find . -type f -name '*.go' -not -name '*.pb.go' -prune`; do \ goimports -w $$f; \ done @@ -64,13 +64,12 @@ protoc: @for f in `find . -type f -name '*.proto'`; do \ echo "⇒ Processing $$f "; \ $(PROTOC_DIR)/bin/protoc \ - --proto_path=.:./vendor:/usr/local/include \ + --proto_path=.:/usr/local/include \ --plugin=protoc-gen-go=$(PROTOC_GEN_GO_DIR)/protoc-gen-go \ --go_out=. --go_opt=paths=source_relative \ --go-grpc_opt=require_unimplemented_servers=false \ --go-grpc_out=. --go-grpc_opt=paths=source_relative $$f; \ done - rm -rf vendor # Run Unit Test with go test test: GOFLAGS ?= "-count=1" diff --git a/prepare.sh b/prepare.sh index 32048b3..4b8b125 100755 --- a/prepare.sh +++ b/prepare.sh @@ -10,7 +10,7 @@ API_PATH=$1 # MOVE FILES FROM API REPO cd "$API_PATH" || exit 1 -ARGS=$(find ./ -name '*.proto' -not -path './vendor/*') +ARGS=$(find ./ -name '*.proto') for file in $ARGS; do dir=$(dirname "$file") mkdir -p "$API_GO_PATH/$dir/grpc" @@ -30,7 +30,7 @@ cd "$API_GO_PATH" || exit 1 make protoc # REMOVE PROTO DEFINITIONS -ARGS=$(find ./$prefix -name '*.proto' -not -path './vendor/*' -not -path './util/*') +ARGS=$(find ./$prefix -name '*.proto' -not -path './util/*') for file in $ARGS; do rm "$file" done From a0a9b765f3a56423b1c6f1fef1d1b413da0e03ef Mon Sep 17 00:00:00 2001 From: Anton Nikiforov Date: Thu, 8 Aug 2024 18:02:30 +0300 Subject: [PATCH 1150/1196] [#101] Fix `make test` Signed-off-by: Anton Nikiforov --- Makefile | 4 ++-- prepare.sh | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 30d599d..db1cc2d 100755 --- a/Makefile +++ b/Makefile @@ -61,10 +61,10 @@ protoc: make protoc-install; \ fi # Protoc generate - @for f in `find . -type f -name '*.proto'`; do \ + @for f in `find . -type f -name '*.proto' -not -path './bin/*'`; do \ echo "⇒ Processing $$f "; \ $(PROTOC_DIR)/bin/protoc \ - --proto_path=.:/usr/local/include \ + --proto_path=.:$(PROTOC_DIR)/include:/usr/local/include \ --plugin=protoc-gen-go=$(PROTOC_GEN_GO_DIR)/protoc-gen-go \ --go_out=. --go_opt=paths=source_relative \ --go-grpc_opt=require_unimplemented_servers=false \ diff --git a/prepare.sh b/prepare.sh index 4b8b125..1d00954 100755 --- a/prepare.sh +++ b/prepare.sh @@ -10,7 +10,7 @@ API_PATH=$1 # MOVE FILES FROM API REPO cd "$API_PATH" || exit 1 -ARGS=$(find ./ -name '*.proto') +ARGS=$(find ./ -name '*.proto' -not -path './bin/*') for file in $ARGS; do dir=$(dirname "$file") mkdir -p "$API_GO_PATH/$dir/grpc" @@ -19,7 +19,7 @@ done # MODIFY FILES cd "$API_GO_PATH" || exit 1 -ARGS2=$(find ./ -name '*.proto') +ARGS2=$(find ./ -name '*.proto' -not -path './bin/*') for file in $ARGS2; do echo "$file" sed -i "s/import\ \"\(.*\)\/\(.*\)\.proto\";/import\ \"\1\/grpc\/\2\.proto\";/" $file @@ -30,7 +30,7 @@ cd "$API_GO_PATH" || exit 1 make protoc # REMOVE PROTO DEFINITIONS -ARGS=$(find ./$prefix -name '*.proto' -not -path './util/*') +ARGS=$(find ./$prefix -name '*.proto' -not -path './util/*' -not -path './bin/*') for file in $ARGS; do rm "$file" done From ff4f31b6f3a977df26b0328afc7604215f1dc86a Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Fri, 9 Aug 2024 10:19:37 +0300 Subject: [PATCH 1151/1196] [#103] protogen: Handle files in all packages Signed-off-by: Evgenii Stratonikov --- util/protogen/main.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/util/protogen/main.go b/util/protogen/main.go index 85c6ded..1a287ba 100644 --- a/util/protogen/main.go +++ b/util/protogen/main.go @@ -16,11 +16,7 @@ var ( func main() { protogen.Options{}.Run(func(gen *protogen.Plugin) error { for _, f := range gen.Files { - //if !f.Generate { - // continue - //} - imp := string(f.GoImportPath) - if strings.HasSuffix(imp, "/tree") || strings.HasSuffix(imp, "/control") { + if f.Generate { generateFile(gen, f) } } From 19247e8941d9f80122746a01a065729a68ec58e7 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Fri, 9 Aug 2024 10:22:13 +0300 Subject: [PATCH 1152/1196] [#103] protogen: Handle uint32 type Signed-off-by: Evgenii Stratonikov --- util/protogen/main.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/util/protogen/main.go b/util/protogen/main.go index 1a287ba..0f2a7ca 100644 --- a/util/protogen/main.go +++ b/util/protogen/main.go @@ -229,7 +229,8 @@ type marshalerDesc struct { var marshalers = map[protoreflect.Kind]marshalerDesc{ protoreflect.BoolKind: {Prefix: "Bool"}, protoreflect.EnumKind: {Prefix: "Enum"}, - // protoreflect.Int32Kind: "", + + protoreflect.Int32Kind: {Prefix: "Int32", RepeatedDouble: true}, // protoreflect.Sint32Kind: "", protoreflect.Uint32Kind: {Prefix: "UInt32", RepeatedDouble: true}, protoreflect.Int64Kind: {Prefix: "Int64", RepeatedDouble: true}, From 47a48969b0676fa35a6d04b0fdd921dbdeccfbc5 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Fri, 9 Aug 2024 10:44:14 +0300 Subject: [PATCH 1153/1196] [#103] proto: Test end-to-end scenario Test the generated code, do not write yet another marshaling routine in tests. Before: ``` ok git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/proto 0.003s coverage: 55.6% of statements ``` After: ``` ok git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/proto 0.003s coverage: 80.0% of statements ``` Signed-off-by: Evgenii Stratonikov --- Makefile | 11 + util/proto/marshal_test.go | 925 ++++------------------------- util/proto/test/test_frostfs.pb.go | 117 ++++ 3 files changed, 255 insertions(+), 798 deletions(-) create mode 100644 util/proto/test/test_frostfs.pb.go diff --git a/Makefile b/Makefile index db1cc2d..19b3138 100755 --- a/Makefile +++ b/Makefile @@ -71,6 +71,17 @@ protoc: --go-grpc_out=. --go-grpc_opt=paths=source_relative $$f; \ done +protogen: + @go build -v -trimpath \ + -o $(BIN)/protogen \ + ./util/protogen + +protoc-test: protoc protogen + @$(PROTOC_DIR)/bin/protoc \ + --plugin=protoc-gen-go-frostfs=$(abspath $(BIN)/protogen) \ + --go-frostfs_out=. --go-frostfs_opt=paths=source_relative \ + ./util/proto/test/test.proto + # Run Unit Test with go test test: GOFLAGS ?= "-count=1" test: diff --git a/util/proto/marshal_test.go b/util/proto/marshal_test.go index c2a0f8e..56d9594 100644 --- a/util/proto/marshal_test.go +++ b/util/proto/marshal_test.go @@ -1,826 +1,155 @@ package proto_test import ( - "encoding/binary" "math" + "math/rand" "testing" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/proto" "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/proto/test" "github.com/stretchr/testify/require" - "google.golang.org/protobuf/encoding/protowire" goproto "google.golang.org/protobuf/proto" ) -type SomeEnum int32 - -type stablePrimitives struct { - FieldA []byte - FieldB string - FieldC bool - FieldD int32 - FieldE uint32 - FieldF int64 - FieldG uint64 - FieldH SomeEnum - FieldI uint64 // fixed64 - FieldJ float64 - FieldK uint32 // fixed32 +type protoInt interface { + ~int32 | ~uint32 | ~int64 | ~uint64 } -type stableRepPrimitives struct { - FieldA [][]byte - FieldB []string - FieldC []int32 - FieldD []uint32 - FieldE []int64 - FieldF []uint64 - - FieldFu []uint64 +func nonZero[T protoInt]() T { + var r T + for r == 0 { + r = T(rand.Uint64()) + } + return r } -const ( - ENUM_UNKNOWN SomeEnum = 0 - ENUM_POSITIVE SomeEnum = 1 - ENUM_NEGATIVE SomeEnum = -1 -) - -func (s *stablePrimitives) stableMarshal(buf []byte, wrongField bool) ([]byte, error) { - if s == nil { - return []byte{}, nil - } - - if buf == nil { - buf = make([]byte, s.stableSize()) - } - - var i, offset, fieldNum int - - fieldNum = 1 - if wrongField { - fieldNum++ - } - i += proto.BytesMarshal(fieldNum, buf, s.FieldA) - - fieldNum = 2 - if wrongField { - fieldNum++ - } - i += proto.StringMarshal(fieldNum, buf, s.FieldB) - - fieldNum = 200 - if wrongField { - fieldNum++ - } - i += proto.BoolMarshal(fieldNum, buf, s.FieldC) - - fieldNum = 201 - if wrongField { - fieldNum++ - } - i += proto.Int32Marshal(fieldNum, buf, s.FieldD) - - fieldNum = 202 - if wrongField { - fieldNum++ - } - i += proto.UInt32Marshal(fieldNum, buf, s.FieldE) - - fieldNum = 203 - if wrongField { - fieldNum++ - } - i += proto.Int64Marshal(fieldNum, buf, s.FieldF) - - fieldNum = 204 - if wrongField { - fieldNum++ - } - i += proto.UInt64Marshal(fieldNum, buf, s.FieldG) - - fieldNum = 205 - if wrongField { - fieldNum++ - } - i += proto.Fixed64Marshal(fieldNum, buf, s.FieldI) - - fieldNum = 206 - if wrongField { - fieldNum++ - } - i += proto.Float64Marshal(fieldNum, buf, s.FieldJ) - - fieldNum = 207 - if wrongField { - fieldNum++ - } - - offset = proto.Fixed32Marshal(fieldNum, buf, s.FieldK) - - i += offset - - fieldNum = 300 - if wrongField { - fieldNum++ - } - i += proto.EnumMarshal(fieldNum, buf, int32(s.FieldH)) - - return buf, nil -} - -func (s *stablePrimitives) stableSize() int { - return proto.BytesSize(1, s.FieldA) + - proto.StringSize(2, s.FieldB) + - proto.BoolSize(200, s.FieldC) + - proto.Int32Size(201, s.FieldD) + - proto.UInt32Size(202, s.FieldE) + - proto.Int64Size(203, s.FieldF) + - proto.UInt64Size(204, s.FieldG) + - proto.Fixed64Size(205, s.FieldI) + - proto.Float64Size(206, s.FieldJ) + - proto.Fixed32Size(207, s.FieldK) + - proto.EnumSize(300, int32(s.FieldH)) -} - -func (s *stableRepPrimitives) stableMarshal(buf []byte, wrongField bool) ([]byte, error) { - if s == nil { - return []byte{}, nil - } - - if buf == nil { - buf = make([]byte, s.stableSize()) - } - - var i, fieldNum int - - fieldNum = 1 - if wrongField { - fieldNum++ - } - i += proto.RepeatedBytesMarshal(fieldNum, buf, s.FieldA) - - fieldNum = 2 - if wrongField { - fieldNum++ - } - i += proto.RepeatedStringMarshal(fieldNum, buf, s.FieldB) - - fieldNum = 3 - if wrongField { - fieldNum++ - } - i += proto.RepeatedInt32Marshal(fieldNum, buf, s.FieldC) - - fieldNum = 4 - if wrongField { - fieldNum++ - } - i += proto.RepeatedUInt32Marshal(fieldNum, buf, s.FieldD) - - fieldNum = 5 - if wrongField { - fieldNum++ - } - i += proto.RepeatedInt64Marshal(fieldNum, buf, s.FieldE) - - fieldNum = 6 - if wrongField { - fieldNum++ - } - i += proto.RepeatedUInt64Marshal(fieldNum, buf, s.FieldF) - - fieldNum = 7 - if wrongField { - fieldNum++ - } - for j := range s.FieldFu { - { - prefix := protowire.EncodeTag( - protowire.Number(fieldNum), - protowire.VarintType) - i += binary.PutUvarint(buf[i:], uint64(prefix)) - i += binary.PutUvarint(buf[i:], s.FieldFu[j]) - } - } - - return buf, nil -} - -func (s *stableRepPrimitives) stableSize() int { - f1 := proto.RepeatedBytesSize(1, s.FieldA) - f2 := proto.RepeatedStringSize(2, s.FieldB) - f3, _ := proto.RepeatedInt32Size(3, s.FieldC) - f4, _ := proto.RepeatedUInt32Size(4, s.FieldD) - f5, _ := proto.RepeatedInt64Size(5, s.FieldE) - f6, _ := proto.RepeatedUInt64Size(6, s.FieldF) - - var f7 int - for i := range s.FieldFu { - f7 += protowire.SizeGroup(protowire.Number(7), protowire.SizeVarint(s.FieldFu[i])) - } - - return f1 + f2 + f3 + f4 + f5 + f6 + f7 -} - -func TestBytesMarshal(t *testing.T) { - t.Run("not empty", func(t *testing.T) { - data := []byte("Hello World") - testBytesMarshal(t, data, false) - testBytesMarshal(t, data, true) - }) - +func TestStableMarshalSingle(t *testing.T) { t.Run("empty", func(t *testing.T) { - testBytesMarshal(t, []byte{}, false) + input := &test.Primitives{} + require.Zero(t, input.StableSize()) + + r := input.StableMarshal(nil) + require.Empty(t, r) }) - t.Run("nil", func(t *testing.T) { - testBytesMarshal(t, nil, false) - }) + marshalCases := []struct { + name string + input *test.Primitives + }{ + {name: "bytes", input: &test.Primitives{FieldA: []byte{1, 2, 3}}}, + {name: "string", input: &test.Primitives{FieldB: "123"}}, + {name: "bool", input: &test.Primitives{FieldC: true}}, + {name: "int32", input: &test.Primitives{FieldD: nonZero[int32]()}}, + {name: "uint32", input: &test.Primitives{FieldE: nonZero[uint32]()}}, + {name: "int64", input: &test.Primitives{FieldF: nonZero[int64]()}}, + {name: "uint64", input: &test.Primitives{FieldG: nonZero[uint64]()}}, + {name: "uint64", input: &test.Primitives{FieldI: nonZero[uint64]()}}, + {name: "float64", input: &test.Primitives{FieldJ: math.Float64frombits(12345677890)}}, + {name: "fixed32", input: &test.Primitives{FieldK: nonZero[uint32]()}}, + {name: "enum, positive", input: &test.Primitives{FieldH: test.Primitives_POSITIVE}}, + {name: "enum, negative", input: &test.Primitives{FieldH: test.Primitives_NEGATIVE}}, + } + for _, tc := range marshalCases { + t.Run(tc.name, func(t *testing.T) { + r := tc.input.StableMarshal(nil) + require.Equal(t, len(r), tc.input.StableSize()) + require.NotEmpty(t, r) + + var actual test.Primitives + require.NoError(t, goproto.Unmarshal(r, &actual)) + + // Compare each field directly, because proto-generated code has private fields. + require.Equal(t, tc.input.FieldA, actual.FieldA) + require.Equal(t, tc.input.FieldB, actual.FieldB) + require.Equal(t, tc.input.FieldC, actual.FieldC) + require.Equal(t, tc.input.FieldD, actual.FieldD) + require.Equal(t, tc.input.FieldE, actual.FieldE) + require.Equal(t, tc.input.FieldF, actual.FieldF) + require.Equal(t, tc.input.FieldG, actual.FieldG) + require.Equal(t, tc.input.FieldI, actual.FieldI) + require.Equal(t, tc.input.FieldJ, actual.FieldJ) + require.Equal(t, tc.input.FieldK, actual.FieldK) + require.Equal(t, tc.input.FieldH, actual.FieldH) + }) + } } -func TestStringMarshal(t *testing.T) { - t.Run("not empty", func(t *testing.T) { - data := "Hello World" - testStringMarshal(t, data, false) - testStringMarshal(t, data, true) - }) +func randIntSlice[T protoInt](n int, includeZero bool) []T { + r := make([]T, n) + if n == 0 { + return r + } + for i := range r { + r[i] = T(rand.Uint64()) + } + if includeZero { + r[0] = 0 + } + return r +} +func TestStableMarshalRep(t *testing.T) { t.Run("empty", func(t *testing.T) { - testStringMarshal(t, "", false) - }) -} - -func TestBoolMarshal(t *testing.T) { - t.Run("true", func(t *testing.T) { - testBoolMarshal(t, true, false) - testBoolMarshal(t, true, true) - }) - - t.Run("false", func(t *testing.T) { - testBoolMarshal(t, false, false) - }) -} - -func TestInt32Marshal(t *testing.T) { - t.Run("zero", func(t *testing.T) { - testInt32Marshal(t, 0, false) - }) - - t.Run("positive", func(t *testing.T) { - testInt32Marshal(t, math.MaxInt32, false) - testInt32Marshal(t, math.MaxInt32, true) - }) - - t.Run("negative", func(t *testing.T) { - testInt32Marshal(t, math.MinInt32, false) - testInt32Marshal(t, math.MinInt32, true) - }) -} - -func TestUInt32Marshal(t *testing.T) { - t.Run("zero", func(t *testing.T) { - testUInt32Marshal(t, 0, false) - }) - - t.Run("non zero", func(t *testing.T) { - testUInt32Marshal(t, math.MaxUint32, false) - testUInt32Marshal(t, math.MaxUint32, true) - }) -} - -func TestInt64Marshal(t *testing.T) { - t.Run("zero", func(t *testing.T) { - testInt32Marshal(t, 0, false) - }) - - t.Run("positive", func(t *testing.T) { - testInt64Marshal(t, math.MaxInt64, false) - testInt64Marshal(t, math.MaxInt64, true) - }) - - t.Run("negative", func(t *testing.T) { - testInt64Marshal(t, math.MinInt64, false) - testInt64Marshal(t, math.MinInt64, true) - }) -} - -func TestUInt64Marshal(t *testing.T) { - t.Run("zero", func(t *testing.T) { - testUInt64Marshal(t, 0, false) - }) - - t.Run("non zero", func(t *testing.T) { - testUInt64Marshal(t, math.MaxUint64, false) - testUInt64Marshal(t, math.MaxUint64, true) - }) -} - -func TestEnumMarshal(t *testing.T) { - testEnumMarshal(t, ENUM_UNKNOWN, false) - testEnumMarshal(t, ENUM_POSITIVE, false) - testEnumMarshal(t, ENUM_POSITIVE, true) - testEnumMarshal(t, ENUM_NEGATIVE, false) - testEnumMarshal(t, ENUM_NEGATIVE, true) -} - -func TestRepeatedBytesMarshal(t *testing.T) { - t.Run("not empty", func(t *testing.T) { - data := [][]byte{[]byte("One"), []byte("Two"), []byte("Three")} - testRepeatedBytesMarshal(t, data, false) - testRepeatedBytesMarshal(t, data, true) - }) - - t.Run("empty", func(t *testing.T) { - testRepeatedBytesMarshal(t, [][]byte{}, false) - }) - - t.Run("empty element", func(t *testing.T) { - testRepeatedBytesMarshal(t, [][]byte{{1}, {}}, false) - }) - - t.Run("nil", func(t *testing.T) { - testRepeatedBytesMarshal(t, nil, false) - }) -} - -func TestRepeatedStringMarshal(t *testing.T) { - t.Run("not empty", func(t *testing.T) { - data := []string{"One", "Two", "Three"} - testRepeatedStringMarshal(t, data, false) - testRepeatedStringMarshal(t, data, true) - }) - - t.Run("empty element", func(t *testing.T) { - testRepeatedStringMarshal(t, []string{""}, false) - }) - - t.Run("empty", func(t *testing.T) { - testRepeatedStringMarshal(t, []string{}, false) - }) - - t.Run("nil", func(t *testing.T) { - testRepeatedStringMarshal(t, nil, false) - }) -} - -func TestRepeatedInt32Marshal(t *testing.T) { - t.Run("not empty", func(t *testing.T) { - data := []int32{-1, 0, 1, 2, 3, 4, 5} - testRepeatedInt32Marshal(t, data, false) - testRepeatedInt32Marshal(t, data, true) - }) - - t.Run("empty", func(t *testing.T) { - testRepeatedInt32Marshal(t, []int32{}, false) - }) - - t.Run("nil", func(t *testing.T) { - testRepeatedInt32Marshal(t, nil, false) - }) -} - -func TestRepeatedUInt32Marshal(t *testing.T) { - t.Run("not empty", func(t *testing.T) { - data := []uint32{0, 1, 2, 3, 4, 5} - testRepeatedUInt32Marshal(t, data, false) - testRepeatedUInt32Marshal(t, data, true) - }) - - t.Run("empty", func(t *testing.T) { - testRepeatedUInt32Marshal(t, []uint32{}, false) - }) - - t.Run("nil", func(t *testing.T) { - testRepeatedUInt32Marshal(t, nil, false) - }) -} - -func TestRepeatedInt64Marshal(t *testing.T) { - t.Run("not empty", func(t *testing.T) { - data := []int64{-1, 0, 1, 2, 3, 4, 5} - testRepeatedInt64Marshal(t, data, false) - testRepeatedInt64Marshal(t, data, true) - }) - - t.Run("empty", func(t *testing.T) { - testRepeatedInt64Marshal(t, []int64{}, false) - }) - - t.Run("nil", func(t *testing.T) { - testRepeatedInt64Marshal(t, nil, false) - }) -} - -func TestRepeatedUInt64Marshal(t *testing.T) { - t.Run("not empty", func(t *testing.T) { - data := []uint64{0, 1, 2, 3, 4, 5} - testRepeatedUInt64Marshal(t, data, false) - testRepeatedUInt64Marshal(t, data, true) - }) - - t.Run("empty", func(t *testing.T) { - testRepeatedUInt64Marshal(t, []uint64{}, false) - }) - - t.Run("nil", func(t *testing.T) { - testRepeatedUInt64Marshal(t, nil, false) - }) -} - -func TestRepeatedUInt64MarshalUnpacked(t *testing.T) { - t.Run("not empty", func(t *testing.T) { - data := []uint64{0, 1, 2, 3, 4, 5} - testRepeatedUInt64MarshalUnpacked(t, data, false) - testRepeatedUInt64MarshalUnpacked(t, data, true) - }) - - t.Run("empty", func(t *testing.T) { - testRepeatedUInt64MarshalUnpacked(t, []uint64{}, false) - }) - - t.Run("nil", func(t *testing.T) { - testRepeatedUInt64MarshalUnpacked(t, nil, false) - }) -} - -func TestFixed64Marshal(t *testing.T) { - t.Run("zero", func(t *testing.T) { - testFixed64Marshal(t, 0, false) - }) - - t.Run("non zero", func(t *testing.T) { - testFixed64Marshal(t, math.MaxUint64, false) - testFixed64Marshal(t, math.MaxUint64, true) - }) -} - -func TestFloat64Marshal(t *testing.T) { - t.Run("zero", func(t *testing.T) { - testFloat64Marshal(t, 0, false) - }) - - t.Run("non zero", func(t *testing.T) { - f := math.Float64frombits(12345677890) - - testFloat64Marshal(t, f, false) - testFloat64Marshal(t, f, true) - }) -} - -func TestFixed32Marshal(t *testing.T) { - t.Run("zero", func(t *testing.T) { - testFixed32Marshal(t, 0, false) - }) - - t.Run("non zero", func(t *testing.T) { - testFixed32Marshal(t, math.MaxUint32, false) - testFixed32Marshal(t, math.MaxUint32, true) - }) -} - -func testMarshal(t *testing.T, c stablePrimitives, tr *test.Primitives, wrongField bool) *test.Primitives { - var ( - wire []byte - err error - ) - wire, err = c.stableMarshal(nil, wrongField) - require.NoError(t, err) - - wireGen, err := goproto.Marshal(tr) - require.NoError(t, err) - - if !wrongField { - // we can check equality because single field cannot be unstable marshalled - require.Equal(t, wireGen, wire) - } else { - require.NotEqual(t, wireGen, wire) - } - - result := new(test.Primitives) - err = goproto.Unmarshal(wire, result) - require.NoError(t, err) - - return result -} - -func testBytesMarshal(t *testing.T, data []byte, wrongField bool) { - var ( - custom = stablePrimitives{FieldA: data} - transport = test.Primitives{FieldA: data} - ) - - result := testMarshal(t, custom, &transport, wrongField) - - if !wrongField { - require.Len(t, result.FieldA, len(data)) - if len(data) > 0 { - require.Equal(t, data, result.FieldA) + marshalCases := []struct { + name string + input *test.RepPrimitives + }{ + {name: "default", input: &test.RepPrimitives{}}, + {name: "bytes", input: &test.RepPrimitives{FieldA: [][]byte{}}}, + {name: "string", input: &test.RepPrimitives{FieldB: []string{}}}, + {name: "int32", input: &test.RepPrimitives{FieldC: []int32{}}}, + {name: "uint32", input: &test.RepPrimitives{FieldD: []uint32{}}}, + {name: "int64", input: &test.RepPrimitives{FieldE: []int64{}}}, + {name: "uint64", input: &test.RepPrimitives{FieldF: []uint64{}}}, + {name: "uint64", input: &test.RepPrimitives{FieldFu: []uint64{}}}, } - } else { - require.Len(t, result.FieldA, 0) - } -} -func testStringMarshal(t *testing.T, s string, wrongField bool) { - var ( - custom = stablePrimitives{FieldB: s} - transport = test.Primitives{FieldB: s} - ) + for _, tc := range marshalCases { + require.Zero(t, tc.input.StableSize()) - result := testMarshal(t, custom, &transport, wrongField) - - if !wrongField { - require.Len(t, result.FieldB, len(s)) - if len(s) > 0 { - require.Equal(t, s, result.FieldB) + r := tc.input.StableMarshal(nil) + require.Empty(t, r) } - } else { - require.Len(t, result.FieldB, 0) - } -} - -func testBoolMarshal(t *testing.T, b bool, wrongField bool) { - var ( - custom = stablePrimitives{FieldC: b} - transport = test.Primitives{FieldC: b} - ) - - result := testMarshal(t, custom, &transport, wrongField) - - if !wrongField { - require.Equal(t, b, result.FieldC) - } else { - require.False(t, false, result.FieldC) - } -} - -func testInt32Marshal(t *testing.T, n int32, wrongField bool) { - var ( - custom = stablePrimitives{FieldD: n} - transport = test.Primitives{FieldD: n} - ) - - result := testMarshal(t, custom, &transport, wrongField) - - if !wrongField { - require.Equal(t, n, result.FieldD) - } else { - require.EqualValues(t, 0, result.FieldD) - } -} - -func testUInt32Marshal(t *testing.T, n uint32, wrongField bool) { - var ( - custom = stablePrimitives{FieldE: n} - transport = test.Primitives{FieldE: n} - ) - - result := testMarshal(t, custom, &transport, wrongField) - - if !wrongField { - require.Equal(t, n, result.FieldE) - } else { - require.EqualValues(t, 0, result.FieldE) - } -} - -func testInt64Marshal(t *testing.T, n int64, wrongField bool) { - var ( - custom = stablePrimitives{FieldF: n} - transport = test.Primitives{FieldF: n} - ) - - result := testMarshal(t, custom, &transport, wrongField) - - if !wrongField { - require.Equal(t, n, result.FieldF) - } else { - require.EqualValues(t, 0, result.FieldF) - } -} - -func testUInt64Marshal(t *testing.T, n uint64, wrongField bool) { - var ( - custom = stablePrimitives{FieldG: n} - transport = test.Primitives{FieldG: n} - ) - - result := testMarshal(t, custom, &transport, wrongField) - - if !wrongField { - require.Equal(t, n, result.FieldG) - } else { - require.EqualValues(t, 0, result.FieldG) - } -} - -func testFloat64Marshal(t *testing.T, n float64, wrongField bool) { - var ( - custom = stablePrimitives{FieldJ: n} - transport = test.Primitives{FieldJ: n} - ) - - result := testMarshal(t, custom, &transport, wrongField) - - if !wrongField { - require.Equal(t, n, result.FieldJ) - } else { - require.EqualValues(t, 0, result.FieldJ) - } -} - -func testEnumMarshal(t *testing.T, e SomeEnum, wrongField bool) { - var ( - custom = stablePrimitives{FieldH: e} - transport = test.Primitives{FieldH: test.Primitives_SomeEnum(e)} - ) - - result := testMarshal(t, custom, &transport, wrongField) - - if !wrongField { - require.EqualValues(t, custom.FieldH, result.FieldH) - } else { - require.EqualValues(t, 0, result.FieldH) - } -} - -func testRepMarshal(t *testing.T, c stableRepPrimitives, tr *test.RepPrimitives, wrongField bool) *test.RepPrimitives { - var ( - wire []byte - err error - ) - wire, err = c.stableMarshal(nil, wrongField) - require.NoError(t, err) - - wireGen, err := goproto.Marshal(tr) - require.NoError(t, err) - - if !wrongField { - // we can check equality because single field cannot be unstable marshalled - require.Equal(t, wireGen, wire) - } else { - require.NotEqual(t, wireGen, wire) - } - - result := new(test.RepPrimitives) - err = goproto.Unmarshal(wire, result) - require.NoError(t, err) - - return result -} - -func testRepeatedBytesMarshal(t *testing.T, data [][]byte, wrongField bool) { - var ( - custom = stableRepPrimitives{FieldA: data} - transport = test.RepPrimitives{FieldA: data} - ) - - result := testRepMarshal(t, custom, &transport, wrongField) - - if !wrongField { - require.Len(t, result.FieldA, len(data)) - if len(data) > 0 { - require.Equal(t, data, result.FieldA) - } - } else { - require.Len(t, result.FieldA, 0) - } -} - -func testRepeatedStringMarshal(t *testing.T, s []string, wrongField bool) { - var ( - custom = stableRepPrimitives{FieldB: s} - transport = test.RepPrimitives{FieldB: s} - ) - - result := testRepMarshal(t, custom, &transport, wrongField) - - if !wrongField { - require.Len(t, result.FieldB, len(s)) - if len(s) > 0 { - require.Equal(t, s, result.FieldB) - } - } else { - require.Len(t, result.FieldB, 0) - } -} - -func testRepeatedInt32Marshal(t *testing.T, n []int32, wrongField bool) { - var ( - custom = stableRepPrimitives{FieldC: n} - transport = test.RepPrimitives{FieldC: n} - ) - - result := testRepMarshal(t, custom, &transport, wrongField) - - if !wrongField { - require.Len(t, result.FieldC, len(n)) - if len(n) > 0 { - require.Equal(t, n, result.FieldC) - } - } else { - require.Len(t, result.FieldC, 0) - } -} - -func testRepeatedUInt32Marshal(t *testing.T, n []uint32, wrongField bool) { - var ( - custom = stableRepPrimitives{FieldD: n} - transport = test.RepPrimitives{FieldD: n} - ) - - result := testRepMarshal(t, custom, &transport, wrongField) - - if !wrongField { - require.Len(t, result.FieldD, len(n)) - if len(n) > 0 { - require.Equal(t, n, result.FieldD) - } - } else { - require.Len(t, result.FieldD, 0) - } -} - -func testRepeatedInt64Marshal(t *testing.T, n []int64, wrongField bool) { - var ( - custom = stableRepPrimitives{FieldE: n} - transport = test.RepPrimitives{FieldE: n} - ) - - result := testRepMarshal(t, custom, &transport, wrongField) - - if !wrongField { - require.Len(t, result.FieldE, len(n)) - if len(n) > 0 { - require.Equal(t, n, result.FieldE) - } - } else { - require.Len(t, result.FieldE, 0) - } -} - -func testRepeatedUInt64Marshal(t *testing.T, n []uint64, wrongField bool) { - var ( - custom = stableRepPrimitives{FieldF: n} - transport = test.RepPrimitives{FieldF: n} - ) - - result := testRepMarshal(t, custom, &transport, wrongField) - - if !wrongField { - require.Len(t, result.FieldF, len(n)) - if len(n) > 0 { - require.Equal(t, n, result.FieldF) - } - } else { - require.Len(t, result.FieldF, 0) - } -} - -func testRepeatedUInt64MarshalUnpacked(t *testing.T, n []uint64, wrongField bool) { - var ( - custom = stableRepPrimitives{FieldFu: n} - transport = test.RepPrimitives{FieldFu: n} - ) - - result := testRepMarshal(t, custom, &transport, wrongField) - - if !wrongField { - require.Len(t, result.FieldFu, len(n)) - if len(n) > 0 { - require.Equal(t, n, result.FieldFu) - } - } else { - require.Len(t, result.FieldFu, 0) - } -} - -func testFixed64Marshal(t *testing.T, n uint64, wrongField bool) { - var ( - custom = stablePrimitives{FieldI: n} - transport = test.Primitives{FieldI: n} - ) - - result := testMarshal(t, custom, &transport, wrongField) - - if !wrongField { - require.Equal(t, n, result.FieldI) - } else { - require.EqualValues(t, 0, result.FieldI) - } -} - -func testFixed32Marshal(t *testing.T, n uint32, wrongField bool) { - var ( - custom = stablePrimitives{FieldK: n} - transport = test.Primitives{FieldK: n} - ) - - result := testMarshal(t, custom, &transport, wrongField) - - if !wrongField { - require.Equal(t, n, result.FieldK) - } else { - require.EqualValues(t, 0, result.FieldK) + }) + + marshalCases := []struct { + name string + input *test.RepPrimitives + }{ + {name: "bytes", input: &test.RepPrimitives{FieldA: [][]byte{{1, 2, 3}}}}, + {name: "string", input: &test.RepPrimitives{FieldB: []string{"123"}}}, + {name: "int32", input: &test.RepPrimitives{FieldC: randIntSlice[int32](1, true)}}, + {name: "int32", input: &test.RepPrimitives{FieldC: randIntSlice[int32](2, true)}}, + {name: "int32", input: &test.RepPrimitives{FieldC: randIntSlice[int32](2, false)}}, + {name: "uint32", input: &test.RepPrimitives{FieldD: randIntSlice[uint32](1, true)}}, + {name: "uint32", input: &test.RepPrimitives{FieldD: randIntSlice[uint32](2, true)}}, + {name: "uint32", input: &test.RepPrimitives{FieldD: randIntSlice[uint32](2, false)}}, + {name: "int64", input: &test.RepPrimitives{FieldE: randIntSlice[int64](1, true)}}, + {name: "int64", input: &test.RepPrimitives{FieldE: randIntSlice[int64](2, true)}}, + {name: "int64", input: &test.RepPrimitives{FieldE: randIntSlice[int64](2, false)}}, + {name: "uint64", input: &test.RepPrimitives{FieldF: randIntSlice[uint64](1, true)}}, + {name: "uint64", input: &test.RepPrimitives{FieldF: randIntSlice[uint64](2, true)}}, + {name: "uint64", input: &test.RepPrimitives{FieldF: randIntSlice[uint64](2, false)}}, + {name: "uint64", input: &test.RepPrimitives{FieldFu: randIntSlice[uint64](1, true)}}, + {name: "uint64", input: &test.RepPrimitives{FieldFu: randIntSlice[uint64](2, true)}}, + {name: "uint64", input: &test.RepPrimitives{FieldFu: randIntSlice[uint64](2, false)}}, + } + for _, tc := range marshalCases { + t.Run(tc.name, func(t *testing.T) { + r := tc.input.StableMarshal(nil) + require.Equal(t, len(r), tc.input.StableSize()) + require.NotEmpty(t, r) + + var actual test.RepPrimitives + require.NoError(t, goproto.Unmarshal(r, &actual)) + + // Compare each field directly, because proto-generated code has private fields. + require.Equal(t, tc.input.FieldA, actual.FieldA) + require.Equal(t, tc.input.FieldB, actual.FieldB) + require.Equal(t, tc.input.FieldC, actual.FieldC) + require.Equal(t, tc.input.FieldD, actual.FieldD) + require.Equal(t, tc.input.FieldE, actual.FieldE) + require.Equal(t, tc.input.FieldF, actual.FieldF) + require.Equal(t, tc.input.FieldFu, actual.FieldFu) + }) } } diff --git a/util/proto/test/test_frostfs.pb.go b/util/proto/test/test_frostfs.pb.go new file mode 100644 index 0000000..47c6d60 --- /dev/null +++ b/util/proto/test/test_frostfs.pb.go @@ -0,0 +1,117 @@ +// Code generated by protoc-gen-go-frostfs. DO NOT EDIT. + +package test + +import ( + binary "encoding/binary" + protowire "google.golang.org/protobuf/encoding/protowire" +) + +import "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/proto" + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *Primitives) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.BytesSize(1, x.FieldA) + size += proto.StringSize(2, x.FieldB) + size += proto.BoolSize(200, x.FieldC) + size += proto.Int32Size(201, x.FieldD) + size += proto.UInt32Size(202, x.FieldE) + size += proto.Int64Size(203, x.FieldF) + size += proto.UInt64Size(204, x.FieldG) + size += proto.Fixed64Size(205, x.FieldI) + size += proto.Float64Size(206, x.FieldJ) + size += proto.Fixed32Size(207, x.FieldK) + size += proto.EnumSize(300, int32(x.FieldH)) + return size +} + +// StableMarshal marshals x in protobuf binary format with stable field order. +// +// If buffer length is less than x.StableSize(), 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 binary format. +func (x *Primitives) StableMarshal(buf []byte) []byte { + if x == nil { + return []byte{} + } + if buf == nil { + buf = make([]byte, x.StableSize()) + } + var offset int + offset += proto.BytesMarshal(1, buf[offset:], x.FieldA) + offset += proto.StringMarshal(2, buf[offset:], x.FieldB) + offset += proto.BoolMarshal(200, buf[offset:], x.FieldC) + offset += proto.Int32Marshal(201, buf[offset:], x.FieldD) + offset += proto.UInt32Marshal(202, buf[offset:], x.FieldE) + offset += proto.Int64Marshal(203, buf[offset:], x.FieldF) + offset += proto.UInt64Marshal(204, buf[offset:], x.FieldG) + offset += proto.Fixed64Marshal(205, buf[offset:], x.FieldI) + offset += proto.Float64Marshal(206, buf[offset:], x.FieldJ) + offset += proto.Fixed32Marshal(207, buf[offset:], x.FieldK) + offset += proto.EnumMarshal(300, buf[offset:], int32(x.FieldH)) + return buf +} + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *RepPrimitives) StableSize() (size int) { + if x == nil { + return 0 + } + var n int + size += proto.RepeatedBytesSize(1, x.FieldA) + size += proto.RepeatedStringSize(2, x.FieldB) + n, _ = proto.RepeatedInt32Size(3, x.FieldC) + size += n + n, _ = proto.RepeatedUInt32Size(4, x.FieldD) + size += n + n, _ = proto.RepeatedInt64Size(5, x.FieldE) + size += n + n, _ = proto.RepeatedUInt64Size(6, x.FieldF) + size += n + for i := range x.FieldFu { + size += protowire.SizeGroup(protowire.Number(7), protowire.SizeVarint(x.FieldFu[i])) + } + return size +} + +// StableMarshal marshals x in protobuf binary format with stable field order. +// +// If buffer length is less than x.StableSize(), 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 binary format. +func (x *RepPrimitives) StableMarshal(buf []byte) []byte { + if x == nil { + return []byte{} + } + if buf == nil { + buf = make([]byte, x.StableSize()) + } + var offset int + offset += proto.RepeatedBytesMarshal(1, buf[offset:], x.FieldA) + offset += proto.RepeatedStringMarshal(2, buf[offset:], x.FieldB) + offset += proto.RepeatedInt32Marshal(3, buf[offset:], x.FieldC) + offset += proto.RepeatedUInt32Marshal(4, buf[offset:], x.FieldD) + offset += proto.RepeatedInt64Marshal(5, buf[offset:], x.FieldE) + offset += proto.RepeatedUInt64Marshal(6, buf[offset:], x.FieldF) + for i := range x.FieldFu { + { + prefix := protowire.EncodeTag(protowire.Number(7), protowire.VarintType) + offset += binary.PutUvarint(buf[offset:], uint64(prefix)) + offset += binary.PutUvarint(buf[offset:], x.FieldFu[i]) + } + } + return buf +} From d112a28d382f6e6a10a2aa24190c857f70cf8984 Mon Sep 17 00:00:00 2001 From: Airat Arifullin Date: Tue, 13 Aug 2024 18:50:51 +0300 Subject: [PATCH 1154/1196] [#104] object: Add getters for `PatchRequestBodyPatch` Signed-off-by: Airat Arifullin --- object/convert.go | 4 ++-- object/marshal.go | 8 ++++---- object/types.go | 16 ++++++++++++++++ 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/object/convert.go b/object/convert.go index 5c9e20a..9814b58 100644 --- a/object/convert.go +++ b/object/convert.go @@ -2352,8 +2352,8 @@ func (r *PatchRequestBodyPatch) ToGRPCMessage() grpc.Message { if r != nil { m = new(object.PatchRequest_Body_Patch) - m.SetSourceRange(r.Range.ToGRPCMessage().(*object.Range)) - m.SetChunk(r.Chunk) + m.SetSourceRange(r.GetRange().ToGRPCMessage().(*object.Range)) + m.SetChunk(r.GetChunk()) } return m diff --git a/object/marshal.go b/object/marshal.go index f337502..166b523 100644 --- a/object/marshal.go +++ b/object/marshal.go @@ -1335,8 +1335,8 @@ func (r *PatchRequestBodyPatch) StableMarshal(buf []byte) []byte { } var offset int - offset += proto.NestedStructureMarshal(patchRequestBodyPatchRangeField, buf[offset:], r.Range) - proto.BytesMarshal(patchRequestBodyPatchChunkField, buf[offset:], r.Chunk) + offset += proto.NestedStructureMarshal(patchRequestBodyPatchRangeField, buf[offset:], r.GetRange()) + proto.BytesMarshal(patchRequestBodyPatchChunkField, buf[offset:], r.GetChunk()) return buf } @@ -1347,8 +1347,8 @@ func (r *PatchRequestBodyPatch) StableSize() int { } var size int - size += proto.NestedStructureSize(patchRequestBodyPatchRangeField, r.Range) - size += proto.BytesSize(patchRequestBodyPatchChunkField, r.Chunk) + size += proto.NestedStructureSize(patchRequestBodyPatchRangeField, r.GetRange()) + size += proto.BytesSize(patchRequestBodyPatchChunkField, r.GetChunk()) return size } diff --git a/object/types.go b/object/types.go index c1a8b87..160e820 100644 --- a/object/types.go +++ b/object/types.go @@ -1615,6 +1615,22 @@ func (r *PatchResponse) SetBody(v *PatchResponseBody) { r.Body = v } +func (r *PatchRequestBodyPatch) GetChunk() []byte { + if r != nil { + return r.Chunk + } + + return nil +} + +func (r *PatchRequestBodyPatch) GetRange() *Range { + if r != nil { + return r.Range + } + + return nil +} + func (s *ECInfo) getObjectPart() {} func (s *ECInfo) getHeaderPart() {} From a28ceb251a433869e56110070cbc484295afff3a Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Fri, 9 Aug 2024 17:20:07 +0300 Subject: [PATCH 1155/1196] [#77] util/proto: Optimize int32 marshaling This is the approach used in easyproto https://github.com/VictoriaMetrics/easyproto/blob/52d3ac47440b52fd42bf4bbb5bacb358a85fccc3/writer.go#L203 It allows to occupy slightly less space for negative numbers. The format is still protobuf, although, technically, this is a breaking change for our stable marshaling format. However, we don't use int32 at all and all enums have positive values, so nothing is broken. Signed-off-by: Evgenii Stratonikov --- util/proto/marshal.go | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/util/proto/marshal.go b/util/proto/marshal.go index 26b3eb0..42c6a91 100644 --- a/util/proto/marshal.go +++ b/util/proto/marshal.go @@ -136,19 +136,19 @@ func UInt32Size(field int, v uint32) int { } func Int32Marshal(field int, buf []byte, v int32) int { - return UInt64Marshal(field, buf, uint64(v)) + return UInt64Marshal(field, buf, uint64(uint32(v))) } func Int32Size(field int, v int32) int { - return UInt64Size(field, uint64(v)) + return UInt64Size(field, uint64(uint32(v))) } func EnumMarshal(field int, buf []byte, v int32) int { - return UInt64Marshal(field, buf, uint64(v)) + return UInt64Marshal(field, buf, uint64(uint32(v))) } func EnumSize(field int, v int32) int { - return UInt64Size(field, uint64(v)) + return UInt64Size(field, uint64(uint32(v))) } func RepeatedBytesMarshal(field int, buf []byte, v [][]byte) int { @@ -243,11 +243,28 @@ func RepeatedUInt32Size(field int, v []uint32) (size, arraySize int) { } func RepeatedInt32Marshal(field int, buf []byte, v []int32) int { - return repeatedUIntMarshal(field, buf, v) + if len(v) == 0 { + return 0 + } + + prefix := protowire.EncodeTag(protowire.Number(field), protowire.BytesType) + offset := binary.PutUvarint(buf, uint64(prefix)) + _, arrSize := RepeatedInt32Size(field, v) + offset += binary.PutUvarint(buf[offset:], uint64(arrSize)) + for i := range v { + offset += binary.PutUvarint(buf[offset:], uint64(uint32(v[i]))) + } + return offset } func RepeatedInt32Size(field int, v []int32) (size, arraySize int) { - return repeatedUIntSize(field, v) + if len(v) == 0 { + return 0, 0 + } + for i := range v { + arraySize += protowire.SizeVarint(uint64(uint32(v[i]))) + } + return protowire.SizeGroup(protowire.Number(field), protowire.SizeBytes(arraySize)), arraySize } // VarUIntSize returns length of varint byte sequence for uint64 value 'x'. From adb7c602d7e5762bd385cb0282dec3b323de25ac Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Thu, 25 Apr 2024 15:13:10 +0300 Subject: [PATCH 1156/1196] [#77] protogen: Initial implementation Signed-off-by: Evgenii Stratonikov --- Makefile | 11 +- accounting/grpc/service.go | 46 - accounting/grpc/service.pb.go | 451 - accounting/grpc/service_frostfs.pb.go | 724 ++ accounting/grpc/service_frostfs_fuzz.go | 45 + accounting/grpc/service_frostfs_test.go | 31 + accounting/grpc/types.go | 11 - accounting/grpc/types.pb.go | 169 - accounting/grpc/types_frostfs.pb.go | 174 + accounting/grpc/types_frostfs_fuzz.go | 26 + accounting/grpc/types_frostfs_test.go | 21 + acl/convert.go | 2 +- acl/grpc/types.go | 193 - acl/grpc/types.pb.go | 1231 --- acl/grpc/types_frostfs.pb.go | 1994 ++++ acl/grpc/types_frostfs_fuzz.go | 64 + acl/grpc/types_frostfs_test.go | 41 + ape/grpc/types.go | 21 - ape/grpc/types.pb.go | 310 - ape/grpc/types_frostfs.pb.go | 400 + ape/grpc/types_frostfs_fuzz.go | 45 + ape/grpc/types_frostfs_test.go | 31 + apemanager/grpc/service.go | 106 - apemanager/grpc/service.pb.go | 1129 --- apemanager/grpc/service_frostfs.pb.go | 2183 +++++ apemanager/grpc/service_frostfs_fuzz.go | 121 + apemanager/grpc/service_frostfs_test.go | 71 + container/grpc/service.go | 234 - container/grpc/service.pb.go | 1909 ---- container/grpc/service_frostfs.pb.go | 3748 +++++++ container/grpc/service_frostfs_fuzz.go | 197 + container/grpc/service_frostfs_test.go | 111 + container/grpc/types.go | 46 - container/grpc/types.pb.go | 337 - container/grpc/types_frostfs.pb.go | 495 + container/grpc/types_frostfs_fuzz.go | 26 + container/grpc/types_frostfs_test.go | 21 + go.mod | 3 + go.sum | 6 + lock/grpc/types.go | 8 - lock/grpc/types.pb.go | 160 - lock/grpc/types_frostfs.pb.go | 167 + lock/grpc/types_frostfs_fuzz.go | 26 + lock/grpc/types_frostfs_test.go | 21 + netmap/grpc/service.go | 116 - netmap/grpc/service.pb.go | 1108 --- netmap/grpc/service_frostfs.pb.go | 2061 ++++ netmap/grpc/service_frostfs_fuzz.go | 121 + netmap/grpc/service_frostfs_test.go | 71 + netmap/grpc/types.go | 212 - netmap/grpc/types.pb.go | 1371 --- netmap/grpc/types_frostfs.pb.go | 2453 +++++ netmap/grpc/types_frostfs_fuzz.go | 159 + netmap/grpc/types_frostfs_test.go | 91 + object/convert.go | 2 +- object/grpc/service.go | 610 -- object/grpc/service.pb.go | 4244 -------- object/grpc/service_frostfs.pb.go | 8690 +++++++++++++++++ object/grpc/service_frostfs_fuzz.go | 387 + object/grpc/service_frostfs_test.go | 211 + object/grpc/service_grpc.pb.go | 4 +- object/grpc/status.pb.go | 251 - object/grpc/types.go | 197 - object/grpc/types.pb.go | 1373 --- object/grpc/types_frostfs.pb.go | 2621 +++++ object/grpc/types_frostfs_fuzz.go | 102 + object/grpc/types_frostfs_test.go | 61 + refs/grpc/types.go | 97 - refs/grpc/types.pb.go | 852 -- refs/grpc/types_frostfs.pb.go | 1343 +++ refs/grpc/types_frostfs_fuzz.go | 159 + refs/grpc/types_frostfs_test.go | 91 + rpc/client/client.go | 2 + rpc/message/encoding.go | 20 +- rpc/netmap.go | 1 - session/convert.go | 2 +- session/grpc/service.go | 55 - session/grpc/service.pb.go | 458 - session/grpc/service_frostfs.pb.go | 781 ++ session/grpc/service_frostfs_fuzz.go | 45 + session/grpc/service_frostfs_test.go | 31 + session/grpc/types.go | 246 - session/grpc/types.pb.go | 1451 --- session/grpc/types_frostfs.pb.go | 2730 ++++++ session/grpc/types_frostfs_fuzz.go | 159 + session/grpc/types_frostfs_test.go | 91 + status/grpc/types.go | 26 - status/grpc/types.pb.go | 721 -- status/grpc/types_frostfs.pb.go | 643 ++ status/grpc/types_frostfs_fuzz.go | 26 + status/grpc/types_frostfs_test.go | 21 + tombstone/grpc/types.go | 20 - tombstone/grpc/types.pb.go | 187 - tombstone/grpc/types_frostfs.pb.go | 229 + tombstone/grpc/types_frostfs_fuzz.go | 26 + tombstone/grpc/types_frostfs_test.go | 21 + util/pool/marshal.go | 7 + util/proto/encoding/compat.go | 22 + util/proto/encoding/json.go | 48 + util/proto/encoding/proto.go | 57 + util/proto/marshal.go | 13 +- util/proto/marshal_test.go | 103 +- util/proto/test/custom/test_frostfs.pb.go | 926 ++ util/proto/test/test_frostfs.pb.go | 117 - util/protogen/internalgengo/file.go | 250 + util/protogen/internalgengo/fuzz.go | 69 + util/protogen/internalgengo/getter.go | 14 + util/protogen/internalgengo/json.go | 230 + util/protogen/internalgengo/options.go | 7 + util/protogen/internalgengo/proto.go | 201 + .../internalgengo/proto_field_type.go | 56 + .../internalgengo/proto_stable_compat.go | 124 + util/protogen/internalgengo/writer.go | 30 + util/protogen/main.go | 265 +- util/signature/data.go | 18 +- 115 files changed, 36376 insertions(+), 20397 deletions(-) delete mode 100644 accounting/grpc/service.go delete mode 100644 accounting/grpc/service.pb.go create mode 100644 accounting/grpc/service_frostfs.pb.go create mode 100644 accounting/grpc/service_frostfs_fuzz.go create mode 100644 accounting/grpc/service_frostfs_test.go delete mode 100644 accounting/grpc/types.go delete mode 100644 accounting/grpc/types.pb.go create mode 100644 accounting/grpc/types_frostfs.pb.go create mode 100644 accounting/grpc/types_frostfs_fuzz.go create mode 100644 accounting/grpc/types_frostfs_test.go delete mode 100644 acl/grpc/types.go delete mode 100644 acl/grpc/types.pb.go create mode 100644 acl/grpc/types_frostfs.pb.go create mode 100644 acl/grpc/types_frostfs_fuzz.go create mode 100644 acl/grpc/types_frostfs_test.go delete mode 100644 ape/grpc/types.go delete mode 100644 ape/grpc/types.pb.go create mode 100644 ape/grpc/types_frostfs.pb.go create mode 100644 ape/grpc/types_frostfs_fuzz.go create mode 100644 ape/grpc/types_frostfs_test.go delete mode 100644 apemanager/grpc/service.go delete mode 100644 apemanager/grpc/service.pb.go create mode 100644 apemanager/grpc/service_frostfs.pb.go create mode 100644 apemanager/grpc/service_frostfs_fuzz.go create mode 100644 apemanager/grpc/service_frostfs_test.go delete mode 100644 container/grpc/service.go delete mode 100644 container/grpc/service.pb.go create mode 100644 container/grpc/service_frostfs.pb.go create mode 100644 container/grpc/service_frostfs_fuzz.go create mode 100644 container/grpc/service_frostfs_test.go delete mode 100644 container/grpc/types.go delete mode 100644 container/grpc/types.pb.go create mode 100644 container/grpc/types_frostfs.pb.go create mode 100644 container/grpc/types_frostfs_fuzz.go create mode 100644 container/grpc/types_frostfs_test.go delete mode 100644 lock/grpc/types.go delete mode 100644 lock/grpc/types.pb.go create mode 100644 lock/grpc/types_frostfs.pb.go create mode 100644 lock/grpc/types_frostfs_fuzz.go create mode 100644 lock/grpc/types_frostfs_test.go delete mode 100644 netmap/grpc/service.go delete mode 100644 netmap/grpc/service.pb.go create mode 100644 netmap/grpc/service_frostfs.pb.go create mode 100644 netmap/grpc/service_frostfs_fuzz.go create mode 100644 netmap/grpc/service_frostfs_test.go delete mode 100644 netmap/grpc/types.go delete mode 100644 netmap/grpc/types.pb.go create mode 100644 netmap/grpc/types_frostfs.pb.go create mode 100644 netmap/grpc/types_frostfs_fuzz.go create mode 100644 netmap/grpc/types_frostfs_test.go delete mode 100644 object/grpc/service.go delete mode 100644 object/grpc/service.pb.go create mode 100644 object/grpc/service_frostfs.pb.go create mode 100644 object/grpc/service_frostfs_fuzz.go create mode 100644 object/grpc/service_frostfs_test.go delete mode 100644 object/grpc/status.pb.go delete mode 100644 object/grpc/types.go delete mode 100644 object/grpc/types.pb.go create mode 100644 object/grpc/types_frostfs.pb.go create mode 100644 object/grpc/types_frostfs_fuzz.go create mode 100644 object/grpc/types_frostfs_test.go delete mode 100644 refs/grpc/types.go delete mode 100644 refs/grpc/types.pb.go create mode 100644 refs/grpc/types_frostfs.pb.go create mode 100644 refs/grpc/types_frostfs_fuzz.go create mode 100644 refs/grpc/types_frostfs_test.go delete mode 100644 session/grpc/service.go delete mode 100644 session/grpc/service.pb.go create mode 100644 session/grpc/service_frostfs.pb.go create mode 100644 session/grpc/service_frostfs_fuzz.go create mode 100644 session/grpc/service_frostfs_test.go delete mode 100644 session/grpc/types.go delete mode 100644 session/grpc/types.pb.go create mode 100644 session/grpc/types_frostfs.pb.go create mode 100644 session/grpc/types_frostfs_fuzz.go create mode 100644 session/grpc/types_frostfs_test.go delete mode 100644 status/grpc/types.go delete mode 100644 status/grpc/types.pb.go create mode 100644 status/grpc/types_frostfs.pb.go create mode 100644 status/grpc/types_frostfs_fuzz.go create mode 100644 status/grpc/types_frostfs_test.go delete mode 100644 tombstone/grpc/types.go delete mode 100644 tombstone/grpc/types.pb.go create mode 100644 tombstone/grpc/types_frostfs.pb.go create mode 100644 tombstone/grpc/types_frostfs_fuzz.go create mode 100644 tombstone/grpc/types_frostfs_test.go create mode 100644 util/pool/marshal.go create mode 100644 util/proto/encoding/compat.go create mode 100644 util/proto/encoding/json.go create mode 100644 util/proto/encoding/proto.go create mode 100644 util/proto/test/custom/test_frostfs.pb.go delete mode 100644 util/proto/test/test_frostfs.pb.go create mode 100644 util/protogen/internalgengo/file.go create mode 100644 util/protogen/internalgengo/fuzz.go create mode 100644 util/protogen/internalgengo/getter.go create mode 100644 util/protogen/internalgengo/json.go create mode 100644 util/protogen/internalgengo/options.go create mode 100644 util/protogen/internalgengo/proto.go create mode 100644 util/protogen/internalgengo/proto_field_type.go create mode 100644 util/protogen/internalgengo/proto_stable_compat.go create mode 100644 util/protogen/internalgengo/writer.go diff --git a/Makefile b/Makefile index 19b3138..7ed6954 100755 --- a/Makefile +++ b/Makefile @@ -61,12 +61,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 './util/proto/test/*'`; do \ echo "⇒ Processing $$f "; \ $(PROTOC_DIR)/bin/protoc \ --proto_path=.:$(PROTOC_DIR)/include:/usr/local/include \ - --plugin=protoc-gen-go=$(PROTOC_GEN_GO_DIR)/protoc-gen-go \ - --go_out=. --go_opt=paths=source_relative \ + --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 @@ -79,7 +80,9 @@ protogen: protoc-test: protoc protogen @$(PROTOC_DIR)/bin/protoc \ --plugin=protoc-gen-go-frostfs=$(abspath $(BIN)/protogen) \ - --go-frostfs_out=. --go-frostfs_opt=paths=source_relative \ + --go-frostfs_opt=Mutil/proto/test/test.proto=git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/proto/test/custom \ + --go-frostfs_opt=module=git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 \ + --go-frostfs_out=. --go-frostfs_opt=paths=import \ ./util/proto/test/test.proto # Run Unit Test with go test diff --git a/accounting/grpc/service.go b/accounting/grpc/service.go deleted file mode 100644 index fa292bf..0000000 --- a/accounting/grpc/service.go +++ /dev/null @@ -1,46 +0,0 @@ -package accounting - -import ( - refs "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc" - session "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session/grpc" -) - -// SetOwnerId sets identifier of the account owner. -func (m *BalanceRequest_Body) SetOwnerId(v *refs.OwnerID) { - m.OwnerId = v -} - -// SetBody sets body of the request. -func (m *BalanceRequest) SetBody(v *BalanceRequest_Body) { - m.Body = v -} - -// SetMetaHeader sets meta header of the request. -func (m *BalanceRequest) SetMetaHeader(v *session.RequestMetaHeader) { - m.MetaHeader = v -} - -// SetVerifyHeader sets verification header of the request. -func (m *BalanceRequest) SetVerifyHeader(v *session.RequestVerificationHeader) { - m.VerifyHeader = v -} - -// SetBalance sets balance value of the response. -func (m *BalanceResponse_Body) SetBalance(v *Decimal) { - m.Balance = v -} - -// SetBody sets body of the response. -func (m *BalanceResponse) SetBody(v *BalanceResponse_Body) { - m.Body = v -} - -// SetMetaHeader sets meta header of the response. -func (m *BalanceResponse) SetMetaHeader(v *session.ResponseMetaHeader) { - m.MetaHeader = v -} - -// SetVerifyHeader sets verification header of the response. -func (m *BalanceResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) { - m.VerifyHeader = v -} diff --git a/accounting/grpc/service.pb.go b/accounting/grpc/service.pb.go deleted file mode 100644 index b66bb7a..0000000 --- a/accounting/grpc/service.pb.go +++ /dev/null @@ -1,451 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.33.0 -// protoc v5.27.2 -// source: accounting/grpc/service.proto - -package accounting - -import ( - grpc1 "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc" - grpc "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session/grpc" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -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 - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Body of the balance request message. - Body *BalanceRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" 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,proto3" json:"verify_header,omitempty"` -} - -func (x *BalanceRequest) Reset() { - *x = BalanceRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_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_accounting_grpc_service_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use BalanceRequest.ProtoReflect.Descriptor instead. -func (*BalanceRequest) Descriptor() ([]byte, []int) { - return file_accounting_grpc_service_proto_rawDescGZIP(), []int{0} -} - -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 -} - -// BalanceResponse message -type BalanceResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Body of the balance response message. - Body *BalanceResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" 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,proto3" json:"verify_header,omitempty"` -} - -func (x *BalanceResponse) Reset() { - *x = BalanceResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_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_accounting_grpc_service_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use BalanceResponse.ProtoReflect.Descriptor instead. -func (*BalanceResponse) Descriptor() ([]byte, []int) { - return file_accounting_grpc_service_proto_rawDescGZIP(), []int{1} -} - -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 -} - -// To indicate the account for which the balance is requested, its identifier -// is used. It can be any existing account in NeoFS sidechain `Balance` smart -// contract. If omitted, client implementation MUST set it to the request's -// signer `OwnerID`. -type BalanceRequest_Body struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // 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,proto3" json:"owner_id,omitempty"` -} - -func (x *BalanceRequest_Body) Reset() { - *x = BalanceRequest_Body{} - if protoimpl.UnsafeEnabled { - mi := &file_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_accounting_grpc_service_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use BalanceRequest_Body.ProtoReflect.Descriptor instead. -func (*BalanceRequest_Body) Descriptor() ([]byte, []int) { - return file_accounting_grpc_service_proto_rawDescGZIP(), []int{0, 0} -} - -func (x *BalanceRequest_Body) GetOwnerId() *grpc1.OwnerID { - if x != nil { - return x.OwnerId - } - return nil -} - -// 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 - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Amount of funds in GAS token for the requested account. - Balance *Decimal `protobuf:"bytes,1,opt,name=balance,proto3" json:"balance,omitempty"` -} - -func (x *BalanceResponse_Body) Reset() { - *x = BalanceResponse_Body{} - if protoimpl.UnsafeEnabled { - mi := &file_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_accounting_grpc_service_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use BalanceResponse_Body.ProtoReflect.Descriptor instead. -func (*BalanceResponse_Body) Descriptor() ([]byte, []int) { - return file_accounting_grpc_service_proto_rawDescGZIP(), []int{1, 0} -} - -func (x *BalanceResponse_Body) GetBalance() *Decimal { - if x != nil { - return x.Balance - } - return nil -} - -var File_accounting_grpc_service_proto protoreflect.FileDescriptor - -var file_accounting_grpc_service_proto_rawDesc = []byte{ - 0x0a, 0x1d, 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, 0x1b, 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, 0x15, 0x72, 0x65, 0x66, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, - 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x18, 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, 0x6d, 0x5a, 0x4a, 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, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 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, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_accounting_grpc_service_proto_rawDescOnce sync.Once - file_accounting_grpc_service_proto_rawDescData = file_accounting_grpc_service_proto_rawDesc -) - -func file_accounting_grpc_service_proto_rawDescGZIP() []byte { - file_accounting_grpc_service_proto_rawDescOnce.Do(func() { - file_accounting_grpc_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_accounting_grpc_service_proto_rawDescData) - }) - return file_accounting_grpc_service_proto_rawDescData -} - -var file_accounting_grpc_service_proto_msgTypes = make([]protoimpl.MessageInfo, 4) -var file_accounting_grpc_service_proto_goTypes = []interface{}{ - (*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_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_accounting_grpc_service_proto_init() } -func file_accounting_grpc_service_proto_init() { - if File_accounting_grpc_service_proto != nil { - return - } - file_accounting_grpc_types_proto_init() - if !protoimpl.UnsafeEnabled { - file_accounting_grpc_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*BalanceRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_accounting_grpc_service_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*BalanceResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_accounting_grpc_service_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*BalanceRequest_Body); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_accounting_grpc_service_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*BalanceResponse_Body); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_accounting_grpc_service_proto_rawDesc, - NumEnums: 0, - NumMessages: 4, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_accounting_grpc_service_proto_goTypes, - DependencyIndexes: file_accounting_grpc_service_proto_depIdxs, - MessageInfos: file_accounting_grpc_service_proto_msgTypes, - }.Build() - File_accounting_grpc_service_proto = out.File - file_accounting_grpc_service_proto_rawDesc = nil - file_accounting_grpc_service_proto_goTypes = nil - file_accounting_grpc_service_proto_depIdxs = nil -} diff --git a/accounting/grpc/service_frostfs.pb.go b/accounting/grpc/service_frostfs.pb.go new file mode 100644 index 0000000..e44d7d4 --- /dev/null +++ b/accounting/grpc/service_frostfs.pb.go @@ -0,0 +1,724 @@ +// Code generated by protoc-gen-go-frostfs. DO NOT EDIT. + +package accounting + +import ( + json "encoding/json" + fmt "fmt" + grpc "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc" + grpc1 "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session/grpc" + pool "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/pool" + proto "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/proto" + encoding "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/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.StableSize() != 0 { + 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 + } + out.RawByte('{') + { + const prefix string = ",\"ownerId\":" + out.RawString(prefix[1:]) + 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.StableSize() != 0 { + x.Body.EmitProtobuf(mm.AppendMessage(1)) + } + if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 { + x.MetaHeader.EmitProtobuf(mm.AppendMessage(2)) + } + if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 { + 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 + } + out.RawByte('{') + { + const prefix string = ",\"body\":" + out.RawString(prefix[1:]) + x.Body.MarshalEasyJSON(out) + } + { + const prefix string = ",\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) + } + { + 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.StableSize() != 0 { + 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 + } + out.RawByte('{') + { + const prefix string = ",\"balance\":" + out.RawString(prefix[1:]) + 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.StableSize() != 0 { + x.Body.EmitProtobuf(mm.AppendMessage(1)) + } + if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 { + x.MetaHeader.EmitProtobuf(mm.AppendMessage(2)) + } + if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 { + 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 + } + out.RawByte('{') + { + const prefix string = ",\"body\":" + out.RawString(prefix[1:]) + x.Body.MarshalEasyJSON(out) + } + { + const prefix string = ",\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) + } + { + 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() + } +} diff --git a/accounting/grpc/service_frostfs_fuzz.go b/accounting/grpc/service_frostfs_fuzz.go new file mode 100644 index 0000000..69e7174 --- /dev/null +++ b/accounting/grpc/service_frostfs_fuzz.go @@ -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 +} diff --git a/accounting/grpc/service_frostfs_test.go b/accounting/grpc/service_frostfs_test.go new file mode 100644 index 0000000..b97a13e --- /dev/null +++ b/accounting/grpc/service_frostfs_test.go @@ -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) + }) +} diff --git a/accounting/grpc/types.go b/accounting/grpc/types.go deleted file mode 100644 index 1c1bac9..0000000 --- a/accounting/grpc/types.go +++ /dev/null @@ -1,11 +0,0 @@ -package accounting - -// SetValue sets value of the decimal number. -func (m *Decimal) SetValue(v int64) { - m.Value = v -} - -// SetPrecision sets precision of the decimal number. -func (m *Decimal) SetPrecision(v uint32) { - m.Precision = v -} diff --git a/accounting/grpc/types.pb.go b/accounting/grpc/types.pb.go deleted file mode 100644 index 8be14bc..0000000 --- a/accounting/grpc/types.pb.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.33.0 -// protoc v5.27.2 -// source: accounting/grpc/types.proto - -package accounting - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -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 NeoFS 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 - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Number in the smallest Token fractions. - Value int64 `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"` - // Precision value indicating how many smallest fractions can be in one - // integer. - Precision uint32 `protobuf:"varint,2,opt,name=precision,proto3" json:"precision,omitempty"` -} - -func (x *Decimal) Reset() { - *x = Decimal{} - if protoimpl.UnsafeEnabled { - mi := &file_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_accounting_grpc_types_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Decimal.ProtoReflect.Descriptor instead. -func (*Decimal) Descriptor() ([]byte, []int) { - return file_accounting_grpc_types_proto_rawDescGZIP(), []int{0} -} - -func (x *Decimal) GetValue() int64 { - if x != nil { - return x.Value - } - return 0 -} - -func (x *Decimal) GetPrecision() uint32 { - if x != nil { - return x.Precision - } - return 0 -} - -var File_accounting_grpc_types_proto protoreflect.FileDescriptor - -var file_accounting_grpc_types_proto_rawDesc = []byte{ - 0x0a, 0x1b, 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, 0x6d, 0x5a, 0x4a, 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, 0x61, 0x70, 0x69, 0x2d, - 0x67, 0x6f, 0x2f, 0x76, 0x32, 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, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_accounting_grpc_types_proto_rawDescOnce sync.Once - file_accounting_grpc_types_proto_rawDescData = file_accounting_grpc_types_proto_rawDesc -) - -func file_accounting_grpc_types_proto_rawDescGZIP() []byte { - file_accounting_grpc_types_proto_rawDescOnce.Do(func() { - file_accounting_grpc_types_proto_rawDescData = protoimpl.X.CompressGZIP(file_accounting_grpc_types_proto_rawDescData) - }) - return file_accounting_grpc_types_proto_rawDescData -} - -var file_accounting_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_accounting_grpc_types_proto_goTypes = []interface{}{ - (*Decimal)(nil), // 0: neo.fs.v2.accounting.Decimal -} -var file_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_accounting_grpc_types_proto_init() } -func file_accounting_grpc_types_proto_init() { - if File_accounting_grpc_types_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_accounting_grpc_types_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Decimal); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_accounting_grpc_types_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_accounting_grpc_types_proto_goTypes, - DependencyIndexes: file_accounting_grpc_types_proto_depIdxs, - MessageInfos: file_accounting_grpc_types_proto_msgTypes, - }.Build() - File_accounting_grpc_types_proto = out.File - file_accounting_grpc_types_proto_rawDesc = nil - file_accounting_grpc_types_proto_goTypes = nil - file_accounting_grpc_types_proto_depIdxs = nil -} diff --git a/accounting/grpc/types_frostfs.pb.go b/accounting/grpc/types_frostfs.pb.go new file mode 100644 index 0000000..182705e --- /dev/null +++ b/accounting/grpc/types_frostfs.pb.go @@ -0,0 +1,174 @@ +// Code generated by protoc-gen-go-frostfs. DO NOT EDIT. + +package accounting + +import ( + json "encoding/json" + fmt "fmt" + pool "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/pool" + proto "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/proto" + encoding "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/proto/encoding" + easyproto "github.com/VictoriaMetrics/easyproto" + jlexer "github.com/mailru/easyjson/jlexer" + jwriter "github.com/mailru/easyjson/jwriter" +) + +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 + } + out.RawByte('{') + { + const prefix string = ",\"value\":" + out.RawString(prefix[1:]) + out.Int64(x.Value) + } + { + 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 + f = in.Int64() + x.Value = f + } + case "precision": + { + var f uint32 + f = in.Uint32() + x.Precision = f + } + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} diff --git a/accounting/grpc/types_frostfs_fuzz.go b/accounting/grpc/types_frostfs_fuzz.go new file mode 100644 index 0000000..5eb5e97 --- /dev/null +++ b/accounting/grpc/types_frostfs_fuzz.go @@ -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 +} diff --git a/accounting/grpc/types_frostfs_test.go b/accounting/grpc/types_frostfs_test.go new file mode 100644 index 0000000..404b75e --- /dev/null +++ b/accounting/grpc/types_frostfs_test.go @@ -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) + }) +} diff --git a/acl/convert.go b/acl/convert.go index 0cf455c..c5768ad 100644 --- a/acl/convert.go +++ b/acl/convert.go @@ -478,7 +478,7 @@ func (bt *BearerTokenBody) ToGRPCMessage() grpc.Message { m.SetLifetime(bt.lifetime.ToGRPCMessage().(*acl.BearerToken_Body_TokenLifetime)) m.SetEaclTable(bt.eacl.ToGRPCMessage().(*acl.EACLTable)) m.SetAllowImpersonate(bt.impersonate) - m.SetAPEOverride(bt.apeOverride.ToGRPCMessage().(*acl.BearerToken_Body_APEOverride)) + m.SetApeOverride(bt.apeOverride.ToGRPCMessage().(*acl.BearerToken_Body_APEOverride)) } return m diff --git a/acl/grpc/types.go b/acl/grpc/types.go deleted file mode 100644 index fbcbb91..0000000 --- a/acl/grpc/types.go +++ /dev/null @@ -1,193 +0,0 @@ -package acl - -import ( - ape "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/ape/grpc" - refs "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc" -) - -// SetVersion sets version of EACL rules in table. -func (m *EACLTable) SetVersion(v *refs.Version) { - m.Version = v -} - -// SetContainerId sets container identifier of the eACL table. -func (m *EACLTable) SetContainerId(v *refs.ContainerID) { - m.ContainerId = v -} - -// SetRecords sets record list of the eACL table. -func (m *EACLTable) SetRecords(v []*EACLRecord) { - m.Records = v -} - -// SetOperation sets operation of the eACL record. -func (m *EACLRecord) SetOperation(v Operation) { - m.Operation = v -} - -// SetAction sets action of the eACL record. -func (m *EACLRecord) SetAction(v Action) { - m.Action = v -} - -// SetFilters sets filter list of the eACL record. -func (m *EACLRecord) SetFilters(v []*EACLRecord_Filter) { - m.Filters = v -} - -// SetTargets sets target list of the eACL record. -func (m *EACLRecord) SetTargets(v []*EACLRecord_Target) { - m.Targets = v -} - -// SetHeaderType sets header type of the eACL filter. -func (m *EACLRecord_Filter) SetHeaderType(v HeaderType) { - m.HeaderType = v -} - -// SetMatchType sets match type of the eACL filter. -func (m *EACLRecord_Filter) SetMatchType(v MatchType) { - m.MatchType = v -} - -// SetKey sets key of the eACL filter. -func (m *EACLRecord_Filter) SetKey(v string) { - m.Key = v -} - -// SetValue sets value of the eACL filter. -func (m *EACLRecord_Filter) SetValue(v string) { - m.Value = v -} - -// SetRole sets target group of the eACL target. -func (m *EACLRecord_Target) SetRole(v Role) { - m.Role = v -} - -// SetKeys of the eACL target. -func (m *EACLRecord_Target) SetKeys(v [][]byte) { - m.Keys = v -} - -// SetEaclTable sets eACL table of the bearer token. -func (m *BearerToken_Body) SetEaclTable(v *EACLTable) { - m.EaclTable = v -} - -func (m *BearerToken_Body) SetAPEOverride(v *BearerToken_Body_APEOverride) { - m.ApeOverride = v -} - -func (m *BearerToken_Body_APEOverride) SetChains(v []*ape.Chain) { - m.Chains = v -} - -func (m *BearerToken_Body_APEOverride) SetTarget(v *ape.ChainTarget) { - m.Target = v -} - -// SetOwnerId sets identifier of the bearer token owner. -func (m *BearerToken_Body) SetOwnerId(v *refs.OwnerID) { - m.OwnerId = v -} - -// SetLifetime sets lifetime of the bearer token. -func (m *BearerToken_Body) SetLifetime(v *BearerToken_Body_TokenLifetime) { - m.Lifetime = v -} - -// SetAllowImpersonate allows impersonate. -func (m *BearerToken_Body) SetAllowImpersonate(v bool) { - m.AllowImpersonate = v -} - -// SetBody sets bearer token body. -func (m *BearerToken) SetBody(v *BearerToken_Body) { - m.Body = v -} - -// SetSignature sets bearer token signature. -func (m *BearerToken) SetSignature(v *refs.Signature) { - m.Signature = v -} - -// SetExp sets epoch number of the token expiration. -func (m *BearerToken_Body_TokenLifetime) SetExp(v uint64) { - m.Exp = v -} - -// SetNbf sets starting epoch number of the token. -func (m *BearerToken_Body_TokenLifetime) SetNbf(v uint64) { - m.Nbf = v -} - -// SetIat sets the number of the epoch in which the token was issued. -func (m *BearerToken_Body_TokenLifetime) SetIat(v uint64) { - m.Iat = v -} - -// FromString parses Action from a string representation, -// It is a reverse action to String(). -// -// Returns true if s was parsed successfully. -func (x *Action) FromString(s string) bool { - i, ok := Action_value[s] - if ok { - *x = Action(i) - } - - return ok -} - -// FromString parses Role from a string representation, -// It is a reverse action to String(). -// -// Returns true if s was parsed successfully. -func (x *Role) FromString(s string) bool { - i, ok := Role_value[s] - if ok { - *x = Role(i) - } - - return ok -} - -// FromString parses Operation from a string representation, -// It is a reverse action to String(). -// -// Returns true if s was parsed successfully. -func (x *Operation) FromString(s string) bool { - i, ok := Operation_value[s] - if ok { - *x = Operation(i) - } - - return ok -} - -// FromString parses MatchType from a string representation, -// It is a reverse action to String(). -// -// Returns true if s was parsed successfully. -func (x *MatchType) FromString(s string) bool { - i, ok := MatchType_value[s] - if ok { - *x = MatchType(i) - } - - return ok -} - -// FromString parses HeaderType from a string representation, -// It is a reverse action to String(). -// -// Returns true if s was parsed successfully. -func (x *HeaderType) FromString(s string) bool { - i, ok := HeaderType_value[s] - if ok { - *x = HeaderType(i) - } - - return ok -} diff --git a/acl/grpc/types.pb.go b/acl/grpc/types.pb.go deleted file mode 100644 index 39ab1e1..0000000 --- a/acl/grpc/types.pb.go +++ /dev/null @@ -1,1231 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.33.0 -// protoc v5.27.2 -// source: acl/grpc/types.proto - -package acl - -import ( - grpc1 "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/ape/grpc" - grpc "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -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) -) - -// Target role of the access control rule in access control list. -type Role int32 - -const ( - // Unspecified role, default value - Role_ROLE_UNSPECIFIED Role = 0 - // User target rule is applied if sender is the owner of the container - Role_USER Role = 1 - // System target rule is applied if sender is a storage node within the - // container or an inner ring node - Role_SYSTEM Role = 2 - // Others target rule is applied if sender is neither a user nor a system - // target - Role_OTHERS Role = 3 -) - -// Enum value maps for Role. -var ( - Role_name = map[int32]string{ - 0: "ROLE_UNSPECIFIED", - 1: "USER", - 2: "SYSTEM", - 3: "OTHERS", - } - Role_value = map[string]int32{ - "ROLE_UNSPECIFIED": 0, - "USER": 1, - "SYSTEM": 2, - "OTHERS": 3, - } -) - -func (x Role) Enum() *Role { - p := new(Role) - *p = x - return p -} - -func (x Role) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (Role) Descriptor() protoreflect.EnumDescriptor { - return file_acl_grpc_types_proto_enumTypes[0].Descriptor() -} - -func (Role) Type() protoreflect.EnumType { - return &file_acl_grpc_types_proto_enumTypes[0] -} - -func (x Role) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use Role.Descriptor instead. -func (Role) EnumDescriptor() ([]byte, []int) { - return file_acl_grpc_types_proto_rawDescGZIP(), []int{0} -} - -// MatchType is an enumeration of match types. -type MatchType int32 - -const ( - // Unspecified match type, default value. - MatchType_MATCH_TYPE_UNSPECIFIED MatchType = 0 - // Return true if strings are equal - MatchType_STRING_EQUAL MatchType = 1 - // Return true if strings are different - MatchType_STRING_NOT_EQUAL MatchType = 2 -) - -// Enum value maps for MatchType. -var ( - MatchType_name = map[int32]string{ - 0: "MATCH_TYPE_UNSPECIFIED", - 1: "STRING_EQUAL", - 2: "STRING_NOT_EQUAL", - } - MatchType_value = map[string]int32{ - "MATCH_TYPE_UNSPECIFIED": 0, - "STRING_EQUAL": 1, - "STRING_NOT_EQUAL": 2, - } -) - -func (x MatchType) Enum() *MatchType { - p := new(MatchType) - *p = x - return p -} - -func (x MatchType) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (MatchType) Descriptor() protoreflect.EnumDescriptor { - return file_acl_grpc_types_proto_enumTypes[1].Descriptor() -} - -func (MatchType) Type() protoreflect.EnumType { - return &file_acl_grpc_types_proto_enumTypes[1] -} - -func (x MatchType) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use MatchType.Descriptor instead. -func (MatchType) EnumDescriptor() ([]byte, []int) { - return file_acl_grpc_types_proto_rawDescGZIP(), []int{1} -} - -// Request's operation type to match if the rule is applicable to a particular -// request. -type Operation int32 - -const ( - // Unspecified operation, default value - Operation_OPERATION_UNSPECIFIED Operation = 0 - // Get - Operation_GET Operation = 1 - // Head - Operation_HEAD Operation = 2 - // Put - Operation_PUT Operation = 3 - // Delete - Operation_DELETE Operation = 4 - // Search - Operation_SEARCH Operation = 5 - // GetRange - Operation_GETRANGE Operation = 6 - // GetRangeHash - Operation_GETRANGEHASH Operation = 7 -) - -// Enum value maps for Operation. -var ( - Operation_name = map[int32]string{ - 0: "OPERATION_UNSPECIFIED", - 1: "GET", - 2: "HEAD", - 3: "PUT", - 4: "DELETE", - 5: "SEARCH", - 6: "GETRANGE", - 7: "GETRANGEHASH", - } - Operation_value = map[string]int32{ - "OPERATION_UNSPECIFIED": 0, - "GET": 1, - "HEAD": 2, - "PUT": 3, - "DELETE": 4, - "SEARCH": 5, - "GETRANGE": 6, - "GETRANGEHASH": 7, - } -) - -func (x Operation) Enum() *Operation { - p := new(Operation) - *p = x - return p -} - -func (x Operation) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (Operation) Descriptor() protoreflect.EnumDescriptor { - return file_acl_grpc_types_proto_enumTypes[2].Descriptor() -} - -func (Operation) Type() protoreflect.EnumType { - return &file_acl_grpc_types_proto_enumTypes[2] -} - -func (x Operation) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use Operation.Descriptor instead. -func (Operation) EnumDescriptor() ([]byte, []int) { - return file_acl_grpc_types_proto_rawDescGZIP(), []int{2} -} - -// Rule execution result action. Either allows or denies access if the rule's -// filters match. -type Action int32 - -const ( - // Unspecified action, default value - Action_ACTION_UNSPECIFIED Action = 0 - // Allow action - Action_ALLOW Action = 1 - // Deny action - Action_DENY Action = 2 -) - -// Enum value maps for Action. -var ( - Action_name = map[int32]string{ - 0: "ACTION_UNSPECIFIED", - 1: "ALLOW", - 2: "DENY", - } - Action_value = map[string]int32{ - "ACTION_UNSPECIFIED": 0, - "ALLOW": 1, - "DENY": 2, - } -) - -func (x Action) Enum() *Action { - p := new(Action) - *p = x - return p -} - -func (x Action) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (Action) Descriptor() protoreflect.EnumDescriptor { - return file_acl_grpc_types_proto_enumTypes[3].Descriptor() -} - -func (Action) Type() protoreflect.EnumType { - return &file_acl_grpc_types_proto_enumTypes[3] -} - -func (x Action) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use Action.Descriptor instead. -func (Action) EnumDescriptor() ([]byte, []int) { - return file_acl_grpc_types_proto_rawDescGZIP(), []int{3} -} - -// Enumeration of possible sources of Headers to apply filters. -type HeaderType int32 - -const ( - // Unspecified header, default value. - HeaderType_HEADER_UNSPECIFIED HeaderType = 0 - // Filter request headers - HeaderType_REQUEST HeaderType = 1 - // Filter object headers - HeaderType_OBJECT HeaderType = 2 - // Filter service headers. These are not processed by NeoFS nodes and - // exist for service use only. - HeaderType_SERVICE HeaderType = 3 -) - -// Enum value maps for HeaderType. -var ( - HeaderType_name = map[int32]string{ - 0: "HEADER_UNSPECIFIED", - 1: "REQUEST", - 2: "OBJECT", - 3: "SERVICE", - } - HeaderType_value = map[string]int32{ - "HEADER_UNSPECIFIED": 0, - "REQUEST": 1, - "OBJECT": 2, - "SERVICE": 3, - } -) - -func (x HeaderType) Enum() *HeaderType { - p := new(HeaderType) - *p = x - return p -} - -func (x HeaderType) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (HeaderType) Descriptor() protoreflect.EnumDescriptor { - return file_acl_grpc_types_proto_enumTypes[4].Descriptor() -} - -func (HeaderType) Type() protoreflect.EnumType { - return &file_acl_grpc_types_proto_enumTypes[4] -} - -func (x HeaderType) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use HeaderType.Descriptor instead. -func (HeaderType) EnumDescriptor() ([]byte, []int) { - return file_acl_grpc_types_proto_rawDescGZIP(), []int{4} -} - -// Describes a single eACL rule. -type EACLRecord struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // NeoFS request Verb to match - Operation Operation `protobuf:"varint,1,opt,name=operation,proto3,enum=neo.fs.v2.acl.Operation" json:"operation,omitempty"` - // Rule execution result. Either allows or denies access if filters match. - Action Action `protobuf:"varint,2,opt,name=action,proto3,enum=neo.fs.v2.acl.Action" json:"action,omitempty"` - // List of filters to match and see if rule is applicable - Filters []*EACLRecord_Filter `protobuf:"bytes,3,rep,name=filters,proto3" json:"filters,omitempty"` - // List of target subjects to apply ACL rule to - Targets []*EACLRecord_Target `protobuf:"bytes,4,rep,name=targets,proto3" json:"targets,omitempty"` -} - -func (x *EACLRecord) Reset() { - *x = EACLRecord{} - if protoimpl.UnsafeEnabled { - mi := &file_acl_grpc_types_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *EACLRecord) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*EACLRecord) ProtoMessage() {} - -func (x *EACLRecord) ProtoReflect() protoreflect.Message { - mi := &file_acl_grpc_types_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use EACLRecord.ProtoReflect.Descriptor instead. -func (*EACLRecord) Descriptor() ([]byte, []int) { - return file_acl_grpc_types_proto_rawDescGZIP(), []int{0} -} - -func (x *EACLRecord) GetOperation() Operation { - if x != nil { - return x.Operation - } - return Operation_OPERATION_UNSPECIFIED -} - -func (x *EACLRecord) GetAction() Action { - if x != nil { - return x.Action - } - return Action_ACTION_UNSPECIFIED -} - -func (x *EACLRecord) GetFilters() []*EACLRecord_Filter { - if x != nil { - return x.Filters - } - return nil -} - -func (x *EACLRecord) GetTargets() []*EACLRecord_Target { - if x != nil { - return x.Targets - } - return nil -} - -// Extended ACL rules table. A list of ACL rules defined additionally to Basic -// ACL. Extended ACL rules can be attached to a container and can be updated -// or may be defined in `BearerToken` structure. Please see the corresponding -// NeoFS Technical Specification section for detailed description. -type EACLTable struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // eACL format version. Effectively, the version of API library used to create - // eACL Table. - Version *grpc.Version `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` - // Identifier of the container that should use given access control rules - ContainerId *grpc.ContainerID `protobuf:"bytes,2,opt,name=container_id,json=containerID,proto3" json:"container_id,omitempty"` - // List of Extended ACL rules - Records []*EACLRecord `protobuf:"bytes,3,rep,name=records,proto3" json:"records,omitempty"` -} - -func (x *EACLTable) Reset() { - *x = EACLTable{} - if protoimpl.UnsafeEnabled { - mi := &file_acl_grpc_types_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *EACLTable) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*EACLTable) ProtoMessage() {} - -func (x *EACLTable) ProtoReflect() protoreflect.Message { - mi := &file_acl_grpc_types_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use EACLTable.ProtoReflect.Descriptor instead. -func (*EACLTable) Descriptor() ([]byte, []int) { - return file_acl_grpc_types_proto_rawDescGZIP(), []int{1} -} - -func (x *EACLTable) GetVersion() *grpc.Version { - if x != nil { - return x.Version - } - return nil -} - -func (x *EACLTable) GetContainerId() *grpc.ContainerID { - if x != nil { - return x.ContainerId - } - return nil -} - -func (x *EACLTable) GetRecords() []*EACLRecord { - if x != nil { - return x.Records - } - return nil -} - -// BearerToken allows to attach signed Extended ACL rules to the request in -// `RequestMetaHeader`. If container's Basic ACL rules allow, the attached rule -// set will be checked instead of one attached to the container itself. Just -// like [JWT](https://jwt.io), it has a limited lifetime and scope, hence can be -// used in the similar use cases, like providing authorisation to externally -// authenticated party. -// -// BearerToken can be issued only by the container's owner and must be signed -// using the key associated with the container's `OwnerID`. -type BearerToken struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Bearer Token body - Body *BearerToken_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` - // Signature of BearerToken body - Signature *grpc.Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` -} - -func (x *BearerToken) Reset() { - *x = BearerToken{} - if protoimpl.UnsafeEnabled { - mi := &file_acl_grpc_types_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *BearerToken) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*BearerToken) ProtoMessage() {} - -func (x *BearerToken) ProtoReflect() protoreflect.Message { - mi := &file_acl_grpc_types_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use BearerToken.ProtoReflect.Descriptor instead. -func (*BearerToken) Descriptor() ([]byte, []int) { - return file_acl_grpc_types_proto_rawDescGZIP(), []int{2} -} - -func (x *BearerToken) GetBody() *BearerToken_Body { - if x != nil { - return x.Body - } - return nil -} - -func (x *BearerToken) GetSignature() *grpc.Signature { - if x != nil { - return x.Signature - } - return nil -} - -// Filter to check particular properties of the request or the object. -// -// By default `key` field refers to the corresponding object's `Attribute`. -// Some Object's header fields can also be accessed by adding `$Object:` -// prefix to the name. Here is the list of fields available via this prefix: -// -// - $Object:version \ -// version -// - $Object:objectID \ -// object_id -// - $Object:containerID \ -// container_id -// - $Object:ownerID \ -// owner_id -// - $Object:creationEpoch \ -// creation_epoch -// - $Object:payloadLength \ -// payload_length -// - $Object:payloadHash \ -// payload_hash -// - $Object:objectType \ -// object_type -// - $Object:homomorphicHash \ -// homomorphic_hash -// -// Please note, that if request or response does not have object's headers of -// full object (Range, RangeHash, Search, Delete), it will not be possible to -// filter by object header fields or user attributes. From the well-known list -// only `$Object:objectID` and `$Object:containerID` will be available, as -// it's possible to take that information from the requested address. -type EACLRecord_Filter struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Define if Object or Request header will be used - HeaderType HeaderType `protobuf:"varint,1,opt,name=header_type,json=headerType,proto3,enum=neo.fs.v2.acl.HeaderType" json:"header_type,omitempty"` - // Match operation type - MatchType MatchType `protobuf:"varint,2,opt,name=match_type,json=matchType,proto3,enum=neo.fs.v2.acl.MatchType" json:"match_type,omitempty"` - // Name of the Header to use - Key string `protobuf:"bytes,3,opt,name=key,proto3" json:"key,omitempty"` - // Expected Header Value or pattern to match - Value string `protobuf:"bytes,4,opt,name=value,proto3" json:"value,omitempty"` -} - -func (x *EACLRecord_Filter) Reset() { - *x = EACLRecord_Filter{} - if protoimpl.UnsafeEnabled { - mi := &file_acl_grpc_types_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *EACLRecord_Filter) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*EACLRecord_Filter) ProtoMessage() {} - -func (x *EACLRecord_Filter) ProtoReflect() protoreflect.Message { - mi := &file_acl_grpc_types_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use EACLRecord_Filter.ProtoReflect.Descriptor instead. -func (*EACLRecord_Filter) Descriptor() ([]byte, []int) { - return file_acl_grpc_types_proto_rawDescGZIP(), []int{0, 0} -} - -func (x *EACLRecord_Filter) GetHeaderType() HeaderType { - if x != nil { - return x.HeaderType - } - return HeaderType_HEADER_UNSPECIFIED -} - -func (x *EACLRecord_Filter) GetMatchType() MatchType { - if x != nil { - return x.MatchType - } - return MatchType_MATCH_TYPE_UNSPECIFIED -} - -func (x *EACLRecord_Filter) GetKey() string { - if x != nil { - return x.Key - } - return "" -} - -func (x *EACLRecord_Filter) GetValue() string { - if x != nil { - return x.Value - } - return "" -} - -// Target to apply ACL rule. Can be a subject's role class or a list of public -// keys to match. -type EACLRecord_Target struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Target subject's role class - Role Role `protobuf:"varint,1,opt,name=role,proto3,enum=neo.fs.v2.acl.Role" json:"role,omitempty"` - // List of public keys to identify target subject - Keys [][]byte `protobuf:"bytes,2,rep,name=keys,proto3" json:"keys,omitempty"` -} - -func (x *EACLRecord_Target) Reset() { - *x = EACLRecord_Target{} - if protoimpl.UnsafeEnabled { - mi := &file_acl_grpc_types_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *EACLRecord_Target) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*EACLRecord_Target) ProtoMessage() {} - -func (x *EACLRecord_Target) ProtoReflect() protoreflect.Message { - mi := &file_acl_grpc_types_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use EACLRecord_Target.ProtoReflect.Descriptor instead. -func (*EACLRecord_Target) Descriptor() ([]byte, []int) { - return file_acl_grpc_types_proto_rawDescGZIP(), []int{0, 1} -} - -func (x *EACLRecord_Target) GetRole() Role { - if x != nil { - return x.Role - } - return Role_ROLE_UNSPECIFIED -} - -func (x *EACLRecord_Target) GetKeys() [][]byte { - if x != nil { - return x.Keys - } - return nil -} - -// Bearer Token body structure contains Extended ACL table issued by the -// container owner with additional information preventing token abuse. -type BearerToken_Body struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Table of Extended ACL rules to use instead of the ones attached to the - // container. If it contains `container_id` field, bearer token is only - // valid for this specific container. Otherwise, any container of the same - // owner is allowed. - // - // Deprecated: eACL tables are no longer relevant - `APEOverrides` should be - // used instead. - EaclTable *EACLTable `protobuf:"bytes,1,opt,name=eacl_table,json=eaclTable,proto3" json:"eacl_table,omitempty"` - // `OwnerID` defines to whom the token was issued. It must match the request - // originator's `OwnerID`. If empty, any token bearer will be accepted. - OwnerId *grpc.OwnerID `protobuf:"bytes,2,opt,name=owner_id,json=ownerID,proto3" json:"owner_id,omitempty"` - // Token expiration and valid time period parameters - Lifetime *BearerToken_Body_TokenLifetime `protobuf:"bytes,3,opt,name=lifetime,proto3" json:"lifetime,omitempty"` - // AllowImpersonate flag to consider token signer as request owner. - // If this field is true extended ACL table in token body isn't processed. - AllowImpersonate bool `protobuf:"varint,4,opt,name=allow_impersonate,json=allowImpersonate,proto3" json:"allow_impersonate,omitempty"` - // APE override for the target. - ApeOverride *BearerToken_Body_APEOverride `protobuf:"bytes,5,opt,name=ape_override,json=apeOverride,proto3" json:"ape_override,omitempty"` -} - -func (x *BearerToken_Body) Reset() { - *x = BearerToken_Body{} - if protoimpl.UnsafeEnabled { - mi := &file_acl_grpc_types_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *BearerToken_Body) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*BearerToken_Body) ProtoMessage() {} - -func (x *BearerToken_Body) ProtoReflect() protoreflect.Message { - mi := &file_acl_grpc_types_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use BearerToken_Body.ProtoReflect.Descriptor instead. -func (*BearerToken_Body) Descriptor() ([]byte, []int) { - return file_acl_grpc_types_proto_rawDescGZIP(), []int{2, 0} -} - -func (x *BearerToken_Body) GetEaclTable() *EACLTable { - if x != nil { - return x.EaclTable - } - return nil -} - -func (x *BearerToken_Body) GetOwnerId() *grpc.OwnerID { - if x != nil { - return x.OwnerId - } - return nil -} - -func (x *BearerToken_Body) GetLifetime() *BearerToken_Body_TokenLifetime { - if x != nil { - return x.Lifetime - } - return nil -} - -func (x *BearerToken_Body) GetAllowImpersonate() bool { - if x != nil { - return x.AllowImpersonate - } - return false -} - -func (x *BearerToken_Body) GetApeOverride() *BearerToken_Body_APEOverride { - if x != nil { - return x.ApeOverride - } - return nil -} - -// Lifetime parameters of the token. Field names taken from -// [rfc7519](https://tools.ietf.org/html/rfc7519). -type BearerToken_Body_TokenLifetime struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Expiration Epoch - Exp uint64 `protobuf:"varint,1,opt,name=exp,proto3" json:"exp,omitempty"` - // Not valid before Epoch - Nbf uint64 `protobuf:"varint,2,opt,name=nbf,proto3" json:"nbf,omitempty"` - // Issued at Epoch - Iat uint64 `protobuf:"varint,3,opt,name=iat,proto3" json:"iat,omitempty"` -} - -func (x *BearerToken_Body_TokenLifetime) Reset() { - *x = BearerToken_Body_TokenLifetime{} - if protoimpl.UnsafeEnabled { - mi := &file_acl_grpc_types_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *BearerToken_Body_TokenLifetime) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*BearerToken_Body_TokenLifetime) ProtoMessage() {} - -func (x *BearerToken_Body_TokenLifetime) ProtoReflect() protoreflect.Message { - mi := &file_acl_grpc_types_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use BearerToken_Body_TokenLifetime.ProtoReflect.Descriptor instead. -func (*BearerToken_Body_TokenLifetime) Descriptor() ([]byte, []int) { - return file_acl_grpc_types_proto_rawDescGZIP(), []int{2, 0, 0} -} - -func (x *BearerToken_Body_TokenLifetime) GetExp() uint64 { - if x != nil { - return x.Exp - } - return 0 -} - -func (x *BearerToken_Body_TokenLifetime) GetNbf() uint64 { - if x != nil { - return x.Nbf - } - return 0 -} - -func (x *BearerToken_Body_TokenLifetime) GetIat() uint64 { - if x != nil { - return x.Iat - } - return 0 -} - -// APEOverride is the list of APE chains defined for a target. -// These chains are meant to serve as overrides to the already defined (or -// even undefined) APE chains for the target (see contract `Policy`). -// -// The server-side processing of the bearer token with set APE overrides -// must verify if a client is permitted to override chains for the target, -// preventing unauthorized access through the APE mechanism. -type BearerToken_Body_APEOverride struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Target for which chains are applied. - Target *grpc1.ChainTarget `protobuf:"bytes,1,opt,name=target,proto3" json:"target,omitempty"` - // The list of APE chains. - Chains []*grpc1.Chain `protobuf:"bytes,2,rep,name=chains,proto3" json:"chains,omitempty"` -} - -func (x *BearerToken_Body_APEOverride) Reset() { - *x = BearerToken_Body_APEOverride{} - if protoimpl.UnsafeEnabled { - mi := &file_acl_grpc_types_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *BearerToken_Body_APEOverride) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*BearerToken_Body_APEOverride) ProtoMessage() {} - -func (x *BearerToken_Body_APEOverride) ProtoReflect() protoreflect.Message { - mi := &file_acl_grpc_types_proto_msgTypes[7] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use BearerToken_Body_APEOverride.ProtoReflect.Descriptor instead. -func (*BearerToken_Body_APEOverride) Descriptor() ([]byte, []int) { - return file_acl_grpc_types_proto_rawDescGZIP(), []int{2, 0, 1} -} - -func (x *BearerToken_Body_APEOverride) GetTarget() *grpc1.ChainTarget { - if x != nil { - return x.Target - } - return nil -} - -func (x *BearerToken_Body_APEOverride) GetChains() []*grpc1.Chain { - if x != nil { - return x.Chains - } - return nil -} - -var File_acl_grpc_types_proto protoreflect.FileDescriptor - -var file_acl_grpc_types_proto_rawDesc = []byte{ - 0x0a, 0x14, 0x61, 0x63, 0x6c, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0d, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, - 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x1a, 0x15, 0x72, 0x65, 0x66, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, - 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x14, 0x61, 0x70, - 0x65, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x22, 0xda, 0x03, 0x0a, 0x0a, 0x45, 0x41, 0x43, 0x4c, 0x52, 0x65, 0x63, 0x6f, 0x72, - 0x64, 0x12, 0x36, 0x0a, 0x09, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, - 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x09, - 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2d, 0x0a, 0x06, 0x61, 0x63, 0x74, - 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x15, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, - 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x52, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3a, 0x0a, 0x07, 0x66, 0x69, 0x6c, 0x74, - 0x65, 0x72, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, - 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x45, 0x41, 0x43, 0x4c, 0x52, 0x65, - 0x63, 0x6f, 0x72, 0x64, 0x2e, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x07, 0x66, 0x69, 0x6c, - 0x74, 0x65, 0x72, 0x73, 0x12, 0x3a, 0x0a, 0x07, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x18, - 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, - 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x45, 0x41, 0x43, 0x4c, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, - 0x2e, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x52, 0x07, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, - 0x1a, 0xa5, 0x01, 0x0a, 0x06, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x3a, 0x0a, 0x0b, 0x68, - 0x65, 0x61, 0x64, 0x65, 0x72, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, - 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, - 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x52, 0x0a, 0x68, 0x65, 0x61, - 0x64, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x12, 0x37, 0x0a, 0x0a, 0x6d, 0x61, 0x74, 0x63, 0x68, - 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x6e, 0x65, - 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x4d, 0x61, 0x74, 0x63, - 0x68, 0x54, 0x79, 0x70, 0x65, 0x52, 0x09, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x54, 0x79, 0x70, 0x65, - 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, - 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x1a, 0x45, 0x0a, 0x06, 0x54, 0x61, 0x72, 0x67, - 0x65, 0x74, 0x12, 0x27, 0x0a, 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, - 0x32, 0x13, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, - 0x2e, 0x52, 0x6f, 0x6c, 0x65, 0x52, 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6b, - 0x65, 0x79, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x04, 0x6b, 0x65, 0x79, 0x73, 0x22, - 0xb3, 0x01, 0x0a, 0x09, 0x45, 0x41, 0x43, 0x4c, 0x54, 0x61, 0x62, 0x6c, 0x65, 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, 0x3e, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, - 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, - 0x72, 0x49, 0x44, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, - 0x12, 0x33, 0x0a, 0x07, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, - 0x6c, 0x2e, 0x45, 0x41, 0x43, 0x4c, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x07, 0x72, 0x65, - 0x63, 0x6f, 0x72, 0x64, 0x73, 0x22, 0xf3, 0x04, 0x0a, 0x0b, 0x42, 0x65, 0x61, 0x72, 0x65, 0x72, - 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x33, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, - 0x61, 0x63, 0x6c, 0x2e, 0x42, 0x65, 0x61, 0x72, 0x65, 0x72, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, - 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x37, 0x0a, 0x09, 0x73, 0x69, - 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, - 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, - 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, - 0x75, 0x72, 0x65, 0x1a, 0xf5, 0x03, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x37, 0x0a, 0x0a, - 0x65, 0x61, 0x63, 0x6c, 0x5f, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, - 0x2e, 0x45, 0x41, 0x43, 0x4c, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x52, 0x09, 0x65, 0x61, 0x63, 0x6c, - 0x54, 0x61, 0x62, 0x6c, 0x65, 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, 0x49, 0x0a, 0x08, 0x6c, 0x69, 0x66, - 0x65, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x6e, 0x65, - 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x42, 0x65, 0x61, 0x72, - 0x65, 0x72, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x2e, 0x54, 0x6f, 0x6b, - 0x65, 0x6e, 0x4c, 0x69, 0x66, 0x65, 0x74, 0x69, 0x6d, 0x65, 0x52, 0x08, 0x6c, 0x69, 0x66, 0x65, - 0x74, 0x69, 0x6d, 0x65, 0x12, 0x2b, 0x0a, 0x11, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x5f, 0x69, 0x6d, - 0x70, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x61, 0x74, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, - 0x10, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x49, 0x6d, 0x70, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x61, 0x74, - 0x65, 0x12, 0x4e, 0x0a, 0x0c, 0x61, 0x70, 0x65, 0x5f, 0x6f, 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, - 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, - 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x42, 0x65, 0x61, 0x72, 0x65, 0x72, 0x54, 0x6f, - 0x6b, 0x65, 0x6e, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x2e, 0x41, 0x50, 0x45, 0x4f, 0x76, 0x65, 0x72, - 0x72, 0x69, 0x64, 0x65, 0x52, 0x0b, 0x61, 0x70, 0x65, 0x4f, 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, - 0x65, 0x1a, 0x45, 0x0a, 0x0d, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x4c, 0x69, 0x66, 0x65, 0x74, 0x69, - 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x78, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, - 0x03, 0x65, 0x78, 0x70, 0x12, 0x10, 0x0a, 0x03, 0x6e, 0x62, 0x66, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x04, 0x52, 0x03, 0x6e, 0x62, 0x66, 0x12, 0x10, 0x0a, 0x03, 0x69, 0x61, 0x74, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x04, 0x52, 0x03, 0x69, 0x61, 0x74, 0x1a, 0x71, 0x0a, 0x0b, 0x41, 0x50, 0x45, 0x4f, - 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, 0x65, 0x12, 0x33, 0x0a, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, - 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, - 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, 0x2e, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x54, 0x61, - 0x72, 0x67, 0x65, 0x74, 0x52, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x12, 0x2d, 0x0a, 0x06, - 0x63, 0x68, 0x61, 0x69, 0x6e, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x66, - 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, 0x2e, 0x43, 0x68, - 0x61, 0x69, 0x6e, 0x52, 0x06, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x73, 0x2a, 0x3e, 0x0a, 0x04, 0x52, - 0x6f, 0x6c, 0x65, 0x12, 0x14, 0x0a, 0x10, 0x52, 0x4f, 0x4c, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, - 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x55, 0x53, 0x45, - 0x52, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x53, 0x59, 0x53, 0x54, 0x45, 0x4d, 0x10, 0x02, 0x12, - 0x0a, 0x0a, 0x06, 0x4f, 0x54, 0x48, 0x45, 0x52, 0x53, 0x10, 0x03, 0x2a, 0x4f, 0x0a, 0x09, 0x4d, - 0x61, 0x74, 0x63, 0x68, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1a, 0x0a, 0x16, 0x4d, 0x41, 0x54, 0x43, - 0x48, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, - 0x45, 0x44, 0x10, 0x00, 0x12, 0x10, 0x0a, 0x0c, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x5f, 0x45, - 0x51, 0x55, 0x41, 0x4c, 0x10, 0x01, 0x12, 0x14, 0x0a, 0x10, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, - 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x45, 0x51, 0x55, 0x41, 0x4c, 0x10, 0x02, 0x2a, 0x7a, 0x0a, 0x09, - 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x19, 0x0a, 0x15, 0x4f, 0x50, 0x45, - 0x52, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, - 0x45, 0x44, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x47, 0x45, 0x54, 0x10, 0x01, 0x12, 0x08, 0x0a, - 0x04, 0x48, 0x45, 0x41, 0x44, 0x10, 0x02, 0x12, 0x07, 0x0a, 0x03, 0x50, 0x55, 0x54, 0x10, 0x03, - 0x12, 0x0a, 0x0a, 0x06, 0x44, 0x45, 0x4c, 0x45, 0x54, 0x45, 0x10, 0x04, 0x12, 0x0a, 0x0a, 0x06, - 0x53, 0x45, 0x41, 0x52, 0x43, 0x48, 0x10, 0x05, 0x12, 0x0c, 0x0a, 0x08, 0x47, 0x45, 0x54, 0x52, - 0x41, 0x4e, 0x47, 0x45, 0x10, 0x06, 0x12, 0x10, 0x0a, 0x0c, 0x47, 0x45, 0x54, 0x52, 0x41, 0x4e, - 0x47, 0x45, 0x48, 0x41, 0x53, 0x48, 0x10, 0x07, 0x2a, 0x35, 0x0a, 0x06, 0x41, 0x63, 0x74, 0x69, - 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x12, 0x41, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x53, - 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x41, 0x4c, - 0x4c, 0x4f, 0x57, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x44, 0x45, 0x4e, 0x59, 0x10, 0x02, 0x2a, - 0x4a, 0x0a, 0x0a, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, - 0x12, 0x48, 0x45, 0x41, 0x44, 0x45, 0x52, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, - 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x52, 0x45, 0x51, 0x55, 0x45, 0x53, 0x54, - 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x4f, 0x42, 0x4a, 0x45, 0x43, 0x54, 0x10, 0x02, 0x12, 0x0b, - 0x0a, 0x07, 0x53, 0x45, 0x52, 0x56, 0x49, 0x43, 0x45, 0x10, 0x03, 0x42, 0x58, 0x5a, 0x3c, 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, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x61, - 0x63, 0x6c, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x61, 0x63, 0x6c, 0xaa, 0x02, 0x17, 0x4e, 0x65, - 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, - 0x49, 0x2e, 0x41, 0x63, 0x6c, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_acl_grpc_types_proto_rawDescOnce sync.Once - file_acl_grpc_types_proto_rawDescData = file_acl_grpc_types_proto_rawDesc -) - -func file_acl_grpc_types_proto_rawDescGZIP() []byte { - file_acl_grpc_types_proto_rawDescOnce.Do(func() { - file_acl_grpc_types_proto_rawDescData = protoimpl.X.CompressGZIP(file_acl_grpc_types_proto_rawDescData) - }) - return file_acl_grpc_types_proto_rawDescData -} - -var file_acl_grpc_types_proto_enumTypes = make([]protoimpl.EnumInfo, 5) -var file_acl_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 8) -var file_acl_grpc_types_proto_goTypes = []interface{}{ - (Role)(0), // 0: neo.fs.v2.acl.Role - (MatchType)(0), // 1: neo.fs.v2.acl.MatchType - (Operation)(0), // 2: neo.fs.v2.acl.Operation - (Action)(0), // 3: neo.fs.v2.acl.Action - (HeaderType)(0), // 4: neo.fs.v2.acl.HeaderType - (*EACLRecord)(nil), // 5: neo.fs.v2.acl.EACLRecord - (*EACLTable)(nil), // 6: neo.fs.v2.acl.EACLTable - (*BearerToken)(nil), // 7: neo.fs.v2.acl.BearerToken - (*EACLRecord_Filter)(nil), // 8: neo.fs.v2.acl.EACLRecord.Filter - (*EACLRecord_Target)(nil), // 9: neo.fs.v2.acl.EACLRecord.Target - (*BearerToken_Body)(nil), // 10: neo.fs.v2.acl.BearerToken.Body - (*BearerToken_Body_TokenLifetime)(nil), // 11: neo.fs.v2.acl.BearerToken.Body.TokenLifetime - (*BearerToken_Body_APEOverride)(nil), // 12: neo.fs.v2.acl.BearerToken.Body.APEOverride - (*grpc.Version)(nil), // 13: neo.fs.v2.refs.Version - (*grpc.ContainerID)(nil), // 14: neo.fs.v2.refs.ContainerID - (*grpc.Signature)(nil), // 15: neo.fs.v2.refs.Signature - (*grpc.OwnerID)(nil), // 16: neo.fs.v2.refs.OwnerID - (*grpc1.ChainTarget)(nil), // 17: frostfs.v2.ape.ChainTarget - (*grpc1.Chain)(nil), // 18: frostfs.v2.ape.Chain -} -var file_acl_grpc_types_proto_depIdxs = []int32{ - 2, // 0: neo.fs.v2.acl.EACLRecord.operation:type_name -> neo.fs.v2.acl.Operation - 3, // 1: neo.fs.v2.acl.EACLRecord.action:type_name -> neo.fs.v2.acl.Action - 8, // 2: neo.fs.v2.acl.EACLRecord.filters:type_name -> neo.fs.v2.acl.EACLRecord.Filter - 9, // 3: neo.fs.v2.acl.EACLRecord.targets:type_name -> neo.fs.v2.acl.EACLRecord.Target - 13, // 4: neo.fs.v2.acl.EACLTable.version:type_name -> neo.fs.v2.refs.Version - 14, // 5: neo.fs.v2.acl.EACLTable.container_id:type_name -> neo.fs.v2.refs.ContainerID - 5, // 6: neo.fs.v2.acl.EACLTable.records:type_name -> neo.fs.v2.acl.EACLRecord - 10, // 7: neo.fs.v2.acl.BearerToken.body:type_name -> neo.fs.v2.acl.BearerToken.Body - 15, // 8: neo.fs.v2.acl.BearerToken.signature:type_name -> neo.fs.v2.refs.Signature - 4, // 9: neo.fs.v2.acl.EACLRecord.Filter.header_type:type_name -> neo.fs.v2.acl.HeaderType - 1, // 10: neo.fs.v2.acl.EACLRecord.Filter.match_type:type_name -> neo.fs.v2.acl.MatchType - 0, // 11: neo.fs.v2.acl.EACLRecord.Target.role:type_name -> neo.fs.v2.acl.Role - 6, // 12: neo.fs.v2.acl.BearerToken.Body.eacl_table:type_name -> neo.fs.v2.acl.EACLTable - 16, // 13: neo.fs.v2.acl.BearerToken.Body.owner_id:type_name -> neo.fs.v2.refs.OwnerID - 11, // 14: neo.fs.v2.acl.BearerToken.Body.lifetime:type_name -> neo.fs.v2.acl.BearerToken.Body.TokenLifetime - 12, // 15: neo.fs.v2.acl.BearerToken.Body.ape_override:type_name -> neo.fs.v2.acl.BearerToken.Body.APEOverride - 17, // 16: neo.fs.v2.acl.BearerToken.Body.APEOverride.target:type_name -> frostfs.v2.ape.ChainTarget - 18, // 17: neo.fs.v2.acl.BearerToken.Body.APEOverride.chains:type_name -> frostfs.v2.ape.Chain - 18, // [18:18] is the sub-list for method output_type - 18, // [18:18] is the sub-list for method input_type - 18, // [18:18] is the sub-list for extension type_name - 18, // [18:18] is the sub-list for extension extendee - 0, // [0:18] is the sub-list for field type_name -} - -func init() { file_acl_grpc_types_proto_init() } -func file_acl_grpc_types_proto_init() { - if File_acl_grpc_types_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_acl_grpc_types_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*EACLRecord); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_acl_grpc_types_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*EACLTable); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_acl_grpc_types_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*BearerToken); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_acl_grpc_types_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*EACLRecord_Filter); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_acl_grpc_types_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*EACLRecord_Target); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_acl_grpc_types_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*BearerToken_Body); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_acl_grpc_types_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*BearerToken_Body_TokenLifetime); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_acl_grpc_types_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*BearerToken_Body_APEOverride); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_acl_grpc_types_proto_rawDesc, - NumEnums: 5, - NumMessages: 8, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_acl_grpc_types_proto_goTypes, - DependencyIndexes: file_acl_grpc_types_proto_depIdxs, - EnumInfos: file_acl_grpc_types_proto_enumTypes, - MessageInfos: file_acl_grpc_types_proto_msgTypes, - }.Build() - File_acl_grpc_types_proto = out.File - file_acl_grpc_types_proto_rawDesc = nil - file_acl_grpc_types_proto_goTypes = nil - file_acl_grpc_types_proto_depIdxs = nil -} diff --git a/acl/grpc/types_frostfs.pb.go b/acl/grpc/types_frostfs.pb.go new file mode 100644 index 0000000..e542a19 --- /dev/null +++ b/acl/grpc/types_frostfs.pb.go @@ -0,0 +1,1994 @@ +// Code generated by protoc-gen-go-frostfs. DO NOT EDIT. + +package acl + +import ( + json "encoding/json" + fmt "fmt" + grpc1 "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/ape/grpc" + grpc "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc" + pool "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/pool" + proto "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/proto" + encoding "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/proto/encoding" + easyproto "github.com/VictoriaMetrics/easyproto" + jlexer "github.com/mailru/easyjson/jlexer" + jwriter "github.com/mailru/easyjson/jwriter" + strconv "strconv" +) + +type Role int32 + +const ( + Role_ROLE_UNSPECIFIED Role = 0 + Role_USER Role = 1 + Role_SYSTEM Role = 2 + Role_OTHERS Role = 3 +) + +var ( + Role_name = map[int32]string{ + 0: "ROLE_UNSPECIFIED", + 1: "USER", + 2: "SYSTEM", + 3: "OTHERS", + } + Role_value = map[string]int32{ + "ROLE_UNSPECIFIED": 0, + "USER": 1, + "SYSTEM": 2, + "OTHERS": 3, + } +) + +func (x Role) String() string { + if v, ok := Role_name[int32(x)]; ok { + return v + } + return strconv.FormatInt(int64(x), 10) +} +func (x *Role) FromString(s string) bool { + if v, ok := Role_value[s]; ok { + *x = Role(v) + return true + } + return false +} + +type MatchType int32 + +const ( + MatchType_MATCH_TYPE_UNSPECIFIED MatchType = 0 + MatchType_STRING_EQUAL MatchType = 1 + MatchType_STRING_NOT_EQUAL MatchType = 2 +) + +var ( + MatchType_name = map[int32]string{ + 0: "MATCH_TYPE_UNSPECIFIED", + 1: "STRING_EQUAL", + 2: "STRING_NOT_EQUAL", + } + MatchType_value = map[string]int32{ + "MATCH_TYPE_UNSPECIFIED": 0, + "STRING_EQUAL": 1, + "STRING_NOT_EQUAL": 2, + } +) + +func (x MatchType) String() string { + if v, ok := MatchType_name[int32(x)]; ok { + return v + } + return strconv.FormatInt(int64(x), 10) +} +func (x *MatchType) FromString(s string) bool { + if v, ok := MatchType_value[s]; ok { + *x = MatchType(v) + return true + } + return false +} + +type Operation int32 + +const ( + Operation_OPERATION_UNSPECIFIED Operation = 0 + Operation_GET Operation = 1 + Operation_HEAD Operation = 2 + Operation_PUT Operation = 3 + Operation_DELETE Operation = 4 + Operation_SEARCH Operation = 5 + Operation_GETRANGE Operation = 6 + Operation_GETRANGEHASH Operation = 7 +) + +var ( + Operation_name = map[int32]string{ + 0: "OPERATION_UNSPECIFIED", + 1: "GET", + 2: "HEAD", + 3: "PUT", + 4: "DELETE", + 5: "SEARCH", + 6: "GETRANGE", + 7: "GETRANGEHASH", + } + Operation_value = map[string]int32{ + "OPERATION_UNSPECIFIED": 0, + "GET": 1, + "HEAD": 2, + "PUT": 3, + "DELETE": 4, + "SEARCH": 5, + "GETRANGE": 6, + "GETRANGEHASH": 7, + } +) + +func (x Operation) String() string { + if v, ok := Operation_name[int32(x)]; ok { + return v + } + return strconv.FormatInt(int64(x), 10) +} +func (x *Operation) FromString(s string) bool { + if v, ok := Operation_value[s]; ok { + *x = Operation(v) + return true + } + return false +} + +type Action int32 + +const ( + Action_ACTION_UNSPECIFIED Action = 0 + Action_ALLOW Action = 1 + Action_DENY Action = 2 +) + +var ( + Action_name = map[int32]string{ + 0: "ACTION_UNSPECIFIED", + 1: "ALLOW", + 2: "DENY", + } + Action_value = map[string]int32{ + "ACTION_UNSPECIFIED": 0, + "ALLOW": 1, + "DENY": 2, + } +) + +func (x Action) String() string { + if v, ok := Action_name[int32(x)]; ok { + return v + } + return strconv.FormatInt(int64(x), 10) +} +func (x *Action) FromString(s string) bool { + if v, ok := Action_value[s]; ok { + *x = Action(v) + return true + } + return false +} + +type HeaderType int32 + +const ( + HeaderType_HEADER_UNSPECIFIED HeaderType = 0 + HeaderType_REQUEST HeaderType = 1 + HeaderType_OBJECT HeaderType = 2 + HeaderType_SERVICE HeaderType = 3 +) + +var ( + HeaderType_name = map[int32]string{ + 0: "HEADER_UNSPECIFIED", + 1: "REQUEST", + 2: "OBJECT", + 3: "SERVICE", + } + HeaderType_value = map[string]int32{ + "HEADER_UNSPECIFIED": 0, + "REQUEST": 1, + "OBJECT": 2, + "SERVICE": 3, + } +) + +func (x HeaderType) String() string { + if v, ok := HeaderType_name[int32(x)]; ok { + return v + } + return strconv.FormatInt(int64(x), 10) +} +func (x *HeaderType) FromString(s string) bool { + if v, ok := HeaderType_value[s]; ok { + *x = HeaderType(v) + return true + } + return false +} + +type EACLRecord_Filter struct { + HeaderType HeaderType `json:"headerType"` + MatchType MatchType `json:"matchType"` + Key string `json:"key"` + Value string `json:"value"` +} + +var ( + _ encoding.ProtoMarshaler = (*EACLRecord_Filter)(nil) + _ encoding.ProtoUnmarshaler = (*EACLRecord_Filter)(nil) + _ json.Marshaler = (*EACLRecord_Filter)(nil) + _ json.Unmarshaler = (*EACLRecord_Filter)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *EACLRecord_Filter) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.EnumSize(1, int32(x.HeaderType)) + size += proto.EnumSize(2, int32(x.MatchType)) + size += proto.StringSize(3, x.Key) + size += proto.StringSize(4, x.Value) + return size +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *EACLRecord_Filter) 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 *EACLRecord_Filter) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if int32(x.HeaderType) != 0 { + mm.AppendInt32(1, int32(x.HeaderType)) + } + if int32(x.MatchType) != 0 { + mm.AppendInt32(2, int32(x.MatchType)) + } + if len(x.Key) != 0 { + mm.AppendString(3, x.Key) + } + if len(x.Value) != 0 { + mm.AppendString(4, x.Value) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *EACLRecord_Filter) 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", "EACLRecord_Filter") + } + switch fc.FieldNum { + case 1: // HeaderType + data, ok := fc.Int32() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "HeaderType") + } + x.HeaderType = HeaderType(data) + case 2: // MatchType + data, ok := fc.Int32() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "MatchType") + } + x.MatchType = MatchType(data) + case 3: // Key + data, ok := fc.String() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Key") + } + x.Key = data + case 4: // Value + data, ok := fc.String() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Value") + } + x.Value = data + } + } + return nil +} +func (x *EACLRecord_Filter) GetHeaderType() HeaderType { + if x != nil { + return x.HeaderType + } + return 0 +} +func (x *EACLRecord_Filter) SetHeaderType(v HeaderType) { + x.HeaderType = v +} +func (x *EACLRecord_Filter) GetMatchType() MatchType { + if x != nil { + return x.MatchType + } + return 0 +} +func (x *EACLRecord_Filter) SetMatchType(v MatchType) { + x.MatchType = v +} +func (x *EACLRecord_Filter) GetKey() string { + if x != nil { + return x.Key + } + return "" +} +func (x *EACLRecord_Filter) SetKey(v string) { + x.Key = v +} +func (x *EACLRecord_Filter) GetValue() string { + if x != nil { + return x.Value + } + return "" +} +func (x *EACLRecord_Filter) SetValue(v string) { + x.Value = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *EACLRecord_Filter) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *EACLRecord_Filter) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"headerType\":" + out.RawString(prefix[1:]) + out.Int32(int32(x.HeaderType)) + } + { + const prefix string = ",\"matchType\":" + out.RawString(prefix) + out.Int32(int32(x.MatchType)) + } + { + const prefix string = ",\"key\":" + out.RawString(prefix) + out.String(x.Key) + } + { + const prefix string = ",\"value\":" + out.RawString(prefix) + out.String(x.Value) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *EACLRecord_Filter) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *EACLRecord_Filter) 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 "headerType": + { + var f HeaderType + var parsedValue HeaderType + switch v := in.Interface().(type) { + case string: + if vv, ok := HeaderType_value[v]; ok { + parsedValue = HeaderType(vv) + break + } + vv, err := strconv.ParseInt(v, 10, 32) + if err != nil { + in.AddError(err) + return + } + parsedValue = HeaderType(vv) + case float64: + parsedValue = HeaderType(v) + } + f = parsedValue + x.HeaderType = f + } + case "matchType": + { + var f MatchType + var parsedValue MatchType + switch v := in.Interface().(type) { + case string: + if vv, ok := MatchType_value[v]; ok { + parsedValue = MatchType(vv) + break + } + vv, err := strconv.ParseInt(v, 10, 32) + if err != nil { + in.AddError(err) + return + } + parsedValue = MatchType(vv) + case float64: + parsedValue = MatchType(v) + } + f = parsedValue + x.MatchType = f + } + 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 EACLRecord_Target struct { + Role Role `json:"role"` + Keys [][]byte `json:"keys"` +} + +var ( + _ encoding.ProtoMarshaler = (*EACLRecord_Target)(nil) + _ encoding.ProtoUnmarshaler = (*EACLRecord_Target)(nil) + _ json.Marshaler = (*EACLRecord_Target)(nil) + _ json.Unmarshaler = (*EACLRecord_Target)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *EACLRecord_Target) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.EnumSize(1, int32(x.Role)) + size += proto.RepeatedBytesSize(2, x.Keys) + return size +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *EACLRecord_Target) 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 *EACLRecord_Target) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if int32(x.Role) != 0 { + mm.AppendInt32(1, int32(x.Role)) + } + for j := range x.Keys { + mm.AppendBytes(2, x.Keys[j]) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *EACLRecord_Target) 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", "EACLRecord_Target") + } + switch fc.FieldNum { + case 1: // Role + data, ok := fc.Int32() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Role") + } + x.Role = Role(data) + case 2: // Keys + data, ok := fc.Bytes() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Keys") + } + x.Keys = append(x.Keys, data) + } + } + return nil +} +func (x *EACLRecord_Target) GetRole() Role { + if x != nil { + return x.Role + } + return 0 +} +func (x *EACLRecord_Target) SetRole(v Role) { + x.Role = v +} +func (x *EACLRecord_Target) GetKeys() [][]byte { + if x != nil { + return x.Keys + } + return nil +} +func (x *EACLRecord_Target) SetKeys(v [][]byte) { + x.Keys = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *EACLRecord_Target) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *EACLRecord_Target) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"role\":" + out.RawString(prefix[1:]) + out.Int32(int32(x.Role)) + } + { + const prefix string = ",\"keys\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.Keys { + if i != 0 { + out.RawByte(',') + } + out.Base64Bytes(x.Keys[i]) + } + out.RawByte(']') + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *EACLRecord_Target) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *EACLRecord_Target) 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 "role": + { + var f Role + var parsedValue Role + switch v := in.Interface().(type) { + case string: + if vv, ok := Role_value[v]; ok { + parsedValue = Role(vv) + break + } + vv, err := strconv.ParseInt(v, 10, 32) + if err != nil { + in.AddError(err) + return + } + parsedValue = Role(vv) + case float64: + parsedValue = Role(v) + } + f = parsedValue + x.Role = f + } + case "keys": + { + var f []byte + var list [][]byte + in.Delim('[') + for !in.IsDelim(']') { + f = in.Bytes() + list = append(list, f) + in.WantComma() + } + x.Keys = list + in.Delim(']') + } + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} + +type EACLRecord struct { + Operation Operation `json:"operation"` + Action Action `json:"action"` + Filters []*EACLRecord_Filter `json:"filters"` + Targets []*EACLRecord_Target `json:"targets"` +} + +var ( + _ encoding.ProtoMarshaler = (*EACLRecord)(nil) + _ encoding.ProtoUnmarshaler = (*EACLRecord)(nil) + _ json.Marshaler = (*EACLRecord)(nil) + _ json.Unmarshaler = (*EACLRecord)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *EACLRecord) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.EnumSize(1, int32(x.Operation)) + size += proto.EnumSize(2, int32(x.Action)) + for i := range x.Filters { + size += proto.NestedStructureSize(3, x.Filters[i]) + } + for i := range x.Targets { + size += proto.NestedStructureSize(4, x.Targets[i]) + } + return size +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *EACLRecord) 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 *EACLRecord) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if int32(x.Operation) != 0 { + mm.AppendInt32(1, int32(x.Operation)) + } + if int32(x.Action) != 0 { + mm.AppendInt32(2, int32(x.Action)) + } + for i := range x.Filters { + if x.Filters[i] != nil && x.Filters[i].StableSize() != 0 { + x.Filters[i].EmitProtobuf(mm.AppendMessage(3)) + } + } + for i := range x.Targets { + if x.Targets[i] != nil && x.Targets[i].StableSize() != 0 { + x.Targets[i].EmitProtobuf(mm.AppendMessage(4)) + } + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *EACLRecord) 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", "EACLRecord") + } + switch fc.FieldNum { + case 1: // Operation + data, ok := fc.Int32() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Operation") + } + x.Operation = Operation(data) + case 2: // Action + data, ok := fc.Int32() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Action") + } + x.Action = Action(data) + case 3: // Filters + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Filters") + } + x.Filters = append(x.Filters, new(EACLRecord_Filter)) + ff := x.Filters[len(x.Filters)-1] + if err := ff.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + case 4: // Targets + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Targets") + } + x.Targets = append(x.Targets, new(EACLRecord_Target)) + ff := x.Targets[len(x.Targets)-1] + if err := ff.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + } + } + return nil +} +func (x *EACLRecord) GetOperation() Operation { + if x != nil { + return x.Operation + } + return 0 +} +func (x *EACLRecord) SetOperation(v Operation) { + x.Operation = v +} +func (x *EACLRecord) GetAction() Action { + if x != nil { + return x.Action + } + return 0 +} +func (x *EACLRecord) SetAction(v Action) { + x.Action = v +} +func (x *EACLRecord) GetFilters() []*EACLRecord_Filter { + if x != nil { + return x.Filters + } + return nil +} +func (x *EACLRecord) SetFilters(v []*EACLRecord_Filter) { + x.Filters = v +} +func (x *EACLRecord) GetTargets() []*EACLRecord_Target { + if x != nil { + return x.Targets + } + return nil +} +func (x *EACLRecord) SetTargets(v []*EACLRecord_Target) { + x.Targets = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *EACLRecord) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *EACLRecord) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"operation\":" + out.RawString(prefix[1:]) + out.Int32(int32(x.Operation)) + } + { + const prefix string = ",\"action\":" + out.RawString(prefix) + out.Int32(int32(x.Action)) + } + { + const prefix string = ",\"filters\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.Filters { + if i != 0 { + out.RawByte(',') + } + x.Filters[i].MarshalEasyJSON(out) + } + out.RawByte(']') + } + { + const prefix string = ",\"targets\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.Targets { + if i != 0 { + out.RawByte(',') + } + x.Targets[i].MarshalEasyJSON(out) + } + out.RawByte(']') + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *EACLRecord) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *EACLRecord) 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 "operation": + { + var f Operation + var parsedValue Operation + switch v := in.Interface().(type) { + case string: + if vv, ok := Operation_value[v]; ok { + parsedValue = Operation(vv) + break + } + vv, err := strconv.ParseInt(v, 10, 32) + if err != nil { + in.AddError(err) + return + } + parsedValue = Operation(vv) + case float64: + parsedValue = Operation(v) + } + f = parsedValue + x.Operation = f + } + case "action": + { + var f Action + var parsedValue Action + switch v := in.Interface().(type) { + case string: + if vv, ok := Action_value[v]; ok { + parsedValue = Action(vv) + break + } + vv, err := strconv.ParseInt(v, 10, 32) + if err != nil { + in.AddError(err) + return + } + parsedValue = Action(vv) + case float64: + parsedValue = Action(v) + } + f = parsedValue + x.Action = f + } + case "filters": + { + var f *EACLRecord_Filter + var list []*EACLRecord_Filter + in.Delim('[') + for !in.IsDelim(']') { + f = new(EACLRecord_Filter) + f.UnmarshalEasyJSON(in) + list = append(list, f) + in.WantComma() + } + x.Filters = list + in.Delim(']') + } + case "targets": + { + var f *EACLRecord_Target + var list []*EACLRecord_Target + in.Delim('[') + for !in.IsDelim(']') { + f = new(EACLRecord_Target) + f.UnmarshalEasyJSON(in) + list = append(list, f) + in.WantComma() + } + x.Targets = list + in.Delim(']') + } + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} + +type EACLTable struct { + Version *grpc.Version `json:"version"` + ContainerId *grpc.ContainerID `json:"containerID"` + Records []*EACLRecord `json:"records"` +} + +var ( + _ encoding.ProtoMarshaler = (*EACLTable)(nil) + _ encoding.ProtoUnmarshaler = (*EACLTable)(nil) + _ json.Marshaler = (*EACLTable)(nil) + _ json.Unmarshaler = (*EACLTable)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *EACLTable) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.NestedStructureSize(1, x.Version) + size += proto.NestedStructureSize(2, x.ContainerId) + for i := range x.Records { + size += proto.NestedStructureSize(3, x.Records[i]) + } + return size +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *EACLTable) 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 *EACLTable) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if x.Version != nil && x.Version.StableSize() != 0 { + x.Version.EmitProtobuf(mm.AppendMessage(1)) + } + if x.ContainerId != nil && x.ContainerId.StableSize() != 0 { + x.ContainerId.EmitProtobuf(mm.AppendMessage(2)) + } + for i := range x.Records { + if x.Records[i] != nil && x.Records[i].StableSize() != 0 { + x.Records[i].EmitProtobuf(mm.AppendMessage(3)) + } + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *EACLTable) 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", "EACLTable") + } + 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: // ContainerId + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "ContainerId") + } + x.ContainerId = new(grpc.ContainerID) + if err := x.ContainerId.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + case 3: // Records + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Records") + } + x.Records = append(x.Records, new(EACLRecord)) + ff := x.Records[len(x.Records)-1] + if err := ff.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + } + } + return nil +} +func (x *EACLTable) GetVersion() *grpc.Version { + if x != nil { + return x.Version + } + return nil +} +func (x *EACLTable) SetVersion(v *grpc.Version) { + x.Version = v +} +func (x *EACLTable) GetContainerId() *grpc.ContainerID { + if x != nil { + return x.ContainerId + } + return nil +} +func (x *EACLTable) SetContainerId(v *grpc.ContainerID) { + x.ContainerId = v +} +func (x *EACLTable) GetRecords() []*EACLRecord { + if x != nil { + return x.Records + } + return nil +} +func (x *EACLTable) SetRecords(v []*EACLRecord) { + x.Records = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *EACLTable) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *EACLTable) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"version\":" + out.RawString(prefix[1:]) + x.Version.MarshalEasyJSON(out) + } + { + const prefix string = ",\"containerID\":" + out.RawString(prefix) + x.ContainerId.MarshalEasyJSON(out) + } + { + const prefix string = ",\"records\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.Records { + if i != 0 { + out.RawByte(',') + } + x.Records[i].MarshalEasyJSON(out) + } + out.RawByte(']') + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *EACLTable) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *EACLTable) 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 "containerID": + { + var f *grpc.ContainerID + f = new(grpc.ContainerID) + f.UnmarshalEasyJSON(in) + x.ContainerId = f + } + case "records": + { + var f *EACLRecord + var list []*EACLRecord + in.Delim('[') + for !in.IsDelim(']') { + f = new(EACLRecord) + f.UnmarshalEasyJSON(in) + list = append(list, f) + in.WantComma() + } + x.Records = list + in.Delim(']') + } + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} + +type BearerToken_Body_TokenLifetime struct { + Exp uint64 `json:"exp"` + Nbf uint64 `json:"nbf"` + Iat uint64 `json:"iat"` +} + +var ( + _ encoding.ProtoMarshaler = (*BearerToken_Body_TokenLifetime)(nil) + _ encoding.ProtoUnmarshaler = (*BearerToken_Body_TokenLifetime)(nil) + _ json.Marshaler = (*BearerToken_Body_TokenLifetime)(nil) + _ json.Unmarshaler = (*BearerToken_Body_TokenLifetime)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *BearerToken_Body_TokenLifetime) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.UInt64Size(1, x.Exp) + size += proto.UInt64Size(2, x.Nbf) + size += proto.UInt64Size(3, x.Iat) + return size +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *BearerToken_Body_TokenLifetime) 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 *BearerToken_Body_TokenLifetime) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if x.Exp != 0 { + mm.AppendUint64(1, x.Exp) + } + if x.Nbf != 0 { + mm.AppendUint64(2, x.Nbf) + } + if x.Iat != 0 { + mm.AppendUint64(3, x.Iat) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *BearerToken_Body_TokenLifetime) 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", "BearerToken_Body_TokenLifetime") + } + switch fc.FieldNum { + case 1: // Exp + data, ok := fc.Uint64() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Exp") + } + x.Exp = data + case 2: // Nbf + data, ok := fc.Uint64() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Nbf") + } + x.Nbf = data + case 3: // Iat + data, ok := fc.Uint64() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Iat") + } + x.Iat = data + } + } + return nil +} +func (x *BearerToken_Body_TokenLifetime) GetExp() uint64 { + if x != nil { + return x.Exp + } + return 0 +} +func (x *BearerToken_Body_TokenLifetime) SetExp(v uint64) { + x.Exp = v +} +func (x *BearerToken_Body_TokenLifetime) GetNbf() uint64 { + if x != nil { + return x.Nbf + } + return 0 +} +func (x *BearerToken_Body_TokenLifetime) SetNbf(v uint64) { + x.Nbf = v +} +func (x *BearerToken_Body_TokenLifetime) GetIat() uint64 { + if x != nil { + return x.Iat + } + return 0 +} +func (x *BearerToken_Body_TokenLifetime) SetIat(v uint64) { + x.Iat = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *BearerToken_Body_TokenLifetime) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *BearerToken_Body_TokenLifetime) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"exp\":" + out.RawString(prefix[1:]) + out.Uint64(x.Exp) + } + { + const prefix string = ",\"nbf\":" + out.RawString(prefix) + out.Uint64(x.Nbf) + } + { + const prefix string = ",\"iat\":" + out.RawString(prefix) + out.Uint64(x.Iat) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *BearerToken_Body_TokenLifetime) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *BearerToken_Body_TokenLifetime) 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 "exp": + { + var f uint64 + f = in.Uint64() + x.Exp = f + } + case "nbf": + { + var f uint64 + f = in.Uint64() + x.Nbf = f + } + case "iat": + { + var f uint64 + f = in.Uint64() + x.Iat = f + } + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} + +type BearerToken_Body_APEOverride struct { + Target *grpc1.ChainTarget `json:"target"` + Chains []*grpc1.Chain `json:"chains"` +} + +var ( + _ encoding.ProtoMarshaler = (*BearerToken_Body_APEOverride)(nil) + _ encoding.ProtoUnmarshaler = (*BearerToken_Body_APEOverride)(nil) + _ json.Marshaler = (*BearerToken_Body_APEOverride)(nil) + _ json.Unmarshaler = (*BearerToken_Body_APEOverride)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *BearerToken_Body_APEOverride) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.NestedStructureSize(1, x.Target) + for i := range x.Chains { + size += proto.NestedStructureSize(2, x.Chains[i]) + } + return size +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *BearerToken_Body_APEOverride) 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 *BearerToken_Body_APEOverride) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if x.Target != nil && x.Target.StableSize() != 0 { + x.Target.EmitProtobuf(mm.AppendMessage(1)) + } + for i := range x.Chains { + if x.Chains[i] != nil && x.Chains[i].StableSize() != 0 { + x.Chains[i].EmitProtobuf(mm.AppendMessage(2)) + } + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *BearerToken_Body_APEOverride) 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", "BearerToken_Body_APEOverride") + } + switch fc.FieldNum { + case 1: // Target + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Target") + } + x.Target = new(grpc1.ChainTarget) + if err := x.Target.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + case 2: // Chains + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Chains") + } + x.Chains = append(x.Chains, new(grpc1.Chain)) + ff := x.Chains[len(x.Chains)-1] + if err := ff.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + } + } + return nil +} +func (x *BearerToken_Body_APEOverride) GetTarget() *grpc1.ChainTarget { + if x != nil { + return x.Target + } + return nil +} +func (x *BearerToken_Body_APEOverride) SetTarget(v *grpc1.ChainTarget) { + x.Target = v +} +func (x *BearerToken_Body_APEOverride) GetChains() []*grpc1.Chain { + if x != nil { + return x.Chains + } + return nil +} +func (x *BearerToken_Body_APEOverride) SetChains(v []*grpc1.Chain) { + x.Chains = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *BearerToken_Body_APEOverride) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *BearerToken_Body_APEOverride) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"target\":" + out.RawString(prefix[1:]) + x.Target.MarshalEasyJSON(out) + } + { + const prefix string = ",\"chains\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.Chains { + if i != 0 { + out.RawByte(',') + } + x.Chains[i].MarshalEasyJSON(out) + } + out.RawByte(']') + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *BearerToken_Body_APEOverride) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *BearerToken_Body_APEOverride) 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 "target": + { + var f *grpc1.ChainTarget + f = new(grpc1.ChainTarget) + f.UnmarshalEasyJSON(in) + x.Target = f + } + case "chains": + { + var f *grpc1.Chain + var list []*grpc1.Chain + in.Delim('[') + for !in.IsDelim(']') { + f = new(grpc1.Chain) + f.UnmarshalEasyJSON(in) + list = append(list, f) + in.WantComma() + } + x.Chains = list + in.Delim(']') + } + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} + +type BearerToken_Body struct { + EaclTable *EACLTable `json:"eaclTable"` + OwnerId *grpc.OwnerID `json:"ownerID"` + Lifetime *BearerToken_Body_TokenLifetime `json:"lifetime"` + AllowImpersonate bool `json:"allowImpersonate"` + ApeOverride *BearerToken_Body_APEOverride `json:"apeOverride"` +} + +var ( + _ encoding.ProtoMarshaler = (*BearerToken_Body)(nil) + _ encoding.ProtoUnmarshaler = (*BearerToken_Body)(nil) + _ json.Marshaler = (*BearerToken_Body)(nil) + _ json.Unmarshaler = (*BearerToken_Body)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *BearerToken_Body) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.NestedStructureSize(1, x.EaclTable) + size += proto.NestedStructureSize(2, x.OwnerId) + size += proto.NestedStructureSize(3, x.Lifetime) + size += proto.BoolSize(4, x.AllowImpersonate) + size += proto.NestedStructureSize(5, x.ApeOverride) + return size +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *BearerToken_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 *BearerToken_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if x.EaclTable != nil && x.EaclTable.StableSize() != 0 { + x.EaclTable.EmitProtobuf(mm.AppendMessage(1)) + } + if x.OwnerId != nil && x.OwnerId.StableSize() != 0 { + x.OwnerId.EmitProtobuf(mm.AppendMessage(2)) + } + if x.Lifetime != nil && x.Lifetime.StableSize() != 0 { + x.Lifetime.EmitProtobuf(mm.AppendMessage(3)) + } + if x.AllowImpersonate { + mm.AppendBool(4, x.AllowImpersonate) + } + if x.ApeOverride != nil && x.ApeOverride.StableSize() != 0 { + x.ApeOverride.EmitProtobuf(mm.AppendMessage(5)) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *BearerToken_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", "BearerToken_Body") + } + switch fc.FieldNum { + case 1: // EaclTable + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "EaclTable") + } + x.EaclTable = new(EACLTable) + if err := x.EaclTable.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: // Lifetime + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Lifetime") + } + x.Lifetime = new(BearerToken_Body_TokenLifetime) + if err := x.Lifetime.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + case 4: // AllowImpersonate + data, ok := fc.Bool() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "AllowImpersonate") + } + x.AllowImpersonate = data + case 5: // ApeOverride + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "ApeOverride") + } + x.ApeOverride = new(BearerToken_Body_APEOverride) + if err := x.ApeOverride.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + } + } + return nil +} +func (x *BearerToken_Body) GetEaclTable() *EACLTable { + if x != nil { + return x.EaclTable + } + return nil +} +func (x *BearerToken_Body) SetEaclTable(v *EACLTable) { + x.EaclTable = v +} +func (x *BearerToken_Body) GetOwnerId() *grpc.OwnerID { + if x != nil { + return x.OwnerId + } + return nil +} +func (x *BearerToken_Body) SetOwnerId(v *grpc.OwnerID) { + x.OwnerId = v +} +func (x *BearerToken_Body) GetLifetime() *BearerToken_Body_TokenLifetime { + if x != nil { + return x.Lifetime + } + return nil +} +func (x *BearerToken_Body) SetLifetime(v *BearerToken_Body_TokenLifetime) { + x.Lifetime = v +} +func (x *BearerToken_Body) GetAllowImpersonate() bool { + if x != nil { + return x.AllowImpersonate + } + return false +} +func (x *BearerToken_Body) SetAllowImpersonate(v bool) { + x.AllowImpersonate = v +} +func (x *BearerToken_Body) GetApeOverride() *BearerToken_Body_APEOverride { + if x != nil { + return x.ApeOverride + } + return nil +} +func (x *BearerToken_Body) SetApeOverride(v *BearerToken_Body_APEOverride) { + x.ApeOverride = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *BearerToken_Body) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *BearerToken_Body) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"eaclTable\":" + out.RawString(prefix[1:]) + x.EaclTable.MarshalEasyJSON(out) + } + { + const prefix string = ",\"ownerID\":" + out.RawString(prefix) + x.OwnerId.MarshalEasyJSON(out) + } + { + const prefix string = ",\"lifetime\":" + out.RawString(prefix) + x.Lifetime.MarshalEasyJSON(out) + } + { + const prefix string = ",\"allowImpersonate\":" + out.RawString(prefix) + out.Bool(x.AllowImpersonate) + } + { + const prefix string = ",\"apeOverride\":" + out.RawString(prefix) + x.ApeOverride.MarshalEasyJSON(out) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *BearerToken_Body) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *BearerToken_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 "eaclTable": + { + var f *EACLTable + f = new(EACLTable) + f.UnmarshalEasyJSON(in) + x.EaclTable = f + } + case "ownerID": + { + var f *grpc.OwnerID + f = new(grpc.OwnerID) + f.UnmarshalEasyJSON(in) + x.OwnerId = f + } + case "lifetime": + { + var f *BearerToken_Body_TokenLifetime + f = new(BearerToken_Body_TokenLifetime) + f.UnmarshalEasyJSON(in) + x.Lifetime = f + } + case "allowImpersonate": + { + var f bool + f = in.Bool() + x.AllowImpersonate = f + } + case "apeOverride": + { + var f *BearerToken_Body_APEOverride + f = new(BearerToken_Body_APEOverride) + f.UnmarshalEasyJSON(in) + x.ApeOverride = f + } + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} + +type BearerToken struct { + Body *BearerToken_Body `json:"body"` + Signature *grpc.Signature `json:"signature"` +} + +var ( + _ encoding.ProtoMarshaler = (*BearerToken)(nil) + _ encoding.ProtoUnmarshaler = (*BearerToken)(nil) + _ json.Marshaler = (*BearerToken)(nil) + _ json.Unmarshaler = (*BearerToken)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *BearerToken) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.NestedStructureSize(1, x.Body) + size += proto.NestedStructureSize(2, x.Signature) + return size +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *BearerToken) 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 *BearerToken) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if x.Body != nil && x.Body.StableSize() != 0 { + x.Body.EmitProtobuf(mm.AppendMessage(1)) + } + if x.Signature != nil && x.Signature.StableSize() != 0 { + x.Signature.EmitProtobuf(mm.AppendMessage(2)) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *BearerToken) 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", "BearerToken") + } + switch fc.FieldNum { + case 1: // Body + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Body") + } + x.Body = new(BearerToken_Body) + if err := x.Body.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + case 2: // Signature + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Signature") + } + x.Signature = new(grpc.Signature) + if err := x.Signature.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + } + } + return nil +} +func (x *BearerToken) GetBody() *BearerToken_Body { + if x != nil { + return x.Body + } + return nil +} +func (x *BearerToken) SetBody(v *BearerToken_Body) { + x.Body = v +} +func (x *BearerToken) GetSignature() *grpc.Signature { + if x != nil { + return x.Signature + } + return nil +} +func (x *BearerToken) SetSignature(v *grpc.Signature) { + x.Signature = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *BearerToken) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *BearerToken) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"body\":" + out.RawString(prefix[1:]) + x.Body.MarshalEasyJSON(out) + } + { + const prefix string = ",\"signature\":" + out.RawString(prefix) + x.Signature.MarshalEasyJSON(out) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *BearerToken) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *BearerToken) 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 *BearerToken_Body + f = new(BearerToken_Body) + f.UnmarshalEasyJSON(in) + x.Body = f + } + case "signature": + { + var f *grpc.Signature + f = new(grpc.Signature) + f.UnmarshalEasyJSON(in) + x.Signature = f + } + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} diff --git a/acl/grpc/types_frostfs_fuzz.go b/acl/grpc/types_frostfs_fuzz.go new file mode 100644 index 0000000..5d5b763 --- /dev/null +++ b/acl/grpc/types_frostfs_fuzz.go @@ -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 +} diff --git a/acl/grpc/types_frostfs_test.go b/acl/grpc/types_frostfs_test.go new file mode 100644 index 0000000..c6d1c43 --- /dev/null +++ b/acl/grpc/types_frostfs_test.go @@ -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) + }) +} diff --git a/ape/grpc/types.go b/ape/grpc/types.go deleted file mode 100644 index 931b6a3..0000000 --- a/ape/grpc/types.go +++ /dev/null @@ -1,21 +0,0 @@ -package ape - -func (t *ChainTarget) SetType(typ TargetType) { - t.Type = typ -} - -func (t *ChainTarget) SetName(name string) { - t.Name = name -} - -func (c *Chain) SetKind(kind isChain_Kind) { - c.Kind = kind -} - -func (cr *Chain_Raw) SetRaw(raw []byte) { - cr.Raw = raw -} - -func (cr *Chain_Raw) GetRaw() []byte { - return cr.Raw -} diff --git a/ape/grpc/types.pb.go b/ape/grpc/types.pb.go deleted file mode 100644 index ee8e0a7..0000000 --- a/ape/grpc/types.pb.go +++ /dev/null @@ -1,310 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.33.0 -// protoc v5.27.2 -// source: ape/grpc/types.proto - -package ape - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -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_ape_grpc_types_proto_enumTypes[0].Descriptor() -} - -func (TargetType) Type() protoreflect.EnumType { - return &file_ape_grpc_types_proto_enumTypes[0] -} - -func (x TargetType) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use TargetType.Descriptor instead. -func (TargetType) EnumDescriptor() ([]byte, []int) { - return file_ape_grpc_types_proto_rawDescGZIP(), []int{0} -} - -// ChainTarget is an object to which a rule chain is defined. -type ChainTarget struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Type TargetType `protobuf:"varint,1,opt,name=type,proto3,enum=frostfs.v2.ape.TargetType" json:"type,omitempty"` - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` -} - -func (x *ChainTarget) Reset() { - *x = ChainTarget{} - if protoimpl.UnsafeEnabled { - mi := &file_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_ape_grpc_types_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ChainTarget.ProtoReflect.Descriptor instead. -func (*ChainTarget) Descriptor() ([]byte, []int) { - return file_ape_grpc_types_proto_rawDescGZIP(), []int{0} -} - -func (x *ChainTarget) GetType() TargetType { - if x != nil { - return x.Type - } - return TargetType_UNDEFINED -} - -func (x *ChainTarget) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -// Chain is a chain of rules defined for a specific target. -type Chain struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to Kind: - // - // *Chain_Raw - Kind isChain_Kind `protobuf_oneof:"kind"` -} - -func (x *Chain) Reset() { - *x = Chain{} - if protoimpl.UnsafeEnabled { - mi := &file_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_ape_grpc_types_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Chain.ProtoReflect.Descriptor instead. -func (*Chain) Descriptor() ([]byte, []int) { - return file_ape_grpc_types_proto_rawDescGZIP(), []int{1} -} - -func (m *Chain) GetKind() isChain_Kind { - if m != nil { - return m.Kind - } - return nil -} - -func (x *Chain) GetRaw() []byte { - if x, ok := x.GetKind().(*Chain_Raw); ok { - return x.Raw - } - return nil -} - -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,proto3,oneof"` -} - -func (*Chain_Raw) isChain_Kind() {} - -var File_ape_grpc_types_proto protoreflect.FileDescriptor - -var file_ape_grpc_types_proto_rawDesc = []byte{ - 0x0a, 0x14, 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, 0x3e, - 0x5a, 0x3c, 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, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, - 0x32, 0x2f, 0x61, 0x70, 0x65, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x61, 0x70, 0x65, 0x62, 0x06, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_ape_grpc_types_proto_rawDescOnce sync.Once - file_ape_grpc_types_proto_rawDescData = file_ape_grpc_types_proto_rawDesc -) - -func file_ape_grpc_types_proto_rawDescGZIP() []byte { - file_ape_grpc_types_proto_rawDescOnce.Do(func() { - file_ape_grpc_types_proto_rawDescData = protoimpl.X.CompressGZIP(file_ape_grpc_types_proto_rawDescData) - }) - return file_ape_grpc_types_proto_rawDescData -} - -var file_ape_grpc_types_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_ape_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_ape_grpc_types_proto_goTypes = []interface{}{ - (TargetType)(0), // 0: frostfs.v2.ape.TargetType - (*ChainTarget)(nil), // 1: frostfs.v2.ape.ChainTarget - (*Chain)(nil), // 2: frostfs.v2.ape.Chain -} -var file_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_ape_grpc_types_proto_init() } -func file_ape_grpc_types_proto_init() { - if File_ape_grpc_types_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_ape_grpc_types_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ChainTarget); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_ape_grpc_types_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Chain); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - file_ape_grpc_types_proto_msgTypes[1].OneofWrappers = []interface{}{ - (*Chain_Raw)(nil), - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_ape_grpc_types_proto_rawDesc, - NumEnums: 1, - NumMessages: 2, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_ape_grpc_types_proto_goTypes, - DependencyIndexes: file_ape_grpc_types_proto_depIdxs, - EnumInfos: file_ape_grpc_types_proto_enumTypes, - MessageInfos: file_ape_grpc_types_proto_msgTypes, - }.Build() - File_ape_grpc_types_proto = out.File - file_ape_grpc_types_proto_rawDesc = nil - file_ape_grpc_types_proto_goTypes = nil - file_ape_grpc_types_proto_depIdxs = nil -} diff --git a/ape/grpc/types_frostfs.pb.go b/ape/grpc/types_frostfs.pb.go new file mode 100644 index 0000000..1e92f22 --- /dev/null +++ b/ape/grpc/types_frostfs.pb.go @@ -0,0 +1,400 @@ +// Code generated by protoc-gen-go-frostfs. DO NOT EDIT. + +package ape + +import ( + json "encoding/json" + fmt "fmt" + pool "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/pool" + proto "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/proto" + encoding "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/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 + } + out.RawByte('{') + { + const prefix string = ",\"type\":" + out.RawString(prefix[1:]) + out.Int32(int32(x.Type)) + } + { + 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() *Chain_Raw { + if xx, ok := x.GetKind().(*Chain_Raw); ok { + return xx + } + 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 + } + out.RawByte('{') + switch xx := x.Kind.(type) { + case *Chain_Raw: + { + const prefix string = ",\"raw\":" + out.RawString(prefix[1:]) + out.Base64Bytes(xx.Raw) + } + default: + out.RawString("null") + } + 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 + f = in.Bytes() + 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() {} diff --git a/ape/grpc/types_frostfs_fuzz.go b/ape/grpc/types_frostfs_fuzz.go new file mode 100644 index 0000000..b7bf367 --- /dev/null +++ b/ape/grpc/types_frostfs_fuzz.go @@ -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 +} diff --git a/ape/grpc/types_frostfs_test.go b/ape/grpc/types_frostfs_test.go new file mode 100644 index 0000000..93d7eea --- /dev/null +++ b/ape/grpc/types_frostfs_test.go @@ -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) + }) +} diff --git a/apemanager/grpc/service.go b/apemanager/grpc/service.go deleted file mode 100644 index bd77db0..0000000 --- a/apemanager/grpc/service.go +++ /dev/null @@ -1,106 +0,0 @@ -package apemanager - -import ( - ape "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/ape/grpc" - session "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session/grpc" -) - -func (rb *AddChainRequest_Body) SetTarget(t *ape.ChainTarget) { - rb.Target = t -} - -func (rb *AddChainRequest_Body) SetChain(chain *ape.Chain) { - rb.Chain = chain -} - -func (r *AddChainRequest) SetBody(rb *AddChainRequest_Body) { - r.Body = rb -} - -func (r *AddChainRequest) SetMetaHeader(mh *session.RequestMetaHeader) { - r.MetaHeader = mh -} - -func (r *AddChainRequest) SetVerifyHeader(vh *session.RequestVerificationHeader) { - r.VerifyHeader = vh -} - -func (rb *AddChainResponse_Body) SetChainId(chainID []byte) { - rb.ChainId = chainID -} - -func (r *AddChainResponse) SetBody(rb *AddChainResponse_Body) { - r.Body = rb -} - -func (r *AddChainResponse) SetMetaHeader(mh *session.ResponseMetaHeader) { - r.MetaHeader = mh -} - -func (r *AddChainResponse) SetVerifyHeader(vh *session.ResponseVerificationHeader) { - r.VerifyHeader = vh -} - -func (rb *RemoveChainRequest_Body) SetTarget(t *ape.ChainTarget) { - rb.Target = t -} - -func (rb *RemoveChainRequest_Body) SetChainId(chainID []byte) { - rb.ChainId = chainID -} - -func (r *RemoveChainRequest) SetBody(rb *RemoveChainRequest_Body) { - r.Body = rb -} - -func (r *RemoveChainRequest) SetMetaHeader(mh *session.RequestMetaHeader) { - r.MetaHeader = mh -} - -func (r *RemoveChainRequest) SetVerifyHeader(vh *session.RequestVerificationHeader) { - r.VerifyHeader = vh -} - -func (r *RemoveChainResponse) SetBody(rb *RemoveChainResponse_Body) { - r.Body = rb -} - -func (r *RemoveChainResponse) SetMetaHeader(mh *session.ResponseMetaHeader) { - r.MetaHeader = mh -} - -func (r *RemoveChainResponse) SetVerifyHeader(vh *session.ResponseVerificationHeader) { - r.VerifyHeader = vh -} - -func (r *ListChainsRequest_Body) SetTarget(t *ape.ChainTarget) { - r.Target = t -} - -func (r *ListChainsRequest) SetBody(rb *ListChainsRequest_Body) { - r.Body = rb -} - -func (r *ListChainsRequest) SetMetaHeader(mh *session.RequestMetaHeader) { - r.MetaHeader = mh -} - -func (r *ListChainsRequest) SetVerifyHeader(vh *session.RequestVerificationHeader) { - r.VerifyHeader = vh -} - -func (rb *ListChainsResponse_Body) SetChains(chains []*ape.Chain) { - rb.Chains = chains -} - -func (r *ListChainsResponse) SetBody(rb *ListChainsResponse_Body) { - r.Body = rb -} - -func (r *ListChainsResponse) SetMetaHeader(mh *session.ResponseMetaHeader) { - r.MetaHeader = mh -} - -func (r *ListChainsResponse) SetVerifyHeader(vh *session.ResponseVerificationHeader) { - r.VerifyHeader = vh -} diff --git a/apemanager/grpc/service.pb.go b/apemanager/grpc/service.pb.go deleted file mode 100644 index 3baf193..0000000 --- a/apemanager/grpc/service.pb.go +++ /dev/null @@ -1,1129 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.33.0 -// protoc v5.27.2 -// source: apemanager/grpc/service.proto - -package apemanager - -import ( - grpc1 "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/ape/grpc" - grpc "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session/grpc" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -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) -) - -type AddChainRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The request's body. - Body *AddChainRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" 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,proto3" json:"verify_header,omitempty"` -} - -func (x *AddChainRequest) Reset() { - *x = AddChainRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_apemanager_grpc_service_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AddChainRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AddChainRequest) ProtoMessage() {} - -func (x *AddChainRequest) ProtoReflect() protoreflect.Message { - mi := &file_apemanager_grpc_service_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AddChainRequest.ProtoReflect.Descriptor instead. -func (*AddChainRequest) Descriptor() ([]byte, []int) { - return file_apemanager_grpc_service_proto_rawDescGZIP(), []int{0} -} - -func (x *AddChainRequest) GetBody() *AddChainRequest_Body { - if x != nil { - return x.Body - } - return nil -} - -func (x *AddChainRequest) GetMetaHeader() *grpc.RequestMetaHeader { - if x != nil { - return x.MetaHeader - } - return nil -} - -func (x *AddChainRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { - if x != nil { - return x.VerifyHeader - } - return nil -} - -type AddChainResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The response's body. - Body *AddChainResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" 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,proto3" json:"verify_header,omitempty"` -} - -func (x *AddChainResponse) Reset() { - *x = AddChainResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_apemanager_grpc_service_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AddChainResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AddChainResponse) ProtoMessage() {} - -func (x *AddChainResponse) ProtoReflect() protoreflect.Message { - mi := &file_apemanager_grpc_service_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AddChainResponse.ProtoReflect.Descriptor instead. -func (*AddChainResponse) Descriptor() ([]byte, []int) { - return file_apemanager_grpc_service_proto_rawDescGZIP(), []int{1} -} - -func (x *AddChainResponse) GetBody() *AddChainResponse_Body { - if x != nil { - return x.Body - } - return nil -} - -func (x *AddChainResponse) GetMetaHeader() *grpc.ResponseMetaHeader { - if x != nil { - return x.MetaHeader - } - return nil -} - -func (x *AddChainResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { - if x != nil { - return x.VerifyHeader - } - return nil -} - -type RemoveChainRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The request's body. - Body *RemoveChainRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" 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,proto3" json:"verify_header,omitempty"` -} - -func (x *RemoveChainRequest) Reset() { - *x = RemoveChainRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_apemanager_grpc_service_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RemoveChainRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RemoveChainRequest) ProtoMessage() {} - -func (x *RemoveChainRequest) ProtoReflect() protoreflect.Message { - mi := &file_apemanager_grpc_service_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RemoveChainRequest.ProtoReflect.Descriptor instead. -func (*RemoveChainRequest) Descriptor() ([]byte, []int) { - return file_apemanager_grpc_service_proto_rawDescGZIP(), []int{2} -} - -func (x *RemoveChainRequest) GetBody() *RemoveChainRequest_Body { - if x != nil { - return x.Body - } - return nil -} - -func (x *RemoveChainRequest) GetMetaHeader() *grpc.RequestMetaHeader { - if x != nil { - return x.MetaHeader - } - return nil -} - -func (x *RemoveChainRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { - if x != nil { - return x.VerifyHeader - } - return nil -} - -type RemoveChainResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The response's body. - Body *RemoveChainResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" 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,proto3" json:"verify_header,omitempty"` -} - -func (x *RemoveChainResponse) Reset() { - *x = RemoveChainResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_apemanager_grpc_service_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RemoveChainResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RemoveChainResponse) ProtoMessage() {} - -func (x *RemoveChainResponse) ProtoReflect() protoreflect.Message { - mi := &file_apemanager_grpc_service_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RemoveChainResponse.ProtoReflect.Descriptor instead. -func (*RemoveChainResponse) Descriptor() ([]byte, []int) { - return file_apemanager_grpc_service_proto_rawDescGZIP(), []int{3} -} - -func (x *RemoveChainResponse) GetBody() *RemoveChainResponse_Body { - if x != nil { - return x.Body - } - return nil -} - -func (x *RemoveChainResponse) GetMetaHeader() *grpc.ResponseMetaHeader { - if x != nil { - return x.MetaHeader - } - return nil -} - -func (x *RemoveChainResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { - if x != nil { - return x.VerifyHeader - } - return nil -} - -type ListChainsRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The request's body. - Body *ListChainsRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" 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,proto3" json:"verify_header,omitempty"` -} - -func (x *ListChainsRequest) Reset() { - *x = ListChainsRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_apemanager_grpc_service_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ListChainsRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ListChainsRequest) ProtoMessage() {} - -func (x *ListChainsRequest) ProtoReflect() protoreflect.Message { - mi := &file_apemanager_grpc_service_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ListChainsRequest.ProtoReflect.Descriptor instead. -func (*ListChainsRequest) Descriptor() ([]byte, []int) { - return file_apemanager_grpc_service_proto_rawDescGZIP(), []int{4} -} - -func (x *ListChainsRequest) GetBody() *ListChainsRequest_Body { - if x != nil { - return x.Body - } - return nil -} - -func (x *ListChainsRequest) GetMetaHeader() *grpc.RequestMetaHeader { - if x != nil { - return x.MetaHeader - } - return nil -} - -func (x *ListChainsRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { - if x != nil { - return x.VerifyHeader - } - return nil -} - -type ListChainsResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The response's body. - Body *ListChainsResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" 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,proto3" json:"verify_header,omitempty"` -} - -func (x *ListChainsResponse) Reset() { - *x = ListChainsResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_apemanager_grpc_service_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ListChainsResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ListChainsResponse) ProtoMessage() {} - -func (x *ListChainsResponse) ProtoReflect() protoreflect.Message { - mi := &file_apemanager_grpc_service_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ListChainsResponse.ProtoReflect.Descriptor instead. -func (*ListChainsResponse) Descriptor() ([]byte, []int) { - return file_apemanager_grpc_service_proto_rawDescGZIP(), []int{5} -} - -func (x *ListChainsResponse) GetBody() *ListChainsResponse_Body { - if x != nil { - return x.Body - } - return nil -} - -func (x *ListChainsResponse) GetMetaHeader() *grpc.ResponseMetaHeader { - if x != nil { - return x.MetaHeader - } - return nil -} - -func (x *ListChainsResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { - if x != nil { - return x.VerifyHeader - } - return nil -} - -type AddChainRequest_Body struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // A target for which a rule chain is added. - Target *grpc1.ChainTarget `protobuf:"bytes,1,opt,name=target,proto3" json:"target,omitempty"` - // The chain to set for the target. - Chain *grpc1.Chain `protobuf:"bytes,2,opt,name=chain,proto3" json:"chain,omitempty"` -} - -func (x *AddChainRequest_Body) Reset() { - *x = AddChainRequest_Body{} - if protoimpl.UnsafeEnabled { - mi := &file_apemanager_grpc_service_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AddChainRequest_Body) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AddChainRequest_Body) ProtoMessage() {} - -func (x *AddChainRequest_Body) ProtoReflect() protoreflect.Message { - mi := &file_apemanager_grpc_service_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AddChainRequest_Body.ProtoReflect.Descriptor instead. -func (*AddChainRequest_Body) Descriptor() ([]byte, []int) { - return file_apemanager_grpc_service_proto_rawDescGZIP(), []int{0, 0} -} - -func (x *AddChainRequest_Body) GetTarget() *grpc1.ChainTarget { - if x != nil { - return x.Target - } - return nil -} - -func (x *AddChainRequest_Body) GetChain() *grpc1.Chain { - if x != nil { - return x.Chain - } - return nil -} - -type AddChainResponse_Body struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Chain ID assigned for the added rule chain. - // If chain ID is left empty in the request, then - // it will be generated. - ChainId []byte `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` -} - -func (x *AddChainResponse_Body) Reset() { - *x = AddChainResponse_Body{} - if protoimpl.UnsafeEnabled { - mi := &file_apemanager_grpc_service_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AddChainResponse_Body) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AddChainResponse_Body) ProtoMessage() {} - -func (x *AddChainResponse_Body) ProtoReflect() protoreflect.Message { - mi := &file_apemanager_grpc_service_proto_msgTypes[7] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AddChainResponse_Body.ProtoReflect.Descriptor instead. -func (*AddChainResponse_Body) Descriptor() ([]byte, []int) { - return file_apemanager_grpc_service_proto_rawDescGZIP(), []int{1, 0} -} - -func (x *AddChainResponse_Body) GetChainId() []byte { - if x != nil { - return x.ChainId - } - return nil -} - -type RemoveChainRequest_Body struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Target for which a rule chain is removed. - Target *grpc1.ChainTarget `protobuf:"bytes,1,opt,name=target,proto3" json:"target,omitempty"` - // Chain ID assigned for the rule chain. - ChainId []byte `protobuf:"bytes,2,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` -} - -func (x *RemoveChainRequest_Body) Reset() { - *x = RemoveChainRequest_Body{} - if protoimpl.UnsafeEnabled { - mi := &file_apemanager_grpc_service_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RemoveChainRequest_Body) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RemoveChainRequest_Body) ProtoMessage() {} - -func (x *RemoveChainRequest_Body) ProtoReflect() protoreflect.Message { - mi := &file_apemanager_grpc_service_proto_msgTypes[8] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RemoveChainRequest_Body.ProtoReflect.Descriptor instead. -func (*RemoveChainRequest_Body) Descriptor() ([]byte, []int) { - return file_apemanager_grpc_service_proto_rawDescGZIP(), []int{2, 0} -} - -func (x *RemoveChainRequest_Body) GetTarget() *grpc1.ChainTarget { - if x != nil { - return x.Target - } - return nil -} - -func (x *RemoveChainRequest_Body) GetChainId() []byte { - if x != nil { - return x.ChainId - } - return nil -} - -// Since RemoveChain is an idempotent operation, then the only indicator that -// operation could not be performed is an error returning to a client. -type RemoveChainResponse_Body struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *RemoveChainResponse_Body) Reset() { - *x = RemoveChainResponse_Body{} - if protoimpl.UnsafeEnabled { - mi := &file_apemanager_grpc_service_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RemoveChainResponse_Body) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RemoveChainResponse_Body) ProtoMessage() {} - -func (x *RemoveChainResponse_Body) ProtoReflect() protoreflect.Message { - mi := &file_apemanager_grpc_service_proto_msgTypes[9] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RemoveChainResponse_Body.ProtoReflect.Descriptor instead. -func (*RemoveChainResponse_Body) Descriptor() ([]byte, []int) { - return file_apemanager_grpc_service_proto_rawDescGZIP(), []int{3, 0} -} - -type ListChainsRequest_Body struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Target for which rule chains are listed. - Target *grpc1.ChainTarget `protobuf:"bytes,1,opt,name=target,proto3" json:"target,omitempty"` -} - -func (x *ListChainsRequest_Body) Reset() { - *x = ListChainsRequest_Body{} - if protoimpl.UnsafeEnabled { - mi := &file_apemanager_grpc_service_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ListChainsRequest_Body) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ListChainsRequest_Body) ProtoMessage() {} - -func (x *ListChainsRequest_Body) ProtoReflect() protoreflect.Message { - mi := &file_apemanager_grpc_service_proto_msgTypes[10] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ListChainsRequest_Body.ProtoReflect.Descriptor instead. -func (*ListChainsRequest_Body) Descriptor() ([]byte, []int) { - return file_apemanager_grpc_service_proto_rawDescGZIP(), []int{4, 0} -} - -func (x *ListChainsRequest_Body) GetTarget() *grpc1.ChainTarget { - if x != nil { - return x.Target - } - return nil -} - -type ListChainsResponse_Body struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The list of chains defined for the reqeusted target. - Chains []*grpc1.Chain `protobuf:"bytes,1,rep,name=chains,proto3" json:"chains,omitempty"` -} - -func (x *ListChainsResponse_Body) Reset() { - *x = ListChainsResponse_Body{} - if protoimpl.UnsafeEnabled { - mi := &file_apemanager_grpc_service_proto_msgTypes[11] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ListChainsResponse_Body) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ListChainsResponse_Body) ProtoMessage() {} - -func (x *ListChainsResponse_Body) ProtoReflect() protoreflect.Message { - mi := &file_apemanager_grpc_service_proto_msgTypes[11] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ListChainsResponse_Body.ProtoReflect.Descriptor instead. -func (*ListChainsResponse_Body) Descriptor() ([]byte, []int) { - return file_apemanager_grpc_service_proto_rawDescGZIP(), []int{5, 0} -} - -func (x *ListChainsResponse_Body) GetChains() []*grpc1.Chain { - if x != nil { - return x.Chains - } - return nil -} - -var File_apemanager_grpc_service_proto protoreflect.FileDescriptor - -var file_apemanager_grpc_service_proto_rawDesc = []byte{ - 0x0a, 0x1d, 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2f, 0x67, 0x72, 0x70, - 0x63, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, - 0x15, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, 0x6d, - 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x1a, 0x14, 0x61, 0x70, 0x65, 0x2f, 0x67, 0x72, 0x70, 0x63, - 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x18, 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, 0xd6, 0x02, 0x0a, 0x0f, 0x41, 0x64, 0x64, 0x43, 0x68, - 0x61, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x3f, 0x0a, 0x04, 0x62, 0x6f, - 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, - 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, - 0x2e, 0x41, 0x64, 0x64, 0x43, 0x68, 0x61, 0x69, 0x6e, 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, 0x68, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x33, 0x0a, - 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, - 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, 0x2e, 0x43, - 0x68, 0x61, 0x69, 0x6e, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x52, 0x06, 0x74, 0x61, 0x72, 0x67, - 0x65, 0x74, 0x12, 0x2b, 0x0a, 0x05, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x15, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, - 0x70, 0x65, 0x2e, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x52, 0x05, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x22, - 0x93, 0x02, 0x0a, 0x10, 0x41, 0x64, 0x64, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x40, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, - 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x41, 0x64, 0x64, 0x43, 0x68, - 0x61, 0x69, 0x6e, 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, 0x21, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x19, 0x0a, 0x08, 0x63, 0x68, - 0x61, 0x69, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x63, 0x68, - 0x61, 0x69, 0x6e, 0x49, 0x64, 0x22, 0xca, 0x02, 0x0a, 0x12, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, - 0x43, 0x68, 0x61, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x42, 0x0a, 0x04, - 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2e, 0x2e, 0x66, 0x72, 0x6f, - 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, - 0x65, 0x72, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x43, 0x68, 0x61, 0x69, 0x6e, 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, 0x56, 0x0a, 0x04, 0x42, 0x6f, - 0x64, 0x79, 0x12, 0x33, 0x0a, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, - 0x61, 0x70, 0x65, 0x2e, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x52, - 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x63, 0x68, 0x61, 0x69, 0x6e, - 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x63, 0x68, 0x61, 0x69, 0x6e, - 0x49, 0x64, 0x22, 0xfe, 0x01, 0x0a, 0x13, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x43, 0x68, 0x61, - 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x43, 0x0a, 0x04, 0x62, 0x6f, - 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, - 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, - 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x43, 0x68, 0x61, 0x69, 0x6e, 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, 0x06, 0x0a, 0x04, 0x42, - 0x6f, 0x64, 0x79, 0x22, 0xad, 0x02, 0x0a, 0x11, 0x4c, 0x69, 0x73, 0x74, 0x43, 0x68, 0x61, 0x69, - 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x41, 0x0a, 0x04, 0x62, 0x6f, 0x64, - 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, - 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, - 0x4c, 0x69, 0x73, 0x74, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x73, 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, 0x3b, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x33, - 0x0a, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, - 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, 0x2e, - 0x43, 0x68, 0x61, 0x69, 0x6e, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x52, 0x06, 0x74, 0x61, 0x72, - 0x67, 0x65, 0x74, 0x22, 0xab, 0x02, 0x0a, 0x12, 0x4c, 0x69, 0x73, 0x74, 0x43, 0x68, 0x61, 0x69, - 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x42, 0x0a, 0x04, 0x62, 0x6f, - 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2e, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, - 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, - 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x73, 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, 0x35, 0x0a, 0x04, 0x42, 0x6f, - 0x64, 0x79, 0x12, 0x2d, 0x0a, 0x06, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, - 0x61, 0x70, 0x65, 0x2e, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x52, 0x06, 0x63, 0x68, 0x61, 0x69, 0x6e, - 0x73, 0x32, 0xb9, 0x02, 0x0a, 0x11, 0x41, 0x50, 0x45, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, - 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x5b, 0x0a, 0x08, 0x41, 0x64, 0x64, 0x43, 0x68, - 0x61, 0x69, 0x6e, 0x12, 0x26, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, - 0x2e, 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x41, 0x64, 0x64, 0x43, - 0x68, 0x61, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x27, 0x2e, 0x66, 0x72, - 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61, - 0x67, 0x65, 0x72, 0x2e, 0x41, 0x64, 0x64, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x64, 0x0a, 0x0b, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x43, 0x68, - 0x61, 0x69, 0x6e, 0x12, 0x29, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, - 0x2e, 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x6d, 0x6f, - 0x76, 0x65, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2a, - 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, 0x6d, - 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x43, 0x68, 0x61, - 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x61, 0x0a, 0x0a, 0x4c, 0x69, - 0x73, 0x74, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x73, 0x12, 0x28, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, - 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, - 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x29, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, - 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x43, - 0x68, 0x61, 0x69, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x4c, 0x5a, - 0x4a, 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, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, - 0x2f, 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2f, 0x67, 0x72, 0x70, 0x63, - 0x3b, 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, -} - -var ( - file_apemanager_grpc_service_proto_rawDescOnce sync.Once - file_apemanager_grpc_service_proto_rawDescData = file_apemanager_grpc_service_proto_rawDesc -) - -func file_apemanager_grpc_service_proto_rawDescGZIP() []byte { - file_apemanager_grpc_service_proto_rawDescOnce.Do(func() { - file_apemanager_grpc_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_apemanager_grpc_service_proto_rawDescData) - }) - return file_apemanager_grpc_service_proto_rawDescData -} - -var file_apemanager_grpc_service_proto_msgTypes = make([]protoimpl.MessageInfo, 12) -var file_apemanager_grpc_service_proto_goTypes = []interface{}{ - (*AddChainRequest)(nil), // 0: frostfs.v2.apemanager.AddChainRequest - (*AddChainResponse)(nil), // 1: frostfs.v2.apemanager.AddChainResponse - (*RemoveChainRequest)(nil), // 2: frostfs.v2.apemanager.RemoveChainRequest - (*RemoveChainResponse)(nil), // 3: frostfs.v2.apemanager.RemoveChainResponse - (*ListChainsRequest)(nil), // 4: frostfs.v2.apemanager.ListChainsRequest - (*ListChainsResponse)(nil), // 5: frostfs.v2.apemanager.ListChainsResponse - (*AddChainRequest_Body)(nil), // 6: frostfs.v2.apemanager.AddChainRequest.Body - (*AddChainResponse_Body)(nil), // 7: frostfs.v2.apemanager.AddChainResponse.Body - (*RemoveChainRequest_Body)(nil), // 8: frostfs.v2.apemanager.RemoveChainRequest.Body - (*RemoveChainResponse_Body)(nil), // 9: frostfs.v2.apemanager.RemoveChainResponse.Body - (*ListChainsRequest_Body)(nil), // 10: frostfs.v2.apemanager.ListChainsRequest.Body - (*ListChainsResponse_Body)(nil), // 11: frostfs.v2.apemanager.ListChainsResponse.Body - (*grpc.RequestMetaHeader)(nil), // 12: neo.fs.v2.session.RequestMetaHeader - (*grpc.RequestVerificationHeader)(nil), // 13: neo.fs.v2.session.RequestVerificationHeader - (*grpc.ResponseMetaHeader)(nil), // 14: neo.fs.v2.session.ResponseMetaHeader - (*grpc.ResponseVerificationHeader)(nil), // 15: neo.fs.v2.session.ResponseVerificationHeader - (*grpc1.ChainTarget)(nil), // 16: frostfs.v2.ape.ChainTarget - (*grpc1.Chain)(nil), // 17: frostfs.v2.ape.Chain -} -var file_apemanager_grpc_service_proto_depIdxs = []int32{ - 6, // 0: frostfs.v2.apemanager.AddChainRequest.body:type_name -> frostfs.v2.apemanager.AddChainRequest.Body - 12, // 1: frostfs.v2.apemanager.AddChainRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader - 13, // 2: frostfs.v2.apemanager.AddChainRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader - 7, // 3: frostfs.v2.apemanager.AddChainResponse.body:type_name -> frostfs.v2.apemanager.AddChainResponse.Body - 14, // 4: frostfs.v2.apemanager.AddChainResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader - 15, // 5: frostfs.v2.apemanager.AddChainResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader - 8, // 6: frostfs.v2.apemanager.RemoveChainRequest.body:type_name -> frostfs.v2.apemanager.RemoveChainRequest.Body - 12, // 7: frostfs.v2.apemanager.RemoveChainRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader - 13, // 8: frostfs.v2.apemanager.RemoveChainRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader - 9, // 9: frostfs.v2.apemanager.RemoveChainResponse.body:type_name -> frostfs.v2.apemanager.RemoveChainResponse.Body - 14, // 10: frostfs.v2.apemanager.RemoveChainResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader - 15, // 11: frostfs.v2.apemanager.RemoveChainResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader - 10, // 12: frostfs.v2.apemanager.ListChainsRequest.body:type_name -> frostfs.v2.apemanager.ListChainsRequest.Body - 12, // 13: frostfs.v2.apemanager.ListChainsRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader - 13, // 14: frostfs.v2.apemanager.ListChainsRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader - 11, // 15: frostfs.v2.apemanager.ListChainsResponse.body:type_name -> frostfs.v2.apemanager.ListChainsResponse.Body - 14, // 16: frostfs.v2.apemanager.ListChainsResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader - 15, // 17: frostfs.v2.apemanager.ListChainsResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader - 16, // 18: frostfs.v2.apemanager.AddChainRequest.Body.target:type_name -> frostfs.v2.ape.ChainTarget - 17, // 19: frostfs.v2.apemanager.AddChainRequest.Body.chain:type_name -> frostfs.v2.ape.Chain - 16, // 20: frostfs.v2.apemanager.RemoveChainRequest.Body.target:type_name -> frostfs.v2.ape.ChainTarget - 16, // 21: frostfs.v2.apemanager.ListChainsRequest.Body.target:type_name -> frostfs.v2.ape.ChainTarget - 17, // 22: frostfs.v2.apemanager.ListChainsResponse.Body.chains:type_name -> frostfs.v2.ape.Chain - 0, // 23: frostfs.v2.apemanager.APEManagerService.AddChain:input_type -> frostfs.v2.apemanager.AddChainRequest - 2, // 24: frostfs.v2.apemanager.APEManagerService.RemoveChain:input_type -> frostfs.v2.apemanager.RemoveChainRequest - 4, // 25: frostfs.v2.apemanager.APEManagerService.ListChains:input_type -> frostfs.v2.apemanager.ListChainsRequest - 1, // 26: frostfs.v2.apemanager.APEManagerService.AddChain:output_type -> frostfs.v2.apemanager.AddChainResponse - 3, // 27: frostfs.v2.apemanager.APEManagerService.RemoveChain:output_type -> frostfs.v2.apemanager.RemoveChainResponse - 5, // 28: frostfs.v2.apemanager.APEManagerService.ListChains:output_type -> frostfs.v2.apemanager.ListChainsResponse - 26, // [26:29] is the sub-list for method output_type - 23, // [23:26] is the sub-list for method input_type - 23, // [23:23] is the sub-list for extension type_name - 23, // [23:23] is the sub-list for extension extendee - 0, // [0:23] is the sub-list for field type_name -} - -func init() { file_apemanager_grpc_service_proto_init() } -func file_apemanager_grpc_service_proto_init() { - if File_apemanager_grpc_service_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_apemanager_grpc_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AddChainRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_apemanager_grpc_service_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AddChainResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_apemanager_grpc_service_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RemoveChainRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_apemanager_grpc_service_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RemoveChainResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_apemanager_grpc_service_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ListChainsRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_apemanager_grpc_service_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ListChainsResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_apemanager_grpc_service_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AddChainRequest_Body); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_apemanager_grpc_service_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AddChainResponse_Body); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_apemanager_grpc_service_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RemoveChainRequest_Body); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_apemanager_grpc_service_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RemoveChainResponse_Body); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_apemanager_grpc_service_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ListChainsRequest_Body); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_apemanager_grpc_service_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ListChainsResponse_Body); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_apemanager_grpc_service_proto_rawDesc, - NumEnums: 0, - NumMessages: 12, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_apemanager_grpc_service_proto_goTypes, - DependencyIndexes: file_apemanager_grpc_service_proto_depIdxs, - MessageInfos: file_apemanager_grpc_service_proto_msgTypes, - }.Build() - File_apemanager_grpc_service_proto = out.File - file_apemanager_grpc_service_proto_rawDesc = nil - file_apemanager_grpc_service_proto_goTypes = nil - file_apemanager_grpc_service_proto_depIdxs = nil -} diff --git a/apemanager/grpc/service_frostfs.pb.go b/apemanager/grpc/service_frostfs.pb.go new file mode 100644 index 0000000..380ba30 --- /dev/null +++ b/apemanager/grpc/service_frostfs.pb.go @@ -0,0 +1,2183 @@ +// Code generated by protoc-gen-go-frostfs. DO NOT EDIT. + +package apemanager + +import ( + json "encoding/json" + fmt "fmt" + grpc "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/ape/grpc" + grpc1 "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session/grpc" + pool "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/pool" + proto "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/proto" + encoding "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/proto/encoding" + easyproto "github.com/VictoriaMetrics/easyproto" + jlexer "github.com/mailru/easyjson/jlexer" + jwriter "github.com/mailru/easyjson/jwriter" +) + +type AddChainRequest_Body struct { + Target *grpc.ChainTarget `json:"target"` + Chain *grpc.Chain `json:"chain"` +} + +var ( + _ encoding.ProtoMarshaler = (*AddChainRequest_Body)(nil) + _ encoding.ProtoUnmarshaler = (*AddChainRequest_Body)(nil) + _ json.Marshaler = (*AddChainRequest_Body)(nil) + _ json.Unmarshaler = (*AddChainRequest_Body)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *AddChainRequest_Body) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.NestedStructureSize(1, x.Target) + size += proto.NestedStructureSize(2, x.Chain) + return size +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *AddChainRequest_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 *AddChainRequest_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if x.Target != nil && x.Target.StableSize() != 0 { + x.Target.EmitProtobuf(mm.AppendMessage(1)) + } + if x.Chain != nil && x.Chain.StableSize() != 0 { + x.Chain.EmitProtobuf(mm.AppendMessage(2)) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *AddChainRequest_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", "AddChainRequest_Body") + } + switch fc.FieldNum { + case 1: // Target + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Target") + } + x.Target = new(grpc.ChainTarget) + if err := x.Target.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + case 2: // Chain + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Chain") + } + x.Chain = new(grpc.Chain) + if err := x.Chain.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + } + } + return nil +} +func (x *AddChainRequest_Body) GetTarget() *grpc.ChainTarget { + if x != nil { + return x.Target + } + return nil +} +func (x *AddChainRequest_Body) SetTarget(v *grpc.ChainTarget) { + x.Target = v +} +func (x *AddChainRequest_Body) GetChain() *grpc.Chain { + if x != nil { + return x.Chain + } + return nil +} +func (x *AddChainRequest_Body) SetChain(v *grpc.Chain) { + x.Chain = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *AddChainRequest_Body) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *AddChainRequest_Body) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"target\":" + out.RawString(prefix[1:]) + x.Target.MarshalEasyJSON(out) + } + { + const prefix string = ",\"chain\":" + out.RawString(prefix) + x.Chain.MarshalEasyJSON(out) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *AddChainRequest_Body) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *AddChainRequest_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 "target": + { + var f *grpc.ChainTarget + f = new(grpc.ChainTarget) + f.UnmarshalEasyJSON(in) + x.Target = f + } + case "chain": + { + var f *grpc.Chain + f = new(grpc.Chain) + f.UnmarshalEasyJSON(in) + x.Chain = f + } + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} + +type AddChainRequest struct { + Body *AddChainRequest_Body `json:"body"` + MetaHeader *grpc1.RequestMetaHeader `json:"metaHeader"` + VerifyHeader *grpc1.RequestVerificationHeader `json:"verifyHeader"` +} + +var ( + _ encoding.ProtoMarshaler = (*AddChainRequest)(nil) + _ encoding.ProtoUnmarshaler = (*AddChainRequest)(nil) + _ json.Marshaler = (*AddChainRequest)(nil) + _ json.Unmarshaler = (*AddChainRequest)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *AddChainRequest) 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 *AddChainRequest) 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 *AddChainRequest) ReadSignedData(buf []byte) ([]byte, error) { + return x.GetBody().MarshalProtobuf(buf), nil +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *AddChainRequest) 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 *AddChainRequest) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if x.Body != nil && x.Body.StableSize() != 0 { + x.Body.EmitProtobuf(mm.AppendMessage(1)) + } + if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 { + x.MetaHeader.EmitProtobuf(mm.AppendMessage(2)) + } + if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 { + x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3)) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *AddChainRequest) 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", "AddChainRequest") + } + switch fc.FieldNum { + case 1: // Body + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Body") + } + x.Body = new(AddChainRequest_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 *AddChainRequest) GetBody() *AddChainRequest_Body { + if x != nil { + return x.Body + } + return nil +} +func (x *AddChainRequest) SetBody(v *AddChainRequest_Body) { + x.Body = v +} +func (x *AddChainRequest) GetMetaHeader() *grpc1.RequestMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} +func (x *AddChainRequest) SetMetaHeader(v *grpc1.RequestMetaHeader) { + x.MetaHeader = v +} +func (x *AddChainRequest) GetVerifyHeader() *grpc1.RequestVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} +func (x *AddChainRequest) SetVerifyHeader(v *grpc1.RequestVerificationHeader) { + x.VerifyHeader = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *AddChainRequest) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *AddChainRequest) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"body\":" + out.RawString(prefix[1:]) + x.Body.MarshalEasyJSON(out) + } + { + const prefix string = ",\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) + } + { + const prefix string = ",\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *AddChainRequest) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *AddChainRequest) 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 *AddChainRequest_Body + f = new(AddChainRequest_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 AddChainResponse_Body struct { + ChainId []byte `json:"chainId"` +} + +var ( + _ encoding.ProtoMarshaler = (*AddChainResponse_Body)(nil) + _ encoding.ProtoUnmarshaler = (*AddChainResponse_Body)(nil) + _ json.Marshaler = (*AddChainResponse_Body)(nil) + _ json.Unmarshaler = (*AddChainResponse_Body)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *AddChainResponse_Body) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.BytesSize(1, x.ChainId) + return size +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *AddChainResponse_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 *AddChainResponse_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if len(x.ChainId) != 0 { + mm.AppendBytes(1, x.ChainId) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *AddChainResponse_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", "AddChainResponse_Body") + } + switch fc.FieldNum { + case 1: // ChainId + data, ok := fc.Bytes() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "ChainId") + } + x.ChainId = data + } + } + return nil +} +func (x *AddChainResponse_Body) GetChainId() []byte { + if x != nil { + return x.ChainId + } + return nil +} +func (x *AddChainResponse_Body) SetChainId(v []byte) { + x.ChainId = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *AddChainResponse_Body) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *AddChainResponse_Body) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"chainId\":" + out.RawString(prefix[1:]) + out.Base64Bytes(x.ChainId) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *AddChainResponse_Body) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *AddChainResponse_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 "chainId": + { + var f []byte + f = in.Bytes() + x.ChainId = f + } + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} + +type AddChainResponse struct { + Body *AddChainResponse_Body `json:"body"` + MetaHeader *grpc1.ResponseMetaHeader `json:"metaHeader"` + VerifyHeader *grpc1.ResponseVerificationHeader `json:"verifyHeader"` +} + +var ( + _ encoding.ProtoMarshaler = (*AddChainResponse)(nil) + _ encoding.ProtoUnmarshaler = (*AddChainResponse)(nil) + _ json.Marshaler = (*AddChainResponse)(nil) + _ json.Unmarshaler = (*AddChainResponse)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *AddChainResponse) 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 *AddChainResponse) 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 *AddChainResponse) ReadSignedData(buf []byte) ([]byte, error) { + return x.GetBody().MarshalProtobuf(buf), nil +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *AddChainResponse) 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 *AddChainResponse) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if x.Body != nil && x.Body.StableSize() != 0 { + x.Body.EmitProtobuf(mm.AppendMessage(1)) + } + if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 { + x.MetaHeader.EmitProtobuf(mm.AppendMessage(2)) + } + if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 { + x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3)) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *AddChainResponse) 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", "AddChainResponse") + } + switch fc.FieldNum { + case 1: // Body + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Body") + } + x.Body = new(AddChainResponse_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 *AddChainResponse) GetBody() *AddChainResponse_Body { + if x != nil { + return x.Body + } + return nil +} +func (x *AddChainResponse) SetBody(v *AddChainResponse_Body) { + x.Body = v +} +func (x *AddChainResponse) GetMetaHeader() *grpc1.ResponseMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} +func (x *AddChainResponse) SetMetaHeader(v *grpc1.ResponseMetaHeader) { + x.MetaHeader = v +} +func (x *AddChainResponse) GetVerifyHeader() *grpc1.ResponseVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} +func (x *AddChainResponse) SetVerifyHeader(v *grpc1.ResponseVerificationHeader) { + x.VerifyHeader = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *AddChainResponse) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *AddChainResponse) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"body\":" + out.RawString(prefix[1:]) + x.Body.MarshalEasyJSON(out) + } + { + const prefix string = ",\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) + } + { + const prefix string = ",\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *AddChainResponse) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *AddChainResponse) 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 *AddChainResponse_Body + f = new(AddChainResponse_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() + } +} + +type RemoveChainRequest_Body struct { + Target *grpc.ChainTarget `json:"target"` + ChainId []byte `json:"chainId"` +} + +var ( + _ encoding.ProtoMarshaler = (*RemoveChainRequest_Body)(nil) + _ encoding.ProtoUnmarshaler = (*RemoveChainRequest_Body)(nil) + _ json.Marshaler = (*RemoveChainRequest_Body)(nil) + _ json.Unmarshaler = (*RemoveChainRequest_Body)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *RemoveChainRequest_Body) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.NestedStructureSize(1, x.Target) + size += proto.BytesSize(2, x.ChainId) + return size +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *RemoveChainRequest_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 *RemoveChainRequest_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if x.Target != nil && x.Target.StableSize() != 0 { + x.Target.EmitProtobuf(mm.AppendMessage(1)) + } + if len(x.ChainId) != 0 { + mm.AppendBytes(2, x.ChainId) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *RemoveChainRequest_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", "RemoveChainRequest_Body") + } + switch fc.FieldNum { + case 1: // Target + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Target") + } + x.Target = new(grpc.ChainTarget) + if err := x.Target.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + case 2: // ChainId + data, ok := fc.Bytes() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "ChainId") + } + x.ChainId = data + } + } + return nil +} +func (x *RemoveChainRequest_Body) GetTarget() *grpc.ChainTarget { + if x != nil { + return x.Target + } + return nil +} +func (x *RemoveChainRequest_Body) SetTarget(v *grpc.ChainTarget) { + x.Target = v +} +func (x *RemoveChainRequest_Body) GetChainId() []byte { + if x != nil { + return x.ChainId + } + return nil +} +func (x *RemoveChainRequest_Body) SetChainId(v []byte) { + x.ChainId = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *RemoveChainRequest_Body) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *RemoveChainRequest_Body) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"target\":" + out.RawString(prefix[1:]) + x.Target.MarshalEasyJSON(out) + } + { + const prefix string = ",\"chainId\":" + out.RawString(prefix) + out.Base64Bytes(x.ChainId) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *RemoveChainRequest_Body) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *RemoveChainRequest_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 "target": + { + var f *grpc.ChainTarget + f = new(grpc.ChainTarget) + f.UnmarshalEasyJSON(in) + x.Target = f + } + case "chainId": + { + var f []byte + f = in.Bytes() + x.ChainId = f + } + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} + +type RemoveChainRequest struct { + Body *RemoveChainRequest_Body `json:"body"` + MetaHeader *grpc1.RequestMetaHeader `json:"metaHeader"` + VerifyHeader *grpc1.RequestVerificationHeader `json:"verifyHeader"` +} + +var ( + _ encoding.ProtoMarshaler = (*RemoveChainRequest)(nil) + _ encoding.ProtoUnmarshaler = (*RemoveChainRequest)(nil) + _ json.Marshaler = (*RemoveChainRequest)(nil) + _ json.Unmarshaler = (*RemoveChainRequest)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *RemoveChainRequest) 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 *RemoveChainRequest) 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 *RemoveChainRequest) ReadSignedData(buf []byte) ([]byte, error) { + return x.GetBody().MarshalProtobuf(buf), nil +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *RemoveChainRequest) 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 *RemoveChainRequest) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if x.Body != nil && x.Body.StableSize() != 0 { + x.Body.EmitProtobuf(mm.AppendMessage(1)) + } + if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 { + x.MetaHeader.EmitProtobuf(mm.AppendMessage(2)) + } + if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 { + x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3)) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *RemoveChainRequest) 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", "RemoveChainRequest") + } + switch fc.FieldNum { + case 1: // Body + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Body") + } + x.Body = new(RemoveChainRequest_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 *RemoveChainRequest) GetBody() *RemoveChainRequest_Body { + if x != nil { + return x.Body + } + return nil +} +func (x *RemoveChainRequest) SetBody(v *RemoveChainRequest_Body) { + x.Body = v +} +func (x *RemoveChainRequest) GetMetaHeader() *grpc1.RequestMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} +func (x *RemoveChainRequest) SetMetaHeader(v *grpc1.RequestMetaHeader) { + x.MetaHeader = v +} +func (x *RemoveChainRequest) GetVerifyHeader() *grpc1.RequestVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} +func (x *RemoveChainRequest) SetVerifyHeader(v *grpc1.RequestVerificationHeader) { + x.VerifyHeader = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *RemoveChainRequest) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *RemoveChainRequest) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"body\":" + out.RawString(prefix[1:]) + x.Body.MarshalEasyJSON(out) + } + { + const prefix string = ",\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) + } + { + const prefix string = ",\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *RemoveChainRequest) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *RemoveChainRequest) 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 *RemoveChainRequest_Body + f = new(RemoveChainRequest_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 RemoveChainResponse_Body struct { +} + +var ( + _ encoding.ProtoMarshaler = (*RemoveChainResponse_Body)(nil) + _ encoding.ProtoUnmarshaler = (*RemoveChainResponse_Body)(nil) + _ json.Marshaler = (*RemoveChainResponse_Body)(nil) + _ json.Unmarshaler = (*RemoveChainResponse_Body)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *RemoveChainResponse_Body) StableSize() (size int) { + if x == nil { + return 0 + } + return size +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *RemoveChainResponse_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 *RemoveChainResponse_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) { +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *RemoveChainResponse_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", "RemoveChainResponse_Body") + } + switch fc.FieldNum { + } + } + return nil +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *RemoveChainResponse_Body) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *RemoveChainResponse_Body) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *RemoveChainResponse_Body) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *RemoveChainResponse_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 { + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} + +type RemoveChainResponse struct { + Body *RemoveChainResponse_Body `json:"body"` + MetaHeader *grpc1.ResponseMetaHeader `json:"metaHeader"` + VerifyHeader *grpc1.ResponseVerificationHeader `json:"verifyHeader"` +} + +var ( + _ encoding.ProtoMarshaler = (*RemoveChainResponse)(nil) + _ encoding.ProtoUnmarshaler = (*RemoveChainResponse)(nil) + _ json.Marshaler = (*RemoveChainResponse)(nil) + _ json.Unmarshaler = (*RemoveChainResponse)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *RemoveChainResponse) 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 *RemoveChainResponse) 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 *RemoveChainResponse) ReadSignedData(buf []byte) ([]byte, error) { + return x.GetBody().MarshalProtobuf(buf), nil +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *RemoveChainResponse) 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 *RemoveChainResponse) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if x.Body != nil && x.Body.StableSize() != 0 { + x.Body.EmitProtobuf(mm.AppendMessage(1)) + } + if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 { + x.MetaHeader.EmitProtobuf(mm.AppendMessage(2)) + } + if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 { + x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3)) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *RemoveChainResponse) 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", "RemoveChainResponse") + } + switch fc.FieldNum { + case 1: // Body + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Body") + } + x.Body = new(RemoveChainResponse_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 *RemoveChainResponse) GetBody() *RemoveChainResponse_Body { + if x != nil { + return x.Body + } + return nil +} +func (x *RemoveChainResponse) SetBody(v *RemoveChainResponse_Body) { + x.Body = v +} +func (x *RemoveChainResponse) GetMetaHeader() *grpc1.ResponseMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} +func (x *RemoveChainResponse) SetMetaHeader(v *grpc1.ResponseMetaHeader) { + x.MetaHeader = v +} +func (x *RemoveChainResponse) GetVerifyHeader() *grpc1.ResponseVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} +func (x *RemoveChainResponse) SetVerifyHeader(v *grpc1.ResponseVerificationHeader) { + x.VerifyHeader = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *RemoveChainResponse) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *RemoveChainResponse) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"body\":" + out.RawString(prefix[1:]) + x.Body.MarshalEasyJSON(out) + } + { + const prefix string = ",\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) + } + { + const prefix string = ",\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *RemoveChainResponse) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *RemoveChainResponse) 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 *RemoveChainResponse_Body + f = new(RemoveChainResponse_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() + } +} + +type ListChainsRequest_Body struct { + Target *grpc.ChainTarget `json:"target"` +} + +var ( + _ encoding.ProtoMarshaler = (*ListChainsRequest_Body)(nil) + _ encoding.ProtoUnmarshaler = (*ListChainsRequest_Body)(nil) + _ json.Marshaler = (*ListChainsRequest_Body)(nil) + _ json.Unmarshaler = (*ListChainsRequest_Body)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *ListChainsRequest_Body) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.NestedStructureSize(1, x.Target) + return size +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *ListChainsRequest_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 *ListChainsRequest_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if x.Target != nil && x.Target.StableSize() != 0 { + x.Target.EmitProtobuf(mm.AppendMessage(1)) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *ListChainsRequest_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", "ListChainsRequest_Body") + } + switch fc.FieldNum { + case 1: // Target + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Target") + } + x.Target = new(grpc.ChainTarget) + if err := x.Target.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + } + } + return nil +} +func (x *ListChainsRequest_Body) GetTarget() *grpc.ChainTarget { + if x != nil { + return x.Target + } + return nil +} +func (x *ListChainsRequest_Body) SetTarget(v *grpc.ChainTarget) { + x.Target = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *ListChainsRequest_Body) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *ListChainsRequest_Body) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"target\":" + out.RawString(prefix[1:]) + x.Target.MarshalEasyJSON(out) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *ListChainsRequest_Body) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *ListChainsRequest_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 "target": + { + var f *grpc.ChainTarget + f = new(grpc.ChainTarget) + f.UnmarshalEasyJSON(in) + x.Target = f + } + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} + +type ListChainsRequest struct { + Body *ListChainsRequest_Body `json:"body"` + MetaHeader *grpc1.RequestMetaHeader `json:"metaHeader"` + VerifyHeader *grpc1.RequestVerificationHeader `json:"verifyHeader"` +} + +var ( + _ encoding.ProtoMarshaler = (*ListChainsRequest)(nil) + _ encoding.ProtoUnmarshaler = (*ListChainsRequest)(nil) + _ json.Marshaler = (*ListChainsRequest)(nil) + _ json.Unmarshaler = (*ListChainsRequest)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *ListChainsRequest) 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 *ListChainsRequest) 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 *ListChainsRequest) ReadSignedData(buf []byte) ([]byte, error) { + return x.GetBody().MarshalProtobuf(buf), nil +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *ListChainsRequest) 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 *ListChainsRequest) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if x.Body != nil && x.Body.StableSize() != 0 { + x.Body.EmitProtobuf(mm.AppendMessage(1)) + } + if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 { + x.MetaHeader.EmitProtobuf(mm.AppendMessage(2)) + } + if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 { + x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3)) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *ListChainsRequest) 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", "ListChainsRequest") + } + switch fc.FieldNum { + case 1: // Body + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Body") + } + x.Body = new(ListChainsRequest_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 *ListChainsRequest) GetBody() *ListChainsRequest_Body { + if x != nil { + return x.Body + } + return nil +} +func (x *ListChainsRequest) SetBody(v *ListChainsRequest_Body) { + x.Body = v +} +func (x *ListChainsRequest) GetMetaHeader() *grpc1.RequestMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} +func (x *ListChainsRequest) SetMetaHeader(v *grpc1.RequestMetaHeader) { + x.MetaHeader = v +} +func (x *ListChainsRequest) GetVerifyHeader() *grpc1.RequestVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} +func (x *ListChainsRequest) SetVerifyHeader(v *grpc1.RequestVerificationHeader) { + x.VerifyHeader = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *ListChainsRequest) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *ListChainsRequest) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"body\":" + out.RawString(prefix[1:]) + x.Body.MarshalEasyJSON(out) + } + { + const prefix string = ",\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) + } + { + const prefix string = ",\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *ListChainsRequest) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *ListChainsRequest) 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 *ListChainsRequest_Body + f = new(ListChainsRequest_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 ListChainsResponse_Body struct { + Chains []*grpc.Chain `json:"chains"` +} + +var ( + _ encoding.ProtoMarshaler = (*ListChainsResponse_Body)(nil) + _ encoding.ProtoUnmarshaler = (*ListChainsResponse_Body)(nil) + _ json.Marshaler = (*ListChainsResponse_Body)(nil) + _ json.Unmarshaler = (*ListChainsResponse_Body)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *ListChainsResponse_Body) StableSize() (size int) { + if x == nil { + return 0 + } + for i := range x.Chains { + size += proto.NestedStructureSize(1, x.Chains[i]) + } + return size +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *ListChainsResponse_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 *ListChainsResponse_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + for i := range x.Chains { + if x.Chains[i] != nil && x.Chains[i].StableSize() != 0 { + x.Chains[i].EmitProtobuf(mm.AppendMessage(1)) + } + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *ListChainsResponse_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", "ListChainsResponse_Body") + } + switch fc.FieldNum { + case 1: // Chains + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Chains") + } + x.Chains = append(x.Chains, new(grpc.Chain)) + ff := x.Chains[len(x.Chains)-1] + if err := ff.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + } + } + return nil +} +func (x *ListChainsResponse_Body) GetChains() []*grpc.Chain { + if x != nil { + return x.Chains + } + return nil +} +func (x *ListChainsResponse_Body) SetChains(v []*grpc.Chain) { + x.Chains = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *ListChainsResponse_Body) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *ListChainsResponse_Body) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"chains\":" + out.RawString(prefix[1:]) + out.RawByte('[') + for i := range x.Chains { + if i != 0 { + out.RawByte(',') + } + x.Chains[i].MarshalEasyJSON(out) + } + out.RawByte(']') + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *ListChainsResponse_Body) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *ListChainsResponse_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 "chains": + { + var f *grpc.Chain + var list []*grpc.Chain + in.Delim('[') + for !in.IsDelim(']') { + f = new(grpc.Chain) + f.UnmarshalEasyJSON(in) + list = append(list, f) + in.WantComma() + } + x.Chains = list + in.Delim(']') + } + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} + +type ListChainsResponse struct { + Body *ListChainsResponse_Body `json:"body"` + MetaHeader *grpc1.ResponseMetaHeader `json:"metaHeader"` + VerifyHeader *grpc1.ResponseVerificationHeader `json:"verifyHeader"` +} + +var ( + _ encoding.ProtoMarshaler = (*ListChainsResponse)(nil) + _ encoding.ProtoUnmarshaler = (*ListChainsResponse)(nil) + _ json.Marshaler = (*ListChainsResponse)(nil) + _ json.Unmarshaler = (*ListChainsResponse)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *ListChainsResponse) 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 *ListChainsResponse) 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 *ListChainsResponse) ReadSignedData(buf []byte) ([]byte, error) { + return x.GetBody().MarshalProtobuf(buf), nil +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *ListChainsResponse) 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 *ListChainsResponse) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if x.Body != nil && x.Body.StableSize() != 0 { + x.Body.EmitProtobuf(mm.AppendMessage(1)) + } + if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 { + x.MetaHeader.EmitProtobuf(mm.AppendMessage(2)) + } + if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 { + x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3)) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *ListChainsResponse) 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", "ListChainsResponse") + } + switch fc.FieldNum { + case 1: // Body + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Body") + } + x.Body = new(ListChainsResponse_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 *ListChainsResponse) GetBody() *ListChainsResponse_Body { + if x != nil { + return x.Body + } + return nil +} +func (x *ListChainsResponse) SetBody(v *ListChainsResponse_Body) { + x.Body = v +} +func (x *ListChainsResponse) GetMetaHeader() *grpc1.ResponseMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} +func (x *ListChainsResponse) SetMetaHeader(v *grpc1.ResponseMetaHeader) { + x.MetaHeader = v +} +func (x *ListChainsResponse) GetVerifyHeader() *grpc1.ResponseVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} +func (x *ListChainsResponse) SetVerifyHeader(v *grpc1.ResponseVerificationHeader) { + x.VerifyHeader = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *ListChainsResponse) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *ListChainsResponse) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"body\":" + out.RawString(prefix[1:]) + x.Body.MarshalEasyJSON(out) + } + { + const prefix string = ",\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) + } + { + const prefix string = ",\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *ListChainsResponse) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *ListChainsResponse) 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 *ListChainsResponse_Body + f = new(ListChainsResponse_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() + } +} diff --git a/apemanager/grpc/service_frostfs_fuzz.go b/apemanager/grpc/service_frostfs_fuzz.go new file mode 100644 index 0000000..08af63e --- /dev/null +++ b/apemanager/grpc/service_frostfs_fuzz.go @@ -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 +} diff --git a/apemanager/grpc/service_frostfs_test.go b/apemanager/grpc/service_frostfs_test.go new file mode 100644 index 0000000..5c4653c --- /dev/null +++ b/apemanager/grpc/service_frostfs_test.go @@ -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) + }) +} diff --git a/container/grpc/service.go b/container/grpc/service.go deleted file mode 100644 index d19add1..0000000 --- a/container/grpc/service.go +++ /dev/null @@ -1,234 +0,0 @@ -package container - -import ( - acl "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/acl/grpc" - refs "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc" - session "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session/grpc" -) - -// SetContainer sets container of the request. -func (m *PutRequest_Body) SetContainer(v *Container) { - m.Container = v -} - -// SetSignature sets signature of the container structure. -func (m *PutRequest_Body) SetSignature(v *refs.SignatureRFC6979) { - m.Signature = v -} - -// SetBody sets body of the request. -func (m *PutRequest) SetBody(v *PutRequest_Body) { - m.Body = v -} - -// SetMetaHeader sets meta header of the request. -func (m *PutRequest) SetMetaHeader(v *session.RequestMetaHeader) { - m.MetaHeader = v -} - -// SetVerifyHeader sets verification header of the request. -func (m *PutRequest) SetVerifyHeader(v *session.RequestVerificationHeader) { - m.VerifyHeader = v -} - -// SetContainerId sets identifier of the container. -func (m *PutResponse_Body) SetContainerId(v *refs.ContainerID) { - m.ContainerId = v -} - -// SetBody sets body of the response. -func (m *PutResponse) SetBody(v *PutResponse_Body) { - m.Body = v -} - -// SetMetaHeader sets meta header of the response. -func (m *PutResponse) SetMetaHeader(v *session.ResponseMetaHeader) { - m.MetaHeader = v -} - -// SetVerifyHeader sets verification header of the response. -func (m *PutResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) { - m.VerifyHeader = v -} - -// SetContainerId sets identifier of the container. -func (m *DeleteRequest_Body) SetContainerId(v *refs.ContainerID) { - m.ContainerId = v -} - -// SetSignature sets signature of the container identifier. -func (m *DeleteRequest_Body) SetSignature(v *refs.SignatureRFC6979) { - m.Signature = v -} - -// SetBody sets body of the request. -func (m *DeleteRequest) SetBody(v *DeleteRequest_Body) { - m.Body = v -} - -// SetMetaHeader sets meta header of the request. -func (m *DeleteRequest) SetMetaHeader(v *session.RequestMetaHeader) { - m.MetaHeader = v -} - -// SetVerifyHeader sets verification header of the request. -func (m *DeleteRequest) SetVerifyHeader(v *session.RequestVerificationHeader) { - m.VerifyHeader = v -} - -// SetBody sets body of the response. -func (m *DeleteResponse) SetBody(v *DeleteResponse_Body) { - m.Body = v -} - -// SetMetaHeader sets meta header of the response. -func (m *DeleteResponse) SetMetaHeader(v *session.ResponseMetaHeader) { - m.MetaHeader = v -} - -// SetVerifyHeader sets verification header of the response. -func (m *DeleteResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) { - m.VerifyHeader = v -} - -// SetContainerId sets identifier of the container. -func (m *GetRequest_Body) SetContainerId(v *refs.ContainerID) { - m.ContainerId = v -} - -// SetBody sets body of the request. -func (m *GetRequest) SetBody(v *GetRequest_Body) { - m.Body = v -} - -// SetMetaHeader sets meta header of the request. -func (m *GetRequest) SetMetaHeader(v *session.RequestMetaHeader) { - m.MetaHeader = v -} - -// SetVerifyHeader sets verification header of the request. -func (m *GetRequest) SetVerifyHeader(v *session.RequestVerificationHeader) { - m.VerifyHeader = v -} - -// SetContainer sets the container structure. -func (m *GetResponse_Body) SetContainer(v *Container) { - m.Container = v -} - -// SetSessionToken sets token of the session within which requested -// container was created. -func (m *GetResponse_Body) SetSessionToken(v *session.SessionToken) { - m.SessionToken = v -} - -// SetSignature sets signature of the container structure. -func (m *GetResponse_Body) SetSignature(v *refs.SignatureRFC6979) { - m.Signature = v -} - -// SetBody sets body of the response. -func (m *GetResponse) SetBody(v *GetResponse_Body) { - m.Body = v -} - -// SetMetaHeader sets meta header of the response. -func (m *GetResponse) SetMetaHeader(v *session.ResponseMetaHeader) { - m.MetaHeader = v -} - -// SetVerifyHeader sets verification header of the response. -func (m *GetResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) { - m.VerifyHeader = v -} - -// SetOwnerId sets identifier of the container owner. -func (m *ListRequest_Body) SetOwnerId(v *refs.OwnerID) { - m.OwnerId = v -} - -// SetBody sets body of the request. -func (m *ListRequest) SetBody(v *ListRequest_Body) { - m.Body = v -} - -// SetMetaHeader sets meta header of the request. -func (m *ListRequest) SetMetaHeader(v *session.RequestMetaHeader) { - m.MetaHeader = v -} - -// SetVerifyHeader sets verification header of the request. -func (m *ListRequest) SetVerifyHeader(v *session.RequestVerificationHeader) { - m.VerifyHeader = v -} - -// SetContainerIds sets list of the container identifiers. -func (m *ListResponse_Body) SetContainerIds(v []*refs.ContainerID) { - m.ContainerIds = v -} - -// SetBody sets body of the response. -func (m *ListResponse) SetBody(v *ListResponse_Body) { - m.Body = v -} - -// SetMetaHeader sets meta header of the response. -func (m *ListResponse) SetMetaHeader(v *session.ResponseMetaHeader) { - m.MetaHeader = v -} - -// SetVerifyHeader sets verification header of the response. -func (m *ListResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) { - m.VerifyHeader = v -} - -// SetContainerId sets identifier of the container. -func (m *GetExtendedACLRequest_Body) SetContainerId(v *refs.ContainerID) { - m.ContainerId = v -} - -// SetBody sets body of the request. -func (m *GetExtendedACLRequest) SetBody(v *GetExtendedACLRequest_Body) { - m.Body = v -} - -// SetMetaHeader sets meta header of the request. -func (m *GetExtendedACLRequest) SetMetaHeader(v *session.RequestMetaHeader) { - m.MetaHeader = v -} - -// SetVerifyHeader sets verification header of the request. -func (m *GetExtendedACLRequest) SetVerifyHeader(v *session.RequestVerificationHeader) { - m.VerifyHeader = v -} - -// SetEacl sets eACL table structure. -func (m *GetExtendedACLResponse_Body) SetEacl(v *acl.EACLTable) { - m.Eacl = v -} - -// SetSignature sets signature of the eACL table structure. -func (m *GetExtendedACLResponse_Body) SetSignature(v *refs.SignatureRFC6979) { - m.Signature = v -} - -// SetSessionToken sets token of the session within which requested -// eACl table was set. -func (m *GetExtendedACLResponse_Body) SetSessionToken(v *session.SessionToken) { - m.SessionToken = v -} - -// SetBody sets body of the response. -func (m *GetExtendedACLResponse) SetBody(v *GetExtendedACLResponse_Body) { - m.Body = v -} - -// SetMetaHeader sets meta header of the response. -func (m *GetExtendedACLResponse) SetMetaHeader(v *session.ResponseMetaHeader) { - m.MetaHeader = v -} - -// SetVerifyHeader sets verification header of the response. -func (m *GetExtendedACLResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) { - m.VerifyHeader = v -} diff --git a/container/grpc/service.pb.go b/container/grpc/service.pb.go deleted file mode 100644 index 3bf1e14..0000000 --- a/container/grpc/service.pb.go +++ /dev/null @@ -1,1909 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.33.0 -// protoc v5.27.2 -// source: container/grpc/service.proto - -package container - -import ( - grpc2 "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/acl/grpc" - grpc1 "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc" - grpc "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session/grpc" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -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) -) - -// New NeoFS Container creation request -type PutRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Body of container put request message. - Body *PutRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" 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,proto3" json:"verify_header,omitempty"` -} - -func (x *PutRequest) Reset() { - *x = PutRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_container_grpc_service_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PutRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PutRequest) ProtoMessage() {} - -func (x *PutRequest) ProtoReflect() protoreflect.Message { - mi := &file_container_grpc_service_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PutRequest.ProtoReflect.Descriptor instead. -func (*PutRequest) Descriptor() ([]byte, []int) { - return file_container_grpc_service_proto_rawDescGZIP(), []int{0} -} - -func (x *PutRequest) GetBody() *PutRequest_Body { - if x != nil { - return x.Body - } - return nil -} - -func (x *PutRequest) GetMetaHeader() *grpc.RequestMetaHeader { - if x != nil { - return x.MetaHeader - } - return nil -} - -func (x *PutRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { - if x != nil { - return x.VerifyHeader - } - return nil -} - -// New NeoFS Container creation response -type PutResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Body of container put response message. - Body *PutResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" 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,proto3" json:"verify_header,omitempty"` -} - -func (x *PutResponse) Reset() { - *x = PutResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_container_grpc_service_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PutResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PutResponse) ProtoMessage() {} - -func (x *PutResponse) ProtoReflect() protoreflect.Message { - mi := &file_container_grpc_service_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PutResponse.ProtoReflect.Descriptor instead. -func (*PutResponse) Descriptor() ([]byte, []int) { - return file_container_grpc_service_proto_rawDescGZIP(), []int{1} -} - -func (x *PutResponse) GetBody() *PutResponse_Body { - if x != nil { - return x.Body - } - return nil -} - -func (x *PutResponse) GetMetaHeader() *grpc.ResponseMetaHeader { - if x != nil { - return x.MetaHeader - } - return nil -} - -func (x *PutResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { - if x != nil { - return x.VerifyHeader - } - return nil -} - -// Container removal request -type DeleteRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Body of container delete request message. - Body *DeleteRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" 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,proto3" json:"verify_header,omitempty"` -} - -func (x *DeleteRequest) Reset() { - *x = DeleteRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_container_grpc_service_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *DeleteRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DeleteRequest) ProtoMessage() {} - -func (x *DeleteRequest) ProtoReflect() protoreflect.Message { - mi := &file_container_grpc_service_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use DeleteRequest.ProtoReflect.Descriptor instead. -func (*DeleteRequest) Descriptor() ([]byte, []int) { - return file_container_grpc_service_proto_rawDescGZIP(), []int{2} -} - -func (x *DeleteRequest) GetBody() *DeleteRequest_Body { - if x != nil { - return x.Body - } - return nil -} - -func (x *DeleteRequest) GetMetaHeader() *grpc.RequestMetaHeader { - if x != nil { - return x.MetaHeader - } - return nil -} - -func (x *DeleteRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { - if x != nil { - return x.VerifyHeader - } - return nil -} - -// `DeleteResponse` has an empty body because delete operation is asynchronous -// and done via consensus in Inner Ring nodes. -type DeleteResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Body of container delete response message. - Body *DeleteResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" 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,proto3" json:"verify_header,omitempty"` -} - -func (x *DeleteResponse) Reset() { - *x = DeleteResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_container_grpc_service_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *DeleteResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DeleteResponse) ProtoMessage() {} - -func (x *DeleteResponse) ProtoReflect() protoreflect.Message { - mi := &file_container_grpc_service_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use DeleteResponse.ProtoReflect.Descriptor instead. -func (*DeleteResponse) Descriptor() ([]byte, []int) { - return file_container_grpc_service_proto_rawDescGZIP(), []int{3} -} - -func (x *DeleteResponse) GetBody() *DeleteResponse_Body { - if x != nil { - return x.Body - } - return nil -} - -func (x *DeleteResponse) GetMetaHeader() *grpc.ResponseMetaHeader { - if x != nil { - return x.MetaHeader - } - return nil -} - -func (x *DeleteResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { - if x != nil { - return x.VerifyHeader - } - return nil -} - -// Get container structure -type GetRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Body of container get request message. - Body *GetRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" 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,proto3" json:"verify_header,omitempty"` -} - -func (x *GetRequest) Reset() { - *x = GetRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_container_grpc_service_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GetRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetRequest) ProtoMessage() {} - -func (x *GetRequest) ProtoReflect() protoreflect.Message { - mi := &file_container_grpc_service_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GetRequest.ProtoReflect.Descriptor instead. -func (*GetRequest) Descriptor() ([]byte, []int) { - return file_container_grpc_service_proto_rawDescGZIP(), []int{4} -} - -func (x *GetRequest) GetBody() *GetRequest_Body { - if x != nil { - return x.Body - } - return nil -} - -func (x *GetRequest) GetMetaHeader() *grpc.RequestMetaHeader { - if x != nil { - return x.MetaHeader - } - return nil -} - -func (x *GetRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { - if x != nil { - return x.VerifyHeader - } - return nil -} - -// Get container structure -type GetResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Body of container get response message. - Body *GetResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" 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,proto3" json:"verify_header,omitempty"` -} - -func (x *GetResponse) Reset() { - *x = GetResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_container_grpc_service_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GetResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetResponse) ProtoMessage() {} - -func (x *GetResponse) ProtoReflect() protoreflect.Message { - mi := &file_container_grpc_service_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GetResponse.ProtoReflect.Descriptor instead. -func (*GetResponse) Descriptor() ([]byte, []int) { - return file_container_grpc_service_proto_rawDescGZIP(), []int{5} -} - -func (x *GetResponse) GetBody() *GetResponse_Body { - if x != nil { - return x.Body - } - return nil -} - -func (x *GetResponse) GetMetaHeader() *grpc.ResponseMetaHeader { - if x != nil { - return x.MetaHeader - } - return nil -} - -func (x *GetResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { - if x != nil { - return x.VerifyHeader - } - return nil -} - -// List containers -type ListRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Body of list containers request message - Body *ListRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" 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,proto3" json:"verify_header,omitempty"` -} - -func (x *ListRequest) Reset() { - *x = ListRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_container_grpc_service_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ListRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ListRequest) ProtoMessage() {} - -func (x *ListRequest) ProtoReflect() protoreflect.Message { - mi := &file_container_grpc_service_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ListRequest.ProtoReflect.Descriptor instead. -func (*ListRequest) Descriptor() ([]byte, []int) { - return file_container_grpc_service_proto_rawDescGZIP(), []int{6} -} - -func (x *ListRequest) GetBody() *ListRequest_Body { - if x != nil { - return x.Body - } - return nil -} - -func (x *ListRequest) GetMetaHeader() *grpc.RequestMetaHeader { - if x != nil { - return x.MetaHeader - } - return nil -} - -func (x *ListRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { - if x != nil { - return x.VerifyHeader - } - return nil -} - -// List containers -type ListResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Body of list containers response message. - Body *ListResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" 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,proto3" json:"verify_header,omitempty"` -} - -func (x *ListResponse) Reset() { - *x = ListResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_container_grpc_service_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ListResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ListResponse) ProtoMessage() {} - -func (x *ListResponse) ProtoReflect() protoreflect.Message { - mi := &file_container_grpc_service_proto_msgTypes[7] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ListResponse.ProtoReflect.Descriptor instead. -func (*ListResponse) Descriptor() ([]byte, []int) { - return file_container_grpc_service_proto_rawDescGZIP(), []int{7} -} - -func (x *ListResponse) GetBody() *ListResponse_Body { - if x != nil { - return x.Body - } - return nil -} - -func (x *ListResponse) GetMetaHeader() *grpc.ResponseMetaHeader { - if x != nil { - return x.MetaHeader - } - return nil -} - -func (x *ListResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { - if x != nil { - return x.VerifyHeader - } - return nil -} - -// Get Extended ACL -type GetExtendedACLRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Body of get extended acl request message. - Body *GetExtendedACLRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" 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,proto3" json:"verify_header,omitempty"` -} - -func (x *GetExtendedACLRequest) Reset() { - *x = GetExtendedACLRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_container_grpc_service_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GetExtendedACLRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetExtendedACLRequest) ProtoMessage() {} - -func (x *GetExtendedACLRequest) ProtoReflect() protoreflect.Message { - mi := &file_container_grpc_service_proto_msgTypes[8] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GetExtendedACLRequest.ProtoReflect.Descriptor instead. -func (*GetExtendedACLRequest) Descriptor() ([]byte, []int) { - return file_container_grpc_service_proto_rawDescGZIP(), []int{8} -} - -func (x *GetExtendedACLRequest) GetBody() *GetExtendedACLRequest_Body { - if x != nil { - return x.Body - } - return nil -} - -func (x *GetExtendedACLRequest) GetMetaHeader() *grpc.RequestMetaHeader { - if x != nil { - return x.MetaHeader - } - return nil -} - -func (x *GetExtendedACLRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { - if x != nil { - return x.VerifyHeader - } - return nil -} - -// Get Extended ACL -type GetExtendedACLResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Body of get extended acl response message. - Body *GetExtendedACLResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" 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,proto3" json:"verify_header,omitempty"` -} - -func (x *GetExtendedACLResponse) Reset() { - *x = GetExtendedACLResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_container_grpc_service_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GetExtendedACLResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetExtendedACLResponse) ProtoMessage() {} - -func (x *GetExtendedACLResponse) ProtoReflect() protoreflect.Message { - mi := &file_container_grpc_service_proto_msgTypes[9] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GetExtendedACLResponse.ProtoReflect.Descriptor instead. -func (*GetExtendedACLResponse) Descriptor() ([]byte, []int) { - return file_container_grpc_service_proto_rawDescGZIP(), []int{9} -} - -func (x *GetExtendedACLResponse) GetBody() *GetExtendedACLResponse_Body { - if x != nil { - return x.Body - } - return nil -} - -func (x *GetExtendedACLResponse) GetMetaHeader() *grpc.ResponseMetaHeader { - if x != nil { - return x.MetaHeader - } - return nil -} - -func (x *GetExtendedACLResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { - if x != nil { - return x.VerifyHeader - } - return nil -} - -// Container creation request has container structure's signature as a -// separate field. It's not stored in sidechain, just verified on container -// creation by `Container` smart contract. `ContainerID` is a SHA256 hash of -// the stable-marshalled container strucutre, hence there is no need for -// additional signature checks. -type PutRequest_Body struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Container structure to register in NeoFS - Container *Container `protobuf:"bytes,1,opt,name=container,proto3" json:"container,omitempty"` - // Signature of a stable-marshalled container according to RFC-6979. - Signature *grpc1.SignatureRFC6979 `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` -} - -func (x *PutRequest_Body) Reset() { - *x = PutRequest_Body{} - if protoimpl.UnsafeEnabled { - mi := &file_container_grpc_service_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PutRequest_Body) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PutRequest_Body) ProtoMessage() {} - -func (x *PutRequest_Body) ProtoReflect() protoreflect.Message { - mi := &file_container_grpc_service_proto_msgTypes[10] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PutRequest_Body.ProtoReflect.Descriptor instead. -func (*PutRequest_Body) Descriptor() ([]byte, []int) { - return file_container_grpc_service_proto_rawDescGZIP(), []int{0, 0} -} - -func (x *PutRequest_Body) GetContainer() *Container { - if x != nil { - return x.Container - } - return nil -} - -func (x *PutRequest_Body) GetSignature() *grpc1.SignatureRFC6979 { - if x != nil { - return x.Signature - } - return nil -} - -// Container put response body contains information about the newly registered -// container as seen by `Container` smart contract. `ContainerID` can be -// calculated beforehand from the container structure and compared to the one -// returned here to make sure everything has been done as expected. -type PutResponse_Body struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Unique identifier of the newly created container - ContainerId *grpc1.ContainerID `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` -} - -func (x *PutResponse_Body) Reset() { - *x = PutResponse_Body{} - if protoimpl.UnsafeEnabled { - mi := &file_container_grpc_service_proto_msgTypes[11] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PutResponse_Body) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PutResponse_Body) ProtoMessage() {} - -func (x *PutResponse_Body) ProtoReflect() protoreflect.Message { - mi := &file_container_grpc_service_proto_msgTypes[11] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PutResponse_Body.ProtoReflect.Descriptor instead. -func (*PutResponse_Body) Descriptor() ([]byte, []int) { - return file_container_grpc_service_proto_rawDescGZIP(), []int{1, 0} -} - -func (x *PutResponse_Body) GetContainerId() *grpc1.ContainerID { - if x != nil { - return x.ContainerId - } - return nil -} - -// Container removal request body has signed `ContainerID` as a proof of -// the container owner's intent. The signature will be verified by `Container` -// smart contract, so signing algorithm must be supported by NeoVM. -type DeleteRequest_Body struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Identifier of the container to delete from NeoFS - ContainerId *grpc1.ContainerID `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` - // `ContainerID` signed with the container owner's key according to - // RFC-6979. - Signature *grpc1.SignatureRFC6979 `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` -} - -func (x *DeleteRequest_Body) Reset() { - *x = DeleteRequest_Body{} - if protoimpl.UnsafeEnabled { - mi := &file_container_grpc_service_proto_msgTypes[12] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *DeleteRequest_Body) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DeleteRequest_Body) ProtoMessage() {} - -func (x *DeleteRequest_Body) ProtoReflect() protoreflect.Message { - mi := &file_container_grpc_service_proto_msgTypes[12] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use DeleteRequest_Body.ProtoReflect.Descriptor instead. -func (*DeleteRequest_Body) Descriptor() ([]byte, []int) { - return file_container_grpc_service_proto_rawDescGZIP(), []int{2, 0} -} - -func (x *DeleteRequest_Body) GetContainerId() *grpc1.ContainerID { - if x != nil { - return x.ContainerId - } - return nil -} - -func (x *DeleteRequest_Body) GetSignature() *grpc1.SignatureRFC6979 { - if x != nil { - return x.Signature - } - return nil -} - -// `DeleteResponse` has an empty body because delete operation is asynchronous -// and done via consensus in Inner Ring nodes. -type DeleteResponse_Body struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *DeleteResponse_Body) Reset() { - *x = DeleteResponse_Body{} - if protoimpl.UnsafeEnabled { - mi := &file_container_grpc_service_proto_msgTypes[13] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *DeleteResponse_Body) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DeleteResponse_Body) ProtoMessage() {} - -func (x *DeleteResponse_Body) ProtoReflect() protoreflect.Message { - mi := &file_container_grpc_service_proto_msgTypes[13] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use DeleteResponse_Body.ProtoReflect.Descriptor instead. -func (*DeleteResponse_Body) Descriptor() ([]byte, []int) { - return file_container_grpc_service_proto_rawDescGZIP(), []int{3, 0} -} - -// Get container structure request body. -type GetRequest_Body struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Identifier of the container to get - ContainerId *grpc1.ContainerID `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` -} - -func (x *GetRequest_Body) Reset() { - *x = GetRequest_Body{} - if protoimpl.UnsafeEnabled { - mi := &file_container_grpc_service_proto_msgTypes[14] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GetRequest_Body) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetRequest_Body) ProtoMessage() {} - -func (x *GetRequest_Body) ProtoReflect() protoreflect.Message { - mi := &file_container_grpc_service_proto_msgTypes[14] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GetRequest_Body.ProtoReflect.Descriptor instead. -func (*GetRequest_Body) Descriptor() ([]byte, []int) { - return file_container_grpc_service_proto_rawDescGZIP(), []int{4, 0} -} - -func (x *GetRequest_Body) GetContainerId() *grpc1.ContainerID { - if x != nil { - return x.ContainerId - } - return nil -} - -// Get container response body does not have container structure signature. It -// has been already verified upon container creation. -type GetResponse_Body struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Requested container structure - Container *Container `protobuf:"bytes,1,opt,name=container,proto3" json:"container,omitempty"` - // Signature of a stable-marshalled container according to RFC-6979. - Signature *grpc1.SignatureRFC6979 `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` - // Session token if the container has been created within the session - SessionToken *grpc.SessionToken `protobuf:"bytes,3,opt,name=session_token,json=sessionToken,proto3" json:"session_token,omitempty"` -} - -func (x *GetResponse_Body) Reset() { - *x = GetResponse_Body{} - if protoimpl.UnsafeEnabled { - mi := &file_container_grpc_service_proto_msgTypes[15] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GetResponse_Body) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetResponse_Body) ProtoMessage() {} - -func (x *GetResponse_Body) ProtoReflect() protoreflect.Message { - mi := &file_container_grpc_service_proto_msgTypes[15] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GetResponse_Body.ProtoReflect.Descriptor instead. -func (*GetResponse_Body) Descriptor() ([]byte, []int) { - return file_container_grpc_service_proto_rawDescGZIP(), []int{5, 0} -} - -func (x *GetResponse_Body) GetContainer() *Container { - if x != nil { - return x.Container - } - return nil -} - -func (x *GetResponse_Body) GetSignature() *grpc1.SignatureRFC6979 { - if x != nil { - return x.Signature - } - return nil -} - -func (x *GetResponse_Body) GetSessionToken() *grpc.SessionToken { - if x != nil { - return x.SessionToken - } - return nil -} - -// List containers request body. -type ListRequest_Body struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Identifier of the container owner - OwnerId *grpc1.OwnerID `protobuf:"bytes,1,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"` -} - -func (x *ListRequest_Body) Reset() { - *x = ListRequest_Body{} - if protoimpl.UnsafeEnabled { - mi := &file_container_grpc_service_proto_msgTypes[16] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ListRequest_Body) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ListRequest_Body) ProtoMessage() {} - -func (x *ListRequest_Body) ProtoReflect() protoreflect.Message { - mi := &file_container_grpc_service_proto_msgTypes[16] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ListRequest_Body.ProtoReflect.Descriptor instead. -func (*ListRequest_Body) Descriptor() ([]byte, []int) { - return file_container_grpc_service_proto_rawDescGZIP(), []int{6, 0} -} - -func (x *ListRequest_Body) GetOwnerId() *grpc1.OwnerID { - if x != nil { - return x.OwnerId - } - return nil -} - -// List containers response body. -type ListResponse_Body struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // List of `ContainerID`s belonging to the requested `OwnerID` - ContainerIds []*grpc1.ContainerID `protobuf:"bytes,1,rep,name=container_ids,json=containerIds,proto3" json:"container_ids,omitempty"` -} - -func (x *ListResponse_Body) Reset() { - *x = ListResponse_Body{} - if protoimpl.UnsafeEnabled { - mi := &file_container_grpc_service_proto_msgTypes[17] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ListResponse_Body) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ListResponse_Body) ProtoMessage() {} - -func (x *ListResponse_Body) ProtoReflect() protoreflect.Message { - mi := &file_container_grpc_service_proto_msgTypes[17] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ListResponse_Body.ProtoReflect.Descriptor instead. -func (*ListResponse_Body) Descriptor() ([]byte, []int) { - return file_container_grpc_service_proto_rawDescGZIP(), []int{7, 0} -} - -func (x *ListResponse_Body) GetContainerIds() []*grpc1.ContainerID { - if x != nil { - return x.ContainerIds - } - return nil -} - -// Get Extended ACL request body -type GetExtendedACLRequest_Body struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Identifier of the container having Extended ACL - ContainerId *grpc1.ContainerID `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` -} - -func (x *GetExtendedACLRequest_Body) Reset() { - *x = GetExtendedACLRequest_Body{} - if protoimpl.UnsafeEnabled { - mi := &file_container_grpc_service_proto_msgTypes[18] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GetExtendedACLRequest_Body) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetExtendedACLRequest_Body) ProtoMessage() {} - -func (x *GetExtendedACLRequest_Body) ProtoReflect() protoreflect.Message { - mi := &file_container_grpc_service_proto_msgTypes[18] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GetExtendedACLRequest_Body.ProtoReflect.Descriptor instead. -func (*GetExtendedACLRequest_Body) Descriptor() ([]byte, []int) { - return file_container_grpc_service_proto_rawDescGZIP(), []int{8, 0} -} - -func (x *GetExtendedACLRequest_Body) GetContainerId() *grpc1.ContainerID { - if x != nil { - return x.ContainerId - } - return nil -} - -// Get Extended ACL Response body can be empty if the requested container does -// not have Extended ACL Table attached or Extended ACL has not been allowed -// at the time of container creation. -type GetExtendedACLResponse_Body struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Extended ACL requested, if available - Eacl *grpc2.EACLTable `protobuf:"bytes,1,opt,name=eacl,proto3" json:"eacl,omitempty"` - // Signature of stable-marshalled Extended ACL according to RFC-6979. - Signature *grpc1.SignatureRFC6979 `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` - // Session token if Extended ACL was set within a session - SessionToken *grpc.SessionToken `protobuf:"bytes,3,opt,name=session_token,json=sessionToken,proto3" json:"session_token,omitempty"` -} - -func (x *GetExtendedACLResponse_Body) Reset() { - *x = GetExtendedACLResponse_Body{} - if protoimpl.UnsafeEnabled { - mi := &file_container_grpc_service_proto_msgTypes[19] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GetExtendedACLResponse_Body) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetExtendedACLResponse_Body) ProtoMessage() {} - -func (x *GetExtendedACLResponse_Body) ProtoReflect() protoreflect.Message { - mi := &file_container_grpc_service_proto_msgTypes[19] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GetExtendedACLResponse_Body.ProtoReflect.Descriptor instead. -func (*GetExtendedACLResponse_Body) Descriptor() ([]byte, []int) { - return file_container_grpc_service_proto_rawDescGZIP(), []int{9, 0} -} - -func (x *GetExtendedACLResponse_Body) GetEacl() *grpc2.EACLTable { - if x != nil { - return x.Eacl - } - return nil -} - -func (x *GetExtendedACLResponse_Body) GetSignature() *grpc1.SignatureRFC6979 { - if x != nil { - return x.Signature - } - return nil -} - -func (x *GetExtendedACLResponse_Body) GetSessionToken() *grpc.SessionToken { - if x != nil { - return x.SessionToken - } - return nil -} - -var File_container_grpc_service_proto protoreflect.FileDescriptor - -var file_container_grpc_service_proto_rawDesc = []byte{ - 0x0a, 0x1c, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2f, 0x67, 0x72, 0x70, 0x63, - 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 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, 0x14, 0x61, 0x63, 0x6c, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, - 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1a, 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, 0x1a, 0x15, 0x72, 0x65, 0x66, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, - 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x18, 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, 0xe7, 0x02, 0x0a, 0x0a, 0x50, 0x75, 0x74, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x38, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, - 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x75, 0x74, 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, 0x84, 0x01, 0x0a, 0x04, 0x42, 0x6f, - 0x64, 0x79, 0x12, 0x3c, 0x0a, 0x09, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 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, 0x52, 0x09, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, - 0x12, 0x3e, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, - 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x46, - 0x43, 0x36, 0x39, 0x37, 0x39, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, - 0x22, 0xac, 0x02, 0x0a, 0x0b, 0x50, 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 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, 0x63, 0x6f, 0x6e, 0x74, 0x61, - 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x75, 0x74, 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, 0x46, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, - 0x3e, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, - 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, - 0x49, 0x44, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x64, 0x22, - 0xef, 0x02, 0x0a, 0x0d, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x12, 0x3b, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x27, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, - 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x44, 0x65, 0x6c, 0x65, 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, 0x86, 0x01, 0x0a, 0x04, 0x42, 0x6f, 0x64, - 0x79, 0x12, 0x3e, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, - 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, - 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, - 0x65, 0x72, 0x49, 0x44, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, - 0x64, 0x12, 0x3e, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, - 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, - 0x46, 0x43, 0x36, 0x39, 0x37, 0x39, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, - 0x65, 0x22, 0xf2, 0x01, 0x0a, 0x0e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3c, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, - 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, 0x44, 0x65, 0x6c, 0x65, 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, 0x06, - 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x22, 0xa8, 0x02, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x38, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, - 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x74, 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, 0x46, 0x0a, 0x04, 0x42, 0x6f, 0x64, - 0x79, 0x12, 0x3e, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, - 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, - 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, - 0x65, 0x72, 0x49, 0x44, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, - 0x64, 0x22, 0xb1, 0x03, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 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, 0x63, 0x6f, 0x6e, 0x74, - 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x74, 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, 0xca, 0x01, 0x0a, 0x04, 0x42, 0x6f, 0x64, - 0x79, 0x12, 0x3c, 0x0a, 0x09, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 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, 0x52, 0x09, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x12, - 0x3e, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, - 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x46, 0x43, - 0x36, 0x39, 0x37, 0x39, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, - 0x44, 0x0a, 0x0d, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, - 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, - 0x6f, 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x0c, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, - 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x9e, 0x02, 0x0a, 0x0b, 0x4c, 0x69, 0x73, 0x74, 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, - 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x4c, 0x69, 0x73, 0x74, 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, 0xb0, 0x02, 0x0a, 0x0c, 0x4c, 0x69, 0x73, 0x74, 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, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x4c, 0x69, 0x73, 0x74, - 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, - 0x48, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x40, 0x0a, 0x0d, 0x63, 0x6f, 0x6e, 0x74, 0x61, - 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, - 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, - 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x52, 0x0c, 0x63, 0x6f, 0x6e, - 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x64, 0x73, 0x22, 0xbe, 0x02, 0x0a, 0x15, 0x47, 0x65, - 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x41, 0x43, 0x4c, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x12, 0x43, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x2f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, - 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, - 0x64, 0x65, 0x64, 0x41, 0x43, 0x4c, 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, 0x46, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x3e, 0x0a, 0x0c, 0x63, 0x6f, - 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, - 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x52, 0x0b, 0x63, - 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x64, 0x22, 0xb7, 0x03, 0x0a, 0x16, 0x47, - 0x65, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x41, 0x43, 0x4c, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x44, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x30, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, - 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x74, 0x45, 0x78, 0x74, - 0x65, 0x6e, 0x64, 0x65, 0x64, 0x41, 0x43, 0x4c, 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, 0xba, 0x01, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, - 0x12, 0x2c, 0x0a, 0x04, 0x65, 0x61, 0x63, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, - 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x45, - 0x41, 0x43, 0x4c, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x52, 0x04, 0x65, 0x61, 0x63, 0x6c, 0x12, 0x3e, - 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, - 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x46, 0x43, 0x36, - 0x39, 0x37, 0x39, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x44, - 0x0a, 0x0d, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, - 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, - 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x0c, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x54, - 0x6f, 0x6b, 0x65, 0x6e, 0x32, 0xb1, 0x03, 0x0a, 0x10, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, - 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x48, 0x0a, 0x03, 0x50, 0x75, 0x74, - 0x12, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, - 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, - 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x12, 0x51, 0x0a, 0x06, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x12, 0x22, 0x2e, - 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, - 0x6e, 0x65, 0x72, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x23, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, - 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x48, 0x0a, 0x03, 0x47, 0x65, 0x74, 0x12, 0x1f, 0x2e, - 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, - 0x6e, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, - 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, - 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x12, 0x4b, 0x0a, 0x04, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, - 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x4c, - 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x6e, 0x65, 0x6f, - 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, - 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x69, 0x0a, - 0x0e, 0x47, 0x65, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x41, 0x43, 0x4c, 0x12, - 0x2a, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, - 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, - 0x64, 0x41, 0x43, 0x4c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2b, 0x2e, 0x6e, 0x65, - 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, - 0x72, 0x2e, 0x47, 0x65, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x41, 0x43, 0x4c, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x6a, 0x5a, 0x48, 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, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 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, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_container_grpc_service_proto_rawDescOnce sync.Once - file_container_grpc_service_proto_rawDescData = file_container_grpc_service_proto_rawDesc -) - -func file_container_grpc_service_proto_rawDescGZIP() []byte { - file_container_grpc_service_proto_rawDescOnce.Do(func() { - file_container_grpc_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_container_grpc_service_proto_rawDescData) - }) - return file_container_grpc_service_proto_rawDescData -} - -var file_container_grpc_service_proto_msgTypes = make([]protoimpl.MessageInfo, 20) -var file_container_grpc_service_proto_goTypes = []interface{}{ - (*PutRequest)(nil), // 0: neo.fs.v2.container.PutRequest - (*PutResponse)(nil), // 1: neo.fs.v2.container.PutResponse - (*DeleteRequest)(nil), // 2: neo.fs.v2.container.DeleteRequest - (*DeleteResponse)(nil), // 3: neo.fs.v2.container.DeleteResponse - (*GetRequest)(nil), // 4: neo.fs.v2.container.GetRequest - (*GetResponse)(nil), // 5: neo.fs.v2.container.GetResponse - (*ListRequest)(nil), // 6: neo.fs.v2.container.ListRequest - (*ListResponse)(nil), // 7: neo.fs.v2.container.ListResponse - (*GetExtendedACLRequest)(nil), // 8: neo.fs.v2.container.GetExtendedACLRequest - (*GetExtendedACLResponse)(nil), // 9: neo.fs.v2.container.GetExtendedACLResponse - (*PutRequest_Body)(nil), // 10: neo.fs.v2.container.PutRequest.Body - (*PutResponse_Body)(nil), // 11: neo.fs.v2.container.PutResponse.Body - (*DeleteRequest_Body)(nil), // 12: neo.fs.v2.container.DeleteRequest.Body - (*DeleteResponse_Body)(nil), // 13: neo.fs.v2.container.DeleteResponse.Body - (*GetRequest_Body)(nil), // 14: neo.fs.v2.container.GetRequest.Body - (*GetResponse_Body)(nil), // 15: neo.fs.v2.container.GetResponse.Body - (*ListRequest_Body)(nil), // 16: neo.fs.v2.container.ListRequest.Body - (*ListResponse_Body)(nil), // 17: neo.fs.v2.container.ListResponse.Body - (*GetExtendedACLRequest_Body)(nil), // 18: neo.fs.v2.container.GetExtendedACLRequest.Body - (*GetExtendedACLResponse_Body)(nil), // 19: neo.fs.v2.container.GetExtendedACLResponse.Body - (*grpc.RequestMetaHeader)(nil), // 20: neo.fs.v2.session.RequestMetaHeader - (*grpc.RequestVerificationHeader)(nil), // 21: neo.fs.v2.session.RequestVerificationHeader - (*grpc.ResponseMetaHeader)(nil), // 22: neo.fs.v2.session.ResponseMetaHeader - (*grpc.ResponseVerificationHeader)(nil), // 23: neo.fs.v2.session.ResponseVerificationHeader - (*Container)(nil), // 24: neo.fs.v2.container.Container - (*grpc1.SignatureRFC6979)(nil), // 25: neo.fs.v2.refs.SignatureRFC6979 - (*grpc1.ContainerID)(nil), // 26: neo.fs.v2.refs.ContainerID - (*grpc.SessionToken)(nil), // 27: neo.fs.v2.session.SessionToken - (*grpc1.OwnerID)(nil), // 28: neo.fs.v2.refs.OwnerID - (*grpc2.EACLTable)(nil), // 29: neo.fs.v2.acl.EACLTable -} -var file_container_grpc_service_proto_depIdxs = []int32{ - 10, // 0: neo.fs.v2.container.PutRequest.body:type_name -> neo.fs.v2.container.PutRequest.Body - 20, // 1: neo.fs.v2.container.PutRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader - 21, // 2: neo.fs.v2.container.PutRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader - 11, // 3: neo.fs.v2.container.PutResponse.body:type_name -> neo.fs.v2.container.PutResponse.Body - 22, // 4: neo.fs.v2.container.PutResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader - 23, // 5: neo.fs.v2.container.PutResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader - 12, // 6: neo.fs.v2.container.DeleteRequest.body:type_name -> neo.fs.v2.container.DeleteRequest.Body - 20, // 7: neo.fs.v2.container.DeleteRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader - 21, // 8: neo.fs.v2.container.DeleteRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader - 13, // 9: neo.fs.v2.container.DeleteResponse.body:type_name -> neo.fs.v2.container.DeleteResponse.Body - 22, // 10: neo.fs.v2.container.DeleteResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader - 23, // 11: neo.fs.v2.container.DeleteResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader - 14, // 12: neo.fs.v2.container.GetRequest.body:type_name -> neo.fs.v2.container.GetRequest.Body - 20, // 13: neo.fs.v2.container.GetRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader - 21, // 14: neo.fs.v2.container.GetRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader - 15, // 15: neo.fs.v2.container.GetResponse.body:type_name -> neo.fs.v2.container.GetResponse.Body - 22, // 16: neo.fs.v2.container.GetResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader - 23, // 17: neo.fs.v2.container.GetResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader - 16, // 18: neo.fs.v2.container.ListRequest.body:type_name -> neo.fs.v2.container.ListRequest.Body - 20, // 19: neo.fs.v2.container.ListRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader - 21, // 20: neo.fs.v2.container.ListRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader - 17, // 21: neo.fs.v2.container.ListResponse.body:type_name -> neo.fs.v2.container.ListResponse.Body - 22, // 22: neo.fs.v2.container.ListResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader - 23, // 23: neo.fs.v2.container.ListResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader - 18, // 24: neo.fs.v2.container.GetExtendedACLRequest.body:type_name -> neo.fs.v2.container.GetExtendedACLRequest.Body - 20, // 25: neo.fs.v2.container.GetExtendedACLRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader - 21, // 26: neo.fs.v2.container.GetExtendedACLRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader - 19, // 27: neo.fs.v2.container.GetExtendedACLResponse.body:type_name -> neo.fs.v2.container.GetExtendedACLResponse.Body - 22, // 28: neo.fs.v2.container.GetExtendedACLResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader - 23, // 29: neo.fs.v2.container.GetExtendedACLResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader - 24, // 30: neo.fs.v2.container.PutRequest.Body.container:type_name -> neo.fs.v2.container.Container - 25, // 31: neo.fs.v2.container.PutRequest.Body.signature:type_name -> neo.fs.v2.refs.SignatureRFC6979 - 26, // 32: neo.fs.v2.container.PutResponse.Body.container_id:type_name -> neo.fs.v2.refs.ContainerID - 26, // 33: neo.fs.v2.container.DeleteRequest.Body.container_id:type_name -> neo.fs.v2.refs.ContainerID - 25, // 34: neo.fs.v2.container.DeleteRequest.Body.signature:type_name -> neo.fs.v2.refs.SignatureRFC6979 - 26, // 35: neo.fs.v2.container.GetRequest.Body.container_id:type_name -> neo.fs.v2.refs.ContainerID - 24, // 36: neo.fs.v2.container.GetResponse.Body.container:type_name -> neo.fs.v2.container.Container - 25, // 37: neo.fs.v2.container.GetResponse.Body.signature:type_name -> neo.fs.v2.refs.SignatureRFC6979 - 27, // 38: neo.fs.v2.container.GetResponse.Body.session_token:type_name -> neo.fs.v2.session.SessionToken - 28, // 39: neo.fs.v2.container.ListRequest.Body.owner_id:type_name -> neo.fs.v2.refs.OwnerID - 26, // 40: neo.fs.v2.container.ListResponse.Body.container_ids:type_name -> neo.fs.v2.refs.ContainerID - 26, // 41: neo.fs.v2.container.GetExtendedACLRequest.Body.container_id:type_name -> neo.fs.v2.refs.ContainerID - 29, // 42: neo.fs.v2.container.GetExtendedACLResponse.Body.eacl:type_name -> neo.fs.v2.acl.EACLTable - 25, // 43: neo.fs.v2.container.GetExtendedACLResponse.Body.signature:type_name -> neo.fs.v2.refs.SignatureRFC6979 - 27, // 44: neo.fs.v2.container.GetExtendedACLResponse.Body.session_token:type_name -> neo.fs.v2.session.SessionToken - 0, // 45: neo.fs.v2.container.ContainerService.Put:input_type -> neo.fs.v2.container.PutRequest - 2, // 46: neo.fs.v2.container.ContainerService.Delete:input_type -> neo.fs.v2.container.DeleteRequest - 4, // 47: neo.fs.v2.container.ContainerService.Get:input_type -> neo.fs.v2.container.GetRequest - 6, // 48: neo.fs.v2.container.ContainerService.List:input_type -> neo.fs.v2.container.ListRequest - 8, // 49: neo.fs.v2.container.ContainerService.GetExtendedACL:input_type -> neo.fs.v2.container.GetExtendedACLRequest - 1, // 50: neo.fs.v2.container.ContainerService.Put:output_type -> neo.fs.v2.container.PutResponse - 3, // 51: neo.fs.v2.container.ContainerService.Delete:output_type -> neo.fs.v2.container.DeleteResponse - 5, // 52: neo.fs.v2.container.ContainerService.Get:output_type -> neo.fs.v2.container.GetResponse - 7, // 53: neo.fs.v2.container.ContainerService.List:output_type -> neo.fs.v2.container.ListResponse - 9, // 54: neo.fs.v2.container.ContainerService.GetExtendedACL:output_type -> neo.fs.v2.container.GetExtendedACLResponse - 50, // [50:55] is the sub-list for method output_type - 45, // [45:50] is the sub-list for method input_type - 45, // [45:45] is the sub-list for extension type_name - 45, // [45:45] is the sub-list for extension extendee - 0, // [0:45] is the sub-list for field type_name -} - -func init() { file_container_grpc_service_proto_init() } -func file_container_grpc_service_proto_init() { - if File_container_grpc_service_proto != nil { - return - } - file_container_grpc_types_proto_init() - if !protoimpl.UnsafeEnabled { - file_container_grpc_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PutRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_container_grpc_service_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PutResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_container_grpc_service_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DeleteRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_container_grpc_service_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DeleteResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_container_grpc_service_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_container_grpc_service_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_container_grpc_service_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ListRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_container_grpc_service_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ListResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_container_grpc_service_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetExtendedACLRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_container_grpc_service_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetExtendedACLResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_container_grpc_service_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PutRequest_Body); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_container_grpc_service_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PutResponse_Body); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_container_grpc_service_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DeleteRequest_Body); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_container_grpc_service_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DeleteResponse_Body); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_container_grpc_service_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetRequest_Body); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_container_grpc_service_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetResponse_Body); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_container_grpc_service_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ListRequest_Body); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_container_grpc_service_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ListResponse_Body); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_container_grpc_service_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetExtendedACLRequest_Body); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_container_grpc_service_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetExtendedACLResponse_Body); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_container_grpc_service_proto_rawDesc, - NumEnums: 0, - NumMessages: 20, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_container_grpc_service_proto_goTypes, - DependencyIndexes: file_container_grpc_service_proto_depIdxs, - MessageInfos: file_container_grpc_service_proto_msgTypes, - }.Build() - File_container_grpc_service_proto = out.File - file_container_grpc_service_proto_rawDesc = nil - file_container_grpc_service_proto_goTypes = nil - file_container_grpc_service_proto_depIdxs = nil -} diff --git a/container/grpc/service_frostfs.pb.go b/container/grpc/service_frostfs.pb.go new file mode 100644 index 0000000..7590435 --- /dev/null +++ b/container/grpc/service_frostfs.pb.go @@ -0,0 +1,3748 @@ +// Code generated by protoc-gen-go-frostfs. DO NOT EDIT. + +package container + +import ( + json "encoding/json" + fmt "fmt" + grpc2 "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/acl/grpc" + grpc "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc" + grpc1 "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session/grpc" + pool "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/pool" + proto "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/proto" + encoding "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/proto/encoding" + easyproto "github.com/VictoriaMetrics/easyproto" + jlexer "github.com/mailru/easyjson/jlexer" + jwriter "github.com/mailru/easyjson/jwriter" +) + +type PutRequest_Body struct { + Container *Container `json:"container"` + Signature *grpc.SignatureRFC6979 `json:"signature"` +} + +var ( + _ encoding.ProtoMarshaler = (*PutRequest_Body)(nil) + _ encoding.ProtoUnmarshaler = (*PutRequest_Body)(nil) + _ json.Marshaler = (*PutRequest_Body)(nil) + _ json.Unmarshaler = (*PutRequest_Body)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *PutRequest_Body) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.NestedStructureSize(1, x.Container) + size += proto.NestedStructureSize(2, x.Signature) + return size +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *PutRequest_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 *PutRequest_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if x.Container != nil && x.Container.StableSize() != 0 { + x.Container.EmitProtobuf(mm.AppendMessage(1)) + } + if x.Signature != nil && x.Signature.StableSize() != 0 { + x.Signature.EmitProtobuf(mm.AppendMessage(2)) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *PutRequest_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", "PutRequest_Body") + } + switch fc.FieldNum { + case 1: // Container + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Container") + } + x.Container = new(Container) + if err := x.Container.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + case 2: // Signature + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Signature") + } + x.Signature = new(grpc.SignatureRFC6979) + if err := x.Signature.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + } + } + return nil +} +func (x *PutRequest_Body) GetContainer() *Container { + if x != nil { + return x.Container + } + return nil +} +func (x *PutRequest_Body) SetContainer(v *Container) { + x.Container = v +} +func (x *PutRequest_Body) GetSignature() *grpc.SignatureRFC6979 { + if x != nil { + return x.Signature + } + return nil +} +func (x *PutRequest_Body) SetSignature(v *grpc.SignatureRFC6979) { + x.Signature = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *PutRequest_Body) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *PutRequest_Body) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"container\":" + out.RawString(prefix[1:]) + x.Container.MarshalEasyJSON(out) + } + { + const prefix string = ",\"signature\":" + out.RawString(prefix) + x.Signature.MarshalEasyJSON(out) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *PutRequest_Body) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *PutRequest_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 "container": + { + var f *Container + f = new(Container) + f.UnmarshalEasyJSON(in) + x.Container = f + } + case "signature": + { + var f *grpc.SignatureRFC6979 + f = new(grpc.SignatureRFC6979) + f.UnmarshalEasyJSON(in) + x.Signature = f + } + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} + +type PutRequest struct { + Body *PutRequest_Body `json:"body"` + MetaHeader *grpc1.RequestMetaHeader `json:"metaHeader"` + VerifyHeader *grpc1.RequestVerificationHeader `json:"verifyHeader"` +} + +var ( + _ encoding.ProtoMarshaler = (*PutRequest)(nil) + _ encoding.ProtoUnmarshaler = (*PutRequest)(nil) + _ json.Marshaler = (*PutRequest)(nil) + _ json.Unmarshaler = (*PutRequest)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *PutRequest) 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 *PutRequest) 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 *PutRequest) ReadSignedData(buf []byte) ([]byte, error) { + return x.GetBody().MarshalProtobuf(buf), nil +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *PutRequest) 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 *PutRequest) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if x.Body != nil && x.Body.StableSize() != 0 { + x.Body.EmitProtobuf(mm.AppendMessage(1)) + } + if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 { + x.MetaHeader.EmitProtobuf(mm.AppendMessage(2)) + } + if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 { + x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3)) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *PutRequest) 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", "PutRequest") + } + switch fc.FieldNum { + case 1: // Body + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Body") + } + x.Body = new(PutRequest_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 *PutRequest) GetBody() *PutRequest_Body { + if x != nil { + return x.Body + } + return nil +} +func (x *PutRequest) SetBody(v *PutRequest_Body) { + x.Body = v +} +func (x *PutRequest) GetMetaHeader() *grpc1.RequestMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} +func (x *PutRequest) SetMetaHeader(v *grpc1.RequestMetaHeader) { + x.MetaHeader = v +} +func (x *PutRequest) GetVerifyHeader() *grpc1.RequestVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} +func (x *PutRequest) SetVerifyHeader(v *grpc1.RequestVerificationHeader) { + x.VerifyHeader = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *PutRequest) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *PutRequest) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"body\":" + out.RawString(prefix[1:]) + x.Body.MarshalEasyJSON(out) + } + { + const prefix string = ",\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) + } + { + const prefix string = ",\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *PutRequest) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *PutRequest) 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 *PutRequest_Body + f = new(PutRequest_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 PutResponse_Body struct { + ContainerId *grpc.ContainerID `json:"containerId"` +} + +var ( + _ encoding.ProtoMarshaler = (*PutResponse_Body)(nil) + _ encoding.ProtoUnmarshaler = (*PutResponse_Body)(nil) + _ json.Marshaler = (*PutResponse_Body)(nil) + _ json.Unmarshaler = (*PutResponse_Body)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *PutResponse_Body) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.NestedStructureSize(1, x.ContainerId) + return size +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *PutResponse_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 *PutResponse_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if x.ContainerId != nil && x.ContainerId.StableSize() != 0 { + x.ContainerId.EmitProtobuf(mm.AppendMessage(1)) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *PutResponse_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", "PutResponse_Body") + } + switch fc.FieldNum { + case 1: // ContainerId + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "ContainerId") + } + x.ContainerId = new(grpc.ContainerID) + if err := x.ContainerId.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + } + } + return nil +} +func (x *PutResponse_Body) GetContainerId() *grpc.ContainerID { + if x != nil { + return x.ContainerId + } + return nil +} +func (x *PutResponse_Body) SetContainerId(v *grpc.ContainerID) { + x.ContainerId = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *PutResponse_Body) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *PutResponse_Body) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"containerId\":" + out.RawString(prefix[1:]) + x.ContainerId.MarshalEasyJSON(out) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *PutResponse_Body) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *PutResponse_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 "containerId": + { + var f *grpc.ContainerID + f = new(grpc.ContainerID) + f.UnmarshalEasyJSON(in) + x.ContainerId = f + } + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} + +type PutResponse struct { + Body *PutResponse_Body `json:"body"` + MetaHeader *grpc1.ResponseMetaHeader `json:"metaHeader"` + VerifyHeader *grpc1.ResponseVerificationHeader `json:"verifyHeader"` +} + +var ( + _ encoding.ProtoMarshaler = (*PutResponse)(nil) + _ encoding.ProtoUnmarshaler = (*PutResponse)(nil) + _ json.Marshaler = (*PutResponse)(nil) + _ json.Unmarshaler = (*PutResponse)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *PutResponse) 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 *PutResponse) 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 *PutResponse) ReadSignedData(buf []byte) ([]byte, error) { + return x.GetBody().MarshalProtobuf(buf), nil +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *PutResponse) 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 *PutResponse) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if x.Body != nil && x.Body.StableSize() != 0 { + x.Body.EmitProtobuf(mm.AppendMessage(1)) + } + if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 { + x.MetaHeader.EmitProtobuf(mm.AppendMessage(2)) + } + if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 { + x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3)) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *PutResponse) 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", "PutResponse") + } + switch fc.FieldNum { + case 1: // Body + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Body") + } + x.Body = new(PutResponse_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 *PutResponse) GetBody() *PutResponse_Body { + if x != nil { + return x.Body + } + return nil +} +func (x *PutResponse) SetBody(v *PutResponse_Body) { + x.Body = v +} +func (x *PutResponse) GetMetaHeader() *grpc1.ResponseMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} +func (x *PutResponse) SetMetaHeader(v *grpc1.ResponseMetaHeader) { + x.MetaHeader = v +} +func (x *PutResponse) GetVerifyHeader() *grpc1.ResponseVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} +func (x *PutResponse) SetVerifyHeader(v *grpc1.ResponseVerificationHeader) { + x.VerifyHeader = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *PutResponse) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *PutResponse) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"body\":" + out.RawString(prefix[1:]) + x.Body.MarshalEasyJSON(out) + } + { + const prefix string = ",\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) + } + { + const prefix string = ",\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *PutResponse) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *PutResponse) 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 *PutResponse_Body + f = new(PutResponse_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() + } +} + +type DeleteRequest_Body struct { + ContainerId *grpc.ContainerID `json:"containerId"` + Signature *grpc.SignatureRFC6979 `json:"signature"` +} + +var ( + _ encoding.ProtoMarshaler = (*DeleteRequest_Body)(nil) + _ encoding.ProtoUnmarshaler = (*DeleteRequest_Body)(nil) + _ json.Marshaler = (*DeleteRequest_Body)(nil) + _ json.Unmarshaler = (*DeleteRequest_Body)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *DeleteRequest_Body) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.NestedStructureSize(1, x.ContainerId) + size += proto.NestedStructureSize(2, x.Signature) + return size +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *DeleteRequest_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 *DeleteRequest_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if x.ContainerId != nil && x.ContainerId.StableSize() != 0 { + x.ContainerId.EmitProtobuf(mm.AppendMessage(1)) + } + if x.Signature != nil && x.Signature.StableSize() != 0 { + x.Signature.EmitProtobuf(mm.AppendMessage(2)) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *DeleteRequest_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", "DeleteRequest_Body") + } + switch fc.FieldNum { + case 1: // ContainerId + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "ContainerId") + } + x.ContainerId = new(grpc.ContainerID) + if err := x.ContainerId.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + case 2: // Signature + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Signature") + } + x.Signature = new(grpc.SignatureRFC6979) + if err := x.Signature.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + } + } + return nil +} +func (x *DeleteRequest_Body) GetContainerId() *grpc.ContainerID { + if x != nil { + return x.ContainerId + } + return nil +} +func (x *DeleteRequest_Body) SetContainerId(v *grpc.ContainerID) { + x.ContainerId = v +} +func (x *DeleteRequest_Body) GetSignature() *grpc.SignatureRFC6979 { + if x != nil { + return x.Signature + } + return nil +} +func (x *DeleteRequest_Body) SetSignature(v *grpc.SignatureRFC6979) { + x.Signature = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *DeleteRequest_Body) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *DeleteRequest_Body) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"containerId\":" + out.RawString(prefix[1:]) + x.ContainerId.MarshalEasyJSON(out) + } + { + const prefix string = ",\"signature\":" + out.RawString(prefix) + x.Signature.MarshalEasyJSON(out) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *DeleteRequest_Body) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *DeleteRequest_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 "containerId": + { + var f *grpc.ContainerID + f = new(grpc.ContainerID) + f.UnmarshalEasyJSON(in) + x.ContainerId = f + } + case "signature": + { + var f *grpc.SignatureRFC6979 + f = new(grpc.SignatureRFC6979) + f.UnmarshalEasyJSON(in) + x.Signature = f + } + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} + +type DeleteRequest struct { + Body *DeleteRequest_Body `json:"body"` + MetaHeader *grpc1.RequestMetaHeader `json:"metaHeader"` + VerifyHeader *grpc1.RequestVerificationHeader `json:"verifyHeader"` +} + +var ( + _ encoding.ProtoMarshaler = (*DeleteRequest)(nil) + _ encoding.ProtoUnmarshaler = (*DeleteRequest)(nil) + _ json.Marshaler = (*DeleteRequest)(nil) + _ json.Unmarshaler = (*DeleteRequest)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *DeleteRequest) 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 *DeleteRequest) 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 *DeleteRequest) ReadSignedData(buf []byte) ([]byte, error) { + return x.GetBody().MarshalProtobuf(buf), nil +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *DeleteRequest) 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 *DeleteRequest) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if x.Body != nil && x.Body.StableSize() != 0 { + x.Body.EmitProtobuf(mm.AppendMessage(1)) + } + if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 { + x.MetaHeader.EmitProtobuf(mm.AppendMessage(2)) + } + if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 { + x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3)) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *DeleteRequest) 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", "DeleteRequest") + } + switch fc.FieldNum { + case 1: // Body + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Body") + } + x.Body = new(DeleteRequest_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 *DeleteRequest) GetBody() *DeleteRequest_Body { + if x != nil { + return x.Body + } + return nil +} +func (x *DeleteRequest) SetBody(v *DeleteRequest_Body) { + x.Body = v +} +func (x *DeleteRequest) GetMetaHeader() *grpc1.RequestMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} +func (x *DeleteRequest) SetMetaHeader(v *grpc1.RequestMetaHeader) { + x.MetaHeader = v +} +func (x *DeleteRequest) GetVerifyHeader() *grpc1.RequestVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} +func (x *DeleteRequest) SetVerifyHeader(v *grpc1.RequestVerificationHeader) { + x.VerifyHeader = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *DeleteRequest) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *DeleteRequest) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"body\":" + out.RawString(prefix[1:]) + x.Body.MarshalEasyJSON(out) + } + { + const prefix string = ",\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) + } + { + const prefix string = ",\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *DeleteRequest) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *DeleteRequest) 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 *DeleteRequest_Body + f = new(DeleteRequest_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 DeleteResponse_Body struct { +} + +var ( + _ encoding.ProtoMarshaler = (*DeleteResponse_Body)(nil) + _ encoding.ProtoUnmarshaler = (*DeleteResponse_Body)(nil) + _ json.Marshaler = (*DeleteResponse_Body)(nil) + _ json.Unmarshaler = (*DeleteResponse_Body)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *DeleteResponse_Body) StableSize() (size int) { + if x == nil { + return 0 + } + return size +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *DeleteResponse_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 *DeleteResponse_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) { +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *DeleteResponse_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", "DeleteResponse_Body") + } + switch fc.FieldNum { + } + } + return nil +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *DeleteResponse_Body) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *DeleteResponse_Body) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *DeleteResponse_Body) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *DeleteResponse_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 { + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} + +type DeleteResponse struct { + Body *DeleteResponse_Body `json:"body"` + MetaHeader *grpc1.ResponseMetaHeader `json:"metaHeader"` + VerifyHeader *grpc1.ResponseVerificationHeader `json:"verifyHeader"` +} + +var ( + _ encoding.ProtoMarshaler = (*DeleteResponse)(nil) + _ encoding.ProtoUnmarshaler = (*DeleteResponse)(nil) + _ json.Marshaler = (*DeleteResponse)(nil) + _ json.Unmarshaler = (*DeleteResponse)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *DeleteResponse) 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 *DeleteResponse) 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 *DeleteResponse) ReadSignedData(buf []byte) ([]byte, error) { + return x.GetBody().MarshalProtobuf(buf), nil +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *DeleteResponse) 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 *DeleteResponse) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if x.Body != nil && x.Body.StableSize() != 0 { + x.Body.EmitProtobuf(mm.AppendMessage(1)) + } + if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 { + x.MetaHeader.EmitProtobuf(mm.AppendMessage(2)) + } + if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 { + x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3)) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *DeleteResponse) 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", "DeleteResponse") + } + switch fc.FieldNum { + case 1: // Body + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Body") + } + x.Body = new(DeleteResponse_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 *DeleteResponse) GetBody() *DeleteResponse_Body { + if x != nil { + return x.Body + } + return nil +} +func (x *DeleteResponse) SetBody(v *DeleteResponse_Body) { + x.Body = v +} +func (x *DeleteResponse) GetMetaHeader() *grpc1.ResponseMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} +func (x *DeleteResponse) SetMetaHeader(v *grpc1.ResponseMetaHeader) { + x.MetaHeader = v +} +func (x *DeleteResponse) GetVerifyHeader() *grpc1.ResponseVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} +func (x *DeleteResponse) SetVerifyHeader(v *grpc1.ResponseVerificationHeader) { + x.VerifyHeader = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *DeleteResponse) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *DeleteResponse) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"body\":" + out.RawString(prefix[1:]) + x.Body.MarshalEasyJSON(out) + } + { + const prefix string = ",\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) + } + { + const prefix string = ",\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *DeleteResponse) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *DeleteResponse) 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 *DeleteResponse_Body + f = new(DeleteResponse_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() + } +} + +type GetRequest_Body struct { + ContainerId *grpc.ContainerID `json:"containerId"` +} + +var ( + _ encoding.ProtoMarshaler = (*GetRequest_Body)(nil) + _ encoding.ProtoUnmarshaler = (*GetRequest_Body)(nil) + _ json.Marshaler = (*GetRequest_Body)(nil) + _ json.Unmarshaler = (*GetRequest_Body)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *GetRequest_Body) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.NestedStructureSize(1, x.ContainerId) + return size +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *GetRequest_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 *GetRequest_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if x.ContainerId != nil && x.ContainerId.StableSize() != 0 { + x.ContainerId.EmitProtobuf(mm.AppendMessage(1)) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *GetRequest_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", "GetRequest_Body") + } + switch fc.FieldNum { + case 1: // ContainerId + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "ContainerId") + } + x.ContainerId = new(grpc.ContainerID) + if err := x.ContainerId.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + } + } + return nil +} +func (x *GetRequest_Body) GetContainerId() *grpc.ContainerID { + if x != nil { + return x.ContainerId + } + return nil +} +func (x *GetRequest_Body) SetContainerId(v *grpc.ContainerID) { + x.ContainerId = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *GetRequest_Body) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *GetRequest_Body) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"containerId\":" + out.RawString(prefix[1:]) + x.ContainerId.MarshalEasyJSON(out) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *GetRequest_Body) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *GetRequest_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 "containerId": + { + var f *grpc.ContainerID + f = new(grpc.ContainerID) + f.UnmarshalEasyJSON(in) + x.ContainerId = f + } + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} + +type GetRequest struct { + Body *GetRequest_Body `json:"body"` + MetaHeader *grpc1.RequestMetaHeader `json:"metaHeader"` + VerifyHeader *grpc1.RequestVerificationHeader `json:"verifyHeader"` +} + +var ( + _ encoding.ProtoMarshaler = (*GetRequest)(nil) + _ encoding.ProtoUnmarshaler = (*GetRequest)(nil) + _ json.Marshaler = (*GetRequest)(nil) + _ json.Unmarshaler = (*GetRequest)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *GetRequest) 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 *GetRequest) 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 *GetRequest) ReadSignedData(buf []byte) ([]byte, error) { + return x.GetBody().MarshalProtobuf(buf), nil +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *GetRequest) 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 *GetRequest) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if x.Body != nil && x.Body.StableSize() != 0 { + x.Body.EmitProtobuf(mm.AppendMessage(1)) + } + if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 { + x.MetaHeader.EmitProtobuf(mm.AppendMessage(2)) + } + if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 { + x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3)) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *GetRequest) 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", "GetRequest") + } + switch fc.FieldNum { + case 1: // Body + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Body") + } + x.Body = new(GetRequest_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 *GetRequest) GetBody() *GetRequest_Body { + if x != nil { + return x.Body + } + return nil +} +func (x *GetRequest) SetBody(v *GetRequest_Body) { + x.Body = v +} +func (x *GetRequest) GetMetaHeader() *grpc1.RequestMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} +func (x *GetRequest) SetMetaHeader(v *grpc1.RequestMetaHeader) { + x.MetaHeader = v +} +func (x *GetRequest) GetVerifyHeader() *grpc1.RequestVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} +func (x *GetRequest) SetVerifyHeader(v *grpc1.RequestVerificationHeader) { + x.VerifyHeader = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *GetRequest) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *GetRequest) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"body\":" + out.RawString(prefix[1:]) + x.Body.MarshalEasyJSON(out) + } + { + const prefix string = ",\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) + } + { + const prefix string = ",\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *GetRequest) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *GetRequest) 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 *GetRequest_Body + f = new(GetRequest_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 GetResponse_Body struct { + Container *Container `json:"container"` + Signature *grpc.SignatureRFC6979 `json:"signature"` + SessionToken *grpc1.SessionToken `json:"sessionToken"` +} + +var ( + _ encoding.ProtoMarshaler = (*GetResponse_Body)(nil) + _ encoding.ProtoUnmarshaler = (*GetResponse_Body)(nil) + _ json.Marshaler = (*GetResponse_Body)(nil) + _ json.Unmarshaler = (*GetResponse_Body)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *GetResponse_Body) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.NestedStructureSize(1, x.Container) + size += proto.NestedStructureSize(2, x.Signature) + size += proto.NestedStructureSize(3, x.SessionToken) + return size +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *GetResponse_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 *GetResponse_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if x.Container != nil && x.Container.StableSize() != 0 { + x.Container.EmitProtobuf(mm.AppendMessage(1)) + } + if x.Signature != nil && x.Signature.StableSize() != 0 { + x.Signature.EmitProtobuf(mm.AppendMessage(2)) + } + if x.SessionToken != nil && x.SessionToken.StableSize() != 0 { + x.SessionToken.EmitProtobuf(mm.AppendMessage(3)) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *GetResponse_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", "GetResponse_Body") + } + switch fc.FieldNum { + case 1: // Container + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Container") + } + x.Container = new(Container) + if err := x.Container.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + case 2: // Signature + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Signature") + } + x.Signature = new(grpc.SignatureRFC6979) + if err := x.Signature.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + case 3: // SessionToken + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "SessionToken") + } + x.SessionToken = new(grpc1.SessionToken) + if err := x.SessionToken.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + } + } + return nil +} +func (x *GetResponse_Body) GetContainer() *Container { + if x != nil { + return x.Container + } + return nil +} +func (x *GetResponse_Body) SetContainer(v *Container) { + x.Container = v +} +func (x *GetResponse_Body) GetSignature() *grpc.SignatureRFC6979 { + if x != nil { + return x.Signature + } + return nil +} +func (x *GetResponse_Body) SetSignature(v *grpc.SignatureRFC6979) { + x.Signature = v +} +func (x *GetResponse_Body) GetSessionToken() *grpc1.SessionToken { + if x != nil { + return x.SessionToken + } + return nil +} +func (x *GetResponse_Body) SetSessionToken(v *grpc1.SessionToken) { + x.SessionToken = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *GetResponse_Body) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *GetResponse_Body) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"container\":" + out.RawString(prefix[1:]) + x.Container.MarshalEasyJSON(out) + } + { + const prefix string = ",\"signature\":" + out.RawString(prefix) + x.Signature.MarshalEasyJSON(out) + } + { + const prefix string = ",\"sessionToken\":" + out.RawString(prefix) + x.SessionToken.MarshalEasyJSON(out) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *GetResponse_Body) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *GetResponse_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 "container": + { + var f *Container + f = new(Container) + f.UnmarshalEasyJSON(in) + x.Container = f + } + case "signature": + { + var f *grpc.SignatureRFC6979 + f = new(grpc.SignatureRFC6979) + f.UnmarshalEasyJSON(in) + x.Signature = f + } + case "sessionToken": + { + var f *grpc1.SessionToken + f = new(grpc1.SessionToken) + f.UnmarshalEasyJSON(in) + x.SessionToken = f + } + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} + +type GetResponse struct { + Body *GetResponse_Body `json:"body"` + MetaHeader *grpc1.ResponseMetaHeader `json:"metaHeader"` + VerifyHeader *grpc1.ResponseVerificationHeader `json:"verifyHeader"` +} + +var ( + _ encoding.ProtoMarshaler = (*GetResponse)(nil) + _ encoding.ProtoUnmarshaler = (*GetResponse)(nil) + _ json.Marshaler = (*GetResponse)(nil) + _ json.Unmarshaler = (*GetResponse)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *GetResponse) 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 *GetResponse) 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 *GetResponse) ReadSignedData(buf []byte) ([]byte, error) { + return x.GetBody().MarshalProtobuf(buf), nil +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *GetResponse) 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 *GetResponse) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if x.Body != nil && x.Body.StableSize() != 0 { + x.Body.EmitProtobuf(mm.AppendMessage(1)) + } + if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 { + x.MetaHeader.EmitProtobuf(mm.AppendMessage(2)) + } + if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 { + x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3)) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *GetResponse) 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", "GetResponse") + } + switch fc.FieldNum { + case 1: // Body + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Body") + } + x.Body = new(GetResponse_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 *GetResponse) GetBody() *GetResponse_Body { + if x != nil { + return x.Body + } + return nil +} +func (x *GetResponse) SetBody(v *GetResponse_Body) { + x.Body = v +} +func (x *GetResponse) GetMetaHeader() *grpc1.ResponseMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} +func (x *GetResponse) SetMetaHeader(v *grpc1.ResponseMetaHeader) { + x.MetaHeader = v +} +func (x *GetResponse) GetVerifyHeader() *grpc1.ResponseVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} +func (x *GetResponse) SetVerifyHeader(v *grpc1.ResponseVerificationHeader) { + x.VerifyHeader = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *GetResponse) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *GetResponse) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"body\":" + out.RawString(prefix[1:]) + x.Body.MarshalEasyJSON(out) + } + { + const prefix string = ",\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) + } + { + const prefix string = ",\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *GetResponse) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *GetResponse) 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 *GetResponse_Body + f = new(GetResponse_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() + } +} + +type ListRequest_Body struct { + OwnerId *grpc.OwnerID `json:"ownerId"` +} + +var ( + _ encoding.ProtoMarshaler = (*ListRequest_Body)(nil) + _ encoding.ProtoUnmarshaler = (*ListRequest_Body)(nil) + _ json.Marshaler = (*ListRequest_Body)(nil) + _ json.Unmarshaler = (*ListRequest_Body)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *ListRequest_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 *ListRequest_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 *ListRequest_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if x.OwnerId != nil && x.OwnerId.StableSize() != 0 { + x.OwnerId.EmitProtobuf(mm.AppendMessage(1)) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *ListRequest_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", "ListRequest_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 *ListRequest_Body) GetOwnerId() *grpc.OwnerID { + if x != nil { + return x.OwnerId + } + return nil +} +func (x *ListRequest_Body) SetOwnerId(v *grpc.OwnerID) { + x.OwnerId = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *ListRequest_Body) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *ListRequest_Body) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"ownerId\":" + out.RawString(prefix[1:]) + x.OwnerId.MarshalEasyJSON(out) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *ListRequest_Body) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *ListRequest_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 ListRequest struct { + Body *ListRequest_Body `json:"body"` + MetaHeader *grpc1.RequestMetaHeader `json:"metaHeader"` + VerifyHeader *grpc1.RequestVerificationHeader `json:"verifyHeader"` +} + +var ( + _ encoding.ProtoMarshaler = (*ListRequest)(nil) + _ encoding.ProtoUnmarshaler = (*ListRequest)(nil) + _ json.Marshaler = (*ListRequest)(nil) + _ json.Unmarshaler = (*ListRequest)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *ListRequest) 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 *ListRequest) 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 *ListRequest) ReadSignedData(buf []byte) ([]byte, error) { + return x.GetBody().MarshalProtobuf(buf), nil +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *ListRequest) 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 *ListRequest) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if x.Body != nil && x.Body.StableSize() != 0 { + x.Body.EmitProtobuf(mm.AppendMessage(1)) + } + if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 { + x.MetaHeader.EmitProtobuf(mm.AppendMessage(2)) + } + if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 { + x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3)) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *ListRequest) 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", "ListRequest") + } + switch fc.FieldNum { + case 1: // Body + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Body") + } + x.Body = new(ListRequest_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 *ListRequest) GetBody() *ListRequest_Body { + if x != nil { + return x.Body + } + return nil +} +func (x *ListRequest) SetBody(v *ListRequest_Body) { + x.Body = v +} +func (x *ListRequest) GetMetaHeader() *grpc1.RequestMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} +func (x *ListRequest) SetMetaHeader(v *grpc1.RequestMetaHeader) { + x.MetaHeader = v +} +func (x *ListRequest) GetVerifyHeader() *grpc1.RequestVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} +func (x *ListRequest) SetVerifyHeader(v *grpc1.RequestVerificationHeader) { + x.VerifyHeader = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *ListRequest) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *ListRequest) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"body\":" + out.RawString(prefix[1:]) + x.Body.MarshalEasyJSON(out) + } + { + const prefix string = ",\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) + } + { + const prefix string = ",\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *ListRequest) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *ListRequest) 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 *ListRequest_Body + f = new(ListRequest_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 ListResponse_Body struct { + ContainerIds []*grpc.ContainerID `json:"containerIds"` +} + +var ( + _ encoding.ProtoMarshaler = (*ListResponse_Body)(nil) + _ encoding.ProtoUnmarshaler = (*ListResponse_Body)(nil) + _ json.Marshaler = (*ListResponse_Body)(nil) + _ json.Unmarshaler = (*ListResponse_Body)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *ListResponse_Body) StableSize() (size int) { + if x == nil { + return 0 + } + for i := range x.ContainerIds { + size += proto.NestedStructureSize(1, x.ContainerIds[i]) + } + return size +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *ListResponse_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 *ListResponse_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + for i := range x.ContainerIds { + if x.ContainerIds[i] != nil && x.ContainerIds[i].StableSize() != 0 { + x.ContainerIds[i].EmitProtobuf(mm.AppendMessage(1)) + } + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *ListResponse_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", "ListResponse_Body") + } + switch fc.FieldNum { + case 1: // ContainerIds + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "ContainerIds") + } + x.ContainerIds = append(x.ContainerIds, new(grpc.ContainerID)) + ff := x.ContainerIds[len(x.ContainerIds)-1] + if err := ff.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + } + } + return nil +} +func (x *ListResponse_Body) GetContainerIds() []*grpc.ContainerID { + if x != nil { + return x.ContainerIds + } + return nil +} +func (x *ListResponse_Body) SetContainerIds(v []*grpc.ContainerID) { + x.ContainerIds = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *ListResponse_Body) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *ListResponse_Body) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"containerIds\":" + out.RawString(prefix[1:]) + out.RawByte('[') + for i := range x.ContainerIds { + if i != 0 { + out.RawByte(',') + } + x.ContainerIds[i].MarshalEasyJSON(out) + } + out.RawByte(']') + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *ListResponse_Body) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *ListResponse_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 "containerIds": + { + var f *grpc.ContainerID + var list []*grpc.ContainerID + in.Delim('[') + for !in.IsDelim(']') { + f = new(grpc.ContainerID) + f.UnmarshalEasyJSON(in) + list = append(list, f) + in.WantComma() + } + x.ContainerIds = list + in.Delim(']') + } + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} + +type ListResponse struct { + Body *ListResponse_Body `json:"body"` + MetaHeader *grpc1.ResponseMetaHeader `json:"metaHeader"` + VerifyHeader *grpc1.ResponseVerificationHeader `json:"verifyHeader"` +} + +var ( + _ encoding.ProtoMarshaler = (*ListResponse)(nil) + _ encoding.ProtoUnmarshaler = (*ListResponse)(nil) + _ json.Marshaler = (*ListResponse)(nil) + _ json.Unmarshaler = (*ListResponse)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *ListResponse) 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 *ListResponse) 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 *ListResponse) ReadSignedData(buf []byte) ([]byte, error) { + return x.GetBody().MarshalProtobuf(buf), nil +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *ListResponse) 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 *ListResponse) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if x.Body != nil && x.Body.StableSize() != 0 { + x.Body.EmitProtobuf(mm.AppendMessage(1)) + } + if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 { + x.MetaHeader.EmitProtobuf(mm.AppendMessage(2)) + } + if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 { + x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3)) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *ListResponse) 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", "ListResponse") + } + switch fc.FieldNum { + case 1: // Body + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Body") + } + x.Body = new(ListResponse_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 *ListResponse) GetBody() *ListResponse_Body { + if x != nil { + return x.Body + } + return nil +} +func (x *ListResponse) SetBody(v *ListResponse_Body) { + x.Body = v +} +func (x *ListResponse) GetMetaHeader() *grpc1.ResponseMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} +func (x *ListResponse) SetMetaHeader(v *grpc1.ResponseMetaHeader) { + x.MetaHeader = v +} +func (x *ListResponse) GetVerifyHeader() *grpc1.ResponseVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} +func (x *ListResponse) SetVerifyHeader(v *grpc1.ResponseVerificationHeader) { + x.VerifyHeader = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *ListResponse) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *ListResponse) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"body\":" + out.RawString(prefix[1:]) + x.Body.MarshalEasyJSON(out) + } + { + const prefix string = ",\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) + } + { + const prefix string = ",\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *ListResponse) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *ListResponse) 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 *ListResponse_Body + f = new(ListResponse_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() + } +} + +type GetExtendedACLRequest_Body struct { + ContainerId *grpc.ContainerID `json:"containerId"` +} + +var ( + _ encoding.ProtoMarshaler = (*GetExtendedACLRequest_Body)(nil) + _ encoding.ProtoUnmarshaler = (*GetExtendedACLRequest_Body)(nil) + _ json.Marshaler = (*GetExtendedACLRequest_Body)(nil) + _ json.Unmarshaler = (*GetExtendedACLRequest_Body)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *GetExtendedACLRequest_Body) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.NestedStructureSize(1, x.ContainerId) + return size +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *GetExtendedACLRequest_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 *GetExtendedACLRequest_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if x.ContainerId != nil && x.ContainerId.StableSize() != 0 { + x.ContainerId.EmitProtobuf(mm.AppendMessage(1)) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *GetExtendedACLRequest_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", "GetExtendedACLRequest_Body") + } + switch fc.FieldNum { + case 1: // ContainerId + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "ContainerId") + } + x.ContainerId = new(grpc.ContainerID) + if err := x.ContainerId.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + } + } + return nil +} +func (x *GetExtendedACLRequest_Body) GetContainerId() *grpc.ContainerID { + if x != nil { + return x.ContainerId + } + return nil +} +func (x *GetExtendedACLRequest_Body) SetContainerId(v *grpc.ContainerID) { + x.ContainerId = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *GetExtendedACLRequest_Body) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *GetExtendedACLRequest_Body) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"containerId\":" + out.RawString(prefix[1:]) + x.ContainerId.MarshalEasyJSON(out) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *GetExtendedACLRequest_Body) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *GetExtendedACLRequest_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 "containerId": + { + var f *grpc.ContainerID + f = new(grpc.ContainerID) + f.UnmarshalEasyJSON(in) + x.ContainerId = f + } + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} + +type GetExtendedACLRequest struct { + Body *GetExtendedACLRequest_Body `json:"body"` + MetaHeader *grpc1.RequestMetaHeader `json:"metaHeader"` + VerifyHeader *grpc1.RequestVerificationHeader `json:"verifyHeader"` +} + +var ( + _ encoding.ProtoMarshaler = (*GetExtendedACLRequest)(nil) + _ encoding.ProtoUnmarshaler = (*GetExtendedACLRequest)(nil) + _ json.Marshaler = (*GetExtendedACLRequest)(nil) + _ json.Unmarshaler = (*GetExtendedACLRequest)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *GetExtendedACLRequest) 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 *GetExtendedACLRequest) 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 *GetExtendedACLRequest) ReadSignedData(buf []byte) ([]byte, error) { + return x.GetBody().MarshalProtobuf(buf), nil +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *GetExtendedACLRequest) 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 *GetExtendedACLRequest) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if x.Body != nil && x.Body.StableSize() != 0 { + x.Body.EmitProtobuf(mm.AppendMessage(1)) + } + if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 { + x.MetaHeader.EmitProtobuf(mm.AppendMessage(2)) + } + if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 { + x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3)) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *GetExtendedACLRequest) 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", "GetExtendedACLRequest") + } + switch fc.FieldNum { + case 1: // Body + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Body") + } + x.Body = new(GetExtendedACLRequest_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 *GetExtendedACLRequest) GetBody() *GetExtendedACLRequest_Body { + if x != nil { + return x.Body + } + return nil +} +func (x *GetExtendedACLRequest) SetBody(v *GetExtendedACLRequest_Body) { + x.Body = v +} +func (x *GetExtendedACLRequest) GetMetaHeader() *grpc1.RequestMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} +func (x *GetExtendedACLRequest) SetMetaHeader(v *grpc1.RequestMetaHeader) { + x.MetaHeader = v +} +func (x *GetExtendedACLRequest) GetVerifyHeader() *grpc1.RequestVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} +func (x *GetExtendedACLRequest) SetVerifyHeader(v *grpc1.RequestVerificationHeader) { + x.VerifyHeader = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *GetExtendedACLRequest) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *GetExtendedACLRequest) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"body\":" + out.RawString(prefix[1:]) + x.Body.MarshalEasyJSON(out) + } + { + const prefix string = ",\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) + } + { + const prefix string = ",\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *GetExtendedACLRequest) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *GetExtendedACLRequest) 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 *GetExtendedACLRequest_Body + f = new(GetExtendedACLRequest_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 GetExtendedACLResponse_Body struct { + Eacl *grpc2.EACLTable `json:"eacl"` + Signature *grpc.SignatureRFC6979 `json:"signature"` + SessionToken *grpc1.SessionToken `json:"sessionToken"` +} + +var ( + _ encoding.ProtoMarshaler = (*GetExtendedACLResponse_Body)(nil) + _ encoding.ProtoUnmarshaler = (*GetExtendedACLResponse_Body)(nil) + _ json.Marshaler = (*GetExtendedACLResponse_Body)(nil) + _ json.Unmarshaler = (*GetExtendedACLResponse_Body)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *GetExtendedACLResponse_Body) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.NestedStructureSize(1, x.Eacl) + size += proto.NestedStructureSize(2, x.Signature) + size += proto.NestedStructureSize(3, x.SessionToken) + return size +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *GetExtendedACLResponse_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 *GetExtendedACLResponse_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if x.Eacl != nil && x.Eacl.StableSize() != 0 { + x.Eacl.EmitProtobuf(mm.AppendMessage(1)) + } + if x.Signature != nil && x.Signature.StableSize() != 0 { + x.Signature.EmitProtobuf(mm.AppendMessage(2)) + } + if x.SessionToken != nil && x.SessionToken.StableSize() != 0 { + x.SessionToken.EmitProtobuf(mm.AppendMessage(3)) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *GetExtendedACLResponse_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", "GetExtendedACLResponse_Body") + } + switch fc.FieldNum { + case 1: // Eacl + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Eacl") + } + x.Eacl = new(grpc2.EACLTable) + if err := x.Eacl.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + case 2: // Signature + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Signature") + } + x.Signature = new(grpc.SignatureRFC6979) + if err := x.Signature.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + case 3: // SessionToken + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "SessionToken") + } + x.SessionToken = new(grpc1.SessionToken) + if err := x.SessionToken.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + } + } + return nil +} +func (x *GetExtendedACLResponse_Body) GetEacl() *grpc2.EACLTable { + if x != nil { + return x.Eacl + } + return nil +} +func (x *GetExtendedACLResponse_Body) SetEacl(v *grpc2.EACLTable) { + x.Eacl = v +} +func (x *GetExtendedACLResponse_Body) GetSignature() *grpc.SignatureRFC6979 { + if x != nil { + return x.Signature + } + return nil +} +func (x *GetExtendedACLResponse_Body) SetSignature(v *grpc.SignatureRFC6979) { + x.Signature = v +} +func (x *GetExtendedACLResponse_Body) GetSessionToken() *grpc1.SessionToken { + if x != nil { + return x.SessionToken + } + return nil +} +func (x *GetExtendedACLResponse_Body) SetSessionToken(v *grpc1.SessionToken) { + x.SessionToken = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *GetExtendedACLResponse_Body) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *GetExtendedACLResponse_Body) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"eacl\":" + out.RawString(prefix[1:]) + x.Eacl.MarshalEasyJSON(out) + } + { + const prefix string = ",\"signature\":" + out.RawString(prefix) + x.Signature.MarshalEasyJSON(out) + } + { + const prefix string = ",\"sessionToken\":" + out.RawString(prefix) + x.SessionToken.MarshalEasyJSON(out) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *GetExtendedACLResponse_Body) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *GetExtendedACLResponse_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 "eacl": + { + var f *grpc2.EACLTable + f = new(grpc2.EACLTable) + f.UnmarshalEasyJSON(in) + x.Eacl = f + } + case "signature": + { + var f *grpc.SignatureRFC6979 + f = new(grpc.SignatureRFC6979) + f.UnmarshalEasyJSON(in) + x.Signature = f + } + case "sessionToken": + { + var f *grpc1.SessionToken + f = new(grpc1.SessionToken) + f.UnmarshalEasyJSON(in) + x.SessionToken = f + } + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} + +type GetExtendedACLResponse struct { + Body *GetExtendedACLResponse_Body `json:"body"` + MetaHeader *grpc1.ResponseMetaHeader `json:"metaHeader"` + VerifyHeader *grpc1.ResponseVerificationHeader `json:"verifyHeader"` +} + +var ( + _ encoding.ProtoMarshaler = (*GetExtendedACLResponse)(nil) + _ encoding.ProtoUnmarshaler = (*GetExtendedACLResponse)(nil) + _ json.Marshaler = (*GetExtendedACLResponse)(nil) + _ json.Unmarshaler = (*GetExtendedACLResponse)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *GetExtendedACLResponse) 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 *GetExtendedACLResponse) 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 *GetExtendedACLResponse) ReadSignedData(buf []byte) ([]byte, error) { + return x.GetBody().MarshalProtobuf(buf), nil +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *GetExtendedACLResponse) 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 *GetExtendedACLResponse) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if x.Body != nil && x.Body.StableSize() != 0 { + x.Body.EmitProtobuf(mm.AppendMessage(1)) + } + if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 { + x.MetaHeader.EmitProtobuf(mm.AppendMessage(2)) + } + if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 { + x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3)) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *GetExtendedACLResponse) 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", "GetExtendedACLResponse") + } + switch fc.FieldNum { + case 1: // Body + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Body") + } + x.Body = new(GetExtendedACLResponse_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 *GetExtendedACLResponse) GetBody() *GetExtendedACLResponse_Body { + if x != nil { + return x.Body + } + return nil +} +func (x *GetExtendedACLResponse) SetBody(v *GetExtendedACLResponse_Body) { + x.Body = v +} +func (x *GetExtendedACLResponse) GetMetaHeader() *grpc1.ResponseMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} +func (x *GetExtendedACLResponse) SetMetaHeader(v *grpc1.ResponseMetaHeader) { + x.MetaHeader = v +} +func (x *GetExtendedACLResponse) GetVerifyHeader() *grpc1.ResponseVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} +func (x *GetExtendedACLResponse) SetVerifyHeader(v *grpc1.ResponseVerificationHeader) { + x.VerifyHeader = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *GetExtendedACLResponse) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *GetExtendedACLResponse) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"body\":" + out.RawString(prefix[1:]) + x.Body.MarshalEasyJSON(out) + } + { + const prefix string = ",\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) + } + { + const prefix string = ",\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *GetExtendedACLResponse) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *GetExtendedACLResponse) 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 *GetExtendedACLResponse_Body + f = new(GetExtendedACLResponse_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() + } +} diff --git a/container/grpc/service_frostfs_fuzz.go b/container/grpc/service_frostfs_fuzz.go new file mode 100644 index 0000000..496a2d6 --- /dev/null +++ b/container/grpc/service_frostfs_fuzz.go @@ -0,0 +1,197 @@ +//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 +} +func DoFuzzProtoGetExtendedACLRequest(data []byte) int { + msg := new(GetExtendedACLRequest) + if err := msg.UnmarshalProtobuf(data); err != nil { + return 0 + } + _ = msg.MarshalProtobuf(nil) + return 1 +} +func DoFuzzJSONGetExtendedACLRequest(data []byte) int { + msg := new(GetExtendedACLRequest) + if err := msg.UnmarshalJSON(data); err != nil { + return 0 + } + _, err := msg.MarshalJSON() + if err != nil { + panic(err) + } + return 1 +} +func DoFuzzProtoGetExtendedACLResponse(data []byte) int { + msg := new(GetExtendedACLResponse) + if err := msg.UnmarshalProtobuf(data); err != nil { + return 0 + } + _ = msg.MarshalProtobuf(nil) + return 1 +} +func DoFuzzJSONGetExtendedACLResponse(data []byte) int { + msg := new(GetExtendedACLResponse) + if err := msg.UnmarshalJSON(data); err != nil { + return 0 + } + _, err := msg.MarshalJSON() + if err != nil { + panic(err) + } + return 1 +} diff --git a/container/grpc/service_frostfs_test.go b/container/grpc/service_frostfs_test.go new file mode 100644 index 0000000..05eb48a --- /dev/null +++ b/container/grpc/service_frostfs_test.go @@ -0,0 +1,111 @@ +//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) + }) +} +func FuzzProtoGetExtendedACLRequest(f *testing.F) { + f.Fuzz(func(t *testing.T, data []byte) { + DoFuzzProtoGetExtendedACLRequest(data) + }) +} +func FuzzJSONGetExtendedACLRequest(f *testing.F) { + f.Fuzz(func(t *testing.T, data []byte) { + DoFuzzJSONGetExtendedACLRequest(data) + }) +} +func FuzzProtoGetExtendedACLResponse(f *testing.F) { + f.Fuzz(func(t *testing.T, data []byte) { + DoFuzzProtoGetExtendedACLResponse(data) + }) +} +func FuzzJSONGetExtendedACLResponse(f *testing.F) { + f.Fuzz(func(t *testing.T, data []byte) { + DoFuzzJSONGetExtendedACLResponse(data) + }) +} diff --git a/container/grpc/types.go b/container/grpc/types.go deleted file mode 100644 index 7308f9e..0000000 --- a/container/grpc/types.go +++ /dev/null @@ -1,46 +0,0 @@ -package container - -import ( - netmap "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/netmap/grpc" - refs "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc" -) - -// SetKey sets key to the container attribute. -func (m *Container_Attribute) SetKey(v string) { - m.Key = v -} - -// SetValue sets value of the container attribute. -func (m *Container_Attribute) SetValue(v string) { - m.Value = v -} - -// SetOwnerId sets identifier of the container owner, -func (m *Container) SetOwnerId(v *refs.OwnerID) { - m.OwnerId = v -} - -// SetNonce sets nonce of the container structure. -func (m *Container) SetNonce(v []byte) { - m.Nonce = v -} - -// SetBasicAcl sets basic ACL of the container. -func (m *Container) SetBasicAcl(v uint32) { - m.BasicAcl = v -} - -// SetAttributes sets list of the container attributes. -func (m *Container) SetAttributes(v []*Container_Attribute) { - m.Attributes = v -} - -// SetPlacementPolicy sets placement policy of the container. -func (m *Container) SetPlacementPolicy(v *netmap.PlacementPolicy) { - m.PlacementPolicy = v -} - -// SetVersion sets version of the container. -func (m *Container) SetVersion(v *refs.Version) { - m.Version = v -} diff --git a/container/grpc/types.pb.go b/container/grpc/types.pb.go deleted file mode 100644 index d0e19ec..0000000 --- a/container/grpc/types.pb.go +++ /dev/null @@ -1,337 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.33.0 -// protoc v5.27.2 -// source: container/grpc/types.proto - -package container - -import ( - grpc1 "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/netmap/grpc" - grpc "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -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 - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Container format version. Effectively, the version of API library used to - // create the container. - Version *grpc.Version `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` - // Identifier of the container owner - OwnerId *grpc.OwnerID `protobuf:"bytes,2,opt,name=owner_id,json=ownerID,proto3" 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,proto3" 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,proto3" json:"basic_acl,omitempty"` - // Attributes represent immutable container's meta data - Attributes []*Container_Attribute `protobuf:"bytes,5,rep,name=attributes,proto3" json:"attributes,omitempty"` - // Placement policy for the object inside the container - PlacementPolicy *grpc1.PlacementPolicy `protobuf:"bytes,6,opt,name=placement_policy,json=placementPolicy,proto3" json:"placement_policy,omitempty"` -} - -func (x *Container) Reset() { - *x = Container{} - if protoimpl.UnsafeEnabled { - mi := &file_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_container_grpc_types_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Container.ProtoReflect.Descriptor instead. -func (*Container) Descriptor() ([]byte, []int) { - return file_container_grpc_types_proto_rawDescGZIP(), []int{0} -} - -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 { - 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 -} - -// `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 NeoFS 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 - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Attribute name key - Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - // Attribute value - Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` -} - -func (x *Container_Attribute) Reset() { - *x = Container_Attribute{} - if protoimpl.UnsafeEnabled { - mi := &file_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_container_grpc_types_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Container_Attribute.ProtoReflect.Descriptor instead. -func (*Container_Attribute) Descriptor() ([]byte, []int) { - return file_container_grpc_types_proto_rawDescGZIP(), []int{0, 0} -} - -func (x *Container_Attribute) GetKey() string { - if x != nil { - return x.Key - } - return "" -} - -func (x *Container_Attribute) GetValue() string { - if x != nil { - return x.Value - } - return "" -} - -var File_container_grpc_types_proto protoreflect.FileDescriptor - -var file_container_grpc_types_proto_rawDesc = []byte{ - 0x0a, 0x1a, 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, 0x17, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, - 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x15, 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, 0x6a, 0x5a, 0x48, 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, - 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 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, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_container_grpc_types_proto_rawDescOnce sync.Once - file_container_grpc_types_proto_rawDescData = file_container_grpc_types_proto_rawDesc -) - -func file_container_grpc_types_proto_rawDescGZIP() []byte { - file_container_grpc_types_proto_rawDescOnce.Do(func() { - file_container_grpc_types_proto_rawDescData = protoimpl.X.CompressGZIP(file_container_grpc_types_proto_rawDescData) - }) - return file_container_grpc_types_proto_rawDescData -} - -var file_container_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_container_grpc_types_proto_goTypes = []interface{}{ - (*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_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_container_grpc_types_proto_init() } -func file_container_grpc_types_proto_init() { - if File_container_grpc_types_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_container_grpc_types_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Container); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_container_grpc_types_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Container_Attribute); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_container_grpc_types_proto_rawDesc, - NumEnums: 0, - NumMessages: 2, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_container_grpc_types_proto_goTypes, - DependencyIndexes: file_container_grpc_types_proto_depIdxs, - MessageInfos: file_container_grpc_types_proto_msgTypes, - }.Build() - File_container_grpc_types_proto = out.File - file_container_grpc_types_proto_rawDesc = nil - file_container_grpc_types_proto_goTypes = nil - file_container_grpc_types_proto_depIdxs = nil -} diff --git a/container/grpc/types_frostfs.pb.go b/container/grpc/types_frostfs.pb.go new file mode 100644 index 0000000..3e0d882 --- /dev/null +++ b/container/grpc/types_frostfs.pb.go @@ -0,0 +1,495 @@ +// Code generated by protoc-gen-go-frostfs. DO NOT EDIT. + +package container + +import ( + json "encoding/json" + fmt "fmt" + grpc1 "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/netmap/grpc" + grpc "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc" + pool "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/pool" + proto "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/proto" + encoding "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/proto/encoding" + easyproto "github.com/VictoriaMetrics/easyproto" + jlexer "github.com/mailru/easyjson/jlexer" + jwriter "github.com/mailru/easyjson/jwriter" +) + +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 + } + out.RawByte('{') + { + const prefix string = ",\"key\":" + out.RawString(prefix[1:]) + out.String(x.Key) + } + { + 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.NestedStructureSize(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.StableSize() != 0 { + x.Version.EmitProtobuf(mm.AppendMessage(1)) + } + if x.OwnerId != nil && x.OwnerId.StableSize() != 0 { + 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 { + if x.Attributes[i] != nil && x.Attributes[i].StableSize() != 0 { + x.Attributes[i].EmitProtobuf(mm.AppendMessage(5)) + } + } + if x.PlacementPolicy != nil && x.PlacementPolicy.StableSize() != 0 { + 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, new(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 + } + out.RawByte('{') + { + const prefix string = ",\"version\":" + out.RawString(prefix[1:]) + x.Version.MarshalEasyJSON(out) + } + { + const prefix string = ",\"ownerID\":" + out.RawString(prefix) + x.OwnerId.MarshalEasyJSON(out) + } + { + const prefix string = ",\"nonce\":" + out.RawString(prefix) + out.Base64Bytes(x.Nonce) + } + { + const prefix string = ",\"basicACL\":" + out.RawString(prefix) + out.Uint32(x.BasicAcl) + } + { + 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(']') + } + { + 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 + f = in.Bytes() + x.Nonce = f + } + case "basicACL": + { + var f uint32 + f = in.Uint32() + x.BasicAcl = f + } + case "attributes": + { + var f *Container_Attribute + var list []*Container_Attribute + in.Delim('[') + for !in.IsDelim(']') { + f = new(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() + } +} diff --git a/container/grpc/types_frostfs_fuzz.go b/container/grpc/types_frostfs_fuzz.go new file mode 100644 index 0000000..5551978 --- /dev/null +++ b/container/grpc/types_frostfs_fuzz.go @@ -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 +} diff --git a/container/grpc/types_frostfs_test.go b/container/grpc/types_frostfs_test.go new file mode 100644 index 0000000..64d840e --- /dev/null +++ b/container/grpc/types_frostfs_test.go @@ -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) + }) +} diff --git a/go.mod b/go.mod index e00f012..13fa1b7 100644 --- a/go.mod +++ b/go.mod @@ -4,6 +4,8 @@ go 1.20 require ( git.frostfs.info/TrueCloudLab/frostfs-crypto v0.6.0 + github.com/VictoriaMetrics/easyproto v0.1.4 + github.com/mailru/easyjson v0.7.7 github.com/stretchr/testify v1.8.3 golang.org/x/sync v0.6.0 google.golang.org/grpc v1.63.2 @@ -13,6 +15,7 @@ require ( require ( git.frostfs.info/TrueCloudLab/rfc6979 v0.4.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect + github.com/josharian/intern v1.0.0 // indirect github.com/kr/pretty v0.1.0 // indirect github.com/mr-tron/base58 v1.2.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect diff --git a/go.sum b/go.sum index 6ce46f7..620642f 100644 --- a/go.sum +++ b/go.sum @@ -2,15 +2,21 @@ git.frostfs.info/TrueCloudLab/frostfs-crypto v0.6.0 h1:FxqFDhQYYgpe41qsIHVOcdzSV git.frostfs.info/TrueCloudLab/frostfs-crypto v0.6.0/go.mod h1:RUIKZATQLJ+TaYQa60X2fTDwfuhMfm8Ar60bQ5fr+vU= git.frostfs.info/TrueCloudLab/rfc6979 v0.4.0 h1:M2KR3iBj7WpY3hP10IevfIB9MURr4O9mwVfJ+SjT3HA= git.frostfs.info/TrueCloudLab/rfc6979 v0.4.0/go.mod h1:okpbKfVYf/BpejtfFTfhZqFP+sZ8rsHrP8Rr/jYPNRc= +github.com/VictoriaMetrics/easyproto v0.1.4 h1:r8cNvo8o6sR4QShBXQd1bKw/VVLSQma/V2KhTBPf+Sc= +github.com/VictoriaMetrics/easyproto v0.1.4/go.mod h1:QlGlzaJnDfFd8Lk6Ci/fuLxfTo3/GThPs2KH23mv710= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= +github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= +github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= github.com/mr-tron/base58 v1.2.0 h1:T/HDJBh4ZCPbU39/+c3rRvE0uKBQlU27+QI8LJ4t64o= github.com/mr-tron/base58 v1.2.0/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= diff --git a/lock/grpc/types.go b/lock/grpc/types.go deleted file mode 100644 index 9d5719f..0000000 --- a/lock/grpc/types.go +++ /dev/null @@ -1,8 +0,0 @@ -package lock - -import refs "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc" - -// SetMembers sets `members` field. -func (x *Lock) SetMembers(ids []*refs.ObjectID) { - x.Members = ids -} diff --git a/lock/grpc/types.pb.go b/lock/grpc/types.pb.go deleted file mode 100644 index 38b62fe..0000000 --- a/lock/grpc/types.pb.go +++ /dev/null @@ -1,160 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.33.0 -// protoc v5.27.2 -// source: lock/grpc/types.proto - -package lock - -import ( - grpc "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -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 - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // 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,proto3" json:"members,omitempty"` -} - -func (x *Lock) Reset() { - *x = Lock{} - if protoimpl.UnsafeEnabled { - mi := &file_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_lock_grpc_types_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Lock.ProtoReflect.Descriptor instead. -func (*Lock) Descriptor() ([]byte, []int) { - return file_lock_grpc_types_proto_rawDescGZIP(), []int{0} -} - -func (x *Lock) GetMembers() []*grpc.ObjectID { - if x != nil { - return x.Members - } - return nil -} - -var File_lock_grpc_types_proto protoreflect.FileDescriptor - -var file_lock_grpc_types_proto_rawDesc = []byte{ - 0x0a, 0x15, 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, 0x15, 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, 0x5b, 0x5a, 0x3e, 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, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 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, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_lock_grpc_types_proto_rawDescOnce sync.Once - file_lock_grpc_types_proto_rawDescData = file_lock_grpc_types_proto_rawDesc -) - -func file_lock_grpc_types_proto_rawDescGZIP() []byte { - file_lock_grpc_types_proto_rawDescOnce.Do(func() { - file_lock_grpc_types_proto_rawDescData = protoimpl.X.CompressGZIP(file_lock_grpc_types_proto_rawDescData) - }) - return file_lock_grpc_types_proto_rawDescData -} - -var file_lock_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_lock_grpc_types_proto_goTypes = []interface{}{ - (*Lock)(nil), // 0: neo.fs.v2.lock.Lock - (*grpc.ObjectID)(nil), // 1: neo.fs.v2.refs.ObjectID -} -var file_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_lock_grpc_types_proto_init() } -func file_lock_grpc_types_proto_init() { - if File_lock_grpc_types_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_lock_grpc_types_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Lock); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_lock_grpc_types_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_lock_grpc_types_proto_goTypes, - DependencyIndexes: file_lock_grpc_types_proto_depIdxs, - MessageInfos: file_lock_grpc_types_proto_msgTypes, - }.Build() - File_lock_grpc_types_proto = out.File - file_lock_grpc_types_proto_rawDesc = nil - file_lock_grpc_types_proto_goTypes = nil - file_lock_grpc_types_proto_depIdxs = nil -} diff --git a/lock/grpc/types_frostfs.pb.go b/lock/grpc/types_frostfs.pb.go new file mode 100644 index 0000000..3012111 --- /dev/null +++ b/lock/grpc/types_frostfs.pb.go @@ -0,0 +1,167 @@ +// Code generated by protoc-gen-go-frostfs. DO NOT EDIT. + +package lock + +import ( + json "encoding/json" + fmt "fmt" + grpc "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc" + pool "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/pool" + proto "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/proto" + encoding "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/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.NestedStructureSize(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 { + if x.Members[i] != nil && x.Members[i].StableSize() != 0 { + 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, new(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 + } + out.RawByte('{') + { + const prefix string = ",\"members\":" + out.RawString(prefix[1:]) + 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 = new(grpc.ObjectID) + f.UnmarshalEasyJSON(in) + list = append(list, f) + in.WantComma() + } + x.Members = list + in.Delim(']') + } + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} diff --git a/lock/grpc/types_frostfs_fuzz.go b/lock/grpc/types_frostfs_fuzz.go new file mode 100644 index 0000000..cb55151 --- /dev/null +++ b/lock/grpc/types_frostfs_fuzz.go @@ -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 +} diff --git a/lock/grpc/types_frostfs_test.go b/lock/grpc/types_frostfs_test.go new file mode 100644 index 0000000..7c69064 --- /dev/null +++ b/lock/grpc/types_frostfs_test.go @@ -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) + }) +} diff --git a/netmap/grpc/service.go b/netmap/grpc/service.go deleted file mode 100644 index 882db6b..0000000 --- a/netmap/grpc/service.go +++ /dev/null @@ -1,116 +0,0 @@ -package netmap - -import ( - refs "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc" - session "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session/grpc" -) - -// SetBody sets body of the request. -func (m *LocalNodeInfoRequest) SetBody(v *LocalNodeInfoRequest_Body) { - m.Body = v -} - -// SetMetaHeader sets meta header of the request. -func (m *LocalNodeInfoRequest) SetMetaHeader(v *session.RequestMetaHeader) { - m.MetaHeader = v -} - -// SetVerifyHeader sets verification header of the request. -func (m *LocalNodeInfoRequest) SetVerifyHeader(v *session.RequestVerificationHeader) { - m.VerifyHeader = v -} - -// SetVersion sets version of response body. -func (m *LocalNodeInfoResponse_Body) SetVersion(v *refs.Version) { - m.Version = v -} - -// SetNodeInfo sets node info of response body. -func (m *LocalNodeInfoResponse_Body) SetNodeInfo(v *NodeInfo) { - m.NodeInfo = v -} - -// SetBody sets body of the response. -func (m *LocalNodeInfoResponse) SetBody(v *LocalNodeInfoResponse_Body) { - m.Body = v -} - -// SetMetaHeader sets meta header of the response. -func (m *LocalNodeInfoResponse) SetMetaHeader(v *session.ResponseMetaHeader) { - m.MetaHeader = v -} - -// SetVerifyHeader sets verification header of the response. -func (m *LocalNodeInfoResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) { - m.VerifyHeader = v -} - -// SetBody sets body of the request. -func (x *NetworkInfoRequest) SetBody(v *NetworkInfoRequest_Body) { - x.Body = v -} - -// SetMetaHeader sets meta header of the request. -func (x *NetworkInfoRequest) SetMetaHeader(v *session.RequestMetaHeader) { - x.MetaHeader = v -} - -// SetVerifyHeader sets verification header of the request. -func (x *NetworkInfoRequest) SetVerifyHeader(v *session.RequestVerificationHeader) { - x.VerifyHeader = v -} - -// SetNetworkInfo sets information about the network. -func (x *NetworkInfoResponse_Body) SetNetworkInfo(v *NetworkInfo) { - x.NetworkInfo = v -} - -// SetBody sets body of the response. -func (x *NetworkInfoResponse) SetBody(v *NetworkInfoResponse_Body) { - x.Body = v -} - -// SetMetaHeader sets meta header of the response. -func (x *NetworkInfoResponse) SetMetaHeader(v *session.ResponseMetaHeader) { - x.MetaHeader = v -} - -// SetVerifyHeader sets verification header of the response. -func (x *NetworkInfoResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) { - x.VerifyHeader = v -} - -// SetBody sets body of the request. -func (x *NetmapSnapshotRequest) SetBody(v *NetmapSnapshotRequest_Body) { - x.Body = v -} - -// SetMetaHeader sets meta header of the request. -func (x *NetmapSnapshotRequest) SetMetaHeader(v *session.RequestMetaHeader) { - x.MetaHeader = v -} - -// SetVerifyHeader sets verification header of the request. -func (x *NetmapSnapshotRequest) SetVerifyHeader(v *session.RequestVerificationHeader) { - x.VerifyHeader = v -} - -// SetNetmap sets current Netmap. -func (x *NetmapSnapshotResponse_Body) SetNetmap(v *Netmap) { - x.Netmap = v -} - -// SetBody sets body of the response. -func (x *NetmapSnapshotResponse) SetBody(v *NetmapSnapshotResponse_Body) { - x.Body = v -} - -// SetMetaHeader sets meta header of the response. -func (x *NetmapSnapshotResponse) SetMetaHeader(v *session.ResponseMetaHeader) { - x.MetaHeader = v -} - -// SetVerifyHeader sets verification header of the response. -func (x *NetmapSnapshotResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) { - x.VerifyHeader = v -} diff --git a/netmap/grpc/service.pb.go b/netmap/grpc/service.pb.go deleted file mode 100644 index eb91862..0000000 --- a/netmap/grpc/service.pb.go +++ /dev/null @@ -1,1108 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.33.0 -// protoc v5.27.2 -// source: netmap/grpc/service.proto - -package netmap - -import ( - grpc1 "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc" - grpc "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session/grpc" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -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) -) - -// Get NodeInfo structure directly from a particular node -type LocalNodeInfoRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Body of the LocalNodeInfo request message - Body *LocalNodeInfoRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" 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,proto3" json:"verify_header,omitempty"` -} - -func (x *LocalNodeInfoRequest) Reset() { - *x = LocalNodeInfoRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_netmap_grpc_service_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *LocalNodeInfoRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*LocalNodeInfoRequest) ProtoMessage() {} - -func (x *LocalNodeInfoRequest) ProtoReflect() protoreflect.Message { - mi := &file_netmap_grpc_service_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use LocalNodeInfoRequest.ProtoReflect.Descriptor instead. -func (*LocalNodeInfoRequest) Descriptor() ([]byte, []int) { - return file_netmap_grpc_service_proto_rawDescGZIP(), []int{0} -} - -func (x *LocalNodeInfoRequest) GetBody() *LocalNodeInfoRequest_Body { - if x != nil { - return x.Body - } - return nil -} - -func (x *LocalNodeInfoRequest) GetMetaHeader() *grpc.RequestMetaHeader { - if x != nil { - return x.MetaHeader - } - return nil -} - -func (x *LocalNodeInfoRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { - if x != nil { - return x.VerifyHeader - } - return nil -} - -// Local Node Info, including API Version in use -type LocalNodeInfoResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Body of the balance response message. - Body *LocalNodeInfoResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` - // Carries response meta information. Header data is used only to regulate - // message transport and does not affect response execution. - MetaHeader *grpc.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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,proto3" json:"verify_header,omitempty"` -} - -func (x *LocalNodeInfoResponse) Reset() { - *x = LocalNodeInfoResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_netmap_grpc_service_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *LocalNodeInfoResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*LocalNodeInfoResponse) ProtoMessage() {} - -func (x *LocalNodeInfoResponse) ProtoReflect() protoreflect.Message { - mi := &file_netmap_grpc_service_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use LocalNodeInfoResponse.ProtoReflect.Descriptor instead. -func (*LocalNodeInfoResponse) Descriptor() ([]byte, []int) { - return file_netmap_grpc_service_proto_rawDescGZIP(), []int{1} -} - -func (x *LocalNodeInfoResponse) GetBody() *LocalNodeInfoResponse_Body { - if x != nil { - return x.Body - } - return nil -} - -func (x *LocalNodeInfoResponse) GetMetaHeader() *grpc.ResponseMetaHeader { - if x != nil { - return x.MetaHeader - } - return nil -} - -func (x *LocalNodeInfoResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { - if x != nil { - return x.VerifyHeader - } - return nil -} - -// Get NetworkInfo structure with the network view from a particular node. -type NetworkInfoRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Body of the NetworkInfo request message - Body *NetworkInfoRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" 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,proto3" json:"verify_header,omitempty"` -} - -func (x *NetworkInfoRequest) Reset() { - *x = NetworkInfoRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_netmap_grpc_service_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *NetworkInfoRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*NetworkInfoRequest) ProtoMessage() {} - -func (x *NetworkInfoRequest) ProtoReflect() protoreflect.Message { - mi := &file_netmap_grpc_service_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use NetworkInfoRequest.ProtoReflect.Descriptor instead. -func (*NetworkInfoRequest) Descriptor() ([]byte, []int) { - return file_netmap_grpc_service_proto_rawDescGZIP(), []int{2} -} - -func (x *NetworkInfoRequest) GetBody() *NetworkInfoRequest_Body { - if x != nil { - return x.Body - } - return nil -} - -func (x *NetworkInfoRequest) GetMetaHeader() *grpc.RequestMetaHeader { - if x != nil { - return x.MetaHeader - } - return nil -} - -func (x *NetworkInfoRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { - if x != nil { - return x.VerifyHeader - } - return nil -} - -// Response with NetworkInfo structure including current epoch and -// sidechain magic number. -type NetworkInfoResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Body of the NetworkInfo response message. - Body *NetworkInfoResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` - // Carries response meta information. Header data is used only to regulate - // message transport and does not affect response execution. - MetaHeader *grpc.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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,proto3" json:"verify_header,omitempty"` -} - -func (x *NetworkInfoResponse) Reset() { - *x = NetworkInfoResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_netmap_grpc_service_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *NetworkInfoResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*NetworkInfoResponse) ProtoMessage() {} - -func (x *NetworkInfoResponse) ProtoReflect() protoreflect.Message { - mi := &file_netmap_grpc_service_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use NetworkInfoResponse.ProtoReflect.Descriptor instead. -func (*NetworkInfoResponse) Descriptor() ([]byte, []int) { - return file_netmap_grpc_service_proto_rawDescGZIP(), []int{3} -} - -func (x *NetworkInfoResponse) GetBody() *NetworkInfoResponse_Body { - if x != nil { - return x.Body - } - return nil -} - -func (x *NetworkInfoResponse) GetMetaHeader() *grpc.ResponseMetaHeader { - if x != nil { - return x.MetaHeader - } - return nil -} - -func (x *NetworkInfoResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { - if x != nil { - return x.VerifyHeader - } - return nil -} - -// Get netmap snapshot request -type NetmapSnapshotRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Body of get netmap snapshot request message. - Body *NetmapSnapshotRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" 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,proto3" json:"verify_header,omitempty"` -} - -func (x *NetmapSnapshotRequest) Reset() { - *x = NetmapSnapshotRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_netmap_grpc_service_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *NetmapSnapshotRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*NetmapSnapshotRequest) ProtoMessage() {} - -func (x *NetmapSnapshotRequest) ProtoReflect() protoreflect.Message { - mi := &file_netmap_grpc_service_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use NetmapSnapshotRequest.ProtoReflect.Descriptor instead. -func (*NetmapSnapshotRequest) Descriptor() ([]byte, []int) { - return file_netmap_grpc_service_proto_rawDescGZIP(), []int{4} -} - -func (x *NetmapSnapshotRequest) GetBody() *NetmapSnapshotRequest_Body { - if x != nil { - return x.Body - } - return nil -} - -func (x *NetmapSnapshotRequest) GetMetaHeader() *grpc.RequestMetaHeader { - if x != nil { - return x.MetaHeader - } - return nil -} - -func (x *NetmapSnapshotRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { - if x != nil { - return x.VerifyHeader - } - return nil -} - -// Response with current netmap snapshot -type NetmapSnapshotResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Body of get netmap snapshot response message. - Body *NetmapSnapshotResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` - // Carries response meta information. Header data is used only to regulate - // message transport and does not affect response execution. - MetaHeader *grpc.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" 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,proto3" json:"verify_header,omitempty"` -} - -func (x *NetmapSnapshotResponse) Reset() { - *x = NetmapSnapshotResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_netmap_grpc_service_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *NetmapSnapshotResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*NetmapSnapshotResponse) ProtoMessage() {} - -func (x *NetmapSnapshotResponse) ProtoReflect() protoreflect.Message { - mi := &file_netmap_grpc_service_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use NetmapSnapshotResponse.ProtoReflect.Descriptor instead. -func (*NetmapSnapshotResponse) Descriptor() ([]byte, []int) { - return file_netmap_grpc_service_proto_rawDescGZIP(), []int{5} -} - -func (x *NetmapSnapshotResponse) GetBody() *NetmapSnapshotResponse_Body { - if x != nil { - return x.Body - } - return nil -} - -func (x *NetmapSnapshotResponse) GetMetaHeader() *grpc.ResponseMetaHeader { - if x != nil { - return x.MetaHeader - } - return nil -} - -func (x *NetmapSnapshotResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { - if x != nil { - return x.VerifyHeader - } - return nil -} - -// LocalNodeInfo request body is empty. -type LocalNodeInfoRequest_Body struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *LocalNodeInfoRequest_Body) Reset() { - *x = LocalNodeInfoRequest_Body{} - if protoimpl.UnsafeEnabled { - mi := &file_netmap_grpc_service_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *LocalNodeInfoRequest_Body) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*LocalNodeInfoRequest_Body) ProtoMessage() {} - -func (x *LocalNodeInfoRequest_Body) ProtoReflect() protoreflect.Message { - mi := &file_netmap_grpc_service_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use LocalNodeInfoRequest_Body.ProtoReflect.Descriptor instead. -func (*LocalNodeInfoRequest_Body) Descriptor() ([]byte, []int) { - return file_netmap_grpc_service_proto_rawDescGZIP(), []int{0, 0} -} - -// Local Node Info, including API Version in use. -type LocalNodeInfoResponse_Body struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Latest NeoFS API version in use - Version *grpc1.Version `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` - // NodeInfo structure with recent information from node itself - NodeInfo *NodeInfo `protobuf:"bytes,2,opt,name=node_info,json=nodeInfo,proto3" json:"node_info,omitempty"` -} - -func (x *LocalNodeInfoResponse_Body) Reset() { - *x = LocalNodeInfoResponse_Body{} - if protoimpl.UnsafeEnabled { - mi := &file_netmap_grpc_service_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *LocalNodeInfoResponse_Body) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*LocalNodeInfoResponse_Body) ProtoMessage() {} - -func (x *LocalNodeInfoResponse_Body) ProtoReflect() protoreflect.Message { - mi := &file_netmap_grpc_service_proto_msgTypes[7] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use LocalNodeInfoResponse_Body.ProtoReflect.Descriptor instead. -func (*LocalNodeInfoResponse_Body) Descriptor() ([]byte, []int) { - return file_netmap_grpc_service_proto_rawDescGZIP(), []int{1, 0} -} - -func (x *LocalNodeInfoResponse_Body) GetVersion() *grpc1.Version { - if x != nil { - return x.Version - } - return nil -} - -func (x *LocalNodeInfoResponse_Body) GetNodeInfo() *NodeInfo { - if x != nil { - return x.NodeInfo - } - return nil -} - -// NetworkInfo request body is empty. -type NetworkInfoRequest_Body struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *NetworkInfoRequest_Body) Reset() { - *x = NetworkInfoRequest_Body{} - if protoimpl.UnsafeEnabled { - mi := &file_netmap_grpc_service_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *NetworkInfoRequest_Body) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*NetworkInfoRequest_Body) ProtoMessage() {} - -func (x *NetworkInfoRequest_Body) ProtoReflect() protoreflect.Message { - mi := &file_netmap_grpc_service_proto_msgTypes[8] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use NetworkInfoRequest_Body.ProtoReflect.Descriptor instead. -func (*NetworkInfoRequest_Body) Descriptor() ([]byte, []int) { - return file_netmap_grpc_service_proto_rawDescGZIP(), []int{2, 0} -} - -// Information about the network. -type NetworkInfoResponse_Body struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // NetworkInfo structure with recent information. - NetworkInfo *NetworkInfo `protobuf:"bytes,1,opt,name=network_info,json=networkInfo,proto3" json:"network_info,omitempty"` -} - -func (x *NetworkInfoResponse_Body) Reset() { - *x = NetworkInfoResponse_Body{} - if protoimpl.UnsafeEnabled { - mi := &file_netmap_grpc_service_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *NetworkInfoResponse_Body) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*NetworkInfoResponse_Body) ProtoMessage() {} - -func (x *NetworkInfoResponse_Body) ProtoReflect() protoreflect.Message { - mi := &file_netmap_grpc_service_proto_msgTypes[9] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use NetworkInfoResponse_Body.ProtoReflect.Descriptor instead. -func (*NetworkInfoResponse_Body) Descriptor() ([]byte, []int) { - return file_netmap_grpc_service_proto_rawDescGZIP(), []int{3, 0} -} - -func (x *NetworkInfoResponse_Body) GetNetworkInfo() *NetworkInfo { - if x != nil { - return x.NetworkInfo - } - return nil -} - -// Get netmap snapshot request body. -type NetmapSnapshotRequest_Body struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *NetmapSnapshotRequest_Body) Reset() { - *x = NetmapSnapshotRequest_Body{} - if protoimpl.UnsafeEnabled { - mi := &file_netmap_grpc_service_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *NetmapSnapshotRequest_Body) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*NetmapSnapshotRequest_Body) ProtoMessage() {} - -func (x *NetmapSnapshotRequest_Body) ProtoReflect() protoreflect.Message { - mi := &file_netmap_grpc_service_proto_msgTypes[10] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use NetmapSnapshotRequest_Body.ProtoReflect.Descriptor instead. -func (*NetmapSnapshotRequest_Body) Descriptor() ([]byte, []int) { - return file_netmap_grpc_service_proto_rawDescGZIP(), []int{4, 0} -} - -// Get netmap snapshot response body -type NetmapSnapshotResponse_Body struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Structure of the requested network map. - Netmap *Netmap `protobuf:"bytes,1,opt,name=netmap,proto3" json:"netmap,omitempty"` -} - -func (x *NetmapSnapshotResponse_Body) Reset() { - *x = NetmapSnapshotResponse_Body{} - if protoimpl.UnsafeEnabled { - mi := &file_netmap_grpc_service_proto_msgTypes[11] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *NetmapSnapshotResponse_Body) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*NetmapSnapshotResponse_Body) ProtoMessage() {} - -func (x *NetmapSnapshotResponse_Body) ProtoReflect() protoreflect.Message { - mi := &file_netmap_grpc_service_proto_msgTypes[11] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use NetmapSnapshotResponse_Body.ProtoReflect.Descriptor instead. -func (*NetmapSnapshotResponse_Body) Descriptor() ([]byte, []int) { - return file_netmap_grpc_service_proto_rawDescGZIP(), []int{5, 0} -} - -func (x *NetmapSnapshotResponse_Body) GetNetmap() *Netmap { - if x != nil { - return x.Netmap - } - return nil -} - -var File_netmap_grpc_service_proto protoreflect.FileDescriptor - -var file_netmap_grpc_service_proto_rawDesc = []byte{ - 0x0a, 0x19, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x73, 0x65, - 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x10, 0x6e, 0x65, 0x6f, - 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x1a, 0x17, 0x6e, - 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x15, 0x72, 0x65, 0x66, 0x73, 0x2f, 0x67, 0x72, 0x70, - 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x18, 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, 0xf9, 0x01, 0x0a, 0x14, 0x4c, 0x6f, 0x63, 0x61, - 0x6c, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x12, 0x3f, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2b, - 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, - 0x70, 0x2e, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 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, 0x06, 0x0a, 0x04, 0x42, - 0x6f, 0x64, 0x79, 0x22, 0xe9, 0x02, 0x0a, 0x15, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x4e, 0x6f, 0x64, - 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x40, 0x0a, - 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x6e, 0x65, - 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4c, - 0x6f, 0x63, 0x61, 0x6c, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 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, 0x72, 0x0a, 0x04, 0x42, - 0x6f, 0x64, 0x79, 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, 0x37, 0x0a, 0x09, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x69, - 0x6e, 0x66, 0x6f, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, - 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4e, 0x6f, 0x64, - 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x08, 0x6e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x22, - 0xf5, 0x01, 0x0a, 0x12, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 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, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x49, - 0x6e, 0x66, 0x6f, 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, - 0x06, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x22, 0xbb, 0x02, 0x0a, 0x13, 0x4e, 0x65, 0x74, 0x77, - 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 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, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, - 0x2e, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 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, 0x48, 0x0a, 0x04, 0x42, - 0x6f, 0x64, 0x79, 0x12, 0x40, 0x0a, 0x0c, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x5f, 0x69, - 0x6e, 0x66, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, - 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4e, 0x65, 0x74, - 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x0b, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, - 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x22, 0xfb, 0x01, 0x0a, 0x15, 0x4e, 0x65, 0x74, 0x6d, 0x61, 0x70, - 0x53, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, - 0x40, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, - 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, - 0x2e, 0x4e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x53, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 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, 0x06, 0x0a, 0x04, 0x42, - 0x6f, 0x64, 0x79, 0x22, 0xb1, 0x02, 0x0a, 0x16, 0x4e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x53, 0x6e, - 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x41, - 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x6e, - 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, - 0x4e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x53, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 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, 0x38, 0x0a, - 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x30, 0x0a, 0x06, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, - 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x52, - 0x06, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x32, 0xb2, 0x02, 0x0a, 0x0d, 0x4e, 0x65, 0x74, 0x6d, - 0x61, 0x70, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x60, 0x0a, 0x0d, 0x4c, 0x6f, 0x63, - 0x61, 0x6c, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x26, 0x2e, 0x6e, 0x65, 0x6f, - 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4c, 0x6f, - 0x63, 0x61, 0x6c, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x27, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, - 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x4e, 0x6f, 0x64, 0x65, 0x49, - 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5a, 0x0a, 0x0b, 0x4e, - 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x24, 0x2e, 0x6e, 0x65, 0x6f, - 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4e, 0x65, - 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x25, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, - 0x6d, 0x61, 0x70, 0x2e, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x63, 0x0a, 0x0e, 0x4e, 0x65, 0x74, 0x6d, 0x61, - 0x70, 0x53, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x12, 0x27, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, - 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4e, 0x65, 0x74, - 0x6d, 0x61, 0x70, 0x53, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x28, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, - 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x53, 0x6e, 0x61, 0x70, - 0x73, 0x68, 0x6f, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x61, 0x5a, 0x42, - 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, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, - 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x6e, 0x65, 0x74, 0x6d, - 0x61, 0x70, 0xaa, 0x02, 0x1a, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, - 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x4e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_netmap_grpc_service_proto_rawDescOnce sync.Once - file_netmap_grpc_service_proto_rawDescData = file_netmap_grpc_service_proto_rawDesc -) - -func file_netmap_grpc_service_proto_rawDescGZIP() []byte { - file_netmap_grpc_service_proto_rawDescOnce.Do(func() { - file_netmap_grpc_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_netmap_grpc_service_proto_rawDescData) - }) - return file_netmap_grpc_service_proto_rawDescData -} - -var file_netmap_grpc_service_proto_msgTypes = make([]protoimpl.MessageInfo, 12) -var file_netmap_grpc_service_proto_goTypes = []interface{}{ - (*LocalNodeInfoRequest)(nil), // 0: neo.fs.v2.netmap.LocalNodeInfoRequest - (*LocalNodeInfoResponse)(nil), // 1: neo.fs.v2.netmap.LocalNodeInfoResponse - (*NetworkInfoRequest)(nil), // 2: neo.fs.v2.netmap.NetworkInfoRequest - (*NetworkInfoResponse)(nil), // 3: neo.fs.v2.netmap.NetworkInfoResponse - (*NetmapSnapshotRequest)(nil), // 4: neo.fs.v2.netmap.NetmapSnapshotRequest - (*NetmapSnapshotResponse)(nil), // 5: neo.fs.v2.netmap.NetmapSnapshotResponse - (*LocalNodeInfoRequest_Body)(nil), // 6: neo.fs.v2.netmap.LocalNodeInfoRequest.Body - (*LocalNodeInfoResponse_Body)(nil), // 7: neo.fs.v2.netmap.LocalNodeInfoResponse.Body - (*NetworkInfoRequest_Body)(nil), // 8: neo.fs.v2.netmap.NetworkInfoRequest.Body - (*NetworkInfoResponse_Body)(nil), // 9: neo.fs.v2.netmap.NetworkInfoResponse.Body - (*NetmapSnapshotRequest_Body)(nil), // 10: neo.fs.v2.netmap.NetmapSnapshotRequest.Body - (*NetmapSnapshotResponse_Body)(nil), // 11: neo.fs.v2.netmap.NetmapSnapshotResponse.Body - (*grpc.RequestMetaHeader)(nil), // 12: neo.fs.v2.session.RequestMetaHeader - (*grpc.RequestVerificationHeader)(nil), // 13: neo.fs.v2.session.RequestVerificationHeader - (*grpc.ResponseMetaHeader)(nil), // 14: neo.fs.v2.session.ResponseMetaHeader - (*grpc.ResponseVerificationHeader)(nil), // 15: neo.fs.v2.session.ResponseVerificationHeader - (*grpc1.Version)(nil), // 16: neo.fs.v2.refs.Version - (*NodeInfo)(nil), // 17: neo.fs.v2.netmap.NodeInfo - (*NetworkInfo)(nil), // 18: neo.fs.v2.netmap.NetworkInfo - (*Netmap)(nil), // 19: neo.fs.v2.netmap.Netmap -} -var file_netmap_grpc_service_proto_depIdxs = []int32{ - 6, // 0: neo.fs.v2.netmap.LocalNodeInfoRequest.body:type_name -> neo.fs.v2.netmap.LocalNodeInfoRequest.Body - 12, // 1: neo.fs.v2.netmap.LocalNodeInfoRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader - 13, // 2: neo.fs.v2.netmap.LocalNodeInfoRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader - 7, // 3: neo.fs.v2.netmap.LocalNodeInfoResponse.body:type_name -> neo.fs.v2.netmap.LocalNodeInfoResponse.Body - 14, // 4: neo.fs.v2.netmap.LocalNodeInfoResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader - 15, // 5: neo.fs.v2.netmap.LocalNodeInfoResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader - 8, // 6: neo.fs.v2.netmap.NetworkInfoRequest.body:type_name -> neo.fs.v2.netmap.NetworkInfoRequest.Body - 12, // 7: neo.fs.v2.netmap.NetworkInfoRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader - 13, // 8: neo.fs.v2.netmap.NetworkInfoRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader - 9, // 9: neo.fs.v2.netmap.NetworkInfoResponse.body:type_name -> neo.fs.v2.netmap.NetworkInfoResponse.Body - 14, // 10: neo.fs.v2.netmap.NetworkInfoResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader - 15, // 11: neo.fs.v2.netmap.NetworkInfoResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader - 10, // 12: neo.fs.v2.netmap.NetmapSnapshotRequest.body:type_name -> neo.fs.v2.netmap.NetmapSnapshotRequest.Body - 12, // 13: neo.fs.v2.netmap.NetmapSnapshotRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader - 13, // 14: neo.fs.v2.netmap.NetmapSnapshotRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader - 11, // 15: neo.fs.v2.netmap.NetmapSnapshotResponse.body:type_name -> neo.fs.v2.netmap.NetmapSnapshotResponse.Body - 14, // 16: neo.fs.v2.netmap.NetmapSnapshotResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader - 15, // 17: neo.fs.v2.netmap.NetmapSnapshotResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader - 16, // 18: neo.fs.v2.netmap.LocalNodeInfoResponse.Body.version:type_name -> neo.fs.v2.refs.Version - 17, // 19: neo.fs.v2.netmap.LocalNodeInfoResponse.Body.node_info:type_name -> neo.fs.v2.netmap.NodeInfo - 18, // 20: neo.fs.v2.netmap.NetworkInfoResponse.Body.network_info:type_name -> neo.fs.v2.netmap.NetworkInfo - 19, // 21: neo.fs.v2.netmap.NetmapSnapshotResponse.Body.netmap:type_name -> neo.fs.v2.netmap.Netmap - 0, // 22: neo.fs.v2.netmap.NetmapService.LocalNodeInfo:input_type -> neo.fs.v2.netmap.LocalNodeInfoRequest - 2, // 23: neo.fs.v2.netmap.NetmapService.NetworkInfo:input_type -> neo.fs.v2.netmap.NetworkInfoRequest - 4, // 24: neo.fs.v2.netmap.NetmapService.NetmapSnapshot:input_type -> neo.fs.v2.netmap.NetmapSnapshotRequest - 1, // 25: neo.fs.v2.netmap.NetmapService.LocalNodeInfo:output_type -> neo.fs.v2.netmap.LocalNodeInfoResponse - 3, // 26: neo.fs.v2.netmap.NetmapService.NetworkInfo:output_type -> neo.fs.v2.netmap.NetworkInfoResponse - 5, // 27: neo.fs.v2.netmap.NetmapService.NetmapSnapshot:output_type -> neo.fs.v2.netmap.NetmapSnapshotResponse - 25, // [25:28] is the sub-list for method output_type - 22, // [22:25] is the sub-list for method input_type - 22, // [22:22] is the sub-list for extension type_name - 22, // [22:22] is the sub-list for extension extendee - 0, // [0:22] is the sub-list for field type_name -} - -func init() { file_netmap_grpc_service_proto_init() } -func file_netmap_grpc_service_proto_init() { - if File_netmap_grpc_service_proto != nil { - return - } - file_netmap_grpc_types_proto_init() - if !protoimpl.UnsafeEnabled { - file_netmap_grpc_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*LocalNodeInfoRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_netmap_grpc_service_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*LocalNodeInfoResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_netmap_grpc_service_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NetworkInfoRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_netmap_grpc_service_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NetworkInfoResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_netmap_grpc_service_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NetmapSnapshotRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_netmap_grpc_service_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NetmapSnapshotResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_netmap_grpc_service_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*LocalNodeInfoRequest_Body); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_netmap_grpc_service_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*LocalNodeInfoResponse_Body); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_netmap_grpc_service_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NetworkInfoRequest_Body); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_netmap_grpc_service_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NetworkInfoResponse_Body); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_netmap_grpc_service_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NetmapSnapshotRequest_Body); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_netmap_grpc_service_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NetmapSnapshotResponse_Body); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_netmap_grpc_service_proto_rawDesc, - NumEnums: 0, - NumMessages: 12, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_netmap_grpc_service_proto_goTypes, - DependencyIndexes: file_netmap_grpc_service_proto_depIdxs, - MessageInfos: file_netmap_grpc_service_proto_msgTypes, - }.Build() - File_netmap_grpc_service_proto = out.File - file_netmap_grpc_service_proto_rawDesc = nil - file_netmap_grpc_service_proto_goTypes = nil - file_netmap_grpc_service_proto_depIdxs = nil -} diff --git a/netmap/grpc/service_frostfs.pb.go b/netmap/grpc/service_frostfs.pb.go new file mode 100644 index 0000000..1ce80ff --- /dev/null +++ b/netmap/grpc/service_frostfs.pb.go @@ -0,0 +1,2061 @@ +// Code generated by protoc-gen-go-frostfs. DO NOT EDIT. + +package netmap + +import ( + json "encoding/json" + fmt "fmt" + grpc1 "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc" + grpc "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session/grpc" + pool "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/pool" + proto "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/proto" + encoding "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/proto/encoding" + easyproto "github.com/VictoriaMetrics/easyproto" + jlexer "github.com/mailru/easyjson/jlexer" + jwriter "github.com/mailru/easyjson/jwriter" +) + +type LocalNodeInfoRequest_Body struct { +} + +var ( + _ encoding.ProtoMarshaler = (*LocalNodeInfoRequest_Body)(nil) + _ encoding.ProtoUnmarshaler = (*LocalNodeInfoRequest_Body)(nil) + _ json.Marshaler = (*LocalNodeInfoRequest_Body)(nil) + _ json.Unmarshaler = (*LocalNodeInfoRequest_Body)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *LocalNodeInfoRequest_Body) StableSize() (size int) { + if x == nil { + return 0 + } + return size +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *LocalNodeInfoRequest_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 *LocalNodeInfoRequest_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) { +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *LocalNodeInfoRequest_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", "LocalNodeInfoRequest_Body") + } + switch fc.FieldNum { + } + } + return nil +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *LocalNodeInfoRequest_Body) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *LocalNodeInfoRequest_Body) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *LocalNodeInfoRequest_Body) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *LocalNodeInfoRequest_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 { + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} + +type LocalNodeInfoRequest struct { + Body *LocalNodeInfoRequest_Body `json:"body"` + MetaHeader *grpc.RequestMetaHeader `json:"metaHeader"` + VerifyHeader *grpc.RequestVerificationHeader `json:"verifyHeader"` +} + +var ( + _ encoding.ProtoMarshaler = (*LocalNodeInfoRequest)(nil) + _ encoding.ProtoUnmarshaler = (*LocalNodeInfoRequest)(nil) + _ json.Marshaler = (*LocalNodeInfoRequest)(nil) + _ json.Unmarshaler = (*LocalNodeInfoRequest)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *LocalNodeInfoRequest) 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 *LocalNodeInfoRequest) 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 *LocalNodeInfoRequest) ReadSignedData(buf []byte) ([]byte, error) { + return x.GetBody().MarshalProtobuf(buf), nil +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *LocalNodeInfoRequest) 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 *LocalNodeInfoRequest) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if x.Body != nil && x.Body.StableSize() != 0 { + x.Body.EmitProtobuf(mm.AppendMessage(1)) + } + if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 { + x.MetaHeader.EmitProtobuf(mm.AppendMessage(2)) + } + if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 { + x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3)) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *LocalNodeInfoRequest) 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", "LocalNodeInfoRequest") + } + switch fc.FieldNum { + case 1: // Body + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Body") + } + x.Body = new(LocalNodeInfoRequest_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(grpc.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(grpc.RequestVerificationHeader) + if err := x.VerifyHeader.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + } + } + return nil +} +func (x *LocalNodeInfoRequest) GetBody() *LocalNodeInfoRequest_Body { + if x != nil { + return x.Body + } + return nil +} +func (x *LocalNodeInfoRequest) SetBody(v *LocalNodeInfoRequest_Body) { + x.Body = v +} +func (x *LocalNodeInfoRequest) GetMetaHeader() *grpc.RequestMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} +func (x *LocalNodeInfoRequest) SetMetaHeader(v *grpc.RequestMetaHeader) { + x.MetaHeader = v +} +func (x *LocalNodeInfoRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} +func (x *LocalNodeInfoRequest) SetVerifyHeader(v *grpc.RequestVerificationHeader) { + x.VerifyHeader = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *LocalNodeInfoRequest) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *LocalNodeInfoRequest) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"body\":" + out.RawString(prefix[1:]) + x.Body.MarshalEasyJSON(out) + } + { + const prefix string = ",\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) + } + { + const prefix string = ",\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *LocalNodeInfoRequest) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *LocalNodeInfoRequest) 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 *LocalNodeInfoRequest_Body + f = new(LocalNodeInfoRequest_Body) + f.UnmarshalEasyJSON(in) + x.Body = f + } + case "metaHeader": + { + var f *grpc.RequestMetaHeader + f = new(grpc.RequestMetaHeader) + f.UnmarshalEasyJSON(in) + x.MetaHeader = f + } + case "verifyHeader": + { + var f *grpc.RequestVerificationHeader + f = new(grpc.RequestVerificationHeader) + f.UnmarshalEasyJSON(in) + x.VerifyHeader = f + } + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} + +type LocalNodeInfoResponse_Body struct { + Version *grpc1.Version `json:"version"` + NodeInfo *NodeInfo `json:"nodeInfo"` +} + +var ( + _ encoding.ProtoMarshaler = (*LocalNodeInfoResponse_Body)(nil) + _ encoding.ProtoUnmarshaler = (*LocalNodeInfoResponse_Body)(nil) + _ json.Marshaler = (*LocalNodeInfoResponse_Body)(nil) + _ json.Unmarshaler = (*LocalNodeInfoResponse_Body)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *LocalNodeInfoResponse_Body) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.NestedStructureSize(1, x.Version) + size += proto.NestedStructureSize(2, x.NodeInfo) + return size +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *LocalNodeInfoResponse_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 *LocalNodeInfoResponse_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if x.Version != nil && x.Version.StableSize() != 0 { + x.Version.EmitProtobuf(mm.AppendMessage(1)) + } + if x.NodeInfo != nil && x.NodeInfo.StableSize() != 0 { + x.NodeInfo.EmitProtobuf(mm.AppendMessage(2)) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *LocalNodeInfoResponse_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", "LocalNodeInfoResponse_Body") + } + switch fc.FieldNum { + case 1: // Version + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Version") + } + x.Version = new(grpc1.Version) + if err := x.Version.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + case 2: // NodeInfo + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "NodeInfo") + } + x.NodeInfo = new(NodeInfo) + if err := x.NodeInfo.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + } + } + return nil +} +func (x *LocalNodeInfoResponse_Body) GetVersion() *grpc1.Version { + if x != nil { + return x.Version + } + return nil +} +func (x *LocalNodeInfoResponse_Body) SetVersion(v *grpc1.Version) { + x.Version = v +} +func (x *LocalNodeInfoResponse_Body) GetNodeInfo() *NodeInfo { + if x != nil { + return x.NodeInfo + } + return nil +} +func (x *LocalNodeInfoResponse_Body) SetNodeInfo(v *NodeInfo) { + x.NodeInfo = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *LocalNodeInfoResponse_Body) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *LocalNodeInfoResponse_Body) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"version\":" + out.RawString(prefix[1:]) + x.Version.MarshalEasyJSON(out) + } + { + const prefix string = ",\"nodeInfo\":" + out.RawString(prefix) + x.NodeInfo.MarshalEasyJSON(out) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *LocalNodeInfoResponse_Body) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *LocalNodeInfoResponse_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 "version": + { + var f *grpc1.Version + f = new(grpc1.Version) + f.UnmarshalEasyJSON(in) + x.Version = f + } + case "nodeInfo": + { + var f *NodeInfo + f = new(NodeInfo) + f.UnmarshalEasyJSON(in) + x.NodeInfo = f + } + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} + +type LocalNodeInfoResponse struct { + Body *LocalNodeInfoResponse_Body `json:"body"` + MetaHeader *grpc.ResponseMetaHeader `json:"metaHeader"` + VerifyHeader *grpc.ResponseVerificationHeader `json:"verifyHeader"` +} + +var ( + _ encoding.ProtoMarshaler = (*LocalNodeInfoResponse)(nil) + _ encoding.ProtoUnmarshaler = (*LocalNodeInfoResponse)(nil) + _ json.Marshaler = (*LocalNodeInfoResponse)(nil) + _ json.Unmarshaler = (*LocalNodeInfoResponse)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *LocalNodeInfoResponse) 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 *LocalNodeInfoResponse) 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 *LocalNodeInfoResponse) ReadSignedData(buf []byte) ([]byte, error) { + return x.GetBody().MarshalProtobuf(buf), nil +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *LocalNodeInfoResponse) 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 *LocalNodeInfoResponse) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if x.Body != nil && x.Body.StableSize() != 0 { + x.Body.EmitProtobuf(mm.AppendMessage(1)) + } + if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 { + x.MetaHeader.EmitProtobuf(mm.AppendMessage(2)) + } + if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 { + x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3)) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *LocalNodeInfoResponse) 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", "LocalNodeInfoResponse") + } + switch fc.FieldNum { + case 1: // Body + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Body") + } + x.Body = new(LocalNodeInfoResponse_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(grpc.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(grpc.ResponseVerificationHeader) + if err := x.VerifyHeader.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + } + } + return nil +} +func (x *LocalNodeInfoResponse) GetBody() *LocalNodeInfoResponse_Body { + if x != nil { + return x.Body + } + return nil +} +func (x *LocalNodeInfoResponse) SetBody(v *LocalNodeInfoResponse_Body) { + x.Body = v +} +func (x *LocalNodeInfoResponse) GetMetaHeader() *grpc.ResponseMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} +func (x *LocalNodeInfoResponse) SetMetaHeader(v *grpc.ResponseMetaHeader) { + x.MetaHeader = v +} +func (x *LocalNodeInfoResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} +func (x *LocalNodeInfoResponse) SetVerifyHeader(v *grpc.ResponseVerificationHeader) { + x.VerifyHeader = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *LocalNodeInfoResponse) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *LocalNodeInfoResponse) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"body\":" + out.RawString(prefix[1:]) + x.Body.MarshalEasyJSON(out) + } + { + const prefix string = ",\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) + } + { + const prefix string = ",\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *LocalNodeInfoResponse) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *LocalNodeInfoResponse) 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 *LocalNodeInfoResponse_Body + f = new(LocalNodeInfoResponse_Body) + f.UnmarshalEasyJSON(in) + x.Body = f + } + case "metaHeader": + { + var f *grpc.ResponseMetaHeader + f = new(grpc.ResponseMetaHeader) + f.UnmarshalEasyJSON(in) + x.MetaHeader = f + } + case "verifyHeader": + { + var f *grpc.ResponseVerificationHeader + f = new(grpc.ResponseVerificationHeader) + f.UnmarshalEasyJSON(in) + x.VerifyHeader = f + } + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} + +type NetworkInfoRequest_Body struct { +} + +var ( + _ encoding.ProtoMarshaler = (*NetworkInfoRequest_Body)(nil) + _ encoding.ProtoUnmarshaler = (*NetworkInfoRequest_Body)(nil) + _ json.Marshaler = (*NetworkInfoRequest_Body)(nil) + _ json.Unmarshaler = (*NetworkInfoRequest_Body)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *NetworkInfoRequest_Body) StableSize() (size int) { + if x == nil { + return 0 + } + return size +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *NetworkInfoRequest_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 *NetworkInfoRequest_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) { +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *NetworkInfoRequest_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", "NetworkInfoRequest_Body") + } + switch fc.FieldNum { + } + } + return nil +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *NetworkInfoRequest_Body) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *NetworkInfoRequest_Body) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *NetworkInfoRequest_Body) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *NetworkInfoRequest_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 { + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} + +type NetworkInfoRequest struct { + Body *NetworkInfoRequest_Body `json:"body"` + MetaHeader *grpc.RequestMetaHeader `json:"metaHeader"` + VerifyHeader *grpc.RequestVerificationHeader `json:"verifyHeader"` +} + +var ( + _ encoding.ProtoMarshaler = (*NetworkInfoRequest)(nil) + _ encoding.ProtoUnmarshaler = (*NetworkInfoRequest)(nil) + _ json.Marshaler = (*NetworkInfoRequest)(nil) + _ json.Unmarshaler = (*NetworkInfoRequest)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *NetworkInfoRequest) 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 *NetworkInfoRequest) 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 *NetworkInfoRequest) ReadSignedData(buf []byte) ([]byte, error) { + return x.GetBody().MarshalProtobuf(buf), nil +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *NetworkInfoRequest) 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 *NetworkInfoRequest) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if x.Body != nil && x.Body.StableSize() != 0 { + x.Body.EmitProtobuf(mm.AppendMessage(1)) + } + if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 { + x.MetaHeader.EmitProtobuf(mm.AppendMessage(2)) + } + if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 { + x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3)) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *NetworkInfoRequest) 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", "NetworkInfoRequest") + } + switch fc.FieldNum { + case 1: // Body + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Body") + } + x.Body = new(NetworkInfoRequest_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(grpc.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(grpc.RequestVerificationHeader) + if err := x.VerifyHeader.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + } + } + return nil +} +func (x *NetworkInfoRequest) GetBody() *NetworkInfoRequest_Body { + if x != nil { + return x.Body + } + return nil +} +func (x *NetworkInfoRequest) SetBody(v *NetworkInfoRequest_Body) { + x.Body = v +} +func (x *NetworkInfoRequest) GetMetaHeader() *grpc.RequestMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} +func (x *NetworkInfoRequest) SetMetaHeader(v *grpc.RequestMetaHeader) { + x.MetaHeader = v +} +func (x *NetworkInfoRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} +func (x *NetworkInfoRequest) SetVerifyHeader(v *grpc.RequestVerificationHeader) { + x.VerifyHeader = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *NetworkInfoRequest) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *NetworkInfoRequest) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"body\":" + out.RawString(prefix[1:]) + x.Body.MarshalEasyJSON(out) + } + { + const prefix string = ",\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) + } + { + const prefix string = ",\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *NetworkInfoRequest) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *NetworkInfoRequest) 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 *NetworkInfoRequest_Body + f = new(NetworkInfoRequest_Body) + f.UnmarshalEasyJSON(in) + x.Body = f + } + case "metaHeader": + { + var f *grpc.RequestMetaHeader + f = new(grpc.RequestMetaHeader) + f.UnmarshalEasyJSON(in) + x.MetaHeader = f + } + case "verifyHeader": + { + var f *grpc.RequestVerificationHeader + f = new(grpc.RequestVerificationHeader) + f.UnmarshalEasyJSON(in) + x.VerifyHeader = f + } + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} + +type NetworkInfoResponse_Body struct { + NetworkInfo *NetworkInfo `json:"networkInfo"` +} + +var ( + _ encoding.ProtoMarshaler = (*NetworkInfoResponse_Body)(nil) + _ encoding.ProtoUnmarshaler = (*NetworkInfoResponse_Body)(nil) + _ json.Marshaler = (*NetworkInfoResponse_Body)(nil) + _ json.Unmarshaler = (*NetworkInfoResponse_Body)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *NetworkInfoResponse_Body) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.NestedStructureSize(1, x.NetworkInfo) + return size +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *NetworkInfoResponse_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 *NetworkInfoResponse_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if x.NetworkInfo != nil && x.NetworkInfo.StableSize() != 0 { + x.NetworkInfo.EmitProtobuf(mm.AppendMessage(1)) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *NetworkInfoResponse_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", "NetworkInfoResponse_Body") + } + switch fc.FieldNum { + case 1: // NetworkInfo + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "NetworkInfo") + } + x.NetworkInfo = new(NetworkInfo) + if err := x.NetworkInfo.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + } + } + return nil +} +func (x *NetworkInfoResponse_Body) GetNetworkInfo() *NetworkInfo { + if x != nil { + return x.NetworkInfo + } + return nil +} +func (x *NetworkInfoResponse_Body) SetNetworkInfo(v *NetworkInfo) { + x.NetworkInfo = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *NetworkInfoResponse_Body) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *NetworkInfoResponse_Body) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"networkInfo\":" + out.RawString(prefix[1:]) + x.NetworkInfo.MarshalEasyJSON(out) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *NetworkInfoResponse_Body) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *NetworkInfoResponse_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 "networkInfo": + { + var f *NetworkInfo + f = new(NetworkInfo) + f.UnmarshalEasyJSON(in) + x.NetworkInfo = f + } + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} + +type NetworkInfoResponse struct { + Body *NetworkInfoResponse_Body `json:"body"` + MetaHeader *grpc.ResponseMetaHeader `json:"metaHeader"` + VerifyHeader *grpc.ResponseVerificationHeader `json:"verifyHeader"` +} + +var ( + _ encoding.ProtoMarshaler = (*NetworkInfoResponse)(nil) + _ encoding.ProtoUnmarshaler = (*NetworkInfoResponse)(nil) + _ json.Marshaler = (*NetworkInfoResponse)(nil) + _ json.Unmarshaler = (*NetworkInfoResponse)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *NetworkInfoResponse) 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 *NetworkInfoResponse) 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 *NetworkInfoResponse) ReadSignedData(buf []byte) ([]byte, error) { + return x.GetBody().MarshalProtobuf(buf), nil +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *NetworkInfoResponse) 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 *NetworkInfoResponse) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if x.Body != nil && x.Body.StableSize() != 0 { + x.Body.EmitProtobuf(mm.AppendMessage(1)) + } + if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 { + x.MetaHeader.EmitProtobuf(mm.AppendMessage(2)) + } + if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 { + x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3)) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *NetworkInfoResponse) 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", "NetworkInfoResponse") + } + switch fc.FieldNum { + case 1: // Body + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Body") + } + x.Body = new(NetworkInfoResponse_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(grpc.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(grpc.ResponseVerificationHeader) + if err := x.VerifyHeader.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + } + } + return nil +} +func (x *NetworkInfoResponse) GetBody() *NetworkInfoResponse_Body { + if x != nil { + return x.Body + } + return nil +} +func (x *NetworkInfoResponse) SetBody(v *NetworkInfoResponse_Body) { + x.Body = v +} +func (x *NetworkInfoResponse) GetMetaHeader() *grpc.ResponseMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} +func (x *NetworkInfoResponse) SetMetaHeader(v *grpc.ResponseMetaHeader) { + x.MetaHeader = v +} +func (x *NetworkInfoResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} +func (x *NetworkInfoResponse) SetVerifyHeader(v *grpc.ResponseVerificationHeader) { + x.VerifyHeader = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *NetworkInfoResponse) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *NetworkInfoResponse) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"body\":" + out.RawString(prefix[1:]) + x.Body.MarshalEasyJSON(out) + } + { + const prefix string = ",\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) + } + { + const prefix string = ",\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *NetworkInfoResponse) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *NetworkInfoResponse) 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 *NetworkInfoResponse_Body + f = new(NetworkInfoResponse_Body) + f.UnmarshalEasyJSON(in) + x.Body = f + } + case "metaHeader": + { + var f *grpc.ResponseMetaHeader + f = new(grpc.ResponseMetaHeader) + f.UnmarshalEasyJSON(in) + x.MetaHeader = f + } + case "verifyHeader": + { + var f *grpc.ResponseVerificationHeader + f = new(grpc.ResponseVerificationHeader) + f.UnmarshalEasyJSON(in) + x.VerifyHeader = f + } + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} + +type NetmapSnapshotRequest_Body struct { +} + +var ( + _ encoding.ProtoMarshaler = (*NetmapSnapshotRequest_Body)(nil) + _ encoding.ProtoUnmarshaler = (*NetmapSnapshotRequest_Body)(nil) + _ json.Marshaler = (*NetmapSnapshotRequest_Body)(nil) + _ json.Unmarshaler = (*NetmapSnapshotRequest_Body)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *NetmapSnapshotRequest_Body) StableSize() (size int) { + if x == nil { + return 0 + } + return size +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *NetmapSnapshotRequest_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 *NetmapSnapshotRequest_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) { +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *NetmapSnapshotRequest_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", "NetmapSnapshotRequest_Body") + } + switch fc.FieldNum { + } + } + return nil +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *NetmapSnapshotRequest_Body) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *NetmapSnapshotRequest_Body) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *NetmapSnapshotRequest_Body) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *NetmapSnapshotRequest_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 { + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} + +type NetmapSnapshotRequest struct { + Body *NetmapSnapshotRequest_Body `json:"body"` + MetaHeader *grpc.RequestMetaHeader `json:"metaHeader"` + VerifyHeader *grpc.RequestVerificationHeader `json:"verifyHeader"` +} + +var ( + _ encoding.ProtoMarshaler = (*NetmapSnapshotRequest)(nil) + _ encoding.ProtoUnmarshaler = (*NetmapSnapshotRequest)(nil) + _ json.Marshaler = (*NetmapSnapshotRequest)(nil) + _ json.Unmarshaler = (*NetmapSnapshotRequest)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *NetmapSnapshotRequest) 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 *NetmapSnapshotRequest) 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 *NetmapSnapshotRequest) ReadSignedData(buf []byte) ([]byte, error) { + return x.GetBody().MarshalProtobuf(buf), nil +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *NetmapSnapshotRequest) 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 *NetmapSnapshotRequest) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if x.Body != nil && x.Body.StableSize() != 0 { + x.Body.EmitProtobuf(mm.AppendMessage(1)) + } + if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 { + x.MetaHeader.EmitProtobuf(mm.AppendMessage(2)) + } + if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 { + x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3)) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *NetmapSnapshotRequest) 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", "NetmapSnapshotRequest") + } + switch fc.FieldNum { + case 1: // Body + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Body") + } + x.Body = new(NetmapSnapshotRequest_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(grpc.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(grpc.RequestVerificationHeader) + if err := x.VerifyHeader.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + } + } + return nil +} +func (x *NetmapSnapshotRequest) GetBody() *NetmapSnapshotRequest_Body { + if x != nil { + return x.Body + } + return nil +} +func (x *NetmapSnapshotRequest) SetBody(v *NetmapSnapshotRequest_Body) { + x.Body = v +} +func (x *NetmapSnapshotRequest) GetMetaHeader() *grpc.RequestMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} +func (x *NetmapSnapshotRequest) SetMetaHeader(v *grpc.RequestMetaHeader) { + x.MetaHeader = v +} +func (x *NetmapSnapshotRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} +func (x *NetmapSnapshotRequest) SetVerifyHeader(v *grpc.RequestVerificationHeader) { + x.VerifyHeader = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *NetmapSnapshotRequest) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *NetmapSnapshotRequest) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"body\":" + out.RawString(prefix[1:]) + x.Body.MarshalEasyJSON(out) + } + { + const prefix string = ",\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) + } + { + const prefix string = ",\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *NetmapSnapshotRequest) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *NetmapSnapshotRequest) 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 *NetmapSnapshotRequest_Body + f = new(NetmapSnapshotRequest_Body) + f.UnmarshalEasyJSON(in) + x.Body = f + } + case "metaHeader": + { + var f *grpc.RequestMetaHeader + f = new(grpc.RequestMetaHeader) + f.UnmarshalEasyJSON(in) + x.MetaHeader = f + } + case "verifyHeader": + { + var f *grpc.RequestVerificationHeader + f = new(grpc.RequestVerificationHeader) + f.UnmarshalEasyJSON(in) + x.VerifyHeader = f + } + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} + +type NetmapSnapshotResponse_Body struct { + Netmap *Netmap `json:"netmap"` +} + +var ( + _ encoding.ProtoMarshaler = (*NetmapSnapshotResponse_Body)(nil) + _ encoding.ProtoUnmarshaler = (*NetmapSnapshotResponse_Body)(nil) + _ json.Marshaler = (*NetmapSnapshotResponse_Body)(nil) + _ json.Unmarshaler = (*NetmapSnapshotResponse_Body)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *NetmapSnapshotResponse_Body) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.NestedStructureSize(1, x.Netmap) + return size +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *NetmapSnapshotResponse_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 *NetmapSnapshotResponse_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if x.Netmap != nil && x.Netmap.StableSize() != 0 { + x.Netmap.EmitProtobuf(mm.AppendMessage(1)) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *NetmapSnapshotResponse_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", "NetmapSnapshotResponse_Body") + } + switch fc.FieldNum { + case 1: // Netmap + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Netmap") + } + x.Netmap = new(Netmap) + if err := x.Netmap.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + } + } + return nil +} +func (x *NetmapSnapshotResponse_Body) GetNetmap() *Netmap { + if x != nil { + return x.Netmap + } + return nil +} +func (x *NetmapSnapshotResponse_Body) SetNetmap(v *Netmap) { + x.Netmap = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *NetmapSnapshotResponse_Body) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *NetmapSnapshotResponse_Body) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"netmap\":" + out.RawString(prefix[1:]) + x.Netmap.MarshalEasyJSON(out) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *NetmapSnapshotResponse_Body) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *NetmapSnapshotResponse_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 "netmap": + { + var f *Netmap + f = new(Netmap) + f.UnmarshalEasyJSON(in) + x.Netmap = f + } + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} + +type NetmapSnapshotResponse struct { + Body *NetmapSnapshotResponse_Body `json:"body"` + MetaHeader *grpc.ResponseMetaHeader `json:"metaHeader"` + VerifyHeader *grpc.ResponseVerificationHeader `json:"verifyHeader"` +} + +var ( + _ encoding.ProtoMarshaler = (*NetmapSnapshotResponse)(nil) + _ encoding.ProtoUnmarshaler = (*NetmapSnapshotResponse)(nil) + _ json.Marshaler = (*NetmapSnapshotResponse)(nil) + _ json.Unmarshaler = (*NetmapSnapshotResponse)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *NetmapSnapshotResponse) 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 *NetmapSnapshotResponse) 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 *NetmapSnapshotResponse) ReadSignedData(buf []byte) ([]byte, error) { + return x.GetBody().MarshalProtobuf(buf), nil +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *NetmapSnapshotResponse) 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 *NetmapSnapshotResponse) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if x.Body != nil && x.Body.StableSize() != 0 { + x.Body.EmitProtobuf(mm.AppendMessage(1)) + } + if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 { + x.MetaHeader.EmitProtobuf(mm.AppendMessage(2)) + } + if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 { + x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3)) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *NetmapSnapshotResponse) 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", "NetmapSnapshotResponse") + } + switch fc.FieldNum { + case 1: // Body + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Body") + } + x.Body = new(NetmapSnapshotResponse_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(grpc.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(grpc.ResponseVerificationHeader) + if err := x.VerifyHeader.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + } + } + return nil +} +func (x *NetmapSnapshotResponse) GetBody() *NetmapSnapshotResponse_Body { + if x != nil { + return x.Body + } + return nil +} +func (x *NetmapSnapshotResponse) SetBody(v *NetmapSnapshotResponse_Body) { + x.Body = v +} +func (x *NetmapSnapshotResponse) GetMetaHeader() *grpc.ResponseMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} +func (x *NetmapSnapshotResponse) SetMetaHeader(v *grpc.ResponseMetaHeader) { + x.MetaHeader = v +} +func (x *NetmapSnapshotResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} +func (x *NetmapSnapshotResponse) SetVerifyHeader(v *grpc.ResponseVerificationHeader) { + x.VerifyHeader = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *NetmapSnapshotResponse) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *NetmapSnapshotResponse) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"body\":" + out.RawString(prefix[1:]) + x.Body.MarshalEasyJSON(out) + } + { + const prefix string = ",\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) + } + { + const prefix string = ",\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *NetmapSnapshotResponse) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *NetmapSnapshotResponse) 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 *NetmapSnapshotResponse_Body + f = new(NetmapSnapshotResponse_Body) + f.UnmarshalEasyJSON(in) + x.Body = f + } + case "metaHeader": + { + var f *grpc.ResponseMetaHeader + f = new(grpc.ResponseMetaHeader) + f.UnmarshalEasyJSON(in) + x.MetaHeader = f + } + case "verifyHeader": + { + var f *grpc.ResponseVerificationHeader + f = new(grpc.ResponseVerificationHeader) + f.UnmarshalEasyJSON(in) + x.VerifyHeader = f + } + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} diff --git a/netmap/grpc/service_frostfs_fuzz.go b/netmap/grpc/service_frostfs_fuzz.go new file mode 100644 index 0000000..ebb59bc --- /dev/null +++ b/netmap/grpc/service_frostfs_fuzz.go @@ -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 +} diff --git a/netmap/grpc/service_frostfs_test.go b/netmap/grpc/service_frostfs_test.go new file mode 100644 index 0000000..5c9035f --- /dev/null +++ b/netmap/grpc/service_frostfs_test.go @@ -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) + }) +} diff --git a/netmap/grpc/types.go b/netmap/grpc/types.go deleted file mode 100644 index f4e90f8..0000000 --- a/netmap/grpc/types.go +++ /dev/null @@ -1,212 +0,0 @@ -package netmap - -// SetReplicas of placement policy. -func (m *PlacementPolicy) SetReplicas(v []*Replica) { - m.Replicas = v -} - -// SetContainerBackupFactor of placement policy. -func (m *PlacementPolicy) SetContainerBackupFactor(v uint32) { - m.ContainerBackupFactor = v -} - -// SetSelectors of placement policy. -func (m *PlacementPolicy) SetSelectors(v []*Selector) { - m.Selectors = v -} - -// SetFilters of placement policy. -func (m *PlacementPolicy) SetFilters(v []*Filter) { - m.Filters = v -} - -// SetUnique of placement policy. -func (m *PlacementPolicy) SetUnique(unique bool) { - m.Unique = unique -} - -// SetName of placement filter. -func (m *Filter) SetName(v string) { - m.Name = v -} - -// SetKey of placement filter. -func (m *Filter) SetKey(v string) { - m.Key = v -} - -// SetOperation of placement filter. -func (m *Filter) SetOp(v Operation) { - m.Op = v -} - -// SetValue of placement filter. -func (m *Filter) SetValue(v string) { - m.Value = v -} - -// SetFilters sets sub-filters of placement filter. -func (m *Filter) SetFilters(v []*Filter) { - m.Filters = v -} - -// SetName of placement selector. -func (m *Selector) SetName(v string) { - m.Name = v -} - -// SetCount of nodes of placement selector. -func (m *Selector) SetCount(v uint32) { - m.Count = v -} - -// SetAttribute of nodes of placement selector. -func (m *Selector) SetAttribute(v string) { - m.Attribute = v -} - -// SetFilter of placement selector. -func (m *Selector) SetFilter(v string) { - m.Filter = v -} - -// SetClause of placement selector. -func (m *Selector) SetClause(v Clause) { - m.Clause = v -} - -// SetCount of object replica. -func (m *Replica) SetCount(v uint32) { - m.Count = v -} - -// SetSelector of object replica. -func (m *Replica) SetSelector(v string) { - m.Selector = v -} - -// SetKey sets key to the node attribute. -func (m *NodeInfo_Attribute) SetKey(v string) { - m.Key = v -} - -// SetValue sets value of the node attribute. -func (m *NodeInfo_Attribute) SetValue(v string) { - m.Value = v -} - -// SetParent sets value of the node parents. -func (m *NodeInfo_Attribute) SetParents(v []string) { - m.Parents = v -} - -// SetAddress sets node network address. -// -// Deprecated: use SetAddresses. -func (m *NodeInfo) SetAddress(v string) { - m.SetAddresses([]string{v}) -} - -// SetAddresses sets list of network addresses of the node. -func (m *NodeInfo) SetAddresses(v []string) { - m.Addresses = v -} - -// SetPublicKey sets node public key in a binary format. -func (m *NodeInfo) SetPublicKey(v []byte) { - m.PublicKey = v -} - -// SetAttributes sets list of the node attributes. -func (m *NodeInfo) SetAttributes(v []*NodeInfo_Attribute) { - m.Attributes = v -} - -// SetState sets node state. -func (m *NodeInfo) SetState(v NodeInfo_State) { - m.State = v -} - -// SetCurrentEpoch sets number of the current epoch. -func (x *NetworkInfo) SetCurrentEpoch(v uint64) { - x.CurrentEpoch = v -} - -// SetMagicNumber sets magic number of the sidechain. -func (x *NetworkInfo) SetMagicNumber(v uint64) { - x.MagicNumber = v -} - -// SetMsPerBlock sets MillisecondsPerBlock network parameter. -func (x *NetworkInfo) SetMsPerBlock(v int64) { - x.MsPerBlock = v -} - -// SetNetworkConfig sets NeoFS network configuration. -func (x *NetworkInfo) SetNetworkConfig(v *NetworkConfig) { - x.NetworkConfig = v -} - -// FromString parses Clause from a string representation, -// It is a reverse action to String(). -// -// Returns true if s was parsed successfully. -func (x *Clause) FromString(s string) bool { - i, ok := Clause_value[s] - if ok { - *x = Clause(i) - } - - return ok -} - -// FromString parses Operation from a string representation, -// It is a reverse action to String(). -// -// Returns true if s was parsed successfully. -func (x *Operation) FromString(s string) bool { - i, ok := Operation_value[s] - if ok { - *x = Operation(i) - } - - return ok -} - -// FromString parses NodeInfo_State from a string representation, -// It is a reverse action to String(). -// -// Returns true if s was parsed successfully. -func (x *NodeInfo_State) FromString(s string) bool { - i, ok := NodeInfo_State_value[s] - if ok { - *x = NodeInfo_State(i) - } - - return ok -} - -// SetKey sets parameter key. -func (x *NetworkConfig_Parameter) SetKey(v []byte) { - x.Key = v -} - -// SetValue sets parameter value. -func (x *NetworkConfig_Parameter) SetValue(v []byte) { - x.Value = v -} - -// SetParameters sets NeoFS network parameters. -func (x *NetworkConfig) SetParameters(v []*NetworkConfig_Parameter) { - x.Parameters = v -} - -// SetEpoch sets revision number of the Netmap. -func (x *Netmap) SetEpoch(v uint64) { - x.Epoch = v -} - -// SetNodes sets nodes presented in the Netmap. -func (x *Netmap) SetNodes(v []*NodeInfo) { - x.Nodes = v -} diff --git a/netmap/grpc/types.pb.go b/netmap/grpc/types.pb.go deleted file mode 100644 index ae1f55f..0000000 --- a/netmap/grpc/types.pb.go +++ /dev/null @@ -1,1371 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.33.0 -// protoc v5.27.2 -// source: netmap/grpc/types.proto - -package netmap - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -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) -) - -// Operations on filters -type Operation int32 - -const ( - // No Operation defined - Operation_OPERATION_UNSPECIFIED Operation = 0 - // Equal - Operation_EQ Operation = 1 - // Not Equal - Operation_NE Operation = 2 - // Greater then - Operation_GT Operation = 3 - // Greater or equal - Operation_GE Operation = 4 - // Less then - Operation_LT Operation = 5 - // Less or equal - Operation_LE Operation = 6 - // Logical OR - Operation_OR Operation = 7 - // Logical AND - Operation_AND Operation = 8 - // Logical negation - Operation_NOT Operation = 9 - // Matches pattern - Operation_LIKE Operation = 10 -) - -// Enum value maps for Operation. -var ( - Operation_name = map[int32]string{ - 0: "OPERATION_UNSPECIFIED", - 1: "EQ", - 2: "NE", - 3: "GT", - 4: "GE", - 5: "LT", - 6: "LE", - 7: "OR", - 8: "AND", - 9: "NOT", - 10: "LIKE", - } - Operation_value = map[string]int32{ - "OPERATION_UNSPECIFIED": 0, - "EQ": 1, - "NE": 2, - "GT": 3, - "GE": 4, - "LT": 5, - "LE": 6, - "OR": 7, - "AND": 8, - "NOT": 9, - "LIKE": 10, - } -) - -func (x Operation) Enum() *Operation { - p := new(Operation) - *p = x - return p -} - -func (x Operation) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (Operation) Descriptor() protoreflect.EnumDescriptor { - return file_netmap_grpc_types_proto_enumTypes[0].Descriptor() -} - -func (Operation) Type() protoreflect.EnumType { - return &file_netmap_grpc_types_proto_enumTypes[0] -} - -func (x Operation) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use Operation.Descriptor instead. -func (Operation) EnumDescriptor() ([]byte, []int) { - return file_netmap_grpc_types_proto_rawDescGZIP(), []int{0} -} - -// Selector modifier shows how the node set will be formed. By default selector -// just groups nodes into a bucket by attribute, selecting nodes only by their -// hash distance. -type Clause int32 - -const ( - // No modifier defined. Nodes will be selected from the bucket randomly - Clause_CLAUSE_UNSPECIFIED Clause = 0 - // SAME will select only nodes having the same value of bucket attribute - Clause_SAME Clause = 1 - // DISTINCT will select nodes having different values of bucket attribute - Clause_DISTINCT Clause = 2 -) - -// Enum value maps for Clause. -var ( - Clause_name = map[int32]string{ - 0: "CLAUSE_UNSPECIFIED", - 1: "SAME", - 2: "DISTINCT", - } - Clause_value = map[string]int32{ - "CLAUSE_UNSPECIFIED": 0, - "SAME": 1, - "DISTINCT": 2, - } -) - -func (x Clause) Enum() *Clause { - p := new(Clause) - *p = x - return p -} - -func (x Clause) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (Clause) Descriptor() protoreflect.EnumDescriptor { - return file_netmap_grpc_types_proto_enumTypes[1].Descriptor() -} - -func (Clause) Type() protoreflect.EnumType { - return &file_netmap_grpc_types_proto_enumTypes[1] -} - -func (x Clause) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use Clause.Descriptor instead. -func (Clause) EnumDescriptor() ([]byte, []int) { - return file_netmap_grpc_types_proto_rawDescGZIP(), []int{1} -} - -// Represents the enumeration of various states of the NeoFS node. -type NodeInfo_State int32 - -const ( - // Unknown state - NodeInfo_UNSPECIFIED NodeInfo_State = 0 - // Active state in the network - NodeInfo_ONLINE NodeInfo_State = 1 - // Network unavailable state - NodeInfo_OFFLINE NodeInfo_State = 2 - // Maintenance state - NodeInfo_MAINTENANCE NodeInfo_State = 3 -) - -// Enum value maps for NodeInfo_State. -var ( - NodeInfo_State_name = map[int32]string{ - 0: "UNSPECIFIED", - 1: "ONLINE", - 2: "OFFLINE", - 3: "MAINTENANCE", - } - NodeInfo_State_value = map[string]int32{ - "UNSPECIFIED": 0, - "ONLINE": 1, - "OFFLINE": 2, - "MAINTENANCE": 3, - } -) - -func (x NodeInfo_State) Enum() *NodeInfo_State { - p := new(NodeInfo_State) - *p = x - return p -} - -func (x NodeInfo_State) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (NodeInfo_State) Descriptor() protoreflect.EnumDescriptor { - return file_netmap_grpc_types_proto_enumTypes[2].Descriptor() -} - -func (NodeInfo_State) Type() protoreflect.EnumType { - return &file_netmap_grpc_types_proto_enumTypes[2] -} - -func (x NodeInfo_State) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use NodeInfo_State.Descriptor instead. -func (NodeInfo_State) EnumDescriptor() ([]byte, []int) { - return file_netmap_grpc_types_proto_rawDescGZIP(), []int{4, 0} -} - -// This filter will return the subset of nodes from `NetworkMap` or another -// filter's results that will satisfy filter's conditions. -type Filter struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Name of the filter or a reference to a named filter. '*' means - // application to the whole unfiltered NetworkMap. At top level it's used as a - // filter name. At lower levels it's considered to be a reference to another - // named filter - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // Key to filter - Key string `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` - // Filtering operation - Op Operation `protobuf:"varint,3,opt,name=op,proto3,enum=neo.fs.v2.netmap.Operation" json:"op,omitempty"` - // Value to match - Value string `protobuf:"bytes,4,opt,name=value,proto3" json:"value,omitempty"` - // List of inner filters. Top level operation will be applied to the whole - // list. - Filters []*Filter `protobuf:"bytes,5,rep,name=filters,proto3" json:"filters,omitempty"` -} - -func (x *Filter) Reset() { - *x = Filter{} - if protoimpl.UnsafeEnabled { - mi := &file_netmap_grpc_types_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Filter) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Filter) ProtoMessage() {} - -func (x *Filter) ProtoReflect() protoreflect.Message { - mi := &file_netmap_grpc_types_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Filter.ProtoReflect.Descriptor instead. -func (*Filter) Descriptor() ([]byte, []int) { - return file_netmap_grpc_types_proto_rawDescGZIP(), []int{0} -} - -func (x *Filter) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *Filter) GetKey() string { - if x != nil { - return x.Key - } - return "" -} - -func (x *Filter) GetOp() Operation { - if x != nil { - return x.Op - } - return Operation_OPERATION_UNSPECIFIED -} - -func (x *Filter) GetValue() string { - if x != nil { - return x.Value - } - return "" -} - -func (x *Filter) GetFilters() []*Filter { - if x != nil { - return x.Filters - } - return nil -} - -// Selector chooses a number of nodes from the bucket taking the nearest nodes -// to the provided `ContainerID` by hash distance. -type Selector struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Selector name to reference in object placement section - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // How many nodes to select from the bucket - Count uint32 `protobuf:"varint,2,opt,name=count,proto3" json:"count,omitempty"` - // Selector modifier showing how to form a bucket - Clause Clause `protobuf:"varint,3,opt,name=clause,proto3,enum=neo.fs.v2.netmap.Clause" json:"clause,omitempty"` - // Bucket attribute to select from - Attribute string `protobuf:"bytes,4,opt,name=attribute,proto3" json:"attribute,omitempty"` - // Filter reference to select from - Filter string `protobuf:"bytes,5,opt,name=filter,proto3" json:"filter,omitempty"` -} - -func (x *Selector) Reset() { - *x = Selector{} - if protoimpl.UnsafeEnabled { - mi := &file_netmap_grpc_types_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Selector) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Selector) ProtoMessage() {} - -func (x *Selector) ProtoReflect() protoreflect.Message { - mi := &file_netmap_grpc_types_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Selector.ProtoReflect.Descriptor instead. -func (*Selector) Descriptor() ([]byte, []int) { - return file_netmap_grpc_types_proto_rawDescGZIP(), []int{1} -} - -func (x *Selector) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *Selector) GetCount() uint32 { - if x != nil { - return x.Count - } - return 0 -} - -func (x *Selector) GetClause() Clause { - if x != nil { - return x.Clause - } - return Clause_CLAUSE_UNSPECIFIED -} - -func (x *Selector) GetAttribute() string { - if x != nil { - return x.Attribute - } - return "" -} - -func (x *Selector) GetFilter() string { - if x != nil { - return x.Filter - } - return "" -} - -// Number of object replicas in a set of nodes from the defined selector. If no -// selector set, the root bucket containing all possible nodes will be used by -// default. -type Replica struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // How many object replicas to put - Count uint32 `protobuf:"varint,1,opt,name=count,proto3" json:"count,omitempty"` - // Named selector bucket to put replicas - Selector string `protobuf:"bytes,2,opt,name=selector,proto3" json:"selector,omitempty"` - // Data shards count - EcDataCount uint32 `protobuf:"varint,3,opt,name=ec_data_count,json=ecDataCount,proto3" json:"ec_data_count,omitempty"` - // Parity shards count - EcParityCount uint32 `protobuf:"varint,4,opt,name=ec_parity_count,json=ecParityCount,proto3" json:"ec_parity_count,omitempty"` -} - -func (x *Replica) Reset() { - *x = Replica{} - if protoimpl.UnsafeEnabled { - mi := &file_netmap_grpc_types_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Replica) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Replica) ProtoMessage() {} - -func (x *Replica) ProtoReflect() protoreflect.Message { - mi := &file_netmap_grpc_types_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Replica.ProtoReflect.Descriptor instead. -func (*Replica) Descriptor() ([]byte, []int) { - return file_netmap_grpc_types_proto_rawDescGZIP(), []int{2} -} - -func (x *Replica) GetCount() uint32 { - if x != nil { - return x.Count - } - return 0 -} - -func (x *Replica) GetSelector() string { - if x != nil { - return x.Selector - } - return "" -} - -func (x *Replica) GetEcDataCount() uint32 { - if x != nil { - return x.EcDataCount - } - return 0 -} - -func (x *Replica) GetEcParityCount() uint32 { - if x != nil { - return x.EcParityCount - } - return 0 -} - -// Set of rules to select a subset of nodes from `NetworkMap` able to store -// container's objects. The format is simple enough to transpile from different -// storage policy definition languages. -type PlacementPolicy struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Rules to set number of object replicas and place each one into a named - // bucket - Replicas []*Replica `protobuf:"bytes,1,rep,name=replicas,proto3" json:"replicas,omitempty"` - // Container backup factor controls how deep NeoFS will search for nodes - // alternatives to include into container's nodes subset - ContainerBackupFactor uint32 `protobuf:"varint,2,opt,name=container_backup_factor,json=containerBackupFactor,proto3" json:"container_backup_factor,omitempty"` - // Set of Selectors to form the container's nodes subset - Selectors []*Selector `protobuf:"bytes,3,rep,name=selectors,proto3" json:"selectors,omitempty"` - // List of named filters to reference in selectors - Filters []*Filter `protobuf:"bytes,4,rep,name=filters,proto3" json:"filters,omitempty"` - // Unique flag defines non-overlapping application for replicas - Unique bool `protobuf:"varint,5,opt,name=unique,proto3" json:"unique,omitempty"` -} - -func (x *PlacementPolicy) Reset() { - *x = PlacementPolicy{} - if protoimpl.UnsafeEnabled { - mi := &file_netmap_grpc_types_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PlacementPolicy) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PlacementPolicy) ProtoMessage() {} - -func (x *PlacementPolicy) ProtoReflect() protoreflect.Message { - mi := &file_netmap_grpc_types_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PlacementPolicy.ProtoReflect.Descriptor instead. -func (*PlacementPolicy) Descriptor() ([]byte, []int) { - return file_netmap_grpc_types_proto_rawDescGZIP(), []int{3} -} - -func (x *PlacementPolicy) GetReplicas() []*Replica { - if x != nil { - return x.Replicas - } - return nil -} - -func (x *PlacementPolicy) GetContainerBackupFactor() uint32 { - if x != nil { - return x.ContainerBackupFactor - } - return 0 -} - -func (x *PlacementPolicy) GetSelectors() []*Selector { - if x != nil { - return x.Selectors - } - return nil -} - -func (x *PlacementPolicy) GetFilters() []*Filter { - if x != nil { - return x.Filters - } - return nil -} - -func (x *PlacementPolicy) GetUnique() bool { - if x != nil { - return x.Unique - } - return false -} - -// NeoFS node description -type NodeInfo struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Public key of the NeoFS node in a binary format - PublicKey []byte `protobuf:"bytes,1,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"` - // Ways to connect to a node - Addresses []string `protobuf:"bytes,2,rep,name=addresses,proto3" json:"addresses,omitempty"` - // Carries list of the NeoFS node attributes in a key-value form. Key name - // must be a node-unique valid UTF-8 string. Value can't be empty. NodeInfo - // structures with duplicated attribute names or attributes with empty values - // will be considered invalid. - Attributes []*NodeInfo_Attribute `protobuf:"bytes,3,rep,name=attributes,proto3" json:"attributes,omitempty"` - // Carries state of the NeoFS node - State NodeInfo_State `protobuf:"varint,4,opt,name=state,proto3,enum=neo.fs.v2.netmap.NodeInfo_State" json:"state,omitempty"` -} - -func (x *NodeInfo) Reset() { - *x = NodeInfo{} - if protoimpl.UnsafeEnabled { - mi := &file_netmap_grpc_types_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *NodeInfo) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*NodeInfo) ProtoMessage() {} - -func (x *NodeInfo) ProtoReflect() protoreflect.Message { - mi := &file_netmap_grpc_types_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use NodeInfo.ProtoReflect.Descriptor instead. -func (*NodeInfo) Descriptor() ([]byte, []int) { - return file_netmap_grpc_types_proto_rawDescGZIP(), []int{4} -} - -func (x *NodeInfo) GetPublicKey() []byte { - if x != nil { - return x.PublicKey - } - return nil -} - -func (x *NodeInfo) GetAddresses() []string { - if x != nil { - return x.Addresses - } - return nil -} - -func (x *NodeInfo) GetAttributes() []*NodeInfo_Attribute { - if x != nil { - return x.Attributes - } - return nil -} - -func (x *NodeInfo) GetState() NodeInfo_State { - if x != nil { - return x.State - } - return NodeInfo_UNSPECIFIED -} - -// Network map structure -type Netmap struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Network map revision number. - Epoch uint64 `protobuf:"varint,1,opt,name=epoch,proto3" json:"epoch,omitempty"` - // Nodes presented in network. - Nodes []*NodeInfo `protobuf:"bytes,2,rep,name=nodes,proto3" json:"nodes,omitempty"` -} - -func (x *Netmap) Reset() { - *x = Netmap{} - if protoimpl.UnsafeEnabled { - mi := &file_netmap_grpc_types_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Netmap) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Netmap) ProtoMessage() {} - -func (x *Netmap) ProtoReflect() protoreflect.Message { - mi := &file_netmap_grpc_types_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Netmap.ProtoReflect.Descriptor instead. -func (*Netmap) Descriptor() ([]byte, []int) { - return file_netmap_grpc_types_proto_rawDescGZIP(), []int{5} -} - -func (x *Netmap) GetEpoch() uint64 { - if x != nil { - return x.Epoch - } - return 0 -} - -func (x *Netmap) GetNodes() []*NodeInfo { - if x != nil { - return x.Nodes - } - return nil -} - -// NeoFS network configuration -type NetworkConfig struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // List of parameter values - Parameters []*NetworkConfig_Parameter `protobuf:"bytes,1,rep,name=parameters,proto3" json:"parameters,omitempty"` -} - -func (x *NetworkConfig) Reset() { - *x = NetworkConfig{} - if protoimpl.UnsafeEnabled { - mi := &file_netmap_grpc_types_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *NetworkConfig) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*NetworkConfig) ProtoMessage() {} - -func (x *NetworkConfig) ProtoReflect() protoreflect.Message { - mi := &file_netmap_grpc_types_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use NetworkConfig.ProtoReflect.Descriptor instead. -func (*NetworkConfig) Descriptor() ([]byte, []int) { - return file_netmap_grpc_types_proto_rawDescGZIP(), []int{6} -} - -func (x *NetworkConfig) GetParameters() []*NetworkConfig_Parameter { - if x != nil { - return x.Parameters - } - return nil -} - -// Information about NeoFS network -type NetworkInfo struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Number of the current epoch in the NeoFS network - CurrentEpoch uint64 `protobuf:"varint,1,opt,name=current_epoch,json=currentEpoch,proto3" json:"current_epoch,omitempty"` - // Magic number of the sidechain of the NeoFS network - MagicNumber uint64 `protobuf:"varint,2,opt,name=magic_number,json=magicNumber,proto3" json:"magic_number,omitempty"` - // MillisecondsPerBlock network parameter of the sidechain of the NeoFS - // network - MsPerBlock int64 `protobuf:"varint,3,opt,name=ms_per_block,json=msPerBlock,proto3" json:"ms_per_block,omitempty"` - // NeoFS network configuration - NetworkConfig *NetworkConfig `protobuf:"bytes,4,opt,name=network_config,json=networkConfig,proto3" json:"network_config,omitempty"` -} - -func (x *NetworkInfo) Reset() { - *x = NetworkInfo{} - if protoimpl.UnsafeEnabled { - mi := &file_netmap_grpc_types_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *NetworkInfo) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*NetworkInfo) ProtoMessage() {} - -func (x *NetworkInfo) ProtoReflect() protoreflect.Message { - mi := &file_netmap_grpc_types_proto_msgTypes[7] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use NetworkInfo.ProtoReflect.Descriptor instead. -func (*NetworkInfo) Descriptor() ([]byte, []int) { - return file_netmap_grpc_types_proto_rawDescGZIP(), []int{7} -} - -func (x *NetworkInfo) GetCurrentEpoch() uint64 { - if x != nil { - return x.CurrentEpoch - } - return 0 -} - -func (x *NetworkInfo) GetMagicNumber() uint64 { - if x != nil { - return x.MagicNumber - } - return 0 -} - -func (x *NetworkInfo) GetMsPerBlock() int64 { - if x != nil { - return x.MsPerBlock - } - return 0 -} - -func (x *NetworkInfo) GetNetworkConfig() *NetworkConfig { - if x != nil { - return x.NetworkConfig - } - return nil -} - -// Administrator-defined Attributes of the NeoFS Storage Node. -// -// `Attribute` is a Key-Value metadata pair. Key name must be a valid UTF-8 -// string. Value can't be empty. -// -// Attributes can be constructed into a chain of attributes: any attribute can -// have a parent attribute and a child attribute (except the first and the -// last one). A string representation of the chain of attributes in NeoFS -// Storage Node configuration uses ":" and "/" symbols, e.g.: -// -// `NEOFS_NODE_ATTRIBUTE_1=key1:val1/key2:val2` -// -// Therefore the string attribute representation in the Node configuration -// must use "\:", "\/" and "\\" escaped symbols if any of them appears in an -// attribute's key or value. -// -// Node's attributes are mostly used during Storage Policy evaluation to -// calculate object's placement and find a set of nodes satisfying policy -// requirements. There are some "well-known" node attributes common to all the -// Storage Nodes in the network and used implicitly with default values if not -// explicitly set: -// -// - Capacity \ -// Total available disk space in Gigabytes. -// - Price \ -// Price in GAS tokens for storing one GB of data during one Epoch. In node -// attributes it's a string presenting floating point number with comma or -// point delimiter for decimal part. In the Network Map it will be saved as -// 64-bit unsigned integer representing number of minimal token fractions. -// - UN-LOCODE \ -// Node's geographic location in -// [UN/LOCODE](https://www.unece.org/cefact/codesfortrade/codes_index.html) -// format approximated to the nearest point defined in the standard. -// - CountryCode \ -// Country code in -// [ISO 3166-1_alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) -// format. Calculated automatically from `UN-LOCODE` attribute. -// - Country \ -// Country short name in English, as defined in -// [ISO-3166](https://www.iso.org/obp/ui/#search). Calculated automatically -// from `UN-LOCODE` attribute. -// - Location \ -// Place names are given, whenever possible, in their national language -// versions as expressed in the Roman alphabet using the 26 characters of -// the character set adopted for international trade data interchange, -// written without diacritics . Calculated automatically from `UN-LOCODE` -// attribute. -// - SubDivCode \ -// Country's administrative subdivision where node is located. Calculated -// automatically from `UN-LOCODE` attribute based on `SubDiv` field. -// Presented in [ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2) -// format. -// - SubDiv \ -// Country's administrative subdivision name, as defined in -// [ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2). Calculated -// automatically from `UN-LOCODE` attribute. -// - Continent \ -// Node's continent name according to the [Seven-Continent model] -// (https://en.wikipedia.org/wiki/Continent#Number). Calculated -// automatically from `UN-LOCODE` attribute. -// - ExternalAddr -// Node's preferred way for communications with external clients. -// Clients SHOULD use these addresses if possible. -// Must contain a comma-separated list of multi-addresses. -// -// For detailed description of each well-known attribute please see the -// corresponding section in NeoFS Technical Specification. -type NodeInfo_Attribute struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Key of the node attribute - Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - // Value of the node attribute - Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` - // Parent keys, if any. For example for `City` it could be `Region` and - // `Country`. - Parents []string `protobuf:"bytes,3,rep,name=parents,proto3" json:"parents,omitempty"` -} - -func (x *NodeInfo_Attribute) Reset() { - *x = NodeInfo_Attribute{} - if protoimpl.UnsafeEnabled { - mi := &file_netmap_grpc_types_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *NodeInfo_Attribute) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*NodeInfo_Attribute) ProtoMessage() {} - -func (x *NodeInfo_Attribute) ProtoReflect() protoreflect.Message { - mi := &file_netmap_grpc_types_proto_msgTypes[8] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use NodeInfo_Attribute.ProtoReflect.Descriptor instead. -func (*NodeInfo_Attribute) Descriptor() ([]byte, []int) { - return file_netmap_grpc_types_proto_rawDescGZIP(), []int{4, 0} -} - -func (x *NodeInfo_Attribute) GetKey() string { - if x != nil { - return x.Key - } - return "" -} - -func (x *NodeInfo_Attribute) GetValue() string { - if x != nil { - return x.Value - } - return "" -} - -func (x *NodeInfo_Attribute) GetParents() []string { - if x != nil { - return x.Parents - } - return nil -} - -// Single configuration parameter. Key MUST be network-unique. -// -// System parameters: -// - **AuditFee** \ -// Fee paid by the storage group owner to the Inner Ring member. -// Value: little-endian integer. Default: 0. -// - **BasicIncomeRate** \ -// Cost of storing one gigabyte of data for a period of one epoch. Paid by -// container owner to container nodes. -// Value: little-endian integer. Default: 0. -// - **ContainerAliasFee** \ -// Fee paid for named container's creation by the container owner. -// Value: little-endian integer. Default: 0. -// - **ContainerFee** \ -// Fee paid for container creation by the container owner. -// Value: little-endian integer. Default: 0. -// - **EpochDuration** \ -// NeoFS epoch duration measured in Sidechain blocks. -// Value: little-endian integer. Default: 0. -// - **HomomorphicHashingDisabled** \ -// Flag of disabling the homomorphic hashing of objects' payload. -// Value: true if any byte != 0. Default: false. -// - **InnerRingCandidateFee** \ -// Fee for entrance to the Inner Ring paid by the candidate. -// Value: little-endian integer. Default: 0. -// - **MaintenanceModeAllowed** \ -// Flag allowing setting the MAINTENANCE state to storage nodes. -// Value: true if any byte != 0. Default: false. -// - **MaxObjectSize** \ -// Maximum size of physically stored NeoFS object measured in bytes. -// Value: little-endian integer. Default: 0. -// - **WithdrawFee** \ -// Fee paid for withdrawal of funds paid by the account owner. -// Value: little-endian integer. Default: 0. -// - **MaxECDataCount** \ -// Maximum number of data shards for EC placement policy. -// Value: little-endian integer. Default: 0. -// - **MaxECParityCount** \ -// Maximum number of parity shards for EC placement policy. -// Value: little-endian integer. Default: 0. -type NetworkConfig_Parameter struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Parameter key. UTF-8 encoded string - Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - // Parameter value - Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` -} - -func (x *NetworkConfig_Parameter) Reset() { - *x = NetworkConfig_Parameter{} - if protoimpl.UnsafeEnabled { - mi := &file_netmap_grpc_types_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *NetworkConfig_Parameter) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*NetworkConfig_Parameter) ProtoMessage() {} - -func (x *NetworkConfig_Parameter) ProtoReflect() protoreflect.Message { - mi := &file_netmap_grpc_types_proto_msgTypes[9] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use NetworkConfig_Parameter.ProtoReflect.Descriptor instead. -func (*NetworkConfig_Parameter) Descriptor() ([]byte, []int) { - return file_netmap_grpc_types_proto_rawDescGZIP(), []int{6, 0} -} - -func (x *NetworkConfig_Parameter) GetKey() []byte { - if x != nil { - return x.Key - } - return nil -} - -func (x *NetworkConfig_Parameter) GetValue() []byte { - if x != nil { - return x.Value - } - return nil -} - -var File_netmap_grpc_types_proto protoreflect.FileDescriptor - -var file_netmap_grpc_types_proto_rawDesc = []byte{ - 0x0a, 0x17, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, - 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x10, 0x6e, 0x65, 0x6f, 0x2e, 0x66, - 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x22, 0xa5, 0x01, 0x0a, 0x06, - 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, - 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x2b, 0x0a, 0x02, - 0x6f, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, - 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4f, 0x70, 0x65, 0x72, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x02, 0x6f, 0x70, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, - 0x32, 0x0a, 0x07, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, - 0x6d, 0x61, 0x70, 0x2e, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x07, 0x66, 0x69, 0x6c, 0x74, - 0x65, 0x72, 0x73, 0x22, 0x9c, 0x01, 0x0a, 0x08, 0x53, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, - 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, - 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0d, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x30, 0x0a, 0x06, 0x63, 0x6c, - 0x61, 0x75, 0x73, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, - 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x43, 0x6c, - 0x61, 0x75, 0x73, 0x65, 0x52, 0x06, 0x63, 0x6c, 0x61, 0x75, 0x73, 0x65, 0x12, 0x1c, 0x0a, 0x09, - 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x09, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x66, 0x69, - 0x6c, 0x74, 0x65, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x66, 0x69, 0x6c, 0x74, - 0x65, 0x72, 0x22, 0x87, 0x01, 0x0a, 0x07, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x12, 0x14, - 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x63, - 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, - 0x12, 0x22, 0x0a, 0x0d, 0x65, 0x63, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x63, 0x6f, 0x75, 0x6e, - 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0b, 0x65, 0x63, 0x44, 0x61, 0x74, 0x61, 0x43, - 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x26, 0x0a, 0x0f, 0x65, 0x63, 0x5f, 0x70, 0x61, 0x72, 0x69, 0x74, - 0x79, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0d, 0x65, - 0x63, 0x50, 0x61, 0x72, 0x69, 0x74, 0x79, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x86, 0x02, 0x0a, - 0x0f, 0x50, 0x6c, 0x61, 0x63, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, - 0x12, 0x35, 0x0a, 0x08, 0x72, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x73, 0x18, 0x01, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, - 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x52, 0x08, 0x72, - 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x73, 0x12, 0x36, 0x0a, 0x17, 0x63, 0x6f, 0x6e, 0x74, 0x61, - 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x62, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x5f, 0x66, 0x61, 0x63, 0x74, - 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x15, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, - 0x6e, 0x65, 0x72, 0x42, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x46, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x12, - 0x38, 0x0a, 0x09, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x73, 0x18, 0x03, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, - 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x53, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x52, 0x09, - 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x73, 0x12, 0x32, 0x0a, 0x07, 0x66, 0x69, 0x6c, - 0x74, 0x65, 0x72, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, - 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x46, 0x69, - 0x6c, 0x74, 0x65, 0x72, 0x52, 0x07, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x73, 0x12, 0x16, 0x0a, - 0x06, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x75, - 0x6e, 0x69, 0x71, 0x75, 0x65, 0x22, 0xd8, 0x02, 0x0a, 0x08, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, - 0x66, 0x6f, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65, 0x79, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, - 0x79, 0x12, 0x1c, 0x0a, 0x09, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x18, 0x02, - 0x20, 0x03, 0x28, 0x09, 0x52, 0x09, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x12, - 0x44, 0x0a, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x03, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, - 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x2e, - 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x52, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, - 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x36, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x04, - 0x20, 0x01, 0x28, 0x0e, 0x32, 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, - 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, - 0x2e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x1a, 0x4d, 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, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x03, 0x20, - 0x03, 0x28, 0x09, 0x52, 0x07, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x73, 0x22, 0x42, 0x0a, 0x05, - 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x0f, 0x0a, 0x0b, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, - 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x4f, 0x4e, 0x4c, 0x49, 0x4e, 0x45, - 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x4f, 0x46, 0x46, 0x4c, 0x49, 0x4e, 0x45, 0x10, 0x02, 0x12, - 0x0f, 0x0a, 0x0b, 0x4d, 0x41, 0x49, 0x4e, 0x54, 0x45, 0x4e, 0x41, 0x4e, 0x43, 0x45, 0x10, 0x03, - 0x22, 0x50, 0x0a, 0x06, 0x4e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x70, - 0x6f, 0x63, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, - 0x12, 0x30, 0x0a, 0x05, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x1a, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, - 0x61, 0x70, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x05, 0x6e, 0x6f, 0x64, - 0x65, 0x73, 0x22, 0x8f, 0x01, 0x0a, 0x0d, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x43, 0x6f, - 0x6e, 0x66, 0x69, 0x67, 0x12, 0x49, 0x0a, 0x0a, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, - 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, - 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4e, 0x65, 0x74, 0x77, - 0x6f, 0x72, 0x6b, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, - 0x74, 0x65, 0x72, 0x52, 0x0a, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x1a, - 0x33, 0x0a, 0x09, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x12, 0x10, 0x0a, 0x03, - 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, - 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x22, 0xbf, 0x01, 0x0a, 0x0b, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, - 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x23, 0x0a, 0x0d, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x5f, - 0x65, 0x70, 0x6f, 0x63, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0c, 0x63, 0x75, 0x72, - 0x72, 0x65, 0x6e, 0x74, 0x45, 0x70, 0x6f, 0x63, 0x68, 0x12, 0x21, 0x0a, 0x0c, 0x6d, 0x61, 0x67, - 0x69, 0x63, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, - 0x0b, 0x6d, 0x61, 0x67, 0x69, 0x63, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x20, 0x0a, 0x0c, - 0x6d, 0x73, 0x5f, 0x70, 0x65, 0x72, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x03, 0x52, 0x0a, 0x6d, 0x73, 0x50, 0x65, 0x72, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x46, - 0x0a, 0x0e, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, - 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, - 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, - 0x6b, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x0d, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, - 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2a, 0x7a, 0x0a, 0x09, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x12, 0x19, 0x0a, 0x15, 0x4f, 0x50, 0x45, 0x52, 0x41, 0x54, 0x49, 0x4f, 0x4e, - 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x06, - 0x0a, 0x02, 0x45, 0x51, 0x10, 0x01, 0x12, 0x06, 0x0a, 0x02, 0x4e, 0x45, 0x10, 0x02, 0x12, 0x06, - 0x0a, 0x02, 0x47, 0x54, 0x10, 0x03, 0x12, 0x06, 0x0a, 0x02, 0x47, 0x45, 0x10, 0x04, 0x12, 0x06, - 0x0a, 0x02, 0x4c, 0x54, 0x10, 0x05, 0x12, 0x06, 0x0a, 0x02, 0x4c, 0x45, 0x10, 0x06, 0x12, 0x06, - 0x0a, 0x02, 0x4f, 0x52, 0x10, 0x07, 0x12, 0x07, 0x0a, 0x03, 0x41, 0x4e, 0x44, 0x10, 0x08, 0x12, - 0x07, 0x0a, 0x03, 0x4e, 0x4f, 0x54, 0x10, 0x09, 0x12, 0x08, 0x0a, 0x04, 0x4c, 0x49, 0x4b, 0x45, - 0x10, 0x0a, 0x2a, 0x38, 0x0a, 0x06, 0x43, 0x6c, 0x61, 0x75, 0x73, 0x65, 0x12, 0x16, 0x0a, 0x12, - 0x43, 0x4c, 0x41, 0x55, 0x53, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, - 0x45, 0x44, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x53, 0x41, 0x4d, 0x45, 0x10, 0x01, 0x12, 0x0c, - 0x0a, 0x08, 0x44, 0x49, 0x53, 0x54, 0x49, 0x4e, 0x43, 0x54, 0x10, 0x02, 0x42, 0x61, 0x5a, 0x42, - 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, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, - 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x6e, 0x65, 0x74, 0x6d, - 0x61, 0x70, 0xaa, 0x02, 0x1a, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, - 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x4e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_netmap_grpc_types_proto_rawDescOnce sync.Once - file_netmap_grpc_types_proto_rawDescData = file_netmap_grpc_types_proto_rawDesc -) - -func file_netmap_grpc_types_proto_rawDescGZIP() []byte { - file_netmap_grpc_types_proto_rawDescOnce.Do(func() { - file_netmap_grpc_types_proto_rawDescData = protoimpl.X.CompressGZIP(file_netmap_grpc_types_proto_rawDescData) - }) - return file_netmap_grpc_types_proto_rawDescData -} - -var file_netmap_grpc_types_proto_enumTypes = make([]protoimpl.EnumInfo, 3) -var file_netmap_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 10) -var file_netmap_grpc_types_proto_goTypes = []interface{}{ - (Operation)(0), // 0: neo.fs.v2.netmap.Operation - (Clause)(0), // 1: neo.fs.v2.netmap.Clause - (NodeInfo_State)(0), // 2: neo.fs.v2.netmap.NodeInfo.State - (*Filter)(nil), // 3: neo.fs.v2.netmap.Filter - (*Selector)(nil), // 4: neo.fs.v2.netmap.Selector - (*Replica)(nil), // 5: neo.fs.v2.netmap.Replica - (*PlacementPolicy)(nil), // 6: neo.fs.v2.netmap.PlacementPolicy - (*NodeInfo)(nil), // 7: neo.fs.v2.netmap.NodeInfo - (*Netmap)(nil), // 8: neo.fs.v2.netmap.Netmap - (*NetworkConfig)(nil), // 9: neo.fs.v2.netmap.NetworkConfig - (*NetworkInfo)(nil), // 10: neo.fs.v2.netmap.NetworkInfo - (*NodeInfo_Attribute)(nil), // 11: neo.fs.v2.netmap.NodeInfo.Attribute - (*NetworkConfig_Parameter)(nil), // 12: neo.fs.v2.netmap.NetworkConfig.Parameter -} -var file_netmap_grpc_types_proto_depIdxs = []int32{ - 0, // 0: neo.fs.v2.netmap.Filter.op:type_name -> neo.fs.v2.netmap.Operation - 3, // 1: neo.fs.v2.netmap.Filter.filters:type_name -> neo.fs.v2.netmap.Filter - 1, // 2: neo.fs.v2.netmap.Selector.clause:type_name -> neo.fs.v2.netmap.Clause - 5, // 3: neo.fs.v2.netmap.PlacementPolicy.replicas:type_name -> neo.fs.v2.netmap.Replica - 4, // 4: neo.fs.v2.netmap.PlacementPolicy.selectors:type_name -> neo.fs.v2.netmap.Selector - 3, // 5: neo.fs.v2.netmap.PlacementPolicy.filters:type_name -> neo.fs.v2.netmap.Filter - 11, // 6: neo.fs.v2.netmap.NodeInfo.attributes:type_name -> neo.fs.v2.netmap.NodeInfo.Attribute - 2, // 7: neo.fs.v2.netmap.NodeInfo.state:type_name -> neo.fs.v2.netmap.NodeInfo.State - 7, // 8: neo.fs.v2.netmap.Netmap.nodes:type_name -> neo.fs.v2.netmap.NodeInfo - 12, // 9: neo.fs.v2.netmap.NetworkConfig.parameters:type_name -> neo.fs.v2.netmap.NetworkConfig.Parameter - 9, // 10: neo.fs.v2.netmap.NetworkInfo.network_config:type_name -> neo.fs.v2.netmap.NetworkConfig - 11, // [11:11] is the sub-list for method output_type - 11, // [11:11] is the sub-list for method input_type - 11, // [11:11] is the sub-list for extension type_name - 11, // [11:11] is the sub-list for extension extendee - 0, // [0:11] is the sub-list for field type_name -} - -func init() { file_netmap_grpc_types_proto_init() } -func file_netmap_grpc_types_proto_init() { - if File_netmap_grpc_types_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_netmap_grpc_types_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Filter); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_netmap_grpc_types_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Selector); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_netmap_grpc_types_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Replica); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_netmap_grpc_types_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PlacementPolicy); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_netmap_grpc_types_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NodeInfo); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_netmap_grpc_types_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Netmap); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_netmap_grpc_types_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NetworkConfig); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_netmap_grpc_types_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NetworkInfo); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_netmap_grpc_types_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NodeInfo_Attribute); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_netmap_grpc_types_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NetworkConfig_Parameter); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_netmap_grpc_types_proto_rawDesc, - NumEnums: 3, - NumMessages: 10, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_netmap_grpc_types_proto_goTypes, - DependencyIndexes: file_netmap_grpc_types_proto_depIdxs, - EnumInfos: file_netmap_grpc_types_proto_enumTypes, - MessageInfos: file_netmap_grpc_types_proto_msgTypes, - }.Build() - File_netmap_grpc_types_proto = out.File - file_netmap_grpc_types_proto_rawDesc = nil - file_netmap_grpc_types_proto_goTypes = nil - file_netmap_grpc_types_proto_depIdxs = nil -} diff --git a/netmap/grpc/types_frostfs.pb.go b/netmap/grpc/types_frostfs.pb.go new file mode 100644 index 0000000..3bab079 --- /dev/null +++ b/netmap/grpc/types_frostfs.pb.go @@ -0,0 +1,2453 @@ +// Code generated by protoc-gen-go-frostfs. DO NOT EDIT. + +package netmap + +import ( + json "encoding/json" + fmt "fmt" + pool "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/pool" + proto "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/proto" + encoding "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/proto/encoding" + easyproto "github.com/VictoriaMetrics/easyproto" + jlexer "github.com/mailru/easyjson/jlexer" + jwriter "github.com/mailru/easyjson/jwriter" + strconv "strconv" +) + +type Operation int32 + +const ( + Operation_OPERATION_UNSPECIFIED Operation = 0 + Operation_EQ Operation = 1 + Operation_NE Operation = 2 + Operation_GT Operation = 3 + Operation_GE Operation = 4 + Operation_LT Operation = 5 + Operation_LE Operation = 6 + Operation_OR Operation = 7 + Operation_AND Operation = 8 + Operation_NOT Operation = 9 + Operation_LIKE Operation = 10 +) + +var ( + Operation_name = map[int32]string{ + 0: "OPERATION_UNSPECIFIED", + 1: "EQ", + 2: "NE", + 3: "GT", + 4: "GE", + 5: "LT", + 6: "LE", + 7: "OR", + 8: "AND", + 9: "NOT", + 10: "LIKE", + } + Operation_value = map[string]int32{ + "OPERATION_UNSPECIFIED": 0, + "EQ": 1, + "NE": 2, + "GT": 3, + "GE": 4, + "LT": 5, + "LE": 6, + "OR": 7, + "AND": 8, + "NOT": 9, + "LIKE": 10, + } +) + +func (x Operation) String() string { + if v, ok := Operation_name[int32(x)]; ok { + return v + } + return strconv.FormatInt(int64(x), 10) +} +func (x *Operation) FromString(s string) bool { + if v, ok := Operation_value[s]; ok { + *x = Operation(v) + return true + } + return false +} + +type Clause int32 + +const ( + Clause_CLAUSE_UNSPECIFIED Clause = 0 + Clause_SAME Clause = 1 + Clause_DISTINCT Clause = 2 +) + +var ( + Clause_name = map[int32]string{ + 0: "CLAUSE_UNSPECIFIED", + 1: "SAME", + 2: "DISTINCT", + } + Clause_value = map[string]int32{ + "CLAUSE_UNSPECIFIED": 0, + "SAME": 1, + "DISTINCT": 2, + } +) + +func (x Clause) String() string { + if v, ok := Clause_name[int32(x)]; ok { + return v + } + return strconv.FormatInt(int64(x), 10) +} +func (x *Clause) FromString(s string) bool { + if v, ok := Clause_value[s]; ok { + *x = Clause(v) + return true + } + return false +} + +type Filter struct { + Name string `json:"name"` + Key string `json:"key"` + Op Operation `json:"op"` + Value string `json:"value"` + Filters []*Filter `json:"filters"` +} + +var ( + _ encoding.ProtoMarshaler = (*Filter)(nil) + _ encoding.ProtoUnmarshaler = (*Filter)(nil) + _ json.Marshaler = (*Filter)(nil) + _ json.Unmarshaler = (*Filter)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *Filter) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.StringSize(1, x.Name) + size += proto.StringSize(2, x.Key) + size += proto.EnumSize(3, int32(x.Op)) + size += proto.StringSize(4, x.Value) + for i := range x.Filters { + size += proto.NestedStructureSize(5, x.Filters[i]) + } + return size +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *Filter) 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 *Filter) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if len(x.Name) != 0 { + mm.AppendString(1, x.Name) + } + if len(x.Key) != 0 { + mm.AppendString(2, x.Key) + } + if int32(x.Op) != 0 { + mm.AppendInt32(3, int32(x.Op)) + } + if len(x.Value) != 0 { + mm.AppendString(4, x.Value) + } + for i := range x.Filters { + if x.Filters[i] != nil && x.Filters[i].StableSize() != 0 { + x.Filters[i].EmitProtobuf(mm.AppendMessage(5)) + } + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *Filter) 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", "Filter") + } + switch fc.FieldNum { + case 1: // Name + data, ok := fc.String() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Name") + } + x.Name = data + case 2: // Key + data, ok := fc.String() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Key") + } + x.Key = data + case 3: // Op + data, ok := fc.Int32() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Op") + } + x.Op = Operation(data) + case 4: // Value + data, ok := fc.String() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Value") + } + x.Value = data + case 5: // Filters + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Filters") + } + x.Filters = append(x.Filters, new(Filter)) + ff := x.Filters[len(x.Filters)-1] + if err := ff.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + } + } + return nil +} +func (x *Filter) GetName() string { + if x != nil { + return x.Name + } + return "" +} +func (x *Filter) SetName(v string) { + x.Name = v +} +func (x *Filter) GetKey() string { + if x != nil { + return x.Key + } + return "" +} +func (x *Filter) SetKey(v string) { + x.Key = v +} +func (x *Filter) GetOp() Operation { + if x != nil { + return x.Op + } + return 0 +} +func (x *Filter) SetOp(v Operation) { + x.Op = v +} +func (x *Filter) GetValue() string { + if x != nil { + return x.Value + } + return "" +} +func (x *Filter) SetValue(v string) { + x.Value = v +} +func (x *Filter) GetFilters() []*Filter { + if x != nil { + return x.Filters + } + return nil +} +func (x *Filter) SetFilters(v []*Filter) { + x.Filters = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *Filter) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *Filter) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"name\":" + out.RawString(prefix[1:]) + out.String(x.Name) + } + { + const prefix string = ",\"key\":" + out.RawString(prefix) + out.String(x.Key) + } + { + const prefix string = ",\"op\":" + out.RawString(prefix) + out.Int32(int32(x.Op)) + } + { + const prefix string = ",\"value\":" + out.RawString(prefix) + out.String(x.Value) + } + { + const prefix string = ",\"filters\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.Filters { + if i != 0 { + out.RawByte(',') + } + x.Filters[i].MarshalEasyJSON(out) + } + out.RawByte(']') + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *Filter) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *Filter) 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 "name": + { + var f string + f = in.String() + x.Name = f + } + case "key": + { + var f string + f = in.String() + x.Key = f + } + case "op": + { + var f Operation + var parsedValue Operation + switch v := in.Interface().(type) { + case string: + if vv, ok := Operation_value[v]; ok { + parsedValue = Operation(vv) + break + } + vv, err := strconv.ParseInt(v, 10, 32) + if err != nil { + in.AddError(err) + return + } + parsedValue = Operation(vv) + case float64: + parsedValue = Operation(v) + } + f = parsedValue + x.Op = f + } + case "value": + { + var f string + f = in.String() + x.Value = f + } + case "filters": + { + var f *Filter + var list []*Filter + in.Delim('[') + for !in.IsDelim(']') { + f = new(Filter) + f.UnmarshalEasyJSON(in) + list = append(list, f) + in.WantComma() + } + x.Filters = list + in.Delim(']') + } + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} + +type Selector struct { + Name string `json:"name"` + Count uint32 `json:"count"` + Clause Clause `json:"clause"` + Attribute string `json:"attribute"` + Filter string `json:"filter"` +} + +var ( + _ encoding.ProtoMarshaler = (*Selector)(nil) + _ encoding.ProtoUnmarshaler = (*Selector)(nil) + _ json.Marshaler = (*Selector)(nil) + _ json.Unmarshaler = (*Selector)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *Selector) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.StringSize(1, x.Name) + size += proto.UInt32Size(2, x.Count) + size += proto.EnumSize(3, int32(x.Clause)) + size += proto.StringSize(4, x.Attribute) + size += proto.StringSize(5, x.Filter) + return size +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *Selector) 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 *Selector) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if len(x.Name) != 0 { + mm.AppendString(1, x.Name) + } + if x.Count != 0 { + mm.AppendUint32(2, x.Count) + } + if int32(x.Clause) != 0 { + mm.AppendInt32(3, int32(x.Clause)) + } + if len(x.Attribute) != 0 { + mm.AppendString(4, x.Attribute) + } + if len(x.Filter) != 0 { + mm.AppendString(5, x.Filter) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *Selector) 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", "Selector") + } + switch fc.FieldNum { + case 1: // Name + data, ok := fc.String() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Name") + } + x.Name = data + case 2: // Count + data, ok := fc.Uint32() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Count") + } + x.Count = data + case 3: // Clause + data, ok := fc.Int32() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Clause") + } + x.Clause = Clause(data) + case 4: // Attribute + data, ok := fc.String() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Attribute") + } + x.Attribute = data + case 5: // Filter + data, ok := fc.String() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Filter") + } + x.Filter = data + } + } + return nil +} +func (x *Selector) GetName() string { + if x != nil { + return x.Name + } + return "" +} +func (x *Selector) SetName(v string) { + x.Name = v +} +func (x *Selector) GetCount() uint32 { + if x != nil { + return x.Count + } + return 0 +} +func (x *Selector) SetCount(v uint32) { + x.Count = v +} +func (x *Selector) GetClause() Clause { + if x != nil { + return x.Clause + } + return 0 +} +func (x *Selector) SetClause(v Clause) { + x.Clause = v +} +func (x *Selector) GetAttribute() string { + if x != nil { + return x.Attribute + } + return "" +} +func (x *Selector) SetAttribute(v string) { + x.Attribute = v +} +func (x *Selector) GetFilter() string { + if x != nil { + return x.Filter + } + return "" +} +func (x *Selector) SetFilter(v string) { + x.Filter = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *Selector) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *Selector) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"name\":" + out.RawString(prefix[1:]) + out.String(x.Name) + } + { + const prefix string = ",\"count\":" + out.RawString(prefix) + out.Uint32(x.Count) + } + { + const prefix string = ",\"clause\":" + out.RawString(prefix) + out.Int32(int32(x.Clause)) + } + { + const prefix string = ",\"attribute\":" + out.RawString(prefix) + out.String(x.Attribute) + } + { + const prefix string = ",\"filter\":" + out.RawString(prefix) + out.String(x.Filter) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *Selector) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *Selector) 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 "name": + { + var f string + f = in.String() + x.Name = f + } + case "count": + { + var f uint32 + f = in.Uint32() + x.Count = f + } + case "clause": + { + var f Clause + var parsedValue Clause + switch v := in.Interface().(type) { + case string: + if vv, ok := Clause_value[v]; ok { + parsedValue = Clause(vv) + break + } + vv, err := strconv.ParseInt(v, 10, 32) + if err != nil { + in.AddError(err) + return + } + parsedValue = Clause(vv) + case float64: + parsedValue = Clause(v) + } + f = parsedValue + x.Clause = f + } + case "attribute": + { + var f string + f = in.String() + x.Attribute = f + } + case "filter": + { + var f string + f = in.String() + x.Filter = f + } + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} + +type Replica struct { + Count uint32 `json:"count"` + Selector string `json:"selector"` + EcDataCount uint32 `json:"ecDataCount"` + EcParityCount uint32 `json:"ecParityCount"` +} + +var ( + _ encoding.ProtoMarshaler = (*Replica)(nil) + _ encoding.ProtoUnmarshaler = (*Replica)(nil) + _ json.Marshaler = (*Replica)(nil) + _ json.Unmarshaler = (*Replica)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *Replica) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.UInt32Size(1, x.Count) + size += proto.StringSize(2, x.Selector) + size += proto.UInt32Size(3, x.EcDataCount) + size += proto.UInt32Size(4, x.EcParityCount) + return size +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *Replica) 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 *Replica) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if x.Count != 0 { + mm.AppendUint32(1, x.Count) + } + if len(x.Selector) != 0 { + mm.AppendString(2, x.Selector) + } + if x.EcDataCount != 0 { + mm.AppendUint32(3, x.EcDataCount) + } + if x.EcParityCount != 0 { + mm.AppendUint32(4, x.EcParityCount) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *Replica) 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", "Replica") + } + switch fc.FieldNum { + case 1: // Count + data, ok := fc.Uint32() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Count") + } + x.Count = data + case 2: // Selector + data, ok := fc.String() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Selector") + } + x.Selector = data + case 3: // EcDataCount + data, ok := fc.Uint32() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "EcDataCount") + } + x.EcDataCount = data + case 4: // EcParityCount + data, ok := fc.Uint32() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "EcParityCount") + } + x.EcParityCount = data + } + } + return nil +} +func (x *Replica) GetCount() uint32 { + if x != nil { + return x.Count + } + return 0 +} +func (x *Replica) SetCount(v uint32) { + x.Count = v +} +func (x *Replica) GetSelector() string { + if x != nil { + return x.Selector + } + return "" +} +func (x *Replica) SetSelector(v string) { + x.Selector = v +} +func (x *Replica) GetEcDataCount() uint32 { + if x != nil { + return x.EcDataCount + } + return 0 +} +func (x *Replica) SetEcDataCount(v uint32) { + x.EcDataCount = v +} +func (x *Replica) GetEcParityCount() uint32 { + if x != nil { + return x.EcParityCount + } + return 0 +} +func (x *Replica) SetEcParityCount(v uint32) { + x.EcParityCount = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *Replica) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *Replica) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"count\":" + out.RawString(prefix[1:]) + out.Uint32(x.Count) + } + { + const prefix string = ",\"selector\":" + out.RawString(prefix) + out.String(x.Selector) + } + { + const prefix string = ",\"ecDataCount\":" + out.RawString(prefix) + out.Uint32(x.EcDataCount) + } + { + const prefix string = ",\"ecParityCount\":" + out.RawString(prefix) + out.Uint32(x.EcParityCount) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *Replica) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *Replica) 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 "count": + { + var f uint32 + f = in.Uint32() + x.Count = f + } + case "selector": + { + var f string + f = in.String() + x.Selector = f + } + case "ecDataCount": + { + var f uint32 + f = in.Uint32() + x.EcDataCount = f + } + case "ecParityCount": + { + var f uint32 + f = in.Uint32() + x.EcParityCount = f + } + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} + +type PlacementPolicy struct { + Replicas []*Replica `json:"replicas"` + ContainerBackupFactor uint32 `json:"containerBackupFactor"` + Selectors []*Selector `json:"selectors"` + Filters []*Filter `json:"filters"` + Unique bool `json:"unique"` +} + +var ( + _ encoding.ProtoMarshaler = (*PlacementPolicy)(nil) + _ encoding.ProtoUnmarshaler = (*PlacementPolicy)(nil) + _ json.Marshaler = (*PlacementPolicy)(nil) + _ json.Unmarshaler = (*PlacementPolicy)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *PlacementPolicy) StableSize() (size int) { + if x == nil { + return 0 + } + for i := range x.Replicas { + size += proto.NestedStructureSize(1, x.Replicas[i]) + } + size += proto.UInt32Size(2, x.ContainerBackupFactor) + for i := range x.Selectors { + size += proto.NestedStructureSize(3, x.Selectors[i]) + } + for i := range x.Filters { + size += proto.NestedStructureSize(4, x.Filters[i]) + } + size += proto.BoolSize(5, x.Unique) + return size +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *PlacementPolicy) 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 *PlacementPolicy) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + for i := range x.Replicas { + if x.Replicas[i] != nil && x.Replicas[i].StableSize() != 0 { + x.Replicas[i].EmitProtobuf(mm.AppendMessage(1)) + } + } + if x.ContainerBackupFactor != 0 { + mm.AppendUint32(2, x.ContainerBackupFactor) + } + for i := range x.Selectors { + if x.Selectors[i] != nil && x.Selectors[i].StableSize() != 0 { + x.Selectors[i].EmitProtobuf(mm.AppendMessage(3)) + } + } + for i := range x.Filters { + if x.Filters[i] != nil && x.Filters[i].StableSize() != 0 { + x.Filters[i].EmitProtobuf(mm.AppendMessage(4)) + } + } + if x.Unique { + mm.AppendBool(5, x.Unique) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *PlacementPolicy) 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", "PlacementPolicy") + } + switch fc.FieldNum { + case 1: // Replicas + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Replicas") + } + x.Replicas = append(x.Replicas, new(Replica)) + ff := x.Replicas[len(x.Replicas)-1] + if err := ff.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + case 2: // ContainerBackupFactor + data, ok := fc.Uint32() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "ContainerBackupFactor") + } + x.ContainerBackupFactor = data + case 3: // Selectors + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Selectors") + } + x.Selectors = append(x.Selectors, new(Selector)) + ff := x.Selectors[len(x.Selectors)-1] + if err := ff.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + case 4: // Filters + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Filters") + } + x.Filters = append(x.Filters, new(Filter)) + ff := x.Filters[len(x.Filters)-1] + if err := ff.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + case 5: // Unique + data, ok := fc.Bool() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Unique") + } + x.Unique = data + } + } + return nil +} +func (x *PlacementPolicy) GetReplicas() []*Replica { + if x != nil { + return x.Replicas + } + return nil +} +func (x *PlacementPolicy) SetReplicas(v []*Replica) { + x.Replicas = v +} +func (x *PlacementPolicy) GetContainerBackupFactor() uint32 { + if x != nil { + return x.ContainerBackupFactor + } + return 0 +} +func (x *PlacementPolicy) SetContainerBackupFactor(v uint32) { + x.ContainerBackupFactor = v +} +func (x *PlacementPolicy) GetSelectors() []*Selector { + if x != nil { + return x.Selectors + } + return nil +} +func (x *PlacementPolicy) SetSelectors(v []*Selector) { + x.Selectors = v +} +func (x *PlacementPolicy) GetFilters() []*Filter { + if x != nil { + return x.Filters + } + return nil +} +func (x *PlacementPolicy) SetFilters(v []*Filter) { + x.Filters = v +} +func (x *PlacementPolicy) GetUnique() bool { + if x != nil { + return x.Unique + } + return false +} +func (x *PlacementPolicy) SetUnique(v bool) { + x.Unique = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *PlacementPolicy) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *PlacementPolicy) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"replicas\":" + out.RawString(prefix[1:]) + out.RawByte('[') + for i := range x.Replicas { + if i != 0 { + out.RawByte(',') + } + x.Replicas[i].MarshalEasyJSON(out) + } + out.RawByte(']') + } + { + const prefix string = ",\"containerBackupFactor\":" + out.RawString(prefix) + out.Uint32(x.ContainerBackupFactor) + } + { + const prefix string = ",\"selectors\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.Selectors { + if i != 0 { + out.RawByte(',') + } + x.Selectors[i].MarshalEasyJSON(out) + } + out.RawByte(']') + } + { + const prefix string = ",\"filters\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.Filters { + if i != 0 { + out.RawByte(',') + } + x.Filters[i].MarshalEasyJSON(out) + } + out.RawByte(']') + } + { + const prefix string = ",\"unique\":" + out.RawString(prefix) + out.Bool(x.Unique) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *PlacementPolicy) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *PlacementPolicy) 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 "replicas": + { + var f *Replica + var list []*Replica + in.Delim('[') + for !in.IsDelim(']') { + f = new(Replica) + f.UnmarshalEasyJSON(in) + list = append(list, f) + in.WantComma() + } + x.Replicas = list + in.Delim(']') + } + case "containerBackupFactor": + { + var f uint32 + f = in.Uint32() + x.ContainerBackupFactor = f + } + case "selectors": + { + var f *Selector + var list []*Selector + in.Delim('[') + for !in.IsDelim(']') { + f = new(Selector) + f.UnmarshalEasyJSON(in) + list = append(list, f) + in.WantComma() + } + x.Selectors = list + in.Delim(']') + } + case "filters": + { + var f *Filter + var list []*Filter + in.Delim('[') + for !in.IsDelim(']') { + f = new(Filter) + f.UnmarshalEasyJSON(in) + list = append(list, f) + in.WantComma() + } + x.Filters = list + in.Delim(']') + } + case "unique": + { + var f bool + f = in.Bool() + x.Unique = f + } + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} + +type NodeInfo_State int32 + +const ( + NodeInfo_UNSPECIFIED NodeInfo_State = 0 + NodeInfo_ONLINE NodeInfo_State = 1 + NodeInfo_OFFLINE NodeInfo_State = 2 + NodeInfo_MAINTENANCE NodeInfo_State = 3 +) + +var ( + NodeInfo_State_name = map[int32]string{ + 0: "UNSPECIFIED", + 1: "ONLINE", + 2: "OFFLINE", + 3: "MAINTENANCE", + } + NodeInfo_State_value = map[string]int32{ + "UNSPECIFIED": 0, + "ONLINE": 1, + "OFFLINE": 2, + "MAINTENANCE": 3, + } +) + +func (x NodeInfo_State) String() string { + if v, ok := NodeInfo_State_name[int32(x)]; ok { + return v + } + return strconv.FormatInt(int64(x), 10) +} +func (x *NodeInfo_State) FromString(s string) bool { + if v, ok := NodeInfo_State_value[s]; ok { + *x = NodeInfo_State(v) + return true + } + return false +} + +type NodeInfo_Attribute struct { + Key string `json:"key"` + Value string `json:"value"` + Parents []string `json:"parents"` +} + +var ( + _ encoding.ProtoMarshaler = (*NodeInfo_Attribute)(nil) + _ encoding.ProtoUnmarshaler = (*NodeInfo_Attribute)(nil) + _ json.Marshaler = (*NodeInfo_Attribute)(nil) + _ json.Unmarshaler = (*NodeInfo_Attribute)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *NodeInfo_Attribute) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.StringSize(1, x.Key) + size += proto.StringSize(2, x.Value) + size += proto.RepeatedStringSize(3, x.Parents) + return size +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *NodeInfo_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 *NodeInfo_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) + } + for j := range x.Parents { + mm.AppendString(3, x.Parents[j]) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *NodeInfo_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", "NodeInfo_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 + case 3: // Parents + data, ok := fc.String() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Parents") + } + x.Parents = append(x.Parents, data) + } + } + return nil +} +func (x *NodeInfo_Attribute) GetKey() string { + if x != nil { + return x.Key + } + return "" +} +func (x *NodeInfo_Attribute) SetKey(v string) { + x.Key = v +} +func (x *NodeInfo_Attribute) GetValue() string { + if x != nil { + return x.Value + } + return "" +} +func (x *NodeInfo_Attribute) SetValue(v string) { + x.Value = v +} +func (x *NodeInfo_Attribute) GetParents() []string { + if x != nil { + return x.Parents + } + return nil +} +func (x *NodeInfo_Attribute) SetParents(v []string) { + x.Parents = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *NodeInfo_Attribute) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *NodeInfo_Attribute) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"key\":" + out.RawString(prefix[1:]) + out.String(x.Key) + } + { + const prefix string = ",\"value\":" + out.RawString(prefix) + out.String(x.Value) + } + { + const prefix string = ",\"parents\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.Parents { + if i != 0 { + out.RawByte(',') + } + out.String(x.Parents[i]) + } + out.RawByte(']') + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *NodeInfo_Attribute) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *NodeInfo_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 + } + case "parents": + { + var f string + var list []string + in.Delim('[') + for !in.IsDelim(']') { + f = in.String() + list = append(list, f) + in.WantComma() + } + x.Parents = list + in.Delim(']') + } + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} + +type NodeInfo struct { + PublicKey []byte `json:"publicKey"` + Addresses []string `json:"addresses"` + Attributes []*NodeInfo_Attribute `json:"attributes"` + State NodeInfo_State `json:"state"` +} + +var ( + _ encoding.ProtoMarshaler = (*NodeInfo)(nil) + _ encoding.ProtoUnmarshaler = (*NodeInfo)(nil) + _ json.Marshaler = (*NodeInfo)(nil) + _ json.Unmarshaler = (*NodeInfo)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *NodeInfo) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.BytesSize(1, x.PublicKey) + size += proto.RepeatedStringSize(2, x.Addresses) + for i := range x.Attributes { + size += proto.NestedStructureSize(3, x.Attributes[i]) + } + size += proto.EnumSize(4, int32(x.State)) + return size +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *NodeInfo) 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 *NodeInfo) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if len(x.PublicKey) != 0 { + mm.AppendBytes(1, x.PublicKey) + } + for j := range x.Addresses { + mm.AppendString(2, x.Addresses[j]) + } + for i := range x.Attributes { + if x.Attributes[i] != nil && x.Attributes[i].StableSize() != 0 { + x.Attributes[i].EmitProtobuf(mm.AppendMessage(3)) + } + } + if int32(x.State) != 0 { + mm.AppendInt32(4, int32(x.State)) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *NodeInfo) 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", "NodeInfo") + } + switch fc.FieldNum { + case 1: // PublicKey + data, ok := fc.Bytes() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "PublicKey") + } + x.PublicKey = data + case 2: // Addresses + data, ok := fc.String() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Addresses") + } + x.Addresses = append(x.Addresses, data) + case 3: // Attributes + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Attributes") + } + x.Attributes = append(x.Attributes, new(NodeInfo_Attribute)) + ff := x.Attributes[len(x.Attributes)-1] + if err := ff.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + case 4: // State + data, ok := fc.Int32() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "State") + } + x.State = NodeInfo_State(data) + } + } + return nil +} +func (x *NodeInfo) GetPublicKey() []byte { + if x != nil { + return x.PublicKey + } + return nil +} +func (x *NodeInfo) SetPublicKey(v []byte) { + x.PublicKey = v +} +func (x *NodeInfo) GetAddresses() []string { + if x != nil { + return x.Addresses + } + return nil +} +func (x *NodeInfo) SetAddresses(v []string) { + x.Addresses = v +} +func (x *NodeInfo) GetAttributes() []*NodeInfo_Attribute { + if x != nil { + return x.Attributes + } + return nil +} +func (x *NodeInfo) SetAttributes(v []*NodeInfo_Attribute) { + x.Attributes = v +} +func (x *NodeInfo) GetState() NodeInfo_State { + if x != nil { + return x.State + } + return 0 +} +func (x *NodeInfo) SetState(v NodeInfo_State) { + x.State = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *NodeInfo) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *NodeInfo) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"publicKey\":" + out.RawString(prefix[1:]) + out.Base64Bytes(x.PublicKey) + } + { + const prefix string = ",\"addresses\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.Addresses { + if i != 0 { + out.RawByte(',') + } + out.String(x.Addresses[i]) + } + out.RawByte(']') + } + { + 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(']') + } + { + const prefix string = ",\"state\":" + out.RawString(prefix) + out.Int32(int32(x.State)) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *NodeInfo) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *NodeInfo) 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 "publicKey": + { + var f []byte + f = in.Bytes() + x.PublicKey = f + } + case "addresses": + { + var f string + var list []string + in.Delim('[') + for !in.IsDelim(']') { + f = in.String() + list = append(list, f) + in.WantComma() + } + x.Addresses = list + in.Delim(']') + } + case "attributes": + { + var f *NodeInfo_Attribute + var list []*NodeInfo_Attribute + in.Delim('[') + for !in.IsDelim(']') { + f = new(NodeInfo_Attribute) + f.UnmarshalEasyJSON(in) + list = append(list, f) + in.WantComma() + } + x.Attributes = list + in.Delim(']') + } + case "state": + { + var f NodeInfo_State + var parsedValue NodeInfo_State + switch v := in.Interface().(type) { + case string: + if vv, ok := NodeInfo_State_value[v]; ok { + parsedValue = NodeInfo_State(vv) + break + } + vv, err := strconv.ParseInt(v, 10, 32) + if err != nil { + in.AddError(err) + return + } + parsedValue = NodeInfo_State(vv) + case float64: + parsedValue = NodeInfo_State(v) + } + f = parsedValue + x.State = f + } + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} + +type Netmap struct { + Epoch uint64 `json:"epoch"` + Nodes []*NodeInfo `json:"nodes"` +} + +var ( + _ encoding.ProtoMarshaler = (*Netmap)(nil) + _ encoding.ProtoUnmarshaler = (*Netmap)(nil) + _ json.Marshaler = (*Netmap)(nil) + _ json.Unmarshaler = (*Netmap)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *Netmap) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.UInt64Size(1, x.Epoch) + for i := range x.Nodes { + size += proto.NestedStructureSize(2, x.Nodes[i]) + } + return size +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *Netmap) 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 *Netmap) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if x.Epoch != 0 { + mm.AppendUint64(1, x.Epoch) + } + for i := range x.Nodes { + if x.Nodes[i] != nil && x.Nodes[i].StableSize() != 0 { + x.Nodes[i].EmitProtobuf(mm.AppendMessage(2)) + } + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *Netmap) 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", "Netmap") + } + switch fc.FieldNum { + case 1: // Epoch + data, ok := fc.Uint64() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Epoch") + } + x.Epoch = data + case 2: // Nodes + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Nodes") + } + x.Nodes = append(x.Nodes, new(NodeInfo)) + ff := x.Nodes[len(x.Nodes)-1] + if err := ff.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + } + } + return nil +} +func (x *Netmap) GetEpoch() uint64 { + if x != nil { + return x.Epoch + } + return 0 +} +func (x *Netmap) SetEpoch(v uint64) { + x.Epoch = v +} +func (x *Netmap) GetNodes() []*NodeInfo { + if x != nil { + return x.Nodes + } + return nil +} +func (x *Netmap) SetNodes(v []*NodeInfo) { + x.Nodes = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *Netmap) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *Netmap) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"epoch\":" + out.RawString(prefix[1:]) + out.Uint64(x.Epoch) + } + { + const prefix string = ",\"nodes\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.Nodes { + if i != 0 { + out.RawByte(',') + } + x.Nodes[i].MarshalEasyJSON(out) + } + out.RawByte(']') + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *Netmap) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *Netmap) 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 "epoch": + { + var f uint64 + f = in.Uint64() + x.Epoch = f + } + case "nodes": + { + var f *NodeInfo + var list []*NodeInfo + in.Delim('[') + for !in.IsDelim(']') { + f = new(NodeInfo) + f.UnmarshalEasyJSON(in) + list = append(list, f) + in.WantComma() + } + x.Nodes = list + in.Delim(']') + } + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} + +type NetworkConfig_Parameter struct { + Key []byte `json:"key"` + Value []byte `json:"value"` +} + +var ( + _ encoding.ProtoMarshaler = (*NetworkConfig_Parameter)(nil) + _ encoding.ProtoUnmarshaler = (*NetworkConfig_Parameter)(nil) + _ json.Marshaler = (*NetworkConfig_Parameter)(nil) + _ json.Unmarshaler = (*NetworkConfig_Parameter)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *NetworkConfig_Parameter) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.BytesSize(1, x.Key) + size += proto.BytesSize(2, x.Value) + return size +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *NetworkConfig_Parameter) 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 *NetworkConfig_Parameter) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if len(x.Key) != 0 { + mm.AppendBytes(1, x.Key) + } + if len(x.Value) != 0 { + mm.AppendBytes(2, x.Value) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *NetworkConfig_Parameter) 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", "NetworkConfig_Parameter") + } + switch fc.FieldNum { + case 1: // Key + data, ok := fc.Bytes() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Key") + } + x.Key = data + case 2: // Value + data, ok := fc.Bytes() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Value") + } + x.Value = data + } + } + return nil +} +func (x *NetworkConfig_Parameter) GetKey() []byte { + if x != nil { + return x.Key + } + return nil +} +func (x *NetworkConfig_Parameter) SetKey(v []byte) { + x.Key = v +} +func (x *NetworkConfig_Parameter) GetValue() []byte { + if x != nil { + return x.Value + } + return nil +} +func (x *NetworkConfig_Parameter) SetValue(v []byte) { + x.Value = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *NetworkConfig_Parameter) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *NetworkConfig_Parameter) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"key\":" + out.RawString(prefix[1:]) + out.Base64Bytes(x.Key) + } + { + const prefix string = ",\"value\":" + out.RawString(prefix) + out.Base64Bytes(x.Value) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *NetworkConfig_Parameter) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *NetworkConfig_Parameter) 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 []byte + f = in.Bytes() + x.Key = f + } + case "value": + { + var f []byte + f = in.Bytes() + x.Value = f + } + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} + +type NetworkConfig struct { + Parameters []*NetworkConfig_Parameter `json:"parameters"` +} + +var ( + _ encoding.ProtoMarshaler = (*NetworkConfig)(nil) + _ encoding.ProtoUnmarshaler = (*NetworkConfig)(nil) + _ json.Marshaler = (*NetworkConfig)(nil) + _ json.Unmarshaler = (*NetworkConfig)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *NetworkConfig) StableSize() (size int) { + if x == nil { + return 0 + } + for i := range x.Parameters { + size += proto.NestedStructureSize(1, x.Parameters[i]) + } + return size +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *NetworkConfig) 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 *NetworkConfig) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + for i := range x.Parameters { + if x.Parameters[i] != nil && x.Parameters[i].StableSize() != 0 { + x.Parameters[i].EmitProtobuf(mm.AppendMessage(1)) + } + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *NetworkConfig) 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", "NetworkConfig") + } + switch fc.FieldNum { + case 1: // Parameters + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Parameters") + } + x.Parameters = append(x.Parameters, new(NetworkConfig_Parameter)) + ff := x.Parameters[len(x.Parameters)-1] + if err := ff.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + } + } + return nil +} +func (x *NetworkConfig) GetParameters() []*NetworkConfig_Parameter { + if x != nil { + return x.Parameters + } + return nil +} +func (x *NetworkConfig) SetParameters(v []*NetworkConfig_Parameter) { + x.Parameters = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *NetworkConfig) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *NetworkConfig) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"parameters\":" + out.RawString(prefix[1:]) + out.RawByte('[') + for i := range x.Parameters { + if i != 0 { + out.RawByte(',') + } + x.Parameters[i].MarshalEasyJSON(out) + } + out.RawByte(']') + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *NetworkConfig) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *NetworkConfig) 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 "parameters": + { + var f *NetworkConfig_Parameter + var list []*NetworkConfig_Parameter + in.Delim('[') + for !in.IsDelim(']') { + f = new(NetworkConfig_Parameter) + f.UnmarshalEasyJSON(in) + list = append(list, f) + in.WantComma() + } + x.Parameters = list + in.Delim(']') + } + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} + +type NetworkInfo struct { + CurrentEpoch uint64 `json:"currentEpoch"` + MagicNumber uint64 `json:"magicNumber"` + MsPerBlock int64 `json:"msPerBlock"` + NetworkConfig *NetworkConfig `json:"networkConfig"` +} + +var ( + _ encoding.ProtoMarshaler = (*NetworkInfo)(nil) + _ encoding.ProtoUnmarshaler = (*NetworkInfo)(nil) + _ json.Marshaler = (*NetworkInfo)(nil) + _ json.Unmarshaler = (*NetworkInfo)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *NetworkInfo) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.UInt64Size(1, x.CurrentEpoch) + size += proto.UInt64Size(2, x.MagicNumber) + size += proto.Int64Size(3, x.MsPerBlock) + size += proto.NestedStructureSize(4, x.NetworkConfig) + return size +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *NetworkInfo) 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 *NetworkInfo) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if x.CurrentEpoch != 0 { + mm.AppendUint64(1, x.CurrentEpoch) + } + if x.MagicNumber != 0 { + mm.AppendUint64(2, x.MagicNumber) + } + if x.MsPerBlock != 0 { + mm.AppendInt64(3, x.MsPerBlock) + } + if x.NetworkConfig != nil && x.NetworkConfig.StableSize() != 0 { + x.NetworkConfig.EmitProtobuf(mm.AppendMessage(4)) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *NetworkInfo) 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", "NetworkInfo") + } + switch fc.FieldNum { + case 1: // CurrentEpoch + data, ok := fc.Uint64() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "CurrentEpoch") + } + x.CurrentEpoch = data + case 2: // MagicNumber + data, ok := fc.Uint64() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "MagicNumber") + } + x.MagicNumber = data + case 3: // MsPerBlock + data, ok := fc.Int64() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "MsPerBlock") + } + x.MsPerBlock = data + case 4: // NetworkConfig + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "NetworkConfig") + } + x.NetworkConfig = new(NetworkConfig) + if err := x.NetworkConfig.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + } + } + return nil +} +func (x *NetworkInfo) GetCurrentEpoch() uint64 { + if x != nil { + return x.CurrentEpoch + } + return 0 +} +func (x *NetworkInfo) SetCurrentEpoch(v uint64) { + x.CurrentEpoch = v +} +func (x *NetworkInfo) GetMagicNumber() uint64 { + if x != nil { + return x.MagicNumber + } + return 0 +} +func (x *NetworkInfo) SetMagicNumber(v uint64) { + x.MagicNumber = v +} +func (x *NetworkInfo) GetMsPerBlock() int64 { + if x != nil { + return x.MsPerBlock + } + return 0 +} +func (x *NetworkInfo) SetMsPerBlock(v int64) { + x.MsPerBlock = v +} +func (x *NetworkInfo) GetNetworkConfig() *NetworkConfig { + if x != nil { + return x.NetworkConfig + } + return nil +} +func (x *NetworkInfo) SetNetworkConfig(v *NetworkConfig) { + x.NetworkConfig = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *NetworkInfo) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *NetworkInfo) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"currentEpoch\":" + out.RawString(prefix[1:]) + out.Uint64(x.CurrentEpoch) + } + { + const prefix string = ",\"magicNumber\":" + out.RawString(prefix) + out.Uint64(x.MagicNumber) + } + { + const prefix string = ",\"msPerBlock\":" + out.RawString(prefix) + out.Int64(x.MsPerBlock) + } + { + const prefix string = ",\"networkConfig\":" + out.RawString(prefix) + x.NetworkConfig.MarshalEasyJSON(out) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *NetworkInfo) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *NetworkInfo) 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 "currentEpoch": + { + var f uint64 + f = in.Uint64() + x.CurrentEpoch = f + } + case "magicNumber": + { + var f uint64 + f = in.Uint64() + x.MagicNumber = f + } + case "msPerBlock": + { + var f int64 + f = in.Int64() + x.MsPerBlock = f + } + case "networkConfig": + { + var f *NetworkConfig + f = new(NetworkConfig) + f.UnmarshalEasyJSON(in) + x.NetworkConfig = f + } + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} diff --git a/netmap/grpc/types_frostfs_fuzz.go b/netmap/grpc/types_frostfs_fuzz.go new file mode 100644 index 0000000..89ccd74 --- /dev/null +++ b/netmap/grpc/types_frostfs_fuzz.go @@ -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 +} diff --git a/netmap/grpc/types_frostfs_test.go b/netmap/grpc/types_frostfs_test.go new file mode 100644 index 0000000..9996dc9 --- /dev/null +++ b/netmap/grpc/types_frostfs_test.go @@ -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) + }) +} diff --git a/object/convert.go b/object/convert.go index 9814b58..e237883 100644 --- a/object/convert.go +++ b/object/convert.go @@ -2491,7 +2491,7 @@ func (r *PatchResponseBody) ToGRPCMessage() grpc.Message { if r != nil { m = new(object.PatchResponse_Body) - m.SetObjectID(r.ObjectID.ToGRPCMessage().(*refsGRPC.ObjectID)) + m.SetObjectId(r.ObjectID.ToGRPCMessage().(*refsGRPC.ObjectID)) } return m diff --git a/object/grpc/service.go b/object/grpc/service.go deleted file mode 100644 index ef6422e..0000000 --- a/object/grpc/service.go +++ /dev/null @@ -1,610 +0,0 @@ -package object - -import ( - refs "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc" - session "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session/grpc" -) - -// SetAddress sets address of the requested object. -func (m *GetRequest_Body) SetAddress(v *refs.Address) { - m.Address = v -} - -// SetRaw sets raw flag of the request. -func (m *GetRequest_Body) SetRaw(v bool) { - m.Raw = v -} - -// SetBody sets body of the request. -func (m *GetRequest) SetBody(v *GetRequest_Body) { - m.Body = v -} - -// SetMetaHeader sets meta header of the request. -func (m *GetRequest) SetMetaHeader(v *session.RequestMetaHeader) { - m.MetaHeader = v -} - -// SetVerifyHeader sets verification header of the request. -func (m *GetRequest) SetVerifyHeader(v *session.RequestVerificationHeader) { - m.VerifyHeader = v -} - -// SetObjectId sets identifier of the object. -func (m *GetResponse_Body_Init) SetObjectId(v *refs.ObjectID) { - m.ObjectId = v -} - -// SetSignature sets signature of the object identifier. -func (m *GetResponse_Body_Init) SetSignature(v *refs.Signature) { - m.Signature = v -} - -// SetHeader sets header of the object. -func (m *GetResponse_Body_Init) SetHeader(v *Header) { - m.Header = v -} - -// GetChunk returns chunk of the object payload bytes. -func (m *GetResponse_Body_Chunk) GetChunk() []byte { - if m != nil { - return m.Chunk - } - - return nil -} - -// SetChunk sets chunk of the object payload bytes. -func (m *GetResponse_Body_Chunk) SetChunk(v []byte) { - m.Chunk = v -} - -// SetInit sets initial part of the object. -func (m *GetResponse_Body) SetInit(v *GetResponse_Body_Init) { - m.ObjectPart = &GetResponse_Body_Init_{ - Init: v, - } -} - -// SetChunk sets part of the object payload. -func (m *GetResponse_Body) SetChunk(v *GetResponse_Body_Chunk) { - m.ObjectPart = v -} - -// SetSplitInfo sets part of the object payload. -func (m *GetResponse_Body) SetSplitInfo(v *SplitInfo) { - m.ObjectPart = &GetResponse_Body_SplitInfo{ - SplitInfo: v, - } -} - -// SetEcInfo sets part of the object payload. -func (m *GetResponse_Body) SetEcInfo(v *ECInfo) { - m.ObjectPart = &GetResponse_Body_EcInfo{ - EcInfo: v, - } -} - -// SetBody sets body of the response. -func (m *GetResponse) SetBody(v *GetResponse_Body) { - m.Body = v -} - -// SetMetaHeader sets meta header of the response. -func (m *GetResponse) SetMetaHeader(v *session.ResponseMetaHeader) { - m.MetaHeader = v -} - -// SetVerifyHeader sets verification header of the response. -func (m *GetResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) { - m.VerifyHeader = v -} - -// SetObjectId sets identifier of the object. -func (m *PutRequest_Body_Init) SetObjectId(v *refs.ObjectID) { - m.ObjectId = v -} - -// SetSignature sets signature of the object identifier. -func (m *PutRequest_Body_Init) SetSignature(v *refs.Signature) { - m.Signature = v -} - -// SetHeader sets header of the object. -func (m *PutRequest_Body_Init) SetHeader(v *Header) { - m.Header = v -} - -// SetCopiesNumber sets number of the copies to save. -func (m *PutRequest_Body_Init) SetCopiesNumber(v []uint32) { - m.CopiesNumber = v -} - -// GetChunk returns chunk of the object payload bytes. -func (m *PutRequest_Body_Chunk) GetChunk() []byte { - if m != nil { - return m.Chunk - } - - return nil -} - -// SetChunk sets chunk of the object payload bytes. -func (m *PutRequest_Body_Chunk) SetChunk(v []byte) { - m.Chunk = v -} - -// SetInit sets initial part of the object. -func (m *PutRequest_Body) SetInit(v *PutRequest_Body_Init) { - m.ObjectPart = &PutRequest_Body_Init_{ - Init: v, - } -} - -// SetChunk sets part of the object payload. -func (m *PutRequest_Body) SetChunk(v *PutRequest_Body_Chunk) { - m.ObjectPart = v -} - -// SetBody sets body of the request. -func (m *PutRequest) SetBody(v *PutRequest_Body) { - m.Body = v -} - -// SetMetaHeader sets meta header of the request. -func (m *PutRequest) SetMetaHeader(v *session.RequestMetaHeader) { - m.MetaHeader = v -} - -// SetVerifyHeader sets verification header of the request. -func (m *PutRequest) SetVerifyHeader(v *session.RequestVerificationHeader) { - m.VerifyHeader = v -} - -// SetObjectId sets identifier of the saved object. -func (m *PutResponse_Body) SetObjectId(v *refs.ObjectID) { - m.ObjectId = v -} - -// SetBody sets body of the response. -func (m *PutResponse) SetBody(v *PutResponse_Body) { - m.Body = v -} - -// SetMetaHeader sets meta header of the response. -func (m *PutResponse) SetMetaHeader(v *session.ResponseMetaHeader) { - m.MetaHeader = v -} - -// SetVerifyHeader sets verification header of the response. -func (m *PutResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) { - m.VerifyHeader = v -} - -// SetAddress sets address of the object to delete. -func (m *DeleteRequest_Body) SetAddress(v *refs.Address) { - m.Address = v -} - -// SetBody sets body of the request. -func (m *DeleteRequest) SetBody(v *DeleteRequest_Body) { - m.Body = v -} - -// SetMetaHeader sets meta header of the request. -func (m *DeleteRequest) SetMetaHeader(v *session.RequestMetaHeader) { - m.MetaHeader = v -} - -// SetVerifyHeader sets verification header of the request. -func (m *DeleteRequest) SetVerifyHeader(v *session.RequestVerificationHeader) { - m.VerifyHeader = v -} - -// SetTombstone sets tombstone address. -func (x *DeleteResponse_Body) SetTombstone(v *refs.Address) { - x.Tombstone = v -} - -// SetBody sets body of the response. -func (m *DeleteResponse) SetBody(v *DeleteResponse_Body) { - m.Body = v -} - -// SetMetaHeader sets meta header of the response. -func (m *DeleteResponse) SetMetaHeader(v *session.ResponseMetaHeader) { - m.MetaHeader = v -} - -// SetVerifyHeader sets verification header of the response. -func (m *DeleteResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) { - m.VerifyHeader = v -} - -// SetAddress sets address of the object with the requested header. -func (m *HeadRequest_Body) SetAddress(v *refs.Address) { - m.Address = v -} - -// SetMainOnly sets flag to return the minimal header subset. -func (m *HeadRequest_Body) SetMainOnly(v bool) { - m.MainOnly = v -} - -// SetRaw sets raw flag of the request. -func (m *HeadRequest_Body) SetRaw(v bool) { - m.Raw = v -} - -// SetBody sets body of the request. -func (m *HeadRequest) SetBody(v *HeadRequest_Body) { - m.Body = v -} - -// SetMetaHeader sets meta header of the request. -func (m *HeadRequest) SetMetaHeader(v *session.RequestMetaHeader) { - m.MetaHeader = v -} - -// SetVerifyHeader sets verification header of the request. -func (m *HeadRequest) SetVerifyHeader(v *session.RequestVerificationHeader) { - m.VerifyHeader = v -} - -// SetHeader sets object header. -func (m *HeaderWithSignature) SetHeader(v *Header) { - m.Header = v -} - -// SetSignature of the header. -func (m *HeaderWithSignature) SetSignature(v *refs.Signature) { - m.Signature = v -} - -// SetHeader sets full header of the object. -func (m *HeadResponse_Body) SetHeader(v *HeaderWithSignature) { - m.Head = &HeadResponse_Body_Header{ - Header: v, - } -} - -// SetShortHeader sets short header of the object. -func (m *HeadResponse_Body) SetShortHeader(v *ShortHeader) { - m.Head = &HeadResponse_Body_ShortHeader{ - ShortHeader: v, - } -} - -// SetSplitInfo sets meta info about split hierarchy of the object. -func (m *HeadResponse_Body) SetSplitInfo(v *SplitInfo) { - m.Head = &HeadResponse_Body_SplitInfo{ - SplitInfo: v, - } -} - -// SetEcInfo sets meta info about the erasure coded object. -func (m *HeadResponse_Body) SetEcInfo(v *ECInfo) { - m.Head = &HeadResponse_Body_EcInfo{ - EcInfo: v, - } -} - -// SetBody sets body of the response. -func (m *HeadResponse) SetBody(v *HeadResponse_Body) { - m.Body = v -} - -// SetMetaHeader sets meta header of the response. -func (m *HeadResponse) SetMetaHeader(v *session.ResponseMetaHeader) { - m.MetaHeader = v -} - -// SetVerifyHeader sets verification header of the response. -func (m *HeadResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) { - m.VerifyHeader = v -} - -// SetMatchType sets match type of the filter. -func (m *SearchRequest_Body_Filter) SetMatchType(v MatchType) { - m.MatchType = v -} - -// SetKey sets key to the filtering header. -func (m *SearchRequest_Body_Filter) SetKey(v string) { - m.Key = v -} - -// SetValue sets value of the filtering header. -func (m *SearchRequest_Body_Filter) SetValue(v string) { - m.Value = v -} - -// SetVersion sets version of the search query. -func (m *SearchRequest_Body) SetVersion(v uint32) { - m.Version = v -} - -// SetFilters sets list of the query filters. -func (m *SearchRequest_Body) SetFilters(v []*SearchRequest_Body_Filter) { - m.Filters = v -} - -// SetContainerId sets container ID of the search requets. -func (m *SearchRequest_Body) SetContainerId(v *refs.ContainerID) { - m.ContainerId = v -} - -// SetBody sets body of the request. -func (m *SearchRequest) SetBody(v *SearchRequest_Body) { - m.Body = v -} - -// SetMetaHeader sets meta header of the request. -func (m *SearchRequest) SetMetaHeader(v *session.RequestMetaHeader) { - m.MetaHeader = v -} - -// SetVerifyHeader sets verification header of the request. -func (m *SearchRequest) SetVerifyHeader(v *session.RequestVerificationHeader) { - m.VerifyHeader = v -} - -// SetIdList sets list of the identifiers of the matched objects. -func (m *SearchResponse_Body) SetIdList(v []*refs.ObjectID) { - m.IdList = v -} - -// SetBody sets body of the response. -func (m *SearchResponse) SetBody(v *SearchResponse_Body) { - m.Body = v -} - -// SetMetaHeader sets meta header of the response. -func (m *SearchResponse) SetMetaHeader(v *session.ResponseMetaHeader) { - m.MetaHeader = v -} - -// SetVerifyHeader sets verification header of the response. -func (m *SearchResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) { - m.VerifyHeader = v -} - -// SetOffset sets offset of the payload range. -func (m *Range) SetOffset(v uint64) { - m.Offset = v -} - -// SetLength sets length of the payload range. -func (m *Range) SetLength(v uint64) { - m.Length = v -} - -// SetAddress sets address of the object with the request payload range. -func (m *GetRangeRequest_Body) SetAddress(v *refs.Address) { - m.Address = v -} - -// SetRange sets range of the object payload. -func (m *GetRangeRequest_Body) SetRange(v *Range) { - m.Range = v -} - -// SetRaw sets raw flag of the request. -func (m *GetRangeRequest_Body) SetRaw(v bool) { - m.Raw = v -} - -// SetBody sets body of the request. -func (m *GetRangeRequest) SetBody(v *GetRangeRequest_Body) { - m.Body = v -} - -// SetMetaHeader sets meta header of the request. -func (m *GetRangeRequest) SetMetaHeader(v *session.RequestMetaHeader) { - m.MetaHeader = v -} - -// SetVerifyHeader sets verification header of the request. -func (m *GetRangeRequest) SetVerifyHeader(v *session.RequestVerificationHeader) { - m.VerifyHeader = v -} - -// GetChunk returns chunk of the object payload range bytes. -func (m *GetRangeResponse_Body_Chunk) GetChunk() []byte { - if m != nil { - return m.Chunk - } - - return nil -} - -// SetChunk sets chunk of the object payload range bytes. -func (m *GetRangeResponse_Body_Chunk) SetChunk(v []byte) { - m.Chunk = v -} - -// SetChunk sets chunk of the object payload. -func (m *GetRangeResponse_Body) SetChunk(v *GetRangeResponse_Body_Chunk) { - m.RangePart = v -} - -// SetSplitInfo sets meta info about split hierarchy of the object. -func (m *GetRangeResponse_Body) SetSplitInfo(v *SplitInfo) { - m.RangePart = &GetRangeResponse_Body_SplitInfo{ - SplitInfo: v, - } -} - -// SetEcInfo sets meta info about the erasure-coded object. -func (m *GetRangeResponse_Body) SetEcInfo(v *ECInfo) { - m.RangePart = &GetRangeResponse_Body_EcInfo{ - EcInfo: v, - } -} - -// SetBody sets body of the response. -func (m *GetRangeResponse) SetBody(v *GetRangeResponse_Body) { - m.Body = v -} - -// SetMetaHeader sets meta header of the response. -func (m *GetRangeResponse) SetMetaHeader(v *session.ResponseMetaHeader) { - m.MetaHeader = v -} - -// SetVerifyHeader sets verification header of the response. -func (m *GetRangeResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) { - m.VerifyHeader = v -} - -// SetAddress sets address of the object with the request payload range. -func (m *GetRangeHashRequest_Body) SetAddress(v *refs.Address) { - m.Address = v -} - -// SetRanges sets list of the ranges of the object payload. -func (m *GetRangeHashRequest_Body) SetRanges(v []*Range) { - m.Ranges = v -} - -// SetSalt sets salt for the object payload ranges. -func (m *GetRangeHashRequest_Body) SetSalt(v []byte) { - m.Salt = v -} - -// Set sets salt for the object payload ranges. -func (m *GetRangeHashRequest_Body) SetType(v refs.ChecksumType) { - m.Type = v -} - -// SetBody sets body of the request. -func (m *GetRangeHashRequest) SetBody(v *GetRangeHashRequest_Body) { - m.Body = v -} - -// SetMetaHeader sets meta header of the request. -func (m *GetRangeHashRequest) SetMetaHeader(v *session.RequestMetaHeader) { - m.MetaHeader = v -} - -// SetVerifyHeader sets verification header of the request. -func (m *GetRangeHashRequest) SetVerifyHeader(v *session.RequestVerificationHeader) { - m.VerifyHeader = v -} - -// SetHashList returns list of the range hashes. -func (m *GetRangeHashResponse_Body) SetHashList(v [][]byte) { - m.HashList = v -} - -// SetHashList returns list of the range hashes. -func (m *GetRangeHashResponse_Body) SetType(v refs.ChecksumType) { - m.Type = v -} - -// SetBody sets body of the response. -func (m *GetRangeHashResponse) SetBody(v *GetRangeHashResponse_Body) { - m.Body = v -} - -// SetMetaHeader sets meta header of the response. -func (m *GetRangeHashResponse) SetMetaHeader(v *session.ResponseMetaHeader) { - m.MetaHeader = v -} - -// SetVerifyHeader sets verification header of the response. -func (m *GetRangeHashResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) { - m.VerifyHeader = v -} - -// SetObject set object of the body. -func (m *PutSingleRequest_Body) SetObject(o *Object) { - m.Object = o -} - -// SetCopiesNumber sets copies number of the body. -func (m *PutSingleRequest_Body) SetCopiesNumber(v []uint32) { - m.CopiesNumber = v -} - -// SetBody sets body of the request. -func (m *PutSingleRequest) SetBody(b *PutSingleRequest_Body) { - m.Body = b -} - -// SetMetaHeader sets meta header of the request. -func (m *PutSingleRequest) SetMetaHeader(v *session.RequestMetaHeader) { - m.MetaHeader = v -} - -// SetVerifyHeader sets verification header of the request. -func (m *PutSingleRequest) SetVerifyHeader(v *session.RequestVerificationHeader) { - m.VerifyHeader = v -} - -// SetBody sets body of the response. -func (m *PutSingleResponse) SetBody(b *PutSingleResponse_Body) { - m.Body = b -} - -// SetMetaHeader sets meta header of the response. -func (m *PutSingleResponse) SetMetaHeader(v *session.ResponseMetaHeader) { - m.MetaHeader = v -} - -// SetVerifyHeader sets verification header of the response. -func (m *PutSingleResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) { - m.VerifyHeader = v -} - -func (m *PatchRequest_Body) SetAddress(addr *refs.Address) { - m.Address = addr -} - -func (m *PatchRequest_Body) SetNewAttributes(attrs []*Header_Attribute) { - m.NewAttributes = attrs -} - -func (m *PatchRequest_Body) SetReplaceAttributes(replaceAttributes bool) { - m.ReplaceAttributes = replaceAttributes -} - -func (m *PatchRequest_Body) SetPatch(patch *PatchRequest_Body_Patch) { - m.Patch = patch -} - -func (m *PatchRequest_Body_Patch) SetSourceRange(r *Range) { - m.SourceRange = r -} - -func (m *PatchRequest_Body_Patch) SetChunk(chunk []byte) { - m.Chunk = chunk -} - -func (m *PatchRequest) SetBody(b *PatchRequest_Body) { - m.Body = b -} - -func (m *PatchRequest) SetMetaHeader(v *session.RequestMetaHeader) { - m.MetaHeader = v -} - -func (m *PatchRequest) SetVerifyHeader(v *session.RequestVerificationHeader) { - m.VerifyHeader = v -} - -func (m *PatchResponse_Body) SetObjectID(objectID *refs.ObjectID) { - m.ObjectId = objectID -} - -func (m *PatchResponse) SetBody(b *PatchResponse_Body) { - m.Body = b -} - -func (m *PatchResponse) SetMetaHeader(v *session.ResponseMetaHeader) { - m.MetaHeader = v -} - -func (m *PatchResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) { - m.VerifyHeader = v -} diff --git a/object/grpc/service.pb.go b/object/grpc/service.pb.go deleted file mode 100644 index 979c932..0000000 --- a/object/grpc/service.pb.go +++ /dev/null @@ -1,4244 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.33.0 -// protoc v5.27.2 -// source: object/grpc/service.proto - -package object - -import ( - grpc1 "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc" - grpc "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session/grpc" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -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) -) - -// GET object request -type GetRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Body of get object request message. - Body *GetRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" 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,proto3" json:"verify_header,omitempty"` -} - -func (x *GetRequest) Reset() { - *x = GetRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_object_grpc_service_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GetRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetRequest) ProtoMessage() {} - -func (x *GetRequest) ProtoReflect() protoreflect.Message { - mi := &file_object_grpc_service_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GetRequest.ProtoReflect.Descriptor instead. -func (*GetRequest) Descriptor() ([]byte, []int) { - return file_object_grpc_service_proto_rawDescGZIP(), []int{0} -} - -func (x *GetRequest) GetBody() *GetRequest_Body { - if x != nil { - return x.Body - } - return nil -} - -func (x *GetRequest) GetMetaHeader() *grpc.RequestMetaHeader { - if x != nil { - return x.MetaHeader - } - return nil -} - -func (x *GetRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { - if x != nil { - return x.VerifyHeader - } - return nil -} - -// GET object response -type GetResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Body of get object response message. - Body *GetResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" 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,proto3" json:"verify_header,omitempty"` -} - -func (x *GetResponse) Reset() { - *x = GetResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_object_grpc_service_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GetResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetResponse) ProtoMessage() {} - -func (x *GetResponse) ProtoReflect() protoreflect.Message { - mi := &file_object_grpc_service_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GetResponse.ProtoReflect.Descriptor instead. -func (*GetResponse) Descriptor() ([]byte, []int) { - return file_object_grpc_service_proto_rawDescGZIP(), []int{1} -} - -func (x *GetResponse) GetBody() *GetResponse_Body { - if x != nil { - return x.Body - } - return nil -} - -func (x *GetResponse) GetMetaHeader() *grpc.ResponseMetaHeader { - if x != nil { - return x.MetaHeader - } - return nil -} - -func (x *GetResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { - if x != nil { - return x.VerifyHeader - } - return nil -} - -// PUT object request -type PutRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Body of put object request message. - Body *PutRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" 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,proto3" json:"verify_header,omitempty"` -} - -func (x *PutRequest) Reset() { - *x = PutRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_object_grpc_service_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PutRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PutRequest) ProtoMessage() {} - -func (x *PutRequest) ProtoReflect() protoreflect.Message { - mi := &file_object_grpc_service_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PutRequest.ProtoReflect.Descriptor instead. -func (*PutRequest) Descriptor() ([]byte, []int) { - return file_object_grpc_service_proto_rawDescGZIP(), []int{2} -} - -func (x *PutRequest) GetBody() *PutRequest_Body { - if x != nil { - return x.Body - } - return nil -} - -func (x *PutRequest) GetMetaHeader() *grpc.RequestMetaHeader { - if x != nil { - return x.MetaHeader - } - return nil -} - -func (x *PutRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { - if x != nil { - return x.VerifyHeader - } - return nil -} - -// PUT Object response -type PutResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Body of put object response message. - Body *PutResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" 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,proto3" json:"verify_header,omitempty"` -} - -func (x *PutResponse) Reset() { - *x = PutResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_object_grpc_service_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PutResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PutResponse) ProtoMessage() {} - -func (x *PutResponse) ProtoReflect() protoreflect.Message { - mi := &file_object_grpc_service_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PutResponse.ProtoReflect.Descriptor instead. -func (*PutResponse) Descriptor() ([]byte, []int) { - return file_object_grpc_service_proto_rawDescGZIP(), []int{3} -} - -func (x *PutResponse) GetBody() *PutResponse_Body { - if x != nil { - return x.Body - } - return nil -} - -func (x *PutResponse) GetMetaHeader() *grpc.ResponseMetaHeader { - if x != nil { - return x.MetaHeader - } - return nil -} - -func (x *PutResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { - if x != nil { - return x.VerifyHeader - } - return nil -} - -// Object DELETE request -type DeleteRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Body of delete object request message. - Body *DeleteRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" 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,proto3" json:"verify_header,omitempty"` -} - -func (x *DeleteRequest) Reset() { - *x = DeleteRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_object_grpc_service_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *DeleteRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DeleteRequest) ProtoMessage() {} - -func (x *DeleteRequest) ProtoReflect() protoreflect.Message { - mi := &file_object_grpc_service_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use DeleteRequest.ProtoReflect.Descriptor instead. -func (*DeleteRequest) Descriptor() ([]byte, []int) { - return file_object_grpc_service_proto_rawDescGZIP(), []int{4} -} - -func (x *DeleteRequest) GetBody() *DeleteRequest_Body { - if x != nil { - return x.Body - } - return nil -} - -func (x *DeleteRequest) GetMetaHeader() *grpc.RequestMetaHeader { - if x != nil { - return x.MetaHeader - } - return nil -} - -func (x *DeleteRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { - if x != nil { - return x.VerifyHeader - } - return nil -} - -// DeleteResponse body is empty because we cannot guarantee permanent object -// removal in distributed system. -type DeleteResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Body of delete object response message. - Body *DeleteResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" 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,proto3" json:"verify_header,omitempty"` -} - -func (x *DeleteResponse) Reset() { - *x = DeleteResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_object_grpc_service_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *DeleteResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DeleteResponse) ProtoMessage() {} - -func (x *DeleteResponse) ProtoReflect() protoreflect.Message { - mi := &file_object_grpc_service_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use DeleteResponse.ProtoReflect.Descriptor instead. -func (*DeleteResponse) Descriptor() ([]byte, []int) { - return file_object_grpc_service_proto_rawDescGZIP(), []int{5} -} - -func (x *DeleteResponse) GetBody() *DeleteResponse_Body { - if x != nil { - return x.Body - } - return nil -} - -func (x *DeleteResponse) GetMetaHeader() *grpc.ResponseMetaHeader { - if x != nil { - return x.MetaHeader - } - return nil -} - -func (x *DeleteResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { - if x != nil { - return x.VerifyHeader - } - return nil -} - -// Object HEAD request -type HeadRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Body of head object request message. - Body *HeadRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" 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,proto3" json:"verify_header,omitempty"` -} - -func (x *HeadRequest) Reset() { - *x = HeadRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_object_grpc_service_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *HeadRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*HeadRequest) ProtoMessage() {} - -func (x *HeadRequest) ProtoReflect() protoreflect.Message { - mi := &file_object_grpc_service_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use HeadRequest.ProtoReflect.Descriptor instead. -func (*HeadRequest) Descriptor() ([]byte, []int) { - return file_object_grpc_service_proto_rawDescGZIP(), []int{6} -} - -func (x *HeadRequest) GetBody() *HeadRequest_Body { - if x != nil { - return x.Body - } - return nil -} - -func (x *HeadRequest) GetMetaHeader() *grpc.RequestMetaHeader { - if x != nil { - return x.MetaHeader - } - return nil -} - -func (x *HeadRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { - if x != nil { - return x.VerifyHeader - } - return nil -} - -// Tuple of a full object header and signature of an `ObjectID`. \ -// Signed `ObjectID` is present to verify full header's authenticity through the -// following steps: -// -// 1. Calculate `SHA-256` of the marshalled `Header` structure -// 2. Check if the resulting hash matches `ObjectID` -// 3. Check if `ObjectID` signature in `signature` field is correct -type HeaderWithSignature struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Full object header - Header *Header `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` - // Signed `ObjectID` to verify full header's authenticity - Signature *grpc1.Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` -} - -func (x *HeaderWithSignature) Reset() { - *x = HeaderWithSignature{} - if protoimpl.UnsafeEnabled { - mi := &file_object_grpc_service_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *HeaderWithSignature) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*HeaderWithSignature) ProtoMessage() {} - -func (x *HeaderWithSignature) ProtoReflect() protoreflect.Message { - mi := &file_object_grpc_service_proto_msgTypes[7] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use HeaderWithSignature.ProtoReflect.Descriptor instead. -func (*HeaderWithSignature) Descriptor() ([]byte, []int) { - return file_object_grpc_service_proto_rawDescGZIP(), []int{7} -} - -func (x *HeaderWithSignature) GetHeader() *Header { - if x != nil { - return x.Header - } - return nil -} - -func (x *HeaderWithSignature) GetSignature() *grpc1.Signature { - if x != nil { - return x.Signature - } - return nil -} - -// Object HEAD response -type HeadResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Body of head object response message. - Body *HeadResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" 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,proto3" json:"verify_header,omitempty"` -} - -func (x *HeadResponse) Reset() { - *x = HeadResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_object_grpc_service_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *HeadResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*HeadResponse) ProtoMessage() {} - -func (x *HeadResponse) ProtoReflect() protoreflect.Message { - mi := &file_object_grpc_service_proto_msgTypes[8] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use HeadResponse.ProtoReflect.Descriptor instead. -func (*HeadResponse) Descriptor() ([]byte, []int) { - return file_object_grpc_service_proto_rawDescGZIP(), []int{8} -} - -func (x *HeadResponse) GetBody() *HeadResponse_Body { - if x != nil { - return x.Body - } - return nil -} - -func (x *HeadResponse) GetMetaHeader() *grpc.ResponseMetaHeader { - if x != nil { - return x.MetaHeader - } - return nil -} - -func (x *HeadResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { - if x != nil { - return x.VerifyHeader - } - return nil -} - -// Object Search request -type SearchRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Body of search object request message. - Body *SearchRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" 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,proto3" json:"verify_header,omitempty"` -} - -func (x *SearchRequest) Reset() { - *x = SearchRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_object_grpc_service_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SearchRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SearchRequest) ProtoMessage() {} - -func (x *SearchRequest) ProtoReflect() protoreflect.Message { - mi := &file_object_grpc_service_proto_msgTypes[9] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SearchRequest.ProtoReflect.Descriptor instead. -func (*SearchRequest) Descriptor() ([]byte, []int) { - return file_object_grpc_service_proto_rawDescGZIP(), []int{9} -} - -func (x *SearchRequest) GetBody() *SearchRequest_Body { - if x != nil { - return x.Body - } - return nil -} - -func (x *SearchRequest) GetMetaHeader() *grpc.RequestMetaHeader { - if x != nil { - return x.MetaHeader - } - return nil -} - -func (x *SearchRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { - if x != nil { - return x.VerifyHeader - } - return nil -} - -// Search response -type SearchResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Body of search object response message. - Body *SearchResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" 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,proto3" json:"verify_header,omitempty"` -} - -func (x *SearchResponse) Reset() { - *x = SearchResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_object_grpc_service_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SearchResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SearchResponse) ProtoMessage() {} - -func (x *SearchResponse) ProtoReflect() protoreflect.Message { - mi := &file_object_grpc_service_proto_msgTypes[10] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SearchResponse.ProtoReflect.Descriptor instead. -func (*SearchResponse) Descriptor() ([]byte, []int) { - return file_object_grpc_service_proto_rawDescGZIP(), []int{10} -} - -func (x *SearchResponse) GetBody() *SearchResponse_Body { - if x != nil { - return x.Body - } - return nil -} - -func (x *SearchResponse) GetMetaHeader() *grpc.ResponseMetaHeader { - if x != nil { - return x.MetaHeader - } - return nil -} - -func (x *SearchResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { - if x != nil { - return x.VerifyHeader - } - return nil -} - -// Object payload range.Ranges of zero length SHOULD be considered as invalid. -type Range struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Offset of the range from the object payload start - Offset uint64 `protobuf:"varint,1,opt,name=offset,proto3" json:"offset,omitempty"` - // Length in bytes of the object payload range - Length uint64 `protobuf:"varint,2,opt,name=length,proto3" json:"length,omitempty"` -} - -func (x *Range) Reset() { - *x = Range{} - if protoimpl.UnsafeEnabled { - mi := &file_object_grpc_service_proto_msgTypes[11] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Range) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Range) ProtoMessage() {} - -func (x *Range) ProtoReflect() protoreflect.Message { - mi := &file_object_grpc_service_proto_msgTypes[11] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Range.ProtoReflect.Descriptor instead. -func (*Range) Descriptor() ([]byte, []int) { - return file_object_grpc_service_proto_rawDescGZIP(), []int{11} -} - -func (x *Range) GetOffset() uint64 { - if x != nil { - return x.Offset - } - return 0 -} - -func (x *Range) GetLength() uint64 { - if x != nil { - return x.Length - } - return 0 -} - -// Request part of object's payload -type GetRangeRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Body of get range object request message. - Body *GetRangeRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" 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,proto3" json:"verify_header,omitempty"` -} - -func (x *GetRangeRequest) Reset() { - *x = GetRangeRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_object_grpc_service_proto_msgTypes[12] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GetRangeRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetRangeRequest) ProtoMessage() {} - -func (x *GetRangeRequest) ProtoReflect() protoreflect.Message { - mi := &file_object_grpc_service_proto_msgTypes[12] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GetRangeRequest.ProtoReflect.Descriptor instead. -func (*GetRangeRequest) Descriptor() ([]byte, []int) { - return file_object_grpc_service_proto_rawDescGZIP(), []int{12} -} - -func (x *GetRangeRequest) GetBody() *GetRangeRequest_Body { - if x != nil { - return x.Body - } - return nil -} - -func (x *GetRangeRequest) GetMetaHeader() *grpc.RequestMetaHeader { - if x != nil { - return x.MetaHeader - } - return nil -} - -func (x *GetRangeRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { - if x != nil { - return x.VerifyHeader - } - return nil -} - -// Get part of object's payload -type GetRangeResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Body of get range object response message. - Body *GetRangeResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" 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,proto3" json:"verify_header,omitempty"` -} - -func (x *GetRangeResponse) Reset() { - *x = GetRangeResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_object_grpc_service_proto_msgTypes[13] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GetRangeResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetRangeResponse) ProtoMessage() {} - -func (x *GetRangeResponse) ProtoReflect() protoreflect.Message { - mi := &file_object_grpc_service_proto_msgTypes[13] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GetRangeResponse.ProtoReflect.Descriptor instead. -func (*GetRangeResponse) Descriptor() ([]byte, []int) { - return file_object_grpc_service_proto_rawDescGZIP(), []int{13} -} - -func (x *GetRangeResponse) GetBody() *GetRangeResponse_Body { - if x != nil { - return x.Body - } - return nil -} - -func (x *GetRangeResponse) GetMetaHeader() *grpc.ResponseMetaHeader { - if x != nil { - return x.MetaHeader - } - return nil -} - -func (x *GetRangeResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { - if x != nil { - return x.VerifyHeader - } - return nil -} - -// Get hash of object's payload part -type GetRangeHashRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Body of get range hash object request message. - Body *GetRangeHashRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" 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,proto3" json:"verify_header,omitempty"` -} - -func (x *GetRangeHashRequest) Reset() { - *x = GetRangeHashRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_object_grpc_service_proto_msgTypes[14] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GetRangeHashRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetRangeHashRequest) ProtoMessage() {} - -func (x *GetRangeHashRequest) ProtoReflect() protoreflect.Message { - mi := &file_object_grpc_service_proto_msgTypes[14] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GetRangeHashRequest.ProtoReflect.Descriptor instead. -func (*GetRangeHashRequest) Descriptor() ([]byte, []int) { - return file_object_grpc_service_proto_rawDescGZIP(), []int{14} -} - -func (x *GetRangeHashRequest) GetBody() *GetRangeHashRequest_Body { - if x != nil { - return x.Body - } - return nil -} - -func (x *GetRangeHashRequest) GetMetaHeader() *grpc.RequestMetaHeader { - if x != nil { - return x.MetaHeader - } - return nil -} - -func (x *GetRangeHashRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { - if x != nil { - return x.VerifyHeader - } - return nil -} - -// Get hash of object's payload part -type GetRangeHashResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Body of get range hash object response message. - Body *GetRangeHashResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" 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,proto3" json:"verify_header,omitempty"` -} - -func (x *GetRangeHashResponse) Reset() { - *x = GetRangeHashResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_object_grpc_service_proto_msgTypes[15] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GetRangeHashResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetRangeHashResponse) ProtoMessage() {} - -func (x *GetRangeHashResponse) ProtoReflect() protoreflect.Message { - mi := &file_object_grpc_service_proto_msgTypes[15] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GetRangeHashResponse.ProtoReflect.Descriptor instead. -func (*GetRangeHashResponse) Descriptor() ([]byte, []int) { - return file_object_grpc_service_proto_rawDescGZIP(), []int{15} -} - -func (x *GetRangeHashResponse) GetBody() *GetRangeHashResponse_Body { - if x != nil { - return x.Body - } - return nil -} - -func (x *GetRangeHashResponse) GetMetaHeader() *grpc.ResponseMetaHeader { - if x != nil { - return x.MetaHeader - } - return nil -} - -func (x *GetRangeHashResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { - if x != nil { - return x.VerifyHeader - } - return nil -} - -// Object PUT Single request -type PutSingleRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Body of put single object request message. - Body *PutSingleRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" 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,proto3" json:"verify_header,omitempty"` -} - -func (x *PutSingleRequest) Reset() { - *x = PutSingleRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_object_grpc_service_proto_msgTypes[16] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PutSingleRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PutSingleRequest) ProtoMessage() {} - -func (x *PutSingleRequest) ProtoReflect() protoreflect.Message { - mi := &file_object_grpc_service_proto_msgTypes[16] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PutSingleRequest.ProtoReflect.Descriptor instead. -func (*PutSingleRequest) Descriptor() ([]byte, []int) { - return file_object_grpc_service_proto_rawDescGZIP(), []int{16} -} - -func (x *PutSingleRequest) GetBody() *PutSingleRequest_Body { - if x != nil { - return x.Body - } - return nil -} - -func (x *PutSingleRequest) GetMetaHeader() *grpc.RequestMetaHeader { - if x != nil { - return x.MetaHeader - } - return nil -} - -func (x *PutSingleRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { - if x != nil { - return x.VerifyHeader - } - return nil -} - -// Object PUT Single response -type PutSingleResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Body of put single object response message. - Body *PutSingleResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" 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,proto3" json:"verify_header,omitempty"` -} - -func (x *PutSingleResponse) Reset() { - *x = PutSingleResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_object_grpc_service_proto_msgTypes[17] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PutSingleResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PutSingleResponse) ProtoMessage() {} - -func (x *PutSingleResponse) ProtoReflect() protoreflect.Message { - mi := &file_object_grpc_service_proto_msgTypes[17] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PutSingleResponse.ProtoReflect.Descriptor instead. -func (*PutSingleResponse) Descriptor() ([]byte, []int) { - return file_object_grpc_service_proto_rawDescGZIP(), []int{17} -} - -func (x *PutSingleResponse) GetBody() *PutSingleResponse_Body { - if x != nil { - return x.Body - } - return nil -} - -func (x *PutSingleResponse) GetMetaHeader() *grpc.ResponseMetaHeader { - if x != nil { - return x.MetaHeader - } - return nil -} - -func (x *PutSingleResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { - if x != nil { - return x.VerifyHeader - } - return nil -} - -// Object PATCH request -type PatchRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Body for patch request message. - Body *PatchRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" 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,proto3" json:"verify_header,omitempty"` -} - -func (x *PatchRequest) Reset() { - *x = PatchRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_object_grpc_service_proto_msgTypes[18] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PatchRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PatchRequest) ProtoMessage() {} - -func (x *PatchRequest) ProtoReflect() protoreflect.Message { - mi := &file_object_grpc_service_proto_msgTypes[18] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PatchRequest.ProtoReflect.Descriptor instead. -func (*PatchRequest) Descriptor() ([]byte, []int) { - return file_object_grpc_service_proto_rawDescGZIP(), []int{18} -} - -func (x *PatchRequest) GetBody() *PatchRequest_Body { - if x != nil { - return x.Body - } - return nil -} - -func (x *PatchRequest) GetMetaHeader() *grpc.RequestMetaHeader { - if x != nil { - return x.MetaHeader - } - return nil -} - -func (x *PatchRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { - if x != nil { - return x.VerifyHeader - } - return nil -} - -// Object PATCH response -type PatchResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Body for patch response message. - Body *PatchResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" 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,proto3" json:"verify_header,omitempty"` -} - -func (x *PatchResponse) Reset() { - *x = PatchResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_object_grpc_service_proto_msgTypes[19] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PatchResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PatchResponse) ProtoMessage() {} - -func (x *PatchResponse) ProtoReflect() protoreflect.Message { - mi := &file_object_grpc_service_proto_msgTypes[19] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PatchResponse.ProtoReflect.Descriptor instead. -func (*PatchResponse) Descriptor() ([]byte, []int) { - return file_object_grpc_service_proto_rawDescGZIP(), []int{19} -} - -func (x *PatchResponse) GetBody() *PatchResponse_Body { - if x != nil { - return x.Body - } - return nil -} - -func (x *PatchResponse) GetMetaHeader() *grpc.ResponseMetaHeader { - if x != nil { - return x.MetaHeader - } - return nil -} - -func (x *PatchResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { - if x != nil { - return x.VerifyHeader - } - return nil -} - -// GET Object request body -type GetRequest_Body struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Address of the requested object - Address *grpc1.Address `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` - // If `raw` flag is set, request will work only with objects that are - // physically stored on the peer node - Raw bool `protobuf:"varint,2,opt,name=raw,proto3" json:"raw,omitempty"` -} - -func (x *GetRequest_Body) Reset() { - *x = GetRequest_Body{} - if protoimpl.UnsafeEnabled { - mi := &file_object_grpc_service_proto_msgTypes[20] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GetRequest_Body) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetRequest_Body) ProtoMessage() {} - -func (x *GetRequest_Body) ProtoReflect() protoreflect.Message { - mi := &file_object_grpc_service_proto_msgTypes[20] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GetRequest_Body.ProtoReflect.Descriptor instead. -func (*GetRequest_Body) Descriptor() ([]byte, []int) { - return file_object_grpc_service_proto_rawDescGZIP(), []int{0, 0} -} - -func (x *GetRequest_Body) GetAddress() *grpc1.Address { - if x != nil { - return x.Address - } - return nil -} - -func (x *GetRequest_Body) GetRaw() bool { - if x != nil { - return x.Raw - } - return false -} - -// GET Object Response body -type GetResponse_Body struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Single message in the response stream. - // - // Types that are assignable to ObjectPart: - // - // *GetResponse_Body_Init_ - // *GetResponse_Body_Chunk - // *GetResponse_Body_SplitInfo - // *GetResponse_Body_EcInfo - ObjectPart isGetResponse_Body_ObjectPart `protobuf_oneof:"object_part"` -} - -func (x *GetResponse_Body) Reset() { - *x = GetResponse_Body{} - if protoimpl.UnsafeEnabled { - mi := &file_object_grpc_service_proto_msgTypes[21] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GetResponse_Body) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetResponse_Body) ProtoMessage() {} - -func (x *GetResponse_Body) ProtoReflect() protoreflect.Message { - mi := &file_object_grpc_service_proto_msgTypes[21] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GetResponse_Body.ProtoReflect.Descriptor instead. -func (*GetResponse_Body) Descriptor() ([]byte, []int) { - return file_object_grpc_service_proto_rawDescGZIP(), []int{1, 0} -} - -func (m *GetResponse_Body) GetObjectPart() isGetResponse_Body_ObjectPart { - if m != nil { - return m.ObjectPart - } - return nil -} - -func (x *GetResponse_Body) GetInit() *GetResponse_Body_Init { - if x, ok := x.GetObjectPart().(*GetResponse_Body_Init_); ok { - return x.Init - } - return nil -} - -func (x *GetResponse_Body) GetChunk() []byte { - if x, ok := x.GetObjectPart().(*GetResponse_Body_Chunk); ok { - return x.Chunk - } - return nil -} - -func (x *GetResponse_Body) GetSplitInfo() *SplitInfo { - if x, ok := x.GetObjectPart().(*GetResponse_Body_SplitInfo); ok { - return x.SplitInfo - } - return nil -} - -func (x *GetResponse_Body) GetEcInfo() *ECInfo { - if x, ok := x.GetObjectPart().(*GetResponse_Body_EcInfo); ok { - return x.EcInfo - } - return nil -} - -type isGetResponse_Body_ObjectPart interface { - isGetResponse_Body_ObjectPart() -} - -type GetResponse_Body_Init_ struct { - // Initial part of the object stream - Init *GetResponse_Body_Init `protobuf:"bytes,1,opt,name=init,proto3,oneof"` -} - -type GetResponse_Body_Chunk struct { - // Chunked object payload - Chunk []byte `protobuf:"bytes,2,opt,name=chunk,proto3,oneof"` -} - -type GetResponse_Body_SplitInfo struct { - // Meta information of split hierarchy for object assembly. - SplitInfo *SplitInfo `protobuf:"bytes,3,opt,name=split_info,json=splitInfo,proto3,oneof"` -} - -type GetResponse_Body_EcInfo struct { - // Meta information for EC object assembly. - EcInfo *ECInfo `protobuf:"bytes,4,opt,name=ec_info,json=ecInfo,proto3,oneof"` -} - -func (*GetResponse_Body_Init_) isGetResponse_Body_ObjectPart() {} - -func (*GetResponse_Body_Chunk) isGetResponse_Body_ObjectPart() {} - -func (*GetResponse_Body_SplitInfo) isGetResponse_Body_ObjectPart() {} - -func (*GetResponse_Body_EcInfo) isGetResponse_Body_ObjectPart() {} - -// Initial part of the `Object` structure stream. Technically it's a -// set of all `Object` structure's fields except `payload`. -type GetResponse_Body_Init struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Object's unique identifier. - ObjectId *grpc1.ObjectID `protobuf:"bytes,1,opt,name=object_id,json=objectId,proto3" json:"object_id,omitempty"` - // Signed `ObjectID` - Signature *grpc1.Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` - // Object metadata headers - Header *Header `protobuf:"bytes,3,opt,name=header,proto3" json:"header,omitempty"` -} - -func (x *GetResponse_Body_Init) Reset() { - *x = GetResponse_Body_Init{} - if protoimpl.UnsafeEnabled { - mi := &file_object_grpc_service_proto_msgTypes[22] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GetResponse_Body_Init) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetResponse_Body_Init) ProtoMessage() {} - -func (x *GetResponse_Body_Init) ProtoReflect() protoreflect.Message { - mi := &file_object_grpc_service_proto_msgTypes[22] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GetResponse_Body_Init.ProtoReflect.Descriptor instead. -func (*GetResponse_Body_Init) Descriptor() ([]byte, []int) { - return file_object_grpc_service_proto_rawDescGZIP(), []int{1, 0, 0} -} - -func (x *GetResponse_Body_Init) GetObjectId() *grpc1.ObjectID { - if x != nil { - return x.ObjectId - } - return nil -} - -func (x *GetResponse_Body_Init) GetSignature() *grpc1.Signature { - if x != nil { - return x.Signature - } - return nil -} - -func (x *GetResponse_Body_Init) GetHeader() *Header { - if x != nil { - return x.Header - } - return nil -} - -// PUT request body -type PutRequest_Body struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Single message in the request stream. - // - // Types that are assignable to ObjectPart: - // - // *PutRequest_Body_Init_ - // *PutRequest_Body_Chunk - ObjectPart isPutRequest_Body_ObjectPart `protobuf_oneof:"object_part"` -} - -func (x *PutRequest_Body) Reset() { - *x = PutRequest_Body{} - if protoimpl.UnsafeEnabled { - mi := &file_object_grpc_service_proto_msgTypes[23] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PutRequest_Body) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PutRequest_Body) ProtoMessage() {} - -func (x *PutRequest_Body) ProtoReflect() protoreflect.Message { - mi := &file_object_grpc_service_proto_msgTypes[23] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PutRequest_Body.ProtoReflect.Descriptor instead. -func (*PutRequest_Body) Descriptor() ([]byte, []int) { - return file_object_grpc_service_proto_rawDescGZIP(), []int{2, 0} -} - -func (m *PutRequest_Body) GetObjectPart() isPutRequest_Body_ObjectPart { - if m != nil { - return m.ObjectPart - } - return nil -} - -func (x *PutRequest_Body) GetInit() *PutRequest_Body_Init { - if x, ok := x.GetObjectPart().(*PutRequest_Body_Init_); ok { - return x.Init - } - return nil -} - -func (x *PutRequest_Body) GetChunk() []byte { - if x, ok := x.GetObjectPart().(*PutRequest_Body_Chunk); ok { - return x.Chunk - } - return nil -} - -type isPutRequest_Body_ObjectPart interface { - isPutRequest_Body_ObjectPart() -} - -type PutRequest_Body_Init_ struct { - // Initial part of the object stream - Init *PutRequest_Body_Init `protobuf:"bytes,1,opt,name=init,proto3,oneof"` -} - -type PutRequest_Body_Chunk struct { - // Chunked object payload - Chunk []byte `protobuf:"bytes,2,opt,name=chunk,proto3,oneof"` -} - -func (*PutRequest_Body_Init_) isPutRequest_Body_ObjectPart() {} - -func (*PutRequest_Body_Chunk) isPutRequest_Body_ObjectPart() {} - -// Newly created object structure parameters. If some optional parameters -// are not set, they will be calculated by a peer node. -type PutRequest_Body_Init struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // ObjectID if available. - ObjectId *grpc1.ObjectID `protobuf:"bytes,1,opt,name=object_id,json=objectId,proto3" json:"object_id,omitempty"` - // Object signature if available - Signature *grpc1.Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` - // Object's Header - Header *Header `protobuf:"bytes,3,opt,name=header,proto3" json:"header,omitempty"` - // Number of copies of the object to store within the RPC call. By - // default, object is processed according to the container's placement - // policy. Can be one of: - // 1. A single number; applied to the whole request and is treated as - // a minimal number of nodes that must store an object to complete the - // request successfully. - // 2. An ordered array; every number is treated as a minimal number of - // nodes in a corresponding placement vector that must store an object - // to complete the request successfully. The length MUST equal the - // placement vectors number, otherwise request is considered malformed. - CopiesNumber []uint32 `protobuf:"varint,4,rep,packed,name=copies_number,json=copiesNumber,proto3" json:"copies_number,omitempty"` -} - -func (x *PutRequest_Body_Init) Reset() { - *x = PutRequest_Body_Init{} - if protoimpl.UnsafeEnabled { - mi := &file_object_grpc_service_proto_msgTypes[24] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PutRequest_Body_Init) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PutRequest_Body_Init) ProtoMessage() {} - -func (x *PutRequest_Body_Init) ProtoReflect() protoreflect.Message { - mi := &file_object_grpc_service_proto_msgTypes[24] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PutRequest_Body_Init.ProtoReflect.Descriptor instead. -func (*PutRequest_Body_Init) Descriptor() ([]byte, []int) { - return file_object_grpc_service_proto_rawDescGZIP(), []int{2, 0, 0} -} - -func (x *PutRequest_Body_Init) GetObjectId() *grpc1.ObjectID { - if x != nil { - return x.ObjectId - } - return nil -} - -func (x *PutRequest_Body_Init) GetSignature() *grpc1.Signature { - if x != nil { - return x.Signature - } - return nil -} - -func (x *PutRequest_Body_Init) GetHeader() *Header { - if x != nil { - return x.Header - } - return nil -} - -func (x *PutRequest_Body_Init) GetCopiesNumber() []uint32 { - if x != nil { - return x.CopiesNumber - } - return nil -} - -// PUT Object response body -type PutResponse_Body struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Identifier of the saved object - ObjectId *grpc1.ObjectID `protobuf:"bytes,1,opt,name=object_id,json=objectId,proto3" json:"object_id,omitempty"` -} - -func (x *PutResponse_Body) Reset() { - *x = PutResponse_Body{} - if protoimpl.UnsafeEnabled { - mi := &file_object_grpc_service_proto_msgTypes[25] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PutResponse_Body) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PutResponse_Body) ProtoMessage() {} - -func (x *PutResponse_Body) ProtoReflect() protoreflect.Message { - mi := &file_object_grpc_service_proto_msgTypes[25] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PutResponse_Body.ProtoReflect.Descriptor instead. -func (*PutResponse_Body) Descriptor() ([]byte, []int) { - return file_object_grpc_service_proto_rawDescGZIP(), []int{3, 0} -} - -func (x *PutResponse_Body) GetObjectId() *grpc1.ObjectID { - if x != nil { - return x.ObjectId - } - return nil -} - -// Object DELETE request body -type DeleteRequest_Body struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Address of the object to be deleted - Address *grpc1.Address `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` -} - -func (x *DeleteRequest_Body) Reset() { - *x = DeleteRequest_Body{} - if protoimpl.UnsafeEnabled { - mi := &file_object_grpc_service_proto_msgTypes[26] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *DeleteRequest_Body) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DeleteRequest_Body) ProtoMessage() {} - -func (x *DeleteRequest_Body) ProtoReflect() protoreflect.Message { - mi := &file_object_grpc_service_proto_msgTypes[26] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use DeleteRequest_Body.ProtoReflect.Descriptor instead. -func (*DeleteRequest_Body) Descriptor() ([]byte, []int) { - return file_object_grpc_service_proto_rawDescGZIP(), []int{4, 0} -} - -func (x *DeleteRequest_Body) GetAddress() *grpc1.Address { - if x != nil { - return x.Address - } - return nil -} - -// Object DELETE Response has an empty body. -type DeleteResponse_Body struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Address of the tombstone created for the deleted object - Tombstone *grpc1.Address `protobuf:"bytes,1,opt,name=tombstone,proto3" json:"tombstone,omitempty"` -} - -func (x *DeleteResponse_Body) Reset() { - *x = DeleteResponse_Body{} - if protoimpl.UnsafeEnabled { - mi := &file_object_grpc_service_proto_msgTypes[27] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *DeleteResponse_Body) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DeleteResponse_Body) ProtoMessage() {} - -func (x *DeleteResponse_Body) ProtoReflect() protoreflect.Message { - mi := &file_object_grpc_service_proto_msgTypes[27] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use DeleteResponse_Body.ProtoReflect.Descriptor instead. -func (*DeleteResponse_Body) Descriptor() ([]byte, []int) { - return file_object_grpc_service_proto_rawDescGZIP(), []int{5, 0} -} - -func (x *DeleteResponse_Body) GetTombstone() *grpc1.Address { - if x != nil { - return x.Tombstone - } - return nil -} - -// Object HEAD request body -type HeadRequest_Body struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Address of the object with the requested Header - Address *grpc1.Address `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` - // Return only minimal header subset - MainOnly bool `protobuf:"varint,2,opt,name=main_only,json=mainOnly,proto3" json:"main_only,omitempty"` - // If `raw` flag is set, request will work only with objects that are - // physically stored on the peer node - Raw bool `protobuf:"varint,3,opt,name=raw,proto3" json:"raw,omitempty"` -} - -func (x *HeadRequest_Body) Reset() { - *x = HeadRequest_Body{} - if protoimpl.UnsafeEnabled { - mi := &file_object_grpc_service_proto_msgTypes[28] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *HeadRequest_Body) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*HeadRequest_Body) ProtoMessage() {} - -func (x *HeadRequest_Body) ProtoReflect() protoreflect.Message { - mi := &file_object_grpc_service_proto_msgTypes[28] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use HeadRequest_Body.ProtoReflect.Descriptor instead. -func (*HeadRequest_Body) Descriptor() ([]byte, []int) { - return file_object_grpc_service_proto_rawDescGZIP(), []int{6, 0} -} - -func (x *HeadRequest_Body) GetAddress() *grpc1.Address { - if x != nil { - return x.Address - } - return nil -} - -func (x *HeadRequest_Body) GetMainOnly() bool { - if x != nil { - return x.MainOnly - } - return false -} - -func (x *HeadRequest_Body) GetRaw() bool { - if x != nil { - return x.Raw - } - return false -} - -// Object HEAD response body -type HeadResponse_Body struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Requested object header, it's part or meta information about split - // object. - // - // Types that are assignable to Head: - // - // *HeadResponse_Body_Header - // *HeadResponse_Body_ShortHeader - // *HeadResponse_Body_SplitInfo - // *HeadResponse_Body_EcInfo - Head isHeadResponse_Body_Head `protobuf_oneof:"head"` -} - -func (x *HeadResponse_Body) Reset() { - *x = HeadResponse_Body{} - if protoimpl.UnsafeEnabled { - mi := &file_object_grpc_service_proto_msgTypes[29] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *HeadResponse_Body) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*HeadResponse_Body) ProtoMessage() {} - -func (x *HeadResponse_Body) ProtoReflect() protoreflect.Message { - mi := &file_object_grpc_service_proto_msgTypes[29] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use HeadResponse_Body.ProtoReflect.Descriptor instead. -func (*HeadResponse_Body) Descriptor() ([]byte, []int) { - return file_object_grpc_service_proto_rawDescGZIP(), []int{8, 0} -} - -func (m *HeadResponse_Body) GetHead() isHeadResponse_Body_Head { - if m != nil { - return m.Head - } - return nil -} - -func (x *HeadResponse_Body) GetHeader() *HeaderWithSignature { - if x, ok := x.GetHead().(*HeadResponse_Body_Header); ok { - return x.Header - } - return nil -} - -func (x *HeadResponse_Body) GetShortHeader() *ShortHeader { - if x, ok := x.GetHead().(*HeadResponse_Body_ShortHeader); ok { - return x.ShortHeader - } - return nil -} - -func (x *HeadResponse_Body) GetSplitInfo() *SplitInfo { - if x, ok := x.GetHead().(*HeadResponse_Body_SplitInfo); ok { - return x.SplitInfo - } - return nil -} - -func (x *HeadResponse_Body) GetEcInfo() *ECInfo { - if x, ok := x.GetHead().(*HeadResponse_Body_EcInfo); ok { - return x.EcInfo - } - return nil -} - -type isHeadResponse_Body_Head interface { - isHeadResponse_Body_Head() -} - -type HeadResponse_Body_Header struct { - // Full object's `Header` with `ObjectID` signature - Header *HeaderWithSignature `protobuf:"bytes,1,opt,name=header,proto3,oneof"` -} - -type HeadResponse_Body_ShortHeader struct { - // Short object header - ShortHeader *ShortHeader `protobuf:"bytes,2,opt,name=short_header,json=shortHeader,proto3,oneof"` -} - -type HeadResponse_Body_SplitInfo struct { - // Meta information of split hierarchy. - SplitInfo *SplitInfo `protobuf:"bytes,3,opt,name=split_info,json=splitInfo,proto3,oneof"` -} - -type HeadResponse_Body_EcInfo struct { - // Meta information for EC object assembly. - EcInfo *ECInfo `protobuf:"bytes,4,opt,name=ec_info,json=ecInfo,proto3,oneof"` -} - -func (*HeadResponse_Body_Header) isHeadResponse_Body_Head() {} - -func (*HeadResponse_Body_ShortHeader) isHeadResponse_Body_Head() {} - -func (*HeadResponse_Body_SplitInfo) isHeadResponse_Body_Head() {} - -func (*HeadResponse_Body_EcInfo) isHeadResponse_Body_Head() {} - -// Object Search request body -type SearchRequest_Body struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Container identifier were to search - ContainerId *grpc1.ContainerID `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` - // Version of the Query Language used - Version uint32 `protobuf:"varint,2,opt,name=version,proto3" json:"version,omitempty"` - // List of search expressions - Filters []*SearchRequest_Body_Filter `protobuf:"bytes,3,rep,name=filters,proto3" json:"filters,omitempty"` -} - -func (x *SearchRequest_Body) Reset() { - *x = SearchRequest_Body{} - if protoimpl.UnsafeEnabled { - mi := &file_object_grpc_service_proto_msgTypes[30] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SearchRequest_Body) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SearchRequest_Body) ProtoMessage() {} - -func (x *SearchRequest_Body) ProtoReflect() protoreflect.Message { - mi := &file_object_grpc_service_proto_msgTypes[30] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SearchRequest_Body.ProtoReflect.Descriptor instead. -func (*SearchRequest_Body) Descriptor() ([]byte, []int) { - return file_object_grpc_service_proto_rawDescGZIP(), []int{9, 0} -} - -func (x *SearchRequest_Body) GetContainerId() *grpc1.ContainerID { - if x != nil { - return x.ContainerId - } - return nil -} - -func (x *SearchRequest_Body) GetVersion() uint32 { - if x != nil { - return x.Version - } - return 0 -} - -func (x *SearchRequest_Body) GetFilters() []*SearchRequest_Body_Filter { - if x != nil { - return x.Filters - } - return nil -} - -// Filter structure checks if the object header field or the attribute -// content matches a value. -// -// If no filters are set, search request will return all objects of the -// container, including Regular object and Tombstone -// objects. Most human users expect to get only object they can directly -// work with. In that case, `$Object:ROOT` filter should be used. -// -// By default `key` field refers to the corresponding object's `Attribute`. -// Some Object's header fields can also be accessed by adding `$Object:` -// prefix to the name. Here is the list of fields available via this prefix: -// -// - $Object:version \ -// version -// - $Object:objectID \ -// object_id -// - $Object:containerID \ -// container_id -// - $Object:ownerID \ -// owner_id -// - $Object:creationEpoch \ -// creation_epoch -// - $Object:payloadLength \ -// payload_length -// - $Object:payloadHash \ -// payload_hash -// - $Object:objectType \ -// object_type -// - $Object:homomorphicHash \ -// homomorphic_hash -// - $Object:split.parent \ -// object_id of parent -// - $Object:split.splitID \ -// 16 byte UUIDv4 used to identify the split object hierarchy parts -// - $Object:ec.parent \ -// If the object is stored according to EC policy, then ec_parent -// attribute is set to return an id list of all related EC chunks. -// -// There are some well-known filter aliases to match objects by certain -// properties: -// -// - $Object:ROOT \ -// Returns only `REGULAR` type objects that are not split or that are the -// top level root objects in a split hierarchy. This includes objects not -// present physically, like large objects split into smaller objects -// without a separate top-level root object. Objects of other types like -// Locks and Tombstones will not be shown. This filter may be -// useful for listing objects like `ls` command of some virtual file -// system. This filter is activated if the `key` exists, disregarding the -// value and matcher type. -// - $Object:PHY \ -// Returns only objects physically stored in the system. This filter is -// activated if the `key` exists, disregarding the value and matcher type. -// -// Note: using filters with a key with prefix `$Object:` and match type -// `NOT_PRESENT `is not recommended since this is not a cross-version -// approach. Behavior when processing this kind of filters is undefined. -type SearchRequest_Body_Filter struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Match type to use - MatchType MatchType `protobuf:"varint,1,opt,name=match_type,json=matchType,proto3,enum=neo.fs.v2.object.MatchType" json:"match_type,omitempty"` - // Attribute or Header fields to match - Key string `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` - // Value to match - Value string `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"` -} - -func (x *SearchRequest_Body_Filter) Reset() { - *x = SearchRequest_Body_Filter{} - if protoimpl.UnsafeEnabled { - mi := &file_object_grpc_service_proto_msgTypes[31] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SearchRequest_Body_Filter) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SearchRequest_Body_Filter) ProtoMessage() {} - -func (x *SearchRequest_Body_Filter) ProtoReflect() protoreflect.Message { - mi := &file_object_grpc_service_proto_msgTypes[31] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SearchRequest_Body_Filter.ProtoReflect.Descriptor instead. -func (*SearchRequest_Body_Filter) Descriptor() ([]byte, []int) { - return file_object_grpc_service_proto_rawDescGZIP(), []int{9, 0, 0} -} - -func (x *SearchRequest_Body_Filter) GetMatchType() MatchType { - if x != nil { - return x.MatchType - } - return MatchType_MATCH_TYPE_UNSPECIFIED -} - -func (x *SearchRequest_Body_Filter) GetKey() string { - if x != nil { - return x.Key - } - return "" -} - -func (x *SearchRequest_Body_Filter) GetValue() string { - if x != nil { - return x.Value - } - return "" -} - -// Object Search response body -type SearchResponse_Body struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // List of `ObjectID`s that match the search query - IdList []*grpc1.ObjectID `protobuf:"bytes,1,rep,name=id_list,json=idList,proto3" json:"id_list,omitempty"` -} - -func (x *SearchResponse_Body) Reset() { - *x = SearchResponse_Body{} - if protoimpl.UnsafeEnabled { - mi := &file_object_grpc_service_proto_msgTypes[32] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SearchResponse_Body) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SearchResponse_Body) ProtoMessage() {} - -func (x *SearchResponse_Body) ProtoReflect() protoreflect.Message { - mi := &file_object_grpc_service_proto_msgTypes[32] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SearchResponse_Body.ProtoReflect.Descriptor instead. -func (*SearchResponse_Body) Descriptor() ([]byte, []int) { - return file_object_grpc_service_proto_rawDescGZIP(), []int{10, 0} -} - -func (x *SearchResponse_Body) GetIdList() []*grpc1.ObjectID { - if x != nil { - return x.IdList - } - return nil -} - -// Byte range of object's payload request body -type GetRangeRequest_Body struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Address of the object containing the requested payload range - Address *grpc1.Address `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` - // Requested payload range - Range *Range `protobuf:"bytes,2,opt,name=range,proto3" json:"range,omitempty"` - // If `raw` flag is set, request will work only with objects that are - // physically stored on the peer node. - Raw bool `protobuf:"varint,3,opt,name=raw,proto3" json:"raw,omitempty"` -} - -func (x *GetRangeRequest_Body) Reset() { - *x = GetRangeRequest_Body{} - if protoimpl.UnsafeEnabled { - mi := &file_object_grpc_service_proto_msgTypes[33] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GetRangeRequest_Body) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetRangeRequest_Body) ProtoMessage() {} - -func (x *GetRangeRequest_Body) ProtoReflect() protoreflect.Message { - mi := &file_object_grpc_service_proto_msgTypes[33] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GetRangeRequest_Body.ProtoReflect.Descriptor instead. -func (*GetRangeRequest_Body) Descriptor() ([]byte, []int) { - return file_object_grpc_service_proto_rawDescGZIP(), []int{12, 0} -} - -func (x *GetRangeRequest_Body) GetAddress() *grpc1.Address { - if x != nil { - return x.Address - } - return nil -} - -func (x *GetRangeRequest_Body) GetRange() *Range { - if x != nil { - return x.Range - } - return nil -} - -func (x *GetRangeRequest_Body) GetRaw() bool { - if x != nil { - return x.Raw - } - return false -} - -// Get Range response body uses streams to transfer the response. Because -// object payload considered a byte sequence, there is no need to have some -// initial preamble message. The requested byte range is sent as a series -// chunks. -type GetRangeResponse_Body struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Requested object range or meta information about split object. - // - // Types that are assignable to RangePart: - // - // *GetRangeResponse_Body_Chunk - // *GetRangeResponse_Body_SplitInfo - // *GetRangeResponse_Body_EcInfo - RangePart isGetRangeResponse_Body_RangePart `protobuf_oneof:"range_part"` -} - -func (x *GetRangeResponse_Body) Reset() { - *x = GetRangeResponse_Body{} - if protoimpl.UnsafeEnabled { - mi := &file_object_grpc_service_proto_msgTypes[34] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GetRangeResponse_Body) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetRangeResponse_Body) ProtoMessage() {} - -func (x *GetRangeResponse_Body) ProtoReflect() protoreflect.Message { - mi := &file_object_grpc_service_proto_msgTypes[34] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GetRangeResponse_Body.ProtoReflect.Descriptor instead. -func (*GetRangeResponse_Body) Descriptor() ([]byte, []int) { - return file_object_grpc_service_proto_rawDescGZIP(), []int{13, 0} -} - -func (m *GetRangeResponse_Body) GetRangePart() isGetRangeResponse_Body_RangePart { - if m != nil { - return m.RangePart - } - return nil -} - -func (x *GetRangeResponse_Body) GetChunk() []byte { - if x, ok := x.GetRangePart().(*GetRangeResponse_Body_Chunk); ok { - return x.Chunk - } - return nil -} - -func (x *GetRangeResponse_Body) GetSplitInfo() *SplitInfo { - if x, ok := x.GetRangePart().(*GetRangeResponse_Body_SplitInfo); ok { - return x.SplitInfo - } - return nil -} - -func (x *GetRangeResponse_Body) GetEcInfo() *ECInfo { - if x, ok := x.GetRangePart().(*GetRangeResponse_Body_EcInfo); ok { - return x.EcInfo - } - return nil -} - -type isGetRangeResponse_Body_RangePart interface { - isGetRangeResponse_Body_RangePart() -} - -type GetRangeResponse_Body_Chunk struct { - // Chunked object payload's range. - Chunk []byte `protobuf:"bytes,1,opt,name=chunk,proto3,oneof"` -} - -type GetRangeResponse_Body_SplitInfo struct { - // Meta information of split hierarchy. - SplitInfo *SplitInfo `protobuf:"bytes,2,opt,name=split_info,json=splitInfo,proto3,oneof"` -} - -type GetRangeResponse_Body_EcInfo struct { - // Meta information for EC object assembly. - EcInfo *ECInfo `protobuf:"bytes,3,opt,name=ec_info,json=ecInfo,proto3,oneof"` -} - -func (*GetRangeResponse_Body_Chunk) isGetRangeResponse_Body_RangePart() {} - -func (*GetRangeResponse_Body_SplitInfo) isGetRangeResponse_Body_RangePart() {} - -func (*GetRangeResponse_Body_EcInfo) isGetRangeResponse_Body_RangePart() {} - -// Get hash of object's payload part request body. -type GetRangeHashRequest_Body struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Address of the object that containing the requested payload range - Address *grpc1.Address `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` - // List of object's payload ranges to calculate homomorphic hash - Ranges []*Range `protobuf:"bytes,2,rep,name=ranges,proto3" json:"ranges,omitempty"` - // Binary salt to XOR object's payload ranges before hash calculation - Salt []byte `protobuf:"bytes,3,opt,name=salt,proto3" json:"salt,omitempty"` - // Checksum algorithm type - Type grpc1.ChecksumType `protobuf:"varint,4,opt,name=type,proto3,enum=neo.fs.v2.refs.ChecksumType" json:"type,omitempty"` -} - -func (x *GetRangeHashRequest_Body) Reset() { - *x = GetRangeHashRequest_Body{} - if protoimpl.UnsafeEnabled { - mi := &file_object_grpc_service_proto_msgTypes[35] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GetRangeHashRequest_Body) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetRangeHashRequest_Body) ProtoMessage() {} - -func (x *GetRangeHashRequest_Body) ProtoReflect() protoreflect.Message { - mi := &file_object_grpc_service_proto_msgTypes[35] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GetRangeHashRequest_Body.ProtoReflect.Descriptor instead. -func (*GetRangeHashRequest_Body) Descriptor() ([]byte, []int) { - return file_object_grpc_service_proto_rawDescGZIP(), []int{14, 0} -} - -func (x *GetRangeHashRequest_Body) GetAddress() *grpc1.Address { - if x != nil { - return x.Address - } - return nil -} - -func (x *GetRangeHashRequest_Body) GetRanges() []*Range { - if x != nil { - return x.Ranges - } - return nil -} - -func (x *GetRangeHashRequest_Body) GetSalt() []byte { - if x != nil { - return x.Salt - } - return nil -} - -func (x *GetRangeHashRequest_Body) GetType() grpc1.ChecksumType { - if x != nil { - return x.Type - } - return grpc1.ChecksumType(0) -} - -// Get hash of object's payload part response body. -type GetRangeHashResponse_Body struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Checksum algorithm type - Type grpc1.ChecksumType `protobuf:"varint,1,opt,name=type,proto3,enum=neo.fs.v2.refs.ChecksumType" json:"type,omitempty"` - // List of range hashes in a binary format - HashList [][]byte `protobuf:"bytes,2,rep,name=hash_list,json=hashList,proto3" json:"hash_list,omitempty"` -} - -func (x *GetRangeHashResponse_Body) Reset() { - *x = GetRangeHashResponse_Body{} - if protoimpl.UnsafeEnabled { - mi := &file_object_grpc_service_proto_msgTypes[36] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GetRangeHashResponse_Body) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetRangeHashResponse_Body) ProtoMessage() {} - -func (x *GetRangeHashResponse_Body) ProtoReflect() protoreflect.Message { - mi := &file_object_grpc_service_proto_msgTypes[36] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GetRangeHashResponse_Body.ProtoReflect.Descriptor instead. -func (*GetRangeHashResponse_Body) Descriptor() ([]byte, []int) { - return file_object_grpc_service_proto_rawDescGZIP(), []int{15, 0} -} - -func (x *GetRangeHashResponse_Body) GetType() grpc1.ChecksumType { - if x != nil { - return x.Type - } - return grpc1.ChecksumType(0) -} - -func (x *GetRangeHashResponse_Body) GetHashList() [][]byte { - if x != nil { - return x.HashList - } - return nil -} - -// PUT Single request body -type PutSingleRequest_Body struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Prepared object with payload. - Object *Object `protobuf:"bytes,1,opt,name=object,proto3" json:"object,omitempty"` - // Number of copies of the object to store within the RPC call. By default, - // object is processed according to the container's placement policy. - // Every number is treated as a minimal number of - // nodes in a corresponding placement vector that must store an object - // to complete the request successfully. The length MUST equal the placement - // vectors number, otherwise request is considered malformed. - CopiesNumber []uint32 `protobuf:"varint,2,rep,packed,name=copies_number,json=copiesNumber,proto3" json:"copies_number,omitempty"` -} - -func (x *PutSingleRequest_Body) Reset() { - *x = PutSingleRequest_Body{} - if protoimpl.UnsafeEnabled { - mi := &file_object_grpc_service_proto_msgTypes[37] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PutSingleRequest_Body) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PutSingleRequest_Body) ProtoMessage() {} - -func (x *PutSingleRequest_Body) ProtoReflect() protoreflect.Message { - mi := &file_object_grpc_service_proto_msgTypes[37] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PutSingleRequest_Body.ProtoReflect.Descriptor instead. -func (*PutSingleRequest_Body) Descriptor() ([]byte, []int) { - return file_object_grpc_service_proto_rawDescGZIP(), []int{16, 0} -} - -func (x *PutSingleRequest_Body) GetObject() *Object { - if x != nil { - return x.Object - } - return nil -} - -func (x *PutSingleRequest_Body) GetCopiesNumber() []uint32 { - if x != nil { - return x.CopiesNumber - } - return nil -} - -// PUT Single Object response body -type PutSingleResponse_Body struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *PutSingleResponse_Body) Reset() { - *x = PutSingleResponse_Body{} - if protoimpl.UnsafeEnabled { - mi := &file_object_grpc_service_proto_msgTypes[38] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PutSingleResponse_Body) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PutSingleResponse_Body) ProtoMessage() {} - -func (x *PutSingleResponse_Body) ProtoReflect() protoreflect.Message { - mi := &file_object_grpc_service_proto_msgTypes[38] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PutSingleResponse_Body.ProtoReflect.Descriptor instead. -func (*PutSingleResponse_Body) Descriptor() ([]byte, []int) { - return file_object_grpc_service_proto_rawDescGZIP(), []int{17, 0} -} - -// PATCH request body -type PatchRequest_Body struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The address of the object that is requested to get patched. - Address *grpc1.Address `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` - // New attributes for the object. See `replace_attributes` flag usage to define how - // new attributes should be set. - NewAttributes []*Header_Attribute `protobuf:"bytes,2,rep,name=new_attributes,json=newAttributes,proto3" json:"new_attributes,omitempty"` - // If this flag is set, then the object's attributes will be entirely replaced by `new_attributes` list. - // The empty `new_attributes` list with `replace_attributes = true` just resets attributes list for the object. - // - // Default `false` value for this flag means the attributes will be just merged. If the incoming `new_attributes` - // list contains already existing key, then it just replaces it while merging the lists. - ReplaceAttributes bool `protobuf:"varint,3,opt,name=replace_attributes,json=replaceAttributes,proto3" json:"replace_attributes,omitempty"` - // The patch that is applied for the object. - Patch *PatchRequest_Body_Patch `protobuf:"bytes,4,opt,name=patch,proto3" json:"patch,omitempty"` -} - -func (x *PatchRequest_Body) Reset() { - *x = PatchRequest_Body{} - if protoimpl.UnsafeEnabled { - mi := &file_object_grpc_service_proto_msgTypes[39] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PatchRequest_Body) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PatchRequest_Body) ProtoMessage() {} - -func (x *PatchRequest_Body) ProtoReflect() protoreflect.Message { - mi := &file_object_grpc_service_proto_msgTypes[39] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PatchRequest_Body.ProtoReflect.Descriptor instead. -func (*PatchRequest_Body) Descriptor() ([]byte, []int) { - return file_object_grpc_service_proto_rawDescGZIP(), []int{18, 0} -} - -func (x *PatchRequest_Body) GetAddress() *grpc1.Address { - if x != nil { - return x.Address - } - return nil -} - -func (x *PatchRequest_Body) GetNewAttributes() []*Header_Attribute { - if x != nil { - return x.NewAttributes - } - return nil -} - -func (x *PatchRequest_Body) GetReplaceAttributes() bool { - if x != nil { - return x.ReplaceAttributes - } - return false -} - -func (x *PatchRequest_Body) GetPatch() *PatchRequest_Body_Patch { - if x != nil { - return x.Patch - } - return nil -} - -// The patch for the object's payload. -type PatchRequest_Body_Patch struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The range of the source object for which the payload is replaced by the patch's chunk. - // If the range's `length = 0`, then the patch's chunk is just appended to the original payload - // starting from the `offest` without any replace. - SourceRange *Range `protobuf:"bytes,1,opt,name=source_range,json=sourceRange,proto3" json:"source_range,omitempty"` - // The chunk that is being appended to or that replaces the original payload on the given range. - Chunk []byte `protobuf:"bytes,2,opt,name=chunk,proto3" json:"chunk,omitempty"` -} - -func (x *PatchRequest_Body_Patch) Reset() { - *x = PatchRequest_Body_Patch{} - if protoimpl.UnsafeEnabled { - mi := &file_object_grpc_service_proto_msgTypes[40] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PatchRequest_Body_Patch) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PatchRequest_Body_Patch) ProtoMessage() {} - -func (x *PatchRequest_Body_Patch) ProtoReflect() protoreflect.Message { - mi := &file_object_grpc_service_proto_msgTypes[40] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PatchRequest_Body_Patch.ProtoReflect.Descriptor instead. -func (*PatchRequest_Body_Patch) Descriptor() ([]byte, []int) { - return file_object_grpc_service_proto_rawDescGZIP(), []int{18, 0, 0} -} - -func (x *PatchRequest_Body_Patch) GetSourceRange() *Range { - if x != nil { - return x.SourceRange - } - return nil -} - -func (x *PatchRequest_Body_Patch) GetChunk() []byte { - if x != nil { - return x.Chunk - } - return nil -} - -// PATCH response body -type PatchResponse_Body struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The object ID of the saved patched object. - ObjectId *grpc1.ObjectID `protobuf:"bytes,1,opt,name=object_id,json=objectId,proto3" json:"object_id,omitempty"` -} - -func (x *PatchResponse_Body) Reset() { - *x = PatchResponse_Body{} - if protoimpl.UnsafeEnabled { - mi := &file_object_grpc_service_proto_msgTypes[41] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PatchResponse_Body) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PatchResponse_Body) ProtoMessage() {} - -func (x *PatchResponse_Body) ProtoReflect() protoreflect.Message { - mi := &file_object_grpc_service_proto_msgTypes[41] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PatchResponse_Body.ProtoReflect.Descriptor instead. -func (*PatchResponse_Body) Descriptor() ([]byte, []int) { - return file_object_grpc_service_proto_rawDescGZIP(), []int{19, 0} -} - -func (x *PatchResponse_Body) GetObjectId() *grpc1.ObjectID { - if x != nil { - return x.ObjectId - } - return nil -} - -var File_object_grpc_service_proto protoreflect.FileDescriptor - -var file_object_grpc_service_proto_rawDesc = []byte{ - 0x0a, 0x19, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x73, 0x65, - 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x10, 0x6e, 0x65, 0x6f, - 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x1a, 0x17, 0x6f, - 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x15, 0x72, 0x65, 0x66, 0x73, 0x2f, 0x67, 0x72, 0x70, - 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x18, 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, 0xaa, 0x02, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x35, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, - 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 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, 0x4b, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, - 0x31, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x17, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, - 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, - 0x73, 0x73, 0x12, 0x10, 0x0a, 0x03, 0x72, 0x61, 0x77, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, - 0x03, 0x72, 0x61, 0x77, 0x22, 0xee, 0x04, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x36, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, - 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 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, 0x8a, 0x03, 0x0a, 0x04, 0x42, 0x6f, 0x64, - 0x79, 0x12, 0x3d, 0x0a, 0x04, 0x69, 0x6e, 0x69, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x27, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, - 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x42, - 0x6f, 0x64, 0x79, 0x2e, 0x49, 0x6e, 0x69, 0x74, 0x48, 0x00, 0x52, 0x04, 0x69, 0x6e, 0x69, 0x74, - 0x12, 0x16, 0x0a, 0x05, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x48, - 0x00, 0x52, 0x05, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x12, 0x3c, 0x0a, 0x0a, 0x73, 0x70, 0x6c, 0x69, - 0x74, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, - 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, - 0x53, 0x70, 0x6c, 0x69, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x48, 0x00, 0x52, 0x09, 0x73, 0x70, 0x6c, - 0x69, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x33, 0x0a, 0x07, 0x65, 0x63, 0x5f, 0x69, 0x6e, 0x66, - 0x6f, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, - 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x45, 0x43, 0x49, 0x6e, 0x66, - 0x6f, 0x48, 0x00, 0x52, 0x06, 0x65, 0x63, 0x49, 0x6e, 0x66, 0x6f, 0x1a, 0xa8, 0x01, 0x0a, 0x04, - 0x49, 0x6e, 0x69, 0x74, 0x12, 0x35, 0x0a, 0x09, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x69, - 0x64, 0x18, 0x01, 0x20, 0x01, 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, 0x08, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x64, 0x12, 0x37, 0x0a, 0x09, 0x73, - 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, - 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, - 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, - 0x74, 0x75, 0x72, 0x65, 0x12, 0x30, 0x0a, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, - 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x06, - 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x42, 0x0d, 0x0a, 0x0b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, - 0x5f, 0x70, 0x61, 0x72, 0x74, 0x22, 0x9b, 0x04, 0x0a, 0x0a, 0x50, 0x75, 0x74, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x12, 0x35, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, - 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x50, 0x75, 0x74, 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, 0xbb, 0x02, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x3c, - 0x0a, 0x04, 0x69, 0x6e, 0x69, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x6e, - 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, - 0x50, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x2e, - 0x49, 0x6e, 0x69, 0x74, 0x48, 0x00, 0x52, 0x04, 0x69, 0x6e, 0x69, 0x74, 0x12, 0x16, 0x0a, 0x05, - 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, 0x05, 0x63, - 0x68, 0x75, 0x6e, 0x6b, 0x1a, 0xcd, 0x01, 0x0a, 0x04, 0x49, 0x6e, 0x69, 0x74, 0x12, 0x35, 0x0a, - 0x09, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 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, 0x08, 0x6f, 0x62, 0x6a, 0x65, - 0x63, 0x74, 0x49, 0x64, 0x12, 0x37, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, - 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, - 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, - 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x30, 0x0a, - 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, - 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, - 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, - 0x23, 0x0a, 0x0d, 0x63, 0x6f, 0x70, 0x69, 0x65, 0x73, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, - 0x18, 0x04, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x0c, 0x63, 0x6f, 0x70, 0x69, 0x65, 0x73, 0x4e, 0x75, - 0x6d, 0x62, 0x65, 0x72, 0x42, 0x0d, 0x0a, 0x0b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x70, - 0x61, 0x72, 0x74, 0x22, 0xa0, 0x02, 0x0a, 0x0b, 0x50, 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x12, 0x36, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x22, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, - 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x50, 0x75, 0x74, 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, 0x3d, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, - 0x35, 0x0a, 0x09, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, - 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, 0x08, 0x6f, 0x62, - 0x6a, 0x65, 0x63, 0x74, 0x49, 0x64, 0x22, 0x9e, 0x02, 0x0a, 0x0d, 0x44, 0x65, 0x6c, 0x65, 0x74, - 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x38, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, - 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x44, 0x65, 0x6c, 0x65, 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, 0x39, 0x0a, 0x04, - 0x42, 0x6f, 0x64, 0x79, 0x12, 0x31, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, - 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x07, - 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0xa6, 0x02, 0x0a, 0x0e, 0x44, 0x65, 0x6c, 0x65, - 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 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, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x44, 0x65, 0x6c, 0x65, - 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, 0x3d, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x35, 0x0a, 0x09, 0x74, 0x6f, 0x6d, - 0x62, 0x73, 0x74, 0x6f, 0x6e, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6e, - 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x41, 0x64, - 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x09, 0x74, 0x6f, 0x6d, 0x62, 0x73, 0x74, 0x6f, 0x6e, 0x65, - 0x22, 0xc9, 0x02, 0x0a, 0x0b, 0x48, 0x65, 0x61, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x12, 0x36, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, - 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, - 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 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, 0x68, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x31, 0x0a, 0x07, 0x61, 0x64, - 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6e, 0x65, - 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x41, 0x64, 0x64, - 0x72, 0x65, 0x73, 0x73, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x1b, 0x0a, - 0x09, 0x6d, 0x61, 0x69, 0x6e, 0x5f, 0x6f, 0x6e, 0x6c, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, - 0x52, 0x08, 0x6d, 0x61, 0x69, 0x6e, 0x4f, 0x6e, 0x6c, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x72, 0x61, - 0x77, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x03, 0x72, 0x61, 0x77, 0x22, 0x80, 0x01, 0x0a, - 0x13, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x57, 0x69, 0x74, 0x68, 0x53, 0x69, 0x67, 0x6e, 0x61, - 0x74, 0x75, 0x72, 0x65, 0x12, 0x30, 0x0a, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, - 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x06, - 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x37, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, - 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, - 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, - 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x22, - 0xec, 0x03, 0x0a, 0x0c, 0x48, 0x65, 0x61, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x12, 0x37, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, - 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, - 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 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, 0x86, 0x02, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x3f, - 0x0a, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, - 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, - 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x57, 0x69, 0x74, 0x68, 0x53, 0x69, 0x67, 0x6e, - 0x61, 0x74, 0x75, 0x72, 0x65, 0x48, 0x00, 0x52, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, - 0x42, 0x0a, 0x0c, 0x73, 0x68, 0x6f, 0x72, 0x74, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, - 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x53, 0x68, 0x6f, 0x72, 0x74, 0x48, 0x65, - 0x61, 0x64, 0x65, 0x72, 0x48, 0x00, 0x52, 0x0b, 0x73, 0x68, 0x6f, 0x72, 0x74, 0x48, 0x65, 0x61, - 0x64, 0x65, 0x72, 0x12, 0x3c, 0x0a, 0x0a, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x5f, 0x69, 0x6e, 0x66, - 0x6f, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, - 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x53, 0x70, 0x6c, 0x69, 0x74, - 0x49, 0x6e, 0x66, 0x6f, 0x48, 0x00, 0x52, 0x09, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x49, 0x6e, 0x66, - 0x6f, 0x12, 0x33, 0x0a, 0x07, 0x65, 0x63, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x04, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, - 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x45, 0x43, 0x49, 0x6e, 0x66, 0x6f, 0x48, 0x00, 0x52, 0x06, - 0x65, 0x63, 0x49, 0x6e, 0x66, 0x6f, 0x42, 0x06, 0x0a, 0x04, 0x68, 0x65, 0x61, 0x64, 0x22, 0xfb, - 0x03, 0x0a, 0x0d, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x12, 0x38, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, - 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, - 0x74, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 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, 0x95, 0x02, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x3e, 0x0a, - 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, - 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, - 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x64, 0x12, 0x18, 0x0a, - 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, - 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x45, 0x0a, 0x07, 0x66, 0x69, 0x6c, 0x74, 0x65, - 0x72, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, - 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x53, 0x65, 0x61, 0x72, - 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x2e, 0x46, - 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x07, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x73, 0x1a, 0x6c, - 0x0a, 0x06, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x3a, 0x0a, 0x0a, 0x6d, 0x61, 0x74, 0x63, - 0x68, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1b, 0x2e, 0x6e, - 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, - 0x4d, 0x61, 0x74, 0x63, 0x68, 0x54, 0x79, 0x70, 0x65, 0x52, 0x09, 0x6d, 0x61, 0x74, 0x63, 0x68, - 0x54, 0x79, 0x70, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xa2, 0x02, 0x0a, - 0x0e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 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, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, - 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 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, 0x39, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x31, - 0x0a, 0x07, 0x69, 0x64, 0x5f, 0x6c, 0x69, 0x73, 0x74, 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, 0x06, 0x69, 0x64, 0x4c, 0x69, 0x73, - 0x74, 0x22, 0x37, 0x0a, 0x05, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x66, - 0x66, 0x73, 0x65, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, - 0x65, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x04, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xe3, 0x02, 0x0a, 0x0f, 0x47, - 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 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, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, - 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 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, 0x7a, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x31, 0x0a, 0x07, - 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, - 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x41, - 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, - 0x2d, 0x0a, 0x05, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, - 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, - 0x74, 0x2e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x05, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x10, - 0x0a, 0x03, 0x72, 0x61, 0x77, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x03, 0x72, 0x61, 0x77, - 0x22, 0x8d, 0x03, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3b, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, - 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 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, 0x9f, - 0x01, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x16, 0x0a, 0x05, 0x63, 0x68, 0x75, 0x6e, 0x6b, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, 0x05, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x12, - 0x3c, 0x0a, 0x0a, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, - 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x53, 0x70, 0x6c, 0x69, 0x74, 0x49, 0x6e, 0x66, 0x6f, - 0x48, 0x00, 0x52, 0x09, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x33, 0x0a, - 0x07, 0x65, 0x63, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, - 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, - 0x74, 0x2e, 0x45, 0x43, 0x49, 0x6e, 0x66, 0x6f, 0x48, 0x00, 0x52, 0x06, 0x65, 0x63, 0x49, 0x6e, - 0x66, 0x6f, 0x42, 0x0c, 0x0a, 0x0a, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x5f, 0x70, 0x61, 0x72, 0x74, - 0x22, 0xa2, 0x03, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x48, 0x61, 0x73, - 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 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, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, - 0x67, 0x65, 0x48, 0x61, 0x73, 0x68, 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, 0xb0, 0x01, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x31, 0x0a, 0x07, 0x61, - 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6e, - 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x41, 0x64, - 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x2f, - 0x0a, 0x06, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, - 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, - 0x74, 0x2e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x06, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x73, 0x12, - 0x12, 0x0a, 0x04, 0x73, 0x61, 0x6c, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x73, - 0x61, 0x6c, 0x74, 0x12, 0x30, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, - 0x0e, 0x32, 0x1c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, - 0x66, 0x73, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x52, - 0x04, 0x74, 0x79, 0x70, 0x65, 0x22, 0xca, 0x02, 0x0a, 0x14, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, - 0x67, 0x65, 0x48, 0x61, 0x73, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3f, - 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x6e, - 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, - 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x48, 0x61, 0x73, 0x68, 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, 0x55, 0x0a, 0x04, 0x42, - 0x6f, 0x64, 0x79, 0x12, 0x30, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0e, 0x32, 0x1c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, - 0x66, 0x73, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x52, - 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x68, 0x61, 0x73, 0x68, 0x5f, 0x6c, 0x69, - 0x73, 0x74, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x08, 0x68, 0x61, 0x73, 0x68, 0x4c, 0x69, - 0x73, 0x74, 0x22, 0xc8, 0x02, 0x0a, 0x10, 0x50, 0x75, 0x74, 0x53, 0x69, 0x6e, 0x67, 0x6c, 0x65, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x3b, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, - 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x50, 0x75, 0x74, 0x53, 0x69, 0x6e, 0x67, - 0x6c, 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, 0x5d, - 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x30, 0x0a, 0x06, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, - 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, - 0x52, 0x06, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x23, 0x0a, 0x0d, 0x63, 0x6f, 0x70, 0x69, - 0x65, 0x73, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0d, 0x52, - 0x0c, 0x63, 0x6f, 0x70, 0x69, 0x65, 0x73, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x22, 0xf5, 0x01, - 0x0a, 0x11, 0x50, 0x75, 0x74, 0x53, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x12, 0x3c, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x28, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, - 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x50, 0x75, 0x74, 0x53, 0x69, 0x6e, 0x67, 0x6c, 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, 0x06, 0x0a, - 0x04, 0x42, 0x6f, 0x64, 0x79, 0x22, 0xb3, 0x04, 0x0a, 0x0c, 0x50, 0x61, 0x74, 0x63, 0x68, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x37, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, - 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x50, 0x61, 0x74, 0x63, 0x68, 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, 0xcf, 0x02, 0x0a, 0x04, 0x42, 0x6f, - 0x64, 0x79, 0x12, 0x31, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, - 0x72, 0x65, 0x66, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x07, 0x61, 0x64, - 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x49, 0x0a, 0x0e, 0x6e, 0x65, 0x77, 0x5f, 0x61, 0x74, 0x74, - 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, - 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, - 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x2e, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, - 0x65, 0x52, 0x0d, 0x6e, 0x65, 0x77, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, - 0x12, 0x2d, 0x0a, 0x12, 0x72, 0x65, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x5f, 0x61, 0x74, 0x74, 0x72, - 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x11, 0x72, 0x65, - 0x70, 0x6c, 0x61, 0x63, 0x65, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, - 0x3f, 0x0a, 0x05, 0x70, 0x61, 0x74, 0x63, 0x68, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, - 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, - 0x74, 0x2e, 0x50, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x42, - 0x6f, 0x64, 0x79, 0x2e, 0x50, 0x61, 0x74, 0x63, 0x68, 0x52, 0x05, 0x70, 0x61, 0x74, 0x63, 0x68, - 0x1a, 0x59, 0x0a, 0x05, 0x50, 0x61, 0x74, 0x63, 0x68, 0x12, 0x3a, 0x0a, 0x0c, 0x73, 0x6f, 0x75, - 0x72, 0x63, 0x65, 0x5f, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x17, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, - 0x63, 0x74, 0x2e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x0b, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, - 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x22, 0xa4, 0x02, 0x0a, 0x0d, - 0x50, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x38, 0x0a, - 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6e, 0x65, - 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x50, - 0x61, 0x74, 0x63, 0x68, 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, 0x3d, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x35, 0x0a, 0x09, 0x6f, - 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 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, 0x08, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, - 0x49, 0x64, 0x32, 0xd4, 0x05, 0x0a, 0x0d, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x53, 0x65, 0x72, - 0x76, 0x69, 0x63, 0x65, 0x12, 0x44, 0x0a, 0x03, 0x47, 0x65, 0x74, 0x12, 0x1c, 0x2e, 0x6e, 0x65, - 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, - 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, - 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x30, 0x01, 0x12, 0x44, 0x0a, 0x03, 0x50, 0x75, - 0x74, 0x12, 0x1c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, - 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x50, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x1d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, - 0x63, 0x74, 0x2e, 0x50, 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x28, 0x01, - 0x12, 0x4b, 0x0a, 0x06, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x12, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, - 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x44, 0x65, - 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x6e, 0x65, - 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x44, - 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x45, 0x0a, - 0x04, 0x48, 0x65, 0x61, 0x64, 0x12, 0x1d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, - 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, - 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4d, 0x0a, 0x06, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x12, 0x1f, - 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, - 0x74, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, - 0x63, 0x74, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x30, 0x01, 0x12, 0x53, 0x0a, 0x08, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, - 0x21, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, - 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x22, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, - 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x30, 0x01, 0x12, 0x5d, 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x52, - 0x61, 0x6e, 0x67, 0x65, 0x48, 0x61, 0x73, 0x68, 0x12, 0x25, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, - 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, - 0x61, 0x6e, 0x67, 0x65, 0x48, 0x61, 0x73, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x26, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, - 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x48, 0x61, 0x73, 0x68, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x54, 0x0a, 0x09, 0x50, 0x75, 0x74, 0x53, 0x69, - 0x6e, 0x67, 0x6c, 0x65, 0x12, 0x22, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, - 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x50, 0x75, 0x74, 0x53, 0x69, 0x6e, 0x67, 0x6c, - 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, - 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x50, 0x75, 0x74, 0x53, - 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4a, 0x0a, - 0x05, 0x50, 0x61, 0x74, 0x63, 0x68, 0x12, 0x1e, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, - 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x50, 0x61, 0x74, 0x63, 0x68, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, - 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x50, 0x61, 0x74, 0x63, 0x68, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x28, 0x01, 0x42, 0x61, 0x5a, 0x42, 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, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x6f, 0x62, 0x6a, - 0x65, 0x63, 0x74, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0xaa, - 0x02, 0x1a, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, - 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x62, 0x06, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_object_grpc_service_proto_rawDescOnce sync.Once - file_object_grpc_service_proto_rawDescData = file_object_grpc_service_proto_rawDesc -) - -func file_object_grpc_service_proto_rawDescGZIP() []byte { - file_object_grpc_service_proto_rawDescOnce.Do(func() { - file_object_grpc_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_object_grpc_service_proto_rawDescData) - }) - return file_object_grpc_service_proto_rawDescData -} - -var file_object_grpc_service_proto_msgTypes = make([]protoimpl.MessageInfo, 42) -var file_object_grpc_service_proto_goTypes = []interface{}{ - (*GetRequest)(nil), // 0: neo.fs.v2.object.GetRequest - (*GetResponse)(nil), // 1: neo.fs.v2.object.GetResponse - (*PutRequest)(nil), // 2: neo.fs.v2.object.PutRequest - (*PutResponse)(nil), // 3: neo.fs.v2.object.PutResponse - (*DeleteRequest)(nil), // 4: neo.fs.v2.object.DeleteRequest - (*DeleteResponse)(nil), // 5: neo.fs.v2.object.DeleteResponse - (*HeadRequest)(nil), // 6: neo.fs.v2.object.HeadRequest - (*HeaderWithSignature)(nil), // 7: neo.fs.v2.object.HeaderWithSignature - (*HeadResponse)(nil), // 8: neo.fs.v2.object.HeadResponse - (*SearchRequest)(nil), // 9: neo.fs.v2.object.SearchRequest - (*SearchResponse)(nil), // 10: neo.fs.v2.object.SearchResponse - (*Range)(nil), // 11: neo.fs.v2.object.Range - (*GetRangeRequest)(nil), // 12: neo.fs.v2.object.GetRangeRequest - (*GetRangeResponse)(nil), // 13: neo.fs.v2.object.GetRangeResponse - (*GetRangeHashRequest)(nil), // 14: neo.fs.v2.object.GetRangeHashRequest - (*GetRangeHashResponse)(nil), // 15: neo.fs.v2.object.GetRangeHashResponse - (*PutSingleRequest)(nil), // 16: neo.fs.v2.object.PutSingleRequest - (*PutSingleResponse)(nil), // 17: neo.fs.v2.object.PutSingleResponse - (*PatchRequest)(nil), // 18: neo.fs.v2.object.PatchRequest - (*PatchResponse)(nil), // 19: neo.fs.v2.object.PatchResponse - (*GetRequest_Body)(nil), // 20: neo.fs.v2.object.GetRequest.Body - (*GetResponse_Body)(nil), // 21: neo.fs.v2.object.GetResponse.Body - (*GetResponse_Body_Init)(nil), // 22: neo.fs.v2.object.GetResponse.Body.Init - (*PutRequest_Body)(nil), // 23: neo.fs.v2.object.PutRequest.Body - (*PutRequest_Body_Init)(nil), // 24: neo.fs.v2.object.PutRequest.Body.Init - (*PutResponse_Body)(nil), // 25: neo.fs.v2.object.PutResponse.Body - (*DeleteRequest_Body)(nil), // 26: neo.fs.v2.object.DeleteRequest.Body - (*DeleteResponse_Body)(nil), // 27: neo.fs.v2.object.DeleteResponse.Body - (*HeadRequest_Body)(nil), // 28: neo.fs.v2.object.HeadRequest.Body - (*HeadResponse_Body)(nil), // 29: neo.fs.v2.object.HeadResponse.Body - (*SearchRequest_Body)(nil), // 30: neo.fs.v2.object.SearchRequest.Body - (*SearchRequest_Body_Filter)(nil), // 31: neo.fs.v2.object.SearchRequest.Body.Filter - (*SearchResponse_Body)(nil), // 32: neo.fs.v2.object.SearchResponse.Body - (*GetRangeRequest_Body)(nil), // 33: neo.fs.v2.object.GetRangeRequest.Body - (*GetRangeResponse_Body)(nil), // 34: neo.fs.v2.object.GetRangeResponse.Body - (*GetRangeHashRequest_Body)(nil), // 35: neo.fs.v2.object.GetRangeHashRequest.Body - (*GetRangeHashResponse_Body)(nil), // 36: neo.fs.v2.object.GetRangeHashResponse.Body - (*PutSingleRequest_Body)(nil), // 37: neo.fs.v2.object.PutSingleRequest.Body - (*PutSingleResponse_Body)(nil), // 38: neo.fs.v2.object.PutSingleResponse.Body - (*PatchRequest_Body)(nil), // 39: neo.fs.v2.object.PatchRequest.Body - (*PatchRequest_Body_Patch)(nil), // 40: neo.fs.v2.object.PatchRequest.Body.Patch - (*PatchResponse_Body)(nil), // 41: neo.fs.v2.object.PatchResponse.Body - (*grpc.RequestMetaHeader)(nil), // 42: neo.fs.v2.session.RequestMetaHeader - (*grpc.RequestVerificationHeader)(nil), // 43: neo.fs.v2.session.RequestVerificationHeader - (*grpc.ResponseMetaHeader)(nil), // 44: neo.fs.v2.session.ResponseMetaHeader - (*grpc.ResponseVerificationHeader)(nil), // 45: neo.fs.v2.session.ResponseVerificationHeader - (*Header)(nil), // 46: neo.fs.v2.object.Header - (*grpc1.Signature)(nil), // 47: neo.fs.v2.refs.Signature - (*grpc1.Address)(nil), // 48: neo.fs.v2.refs.Address - (*SplitInfo)(nil), // 49: neo.fs.v2.object.SplitInfo - (*ECInfo)(nil), // 50: neo.fs.v2.object.ECInfo - (*grpc1.ObjectID)(nil), // 51: neo.fs.v2.refs.ObjectID - (*ShortHeader)(nil), // 52: neo.fs.v2.object.ShortHeader - (*grpc1.ContainerID)(nil), // 53: neo.fs.v2.refs.ContainerID - (MatchType)(0), // 54: neo.fs.v2.object.MatchType - (grpc1.ChecksumType)(0), // 55: neo.fs.v2.refs.ChecksumType - (*Object)(nil), // 56: neo.fs.v2.object.Object - (*Header_Attribute)(nil), // 57: neo.fs.v2.object.Header.Attribute -} -var file_object_grpc_service_proto_depIdxs = []int32{ - 20, // 0: neo.fs.v2.object.GetRequest.body:type_name -> neo.fs.v2.object.GetRequest.Body - 42, // 1: neo.fs.v2.object.GetRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader - 43, // 2: neo.fs.v2.object.GetRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader - 21, // 3: neo.fs.v2.object.GetResponse.body:type_name -> neo.fs.v2.object.GetResponse.Body - 44, // 4: neo.fs.v2.object.GetResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader - 45, // 5: neo.fs.v2.object.GetResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader - 23, // 6: neo.fs.v2.object.PutRequest.body:type_name -> neo.fs.v2.object.PutRequest.Body - 42, // 7: neo.fs.v2.object.PutRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader - 43, // 8: neo.fs.v2.object.PutRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader - 25, // 9: neo.fs.v2.object.PutResponse.body:type_name -> neo.fs.v2.object.PutResponse.Body - 44, // 10: neo.fs.v2.object.PutResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader - 45, // 11: neo.fs.v2.object.PutResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader - 26, // 12: neo.fs.v2.object.DeleteRequest.body:type_name -> neo.fs.v2.object.DeleteRequest.Body - 42, // 13: neo.fs.v2.object.DeleteRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader - 43, // 14: neo.fs.v2.object.DeleteRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader - 27, // 15: neo.fs.v2.object.DeleteResponse.body:type_name -> neo.fs.v2.object.DeleteResponse.Body - 44, // 16: neo.fs.v2.object.DeleteResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader - 45, // 17: neo.fs.v2.object.DeleteResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader - 28, // 18: neo.fs.v2.object.HeadRequest.body:type_name -> neo.fs.v2.object.HeadRequest.Body - 42, // 19: neo.fs.v2.object.HeadRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader - 43, // 20: neo.fs.v2.object.HeadRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader - 46, // 21: neo.fs.v2.object.HeaderWithSignature.header:type_name -> neo.fs.v2.object.Header - 47, // 22: neo.fs.v2.object.HeaderWithSignature.signature:type_name -> neo.fs.v2.refs.Signature - 29, // 23: neo.fs.v2.object.HeadResponse.body:type_name -> neo.fs.v2.object.HeadResponse.Body - 44, // 24: neo.fs.v2.object.HeadResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader - 45, // 25: neo.fs.v2.object.HeadResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader - 30, // 26: neo.fs.v2.object.SearchRequest.body:type_name -> neo.fs.v2.object.SearchRequest.Body - 42, // 27: neo.fs.v2.object.SearchRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader - 43, // 28: neo.fs.v2.object.SearchRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader - 32, // 29: neo.fs.v2.object.SearchResponse.body:type_name -> neo.fs.v2.object.SearchResponse.Body - 44, // 30: neo.fs.v2.object.SearchResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader - 45, // 31: neo.fs.v2.object.SearchResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader - 33, // 32: neo.fs.v2.object.GetRangeRequest.body:type_name -> neo.fs.v2.object.GetRangeRequest.Body - 42, // 33: neo.fs.v2.object.GetRangeRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader - 43, // 34: neo.fs.v2.object.GetRangeRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader - 34, // 35: neo.fs.v2.object.GetRangeResponse.body:type_name -> neo.fs.v2.object.GetRangeResponse.Body - 44, // 36: neo.fs.v2.object.GetRangeResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader - 45, // 37: neo.fs.v2.object.GetRangeResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader - 35, // 38: neo.fs.v2.object.GetRangeHashRequest.body:type_name -> neo.fs.v2.object.GetRangeHashRequest.Body - 42, // 39: neo.fs.v2.object.GetRangeHashRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader - 43, // 40: neo.fs.v2.object.GetRangeHashRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader - 36, // 41: neo.fs.v2.object.GetRangeHashResponse.body:type_name -> neo.fs.v2.object.GetRangeHashResponse.Body - 44, // 42: neo.fs.v2.object.GetRangeHashResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader - 45, // 43: neo.fs.v2.object.GetRangeHashResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader - 37, // 44: neo.fs.v2.object.PutSingleRequest.body:type_name -> neo.fs.v2.object.PutSingleRequest.Body - 42, // 45: neo.fs.v2.object.PutSingleRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader - 43, // 46: neo.fs.v2.object.PutSingleRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader - 38, // 47: neo.fs.v2.object.PutSingleResponse.body:type_name -> neo.fs.v2.object.PutSingleResponse.Body - 44, // 48: neo.fs.v2.object.PutSingleResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader - 45, // 49: neo.fs.v2.object.PutSingleResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader - 39, // 50: neo.fs.v2.object.PatchRequest.body:type_name -> neo.fs.v2.object.PatchRequest.Body - 42, // 51: neo.fs.v2.object.PatchRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader - 43, // 52: neo.fs.v2.object.PatchRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader - 41, // 53: neo.fs.v2.object.PatchResponse.body:type_name -> neo.fs.v2.object.PatchResponse.Body - 44, // 54: neo.fs.v2.object.PatchResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader - 45, // 55: neo.fs.v2.object.PatchResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader - 48, // 56: neo.fs.v2.object.GetRequest.Body.address:type_name -> neo.fs.v2.refs.Address - 22, // 57: neo.fs.v2.object.GetResponse.Body.init:type_name -> neo.fs.v2.object.GetResponse.Body.Init - 49, // 58: neo.fs.v2.object.GetResponse.Body.split_info:type_name -> neo.fs.v2.object.SplitInfo - 50, // 59: neo.fs.v2.object.GetResponse.Body.ec_info:type_name -> neo.fs.v2.object.ECInfo - 51, // 60: neo.fs.v2.object.GetResponse.Body.Init.object_id:type_name -> neo.fs.v2.refs.ObjectID - 47, // 61: neo.fs.v2.object.GetResponse.Body.Init.signature:type_name -> neo.fs.v2.refs.Signature - 46, // 62: neo.fs.v2.object.GetResponse.Body.Init.header:type_name -> neo.fs.v2.object.Header - 24, // 63: neo.fs.v2.object.PutRequest.Body.init:type_name -> neo.fs.v2.object.PutRequest.Body.Init - 51, // 64: neo.fs.v2.object.PutRequest.Body.Init.object_id:type_name -> neo.fs.v2.refs.ObjectID - 47, // 65: neo.fs.v2.object.PutRequest.Body.Init.signature:type_name -> neo.fs.v2.refs.Signature - 46, // 66: neo.fs.v2.object.PutRequest.Body.Init.header:type_name -> neo.fs.v2.object.Header - 51, // 67: neo.fs.v2.object.PutResponse.Body.object_id:type_name -> neo.fs.v2.refs.ObjectID - 48, // 68: neo.fs.v2.object.DeleteRequest.Body.address:type_name -> neo.fs.v2.refs.Address - 48, // 69: neo.fs.v2.object.DeleteResponse.Body.tombstone:type_name -> neo.fs.v2.refs.Address - 48, // 70: neo.fs.v2.object.HeadRequest.Body.address:type_name -> neo.fs.v2.refs.Address - 7, // 71: neo.fs.v2.object.HeadResponse.Body.header:type_name -> neo.fs.v2.object.HeaderWithSignature - 52, // 72: neo.fs.v2.object.HeadResponse.Body.short_header:type_name -> neo.fs.v2.object.ShortHeader - 49, // 73: neo.fs.v2.object.HeadResponse.Body.split_info:type_name -> neo.fs.v2.object.SplitInfo - 50, // 74: neo.fs.v2.object.HeadResponse.Body.ec_info:type_name -> neo.fs.v2.object.ECInfo - 53, // 75: neo.fs.v2.object.SearchRequest.Body.container_id:type_name -> neo.fs.v2.refs.ContainerID - 31, // 76: neo.fs.v2.object.SearchRequest.Body.filters:type_name -> neo.fs.v2.object.SearchRequest.Body.Filter - 54, // 77: neo.fs.v2.object.SearchRequest.Body.Filter.match_type:type_name -> neo.fs.v2.object.MatchType - 51, // 78: neo.fs.v2.object.SearchResponse.Body.id_list:type_name -> neo.fs.v2.refs.ObjectID - 48, // 79: neo.fs.v2.object.GetRangeRequest.Body.address:type_name -> neo.fs.v2.refs.Address - 11, // 80: neo.fs.v2.object.GetRangeRequest.Body.range:type_name -> neo.fs.v2.object.Range - 49, // 81: neo.fs.v2.object.GetRangeResponse.Body.split_info:type_name -> neo.fs.v2.object.SplitInfo - 50, // 82: neo.fs.v2.object.GetRangeResponse.Body.ec_info:type_name -> neo.fs.v2.object.ECInfo - 48, // 83: neo.fs.v2.object.GetRangeHashRequest.Body.address:type_name -> neo.fs.v2.refs.Address - 11, // 84: neo.fs.v2.object.GetRangeHashRequest.Body.ranges:type_name -> neo.fs.v2.object.Range - 55, // 85: neo.fs.v2.object.GetRangeHashRequest.Body.type:type_name -> neo.fs.v2.refs.ChecksumType - 55, // 86: neo.fs.v2.object.GetRangeHashResponse.Body.type:type_name -> neo.fs.v2.refs.ChecksumType - 56, // 87: neo.fs.v2.object.PutSingleRequest.Body.object:type_name -> neo.fs.v2.object.Object - 48, // 88: neo.fs.v2.object.PatchRequest.Body.address:type_name -> neo.fs.v2.refs.Address - 57, // 89: neo.fs.v2.object.PatchRequest.Body.new_attributes:type_name -> neo.fs.v2.object.Header.Attribute - 40, // 90: neo.fs.v2.object.PatchRequest.Body.patch:type_name -> neo.fs.v2.object.PatchRequest.Body.Patch - 11, // 91: neo.fs.v2.object.PatchRequest.Body.Patch.source_range:type_name -> neo.fs.v2.object.Range - 51, // 92: neo.fs.v2.object.PatchResponse.Body.object_id:type_name -> neo.fs.v2.refs.ObjectID - 0, // 93: neo.fs.v2.object.ObjectService.Get:input_type -> neo.fs.v2.object.GetRequest - 2, // 94: neo.fs.v2.object.ObjectService.Put:input_type -> neo.fs.v2.object.PutRequest - 4, // 95: neo.fs.v2.object.ObjectService.Delete:input_type -> neo.fs.v2.object.DeleteRequest - 6, // 96: neo.fs.v2.object.ObjectService.Head:input_type -> neo.fs.v2.object.HeadRequest - 9, // 97: neo.fs.v2.object.ObjectService.Search:input_type -> neo.fs.v2.object.SearchRequest - 12, // 98: neo.fs.v2.object.ObjectService.GetRange:input_type -> neo.fs.v2.object.GetRangeRequest - 14, // 99: neo.fs.v2.object.ObjectService.GetRangeHash:input_type -> neo.fs.v2.object.GetRangeHashRequest - 16, // 100: neo.fs.v2.object.ObjectService.PutSingle:input_type -> neo.fs.v2.object.PutSingleRequest - 18, // 101: neo.fs.v2.object.ObjectService.Patch:input_type -> neo.fs.v2.object.PatchRequest - 1, // 102: neo.fs.v2.object.ObjectService.Get:output_type -> neo.fs.v2.object.GetResponse - 3, // 103: neo.fs.v2.object.ObjectService.Put:output_type -> neo.fs.v2.object.PutResponse - 5, // 104: neo.fs.v2.object.ObjectService.Delete:output_type -> neo.fs.v2.object.DeleteResponse - 8, // 105: neo.fs.v2.object.ObjectService.Head:output_type -> neo.fs.v2.object.HeadResponse - 10, // 106: neo.fs.v2.object.ObjectService.Search:output_type -> neo.fs.v2.object.SearchResponse - 13, // 107: neo.fs.v2.object.ObjectService.GetRange:output_type -> neo.fs.v2.object.GetRangeResponse - 15, // 108: neo.fs.v2.object.ObjectService.GetRangeHash:output_type -> neo.fs.v2.object.GetRangeHashResponse - 17, // 109: neo.fs.v2.object.ObjectService.PutSingle:output_type -> neo.fs.v2.object.PutSingleResponse - 19, // 110: neo.fs.v2.object.ObjectService.Patch:output_type -> neo.fs.v2.object.PatchResponse - 102, // [102:111] is the sub-list for method output_type - 93, // [93:102] is the sub-list for method input_type - 93, // [93:93] is the sub-list for extension type_name - 93, // [93:93] is the sub-list for extension extendee - 0, // [0:93] is the sub-list for field type_name -} - -func init() { file_object_grpc_service_proto_init() } -func file_object_grpc_service_proto_init() { - if File_object_grpc_service_proto != nil { - return - } - file_object_grpc_types_proto_init() - if !protoimpl.UnsafeEnabled { - file_object_grpc_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_object_grpc_service_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_object_grpc_service_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PutRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_object_grpc_service_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PutResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_object_grpc_service_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DeleteRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_object_grpc_service_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DeleteResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_object_grpc_service_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*HeadRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_object_grpc_service_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*HeaderWithSignature); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_object_grpc_service_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*HeadResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_object_grpc_service_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SearchRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_object_grpc_service_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SearchResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_object_grpc_service_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Range); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_object_grpc_service_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetRangeRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_object_grpc_service_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetRangeResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_object_grpc_service_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetRangeHashRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_object_grpc_service_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetRangeHashResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_object_grpc_service_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PutSingleRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_object_grpc_service_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PutSingleResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_object_grpc_service_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatchRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_object_grpc_service_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatchResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_object_grpc_service_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetRequest_Body); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_object_grpc_service_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetResponse_Body); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_object_grpc_service_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetResponse_Body_Init); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_object_grpc_service_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PutRequest_Body); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_object_grpc_service_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PutRequest_Body_Init); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_object_grpc_service_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PutResponse_Body); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_object_grpc_service_proto_msgTypes[26].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DeleteRequest_Body); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_object_grpc_service_proto_msgTypes[27].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DeleteResponse_Body); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_object_grpc_service_proto_msgTypes[28].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*HeadRequest_Body); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_object_grpc_service_proto_msgTypes[29].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*HeadResponse_Body); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_object_grpc_service_proto_msgTypes[30].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SearchRequest_Body); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_object_grpc_service_proto_msgTypes[31].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SearchRequest_Body_Filter); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_object_grpc_service_proto_msgTypes[32].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SearchResponse_Body); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_object_grpc_service_proto_msgTypes[33].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetRangeRequest_Body); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_object_grpc_service_proto_msgTypes[34].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetRangeResponse_Body); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_object_grpc_service_proto_msgTypes[35].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetRangeHashRequest_Body); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_object_grpc_service_proto_msgTypes[36].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetRangeHashResponse_Body); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_object_grpc_service_proto_msgTypes[37].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PutSingleRequest_Body); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_object_grpc_service_proto_msgTypes[38].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PutSingleResponse_Body); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_object_grpc_service_proto_msgTypes[39].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatchRequest_Body); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_object_grpc_service_proto_msgTypes[40].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatchRequest_Body_Patch); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_object_grpc_service_proto_msgTypes[41].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatchResponse_Body); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - file_object_grpc_service_proto_msgTypes[21].OneofWrappers = []interface{}{ - (*GetResponse_Body_Init_)(nil), - (*GetResponse_Body_Chunk)(nil), - (*GetResponse_Body_SplitInfo)(nil), - (*GetResponse_Body_EcInfo)(nil), - } - file_object_grpc_service_proto_msgTypes[23].OneofWrappers = []interface{}{ - (*PutRequest_Body_Init_)(nil), - (*PutRequest_Body_Chunk)(nil), - } - file_object_grpc_service_proto_msgTypes[29].OneofWrappers = []interface{}{ - (*HeadResponse_Body_Header)(nil), - (*HeadResponse_Body_ShortHeader)(nil), - (*HeadResponse_Body_SplitInfo)(nil), - (*HeadResponse_Body_EcInfo)(nil), - } - file_object_grpc_service_proto_msgTypes[34].OneofWrappers = []interface{}{ - (*GetRangeResponse_Body_Chunk)(nil), - (*GetRangeResponse_Body_SplitInfo)(nil), - (*GetRangeResponse_Body_EcInfo)(nil), - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_object_grpc_service_proto_rawDesc, - NumEnums: 0, - NumMessages: 42, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_object_grpc_service_proto_goTypes, - DependencyIndexes: file_object_grpc_service_proto_depIdxs, - MessageInfos: file_object_grpc_service_proto_msgTypes, - }.Build() - File_object_grpc_service_proto = out.File - file_object_grpc_service_proto_rawDesc = nil - file_object_grpc_service_proto_goTypes = nil - file_object_grpc_service_proto_depIdxs = nil -} diff --git a/object/grpc/service_frostfs.pb.go b/object/grpc/service_frostfs.pb.go new file mode 100644 index 0000000..08b2860 --- /dev/null +++ b/object/grpc/service_frostfs.pb.go @@ -0,0 +1,8690 @@ +// Code generated by protoc-gen-go-frostfs. DO NOT EDIT. + +package object + +import ( + json "encoding/json" + fmt "fmt" + grpc "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc" + grpc1 "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session/grpc" + pool "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/pool" + proto "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/proto" + encoding "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/proto/encoding" + easyproto "github.com/VictoriaMetrics/easyproto" + jlexer "github.com/mailru/easyjson/jlexer" + jwriter "github.com/mailru/easyjson/jwriter" + strconv "strconv" +) + +type GetRequest_Body struct { + Address *grpc.Address `json:"address"` + Raw bool `json:"raw"` +} + +var ( + _ encoding.ProtoMarshaler = (*GetRequest_Body)(nil) + _ encoding.ProtoUnmarshaler = (*GetRequest_Body)(nil) + _ json.Marshaler = (*GetRequest_Body)(nil) + _ json.Unmarshaler = (*GetRequest_Body)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *GetRequest_Body) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.NestedStructureSize(1, x.Address) + size += proto.BoolSize(2, x.Raw) + return size +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *GetRequest_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 *GetRequest_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if x.Address != nil && x.Address.StableSize() != 0 { + x.Address.EmitProtobuf(mm.AppendMessage(1)) + } + if x.Raw { + mm.AppendBool(2, x.Raw) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *GetRequest_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", "GetRequest_Body") + } + switch fc.FieldNum { + case 1: // Address + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Address") + } + x.Address = new(grpc.Address) + if err := x.Address.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + case 2: // Raw + data, ok := fc.Bool() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Raw") + } + x.Raw = data + } + } + return nil +} +func (x *GetRequest_Body) GetAddress() *grpc.Address { + if x != nil { + return x.Address + } + return nil +} +func (x *GetRequest_Body) SetAddress(v *grpc.Address) { + x.Address = v +} +func (x *GetRequest_Body) GetRaw() bool { + if x != nil { + return x.Raw + } + return false +} +func (x *GetRequest_Body) SetRaw(v bool) { + x.Raw = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *GetRequest_Body) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *GetRequest_Body) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"address\":" + out.RawString(prefix[1:]) + x.Address.MarshalEasyJSON(out) + } + { + const prefix string = ",\"raw\":" + out.RawString(prefix) + out.Bool(x.Raw) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *GetRequest_Body) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *GetRequest_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 "address": + { + var f *grpc.Address + f = new(grpc.Address) + f.UnmarshalEasyJSON(in) + x.Address = f + } + case "raw": + { + var f bool + f = in.Bool() + x.Raw = f + } + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} + +type GetRequest struct { + Body *GetRequest_Body `json:"body"` + MetaHeader *grpc1.RequestMetaHeader `json:"metaHeader"` + VerifyHeader *grpc1.RequestVerificationHeader `json:"verifyHeader"` +} + +var ( + _ encoding.ProtoMarshaler = (*GetRequest)(nil) + _ encoding.ProtoUnmarshaler = (*GetRequest)(nil) + _ json.Marshaler = (*GetRequest)(nil) + _ json.Unmarshaler = (*GetRequest)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *GetRequest) 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 *GetRequest) 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 *GetRequest) ReadSignedData(buf []byte) ([]byte, error) { + return x.GetBody().MarshalProtobuf(buf), nil +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *GetRequest) 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 *GetRequest) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if x.Body != nil && x.Body.StableSize() != 0 { + x.Body.EmitProtobuf(mm.AppendMessage(1)) + } + if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 { + x.MetaHeader.EmitProtobuf(mm.AppendMessage(2)) + } + if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 { + x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3)) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *GetRequest) 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", "GetRequest") + } + switch fc.FieldNum { + case 1: // Body + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Body") + } + x.Body = new(GetRequest_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 *GetRequest) GetBody() *GetRequest_Body { + if x != nil { + return x.Body + } + return nil +} +func (x *GetRequest) SetBody(v *GetRequest_Body) { + x.Body = v +} +func (x *GetRequest) GetMetaHeader() *grpc1.RequestMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} +func (x *GetRequest) SetMetaHeader(v *grpc1.RequestMetaHeader) { + x.MetaHeader = v +} +func (x *GetRequest) GetVerifyHeader() *grpc1.RequestVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} +func (x *GetRequest) SetVerifyHeader(v *grpc1.RequestVerificationHeader) { + x.VerifyHeader = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *GetRequest) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *GetRequest) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"body\":" + out.RawString(prefix[1:]) + x.Body.MarshalEasyJSON(out) + } + { + const prefix string = ",\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) + } + { + const prefix string = ",\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *GetRequest) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *GetRequest) 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 *GetRequest_Body + f = new(GetRequest_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 GetResponse_Body_Init struct { + ObjectId *grpc.ObjectID `json:"objectId"` + Signature *grpc.Signature `json:"signature"` + Header *Header `json:"header"` +} + +var ( + _ encoding.ProtoMarshaler = (*GetResponse_Body_Init)(nil) + _ encoding.ProtoUnmarshaler = (*GetResponse_Body_Init)(nil) + _ json.Marshaler = (*GetResponse_Body_Init)(nil) + _ json.Unmarshaler = (*GetResponse_Body_Init)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *GetResponse_Body_Init) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.NestedStructureSize(1, x.ObjectId) + size += proto.NestedStructureSize(2, x.Signature) + size += proto.NestedStructureSize(3, x.Header) + return size +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *GetResponse_Body_Init) 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 *GetResponse_Body_Init) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if x.ObjectId != nil && x.ObjectId.StableSize() != 0 { + x.ObjectId.EmitProtobuf(mm.AppendMessage(1)) + } + if x.Signature != nil && x.Signature.StableSize() != 0 { + x.Signature.EmitProtobuf(mm.AppendMessage(2)) + } + if x.Header != nil && x.Header.StableSize() != 0 { + x.Header.EmitProtobuf(mm.AppendMessage(3)) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *GetResponse_Body_Init) 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", "GetResponse_Body_Init") + } + switch fc.FieldNum { + case 1: // ObjectId + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "ObjectId") + } + x.ObjectId = new(grpc.ObjectID) + if err := x.ObjectId.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + case 2: // Signature + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Signature") + } + x.Signature = new(grpc.Signature) + if err := x.Signature.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + case 3: // Header + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Header") + } + x.Header = new(Header) + if err := x.Header.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + } + } + return nil +} +func (x *GetResponse_Body_Init) GetObjectId() *grpc.ObjectID { + if x != nil { + return x.ObjectId + } + return nil +} +func (x *GetResponse_Body_Init) SetObjectId(v *grpc.ObjectID) { + x.ObjectId = v +} +func (x *GetResponse_Body_Init) GetSignature() *grpc.Signature { + if x != nil { + return x.Signature + } + return nil +} +func (x *GetResponse_Body_Init) SetSignature(v *grpc.Signature) { + x.Signature = v +} +func (x *GetResponse_Body_Init) GetHeader() *Header { + if x != nil { + return x.Header + } + return nil +} +func (x *GetResponse_Body_Init) SetHeader(v *Header) { + x.Header = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *GetResponse_Body_Init) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *GetResponse_Body_Init) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"objectId\":" + out.RawString(prefix[1:]) + x.ObjectId.MarshalEasyJSON(out) + } + { + const prefix string = ",\"signature\":" + out.RawString(prefix) + x.Signature.MarshalEasyJSON(out) + } + { + const prefix string = ",\"header\":" + out.RawString(prefix) + x.Header.MarshalEasyJSON(out) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *GetResponse_Body_Init) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *GetResponse_Body_Init) 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 "objectId": + { + var f *grpc.ObjectID + f = new(grpc.ObjectID) + f.UnmarshalEasyJSON(in) + x.ObjectId = f + } + case "signature": + { + var f *grpc.Signature + f = new(grpc.Signature) + f.UnmarshalEasyJSON(in) + x.Signature = f + } + case "header": + { + var f *Header + f = new(Header) + f.UnmarshalEasyJSON(in) + x.Header = f + } + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} + +type GetResponse_Body struct { + ObjectPart isGetResponse_Body_ObjectPart +} + +var ( + _ encoding.ProtoMarshaler = (*GetResponse_Body)(nil) + _ encoding.ProtoUnmarshaler = (*GetResponse_Body)(nil) + _ json.Marshaler = (*GetResponse_Body)(nil) + _ json.Unmarshaler = (*GetResponse_Body)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *GetResponse_Body) StableSize() (size int) { + if x == nil { + return 0 + } + if inner, ok := x.ObjectPart.(*GetResponse_Body_Init_); ok { + size += proto.NestedStructureSize(1, inner.Init) + } + if inner, ok := x.ObjectPart.(*GetResponse_Body_Chunk); ok { + size += proto.BytesSize(2, inner.Chunk) + } + if inner, ok := x.ObjectPart.(*GetResponse_Body_SplitInfo); ok { + size += proto.NestedStructureSize(3, inner.SplitInfo) + } + if inner, ok := x.ObjectPart.(*GetResponse_Body_EcInfo); ok { + size += proto.NestedStructureSize(4, inner.EcInfo) + } + return size +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *GetResponse_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 *GetResponse_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if inner, ok := x.ObjectPart.(*GetResponse_Body_Init_); ok { + if inner.Init != nil && inner.Init.StableSize() != 0 { + inner.Init.EmitProtobuf(mm.AppendMessage(1)) + } + } + if inner, ok := x.ObjectPart.(*GetResponse_Body_Chunk); ok { + if len(inner.Chunk) != 0 { + mm.AppendBytes(2, inner.Chunk) + } + } + if inner, ok := x.ObjectPart.(*GetResponse_Body_SplitInfo); ok { + if inner.SplitInfo != nil && inner.SplitInfo.StableSize() != 0 { + inner.SplitInfo.EmitProtobuf(mm.AppendMessage(3)) + } + } + if inner, ok := x.ObjectPart.(*GetResponse_Body_EcInfo); ok { + if inner.EcInfo != nil && inner.EcInfo.StableSize() != 0 { + inner.EcInfo.EmitProtobuf(mm.AppendMessage(4)) + } + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *GetResponse_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", "GetResponse_Body") + } + switch fc.FieldNum { + case 1: // Init + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Init") + } + oneofField := &GetResponse_Body_Init_{Init: new(GetResponse_Body_Init)} + if err := oneofField.Init.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + x.ObjectPart = oneofField + case 2: // Chunk + data, ok := fc.Bytes() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Chunk") + } + x.ObjectPart = &GetResponse_Body_Chunk{Chunk: data} + case 3: // SplitInfo + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "SplitInfo") + } + oneofField := &GetResponse_Body_SplitInfo{SplitInfo: new(SplitInfo)} + if err := oneofField.SplitInfo.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + x.ObjectPart = oneofField + case 4: // EcInfo + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "EcInfo") + } + oneofField := &GetResponse_Body_EcInfo{EcInfo: new(ECInfo)} + if err := oneofField.EcInfo.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + x.ObjectPart = oneofField + } + } + return nil +} +func (x *GetResponse_Body) GetObjectPart() isGetResponse_Body_ObjectPart { + if x != nil { + return x.ObjectPart + } + return nil +} +func (x *GetResponse_Body) SetObjectPart(v isGetResponse_Body_ObjectPart) { + x.ObjectPart = v +} +func (x *GetResponse_Body) GetInit() *GetResponse_Body_Init { + if xx, ok := x.GetObjectPart().(*GetResponse_Body_Init_); ok { + return xx.Init + } + return nil +} +func (x *GetResponse_Body) SetInit(v *GetResponse_Body_Init) { + x.ObjectPart = &GetResponse_Body_Init_{Init: v} +} +func (x *GetResponse_Body) GetChunk() *GetResponse_Body_Chunk { + if xx, ok := x.GetObjectPart().(*GetResponse_Body_Chunk); ok { + return xx + } + return nil +} +func (x *GetResponse_Body) SetChunk(v *GetResponse_Body_Chunk) { + x.ObjectPart = v +} +func (x *GetResponse_Body_Chunk) GetChunk() []byte { + if x != nil { + return x.Chunk + } + return nil +} +func (x *GetResponse_Body_Chunk) SetChunk(v []byte) { + x.Chunk = v +} +func (x *GetResponse_Body) GetSplitInfo() *SplitInfo { + if xx, ok := x.GetObjectPart().(*GetResponse_Body_SplitInfo); ok { + return xx.SplitInfo + } + return nil +} +func (x *GetResponse_Body) SetSplitInfo(v *SplitInfo) { + x.ObjectPart = &GetResponse_Body_SplitInfo{SplitInfo: v} +} +func (x *GetResponse_Body) GetEcInfo() *ECInfo { + if xx, ok := x.GetObjectPart().(*GetResponse_Body_EcInfo); ok { + return xx.EcInfo + } + return nil +} +func (x *GetResponse_Body) SetEcInfo(v *ECInfo) { + x.ObjectPart = &GetResponse_Body_EcInfo{EcInfo: v} +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *GetResponse_Body) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *GetResponse_Body) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + switch xx := x.ObjectPart.(type) { + case *GetResponse_Body_Init_: + { + const prefix string = ",\"init\":" + out.RawString(prefix[1:]) + xx.Init.MarshalEasyJSON(out) + } + case *GetResponse_Body_Chunk: + { + const prefix string = ",\"chunk\":" + out.RawString(prefix[1:]) + out.Base64Bytes(xx.Chunk) + } + case *GetResponse_Body_SplitInfo: + { + const prefix string = ",\"splitInfo\":" + out.RawString(prefix[1:]) + xx.SplitInfo.MarshalEasyJSON(out) + } + case *GetResponse_Body_EcInfo: + { + const prefix string = ",\"ecInfo\":" + out.RawString(prefix[1:]) + xx.EcInfo.MarshalEasyJSON(out) + } + default: + out.RawString("null") + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *GetResponse_Body) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *GetResponse_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 "init": + xx := new(GetResponse_Body_Init_) + x.ObjectPart = xx + { + var f *GetResponse_Body_Init + f = new(GetResponse_Body_Init) + f.UnmarshalEasyJSON(in) + xx.Init = f + } + case "chunk": + xx := new(GetResponse_Body_Chunk) + x.ObjectPart = xx + { + var f []byte + f = in.Bytes() + xx.Chunk = f + } + case "splitInfo": + xx := new(GetResponse_Body_SplitInfo) + x.ObjectPart = xx + { + var f *SplitInfo + f = new(SplitInfo) + f.UnmarshalEasyJSON(in) + xx.SplitInfo = f + } + case "ecInfo": + xx := new(GetResponse_Body_EcInfo) + x.ObjectPart = xx + { + var f *ECInfo + f = new(ECInfo) + f.UnmarshalEasyJSON(in) + xx.EcInfo = f + } + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} + +type isGetResponse_Body_ObjectPart interface { + isGetResponse_Body_ObjectPart() +} + +type GetResponse_Body_Init_ struct { + Init *GetResponse_Body_Init +} + +type GetResponse_Body_Chunk struct { + Chunk []byte +} + +type GetResponse_Body_SplitInfo struct { + SplitInfo *SplitInfo +} + +type GetResponse_Body_EcInfo struct { + EcInfo *ECInfo +} + +func (*GetResponse_Body_Init_) isGetResponse_Body_ObjectPart() {} + +func (*GetResponse_Body_Chunk) isGetResponse_Body_ObjectPart() {} + +func (*GetResponse_Body_SplitInfo) isGetResponse_Body_ObjectPart() {} + +func (*GetResponse_Body_EcInfo) isGetResponse_Body_ObjectPart() {} + +type GetResponse struct { + Body *GetResponse_Body `json:"body"` + MetaHeader *grpc1.ResponseMetaHeader `json:"metaHeader"` + VerifyHeader *grpc1.ResponseVerificationHeader `json:"verifyHeader"` +} + +var ( + _ encoding.ProtoMarshaler = (*GetResponse)(nil) + _ encoding.ProtoUnmarshaler = (*GetResponse)(nil) + _ json.Marshaler = (*GetResponse)(nil) + _ json.Unmarshaler = (*GetResponse)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *GetResponse) 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 *GetResponse) 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 *GetResponse) ReadSignedData(buf []byte) ([]byte, error) { + return x.GetBody().MarshalProtobuf(buf), nil +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *GetResponse) 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 *GetResponse) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if x.Body != nil && x.Body.StableSize() != 0 { + x.Body.EmitProtobuf(mm.AppendMessage(1)) + } + if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 { + x.MetaHeader.EmitProtobuf(mm.AppendMessage(2)) + } + if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 { + x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3)) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *GetResponse) 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", "GetResponse") + } + switch fc.FieldNum { + case 1: // Body + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Body") + } + x.Body = new(GetResponse_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 *GetResponse) GetBody() *GetResponse_Body { + if x != nil { + return x.Body + } + return nil +} +func (x *GetResponse) SetBody(v *GetResponse_Body) { + x.Body = v +} +func (x *GetResponse) GetMetaHeader() *grpc1.ResponseMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} +func (x *GetResponse) SetMetaHeader(v *grpc1.ResponseMetaHeader) { + x.MetaHeader = v +} +func (x *GetResponse) GetVerifyHeader() *grpc1.ResponseVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} +func (x *GetResponse) SetVerifyHeader(v *grpc1.ResponseVerificationHeader) { + x.VerifyHeader = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *GetResponse) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *GetResponse) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"body\":" + out.RawString(prefix[1:]) + x.Body.MarshalEasyJSON(out) + } + { + const prefix string = ",\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) + } + { + const prefix string = ",\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *GetResponse) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *GetResponse) 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 *GetResponse_Body + f = new(GetResponse_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() + } +} + +type PutRequest_Body_Init struct { + ObjectId *grpc.ObjectID `json:"objectId"` + Signature *grpc.Signature `json:"signature"` + Header *Header `json:"header"` + CopiesNumber []uint32 `json:"copiesNumber"` +} + +var ( + _ encoding.ProtoMarshaler = (*PutRequest_Body_Init)(nil) + _ encoding.ProtoUnmarshaler = (*PutRequest_Body_Init)(nil) + _ json.Marshaler = (*PutRequest_Body_Init)(nil) + _ json.Unmarshaler = (*PutRequest_Body_Init)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *PutRequest_Body_Init) StableSize() (size int) { + if x == nil { + return 0 + } + var n int + size += proto.NestedStructureSize(1, x.ObjectId) + size += proto.NestedStructureSize(2, x.Signature) + size += proto.NestedStructureSize(3, x.Header) + n, _ = proto.RepeatedUInt32Size(4, x.CopiesNumber) + size += n + return size +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *PutRequest_Body_Init) 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 *PutRequest_Body_Init) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if x.ObjectId != nil && x.ObjectId.StableSize() != 0 { + x.ObjectId.EmitProtobuf(mm.AppendMessage(1)) + } + if x.Signature != nil && x.Signature.StableSize() != 0 { + x.Signature.EmitProtobuf(mm.AppendMessage(2)) + } + if x.Header != nil && x.Header.StableSize() != 0 { + x.Header.EmitProtobuf(mm.AppendMessage(3)) + } + if len(x.CopiesNumber) != 0 { + mm.AppendUint32s(4, x.CopiesNumber) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *PutRequest_Body_Init) 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", "PutRequest_Body_Init") + } + switch fc.FieldNum { + case 1: // ObjectId + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "ObjectId") + } + x.ObjectId = new(grpc.ObjectID) + if err := x.ObjectId.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + case 2: // Signature + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Signature") + } + x.Signature = new(grpc.Signature) + if err := x.Signature.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + case 3: // Header + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Header") + } + x.Header = new(Header) + if err := x.Header.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + case 4: // CopiesNumber + data, ok := fc.UnpackUint32s(nil) + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "CopiesNumber") + } + x.CopiesNumber = data + } + } + return nil +} +func (x *PutRequest_Body_Init) GetObjectId() *grpc.ObjectID { + if x != nil { + return x.ObjectId + } + return nil +} +func (x *PutRequest_Body_Init) SetObjectId(v *grpc.ObjectID) { + x.ObjectId = v +} +func (x *PutRequest_Body_Init) GetSignature() *grpc.Signature { + if x != nil { + return x.Signature + } + return nil +} +func (x *PutRequest_Body_Init) SetSignature(v *grpc.Signature) { + x.Signature = v +} +func (x *PutRequest_Body_Init) GetHeader() *Header { + if x != nil { + return x.Header + } + return nil +} +func (x *PutRequest_Body_Init) SetHeader(v *Header) { + x.Header = v +} +func (x *PutRequest_Body_Init) GetCopiesNumber() []uint32 { + if x != nil { + return x.CopiesNumber + } + return nil +} +func (x *PutRequest_Body_Init) SetCopiesNumber(v []uint32) { + x.CopiesNumber = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *PutRequest_Body_Init) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *PutRequest_Body_Init) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"objectId\":" + out.RawString(prefix[1:]) + x.ObjectId.MarshalEasyJSON(out) + } + { + const prefix string = ",\"signature\":" + out.RawString(prefix) + x.Signature.MarshalEasyJSON(out) + } + { + const prefix string = ",\"header\":" + out.RawString(prefix) + x.Header.MarshalEasyJSON(out) + } + { + const prefix string = ",\"copiesNumber\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.CopiesNumber { + if i != 0 { + out.RawByte(',') + } + out.Uint32(x.CopiesNumber[i]) + } + out.RawByte(']') + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *PutRequest_Body_Init) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *PutRequest_Body_Init) 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 "objectId": + { + var f *grpc.ObjectID + f = new(grpc.ObjectID) + f.UnmarshalEasyJSON(in) + x.ObjectId = f + } + case "signature": + { + var f *grpc.Signature + f = new(grpc.Signature) + f.UnmarshalEasyJSON(in) + x.Signature = f + } + case "header": + { + var f *Header + f = new(Header) + f.UnmarshalEasyJSON(in) + x.Header = f + } + case "copiesNumber": + { + var f uint32 + var list []uint32 + in.Delim('[') + for !in.IsDelim(']') { + f = in.Uint32() + list = append(list, f) + in.WantComma() + } + x.CopiesNumber = list + in.Delim(']') + } + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} + +type PutRequest_Body struct { + ObjectPart isPutRequest_Body_ObjectPart +} + +var ( + _ encoding.ProtoMarshaler = (*PutRequest_Body)(nil) + _ encoding.ProtoUnmarshaler = (*PutRequest_Body)(nil) + _ json.Marshaler = (*PutRequest_Body)(nil) + _ json.Unmarshaler = (*PutRequest_Body)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *PutRequest_Body) StableSize() (size int) { + if x == nil { + return 0 + } + if inner, ok := x.ObjectPart.(*PutRequest_Body_Init_); ok { + size += proto.NestedStructureSize(1, inner.Init) + } + if inner, ok := x.ObjectPart.(*PutRequest_Body_Chunk); ok { + size += proto.BytesSize(2, inner.Chunk) + } + return size +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *PutRequest_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 *PutRequest_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if inner, ok := x.ObjectPart.(*PutRequest_Body_Init_); ok { + if inner.Init != nil && inner.Init.StableSize() != 0 { + inner.Init.EmitProtobuf(mm.AppendMessage(1)) + } + } + if inner, ok := x.ObjectPart.(*PutRequest_Body_Chunk); ok { + if len(inner.Chunk) != 0 { + mm.AppendBytes(2, inner.Chunk) + } + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *PutRequest_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", "PutRequest_Body") + } + switch fc.FieldNum { + case 1: // Init + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Init") + } + oneofField := &PutRequest_Body_Init_{Init: new(PutRequest_Body_Init)} + if err := oneofField.Init.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + x.ObjectPart = oneofField + case 2: // Chunk + data, ok := fc.Bytes() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Chunk") + } + x.ObjectPart = &PutRequest_Body_Chunk{Chunk: data} + } + } + return nil +} +func (x *PutRequest_Body) GetObjectPart() isPutRequest_Body_ObjectPart { + if x != nil { + return x.ObjectPart + } + return nil +} +func (x *PutRequest_Body) SetObjectPart(v isPutRequest_Body_ObjectPart) { + x.ObjectPart = v +} +func (x *PutRequest_Body) GetInit() *PutRequest_Body_Init { + if xx, ok := x.GetObjectPart().(*PutRequest_Body_Init_); ok { + return xx.Init + } + return nil +} +func (x *PutRequest_Body) SetInit(v *PutRequest_Body_Init) { + x.ObjectPart = &PutRequest_Body_Init_{Init: v} +} +func (x *PutRequest_Body) GetChunk() *PutRequest_Body_Chunk { + if xx, ok := x.GetObjectPart().(*PutRequest_Body_Chunk); ok { + return xx + } + return nil +} +func (x *PutRequest_Body) SetChunk(v *PutRequest_Body_Chunk) { + x.ObjectPart = v +} +func (x *PutRequest_Body_Chunk) GetChunk() []byte { + if x != nil { + return x.Chunk + } + return nil +} +func (x *PutRequest_Body_Chunk) SetChunk(v []byte) { + x.Chunk = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *PutRequest_Body) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *PutRequest_Body) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + switch xx := x.ObjectPart.(type) { + case *PutRequest_Body_Init_: + { + const prefix string = ",\"init\":" + out.RawString(prefix[1:]) + xx.Init.MarshalEasyJSON(out) + } + case *PutRequest_Body_Chunk: + { + const prefix string = ",\"chunk\":" + out.RawString(prefix[1:]) + out.Base64Bytes(xx.Chunk) + } + default: + out.RawString("null") + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *PutRequest_Body) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *PutRequest_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 "init": + xx := new(PutRequest_Body_Init_) + x.ObjectPart = xx + { + var f *PutRequest_Body_Init + f = new(PutRequest_Body_Init) + f.UnmarshalEasyJSON(in) + xx.Init = f + } + case "chunk": + xx := new(PutRequest_Body_Chunk) + x.ObjectPart = xx + { + var f []byte + f = in.Bytes() + xx.Chunk = f + } + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} + +type isPutRequest_Body_ObjectPart interface { + isPutRequest_Body_ObjectPart() +} + +type PutRequest_Body_Init_ struct { + Init *PutRequest_Body_Init +} + +type PutRequest_Body_Chunk struct { + Chunk []byte +} + +func (*PutRequest_Body_Init_) isPutRequest_Body_ObjectPart() {} + +func (*PutRequest_Body_Chunk) isPutRequest_Body_ObjectPart() {} + +type PutRequest struct { + Body *PutRequest_Body `json:"body"` + MetaHeader *grpc1.RequestMetaHeader `json:"metaHeader"` + VerifyHeader *grpc1.RequestVerificationHeader `json:"verifyHeader"` +} + +var ( + _ encoding.ProtoMarshaler = (*PutRequest)(nil) + _ encoding.ProtoUnmarshaler = (*PutRequest)(nil) + _ json.Marshaler = (*PutRequest)(nil) + _ json.Unmarshaler = (*PutRequest)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *PutRequest) 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 *PutRequest) 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 *PutRequest) ReadSignedData(buf []byte) ([]byte, error) { + return x.GetBody().MarshalProtobuf(buf), nil +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *PutRequest) 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 *PutRequest) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if x.Body != nil && x.Body.StableSize() != 0 { + x.Body.EmitProtobuf(mm.AppendMessage(1)) + } + if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 { + x.MetaHeader.EmitProtobuf(mm.AppendMessage(2)) + } + if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 { + x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3)) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *PutRequest) 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", "PutRequest") + } + switch fc.FieldNum { + case 1: // Body + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Body") + } + x.Body = new(PutRequest_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 *PutRequest) GetBody() *PutRequest_Body { + if x != nil { + return x.Body + } + return nil +} +func (x *PutRequest) SetBody(v *PutRequest_Body) { + x.Body = v +} +func (x *PutRequest) GetMetaHeader() *grpc1.RequestMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} +func (x *PutRequest) SetMetaHeader(v *grpc1.RequestMetaHeader) { + x.MetaHeader = v +} +func (x *PutRequest) GetVerifyHeader() *grpc1.RequestVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} +func (x *PutRequest) SetVerifyHeader(v *grpc1.RequestVerificationHeader) { + x.VerifyHeader = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *PutRequest) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *PutRequest) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"body\":" + out.RawString(prefix[1:]) + x.Body.MarshalEasyJSON(out) + } + { + const prefix string = ",\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) + } + { + const prefix string = ",\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *PutRequest) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *PutRequest) 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 *PutRequest_Body + f = new(PutRequest_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 PutResponse_Body struct { + ObjectId *grpc.ObjectID `json:"objectId"` +} + +var ( + _ encoding.ProtoMarshaler = (*PutResponse_Body)(nil) + _ encoding.ProtoUnmarshaler = (*PutResponse_Body)(nil) + _ json.Marshaler = (*PutResponse_Body)(nil) + _ json.Unmarshaler = (*PutResponse_Body)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *PutResponse_Body) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.NestedStructureSize(1, x.ObjectId) + return size +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *PutResponse_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 *PutResponse_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if x.ObjectId != nil && x.ObjectId.StableSize() != 0 { + x.ObjectId.EmitProtobuf(mm.AppendMessage(1)) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *PutResponse_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", "PutResponse_Body") + } + switch fc.FieldNum { + case 1: // ObjectId + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "ObjectId") + } + x.ObjectId = new(grpc.ObjectID) + if err := x.ObjectId.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + } + } + return nil +} +func (x *PutResponse_Body) GetObjectId() *grpc.ObjectID { + if x != nil { + return x.ObjectId + } + return nil +} +func (x *PutResponse_Body) SetObjectId(v *grpc.ObjectID) { + x.ObjectId = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *PutResponse_Body) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *PutResponse_Body) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"objectId\":" + out.RawString(prefix[1:]) + x.ObjectId.MarshalEasyJSON(out) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *PutResponse_Body) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *PutResponse_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 "objectId": + { + var f *grpc.ObjectID + f = new(grpc.ObjectID) + f.UnmarshalEasyJSON(in) + x.ObjectId = f + } + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} + +type PutResponse struct { + Body *PutResponse_Body `json:"body"` + MetaHeader *grpc1.ResponseMetaHeader `json:"metaHeader"` + VerifyHeader *grpc1.ResponseVerificationHeader `json:"verifyHeader"` +} + +var ( + _ encoding.ProtoMarshaler = (*PutResponse)(nil) + _ encoding.ProtoUnmarshaler = (*PutResponse)(nil) + _ json.Marshaler = (*PutResponse)(nil) + _ json.Unmarshaler = (*PutResponse)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *PutResponse) 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 *PutResponse) 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 *PutResponse) ReadSignedData(buf []byte) ([]byte, error) { + return x.GetBody().MarshalProtobuf(buf), nil +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *PutResponse) 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 *PutResponse) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if x.Body != nil && x.Body.StableSize() != 0 { + x.Body.EmitProtobuf(mm.AppendMessage(1)) + } + if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 { + x.MetaHeader.EmitProtobuf(mm.AppendMessage(2)) + } + if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 { + x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3)) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *PutResponse) 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", "PutResponse") + } + switch fc.FieldNum { + case 1: // Body + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Body") + } + x.Body = new(PutResponse_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 *PutResponse) GetBody() *PutResponse_Body { + if x != nil { + return x.Body + } + return nil +} +func (x *PutResponse) SetBody(v *PutResponse_Body) { + x.Body = v +} +func (x *PutResponse) GetMetaHeader() *grpc1.ResponseMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} +func (x *PutResponse) SetMetaHeader(v *grpc1.ResponseMetaHeader) { + x.MetaHeader = v +} +func (x *PutResponse) GetVerifyHeader() *grpc1.ResponseVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} +func (x *PutResponse) SetVerifyHeader(v *grpc1.ResponseVerificationHeader) { + x.VerifyHeader = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *PutResponse) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *PutResponse) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"body\":" + out.RawString(prefix[1:]) + x.Body.MarshalEasyJSON(out) + } + { + const prefix string = ",\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) + } + { + const prefix string = ",\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *PutResponse) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *PutResponse) 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 *PutResponse_Body + f = new(PutResponse_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() + } +} + +type DeleteRequest_Body struct { + Address *grpc.Address `json:"address"` +} + +var ( + _ encoding.ProtoMarshaler = (*DeleteRequest_Body)(nil) + _ encoding.ProtoUnmarshaler = (*DeleteRequest_Body)(nil) + _ json.Marshaler = (*DeleteRequest_Body)(nil) + _ json.Unmarshaler = (*DeleteRequest_Body)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *DeleteRequest_Body) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.NestedStructureSize(1, x.Address) + return size +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *DeleteRequest_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 *DeleteRequest_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if x.Address != nil && x.Address.StableSize() != 0 { + x.Address.EmitProtobuf(mm.AppendMessage(1)) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *DeleteRequest_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", "DeleteRequest_Body") + } + switch fc.FieldNum { + case 1: // Address + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Address") + } + x.Address = new(grpc.Address) + if err := x.Address.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + } + } + return nil +} +func (x *DeleteRequest_Body) GetAddress() *grpc.Address { + if x != nil { + return x.Address + } + return nil +} +func (x *DeleteRequest_Body) SetAddress(v *grpc.Address) { + x.Address = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *DeleteRequest_Body) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *DeleteRequest_Body) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"address\":" + out.RawString(prefix[1:]) + x.Address.MarshalEasyJSON(out) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *DeleteRequest_Body) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *DeleteRequest_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 "address": + { + var f *grpc.Address + f = new(grpc.Address) + f.UnmarshalEasyJSON(in) + x.Address = f + } + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} + +type DeleteRequest struct { + Body *DeleteRequest_Body `json:"body"` + MetaHeader *grpc1.RequestMetaHeader `json:"metaHeader"` + VerifyHeader *grpc1.RequestVerificationHeader `json:"verifyHeader"` +} + +var ( + _ encoding.ProtoMarshaler = (*DeleteRequest)(nil) + _ encoding.ProtoUnmarshaler = (*DeleteRequest)(nil) + _ json.Marshaler = (*DeleteRequest)(nil) + _ json.Unmarshaler = (*DeleteRequest)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *DeleteRequest) 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 *DeleteRequest) 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 *DeleteRequest) ReadSignedData(buf []byte) ([]byte, error) { + return x.GetBody().MarshalProtobuf(buf), nil +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *DeleteRequest) 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 *DeleteRequest) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if x.Body != nil && x.Body.StableSize() != 0 { + x.Body.EmitProtobuf(mm.AppendMessage(1)) + } + if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 { + x.MetaHeader.EmitProtobuf(mm.AppendMessage(2)) + } + if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 { + x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3)) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *DeleteRequest) 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", "DeleteRequest") + } + switch fc.FieldNum { + case 1: // Body + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Body") + } + x.Body = new(DeleteRequest_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 *DeleteRequest) GetBody() *DeleteRequest_Body { + if x != nil { + return x.Body + } + return nil +} +func (x *DeleteRequest) SetBody(v *DeleteRequest_Body) { + x.Body = v +} +func (x *DeleteRequest) GetMetaHeader() *grpc1.RequestMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} +func (x *DeleteRequest) SetMetaHeader(v *grpc1.RequestMetaHeader) { + x.MetaHeader = v +} +func (x *DeleteRequest) GetVerifyHeader() *grpc1.RequestVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} +func (x *DeleteRequest) SetVerifyHeader(v *grpc1.RequestVerificationHeader) { + x.VerifyHeader = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *DeleteRequest) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *DeleteRequest) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"body\":" + out.RawString(prefix[1:]) + x.Body.MarshalEasyJSON(out) + } + { + const prefix string = ",\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) + } + { + const prefix string = ",\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *DeleteRequest) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *DeleteRequest) 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 *DeleteRequest_Body + f = new(DeleteRequest_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 DeleteResponse_Body struct { + Tombstone *grpc.Address `json:"tombstone"` +} + +var ( + _ encoding.ProtoMarshaler = (*DeleteResponse_Body)(nil) + _ encoding.ProtoUnmarshaler = (*DeleteResponse_Body)(nil) + _ json.Marshaler = (*DeleteResponse_Body)(nil) + _ json.Unmarshaler = (*DeleteResponse_Body)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *DeleteResponse_Body) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.NestedStructureSize(1, x.Tombstone) + return size +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *DeleteResponse_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 *DeleteResponse_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if x.Tombstone != nil && x.Tombstone.StableSize() != 0 { + x.Tombstone.EmitProtobuf(mm.AppendMessage(1)) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *DeleteResponse_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", "DeleteResponse_Body") + } + switch fc.FieldNum { + case 1: // Tombstone + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Tombstone") + } + x.Tombstone = new(grpc.Address) + if err := x.Tombstone.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + } + } + return nil +} +func (x *DeleteResponse_Body) GetTombstone() *grpc.Address { + if x != nil { + return x.Tombstone + } + return nil +} +func (x *DeleteResponse_Body) SetTombstone(v *grpc.Address) { + x.Tombstone = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *DeleteResponse_Body) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *DeleteResponse_Body) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"tombstone\":" + out.RawString(prefix[1:]) + x.Tombstone.MarshalEasyJSON(out) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *DeleteResponse_Body) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *DeleteResponse_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 "tombstone": + { + var f *grpc.Address + f = new(grpc.Address) + f.UnmarshalEasyJSON(in) + x.Tombstone = f + } + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} + +type DeleteResponse struct { + Body *DeleteResponse_Body `json:"body"` + MetaHeader *grpc1.ResponseMetaHeader `json:"metaHeader"` + VerifyHeader *grpc1.ResponseVerificationHeader `json:"verifyHeader"` +} + +var ( + _ encoding.ProtoMarshaler = (*DeleteResponse)(nil) + _ encoding.ProtoUnmarshaler = (*DeleteResponse)(nil) + _ json.Marshaler = (*DeleteResponse)(nil) + _ json.Unmarshaler = (*DeleteResponse)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *DeleteResponse) 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 *DeleteResponse) 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 *DeleteResponse) ReadSignedData(buf []byte) ([]byte, error) { + return x.GetBody().MarshalProtobuf(buf), nil +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *DeleteResponse) 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 *DeleteResponse) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if x.Body != nil && x.Body.StableSize() != 0 { + x.Body.EmitProtobuf(mm.AppendMessage(1)) + } + if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 { + x.MetaHeader.EmitProtobuf(mm.AppendMessage(2)) + } + if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 { + x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3)) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *DeleteResponse) 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", "DeleteResponse") + } + switch fc.FieldNum { + case 1: // Body + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Body") + } + x.Body = new(DeleteResponse_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 *DeleteResponse) GetBody() *DeleteResponse_Body { + if x != nil { + return x.Body + } + return nil +} +func (x *DeleteResponse) SetBody(v *DeleteResponse_Body) { + x.Body = v +} +func (x *DeleteResponse) GetMetaHeader() *grpc1.ResponseMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} +func (x *DeleteResponse) SetMetaHeader(v *grpc1.ResponseMetaHeader) { + x.MetaHeader = v +} +func (x *DeleteResponse) GetVerifyHeader() *grpc1.ResponseVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} +func (x *DeleteResponse) SetVerifyHeader(v *grpc1.ResponseVerificationHeader) { + x.VerifyHeader = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *DeleteResponse) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *DeleteResponse) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"body\":" + out.RawString(prefix[1:]) + x.Body.MarshalEasyJSON(out) + } + { + const prefix string = ",\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) + } + { + const prefix string = ",\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *DeleteResponse) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *DeleteResponse) 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 *DeleteResponse_Body + f = new(DeleteResponse_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() + } +} + +type HeadRequest_Body struct { + Address *grpc.Address `json:"address"` + MainOnly bool `json:"mainOnly"` + Raw bool `json:"raw"` +} + +var ( + _ encoding.ProtoMarshaler = (*HeadRequest_Body)(nil) + _ encoding.ProtoUnmarshaler = (*HeadRequest_Body)(nil) + _ json.Marshaler = (*HeadRequest_Body)(nil) + _ json.Unmarshaler = (*HeadRequest_Body)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *HeadRequest_Body) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.NestedStructureSize(1, x.Address) + size += proto.BoolSize(2, x.MainOnly) + size += proto.BoolSize(3, x.Raw) + return size +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *HeadRequest_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 *HeadRequest_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if x.Address != nil && x.Address.StableSize() != 0 { + x.Address.EmitProtobuf(mm.AppendMessage(1)) + } + if x.MainOnly { + mm.AppendBool(2, x.MainOnly) + } + if x.Raw { + mm.AppendBool(3, x.Raw) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *HeadRequest_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", "HeadRequest_Body") + } + switch fc.FieldNum { + case 1: // Address + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Address") + } + x.Address = new(grpc.Address) + if err := x.Address.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + case 2: // MainOnly + data, ok := fc.Bool() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "MainOnly") + } + x.MainOnly = data + case 3: // Raw + data, ok := fc.Bool() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Raw") + } + x.Raw = data + } + } + return nil +} +func (x *HeadRequest_Body) GetAddress() *grpc.Address { + if x != nil { + return x.Address + } + return nil +} +func (x *HeadRequest_Body) SetAddress(v *grpc.Address) { + x.Address = v +} +func (x *HeadRequest_Body) GetMainOnly() bool { + if x != nil { + return x.MainOnly + } + return false +} +func (x *HeadRequest_Body) SetMainOnly(v bool) { + x.MainOnly = v +} +func (x *HeadRequest_Body) GetRaw() bool { + if x != nil { + return x.Raw + } + return false +} +func (x *HeadRequest_Body) SetRaw(v bool) { + x.Raw = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *HeadRequest_Body) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *HeadRequest_Body) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"address\":" + out.RawString(prefix[1:]) + x.Address.MarshalEasyJSON(out) + } + { + const prefix string = ",\"mainOnly\":" + out.RawString(prefix) + out.Bool(x.MainOnly) + } + { + const prefix string = ",\"raw\":" + out.RawString(prefix) + out.Bool(x.Raw) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *HeadRequest_Body) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *HeadRequest_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 "address": + { + var f *grpc.Address + f = new(grpc.Address) + f.UnmarshalEasyJSON(in) + x.Address = f + } + case "mainOnly": + { + var f bool + f = in.Bool() + x.MainOnly = f + } + case "raw": + { + var f bool + f = in.Bool() + x.Raw = f + } + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} + +type HeadRequest struct { + Body *HeadRequest_Body `json:"body"` + MetaHeader *grpc1.RequestMetaHeader `json:"metaHeader"` + VerifyHeader *grpc1.RequestVerificationHeader `json:"verifyHeader"` +} + +var ( + _ encoding.ProtoMarshaler = (*HeadRequest)(nil) + _ encoding.ProtoUnmarshaler = (*HeadRequest)(nil) + _ json.Marshaler = (*HeadRequest)(nil) + _ json.Unmarshaler = (*HeadRequest)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *HeadRequest) 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 *HeadRequest) 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 *HeadRequest) ReadSignedData(buf []byte) ([]byte, error) { + return x.GetBody().MarshalProtobuf(buf), nil +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *HeadRequest) 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 *HeadRequest) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if x.Body != nil && x.Body.StableSize() != 0 { + x.Body.EmitProtobuf(mm.AppendMessage(1)) + } + if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 { + x.MetaHeader.EmitProtobuf(mm.AppendMessage(2)) + } + if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 { + x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3)) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *HeadRequest) 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", "HeadRequest") + } + switch fc.FieldNum { + case 1: // Body + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Body") + } + x.Body = new(HeadRequest_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 *HeadRequest) GetBody() *HeadRequest_Body { + if x != nil { + return x.Body + } + return nil +} +func (x *HeadRequest) SetBody(v *HeadRequest_Body) { + x.Body = v +} +func (x *HeadRequest) GetMetaHeader() *grpc1.RequestMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} +func (x *HeadRequest) SetMetaHeader(v *grpc1.RequestMetaHeader) { + x.MetaHeader = v +} +func (x *HeadRequest) GetVerifyHeader() *grpc1.RequestVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} +func (x *HeadRequest) SetVerifyHeader(v *grpc1.RequestVerificationHeader) { + x.VerifyHeader = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *HeadRequest) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *HeadRequest) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"body\":" + out.RawString(prefix[1:]) + x.Body.MarshalEasyJSON(out) + } + { + const prefix string = ",\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) + } + { + const prefix string = ",\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *HeadRequest) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *HeadRequest) 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 *HeadRequest_Body + f = new(HeadRequest_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 HeaderWithSignature struct { + Header *Header `json:"header"` + Signature *grpc.Signature `json:"signature"` +} + +var ( + _ encoding.ProtoMarshaler = (*HeaderWithSignature)(nil) + _ encoding.ProtoUnmarshaler = (*HeaderWithSignature)(nil) + _ json.Marshaler = (*HeaderWithSignature)(nil) + _ json.Unmarshaler = (*HeaderWithSignature)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *HeaderWithSignature) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.NestedStructureSize(1, x.Header) + size += proto.NestedStructureSize(2, x.Signature) + return size +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *HeaderWithSignature) 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 *HeaderWithSignature) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if x.Header != nil && x.Header.StableSize() != 0 { + x.Header.EmitProtobuf(mm.AppendMessage(1)) + } + if x.Signature != nil && x.Signature.StableSize() != 0 { + x.Signature.EmitProtobuf(mm.AppendMessage(2)) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *HeaderWithSignature) 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", "HeaderWithSignature") + } + switch fc.FieldNum { + case 1: // Header + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Header") + } + x.Header = new(Header) + if err := x.Header.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + case 2: // Signature + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Signature") + } + x.Signature = new(grpc.Signature) + if err := x.Signature.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + } + } + return nil +} +func (x *HeaderWithSignature) GetHeader() *Header { + if x != nil { + return x.Header + } + return nil +} +func (x *HeaderWithSignature) SetHeader(v *Header) { + x.Header = v +} +func (x *HeaderWithSignature) GetSignature() *grpc.Signature { + if x != nil { + return x.Signature + } + return nil +} +func (x *HeaderWithSignature) SetSignature(v *grpc.Signature) { + x.Signature = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *HeaderWithSignature) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *HeaderWithSignature) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"header\":" + out.RawString(prefix[1:]) + x.Header.MarshalEasyJSON(out) + } + { + const prefix string = ",\"signature\":" + out.RawString(prefix) + x.Signature.MarshalEasyJSON(out) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *HeaderWithSignature) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *HeaderWithSignature) 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 "header": + { + var f *Header + f = new(Header) + f.UnmarshalEasyJSON(in) + x.Header = f + } + case "signature": + { + var f *grpc.Signature + f = new(grpc.Signature) + f.UnmarshalEasyJSON(in) + x.Signature = f + } + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} + +type HeadResponse_Body struct { + Head isHeadResponse_Body_Head +} + +var ( + _ encoding.ProtoMarshaler = (*HeadResponse_Body)(nil) + _ encoding.ProtoUnmarshaler = (*HeadResponse_Body)(nil) + _ json.Marshaler = (*HeadResponse_Body)(nil) + _ json.Unmarshaler = (*HeadResponse_Body)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *HeadResponse_Body) StableSize() (size int) { + if x == nil { + return 0 + } + if inner, ok := x.Head.(*HeadResponse_Body_Header); ok { + size += proto.NestedStructureSize(1, inner.Header) + } + if inner, ok := x.Head.(*HeadResponse_Body_ShortHeader); ok { + size += proto.NestedStructureSize(2, inner.ShortHeader) + } + if inner, ok := x.Head.(*HeadResponse_Body_SplitInfo); ok { + size += proto.NestedStructureSize(3, inner.SplitInfo) + } + if inner, ok := x.Head.(*HeadResponse_Body_EcInfo); ok { + size += proto.NestedStructureSize(4, inner.EcInfo) + } + return size +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *HeadResponse_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 *HeadResponse_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if inner, ok := x.Head.(*HeadResponse_Body_Header); ok { + if inner.Header != nil && inner.Header.StableSize() != 0 { + inner.Header.EmitProtobuf(mm.AppendMessage(1)) + } + } + if inner, ok := x.Head.(*HeadResponse_Body_ShortHeader); ok { + if inner.ShortHeader != nil && inner.ShortHeader.StableSize() != 0 { + inner.ShortHeader.EmitProtobuf(mm.AppendMessage(2)) + } + } + if inner, ok := x.Head.(*HeadResponse_Body_SplitInfo); ok { + if inner.SplitInfo != nil && inner.SplitInfo.StableSize() != 0 { + inner.SplitInfo.EmitProtobuf(mm.AppendMessage(3)) + } + } + if inner, ok := x.Head.(*HeadResponse_Body_EcInfo); ok { + if inner.EcInfo != nil && inner.EcInfo.StableSize() != 0 { + inner.EcInfo.EmitProtobuf(mm.AppendMessage(4)) + } + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *HeadResponse_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", "HeadResponse_Body") + } + switch fc.FieldNum { + case 1: // Header + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Header") + } + oneofField := &HeadResponse_Body_Header{Header: new(HeaderWithSignature)} + if err := oneofField.Header.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + x.Head = oneofField + case 2: // ShortHeader + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "ShortHeader") + } + oneofField := &HeadResponse_Body_ShortHeader{ShortHeader: new(ShortHeader)} + if err := oneofField.ShortHeader.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + x.Head = oneofField + case 3: // SplitInfo + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "SplitInfo") + } + oneofField := &HeadResponse_Body_SplitInfo{SplitInfo: new(SplitInfo)} + if err := oneofField.SplitInfo.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + x.Head = oneofField + case 4: // EcInfo + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "EcInfo") + } + oneofField := &HeadResponse_Body_EcInfo{EcInfo: new(ECInfo)} + if err := oneofField.EcInfo.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + x.Head = oneofField + } + } + return nil +} +func (x *HeadResponse_Body) GetHead() isHeadResponse_Body_Head { + if x != nil { + return x.Head + } + return nil +} +func (x *HeadResponse_Body) SetHead(v isHeadResponse_Body_Head) { + x.Head = v +} +func (x *HeadResponse_Body) GetHeader() *HeaderWithSignature { + if xx, ok := x.GetHead().(*HeadResponse_Body_Header); ok { + return xx.Header + } + return nil +} +func (x *HeadResponse_Body) SetHeader(v *HeaderWithSignature) { + x.Head = &HeadResponse_Body_Header{Header: v} +} +func (x *HeadResponse_Body) GetShortHeader() *ShortHeader { + if xx, ok := x.GetHead().(*HeadResponse_Body_ShortHeader); ok { + return xx.ShortHeader + } + return nil +} +func (x *HeadResponse_Body) SetShortHeader(v *ShortHeader) { + x.Head = &HeadResponse_Body_ShortHeader{ShortHeader: v} +} +func (x *HeadResponse_Body) GetSplitInfo() *SplitInfo { + if xx, ok := x.GetHead().(*HeadResponse_Body_SplitInfo); ok { + return xx.SplitInfo + } + return nil +} +func (x *HeadResponse_Body) SetSplitInfo(v *SplitInfo) { + x.Head = &HeadResponse_Body_SplitInfo{SplitInfo: v} +} +func (x *HeadResponse_Body) GetEcInfo() *ECInfo { + if xx, ok := x.GetHead().(*HeadResponse_Body_EcInfo); ok { + return xx.EcInfo + } + return nil +} +func (x *HeadResponse_Body) SetEcInfo(v *ECInfo) { + x.Head = &HeadResponse_Body_EcInfo{EcInfo: v} +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *HeadResponse_Body) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *HeadResponse_Body) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + switch xx := x.Head.(type) { + case *HeadResponse_Body_Header: + { + const prefix string = ",\"header\":" + out.RawString(prefix[1:]) + xx.Header.MarshalEasyJSON(out) + } + case *HeadResponse_Body_ShortHeader: + { + const prefix string = ",\"shortHeader\":" + out.RawString(prefix[1:]) + xx.ShortHeader.MarshalEasyJSON(out) + } + case *HeadResponse_Body_SplitInfo: + { + const prefix string = ",\"splitInfo\":" + out.RawString(prefix[1:]) + xx.SplitInfo.MarshalEasyJSON(out) + } + case *HeadResponse_Body_EcInfo: + { + const prefix string = ",\"ecInfo\":" + out.RawString(prefix[1:]) + xx.EcInfo.MarshalEasyJSON(out) + } + default: + out.RawString("null") + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *HeadResponse_Body) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *HeadResponse_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 "header": + xx := new(HeadResponse_Body_Header) + x.Head = xx + { + var f *HeaderWithSignature + f = new(HeaderWithSignature) + f.UnmarshalEasyJSON(in) + xx.Header = f + } + case "shortHeader": + xx := new(HeadResponse_Body_ShortHeader) + x.Head = xx + { + var f *ShortHeader + f = new(ShortHeader) + f.UnmarshalEasyJSON(in) + xx.ShortHeader = f + } + case "splitInfo": + xx := new(HeadResponse_Body_SplitInfo) + x.Head = xx + { + var f *SplitInfo + f = new(SplitInfo) + f.UnmarshalEasyJSON(in) + xx.SplitInfo = f + } + case "ecInfo": + xx := new(HeadResponse_Body_EcInfo) + x.Head = xx + { + var f *ECInfo + f = new(ECInfo) + f.UnmarshalEasyJSON(in) + xx.EcInfo = f + } + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} + +type isHeadResponse_Body_Head interface { + isHeadResponse_Body_Head() +} + +type HeadResponse_Body_Header struct { + Header *HeaderWithSignature +} + +type HeadResponse_Body_ShortHeader struct { + ShortHeader *ShortHeader +} + +type HeadResponse_Body_SplitInfo struct { + SplitInfo *SplitInfo +} + +type HeadResponse_Body_EcInfo struct { + EcInfo *ECInfo +} + +func (*HeadResponse_Body_Header) isHeadResponse_Body_Head() {} + +func (*HeadResponse_Body_ShortHeader) isHeadResponse_Body_Head() {} + +func (*HeadResponse_Body_SplitInfo) isHeadResponse_Body_Head() {} + +func (*HeadResponse_Body_EcInfo) isHeadResponse_Body_Head() {} + +type HeadResponse struct { + Body *HeadResponse_Body `json:"body"` + MetaHeader *grpc1.ResponseMetaHeader `json:"metaHeader"` + VerifyHeader *grpc1.ResponseVerificationHeader `json:"verifyHeader"` +} + +var ( + _ encoding.ProtoMarshaler = (*HeadResponse)(nil) + _ encoding.ProtoUnmarshaler = (*HeadResponse)(nil) + _ json.Marshaler = (*HeadResponse)(nil) + _ json.Unmarshaler = (*HeadResponse)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *HeadResponse) 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 *HeadResponse) 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 *HeadResponse) ReadSignedData(buf []byte) ([]byte, error) { + return x.GetBody().MarshalProtobuf(buf), nil +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *HeadResponse) 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 *HeadResponse) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if x.Body != nil && x.Body.StableSize() != 0 { + x.Body.EmitProtobuf(mm.AppendMessage(1)) + } + if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 { + x.MetaHeader.EmitProtobuf(mm.AppendMessage(2)) + } + if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 { + x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3)) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *HeadResponse) 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", "HeadResponse") + } + switch fc.FieldNum { + case 1: // Body + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Body") + } + x.Body = new(HeadResponse_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 *HeadResponse) GetBody() *HeadResponse_Body { + if x != nil { + return x.Body + } + return nil +} +func (x *HeadResponse) SetBody(v *HeadResponse_Body) { + x.Body = v +} +func (x *HeadResponse) GetMetaHeader() *grpc1.ResponseMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} +func (x *HeadResponse) SetMetaHeader(v *grpc1.ResponseMetaHeader) { + x.MetaHeader = v +} +func (x *HeadResponse) GetVerifyHeader() *grpc1.ResponseVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} +func (x *HeadResponse) SetVerifyHeader(v *grpc1.ResponseVerificationHeader) { + x.VerifyHeader = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *HeadResponse) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *HeadResponse) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"body\":" + out.RawString(prefix[1:]) + x.Body.MarshalEasyJSON(out) + } + { + const prefix string = ",\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) + } + { + const prefix string = ",\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *HeadResponse) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *HeadResponse) 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 *HeadResponse_Body + f = new(HeadResponse_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() + } +} + +type SearchRequest_Body_Filter struct { + MatchType MatchType `json:"matchType"` + Key string `json:"key"` + Value string `json:"value"` +} + +var ( + _ encoding.ProtoMarshaler = (*SearchRequest_Body_Filter)(nil) + _ encoding.ProtoUnmarshaler = (*SearchRequest_Body_Filter)(nil) + _ json.Marshaler = (*SearchRequest_Body_Filter)(nil) + _ json.Unmarshaler = (*SearchRequest_Body_Filter)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *SearchRequest_Body_Filter) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.EnumSize(1, int32(x.MatchType)) + size += proto.StringSize(2, x.Key) + size += proto.StringSize(3, x.Value) + return size +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *SearchRequest_Body_Filter) 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 *SearchRequest_Body_Filter) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if int32(x.MatchType) != 0 { + mm.AppendInt32(1, int32(x.MatchType)) + } + if len(x.Key) != 0 { + mm.AppendString(2, x.Key) + } + if len(x.Value) != 0 { + mm.AppendString(3, x.Value) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *SearchRequest_Body_Filter) 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", "SearchRequest_Body_Filter") + } + switch fc.FieldNum { + case 1: // MatchType + data, ok := fc.Int32() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "MatchType") + } + x.MatchType = MatchType(data) + case 2: // Key + data, ok := fc.String() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Key") + } + x.Key = data + case 3: // Value + data, ok := fc.String() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Value") + } + x.Value = data + } + } + return nil +} +func (x *SearchRequest_Body_Filter) GetMatchType() MatchType { + if x != nil { + return x.MatchType + } + return 0 +} +func (x *SearchRequest_Body_Filter) SetMatchType(v MatchType) { + x.MatchType = v +} +func (x *SearchRequest_Body_Filter) GetKey() string { + if x != nil { + return x.Key + } + return "" +} +func (x *SearchRequest_Body_Filter) SetKey(v string) { + x.Key = v +} +func (x *SearchRequest_Body_Filter) GetValue() string { + if x != nil { + return x.Value + } + return "" +} +func (x *SearchRequest_Body_Filter) SetValue(v string) { + x.Value = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *SearchRequest_Body_Filter) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *SearchRequest_Body_Filter) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"matchType\":" + out.RawString(prefix[1:]) + out.Int32(int32(x.MatchType)) + } + { + const prefix string = ",\"key\":" + out.RawString(prefix) + out.String(x.Key) + } + { + const prefix string = ",\"value\":" + out.RawString(prefix) + out.String(x.Value) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *SearchRequest_Body_Filter) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *SearchRequest_Body_Filter) 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 "matchType": + { + var f MatchType + var parsedValue MatchType + switch v := in.Interface().(type) { + case string: + if vv, ok := MatchType_value[v]; ok { + parsedValue = MatchType(vv) + break + } + vv, err := strconv.ParseInt(v, 10, 32) + if err != nil { + in.AddError(err) + return + } + parsedValue = MatchType(vv) + case float64: + parsedValue = MatchType(v) + } + f = parsedValue + x.MatchType = f + } + 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 SearchRequest_Body struct { + ContainerId *grpc.ContainerID `json:"containerId"` + Version uint32 `json:"version"` + Filters []*SearchRequest_Body_Filter `json:"filters"` +} + +var ( + _ encoding.ProtoMarshaler = (*SearchRequest_Body)(nil) + _ encoding.ProtoUnmarshaler = (*SearchRequest_Body)(nil) + _ json.Marshaler = (*SearchRequest_Body)(nil) + _ json.Unmarshaler = (*SearchRequest_Body)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *SearchRequest_Body) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.NestedStructureSize(1, x.ContainerId) + size += proto.UInt32Size(2, x.Version) + for i := range x.Filters { + size += proto.NestedStructureSize(3, x.Filters[i]) + } + return size +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *SearchRequest_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 *SearchRequest_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if x.ContainerId != nil && x.ContainerId.StableSize() != 0 { + x.ContainerId.EmitProtobuf(mm.AppendMessage(1)) + } + if x.Version != 0 { + mm.AppendUint32(2, x.Version) + } + for i := range x.Filters { + if x.Filters[i] != nil && x.Filters[i].StableSize() != 0 { + x.Filters[i].EmitProtobuf(mm.AppendMessage(3)) + } + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *SearchRequest_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", "SearchRequest_Body") + } + switch fc.FieldNum { + case 1: // ContainerId + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "ContainerId") + } + x.ContainerId = new(grpc.ContainerID) + if err := x.ContainerId.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + case 2: // Version + data, ok := fc.Uint32() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Version") + } + x.Version = data + case 3: // Filters + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Filters") + } + x.Filters = append(x.Filters, new(SearchRequest_Body_Filter)) + ff := x.Filters[len(x.Filters)-1] + if err := ff.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + } + } + return nil +} +func (x *SearchRequest_Body) GetContainerId() *grpc.ContainerID { + if x != nil { + return x.ContainerId + } + return nil +} +func (x *SearchRequest_Body) SetContainerId(v *grpc.ContainerID) { + x.ContainerId = v +} +func (x *SearchRequest_Body) GetVersion() uint32 { + if x != nil { + return x.Version + } + return 0 +} +func (x *SearchRequest_Body) SetVersion(v uint32) { + x.Version = v +} +func (x *SearchRequest_Body) GetFilters() []*SearchRequest_Body_Filter { + if x != nil { + return x.Filters + } + return nil +} +func (x *SearchRequest_Body) SetFilters(v []*SearchRequest_Body_Filter) { + x.Filters = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *SearchRequest_Body) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *SearchRequest_Body) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"containerId\":" + out.RawString(prefix[1:]) + x.ContainerId.MarshalEasyJSON(out) + } + { + const prefix string = ",\"version\":" + out.RawString(prefix) + out.Uint32(x.Version) + } + { + const prefix string = ",\"filters\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.Filters { + if i != 0 { + out.RawByte(',') + } + x.Filters[i].MarshalEasyJSON(out) + } + out.RawByte(']') + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *SearchRequest_Body) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *SearchRequest_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 "containerId": + { + var f *grpc.ContainerID + f = new(grpc.ContainerID) + f.UnmarshalEasyJSON(in) + x.ContainerId = f + } + case "version": + { + var f uint32 + f = in.Uint32() + x.Version = f + } + case "filters": + { + var f *SearchRequest_Body_Filter + var list []*SearchRequest_Body_Filter + in.Delim('[') + for !in.IsDelim(']') { + f = new(SearchRequest_Body_Filter) + f.UnmarshalEasyJSON(in) + list = append(list, f) + in.WantComma() + } + x.Filters = list + in.Delim(']') + } + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} + +type SearchRequest struct { + Body *SearchRequest_Body `json:"body"` + MetaHeader *grpc1.RequestMetaHeader `json:"metaHeader"` + VerifyHeader *grpc1.RequestVerificationHeader `json:"verifyHeader"` +} + +var ( + _ encoding.ProtoMarshaler = (*SearchRequest)(nil) + _ encoding.ProtoUnmarshaler = (*SearchRequest)(nil) + _ json.Marshaler = (*SearchRequest)(nil) + _ json.Unmarshaler = (*SearchRequest)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *SearchRequest) 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 *SearchRequest) 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 *SearchRequest) ReadSignedData(buf []byte) ([]byte, error) { + return x.GetBody().MarshalProtobuf(buf), nil +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *SearchRequest) 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 *SearchRequest) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if x.Body != nil && x.Body.StableSize() != 0 { + x.Body.EmitProtobuf(mm.AppendMessage(1)) + } + if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 { + x.MetaHeader.EmitProtobuf(mm.AppendMessage(2)) + } + if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 { + x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3)) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *SearchRequest) 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", "SearchRequest") + } + switch fc.FieldNum { + case 1: // Body + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Body") + } + x.Body = new(SearchRequest_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 *SearchRequest) GetBody() *SearchRequest_Body { + if x != nil { + return x.Body + } + return nil +} +func (x *SearchRequest) SetBody(v *SearchRequest_Body) { + x.Body = v +} +func (x *SearchRequest) GetMetaHeader() *grpc1.RequestMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} +func (x *SearchRequest) SetMetaHeader(v *grpc1.RequestMetaHeader) { + x.MetaHeader = v +} +func (x *SearchRequest) GetVerifyHeader() *grpc1.RequestVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} +func (x *SearchRequest) SetVerifyHeader(v *grpc1.RequestVerificationHeader) { + x.VerifyHeader = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *SearchRequest) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *SearchRequest) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"body\":" + out.RawString(prefix[1:]) + x.Body.MarshalEasyJSON(out) + } + { + const prefix string = ",\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) + } + { + const prefix string = ",\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *SearchRequest) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *SearchRequest) 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 *SearchRequest_Body + f = new(SearchRequest_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 SearchResponse_Body struct { + IdList []*grpc.ObjectID `json:"idList"` +} + +var ( + _ encoding.ProtoMarshaler = (*SearchResponse_Body)(nil) + _ encoding.ProtoUnmarshaler = (*SearchResponse_Body)(nil) + _ json.Marshaler = (*SearchResponse_Body)(nil) + _ json.Unmarshaler = (*SearchResponse_Body)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *SearchResponse_Body) StableSize() (size int) { + if x == nil { + return 0 + } + for i := range x.IdList { + size += proto.NestedStructureSize(1, x.IdList[i]) + } + return size +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *SearchResponse_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 *SearchResponse_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + for i := range x.IdList { + if x.IdList[i] != nil && x.IdList[i].StableSize() != 0 { + x.IdList[i].EmitProtobuf(mm.AppendMessage(1)) + } + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *SearchResponse_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", "SearchResponse_Body") + } + switch fc.FieldNum { + case 1: // IdList + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "IdList") + } + x.IdList = append(x.IdList, new(grpc.ObjectID)) + ff := x.IdList[len(x.IdList)-1] + if err := ff.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + } + } + return nil +} +func (x *SearchResponse_Body) GetIdList() []*grpc.ObjectID { + if x != nil { + return x.IdList + } + return nil +} +func (x *SearchResponse_Body) SetIdList(v []*grpc.ObjectID) { + x.IdList = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *SearchResponse_Body) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *SearchResponse_Body) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"idList\":" + out.RawString(prefix[1:]) + out.RawByte('[') + for i := range x.IdList { + if i != 0 { + out.RawByte(',') + } + x.IdList[i].MarshalEasyJSON(out) + } + out.RawByte(']') + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *SearchResponse_Body) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *SearchResponse_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 "idList": + { + var f *grpc.ObjectID + var list []*grpc.ObjectID + in.Delim('[') + for !in.IsDelim(']') { + f = new(grpc.ObjectID) + f.UnmarshalEasyJSON(in) + list = append(list, f) + in.WantComma() + } + x.IdList = list + in.Delim(']') + } + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} + +type SearchResponse struct { + Body *SearchResponse_Body `json:"body"` + MetaHeader *grpc1.ResponseMetaHeader `json:"metaHeader"` + VerifyHeader *grpc1.ResponseVerificationHeader `json:"verifyHeader"` +} + +var ( + _ encoding.ProtoMarshaler = (*SearchResponse)(nil) + _ encoding.ProtoUnmarshaler = (*SearchResponse)(nil) + _ json.Marshaler = (*SearchResponse)(nil) + _ json.Unmarshaler = (*SearchResponse)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *SearchResponse) 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 *SearchResponse) 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 *SearchResponse) ReadSignedData(buf []byte) ([]byte, error) { + return x.GetBody().MarshalProtobuf(buf), nil +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *SearchResponse) 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 *SearchResponse) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if x.Body != nil && x.Body.StableSize() != 0 { + x.Body.EmitProtobuf(mm.AppendMessage(1)) + } + if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 { + x.MetaHeader.EmitProtobuf(mm.AppendMessage(2)) + } + if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 { + x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3)) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *SearchResponse) 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", "SearchResponse") + } + switch fc.FieldNum { + case 1: // Body + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Body") + } + x.Body = new(SearchResponse_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 *SearchResponse) GetBody() *SearchResponse_Body { + if x != nil { + return x.Body + } + return nil +} +func (x *SearchResponse) SetBody(v *SearchResponse_Body) { + x.Body = v +} +func (x *SearchResponse) GetMetaHeader() *grpc1.ResponseMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} +func (x *SearchResponse) SetMetaHeader(v *grpc1.ResponseMetaHeader) { + x.MetaHeader = v +} +func (x *SearchResponse) GetVerifyHeader() *grpc1.ResponseVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} +func (x *SearchResponse) SetVerifyHeader(v *grpc1.ResponseVerificationHeader) { + x.VerifyHeader = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *SearchResponse) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *SearchResponse) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"body\":" + out.RawString(prefix[1:]) + x.Body.MarshalEasyJSON(out) + } + { + const prefix string = ",\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) + } + { + const prefix string = ",\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *SearchResponse) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *SearchResponse) 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 *SearchResponse_Body + f = new(SearchResponse_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() + } +} + +type Range struct { + Offset uint64 `json:"offset"` + Length uint64 `json:"length"` +} + +var ( + _ encoding.ProtoMarshaler = (*Range)(nil) + _ encoding.ProtoUnmarshaler = (*Range)(nil) + _ json.Marshaler = (*Range)(nil) + _ json.Unmarshaler = (*Range)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *Range) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.UInt64Size(1, x.Offset) + size += proto.UInt64Size(2, x.Length) + return size +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *Range) 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 *Range) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if x.Offset != 0 { + mm.AppendUint64(1, x.Offset) + } + if x.Length != 0 { + mm.AppendUint64(2, x.Length) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *Range) 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", "Range") + } + switch fc.FieldNum { + case 1: // Offset + data, ok := fc.Uint64() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Offset") + } + x.Offset = data + case 2: // Length + data, ok := fc.Uint64() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Length") + } + x.Length = data + } + } + return nil +} +func (x *Range) GetOffset() uint64 { + if x != nil { + return x.Offset + } + return 0 +} +func (x *Range) SetOffset(v uint64) { + x.Offset = v +} +func (x *Range) GetLength() uint64 { + if x != nil { + return x.Length + } + return 0 +} +func (x *Range) SetLength(v uint64) { + x.Length = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *Range) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *Range) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"offset\":" + out.RawString(prefix[1:]) + out.Uint64(x.Offset) + } + { + const prefix string = ",\"length\":" + out.RawString(prefix) + out.Uint64(x.Length) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *Range) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *Range) 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 "offset": + { + var f uint64 + f = in.Uint64() + x.Offset = f + } + case "length": + { + var f uint64 + f = in.Uint64() + x.Length = f + } + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} + +type GetRangeRequest_Body struct { + Address *grpc.Address `json:"address"` + Range *Range `json:"range"` + Raw bool `json:"raw"` +} + +var ( + _ encoding.ProtoMarshaler = (*GetRangeRequest_Body)(nil) + _ encoding.ProtoUnmarshaler = (*GetRangeRequest_Body)(nil) + _ json.Marshaler = (*GetRangeRequest_Body)(nil) + _ json.Unmarshaler = (*GetRangeRequest_Body)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *GetRangeRequest_Body) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.NestedStructureSize(1, x.Address) + size += proto.NestedStructureSize(2, x.Range) + size += proto.BoolSize(3, x.Raw) + return size +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *GetRangeRequest_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 *GetRangeRequest_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if x.Address != nil && x.Address.StableSize() != 0 { + x.Address.EmitProtobuf(mm.AppendMessage(1)) + } + if x.Range != nil && x.Range.StableSize() != 0 { + x.Range.EmitProtobuf(mm.AppendMessage(2)) + } + if x.Raw { + mm.AppendBool(3, x.Raw) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *GetRangeRequest_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", "GetRangeRequest_Body") + } + switch fc.FieldNum { + case 1: // Address + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Address") + } + x.Address = new(grpc.Address) + if err := x.Address.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + case 2: // Range + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Range") + } + x.Range = new(Range) + if err := x.Range.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + case 3: // Raw + data, ok := fc.Bool() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Raw") + } + x.Raw = data + } + } + return nil +} +func (x *GetRangeRequest_Body) GetAddress() *grpc.Address { + if x != nil { + return x.Address + } + return nil +} +func (x *GetRangeRequest_Body) SetAddress(v *grpc.Address) { + x.Address = v +} +func (x *GetRangeRequest_Body) GetRange() *Range { + if x != nil { + return x.Range + } + return nil +} +func (x *GetRangeRequest_Body) SetRange(v *Range) { + x.Range = v +} +func (x *GetRangeRequest_Body) GetRaw() bool { + if x != nil { + return x.Raw + } + return false +} +func (x *GetRangeRequest_Body) SetRaw(v bool) { + x.Raw = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *GetRangeRequest_Body) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *GetRangeRequest_Body) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"address\":" + out.RawString(prefix[1:]) + x.Address.MarshalEasyJSON(out) + } + { + const prefix string = ",\"range\":" + out.RawString(prefix) + x.Range.MarshalEasyJSON(out) + } + { + const prefix string = ",\"raw\":" + out.RawString(prefix) + out.Bool(x.Raw) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *GetRangeRequest_Body) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *GetRangeRequest_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 "address": + { + var f *grpc.Address + f = new(grpc.Address) + f.UnmarshalEasyJSON(in) + x.Address = f + } + case "range": + { + var f *Range + f = new(Range) + f.UnmarshalEasyJSON(in) + x.Range = f + } + case "raw": + { + var f bool + f = in.Bool() + x.Raw = f + } + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} + +type GetRangeRequest struct { + Body *GetRangeRequest_Body `json:"body"` + MetaHeader *grpc1.RequestMetaHeader `json:"metaHeader"` + VerifyHeader *grpc1.RequestVerificationHeader `json:"verifyHeader"` +} + +var ( + _ encoding.ProtoMarshaler = (*GetRangeRequest)(nil) + _ encoding.ProtoUnmarshaler = (*GetRangeRequest)(nil) + _ json.Marshaler = (*GetRangeRequest)(nil) + _ json.Unmarshaler = (*GetRangeRequest)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *GetRangeRequest) 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 *GetRangeRequest) 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 *GetRangeRequest) ReadSignedData(buf []byte) ([]byte, error) { + return x.GetBody().MarshalProtobuf(buf), nil +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *GetRangeRequest) 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 *GetRangeRequest) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if x.Body != nil && x.Body.StableSize() != 0 { + x.Body.EmitProtobuf(mm.AppendMessage(1)) + } + if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 { + x.MetaHeader.EmitProtobuf(mm.AppendMessage(2)) + } + if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 { + x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3)) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *GetRangeRequest) 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", "GetRangeRequest") + } + switch fc.FieldNum { + case 1: // Body + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Body") + } + x.Body = new(GetRangeRequest_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 *GetRangeRequest) GetBody() *GetRangeRequest_Body { + if x != nil { + return x.Body + } + return nil +} +func (x *GetRangeRequest) SetBody(v *GetRangeRequest_Body) { + x.Body = v +} +func (x *GetRangeRequest) GetMetaHeader() *grpc1.RequestMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} +func (x *GetRangeRequest) SetMetaHeader(v *grpc1.RequestMetaHeader) { + x.MetaHeader = v +} +func (x *GetRangeRequest) GetVerifyHeader() *grpc1.RequestVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} +func (x *GetRangeRequest) SetVerifyHeader(v *grpc1.RequestVerificationHeader) { + x.VerifyHeader = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *GetRangeRequest) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *GetRangeRequest) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"body\":" + out.RawString(prefix[1:]) + x.Body.MarshalEasyJSON(out) + } + { + const prefix string = ",\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) + } + { + const prefix string = ",\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *GetRangeRequest) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *GetRangeRequest) 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 *GetRangeRequest_Body + f = new(GetRangeRequest_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 GetRangeResponse_Body struct { + RangePart isGetRangeResponse_Body_RangePart +} + +var ( + _ encoding.ProtoMarshaler = (*GetRangeResponse_Body)(nil) + _ encoding.ProtoUnmarshaler = (*GetRangeResponse_Body)(nil) + _ json.Marshaler = (*GetRangeResponse_Body)(nil) + _ json.Unmarshaler = (*GetRangeResponse_Body)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *GetRangeResponse_Body) StableSize() (size int) { + if x == nil { + return 0 + } + if inner, ok := x.RangePart.(*GetRangeResponse_Body_Chunk); ok { + size += proto.BytesSize(1, inner.Chunk) + } + if inner, ok := x.RangePart.(*GetRangeResponse_Body_SplitInfo); ok { + size += proto.NestedStructureSize(2, inner.SplitInfo) + } + if inner, ok := x.RangePart.(*GetRangeResponse_Body_EcInfo); ok { + size += proto.NestedStructureSize(3, inner.EcInfo) + } + return size +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *GetRangeResponse_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 *GetRangeResponse_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if inner, ok := x.RangePart.(*GetRangeResponse_Body_Chunk); ok { + if len(inner.Chunk) != 0 { + mm.AppendBytes(1, inner.Chunk) + } + } + if inner, ok := x.RangePart.(*GetRangeResponse_Body_SplitInfo); ok { + if inner.SplitInfo != nil && inner.SplitInfo.StableSize() != 0 { + inner.SplitInfo.EmitProtobuf(mm.AppendMessage(2)) + } + } + if inner, ok := x.RangePart.(*GetRangeResponse_Body_EcInfo); ok { + if inner.EcInfo != nil && inner.EcInfo.StableSize() != 0 { + inner.EcInfo.EmitProtobuf(mm.AppendMessage(3)) + } + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *GetRangeResponse_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", "GetRangeResponse_Body") + } + switch fc.FieldNum { + case 1: // Chunk + data, ok := fc.Bytes() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Chunk") + } + x.RangePart = &GetRangeResponse_Body_Chunk{Chunk: data} + case 2: // SplitInfo + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "SplitInfo") + } + oneofField := &GetRangeResponse_Body_SplitInfo{SplitInfo: new(SplitInfo)} + if err := oneofField.SplitInfo.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + x.RangePart = oneofField + case 3: // EcInfo + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "EcInfo") + } + oneofField := &GetRangeResponse_Body_EcInfo{EcInfo: new(ECInfo)} + if err := oneofField.EcInfo.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + x.RangePart = oneofField + } + } + return nil +} +func (x *GetRangeResponse_Body) GetRangePart() isGetRangeResponse_Body_RangePart { + if x != nil { + return x.RangePart + } + return nil +} +func (x *GetRangeResponse_Body) SetRangePart(v isGetRangeResponse_Body_RangePart) { + x.RangePart = v +} +func (x *GetRangeResponse_Body) GetChunk() *GetRangeResponse_Body_Chunk { + if xx, ok := x.GetRangePart().(*GetRangeResponse_Body_Chunk); ok { + return xx + } + return nil +} +func (x *GetRangeResponse_Body) SetChunk(v *GetRangeResponse_Body_Chunk) { + x.RangePart = v +} +func (x *GetRangeResponse_Body_Chunk) GetChunk() []byte { + if x != nil { + return x.Chunk + } + return nil +} +func (x *GetRangeResponse_Body_Chunk) SetChunk(v []byte) { + x.Chunk = v +} +func (x *GetRangeResponse_Body) GetSplitInfo() *SplitInfo { + if xx, ok := x.GetRangePart().(*GetRangeResponse_Body_SplitInfo); ok { + return xx.SplitInfo + } + return nil +} +func (x *GetRangeResponse_Body) SetSplitInfo(v *SplitInfo) { + x.RangePart = &GetRangeResponse_Body_SplitInfo{SplitInfo: v} +} +func (x *GetRangeResponse_Body) GetEcInfo() *ECInfo { + if xx, ok := x.GetRangePart().(*GetRangeResponse_Body_EcInfo); ok { + return xx.EcInfo + } + return nil +} +func (x *GetRangeResponse_Body) SetEcInfo(v *ECInfo) { + x.RangePart = &GetRangeResponse_Body_EcInfo{EcInfo: v} +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *GetRangeResponse_Body) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *GetRangeResponse_Body) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + switch xx := x.RangePart.(type) { + case *GetRangeResponse_Body_Chunk: + { + const prefix string = ",\"chunk\":" + out.RawString(prefix[1:]) + out.Base64Bytes(xx.Chunk) + } + case *GetRangeResponse_Body_SplitInfo: + { + const prefix string = ",\"splitInfo\":" + out.RawString(prefix[1:]) + xx.SplitInfo.MarshalEasyJSON(out) + } + case *GetRangeResponse_Body_EcInfo: + { + const prefix string = ",\"ecInfo\":" + out.RawString(prefix[1:]) + xx.EcInfo.MarshalEasyJSON(out) + } + default: + out.RawString("null") + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *GetRangeResponse_Body) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *GetRangeResponse_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 "chunk": + xx := new(GetRangeResponse_Body_Chunk) + x.RangePart = xx + { + var f []byte + f = in.Bytes() + xx.Chunk = f + } + case "splitInfo": + xx := new(GetRangeResponse_Body_SplitInfo) + x.RangePart = xx + { + var f *SplitInfo + f = new(SplitInfo) + f.UnmarshalEasyJSON(in) + xx.SplitInfo = f + } + case "ecInfo": + xx := new(GetRangeResponse_Body_EcInfo) + x.RangePart = xx + { + var f *ECInfo + f = new(ECInfo) + f.UnmarshalEasyJSON(in) + xx.EcInfo = f + } + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} + +type isGetRangeResponse_Body_RangePart interface { + isGetRangeResponse_Body_RangePart() +} + +type GetRangeResponse_Body_Chunk struct { + Chunk []byte +} + +type GetRangeResponse_Body_SplitInfo struct { + SplitInfo *SplitInfo +} + +type GetRangeResponse_Body_EcInfo struct { + EcInfo *ECInfo +} + +func (*GetRangeResponse_Body_Chunk) isGetRangeResponse_Body_RangePart() {} + +func (*GetRangeResponse_Body_SplitInfo) isGetRangeResponse_Body_RangePart() {} + +func (*GetRangeResponse_Body_EcInfo) isGetRangeResponse_Body_RangePart() {} + +type GetRangeResponse struct { + Body *GetRangeResponse_Body `json:"body"` + MetaHeader *grpc1.ResponseMetaHeader `json:"metaHeader"` + VerifyHeader *grpc1.ResponseVerificationHeader `json:"verifyHeader"` +} + +var ( + _ encoding.ProtoMarshaler = (*GetRangeResponse)(nil) + _ encoding.ProtoUnmarshaler = (*GetRangeResponse)(nil) + _ json.Marshaler = (*GetRangeResponse)(nil) + _ json.Unmarshaler = (*GetRangeResponse)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *GetRangeResponse) 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 *GetRangeResponse) 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 *GetRangeResponse) ReadSignedData(buf []byte) ([]byte, error) { + return x.GetBody().MarshalProtobuf(buf), nil +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *GetRangeResponse) 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 *GetRangeResponse) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if x.Body != nil && x.Body.StableSize() != 0 { + x.Body.EmitProtobuf(mm.AppendMessage(1)) + } + if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 { + x.MetaHeader.EmitProtobuf(mm.AppendMessage(2)) + } + if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 { + x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3)) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *GetRangeResponse) 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", "GetRangeResponse") + } + switch fc.FieldNum { + case 1: // Body + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Body") + } + x.Body = new(GetRangeResponse_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 *GetRangeResponse) GetBody() *GetRangeResponse_Body { + if x != nil { + return x.Body + } + return nil +} +func (x *GetRangeResponse) SetBody(v *GetRangeResponse_Body) { + x.Body = v +} +func (x *GetRangeResponse) GetMetaHeader() *grpc1.ResponseMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} +func (x *GetRangeResponse) SetMetaHeader(v *grpc1.ResponseMetaHeader) { + x.MetaHeader = v +} +func (x *GetRangeResponse) GetVerifyHeader() *grpc1.ResponseVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} +func (x *GetRangeResponse) SetVerifyHeader(v *grpc1.ResponseVerificationHeader) { + x.VerifyHeader = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *GetRangeResponse) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *GetRangeResponse) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"body\":" + out.RawString(prefix[1:]) + x.Body.MarshalEasyJSON(out) + } + { + const prefix string = ",\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) + } + { + const prefix string = ",\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *GetRangeResponse) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *GetRangeResponse) 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 *GetRangeResponse_Body + f = new(GetRangeResponse_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() + } +} + +type GetRangeHashRequest_Body struct { + Address *grpc.Address `json:"address"` + Ranges []*Range `json:"ranges"` + Salt []byte `json:"salt"` + Type grpc.ChecksumType `json:"type"` +} + +var ( + _ encoding.ProtoMarshaler = (*GetRangeHashRequest_Body)(nil) + _ encoding.ProtoUnmarshaler = (*GetRangeHashRequest_Body)(nil) + _ json.Marshaler = (*GetRangeHashRequest_Body)(nil) + _ json.Unmarshaler = (*GetRangeHashRequest_Body)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *GetRangeHashRequest_Body) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.NestedStructureSize(1, x.Address) + for i := range x.Ranges { + size += proto.NestedStructureSize(2, x.Ranges[i]) + } + size += proto.BytesSize(3, x.Salt) + size += proto.EnumSize(4, int32(x.Type)) + return size +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *GetRangeHashRequest_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 *GetRangeHashRequest_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if x.Address != nil && x.Address.StableSize() != 0 { + x.Address.EmitProtobuf(mm.AppendMessage(1)) + } + for i := range x.Ranges { + if x.Ranges[i] != nil && x.Ranges[i].StableSize() != 0 { + x.Ranges[i].EmitProtobuf(mm.AppendMessage(2)) + } + } + if len(x.Salt) != 0 { + mm.AppendBytes(3, x.Salt) + } + if int32(x.Type) != 0 { + mm.AppendInt32(4, int32(x.Type)) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *GetRangeHashRequest_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", "GetRangeHashRequest_Body") + } + switch fc.FieldNum { + case 1: // Address + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Address") + } + x.Address = new(grpc.Address) + if err := x.Address.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + case 2: // Ranges + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Ranges") + } + x.Ranges = append(x.Ranges, new(Range)) + ff := x.Ranges[len(x.Ranges)-1] + if err := ff.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + case 3: // Salt + data, ok := fc.Bytes() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Salt") + } + x.Salt = data + case 4: // Type + data, ok := fc.Int32() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Type") + } + x.Type = grpc.ChecksumType(data) + } + } + return nil +} +func (x *GetRangeHashRequest_Body) GetAddress() *grpc.Address { + if x != nil { + return x.Address + } + return nil +} +func (x *GetRangeHashRequest_Body) SetAddress(v *grpc.Address) { + x.Address = v +} +func (x *GetRangeHashRequest_Body) GetRanges() []*Range { + if x != nil { + return x.Ranges + } + return nil +} +func (x *GetRangeHashRequest_Body) SetRanges(v []*Range) { + x.Ranges = v +} +func (x *GetRangeHashRequest_Body) GetSalt() []byte { + if x != nil { + return x.Salt + } + return nil +} +func (x *GetRangeHashRequest_Body) SetSalt(v []byte) { + x.Salt = v +} +func (x *GetRangeHashRequest_Body) GetType() grpc.ChecksumType { + if x != nil { + return x.Type + } + return 0 +} +func (x *GetRangeHashRequest_Body) SetType(v grpc.ChecksumType) { + x.Type = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *GetRangeHashRequest_Body) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *GetRangeHashRequest_Body) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"address\":" + out.RawString(prefix[1:]) + x.Address.MarshalEasyJSON(out) + } + { + const prefix string = ",\"ranges\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.Ranges { + if i != 0 { + out.RawByte(',') + } + x.Ranges[i].MarshalEasyJSON(out) + } + out.RawByte(']') + } + { + const prefix string = ",\"salt\":" + out.RawString(prefix) + out.Base64Bytes(x.Salt) + } + { + const prefix string = ",\"type\":" + out.RawString(prefix) + out.Int32(int32(x.Type)) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *GetRangeHashRequest_Body) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *GetRangeHashRequest_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 "address": + { + var f *grpc.Address + f = new(grpc.Address) + f.UnmarshalEasyJSON(in) + x.Address = f + } + case "ranges": + { + var f *Range + var list []*Range + in.Delim('[') + for !in.IsDelim(']') { + f = new(Range) + f.UnmarshalEasyJSON(in) + list = append(list, f) + in.WantComma() + } + x.Ranges = list + in.Delim(']') + } + case "salt": + { + var f []byte + f = in.Bytes() + x.Salt = f + } + case "type": + { + var f grpc.ChecksumType + var parsedValue grpc.ChecksumType + switch v := in.Interface().(type) { + case string: + if vv, ok := grpc.ChecksumType_value[v]; ok { + parsedValue = grpc.ChecksumType(vv) + break + } + vv, err := strconv.ParseInt(v, 10, 32) + if err != nil { + in.AddError(err) + return + } + parsedValue = grpc.ChecksumType(vv) + case float64: + parsedValue = grpc.ChecksumType(v) + } + f = parsedValue + x.Type = f + } + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} + +type GetRangeHashRequest struct { + Body *GetRangeHashRequest_Body `json:"body"` + MetaHeader *grpc1.RequestMetaHeader `json:"metaHeader"` + VerifyHeader *grpc1.RequestVerificationHeader `json:"verifyHeader"` +} + +var ( + _ encoding.ProtoMarshaler = (*GetRangeHashRequest)(nil) + _ encoding.ProtoUnmarshaler = (*GetRangeHashRequest)(nil) + _ json.Marshaler = (*GetRangeHashRequest)(nil) + _ json.Unmarshaler = (*GetRangeHashRequest)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *GetRangeHashRequest) 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 *GetRangeHashRequest) 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 *GetRangeHashRequest) ReadSignedData(buf []byte) ([]byte, error) { + return x.GetBody().MarshalProtobuf(buf), nil +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *GetRangeHashRequest) 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 *GetRangeHashRequest) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if x.Body != nil && x.Body.StableSize() != 0 { + x.Body.EmitProtobuf(mm.AppendMessage(1)) + } + if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 { + x.MetaHeader.EmitProtobuf(mm.AppendMessage(2)) + } + if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 { + x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3)) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *GetRangeHashRequest) 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", "GetRangeHashRequest") + } + switch fc.FieldNum { + case 1: // Body + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Body") + } + x.Body = new(GetRangeHashRequest_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 *GetRangeHashRequest) GetBody() *GetRangeHashRequest_Body { + if x != nil { + return x.Body + } + return nil +} +func (x *GetRangeHashRequest) SetBody(v *GetRangeHashRequest_Body) { + x.Body = v +} +func (x *GetRangeHashRequest) GetMetaHeader() *grpc1.RequestMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} +func (x *GetRangeHashRequest) SetMetaHeader(v *grpc1.RequestMetaHeader) { + x.MetaHeader = v +} +func (x *GetRangeHashRequest) GetVerifyHeader() *grpc1.RequestVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} +func (x *GetRangeHashRequest) SetVerifyHeader(v *grpc1.RequestVerificationHeader) { + x.VerifyHeader = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *GetRangeHashRequest) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *GetRangeHashRequest) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"body\":" + out.RawString(prefix[1:]) + x.Body.MarshalEasyJSON(out) + } + { + const prefix string = ",\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) + } + { + const prefix string = ",\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *GetRangeHashRequest) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *GetRangeHashRequest) 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 *GetRangeHashRequest_Body + f = new(GetRangeHashRequest_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 GetRangeHashResponse_Body struct { + Type grpc.ChecksumType `json:"type"` + HashList [][]byte `json:"hashList"` +} + +var ( + _ encoding.ProtoMarshaler = (*GetRangeHashResponse_Body)(nil) + _ encoding.ProtoUnmarshaler = (*GetRangeHashResponse_Body)(nil) + _ json.Marshaler = (*GetRangeHashResponse_Body)(nil) + _ json.Unmarshaler = (*GetRangeHashResponse_Body)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *GetRangeHashResponse_Body) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.EnumSize(1, int32(x.Type)) + size += proto.RepeatedBytesSize(2, x.HashList) + return size +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *GetRangeHashResponse_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 *GetRangeHashResponse_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if int32(x.Type) != 0 { + mm.AppendInt32(1, int32(x.Type)) + } + for j := range x.HashList { + mm.AppendBytes(2, x.HashList[j]) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *GetRangeHashResponse_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", "GetRangeHashResponse_Body") + } + switch fc.FieldNum { + case 1: // Type + data, ok := fc.Int32() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Type") + } + x.Type = grpc.ChecksumType(data) + case 2: // HashList + data, ok := fc.Bytes() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "HashList") + } + x.HashList = append(x.HashList, data) + } + } + return nil +} +func (x *GetRangeHashResponse_Body) GetType() grpc.ChecksumType { + if x != nil { + return x.Type + } + return 0 +} +func (x *GetRangeHashResponse_Body) SetType(v grpc.ChecksumType) { + x.Type = v +} +func (x *GetRangeHashResponse_Body) GetHashList() [][]byte { + if x != nil { + return x.HashList + } + return nil +} +func (x *GetRangeHashResponse_Body) SetHashList(v [][]byte) { + x.HashList = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *GetRangeHashResponse_Body) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *GetRangeHashResponse_Body) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"type\":" + out.RawString(prefix[1:]) + out.Int32(int32(x.Type)) + } + { + const prefix string = ",\"hashList\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.HashList { + if i != 0 { + out.RawByte(',') + } + out.Base64Bytes(x.HashList[i]) + } + out.RawByte(']') + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *GetRangeHashResponse_Body) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *GetRangeHashResponse_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 "type": + { + var f grpc.ChecksumType + var parsedValue grpc.ChecksumType + switch v := in.Interface().(type) { + case string: + if vv, ok := grpc.ChecksumType_value[v]; ok { + parsedValue = grpc.ChecksumType(vv) + break + } + vv, err := strconv.ParseInt(v, 10, 32) + if err != nil { + in.AddError(err) + return + } + parsedValue = grpc.ChecksumType(vv) + case float64: + parsedValue = grpc.ChecksumType(v) + } + f = parsedValue + x.Type = f + } + case "hashList": + { + var f []byte + var list [][]byte + in.Delim('[') + for !in.IsDelim(']') { + f = in.Bytes() + list = append(list, f) + in.WantComma() + } + x.HashList = list + in.Delim(']') + } + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} + +type GetRangeHashResponse struct { + Body *GetRangeHashResponse_Body `json:"body"` + MetaHeader *grpc1.ResponseMetaHeader `json:"metaHeader"` + VerifyHeader *grpc1.ResponseVerificationHeader `json:"verifyHeader"` +} + +var ( + _ encoding.ProtoMarshaler = (*GetRangeHashResponse)(nil) + _ encoding.ProtoUnmarshaler = (*GetRangeHashResponse)(nil) + _ json.Marshaler = (*GetRangeHashResponse)(nil) + _ json.Unmarshaler = (*GetRangeHashResponse)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *GetRangeHashResponse) 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 *GetRangeHashResponse) 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 *GetRangeHashResponse) ReadSignedData(buf []byte) ([]byte, error) { + return x.GetBody().MarshalProtobuf(buf), nil +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *GetRangeHashResponse) 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 *GetRangeHashResponse) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if x.Body != nil && x.Body.StableSize() != 0 { + x.Body.EmitProtobuf(mm.AppendMessage(1)) + } + if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 { + x.MetaHeader.EmitProtobuf(mm.AppendMessage(2)) + } + if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 { + x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3)) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *GetRangeHashResponse) 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", "GetRangeHashResponse") + } + switch fc.FieldNum { + case 1: // Body + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Body") + } + x.Body = new(GetRangeHashResponse_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 *GetRangeHashResponse) GetBody() *GetRangeHashResponse_Body { + if x != nil { + return x.Body + } + return nil +} +func (x *GetRangeHashResponse) SetBody(v *GetRangeHashResponse_Body) { + x.Body = v +} +func (x *GetRangeHashResponse) GetMetaHeader() *grpc1.ResponseMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} +func (x *GetRangeHashResponse) SetMetaHeader(v *grpc1.ResponseMetaHeader) { + x.MetaHeader = v +} +func (x *GetRangeHashResponse) GetVerifyHeader() *grpc1.ResponseVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} +func (x *GetRangeHashResponse) SetVerifyHeader(v *grpc1.ResponseVerificationHeader) { + x.VerifyHeader = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *GetRangeHashResponse) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *GetRangeHashResponse) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"body\":" + out.RawString(prefix[1:]) + x.Body.MarshalEasyJSON(out) + } + { + const prefix string = ",\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) + } + { + const prefix string = ",\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *GetRangeHashResponse) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *GetRangeHashResponse) 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 *GetRangeHashResponse_Body + f = new(GetRangeHashResponse_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() + } +} + +type PutSingleRequest_Body struct { + Object *Object `json:"object"` + CopiesNumber []uint32 `json:"copiesNumber"` +} + +var ( + _ encoding.ProtoMarshaler = (*PutSingleRequest_Body)(nil) + _ encoding.ProtoUnmarshaler = (*PutSingleRequest_Body)(nil) + _ json.Marshaler = (*PutSingleRequest_Body)(nil) + _ json.Unmarshaler = (*PutSingleRequest_Body)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *PutSingleRequest_Body) StableSize() (size int) { + if x == nil { + return 0 + } + var n int + size += proto.NestedStructureSize(1, x.Object) + n, _ = proto.RepeatedUInt32Size(2, x.CopiesNumber) + size += n + return size +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *PutSingleRequest_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 *PutSingleRequest_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if x.Object != nil && x.Object.StableSize() != 0 { + x.Object.EmitProtobuf(mm.AppendMessage(1)) + } + if len(x.CopiesNumber) != 0 { + mm.AppendUint32s(2, x.CopiesNumber) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *PutSingleRequest_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", "PutSingleRequest_Body") + } + switch fc.FieldNum { + case 1: // Object + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Object") + } + x.Object = new(Object) + if err := x.Object.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + case 2: // CopiesNumber + data, ok := fc.UnpackUint32s(nil) + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "CopiesNumber") + } + x.CopiesNumber = data + } + } + return nil +} +func (x *PutSingleRequest_Body) GetObject() *Object { + if x != nil { + return x.Object + } + return nil +} +func (x *PutSingleRequest_Body) SetObject(v *Object) { + x.Object = v +} +func (x *PutSingleRequest_Body) GetCopiesNumber() []uint32 { + if x != nil { + return x.CopiesNumber + } + return nil +} +func (x *PutSingleRequest_Body) SetCopiesNumber(v []uint32) { + x.CopiesNumber = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *PutSingleRequest_Body) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *PutSingleRequest_Body) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"object\":" + out.RawString(prefix[1:]) + x.Object.MarshalEasyJSON(out) + } + { + const prefix string = ",\"copiesNumber\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.CopiesNumber { + if i != 0 { + out.RawByte(',') + } + out.Uint32(x.CopiesNumber[i]) + } + out.RawByte(']') + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *PutSingleRequest_Body) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *PutSingleRequest_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 "object": + { + var f *Object + f = new(Object) + f.UnmarshalEasyJSON(in) + x.Object = f + } + case "copiesNumber": + { + var f uint32 + var list []uint32 + in.Delim('[') + for !in.IsDelim(']') { + f = in.Uint32() + list = append(list, f) + in.WantComma() + } + x.CopiesNumber = list + in.Delim(']') + } + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} + +type PutSingleRequest struct { + Body *PutSingleRequest_Body `json:"body"` + MetaHeader *grpc1.RequestMetaHeader `json:"metaHeader"` + VerifyHeader *grpc1.RequestVerificationHeader `json:"verifyHeader"` +} + +var ( + _ encoding.ProtoMarshaler = (*PutSingleRequest)(nil) + _ encoding.ProtoUnmarshaler = (*PutSingleRequest)(nil) + _ json.Marshaler = (*PutSingleRequest)(nil) + _ json.Unmarshaler = (*PutSingleRequest)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *PutSingleRequest) 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 *PutSingleRequest) 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 *PutSingleRequest) ReadSignedData(buf []byte) ([]byte, error) { + return x.GetBody().MarshalProtobuf(buf), nil +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *PutSingleRequest) 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 *PutSingleRequest) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if x.Body != nil && x.Body.StableSize() != 0 { + x.Body.EmitProtobuf(mm.AppendMessage(1)) + } + if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 { + x.MetaHeader.EmitProtobuf(mm.AppendMessage(2)) + } + if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 { + x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3)) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *PutSingleRequest) 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", "PutSingleRequest") + } + switch fc.FieldNum { + case 1: // Body + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Body") + } + x.Body = new(PutSingleRequest_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 *PutSingleRequest) GetBody() *PutSingleRequest_Body { + if x != nil { + return x.Body + } + return nil +} +func (x *PutSingleRequest) SetBody(v *PutSingleRequest_Body) { + x.Body = v +} +func (x *PutSingleRequest) GetMetaHeader() *grpc1.RequestMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} +func (x *PutSingleRequest) SetMetaHeader(v *grpc1.RequestMetaHeader) { + x.MetaHeader = v +} +func (x *PutSingleRequest) GetVerifyHeader() *grpc1.RequestVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} +func (x *PutSingleRequest) SetVerifyHeader(v *grpc1.RequestVerificationHeader) { + x.VerifyHeader = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *PutSingleRequest) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *PutSingleRequest) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"body\":" + out.RawString(prefix[1:]) + x.Body.MarshalEasyJSON(out) + } + { + const prefix string = ",\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) + } + { + const prefix string = ",\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *PutSingleRequest) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *PutSingleRequest) 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 *PutSingleRequest_Body + f = new(PutSingleRequest_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 PutSingleResponse_Body struct { +} + +var ( + _ encoding.ProtoMarshaler = (*PutSingleResponse_Body)(nil) + _ encoding.ProtoUnmarshaler = (*PutSingleResponse_Body)(nil) + _ json.Marshaler = (*PutSingleResponse_Body)(nil) + _ json.Unmarshaler = (*PutSingleResponse_Body)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *PutSingleResponse_Body) StableSize() (size int) { + if x == nil { + return 0 + } + return size +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *PutSingleResponse_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 *PutSingleResponse_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) { +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *PutSingleResponse_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", "PutSingleResponse_Body") + } + switch fc.FieldNum { + } + } + return nil +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *PutSingleResponse_Body) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *PutSingleResponse_Body) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *PutSingleResponse_Body) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *PutSingleResponse_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 { + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} + +type PutSingleResponse struct { + Body *PutSingleResponse_Body `json:"body"` + MetaHeader *grpc1.ResponseMetaHeader `json:"metaHeader"` + VerifyHeader *grpc1.ResponseVerificationHeader `json:"verifyHeader"` +} + +var ( + _ encoding.ProtoMarshaler = (*PutSingleResponse)(nil) + _ encoding.ProtoUnmarshaler = (*PutSingleResponse)(nil) + _ json.Marshaler = (*PutSingleResponse)(nil) + _ json.Unmarshaler = (*PutSingleResponse)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *PutSingleResponse) 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 *PutSingleResponse) 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 *PutSingleResponse) ReadSignedData(buf []byte) ([]byte, error) { + return x.GetBody().MarshalProtobuf(buf), nil +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *PutSingleResponse) 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 *PutSingleResponse) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if x.Body != nil && x.Body.StableSize() != 0 { + x.Body.EmitProtobuf(mm.AppendMessage(1)) + } + if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 { + x.MetaHeader.EmitProtobuf(mm.AppendMessage(2)) + } + if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 { + x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3)) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *PutSingleResponse) 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", "PutSingleResponse") + } + switch fc.FieldNum { + case 1: // Body + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Body") + } + x.Body = new(PutSingleResponse_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 *PutSingleResponse) GetBody() *PutSingleResponse_Body { + if x != nil { + return x.Body + } + return nil +} +func (x *PutSingleResponse) SetBody(v *PutSingleResponse_Body) { + x.Body = v +} +func (x *PutSingleResponse) GetMetaHeader() *grpc1.ResponseMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} +func (x *PutSingleResponse) SetMetaHeader(v *grpc1.ResponseMetaHeader) { + x.MetaHeader = v +} +func (x *PutSingleResponse) GetVerifyHeader() *grpc1.ResponseVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} +func (x *PutSingleResponse) SetVerifyHeader(v *grpc1.ResponseVerificationHeader) { + x.VerifyHeader = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *PutSingleResponse) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *PutSingleResponse) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"body\":" + out.RawString(prefix[1:]) + x.Body.MarshalEasyJSON(out) + } + { + const prefix string = ",\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) + } + { + const prefix string = ",\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *PutSingleResponse) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *PutSingleResponse) 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 *PutSingleResponse_Body + f = new(PutSingleResponse_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() + } +} + +type PatchRequest_Body_Patch struct { + SourceRange *Range `json:"sourceRange"` + Chunk []byte `json:"chunk"` +} + +var ( + _ encoding.ProtoMarshaler = (*PatchRequest_Body_Patch)(nil) + _ encoding.ProtoUnmarshaler = (*PatchRequest_Body_Patch)(nil) + _ json.Marshaler = (*PatchRequest_Body_Patch)(nil) + _ json.Unmarshaler = (*PatchRequest_Body_Patch)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *PatchRequest_Body_Patch) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.NestedStructureSize(1, x.SourceRange) + size += proto.BytesSize(2, x.Chunk) + return size +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *PatchRequest_Body_Patch) 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 *PatchRequest_Body_Patch) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if x.SourceRange != nil && x.SourceRange.StableSize() != 0 { + x.SourceRange.EmitProtobuf(mm.AppendMessage(1)) + } + if len(x.Chunk) != 0 { + mm.AppendBytes(2, x.Chunk) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *PatchRequest_Body_Patch) 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", "PatchRequest_Body_Patch") + } + switch fc.FieldNum { + case 1: // SourceRange + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "SourceRange") + } + x.SourceRange = new(Range) + if err := x.SourceRange.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + case 2: // Chunk + data, ok := fc.Bytes() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Chunk") + } + x.Chunk = data + } + } + return nil +} +func (x *PatchRequest_Body_Patch) GetSourceRange() *Range { + if x != nil { + return x.SourceRange + } + return nil +} +func (x *PatchRequest_Body_Patch) SetSourceRange(v *Range) { + x.SourceRange = v +} +func (x *PatchRequest_Body_Patch) GetChunk() []byte { + if x != nil { + return x.Chunk + } + return nil +} +func (x *PatchRequest_Body_Patch) SetChunk(v []byte) { + x.Chunk = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *PatchRequest_Body_Patch) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *PatchRequest_Body_Patch) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"sourceRange\":" + out.RawString(prefix[1:]) + x.SourceRange.MarshalEasyJSON(out) + } + { + const prefix string = ",\"chunk\":" + out.RawString(prefix) + out.Base64Bytes(x.Chunk) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *PatchRequest_Body_Patch) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *PatchRequest_Body_Patch) 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 "sourceRange": + { + var f *Range + f = new(Range) + f.UnmarshalEasyJSON(in) + x.SourceRange = f + } + case "chunk": + { + var f []byte + f = in.Bytes() + x.Chunk = f + } + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} + +type PatchRequest_Body struct { + Address *grpc.Address `json:"address"` + NewAttributes []*Header_Attribute `json:"newAttributes"` + ReplaceAttributes bool `json:"replaceAttributes"` + Patch *PatchRequest_Body_Patch `json:"patch"` +} + +var ( + _ encoding.ProtoMarshaler = (*PatchRequest_Body)(nil) + _ encoding.ProtoUnmarshaler = (*PatchRequest_Body)(nil) + _ json.Marshaler = (*PatchRequest_Body)(nil) + _ json.Unmarshaler = (*PatchRequest_Body)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *PatchRequest_Body) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.NestedStructureSize(1, x.Address) + for i := range x.NewAttributes { + size += proto.NestedStructureSize(2, x.NewAttributes[i]) + } + size += proto.BoolSize(3, x.ReplaceAttributes) + size += proto.NestedStructureSize(4, x.Patch) + return size +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *PatchRequest_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 *PatchRequest_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if x.Address != nil && x.Address.StableSize() != 0 { + x.Address.EmitProtobuf(mm.AppendMessage(1)) + } + for i := range x.NewAttributes { + if x.NewAttributes[i] != nil && x.NewAttributes[i].StableSize() != 0 { + x.NewAttributes[i].EmitProtobuf(mm.AppendMessage(2)) + } + } + if x.ReplaceAttributes { + mm.AppendBool(3, x.ReplaceAttributes) + } + if x.Patch != nil && x.Patch.StableSize() != 0 { + x.Patch.EmitProtobuf(mm.AppendMessage(4)) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *PatchRequest_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", "PatchRequest_Body") + } + switch fc.FieldNum { + case 1: // Address + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Address") + } + x.Address = new(grpc.Address) + if err := x.Address.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + case 2: // NewAttributes + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "NewAttributes") + } + x.NewAttributes = append(x.NewAttributes, new(Header_Attribute)) + ff := x.NewAttributes[len(x.NewAttributes)-1] + if err := ff.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + case 3: // ReplaceAttributes + data, ok := fc.Bool() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "ReplaceAttributes") + } + x.ReplaceAttributes = data + case 4: // Patch + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Patch") + } + x.Patch = new(PatchRequest_Body_Patch) + if err := x.Patch.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + } + } + return nil +} +func (x *PatchRequest_Body) GetAddress() *grpc.Address { + if x != nil { + return x.Address + } + return nil +} +func (x *PatchRequest_Body) SetAddress(v *grpc.Address) { + x.Address = v +} +func (x *PatchRequest_Body) GetNewAttributes() []*Header_Attribute { + if x != nil { + return x.NewAttributes + } + return nil +} +func (x *PatchRequest_Body) SetNewAttributes(v []*Header_Attribute) { + x.NewAttributes = v +} +func (x *PatchRequest_Body) GetReplaceAttributes() bool { + if x != nil { + return x.ReplaceAttributes + } + return false +} +func (x *PatchRequest_Body) SetReplaceAttributes(v bool) { + x.ReplaceAttributes = v +} +func (x *PatchRequest_Body) GetPatch() *PatchRequest_Body_Patch { + if x != nil { + return x.Patch + } + return nil +} +func (x *PatchRequest_Body) SetPatch(v *PatchRequest_Body_Patch) { + x.Patch = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *PatchRequest_Body) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *PatchRequest_Body) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"address\":" + out.RawString(prefix[1:]) + x.Address.MarshalEasyJSON(out) + } + { + const prefix string = ",\"newAttributes\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.NewAttributes { + if i != 0 { + out.RawByte(',') + } + x.NewAttributes[i].MarshalEasyJSON(out) + } + out.RawByte(']') + } + { + const prefix string = ",\"replaceAttributes\":" + out.RawString(prefix) + out.Bool(x.ReplaceAttributes) + } + { + const prefix string = ",\"patch\":" + out.RawString(prefix) + x.Patch.MarshalEasyJSON(out) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *PatchRequest_Body) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *PatchRequest_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 "address": + { + var f *grpc.Address + f = new(grpc.Address) + f.UnmarshalEasyJSON(in) + x.Address = f + } + case "newAttributes": + { + var f *Header_Attribute + var list []*Header_Attribute + in.Delim('[') + for !in.IsDelim(']') { + f = new(Header_Attribute) + f.UnmarshalEasyJSON(in) + list = append(list, f) + in.WantComma() + } + x.NewAttributes = list + in.Delim(']') + } + case "replaceAttributes": + { + var f bool + f = in.Bool() + x.ReplaceAttributes = f + } + case "patch": + { + var f *PatchRequest_Body_Patch + f = new(PatchRequest_Body_Patch) + f.UnmarshalEasyJSON(in) + x.Patch = f + } + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} + +type PatchRequest struct { + Body *PatchRequest_Body `json:"body"` + MetaHeader *grpc1.RequestMetaHeader `json:"metaHeader"` + VerifyHeader *grpc1.RequestVerificationHeader `json:"verifyHeader"` +} + +var ( + _ encoding.ProtoMarshaler = (*PatchRequest)(nil) + _ encoding.ProtoUnmarshaler = (*PatchRequest)(nil) + _ json.Marshaler = (*PatchRequest)(nil) + _ json.Unmarshaler = (*PatchRequest)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *PatchRequest) 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 *PatchRequest) 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 *PatchRequest) ReadSignedData(buf []byte) ([]byte, error) { + return x.GetBody().MarshalProtobuf(buf), nil +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *PatchRequest) 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 *PatchRequest) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if x.Body != nil && x.Body.StableSize() != 0 { + x.Body.EmitProtobuf(mm.AppendMessage(1)) + } + if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 { + x.MetaHeader.EmitProtobuf(mm.AppendMessage(2)) + } + if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 { + x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3)) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *PatchRequest) 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", "PatchRequest") + } + switch fc.FieldNum { + case 1: // Body + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Body") + } + x.Body = new(PatchRequest_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 *PatchRequest) GetBody() *PatchRequest_Body { + if x != nil { + return x.Body + } + return nil +} +func (x *PatchRequest) SetBody(v *PatchRequest_Body) { + x.Body = v +} +func (x *PatchRequest) GetMetaHeader() *grpc1.RequestMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} +func (x *PatchRequest) SetMetaHeader(v *grpc1.RequestMetaHeader) { + x.MetaHeader = v +} +func (x *PatchRequest) GetVerifyHeader() *grpc1.RequestVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} +func (x *PatchRequest) SetVerifyHeader(v *grpc1.RequestVerificationHeader) { + x.VerifyHeader = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *PatchRequest) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *PatchRequest) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"body\":" + out.RawString(prefix[1:]) + x.Body.MarshalEasyJSON(out) + } + { + const prefix string = ",\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) + } + { + const prefix string = ",\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *PatchRequest) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *PatchRequest) 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 *PatchRequest_Body + f = new(PatchRequest_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 PatchResponse_Body struct { + ObjectId *grpc.ObjectID `json:"objectId"` +} + +var ( + _ encoding.ProtoMarshaler = (*PatchResponse_Body)(nil) + _ encoding.ProtoUnmarshaler = (*PatchResponse_Body)(nil) + _ json.Marshaler = (*PatchResponse_Body)(nil) + _ json.Unmarshaler = (*PatchResponse_Body)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *PatchResponse_Body) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.NestedStructureSize(1, x.ObjectId) + return size +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *PatchResponse_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 *PatchResponse_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if x.ObjectId != nil && x.ObjectId.StableSize() != 0 { + x.ObjectId.EmitProtobuf(mm.AppendMessage(1)) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *PatchResponse_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", "PatchResponse_Body") + } + switch fc.FieldNum { + case 1: // ObjectId + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "ObjectId") + } + x.ObjectId = new(grpc.ObjectID) + if err := x.ObjectId.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + } + } + return nil +} +func (x *PatchResponse_Body) GetObjectId() *grpc.ObjectID { + if x != nil { + return x.ObjectId + } + return nil +} +func (x *PatchResponse_Body) SetObjectId(v *grpc.ObjectID) { + x.ObjectId = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *PatchResponse_Body) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *PatchResponse_Body) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"objectId\":" + out.RawString(prefix[1:]) + x.ObjectId.MarshalEasyJSON(out) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *PatchResponse_Body) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *PatchResponse_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 "objectId": + { + var f *grpc.ObjectID + f = new(grpc.ObjectID) + f.UnmarshalEasyJSON(in) + x.ObjectId = f + } + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} + +type PatchResponse struct { + Body *PatchResponse_Body `json:"body"` + MetaHeader *grpc1.ResponseMetaHeader `json:"metaHeader"` + VerifyHeader *grpc1.ResponseVerificationHeader `json:"verifyHeader"` +} + +var ( + _ encoding.ProtoMarshaler = (*PatchResponse)(nil) + _ encoding.ProtoUnmarshaler = (*PatchResponse)(nil) + _ json.Marshaler = (*PatchResponse)(nil) + _ json.Unmarshaler = (*PatchResponse)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *PatchResponse) 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 *PatchResponse) 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 *PatchResponse) ReadSignedData(buf []byte) ([]byte, error) { + return x.GetBody().MarshalProtobuf(buf), nil +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *PatchResponse) 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 *PatchResponse) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if x.Body != nil && x.Body.StableSize() != 0 { + x.Body.EmitProtobuf(mm.AppendMessage(1)) + } + if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 { + x.MetaHeader.EmitProtobuf(mm.AppendMessage(2)) + } + if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 { + x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3)) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *PatchResponse) 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", "PatchResponse") + } + switch fc.FieldNum { + case 1: // Body + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Body") + } + x.Body = new(PatchResponse_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 *PatchResponse) GetBody() *PatchResponse_Body { + if x != nil { + return x.Body + } + return nil +} +func (x *PatchResponse) SetBody(v *PatchResponse_Body) { + x.Body = v +} +func (x *PatchResponse) GetMetaHeader() *grpc1.ResponseMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} +func (x *PatchResponse) SetMetaHeader(v *grpc1.ResponseMetaHeader) { + x.MetaHeader = v +} +func (x *PatchResponse) GetVerifyHeader() *grpc1.ResponseVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} +func (x *PatchResponse) SetVerifyHeader(v *grpc1.ResponseVerificationHeader) { + x.VerifyHeader = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *PatchResponse) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *PatchResponse) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"body\":" + out.RawString(prefix[1:]) + x.Body.MarshalEasyJSON(out) + } + { + const prefix string = ",\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) + } + { + const prefix string = ",\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *PatchResponse) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *PatchResponse) 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 *PatchResponse_Body + f = new(PatchResponse_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() + } +} diff --git a/object/grpc/service_frostfs_fuzz.go b/object/grpc/service_frostfs_fuzz.go new file mode 100644 index 0000000..f58ee01 --- /dev/null +++ b/object/grpc/service_frostfs_fuzz.go @@ -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 +} diff --git a/object/grpc/service_frostfs_test.go b/object/grpc/service_frostfs_test.go new file mode 100644 index 0000000..cb4baeb --- /dev/null +++ b/object/grpc/service_frostfs_test.go @@ -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) + }) +} diff --git a/object/grpc/service_grpc.pb.go b/object/grpc/service_grpc.pb.go index 2494be9..687df99 100644 --- a/object/grpc/service_grpc.pb.go +++ b/object/grpc/service_grpc.pb.go @@ -331,7 +331,7 @@ type ObjectServiceClient interface { // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ // object not found in container; // - **OBJECT_ALREADY_REMOVED** (2052, SECTION_OBJECT): \ - // the requested object has been marked as deleted; + // the requested object has been marked as deleted. // - **OUT_OF_RANGE** (2053, SECTION_OBJECT): \ // the requested range is out of bounds; // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ @@ -855,7 +855,7 @@ type ObjectServiceServer interface { // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ // object not found in container; // - **OBJECT_ALREADY_REMOVED** (2052, SECTION_OBJECT): \ - // the requested object has been marked as deleted; + // the requested object has been marked as deleted. // - **OUT_OF_RANGE** (2053, SECTION_OBJECT): \ // the requested range is out of bounds; // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ diff --git a/object/grpc/status.pb.go b/object/grpc/status.pb.go deleted file mode 100644 index 034fa1b..0000000 --- a/object/grpc/status.pb.go +++ /dev/null @@ -1,251 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.27.1 -// protoc v3.18.0 -// source: v2/object/grpc/status.proto - -package object - -import ( - reflect "reflect" - sync "sync" - - grpc "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/status/grpc" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -type StatusCommon int32 - -const ( - StatusCommon_ACCESS_DENIED StatusCommon = 0 -) - -// Enum value maps for StatusCommon. -var ( - StatusCommon_name = map[int32]string{ - 0: "ACCESS_DENIED", - } - StatusCommon_value = map[string]int32{ - "ACCESS_DENIED": 0, - } -) - -func (x StatusCommon) Enum() *StatusCommon { - p := new(StatusCommon) - *p = x - return p -} - -func (x StatusCommon) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (StatusCommon) Descriptor() protoreflect.EnumDescriptor { - return file_v2_object_grpc_status_proto_enumTypes[0].Descriptor() -} - -func (StatusCommon) Type() protoreflect.EnumType { - return &file_v2_object_grpc_status_proto_enumTypes[0] -} - -func (x StatusCommon) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use StatusCommon.Descriptor instead. -func (StatusCommon) EnumDescriptor() ([]byte, []int) { - return file_v2_object_grpc_status_proto_rawDescGZIP(), []int{0} -} - -type StatusPut int32 - -const ( - StatusPut_STATUS_PUT_INCOMPLETE StatusPut = 0 -) - -// Enum value maps for StatusPut. -var ( - StatusPut_name = map[int32]string{ - 0: "STATUS_PUT_INCOMPLETE", - } - StatusPut_value = map[string]int32{ - "STATUS_PUT_INCOMPLETE": 0, - } -) - -func (x StatusPut) Enum() *StatusPut { - p := new(StatusPut) - *p = x - return p -} - -func (x StatusPut) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (StatusPut) Descriptor() protoreflect.EnumDescriptor { - return file_v2_object_grpc_status_proto_enumTypes[1].Descriptor() -} - -func (StatusPut) Type() protoreflect.EnumType { - return &file_v2_object_grpc_status_proto_enumTypes[1] -} - -func (x StatusPut) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use StatusPut.Descriptor instead. -func (StatusPut) EnumDescriptor() ([]byte, []int) { - return file_v2_object_grpc_status_proto_rawDescGZIP(), []int{1} -} - -type PutIncompleteDetail struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Statuses []*grpc.Status `protobuf:"bytes,1,rep,name=statuses,proto3" json:"statuses,omitempty"` -} - -func (x *PutIncompleteDetail) Reset() { - *x = PutIncompleteDetail{} - if protoimpl.UnsafeEnabled { - mi := &file_v2_object_grpc_status_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PutIncompleteDetail) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PutIncompleteDetail) ProtoMessage() {} - -func (x *PutIncompleteDetail) ProtoReflect() protoreflect.Message { - mi := &file_v2_object_grpc_status_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PutIncompleteDetail.ProtoReflect.Descriptor instead. -func (*PutIncompleteDetail) Descriptor() ([]byte, []int) { - return file_v2_object_grpc_status_proto_rawDescGZIP(), []int{0} -} - -func (x *PutIncompleteDetail) GetStatuses() []*grpc.Status { - if x != nil { - return x.Statuses - } - return nil -} - -var File_v2_object_grpc_status_proto protoreflect.FileDescriptor - -var file_v2_object_grpc_status_proto_rawDesc = []byte{ - 0x0a, 0x1b, 0x76, 0x32, 0x2f, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2f, 0x67, 0x72, 0x70, 0x63, - 0x2f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x10, 0x6e, - 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x1a, - 0x1a, 0x76, 0x32, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, - 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x4b, 0x0a, 0x13, 0x50, - 0x75, 0x74, 0x49, 0x6e, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x44, 0x65, 0x74, 0x61, - 0x69, 0x6c, 0x12, 0x34, 0x0a, 0x08, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x65, 0x73, 0x18, 0x01, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, - 0x2e, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x08, - 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x65, 0x73, 0x2a, 0x21, 0x0a, 0x0c, 0x53, 0x74, 0x61, 0x74, - 0x75, 0x73, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x12, 0x11, 0x0a, 0x0d, 0x41, 0x43, 0x43, 0x45, - 0x53, 0x53, 0x5f, 0x44, 0x45, 0x4e, 0x49, 0x45, 0x44, 0x10, 0x00, 0x2a, 0x26, 0x0a, 0x09, 0x53, - 0x74, 0x61, 0x74, 0x75, 0x73, 0x50, 0x75, 0x74, 0x12, 0x19, 0x0a, 0x15, 0x53, 0x54, 0x41, 0x54, - 0x55, 0x53, 0x5f, 0x50, 0x55, 0x54, 0x5f, 0x49, 0x4e, 0x43, 0x4f, 0x4d, 0x50, 0x4c, 0x45, 0x54, - 0x45, 0x10, 0x00, 0x42, 0x56, 0x5a, 0x37, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, - 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, - 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x6f, 0x62, 0x6a, 0x65, - 0x63, 0x74, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0xaa, 0x02, - 0x1a, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, - 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, -} - -var ( - file_v2_object_grpc_status_proto_rawDescOnce sync.Once - file_v2_object_grpc_status_proto_rawDescData = file_v2_object_grpc_status_proto_rawDesc -) - -func file_v2_object_grpc_status_proto_rawDescGZIP() []byte { - file_v2_object_grpc_status_proto_rawDescOnce.Do(func() { - file_v2_object_grpc_status_proto_rawDescData = protoimpl.X.CompressGZIP(file_v2_object_grpc_status_proto_rawDescData) - }) - return file_v2_object_grpc_status_proto_rawDescData -} - -var file_v2_object_grpc_status_proto_enumTypes = make([]protoimpl.EnumInfo, 2) -var file_v2_object_grpc_status_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_v2_object_grpc_status_proto_goTypes = []interface{}{ - (StatusCommon)(0), // 0: neo.fs.v2.object.StatusCommon - (StatusPut)(0), // 1: neo.fs.v2.object.StatusPut - (*PutIncompleteDetail)(nil), // 2: neo.fs.v2.object.PutIncompleteDetail - (*grpc.Status)(nil), // 3: neo.fs.v2.status.Status -} -var file_v2_object_grpc_status_proto_depIdxs = []int32{ - 3, // 0: neo.fs.v2.object.PutIncompleteDetail.statuses:type_name -> neo.fs.v2.status.Status - 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_v2_object_grpc_status_proto_init() } -func file_v2_object_grpc_status_proto_init() { - if File_v2_object_grpc_status_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_v2_object_grpc_status_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PutIncompleteDetail); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_v2_object_grpc_status_proto_rawDesc, - NumEnums: 2, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_v2_object_grpc_status_proto_goTypes, - DependencyIndexes: file_v2_object_grpc_status_proto_depIdxs, - EnumInfos: file_v2_object_grpc_status_proto_enumTypes, - MessageInfos: file_v2_object_grpc_status_proto_msgTypes, - }.Build() - File_v2_object_grpc_status_proto = out.File - file_v2_object_grpc_status_proto_rawDesc = nil - file_v2_object_grpc_status_proto_goTypes = nil - file_v2_object_grpc_status_proto_depIdxs = nil -} diff --git a/object/grpc/types.go b/object/grpc/types.go deleted file mode 100644 index 9a2cdea..0000000 --- a/object/grpc/types.go +++ /dev/null @@ -1,197 +0,0 @@ -package object - -import ( - refs "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc" - session "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session/grpc" -) - -// SetKey sets key to the object attribute. -func (m *Header_Attribute) SetKey(v string) { - m.Key = v -} - -// SetValue sets value of the object attribute. -func (m *Header_Attribute) SetValue(v string) { - m.Value = v -} - -// SetParent sets identifier of the parent object. -func (m *Header_Split) SetParent(v *refs.ObjectID) { - m.Parent = v -} - -// SetPrevious sets identifier of the previous object in split-chain. -func (m *Header_Split) SetPrevious(v *refs.ObjectID) { - m.Previous = v -} - -// SetParentSignature sets signature of the parent object header. -func (m *Header_Split) SetParentSignature(v *refs.Signature) { - m.ParentSignature = v -} - -// SetParentHeader sets parent header structure. -func (m *Header_Split) SetParentHeader(v *Header) { - m.ParentHeader = v -} - -// SetChildren sets list of the identifiers of the child objects. -func (m *Header_Split) SetChildren(v []*refs.ObjectID) { - m.Children = v -} - -// SetSplitId sets split ID of the object. -func (m *Header_Split) SetSplitId(v []byte) { - m.SplitId = v -} - -// SetContainerId sets identifier of the container. -func (m *Header) SetContainerId(v *refs.ContainerID) { - m.ContainerId = v -} - -// SetOwnerId sets identifier of the object owner. -func (m *Header) SetOwnerId(v *refs.OwnerID) { - m.OwnerId = v -} - -// SetCreationEpoch sets creation epoch number. -func (m *Header) SetCreationEpoch(v uint64) { - m.CreationEpoch = v -} - -// SetVersion sets version of the object format. -func (m *Header) SetVersion(v *refs.Version) { - m.Version = v -} - -// SetPayloadLength sets length of the object payload. -func (m *Header) SetPayloadLength(v uint64) { - m.PayloadLength = v -} - -// SetPayloadHash sets hash of the object payload. -func (m *Header) SetPayloadHash(v *refs.Checksum) { - m.PayloadHash = v -} - -// SetObjectType sets type of the object. -func (m *Header) SetObjectType(v ObjectType) { - m.ObjectType = v -} - -// SetHomomorphicHash sets homomorphic hash of the object payload. -func (m *Header) SetHomomorphicHash(v *refs.Checksum) { - m.HomomorphicHash = v -} - -// SetSessionToken sets session token. -func (m *Header) SetSessionToken(v *session.SessionToken) { - m.SessionToken = v -} - -// SetAttributes sets list of the object attributes. -func (m *Header) SetAttributes(v []*Header_Attribute) { - m.Attributes = v -} - -// SetSplit sets split header. -func (m *Header) SetSplit(v *Header_Split) { - m.Split = v -} - -// SetObjectId sets identifier of the object. -func (m *Object) SetObjectId(v *refs.ObjectID) { - m.ObjectId = v -} - -// SetSignature sets signature of the object identifier. -func (m *Object) SetSignature(v *refs.Signature) { - m.Signature = v -} - -// SetHeader sets header of the object. -func (m *Object) SetHeader(v *Header) { - m.Header = v -} - -// SetPayload sets payload bytes of the object. -func (m *Object) SetPayload(v []byte) { - m.Payload = v -} - -// SetVersion sets version of the object. -func (m *ShortHeader) SetVersion(v *refs.Version) { - m.Version = v -} - -// SetCreationEpoch sets creation epoch number. -func (m *ShortHeader) SetCreationEpoch(v uint64) { - m.CreationEpoch = v -} - -// SetOwnerId sets identifier of the object owner. -func (m *ShortHeader) SetOwnerId(v *refs.OwnerID) { - m.OwnerId = v -} - -// SetObjectType sets type of the object. -func (m *ShortHeader) SetObjectType(v ObjectType) { - m.ObjectType = v -} - -// SetPayloadLength sets length of the object payload. -func (m *ShortHeader) SetPayloadLength(v uint64) { - m.PayloadLength = v -} - -// SetPayloadHash sets hash of the object payload. -func (m *ShortHeader) SetPayloadHash(v *refs.Checksum) { - m.PayloadHash = v -} - -// SetHomomorphicHash sets homomorphic hash of the object payload. -func (m *ShortHeader) SetHomomorphicHash(v *refs.Checksum) { - m.HomomorphicHash = v -} - -// SetSplitId sets id of split hierarchy. -func (m *SplitInfo) SetSplitId(v []byte) { - m.SplitId = v -} - -// SetLastPart sets id of most right child in split hierarchy. -func (m *SplitInfo) SetLastPart(v *refs.ObjectID) { - m.LastPart = v -} - -// SetLink sets id of linking object in split hierarchy. -func (m *SplitInfo) SetLink(v *refs.ObjectID) { - m.Link = v -} - -// FromString parses ObjectType from a string representation, -// It is a reverse action to String(). -// -// Returns true if s was parsed successfully. -func (x *ObjectType) FromString(s string) bool { - i, ok := ObjectType_value[s] - if ok { - *x = ObjectType(i) - } - - return ok -} - -// FromString parses MatchType from a string representation, -// It is a reverse action to String(). -// -// Returns true if s was parsed successfully. -func (x *MatchType) FromString(s string) bool { - i, ok := MatchType_value[s] - if ok { - *x = MatchType(i) - } - - return ok -} diff --git a/object/grpc/types.pb.go b/object/grpc/types.pb.go deleted file mode 100644 index 2a5a2f9..0000000 --- a/object/grpc/types.pb.go +++ /dev/null @@ -1,1373 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.33.0 -// protoc v5.27.2 -// source: object/grpc/types.proto - -package object - -import ( - grpc "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc" - grpc1 "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session/grpc" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -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) -) - -// Type of the object payload content. Only `REGULAR` type objects can be split, -// hence `TOMBSTONE` and `LOCK` payload is limited by the -// maximum object size. -// -// String presentation of object type is the same as definition: -// * REGULAR -// * TOMBSTONE -// * LOCK -type ObjectType int32 - -const ( - // Just a normal object - ObjectType_REGULAR ObjectType = 0 - // Used internally to identify deleted objects - ObjectType_TOMBSTONE ObjectType = 1 - // Object lock - ObjectType_LOCK ObjectType = 3 -) - -// Enum value maps for ObjectType. -var ( - ObjectType_name = map[int32]string{ - 0: "REGULAR", - 1: "TOMBSTONE", - 3: "LOCK", - } - ObjectType_value = map[string]int32{ - "REGULAR": 0, - "TOMBSTONE": 1, - "LOCK": 3, - } -) - -func (x ObjectType) Enum() *ObjectType { - p := new(ObjectType) - *p = x - return p -} - -func (x ObjectType) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (ObjectType) Descriptor() protoreflect.EnumDescriptor { - return file_object_grpc_types_proto_enumTypes[0].Descriptor() -} - -func (ObjectType) Type() protoreflect.EnumType { - return &file_object_grpc_types_proto_enumTypes[0] -} - -func (x ObjectType) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use ObjectType.Descriptor instead. -func (ObjectType) EnumDescriptor() ([]byte, []int) { - return file_object_grpc_types_proto_rawDescGZIP(), []int{0} -} - -// Type of match expression -type MatchType int32 - -const ( - // Unknown. Not used - MatchType_MATCH_TYPE_UNSPECIFIED MatchType = 0 - // Full string match - MatchType_STRING_EQUAL MatchType = 1 - // Full string mismatch - MatchType_STRING_NOT_EQUAL MatchType = 2 - // Lack of key - MatchType_NOT_PRESENT MatchType = 3 - // String prefix match - MatchType_COMMON_PREFIX MatchType = 4 -) - -// Enum value maps for MatchType. -var ( - MatchType_name = map[int32]string{ - 0: "MATCH_TYPE_UNSPECIFIED", - 1: "STRING_EQUAL", - 2: "STRING_NOT_EQUAL", - 3: "NOT_PRESENT", - 4: "COMMON_PREFIX", - } - MatchType_value = map[string]int32{ - "MATCH_TYPE_UNSPECIFIED": 0, - "STRING_EQUAL": 1, - "STRING_NOT_EQUAL": 2, - "NOT_PRESENT": 3, - "COMMON_PREFIX": 4, - } -) - -func (x MatchType) Enum() *MatchType { - p := new(MatchType) - *p = x - return p -} - -func (x MatchType) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (MatchType) Descriptor() protoreflect.EnumDescriptor { - return file_object_grpc_types_proto_enumTypes[1].Descriptor() -} - -func (MatchType) Type() protoreflect.EnumType { - return &file_object_grpc_types_proto_enumTypes[1] -} - -func (x MatchType) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use MatchType.Descriptor instead. -func (MatchType) EnumDescriptor() ([]byte, []int) { - return file_object_grpc_types_proto_rawDescGZIP(), []int{1} -} - -// Short header fields -type ShortHeader struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Object format version. Effectively, the version of API library used to - // create particular object. - Version *grpc.Version `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` - // Epoch when the object was created - CreationEpoch uint64 `protobuf:"varint,2,opt,name=creation_epoch,json=creationEpoch,proto3" json:"creation_epoch,omitempty"` - // Object's owner - OwnerId *grpc.OwnerID `protobuf:"bytes,3,opt,name=owner_id,json=ownerID,proto3" json:"owner_id,omitempty"` - // Type of the object payload content - ObjectType ObjectType `protobuf:"varint,4,opt,name=object_type,json=objectType,proto3,enum=neo.fs.v2.object.ObjectType" json:"object_type,omitempty"` - // Size of payload in bytes. - // `0xFFFFFFFFFFFFFFFF` means `payload_length` is unknown - PayloadLength uint64 `protobuf:"varint,5,opt,name=payload_length,json=payloadLength,proto3" json:"payload_length,omitempty"` - // Hash of payload bytes - PayloadHash *grpc.Checksum `protobuf:"bytes,6,opt,name=payload_hash,json=payloadHash,proto3" json:"payload_hash,omitempty"` - // Homomorphic hash of the object payload - HomomorphicHash *grpc.Checksum `protobuf:"bytes,7,opt,name=homomorphic_hash,json=homomorphicHash,proto3" json:"homomorphic_hash,omitempty"` -} - -func (x *ShortHeader) Reset() { - *x = ShortHeader{} - if protoimpl.UnsafeEnabled { - mi := &file_object_grpc_types_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ShortHeader) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ShortHeader) ProtoMessage() {} - -func (x *ShortHeader) ProtoReflect() protoreflect.Message { - mi := &file_object_grpc_types_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ShortHeader.ProtoReflect.Descriptor instead. -func (*ShortHeader) Descriptor() ([]byte, []int) { - return file_object_grpc_types_proto_rawDescGZIP(), []int{0} -} - -func (x *ShortHeader) GetVersion() *grpc.Version { - if x != nil { - return x.Version - } - return nil -} - -func (x *ShortHeader) GetCreationEpoch() uint64 { - if x != nil { - return x.CreationEpoch - } - return 0 -} - -func (x *ShortHeader) GetOwnerId() *grpc.OwnerID { - if x != nil { - return x.OwnerId - } - return nil -} - -func (x *ShortHeader) GetObjectType() ObjectType { - if x != nil { - return x.ObjectType - } - return ObjectType_REGULAR -} - -func (x *ShortHeader) GetPayloadLength() uint64 { - if x != nil { - return x.PayloadLength - } - return 0 -} - -func (x *ShortHeader) GetPayloadHash() *grpc.Checksum { - if x != nil { - return x.PayloadHash - } - return nil -} - -func (x *ShortHeader) GetHomomorphicHash() *grpc.Checksum { - if x != nil { - return x.HomomorphicHash - } - return nil -} - -// Object Header -type Header struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Object format version. Effectively, the version of API library used to - // create particular object - Version *grpc.Version `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` - // Object's container - ContainerId *grpc.ContainerID `protobuf:"bytes,2,opt,name=container_id,json=containerID,proto3" json:"container_id,omitempty"` - // Object's owner - OwnerId *grpc.OwnerID `protobuf:"bytes,3,opt,name=owner_id,json=ownerID,proto3" json:"owner_id,omitempty"` - // Object creation Epoch - CreationEpoch uint64 `protobuf:"varint,4,opt,name=creation_epoch,json=creationEpoch,proto3" json:"creation_epoch,omitempty"` - // Size of payload in bytes. - // `0xFFFFFFFFFFFFFFFF` means `payload_length` is unknown. - PayloadLength uint64 `protobuf:"varint,5,opt,name=payload_length,json=payloadLength,proto3" json:"payload_length,omitempty"` - // Hash of payload bytes - PayloadHash *grpc.Checksum `protobuf:"bytes,6,opt,name=payload_hash,json=payloadHash,proto3" json:"payload_hash,omitempty"` - // Type of the object payload content - ObjectType ObjectType `protobuf:"varint,7,opt,name=object_type,json=objectType,proto3,enum=neo.fs.v2.object.ObjectType" json:"object_type,omitempty"` - // Homomorphic hash of the object payload - HomomorphicHash *grpc.Checksum `protobuf:"bytes,8,opt,name=homomorphic_hash,json=homomorphicHash,proto3" json:"homomorphic_hash,omitempty"` - // Session token, if it was used during Object creation. Need it to verify - // integrity and authenticity out of Request scope. - SessionToken *grpc1.SessionToken `protobuf:"bytes,9,opt,name=session_token,json=sessionToken,proto3" json:"session_token,omitempty"` - // User-defined object attributes - Attributes []*Header_Attribute `protobuf:"bytes,10,rep,name=attributes,proto3" json:"attributes,omitempty"` - // Position of the object in the split hierarchy - Split *Header_Split `protobuf:"bytes,11,opt,name=split,proto3" json:"split,omitempty"` - // Erasure code chunk information. - Ec *Header_EC `protobuf:"bytes,12,opt,name=ec,proto3" json:"ec,omitempty"` -} - -func (x *Header) Reset() { - *x = Header{} - if protoimpl.UnsafeEnabled { - mi := &file_object_grpc_types_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Header) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Header) ProtoMessage() {} - -func (x *Header) ProtoReflect() protoreflect.Message { - mi := &file_object_grpc_types_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Header.ProtoReflect.Descriptor instead. -func (*Header) Descriptor() ([]byte, []int) { - return file_object_grpc_types_proto_rawDescGZIP(), []int{1} -} - -func (x *Header) GetVersion() *grpc.Version { - if x != nil { - return x.Version - } - return nil -} - -func (x *Header) GetContainerId() *grpc.ContainerID { - if x != nil { - return x.ContainerId - } - return nil -} - -func (x *Header) GetOwnerId() *grpc.OwnerID { - if x != nil { - return x.OwnerId - } - return nil -} - -func (x *Header) GetCreationEpoch() uint64 { - if x != nil { - return x.CreationEpoch - } - return 0 -} - -func (x *Header) GetPayloadLength() uint64 { - if x != nil { - return x.PayloadLength - } - return 0 -} - -func (x *Header) GetPayloadHash() *grpc.Checksum { - if x != nil { - return x.PayloadHash - } - return nil -} - -func (x *Header) GetObjectType() ObjectType { - if x != nil { - return x.ObjectType - } - return ObjectType_REGULAR -} - -func (x *Header) GetHomomorphicHash() *grpc.Checksum { - if x != nil { - return x.HomomorphicHash - } - return nil -} - -func (x *Header) GetSessionToken() *grpc1.SessionToken { - if x != nil { - return x.SessionToken - } - return nil -} - -func (x *Header) GetAttributes() []*Header_Attribute { - if x != nil { - return x.Attributes - } - return nil -} - -func (x *Header) GetSplit() *Header_Split { - if x != nil { - return x.Split - } - return nil -} - -func (x *Header) GetEc() *Header_EC { - if x != nil { - return x.Ec - } - return nil -} - -// Object structure. Object is immutable and content-addressed. It means -// `ObjectID` will change if the header or the payload changes. It's calculated -// as a hash of header field which contains hash of the object's payload. -// -// For non-regular object types payload format depends on object type specified -// in the header. -type Object struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Object's unique identifier. - ObjectId *grpc.ObjectID `protobuf:"bytes,1,opt,name=object_id,json=objectID,proto3" json:"object_id,omitempty"` - // Signed object_id - Signature *grpc.Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` - // Object metadata headers - Header *Header `protobuf:"bytes,3,opt,name=header,proto3" json:"header,omitempty"` - // Payload bytes - Payload []byte `protobuf:"bytes,4,opt,name=payload,proto3" json:"payload,omitempty"` -} - -func (x *Object) Reset() { - *x = Object{} - if protoimpl.UnsafeEnabled { - mi := &file_object_grpc_types_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Object) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Object) ProtoMessage() {} - -func (x *Object) ProtoReflect() protoreflect.Message { - mi := &file_object_grpc_types_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Object.ProtoReflect.Descriptor instead. -func (*Object) Descriptor() ([]byte, []int) { - return file_object_grpc_types_proto_rawDescGZIP(), []int{2} -} - -func (x *Object) GetObjectId() *grpc.ObjectID { - if x != nil { - return x.ObjectId - } - return nil -} - -func (x *Object) GetSignature() *grpc.Signature { - if x != nil { - return x.Signature - } - return nil -} - -func (x *Object) GetHeader() *Header { - if x != nil { - return x.Header - } - return nil -} - -func (x *Object) GetPayload() []byte { - if x != nil { - return x.Payload - } - return nil -} - -// Meta information of split hierarchy for object assembly. With the last part -// one can traverse linked list of split hierarchy back to the first part and -// assemble the original object. With a linking object one can assemble an -// object right from the object parts. -type SplitInfo struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // 16 byte UUID used to identify the split object hierarchy parts. - SplitId []byte `protobuf:"bytes,1,opt,name=split_id,json=splitId,proto3" json:"split_id,omitempty"` - // The identifier of the last object in split hierarchy parts. It contains - // split header with the original object header. - LastPart *grpc.ObjectID `protobuf:"bytes,2,opt,name=last_part,json=lastPart,proto3" json:"last_part,omitempty"` - // The identifier of a linking object for split hierarchy parts. It contains - // split header with the original object header and a sorted list of - // object parts. - Link *grpc.ObjectID `protobuf:"bytes,3,opt,name=link,proto3" json:"link,omitempty"` -} - -func (x *SplitInfo) Reset() { - *x = SplitInfo{} - if protoimpl.UnsafeEnabled { - mi := &file_object_grpc_types_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SplitInfo) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SplitInfo) ProtoMessage() {} - -func (x *SplitInfo) ProtoReflect() protoreflect.Message { - mi := &file_object_grpc_types_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SplitInfo.ProtoReflect.Descriptor instead. -func (*SplitInfo) Descriptor() ([]byte, []int) { - return file_object_grpc_types_proto_rawDescGZIP(), []int{3} -} - -func (x *SplitInfo) GetSplitId() []byte { - if x != nil { - return x.SplitId - } - return nil -} - -func (x *SplitInfo) GetLastPart() *grpc.ObjectID { - if x != nil { - return x.LastPart - } - return nil -} - -func (x *SplitInfo) GetLink() *grpc.ObjectID { - if x != nil { - return x.Link - } - return nil -} - -// Meta information for the erasure-encoded object. -type ECInfo struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Chunk stored on the node. - Chunks []*ECInfo_Chunk `protobuf:"bytes,1,rep,name=chunks,proto3" json:"chunks,omitempty"` -} - -func (x *ECInfo) Reset() { - *x = ECInfo{} - if protoimpl.UnsafeEnabled { - mi := &file_object_grpc_types_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ECInfo) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ECInfo) ProtoMessage() {} - -func (x *ECInfo) ProtoReflect() protoreflect.Message { - mi := &file_object_grpc_types_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ECInfo.ProtoReflect.Descriptor instead. -func (*ECInfo) Descriptor() ([]byte, []int) { - return file_object_grpc_types_proto_rawDescGZIP(), []int{4} -} - -func (x *ECInfo) GetChunks() []*ECInfo_Chunk { - if x != nil { - return x.Chunks - } - return nil -} - -// `Attribute` is a user-defined Key-Value metadata pair attached to an -// object. -// -// Key name must be an object-unique valid UTF-8 string. Value can't be empty. -// Objects with duplicated attribute names or attributes with empty values -// will be considered invalid. -// -// There are some "well-known" attributes starting with `__SYSTEM__` -// (`__NEOFS__` is deprecated) prefix that affect system behaviour: -// -// - [ __SYSTEM__UPLOAD_ID ] \ -// (`__NEOFS__UPLOAD_ID` is deprecated) \ -// Marks smaller parts of a split bigger object -// - [ __SYSTEM__EXPIRATION_EPOCH ] \ -// (`__NEOFS__EXPIRATION_EPOCH` is deprecated) \ -// The epoch after which object with no LOCKs on it becomes unavailable. -// Locked object continues to be available until each of the LOCKs expire. -// - [ __SYSTEM__TICK_EPOCH ] \ -// (`__NEOFS__TICK_EPOCH` is deprecated) \ -// Decimal number that defines what epoch must produce -// object notification with UTF-8 object address in a -// body (`0` value produces notification right after -// object put) -// - [ __SYSTEM__TICK_TOPIC ] \ -// (`__NEOFS__TICK_TOPIC` is deprecated) \ -// UTF-8 string topic ID that is used for object notification -// -// And some well-known attributes used by applications only: -// -// - Name \ -// Human-friendly name -// - FileName \ -// File name to be associated with the object on saving -// - FilePath \ -// Full path to be associated with the object on saving. Should start with a -// '/' and use '/' as a delimiting symbol. Trailing '/' should be -// interpreted as a virtual directory marker. If an object has conflicting -// FilePath and FileName, FilePath should have higher priority, because it -// is used to construct the directory tree. FilePath with trailing '/' and -// non-empty FileName attribute should not be used together. -// - Timestamp \ -// User-defined local time of object creation in Unix Timestamp format -// - Content-Type \ -// MIME Content Type of object's payload -// -// For detailed description of each well-known attribute please see the -// corresponding section in NeoFS Technical Specification. -type Header_Attribute struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // string key to the object attribute - Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - // string value of the object attribute - Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` -} - -func (x *Header_Attribute) Reset() { - *x = Header_Attribute{} - if protoimpl.UnsafeEnabled { - mi := &file_object_grpc_types_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Header_Attribute) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Header_Attribute) ProtoMessage() {} - -func (x *Header_Attribute) ProtoReflect() protoreflect.Message { - mi := &file_object_grpc_types_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Header_Attribute.ProtoReflect.Descriptor instead. -func (*Header_Attribute) Descriptor() ([]byte, []int) { - return file_object_grpc_types_proto_rawDescGZIP(), []int{1, 0} -} - -func (x *Header_Attribute) GetKey() string { - if x != nil { - return x.Key - } - return "" -} - -func (x *Header_Attribute) GetValue() string { - if x != nil { - return x.Value - } - return "" -} - -// Bigger objects can be split into a chain of smaller objects. Information -// about inter-dependencies between spawned objects and how to re-construct -// the original one is in the `Split` headers. Parent and children objects -// must be within the same container. -type Header_Split struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Identifier of the origin object. Known only to the minor child. - Parent *grpc.ObjectID `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"` - // Identifier of the left split neighbor - Previous *grpc.ObjectID `protobuf:"bytes,2,opt,name=previous,proto3" json:"previous,omitempty"` - // `signature` field of the parent object. Used to reconstruct parent. - ParentSignature *grpc.Signature `protobuf:"bytes,3,opt,name=parent_signature,json=parentSignature,proto3" json:"parent_signature,omitempty"` - // `header` field of the parent object. Used to reconstruct parent. - ParentHeader *Header `protobuf:"bytes,4,opt,name=parent_header,json=parentHeader,proto3" json:"parent_header,omitempty"` - // List of identifiers of the objects generated by splitting current one. - Children []*grpc.ObjectID `protobuf:"bytes,5,rep,name=children,proto3" json:"children,omitempty"` - // 16 byte UUIDv4 used to identify the split object hierarchy parts. Must be - // unique inside container. All objects participating in the split must have - // the same `split_id` value. - SplitId []byte `protobuf:"bytes,6,opt,name=split_id,json=splitID,proto3" json:"split_id,omitempty"` -} - -func (x *Header_Split) Reset() { - *x = Header_Split{} - if protoimpl.UnsafeEnabled { - mi := &file_object_grpc_types_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Header_Split) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Header_Split) ProtoMessage() {} - -func (x *Header_Split) ProtoReflect() protoreflect.Message { - mi := &file_object_grpc_types_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Header_Split.ProtoReflect.Descriptor instead. -func (*Header_Split) Descriptor() ([]byte, []int) { - return file_object_grpc_types_proto_rawDescGZIP(), []int{1, 1} -} - -func (x *Header_Split) GetParent() *grpc.ObjectID { - if x != nil { - return x.Parent - } - return nil -} - -func (x *Header_Split) GetPrevious() *grpc.ObjectID { - if x != nil { - return x.Previous - } - return nil -} - -func (x *Header_Split) GetParentSignature() *grpc.Signature { - if x != nil { - return x.ParentSignature - } - return nil -} - -func (x *Header_Split) GetParentHeader() *Header { - if x != nil { - return x.ParentHeader - } - return nil -} - -func (x *Header_Split) GetChildren() []*grpc.ObjectID { - if x != nil { - return x.Children - } - return nil -} - -func (x *Header_Split) GetSplitId() []byte { - if x != nil { - return x.SplitId - } - return nil -} - -// Erasure code can be applied to any object. -// Information about encoded object structure is stored in `EC` header. -// All objects belonging to a single EC group have the same `parent` field. -type Header_EC struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Identifier of the origin object. Known to all chunks. - Parent *grpc.ObjectID `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"` - // Index of this chunk. - Index uint32 `protobuf:"varint,2,opt,name=index,proto3" json:"index,omitempty"` - // Total number of chunks in this split. - Total uint32 `protobuf:"varint,3,opt,name=total,proto3" json:"total,omitempty"` - // Total length of a parent header. Used to trim padding zeroes. - HeaderLength uint32 `protobuf:"varint,4,opt,name=header_length,json=headerLength,proto3" json:"header_length,omitempty"` - // Chunk of a parent header. - Header []byte `protobuf:"bytes,5,opt,name=header,proto3" json:"header,omitempty"` - // As the origin object is EC-splitted its identifier is known to all - // chunks as parent. But parent itself can be a part of Split (does not - // relate to EC-split). In this case parent_split_id should be set. - ParentSplitId []byte `protobuf:"bytes,6,opt,name=parent_split_id,json=parentSplitID,proto3" json:"parent_split_id,omitempty"` - // EC-parent's parent ID. parent_split_parent_id is set if EC-parent, - // itself, is a part of Split and if an object ID of its parent is - // presented. The field allows to determine how EC-chunk is placed in Split - // hierarchy. - ParentSplitParentId *grpc.ObjectID `protobuf:"bytes,7,opt,name=parent_split_parent_id,json=parentSplitParentID,proto3" json:"parent_split_parent_id,omitempty"` - // EC parent's attributes. - ParentAttributes []*Header_Attribute `protobuf:"bytes,8,rep,name=parent_attributes,json=parentAttributes,proto3" json:"parent_attributes,omitempty"` -} - -func (x *Header_EC) Reset() { - *x = Header_EC{} - if protoimpl.UnsafeEnabled { - mi := &file_object_grpc_types_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Header_EC) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Header_EC) ProtoMessage() {} - -func (x *Header_EC) ProtoReflect() protoreflect.Message { - mi := &file_object_grpc_types_proto_msgTypes[7] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Header_EC.ProtoReflect.Descriptor instead. -func (*Header_EC) Descriptor() ([]byte, []int) { - return file_object_grpc_types_proto_rawDescGZIP(), []int{1, 2} -} - -func (x *Header_EC) GetParent() *grpc.ObjectID { - if x != nil { - return x.Parent - } - return nil -} - -func (x *Header_EC) GetIndex() uint32 { - if x != nil { - return x.Index - } - return 0 -} - -func (x *Header_EC) GetTotal() uint32 { - if x != nil { - return x.Total - } - return 0 -} - -func (x *Header_EC) GetHeaderLength() uint32 { - if x != nil { - return x.HeaderLength - } - return 0 -} - -func (x *Header_EC) GetHeader() []byte { - if x != nil { - return x.Header - } - return nil -} - -func (x *Header_EC) GetParentSplitId() []byte { - if x != nil { - return x.ParentSplitId - } - return nil -} - -func (x *Header_EC) GetParentSplitParentId() *grpc.ObjectID { - if x != nil { - return x.ParentSplitParentId - } - return nil -} - -func (x *Header_EC) GetParentAttributes() []*Header_Attribute { - if x != nil { - return x.ParentAttributes - } - return nil -} - -type ECInfo_Chunk struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Object ID of the chunk. - Id *grpc.ObjectID `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - // Index of the chunk. - Index uint32 `protobuf:"varint,2,opt,name=index,proto3" json:"index,omitempty"` - // Total number of chunks in this split. - Total uint32 `protobuf:"varint,3,opt,name=total,proto3" json:"total,omitempty"` -} - -func (x *ECInfo_Chunk) Reset() { - *x = ECInfo_Chunk{} - if protoimpl.UnsafeEnabled { - mi := &file_object_grpc_types_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ECInfo_Chunk) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ECInfo_Chunk) ProtoMessage() {} - -func (x *ECInfo_Chunk) ProtoReflect() protoreflect.Message { - mi := &file_object_grpc_types_proto_msgTypes[8] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ECInfo_Chunk.ProtoReflect.Descriptor instead. -func (*ECInfo_Chunk) Descriptor() ([]byte, []int) { - return file_object_grpc_types_proto_rawDescGZIP(), []int{4, 0} -} - -func (x *ECInfo_Chunk) GetId() *grpc.ObjectID { - if x != nil { - return x.Id - } - return nil -} - -func (x *ECInfo_Chunk) GetIndex() uint32 { - if x != nil { - return x.Index - } - return 0 -} - -func (x *ECInfo_Chunk) GetTotal() uint32 { - if x != nil { - return x.Total - } - return 0 -} - -var File_object_grpc_types_proto protoreflect.FileDescriptor - -var file_object_grpc_types_proto_rawDesc = []byte{ - 0x0a, 0x17, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, - 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x10, 0x6e, 0x65, 0x6f, 0x2e, 0x66, - 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x1a, 0x15, 0x72, 0x65, 0x66, - 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x1a, 0x18, 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, 0x83, 0x03, 0x0a, - 0x0b, 0x53, 0x68, 0x6f, 0x72, 0x74, 0x48, 0x65, 0x61, 0x64, 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, - 0x25, 0x0a, 0x0e, 0x63, 0x72, 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x70, 0x6f, 0x63, - 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0d, 0x63, 0x72, 0x65, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x45, 0x70, 0x6f, 0x63, 0x68, 0x12, 0x32, 0x0a, 0x08, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x5f, - 0x69, 0x64, 0x18, 0x03, 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, 0x3d, 0x0a, 0x0b, 0x6f, 0x62, - 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, - 0x1c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, - 0x63, 0x74, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x52, 0x0a, 0x6f, - 0x62, 0x6a, 0x65, 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x25, 0x0a, 0x0e, 0x70, 0x61, 0x79, - 0x6c, 0x6f, 0x61, 0x64, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x05, 0x20, 0x01, 0x28, - 0x04, 0x52, 0x0d, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, - 0x12, 0x3b, 0x0a, 0x0c, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x5f, 0x68, 0x61, 0x73, 0x68, - 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, - 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, - 0x52, 0x0b, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x48, 0x61, 0x73, 0x68, 0x12, 0x43, 0x0a, - 0x10, 0x68, 0x6f, 0x6d, 0x6f, 0x6d, 0x6f, 0x72, 0x70, 0x68, 0x69, 0x63, 0x5f, 0x68, 0x61, 0x73, - 0x68, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, - 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, - 0x6d, 0x52, 0x0f, 0x68, 0x6f, 0x6d, 0x6f, 0x6d, 0x6f, 0x72, 0x70, 0x68, 0x69, 0x63, 0x48, 0x61, - 0x73, 0x68, 0x22, 0x92, 0x0b, 0x0a, 0x06, 0x48, 0x65, 0x61, 0x64, 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, 0x3e, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, - 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, - 0x72, 0x49, 0x44, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, - 0x12, 0x32, 0x0a, 0x08, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x03, 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, 0x25, 0x0a, 0x0e, 0x63, 0x72, 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x5f, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0d, 0x63, 0x72, - 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x70, 0x6f, 0x63, 0x68, 0x12, 0x25, 0x0a, 0x0e, 0x70, - 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x05, 0x20, - 0x01, 0x28, 0x04, 0x52, 0x0d, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x4c, 0x65, 0x6e, 0x67, - 0x74, 0x68, 0x12, 0x3b, 0x0a, 0x0c, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x5f, 0x68, 0x61, - 0x73, 0x68, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, - 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, - 0x75, 0x6d, 0x52, 0x0b, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x48, 0x61, 0x73, 0x68, 0x12, - 0x3d, 0x0a, 0x0b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x07, - 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, - 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x54, 0x79, - 0x70, 0x65, 0x52, 0x0a, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x43, - 0x0a, 0x10, 0x68, 0x6f, 0x6d, 0x6f, 0x6d, 0x6f, 0x72, 0x70, 0x68, 0x69, 0x63, 0x5f, 0x68, 0x61, - 0x73, 0x68, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, - 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, - 0x75, 0x6d, 0x52, 0x0f, 0x68, 0x6f, 0x6d, 0x6f, 0x6d, 0x6f, 0x72, 0x70, 0x68, 0x69, 0x63, 0x48, - 0x61, 0x73, 0x68, 0x12, 0x44, 0x0a, 0x0d, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x74, - 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, - 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x53, - 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x0c, 0x73, 0x65, 0x73, - 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x42, 0x0a, 0x0a, 0x61, 0x74, 0x74, - 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, - 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, - 0x2e, 0x48, 0x65, 0x61, 0x64, 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, 0x34, 0x0a, - 0x05, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x6e, - 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, - 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x2e, 0x53, 0x70, 0x6c, 0x69, 0x74, 0x52, 0x05, 0x73, 0x70, - 0x6c, 0x69, 0x74, 0x12, 0x2b, 0x0a, 0x02, 0x65, 0x63, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, - 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x2e, 0x45, 0x43, 0x52, 0x02, 0x65, 0x63, - 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, 0x1a, 0xc5, 0x02, 0x0a, 0x05, 0x53, 0x70, 0x6c, 0x69, 0x74, 0x12, - 0x30, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 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, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, - 0x74, 0x12, 0x34, 0x0a, 0x08, 0x70, 0x72, 0x65, 0x76, 0x69, 0x6f, 0x75, 0x73, 0x18, 0x02, 0x20, - 0x01, 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, 0x08, 0x70, - 0x72, 0x65, 0x76, 0x69, 0x6f, 0x75, 0x73, 0x12, 0x44, 0x0a, 0x10, 0x70, 0x61, 0x72, 0x65, 0x6e, - 0x74, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, - 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x0f, 0x70, 0x61, - 0x72, 0x65, 0x6e, 0x74, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x3d, 0x0a, - 0x0d, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x04, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, - 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0c, - 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x34, 0x0a, 0x08, - 0x63, 0x68, 0x69, 0x6c, 0x64, 0x72, 0x65, 0x6e, 0x18, 0x05, 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, 0x08, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x72, - 0x65, 0x6e, 0x12, 0x19, 0x0a, 0x08, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x06, - 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x49, 0x44, 0x1a, 0xe7, 0x02, - 0x0a, 0x02, 0x45, 0x43, 0x12, 0x30, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x18, 0x01, - 0x20, 0x01, 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, 0x06, - 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x14, 0x0a, 0x05, - 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x74, 0x6f, 0x74, - 0x61, 0x6c, 0x12, 0x23, 0x0a, 0x0d, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x5f, 0x6c, 0x65, 0x6e, - 0x67, 0x74, 0x68, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0c, 0x68, 0x65, 0x61, 0x64, 0x65, - 0x72, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x16, 0x0a, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, - 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, - 0x26, 0x0a, 0x0f, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x5f, - 0x69, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0d, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, - 0x53, 0x70, 0x6c, 0x69, 0x74, 0x49, 0x44, 0x12, 0x4d, 0x0a, 0x16, 0x70, 0x61, 0x72, 0x65, 0x6e, - 0x74, 0x5f, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x5f, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x69, - 0x64, 0x18, 0x07, 0x20, 0x01, 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, 0x13, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x53, 0x70, 0x6c, 0x69, 0x74, 0x50, 0x61, - 0x72, 0x65, 0x6e, 0x74, 0x49, 0x44, 0x12, 0x4f, 0x0a, 0x11, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, - 0x5f, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x08, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x22, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, - 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x2e, 0x41, 0x74, 0x74, 0x72, - 0x69, 0x62, 0x75, 0x74, 0x65, 0x52, 0x10, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x41, 0x74, 0x74, - 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x22, 0xc4, 0x01, 0x0a, 0x06, 0x4f, 0x62, 0x6a, 0x65, - 0x63, 0x74, 0x12, 0x35, 0x0a, 0x09, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x69, 0x64, 0x18, - 0x01, 0x20, 0x01, 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, - 0x08, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x44, 0x12, 0x37, 0x0a, 0x09, 0x73, 0x69, 0x67, - 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, - 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, - 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, - 0x72, 0x65, 0x12, 0x30, 0x0a, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, - 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x06, 0x68, 0x65, - 0x61, 0x64, 0x65, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x18, - 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x22, 0x8b, - 0x01, 0x0a, 0x09, 0x53, 0x70, 0x6c, 0x69, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x19, 0x0a, 0x08, - 0x73, 0x70, 0x6c, 0x69, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, - 0x73, 0x70, 0x6c, 0x69, 0x74, 0x49, 0x64, 0x12, 0x35, 0x0a, 0x09, 0x6c, 0x61, 0x73, 0x74, 0x5f, - 0x70, 0x61, 0x72, 0x74, 0x18, 0x02, 0x20, 0x01, 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, 0x08, 0x6c, 0x61, 0x73, 0x74, 0x50, 0x61, 0x72, 0x74, 0x12, 0x2c, - 0x0a, 0x04, 0x6c, 0x69, 0x6e, 0x6b, 0x18, 0x03, 0x20, 0x01, 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, 0x04, 0x6c, 0x69, 0x6e, 0x6b, 0x22, 0x9f, 0x01, 0x0a, - 0x06, 0x45, 0x43, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x36, 0x0a, 0x06, 0x63, 0x68, 0x75, 0x6e, 0x6b, - 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, - 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x45, 0x43, 0x49, 0x6e, 0x66, - 0x6f, 0x2e, 0x43, 0x68, 0x75, 0x6e, 0x6b, 0x52, 0x06, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x73, 0x1a, - 0x5d, 0x0a, 0x05, 0x43, 0x68, 0x75, 0x6e, 0x6b, 0x12, 0x28, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, - 0x20, 0x01, 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, 0x02, - 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0d, 0x52, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x74, 0x61, - 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x2a, 0x32, - 0x0a, 0x0a, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0b, 0x0a, 0x07, - 0x52, 0x45, 0x47, 0x55, 0x4c, 0x41, 0x52, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x54, 0x4f, 0x4d, - 0x42, 0x53, 0x54, 0x4f, 0x4e, 0x45, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x4c, 0x4f, 0x43, 0x4b, - 0x10, 0x03, 0x2a, 0x73, 0x0a, 0x09, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x54, 0x79, 0x70, 0x65, 0x12, - 0x1a, 0x0a, 0x16, 0x4d, 0x41, 0x54, 0x43, 0x48, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, - 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x10, 0x0a, 0x0c, 0x53, - 0x54, 0x52, 0x49, 0x4e, 0x47, 0x5f, 0x45, 0x51, 0x55, 0x41, 0x4c, 0x10, 0x01, 0x12, 0x14, 0x0a, - 0x10, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x45, 0x51, 0x55, 0x41, - 0x4c, 0x10, 0x02, 0x12, 0x0f, 0x0a, 0x0b, 0x4e, 0x4f, 0x54, 0x5f, 0x50, 0x52, 0x45, 0x53, 0x45, - 0x4e, 0x54, 0x10, 0x03, 0x12, 0x11, 0x0a, 0x0d, 0x43, 0x4f, 0x4d, 0x4d, 0x4f, 0x4e, 0x5f, 0x50, - 0x52, 0x45, 0x46, 0x49, 0x58, 0x10, 0x04, 0x42, 0x61, 0x5a, 0x42, 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, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x6f, 0x62, 0x6a, 0x65, 0x63, - 0x74, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0xaa, 0x02, 0x1a, - 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, - 0x41, 0x50, 0x49, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x33, -} - -var ( - file_object_grpc_types_proto_rawDescOnce sync.Once - file_object_grpc_types_proto_rawDescData = file_object_grpc_types_proto_rawDesc -) - -func file_object_grpc_types_proto_rawDescGZIP() []byte { - file_object_grpc_types_proto_rawDescOnce.Do(func() { - file_object_grpc_types_proto_rawDescData = protoimpl.X.CompressGZIP(file_object_grpc_types_proto_rawDescData) - }) - return file_object_grpc_types_proto_rawDescData -} - -var file_object_grpc_types_proto_enumTypes = make([]protoimpl.EnumInfo, 2) -var file_object_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 9) -var file_object_grpc_types_proto_goTypes = []interface{}{ - (ObjectType)(0), // 0: neo.fs.v2.object.ObjectType - (MatchType)(0), // 1: neo.fs.v2.object.MatchType - (*ShortHeader)(nil), // 2: neo.fs.v2.object.ShortHeader - (*Header)(nil), // 3: neo.fs.v2.object.Header - (*Object)(nil), // 4: neo.fs.v2.object.Object - (*SplitInfo)(nil), // 5: neo.fs.v2.object.SplitInfo - (*ECInfo)(nil), // 6: neo.fs.v2.object.ECInfo - (*Header_Attribute)(nil), // 7: neo.fs.v2.object.Header.Attribute - (*Header_Split)(nil), // 8: neo.fs.v2.object.Header.Split - (*Header_EC)(nil), // 9: neo.fs.v2.object.Header.EC - (*ECInfo_Chunk)(nil), // 10: neo.fs.v2.object.ECInfo.Chunk - (*grpc.Version)(nil), // 11: neo.fs.v2.refs.Version - (*grpc.OwnerID)(nil), // 12: neo.fs.v2.refs.OwnerID - (*grpc.Checksum)(nil), // 13: neo.fs.v2.refs.Checksum - (*grpc.ContainerID)(nil), // 14: neo.fs.v2.refs.ContainerID - (*grpc1.SessionToken)(nil), // 15: neo.fs.v2.session.SessionToken - (*grpc.ObjectID)(nil), // 16: neo.fs.v2.refs.ObjectID - (*grpc.Signature)(nil), // 17: neo.fs.v2.refs.Signature -} -var file_object_grpc_types_proto_depIdxs = []int32{ - 11, // 0: neo.fs.v2.object.ShortHeader.version:type_name -> neo.fs.v2.refs.Version - 12, // 1: neo.fs.v2.object.ShortHeader.owner_id:type_name -> neo.fs.v2.refs.OwnerID - 0, // 2: neo.fs.v2.object.ShortHeader.object_type:type_name -> neo.fs.v2.object.ObjectType - 13, // 3: neo.fs.v2.object.ShortHeader.payload_hash:type_name -> neo.fs.v2.refs.Checksum - 13, // 4: neo.fs.v2.object.ShortHeader.homomorphic_hash:type_name -> neo.fs.v2.refs.Checksum - 11, // 5: neo.fs.v2.object.Header.version:type_name -> neo.fs.v2.refs.Version - 14, // 6: neo.fs.v2.object.Header.container_id:type_name -> neo.fs.v2.refs.ContainerID - 12, // 7: neo.fs.v2.object.Header.owner_id:type_name -> neo.fs.v2.refs.OwnerID - 13, // 8: neo.fs.v2.object.Header.payload_hash:type_name -> neo.fs.v2.refs.Checksum - 0, // 9: neo.fs.v2.object.Header.object_type:type_name -> neo.fs.v2.object.ObjectType - 13, // 10: neo.fs.v2.object.Header.homomorphic_hash:type_name -> neo.fs.v2.refs.Checksum - 15, // 11: neo.fs.v2.object.Header.session_token:type_name -> neo.fs.v2.session.SessionToken - 7, // 12: neo.fs.v2.object.Header.attributes:type_name -> neo.fs.v2.object.Header.Attribute - 8, // 13: neo.fs.v2.object.Header.split:type_name -> neo.fs.v2.object.Header.Split - 9, // 14: neo.fs.v2.object.Header.ec:type_name -> neo.fs.v2.object.Header.EC - 16, // 15: neo.fs.v2.object.Object.object_id:type_name -> neo.fs.v2.refs.ObjectID - 17, // 16: neo.fs.v2.object.Object.signature:type_name -> neo.fs.v2.refs.Signature - 3, // 17: neo.fs.v2.object.Object.header:type_name -> neo.fs.v2.object.Header - 16, // 18: neo.fs.v2.object.SplitInfo.last_part:type_name -> neo.fs.v2.refs.ObjectID - 16, // 19: neo.fs.v2.object.SplitInfo.link:type_name -> neo.fs.v2.refs.ObjectID - 10, // 20: neo.fs.v2.object.ECInfo.chunks:type_name -> neo.fs.v2.object.ECInfo.Chunk - 16, // 21: neo.fs.v2.object.Header.Split.parent:type_name -> neo.fs.v2.refs.ObjectID - 16, // 22: neo.fs.v2.object.Header.Split.previous:type_name -> neo.fs.v2.refs.ObjectID - 17, // 23: neo.fs.v2.object.Header.Split.parent_signature:type_name -> neo.fs.v2.refs.Signature - 3, // 24: neo.fs.v2.object.Header.Split.parent_header:type_name -> neo.fs.v2.object.Header - 16, // 25: neo.fs.v2.object.Header.Split.children:type_name -> neo.fs.v2.refs.ObjectID - 16, // 26: neo.fs.v2.object.Header.EC.parent:type_name -> neo.fs.v2.refs.ObjectID - 16, // 27: neo.fs.v2.object.Header.EC.parent_split_parent_id:type_name -> neo.fs.v2.refs.ObjectID - 7, // 28: neo.fs.v2.object.Header.EC.parent_attributes:type_name -> neo.fs.v2.object.Header.Attribute - 16, // 29: neo.fs.v2.object.ECInfo.Chunk.id:type_name -> neo.fs.v2.refs.ObjectID - 30, // [30:30] is the sub-list for method output_type - 30, // [30:30] is the sub-list for method input_type - 30, // [30:30] is the sub-list for extension type_name - 30, // [30:30] is the sub-list for extension extendee - 0, // [0:30] is the sub-list for field type_name -} - -func init() { file_object_grpc_types_proto_init() } -func file_object_grpc_types_proto_init() { - if File_object_grpc_types_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_object_grpc_types_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ShortHeader); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_object_grpc_types_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Header); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_object_grpc_types_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Object); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_object_grpc_types_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SplitInfo); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_object_grpc_types_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ECInfo); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_object_grpc_types_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Header_Attribute); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_object_grpc_types_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Header_Split); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_object_grpc_types_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Header_EC); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_object_grpc_types_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ECInfo_Chunk); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_object_grpc_types_proto_rawDesc, - NumEnums: 2, - NumMessages: 9, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_object_grpc_types_proto_goTypes, - DependencyIndexes: file_object_grpc_types_proto_depIdxs, - EnumInfos: file_object_grpc_types_proto_enumTypes, - MessageInfos: file_object_grpc_types_proto_msgTypes, - }.Build() - File_object_grpc_types_proto = out.File - file_object_grpc_types_proto_rawDesc = nil - file_object_grpc_types_proto_goTypes = nil - file_object_grpc_types_proto_depIdxs = nil -} diff --git a/object/grpc/types_frostfs.pb.go b/object/grpc/types_frostfs.pb.go new file mode 100644 index 0000000..492ee48 --- /dev/null +++ b/object/grpc/types_frostfs.pb.go @@ -0,0 +1,2621 @@ +// Code generated by protoc-gen-go-frostfs. DO NOT EDIT. + +package object + +import ( + json "encoding/json" + fmt "fmt" + grpc "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc" + grpc1 "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session/grpc" + pool "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/pool" + proto "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/proto" + encoding "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/proto/encoding" + easyproto "github.com/VictoriaMetrics/easyproto" + jlexer "github.com/mailru/easyjson/jlexer" + jwriter "github.com/mailru/easyjson/jwriter" + strconv "strconv" +) + +type ObjectType int32 + +const ( + ObjectType_REGULAR ObjectType = 0 + ObjectType_TOMBSTONE ObjectType = 1 + ObjectType_LOCK ObjectType = 3 +) + +var ( + ObjectType_name = map[int32]string{ + 0: "REGULAR", + 1: "TOMBSTONE", + 3: "LOCK", + } + ObjectType_value = map[string]int32{ + "REGULAR": 0, + "TOMBSTONE": 1, + "LOCK": 3, + } +) + +func (x ObjectType) String() string { + if v, ok := ObjectType_name[int32(x)]; ok { + return v + } + return strconv.FormatInt(int64(x), 10) +} +func (x *ObjectType) FromString(s string) bool { + if v, ok := ObjectType_value[s]; ok { + *x = ObjectType(v) + return true + } + return false +} + +type MatchType int32 + +const ( + MatchType_MATCH_TYPE_UNSPECIFIED MatchType = 0 + MatchType_STRING_EQUAL MatchType = 1 + MatchType_STRING_NOT_EQUAL MatchType = 2 + MatchType_NOT_PRESENT MatchType = 3 + MatchType_COMMON_PREFIX MatchType = 4 +) + +var ( + MatchType_name = map[int32]string{ + 0: "MATCH_TYPE_UNSPECIFIED", + 1: "STRING_EQUAL", + 2: "STRING_NOT_EQUAL", + 3: "NOT_PRESENT", + 4: "COMMON_PREFIX", + } + MatchType_value = map[string]int32{ + "MATCH_TYPE_UNSPECIFIED": 0, + "STRING_EQUAL": 1, + "STRING_NOT_EQUAL": 2, + "NOT_PRESENT": 3, + "COMMON_PREFIX": 4, + } +) + +func (x MatchType) String() string { + if v, ok := MatchType_name[int32(x)]; ok { + return v + } + return strconv.FormatInt(int64(x), 10) +} +func (x *MatchType) FromString(s string) bool { + if v, ok := MatchType_value[s]; ok { + *x = MatchType(v) + return true + } + return false +} + +type ShortHeader struct { + Version *grpc.Version `json:"version"` + CreationEpoch uint64 `json:"creationEpoch"` + OwnerId *grpc.OwnerID `json:"ownerID"` + ObjectType ObjectType `json:"objectType"` + PayloadLength uint64 `json:"payloadLength"` + PayloadHash *grpc.Checksum `json:"payloadHash"` + HomomorphicHash *grpc.Checksum `json:"homomorphicHash"` +} + +var ( + _ encoding.ProtoMarshaler = (*ShortHeader)(nil) + _ encoding.ProtoUnmarshaler = (*ShortHeader)(nil) + _ json.Marshaler = (*ShortHeader)(nil) + _ json.Unmarshaler = (*ShortHeader)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *ShortHeader) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.NestedStructureSize(1, x.Version) + size += proto.UInt64Size(2, x.CreationEpoch) + size += proto.NestedStructureSize(3, x.OwnerId) + size += proto.EnumSize(4, int32(x.ObjectType)) + size += proto.UInt64Size(5, x.PayloadLength) + size += proto.NestedStructureSize(6, x.PayloadHash) + size += proto.NestedStructureSize(7, x.HomomorphicHash) + return size +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *ShortHeader) 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 *ShortHeader) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if x.Version != nil && x.Version.StableSize() != 0 { + x.Version.EmitProtobuf(mm.AppendMessage(1)) + } + if x.CreationEpoch != 0 { + mm.AppendUint64(2, x.CreationEpoch) + } + if x.OwnerId != nil && x.OwnerId.StableSize() != 0 { + x.OwnerId.EmitProtobuf(mm.AppendMessage(3)) + } + if int32(x.ObjectType) != 0 { + mm.AppendInt32(4, int32(x.ObjectType)) + } + if x.PayloadLength != 0 { + mm.AppendUint64(5, x.PayloadLength) + } + if x.PayloadHash != nil && x.PayloadHash.StableSize() != 0 { + x.PayloadHash.EmitProtobuf(mm.AppendMessage(6)) + } + if x.HomomorphicHash != nil && x.HomomorphicHash.StableSize() != 0 { + x.HomomorphicHash.EmitProtobuf(mm.AppendMessage(7)) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *ShortHeader) 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", "ShortHeader") + } + 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: // CreationEpoch + data, ok := fc.Uint64() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "CreationEpoch") + } + x.CreationEpoch = data + case 3: // 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 4: // ObjectType + data, ok := fc.Int32() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "ObjectType") + } + x.ObjectType = ObjectType(data) + case 5: // PayloadLength + data, ok := fc.Uint64() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "PayloadLength") + } + x.PayloadLength = data + case 6: // PayloadHash + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "PayloadHash") + } + x.PayloadHash = new(grpc.Checksum) + if err := x.PayloadHash.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + case 7: // HomomorphicHash + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "HomomorphicHash") + } + x.HomomorphicHash = new(grpc.Checksum) + if err := x.HomomorphicHash.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + } + } + return nil +} +func (x *ShortHeader) GetVersion() *grpc.Version { + if x != nil { + return x.Version + } + return nil +} +func (x *ShortHeader) SetVersion(v *grpc.Version) { + x.Version = v +} +func (x *ShortHeader) GetCreationEpoch() uint64 { + if x != nil { + return x.CreationEpoch + } + return 0 +} +func (x *ShortHeader) SetCreationEpoch(v uint64) { + x.CreationEpoch = v +} +func (x *ShortHeader) GetOwnerId() *grpc.OwnerID { + if x != nil { + return x.OwnerId + } + return nil +} +func (x *ShortHeader) SetOwnerId(v *grpc.OwnerID) { + x.OwnerId = v +} +func (x *ShortHeader) GetObjectType() ObjectType { + if x != nil { + return x.ObjectType + } + return 0 +} +func (x *ShortHeader) SetObjectType(v ObjectType) { + x.ObjectType = v +} +func (x *ShortHeader) GetPayloadLength() uint64 { + if x != nil { + return x.PayloadLength + } + return 0 +} +func (x *ShortHeader) SetPayloadLength(v uint64) { + x.PayloadLength = v +} +func (x *ShortHeader) GetPayloadHash() *grpc.Checksum { + if x != nil { + return x.PayloadHash + } + return nil +} +func (x *ShortHeader) SetPayloadHash(v *grpc.Checksum) { + x.PayloadHash = v +} +func (x *ShortHeader) GetHomomorphicHash() *grpc.Checksum { + if x != nil { + return x.HomomorphicHash + } + return nil +} +func (x *ShortHeader) SetHomomorphicHash(v *grpc.Checksum) { + x.HomomorphicHash = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *ShortHeader) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *ShortHeader) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"version\":" + out.RawString(prefix[1:]) + x.Version.MarshalEasyJSON(out) + } + { + const prefix string = ",\"creationEpoch\":" + out.RawString(prefix) + out.Uint64(x.CreationEpoch) + } + { + const prefix string = ",\"ownerID\":" + out.RawString(prefix) + x.OwnerId.MarshalEasyJSON(out) + } + { + const prefix string = ",\"objectType\":" + out.RawString(prefix) + out.Int32(int32(x.ObjectType)) + } + { + const prefix string = ",\"payloadLength\":" + out.RawString(prefix) + out.Uint64(x.PayloadLength) + } + { + const prefix string = ",\"payloadHash\":" + out.RawString(prefix) + x.PayloadHash.MarshalEasyJSON(out) + } + { + const prefix string = ",\"homomorphicHash\":" + out.RawString(prefix) + x.HomomorphicHash.MarshalEasyJSON(out) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *ShortHeader) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *ShortHeader) 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 "creationEpoch": + { + var f uint64 + f = in.Uint64() + x.CreationEpoch = f + } + case "ownerID": + { + var f *grpc.OwnerID + f = new(grpc.OwnerID) + f.UnmarshalEasyJSON(in) + x.OwnerId = f + } + case "objectType": + { + var f ObjectType + var parsedValue ObjectType + switch v := in.Interface().(type) { + case string: + if vv, ok := ObjectType_value[v]; ok { + parsedValue = ObjectType(vv) + break + } + vv, err := strconv.ParseInt(v, 10, 32) + if err != nil { + in.AddError(err) + return + } + parsedValue = ObjectType(vv) + case float64: + parsedValue = ObjectType(v) + } + f = parsedValue + x.ObjectType = f + } + case "payloadLength": + { + var f uint64 + f = in.Uint64() + x.PayloadLength = f + } + case "payloadHash": + { + var f *grpc.Checksum + f = new(grpc.Checksum) + f.UnmarshalEasyJSON(in) + x.PayloadHash = f + } + case "homomorphicHash": + { + var f *grpc.Checksum + f = new(grpc.Checksum) + f.UnmarshalEasyJSON(in) + x.HomomorphicHash = f + } + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} + +type Header_Attribute struct { + Key string `json:"key"` + Value string `json:"value"` +} + +var ( + _ encoding.ProtoMarshaler = (*Header_Attribute)(nil) + _ encoding.ProtoUnmarshaler = (*Header_Attribute)(nil) + _ json.Marshaler = (*Header_Attribute)(nil) + _ json.Unmarshaler = (*Header_Attribute)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *Header_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 *Header_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 *Header_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 *Header_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", "Header_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 *Header_Attribute) GetKey() string { + if x != nil { + return x.Key + } + return "" +} +func (x *Header_Attribute) SetKey(v string) { + x.Key = v +} +func (x *Header_Attribute) GetValue() string { + if x != nil { + return x.Value + } + return "" +} +func (x *Header_Attribute) SetValue(v string) { + x.Value = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *Header_Attribute) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *Header_Attribute) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"key\":" + out.RawString(prefix[1:]) + out.String(x.Key) + } + { + const prefix string = ",\"value\":" + out.RawString(prefix) + out.String(x.Value) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *Header_Attribute) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *Header_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 Header_Split struct { + Parent *grpc.ObjectID `json:"parent"` + Previous *grpc.ObjectID `json:"previous"` + ParentSignature *grpc.Signature `json:"parentSignature"` + ParentHeader *Header `json:"parentHeader"` + Children []*grpc.ObjectID `json:"children"` + SplitId []byte `json:"splitID"` +} + +var ( + _ encoding.ProtoMarshaler = (*Header_Split)(nil) + _ encoding.ProtoUnmarshaler = (*Header_Split)(nil) + _ json.Marshaler = (*Header_Split)(nil) + _ json.Unmarshaler = (*Header_Split)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *Header_Split) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.NestedStructureSize(1, x.Parent) + size += proto.NestedStructureSize(2, x.Previous) + size += proto.NestedStructureSize(3, x.ParentSignature) + size += proto.NestedStructureSize(4, x.ParentHeader) + for i := range x.Children { + size += proto.NestedStructureSize(5, x.Children[i]) + } + size += proto.BytesSize(6, x.SplitId) + return size +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *Header_Split) 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 *Header_Split) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if x.Parent != nil && x.Parent.StableSize() != 0 { + x.Parent.EmitProtobuf(mm.AppendMessage(1)) + } + if x.Previous != nil && x.Previous.StableSize() != 0 { + x.Previous.EmitProtobuf(mm.AppendMessage(2)) + } + if x.ParentSignature != nil && x.ParentSignature.StableSize() != 0 { + x.ParentSignature.EmitProtobuf(mm.AppendMessage(3)) + } + if x.ParentHeader != nil && x.ParentHeader.StableSize() != 0 { + x.ParentHeader.EmitProtobuf(mm.AppendMessage(4)) + } + for i := range x.Children { + if x.Children[i] != nil && x.Children[i].StableSize() != 0 { + x.Children[i].EmitProtobuf(mm.AppendMessage(5)) + } + } + if len(x.SplitId) != 0 { + mm.AppendBytes(6, x.SplitId) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *Header_Split) 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", "Header_Split") + } + switch fc.FieldNum { + case 1: // Parent + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Parent") + } + x.Parent = new(grpc.ObjectID) + if err := x.Parent.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + case 2: // Previous + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Previous") + } + x.Previous = new(grpc.ObjectID) + if err := x.Previous.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + case 3: // ParentSignature + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "ParentSignature") + } + x.ParentSignature = new(grpc.Signature) + if err := x.ParentSignature.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + case 4: // ParentHeader + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "ParentHeader") + } + x.ParentHeader = new(Header) + if err := x.ParentHeader.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + case 5: // Children + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Children") + } + x.Children = append(x.Children, new(grpc.ObjectID)) + ff := x.Children[len(x.Children)-1] + if err := ff.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + case 6: // SplitId + data, ok := fc.Bytes() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "SplitId") + } + x.SplitId = data + } + } + return nil +} +func (x *Header_Split) GetParent() *grpc.ObjectID { + if x != nil { + return x.Parent + } + return nil +} +func (x *Header_Split) SetParent(v *grpc.ObjectID) { + x.Parent = v +} +func (x *Header_Split) GetPrevious() *grpc.ObjectID { + if x != nil { + return x.Previous + } + return nil +} +func (x *Header_Split) SetPrevious(v *grpc.ObjectID) { + x.Previous = v +} +func (x *Header_Split) GetParentSignature() *grpc.Signature { + if x != nil { + return x.ParentSignature + } + return nil +} +func (x *Header_Split) SetParentSignature(v *grpc.Signature) { + x.ParentSignature = v +} +func (x *Header_Split) GetParentHeader() *Header { + if x != nil { + return x.ParentHeader + } + return nil +} +func (x *Header_Split) SetParentHeader(v *Header) { + x.ParentHeader = v +} +func (x *Header_Split) GetChildren() []*grpc.ObjectID { + if x != nil { + return x.Children + } + return nil +} +func (x *Header_Split) SetChildren(v []*grpc.ObjectID) { + x.Children = v +} +func (x *Header_Split) GetSplitId() []byte { + if x != nil { + return x.SplitId + } + return nil +} +func (x *Header_Split) SetSplitId(v []byte) { + x.SplitId = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *Header_Split) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *Header_Split) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"parent\":" + out.RawString(prefix[1:]) + x.Parent.MarshalEasyJSON(out) + } + { + const prefix string = ",\"previous\":" + out.RawString(prefix) + x.Previous.MarshalEasyJSON(out) + } + { + const prefix string = ",\"parentSignature\":" + out.RawString(prefix) + x.ParentSignature.MarshalEasyJSON(out) + } + { + const prefix string = ",\"parentHeader\":" + out.RawString(prefix) + x.ParentHeader.MarshalEasyJSON(out) + } + { + const prefix string = ",\"children\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.Children { + if i != 0 { + out.RawByte(',') + } + x.Children[i].MarshalEasyJSON(out) + } + out.RawByte(']') + } + { + const prefix string = ",\"splitID\":" + out.RawString(prefix) + out.Base64Bytes(x.SplitId) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *Header_Split) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *Header_Split) 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 "parent": + { + var f *grpc.ObjectID + f = new(grpc.ObjectID) + f.UnmarshalEasyJSON(in) + x.Parent = f + } + case "previous": + { + var f *grpc.ObjectID + f = new(grpc.ObjectID) + f.UnmarshalEasyJSON(in) + x.Previous = f + } + case "parentSignature": + { + var f *grpc.Signature + f = new(grpc.Signature) + f.UnmarshalEasyJSON(in) + x.ParentSignature = f + } + case "parentHeader": + { + var f *Header + f = new(Header) + f.UnmarshalEasyJSON(in) + x.ParentHeader = f + } + case "children": + { + var f *grpc.ObjectID + var list []*grpc.ObjectID + in.Delim('[') + for !in.IsDelim(']') { + f = new(grpc.ObjectID) + f.UnmarshalEasyJSON(in) + list = append(list, f) + in.WantComma() + } + x.Children = list + in.Delim(']') + } + case "splitID": + { + var f []byte + f = in.Bytes() + x.SplitId = f + } + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} + +type Header_EC struct { + Parent *grpc.ObjectID `json:"parent"` + Index uint32 `json:"index"` + Total uint32 `json:"total"` + HeaderLength uint32 `json:"headerLength"` + Header []byte `json:"header"` + ParentSplitId []byte `json:"parentSplitID"` + ParentSplitParentId *grpc.ObjectID `json:"parentSplitParentID"` + ParentAttributes []*Header_Attribute `json:"parentAttributes"` +} + +var ( + _ encoding.ProtoMarshaler = (*Header_EC)(nil) + _ encoding.ProtoUnmarshaler = (*Header_EC)(nil) + _ json.Marshaler = (*Header_EC)(nil) + _ json.Unmarshaler = (*Header_EC)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *Header_EC) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.NestedStructureSize(1, x.Parent) + size += proto.UInt32Size(2, x.Index) + size += proto.UInt32Size(3, x.Total) + size += proto.UInt32Size(4, x.HeaderLength) + size += proto.BytesSize(5, x.Header) + size += proto.BytesSize(6, x.ParentSplitId) + size += proto.NestedStructureSize(7, x.ParentSplitParentId) + for i := range x.ParentAttributes { + size += proto.NestedStructureSize(8, x.ParentAttributes[i]) + } + return size +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *Header_EC) 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 *Header_EC) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if x.Parent != nil && x.Parent.StableSize() != 0 { + x.Parent.EmitProtobuf(mm.AppendMessage(1)) + } + if x.Index != 0 { + mm.AppendUint32(2, x.Index) + } + if x.Total != 0 { + mm.AppendUint32(3, x.Total) + } + if x.HeaderLength != 0 { + mm.AppendUint32(4, x.HeaderLength) + } + if len(x.Header) != 0 { + mm.AppendBytes(5, x.Header) + } + if len(x.ParentSplitId) != 0 { + mm.AppendBytes(6, x.ParentSplitId) + } + if x.ParentSplitParentId != nil && x.ParentSplitParentId.StableSize() != 0 { + x.ParentSplitParentId.EmitProtobuf(mm.AppendMessage(7)) + } + for i := range x.ParentAttributes { + if x.ParentAttributes[i] != nil && x.ParentAttributes[i].StableSize() != 0 { + x.ParentAttributes[i].EmitProtobuf(mm.AppendMessage(8)) + } + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *Header_EC) 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", "Header_EC") + } + switch fc.FieldNum { + case 1: // Parent + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Parent") + } + x.Parent = new(grpc.ObjectID) + if err := x.Parent.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + case 2: // Index + data, ok := fc.Uint32() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Index") + } + x.Index = data + case 3: // Total + data, ok := fc.Uint32() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Total") + } + x.Total = data + case 4: // HeaderLength + data, ok := fc.Uint32() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "HeaderLength") + } + x.HeaderLength = data + case 5: // Header + data, ok := fc.Bytes() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Header") + } + x.Header = data + case 6: // ParentSplitId + data, ok := fc.Bytes() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "ParentSplitId") + } + x.ParentSplitId = data + case 7: // ParentSplitParentId + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "ParentSplitParentId") + } + x.ParentSplitParentId = new(grpc.ObjectID) + if err := x.ParentSplitParentId.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + case 8: // ParentAttributes + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "ParentAttributes") + } + x.ParentAttributes = append(x.ParentAttributes, new(Header_Attribute)) + ff := x.ParentAttributes[len(x.ParentAttributes)-1] + if err := ff.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + } + } + return nil +} +func (x *Header_EC) GetParent() *grpc.ObjectID { + if x != nil { + return x.Parent + } + return nil +} +func (x *Header_EC) SetParent(v *grpc.ObjectID) { + x.Parent = v +} +func (x *Header_EC) GetIndex() uint32 { + if x != nil { + return x.Index + } + return 0 +} +func (x *Header_EC) SetIndex(v uint32) { + x.Index = v +} +func (x *Header_EC) GetTotal() uint32 { + if x != nil { + return x.Total + } + return 0 +} +func (x *Header_EC) SetTotal(v uint32) { + x.Total = v +} +func (x *Header_EC) GetHeaderLength() uint32 { + if x != nil { + return x.HeaderLength + } + return 0 +} +func (x *Header_EC) SetHeaderLength(v uint32) { + x.HeaderLength = v +} +func (x *Header_EC) GetHeader() []byte { + if x != nil { + return x.Header + } + return nil +} +func (x *Header_EC) SetHeader(v []byte) { + x.Header = v +} +func (x *Header_EC) GetParentSplitId() []byte { + if x != nil { + return x.ParentSplitId + } + return nil +} +func (x *Header_EC) SetParentSplitId(v []byte) { + x.ParentSplitId = v +} +func (x *Header_EC) GetParentSplitParentId() *grpc.ObjectID { + if x != nil { + return x.ParentSplitParentId + } + return nil +} +func (x *Header_EC) SetParentSplitParentId(v *grpc.ObjectID) { + x.ParentSplitParentId = v +} +func (x *Header_EC) GetParentAttributes() []*Header_Attribute { + if x != nil { + return x.ParentAttributes + } + return nil +} +func (x *Header_EC) SetParentAttributes(v []*Header_Attribute) { + x.ParentAttributes = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *Header_EC) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *Header_EC) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"parent\":" + out.RawString(prefix[1:]) + x.Parent.MarshalEasyJSON(out) + } + { + const prefix string = ",\"index\":" + out.RawString(prefix) + out.Uint32(x.Index) + } + { + const prefix string = ",\"total\":" + out.RawString(prefix) + out.Uint32(x.Total) + } + { + const prefix string = ",\"headerLength\":" + out.RawString(prefix) + out.Uint32(x.HeaderLength) + } + { + const prefix string = ",\"header\":" + out.RawString(prefix) + out.Base64Bytes(x.Header) + } + { + const prefix string = ",\"parentSplitID\":" + out.RawString(prefix) + out.Base64Bytes(x.ParentSplitId) + } + { + const prefix string = ",\"parentSplitParentID\":" + out.RawString(prefix) + x.ParentSplitParentId.MarshalEasyJSON(out) + } + { + const prefix string = ",\"parentAttributes\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.ParentAttributes { + if i != 0 { + out.RawByte(',') + } + x.ParentAttributes[i].MarshalEasyJSON(out) + } + out.RawByte(']') + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *Header_EC) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *Header_EC) 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 "parent": + { + var f *grpc.ObjectID + f = new(grpc.ObjectID) + f.UnmarshalEasyJSON(in) + x.Parent = f + } + case "index": + { + var f uint32 + f = in.Uint32() + x.Index = f + } + case "total": + { + var f uint32 + f = in.Uint32() + x.Total = f + } + case "headerLength": + { + var f uint32 + f = in.Uint32() + x.HeaderLength = f + } + case "header": + { + var f []byte + f = in.Bytes() + x.Header = f + } + case "parentSplitID": + { + var f []byte + f = in.Bytes() + x.ParentSplitId = f + } + case "parentSplitParentID": + { + var f *grpc.ObjectID + f = new(grpc.ObjectID) + f.UnmarshalEasyJSON(in) + x.ParentSplitParentId = f + } + case "parentAttributes": + { + var f *Header_Attribute + var list []*Header_Attribute + in.Delim('[') + for !in.IsDelim(']') { + f = new(Header_Attribute) + f.UnmarshalEasyJSON(in) + list = append(list, f) + in.WantComma() + } + x.ParentAttributes = list + in.Delim(']') + } + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} + +type Header struct { + Version *grpc.Version `json:"version"` + ContainerId *grpc.ContainerID `json:"containerID"` + OwnerId *grpc.OwnerID `json:"ownerID"` + CreationEpoch uint64 `json:"creationEpoch"` + PayloadLength uint64 `json:"payloadLength"` + PayloadHash *grpc.Checksum `json:"payloadHash"` + ObjectType ObjectType `json:"objectType"` + HomomorphicHash *grpc.Checksum `json:"homomorphicHash"` + SessionToken *grpc1.SessionToken `json:"sessionToken"` + Attributes []*Header_Attribute `json:"attributes"` + Split *Header_Split `json:"split"` + Ec *Header_EC `json:"ec"` +} + +var ( + _ encoding.ProtoMarshaler = (*Header)(nil) + _ encoding.ProtoUnmarshaler = (*Header)(nil) + _ json.Marshaler = (*Header)(nil) + _ json.Unmarshaler = (*Header)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *Header) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.NestedStructureSize(1, x.Version) + size += proto.NestedStructureSize(2, x.ContainerId) + size += proto.NestedStructureSize(3, x.OwnerId) + size += proto.UInt64Size(4, x.CreationEpoch) + size += proto.UInt64Size(5, x.PayloadLength) + size += proto.NestedStructureSize(6, x.PayloadHash) + size += proto.EnumSize(7, int32(x.ObjectType)) + size += proto.NestedStructureSize(8, x.HomomorphicHash) + size += proto.NestedStructureSize(9, x.SessionToken) + for i := range x.Attributes { + size += proto.NestedStructureSize(10, x.Attributes[i]) + } + size += proto.NestedStructureSize(11, x.Split) + size += proto.NestedStructureSize(12, x.Ec) + return size +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *Header) 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 *Header) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if x.Version != nil && x.Version.StableSize() != 0 { + x.Version.EmitProtobuf(mm.AppendMessage(1)) + } + if x.ContainerId != nil && x.ContainerId.StableSize() != 0 { + x.ContainerId.EmitProtobuf(mm.AppendMessage(2)) + } + if x.OwnerId != nil && x.OwnerId.StableSize() != 0 { + x.OwnerId.EmitProtobuf(mm.AppendMessage(3)) + } + if x.CreationEpoch != 0 { + mm.AppendUint64(4, x.CreationEpoch) + } + if x.PayloadLength != 0 { + mm.AppendUint64(5, x.PayloadLength) + } + if x.PayloadHash != nil && x.PayloadHash.StableSize() != 0 { + x.PayloadHash.EmitProtobuf(mm.AppendMessage(6)) + } + if int32(x.ObjectType) != 0 { + mm.AppendInt32(7, int32(x.ObjectType)) + } + if x.HomomorphicHash != nil && x.HomomorphicHash.StableSize() != 0 { + x.HomomorphicHash.EmitProtobuf(mm.AppendMessage(8)) + } + if x.SessionToken != nil && x.SessionToken.StableSize() != 0 { + x.SessionToken.EmitProtobuf(mm.AppendMessage(9)) + } + for i := range x.Attributes { + if x.Attributes[i] != nil && x.Attributes[i].StableSize() != 0 { + x.Attributes[i].EmitProtobuf(mm.AppendMessage(10)) + } + } + if x.Split != nil && x.Split.StableSize() != 0 { + x.Split.EmitProtobuf(mm.AppendMessage(11)) + } + if x.Ec != nil && x.Ec.StableSize() != 0 { + x.Ec.EmitProtobuf(mm.AppendMessage(12)) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *Header) 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", "Header") + } + 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: // ContainerId + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "ContainerId") + } + x.ContainerId = new(grpc.ContainerID) + if err := x.ContainerId.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + case 3: // 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 4: // CreationEpoch + data, ok := fc.Uint64() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "CreationEpoch") + } + x.CreationEpoch = data + case 5: // PayloadLength + data, ok := fc.Uint64() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "PayloadLength") + } + x.PayloadLength = data + case 6: // PayloadHash + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "PayloadHash") + } + x.PayloadHash = new(grpc.Checksum) + if err := x.PayloadHash.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + case 7: // ObjectType + data, ok := fc.Int32() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "ObjectType") + } + x.ObjectType = ObjectType(data) + case 8: // HomomorphicHash + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "HomomorphicHash") + } + x.HomomorphicHash = new(grpc.Checksum) + if err := x.HomomorphicHash.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + case 9: // SessionToken + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "SessionToken") + } + x.SessionToken = new(grpc1.SessionToken) + if err := x.SessionToken.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + case 10: // Attributes + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Attributes") + } + x.Attributes = append(x.Attributes, new(Header_Attribute)) + ff := x.Attributes[len(x.Attributes)-1] + if err := ff.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + case 11: // Split + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Split") + } + x.Split = new(Header_Split) + if err := x.Split.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + case 12: // Ec + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Ec") + } + x.Ec = new(Header_EC) + if err := x.Ec.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + } + } + return nil +} +func (x *Header) GetVersion() *grpc.Version { + if x != nil { + return x.Version + } + return nil +} +func (x *Header) SetVersion(v *grpc.Version) { + x.Version = v +} +func (x *Header) GetContainerId() *grpc.ContainerID { + if x != nil { + return x.ContainerId + } + return nil +} +func (x *Header) SetContainerId(v *grpc.ContainerID) { + x.ContainerId = v +} +func (x *Header) GetOwnerId() *grpc.OwnerID { + if x != nil { + return x.OwnerId + } + return nil +} +func (x *Header) SetOwnerId(v *grpc.OwnerID) { + x.OwnerId = v +} +func (x *Header) GetCreationEpoch() uint64 { + if x != nil { + return x.CreationEpoch + } + return 0 +} +func (x *Header) SetCreationEpoch(v uint64) { + x.CreationEpoch = v +} +func (x *Header) GetPayloadLength() uint64 { + if x != nil { + return x.PayloadLength + } + return 0 +} +func (x *Header) SetPayloadLength(v uint64) { + x.PayloadLength = v +} +func (x *Header) GetPayloadHash() *grpc.Checksum { + if x != nil { + return x.PayloadHash + } + return nil +} +func (x *Header) SetPayloadHash(v *grpc.Checksum) { + x.PayloadHash = v +} +func (x *Header) GetObjectType() ObjectType { + if x != nil { + return x.ObjectType + } + return 0 +} +func (x *Header) SetObjectType(v ObjectType) { + x.ObjectType = v +} +func (x *Header) GetHomomorphicHash() *grpc.Checksum { + if x != nil { + return x.HomomorphicHash + } + return nil +} +func (x *Header) SetHomomorphicHash(v *grpc.Checksum) { + x.HomomorphicHash = v +} +func (x *Header) GetSessionToken() *grpc1.SessionToken { + if x != nil { + return x.SessionToken + } + return nil +} +func (x *Header) SetSessionToken(v *grpc1.SessionToken) { + x.SessionToken = v +} +func (x *Header) GetAttributes() []*Header_Attribute { + if x != nil { + return x.Attributes + } + return nil +} +func (x *Header) SetAttributes(v []*Header_Attribute) { + x.Attributes = v +} +func (x *Header) GetSplit() *Header_Split { + if x != nil { + return x.Split + } + return nil +} +func (x *Header) SetSplit(v *Header_Split) { + x.Split = v +} +func (x *Header) GetEc() *Header_EC { + if x != nil { + return x.Ec + } + return nil +} +func (x *Header) SetEc(v *Header_EC) { + x.Ec = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *Header) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *Header) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"version\":" + out.RawString(prefix[1:]) + x.Version.MarshalEasyJSON(out) + } + { + const prefix string = ",\"containerID\":" + out.RawString(prefix) + x.ContainerId.MarshalEasyJSON(out) + } + { + const prefix string = ",\"ownerID\":" + out.RawString(prefix) + x.OwnerId.MarshalEasyJSON(out) + } + { + const prefix string = ",\"creationEpoch\":" + out.RawString(prefix) + out.Uint64(x.CreationEpoch) + } + { + const prefix string = ",\"payloadLength\":" + out.RawString(prefix) + out.Uint64(x.PayloadLength) + } + { + const prefix string = ",\"payloadHash\":" + out.RawString(prefix) + x.PayloadHash.MarshalEasyJSON(out) + } + { + const prefix string = ",\"objectType\":" + out.RawString(prefix) + out.Int32(int32(x.ObjectType)) + } + { + const prefix string = ",\"homomorphicHash\":" + out.RawString(prefix) + x.HomomorphicHash.MarshalEasyJSON(out) + } + { + const prefix string = ",\"sessionToken\":" + out.RawString(prefix) + x.SessionToken.MarshalEasyJSON(out) + } + { + 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(']') + } + { + const prefix string = ",\"split\":" + out.RawString(prefix) + x.Split.MarshalEasyJSON(out) + } + { + const prefix string = ",\"ec\":" + out.RawString(prefix) + x.Ec.MarshalEasyJSON(out) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *Header) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *Header) 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 "containerID": + { + var f *grpc.ContainerID + f = new(grpc.ContainerID) + f.UnmarshalEasyJSON(in) + x.ContainerId = f + } + case "ownerID": + { + var f *grpc.OwnerID + f = new(grpc.OwnerID) + f.UnmarshalEasyJSON(in) + x.OwnerId = f + } + case "creationEpoch": + { + var f uint64 + f = in.Uint64() + x.CreationEpoch = f + } + case "payloadLength": + { + var f uint64 + f = in.Uint64() + x.PayloadLength = f + } + case "payloadHash": + { + var f *grpc.Checksum + f = new(grpc.Checksum) + f.UnmarshalEasyJSON(in) + x.PayloadHash = f + } + case "objectType": + { + var f ObjectType + var parsedValue ObjectType + switch v := in.Interface().(type) { + case string: + if vv, ok := ObjectType_value[v]; ok { + parsedValue = ObjectType(vv) + break + } + vv, err := strconv.ParseInt(v, 10, 32) + if err != nil { + in.AddError(err) + return + } + parsedValue = ObjectType(vv) + case float64: + parsedValue = ObjectType(v) + } + f = parsedValue + x.ObjectType = f + } + case "homomorphicHash": + { + var f *grpc.Checksum + f = new(grpc.Checksum) + f.UnmarshalEasyJSON(in) + x.HomomorphicHash = f + } + case "sessionToken": + { + var f *grpc1.SessionToken + f = new(grpc1.SessionToken) + f.UnmarshalEasyJSON(in) + x.SessionToken = f + } + case "attributes": + { + var f *Header_Attribute + var list []*Header_Attribute + in.Delim('[') + for !in.IsDelim(']') { + f = new(Header_Attribute) + f.UnmarshalEasyJSON(in) + list = append(list, f) + in.WantComma() + } + x.Attributes = list + in.Delim(']') + } + case "split": + { + var f *Header_Split + f = new(Header_Split) + f.UnmarshalEasyJSON(in) + x.Split = f + } + case "ec": + { + var f *Header_EC + f = new(Header_EC) + f.UnmarshalEasyJSON(in) + x.Ec = f + } + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} + +type Object struct { + ObjectId *grpc.ObjectID `json:"objectID"` + Signature *grpc.Signature `json:"signature"` + Header *Header `json:"header"` + Payload []byte `json:"payload"` +} + +var ( + _ encoding.ProtoMarshaler = (*Object)(nil) + _ encoding.ProtoUnmarshaler = (*Object)(nil) + _ json.Marshaler = (*Object)(nil) + _ json.Unmarshaler = (*Object)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *Object) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.NestedStructureSize(1, x.ObjectId) + size += proto.NestedStructureSize(2, x.Signature) + size += proto.NestedStructureSize(3, x.Header) + size += proto.BytesSize(4, x.Payload) + return size +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *Object) 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 *Object) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if x.ObjectId != nil && x.ObjectId.StableSize() != 0 { + x.ObjectId.EmitProtobuf(mm.AppendMessage(1)) + } + if x.Signature != nil && x.Signature.StableSize() != 0 { + x.Signature.EmitProtobuf(mm.AppendMessage(2)) + } + if x.Header != nil && x.Header.StableSize() != 0 { + x.Header.EmitProtobuf(mm.AppendMessage(3)) + } + if len(x.Payload) != 0 { + mm.AppendBytes(4, x.Payload) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *Object) 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", "Object") + } + switch fc.FieldNum { + case 1: // ObjectId + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "ObjectId") + } + x.ObjectId = new(grpc.ObjectID) + if err := x.ObjectId.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + case 2: // Signature + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Signature") + } + x.Signature = new(grpc.Signature) + if err := x.Signature.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + case 3: // Header + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Header") + } + x.Header = new(Header) + if err := x.Header.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + case 4: // Payload + data, ok := fc.Bytes() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Payload") + } + x.Payload = data + } + } + return nil +} +func (x *Object) GetObjectId() *grpc.ObjectID { + if x != nil { + return x.ObjectId + } + return nil +} +func (x *Object) SetObjectId(v *grpc.ObjectID) { + x.ObjectId = v +} +func (x *Object) GetSignature() *grpc.Signature { + if x != nil { + return x.Signature + } + return nil +} +func (x *Object) SetSignature(v *grpc.Signature) { + x.Signature = v +} +func (x *Object) GetHeader() *Header { + if x != nil { + return x.Header + } + return nil +} +func (x *Object) SetHeader(v *Header) { + x.Header = v +} +func (x *Object) GetPayload() []byte { + if x != nil { + return x.Payload + } + return nil +} +func (x *Object) SetPayload(v []byte) { + x.Payload = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *Object) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *Object) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"objectID\":" + out.RawString(prefix[1:]) + x.ObjectId.MarshalEasyJSON(out) + } + { + const prefix string = ",\"signature\":" + out.RawString(prefix) + x.Signature.MarshalEasyJSON(out) + } + { + const prefix string = ",\"header\":" + out.RawString(prefix) + x.Header.MarshalEasyJSON(out) + } + { + const prefix string = ",\"payload\":" + out.RawString(prefix) + out.Base64Bytes(x.Payload) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *Object) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *Object) 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 "objectID": + { + var f *grpc.ObjectID + f = new(grpc.ObjectID) + f.UnmarshalEasyJSON(in) + x.ObjectId = f + } + case "signature": + { + var f *grpc.Signature + f = new(grpc.Signature) + f.UnmarshalEasyJSON(in) + x.Signature = f + } + case "header": + { + var f *Header + f = new(Header) + f.UnmarshalEasyJSON(in) + x.Header = f + } + case "payload": + { + var f []byte + f = in.Bytes() + x.Payload = f + } + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} + +type SplitInfo struct { + SplitId []byte `json:"splitId"` + LastPart *grpc.ObjectID `json:"lastPart"` + Link *grpc.ObjectID `json:"link"` +} + +var ( + _ encoding.ProtoMarshaler = (*SplitInfo)(nil) + _ encoding.ProtoUnmarshaler = (*SplitInfo)(nil) + _ json.Marshaler = (*SplitInfo)(nil) + _ json.Unmarshaler = (*SplitInfo)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *SplitInfo) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.BytesSize(1, x.SplitId) + size += proto.NestedStructureSize(2, x.LastPart) + size += proto.NestedStructureSize(3, x.Link) + return size +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *SplitInfo) 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 *SplitInfo) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if len(x.SplitId) != 0 { + mm.AppendBytes(1, x.SplitId) + } + if x.LastPart != nil && x.LastPart.StableSize() != 0 { + x.LastPart.EmitProtobuf(mm.AppendMessage(2)) + } + if x.Link != nil && x.Link.StableSize() != 0 { + x.Link.EmitProtobuf(mm.AppendMessage(3)) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *SplitInfo) 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", "SplitInfo") + } + switch fc.FieldNum { + case 1: // SplitId + data, ok := fc.Bytes() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "SplitId") + } + x.SplitId = data + case 2: // LastPart + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "LastPart") + } + x.LastPart = new(grpc.ObjectID) + if err := x.LastPart.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + case 3: // Link + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Link") + } + x.Link = new(grpc.ObjectID) + if err := x.Link.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + } + } + return nil +} +func (x *SplitInfo) GetSplitId() []byte { + if x != nil { + return x.SplitId + } + return nil +} +func (x *SplitInfo) SetSplitId(v []byte) { + x.SplitId = v +} +func (x *SplitInfo) GetLastPart() *grpc.ObjectID { + if x != nil { + return x.LastPart + } + return nil +} +func (x *SplitInfo) SetLastPart(v *grpc.ObjectID) { + x.LastPart = v +} +func (x *SplitInfo) GetLink() *grpc.ObjectID { + if x != nil { + return x.Link + } + return nil +} +func (x *SplitInfo) SetLink(v *grpc.ObjectID) { + x.Link = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *SplitInfo) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *SplitInfo) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"splitId\":" + out.RawString(prefix[1:]) + out.Base64Bytes(x.SplitId) + } + { + const prefix string = ",\"lastPart\":" + out.RawString(prefix) + x.LastPart.MarshalEasyJSON(out) + } + { + const prefix string = ",\"link\":" + out.RawString(prefix) + x.Link.MarshalEasyJSON(out) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *SplitInfo) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *SplitInfo) 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 "splitId": + { + var f []byte + f = in.Bytes() + x.SplitId = f + } + case "lastPart": + { + var f *grpc.ObjectID + f = new(grpc.ObjectID) + f.UnmarshalEasyJSON(in) + x.LastPart = f + } + case "link": + { + var f *grpc.ObjectID + f = new(grpc.ObjectID) + f.UnmarshalEasyJSON(in) + x.Link = f + } + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} + +type ECInfo_Chunk struct { + Id *grpc.ObjectID `json:"id"` + Index uint32 `json:"index"` + Total uint32 `json:"total"` +} + +var ( + _ encoding.ProtoMarshaler = (*ECInfo_Chunk)(nil) + _ encoding.ProtoUnmarshaler = (*ECInfo_Chunk)(nil) + _ json.Marshaler = (*ECInfo_Chunk)(nil) + _ json.Unmarshaler = (*ECInfo_Chunk)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *ECInfo_Chunk) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.NestedStructureSize(1, x.Id) + size += proto.UInt32Size(2, x.Index) + size += proto.UInt32Size(3, x.Total) + return size +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *ECInfo_Chunk) 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 *ECInfo_Chunk) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if x.Id != nil && x.Id.StableSize() != 0 { + x.Id.EmitProtobuf(mm.AppendMessage(1)) + } + if x.Index != 0 { + mm.AppendUint32(2, x.Index) + } + if x.Total != 0 { + mm.AppendUint32(3, x.Total) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *ECInfo_Chunk) 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", "ECInfo_Chunk") + } + switch fc.FieldNum { + case 1: // Id + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Id") + } + x.Id = new(grpc.ObjectID) + if err := x.Id.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + case 2: // Index + data, ok := fc.Uint32() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Index") + } + x.Index = data + case 3: // Total + data, ok := fc.Uint32() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Total") + } + x.Total = data + } + } + return nil +} +func (x *ECInfo_Chunk) GetId() *grpc.ObjectID { + if x != nil { + return x.Id + } + return nil +} +func (x *ECInfo_Chunk) SetId(v *grpc.ObjectID) { + x.Id = v +} +func (x *ECInfo_Chunk) GetIndex() uint32 { + if x != nil { + return x.Index + } + return 0 +} +func (x *ECInfo_Chunk) SetIndex(v uint32) { + x.Index = v +} +func (x *ECInfo_Chunk) GetTotal() uint32 { + if x != nil { + return x.Total + } + return 0 +} +func (x *ECInfo_Chunk) SetTotal(v uint32) { + x.Total = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *ECInfo_Chunk) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *ECInfo_Chunk) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"id\":" + out.RawString(prefix[1:]) + x.Id.MarshalEasyJSON(out) + } + { + const prefix string = ",\"index\":" + out.RawString(prefix) + out.Uint32(x.Index) + } + { + const prefix string = ",\"total\":" + out.RawString(prefix) + out.Uint32(x.Total) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *ECInfo_Chunk) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *ECInfo_Chunk) 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 *grpc.ObjectID + f = new(grpc.ObjectID) + f.UnmarshalEasyJSON(in) + x.Id = f + } + case "index": + { + var f uint32 + f = in.Uint32() + x.Index = f + } + case "total": + { + var f uint32 + f = in.Uint32() + x.Total = f + } + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} + +type ECInfo struct { + Chunks []*ECInfo_Chunk `json:"chunks"` +} + +var ( + _ encoding.ProtoMarshaler = (*ECInfo)(nil) + _ encoding.ProtoUnmarshaler = (*ECInfo)(nil) + _ json.Marshaler = (*ECInfo)(nil) + _ json.Unmarshaler = (*ECInfo)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *ECInfo) StableSize() (size int) { + if x == nil { + return 0 + } + for i := range x.Chunks { + size += proto.NestedStructureSize(1, x.Chunks[i]) + } + return size +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *ECInfo) 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 *ECInfo) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + for i := range x.Chunks { + if x.Chunks[i] != nil && x.Chunks[i].StableSize() != 0 { + x.Chunks[i].EmitProtobuf(mm.AppendMessage(1)) + } + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *ECInfo) 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", "ECInfo") + } + switch fc.FieldNum { + case 1: // Chunks + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Chunks") + } + x.Chunks = append(x.Chunks, new(ECInfo_Chunk)) + ff := x.Chunks[len(x.Chunks)-1] + if err := ff.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + } + } + return nil +} +func (x *ECInfo) GetChunks() []*ECInfo_Chunk { + if x != nil { + return x.Chunks + } + return nil +} +func (x *ECInfo) SetChunks(v []*ECInfo_Chunk) { + x.Chunks = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *ECInfo) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *ECInfo) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"chunks\":" + out.RawString(prefix[1:]) + out.RawByte('[') + for i := range x.Chunks { + if i != 0 { + out.RawByte(',') + } + x.Chunks[i].MarshalEasyJSON(out) + } + out.RawByte(']') + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *ECInfo) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *ECInfo) 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 "chunks": + { + var f *ECInfo_Chunk + var list []*ECInfo_Chunk + in.Delim('[') + for !in.IsDelim(']') { + f = new(ECInfo_Chunk) + f.UnmarshalEasyJSON(in) + list = append(list, f) + in.WantComma() + } + x.Chunks = list + in.Delim(']') + } + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} diff --git a/object/grpc/types_frostfs_fuzz.go b/object/grpc/types_frostfs_fuzz.go new file mode 100644 index 0000000..8491638 --- /dev/null +++ b/object/grpc/types_frostfs_fuzz.go @@ -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 +} diff --git a/object/grpc/types_frostfs_test.go b/object/grpc/types_frostfs_test.go new file mode 100644 index 0000000..11825be --- /dev/null +++ b/object/grpc/types_frostfs_test.go @@ -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) + }) +} diff --git a/refs/grpc/types.go b/refs/grpc/types.go deleted file mode 100644 index cdb69aa..0000000 --- a/refs/grpc/types.go +++ /dev/null @@ -1,97 +0,0 @@ -package refs - -// SetValue sets container identifier in a binary format. -func (x *ContainerID) SetValue(v []byte) { - x.Value = v -} - -// SetValue sets object identifier in a binary format. -func (x *ObjectID) SetValue(v []byte) { - x.Value = v -} - -// SetValue sets owner identifier in a binary format. -func (x *OwnerID) SetValue(v []byte) { - x.Value = v -} - -// SetContainerId sets container identifier of the address. -func (x *Address) SetContainerId(v *ContainerID) { - x.ContainerId = v -} - -// SetObjectId sets object identifier of the address. -func (x *Address) SetObjectId(v *ObjectID) { - x.ObjectId = v -} - -// SetType in generic checksum structure. -func (x *Checksum) SetType(v ChecksumType) { - x.Type = v -} - -// SetSum in generic checksum structure. -func (x *Checksum) SetSum(v []byte) { - x.Sum = v -} - -// SetMajor sets major version number. -func (x *Version) SetMajor(v uint32) { - x.Major = v -} - -// SetMinor sets minor version number. -func (x *Version) SetMinor(v uint32) { - x.Minor = v -} - -// SetKey sets public key in a binary format. -func (x *Signature) SetKey(v []byte) { - x.Key = v -} - -// SetSign sets signature. -func (x *Signature) SetSign(v []byte) { - x.Sign = v -} - -// SetScheme sets signature scheme. -func (x *Signature) SetScheme(s SignatureScheme) { - x.Scheme = s -} - -// SetKey sets public key in a binary format. -func (x *SignatureRFC6979) SetKey(v []byte) { - x.Key = v -} - -// SetSign sets signature. -func (x *SignatureRFC6979) SetSign(v []byte) { - x.Sign = v -} - -// FromString parses SignatureScheme from a string representation, -// It is a reverse action to String(). -// -// Returns true if s was parsed successfully. -func (x *SignatureScheme) FromString(s string) bool { - i, ok := SignatureScheme_value[s] - if ok { - *x = SignatureScheme(i) - } - - return ok -} - -// FromString parses ChecksumType from a string representation, -// It is a reverse action to String(). -// -// Returns true if s was parsed successfully. -func (x *ChecksumType) FromString(s string) bool { - i, ok := ChecksumType_value[s] - if ok { - *x = ChecksumType(i) - } - - return ok -} diff --git a/refs/grpc/types.pb.go b/refs/grpc/types.pb.go deleted file mode 100644 index ab3ae42..0000000 --- a/refs/grpc/types.pb.go +++ /dev/null @@ -1,852 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.33.0 -// protoc v5.27.2 -// source: refs/grpc/types.proto - -package refs - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -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) -) - -// Signature scheme describes digital signing scheme used for (key, signature) -// pair. -type SignatureScheme int32 - -const ( - // ECDSA with SHA-512 hashing (FIPS 186-3) - SignatureScheme_ECDSA_SHA512 SignatureScheme = 0 - // Deterministic ECDSA with SHA-256 hashing (RFC 6979) - SignatureScheme_ECDSA_RFC6979_SHA256 SignatureScheme = 1 - // Deterministic ECDSA with SHA-256 hashing using WalletConnect API. - // Here the algorithm is the same, but the message format differs. - SignatureScheme_ECDSA_RFC6979_SHA256_WALLET_CONNECT SignatureScheme = 2 -) - -// Enum value maps for SignatureScheme. -var ( - SignatureScheme_name = map[int32]string{ - 0: "ECDSA_SHA512", - 1: "ECDSA_RFC6979_SHA256", - 2: "ECDSA_RFC6979_SHA256_WALLET_CONNECT", - } - SignatureScheme_value = map[string]int32{ - "ECDSA_SHA512": 0, - "ECDSA_RFC6979_SHA256": 1, - "ECDSA_RFC6979_SHA256_WALLET_CONNECT": 2, - } -) - -func (x SignatureScheme) Enum() *SignatureScheme { - p := new(SignatureScheme) - *p = x - return p -} - -func (x SignatureScheme) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (SignatureScheme) Descriptor() protoreflect.EnumDescriptor { - return file_refs_grpc_types_proto_enumTypes[0].Descriptor() -} - -func (SignatureScheme) Type() protoreflect.EnumType { - return &file_refs_grpc_types_proto_enumTypes[0] -} - -func (x SignatureScheme) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use SignatureScheme.Descriptor instead. -func (SignatureScheme) EnumDescriptor() ([]byte, []int) { - return file_refs_grpc_types_proto_rawDescGZIP(), []int{0} -} - -// Checksum algorithm type. -type ChecksumType int32 - -const ( - // Unknown. Not used - ChecksumType_CHECKSUM_TYPE_UNSPECIFIED ChecksumType = 0 - // Tillich-Zemor homomorphic hash function - ChecksumType_TZ ChecksumType = 1 - // SHA-256 - ChecksumType_SHA256 ChecksumType = 2 -) - -// Enum value maps for ChecksumType. -var ( - ChecksumType_name = map[int32]string{ - 0: "CHECKSUM_TYPE_UNSPECIFIED", - 1: "TZ", - 2: "SHA256", - } - ChecksumType_value = map[string]int32{ - "CHECKSUM_TYPE_UNSPECIFIED": 0, - "TZ": 1, - "SHA256": 2, - } -) - -func (x ChecksumType) Enum() *ChecksumType { - p := new(ChecksumType) - *p = x - return p -} - -func (x ChecksumType) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (ChecksumType) Descriptor() protoreflect.EnumDescriptor { - return file_refs_grpc_types_proto_enumTypes[1].Descriptor() -} - -func (ChecksumType) Type() protoreflect.EnumType { - return &file_refs_grpc_types_proto_enumTypes[1] -} - -func (x ChecksumType) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use ChecksumType.Descriptor instead. -func (ChecksumType) EnumDescriptor() ([]byte, []int) { - return file_refs_grpc_types_proto_rawDescGZIP(), []int{1} -} - -// Objects in NeoFS are addressed by their ContainerID and ObjectID. -// -// String presentation of `Address` is a concatenation of string encoded -// `ContainerID` and `ObjectID` delimited by '/' character. -type Address struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Container identifier - ContainerId *ContainerID `protobuf:"bytes,1,opt,name=container_id,json=containerID,proto3" json:"container_id,omitempty"` - // Object identifier - ObjectId *ObjectID `protobuf:"bytes,2,opt,name=object_id,json=objectID,proto3" json:"object_id,omitempty"` -} - -func (x *Address) Reset() { - *x = Address{} - if protoimpl.UnsafeEnabled { - mi := &file_refs_grpc_types_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Address) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Address) ProtoMessage() {} - -func (x *Address) ProtoReflect() protoreflect.Message { - mi := &file_refs_grpc_types_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Address.ProtoReflect.Descriptor instead. -func (*Address) Descriptor() ([]byte, []int) { - return file_refs_grpc_types_proto_rawDescGZIP(), []int{0} -} - -func (x *Address) GetContainerId() *ContainerID { - if x != nil { - return x.ContainerId - } - return nil -} - -func (x *Address) GetObjectId() *ObjectID { - if x != nil { - return x.ObjectId - } - return nil -} - -// NeoFS Object unique identifier. Objects are immutable and content-addressed. -// It means `ObjectID` will change if the `header` or the `payload` changes. -// -// `ObjectID` is a 32 byte long -// [SHA256](https://csrc.nist.gov/publications/detail/fips/180/4/final) hash of -// the object's `header` field, which, in it's turn, contains the hash of the -// object's payload. -// -// String presentation is a -// [base58](https://tools.ietf.org/html/draft-msporny-base58-02) encoded string. -// -// JSON value will be data encoded as a string using standard base64 -// encoding with paddings. Either -// [standard](https://tools.ietf.org/html/rfc4648#section-4) or -// [URL-safe](https://tools.ietf.org/html/rfc4648#section-5) base64 encoding -// with/without paddings are accepted. -type ObjectID struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Object identifier in a binary format - Value []byte `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` -} - -func (x *ObjectID) Reset() { - *x = ObjectID{} - if protoimpl.UnsafeEnabled { - mi := &file_refs_grpc_types_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ObjectID) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ObjectID) ProtoMessage() {} - -func (x *ObjectID) ProtoReflect() protoreflect.Message { - mi := &file_refs_grpc_types_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ObjectID.ProtoReflect.Descriptor instead. -func (*ObjectID) Descriptor() ([]byte, []int) { - return file_refs_grpc_types_proto_rawDescGZIP(), []int{1} -} - -func (x *ObjectID) GetValue() []byte { - if x != nil { - return x.Value - } - return nil -} - -// NeoFS container identifier. Container structures are immutable and -// content-addressed. -// -// `ContainerID` is a 32 byte long -// [SHA256](https://csrc.nist.gov/publications/detail/fips/180/4/final) hash of -// stable-marshalled container message. -// -// String presentation is a -// [base58](https://tools.ietf.org/html/draft-msporny-base58-02) encoded string. -// -// JSON value will be data encoded as a string using standard base64 -// encoding with paddings. Either -// [standard](https://tools.ietf.org/html/rfc4648#section-4) or -// [URL-safe](https://tools.ietf.org/html/rfc4648#section-5) base64 encoding -// with/without paddings are accepted. -type ContainerID struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Container identifier in a binary format. - Value []byte `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` -} - -func (x *ContainerID) Reset() { - *x = ContainerID{} - if protoimpl.UnsafeEnabled { - mi := &file_refs_grpc_types_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ContainerID) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ContainerID) ProtoMessage() {} - -func (x *ContainerID) ProtoReflect() protoreflect.Message { - mi := &file_refs_grpc_types_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ContainerID.ProtoReflect.Descriptor instead. -func (*ContainerID) Descriptor() ([]byte, []int) { - return file_refs_grpc_types_proto_rawDescGZIP(), []int{2} -} - -func (x *ContainerID) GetValue() []byte { - if x != nil { - return x.Value - } - return nil -} - -// `OwnerID` is a derivative of a user's main public key. The transformation -// algorithm is the same as for Neo3 wallet addresses. Neo3 wallet address can -// be directly used as `OwnerID`. -// -// `OwnerID` is a 25 bytes sequence starting with Neo version prefix byte -// followed by 20 bytes of ScrptHash and 4 bytes of checksum. -// -// String presentation is a [Base58 -// Check](https://en.bitcoin.it/wiki/Base58Check_encoding) Encoded string. -// -// JSON value will be data encoded as a string using standard base64 -// encoding with paddings. Either -// [standard](https://tools.ietf.org/html/rfc4648#section-4) or -// [URL-safe](https://tools.ietf.org/html/rfc4648#section-5) base64 encoding -// with/without paddings are accepted. -type OwnerID struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Identifier of the container owner in a binary format - Value []byte `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` -} - -func (x *OwnerID) Reset() { - *x = OwnerID{} - if protoimpl.UnsafeEnabled { - mi := &file_refs_grpc_types_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *OwnerID) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*OwnerID) ProtoMessage() {} - -func (x *OwnerID) ProtoReflect() protoreflect.Message { - mi := &file_refs_grpc_types_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use OwnerID.ProtoReflect.Descriptor instead. -func (*OwnerID) Descriptor() ([]byte, []int) { - return file_refs_grpc_types_proto_rawDescGZIP(), []int{3} -} - -func (x *OwnerID) GetValue() []byte { - if x != nil { - return x.Value - } - return nil -} - -// API version used by a node. -// -// String presentation is a Semantic Versioning 2.0.0 compatible version string -// with 'v' prefix. i.e. `vX.Y`, where `X` is the major number, `Y` is the minor -// number. -type Version struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Major API version - Major uint32 `protobuf:"varint,1,opt,name=major,proto3" json:"major,omitempty"` - // Minor API version - Minor uint32 `protobuf:"varint,2,opt,name=minor,proto3" json:"minor,omitempty"` -} - -func (x *Version) Reset() { - *x = Version{} - if protoimpl.UnsafeEnabled { - mi := &file_refs_grpc_types_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Version) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Version) ProtoMessage() {} - -func (x *Version) ProtoReflect() protoreflect.Message { - mi := &file_refs_grpc_types_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Version.ProtoReflect.Descriptor instead. -func (*Version) Descriptor() ([]byte, []int) { - return file_refs_grpc_types_proto_rawDescGZIP(), []int{4} -} - -func (x *Version) GetMajor() uint32 { - if x != nil { - return x.Major - } - return 0 -} - -func (x *Version) GetMinor() uint32 { - if x != nil { - return x.Minor - } - return 0 -} - -// Signature of something in NeoFS. -type Signature struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Public key used for signing - Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - // Signature - Sign []byte `protobuf:"bytes,2,opt,name=sign,json=signature,proto3" json:"sign,omitempty"` - // Scheme contains digital signature scheme identifier - Scheme SignatureScheme `protobuf:"varint,3,opt,name=scheme,proto3,enum=neo.fs.v2.refs.SignatureScheme" json:"scheme,omitempty"` -} - -func (x *Signature) Reset() { - *x = Signature{} - if protoimpl.UnsafeEnabled { - mi := &file_refs_grpc_types_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Signature) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Signature) ProtoMessage() {} - -func (x *Signature) ProtoReflect() protoreflect.Message { - mi := &file_refs_grpc_types_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Signature.ProtoReflect.Descriptor instead. -func (*Signature) Descriptor() ([]byte, []int) { - return file_refs_grpc_types_proto_rawDescGZIP(), []int{5} -} - -func (x *Signature) GetKey() []byte { - if x != nil { - return x.Key - } - return nil -} - -func (x *Signature) GetSign() []byte { - if x != nil { - return x.Sign - } - return nil -} - -func (x *Signature) GetScheme() SignatureScheme { - if x != nil { - return x.Scheme - } - return SignatureScheme_ECDSA_SHA512 -} - -// RFC 6979 signature. -type SignatureRFC6979 struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Public key used for signing - Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - // Deterministic ECDSA with SHA-256 hashing - Sign []byte `protobuf:"bytes,2,opt,name=sign,json=signature,proto3" json:"sign,omitempty"` -} - -func (x *SignatureRFC6979) Reset() { - *x = SignatureRFC6979{} - if protoimpl.UnsafeEnabled { - mi := &file_refs_grpc_types_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SignatureRFC6979) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SignatureRFC6979) ProtoMessage() {} - -func (x *SignatureRFC6979) ProtoReflect() protoreflect.Message { - mi := &file_refs_grpc_types_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SignatureRFC6979.ProtoReflect.Descriptor instead. -func (*SignatureRFC6979) Descriptor() ([]byte, []int) { - return file_refs_grpc_types_proto_rawDescGZIP(), []int{6} -} - -func (x *SignatureRFC6979) GetKey() []byte { - if x != nil { - return x.Key - } - return nil -} - -func (x *SignatureRFC6979) GetSign() []byte { - if x != nil { - return x.Sign - } - return nil -} - -// Checksum message. -// Depending on checksum algorithm type, the string presentation may vary: -// -// - TZ \ -// Hex encoded string without `0x` prefix -// - SHA256 \ -// Hex encoded string without `0x` prefix -type Checksum struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Checksum algorithm type - Type ChecksumType `protobuf:"varint,1,opt,name=type,proto3,enum=neo.fs.v2.refs.ChecksumType" json:"type,omitempty"` - // Checksum itself - Sum []byte `protobuf:"bytes,2,opt,name=sum,proto3" json:"sum,omitempty"` -} - -func (x *Checksum) Reset() { - *x = Checksum{} - if protoimpl.UnsafeEnabled { - mi := &file_refs_grpc_types_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Checksum) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Checksum) ProtoMessage() {} - -func (x *Checksum) ProtoReflect() protoreflect.Message { - mi := &file_refs_grpc_types_proto_msgTypes[7] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Checksum.ProtoReflect.Descriptor instead. -func (*Checksum) Descriptor() ([]byte, []int) { - return file_refs_grpc_types_proto_rawDescGZIP(), []int{7} -} - -func (x *Checksum) GetType() ChecksumType { - if x != nil { - return x.Type - } - return ChecksumType_CHECKSUM_TYPE_UNSPECIFIED -} - -func (x *Checksum) GetSum() []byte { - if x != nil { - return x.Sum - } - return nil -} - -var File_refs_grpc_types_proto protoreflect.FileDescriptor - -var file_refs_grpc_types_proto_rawDesc = []byte{ - 0x0a, 0x15, 0x72, 0x65, 0x66, 0x73, 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, 0x72, 0x65, 0x66, 0x73, 0x22, 0x80, 0x01, 0x0a, 0x07, 0x41, 0x64, 0x64, 0x72, - 0x65, 0x73, 0x73, 0x12, 0x3e, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, - 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, - 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, - 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, - 0x72, 0x49, 0x44, 0x12, 0x35, 0x0a, 0x09, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x69, 0x64, - 0x18, 0x02, 0x20, 0x01, 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, 0x08, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x44, 0x22, 0x20, 0x0a, 0x08, 0x4f, 0x62, - 0x6a, 0x65, 0x63, 0x74, 0x49, 0x44, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x23, 0x0a, 0x0b, - 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x12, 0x14, 0x0a, 0x05, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x22, 0x1f, 0x0a, 0x07, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x12, 0x14, 0x0a, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x22, 0x35, 0x0a, 0x07, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x14, 0x0a, - 0x05, 0x6d, 0x61, 0x6a, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x6d, 0x61, - 0x6a, 0x6f, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x6d, 0x69, 0x6e, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0d, 0x52, 0x05, 0x6d, 0x69, 0x6e, 0x6f, 0x72, 0x22, 0x6f, 0x0a, 0x09, 0x53, 0x69, 0x67, - 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0c, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x69, 0x67, 0x6e, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, - 0x65, 0x12, 0x37, 0x0a, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x0e, 0x32, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, - 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x63, 0x68, 0x65, - 0x6d, 0x65, 0x52, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x22, 0x3d, 0x0a, 0x10, 0x53, 0x69, - 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x46, 0x43, 0x36, 0x39, 0x37, 0x39, 0x12, 0x10, - 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x03, 0x6b, 0x65, 0x79, - 0x12, 0x17, 0x0a, 0x04, 0x73, 0x69, 0x67, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, - 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x22, 0x4e, 0x0a, 0x08, 0x43, 0x68, 0x65, - 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x12, 0x30, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0e, 0x32, 0x1c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, - 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x54, 0x79, 0x70, - 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x75, 0x6d, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0c, 0x52, 0x03, 0x73, 0x75, 0x6d, 0x2a, 0x66, 0x0a, 0x0f, 0x53, 0x69, 0x67, - 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x0c, - 0x45, 0x43, 0x44, 0x53, 0x41, 0x5f, 0x53, 0x48, 0x41, 0x35, 0x31, 0x32, 0x10, 0x00, 0x12, 0x18, - 0x0a, 0x14, 0x45, 0x43, 0x44, 0x53, 0x41, 0x5f, 0x52, 0x46, 0x43, 0x36, 0x39, 0x37, 0x39, 0x5f, - 0x53, 0x48, 0x41, 0x32, 0x35, 0x36, 0x10, 0x01, 0x12, 0x27, 0x0a, 0x23, 0x45, 0x43, 0x44, 0x53, - 0x41, 0x5f, 0x52, 0x46, 0x43, 0x36, 0x39, 0x37, 0x39, 0x5f, 0x53, 0x48, 0x41, 0x32, 0x35, 0x36, - 0x5f, 0x57, 0x41, 0x4c, 0x4c, 0x45, 0x54, 0x5f, 0x43, 0x4f, 0x4e, 0x4e, 0x45, 0x43, 0x54, 0x10, - 0x02, 0x2a, 0x41, 0x0a, 0x0c, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x54, 0x79, 0x70, - 0x65, 0x12, 0x1d, 0x0a, 0x19, 0x43, 0x48, 0x45, 0x43, 0x4b, 0x53, 0x55, 0x4d, 0x5f, 0x54, 0x59, - 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, - 0x12, 0x06, 0x0a, 0x02, 0x54, 0x5a, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x53, 0x48, 0x41, 0x32, - 0x35, 0x36, 0x10, 0x02, 0x42, 0x5b, 0x5a, 0x3e, 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, 0x61, 0x70, - 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x72, 0x65, 0x66, 0x73, 0x2f, 0x67, 0x72, 0x70, - 0x63, 0x3b, 0x72, 0x65, 0x66, 0x73, 0xaa, 0x02, 0x18, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, - 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x52, 0x65, 0x66, - 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_refs_grpc_types_proto_rawDescOnce sync.Once - file_refs_grpc_types_proto_rawDescData = file_refs_grpc_types_proto_rawDesc -) - -func file_refs_grpc_types_proto_rawDescGZIP() []byte { - file_refs_grpc_types_proto_rawDescOnce.Do(func() { - file_refs_grpc_types_proto_rawDescData = protoimpl.X.CompressGZIP(file_refs_grpc_types_proto_rawDescData) - }) - return file_refs_grpc_types_proto_rawDescData -} - -var file_refs_grpc_types_proto_enumTypes = make([]protoimpl.EnumInfo, 2) -var file_refs_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 8) -var file_refs_grpc_types_proto_goTypes = []interface{}{ - (SignatureScheme)(0), // 0: neo.fs.v2.refs.SignatureScheme - (ChecksumType)(0), // 1: neo.fs.v2.refs.ChecksumType - (*Address)(nil), // 2: neo.fs.v2.refs.Address - (*ObjectID)(nil), // 3: neo.fs.v2.refs.ObjectID - (*ContainerID)(nil), // 4: neo.fs.v2.refs.ContainerID - (*OwnerID)(nil), // 5: neo.fs.v2.refs.OwnerID - (*Version)(nil), // 6: neo.fs.v2.refs.Version - (*Signature)(nil), // 7: neo.fs.v2.refs.Signature - (*SignatureRFC6979)(nil), // 8: neo.fs.v2.refs.SignatureRFC6979 - (*Checksum)(nil), // 9: neo.fs.v2.refs.Checksum -} -var file_refs_grpc_types_proto_depIdxs = []int32{ - 4, // 0: neo.fs.v2.refs.Address.container_id:type_name -> neo.fs.v2.refs.ContainerID - 3, // 1: neo.fs.v2.refs.Address.object_id:type_name -> neo.fs.v2.refs.ObjectID - 0, // 2: neo.fs.v2.refs.Signature.scheme:type_name -> neo.fs.v2.refs.SignatureScheme - 1, // 3: neo.fs.v2.refs.Checksum.type:type_name -> neo.fs.v2.refs.ChecksumType - 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_refs_grpc_types_proto_init() } -func file_refs_grpc_types_proto_init() { - if File_refs_grpc_types_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_refs_grpc_types_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Address); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_refs_grpc_types_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ObjectID); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_refs_grpc_types_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ContainerID); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_refs_grpc_types_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*OwnerID); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_refs_grpc_types_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Version); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_refs_grpc_types_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Signature); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_refs_grpc_types_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SignatureRFC6979); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_refs_grpc_types_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Checksum); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_refs_grpc_types_proto_rawDesc, - NumEnums: 2, - NumMessages: 8, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_refs_grpc_types_proto_goTypes, - DependencyIndexes: file_refs_grpc_types_proto_depIdxs, - EnumInfos: file_refs_grpc_types_proto_enumTypes, - MessageInfos: file_refs_grpc_types_proto_msgTypes, - }.Build() - File_refs_grpc_types_proto = out.File - file_refs_grpc_types_proto_rawDesc = nil - file_refs_grpc_types_proto_goTypes = nil - file_refs_grpc_types_proto_depIdxs = nil -} diff --git a/refs/grpc/types_frostfs.pb.go b/refs/grpc/types_frostfs.pb.go new file mode 100644 index 0000000..881a06f --- /dev/null +++ b/refs/grpc/types_frostfs.pb.go @@ -0,0 +1,1343 @@ +// Code generated by protoc-gen-go-frostfs. DO NOT EDIT. + +package refs + +import ( + json "encoding/json" + fmt "fmt" + pool "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/pool" + proto "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/proto" + encoding "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/proto/encoding" + easyproto "github.com/VictoriaMetrics/easyproto" + jlexer "github.com/mailru/easyjson/jlexer" + jwriter "github.com/mailru/easyjson/jwriter" + strconv "strconv" +) + +type SignatureScheme int32 + +const ( + SignatureScheme_ECDSA_SHA512 SignatureScheme = 0 + SignatureScheme_ECDSA_RFC6979_SHA256 SignatureScheme = 1 + SignatureScheme_ECDSA_RFC6979_SHA256_WALLET_CONNECT SignatureScheme = 2 +) + +var ( + SignatureScheme_name = map[int32]string{ + 0: "ECDSA_SHA512", + 1: "ECDSA_RFC6979_SHA256", + 2: "ECDSA_RFC6979_SHA256_WALLET_CONNECT", + } + SignatureScheme_value = map[string]int32{ + "ECDSA_SHA512": 0, + "ECDSA_RFC6979_SHA256": 1, + "ECDSA_RFC6979_SHA256_WALLET_CONNECT": 2, + } +) + +func (x SignatureScheme) String() string { + if v, ok := SignatureScheme_name[int32(x)]; ok { + return v + } + return strconv.FormatInt(int64(x), 10) +} +func (x *SignatureScheme) FromString(s string) bool { + if v, ok := SignatureScheme_value[s]; ok { + *x = SignatureScheme(v) + return true + } + return false +} + +type ChecksumType int32 + +const ( + ChecksumType_CHECKSUM_TYPE_UNSPECIFIED ChecksumType = 0 + ChecksumType_TZ ChecksumType = 1 + ChecksumType_SHA256 ChecksumType = 2 +) + +var ( + ChecksumType_name = map[int32]string{ + 0: "CHECKSUM_TYPE_UNSPECIFIED", + 1: "TZ", + 2: "SHA256", + } + ChecksumType_value = map[string]int32{ + "CHECKSUM_TYPE_UNSPECIFIED": 0, + "TZ": 1, + "SHA256": 2, + } +) + +func (x ChecksumType) String() string { + if v, ok := ChecksumType_name[int32(x)]; ok { + return v + } + return strconv.FormatInt(int64(x), 10) +} +func (x *ChecksumType) FromString(s string) bool { + if v, ok := ChecksumType_value[s]; ok { + *x = ChecksumType(v) + return true + } + return false +} + +type Address struct { + ContainerId *ContainerID `json:"containerID"` + ObjectId *ObjectID `json:"objectID"` +} + +var ( + _ encoding.ProtoMarshaler = (*Address)(nil) + _ encoding.ProtoUnmarshaler = (*Address)(nil) + _ json.Marshaler = (*Address)(nil) + _ json.Unmarshaler = (*Address)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *Address) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.NestedStructureSize(1, x.ContainerId) + size += proto.NestedStructureSize(2, x.ObjectId) + return size +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *Address) 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 *Address) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if x.ContainerId != nil && x.ContainerId.StableSize() != 0 { + x.ContainerId.EmitProtobuf(mm.AppendMessage(1)) + } + if x.ObjectId != nil && x.ObjectId.StableSize() != 0 { + x.ObjectId.EmitProtobuf(mm.AppendMessage(2)) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *Address) 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", "Address") + } + switch fc.FieldNum { + case 1: // ContainerId + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "ContainerId") + } + x.ContainerId = new(ContainerID) + if err := x.ContainerId.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + case 2: // ObjectId + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "ObjectId") + } + x.ObjectId = new(ObjectID) + if err := x.ObjectId.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + } + } + return nil +} +func (x *Address) GetContainerId() *ContainerID { + if x != nil { + return x.ContainerId + } + return nil +} +func (x *Address) SetContainerId(v *ContainerID) { + x.ContainerId = v +} +func (x *Address) GetObjectId() *ObjectID { + if x != nil { + return x.ObjectId + } + return nil +} +func (x *Address) SetObjectId(v *ObjectID) { + x.ObjectId = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *Address) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *Address) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"containerID\":" + out.RawString(prefix[1:]) + x.ContainerId.MarshalEasyJSON(out) + } + { + const prefix string = ",\"objectID\":" + out.RawString(prefix) + x.ObjectId.MarshalEasyJSON(out) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *Address) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *Address) 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 "containerID": + { + var f *ContainerID + f = new(ContainerID) + f.UnmarshalEasyJSON(in) + x.ContainerId = f + } + case "objectID": + { + var f *ObjectID + f = new(ObjectID) + f.UnmarshalEasyJSON(in) + x.ObjectId = f + } + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} + +type ObjectID struct { + Value []byte `json:"value"` +} + +var ( + _ encoding.ProtoMarshaler = (*ObjectID)(nil) + _ encoding.ProtoUnmarshaler = (*ObjectID)(nil) + _ json.Marshaler = (*ObjectID)(nil) + _ json.Unmarshaler = (*ObjectID)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *ObjectID) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.BytesSize(1, x.Value) + return size +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *ObjectID) 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 *ObjectID) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if len(x.Value) != 0 { + mm.AppendBytes(1, x.Value) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *ObjectID) 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", "ObjectID") + } + switch fc.FieldNum { + case 1: // Value + data, ok := fc.Bytes() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Value") + } + x.Value = data + } + } + return nil +} +func (x *ObjectID) GetValue() []byte { + if x != nil { + return x.Value + } + return nil +} +func (x *ObjectID) SetValue(v []byte) { + x.Value = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *ObjectID) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *ObjectID) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"value\":" + out.RawString(prefix[1:]) + out.Base64Bytes(x.Value) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *ObjectID) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *ObjectID) 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 []byte + f = in.Bytes() + x.Value = f + } + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} + +type ContainerID struct { + Value []byte `json:"value"` +} + +var ( + _ encoding.ProtoMarshaler = (*ContainerID)(nil) + _ encoding.ProtoUnmarshaler = (*ContainerID)(nil) + _ json.Marshaler = (*ContainerID)(nil) + _ json.Unmarshaler = (*ContainerID)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *ContainerID) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.BytesSize(1, x.Value) + return size +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *ContainerID) 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 *ContainerID) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if len(x.Value) != 0 { + mm.AppendBytes(1, x.Value) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *ContainerID) 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", "ContainerID") + } + switch fc.FieldNum { + case 1: // Value + data, ok := fc.Bytes() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Value") + } + x.Value = data + } + } + return nil +} +func (x *ContainerID) GetValue() []byte { + if x != nil { + return x.Value + } + return nil +} +func (x *ContainerID) SetValue(v []byte) { + x.Value = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *ContainerID) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *ContainerID) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"value\":" + out.RawString(prefix[1:]) + out.Base64Bytes(x.Value) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *ContainerID) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *ContainerID) 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 []byte + f = in.Bytes() + x.Value = f + } + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} + +type OwnerID struct { + Value []byte `json:"value"` +} + +var ( + _ encoding.ProtoMarshaler = (*OwnerID)(nil) + _ encoding.ProtoUnmarshaler = (*OwnerID)(nil) + _ json.Marshaler = (*OwnerID)(nil) + _ json.Unmarshaler = (*OwnerID)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *OwnerID) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.BytesSize(1, x.Value) + return size +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *OwnerID) 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 *OwnerID) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if len(x.Value) != 0 { + mm.AppendBytes(1, x.Value) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *OwnerID) 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", "OwnerID") + } + switch fc.FieldNum { + case 1: // Value + data, ok := fc.Bytes() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Value") + } + x.Value = data + } + } + return nil +} +func (x *OwnerID) GetValue() []byte { + if x != nil { + return x.Value + } + return nil +} +func (x *OwnerID) SetValue(v []byte) { + x.Value = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *OwnerID) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *OwnerID) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"value\":" + out.RawString(prefix[1:]) + out.Base64Bytes(x.Value) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *OwnerID) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *OwnerID) 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 []byte + f = in.Bytes() + x.Value = f + } + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} + +type Version struct { + Major uint32 `json:"major"` + Minor uint32 `json:"minor"` +} + +var ( + _ encoding.ProtoMarshaler = (*Version)(nil) + _ encoding.ProtoUnmarshaler = (*Version)(nil) + _ json.Marshaler = (*Version)(nil) + _ json.Unmarshaler = (*Version)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *Version) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.UInt32Size(1, x.Major) + size += proto.UInt32Size(2, x.Minor) + return size +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *Version) 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 *Version) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if x.Major != 0 { + mm.AppendUint32(1, x.Major) + } + if x.Minor != 0 { + mm.AppendUint32(2, x.Minor) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *Version) 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", "Version") + } + switch fc.FieldNum { + case 1: // Major + data, ok := fc.Uint32() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Major") + } + x.Major = data + case 2: // Minor + data, ok := fc.Uint32() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Minor") + } + x.Minor = data + } + } + return nil +} +func (x *Version) GetMajor() uint32 { + if x != nil { + return x.Major + } + return 0 +} +func (x *Version) SetMajor(v uint32) { + x.Major = v +} +func (x *Version) GetMinor() uint32 { + if x != nil { + return x.Minor + } + return 0 +} +func (x *Version) SetMinor(v uint32) { + x.Minor = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *Version) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *Version) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"major\":" + out.RawString(prefix[1:]) + out.Uint32(x.Major) + } + { + const prefix string = ",\"minor\":" + out.RawString(prefix) + out.Uint32(x.Minor) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *Version) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *Version) 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 "major": + { + var f uint32 + f = in.Uint32() + x.Major = f + } + case "minor": + { + var f uint32 + f = in.Uint32() + x.Minor = f + } + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} + +type Signature struct { + Key []byte `json:"key"` + Sign []byte `json:"signature"` + Scheme SignatureScheme `json:"scheme"` +} + +var ( + _ encoding.ProtoMarshaler = (*Signature)(nil) + _ encoding.ProtoUnmarshaler = (*Signature)(nil) + _ json.Marshaler = (*Signature)(nil) + _ json.Unmarshaler = (*Signature)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *Signature) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.BytesSize(1, x.Key) + size += proto.BytesSize(2, x.Sign) + size += proto.EnumSize(3, int32(x.Scheme)) + return size +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *Signature) 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 *Signature) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if len(x.Key) != 0 { + mm.AppendBytes(1, x.Key) + } + if len(x.Sign) != 0 { + mm.AppendBytes(2, x.Sign) + } + if int32(x.Scheme) != 0 { + mm.AppendInt32(3, int32(x.Scheme)) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *Signature) 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", "Signature") + } + switch fc.FieldNum { + case 1: // Key + data, ok := fc.Bytes() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Key") + } + x.Key = data + case 2: // Sign + data, ok := fc.Bytes() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Sign") + } + x.Sign = data + case 3: // Scheme + data, ok := fc.Int32() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Scheme") + } + x.Scheme = SignatureScheme(data) + } + } + return nil +} +func (x *Signature) GetKey() []byte { + if x != nil { + return x.Key + } + return nil +} +func (x *Signature) SetKey(v []byte) { + x.Key = v +} +func (x *Signature) GetSign() []byte { + if x != nil { + return x.Sign + } + return nil +} +func (x *Signature) SetSign(v []byte) { + x.Sign = v +} +func (x *Signature) GetScheme() SignatureScheme { + if x != nil { + return x.Scheme + } + return 0 +} +func (x *Signature) SetScheme(v SignatureScheme) { + x.Scheme = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *Signature) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *Signature) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"key\":" + out.RawString(prefix[1:]) + out.Base64Bytes(x.Key) + } + { + const prefix string = ",\"signature\":" + out.RawString(prefix) + out.Base64Bytes(x.Sign) + } + { + const prefix string = ",\"scheme\":" + out.RawString(prefix) + out.Int32(int32(x.Scheme)) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *Signature) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *Signature) 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 []byte + f = in.Bytes() + x.Key = f + } + case "signature": + { + var f []byte + f = in.Bytes() + x.Sign = f + } + case "scheme": + { + var f SignatureScheme + var parsedValue SignatureScheme + switch v := in.Interface().(type) { + case string: + if vv, ok := SignatureScheme_value[v]; ok { + parsedValue = SignatureScheme(vv) + break + } + vv, err := strconv.ParseInt(v, 10, 32) + if err != nil { + in.AddError(err) + return + } + parsedValue = SignatureScheme(vv) + case float64: + parsedValue = SignatureScheme(v) + } + f = parsedValue + x.Scheme = f + } + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} + +type SignatureRFC6979 struct { + Key []byte `json:"key"` + Sign []byte `json:"signature"` +} + +var ( + _ encoding.ProtoMarshaler = (*SignatureRFC6979)(nil) + _ encoding.ProtoUnmarshaler = (*SignatureRFC6979)(nil) + _ json.Marshaler = (*SignatureRFC6979)(nil) + _ json.Unmarshaler = (*SignatureRFC6979)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *SignatureRFC6979) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.BytesSize(1, x.Key) + size += proto.BytesSize(2, x.Sign) + return size +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *SignatureRFC6979) 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 *SignatureRFC6979) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if len(x.Key) != 0 { + mm.AppendBytes(1, x.Key) + } + if len(x.Sign) != 0 { + mm.AppendBytes(2, x.Sign) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *SignatureRFC6979) 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", "SignatureRFC6979") + } + switch fc.FieldNum { + case 1: // Key + data, ok := fc.Bytes() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Key") + } + x.Key = data + case 2: // Sign + data, ok := fc.Bytes() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Sign") + } + x.Sign = data + } + } + return nil +} +func (x *SignatureRFC6979) GetKey() []byte { + if x != nil { + return x.Key + } + return nil +} +func (x *SignatureRFC6979) SetKey(v []byte) { + x.Key = v +} +func (x *SignatureRFC6979) GetSign() []byte { + if x != nil { + return x.Sign + } + return nil +} +func (x *SignatureRFC6979) SetSign(v []byte) { + x.Sign = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *SignatureRFC6979) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *SignatureRFC6979) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"key\":" + out.RawString(prefix[1:]) + out.Base64Bytes(x.Key) + } + { + const prefix string = ",\"signature\":" + out.RawString(prefix) + out.Base64Bytes(x.Sign) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *SignatureRFC6979) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *SignatureRFC6979) 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 []byte + f = in.Bytes() + x.Key = f + } + case "signature": + { + var f []byte + f = in.Bytes() + x.Sign = f + } + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} + +type Checksum struct { + Type ChecksumType `json:"type"` + Sum []byte `json:"sum"` +} + +var ( + _ encoding.ProtoMarshaler = (*Checksum)(nil) + _ encoding.ProtoUnmarshaler = (*Checksum)(nil) + _ json.Marshaler = (*Checksum)(nil) + _ json.Unmarshaler = (*Checksum)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *Checksum) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.EnumSize(1, int32(x.Type)) + size += proto.BytesSize(2, x.Sum) + return size +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *Checksum) 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 *Checksum) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if int32(x.Type) != 0 { + mm.AppendInt32(1, int32(x.Type)) + } + if len(x.Sum) != 0 { + mm.AppendBytes(2, x.Sum) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *Checksum) 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", "Checksum") + } + switch fc.FieldNum { + case 1: // Type + data, ok := fc.Int32() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Type") + } + x.Type = ChecksumType(data) + case 2: // Sum + data, ok := fc.Bytes() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Sum") + } + x.Sum = data + } + } + return nil +} +func (x *Checksum) GetType() ChecksumType { + if x != nil { + return x.Type + } + return 0 +} +func (x *Checksum) SetType(v ChecksumType) { + x.Type = v +} +func (x *Checksum) GetSum() []byte { + if x != nil { + return x.Sum + } + return nil +} +func (x *Checksum) SetSum(v []byte) { + x.Sum = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *Checksum) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *Checksum) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"type\":" + out.RawString(prefix[1:]) + out.Int32(int32(x.Type)) + } + { + const prefix string = ",\"sum\":" + out.RawString(prefix) + out.Base64Bytes(x.Sum) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *Checksum) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *Checksum) 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 ChecksumType + var parsedValue ChecksumType + switch v := in.Interface().(type) { + case string: + if vv, ok := ChecksumType_value[v]; ok { + parsedValue = ChecksumType(vv) + break + } + vv, err := strconv.ParseInt(v, 10, 32) + if err != nil { + in.AddError(err) + return + } + parsedValue = ChecksumType(vv) + case float64: + parsedValue = ChecksumType(v) + } + f = parsedValue + x.Type = f + } + case "sum": + { + var f []byte + f = in.Bytes() + x.Sum = f + } + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} diff --git a/refs/grpc/types_frostfs_fuzz.go b/refs/grpc/types_frostfs_fuzz.go new file mode 100644 index 0000000..a64a9bf --- /dev/null +++ b/refs/grpc/types_frostfs_fuzz.go @@ -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 +} diff --git a/refs/grpc/types_frostfs_test.go b/refs/grpc/types_frostfs_test.go new file mode 100644 index 0000000..9b19892 --- /dev/null +++ b/refs/grpc/types_frostfs_test.go @@ -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) + }) +} diff --git a/rpc/client/client.go b/rpc/client/client.go index 7e914db..d9ce2fc 100644 --- a/rpc/client/client.go +++ b/rpc/client/client.go @@ -1,6 +1,7 @@ package client import ( + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/proto/encoding" "google.golang.org/grpc" "google.golang.org/grpc/credentials" ) @@ -20,6 +21,7 @@ func New(opts ...Option) *Client { opt(&c.cfg) } + c.grpcDialOpts = append(c.grpcDialOpts, grpc.WithDefaultCallOptions(grpc.ForceCodec(encoding.ProtoCodec{}))) if c.tlsCfg != nil { c.grpcDialOpts = append(c.grpcDialOpts, grpc.WithTransportCredentials(credentials.NewTLS(c.tlsCfg))) } diff --git a/rpc/message/encoding.go b/rpc/message/encoding.go index 715f015..d656acd 100644 --- a/rpc/message/encoding.go +++ b/rpc/message/encoding.go @@ -1,17 +1,14 @@ package message import ( - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/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) } diff --git a/rpc/netmap.go b/rpc/netmap.go index 38bdd6d..8119477 100644 --- a/rpc/netmap.go +++ b/rpc/netmap.go @@ -37,7 +37,6 @@ func NetworkInfo( opts ...client.CallOption, ) (*netmap.NetworkInfoResponse, error) { resp := new(netmap.NetworkInfoResponse) - err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceNetmap, rpcNetmapNetInfo), req, resp, opts...) if err != nil { return nil, err diff --git a/session/convert.go b/session/convert.go index 4197935..b7f334e 100644 --- a/session/convert.go +++ b/session/convert.go @@ -460,7 +460,7 @@ func (r *RequestMetaHeader) FromGRPCMessage(m grpc.Message) error { r.epoch = v.GetEpoch() r.ttl = v.GetTtl() - r.netMagic = v.GetNetworkMagic() + r.netMagic = v.GetMagicNumber() return nil } diff --git a/session/grpc/service.go b/session/grpc/service.go deleted file mode 100644 index 6e02328..0000000 --- a/session/grpc/service.go +++ /dev/null @@ -1,55 +0,0 @@ -package session - -import ( - refs "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc" -) - -// SetOwnerId sets identifier of the session initiator. -func (m *CreateRequest_Body) SetOwnerId(v *refs.OwnerID) { - m.OwnerId = v -} - -// SetExpiration sets lifetime of the session. -func (m *CreateRequest_Body) SetExpiration(v uint64) { - m.Expiration = v -} - -// SetBody sets body of the request. -func (m *CreateRequest) SetBody(v *CreateRequest_Body) { - m.Body = v -} - -// SetMetaHeader sets meta header of the request. -func (m *CreateRequest) SetMetaHeader(v *RequestMetaHeader) { - m.MetaHeader = v -} - -// SetVerifyHeader sets verification header of the request. -func (m *CreateRequest) SetVerifyHeader(v *RequestVerificationHeader) { - m.VerifyHeader = v -} - -// SetId sets identifier of the session token. -func (m *CreateResponse_Body) SetId(v []byte) { - m.Id = v -} - -// SetSessionKey sets session public key in a binary format. -func (m *CreateResponse_Body) SetSessionKey(v []byte) { - m.SessionKey = v -} - -// SetBody sets body of the response. -func (m *CreateResponse) SetBody(v *CreateResponse_Body) { - m.Body = v -} - -// SetMetaHeader sets meta header of the response. -func (m *CreateResponse) SetMetaHeader(v *ResponseMetaHeader) { - m.MetaHeader = v -} - -// SetVerifyHeader sets verification header of the response. -func (m *CreateResponse) SetVerifyHeader(v *ResponseVerificationHeader) { - m.VerifyHeader = v -} diff --git a/session/grpc/service.pb.go b/session/grpc/service.pb.go deleted file mode 100644 index b5e999f..0000000 --- a/session/grpc/service.pb.go +++ /dev/null @@ -1,458 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.33.0 -// protoc v5.27.2 -// source: session/grpc/service.proto - -package session - -import ( - grpc "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -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 - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Body of a create session token request message. - Body *CreateRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" 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,proto3" json:"verify_header,omitempty"` -} - -func (x *CreateRequest) Reset() { - *x = CreateRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_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_session_grpc_service_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CreateRequest.ProtoReflect.Descriptor instead. -func (*CreateRequest) Descriptor() ([]byte, []int) { - return file_session_grpc_service_proto_rawDescGZIP(), []int{0} -} - -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 -} - -// Information about the opened session. -type CreateResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Body of create session token response message. - Body *CreateResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" 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,proto3" 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,proto3" json:"verify_header,omitempty"` -} - -func (x *CreateResponse) Reset() { - *x = CreateResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_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_session_grpc_service_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CreateResponse.ProtoReflect.Descriptor instead. -func (*CreateResponse) Descriptor() ([]byte, []int) { - return file_session_grpc_service_proto_rawDescGZIP(), []int{1} -} - -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 -} - -// Session creation request body -type CreateRequest_Body struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Session initiating user's or node's key derived `OwnerID` - OwnerId *grpc.OwnerID `protobuf:"bytes,1,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"` - // Session expiration `Epoch` - Expiration uint64 `protobuf:"varint,2,opt,name=expiration,proto3" json:"expiration,omitempty"` -} - -func (x *CreateRequest_Body) Reset() { - *x = CreateRequest_Body{} - if protoimpl.UnsafeEnabled { - mi := &file_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_session_grpc_service_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CreateRequest_Body.ProtoReflect.Descriptor instead. -func (*CreateRequest_Body) Descriptor() ([]byte, []int) { - return file_session_grpc_service_proto_rawDescGZIP(), []int{0, 0} -} - -func (x *CreateRequest_Body) GetOwnerId() *grpc.OwnerID { - if x != nil { - return x.OwnerId - } - return nil -} - -func (x *CreateRequest_Body) GetExpiration() uint64 { - if x != nil { - return x.Expiration - } - return 0 -} - -// Session creation response body -type CreateResponse_Body struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Identifier of a newly created session - Id []byte `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - // Public key used for session - SessionKey []byte `protobuf:"bytes,2,opt,name=session_key,json=sessionKey,proto3" json:"session_key,omitempty"` -} - -func (x *CreateResponse_Body) Reset() { - *x = CreateResponse_Body{} - if protoimpl.UnsafeEnabled { - mi := &file_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_session_grpc_service_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CreateResponse_Body.ProtoReflect.Descriptor instead. -func (*CreateResponse_Body) Descriptor() ([]byte, []int) { - return file_session_grpc_service_proto_rawDescGZIP(), []int{1, 0} -} - -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 -} - -var File_session_grpc_service_proto protoreflect.FileDescriptor - -var file_session_grpc_service_proto_rawDesc = []byte{ - 0x0a, 0x1a, 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, - 0x15, 0x72, 0x65, 0x66, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x18, 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, 0x64, 0x5a, 0x44, 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, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 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, 0x06, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_session_grpc_service_proto_rawDescOnce sync.Once - file_session_grpc_service_proto_rawDescData = file_session_grpc_service_proto_rawDesc -) - -func file_session_grpc_service_proto_rawDescGZIP() []byte { - file_session_grpc_service_proto_rawDescOnce.Do(func() { - file_session_grpc_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_session_grpc_service_proto_rawDescData) - }) - return file_session_grpc_service_proto_rawDescData -} - -var file_session_grpc_service_proto_msgTypes = make([]protoimpl.MessageInfo, 4) -var file_session_grpc_service_proto_goTypes = []interface{}{ - (*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_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_session_grpc_service_proto_init() } -func file_session_grpc_service_proto_init() { - if File_session_grpc_service_proto != nil { - return - } - file_session_grpc_types_proto_init() - if !protoimpl.UnsafeEnabled { - file_session_grpc_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CreateRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_session_grpc_service_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CreateResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_session_grpc_service_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CreateRequest_Body); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_session_grpc_service_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CreateResponse_Body); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_session_grpc_service_proto_rawDesc, - NumEnums: 0, - NumMessages: 4, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_session_grpc_service_proto_goTypes, - DependencyIndexes: file_session_grpc_service_proto_depIdxs, - MessageInfos: file_session_grpc_service_proto_msgTypes, - }.Build() - File_session_grpc_service_proto = out.File - file_session_grpc_service_proto_rawDesc = nil - file_session_grpc_service_proto_goTypes = nil - file_session_grpc_service_proto_depIdxs = nil -} diff --git a/session/grpc/service_frostfs.pb.go b/session/grpc/service_frostfs.pb.go new file mode 100644 index 0000000..cfec4d6 --- /dev/null +++ b/session/grpc/service_frostfs.pb.go @@ -0,0 +1,781 @@ +// Code generated by protoc-gen-go-frostfs. DO NOT EDIT. + +package session + +import ( + json "encoding/json" + fmt "fmt" + grpc "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc" + pool "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/pool" + proto "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/proto" + encoding "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/proto/encoding" + easyproto "github.com/VictoriaMetrics/easyproto" + jlexer "github.com/mailru/easyjson/jlexer" + jwriter "github.com/mailru/easyjson/jwriter" +) + +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.StableSize() != 0 { + 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 + } + out.RawByte('{') + { + const prefix string = ",\"ownerId\":" + out.RawString(prefix[1:]) + x.OwnerId.MarshalEasyJSON(out) + } + { + const prefix string = ",\"expiration\":" + out.RawString(prefix) + out.Uint64(x.Expiration) + } + 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 + f = in.Uint64() + 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.StableSize() != 0 { + x.Body.EmitProtobuf(mm.AppendMessage(1)) + } + if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 { + x.MetaHeader.EmitProtobuf(mm.AppendMessage(2)) + } + if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 { + 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 + } + out.RawByte('{') + { + const prefix string = ",\"body\":" + out.RawString(prefix[1:]) + x.Body.MarshalEasyJSON(out) + } + { + const prefix string = ",\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) + } + { + 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 + } + out.RawByte('{') + { + const prefix string = ",\"id\":" + out.RawString(prefix[1:]) + out.Base64Bytes(x.Id) + } + { + const prefix string = ",\"sessionKey\":" + out.RawString(prefix) + out.Base64Bytes(x.SessionKey) + } + 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 + f = in.Bytes() + x.Id = f + } + case "sessionKey": + { + var f []byte + f = in.Bytes() + 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.StableSize() != 0 { + x.Body.EmitProtobuf(mm.AppendMessage(1)) + } + if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 { + x.MetaHeader.EmitProtobuf(mm.AppendMessage(2)) + } + if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 { + 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 + } + out.RawByte('{') + { + const prefix string = ",\"body\":" + out.RawString(prefix[1:]) + x.Body.MarshalEasyJSON(out) + } + { + const prefix string = ",\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) + } + { + 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() + } +} diff --git a/session/grpc/service_frostfs_fuzz.go b/session/grpc/service_frostfs_fuzz.go new file mode 100644 index 0000000..759361c --- /dev/null +++ b/session/grpc/service_frostfs_fuzz.go @@ -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 +} diff --git a/session/grpc/service_frostfs_test.go b/session/grpc/service_frostfs_test.go new file mode 100644 index 0000000..fc8664e --- /dev/null +++ b/session/grpc/service_frostfs_test.go @@ -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) + }) +} diff --git a/session/grpc/types.go b/session/grpc/types.go deleted file mode 100644 index 857c45e..0000000 --- a/session/grpc/types.go +++ /dev/null @@ -1,246 +0,0 @@ -package session - -import ( - acl "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/acl/grpc" - refs "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc" - status "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/status/grpc" -) - -// SetKey sets key to the X-Header. -func (m *XHeader) SetKey(v string) { - m.Key = v -} - -// SetValue sets value of the X-Header. -func (m *XHeader) SetValue(v string) { - m.Value = v -} - -// SetExp sets epoch number of the token expiration. -func (m *SessionToken_Body_TokenLifetime) SetExp(v uint64) { - m.Exp = v -} - -// SetNbf sets starting epoch number of the token. -func (m *SessionToken_Body_TokenLifetime) SetNbf(v uint64) { - m.Nbf = v -} - -// SetIat sets the number of the epoch in which the token was issued. -func (m *SessionToken_Body_TokenLifetime) SetIat(v uint64) { - m.Iat = v -} - -// SetId sets identifier of the session token. -func (m *SessionToken_Body) SetId(v []byte) { - m.Id = v -} - -// SetOwnerId sets identifier of the session token owner. -func (m *SessionToken_Body) SetOwnerId(v *refs.OwnerID) { - m.OwnerId = v -} - -// SetLifetime sets lifetime of the session token. -func (m *SessionToken_Body) SetLifetime(v *SessionToken_Body_TokenLifetime) { - m.Lifetime = v -} - -// SetSessionKey sets public session key in a binary format. -func (m *SessionToken_Body) SetSessionKey(v []byte) { - m.SessionKey = v -} - -// SetObjectAddressContext sets object context of the session token. -func (m *SessionToken_Body) SetObject(v *ObjectSessionContext) { - m.Context = &SessionToken_Body_Object{ - Object: v, - } -} - -// SetContainer sets container context of the session token. -func (m *SessionToken_Body) SetContainer(v *ContainerSessionContext) { - m.Context = &SessionToken_Body_Container{ - Container: v, - } -} - -// SetTarget specifies objects involved in the object session. -func (m *ObjectSessionContext) SetTarget(tgt *ObjectSessionContext_Target) { - m.Target = tgt -} - -// SetVerb sets type of request for which the token is issued. -func (m *ObjectSessionContext) SetVerb(v ObjectSessionContext_Verb) { - m.Verb = v -} - -// SetVerb sets type of request for which the token is issued. -func (x *ContainerSessionContext) SetVerb(v ContainerSessionContext_Verb) { - x.Verb = v -} - -// SetWildcard sets wildcard flag of the container session. -func (x *ContainerSessionContext) SetWildcard(v bool) { - x.Wildcard = v -} - -// SetContainerId sets identifier of the container related to the session. -func (x *ContainerSessionContext) SetContainerId(v *refs.ContainerID) { - x.ContainerId = v -} - -// SetBody sets session token body. -func (m *SessionToken) SetBody(v *SessionToken_Body) { - m.Body = v -} - -// SetSignature sets session token signature. -func (m *SessionToken) SetSignature(v *refs.Signature) { - m.Signature = v -} - -// SetVersion sets client protocol version. -func (m *RequestMetaHeader) SetVersion(v *refs.Version) { - m.Version = v -} - -// SetEpoch sets client local epoch. -func (m *RequestMetaHeader) SetEpoch(v uint64) { - m.Epoch = v -} - -// SetTtl sets request TTL. -func (m *RequestMetaHeader) SetTtl(v uint32) { - m.Ttl = v -} - -// SetXHeaders sets request X-Headers. -func (m *RequestMetaHeader) SetXHeaders(v []*XHeader) { - m.XHeaders = v -} - -// SetSessionToken sets session token of the request. -func (m *RequestMetaHeader) SetSessionToken(v *SessionToken) { - m.SessionToken = v -} - -// SetBearerToken sets bearer token of the request. -func (m *RequestMetaHeader) SetBearerToken(v *acl.BearerToken) { - m.BearerToken = v -} - -// SetOrigin sets origin request meta header. -func (m *RequestMetaHeader) SetOrigin(v *RequestMetaHeader) { - m.Origin = v -} - -// GetNetworkMagic returns NeoFS network magic. -func (m *RequestMetaHeader) GetNetworkMagic() uint64 { - if m != nil { - return m.MagicNumber - } - - return 0 -} - -// SetMagicNumber sets NeoFS network magic. -func (m *RequestMetaHeader) SetMagicNumber(v uint64) { - m.MagicNumber = v -} - -// SetVersion sets server protocol version. -func (m *ResponseMetaHeader) SetVersion(v *refs.Version) { - m.Version = v -} - -// SetEpoch sets server local epoch. -func (m *ResponseMetaHeader) SetEpoch(v uint64) { - m.Epoch = v -} - -// SetTtl sets response TTL. -func (m *ResponseMetaHeader) SetTtl(v uint32) { - m.Ttl = v -} - -// SetXHeaders sets response X-Headers. -func (m *ResponseMetaHeader) SetXHeaders(v []*XHeader) { - m.XHeaders = v -} - -// SetOrigin sets origin response meta header. -func (m *ResponseMetaHeader) SetOrigin(v *ResponseMetaHeader) { - m.Origin = v -} - -// SetStatus sets response status. -func (m *ResponseMetaHeader) SetStatus(v *status.Status) { - m.Status = v -} - -// SetBodySignature sets signature of the request body. -func (m *RequestVerificationHeader) SetBodySignature(v *refs.Signature) { - m.BodySignature = v -} - -// SetMetaSignature sets signature of the request meta. -func (m *RequestVerificationHeader) SetMetaSignature(v *refs.Signature) { - m.MetaSignature = v -} - -// SetOriginSignature sets signature of the origin verification header of the request. -func (m *RequestVerificationHeader) SetOriginSignature(v *refs.Signature) { - m.OriginSignature = v -} - -// SetOrigin sets origin verification header of the request. -func (m *RequestVerificationHeader) SetOrigin(v *RequestVerificationHeader) { - m.Origin = v -} - -// SetBodySignature sets signature of the response body. -func (m *ResponseVerificationHeader) SetBodySignature(v *refs.Signature) { - m.BodySignature = v -} - -// SetMetaSignature sets signature of the response meta. -func (m *ResponseVerificationHeader) SetMetaSignature(v *refs.Signature) { - m.MetaSignature = v -} - -// SetOriginSignature sets signature of the origin verification header of the response. -func (m *ResponseVerificationHeader) SetOriginSignature(v *refs.Signature) { - m.OriginSignature = v -} - -// SetOrigin sets origin verification header of the response. -func (m *ResponseVerificationHeader) SetOrigin(v *ResponseVerificationHeader) { - m.Origin = v -} - -// FromString parses ObjectSessionContext_Verb from a string representation, -// It is a reverse action to String(). -// -// Returns true if s was parsed successfully. -func (x *ObjectSessionContext_Verb) FromString(s string) bool { - i, ok := ObjectSessionContext_Verb_value[s] - if ok { - *x = ObjectSessionContext_Verb(i) - } - - return ok -} - -// FromString parses ContainerSessionContext_Verb from a string representation, -// It is a reverse action to String(). -// -// Returns true if s was parsed successfully. -func (x *ContainerSessionContext_Verb) FromString(s string) bool { - i, ok := ContainerSessionContext_Verb_value[s] - if ok { - *x = ContainerSessionContext_Verb(i) - } - - return ok -} diff --git a/session/grpc/types.pb.go b/session/grpc/types.pb.go deleted file mode 100644 index 9f51743..0000000 --- a/session/grpc/types.pb.go +++ /dev/null @@ -1,1451 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.33.0 -// protoc v5.27.2 -// source: session/grpc/types.proto - -package session - -import ( - grpc1 "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/acl/grpc" - grpc "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc" - grpc2 "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/status/grpc" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -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) -) - -// Object request verbs -type ObjectSessionContext_Verb int32 - -const ( - // Unknown verb - ObjectSessionContext_VERB_UNSPECIFIED ObjectSessionContext_Verb = 0 - // Refers to object.Put RPC call - ObjectSessionContext_PUT ObjectSessionContext_Verb = 1 - // Refers to object.Get RPC call - ObjectSessionContext_GET ObjectSessionContext_Verb = 2 - // Refers to object.Head RPC call - ObjectSessionContext_HEAD ObjectSessionContext_Verb = 3 - // Refers to object.Search RPC call - ObjectSessionContext_SEARCH ObjectSessionContext_Verb = 4 - // Refers to object.Delete RPC call - ObjectSessionContext_DELETE ObjectSessionContext_Verb = 5 - // Refers to object.GetRange RPC call - ObjectSessionContext_RANGE ObjectSessionContext_Verb = 6 - // Refers to object.GetRangeHash RPC call - ObjectSessionContext_RANGEHASH ObjectSessionContext_Verb = 7 - // Refers to object.Patch RPC call - ObjectSessionContext_PATCH ObjectSessionContext_Verb = 8 -) - -// Enum value maps for ObjectSessionContext_Verb. -var ( - ObjectSessionContext_Verb_name = map[int32]string{ - 0: "VERB_UNSPECIFIED", - 1: "PUT", - 2: "GET", - 3: "HEAD", - 4: "SEARCH", - 5: "DELETE", - 6: "RANGE", - 7: "RANGEHASH", - 8: "PATCH", - } - ObjectSessionContext_Verb_value = map[string]int32{ - "VERB_UNSPECIFIED": 0, - "PUT": 1, - "GET": 2, - "HEAD": 3, - "SEARCH": 4, - "DELETE": 5, - "RANGE": 6, - "RANGEHASH": 7, - "PATCH": 8, - } -) - -func (x ObjectSessionContext_Verb) Enum() *ObjectSessionContext_Verb { - p := new(ObjectSessionContext_Verb) - *p = x - return p -} - -func (x ObjectSessionContext_Verb) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (ObjectSessionContext_Verb) Descriptor() protoreflect.EnumDescriptor { - return file_session_grpc_types_proto_enumTypes[0].Descriptor() -} - -func (ObjectSessionContext_Verb) Type() protoreflect.EnumType { - return &file_session_grpc_types_proto_enumTypes[0] -} - -func (x ObjectSessionContext_Verb) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use ObjectSessionContext_Verb.Descriptor instead. -func (ObjectSessionContext_Verb) EnumDescriptor() ([]byte, []int) { - return file_session_grpc_types_proto_rawDescGZIP(), []int{0, 0} -} - -// Container request verbs -type ContainerSessionContext_Verb int32 - -const ( - // Unknown verb - ContainerSessionContext_VERB_UNSPECIFIED ContainerSessionContext_Verb = 0 - // Refers to container.Put RPC call - ContainerSessionContext_PUT ContainerSessionContext_Verb = 1 - // Refers to container.Delete RPC call - ContainerSessionContext_DELETE ContainerSessionContext_Verb = 2 - // Refers to container.SetExtendedACL RPC call - ContainerSessionContext_SETEACL ContainerSessionContext_Verb = 3 -) - -// Enum value maps for ContainerSessionContext_Verb. -var ( - ContainerSessionContext_Verb_name = map[int32]string{ - 0: "VERB_UNSPECIFIED", - 1: "PUT", - 2: "DELETE", - 3: "SETEACL", - } - ContainerSessionContext_Verb_value = map[string]int32{ - "VERB_UNSPECIFIED": 0, - "PUT": 1, - "DELETE": 2, - "SETEACL": 3, - } -) - -func (x ContainerSessionContext_Verb) Enum() *ContainerSessionContext_Verb { - p := new(ContainerSessionContext_Verb) - *p = x - return p -} - -func (x ContainerSessionContext_Verb) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (ContainerSessionContext_Verb) Descriptor() protoreflect.EnumDescriptor { - return file_session_grpc_types_proto_enumTypes[1].Descriptor() -} - -func (ContainerSessionContext_Verb) Type() protoreflect.EnumType { - return &file_session_grpc_types_proto_enumTypes[1] -} - -func (x ContainerSessionContext_Verb) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use ContainerSessionContext_Verb.Descriptor instead. -func (ContainerSessionContext_Verb) EnumDescriptor() ([]byte, []int) { - return file_session_grpc_types_proto_rawDescGZIP(), []int{1, 0} -} - -// Context information for Session Tokens related to ObjectService requests -type ObjectSessionContext struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Type of request for which the token is issued - Verb ObjectSessionContext_Verb `protobuf:"varint,1,opt,name=verb,proto3,enum=neo.fs.v2.session.ObjectSessionContext_Verb" json:"verb,omitempty"` - // Object session target. MUST be correctly formed and set. If `objects` - // field is not empty, then the session applies only to these elements, - // otherwise, to all objects from the specified container. - Target *ObjectSessionContext_Target `protobuf:"bytes,2,opt,name=target,proto3" json:"target,omitempty"` -} - -func (x *ObjectSessionContext) Reset() { - *x = ObjectSessionContext{} - if protoimpl.UnsafeEnabled { - mi := &file_session_grpc_types_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ObjectSessionContext) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ObjectSessionContext) ProtoMessage() {} - -func (x *ObjectSessionContext) ProtoReflect() protoreflect.Message { - mi := &file_session_grpc_types_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ObjectSessionContext.ProtoReflect.Descriptor instead. -func (*ObjectSessionContext) Descriptor() ([]byte, []int) { - return file_session_grpc_types_proto_rawDescGZIP(), []int{0} -} - -func (x *ObjectSessionContext) GetVerb() ObjectSessionContext_Verb { - if x != nil { - return x.Verb - } - return ObjectSessionContext_VERB_UNSPECIFIED -} - -func (x *ObjectSessionContext) GetTarget() *ObjectSessionContext_Target { - if x != nil { - return x.Target - } - return nil -} - -// Context information for Session Tokens related to ContainerService requests. -type ContainerSessionContext struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Type of request for which the token is issued - Verb ContainerSessionContext_Verb `protobuf:"varint,1,opt,name=verb,proto3,enum=neo.fs.v2.session.ContainerSessionContext_Verb" json:"verb,omitempty"` - // Spreads the action to all owner containers. - // If set, container_id field is ignored. - Wildcard bool `protobuf:"varint,2,opt,name=wildcard,proto3" json:"wildcard,omitempty"` - // Particular container to which the action applies. - // Ignored if wildcard flag is set. - ContainerId *grpc.ContainerID `protobuf:"bytes,3,opt,name=container_id,json=containerID,proto3" json:"container_id,omitempty"` -} - -func (x *ContainerSessionContext) Reset() { - *x = ContainerSessionContext{} - if protoimpl.UnsafeEnabled { - mi := &file_session_grpc_types_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ContainerSessionContext) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ContainerSessionContext) ProtoMessage() {} - -func (x *ContainerSessionContext) ProtoReflect() protoreflect.Message { - mi := &file_session_grpc_types_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ContainerSessionContext.ProtoReflect.Descriptor instead. -func (*ContainerSessionContext) Descriptor() ([]byte, []int) { - return file_session_grpc_types_proto_rawDescGZIP(), []int{1} -} - -func (x *ContainerSessionContext) GetVerb() ContainerSessionContext_Verb { - if x != nil { - return x.Verb - } - return ContainerSessionContext_VERB_UNSPECIFIED -} - -func (x *ContainerSessionContext) GetWildcard() bool { - if x != nil { - return x.Wildcard - } - return false -} - -func (x *ContainerSessionContext) GetContainerId() *grpc.ContainerID { - if x != nil { - return x.ContainerId - } - return nil -} - -// NeoFS Session Token. -type SessionToken struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Session Token contains the proof of trust between peers to be attached in - // requests for further verification. Please see corresponding section of - // NeoFS Technical Specification for details. - Body *SessionToken_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` - // Signature of `SessionToken` information - Signature *grpc.Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` -} - -func (x *SessionToken) Reset() { - *x = SessionToken{} - if protoimpl.UnsafeEnabled { - mi := &file_session_grpc_types_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SessionToken) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SessionToken) ProtoMessage() {} - -func (x *SessionToken) ProtoReflect() protoreflect.Message { - mi := &file_session_grpc_types_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SessionToken.ProtoReflect.Descriptor instead. -func (*SessionToken) Descriptor() ([]byte, []int) { - return file_session_grpc_types_proto_rawDescGZIP(), []int{2} -} - -func (x *SessionToken) GetBody() *SessionToken_Body { - if x != nil { - return x.Body - } - return nil -} - -func (x *SessionToken) GetSignature() *grpc.Signature { - if x != nil { - return x.Signature - } - return nil -} - -// Extended headers for Request/Response. They may contain any user-defined -// headers to be interpreted on application level. -// -// Key name must be a unique valid UTF-8 string. Value can't be empty. Requests -// or Responses with duplicated header names or headers with empty values will -// be considered invalid. -// -// There are some "well-known" headers starting with `__SYSTEM__` (`__NEOFS__` -// is deprecated) prefix that affect system behaviour: -// -// - [ __SYSTEM__NETMAP_EPOCH ] \ -// (`__NEOFS__NETMAP_EPOCH` is deprecated) \ -// Netmap epoch to use for object placement calculation. The `value` is string -// encoded `uint64` in decimal presentation. If set to '0' or not set, the -// current epoch only will be used. -// - [ __SYSTEM__NETMAP_LOOKUP_DEPTH ] \ -// (`__NEOFS__NETMAP_LOOKUP_DEPTH` is deprecated) \ -// If object can't be found using current epoch's netmap, this header limits -// how many past epochs the node can look up through. The `value` is string -// encoded `uint64` in decimal presentation. If set to '0' or not set, only -// the current epoch will be used. -type XHeader struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Key of the X-Header - Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - // Value of the X-Header - Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` -} - -func (x *XHeader) Reset() { - *x = XHeader{} - if protoimpl.UnsafeEnabled { - mi := &file_session_grpc_types_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *XHeader) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*XHeader) ProtoMessage() {} - -func (x *XHeader) ProtoReflect() protoreflect.Message { - mi := &file_session_grpc_types_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use XHeader.ProtoReflect.Descriptor instead. -func (*XHeader) Descriptor() ([]byte, []int) { - return file_session_grpc_types_proto_rawDescGZIP(), []int{3} -} - -func (x *XHeader) GetKey() string { - if x != nil { - return x.Key - } - return "" -} - -func (x *XHeader) GetValue() string { - if x != nil { - return x.Value - } - return "" -} - -// Meta information attached to the request. When forwarded between peers, -// request meta headers are folded in matryoshka style. -type RequestMetaHeader struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Peer's API version used - Version *grpc.Version `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` - // Peer's local epoch number. Set to 0 if unknown. - Epoch uint64 `protobuf:"varint,2,opt,name=epoch,proto3" json:"epoch,omitempty"` - // Maximum number of intermediate nodes in the request route - Ttl uint32 `protobuf:"varint,3,opt,name=ttl,proto3" json:"ttl,omitempty"` - // Request X-Headers - XHeaders []*XHeader `protobuf:"bytes,4,rep,name=x_headers,json=xHeaders,proto3" json:"x_headers,omitempty"` - // Session token within which the request is sent - SessionToken *SessionToken `protobuf:"bytes,5,opt,name=session_token,json=sessionToken,proto3" json:"session_token,omitempty"` - // `BearerToken` with eACL overrides for the request - BearerToken *grpc1.BearerToken `protobuf:"bytes,6,opt,name=bearer_token,json=bearerToken,proto3" json:"bearer_token,omitempty"` - // `RequestMetaHeader` of the origin request - Origin *RequestMetaHeader `protobuf:"bytes,7,opt,name=origin,proto3" json:"origin,omitempty"` - // NeoFS network magic. Must match the value for the network - // that the server belongs to. - MagicNumber uint64 `protobuf:"varint,8,opt,name=magic_number,json=magicNumber,proto3" json:"magic_number,omitempty"` -} - -func (x *RequestMetaHeader) Reset() { - *x = RequestMetaHeader{} - if protoimpl.UnsafeEnabled { - mi := &file_session_grpc_types_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RequestMetaHeader) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RequestMetaHeader) ProtoMessage() {} - -func (x *RequestMetaHeader) ProtoReflect() protoreflect.Message { - mi := &file_session_grpc_types_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RequestMetaHeader.ProtoReflect.Descriptor instead. -func (*RequestMetaHeader) Descriptor() ([]byte, []int) { - return file_session_grpc_types_proto_rawDescGZIP(), []int{4} -} - -func (x *RequestMetaHeader) GetVersion() *grpc.Version { - if x != nil { - return x.Version - } - return nil -} - -func (x *RequestMetaHeader) GetEpoch() uint64 { - if x != nil { - return x.Epoch - } - return 0 -} - -func (x *RequestMetaHeader) GetTtl() uint32 { - if x != nil { - return x.Ttl - } - return 0 -} - -func (x *RequestMetaHeader) GetXHeaders() []*XHeader { - if x != nil { - return x.XHeaders - } - return nil -} - -func (x *RequestMetaHeader) GetSessionToken() *SessionToken { - if x != nil { - return x.SessionToken - } - return nil -} - -func (x *RequestMetaHeader) GetBearerToken() *grpc1.BearerToken { - if x != nil { - return x.BearerToken - } - return nil -} - -func (x *RequestMetaHeader) GetOrigin() *RequestMetaHeader { - if x != nil { - return x.Origin - } - return nil -} - -func (x *RequestMetaHeader) GetMagicNumber() uint64 { - if x != nil { - return x.MagicNumber - } - return 0 -} - -// Information about the response -type ResponseMetaHeader struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Peer's API version used - Version *grpc.Version `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` - // Peer's local epoch number - Epoch uint64 `protobuf:"varint,2,opt,name=epoch,proto3" json:"epoch,omitempty"` - // Maximum number of intermediate nodes in the request route - Ttl uint32 `protobuf:"varint,3,opt,name=ttl,proto3" json:"ttl,omitempty"` - // Response X-Headers - XHeaders []*XHeader `protobuf:"bytes,4,rep,name=x_headers,json=xHeaders,proto3" json:"x_headers,omitempty"` - // `ResponseMetaHeader` of the origin request - Origin *ResponseMetaHeader `protobuf:"bytes,5,opt,name=origin,proto3" json:"origin,omitempty"` - // Status return - Status *grpc2.Status `protobuf:"bytes,6,opt,name=status,proto3" json:"status,omitempty"` -} - -func (x *ResponseMetaHeader) Reset() { - *x = ResponseMetaHeader{} - if protoimpl.UnsafeEnabled { - mi := &file_session_grpc_types_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ResponseMetaHeader) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ResponseMetaHeader) ProtoMessage() {} - -func (x *ResponseMetaHeader) ProtoReflect() protoreflect.Message { - mi := &file_session_grpc_types_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ResponseMetaHeader.ProtoReflect.Descriptor instead. -func (*ResponseMetaHeader) Descriptor() ([]byte, []int) { - return file_session_grpc_types_proto_rawDescGZIP(), []int{5} -} - -func (x *ResponseMetaHeader) GetVersion() *grpc.Version { - if x != nil { - return x.Version - } - return nil -} - -func (x *ResponseMetaHeader) GetEpoch() uint64 { - if x != nil { - return x.Epoch - } - return 0 -} - -func (x *ResponseMetaHeader) GetTtl() uint32 { - if x != nil { - return x.Ttl - } - return 0 -} - -func (x *ResponseMetaHeader) GetXHeaders() []*XHeader { - if x != nil { - return x.XHeaders - } - return nil -} - -func (x *ResponseMetaHeader) GetOrigin() *ResponseMetaHeader { - if x != nil { - return x.Origin - } - return nil -} - -func (x *ResponseMetaHeader) GetStatus() *grpc2.Status { - if x != nil { - return x.Status - } - return nil -} - -// Verification info for the request signed by all intermediate nodes. -type RequestVerificationHeader struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Request Body signature. Should be generated once by the request initiator. - BodySignature *grpc.Signature `protobuf:"bytes,1,opt,name=body_signature,json=bodySignature,proto3" json:"body_signature,omitempty"` - // Request Meta signature is added and signed by each intermediate node - MetaSignature *grpc.Signature `protobuf:"bytes,2,opt,name=meta_signature,json=metaSignature,proto3" json:"meta_signature,omitempty"` - // Signature of previous hops - OriginSignature *grpc.Signature `protobuf:"bytes,3,opt,name=origin_signature,json=originSignature,proto3" json:"origin_signature,omitempty"` - // Chain of previous hops signatures - Origin *RequestVerificationHeader `protobuf:"bytes,4,opt,name=origin,proto3" json:"origin,omitempty"` -} - -func (x *RequestVerificationHeader) Reset() { - *x = RequestVerificationHeader{} - if protoimpl.UnsafeEnabled { - mi := &file_session_grpc_types_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RequestVerificationHeader) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RequestVerificationHeader) ProtoMessage() {} - -func (x *RequestVerificationHeader) ProtoReflect() protoreflect.Message { - mi := &file_session_grpc_types_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RequestVerificationHeader.ProtoReflect.Descriptor instead. -func (*RequestVerificationHeader) Descriptor() ([]byte, []int) { - return file_session_grpc_types_proto_rawDescGZIP(), []int{6} -} - -func (x *RequestVerificationHeader) GetBodySignature() *grpc.Signature { - if x != nil { - return x.BodySignature - } - return nil -} - -func (x *RequestVerificationHeader) GetMetaSignature() *grpc.Signature { - if x != nil { - return x.MetaSignature - } - return nil -} - -func (x *RequestVerificationHeader) GetOriginSignature() *grpc.Signature { - if x != nil { - return x.OriginSignature - } - return nil -} - -func (x *RequestVerificationHeader) GetOrigin() *RequestVerificationHeader { - if x != nil { - return x.Origin - } - return nil -} - -// Verification info for the response signed by all intermediate nodes -type ResponseVerificationHeader struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Response Body signature. Should be generated once by an answering node. - BodySignature *grpc.Signature `protobuf:"bytes,1,opt,name=body_signature,json=bodySignature,proto3" json:"body_signature,omitempty"` - // Response Meta signature is added and signed by each intermediate node - MetaSignature *grpc.Signature `protobuf:"bytes,2,opt,name=meta_signature,json=metaSignature,proto3" json:"meta_signature,omitempty"` - // Signature of previous hops - OriginSignature *grpc.Signature `protobuf:"bytes,3,opt,name=origin_signature,json=originSignature,proto3" json:"origin_signature,omitempty"` - // Chain of previous hops signatures - Origin *ResponseVerificationHeader `protobuf:"bytes,4,opt,name=origin,proto3" json:"origin,omitempty"` -} - -func (x *ResponseVerificationHeader) Reset() { - *x = ResponseVerificationHeader{} - if protoimpl.UnsafeEnabled { - mi := &file_session_grpc_types_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ResponseVerificationHeader) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ResponseVerificationHeader) ProtoMessage() {} - -func (x *ResponseVerificationHeader) ProtoReflect() protoreflect.Message { - mi := &file_session_grpc_types_proto_msgTypes[7] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ResponseVerificationHeader.ProtoReflect.Descriptor instead. -func (*ResponseVerificationHeader) Descriptor() ([]byte, []int) { - return file_session_grpc_types_proto_rawDescGZIP(), []int{7} -} - -func (x *ResponseVerificationHeader) GetBodySignature() *grpc.Signature { - if x != nil { - return x.BodySignature - } - return nil -} - -func (x *ResponseVerificationHeader) GetMetaSignature() *grpc.Signature { - if x != nil { - return x.MetaSignature - } - return nil -} - -func (x *ResponseVerificationHeader) GetOriginSignature() *grpc.Signature { - if x != nil { - return x.OriginSignature - } - return nil -} - -func (x *ResponseVerificationHeader) GetOrigin() *ResponseVerificationHeader { - if x != nil { - return x.Origin - } - return nil -} - -// Carries objects involved in the object session. -type ObjectSessionContext_Target struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Indicates which container the session is spread to. Field MUST be set - // and correct. - Container *grpc.ContainerID `protobuf:"bytes,1,opt,name=container,proto3" json:"container,omitempty"` - // Indicates which objects the session is spread to. Objects are expected - // to be stored in the NeoFS container referenced by `container` field. - // Each element MUST have correct format. - Objects []*grpc.ObjectID `protobuf:"bytes,2,rep,name=objects,proto3" json:"objects,omitempty"` -} - -func (x *ObjectSessionContext_Target) Reset() { - *x = ObjectSessionContext_Target{} - if protoimpl.UnsafeEnabled { - mi := &file_session_grpc_types_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ObjectSessionContext_Target) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ObjectSessionContext_Target) ProtoMessage() {} - -func (x *ObjectSessionContext_Target) ProtoReflect() protoreflect.Message { - mi := &file_session_grpc_types_proto_msgTypes[8] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ObjectSessionContext_Target.ProtoReflect.Descriptor instead. -func (*ObjectSessionContext_Target) Descriptor() ([]byte, []int) { - return file_session_grpc_types_proto_rawDescGZIP(), []int{0, 0} -} - -func (x *ObjectSessionContext_Target) GetContainer() *grpc.ContainerID { - if x != nil { - return x.Container - } - return nil -} - -func (x *ObjectSessionContext_Target) GetObjects() []*grpc.ObjectID { - if x != nil { - return x.Objects - } - return nil -} - -// Session Token body -type SessionToken_Body struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Token identifier is a valid UUIDv4 in binary form - Id []byte `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - // Identifier of the session initiator - OwnerId *grpc.OwnerID `protobuf:"bytes,2,opt,name=owner_id,json=ownerID,proto3" json:"owner_id,omitempty"` - // Lifetime of the session - Lifetime *SessionToken_Body_TokenLifetime `protobuf:"bytes,3,opt,name=lifetime,proto3" json:"lifetime,omitempty"` - // Public key used in session - SessionKey []byte `protobuf:"bytes,4,opt,name=session_key,json=sessionKey,proto3" json:"session_key,omitempty"` - // Session Context information - // - // Types that are assignable to Context: - // - // *SessionToken_Body_Object - // *SessionToken_Body_Container - Context isSessionToken_Body_Context `protobuf_oneof:"context"` -} - -func (x *SessionToken_Body) Reset() { - *x = SessionToken_Body{} - if protoimpl.UnsafeEnabled { - mi := &file_session_grpc_types_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SessionToken_Body) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SessionToken_Body) ProtoMessage() {} - -func (x *SessionToken_Body) ProtoReflect() protoreflect.Message { - mi := &file_session_grpc_types_proto_msgTypes[9] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SessionToken_Body.ProtoReflect.Descriptor instead. -func (*SessionToken_Body) Descriptor() ([]byte, []int) { - return file_session_grpc_types_proto_rawDescGZIP(), []int{2, 0} -} - -func (x *SessionToken_Body) GetId() []byte { - if x != nil { - return x.Id - } - return nil -} - -func (x *SessionToken_Body) GetOwnerId() *grpc.OwnerID { - if x != nil { - return x.OwnerId - } - return nil -} - -func (x *SessionToken_Body) GetLifetime() *SessionToken_Body_TokenLifetime { - if x != nil { - return x.Lifetime - } - return nil -} - -func (x *SessionToken_Body) GetSessionKey() []byte { - if x != nil { - return x.SessionKey - } - return nil -} - -func (m *SessionToken_Body) GetContext() isSessionToken_Body_Context { - if m != nil { - return m.Context - } - return nil -} - -func (x *SessionToken_Body) GetObject() *ObjectSessionContext { - if x, ok := x.GetContext().(*SessionToken_Body_Object); ok { - return x.Object - } - return nil -} - -func (x *SessionToken_Body) GetContainer() *ContainerSessionContext { - if x, ok := x.GetContext().(*SessionToken_Body_Container); ok { - return x.Container - } - return nil -} - -type isSessionToken_Body_Context interface { - isSessionToken_Body_Context() -} - -type SessionToken_Body_Object struct { - // ObjectService session context - Object *ObjectSessionContext `protobuf:"bytes,5,opt,name=object,proto3,oneof"` -} - -type SessionToken_Body_Container struct { - // ContainerService session context - Container *ContainerSessionContext `protobuf:"bytes,6,opt,name=container,proto3,oneof"` -} - -func (*SessionToken_Body_Object) isSessionToken_Body_Context() {} - -func (*SessionToken_Body_Container) isSessionToken_Body_Context() {} - -// Lifetime parameters of the token. Field names taken from rfc7519. -type SessionToken_Body_TokenLifetime struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Expiration Epoch - Exp uint64 `protobuf:"varint,1,opt,name=exp,proto3" json:"exp,omitempty"` - // Not valid before Epoch - Nbf uint64 `protobuf:"varint,2,opt,name=nbf,proto3" json:"nbf,omitempty"` - // Issued at Epoch - Iat uint64 `protobuf:"varint,3,opt,name=iat,proto3" json:"iat,omitempty"` -} - -func (x *SessionToken_Body_TokenLifetime) Reset() { - *x = SessionToken_Body_TokenLifetime{} - if protoimpl.UnsafeEnabled { - mi := &file_session_grpc_types_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SessionToken_Body_TokenLifetime) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SessionToken_Body_TokenLifetime) ProtoMessage() {} - -func (x *SessionToken_Body_TokenLifetime) ProtoReflect() protoreflect.Message { - mi := &file_session_grpc_types_proto_msgTypes[10] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SessionToken_Body_TokenLifetime.ProtoReflect.Descriptor instead. -func (*SessionToken_Body_TokenLifetime) Descriptor() ([]byte, []int) { - return file_session_grpc_types_proto_rawDescGZIP(), []int{2, 0, 0} -} - -func (x *SessionToken_Body_TokenLifetime) GetExp() uint64 { - if x != nil { - return x.Exp - } - return 0 -} - -func (x *SessionToken_Body_TokenLifetime) GetNbf() uint64 { - if x != nil { - return x.Nbf - } - return 0 -} - -func (x *SessionToken_Body_TokenLifetime) GetIat() uint64 { - if x != nil { - return x.Iat - } - return 0 -} - -var File_session_grpc_types_proto protoreflect.FileDescriptor - -var file_session_grpc_types_proto_rawDesc = []byte{ - 0x0a, 0x18, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, - 0x79, 0x70, 0x65, 0x73, 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, 0x15, 0x72, - 0x65, 0x66, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x14, 0x61, 0x63, 0x6c, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, - 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x73, 0x74, 0x61, 0x74, - 0x75, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x22, 0x90, 0x03, 0x0a, 0x14, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x53, 0x65, - 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x12, 0x40, 0x0a, 0x04, - 0x76, 0x65, 0x72, 0x62, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2c, 0x2e, 0x6e, 0x65, 0x6f, - 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x4f, - 0x62, 0x6a, 0x65, 0x63, 0x74, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x74, - 0x65, 0x78, 0x74, 0x2e, 0x56, 0x65, 0x72, 0x62, 0x52, 0x04, 0x76, 0x65, 0x72, 0x62, 0x12, 0x46, - 0x0a, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2e, - 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, - 0x6f, 0x6e, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, - 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x2e, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x52, 0x06, - 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x1a, 0x77, 0x0a, 0x06, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, - 0x12, 0x39, 0x0a, 0x09, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, - 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, - 0x52, 0x09, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x12, 0x32, 0x0a, 0x07, 0x6f, - 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x18, 0x02, 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, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x22, - 0x75, 0x0a, 0x04, 0x56, 0x65, 0x72, 0x62, 0x12, 0x14, 0x0a, 0x10, 0x56, 0x45, 0x52, 0x42, 0x5f, - 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x07, 0x0a, - 0x03, 0x50, 0x55, 0x54, 0x10, 0x01, 0x12, 0x07, 0x0a, 0x03, 0x47, 0x45, 0x54, 0x10, 0x02, 0x12, - 0x08, 0x0a, 0x04, 0x48, 0x45, 0x41, 0x44, 0x10, 0x03, 0x12, 0x0a, 0x0a, 0x06, 0x53, 0x45, 0x41, - 0x52, 0x43, 0x48, 0x10, 0x04, 0x12, 0x0a, 0x0a, 0x06, 0x44, 0x45, 0x4c, 0x45, 0x54, 0x45, 0x10, - 0x05, 0x12, 0x09, 0x0a, 0x05, 0x52, 0x41, 0x4e, 0x47, 0x45, 0x10, 0x06, 0x12, 0x0d, 0x0a, 0x09, - 0x52, 0x41, 0x4e, 0x47, 0x45, 0x48, 0x41, 0x53, 0x48, 0x10, 0x07, 0x12, 0x09, 0x0a, 0x05, 0x50, - 0x41, 0x54, 0x43, 0x48, 0x10, 0x08, 0x22, 0xfa, 0x01, 0x0a, 0x17, 0x43, 0x6f, 0x6e, 0x74, 0x61, - 0x69, 0x6e, 0x65, 0x72, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x74, 0x65, - 0x78, 0x74, 0x12, 0x43, 0x0a, 0x04, 0x76, 0x65, 0x72, 0x62, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, - 0x32, 0x2f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, - 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x53, 0x65, - 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x2e, 0x56, 0x65, 0x72, - 0x62, 0x52, 0x04, 0x76, 0x65, 0x72, 0x62, 0x12, 0x1a, 0x0a, 0x08, 0x77, 0x69, 0x6c, 0x64, 0x63, - 0x61, 0x72, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x77, 0x69, 0x6c, 0x64, 0x63, - 0x61, 0x72, 0x64, 0x12, 0x3e, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, - 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, - 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, - 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, - 0x72, 0x49, 0x44, 0x22, 0x3e, 0x0a, 0x04, 0x56, 0x65, 0x72, 0x62, 0x12, 0x14, 0x0a, 0x10, 0x56, - 0x45, 0x52, 0x42, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, - 0x00, 0x12, 0x07, 0x0a, 0x03, 0x50, 0x55, 0x54, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x44, 0x45, - 0x4c, 0x45, 0x54, 0x45, 0x10, 0x02, 0x12, 0x0b, 0x0a, 0x07, 0x53, 0x45, 0x54, 0x45, 0x41, 0x43, - 0x4c, 0x10, 0x03, 0x22, 0xa0, 0x04, 0x0a, 0x0c, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x54, - 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x38, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 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, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x6f, - 0x6b, 0x65, 0x6e, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x37, - 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, - 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, - 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x1a, 0x9c, 0x03, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, - 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x02, 0x69, 0x64, - 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, 0x4e, 0x0a, 0x08, 0x6c, 0x69, 0x66, 0x65, 0x74, 0x69, 0x6d, 0x65, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x32, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, - 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, - 0x6f, 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x2e, 0x54, 0x6f, 0x6b, - 0x65, 0x6e, 0x4c, 0x69, 0x66, 0x65, 0x74, 0x69, 0x6d, 0x65, 0x52, 0x08, 0x6c, 0x69, 0x66, 0x65, - 0x74, 0x69, 0x6d, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, - 0x6b, 0x65, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x73, 0x65, 0x73, 0x73, 0x69, - 0x6f, 0x6e, 0x4b, 0x65, 0x79, 0x12, 0x41, 0x0a, 0x06, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x18, - 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, - 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, - 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x48, 0x00, - 0x52, 0x06, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x4a, 0x0a, 0x09, 0x63, 0x6f, 0x6e, 0x74, - 0x61, 0x69, 0x6e, 0x65, 0x72, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x6e, 0x65, - 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, - 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, - 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x48, 0x00, 0x52, 0x09, 0x63, 0x6f, 0x6e, 0x74, 0x61, - 0x69, 0x6e, 0x65, 0x72, 0x1a, 0x45, 0x0a, 0x0d, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x4c, 0x69, 0x66, - 0x65, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x78, 0x70, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x04, 0x52, 0x03, 0x65, 0x78, 0x70, 0x12, 0x10, 0x0a, 0x03, 0x6e, 0x62, 0x66, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x6e, 0x62, 0x66, 0x12, 0x10, 0x0a, 0x03, 0x69, 0x61, 0x74, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x69, 0x61, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x63, - 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x22, 0x31, 0x0a, 0x07, 0x58, 0x48, 0x65, 0x61, 0x64, 0x65, - 0x72, 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, 0x22, 0x8d, 0x03, 0x0a, 0x11, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 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, 0x14, 0x0a, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x04, 0x52, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x12, 0x10, 0x0a, 0x03, 0x74, 0x74, 0x6c, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x03, 0x74, 0x74, 0x6c, 0x12, 0x37, 0x0a, 0x09, 0x78, 0x5f, - 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, - 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, - 0x6e, 0x2e, 0x58, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x08, 0x78, 0x48, 0x65, 0x61, 0x64, - 0x65, 0x72, 0x73, 0x12, 0x44, 0x0a, 0x0d, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x74, - 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, - 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x53, - 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x0c, 0x73, 0x65, 0x73, - 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x3d, 0x0a, 0x0c, 0x62, 0x65, 0x61, - 0x72, 0x65, 0x72, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x1a, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, - 0x42, 0x65, 0x61, 0x72, 0x65, 0x72, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x0b, 0x62, 0x65, 0x61, - 0x72, 0x65, 0x72, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x3c, 0x0a, 0x06, 0x6f, 0x72, 0x69, 0x67, - 0x69, 0x6e, 0x18, 0x07, 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, 0x06, - 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x12, 0x21, 0x0a, 0x0c, 0x6d, 0x61, 0x67, 0x69, 0x63, 0x5f, - 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x08, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0b, 0x6d, 0x61, - 0x67, 0x69, 0x63, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x22, 0x99, 0x02, 0x0a, 0x12, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 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, 0x14, 0x0a, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x04, 0x52, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x12, 0x10, 0x0a, 0x03, 0x74, 0x74, 0x6c, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x03, 0x74, 0x74, 0x6c, 0x12, 0x37, 0x0a, 0x09, 0x78, - 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, - 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, - 0x6f, 0x6e, 0x2e, 0x58, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x08, 0x78, 0x48, 0x65, 0x61, - 0x64, 0x65, 0x72, 0x73, 0x12, 0x3d, 0x0a, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x18, 0x05, - 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, 0x06, 0x6f, 0x72, 0x69, - 0x67, 0x69, 0x6e, 0x12, 0x30, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x06, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, - 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, - 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0xab, 0x02, 0x0a, 0x19, 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, 0x12, 0x40, 0x0a, 0x0e, 0x62, 0x6f, 0x64, 0x79, 0x5f, 0x73, 0x69, 0x67, 0x6e, - 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, - 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, - 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x0d, 0x62, 0x6f, 0x64, 0x79, 0x53, 0x69, 0x67, 0x6e, - 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x40, 0x0a, 0x0e, 0x6d, 0x65, 0x74, 0x61, 0x5f, 0x73, 0x69, - 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, - 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, - 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x0d, 0x6d, 0x65, 0x74, 0x61, 0x53, 0x69, - 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x44, 0x0a, 0x10, 0x6f, 0x72, 0x69, 0x67, 0x69, - 0x6e, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, - 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x0f, 0x6f, 0x72, - 0x69, 0x67, 0x69, 0x6e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x44, 0x0a, - 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x18, 0x04, 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, 0x06, 0x6f, 0x72, 0x69, - 0x67, 0x69, 0x6e, 0x22, 0xad, 0x02, 0x0a, 0x1a, 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, 0x12, 0x40, 0x0a, 0x0e, 0x62, 0x6f, 0x64, 0x79, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, - 0x74, 0x75, 0x72, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, - 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, - 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x0d, 0x62, 0x6f, 0x64, 0x79, 0x53, 0x69, 0x67, 0x6e, 0x61, - 0x74, 0x75, 0x72, 0x65, 0x12, 0x40, 0x0a, 0x0e, 0x6d, 0x65, 0x74, 0x61, 0x5f, 0x73, 0x69, 0x67, - 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, - 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, - 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x0d, 0x6d, 0x65, 0x74, 0x61, 0x53, 0x69, 0x67, - 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x44, 0x0a, 0x10, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, - 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, - 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x0f, 0x6f, 0x72, 0x69, - 0x67, 0x69, 0x6e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x45, 0x0a, 0x06, - 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x18, 0x04, 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, 0x06, 0x6f, 0x72, 0x69, - 0x67, 0x69, 0x6e, 0x42, 0x64, 0x5a, 0x44, 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, 0x61, 0x70, 0x69, - 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 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, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x33, -} - -var ( - file_session_grpc_types_proto_rawDescOnce sync.Once - file_session_grpc_types_proto_rawDescData = file_session_grpc_types_proto_rawDesc -) - -func file_session_grpc_types_proto_rawDescGZIP() []byte { - file_session_grpc_types_proto_rawDescOnce.Do(func() { - file_session_grpc_types_proto_rawDescData = protoimpl.X.CompressGZIP(file_session_grpc_types_proto_rawDescData) - }) - return file_session_grpc_types_proto_rawDescData -} - -var file_session_grpc_types_proto_enumTypes = make([]protoimpl.EnumInfo, 2) -var file_session_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 11) -var file_session_grpc_types_proto_goTypes = []interface{}{ - (ObjectSessionContext_Verb)(0), // 0: neo.fs.v2.session.ObjectSessionContext.Verb - (ContainerSessionContext_Verb)(0), // 1: neo.fs.v2.session.ContainerSessionContext.Verb - (*ObjectSessionContext)(nil), // 2: neo.fs.v2.session.ObjectSessionContext - (*ContainerSessionContext)(nil), // 3: neo.fs.v2.session.ContainerSessionContext - (*SessionToken)(nil), // 4: neo.fs.v2.session.SessionToken - (*XHeader)(nil), // 5: neo.fs.v2.session.XHeader - (*RequestMetaHeader)(nil), // 6: neo.fs.v2.session.RequestMetaHeader - (*ResponseMetaHeader)(nil), // 7: neo.fs.v2.session.ResponseMetaHeader - (*RequestVerificationHeader)(nil), // 8: neo.fs.v2.session.RequestVerificationHeader - (*ResponseVerificationHeader)(nil), // 9: neo.fs.v2.session.ResponseVerificationHeader - (*ObjectSessionContext_Target)(nil), // 10: neo.fs.v2.session.ObjectSessionContext.Target - (*SessionToken_Body)(nil), // 11: neo.fs.v2.session.SessionToken.Body - (*SessionToken_Body_TokenLifetime)(nil), // 12: neo.fs.v2.session.SessionToken.Body.TokenLifetime - (*grpc.ContainerID)(nil), // 13: neo.fs.v2.refs.ContainerID - (*grpc.Signature)(nil), // 14: neo.fs.v2.refs.Signature - (*grpc.Version)(nil), // 15: neo.fs.v2.refs.Version - (*grpc1.BearerToken)(nil), // 16: neo.fs.v2.acl.BearerToken - (*grpc2.Status)(nil), // 17: neo.fs.v2.status.Status - (*grpc.ObjectID)(nil), // 18: neo.fs.v2.refs.ObjectID - (*grpc.OwnerID)(nil), // 19: neo.fs.v2.refs.OwnerID -} -var file_session_grpc_types_proto_depIdxs = []int32{ - 0, // 0: neo.fs.v2.session.ObjectSessionContext.verb:type_name -> neo.fs.v2.session.ObjectSessionContext.Verb - 10, // 1: neo.fs.v2.session.ObjectSessionContext.target:type_name -> neo.fs.v2.session.ObjectSessionContext.Target - 1, // 2: neo.fs.v2.session.ContainerSessionContext.verb:type_name -> neo.fs.v2.session.ContainerSessionContext.Verb - 13, // 3: neo.fs.v2.session.ContainerSessionContext.container_id:type_name -> neo.fs.v2.refs.ContainerID - 11, // 4: neo.fs.v2.session.SessionToken.body:type_name -> neo.fs.v2.session.SessionToken.Body - 14, // 5: neo.fs.v2.session.SessionToken.signature:type_name -> neo.fs.v2.refs.Signature - 15, // 6: neo.fs.v2.session.RequestMetaHeader.version:type_name -> neo.fs.v2.refs.Version - 5, // 7: neo.fs.v2.session.RequestMetaHeader.x_headers:type_name -> neo.fs.v2.session.XHeader - 4, // 8: neo.fs.v2.session.RequestMetaHeader.session_token:type_name -> neo.fs.v2.session.SessionToken - 16, // 9: neo.fs.v2.session.RequestMetaHeader.bearer_token:type_name -> neo.fs.v2.acl.BearerToken - 6, // 10: neo.fs.v2.session.RequestMetaHeader.origin:type_name -> neo.fs.v2.session.RequestMetaHeader - 15, // 11: neo.fs.v2.session.ResponseMetaHeader.version:type_name -> neo.fs.v2.refs.Version - 5, // 12: neo.fs.v2.session.ResponseMetaHeader.x_headers:type_name -> neo.fs.v2.session.XHeader - 7, // 13: neo.fs.v2.session.ResponseMetaHeader.origin:type_name -> neo.fs.v2.session.ResponseMetaHeader - 17, // 14: neo.fs.v2.session.ResponseMetaHeader.status:type_name -> neo.fs.v2.status.Status - 14, // 15: neo.fs.v2.session.RequestVerificationHeader.body_signature:type_name -> neo.fs.v2.refs.Signature - 14, // 16: neo.fs.v2.session.RequestVerificationHeader.meta_signature:type_name -> neo.fs.v2.refs.Signature - 14, // 17: neo.fs.v2.session.RequestVerificationHeader.origin_signature:type_name -> neo.fs.v2.refs.Signature - 8, // 18: neo.fs.v2.session.RequestVerificationHeader.origin:type_name -> neo.fs.v2.session.RequestVerificationHeader - 14, // 19: neo.fs.v2.session.ResponseVerificationHeader.body_signature:type_name -> neo.fs.v2.refs.Signature - 14, // 20: neo.fs.v2.session.ResponseVerificationHeader.meta_signature:type_name -> neo.fs.v2.refs.Signature - 14, // 21: neo.fs.v2.session.ResponseVerificationHeader.origin_signature:type_name -> neo.fs.v2.refs.Signature - 9, // 22: neo.fs.v2.session.ResponseVerificationHeader.origin:type_name -> neo.fs.v2.session.ResponseVerificationHeader - 13, // 23: neo.fs.v2.session.ObjectSessionContext.Target.container:type_name -> neo.fs.v2.refs.ContainerID - 18, // 24: neo.fs.v2.session.ObjectSessionContext.Target.objects:type_name -> neo.fs.v2.refs.ObjectID - 19, // 25: neo.fs.v2.session.SessionToken.Body.owner_id:type_name -> neo.fs.v2.refs.OwnerID - 12, // 26: neo.fs.v2.session.SessionToken.Body.lifetime:type_name -> neo.fs.v2.session.SessionToken.Body.TokenLifetime - 2, // 27: neo.fs.v2.session.SessionToken.Body.object:type_name -> neo.fs.v2.session.ObjectSessionContext - 3, // 28: neo.fs.v2.session.SessionToken.Body.container:type_name -> neo.fs.v2.session.ContainerSessionContext - 29, // [29:29] is the sub-list for method output_type - 29, // [29:29] is the sub-list for method input_type - 29, // [29:29] is the sub-list for extension type_name - 29, // [29:29] is the sub-list for extension extendee - 0, // [0:29] is the sub-list for field type_name -} - -func init() { file_session_grpc_types_proto_init() } -func file_session_grpc_types_proto_init() { - if File_session_grpc_types_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_session_grpc_types_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ObjectSessionContext); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_session_grpc_types_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ContainerSessionContext); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_session_grpc_types_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SessionToken); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_session_grpc_types_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*XHeader); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_session_grpc_types_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RequestMetaHeader); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_session_grpc_types_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ResponseMetaHeader); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_session_grpc_types_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RequestVerificationHeader); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_session_grpc_types_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ResponseVerificationHeader); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_session_grpc_types_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ObjectSessionContext_Target); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_session_grpc_types_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SessionToken_Body); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_session_grpc_types_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SessionToken_Body_TokenLifetime); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - file_session_grpc_types_proto_msgTypes[9].OneofWrappers = []interface{}{ - (*SessionToken_Body_Object)(nil), - (*SessionToken_Body_Container)(nil), - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_session_grpc_types_proto_rawDesc, - NumEnums: 2, - NumMessages: 11, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_session_grpc_types_proto_goTypes, - DependencyIndexes: file_session_grpc_types_proto_depIdxs, - EnumInfos: file_session_grpc_types_proto_enumTypes, - MessageInfos: file_session_grpc_types_proto_msgTypes, - }.Build() - File_session_grpc_types_proto = out.File - file_session_grpc_types_proto_rawDesc = nil - file_session_grpc_types_proto_goTypes = nil - file_session_grpc_types_proto_depIdxs = nil -} diff --git a/session/grpc/types_frostfs.pb.go b/session/grpc/types_frostfs.pb.go new file mode 100644 index 0000000..6a0d75c --- /dev/null +++ b/session/grpc/types_frostfs.pb.go @@ -0,0 +1,2730 @@ +// Code generated by protoc-gen-go-frostfs. DO NOT EDIT. + +package session + +import ( + json "encoding/json" + fmt "fmt" + grpc1 "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/acl/grpc" + grpc "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc" + grpc2 "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/status/grpc" + pool "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/pool" + proto "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/proto" + encoding "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/proto/encoding" + easyproto "github.com/VictoriaMetrics/easyproto" + jlexer "github.com/mailru/easyjson/jlexer" + jwriter "github.com/mailru/easyjson/jwriter" + strconv "strconv" +) + +type ObjectSessionContext_Verb int32 + +const ( + ObjectSessionContext_VERB_UNSPECIFIED ObjectSessionContext_Verb = 0 + ObjectSessionContext_PUT ObjectSessionContext_Verb = 1 + ObjectSessionContext_GET ObjectSessionContext_Verb = 2 + ObjectSessionContext_HEAD ObjectSessionContext_Verb = 3 + ObjectSessionContext_SEARCH ObjectSessionContext_Verb = 4 + ObjectSessionContext_DELETE ObjectSessionContext_Verb = 5 + ObjectSessionContext_RANGE ObjectSessionContext_Verb = 6 + ObjectSessionContext_RANGEHASH ObjectSessionContext_Verb = 7 + ObjectSessionContext_PATCH ObjectSessionContext_Verb = 8 +) + +var ( + ObjectSessionContext_Verb_name = map[int32]string{ + 0: "VERB_UNSPECIFIED", + 1: "PUT", + 2: "GET", + 3: "HEAD", + 4: "SEARCH", + 5: "DELETE", + 6: "RANGE", + 7: "RANGEHASH", + 8: "PATCH", + } + ObjectSessionContext_Verb_value = map[string]int32{ + "VERB_UNSPECIFIED": 0, + "PUT": 1, + "GET": 2, + "HEAD": 3, + "SEARCH": 4, + "DELETE": 5, + "RANGE": 6, + "RANGEHASH": 7, + "PATCH": 8, + } +) + +func (x ObjectSessionContext_Verb) String() string { + if v, ok := ObjectSessionContext_Verb_name[int32(x)]; ok { + return v + } + return strconv.FormatInt(int64(x), 10) +} +func (x *ObjectSessionContext_Verb) FromString(s string) bool { + if v, ok := ObjectSessionContext_Verb_value[s]; ok { + *x = ObjectSessionContext_Verb(v) + return true + } + return false +} + +type ObjectSessionContext_Target struct { + Container *grpc.ContainerID `json:"container"` + Objects []*grpc.ObjectID `json:"objects"` +} + +var ( + _ encoding.ProtoMarshaler = (*ObjectSessionContext_Target)(nil) + _ encoding.ProtoUnmarshaler = (*ObjectSessionContext_Target)(nil) + _ json.Marshaler = (*ObjectSessionContext_Target)(nil) + _ json.Unmarshaler = (*ObjectSessionContext_Target)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *ObjectSessionContext_Target) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.NestedStructureSize(1, x.Container) + for i := range x.Objects { + size += proto.NestedStructureSize(2, x.Objects[i]) + } + return size +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *ObjectSessionContext_Target) 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 *ObjectSessionContext_Target) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if x.Container != nil && x.Container.StableSize() != 0 { + x.Container.EmitProtobuf(mm.AppendMessage(1)) + } + for i := range x.Objects { + if x.Objects[i] != nil && x.Objects[i].StableSize() != 0 { + x.Objects[i].EmitProtobuf(mm.AppendMessage(2)) + } + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *ObjectSessionContext_Target) 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", "ObjectSessionContext_Target") + } + switch fc.FieldNum { + case 1: // Container + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Container") + } + x.Container = new(grpc.ContainerID) + if err := x.Container.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + case 2: // Objects + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Objects") + } + x.Objects = append(x.Objects, new(grpc.ObjectID)) + ff := x.Objects[len(x.Objects)-1] + if err := ff.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + } + } + return nil +} +func (x *ObjectSessionContext_Target) GetContainer() *grpc.ContainerID { + if x != nil { + return x.Container + } + return nil +} +func (x *ObjectSessionContext_Target) SetContainer(v *grpc.ContainerID) { + x.Container = v +} +func (x *ObjectSessionContext_Target) GetObjects() []*grpc.ObjectID { + if x != nil { + return x.Objects + } + return nil +} +func (x *ObjectSessionContext_Target) SetObjects(v []*grpc.ObjectID) { + x.Objects = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *ObjectSessionContext_Target) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *ObjectSessionContext_Target) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"container\":" + out.RawString(prefix[1:]) + x.Container.MarshalEasyJSON(out) + } + { + const prefix string = ",\"objects\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.Objects { + if i != 0 { + out.RawByte(',') + } + x.Objects[i].MarshalEasyJSON(out) + } + out.RawByte(']') + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *ObjectSessionContext_Target) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *ObjectSessionContext_Target) 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 "container": + { + var f *grpc.ContainerID + f = new(grpc.ContainerID) + f.UnmarshalEasyJSON(in) + x.Container = f + } + case "objects": + { + var f *grpc.ObjectID + var list []*grpc.ObjectID + in.Delim('[') + for !in.IsDelim(']') { + f = new(grpc.ObjectID) + f.UnmarshalEasyJSON(in) + list = append(list, f) + in.WantComma() + } + x.Objects = list + in.Delim(']') + } + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} + +type ObjectSessionContext struct { + Verb ObjectSessionContext_Verb `json:"verb"` + Target *ObjectSessionContext_Target `json:"target"` +} + +var ( + _ encoding.ProtoMarshaler = (*ObjectSessionContext)(nil) + _ encoding.ProtoUnmarshaler = (*ObjectSessionContext)(nil) + _ json.Marshaler = (*ObjectSessionContext)(nil) + _ json.Unmarshaler = (*ObjectSessionContext)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *ObjectSessionContext) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.EnumSize(1, int32(x.Verb)) + size += proto.NestedStructureSize(2, x.Target) + return size +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *ObjectSessionContext) 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 *ObjectSessionContext) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if int32(x.Verb) != 0 { + mm.AppendInt32(1, int32(x.Verb)) + } + if x.Target != nil && x.Target.StableSize() != 0 { + x.Target.EmitProtobuf(mm.AppendMessage(2)) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *ObjectSessionContext) 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", "ObjectSessionContext") + } + switch fc.FieldNum { + case 1: // Verb + data, ok := fc.Int32() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Verb") + } + x.Verb = ObjectSessionContext_Verb(data) + case 2: // Target + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Target") + } + x.Target = new(ObjectSessionContext_Target) + if err := x.Target.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + } + } + return nil +} +func (x *ObjectSessionContext) GetVerb() ObjectSessionContext_Verb { + if x != nil { + return x.Verb + } + return 0 +} +func (x *ObjectSessionContext) SetVerb(v ObjectSessionContext_Verb) { + x.Verb = v +} +func (x *ObjectSessionContext) GetTarget() *ObjectSessionContext_Target { + if x != nil { + return x.Target + } + return nil +} +func (x *ObjectSessionContext) SetTarget(v *ObjectSessionContext_Target) { + x.Target = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *ObjectSessionContext) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *ObjectSessionContext) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"verb\":" + out.RawString(prefix[1:]) + out.Int32(int32(x.Verb)) + } + { + const prefix string = ",\"target\":" + out.RawString(prefix) + x.Target.MarshalEasyJSON(out) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *ObjectSessionContext) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *ObjectSessionContext) 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 "verb": + { + var f ObjectSessionContext_Verb + var parsedValue ObjectSessionContext_Verb + switch v := in.Interface().(type) { + case string: + if vv, ok := ObjectSessionContext_Verb_value[v]; ok { + parsedValue = ObjectSessionContext_Verb(vv) + break + } + vv, err := strconv.ParseInt(v, 10, 32) + if err != nil { + in.AddError(err) + return + } + parsedValue = ObjectSessionContext_Verb(vv) + case float64: + parsedValue = ObjectSessionContext_Verb(v) + } + f = parsedValue + x.Verb = f + } + case "target": + { + var f *ObjectSessionContext_Target + f = new(ObjectSessionContext_Target) + f.UnmarshalEasyJSON(in) + x.Target = f + } + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} + +type ContainerSessionContext_Verb int32 + +const ( + ContainerSessionContext_VERB_UNSPECIFIED ContainerSessionContext_Verb = 0 + ContainerSessionContext_PUT ContainerSessionContext_Verb = 1 + ContainerSessionContext_DELETE ContainerSessionContext_Verb = 2 + ContainerSessionContext_SETEACL ContainerSessionContext_Verb = 3 +) + +var ( + ContainerSessionContext_Verb_name = map[int32]string{ + 0: "VERB_UNSPECIFIED", + 1: "PUT", + 2: "DELETE", + 3: "SETEACL", + } + ContainerSessionContext_Verb_value = map[string]int32{ + "VERB_UNSPECIFIED": 0, + "PUT": 1, + "DELETE": 2, + "SETEACL": 3, + } +) + +func (x ContainerSessionContext_Verb) String() string { + if v, ok := ContainerSessionContext_Verb_name[int32(x)]; ok { + return v + } + return strconv.FormatInt(int64(x), 10) +} +func (x *ContainerSessionContext_Verb) FromString(s string) bool { + if v, ok := ContainerSessionContext_Verb_value[s]; ok { + *x = ContainerSessionContext_Verb(v) + return true + } + return false +} + +type ContainerSessionContext struct { + Verb ContainerSessionContext_Verb `json:"verb"` + Wildcard bool `json:"wildcard"` + ContainerId *grpc.ContainerID `json:"containerID"` +} + +var ( + _ encoding.ProtoMarshaler = (*ContainerSessionContext)(nil) + _ encoding.ProtoUnmarshaler = (*ContainerSessionContext)(nil) + _ json.Marshaler = (*ContainerSessionContext)(nil) + _ json.Unmarshaler = (*ContainerSessionContext)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *ContainerSessionContext) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.EnumSize(1, int32(x.Verb)) + size += proto.BoolSize(2, x.Wildcard) + size += proto.NestedStructureSize(3, x.ContainerId) + return size +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *ContainerSessionContext) 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 *ContainerSessionContext) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if int32(x.Verb) != 0 { + mm.AppendInt32(1, int32(x.Verb)) + } + if x.Wildcard { + mm.AppendBool(2, x.Wildcard) + } + if x.ContainerId != nil && x.ContainerId.StableSize() != 0 { + x.ContainerId.EmitProtobuf(mm.AppendMessage(3)) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *ContainerSessionContext) 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", "ContainerSessionContext") + } + switch fc.FieldNum { + case 1: // Verb + data, ok := fc.Int32() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Verb") + } + x.Verb = ContainerSessionContext_Verb(data) + case 2: // Wildcard + data, ok := fc.Bool() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Wildcard") + } + x.Wildcard = data + case 3: // ContainerId + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "ContainerId") + } + x.ContainerId = new(grpc.ContainerID) + if err := x.ContainerId.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + } + } + return nil +} +func (x *ContainerSessionContext) GetVerb() ContainerSessionContext_Verb { + if x != nil { + return x.Verb + } + return 0 +} +func (x *ContainerSessionContext) SetVerb(v ContainerSessionContext_Verb) { + x.Verb = v +} +func (x *ContainerSessionContext) GetWildcard() bool { + if x != nil { + return x.Wildcard + } + return false +} +func (x *ContainerSessionContext) SetWildcard(v bool) { + x.Wildcard = v +} +func (x *ContainerSessionContext) GetContainerId() *grpc.ContainerID { + if x != nil { + return x.ContainerId + } + return nil +} +func (x *ContainerSessionContext) SetContainerId(v *grpc.ContainerID) { + x.ContainerId = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *ContainerSessionContext) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *ContainerSessionContext) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"verb\":" + out.RawString(prefix[1:]) + out.Int32(int32(x.Verb)) + } + { + const prefix string = ",\"wildcard\":" + out.RawString(prefix) + out.Bool(x.Wildcard) + } + { + const prefix string = ",\"containerID\":" + out.RawString(prefix) + x.ContainerId.MarshalEasyJSON(out) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *ContainerSessionContext) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *ContainerSessionContext) 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 "verb": + { + var f ContainerSessionContext_Verb + var parsedValue ContainerSessionContext_Verb + switch v := in.Interface().(type) { + case string: + if vv, ok := ContainerSessionContext_Verb_value[v]; ok { + parsedValue = ContainerSessionContext_Verb(vv) + break + } + vv, err := strconv.ParseInt(v, 10, 32) + if err != nil { + in.AddError(err) + return + } + parsedValue = ContainerSessionContext_Verb(vv) + case float64: + parsedValue = ContainerSessionContext_Verb(v) + } + f = parsedValue + x.Verb = f + } + case "wildcard": + { + var f bool + f = in.Bool() + x.Wildcard = f + } + case "containerID": + { + var f *grpc.ContainerID + f = new(grpc.ContainerID) + f.UnmarshalEasyJSON(in) + x.ContainerId = f + } + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} + +type SessionToken_Body_TokenLifetime struct { + Exp uint64 `json:"exp"` + Nbf uint64 `json:"nbf"` + Iat uint64 `json:"iat"` +} + +var ( + _ encoding.ProtoMarshaler = (*SessionToken_Body_TokenLifetime)(nil) + _ encoding.ProtoUnmarshaler = (*SessionToken_Body_TokenLifetime)(nil) + _ json.Marshaler = (*SessionToken_Body_TokenLifetime)(nil) + _ json.Unmarshaler = (*SessionToken_Body_TokenLifetime)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *SessionToken_Body_TokenLifetime) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.UInt64Size(1, x.Exp) + size += proto.UInt64Size(2, x.Nbf) + size += proto.UInt64Size(3, x.Iat) + return size +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *SessionToken_Body_TokenLifetime) 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 *SessionToken_Body_TokenLifetime) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if x.Exp != 0 { + mm.AppendUint64(1, x.Exp) + } + if x.Nbf != 0 { + mm.AppendUint64(2, x.Nbf) + } + if x.Iat != 0 { + mm.AppendUint64(3, x.Iat) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *SessionToken_Body_TokenLifetime) 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", "SessionToken_Body_TokenLifetime") + } + switch fc.FieldNum { + case 1: // Exp + data, ok := fc.Uint64() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Exp") + } + x.Exp = data + case 2: // Nbf + data, ok := fc.Uint64() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Nbf") + } + x.Nbf = data + case 3: // Iat + data, ok := fc.Uint64() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Iat") + } + x.Iat = data + } + } + return nil +} +func (x *SessionToken_Body_TokenLifetime) GetExp() uint64 { + if x != nil { + return x.Exp + } + return 0 +} +func (x *SessionToken_Body_TokenLifetime) SetExp(v uint64) { + x.Exp = v +} +func (x *SessionToken_Body_TokenLifetime) GetNbf() uint64 { + if x != nil { + return x.Nbf + } + return 0 +} +func (x *SessionToken_Body_TokenLifetime) SetNbf(v uint64) { + x.Nbf = v +} +func (x *SessionToken_Body_TokenLifetime) GetIat() uint64 { + if x != nil { + return x.Iat + } + return 0 +} +func (x *SessionToken_Body_TokenLifetime) SetIat(v uint64) { + x.Iat = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *SessionToken_Body_TokenLifetime) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *SessionToken_Body_TokenLifetime) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"exp\":" + out.RawString(prefix[1:]) + out.Uint64(x.Exp) + } + { + const prefix string = ",\"nbf\":" + out.RawString(prefix) + out.Uint64(x.Nbf) + } + { + const prefix string = ",\"iat\":" + out.RawString(prefix) + out.Uint64(x.Iat) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *SessionToken_Body_TokenLifetime) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *SessionToken_Body_TokenLifetime) 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 "exp": + { + var f uint64 + f = in.Uint64() + x.Exp = f + } + case "nbf": + { + var f uint64 + f = in.Uint64() + x.Nbf = f + } + case "iat": + { + var f uint64 + f = in.Uint64() + x.Iat = f + } + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} + +type SessionToken_Body struct { + Id []byte `json:"id"` + OwnerId *grpc.OwnerID `json:"ownerID"` + Lifetime *SessionToken_Body_TokenLifetime `json:"lifetime"` + SessionKey []byte `json:"sessionKey"` + Context isSessionToken_Body_Context +} + +var ( + _ encoding.ProtoMarshaler = (*SessionToken_Body)(nil) + _ encoding.ProtoUnmarshaler = (*SessionToken_Body)(nil) + _ json.Marshaler = (*SessionToken_Body)(nil) + _ json.Unmarshaler = (*SessionToken_Body)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *SessionToken_Body) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.BytesSize(1, x.Id) + size += proto.NestedStructureSize(2, x.OwnerId) + size += proto.NestedStructureSize(3, x.Lifetime) + size += proto.BytesSize(4, x.SessionKey) + if inner, ok := x.Context.(*SessionToken_Body_Object); ok { + size += proto.NestedStructureSize(5, inner.Object) + } + if inner, ok := x.Context.(*SessionToken_Body_Container); ok { + size += proto.NestedStructureSize(6, inner.Container) + } + return size +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *SessionToken_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 *SessionToken_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if len(x.Id) != 0 { + mm.AppendBytes(1, x.Id) + } + if x.OwnerId != nil && x.OwnerId.StableSize() != 0 { + x.OwnerId.EmitProtobuf(mm.AppendMessage(2)) + } + if x.Lifetime != nil && x.Lifetime.StableSize() != 0 { + x.Lifetime.EmitProtobuf(mm.AppendMessage(3)) + } + if len(x.SessionKey) != 0 { + mm.AppendBytes(4, x.SessionKey) + } + if inner, ok := x.Context.(*SessionToken_Body_Object); ok { + if inner.Object != nil && inner.Object.StableSize() != 0 { + inner.Object.EmitProtobuf(mm.AppendMessage(5)) + } + } + if inner, ok := x.Context.(*SessionToken_Body_Container); ok { + if inner.Container != nil && inner.Container.StableSize() != 0 { + inner.Container.EmitProtobuf(mm.AppendMessage(6)) + } + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *SessionToken_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", "SessionToken_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: // 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: // Lifetime + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Lifetime") + } + x.Lifetime = new(SessionToken_Body_TokenLifetime) + if err := x.Lifetime.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + case 4: // SessionKey + data, ok := fc.Bytes() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "SessionKey") + } + x.SessionKey = data + case 5: // Object + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Object") + } + oneofField := &SessionToken_Body_Object{Object: new(ObjectSessionContext)} + if err := oneofField.Object.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + x.Context = oneofField + case 6: // Container + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Container") + } + oneofField := &SessionToken_Body_Container{Container: new(ContainerSessionContext)} + if err := oneofField.Container.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + x.Context = oneofField + } + } + return nil +} +func (x *SessionToken_Body) GetId() []byte { + if x != nil { + return x.Id + } + return nil +} +func (x *SessionToken_Body) SetId(v []byte) { + x.Id = v +} +func (x *SessionToken_Body) GetOwnerId() *grpc.OwnerID { + if x != nil { + return x.OwnerId + } + return nil +} +func (x *SessionToken_Body) SetOwnerId(v *grpc.OwnerID) { + x.OwnerId = v +} +func (x *SessionToken_Body) GetLifetime() *SessionToken_Body_TokenLifetime { + if x != nil { + return x.Lifetime + } + return nil +} +func (x *SessionToken_Body) SetLifetime(v *SessionToken_Body_TokenLifetime) { + x.Lifetime = v +} +func (x *SessionToken_Body) GetSessionKey() []byte { + if x != nil { + return x.SessionKey + } + return nil +} +func (x *SessionToken_Body) SetSessionKey(v []byte) { + x.SessionKey = v +} +func (x *SessionToken_Body) GetContext() isSessionToken_Body_Context { + if x != nil { + return x.Context + } + return nil +} +func (x *SessionToken_Body) SetContext(v isSessionToken_Body_Context) { + x.Context = v +} +func (x *SessionToken_Body) GetObject() *ObjectSessionContext { + if xx, ok := x.GetContext().(*SessionToken_Body_Object); ok { + return xx.Object + } + return nil +} +func (x *SessionToken_Body) SetObject(v *ObjectSessionContext) { + x.Context = &SessionToken_Body_Object{Object: v} +} +func (x *SessionToken_Body) GetContainer() *ContainerSessionContext { + if xx, ok := x.GetContext().(*SessionToken_Body_Container); ok { + return xx.Container + } + return nil +} +func (x *SessionToken_Body) SetContainer(v *ContainerSessionContext) { + x.Context = &SessionToken_Body_Container{Container: v} +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *SessionToken_Body) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *SessionToken_Body) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"id\":" + out.RawString(prefix[1:]) + out.Base64Bytes(x.Id) + } + { + const prefix string = ",\"ownerID\":" + out.RawString(prefix) + x.OwnerId.MarshalEasyJSON(out) + } + { + const prefix string = ",\"lifetime\":" + out.RawString(prefix) + x.Lifetime.MarshalEasyJSON(out) + } + { + const prefix string = ",\"sessionKey\":" + out.RawString(prefix) + out.Base64Bytes(x.SessionKey) + } + switch xx := x.Context.(type) { + case *SessionToken_Body_Object: + { + const prefix string = ",\"object\":" + out.RawString(prefix) + xx.Object.MarshalEasyJSON(out) + } + case *SessionToken_Body_Container: + { + const prefix string = ",\"container\":" + out.RawString(prefix) + xx.Container.MarshalEasyJSON(out) + } + default: + out.RawString("null") + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *SessionToken_Body) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *SessionToken_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 + f = in.Bytes() + x.Id = f + } + case "ownerID": + { + var f *grpc.OwnerID + f = new(grpc.OwnerID) + f.UnmarshalEasyJSON(in) + x.OwnerId = f + } + case "lifetime": + { + var f *SessionToken_Body_TokenLifetime + f = new(SessionToken_Body_TokenLifetime) + f.UnmarshalEasyJSON(in) + x.Lifetime = f + } + case "sessionKey": + { + var f []byte + f = in.Bytes() + x.SessionKey = f + } + case "object": + xx := new(SessionToken_Body_Object) + x.Context = xx + { + var f *ObjectSessionContext + f = new(ObjectSessionContext) + f.UnmarshalEasyJSON(in) + xx.Object = f + } + case "container": + xx := new(SessionToken_Body_Container) + x.Context = xx + { + var f *ContainerSessionContext + f = new(ContainerSessionContext) + f.UnmarshalEasyJSON(in) + xx.Container = f + } + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} + +type isSessionToken_Body_Context interface { + isSessionToken_Body_Context() +} + +type SessionToken_Body_Object struct { + Object *ObjectSessionContext +} + +type SessionToken_Body_Container struct { + Container *ContainerSessionContext +} + +func (*SessionToken_Body_Object) isSessionToken_Body_Context() {} + +func (*SessionToken_Body_Container) isSessionToken_Body_Context() {} + +type SessionToken struct { + Body *SessionToken_Body `json:"body"` + Signature *grpc.Signature `json:"signature"` +} + +var ( + _ encoding.ProtoMarshaler = (*SessionToken)(nil) + _ encoding.ProtoUnmarshaler = (*SessionToken)(nil) + _ json.Marshaler = (*SessionToken)(nil) + _ json.Unmarshaler = (*SessionToken)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *SessionToken) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.NestedStructureSize(1, x.Body) + size += proto.NestedStructureSize(2, x.Signature) + return size +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *SessionToken) 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 *SessionToken) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if x.Body != nil && x.Body.StableSize() != 0 { + x.Body.EmitProtobuf(mm.AppendMessage(1)) + } + if x.Signature != nil && x.Signature.StableSize() != 0 { + x.Signature.EmitProtobuf(mm.AppendMessage(2)) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *SessionToken) 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", "SessionToken") + } + switch fc.FieldNum { + case 1: // Body + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Body") + } + x.Body = new(SessionToken_Body) + if err := x.Body.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + case 2: // Signature + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Signature") + } + x.Signature = new(grpc.Signature) + if err := x.Signature.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + } + } + return nil +} +func (x *SessionToken) GetBody() *SessionToken_Body { + if x != nil { + return x.Body + } + return nil +} +func (x *SessionToken) SetBody(v *SessionToken_Body) { + x.Body = v +} +func (x *SessionToken) GetSignature() *grpc.Signature { + if x != nil { + return x.Signature + } + return nil +} +func (x *SessionToken) SetSignature(v *grpc.Signature) { + x.Signature = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *SessionToken) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *SessionToken) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"body\":" + out.RawString(prefix[1:]) + x.Body.MarshalEasyJSON(out) + } + { + const prefix string = ",\"signature\":" + out.RawString(prefix) + x.Signature.MarshalEasyJSON(out) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *SessionToken) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *SessionToken) 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 *SessionToken_Body + f = new(SessionToken_Body) + f.UnmarshalEasyJSON(in) + x.Body = f + } + case "signature": + { + var f *grpc.Signature + f = new(grpc.Signature) + f.UnmarshalEasyJSON(in) + x.Signature = f + } + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} + +type XHeader struct { + Key string `json:"key"` + Value string `json:"value"` +} + +var ( + _ encoding.ProtoMarshaler = (*XHeader)(nil) + _ encoding.ProtoUnmarshaler = (*XHeader)(nil) + _ json.Marshaler = (*XHeader)(nil) + _ json.Unmarshaler = (*XHeader)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *XHeader) 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 *XHeader) 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 *XHeader) 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 *XHeader) 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", "XHeader") + } + 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 *XHeader) GetKey() string { + if x != nil { + return x.Key + } + return "" +} +func (x *XHeader) SetKey(v string) { + x.Key = v +} +func (x *XHeader) GetValue() string { + if x != nil { + return x.Value + } + return "" +} +func (x *XHeader) SetValue(v string) { + x.Value = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *XHeader) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *XHeader) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"key\":" + out.RawString(prefix[1:]) + out.String(x.Key) + } + { + const prefix string = ",\"value\":" + out.RawString(prefix) + out.String(x.Value) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *XHeader) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *XHeader) 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 RequestMetaHeader struct { + Version *grpc.Version `json:"version"` + Epoch uint64 `json:"epoch"` + Ttl uint32 `json:"ttl"` + XHeaders []*XHeader `json:"xHeaders"` + SessionToken *SessionToken `json:"sessionToken"` + BearerToken *grpc1.BearerToken `json:"bearerToken"` + Origin *RequestMetaHeader `json:"origin"` + MagicNumber uint64 `json:"magicNumber"` +} + +var ( + _ encoding.ProtoMarshaler = (*RequestMetaHeader)(nil) + _ encoding.ProtoUnmarshaler = (*RequestMetaHeader)(nil) + _ json.Marshaler = (*RequestMetaHeader)(nil) + _ json.Unmarshaler = (*RequestMetaHeader)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *RequestMetaHeader) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.NestedStructureSize(1, x.Version) + size += proto.UInt64Size(2, x.Epoch) + size += proto.UInt32Size(3, x.Ttl) + for i := range x.XHeaders { + size += proto.NestedStructureSize(4, x.XHeaders[i]) + } + size += proto.NestedStructureSize(5, x.SessionToken) + size += proto.NestedStructureSize(6, x.BearerToken) + size += proto.NestedStructureSize(7, x.Origin) + size += proto.UInt64Size(8, x.MagicNumber) + return size +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *RequestMetaHeader) 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 *RequestMetaHeader) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if x.Version != nil && x.Version.StableSize() != 0 { + x.Version.EmitProtobuf(mm.AppendMessage(1)) + } + if x.Epoch != 0 { + mm.AppendUint64(2, x.Epoch) + } + if x.Ttl != 0 { + mm.AppendUint32(3, x.Ttl) + } + for i := range x.XHeaders { + if x.XHeaders[i] != nil && x.XHeaders[i].StableSize() != 0 { + x.XHeaders[i].EmitProtobuf(mm.AppendMessage(4)) + } + } + if x.SessionToken != nil && x.SessionToken.StableSize() != 0 { + x.SessionToken.EmitProtobuf(mm.AppendMessage(5)) + } + if x.BearerToken != nil && x.BearerToken.StableSize() != 0 { + x.BearerToken.EmitProtobuf(mm.AppendMessage(6)) + } + if x.Origin != nil && x.Origin.StableSize() != 0 { + x.Origin.EmitProtobuf(mm.AppendMessage(7)) + } + if x.MagicNumber != 0 { + mm.AppendUint64(8, x.MagicNumber) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *RequestMetaHeader) 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", "RequestMetaHeader") + } + 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: // Epoch + data, ok := fc.Uint64() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Epoch") + } + x.Epoch = data + case 3: // Ttl + data, ok := fc.Uint32() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Ttl") + } + x.Ttl = data + case 4: // XHeaders + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "XHeaders") + } + x.XHeaders = append(x.XHeaders, new(XHeader)) + ff := x.XHeaders[len(x.XHeaders)-1] + if err := ff.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + case 5: // SessionToken + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "SessionToken") + } + x.SessionToken = new(SessionToken) + if err := x.SessionToken.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + case 6: // BearerToken + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "BearerToken") + } + x.BearerToken = new(grpc1.BearerToken) + if err := x.BearerToken.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + case 7: // Origin + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Origin") + } + x.Origin = new(RequestMetaHeader) + if err := x.Origin.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + case 8: // MagicNumber + data, ok := fc.Uint64() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "MagicNumber") + } + x.MagicNumber = data + } + } + return nil +} +func (x *RequestMetaHeader) GetVersion() *grpc.Version { + if x != nil { + return x.Version + } + return nil +} +func (x *RequestMetaHeader) SetVersion(v *grpc.Version) { + x.Version = v +} +func (x *RequestMetaHeader) GetEpoch() uint64 { + if x != nil { + return x.Epoch + } + return 0 +} +func (x *RequestMetaHeader) SetEpoch(v uint64) { + x.Epoch = v +} +func (x *RequestMetaHeader) GetTtl() uint32 { + if x != nil { + return x.Ttl + } + return 0 +} +func (x *RequestMetaHeader) SetTtl(v uint32) { + x.Ttl = v +} +func (x *RequestMetaHeader) GetXHeaders() []*XHeader { + if x != nil { + return x.XHeaders + } + return nil +} +func (x *RequestMetaHeader) SetXHeaders(v []*XHeader) { + x.XHeaders = v +} +func (x *RequestMetaHeader) GetSessionToken() *SessionToken { + if x != nil { + return x.SessionToken + } + return nil +} +func (x *RequestMetaHeader) SetSessionToken(v *SessionToken) { + x.SessionToken = v +} +func (x *RequestMetaHeader) GetBearerToken() *grpc1.BearerToken { + if x != nil { + return x.BearerToken + } + return nil +} +func (x *RequestMetaHeader) SetBearerToken(v *grpc1.BearerToken) { + x.BearerToken = v +} +func (x *RequestMetaHeader) GetOrigin() *RequestMetaHeader { + if x != nil { + return x.Origin + } + return nil +} +func (x *RequestMetaHeader) SetOrigin(v *RequestMetaHeader) { + x.Origin = v +} +func (x *RequestMetaHeader) GetMagicNumber() uint64 { + if x != nil { + return x.MagicNumber + } + return 0 +} +func (x *RequestMetaHeader) SetMagicNumber(v uint64) { + x.MagicNumber = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *RequestMetaHeader) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *RequestMetaHeader) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"version\":" + out.RawString(prefix[1:]) + x.Version.MarshalEasyJSON(out) + } + { + const prefix string = ",\"epoch\":" + out.RawString(prefix) + out.Uint64(x.Epoch) + } + { + const prefix string = ",\"ttl\":" + out.RawString(prefix) + out.Uint32(x.Ttl) + } + { + const prefix string = ",\"xHeaders\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.XHeaders { + if i != 0 { + out.RawByte(',') + } + x.XHeaders[i].MarshalEasyJSON(out) + } + out.RawByte(']') + } + { + const prefix string = ",\"sessionToken\":" + out.RawString(prefix) + x.SessionToken.MarshalEasyJSON(out) + } + { + const prefix string = ",\"bearerToken\":" + out.RawString(prefix) + x.BearerToken.MarshalEasyJSON(out) + } + { + const prefix string = ",\"origin\":" + out.RawString(prefix) + x.Origin.MarshalEasyJSON(out) + } + { + const prefix string = ",\"magicNumber\":" + out.RawString(prefix) + out.Uint64(x.MagicNumber) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *RequestMetaHeader) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *RequestMetaHeader) 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 "epoch": + { + var f uint64 + f = in.Uint64() + x.Epoch = f + } + case "ttl": + { + var f uint32 + f = in.Uint32() + x.Ttl = f + } + case "xHeaders": + { + var f *XHeader + var list []*XHeader + in.Delim('[') + for !in.IsDelim(']') { + f = new(XHeader) + f.UnmarshalEasyJSON(in) + list = append(list, f) + in.WantComma() + } + x.XHeaders = list + in.Delim(']') + } + case "sessionToken": + { + var f *SessionToken + f = new(SessionToken) + f.UnmarshalEasyJSON(in) + x.SessionToken = f + } + case "bearerToken": + { + var f *grpc1.BearerToken + f = new(grpc1.BearerToken) + f.UnmarshalEasyJSON(in) + x.BearerToken = f + } + case "origin": + { + var f *RequestMetaHeader + f = new(RequestMetaHeader) + f.UnmarshalEasyJSON(in) + x.Origin = f + } + case "magicNumber": + { + var f uint64 + f = in.Uint64() + x.MagicNumber = f + } + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} + +type ResponseMetaHeader struct { + Version *grpc.Version `json:"version"` + Epoch uint64 `json:"epoch"` + Ttl uint32 `json:"ttl"` + XHeaders []*XHeader `json:"xHeaders"` + Origin *ResponseMetaHeader `json:"origin"` + Status *grpc2.Status `json:"status"` +} + +var ( + _ encoding.ProtoMarshaler = (*ResponseMetaHeader)(nil) + _ encoding.ProtoUnmarshaler = (*ResponseMetaHeader)(nil) + _ json.Marshaler = (*ResponseMetaHeader)(nil) + _ json.Unmarshaler = (*ResponseMetaHeader)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *ResponseMetaHeader) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.NestedStructureSize(1, x.Version) + size += proto.UInt64Size(2, x.Epoch) + size += proto.UInt32Size(3, x.Ttl) + for i := range x.XHeaders { + size += proto.NestedStructureSize(4, x.XHeaders[i]) + } + size += proto.NestedStructureSize(5, x.Origin) + size += proto.NestedStructureSize(6, x.Status) + return size +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *ResponseMetaHeader) 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 *ResponseMetaHeader) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if x.Version != nil && x.Version.StableSize() != 0 { + x.Version.EmitProtobuf(mm.AppendMessage(1)) + } + if x.Epoch != 0 { + mm.AppendUint64(2, x.Epoch) + } + if x.Ttl != 0 { + mm.AppendUint32(3, x.Ttl) + } + for i := range x.XHeaders { + if x.XHeaders[i] != nil && x.XHeaders[i].StableSize() != 0 { + x.XHeaders[i].EmitProtobuf(mm.AppendMessage(4)) + } + } + if x.Origin != nil && x.Origin.StableSize() != 0 { + x.Origin.EmitProtobuf(mm.AppendMessage(5)) + } + if x.Status != nil && x.Status.StableSize() != 0 { + x.Status.EmitProtobuf(mm.AppendMessage(6)) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *ResponseMetaHeader) 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", "ResponseMetaHeader") + } + 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: // Epoch + data, ok := fc.Uint64() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Epoch") + } + x.Epoch = data + case 3: // Ttl + data, ok := fc.Uint32() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Ttl") + } + x.Ttl = data + case 4: // XHeaders + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "XHeaders") + } + x.XHeaders = append(x.XHeaders, new(XHeader)) + ff := x.XHeaders[len(x.XHeaders)-1] + if err := ff.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + case 5: // Origin + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Origin") + } + x.Origin = new(ResponseMetaHeader) + if err := x.Origin.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + case 6: // Status + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Status") + } + x.Status = new(grpc2.Status) + if err := x.Status.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + } + } + return nil +} +func (x *ResponseMetaHeader) GetVersion() *grpc.Version { + if x != nil { + return x.Version + } + return nil +} +func (x *ResponseMetaHeader) SetVersion(v *grpc.Version) { + x.Version = v +} +func (x *ResponseMetaHeader) GetEpoch() uint64 { + if x != nil { + return x.Epoch + } + return 0 +} +func (x *ResponseMetaHeader) SetEpoch(v uint64) { + x.Epoch = v +} +func (x *ResponseMetaHeader) GetTtl() uint32 { + if x != nil { + return x.Ttl + } + return 0 +} +func (x *ResponseMetaHeader) SetTtl(v uint32) { + x.Ttl = v +} +func (x *ResponseMetaHeader) GetXHeaders() []*XHeader { + if x != nil { + return x.XHeaders + } + return nil +} +func (x *ResponseMetaHeader) SetXHeaders(v []*XHeader) { + x.XHeaders = v +} +func (x *ResponseMetaHeader) GetOrigin() *ResponseMetaHeader { + if x != nil { + return x.Origin + } + return nil +} +func (x *ResponseMetaHeader) SetOrigin(v *ResponseMetaHeader) { + x.Origin = v +} +func (x *ResponseMetaHeader) GetStatus() *grpc2.Status { + if x != nil { + return x.Status + } + return nil +} +func (x *ResponseMetaHeader) SetStatus(v *grpc2.Status) { + x.Status = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *ResponseMetaHeader) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *ResponseMetaHeader) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"version\":" + out.RawString(prefix[1:]) + x.Version.MarshalEasyJSON(out) + } + { + const prefix string = ",\"epoch\":" + out.RawString(prefix) + out.Uint64(x.Epoch) + } + { + const prefix string = ",\"ttl\":" + out.RawString(prefix) + out.Uint32(x.Ttl) + } + { + const prefix string = ",\"xHeaders\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.XHeaders { + if i != 0 { + out.RawByte(',') + } + x.XHeaders[i].MarshalEasyJSON(out) + } + out.RawByte(']') + } + { + const prefix string = ",\"origin\":" + out.RawString(prefix) + x.Origin.MarshalEasyJSON(out) + } + { + const prefix string = ",\"status\":" + out.RawString(prefix) + x.Status.MarshalEasyJSON(out) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *ResponseMetaHeader) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *ResponseMetaHeader) 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 "epoch": + { + var f uint64 + f = in.Uint64() + x.Epoch = f + } + case "ttl": + { + var f uint32 + f = in.Uint32() + x.Ttl = f + } + case "xHeaders": + { + var f *XHeader + var list []*XHeader + in.Delim('[') + for !in.IsDelim(']') { + f = new(XHeader) + f.UnmarshalEasyJSON(in) + list = append(list, f) + in.WantComma() + } + x.XHeaders = list + in.Delim(']') + } + case "origin": + { + var f *ResponseMetaHeader + f = new(ResponseMetaHeader) + f.UnmarshalEasyJSON(in) + x.Origin = f + } + case "status": + { + var f *grpc2.Status + f = new(grpc2.Status) + f.UnmarshalEasyJSON(in) + x.Status = f + } + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} + +type RequestVerificationHeader struct { + BodySignature *grpc.Signature `json:"bodySignature"` + MetaSignature *grpc.Signature `json:"metaSignature"` + OriginSignature *grpc.Signature `json:"originSignature"` + Origin *RequestVerificationHeader `json:"origin"` +} + +var ( + _ encoding.ProtoMarshaler = (*RequestVerificationHeader)(nil) + _ encoding.ProtoUnmarshaler = (*RequestVerificationHeader)(nil) + _ json.Marshaler = (*RequestVerificationHeader)(nil) + _ json.Unmarshaler = (*RequestVerificationHeader)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *RequestVerificationHeader) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.NestedStructureSize(1, x.BodySignature) + size += proto.NestedStructureSize(2, x.MetaSignature) + size += proto.NestedStructureSize(3, x.OriginSignature) + size += proto.NestedStructureSize(4, x.Origin) + return size +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *RequestVerificationHeader) 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 *RequestVerificationHeader) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if x.BodySignature != nil && x.BodySignature.StableSize() != 0 { + x.BodySignature.EmitProtobuf(mm.AppendMessage(1)) + } + if x.MetaSignature != nil && x.MetaSignature.StableSize() != 0 { + x.MetaSignature.EmitProtobuf(mm.AppendMessage(2)) + } + if x.OriginSignature != nil && x.OriginSignature.StableSize() != 0 { + x.OriginSignature.EmitProtobuf(mm.AppendMessage(3)) + } + if x.Origin != nil && x.Origin.StableSize() != 0 { + x.Origin.EmitProtobuf(mm.AppendMessage(4)) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *RequestVerificationHeader) 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", "RequestVerificationHeader") + } + switch fc.FieldNum { + case 1: // BodySignature + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "BodySignature") + } + x.BodySignature = new(grpc.Signature) + if err := x.BodySignature.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + case 2: // MetaSignature + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "MetaSignature") + } + x.MetaSignature = new(grpc.Signature) + if err := x.MetaSignature.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + case 3: // OriginSignature + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "OriginSignature") + } + x.OriginSignature = new(grpc.Signature) + if err := x.OriginSignature.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + case 4: // Origin + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Origin") + } + x.Origin = new(RequestVerificationHeader) + if err := x.Origin.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + } + } + return nil +} +func (x *RequestVerificationHeader) GetBodySignature() *grpc.Signature { + if x != nil { + return x.BodySignature + } + return nil +} +func (x *RequestVerificationHeader) SetBodySignature(v *grpc.Signature) { + x.BodySignature = v +} +func (x *RequestVerificationHeader) GetMetaSignature() *grpc.Signature { + if x != nil { + return x.MetaSignature + } + return nil +} +func (x *RequestVerificationHeader) SetMetaSignature(v *grpc.Signature) { + x.MetaSignature = v +} +func (x *RequestVerificationHeader) GetOriginSignature() *grpc.Signature { + if x != nil { + return x.OriginSignature + } + return nil +} +func (x *RequestVerificationHeader) SetOriginSignature(v *grpc.Signature) { + x.OriginSignature = v +} +func (x *RequestVerificationHeader) GetOrigin() *RequestVerificationHeader { + if x != nil { + return x.Origin + } + return nil +} +func (x *RequestVerificationHeader) SetOrigin(v *RequestVerificationHeader) { + x.Origin = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *RequestVerificationHeader) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *RequestVerificationHeader) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"bodySignature\":" + out.RawString(prefix[1:]) + x.BodySignature.MarshalEasyJSON(out) + } + { + const prefix string = ",\"metaSignature\":" + out.RawString(prefix) + x.MetaSignature.MarshalEasyJSON(out) + } + { + const prefix string = ",\"originSignature\":" + out.RawString(prefix) + x.OriginSignature.MarshalEasyJSON(out) + } + { + const prefix string = ",\"origin\":" + out.RawString(prefix) + x.Origin.MarshalEasyJSON(out) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *RequestVerificationHeader) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *RequestVerificationHeader) 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 "bodySignature": + { + var f *grpc.Signature + f = new(grpc.Signature) + f.UnmarshalEasyJSON(in) + x.BodySignature = f + } + case "metaSignature": + { + var f *grpc.Signature + f = new(grpc.Signature) + f.UnmarshalEasyJSON(in) + x.MetaSignature = f + } + case "originSignature": + { + var f *grpc.Signature + f = new(grpc.Signature) + f.UnmarshalEasyJSON(in) + x.OriginSignature = f + } + case "origin": + { + var f *RequestVerificationHeader + f = new(RequestVerificationHeader) + f.UnmarshalEasyJSON(in) + x.Origin = f + } + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} + +type ResponseVerificationHeader struct { + BodySignature *grpc.Signature `json:"bodySignature"` + MetaSignature *grpc.Signature `json:"metaSignature"` + OriginSignature *grpc.Signature `json:"originSignature"` + Origin *ResponseVerificationHeader `json:"origin"` +} + +var ( + _ encoding.ProtoMarshaler = (*ResponseVerificationHeader)(nil) + _ encoding.ProtoUnmarshaler = (*ResponseVerificationHeader)(nil) + _ json.Marshaler = (*ResponseVerificationHeader)(nil) + _ json.Unmarshaler = (*ResponseVerificationHeader)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *ResponseVerificationHeader) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.NestedStructureSize(1, x.BodySignature) + size += proto.NestedStructureSize(2, x.MetaSignature) + size += proto.NestedStructureSize(3, x.OriginSignature) + size += proto.NestedStructureSize(4, x.Origin) + return size +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *ResponseVerificationHeader) 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 *ResponseVerificationHeader) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if x.BodySignature != nil && x.BodySignature.StableSize() != 0 { + x.BodySignature.EmitProtobuf(mm.AppendMessage(1)) + } + if x.MetaSignature != nil && x.MetaSignature.StableSize() != 0 { + x.MetaSignature.EmitProtobuf(mm.AppendMessage(2)) + } + if x.OriginSignature != nil && x.OriginSignature.StableSize() != 0 { + x.OriginSignature.EmitProtobuf(mm.AppendMessage(3)) + } + if x.Origin != nil && x.Origin.StableSize() != 0 { + x.Origin.EmitProtobuf(mm.AppendMessage(4)) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *ResponseVerificationHeader) 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", "ResponseVerificationHeader") + } + switch fc.FieldNum { + case 1: // BodySignature + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "BodySignature") + } + x.BodySignature = new(grpc.Signature) + if err := x.BodySignature.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + case 2: // MetaSignature + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "MetaSignature") + } + x.MetaSignature = new(grpc.Signature) + if err := x.MetaSignature.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + case 3: // OriginSignature + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "OriginSignature") + } + x.OriginSignature = new(grpc.Signature) + if err := x.OriginSignature.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + case 4: // Origin + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Origin") + } + x.Origin = new(ResponseVerificationHeader) + if err := x.Origin.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + } + } + return nil +} +func (x *ResponseVerificationHeader) GetBodySignature() *grpc.Signature { + if x != nil { + return x.BodySignature + } + return nil +} +func (x *ResponseVerificationHeader) SetBodySignature(v *grpc.Signature) { + x.BodySignature = v +} +func (x *ResponseVerificationHeader) GetMetaSignature() *grpc.Signature { + if x != nil { + return x.MetaSignature + } + return nil +} +func (x *ResponseVerificationHeader) SetMetaSignature(v *grpc.Signature) { + x.MetaSignature = v +} +func (x *ResponseVerificationHeader) GetOriginSignature() *grpc.Signature { + if x != nil { + return x.OriginSignature + } + return nil +} +func (x *ResponseVerificationHeader) SetOriginSignature(v *grpc.Signature) { + x.OriginSignature = v +} +func (x *ResponseVerificationHeader) GetOrigin() *ResponseVerificationHeader { + if x != nil { + return x.Origin + } + return nil +} +func (x *ResponseVerificationHeader) SetOrigin(v *ResponseVerificationHeader) { + x.Origin = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *ResponseVerificationHeader) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *ResponseVerificationHeader) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"bodySignature\":" + out.RawString(prefix[1:]) + x.BodySignature.MarshalEasyJSON(out) + } + { + const prefix string = ",\"metaSignature\":" + out.RawString(prefix) + x.MetaSignature.MarshalEasyJSON(out) + } + { + const prefix string = ",\"originSignature\":" + out.RawString(prefix) + x.OriginSignature.MarshalEasyJSON(out) + } + { + const prefix string = ",\"origin\":" + out.RawString(prefix) + x.Origin.MarshalEasyJSON(out) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *ResponseVerificationHeader) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *ResponseVerificationHeader) 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 "bodySignature": + { + var f *grpc.Signature + f = new(grpc.Signature) + f.UnmarshalEasyJSON(in) + x.BodySignature = f + } + case "metaSignature": + { + var f *grpc.Signature + f = new(grpc.Signature) + f.UnmarshalEasyJSON(in) + x.MetaSignature = f + } + case "originSignature": + { + var f *grpc.Signature + f = new(grpc.Signature) + f.UnmarshalEasyJSON(in) + x.OriginSignature = f + } + case "origin": + { + var f *ResponseVerificationHeader + f = new(ResponseVerificationHeader) + f.UnmarshalEasyJSON(in) + x.Origin = f + } + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} diff --git a/session/grpc/types_frostfs_fuzz.go b/session/grpc/types_frostfs_fuzz.go new file mode 100644 index 0000000..fae4a05 --- /dev/null +++ b/session/grpc/types_frostfs_fuzz.go @@ -0,0 +1,159 @@ +//go:build gofuzz +// +build gofuzz + +// Code generated by protoc-gen-go-frostfs. DO NOT EDIT. + +package session + +func DoFuzzProtoObjectSessionContext(data []byte) int { + msg := new(ObjectSessionContext) + if err := msg.UnmarshalProtobuf(data); err != nil { + return 0 + } + _ = msg.MarshalProtobuf(nil) + return 1 +} +func DoFuzzJSONObjectSessionContext(data []byte) int { + msg := new(ObjectSessionContext) + if err := msg.UnmarshalJSON(data); err != nil { + return 0 + } + _, err := msg.MarshalJSON() + if err != nil { + panic(err) + } + return 1 +} +func DoFuzzProtoContainerSessionContext(data []byte) int { + msg := new(ContainerSessionContext) + if err := msg.UnmarshalProtobuf(data); err != nil { + return 0 + } + _ = msg.MarshalProtobuf(nil) + return 1 +} +func DoFuzzJSONContainerSessionContext(data []byte) int { + msg := new(ContainerSessionContext) + if err := msg.UnmarshalJSON(data); err != nil { + return 0 + } + _, err := msg.MarshalJSON() + if err != nil { + panic(err) + } + return 1 +} +func DoFuzzProtoSessionToken(data []byte) int { + msg := new(SessionToken) + if err := msg.UnmarshalProtobuf(data); err != nil { + return 0 + } + _ = msg.MarshalProtobuf(nil) + return 1 +} +func DoFuzzJSONSessionToken(data []byte) int { + msg := new(SessionToken) + if err := msg.UnmarshalJSON(data); err != nil { + return 0 + } + _, err := msg.MarshalJSON() + if err != nil { + panic(err) + } + return 1 +} +func DoFuzzProtoXHeader(data []byte) int { + msg := new(XHeader) + if err := msg.UnmarshalProtobuf(data); err != nil { + return 0 + } + _ = msg.MarshalProtobuf(nil) + return 1 +} +func DoFuzzJSONXHeader(data []byte) int { + msg := new(XHeader) + if err := msg.UnmarshalJSON(data); err != nil { + return 0 + } + _, err := msg.MarshalJSON() + if err != nil { + panic(err) + } + return 1 +} +func DoFuzzProtoRequestMetaHeader(data []byte) int { + msg := new(RequestMetaHeader) + if err := msg.UnmarshalProtobuf(data); err != nil { + return 0 + } + _ = msg.MarshalProtobuf(nil) + return 1 +} +func DoFuzzJSONRequestMetaHeader(data []byte) int { + msg := new(RequestMetaHeader) + if err := msg.UnmarshalJSON(data); err != nil { + return 0 + } + _, err := msg.MarshalJSON() + if err != nil { + panic(err) + } + return 1 +} +func DoFuzzProtoResponseMetaHeader(data []byte) int { + msg := new(ResponseMetaHeader) + if err := msg.UnmarshalProtobuf(data); err != nil { + return 0 + } + _ = msg.MarshalProtobuf(nil) + return 1 +} +func DoFuzzJSONResponseMetaHeader(data []byte) int { + msg := new(ResponseMetaHeader) + if err := msg.UnmarshalJSON(data); err != nil { + return 0 + } + _, err := msg.MarshalJSON() + if err != nil { + panic(err) + } + return 1 +} +func DoFuzzProtoRequestVerificationHeader(data []byte) int { + msg := new(RequestVerificationHeader) + if err := msg.UnmarshalProtobuf(data); err != nil { + return 0 + } + _ = msg.MarshalProtobuf(nil) + return 1 +} +func DoFuzzJSONRequestVerificationHeader(data []byte) int { + msg := new(RequestVerificationHeader) + if err := msg.UnmarshalJSON(data); err != nil { + return 0 + } + _, err := msg.MarshalJSON() + if err != nil { + panic(err) + } + return 1 +} +func DoFuzzProtoResponseVerificationHeader(data []byte) int { + msg := new(ResponseVerificationHeader) + if err := msg.UnmarshalProtobuf(data); err != nil { + return 0 + } + _ = msg.MarshalProtobuf(nil) + return 1 +} +func DoFuzzJSONResponseVerificationHeader(data []byte) int { + msg := new(ResponseVerificationHeader) + if err := msg.UnmarshalJSON(data); err != nil { + return 0 + } + _, err := msg.MarshalJSON() + if err != nil { + panic(err) + } + return 1 +} diff --git a/session/grpc/types_frostfs_test.go b/session/grpc/types_frostfs_test.go new file mode 100644 index 0000000..5c9b6c2 --- /dev/null +++ b/session/grpc/types_frostfs_test.go @@ -0,0 +1,91 @@ +//go:build gofuzz +// +build gofuzz + +// Code generated by protoc-gen-go-frostfs. DO NOT EDIT. + +package session + +import ( + testing "testing" +) + +func FuzzProtoObjectSessionContext(f *testing.F) { + f.Fuzz(func(t *testing.T, data []byte) { + DoFuzzProtoObjectSessionContext(data) + }) +} +func FuzzJSONObjectSessionContext(f *testing.F) { + f.Fuzz(func(t *testing.T, data []byte) { + DoFuzzJSONObjectSessionContext(data) + }) +} +func FuzzProtoContainerSessionContext(f *testing.F) { + f.Fuzz(func(t *testing.T, data []byte) { + DoFuzzProtoContainerSessionContext(data) + }) +} +func FuzzJSONContainerSessionContext(f *testing.F) { + f.Fuzz(func(t *testing.T, data []byte) { + DoFuzzJSONContainerSessionContext(data) + }) +} +func FuzzProtoSessionToken(f *testing.F) { + f.Fuzz(func(t *testing.T, data []byte) { + DoFuzzProtoSessionToken(data) + }) +} +func FuzzJSONSessionToken(f *testing.F) { + f.Fuzz(func(t *testing.T, data []byte) { + DoFuzzJSONSessionToken(data) + }) +} +func FuzzProtoXHeader(f *testing.F) { + f.Fuzz(func(t *testing.T, data []byte) { + DoFuzzProtoXHeader(data) + }) +} +func FuzzJSONXHeader(f *testing.F) { + f.Fuzz(func(t *testing.T, data []byte) { + DoFuzzJSONXHeader(data) + }) +} +func FuzzProtoRequestMetaHeader(f *testing.F) { + f.Fuzz(func(t *testing.T, data []byte) { + DoFuzzProtoRequestMetaHeader(data) + }) +} +func FuzzJSONRequestMetaHeader(f *testing.F) { + f.Fuzz(func(t *testing.T, data []byte) { + DoFuzzJSONRequestMetaHeader(data) + }) +} +func FuzzProtoResponseMetaHeader(f *testing.F) { + f.Fuzz(func(t *testing.T, data []byte) { + DoFuzzProtoResponseMetaHeader(data) + }) +} +func FuzzJSONResponseMetaHeader(f *testing.F) { + f.Fuzz(func(t *testing.T, data []byte) { + DoFuzzJSONResponseMetaHeader(data) + }) +} +func FuzzProtoRequestVerificationHeader(f *testing.F) { + f.Fuzz(func(t *testing.T, data []byte) { + DoFuzzProtoRequestVerificationHeader(data) + }) +} +func FuzzJSONRequestVerificationHeader(f *testing.F) { + f.Fuzz(func(t *testing.T, data []byte) { + DoFuzzJSONRequestVerificationHeader(data) + }) +} +func FuzzProtoResponseVerificationHeader(f *testing.F) { + f.Fuzz(func(t *testing.T, data []byte) { + DoFuzzProtoResponseVerificationHeader(data) + }) +} +func FuzzJSONResponseVerificationHeader(f *testing.F) { + f.Fuzz(func(t *testing.T, data []byte) { + DoFuzzJSONResponseVerificationHeader(data) + }) +} diff --git a/status/grpc/types.go b/status/grpc/types.go deleted file mode 100644 index 993f632..0000000 --- a/status/grpc/types.go +++ /dev/null @@ -1,26 +0,0 @@ -package status - -// SetId sets identifier of the Status_Detail. -func (x *Status_Detail) SetId(v uint32) { - x.Id = v -} - -// SetValue sets value of the Status_Detail. -func (x *Status_Detail) SetValue(v []byte) { - x.Value = v -} - -// SetCode sets code of the Status. -func (x *Status) SetCode(v uint32) { - x.Code = v -} - -// SetMessage sets message about the Status. -func (x *Status) SetMessage(v string) { - x.Message = v -} - -// SetDetails sets details of the Status. -func (x *Status) SetDetails(v []*Status_Detail) { - x.Details = v -} diff --git a/status/grpc/types.pb.go b/status/grpc/types.pb.go deleted file mode 100644 index b6b081b..0000000 --- a/status/grpc/types.pb.go +++ /dev/null @@ -1,721 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.33.0 -// protoc v5.27.2 -// source: status/grpc/types.proto - -package status - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -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) -) - -// Section identifiers. -type Section int32 - -const ( - // Successful return codes. - Section_SECTION_SUCCESS Section = 0 - // Failure codes regardless of the operation. - Section_SECTION_FAILURE_COMMON Section = 1 - // Object service-specific errors. - Section_SECTION_OBJECT Section = 2 - // Container service-specific errors. - Section_SECTION_CONTAINER Section = 3 - // Session service-specific errors. - Section_SECTION_SESSION Section = 4 - // Session service-specific errors. - Section_SECTION_APE_MANAGER Section = 5 -) - -// Enum value maps for Section. -var ( - Section_name = map[int32]string{ - 0: "SECTION_SUCCESS", - 1: "SECTION_FAILURE_COMMON", - 2: "SECTION_OBJECT", - 3: "SECTION_CONTAINER", - 4: "SECTION_SESSION", - 5: "SECTION_APE_MANAGER", - } - Section_value = map[string]int32{ - "SECTION_SUCCESS": 0, - "SECTION_FAILURE_COMMON": 1, - "SECTION_OBJECT": 2, - "SECTION_CONTAINER": 3, - "SECTION_SESSION": 4, - "SECTION_APE_MANAGER": 5, - } -) - -func (x Section) Enum() *Section { - p := new(Section) - *p = x - return p -} - -func (x Section) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (Section) Descriptor() protoreflect.EnumDescriptor { - return file_status_grpc_types_proto_enumTypes[0].Descriptor() -} - -func (Section) Type() protoreflect.EnumType { - return &file_status_grpc_types_proto_enumTypes[0] -} - -func (x Section) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use Section.Descriptor instead. -func (Section) EnumDescriptor() ([]byte, []int) { - return file_status_grpc_types_proto_rawDescGZIP(), []int{0} -} - -// Section of NeoFS successful return codes. -type Success int32 - -const ( - // [**0**] Default success. Not detailed. - // If the server cannot match successful outcome to the code, it should - // use this code. - Success_OK Success = 0 -) - -// Enum value maps for Success. -var ( - Success_name = map[int32]string{ - 0: "OK", - } - Success_value = map[string]int32{ - "OK": 0, - } -) - -func (x Success) Enum() *Success { - p := new(Success) - *p = x - return p -} - -func (x Success) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (Success) Descriptor() protoreflect.EnumDescriptor { - return file_status_grpc_types_proto_enumTypes[1].Descriptor() -} - -func (Success) Type() protoreflect.EnumType { - return &file_status_grpc_types_proto_enumTypes[1] -} - -func (x Success) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use Success.Descriptor instead. -func (Success) EnumDescriptor() ([]byte, []int) { - return file_status_grpc_types_proto_rawDescGZIP(), []int{1} -} - -// Section of failed statuses independent of the operation. -type CommonFail int32 - -const ( - // [**1024**] Internal server error, default failure. Not detailed. - // If the server cannot match failed outcome to the code, it should - // use this code. - CommonFail_INTERNAL CommonFail = 0 - // [**1025**] Wrong magic of the NeoFS network. - // Details: - // - [**0**] Magic number of the served NeoFS network (big-endian 64-bit - // unsigned integer). - CommonFail_WRONG_MAGIC_NUMBER CommonFail = 1 - // [**1026**] Signature verification failure. - CommonFail_SIGNATURE_VERIFICATION_FAIL CommonFail = 2 - // [**1027**] Node is under maintenance. - CommonFail_NODE_UNDER_MAINTENANCE CommonFail = 3 - // [**1028**] Invalid argument error. If the server fails on validation of a - // request parameter as the client sent it incorrectly, then this code should - // be used. - CommonFail_INVALID_ARGUMENT CommonFail = 4 -) - -// Enum value maps for CommonFail. -var ( - CommonFail_name = map[int32]string{ - 0: "INTERNAL", - 1: "WRONG_MAGIC_NUMBER", - 2: "SIGNATURE_VERIFICATION_FAIL", - 3: "NODE_UNDER_MAINTENANCE", - 4: "INVALID_ARGUMENT", - } - CommonFail_value = map[string]int32{ - "INTERNAL": 0, - "WRONG_MAGIC_NUMBER": 1, - "SIGNATURE_VERIFICATION_FAIL": 2, - "NODE_UNDER_MAINTENANCE": 3, - "INVALID_ARGUMENT": 4, - } -) - -func (x CommonFail) Enum() *CommonFail { - p := new(CommonFail) - *p = x - return p -} - -func (x CommonFail) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (CommonFail) Descriptor() protoreflect.EnumDescriptor { - return file_status_grpc_types_proto_enumTypes[2].Descriptor() -} - -func (CommonFail) Type() protoreflect.EnumType { - return &file_status_grpc_types_proto_enumTypes[2] -} - -func (x CommonFail) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use CommonFail.Descriptor instead. -func (CommonFail) EnumDescriptor() ([]byte, []int) { - return file_status_grpc_types_proto_rawDescGZIP(), []int{2} -} - -// Section of statuses for object-related operations. -type Object int32 - -const ( - // [**2048**] Access denied by ACL. - // Details: - // - [**0**] Human-readable description (UTF-8 encoded string). - Object_ACCESS_DENIED Object = 0 - // [**2049**] Object not found. - Object_OBJECT_NOT_FOUND Object = 1 - // [**2050**] Operation rejected by the object lock. - Object_LOCKED Object = 2 - // [**2051**] Locking an object with a non-REGULAR type rejected. - Object_LOCK_NON_REGULAR_OBJECT Object = 3 - // [**2052**] Object has been marked deleted. - Object_OBJECT_ALREADY_REMOVED Object = 4 - // [**2053**] Invalid range has been requested for an object. - Object_OUT_OF_RANGE Object = 5 -) - -// Enum value maps for Object. -var ( - Object_name = map[int32]string{ - 0: "ACCESS_DENIED", - 1: "OBJECT_NOT_FOUND", - 2: "LOCKED", - 3: "LOCK_NON_REGULAR_OBJECT", - 4: "OBJECT_ALREADY_REMOVED", - 5: "OUT_OF_RANGE", - } - Object_value = map[string]int32{ - "ACCESS_DENIED": 0, - "OBJECT_NOT_FOUND": 1, - "LOCKED": 2, - "LOCK_NON_REGULAR_OBJECT": 3, - "OBJECT_ALREADY_REMOVED": 4, - "OUT_OF_RANGE": 5, - } -) - -func (x Object) Enum() *Object { - p := new(Object) - *p = x - return p -} - -func (x Object) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (Object) Descriptor() protoreflect.EnumDescriptor { - return file_status_grpc_types_proto_enumTypes[3].Descriptor() -} - -func (Object) Type() protoreflect.EnumType { - return &file_status_grpc_types_proto_enumTypes[3] -} - -func (x Object) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use Object.Descriptor instead. -func (Object) EnumDescriptor() ([]byte, []int) { - return file_status_grpc_types_proto_rawDescGZIP(), []int{3} -} - -// Section of statuses for container-related operations. -type Container int32 - -const ( - // [**3072**] Container not found. - Container_CONTAINER_NOT_FOUND Container = 0 - // [**3073**] eACL table not found. - Container_EACL_NOT_FOUND Container = 1 - // [**3074**] Container access denied. - Container_CONTAINER_ACCESS_DENIED Container = 2 -) - -// Enum value maps for Container. -var ( - Container_name = map[int32]string{ - 0: "CONTAINER_NOT_FOUND", - 1: "EACL_NOT_FOUND", - 2: "CONTAINER_ACCESS_DENIED", - } - Container_value = map[string]int32{ - "CONTAINER_NOT_FOUND": 0, - "EACL_NOT_FOUND": 1, - "CONTAINER_ACCESS_DENIED": 2, - } -) - -func (x Container) Enum() *Container { - p := new(Container) - *p = x - return p -} - -func (x Container) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (Container) Descriptor() protoreflect.EnumDescriptor { - return file_status_grpc_types_proto_enumTypes[4].Descriptor() -} - -func (Container) Type() protoreflect.EnumType { - return &file_status_grpc_types_proto_enumTypes[4] -} - -func (x Container) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use Container.Descriptor instead. -func (Container) EnumDescriptor() ([]byte, []int) { - return file_status_grpc_types_proto_rawDescGZIP(), []int{4} -} - -// Section of statuses for session-related operations. -type Session int32 - -const ( - // [**4096**] Token not found. - Session_TOKEN_NOT_FOUND Session = 0 - // [**4097**] Token has expired. - Session_TOKEN_EXPIRED Session = 1 -) - -// Enum value maps for Session. -var ( - Session_name = map[int32]string{ - 0: "TOKEN_NOT_FOUND", - 1: "TOKEN_EXPIRED", - } - Session_value = map[string]int32{ - "TOKEN_NOT_FOUND": 0, - "TOKEN_EXPIRED": 1, - } -) - -func (x Session) Enum() *Session { - p := new(Session) - *p = x - return p -} - -func (x Session) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (Session) Descriptor() protoreflect.EnumDescriptor { - return file_status_grpc_types_proto_enumTypes[5].Descriptor() -} - -func (Session) Type() protoreflect.EnumType { - return &file_status_grpc_types_proto_enumTypes[5] -} - -func (x Session) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use Session.Descriptor instead. -func (Session) EnumDescriptor() ([]byte, []int) { - return file_status_grpc_types_proto_rawDescGZIP(), []int{5} -} - -// Section of status for APE manager related operations. -type APEManager int32 - -const ( - // [**5120**] The operation is denied by APE manager. - APEManager_APE_MANAGER_ACCESS_DENIED APEManager = 0 -) - -// Enum value maps for APEManager. -var ( - APEManager_name = map[int32]string{ - 0: "APE_MANAGER_ACCESS_DENIED", - } - APEManager_value = map[string]int32{ - "APE_MANAGER_ACCESS_DENIED": 0, - } -) - -func (x APEManager) Enum() *APEManager { - p := new(APEManager) - *p = x - return p -} - -func (x APEManager) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (APEManager) Descriptor() protoreflect.EnumDescriptor { - return file_status_grpc_types_proto_enumTypes[6].Descriptor() -} - -func (APEManager) Type() protoreflect.EnumType { - return &file_status_grpc_types_proto_enumTypes[6] -} - -func (x APEManager) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use APEManager.Descriptor instead. -func (APEManager) EnumDescriptor() ([]byte, []int) { - return file_status_grpc_types_proto_rawDescGZIP(), []int{6} -} - -// Declares the general format of the status returns of the NeoFS RPC protocol. -// Status is present in all response messages. Each RPC of NeoFS protocol -// describes the possible outcomes and details of the operation. -// -// Each status is assigned a one-to-one numeric code. Any unique result of an -// operation in NeoFS is unambiguously associated with the code value. -// -// Numerical set of codes is split into 1024-element sections. An enumeration -// is defined for each section. Values can be referred to in the following ways: -// -// * numerical value ranging from 0 to 4,294,967,295 (global code); -// -// - values from enumeration (local code). The formula for the ratio of the -// local code (`L`) of a defined section (`S`) to the global one (`G`): -// `G = 1024 * S + L`. -// -// All outcomes are divided into successful and failed, which corresponds -// to the success or failure of the operation. The definition of success -// follows the semantics of RPC and the description of its purpose. -// The server must not attach code that is the opposite of the outcome type. -// -// See the set of return codes in the description for calls. -// -// Each status can carry a developer-facing error message. It should be a human -// readable text in English. The server should not transmit (and the client -// should not expect) useful information in the message. Field `details` -// should make the return more detailed. -type Status struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The status code - Code uint32 `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"` - // Developer-facing error message - Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` - // Data detailing the outcome of the operation. Must be unique by ID. - Details []*Status_Detail `protobuf:"bytes,3,rep,name=details,proto3" json:"details,omitempty"` -} - -func (x *Status) Reset() { - *x = Status{} - if protoimpl.UnsafeEnabled { - mi := &file_status_grpc_types_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Status) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Status) ProtoMessage() {} - -func (x *Status) ProtoReflect() protoreflect.Message { - mi := &file_status_grpc_types_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Status.ProtoReflect.Descriptor instead. -func (*Status) Descriptor() ([]byte, []int) { - return file_status_grpc_types_proto_rawDescGZIP(), []int{0} -} - -func (x *Status) GetCode() uint32 { - if x != nil { - return x.Code - } - return 0 -} - -func (x *Status) GetMessage() string { - if x != nil { - return x.Message - } - return "" -} - -func (x *Status) GetDetails() []*Status_Detail { - if x != nil { - return x.Details - } - return nil -} - -// Return detail. It contains additional information that can be used to -// analyze the response. Each code defines a set of details that can be -// attached to a status. Client should not handle details that are not -// covered by the code. -type Status_Detail struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Detail ID. The identifier is required to determine the binary format - // of the detail and how to decode it. - Id uint32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` - // Binary status detail. Must follow the format associated with ID. - // The possibility of missing a value must be explicitly allowed. - Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` -} - -func (x *Status_Detail) Reset() { - *x = Status_Detail{} - if protoimpl.UnsafeEnabled { - mi := &file_status_grpc_types_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Status_Detail) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Status_Detail) ProtoMessage() {} - -func (x *Status_Detail) ProtoReflect() protoreflect.Message { - mi := &file_status_grpc_types_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Status_Detail.ProtoReflect.Descriptor instead. -func (*Status_Detail) Descriptor() ([]byte, []int) { - return file_status_grpc_types_proto_rawDescGZIP(), []int{0, 0} -} - -func (x *Status_Detail) GetId() uint32 { - if x != nil { - return x.Id - } - return 0 -} - -func (x *Status_Detail) GetValue() []byte { - if x != nil { - return x.Value - } - return nil -} - -var File_status_grpc_types_proto protoreflect.FileDescriptor - -var file_status_grpc_types_proto_rawDesc = []byte{ - 0x0a, 0x17, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, - 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x10, 0x6e, 0x65, 0x6f, 0x2e, 0x66, - 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0xa1, 0x01, 0x0a, 0x06, - 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0d, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, - 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, - 0x73, 0x61, 0x67, 0x65, 0x12, 0x39, 0x0a, 0x07, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x18, - 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, - 0x32, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, - 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x07, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x1a, - 0x2e, 0x0a, 0x06, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x02, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x2a, - 0x93, 0x01, 0x0a, 0x07, 0x53, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x13, 0x0a, 0x0f, 0x53, - 0x45, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x53, 0x55, 0x43, 0x43, 0x45, 0x53, 0x53, 0x10, 0x00, - 0x12, 0x1a, 0x0a, 0x16, 0x53, 0x45, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x46, 0x41, 0x49, 0x4c, - 0x55, 0x52, 0x45, 0x5f, 0x43, 0x4f, 0x4d, 0x4d, 0x4f, 0x4e, 0x10, 0x01, 0x12, 0x12, 0x0a, 0x0e, - 0x53, 0x45, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x4f, 0x42, 0x4a, 0x45, 0x43, 0x54, 0x10, 0x02, - 0x12, 0x15, 0x0a, 0x11, 0x53, 0x45, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x43, 0x4f, 0x4e, 0x54, - 0x41, 0x49, 0x4e, 0x45, 0x52, 0x10, 0x03, 0x12, 0x13, 0x0a, 0x0f, 0x53, 0x45, 0x43, 0x54, 0x49, - 0x4f, 0x4e, 0x5f, 0x53, 0x45, 0x53, 0x53, 0x49, 0x4f, 0x4e, 0x10, 0x04, 0x12, 0x17, 0x0a, 0x13, - 0x53, 0x45, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x41, 0x50, 0x45, 0x5f, 0x4d, 0x41, 0x4e, 0x41, - 0x47, 0x45, 0x52, 0x10, 0x05, 0x2a, 0x11, 0x0a, 0x07, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, - 0x12, 0x06, 0x0a, 0x02, 0x4f, 0x4b, 0x10, 0x00, 0x2a, 0x85, 0x01, 0x0a, 0x0a, 0x43, 0x6f, 0x6d, - 0x6d, 0x6f, 0x6e, 0x46, 0x61, 0x69, 0x6c, 0x12, 0x0c, 0x0a, 0x08, 0x49, 0x4e, 0x54, 0x45, 0x52, - 0x4e, 0x41, 0x4c, 0x10, 0x00, 0x12, 0x16, 0x0a, 0x12, 0x57, 0x52, 0x4f, 0x4e, 0x47, 0x5f, 0x4d, - 0x41, 0x47, 0x49, 0x43, 0x5f, 0x4e, 0x55, 0x4d, 0x42, 0x45, 0x52, 0x10, 0x01, 0x12, 0x1f, 0x0a, - 0x1b, 0x53, 0x49, 0x47, 0x4e, 0x41, 0x54, 0x55, 0x52, 0x45, 0x5f, 0x56, 0x45, 0x52, 0x49, 0x46, - 0x49, 0x43, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x46, 0x41, 0x49, 0x4c, 0x10, 0x02, 0x12, 0x1a, - 0x0a, 0x16, 0x4e, 0x4f, 0x44, 0x45, 0x5f, 0x55, 0x4e, 0x44, 0x45, 0x52, 0x5f, 0x4d, 0x41, 0x49, - 0x4e, 0x54, 0x45, 0x4e, 0x41, 0x4e, 0x43, 0x45, 0x10, 0x03, 0x12, 0x14, 0x0a, 0x10, 0x49, 0x4e, - 0x56, 0x41, 0x4c, 0x49, 0x44, 0x5f, 0x41, 0x52, 0x47, 0x55, 0x4d, 0x45, 0x4e, 0x54, 0x10, 0x04, - 0x2a, 0x88, 0x01, 0x0a, 0x06, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x11, 0x0a, 0x0d, 0x41, - 0x43, 0x43, 0x45, 0x53, 0x53, 0x5f, 0x44, 0x45, 0x4e, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x14, - 0x0a, 0x10, 0x4f, 0x42, 0x4a, 0x45, 0x43, 0x54, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x46, 0x4f, 0x55, - 0x4e, 0x44, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x4c, 0x4f, 0x43, 0x4b, 0x45, 0x44, 0x10, 0x02, - 0x12, 0x1b, 0x0a, 0x17, 0x4c, 0x4f, 0x43, 0x4b, 0x5f, 0x4e, 0x4f, 0x4e, 0x5f, 0x52, 0x45, 0x47, - 0x55, 0x4c, 0x41, 0x52, 0x5f, 0x4f, 0x42, 0x4a, 0x45, 0x43, 0x54, 0x10, 0x03, 0x12, 0x1a, 0x0a, - 0x16, 0x4f, 0x42, 0x4a, 0x45, 0x43, 0x54, 0x5f, 0x41, 0x4c, 0x52, 0x45, 0x41, 0x44, 0x59, 0x5f, - 0x52, 0x45, 0x4d, 0x4f, 0x56, 0x45, 0x44, 0x10, 0x04, 0x12, 0x10, 0x0a, 0x0c, 0x4f, 0x55, 0x54, - 0x5f, 0x4f, 0x46, 0x5f, 0x52, 0x41, 0x4e, 0x47, 0x45, 0x10, 0x05, 0x2a, 0x55, 0x0a, 0x09, 0x43, - 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x12, 0x17, 0x0a, 0x13, 0x43, 0x4f, 0x4e, 0x54, - 0x41, 0x49, 0x4e, 0x45, 0x52, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x46, 0x4f, 0x55, 0x4e, 0x44, 0x10, - 0x00, 0x12, 0x12, 0x0a, 0x0e, 0x45, 0x41, 0x43, 0x4c, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x46, 0x4f, - 0x55, 0x4e, 0x44, 0x10, 0x01, 0x12, 0x1b, 0x0a, 0x17, 0x43, 0x4f, 0x4e, 0x54, 0x41, 0x49, 0x4e, - 0x45, 0x52, 0x5f, 0x41, 0x43, 0x43, 0x45, 0x53, 0x53, 0x5f, 0x44, 0x45, 0x4e, 0x49, 0x45, 0x44, - 0x10, 0x02, 0x2a, 0x31, 0x0a, 0x07, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x13, 0x0a, - 0x0f, 0x54, 0x4f, 0x4b, 0x45, 0x4e, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x46, 0x4f, 0x55, 0x4e, 0x44, - 0x10, 0x00, 0x12, 0x11, 0x0a, 0x0d, 0x54, 0x4f, 0x4b, 0x45, 0x4e, 0x5f, 0x45, 0x58, 0x50, 0x49, - 0x52, 0x45, 0x44, 0x10, 0x01, 0x2a, 0x2b, 0x0a, 0x0a, 0x41, 0x50, 0x45, 0x4d, 0x61, 0x6e, 0x61, - 0x67, 0x65, 0x72, 0x12, 0x1d, 0x0a, 0x19, 0x41, 0x50, 0x45, 0x5f, 0x4d, 0x41, 0x4e, 0x41, 0x47, - 0x45, 0x52, 0x5f, 0x41, 0x43, 0x43, 0x45, 0x53, 0x53, 0x5f, 0x44, 0x45, 0x4e, 0x49, 0x45, 0x44, - 0x10, 0x00, 0x42, 0x61, 0x5a, 0x42, 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, 0x61, 0x70, 0x69, 0x2d, - 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2f, 0x67, 0x72, 0x70, - 0x63, 0x3b, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0xaa, 0x02, 0x1a, 0x4e, 0x65, 0x6f, 0x2e, 0x46, - 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x53, - 0x74, 0x61, 0x74, 0x75, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_status_grpc_types_proto_rawDescOnce sync.Once - file_status_grpc_types_proto_rawDescData = file_status_grpc_types_proto_rawDesc -) - -func file_status_grpc_types_proto_rawDescGZIP() []byte { - file_status_grpc_types_proto_rawDescOnce.Do(func() { - file_status_grpc_types_proto_rawDescData = protoimpl.X.CompressGZIP(file_status_grpc_types_proto_rawDescData) - }) - return file_status_grpc_types_proto_rawDescData -} - -var file_status_grpc_types_proto_enumTypes = make([]protoimpl.EnumInfo, 7) -var file_status_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_status_grpc_types_proto_goTypes = []interface{}{ - (Section)(0), // 0: neo.fs.v2.status.Section - (Success)(0), // 1: neo.fs.v2.status.Success - (CommonFail)(0), // 2: neo.fs.v2.status.CommonFail - (Object)(0), // 3: neo.fs.v2.status.Object - (Container)(0), // 4: neo.fs.v2.status.Container - (Session)(0), // 5: neo.fs.v2.status.Session - (APEManager)(0), // 6: neo.fs.v2.status.APEManager - (*Status)(nil), // 7: neo.fs.v2.status.Status - (*Status_Detail)(nil), // 8: neo.fs.v2.status.Status.Detail -} -var file_status_grpc_types_proto_depIdxs = []int32{ - 8, // 0: neo.fs.v2.status.Status.details:type_name -> neo.fs.v2.status.Status.Detail - 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_status_grpc_types_proto_init() } -func file_status_grpc_types_proto_init() { - if File_status_grpc_types_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_status_grpc_types_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Status); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_status_grpc_types_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Status_Detail); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_status_grpc_types_proto_rawDesc, - NumEnums: 7, - NumMessages: 2, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_status_grpc_types_proto_goTypes, - DependencyIndexes: file_status_grpc_types_proto_depIdxs, - EnumInfos: file_status_grpc_types_proto_enumTypes, - MessageInfos: file_status_grpc_types_proto_msgTypes, - }.Build() - File_status_grpc_types_proto = out.File - file_status_grpc_types_proto_rawDesc = nil - file_status_grpc_types_proto_goTypes = nil - file_status_grpc_types_proto_depIdxs = nil -} diff --git a/status/grpc/types_frostfs.pb.go b/status/grpc/types_frostfs.pb.go new file mode 100644 index 0000000..a12ab55 --- /dev/null +++ b/status/grpc/types_frostfs.pb.go @@ -0,0 +1,643 @@ +// Code generated by protoc-gen-go-frostfs. DO NOT EDIT. + +package status + +import ( + json "encoding/json" + fmt "fmt" + pool "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/pool" + proto "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/proto" + encoding "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/proto/encoding" + easyproto "github.com/VictoriaMetrics/easyproto" + jlexer "github.com/mailru/easyjson/jlexer" + jwriter "github.com/mailru/easyjson/jwriter" + strconv "strconv" +) + +type Section int32 + +const ( + Section_SECTION_SUCCESS Section = 0 + Section_SECTION_FAILURE_COMMON Section = 1 + Section_SECTION_OBJECT Section = 2 + Section_SECTION_CONTAINER Section = 3 + Section_SECTION_SESSION Section = 4 + Section_SECTION_APE_MANAGER Section = 5 +) + +var ( + Section_name = map[int32]string{ + 0: "SECTION_SUCCESS", + 1: "SECTION_FAILURE_COMMON", + 2: "SECTION_OBJECT", + 3: "SECTION_CONTAINER", + 4: "SECTION_SESSION", + 5: "SECTION_APE_MANAGER", + } + Section_value = map[string]int32{ + "SECTION_SUCCESS": 0, + "SECTION_FAILURE_COMMON": 1, + "SECTION_OBJECT": 2, + "SECTION_CONTAINER": 3, + "SECTION_SESSION": 4, + "SECTION_APE_MANAGER": 5, + } +) + +func (x Section) String() string { + if v, ok := Section_name[int32(x)]; ok { + return v + } + return strconv.FormatInt(int64(x), 10) +} +func (x *Section) FromString(s string) bool { + if v, ok := Section_value[s]; ok { + *x = Section(v) + return true + } + return false +} + +type Success int32 + +const ( + Success_OK Success = 0 +) + +var ( + Success_name = map[int32]string{ + 0: "OK", + } + Success_value = map[string]int32{ + "OK": 0, + } +) + +func (x Success) String() string { + if v, ok := Success_name[int32(x)]; ok { + return v + } + return strconv.FormatInt(int64(x), 10) +} +func (x *Success) FromString(s string) bool { + if v, ok := Success_value[s]; ok { + *x = Success(v) + return true + } + return false +} + +type CommonFail int32 + +const ( + CommonFail_INTERNAL CommonFail = 0 + CommonFail_WRONG_MAGIC_NUMBER CommonFail = 1 + CommonFail_SIGNATURE_VERIFICATION_FAIL CommonFail = 2 + CommonFail_NODE_UNDER_MAINTENANCE CommonFail = 3 + CommonFail_INVALID_ARGUMENT CommonFail = 4 +) + +var ( + CommonFail_name = map[int32]string{ + 0: "INTERNAL", + 1: "WRONG_MAGIC_NUMBER", + 2: "SIGNATURE_VERIFICATION_FAIL", + 3: "NODE_UNDER_MAINTENANCE", + 4: "INVALID_ARGUMENT", + } + CommonFail_value = map[string]int32{ + "INTERNAL": 0, + "WRONG_MAGIC_NUMBER": 1, + "SIGNATURE_VERIFICATION_FAIL": 2, + "NODE_UNDER_MAINTENANCE": 3, + "INVALID_ARGUMENT": 4, + } +) + +func (x CommonFail) String() string { + if v, ok := CommonFail_name[int32(x)]; ok { + return v + } + return strconv.FormatInt(int64(x), 10) +} +func (x *CommonFail) FromString(s string) bool { + if v, ok := CommonFail_value[s]; ok { + *x = CommonFail(v) + return true + } + return false +} + +type Object int32 + +const ( + Object_ACCESS_DENIED Object = 0 + Object_OBJECT_NOT_FOUND Object = 1 + Object_LOCKED Object = 2 + Object_LOCK_NON_REGULAR_OBJECT Object = 3 + Object_OBJECT_ALREADY_REMOVED Object = 4 + Object_OUT_OF_RANGE Object = 5 +) + +var ( + Object_name = map[int32]string{ + 0: "ACCESS_DENIED", + 1: "OBJECT_NOT_FOUND", + 2: "LOCKED", + 3: "LOCK_NON_REGULAR_OBJECT", + 4: "OBJECT_ALREADY_REMOVED", + 5: "OUT_OF_RANGE", + } + Object_value = map[string]int32{ + "ACCESS_DENIED": 0, + "OBJECT_NOT_FOUND": 1, + "LOCKED": 2, + "LOCK_NON_REGULAR_OBJECT": 3, + "OBJECT_ALREADY_REMOVED": 4, + "OUT_OF_RANGE": 5, + } +) + +func (x Object) String() string { + if v, ok := Object_name[int32(x)]; ok { + return v + } + return strconv.FormatInt(int64(x), 10) +} +func (x *Object) FromString(s string) bool { + if v, ok := Object_value[s]; ok { + *x = Object(v) + return true + } + return false +} + +type Container int32 + +const ( + Container_CONTAINER_NOT_FOUND Container = 0 + Container_EACL_NOT_FOUND Container = 1 + Container_CONTAINER_ACCESS_DENIED Container = 2 +) + +var ( + Container_name = map[int32]string{ + 0: "CONTAINER_NOT_FOUND", + 1: "EACL_NOT_FOUND", + 2: "CONTAINER_ACCESS_DENIED", + } + Container_value = map[string]int32{ + "CONTAINER_NOT_FOUND": 0, + "EACL_NOT_FOUND": 1, + "CONTAINER_ACCESS_DENIED": 2, + } +) + +func (x Container) String() string { + if v, ok := Container_name[int32(x)]; ok { + return v + } + return strconv.FormatInt(int64(x), 10) +} +func (x *Container) FromString(s string) bool { + if v, ok := Container_value[s]; ok { + *x = Container(v) + return true + } + return false +} + +type Session int32 + +const ( + Session_TOKEN_NOT_FOUND Session = 0 + Session_TOKEN_EXPIRED Session = 1 +) + +var ( + Session_name = map[int32]string{ + 0: "TOKEN_NOT_FOUND", + 1: "TOKEN_EXPIRED", + } + Session_value = map[string]int32{ + "TOKEN_NOT_FOUND": 0, + "TOKEN_EXPIRED": 1, + } +) + +func (x Session) String() string { + if v, ok := Session_name[int32(x)]; ok { + return v + } + return strconv.FormatInt(int64(x), 10) +} +func (x *Session) FromString(s string) bool { + if v, ok := Session_value[s]; ok { + *x = Session(v) + return true + } + return false +} + +type APEManager int32 + +const ( + APEManager_APE_MANAGER_ACCESS_DENIED APEManager = 0 +) + +var ( + APEManager_name = map[int32]string{ + 0: "APE_MANAGER_ACCESS_DENIED", + } + APEManager_value = map[string]int32{ + "APE_MANAGER_ACCESS_DENIED": 0, + } +) + +func (x APEManager) String() string { + if v, ok := APEManager_name[int32(x)]; ok { + return v + } + return strconv.FormatInt(int64(x), 10) +} +func (x *APEManager) FromString(s string) bool { + if v, ok := APEManager_value[s]; ok { + *x = APEManager(v) + return true + } + return false +} + +type Status_Detail struct { + Id uint32 `json:"id"` + Value []byte `json:"value"` +} + +var ( + _ encoding.ProtoMarshaler = (*Status_Detail)(nil) + _ encoding.ProtoUnmarshaler = (*Status_Detail)(nil) + _ json.Marshaler = (*Status_Detail)(nil) + _ json.Unmarshaler = (*Status_Detail)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *Status_Detail) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.UInt32Size(1, x.Id) + size += proto.BytesSize(2, x.Value) + return size +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *Status_Detail) 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 *Status_Detail) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if x.Id != 0 { + mm.AppendUint32(1, x.Id) + } + if len(x.Value) != 0 { + mm.AppendBytes(2, x.Value) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *Status_Detail) 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", "Status_Detail") + } + switch fc.FieldNum { + case 1: // Id + data, ok := fc.Uint32() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Id") + } + x.Id = data + case 2: // Value + data, ok := fc.Bytes() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Value") + } + x.Value = data + } + } + return nil +} +func (x *Status_Detail) GetId() uint32 { + if x != nil { + return x.Id + } + return 0 +} +func (x *Status_Detail) SetId(v uint32) { + x.Id = v +} +func (x *Status_Detail) GetValue() []byte { + if x != nil { + return x.Value + } + return nil +} +func (x *Status_Detail) SetValue(v []byte) { + x.Value = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *Status_Detail) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *Status_Detail) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"id\":" + out.RawString(prefix[1:]) + out.Uint32(x.Id) + } + { + const prefix string = ",\"value\":" + out.RawString(prefix) + out.Base64Bytes(x.Value) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *Status_Detail) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *Status_Detail) 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 uint32 + f = in.Uint32() + x.Id = f + } + case "value": + { + var f []byte + f = in.Bytes() + x.Value = f + } + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} + +type Status struct { + Code uint32 `json:"code"` + Message string `json:"message"` + Details []*Status_Detail `json:"details"` +} + +var ( + _ encoding.ProtoMarshaler = (*Status)(nil) + _ encoding.ProtoUnmarshaler = (*Status)(nil) + _ json.Marshaler = (*Status)(nil) + _ json.Unmarshaler = (*Status)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *Status) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.UInt32Size(1, x.Code) + size += proto.StringSize(2, x.Message) + for i := range x.Details { + size += proto.NestedStructureSize(3, x.Details[i]) + } + return size +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *Status) 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 *Status) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if x.Code != 0 { + mm.AppendUint32(1, x.Code) + } + if len(x.Message) != 0 { + mm.AppendString(2, x.Message) + } + for i := range x.Details { + if x.Details[i] != nil && x.Details[i].StableSize() != 0 { + x.Details[i].EmitProtobuf(mm.AppendMessage(3)) + } + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *Status) 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", "Status") + } + switch fc.FieldNum { + case 1: // Code + data, ok := fc.Uint32() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Code") + } + x.Code = data + case 2: // Message + data, ok := fc.String() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Message") + } + x.Message = data + case 3: // Details + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Details") + } + x.Details = append(x.Details, new(Status_Detail)) + ff := x.Details[len(x.Details)-1] + if err := ff.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + } + } + return nil +} +func (x *Status) GetCode() uint32 { + if x != nil { + return x.Code + } + return 0 +} +func (x *Status) SetCode(v uint32) { + x.Code = v +} +func (x *Status) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} +func (x *Status) SetMessage(v string) { + x.Message = v +} +func (x *Status) GetDetails() []*Status_Detail { + if x != nil { + return x.Details + } + return nil +} +func (x *Status) SetDetails(v []*Status_Detail) { + x.Details = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *Status) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *Status) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"code\":" + out.RawString(prefix[1:]) + out.Uint32(x.Code) + } + { + const prefix string = ",\"message\":" + out.RawString(prefix) + out.String(x.Message) + } + { + const prefix string = ",\"details\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.Details { + if i != 0 { + out.RawByte(',') + } + x.Details[i].MarshalEasyJSON(out) + } + out.RawByte(']') + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *Status) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *Status) 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 "code": + { + var f uint32 + f = in.Uint32() + x.Code = f + } + case "message": + { + var f string + f = in.String() + x.Message = f + } + case "details": + { + var f *Status_Detail + var list []*Status_Detail + in.Delim('[') + for !in.IsDelim(']') { + f = new(Status_Detail) + f.UnmarshalEasyJSON(in) + list = append(list, f) + in.WantComma() + } + x.Details = list + in.Delim(']') + } + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} diff --git a/status/grpc/types_frostfs_fuzz.go b/status/grpc/types_frostfs_fuzz.go new file mode 100644 index 0000000..ce9d84e --- /dev/null +++ b/status/grpc/types_frostfs_fuzz.go @@ -0,0 +1,26 @@ +//go:build gofuzz +// +build gofuzz + +// Code generated by protoc-gen-go-frostfs. DO NOT EDIT. + +package status + +func DoFuzzProtoStatus(data []byte) int { + msg := new(Status) + if err := msg.UnmarshalProtobuf(data); err != nil { + return 0 + } + _ = msg.MarshalProtobuf(nil) + return 1 +} +func DoFuzzJSONStatus(data []byte) int { + msg := new(Status) + if err := msg.UnmarshalJSON(data); err != nil { + return 0 + } + _, err := msg.MarshalJSON() + if err != nil { + panic(err) + } + return 1 +} diff --git a/status/grpc/types_frostfs_test.go b/status/grpc/types_frostfs_test.go new file mode 100644 index 0000000..dfc5631 --- /dev/null +++ b/status/grpc/types_frostfs_test.go @@ -0,0 +1,21 @@ +//go:build gofuzz +// +build gofuzz + +// Code generated by protoc-gen-go-frostfs. DO NOT EDIT. + +package status + +import ( + testing "testing" +) + +func FuzzProtoStatus(f *testing.F) { + f.Fuzz(func(t *testing.T, data []byte) { + DoFuzzProtoStatus(data) + }) +} +func FuzzJSONStatus(f *testing.F) { + f.Fuzz(func(t *testing.T, data []byte) { + DoFuzzJSONStatus(data) + }) +} diff --git a/tombstone/grpc/types.go b/tombstone/grpc/types.go deleted file mode 100644 index 9b4b744..0000000 --- a/tombstone/grpc/types.go +++ /dev/null @@ -1,20 +0,0 @@ -package tombstone - -import ( - refs "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc" -) - -// SetExpirationEpoch sets number of tombstone expiration epoch. -func (x *Tombstone) SetExpirationEpoch(v uint64) { - x.ExpirationEpoch = v -} - -// SetSplitId sets identifier of split object hierarchy. -func (x *Tombstone) SetSplitId(v []byte) { - x.SplitId = v -} - -// SetMembers sets list of objects to be deleted. -func (x *Tombstone) SetMembers(v []*refs.ObjectID) { - x.Members = v -} diff --git a/tombstone/grpc/types.pb.go b/tombstone/grpc/types.pb.go deleted file mode 100644 index 7d416fe..0000000 --- a/tombstone/grpc/types.pb.go +++ /dev/null @@ -1,187 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.33.0 -// protoc v5.27.2 -// source: tombstone/grpc/types.proto - -package tombstone - -import ( - grpc "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -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) -) - -// Tombstone keeps record of deleted objects for a few epochs until they are -// purged from the NeoFS network. -type Tombstone struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Last NeoFS epoch number of the tombstone lifetime. It's set by the - // tombstone creator depending on the current NeoFS network settings. A - // tombstone object must have the same expiration epoch value in - // `__SYSTEM__EXPIRATION_EPOCH` (`__NEOFS__EXPIRATION_EPOCH` is deprecated) - // attribute. Otherwise, the tombstone will be rejected by a storage node. - ExpirationEpoch uint64 `protobuf:"varint,1,opt,name=expiration_epoch,json=expirationEpoch,proto3" json:"expiration_epoch,omitempty"` - // 16 byte UUID used to identify the split object hierarchy parts. Must be - // unique inside a container. All objects participating in the split must - // have the same `split_id` value. - SplitId []byte `protobuf:"bytes,2,opt,name=split_id,json=splitID,proto3" json:"split_id,omitempty"` - // List of objects to be deleted. - Members []*grpc.ObjectID `protobuf:"bytes,3,rep,name=members,proto3" json:"members,omitempty"` -} - -func (x *Tombstone) Reset() { - *x = Tombstone{} - if protoimpl.UnsafeEnabled { - mi := &file_tombstone_grpc_types_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Tombstone) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Tombstone) ProtoMessage() {} - -func (x *Tombstone) ProtoReflect() protoreflect.Message { - mi := &file_tombstone_grpc_types_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Tombstone.ProtoReflect.Descriptor instead. -func (*Tombstone) Descriptor() ([]byte, []int) { - return file_tombstone_grpc_types_proto_rawDescGZIP(), []int{0} -} - -func (x *Tombstone) GetExpirationEpoch() uint64 { - if x != nil { - return x.ExpirationEpoch - } - return 0 -} - -func (x *Tombstone) GetSplitId() []byte { - if x != nil { - return x.SplitId - } - return nil -} - -func (x *Tombstone) GetMembers() []*grpc.ObjectID { - if x != nil { - return x.Members - } - return nil -} - -var File_tombstone_grpc_types_proto protoreflect.FileDescriptor - -var file_tombstone_grpc_types_proto_rawDesc = []byte{ - 0x0a, 0x1a, 0x74, 0x6f, 0x6d, 0x62, 0x73, 0x74, 0x6f, 0x6e, 0x65, 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, 0x74, 0x6f, 0x6d, 0x62, 0x73, 0x74, 0x6f, 0x6e, - 0x65, 0x1a, 0x15, 0x72, 0x65, 0x66, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, - 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x85, 0x01, 0x0a, 0x09, 0x54, 0x6f, 0x6d, - 0x62, 0x73, 0x74, 0x6f, 0x6e, 0x65, 0x12, 0x29, 0x0a, 0x10, 0x65, 0x78, 0x70, 0x69, 0x72, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, - 0x52, 0x0f, 0x65, 0x78, 0x70, 0x69, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x70, 0x6f, 0x63, - 0x68, 0x12, 0x19, 0x0a, 0x08, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0c, 0x52, 0x07, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x49, 0x44, 0x12, 0x32, 0x0a, 0x07, - 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x18, 0x03, 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, 0x6a, 0x5a, 0x48, 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, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, - 0x2f, 0x76, 0x32, 0x2f, 0x74, 0x6f, 0x6d, 0x62, 0x73, 0x74, 0x6f, 0x6e, 0x65, 0x2f, 0x67, 0x72, - 0x70, 0x63, 0x3b, 0x74, 0x6f, 0x6d, 0x62, 0x73, 0x74, 0x6f, 0x6e, 0x65, 0xaa, 0x02, 0x1d, 0x4e, - 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, - 0x50, 0x49, 0x2e, 0x54, 0x6f, 0x6d, 0x62, 0x73, 0x74, 0x6f, 0x6e, 0x65, 0x62, 0x06, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_tombstone_grpc_types_proto_rawDescOnce sync.Once - file_tombstone_grpc_types_proto_rawDescData = file_tombstone_grpc_types_proto_rawDesc -) - -func file_tombstone_grpc_types_proto_rawDescGZIP() []byte { - file_tombstone_grpc_types_proto_rawDescOnce.Do(func() { - file_tombstone_grpc_types_proto_rawDescData = protoimpl.X.CompressGZIP(file_tombstone_grpc_types_proto_rawDescData) - }) - return file_tombstone_grpc_types_proto_rawDescData -} - -var file_tombstone_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_tombstone_grpc_types_proto_goTypes = []interface{}{ - (*Tombstone)(nil), // 0: neo.fs.v2.tombstone.Tombstone - (*grpc.ObjectID)(nil), // 1: neo.fs.v2.refs.ObjectID -} -var file_tombstone_grpc_types_proto_depIdxs = []int32{ - 1, // 0: neo.fs.v2.tombstone.Tombstone.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_tombstone_grpc_types_proto_init() } -func file_tombstone_grpc_types_proto_init() { - if File_tombstone_grpc_types_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_tombstone_grpc_types_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Tombstone); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_tombstone_grpc_types_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_tombstone_grpc_types_proto_goTypes, - DependencyIndexes: file_tombstone_grpc_types_proto_depIdxs, - MessageInfos: file_tombstone_grpc_types_proto_msgTypes, - }.Build() - File_tombstone_grpc_types_proto = out.File - file_tombstone_grpc_types_proto_rawDesc = nil - file_tombstone_grpc_types_proto_goTypes = nil - file_tombstone_grpc_types_proto_depIdxs = nil -} diff --git a/tombstone/grpc/types_frostfs.pb.go b/tombstone/grpc/types_frostfs.pb.go new file mode 100644 index 0000000..b0924c0 --- /dev/null +++ b/tombstone/grpc/types_frostfs.pb.go @@ -0,0 +1,229 @@ +// Code generated by protoc-gen-go-frostfs. DO NOT EDIT. + +package tombstone + +import ( + json "encoding/json" + fmt "fmt" + grpc "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc" + pool "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/pool" + proto "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/proto" + encoding "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/proto/encoding" + easyproto "github.com/VictoriaMetrics/easyproto" + jlexer "github.com/mailru/easyjson/jlexer" + jwriter "github.com/mailru/easyjson/jwriter" +) + +type Tombstone struct { + ExpirationEpoch uint64 `json:"expirationEpoch"` + SplitId []byte `json:"splitID"` + Members []*grpc.ObjectID `json:"members"` +} + +var ( + _ encoding.ProtoMarshaler = (*Tombstone)(nil) + _ encoding.ProtoUnmarshaler = (*Tombstone)(nil) + _ json.Marshaler = (*Tombstone)(nil) + _ json.Unmarshaler = (*Tombstone)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *Tombstone) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.UInt64Size(1, x.ExpirationEpoch) + size += proto.BytesSize(2, x.SplitId) + for i := range x.Members { + size += proto.NestedStructureSize(3, x.Members[i]) + } + return size +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *Tombstone) 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 *Tombstone) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if x.ExpirationEpoch != 0 { + mm.AppendUint64(1, x.ExpirationEpoch) + } + if len(x.SplitId) != 0 { + mm.AppendBytes(2, x.SplitId) + } + for i := range x.Members { + if x.Members[i] != nil && x.Members[i].StableSize() != 0 { + x.Members[i].EmitProtobuf(mm.AppendMessage(3)) + } + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *Tombstone) 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", "Tombstone") + } + switch fc.FieldNum { + case 1: // ExpirationEpoch + data, ok := fc.Uint64() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "ExpirationEpoch") + } + x.ExpirationEpoch = data + case 2: // SplitId + data, ok := fc.Bytes() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "SplitId") + } + x.SplitId = data + case 3: // Members + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Members") + } + x.Members = append(x.Members, new(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 *Tombstone) GetExpirationEpoch() uint64 { + if x != nil { + return x.ExpirationEpoch + } + return 0 +} +func (x *Tombstone) SetExpirationEpoch(v uint64) { + x.ExpirationEpoch = v +} +func (x *Tombstone) GetSplitId() []byte { + if x != nil { + return x.SplitId + } + return nil +} +func (x *Tombstone) SetSplitId(v []byte) { + x.SplitId = v +} +func (x *Tombstone) GetMembers() []*grpc.ObjectID { + if x != nil { + return x.Members + } + return nil +} +func (x *Tombstone) SetMembers(v []*grpc.ObjectID) { + x.Members = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *Tombstone) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *Tombstone) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"expirationEpoch\":" + out.RawString(prefix[1:]) + out.Uint64(x.ExpirationEpoch) + } + { + const prefix string = ",\"splitID\":" + out.RawString(prefix) + out.Base64Bytes(x.SplitId) + } + { + 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 *Tombstone) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *Tombstone) 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 "expirationEpoch": + { + var f uint64 + f = in.Uint64() + x.ExpirationEpoch = f + } + case "splitID": + { + var f []byte + f = in.Bytes() + x.SplitId = f + } + case "members": + { + var f *grpc.ObjectID + var list []*grpc.ObjectID + in.Delim('[') + for !in.IsDelim(']') { + f = new(grpc.ObjectID) + f.UnmarshalEasyJSON(in) + list = append(list, f) + in.WantComma() + } + x.Members = list + in.Delim(']') + } + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} diff --git a/tombstone/grpc/types_frostfs_fuzz.go b/tombstone/grpc/types_frostfs_fuzz.go new file mode 100644 index 0000000..57cfb58 --- /dev/null +++ b/tombstone/grpc/types_frostfs_fuzz.go @@ -0,0 +1,26 @@ +//go:build gofuzz +// +build gofuzz + +// Code generated by protoc-gen-go-frostfs. DO NOT EDIT. + +package tombstone + +func DoFuzzProtoTombstone(data []byte) int { + msg := new(Tombstone) + if err := msg.UnmarshalProtobuf(data); err != nil { + return 0 + } + _ = msg.MarshalProtobuf(nil) + return 1 +} +func DoFuzzJSONTombstone(data []byte) int { + msg := new(Tombstone) + if err := msg.UnmarshalJSON(data); err != nil { + return 0 + } + _, err := msg.MarshalJSON() + if err != nil { + panic(err) + } + return 1 +} diff --git a/tombstone/grpc/types_frostfs_test.go b/tombstone/grpc/types_frostfs_test.go new file mode 100644 index 0000000..8264824 --- /dev/null +++ b/tombstone/grpc/types_frostfs_test.go @@ -0,0 +1,21 @@ +//go:build gofuzz +// +build gofuzz + +// Code generated by protoc-gen-go-frostfs. DO NOT EDIT. + +package tombstone + +import ( + testing "testing" +) + +func FuzzProtoTombstone(f *testing.F) { + f.Fuzz(func(t *testing.T, data []byte) { + DoFuzzProtoTombstone(data) + }) +} +func FuzzJSONTombstone(f *testing.F) { + f.Fuzz(func(t *testing.T, data []byte) { + DoFuzzJSONTombstone(data) + }) +} diff --git a/util/pool/marshal.go b/util/pool/marshal.go new file mode 100644 index 0000000..107df28 --- /dev/null +++ b/util/pool/marshal.go @@ -0,0 +1,7 @@ +package pool + +import ( + "github.com/VictoriaMetrics/easyproto" +) + +var MarshalerPool easyproto.MarshalerPool diff --git a/util/proto/encoding/compat.go b/util/proto/encoding/compat.go new file mode 100644 index 0000000..09d45e6 --- /dev/null +++ b/util/proto/encoding/compat.go @@ -0,0 +1,22 @@ +package encoding + +import ( + _ "google.golang.org/grpc/encoding/proto" // Ensure default codec is registered before our one. + "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/protoadapt" +) + +// messageV2Of converts v to a proto.Message. +// This is needed for this library to continue working in presence of external gRPC packages, +// such as opentelemetry gRPC exporter. +// Copied from https://github.com/grpc/grpc-go/blob/e524655becd8d4c7ba9e8687faef456e495e341e/encoding/proto/proto.go#L59. +func messageV2Of(v any) proto.Message { + switch v := v.(type) { + case protoadapt.MessageV1: + return protoadapt.MessageV2Of(v) + case protoadapt.MessageV2: + return v + } + + return nil +} diff --git a/util/proto/encoding/json.go b/util/proto/encoding/json.go new file mode 100644 index 0000000..3456a40 --- /dev/null +++ b/util/proto/encoding/json.go @@ -0,0 +1,48 @@ +package encoding + +import ( + "encoding/json" + "fmt" + + "google.golang.org/grpc/encoding" + "google.golang.org/protobuf/encoding/protojson" +) + +// JSONCodec is easyjson codec used for code generated by protogen. +// It is binary-level compatible with the standard protojson format, thus uses the same name. +type JSONCodec struct{} + +var _ encoding.Codec = JSONCodec{} + +func init() { + encoding.RegisterCodec(JSONCodec{}) +} + +// Name implements the encoding.Codec interface. +func (JSONCodec) Name() string { return "json" } + +// Marshal implements the encoding.Codec interface. +func (JSONCodec) Marshal(v any) ([]byte, error) { + switch v := v.(type) { + case json.Marshaler: + return json.Marshal(v) + default: + if v := messageV2Of(v); v != nil { + return protojson.Marshal(v) + } + return nil, fmt.Errorf("failed to marshal, message is %T, want proto.Message", v) + } +} + +// Unmarshal implements the encoding.Codec interface. +func (JSONCodec) Unmarshal(data []byte, v any) error { + switch v := v.(type) { + case json.Unmarshaler: + return json.Unmarshal(data, v) + default: + if v := messageV2Of(v); v != nil { + return protojson.Unmarshal(data, v) + } + return fmt.Errorf("failed to unmarshal, message is %T, want proto.Message", v) + } +} diff --git a/util/proto/encoding/proto.go b/util/proto/encoding/proto.go new file mode 100644 index 0000000..5f3c556 --- /dev/null +++ b/util/proto/encoding/proto.go @@ -0,0 +1,57 @@ +package encoding + +import ( + "fmt" + + "google.golang.org/grpc/encoding" + "google.golang.org/protobuf/proto" +) + +// ProtoCodec is easyproto codec used for code generated by protogen. +// It is binary-level compatible with the standard proto codec, thus uses the same name. +type ProtoCodec struct{} + +// ProtoMarshaler is an interface accepted by ProtoCodec.Marshal. +type ProtoMarshaler interface { + MarshalProtobuf([]byte) []byte +} + +// ProtoUnmarshaler is an interface accepted by ProtoCodec.Unmarshal. +type ProtoUnmarshaler interface { + UnmarshalProtobuf([]byte) error +} + +var _ encoding.Codec = ProtoCodec{} + +func init() { + encoding.RegisterCodec(ProtoCodec{}) +} + +// Name implements the encoding.Codec interface. +func (ProtoCodec) Name() string { return "proto" } + +// Marshal implements the encoding.Codec interface. +func (ProtoCodec) Marshal(v any) ([]byte, error) { + switch v := v.(type) { + case ProtoMarshaler: + return v.MarshalProtobuf(nil), nil + default: + if v := messageV2Of(v); v != nil { + return proto.Marshal(v) + } + return nil, fmt.Errorf("failed to marshal, message is %T, want proto.Message", v) + } +} + +// Unmarshal implements the encoding.Codec interface. +func (ProtoCodec) Unmarshal(data []byte, v any) error { + switch v := v.(type) { + case ProtoUnmarshaler: + return v.UnmarshalProtobuf(data) + default: + if v := messageV2Of(v); v != nil { + return proto.Unmarshal(data, v) + } + return fmt.Errorf("failed to unmarshal, message is %T, want proto.Message", v) + } +} diff --git a/util/proto/marshal.go b/util/proto/marshal.go index 42c6a91..5016255 100644 --- a/util/proto/marshal.go +++ b/util/proto/marshal.go @@ -17,6 +17,10 @@ import ( type ( stableMarshaler interface { StableMarshal([]byte) []byte + stableSizer + } + + stableSizer interface { StableSize() int } @@ -277,6 +281,11 @@ type ptrStableMarshaler[T any] interface { ~*T } +type ptrStableSizer[T any] interface { + stableSizer + ~*T +} + func NestedStructureMarshal[T any, M ptrStableMarshaler[T]](field int64, buf []byte, v M) int { if v == nil { return 0 @@ -320,7 +329,7 @@ func NestedStructureSetMarshalData[T any, M setMarshalData[T]](field int64, pare return offset + n } -func NestedStructureSize[T any, M ptrStableMarshaler[T]](field int64, v M) (size int) { +func NestedStructureSize[T any, M ptrStableSizer[T]](field int64, v M) (size int) { if v == nil { return 0 } @@ -328,7 +337,7 @@ func NestedStructureSize[T any, M ptrStableMarshaler[T]](field int64, v M) (size return NestedStructureSizeUnchecked(field, v) } -func NestedStructureSizeUnchecked[T stableMarshaler](field int64, v T) int { +func NestedStructureSizeUnchecked[T stableSizer](field int64, v T) int { n := v.StableSize() return protowire.SizeGroup(protowire.Number(field), protowire.SizeBytes(n)) } diff --git a/util/proto/marshal_test.go b/util/proto/marshal_test.go index 56d9594..e565b7c 100644 --- a/util/proto/marshal_test.go +++ b/util/proto/marshal_test.go @@ -6,6 +6,7 @@ import ( "testing" "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/proto/test" + generated "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/proto/test/custom" "github.com/stretchr/testify/require" goproto "google.golang.org/protobuf/proto" ) @@ -24,39 +25,43 @@ func nonZero[T protoInt]() T { func TestStableMarshalSingle(t *testing.T) { t.Run("empty", func(t *testing.T) { - input := &test.Primitives{} + input := &generated.Primitives{} require.Zero(t, input.StableSize()) - r := input.StableMarshal(nil) + r := input.MarshalProtobuf(nil) require.Empty(t, r) }) marshalCases := []struct { name string - input *test.Primitives + input *generated.Primitives }{ - {name: "bytes", input: &test.Primitives{FieldA: []byte{1, 2, 3}}}, - {name: "string", input: &test.Primitives{FieldB: "123"}}, - {name: "bool", input: &test.Primitives{FieldC: true}}, - {name: "int32", input: &test.Primitives{FieldD: nonZero[int32]()}}, - {name: "uint32", input: &test.Primitives{FieldE: nonZero[uint32]()}}, - {name: "int64", input: &test.Primitives{FieldF: nonZero[int64]()}}, - {name: "uint64", input: &test.Primitives{FieldG: nonZero[uint64]()}}, - {name: "uint64", input: &test.Primitives{FieldI: nonZero[uint64]()}}, - {name: "float64", input: &test.Primitives{FieldJ: math.Float64frombits(12345677890)}}, - {name: "fixed32", input: &test.Primitives{FieldK: nonZero[uint32]()}}, - {name: "enum, positive", input: &test.Primitives{FieldH: test.Primitives_POSITIVE}}, - {name: "enum, negative", input: &test.Primitives{FieldH: test.Primitives_NEGATIVE}}, + {name: "bytes", input: &generated.Primitives{FieldA: []byte{1, 2, 3}}}, + {name: "string", input: &generated.Primitives{FieldB: "123"}}, + {name: "bool", input: &generated.Primitives{FieldC: true}}, + {name: "int32", input: &generated.Primitives{FieldD: -10}}, + {name: "uint32", input: &generated.Primitives{FieldE: nonZero[uint32]()}}, + {name: "int64", input: &generated.Primitives{FieldF: nonZero[int64]()}}, + {name: "uint64", input: &generated.Primitives{FieldG: nonZero[uint64]()}}, + {name: "uint64", input: &generated.Primitives{FieldI: nonZero[uint64]()}}, + {name: "float64", input: &generated.Primitives{FieldJ: math.Float64frombits(12345677890)}}, + {name: "fixed32", input: &generated.Primitives{FieldK: nonZero[uint32]()}}, + {name: "enum, positive", input: &generated.Primitives{FieldH: generated.Primitives_POSITIVE}}, + {name: "enum, negative", input: &generated.Primitives{FieldH: generated.Primitives_NEGATIVE}}, } for _, tc := range marshalCases { t.Run(tc.name, func(t *testing.T) { - r := tc.input.StableMarshal(nil) + r := tc.input.MarshalProtobuf(nil) require.Equal(t, len(r), tc.input.StableSize()) require.NotEmpty(t, r) var actual test.Primitives require.NoError(t, goproto.Unmarshal(r, &actual)) + var actualFrostfs generated.Primitives + require.NoError(t, actualFrostfs.UnmarshalProtobuf(r)) + require.Equal(t, tc.input, &actualFrostfs) + // Compare each field directly, because proto-generated code has private fields. require.Equal(t, tc.input.FieldA, actual.FieldA) require.Equal(t, tc.input.FieldB, actual.FieldB) @@ -68,7 +73,7 @@ func TestStableMarshalSingle(t *testing.T) { require.Equal(t, tc.input.FieldI, actual.FieldI) require.Equal(t, tc.input.FieldJ, actual.FieldJ) require.Equal(t, tc.input.FieldK, actual.FieldK) - require.Equal(t, tc.input.FieldH, actual.FieldH) + require.EqualValues(t, tc.input.FieldH, actual.FieldH) }) } } @@ -91,51 +96,53 @@ func TestStableMarshalRep(t *testing.T) { t.Run("empty", func(t *testing.T) { marshalCases := []struct { name string - input *test.RepPrimitives + input *generated.RepPrimitives }{ - {name: "default", input: &test.RepPrimitives{}}, - {name: "bytes", input: &test.RepPrimitives{FieldA: [][]byte{}}}, - {name: "string", input: &test.RepPrimitives{FieldB: []string{}}}, - {name: "int32", input: &test.RepPrimitives{FieldC: []int32{}}}, - {name: "uint32", input: &test.RepPrimitives{FieldD: []uint32{}}}, - {name: "int64", input: &test.RepPrimitives{FieldE: []int64{}}}, - {name: "uint64", input: &test.RepPrimitives{FieldF: []uint64{}}}, - {name: "uint64", input: &test.RepPrimitives{FieldFu: []uint64{}}}, + {name: "default", input: &generated.RepPrimitives{}}, + {name: "bytes", input: &generated.RepPrimitives{FieldA: [][]byte{}}}, + {name: "string", input: &generated.RepPrimitives{FieldB: []string{}}}, + {name: "int32", input: &generated.RepPrimitives{FieldC: []int32{}}}, + {name: "uint32", input: &generated.RepPrimitives{FieldD: []uint32{}}}, + {name: "int64", input: &generated.RepPrimitives{FieldE: []int64{}}}, + {name: "uint64", input: &generated.RepPrimitives{FieldF: []uint64{}}}, + {name: "uint64", input: &generated.RepPrimitives{FieldFu: []uint64{}}}, } for _, tc := range marshalCases { - require.Zero(t, tc.input.StableSize()) + t.Run(tc.name, func(t *testing.T) { + require.Zero(t, tc.input.StableSize()) - r := tc.input.StableMarshal(nil) - require.Empty(t, r) + r := tc.input.MarshalProtobuf(nil) + require.Empty(t, r) + }) } }) marshalCases := []struct { name string - input *test.RepPrimitives + input *generated.RepPrimitives }{ - {name: "bytes", input: &test.RepPrimitives{FieldA: [][]byte{{1, 2, 3}}}}, - {name: "string", input: &test.RepPrimitives{FieldB: []string{"123"}}}, - {name: "int32", input: &test.RepPrimitives{FieldC: randIntSlice[int32](1, true)}}, - {name: "int32", input: &test.RepPrimitives{FieldC: randIntSlice[int32](2, true)}}, - {name: "int32", input: &test.RepPrimitives{FieldC: randIntSlice[int32](2, false)}}, - {name: "uint32", input: &test.RepPrimitives{FieldD: randIntSlice[uint32](1, true)}}, - {name: "uint32", input: &test.RepPrimitives{FieldD: randIntSlice[uint32](2, true)}}, - {name: "uint32", input: &test.RepPrimitives{FieldD: randIntSlice[uint32](2, false)}}, - {name: "int64", input: &test.RepPrimitives{FieldE: randIntSlice[int64](1, true)}}, - {name: "int64", input: &test.RepPrimitives{FieldE: randIntSlice[int64](2, true)}}, - {name: "int64", input: &test.RepPrimitives{FieldE: randIntSlice[int64](2, false)}}, - {name: "uint64", input: &test.RepPrimitives{FieldF: randIntSlice[uint64](1, true)}}, - {name: "uint64", input: &test.RepPrimitives{FieldF: randIntSlice[uint64](2, true)}}, - {name: "uint64", input: &test.RepPrimitives{FieldF: randIntSlice[uint64](2, false)}}, - {name: "uint64", input: &test.RepPrimitives{FieldFu: randIntSlice[uint64](1, true)}}, - {name: "uint64", input: &test.RepPrimitives{FieldFu: randIntSlice[uint64](2, true)}}, - {name: "uint64", input: &test.RepPrimitives{FieldFu: randIntSlice[uint64](2, false)}}, + {name: "bytes", input: &generated.RepPrimitives{FieldA: [][]byte{{1, 2, 3}}}}, + {name: "string", input: &generated.RepPrimitives{FieldB: []string{"123"}}}, + {name: "int32", input: &generated.RepPrimitives{FieldC: randIntSlice[int32](1, true)}}, + {name: "int32", input: &generated.RepPrimitives{FieldC: randIntSlice[int32](2, true)}}, + {name: "int32", input: &generated.RepPrimitives{FieldC: randIntSlice[int32](2, false)}}, + {name: "uint32", input: &generated.RepPrimitives{FieldD: randIntSlice[uint32](1, true)}}, + {name: "uint32", input: &generated.RepPrimitives{FieldD: randIntSlice[uint32](2, true)}}, + {name: "uint32", input: &generated.RepPrimitives{FieldD: randIntSlice[uint32](2, false)}}, + {name: "int64", input: &generated.RepPrimitives{FieldE: randIntSlice[int64](1, true)}}, + {name: "int64", input: &generated.RepPrimitives{FieldE: randIntSlice[int64](2, true)}}, + {name: "int64", input: &generated.RepPrimitives{FieldE: randIntSlice[int64](2, false)}}, + {name: "uint64", input: &generated.RepPrimitives{FieldF: randIntSlice[uint64](1, true)}}, + {name: "uint64", input: &generated.RepPrimitives{FieldF: randIntSlice[uint64](2, true)}}, + {name: "uint64", input: &generated.RepPrimitives{FieldF: randIntSlice[uint64](2, false)}}, + {name: "uint64", input: &generated.RepPrimitives{FieldFu: randIntSlice[uint64](1, true)}}, + {name: "uint64", input: &generated.RepPrimitives{FieldFu: randIntSlice[uint64](2, true)}}, + {name: "uint64", input: &generated.RepPrimitives{FieldFu: randIntSlice[uint64](2, false)}}, } for _, tc := range marshalCases { t.Run(tc.name, func(t *testing.T) { - r := tc.input.StableMarshal(nil) + r := tc.input.MarshalProtobuf(nil) require.Equal(t, len(r), tc.input.StableSize()) require.NotEmpty(t, r) diff --git a/util/proto/test/custom/test_frostfs.pb.go b/util/proto/test/custom/test_frostfs.pb.go new file mode 100644 index 0000000..28a3044 --- /dev/null +++ b/util/proto/test/custom/test_frostfs.pb.go @@ -0,0 +1,926 @@ +// Code generated by protoc-gen-go-frostfs. DO NOT EDIT. + +package test + +import ( + json "encoding/json" + fmt "fmt" + pool "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/pool" + proto "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/proto" + encoding "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/proto/encoding" + easyproto "github.com/VictoriaMetrics/easyproto" + jlexer "github.com/mailru/easyjson/jlexer" + jwriter "github.com/mailru/easyjson/jwriter" + protowire "google.golang.org/protobuf/encoding/protowire" + strconv "strconv" +) + +type Primitives_SomeEnum int32 + +const ( + Primitives_UNKNOWN = 0 + Primitives_POSITIVE = 1 + Primitives_NEGATIVE = -1 +) + +var ( + Primitives_SomeEnum_name = map[int32]string{ + 0: "UNKNOWN", + 1: "POSITIVE", + -1: "NEGATIVE", + } + Primitives_SomeEnum_value = map[string]int32{ + "UNKNOWN": 0, + "POSITIVE": 1, + "NEGATIVE": -1, + } +) + +func (x Primitives_SomeEnum) String() string { + if v, ok := Primitives_SomeEnum_name[int32(x)]; ok { + return v + } + return strconv.FormatInt(int64(x), 10) +} +func (x *Primitives_SomeEnum) FromString(s string) bool { + if v, ok := Primitives_SomeEnum_value[s]; ok { + *x = Primitives_SomeEnum(v) + return true + } + return false +} + +type Primitives struct { + FieldA []byte `json:"fieldA"` + FieldB string `json:"fieldB"` + FieldC bool `json:"fieldC"` + FieldD int32 `json:"fieldD"` + FieldE uint32 `json:"fieldE"` + FieldF int64 `json:"fieldF"` + FieldG uint64 `json:"fieldG"` + FieldI uint64 `json:"fieldI"` + FieldJ float64 `json:"fieldJ"` + FieldK uint32 `json:"fieldK"` + FieldH Primitives_SomeEnum `json:"fieldH"` +} + +var ( + _ encoding.ProtoMarshaler = (*Primitives)(nil) + _ encoding.ProtoUnmarshaler = (*Primitives)(nil) + _ json.Marshaler = (*Primitives)(nil) + _ json.Unmarshaler = (*Primitives)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *Primitives) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.BytesSize(1, x.FieldA) + size += proto.StringSize(2, x.FieldB) + size += proto.BoolSize(200, x.FieldC) + size += proto.Int32Size(201, x.FieldD) + size += proto.UInt32Size(202, x.FieldE) + size += proto.Int64Size(203, x.FieldF) + size += proto.UInt64Size(204, x.FieldG) + size += proto.Fixed64Size(205, x.FieldI) + size += proto.Float64Size(206, x.FieldJ) + size += proto.Fixed32Size(207, x.FieldK) + size += proto.EnumSize(300, int32(x.FieldH)) + return size +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *Primitives) 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 *Primitives) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if len(x.FieldA) != 0 { + mm.AppendBytes(1, x.FieldA) + } + if len(x.FieldB) != 0 { + mm.AppendString(2, x.FieldB) + } + if x.FieldC { + mm.AppendBool(200, x.FieldC) + } + if x.FieldD != 0 { + mm.AppendInt32(201, x.FieldD) + } + if x.FieldE != 0 { + mm.AppendUint32(202, x.FieldE) + } + if x.FieldF != 0 { + mm.AppendInt64(203, x.FieldF) + } + if x.FieldG != 0 { + mm.AppendUint64(204, x.FieldG) + } + if x.FieldI != 0 { + mm.AppendFixed64(205, x.FieldI) + } + if x.FieldJ != 0 { + mm.AppendDouble(206, x.FieldJ) + } + if x.FieldK != 0 { + mm.AppendFixed32(207, x.FieldK) + } + if int32(x.FieldH) != 0 { + mm.AppendInt32(300, int32(x.FieldH)) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *Primitives) 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", "Primitives") + } + switch fc.FieldNum { + case 1: // FieldA + data, ok := fc.Bytes() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "FieldA") + } + x.FieldA = data + case 2: // FieldB + data, ok := fc.String() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "FieldB") + } + x.FieldB = data + case 200: // FieldC + data, ok := fc.Bool() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "FieldC") + } + x.FieldC = data + case 201: // FieldD + data, ok := fc.Int32() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "FieldD") + } + x.FieldD = data + case 202: // FieldE + data, ok := fc.Uint32() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "FieldE") + } + x.FieldE = data + case 203: // FieldF + data, ok := fc.Int64() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "FieldF") + } + x.FieldF = data + case 204: // FieldG + data, ok := fc.Uint64() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "FieldG") + } + x.FieldG = data + case 205: // FieldI + data, ok := fc.Fixed64() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "FieldI") + } + x.FieldI = data + case 206: // FieldJ + data, ok := fc.Double() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "FieldJ") + } + x.FieldJ = data + case 207: // FieldK + data, ok := fc.Fixed32() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "FieldK") + } + x.FieldK = data + case 300: // FieldH + data, ok := fc.Int32() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "FieldH") + } + x.FieldH = Primitives_SomeEnum(data) + } + } + return nil +} +func (x *Primitives) GetFieldA() []byte { + if x != nil { + return x.FieldA + } + return nil +} +func (x *Primitives) SetFieldA(v []byte) { + x.FieldA = v +} +func (x *Primitives) GetFieldB() string { + if x != nil { + return x.FieldB + } + return "" +} +func (x *Primitives) SetFieldB(v string) { + x.FieldB = v +} +func (x *Primitives) GetFieldC() bool { + if x != nil { + return x.FieldC + } + return false +} +func (x *Primitives) SetFieldC(v bool) { + x.FieldC = v +} +func (x *Primitives) GetFieldD() int32 { + if x != nil { + return x.FieldD + } + return 0 +} +func (x *Primitives) SetFieldD(v int32) { + x.FieldD = v +} +func (x *Primitives) GetFieldE() uint32 { + if x != nil { + return x.FieldE + } + return 0 +} +func (x *Primitives) SetFieldE(v uint32) { + x.FieldE = v +} +func (x *Primitives) GetFieldF() int64 { + if x != nil { + return x.FieldF + } + return 0 +} +func (x *Primitives) SetFieldF(v int64) { + x.FieldF = v +} +func (x *Primitives) GetFieldG() uint64 { + if x != nil { + return x.FieldG + } + return 0 +} +func (x *Primitives) SetFieldG(v uint64) { + x.FieldG = v +} +func (x *Primitives) GetFieldI() uint64 { + if x != nil { + return x.FieldI + } + return 0 +} +func (x *Primitives) SetFieldI(v uint64) { + x.FieldI = v +} +func (x *Primitives) GetFieldJ() float64 { + if x != nil { + return x.FieldJ + } + return 0 +} +func (x *Primitives) SetFieldJ(v float64) { + x.FieldJ = v +} +func (x *Primitives) GetFieldK() uint32 { + if x != nil { + return x.FieldK + } + return 0 +} +func (x *Primitives) SetFieldK(v uint32) { + x.FieldK = v +} +func (x *Primitives) GetFieldH() Primitives_SomeEnum { + if x != nil { + return x.FieldH + } + return 0 +} +func (x *Primitives) SetFieldH(v Primitives_SomeEnum) { + x.FieldH = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *Primitives) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *Primitives) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"fieldA\":" + out.RawString(prefix[1:]) + out.Base64Bytes(x.FieldA) + } + { + const prefix string = ",\"fieldB\":" + out.RawString(prefix) + out.String(x.FieldB) + } + { + const prefix string = ",\"fieldC\":" + out.RawString(prefix) + out.Bool(x.FieldC) + } + { + const prefix string = ",\"fieldD\":" + out.RawString(prefix) + out.Int32(x.FieldD) + } + { + const prefix string = ",\"fieldE\":" + out.RawString(prefix) + out.Uint32(x.FieldE) + } + { + const prefix string = ",\"fieldF\":" + out.RawString(prefix) + out.Int64(x.FieldF) + } + { + const prefix string = ",\"fieldG\":" + out.RawString(prefix) + out.Uint64(x.FieldG) + } + { + const prefix string = ",\"fieldI\":" + out.RawString(prefix) + out.Uint64(x.FieldI) + } + { + const prefix string = ",\"fieldJ\":" + out.RawString(prefix) + out.Float64(x.FieldJ) + } + { + const prefix string = ",\"fieldK\":" + out.RawString(prefix) + out.Uint32(x.FieldK) + } + { + const prefix string = ",\"fieldH\":" + out.RawString(prefix) + out.Int32(int32(x.FieldH)) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *Primitives) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *Primitives) 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 "fieldA": + { + var f []byte + f = in.Bytes() + x.FieldA = f + } + case "fieldB": + { + var f string + f = in.String() + x.FieldB = f + } + case "fieldC": + { + var f bool + f = in.Bool() + x.FieldC = f + } + case "fieldD": + { + var f int32 + f = in.Int32() + x.FieldD = f + } + case "fieldE": + { + var f uint32 + f = in.Uint32() + x.FieldE = f + } + case "fieldF": + { + var f int64 + f = in.Int64() + x.FieldF = f + } + case "fieldG": + { + var f uint64 + f = in.Uint64() + x.FieldG = f + } + case "fieldI": + { + var f uint64 + f = in.Uint64() + x.FieldI = f + } + case "fieldJ": + { + var f float64 + f = in.Float64() + x.FieldJ = f + } + case "fieldK": + { + var f uint32 + f = in.Uint32() + x.FieldK = f + } + case "fieldH": + { + var f Primitives_SomeEnum + var parsedValue Primitives_SomeEnum + switch v := in.Interface().(type) { + case string: + if vv, ok := Primitives_SomeEnum_value[v]; ok { + parsedValue = Primitives_SomeEnum(vv) + break + } + vv, err := strconv.ParseInt(v, 10, 32) + if err != nil { + in.AddError(err) + return + } + parsedValue = Primitives_SomeEnum(vv) + case float64: + parsedValue = Primitives_SomeEnum(v) + } + f = parsedValue + x.FieldH = f + } + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} + +type RepPrimitives struct { + FieldA [][]byte `json:"fieldA"` + FieldB []string `json:"fieldB"` + FieldC []int32 `json:"fieldC"` + FieldD []uint32 `json:"fieldD"` + FieldE []int64 `json:"fieldE"` + FieldF []uint64 `json:"fieldF"` + FieldFu []uint64 `json:"fieldFu"` +} + +var ( + _ encoding.ProtoMarshaler = (*RepPrimitives)(nil) + _ encoding.ProtoUnmarshaler = (*RepPrimitives)(nil) + _ json.Marshaler = (*RepPrimitives)(nil) + _ json.Unmarshaler = (*RepPrimitives)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *RepPrimitives) StableSize() (size int) { + if x == nil { + return 0 + } + var n int + size += proto.RepeatedBytesSize(1, x.FieldA) + size += proto.RepeatedStringSize(2, x.FieldB) + n, _ = proto.RepeatedInt32Size(3, x.FieldC) + size += n + n, _ = proto.RepeatedUInt32Size(4, x.FieldD) + size += n + n, _ = proto.RepeatedInt64Size(5, x.FieldE) + size += n + n, _ = proto.RepeatedUInt64Size(6, x.FieldF) + size += n + for i := range x.FieldFu { + size += protowire.SizeGroup(protowire.Number(7), protowire.SizeVarint(x.FieldFu[i])) + } + return size +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *RepPrimitives) 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 *RepPrimitives) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + for j := range x.FieldA { + mm.AppendBytes(1, x.FieldA[j]) + } + for j := range x.FieldB { + mm.AppendString(2, x.FieldB[j]) + } + if len(x.FieldC) != 0 { + mm.AppendInt32s(3, x.FieldC) + } + if len(x.FieldD) != 0 { + mm.AppendUint32s(4, x.FieldD) + } + if len(x.FieldE) != 0 { + mm.AppendInt64s(5, x.FieldE) + } + if len(x.FieldF) != 0 { + mm.AppendUint64s(6, x.FieldF) + } + for j := range x.FieldFu { + mm.AppendUint64(7, x.FieldFu[j]) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *RepPrimitives) 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", "RepPrimitives") + } + switch fc.FieldNum { + case 1: // FieldA + data, ok := fc.Bytes() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "FieldA") + } + x.FieldA = append(x.FieldA, data) + case 2: // FieldB + data, ok := fc.String() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "FieldB") + } + x.FieldB = append(x.FieldB, data) + case 3: // FieldC + data, ok := fc.UnpackInt32s(nil) + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "FieldC") + } + x.FieldC = data + case 4: // FieldD + data, ok := fc.UnpackUint32s(nil) + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "FieldD") + } + x.FieldD = data + case 5: // FieldE + data, ok := fc.UnpackInt64s(nil) + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "FieldE") + } + x.FieldE = data + case 6: // FieldF + data, ok := fc.UnpackUint64s(nil) + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "FieldF") + } + x.FieldF = data + case 7: // FieldFu + data, ok := fc.Uint64() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "FieldFu") + } + x.FieldFu = append(x.FieldFu, data) + } + } + return nil +} +func (x *RepPrimitives) GetFieldA() [][]byte { + if x != nil { + return x.FieldA + } + return nil +} +func (x *RepPrimitives) SetFieldA(v [][]byte) { + x.FieldA = v +} +func (x *RepPrimitives) GetFieldB() []string { + if x != nil { + return x.FieldB + } + return nil +} +func (x *RepPrimitives) SetFieldB(v []string) { + x.FieldB = v +} +func (x *RepPrimitives) GetFieldC() []int32 { + if x != nil { + return x.FieldC + } + return nil +} +func (x *RepPrimitives) SetFieldC(v []int32) { + x.FieldC = v +} +func (x *RepPrimitives) GetFieldD() []uint32 { + if x != nil { + return x.FieldD + } + return nil +} +func (x *RepPrimitives) SetFieldD(v []uint32) { + x.FieldD = v +} +func (x *RepPrimitives) GetFieldE() []int64 { + if x != nil { + return x.FieldE + } + return nil +} +func (x *RepPrimitives) SetFieldE(v []int64) { + x.FieldE = v +} +func (x *RepPrimitives) GetFieldF() []uint64 { + if x != nil { + return x.FieldF + } + return nil +} +func (x *RepPrimitives) SetFieldF(v []uint64) { + x.FieldF = v +} +func (x *RepPrimitives) GetFieldFu() []uint64 { + if x != nil { + return x.FieldFu + } + return nil +} +func (x *RepPrimitives) SetFieldFu(v []uint64) { + x.FieldFu = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *RepPrimitives) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *RepPrimitives) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"fieldA\":" + out.RawString(prefix[1:]) + out.RawByte('[') + for i := range x.FieldA { + if i != 0 { + out.RawByte(',') + } + out.Base64Bytes(x.FieldA[i]) + } + out.RawByte(']') + } + { + const prefix string = ",\"fieldB\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.FieldB { + if i != 0 { + out.RawByte(',') + } + out.String(x.FieldB[i]) + } + out.RawByte(']') + } + { + const prefix string = ",\"fieldC\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.FieldC { + if i != 0 { + out.RawByte(',') + } + out.Int32(x.FieldC[i]) + } + out.RawByte(']') + } + { + const prefix string = ",\"fieldD\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.FieldD { + if i != 0 { + out.RawByte(',') + } + out.Uint32(x.FieldD[i]) + } + out.RawByte(']') + } + { + const prefix string = ",\"fieldE\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.FieldE { + if i != 0 { + out.RawByte(',') + } + out.Int64(x.FieldE[i]) + } + out.RawByte(']') + } + { + const prefix string = ",\"fieldF\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.FieldF { + if i != 0 { + out.RawByte(',') + } + out.Uint64(x.FieldF[i]) + } + out.RawByte(']') + } + { + const prefix string = ",\"fieldFu\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.FieldFu { + if i != 0 { + out.RawByte(',') + } + out.Uint64(x.FieldFu[i]) + } + out.RawByte(']') + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *RepPrimitives) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *RepPrimitives) 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 "fieldA": + { + var f []byte + var list [][]byte + in.Delim('[') + for !in.IsDelim(']') { + f = in.Bytes() + list = append(list, f) + in.WantComma() + } + x.FieldA = list + in.Delim(']') + } + case "fieldB": + { + var f string + var list []string + in.Delim('[') + for !in.IsDelim(']') { + f = in.String() + list = append(list, f) + in.WantComma() + } + x.FieldB = list + in.Delim(']') + } + case "fieldC": + { + var f int32 + var list []int32 + in.Delim('[') + for !in.IsDelim(']') { + f = in.Int32() + list = append(list, f) + in.WantComma() + } + x.FieldC = list + in.Delim(']') + } + case "fieldD": + { + var f uint32 + var list []uint32 + in.Delim('[') + for !in.IsDelim(']') { + f = in.Uint32() + list = append(list, f) + in.WantComma() + } + x.FieldD = list + in.Delim(']') + } + case "fieldE": + { + var f int64 + var list []int64 + in.Delim('[') + for !in.IsDelim(']') { + f = in.Int64() + list = append(list, f) + in.WantComma() + } + x.FieldE = list + in.Delim(']') + } + case "fieldF": + { + var f uint64 + var list []uint64 + in.Delim('[') + for !in.IsDelim(']') { + f = in.Uint64() + list = append(list, f) + in.WantComma() + } + x.FieldF = list + in.Delim(']') + } + case "fieldFu": + { + var f uint64 + var list []uint64 + in.Delim('[') + for !in.IsDelim(']') { + f = in.Uint64() + list = append(list, f) + in.WantComma() + } + x.FieldFu = list + in.Delim(']') + } + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} diff --git a/util/proto/test/test_frostfs.pb.go b/util/proto/test/test_frostfs.pb.go deleted file mode 100644 index 47c6d60..0000000 --- a/util/proto/test/test_frostfs.pb.go +++ /dev/null @@ -1,117 +0,0 @@ -// Code generated by protoc-gen-go-frostfs. DO NOT EDIT. - -package test - -import ( - binary "encoding/binary" - protowire "google.golang.org/protobuf/encoding/protowire" -) - -import "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/proto" - -// StableSize returns the size of x in protobuf format. -// -// Structures with the same field values have the same binary size. -func (x *Primitives) StableSize() (size int) { - if x == nil { - return 0 - } - size += proto.BytesSize(1, x.FieldA) - size += proto.StringSize(2, x.FieldB) - size += proto.BoolSize(200, x.FieldC) - size += proto.Int32Size(201, x.FieldD) - size += proto.UInt32Size(202, x.FieldE) - size += proto.Int64Size(203, x.FieldF) - size += proto.UInt64Size(204, x.FieldG) - size += proto.Fixed64Size(205, x.FieldI) - size += proto.Float64Size(206, x.FieldJ) - size += proto.Fixed32Size(207, x.FieldK) - size += proto.EnumSize(300, int32(x.FieldH)) - return size -} - -// StableMarshal marshals x in protobuf binary format with stable field order. -// -// If buffer length is less than x.StableSize(), 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 binary format. -func (x *Primitives) StableMarshal(buf []byte) []byte { - if x == nil { - return []byte{} - } - if buf == nil { - buf = make([]byte, x.StableSize()) - } - var offset int - offset += proto.BytesMarshal(1, buf[offset:], x.FieldA) - offset += proto.StringMarshal(2, buf[offset:], x.FieldB) - offset += proto.BoolMarshal(200, buf[offset:], x.FieldC) - offset += proto.Int32Marshal(201, buf[offset:], x.FieldD) - offset += proto.UInt32Marshal(202, buf[offset:], x.FieldE) - offset += proto.Int64Marshal(203, buf[offset:], x.FieldF) - offset += proto.UInt64Marshal(204, buf[offset:], x.FieldG) - offset += proto.Fixed64Marshal(205, buf[offset:], x.FieldI) - offset += proto.Float64Marshal(206, buf[offset:], x.FieldJ) - offset += proto.Fixed32Marshal(207, buf[offset:], x.FieldK) - offset += proto.EnumMarshal(300, buf[offset:], int32(x.FieldH)) - return buf -} - -// StableSize returns the size of x in protobuf format. -// -// Structures with the same field values have the same binary size. -func (x *RepPrimitives) StableSize() (size int) { - if x == nil { - return 0 - } - var n int - size += proto.RepeatedBytesSize(1, x.FieldA) - size += proto.RepeatedStringSize(2, x.FieldB) - n, _ = proto.RepeatedInt32Size(3, x.FieldC) - size += n - n, _ = proto.RepeatedUInt32Size(4, x.FieldD) - size += n - n, _ = proto.RepeatedInt64Size(5, x.FieldE) - size += n - n, _ = proto.RepeatedUInt64Size(6, x.FieldF) - size += n - for i := range x.FieldFu { - size += protowire.SizeGroup(protowire.Number(7), protowire.SizeVarint(x.FieldFu[i])) - } - return size -} - -// StableMarshal marshals x in protobuf binary format with stable field order. -// -// If buffer length is less than x.StableSize(), 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 binary format. -func (x *RepPrimitives) StableMarshal(buf []byte) []byte { - if x == nil { - return []byte{} - } - if buf == nil { - buf = make([]byte, x.StableSize()) - } - var offset int - offset += proto.RepeatedBytesMarshal(1, buf[offset:], x.FieldA) - offset += proto.RepeatedStringMarshal(2, buf[offset:], x.FieldB) - offset += proto.RepeatedInt32Marshal(3, buf[offset:], x.FieldC) - offset += proto.RepeatedUInt32Marshal(4, buf[offset:], x.FieldD) - offset += proto.RepeatedInt64Marshal(5, buf[offset:], x.FieldE) - offset += proto.RepeatedUInt64Marshal(6, buf[offset:], x.FieldF) - for i := range x.FieldFu { - { - prefix := protowire.EncodeTag(protowire.Number(7), protowire.VarintType) - offset += binary.PutUvarint(buf[offset:], uint64(prefix)) - offset += binary.PutUvarint(buf[offset:], x.FieldFu[i]) - } - } - return buf -} diff --git a/util/protogen/internalgengo/file.go b/util/protogen/internalgengo/file.go new file mode 100644 index 0000000..b5b351c --- /dev/null +++ b/util/protogen/internalgengo/file.go @@ -0,0 +1,250 @@ +package internalgengo + +import ( + "fmt" + "sort" + "strconv" + "strings" + + "google.golang.org/protobuf/compiler/protogen" + "google.golang.org/protobuf/reflect/protoreflect" +) + +var ( + strconvPackage = protogen.GoImportPath("strconv") + fmtPackage = protogen.GoImportPath("fmt") + jsonPackage = protogen.GoImportPath("encoding/json") + easyprotoPackage = protogen.GoImportPath("github.com/VictoriaMetrics/easyproto") + mpPackage = protogen.GoImportPath("git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/pool") + protoPackage = protogen.GoImportPath("git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/proto") + encodingPackage = protogen.GoImportPath("git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/proto/encoding") + + mp = mpPackage.Ident("MarshalerPool") +) + +// GenerateFile generates a *.pb.go file enforcing field-order serialization. +func GenerateFile(gen *protogen.Plugin, file *protogen.File) *protogen.GeneratedFile { + filename := file.GeneratedFilenamePrefix + "_frostfs.pb.go" + g := gen.NewGeneratedFile(filename, file.GoImportPath) + + g.P("// Code generated by protoc-gen-go-frostfs. DO NOT EDIT.") + g.P() + g.P("package ", file.GoPackageName) + g.P() + g.Import(encodingPackage) + + // Doesn't work for multiple files in a single package, use external pool. + // g.P("var mp ", easyprotoPackage.Ident("MarshalerPool")) + + for _, e := range file.Enums { + emitEnum(g, e) + } + for _, msg := range file.Messages { + emitEasyProto(g, msg) + } + return g +} + +func emitEnum(g *protogen.GeneratedFile, e *protogen.Enum) { + g.P("type " + e.GoIdent.GoName + " int32") + g.P("const (") + for _, ev := range e.Values { + g.P(ev.GoIdent.GoName, " ", e.GoIdent.GoName, " = ", ev.Desc.Number()) + } + g.P(")") + + g.P("var (") + g.P(e.GoIdent.GoName+"_name", " = map[int32]string{") + for _, value := range e.Values { + g.P(value.Desc.Number(), ": ", strconv.Quote(string(value.Desc.Name())), ",") + } + g.P("}") + g.P(e.GoIdent.GoName+"_value", " = map[string]int32{") + for _, value := range e.Values { + g.P(strconv.Quote(string(value.Desc.Name())), ": ", value.Desc.Number(), ",") + } + g.P("}") + g.P(")") + g.P() + + g.P("func (x ", e.GoIdent.GoName, ") String() string {") + g.P("if v, ok := ", e.GoIdent.GoName+"_name[int32(x)]; ok {") + g.P("return v") + g.P("}") + g.P("return ", strconvPackage.Ident("FormatInt"), "(int64(x), 10)") + g.P("}") + + g.P("func (x *", e.GoIdent.GoName, ") FromString(s string) bool {") + g.P("if v, ok := ", e.GoIdent.GoName+"_value[s]; ok {") + g.P("*x = ", e.GoIdent.GoName, "(v)") + g.P("return true") + g.P("}") + g.P("return false") + g.P("}") +} + +func emitEasyProto(g *protogen.GeneratedFile, msg *protogen.Message) { + for _, e := range msg.Enums { + emitEnum(g, e) + } + for _, m := range msg.Messages { + emitEasyProto(g, m) + } + + g.P("type " + msg.GoIdent.GoName + " struct {") + emitMessageFields(g, msg) + g.P("}") + + g.P("var (") + g.P("_ ", encodingPackage.Ident("ProtoMarshaler"), " = (*", msg.GoIdent.GoName, ")(nil)") + g.P("_ ", encodingPackage.Ident("ProtoUnmarshaler"), " = (*", msg.GoIdent.GoName, ")(nil)") + g.P("_ ", jsonPackage.Ident("Marshaler"), " = (*", msg.GoIdent.GoName, ")(nil)") + g.P("_ ", jsonPackage.Ident("Unmarshaler"), " = (*", msg.GoIdent.GoName, ")(nil)") + g.P(")") + + emitStableSize(g, msg) + if strings.HasSuffix(msg.GoIdent.GoName, "Request") || strings.HasSuffix(msg.GoIdent.GoName, "Response") { + emitSignatureMethods(g, msg) + } + + emitProtoMethods(g, msg) + emitGettersSetters(g, msg) + emitJSONMethods(g, msg) + + for _, f := range msg.Fields { + if isFirstOneof(f) { + genOneof(g, f) + } + } +} + +func isFirstOneof(f *protogen.Field) bool { + return f.Oneof != nil && f == f.Oneof.Fields[0] +} + +func emitOneofGettersSetters(g *protogen.GeneratedFile, msg *protogen.Message, ff *protogen.Field) { + // For some reason protoc generates different code for oneof message/non-message fields: + // 1. For message we have 2 level struct wrapping and setters use inner type. + // 2. For other types we also have 2 level wrapping, but setters use outer type. + if ff.Desc.Kind() == protoreflect.MessageKind { + ft := fieldType(g, ff) + + g.P("func (x *", msg.GoIdent.GoName, ") Get", ff.GoName, "() ", ft, " {") + g.P("if xx, ok := x.Get", ff.Oneof.GoName, "().(*", ff.GoIdent, "); ok { return xx.", ff.GoName, " }") + g.P("return nil") + g.P("}") + + g.P("func (x *", msg.GoIdent.GoName, ") Set", ff.GoName, "(v ", ft, ") {") + g.P("x.", ff.Oneof.GoName, " = &", ff.GoIdent, "{", ff.GoName, ": v}") + g.P("}") + } else { + g.P("func (x *", msg.GoIdent.GoName, ") Get", ff.GoName, "() *", ff.GoIdent, " {") + g.P("if xx, ok := x.Get", ff.Oneof.GoName, "().(*", ff.GoIdent, "); ok { return xx }") + g.P("return nil") + g.P("}") + + g.P("func (x *", msg.GoIdent.GoName, ") Set", ff.GoName, "(v *", ff.GoIdent, ") {") + g.P("x.", ff.Oneof.GoName, " = v") + g.P("}") + + ft := fieldType(g, ff) + emitGetterSetter(g, ff.GoIdent.GoName, ff.GoName, ft.String(), "nil") + } +} + +func emitGettersSetters(g *protogen.GeneratedFile, msg *protogen.Message) { + for _, f := range msg.Fields { + if f.Oneof != nil { + if f.Oneof.Fields[0] == f { + emitGetterSetter(g, msg.GoIdent.GoName, f.Oneof.GoName, oneOfDescriptor(f.Oneof), "nil") + for _, ff := range f.Oneof.Fields { + emitOneofGettersSetters(g, msg, ff) + } + } + continue + } + + ft := fieldType(g, f) + emitGetterSetter(g, msg.GoIdent.GoName, f.GoName, ft.String(), fieldDefaultValue(f)) + } +} + +func emitMessageFields(g *protogen.GeneratedFile, msg *protogen.Message) { + for _, field := range msg.Fields { + genMessageField(g, field) + } +} + +func genMessageField(g *protogen.GeneratedFile, field *protogen.Field) { + if field.Oneof != nil { + if field.Oneof.Fields[0] == field { + g.P(field.Oneof.GoName, " ", oneOfDescriptor(field.Oneof)) + } + return + } + + typ := fieldType(g, field) + g.P(field.GoName, " ", typ, fmt.Sprintf(" `json:%q`", fieldJSONName(field))) +} + +func oneOfDescriptor(oneof *protogen.Oneof) string { + return "is" + oneof.GoIdent.GoName +} + +func genOneof(g *protogen.GeneratedFile, field *protogen.Field) { + ifName := oneOfDescriptor(field.Oneof) + g.P("type ", ifName, " interface {") + g.P(ifName, "()") + g.P("}") + g.P() + for _, field := range field.Oneof.Fields { + g.P("type ", field.GoIdent, " struct {") + + ft := fieldType(g, field) + g.P(field.GoName, " ", ft) + g.P("}") + g.P() + } + for _, field := range field.Oneof.Fields { + g.P("func (*", field.GoIdent, ") ", ifName, "() {}") + g.P() + } +} + +func fieldDefaultValue(field *protogen.Field) string { + if field.Desc.Cardinality() == protoreflect.Repeated { + return "nil" + } + + switch field.Desc.Kind() { + case protoreflect.MessageKind, protoreflect.BytesKind: + return "nil" + case protoreflect.BoolKind: + return "false" + case protoreflect.StringKind: + return `""` + default: + return "0" + } +} + +func castFieldName(f *protogen.Field) string { + if f.Oneof != nil { + return "x." + f.Oneof.GoName + } + + name := "x." + f.GoName + if f.Desc.Kind() != protoreflect.EnumKind { + return name + } + return "int32(" + name + ")" +} + +func sortFields(fs []*protogen.Field) []*protogen.Field { + res := make([]*protogen.Field, len(fs)) + copy(res, fs) + sort.Slice(res, func(i, j int) bool { + return res[i].Desc.Number() < res[j].Desc.Number() + }) + return res +} diff --git a/util/protogen/internalgengo/fuzz.go b/util/protogen/internalgengo/fuzz.go new file mode 100644 index 0000000..ec99692 --- /dev/null +++ b/util/protogen/internalgengo/fuzz.go @@ -0,0 +1,69 @@ +package internalgengo + +import ( + "google.golang.org/protobuf/compiler/protogen" +) + +var testingPackage = protogen.GoImportPath("testing") + +func GenerateFuzzTests(gen *protogen.Plugin, file *protogen.File) { + { + filename := file.GeneratedFilenamePrefix + "_frostfs_fuzz.go" + g := gen.NewGeneratedFile(filename, file.GoImportPath) + + g.P("//go:build gofuzz") + g.P("// +build gofuzz") + g.P("// Code generated by protoc-gen-go-frostfs. DO NOT EDIT.") + g.P() + g.P("package ", file.GoPackageName) + g.P() + + for _, msg := range file.Messages { + emitFuzzWrappers(g, msg) + } + } + { + filename := file.GeneratedFilenamePrefix + "_frostfs_test.go" + g := gen.NewGeneratedFile(filename, file.GoImportPath) + + g.P("//go:build gofuzz") + g.P("// +build gofuzz") + g.P("// Code generated by protoc-gen-go-frostfs. DO NOT EDIT.") + g.P() + g.P("package ", file.GoPackageName) + g.P() + + for _, msg := range file.Messages { + emitFuzzTests(g, msg) + } + } +} + +func emitFuzzWrappers(g *protogen.GeneratedFile, msg *protogen.Message) { + g.P("func DoFuzzProto", msg.GoIdent.GoName, "(data []byte) int {") + g.P("msg := new(", msg.GoIdent.GoName, ")") + g.P("if err := msg.UnmarshalProtobuf(data); err != nil { return 0 }") + g.P("_ = msg.MarshalProtobuf(nil)") + g.P("return 1") + g.P("}") + + g.P("func DoFuzzJSON", msg.GoIdent.GoName, "(data []byte) int {") + g.P("msg := new(", msg.GoIdent.GoName, ")") + g.P("if err := msg.UnmarshalJSON(data); err != nil { return 0 }") + g.P("_, err := msg.MarshalJSON()") + g.P("if err != nil { panic(err) }") + g.P("return 1") + g.P("}") +} + +func emitFuzzTests(g *protogen.GeneratedFile, msg *protogen.Message) { + g.P("func FuzzProto", msg.GoIdent.GoName, "(f *", testingPackage.Ident("F"), ") {") + g.P("f.Fuzz(func(t *", testingPackage.Ident("T"), ", data []byte) {") + g.P("DoFuzzProto", msg.GoIdent.GoName, "(data)") + g.P("})}") + + g.P("func FuzzJSON", msg.GoIdent.GoName, "(f *", testingPackage.Ident("F"), ") {") + g.P("f.Fuzz(func(t *", testingPackage.Ident("T"), ", data []byte) {") + g.P("DoFuzzJSON", msg.GoIdent.GoName, "(data)") + g.P("})}") +} diff --git a/util/protogen/internalgengo/getter.go b/util/protogen/internalgengo/getter.go new file mode 100644 index 0000000..78deef7 --- /dev/null +++ b/util/protogen/internalgengo/getter.go @@ -0,0 +1,14 @@ +package internalgengo + +import "google.golang.org/protobuf/compiler/protogen" + +func emitGetterSetter(g *protogen.GeneratedFile, typeName string, fieldName string, fieldType string, defaultValue string) { + g.P("func (x *", typeName, ") Get", fieldName, "() ", fieldType, " {") + g.P("if x != nil { return x.", fieldName, "}") + g.P("return ", defaultValue) + g.P("}") + + g.P("func (x *", typeName, ") Set", fieldName, "(v ", fieldType, ") {") + g.P("x.", fieldName, " = v") + g.P("}") +} diff --git a/util/protogen/internalgengo/json.go b/util/protogen/internalgengo/json.go new file mode 100644 index 0000000..ad43fc8 --- /dev/null +++ b/util/protogen/internalgengo/json.go @@ -0,0 +1,230 @@ +package internalgengo + +import ( + "fmt" + + "google.golang.org/protobuf/compiler/protogen" + "google.golang.org/protobuf/reflect/protoreflect" +) + +var ( + jwriterPackage = protogen.GoImportPath("github.com/mailru/easyjson/jwriter") + jlexerPackage = protogen.GoImportPath("github.com/mailru/easyjson/jlexer") +) + +func emitJSONMethods(g *protogen.GeneratedFile, msg *protogen.Message) { + emitJSONMarshal(g, msg) + emitJSONUnmarshal(g, msg) +} + +func emitJSONUnmarshal(g *protogen.GeneratedFile, msg *protogen.Message) { + g.P("// UnmarshalJSON implements the json.Unmarshaler interface.") + g.P("func (x *", msg.GoIdent.GoName, ") UnmarshalJSON(data []byte) error {") + g.P("r := ", jlexerPackage.Ident("Lexer"), "{Data: data}") + g.P("x.UnmarshalEasyJSON(&r)") + g.P("return r.Error()") + g.P("}") + + g.P("func (x *", msg.GoIdent.GoName, ") UnmarshalEasyJSON(in *", jlexerPackage.Ident("Lexer"), ") {") + + g.P("isTopLevel := in.IsStart()") + g.P("if in.IsNull() {") + g.P("if isTopLevel { in.Consumed() }") + g.P("in.Skip()") + g.P("return") + g.P("}") + + g.P("in.Delim('{')") + g.P("for !in.IsDelim('}') {") + + g.P("key := in.UnsafeFieldName(false)") + g.P("in.WantColon()") + g.P("if in.IsNull() { in.Skip(); in.WantComma(); continue }") + g.P("switch key {") + for _, f := range msg.Fields { + g.P(`case "`, fieldJSONName(f), `":`) + if f.Oneof != nil { + g.P("xx := new(", f.GoIdent, ")") + g.P("x." + f.Oneof.GoName + " = xx") + emitJSONFieldRead(g, f, "xx") + continue + } + emitJSONFieldRead(g, f, "x") + } + g.P("}") + g.P("in.WantComma()") + g.P("}") + g.P("in.Delim('}')") + g.P("if isTopLevel { in.Consumed() }") + g.P("}") +} + +func emitJSONFieldRead(g *protogen.GeneratedFile, f *protogen.Field, name string) { + g.P("{") + defer g.P("}") + + if f.Desc.IsList() { + g.P("var f ", fieldType(g, f)[2:]) + g.P("var list ", fieldType(g, f)) + g.P("in.Delim('[')") + defer g.P("in.Delim(']')") + + g.P("for !in.IsDelim(']') {") + } else { + g.P("var f ", fieldType(g, f)) + } + + var template string + switch f.Desc.Kind() { + case protoreflect.BoolKind: + template = "%s = in.Bool()" + case protoreflect.EnumKind: + g.Import(strconvPackage) + + enumType := fieldType(g, f).String() + g.P("var parsedValue " + enumType) + g.P(`switch v := in.Interface().(type) { + case string: + if vv, ok := `+enumType+`_value[v]; ok { + parsedValue = `+enumType+`(vv) + break + } + vv, err := `, strconvPackage.Ident("ParseInt"), `(v, 10, 32) + if err != nil { + in.AddError(err) + return + } + parsedValue = `+enumType+`(vv) + case float64: + parsedValue = `+enumType+`(v) + }`) + template = "%s = parsedValue" + case protoreflect.Int32Kind, protoreflect.Sint32Kind, protoreflect.Sfixed32Kind: + template = "%s = in.Int32()" + case protoreflect.Uint32Kind, protoreflect.Fixed32Kind: + template = "%s = in.Uint32()" + case protoreflect.Int64Kind, protoreflect.Sint64Kind, protoreflect.Sfixed64Kind: + template = "%s = in.Int64()" + case protoreflect.Uint64Kind, protoreflect.Fixed64Kind: + template = "%s = in.Uint64()" + case protoreflect.FloatKind: + template = "%s = in.Float32()" + case protoreflect.DoubleKind: + template = "%s = in.Float64()" + case protoreflect.StringKind: + template = "%s = in.String()" + case protoreflect.BytesKind: + template = "%s = in.Bytes()" + case protoreflect.MessageKind: + if f.Desc.IsList() { + g.P("f = new(", fieldType(g, f)[3:], ")") + } else { + g.P("f = new(", fieldType(g, f)[1:], ")") + } + template = "%s.UnmarshalEasyJSON(in)" + case protoreflect.GroupKind: + panic("unimplemented") + } + g.P(fmt.Sprintf(template, "f")) + if f.Desc.IsList() { + g.P("list = append(list, f)") + g.P("in.WantComma()") + g.P("}") + g.P(name, ".", f.GoName, " = list") + } else { + g.P(name, ".", f.GoName, " = f") + } +} + +func emitJSONMarshal(g *protogen.GeneratedFile, msg *protogen.Message) { + g.P("// MarshalJSON implements the json.Marshaler interface.") + g.P("func (x *", msg.GoIdent.GoName, ") MarshalJSON() ([]byte, error) {") + g.P("w := ", jwriterPackage.Ident("Writer"), "{}") + g.P("x.MarshalEasyJSON(&w)") + g.P("return w.Buffer.BuildBytes(), w.Error") + g.P("}") + + g.P("func (x *", msg.GoIdent.GoName, ") MarshalEasyJSON(out *", jwriterPackage.Ident("Writer"), ") {") + g.P(`if x == nil { out.RawString("null"); return }`) + + g.P("out.RawByte('{')") + for i, f := range msg.Fields { + if f.Oneof != nil { + if f.Oneof.Fields[0] != f { + continue + } + + g.P("switch xx := x.", f.Oneof.GoName, ".(type) {") + for _, ff := range f.Oneof.Fields { + g.P("case *", ff.GoIdent, ":") + emitJSONFieldWrite(g, ff, "xx", i == 0) + } + g.P("default:") + g.P(`out.RawString("null")`) + g.P("}") + continue + } + emitJSONFieldWrite(g, f, "x", i == 0) + } + g.P("out.RawByte('}')") + g.P("}") +} + +func emitJSONFieldWrite(g *protogen.GeneratedFile, f *protogen.Field, name string, first bool) { + g.P("{") + defer g.P("}") + + g.P("const prefix string = ", `",\"`, fieldJSONName(f), `\":"`) + if first { + g.P("out.RawString(prefix[1:])") + } else { + g.P("out.RawString(prefix)") + } + + selector := name + "." + f.GoName + if f.Desc.IsList() { + selector += "[i]" + g.P("out.RawByte('[')") + defer g.P("out.RawByte(']')") + + g.P("for i := range ", name, ".", f.GoName, " {") + g.P("if i != 0 { out.RawByte(',') }") + defer g.P("}") + } + + var template string + switch f.Desc.Kind() { + case protoreflect.BoolKind: + template = "out.Bool(%s)" + case protoreflect.EnumKind: + template = "out.Int32(int32(%s))" + case protoreflect.Int32Kind, protoreflect.Sint32Kind, protoreflect.Sfixed32Kind: + template = "out.Int32(%s)" + case protoreflect.Uint32Kind, protoreflect.Fixed32Kind: + template = "out.Uint32(%s)" + case protoreflect.Int64Kind, protoreflect.Sint64Kind, protoreflect.Sfixed64Kind: + template = "out.Int64(%s)" + case protoreflect.Uint64Kind, protoreflect.Fixed64Kind: + template = "out.Uint64(%s)" + case protoreflect.FloatKind: + template = "out.Float32(%s)" + case protoreflect.DoubleKind: + template = "out.Float64(%s)" + case protoreflect.StringKind: + template = "out.String(%s)" + case protoreflect.BytesKind: + template = "out.Base64Bytes(%s)" + case protoreflect.MessageKind: + template = "%s.MarshalEasyJSON(out)" + case protoreflect.GroupKind: + panic("unimplemented") + } + g.P(fmt.Sprintf(template, selector)) +} + +func fieldJSONName(f *protogen.Field) string { + if f.Desc.HasJSONName() { + return f.Desc.JSONName() + } + return string(f.Desc.Name()) +} diff --git a/util/protogen/internalgengo/options.go b/util/protogen/internalgengo/options.go new file mode 100644 index 0000000..8aab8f0 --- /dev/null +++ b/util/protogen/internalgengo/options.go @@ -0,0 +1,7 @@ +package internalgengo + +type Options struct { + Fuzz bool `yaml:"fuzz"` + JSON bool `yaml:"json"` + MessageData []string `yaml:"message_data"` +} diff --git a/util/protogen/internalgengo/proto.go b/util/protogen/internalgengo/proto.go new file mode 100644 index 0000000..8e5e967 --- /dev/null +++ b/util/protogen/internalgengo/proto.go @@ -0,0 +1,201 @@ +package internalgengo + +import ( + "google.golang.org/protobuf/compiler/protogen" + "google.golang.org/protobuf/reflect/protoreflect" +) + +func emitProtoMethods(g *protogen.GeneratedFile, msg *protogen.Message) { + emitMarshalProtobuf(g, msg) + emitUnmarshalProtobuf(g, msg) +} + +func emitUnmarshalProtobuf(g *protogen.GeneratedFile, msg *protogen.Message) { + g.P("// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface.") + g.P("func (x *", msg.GoIdent.GoName, ") UnmarshalProtobuf(src []byte) (err error) {") + g.P("var fc ", easyprotoPackage.Ident("FieldContext")) + g.P("for len(src) > 0 {") + { + g.P("src, err = fc.NextField(src)") + g.P("if err != nil { return ", fmtPackage.Ident("Errorf"), `("cannot read next field in %s", "`, msg.GoIdent.GoName, `")}`) + g.P("switch fc.FieldNum {") + { + for _, f := range msg.Fields { + g.P("case ", f.Desc.Number(), ":", " // ", f.GoName) + emitFieldUnmarshal(g, f) + } + } + g.P("}") + } + g.P("}") + + g.P("return nil") + g.P("}") +} + +func emitFieldUnmarshal(g *protogen.GeneratedFile, f *protogen.Field) { + name := castFieldName(f) + if f.Desc.Kind() == protoreflect.MessageKind { + g.P("data, ok := fc.MessageData()") + g.P(`if !ok { return fmt.Errorf("cannot unmarshal field %s", "`, f.GoName, `") }`) + if f.Desc.IsList() { + g.P(name, " = append(", name, ", new(", fieldType(g, f)[3:], "))") + g.P("ff := ", name, "[len(", name, ")-1]") + name = "ff" + } else if f.Oneof != nil { + const tmp = "oneofField" + g.P(tmp, " := &", f.GoIdent, "{", f.GoName, ": ", "new(", fieldType(g, f)[1:], ")}") + defer g.P(name, " = ", tmp) + + name = tmp + "." + f.GoName + } else { + g.P(name, " = new(", fieldType(g, f)[1:], ")") + } + + g.P(`if err := `, name, `.UnmarshalProtobuf(data); err != nil { return fmt.Errorf("unmarshal: %w", err)}`) + return + } + + getter, _ := easyprotoKindInfo(f.Desc.Kind()) + + if f.Desc.IsList() && (f.Desc.Kind() == protoreflect.BytesKind || f.Desc.Kind() == protoreflect.StringKind || f.Desc.Kind() == protoreflect.Uint64Kind && !f.Desc.IsPacked()) { + g.P("data, ok := fc.", getter, "()") + g.P(`if !ok { return fmt.Errorf("cannot unmarshal field %s", "`, f.GoName, `") }`) + g.P(name, " = append(", name, ", data)") + return + } + + if f.Desc.IsList() { + g.P("data, ok := fc.Unpack", getter, "s(nil)") + } else { + g.P("data, ok := fc.", getter, "()") + } + + g.P(`if !ok { return fmt.Errorf("cannot unmarshal field %s", "`, f.GoName, `") }`) + value := "data" + if f.Desc.Kind() == protoreflect.EnumKind { + value = fieldType(g, f).String() + "(data)" + } + + if f.Oneof == nil { + g.P("x.", f.GoName, " = ", value) + } else { + g.P("x.", f.Oneof.GoName, " = &", f.GoIdent, "{", f.GoName, ": data}") + } +} + +func emitMarshalProtobuf(g *protogen.GeneratedFile, msg *protogen.Message) { + g.P("// MarshalProtobuf implements the encoding.ProtoMarshaler interface.") + g.P("func (x *", msg.GoIdent.GoName, ") MarshalProtobuf(dst []byte) []byte {") + g.P("m := ", mp, ".Get()") + g.P("defer ", mp, ".Put(m)") + g.P("x.EmitProtobuf(m.MessageMarshaler())") + g.P("dst = m.Marshal(dst)") + g.P("return dst") + g.P("}\n") + + g.P("func (x *", msg.GoIdent.GoName, ") EmitProtobuf(mm *", easyprotoPackage.Ident("MessageMarshaler"), ") {") + if len(msg.Fields) != 0 { + fs := sortFields(msg.Fields) + + g.P("if x == nil { return }") + for _, f := range fs { + emitFieldMarshal(g, f) + } + } + g.P("}") +} + +func emitMarshalOneof(g *protogen.GeneratedFile, f *protogen.Field) { + name := "x." + f.Oneof.GoName + g.P("if inner, ok := ", name, ".(*", f.GoIdent.GoName, "); ok {") + defer g.P("}") + emitMarshalRaw(g, f, "inner."+f.GoName) +} + +// easyprotoKindInfo returns string name for kind, used in easyproto methods. +// The second return value is a condition to test for the default value of kind. +func easyprotoKindInfo(kind protoreflect.Kind) (string, func(string) string) { + switch kind { + case protoreflect.BoolKind: + return "Bool", identity + case protoreflect.EnumKind: + return "Int32", notZero + case protoreflect.Int32Kind: + return "Int32", notZero + case protoreflect.Sint32Kind: + return "Sint32", notZero + case protoreflect.Uint32Kind: + return "Uint32", notZero + case protoreflect.Int64Kind: + return "Int64", notZero + case protoreflect.Sint64Kind: + return "Sint64", notZero + case protoreflect.Uint64Kind: + return "Uint64", notZero + case protoreflect.Sfixed32Kind: + return "Sfixed32", notZero + case protoreflect.Fixed32Kind: + return "Fixed32", notZero + case protoreflect.FloatKind: + return "Float", notZero + case protoreflect.Sfixed64Kind: + return "Sfixed64", notZero + case protoreflect.Fixed64Kind: + return "Fixed64", notZero + case protoreflect.DoubleKind: + return "Double", notZero + case protoreflect.StringKind: + return "String", notEmpty + case protoreflect.BytesKind: + return "Bytes", notEmpty + case protoreflect.GroupKind: + panic("unimplemented") + default: + panic("unreachable") + } +} + +func emitFieldMarshal(g *protogen.GeneratedFile, f *protogen.Field) { + if f.Oneof != nil { + emitMarshalOneof(g, f) + return + } + + emitMarshalRaw(g, f, castFieldName(f)) +} + +func emitMarshalRaw(g *protogen.GeneratedFile, f *protogen.Field, name string) { + if f.Desc.Kind() == protoreflect.MessageKind { + if f.Desc.IsList() { + g.P("for i := range ", name, " {") + defer g.P("}") + + name += "[i]" + } + + g.P("if ", notNil(name), " && ", name, ".StableSize() != 0 {") + g.P(name, ".EmitProtobuf(mm.AppendMessage(", f.Desc.Number(), "))") + g.P("}") + return + } + + method, cond := easyprotoKindInfo(f.Desc.Kind()) + method = "Append" + method + if f.Desc.IsList() && !f.Desc.IsPacked() { + g.P("for j := range ", name, " {") + g.P("mm.", method, "(", f.Desc.Number(), ", ", name, "[j])") + g.P("}") + return + } + + if f.Desc.IsList() { + method += "s" + g.P("if ", notEmpty(name), "{") + } else { + g.P("if ", cond(name), " {") + } + + g.P("mm.", method, "(", f.Desc.Number(), ", ", name, ")") + g.P("}") +} diff --git a/util/protogen/internalgengo/proto_field_type.go b/util/protogen/internalgengo/proto_field_type.go new file mode 100644 index 0000000..09f6884 --- /dev/null +++ b/util/protogen/internalgengo/proto_field_type.go @@ -0,0 +1,56 @@ +package internalgengo + +import ( + "google.golang.org/protobuf/compiler/protogen" + "google.golang.org/protobuf/reflect/protoreflect" +) + +type structField string + +func (f structField) String() string { + return string(f) +} + +func (f structField) PointerTo() structField { + return "*" + f +} + +func (f structField) SliceOf() structField { + return "[]" + f +} + +func fieldType(g *protogen.GeneratedFile, field *protogen.Field) structField { + var typ structField + switch field.Desc.Kind() { + case protoreflect.BoolKind: + typ = "bool" + case protoreflect.EnumKind: + typ = structField(g.QualifiedGoIdent(field.Enum.GoIdent)) + case protoreflect.Int32Kind, protoreflect.Sint32Kind, protoreflect.Sfixed32Kind: + typ = "int32" + case protoreflect.Uint32Kind, protoreflect.Fixed32Kind: + typ = "uint32" + case protoreflect.Int64Kind, protoreflect.Sint64Kind, protoreflect.Sfixed64Kind: + typ = "int64" + case protoreflect.Uint64Kind, protoreflect.Fixed64Kind: + typ = "uint64" + case protoreflect.FloatKind: + typ = "float32" + case protoreflect.DoubleKind: + typ = "float64" + case protoreflect.StringKind: + typ = "string" + case protoreflect.BytesKind: + typ = "[]byte" + case protoreflect.MessageKind: + typ = structField(g.QualifiedGoIdent(field.Message.GoIdent)).PointerTo() + case protoreflect.GroupKind: + panic("unimplemented") + } + + if field.Desc.IsList() { + typ = "[]" + typ + } + + return typ +} diff --git a/util/protogen/internalgengo/proto_stable_compat.go b/util/protogen/internalgengo/proto_stable_compat.go new file mode 100644 index 0000000..c27b9d8 --- /dev/null +++ b/util/protogen/internalgengo/proto_stable_compat.go @@ -0,0 +1,124 @@ +package internalgengo + +import ( + "google.golang.org/protobuf/compiler/protogen" + "google.golang.org/protobuf/reflect/protoreflect" +) + +var protowirePackage = protogen.GoImportPath("google.golang.org/protobuf/encoding/protowire") + +func emitStableSize(g *protogen.GeneratedFile, msg *protogen.Message) { + fs := sortFields(msg.Fields) + + g.P("// StableSize returns the size of x in protobuf format.") + g.P("//") + g.P("// Structures with the same field values have the same binary size.") + g.P("func (x *", msg.GoIdent.GoName, ") StableSize() (size int) {") + g.P("if x == nil { return 0 }") + if len(fs) != 0 { + for _, f := range fs { + if f.Desc.IsList() && marshalers[f.Desc.Kind()].RepeatedDouble && !(f.Desc.Kind() == protoreflect.Uint64Kind && !f.Desc.IsPacked()) { + g.P("var n int") + break + } + } + for _, f := range fs { + emitFieldSize(g, f) + } + } + g.P("return size") + g.P("}\n") +} + +func emitSignatureMethods(g *protogen.GeneratedFile, msg *protogen.Message) { + // SignedDataSize implementation (only for requests and responses). + g.P("// ReadSignedData fills buf with signed data of x.") + g.P("// If buffer length is less than x.SignedDataSize(), new buffer is allocated.") + g.P("//") + g.P("// Returns any error encountered which did not allow writing the data completely.") + g.P("// Otherwise, returns the buffer in which the data is written.") + g.P("//") + g.P("// Structures with the same field values have the same signed data.") + g.P("func (x *", msg.GoIdent.GoName, ") SignedDataSize() int {") + g.P("return x.GetBody().StableSize()") + g.P("}\n") + + // ReadSignedData implementation (only for requests and responses). + g.P("// SignedDataSize returns size of the request signed data in bytes.") + g.P("//") + g.P("// Structures with the same field values have the same signed data size.") + g.P("func (x *", msg.GoIdent.GoName, ") ReadSignedData(buf []byte) ([]byte, error) {") + g.P("return x.GetBody().MarshalProtobuf(buf), nil") + g.P("}\n") +} + +func emitFieldSize(g *protogen.GeneratedFile, f *protogen.Field) { + m := marshalers[f.Desc.Kind()] + if m.Prefix == "" { + g.P("// FIXME missing field marshaler: ", f.GoName, " of type ", f.Desc.Kind().String()) + g.P(`panic("unimplemented")`) + return + } + + name := castFieldName(f) + if f.Oneof != nil { + name = "x." + f.Oneof.GoName + g.P("if inner, ok := ", name, ".(*", f.GoIdent.GoName, "); ok {") + defer g.P("}") + name = "inner." + f.GoName + } + + switch { + case f.Desc.IsList() && (f.Desc.Kind() == protoreflect.MessageKind || f.Desc.Kind() == protoreflect.Uint64Kind && !f.Desc.IsPacked()): + g.P("for i := range ", name, "{") + if f.Desc.Kind() == protoreflect.MessageKind { + g.P("size += ", protoPackage.Ident("NestedStructureSize"), "(", f.Desc.Number(), ", ", name, "[i])") + } else { + if f.Desc.Kind() != protoreflect.Uint64Kind { + panic("only uint64 unpacked primitive is supported") + } + + g.P("size += ", protowirePackage.Ident("SizeGroup"), "(", + protowirePackage.Ident("Number"), "(", f.Desc.Number(), "), ", + protowirePackage.Ident("SizeVarint"), "(", name, "[i]))") + } + g.P("}") + + case f.Desc.IsList(): + if m.RepeatedDouble { + g.P("n, _ = ", protoPackage.Ident("Repeated"+m.Prefix+"Size"), "(", f.Desc.Number(), ", ", name, ")") + g.P("size += n") + } else { + g.P("size += ", protoPackage.Ident("Repeated"+m.Prefix+"Size"), "(", f.Desc.Number(), ", ", name, ")") + } + default: + g.P("size += ", protoPackage.Ident(m.Prefix+"Size"), "(", f.Desc.Number(), ", ", name, ")") + } +} + +type marshalerDesc struct { + Prefix string + RepeatedDouble bool +} + +// Unused kinds are commented. +var marshalers = map[protoreflect.Kind]marshalerDesc{ + protoreflect.BoolKind: {Prefix: "Bool"}, + protoreflect.EnumKind: {Prefix: "Enum"}, + protoreflect.Int32Kind: {Prefix: "Int32", RepeatedDouble: true}, + // protoreflect.Sint32Kind: "", + protoreflect.Uint32Kind: {Prefix: "UInt32", RepeatedDouble: true}, + protoreflect.Int64Kind: {Prefix: "Int64", RepeatedDouble: true}, + // protoreflect.Sint64Kind: "", + protoreflect.Uint64Kind: {Prefix: "UInt64", RepeatedDouble: true}, + // protoreflect.Sfixed32Kind: "", + protoreflect.Fixed32Kind: {Prefix: "Fixed32", RepeatedDouble: true}, + // protoreflect.FloatKind: "", + // protoreflect.Sfixed64Kind: "", + protoreflect.Fixed64Kind: {Prefix: "Fixed64", RepeatedDouble: true}, + protoreflect.DoubleKind: {Prefix: "Float64"}, + protoreflect.StringKind: {Prefix: "String"}, + protoreflect.BytesKind: {Prefix: "Bytes"}, + protoreflect.MessageKind: {Prefix: "NestedStructure"}, + // protoreflect.GroupKind: "", +} diff --git a/util/protogen/internalgengo/writer.go b/util/protogen/internalgengo/writer.go new file mode 100644 index 0000000..7b0d4f1 --- /dev/null +++ b/util/protogen/internalgengo/writer.go @@ -0,0 +1,30 @@ +package internalgengo + +import ( + "fmt" +) + +type condition = func(string) string + +var ( + _ condition = notZero + _ condition = notEmpty + _ condition = identity + _ condition = notNil +) + +func notZero(name string) string { + return fmt.Sprintf("%s != 0", name) +} + +func notEmpty(name string) string { + return fmt.Sprintf("len(%s) != 0", name) +} + +func identity(name string) string { + return name +} + +func notNil(name string) string { + return fmt.Sprintf("%s != nil", name) +} diff --git a/util/protogen/main.go b/util/protogen/main.go index 0f2a7ca..bfce1bf 100644 --- a/util/protogen/main.go +++ b/util/protogen/main.go @@ -1,258 +1,37 @@ package main import ( - "sort" - "strings" + "flag" + "fmt" + "os" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/protogen/internalgengo" "google.golang.org/protobuf/compiler/protogen" - "google.golang.org/protobuf/reflect/protoreflect" -) - -var ( - protowirePackage = protogen.GoImportPath("google.golang.org/protobuf/encoding/protowire") - binaryPackage = protogen.GoImportPath("encoding/binary") ) func main() { - protogen.Options{}.Run(func(gen *protogen.Plugin) error { + var flags flag.FlagSet + genFuzz := flags.Bool("fuzz", false, "generate fuzz tests") + yamlConfigPath := flags.String("config", "", "path to the configuration") + + protogen.Options{ + ParamFunc: flags.Set, + }.Run(func(gen *protogen.Plugin) error { + if *yamlConfigPath != "" { + s, e := os.Getwd() + fmt.Fprintln(os.Stderr, s, e) + data, err := os.ReadFile(*yamlConfigPath) + fmt.Fprintln(os.Stderr, string(data), err) + } + for _, f := range gen.Files { if f.Generate { - generateFile(gen, f) + internalgengo.GenerateFile(gen, f) + if *genFuzz { + internalgengo.GenerateFuzzTests(gen, f) + } } } return nil }) } - -// generateFile generates a *.pb.go file enforcing field-order serialization. -func generateFile(gen *protogen.Plugin, file *protogen.File) *protogen.GeneratedFile { - filename := file.GeneratedFilenamePrefix + "_frostfs.pb.go" - g := gen.NewGeneratedFile(filename, file.GoImportPath) - g.P("// Code generated by protoc-gen-go-frostfs. DO NOT EDIT.") - g.P() - g.P("package ", file.GoPackageName) - g.P() - g.P(`import "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/proto"`) - - //for _, e := range file.Enums { - // g.P("type " + e.GoIdent.GoName + " int32") - // g.P("const (") - // for _, ev := range e.Values { - // g.P(ev.GoIdent.GoName, " = ", ev.Desc.Number()) - // } - // g.P(")") - //} - for _, msg := range file.Messages { - emitMessage(g, msg) - } - return g -} - -func emitMessage(g *protogen.GeneratedFile, msg *protogen.Message) { - for _, inner := range msg.Messages { - emitMessage(g, inner) - } - - fs := sortFields(msg.Fields) - - // StableSize implementation. - g.P("// StableSize returns the size of x in protobuf format.") - g.P("//") - g.P("// Structures with the same field values have the same binary size.") - g.P("func (x *", msg.GoIdent.GoName, ") StableSize() (size int) {") - g.P("if x == nil { return 0 }") - if len(fs) != 0 { - for _, f := range fs { - if f.Desc.IsList() && marshalers[f.Desc.Kind()].RepeatedDouble && !(f.Desc.Kind() == protoreflect.Uint64Kind && !f.Desc.IsPacked()) { - g.P("var n int") - break - } - } - for _, f := range fs { - emitFieldSize(g, f) - } - } - g.P("return size") - g.P("}\n") - - // StableMarshal implementation. - g.P("// StableMarshal marshals x in protobuf binary format with stable field order.") - g.P("//") - g.P("// If buffer length is less than x.StableSize(), new buffer is allocated.") - g.P("//") - g.P("// Returns any error encountered which did not allow writing the data completely.") - g.P("// Otherwise, returns the buffer in which the data is written.") - g.P("//") - g.P("// Structures with the same field values have the same binary format.") - g.P("func (x *", msg.GoIdent.GoName, ") StableMarshal(buf []byte) []byte {") - if len(fs) != 0 { - g.P("if x == nil { return []byte{} }") - g.P("if buf == nil { buf = make([]byte, x.StableSize()) }") - g.P("var offset int") - for _, f := range fs { - emitFieldMarshal(g, f) - } - } - g.P("return buf") - g.P("}\n") - - if strings.HasSuffix(msg.GoIdent.GoName, "Request") || strings.HasSuffix(msg.GoIdent.GoName, "Response") { - // SignedDataSize implementation (only for requests and responses). - g.P("// ReadSignedData fills buf with signed data of x.") - g.P("// If buffer length is less than x.SignedDataSize(), new buffer is allocated.") - g.P("//") - g.P("// Returns any error encountered which did not allow writing the data completely.") - g.P("// Otherwise, returns the buffer in which the data is written.") - g.P("//") - g.P("// Structures with the same field values have the same signed data.") - g.P("func (x *", msg.GoIdent.GoName, ") SignedDataSize() int {") - g.P("return x.GetBody().StableSize()") - g.P("}\n") - - // ReadSignedData implementation (only for requests and responses). - g.P("// SignedDataSize returns size of the request signed data in bytes.") - g.P("//") - g.P("// Structures with the same field values have the same signed data size.") - g.P("func (x *", msg.GoIdent.GoName, ") ReadSignedData(buf []byte) ([]byte, error) {") - g.P("return x.GetBody().StableMarshal(buf), nil") - g.P("}\n") - - // Signature setters and getters. - g.P("func (x *", msg.GoIdent.GoName, ") SetSignature(sig *Signature) {") - g.P("x.Signature = sig") - g.P("}\n") - } -} - -func emitFieldSize(g *protogen.GeneratedFile, f *protogen.Field) { - m := marshalers[f.Desc.Kind()] - if m.Prefix == "" { - g.P("// FIXME missing field marshaler: ", f.GoName, " of type ", f.Desc.Kind().String()) - g.P(`panic("unimplemented")`) - return - } - - name := castFieldName(f) - if f.Oneof != nil { - name = "x." + f.Oneof.GoName - g.P("if inner, ok := ", name, ".(*", f.GoIdent.GoName, "); ok {") - defer g.P("}") - name = "inner." + f.GoName - } - - switch { - case f.Desc.IsList() && (f.Desc.Kind() == protoreflect.MessageKind || f.Desc.Kind() == protoreflect.Uint64Kind && !f.Desc.IsPacked()): - g.P("for i := range ", name, "{") - if f.Desc.Kind() == protoreflect.MessageKind { - g.P("size += proto.NestedStructureSize(", f.Desc.Number(), ", ", name, "[i])") - } else { - if f.Desc.Kind() != protoreflect.Uint64Kind { - panic("only uint64 unpacked primitive is supported") - } - - g.P("size += ", protowirePackage.Ident("SizeGroup"), "(", - protowirePackage.Ident("Number"), "(", f.Desc.Number(), "), ", - protowirePackage.Ident("SizeVarint"), "(", name, "[i]))") - } - g.P("}") - case f.Desc.IsList(): - if m.RepeatedDouble { - g.P("n, _ = proto.Repeated", m.Prefix, "Size(", f.Desc.Number(), ", ", name, ")") - g.P("size += n") - } else { - g.P("size += proto.Repeated", m.Prefix, "Size(", f.Desc.Number(), ", ", name, ")") - } - default: - g.P("size += proto.", m.Prefix, "Size(", f.Desc.Number(), ", ", name, ")") - } -} - -func emitFieldMarshal(g *protogen.GeneratedFile, f *protogen.Field) { - m := marshalers[f.Desc.Kind()] - if m.Prefix == "" { - g.P("// FIXME missing field marshaler: ", f.GoName, " of type ", f.Desc.Kind().String()) - g.P(`panic("unimplemented")`) - return - } - - name := castFieldName(f) - if f.Oneof != nil { - name = "x." + f.Oneof.GoName - g.P("if inner, ok := ", name, ".(*", f.GoIdent.GoName, "); ok {") - defer g.P("}") - name = "inner." + f.GoName - } - - prefix := m.Prefix - if f.Desc.IsList() { - prefix = "Repeated" + m.Prefix - } - switch { - case f.Desc.IsList() && (f.Desc.Kind() == protoreflect.MessageKind || f.Desc.Kind() == protoreflect.Uint64Kind && !f.Desc.IsPacked()): - g.P("for i := range ", name, "{") - if f.Desc.Kind() == protoreflect.MessageKind { - g.P("offset += proto.NestedStructureMarshal(", f.Desc.Number(), ", buf[offset:], ", name, "[i])") - } else { - if f.Desc.Kind() != protoreflect.Uint64Kind { - panic("only uint64 unpacked primitive is supported") - } - g.P("{") - g.P("prefix := ", protowirePackage.Ident("EncodeTag"), "(", - protowirePackage.Ident("Number"), "(", f.Desc.Number(), "), ", - protowirePackage.Ident("VarintType"), ")") - g.P("offset += ", binaryPackage.Ident("PutUvarint"), "(buf[offset:], uint64(prefix))") - g.P("offset += ", binaryPackage.Ident("PutUvarint"), "(buf[offset:], ", name, "[i])") - g.P("}") - } - g.P("}") - case f.Desc.IsList(): - g.P("offset += proto.Repeated", m.Prefix, "Marshal(", f.Desc.Number(), ", buf[offset:], ", name, ")") - default: - g.P("offset += proto.", prefix, "Marshal(", f.Desc.Number(), ", buf[offset:], ", name, ")") - } -} - -func castFieldName(f *protogen.Field) string { - name := "x." + f.GoName - if f.Desc.Kind() != protoreflect.EnumKind { - return name - } - return "int32(" + name + ")" -} - -type marshalerDesc struct { - Prefix string - RepeatedDouble bool -} - -// Unused kinds are commented. -var marshalers = map[protoreflect.Kind]marshalerDesc{ - protoreflect.BoolKind: {Prefix: "Bool"}, - protoreflect.EnumKind: {Prefix: "Enum"}, - - protoreflect.Int32Kind: {Prefix: "Int32", RepeatedDouble: true}, - // protoreflect.Sint32Kind: "", - protoreflect.Uint32Kind: {Prefix: "UInt32", RepeatedDouble: true}, - protoreflect.Int64Kind: {Prefix: "Int64", RepeatedDouble: true}, - // protoreflect.Sint64Kind: "", - protoreflect.Uint64Kind: {Prefix: "UInt64", RepeatedDouble: true}, - // protoreflect.Sfixed32Kind: "", - protoreflect.Fixed32Kind: {Prefix: "Fixed32", RepeatedDouble: true}, - // protoreflect.FloatKind: "", - // protoreflect.Sfixed64Kind: "", - protoreflect.Fixed64Kind: {Prefix: "Fixed64", RepeatedDouble: true}, - protoreflect.DoubleKind: {Prefix: "Float64"}, - protoreflect.StringKind: {Prefix: "String"}, - protoreflect.BytesKind: {Prefix: "Bytes"}, - protoreflect.MessageKind: {Prefix: "NestedStructure"}, - // protoreflect.GroupKind: "", -} - -func sortFields(fs []*protogen.Field) []*protogen.Field { - res := make([]*protogen.Field, len(fs)) - copy(res, fs) - sort.Slice(res, func(i, j int) bool { - return res[i].Desc.Number() < res[j].Desc.Number() - }) - return res -} diff --git a/util/signature/data.go b/util/signature/data.go index 5e7c310..62c3eaf 100644 --- a/util/signature/data.go +++ b/util/signature/data.go @@ -63,12 +63,6 @@ func SignDataWithHandler(key *ecdsa.PrivateKey, src DataSource, handler KeySigna } func VerifyDataWithSource(dataSrc DataSource, sigSrc KeySignatureSource, opts ...SignOption) error { - cfg := defaultCfg() - - for i := range opts { - opts[i](cfg) - } - buffer := buffersPool.Get(uint32(dataSrc.SignedDataSize())) defer buffersPool.Put(buffer) @@ -77,7 +71,7 @@ func VerifyDataWithSource(dataSrc DataSource, sigSrc KeySignatureSource, opts .. return err } - return verify(cfg, data, sigSrc()) + return VerifyDataSlice(data, sigSrc, opts...) } func SignData(key *ecdsa.PrivateKey, v DataWithSignature, opts ...SignOption) error { @@ -87,3 +81,13 @@ func SignData(key *ecdsa.PrivateKey, v DataWithSignature, opts ...SignOption) er func VerifyData(src DataWithSignature, opts ...SignOption) error { return VerifyDataWithSource(src, src.GetSignature, opts...) } + +func VerifyDataSlice(data []byte, sigSrc KeySignatureSource, opts ...SignOption) error { + cfg := defaultCfg() + + for i := range opts { + opts[i](cfg) + } + + return verify(cfg, data, sigSrc()) +} From 7be31eb84738fc9094a8de07035b8cab44c92579 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Fri, 16 Aug 2024 11:08:47 +0300 Subject: [PATCH 1157/1196] [#77] protogen: Add tests for JSON format Signed-off-by: Evgenii Stratonikov --- util/proto/marshal_test.go | 101 +++++++++++++++++++++++++------------ 1 file changed, 68 insertions(+), 33 deletions(-) diff --git a/util/proto/marshal_test.go b/util/proto/marshal_test.go index e565b7c..d5758f2 100644 --- a/util/proto/marshal_test.go +++ b/util/proto/marshal_test.go @@ -8,6 +8,7 @@ import ( "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/proto/test" generated "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/proto/test/custom" "github.com/stretchr/testify/require" + "google.golang.org/protobuf/encoding/protojson" goproto "google.golang.org/protobuf/proto" ) @@ -51,33 +52,64 @@ func TestStableMarshalSingle(t *testing.T) { } for _, tc := range marshalCases { t.Run(tc.name, func(t *testing.T) { - r := tc.input.MarshalProtobuf(nil) - require.Equal(t, len(r), tc.input.StableSize()) - require.NotEmpty(t, r) + t.Run("proto", func(t *testing.T) { + r := tc.input.MarshalProtobuf(nil) + require.Equal(t, len(r), tc.input.StableSize()) + require.NotEmpty(t, r) - var actual test.Primitives - require.NoError(t, goproto.Unmarshal(r, &actual)) + var actual test.Primitives + require.NoError(t, goproto.Unmarshal(r, &actual)) - var actualFrostfs generated.Primitives - require.NoError(t, actualFrostfs.UnmarshalProtobuf(r)) - require.Equal(t, tc.input, &actualFrostfs) + var actualFrostfs generated.Primitives + require.NoError(t, actualFrostfs.UnmarshalProtobuf(r)) + require.Equal(t, tc.input, &actualFrostfs) - // Compare each field directly, because proto-generated code has private fields. - require.Equal(t, tc.input.FieldA, actual.FieldA) - require.Equal(t, tc.input.FieldB, actual.FieldB) - require.Equal(t, tc.input.FieldC, actual.FieldC) - require.Equal(t, tc.input.FieldD, actual.FieldD) - require.Equal(t, tc.input.FieldE, actual.FieldE) - require.Equal(t, tc.input.FieldF, actual.FieldF) - require.Equal(t, tc.input.FieldG, actual.FieldG) - require.Equal(t, tc.input.FieldI, actual.FieldI) - require.Equal(t, tc.input.FieldJ, actual.FieldJ) - require.Equal(t, tc.input.FieldK, actual.FieldK) - require.EqualValues(t, tc.input.FieldH, actual.FieldH) + primitivesEqual(t, tc.input, &actual) + }) + t.Run("json", func(t *testing.T) { + r, err := tc.input.MarshalJSON() + require.NoError(t, err) + require.NotEmpty(t, r) + + var actual test.Primitives + require.NoError(t, protojson.Unmarshal(r, &actual)) + + var actualFrostfs generated.Primitives + require.NoError(t, actualFrostfs.UnmarshalJSON(r)) + require.Equal(t, tc.input, &actualFrostfs) + + primitivesEqual(t, tc.input, &actual) + }) }) } } +func primitivesEqual(t *testing.T, a *generated.Primitives, b *test.Primitives) { + // Compare each field directly, because proto-generated code has private fields. + require.Equal(t, a.FieldA, b.FieldA) + require.Equal(t, a.FieldB, b.FieldB) + require.Equal(t, a.FieldC, b.FieldC) + require.Equal(t, a.FieldD, b.FieldD) + require.Equal(t, a.FieldE, b.FieldE) + require.Equal(t, a.FieldF, b.FieldF) + require.Equal(t, a.FieldG, b.FieldG) + require.Equal(t, a.FieldI, b.FieldI) + require.Equal(t, a.FieldJ, b.FieldJ) + require.Equal(t, a.FieldK, b.FieldK) + require.EqualValues(t, a.FieldH, b.FieldH) +} + +func repPrimitivesEqual(t *testing.T, a *generated.RepPrimitives, b *test.RepPrimitives) { + // Compare each field directly, because proto-generated code has private fields. + require.Equal(t, a.FieldA, b.FieldA) + require.Equal(t, a.FieldB, b.FieldB) + require.Equal(t, a.FieldC, b.FieldC) + require.Equal(t, a.FieldD, b.FieldD) + require.Equal(t, a.FieldE, b.FieldE) + require.Equal(t, a.FieldF, b.FieldF) + require.Equal(t, a.FieldFu, b.FieldFu) +} + func randIntSlice[T protoInt](n int, includeZero bool) []T { r := make([]T, n) if n == 0 { @@ -142,21 +174,24 @@ func TestStableMarshalRep(t *testing.T) { } for _, tc := range marshalCases { t.Run(tc.name, func(t *testing.T) { - r := tc.input.MarshalProtobuf(nil) - require.Equal(t, len(r), tc.input.StableSize()) - require.NotEmpty(t, r) + t.Run("proto", func(t *testing.T) { + r := tc.input.MarshalProtobuf(nil) + require.Equal(t, len(r), tc.input.StableSize()) + require.NotEmpty(t, r) - var actual test.RepPrimitives - require.NoError(t, goproto.Unmarshal(r, &actual)) + var actual test.RepPrimitives + require.NoError(t, goproto.Unmarshal(r, &actual)) + repPrimitivesEqual(t, tc.input, &actual) + }) + t.Run("json", func(t *testing.T) { + r, err := tc.input.MarshalJSON() + require.NoError(t, err) + require.NotEmpty(t, r) - // Compare each field directly, because proto-generated code has private fields. - require.Equal(t, tc.input.FieldA, actual.FieldA) - require.Equal(t, tc.input.FieldB, actual.FieldB) - require.Equal(t, tc.input.FieldC, actual.FieldC) - require.Equal(t, tc.input.FieldD, actual.FieldD) - require.Equal(t, tc.input.FieldE, actual.FieldE) - require.Equal(t, tc.input.FieldF, actual.FieldF) - require.Equal(t, tc.input.FieldFu, actual.FieldFu) + var actual test.RepPrimitives + require.NoError(t, protojson.Unmarshal(r, &actual)) + repPrimitivesEqual(t, tc.input, &actual) + }) }) } } From a43110e36326a60466080b458ca82172dbfc81ef Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Fri, 16 Aug 2024 17:11:08 +0300 Subject: [PATCH 1158/1196] [#77] Makefile: Mark protogen as .PHONY Signed-off-by: Evgenii Stratonikov --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 7ed6954..271036a 100755 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ PROTOBUF_DIR ?= $(abspath $(BIN))/protobuf PROTOC_DIR ?= $(PROTOBUF_DIR)/protoc-v$(PROTOC_VERSION) PROTOC_GEN_GO_DIR ?= $(PROTOBUF_DIR)/protoc-gen-go-$(PROTOC_GEN_GO_VERSION) -.PHONY: dep fmts fumpt imports protoc test lint version help +.PHONY: dep fmts fumpt imports protoc test lint version help $(BIN)/protogen protoc-test # Pull go dependencies dep: @@ -72,12 +72,12 @@ protoc: --go-grpc_out=. --go-grpc_opt=paths=source_relative $$f; \ done -protogen: +$(BIN)/protogen: @go build -v -trimpath \ -o $(BIN)/protogen \ ./util/protogen -protoc-test: protoc protogen +protoc-test: protoc $(BIN)/protogen @$(PROTOC_DIR)/bin/protoc \ --plugin=protoc-gen-go-frostfs=$(abspath $(BIN)/protogen) \ --go-frostfs_opt=Mutil/proto/test/test.proto=git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/proto/test/custom \ From 33653962b72a841a024f81dcec95adfd01027e0e Mon Sep 17 00:00:00 2001 From: Ekaterina Lebedeva Date: Wed, 21 Aug 2024 17:22:56 +0300 Subject: [PATCH 1159/1196] [#1316] go.mod: Bump go version to 1.22 Signed-off-by: Ekaterina Lebedeva --- .forgejo/workflows/dco.yml | 2 +- .forgejo/workflows/tests.yml | 6 +++--- go.mod | 2 +- go.sum | 1 + 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.forgejo/workflows/dco.yml b/.forgejo/workflows/dco.yml index 9aa0d31..2374802 100644 --- a/.forgejo/workflows/dco.yml +++ b/.forgejo/workflows/dco.yml @@ -13,7 +13,7 @@ jobs: - name: Setup Go uses: actions/setup-go@v3 with: - go-version: '1.21' + go-version: '1.23' - name: Run commit format checker uses: https://git.frostfs.info/TrueCloudLab/dco-go@v3 diff --git a/.forgejo/workflows/tests.yml b/.forgejo/workflows/tests.yml index 2d44d34..7950b1c 100644 --- a/.forgejo/workflows/tests.yml +++ b/.forgejo/workflows/tests.yml @@ -11,7 +11,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v3 with: - go-version: '1.20' + go-version: '1.23' cache: true - name: golangci-lint @@ -24,7 +24,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - go_versions: [ '1.19', '1.20' ] + go_versions: [ '1.22', '1.23' ] fail-fast: false steps: - uses: actions/checkout@v3 @@ -47,7 +47,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v3 with: - go-version: '1.20' + go-version: '1.23' cache: true - name: Run tests diff --git a/go.mod b/go.mod index 13fa1b7..a241dd5 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 -go 1.20 +go 1.22 require ( git.frostfs.info/TrueCloudLab/frostfs-crypto v0.6.0 diff --git a/go.sum b/go.sum index 620642f..83963fe 100644 --- a/go.sum +++ b/go.sum @@ -8,6 +8,7 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= From c1b5f46f98a8a6ac7fc04f64633f66d39a8aaf33 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Mon, 26 Aug 2024 09:51:28 +0300 Subject: [PATCH 1160/1196] [#107] protogen: Remove unused parameter Signed-off-by: Evgenii Stratonikov --- util/protogen/main.go | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/util/protogen/main.go b/util/protogen/main.go index bfce1bf..8fdd666 100644 --- a/util/protogen/main.go +++ b/util/protogen/main.go @@ -2,8 +2,6 @@ package main import ( "flag" - "fmt" - "os" "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/protogen/internalgengo" "google.golang.org/protobuf/compiler/protogen" @@ -12,18 +10,10 @@ import ( func main() { var flags flag.FlagSet genFuzz := flags.Bool("fuzz", false, "generate fuzz tests") - yamlConfigPath := flags.String("config", "", "path to the configuration") protogen.Options{ ParamFunc: flags.Set, }.Run(func(gen *protogen.Plugin) error { - if *yamlConfigPath != "" { - s, e := os.Getwd() - fmt.Fprintln(os.Stderr, s, e) - data, err := os.ReadFile(*yamlConfigPath) - fmt.Fprintln(os.Stderr, string(data), err) - } - for _, f := range gen.Files { if f.Generate { internalgengo.GenerateFile(gen, f) From 61f6f0f4a207c7e58b6573329a21d81cdee1091f Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Mon, 26 Aug 2024 14:14:38 +0300 Subject: [PATCH 1161/1196] [#107] proto/test: Regenerate *.pb.go Signed-off-by: Evgenii Stratonikov --- util/proto/test/custom/test_frostfs.pb.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/util/proto/test/custom/test_frostfs.pb.go b/util/proto/test/custom/test_frostfs.pb.go index 28a3044..c99234e 100644 --- a/util/proto/test/custom/test_frostfs.pb.go +++ b/util/proto/test/custom/test_frostfs.pb.go @@ -18,9 +18,9 @@ import ( type Primitives_SomeEnum int32 const ( - Primitives_UNKNOWN = 0 - Primitives_POSITIVE = 1 - Primitives_NEGATIVE = -1 + Primitives_UNKNOWN Primitives_SomeEnum = 0 + Primitives_POSITIVE Primitives_SomeEnum = 1 + Primitives_NEGATIVE Primitives_SomeEnum = -1 ) var ( From f484ce6b0bfb74d77b1af162c462e4acc6ddcf5b Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Mon, 26 Aug 2024 14:15:00 +0300 Subject: [PATCH 1162/1196] [#107] Makefile: Generate standard protobuf bindings for tests It was removed accidentally during transition. Signed-off-by: Evgenii Stratonikov --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index 271036a..abcabc7 100755 --- a/Makefile +++ b/Makefile @@ -79,6 +79,7 @@ $(BIN)/protogen: protoc-test: protoc $(BIN)/protogen @$(PROTOC_DIR)/bin/protoc \ + --go_out=. --go_opt=paths=source_relative \ --plugin=protoc-gen-go-frostfs=$(abspath $(BIN)/protogen) \ --go-frostfs_opt=Mutil/proto/test/test.proto=git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/proto/test/custom \ --go-frostfs_opt=module=git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 \ From 4a00ef946fdf8e82cc9dce7313c63db825adea4b Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Mon, 26 Aug 2024 14:16:10 +0300 Subject: [PATCH 1163/1196] [#107] protogen: Fix oneof getter scalar default value Signed-off-by: Evgenii Stratonikov --- util/protogen/internalgengo/file.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/protogen/internalgengo/file.go b/util/protogen/internalgengo/file.go index b5b351c..cd54fa0 100644 --- a/util/protogen/internalgengo/file.go +++ b/util/protogen/internalgengo/file.go @@ -148,7 +148,7 @@ func emitOneofGettersSetters(g *protogen.GeneratedFile, msg *protogen.Message, f g.P("}") ft := fieldType(g, ff) - emitGetterSetter(g, ff.GoIdent.GoName, ff.GoName, ft.String(), "nil") + emitGetterSetter(g, ff.GoIdent.GoName, ff.GoName, ft.String(), fieldDefaultValue(ff)) } } From 937a53683a3c083f9ab5d970c205200d10c058bf Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Mon, 26 Aug 2024 14:19:28 +0300 Subject: [PATCH 1164/1196] [#107] protogen: Fix oneof JSON marshaling Signed-off-by: Evgenii Stratonikov --- util/protogen/internalgengo/json.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/util/protogen/internalgengo/json.go b/util/protogen/internalgengo/json.go index ad43fc8..4ae24e7 100644 --- a/util/protogen/internalgengo/json.go +++ b/util/protogen/internalgengo/json.go @@ -159,8 +159,6 @@ func emitJSONMarshal(g *protogen.GeneratedFile, msg *protogen.Message) { g.P("case *", ff.GoIdent, ":") emitJSONFieldWrite(g, ff, "xx", i == 0) } - g.P("default:") - g.P(`out.RawString("null")`) g.P("}") continue } From 866db105ed8d64e9218d94991a3707dfec39efa8 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Mon, 26 Aug 2024 14:33:18 +0300 Subject: [PATCH 1165/1196] [#107] protogen: Unify oneof getters with default protoc plugin Signed-off-by: Evgenii Stratonikov --- util/protogen/internalgengo/file.go | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/util/protogen/internalgengo/file.go b/util/protogen/internalgengo/file.go index cd54fa0..ff1c830 100644 --- a/util/protogen/internalgengo/file.go +++ b/util/protogen/internalgengo/file.go @@ -126,23 +126,18 @@ func emitOneofGettersSetters(g *protogen.GeneratedFile, msg *protogen.Message, f // For some reason protoc generates different code for oneof message/non-message fields: // 1. For message we have 2 level struct wrapping and setters use inner type. // 2. For other types we also have 2 level wrapping, but setters use outer type. + ft := fieldType(g, ff) + + g.P("func (x *", msg.GoIdent.GoName, ") Get", ff.GoName, "() ", ft, " {") + g.P("if xx, ok := x.Get", ff.Oneof.GoName, "().(*", ff.GoIdent, "); ok { return xx.", ff.GoName, " }") + g.P("return ", fieldDefaultValue(ff)) + g.P("}") + if ff.Desc.Kind() == protoreflect.MessageKind { - ft := fieldType(g, ff) - - g.P("func (x *", msg.GoIdent.GoName, ") Get", ff.GoName, "() ", ft, " {") - g.P("if xx, ok := x.Get", ff.Oneof.GoName, "().(*", ff.GoIdent, "); ok { return xx.", ff.GoName, " }") - g.P("return nil") - g.P("}") - g.P("func (x *", msg.GoIdent.GoName, ") Set", ff.GoName, "(v ", ft, ") {") g.P("x.", ff.Oneof.GoName, " = &", ff.GoIdent, "{", ff.GoName, ": v}") g.P("}") } else { - g.P("func (x *", msg.GoIdent.GoName, ") Get", ff.GoName, "() *", ff.GoIdent, " {") - g.P("if xx, ok := x.Get", ff.Oneof.GoName, "().(*", ff.GoIdent, "); ok { return xx }") - g.P("return nil") - g.P("}") - g.P("func (x *", msg.GoIdent.GoName, ") Set", ff.GoName, "(v *", ff.GoIdent, ") {") g.P("x.", ff.Oneof.GoName, " = v") g.P("}") From 981dc785f34aaff6b26ee6a24f460f58bba02596 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Mon, 26 Aug 2024 14:33:30 +0300 Subject: [PATCH 1166/1196] [#107] proto/test: Add oneof test Signed-off-by: Evgenii Stratonikov --- util/proto/marshal_test.go | 5 + util/proto/test/custom/test_frostfs.pb.go | 297 ++++++++++++++++++++++ util/proto/test/test.pb.go | 186 ++++++++++++-- util/proto/test/test.proto | 8 + 4 files changed, 469 insertions(+), 27 deletions(-) diff --git a/util/proto/marshal_test.go b/util/proto/marshal_test.go index d5758f2..5d887ce 100644 --- a/util/proto/marshal_test.go +++ b/util/proto/marshal_test.go @@ -49,6 +49,8 @@ func TestStableMarshalSingle(t *testing.T) { {name: "fixed32", input: &generated.Primitives{FieldK: nonZero[uint32]()}}, {name: "enum, positive", input: &generated.Primitives{FieldH: generated.Primitives_POSITIVE}}, {name: "enum, negative", input: &generated.Primitives{FieldH: generated.Primitives_NEGATIVE}}, + {name: "oneof, first", input: &generated.Primitives{FieldM: &generated.Primitives_FieldMa{FieldMa: []byte{4, 2}}}}, + {name: "oneof, second", input: &generated.Primitives{FieldM: &generated.Primitives_FieldMe{FieldMe: nonZero[uint32]()}}}, } for _, tc := range marshalCases { t.Run(tc.name, func(t *testing.T) { @@ -97,6 +99,9 @@ func primitivesEqual(t *testing.T, a *generated.Primitives, b *test.Primitives) require.Equal(t, a.FieldJ, b.FieldJ) require.Equal(t, a.FieldK, b.FieldK) require.EqualValues(t, a.FieldH, b.FieldH) + require.Equal(t, a.GetFieldMa(), b.GetFieldMa()) + require.Equal(t, a.GetFieldMe(), b.GetFieldMe()) + require.Equal(t, a.GetFieldAux().GetInnerField(), b.GetFieldAux().GetInnerField()) } func repPrimitivesEqual(t *testing.T, a *generated.RepPrimitives, b *test.RepPrimitives) { diff --git a/util/proto/test/custom/test_frostfs.pb.go b/util/proto/test/custom/test_frostfs.pb.go index c99234e..b1d2cf2 100644 --- a/util/proto/test/custom/test_frostfs.pb.go +++ b/util/proto/test/custom/test_frostfs.pb.go @@ -50,6 +50,135 @@ func (x *Primitives_SomeEnum) FromString(s string) bool { return false } +type Primitives_Aux struct { + InnerField uint32 `json:"innerField"` +} + +var ( + _ encoding.ProtoMarshaler = (*Primitives_Aux)(nil) + _ encoding.ProtoUnmarshaler = (*Primitives_Aux)(nil) + _ json.Marshaler = (*Primitives_Aux)(nil) + _ json.Unmarshaler = (*Primitives_Aux)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *Primitives_Aux) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.UInt32Size(1, x.InnerField) + return size +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *Primitives_Aux) 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 *Primitives_Aux) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if x.InnerField != 0 { + mm.AppendUint32(1, x.InnerField) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *Primitives_Aux) 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", "Primitives_Aux") + } + switch fc.FieldNum { + case 1: // InnerField + data, ok := fc.Uint32() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "InnerField") + } + x.InnerField = data + } + } + return nil +} +func (x *Primitives_Aux) GetInnerField() uint32 { + if x != nil { + return x.InnerField + } + return 0 +} +func (x *Primitives_Aux) SetInnerField(v uint32) { + x.InnerField = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *Primitives_Aux) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *Primitives_Aux) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"innerField\":" + out.RawString(prefix[1:]) + out.Uint32(x.InnerField) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *Primitives_Aux) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *Primitives_Aux) 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 "innerField": + { + var f uint32 + f = in.Uint32() + x.InnerField = f + } + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} + type Primitives struct { FieldA []byte `json:"fieldA"` FieldB string `json:"fieldB"` @@ -62,6 +191,7 @@ type Primitives struct { FieldJ float64 `json:"fieldJ"` FieldK uint32 `json:"fieldK"` FieldH Primitives_SomeEnum `json:"fieldH"` + FieldM isPrimitives_FieldM } var ( @@ -89,6 +219,15 @@ func (x *Primitives) StableSize() (size int) { size += proto.Float64Size(206, x.FieldJ) size += proto.Fixed32Size(207, x.FieldK) size += proto.EnumSize(300, int32(x.FieldH)) + if inner, ok := x.FieldM.(*Primitives_FieldMa); ok { + size += proto.BytesSize(401, inner.FieldMa) + } + if inner, ok := x.FieldM.(*Primitives_FieldMe); ok { + size += proto.UInt32Size(402, inner.FieldMe) + } + if inner, ok := x.FieldM.(*Primitives_FieldAux); ok { + size += proto.NestedStructureSize(403, inner.FieldAux) + } return size } @@ -138,6 +277,21 @@ func (x *Primitives) EmitProtobuf(mm *easyproto.MessageMarshaler) { if int32(x.FieldH) != 0 { mm.AppendInt32(300, int32(x.FieldH)) } + if inner, ok := x.FieldM.(*Primitives_FieldMa); ok { + if len(inner.FieldMa) != 0 { + mm.AppendBytes(401, inner.FieldMa) + } + } + if inner, ok := x.FieldM.(*Primitives_FieldMe); ok { + if inner.FieldMe != 0 { + mm.AppendUint32(402, inner.FieldMe) + } + } + if inner, ok := x.FieldM.(*Primitives_FieldAux); ok { + if inner.FieldAux != nil && inner.FieldAux.StableSize() != 0 { + inner.FieldAux.EmitProtobuf(mm.AppendMessage(403)) + } + } } // UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. @@ -215,6 +369,28 @@ func (x *Primitives) UnmarshalProtobuf(src []byte) (err error) { return fmt.Errorf("cannot unmarshal field %s", "FieldH") } x.FieldH = Primitives_SomeEnum(data) + case 401: // FieldMa + data, ok := fc.Bytes() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "FieldMa") + } + x.FieldM = &Primitives_FieldMa{FieldMa: data} + case 402: // FieldMe + data, ok := fc.Uint32() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "FieldMe") + } + x.FieldM = &Primitives_FieldMe{FieldMe: data} + case 403: // FieldAux + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "FieldAux") + } + oneofField := &Primitives_FieldAux{FieldAux: new(Primitives_Aux)} + if err := oneofField.FieldAux.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + x.FieldM = oneofField } } return nil @@ -318,6 +494,60 @@ func (x *Primitives) GetFieldH() Primitives_SomeEnum { func (x *Primitives) SetFieldH(v Primitives_SomeEnum) { x.FieldH = v } +func (x *Primitives) GetFieldM() isPrimitives_FieldM { + if x != nil { + return x.FieldM + } + return nil +} +func (x *Primitives) SetFieldM(v isPrimitives_FieldM) { + x.FieldM = v +} +func (x *Primitives) GetFieldMa() []byte { + if xx, ok := x.GetFieldM().(*Primitives_FieldMa); ok { + return xx.FieldMa + } + return nil +} +func (x *Primitives) SetFieldMa(v *Primitives_FieldMa) { + x.FieldM = v +} +func (x *Primitives_FieldMa) GetFieldMa() []byte { + if x != nil { + return x.FieldMa + } + return nil +} +func (x *Primitives_FieldMa) SetFieldMa(v []byte) { + x.FieldMa = v +} +func (x *Primitives) GetFieldMe() uint32 { + if xx, ok := x.GetFieldM().(*Primitives_FieldMe); ok { + return xx.FieldMe + } + return 0 +} +func (x *Primitives) SetFieldMe(v *Primitives_FieldMe) { + x.FieldM = v +} +func (x *Primitives_FieldMe) GetFieldMe() uint32 { + if x != nil { + return x.FieldMe + } + return 0 +} +func (x *Primitives_FieldMe) SetFieldMe(v uint32) { + x.FieldMe = v +} +func (x *Primitives) GetFieldAux() *Primitives_Aux { + if xx, ok := x.GetFieldM().(*Primitives_FieldAux); ok { + return xx.FieldAux + } + return nil +} +func (x *Primitives) SetFieldAux(v *Primitives_Aux) { + x.FieldM = &Primitives_FieldAux{FieldAux: v} +} // MarshalJSON implements the json.Marshaler interface. func (x *Primitives) MarshalJSON() ([]byte, error) { @@ -386,6 +616,26 @@ func (x *Primitives) MarshalEasyJSON(out *jwriter.Writer) { out.RawString(prefix) out.Int32(int32(x.FieldH)) } + switch xx := x.FieldM.(type) { + case *Primitives_FieldMa: + { + const prefix string = ",\"fieldMa\":" + out.RawString(prefix) + out.Base64Bytes(xx.FieldMa) + } + case *Primitives_FieldMe: + { + const prefix string = ",\"fieldMe\":" + out.RawString(prefix) + out.Uint32(xx.FieldMe) + } + case *Primitives_FieldAux: + { + const prefix string = ",\"fieldAux\":" + out.RawString(prefix) + xx.FieldAux.MarshalEasyJSON(out) + } + } out.RawByte('}') } @@ -496,6 +746,31 @@ func (x *Primitives) UnmarshalEasyJSON(in *jlexer.Lexer) { f = parsedValue x.FieldH = f } + case "fieldMa": + xx := new(Primitives_FieldMa) + x.FieldM = xx + { + var f []byte + f = in.Bytes() + xx.FieldMa = f + } + case "fieldMe": + xx := new(Primitives_FieldMe) + x.FieldM = xx + { + var f uint32 + f = in.Uint32() + xx.FieldMe = f + } + case "fieldAux": + xx := new(Primitives_FieldAux) + x.FieldM = xx + { + var f *Primitives_Aux + f = new(Primitives_Aux) + f.UnmarshalEasyJSON(in) + xx.FieldAux = f + } } in.WantComma() } @@ -505,6 +780,28 @@ func (x *Primitives) UnmarshalEasyJSON(in *jlexer.Lexer) { } } +type isPrimitives_FieldM interface { + isPrimitives_FieldM() +} + +type Primitives_FieldMa struct { + FieldMa []byte +} + +type Primitives_FieldMe struct { + FieldMe uint32 +} + +type Primitives_FieldAux struct { + FieldAux *Primitives_Aux +} + +func (*Primitives_FieldMa) isPrimitives_FieldM() {} + +func (*Primitives_FieldMe) isPrimitives_FieldM() {} + +func (*Primitives_FieldAux) isPrimitives_FieldM() {} + type RepPrimitives struct { FieldA [][]byte `json:"fieldA"` FieldB []string `json:"fieldB"` diff --git a/util/proto/test/test.pb.go b/util/proto/test/test.pb.go index 57f7fb0..de8ec65 100644 --- a/util/proto/test/test.pb.go +++ b/util/proto/test/test.pb.go @@ -85,6 +85,12 @@ type Primitives struct { FieldJ float64 `protobuf:"fixed64,206,opt,name=field_j,json=fieldJ,proto3" json:"field_j,omitempty"` FieldK uint32 `protobuf:"fixed32,207,opt,name=field_k,json=fieldK,proto3" json:"field_k,omitempty"` FieldH Primitives_SomeEnum `protobuf:"varint,300,opt,name=field_h,json=fieldH,proto3,enum=test.Primitives_SomeEnum" json:"field_h,omitempty"` + // Types that are assignable to FieldM: + // + // *Primitives_FieldMa + // *Primitives_FieldMe + // *Primitives_FieldAux + FieldM isPrimitives_FieldM `protobuf_oneof:"field_m"` } func (x *Primitives) Reset() { @@ -196,6 +202,56 @@ func (x *Primitives) GetFieldH() Primitives_SomeEnum { return Primitives_UNKNOWN } +func (m *Primitives) GetFieldM() isPrimitives_FieldM { + if m != nil { + return m.FieldM + } + return nil +} + +func (x *Primitives) GetFieldMa() []byte { + if x, ok := x.GetFieldM().(*Primitives_FieldMa); ok { + return x.FieldMa + } + return nil +} + +func (x *Primitives) GetFieldMe() uint32 { + if x, ok := x.GetFieldM().(*Primitives_FieldMe); ok { + return x.FieldMe + } + return 0 +} + +func (x *Primitives) GetFieldAux() *Primitives_Aux { + if x, ok := x.GetFieldM().(*Primitives_FieldAux); ok { + return x.FieldAux + } + return nil +} + +type isPrimitives_FieldM interface { + isPrimitives_FieldM() +} + +type Primitives_FieldMa struct { + FieldMa []byte `protobuf:"bytes,401,opt,name=field_ma,json=fieldMa,proto3,oneof"` +} + +type Primitives_FieldMe struct { + FieldMe uint32 `protobuf:"varint,402,opt,name=field_me,json=fieldMe,proto3,oneof"` +} + +type Primitives_FieldAux struct { + FieldAux *Primitives_Aux `protobuf:"bytes,403,opt,name=field_aux,json=fieldAux,proto3,oneof"` +} + +func (*Primitives_FieldMa) isPrimitives_FieldM() {} + +func (*Primitives_FieldMe) isPrimitives_FieldM() {} + +func (*Primitives_FieldAux) isPrimitives_FieldM() {} + type RepPrimitives struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -291,12 +347,59 @@ func (x *RepPrimitives) GetFieldFu() []uint64 { return nil } +type Primitives_Aux struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + InnerField uint32 `protobuf:"varint,1,opt,name=inner_field,json=innerField,proto3" json:"inner_field,omitempty"` +} + +func (x *Primitives_Aux) Reset() { + *x = Primitives_Aux{} + if protoimpl.UnsafeEnabled { + mi := &file_util_proto_test_test_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Primitives_Aux) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Primitives_Aux) ProtoMessage() {} + +func (x *Primitives_Aux) ProtoReflect() protoreflect.Message { + mi := &file_util_proto_test_test_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Primitives_Aux.ProtoReflect.Descriptor instead. +func (*Primitives_Aux) Descriptor() ([]byte, []int) { + return file_util_proto_test_test_proto_rawDescGZIP(), []int{0, 0} +} + +func (x *Primitives_Aux) GetInnerField() uint32 { + if x != nil { + return x.InnerField + } + return 0 +} + var File_util_proto_test_test_proto protoreflect.FileDescriptor var file_util_proto_test_test_proto_rawDesc = []byte{ 0x0a, 0x1a, 0x75, 0x74, 0x69, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x04, 0x74, 0x65, - 0x73, 0x74, 0x22, 0x81, 0x03, 0x0a, 0x0a, 0x50, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, + 0x73, 0x74, 0x22, 0xa6, 0x04, 0x0a, 0x0a, 0x50, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, 0x12, 0x17, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x41, 0x12, 0x17, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x62, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x66, 0x69, 0x65, @@ -316,25 +419,35 @@ var file_util_proto_test_test_proto_rawDesc = []byte{ 0x6c, 0x64, 0x4b, 0x12, 0x33, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x68, 0x18, 0xac, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x19, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x50, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, 0x2e, 0x53, 0x6f, 0x6d, 0x65, 0x45, 0x6e, 0x75, 0x6d, - 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x48, 0x22, 0x3c, 0x0a, 0x08, 0x53, 0x6f, 0x6d, 0x65, - 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, - 0x00, 0x12, 0x0c, 0x0a, 0x08, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x49, 0x56, 0x45, 0x10, 0x01, 0x12, - 0x15, 0x0a, 0x08, 0x4e, 0x45, 0x47, 0x41, 0x54, 0x49, 0x56, 0x45, 0x10, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0x22, 0xc4, 0x01, 0x0a, 0x0d, 0x52, 0x65, 0x70, 0x50, 0x72, - 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, 0x12, 0x17, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, - 0x64, 0x5f, 0x61, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, - 0x41, 0x12, 0x17, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x62, 0x18, 0x02, 0x20, 0x03, - 0x28, 0x09, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x42, 0x12, 0x17, 0x0a, 0x07, 0x66, 0x69, - 0x65, 0x6c, 0x64, 0x5f, 0x63, 0x18, 0x03, 0x20, 0x03, 0x28, 0x05, 0x52, 0x06, 0x66, 0x69, 0x65, - 0x6c, 0x64, 0x43, 0x12, 0x17, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x64, 0x18, 0x04, - 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x44, 0x12, 0x17, 0x0a, 0x07, - 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x65, 0x18, 0x05, 0x20, 0x03, 0x28, 0x03, 0x52, 0x06, 0x66, - 0x69, 0x65, 0x6c, 0x64, 0x45, 0x12, 0x17, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x66, - 0x18, 0x06, 0x20, 0x03, 0x28, 0x04, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x46, 0x12, 0x1d, - 0x0a, 0x08, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x66, 0x75, 0x18, 0x07, 0x20, 0x03, 0x28, 0x04, - 0x42, 0x02, 0x10, 0x00, 0x52, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x46, 0x75, 0x42, 0x11, 0x5a, - 0x0f, 0x75, 0x74, 0x69, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x74, 0x65, 0x73, 0x74, - 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x48, 0x12, 0x1c, 0x0a, 0x08, 0x66, 0x69, 0x65, 0x6c, + 0x64, 0x5f, 0x6d, 0x61, 0x18, 0x91, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, 0x07, 0x66, + 0x69, 0x65, 0x6c, 0x64, 0x4d, 0x61, 0x12, 0x1c, 0x0a, 0x08, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, + 0x6d, 0x65, 0x18, 0x92, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x07, 0x66, 0x69, 0x65, + 0x6c, 0x64, 0x4d, 0x65, 0x12, 0x34, 0x0a, 0x09, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x61, 0x75, + 0x78, 0x18, 0x93, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, + 0x50, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, 0x2e, 0x41, 0x75, 0x78, 0x48, 0x00, + 0x52, 0x08, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x41, 0x75, 0x78, 0x1a, 0x26, 0x0a, 0x03, 0x41, 0x75, + 0x78, 0x12, 0x1f, 0x0a, 0x0b, 0x69, 0x6e, 0x6e, 0x65, 0x72, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0a, 0x69, 0x6e, 0x6e, 0x65, 0x72, 0x46, 0x69, 0x65, + 0x6c, 0x64, 0x22, 0x3c, 0x0a, 0x08, 0x53, 0x6f, 0x6d, 0x65, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0b, + 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x0c, 0x0a, 0x08, 0x50, + 0x4f, 0x53, 0x49, 0x54, 0x49, 0x56, 0x45, 0x10, 0x01, 0x12, 0x15, 0x0a, 0x08, 0x4e, 0x45, 0x47, + 0x41, 0x54, 0x49, 0x56, 0x45, 0x10, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, + 0x42, 0x09, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x6d, 0x22, 0xc4, 0x01, 0x0a, 0x0d, + 0x52, 0x65, 0x70, 0x50, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, 0x12, 0x17, 0x0a, + 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x61, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x06, + 0x66, 0x69, 0x65, 0x6c, 0x64, 0x41, 0x12, 0x17, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, + 0x62, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x42, 0x12, + 0x17, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x63, 0x18, 0x03, 0x20, 0x03, 0x28, 0x05, + 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x43, 0x12, 0x17, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, + 0x64, 0x5f, 0x64, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, + 0x44, 0x12, 0x17, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x65, 0x18, 0x05, 0x20, 0x03, + 0x28, 0x03, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x45, 0x12, 0x17, 0x0a, 0x07, 0x66, 0x69, + 0x65, 0x6c, 0x64, 0x5f, 0x66, 0x18, 0x06, 0x20, 0x03, 0x28, 0x04, 0x52, 0x06, 0x66, 0x69, 0x65, + 0x6c, 0x64, 0x46, 0x12, 0x1d, 0x0a, 0x08, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x66, 0x75, 0x18, + 0x07, 0x20, 0x03, 0x28, 0x04, 0x42, 0x02, 0x10, 0x00, 0x52, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, + 0x46, 0x75, 0x42, 0x11, 0x5a, 0x0f, 0x75, 0x74, 0x69, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x2f, 0x74, 0x65, 0x73, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -350,19 +463,21 @@ func file_util_proto_test_test_proto_rawDescGZIP() []byte { } var file_util_proto_test_test_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_util_proto_test_test_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_util_proto_test_test_proto_msgTypes = make([]protoimpl.MessageInfo, 3) var file_util_proto_test_test_proto_goTypes = []interface{}{ (Primitives_SomeEnum)(0), // 0: test.Primitives.SomeEnum (*Primitives)(nil), // 1: test.Primitives (*RepPrimitives)(nil), // 2: test.RepPrimitives + (*Primitives_Aux)(nil), // 3: test.Primitives.Aux } var file_util_proto_test_test_proto_depIdxs = []int32{ 0, // 0: test.Primitives.field_h:type_name -> test.Primitives.SomeEnum - 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 + 3, // 1: test.Primitives.field_aux:type_name -> test.Primitives.Aux + 2, // [2:2] is the sub-list for method output_type + 2, // [2:2] is the sub-list for method input_type + 2, // [2:2] is the sub-list for extension type_name + 2, // [2:2] is the sub-list for extension extendee + 0, // [0:2] is the sub-list for field type_name } func init() { file_util_proto_test_test_proto_init() } @@ -395,6 +510,23 @@ func file_util_proto_test_test_proto_init() { return nil } } + file_util_proto_test_test_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Primitives_Aux); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_util_proto_test_test_proto_msgTypes[0].OneofWrappers = []interface{}{ + (*Primitives_FieldMa)(nil), + (*Primitives_FieldMe)(nil), + (*Primitives_FieldAux)(nil), } type x struct{} out := protoimpl.TypeBuilder{ @@ -402,7 +534,7 @@ func file_util_proto_test_test_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_util_proto_test_test_proto_rawDesc, NumEnums: 1, - NumMessages: 2, + NumMessages: 3, NumExtensions: 0, NumServices: 0, }, diff --git a/util/proto/test/test.proto b/util/proto/test/test.proto index 14f6ac2..f33be49 100644 --- a/util/proto/test/test.proto +++ b/util/proto/test/test.proto @@ -22,6 +22,14 @@ message Primitives { NEGATIVE = -1; } SomeEnum field_h = 300; + + message Aux { uint32 inner_field = 1; } + + oneof field_m { + bytes field_ma = 401; + uint32 field_me = 402; + Aux field_aux = 403; + } } message RepPrimitives { From 9e82a5a31a888f44219dac09cc4a6d07ad1a215b Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Mon, 26 Aug 2024 14:36:02 +0300 Subject: [PATCH 1167/1196] [#107] Regenerate proto files Signed-off-by: Evgenii Stratonikov --- ape/grpc/types_frostfs.pb.go | 6 ++---- object/grpc/service_frostfs.pb.go | 20 ++++++-------------- session/grpc/types_frostfs.pb.go | 2 -- 3 files changed, 8 insertions(+), 20 deletions(-) diff --git a/ape/grpc/types_frostfs.pb.go b/ape/grpc/types_frostfs.pb.go index 1e92f22..216415b 100644 --- a/ape/grpc/types_frostfs.pb.go +++ b/ape/grpc/types_frostfs.pb.go @@ -303,9 +303,9 @@ func (x *Chain) GetKind() isChain_Kind { func (x *Chain) SetKind(v isChain_Kind) { x.Kind = v } -func (x *Chain) GetRaw() *Chain_Raw { +func (x *Chain) GetRaw() []byte { if xx, ok := x.GetKind().(*Chain_Raw); ok { - return xx + return xx.Raw } return nil } @@ -341,8 +341,6 @@ func (x *Chain) MarshalEasyJSON(out *jwriter.Writer) { out.RawString(prefix[1:]) out.Base64Bytes(xx.Raw) } - default: - out.RawString("null") } out.RawByte('}') } diff --git a/object/grpc/service_frostfs.pb.go b/object/grpc/service_frostfs.pb.go index 08b2860..ce8336a 100644 --- a/object/grpc/service_frostfs.pb.go +++ b/object/grpc/service_frostfs.pb.go @@ -739,9 +739,9 @@ func (x *GetResponse_Body) GetInit() *GetResponse_Body_Init { func (x *GetResponse_Body) SetInit(v *GetResponse_Body_Init) { x.ObjectPart = &GetResponse_Body_Init_{Init: v} } -func (x *GetResponse_Body) GetChunk() *GetResponse_Body_Chunk { +func (x *GetResponse_Body) GetChunk() []byte { if xx, ok := x.GetObjectPart().(*GetResponse_Body_Chunk); ok { - return xx + return xx.Chunk } return nil } @@ -813,8 +813,6 @@ func (x *GetResponse_Body) MarshalEasyJSON(out *jwriter.Writer) { out.RawString(prefix[1:]) xx.EcInfo.MarshalEasyJSON(out) } - default: - out.RawString("null") } out.RawByte('}') } @@ -1486,9 +1484,9 @@ func (x *PutRequest_Body) GetInit() *PutRequest_Body_Init { func (x *PutRequest_Body) SetInit(v *PutRequest_Body_Init) { x.ObjectPart = &PutRequest_Body_Init_{Init: v} } -func (x *PutRequest_Body) GetChunk() *PutRequest_Body_Chunk { +func (x *PutRequest_Body) GetChunk() []byte { if xx, ok := x.GetObjectPart().(*PutRequest_Body_Chunk); ok { - return xx + return xx.Chunk } return nil } @@ -1530,8 +1528,6 @@ func (x *PutRequest_Body) MarshalEasyJSON(out *jwriter.Writer) { out.RawString(prefix[1:]) out.Base64Bytes(xx.Chunk) } - default: - out.RawString("null") } out.RawByte('}') } @@ -3674,8 +3670,6 @@ func (x *HeadResponse_Body) MarshalEasyJSON(out *jwriter.Writer) { out.RawString(prefix[1:]) xx.EcInfo.MarshalEasyJSON(out) } - default: - out.RawString("null") } out.RawByte('}') } @@ -5706,9 +5700,9 @@ func (x *GetRangeResponse_Body) GetRangePart() isGetRangeResponse_Body_RangePart func (x *GetRangeResponse_Body) SetRangePart(v isGetRangeResponse_Body_RangePart) { x.RangePart = v } -func (x *GetRangeResponse_Body) GetChunk() *GetRangeResponse_Body_Chunk { +func (x *GetRangeResponse_Body) GetChunk() []byte { if xx, ok := x.GetRangePart().(*GetRangeResponse_Body_Chunk); ok { - return xx + return xx.Chunk } return nil } @@ -5774,8 +5768,6 @@ func (x *GetRangeResponse_Body) MarshalEasyJSON(out *jwriter.Writer) { out.RawString(prefix[1:]) xx.EcInfo.MarshalEasyJSON(out) } - default: - out.RawString("null") } out.RawByte('}') } diff --git a/session/grpc/types_frostfs.pb.go b/session/grpc/types_frostfs.pb.go index 6a0d75c..af95210 100644 --- a/session/grpc/types_frostfs.pb.go +++ b/session/grpc/types_frostfs.pb.go @@ -1121,8 +1121,6 @@ func (x *SessionToken_Body) MarshalEasyJSON(out *jwriter.Writer) { out.RawString(prefix) xx.Container.MarshalEasyJSON(out) } - default: - out.RawString("null") } out.RawByte('}') } From 11e194d274c45c0643518fea052d9467845e5ce6 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Tue, 27 Aug 2024 10:50:15 +0300 Subject: [PATCH 1168/1196] [#108] rpc/message: Add compatibility tests for marshaling Signed-off-by: Evgenii Stratonikov --- rpc/message/test/message.go | 59 +++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/rpc/message/test/message.go b/rpc/message/test/message.go index 435f20a..1f7097e 100644 --- a/rpc/message/test/message.go +++ b/rpc/message/test/message.go @@ -7,6 +7,7 @@ import ( "testing" "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message" + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/proto/encoding" "github.com/stretchr/testify/require" ) @@ -68,6 +69,64 @@ func TestRPCMessage(t *testing.T, msgGens ...func(empty bool) message.Message) { require.Equal(t, bm, bm2) }) } + t.Run("compatibility", func(t *testing.T) { + testCompatibility(t, msgGen) + }) }) } } + +func testCompatibility(t *testing.T, msgGen func(empty bool) message.Message) { + compareBinary := func(t *testing.T, msg message.Message) { + am, ok := msg.(binaryMessage) + if !ok { + t.Skip() + } + + a := am.StableMarshal(nil) + b := msg.ToGRPCMessage().(encoding.ProtoMarshaler).MarshalProtobuf(nil) + if len(a) == 0 { + require.Empty(t, b) + } else { + require.Equal(t, a, b) + } + } + compareJSON := func(t *testing.T, msg message.Message) { + am, ok := msg.(jsonMessage) + if !ok { + t.Skip() + } + + a, err := am.MarshalJSON() + require.NoError(t, err) + + b, err := json.Marshal(msg.ToGRPCMessage()) + require.NoError(t, err) + + require.JSONEq(t, string(a), string(b)) + if len(a) == 0 { + require.Empty(t, b) + } else { + require.Equal(t, a, b) + } + } + t.Run("empty", func(t *testing.T) { + t.Skip() + msg := msgGen(true) + t.Run(fmt.Sprintf("Binary_%T", msg), func(t *testing.T) { + compareBinary(t, msg) + }) + t.Run(fmt.Sprintf("JSON_%T", msg), func(t *testing.T) { + compareJSON(t, msg) + }) + }) + t.Run("not empty", func(t *testing.T) { + msg := msgGen(false) + t.Run(fmt.Sprintf("Binary_%T", msg), func(t *testing.T) { + compareBinary(t, msg) + }) + t.Run(fmt.Sprintf("JSON_%T", msg), func(t *testing.T) { + compareJSON(t, msg) + }) + }) +} From 5fece80b42035acef87108d128d2d33b0239f343 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Tue, 27 Aug 2024 10:53:43 +0300 Subject: [PATCH 1169/1196] [#108] protogen: Distinguish between empty and nil messages Refs #59 Signed-off-by: Evgenii Stratonikov --- accounting/grpc/service_frostfs.pb.go | 16 +- acl/grpc/types_frostfs.pb.go | 26 ++-- apemanager/grpc/service_frostfs.pb.go | 46 +++--- container/grpc/service_frostfs.pb.go | 90 +++++------ container/grpc/types_frostfs.pb.go | 8 +- lock/grpc/types_frostfs.pb.go | 2 +- netmap/grpc/service_frostfs.pb.go | 44 +++--- netmap/grpc/types_frostfs.pb.go | 16 +- object/grpc/service_frostfs.pb.go | 180 +++++++++++----------- object/grpc/types_frostfs.pb.go | 56 +++---- refs/grpc/types_frostfs.pb.go | 4 +- rpc/message/test/message.go | 1 - session/grpc/service_frostfs.pb.go | 14 +- session/grpc/types_frostfs.pb.go | 54 +++---- status/grpc/types_frostfs.pb.go | 2 +- tombstone/grpc/types_frostfs.pb.go | 2 +- util/proto/test/custom/test_frostfs.pb.go | 2 +- util/protogen/internalgengo/proto.go | 2 +- 18 files changed, 282 insertions(+), 283 deletions(-) diff --git a/accounting/grpc/service_frostfs.pb.go b/accounting/grpc/service_frostfs.pb.go index e44d7d4..b70fd27 100644 --- a/accounting/grpc/service_frostfs.pb.go +++ b/accounting/grpc/service_frostfs.pb.go @@ -50,7 +50,7 @@ func (x *BalanceRequest_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) { if x == nil { return } - if x.OwnerId != nil && x.OwnerId.StableSize() != 0 { + if x.OwnerId != nil { x.OwnerId.EmitProtobuf(mm.AppendMessage(1)) } } @@ -205,13 +205,13 @@ func (x *BalanceRequest) EmitProtobuf(mm *easyproto.MessageMarshaler) { if x == nil { return } - if x.Body != nil && x.Body.StableSize() != 0 { + if x.Body != nil { x.Body.EmitProtobuf(mm.AppendMessage(1)) } - if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 { + if x.MetaHeader != nil { x.MetaHeader.EmitProtobuf(mm.AppendMessage(2)) } - if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 { + if x.VerifyHeader != nil { x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3)) } } @@ -404,7 +404,7 @@ func (x *BalanceResponse_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) { if x == nil { return } - if x.Balance != nil && x.Balance.StableSize() != 0 { + if x.Balance != nil { x.Balance.EmitProtobuf(mm.AppendMessage(1)) } } @@ -559,13 +559,13 @@ func (x *BalanceResponse) EmitProtobuf(mm *easyproto.MessageMarshaler) { if x == nil { return } - if x.Body != nil && x.Body.StableSize() != 0 { + if x.Body != nil { x.Body.EmitProtobuf(mm.AppendMessage(1)) } - if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 { + if x.MetaHeader != nil { x.MetaHeader.EmitProtobuf(mm.AppendMessage(2)) } - if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 { + if x.VerifyHeader != nil { x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3)) } } diff --git a/acl/grpc/types_frostfs.pb.go b/acl/grpc/types_frostfs.pb.go index e542a19..931f3b3 100644 --- a/acl/grpc/types_frostfs.pb.go +++ b/acl/grpc/types_frostfs.pb.go @@ -708,12 +708,12 @@ func (x *EACLRecord) EmitProtobuf(mm *easyproto.MessageMarshaler) { mm.AppendInt32(2, int32(x.Action)) } for i := range x.Filters { - if x.Filters[i] != nil && x.Filters[i].StableSize() != 0 { + if x.Filters[i] != nil { x.Filters[i].EmitProtobuf(mm.AppendMessage(3)) } } for i := range x.Targets { - if x.Targets[i] != nil && x.Targets[i].StableSize() != 0 { + if x.Targets[i] != nil { x.Targets[i].EmitProtobuf(mm.AppendMessage(4)) } } @@ -997,14 +997,14 @@ func (x *EACLTable) EmitProtobuf(mm *easyproto.MessageMarshaler) { if x == nil { return } - if x.Version != nil && x.Version.StableSize() != 0 { + if x.Version != nil { x.Version.EmitProtobuf(mm.AppendMessage(1)) } - if x.ContainerId != nil && x.ContainerId.StableSize() != 0 { + if x.ContainerId != nil { x.ContainerId.EmitProtobuf(mm.AppendMessage(2)) } for i := range x.Records { - if x.Records[i] != nil && x.Records[i].StableSize() != 0 { + if x.Records[i] != nil { x.Records[i].EmitProtobuf(mm.AppendMessage(3)) } } @@ -1408,11 +1408,11 @@ func (x *BearerToken_Body_APEOverride) EmitProtobuf(mm *easyproto.MessageMarshal if x == nil { return } - if x.Target != nil && x.Target.StableSize() != 0 { + if x.Target != nil { x.Target.EmitProtobuf(mm.AppendMessage(1)) } for i := range x.Chains { - if x.Chains[i] != nil && x.Chains[i].StableSize() != 0 { + if x.Chains[i] != nil { x.Chains[i].EmitProtobuf(mm.AppendMessage(2)) } } @@ -1599,19 +1599,19 @@ func (x *BearerToken_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) { if x == nil { return } - if x.EaclTable != nil && x.EaclTable.StableSize() != 0 { + if x.EaclTable != nil { x.EaclTable.EmitProtobuf(mm.AppendMessage(1)) } - if x.OwnerId != nil && x.OwnerId.StableSize() != 0 { + if x.OwnerId != nil { x.OwnerId.EmitProtobuf(mm.AppendMessage(2)) } - if x.Lifetime != nil && x.Lifetime.StableSize() != 0 { + if x.Lifetime != nil { x.Lifetime.EmitProtobuf(mm.AppendMessage(3)) } if x.AllowImpersonate { mm.AppendBool(4, x.AllowImpersonate) } - if x.ApeOverride != nil && x.ApeOverride.StableSize() != 0 { + if x.ApeOverride != nil { x.ApeOverride.EmitProtobuf(mm.AppendMessage(5)) } } @@ -1862,10 +1862,10 @@ func (x *BearerToken) EmitProtobuf(mm *easyproto.MessageMarshaler) { if x == nil { return } - if x.Body != nil && x.Body.StableSize() != 0 { + if x.Body != nil { x.Body.EmitProtobuf(mm.AppendMessage(1)) } - if x.Signature != nil && x.Signature.StableSize() != 0 { + if x.Signature != nil { x.Signature.EmitProtobuf(mm.AppendMessage(2)) } } diff --git a/apemanager/grpc/service_frostfs.pb.go b/apemanager/grpc/service_frostfs.pb.go index 380ba30..c1d28ed 100644 --- a/apemanager/grpc/service_frostfs.pb.go +++ b/apemanager/grpc/service_frostfs.pb.go @@ -52,10 +52,10 @@ func (x *AddChainRequest_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) { if x == nil { return } - if x.Target != nil && x.Target.StableSize() != 0 { + if x.Target != nil { x.Target.EmitProtobuf(mm.AppendMessage(1)) } - if x.Chain != nil && x.Chain.StableSize() != 0 { + if x.Chain != nil { x.Chain.EmitProtobuf(mm.AppendMessage(2)) } } @@ -240,13 +240,13 @@ func (x *AddChainRequest) EmitProtobuf(mm *easyproto.MessageMarshaler) { if x == nil { return } - if x.Body != nil && x.Body.StableSize() != 0 { + if x.Body != nil { x.Body.EmitProtobuf(mm.AppendMessage(1)) } - if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 { + if x.MetaHeader != nil { x.MetaHeader.EmitProtobuf(mm.AppendMessage(2)) } - if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 { + if x.VerifyHeader != nil { x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3)) } } @@ -590,13 +590,13 @@ func (x *AddChainResponse) EmitProtobuf(mm *easyproto.MessageMarshaler) { if x == nil { return } - if x.Body != nil && x.Body.StableSize() != 0 { + if x.Body != nil { x.Body.EmitProtobuf(mm.AppendMessage(1)) } - if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 { + if x.MetaHeader != nil { x.MetaHeader.EmitProtobuf(mm.AppendMessage(2)) } - if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 { + if x.VerifyHeader != nil { x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3)) } } @@ -791,7 +791,7 @@ func (x *RemoveChainRequest_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) { if x == nil { return } - if x.Target != nil && x.Target.StableSize() != 0 { + if x.Target != nil { x.Target.EmitProtobuf(mm.AppendMessage(1)) } if len(x.ChainId) != 0 { @@ -975,13 +975,13 @@ func (x *RemoveChainRequest) EmitProtobuf(mm *easyproto.MessageMarshaler) { if x == nil { return } - if x.Body != nil && x.Body.StableSize() != 0 { + if x.Body != nil { x.Body.EmitProtobuf(mm.AppendMessage(1)) } - if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 { + if x.MetaHeader != nil { x.MetaHeader.EmitProtobuf(mm.AppendMessage(2)) } - if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 { + if x.VerifyHeader != nil { x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3)) } } @@ -1291,13 +1291,13 @@ func (x *RemoveChainResponse) EmitProtobuf(mm *easyproto.MessageMarshaler) { if x == nil { return } - if x.Body != nil && x.Body.StableSize() != 0 { + if x.Body != nil { x.Body.EmitProtobuf(mm.AppendMessage(1)) } - if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 { + if x.MetaHeader != nil { x.MetaHeader.EmitProtobuf(mm.AppendMessage(2)) } - if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 { + if x.VerifyHeader != nil { x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3)) } } @@ -1490,7 +1490,7 @@ func (x *ListChainsRequest_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) { if x == nil { return } - if x.Target != nil && x.Target.StableSize() != 0 { + if x.Target != nil { x.Target.EmitProtobuf(mm.AppendMessage(1)) } } @@ -1645,13 +1645,13 @@ func (x *ListChainsRequest) EmitProtobuf(mm *easyproto.MessageMarshaler) { if x == nil { return } - if x.Body != nil && x.Body.StableSize() != 0 { + if x.Body != nil { x.Body.EmitProtobuf(mm.AppendMessage(1)) } - if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 { + if x.MetaHeader != nil { x.MetaHeader.EmitProtobuf(mm.AppendMessage(2)) } - if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 { + if x.VerifyHeader != nil { x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3)) } } @@ -1847,7 +1847,7 @@ func (x *ListChainsResponse_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) { return } for i := range x.Chains { - if x.Chains[i] != nil && x.Chains[i].StableSize() != 0 { + if x.Chains[i] != nil { x.Chains[i].EmitProtobuf(mm.AppendMessage(1)) } } @@ -2018,13 +2018,13 @@ func (x *ListChainsResponse) EmitProtobuf(mm *easyproto.MessageMarshaler) { if x == nil { return } - if x.Body != nil && x.Body.StableSize() != 0 { + if x.Body != nil { x.Body.EmitProtobuf(mm.AppendMessage(1)) } - if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 { + if x.MetaHeader != nil { x.MetaHeader.EmitProtobuf(mm.AppendMessage(2)) } - if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 { + if x.VerifyHeader != nil { x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3)) } } diff --git a/container/grpc/service_frostfs.pb.go b/container/grpc/service_frostfs.pb.go index 7590435..514f03b 100644 --- a/container/grpc/service_frostfs.pb.go +++ b/container/grpc/service_frostfs.pb.go @@ -53,10 +53,10 @@ func (x *PutRequest_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) { if x == nil { return } - if x.Container != nil && x.Container.StableSize() != 0 { + if x.Container != nil { x.Container.EmitProtobuf(mm.AppendMessage(1)) } - if x.Signature != nil && x.Signature.StableSize() != 0 { + if x.Signature != nil { x.Signature.EmitProtobuf(mm.AppendMessage(2)) } } @@ -241,13 +241,13 @@ func (x *PutRequest) EmitProtobuf(mm *easyproto.MessageMarshaler) { if x == nil { return } - if x.Body != nil && x.Body.StableSize() != 0 { + if x.Body != nil { x.Body.EmitProtobuf(mm.AppendMessage(1)) } - if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 { + if x.MetaHeader != nil { x.MetaHeader.EmitProtobuf(mm.AppendMessage(2)) } - if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 { + if x.VerifyHeader != nil { x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3)) } } @@ -440,7 +440,7 @@ func (x *PutResponse_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) { if x == nil { return } - if x.ContainerId != nil && x.ContainerId.StableSize() != 0 { + if x.ContainerId != nil { x.ContainerId.EmitProtobuf(mm.AppendMessage(1)) } } @@ -595,13 +595,13 @@ func (x *PutResponse) EmitProtobuf(mm *easyproto.MessageMarshaler) { if x == nil { return } - if x.Body != nil && x.Body.StableSize() != 0 { + if x.Body != nil { x.Body.EmitProtobuf(mm.AppendMessage(1)) } - if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 { + if x.MetaHeader != nil { x.MetaHeader.EmitProtobuf(mm.AppendMessage(2)) } - if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 { + if x.VerifyHeader != nil { x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3)) } } @@ -796,10 +796,10 @@ func (x *DeleteRequest_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) { if x == nil { return } - if x.ContainerId != nil && x.ContainerId.StableSize() != 0 { + if x.ContainerId != nil { x.ContainerId.EmitProtobuf(mm.AppendMessage(1)) } - if x.Signature != nil && x.Signature.StableSize() != 0 { + if x.Signature != nil { x.Signature.EmitProtobuf(mm.AppendMessage(2)) } } @@ -984,13 +984,13 @@ func (x *DeleteRequest) EmitProtobuf(mm *easyproto.MessageMarshaler) { if x == nil { return } - if x.Body != nil && x.Body.StableSize() != 0 { + if x.Body != nil { x.Body.EmitProtobuf(mm.AppendMessage(1)) } - if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 { + if x.MetaHeader != nil { x.MetaHeader.EmitProtobuf(mm.AppendMessage(2)) } - if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 { + if x.VerifyHeader != nil { x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3)) } } @@ -1300,13 +1300,13 @@ func (x *DeleteResponse) EmitProtobuf(mm *easyproto.MessageMarshaler) { if x == nil { return } - if x.Body != nil && x.Body.StableSize() != 0 { + if x.Body != nil { x.Body.EmitProtobuf(mm.AppendMessage(1)) } - if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 { + if x.MetaHeader != nil { x.MetaHeader.EmitProtobuf(mm.AppendMessage(2)) } - if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 { + if x.VerifyHeader != nil { x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3)) } } @@ -1499,7 +1499,7 @@ func (x *GetRequest_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) { if x == nil { return } - if x.ContainerId != nil && x.ContainerId.StableSize() != 0 { + if x.ContainerId != nil { x.ContainerId.EmitProtobuf(mm.AppendMessage(1)) } } @@ -1654,13 +1654,13 @@ func (x *GetRequest) EmitProtobuf(mm *easyproto.MessageMarshaler) { if x == nil { return } - if x.Body != nil && x.Body.StableSize() != 0 { + if x.Body != nil { x.Body.EmitProtobuf(mm.AppendMessage(1)) } - if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 { + if x.MetaHeader != nil { x.MetaHeader.EmitProtobuf(mm.AppendMessage(2)) } - if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 { + if x.VerifyHeader != nil { x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3)) } } @@ -1857,13 +1857,13 @@ func (x *GetResponse_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) { if x == nil { return } - if x.Container != nil && x.Container.StableSize() != 0 { + if x.Container != nil { x.Container.EmitProtobuf(mm.AppendMessage(1)) } - if x.Signature != nil && x.Signature.StableSize() != 0 { + if x.Signature != nil { x.Signature.EmitProtobuf(mm.AppendMessage(2)) } - if x.SessionToken != nil && x.SessionToken.StableSize() != 0 { + if x.SessionToken != nil { x.SessionToken.EmitProtobuf(mm.AppendMessage(3)) } } @@ -2078,13 +2078,13 @@ func (x *GetResponse) EmitProtobuf(mm *easyproto.MessageMarshaler) { if x == nil { return } - if x.Body != nil && x.Body.StableSize() != 0 { + if x.Body != nil { x.Body.EmitProtobuf(mm.AppendMessage(1)) } - if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 { + if x.MetaHeader != nil { x.MetaHeader.EmitProtobuf(mm.AppendMessage(2)) } - if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 { + if x.VerifyHeader != nil { x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3)) } } @@ -2277,7 +2277,7 @@ func (x *ListRequest_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) { if x == nil { return } - if x.OwnerId != nil && x.OwnerId.StableSize() != 0 { + if x.OwnerId != nil { x.OwnerId.EmitProtobuf(mm.AppendMessage(1)) } } @@ -2432,13 +2432,13 @@ func (x *ListRequest) EmitProtobuf(mm *easyproto.MessageMarshaler) { if x == nil { return } - if x.Body != nil && x.Body.StableSize() != 0 { + if x.Body != nil { x.Body.EmitProtobuf(mm.AppendMessage(1)) } - if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 { + if x.MetaHeader != nil { x.MetaHeader.EmitProtobuf(mm.AppendMessage(2)) } - if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 { + if x.VerifyHeader != nil { x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3)) } } @@ -2634,7 +2634,7 @@ func (x *ListResponse_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) { return } for i := range x.ContainerIds { - if x.ContainerIds[i] != nil && x.ContainerIds[i].StableSize() != 0 { + if x.ContainerIds[i] != nil { x.ContainerIds[i].EmitProtobuf(mm.AppendMessage(1)) } } @@ -2805,13 +2805,13 @@ func (x *ListResponse) EmitProtobuf(mm *easyproto.MessageMarshaler) { if x == nil { return } - if x.Body != nil && x.Body.StableSize() != 0 { + if x.Body != nil { x.Body.EmitProtobuf(mm.AppendMessage(1)) } - if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 { + if x.MetaHeader != nil { x.MetaHeader.EmitProtobuf(mm.AppendMessage(2)) } - if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 { + if x.VerifyHeader != nil { x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3)) } } @@ -3004,7 +3004,7 @@ func (x *GetExtendedACLRequest_Body) EmitProtobuf(mm *easyproto.MessageMarshaler if x == nil { return } - if x.ContainerId != nil && x.ContainerId.StableSize() != 0 { + if x.ContainerId != nil { x.ContainerId.EmitProtobuf(mm.AppendMessage(1)) } } @@ -3159,13 +3159,13 @@ func (x *GetExtendedACLRequest) EmitProtobuf(mm *easyproto.MessageMarshaler) { if x == nil { return } - if x.Body != nil && x.Body.StableSize() != 0 { + if x.Body != nil { x.Body.EmitProtobuf(mm.AppendMessage(1)) } - if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 { + if x.MetaHeader != nil { x.MetaHeader.EmitProtobuf(mm.AppendMessage(2)) } - if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 { + if x.VerifyHeader != nil { x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3)) } } @@ -3362,13 +3362,13 @@ func (x *GetExtendedACLResponse_Body) EmitProtobuf(mm *easyproto.MessageMarshale if x == nil { return } - if x.Eacl != nil && x.Eacl.StableSize() != 0 { + if x.Eacl != nil { x.Eacl.EmitProtobuf(mm.AppendMessage(1)) } - if x.Signature != nil && x.Signature.StableSize() != 0 { + if x.Signature != nil { x.Signature.EmitProtobuf(mm.AppendMessage(2)) } - if x.SessionToken != nil && x.SessionToken.StableSize() != 0 { + if x.SessionToken != nil { x.SessionToken.EmitProtobuf(mm.AppendMessage(3)) } } @@ -3583,13 +3583,13 @@ func (x *GetExtendedACLResponse) EmitProtobuf(mm *easyproto.MessageMarshaler) { if x == nil { return } - if x.Body != nil && x.Body.StableSize() != 0 { + if x.Body != nil { x.Body.EmitProtobuf(mm.AppendMessage(1)) } - if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 { + if x.MetaHeader != nil { x.MetaHeader.EmitProtobuf(mm.AppendMessage(2)) } - if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 { + if x.VerifyHeader != nil { x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3)) } } diff --git a/container/grpc/types_frostfs.pb.go b/container/grpc/types_frostfs.pb.go index 3e0d882..dcb9cf4 100644 --- a/container/grpc/types_frostfs.pb.go +++ b/container/grpc/types_frostfs.pb.go @@ -222,10 +222,10 @@ func (x *Container) EmitProtobuf(mm *easyproto.MessageMarshaler) { if x == nil { return } - if x.Version != nil && x.Version.StableSize() != 0 { + if x.Version != nil { x.Version.EmitProtobuf(mm.AppendMessage(1)) } - if x.OwnerId != nil && x.OwnerId.StableSize() != 0 { + if x.OwnerId != nil { x.OwnerId.EmitProtobuf(mm.AppendMessage(2)) } if len(x.Nonce) != 0 { @@ -235,11 +235,11 @@ func (x *Container) EmitProtobuf(mm *easyproto.MessageMarshaler) { mm.AppendUint32(4, x.BasicAcl) } for i := range x.Attributes { - if x.Attributes[i] != nil && x.Attributes[i].StableSize() != 0 { + if x.Attributes[i] != nil { x.Attributes[i].EmitProtobuf(mm.AppendMessage(5)) } } - if x.PlacementPolicy != nil && x.PlacementPolicy.StableSize() != 0 { + if x.PlacementPolicy != nil { x.PlacementPolicy.EmitProtobuf(mm.AppendMessage(6)) } } diff --git a/lock/grpc/types_frostfs.pb.go b/lock/grpc/types_frostfs.pb.go index 3012111..52a1a2d 100644 --- a/lock/grpc/types_frostfs.pb.go +++ b/lock/grpc/types_frostfs.pb.go @@ -52,7 +52,7 @@ func (x *Lock) EmitProtobuf(mm *easyproto.MessageMarshaler) { return } for i := range x.Members { - if x.Members[i] != nil && x.Members[i].StableSize() != 0 { + if x.Members[i] != nil { x.Members[i].EmitProtobuf(mm.AppendMessage(1)) } } diff --git a/netmap/grpc/service_frostfs.pb.go b/netmap/grpc/service_frostfs.pb.go index 1ce80ff..3d62855 100644 --- a/netmap/grpc/service_frostfs.pb.go +++ b/netmap/grpc/service_frostfs.pb.go @@ -167,13 +167,13 @@ func (x *LocalNodeInfoRequest) EmitProtobuf(mm *easyproto.MessageMarshaler) { if x == nil { return } - if x.Body != nil && x.Body.StableSize() != 0 { + if x.Body != nil { x.Body.EmitProtobuf(mm.AppendMessage(1)) } - if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 { + if x.MetaHeader != nil { x.MetaHeader.EmitProtobuf(mm.AppendMessage(2)) } - if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 { + if x.VerifyHeader != nil { x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3)) } } @@ -368,10 +368,10 @@ func (x *LocalNodeInfoResponse_Body) EmitProtobuf(mm *easyproto.MessageMarshaler if x == nil { return } - if x.Version != nil && x.Version.StableSize() != 0 { + if x.Version != nil { x.Version.EmitProtobuf(mm.AppendMessage(1)) } - if x.NodeInfo != nil && x.NodeInfo.StableSize() != 0 { + if x.NodeInfo != nil { x.NodeInfo.EmitProtobuf(mm.AppendMessage(2)) } } @@ -556,13 +556,13 @@ func (x *LocalNodeInfoResponse) EmitProtobuf(mm *easyproto.MessageMarshaler) { if x == nil { return } - if x.Body != nil && x.Body.StableSize() != 0 { + if x.Body != nil { x.Body.EmitProtobuf(mm.AppendMessage(1)) } - if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 { + if x.MetaHeader != nil { x.MetaHeader.EmitProtobuf(mm.AppendMessage(2)) } - if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 { + if x.VerifyHeader != nil { x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3)) } } @@ -872,13 +872,13 @@ func (x *NetworkInfoRequest) EmitProtobuf(mm *easyproto.MessageMarshaler) { if x == nil { return } - if x.Body != nil && x.Body.StableSize() != 0 { + if x.Body != nil { x.Body.EmitProtobuf(mm.AppendMessage(1)) } - if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 { + if x.MetaHeader != nil { x.MetaHeader.EmitProtobuf(mm.AppendMessage(2)) } - if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 { + if x.VerifyHeader != nil { x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3)) } } @@ -1071,7 +1071,7 @@ func (x *NetworkInfoResponse_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) if x == nil { return } - if x.NetworkInfo != nil && x.NetworkInfo.StableSize() != 0 { + if x.NetworkInfo != nil { x.NetworkInfo.EmitProtobuf(mm.AppendMessage(1)) } } @@ -1226,13 +1226,13 @@ func (x *NetworkInfoResponse) EmitProtobuf(mm *easyproto.MessageMarshaler) { if x == nil { return } - if x.Body != nil && x.Body.StableSize() != 0 { + if x.Body != nil { x.Body.EmitProtobuf(mm.AppendMessage(1)) } - if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 { + if x.MetaHeader != nil { x.MetaHeader.EmitProtobuf(mm.AppendMessage(2)) } - if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 { + if x.VerifyHeader != nil { x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3)) } } @@ -1542,13 +1542,13 @@ func (x *NetmapSnapshotRequest) EmitProtobuf(mm *easyproto.MessageMarshaler) { if x == nil { return } - if x.Body != nil && x.Body.StableSize() != 0 { + if x.Body != nil { x.Body.EmitProtobuf(mm.AppendMessage(1)) } - if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 { + if x.MetaHeader != nil { x.MetaHeader.EmitProtobuf(mm.AppendMessage(2)) } - if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 { + if x.VerifyHeader != nil { x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3)) } } @@ -1741,7 +1741,7 @@ func (x *NetmapSnapshotResponse_Body) EmitProtobuf(mm *easyproto.MessageMarshale if x == nil { return } - if x.Netmap != nil && x.Netmap.StableSize() != 0 { + if x.Netmap != nil { x.Netmap.EmitProtobuf(mm.AppendMessage(1)) } } @@ -1896,13 +1896,13 @@ func (x *NetmapSnapshotResponse) EmitProtobuf(mm *easyproto.MessageMarshaler) { if x == nil { return } - if x.Body != nil && x.Body.StableSize() != 0 { + if x.Body != nil { x.Body.EmitProtobuf(mm.AppendMessage(1)) } - if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 { + if x.MetaHeader != nil { x.MetaHeader.EmitProtobuf(mm.AppendMessage(2)) } - if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 { + if x.VerifyHeader != nil { x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3)) } } diff --git a/netmap/grpc/types_frostfs.pb.go b/netmap/grpc/types_frostfs.pb.go index 3bab079..6ecf0fa 100644 --- a/netmap/grpc/types_frostfs.pb.go +++ b/netmap/grpc/types_frostfs.pb.go @@ -166,7 +166,7 @@ func (x *Filter) EmitProtobuf(mm *easyproto.MessageMarshaler) { mm.AppendString(4, x.Value) } for i := range x.Filters { - if x.Filters[i] != nil && x.Filters[i].StableSize() != 0 { + if x.Filters[i] != nil { x.Filters[i].EmitProtobuf(mm.AppendMessage(5)) } } @@ -941,7 +941,7 @@ func (x *PlacementPolicy) EmitProtobuf(mm *easyproto.MessageMarshaler) { return } for i := range x.Replicas { - if x.Replicas[i] != nil && x.Replicas[i].StableSize() != 0 { + if x.Replicas[i] != nil { x.Replicas[i].EmitProtobuf(mm.AppendMessage(1)) } } @@ -949,12 +949,12 @@ func (x *PlacementPolicy) EmitProtobuf(mm *easyproto.MessageMarshaler) { mm.AppendUint32(2, x.ContainerBackupFactor) } for i := range x.Selectors { - if x.Selectors[i] != nil && x.Selectors[i].StableSize() != 0 { + if x.Selectors[i] != nil { x.Selectors[i].EmitProtobuf(mm.AppendMessage(3)) } } for i := range x.Filters { - if x.Filters[i] != nil && x.Filters[i].StableSize() != 0 { + if x.Filters[i] != nil { x.Filters[i].EmitProtobuf(mm.AppendMessage(4)) } } @@ -1506,7 +1506,7 @@ func (x *NodeInfo) EmitProtobuf(mm *easyproto.MessageMarshaler) { mm.AppendString(2, x.Addresses[j]) } for i := range x.Attributes { - if x.Attributes[i] != nil && x.Attributes[i].StableSize() != 0 { + if x.Attributes[i] != nil { x.Attributes[i].EmitProtobuf(mm.AppendMessage(3)) } } @@ -1774,7 +1774,7 @@ func (x *Netmap) EmitProtobuf(mm *easyproto.MessageMarshaler) { mm.AppendUint64(1, x.Epoch) } for i := range x.Nodes { - if x.Nodes[i] != nil && x.Nodes[i].StableSize() != 0 { + if x.Nodes[i] != nil { x.Nodes[i].EmitProtobuf(mm.AppendMessage(2)) } } @@ -2112,7 +2112,7 @@ func (x *NetworkConfig) EmitProtobuf(mm *easyproto.MessageMarshaler) { return } for i := range x.Parameters { - if x.Parameters[i] != nil && x.Parameters[i].StableSize() != 0 { + if x.Parameters[i] != nil { x.Parameters[i].EmitProtobuf(mm.AppendMessage(1)) } } @@ -2276,7 +2276,7 @@ func (x *NetworkInfo) EmitProtobuf(mm *easyproto.MessageMarshaler) { if x.MsPerBlock != 0 { mm.AppendInt64(3, x.MsPerBlock) } - if x.NetworkConfig != nil && x.NetworkConfig.StableSize() != 0 { + if x.NetworkConfig != nil { x.NetworkConfig.EmitProtobuf(mm.AppendMessage(4)) } } diff --git a/object/grpc/service_frostfs.pb.go b/object/grpc/service_frostfs.pb.go index ce8336a..0bd0111 100644 --- a/object/grpc/service_frostfs.pb.go +++ b/object/grpc/service_frostfs.pb.go @@ -53,7 +53,7 @@ func (x *GetRequest_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) { if x == nil { return } - if x.Address != nil && x.Address.StableSize() != 0 { + if x.Address != nil { x.Address.EmitProtobuf(mm.AppendMessage(1)) } if x.Raw { @@ -237,13 +237,13 @@ func (x *GetRequest) EmitProtobuf(mm *easyproto.MessageMarshaler) { if x == nil { return } - if x.Body != nil && x.Body.StableSize() != 0 { + if x.Body != nil { x.Body.EmitProtobuf(mm.AppendMessage(1)) } - if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 { + if x.MetaHeader != nil { x.MetaHeader.EmitProtobuf(mm.AppendMessage(2)) } - if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 { + if x.VerifyHeader != nil { x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3)) } } @@ -440,13 +440,13 @@ func (x *GetResponse_Body_Init) EmitProtobuf(mm *easyproto.MessageMarshaler) { if x == nil { return } - if x.ObjectId != nil && x.ObjectId.StableSize() != 0 { + if x.ObjectId != nil { x.ObjectId.EmitProtobuf(mm.AppendMessage(1)) } - if x.Signature != nil && x.Signature.StableSize() != 0 { + if x.Signature != nil { x.Signature.EmitProtobuf(mm.AppendMessage(2)) } - if x.Header != nil && x.Header.StableSize() != 0 { + if x.Header != nil { x.Header.EmitProtobuf(mm.AppendMessage(3)) } } @@ -651,7 +651,7 @@ func (x *GetResponse_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) { return } if inner, ok := x.ObjectPart.(*GetResponse_Body_Init_); ok { - if inner.Init != nil && inner.Init.StableSize() != 0 { + if inner.Init != nil { inner.Init.EmitProtobuf(mm.AppendMessage(1)) } } @@ -661,12 +661,12 @@ func (x *GetResponse_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) { } } if inner, ok := x.ObjectPart.(*GetResponse_Body_SplitInfo); ok { - if inner.SplitInfo != nil && inner.SplitInfo.StableSize() != 0 { + if inner.SplitInfo != nil { inner.SplitInfo.EmitProtobuf(mm.AppendMessage(3)) } } if inner, ok := x.ObjectPart.(*GetResponse_Body_EcInfo); ok { - if inner.EcInfo != nil && inner.EcInfo.StableSize() != 0 { + if inner.EcInfo != nil { inner.EcInfo.EmitProtobuf(mm.AppendMessage(4)) } } @@ -971,13 +971,13 @@ func (x *GetResponse) EmitProtobuf(mm *easyproto.MessageMarshaler) { if x == nil { return } - if x.Body != nil && x.Body.StableSize() != 0 { + if x.Body != nil { x.Body.EmitProtobuf(mm.AppendMessage(1)) } - if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 { + if x.MetaHeader != nil { x.MetaHeader.EmitProtobuf(mm.AppendMessage(2)) } - if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 { + if x.VerifyHeader != nil { x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3)) } } @@ -1178,13 +1178,13 @@ func (x *PutRequest_Body_Init) EmitProtobuf(mm *easyproto.MessageMarshaler) { if x == nil { return } - if x.ObjectId != nil && x.ObjectId.StableSize() != 0 { + if x.ObjectId != nil { x.ObjectId.EmitProtobuf(mm.AppendMessage(1)) } - if x.Signature != nil && x.Signature.StableSize() != 0 { + if x.Signature != nil { x.Signature.EmitProtobuf(mm.AppendMessage(2)) } - if x.Header != nil && x.Header.StableSize() != 0 { + if x.Header != nil { x.Header.EmitProtobuf(mm.AppendMessage(3)) } if len(x.CopiesNumber) != 0 { @@ -1426,7 +1426,7 @@ func (x *PutRequest_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) { return } if inner, ok := x.ObjectPart.(*PutRequest_Body_Init_); ok { - if inner.Init != nil && inner.Init.StableSize() != 0 { + if inner.Init != nil { inner.Init.EmitProtobuf(mm.AppendMessage(1)) } } @@ -1656,13 +1656,13 @@ func (x *PutRequest) EmitProtobuf(mm *easyproto.MessageMarshaler) { if x == nil { return } - if x.Body != nil && x.Body.StableSize() != 0 { + if x.Body != nil { x.Body.EmitProtobuf(mm.AppendMessage(1)) } - if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 { + if x.MetaHeader != nil { x.MetaHeader.EmitProtobuf(mm.AppendMessage(2)) } - if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 { + if x.VerifyHeader != nil { x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3)) } } @@ -1855,7 +1855,7 @@ func (x *PutResponse_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) { if x == nil { return } - if x.ObjectId != nil && x.ObjectId.StableSize() != 0 { + if x.ObjectId != nil { x.ObjectId.EmitProtobuf(mm.AppendMessage(1)) } } @@ -2010,13 +2010,13 @@ func (x *PutResponse) EmitProtobuf(mm *easyproto.MessageMarshaler) { if x == nil { return } - if x.Body != nil && x.Body.StableSize() != 0 { + if x.Body != nil { x.Body.EmitProtobuf(mm.AppendMessage(1)) } - if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 { + if x.MetaHeader != nil { x.MetaHeader.EmitProtobuf(mm.AppendMessage(2)) } - if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 { + if x.VerifyHeader != nil { x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3)) } } @@ -2209,7 +2209,7 @@ func (x *DeleteRequest_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) { if x == nil { return } - if x.Address != nil && x.Address.StableSize() != 0 { + if x.Address != nil { x.Address.EmitProtobuf(mm.AppendMessage(1)) } } @@ -2364,13 +2364,13 @@ func (x *DeleteRequest) EmitProtobuf(mm *easyproto.MessageMarshaler) { if x == nil { return } - if x.Body != nil && x.Body.StableSize() != 0 { + if x.Body != nil { x.Body.EmitProtobuf(mm.AppendMessage(1)) } - if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 { + if x.MetaHeader != nil { x.MetaHeader.EmitProtobuf(mm.AppendMessage(2)) } - if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 { + if x.VerifyHeader != nil { x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3)) } } @@ -2563,7 +2563,7 @@ func (x *DeleteResponse_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) { if x == nil { return } - if x.Tombstone != nil && x.Tombstone.StableSize() != 0 { + if x.Tombstone != nil { x.Tombstone.EmitProtobuf(mm.AppendMessage(1)) } } @@ -2718,13 +2718,13 @@ func (x *DeleteResponse) EmitProtobuf(mm *easyproto.MessageMarshaler) { if x == nil { return } - if x.Body != nil && x.Body.StableSize() != 0 { + if x.Body != nil { x.Body.EmitProtobuf(mm.AppendMessage(1)) } - if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 { + if x.MetaHeader != nil { x.MetaHeader.EmitProtobuf(mm.AppendMessage(2)) } - if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 { + if x.VerifyHeader != nil { x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3)) } } @@ -2921,7 +2921,7 @@ func (x *HeadRequest_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) { if x == nil { return } - if x.Address != nil && x.Address.StableSize() != 0 { + if x.Address != nil { x.Address.EmitProtobuf(mm.AppendMessage(1)) } if x.MainOnly { @@ -3134,13 +3134,13 @@ func (x *HeadRequest) EmitProtobuf(mm *easyproto.MessageMarshaler) { if x == nil { return } - if x.Body != nil && x.Body.StableSize() != 0 { + if x.Body != nil { x.Body.EmitProtobuf(mm.AppendMessage(1)) } - if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 { + if x.MetaHeader != nil { x.MetaHeader.EmitProtobuf(mm.AppendMessage(2)) } - if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 { + if x.VerifyHeader != nil { x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3)) } } @@ -3335,10 +3335,10 @@ func (x *HeaderWithSignature) EmitProtobuf(mm *easyproto.MessageMarshaler) { if x == nil { return } - if x.Header != nil && x.Header.StableSize() != 0 { + if x.Header != nil { x.Header.EmitProtobuf(mm.AppendMessage(1)) } - if x.Signature != nil && x.Signature.StableSize() != 0 { + if x.Signature != nil { x.Signature.EmitProtobuf(mm.AppendMessage(2)) } } @@ -3513,22 +3513,22 @@ func (x *HeadResponse_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) { return } if inner, ok := x.Head.(*HeadResponse_Body_Header); ok { - if inner.Header != nil && inner.Header.StableSize() != 0 { + if inner.Header != nil { inner.Header.EmitProtobuf(mm.AppendMessage(1)) } } if inner, ok := x.Head.(*HeadResponse_Body_ShortHeader); ok { - if inner.ShortHeader != nil && inner.ShortHeader.StableSize() != 0 { + if inner.ShortHeader != nil { inner.ShortHeader.EmitProtobuf(mm.AppendMessage(2)) } } if inner, ok := x.Head.(*HeadResponse_Body_SplitInfo); ok { - if inner.SplitInfo != nil && inner.SplitInfo.StableSize() != 0 { + if inner.SplitInfo != nil { inner.SplitInfo.EmitProtobuf(mm.AppendMessage(3)) } } if inner, ok := x.Head.(*HeadResponse_Body_EcInfo); ok { - if inner.EcInfo != nil && inner.EcInfo.StableSize() != 0 { + if inner.EcInfo != nil { inner.EcInfo.EmitProtobuf(mm.AppendMessage(4)) } } @@ -3829,13 +3829,13 @@ func (x *HeadResponse) EmitProtobuf(mm *easyproto.MessageMarshaler) { if x == nil { return } - if x.Body != nil && x.Body.StableSize() != 0 { + if x.Body != nil { x.Body.EmitProtobuf(mm.AppendMessage(1)) } - if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 { + if x.MetaHeader != nil { x.MetaHeader.EmitProtobuf(mm.AppendMessage(2)) } - if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 { + if x.VerifyHeader != nil { x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3)) } } @@ -4241,14 +4241,14 @@ func (x *SearchRequest_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) { if x == nil { return } - if x.ContainerId != nil && x.ContainerId.StableSize() != 0 { + if x.ContainerId != nil { x.ContainerId.EmitProtobuf(mm.AppendMessage(1)) } if x.Version != 0 { mm.AppendUint32(2, x.Version) } for i := range x.Filters { - if x.Filters[i] != nil && x.Filters[i].StableSize() != 0 { + if x.Filters[i] != nil { x.Filters[i].EmitProtobuf(mm.AppendMessage(3)) } } @@ -4475,13 +4475,13 @@ func (x *SearchRequest) EmitProtobuf(mm *easyproto.MessageMarshaler) { if x == nil { return } - if x.Body != nil && x.Body.StableSize() != 0 { + if x.Body != nil { x.Body.EmitProtobuf(mm.AppendMessage(1)) } - if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 { + if x.MetaHeader != nil { x.MetaHeader.EmitProtobuf(mm.AppendMessage(2)) } - if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 { + if x.VerifyHeader != nil { x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3)) } } @@ -4677,7 +4677,7 @@ func (x *SearchResponse_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) { return } for i := range x.IdList { - if x.IdList[i] != nil && x.IdList[i].StableSize() != 0 { + if x.IdList[i] != nil { x.IdList[i].EmitProtobuf(mm.AppendMessage(1)) } } @@ -4848,13 +4848,13 @@ func (x *SearchResponse) EmitProtobuf(mm *easyproto.MessageMarshaler) { if x == nil { return } - if x.Body != nil && x.Body.StableSize() != 0 { + if x.Body != nil { x.Body.EmitProtobuf(mm.AppendMessage(1)) } - if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 { + if x.MetaHeader != nil { x.MetaHeader.EmitProtobuf(mm.AppendMessage(2)) } - if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 { + if x.VerifyHeader != nil { x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3)) } } @@ -5211,10 +5211,10 @@ func (x *GetRangeRequest_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) { if x == nil { return } - if x.Address != nil && x.Address.StableSize() != 0 { + if x.Address != nil { x.Address.EmitProtobuf(mm.AppendMessage(1)) } - if x.Range != nil && x.Range.StableSize() != 0 { + if x.Range != nil { x.Range.EmitProtobuf(mm.AppendMessage(2)) } if x.Raw { @@ -5428,13 +5428,13 @@ func (x *GetRangeRequest) EmitProtobuf(mm *easyproto.MessageMarshaler) { if x == nil { return } - if x.Body != nil && x.Body.StableSize() != 0 { + if x.Body != nil { x.Body.EmitProtobuf(mm.AppendMessage(1)) } - if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 { + if x.MetaHeader != nil { x.MetaHeader.EmitProtobuf(mm.AppendMessage(2)) } - if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 { + if x.VerifyHeader != nil { x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3)) } } @@ -5641,12 +5641,12 @@ func (x *GetRangeResponse_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) { } } if inner, ok := x.RangePart.(*GetRangeResponse_Body_SplitInfo); ok { - if inner.SplitInfo != nil && inner.SplitInfo.StableSize() != 0 { + if inner.SplitInfo != nil { inner.SplitInfo.EmitProtobuf(mm.AppendMessage(2)) } } if inner, ok := x.RangePart.(*GetRangeResponse_Body_EcInfo); ok { - if inner.EcInfo != nil && inner.EcInfo.StableSize() != 0 { + if inner.EcInfo != nil { inner.EcInfo.EmitProtobuf(mm.AppendMessage(3)) } } @@ -5911,13 +5911,13 @@ func (x *GetRangeResponse) EmitProtobuf(mm *easyproto.MessageMarshaler) { if x == nil { return } - if x.Body != nil && x.Body.StableSize() != 0 { + if x.Body != nil { x.Body.EmitProtobuf(mm.AppendMessage(1)) } - if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 { + if x.MetaHeader != nil { x.MetaHeader.EmitProtobuf(mm.AppendMessage(2)) } - if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 { + if x.VerifyHeader != nil { x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3)) } } @@ -6118,11 +6118,11 @@ func (x *GetRangeHashRequest_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) if x == nil { return } - if x.Address != nil && x.Address.StableSize() != 0 { + if x.Address != nil { x.Address.EmitProtobuf(mm.AppendMessage(1)) } for i := range x.Ranges { - if x.Ranges[i] != nil && x.Ranges[i].StableSize() != 0 { + if x.Ranges[i] != nil { x.Ranges[i].EmitProtobuf(mm.AppendMessage(2)) } } @@ -6397,13 +6397,13 @@ func (x *GetRangeHashRequest) EmitProtobuf(mm *easyproto.MessageMarshaler) { if x == nil { return } - if x.Body != nil && x.Body.StableSize() != 0 { + if x.Body != nil { x.Body.EmitProtobuf(mm.AppendMessage(1)) } - if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 { + if x.MetaHeader != nil { x.MetaHeader.EmitProtobuf(mm.AppendMessage(2)) } - if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 { + if x.VerifyHeader != nil { x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3)) } } @@ -6808,13 +6808,13 @@ func (x *GetRangeHashResponse) EmitProtobuf(mm *easyproto.MessageMarshaler) { if x == nil { return } - if x.Body != nil && x.Body.StableSize() != 0 { + if x.Body != nil { x.Body.EmitProtobuf(mm.AppendMessage(1)) } - if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 { + if x.MetaHeader != nil { x.MetaHeader.EmitProtobuf(mm.AppendMessage(2)) } - if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 { + if x.VerifyHeader != nil { x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3)) } } @@ -7011,7 +7011,7 @@ func (x *PutSingleRequest_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) { if x == nil { return } - if x.Object != nil && x.Object.StableSize() != 0 { + if x.Object != nil { x.Object.EmitProtobuf(mm.AppendMessage(1)) } if len(x.CopiesNumber) != 0 { @@ -7209,13 +7209,13 @@ func (x *PutSingleRequest) EmitProtobuf(mm *easyproto.MessageMarshaler) { if x == nil { return } - if x.Body != nil && x.Body.StableSize() != 0 { + if x.Body != nil { x.Body.EmitProtobuf(mm.AppendMessage(1)) } - if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 { + if x.MetaHeader != nil { x.MetaHeader.EmitProtobuf(mm.AppendMessage(2)) } - if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 { + if x.VerifyHeader != nil { x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3)) } } @@ -7525,13 +7525,13 @@ func (x *PutSingleResponse) EmitProtobuf(mm *easyproto.MessageMarshaler) { if x == nil { return } - if x.Body != nil && x.Body.StableSize() != 0 { + if x.Body != nil { x.Body.EmitProtobuf(mm.AppendMessage(1)) } - if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 { + if x.MetaHeader != nil { x.MetaHeader.EmitProtobuf(mm.AppendMessage(2)) } - if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 { + if x.VerifyHeader != nil { x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3)) } } @@ -7726,7 +7726,7 @@ func (x *PatchRequest_Body_Patch) EmitProtobuf(mm *easyproto.MessageMarshaler) { if x == nil { return } - if x.SourceRange != nil && x.SourceRange.StableSize() != 0 { + if x.SourceRange != nil { x.SourceRange.EmitProtobuf(mm.AppendMessage(1)) } if len(x.Chunk) != 0 { @@ -7896,18 +7896,18 @@ func (x *PatchRequest_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) { if x == nil { return } - if x.Address != nil && x.Address.StableSize() != 0 { + if x.Address != nil { x.Address.EmitProtobuf(mm.AppendMessage(1)) } for i := range x.NewAttributes { - if x.NewAttributes[i] != nil && x.NewAttributes[i].StableSize() != 0 { + if x.NewAttributes[i] != nil { x.NewAttributes[i].EmitProtobuf(mm.AppendMessage(2)) } } if x.ReplaceAttributes { mm.AppendBool(3, x.ReplaceAttributes) } - if x.Patch != nil && x.Patch.StableSize() != 0 { + if x.Patch != nil { x.Patch.EmitProtobuf(mm.AppendMessage(4)) } } @@ -8163,13 +8163,13 @@ func (x *PatchRequest) EmitProtobuf(mm *easyproto.MessageMarshaler) { if x == nil { return } - if x.Body != nil && x.Body.StableSize() != 0 { + if x.Body != nil { x.Body.EmitProtobuf(mm.AppendMessage(1)) } - if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 { + if x.MetaHeader != nil { x.MetaHeader.EmitProtobuf(mm.AppendMessage(2)) } - if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 { + if x.VerifyHeader != nil { x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3)) } } @@ -8362,7 +8362,7 @@ func (x *PatchResponse_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) { if x == nil { return } - if x.ObjectId != nil && x.ObjectId.StableSize() != 0 { + if x.ObjectId != nil { x.ObjectId.EmitProtobuf(mm.AppendMessage(1)) } } @@ -8517,13 +8517,13 @@ func (x *PatchResponse) EmitProtobuf(mm *easyproto.MessageMarshaler) { if x == nil { return } - if x.Body != nil && x.Body.StableSize() != 0 { + if x.Body != nil { x.Body.EmitProtobuf(mm.AppendMessage(1)) } - if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 { + if x.MetaHeader != nil { x.MetaHeader.EmitProtobuf(mm.AppendMessage(2)) } - if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 { + if x.VerifyHeader != nil { x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3)) } } diff --git a/object/grpc/types_frostfs.pb.go b/object/grpc/types_frostfs.pb.go index 492ee48..04a3e29 100644 --- a/object/grpc/types_frostfs.pb.go +++ b/object/grpc/types_frostfs.pb.go @@ -139,13 +139,13 @@ func (x *ShortHeader) EmitProtobuf(mm *easyproto.MessageMarshaler) { if x == nil { return } - if x.Version != nil && x.Version.StableSize() != 0 { + if x.Version != nil { x.Version.EmitProtobuf(mm.AppendMessage(1)) } if x.CreationEpoch != 0 { mm.AppendUint64(2, x.CreationEpoch) } - if x.OwnerId != nil && x.OwnerId.StableSize() != 0 { + if x.OwnerId != nil { x.OwnerId.EmitProtobuf(mm.AppendMessage(3)) } if int32(x.ObjectType) != 0 { @@ -154,10 +154,10 @@ func (x *ShortHeader) EmitProtobuf(mm *easyproto.MessageMarshaler) { if x.PayloadLength != 0 { mm.AppendUint64(5, x.PayloadLength) } - if x.PayloadHash != nil && x.PayloadHash.StableSize() != 0 { + if x.PayloadHash != nil { x.PayloadHash.EmitProtobuf(mm.AppendMessage(6)) } - if x.HomomorphicHash != nil && x.HomomorphicHash.StableSize() != 0 { + if x.HomomorphicHash != nil { x.HomomorphicHash.EmitProtobuf(mm.AppendMessage(7)) } } @@ -646,20 +646,20 @@ func (x *Header_Split) EmitProtobuf(mm *easyproto.MessageMarshaler) { if x == nil { return } - if x.Parent != nil && x.Parent.StableSize() != 0 { + if x.Parent != nil { x.Parent.EmitProtobuf(mm.AppendMessage(1)) } - if x.Previous != nil && x.Previous.StableSize() != 0 { + if x.Previous != nil { x.Previous.EmitProtobuf(mm.AppendMessage(2)) } - if x.ParentSignature != nil && x.ParentSignature.StableSize() != 0 { + if x.ParentSignature != nil { x.ParentSignature.EmitProtobuf(mm.AppendMessage(3)) } - if x.ParentHeader != nil && x.ParentHeader.StableSize() != 0 { + if x.ParentHeader != nil { x.ParentHeader.EmitProtobuf(mm.AppendMessage(4)) } for i := range x.Children { - if x.Children[i] != nil && x.Children[i].StableSize() != 0 { + if x.Children[i] != nil { x.Children[i].EmitProtobuf(mm.AppendMessage(5)) } } @@ -973,7 +973,7 @@ func (x *Header_EC) EmitProtobuf(mm *easyproto.MessageMarshaler) { if x == nil { return } - if x.Parent != nil && x.Parent.StableSize() != 0 { + if x.Parent != nil { x.Parent.EmitProtobuf(mm.AppendMessage(1)) } if x.Index != 0 { @@ -991,11 +991,11 @@ func (x *Header_EC) EmitProtobuf(mm *easyproto.MessageMarshaler) { if len(x.ParentSplitId) != 0 { mm.AppendBytes(6, x.ParentSplitId) } - if x.ParentSplitParentId != nil && x.ParentSplitParentId.StableSize() != 0 { + if x.ParentSplitParentId != nil { x.ParentSplitParentId.EmitProtobuf(mm.AppendMessage(7)) } for i := range x.ParentAttributes { - if x.ParentAttributes[i] != nil && x.ParentAttributes[i].StableSize() != 0 { + if x.ParentAttributes[i] != nil { x.ParentAttributes[i].EmitProtobuf(mm.AppendMessage(8)) } } @@ -1358,13 +1358,13 @@ func (x *Header) EmitProtobuf(mm *easyproto.MessageMarshaler) { if x == nil { return } - if x.Version != nil && x.Version.StableSize() != 0 { + if x.Version != nil { x.Version.EmitProtobuf(mm.AppendMessage(1)) } - if x.ContainerId != nil && x.ContainerId.StableSize() != 0 { + if x.ContainerId != nil { x.ContainerId.EmitProtobuf(mm.AppendMessage(2)) } - if x.OwnerId != nil && x.OwnerId.StableSize() != 0 { + if x.OwnerId != nil { x.OwnerId.EmitProtobuf(mm.AppendMessage(3)) } if x.CreationEpoch != 0 { @@ -1373,27 +1373,27 @@ func (x *Header) EmitProtobuf(mm *easyproto.MessageMarshaler) { if x.PayloadLength != 0 { mm.AppendUint64(5, x.PayloadLength) } - if x.PayloadHash != nil && x.PayloadHash.StableSize() != 0 { + if x.PayloadHash != nil { x.PayloadHash.EmitProtobuf(mm.AppendMessage(6)) } if int32(x.ObjectType) != 0 { mm.AppendInt32(7, int32(x.ObjectType)) } - if x.HomomorphicHash != nil && x.HomomorphicHash.StableSize() != 0 { + if x.HomomorphicHash != nil { x.HomomorphicHash.EmitProtobuf(mm.AppendMessage(8)) } - if x.SessionToken != nil && x.SessionToken.StableSize() != 0 { + if x.SessionToken != nil { x.SessionToken.EmitProtobuf(mm.AppendMessage(9)) } for i := range x.Attributes { - if x.Attributes[i] != nil && x.Attributes[i].StableSize() != 0 { + if x.Attributes[i] != nil { x.Attributes[i].EmitProtobuf(mm.AppendMessage(10)) } } - if x.Split != nil && x.Split.StableSize() != 0 { + if x.Split != nil { x.Split.EmitProtobuf(mm.AppendMessage(11)) } - if x.Ec != nil && x.Ec.StableSize() != 0 { + if x.Ec != nil { x.Ec.EmitProtobuf(mm.AppendMessage(12)) } } @@ -1881,13 +1881,13 @@ func (x *Object) EmitProtobuf(mm *easyproto.MessageMarshaler) { if x == nil { return } - if x.ObjectId != nil && x.ObjectId.StableSize() != 0 { + if x.ObjectId != nil { x.ObjectId.EmitProtobuf(mm.AppendMessage(1)) } - if x.Signature != nil && x.Signature.StableSize() != 0 { + if x.Signature != nil { x.Signature.EmitProtobuf(mm.AppendMessage(2)) } - if x.Header != nil && x.Header.StableSize() != 0 { + if x.Header != nil { x.Header.EmitProtobuf(mm.AppendMessage(3)) } if len(x.Payload) != 0 { @@ -2116,10 +2116,10 @@ func (x *SplitInfo) EmitProtobuf(mm *easyproto.MessageMarshaler) { if len(x.SplitId) != 0 { mm.AppendBytes(1, x.SplitId) } - if x.LastPart != nil && x.LastPart.StableSize() != 0 { + if x.LastPart != nil { x.LastPart.EmitProtobuf(mm.AppendMessage(2)) } - if x.Link != nil && x.Link.StableSize() != 0 { + if x.Link != nil { x.Link.EmitProtobuf(mm.AppendMessage(3)) } } @@ -2312,7 +2312,7 @@ func (x *ECInfo_Chunk) EmitProtobuf(mm *easyproto.MessageMarshaler) { if x == nil { return } - if x.Id != nil && x.Id.StableSize() != 0 { + if x.Id != nil { x.Id.EmitProtobuf(mm.AppendMessage(1)) } if x.Index != 0 { @@ -2506,7 +2506,7 @@ func (x *ECInfo) EmitProtobuf(mm *easyproto.MessageMarshaler) { return } for i := range x.Chunks { - if x.Chunks[i] != nil && x.Chunks[i].StableSize() != 0 { + if x.Chunks[i] != nil { x.Chunks[i].EmitProtobuf(mm.AppendMessage(1)) } } diff --git a/refs/grpc/types_frostfs.pb.go b/refs/grpc/types_frostfs.pb.go index 881a06f..35febe9 100644 --- a/refs/grpc/types_frostfs.pb.go +++ b/refs/grpc/types_frostfs.pb.go @@ -121,10 +121,10 @@ func (x *Address) EmitProtobuf(mm *easyproto.MessageMarshaler) { if x == nil { return } - if x.ContainerId != nil && x.ContainerId.StableSize() != 0 { + if x.ContainerId != nil { x.ContainerId.EmitProtobuf(mm.AppendMessage(1)) } - if x.ObjectId != nil && x.ObjectId.StableSize() != 0 { + if x.ObjectId != nil { x.ObjectId.EmitProtobuf(mm.AppendMessage(2)) } } diff --git a/rpc/message/test/message.go b/rpc/message/test/message.go index 1f7097e..0849b20 100644 --- a/rpc/message/test/message.go +++ b/rpc/message/test/message.go @@ -111,7 +111,6 @@ func testCompatibility(t *testing.T, msgGen func(empty bool) message.Message) { } } t.Run("empty", func(t *testing.T) { - t.Skip() msg := msgGen(true) t.Run(fmt.Sprintf("Binary_%T", msg), func(t *testing.T) { compareBinary(t, msg) diff --git a/session/grpc/service_frostfs.pb.go b/session/grpc/service_frostfs.pb.go index cfec4d6..aa42ee8 100644 --- a/session/grpc/service_frostfs.pb.go +++ b/session/grpc/service_frostfs.pb.go @@ -51,7 +51,7 @@ func (x *CreateRequest_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) { if x == nil { return } - if x.OwnerId != nil && x.OwnerId.StableSize() != 0 { + if x.OwnerId != nil { x.OwnerId.EmitProtobuf(mm.AppendMessage(1)) } if x.Expiration != 0 { @@ -235,13 +235,13 @@ func (x *CreateRequest) EmitProtobuf(mm *easyproto.MessageMarshaler) { if x == nil { return } - if x.Body != nil && x.Body.StableSize() != 0 { + if x.Body != nil { x.Body.EmitProtobuf(mm.AppendMessage(1)) } - if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 { + if x.MetaHeader != nil { x.MetaHeader.EmitProtobuf(mm.AppendMessage(2)) } - if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 { + if x.VerifyHeader != nil { x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3)) } } @@ -616,13 +616,13 @@ func (x *CreateResponse) EmitProtobuf(mm *easyproto.MessageMarshaler) { if x == nil { return } - if x.Body != nil && x.Body.StableSize() != 0 { + if x.Body != nil { x.Body.EmitProtobuf(mm.AppendMessage(1)) } - if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 { + if x.MetaHeader != nil { x.MetaHeader.EmitProtobuf(mm.AppendMessage(2)) } - if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 { + if x.VerifyHeader != nil { x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3)) } } diff --git a/session/grpc/types_frostfs.pb.go b/session/grpc/types_frostfs.pb.go index af95210..4f8bf81 100644 --- a/session/grpc/types_frostfs.pb.go +++ b/session/grpc/types_frostfs.pb.go @@ -109,11 +109,11 @@ func (x *ObjectSessionContext_Target) EmitProtobuf(mm *easyproto.MessageMarshale if x == nil { return } - if x.Container != nil && x.Container.StableSize() != 0 { + if x.Container != nil { x.Container.EmitProtobuf(mm.AppendMessage(1)) } for i := range x.Objects { - if x.Objects[i] != nil && x.Objects[i].StableSize() != 0 { + if x.Objects[i] != nil { x.Objects[i].EmitProtobuf(mm.AppendMessage(2)) } } @@ -297,7 +297,7 @@ func (x *ObjectSessionContext) EmitProtobuf(mm *easyproto.MessageMarshaler) { if int32(x.Verb) != 0 { mm.AppendInt32(1, int32(x.Verb)) } - if x.Target != nil && x.Target.StableSize() != 0 { + if x.Target != nil { x.Target.EmitProtobuf(mm.AppendMessage(2)) } } @@ -520,7 +520,7 @@ func (x *ContainerSessionContext) EmitProtobuf(mm *easyproto.MessageMarshaler) { if x.Wildcard { mm.AppendBool(2, x.Wildcard) } - if x.ContainerId != nil && x.ContainerId.StableSize() != 0 { + if x.ContainerId != nil { x.ContainerId.EmitProtobuf(mm.AppendMessage(3)) } } @@ -928,22 +928,22 @@ func (x *SessionToken_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) { if len(x.Id) != 0 { mm.AppendBytes(1, x.Id) } - if x.OwnerId != nil && x.OwnerId.StableSize() != 0 { + if x.OwnerId != nil { x.OwnerId.EmitProtobuf(mm.AppendMessage(2)) } - if x.Lifetime != nil && x.Lifetime.StableSize() != 0 { + if x.Lifetime != nil { x.Lifetime.EmitProtobuf(mm.AppendMessage(3)) } if len(x.SessionKey) != 0 { mm.AppendBytes(4, x.SessionKey) } if inner, ok := x.Context.(*SessionToken_Body_Object); ok { - if inner.Object != nil && inner.Object.StableSize() != 0 { + if inner.Object != nil { inner.Object.EmitProtobuf(mm.AppendMessage(5)) } } if inner, ok := x.Context.(*SessionToken_Body_Container); ok { - if inner.Container != nil && inner.Container.StableSize() != 0 { + if inner.Container != nil { inner.Container.EmitProtobuf(mm.AppendMessage(6)) } } @@ -1256,10 +1256,10 @@ func (x *SessionToken) EmitProtobuf(mm *easyproto.MessageMarshaler) { if x == nil { return } - if x.Body != nil && x.Body.StableSize() != 0 { + if x.Body != nil { x.Body.EmitProtobuf(mm.AppendMessage(1)) } - if x.Signature != nil && x.Signature.StableSize() != 0 { + if x.Signature != nil { x.Signature.EmitProtobuf(mm.AppendMessage(2)) } } @@ -1598,7 +1598,7 @@ func (x *RequestMetaHeader) EmitProtobuf(mm *easyproto.MessageMarshaler) { if x == nil { return } - if x.Version != nil && x.Version.StableSize() != 0 { + if x.Version != nil { x.Version.EmitProtobuf(mm.AppendMessage(1)) } if x.Epoch != 0 { @@ -1608,17 +1608,17 @@ func (x *RequestMetaHeader) EmitProtobuf(mm *easyproto.MessageMarshaler) { mm.AppendUint32(3, x.Ttl) } for i := range x.XHeaders { - if x.XHeaders[i] != nil && x.XHeaders[i].StableSize() != 0 { + if x.XHeaders[i] != nil { x.XHeaders[i].EmitProtobuf(mm.AppendMessage(4)) } } - if x.SessionToken != nil && x.SessionToken.StableSize() != 0 { + if x.SessionToken != nil { x.SessionToken.EmitProtobuf(mm.AppendMessage(5)) } - if x.BearerToken != nil && x.BearerToken.StableSize() != 0 { + if x.BearerToken != nil { x.BearerToken.EmitProtobuf(mm.AppendMessage(6)) } - if x.Origin != nil && x.Origin.StableSize() != 0 { + if x.Origin != nil { x.Origin.EmitProtobuf(mm.AppendMessage(7)) } if x.MagicNumber != 0 { @@ -1979,7 +1979,7 @@ func (x *ResponseMetaHeader) EmitProtobuf(mm *easyproto.MessageMarshaler) { if x == nil { return } - if x.Version != nil && x.Version.StableSize() != 0 { + if x.Version != nil { x.Version.EmitProtobuf(mm.AppendMessage(1)) } if x.Epoch != 0 { @@ -1989,14 +1989,14 @@ func (x *ResponseMetaHeader) EmitProtobuf(mm *easyproto.MessageMarshaler) { mm.AppendUint32(3, x.Ttl) } for i := range x.XHeaders { - if x.XHeaders[i] != nil && x.XHeaders[i].StableSize() != 0 { + if x.XHeaders[i] != nil { x.XHeaders[i].EmitProtobuf(mm.AppendMessage(4)) } } - if x.Origin != nil && x.Origin.StableSize() != 0 { + if x.Origin != nil { x.Origin.EmitProtobuf(mm.AppendMessage(5)) } - if x.Status != nil && x.Status.StableSize() != 0 { + if x.Status != nil { x.Status.EmitProtobuf(mm.AppendMessage(6)) } } @@ -2292,16 +2292,16 @@ func (x *RequestVerificationHeader) EmitProtobuf(mm *easyproto.MessageMarshaler) if x == nil { return } - if x.BodySignature != nil && x.BodySignature.StableSize() != 0 { + if x.BodySignature != nil { x.BodySignature.EmitProtobuf(mm.AppendMessage(1)) } - if x.MetaSignature != nil && x.MetaSignature.StableSize() != 0 { + if x.MetaSignature != nil { x.MetaSignature.EmitProtobuf(mm.AppendMessage(2)) } - if x.OriginSignature != nil && x.OriginSignature.StableSize() != 0 { + if x.OriginSignature != nil { x.OriginSignature.EmitProtobuf(mm.AppendMessage(3)) } - if x.Origin != nil && x.Origin.StableSize() != 0 { + if x.Origin != nil { x.Origin.EmitProtobuf(mm.AppendMessage(4)) } } @@ -2530,16 +2530,16 @@ func (x *ResponseVerificationHeader) EmitProtobuf(mm *easyproto.MessageMarshaler if x == nil { return } - if x.BodySignature != nil && x.BodySignature.StableSize() != 0 { + if x.BodySignature != nil { x.BodySignature.EmitProtobuf(mm.AppendMessage(1)) } - if x.MetaSignature != nil && x.MetaSignature.StableSize() != 0 { + if x.MetaSignature != nil { x.MetaSignature.EmitProtobuf(mm.AppendMessage(2)) } - if x.OriginSignature != nil && x.OriginSignature.StableSize() != 0 { + if x.OriginSignature != nil { x.OriginSignature.EmitProtobuf(mm.AppendMessage(3)) } - if x.Origin != nil && x.Origin.StableSize() != 0 { + if x.Origin != nil { x.Origin.EmitProtobuf(mm.AppendMessage(4)) } } diff --git a/status/grpc/types_frostfs.pb.go b/status/grpc/types_frostfs.pb.go index a12ab55..5012491 100644 --- a/status/grpc/types_frostfs.pb.go +++ b/status/grpc/types_frostfs.pb.go @@ -476,7 +476,7 @@ func (x *Status) EmitProtobuf(mm *easyproto.MessageMarshaler) { mm.AppendString(2, x.Message) } for i := range x.Details { - if x.Details[i] != nil && x.Details[i].StableSize() != 0 { + if x.Details[i] != nil { x.Details[i].EmitProtobuf(mm.AppendMessage(3)) } } diff --git a/tombstone/grpc/types_frostfs.pb.go b/tombstone/grpc/types_frostfs.pb.go index b0924c0..8c2e83c 100644 --- a/tombstone/grpc/types_frostfs.pb.go +++ b/tombstone/grpc/types_frostfs.pb.go @@ -62,7 +62,7 @@ func (x *Tombstone) EmitProtobuf(mm *easyproto.MessageMarshaler) { mm.AppendBytes(2, x.SplitId) } for i := range x.Members { - if x.Members[i] != nil && x.Members[i].StableSize() != 0 { + if x.Members[i] != nil { x.Members[i].EmitProtobuf(mm.AppendMessage(3)) } } diff --git a/util/proto/test/custom/test_frostfs.pb.go b/util/proto/test/custom/test_frostfs.pb.go index b1d2cf2..a39bba7 100644 --- a/util/proto/test/custom/test_frostfs.pb.go +++ b/util/proto/test/custom/test_frostfs.pb.go @@ -288,7 +288,7 @@ func (x *Primitives) EmitProtobuf(mm *easyproto.MessageMarshaler) { } } if inner, ok := x.FieldM.(*Primitives_FieldAux); ok { - if inner.FieldAux != nil && inner.FieldAux.StableSize() != 0 { + if inner.FieldAux != nil { inner.FieldAux.EmitProtobuf(mm.AppendMessage(403)) } } diff --git a/util/protogen/internalgengo/proto.go b/util/protogen/internalgengo/proto.go index 8e5e967..8894cde 100644 --- a/util/protogen/internalgengo/proto.go +++ b/util/protogen/internalgengo/proto.go @@ -174,7 +174,7 @@ func emitMarshalRaw(g *protogen.GeneratedFile, f *protogen.Field, name string) { name += "[i]" } - g.P("if ", notNil(name), " && ", name, ".StableSize() != 0 {") + g.P("if ", notNil(name), " {") g.P(name, ".EmitProtobuf(mm.AppendMessage(", f.Desc.Number(), "))") g.P("}") return From ca33fc4adb9715559cafccb48b3625b032c5d266 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Tue, 27 Aug 2024 11:35:49 +0300 Subject: [PATCH 1170/1196] [#109] rpc/message: Remove incorrect copypaste Signed-off-by: Evgenii Stratonikov --- rpc/message/test/message.go | 5 ----- 1 file changed, 5 deletions(-) diff --git a/rpc/message/test/message.go b/rpc/message/test/message.go index 0849b20..96b6de4 100644 --- a/rpc/message/test/message.go +++ b/rpc/message/test/message.go @@ -104,11 +104,6 @@ func testCompatibility(t *testing.T, msgGen func(empty bool) message.Message) { require.NoError(t, err) require.JSONEq(t, string(a), string(b)) - if len(a) == 0 { - require.Empty(t, b) - } else { - require.Equal(t, a, b) - } } t.Run("empty", func(t *testing.T) { msg := msgGen(true) From eba18f6e67ac7fd47670b8dad63f1a1379a04cac Mon Sep 17 00:00:00 2001 From: Airat Arifullin Date: Tue, 27 Aug 2024 13:45:04 +0300 Subject: [PATCH 1171/1196] [#110] object: Add getter and setter for `PatchResponseBody` Signed-off-by: Airat Arifullin --- object/types.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/object/types.go b/object/types.go index 160e820..0ca3f12 100644 --- a/object/types.go +++ b/object/types.go @@ -1615,6 +1615,18 @@ func (r *PatchResponse) SetBody(v *PatchResponseBody) { r.Body = v } +func (r *PatchResponseBody) GetObjectID() *refs.ObjectID { + if r != nil { + return r.ObjectID + } + + return nil +} + +func (r *PatchResponseBody) SetObjectID(objectID *refs.ObjectID) { + r.ObjectID = objectID +} + func (r *PatchRequestBodyPatch) GetChunk() []byte { if r != nil { return r.Chunk From a2025376fcd42534661cff65360c50f0b4643d3a Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Tue, 27 Aug 2024 15:02:16 +0300 Subject: [PATCH 1172/1196] [#111] proto/test: Add repeated message test Signed-off-by: Evgenii Stratonikov --- util/proto/marshal_test.go | 15 ++ util/proto/test/custom/test_frostfs.pb.go | 197 +++++++++++++++++++++- util/proto/test/test.pb.go | 117 ++++++++++--- util/proto/test/test.proto | 3 + 4 files changed, 304 insertions(+), 28 deletions(-) diff --git a/util/proto/marshal_test.go b/util/proto/marshal_test.go index 5d887ce..a848bb5 100644 --- a/util/proto/marshal_test.go +++ b/util/proto/marshal_test.go @@ -113,6 +113,10 @@ func repPrimitivesEqual(t *testing.T, a *generated.RepPrimitives, b *test.RepPri require.Equal(t, a.FieldE, b.FieldE) require.Equal(t, a.FieldF, b.FieldF) require.Equal(t, a.FieldFu, b.FieldFu) + require.Equal(t, len(a.GetFieldAux()), len(b.GetFieldAux())) + for i := range a.FieldAux { + require.Equal(t, a.GetFieldAux()[i].GetInnerField(), b.GetFieldAux()[i].GetInnerField()) + } } func randIntSlice[T protoInt](n int, includeZero bool) []T { @@ -129,6 +133,14 @@ func randIntSlice[T protoInt](n int, includeZero bool) []T { return r } +func uint32SliceToAux(s []uint32) []*generated.RepPrimitives_Aux { + r := make([]*generated.RepPrimitives_Aux, len(s)) + for i := range s { + r[i] = &generated.RepPrimitives_Aux{s[i]} + } + return r +} + func TestStableMarshalRep(t *testing.T) { t.Run("empty", func(t *testing.T) { marshalCases := []struct { @@ -176,6 +188,9 @@ func TestStableMarshalRep(t *testing.T) { {name: "uint64", input: &generated.RepPrimitives{FieldFu: randIntSlice[uint64](1, true)}}, {name: "uint64", input: &generated.RepPrimitives{FieldFu: randIntSlice[uint64](2, true)}}, {name: "uint64", input: &generated.RepPrimitives{FieldFu: randIntSlice[uint64](2, false)}}, + {name: "message", input: &generated.RepPrimitives{FieldAux: uint32SliceToAux(randIntSlice[uint32](1, true))}}, + {name: "message", input: &generated.RepPrimitives{FieldAux: uint32SliceToAux(randIntSlice[uint32](2, true))}}, + {name: "message", input: &generated.RepPrimitives{FieldAux: uint32SliceToAux(randIntSlice[uint32](2, false))}}, } for _, tc := range marshalCases { t.Run(tc.name, func(t *testing.T) { diff --git a/util/proto/test/custom/test_frostfs.pb.go b/util/proto/test/custom/test_frostfs.pb.go index a39bba7..f3b958f 100644 --- a/util/proto/test/custom/test_frostfs.pb.go +++ b/util/proto/test/custom/test_frostfs.pb.go @@ -802,14 +802,144 @@ func (*Primitives_FieldMe) isPrimitives_FieldM() {} func (*Primitives_FieldAux) isPrimitives_FieldM() {} +type RepPrimitives_Aux struct { + InnerField uint32 `json:"innerField"` +} + +var ( + _ encoding.ProtoMarshaler = (*RepPrimitives_Aux)(nil) + _ encoding.ProtoUnmarshaler = (*RepPrimitives_Aux)(nil) + _ json.Marshaler = (*RepPrimitives_Aux)(nil) + _ json.Unmarshaler = (*RepPrimitives_Aux)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *RepPrimitives_Aux) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.UInt32Size(1, x.InnerField) + return size +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *RepPrimitives_Aux) 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 *RepPrimitives_Aux) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if x.InnerField != 0 { + mm.AppendUint32(1, x.InnerField) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *RepPrimitives_Aux) 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", "RepPrimitives_Aux") + } + switch fc.FieldNum { + case 1: // InnerField + data, ok := fc.Uint32() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "InnerField") + } + x.InnerField = data + } + } + return nil +} +func (x *RepPrimitives_Aux) GetInnerField() uint32 { + if x != nil { + return x.InnerField + } + return 0 +} +func (x *RepPrimitives_Aux) SetInnerField(v uint32) { + x.InnerField = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *RepPrimitives_Aux) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *RepPrimitives_Aux) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + out.RawByte('{') + { + const prefix string = ",\"innerField\":" + out.RawString(prefix[1:]) + out.Uint32(x.InnerField) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *RepPrimitives_Aux) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *RepPrimitives_Aux) 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 "innerField": + { + var f uint32 + f = in.Uint32() + x.InnerField = f + } + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} + type RepPrimitives struct { - FieldA [][]byte `json:"fieldA"` - FieldB []string `json:"fieldB"` - FieldC []int32 `json:"fieldC"` - FieldD []uint32 `json:"fieldD"` - FieldE []int64 `json:"fieldE"` - FieldF []uint64 `json:"fieldF"` - FieldFu []uint64 `json:"fieldFu"` + FieldA [][]byte `json:"fieldA"` + FieldB []string `json:"fieldB"` + FieldC []int32 `json:"fieldC"` + FieldD []uint32 `json:"fieldD"` + FieldE []int64 `json:"fieldE"` + FieldF []uint64 `json:"fieldF"` + FieldFu []uint64 `json:"fieldFu"` + FieldAux []*RepPrimitives_Aux `json:"fieldAux"` } var ( @@ -840,6 +970,9 @@ func (x *RepPrimitives) StableSize() (size int) { for i := range x.FieldFu { size += protowire.SizeGroup(protowire.Number(7), protowire.SizeVarint(x.FieldFu[i])) } + for i := range x.FieldAux { + size += proto.NestedStructureSize(8, x.FieldAux[i]) + } return size } @@ -877,6 +1010,11 @@ func (x *RepPrimitives) EmitProtobuf(mm *easyproto.MessageMarshaler) { for j := range x.FieldFu { mm.AppendUint64(7, x.FieldFu[j]) } + for i := range x.FieldAux { + if x.FieldAux[i] != nil { + x.FieldAux[i].EmitProtobuf(mm.AppendMessage(8)) + } + } } // UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. @@ -930,6 +1068,16 @@ func (x *RepPrimitives) UnmarshalProtobuf(src []byte) (err error) { return fmt.Errorf("cannot unmarshal field %s", "FieldFu") } x.FieldFu = append(x.FieldFu, data) + case 8: // FieldAux + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "FieldAux") + } + x.FieldAux = append(x.FieldAux, new(RepPrimitives_Aux)) + ff := x.FieldAux[len(x.FieldAux)-1] + if err := ff.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } } } return nil @@ -997,6 +1145,15 @@ func (x *RepPrimitives) GetFieldFu() []uint64 { func (x *RepPrimitives) SetFieldFu(v []uint64) { x.FieldFu = v } +func (x *RepPrimitives) GetFieldAux() []*RepPrimitives_Aux { + if x != nil { + return x.FieldAux + } + return nil +} +func (x *RepPrimitives) SetFieldAux(v []*RepPrimitives_Aux) { + x.FieldAux = v +} // MarshalJSON implements the json.Marshaler interface. func (x *RepPrimitives) MarshalJSON() ([]byte, error) { @@ -1094,6 +1251,18 @@ func (x *RepPrimitives) MarshalEasyJSON(out *jwriter.Writer) { } out.RawByte(']') } + { + const prefix string = ",\"fieldAux\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.FieldAux { + if i != 0 { + out.RawByte(',') + } + x.FieldAux[i].MarshalEasyJSON(out) + } + out.RawByte(']') + } out.RawByte('}') } @@ -1213,6 +1382,20 @@ func (x *RepPrimitives) UnmarshalEasyJSON(in *jlexer.Lexer) { x.FieldFu = list in.Delim(']') } + case "fieldAux": + { + var f *RepPrimitives_Aux + var list []*RepPrimitives_Aux + in.Delim('[') + for !in.IsDelim(']') { + f = new(RepPrimitives_Aux) + f.UnmarshalEasyJSON(in) + list = append(list, f) + in.WantComma() + } + x.FieldAux = list + in.Delim(']') + } } in.WantComma() } diff --git a/util/proto/test/test.pb.go b/util/proto/test/test.pb.go index de8ec65..e7d5699 100644 --- a/util/proto/test/test.pb.go +++ b/util/proto/test/test.pb.go @@ -257,13 +257,14 @@ type RepPrimitives struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - FieldA [][]byte `protobuf:"bytes,1,rep,name=field_a,json=fieldA,proto3" json:"field_a,omitempty"` - FieldB []string `protobuf:"bytes,2,rep,name=field_b,json=fieldB,proto3" json:"field_b,omitempty"` - FieldC []int32 `protobuf:"varint,3,rep,packed,name=field_c,json=fieldC,proto3" json:"field_c,omitempty"` - FieldD []uint32 `protobuf:"varint,4,rep,packed,name=field_d,json=fieldD,proto3" json:"field_d,omitempty"` - FieldE []int64 `protobuf:"varint,5,rep,packed,name=field_e,json=fieldE,proto3" json:"field_e,omitempty"` - FieldF []uint64 `protobuf:"varint,6,rep,packed,name=field_f,json=fieldF,proto3" json:"field_f,omitempty"` - FieldFu []uint64 `protobuf:"varint,7,rep,name=field_fu,json=fieldFu,proto3" json:"field_fu,omitempty"` + FieldA [][]byte `protobuf:"bytes,1,rep,name=field_a,json=fieldA,proto3" json:"field_a,omitempty"` + FieldB []string `protobuf:"bytes,2,rep,name=field_b,json=fieldB,proto3" json:"field_b,omitempty"` + FieldC []int32 `protobuf:"varint,3,rep,packed,name=field_c,json=fieldC,proto3" json:"field_c,omitempty"` + FieldD []uint32 `protobuf:"varint,4,rep,packed,name=field_d,json=fieldD,proto3" json:"field_d,omitempty"` + FieldE []int64 `protobuf:"varint,5,rep,packed,name=field_e,json=fieldE,proto3" json:"field_e,omitempty"` + FieldF []uint64 `protobuf:"varint,6,rep,packed,name=field_f,json=fieldF,proto3" json:"field_f,omitempty"` + FieldFu []uint64 `protobuf:"varint,7,rep,name=field_fu,json=fieldFu,proto3" json:"field_fu,omitempty"` + FieldAux []*RepPrimitives_Aux `protobuf:"bytes,8,rep,name=field_aux,json=fieldAux,proto3" json:"field_aux,omitempty"` } func (x *RepPrimitives) Reset() { @@ -347,6 +348,13 @@ func (x *RepPrimitives) GetFieldFu() []uint64 { return nil } +func (x *RepPrimitives) GetFieldAux() []*RepPrimitives_Aux { + if x != nil { + return x.FieldAux + } + return nil +} + type Primitives_Aux struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -394,6 +402,53 @@ func (x *Primitives_Aux) GetInnerField() uint32 { return 0 } +type RepPrimitives_Aux struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + InnerField uint32 `protobuf:"varint,1,opt,name=inner_field,json=innerField,proto3" json:"inner_field,omitempty"` +} + +func (x *RepPrimitives_Aux) Reset() { + *x = RepPrimitives_Aux{} + if protoimpl.UnsafeEnabled { + mi := &file_util_proto_test_test_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RepPrimitives_Aux) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RepPrimitives_Aux) ProtoMessage() {} + +func (x *RepPrimitives_Aux) ProtoReflect() protoreflect.Message { + mi := &file_util_proto_test_test_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RepPrimitives_Aux.ProtoReflect.Descriptor instead. +func (*RepPrimitives_Aux) Descriptor() ([]byte, []int) { + return file_util_proto_test_test_proto_rawDescGZIP(), []int{1, 0} +} + +func (x *RepPrimitives_Aux) GetInnerField() uint32 { + if x != nil { + return x.InnerField + } + return 0 +} + var File_util_proto_test_test_proto protoreflect.FileDescriptor var file_util_proto_test_test_proto_rawDesc = []byte{ @@ -433,7 +488,7 @@ var file_util_proto_test_test_proto_rawDesc = []byte{ 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x0c, 0x0a, 0x08, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x49, 0x56, 0x45, 0x10, 0x01, 0x12, 0x15, 0x0a, 0x08, 0x4e, 0x45, 0x47, 0x41, 0x54, 0x49, 0x56, 0x45, 0x10, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, - 0x42, 0x09, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x6d, 0x22, 0xc4, 0x01, 0x0a, 0x0d, + 0x42, 0x09, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x6d, 0x22, 0xa2, 0x02, 0x0a, 0x0d, 0x52, 0x65, 0x70, 0x50, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, 0x12, 0x17, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x61, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x41, 0x12, 0x17, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, @@ -446,8 +501,14 @@ var file_util_proto_test_test_proto_rawDesc = []byte{ 0x65, 0x6c, 0x64, 0x5f, 0x66, 0x18, 0x06, 0x20, 0x03, 0x28, 0x04, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x46, 0x12, 0x1d, 0x0a, 0x08, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x66, 0x75, 0x18, 0x07, 0x20, 0x03, 0x28, 0x04, 0x42, 0x02, 0x10, 0x00, 0x52, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, - 0x46, 0x75, 0x42, 0x11, 0x5a, 0x0f, 0x75, 0x74, 0x69, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x2f, 0x74, 0x65, 0x73, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x46, 0x75, 0x12, 0x34, 0x0a, 0x09, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x61, 0x75, 0x78, 0x18, + 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x52, 0x65, 0x70, + 0x50, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, 0x2e, 0x41, 0x75, 0x78, 0x52, 0x08, + 0x66, 0x69, 0x65, 0x6c, 0x64, 0x41, 0x75, 0x78, 0x1a, 0x26, 0x0a, 0x03, 0x41, 0x75, 0x78, 0x12, + 0x1f, 0x0a, 0x0b, 0x69, 0x6e, 0x6e, 0x65, 0x72, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0a, 0x69, 0x6e, 0x6e, 0x65, 0x72, 0x46, 0x69, 0x65, 0x6c, 0x64, + 0x42, 0x11, 0x5a, 0x0f, 0x75, 0x74, 0x69, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x74, + 0x65, 0x73, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -463,21 +524,23 @@ func file_util_proto_test_test_proto_rawDescGZIP() []byte { } var file_util_proto_test_test_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_util_proto_test_test_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_util_proto_test_test_proto_msgTypes = make([]protoimpl.MessageInfo, 4) var file_util_proto_test_test_proto_goTypes = []interface{}{ - (Primitives_SomeEnum)(0), // 0: test.Primitives.SomeEnum - (*Primitives)(nil), // 1: test.Primitives - (*RepPrimitives)(nil), // 2: test.RepPrimitives - (*Primitives_Aux)(nil), // 3: test.Primitives.Aux + (Primitives_SomeEnum)(0), // 0: test.Primitives.SomeEnum + (*Primitives)(nil), // 1: test.Primitives + (*RepPrimitives)(nil), // 2: test.RepPrimitives + (*Primitives_Aux)(nil), // 3: test.Primitives.Aux + (*RepPrimitives_Aux)(nil), // 4: test.RepPrimitives.Aux } var file_util_proto_test_test_proto_depIdxs = []int32{ 0, // 0: test.Primitives.field_h:type_name -> test.Primitives.SomeEnum 3, // 1: test.Primitives.field_aux:type_name -> test.Primitives.Aux - 2, // [2:2] is the sub-list for method output_type - 2, // [2:2] is the sub-list for method input_type - 2, // [2:2] is the sub-list for extension type_name - 2, // [2:2] is the sub-list for extension extendee - 0, // [0:2] is the sub-list for field type_name + 4, // 2: test.RepPrimitives.field_aux:type_name -> test.RepPrimitives.Aux + 3, // [3:3] is the sub-list for method output_type + 3, // [3:3] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name } func init() { file_util_proto_test_test_proto_init() } @@ -522,6 +585,18 @@ func file_util_proto_test_test_proto_init() { return nil } } + file_util_proto_test_test_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RepPrimitives_Aux); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } file_util_proto_test_test_proto_msgTypes[0].OneofWrappers = []interface{}{ (*Primitives_FieldMa)(nil), @@ -534,7 +609,7 @@ func file_util_proto_test_test_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_util_proto_test_test_proto_rawDesc, NumEnums: 1, - NumMessages: 3, + NumMessages: 4, NumExtensions: 0, NumServices: 0, }, diff --git a/util/proto/test/test.proto b/util/proto/test/test.proto index f33be49..58cee2f 100644 --- a/util/proto/test/test.proto +++ b/util/proto/test/test.proto @@ -40,4 +40,7 @@ message RepPrimitives { repeated int64 field_e = 5; repeated uint64 field_f = 6; repeated uint64 field_fu = 7 [ packed = false ]; + + message Aux { uint32 inner_field = 1; } + repeated Aux field_aux = 8; } From 5e1c6a908f61d357acd71c1b0a1320f962ea5827 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Tue, 27 Aug 2024 15:12:31 +0300 Subject: [PATCH 1173/1196] [#111] protogen: Emit slice of messages without a pointer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ``` goos: linux goarch: amd64 pkg: git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs cpu: 11th Gen Intel(R) Core(TM) i5-1135G7 @ 2.40GHz │ old │ new │ │ sec/op │ sec/op vs base │ ObjectIDSlice/0_elements/to_grpc_message-8 3.193n ± 2% 3.242n ± 0% +1.50% (p=0.034 n=10) ObjectIDSlice/0_elements/from_grpc_message-8 3.197n ± 2% 3.343n ± 1% +4.57% (p=0.000 n=10) ObjectIDSlice/0_elements/marshal-8 5.666n ± 3% 5.642n ± 0% -0.42% (p=0.000 n=10) ObjectIDSlice/1_elements/to_grpc_message-8 53.10n ± 6% 29.78n ± 12% -43.92% (p=0.000 n=10) ObjectIDSlice/1_elements/from_grpc_message-8 28.99n ± 5% 29.77n ± 7% ~ (p=0.165 n=10) ObjectIDSlice/1_elements/marshal-8 49.08n ± 7% 50.72n ± 6% ~ (p=0.218 n=10) ObjectIDSlice/50_elements/to_grpc_message-8 1652.5n ± 7% 277.2n ± 1% -83.22% (p=0.000 n=10) ObjectIDSlice/50_elements/from_grpc_message-8 261.2n ± 11% 226.7n ± 15% -13.19% (p=0.003 n=10) ObjectIDSlice/50_elements/marshal-8 1.512µ ± 6% 1.514µ ± 6% ~ (p=0.955 n=10) geomean 52.15n 39.99n -23.31% │ old │ new │ │ B/op │ B/op vs base │ ObjectIDSlice/0_elements/to_grpc_message-8 0.000 ± 0% 0.000 ± 0% ~ (p=1.000 n=10) ¹ ObjectIDSlice/0_elements/from_grpc_message-8 0.000 ± 0% 0.000 ± 0% ~ (p=1.000 n=10) ¹ ObjectIDSlice/0_elements/marshal-8 0.000 ± 0% 0.000 ± 0% ~ (p=1.000 n=10) ¹ ObjectIDSlice/1_elements/to_grpc_message-8 32.00 ± 0% 24.00 ± 0% -25.00% (p=0.000 n=10) ObjectIDSlice/1_elements/from_grpc_message-8 24.00 ± 0% 24.00 ± 0% ~ (p=1.000 n=10) ¹ ObjectIDSlice/1_elements/marshal-8 48.00 ± 0% 48.00 ± 0% ~ (p=1.000 n=10) ¹ ObjectIDSlice/50_elements/to_grpc_message-8 1.578Ki ± 0% 1.250Ki ± 0% -20.79% (p=0.000 n=10) ObjectIDSlice/50_elements/from_grpc_message-8 1.250Ki ± 0% 1.250Ki ± 0% ~ (p=1.000 n=10) ¹ ObjectIDSlice/50_elements/marshal-8 2.000Ki ± 0% 2.000Ki ± 0% ~ (p=1.000 n=10) ¹ geomean ² -5.62% ² ¹ all samples are equal ² summaries must be >0 to compute geomean │ old │ new │ │ allocs/op │ allocs/op vs base │ ObjectIDSlice/0_elements/to_grpc_message-8 0.000 ± 0% 0.000 ± 0% ~ (p=1.000 n=10) ¹ ObjectIDSlice/0_elements/from_grpc_message-8 0.000 ± 0% 0.000 ± 0% ~ (p=1.000 n=10) ¹ ObjectIDSlice/0_elements/marshal-8 0.000 ± 0% 0.000 ± 0% ~ (p=1.000 n=10) ¹ ObjectIDSlice/1_elements/to_grpc_message-8 2.000 ± 0% 1.000 ± 0% -50.00% (p=0.000 n=10) ObjectIDSlice/1_elements/from_grpc_message-8 1.000 ± 0% 1.000 ± 0% ~ (p=1.000 n=10) ¹ ObjectIDSlice/1_elements/marshal-8 1.000 ± 0% 1.000 ± 0% ~ (p=1.000 n=10) ¹ ObjectIDSlice/50_elements/to_grpc_message-8 51.000 ± 0% 1.000 ± 0% -98.04% (p=0.000 n=10) ObjectIDSlice/50_elements/from_grpc_message-8 1.000 ± 0% 1.000 ± 0% ~ (p=1.000 n=10) ¹ ObjectIDSlice/50_elements/marshal-8 1.000 ± 0% 1.000 ± 0% ~ (p=1.000 n=10) ¹ geomean ² -40.18% ² ¹ all samples are equal ² summaries must be >0 to compute geomean ``` Signed-off-by: Evgenii Stratonikov --- acl/convert.go | 54 +++--- acl/grpc/types_frostfs.pb.go | 92 +++++----- apemanager/convert.go | 6 +- apemanager/grpc/service_frostfs.pb.go | 22 ++- container/convert.go | 16 +- container/grpc/service_frostfs.pb.go | 22 ++- container/grpc/types_frostfs.pb.go | 22 ++- lock/grpc/types_frostfs.pb.go | 22 ++- netmap/convert.go | 82 ++++----- netmap/grpc/types_frostfs.pb.go | 166 ++++++++---------- object/convert.go | 54 +++--- object/grpc/service_frostfs.pb.go | 92 +++++----- object/grpc/types_frostfs.pb.go | 112 ++++++------ object/lock.go | 8 +- refs/convert.go | 32 ++-- session/convert.go | 16 +- session/grpc/types_frostfs.pb.go | 66 ++++--- status/convert.go | 12 +- status/grpc/types_frostfs.pb.go | 26 ++- tombstone/grpc/types_frostfs.pb.go | 26 ++- util/proto/marshal_test.go | 6 +- util/proto/test/custom/test_frostfs.pb.go | 36 ++-- util/protogen/internalgengo/json.go | 2 +- util/protogen/internalgengo/proto.go | 9 +- .../internalgengo/proto_field_type.go | 5 +- .../internalgengo/proto_stable_compat.go | 2 +- 26 files changed, 461 insertions(+), 547 deletions(-) diff --git a/acl/convert.go b/acl/convert.go index c5768ad..f5de743 100644 --- a/acl/convert.go +++ b/acl/convert.go @@ -187,28 +187,26 @@ 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 { - if fs[i] != nil { - err = res[i].FromGRPCMessage(fs[i]) - if err != nil { - return - } + err = res[i].FromGRPCMessage(&fs[i]) + if err != nil { + return } } } @@ -241,28 +239,26 @@ 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 { - if fs[i] != nil { - err = res[i].FromGRPCMessage(fs[i]) - if err != nil { - return - } + err = res[i].FromGRPCMessage(&fs[i]) + if err != nil { + return } } } @@ -309,28 +305,26 @@ 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 { - if fs[i] != nil { - err = res[i].FromGRPCMessage(fs[i]) - if err != nil { - return - } + err = res[i].FromGRPCMessage(&fs[i]) + if err != nil { + return } } } @@ -429,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) } @@ -459,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 } } diff --git a/acl/grpc/types_frostfs.pb.go b/acl/grpc/types_frostfs.pb.go index 931f3b3..2b116bd 100644 --- a/acl/grpc/types_frostfs.pb.go +++ b/acl/grpc/types_frostfs.pb.go @@ -657,10 +657,10 @@ func (x *EACLRecord_Target) UnmarshalEasyJSON(in *jlexer.Lexer) { } type EACLRecord struct { - Operation Operation `json:"operation"` - Action Action `json:"action"` - Filters []*EACLRecord_Filter `json:"filters"` - Targets []*EACLRecord_Target `json:"targets"` + Operation Operation `json:"operation"` + Action Action `json:"action"` + Filters []EACLRecord_Filter `json:"filters"` + Targets []EACLRecord_Target `json:"targets"` } var ( @@ -680,10 +680,10 @@ func (x *EACLRecord) StableSize() (size int) { size += proto.EnumSize(1, int32(x.Operation)) size += proto.EnumSize(2, int32(x.Action)) for i := range x.Filters { - size += proto.NestedStructureSize(3, x.Filters[i]) + size += proto.NestedStructureSizeUnchecked(3, &x.Filters[i]) } for i := range x.Targets { - size += proto.NestedStructureSize(4, x.Targets[i]) + size += proto.NestedStructureSizeUnchecked(4, &x.Targets[i]) } return size } @@ -708,14 +708,10 @@ func (x *EACLRecord) EmitProtobuf(mm *easyproto.MessageMarshaler) { mm.AppendInt32(2, int32(x.Action)) } for i := range x.Filters { - if x.Filters[i] != nil { - x.Filters[i].EmitProtobuf(mm.AppendMessage(3)) - } + x.Filters[i].EmitProtobuf(mm.AppendMessage(3)) } for i := range x.Targets { - if x.Targets[i] != nil { - x.Targets[i].EmitProtobuf(mm.AppendMessage(4)) - } + x.Targets[i].EmitProtobuf(mm.AppendMessage(4)) } } @@ -745,8 +741,8 @@ func (x *EACLRecord) UnmarshalProtobuf(src []byte) (err error) { if !ok { return fmt.Errorf("cannot unmarshal field %s", "Filters") } - x.Filters = append(x.Filters, new(EACLRecord_Filter)) - ff := x.Filters[len(x.Filters)-1] + x.Filters = append(x.Filters, EACLRecord_Filter{}) + ff := &x.Filters[len(x.Filters)-1] if err := ff.UnmarshalProtobuf(data); err != nil { return fmt.Errorf("unmarshal: %w", err) } @@ -755,8 +751,8 @@ func (x *EACLRecord) UnmarshalProtobuf(src []byte) (err error) { if !ok { return fmt.Errorf("cannot unmarshal field %s", "Targets") } - x.Targets = append(x.Targets, new(EACLRecord_Target)) - ff := x.Targets[len(x.Targets)-1] + x.Targets = append(x.Targets, EACLRecord_Target{}) + ff := &x.Targets[len(x.Targets)-1] if err := ff.UnmarshalProtobuf(data); err != nil { return fmt.Errorf("unmarshal: %w", err) } @@ -782,22 +778,22 @@ func (x *EACLRecord) GetAction() Action { func (x *EACLRecord) SetAction(v Action) { x.Action = v } -func (x *EACLRecord) GetFilters() []*EACLRecord_Filter { +func (x *EACLRecord) GetFilters() []EACLRecord_Filter { if x != nil { return x.Filters } return nil } -func (x *EACLRecord) SetFilters(v []*EACLRecord_Filter) { +func (x *EACLRecord) SetFilters(v []EACLRecord_Filter) { x.Filters = v } -func (x *EACLRecord) GetTargets() []*EACLRecord_Target { +func (x *EACLRecord) GetTargets() []EACLRecord_Target { if x != nil { return x.Targets } return nil } -func (x *EACLRecord) SetTargets(v []*EACLRecord_Target) { +func (x *EACLRecord) SetTargets(v []EACLRecord_Target) { x.Targets = v } @@ -921,11 +917,11 @@ func (x *EACLRecord) UnmarshalEasyJSON(in *jlexer.Lexer) { } case "filters": { - var f *EACLRecord_Filter - var list []*EACLRecord_Filter + var f EACLRecord_Filter + var list []EACLRecord_Filter in.Delim('[') for !in.IsDelim(']') { - f = new(EACLRecord_Filter) + f = EACLRecord_Filter{} f.UnmarshalEasyJSON(in) list = append(list, f) in.WantComma() @@ -935,11 +931,11 @@ func (x *EACLRecord) UnmarshalEasyJSON(in *jlexer.Lexer) { } case "targets": { - var f *EACLRecord_Target - var list []*EACLRecord_Target + var f EACLRecord_Target + var list []EACLRecord_Target in.Delim('[') for !in.IsDelim(']') { - f = new(EACLRecord_Target) + f = EACLRecord_Target{} f.UnmarshalEasyJSON(in) list = append(list, f) in.WantComma() @@ -959,7 +955,7 @@ func (x *EACLRecord) UnmarshalEasyJSON(in *jlexer.Lexer) { type EACLTable struct { Version *grpc.Version `json:"version"` ContainerId *grpc.ContainerID `json:"containerID"` - Records []*EACLRecord `json:"records"` + Records []EACLRecord `json:"records"` } var ( @@ -979,7 +975,7 @@ func (x *EACLTable) StableSize() (size int) { size += proto.NestedStructureSize(1, x.Version) size += proto.NestedStructureSize(2, x.ContainerId) for i := range x.Records { - size += proto.NestedStructureSize(3, x.Records[i]) + size += proto.NestedStructureSizeUnchecked(3, &x.Records[i]) } return size } @@ -1004,9 +1000,7 @@ func (x *EACLTable) EmitProtobuf(mm *easyproto.MessageMarshaler) { x.ContainerId.EmitProtobuf(mm.AppendMessage(2)) } for i := range x.Records { - if x.Records[i] != nil { - x.Records[i].EmitProtobuf(mm.AppendMessage(3)) - } + x.Records[i].EmitProtobuf(mm.AppendMessage(3)) } } @@ -1042,8 +1036,8 @@ func (x *EACLTable) UnmarshalProtobuf(src []byte) (err error) { if !ok { return fmt.Errorf("cannot unmarshal field %s", "Records") } - x.Records = append(x.Records, new(EACLRecord)) - ff := x.Records[len(x.Records)-1] + x.Records = append(x.Records, EACLRecord{}) + ff := &x.Records[len(x.Records)-1] if err := ff.UnmarshalProtobuf(data); err != nil { return fmt.Errorf("unmarshal: %w", err) } @@ -1069,13 +1063,13 @@ func (x *EACLTable) GetContainerId() *grpc.ContainerID { func (x *EACLTable) SetContainerId(v *grpc.ContainerID) { x.ContainerId = v } -func (x *EACLTable) GetRecords() []*EACLRecord { +func (x *EACLTable) GetRecords() []EACLRecord { if x != nil { return x.Records } return nil } -func (x *EACLTable) SetRecords(v []*EACLRecord) { +func (x *EACLTable) SetRecords(v []EACLRecord) { x.Records = v } @@ -1157,11 +1151,11 @@ func (x *EACLTable) UnmarshalEasyJSON(in *jlexer.Lexer) { } case "records": { - var f *EACLRecord - var list []*EACLRecord + var f EACLRecord + var list []EACLRecord in.Delim('[') for !in.IsDelim(']') { - f = new(EACLRecord) + f = EACLRecord{} f.UnmarshalEasyJSON(in) list = append(list, f) in.WantComma() @@ -1371,7 +1365,7 @@ func (x *BearerToken_Body_TokenLifetime) UnmarshalEasyJSON(in *jlexer.Lexer) { type BearerToken_Body_APEOverride struct { Target *grpc1.ChainTarget `json:"target"` - Chains []*grpc1.Chain `json:"chains"` + Chains []grpc1.Chain `json:"chains"` } var ( @@ -1390,7 +1384,7 @@ func (x *BearerToken_Body_APEOverride) StableSize() (size int) { } size += proto.NestedStructureSize(1, x.Target) for i := range x.Chains { - size += proto.NestedStructureSize(2, x.Chains[i]) + size += proto.NestedStructureSizeUnchecked(2, &x.Chains[i]) } return size } @@ -1412,9 +1406,7 @@ func (x *BearerToken_Body_APEOverride) EmitProtobuf(mm *easyproto.MessageMarshal x.Target.EmitProtobuf(mm.AppendMessage(1)) } for i := range x.Chains { - if x.Chains[i] != nil { - x.Chains[i].EmitProtobuf(mm.AppendMessage(2)) - } + x.Chains[i].EmitProtobuf(mm.AppendMessage(2)) } } @@ -1441,8 +1433,8 @@ func (x *BearerToken_Body_APEOverride) UnmarshalProtobuf(src []byte) (err error) if !ok { return fmt.Errorf("cannot unmarshal field %s", "Chains") } - x.Chains = append(x.Chains, new(grpc1.Chain)) - ff := x.Chains[len(x.Chains)-1] + x.Chains = append(x.Chains, grpc1.Chain{}) + ff := &x.Chains[len(x.Chains)-1] if err := ff.UnmarshalProtobuf(data); err != nil { return fmt.Errorf("unmarshal: %w", err) } @@ -1459,13 +1451,13 @@ func (x *BearerToken_Body_APEOverride) GetTarget() *grpc1.ChainTarget { func (x *BearerToken_Body_APEOverride) SetTarget(v *grpc1.ChainTarget) { x.Target = v } -func (x *BearerToken_Body_APEOverride) GetChains() []*grpc1.Chain { +func (x *BearerToken_Body_APEOverride) GetChains() []grpc1.Chain { if x != nil { return x.Chains } return nil } -func (x *BearerToken_Body_APEOverride) SetChains(v []*grpc1.Chain) { +func (x *BearerToken_Body_APEOverride) SetChains(v []grpc1.Chain) { x.Chains = v } @@ -1535,11 +1527,11 @@ func (x *BearerToken_Body_APEOverride) UnmarshalEasyJSON(in *jlexer.Lexer) { } case "chains": { - var f *grpc1.Chain - var list []*grpc1.Chain + var f grpc1.Chain + var list []grpc1.Chain in.Delim('[') for !in.IsDelim(']') { - f = new(grpc1.Chain) + f = grpc1.Chain{} f.UnmarshalEasyJSON(in) list = append(list, f) in.WantComma() diff --git a/apemanager/convert.go b/apemanager/convert.go index fdc5132..5677b25 100644 --- a/apemanager/convert.go +++ b/apemanager/convert.go @@ -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) diff --git a/apemanager/grpc/service_frostfs.pb.go b/apemanager/grpc/service_frostfs.pb.go index c1d28ed..99abeb2 100644 --- a/apemanager/grpc/service_frostfs.pb.go +++ b/apemanager/grpc/service_frostfs.pb.go @@ -1810,7 +1810,7 @@ func (x *ListChainsRequest) UnmarshalEasyJSON(in *jlexer.Lexer) { } type ListChainsResponse_Body struct { - Chains []*grpc.Chain `json:"chains"` + Chains []grpc.Chain `json:"chains"` } var ( @@ -1828,7 +1828,7 @@ func (x *ListChainsResponse_Body) StableSize() (size int) { return 0 } for i := range x.Chains { - size += proto.NestedStructureSize(1, x.Chains[i]) + size += proto.NestedStructureSizeUnchecked(1, &x.Chains[i]) } return size } @@ -1847,9 +1847,7 @@ func (x *ListChainsResponse_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) { return } for i := range x.Chains { - if x.Chains[i] != nil { - x.Chains[i].EmitProtobuf(mm.AppendMessage(1)) - } + x.Chains[i].EmitProtobuf(mm.AppendMessage(1)) } } @@ -1867,8 +1865,8 @@ func (x *ListChainsResponse_Body) UnmarshalProtobuf(src []byte) (err error) { if !ok { return fmt.Errorf("cannot unmarshal field %s", "Chains") } - x.Chains = append(x.Chains, new(grpc.Chain)) - ff := x.Chains[len(x.Chains)-1] + x.Chains = append(x.Chains, grpc.Chain{}) + ff := &x.Chains[len(x.Chains)-1] if err := ff.UnmarshalProtobuf(data); err != nil { return fmt.Errorf("unmarshal: %w", err) } @@ -1876,13 +1874,13 @@ func (x *ListChainsResponse_Body) UnmarshalProtobuf(src []byte) (err error) { } return nil } -func (x *ListChainsResponse_Body) GetChains() []*grpc.Chain { +func (x *ListChainsResponse_Body) GetChains() []grpc.Chain { if x != nil { return x.Chains } return nil } -func (x *ListChainsResponse_Body) SetChains(v []*grpc.Chain) { +func (x *ListChainsResponse_Body) SetChains(v []grpc.Chain) { x.Chains = v } @@ -1940,11 +1938,11 @@ func (x *ListChainsResponse_Body) UnmarshalEasyJSON(in *jlexer.Lexer) { switch key { case "chains": { - var f *grpc.Chain - var list []*grpc.Chain + var f grpc.Chain + var list []grpc.Chain in.Delim('[') for !in.IsDelim(']') { - f = new(grpc.Chain) + f = grpc.Chain{} f.UnmarshalEasyJSON(in) list = append(list, f) in.WantComma() diff --git a/container/convert.go b/container/convert.go index c5f9cd7..b487f40 100644 --- a/container/convert.go +++ b/container/convert.go @@ -39,28 +39,26 @@ 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 { - if xs[i] != nil { - err = res[i].FromGRPCMessage(xs[i]) - if err != nil { - return - } + err = res[i].FromGRPCMessage(&xs[i]) + if err != nil { + return } } } diff --git a/container/grpc/service_frostfs.pb.go b/container/grpc/service_frostfs.pb.go index 514f03b..f38b0de 100644 --- a/container/grpc/service_frostfs.pb.go +++ b/container/grpc/service_frostfs.pb.go @@ -2597,7 +2597,7 @@ func (x *ListRequest) UnmarshalEasyJSON(in *jlexer.Lexer) { } type ListResponse_Body struct { - ContainerIds []*grpc.ContainerID `json:"containerIds"` + ContainerIds []grpc.ContainerID `json:"containerIds"` } var ( @@ -2615,7 +2615,7 @@ func (x *ListResponse_Body) StableSize() (size int) { return 0 } for i := range x.ContainerIds { - size += proto.NestedStructureSize(1, x.ContainerIds[i]) + size += proto.NestedStructureSizeUnchecked(1, &x.ContainerIds[i]) } return size } @@ -2634,9 +2634,7 @@ func (x *ListResponse_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) { return } for i := range x.ContainerIds { - if x.ContainerIds[i] != nil { - x.ContainerIds[i].EmitProtobuf(mm.AppendMessage(1)) - } + x.ContainerIds[i].EmitProtobuf(mm.AppendMessage(1)) } } @@ -2654,8 +2652,8 @@ func (x *ListResponse_Body) UnmarshalProtobuf(src []byte) (err error) { if !ok { return fmt.Errorf("cannot unmarshal field %s", "ContainerIds") } - x.ContainerIds = append(x.ContainerIds, new(grpc.ContainerID)) - ff := x.ContainerIds[len(x.ContainerIds)-1] + x.ContainerIds = append(x.ContainerIds, grpc.ContainerID{}) + ff := &x.ContainerIds[len(x.ContainerIds)-1] if err := ff.UnmarshalProtobuf(data); err != nil { return fmt.Errorf("unmarshal: %w", err) } @@ -2663,13 +2661,13 @@ func (x *ListResponse_Body) UnmarshalProtobuf(src []byte) (err error) { } return nil } -func (x *ListResponse_Body) GetContainerIds() []*grpc.ContainerID { +func (x *ListResponse_Body) GetContainerIds() []grpc.ContainerID { if x != nil { return x.ContainerIds } return nil } -func (x *ListResponse_Body) SetContainerIds(v []*grpc.ContainerID) { +func (x *ListResponse_Body) SetContainerIds(v []grpc.ContainerID) { x.ContainerIds = v } @@ -2727,11 +2725,11 @@ func (x *ListResponse_Body) UnmarshalEasyJSON(in *jlexer.Lexer) { switch key { case "containerIds": { - var f *grpc.ContainerID - var list []*grpc.ContainerID + var f grpc.ContainerID + var list []grpc.ContainerID in.Delim('[') for !in.IsDelim(']') { - f = new(grpc.ContainerID) + f = grpc.ContainerID{} f.UnmarshalEasyJSON(in) list = append(list, f) in.WantComma() diff --git a/container/grpc/types_frostfs.pb.go b/container/grpc/types_frostfs.pb.go index dcb9cf4..3010eb0 100644 --- a/container/grpc/types_frostfs.pb.go +++ b/container/grpc/types_frostfs.pb.go @@ -180,7 +180,7 @@ type Container struct { OwnerId *grpc.OwnerID `json:"ownerID"` Nonce []byte `json:"nonce"` BasicAcl uint32 `json:"basicACL"` - Attributes []*Container_Attribute `json:"attributes"` + Attributes []Container_Attribute `json:"attributes"` PlacementPolicy *grpc1.PlacementPolicy `json:"placementPolicy"` } @@ -203,7 +203,7 @@ func (x *Container) StableSize() (size int) { size += proto.BytesSize(3, x.Nonce) size += proto.UInt32Size(4, x.BasicAcl) for i := range x.Attributes { - size += proto.NestedStructureSize(5, x.Attributes[i]) + size += proto.NestedStructureSizeUnchecked(5, &x.Attributes[i]) } size += proto.NestedStructureSize(6, x.PlacementPolicy) return size @@ -235,9 +235,7 @@ func (x *Container) EmitProtobuf(mm *easyproto.MessageMarshaler) { mm.AppendUint32(4, x.BasicAcl) } for i := range x.Attributes { - if x.Attributes[i] != nil { - x.Attributes[i].EmitProtobuf(mm.AppendMessage(5)) - } + x.Attributes[i].EmitProtobuf(mm.AppendMessage(5)) } if x.PlacementPolicy != nil { x.PlacementPolicy.EmitProtobuf(mm.AppendMessage(6)) @@ -288,8 +286,8 @@ func (x *Container) UnmarshalProtobuf(src []byte) (err error) { if !ok { return fmt.Errorf("cannot unmarshal field %s", "Attributes") } - x.Attributes = append(x.Attributes, new(Container_Attribute)) - ff := x.Attributes[len(x.Attributes)-1] + 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) } @@ -342,13 +340,13 @@ func (x *Container) GetBasicAcl() uint32 { func (x *Container) SetBasicAcl(v uint32) { x.BasicAcl = v } -func (x *Container) GetAttributes() []*Container_Attribute { +func (x *Container) GetAttributes() []Container_Attribute { if x != nil { return x.Attributes } return nil } -func (x *Container) SetAttributes(v []*Container_Attribute) { +func (x *Container) SetAttributes(v []Container_Attribute) { x.Attributes = v } func (x *Container) GetPlacementPolicy() *grpc1.PlacementPolicy { @@ -466,11 +464,11 @@ func (x *Container) UnmarshalEasyJSON(in *jlexer.Lexer) { } case "attributes": { - var f *Container_Attribute - var list []*Container_Attribute + var f Container_Attribute + var list []Container_Attribute in.Delim('[') for !in.IsDelim(']') { - f = new(Container_Attribute) + f = Container_Attribute{} f.UnmarshalEasyJSON(in) list = append(list, f) in.WantComma() diff --git a/lock/grpc/types_frostfs.pb.go b/lock/grpc/types_frostfs.pb.go index 52a1a2d..58be895 100644 --- a/lock/grpc/types_frostfs.pb.go +++ b/lock/grpc/types_frostfs.pb.go @@ -15,7 +15,7 @@ import ( ) type Lock struct { - Members []*grpc.ObjectID `json:"members"` + Members []grpc.ObjectID `json:"members"` } var ( @@ -33,7 +33,7 @@ func (x *Lock) StableSize() (size int) { return 0 } for i := range x.Members { - size += proto.NestedStructureSize(1, x.Members[i]) + size += proto.NestedStructureSizeUnchecked(1, &x.Members[i]) } return size } @@ -52,9 +52,7 @@ func (x *Lock) EmitProtobuf(mm *easyproto.MessageMarshaler) { return } for i := range x.Members { - if x.Members[i] != nil { - x.Members[i].EmitProtobuf(mm.AppendMessage(1)) - } + x.Members[i].EmitProtobuf(mm.AppendMessage(1)) } } @@ -72,8 +70,8 @@ func (x *Lock) UnmarshalProtobuf(src []byte) (err error) { if !ok { return fmt.Errorf("cannot unmarshal field %s", "Members") } - x.Members = append(x.Members, new(grpc.ObjectID)) - ff := x.Members[len(x.Members)-1] + 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) } @@ -81,13 +79,13 @@ func (x *Lock) UnmarshalProtobuf(src []byte) (err error) { } return nil } -func (x *Lock) GetMembers() []*grpc.ObjectID { +func (x *Lock) GetMembers() []grpc.ObjectID { if x != nil { return x.Members } return nil } -func (x *Lock) SetMembers(v []*grpc.ObjectID) { +func (x *Lock) SetMembers(v []grpc.ObjectID) { x.Members = v } @@ -145,11 +143,11 @@ func (x *Lock) UnmarshalEasyJSON(in *jlexer.Lexer) { switch key { case "members": { - var f *grpc.ObjectID - var list []*grpc.ObjectID + var f grpc.ObjectID + var list []grpc.ObjectID in.Delim('[') for !in.IsDelim(']') { - f = new(grpc.ObjectID) + f = grpc.ObjectID{} f.UnmarshalEasyJSON(in) list = append(list, f) in.WantComma() diff --git a/netmap/convert.go b/netmap/convert.go index fad7380..659b798 100644 --- a/netmap/convert.go +++ b/netmap/convert.go @@ -45,28 +45,26 @@ 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 { - if fs[i] != nil { - err = res[i].FromGRPCMessage(fs[i]) - if err != nil { - return - } + err = res[i].FromGRPCMessage(&fs[i]) + if err != nil { + return } } } @@ -105,28 +103,26 @@ 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 { - if ss[i] != nil { - err = res[i].FromGRPCMessage(ss[i]) - if err != nil { - return - } + err = res[i].FromGRPCMessage(&ss[i]) + if err != nil { + return } } } @@ -163,28 +159,26 @@ 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 { - if rs[i] != nil { - err = res[i].FromGRPCMessage(rs[i]) - if err != nil { - return - } + err = res[i].FromGRPCMessage(&rs[i]) + if err != nil { + return } } } @@ -289,28 +283,26 @@ 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 { - if as[i] != nil { - err = res[i].FromGRPCMessage(as[i]) - if err != nil { - return - } + err = res[i].FromGRPCMessage(&as[i]) + if err != nil { + return } } } @@ -528,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 := 0; i < ln; i++ { - ps = append(ps, x.ps[i].ToGRPCMessage().(*netmap.NetworkConfig_Parameter)) + ps = append(ps, *x.ps[i].ToGRPCMessage().(*netmap.NetworkConfig_Parameter)) } } @@ -561,10 +553,8 @@ func (x *NetworkConfig) FromGRPCMessage(m grpc.Message) error { ps = make([]NetworkParameter, ln) for i := 0; i < ln; i++ { - if psV2[i] != nil { - if err := ps[i].FromGRPCMessage(psV2[i]); err != nil { - return err - } + if err := ps[i].FromGRPCMessage(&psV2[i]); err != nil { + return err } } } @@ -756,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) @@ -784,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 } diff --git a/netmap/grpc/types_frostfs.pb.go b/netmap/grpc/types_frostfs.pb.go index 6ecf0fa..e7597ea 100644 --- a/netmap/grpc/types_frostfs.pb.go +++ b/netmap/grpc/types_frostfs.pb.go @@ -113,7 +113,7 @@ type Filter struct { Key string `json:"key"` Op Operation `json:"op"` Value string `json:"value"` - Filters []*Filter `json:"filters"` + Filters []Filter `json:"filters"` } var ( @@ -135,7 +135,7 @@ func (x *Filter) StableSize() (size int) { size += proto.EnumSize(3, int32(x.Op)) size += proto.StringSize(4, x.Value) for i := range x.Filters { - size += proto.NestedStructureSize(5, x.Filters[i]) + size += proto.NestedStructureSizeUnchecked(5, &x.Filters[i]) } return size } @@ -166,9 +166,7 @@ func (x *Filter) EmitProtobuf(mm *easyproto.MessageMarshaler) { mm.AppendString(4, x.Value) } for i := range x.Filters { - if x.Filters[i] != nil { - x.Filters[i].EmitProtobuf(mm.AppendMessage(5)) - } + x.Filters[i].EmitProtobuf(mm.AppendMessage(5)) } } @@ -210,8 +208,8 @@ func (x *Filter) UnmarshalProtobuf(src []byte) (err error) { if !ok { return fmt.Errorf("cannot unmarshal field %s", "Filters") } - x.Filters = append(x.Filters, new(Filter)) - ff := x.Filters[len(x.Filters)-1] + x.Filters = append(x.Filters, Filter{}) + ff := &x.Filters[len(x.Filters)-1] if err := ff.UnmarshalProtobuf(data); err != nil { return fmt.Errorf("unmarshal: %w", err) } @@ -255,13 +253,13 @@ func (x *Filter) GetValue() string { func (x *Filter) SetValue(v string) { x.Value = v } -func (x *Filter) GetFilters() []*Filter { +func (x *Filter) GetFilters() []Filter { if x != nil { return x.Filters } return nil } -func (x *Filter) SetFilters(v []*Filter) { +func (x *Filter) SetFilters(v []Filter) { x.Filters = v } @@ -379,11 +377,11 @@ func (x *Filter) UnmarshalEasyJSON(in *jlexer.Lexer) { } case "filters": { - var f *Filter - var list []*Filter + var f Filter + var list []Filter in.Delim('[') for !in.IsDelim(']') { - f = new(Filter) + f = Filter{} f.UnmarshalEasyJSON(in) list = append(list, f) in.WantComma() @@ -892,11 +890,11 @@ func (x *Replica) UnmarshalEasyJSON(in *jlexer.Lexer) { } type PlacementPolicy struct { - Replicas []*Replica `json:"replicas"` - ContainerBackupFactor uint32 `json:"containerBackupFactor"` - Selectors []*Selector `json:"selectors"` - Filters []*Filter `json:"filters"` - Unique bool `json:"unique"` + Replicas []Replica `json:"replicas"` + ContainerBackupFactor uint32 `json:"containerBackupFactor"` + Selectors []Selector `json:"selectors"` + Filters []Filter `json:"filters"` + Unique bool `json:"unique"` } var ( @@ -914,14 +912,14 @@ func (x *PlacementPolicy) StableSize() (size int) { return 0 } for i := range x.Replicas { - size += proto.NestedStructureSize(1, x.Replicas[i]) + size += proto.NestedStructureSizeUnchecked(1, &x.Replicas[i]) } size += proto.UInt32Size(2, x.ContainerBackupFactor) for i := range x.Selectors { - size += proto.NestedStructureSize(3, x.Selectors[i]) + size += proto.NestedStructureSizeUnchecked(3, &x.Selectors[i]) } for i := range x.Filters { - size += proto.NestedStructureSize(4, x.Filters[i]) + size += proto.NestedStructureSizeUnchecked(4, &x.Filters[i]) } size += proto.BoolSize(5, x.Unique) return size @@ -941,22 +939,16 @@ func (x *PlacementPolicy) EmitProtobuf(mm *easyproto.MessageMarshaler) { return } for i := range x.Replicas { - if x.Replicas[i] != nil { - x.Replicas[i].EmitProtobuf(mm.AppendMessage(1)) - } + x.Replicas[i].EmitProtobuf(mm.AppendMessage(1)) } if x.ContainerBackupFactor != 0 { mm.AppendUint32(2, x.ContainerBackupFactor) } for i := range x.Selectors { - if x.Selectors[i] != nil { - x.Selectors[i].EmitProtobuf(mm.AppendMessage(3)) - } + x.Selectors[i].EmitProtobuf(mm.AppendMessage(3)) } for i := range x.Filters { - if x.Filters[i] != nil { - x.Filters[i].EmitProtobuf(mm.AppendMessage(4)) - } + x.Filters[i].EmitProtobuf(mm.AppendMessage(4)) } if x.Unique { mm.AppendBool(5, x.Unique) @@ -977,8 +969,8 @@ func (x *PlacementPolicy) UnmarshalProtobuf(src []byte) (err error) { if !ok { return fmt.Errorf("cannot unmarshal field %s", "Replicas") } - x.Replicas = append(x.Replicas, new(Replica)) - ff := x.Replicas[len(x.Replicas)-1] + x.Replicas = append(x.Replicas, Replica{}) + ff := &x.Replicas[len(x.Replicas)-1] if err := ff.UnmarshalProtobuf(data); err != nil { return fmt.Errorf("unmarshal: %w", err) } @@ -993,8 +985,8 @@ func (x *PlacementPolicy) UnmarshalProtobuf(src []byte) (err error) { if !ok { return fmt.Errorf("cannot unmarshal field %s", "Selectors") } - x.Selectors = append(x.Selectors, new(Selector)) - ff := x.Selectors[len(x.Selectors)-1] + x.Selectors = append(x.Selectors, Selector{}) + ff := &x.Selectors[len(x.Selectors)-1] if err := ff.UnmarshalProtobuf(data); err != nil { return fmt.Errorf("unmarshal: %w", err) } @@ -1003,8 +995,8 @@ func (x *PlacementPolicy) UnmarshalProtobuf(src []byte) (err error) { if !ok { return fmt.Errorf("cannot unmarshal field %s", "Filters") } - x.Filters = append(x.Filters, new(Filter)) - ff := x.Filters[len(x.Filters)-1] + x.Filters = append(x.Filters, Filter{}) + ff := &x.Filters[len(x.Filters)-1] if err := ff.UnmarshalProtobuf(data); err != nil { return fmt.Errorf("unmarshal: %w", err) } @@ -1018,13 +1010,13 @@ func (x *PlacementPolicy) UnmarshalProtobuf(src []byte) (err error) { } return nil } -func (x *PlacementPolicy) GetReplicas() []*Replica { +func (x *PlacementPolicy) GetReplicas() []Replica { if x != nil { return x.Replicas } return nil } -func (x *PlacementPolicy) SetReplicas(v []*Replica) { +func (x *PlacementPolicy) SetReplicas(v []Replica) { x.Replicas = v } func (x *PlacementPolicy) GetContainerBackupFactor() uint32 { @@ -1036,22 +1028,22 @@ func (x *PlacementPolicy) GetContainerBackupFactor() uint32 { func (x *PlacementPolicy) SetContainerBackupFactor(v uint32) { x.ContainerBackupFactor = v } -func (x *PlacementPolicy) GetSelectors() []*Selector { +func (x *PlacementPolicy) GetSelectors() []Selector { if x != nil { return x.Selectors } return nil } -func (x *PlacementPolicy) SetSelectors(v []*Selector) { +func (x *PlacementPolicy) SetSelectors(v []Selector) { x.Selectors = v } -func (x *PlacementPolicy) GetFilters() []*Filter { +func (x *PlacementPolicy) GetFilters() []Filter { if x != nil { return x.Filters } return nil } -func (x *PlacementPolicy) SetFilters(v []*Filter) { +func (x *PlacementPolicy) SetFilters(v []Filter) { x.Filters = v } func (x *PlacementPolicy) GetUnique() bool { @@ -1152,11 +1144,11 @@ func (x *PlacementPolicy) UnmarshalEasyJSON(in *jlexer.Lexer) { switch key { case "replicas": { - var f *Replica - var list []*Replica + var f Replica + var list []Replica in.Delim('[') for !in.IsDelim(']') { - f = new(Replica) + f = Replica{} f.UnmarshalEasyJSON(in) list = append(list, f) in.WantComma() @@ -1172,11 +1164,11 @@ func (x *PlacementPolicy) UnmarshalEasyJSON(in *jlexer.Lexer) { } case "selectors": { - var f *Selector - var list []*Selector + var f Selector + var list []Selector in.Delim('[') for !in.IsDelim(']') { - f = new(Selector) + f = Selector{} f.UnmarshalEasyJSON(in) list = append(list, f) in.WantComma() @@ -1186,11 +1178,11 @@ func (x *PlacementPolicy) UnmarshalEasyJSON(in *jlexer.Lexer) { } case "filters": { - var f *Filter - var list []*Filter + var f Filter + var list []Filter in.Delim('[') for !in.IsDelim(']') { - f = new(Filter) + f = Filter{} f.UnmarshalEasyJSON(in) list = append(list, f) in.WantComma() @@ -1457,10 +1449,10 @@ func (x *NodeInfo_Attribute) UnmarshalEasyJSON(in *jlexer.Lexer) { } type NodeInfo struct { - PublicKey []byte `json:"publicKey"` - Addresses []string `json:"addresses"` - Attributes []*NodeInfo_Attribute `json:"attributes"` - State NodeInfo_State `json:"state"` + PublicKey []byte `json:"publicKey"` + Addresses []string `json:"addresses"` + Attributes []NodeInfo_Attribute `json:"attributes"` + State NodeInfo_State `json:"state"` } var ( @@ -1480,7 +1472,7 @@ func (x *NodeInfo) StableSize() (size int) { size += proto.BytesSize(1, x.PublicKey) size += proto.RepeatedStringSize(2, x.Addresses) for i := range x.Attributes { - size += proto.NestedStructureSize(3, x.Attributes[i]) + size += proto.NestedStructureSizeUnchecked(3, &x.Attributes[i]) } size += proto.EnumSize(4, int32(x.State)) return size @@ -1506,9 +1498,7 @@ func (x *NodeInfo) EmitProtobuf(mm *easyproto.MessageMarshaler) { mm.AppendString(2, x.Addresses[j]) } for i := range x.Attributes { - if x.Attributes[i] != nil { - x.Attributes[i].EmitProtobuf(mm.AppendMessage(3)) - } + x.Attributes[i].EmitProtobuf(mm.AppendMessage(3)) } if int32(x.State) != 0 { mm.AppendInt32(4, int32(x.State)) @@ -1541,8 +1531,8 @@ func (x *NodeInfo) UnmarshalProtobuf(src []byte) (err error) { if !ok { return fmt.Errorf("cannot unmarshal field %s", "Attributes") } - x.Attributes = append(x.Attributes, new(NodeInfo_Attribute)) - ff := x.Attributes[len(x.Attributes)-1] + x.Attributes = append(x.Attributes, NodeInfo_Attribute{}) + ff := &x.Attributes[len(x.Attributes)-1] if err := ff.UnmarshalProtobuf(data); err != nil { return fmt.Errorf("unmarshal: %w", err) } @@ -1574,13 +1564,13 @@ func (x *NodeInfo) GetAddresses() []string { func (x *NodeInfo) SetAddresses(v []string) { x.Addresses = v } -func (x *NodeInfo) GetAttributes() []*NodeInfo_Attribute { +func (x *NodeInfo) GetAttributes() []NodeInfo_Attribute { if x != nil { return x.Attributes } return nil } -func (x *NodeInfo) SetAttributes(v []*NodeInfo_Attribute) { +func (x *NodeInfo) SetAttributes(v []NodeInfo_Attribute) { x.Attributes = v } func (x *NodeInfo) GetState() NodeInfo_State { @@ -1688,11 +1678,11 @@ func (x *NodeInfo) UnmarshalEasyJSON(in *jlexer.Lexer) { } case "attributes": { - var f *NodeInfo_Attribute - var list []*NodeInfo_Attribute + var f NodeInfo_Attribute + var list []NodeInfo_Attribute in.Delim('[') for !in.IsDelim(']') { - f = new(NodeInfo_Attribute) + f = NodeInfo_Attribute{} f.UnmarshalEasyJSON(in) list = append(list, f) in.WantComma() @@ -1732,8 +1722,8 @@ func (x *NodeInfo) UnmarshalEasyJSON(in *jlexer.Lexer) { } type Netmap struct { - Epoch uint64 `json:"epoch"` - Nodes []*NodeInfo `json:"nodes"` + Epoch uint64 `json:"epoch"` + Nodes []NodeInfo `json:"nodes"` } var ( @@ -1752,7 +1742,7 @@ func (x *Netmap) StableSize() (size int) { } size += proto.UInt64Size(1, x.Epoch) for i := range x.Nodes { - size += proto.NestedStructureSize(2, x.Nodes[i]) + size += proto.NestedStructureSizeUnchecked(2, &x.Nodes[i]) } return size } @@ -1774,9 +1764,7 @@ func (x *Netmap) EmitProtobuf(mm *easyproto.MessageMarshaler) { mm.AppendUint64(1, x.Epoch) } for i := range x.Nodes { - if x.Nodes[i] != nil { - x.Nodes[i].EmitProtobuf(mm.AppendMessage(2)) - } + x.Nodes[i].EmitProtobuf(mm.AppendMessage(2)) } } @@ -1800,8 +1788,8 @@ func (x *Netmap) UnmarshalProtobuf(src []byte) (err error) { if !ok { return fmt.Errorf("cannot unmarshal field %s", "Nodes") } - x.Nodes = append(x.Nodes, new(NodeInfo)) - ff := x.Nodes[len(x.Nodes)-1] + x.Nodes = append(x.Nodes, NodeInfo{}) + ff := &x.Nodes[len(x.Nodes)-1] if err := ff.UnmarshalProtobuf(data); err != nil { return fmt.Errorf("unmarshal: %w", err) } @@ -1818,13 +1806,13 @@ func (x *Netmap) GetEpoch() uint64 { func (x *Netmap) SetEpoch(v uint64) { x.Epoch = v } -func (x *Netmap) GetNodes() []*NodeInfo { +func (x *Netmap) GetNodes() []NodeInfo { if x != nil { return x.Nodes } return nil } -func (x *Netmap) SetNodes(v []*NodeInfo) { +func (x *Netmap) SetNodes(v []NodeInfo) { x.Nodes = v } @@ -1893,11 +1881,11 @@ func (x *Netmap) UnmarshalEasyJSON(in *jlexer.Lexer) { } case "nodes": { - var f *NodeInfo - var list []*NodeInfo + var f NodeInfo + var list []NodeInfo in.Delim('[') for !in.IsDelim(']') { - f = new(NodeInfo) + f = NodeInfo{} f.UnmarshalEasyJSON(in) list = append(list, f) in.WantComma() @@ -2075,7 +2063,7 @@ func (x *NetworkConfig_Parameter) UnmarshalEasyJSON(in *jlexer.Lexer) { } type NetworkConfig struct { - Parameters []*NetworkConfig_Parameter `json:"parameters"` + Parameters []NetworkConfig_Parameter `json:"parameters"` } var ( @@ -2093,7 +2081,7 @@ func (x *NetworkConfig) StableSize() (size int) { return 0 } for i := range x.Parameters { - size += proto.NestedStructureSize(1, x.Parameters[i]) + size += proto.NestedStructureSizeUnchecked(1, &x.Parameters[i]) } return size } @@ -2112,9 +2100,7 @@ func (x *NetworkConfig) EmitProtobuf(mm *easyproto.MessageMarshaler) { return } for i := range x.Parameters { - if x.Parameters[i] != nil { - x.Parameters[i].EmitProtobuf(mm.AppendMessage(1)) - } + x.Parameters[i].EmitProtobuf(mm.AppendMessage(1)) } } @@ -2132,8 +2118,8 @@ func (x *NetworkConfig) UnmarshalProtobuf(src []byte) (err error) { if !ok { return fmt.Errorf("cannot unmarshal field %s", "Parameters") } - x.Parameters = append(x.Parameters, new(NetworkConfig_Parameter)) - ff := x.Parameters[len(x.Parameters)-1] + x.Parameters = append(x.Parameters, NetworkConfig_Parameter{}) + ff := &x.Parameters[len(x.Parameters)-1] if err := ff.UnmarshalProtobuf(data); err != nil { return fmt.Errorf("unmarshal: %w", err) } @@ -2141,13 +2127,13 @@ func (x *NetworkConfig) UnmarshalProtobuf(src []byte) (err error) { } return nil } -func (x *NetworkConfig) GetParameters() []*NetworkConfig_Parameter { +func (x *NetworkConfig) GetParameters() []NetworkConfig_Parameter { if x != nil { return x.Parameters } return nil } -func (x *NetworkConfig) SetParameters(v []*NetworkConfig_Parameter) { +func (x *NetworkConfig) SetParameters(v []NetworkConfig_Parameter) { x.Parameters = v } @@ -2205,11 +2191,11 @@ func (x *NetworkConfig) UnmarshalEasyJSON(in *jlexer.Lexer) { switch key { case "parameters": { - var f *NetworkConfig_Parameter - var list []*NetworkConfig_Parameter + var f NetworkConfig_Parameter + var list []NetworkConfig_Parameter in.Delim('[') for !in.IsDelim(']') { - f = new(NetworkConfig_Parameter) + f = NetworkConfig_Parameter{} f.UnmarshalEasyJSON(in) list = append(list, f) in.WantComma() diff --git a/object/convert.go b/object/convert.go index e237883..88e6ab7 100644 --- a/object/convert.go +++ b/object/convert.go @@ -142,28 +142,26 @@ 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 { - if xs[i] != nil { - err = res[i].FromGRPCMessage(xs[i]) - if err != nil { - return - } + err = res[i].FromGRPCMessage(&xs[i]) + if err != nil { + return } } } @@ -683,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 } @@ -706,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 } } @@ -1626,28 +1624,26 @@ 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 { - if fs[i] != nil { - err = res[i].FromGRPCMessage(fs[i]) - if err != nil { - return - } + err = res[i].FromGRPCMessage(&fs[i]) + if err != nil { + return } } } @@ -1827,28 +1823,26 @@ 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 { - if rs[i] != nil { - err = res[i].FromGRPCMessage(rs[i]) - if err != nil { - return - } + err = res[i].FromGRPCMessage(&rs[i]) + if err != nil { + return } } } diff --git a/object/grpc/service_frostfs.pb.go b/object/grpc/service_frostfs.pb.go index 0bd0111..dea1b5b 100644 --- a/object/grpc/service_frostfs.pb.go +++ b/object/grpc/service_frostfs.pb.go @@ -4201,9 +4201,9 @@ func (x *SearchRequest_Body_Filter) UnmarshalEasyJSON(in *jlexer.Lexer) { } type SearchRequest_Body struct { - ContainerId *grpc.ContainerID `json:"containerId"` - Version uint32 `json:"version"` - Filters []*SearchRequest_Body_Filter `json:"filters"` + ContainerId *grpc.ContainerID `json:"containerId"` + Version uint32 `json:"version"` + Filters []SearchRequest_Body_Filter `json:"filters"` } var ( @@ -4223,7 +4223,7 @@ func (x *SearchRequest_Body) StableSize() (size int) { size += proto.NestedStructureSize(1, x.ContainerId) size += proto.UInt32Size(2, x.Version) for i := range x.Filters { - size += proto.NestedStructureSize(3, x.Filters[i]) + size += proto.NestedStructureSizeUnchecked(3, &x.Filters[i]) } return size } @@ -4248,9 +4248,7 @@ func (x *SearchRequest_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) { mm.AppendUint32(2, x.Version) } for i := range x.Filters { - if x.Filters[i] != nil { - x.Filters[i].EmitProtobuf(mm.AppendMessage(3)) - } + x.Filters[i].EmitProtobuf(mm.AppendMessage(3)) } } @@ -4283,8 +4281,8 @@ func (x *SearchRequest_Body) UnmarshalProtobuf(src []byte) (err error) { if !ok { return fmt.Errorf("cannot unmarshal field %s", "Filters") } - x.Filters = append(x.Filters, new(SearchRequest_Body_Filter)) - ff := x.Filters[len(x.Filters)-1] + x.Filters = append(x.Filters, SearchRequest_Body_Filter{}) + ff := &x.Filters[len(x.Filters)-1] if err := ff.UnmarshalProtobuf(data); err != nil { return fmt.Errorf("unmarshal: %w", err) } @@ -4310,13 +4308,13 @@ func (x *SearchRequest_Body) GetVersion() uint32 { func (x *SearchRequest_Body) SetVersion(v uint32) { x.Version = v } -func (x *SearchRequest_Body) GetFilters() []*SearchRequest_Body_Filter { +func (x *SearchRequest_Body) GetFilters() []SearchRequest_Body_Filter { if x != nil { return x.Filters } return nil } -func (x *SearchRequest_Body) SetFilters(v []*SearchRequest_Body_Filter) { +func (x *SearchRequest_Body) SetFilters(v []SearchRequest_Body_Filter) { x.Filters = v } @@ -4397,11 +4395,11 @@ func (x *SearchRequest_Body) UnmarshalEasyJSON(in *jlexer.Lexer) { } case "filters": { - var f *SearchRequest_Body_Filter - var list []*SearchRequest_Body_Filter + var f SearchRequest_Body_Filter + var list []SearchRequest_Body_Filter in.Delim('[') for !in.IsDelim(']') { - f = new(SearchRequest_Body_Filter) + f = SearchRequest_Body_Filter{} f.UnmarshalEasyJSON(in) list = append(list, f) in.WantComma() @@ -4640,7 +4638,7 @@ func (x *SearchRequest) UnmarshalEasyJSON(in *jlexer.Lexer) { } type SearchResponse_Body struct { - IdList []*grpc.ObjectID `json:"idList"` + IdList []grpc.ObjectID `json:"idList"` } var ( @@ -4658,7 +4656,7 @@ func (x *SearchResponse_Body) StableSize() (size int) { return 0 } for i := range x.IdList { - size += proto.NestedStructureSize(1, x.IdList[i]) + size += proto.NestedStructureSizeUnchecked(1, &x.IdList[i]) } return size } @@ -4677,9 +4675,7 @@ func (x *SearchResponse_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) { return } for i := range x.IdList { - if x.IdList[i] != nil { - x.IdList[i].EmitProtobuf(mm.AppendMessage(1)) - } + x.IdList[i].EmitProtobuf(mm.AppendMessage(1)) } } @@ -4697,8 +4693,8 @@ func (x *SearchResponse_Body) UnmarshalProtobuf(src []byte) (err error) { if !ok { return fmt.Errorf("cannot unmarshal field %s", "IdList") } - x.IdList = append(x.IdList, new(grpc.ObjectID)) - ff := x.IdList[len(x.IdList)-1] + x.IdList = append(x.IdList, grpc.ObjectID{}) + ff := &x.IdList[len(x.IdList)-1] if err := ff.UnmarshalProtobuf(data); err != nil { return fmt.Errorf("unmarshal: %w", err) } @@ -4706,13 +4702,13 @@ func (x *SearchResponse_Body) UnmarshalProtobuf(src []byte) (err error) { } return nil } -func (x *SearchResponse_Body) GetIdList() []*grpc.ObjectID { +func (x *SearchResponse_Body) GetIdList() []grpc.ObjectID { if x != nil { return x.IdList } return nil } -func (x *SearchResponse_Body) SetIdList(v []*grpc.ObjectID) { +func (x *SearchResponse_Body) SetIdList(v []grpc.ObjectID) { x.IdList = v } @@ -4770,11 +4766,11 @@ func (x *SearchResponse_Body) UnmarshalEasyJSON(in *jlexer.Lexer) { switch key { case "idList": { - var f *grpc.ObjectID - var list []*grpc.ObjectID + var f grpc.ObjectID + var list []grpc.ObjectID in.Delim('[') for !in.IsDelim(']') { - f = new(grpc.ObjectID) + f = grpc.ObjectID{} f.UnmarshalEasyJSON(in) list = append(list, f) in.WantComma() @@ -6077,7 +6073,7 @@ func (x *GetRangeResponse) UnmarshalEasyJSON(in *jlexer.Lexer) { type GetRangeHashRequest_Body struct { Address *grpc.Address `json:"address"` - Ranges []*Range `json:"ranges"` + Ranges []Range `json:"ranges"` Salt []byte `json:"salt"` Type grpc.ChecksumType `json:"type"` } @@ -6098,7 +6094,7 @@ func (x *GetRangeHashRequest_Body) StableSize() (size int) { } size += proto.NestedStructureSize(1, x.Address) for i := range x.Ranges { - size += proto.NestedStructureSize(2, x.Ranges[i]) + size += proto.NestedStructureSizeUnchecked(2, &x.Ranges[i]) } size += proto.BytesSize(3, x.Salt) size += proto.EnumSize(4, int32(x.Type)) @@ -6122,9 +6118,7 @@ func (x *GetRangeHashRequest_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) x.Address.EmitProtobuf(mm.AppendMessage(1)) } for i := range x.Ranges { - if x.Ranges[i] != nil { - x.Ranges[i].EmitProtobuf(mm.AppendMessage(2)) - } + x.Ranges[i].EmitProtobuf(mm.AppendMessage(2)) } if len(x.Salt) != 0 { mm.AppendBytes(3, x.Salt) @@ -6157,8 +6151,8 @@ func (x *GetRangeHashRequest_Body) UnmarshalProtobuf(src []byte) (err error) { if !ok { return fmt.Errorf("cannot unmarshal field %s", "Ranges") } - x.Ranges = append(x.Ranges, new(Range)) - ff := x.Ranges[len(x.Ranges)-1] + x.Ranges = append(x.Ranges, Range{}) + ff := &x.Ranges[len(x.Ranges)-1] if err := ff.UnmarshalProtobuf(data); err != nil { return fmt.Errorf("unmarshal: %w", err) } @@ -6187,13 +6181,13 @@ func (x *GetRangeHashRequest_Body) GetAddress() *grpc.Address { func (x *GetRangeHashRequest_Body) SetAddress(v *grpc.Address) { x.Address = v } -func (x *GetRangeHashRequest_Body) GetRanges() []*Range { +func (x *GetRangeHashRequest_Body) GetRanges() []Range { if x != nil { return x.Ranges } return nil } -func (x *GetRangeHashRequest_Body) SetRanges(v []*Range) { +func (x *GetRangeHashRequest_Body) SetRanges(v []Range) { x.Ranges = v } func (x *GetRangeHashRequest_Body) GetSalt() []byte { @@ -6291,11 +6285,11 @@ func (x *GetRangeHashRequest_Body) UnmarshalEasyJSON(in *jlexer.Lexer) { } case "ranges": { - var f *Range - var list []*Range + var f Range + var list []Range in.Delim('[') for !in.IsDelim(']') { - f = new(Range) + f = Range{} f.UnmarshalEasyJSON(in) list = append(list, f) in.WantComma() @@ -7855,7 +7849,7 @@ func (x *PatchRequest_Body_Patch) UnmarshalEasyJSON(in *jlexer.Lexer) { type PatchRequest_Body struct { Address *grpc.Address `json:"address"` - NewAttributes []*Header_Attribute `json:"newAttributes"` + NewAttributes []Header_Attribute `json:"newAttributes"` ReplaceAttributes bool `json:"replaceAttributes"` Patch *PatchRequest_Body_Patch `json:"patch"` } @@ -7876,7 +7870,7 @@ func (x *PatchRequest_Body) StableSize() (size int) { } size += proto.NestedStructureSize(1, x.Address) for i := range x.NewAttributes { - size += proto.NestedStructureSize(2, x.NewAttributes[i]) + size += proto.NestedStructureSizeUnchecked(2, &x.NewAttributes[i]) } size += proto.BoolSize(3, x.ReplaceAttributes) size += proto.NestedStructureSize(4, x.Patch) @@ -7900,9 +7894,7 @@ func (x *PatchRequest_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) { x.Address.EmitProtobuf(mm.AppendMessage(1)) } for i := range x.NewAttributes { - if x.NewAttributes[i] != nil { - x.NewAttributes[i].EmitProtobuf(mm.AppendMessage(2)) - } + x.NewAttributes[i].EmitProtobuf(mm.AppendMessage(2)) } if x.ReplaceAttributes { mm.AppendBool(3, x.ReplaceAttributes) @@ -7935,8 +7927,8 @@ func (x *PatchRequest_Body) UnmarshalProtobuf(src []byte) (err error) { if !ok { return fmt.Errorf("cannot unmarshal field %s", "NewAttributes") } - x.NewAttributes = append(x.NewAttributes, new(Header_Attribute)) - ff := x.NewAttributes[len(x.NewAttributes)-1] + x.NewAttributes = append(x.NewAttributes, Header_Attribute{}) + ff := &x.NewAttributes[len(x.NewAttributes)-1] if err := ff.UnmarshalProtobuf(data); err != nil { return fmt.Errorf("unmarshal: %w", err) } @@ -7968,13 +7960,13 @@ func (x *PatchRequest_Body) GetAddress() *grpc.Address { func (x *PatchRequest_Body) SetAddress(v *grpc.Address) { x.Address = v } -func (x *PatchRequest_Body) GetNewAttributes() []*Header_Attribute { +func (x *PatchRequest_Body) GetNewAttributes() []Header_Attribute { if x != nil { return x.NewAttributes } return nil } -func (x *PatchRequest_Body) SetNewAttributes(v []*Header_Attribute) { +func (x *PatchRequest_Body) SetNewAttributes(v []Header_Attribute) { x.NewAttributes = v } func (x *PatchRequest_Body) GetReplaceAttributes() bool { @@ -8072,11 +8064,11 @@ func (x *PatchRequest_Body) UnmarshalEasyJSON(in *jlexer.Lexer) { } case "newAttributes": { - var f *Header_Attribute - var list []*Header_Attribute + var f Header_Attribute + var list []Header_Attribute in.Delim('[') for !in.IsDelim(']') { - f = new(Header_Attribute) + f = Header_Attribute{} f.UnmarshalEasyJSON(in) list = append(list, f) in.WantComma() diff --git a/object/grpc/types_frostfs.pb.go b/object/grpc/types_frostfs.pb.go index 04a3e29..4233417 100644 --- a/object/grpc/types_frostfs.pb.go +++ b/object/grpc/types_frostfs.pb.go @@ -600,12 +600,12 @@ func (x *Header_Attribute) UnmarshalEasyJSON(in *jlexer.Lexer) { } type Header_Split struct { - Parent *grpc.ObjectID `json:"parent"` - Previous *grpc.ObjectID `json:"previous"` - ParentSignature *grpc.Signature `json:"parentSignature"` - ParentHeader *Header `json:"parentHeader"` - Children []*grpc.ObjectID `json:"children"` - SplitId []byte `json:"splitID"` + Parent *grpc.ObjectID `json:"parent"` + Previous *grpc.ObjectID `json:"previous"` + ParentSignature *grpc.Signature `json:"parentSignature"` + ParentHeader *Header `json:"parentHeader"` + Children []grpc.ObjectID `json:"children"` + SplitId []byte `json:"splitID"` } var ( @@ -627,7 +627,7 @@ func (x *Header_Split) StableSize() (size int) { size += proto.NestedStructureSize(3, x.ParentSignature) size += proto.NestedStructureSize(4, x.ParentHeader) for i := range x.Children { - size += proto.NestedStructureSize(5, x.Children[i]) + size += proto.NestedStructureSizeUnchecked(5, &x.Children[i]) } size += proto.BytesSize(6, x.SplitId) return size @@ -659,9 +659,7 @@ func (x *Header_Split) EmitProtobuf(mm *easyproto.MessageMarshaler) { x.ParentHeader.EmitProtobuf(mm.AppendMessage(4)) } for i := range x.Children { - if x.Children[i] != nil { - x.Children[i].EmitProtobuf(mm.AppendMessage(5)) - } + x.Children[i].EmitProtobuf(mm.AppendMessage(5)) } if len(x.SplitId) != 0 { mm.AppendBytes(6, x.SplitId) @@ -718,8 +716,8 @@ func (x *Header_Split) UnmarshalProtobuf(src []byte) (err error) { if !ok { return fmt.Errorf("cannot unmarshal field %s", "Children") } - x.Children = append(x.Children, new(grpc.ObjectID)) - ff := x.Children[len(x.Children)-1] + x.Children = append(x.Children, grpc.ObjectID{}) + ff := &x.Children[len(x.Children)-1] if err := ff.UnmarshalProtobuf(data); err != nil { return fmt.Errorf("unmarshal: %w", err) } @@ -769,13 +767,13 @@ func (x *Header_Split) GetParentHeader() *Header { func (x *Header_Split) SetParentHeader(v *Header) { x.ParentHeader = v } -func (x *Header_Split) GetChildren() []*grpc.ObjectID { +func (x *Header_Split) GetChildren() []grpc.ObjectID { if x != nil { return x.Children } return nil } -func (x *Header_Split) SetChildren(v []*grpc.ObjectID) { +func (x *Header_Split) SetChildren(v []grpc.ObjectID) { x.Children = v } func (x *Header_Split) GetSplitId() []byte { @@ -895,11 +893,11 @@ func (x *Header_Split) UnmarshalEasyJSON(in *jlexer.Lexer) { } case "children": { - var f *grpc.ObjectID - var list []*grpc.ObjectID + var f grpc.ObjectID + var list []grpc.ObjectID in.Delim('[') for !in.IsDelim(']') { - f = new(grpc.ObjectID) + f = grpc.ObjectID{} f.UnmarshalEasyJSON(in) list = append(list, f) in.WantComma() @@ -923,14 +921,14 @@ func (x *Header_Split) UnmarshalEasyJSON(in *jlexer.Lexer) { } type Header_EC struct { - Parent *grpc.ObjectID `json:"parent"` - Index uint32 `json:"index"` - Total uint32 `json:"total"` - HeaderLength uint32 `json:"headerLength"` - Header []byte `json:"header"` - ParentSplitId []byte `json:"parentSplitID"` - ParentSplitParentId *grpc.ObjectID `json:"parentSplitParentID"` - ParentAttributes []*Header_Attribute `json:"parentAttributes"` + Parent *grpc.ObjectID `json:"parent"` + Index uint32 `json:"index"` + Total uint32 `json:"total"` + HeaderLength uint32 `json:"headerLength"` + Header []byte `json:"header"` + ParentSplitId []byte `json:"parentSplitID"` + ParentSplitParentId *grpc.ObjectID `json:"parentSplitParentID"` + ParentAttributes []Header_Attribute `json:"parentAttributes"` } var ( @@ -955,7 +953,7 @@ func (x *Header_EC) StableSize() (size int) { size += proto.BytesSize(6, x.ParentSplitId) size += proto.NestedStructureSize(7, x.ParentSplitParentId) for i := range x.ParentAttributes { - size += proto.NestedStructureSize(8, x.ParentAttributes[i]) + size += proto.NestedStructureSizeUnchecked(8, &x.ParentAttributes[i]) } return size } @@ -995,9 +993,7 @@ func (x *Header_EC) EmitProtobuf(mm *easyproto.MessageMarshaler) { x.ParentSplitParentId.EmitProtobuf(mm.AppendMessage(7)) } for i := range x.ParentAttributes { - if x.ParentAttributes[i] != nil { - x.ParentAttributes[i].EmitProtobuf(mm.AppendMessage(8)) - } + x.ParentAttributes[i].EmitProtobuf(mm.AppendMessage(8)) } } @@ -1063,8 +1059,8 @@ func (x *Header_EC) UnmarshalProtobuf(src []byte) (err error) { if !ok { return fmt.Errorf("cannot unmarshal field %s", "ParentAttributes") } - x.ParentAttributes = append(x.ParentAttributes, new(Header_Attribute)) - ff := x.ParentAttributes[len(x.ParentAttributes)-1] + x.ParentAttributes = append(x.ParentAttributes, Header_Attribute{}) + ff := &x.ParentAttributes[len(x.ParentAttributes)-1] if err := ff.UnmarshalProtobuf(data); err != nil { return fmt.Errorf("unmarshal: %w", err) } @@ -1135,13 +1131,13 @@ func (x *Header_EC) GetParentSplitParentId() *grpc.ObjectID { func (x *Header_EC) SetParentSplitParentId(v *grpc.ObjectID) { x.ParentSplitParentId = v } -func (x *Header_EC) GetParentAttributes() []*Header_Attribute { +func (x *Header_EC) GetParentAttributes() []Header_Attribute { if x != nil { return x.ParentAttributes } return nil } -func (x *Header_EC) SetParentAttributes(v []*Header_Attribute) { +func (x *Header_EC) SetParentAttributes(v []Header_Attribute) { x.ParentAttributes = v } @@ -1278,11 +1274,11 @@ func (x *Header_EC) UnmarshalEasyJSON(in *jlexer.Lexer) { } case "parentAttributes": { - var f *Header_Attribute - var list []*Header_Attribute + var f Header_Attribute + var list []Header_Attribute in.Delim('[') for !in.IsDelim(']') { - f = new(Header_Attribute) + f = Header_Attribute{} f.UnmarshalEasyJSON(in) list = append(list, f) in.WantComma() @@ -1309,7 +1305,7 @@ type Header struct { ObjectType ObjectType `json:"objectType"` HomomorphicHash *grpc.Checksum `json:"homomorphicHash"` SessionToken *grpc1.SessionToken `json:"sessionToken"` - Attributes []*Header_Attribute `json:"attributes"` + Attributes []Header_Attribute `json:"attributes"` Split *Header_Split `json:"split"` Ec *Header_EC `json:"ec"` } @@ -1338,7 +1334,7 @@ func (x *Header) StableSize() (size int) { size += proto.NestedStructureSize(8, x.HomomorphicHash) size += proto.NestedStructureSize(9, x.SessionToken) for i := range x.Attributes { - size += proto.NestedStructureSize(10, x.Attributes[i]) + size += proto.NestedStructureSizeUnchecked(10, &x.Attributes[i]) } size += proto.NestedStructureSize(11, x.Split) size += proto.NestedStructureSize(12, x.Ec) @@ -1386,9 +1382,7 @@ func (x *Header) EmitProtobuf(mm *easyproto.MessageMarshaler) { x.SessionToken.EmitProtobuf(mm.AppendMessage(9)) } for i := range x.Attributes { - if x.Attributes[i] != nil { - x.Attributes[i].EmitProtobuf(mm.AppendMessage(10)) - } + x.Attributes[i].EmitProtobuf(mm.AppendMessage(10)) } if x.Split != nil { x.Split.EmitProtobuf(mm.AppendMessage(11)) @@ -1484,8 +1478,8 @@ func (x *Header) UnmarshalProtobuf(src []byte) (err error) { if !ok { return fmt.Errorf("cannot unmarshal field %s", "Attributes") } - x.Attributes = append(x.Attributes, new(Header_Attribute)) - ff := x.Attributes[len(x.Attributes)-1] + x.Attributes = append(x.Attributes, Header_Attribute{}) + ff := &x.Attributes[len(x.Attributes)-1] if err := ff.UnmarshalProtobuf(data); err != nil { return fmt.Errorf("unmarshal: %w", err) } @@ -1592,13 +1586,13 @@ func (x *Header) GetSessionToken() *grpc1.SessionToken { func (x *Header) SetSessionToken(v *grpc1.SessionToken) { x.SessionToken = v } -func (x *Header) GetAttributes() []*Header_Attribute { +func (x *Header) GetAttributes() []Header_Attribute { if x != nil { return x.Attributes } return nil } -func (x *Header) SetAttributes(v []*Header_Attribute) { +func (x *Header) SetAttributes(v []Header_Attribute) { x.Attributes = v } func (x *Header) GetSplit() *Header_Split { @@ -1805,11 +1799,11 @@ func (x *Header) UnmarshalEasyJSON(in *jlexer.Lexer) { } case "attributes": { - var f *Header_Attribute - var list []*Header_Attribute + var f Header_Attribute + var list []Header_Attribute in.Delim('[') for !in.IsDelim(']') { - f = new(Header_Attribute) + f = Header_Attribute{} f.UnmarshalEasyJSON(in) list = append(list, f) in.WantComma() @@ -2469,7 +2463,7 @@ func (x *ECInfo_Chunk) UnmarshalEasyJSON(in *jlexer.Lexer) { } type ECInfo struct { - Chunks []*ECInfo_Chunk `json:"chunks"` + Chunks []ECInfo_Chunk `json:"chunks"` } var ( @@ -2487,7 +2481,7 @@ func (x *ECInfo) StableSize() (size int) { return 0 } for i := range x.Chunks { - size += proto.NestedStructureSize(1, x.Chunks[i]) + size += proto.NestedStructureSizeUnchecked(1, &x.Chunks[i]) } return size } @@ -2506,9 +2500,7 @@ func (x *ECInfo) EmitProtobuf(mm *easyproto.MessageMarshaler) { return } for i := range x.Chunks { - if x.Chunks[i] != nil { - x.Chunks[i].EmitProtobuf(mm.AppendMessage(1)) - } + x.Chunks[i].EmitProtobuf(mm.AppendMessage(1)) } } @@ -2526,8 +2518,8 @@ func (x *ECInfo) UnmarshalProtobuf(src []byte) (err error) { if !ok { return fmt.Errorf("cannot unmarshal field %s", "Chunks") } - x.Chunks = append(x.Chunks, new(ECInfo_Chunk)) - ff := x.Chunks[len(x.Chunks)-1] + x.Chunks = append(x.Chunks, ECInfo_Chunk{}) + ff := &x.Chunks[len(x.Chunks)-1] if err := ff.UnmarshalProtobuf(data); err != nil { return fmt.Errorf("unmarshal: %w", err) } @@ -2535,13 +2527,13 @@ func (x *ECInfo) UnmarshalProtobuf(src []byte) (err error) { } return nil } -func (x *ECInfo) GetChunks() []*ECInfo_Chunk { +func (x *ECInfo) GetChunks() []ECInfo_Chunk { if x != nil { return x.Chunks } return nil } -func (x *ECInfo) SetChunks(v []*ECInfo_Chunk) { +func (x *ECInfo) SetChunks(v []ECInfo_Chunk) { x.Chunks = v } @@ -2599,11 +2591,11 @@ func (x *ECInfo) UnmarshalEasyJSON(in *jlexer.Lexer) { switch key { case "chunks": { - var f *ECInfo_Chunk - var list []*ECInfo_Chunk + var f ECInfo_Chunk + var list []ECInfo_Chunk in.Delim('[') for !in.IsDelim(']') { - f = new(ECInfo_Chunk) + f = ECInfo_Chunk{} f.UnmarshalEasyJSON(in) list = append(list, f) in.WantComma() diff --git a/object/lock.go b/object/lock.go index 62ba4a9..585fd09 100644 --- a/object/lock.go +++ b/object/lock.go @@ -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 } diff --git a/refs/convert.go b/refs/convert.go index 6f06783..da31cdb 100644 --- a/refs/convert.go +++ b/refs/convert.go @@ -52,28 +52,26 @@ 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 { - if idsV2[i] != nil { - err = res[i].FromGRPCMessage(idsV2[i]) - if err != nil { - return - } + err = res[i].FromGRPCMessage(&idsV2[i]) + if err != nil { + return } } } @@ -104,28 +102,26 @@ 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 { - if idsV2[i] != nil { - err = res[i].FromGRPCMessage(idsV2[i]) - if err != nil { - return - } + err = res[i].FromGRPCMessage(&idsV2[i]) + if err != nil { + return } } } diff --git a/session/convert.go b/session/convert.go index b7f334e..d0e83fa 100644 --- a/session/convert.go +++ b/session/convert.go @@ -207,28 +207,26 @@ 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 { - if xs[i] != nil { - err = res[i].FromGRPCMessage(xs[i]) - if err != nil { - return - } + err = res[i].FromGRPCMessage(&xs[i]) + if err != nil { + return } } } diff --git a/session/grpc/types_frostfs.pb.go b/session/grpc/types_frostfs.pb.go index 4f8bf81..41ff5d9 100644 --- a/session/grpc/types_frostfs.pb.go +++ b/session/grpc/types_frostfs.pb.go @@ -72,7 +72,7 @@ func (x *ObjectSessionContext_Verb) FromString(s string) bool { type ObjectSessionContext_Target struct { Container *grpc.ContainerID `json:"container"` - Objects []*grpc.ObjectID `json:"objects"` + Objects []grpc.ObjectID `json:"objects"` } var ( @@ -91,7 +91,7 @@ func (x *ObjectSessionContext_Target) StableSize() (size int) { } size += proto.NestedStructureSize(1, x.Container) for i := range x.Objects { - size += proto.NestedStructureSize(2, x.Objects[i]) + size += proto.NestedStructureSizeUnchecked(2, &x.Objects[i]) } return size } @@ -113,9 +113,7 @@ func (x *ObjectSessionContext_Target) EmitProtobuf(mm *easyproto.MessageMarshale x.Container.EmitProtobuf(mm.AppendMessage(1)) } for i := range x.Objects { - if x.Objects[i] != nil { - x.Objects[i].EmitProtobuf(mm.AppendMessage(2)) - } + x.Objects[i].EmitProtobuf(mm.AppendMessage(2)) } } @@ -142,8 +140,8 @@ func (x *ObjectSessionContext_Target) UnmarshalProtobuf(src []byte) (err error) if !ok { return fmt.Errorf("cannot unmarshal field %s", "Objects") } - x.Objects = append(x.Objects, new(grpc.ObjectID)) - ff := x.Objects[len(x.Objects)-1] + x.Objects = append(x.Objects, grpc.ObjectID{}) + ff := &x.Objects[len(x.Objects)-1] if err := ff.UnmarshalProtobuf(data); err != nil { return fmt.Errorf("unmarshal: %w", err) } @@ -160,13 +158,13 @@ func (x *ObjectSessionContext_Target) GetContainer() *grpc.ContainerID { func (x *ObjectSessionContext_Target) SetContainer(v *grpc.ContainerID) { x.Container = v } -func (x *ObjectSessionContext_Target) GetObjects() []*grpc.ObjectID { +func (x *ObjectSessionContext_Target) GetObjects() []grpc.ObjectID { if x != nil { return x.Objects } return nil } -func (x *ObjectSessionContext_Target) SetObjects(v []*grpc.ObjectID) { +func (x *ObjectSessionContext_Target) SetObjects(v []grpc.ObjectID) { x.Objects = v } @@ -236,11 +234,11 @@ func (x *ObjectSessionContext_Target) UnmarshalEasyJSON(in *jlexer.Lexer) { } case "objects": { - var f *grpc.ObjectID - var list []*grpc.ObjectID + var f grpc.ObjectID + var list []grpc.ObjectID in.Delim('[') for !in.IsDelim(']') { - f = new(grpc.ObjectID) + f = grpc.ObjectID{} f.UnmarshalEasyJSON(in) list = append(list, f) in.WantComma() @@ -1551,7 +1549,7 @@ type RequestMetaHeader struct { Version *grpc.Version `json:"version"` Epoch uint64 `json:"epoch"` Ttl uint32 `json:"ttl"` - XHeaders []*XHeader `json:"xHeaders"` + XHeaders []XHeader `json:"xHeaders"` SessionToken *SessionToken `json:"sessionToken"` BearerToken *grpc1.BearerToken `json:"bearerToken"` Origin *RequestMetaHeader `json:"origin"` @@ -1576,7 +1574,7 @@ func (x *RequestMetaHeader) StableSize() (size int) { size += proto.UInt64Size(2, x.Epoch) size += proto.UInt32Size(3, x.Ttl) for i := range x.XHeaders { - size += proto.NestedStructureSize(4, x.XHeaders[i]) + size += proto.NestedStructureSizeUnchecked(4, &x.XHeaders[i]) } size += proto.NestedStructureSize(5, x.SessionToken) size += proto.NestedStructureSize(6, x.BearerToken) @@ -1608,9 +1606,7 @@ func (x *RequestMetaHeader) EmitProtobuf(mm *easyproto.MessageMarshaler) { mm.AppendUint32(3, x.Ttl) } for i := range x.XHeaders { - if x.XHeaders[i] != nil { - x.XHeaders[i].EmitProtobuf(mm.AppendMessage(4)) - } + x.XHeaders[i].EmitProtobuf(mm.AppendMessage(4)) } if x.SessionToken != nil { x.SessionToken.EmitProtobuf(mm.AppendMessage(5)) @@ -1661,8 +1657,8 @@ func (x *RequestMetaHeader) UnmarshalProtobuf(src []byte) (err error) { if !ok { return fmt.Errorf("cannot unmarshal field %s", "XHeaders") } - x.XHeaders = append(x.XHeaders, new(XHeader)) - ff := x.XHeaders[len(x.XHeaders)-1] + x.XHeaders = append(x.XHeaders, XHeader{}) + ff := &x.XHeaders[len(x.XHeaders)-1] if err := ff.UnmarshalProtobuf(data); err != nil { return fmt.Errorf("unmarshal: %w", err) } @@ -1730,13 +1726,13 @@ func (x *RequestMetaHeader) GetTtl() uint32 { func (x *RequestMetaHeader) SetTtl(v uint32) { x.Ttl = v } -func (x *RequestMetaHeader) GetXHeaders() []*XHeader { +func (x *RequestMetaHeader) GetXHeaders() []XHeader { if x != nil { return x.XHeaders } return nil } -func (x *RequestMetaHeader) SetXHeaders(v []*XHeader) { +func (x *RequestMetaHeader) SetXHeaders(v []XHeader) { x.XHeaders = v } func (x *RequestMetaHeader) GetSessionToken() *SessionToken { @@ -1884,11 +1880,11 @@ func (x *RequestMetaHeader) UnmarshalEasyJSON(in *jlexer.Lexer) { } case "xHeaders": { - var f *XHeader - var list []*XHeader + var f XHeader + var list []XHeader in.Delim('[') for !in.IsDelim(']') { - f = new(XHeader) + f = XHeader{} f.UnmarshalEasyJSON(in) list = append(list, f) in.WantComma() @@ -1936,7 +1932,7 @@ type ResponseMetaHeader struct { Version *grpc.Version `json:"version"` Epoch uint64 `json:"epoch"` Ttl uint32 `json:"ttl"` - XHeaders []*XHeader `json:"xHeaders"` + XHeaders []XHeader `json:"xHeaders"` Origin *ResponseMetaHeader `json:"origin"` Status *grpc2.Status `json:"status"` } @@ -1959,7 +1955,7 @@ func (x *ResponseMetaHeader) StableSize() (size int) { size += proto.UInt64Size(2, x.Epoch) size += proto.UInt32Size(3, x.Ttl) for i := range x.XHeaders { - size += proto.NestedStructureSize(4, x.XHeaders[i]) + size += proto.NestedStructureSizeUnchecked(4, &x.XHeaders[i]) } size += proto.NestedStructureSize(5, x.Origin) size += proto.NestedStructureSize(6, x.Status) @@ -1989,9 +1985,7 @@ func (x *ResponseMetaHeader) EmitProtobuf(mm *easyproto.MessageMarshaler) { mm.AppendUint32(3, x.Ttl) } for i := range x.XHeaders { - if x.XHeaders[i] != nil { - x.XHeaders[i].EmitProtobuf(mm.AppendMessage(4)) - } + x.XHeaders[i].EmitProtobuf(mm.AppendMessage(4)) } if x.Origin != nil { x.Origin.EmitProtobuf(mm.AppendMessage(5)) @@ -2036,8 +2030,8 @@ func (x *ResponseMetaHeader) UnmarshalProtobuf(src []byte) (err error) { if !ok { return fmt.Errorf("cannot unmarshal field %s", "XHeaders") } - x.XHeaders = append(x.XHeaders, new(XHeader)) - ff := x.XHeaders[len(x.XHeaders)-1] + x.XHeaders = append(x.XHeaders, XHeader{}) + ff := &x.XHeaders[len(x.XHeaders)-1] if err := ff.UnmarshalProtobuf(data); err != nil { return fmt.Errorf("unmarshal: %w", err) } @@ -2090,13 +2084,13 @@ func (x *ResponseMetaHeader) GetTtl() uint32 { func (x *ResponseMetaHeader) SetTtl(v uint32) { x.Ttl = v } -func (x *ResponseMetaHeader) GetXHeaders() []*XHeader { +func (x *ResponseMetaHeader) GetXHeaders() []XHeader { if x != nil { return x.XHeaders } return nil } -func (x *ResponseMetaHeader) SetXHeaders(v []*XHeader) { +func (x *ResponseMetaHeader) SetXHeaders(v []XHeader) { x.XHeaders = v } func (x *ResponseMetaHeader) GetOrigin() *ResponseMetaHeader { @@ -2216,11 +2210,11 @@ func (x *ResponseMetaHeader) UnmarshalEasyJSON(in *jlexer.Lexer) { } case "xHeaders": { - var f *XHeader - var list []*XHeader + var f XHeader + var list []XHeader in.Delim('[') for !in.IsDelim(']') { - f = new(XHeader) + f = XHeader{} f.UnmarshalEasyJSON(in) list = append(list, f) in.WantComma() diff --git a/status/convert.go b/status/convert.go index 0743952..3c5b5bf 100644 --- a/status/convert.go +++ b/status/convert.go @@ -48,13 +48,13 @@ func (x *Status) ToGRPCMessage() grpc.Message { m.SetCode(CodeToGRPC(x.code)) m.SetMessage(x.msg) - var ds []*status.Status_Detail + var ds []status.Status_Detail if ln := len(x.details); ln > 0 { - ds = make([]*status.Status_Detail, 0, ln) + ds = make([]status.Status_Detail, 0, ln) for i := 0; i < ln; i++ { - ds = append(ds, x.details[i].ToGRPCMessage().(*status.Status_Detail)) + ds = append(ds, *x.details[i].ToGRPCMessage().(*status.Status_Detail)) } } @@ -81,10 +81,8 @@ func (x *Status) FromGRPCMessage(m grpc.Message) error { ds = make([]Detail, ln) for i := 0; i < ln; i++ { - if dsV2[i] != nil { - if err := ds[i].FromGRPCMessage(dsV2[i]); err != nil { - return err - } + if err := ds[i].FromGRPCMessage(&dsV2[i]); err != nil { + return err } } } diff --git a/status/grpc/types_frostfs.pb.go b/status/grpc/types_frostfs.pb.go index 5012491..29dfebe 100644 --- a/status/grpc/types_frostfs.pb.go +++ b/status/grpc/types_frostfs.pb.go @@ -429,9 +429,9 @@ func (x *Status_Detail) UnmarshalEasyJSON(in *jlexer.Lexer) { } type Status struct { - Code uint32 `json:"code"` - Message string `json:"message"` - Details []*Status_Detail `json:"details"` + Code uint32 `json:"code"` + Message string `json:"message"` + Details []Status_Detail `json:"details"` } var ( @@ -451,7 +451,7 @@ func (x *Status) StableSize() (size int) { size += proto.UInt32Size(1, x.Code) size += proto.StringSize(2, x.Message) for i := range x.Details { - size += proto.NestedStructureSize(3, x.Details[i]) + size += proto.NestedStructureSizeUnchecked(3, &x.Details[i]) } return size } @@ -476,9 +476,7 @@ func (x *Status) EmitProtobuf(mm *easyproto.MessageMarshaler) { mm.AppendString(2, x.Message) } for i := range x.Details { - if x.Details[i] != nil { - x.Details[i].EmitProtobuf(mm.AppendMessage(3)) - } + x.Details[i].EmitProtobuf(mm.AppendMessage(3)) } } @@ -508,8 +506,8 @@ func (x *Status) UnmarshalProtobuf(src []byte) (err error) { if !ok { return fmt.Errorf("cannot unmarshal field %s", "Details") } - x.Details = append(x.Details, new(Status_Detail)) - ff := x.Details[len(x.Details)-1] + x.Details = append(x.Details, Status_Detail{}) + ff := &x.Details[len(x.Details)-1] if err := ff.UnmarshalProtobuf(data); err != nil { return fmt.Errorf("unmarshal: %w", err) } @@ -535,13 +533,13 @@ func (x *Status) GetMessage() string { func (x *Status) SetMessage(v string) { x.Message = v } -func (x *Status) GetDetails() []*Status_Detail { +func (x *Status) GetDetails() []Status_Detail { if x != nil { return x.Details } return nil } -func (x *Status) SetDetails(v []*Status_Detail) { +func (x *Status) SetDetails(v []Status_Detail) { x.Details = v } @@ -621,11 +619,11 @@ func (x *Status) UnmarshalEasyJSON(in *jlexer.Lexer) { } case "details": { - var f *Status_Detail - var list []*Status_Detail + var f Status_Detail + var list []Status_Detail in.Delim('[') for !in.IsDelim(']') { - f = new(Status_Detail) + f = Status_Detail{} f.UnmarshalEasyJSON(in) list = append(list, f) in.WantComma() diff --git a/tombstone/grpc/types_frostfs.pb.go b/tombstone/grpc/types_frostfs.pb.go index 8c2e83c..f7bc48c 100644 --- a/tombstone/grpc/types_frostfs.pb.go +++ b/tombstone/grpc/types_frostfs.pb.go @@ -15,9 +15,9 @@ import ( ) type Tombstone struct { - ExpirationEpoch uint64 `json:"expirationEpoch"` - SplitId []byte `json:"splitID"` - Members []*grpc.ObjectID `json:"members"` + ExpirationEpoch uint64 `json:"expirationEpoch"` + SplitId []byte `json:"splitID"` + Members []grpc.ObjectID `json:"members"` } var ( @@ -37,7 +37,7 @@ func (x *Tombstone) StableSize() (size int) { size += proto.UInt64Size(1, x.ExpirationEpoch) size += proto.BytesSize(2, x.SplitId) for i := range x.Members { - size += proto.NestedStructureSize(3, x.Members[i]) + size += proto.NestedStructureSizeUnchecked(3, &x.Members[i]) } return size } @@ -62,9 +62,7 @@ func (x *Tombstone) EmitProtobuf(mm *easyproto.MessageMarshaler) { mm.AppendBytes(2, x.SplitId) } for i := range x.Members { - if x.Members[i] != nil { - x.Members[i].EmitProtobuf(mm.AppendMessage(3)) - } + x.Members[i].EmitProtobuf(mm.AppendMessage(3)) } } @@ -94,8 +92,8 @@ func (x *Tombstone) UnmarshalProtobuf(src []byte) (err error) { if !ok { return fmt.Errorf("cannot unmarshal field %s", "Members") } - x.Members = append(x.Members, new(grpc.ObjectID)) - ff := x.Members[len(x.Members)-1] + 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) } @@ -121,13 +119,13 @@ func (x *Tombstone) GetSplitId() []byte { func (x *Tombstone) SetSplitId(v []byte) { x.SplitId = v } -func (x *Tombstone) GetMembers() []*grpc.ObjectID { +func (x *Tombstone) GetMembers() []grpc.ObjectID { if x != nil { return x.Members } return nil } -func (x *Tombstone) SetMembers(v []*grpc.ObjectID) { +func (x *Tombstone) SetMembers(v []grpc.ObjectID) { x.Members = v } @@ -207,11 +205,11 @@ func (x *Tombstone) UnmarshalEasyJSON(in *jlexer.Lexer) { } case "members": { - var f *grpc.ObjectID - var list []*grpc.ObjectID + var f grpc.ObjectID + var list []grpc.ObjectID in.Delim('[') for !in.IsDelim(']') { - f = new(grpc.ObjectID) + f = grpc.ObjectID{} f.UnmarshalEasyJSON(in) list = append(list, f) in.WantComma() diff --git a/util/proto/marshal_test.go b/util/proto/marshal_test.go index a848bb5..1cd7005 100644 --- a/util/proto/marshal_test.go +++ b/util/proto/marshal_test.go @@ -133,10 +133,10 @@ func randIntSlice[T protoInt](n int, includeZero bool) []T { return r } -func uint32SliceToAux(s []uint32) []*generated.RepPrimitives_Aux { - r := make([]*generated.RepPrimitives_Aux, len(s)) +func uint32SliceToAux(s []uint32) []generated.RepPrimitives_Aux { + r := make([]generated.RepPrimitives_Aux, len(s)) for i := range s { - r[i] = &generated.RepPrimitives_Aux{s[i]} + r[i] = generated.RepPrimitives_Aux{InnerField: s[i]} } return r } diff --git a/util/proto/test/custom/test_frostfs.pb.go b/util/proto/test/custom/test_frostfs.pb.go index f3b958f..97efa51 100644 --- a/util/proto/test/custom/test_frostfs.pb.go +++ b/util/proto/test/custom/test_frostfs.pb.go @@ -932,14 +932,14 @@ func (x *RepPrimitives_Aux) UnmarshalEasyJSON(in *jlexer.Lexer) { } type RepPrimitives struct { - FieldA [][]byte `json:"fieldA"` - FieldB []string `json:"fieldB"` - FieldC []int32 `json:"fieldC"` - FieldD []uint32 `json:"fieldD"` - FieldE []int64 `json:"fieldE"` - FieldF []uint64 `json:"fieldF"` - FieldFu []uint64 `json:"fieldFu"` - FieldAux []*RepPrimitives_Aux `json:"fieldAux"` + FieldA [][]byte `json:"fieldA"` + FieldB []string `json:"fieldB"` + FieldC []int32 `json:"fieldC"` + FieldD []uint32 `json:"fieldD"` + FieldE []int64 `json:"fieldE"` + FieldF []uint64 `json:"fieldF"` + FieldFu []uint64 `json:"fieldFu"` + FieldAux []RepPrimitives_Aux `json:"fieldAux"` } var ( @@ -971,7 +971,7 @@ func (x *RepPrimitives) StableSize() (size int) { size += protowire.SizeGroup(protowire.Number(7), protowire.SizeVarint(x.FieldFu[i])) } for i := range x.FieldAux { - size += proto.NestedStructureSize(8, x.FieldAux[i]) + size += proto.NestedStructureSizeUnchecked(8, &x.FieldAux[i]) } return size } @@ -1011,9 +1011,7 @@ func (x *RepPrimitives) EmitProtobuf(mm *easyproto.MessageMarshaler) { mm.AppendUint64(7, x.FieldFu[j]) } for i := range x.FieldAux { - if x.FieldAux[i] != nil { - x.FieldAux[i].EmitProtobuf(mm.AppendMessage(8)) - } + x.FieldAux[i].EmitProtobuf(mm.AppendMessage(8)) } } @@ -1073,8 +1071,8 @@ func (x *RepPrimitives) UnmarshalProtobuf(src []byte) (err error) { if !ok { return fmt.Errorf("cannot unmarshal field %s", "FieldAux") } - x.FieldAux = append(x.FieldAux, new(RepPrimitives_Aux)) - ff := x.FieldAux[len(x.FieldAux)-1] + x.FieldAux = append(x.FieldAux, RepPrimitives_Aux{}) + ff := &x.FieldAux[len(x.FieldAux)-1] if err := ff.UnmarshalProtobuf(data); err != nil { return fmt.Errorf("unmarshal: %w", err) } @@ -1145,13 +1143,13 @@ func (x *RepPrimitives) GetFieldFu() []uint64 { func (x *RepPrimitives) SetFieldFu(v []uint64) { x.FieldFu = v } -func (x *RepPrimitives) GetFieldAux() []*RepPrimitives_Aux { +func (x *RepPrimitives) GetFieldAux() []RepPrimitives_Aux { if x != nil { return x.FieldAux } return nil } -func (x *RepPrimitives) SetFieldAux(v []*RepPrimitives_Aux) { +func (x *RepPrimitives) SetFieldAux(v []RepPrimitives_Aux) { x.FieldAux = v } @@ -1384,11 +1382,11 @@ func (x *RepPrimitives) UnmarshalEasyJSON(in *jlexer.Lexer) { } case "fieldAux": { - var f *RepPrimitives_Aux - var list []*RepPrimitives_Aux + var f RepPrimitives_Aux + var list []RepPrimitives_Aux in.Delim('[') for !in.IsDelim(']') { - f = new(RepPrimitives_Aux) + f = RepPrimitives_Aux{} f.UnmarshalEasyJSON(in) list = append(list, f) in.WantComma() diff --git a/util/protogen/internalgengo/json.go b/util/protogen/internalgengo/json.go index 4ae24e7..f7cd284 100644 --- a/util/protogen/internalgengo/json.go +++ b/util/protogen/internalgengo/json.go @@ -117,7 +117,7 @@ func emitJSONFieldRead(g *protogen.GeneratedFile, f *protogen.Field, name string template = "%s = in.Bytes()" case protoreflect.MessageKind: if f.Desc.IsList() { - g.P("f = new(", fieldType(g, f)[3:], ")") + g.P("f = ", fieldType(g, f)[2:], "{}") } else { g.P("f = new(", fieldType(g, f)[1:], ")") } diff --git a/util/protogen/internalgengo/proto.go b/util/protogen/internalgengo/proto.go index 8894cde..1467541 100644 --- a/util/protogen/internalgengo/proto.go +++ b/util/protogen/internalgengo/proto.go @@ -39,8 +39,8 @@ func emitFieldUnmarshal(g *protogen.GeneratedFile, f *protogen.Field) { g.P("data, ok := fc.MessageData()") g.P(`if !ok { return fmt.Errorf("cannot unmarshal field %s", "`, f.GoName, `") }`) if f.Desc.IsList() { - g.P(name, " = append(", name, ", new(", fieldType(g, f)[3:], "))") - g.P("ff := ", name, "[len(", name, ")-1]") + g.P(name, " = append(", name, ", ", fieldType(g, f)[2:], "{})") + g.P("ff := &", name, "[len(", name, ")-1]") name = "ff" } else if f.Oneof != nil { const tmp = "oneofField" @@ -172,11 +172,12 @@ func emitMarshalRaw(g *protogen.GeneratedFile, f *protogen.Field, name string) { defer g.P("}") name += "[i]" + } else { + g.P("if ", notNil(name), " {") + defer g.P("}") } - g.P("if ", notNil(name), " {") g.P(name, ".EmitProtobuf(mm.AppendMessage(", f.Desc.Number(), "))") - g.P("}") return } diff --git a/util/protogen/internalgengo/proto_field_type.go b/util/protogen/internalgengo/proto_field_type.go index 09f6884..0096751 100644 --- a/util/protogen/internalgengo/proto_field_type.go +++ b/util/protogen/internalgengo/proto_field_type.go @@ -43,7 +43,10 @@ func fieldType(g *protogen.GeneratedFile, field *protogen.Field) structField { case protoreflect.BytesKind: typ = "[]byte" case protoreflect.MessageKind: - typ = structField(g.QualifiedGoIdent(field.Message.GoIdent)).PointerTo() + typ = structField(g.QualifiedGoIdent(field.Message.GoIdent)) + if !field.Desc.IsList() { + typ = typ.PointerTo() + } case protoreflect.GroupKind: panic("unimplemented") } diff --git a/util/protogen/internalgengo/proto_stable_compat.go b/util/protogen/internalgengo/proto_stable_compat.go index c27b9d8..3c4670c 100644 --- a/util/protogen/internalgengo/proto_stable_compat.go +++ b/util/protogen/internalgengo/proto_stable_compat.go @@ -72,7 +72,7 @@ func emitFieldSize(g *protogen.GeneratedFile, f *protogen.Field) { case f.Desc.IsList() && (f.Desc.Kind() == protoreflect.MessageKind || f.Desc.Kind() == protoreflect.Uint64Kind && !f.Desc.IsPacked()): g.P("for i := range ", name, "{") if f.Desc.Kind() == protoreflect.MessageKind { - g.P("size += ", protoPackage.Ident("NestedStructureSize"), "(", f.Desc.Number(), ", ", name, "[i])") + g.P("size += ", protoPackage.Ident("NestedStructureSizeUnchecked"), "(", f.Desc.Number(), ", &", name, "[i])") } else { if f.Desc.Kind() != protoreflect.Uint64Kind { panic("only uint64 unpacked primitive is supported") From 9c5e32a183576069b889f7e5d09af966c8623612 Mon Sep 17 00:00:00 2001 From: Aleksey Savchuk Date: Mon, 26 Aug 2024 14:13:20 +0300 Subject: [PATCH 1174/1196] [#106] test: Generate correct data for tests Some tests are using invalid data that do not meet the requirements of the FrostFS protocol, e.g. - Container/Object IDs aren't 32 bytes long - Signature key and sign have invalid length - Split IDs aren't valid UUIDv4 and etc. Signed-off-by: Aleksey Savchuk --- container/test/generate.go | 7 ++++++- object/test/generate.go | 21 +++++++++++++++++---- refs/test/generate.go | 37 ++++++++++++++++++++++++++++--------- session/test/generate.go | 11 +++++++++-- tombstone/test/generate.go | 7 ++++++- 5 files changed, 66 insertions(+), 17 deletions(-) diff --git a/container/test/generate.go b/container/test/generate.go index b94347b..23ad3a1 100644 --- a/container/test/generate.go +++ b/container/test/generate.go @@ -1,6 +1,8 @@ package containertest import ( + "crypto/rand" + acltest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/acl/test" "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/container" netmaptest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/netmap/test" @@ -36,8 +38,11 @@ func GenerateContainer(empty bool) *container.Container { m := new(container.Container) if !empty { + nonce := make([]byte, 16) + _, _ = rand.Read(nonce) + m.SetBasicACL(12) - m.SetNonce([]byte{1, 2, 3}) + m.SetNonce(nonce) m.SetOwnerID(refstest.GenerateOwnerID(false)) m.SetAttributes(GenerateAttributes(false)) m.SetPlacementPolicy(netmaptest.GeneratePlacementPolicy(false)) diff --git a/object/test/generate.go b/object/test/generate.go index 87ad64e..b4d3de5 100644 --- a/object/test/generate.go +++ b/object/test/generate.go @@ -1,6 +1,7 @@ package objecttest import ( + crand "crypto/rand" "math/rand" "time" @@ -59,7 +60,10 @@ func generateSplitHeader(empty, withPar bool) *object.SplitHeader { m := new(object.SplitHeader) if !empty { - m.SetSplitID([]byte{1, 3, 5}) + id := make([]byte, 16) + _, _ = crand.Read(id) + + m.SetSplitID(id) m.SetParent(refstest.GenerateObjectID(false)) m.SetPrevious(refstest.GenerateObjectID(false)) m.SetChildren(refstest.GenerateObjectIDs(false)) @@ -91,7 +95,10 @@ func GenerateECHeader(empty bool) *object.ECHeader { if !empty { ech.Parent = refstest.GenerateObjectID(empty) - ech.ParentSplitID = []byte{1, 2, 3} + + ech.ParentSplitID = make([]byte, 16) + _, _ = crand.Read(ech.ParentSplitID) + ech.ParentSplitParentID = refstest.GenerateObjectID(empty) ech.ParentAttributes = GenerateAttributes(empty) ech.Index = 0 @@ -150,7 +157,10 @@ func GenerateSplitInfo(empty bool) *object.SplitInfo { m := new(object.SplitInfo) if !empty { - m.SetSplitID([]byte("splitID")) + id := make([]byte, 16) + _, _ = crand.Read(id) + + m.SetSplitID(id) m.SetLastPart(refstest.GenerateObjectID(false)) m.SetLink(refstest.GenerateObjectID(false)) } @@ -627,7 +637,10 @@ func GenerateGetRangeHashResponseBody(empty bool) *object.GetRangeHashResponseBo if !empty { m.SetType(678) - m.SetHashList([][]byte{{1}, {2}}) + m.SetHashList([][]byte{ + refstest.GenerateChecksum(false).GetSum(), + refstest.GenerateChecksum(false).GetSum(), + }) } return m diff --git a/refs/test/generate.go b/refs/test/generate.go index 6217a96..49619ef 100644 --- a/refs/test/generate.go +++ b/refs/test/generate.go @@ -1,7 +1,8 @@ package refstest import ( - "math/rand" + crand "crypto/rand" + "crypto/sha256" "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" ) @@ -21,7 +22,10 @@ func GenerateOwnerID(empty bool) *refs.OwnerID { m := new(refs.OwnerID) if !empty { - m.SetValue([]byte{1, 2, 3}) + id := make([]byte, 25) + _, _ = crand.Read(id) + + m.SetValue(id) } return m @@ -42,7 +46,10 @@ func GenerateObjectID(empty bool) *refs.ObjectID { m := new(refs.ObjectID) if !empty { - m.SetValue([]byte{1, 2, 3}) + id := make([]byte, sha256.Size) + _, _ = crand.Read(id) + + m.SetValue(id) } return m @@ -65,7 +72,10 @@ func GenerateContainerID(empty bool) *refs.ContainerID { m := new(refs.ContainerID) if !empty { - m.SetValue([]byte{1, 2, 3}) + id := make([]byte, sha256.Size) + _, _ = crand.Read(id) + + m.SetValue(id) } return m @@ -88,9 +98,15 @@ func GenerateSignature(empty bool) *refs.Signature { m := new(refs.Signature) if !empty { - m.SetKey([]byte{1}) - m.SetSign([]byte{2}) - m.SetScheme(refs.SignatureScheme(rand.Int31() % 3)) + key := make([]byte, 33) + _, _ = crand.Read(key) + + sign := make([]byte, 65) + _, _ = crand.Read(sign) + + m.SetScheme(refs.ECDSA_SHA512) + m.SetKey(key) + m.SetSign(sign) } return m @@ -100,8 +116,11 @@ func GenerateChecksum(empty bool) *refs.Checksum { m := new(refs.Checksum) if !empty { - m.SetType(1) - m.SetSum([]byte{1, 2, 3}) + cs := make([]byte, sha256.Size) + _, _ = crand.Read(cs) + + m.SetType(refs.SHA256) + m.SetSum(cs) } return m diff --git a/session/test/generate.go b/session/test/generate.go index 561ec01..58084be 100644 --- a/session/test/generate.go +++ b/session/test/generate.go @@ -1,6 +1,7 @@ package sessiontest import ( + crand "crypto/rand" "math/rand" "time" @@ -38,7 +39,10 @@ func GenerateCreateResponseBody(empty bool) *session.CreateResponseBody { m := new(session.CreateResponseBody) if !empty { - m.SetID([]byte{1, 2, 3}) + id := make([]byte, 16) + _, _ = crand.Read(id) + + m.SetID(id) m.SetSessionKey([]byte{4, 5, 6}) } @@ -164,7 +168,10 @@ func GenerateSessionTokenBody(empty bool) *session.TokenBody { m := new(session.TokenBody) if !empty { - m.SetID([]byte{1}) + id := make([]byte, 16) + _, _ = crand.Read(id) + + m.SetID(id) m.SetSessionKey([]byte{2}) m.SetOwnerID(refstest.GenerateOwnerID(false)) m.SetLifetime(GenerateTokenLifetime(false)) diff --git a/tombstone/test/generate.go b/tombstone/test/generate.go index 3caf528..1fab9eb 100644 --- a/tombstone/test/generate.go +++ b/tombstone/test/generate.go @@ -1,6 +1,8 @@ package tombstonetest import ( + "crypto/rand" + refstest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/test" "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/tombstone" ) @@ -9,8 +11,11 @@ func GenerateTombstone(empty bool) *tombstone.Tombstone { m := new(tombstone.Tombstone) if !empty { + id := make([]byte, 16) + _, _ = rand.Read(id) + m.SetExpirationEpoch(89) - m.SetSplitID([]byte{3, 2, 1}) + m.SetSplitID(id) m.SetMembers(refstest.GenerateObjectIDs(false)) } From c11f50efeccbc68d9c12e9688e739a4f3bc4f301 Mon Sep 17 00:00:00 2001 From: Aleksey Savchuk Date: Mon, 2 Sep 2024 13:39:07 +0300 Subject: [PATCH 1175/1196] [#112] container: Remove GetExtendedACL Signed-off-by: Aleksey Savchuk --- container/convert.go | 174 ------ container/grpc/service_frostfs.pb.go | 779 ------------------------- container/grpc/service_frostfs_fuzz.go | 38 -- container/grpc/service_frostfs_test.go | 20 - container/grpc/service_grpc.pb.go | 71 +-- container/marshal.go | 68 --- container/message_test.go | 4 - container/test/generate.go | 50 -- container/types.go | 103 ---- rpc/container.go | 16 - signature/body.go | 4 - 11 files changed, 4 insertions(+), 1323 deletions(-) diff --git a/container/convert.go b/container/convert.go index b487f40..ebd4bcc 100644 --- a/container/convert.go +++ b/container/convert.go @@ -1,8 +1,6 @@ package container import ( - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/acl" - aclGRPC "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/acl/grpc" container "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/container/grpc" "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/netmap" netmapGRPC "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/netmap/grpc" @@ -764,175 +762,3 @@ func (r *ListResponse) FromGRPCMessage(m grpc.Message) error { return r.ResponseHeaders.FromMessage(v) } - -func (r *GetExtendedACLRequestBody) ToGRPCMessage() grpc.Message { - var m *container.GetExtendedACLRequest_Body - - if r != nil { - m = new(container.GetExtendedACLRequest_Body) - - m.SetContainerId(r.cid.ToGRPCMessage().(*refsGRPC.ContainerID)) - } - - return m -} - -func (r *GetExtendedACLRequestBody) FromGRPCMessage(m grpc.Message) error { - v, ok := m.(*container.GetExtendedACLRequest_Body) - if !ok { - return message.NewUnexpectedMessageType(m, v) - } - - var err error - - cid := v.GetContainerId() - if cid == nil { - r.cid = nil - } else { - if r.cid == nil { - r.cid = new(refs.ContainerID) - } - - err = r.cid.FromGRPCMessage(cid) - } - - return err -} - -func (r *GetExtendedACLRequest) ToGRPCMessage() grpc.Message { - var m *container.GetExtendedACLRequest - - if r != nil { - m = new(container.GetExtendedACLRequest) - - m.SetBody(r.body.ToGRPCMessage().(*container.GetExtendedACLRequest_Body)) - r.RequestHeaders.ToMessage(m) - } - - return m -} - -func (r *GetExtendedACLRequest) FromGRPCMessage(m grpc.Message) error { - v, ok := m.(*container.GetExtendedACLRequest) - 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(GetExtendedACLRequestBody) - } - - err = r.body.FromGRPCMessage(body) - if err != nil { - return err - } - } - - return r.RequestHeaders.FromMessage(v) -} - -func (r *GetExtendedACLResponseBody) ToGRPCMessage() grpc.Message { - var m *container.GetExtendedACLResponse_Body - - if r != nil { - m = new(container.GetExtendedACLResponse_Body) - - m.SetEacl(r.eacl.ToGRPCMessage().(*aclGRPC.EACLTable)) - m.SetSignature(toSignatureRFC6979(r.sig)) - m.SetSessionToken(r.token.ToGRPCMessage().(*sessionGRPC.SessionToken)) - } - - return m -} - -func (r *GetExtendedACLResponseBody) FromGRPCMessage(m grpc.Message) error { - v, ok := m.(*container.GetExtendedACLResponse_Body) - if !ok { - return message.NewUnexpectedMessageType(m, v) - } - - var err error - - eacl := v.GetEacl() - if eacl == nil { - r.eacl = nil - } else { - if r.eacl == nil { - r.eacl = new(acl.Table) - } - - err = r.eacl.FromGRPCMessage(eacl) - if err != nil { - return err - } - } - - sig := v.GetSignature() - if sig == nil { - r.sig = nil - } else { - if r.sig == nil { - r.sig = new(refs.Signature) - } - - r.sig.SetKey(sig.GetKey()) - r.sig.SetSign(sig.GetSign()) - } - - token := v.GetSessionToken() - if token == nil { - r.token = nil - } else { - if r.token == nil { - r.token = new(session.Token) - } - - err = r.token.FromGRPCMessage(token) - } - - return err -} - -func (r *GetExtendedACLResponse) ToGRPCMessage() grpc.Message { - var m *container.GetExtendedACLResponse - - if r != nil { - m = new(container.GetExtendedACLResponse) - - m.SetBody(r.body.ToGRPCMessage().(*container.GetExtendedACLResponse_Body)) - r.ResponseHeaders.ToMessage(m) - } - - return m -} - -func (r *GetExtendedACLResponse) FromGRPCMessage(m grpc.Message) error { - v, ok := m.(*container.GetExtendedACLResponse) - 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(GetExtendedACLResponseBody) - } - - err = r.body.FromGRPCMessage(body) - if err != nil { - return err - } - } - - return r.ResponseHeaders.FromMessage(v) -} diff --git a/container/grpc/service_frostfs.pb.go b/container/grpc/service_frostfs.pb.go index f38b0de..ffdc730 100644 --- a/container/grpc/service_frostfs.pb.go +++ b/container/grpc/service_frostfs.pb.go @@ -5,7 +5,6 @@ package container import ( json "encoding/json" fmt "fmt" - grpc2 "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/acl/grpc" grpc "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc" grpc1 "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session/grpc" pool "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/pool" @@ -2966,781 +2965,3 @@ func (x *ListResponse) UnmarshalEasyJSON(in *jlexer.Lexer) { in.Consumed() } } - -type GetExtendedACLRequest_Body struct { - ContainerId *grpc.ContainerID `json:"containerId"` -} - -var ( - _ encoding.ProtoMarshaler = (*GetExtendedACLRequest_Body)(nil) - _ encoding.ProtoUnmarshaler = (*GetExtendedACLRequest_Body)(nil) - _ json.Marshaler = (*GetExtendedACLRequest_Body)(nil) - _ json.Unmarshaler = (*GetExtendedACLRequest_Body)(nil) -) - -// StableSize returns the size of x in protobuf format. -// -// Structures with the same field values have the same binary size. -func (x *GetExtendedACLRequest_Body) StableSize() (size int) { - if x == nil { - return 0 - } - size += proto.NestedStructureSize(1, x.ContainerId) - return size -} - -// MarshalProtobuf implements the encoding.ProtoMarshaler interface. -func (x *GetExtendedACLRequest_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 *GetExtendedACLRequest_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) { - if x == nil { - return - } - if x.ContainerId != nil { - x.ContainerId.EmitProtobuf(mm.AppendMessage(1)) - } -} - -// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. -func (x *GetExtendedACLRequest_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", "GetExtendedACLRequest_Body") - } - switch fc.FieldNum { - case 1: // ContainerId - data, ok := fc.MessageData() - if !ok { - return fmt.Errorf("cannot unmarshal field %s", "ContainerId") - } - x.ContainerId = new(grpc.ContainerID) - if err := x.ContainerId.UnmarshalProtobuf(data); err != nil { - return fmt.Errorf("unmarshal: %w", err) - } - } - } - return nil -} -func (x *GetExtendedACLRequest_Body) GetContainerId() *grpc.ContainerID { - if x != nil { - return x.ContainerId - } - return nil -} -func (x *GetExtendedACLRequest_Body) SetContainerId(v *grpc.ContainerID) { - x.ContainerId = v -} - -// MarshalJSON implements the json.Marshaler interface. -func (x *GetExtendedACLRequest_Body) MarshalJSON() ([]byte, error) { - w := jwriter.Writer{} - x.MarshalEasyJSON(&w) - return w.Buffer.BuildBytes(), w.Error -} -func (x *GetExtendedACLRequest_Body) MarshalEasyJSON(out *jwriter.Writer) { - if x == nil { - out.RawString("null") - return - } - out.RawByte('{') - { - const prefix string = ",\"containerId\":" - out.RawString(prefix[1:]) - x.ContainerId.MarshalEasyJSON(out) - } - out.RawByte('}') -} - -// UnmarshalJSON implements the json.Unmarshaler interface. -func (x *GetExtendedACLRequest_Body) UnmarshalJSON(data []byte) error { - r := jlexer.Lexer{Data: data} - x.UnmarshalEasyJSON(&r) - return r.Error() -} -func (x *GetExtendedACLRequest_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 "containerId": - { - var f *grpc.ContainerID - f = new(grpc.ContainerID) - f.UnmarshalEasyJSON(in) - x.ContainerId = f - } - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} - -type GetExtendedACLRequest struct { - Body *GetExtendedACLRequest_Body `json:"body"` - MetaHeader *grpc1.RequestMetaHeader `json:"metaHeader"` - VerifyHeader *grpc1.RequestVerificationHeader `json:"verifyHeader"` -} - -var ( - _ encoding.ProtoMarshaler = (*GetExtendedACLRequest)(nil) - _ encoding.ProtoUnmarshaler = (*GetExtendedACLRequest)(nil) - _ json.Marshaler = (*GetExtendedACLRequest)(nil) - _ json.Unmarshaler = (*GetExtendedACLRequest)(nil) -) - -// StableSize returns the size of x in protobuf format. -// -// Structures with the same field values have the same binary size. -func (x *GetExtendedACLRequest) 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 *GetExtendedACLRequest) 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 *GetExtendedACLRequest) ReadSignedData(buf []byte) ([]byte, error) { - return x.GetBody().MarshalProtobuf(buf), nil -} - -// MarshalProtobuf implements the encoding.ProtoMarshaler interface. -func (x *GetExtendedACLRequest) 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 *GetExtendedACLRequest) 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 *GetExtendedACLRequest) 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", "GetExtendedACLRequest") - } - switch fc.FieldNum { - case 1: // Body - data, ok := fc.MessageData() - if !ok { - return fmt.Errorf("cannot unmarshal field %s", "Body") - } - x.Body = new(GetExtendedACLRequest_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 *GetExtendedACLRequest) GetBody() *GetExtendedACLRequest_Body { - if x != nil { - return x.Body - } - return nil -} -func (x *GetExtendedACLRequest) SetBody(v *GetExtendedACLRequest_Body) { - x.Body = v -} -func (x *GetExtendedACLRequest) GetMetaHeader() *grpc1.RequestMetaHeader { - if x != nil { - return x.MetaHeader - } - return nil -} -func (x *GetExtendedACLRequest) SetMetaHeader(v *grpc1.RequestMetaHeader) { - x.MetaHeader = v -} -func (x *GetExtendedACLRequest) GetVerifyHeader() *grpc1.RequestVerificationHeader { - if x != nil { - return x.VerifyHeader - } - return nil -} -func (x *GetExtendedACLRequest) SetVerifyHeader(v *grpc1.RequestVerificationHeader) { - x.VerifyHeader = v -} - -// MarshalJSON implements the json.Marshaler interface. -func (x *GetExtendedACLRequest) MarshalJSON() ([]byte, error) { - w := jwriter.Writer{} - x.MarshalEasyJSON(&w) - return w.Buffer.BuildBytes(), w.Error -} -func (x *GetExtendedACLRequest) MarshalEasyJSON(out *jwriter.Writer) { - if x == nil { - out.RawString("null") - return - } - out.RawByte('{') - { - const prefix string = ",\"body\":" - out.RawString(prefix[1:]) - x.Body.MarshalEasyJSON(out) - } - { - const prefix string = ",\"metaHeader\":" - out.RawString(prefix) - x.MetaHeader.MarshalEasyJSON(out) - } - { - const prefix string = ",\"verifyHeader\":" - out.RawString(prefix) - x.VerifyHeader.MarshalEasyJSON(out) - } - out.RawByte('}') -} - -// UnmarshalJSON implements the json.Unmarshaler interface. -func (x *GetExtendedACLRequest) UnmarshalJSON(data []byte) error { - r := jlexer.Lexer{Data: data} - x.UnmarshalEasyJSON(&r) - return r.Error() -} -func (x *GetExtendedACLRequest) 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 *GetExtendedACLRequest_Body - f = new(GetExtendedACLRequest_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 GetExtendedACLResponse_Body struct { - Eacl *grpc2.EACLTable `json:"eacl"` - Signature *grpc.SignatureRFC6979 `json:"signature"` - SessionToken *grpc1.SessionToken `json:"sessionToken"` -} - -var ( - _ encoding.ProtoMarshaler = (*GetExtendedACLResponse_Body)(nil) - _ encoding.ProtoUnmarshaler = (*GetExtendedACLResponse_Body)(nil) - _ json.Marshaler = (*GetExtendedACLResponse_Body)(nil) - _ json.Unmarshaler = (*GetExtendedACLResponse_Body)(nil) -) - -// StableSize returns the size of x in protobuf format. -// -// Structures with the same field values have the same binary size. -func (x *GetExtendedACLResponse_Body) StableSize() (size int) { - if x == nil { - return 0 - } - size += proto.NestedStructureSize(1, x.Eacl) - size += proto.NestedStructureSize(2, x.Signature) - size += proto.NestedStructureSize(3, x.SessionToken) - return size -} - -// MarshalProtobuf implements the encoding.ProtoMarshaler interface. -func (x *GetExtendedACLResponse_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 *GetExtendedACLResponse_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) { - if x == nil { - return - } - if x.Eacl != nil { - x.Eacl.EmitProtobuf(mm.AppendMessage(1)) - } - if x.Signature != nil { - x.Signature.EmitProtobuf(mm.AppendMessage(2)) - } - if x.SessionToken != nil { - x.SessionToken.EmitProtobuf(mm.AppendMessage(3)) - } -} - -// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. -func (x *GetExtendedACLResponse_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", "GetExtendedACLResponse_Body") - } - switch fc.FieldNum { - case 1: // Eacl - data, ok := fc.MessageData() - if !ok { - return fmt.Errorf("cannot unmarshal field %s", "Eacl") - } - x.Eacl = new(grpc2.EACLTable) - if err := x.Eacl.UnmarshalProtobuf(data); err != nil { - return fmt.Errorf("unmarshal: %w", err) - } - case 2: // Signature - data, ok := fc.MessageData() - if !ok { - return fmt.Errorf("cannot unmarshal field %s", "Signature") - } - x.Signature = new(grpc.SignatureRFC6979) - if err := x.Signature.UnmarshalProtobuf(data); err != nil { - return fmt.Errorf("unmarshal: %w", err) - } - case 3: // SessionToken - data, ok := fc.MessageData() - if !ok { - return fmt.Errorf("cannot unmarshal field %s", "SessionToken") - } - x.SessionToken = new(grpc1.SessionToken) - if err := x.SessionToken.UnmarshalProtobuf(data); err != nil { - return fmt.Errorf("unmarshal: %w", err) - } - } - } - return nil -} -func (x *GetExtendedACLResponse_Body) GetEacl() *grpc2.EACLTable { - if x != nil { - return x.Eacl - } - return nil -} -func (x *GetExtendedACLResponse_Body) SetEacl(v *grpc2.EACLTable) { - x.Eacl = v -} -func (x *GetExtendedACLResponse_Body) GetSignature() *grpc.SignatureRFC6979 { - if x != nil { - return x.Signature - } - return nil -} -func (x *GetExtendedACLResponse_Body) SetSignature(v *grpc.SignatureRFC6979) { - x.Signature = v -} -func (x *GetExtendedACLResponse_Body) GetSessionToken() *grpc1.SessionToken { - if x != nil { - return x.SessionToken - } - return nil -} -func (x *GetExtendedACLResponse_Body) SetSessionToken(v *grpc1.SessionToken) { - x.SessionToken = v -} - -// MarshalJSON implements the json.Marshaler interface. -func (x *GetExtendedACLResponse_Body) MarshalJSON() ([]byte, error) { - w := jwriter.Writer{} - x.MarshalEasyJSON(&w) - return w.Buffer.BuildBytes(), w.Error -} -func (x *GetExtendedACLResponse_Body) MarshalEasyJSON(out *jwriter.Writer) { - if x == nil { - out.RawString("null") - return - } - out.RawByte('{') - { - const prefix string = ",\"eacl\":" - out.RawString(prefix[1:]) - x.Eacl.MarshalEasyJSON(out) - } - { - const prefix string = ",\"signature\":" - out.RawString(prefix) - x.Signature.MarshalEasyJSON(out) - } - { - const prefix string = ",\"sessionToken\":" - out.RawString(prefix) - x.SessionToken.MarshalEasyJSON(out) - } - out.RawByte('}') -} - -// UnmarshalJSON implements the json.Unmarshaler interface. -func (x *GetExtendedACLResponse_Body) UnmarshalJSON(data []byte) error { - r := jlexer.Lexer{Data: data} - x.UnmarshalEasyJSON(&r) - return r.Error() -} -func (x *GetExtendedACLResponse_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 "eacl": - { - var f *grpc2.EACLTable - f = new(grpc2.EACLTable) - f.UnmarshalEasyJSON(in) - x.Eacl = f - } - case "signature": - { - var f *grpc.SignatureRFC6979 - f = new(grpc.SignatureRFC6979) - f.UnmarshalEasyJSON(in) - x.Signature = f - } - case "sessionToken": - { - var f *grpc1.SessionToken - f = new(grpc1.SessionToken) - f.UnmarshalEasyJSON(in) - x.SessionToken = f - } - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} - -type GetExtendedACLResponse struct { - Body *GetExtendedACLResponse_Body `json:"body"` - MetaHeader *grpc1.ResponseMetaHeader `json:"metaHeader"` - VerifyHeader *grpc1.ResponseVerificationHeader `json:"verifyHeader"` -} - -var ( - _ encoding.ProtoMarshaler = (*GetExtendedACLResponse)(nil) - _ encoding.ProtoUnmarshaler = (*GetExtendedACLResponse)(nil) - _ json.Marshaler = (*GetExtendedACLResponse)(nil) - _ json.Unmarshaler = (*GetExtendedACLResponse)(nil) -) - -// StableSize returns the size of x in protobuf format. -// -// Structures with the same field values have the same binary size. -func (x *GetExtendedACLResponse) 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 *GetExtendedACLResponse) 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 *GetExtendedACLResponse) ReadSignedData(buf []byte) ([]byte, error) { - return x.GetBody().MarshalProtobuf(buf), nil -} - -// MarshalProtobuf implements the encoding.ProtoMarshaler interface. -func (x *GetExtendedACLResponse) 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 *GetExtendedACLResponse) 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 *GetExtendedACLResponse) 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", "GetExtendedACLResponse") - } - switch fc.FieldNum { - case 1: // Body - data, ok := fc.MessageData() - if !ok { - return fmt.Errorf("cannot unmarshal field %s", "Body") - } - x.Body = new(GetExtendedACLResponse_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 *GetExtendedACLResponse) GetBody() *GetExtendedACLResponse_Body { - if x != nil { - return x.Body - } - return nil -} -func (x *GetExtendedACLResponse) SetBody(v *GetExtendedACLResponse_Body) { - x.Body = v -} -func (x *GetExtendedACLResponse) GetMetaHeader() *grpc1.ResponseMetaHeader { - if x != nil { - return x.MetaHeader - } - return nil -} -func (x *GetExtendedACLResponse) SetMetaHeader(v *grpc1.ResponseMetaHeader) { - x.MetaHeader = v -} -func (x *GetExtendedACLResponse) GetVerifyHeader() *grpc1.ResponseVerificationHeader { - if x != nil { - return x.VerifyHeader - } - return nil -} -func (x *GetExtendedACLResponse) SetVerifyHeader(v *grpc1.ResponseVerificationHeader) { - x.VerifyHeader = v -} - -// MarshalJSON implements the json.Marshaler interface. -func (x *GetExtendedACLResponse) MarshalJSON() ([]byte, error) { - w := jwriter.Writer{} - x.MarshalEasyJSON(&w) - return w.Buffer.BuildBytes(), w.Error -} -func (x *GetExtendedACLResponse) MarshalEasyJSON(out *jwriter.Writer) { - if x == nil { - out.RawString("null") - return - } - out.RawByte('{') - { - const prefix string = ",\"body\":" - out.RawString(prefix[1:]) - x.Body.MarshalEasyJSON(out) - } - { - const prefix string = ",\"metaHeader\":" - out.RawString(prefix) - x.MetaHeader.MarshalEasyJSON(out) - } - { - const prefix string = ",\"verifyHeader\":" - out.RawString(prefix) - x.VerifyHeader.MarshalEasyJSON(out) - } - out.RawByte('}') -} - -// UnmarshalJSON implements the json.Unmarshaler interface. -func (x *GetExtendedACLResponse) UnmarshalJSON(data []byte) error { - r := jlexer.Lexer{Data: data} - x.UnmarshalEasyJSON(&r) - return r.Error() -} -func (x *GetExtendedACLResponse) 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 *GetExtendedACLResponse_Body - f = new(GetExtendedACLResponse_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() - } -} diff --git a/container/grpc/service_frostfs_fuzz.go b/container/grpc/service_frostfs_fuzz.go index 496a2d6..7e6d6e6 100644 --- a/container/grpc/service_frostfs_fuzz.go +++ b/container/grpc/service_frostfs_fuzz.go @@ -157,41 +157,3 @@ func DoFuzzJSONListResponse(data []byte) int { } return 1 } -func DoFuzzProtoGetExtendedACLRequest(data []byte) int { - msg := new(GetExtendedACLRequest) - if err := msg.UnmarshalProtobuf(data); err != nil { - return 0 - } - _ = msg.MarshalProtobuf(nil) - return 1 -} -func DoFuzzJSONGetExtendedACLRequest(data []byte) int { - msg := new(GetExtendedACLRequest) - if err := msg.UnmarshalJSON(data); err != nil { - return 0 - } - _, err := msg.MarshalJSON() - if err != nil { - panic(err) - } - return 1 -} -func DoFuzzProtoGetExtendedACLResponse(data []byte) int { - msg := new(GetExtendedACLResponse) - if err := msg.UnmarshalProtobuf(data); err != nil { - return 0 - } - _ = msg.MarshalProtobuf(nil) - return 1 -} -func DoFuzzJSONGetExtendedACLResponse(data []byte) int { - msg := new(GetExtendedACLResponse) - if err := msg.UnmarshalJSON(data); err != nil { - return 0 - } - _, err := msg.MarshalJSON() - if err != nil { - panic(err) - } - return 1 -} diff --git a/container/grpc/service_frostfs_test.go b/container/grpc/service_frostfs_test.go index 05eb48a..804b89c 100644 --- a/container/grpc/service_frostfs_test.go +++ b/container/grpc/service_frostfs_test.go @@ -89,23 +89,3 @@ func FuzzJSONListResponse(f *testing.F) { DoFuzzJSONListResponse(data) }) } -func FuzzProtoGetExtendedACLRequest(f *testing.F) { - f.Fuzz(func(t *testing.T, data []byte) { - DoFuzzProtoGetExtendedACLRequest(data) - }) -} -func FuzzJSONGetExtendedACLRequest(f *testing.F) { - f.Fuzz(func(t *testing.T, data []byte) { - DoFuzzJSONGetExtendedACLRequest(data) - }) -} -func FuzzProtoGetExtendedACLResponse(f *testing.F) { - f.Fuzz(func(t *testing.T, data []byte) { - DoFuzzProtoGetExtendedACLResponse(data) - }) -} -func FuzzJSONGetExtendedACLResponse(f *testing.F) { - f.Fuzz(func(t *testing.T, data []byte) { - DoFuzzJSONGetExtendedACLResponse(data) - }) -} diff --git a/container/grpc/service_grpc.pb.go b/container/grpc/service_grpc.pb.go index 939a978..abb0fef 100644 --- a/container/grpc/service_grpc.pb.go +++ b/container/grpc/service_grpc.pb.go @@ -19,11 +19,10 @@ import ( 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_GetExtendedACL_FullMethodName = "/neo.fs.v2.container.ContainerService/GetExtendedACL" + 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. @@ -74,20 +73,6 @@ type ContainerServiceClient interface { // - **CONTAINER_ACCESS_DENIED** (3074, SECTION_CONTAINER): \ // container list access denied. List(ctx context.Context, in *ListRequest, opts ...grpc.CallOption) (*ListResponse, error) - // Returns Extended ACL table and signature from `Container` smart contract - // storage. - // - // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // container eACL has been successfully read; - // - Common failures (SECTION_FAILURE_COMMON); - // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ - // container not found; - // - **EACL_NOT_FOUND** (3073, SECTION_CONTAINER): \ - // eACL table not found; - // - **CONTAINER_ACCESS_DENIED** (3074, SECTION_CONTAINER): \ - // access to container eACL is denied. - GetExtendedACL(ctx context.Context, in *GetExtendedACLRequest, opts ...grpc.CallOption) (*GetExtendedACLResponse, error) } type containerServiceClient struct { @@ -134,15 +119,6 @@ func (c *containerServiceClient) List(ctx context.Context, in *ListRequest, opts return out, nil } -func (c *containerServiceClient) GetExtendedACL(ctx context.Context, in *GetExtendedACLRequest, opts ...grpc.CallOption) (*GetExtendedACLResponse, error) { - out := new(GetExtendedACLResponse) - err := c.cc.Invoke(ctx, ContainerService_GetExtendedACL_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - // ContainerServiceServer is the server API for ContainerService service. // All implementations should embed UnimplementedContainerServiceServer // for forward compatibility @@ -191,20 +167,6 @@ type ContainerServiceServer interface { // - **CONTAINER_ACCESS_DENIED** (3074, SECTION_CONTAINER): \ // container list access denied. List(context.Context, *ListRequest) (*ListResponse, error) - // Returns Extended ACL table and signature from `Container` smart contract - // storage. - // - // Statuses: - // - **OK** (0, SECTION_SUCCESS): \ - // container eACL has been successfully read; - // - Common failures (SECTION_FAILURE_COMMON); - // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ - // container not found; - // - **EACL_NOT_FOUND** (3073, SECTION_CONTAINER): \ - // eACL table not found; - // - **CONTAINER_ACCESS_DENIED** (3074, SECTION_CONTAINER): \ - // access to container eACL is denied. - GetExtendedACL(context.Context, *GetExtendedACLRequest) (*GetExtendedACLResponse, error) } // UnimplementedContainerServiceServer should be embedded to have forward compatible implementations. @@ -223,9 +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) GetExtendedACL(context.Context, *GetExtendedACLRequest) (*GetExtendedACLResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetExtendedACL not implemented") -} // 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 @@ -310,24 +269,6 @@ func _ContainerService_List_Handler(srv interface{}, ctx context.Context, dec fu return interceptor(ctx, in, info, handler) } -func _ContainerService_GetExtendedACL_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetExtendedACLRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ContainerServiceServer).GetExtendedACL(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: ContainerService_GetExtendedACL_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ContainerServiceServer).GetExtendedACL(ctx, req.(*GetExtendedACLRequest)) - } - return interceptor(ctx, in, info, handler) -} - // 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) @@ -351,10 +292,6 @@ var ContainerService_ServiceDesc = grpc.ServiceDesc{ MethodName: "List", Handler: _ContainerService_List_Handler, }, - { - MethodName: "GetExtendedACL", - Handler: _ContainerService_GetExtendedACL_Handler, - }, }, Streams: []grpc.StreamDesc{}, Metadata: "container/grpc/service.proto", diff --git a/container/marshal.go b/container/marshal.go index ff17150..7c9b8ef 100644 --- a/container/marshal.go +++ b/container/marshal.go @@ -34,12 +34,6 @@ const ( listReqBodyOwnerField = 1 listRespBodyIDsField = 1 - - getEACLReqBodyIDField = 1 - - getEACLRespBodyTableField = 1 - getEACLRespBodySignatureField = 2 - getEACLRespBodyTokenField = 3 ) func (a *Attribute) StableMarshal(buf []byte) []byte { @@ -349,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 *GetExtendedACLRequestBody) StableMarshal(buf []byte) []byte { - if r == nil { - return []byte{} - } - - if buf == nil { - buf = make([]byte, r.StableSize()) - } - - protoutil.NestedStructureMarshal(getEACLReqBodyIDField, buf, r.cid) - - return buf -} - -func (r *GetExtendedACLRequestBody) StableSize() (size int) { - if r == nil { - return 0 - } - - size += protoutil.NestedStructureSize(getEACLReqBodyIDField, r.cid) - - return size -} - -func (r *GetExtendedACLRequestBody) Unmarshal(data []byte) error { - return message.Unmarshal(r, data, new(container.GetExtendedACLRequest_Body)) -} - -func (r *GetExtendedACLResponseBody) StableMarshal(buf []byte) []byte { - if r == nil { - return []byte{} - } - - if buf == nil { - buf = make([]byte, r.StableSize()) - } - - var offset int - - offset += protoutil.NestedStructureMarshal(getEACLRespBodyTableField, buf[offset:], r.eacl) - offset += protoutil.NestedStructureMarshal(getEACLRespBodySignatureField, buf[offset:], r.sig) - protoutil.NestedStructureMarshal(getEACLRespBodyTokenField, buf[offset:], r.token) - - return buf -} - -func (r *GetExtendedACLResponseBody) StableSize() (size int) { - if r == nil { - return 0 - } - - size += protoutil.NestedStructureSize(getEACLRespBodyTableField, r.eacl) - size += protoutil.NestedStructureSize(getEACLRespBodySignatureField, r.sig) - size += protoutil.NestedStructureSize(getEACLRespBodyTokenField, r.token) - - return size -} - -func (r *GetExtendedACLResponseBody) Unmarshal(data []byte) error { - return message.Unmarshal(r, data, new(container.GetExtendedACLResponse_Body)) -} diff --git a/container/message_test.go b/container/message_test.go index 6558e25..da99331 100644 --- a/container/message_test.go +++ b/container/message_test.go @@ -32,9 +32,5 @@ func TestMessageConvert(t *testing.T) { func(empty bool) message.Message { return containertest.GenerateGetRequest(empty) }, func(empty bool) message.Message { return containertest.GenerateGetResponseBody(empty) }, func(empty bool) message.Message { return containertest.GenerateGetResponse(empty) }, - func(empty bool) message.Message { return containertest.GenerateGetExtendedACLRequestBody(empty) }, - func(empty bool) message.Message { return containertest.GenerateGetExtendedACLRequest(empty) }, - func(empty bool) message.Message { return containertest.GenerateGetExtendedACLResponseBody(empty) }, - func(empty bool) message.Message { return containertest.GenerateGetExtendedACLResponse(empty) }, ) } diff --git a/container/test/generate.go b/container/test/generate.go index 23ad3a1..fb5c9e6 100644 --- a/container/test/generate.go +++ b/container/test/generate.go @@ -3,7 +3,6 @@ package containertest import ( "crypto/rand" - acltest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/acl/test" "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/container" netmaptest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/netmap/test" refstest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/test" @@ -239,52 +238,3 @@ func GenerateListResponse(empty bool) *container.ListResponse { return m } - -func GenerateGetExtendedACLRequestBody(empty bool) *container.GetExtendedACLRequestBody { - m := new(container.GetExtendedACLRequestBody) - - if !empty { - m.SetContainerID(refstest.GenerateContainerID(false)) - } - - return m -} - -func GenerateGetExtendedACLRequest(empty bool) *container.GetExtendedACLRequest { - m := new(container.GetExtendedACLRequest) - - if !empty { - m.SetBody(GenerateGetExtendedACLRequestBody(false)) - } - - m.SetMetaHeader(sessiontest.GenerateRequestMetaHeader(empty)) - m.SetVerificationHeader(sessiontest.GenerateRequestVerificationHeader(empty)) - - return m -} - -func GenerateGetExtendedACLResponseBody(empty bool) *container.GetExtendedACLResponseBody { - m := new(container.GetExtendedACLResponseBody) - - if !empty { - m.SetEACL(acltest.GenerateTable(false)) - } - - m.SetSignature(refstest.GenerateSignature(empty)) - m.SetSessionToken(sessiontest.GenerateSessionToken(empty)) - - return m -} - -func GenerateGetExtendedACLResponse(empty bool) *container.GetExtendedACLResponse { - m := new(container.GetExtendedACLResponse) - - if !empty { - m.SetBody(GenerateGetExtendedACLResponseBody(false)) - } - - m.SetMetaHeader(sessiontest.GenerateResponseMetaHeader(empty)) - m.SetVerificationHeader(sessiontest.GenerateResponseVerificationHeader(empty)) - - return m -} diff --git a/container/types.go b/container/types.go index 3a9e915..6adc57b 100644 --- a/container/types.go +++ b/container/types.go @@ -1,7 +1,6 @@ package container import ( - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/acl" "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/netmap" "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session" @@ -110,30 +109,6 @@ type ListResponse struct { session.ResponseHeaders } -type GetExtendedACLRequestBody struct { - cid *refs.ContainerID -} - -type GetExtendedACLRequest struct { - body *GetExtendedACLRequestBody - - session.RequestHeaders -} - -type GetExtendedACLResponseBody struct { - eacl *acl.Table - - sig *refs.Signature - - token *session.Token -} - -type GetExtendedACLResponse struct { - body *GetExtendedACLResponseBody - - session.ResponseHeaders -} - func (a *Attribute) GetKey() string { if a != nil { return a.key @@ -469,81 +444,3 @@ func (r *ListResponse) GetBody() *ListResponseBody { func (r *ListResponse) SetBody(v *ListResponseBody) { r.body = v } - -func (r *GetExtendedACLRequestBody) GetContainerID() *refs.ContainerID { - if r != nil { - return r.cid - } - - return nil -} - -func (r *GetExtendedACLRequestBody) SetContainerID(v *refs.ContainerID) { - r.cid = v -} - -func (r *GetExtendedACLRequest) GetBody() *GetExtendedACLRequestBody { - if r != nil { - return r.body - } - - return nil -} - -func (r *GetExtendedACLRequest) SetBody(v *GetExtendedACLRequestBody) { - r.body = v -} - -func (r *GetExtendedACLResponseBody) GetEACL() *acl.Table { - if r != nil { - return r.eacl - } - - return nil -} - -func (r *GetExtendedACLResponseBody) SetEACL(v *acl.Table) { - r.eacl = v -} - -func (r *GetExtendedACLResponseBody) GetSignature() *refs.Signature { - if r != nil { - return r.sig - } - - return nil -} - -func (r *GetExtendedACLResponseBody) SetSignature(v *refs.Signature) { - // TODO: (neofs-api-go#381) avoid this hack (e.g. create refs.SignatureRFC6979 type) - v.SetScheme(0) - r.sig = v -} - -// GetSessionToken returns token of the session within which requested -// eACL table was set. -func (r *GetExtendedACLResponseBody) GetSessionToken() *session.Token { - if r != nil { - return r.token - } - - return nil -} - -// SetSessionToken sets token of the session within which requested -// eACL table was set. -func (r *GetExtendedACLResponseBody) SetSessionToken(v *session.Token) { - r.token = v -} - -func (r *GetExtendedACLResponse) GetBody() *GetExtendedACLResponseBody { - if r != nil { - return r.body - } - - return nil -} - -func (r *GetExtendedACLResponse) SetBody(v *GetExtendedACLResponseBody) { - r.body = v -} diff --git a/rpc/container.go b/rpc/container.go index 39213f6..b1d4a68 100644 --- a/rpc/container.go +++ b/rpc/container.go @@ -80,19 +80,3 @@ func ListContainers( return resp, nil } - -// GetEACL executes ContainerService.GetExtendedACL RPC. -func GetEACL( - cli *client.Client, - req *container.GetExtendedACLRequest, - opts ...client.CallOption, -) (*container.GetExtendedACLResponse, error) { - resp := new(container.GetExtendedACLResponse) - - err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceContainer, rpcContainerGetEACL), req, resp, opts...) - if err != nil { - return nil, err - } - - return resp, nil -} diff --git a/signature/body.go b/signature/body.go index 4b43b84..b1a5904 100644 --- a/signature/body.go +++ b/signature/body.go @@ -46,10 +46,6 @@ func serviceMessageBody(req any) stableMarshaler { return v.GetBody() case *container.ListResponse: return v.GetBody() - case *container.GetExtendedACLRequest: - return v.GetBody() - case *container.GetExtendedACLResponse: - return v.GetBody() /* Object */ case *object.PutRequest: From 7d71556eee2d8a1b3efc3e3e0083a5edb1dda798 Mon Sep 17 00:00:00 2001 From: Ekaterina Lebedeva Date: Wed, 4 Sep 2024 12:45:32 +0300 Subject: [PATCH 1176/1196] [#113] pre-commit: Update golangci-lint to v1.60.3 Signed-off-by: Ekaterina Lebedeva --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a64cbaa..d20db47 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -37,6 +37,6 @@ repos: language: system - repo: https://github.com/golangci/golangci-lint - rev: v1.56.2 + rev: v1.60.3 hooks: - id: golangci-lint From bd588fa2e5d1c2d398f1f602692b867dcca154a1 Mon Sep 17 00:00:00 2001 From: Ekaterina Lebedeva Date: Wed, 4 Sep 2024 15:44:59 +0300 Subject: [PATCH 1177/1196] [#113] go.mod: Use range over int Since Go 1.22 a `for` statement with a `range` clause is able to iterate through integer values from zero to an upper limit. gopatch script: @@ var i, e expression @@ -for i := 0; i <= e - 1; i++ { +for i := range e { ... } @@ var i, e expression @@ -for i := 0; i <= e; i++ { +for i := range e + 1 { ... } @@ var i, e expression @@ -for i := 0; i < e; i++ { +for i := range e { ... } Signed-off-by: Ekaterina Lebedeva --- acl/bench_test.go | 4 ++-- netmap/convert.go | 4 ++-- object/bench_test.go | 4 ++-- refs/bench_test.go | 6 +++--- signature/sign_test.go | 4 ++-- status/convert.go | 4 ++-- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/acl/bench_test.go b/acl/bench_test.go index 8d6352b..85dbf7d 100644 --- a/acl/bench_test.go +++ b/acl/bench_test.go @@ -32,7 +32,7 @@ func BenchmarkTable_ToGRPCMessage(b *testing.B) { b.Run("to grpc message", func(b *testing.B) { b.ReportAllocs() - for i := 0; i < b.N; i++ { + for range b.N { raw := tb.ToGRPCMessage() if len(tb.GetRecords()) != len(raw.(*aclGrpc.EACLTable).Records) { b.FailNow() @@ -41,7 +41,7 @@ func BenchmarkTable_ToGRPCMessage(b *testing.B) { }) b.Run("from grpc message", func(b *testing.B) { b.ReportAllocs() - for i := 0; i < b.N; i++ { + for range b.N { tb := new(acl.Table) if tb.FromGRPCMessage(raw) != nil { b.FailNow() diff --git a/netmap/convert.go b/netmap/convert.go index 659b798..bae309f 100644 --- a/netmap/convert.go +++ b/netmap/convert.go @@ -525,7 +525,7 @@ func (x *NetworkConfig) ToGRPCMessage() grpc.Message { if ln := len(x.ps); ln > 0 { ps = make([]netmap.NetworkConfig_Parameter, 0, ln) - for i := 0; i < ln; i++ { + for i := range ln { ps = append(ps, *x.ps[i].ToGRPCMessage().(*netmap.NetworkConfig_Parameter)) } } @@ -552,7 +552,7 @@ func (x *NetworkConfig) FromGRPCMessage(m grpc.Message) error { ps = make([]NetworkParameter, ln) - for i := 0; i < ln; i++ { + for i := range ln { if err := ps[i].FromGRPCMessage(&psV2[i]); err != nil { return err } diff --git a/object/bench_test.go b/object/bench_test.go index 90fab73..b29b1d1 100644 --- a/object/bench_test.go +++ b/object/bench_test.go @@ -26,7 +26,7 @@ func BenchmarkAttributesMarshal(b *testing.B) { b.Run("marshal", func(b *testing.B) { b.ReportAllocs() - for i := 0; i < b.N; i++ { + for range b.N { res := AttributesToGRPC(attrs) if len(res) != len(raw) { b.FailNow() @@ -35,7 +35,7 @@ func BenchmarkAttributesMarshal(b *testing.B) { }) b.Run("unmarshal", func(b *testing.B) { b.ReportAllocs() - for i := 0; i < b.N; i++ { + for range b.N { res, err := AttributesFromGRPC(raw) if err != nil || len(res) != len(raw) { b.FailNow() diff --git a/refs/bench_test.go b/refs/bench_test.go index b24e674..40784c6 100644 --- a/refs/bench_test.go +++ b/refs/bench_test.go @@ -24,7 +24,7 @@ func benchmarkObjectIDSlice(b *testing.B, size int) { b.Run("to grpc message", func(b *testing.B) { b.ReportAllocs() - for i := 0; i < b.N; i++ { + for range b.N { raw := ObjectIDListToGRPCMessage(ids) if len(raw) != len(ids) { b.FailNow() @@ -33,7 +33,7 @@ func benchmarkObjectIDSlice(b *testing.B, size int) { }) b.Run("from grpc message", func(b *testing.B) { b.ReportAllocs() - for i := 0; i < b.N; i++ { + for range b.N { ids, err := ObjectIDListFromGRPCMessage(raw) if err != nil || len(raw) != len(ids) { b.FailNow() @@ -42,7 +42,7 @@ func benchmarkObjectIDSlice(b *testing.B, size int) { }) b.Run("marshal", func(b *testing.B) { b.ReportAllocs() - for i := 0; i < b.N; i++ { + for range b.N { buf := make([]byte, ObjectIDNestedListSize(1, ids)) n := ObjectIDNestedListMarshal(1, buf, ids) if n != len(buf) { diff --git a/signature/sign_test.go b/signature/sign_test.go index c013525..b606c27 100644 --- a/signature/sign_test.go +++ b/signature/sign_test.go @@ -77,7 +77,7 @@ func BenchmarkSignRequest(b *testing.B) { b.ResetTimer() b.ReportAllocs() - for i := 0; i < b.N; i++ { + for range b.N { b.StopTimer() dec := new(accounting.Decimal) dec.SetValue(100) @@ -103,7 +103,7 @@ func BenchmarkVerifyRequest(b *testing.B) { b.ResetTimer() b.ReportAllocs() - for i := 0; i < b.N; i++ { + for range b.N { b.StopTimer() dec := new(accounting.Decimal) dec.SetValue(100) diff --git a/status/convert.go b/status/convert.go index 3c5b5bf..6b34084 100644 --- a/status/convert.go +++ b/status/convert.go @@ -53,7 +53,7 @@ func (x *Status) ToGRPCMessage() grpc.Message { if ln := len(x.details); ln > 0 { ds = make([]status.Status_Detail, 0, ln) - for i := 0; i < ln; i++ { + for i := range ln { ds = append(ds, *x.details[i].ToGRPCMessage().(*status.Status_Detail)) } } @@ -80,7 +80,7 @@ func (x *Status) FromGRPCMessage(m grpc.Message) error { ds = make([]Detail, ln) - for i := 0; i < ln; i++ { + for i := range ln { if err := ds[i].FromGRPCMessage(&dsV2[i]); err != nil { return err } From 9c0007fb1d787b42d00e40ead6fb67f1c12128b4 Mon Sep 17 00:00:00 2001 From: Airat Arifullin Date: Fri, 6 Sep 2024 11:39:23 +0300 Subject: [PATCH 1178/1196] [#115] apemanager: Fix type getters * Add type instance check for nil to avoid panic by accessing fields. Signed-off-by: Airat Arifullin --- acl/types.go | 8 +++++++ ape/types.go | 8 +++++++ apemanager/types.go | 52 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 68 insertions(+) diff --git a/acl/types.go b/acl/types.go index b42528b..960d8c9 100644 --- a/acl/types.go +++ b/acl/types.go @@ -330,10 +330,18 @@ func (bt *BearerTokenBody) SetEACL(v *Table) { } func (t *APEOverride) GetTarget() *ape.ChainTarget { + if t == nil { + return nil + } + return t.target } func (t *APEOverride) GetChains() []*ape.Chain { + if t == nil { + return nil + } + return t.chains } diff --git a/ape/types.go b/ape/types.go index 935a5ea..467a441 100644 --- a/ape/types.go +++ b/ape/types.go @@ -53,6 +53,10 @@ func (c *Chain) SetKind(kind chainKind) { } func (c *Chain) GetKind() chainKind { + if c == nil { + return nil + } + return c.kind } @@ -67,5 +71,9 @@ func (c *ChainRaw) SetRaw(raw []byte) { } func (c *ChainRaw) GetRaw() []byte { + if c == nil { + return nil + } + return c.Raw } diff --git a/apemanager/types.go b/apemanager/types.go index 21edf85..b6c3912 100644 --- a/apemanager/types.go +++ b/apemanager/types.go @@ -16,6 +16,10 @@ func (r *AddChainRequest) SetBody(body *AddChainRequestBody) { } func (r *AddChainRequest) GetBody() *AddChainRequestBody { + if r == nil { + return nil + } + return r.body } @@ -30,6 +34,10 @@ func (rb *AddChainRequestBody) SetTarget(target *ape.ChainTarget) { } func (rb *AddChainRequestBody) GetTarget() *ape.ChainTarget { + if rb == nil { + return nil + } + return rb.target } @@ -38,6 +46,10 @@ func (rb *AddChainRequestBody) SetChain(chain *ape.Chain) { } func (rb *AddChainRequestBody) GetChain() *ape.Chain { + if rb == nil { + return nil + } + return rb.chain } @@ -52,6 +64,10 @@ func (r *AddChainResponse) SetBody(body *AddChainResponseBody) { } func (r *AddChainResponse) GetBody() *AddChainResponseBody { + if r == nil { + return nil + } + return r.body } @@ -64,6 +80,10 @@ func (rb *AddChainResponseBody) SetChainID(chainID []byte) { } func (rb *AddChainResponseBody) GetChainID() []byte { + if rb == nil { + return nil + } + return rb.chainID } @@ -78,6 +98,10 @@ func (r *RemoveChainRequest) SetBody(body *RemoveChainRequestBody) { } func (r *RemoveChainRequest) GetBody() *RemoveChainRequestBody { + if r == nil { + return nil + } + return r.body } @@ -92,6 +116,10 @@ func (rb *RemoveChainRequestBody) SetTarget(target *ape.ChainTarget) { } func (rb *RemoveChainRequestBody) GetTarget() *ape.ChainTarget { + if rb == nil { + return nil + } + return rb.target } @@ -100,6 +128,10 @@ func (rb *RemoveChainRequestBody) SetChainID(chainID []byte) { } func (rb *RemoveChainRequestBody) GetChainID() []byte { + if rb == nil { + return nil + } + return rb.chainID } @@ -116,6 +148,10 @@ func (r *RemoveChainResponse) SetBody(body *RemoveChainResponseBody) { } func (r *RemoveChainResponse) GetBody() *RemoveChainResponseBody { + if r == nil { + return nil + } + return r.body } @@ -130,6 +166,10 @@ func (r *ListChainsRequest) SetBody(body *ListChainsRequestBody) { } func (r *ListChainsRequest) GetBody() *ListChainsRequestBody { + if r == nil { + return nil + } + return r.body } @@ -142,6 +182,10 @@ func (rb *ListChainsRequestBody) SetTarget(target *ape.ChainTarget) { } func (rb *ListChainsRequestBody) GetTarget() *ape.ChainTarget { + if rb == nil { + return nil + } + return rb.target } @@ -156,6 +200,10 @@ func (r *ListChainsResponse) SetBody(body *ListChainsResponseBody) { } func (r *ListChainsResponse) GetBody() *ListChainsResponseBody { + if r == nil { + return nil + } + return r.body } @@ -170,5 +218,9 @@ func (r *ListChainsResponseBody) SetChains(chains []*ape.Chain) { } func (r *ListChainsResponseBody) GetChains() []*ape.Chain { + if r == nil { + return nil + } + return r.chains } From 0484647aaecdc04485f12d80a8ff31123b89fe23 Mon Sep 17 00:00:00 2001 From: Airat Arifullin Date: Fri, 6 Sep 2024 12:13:18 +0300 Subject: [PATCH 1179/1196] [#115] netmap: Fix type getters * Add type instance check for nil to avoid panic by accessing fields. Signed-off-by: Airat Arifullin --- netmap/types.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/netmap/types.go b/netmap/types.go index 1fcdc6e..7821385 100644 --- a/netmap/types.go +++ b/netmap/types.go @@ -335,6 +335,10 @@ func (p *PlacementPolicy) SetContainerBackupFactor(backupFactor uint32) { } func (p *PlacementPolicy) GetReplicas() []Replica { + if p == nil { + return nil + } + return p.replicas } From c49c482ba6601d8c14334e48db70f462f549fe77 Mon Sep 17 00:00:00 2001 From: Vitaliy Potyarkin Date: Wed, 11 Sep 2024 13:05:54 +0300 Subject: [PATCH 1180/1196] [#116] Update obsolete URLs Signed-off-by: Vitaliy Potyarkin --- CHANGELOG.md | 2 +- CONTRIBUTING.md | 10 +++++----- README.md | 14 ++++++-------- 3 files changed, 12 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 77bf5a2..5baefc3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -47,4 +47,4 @@ Initial public release. This project is a fork of [NeoFS](https://github.com/nspcc-dev/neofs-api-go) from version v2.14.0. To see CHANGELOG for older versions, refer to https://github.com/nspcc-dev/neofs-api-go/blob/master/CHANGELOG.md. -[Unreleased]: https://github.com/TrueCloudLab/compare/v2.15.0...master +[Unreleased]: https://git.frostfs.info/TrueCloudLab/frostfs-api-go/compare/v2.16.0...master diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index baa7725..dd360b5 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -3,8 +3,8 @@ First, thank you for contributing! We love and encourage pull requests from everyone. Please follow the guidelines: -- Check the open [issues](https://github.com/TrueCloudLab/frostfs-api-go/issues) and - [pull requests](https://github.com/TrueCloudLab/frostfs-api-go/pulls) for existing +- Check the open [issues](https://git.frostfs.info/TrueCloudLab/frostfs-api-go/issues) and + [pull requests](https://git.frostfs.info/TrueCloudLab/frostfs-api-go/pulls) for existing discussions. - Open an issue first, to discuss a new feature or enhancement. @@ -26,18 +26,18 @@ send a pull request. We encourage pull requests to discuss code changes. Here are the steps in details: ### Set up your GitHub Repository -Fork [FrostFS node upstream](https://github.com/TrueCloudLab/frostfs-api-go/fork) source +Fork [FrostFS node upstream](https://git.frostfs.info/TrueCloudLab/frostfs-api-go/fork) source repository to your own personal repository. Copy the URL of your fork (you will need it for the `git clone` command below). ```sh -$ git clone https://github.com/TrueCloudLab/frostfs-api-go +$ git clone https://git.frostfs.info/TrueCloudLab/frostfs-api-go ``` ### Set up git remote as ``upstream`` ```sh $ cd frostfs-api-go -$ git remote add upstream https://github.com/TrueCloudLab/frostfs-api-go +$ git remote add upstream https://git.frostfs.info/TrueCloudLab/frostfs-api-go $ git fetch upstream $ git merge upstream/master ... diff --git a/README.md b/README.md index 73f06e3..a6e7b6f 100644 --- a/README.md +++ b/README.md @@ -6,22 +6,20 @@

--- -![Tests](https://github.com/TrueCloudLab/frostfs-api-go/workflows/frostfs-api-go%20tests/badge.svg) -[![codecov](https://codecov.io/gh/TrueCloudLab/frostfs-api-go/branch/master/graph/badge.svg)](https://codecov.io/gh/TrueCloudLab/frostfs-api-go) -[![Report](https://goreportcard.com/badge/github.com/TrueCloudLab/frostfs-api-go)](https://goreportcard.com/report/github.com/TrueCloudLab/frostfs-api-go) -[![GitHub release](https://img.shields.io/github/release/TrueCloudLab/frostfs-api-go.svg)](https://github.com/TrueCloudLab/frostfs-api-go) -![GitHub license](https://img.shields.io/github/license/TrueCloudLab/frostfs-api-go.svg?style=popout) +![Tests](https://git.frostfs.info/TrueCloudLab/frostfs-api-go/badges/workflows/tests.yml/badge.svg) +[![Report](https://goreportcard.com/badge/git.frostfs.info/TrueCloudLab/frostfs-api-go)](https://goreportcard.com/report/git.frostfs.info/TrueCloudLab/frostfs-api-go) +[![Release](https://git.frostfs.info/TrueCloudLab/frostfs-api-go/badges/release.svg)](https://git.frostfs.info/TrueCloudLab/frostfs-api-go) # Overview -Go implementation of recent [FrostFS API](https://github.com/TrueCloudLab/frostfs-api) -versions. For a more high-level SDK see [FrostFS SDK](https://github.com/TrueCloudLab/frostfs-sdk-go). +Go implementation of recent [FrostFS API](https://git.frostfs.info/TrueCloudLab/frostfs-api) +versions. For a more high-level SDK see [FrostFS SDK](https://git.frostfs.info/TrueCloudLab/frostfs-sdk-go). ## Frostfs-Api compatibility |frostfs-api-go version|supported frostfs-api versions| |:------------------:|:--------------------------:| -|v2.14.x|[v2.14.0](https://github.com/TrueCloudLab/frostfs-api/releases/tag/v2.14.0)| +|v2.14.x|[v2.14.0](https://git.frostfs.info/TrueCloudLab/frostfs-api/releases/tag/v2.14.0)| ## Contributing From c9782cf3ef716d676a1e849e28a9b497cab82502 Mon Sep 17 00:00:00 2001 From: Dmitrii Stepanov Date: Fri, 13 Sep 2024 17:18:19 +0300 Subject: [PATCH 1181/1196] [#117] go.mod: Upgrade grpc to v1.66.2 Signed-off-by: Dmitrii Stepanov --- go.mod | 14 +++++++------- go.sum | 28 ++++++++++++++-------------- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/go.mod b/go.mod index a241dd5..9672cb4 100644 --- a/go.mod +++ b/go.mod @@ -7,9 +7,9 @@ require ( github.com/VictoriaMetrics/easyproto v0.1.4 github.com/mailru/easyjson v0.7.7 github.com/stretchr/testify v1.8.3 - golang.org/x/sync v0.6.0 - google.golang.org/grpc v1.63.2 - google.golang.org/protobuf v1.33.0 + golang.org/x/sync v0.7.0 + google.golang.org/grpc v1.66.2 + google.golang.org/protobuf v1.34.1 ) require ( @@ -19,10 +19,10 @@ require ( github.com/kr/pretty v0.1.0 // indirect github.com/mr-tron/base58 v1.2.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - golang.org/x/net v0.21.0 // indirect - golang.org/x/sys v0.17.0 // indirect - golang.org/x/text v0.14.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de // indirect + golang.org/x/net v0.26.0 // indirect + golang.org/x/sys v0.21.0 // indirect + golang.org/x/text v0.16.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117 // indirect gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 83963fe..4bae273 100644 --- a/go.sum +++ b/go.sum @@ -26,20 +26,20 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4= -golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= -golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ= -golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= -golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= -golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= -golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de h1:cZGRis4/ot9uVm639a+rHCUaG0JJHEsdyzSQTMX+suY= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de/go.mod h1:H4O17MA/PE9BsGx3w+a+W2VOLLD1Qf7oJneAoU6WktY= -google.golang.org/grpc v1.63.2 h1:MUeiw1B2maTVZthpU5xvASfTh3LDbxHd6IJ6QQVU+xM= -google.golang.org/grpc v1.63.2/go.mod h1:WAX/8DgncnokcFUldAxq7GeB5DXHDbMF+lLvDomNkRA= -google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= -google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +golang.org/x/net v0.26.0 h1:soB7SVo0PWrY4vPW/+ay0jKDNScG2X9wFeYlXIvJsOQ= +golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE= +golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= +golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws= +golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= +golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117 h1:1GBuWVLM/KMVUv1t1En5Gs+gFZCNd360GGb4sSxtrhU= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117/go.mod h1:EfXuqaE1J41VCDicxHzUDm+8rk+7ZdXzHV0IhO/I6s0= +google.golang.org/grpc v1.66.2 h1:3QdXkuq3Bkh7w+ywLdLvM56cmGvQHUMZpiCzt6Rqaoo= +google.golang.org/grpc v1.66.2/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= +google.golang.org/protobuf v1.34.1 h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFWg= +google.golang.org/protobuf v1.34.1/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= From 13fa0da3741e6f79fe2b4bef2c6a0778a389699b Mon Sep 17 00:00:00 2001 From: Dmitrii Stepanov Date: Fri, 13 Sep 2024 17:18:53 +0300 Subject: [PATCH 1182/1196] [#117] rpc: Allow to specify custom gRPC dialer After grpc upgrade there is no DialContext call. So connection is not actually established after created. Signed-off-by: Dmitrii Stepanov --- rpc/client/call_options.go | 13 ++++++++++++- rpc/client/connect.go | 20 +++++++++++++------- rpc/client/init.go | 2 +- rpc/client/options.go | 1 - 4 files changed, 26 insertions(+), 10 deletions(-) diff --git a/rpc/client/call_options.go b/rpc/client/call_options.go index 8134e46..4fe8791 100644 --- a/rpc/client/call_options.go +++ b/rpc/client/call_options.go @@ -2,13 +2,16 @@ package client import ( "context" + + "google.golang.org/grpc" ) // CallOption is a messaging session option within Protobuf RPC. type CallOption func(*callParameters) type callParameters struct { - ctx context.Context // nolint:containedctx + ctx context.Context // nolint:containedctx + dialer func(context.Context, grpc.ClientConnInterface) error } func defaultCallParameters() *callParameters { @@ -27,3 +30,11 @@ func WithContext(ctx context.Context) CallOption { prm.ctx = ctx } } + +// WithDialer returns option to specify grpc dialer. If passed, it will be +// called after the connection is successfully created. +func WithDialer(dialer func(context.Context, grpc.ClientConnInterface) error) CallOption { + return func(prm *callParameters) { + prm.dialer = dialer + } +} diff --git a/rpc/client/connect.go b/rpc/client/connect.go index 29f4189..e22e0a6 100644 --- a/rpc/client/connect.go +++ b/rpc/client/connect.go @@ -12,7 +12,7 @@ import ( var errInvalidEndpoint = errors.New("invalid endpoint options") -func (c *Client) openGRPCConn(ctx context.Context) error { +func (c *Client) openGRPCConn(ctx context.Context, dialer func(ctx context.Context, cc grpcstd.ClientConnInterface) error) error { if c.conn != nil { return nil } @@ -21,15 +21,21 @@ func (c *Client) openGRPCConn(ctx context.Context) error { return errInvalidEndpoint } - dialCtx, cancel := context.WithTimeout(ctx, c.dialTimeout) var err error - c.conn, err = grpcstd.DialContext(dialCtx, c.addr, c.grpcDialOpts...) - - cancel() - + c.conn, err = grpcstd.NewClient(c.addr, c.grpcDialOpts...) if err != nil { - return fmt.Errorf("gRPC dial: %w", err) + return fmt.Errorf("gRPC new client: %w", err) + } + + if dialer != nil { + ctx, cancel := context.WithTimeout(ctx, c.dialTimeout) + defer cancel() + + if err := dialer(ctx, c.conn); err != nil { + _ = c.conn.Close() + return fmt.Errorf("gRPC dial: %w", err) + } } return nil diff --git a/rpc/client/init.go b/rpc/client/init.go index 60ccda9..be8d066 100644 --- a/rpc/client/init.go +++ b/rpc/client/init.go @@ -46,7 +46,7 @@ func (c *Client) Init(info common.CallMethodInfo, opts ...CallOption) (MessageRe opt(prm) } - if err := c.openGRPCConn(prm.ctx); err != nil { + if err := c.openGRPCConn(prm.ctx, prm.dialer); err != nil { return nil, err } diff --git a/rpc/client/options.go b/rpc/client/options.go index 22358a3..5711cd4 100644 --- a/rpc/client/options.go +++ b/rpc/client/options.go @@ -37,7 +37,6 @@ func (c *cfg) initDefault() { c.dialTimeout = defaultDialTimeout c.rwTimeout = defaultRWTimeout c.grpcDialOpts = []grpc.DialOption{ - grpc.WithBlock(), grpc.WithTransportCredentials(insecure.NewCredentials()), } } From c3dbbc5eab70dd429e191e081294c13d4b51fa3b Mon Sep 17 00:00:00 2001 From: Aleksey Savchuk Date: Tue, 24 Sep 2024 14:34:21 +0300 Subject: [PATCH 1183/1196] [#118] status: Support INVALID_ARGUMENT status Signed-off-by: Aleksey Savchuk --- status/status.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/status/status.go b/status/status.go index c1b5272..53d361e 100644 --- a/status/status.go +++ b/status/status.go @@ -63,6 +63,8 @@ const ( SignatureVerificationFail // NodeUnderMaintenance is a local Code value for NODE_UNDER_MAINTENANCE status. NodeUnderMaintenance + // InvalidArgument is a local Code value for INVALID_ARGUMENT status. + InvalidArgument ) const ( From 287e98ad670b29d849576e9f3204a6b42e91ea0c Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Tue, 1 Oct 2024 09:38:57 +0300 Subject: [PATCH 1184/1196] [#120] proto/test: Add protojson compatibility test It is failing, thus is skipped. But implement it now to make it easier to see it failing. Signed-off-by: Evgenii Stratonikov --- util/proto/marshal_test.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/util/proto/marshal_test.go b/util/proto/marshal_test.go index 1cd7005..98422fc 100644 --- a/util/proto/marshal_test.go +++ b/util/proto/marshal_test.go @@ -76,6 +76,13 @@ func TestStableMarshalSingle(t *testing.T) { var actual test.Primitives require.NoError(t, protojson.Unmarshal(r, &actual)) + t.Run("protojson compatibility", func(t *testing.T) { + t.Skip() + data, err := protojson.Marshal(&actual) + require.NoError(t, err) + require.JSONEq(t, string(data), string(r)) + }) + var actualFrostfs generated.Primitives require.NoError(t, actualFrostfs.UnmarshalJSON(r)) require.Equal(t, tc.input, &actualFrostfs) From f812b1ae5bd602000da17feeb0f8d5afead4a531 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Tue, 1 Oct 2024 13:52:57 +0300 Subject: [PATCH 1185/1196] [#120] Regenerate proto files Signed-off-by: Evgenii Stratonikov --- accounting/grpc/service_grpc.pb.go | 4 +-- netmap/grpc/service_grpc.pb.go | 8 +++--- object/grpc/service_grpc.pb.go | 44 ++++++++++++++++++------------ 3 files changed, 32 insertions(+), 24 deletions(-) diff --git a/accounting/grpc/service_grpc.pb.go b/accounting/grpc/service_grpc.pb.go index 63207fe..87eb56b 100644 --- a/accounting/grpc/service_grpc.pb.go +++ b/accounting/grpc/service_grpc.pb.go @@ -26,7 +26,7 @@ const ( // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. type AccountingServiceClient interface { - // Returns the amount of funds in GAS token for the requested NeoFS account. + // Returns the amount of funds in GAS token for the requested FrostFS account. // // Statuses: // - **OK** (0, SECTION_SUCCESS): @@ -56,7 +56,7 @@ func (c *accountingServiceClient) Balance(ctx context.Context, in *BalanceReques // All implementations should embed UnimplementedAccountingServiceServer // for forward compatibility type AccountingServiceServer interface { - // Returns the amount of funds in GAS token for the requested NeoFS account. + // Returns the amount of funds in GAS token for the requested FrostFS account. // // Statuses: // - **OK** (0, SECTION_SUCCESS): diff --git a/netmap/grpc/service_grpc.pb.go b/netmap/grpc/service_grpc.pb.go index 7881cd6..9ad7fef 100644 --- a/netmap/grpc/service_grpc.pb.go +++ b/netmap/grpc/service_grpc.pb.go @@ -40,14 +40,14 @@ type NetmapServiceClient interface { // information about the server has been successfully read; // - Common failures (SECTION_FAILURE_COMMON). LocalNodeInfo(ctx context.Context, in *LocalNodeInfoRequest, opts ...grpc.CallOption) (*LocalNodeInfoResponse, error) - // Read recent information about the NeoFS network. + // Read recent information about the FrostFS network. // // Statuses: // - **OK** (0, SECTION_SUCCESS): // information about the current network state has been successfully read; // - Common failures (SECTION_FAILURE_COMMON). NetworkInfo(ctx context.Context, in *NetworkInfoRequest, opts ...grpc.CallOption) (*NetworkInfoResponse, error) - // Returns network map snapshot of the current NeoFS epoch. + // Returns network map snapshot of the current FrostFS epoch. // // Statuses: // - **OK** (0, SECTION_SUCCESS): @@ -107,14 +107,14 @@ type NetmapServiceServer interface { // information about the server has been successfully read; // - Common failures (SECTION_FAILURE_COMMON). LocalNodeInfo(context.Context, *LocalNodeInfoRequest) (*LocalNodeInfoResponse, error) - // Read recent information about the NeoFS network. + // Read recent information about the FrostFS network. // // Statuses: // - **OK** (0, SECTION_SUCCESS): // information about the current network state has been successfully read; // - Common failures (SECTION_FAILURE_COMMON). NetworkInfo(context.Context, *NetworkInfoRequest) (*NetworkInfoResponse, error) - // Returns network map snapshot of the current NeoFS epoch. + // Returns network map snapshot of the current FrostFS epoch. // // Statuses: // - **OK** (0, SECTION_SUCCESS): diff --git a/object/grpc/service_grpc.pb.go b/object/grpc/service_grpc.pb.go index 687df99..abc1c71 100644 --- a/object/grpc/service_grpc.pb.go +++ b/object/grpc/service_grpc.pb.go @@ -170,7 +170,7 @@ type ObjectServiceClient interface { // provided session token has expired. Head(ctx context.Context, in *HeadRequest, opts ...grpc.CallOption) (*HeadResponse, error) // Search objects in container. Search query allows to match by Object - // Header's filed values. Please see the corresponding NeoFS Technical + // Header's filed values. Please see the corresponding FrostFS Technical // Specification section for more details. // // Extended headers can change `Search` behaviour: @@ -301,16 +301,20 @@ type ObjectServiceClient interface { // provided session token has expired. PutSingle(ctx context.Context, in *PutSingleRequest, opts ...grpc.CallOption) (*PutSingleResponse, error) // Patch the object. Request uses gRPC stream. First message must set - // the address of the object that is going to get patched. If the object's attributes - // are patched, then these attrubutes must be set only within the first stream message. + // the address of the object that is going to get patched. If the object's + // attributes are patched, then these attrubutes must be set only within the + // first stream message. // - // If the patch request is performed by NOT the object's owner but if the actor has the permission - // to perform the patch, then `OwnerID` of the object is changed. In this case the object's owner - // loses the object's ownership after the patch request is successfully done. + // If the patch request is performed by NOT the object's owner but if the + // actor has the permission to perform the patch, then `OwnerID` of the object + // is changed. In this case the object's owner loses the object's ownership + // after the patch request is successfully done. // - // As objects are content-addressable the patching causes new object ID generation for the patched object. - // This object id is set witihn `PatchResponse`. But the object id may remain unchanged in such cases: - // 1. The chunk of the applying patch contains the same value as the object's payload within the same range; + // As objects are content-addressable the patching causes new object ID + // generation for the patched object. This object id is set witihn + // `PatchResponse`. But the object id may remain unchanged in such cases: + // 1. The chunk of the applying patch contains the same value as the object's + // payload within the same range; // 2. The patch that reverts the changes applied by preceding patch; // 3. The application of the same patches for the object a few times. // @@ -694,7 +698,7 @@ type ObjectServiceServer interface { // provided session token has expired. Head(context.Context, *HeadRequest) (*HeadResponse, error) // Search objects in container. Search query allows to match by Object - // Header's filed values. Please see the corresponding NeoFS Technical + // Header's filed values. Please see the corresponding FrostFS Technical // Specification section for more details. // // Extended headers can change `Search` behaviour: @@ -825,16 +829,20 @@ type ObjectServiceServer interface { // provided session token has expired. PutSingle(context.Context, *PutSingleRequest) (*PutSingleResponse, error) // Patch the object. Request uses gRPC stream. First message must set - // the address of the object that is going to get patched. If the object's attributes - // are patched, then these attrubutes must be set only within the first stream message. + // the address of the object that is going to get patched. If the object's + // attributes are patched, then these attrubutes must be set only within the + // first stream message. // - // If the patch request is performed by NOT the object's owner but if the actor has the permission - // to perform the patch, then `OwnerID` of the object is changed. In this case the object's owner - // loses the object's ownership after the patch request is successfully done. + // If the patch request is performed by NOT the object's owner but if the + // actor has the permission to perform the patch, then `OwnerID` of the object + // is changed. In this case the object's owner loses the object's ownership + // after the patch request is successfully done. // - // As objects are content-addressable the patching causes new object ID generation for the patched object. - // This object id is set witihn `PatchResponse`. But the object id may remain unchanged in such cases: - // 1. The chunk of the applying patch contains the same value as the object's payload within the same range; + // As objects are content-addressable the patching causes new object ID + // generation for the patched object. This object id is set witihn + // `PatchResponse`. But the object id may remain unchanged in such cases: + // 1. The chunk of the applying patch contains the same value as the object's + // payload within the same range; // 2. The patch that reverts the changes applied by preceding patch; // 3. The application of the same patches for the object a few times. // From 805da79319a4b84b5d2a8a0c6f2234ff37f55acd Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Tue, 1 Oct 2024 09:42:40 +0300 Subject: [PATCH 1186/1196] [#120] protogen: Marshal enum as string Be compatible with protojson. Signed-off-by: Evgenii Stratonikov --- acl/grpc/types_frostfs.pb.go | 35 +++++++++++++++++++---- ape/grpc/types_frostfs.pb.go | 7 ++++- netmap/grpc/types_frostfs.pb.go | 21 ++++++++++++-- object/grpc/service_frostfs.pb.go | 21 ++++++++++++-- object/grpc/types_frostfs.pb.go | 14 +++++++-- refs/grpc/types_frostfs.pb.go | 14 +++++++-- session/grpc/types_frostfs.pb.go | 14 +++++++-- util/proto/test/custom/test_frostfs.pb.go | 7 ++++- util/protogen/internalgengo/json.go | 8 +++++- 9 files changed, 121 insertions(+), 20 deletions(-) diff --git a/acl/grpc/types_frostfs.pb.go b/acl/grpc/types_frostfs.pb.go index 2b116bd..b055167 100644 --- a/acl/grpc/types_frostfs.pb.go +++ b/acl/grpc/types_frostfs.pb.go @@ -356,12 +356,22 @@ func (x *EACLRecord_Filter) MarshalEasyJSON(out *jwriter.Writer) { { const prefix string = ",\"headerType\":" out.RawString(prefix[1:]) - out.Int32(int32(x.HeaderType)) + v := int32(x.HeaderType) + if vv, ok := HeaderType_name[v]; ok { + out.String(vv) + } else { + out.Int32(v) + } } { const prefix string = ",\"matchType\":" out.RawString(prefix) - out.Int32(int32(x.MatchType)) + v := int32(x.MatchType) + if vv, ok := MatchType_name[v]; ok { + out.String(vv) + } else { + out.Int32(v) + } } { const prefix string = ",\"key\":" @@ -570,7 +580,12 @@ func (x *EACLRecord_Target) MarshalEasyJSON(out *jwriter.Writer) { { const prefix string = ",\"role\":" out.RawString(prefix[1:]) - out.Int32(int32(x.Role)) + v := int32(x.Role) + if vv, ok := Role_name[v]; ok { + out.String(vv) + } else { + out.Int32(v) + } } { const prefix string = ",\"keys\":" @@ -812,12 +827,22 @@ func (x *EACLRecord) MarshalEasyJSON(out *jwriter.Writer) { { const prefix string = ",\"operation\":" out.RawString(prefix[1:]) - out.Int32(int32(x.Operation)) + v := int32(x.Operation) + if vv, ok := Operation_name[v]; ok { + out.String(vv) + } else { + out.Int32(v) + } } { const prefix string = ",\"action\":" out.RawString(prefix) - out.Int32(int32(x.Action)) + v := int32(x.Action) + if vv, ok := Action_name[v]; ok { + out.String(vv) + } else { + out.Int32(v) + } } { const prefix string = ",\"filters\":" diff --git a/ape/grpc/types_frostfs.pb.go b/ape/grpc/types_frostfs.pb.go index 216415b..e19d9f6 100644 --- a/ape/grpc/types_frostfs.pb.go +++ b/ape/grpc/types_frostfs.pb.go @@ -159,7 +159,12 @@ func (x *ChainTarget) MarshalEasyJSON(out *jwriter.Writer) { { const prefix string = ",\"type\":" out.RawString(prefix[1:]) - out.Int32(int32(x.Type)) + v := int32(x.Type) + if vv, ok := TargetType_name[v]; ok { + out.String(vv) + } else { + out.Int32(v) + } } { const prefix string = ",\"name\":" diff --git a/netmap/grpc/types_frostfs.pb.go b/netmap/grpc/types_frostfs.pb.go index e7597ea..43af103 100644 --- a/netmap/grpc/types_frostfs.pb.go +++ b/netmap/grpc/types_frostfs.pb.go @@ -288,7 +288,12 @@ func (x *Filter) MarshalEasyJSON(out *jwriter.Writer) { { const prefix string = ",\"op\":" out.RawString(prefix) - out.Int32(int32(x.Op)) + v := int32(x.Op) + if vv, ok := Operation_name[v]; ok { + out.String(vv) + } else { + out.Int32(v) + } } { const prefix string = ",\"value\":" @@ -572,7 +577,12 @@ func (x *Selector) MarshalEasyJSON(out *jwriter.Writer) { { const prefix string = ",\"clause\":" out.RawString(prefix) - out.Int32(int32(x.Clause)) + v := int32(x.Clause) + if vv, ok := Clause_name[v]; ok { + out.String(vv) + } else { + out.Int32(v) + } } { const prefix string = ",\"attribute\":" @@ -1627,7 +1637,12 @@ func (x *NodeInfo) MarshalEasyJSON(out *jwriter.Writer) { { const prefix string = ",\"state\":" out.RawString(prefix) - out.Int32(int32(x.State)) + v := int32(x.State) + if vv, ok := NodeInfo_State_name[v]; ok { + out.String(vv) + } else { + out.Int32(v) + } } out.RawByte('}') } diff --git a/object/grpc/service_frostfs.pb.go b/object/grpc/service_frostfs.pb.go index dea1b5b..188d032 100644 --- a/object/grpc/service_frostfs.pb.go +++ b/object/grpc/service_frostfs.pb.go @@ -4117,7 +4117,12 @@ func (x *SearchRequest_Body_Filter) MarshalEasyJSON(out *jwriter.Writer) { { const prefix string = ",\"matchType\":" out.RawString(prefix[1:]) - out.Int32(int32(x.MatchType)) + v := int32(x.MatchType) + if vv, ok := MatchType_name[v]; ok { + out.String(vv) + } else { + out.Int32(v) + } } { const prefix string = ",\"key\":" @@ -6246,7 +6251,12 @@ func (x *GetRangeHashRequest_Body) MarshalEasyJSON(out *jwriter.Writer) { { const prefix string = ",\"type\":" out.RawString(prefix) - out.Int32(int32(x.Type)) + v := int32(x.Type) + if vv, ok := grpc.ChecksumType_name[v]; ok { + out.String(vv) + } else { + out.Int32(v) + } } out.RawByte('}') } @@ -6659,7 +6669,12 @@ func (x *GetRangeHashResponse_Body) MarshalEasyJSON(out *jwriter.Writer) { { const prefix string = ",\"type\":" out.RawString(prefix[1:]) - out.Int32(int32(x.Type)) + v := int32(x.Type) + if vv, ok := grpc.ChecksumType_name[v]; ok { + out.String(vv) + } else { + out.Int32(v) + } } { const prefix string = ",\"hashList\":" diff --git a/object/grpc/types_frostfs.pb.go b/object/grpc/types_frostfs.pb.go index 4233417..9fc2769 100644 --- a/object/grpc/types_frostfs.pb.go +++ b/object/grpc/types_frostfs.pb.go @@ -323,7 +323,12 @@ func (x *ShortHeader) MarshalEasyJSON(out *jwriter.Writer) { { const prefix string = ",\"objectType\":" out.RawString(prefix) - out.Int32(int32(x.ObjectType)) + v := int32(x.ObjectType) + if vv, ok := ObjectType_name[v]; ok { + out.String(vv) + } else { + out.Int32(v) + } } { const prefix string = ",\"payloadLength\":" @@ -1659,7 +1664,12 @@ func (x *Header) MarshalEasyJSON(out *jwriter.Writer) { { const prefix string = ",\"objectType\":" out.RawString(prefix) - out.Int32(int32(x.ObjectType)) + v := int32(x.ObjectType) + if vv, ok := ObjectType_name[v]; ok { + out.String(vv) + } else { + out.Int32(v) + } } { const prefix string = ",\"homomorphicHash\":" diff --git a/refs/grpc/types_frostfs.pb.go b/refs/grpc/types_frostfs.pb.go index 35febe9..5f35eba 100644 --- a/refs/grpc/types_frostfs.pb.go +++ b/refs/grpc/types_frostfs.pb.go @@ -933,7 +933,12 @@ func (x *Signature) MarshalEasyJSON(out *jwriter.Writer) { { const prefix string = ",\"scheme\":" out.RawString(prefix) - out.Int32(int32(x.Scheme)) + v := int32(x.Scheme) + if vv, ok := SignatureScheme_name[v]; ok { + out.String(vv) + } else { + out.Int32(v) + } } out.RawByte('}') } @@ -1270,7 +1275,12 @@ func (x *Checksum) MarshalEasyJSON(out *jwriter.Writer) { { const prefix string = ",\"type\":" out.RawString(prefix[1:]) - out.Int32(int32(x.Type)) + v := int32(x.Type) + if vv, ok := ChecksumType_name[v]; ok { + out.String(vv) + } else { + out.Int32(v) + } } { const prefix string = ",\"sum\":" diff --git a/session/grpc/types_frostfs.pb.go b/session/grpc/types_frostfs.pb.go index 41ff5d9..c92ab28 100644 --- a/session/grpc/types_frostfs.pb.go +++ b/session/grpc/types_frostfs.pb.go @@ -362,7 +362,12 @@ func (x *ObjectSessionContext) MarshalEasyJSON(out *jwriter.Writer) { { const prefix string = ",\"verb\":" out.RawString(prefix[1:]) - out.Int32(int32(x.Verb)) + v := int32(x.Verb) + if vv, ok := ObjectSessionContext_Verb_name[v]; ok { + out.String(vv) + } else { + out.Int32(v) + } } { const prefix string = ",\"target\":" @@ -600,7 +605,12 @@ func (x *ContainerSessionContext) MarshalEasyJSON(out *jwriter.Writer) { { const prefix string = ",\"verb\":" out.RawString(prefix[1:]) - out.Int32(int32(x.Verb)) + v := int32(x.Verb) + if vv, ok := ContainerSessionContext_Verb_name[v]; ok { + out.String(vv) + } else { + out.Int32(v) + } } { const prefix string = ",\"wildcard\":" diff --git a/util/proto/test/custom/test_frostfs.pb.go b/util/proto/test/custom/test_frostfs.pb.go index 97efa51..005d6d1 100644 --- a/util/proto/test/custom/test_frostfs.pb.go +++ b/util/proto/test/custom/test_frostfs.pb.go @@ -614,7 +614,12 @@ func (x *Primitives) MarshalEasyJSON(out *jwriter.Writer) { { const prefix string = ",\"fieldH\":" out.RawString(prefix) - out.Int32(int32(x.FieldH)) + v := int32(x.FieldH) + if vv, ok := Primitives_SomeEnum_name[v]; ok { + out.String(vv) + } else { + out.Int32(v) + } } switch xx := x.FieldM.(type) { case *Primitives_FieldMa: diff --git a/util/protogen/internalgengo/json.go b/util/protogen/internalgengo/json.go index f7cd284..95a06d5 100644 --- a/util/protogen/internalgengo/json.go +++ b/util/protogen/internalgengo/json.go @@ -195,7 +195,13 @@ func emitJSONFieldWrite(g *protogen.GeneratedFile, f *protogen.Field, name strin case protoreflect.BoolKind: template = "out.Bool(%s)" case protoreflect.EnumKind: - template = "out.Int32(int32(%s))" + enumType := fieldType(g, f).String() + template = `v := int32(%s) + if vv, ok := ` + enumType + `_name[v]; ok { + out.String(vv) + } else { + out.Int32(v) + }` case protoreflect.Int32Kind, protoreflect.Sint32Kind, protoreflect.Sfixed32Kind: template = "out.Int32(%s)" case protoreflect.Uint32Kind, protoreflect.Fixed32Kind: From eeb754c327dec8e9007bb9154ab215f91240d5ec Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Tue, 1 Oct 2024 09:53:38 +0300 Subject: [PATCH 1187/1196] [#120] protogen: Omit empty fields from JSON output Signed-off-by: Evgenii Stratonikov --- accounting/grpc/service_frostfs.pb.go | 108 +- accounting/grpc/types_frostfs.pb.go | 27 +- acl/grpc/types_frostfs.pb.go | 433 ++++-- ape/grpc/types_frostfs.pb.go | 49 +- apemanager/grpc/service_frostfs.pb.go | 344 ++++- container/grpc/service_frostfs.pb.go | 478 +++++-- container/grpc/types_frostfs.pb.go | 130 +- lock/grpc/types_frostfs.pb.go | 22 +- netmap/grpc/service_frostfs.pb.go | 295 +++- netmap/grpc/types_frostfs.pb.go | 603 +++++--- object/grpc/service_frostfs.pb.go | 1592 ++++++++++++++++----- object/grpc/types_frostfs.pb.go | 749 +++++++--- refs/grpc/types_frostfs.pb.go | 206 ++- session/grpc/service_frostfs.pb.go | 134 +- session/grpc/types_frostfs.pb.go | 621 ++++++-- status/grpc/types_frostfs.pb.go | 83 +- tombstone/grpc/types_frostfs.pb.go | 56 +- util/proto/test/custom/test_frostfs.pb.go | 388 +++-- util/protogen/internalgengo/json.go | 31 +- 19 files changed, 4717 insertions(+), 1632 deletions(-) diff --git a/accounting/grpc/service_frostfs.pb.go b/accounting/grpc/service_frostfs.pb.go index b70fd27..4f11303 100644 --- a/accounting/grpc/service_frostfs.pb.go +++ b/accounting/grpc/service_frostfs.pb.go @@ -98,11 +98,19 @@ func (x *BalanceRequest_Body) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"ownerId\":" - out.RawString(prefix[1:]) - x.OwnerId.MarshalEasyJSON(out) + if x.OwnerId != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"ownerId\":" + out.RawString(prefix) + x.OwnerId.MarshalEasyJSON(out) + } } out.RawByte('}') } @@ -295,21 +303,43 @@ func (x *BalanceRequest) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"body\":" - out.RawString(prefix[1:]) - x.Body.MarshalEasyJSON(out) + if x.Body != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"body\":" + out.RawString(prefix) + x.Body.MarshalEasyJSON(out) + } } { - const prefix string = ",\"metaHeader\":" - out.RawString(prefix) - x.MetaHeader.MarshalEasyJSON(out) + if x.MetaHeader != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) + } } { - const prefix string = ",\"verifyHeader\":" - out.RawString(prefix) - x.VerifyHeader.MarshalEasyJSON(out) + if x.VerifyHeader != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) + } } out.RawByte('}') } @@ -452,11 +482,19 @@ func (x *BalanceResponse_Body) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"balance\":" - out.RawString(prefix[1:]) - x.Balance.MarshalEasyJSON(out) + if x.Balance != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"balance\":" + out.RawString(prefix) + x.Balance.MarshalEasyJSON(out) + } } out.RawByte('}') } @@ -649,21 +687,43 @@ func (x *BalanceResponse) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"body\":" - out.RawString(prefix[1:]) - x.Body.MarshalEasyJSON(out) + if x.Body != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"body\":" + out.RawString(prefix) + x.Body.MarshalEasyJSON(out) + } } { - const prefix string = ",\"metaHeader\":" - out.RawString(prefix) - x.MetaHeader.MarshalEasyJSON(out) + if x.MetaHeader != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) + } } { - const prefix string = ",\"verifyHeader\":" - out.RawString(prefix) - x.VerifyHeader.MarshalEasyJSON(out) + if x.VerifyHeader != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) + } } out.RawByte('}') } diff --git a/accounting/grpc/types_frostfs.pb.go b/accounting/grpc/types_frostfs.pb.go index 182705e..0ae770b 100644 --- a/accounting/grpc/types_frostfs.pb.go +++ b/accounting/grpc/types_frostfs.pb.go @@ -113,16 +113,31 @@ func (x *Decimal) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"value\":" - out.RawString(prefix[1:]) - out.Int64(x.Value) + if x.Value != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"value\":" + out.RawString(prefix) + out.Int64(x.Value) + } } { - const prefix string = ",\"precision\":" - out.RawString(prefix) - out.Uint32(x.Precision) + if x.Precision != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"precision\":" + out.RawString(prefix) + out.Uint32(x.Precision) + } } out.RawByte('}') } diff --git a/acl/grpc/types_frostfs.pb.go b/acl/grpc/types_frostfs.pb.go index b055167..57e1682 100644 --- a/acl/grpc/types_frostfs.pb.go +++ b/acl/grpc/types_frostfs.pb.go @@ -352,36 +352,65 @@ func (x *EACLRecord_Filter) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"headerType\":" - out.RawString(prefix[1:]) - v := int32(x.HeaderType) - if vv, ok := HeaderType_name[v]; ok { - out.String(vv) - } else { - out.Int32(v) + if x.HeaderType != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"headerType\":" + out.RawString(prefix) + v := int32(x.HeaderType) + if vv, ok := HeaderType_name[v]; ok { + out.String(vv) + } else { + out.Int32(v) + } } } { - const prefix string = ",\"matchType\":" - out.RawString(prefix) - v := int32(x.MatchType) - if vv, ok := MatchType_name[v]; ok { - out.String(vv) - } else { - out.Int32(v) + if x.MatchType != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"matchType\":" + out.RawString(prefix) + v := int32(x.MatchType) + if vv, ok := MatchType_name[v]; ok { + out.String(vv) + } else { + out.Int32(v) + } } } { - const prefix string = ",\"key\":" - out.RawString(prefix) - out.String(x.Key) + if len(x.Key) != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"key\":" + out.RawString(prefix) + out.String(x.Key) + } } { - const prefix string = ",\"value\":" - out.RawString(prefix) - out.String(x.Value) + if len(x.Value) != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"value\":" + out.RawString(prefix) + out.String(x.Value) + } } out.RawByte('}') } @@ -576,28 +605,43 @@ func (x *EACLRecord_Target) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"role\":" - out.RawString(prefix[1:]) - v := int32(x.Role) - if vv, ok := Role_name[v]; ok { - out.String(vv) - } else { - out.Int32(v) + if x.Role != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"role\":" + out.RawString(prefix) + v := int32(x.Role) + if vv, ok := Role_name[v]; ok { + out.String(vv) + } else { + out.Int32(v) + } } } { - const prefix string = ",\"keys\":" - out.RawString(prefix) - out.RawByte('[') - for i := range x.Keys { - if i != 0 { + if len(x.Keys) != 0 { + if !first { out.RawByte(',') + } else { + first = false } - out.Base64Bytes(x.Keys[i]) + const prefix string = "\"keys\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.Keys { + if i != 0 { + out.RawByte(',') + } + out.Base64Bytes(x.Keys[i]) + } + out.RawByte(']') } - out.RawByte(']') } out.RawByte('}') } @@ -823,50 +867,79 @@ func (x *EACLRecord) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"operation\":" - out.RawString(prefix[1:]) - v := int32(x.Operation) - if vv, ok := Operation_name[v]; ok { - out.String(vv) - } else { - out.Int32(v) - } - } - { - const prefix string = ",\"action\":" - out.RawString(prefix) - v := int32(x.Action) - if vv, ok := Action_name[v]; ok { - out.String(vv) - } else { - out.Int32(v) - } - } - { - const prefix string = ",\"filters\":" - out.RawString(prefix) - out.RawByte('[') - for i := range x.Filters { - if i != 0 { + if x.Operation != 0 { + if !first { out.RawByte(',') + } else { + first = false + } + const prefix string = "\"operation\":" + out.RawString(prefix) + v := int32(x.Operation) + if vv, ok := Operation_name[v]; ok { + out.String(vv) + } else { + out.Int32(v) } - x.Filters[i].MarshalEasyJSON(out) } - out.RawByte(']') } { - const prefix string = ",\"targets\":" - out.RawString(prefix) - out.RawByte('[') - for i := range x.Targets { - if i != 0 { + if x.Action != 0 { + if !first { out.RawByte(',') + } else { + first = false + } + const prefix string = "\"action\":" + out.RawString(prefix) + v := int32(x.Action) + if vv, ok := Action_name[v]; ok { + out.String(vv) + } else { + out.Int32(v) } - x.Targets[i].MarshalEasyJSON(out) } - out.RawByte(']') + } + { + if len(x.Filters) != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"filters\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.Filters { + if i != 0 { + out.RawByte(',') + } + x.Filters[i].MarshalEasyJSON(out) + } + out.RawByte(']') + } + } + { + if len(x.Targets) != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"targets\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.Targets { + if i != 0 { + out.RawByte(',') + } + x.Targets[i].MarshalEasyJSON(out) + } + out.RawByte(']') + } } out.RawByte('}') } @@ -1109,28 +1182,50 @@ func (x *EACLTable) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"version\":" - out.RawString(prefix[1:]) - x.Version.MarshalEasyJSON(out) - } - { - const prefix string = ",\"containerID\":" - out.RawString(prefix) - x.ContainerId.MarshalEasyJSON(out) - } - { - const prefix string = ",\"records\":" - out.RawString(prefix) - out.RawByte('[') - for i := range x.Records { - if i != 0 { + if x.Version != nil { + if !first { out.RawByte(',') + } else { + first = false } - x.Records[i].MarshalEasyJSON(out) + const prefix string = "\"version\":" + out.RawString(prefix) + x.Version.MarshalEasyJSON(out) + } + } + { + if x.ContainerId != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"containerID\":" + out.RawString(prefix) + x.ContainerId.MarshalEasyJSON(out) + } + } + { + if len(x.Records) != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"records\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.Records { + if i != 0 { + out.RawByte(',') + } + x.Records[i].MarshalEasyJSON(out) + } + out.RawByte(']') } - out.RawByte(']') } out.RawByte('}') } @@ -1317,21 +1412,43 @@ func (x *BearerToken_Body_TokenLifetime) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"exp\":" - out.RawString(prefix[1:]) - out.Uint64(x.Exp) + if x.Exp != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"exp\":" + out.RawString(prefix) + out.Uint64(x.Exp) + } } { - const prefix string = ",\"nbf\":" - out.RawString(prefix) - out.Uint64(x.Nbf) + if x.Nbf != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"nbf\":" + out.RawString(prefix) + out.Uint64(x.Nbf) + } } { - const prefix string = ",\"iat\":" - out.RawString(prefix) - out.Uint64(x.Iat) + if x.Iat != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"iat\":" + out.RawString(prefix) + out.Uint64(x.Iat) + } } out.RawByte('}') } @@ -1497,23 +1614,38 @@ func (x *BearerToken_Body_APEOverride) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"target\":" - out.RawString(prefix[1:]) - x.Target.MarshalEasyJSON(out) + if x.Target != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"target\":" + out.RawString(prefix) + x.Target.MarshalEasyJSON(out) + } } { - const prefix string = ",\"chains\":" - out.RawString(prefix) - out.RawByte('[') - for i := range x.Chains { - if i != 0 { + if len(x.Chains) != 0 { + if !first { out.RawByte(',') + } else { + first = false } - x.Chains[i].MarshalEasyJSON(out) + const prefix string = "\"chains\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.Chains { + if i != 0 { + out.RawByte(',') + } + x.Chains[i].MarshalEasyJSON(out) + } + out.RawByte(']') } - out.RawByte(']') } out.RawByte('}') } @@ -1745,31 +1877,67 @@ func (x *BearerToken_Body) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"eaclTable\":" - out.RawString(prefix[1:]) - x.EaclTable.MarshalEasyJSON(out) + if x.EaclTable != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"eaclTable\":" + out.RawString(prefix) + x.EaclTable.MarshalEasyJSON(out) + } } { - const prefix string = ",\"ownerID\":" - out.RawString(prefix) - x.OwnerId.MarshalEasyJSON(out) + if x.OwnerId != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"ownerID\":" + out.RawString(prefix) + x.OwnerId.MarshalEasyJSON(out) + } } { - const prefix string = ",\"lifetime\":" - out.RawString(prefix) - x.Lifetime.MarshalEasyJSON(out) + if x.Lifetime != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"lifetime\":" + out.RawString(prefix) + x.Lifetime.MarshalEasyJSON(out) + } } { - const prefix string = ",\"allowImpersonate\":" - out.RawString(prefix) - out.Bool(x.AllowImpersonate) + if x.AllowImpersonate { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"allowImpersonate\":" + out.RawString(prefix) + out.Bool(x.AllowImpersonate) + } } { - const prefix string = ",\"apeOverride\":" - out.RawString(prefix) - x.ApeOverride.MarshalEasyJSON(out) + if x.ApeOverride != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"apeOverride\":" + out.RawString(prefix) + x.ApeOverride.MarshalEasyJSON(out) + } } out.RawByte('}') } @@ -1948,16 +2116,31 @@ func (x *BearerToken) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"body\":" - out.RawString(prefix[1:]) - x.Body.MarshalEasyJSON(out) + if x.Body != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"body\":" + out.RawString(prefix) + x.Body.MarshalEasyJSON(out) + } } { - const prefix string = ",\"signature\":" - out.RawString(prefix) - x.Signature.MarshalEasyJSON(out) + if x.Signature != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"signature\":" + out.RawString(prefix) + x.Signature.MarshalEasyJSON(out) + } } out.RawByte('}') } diff --git a/ape/grpc/types_frostfs.pb.go b/ape/grpc/types_frostfs.pb.go index e19d9f6..7967e13 100644 --- a/ape/grpc/types_frostfs.pb.go +++ b/ape/grpc/types_frostfs.pb.go @@ -155,21 +155,36 @@ func (x *ChainTarget) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"type\":" - out.RawString(prefix[1:]) - v := int32(x.Type) - if vv, ok := TargetType_name[v]; ok { - out.String(vv) - } else { - out.Int32(v) + if x.Type != 0 { + 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) + } } } { - const prefix string = ",\"name\":" - out.RawString(prefix) - out.String(x.Name) + if len(x.Name) != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"name\":" + out.RawString(prefix) + out.String(x.Name) + } } out.RawByte('}') } @@ -338,13 +353,21 @@ func (x *Chain) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') switch xx := x.Kind.(type) { case *Chain_Raw: { - const prefix string = ",\"raw\":" - out.RawString(prefix[1:]) - out.Base64Bytes(xx.Raw) + if len(xx.Raw) != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"raw\":" + out.RawString(prefix) + out.Base64Bytes(xx.Raw) + } } } out.RawByte('}') diff --git a/apemanager/grpc/service_frostfs.pb.go b/apemanager/grpc/service_frostfs.pb.go index 99abeb2..2a30850 100644 --- a/apemanager/grpc/service_frostfs.pb.go +++ b/apemanager/grpc/service_frostfs.pb.go @@ -121,16 +121,31 @@ func (x *AddChainRequest_Body) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"target\":" - out.RawString(prefix[1:]) - x.Target.MarshalEasyJSON(out) + if x.Target != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"target\":" + out.RawString(prefix) + x.Target.MarshalEasyJSON(out) + } } { - const prefix string = ",\"chain\":" - out.RawString(prefix) - x.Chain.MarshalEasyJSON(out) + if x.Chain != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"chain\":" + out.RawString(prefix) + x.Chain.MarshalEasyJSON(out) + } } out.RawByte('}') } @@ -330,21 +345,43 @@ func (x *AddChainRequest) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"body\":" - out.RawString(prefix[1:]) - x.Body.MarshalEasyJSON(out) + if x.Body != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"body\":" + out.RawString(prefix) + x.Body.MarshalEasyJSON(out) + } } { - const prefix string = ",\"metaHeader\":" - out.RawString(prefix) - x.MetaHeader.MarshalEasyJSON(out) + if x.MetaHeader != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) + } } { - const prefix string = ",\"verifyHeader\":" - out.RawString(prefix) - x.VerifyHeader.MarshalEasyJSON(out) + if x.VerifyHeader != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) + } } out.RawByte('}') } @@ -484,11 +521,19 @@ func (x *AddChainResponse_Body) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"chainId\":" - out.RawString(prefix[1:]) - out.Base64Bytes(x.ChainId) + if len(x.ChainId) != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"chainId\":" + out.RawString(prefix) + out.Base64Bytes(x.ChainId) + } } out.RawByte('}') } @@ -680,21 +725,43 @@ func (x *AddChainResponse) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"body\":" - out.RawString(prefix[1:]) - x.Body.MarshalEasyJSON(out) + if x.Body != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"body\":" + out.RawString(prefix) + x.Body.MarshalEasyJSON(out) + } } { - const prefix string = ",\"metaHeader\":" - out.RawString(prefix) - x.MetaHeader.MarshalEasyJSON(out) + if x.MetaHeader != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) + } } { - const prefix string = ",\"verifyHeader\":" - out.RawString(prefix) - x.VerifyHeader.MarshalEasyJSON(out) + if x.VerifyHeader != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) + } } out.RawByte('}') } @@ -857,16 +924,31 @@ func (x *RemoveChainRequest_Body) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"target\":" - out.RawString(prefix[1:]) - x.Target.MarshalEasyJSON(out) + if x.Target != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"target\":" + out.RawString(prefix) + x.Target.MarshalEasyJSON(out) + } } { - const prefix string = ",\"chainId\":" - out.RawString(prefix) - out.Base64Bytes(x.ChainId) + if len(x.ChainId) != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"chainId\":" + out.RawString(prefix) + out.Base64Bytes(x.ChainId) + } } out.RawByte('}') } @@ -1065,21 +1147,43 @@ func (x *RemoveChainRequest) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"body\":" - out.RawString(prefix[1:]) - x.Body.MarshalEasyJSON(out) + if x.Body != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"body\":" + out.RawString(prefix) + x.Body.MarshalEasyJSON(out) + } } { - const prefix string = ",\"metaHeader\":" - out.RawString(prefix) - x.MetaHeader.MarshalEasyJSON(out) + if x.MetaHeader != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) + } } { - const prefix string = ",\"verifyHeader\":" - out.RawString(prefix) - x.VerifyHeader.MarshalEasyJSON(out) + if x.VerifyHeader != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) + } } out.RawByte('}') } @@ -1381,21 +1485,43 @@ func (x *RemoveChainResponse) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"body\":" - out.RawString(prefix[1:]) - x.Body.MarshalEasyJSON(out) + if x.Body != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"body\":" + out.RawString(prefix) + x.Body.MarshalEasyJSON(out) + } } { - const prefix string = ",\"metaHeader\":" - out.RawString(prefix) - x.MetaHeader.MarshalEasyJSON(out) + if x.MetaHeader != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) + } } { - const prefix string = ",\"verifyHeader\":" - out.RawString(prefix) - x.VerifyHeader.MarshalEasyJSON(out) + if x.VerifyHeader != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) + } } out.RawByte('}') } @@ -1538,11 +1664,19 @@ func (x *ListChainsRequest_Body) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"target\":" - out.RawString(prefix[1:]) - x.Target.MarshalEasyJSON(out) + if x.Target != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"target\":" + out.RawString(prefix) + x.Target.MarshalEasyJSON(out) + } } out.RawByte('}') } @@ -1735,21 +1869,43 @@ func (x *ListChainsRequest) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"body\":" - out.RawString(prefix[1:]) - x.Body.MarshalEasyJSON(out) + if x.Body != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"body\":" + out.RawString(prefix) + x.Body.MarshalEasyJSON(out) + } } { - const prefix string = ",\"metaHeader\":" - out.RawString(prefix) - x.MetaHeader.MarshalEasyJSON(out) + if x.MetaHeader != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) + } } { - const prefix string = ",\"verifyHeader\":" - out.RawString(prefix) - x.VerifyHeader.MarshalEasyJSON(out) + if x.VerifyHeader != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) + } } out.RawByte('}') } @@ -1895,18 +2051,26 @@ func (x *ListChainsResponse_Body) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"chains\":" - out.RawString(prefix[1:]) - out.RawByte('[') - for i := range x.Chains { - if i != 0 { + if len(x.Chains) != 0 { + if !first { out.RawByte(',') + } else { + first = false } - x.Chains[i].MarshalEasyJSON(out) + const prefix string = "\"chains\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.Chains { + if i != 0 { + out.RawByte(',') + } + x.Chains[i].MarshalEasyJSON(out) + } + out.RawByte(']') } - out.RawByte(']') } out.RawByte('}') } @@ -2106,21 +2270,43 @@ func (x *ListChainsResponse) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"body\":" - out.RawString(prefix[1:]) - x.Body.MarshalEasyJSON(out) + if x.Body != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"body\":" + out.RawString(prefix) + x.Body.MarshalEasyJSON(out) + } } { - const prefix string = ",\"metaHeader\":" - out.RawString(prefix) - x.MetaHeader.MarshalEasyJSON(out) + if x.MetaHeader != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) + } } { - const prefix string = ",\"verifyHeader\":" - out.RawString(prefix) - x.VerifyHeader.MarshalEasyJSON(out) + if x.VerifyHeader != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) + } } out.RawByte('}') } diff --git a/container/grpc/service_frostfs.pb.go b/container/grpc/service_frostfs.pb.go index ffdc730..4ccb595 100644 --- a/container/grpc/service_frostfs.pb.go +++ b/container/grpc/service_frostfs.pb.go @@ -121,16 +121,31 @@ func (x *PutRequest_Body) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"container\":" - out.RawString(prefix[1:]) - x.Container.MarshalEasyJSON(out) + if x.Container != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"container\":" + out.RawString(prefix) + x.Container.MarshalEasyJSON(out) + } } { - const prefix string = ",\"signature\":" - out.RawString(prefix) - x.Signature.MarshalEasyJSON(out) + if x.Signature != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"signature\":" + out.RawString(prefix) + x.Signature.MarshalEasyJSON(out) + } } out.RawByte('}') } @@ -330,21 +345,43 @@ func (x *PutRequest) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"body\":" - out.RawString(prefix[1:]) - x.Body.MarshalEasyJSON(out) + if x.Body != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"body\":" + out.RawString(prefix) + x.Body.MarshalEasyJSON(out) + } } { - const prefix string = ",\"metaHeader\":" - out.RawString(prefix) - x.MetaHeader.MarshalEasyJSON(out) + if x.MetaHeader != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) + } } { - const prefix string = ",\"verifyHeader\":" - out.RawString(prefix) - x.VerifyHeader.MarshalEasyJSON(out) + if x.VerifyHeader != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) + } } out.RawByte('}') } @@ -487,11 +524,19 @@ func (x *PutResponse_Body) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"containerId\":" - out.RawString(prefix[1:]) - x.ContainerId.MarshalEasyJSON(out) + if x.ContainerId != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"containerId\":" + out.RawString(prefix) + x.ContainerId.MarshalEasyJSON(out) + } } out.RawByte('}') } @@ -684,21 +729,43 @@ func (x *PutResponse) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"body\":" - out.RawString(prefix[1:]) - x.Body.MarshalEasyJSON(out) + if x.Body != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"body\":" + out.RawString(prefix) + x.Body.MarshalEasyJSON(out) + } } { - const prefix string = ",\"metaHeader\":" - out.RawString(prefix) - x.MetaHeader.MarshalEasyJSON(out) + if x.MetaHeader != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) + } } { - const prefix string = ",\"verifyHeader\":" - out.RawString(prefix) - x.VerifyHeader.MarshalEasyJSON(out) + if x.VerifyHeader != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) + } } out.RawByte('}') } @@ -864,16 +931,31 @@ func (x *DeleteRequest_Body) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"containerId\":" - out.RawString(prefix[1:]) - x.ContainerId.MarshalEasyJSON(out) + if x.ContainerId != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"containerId\":" + out.RawString(prefix) + x.ContainerId.MarshalEasyJSON(out) + } } { - const prefix string = ",\"signature\":" - out.RawString(prefix) - x.Signature.MarshalEasyJSON(out) + if x.Signature != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"signature\":" + out.RawString(prefix) + x.Signature.MarshalEasyJSON(out) + } } out.RawByte('}') } @@ -1073,21 +1155,43 @@ func (x *DeleteRequest) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"body\":" - out.RawString(prefix[1:]) - x.Body.MarshalEasyJSON(out) + if x.Body != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"body\":" + out.RawString(prefix) + x.Body.MarshalEasyJSON(out) + } } { - const prefix string = ",\"metaHeader\":" - out.RawString(prefix) - x.MetaHeader.MarshalEasyJSON(out) + if x.MetaHeader != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) + } } { - const prefix string = ",\"verifyHeader\":" - out.RawString(prefix) - x.VerifyHeader.MarshalEasyJSON(out) + if x.VerifyHeader != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) + } } out.RawByte('}') } @@ -1389,21 +1493,43 @@ func (x *DeleteResponse) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"body\":" - out.RawString(prefix[1:]) - x.Body.MarshalEasyJSON(out) + if x.Body != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"body\":" + out.RawString(prefix) + x.Body.MarshalEasyJSON(out) + } } { - const prefix string = ",\"metaHeader\":" - out.RawString(prefix) - x.MetaHeader.MarshalEasyJSON(out) + if x.MetaHeader != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) + } } { - const prefix string = ",\"verifyHeader\":" - out.RawString(prefix) - x.VerifyHeader.MarshalEasyJSON(out) + if x.VerifyHeader != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) + } } out.RawByte('}') } @@ -1546,11 +1672,19 @@ func (x *GetRequest_Body) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"containerId\":" - out.RawString(prefix[1:]) - x.ContainerId.MarshalEasyJSON(out) + if x.ContainerId != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"containerId\":" + out.RawString(prefix) + x.ContainerId.MarshalEasyJSON(out) + } } out.RawByte('}') } @@ -1743,21 +1877,43 @@ func (x *GetRequest) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"body\":" - out.RawString(prefix[1:]) - x.Body.MarshalEasyJSON(out) + if x.Body != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"body\":" + out.RawString(prefix) + x.Body.MarshalEasyJSON(out) + } } { - const prefix string = ",\"metaHeader\":" - out.RawString(prefix) - x.MetaHeader.MarshalEasyJSON(out) + if x.MetaHeader != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) + } } { - const prefix string = ",\"verifyHeader\":" - out.RawString(prefix) - x.VerifyHeader.MarshalEasyJSON(out) + if x.VerifyHeader != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) + } } out.RawByte('}') } @@ -1946,21 +2102,43 @@ func (x *GetResponse_Body) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"container\":" - out.RawString(prefix[1:]) - x.Container.MarshalEasyJSON(out) + if x.Container != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"container\":" + out.RawString(prefix) + x.Container.MarshalEasyJSON(out) + } } { - const prefix string = ",\"signature\":" - out.RawString(prefix) - x.Signature.MarshalEasyJSON(out) + if x.Signature != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"signature\":" + out.RawString(prefix) + x.Signature.MarshalEasyJSON(out) + } } { - const prefix string = ",\"sessionToken\":" - out.RawString(prefix) - x.SessionToken.MarshalEasyJSON(out) + if x.SessionToken != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"sessionToken\":" + out.RawString(prefix) + x.SessionToken.MarshalEasyJSON(out) + } } out.RawByte('}') } @@ -2167,21 +2345,43 @@ func (x *GetResponse) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"body\":" - out.RawString(prefix[1:]) - x.Body.MarshalEasyJSON(out) + if x.Body != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"body\":" + out.RawString(prefix) + x.Body.MarshalEasyJSON(out) + } } { - const prefix string = ",\"metaHeader\":" - out.RawString(prefix) - x.MetaHeader.MarshalEasyJSON(out) + if x.MetaHeader != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) + } } { - const prefix string = ",\"verifyHeader\":" - out.RawString(prefix) - x.VerifyHeader.MarshalEasyJSON(out) + if x.VerifyHeader != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) + } } out.RawByte('}') } @@ -2324,11 +2524,19 @@ func (x *ListRequest_Body) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"ownerId\":" - out.RawString(prefix[1:]) - x.OwnerId.MarshalEasyJSON(out) + if x.OwnerId != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"ownerId\":" + out.RawString(prefix) + x.OwnerId.MarshalEasyJSON(out) + } } out.RawByte('}') } @@ -2521,21 +2729,43 @@ func (x *ListRequest) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"body\":" - out.RawString(prefix[1:]) - x.Body.MarshalEasyJSON(out) + if x.Body != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"body\":" + out.RawString(prefix) + x.Body.MarshalEasyJSON(out) + } } { - const prefix string = ",\"metaHeader\":" - out.RawString(prefix) - x.MetaHeader.MarshalEasyJSON(out) + if x.MetaHeader != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) + } } { - const prefix string = ",\"verifyHeader\":" - out.RawString(prefix) - x.VerifyHeader.MarshalEasyJSON(out) + if x.VerifyHeader != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) + } } out.RawByte('}') } @@ -2681,18 +2911,26 @@ func (x *ListResponse_Body) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"containerIds\":" - out.RawString(prefix[1:]) - out.RawByte('[') - for i := range x.ContainerIds { - if i != 0 { + if len(x.ContainerIds) != 0 { + if !first { out.RawByte(',') + } else { + first = false } - x.ContainerIds[i].MarshalEasyJSON(out) + const prefix string = "\"containerIds\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.ContainerIds { + if i != 0 { + out.RawByte(',') + } + x.ContainerIds[i].MarshalEasyJSON(out) + } + out.RawByte(']') } - out.RawByte(']') } out.RawByte('}') } @@ -2892,21 +3130,43 @@ func (x *ListResponse) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"body\":" - out.RawString(prefix[1:]) - x.Body.MarshalEasyJSON(out) + if x.Body != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"body\":" + out.RawString(prefix) + x.Body.MarshalEasyJSON(out) + } } { - const prefix string = ",\"metaHeader\":" - out.RawString(prefix) - x.MetaHeader.MarshalEasyJSON(out) + if x.MetaHeader != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) + } } { - const prefix string = ",\"verifyHeader\":" - out.RawString(prefix) - x.VerifyHeader.MarshalEasyJSON(out) + if x.VerifyHeader != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) + } } out.RawByte('}') } diff --git a/container/grpc/types_frostfs.pb.go b/container/grpc/types_frostfs.pb.go index 3010eb0..9db07ed 100644 --- a/container/grpc/types_frostfs.pb.go +++ b/container/grpc/types_frostfs.pb.go @@ -115,16 +115,31 @@ func (x *Container_Attribute) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"key\":" - out.RawString(prefix[1:]) - out.String(x.Key) + if len(x.Key) != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"key\":" + out.RawString(prefix) + out.String(x.Key) + } } { - const prefix string = ",\"value\":" - out.RawString(prefix) - out.String(x.Value) + if len(x.Value) != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"value\":" + out.RawString(prefix) + out.String(x.Value) + } } out.RawByte('}') } @@ -370,43 +385,86 @@ func (x *Container) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"version\":" - out.RawString(prefix[1:]) - x.Version.MarshalEasyJSON(out) - } - { - const prefix string = ",\"ownerID\":" - out.RawString(prefix) - x.OwnerId.MarshalEasyJSON(out) - } - { - const prefix string = ",\"nonce\":" - out.RawString(prefix) - out.Base64Bytes(x.Nonce) - } - { - const prefix string = ",\"basicACL\":" - out.RawString(prefix) - out.Uint32(x.BasicAcl) - } - { - const prefix string = ",\"attributes\":" - out.RawString(prefix) - out.RawByte('[') - for i := range x.Attributes { - if i != 0 { + if x.Version != nil { + if !first { out.RawByte(',') + } else { + first = false } - x.Attributes[i].MarshalEasyJSON(out) + const prefix string = "\"version\":" + out.RawString(prefix) + x.Version.MarshalEasyJSON(out) } - out.RawByte(']') } { - const prefix string = ",\"placementPolicy\":" - out.RawString(prefix) - x.PlacementPolicy.MarshalEasyJSON(out) + if x.OwnerId != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"ownerID\":" + out.RawString(prefix) + x.OwnerId.MarshalEasyJSON(out) + } + } + { + if len(x.Nonce) != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"nonce\":" + out.RawString(prefix) + out.Base64Bytes(x.Nonce) + } + } + { + if x.BasicAcl != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"basicACL\":" + out.RawString(prefix) + out.Uint32(x.BasicAcl) + } + } + { + if len(x.Attributes) != 0 { + 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 x.PlacementPolicy != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"placementPolicy\":" + out.RawString(prefix) + x.PlacementPolicy.MarshalEasyJSON(out) + } } out.RawByte('}') } diff --git a/lock/grpc/types_frostfs.pb.go b/lock/grpc/types_frostfs.pb.go index 58be895..33f22c5 100644 --- a/lock/grpc/types_frostfs.pb.go +++ b/lock/grpc/types_frostfs.pb.go @@ -100,18 +100,26 @@ func (x *Lock) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"members\":" - out.RawString(prefix[1:]) - out.RawByte('[') - for i := range x.Members { - if i != 0 { + if len(x.Members) != 0 { + if !first { out.RawByte(',') + } else { + first = false } - x.Members[i].MarshalEasyJSON(out) + 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(']') } out.RawByte('}') } diff --git a/netmap/grpc/service_frostfs.pb.go b/netmap/grpc/service_frostfs.pb.go index 3d62855..4d53031 100644 --- a/netmap/grpc/service_frostfs.pb.go +++ b/netmap/grpc/service_frostfs.pb.go @@ -257,21 +257,43 @@ func (x *LocalNodeInfoRequest) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"body\":" - out.RawString(prefix[1:]) - x.Body.MarshalEasyJSON(out) + if x.Body != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"body\":" + out.RawString(prefix) + x.Body.MarshalEasyJSON(out) + } } { - const prefix string = ",\"metaHeader\":" - out.RawString(prefix) - x.MetaHeader.MarshalEasyJSON(out) + if x.MetaHeader != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) + } } { - const prefix string = ",\"verifyHeader\":" - out.RawString(prefix) - x.VerifyHeader.MarshalEasyJSON(out) + if x.VerifyHeader != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) + } } out.RawByte('}') } @@ -437,16 +459,31 @@ func (x *LocalNodeInfoResponse_Body) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"version\":" - out.RawString(prefix[1:]) - x.Version.MarshalEasyJSON(out) + if x.Version != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"version\":" + out.RawString(prefix) + x.Version.MarshalEasyJSON(out) + } } { - const prefix string = ",\"nodeInfo\":" - out.RawString(prefix) - x.NodeInfo.MarshalEasyJSON(out) + if x.NodeInfo != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"nodeInfo\":" + out.RawString(prefix) + x.NodeInfo.MarshalEasyJSON(out) + } } out.RawByte('}') } @@ -646,21 +683,43 @@ func (x *LocalNodeInfoResponse) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"body\":" - out.RawString(prefix[1:]) - x.Body.MarshalEasyJSON(out) + if x.Body != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"body\":" + out.RawString(prefix) + x.Body.MarshalEasyJSON(out) + } } { - const prefix string = ",\"metaHeader\":" - out.RawString(prefix) - x.MetaHeader.MarshalEasyJSON(out) + if x.MetaHeader != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) + } } { - const prefix string = ",\"verifyHeader\":" - out.RawString(prefix) - x.VerifyHeader.MarshalEasyJSON(out) + if x.VerifyHeader != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) + } } out.RawByte('}') } @@ -962,21 +1021,43 @@ func (x *NetworkInfoRequest) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"body\":" - out.RawString(prefix[1:]) - x.Body.MarshalEasyJSON(out) + if x.Body != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"body\":" + out.RawString(prefix) + x.Body.MarshalEasyJSON(out) + } } { - const prefix string = ",\"metaHeader\":" - out.RawString(prefix) - x.MetaHeader.MarshalEasyJSON(out) + if x.MetaHeader != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) + } } { - const prefix string = ",\"verifyHeader\":" - out.RawString(prefix) - x.VerifyHeader.MarshalEasyJSON(out) + if x.VerifyHeader != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) + } } out.RawByte('}') } @@ -1119,11 +1200,19 @@ func (x *NetworkInfoResponse_Body) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"networkInfo\":" - out.RawString(prefix[1:]) - x.NetworkInfo.MarshalEasyJSON(out) + if x.NetworkInfo != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"networkInfo\":" + out.RawString(prefix) + x.NetworkInfo.MarshalEasyJSON(out) + } } out.RawByte('}') } @@ -1316,21 +1405,43 @@ func (x *NetworkInfoResponse) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"body\":" - out.RawString(prefix[1:]) - x.Body.MarshalEasyJSON(out) + if x.Body != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"body\":" + out.RawString(prefix) + x.Body.MarshalEasyJSON(out) + } } { - const prefix string = ",\"metaHeader\":" - out.RawString(prefix) - x.MetaHeader.MarshalEasyJSON(out) + if x.MetaHeader != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) + } } { - const prefix string = ",\"verifyHeader\":" - out.RawString(prefix) - x.VerifyHeader.MarshalEasyJSON(out) + if x.VerifyHeader != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) + } } out.RawByte('}') } @@ -1632,21 +1743,43 @@ func (x *NetmapSnapshotRequest) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"body\":" - out.RawString(prefix[1:]) - x.Body.MarshalEasyJSON(out) + if x.Body != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"body\":" + out.RawString(prefix) + x.Body.MarshalEasyJSON(out) + } } { - const prefix string = ",\"metaHeader\":" - out.RawString(prefix) - x.MetaHeader.MarshalEasyJSON(out) + if x.MetaHeader != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) + } } { - const prefix string = ",\"verifyHeader\":" - out.RawString(prefix) - x.VerifyHeader.MarshalEasyJSON(out) + if x.VerifyHeader != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) + } } out.RawByte('}') } @@ -1789,11 +1922,19 @@ func (x *NetmapSnapshotResponse_Body) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"netmap\":" - out.RawString(prefix[1:]) - x.Netmap.MarshalEasyJSON(out) + if x.Netmap != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"netmap\":" + out.RawString(prefix) + x.Netmap.MarshalEasyJSON(out) + } } out.RawByte('}') } @@ -1986,21 +2127,43 @@ func (x *NetmapSnapshotResponse) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"body\":" - out.RawString(prefix[1:]) - x.Body.MarshalEasyJSON(out) + if x.Body != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"body\":" + out.RawString(prefix) + x.Body.MarshalEasyJSON(out) + } } { - const prefix string = ",\"metaHeader\":" - out.RawString(prefix) - x.MetaHeader.MarshalEasyJSON(out) + if x.MetaHeader != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) + } } { - const prefix string = ",\"verifyHeader\":" - out.RawString(prefix) - x.VerifyHeader.MarshalEasyJSON(out) + if x.VerifyHeader != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) + } } out.RawByte('}') } diff --git a/netmap/grpc/types_frostfs.pb.go b/netmap/grpc/types_frostfs.pb.go index 43af103..d082910 100644 --- a/netmap/grpc/types_frostfs.pb.go +++ b/netmap/grpc/types_frostfs.pb.go @@ -274,43 +274,79 @@ func (x *Filter) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"name\":" - out.RawString(prefix[1:]) - out.String(x.Name) - } - { - const prefix string = ",\"key\":" - out.RawString(prefix) - out.String(x.Key) - } - { - const prefix string = ",\"op\":" - out.RawString(prefix) - v := int32(x.Op) - if vv, ok := Operation_name[v]; ok { - out.String(vv) - } else { - out.Int32(v) - } - } - { - const prefix string = ",\"value\":" - out.RawString(prefix) - out.String(x.Value) - } - { - const prefix string = ",\"filters\":" - out.RawString(prefix) - out.RawByte('[') - for i := range x.Filters { - if i != 0 { + if len(x.Name) != 0 { + if !first { out.RawByte(',') + } else { + first = false } - x.Filters[i].MarshalEasyJSON(out) + const prefix string = "\"name\":" + out.RawString(prefix) + out.String(x.Name) + } + } + { + if len(x.Key) != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"key\":" + out.RawString(prefix) + out.String(x.Key) + } + } + { + if x.Op != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"op\":" + out.RawString(prefix) + v := int32(x.Op) + if vv, ok := Operation_name[v]; ok { + out.String(vv) + } else { + out.Int32(v) + } + } + } + { + if len(x.Value) != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"value\":" + out.RawString(prefix) + out.String(x.Value) + } + } + { + if len(x.Filters) != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"filters\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.Filters { + if i != 0 { + out.RawByte(',') + } + x.Filters[i].MarshalEasyJSON(out) + } + out.RawByte(']') } - out.RawByte(']') } out.RawByte('}') } @@ -563,36 +599,72 @@ func (x *Selector) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"name\":" - out.RawString(prefix[1:]) - out.String(x.Name) - } - { - const prefix string = ",\"count\":" - out.RawString(prefix) - out.Uint32(x.Count) - } - { - const prefix string = ",\"clause\":" - out.RawString(prefix) - v := int32(x.Clause) - if vv, ok := Clause_name[v]; ok { - out.String(vv) - } else { - out.Int32(v) + if len(x.Name) != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"name\":" + out.RawString(prefix) + out.String(x.Name) } } { - const prefix string = ",\"attribute\":" - out.RawString(prefix) - out.String(x.Attribute) + if x.Count != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"count\":" + out.RawString(prefix) + out.Uint32(x.Count) + } } { - const prefix string = ",\"filter\":" - out.RawString(prefix) - out.String(x.Filter) + if x.Clause != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"clause\":" + out.RawString(prefix) + v := int32(x.Clause) + if vv, ok := Clause_name[v]; ok { + out.String(vv) + } else { + out.Int32(v) + } + } + } + { + if len(x.Attribute) != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"attribute\":" + out.RawString(prefix) + out.String(x.Attribute) + } + } + { + if len(x.Filter) != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"filter\":" + out.RawString(prefix) + out.String(x.Filter) + } } out.RawByte('}') } @@ -817,26 +889,55 @@ func (x *Replica) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"count\":" - out.RawString(prefix[1:]) - out.Uint32(x.Count) + if x.Count != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"count\":" + out.RawString(prefix) + out.Uint32(x.Count) + } } { - const prefix string = ",\"selector\":" - out.RawString(prefix) - out.String(x.Selector) + if len(x.Selector) != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"selector\":" + out.RawString(prefix) + out.String(x.Selector) + } } { - const prefix string = ",\"ecDataCount\":" - out.RawString(prefix) - out.Uint32(x.EcDataCount) + if x.EcDataCount != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"ecDataCount\":" + out.RawString(prefix) + out.Uint32(x.EcDataCount) + } } { - const prefix string = ",\"ecParityCount\":" - out.RawString(prefix) - out.Uint32(x.EcParityCount) + if x.EcParityCount != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"ecParityCount\":" + out.RawString(prefix) + out.Uint32(x.EcParityCount) + } } out.RawByte('}') } @@ -1077,52 +1178,88 @@ func (x *PlacementPolicy) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"replicas\":" - out.RawString(prefix[1:]) - out.RawByte('[') - for i := range x.Replicas { - if i != 0 { + if len(x.Replicas) != 0 { + if !first { out.RawByte(',') + } else { + first = false } - x.Replicas[i].MarshalEasyJSON(out) + const prefix string = "\"replicas\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.Replicas { + if i != 0 { + out.RawByte(',') + } + x.Replicas[i].MarshalEasyJSON(out) + } + out.RawByte(']') } - out.RawByte(']') } { - const prefix string = ",\"containerBackupFactor\":" - out.RawString(prefix) - out.Uint32(x.ContainerBackupFactor) - } - { - const prefix string = ",\"selectors\":" - out.RawString(prefix) - out.RawByte('[') - for i := range x.Selectors { - if i != 0 { + if x.ContainerBackupFactor != 0 { + if !first { out.RawByte(',') + } else { + first = false } - x.Selectors[i].MarshalEasyJSON(out) + const prefix string = "\"containerBackupFactor\":" + out.RawString(prefix) + out.Uint32(x.ContainerBackupFactor) } - out.RawByte(']') } { - const prefix string = ",\"filters\":" - out.RawString(prefix) - out.RawByte('[') - for i := range x.Filters { - if i != 0 { + if len(x.Selectors) != 0 { + if !first { out.RawByte(',') + } else { + first = false } - x.Filters[i].MarshalEasyJSON(out) + const prefix string = "\"selectors\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.Selectors { + if i != 0 { + out.RawByte(',') + } + x.Selectors[i].MarshalEasyJSON(out) + } + out.RawByte(']') } - out.RawByte(']') } { - const prefix string = ",\"unique\":" - out.RawString(prefix) - out.Bool(x.Unique) + if len(x.Filters) != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"filters\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.Filters { + if i != 0 { + out.RawByte(',') + } + x.Filters[i].MarshalEasyJSON(out) + } + out.RawByte(']') + } + } + { + if x.Unique { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"unique\":" + out.RawString(prefix) + out.Bool(x.Unique) + } } out.RawByte('}') } @@ -1373,28 +1510,50 @@ func (x *NodeInfo_Attribute) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"key\":" - out.RawString(prefix[1:]) - out.String(x.Key) - } - { - const prefix string = ",\"value\":" - out.RawString(prefix) - out.String(x.Value) - } - { - const prefix string = ",\"parents\":" - out.RawString(prefix) - out.RawByte('[') - for i := range x.Parents { - if i != 0 { + if len(x.Key) != 0 { + if !first { out.RawByte(',') + } else { + first = false } - out.String(x.Parents[i]) + const prefix string = "\"key\":" + out.RawString(prefix) + out.String(x.Key) + } + } + { + if len(x.Value) != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"value\":" + out.RawString(prefix) + out.String(x.Value) + } + } + { + if len(x.Parents) != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"parents\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.Parents { + if i != 0 { + out.RawByte(',') + } + out.String(x.Parents[i]) + } + out.RawByte(']') } - out.RawByte(']') } out.RawByte('}') } @@ -1604,44 +1763,73 @@ func (x *NodeInfo) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"publicKey\":" - out.RawString(prefix[1:]) - out.Base64Bytes(x.PublicKey) - } - { - const prefix string = ",\"addresses\":" - out.RawString(prefix) - out.RawByte('[') - for i := range x.Addresses { - if i != 0 { + if len(x.PublicKey) != 0 { + if !first { out.RawByte(',') + } else { + first = false } - out.String(x.Addresses[i]) + const prefix string = "\"publicKey\":" + out.RawString(prefix) + out.Base64Bytes(x.PublicKey) } - out.RawByte(']') } { - const prefix string = ",\"attributes\":" - out.RawString(prefix) - out.RawByte('[') - for i := range x.Attributes { - if i != 0 { + if len(x.Addresses) != 0 { + if !first { out.RawByte(',') + } else { + first = false } - x.Attributes[i].MarshalEasyJSON(out) + const prefix string = "\"addresses\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.Addresses { + if i != 0 { + out.RawByte(',') + } + out.String(x.Addresses[i]) + } + out.RawByte(']') } - out.RawByte(']') } { - const prefix string = ",\"state\":" - out.RawString(prefix) - v := int32(x.State) - if vv, ok := NodeInfo_State_name[v]; ok { - out.String(vv) - } else { - out.Int32(v) + if len(x.Attributes) != 0 { + 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 x.State != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"state\":" + out.RawString(prefix) + v := int32(x.State) + if vv, ok := NodeInfo_State_name[v]; ok { + out.String(vv) + } else { + out.Int32(v) + } } } out.RawByte('}') @@ -1842,23 +2030,38 @@ func (x *Netmap) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"epoch\":" - out.RawString(prefix[1:]) - out.Uint64(x.Epoch) + if x.Epoch != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"epoch\":" + out.RawString(prefix) + out.Uint64(x.Epoch) + } } { - const prefix string = ",\"nodes\":" - out.RawString(prefix) - out.RawByte('[') - for i := range x.Nodes { - if i != 0 { + if len(x.Nodes) != 0 { + if !first { out.RawByte(',') + } else { + first = false } - x.Nodes[i].MarshalEasyJSON(out) + const prefix string = "\"nodes\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.Nodes { + if i != 0 { + out.RawByte(',') + } + x.Nodes[i].MarshalEasyJSON(out) + } + out.RawByte(']') } - out.RawByte(']') } out.RawByte('}') } @@ -2017,16 +2220,31 @@ func (x *NetworkConfig_Parameter) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"key\":" - out.RawString(prefix[1:]) - out.Base64Bytes(x.Key) + if len(x.Key) != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"key\":" + out.RawString(prefix) + out.Base64Bytes(x.Key) + } } { - const prefix string = ",\"value\":" - out.RawString(prefix) - out.Base64Bytes(x.Value) + if len(x.Value) != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"value\":" + out.RawString(prefix) + out.Base64Bytes(x.Value) + } } out.RawByte('}') } @@ -2163,18 +2381,26 @@ func (x *NetworkConfig) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"parameters\":" - out.RawString(prefix[1:]) - out.RawByte('[') - for i := range x.Parameters { - if i != 0 { + if len(x.Parameters) != 0 { + if !first { out.RawByte(',') + } else { + first = false } - x.Parameters[i].MarshalEasyJSON(out) + const prefix string = "\"parameters\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.Parameters { + if i != 0 { + out.RawByte(',') + } + x.Parameters[i].MarshalEasyJSON(out) + } + out.RawByte(']') } - out.RawByte(']') } out.RawByte('}') } @@ -2370,26 +2596,55 @@ func (x *NetworkInfo) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"currentEpoch\":" - out.RawString(prefix[1:]) - out.Uint64(x.CurrentEpoch) + if x.CurrentEpoch != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"currentEpoch\":" + out.RawString(prefix) + out.Uint64(x.CurrentEpoch) + } } { - const prefix string = ",\"magicNumber\":" - out.RawString(prefix) - out.Uint64(x.MagicNumber) + if x.MagicNumber != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"magicNumber\":" + out.RawString(prefix) + out.Uint64(x.MagicNumber) + } } { - const prefix string = ",\"msPerBlock\":" - out.RawString(prefix) - out.Int64(x.MsPerBlock) + if x.MsPerBlock != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"msPerBlock\":" + out.RawString(prefix) + out.Int64(x.MsPerBlock) + } } { - const prefix string = ",\"networkConfig\":" - out.RawString(prefix) - x.NetworkConfig.MarshalEasyJSON(out) + if x.NetworkConfig != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"networkConfig\":" + out.RawString(prefix) + x.NetworkConfig.MarshalEasyJSON(out) + } } out.RawByte('}') } diff --git a/object/grpc/service_frostfs.pb.go b/object/grpc/service_frostfs.pb.go index 188d032..2434bd3 100644 --- a/object/grpc/service_frostfs.pb.go +++ b/object/grpc/service_frostfs.pb.go @@ -119,16 +119,31 @@ func (x *GetRequest_Body) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"address\":" - out.RawString(prefix[1:]) - x.Address.MarshalEasyJSON(out) + if x.Address != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"address\":" + out.RawString(prefix) + x.Address.MarshalEasyJSON(out) + } } { - const prefix string = ",\"raw\":" - out.RawString(prefix) - out.Bool(x.Raw) + if x.Raw { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"raw\":" + out.RawString(prefix) + out.Bool(x.Raw) + } } out.RawByte('}') } @@ -327,21 +342,43 @@ func (x *GetRequest) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"body\":" - out.RawString(prefix[1:]) - x.Body.MarshalEasyJSON(out) + if x.Body != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"body\":" + out.RawString(prefix) + x.Body.MarshalEasyJSON(out) + } } { - const prefix string = ",\"metaHeader\":" - out.RawString(prefix) - x.MetaHeader.MarshalEasyJSON(out) + if x.MetaHeader != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) + } } { - const prefix string = ",\"verifyHeader\":" - out.RawString(prefix) - x.VerifyHeader.MarshalEasyJSON(out) + if x.VerifyHeader != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) + } } out.RawByte('}') } @@ -530,21 +567,43 @@ func (x *GetResponse_Body_Init) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"objectId\":" - out.RawString(prefix[1:]) - x.ObjectId.MarshalEasyJSON(out) + if x.ObjectId != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"objectId\":" + out.RawString(prefix) + x.ObjectId.MarshalEasyJSON(out) + } } { - const prefix string = ",\"signature\":" - out.RawString(prefix) - x.Signature.MarshalEasyJSON(out) + if x.Signature != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"signature\":" + out.RawString(prefix) + x.Signature.MarshalEasyJSON(out) + } } { - const prefix string = ",\"header\":" - out.RawString(prefix) - x.Header.MarshalEasyJSON(out) + if x.Header != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"header\":" + out.RawString(prefix) + x.Header.MarshalEasyJSON(out) + } } out.RawByte('}') } @@ -787,31 +846,60 @@ func (x *GetResponse_Body) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') switch xx := x.ObjectPart.(type) { case *GetResponse_Body_Init_: { - const prefix string = ",\"init\":" - out.RawString(prefix[1:]) - xx.Init.MarshalEasyJSON(out) + if xx.Init != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"init\":" + out.RawString(prefix) + xx.Init.MarshalEasyJSON(out) + } } case *GetResponse_Body_Chunk: { - const prefix string = ",\"chunk\":" - out.RawString(prefix[1:]) - out.Base64Bytes(xx.Chunk) + if len(xx.Chunk) != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"chunk\":" + out.RawString(prefix) + out.Base64Bytes(xx.Chunk) + } } case *GetResponse_Body_SplitInfo: { - const prefix string = ",\"splitInfo\":" - out.RawString(prefix[1:]) - xx.SplitInfo.MarshalEasyJSON(out) + if xx.SplitInfo != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"splitInfo\":" + out.RawString(prefix) + xx.SplitInfo.MarshalEasyJSON(out) + } } case *GetResponse_Body_EcInfo: { - const prefix string = ",\"ecInfo\":" - out.RawString(prefix[1:]) - xx.EcInfo.MarshalEasyJSON(out) + if xx.EcInfo != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"ecInfo\":" + out.RawString(prefix) + xx.EcInfo.MarshalEasyJSON(out) + } } } out.RawByte('}') @@ -1061,21 +1149,43 @@ func (x *GetResponse) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"body\":" - out.RawString(prefix[1:]) - x.Body.MarshalEasyJSON(out) + if x.Body != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"body\":" + out.RawString(prefix) + x.Body.MarshalEasyJSON(out) + } } { - const prefix string = ",\"metaHeader\":" - out.RawString(prefix) - x.MetaHeader.MarshalEasyJSON(out) + if x.MetaHeader != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) + } } { - const prefix string = ",\"verifyHeader\":" - out.RawString(prefix) - x.VerifyHeader.MarshalEasyJSON(out) + if x.VerifyHeader != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) + } } out.RawByte('}') } @@ -1286,33 +1396,62 @@ func (x *PutRequest_Body_Init) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"objectId\":" - out.RawString(prefix[1:]) - x.ObjectId.MarshalEasyJSON(out) - } - { - const prefix string = ",\"signature\":" - out.RawString(prefix) - x.Signature.MarshalEasyJSON(out) - } - { - const prefix string = ",\"header\":" - out.RawString(prefix) - x.Header.MarshalEasyJSON(out) - } - { - const prefix string = ",\"copiesNumber\":" - out.RawString(prefix) - out.RawByte('[') - for i := range x.CopiesNumber { - if i != 0 { + if x.ObjectId != nil { + if !first { out.RawByte(',') + } else { + first = false } - out.Uint32(x.CopiesNumber[i]) + const prefix string = "\"objectId\":" + out.RawString(prefix) + x.ObjectId.MarshalEasyJSON(out) + } + } + { + if x.Signature != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"signature\":" + out.RawString(prefix) + x.Signature.MarshalEasyJSON(out) + } + } + { + if x.Header != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"header\":" + out.RawString(prefix) + x.Header.MarshalEasyJSON(out) + } + } + { + if len(x.CopiesNumber) != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"copiesNumber\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.CopiesNumber { + if i != 0 { + out.RawByte(',') + } + out.Uint32(x.CopiesNumber[i]) + } + out.RawByte(']') } - out.RawByte(']') } out.RawByte('}') } @@ -1514,19 +1653,34 @@ func (x *PutRequest_Body) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') switch xx := x.ObjectPart.(type) { case *PutRequest_Body_Init_: { - const prefix string = ",\"init\":" - out.RawString(prefix[1:]) - xx.Init.MarshalEasyJSON(out) + if xx.Init != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"init\":" + out.RawString(prefix) + xx.Init.MarshalEasyJSON(out) + } } case *PutRequest_Body_Chunk: { - const prefix string = ",\"chunk\":" - out.RawString(prefix[1:]) - out.Base64Bytes(xx.Chunk) + if len(xx.Chunk) != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"chunk\":" + out.RawString(prefix) + out.Base64Bytes(xx.Chunk) + } } } out.RawByte('}') @@ -1746,21 +1900,43 @@ func (x *PutRequest) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"body\":" - out.RawString(prefix[1:]) - x.Body.MarshalEasyJSON(out) + if x.Body != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"body\":" + out.RawString(prefix) + x.Body.MarshalEasyJSON(out) + } } { - const prefix string = ",\"metaHeader\":" - out.RawString(prefix) - x.MetaHeader.MarshalEasyJSON(out) + if x.MetaHeader != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) + } } { - const prefix string = ",\"verifyHeader\":" - out.RawString(prefix) - x.VerifyHeader.MarshalEasyJSON(out) + if x.VerifyHeader != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) + } } out.RawByte('}') } @@ -1903,11 +2079,19 @@ func (x *PutResponse_Body) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"objectId\":" - out.RawString(prefix[1:]) - x.ObjectId.MarshalEasyJSON(out) + if x.ObjectId != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"objectId\":" + out.RawString(prefix) + x.ObjectId.MarshalEasyJSON(out) + } } out.RawByte('}') } @@ -2100,21 +2284,43 @@ func (x *PutResponse) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"body\":" - out.RawString(prefix[1:]) - x.Body.MarshalEasyJSON(out) + if x.Body != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"body\":" + out.RawString(prefix) + x.Body.MarshalEasyJSON(out) + } } { - const prefix string = ",\"metaHeader\":" - out.RawString(prefix) - x.MetaHeader.MarshalEasyJSON(out) + if x.MetaHeader != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) + } } { - const prefix string = ",\"verifyHeader\":" - out.RawString(prefix) - x.VerifyHeader.MarshalEasyJSON(out) + if x.VerifyHeader != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) + } } out.RawByte('}') } @@ -2257,11 +2463,19 @@ func (x *DeleteRequest_Body) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"address\":" - out.RawString(prefix[1:]) - x.Address.MarshalEasyJSON(out) + if x.Address != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"address\":" + out.RawString(prefix) + x.Address.MarshalEasyJSON(out) + } } out.RawByte('}') } @@ -2454,21 +2668,43 @@ func (x *DeleteRequest) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"body\":" - out.RawString(prefix[1:]) - x.Body.MarshalEasyJSON(out) + if x.Body != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"body\":" + out.RawString(prefix) + x.Body.MarshalEasyJSON(out) + } } { - const prefix string = ",\"metaHeader\":" - out.RawString(prefix) - x.MetaHeader.MarshalEasyJSON(out) + if x.MetaHeader != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) + } } { - const prefix string = ",\"verifyHeader\":" - out.RawString(prefix) - x.VerifyHeader.MarshalEasyJSON(out) + if x.VerifyHeader != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) + } } out.RawByte('}') } @@ -2611,11 +2847,19 @@ func (x *DeleteResponse_Body) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"tombstone\":" - out.RawString(prefix[1:]) - x.Tombstone.MarshalEasyJSON(out) + if x.Tombstone != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"tombstone\":" + out.RawString(prefix) + x.Tombstone.MarshalEasyJSON(out) + } } out.RawByte('}') } @@ -2808,21 +3052,43 @@ func (x *DeleteResponse) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"body\":" - out.RawString(prefix[1:]) - x.Body.MarshalEasyJSON(out) + if x.Body != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"body\":" + out.RawString(prefix) + x.Body.MarshalEasyJSON(out) + } } { - const prefix string = ",\"metaHeader\":" - out.RawString(prefix) - x.MetaHeader.MarshalEasyJSON(out) + if x.MetaHeader != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) + } } { - const prefix string = ",\"verifyHeader\":" - out.RawString(prefix) - x.VerifyHeader.MarshalEasyJSON(out) + if x.VerifyHeader != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) + } } out.RawByte('}') } @@ -3005,21 +3271,43 @@ func (x *HeadRequest_Body) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"address\":" - out.RawString(prefix[1:]) - x.Address.MarshalEasyJSON(out) + if x.Address != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"address\":" + out.RawString(prefix) + x.Address.MarshalEasyJSON(out) + } } { - const prefix string = ",\"mainOnly\":" - out.RawString(prefix) - out.Bool(x.MainOnly) + if x.MainOnly { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"mainOnly\":" + out.RawString(prefix) + out.Bool(x.MainOnly) + } } { - const prefix string = ",\"raw\":" - out.RawString(prefix) - out.Bool(x.Raw) + if x.Raw { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"raw\":" + out.RawString(prefix) + out.Bool(x.Raw) + } } out.RawByte('}') } @@ -3224,21 +3512,43 @@ func (x *HeadRequest) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"body\":" - out.RawString(prefix[1:]) - x.Body.MarshalEasyJSON(out) + if x.Body != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"body\":" + out.RawString(prefix) + x.Body.MarshalEasyJSON(out) + } } { - const prefix string = ",\"metaHeader\":" - out.RawString(prefix) - x.MetaHeader.MarshalEasyJSON(out) + if x.MetaHeader != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) + } } { - const prefix string = ",\"verifyHeader\":" - out.RawString(prefix) - x.VerifyHeader.MarshalEasyJSON(out) + if x.VerifyHeader != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) + } } out.RawByte('}') } @@ -3404,16 +3714,31 @@ func (x *HeaderWithSignature) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"header\":" - out.RawString(prefix[1:]) - x.Header.MarshalEasyJSON(out) + if x.Header != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"header\":" + out.RawString(prefix) + x.Header.MarshalEasyJSON(out) + } } { - const prefix string = ",\"signature\":" - out.RawString(prefix) - x.Signature.MarshalEasyJSON(out) + if x.Signature != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"signature\":" + out.RawString(prefix) + x.Signature.MarshalEasyJSON(out) + } } out.RawByte('}') } @@ -3644,31 +3969,60 @@ func (x *HeadResponse_Body) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') switch xx := x.Head.(type) { case *HeadResponse_Body_Header: { - const prefix string = ",\"header\":" - out.RawString(prefix[1:]) - xx.Header.MarshalEasyJSON(out) + if xx.Header != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"header\":" + out.RawString(prefix) + xx.Header.MarshalEasyJSON(out) + } } case *HeadResponse_Body_ShortHeader: { - const prefix string = ",\"shortHeader\":" - out.RawString(prefix[1:]) - xx.ShortHeader.MarshalEasyJSON(out) + if xx.ShortHeader != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"shortHeader\":" + out.RawString(prefix) + xx.ShortHeader.MarshalEasyJSON(out) + } } case *HeadResponse_Body_SplitInfo: { - const prefix string = ",\"splitInfo\":" - out.RawString(prefix[1:]) - xx.SplitInfo.MarshalEasyJSON(out) + if xx.SplitInfo != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"splitInfo\":" + out.RawString(prefix) + xx.SplitInfo.MarshalEasyJSON(out) + } } case *HeadResponse_Body_EcInfo: { - const prefix string = ",\"ecInfo\":" - out.RawString(prefix[1:]) - xx.EcInfo.MarshalEasyJSON(out) + if xx.EcInfo != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"ecInfo\":" + out.RawString(prefix) + xx.EcInfo.MarshalEasyJSON(out) + } } } out.RawByte('}') @@ -3919,21 +4273,43 @@ func (x *HeadResponse) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"body\":" - out.RawString(prefix[1:]) - x.Body.MarshalEasyJSON(out) + if x.Body != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"body\":" + out.RawString(prefix) + x.Body.MarshalEasyJSON(out) + } } { - const prefix string = ",\"metaHeader\":" - out.RawString(prefix) - x.MetaHeader.MarshalEasyJSON(out) + if x.MetaHeader != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) + } } { - const prefix string = ",\"verifyHeader\":" - out.RawString(prefix) - x.VerifyHeader.MarshalEasyJSON(out) + if x.VerifyHeader != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) + } } out.RawByte('}') } @@ -4113,26 +4489,48 @@ func (x *SearchRequest_Body_Filter) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"matchType\":" - out.RawString(prefix[1:]) - v := int32(x.MatchType) - if vv, ok := MatchType_name[v]; ok { - out.String(vv) - } else { - out.Int32(v) + if x.MatchType != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"matchType\":" + out.RawString(prefix) + v := int32(x.MatchType) + if vv, ok := MatchType_name[v]; ok { + out.String(vv) + } else { + out.Int32(v) + } } } { - const prefix string = ",\"key\":" - out.RawString(prefix) - out.String(x.Key) + if len(x.Key) != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"key\":" + out.RawString(prefix) + out.String(x.Key) + } } { - const prefix string = ",\"value\":" - out.RawString(prefix) - out.String(x.Value) + if len(x.Value) != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"value\":" + out.RawString(prefix) + out.String(x.Value) + } } out.RawByte('}') } @@ -4334,28 +4732,50 @@ func (x *SearchRequest_Body) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"containerId\":" - out.RawString(prefix[1:]) - x.ContainerId.MarshalEasyJSON(out) - } - { - const prefix string = ",\"version\":" - out.RawString(prefix) - out.Uint32(x.Version) - } - { - const prefix string = ",\"filters\":" - out.RawString(prefix) - out.RawByte('[') - for i := range x.Filters { - if i != 0 { + if x.ContainerId != nil { + if !first { out.RawByte(',') + } else { + first = false } - x.Filters[i].MarshalEasyJSON(out) + const prefix string = "\"containerId\":" + out.RawString(prefix) + x.ContainerId.MarshalEasyJSON(out) + } + } + { + if x.Version != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"version\":" + out.RawString(prefix) + out.Uint32(x.Version) + } + } + { + if len(x.Filters) != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"filters\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.Filters { + if i != 0 { + out.RawByte(',') + } + x.Filters[i].MarshalEasyJSON(out) + } + out.RawByte(']') } - out.RawByte(']') } out.RawByte('}') } @@ -4568,21 +4988,43 @@ func (x *SearchRequest) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"body\":" - out.RawString(prefix[1:]) - x.Body.MarshalEasyJSON(out) + if x.Body != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"body\":" + out.RawString(prefix) + x.Body.MarshalEasyJSON(out) + } } { - const prefix string = ",\"metaHeader\":" - out.RawString(prefix) - x.MetaHeader.MarshalEasyJSON(out) + if x.MetaHeader != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) + } } { - const prefix string = ",\"verifyHeader\":" - out.RawString(prefix) - x.VerifyHeader.MarshalEasyJSON(out) + if x.VerifyHeader != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) + } } out.RawByte('}') } @@ -4728,18 +5170,26 @@ func (x *SearchResponse_Body) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"idList\":" - out.RawString(prefix[1:]) - out.RawByte('[') - for i := range x.IdList { - if i != 0 { + if len(x.IdList) != 0 { + if !first { out.RawByte(',') + } else { + first = false } - x.IdList[i].MarshalEasyJSON(out) + const prefix string = "\"idList\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.IdList { + if i != 0 { + out.RawByte(',') + } + x.IdList[i].MarshalEasyJSON(out) + } + out.RawByte(']') } - out.RawByte(']') } out.RawByte('}') } @@ -4939,21 +5389,43 @@ func (x *SearchResponse) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"body\":" - out.RawString(prefix[1:]) - x.Body.MarshalEasyJSON(out) + if x.Body != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"body\":" + out.RawString(prefix) + x.Body.MarshalEasyJSON(out) + } } { - const prefix string = ",\"metaHeader\":" - out.RawString(prefix) - x.MetaHeader.MarshalEasyJSON(out) + if x.MetaHeader != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) + } } { - const prefix string = ",\"verifyHeader\":" - out.RawString(prefix) - x.VerifyHeader.MarshalEasyJSON(out) + if x.VerifyHeader != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) + } } out.RawByte('}') } @@ -5113,16 +5585,31 @@ func (x *Range) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"offset\":" - out.RawString(prefix[1:]) - out.Uint64(x.Offset) + if x.Offset != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"offset\":" + out.RawString(prefix) + out.Uint64(x.Offset) + } } { - const prefix string = ",\"length\":" - out.RawString(prefix) - out.Uint64(x.Length) + if x.Length != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"length\":" + out.RawString(prefix) + out.Uint64(x.Length) + } } out.RawByte('}') } @@ -5299,21 +5786,43 @@ func (x *GetRangeRequest_Body) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"address\":" - out.RawString(prefix[1:]) - x.Address.MarshalEasyJSON(out) + if x.Address != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"address\":" + out.RawString(prefix) + x.Address.MarshalEasyJSON(out) + } } { - const prefix string = ",\"range\":" - out.RawString(prefix) - x.Range.MarshalEasyJSON(out) + if x.Range != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"range\":" + out.RawString(prefix) + x.Range.MarshalEasyJSON(out) + } } { - const prefix string = ",\"raw\":" - out.RawString(prefix) - out.Bool(x.Raw) + if x.Raw { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"raw\":" + out.RawString(prefix) + out.Bool(x.Raw) + } } out.RawByte('}') } @@ -5519,21 +6028,43 @@ func (x *GetRangeRequest) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"body\":" - out.RawString(prefix[1:]) - x.Body.MarshalEasyJSON(out) + if x.Body != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"body\":" + out.RawString(prefix) + x.Body.MarshalEasyJSON(out) + } } { - const prefix string = ",\"metaHeader\":" - out.RawString(prefix) - x.MetaHeader.MarshalEasyJSON(out) + if x.MetaHeader != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) + } } { - const prefix string = ",\"verifyHeader\":" - out.RawString(prefix) - x.VerifyHeader.MarshalEasyJSON(out) + if x.VerifyHeader != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) + } } out.RawByte('}') } @@ -5749,25 +6280,47 @@ func (x *GetRangeResponse_Body) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') switch xx := x.RangePart.(type) { case *GetRangeResponse_Body_Chunk: { - const prefix string = ",\"chunk\":" - out.RawString(prefix[1:]) - out.Base64Bytes(xx.Chunk) + if len(xx.Chunk) != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"chunk\":" + out.RawString(prefix) + out.Base64Bytes(xx.Chunk) + } } case *GetRangeResponse_Body_SplitInfo: { - const prefix string = ",\"splitInfo\":" - out.RawString(prefix[1:]) - xx.SplitInfo.MarshalEasyJSON(out) + if xx.SplitInfo != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"splitInfo\":" + out.RawString(prefix) + xx.SplitInfo.MarshalEasyJSON(out) + } } case *GetRangeResponse_Body_EcInfo: { - const prefix string = ",\"ecInfo\":" - out.RawString(prefix[1:]) - xx.EcInfo.MarshalEasyJSON(out) + if xx.EcInfo != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"ecInfo\":" + out.RawString(prefix) + xx.EcInfo.MarshalEasyJSON(out) + } } } out.RawByte('}') @@ -6002,21 +6555,43 @@ func (x *GetRangeResponse) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"body\":" - out.RawString(prefix[1:]) - x.Body.MarshalEasyJSON(out) + if x.Body != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"body\":" + out.RawString(prefix) + x.Body.MarshalEasyJSON(out) + } } { - const prefix string = ",\"metaHeader\":" - out.RawString(prefix) - x.MetaHeader.MarshalEasyJSON(out) + if x.MetaHeader != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) + } } { - const prefix string = ",\"verifyHeader\":" - out.RawString(prefix) - x.VerifyHeader.MarshalEasyJSON(out) + if x.VerifyHeader != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) + } } out.RawByte('}') } @@ -6225,37 +6800,66 @@ func (x *GetRangeHashRequest_Body) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"address\":" - out.RawString(prefix[1:]) - x.Address.MarshalEasyJSON(out) - } - { - const prefix string = ",\"ranges\":" - out.RawString(prefix) - out.RawByte('[') - for i := range x.Ranges { - if i != 0 { + if x.Address != nil { + if !first { out.RawByte(',') + } else { + first = false } - x.Ranges[i].MarshalEasyJSON(out) + const prefix string = "\"address\":" + out.RawString(prefix) + x.Address.MarshalEasyJSON(out) } - out.RawByte(']') } { - const prefix string = ",\"salt\":" - out.RawString(prefix) - out.Base64Bytes(x.Salt) + if len(x.Ranges) != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"ranges\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.Ranges { + if i != 0 { + out.RawByte(',') + } + x.Ranges[i].MarshalEasyJSON(out) + } + out.RawByte(']') + } } { - const prefix string = ",\"type\":" - out.RawString(prefix) - v := int32(x.Type) - if vv, ok := grpc.ChecksumType_name[v]; ok { - out.String(vv) - } else { - out.Int32(v) + if len(x.Salt) != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"salt\":" + out.RawString(prefix) + out.Base64Bytes(x.Salt) + } + } + { + if x.Type != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"type\":" + out.RawString(prefix) + v := int32(x.Type) + if vv, ok := grpc.ChecksumType_name[v]; ok { + out.String(vv) + } else { + out.Int32(v) + } } } out.RawByte('}') @@ -6491,21 +7095,43 @@ func (x *GetRangeHashRequest) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"body\":" - out.RawString(prefix[1:]) - x.Body.MarshalEasyJSON(out) + if x.Body != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"body\":" + out.RawString(prefix) + x.Body.MarshalEasyJSON(out) + } } { - const prefix string = ",\"metaHeader\":" - out.RawString(prefix) - x.MetaHeader.MarshalEasyJSON(out) + if x.MetaHeader != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) + } } { - const prefix string = ",\"verifyHeader\":" - out.RawString(prefix) - x.VerifyHeader.MarshalEasyJSON(out) + if x.VerifyHeader != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) + } } out.RawByte('}') } @@ -6665,28 +7291,43 @@ func (x *GetRangeHashResponse_Body) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"type\":" - out.RawString(prefix[1:]) - v := int32(x.Type) - if vv, ok := grpc.ChecksumType_name[v]; ok { - out.String(vv) - } else { - out.Int32(v) + if x.Type != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"type\":" + out.RawString(prefix) + v := int32(x.Type) + if vv, ok := grpc.ChecksumType_name[v]; ok { + out.String(vv) + } else { + out.Int32(v) + } } } { - const prefix string = ",\"hashList\":" - out.RawString(prefix) - out.RawByte('[') - for i := range x.HashList { - if i != 0 { + if len(x.HashList) != 0 { + if !first { out.RawByte(',') + } else { + first = false } - out.Base64Bytes(x.HashList[i]) + const prefix string = "\"hashList\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.HashList { + if i != 0 { + out.RawByte(',') + } + out.Base64Bytes(x.HashList[i]) + } + out.RawByte(']') } - out.RawByte(']') } out.RawByte('}') } @@ -6907,21 +7548,43 @@ func (x *GetRangeHashResponse) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"body\":" - out.RawString(prefix[1:]) - x.Body.MarshalEasyJSON(out) + if x.Body != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"body\":" + out.RawString(prefix) + x.Body.MarshalEasyJSON(out) + } } { - const prefix string = ",\"metaHeader\":" - out.RawString(prefix) - x.MetaHeader.MarshalEasyJSON(out) + if x.MetaHeader != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) + } } { - const prefix string = ",\"verifyHeader\":" - out.RawString(prefix) - x.VerifyHeader.MarshalEasyJSON(out) + if x.VerifyHeader != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) + } } out.RawByte('}') } @@ -7086,23 +7749,38 @@ func (x *PutSingleRequest_Body) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"object\":" - out.RawString(prefix[1:]) - x.Object.MarshalEasyJSON(out) + if x.Object != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"object\":" + out.RawString(prefix) + x.Object.MarshalEasyJSON(out) + } } { - const prefix string = ",\"copiesNumber\":" - out.RawString(prefix) - out.RawByte('[') - for i := range x.CopiesNumber { - if i != 0 { + if len(x.CopiesNumber) != 0 { + if !first { out.RawByte(',') + } else { + first = false } - out.Uint32(x.CopiesNumber[i]) + const prefix string = "\"copiesNumber\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.CopiesNumber { + if i != 0 { + out.RawByte(',') + } + out.Uint32(x.CopiesNumber[i]) + } + out.RawByte(']') } - out.RawByte(']') } out.RawByte('}') } @@ -7308,21 +7986,43 @@ func (x *PutSingleRequest) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"body\":" - out.RawString(prefix[1:]) - x.Body.MarshalEasyJSON(out) + if x.Body != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"body\":" + out.RawString(prefix) + x.Body.MarshalEasyJSON(out) + } } { - const prefix string = ",\"metaHeader\":" - out.RawString(prefix) - x.MetaHeader.MarshalEasyJSON(out) + if x.MetaHeader != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) + } } { - const prefix string = ",\"verifyHeader\":" - out.RawString(prefix) - x.VerifyHeader.MarshalEasyJSON(out) + if x.VerifyHeader != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) + } } out.RawByte('}') } @@ -7624,21 +8324,43 @@ func (x *PutSingleResponse) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"body\":" - out.RawString(prefix[1:]) - x.Body.MarshalEasyJSON(out) + if x.Body != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"body\":" + out.RawString(prefix) + x.Body.MarshalEasyJSON(out) + } } { - const prefix string = ",\"metaHeader\":" - out.RawString(prefix) - x.MetaHeader.MarshalEasyJSON(out) + if x.MetaHeader != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) + } } { - const prefix string = ",\"verifyHeader\":" - out.RawString(prefix) - x.VerifyHeader.MarshalEasyJSON(out) + if x.VerifyHeader != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) + } } out.RawByte('}') } @@ -7801,16 +8523,31 @@ func (x *PatchRequest_Body_Patch) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"sourceRange\":" - out.RawString(prefix[1:]) - x.SourceRange.MarshalEasyJSON(out) + if x.SourceRange != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"sourceRange\":" + out.RawString(prefix) + x.SourceRange.MarshalEasyJSON(out) + } } { - const prefix string = ",\"chunk\":" - out.RawString(prefix) - out.Base64Bytes(x.Chunk) + if len(x.Chunk) != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"chunk\":" + out.RawString(prefix) + out.Base64Bytes(x.Chunk) + } } out.RawByte('}') } @@ -8014,33 +8751,62 @@ func (x *PatchRequest_Body) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"address\":" - out.RawString(prefix[1:]) - x.Address.MarshalEasyJSON(out) - } - { - const prefix string = ",\"newAttributes\":" - out.RawString(prefix) - out.RawByte('[') - for i := range x.NewAttributes { - if i != 0 { + if x.Address != nil { + if !first { out.RawByte(',') + } else { + first = false } - x.NewAttributes[i].MarshalEasyJSON(out) + const prefix string = "\"address\":" + out.RawString(prefix) + x.Address.MarshalEasyJSON(out) } - out.RawByte(']') } { - const prefix string = ",\"replaceAttributes\":" - out.RawString(prefix) - out.Bool(x.ReplaceAttributes) + if len(x.NewAttributes) != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"newAttributes\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.NewAttributes { + if i != 0 { + out.RawByte(',') + } + x.NewAttributes[i].MarshalEasyJSON(out) + } + out.RawByte(']') + } } { - const prefix string = ",\"patch\":" - out.RawString(prefix) - x.Patch.MarshalEasyJSON(out) + if x.ReplaceAttributes { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"replaceAttributes\":" + out.RawString(prefix) + out.Bool(x.ReplaceAttributes) + } + } + { + if x.Patch != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"patch\":" + out.RawString(prefix) + x.Patch.MarshalEasyJSON(out) + } } out.RawByte('}') } @@ -8260,21 +9026,43 @@ func (x *PatchRequest) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"body\":" - out.RawString(prefix[1:]) - x.Body.MarshalEasyJSON(out) + if x.Body != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"body\":" + out.RawString(prefix) + x.Body.MarshalEasyJSON(out) + } } { - const prefix string = ",\"metaHeader\":" - out.RawString(prefix) - x.MetaHeader.MarshalEasyJSON(out) + if x.MetaHeader != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) + } } { - const prefix string = ",\"verifyHeader\":" - out.RawString(prefix) - x.VerifyHeader.MarshalEasyJSON(out) + if x.VerifyHeader != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) + } } out.RawByte('}') } @@ -8417,11 +9205,19 @@ func (x *PatchResponse_Body) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"objectId\":" - out.RawString(prefix[1:]) - x.ObjectId.MarshalEasyJSON(out) + if x.ObjectId != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"objectId\":" + out.RawString(prefix) + x.ObjectId.MarshalEasyJSON(out) + } } out.RawByte('}') } @@ -8614,21 +9410,43 @@ func (x *PatchResponse) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"body\":" - out.RawString(prefix[1:]) - x.Body.MarshalEasyJSON(out) + if x.Body != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"body\":" + out.RawString(prefix) + x.Body.MarshalEasyJSON(out) + } } { - const prefix string = ",\"metaHeader\":" - out.RawString(prefix) - x.MetaHeader.MarshalEasyJSON(out) + if x.MetaHeader != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) + } } { - const prefix string = ",\"verifyHeader\":" - out.RawString(prefix) - x.VerifyHeader.MarshalEasyJSON(out) + if x.VerifyHeader != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) + } } out.RawByte('}') } diff --git a/object/grpc/types_frostfs.pb.go b/object/grpc/types_frostfs.pb.go index 9fc2769..5b1eb2c 100644 --- a/object/grpc/types_frostfs.pb.go +++ b/object/grpc/types_frostfs.pb.go @@ -304,46 +304,96 @@ func (x *ShortHeader) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"version\":" - out.RawString(prefix[1:]) - x.Version.MarshalEasyJSON(out) - } - { - const prefix string = ",\"creationEpoch\":" - out.RawString(prefix) - out.Uint64(x.CreationEpoch) - } - { - const prefix string = ",\"ownerID\":" - out.RawString(prefix) - x.OwnerId.MarshalEasyJSON(out) - } - { - const prefix string = ",\"objectType\":" - out.RawString(prefix) - v := int32(x.ObjectType) - if vv, ok := ObjectType_name[v]; ok { - out.String(vv) - } else { - out.Int32(v) + if x.Version != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"version\":" + out.RawString(prefix) + x.Version.MarshalEasyJSON(out) } } { - const prefix string = ",\"payloadLength\":" - out.RawString(prefix) - out.Uint64(x.PayloadLength) + if x.CreationEpoch != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"creationEpoch\":" + out.RawString(prefix) + out.Uint64(x.CreationEpoch) + } } { - const prefix string = ",\"payloadHash\":" - out.RawString(prefix) - x.PayloadHash.MarshalEasyJSON(out) + if x.OwnerId != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"ownerID\":" + out.RawString(prefix) + x.OwnerId.MarshalEasyJSON(out) + } } { - const prefix string = ",\"homomorphicHash\":" - out.RawString(prefix) - x.HomomorphicHash.MarshalEasyJSON(out) + if x.ObjectType != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"objectType\":" + out.RawString(prefix) + v := int32(x.ObjectType) + if vv, ok := ObjectType_name[v]; ok { + out.String(vv) + } else { + out.Int32(v) + } + } + } + { + if x.PayloadLength != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"payloadLength\":" + out.RawString(prefix) + out.Uint64(x.PayloadLength) + } + } + { + if x.PayloadHash != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"payloadHash\":" + out.RawString(prefix) + x.PayloadHash.MarshalEasyJSON(out) + } + } + { + if x.HomomorphicHash != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"homomorphicHash\":" + out.RawString(prefix) + x.HomomorphicHash.MarshalEasyJSON(out) + } } out.RawByte('}') } @@ -544,16 +594,31 @@ func (x *Header_Attribute) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"key\":" - out.RawString(prefix[1:]) - out.String(x.Key) + if len(x.Key) != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"key\":" + out.RawString(prefix) + out.String(x.Key) + } } { - const prefix string = ",\"value\":" - out.RawString(prefix) - out.String(x.Value) + if len(x.Value) != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"value\":" + out.RawString(prefix) + out.String(x.Value) + } } out.RawByte('}') } @@ -802,43 +867,86 @@ func (x *Header_Split) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"parent\":" - out.RawString(prefix[1:]) - x.Parent.MarshalEasyJSON(out) - } - { - const prefix string = ",\"previous\":" - out.RawString(prefix) - x.Previous.MarshalEasyJSON(out) - } - { - const prefix string = ",\"parentSignature\":" - out.RawString(prefix) - x.ParentSignature.MarshalEasyJSON(out) - } - { - const prefix string = ",\"parentHeader\":" - out.RawString(prefix) - x.ParentHeader.MarshalEasyJSON(out) - } - { - const prefix string = ",\"children\":" - out.RawString(prefix) - out.RawByte('[') - for i := range x.Children { - if i != 0 { + if x.Parent != nil { + if !first { out.RawByte(',') + } else { + first = false } - x.Children[i].MarshalEasyJSON(out) + const prefix string = "\"parent\":" + out.RawString(prefix) + x.Parent.MarshalEasyJSON(out) } - out.RawByte(']') } { - const prefix string = ",\"splitID\":" - out.RawString(prefix) - out.Base64Bytes(x.SplitId) + if x.Previous != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"previous\":" + out.RawString(prefix) + x.Previous.MarshalEasyJSON(out) + } + } + { + if x.ParentSignature != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"parentSignature\":" + out.RawString(prefix) + x.ParentSignature.MarshalEasyJSON(out) + } + } + { + if x.ParentHeader != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"parentHeader\":" + out.RawString(prefix) + x.ParentHeader.MarshalEasyJSON(out) + } + } + { + if len(x.Children) != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"children\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.Children { + if i != 0 { + out.RawByte(',') + } + x.Children[i].MarshalEasyJSON(out) + } + out.RawByte(']') + } + } + { + if len(x.SplitId) != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"splitID\":" + out.RawString(prefix) + out.Base64Bytes(x.SplitId) + } } out.RawByte('}') } @@ -1157,53 +1265,110 @@ func (x *Header_EC) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"parent\":" - out.RawString(prefix[1:]) - x.Parent.MarshalEasyJSON(out) - } - { - const prefix string = ",\"index\":" - out.RawString(prefix) - out.Uint32(x.Index) - } - { - const prefix string = ",\"total\":" - out.RawString(prefix) - out.Uint32(x.Total) - } - { - const prefix string = ",\"headerLength\":" - out.RawString(prefix) - out.Uint32(x.HeaderLength) - } - { - const prefix string = ",\"header\":" - out.RawString(prefix) - out.Base64Bytes(x.Header) - } - { - const prefix string = ",\"parentSplitID\":" - out.RawString(prefix) - out.Base64Bytes(x.ParentSplitId) - } - { - const prefix string = ",\"parentSplitParentID\":" - out.RawString(prefix) - x.ParentSplitParentId.MarshalEasyJSON(out) - } - { - const prefix string = ",\"parentAttributes\":" - out.RawString(prefix) - out.RawByte('[') - for i := range x.ParentAttributes { - if i != 0 { + if x.Parent != nil { + if !first { out.RawByte(',') + } else { + first = false } - x.ParentAttributes[i].MarshalEasyJSON(out) + const prefix string = "\"parent\":" + out.RawString(prefix) + x.Parent.MarshalEasyJSON(out) + } + } + { + if x.Index != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"index\":" + out.RawString(prefix) + out.Uint32(x.Index) + } + } + { + if x.Total != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"total\":" + out.RawString(prefix) + out.Uint32(x.Total) + } + } + { + if x.HeaderLength != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"headerLength\":" + out.RawString(prefix) + out.Uint32(x.HeaderLength) + } + } + { + if len(x.Header) != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"header\":" + out.RawString(prefix) + out.Base64Bytes(x.Header) + } + } + { + if len(x.ParentSplitId) != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"parentSplitID\":" + out.RawString(prefix) + out.Base64Bytes(x.ParentSplitId) + } + } + { + if x.ParentSplitParentId != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"parentSplitParentID\":" + out.RawString(prefix) + x.ParentSplitParentId.MarshalEasyJSON(out) + } + } + { + if len(x.ParentAttributes) != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"parentAttributes\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.ParentAttributes { + if i != 0 { + out.RawByte(',') + } + x.ParentAttributes[i].MarshalEasyJSON(out) + } + out.RawByte(']') } - out.RawByte(']') } out.RawByte('}') } @@ -1630,78 +1795,163 @@ func (x *Header) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"version\":" - out.RawString(prefix[1:]) - x.Version.MarshalEasyJSON(out) - } - { - const prefix string = ",\"containerID\":" - out.RawString(prefix) - x.ContainerId.MarshalEasyJSON(out) - } - { - const prefix string = ",\"ownerID\":" - out.RawString(prefix) - x.OwnerId.MarshalEasyJSON(out) - } - { - const prefix string = ",\"creationEpoch\":" - out.RawString(prefix) - out.Uint64(x.CreationEpoch) - } - { - const prefix string = ",\"payloadLength\":" - out.RawString(prefix) - out.Uint64(x.PayloadLength) - } - { - const prefix string = ",\"payloadHash\":" - out.RawString(prefix) - x.PayloadHash.MarshalEasyJSON(out) - } - { - const prefix string = ",\"objectType\":" - out.RawString(prefix) - v := int32(x.ObjectType) - if vv, ok := ObjectType_name[v]; ok { - out.String(vv) - } else { - out.Int32(v) - } - } - { - const prefix string = ",\"homomorphicHash\":" - out.RawString(prefix) - x.HomomorphicHash.MarshalEasyJSON(out) - } - { - const prefix string = ",\"sessionToken\":" - out.RawString(prefix) - x.SessionToken.MarshalEasyJSON(out) - } - { - const prefix string = ",\"attributes\":" - out.RawString(prefix) - out.RawByte('[') - for i := range x.Attributes { - if i != 0 { + if x.Version != nil { + if !first { out.RawByte(',') + } else { + first = false } - x.Attributes[i].MarshalEasyJSON(out) + const prefix string = "\"version\":" + out.RawString(prefix) + x.Version.MarshalEasyJSON(out) } - out.RawByte(']') } { - const prefix string = ",\"split\":" - out.RawString(prefix) - x.Split.MarshalEasyJSON(out) + if x.ContainerId != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"containerID\":" + out.RawString(prefix) + x.ContainerId.MarshalEasyJSON(out) + } } { - const prefix string = ",\"ec\":" - out.RawString(prefix) - x.Ec.MarshalEasyJSON(out) + if x.OwnerId != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"ownerID\":" + out.RawString(prefix) + x.OwnerId.MarshalEasyJSON(out) + } + } + { + if x.CreationEpoch != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"creationEpoch\":" + out.RawString(prefix) + out.Uint64(x.CreationEpoch) + } + } + { + if x.PayloadLength != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"payloadLength\":" + out.RawString(prefix) + out.Uint64(x.PayloadLength) + } + } + { + if x.PayloadHash != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"payloadHash\":" + out.RawString(prefix) + x.PayloadHash.MarshalEasyJSON(out) + } + } + { + if x.ObjectType != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"objectType\":" + out.RawString(prefix) + v := int32(x.ObjectType) + if vv, ok := ObjectType_name[v]; ok { + out.String(vv) + } else { + out.Int32(v) + } + } + } + { + if x.HomomorphicHash != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"homomorphicHash\":" + out.RawString(prefix) + x.HomomorphicHash.MarshalEasyJSON(out) + } + } + { + if x.SessionToken != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"sessionToken\":" + out.RawString(prefix) + x.SessionToken.MarshalEasyJSON(out) + } + } + { + if len(x.Attributes) != 0 { + 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 x.Split != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"split\":" + out.RawString(prefix) + x.Split.MarshalEasyJSON(out) + } + } + { + if x.Ec != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"ec\":" + out.RawString(prefix) + x.Ec.MarshalEasyJSON(out) + } } out.RawByte('}') } @@ -1993,26 +2243,55 @@ func (x *Object) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"objectID\":" - out.RawString(prefix[1:]) - x.ObjectId.MarshalEasyJSON(out) + if x.ObjectId != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"objectID\":" + out.RawString(prefix) + x.ObjectId.MarshalEasyJSON(out) + } } { - const prefix string = ",\"signature\":" - out.RawString(prefix) - x.Signature.MarshalEasyJSON(out) + if x.Signature != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"signature\":" + out.RawString(prefix) + x.Signature.MarshalEasyJSON(out) + } } { - const prefix string = ",\"header\":" - out.RawString(prefix) - x.Header.MarshalEasyJSON(out) + if x.Header != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"header\":" + out.RawString(prefix) + x.Header.MarshalEasyJSON(out) + } } { - const prefix string = ",\"payload\":" - out.RawString(prefix) - out.Base64Bytes(x.Payload) + if len(x.Payload) != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"payload\":" + out.RawString(prefix) + out.Base64Bytes(x.Payload) + } } out.RawByte('}') } @@ -2204,21 +2483,43 @@ func (x *SplitInfo) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"splitId\":" - out.RawString(prefix[1:]) - out.Base64Bytes(x.SplitId) + if len(x.SplitId) != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"splitId\":" + out.RawString(prefix) + out.Base64Bytes(x.SplitId) + } } { - const prefix string = ",\"lastPart\":" - out.RawString(prefix) - x.LastPart.MarshalEasyJSON(out) + if x.LastPart != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"lastPart\":" + out.RawString(prefix) + x.LastPart.MarshalEasyJSON(out) + } } { - const prefix string = ",\"link\":" - out.RawString(prefix) - x.Link.MarshalEasyJSON(out) + if x.Link != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"link\":" + out.RawString(prefix) + x.Link.MarshalEasyJSON(out) + } } out.RawByte('}') } @@ -2400,21 +2701,43 @@ func (x *ECInfo_Chunk) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"id\":" - out.RawString(prefix[1:]) - x.Id.MarshalEasyJSON(out) + if x.Id != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"id\":" + out.RawString(prefix) + x.Id.MarshalEasyJSON(out) + } } { - const prefix string = ",\"index\":" - out.RawString(prefix) - out.Uint32(x.Index) + if x.Index != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"index\":" + out.RawString(prefix) + out.Uint32(x.Index) + } } { - const prefix string = ",\"total\":" - out.RawString(prefix) - out.Uint32(x.Total) + if x.Total != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"total\":" + out.RawString(prefix) + out.Uint32(x.Total) + } } out.RawByte('}') } @@ -2558,18 +2881,26 @@ func (x *ECInfo) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"chunks\":" - out.RawString(prefix[1:]) - out.RawByte('[') - for i := range x.Chunks { - if i != 0 { + if len(x.Chunks) != 0 { + if !first { out.RawByte(',') + } else { + first = false } - x.Chunks[i].MarshalEasyJSON(out) + const prefix string = "\"chunks\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.Chunks { + if i != 0 { + out.RawByte(',') + } + x.Chunks[i].MarshalEasyJSON(out) + } + out.RawByte(']') } - out.RawByte(']') } out.RawByte('}') } diff --git a/refs/grpc/types_frostfs.pb.go b/refs/grpc/types_frostfs.pb.go index 5f35eba..869620f 100644 --- a/refs/grpc/types_frostfs.pb.go +++ b/refs/grpc/types_frostfs.pb.go @@ -190,16 +190,31 @@ func (x *Address) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"containerID\":" - out.RawString(prefix[1:]) - x.ContainerId.MarshalEasyJSON(out) + if x.ContainerId != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"containerID\":" + out.RawString(prefix) + x.ContainerId.MarshalEasyJSON(out) + } } { - const prefix string = ",\"objectID\":" - out.RawString(prefix) - x.ObjectId.MarshalEasyJSON(out) + if x.ObjectId != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"objectID\":" + out.RawString(prefix) + x.ObjectId.MarshalEasyJSON(out) + } } out.RawByte('}') } @@ -332,11 +347,19 @@ func (x *ObjectID) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"value\":" - out.RawString(prefix[1:]) - out.Base64Bytes(x.Value) + if len(x.Value) != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"value\":" + out.RawString(prefix) + out.Base64Bytes(x.Value) + } } out.RawByte('}') } @@ -461,11 +484,19 @@ func (x *ContainerID) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"value\":" - out.RawString(prefix[1:]) - out.Base64Bytes(x.Value) + if len(x.Value) != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"value\":" + out.RawString(prefix) + out.Base64Bytes(x.Value) + } } out.RawByte('}') } @@ -590,11 +621,19 @@ func (x *OwnerID) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"value\":" - out.RawString(prefix[1:]) - out.Base64Bytes(x.Value) + if len(x.Value) != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"value\":" + out.RawString(prefix) + out.Base64Bytes(x.Value) + } } out.RawByte('}') } @@ -739,16 +778,31 @@ func (x *Version) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"major\":" - out.RawString(prefix[1:]) - out.Uint32(x.Major) + if x.Major != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"major\":" + out.RawString(prefix) + out.Uint32(x.Major) + } } { - const prefix string = ",\"minor\":" - out.RawString(prefix) - out.Uint32(x.Minor) + if x.Minor != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"minor\":" + out.RawString(prefix) + out.Uint32(x.Minor) + } } out.RawByte('}') } @@ -919,25 +973,47 @@ func (x *Signature) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"key\":" - out.RawString(prefix[1:]) - out.Base64Bytes(x.Key) + if len(x.Key) != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"key\":" + out.RawString(prefix) + out.Base64Bytes(x.Key) + } } { - const prefix string = ",\"signature\":" - out.RawString(prefix) - out.Base64Bytes(x.Sign) + if len(x.Sign) != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"signature\":" + out.RawString(prefix) + out.Base64Bytes(x.Sign) + } } { - const prefix string = ",\"scheme\":" - out.RawString(prefix) - v := int32(x.Scheme) - if vv, ok := SignatureScheme_name[v]; ok { - out.String(vv) - } else { - out.Int32(v) + if x.Scheme != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"scheme\":" + out.RawString(prefix) + v := int32(x.Scheme) + if vv, ok := SignatureScheme_name[v]; ok { + out.String(vv) + } else { + out.Int32(v) + } } } out.RawByte('}') @@ -1111,16 +1187,31 @@ func (x *SignatureRFC6979) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"key\":" - out.RawString(prefix[1:]) - out.Base64Bytes(x.Key) + if len(x.Key) != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"key\":" + out.RawString(prefix) + out.Base64Bytes(x.Key) + } } { - const prefix string = ",\"signature\":" - out.RawString(prefix) - out.Base64Bytes(x.Sign) + if len(x.Sign) != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"signature\":" + out.RawString(prefix) + out.Base64Bytes(x.Sign) + } } out.RawByte('}') } @@ -1271,21 +1362,36 @@ func (x *Checksum) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"type\":" - out.RawString(prefix[1:]) - v := int32(x.Type) - if vv, ok := ChecksumType_name[v]; ok { - out.String(vv) - } else { - out.Int32(v) + if x.Type != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"type\":" + out.RawString(prefix) + v := int32(x.Type) + if vv, ok := ChecksumType_name[v]; ok { + out.String(vv) + } else { + out.Int32(v) + } } } { - const prefix string = ",\"sum\":" - out.RawString(prefix) - out.Base64Bytes(x.Sum) + if len(x.Sum) != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"sum\":" + out.RawString(prefix) + out.Base64Bytes(x.Sum) + } } out.RawByte('}') } diff --git a/session/grpc/service_frostfs.pb.go b/session/grpc/service_frostfs.pb.go index aa42ee8..a3f0111 100644 --- a/session/grpc/service_frostfs.pb.go +++ b/session/grpc/service_frostfs.pb.go @@ -117,16 +117,31 @@ func (x *CreateRequest_Body) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"ownerId\":" - out.RawString(prefix[1:]) - x.OwnerId.MarshalEasyJSON(out) + if x.OwnerId != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"ownerId\":" + out.RawString(prefix) + x.OwnerId.MarshalEasyJSON(out) + } } { - const prefix string = ",\"expiration\":" - out.RawString(prefix) - out.Uint64(x.Expiration) + if x.Expiration != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"expiration\":" + out.RawString(prefix) + out.Uint64(x.Expiration) + } } out.RawByte('}') } @@ -325,21 +340,43 @@ func (x *CreateRequest) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"body\":" - out.RawString(prefix[1:]) - x.Body.MarshalEasyJSON(out) + if x.Body != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"body\":" + out.RawString(prefix) + x.Body.MarshalEasyJSON(out) + } } { - const prefix string = ",\"metaHeader\":" - out.RawString(prefix) - x.MetaHeader.MarshalEasyJSON(out) + if x.MetaHeader != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) + } } { - const prefix string = ",\"verifyHeader\":" - out.RawString(prefix) - x.VerifyHeader.MarshalEasyJSON(out) + if x.VerifyHeader != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) + } } out.RawByte('}') } @@ -499,16 +536,31 @@ func (x *CreateResponse_Body) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"id\":" - out.RawString(prefix[1:]) - out.Base64Bytes(x.Id) + if len(x.Id) != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"id\":" + out.RawString(prefix) + out.Base64Bytes(x.Id) + } } { - const prefix string = ",\"sessionKey\":" - out.RawString(prefix) - out.Base64Bytes(x.SessionKey) + if len(x.SessionKey) != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"sessionKey\":" + out.RawString(prefix) + out.Base64Bytes(x.SessionKey) + } } out.RawByte('}') } @@ -706,21 +758,43 @@ func (x *CreateResponse) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"body\":" - out.RawString(prefix[1:]) - x.Body.MarshalEasyJSON(out) + if x.Body != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"body\":" + out.RawString(prefix) + x.Body.MarshalEasyJSON(out) + } } { - const prefix string = ",\"metaHeader\":" - out.RawString(prefix) - x.MetaHeader.MarshalEasyJSON(out) + if x.MetaHeader != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) + } } { - const prefix string = ",\"verifyHeader\":" - out.RawString(prefix) - x.VerifyHeader.MarshalEasyJSON(out) + if x.VerifyHeader != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) + } } out.RawByte('}') } diff --git a/session/grpc/types_frostfs.pb.go b/session/grpc/types_frostfs.pb.go index c92ab28..58807fe 100644 --- a/session/grpc/types_frostfs.pb.go +++ b/session/grpc/types_frostfs.pb.go @@ -179,23 +179,38 @@ func (x *ObjectSessionContext_Target) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"container\":" - out.RawString(prefix[1:]) - x.Container.MarshalEasyJSON(out) + if x.Container != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"container\":" + out.RawString(prefix) + x.Container.MarshalEasyJSON(out) + } } { - const prefix string = ",\"objects\":" - out.RawString(prefix) - out.RawByte('[') - for i := range x.Objects { - if i != 0 { + if len(x.Objects) != 0 { + if !first { out.RawByte(',') + } else { + first = false } - x.Objects[i].MarshalEasyJSON(out) + const prefix string = "\"objects\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.Objects { + if i != 0 { + out.RawByte(',') + } + x.Objects[i].MarshalEasyJSON(out) + } + out.RawByte(']') } - out.RawByte(']') } out.RawByte('}') } @@ -358,21 +373,36 @@ func (x *ObjectSessionContext) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"verb\":" - out.RawString(prefix[1:]) - v := int32(x.Verb) - if vv, ok := ObjectSessionContext_Verb_name[v]; ok { - out.String(vv) - } else { - out.Int32(v) + if x.Verb != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"verb\":" + out.RawString(prefix) + v := int32(x.Verb) + if vv, ok := ObjectSessionContext_Verb_name[v]; ok { + out.String(vv) + } else { + out.Int32(v) + } } } { - const prefix string = ",\"target\":" - out.RawString(prefix) - x.Target.MarshalEasyJSON(out) + if x.Target != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"target\":" + out.RawString(prefix) + x.Target.MarshalEasyJSON(out) + } } out.RawByte('}') } @@ -601,26 +631,48 @@ func (x *ContainerSessionContext) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"verb\":" - out.RawString(prefix[1:]) - v := int32(x.Verb) - if vv, ok := ContainerSessionContext_Verb_name[v]; ok { - out.String(vv) - } else { - out.Int32(v) + if x.Verb != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"verb\":" + out.RawString(prefix) + v := int32(x.Verb) + if vv, ok := ContainerSessionContext_Verb_name[v]; ok { + out.String(vv) + } else { + out.Int32(v) + } } } { - const prefix string = ",\"wildcard\":" - out.RawString(prefix) - out.Bool(x.Wildcard) + if x.Wildcard { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"wildcard\":" + out.RawString(prefix) + out.Bool(x.Wildcard) + } } { - const prefix string = ",\"containerID\":" - out.RawString(prefix) - x.ContainerId.MarshalEasyJSON(out) + if x.ContainerId != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"containerID\":" + out.RawString(prefix) + x.ContainerId.MarshalEasyJSON(out) + } } out.RawByte('}') } @@ -814,21 +866,43 @@ func (x *SessionToken_Body_TokenLifetime) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"exp\":" - out.RawString(prefix[1:]) - out.Uint64(x.Exp) + if x.Exp != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"exp\":" + out.RawString(prefix) + out.Uint64(x.Exp) + } } { - const prefix string = ",\"nbf\":" - out.RawString(prefix) - out.Uint64(x.Nbf) + if x.Nbf != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"nbf\":" + out.RawString(prefix) + out.Uint64(x.Nbf) + } } { - const prefix string = ",\"iat\":" - out.RawString(prefix) - out.Uint64(x.Iat) + if x.Iat != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"iat\":" + out.RawString(prefix) + out.Uint64(x.Iat) + } } out.RawByte('}') } @@ -1095,39 +1169,82 @@ func (x *SessionToken_Body) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"id\":" - out.RawString(prefix[1:]) - out.Base64Bytes(x.Id) + if len(x.Id) != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"id\":" + out.RawString(prefix) + out.Base64Bytes(x.Id) + } } { - const prefix string = ",\"ownerID\":" - out.RawString(prefix) - x.OwnerId.MarshalEasyJSON(out) + if x.OwnerId != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"ownerID\":" + out.RawString(prefix) + x.OwnerId.MarshalEasyJSON(out) + } } { - const prefix string = ",\"lifetime\":" - out.RawString(prefix) - x.Lifetime.MarshalEasyJSON(out) + if x.Lifetime != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"lifetime\":" + out.RawString(prefix) + x.Lifetime.MarshalEasyJSON(out) + } } { - const prefix string = ",\"sessionKey\":" - out.RawString(prefix) - out.Base64Bytes(x.SessionKey) + if len(x.SessionKey) != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"sessionKey\":" + out.RawString(prefix) + out.Base64Bytes(x.SessionKey) + } } switch xx := x.Context.(type) { case *SessionToken_Body_Object: { - const prefix string = ",\"object\":" - out.RawString(prefix) - xx.Object.MarshalEasyJSON(out) + if xx.Object != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"object\":" + out.RawString(prefix) + xx.Object.MarshalEasyJSON(out) + } } case *SessionToken_Body_Container: { - const prefix string = ",\"container\":" - out.RawString(prefix) - xx.Container.MarshalEasyJSON(out) + if xx.Container != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"container\":" + out.RawString(prefix) + xx.Container.MarshalEasyJSON(out) + } } } out.RawByte('}') @@ -1333,16 +1450,31 @@ func (x *SessionToken) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"body\":" - out.RawString(prefix[1:]) - x.Body.MarshalEasyJSON(out) + if x.Body != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"body\":" + out.RawString(prefix) + x.Body.MarshalEasyJSON(out) + } } { - const prefix string = ",\"signature\":" - out.RawString(prefix) - x.Signature.MarshalEasyJSON(out) + if x.Signature != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"signature\":" + out.RawString(prefix) + x.Signature.MarshalEasyJSON(out) + } } out.RawByte('}') } @@ -1495,16 +1627,31 @@ func (x *XHeader) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"key\":" - out.RawString(prefix[1:]) - out.String(x.Key) + if len(x.Key) != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"key\":" + out.RawString(prefix) + out.String(x.Key) + } } { - const prefix string = ",\"value\":" - out.RawString(prefix) - out.String(x.Value) + if len(x.Value) != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"value\":" + out.RawString(prefix) + out.String(x.Value) + } } out.RawByte('}') } @@ -1793,53 +1940,110 @@ func (x *RequestMetaHeader) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"version\":" - out.RawString(prefix[1:]) - x.Version.MarshalEasyJSON(out) - } - { - const prefix string = ",\"epoch\":" - out.RawString(prefix) - out.Uint64(x.Epoch) - } - { - const prefix string = ",\"ttl\":" - out.RawString(prefix) - out.Uint32(x.Ttl) - } - { - const prefix string = ",\"xHeaders\":" - out.RawString(prefix) - out.RawByte('[') - for i := range x.XHeaders { - if i != 0 { + if x.Version != nil { + if !first { out.RawByte(',') + } else { + first = false } - x.XHeaders[i].MarshalEasyJSON(out) + const prefix string = "\"version\":" + out.RawString(prefix) + x.Version.MarshalEasyJSON(out) } - out.RawByte(']') } { - const prefix string = ",\"sessionToken\":" - out.RawString(prefix) - x.SessionToken.MarshalEasyJSON(out) + if x.Epoch != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"epoch\":" + out.RawString(prefix) + out.Uint64(x.Epoch) + } } { - const prefix string = ",\"bearerToken\":" - out.RawString(prefix) - x.BearerToken.MarshalEasyJSON(out) + if x.Ttl != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"ttl\":" + out.RawString(prefix) + out.Uint32(x.Ttl) + } } { - const prefix string = ",\"origin\":" - out.RawString(prefix) - x.Origin.MarshalEasyJSON(out) + if len(x.XHeaders) != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"xHeaders\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.XHeaders { + if i != 0 { + out.RawByte(',') + } + x.XHeaders[i].MarshalEasyJSON(out) + } + out.RawByte(']') + } } { - const prefix string = ",\"magicNumber\":" - out.RawString(prefix) - out.Uint64(x.MagicNumber) + if x.SessionToken != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"sessionToken\":" + out.RawString(prefix) + x.SessionToken.MarshalEasyJSON(out) + } + } + { + if x.BearerToken != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"bearerToken\":" + out.RawString(prefix) + x.BearerToken.MarshalEasyJSON(out) + } + } + { + if x.Origin != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"origin\":" + out.RawString(prefix) + x.Origin.MarshalEasyJSON(out) + } + } + { + if x.MagicNumber != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"magicNumber\":" + out.RawString(prefix) + out.Uint64(x.MagicNumber) + } } out.RawByte('}') } @@ -2133,43 +2337,86 @@ func (x *ResponseMetaHeader) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"version\":" - out.RawString(prefix[1:]) - x.Version.MarshalEasyJSON(out) - } - { - const prefix string = ",\"epoch\":" - out.RawString(prefix) - out.Uint64(x.Epoch) - } - { - const prefix string = ",\"ttl\":" - out.RawString(prefix) - out.Uint32(x.Ttl) - } - { - const prefix string = ",\"xHeaders\":" - out.RawString(prefix) - out.RawByte('[') - for i := range x.XHeaders { - if i != 0 { + if x.Version != nil { + if !first { out.RawByte(',') + } else { + first = false } - x.XHeaders[i].MarshalEasyJSON(out) + const prefix string = "\"version\":" + out.RawString(prefix) + x.Version.MarshalEasyJSON(out) } - out.RawByte(']') } { - const prefix string = ",\"origin\":" - out.RawString(prefix) - x.Origin.MarshalEasyJSON(out) + if x.Epoch != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"epoch\":" + out.RawString(prefix) + out.Uint64(x.Epoch) + } } { - const prefix string = ",\"status\":" - out.RawString(prefix) - x.Status.MarshalEasyJSON(out) + if x.Ttl != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"ttl\":" + out.RawString(prefix) + out.Uint32(x.Ttl) + } + } + { + if len(x.XHeaders) != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"xHeaders\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.XHeaders { + if i != 0 { + out.RawByte(',') + } + x.XHeaders[i].MarshalEasyJSON(out) + } + out.RawByte(']') + } + } + { + if x.Origin != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"origin\":" + out.RawString(prefix) + x.Origin.MarshalEasyJSON(out) + } + } + { + if x.Status != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"status\":" + out.RawString(prefix) + x.Status.MarshalEasyJSON(out) + } } out.RawByte('}') } @@ -2407,26 +2654,55 @@ func (x *RequestVerificationHeader) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"bodySignature\":" - out.RawString(prefix[1:]) - x.BodySignature.MarshalEasyJSON(out) + if x.BodySignature != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"bodySignature\":" + out.RawString(prefix) + x.BodySignature.MarshalEasyJSON(out) + } } { - const prefix string = ",\"metaSignature\":" - out.RawString(prefix) - x.MetaSignature.MarshalEasyJSON(out) + if x.MetaSignature != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"metaSignature\":" + out.RawString(prefix) + x.MetaSignature.MarshalEasyJSON(out) + } } { - const prefix string = ",\"originSignature\":" - out.RawString(prefix) - x.OriginSignature.MarshalEasyJSON(out) + if x.OriginSignature != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"originSignature\":" + out.RawString(prefix) + x.OriginSignature.MarshalEasyJSON(out) + } } { - const prefix string = ",\"origin\":" - out.RawString(prefix) - x.Origin.MarshalEasyJSON(out) + if x.Origin != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"origin\":" + out.RawString(prefix) + x.Origin.MarshalEasyJSON(out) + } } out.RawByte('}') } @@ -2645,26 +2921,55 @@ func (x *ResponseVerificationHeader) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"bodySignature\":" - out.RawString(prefix[1:]) - x.BodySignature.MarshalEasyJSON(out) + if x.BodySignature != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"bodySignature\":" + out.RawString(prefix) + x.BodySignature.MarshalEasyJSON(out) + } } { - const prefix string = ",\"metaSignature\":" - out.RawString(prefix) - x.MetaSignature.MarshalEasyJSON(out) + if x.MetaSignature != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"metaSignature\":" + out.RawString(prefix) + x.MetaSignature.MarshalEasyJSON(out) + } } { - const prefix string = ",\"originSignature\":" - out.RawString(prefix) - x.OriginSignature.MarshalEasyJSON(out) + if x.OriginSignature != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"originSignature\":" + out.RawString(prefix) + x.OriginSignature.MarshalEasyJSON(out) + } } { - const prefix string = ",\"origin\":" - out.RawString(prefix) - x.Origin.MarshalEasyJSON(out) + if x.Origin != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"origin\":" + out.RawString(prefix) + x.Origin.MarshalEasyJSON(out) + } } out.RawByte('}') } diff --git a/status/grpc/types_frostfs.pb.go b/status/grpc/types_frostfs.pb.go index 29dfebe..7581dbe 100644 --- a/status/grpc/types_frostfs.pb.go +++ b/status/grpc/types_frostfs.pb.go @@ -368,16 +368,31 @@ func (x *Status_Detail) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"id\":" - out.RawString(prefix[1:]) - out.Uint32(x.Id) + if x.Id != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"id\":" + out.RawString(prefix) + out.Uint32(x.Id) + } } { - const prefix string = ",\"value\":" - out.RawString(prefix) - out.Base64Bytes(x.Value) + if len(x.Value) != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"value\":" + out.RawString(prefix) + out.Base64Bytes(x.Value) + } } out.RawByte('}') } @@ -554,28 +569,50 @@ func (x *Status) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"code\":" - out.RawString(prefix[1:]) - out.Uint32(x.Code) - } - { - const prefix string = ",\"message\":" - out.RawString(prefix) - out.String(x.Message) - } - { - const prefix string = ",\"details\":" - out.RawString(prefix) - out.RawByte('[') - for i := range x.Details { - if i != 0 { + if x.Code != 0 { + if !first { out.RawByte(',') + } else { + first = false } - x.Details[i].MarshalEasyJSON(out) + const prefix string = "\"code\":" + out.RawString(prefix) + out.Uint32(x.Code) + } + } + { + if len(x.Message) != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"message\":" + out.RawString(prefix) + out.String(x.Message) + } + } + { + if len(x.Details) != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"details\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.Details { + if i != 0 { + out.RawByte(',') + } + x.Details[i].MarshalEasyJSON(out) + } + out.RawByte(']') } - out.RawByte(']') } out.RawByte('}') } diff --git a/tombstone/grpc/types_frostfs.pb.go b/tombstone/grpc/types_frostfs.pb.go index f7bc48c..79afdfc 100644 --- a/tombstone/grpc/types_frostfs.pb.go +++ b/tombstone/grpc/types_frostfs.pb.go @@ -140,28 +140,50 @@ func (x *Tombstone) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"expirationEpoch\":" - out.RawString(prefix[1:]) - out.Uint64(x.ExpirationEpoch) - } - { - const prefix string = ",\"splitID\":" - out.RawString(prefix) - out.Base64Bytes(x.SplitId) - } - { - const prefix string = ",\"members\":" - out.RawString(prefix) - out.RawByte('[') - for i := range x.Members { - if i != 0 { + if x.ExpirationEpoch != 0 { + if !first { out.RawByte(',') + } else { + first = false } - x.Members[i].MarshalEasyJSON(out) + const prefix string = "\"expirationEpoch\":" + out.RawString(prefix) + out.Uint64(x.ExpirationEpoch) + } + } + { + if len(x.SplitId) != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"splitID\":" + out.RawString(prefix) + out.Base64Bytes(x.SplitId) + } + } + { + if len(x.Members) != 0 { + 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(']') } out.RawByte('}') } diff --git a/util/proto/test/custom/test_frostfs.pb.go b/util/proto/test/custom/test_frostfs.pb.go index 005d6d1..03f3ece 100644 --- a/util/proto/test/custom/test_frostfs.pb.go +++ b/util/proto/test/custom/test_frostfs.pb.go @@ -130,11 +130,19 @@ func (x *Primitives_Aux) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"innerField\":" - out.RawString(prefix[1:]) - out.Uint32(x.InnerField) + if x.InnerField != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"innerField\":" + out.RawString(prefix) + out.Uint32(x.InnerField) + } } out.RawByte('}') } @@ -560,85 +568,184 @@ func (x *Primitives) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"fieldA\":" - out.RawString(prefix[1:]) - out.Base64Bytes(x.FieldA) + if len(x.FieldA) != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"fieldA\":" + out.RawString(prefix) + out.Base64Bytes(x.FieldA) + } } { - const prefix string = ",\"fieldB\":" - out.RawString(prefix) - out.String(x.FieldB) + if len(x.FieldB) != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"fieldB\":" + out.RawString(prefix) + out.String(x.FieldB) + } } { - const prefix string = ",\"fieldC\":" - out.RawString(prefix) - out.Bool(x.FieldC) + if x.FieldC { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"fieldC\":" + out.RawString(prefix) + out.Bool(x.FieldC) + } } { - const prefix string = ",\"fieldD\":" - out.RawString(prefix) - out.Int32(x.FieldD) + if x.FieldD != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"fieldD\":" + out.RawString(prefix) + out.Int32(x.FieldD) + } } { - const prefix string = ",\"fieldE\":" - out.RawString(prefix) - out.Uint32(x.FieldE) + if x.FieldE != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"fieldE\":" + out.RawString(prefix) + out.Uint32(x.FieldE) + } } { - const prefix string = ",\"fieldF\":" - out.RawString(prefix) - out.Int64(x.FieldF) + if x.FieldF != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"fieldF\":" + out.RawString(prefix) + out.Int64(x.FieldF) + } } { - const prefix string = ",\"fieldG\":" - out.RawString(prefix) - out.Uint64(x.FieldG) + if x.FieldG != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"fieldG\":" + out.RawString(prefix) + out.Uint64(x.FieldG) + } } { - const prefix string = ",\"fieldI\":" - out.RawString(prefix) - out.Uint64(x.FieldI) + if x.FieldI != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"fieldI\":" + out.RawString(prefix) + out.Uint64(x.FieldI) + } } { - const prefix string = ",\"fieldJ\":" - out.RawString(prefix) - out.Float64(x.FieldJ) + if x.FieldJ != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"fieldJ\":" + out.RawString(prefix) + out.Float64(x.FieldJ) + } } { - const prefix string = ",\"fieldK\":" - out.RawString(prefix) - out.Uint32(x.FieldK) + if x.FieldK != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"fieldK\":" + out.RawString(prefix) + out.Uint32(x.FieldK) + } } { - const prefix string = ",\"fieldH\":" - out.RawString(prefix) - v := int32(x.FieldH) - if vv, ok := Primitives_SomeEnum_name[v]; ok { - out.String(vv) - } else { - out.Int32(v) + if x.FieldH != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"fieldH\":" + out.RawString(prefix) + v := int32(x.FieldH) + if vv, ok := Primitives_SomeEnum_name[v]; ok { + out.String(vv) + } else { + out.Int32(v) + } } } switch xx := x.FieldM.(type) { case *Primitives_FieldMa: { - const prefix string = ",\"fieldMa\":" - out.RawString(prefix) - out.Base64Bytes(xx.FieldMa) + if len(xx.FieldMa) != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"fieldMa\":" + out.RawString(prefix) + out.Base64Bytes(xx.FieldMa) + } } case *Primitives_FieldMe: { - const prefix string = ",\"fieldMe\":" - out.RawString(prefix) - out.Uint32(xx.FieldMe) + if xx.FieldMe != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"fieldMe\":" + out.RawString(prefix) + out.Uint32(xx.FieldMe) + } } case *Primitives_FieldAux: { - const prefix string = ",\"fieldAux\":" - out.RawString(prefix) - xx.FieldAux.MarshalEasyJSON(out) + if xx.FieldAux != nil { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"fieldAux\":" + out.RawString(prefix) + xx.FieldAux.MarshalEasyJSON(out) + } } } out.RawByte('}') @@ -887,11 +994,19 @@ func (x *RepPrimitives_Aux) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"innerField\":" - out.RawString(prefix[1:]) - out.Uint32(x.InnerField) + if x.InnerField != 0 { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"innerField\":" + out.RawString(prefix) + out.Uint32(x.InnerField) + } } out.RawByte('}') } @@ -1169,102 +1284,159 @@ func (x *RepPrimitives) MarshalEasyJSON(out *jwriter.Writer) { out.RawString("null") return } + first := true out.RawByte('{') { - const prefix string = ",\"fieldA\":" - out.RawString(prefix[1:]) - out.RawByte('[') - for i := range x.FieldA { - if i != 0 { + if len(x.FieldA) != 0 { + if !first { out.RawByte(',') + } else { + first = false } - out.Base64Bytes(x.FieldA[i]) + const prefix string = "\"fieldA\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.FieldA { + if i != 0 { + out.RawByte(',') + } + out.Base64Bytes(x.FieldA[i]) + } + out.RawByte(']') } - out.RawByte(']') } { - const prefix string = ",\"fieldB\":" - out.RawString(prefix) - out.RawByte('[') - for i := range x.FieldB { - if i != 0 { + if len(x.FieldB) != 0 { + if !first { out.RawByte(',') + } else { + first = false } - out.String(x.FieldB[i]) + const prefix string = "\"fieldB\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.FieldB { + if i != 0 { + out.RawByte(',') + } + out.String(x.FieldB[i]) + } + out.RawByte(']') } - out.RawByte(']') } { - const prefix string = ",\"fieldC\":" - out.RawString(prefix) - out.RawByte('[') - for i := range x.FieldC { - if i != 0 { + if len(x.FieldC) != 0 { + if !first { out.RawByte(',') + } else { + first = false } - out.Int32(x.FieldC[i]) + const prefix string = "\"fieldC\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.FieldC { + if i != 0 { + out.RawByte(',') + } + out.Int32(x.FieldC[i]) + } + out.RawByte(']') } - out.RawByte(']') } { - const prefix string = ",\"fieldD\":" - out.RawString(prefix) - out.RawByte('[') - for i := range x.FieldD { - if i != 0 { + if len(x.FieldD) != 0 { + if !first { out.RawByte(',') + } else { + first = false } - out.Uint32(x.FieldD[i]) + const prefix string = "\"fieldD\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.FieldD { + if i != 0 { + out.RawByte(',') + } + out.Uint32(x.FieldD[i]) + } + out.RawByte(']') } - out.RawByte(']') } { - const prefix string = ",\"fieldE\":" - out.RawString(prefix) - out.RawByte('[') - for i := range x.FieldE { - if i != 0 { + if len(x.FieldE) != 0 { + if !first { out.RawByte(',') + } else { + first = false } - out.Int64(x.FieldE[i]) + const prefix string = "\"fieldE\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.FieldE { + if i != 0 { + out.RawByte(',') + } + out.Int64(x.FieldE[i]) + } + out.RawByte(']') } - out.RawByte(']') } { - const prefix string = ",\"fieldF\":" - out.RawString(prefix) - out.RawByte('[') - for i := range x.FieldF { - if i != 0 { + if len(x.FieldF) != 0 { + if !first { out.RawByte(',') + } else { + first = false } - out.Uint64(x.FieldF[i]) + const prefix string = "\"fieldF\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.FieldF { + if i != 0 { + out.RawByte(',') + } + out.Uint64(x.FieldF[i]) + } + out.RawByte(']') } - out.RawByte(']') } { - const prefix string = ",\"fieldFu\":" - out.RawString(prefix) - out.RawByte('[') - for i := range x.FieldFu { - if i != 0 { + if len(x.FieldFu) != 0 { + if !first { out.RawByte(',') + } else { + first = false } - out.Uint64(x.FieldFu[i]) + const prefix string = "\"fieldFu\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.FieldFu { + if i != 0 { + out.RawByte(',') + } + out.Uint64(x.FieldFu[i]) + } + out.RawByte(']') } - out.RawByte(']') } { - const prefix string = ",\"fieldAux\":" - out.RawString(prefix) - out.RawByte('[') - for i := range x.FieldAux { - if i != 0 { + if len(x.FieldAux) != 0 { + if !first { out.RawByte(',') + } else { + first = false } - x.FieldAux[i].MarshalEasyJSON(out) + const prefix string = "\"fieldAux\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.FieldAux { + if i != 0 { + out.RawByte(',') + } + x.FieldAux[i].MarshalEasyJSON(out) + } + out.RawByte(']') } - out.RawByte(']') } out.RawByte('}') } diff --git a/util/protogen/internalgengo/json.go b/util/protogen/internalgengo/json.go index 95a06d5..ec70155 100644 --- a/util/protogen/internalgengo/json.go +++ b/util/protogen/internalgengo/json.go @@ -147,8 +147,11 @@ func emitJSONMarshal(g *protogen.GeneratedFile, msg *protogen.Message) { g.P("func (x *", msg.GoIdent.GoName, ") MarshalEasyJSON(out *", jwriterPackage.Ident("Writer"), ") {") g.P(`if x == nil { out.RawString("null"); return }`) + if len(msg.Fields) != 0 { + g.P("first := true") + } g.P("out.RawByte('{')") - for i, f := range msg.Fields { + for _, f := range msg.Fields { if f.Oneof != nil { if f.Oneof.Fields[0] != f { continue @@ -157,29 +160,35 @@ func emitJSONMarshal(g *protogen.GeneratedFile, msg *protogen.Message) { g.P("switch xx := x.", f.Oneof.GoName, ".(type) {") for _, ff := range f.Oneof.Fields { g.P("case *", ff.GoIdent, ":") - emitJSONFieldWrite(g, ff, "xx", i == 0) + emitJSONFieldWrite(g, ff, "xx") } g.P("}") continue } - emitJSONFieldWrite(g, f, "x", i == 0) + emitJSONFieldWrite(g, f, "x") } g.P("out.RawByte('}')") g.P("}") } -func emitJSONFieldWrite(g *protogen.GeneratedFile, f *protogen.Field, name string, first bool) { +func emitJSONFieldWrite(g *protogen.GeneratedFile, f *protogen.Field, name string) { g.P("{") defer g.P("}") - g.P("const prefix string = ", `",\"`, fieldJSONName(f), `\":"`) - if first { - g.P("out.RawString(prefix[1:])") - } else { - g.P("out.RawString(prefix)") - } - selector := name + "." + f.GoName + + isNotDefault := notNil + if f.Desc.IsList() { + isNotDefault = notEmpty + } else if f.Desc.Kind() != protoreflect.MessageKind { + _, isNotDefault = easyprotoKindInfo(f.Desc.Kind()) + } + g.P("if ", isNotDefault(selector), "{") + defer g.P("}") + + g.P("if !first { out.RawByte(','); } else { first = false; }") + g.P("const prefix string = ", `"\"`, fieldJSONName(f), `\":"`) + g.P("out.RawString(prefix)") if f.Desc.IsList() { selector += "[i]" g.P("out.RawByte('[')") From d94b9c6d0d6030e551a58ae260d943290fd8e38e Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Tue, 1 Oct 2024 13:50:27 +0300 Subject: [PATCH 1188/1196] [#120] protogen: Unmarshal stringified integers from JSON Signed-off-by: Evgenii Stratonikov --- accounting/grpc/types_frostfs.pb.go | 21 +++- acl/grpc/types_frostfs.pb.go | 30 ++++- container/grpc/types_frostfs.pb.go | 11 +- netmap/grpc/types_frostfs.pb.go | 90 ++++++++++++-- object/grpc/service_frostfs.pb.go | 50 +++++++- object/grpc/types_frostfs.pb.go | 90 ++++++++++++-- refs/grpc/types_frostfs.pb.go | 20 +++- session/grpc/service_frostfs.pb.go | 11 +- session/grpc/types_frostfs.pb.go | 80 +++++++++++-- status/grpc/types_frostfs.pb.go | 20 +++- tombstone/grpc/types_frostfs.pb.go | 11 +- util/proto/test/custom/test_frostfs.pb.go | 140 +++++++++++++++++++--- util/protogen/internalgengo/json.go | 23 +++- 13 files changed, 536 insertions(+), 61 deletions(-) diff --git a/accounting/grpc/types_frostfs.pb.go b/accounting/grpc/types_frostfs.pb.go index 0ae770b..438cd03 100644 --- a/accounting/grpc/types_frostfs.pb.go +++ b/accounting/grpc/types_frostfs.pb.go @@ -11,6 +11,7 @@ import ( easyproto "github.com/VictoriaMetrics/easyproto" jlexer "github.com/mailru/easyjson/jlexer" jwriter "github.com/mailru/easyjson/jwriter" + strconv "strconv" ) type Decimal struct { @@ -170,13 +171,29 @@ func (x *Decimal) UnmarshalEasyJSON(in *jlexer.Lexer) { case "value": { var f int64 - f = in.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 - f = in.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 } } diff --git a/acl/grpc/types_frostfs.pb.go b/acl/grpc/types_frostfs.pb.go index 57e1682..6ebaf63 100644 --- a/acl/grpc/types_frostfs.pb.go +++ b/acl/grpc/types_frostfs.pb.go @@ -1481,19 +1481,43 @@ func (x *BearerToken_Body_TokenLifetime) UnmarshalEasyJSON(in *jlexer.Lexer) { case "exp": { var f uint64 - f = in.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.Exp = f } case "nbf": { var f uint64 - f = in.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.Nbf = f } case "iat": { var f uint64 - f = in.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.Iat = f } } diff --git a/container/grpc/types_frostfs.pb.go b/container/grpc/types_frostfs.pb.go index 9db07ed..e5da35f 100644 --- a/container/grpc/types_frostfs.pb.go +++ b/container/grpc/types_frostfs.pb.go @@ -13,6 +13,7 @@ import ( easyproto "github.com/VictoriaMetrics/easyproto" jlexer "github.com/mailru/easyjson/jlexer" jwriter "github.com/mailru/easyjson/jwriter" + strconv "strconv" ) type Container_Attribute struct { @@ -517,7 +518,15 @@ func (x *Container) UnmarshalEasyJSON(in *jlexer.Lexer) { case "basicACL": { var f uint32 - f = in.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": diff --git a/netmap/grpc/types_frostfs.pb.go b/netmap/grpc/types_frostfs.pb.go index d082910..24b7575 100644 --- a/netmap/grpc/types_frostfs.pb.go +++ b/netmap/grpc/types_frostfs.pb.go @@ -703,7 +703,15 @@ func (x *Selector) UnmarshalEasyJSON(in *jlexer.Lexer) { case "count": { var f uint32 - f = in.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.Count = f } case "clause": @@ -970,7 +978,15 @@ func (x *Replica) UnmarshalEasyJSON(in *jlexer.Lexer) { case "count": { var f uint32 - f = in.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.Count = f } case "selector": @@ -982,13 +998,29 @@ func (x *Replica) UnmarshalEasyJSON(in *jlexer.Lexer) { case "ecDataCount": { var f uint32 - f = in.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.EcDataCount = f } case "ecParityCount": { var f uint32 - f = in.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.EcParityCount = f } } @@ -1306,7 +1338,15 @@ func (x *PlacementPolicy) UnmarshalEasyJSON(in *jlexer.Lexer) { case "containerBackupFactor": { var f uint32 - f = in.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.ContainerBackupFactor = f } case "selectors": @@ -2094,7 +2134,15 @@ func (x *Netmap) UnmarshalEasyJSON(in *jlexer.Lexer) { case "epoch": { var f uint64 - f = in.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.Epoch = f } case "nodes": @@ -2677,19 +2725,43 @@ func (x *NetworkInfo) UnmarshalEasyJSON(in *jlexer.Lexer) { case "currentEpoch": { var f uint64 - f = in.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.CurrentEpoch = f } case "magicNumber": { var f uint64 - f = in.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.MagicNumber = f } case "msPerBlock": { var f int64 - f = in.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.MsPerBlock = f } case "networkConfig": diff --git a/object/grpc/service_frostfs.pb.go b/object/grpc/service_frostfs.pb.go index 2434bd3..0130ee3 100644 --- a/object/grpc/service_frostfs.pb.go +++ b/object/grpc/service_frostfs.pb.go @@ -1508,7 +1508,15 @@ func (x *PutRequest_Body_Init) UnmarshalEasyJSON(in *jlexer.Lexer) { var list []uint32 in.Delim('[') for !in.IsDelim(']') { - f = in.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 list = append(list, f) in.WantComma() } @@ -4815,7 +4823,15 @@ func (x *SearchRequest_Body) UnmarshalEasyJSON(in *jlexer.Lexer) { case "version": { var f uint32 - f = in.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.Version = f } case "filters": @@ -5642,13 +5658,29 @@ func (x *Range) UnmarshalEasyJSON(in *jlexer.Lexer) { case "offset": { var f uint64 - f = in.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.Offset = f } case "length": { var f uint64 - f = in.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.Length = f } } @@ -7823,7 +7855,15 @@ func (x *PutSingleRequest_Body) UnmarshalEasyJSON(in *jlexer.Lexer) { var list []uint32 in.Delim('[') for !in.IsDelim(']') { - f = in.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 list = append(list, f) in.WantComma() } diff --git a/object/grpc/types_frostfs.pb.go b/object/grpc/types_frostfs.pb.go index 5b1eb2c..bc246cf 100644 --- a/object/grpc/types_frostfs.pb.go +++ b/object/grpc/types_frostfs.pb.go @@ -433,7 +433,15 @@ func (x *ShortHeader) UnmarshalEasyJSON(in *jlexer.Lexer) { case "creationEpoch": { var f uint64 - f = in.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.CreationEpoch = f } case "ownerID": @@ -468,7 +476,15 @@ func (x *ShortHeader) UnmarshalEasyJSON(in *jlexer.Lexer) { case "payloadLength": { var f uint64 - f = in.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.PayloadLength = f } case "payloadHash": @@ -1408,19 +1424,43 @@ func (x *Header_EC) UnmarshalEasyJSON(in *jlexer.Lexer) { case "index": { var f uint32 - f = in.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.Index = f } case "total": { var f uint32 - f = in.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.Total = f } case "headerLength": { var f uint32 - f = in.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.HeaderLength = f } case "header": @@ -2005,13 +2045,29 @@ func (x *Header) UnmarshalEasyJSON(in *jlexer.Lexer) { case "creationEpoch": { var f uint64 - f = in.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.CreationEpoch = f } case "payloadLength": { var f uint64 - f = in.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.PayloadLength = f } case "payloadHash": @@ -2777,13 +2833,29 @@ func (x *ECInfo_Chunk) UnmarshalEasyJSON(in *jlexer.Lexer) { case "index": { var f uint32 - f = in.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.Index = f } case "total": { var f uint32 - f = in.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.Total = f } } diff --git a/refs/grpc/types_frostfs.pb.go b/refs/grpc/types_frostfs.pb.go index 869620f..3ed647c 100644 --- a/refs/grpc/types_frostfs.pb.go +++ b/refs/grpc/types_frostfs.pb.go @@ -835,13 +835,29 @@ func (x *Version) UnmarshalEasyJSON(in *jlexer.Lexer) { case "major": { var f uint32 - f = in.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.Major = f } case "minor": { var f uint32 - f = in.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.Minor = f } } diff --git a/session/grpc/service_frostfs.pb.go b/session/grpc/service_frostfs.pb.go index a3f0111..71a6a41 100644 --- a/session/grpc/service_frostfs.pb.go +++ b/session/grpc/service_frostfs.pb.go @@ -12,6 +12,7 @@ import ( easyproto "github.com/VictoriaMetrics/easyproto" jlexer "github.com/mailru/easyjson/jlexer" jwriter "github.com/mailru/easyjson/jwriter" + strconv "strconv" ) type CreateRequest_Body struct { @@ -181,7 +182,15 @@ func (x *CreateRequest_Body) UnmarshalEasyJSON(in *jlexer.Lexer) { case "expiration": { var f uint64 - f = in.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 } } diff --git a/session/grpc/types_frostfs.pb.go b/session/grpc/types_frostfs.pb.go index 58807fe..1b6a664 100644 --- a/session/grpc/types_frostfs.pb.go +++ b/session/grpc/types_frostfs.pb.go @@ -935,19 +935,43 @@ func (x *SessionToken_Body_TokenLifetime) UnmarshalEasyJSON(in *jlexer.Lexer) { case "exp": { var f uint64 - f = in.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.Exp = f } case "nbf": { var f uint64 - f = in.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.Nbf = f } case "iat": { var f uint64 - f = in.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.Iat = f } } @@ -2083,13 +2107,29 @@ func (x *RequestMetaHeader) UnmarshalEasyJSON(in *jlexer.Lexer) { case "epoch": { var f uint64 - f = in.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.Epoch = f } case "ttl": { var f uint32 - f = in.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.Ttl = f } case "xHeaders": @@ -2130,7 +2170,15 @@ func (x *RequestMetaHeader) UnmarshalEasyJSON(in *jlexer.Lexer) { case "magicNumber": { var f uint64 - f = in.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.MagicNumber = f } } @@ -2456,13 +2504,29 @@ func (x *ResponseMetaHeader) UnmarshalEasyJSON(in *jlexer.Lexer) { case "epoch": { var f uint64 - f = in.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.Epoch = f } case "ttl": { var f uint32 - f = in.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.Ttl = f } case "xHeaders": diff --git a/status/grpc/types_frostfs.pb.go b/status/grpc/types_frostfs.pb.go index 7581dbe..609fc03 100644 --- a/status/grpc/types_frostfs.pb.go +++ b/status/grpc/types_frostfs.pb.go @@ -425,7 +425,15 @@ func (x *Status_Detail) UnmarshalEasyJSON(in *jlexer.Lexer) { case "id": { var f uint32 - f = in.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.Id = f } case "value": @@ -645,7 +653,15 @@ func (x *Status) UnmarshalEasyJSON(in *jlexer.Lexer) { case "code": { var f uint32 - f = in.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.Code = f } case "message": diff --git a/tombstone/grpc/types_frostfs.pb.go b/tombstone/grpc/types_frostfs.pb.go index 79afdfc..0971045 100644 --- a/tombstone/grpc/types_frostfs.pb.go +++ b/tombstone/grpc/types_frostfs.pb.go @@ -12,6 +12,7 @@ import ( easyproto "github.com/VictoriaMetrics/easyproto" jlexer "github.com/mailru/easyjson/jlexer" jwriter "github.com/mailru/easyjson/jwriter" + strconv "strconv" ) type Tombstone struct { @@ -216,7 +217,15 @@ func (x *Tombstone) UnmarshalEasyJSON(in *jlexer.Lexer) { case "expirationEpoch": { var f uint64 - f = in.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.ExpirationEpoch = f } case "splitID": diff --git a/util/proto/test/custom/test_frostfs.pb.go b/util/proto/test/custom/test_frostfs.pb.go index 03f3ece..15e77af 100644 --- a/util/proto/test/custom/test_frostfs.pb.go +++ b/util/proto/test/custom/test_frostfs.pb.go @@ -175,7 +175,15 @@ func (x *Primitives_Aux) UnmarshalEasyJSON(in *jlexer.Lexer) { case "innerField": { var f uint32 - f = in.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.InnerField = f } } @@ -797,31 +805,71 @@ func (x *Primitives) UnmarshalEasyJSON(in *jlexer.Lexer) { case "fieldD": { var f int32 - f = in.Int32() + r := in.JsonNumber() + n := r.String() + v, err := strconv.ParseInt(n, 10, 32) + if err != nil { + in.AddError(err) + return + } + pv := int32(v) + f = pv x.FieldD = f } case "fieldE": { var f uint32 - f = in.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.FieldE = f } case "fieldF": { var f int64 - f = in.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.FieldF = f } case "fieldG": { var f uint64 - f = in.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.FieldG = f } case "fieldI": { var f uint64 - f = in.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.FieldI = f } case "fieldJ": @@ -833,7 +881,15 @@ func (x *Primitives) UnmarshalEasyJSON(in *jlexer.Lexer) { case "fieldK": { var f uint32 - f = in.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.FieldK = f } case "fieldH": @@ -871,7 +927,15 @@ func (x *Primitives) UnmarshalEasyJSON(in *jlexer.Lexer) { x.FieldM = xx { var f uint32 - f = in.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 xx.FieldMe = f } case "fieldAux": @@ -1039,7 +1103,15 @@ func (x *RepPrimitives_Aux) UnmarshalEasyJSON(in *jlexer.Lexer) { case "innerField": { var f uint32 - f = in.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.InnerField = f } } @@ -1498,7 +1570,15 @@ func (x *RepPrimitives) UnmarshalEasyJSON(in *jlexer.Lexer) { var list []int32 in.Delim('[') for !in.IsDelim(']') { - f = in.Int32() + r := in.JsonNumber() + n := r.String() + v, err := strconv.ParseInt(n, 10, 32) + if err != nil { + in.AddError(err) + return + } + pv := int32(v) + f = pv list = append(list, f) in.WantComma() } @@ -1511,7 +1591,15 @@ func (x *RepPrimitives) UnmarshalEasyJSON(in *jlexer.Lexer) { var list []uint32 in.Delim('[') for !in.IsDelim(']') { - f = in.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 list = append(list, f) in.WantComma() } @@ -1524,7 +1612,15 @@ func (x *RepPrimitives) UnmarshalEasyJSON(in *jlexer.Lexer) { var list []int64 in.Delim('[') for !in.IsDelim(']') { - f = in.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 list = append(list, f) in.WantComma() } @@ -1537,7 +1633,15 @@ func (x *RepPrimitives) UnmarshalEasyJSON(in *jlexer.Lexer) { var list []uint64 in.Delim('[') for !in.IsDelim(']') { - f = in.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 list = append(list, f) in.WantComma() } @@ -1550,7 +1654,15 @@ func (x *RepPrimitives) UnmarshalEasyJSON(in *jlexer.Lexer) { var list []uint64 in.Delim('[') for !in.IsDelim(']') { - f = in.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 list = append(list, f) in.WantComma() } diff --git a/util/protogen/internalgengo/json.go b/util/protogen/internalgengo/json.go index ec70155..4d7f4be 100644 --- a/util/protogen/internalgengo/json.go +++ b/util/protogen/internalgengo/json.go @@ -59,6 +59,17 @@ func emitJSONUnmarshal(g *protogen.GeneratedFile, msg *protogen.Message) { g.P("}") } +func emitJSONParseInteger(g *protogen.GeneratedFile, ident string, method string, bitSize int, typ string) { + g.P("r := in.JsonNumber()") + g.P("n := r.String()") + g.P("v, err := ", strconvPackage.Ident(method), "(n, 10, ", bitSize, ")") + g.P("if err != nil {") + g.P(" in.AddError(err)") + g.P(" return") + g.P("}") + g.P(ident, " := ", typ, "(v)") +} + func emitJSONFieldRead(g *protogen.GeneratedFile, f *protogen.Field, name string) { g.P("{") defer g.P("}") @@ -100,13 +111,17 @@ func emitJSONFieldRead(g *protogen.GeneratedFile, f *protogen.Field, name string }`) template = "%s = parsedValue" case protoreflect.Int32Kind, protoreflect.Sint32Kind, protoreflect.Sfixed32Kind: - template = "%s = in.Int32()" + emitJSONParseInteger(g, "pv", "ParseInt", 32, "int32") + template = "%s = pv" case protoreflect.Uint32Kind, protoreflect.Fixed32Kind: - template = "%s = in.Uint32()" + emitJSONParseInteger(g, "pv", "ParseUint", 32, "uint32") + template = "%s = pv" case protoreflect.Int64Kind, protoreflect.Sint64Kind, protoreflect.Sfixed64Kind: - template = "%s = in.Int64()" + emitJSONParseInteger(g, "pv", "ParseInt", 64, "int64") + template = "%s = pv" case protoreflect.Uint64Kind, protoreflect.Fixed64Kind: - template = "%s = in.Uint64()" + emitJSONParseInteger(g, "pv", "ParseUint", 64, "uint64") + template = "%s = pv" case protoreflect.FloatKind: template = "%s = in.Float32()" case protoreflect.DoubleKind: From b06dad731c711082abfb6f88a54a77ee7cc6d043 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Tue, 1 Oct 2024 13:50:43 +0300 Subject: [PATCH 1189/1196] [#120] protogen: Marshal 64-bit integers as strings Signed-off-by: Evgenii Stratonikov --- accounting/grpc/types_frostfs.pb.go | 4 +++- acl/grpc/types_frostfs.pb.go | 12 +++++++++--- netmap/grpc/types_frostfs.pb.go | 16 +++++++++++---- object/grpc/service_frostfs.pb.go | 8 ++++++-- object/grpc/types_frostfs.pb.go | 16 +++++++++++---- session/grpc/service_frostfs.pb.go | 4 +++- session/grpc/types_frostfs.pb.go | 24 +++++++++++++++++------ tombstone/grpc/types_frostfs.pb.go | 4 +++- util/proto/test/custom/test_frostfs.pb.go | 24 +++++++++++++++++------ util/protogen/internalgengo/json.go | 10 ++++++++-- 10 files changed, 92 insertions(+), 30 deletions(-) diff --git a/accounting/grpc/types_frostfs.pb.go b/accounting/grpc/types_frostfs.pb.go index 438cd03..8585583 100644 --- a/accounting/grpc/types_frostfs.pb.go +++ b/accounting/grpc/types_frostfs.pb.go @@ -125,7 +125,9 @@ func (x *Decimal) MarshalEasyJSON(out *jwriter.Writer) { } const prefix string = "\"value\":" out.RawString(prefix) - out.Int64(x.Value) + out.RawByte('"') + out.Buffer.Buf = strconv.AppendInt(out.Buffer.Buf, x.Value, 10) + out.RawByte('"') } } { diff --git a/acl/grpc/types_frostfs.pb.go b/acl/grpc/types_frostfs.pb.go index 6ebaf63..1ba6c53 100644 --- a/acl/grpc/types_frostfs.pb.go +++ b/acl/grpc/types_frostfs.pb.go @@ -1423,7 +1423,9 @@ func (x *BearerToken_Body_TokenLifetime) MarshalEasyJSON(out *jwriter.Writer) { } const prefix string = "\"exp\":" out.RawString(prefix) - out.Uint64(x.Exp) + out.RawByte('"') + out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.Exp, 10) + out.RawByte('"') } } { @@ -1435,7 +1437,9 @@ func (x *BearerToken_Body_TokenLifetime) MarshalEasyJSON(out *jwriter.Writer) { } const prefix string = "\"nbf\":" out.RawString(prefix) - out.Uint64(x.Nbf) + out.RawByte('"') + out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.Nbf, 10) + out.RawByte('"') } } { @@ -1447,7 +1451,9 @@ func (x *BearerToken_Body_TokenLifetime) MarshalEasyJSON(out *jwriter.Writer) { } const prefix string = "\"iat\":" out.RawString(prefix) - out.Uint64(x.Iat) + out.RawByte('"') + out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.Iat, 10) + out.RawByte('"') } } out.RawByte('}') diff --git a/netmap/grpc/types_frostfs.pb.go b/netmap/grpc/types_frostfs.pb.go index 24b7575..a4b10f9 100644 --- a/netmap/grpc/types_frostfs.pb.go +++ b/netmap/grpc/types_frostfs.pb.go @@ -2081,7 +2081,9 @@ func (x *Netmap) MarshalEasyJSON(out *jwriter.Writer) { } const prefix string = "\"epoch\":" out.RawString(prefix) - out.Uint64(x.Epoch) + out.RawByte('"') + out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.Epoch, 10) + out.RawByte('"') } } { @@ -2655,7 +2657,9 @@ func (x *NetworkInfo) MarshalEasyJSON(out *jwriter.Writer) { } const prefix string = "\"currentEpoch\":" out.RawString(prefix) - out.Uint64(x.CurrentEpoch) + out.RawByte('"') + out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.CurrentEpoch, 10) + out.RawByte('"') } } { @@ -2667,7 +2671,9 @@ func (x *NetworkInfo) MarshalEasyJSON(out *jwriter.Writer) { } const prefix string = "\"magicNumber\":" out.RawString(prefix) - out.Uint64(x.MagicNumber) + out.RawByte('"') + out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.MagicNumber, 10) + out.RawByte('"') } } { @@ -2679,7 +2685,9 @@ func (x *NetworkInfo) MarshalEasyJSON(out *jwriter.Writer) { } const prefix string = "\"msPerBlock\":" out.RawString(prefix) - out.Int64(x.MsPerBlock) + out.RawByte('"') + out.Buffer.Buf = strconv.AppendInt(out.Buffer.Buf, x.MsPerBlock, 10) + out.RawByte('"') } } { diff --git a/object/grpc/service_frostfs.pb.go b/object/grpc/service_frostfs.pb.go index 0130ee3..f934f3b 100644 --- a/object/grpc/service_frostfs.pb.go +++ b/object/grpc/service_frostfs.pb.go @@ -5612,7 +5612,9 @@ func (x *Range) MarshalEasyJSON(out *jwriter.Writer) { } const prefix string = "\"offset\":" out.RawString(prefix) - out.Uint64(x.Offset) + out.RawByte('"') + out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.Offset, 10) + out.RawByte('"') } } { @@ -5624,7 +5626,9 @@ func (x *Range) MarshalEasyJSON(out *jwriter.Writer) { } const prefix string = "\"length\":" out.RawString(prefix) - out.Uint64(x.Length) + out.RawByte('"') + out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.Length, 10) + out.RawByte('"') } } out.RawByte('}') diff --git a/object/grpc/types_frostfs.pb.go b/object/grpc/types_frostfs.pb.go index bc246cf..0ee939a 100644 --- a/object/grpc/types_frostfs.pb.go +++ b/object/grpc/types_frostfs.pb.go @@ -327,7 +327,9 @@ func (x *ShortHeader) MarshalEasyJSON(out *jwriter.Writer) { } const prefix string = "\"creationEpoch\":" out.RawString(prefix) - out.Uint64(x.CreationEpoch) + out.RawByte('"') + out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.CreationEpoch, 10) + out.RawByte('"') } } { @@ -368,7 +370,9 @@ func (x *ShortHeader) MarshalEasyJSON(out *jwriter.Writer) { } const prefix string = "\"payloadLength\":" out.RawString(prefix) - out.Uint64(x.PayloadLength) + out.RawByte('"') + out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.PayloadLength, 10) + out.RawByte('"') } } { @@ -1882,7 +1886,9 @@ func (x *Header) MarshalEasyJSON(out *jwriter.Writer) { } const prefix string = "\"creationEpoch\":" out.RawString(prefix) - out.Uint64(x.CreationEpoch) + out.RawByte('"') + out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.CreationEpoch, 10) + out.RawByte('"') } } { @@ -1894,7 +1900,9 @@ func (x *Header) MarshalEasyJSON(out *jwriter.Writer) { } const prefix string = "\"payloadLength\":" out.RawString(prefix) - out.Uint64(x.PayloadLength) + out.RawByte('"') + out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.PayloadLength, 10) + out.RawByte('"') } } { diff --git a/session/grpc/service_frostfs.pb.go b/session/grpc/service_frostfs.pb.go index 71a6a41..c71325a 100644 --- a/session/grpc/service_frostfs.pb.go +++ b/session/grpc/service_frostfs.pb.go @@ -141,7 +141,9 @@ func (x *CreateRequest_Body) MarshalEasyJSON(out *jwriter.Writer) { } const prefix string = "\"expiration\":" out.RawString(prefix) - out.Uint64(x.Expiration) + out.RawByte('"') + out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.Expiration, 10) + out.RawByte('"') } } out.RawByte('}') diff --git a/session/grpc/types_frostfs.pb.go b/session/grpc/types_frostfs.pb.go index 1b6a664..e18c1ab 100644 --- a/session/grpc/types_frostfs.pb.go +++ b/session/grpc/types_frostfs.pb.go @@ -877,7 +877,9 @@ func (x *SessionToken_Body_TokenLifetime) MarshalEasyJSON(out *jwriter.Writer) { } const prefix string = "\"exp\":" out.RawString(prefix) - out.Uint64(x.Exp) + out.RawByte('"') + out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.Exp, 10) + out.RawByte('"') } } { @@ -889,7 +891,9 @@ func (x *SessionToken_Body_TokenLifetime) MarshalEasyJSON(out *jwriter.Writer) { } const prefix string = "\"nbf\":" out.RawString(prefix) - out.Uint64(x.Nbf) + out.RawByte('"') + out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.Nbf, 10) + out.RawByte('"') } } { @@ -901,7 +905,9 @@ func (x *SessionToken_Body_TokenLifetime) MarshalEasyJSON(out *jwriter.Writer) { } const prefix string = "\"iat\":" out.RawString(prefix) - out.Uint64(x.Iat) + out.RawByte('"') + out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.Iat, 10) + out.RawByte('"') } } out.RawByte('}') @@ -1987,7 +1993,9 @@ func (x *RequestMetaHeader) MarshalEasyJSON(out *jwriter.Writer) { } const prefix string = "\"epoch\":" out.RawString(prefix) - out.Uint64(x.Epoch) + out.RawByte('"') + out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.Epoch, 10) + out.RawByte('"') } } { @@ -2066,7 +2074,9 @@ func (x *RequestMetaHeader) MarshalEasyJSON(out *jwriter.Writer) { } const prefix string = "\"magicNumber\":" out.RawString(prefix) - out.Uint64(x.MagicNumber) + out.RawByte('"') + out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.MagicNumber, 10) + out.RawByte('"') } } out.RawByte('}') @@ -2408,7 +2418,9 @@ func (x *ResponseMetaHeader) MarshalEasyJSON(out *jwriter.Writer) { } const prefix string = "\"epoch\":" out.RawString(prefix) - out.Uint64(x.Epoch) + out.RawByte('"') + out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.Epoch, 10) + out.RawByte('"') } } { diff --git a/tombstone/grpc/types_frostfs.pb.go b/tombstone/grpc/types_frostfs.pb.go index 0971045..e5b67d5 100644 --- a/tombstone/grpc/types_frostfs.pb.go +++ b/tombstone/grpc/types_frostfs.pb.go @@ -152,7 +152,9 @@ func (x *Tombstone) MarshalEasyJSON(out *jwriter.Writer) { } const prefix string = "\"expirationEpoch\":" out.RawString(prefix) - out.Uint64(x.ExpirationEpoch) + out.RawByte('"') + out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.ExpirationEpoch, 10) + out.RawByte('"') } } { diff --git a/util/proto/test/custom/test_frostfs.pb.go b/util/proto/test/custom/test_frostfs.pb.go index 15e77af..3804e46 100644 --- a/util/proto/test/custom/test_frostfs.pb.go +++ b/util/proto/test/custom/test_frostfs.pb.go @@ -647,7 +647,9 @@ func (x *Primitives) MarshalEasyJSON(out *jwriter.Writer) { } const prefix string = "\"fieldF\":" out.RawString(prefix) - out.Int64(x.FieldF) + out.RawByte('"') + out.Buffer.Buf = strconv.AppendInt(out.Buffer.Buf, x.FieldF, 10) + out.RawByte('"') } } { @@ -659,7 +661,9 @@ func (x *Primitives) MarshalEasyJSON(out *jwriter.Writer) { } const prefix string = "\"fieldG\":" out.RawString(prefix) - out.Uint64(x.FieldG) + out.RawByte('"') + out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.FieldG, 10) + out.RawByte('"') } } { @@ -671,7 +675,9 @@ func (x *Primitives) MarshalEasyJSON(out *jwriter.Writer) { } const prefix string = "\"fieldI\":" out.RawString(prefix) - out.Uint64(x.FieldI) + out.RawByte('"') + out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.FieldI, 10) + out.RawByte('"') } } { @@ -1448,7 +1454,9 @@ func (x *RepPrimitives) MarshalEasyJSON(out *jwriter.Writer) { if i != 0 { out.RawByte(',') } - out.Int64(x.FieldE[i]) + out.RawByte('"') + out.Buffer.Buf = strconv.AppendInt(out.Buffer.Buf, x.FieldE[i], 10) + out.RawByte('"') } out.RawByte(']') } @@ -1467,7 +1475,9 @@ func (x *RepPrimitives) MarshalEasyJSON(out *jwriter.Writer) { if i != 0 { out.RawByte(',') } - out.Uint64(x.FieldF[i]) + out.RawByte('"') + out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.FieldF[i], 10) + out.RawByte('"') } out.RawByte(']') } @@ -1486,7 +1496,9 @@ func (x *RepPrimitives) MarshalEasyJSON(out *jwriter.Writer) { if i != 0 { out.RawByte(',') } - out.Uint64(x.FieldFu[i]) + out.RawByte('"') + out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.FieldFu[i], 10) + out.RawByte('"') } out.RawByte(']') } diff --git a/util/protogen/internalgengo/json.go b/util/protogen/internalgengo/json.go index 4d7f4be..3267955 100644 --- a/util/protogen/internalgengo/json.go +++ b/util/protogen/internalgengo/json.go @@ -231,9 +231,15 @@ func emitJSONFieldWrite(g *protogen.GeneratedFile, f *protogen.Field, name strin case protoreflect.Uint32Kind, protoreflect.Fixed32Kind: template = "out.Uint32(%s)" case protoreflect.Int64Kind, protoreflect.Sint64Kind, protoreflect.Sfixed64Kind: - template = "out.Int64(%s)" + g.P("out.RawByte('\"')") + g.P("out.Buffer.Buf = ", strconvPackage.Ident("AppendInt"), "(out.Buffer.Buf, ", selector, ", 10)") + g.P("out.RawByte('\"')") + return case protoreflect.Uint64Kind, protoreflect.Fixed64Kind: - template = "out.Uint64(%s)" + g.P("out.RawByte('\"')") + g.P("out.Buffer.Buf = ", strconvPackage.Ident("AppendUint"), "(out.Buffer.Buf, ", selector, ", 10)") + g.P("out.RawByte('\"')") + return case protoreflect.FloatKind: template = "out.Float32(%s)" case protoreflect.DoubleKind: From d9a604fbc16fdcd988716a74cfd839eb3f83f50c Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Tue, 1 Oct 2024 13:54:32 +0300 Subject: [PATCH 1190/1196] [#120] proto/test: Unskip protojson compatibility test Signed-off-by: Evgenii Stratonikov --- util/proto/marshal_test.go | 1 - 1 file changed, 1 deletion(-) diff --git a/util/proto/marshal_test.go b/util/proto/marshal_test.go index 98422fc..8b717be 100644 --- a/util/proto/marshal_test.go +++ b/util/proto/marshal_test.go @@ -77,7 +77,6 @@ func TestStableMarshalSingle(t *testing.T) { require.NoError(t, protojson.Unmarshal(r, &actual)) t.Run("protojson compatibility", func(t *testing.T) { - t.Skip() data, err := protojson.Marshal(&actual) require.NoError(t, err) require.JSONEq(t, string(data), string(r)) From 3e705a3cbe84752a263d6e7ba64c57a3dd091f5b Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Wed, 2 Oct 2024 09:47:08 +0300 Subject: [PATCH 1191/1196] [#121] .golangci.yml: Replace exportloopref with copyloopvar Fix linter warning: ``` WARN The linter 'exportloopref' is deprecated (since v1.60.2) due to: Since Go1.22 (loopvar) this linter is no longer relevant. Replaced by copyloopvar. ``` Signed-off-by: Evgenii Stratonikov --- .golangci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.golangci.yml b/.golangci.yml index c6f4308..eacdf7b 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -50,7 +50,7 @@ linters: - bidichk - durationcheck - exhaustive - - exportloopref + - copyloopvar - gofmt - goimports - misspell From 29c522d5d8a31721b32fa0932f2f4abba445ec77 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Mon, 7 Oct 2024 15:00:16 +0300 Subject: [PATCH 1192/1196] [#122] protogen: Always marshal empty fields This is how it was done previously: https://git.frostfs.info/TrueCloudLab/frostfs-api-go/src/commit/a0a9b765f3a56423b1c6f1fef1d1b413da0e03ef/rpc/message/encoding.go#L31 The tricky part is `[]byte` which is marshaled as `null` by easyjson helper, but as `""` by protojson. Signed-off-by: Evgenii Stratonikov --- accounting/grpc/service_frostfs.pb.go | 128 +- accounting/grpc/types_frostfs.pb.go | 36 +- acl/grpc/types_frostfs.pb.go | 536 +++--- ape/grpc/types_frostfs.pb.go | 60 +- apemanager/grpc/service_frostfs.pb.go | 418 ++--- container/grpc/service_frostfs.pb.go | 574 +++--- container/grpc/types_frostfs.pb.go | 144 +- lock/grpc/types_frostfs.pb.go | 30 +- netmap/grpc/service_frostfs.pb.go | 352 ++-- netmap/grpc/types_frostfs.pb.go | 756 ++++---- object/grpc/service_frostfs.pb.go | 1926 +++++++++------------ object/grpc/types_frostfs.pb.go | 892 +++++----- refs/grpc/types_frostfs.pb.go | 260 +-- session/grpc/service_frostfs.pb.go | 168 +- session/grpc/types_frostfs.pb.go | 762 ++++---- status/grpc/types_frostfs.pb.go | 96 +- tombstone/grpc/types_frostfs.pb.go | 68 +- util/proto/marshal_test.go | 44 +- util/proto/test/custom/test_frostfs.pb.go | 530 +++--- util/protogen/internalgengo/json.go | 24 +- 20 files changed, 3574 insertions(+), 4230 deletions(-) diff --git a/accounting/grpc/service_frostfs.pb.go b/accounting/grpc/service_frostfs.pb.go index 4f11303..9c8c946 100644 --- a/accounting/grpc/service_frostfs.pb.go +++ b/accounting/grpc/service_frostfs.pb.go @@ -101,16 +101,14 @@ func (x *BalanceRequest_Body) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.OwnerId != nil { - 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 = "\"ownerId\":" + out.RawString(prefix) + x.OwnerId.MarshalEasyJSON(out) } out.RawByte('}') } @@ -306,40 +304,34 @@ func (x *BalanceRequest) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.Body != nil { - 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 = "\"body\":" + out.RawString(prefix) + x.Body.MarshalEasyJSON(out) } { - if x.MetaHeader != nil { - 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 = "\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) } { - if x.VerifyHeader != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"verifyHeader\":" - out.RawString(prefix) - x.VerifyHeader.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) } out.RawByte('}') } @@ -485,16 +477,14 @@ func (x *BalanceResponse_Body) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.Balance != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"balance\":" - out.RawString(prefix) - x.Balance.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"balance\":" + out.RawString(prefix) + x.Balance.MarshalEasyJSON(out) } out.RawByte('}') } @@ -690,40 +680,34 @@ func (x *BalanceResponse) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.Body != nil { - 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 = "\"body\":" + out.RawString(prefix) + x.Body.MarshalEasyJSON(out) } { - if x.MetaHeader != nil { - 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 = "\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) } { - if x.VerifyHeader != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"verifyHeader\":" - out.RawString(prefix) - x.VerifyHeader.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) } out.RawByte('}') } diff --git a/accounting/grpc/types_frostfs.pb.go b/accounting/grpc/types_frostfs.pb.go index 8585583..b7e6b40 100644 --- a/accounting/grpc/types_frostfs.pb.go +++ b/accounting/grpc/types_frostfs.pb.go @@ -117,30 +117,26 @@ func (x *Decimal) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.Value != 0 { - 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 = "\"value\":" + out.RawString(prefix) + out.RawByte('"') + out.Buffer.Buf = strconv.AppendInt(out.Buffer.Buf, x.Value, 10) + out.RawByte('"') } { - if x.Precision != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"precision\":" - out.RawString(prefix) - out.Uint32(x.Precision) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"precision\":" + out.RawString(prefix) + out.Uint32(x.Precision) } out.RawByte('}') } diff --git a/acl/grpc/types_frostfs.pb.go b/acl/grpc/types_frostfs.pb.go index 1ba6c53..e5a6f32 100644 --- a/acl/grpc/types_frostfs.pb.go +++ b/acl/grpc/types_frostfs.pb.go @@ -355,62 +355,54 @@ func (x *EACLRecord_Filter) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.HeaderType != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"headerType\":" - out.RawString(prefix) - v := int32(x.HeaderType) - if vv, ok := HeaderType_name[v]; ok { - out.String(vv) - } else { - out.Int32(v) - } + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"headerType\":" + out.RawString(prefix) + v := int32(x.HeaderType) + if vv, ok := HeaderType_name[v]; ok { + out.String(vv) + } else { + out.Int32(v) } } { - if x.MatchType != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"matchType\":" - out.RawString(prefix) - v := int32(x.MatchType) - if vv, ok := MatchType_name[v]; ok { - out.String(vv) - } else { - out.Int32(v) - } + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"matchType\":" + out.RawString(prefix) + v := int32(x.MatchType) + if vv, ok := MatchType_name[v]; ok { + out.String(vv) + } else { + out.Int32(v) } } { - if len(x.Key) != 0 { - 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 = "\"key\":" + out.RawString(prefix) + out.String(x.Key) } { - if len(x.Value) != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"value\":" - out.RawString(prefix) - out.String(x.Value) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"value\":" + out.RawString(prefix) + out.String(x.Value) } out.RawByte('}') } @@ -608,40 +600,40 @@ func (x *EACLRecord_Target) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.Role != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"role\":" - out.RawString(prefix) - v := int32(x.Role) - if vv, ok := Role_name[v]; ok { - out.String(vv) - } else { - out.Int32(v) - } + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"role\":" + out.RawString(prefix) + v := int32(x.Role) + if vv, ok := Role_name[v]; ok { + out.String(vv) + } else { + out.Int32(v) } } { - if len(x.Keys) != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"keys\":" - out.RawString(prefix) - out.RawByte('[') - for i := range x.Keys { - if i != 0 { - out.RawByte(',') - } - out.Base64Bytes(x.Keys[i]) - } - out.RawByte(']') + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"keys\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.Keys { + if i != 0 { + out.RawByte(',') + } + if x.Keys[i] != nil { + out.Base64Bytes(x.Keys[i]) + } else { + out.String("") + } + } + out.RawByte(']') } out.RawByte('}') } @@ -870,76 +862,68 @@ func (x *EACLRecord) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.Operation != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"operation\":" - out.RawString(prefix) - v := int32(x.Operation) - if vv, ok := Operation_name[v]; ok { - out.String(vv) - } else { - out.Int32(v) - } + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"operation\":" + out.RawString(prefix) + v := int32(x.Operation) + if vv, ok := Operation_name[v]; ok { + out.String(vv) + } else { + out.Int32(v) } } { - if x.Action != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"action\":" - out.RawString(prefix) - v := int32(x.Action) - if vv, ok := Action_name[v]; ok { - out.String(vv) - } else { - out.Int32(v) - } + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"action\":" + out.RawString(prefix) + v := int32(x.Action) + if vv, ok := Action_name[v]; ok { + out.String(vv) + } else { + out.Int32(v) } } { - if len(x.Filters) != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"filters\":" - out.RawString(prefix) - out.RawByte('[') - for i := range x.Filters { - if i != 0 { - out.RawByte(',') - } - x.Filters[i].MarshalEasyJSON(out) - } - out.RawByte(']') + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"filters\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.Filters { + if i != 0 { + out.RawByte(',') + } + x.Filters[i].MarshalEasyJSON(out) + } + out.RawByte(']') } { - if len(x.Targets) != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"targets\":" - out.RawString(prefix) - out.RawByte('[') - for i := range x.Targets { - if i != 0 { - out.RawByte(',') - } - x.Targets[i].MarshalEasyJSON(out) - } - out.RawByte(']') + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"targets\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.Targets { + if i != 0 { + out.RawByte(',') + } + x.Targets[i].MarshalEasyJSON(out) + } + out.RawByte(']') } out.RawByte('}') } @@ -1185,47 +1169,41 @@ func (x *EACLTable) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.Version != nil { - 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 = "\"version\":" + out.RawString(prefix) + x.Version.MarshalEasyJSON(out) } { - if x.ContainerId != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"containerID\":" - out.RawString(prefix) - x.ContainerId.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"containerID\":" + out.RawString(prefix) + x.ContainerId.MarshalEasyJSON(out) } { - if len(x.Records) != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"records\":" - out.RawString(prefix) - out.RawByte('[') - for i := range x.Records { - if i != 0 { - out.RawByte(',') - } - x.Records[i].MarshalEasyJSON(out) - } - out.RawByte(']') + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"records\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.Records { + if i != 0 { + out.RawByte(',') + } + x.Records[i].MarshalEasyJSON(out) + } + out.RawByte(']') } out.RawByte('}') } @@ -1415,46 +1393,40 @@ func (x *BearerToken_Body_TokenLifetime) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.Exp != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"exp\":" - out.RawString(prefix) - out.RawByte('"') - out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.Exp, 10) - out.RawByte('"') + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"exp\":" + out.RawString(prefix) + out.RawByte('"') + out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.Exp, 10) + out.RawByte('"') } { - if x.Nbf != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"nbf\":" - out.RawString(prefix) - out.RawByte('"') - out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.Nbf, 10) - out.RawByte('"') + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"nbf\":" + out.RawString(prefix) + out.RawByte('"') + out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.Nbf, 10) + out.RawByte('"') } { - if x.Iat != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"iat\":" - out.RawString(prefix) - out.RawByte('"') - out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.Iat, 10) - out.RawByte('"') + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"iat\":" + out.RawString(prefix) + out.RawByte('"') + out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.Iat, 10) + out.RawByte('"') } out.RawByte('}') } @@ -1647,35 +1619,31 @@ func (x *BearerToken_Body_APEOverride) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.Target != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"target\":" - out.RawString(prefix) - x.Target.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"target\":" + out.RawString(prefix) + x.Target.MarshalEasyJSON(out) } { - if len(x.Chains) != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"chains\":" - out.RawString(prefix) - out.RawByte('[') - for i := range x.Chains { - if i != 0 { - out.RawByte(',') - } - x.Chains[i].MarshalEasyJSON(out) - } - out.RawByte(']') + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"chains\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.Chains { + if i != 0 { + out.RawByte(',') + } + x.Chains[i].MarshalEasyJSON(out) + } + out.RawByte(']') } out.RawByte('}') } @@ -1910,64 +1878,54 @@ func (x *BearerToken_Body) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.EaclTable != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"eaclTable\":" - out.RawString(prefix) - x.EaclTable.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"eaclTable\":" + out.RawString(prefix) + x.EaclTable.MarshalEasyJSON(out) } { - if x.OwnerId != nil { - 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 = "\"ownerID\":" + out.RawString(prefix) + x.OwnerId.MarshalEasyJSON(out) } { - if x.Lifetime != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"lifetime\":" - out.RawString(prefix) - x.Lifetime.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"lifetime\":" + out.RawString(prefix) + x.Lifetime.MarshalEasyJSON(out) } { - if x.AllowImpersonate { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"allowImpersonate\":" - out.RawString(prefix) - out.Bool(x.AllowImpersonate) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"allowImpersonate\":" + out.RawString(prefix) + out.Bool(x.AllowImpersonate) } { - if x.ApeOverride != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"apeOverride\":" - out.RawString(prefix) - x.ApeOverride.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"apeOverride\":" + out.RawString(prefix) + x.ApeOverride.MarshalEasyJSON(out) } out.RawByte('}') } @@ -2149,28 +2107,24 @@ func (x *BearerToken) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.Body != nil { - 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 = "\"body\":" + out.RawString(prefix) + x.Body.MarshalEasyJSON(out) } { - if x.Signature != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"signature\":" - out.RawString(prefix) - x.Signature.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"signature\":" + out.RawString(prefix) + x.Signature.MarshalEasyJSON(out) } out.RawByte('}') } diff --git a/ape/grpc/types_frostfs.pb.go b/ape/grpc/types_frostfs.pb.go index 7967e13..cf9499f 100644 --- a/ape/grpc/types_frostfs.pb.go +++ b/ape/grpc/types_frostfs.pb.go @@ -158,33 +158,29 @@ func (x *ChainTarget) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.Type != 0 { - 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 = "\"type\":" + out.RawString(prefix) + v := int32(x.Type) + if vv, ok := TargetType_name[v]; ok { + out.String(vv) + } else { + out.Int32(v) } } { - if len(x.Name) != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"name\":" - out.RawString(prefix) - out.String(x.Name) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"name\":" + out.RawString(prefix) + out.String(x.Name) } out.RawByte('}') } @@ -358,15 +354,17 @@ func (x *Chain) MarshalEasyJSON(out *jwriter.Writer) { switch xx := x.Kind.(type) { case *Chain_Raw: { - if len(xx.Raw) != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"raw\":" - out.RawString(prefix) + 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("") } } } diff --git a/apemanager/grpc/service_frostfs.pb.go b/apemanager/grpc/service_frostfs.pb.go index 2a30850..7f3ed10 100644 --- a/apemanager/grpc/service_frostfs.pb.go +++ b/apemanager/grpc/service_frostfs.pb.go @@ -124,28 +124,24 @@ func (x *AddChainRequest_Body) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.Target != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"target\":" - out.RawString(prefix) - x.Target.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"target\":" + out.RawString(prefix) + x.Target.MarshalEasyJSON(out) } { - if x.Chain != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"chain\":" - out.RawString(prefix) - x.Chain.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"chain\":" + out.RawString(prefix) + x.Chain.MarshalEasyJSON(out) } out.RawByte('}') } @@ -348,40 +344,34 @@ func (x *AddChainRequest) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.Body != nil { - 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 = "\"body\":" + out.RawString(prefix) + x.Body.MarshalEasyJSON(out) } { - if x.MetaHeader != nil { - 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 = "\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) } { - if x.VerifyHeader != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"verifyHeader\":" - out.RawString(prefix) - x.VerifyHeader.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) } out.RawByte('}') } @@ -524,15 +514,17 @@ func (x *AddChainResponse_Body) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if len(x.ChainId) != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"chainId\":" - out.RawString(prefix) + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"chainId\":" + out.RawString(prefix) + if x.ChainId != nil { out.Base64Bytes(x.ChainId) + } else { + out.String("") } } out.RawByte('}') @@ -728,40 +720,34 @@ func (x *AddChainResponse) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.Body != nil { - 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 = "\"body\":" + out.RawString(prefix) + x.Body.MarshalEasyJSON(out) } { - if x.MetaHeader != nil { - 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 = "\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) } { - if x.VerifyHeader != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"verifyHeader\":" - out.RawString(prefix) - x.VerifyHeader.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) } out.RawByte('}') } @@ -927,27 +913,27 @@ func (x *RemoveChainRequest_Body) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.Target != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"target\":" - out.RawString(prefix) - x.Target.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"target\":" + out.RawString(prefix) + x.Target.MarshalEasyJSON(out) } { - if len(x.ChainId) != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"chainId\":" - out.RawString(prefix) + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"chainId\":" + out.RawString(prefix) + if x.ChainId != nil { out.Base64Bytes(x.ChainId) + } else { + out.String("") } } out.RawByte('}') @@ -1150,40 +1136,34 @@ func (x *RemoveChainRequest) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.Body != nil { - 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 = "\"body\":" + out.RawString(prefix) + x.Body.MarshalEasyJSON(out) } { - if x.MetaHeader != nil { - 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 = "\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) } { - if x.VerifyHeader != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"verifyHeader\":" - out.RawString(prefix) - x.VerifyHeader.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) } out.RawByte('}') } @@ -1488,40 +1468,34 @@ func (x *RemoveChainResponse) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.Body != nil { - 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 = "\"body\":" + out.RawString(prefix) + x.Body.MarshalEasyJSON(out) } { - if x.MetaHeader != nil { - 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 = "\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) } { - if x.VerifyHeader != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"verifyHeader\":" - out.RawString(prefix) - x.VerifyHeader.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) } out.RawByte('}') } @@ -1667,16 +1641,14 @@ func (x *ListChainsRequest_Body) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.Target != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"target\":" - out.RawString(prefix) - x.Target.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"target\":" + out.RawString(prefix) + x.Target.MarshalEasyJSON(out) } out.RawByte('}') } @@ -1872,40 +1844,34 @@ func (x *ListChainsRequest) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.Body != nil { - 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 = "\"body\":" + out.RawString(prefix) + x.Body.MarshalEasyJSON(out) } { - if x.MetaHeader != nil { - 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 = "\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) } { - if x.VerifyHeader != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"verifyHeader\":" - out.RawString(prefix) - x.VerifyHeader.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) } out.RawByte('}') } @@ -2054,23 +2020,21 @@ func (x *ListChainsResponse_Body) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if len(x.Chains) != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"chains\":" - out.RawString(prefix) - out.RawByte('[') - for i := range x.Chains { - if i != 0 { - out.RawByte(',') - } - x.Chains[i].MarshalEasyJSON(out) - } - out.RawByte(']') + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"chains\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.Chains { + if i != 0 { + out.RawByte(',') + } + x.Chains[i].MarshalEasyJSON(out) + } + out.RawByte(']') } out.RawByte('}') } @@ -2273,40 +2237,34 @@ func (x *ListChainsResponse) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.Body != nil { - 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 = "\"body\":" + out.RawString(prefix) + x.Body.MarshalEasyJSON(out) } { - if x.MetaHeader != nil { - 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 = "\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) } { - if x.VerifyHeader != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"verifyHeader\":" - out.RawString(prefix) - x.VerifyHeader.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) } out.RawByte('}') } diff --git a/container/grpc/service_frostfs.pb.go b/container/grpc/service_frostfs.pb.go index 4ccb595..cc05dde 100644 --- a/container/grpc/service_frostfs.pb.go +++ b/container/grpc/service_frostfs.pb.go @@ -124,28 +124,24 @@ func (x *PutRequest_Body) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.Container != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"container\":" - out.RawString(prefix) - x.Container.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"container\":" + out.RawString(prefix) + x.Container.MarshalEasyJSON(out) } { - if x.Signature != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"signature\":" - out.RawString(prefix) - x.Signature.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"signature\":" + out.RawString(prefix) + x.Signature.MarshalEasyJSON(out) } out.RawByte('}') } @@ -348,40 +344,34 @@ func (x *PutRequest) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.Body != nil { - 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 = "\"body\":" + out.RawString(prefix) + x.Body.MarshalEasyJSON(out) } { - if x.MetaHeader != nil { - 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 = "\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) } { - if x.VerifyHeader != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"verifyHeader\":" - out.RawString(prefix) - x.VerifyHeader.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) } out.RawByte('}') } @@ -527,16 +517,14 @@ func (x *PutResponse_Body) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.ContainerId != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"containerId\":" - out.RawString(prefix) - x.ContainerId.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"containerId\":" + out.RawString(prefix) + x.ContainerId.MarshalEasyJSON(out) } out.RawByte('}') } @@ -732,40 +720,34 @@ func (x *PutResponse) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.Body != nil { - 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 = "\"body\":" + out.RawString(prefix) + x.Body.MarshalEasyJSON(out) } { - if x.MetaHeader != nil { - 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 = "\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) } { - if x.VerifyHeader != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"verifyHeader\":" - out.RawString(prefix) - x.VerifyHeader.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) } out.RawByte('}') } @@ -934,28 +916,24 @@ func (x *DeleteRequest_Body) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.ContainerId != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"containerId\":" - out.RawString(prefix) - x.ContainerId.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"containerId\":" + out.RawString(prefix) + x.ContainerId.MarshalEasyJSON(out) } { - if x.Signature != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"signature\":" - out.RawString(prefix) - x.Signature.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"signature\":" + out.RawString(prefix) + x.Signature.MarshalEasyJSON(out) } out.RawByte('}') } @@ -1158,40 +1136,34 @@ func (x *DeleteRequest) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.Body != nil { - 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 = "\"body\":" + out.RawString(prefix) + x.Body.MarshalEasyJSON(out) } { - if x.MetaHeader != nil { - 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 = "\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) } { - if x.VerifyHeader != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"verifyHeader\":" - out.RawString(prefix) - x.VerifyHeader.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) } out.RawByte('}') } @@ -1496,40 +1468,34 @@ func (x *DeleteResponse) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.Body != nil { - 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 = "\"body\":" + out.RawString(prefix) + x.Body.MarshalEasyJSON(out) } { - if x.MetaHeader != nil { - 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 = "\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) } { - if x.VerifyHeader != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"verifyHeader\":" - out.RawString(prefix) - x.VerifyHeader.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) } out.RawByte('}') } @@ -1675,16 +1641,14 @@ func (x *GetRequest_Body) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.ContainerId != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"containerId\":" - out.RawString(prefix) - x.ContainerId.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"containerId\":" + out.RawString(prefix) + x.ContainerId.MarshalEasyJSON(out) } out.RawByte('}') } @@ -1880,40 +1844,34 @@ func (x *GetRequest) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.Body != nil { - 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 = "\"body\":" + out.RawString(prefix) + x.Body.MarshalEasyJSON(out) } { - if x.MetaHeader != nil { - 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 = "\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) } { - if x.VerifyHeader != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"verifyHeader\":" - out.RawString(prefix) - x.VerifyHeader.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) } out.RawByte('}') } @@ -2105,40 +2063,34 @@ func (x *GetResponse_Body) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.Container != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"container\":" - out.RawString(prefix) - x.Container.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"container\":" + out.RawString(prefix) + x.Container.MarshalEasyJSON(out) } { - if x.Signature != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"signature\":" - out.RawString(prefix) - x.Signature.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"signature\":" + out.RawString(prefix) + x.Signature.MarshalEasyJSON(out) } { - if x.SessionToken != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"sessionToken\":" - out.RawString(prefix) - x.SessionToken.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"sessionToken\":" + out.RawString(prefix) + x.SessionToken.MarshalEasyJSON(out) } out.RawByte('}') } @@ -2348,40 +2300,34 @@ func (x *GetResponse) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.Body != nil { - 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 = "\"body\":" + out.RawString(prefix) + x.Body.MarshalEasyJSON(out) } { - if x.MetaHeader != nil { - 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 = "\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) } { - if x.VerifyHeader != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"verifyHeader\":" - out.RawString(prefix) - x.VerifyHeader.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) } out.RawByte('}') } @@ -2527,16 +2473,14 @@ func (x *ListRequest_Body) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.OwnerId != nil { - 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 = "\"ownerId\":" + out.RawString(prefix) + x.OwnerId.MarshalEasyJSON(out) } out.RawByte('}') } @@ -2732,40 +2676,34 @@ func (x *ListRequest) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.Body != nil { - 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 = "\"body\":" + out.RawString(prefix) + x.Body.MarshalEasyJSON(out) } { - if x.MetaHeader != nil { - 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 = "\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) } { - if x.VerifyHeader != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"verifyHeader\":" - out.RawString(prefix) - x.VerifyHeader.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) } out.RawByte('}') } @@ -2914,23 +2852,21 @@ func (x *ListResponse_Body) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if len(x.ContainerIds) != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"containerIds\":" - out.RawString(prefix) - out.RawByte('[') - for i := range x.ContainerIds { - if i != 0 { - out.RawByte(',') - } - x.ContainerIds[i].MarshalEasyJSON(out) - } - out.RawByte(']') + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"containerIds\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.ContainerIds { + if i != 0 { + out.RawByte(',') + } + x.ContainerIds[i].MarshalEasyJSON(out) + } + out.RawByte(']') } out.RawByte('}') } @@ -3133,40 +3069,34 @@ func (x *ListResponse) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.Body != nil { - 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 = "\"body\":" + out.RawString(prefix) + x.Body.MarshalEasyJSON(out) } { - if x.MetaHeader != nil { - 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 = "\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) } { - if x.VerifyHeader != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"verifyHeader\":" - out.RawString(prefix) - x.VerifyHeader.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) } out.RawByte('}') } diff --git a/container/grpc/types_frostfs.pb.go b/container/grpc/types_frostfs.pb.go index e5da35f..4ca23fa 100644 --- a/container/grpc/types_frostfs.pb.go +++ b/container/grpc/types_frostfs.pb.go @@ -119,28 +119,24 @@ func (x *Container_Attribute) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if len(x.Key) != 0 { - 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 = "\"key\":" + out.RawString(prefix) + out.String(x.Key) } { - if len(x.Value) != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"value\":" - out.RawString(prefix) - out.String(x.Value) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"value\":" + out.RawString(prefix) + out.String(x.Value) } out.RawByte('}') } @@ -389,83 +385,75 @@ func (x *Container) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.Version != nil { - 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 = "\"version\":" + out.RawString(prefix) + x.Version.MarshalEasyJSON(out) } { - if x.OwnerId != nil { - 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 = "\"ownerID\":" + out.RawString(prefix) + x.OwnerId.MarshalEasyJSON(out) } { - if len(x.Nonce) != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"nonce\":" - out.RawString(prefix) + 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 x.BasicAcl != 0 { - 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 = "\"basicACL\":" + out.RawString(prefix) + out.Uint32(x.BasicAcl) } { - if len(x.Attributes) != 0 { - 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 = "\"attributes\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.Attributes { + if i != 0 { + out.RawByte(',') + } + x.Attributes[i].MarshalEasyJSON(out) + } + out.RawByte(']') } { - if x.PlacementPolicy != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"placementPolicy\":" - out.RawString(prefix) - x.PlacementPolicy.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"placementPolicy\":" + out.RawString(prefix) + x.PlacementPolicy.MarshalEasyJSON(out) } out.RawByte('}') } diff --git a/lock/grpc/types_frostfs.pb.go b/lock/grpc/types_frostfs.pb.go index 33f22c5..004a01f 100644 --- a/lock/grpc/types_frostfs.pb.go +++ b/lock/grpc/types_frostfs.pb.go @@ -103,23 +103,21 @@ func (x *Lock) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if len(x.Members) != 0 { - 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(']') + 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('}') } diff --git a/netmap/grpc/service_frostfs.pb.go b/netmap/grpc/service_frostfs.pb.go index 4d53031..9ebbf98 100644 --- a/netmap/grpc/service_frostfs.pb.go +++ b/netmap/grpc/service_frostfs.pb.go @@ -260,40 +260,34 @@ func (x *LocalNodeInfoRequest) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.Body != nil { - 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 = "\"body\":" + out.RawString(prefix) + x.Body.MarshalEasyJSON(out) } { - if x.MetaHeader != nil { - 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 = "\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) } { - if x.VerifyHeader != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"verifyHeader\":" - out.RawString(prefix) - x.VerifyHeader.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) } out.RawByte('}') } @@ -462,28 +456,24 @@ func (x *LocalNodeInfoResponse_Body) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.Version != nil { - 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 = "\"version\":" + out.RawString(prefix) + x.Version.MarshalEasyJSON(out) } { - if x.NodeInfo != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"nodeInfo\":" - out.RawString(prefix) - x.NodeInfo.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"nodeInfo\":" + out.RawString(prefix) + x.NodeInfo.MarshalEasyJSON(out) } out.RawByte('}') } @@ -686,40 +676,34 @@ func (x *LocalNodeInfoResponse) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.Body != nil { - 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 = "\"body\":" + out.RawString(prefix) + x.Body.MarshalEasyJSON(out) } { - if x.MetaHeader != nil { - 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 = "\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) } { - if x.VerifyHeader != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"verifyHeader\":" - out.RawString(prefix) - x.VerifyHeader.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) } out.RawByte('}') } @@ -1024,40 +1008,34 @@ func (x *NetworkInfoRequest) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.Body != nil { - 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 = "\"body\":" + out.RawString(prefix) + x.Body.MarshalEasyJSON(out) } { - if x.MetaHeader != nil { - 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 = "\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) } { - if x.VerifyHeader != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"verifyHeader\":" - out.RawString(prefix) - x.VerifyHeader.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) } out.RawByte('}') } @@ -1203,16 +1181,14 @@ func (x *NetworkInfoResponse_Body) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.NetworkInfo != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"networkInfo\":" - out.RawString(prefix) - x.NetworkInfo.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"networkInfo\":" + out.RawString(prefix) + x.NetworkInfo.MarshalEasyJSON(out) } out.RawByte('}') } @@ -1408,40 +1384,34 @@ func (x *NetworkInfoResponse) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.Body != nil { - 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 = "\"body\":" + out.RawString(prefix) + x.Body.MarshalEasyJSON(out) } { - if x.MetaHeader != nil { - 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 = "\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) } { - if x.VerifyHeader != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"verifyHeader\":" - out.RawString(prefix) - x.VerifyHeader.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) } out.RawByte('}') } @@ -1746,40 +1716,34 @@ func (x *NetmapSnapshotRequest) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.Body != nil { - 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 = "\"body\":" + out.RawString(prefix) + x.Body.MarshalEasyJSON(out) } { - if x.MetaHeader != nil { - 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 = "\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) } { - if x.VerifyHeader != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"verifyHeader\":" - out.RawString(prefix) - x.VerifyHeader.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) } out.RawByte('}') } @@ -1925,16 +1889,14 @@ func (x *NetmapSnapshotResponse_Body) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.Netmap != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"netmap\":" - out.RawString(prefix) - x.Netmap.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"netmap\":" + out.RawString(prefix) + x.Netmap.MarshalEasyJSON(out) } out.RawByte('}') } @@ -2130,40 +2092,34 @@ func (x *NetmapSnapshotResponse) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.Body != nil { - 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 = "\"body\":" + out.RawString(prefix) + x.Body.MarshalEasyJSON(out) } { - if x.MetaHeader != nil { - 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 = "\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) } { - if x.VerifyHeader != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"verifyHeader\":" - out.RawString(prefix) - x.VerifyHeader.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) } out.RawByte('}') } diff --git a/netmap/grpc/types_frostfs.pb.go b/netmap/grpc/types_frostfs.pb.go index a4b10f9..0328531 100644 --- a/netmap/grpc/types_frostfs.pb.go +++ b/netmap/grpc/types_frostfs.pb.go @@ -277,76 +277,66 @@ func (x *Filter) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if len(x.Name) != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"name\":" - out.RawString(prefix) - out.String(x.Name) + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"name\":" + out.RawString(prefix) + out.String(x.Name) + } + { + 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 = "\"op\":" + out.RawString(prefix) + v := int32(x.Op) + if vv, ok := Operation_name[v]; ok { + out.String(vv) + } else { + out.Int32(v) } } { - if len(x.Key) != 0 { - 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) } { - if x.Op != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"op\":" - out.RawString(prefix) - v := int32(x.Op) - if vv, ok := Operation_name[v]; ok { - out.String(vv) - } else { - out.Int32(v) - } + if !first { + out.RawByte(',') + } else { + first = false } - } - { - if len(x.Value) != 0 { - if !first { + const prefix string = "\"filters\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.Filters { + if i != 0 { out.RawByte(',') - } else { - first = false } - const prefix string = "\"value\":" - out.RawString(prefix) - out.String(x.Value) - } - } - { - if len(x.Filters) != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"filters\":" - out.RawString(prefix) - out.RawByte('[') - for i := range x.Filters { - if i != 0 { - out.RawByte(',') - } - x.Filters[i].MarshalEasyJSON(out) - } - out.RawByte(']') + x.Filters[i].MarshalEasyJSON(out) } + out.RawByte(']') } out.RawByte('}') } @@ -602,69 +592,59 @@ func (x *Selector) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if len(x.Name) != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"name\":" - out.RawString(prefix) - out.String(x.Name) + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"name\":" + out.RawString(prefix) + out.String(x.Name) + } + { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"count\":" + out.RawString(prefix) + out.Uint32(x.Count) + } + { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"clause\":" + out.RawString(prefix) + v := int32(x.Clause) + if vv, ok := Clause_name[v]; ok { + out.String(vv) + } else { + out.Int32(v) } } { - if x.Count != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"count\":" - out.RawString(prefix) - out.Uint32(x.Count) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"attribute\":" + out.RawString(prefix) + out.String(x.Attribute) } { - if x.Clause != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"clause\":" - out.RawString(prefix) - v := int32(x.Clause) - if vv, ok := Clause_name[v]; ok { - out.String(vv) - } else { - out.Int32(v) - } - } - } - { - if len(x.Attribute) != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"attribute\":" - out.RawString(prefix) - out.String(x.Attribute) - } - } - { - if len(x.Filter) != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"filter\":" - out.RawString(prefix) - out.String(x.Filter) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"filter\":" + out.RawString(prefix) + out.String(x.Filter) } out.RawByte('}') } @@ -900,52 +880,44 @@ func (x *Replica) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.Count != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"count\":" - out.RawString(prefix) - out.Uint32(x.Count) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"count\":" + out.RawString(prefix) + out.Uint32(x.Count) } { - if len(x.Selector) != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"selector\":" - out.RawString(prefix) - out.String(x.Selector) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"selector\":" + out.RawString(prefix) + out.String(x.Selector) } { - if x.EcDataCount != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"ecDataCount\":" - out.RawString(prefix) - out.Uint32(x.EcDataCount) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"ecDataCount\":" + out.RawString(prefix) + out.Uint32(x.EcDataCount) } { - if x.EcParityCount != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"ecParityCount\":" - out.RawString(prefix) - out.Uint32(x.EcParityCount) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"ecParityCount\":" + out.RawString(prefix) + out.Uint32(x.EcParityCount) } out.RawByte('}') } @@ -1213,85 +1185,75 @@ func (x *PlacementPolicy) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if len(x.Replicas) != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"replicas\":" - out.RawString(prefix) - out.RawByte('[') - for i := range x.Replicas { - if i != 0 { - out.RawByte(',') - } - x.Replicas[i].MarshalEasyJSON(out) - } - out.RawByte(']') + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"replicas\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.Replicas { + if i != 0 { + out.RawByte(',') + } + x.Replicas[i].MarshalEasyJSON(out) + } + out.RawByte(']') } { - if x.ContainerBackupFactor != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"containerBackupFactor\":" - out.RawString(prefix) - out.Uint32(x.ContainerBackupFactor) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"containerBackupFactor\":" + out.RawString(prefix) + out.Uint32(x.ContainerBackupFactor) } { - if len(x.Selectors) != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"selectors\":" - out.RawString(prefix) - out.RawByte('[') - for i := range x.Selectors { - if i != 0 { - out.RawByte(',') - } - x.Selectors[i].MarshalEasyJSON(out) - } - out.RawByte(']') + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"selectors\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.Selectors { + if i != 0 { + out.RawByte(',') + } + x.Selectors[i].MarshalEasyJSON(out) + } + out.RawByte(']') } { - if len(x.Filters) != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"filters\":" - out.RawString(prefix) - out.RawByte('[') - for i := range x.Filters { - if i != 0 { - out.RawByte(',') - } - x.Filters[i].MarshalEasyJSON(out) - } - out.RawByte(']') + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"filters\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.Filters { + if i != 0 { + out.RawByte(',') + } + x.Filters[i].MarshalEasyJSON(out) + } + out.RawByte(']') } { - if x.Unique { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"unique\":" - out.RawString(prefix) - out.Bool(x.Unique) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"unique\":" + out.RawString(prefix) + out.Bool(x.Unique) } out.RawByte('}') } @@ -1553,47 +1515,41 @@ func (x *NodeInfo_Attribute) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if len(x.Key) != 0 { - 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 = "\"key\":" + out.RawString(prefix) + out.String(x.Key) } { - if len(x.Value) != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"value\":" - out.RawString(prefix) - out.String(x.Value) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"value\":" + out.RawString(prefix) + out.String(x.Value) } { - if len(x.Parents) != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"parents\":" - out.RawString(prefix) - out.RawByte('[') - for i := range x.Parents { - if i != 0 { - out.RawByte(',') - } - out.String(x.Parents[i]) - } - out.RawByte(']') + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"parents\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.Parents { + if i != 0 { + out.RawByte(',') + } + out.String(x.Parents[i]) + } + out.RawByte(']') } out.RawByte('}') } @@ -1806,70 +1762,66 @@ func (x *NodeInfo) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if len(x.PublicKey) != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"publicKey\":" - out.RawString(prefix) + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"publicKey\":" + out.RawString(prefix) + if x.PublicKey != nil { out.Base64Bytes(x.PublicKey) + } else { + out.String("") } } { - if len(x.Addresses) != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"addresses\":" - out.RawString(prefix) - out.RawByte('[') - for i := range x.Addresses { - if i != 0 { - out.RawByte(',') - } - out.String(x.Addresses[i]) - } - out.RawByte(']') + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"addresses\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.Addresses { + if i != 0 { + out.RawByte(',') + } + out.String(x.Addresses[i]) + } + out.RawByte(']') } { - if len(x.Attributes) != 0 { - 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 = "\"attributes\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.Attributes { + if i != 0 { + out.RawByte(',') + } + x.Attributes[i].MarshalEasyJSON(out) + } + out.RawByte(']') } { - if x.State != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"state\":" - out.RawString(prefix) - v := int32(x.State) - if vv, ok := NodeInfo_State_name[v]; ok { - out.String(vv) - } else { - out.Int32(v) - } + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"state\":" + out.RawString(prefix) + v := int32(x.State) + if vv, ok := NodeInfo_State_name[v]; ok { + out.String(vv) + } else { + out.Int32(v) } } out.RawByte('}') @@ -2073,37 +2025,33 @@ func (x *Netmap) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.Epoch != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"epoch\":" - out.RawString(prefix) - out.RawByte('"') - out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.Epoch, 10) - out.RawByte('"') + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"epoch\":" + out.RawString(prefix) + out.RawByte('"') + out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.Epoch, 10) + out.RawByte('"') } { - if len(x.Nodes) != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"nodes\":" - out.RawString(prefix) - out.RawByte('[') - for i := range x.Nodes { - if i != 0 { - out.RawByte(',') - } - x.Nodes[i].MarshalEasyJSON(out) - } - out.RawByte(']') + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"nodes\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.Nodes { + if i != 0 { + out.RawByte(',') + } + x.Nodes[i].MarshalEasyJSON(out) + } + out.RawByte(']') } out.RawByte('}') } @@ -2273,27 +2221,31 @@ func (x *NetworkConfig_Parameter) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if len(x.Key) != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"key\":" - out.RawString(prefix) + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"key\":" + out.RawString(prefix) + if x.Key != nil { out.Base64Bytes(x.Key) + } else { + out.String("") } } { - if len(x.Value) != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"value\":" - out.RawString(prefix) + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"value\":" + out.RawString(prefix) + if x.Value != nil { out.Base64Bytes(x.Value) + } else { + out.String("") } } out.RawByte('}') @@ -2434,23 +2386,21 @@ func (x *NetworkConfig) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if len(x.Parameters) != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"parameters\":" - out.RawString(prefix) - out.RawByte('[') - for i := range x.Parameters { - if i != 0 { - out.RawByte(',') - } - x.Parameters[i].MarshalEasyJSON(out) - } - out.RawByte(']') + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"parameters\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.Parameters { + if i != 0 { + out.RawByte(',') + } + x.Parameters[i].MarshalEasyJSON(out) + } + out.RawByte(']') } out.RawByte('}') } @@ -2649,58 +2599,50 @@ func (x *NetworkInfo) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.CurrentEpoch != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"currentEpoch\":" - out.RawString(prefix) - out.RawByte('"') - out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.CurrentEpoch, 10) - out.RawByte('"') + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"currentEpoch\":" + out.RawString(prefix) + out.RawByte('"') + out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.CurrentEpoch, 10) + out.RawByte('"') } { - if x.MagicNumber != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"magicNumber\":" - out.RawString(prefix) - out.RawByte('"') - out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.MagicNumber, 10) - out.RawByte('"') + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"magicNumber\":" + out.RawString(prefix) + out.RawByte('"') + out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.MagicNumber, 10) + out.RawByte('"') } { - if x.MsPerBlock != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"msPerBlock\":" - out.RawString(prefix) - out.RawByte('"') - out.Buffer.Buf = strconv.AppendInt(out.Buffer.Buf, x.MsPerBlock, 10) - out.RawByte('"') + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"msPerBlock\":" + out.RawString(prefix) + out.RawByte('"') + out.Buffer.Buf = strconv.AppendInt(out.Buffer.Buf, x.MsPerBlock, 10) + out.RawByte('"') } { - if x.NetworkConfig != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"networkConfig\":" - out.RawString(prefix) - x.NetworkConfig.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"networkConfig\":" + out.RawString(prefix) + x.NetworkConfig.MarshalEasyJSON(out) } out.RawByte('}') } diff --git a/object/grpc/service_frostfs.pb.go b/object/grpc/service_frostfs.pb.go index f934f3b..9ee5a3d 100644 --- a/object/grpc/service_frostfs.pb.go +++ b/object/grpc/service_frostfs.pb.go @@ -122,28 +122,24 @@ func (x *GetRequest_Body) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.Address != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"address\":" - out.RawString(prefix) - x.Address.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"address\":" + out.RawString(prefix) + x.Address.MarshalEasyJSON(out) } { - if x.Raw { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"raw\":" - out.RawString(prefix) - out.Bool(x.Raw) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"raw\":" + out.RawString(prefix) + out.Bool(x.Raw) } out.RawByte('}') } @@ -345,40 +341,34 @@ func (x *GetRequest) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.Body != nil { - 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 = "\"body\":" + out.RawString(prefix) + x.Body.MarshalEasyJSON(out) } { - if x.MetaHeader != nil { - 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 = "\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) } { - if x.VerifyHeader != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"verifyHeader\":" - out.RawString(prefix) - x.VerifyHeader.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) } out.RawByte('}') } @@ -570,40 +560,34 @@ func (x *GetResponse_Body_Init) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.ObjectId != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"objectId\":" - out.RawString(prefix) - x.ObjectId.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"objectId\":" + out.RawString(prefix) + x.ObjectId.MarshalEasyJSON(out) } { - if x.Signature != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"signature\":" - out.RawString(prefix) - x.Signature.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"signature\":" + out.RawString(prefix) + x.Signature.MarshalEasyJSON(out) } { - if x.Header != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"header\":" - out.RawString(prefix) - x.Header.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"header\":" + out.RawString(prefix) + x.Header.MarshalEasyJSON(out) } out.RawByte('}') } @@ -851,55 +835,51 @@ func (x *GetResponse_Body) MarshalEasyJSON(out *jwriter.Writer) { switch xx := x.ObjectPart.(type) { case *GetResponse_Body_Init_: { - if xx.Init != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"init\":" - out.RawString(prefix) - xx.Init.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"init\":" + out.RawString(prefix) + xx.Init.MarshalEasyJSON(out) } case *GetResponse_Body_Chunk: { - if len(xx.Chunk) != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"chunk\":" - out.RawString(prefix) + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"chunk\":" + out.RawString(prefix) + if xx.Chunk != nil { out.Base64Bytes(xx.Chunk) + } else { + out.String("") } } case *GetResponse_Body_SplitInfo: { - if xx.SplitInfo != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"splitInfo\":" - out.RawString(prefix) - xx.SplitInfo.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"splitInfo\":" + out.RawString(prefix) + xx.SplitInfo.MarshalEasyJSON(out) } case *GetResponse_Body_EcInfo: { - if xx.EcInfo != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"ecInfo\":" - out.RawString(prefix) - xx.EcInfo.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"ecInfo\":" + out.RawString(prefix) + xx.EcInfo.MarshalEasyJSON(out) } } out.RawByte('}') @@ -1152,40 +1132,34 @@ func (x *GetResponse) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.Body != nil { - 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 = "\"body\":" + out.RawString(prefix) + x.Body.MarshalEasyJSON(out) } { - if x.MetaHeader != nil { - 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 = "\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) } { - if x.VerifyHeader != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"verifyHeader\":" - out.RawString(prefix) - x.VerifyHeader.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) } out.RawByte('}') } @@ -1399,59 +1373,51 @@ func (x *PutRequest_Body_Init) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.ObjectId != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"objectId\":" - out.RawString(prefix) - x.ObjectId.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"objectId\":" + out.RawString(prefix) + x.ObjectId.MarshalEasyJSON(out) } { - if x.Signature != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"signature\":" - out.RawString(prefix) - x.Signature.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"signature\":" + out.RawString(prefix) + x.Signature.MarshalEasyJSON(out) } { - if x.Header != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"header\":" - out.RawString(prefix) - x.Header.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"header\":" + out.RawString(prefix) + x.Header.MarshalEasyJSON(out) } { - if len(x.CopiesNumber) != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"copiesNumber\":" - out.RawString(prefix) - out.RawByte('[') - for i := range x.CopiesNumber { - if i != 0 { - out.RawByte(',') - } - out.Uint32(x.CopiesNumber[i]) - } - out.RawByte(']') + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"copiesNumber\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.CopiesNumber { + if i != 0 { + out.RawByte(',') + } + out.Uint32(x.CopiesNumber[i]) + } + out.RawByte(']') } out.RawByte('}') } @@ -1666,28 +1632,28 @@ func (x *PutRequest_Body) MarshalEasyJSON(out *jwriter.Writer) { switch xx := x.ObjectPart.(type) { case *PutRequest_Body_Init_: { - if xx.Init != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"init\":" - out.RawString(prefix) - xx.Init.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"init\":" + out.RawString(prefix) + xx.Init.MarshalEasyJSON(out) } case *PutRequest_Body_Chunk: { - if len(xx.Chunk) != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"chunk\":" - out.RawString(prefix) + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"chunk\":" + out.RawString(prefix) + if xx.Chunk != nil { out.Base64Bytes(xx.Chunk) + } else { + out.String("") } } } @@ -1911,40 +1877,34 @@ func (x *PutRequest) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.Body != nil { - 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 = "\"body\":" + out.RawString(prefix) + x.Body.MarshalEasyJSON(out) } { - if x.MetaHeader != nil { - 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 = "\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) } { - if x.VerifyHeader != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"verifyHeader\":" - out.RawString(prefix) - x.VerifyHeader.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) } out.RawByte('}') } @@ -2090,16 +2050,14 @@ func (x *PutResponse_Body) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.ObjectId != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"objectId\":" - out.RawString(prefix) - x.ObjectId.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"objectId\":" + out.RawString(prefix) + x.ObjectId.MarshalEasyJSON(out) } out.RawByte('}') } @@ -2295,40 +2253,34 @@ func (x *PutResponse) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.Body != nil { - 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 = "\"body\":" + out.RawString(prefix) + x.Body.MarshalEasyJSON(out) } { - if x.MetaHeader != nil { - 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 = "\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) } { - if x.VerifyHeader != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"verifyHeader\":" - out.RawString(prefix) - x.VerifyHeader.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) } out.RawByte('}') } @@ -2474,16 +2426,14 @@ func (x *DeleteRequest_Body) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.Address != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"address\":" - out.RawString(prefix) - x.Address.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"address\":" + out.RawString(prefix) + x.Address.MarshalEasyJSON(out) } out.RawByte('}') } @@ -2679,40 +2629,34 @@ func (x *DeleteRequest) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.Body != nil { - 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 = "\"body\":" + out.RawString(prefix) + x.Body.MarshalEasyJSON(out) } { - if x.MetaHeader != nil { - 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 = "\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) } { - if x.VerifyHeader != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"verifyHeader\":" - out.RawString(prefix) - x.VerifyHeader.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) } out.RawByte('}') } @@ -2858,16 +2802,14 @@ func (x *DeleteResponse_Body) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.Tombstone != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"tombstone\":" - out.RawString(prefix) - x.Tombstone.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"tombstone\":" + out.RawString(prefix) + x.Tombstone.MarshalEasyJSON(out) } out.RawByte('}') } @@ -3063,40 +3005,34 @@ func (x *DeleteResponse) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.Body != nil { - 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 = "\"body\":" + out.RawString(prefix) + x.Body.MarshalEasyJSON(out) } { - if x.MetaHeader != nil { - 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 = "\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) } { - if x.VerifyHeader != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"verifyHeader\":" - out.RawString(prefix) - x.VerifyHeader.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) } out.RawByte('}') } @@ -3282,40 +3218,34 @@ func (x *HeadRequest_Body) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.Address != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"address\":" - out.RawString(prefix) - x.Address.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"address\":" + out.RawString(prefix) + x.Address.MarshalEasyJSON(out) } { - if x.MainOnly { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"mainOnly\":" - out.RawString(prefix) - out.Bool(x.MainOnly) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"mainOnly\":" + out.RawString(prefix) + out.Bool(x.MainOnly) } { - if x.Raw { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"raw\":" - out.RawString(prefix) - out.Bool(x.Raw) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"raw\":" + out.RawString(prefix) + out.Bool(x.Raw) } out.RawByte('}') } @@ -3523,40 +3453,34 @@ func (x *HeadRequest) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.Body != nil { - 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 = "\"body\":" + out.RawString(prefix) + x.Body.MarshalEasyJSON(out) } { - if x.MetaHeader != nil { - 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 = "\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) } { - if x.VerifyHeader != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"verifyHeader\":" - out.RawString(prefix) - x.VerifyHeader.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) } out.RawByte('}') } @@ -3725,28 +3649,24 @@ func (x *HeaderWithSignature) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.Header != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"header\":" - out.RawString(prefix) - x.Header.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"header\":" + out.RawString(prefix) + x.Header.MarshalEasyJSON(out) } { - if x.Signature != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"signature\":" - out.RawString(prefix) - x.Signature.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"signature\":" + out.RawString(prefix) + x.Signature.MarshalEasyJSON(out) } out.RawByte('}') } @@ -3982,55 +3902,47 @@ func (x *HeadResponse_Body) MarshalEasyJSON(out *jwriter.Writer) { switch xx := x.Head.(type) { case *HeadResponse_Body_Header: { - if xx.Header != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"header\":" - out.RawString(prefix) - xx.Header.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"header\":" + out.RawString(prefix) + xx.Header.MarshalEasyJSON(out) } case *HeadResponse_Body_ShortHeader: { - if xx.ShortHeader != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"shortHeader\":" - out.RawString(prefix) - xx.ShortHeader.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"shortHeader\":" + out.RawString(prefix) + xx.ShortHeader.MarshalEasyJSON(out) } case *HeadResponse_Body_SplitInfo: { - if xx.SplitInfo != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"splitInfo\":" - out.RawString(prefix) - xx.SplitInfo.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"splitInfo\":" + out.RawString(prefix) + xx.SplitInfo.MarshalEasyJSON(out) } case *HeadResponse_Body_EcInfo: { - if xx.EcInfo != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"ecInfo\":" - out.RawString(prefix) - xx.EcInfo.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"ecInfo\":" + out.RawString(prefix) + xx.EcInfo.MarshalEasyJSON(out) } } out.RawByte('}') @@ -4284,40 +4196,34 @@ func (x *HeadResponse) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.Body != nil { - 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 = "\"body\":" + out.RawString(prefix) + x.Body.MarshalEasyJSON(out) } { - if x.MetaHeader != nil { - 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 = "\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) } { - if x.VerifyHeader != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"verifyHeader\":" - out.RawString(prefix) - x.VerifyHeader.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) } out.RawByte('}') } @@ -4500,45 +4406,39 @@ func (x *SearchRequest_Body_Filter) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.MatchType != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"matchType\":" - out.RawString(prefix) - v := int32(x.MatchType) - if vv, ok := MatchType_name[v]; ok { - out.String(vv) - } else { - out.Int32(v) - } + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"matchType\":" + out.RawString(prefix) + v := int32(x.MatchType) + if vv, ok := MatchType_name[v]; ok { + out.String(vv) + } else { + out.Int32(v) } } { - if len(x.Key) != 0 { - 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 = "\"key\":" + out.RawString(prefix) + out.String(x.Key) } { - if len(x.Value) != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"value\":" - out.RawString(prefix) - out.String(x.Value) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"value\":" + out.RawString(prefix) + out.String(x.Value) } out.RawByte('}') } @@ -4743,47 +4643,41 @@ func (x *SearchRequest_Body) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.ContainerId != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"containerId\":" - out.RawString(prefix) - x.ContainerId.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"containerId\":" + out.RawString(prefix) + x.ContainerId.MarshalEasyJSON(out) } { - if x.Version != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"version\":" - out.RawString(prefix) - out.Uint32(x.Version) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"version\":" + out.RawString(prefix) + out.Uint32(x.Version) } { - if len(x.Filters) != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"filters\":" - out.RawString(prefix) - out.RawByte('[') - for i := range x.Filters { - if i != 0 { - out.RawByte(',') - } - x.Filters[i].MarshalEasyJSON(out) - } - out.RawByte(']') + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"filters\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.Filters { + if i != 0 { + out.RawByte(',') + } + x.Filters[i].MarshalEasyJSON(out) + } + out.RawByte(']') } out.RawByte('}') } @@ -5007,40 +4901,34 @@ func (x *SearchRequest) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.Body != nil { - 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 = "\"body\":" + out.RawString(prefix) + x.Body.MarshalEasyJSON(out) } { - if x.MetaHeader != nil { - 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 = "\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) } { - if x.VerifyHeader != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"verifyHeader\":" - out.RawString(prefix) - x.VerifyHeader.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) } out.RawByte('}') } @@ -5189,23 +5077,21 @@ func (x *SearchResponse_Body) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if len(x.IdList) != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"idList\":" - out.RawString(prefix) - out.RawByte('[') - for i := range x.IdList { - if i != 0 { - out.RawByte(',') - } - x.IdList[i].MarshalEasyJSON(out) - } - out.RawByte(']') + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"idList\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.IdList { + if i != 0 { + out.RawByte(',') + } + x.IdList[i].MarshalEasyJSON(out) + } + out.RawByte(']') } out.RawByte('}') } @@ -5408,40 +5294,34 @@ func (x *SearchResponse) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.Body != nil { - 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 = "\"body\":" + out.RawString(prefix) + x.Body.MarshalEasyJSON(out) } { - if x.MetaHeader != nil { - 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 = "\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) } { - if x.VerifyHeader != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"verifyHeader\":" - out.RawString(prefix) - x.VerifyHeader.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) } out.RawByte('}') } @@ -5604,32 +5484,28 @@ func (x *Range) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.Offset != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"offset\":" - out.RawString(prefix) - out.RawByte('"') - out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.Offset, 10) - out.RawByte('"') + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"offset\":" + out.RawString(prefix) + out.RawByte('"') + out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.Offset, 10) + out.RawByte('"') } { - if x.Length != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"length\":" - out.RawString(prefix) - out.RawByte('"') - out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.Length, 10) - out.RawByte('"') + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"length\":" + out.RawString(prefix) + out.RawByte('"') + out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.Length, 10) + out.RawByte('"') } out.RawByte('}') } @@ -5825,40 +5701,34 @@ func (x *GetRangeRequest_Body) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.Address != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"address\":" - out.RawString(prefix) - x.Address.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"address\":" + out.RawString(prefix) + x.Address.MarshalEasyJSON(out) } { - if x.Range != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"range\":" - out.RawString(prefix) - x.Range.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"range\":" + out.RawString(prefix) + x.Range.MarshalEasyJSON(out) } { - if x.Raw { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"raw\":" - out.RawString(prefix) - out.Bool(x.Raw) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"raw\":" + out.RawString(prefix) + out.Bool(x.Raw) } out.RawByte('}') } @@ -6067,40 +5937,34 @@ func (x *GetRangeRequest) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.Body != nil { - 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 = "\"body\":" + out.RawString(prefix) + x.Body.MarshalEasyJSON(out) } { - if x.MetaHeader != nil { - 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 = "\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) } { - if x.VerifyHeader != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"verifyHeader\":" - out.RawString(prefix) - x.VerifyHeader.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) } out.RawByte('}') } @@ -6321,42 +6185,40 @@ func (x *GetRangeResponse_Body) MarshalEasyJSON(out *jwriter.Writer) { switch xx := x.RangePart.(type) { case *GetRangeResponse_Body_Chunk: { - if len(xx.Chunk) != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"chunk\":" - out.RawString(prefix) + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"chunk\":" + out.RawString(prefix) + if xx.Chunk != nil { out.Base64Bytes(xx.Chunk) + } else { + out.String("") } } case *GetRangeResponse_Body_SplitInfo: { - if xx.SplitInfo != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"splitInfo\":" - out.RawString(prefix) - xx.SplitInfo.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"splitInfo\":" + out.RawString(prefix) + xx.SplitInfo.MarshalEasyJSON(out) } case *GetRangeResponse_Body_EcInfo: { - if xx.EcInfo != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"ecInfo\":" - out.RawString(prefix) - xx.EcInfo.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"ecInfo\":" + out.RawString(prefix) + xx.EcInfo.MarshalEasyJSON(out) } } out.RawByte('}') @@ -6594,40 +6456,34 @@ func (x *GetRangeResponse) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.Body != nil { - 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 = "\"body\":" + out.RawString(prefix) + x.Body.MarshalEasyJSON(out) } { - if x.MetaHeader != nil { - 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 = "\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) } { - if x.VerifyHeader != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"verifyHeader\":" - out.RawString(prefix) - x.VerifyHeader.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) } out.RawByte('}') } @@ -6839,63 +6695,59 @@ func (x *GetRangeHashRequest_Body) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.Address != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"address\":" - out.RawString(prefix) - x.Address.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"address\":" + out.RawString(prefix) + x.Address.MarshalEasyJSON(out) } { - if len(x.Ranges) != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"ranges\":" - out.RawString(prefix) - out.RawByte('[') - for i := range x.Ranges { - if i != 0 { - out.RawByte(',') - } - x.Ranges[i].MarshalEasyJSON(out) - } - out.RawByte(']') + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"ranges\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.Ranges { + if i != 0 { + out.RawByte(',') + } + x.Ranges[i].MarshalEasyJSON(out) + } + out.RawByte(']') } { - if len(x.Salt) != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"salt\":" - out.RawString(prefix) + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"salt\":" + out.RawString(prefix) + if x.Salt != nil { out.Base64Bytes(x.Salt) + } else { + out.String("") } } { - if x.Type != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"type\":" - out.RawString(prefix) - v := int32(x.Type) - if vv, ok := grpc.ChecksumType_name[v]; ok { - out.String(vv) - } else { - out.Int32(v) - } + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"type\":" + out.RawString(prefix) + v := int32(x.Type) + if vv, ok := grpc.ChecksumType_name[v]; ok { + out.String(vv) + } else { + out.Int32(v) } } out.RawByte('}') @@ -7134,40 +6986,34 @@ func (x *GetRangeHashRequest) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.Body != nil { - 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 = "\"body\":" + out.RawString(prefix) + x.Body.MarshalEasyJSON(out) } { - if x.MetaHeader != nil { - 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 = "\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) } { - if x.VerifyHeader != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"verifyHeader\":" - out.RawString(prefix) - x.VerifyHeader.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) } out.RawByte('}') } @@ -7330,40 +7176,40 @@ func (x *GetRangeHashResponse_Body) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.Type != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"type\":" - out.RawString(prefix) - v := int32(x.Type) - if vv, ok := grpc.ChecksumType_name[v]; ok { - out.String(vv) - } else { - out.Int32(v) - } + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"type\":" + out.RawString(prefix) + v := int32(x.Type) + if vv, ok := grpc.ChecksumType_name[v]; ok { + out.String(vv) + } else { + out.Int32(v) } } { - if len(x.HashList) != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"hashList\":" - out.RawString(prefix) - out.RawByte('[') - for i := range x.HashList { - if i != 0 { - out.RawByte(',') - } - out.Base64Bytes(x.HashList[i]) - } - out.RawByte(']') + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"hashList\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.HashList { + if i != 0 { + out.RawByte(',') + } + if x.HashList[i] != nil { + out.Base64Bytes(x.HashList[i]) + } else { + out.String("") + } + } + out.RawByte(']') } out.RawByte('}') } @@ -7587,40 +7433,34 @@ func (x *GetRangeHashResponse) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.Body != nil { - 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 = "\"body\":" + out.RawString(prefix) + x.Body.MarshalEasyJSON(out) } { - if x.MetaHeader != nil { - 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 = "\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) } { - if x.VerifyHeader != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"verifyHeader\":" - out.RawString(prefix) - x.VerifyHeader.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) } out.RawByte('}') } @@ -7788,35 +7628,31 @@ func (x *PutSingleRequest_Body) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.Object != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"object\":" - out.RawString(prefix) - x.Object.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"object\":" + out.RawString(prefix) + x.Object.MarshalEasyJSON(out) } { - if len(x.CopiesNumber) != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"copiesNumber\":" - out.RawString(prefix) - out.RawByte('[') - for i := range x.CopiesNumber { - if i != 0 { - out.RawByte(',') - } - out.Uint32(x.CopiesNumber[i]) - } - out.RawByte(']') + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"copiesNumber\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.CopiesNumber { + if i != 0 { + out.RawByte(',') + } + out.Uint32(x.CopiesNumber[i]) + } + out.RawByte(']') } out.RawByte('}') } @@ -8033,40 +7869,34 @@ func (x *PutSingleRequest) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.Body != nil { - 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 = "\"body\":" + out.RawString(prefix) + x.Body.MarshalEasyJSON(out) } { - if x.MetaHeader != nil { - 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 = "\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) } { - if x.VerifyHeader != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"verifyHeader\":" - out.RawString(prefix) - x.VerifyHeader.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) } out.RawByte('}') } @@ -8371,40 +8201,34 @@ func (x *PutSingleResponse) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.Body != nil { - 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 = "\"body\":" + out.RawString(prefix) + x.Body.MarshalEasyJSON(out) } { - if x.MetaHeader != nil { - 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 = "\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) } { - if x.VerifyHeader != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"verifyHeader\":" - out.RawString(prefix) - x.VerifyHeader.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) } out.RawByte('}') } @@ -8570,27 +8394,27 @@ func (x *PatchRequest_Body_Patch) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.SourceRange != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"sourceRange\":" - out.RawString(prefix) - x.SourceRange.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"sourceRange\":" + out.RawString(prefix) + x.SourceRange.MarshalEasyJSON(out) } { - if len(x.Chunk) != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"chunk\":" - out.RawString(prefix) + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"chunk\":" + out.RawString(prefix) + if x.Chunk != nil { out.Base64Bytes(x.Chunk) + } else { + out.String("") } } out.RawByte('}') @@ -8798,59 +8622,51 @@ func (x *PatchRequest_Body) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.Address != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"address\":" - out.RawString(prefix) - x.Address.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"address\":" + out.RawString(prefix) + x.Address.MarshalEasyJSON(out) } { - if len(x.NewAttributes) != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"newAttributes\":" - out.RawString(prefix) - out.RawByte('[') - for i := range x.NewAttributes { - if i != 0 { - out.RawByte(',') - } - x.NewAttributes[i].MarshalEasyJSON(out) - } - out.RawByte(']') + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"newAttributes\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.NewAttributes { + if i != 0 { + out.RawByte(',') + } + x.NewAttributes[i].MarshalEasyJSON(out) + } + out.RawByte(']') } { - if x.ReplaceAttributes { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"replaceAttributes\":" - out.RawString(prefix) - out.Bool(x.ReplaceAttributes) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"replaceAttributes\":" + out.RawString(prefix) + out.Bool(x.ReplaceAttributes) } { - if x.Patch != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"patch\":" - out.RawString(prefix) - x.Patch.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"patch\":" + out.RawString(prefix) + x.Patch.MarshalEasyJSON(out) } out.RawByte('}') } @@ -9073,40 +8889,34 @@ func (x *PatchRequest) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.Body != nil { - 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 = "\"body\":" + out.RawString(prefix) + x.Body.MarshalEasyJSON(out) } { - if x.MetaHeader != nil { - 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 = "\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) } { - if x.VerifyHeader != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"verifyHeader\":" - out.RawString(prefix) - x.VerifyHeader.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) } out.RawByte('}') } @@ -9252,16 +9062,14 @@ func (x *PatchResponse_Body) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.ObjectId != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"objectId\":" - out.RawString(prefix) - x.ObjectId.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"objectId\":" + out.RawString(prefix) + x.ObjectId.MarshalEasyJSON(out) } out.RawByte('}') } @@ -9457,40 +9265,34 @@ func (x *PatchResponse) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.Body != nil { - 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 = "\"body\":" + out.RawString(prefix) + x.Body.MarshalEasyJSON(out) } { - if x.MetaHeader != nil { - 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 = "\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) } { - if x.VerifyHeader != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"verifyHeader\":" - out.RawString(prefix) - x.VerifyHeader.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) } out.RawByte('}') } diff --git a/object/grpc/types_frostfs.pb.go b/object/grpc/types_frostfs.pb.go index 0ee939a..e4a916f 100644 --- a/object/grpc/types_frostfs.pb.go +++ b/object/grpc/types_frostfs.pb.go @@ -307,97 +307,83 @@ func (x *ShortHeader) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.Version != nil { - 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 = "\"version\":" + out.RawString(prefix) + x.Version.MarshalEasyJSON(out) + } + { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"creationEpoch\":" + out.RawString(prefix) + out.RawByte('"') + out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.CreationEpoch, 10) + 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 = "\"objectType\":" + out.RawString(prefix) + v := int32(x.ObjectType) + if vv, ok := ObjectType_name[v]; ok { + out.String(vv) + } else { + out.Int32(v) } } { - if x.CreationEpoch != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"creationEpoch\":" - out.RawString(prefix) - out.RawByte('"') - out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.CreationEpoch, 10) - out.RawByte('"') + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"payloadLength\":" + out.RawString(prefix) + out.RawByte('"') + out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.PayloadLength, 10) + out.RawByte('"') } { - if x.OwnerId != nil { - 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 = "\"payloadHash\":" + out.RawString(prefix) + x.PayloadHash.MarshalEasyJSON(out) } { - if x.ObjectType != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"objectType\":" - out.RawString(prefix) - v := int32(x.ObjectType) - if vv, ok := ObjectType_name[v]; ok { - out.String(vv) - } else { - out.Int32(v) - } - } - } - { - if x.PayloadLength != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"payloadLength\":" - out.RawString(prefix) - out.RawByte('"') - out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.PayloadLength, 10) - out.RawByte('"') - } - } - { - if x.PayloadHash != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"payloadHash\":" - out.RawString(prefix) - x.PayloadHash.MarshalEasyJSON(out) - } - } - { - if x.HomomorphicHash != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"homomorphicHash\":" - out.RawString(prefix) - x.HomomorphicHash.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"homomorphicHash\":" + out.RawString(prefix) + x.HomomorphicHash.MarshalEasyJSON(out) } out.RawByte('}') } @@ -617,28 +603,24 @@ func (x *Header_Attribute) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if len(x.Key) != 0 { - 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 = "\"key\":" + out.RawString(prefix) + out.String(x.Key) } { - if len(x.Value) != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"value\":" - out.RawString(prefix) - out.String(x.Value) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"value\":" + out.RawString(prefix) + out.String(x.Value) } out.RawByte('}') } @@ -890,82 +872,74 @@ func (x *Header_Split) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.Parent != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"parent\":" - out.RawString(prefix) - x.Parent.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"parent\":" + out.RawString(prefix) + x.Parent.MarshalEasyJSON(out) } { - if x.Previous != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"previous\":" - out.RawString(prefix) - x.Previous.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"previous\":" + out.RawString(prefix) + x.Previous.MarshalEasyJSON(out) } { - if x.ParentSignature != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"parentSignature\":" - out.RawString(prefix) - x.ParentSignature.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"parentSignature\":" + out.RawString(prefix) + x.ParentSignature.MarshalEasyJSON(out) } { - if x.ParentHeader != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"parentHeader\":" - out.RawString(prefix) - x.ParentHeader.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"parentHeader\":" + out.RawString(prefix) + x.ParentHeader.MarshalEasyJSON(out) } { - if len(x.Children) != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"children\":" - out.RawString(prefix) - out.RawByte('[') - for i := range x.Children { - if i != 0 { - out.RawByte(',') - } - x.Children[i].MarshalEasyJSON(out) - } - out.RawByte(']') + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"children\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.Children { + if i != 0 { + out.RawByte(',') + } + x.Children[i].MarshalEasyJSON(out) + } + out.RawByte(']') } { - if len(x.SplitId) != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"splitID\":" - out.RawString(prefix) + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"splitID\":" + out.RawString(prefix) + if x.SplitId != nil { out.Base64Bytes(x.SplitId) + } else { + out.String("") } } out.RawByte('}') @@ -1288,107 +1262,99 @@ func (x *Header_EC) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.Parent != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"parent\":" - out.RawString(prefix) - x.Parent.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"parent\":" + out.RawString(prefix) + x.Parent.MarshalEasyJSON(out) } { - if x.Index != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"index\":" - out.RawString(prefix) - out.Uint32(x.Index) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"index\":" + out.RawString(prefix) + out.Uint32(x.Index) } { - if x.Total != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"total\":" - out.RawString(prefix) - out.Uint32(x.Total) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"total\":" + out.RawString(prefix) + out.Uint32(x.Total) } { - if x.HeaderLength != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"headerLength\":" - out.RawString(prefix) - out.Uint32(x.HeaderLength) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"headerLength\":" + out.RawString(prefix) + out.Uint32(x.HeaderLength) } { - if len(x.Header) != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"header\":" - out.RawString(prefix) + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"header\":" + out.RawString(prefix) + if x.Header != nil { out.Base64Bytes(x.Header) + } else { + out.String("") } } { - if len(x.ParentSplitId) != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"parentSplitID\":" - out.RawString(prefix) + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"parentSplitID\":" + out.RawString(prefix) + if x.ParentSplitId != nil { out.Base64Bytes(x.ParentSplitId) + } else { + out.String("") } } { - if x.ParentSplitParentId != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"parentSplitParentID\":" - out.RawString(prefix) - x.ParentSplitParentId.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"parentSplitParentID\":" + out.RawString(prefix) + x.ParentSplitParentId.MarshalEasyJSON(out) } { - if len(x.ParentAttributes) != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"parentAttributes\":" - out.RawString(prefix) - out.RawByte('[') - for i := range x.ParentAttributes { - if i != 0 { - out.RawByte(',') - } - x.ParentAttributes[i].MarshalEasyJSON(out) - } - out.RawByte(']') + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"parentAttributes\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.ParentAttributes { + if i != 0 { + out.RawByte(',') + } + x.ParentAttributes[i].MarshalEasyJSON(out) + } + out.RawByte(']') } out.RawByte('}') } @@ -1842,164 +1808,140 @@ func (x *Header) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.Version != nil { - 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 = "\"version\":" + out.RawString(prefix) + x.Version.MarshalEasyJSON(out) + } + { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"containerID\":" + out.RawString(prefix) + x.ContainerId.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 = "\"creationEpoch\":" + out.RawString(prefix) + out.RawByte('"') + out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.CreationEpoch, 10) + out.RawByte('"') + } + { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"payloadLength\":" + out.RawString(prefix) + out.RawByte('"') + out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.PayloadLength, 10) + out.RawByte('"') + } + { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"payloadHash\":" + out.RawString(prefix) + x.PayloadHash.MarshalEasyJSON(out) + } + { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"objectType\":" + out.RawString(prefix) + v := int32(x.ObjectType) + if vv, ok := ObjectType_name[v]; ok { + out.String(vv) + } else { + out.Int32(v) } } { - if x.ContainerId != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"containerID\":" - out.RawString(prefix) - x.ContainerId.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"homomorphicHash\":" + out.RawString(prefix) + x.HomomorphicHash.MarshalEasyJSON(out) } { - if x.OwnerId != nil { - 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 = "\"sessionToken\":" + out.RawString(prefix) + x.SessionToken.MarshalEasyJSON(out) } { - if x.CreationEpoch != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"creationEpoch\":" - out.RawString(prefix) - out.RawByte('"') - out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.CreationEpoch, 10) - out.RawByte('"') + 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 x.PayloadLength != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"payloadLength\":" - out.RawString(prefix) - out.RawByte('"') - out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.PayloadLength, 10) - out.RawByte('"') + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"split\":" + out.RawString(prefix) + x.Split.MarshalEasyJSON(out) } { - if x.PayloadHash != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"payloadHash\":" - out.RawString(prefix) - x.PayloadHash.MarshalEasyJSON(out) - } - } - { - if x.ObjectType != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"objectType\":" - out.RawString(prefix) - v := int32(x.ObjectType) - if vv, ok := ObjectType_name[v]; ok { - out.String(vv) - } else { - out.Int32(v) - } - } - } - { - if x.HomomorphicHash != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"homomorphicHash\":" - out.RawString(prefix) - x.HomomorphicHash.MarshalEasyJSON(out) - } - } - { - if x.SessionToken != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"sessionToken\":" - out.RawString(prefix) - x.SessionToken.MarshalEasyJSON(out) - } - } - { - if len(x.Attributes) != 0 { - 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 x.Split != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"split\":" - out.RawString(prefix) - x.Split.MarshalEasyJSON(out) - } - } - { - if x.Ec != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"ec\":" - out.RawString(prefix) - x.Ec.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"ec\":" + out.RawString(prefix) + x.Ec.MarshalEasyJSON(out) } out.RawByte('}') } @@ -2310,51 +2252,47 @@ func (x *Object) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.ObjectId != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"objectID\":" - out.RawString(prefix) - x.ObjectId.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"objectID\":" + out.RawString(prefix) + x.ObjectId.MarshalEasyJSON(out) } { - if x.Signature != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"signature\":" - out.RawString(prefix) - x.Signature.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"signature\":" + out.RawString(prefix) + x.Signature.MarshalEasyJSON(out) } { - if x.Header != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"header\":" - out.RawString(prefix) - x.Header.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"header\":" + out.RawString(prefix) + x.Header.MarshalEasyJSON(out) } { - if len(x.Payload) != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"payload\":" - out.RawString(prefix) + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"payload\":" + out.RawString(prefix) + if x.Payload != nil { out.Base64Bytes(x.Payload) + } else { + out.String("") } } out.RawByte('}') @@ -2550,40 +2488,38 @@ func (x *SplitInfo) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if len(x.SplitId) != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"splitId\":" - out.RawString(prefix) + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"splitId\":" + out.RawString(prefix) + if x.SplitId != nil { out.Base64Bytes(x.SplitId) + } else { + out.String("") } } { - if x.LastPart != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"lastPart\":" - out.RawString(prefix) - x.LastPart.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"lastPart\":" + out.RawString(prefix) + x.LastPart.MarshalEasyJSON(out) } { - if x.Link != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"link\":" - out.RawString(prefix) - x.Link.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"link\":" + out.RawString(prefix) + x.Link.MarshalEasyJSON(out) } out.RawByte('}') } @@ -2768,40 +2704,34 @@ func (x *ECInfo_Chunk) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.Id != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"id\":" - out.RawString(prefix) - x.Id.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"id\":" + out.RawString(prefix) + x.Id.MarshalEasyJSON(out) } { - if x.Index != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"index\":" - out.RawString(prefix) - out.Uint32(x.Index) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"index\":" + out.RawString(prefix) + out.Uint32(x.Index) } { - if x.Total != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"total\":" - out.RawString(prefix) - out.Uint32(x.Total) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"total\":" + out.RawString(prefix) + out.Uint32(x.Total) } out.RawByte('}') } @@ -2964,23 +2894,21 @@ func (x *ECInfo) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if len(x.Chunks) != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"chunks\":" - out.RawString(prefix) - out.RawByte('[') - for i := range x.Chunks { - if i != 0 { - out.RawByte(',') - } - x.Chunks[i].MarshalEasyJSON(out) - } - out.RawByte(']') + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"chunks\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.Chunks { + if i != 0 { + out.RawByte(',') + } + x.Chunks[i].MarshalEasyJSON(out) + } + out.RawByte(']') } out.RawByte('}') } diff --git a/refs/grpc/types_frostfs.pb.go b/refs/grpc/types_frostfs.pb.go index 3ed647c..5a16f8e 100644 --- a/refs/grpc/types_frostfs.pb.go +++ b/refs/grpc/types_frostfs.pb.go @@ -193,28 +193,24 @@ func (x *Address) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.ContainerId != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"containerID\":" - out.RawString(prefix) - x.ContainerId.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"containerID\":" + out.RawString(prefix) + x.ContainerId.MarshalEasyJSON(out) } { - if x.ObjectId != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"objectID\":" - out.RawString(prefix) - x.ObjectId.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"objectID\":" + out.RawString(prefix) + x.ObjectId.MarshalEasyJSON(out) } out.RawByte('}') } @@ -350,15 +346,17 @@ func (x *ObjectID) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if len(x.Value) != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"value\":" - out.RawString(prefix) + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"value\":" + out.RawString(prefix) + if x.Value != nil { out.Base64Bytes(x.Value) + } else { + out.String("") } } out.RawByte('}') @@ -487,15 +485,17 @@ func (x *ContainerID) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if len(x.Value) != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"value\":" - out.RawString(prefix) + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"value\":" + out.RawString(prefix) + if x.Value != nil { out.Base64Bytes(x.Value) + } else { + out.String("") } } out.RawByte('}') @@ -624,15 +624,17 @@ func (x *OwnerID) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if len(x.Value) != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"value\":" - out.RawString(prefix) + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"value\":" + out.RawString(prefix) + if x.Value != nil { out.Base64Bytes(x.Value) + } else { + out.String("") } } out.RawByte('}') @@ -781,28 +783,24 @@ func (x *Version) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.Major != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"major\":" - out.RawString(prefix) - out.Uint32(x.Major) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"major\":" + out.RawString(prefix) + out.Uint32(x.Major) } { - if x.Minor != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"minor\":" - out.RawString(prefix) - out.Uint32(x.Minor) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"minor\":" + out.RawString(prefix) + out.Uint32(x.Minor) } out.RawByte('}') } @@ -992,44 +990,46 @@ func (x *Signature) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if len(x.Key) != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"key\":" - out.RawString(prefix) + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"key\":" + out.RawString(prefix) + if x.Key != nil { out.Base64Bytes(x.Key) + } else { + out.String("") } } { - if len(x.Sign) != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"signature\":" - out.RawString(prefix) + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"signature\":" + out.RawString(prefix) + if x.Sign != nil { out.Base64Bytes(x.Sign) + } else { + out.String("") } } { - if x.Scheme != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"scheme\":" - out.RawString(prefix) - v := int32(x.Scheme) - if vv, ok := SignatureScheme_name[v]; ok { - out.String(vv) - } else { - out.Int32(v) - } + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"scheme\":" + out.RawString(prefix) + v := int32(x.Scheme) + if vv, ok := SignatureScheme_name[v]; ok { + out.String(vv) + } else { + out.Int32(v) } } out.RawByte('}') @@ -1206,27 +1206,31 @@ func (x *SignatureRFC6979) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if len(x.Key) != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"key\":" - out.RawString(prefix) + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"key\":" + out.RawString(prefix) + if x.Key != nil { out.Base64Bytes(x.Key) + } else { + out.String("") } } { - if len(x.Sign) != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"signature\":" - out.RawString(prefix) + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"signature\":" + out.RawString(prefix) + if x.Sign != nil { out.Base64Bytes(x.Sign) + } else { + out.String("") } } out.RawByte('}') @@ -1381,32 +1385,32 @@ func (x *Checksum) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.Type != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"type\":" - out.RawString(prefix) - v := int32(x.Type) - if vv, ok := ChecksumType_name[v]; ok { - out.String(vv) - } else { - out.Int32(v) - } + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"type\":" + out.RawString(prefix) + v := int32(x.Type) + if vv, ok := ChecksumType_name[v]; ok { + out.String(vv) + } else { + out.Int32(v) } } { - if len(x.Sum) != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"sum\":" - out.RawString(prefix) + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"sum\":" + out.RawString(prefix) + if x.Sum != nil { out.Base64Bytes(x.Sum) + } else { + out.String("") } } out.RawByte('}') diff --git a/session/grpc/service_frostfs.pb.go b/session/grpc/service_frostfs.pb.go index c71325a..6d3ea9f 100644 --- a/session/grpc/service_frostfs.pb.go +++ b/session/grpc/service_frostfs.pb.go @@ -121,30 +121,26 @@ func (x *CreateRequest_Body) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.OwnerId != nil { - 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 = "\"ownerId\":" + out.RawString(prefix) + x.OwnerId.MarshalEasyJSON(out) } { - if x.Expiration != 0 { - 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('"') + 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('}') } @@ -354,40 +350,34 @@ func (x *CreateRequest) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.Body != nil { - 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 = "\"body\":" + out.RawString(prefix) + x.Body.MarshalEasyJSON(out) } { - if x.MetaHeader != nil { - 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 = "\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) } { - if x.VerifyHeader != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"verifyHeader\":" - out.RawString(prefix) - x.VerifyHeader.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) } out.RawByte('}') } @@ -550,27 +540,31 @@ func (x *CreateResponse_Body) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if len(x.Id) != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"id\":" - out.RawString(prefix) + 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 len(x.SessionKey) != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"sessionKey\":" - out.RawString(prefix) + 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('}') @@ -772,40 +766,34 @@ func (x *CreateResponse) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.Body != nil { - 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 = "\"body\":" + out.RawString(prefix) + x.Body.MarshalEasyJSON(out) } { - if x.MetaHeader != nil { - 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 = "\"metaHeader\":" + out.RawString(prefix) + x.MetaHeader.MarshalEasyJSON(out) } { - if x.VerifyHeader != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"verifyHeader\":" - out.RawString(prefix) - x.VerifyHeader.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"verifyHeader\":" + out.RawString(prefix) + x.VerifyHeader.MarshalEasyJSON(out) } out.RawByte('}') } diff --git a/session/grpc/types_frostfs.pb.go b/session/grpc/types_frostfs.pb.go index e18c1ab..e9f3b42 100644 --- a/session/grpc/types_frostfs.pb.go +++ b/session/grpc/types_frostfs.pb.go @@ -182,35 +182,31 @@ func (x *ObjectSessionContext_Target) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.Container != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"container\":" - out.RawString(prefix) - x.Container.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"container\":" + out.RawString(prefix) + x.Container.MarshalEasyJSON(out) } { - if len(x.Objects) != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"objects\":" - out.RawString(prefix) - out.RawByte('[') - for i := range x.Objects { - if i != 0 { - out.RawByte(',') - } - x.Objects[i].MarshalEasyJSON(out) - } - out.RawByte(']') + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"objects\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.Objects { + if i != 0 { + out.RawByte(',') + } + x.Objects[i].MarshalEasyJSON(out) + } + out.RawByte(']') } out.RawByte('}') } @@ -376,33 +372,29 @@ func (x *ObjectSessionContext) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.Verb != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"verb\":" - out.RawString(prefix) - v := int32(x.Verb) - if vv, ok := ObjectSessionContext_Verb_name[v]; ok { - out.String(vv) - } else { - out.Int32(v) - } + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"verb\":" + out.RawString(prefix) + v := int32(x.Verb) + if vv, ok := ObjectSessionContext_Verb_name[v]; ok { + out.String(vv) + } else { + out.Int32(v) } } { - if x.Target != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"target\":" - out.RawString(prefix) - x.Target.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"target\":" + out.RawString(prefix) + x.Target.MarshalEasyJSON(out) } out.RawByte('}') } @@ -634,45 +626,39 @@ func (x *ContainerSessionContext) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.Verb != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"verb\":" - out.RawString(prefix) - v := int32(x.Verb) - if vv, ok := ContainerSessionContext_Verb_name[v]; ok { - out.String(vv) - } else { - out.Int32(v) - } + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"verb\":" + out.RawString(prefix) + v := int32(x.Verb) + if vv, ok := ContainerSessionContext_Verb_name[v]; ok { + out.String(vv) + } else { + out.Int32(v) } } { - if x.Wildcard { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"wildcard\":" - out.RawString(prefix) - out.Bool(x.Wildcard) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"wildcard\":" + out.RawString(prefix) + out.Bool(x.Wildcard) } { - if x.ContainerId != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"containerID\":" - out.RawString(prefix) - x.ContainerId.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"containerID\":" + out.RawString(prefix) + x.ContainerId.MarshalEasyJSON(out) } out.RawByte('}') } @@ -869,46 +855,40 @@ func (x *SessionToken_Body_TokenLifetime) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.Exp != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"exp\":" - out.RawString(prefix) - out.RawByte('"') - out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.Exp, 10) - out.RawByte('"') + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"exp\":" + out.RawString(prefix) + out.RawByte('"') + out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.Exp, 10) + out.RawByte('"') } { - if x.Nbf != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"nbf\":" - out.RawString(prefix) - out.RawByte('"') - out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.Nbf, 10) - out.RawByte('"') + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"nbf\":" + out.RawString(prefix) + out.RawByte('"') + out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.Nbf, 10) + out.RawByte('"') } { - if x.Iat != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"iat\":" - out.RawString(prefix) - out.RawByte('"') - out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.Iat, 10) - out.RawByte('"') + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"iat\":" + out.RawString(prefix) + out.RawByte('"') + out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.Iat, 10) + out.RawByte('"') } out.RawByte('}') } @@ -1202,79 +1182,75 @@ func (x *SessionToken_Body) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if len(x.Id) != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"id\":" - out.RawString(prefix) + 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 x.OwnerId != nil { - 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 = "\"ownerID\":" + out.RawString(prefix) + x.OwnerId.MarshalEasyJSON(out) } { - if x.Lifetime != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"lifetime\":" - out.RawString(prefix) - x.Lifetime.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"lifetime\":" + out.RawString(prefix) + x.Lifetime.MarshalEasyJSON(out) } { - if len(x.SessionKey) != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"sessionKey\":" - out.RawString(prefix) + 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("") } } switch xx := x.Context.(type) { case *SessionToken_Body_Object: { - if xx.Object != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"object\":" - out.RawString(prefix) - xx.Object.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"object\":" + out.RawString(prefix) + xx.Object.MarshalEasyJSON(out) } case *SessionToken_Body_Container: { - if xx.Container != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"container\":" - out.RawString(prefix) - xx.Container.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"container\":" + out.RawString(prefix) + xx.Container.MarshalEasyJSON(out) } } out.RawByte('}') @@ -1483,28 +1459,24 @@ func (x *SessionToken) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.Body != nil { - 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 = "\"body\":" + out.RawString(prefix) + x.Body.MarshalEasyJSON(out) } { - if x.Signature != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"signature\":" - out.RawString(prefix) - x.Signature.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"signature\":" + out.RawString(prefix) + x.Signature.MarshalEasyJSON(out) } out.RawByte('}') } @@ -1660,28 +1632,24 @@ func (x *XHeader) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if len(x.Key) != 0 { - 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 = "\"key\":" + out.RawString(prefix) + out.String(x.Key) } { - if len(x.Value) != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"value\":" - out.RawString(prefix) - out.String(x.Value) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"value\":" + out.RawString(prefix) + out.String(x.Value) } out.RawByte('}') } @@ -1973,111 +1941,95 @@ func (x *RequestMetaHeader) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.Version != nil { - 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 = "\"version\":" + out.RawString(prefix) + x.Version.MarshalEasyJSON(out) } { - if x.Epoch != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"epoch\":" - out.RawString(prefix) - out.RawByte('"') - out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.Epoch, 10) - out.RawByte('"') + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"epoch\":" + out.RawString(prefix) + out.RawByte('"') + out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.Epoch, 10) + out.RawByte('"') } { - if x.Ttl != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"ttl\":" - out.RawString(prefix) - out.Uint32(x.Ttl) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"ttl\":" + out.RawString(prefix) + out.Uint32(x.Ttl) } { - if len(x.XHeaders) != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"xHeaders\":" - out.RawString(prefix) - out.RawByte('[') - for i := range x.XHeaders { - if i != 0 { - out.RawByte(',') - } - x.XHeaders[i].MarshalEasyJSON(out) - } - out.RawByte(']') + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"xHeaders\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.XHeaders { + if i != 0 { + out.RawByte(',') + } + x.XHeaders[i].MarshalEasyJSON(out) + } + out.RawByte(']') } { - if x.SessionToken != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"sessionToken\":" - out.RawString(prefix) - x.SessionToken.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"sessionToken\":" + out.RawString(prefix) + x.SessionToken.MarshalEasyJSON(out) } { - if x.BearerToken != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"bearerToken\":" - out.RawString(prefix) - x.BearerToken.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"bearerToken\":" + out.RawString(prefix) + x.BearerToken.MarshalEasyJSON(out) } { - if x.Origin != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"origin\":" - out.RawString(prefix) - x.Origin.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"origin\":" + out.RawString(prefix) + x.Origin.MarshalEasyJSON(out) } { - if x.MagicNumber != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"magicNumber\":" - out.RawString(prefix) - out.RawByte('"') - out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.MagicNumber, 10) - out.RawByte('"') + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"magicNumber\":" + out.RawString(prefix) + out.RawByte('"') + out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.MagicNumber, 10) + out.RawByte('"') } out.RawByte('}') } @@ -2398,85 +2350,73 @@ func (x *ResponseMetaHeader) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.Version != nil { - 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 = "\"version\":" + out.RawString(prefix) + x.Version.MarshalEasyJSON(out) } { - if x.Epoch != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"epoch\":" - out.RawString(prefix) - out.RawByte('"') - out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.Epoch, 10) - out.RawByte('"') + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"epoch\":" + out.RawString(prefix) + out.RawByte('"') + out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.Epoch, 10) + out.RawByte('"') } { - if x.Ttl != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"ttl\":" - out.RawString(prefix) - out.Uint32(x.Ttl) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"ttl\":" + out.RawString(prefix) + out.Uint32(x.Ttl) } { - if len(x.XHeaders) != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"xHeaders\":" - out.RawString(prefix) - out.RawByte('[') - for i := range x.XHeaders { - if i != 0 { - out.RawByte(',') - } - x.XHeaders[i].MarshalEasyJSON(out) - } - out.RawByte(']') + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"xHeaders\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.XHeaders { + if i != 0 { + out.RawByte(',') + } + x.XHeaders[i].MarshalEasyJSON(out) + } + out.RawByte(']') } { - if x.Origin != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"origin\":" - out.RawString(prefix) - x.Origin.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"origin\":" + out.RawString(prefix) + x.Origin.MarshalEasyJSON(out) } { - if x.Status != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"status\":" - out.RawString(prefix) - x.Status.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"status\":" + out.RawString(prefix) + x.Status.MarshalEasyJSON(out) } out.RawByte('}') } @@ -2733,52 +2673,44 @@ func (x *RequestVerificationHeader) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.BodySignature != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"bodySignature\":" - out.RawString(prefix) - x.BodySignature.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"bodySignature\":" + out.RawString(prefix) + x.BodySignature.MarshalEasyJSON(out) } { - if x.MetaSignature != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"metaSignature\":" - out.RawString(prefix) - x.MetaSignature.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"metaSignature\":" + out.RawString(prefix) + x.MetaSignature.MarshalEasyJSON(out) } { - if x.OriginSignature != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"originSignature\":" - out.RawString(prefix) - x.OriginSignature.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"originSignature\":" + out.RawString(prefix) + x.OriginSignature.MarshalEasyJSON(out) } { - if x.Origin != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"origin\":" - out.RawString(prefix) - x.Origin.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"origin\":" + out.RawString(prefix) + x.Origin.MarshalEasyJSON(out) } out.RawByte('}') } @@ -3000,52 +2932,44 @@ func (x *ResponseVerificationHeader) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.BodySignature != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"bodySignature\":" - out.RawString(prefix) - x.BodySignature.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"bodySignature\":" + out.RawString(prefix) + x.BodySignature.MarshalEasyJSON(out) } { - if x.MetaSignature != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"metaSignature\":" - out.RawString(prefix) - x.MetaSignature.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"metaSignature\":" + out.RawString(prefix) + x.MetaSignature.MarshalEasyJSON(out) } { - if x.OriginSignature != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"originSignature\":" - out.RawString(prefix) - x.OriginSignature.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"originSignature\":" + out.RawString(prefix) + x.OriginSignature.MarshalEasyJSON(out) } { - if x.Origin != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"origin\":" - out.RawString(prefix) - x.Origin.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"origin\":" + out.RawString(prefix) + x.Origin.MarshalEasyJSON(out) } out.RawByte('}') } diff --git a/status/grpc/types_frostfs.pb.go b/status/grpc/types_frostfs.pb.go index 609fc03..1d8b477 100644 --- a/status/grpc/types_frostfs.pb.go +++ b/status/grpc/types_frostfs.pb.go @@ -371,27 +371,27 @@ func (x *Status_Detail) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.Id != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"id\":" - out.RawString(prefix) - out.Uint32(x.Id) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"id\":" + out.RawString(prefix) + out.Uint32(x.Id) } { - if len(x.Value) != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"value\":" - out.RawString(prefix) + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"value\":" + out.RawString(prefix) + if x.Value != nil { out.Base64Bytes(x.Value) + } else { + out.String("") } } out.RawByte('}') @@ -580,47 +580,41 @@ func (x *Status) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.Code != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"code\":" - out.RawString(prefix) - out.Uint32(x.Code) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"code\":" + out.RawString(prefix) + out.Uint32(x.Code) } { - if len(x.Message) != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"message\":" - out.RawString(prefix) - out.String(x.Message) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"message\":" + out.RawString(prefix) + out.String(x.Message) } { - if len(x.Details) != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"details\":" - out.RawString(prefix) - out.RawByte('[') - for i := range x.Details { - if i != 0 { - out.RawByte(',') - } - x.Details[i].MarshalEasyJSON(out) - } - out.RawByte(']') + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"details\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.Details { + if i != 0 { + out.RawByte(',') + } + x.Details[i].MarshalEasyJSON(out) + } + out.RawByte(']') } out.RawByte('}') } diff --git a/tombstone/grpc/types_frostfs.pb.go b/tombstone/grpc/types_frostfs.pb.go index e5b67d5..acb1836 100644 --- a/tombstone/grpc/types_frostfs.pb.go +++ b/tombstone/grpc/types_frostfs.pb.go @@ -144,49 +144,47 @@ func (x *Tombstone) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.ExpirationEpoch != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"expirationEpoch\":" - out.RawString(prefix) - out.RawByte('"') - out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.ExpirationEpoch, 10) - out.RawByte('"') + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"expirationEpoch\":" + out.RawString(prefix) + out.RawByte('"') + out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.ExpirationEpoch, 10) + out.RawByte('"') } { - if len(x.SplitId) != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"splitID\":" - out.RawString(prefix) + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"splitID\":" + out.RawString(prefix) + if x.SplitId != nil { out.Base64Bytes(x.SplitId) + } else { + out.String("") } } { - if len(x.Members) != 0 { - 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(']') + 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('}') } diff --git a/util/proto/marshal_test.go b/util/proto/marshal_test.go index 8b717be..5498cf9 100644 --- a/util/proto/marshal_test.go +++ b/util/proto/marshal_test.go @@ -26,11 +26,37 @@ func nonZero[T protoInt]() T { func TestStableMarshalSingle(t *testing.T) { t.Run("empty", func(t *testing.T) { - input := &generated.Primitives{} - require.Zero(t, input.StableSize()) + t.Run("proto", func(t *testing.T) { + input := &generated.Primitives{} + require.Zero(t, input.StableSize()) - r := input.MarshalProtobuf(nil) - require.Empty(t, r) + r := input.MarshalProtobuf(nil) + require.Empty(t, r) + }) + t.Run("json", func(t *testing.T) { + input := &generated.Primitives{} + r, err := input.MarshalJSON() + require.NoError(t, err) + require.NotEmpty(t, r) + + var actual test.Primitives + require.NoError(t, protojson.Unmarshal(r, &actual)) + + t.Run("protojson compatibility", func(t *testing.T) { + data, err := protojson.MarshalOptions{EmitUnpopulated: true}.Marshal(&actual) + require.NoError(t, err) + require.JSONEq(t, string(data), string(r)) + }) + + var actualFrostfs generated.Primitives + require.NoError(t, actualFrostfs.UnmarshalJSON(r)) + if len(actualFrostfs.FieldA) == 0 { + actualFrostfs.FieldA = nil + } + require.Equal(t, input, &actualFrostfs) + + primitivesEqual(t, input, &actual) + }) }) marshalCases := []struct { @@ -77,13 +103,16 @@ func TestStableMarshalSingle(t *testing.T) { require.NoError(t, protojson.Unmarshal(r, &actual)) t.Run("protojson compatibility", func(t *testing.T) { - data, err := protojson.Marshal(&actual) + data, err := protojson.MarshalOptions{EmitUnpopulated: true}.Marshal(&actual) require.NoError(t, err) require.JSONEq(t, string(data), string(r)) }) var actualFrostfs generated.Primitives require.NoError(t, actualFrostfs.UnmarshalJSON(r)) + if len(actualFrostfs.FieldA) == 0 { + actualFrostfs.FieldA = nil + } require.Equal(t, tc.input, &actualFrostfs) primitivesEqual(t, tc.input, &actual) @@ -94,7 +123,10 @@ func TestStableMarshalSingle(t *testing.T) { func primitivesEqual(t *testing.T, a *generated.Primitives, b *test.Primitives) { // Compare each field directly, because proto-generated code has private fields. - require.Equal(t, a.FieldA, b.FieldA) + require.Equal(t, len(a.FieldA), len(b.FieldA)) + if len(a.FieldA) != 0 { + require.Equal(t, a.FieldA, b.FieldA) + } require.Equal(t, a.FieldB, b.FieldB) require.Equal(t, a.FieldC, b.FieldC) require.Equal(t, a.FieldD, b.FieldD) diff --git a/util/proto/test/custom/test_frostfs.pb.go b/util/proto/test/custom/test_frostfs.pb.go index 3804e46..f979038 100644 --- a/util/proto/test/custom/test_frostfs.pb.go +++ b/util/proto/test/custom/test_frostfs.pb.go @@ -133,16 +133,14 @@ func (x *Primitives_Aux) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.InnerField != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"innerField\":" - out.RawString(prefix) - out.Uint32(x.InnerField) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"innerField\":" + out.RawString(prefix) + out.Uint32(x.InnerField) } out.RawByte('}') } @@ -579,187 +577,167 @@ func (x *Primitives) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if len(x.FieldA) != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"fieldA\":" - out.RawString(prefix) + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"fieldA\":" + out.RawString(prefix) + if x.FieldA != nil { out.Base64Bytes(x.FieldA) + } else { + out.String("") } } { - if len(x.FieldB) != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"fieldB\":" - out.RawString(prefix) - out.String(x.FieldB) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"fieldB\":" + out.RawString(prefix) + out.String(x.FieldB) } { - if x.FieldC { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"fieldC\":" - out.RawString(prefix) - out.Bool(x.FieldC) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"fieldC\":" + out.RawString(prefix) + out.Bool(x.FieldC) } { - if x.FieldD != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"fieldD\":" - out.RawString(prefix) - out.Int32(x.FieldD) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"fieldD\":" + out.RawString(prefix) + out.Int32(x.FieldD) } { - if x.FieldE != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"fieldE\":" - out.RawString(prefix) - out.Uint32(x.FieldE) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"fieldE\":" + out.RawString(prefix) + out.Uint32(x.FieldE) } { - if x.FieldF != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"fieldF\":" - out.RawString(prefix) - out.RawByte('"') - out.Buffer.Buf = strconv.AppendInt(out.Buffer.Buf, x.FieldF, 10) - out.RawByte('"') + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"fieldF\":" + out.RawString(prefix) + out.RawByte('"') + out.Buffer.Buf = strconv.AppendInt(out.Buffer.Buf, x.FieldF, 10) + out.RawByte('"') } { - if x.FieldG != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"fieldG\":" - out.RawString(prefix) - out.RawByte('"') - out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.FieldG, 10) - out.RawByte('"') + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"fieldG\":" + out.RawString(prefix) + out.RawByte('"') + out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.FieldG, 10) + out.RawByte('"') } { - if x.FieldI != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"fieldI\":" - out.RawString(prefix) - out.RawByte('"') - out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.FieldI, 10) - out.RawByte('"') + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"fieldI\":" + out.RawString(prefix) + out.RawByte('"') + out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.FieldI, 10) + out.RawByte('"') } { - if x.FieldJ != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"fieldJ\":" - out.RawString(prefix) - out.Float64(x.FieldJ) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"fieldJ\":" + out.RawString(prefix) + out.Float64(x.FieldJ) } { - if x.FieldK != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"fieldK\":" - out.RawString(prefix) - out.Uint32(x.FieldK) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"fieldK\":" + out.RawString(prefix) + out.Uint32(x.FieldK) } { - if x.FieldH != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"fieldH\":" - out.RawString(prefix) - v := int32(x.FieldH) - if vv, ok := Primitives_SomeEnum_name[v]; ok { - out.String(vv) - } else { - out.Int32(v) - } + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"fieldH\":" + out.RawString(prefix) + v := int32(x.FieldH) + if vv, ok := Primitives_SomeEnum_name[v]; ok { + out.String(vv) + } else { + out.Int32(v) } } switch xx := x.FieldM.(type) { case *Primitives_FieldMa: { - if len(xx.FieldMa) != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"fieldMa\":" - out.RawString(prefix) + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"fieldMa\":" + out.RawString(prefix) + if xx.FieldMa != nil { out.Base64Bytes(xx.FieldMa) + } else { + out.String("") } } case *Primitives_FieldMe: { - if xx.FieldMe != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"fieldMe\":" - out.RawString(prefix) - out.Uint32(xx.FieldMe) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"fieldMe\":" + out.RawString(prefix) + out.Uint32(xx.FieldMe) } case *Primitives_FieldAux: { - if xx.FieldAux != nil { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"fieldAux\":" - out.RawString(prefix) - xx.FieldAux.MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"fieldAux\":" + out.RawString(prefix) + xx.FieldAux.MarshalEasyJSON(out) } } out.RawByte('}') @@ -1067,16 +1045,14 @@ func (x *RepPrimitives_Aux) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if x.InnerField != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"innerField\":" - out.RawString(prefix) - out.Uint32(x.InnerField) + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"innerField\":" + out.RawString(prefix) + out.Uint32(x.InnerField) } out.RawByte('}') } @@ -1365,162 +1341,150 @@ func (x *RepPrimitives) MarshalEasyJSON(out *jwriter.Writer) { first := true out.RawByte('{') { - if len(x.FieldA) != 0 { - if !first { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"fieldA\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.FieldA { + if i != 0 { out.RawByte(',') - } else { - first = false } - const prefix string = "\"fieldA\":" - out.RawString(prefix) - out.RawByte('[') - for i := range x.FieldA { - if i != 0 { - out.RawByte(',') - } + if x.FieldA[i] != nil { out.Base64Bytes(x.FieldA[i]) + } else { + out.String("") } - out.RawByte(']') } + out.RawByte(']') } { - if len(x.FieldB) != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"fieldB\":" - out.RawString(prefix) - out.RawByte('[') - for i := range x.FieldB { - if i != 0 { - out.RawByte(',') - } - out.String(x.FieldB[i]) - } - out.RawByte(']') + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"fieldB\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.FieldB { + if i != 0 { + out.RawByte(',') + } + out.String(x.FieldB[i]) + } + out.RawByte(']') } { - if len(x.FieldC) != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"fieldC\":" - out.RawString(prefix) - out.RawByte('[') - for i := range x.FieldC { - if i != 0 { - out.RawByte(',') - } - out.Int32(x.FieldC[i]) - } - out.RawByte(']') + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"fieldC\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.FieldC { + if i != 0 { + out.RawByte(',') + } + out.Int32(x.FieldC[i]) + } + out.RawByte(']') } { - if len(x.FieldD) != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"fieldD\":" - out.RawString(prefix) - out.RawByte('[') - for i := range x.FieldD { - if i != 0 { - out.RawByte(',') - } - out.Uint32(x.FieldD[i]) - } - out.RawByte(']') + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"fieldD\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.FieldD { + if i != 0 { + out.RawByte(',') + } + out.Uint32(x.FieldD[i]) + } + out.RawByte(']') } { - if len(x.FieldE) != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"fieldE\":" - out.RawString(prefix) - out.RawByte('[') - for i := range x.FieldE { - if i != 0 { - out.RawByte(',') - } - out.RawByte('"') - out.Buffer.Buf = strconv.AppendInt(out.Buffer.Buf, x.FieldE[i], 10) - out.RawByte('"') - } - out.RawByte(']') + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"fieldE\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.FieldE { + if i != 0 { + out.RawByte(',') + } + out.RawByte('"') + out.Buffer.Buf = strconv.AppendInt(out.Buffer.Buf, x.FieldE[i], 10) + out.RawByte('"') + } + out.RawByte(']') } { - if len(x.FieldF) != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"fieldF\":" - out.RawString(prefix) - out.RawByte('[') - for i := range x.FieldF { - if i != 0 { - out.RawByte(',') - } - out.RawByte('"') - out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.FieldF[i], 10) - out.RawByte('"') - } - out.RawByte(']') + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"fieldF\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.FieldF { + if i != 0 { + out.RawByte(',') + } + out.RawByte('"') + out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.FieldF[i], 10) + out.RawByte('"') + } + out.RawByte(']') } { - if len(x.FieldFu) != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"fieldFu\":" - out.RawString(prefix) - out.RawByte('[') - for i := range x.FieldFu { - if i != 0 { - out.RawByte(',') - } - out.RawByte('"') - out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.FieldFu[i], 10) - out.RawByte('"') - } - out.RawByte(']') + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"fieldFu\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.FieldFu { + if i != 0 { + out.RawByte(',') + } + out.RawByte('"') + out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.FieldFu[i], 10) + out.RawByte('"') + } + out.RawByte(']') } { - if len(x.FieldAux) != 0 { - if !first { - out.RawByte(',') - } else { - first = false - } - const prefix string = "\"fieldAux\":" - out.RawString(prefix) - out.RawByte('[') - for i := range x.FieldAux { - if i != 0 { - out.RawByte(',') - } - x.FieldAux[i].MarshalEasyJSON(out) - } - out.RawByte(']') + if !first { + out.RawByte(',') + } else { + first = false } + const prefix string = "\"fieldAux\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.FieldAux { + if i != 0 { + out.RawByte(',') + } + x.FieldAux[i].MarshalEasyJSON(out) + } + out.RawByte(']') } out.RawByte('}') } diff --git a/util/protogen/internalgengo/json.go b/util/protogen/internalgengo/json.go index 3267955..15facfd 100644 --- a/util/protogen/internalgengo/json.go +++ b/util/protogen/internalgengo/json.go @@ -192,14 +192,17 @@ func emitJSONFieldWrite(g *protogen.GeneratedFile, f *protogen.Field, name strin selector := name + "." + f.GoName - isNotDefault := notNil - if f.Desc.IsList() { - isNotDefault = notEmpty - } else if f.Desc.Kind() != protoreflect.MessageKind { - _, isNotDefault = easyprotoKindInfo(f.Desc.Kind()) - } - g.P("if ", isNotDefault(selector), "{") - defer g.P("}") + // This code is responsible for ignoring default values. + // We will restore it after having parametrized JSON marshaling. + // + // isNotDefault := notNil + // if f.Desc.IsList() { + // isNotDefault = notEmpty + // } else if f.Desc.Kind() != protoreflect.MessageKind { + // _, isNotDefault = easyprotoKindInfo(f.Desc.Kind()) + // } + // g.P("if ", isNotDefault(selector), "{") + // defer g.P("}") g.P("if !first { out.RawByte(','); } else { first = false; }") g.P("const prefix string = ", `"\"`, fieldJSONName(f), `\":"`) @@ -247,7 +250,10 @@ func emitJSONFieldWrite(g *protogen.GeneratedFile, f *protogen.Field, name strin case protoreflect.StringKind: template = "out.String(%s)" case protoreflect.BytesKind: - template = "out.Base64Bytes(%s)" + g.P("if ", selector, "!= nil {") + g.P("out.Base64Bytes(", selector, ")") + g.P("} else { out.String(\"\") }") + return case protoreflect.MessageKind: template = "%s.MarshalEasyJSON(out)" case protoreflect.GroupKind: From 29f215756383cf58cd1de326dd1c2961b06ea201 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Fri, 11 Oct 2024 10:17:42 +0300 Subject: [PATCH 1193/1196] [#123] protogen: Treat bytes field as non-nullable In protobuf 3.12 they have added an support for `optional` keyword, which has made it into the main branch in 3.15. https://github.com/protocolbuffers/protobuf/blob/main/docs/implementing_proto3_presence.md https://github.com/protocolbuffers/protobuf/blob/v3.12.0/docs/field_presence.md#presence-in-proto3-apis This means that without an explicit `optional` keyword field presence for scalars is not tracked, thus empty string in JSON should be unmarshaled to a nil byte slice. Relevant decoding code and tests from protojson: https://github.com/protocolbuffers/protobuf-go/blob/fb995f184a1719ec42b247a3771d1036d92adf67/internal/impl/message_reflect_field.go#L327 https://github.com/protocolbuffers/protobuf-go/blob/fb995f184a1719ec42b247a3771d1036d92adf67/encoding/protojson/decode_test.go#L134 https://github.com/protocolbuffers/protobuf-go/blob/fb995f184a1719ec42b247a3771d1036d92adf67/encoding/protojson/decode_test.go#L156 We do not support `optional` keyword and the generator will fail if it sees on. So only implement the default behaviour. Refs #122 Signed-off-by: Evgenii Stratonikov --- acl/grpc/types_frostfs.pb.go | 8 ++- ape/grpc/types_frostfs.pb.go | 8 ++- apemanager/grpc/service_frostfs.pb.go | 16 +++++- container/grpc/types_frostfs.pb.go | 8 ++- netmap/grpc/types_frostfs.pb.go | 24 +++++++-- object/grpc/service_frostfs.pb.go | 48 ++++++++++++++--- object/grpc/types_frostfs.pb.go | 40 ++++++++++++-- refs/grpc/types_frostfs.pb.go | 64 ++++++++++++++++++++--- session/grpc/service_frostfs.pb.go | 16 +++++- session/grpc/types_frostfs.pb.go | 16 +++++- status/grpc/types_frostfs.pb.go | 8 ++- tombstone/grpc/types_frostfs.pb.go | 8 ++- util/proto/marshal_test.go | 10 +--- util/proto/test/custom/test_frostfs.pb.go | 24 +++++++-- util/protogen/internalgengo/json.go | 12 ++++- 15 files changed, 264 insertions(+), 46 deletions(-) diff --git a/acl/grpc/types_frostfs.pb.go b/acl/grpc/types_frostfs.pb.go index e5a6f32..bc90cb7 100644 --- a/acl/grpc/types_frostfs.pb.go +++ b/acl/grpc/types_frostfs.pb.go @@ -691,7 +691,13 @@ func (x *EACLRecord_Target) UnmarshalEasyJSON(in *jlexer.Lexer) { var list [][]byte in.Delim('[') for !in.IsDelim(']') { - f = in.Bytes() + { + tmp := in.Bytes() + if len(tmp) == 0 { + tmp = nil + } + f = tmp + } list = append(list, f) in.WantComma() } diff --git a/ape/grpc/types_frostfs.pb.go b/ape/grpc/types_frostfs.pb.go index cf9499f..1f2a1a5 100644 --- a/ape/grpc/types_frostfs.pb.go +++ b/ape/grpc/types_frostfs.pb.go @@ -401,7 +401,13 @@ func (x *Chain) UnmarshalEasyJSON(in *jlexer.Lexer) { x.Kind = xx { var f []byte - f = in.Bytes() + { + tmp := in.Bytes() + if len(tmp) == 0 { + tmp = nil + } + f = tmp + } xx.Raw = f } } diff --git a/apemanager/grpc/service_frostfs.pb.go b/apemanager/grpc/service_frostfs.pb.go index 7f3ed10..b2633e1 100644 --- a/apemanager/grpc/service_frostfs.pb.go +++ b/apemanager/grpc/service_frostfs.pb.go @@ -558,7 +558,13 @@ func (x *AddChainResponse_Body) UnmarshalEasyJSON(in *jlexer.Lexer) { case "chainId": { var f []byte - f = in.Bytes() + { + tmp := in.Bytes() + if len(tmp) == 0 { + tmp = nil + } + f = tmp + } x.ChainId = f } } @@ -974,7 +980,13 @@ func (x *RemoveChainRequest_Body) UnmarshalEasyJSON(in *jlexer.Lexer) { case "chainId": { var f []byte - f = in.Bytes() + { + tmp := in.Bytes() + if len(tmp) == 0 { + tmp = nil + } + f = tmp + } x.ChainId = f } } diff --git a/container/grpc/types_frostfs.pb.go b/container/grpc/types_frostfs.pb.go index 4ca23fa..a4f0882 100644 --- a/container/grpc/types_frostfs.pb.go +++ b/container/grpc/types_frostfs.pb.go @@ -500,7 +500,13 @@ func (x *Container) UnmarshalEasyJSON(in *jlexer.Lexer) { case "nonce": { var f []byte - f = in.Bytes() + { + tmp := in.Bytes() + if len(tmp) == 0 { + tmp = nil + } + f = tmp + } x.Nonce = f } case "basicACL": diff --git a/netmap/grpc/types_frostfs.pb.go b/netmap/grpc/types_frostfs.pb.go index 0328531..24003c6 100644 --- a/netmap/grpc/types_frostfs.pb.go +++ b/netmap/grpc/types_frostfs.pb.go @@ -1855,7 +1855,13 @@ func (x *NodeInfo) UnmarshalEasyJSON(in *jlexer.Lexer) { case "publicKey": { var f []byte - f = in.Bytes() + { + tmp := in.Bytes() + if len(tmp) == 0 { + tmp = nil + } + f = tmp + } x.PublicKey = f } case "addresses": @@ -2279,13 +2285,25 @@ func (x *NetworkConfig_Parameter) UnmarshalEasyJSON(in *jlexer.Lexer) { case "key": { var f []byte - f = in.Bytes() + { + tmp := in.Bytes() + if len(tmp) == 0 { + tmp = nil + } + f = tmp + } x.Key = f } case "value": { var f []byte - f = in.Bytes() + { + tmp := in.Bytes() + if len(tmp) == 0 { + tmp = nil + } + f = tmp + } x.Value = f } } diff --git a/object/grpc/service_frostfs.pb.go b/object/grpc/service_frostfs.pb.go index 9ee5a3d..a55a41b 100644 --- a/object/grpc/service_frostfs.pb.go +++ b/object/grpc/service_frostfs.pb.go @@ -924,7 +924,13 @@ func (x *GetResponse_Body) UnmarshalEasyJSON(in *jlexer.Lexer) { x.ObjectPart = xx { var f []byte - f = in.Bytes() + { + tmp := in.Bytes() + if len(tmp) == 0 { + tmp = nil + } + f = tmp + } xx.Chunk = f } case "splitInfo": @@ -1699,7 +1705,13 @@ func (x *PutRequest_Body) UnmarshalEasyJSON(in *jlexer.Lexer) { x.ObjectPart = xx { var f []byte - f = in.Bytes() + { + tmp := in.Bytes() + if len(tmp) == 0 { + tmp = nil + } + f = tmp + } xx.Chunk = f } } @@ -6254,7 +6266,13 @@ func (x *GetRangeResponse_Body) UnmarshalEasyJSON(in *jlexer.Lexer) { x.RangePart = xx { var f []byte - f = in.Bytes() + { + tmp := in.Bytes() + if len(tmp) == 0 { + tmp = nil + } + f = tmp + } xx.Chunk = f } case "splitInfo": @@ -6802,7 +6820,13 @@ func (x *GetRangeHashRequest_Body) UnmarshalEasyJSON(in *jlexer.Lexer) { case "salt": { var f []byte - f = in.Bytes() + { + tmp := in.Bytes() + if len(tmp) == 0 { + tmp = nil + } + f = tmp + } x.Salt = f } case "type": @@ -7267,7 +7291,13 @@ func (x *GetRangeHashResponse_Body) UnmarshalEasyJSON(in *jlexer.Lexer) { var list [][]byte in.Delim('[') for !in.IsDelim(']') { - f = in.Bytes() + { + tmp := in.Bytes() + if len(tmp) == 0 { + tmp = nil + } + f = tmp + } list = append(list, f) in.WantComma() } @@ -8455,7 +8485,13 @@ func (x *PatchRequest_Body_Patch) UnmarshalEasyJSON(in *jlexer.Lexer) { case "chunk": { var f []byte - f = in.Bytes() + { + tmp := in.Bytes() + if len(tmp) == 0 { + tmp = nil + } + f = tmp + } x.Chunk = f } } diff --git a/object/grpc/types_frostfs.pb.go b/object/grpc/types_frostfs.pb.go index e4a916f..a6d4f01 100644 --- a/object/grpc/types_frostfs.pb.go +++ b/object/grpc/types_frostfs.pb.go @@ -1015,7 +1015,13 @@ func (x *Header_Split) UnmarshalEasyJSON(in *jlexer.Lexer) { case "splitID": { var f []byte - f = in.Bytes() + { + tmp := in.Bytes() + if len(tmp) == 0 { + tmp = nil + } + f = tmp + } x.SplitId = f } } @@ -1436,13 +1442,25 @@ func (x *Header_EC) UnmarshalEasyJSON(in *jlexer.Lexer) { case "header": { var f []byte - f = in.Bytes() + { + tmp := in.Bytes() + if len(tmp) == 0 { + tmp = nil + } + f = tmp + } x.Header = f } case "parentSplitID": { var f []byte - f = in.Bytes() + { + tmp := in.Bytes() + if len(tmp) == 0 { + tmp = nil + } + f = tmp + } x.ParentSplitId = f } case "parentSplitParentID": @@ -2347,7 +2365,13 @@ func (x *Object) UnmarshalEasyJSON(in *jlexer.Lexer) { case "payload": { var f []byte - f = in.Bytes() + { + tmp := in.Bytes() + if len(tmp) == 0 { + tmp = nil + } + f = tmp + } x.Payload = f } } @@ -2552,7 +2576,13 @@ func (x *SplitInfo) UnmarshalEasyJSON(in *jlexer.Lexer) { case "splitId": { var f []byte - f = in.Bytes() + { + tmp := in.Bytes() + if len(tmp) == 0 { + tmp = nil + } + f = tmp + } x.SplitId = f } case "lastPart": diff --git a/refs/grpc/types_frostfs.pb.go b/refs/grpc/types_frostfs.pb.go index 5a16f8e..f2a2663 100644 --- a/refs/grpc/types_frostfs.pb.go +++ b/refs/grpc/types_frostfs.pb.go @@ -390,7 +390,13 @@ func (x *ObjectID) UnmarshalEasyJSON(in *jlexer.Lexer) { case "value": { var f []byte - f = in.Bytes() + { + tmp := in.Bytes() + if len(tmp) == 0 { + tmp = nil + } + f = tmp + } x.Value = f } } @@ -529,7 +535,13 @@ func (x *ContainerID) UnmarshalEasyJSON(in *jlexer.Lexer) { case "value": { var f []byte - f = in.Bytes() + { + tmp := in.Bytes() + if len(tmp) == 0 { + tmp = nil + } + f = tmp + } x.Value = f } } @@ -668,7 +680,13 @@ func (x *OwnerID) UnmarshalEasyJSON(in *jlexer.Lexer) { case "value": { var f []byte - f = in.Bytes() + { + tmp := in.Bytes() + if len(tmp) == 0 { + tmp = nil + } + f = tmp + } x.Value = f } } @@ -1063,13 +1081,25 @@ func (x *Signature) UnmarshalEasyJSON(in *jlexer.Lexer) { case "key": { var f []byte - f = in.Bytes() + { + tmp := in.Bytes() + if len(tmp) == 0 { + tmp = nil + } + f = tmp + } x.Key = f } case "signature": { var f []byte - f = in.Bytes() + { + tmp := in.Bytes() + if len(tmp) == 0 { + tmp = nil + } + f = tmp + } x.Sign = f } case "scheme": @@ -1264,13 +1294,25 @@ func (x *SignatureRFC6979) UnmarshalEasyJSON(in *jlexer.Lexer) { case "key": { var f []byte - f = in.Bytes() + { + tmp := in.Bytes() + if len(tmp) == 0 { + tmp = nil + } + f = tmp + } x.Key = f } case "signature": { var f []byte - f = in.Bytes() + { + tmp := in.Bytes() + if len(tmp) == 0 { + tmp = nil + } + f = tmp + } x.Sign = f } } @@ -1466,7 +1508,13 @@ func (x *Checksum) UnmarshalEasyJSON(in *jlexer.Lexer) { case "sum": { var f []byte - f = in.Bytes() + { + tmp := in.Bytes() + if len(tmp) == 0 { + tmp = nil + } + f = tmp + } x.Sum = f } } diff --git a/session/grpc/service_frostfs.pb.go b/session/grpc/service_frostfs.pb.go index 6d3ea9f..26213b9 100644 --- a/session/grpc/service_frostfs.pb.go +++ b/session/grpc/service_frostfs.pb.go @@ -598,13 +598,25 @@ func (x *CreateResponse_Body) UnmarshalEasyJSON(in *jlexer.Lexer) { case "id": { var f []byte - f = in.Bytes() + { + tmp := in.Bytes() + if len(tmp) == 0 { + tmp = nil + } + f = tmp + } x.Id = f } case "sessionKey": { var f []byte - f = in.Bytes() + { + tmp := in.Bytes() + if len(tmp) == 0 { + tmp = nil + } + f = tmp + } x.SessionKey = f } } diff --git a/session/grpc/types_frostfs.pb.go b/session/grpc/types_frostfs.pb.go index e9f3b42..542a02b 100644 --- a/session/grpc/types_frostfs.pb.go +++ b/session/grpc/types_frostfs.pb.go @@ -1284,7 +1284,13 @@ func (x *SessionToken_Body) UnmarshalEasyJSON(in *jlexer.Lexer) { case "id": { var f []byte - f = in.Bytes() + { + tmp := in.Bytes() + if len(tmp) == 0 { + tmp = nil + } + f = tmp + } x.Id = f } case "ownerID": @@ -1304,7 +1310,13 @@ func (x *SessionToken_Body) UnmarshalEasyJSON(in *jlexer.Lexer) { case "sessionKey": { var f []byte - f = in.Bytes() + { + tmp := in.Bytes() + if len(tmp) == 0 { + tmp = nil + } + f = tmp + } x.SessionKey = f } case "object": diff --git a/status/grpc/types_frostfs.pb.go b/status/grpc/types_frostfs.pb.go index 1d8b477..6c62a0f 100644 --- a/status/grpc/types_frostfs.pb.go +++ b/status/grpc/types_frostfs.pb.go @@ -439,7 +439,13 @@ func (x *Status_Detail) UnmarshalEasyJSON(in *jlexer.Lexer) { case "value": { var f []byte - f = in.Bytes() + { + tmp := in.Bytes() + if len(tmp) == 0 { + tmp = nil + } + f = tmp + } x.Value = f } } diff --git a/tombstone/grpc/types_frostfs.pb.go b/tombstone/grpc/types_frostfs.pb.go index acb1836..e56832a 100644 --- a/tombstone/grpc/types_frostfs.pb.go +++ b/tombstone/grpc/types_frostfs.pb.go @@ -231,7 +231,13 @@ func (x *Tombstone) UnmarshalEasyJSON(in *jlexer.Lexer) { case "splitID": { var f []byte - f = in.Bytes() + { + tmp := in.Bytes() + if len(tmp) == 0 { + tmp = nil + } + f = tmp + } x.SplitId = f } case "members": diff --git a/util/proto/marshal_test.go b/util/proto/marshal_test.go index 5498cf9..29af711 100644 --- a/util/proto/marshal_test.go +++ b/util/proto/marshal_test.go @@ -50,9 +50,6 @@ func TestStableMarshalSingle(t *testing.T) { var actualFrostfs generated.Primitives require.NoError(t, actualFrostfs.UnmarshalJSON(r)) - if len(actualFrostfs.FieldA) == 0 { - actualFrostfs.FieldA = nil - } require.Equal(t, input, &actualFrostfs) primitivesEqual(t, input, &actual) @@ -110,9 +107,6 @@ func TestStableMarshalSingle(t *testing.T) { var actualFrostfs generated.Primitives require.NoError(t, actualFrostfs.UnmarshalJSON(r)) - if len(actualFrostfs.FieldA) == 0 { - actualFrostfs.FieldA = nil - } require.Equal(t, tc.input, &actualFrostfs) primitivesEqual(t, tc.input, &actual) @@ -124,9 +118,7 @@ func TestStableMarshalSingle(t *testing.T) { func primitivesEqual(t *testing.T, a *generated.Primitives, b *test.Primitives) { // Compare each field directly, because proto-generated code has private fields. require.Equal(t, len(a.FieldA), len(b.FieldA)) - if len(a.FieldA) != 0 { - require.Equal(t, a.FieldA, b.FieldA) - } + require.Equal(t, a.FieldA, b.FieldA) require.Equal(t, a.FieldB, b.FieldB) require.Equal(t, a.FieldC, b.FieldC) require.Equal(t, a.FieldD, b.FieldD) diff --git a/util/proto/test/custom/test_frostfs.pb.go b/util/proto/test/custom/test_frostfs.pb.go index f979038..5ef95a6 100644 --- a/util/proto/test/custom/test_frostfs.pb.go +++ b/util/proto/test/custom/test_frostfs.pb.go @@ -771,7 +771,13 @@ func (x *Primitives) UnmarshalEasyJSON(in *jlexer.Lexer) { case "fieldA": { var f []byte - f = in.Bytes() + { + tmp := in.Bytes() + if len(tmp) == 0 { + tmp = nil + } + f = tmp + } x.FieldA = f } case "fieldB": @@ -903,7 +909,13 @@ func (x *Primitives) UnmarshalEasyJSON(in *jlexer.Lexer) { x.FieldM = xx { var f []byte - f = in.Bytes() + { + tmp := in.Bytes() + if len(tmp) == 0 { + tmp = nil + } + f = tmp + } xx.FieldMa = f } case "fieldMe": @@ -1520,7 +1532,13 @@ func (x *RepPrimitives) UnmarshalEasyJSON(in *jlexer.Lexer) { var list [][]byte in.Delim('[') for !in.IsDelim(']') { - f = in.Bytes() + { + tmp := in.Bytes() + if len(tmp) == 0 { + tmp = nil + } + f = tmp + } list = append(list, f) in.WantComma() } diff --git a/util/protogen/internalgengo/json.go b/util/protogen/internalgengo/json.go index 15facfd..55c9cd3 100644 --- a/util/protogen/internalgengo/json.go +++ b/util/protogen/internalgengo/json.go @@ -129,7 +129,17 @@ func emitJSONFieldRead(g *protogen.GeneratedFile, f *protogen.Field, name string case protoreflect.StringKind: template = "%s = in.String()" case protoreflect.BytesKind: - template = "%s = in.Bytes()" + // Since some time ago proto3 support optional keyword, thus the presence is not tracked by default: + // https://github.com/protocolbuffers/protobuf-go/blob/fb995f184a1719ec42b247a3771d1036d92adf67/internal/impl/message_reflect_field.go#L327 + // We do not explicitly support `optional` keyword, protoc will fail on such fileds. + // Thus, treat empty string as `[]byte(nil)`. + template = `{ + tmp := in.Bytes() + if len(tmp) == 0 { + tmp = nil + } + %s = tmp + }` case protoreflect.MessageKind: if f.Desc.IsList() { g.P("f = ", fieldType(g, f)[2:], "{}") From f0fc40e116d13869bb8a21761749d7666137e15b Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Fri, 11 Oct 2024 10:28:55 +0300 Subject: [PATCH 1194/1196] [#123] Resolve funlen linter issue Signed-off-by: Evgenii Stratonikov --- util/protogen/internalgengo/json.go | 34 ++++++++++++++++------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/util/protogen/internalgengo/json.go b/util/protogen/internalgengo/json.go index 55c9cd3..20730a6 100644 --- a/util/protogen/internalgengo/json.go +++ b/util/protogen/internalgengo/json.go @@ -70,6 +70,24 @@ func emitJSONParseInteger(g *protogen.GeneratedFile, ident string, method string g.P(ident, " := ", typ, "(v)") } +func emitJSONReadEnum(g *protogen.GeneratedFile, name string, enumType string) { + g.P(`switch v := in.Interface().(type) { + case string: + if vv, ok := `+enumType+`_value[v]; ok { + `+name+` = `+enumType+`(vv) + break + } + vv, err := `, strconvPackage.Ident("ParseInt"), `(v, 10, 32) + if err != nil { + in.AddError(err) + return + } + `+name+` = `+enumType+`(vv) + case float64: + `+name+` = `+enumType+`(v) + }`) +} + func emitJSONFieldRead(g *protogen.GeneratedFile, f *protogen.Field, name string) { g.P("{") defer g.P("}") @@ -94,21 +112,7 @@ func emitJSONFieldRead(g *protogen.GeneratedFile, f *protogen.Field, name string enumType := fieldType(g, f).String() g.P("var parsedValue " + enumType) - g.P(`switch v := in.Interface().(type) { - case string: - if vv, ok := `+enumType+`_value[v]; ok { - parsedValue = `+enumType+`(vv) - break - } - vv, err := `, strconvPackage.Ident("ParseInt"), `(v, 10, 32) - if err != nil { - in.AddError(err) - return - } - parsedValue = `+enumType+`(vv) - case float64: - parsedValue = `+enumType+`(v) - }`) + emitJSONReadEnum(g, "parsedValue", enumType) template = "%s = parsedValue" case protoreflect.Int32Kind, protoreflect.Sint32Kind, protoreflect.Sfixed32Kind: emitJSONParseInteger(g, "pv", "ParseInt", 32, "int32") From 2bdee4c9e6d9d6d1b9a85f11b3943d966c9e5569 Mon Sep 17 00:00:00 2001 From: Vitaliy Potyarkin Date: Wed, 6 Nov 2024 13:37:41 +0300 Subject: [PATCH 1195/1196] [#126] Stop using obsolete .github directory This commit is a part of multi-repo cleanup effort: https://git.frostfs.info/TrueCloudLab/frostfs-infra/issues/136 Signed-off-by: Vitaliy Potyarkin --- .../ISSUE_TEMPLATE/bug_report.md | 0 .../ISSUE_TEMPLATE/config.yml | 0 .../ISSUE_TEMPLATE/feature_request.md | 0 .forgejo/logo.svg | 70 +++++++++++++++++++ .github/CODEOWNERS | 1 - CODEOWNERS | 1 + CONTRIBUTING.md | 5 +- README.md | 2 +- docs/release-instruction.md | 8 +-- 9 files changed, 79 insertions(+), 8 deletions(-) rename {.github => .forgejo}/ISSUE_TEMPLATE/bug_report.md (100%) rename {.github => .forgejo}/ISSUE_TEMPLATE/config.yml (100%) rename {.github => .forgejo}/ISSUE_TEMPLATE/feature_request.md (100%) create mode 100644 .forgejo/logo.svg delete mode 100644 .github/CODEOWNERS create mode 100644 CODEOWNERS diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.forgejo/ISSUE_TEMPLATE/bug_report.md similarity index 100% rename from .github/ISSUE_TEMPLATE/bug_report.md rename to .forgejo/ISSUE_TEMPLATE/bug_report.md diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.forgejo/ISSUE_TEMPLATE/config.yml similarity index 100% rename from .github/ISSUE_TEMPLATE/config.yml rename to .forgejo/ISSUE_TEMPLATE/config.yml diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.forgejo/ISSUE_TEMPLATE/feature_request.md similarity index 100% rename from .github/ISSUE_TEMPLATE/feature_request.md rename to .forgejo/ISSUE_TEMPLATE/feature_request.md diff --git a/.forgejo/logo.svg b/.forgejo/logo.svg new file mode 100644 index 0000000..148c359 --- /dev/null +++ b/.forgejo/logo.svg @@ -0,0 +1,70 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS deleted file mode 100644 index b3c6cfa..0000000 --- a/.github/CODEOWNERS +++ /dev/null @@ -1 +0,0 @@ -* @TrueCloudLab/storage-core @TrueCloudLab/storage-services @TrueCloudLab/committers diff --git a/CODEOWNERS b/CODEOWNERS new file mode 100644 index 0000000..276d26f --- /dev/null +++ b/CODEOWNERS @@ -0,0 +1 @@ +.* @TrueCloudLab/storage-core @TrueCloudLab/storage-services @TrueCloudLab/committers diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index dd360b5..eb8061d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -25,7 +25,8 @@ Start by forking the `frostfs-api-go` repository, make changes in a branch and t send a pull request. We encourage pull requests to discuss code changes. Here are the steps in details: -### Set up your GitHub Repository +### Set up your repository + Fork [FrostFS node upstream](https://git.frostfs.info/TrueCloudLab/frostfs-api-go/fork) source repository to your own personal repository. Copy the URL of your fork (you will need it for the `git clone` command below). @@ -86,7 +87,7 @@ $ git push origin feature/123-something_awesome ``` ### Create a Pull Request -Pull requests can be created via GitHub. Refer to [this +Pull requests can be created via git.frostfs.info. Refer to [this document](https://help.github.com/articles/creating-a-pull-request/) for detailed steps on how to create a pull request. After a Pull Request gets peer reviewed and approved, it will be merged. diff --git a/README.md b/README.md index a6e7b6f..4ea5d8a 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@

-FrostFS +FrostFS

Low-level Golang API for FrostFS diff --git a/docs/release-instruction.md b/docs/release-instruction.md index 4134f1c..d9b4e90 100644 --- a/docs/release-instruction.md +++ b/docs/release-instruction.md @@ -35,11 +35,11 @@ Tag a release (must be signed) and push it: $ git tag -s vX.Y.Z[-rc.N] && git push origin vX.Y.Z[-rc.N] ``` -## Make a Github release +## Make a proper release -Using Github's web interface create a new release based on just created tag +Using git.frostfs.info web interface create a new release based on just created tag with the same changes from changelog and publish it. -## Close github milestone +## Close milestone -Close corresponding vX.Y.Z github milestone. +Close corresponding vX.Y.Z milestone. From 557267a07beb045d8848b0be3d96ace72d6b70ce Mon Sep 17 00:00:00 2001 From: Vitaliy Potyarkin Date: Tue, 10 Dec 2024 12:37:53 +0300 Subject: [PATCH 1196/1196] [#126] Refine CODEOWNERS settings Signed-off-by: Vitaliy Potyarkin --- CODEOWNERS | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CODEOWNERS b/CODEOWNERS index 276d26f..b428c89 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -1 +1,2 @@ -.* @TrueCloudLab/storage-core @TrueCloudLab/storage-services @TrueCloudLab/committers +.* @TrueCloudLab/storage-core-committers @TrueCloudLab/storage-core-developers @TrueCloudLab/storage-services-committers @TrueCloudLab/storage-services-developers +.forgejo/.* @potyarkin